From: Andrea Amorese Date: Tue, 9 Nov 2021 10:08:24 +0000 (+0100) Subject: Built motion from commit 529ebfd3.|2.5.37 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;//%22avatar.png/%22?a=commitdiff_plain;h=a4c5238f32604e77f88c9860ed6d9eff8756488a;p=motion2.git Built motion from commit 529ebfd3.|2.5.37 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index fcec2f3..2a03b58 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-11-09T09:24:34.676Z", + "time": "2021-11-09T09:50:24.084Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index e26f67f..0009905 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-11-09T09:24:34.676Z", + "time": "2021-11-09T09:50:24.084Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index b807415..364deb5 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 _0x52a6=['urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','sequelize','exports','getDataValue','action','contactManager','motionbar','urlForward','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'];(function(_0x35035e,_0x26bc1d){var _0x3a042f=function(_0x38d4e3){while(--_0x38d4e3){_0x35035e['push'](_0x35035e['shift']());}};_0x3a042f(++_0x26bc1d);}(_0x52a6,0x16e));var _0x652a=function(_0x50237b,_0x4ca696){_0x50237b=_0x50237b-0x0;var _0xd7ae74=_0x52a6[_0x50237b];return _0xd7ae74;};'use strict';var Sequelize=require(_0x652a('0x0'));module[_0x652a('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2f6465){return this[_0x652a('0x2')](_0x652a('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x652a('0x4'),'integration',_0x652a('0x5'),'jscripty',_0x652a('0x6'),'browser','bot',_0x652a('0x7')]],'msg':_0x652a('0x8')}},'comment':_0x652a('0x8')},'data1':{'type':Sequelize[_0x652a('0x9')](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[_0x652a('0x9')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x652a('0xa')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x652a('0xb')},'data6':{'type':Sequelize[_0x652a('0x9')],'comments':_0x652a('0xc')},'data7':{'type':Sequelize['TEXT'],'comments':_0x652a('0xd')}}; \ No newline at end of file +var _0x598d=['urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','contactManager','motionbar','urlForward','bot','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]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'];(function(_0x87d4df,_0xa67ee3){var _0x2cea8d=function(_0x5be174){while(--_0x5be174){_0x87d4df['push'](_0x87d4df['shift']());}};_0x2cea8d(++_0xa67ee3);}(_0x598d,0x190));var _0xd598=function(_0x14b622,_0xbf2f5){_0x14b622=_0x14b622-0x0;var _0x17b23b=_0x598d[_0x14b622];return _0x17b23b;};'use strict';var Sequelize=require(_0xd598('0x0'));module[_0xd598('0x1')]={'name':{'type':Sequelize[_0xd598('0x2')],'get':function(_0x58f591){return this[_0xd598('0x3')]('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xd598('0x4'),'integration',_0xd598('0x5'),'jscripty',_0xd598('0x6'),'browser',_0xd598('0x7'),_0xd598('0x8')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xd598('0x9')},'data1':{'type':Sequelize[_0xd598('0xa')](0x1000),'comment':_0xd598('0xb')},'data2':{'type':Sequelize[_0xd598('0xa')](0x1000),'comment':_0xd598('0xc')},'data3':{'type':Sequelize[_0xd598('0xa')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0xd598('0xa')](0x1000),'comments':_0xd598('0xd')},'data5':{'type':Sequelize[_0xd598('0xa')](0x1000),'comments':_0xd598('0xe')},'data6':{'type':Sequelize[_0xd598('0xa')],'comments':_0xd598('0xf')},'data7':{'type':Sequelize[_0xd598('0x10')],'comments':_0xd598('0x11')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index a8ae00c..b0d4193 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 _0x33cb=['end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','body','Action','params','catch','destroy','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x4a310d,_0x33322d){var _0x5eaf36=function(_0x233014){while(--_0x233014){_0x4a310d['push'](_0x4a310d['shift']());}};_0x5eaf36(++_0x33322d);}(_0x33cb,0x72));var _0xb33c=function(_0x1b3533,_0x4b056e){_0x1b3533=_0x1b3533-0x0;var _0x268c8b=_0x33cb[_0x1b3533];return _0x268c8b;};'use strict';var emlformat=require(_0xb33c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb33c('0x1'));var jsonpatch=require(_0xb33c('0x2'));var rp=require(_0xb33c('0x3'));var moment=require(_0xb33c('0x4'));var BPromise=require(_0xb33c('0x5'));var Mustache=require(_0xb33c('0x6'));var util=require(_0xb33c('0x7'));var path=require(_0xb33c('0x8'));var sox=require(_0xb33c('0x9'));var csv=require(_0xb33c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb33c('0xb'));var squel=require(_0xb33c('0xc'));var crypto=require(_0xb33c('0xd'));var jsforce=require(_0xb33c('0xe'));var deskjs=require(_0xb33c('0xf'));var toCsv=require(_0xb33c('0xa'));var querystring=require(_0xb33c('0x10'));var Papa=require(_0xb33c('0x11'));var Redis=require('ioredis');var authService=require(_0xb33c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb33c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xb33c('0x14'));var licenseUtil=require(_0xb33c('0x15'));var db=require(_0xb33c('0x16'))['db'];function respondWithStatusCode(_0x466087,_0x180680){_0x180680=_0x180680||0xcc;return function(_0x580c92){if(_0x580c92){return _0x466087['sendStatus'](_0x180680);}return _0x466087[_0xb33c('0x17')](_0x180680)[_0xb33c('0x18')]();};}function respondWithResult(_0x5696c3,_0x560c48){_0x560c48=_0x560c48||0xc8;return function(_0x260ba8){if(_0x260ba8){return _0x5696c3[_0xb33c('0x17')](_0x560c48)[_0xb33c('0x19')](_0x260ba8);}};}function respondWithFilteredResult(_0xa626f8,_0x19a71f){return function(_0x5ec22a){if(_0x5ec22a){var _0x4ea774=typeof _0x19a71f[_0xb33c('0x1a')]==='undefined'&&typeof _0x19a71f[_0xb33c('0x1b')]===_0xb33c('0x1c');var _0x47f213=_0x5ec22a[_0xb33c('0x1d')];var _0x5689c4=_0x4ea774?0x0:_0x19a71f[_0xb33c('0x1a')];var _0x3d5bd2=_0x4ea774?_0x5ec22a[_0xb33c('0x1d')]:_0x19a71f[_0xb33c('0x1a')]+_0x19a71f[_0xb33c('0x1b')];var _0x465073;if(_0x3d5bd2>=_0x47f213){_0x3d5bd2=_0x47f213;_0x465073=0xc8;}else{_0x465073=0xce;}_0xa626f8['status'](_0x465073);return _0xa626f8[_0xb33c('0x1e')](_0xb33c('0x1f'),_0x5689c4+'-'+_0x3d5bd2+'/'+_0x47f213)[_0xb33c('0x19')](_0x5ec22a);}return null;};}function patchUpdates(_0x3507b9){return function(_0x2980a4){try{jsonpatch[_0xb33c('0x20')](_0x2980a4,_0x3507b9,!![]);}catch(_0x4dc92b){return BPromise[_0xb33c('0x21')](_0x4dc92b);}return _0x2980a4['save']();};}function saveUpdates(_0x284f41,_0x14c5c3){return function(_0x300854){if(_0x300854){return _0x300854[_0xb33c('0x22')](_0x284f41)[_0xb33c('0x23')](function(_0x5f091b){return _0x5f091b;});}return null;};}function removeEntity(_0x53ab98,_0x2a6332){return function(_0x3a77e1){if(_0x3a77e1){return _0x3a77e1['destroy']()[_0xb33c('0x23')](function(){_0x53ab98[_0xb33c('0x17')](0xcc)[_0xb33c('0x18')]();});}};}function handleEntityNotFound(_0x34bdae,_0x4f51a8){return function(_0x45e1af){if(!_0x45e1af){_0x34bdae['sendStatus'](0x194);}return _0x45e1af;};}function handleError(_0x539161,_0x5f298f){_0x5f298f=_0x5f298f||0x1f4;return function(_0x32d86e){logger[_0xb33c('0x24')](_0x32d86e[_0xb33c('0x25')]);if(_0x32d86e['name']){delete _0x32d86e[_0xb33c('0x26')];}_0x539161[_0xb33c('0x17')](_0x5f298f)[_0xb33c('0x27')](_0x32d86e);};}exports[_0xb33c('0x22')]=function(_0x192ee9,_0x263617){if(_0x192ee9[_0xb33c('0x28')]['id']){delete _0x192ee9[_0xb33c('0x28')]['id'];}return db[_0xb33c('0x29')]['find']({'where':{'id':_0x192ee9[_0xb33c('0x2a')]['id']}})[_0xb33c('0x23')](handleEntityNotFound(_0x263617,null))[_0xb33c('0x23')](saveUpdates(_0x192ee9[_0xb33c('0x28')],null))[_0xb33c('0x23')](respondWithResult(_0x263617,null))[_0xb33c('0x2b')](handleError(_0x263617,null));};exports[_0xb33c('0x2c')]=function(_0x3a7189,_0x145ac4){return db['Action'][_0xb33c('0x2d')]({'where':{'id':_0x3a7189[_0xb33c('0x2a')]['id']}})[_0xb33c('0x23')](handleEntityNotFound(_0x145ac4,null))[_0xb33c('0x23')](removeEntity(_0x145ac4,null))[_0xb33c('0x2b')](handleError(_0x145ac4,null));}; \ No newline at end of file +var _0x5860=['save','update','destroy','then','stack','name','send','body','Action','find','catch','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','Content-Range','reject'];(function(_0xd9dd5e,_0x45b072){var _0x1e4351=function(_0x46e230){while(--_0x46e230){_0xd9dd5e['push'](_0xd9dd5e['shift']());}};_0x1e4351(++_0x45b072);}(_0x5860,0x155));var _0x0586=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5860[_0x4243a3];return _0x1b2a33;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0586('0x0'));var jsonpatch=require(_0x0586('0x1'));var rp=require(_0x0586('0x2'));var moment=require(_0x0586('0x3'));var BPromise=require(_0x0586('0x4'));var Mustache=require(_0x0586('0x5'));var util=require(_0x0586('0x6'));var path=require(_0x0586('0x7'));var sox=require(_0x0586('0x8'));var csv=require(_0x0586('0x9'));var ejs=require(_0x0586('0xa'));var fs=require('fs');var fs_extra=require(_0x0586('0xb'));var _=require('lodash');var squel=require(_0x0586('0xc'));var crypto=require(_0x0586('0xd'));var jsforce=require(_0x0586('0xe'));var deskjs=require(_0x0586('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0586('0x10'));var Papa=require(_0x0586('0x11'));var Redis=require(_0x0586('0x12'));var authService=require(_0x0586('0x13'));var qs=require(_0x0586('0x14'));var as=require(_0x0586('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0586('0x16'))(_0x0586('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0586('0x18'));var db=require(_0x0586('0x19'))['db'];function respondWithStatusCode(_0x3e27ce,_0x572479){_0x572479=_0x572479||0xcc;return function(_0x5d10fd){if(_0x5d10fd){return _0x3e27ce[_0x0586('0x1a')](_0x572479);}return _0x3e27ce[_0x0586('0x1b')](_0x572479)[_0x0586('0x1c')]();};}function respondWithResult(_0x459690,_0x518100){_0x518100=_0x518100||0xc8;return function(_0x5eb87e){if(_0x5eb87e){return _0x459690['status'](_0x518100)['json'](_0x5eb87e);}};}function respondWithFilteredResult(_0x2c2403,_0x24cba9){return function(_0x190584){if(_0x190584){var _0x21e4df=typeof _0x24cba9[_0x0586('0x1d')]===_0x0586('0x1e')&&typeof _0x24cba9[_0x0586('0x1f')]==='undefined';var _0x2a3866=_0x190584['count'];var _0x24274d=_0x21e4df?0x0:_0x24cba9['offset'];var _0x4ee561=_0x21e4df?_0x190584['count']:_0x24cba9[_0x0586('0x1d')]+_0x24cba9[_0x0586('0x1f')];var _0x1604a7;if(_0x4ee561>=_0x2a3866){_0x4ee561=_0x2a3866;_0x1604a7=0xc8;}else{_0x1604a7=0xce;}_0x2c2403[_0x0586('0x1b')](_0x1604a7);return _0x2c2403[_0x0586('0x20')](_0x0586('0x21'),_0x24274d+'-'+_0x4ee561+'/'+_0x2a3866)['json'](_0x190584);}return null;};}function patchUpdates(_0x4bc04b){return function(_0x436279){try{jsonpatch['apply'](_0x436279,_0x4bc04b,!![]);}catch(_0x253acd){return BPromise[_0x0586('0x22')](_0x253acd);}return _0x436279[_0x0586('0x23')]();};}function saveUpdates(_0xf70706,_0x3f64b8){return function(_0x48b227){if(_0x48b227){return _0x48b227[_0x0586('0x24')](_0xf70706)['then'](function(_0x415108){return _0x415108;});}return null;};}function removeEntity(_0x41746e,_0x3560cd){return function(_0x89caaa){if(_0x89caaa){return _0x89caaa[_0x0586('0x25')]()[_0x0586('0x26')](function(){_0x41746e[_0x0586('0x1b')](0xcc)[_0x0586('0x1c')]();});}};}function handleEntityNotFound(_0x40cc7d,_0x5305a5){return function(_0x421ed5){if(!_0x421ed5){_0x40cc7d[_0x0586('0x1a')](0x194);}return _0x421ed5;};}function handleError(_0x27c51b,_0x350af0){_0x350af0=_0x350af0||0x1f4;return function(_0x3e7fe7){logger['error'](_0x3e7fe7[_0x0586('0x27')]);if(_0x3e7fe7[_0x0586('0x28')]){delete _0x3e7fe7[_0x0586('0x28')];}_0x27c51b[_0x0586('0x1b')](_0x350af0)[_0x0586('0x29')](_0x3e7fe7);};}exports[_0x0586('0x24')]=function(_0x42d61e,_0x42dc96){if(_0x42d61e['body']['id']){delete _0x42d61e[_0x0586('0x2a')]['id'];}return db[_0x0586('0x2b')][_0x0586('0x2c')]({'where':{'id':_0x42d61e['params']['id']}})[_0x0586('0x26')](handleEntityNotFound(_0x42dc96,null))[_0x0586('0x26')](saveUpdates(_0x42d61e[_0x0586('0x2a')],null))[_0x0586('0x26')](respondWithResult(_0x42dc96,null))[_0x0586('0x2d')](handleError(_0x42dc96,null));};exports[_0x0586('0x25')]=function(_0x197994,_0x69029c){return db[_0x0586('0x2b')][_0x0586('0x2c')]({'where':{'id':_0x197994[_0x0586('0x2e')]['id']}})[_0x0586('0x26')](handleEntityNotFound(_0x69029c,null))['then'](removeEntity(_0x69029c,null))[_0x0586('0x2d')](handleError(_0x69029c,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 1112a93..cc31554 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 _0xc648=['../../config/logger','api','moment','bluebird','request-promise','path','exports','define','tools_actions','util'];(function(_0x3b5582,_0x378b12){var _0x1ffbfa=function(_0x1037bc){while(--_0x1037bc){_0x3b5582['push'](_0x3b5582['shift']());}};_0x1ffbfa(++_0x378b12);}(_0xc648,0x171));var _0x8c64=function(_0x32c8a1,_0x1bc3ef){_0x32c8a1=_0x32c8a1-0x0;var _0x6f2460=_0xc648[_0x32c8a1];return _0x6f2460;};'use strict';var _=require('lodash');var util=require(_0x8c64('0x0'));var logger=require(_0x8c64('0x1'))(_0x8c64('0x2'));var moment=require(_0x8c64('0x3'));var BPromise=require(_0x8c64('0x4'));var rp=require(_0x8c64('0x5'));var fs=require('fs');var path=require(_0x8c64('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./action.attributes');module[_0x8c64('0x7')]=function(_0x449786,_0xb31493){return _0x449786[_0x8c64('0x8')]('Action',attributes,{'tableName':_0x8c64('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41d0=['../../config/environment','./action.attributes','exports','Action','tools_actions','lodash','util','../../config/logger','moment','path','rimraf'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x41d0,0x191));var _0x041d=function(_0x2158a8,_0x335f85){_0x2158a8=_0x2158a8-0x0;var _0x4b1071=_0x41d0[_0x2158a8];return _0x4b1071;};'use strict';var _=require(_0x041d('0x0'));var util=require(_0x041d('0x1'));var logger=require(_0x041d('0x2'))('api');var moment=require(_0x041d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x041d('0x4'));var rimraf=require(_0x041d('0x5'));var config=require(_0x041d('0x6'));var attributes=require(_0x041d('0x7'));module[_0x041d('0x8')]=function(_0x16ce18,_0x566423){return _0x16ce18['define'](_0x041d('0x9'),attributes,{'tableName':_0x041d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 02063e8..4f01f96 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 _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x5bde9c,_0x4fe416){var _0x1943ba=function(_0x4954d2){while(--_0x4954d2){_0x5bde9c['push'](_0x5bde9c['shift']());}};_0x1943ba(++_0x4fe416);}(_0x5fc3,0xa8));var _0x35fc=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x5fc3[_0x15c421];return _0x5e5ed5;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Action,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Action,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file +var _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(_0x35753d,_0x5588a6){var _0x762e5c=function(_0x5648b6){while(--_0x5648b6){_0x35753d['push'](_0x35753d['shift']());}};_0x762e5c(++_0x5588a6);}(_0x326f,0xd1));var _0xf326=function(_0x376e68,_0x100437){_0x376e68=_0x376e68-0x0;var _0x37709b=_0x326f[_0x376e68];return _0x37709b;};'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 diff --git a/server/api/action/index.js b/server/api/action/index.js index 1d7c0a8..6987b1c 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 _0xe775=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','destroy','multer','path'];(function(_0x4c3ece,_0x57053e){var _0x409c1d=function(_0x411a3b){while(--_0x411a3b){_0x4c3ece['push'](_0x4c3ece['shift']());}};_0x409c1d(++_0x57053e);}(_0xe775,0x124));var _0x5e77=function(_0x30f5bb,_0x4db4bd){_0x30f5bb=_0x30f5bb-0x0;var _0x1cfc00=_0xe775[_0x30f5bb];return _0x1cfc00;};'use strict';var multer=require(_0x5e77('0x0'));var util=require('util');var path=require(_0x5e77('0x1'));var timeout=require(_0x5e77('0x2'));var express=require(_0x5e77('0x3'));var router=express[_0x5e77('0x4')]();var fs_extra=require(_0x5e77('0x5'));var auth=require(_0x5e77('0x6'));var interaction=require(_0x5e77('0x7'));var config=require(_0x5e77('0x8'));var controller=require(_0x5e77('0x9'));router[_0x5e77('0xa')](_0x5e77('0xb'),auth[_0x5e77('0xc')](),controller['update']);router['delete']('/:id',auth[_0x5e77('0xc')](),controller[_0x5e77('0xd')]);module['exports']=router; \ No newline at end of file +var _0xbd9e=['../../config/environment','put','isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x1ed735,_0x427bc1){var _0x465b2d=function(_0xf24129){while(--_0xf24129){_0x1ed735['push'](_0x1ed735['shift']());}};_0x465b2d(++_0x427bc1);}(_0xbd9e,0x165));var _0xebd9=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xbd9e[_0x33032e];return _0x13316b;};'use strict';var multer=require(_0xebd9('0x0'));var util=require(_0xebd9('0x1'));var path=require(_0xebd9('0x2'));var timeout=require(_0xebd9('0x3'));var express=require(_0xebd9('0x4'));var router=express[_0xebd9('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xebd9('0x6'));var config=require(_0xebd9('0x7'));var controller=require('./action.controller');router[_0xebd9('0x8')]('/:id',auth[_0xebd9('0x9')](),controller[_0xebd9('0xa')]);router[_0xebd9('0xb')]('/:id',auth[_0xebd9('0x9')](),controller[_0xebd9('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index c55cd9a..748551b 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 _0x814b=['STRING','TEXT','sequelize','exports'];(function(_0x241af1,_0xf80087){var _0x5bdfee=function(_0x280f5e){while(--_0x280f5e){_0x241af1['push'](_0x241af1['shift']());}};_0x5bdfee(++_0xf80087);}(_0x814b,0x1a2));var _0xb814=function(_0x5d6e35,_0x4d1ac0){_0x5d6e35=_0x5d6e35-0x0;var _0x5d7ada=_0x814b[_0x5d6e35];return _0x5d7ada;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'name':{'type':Sequelize[_0xb814('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb814('0x2')]},'parent':{'type':Sequelize[_0xb814('0x2')]},'table':{'type':Sequelize[_0xb814('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xb814('0x3')]}}; \ No newline at end of file +var _0x3eea=['STRING','TEXT','sequelize'];(function(_0x43a9d2,_0x293d10){var _0x2b443e=function(_0xa5426f){while(--_0xa5426f){_0x43a9d2['push'](_0x43a9d2['shift']());}};_0x2b443e(++_0x293d10);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x4451da,_0x5ead4e){_0x4451da=_0x4451da-0x0;var _0x39d1ed=_0x3eea[_0x4451da];return _0x39d1ed;};'use strict';var Sequelize=require(_0xa3ee('0x0'));module['exports']={'name':{'type':Sequelize[_0xa3ee('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa3ee('0x1')]},'parent':{'type':Sequelize[_0xa3ee('0x1')]},'table':{'type':Sequelize[_0xa3ee('0x1')]},'conditions':{'type':Sequelize[_0xa3ee('0x2')]},'joins':{'type':Sequelize[_0xa3ee('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 32f80bf..0d6eb75 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 _0xece1=['count','offset','Content-Range','apply','save','update','then','destroy','get','CustomReports','error','stack','name','send','index','map','AnalyticCustomReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','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)','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)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','length','field','condition','value','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','metric','function','replace','format','orderBy','order','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','group','debug','Limited\x20Query:','sequelize','toString','SELECT','left_join','COUNT(DISTINCT\x20%s)','MAX(%s)','DATE(%s)','HOUR(%s)','IS\x20NULL','IS\x20EMPTY','getFields','ValidationErrorItem','select','clone','web','%s-%s.%s','randomstring','generate','output','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','savename','COUNT(*)','QueryTypes','runReport','operator','groupBy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','dbH','sendStatus','status','end','json','undefined','limit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xece1,0x89));var _0x1ece=function(_0x3874e2,_0x41d10b){_0x3874e2=_0x3874e2-0x0;var _0x4f3893=_0xece1[_0x3874e2];return _0x4f3893;};'use strict';var emlformat=require(_0x1ece('0x0'));var rimraf=require(_0x1ece('0x1'));var zipdir=require(_0x1ece('0x2'));var jsonpatch=require(_0x1ece('0x3'));var rp=require(_0x1ece('0x4'));var moment=require(_0x1ece('0x5'));var BPromise=require(_0x1ece('0x6'));var Mustache=require(_0x1ece('0x7'));var util=require(_0x1ece('0x8'));var path=require(_0x1ece('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1ece('0xa'));var fs=require('fs');var fs_extra=require(_0x1ece('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1ece('0xc'));var toCsv=require(_0x1ece('0xd'));var querystring=require(_0x1ece('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1ece('0xf'));var qs=require(_0x1ece('0x10'));var as=require(_0x1ece('0x11'));var hardwareService=require(_0x1ece('0x12'));var logger=require(_0x1ece('0x13'))('api');var utils=require(_0x1ece('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1ece('0x15'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x1ece('0x16')];function respondWithStatusCode(_0x20bce5,_0x53b755){_0x53b755=_0x53b755||0xcc;return function(_0x33133b){if(_0x33133b){return _0x20bce5[_0x1ece('0x17')](_0x53b755);}return _0x20bce5[_0x1ece('0x18')](_0x53b755)[_0x1ece('0x19')]();};}function respondWithResult(_0x2beca4,_0x461bae){_0x461bae=_0x461bae||0xc8;return function(_0x398a99){if(_0x398a99){return _0x2beca4[_0x1ece('0x18')](_0x461bae)[_0x1ece('0x1a')](_0x398a99);}};}function respondWithFilteredResult(_0x1d9a70,_0x13fea3){return function(_0x38b65a){if(_0x38b65a){var _0xbb1d21=typeof _0x13fea3['offset']===_0x1ece('0x1b')&&typeof _0x13fea3[_0x1ece('0x1c')]===_0x1ece('0x1b');var _0x1e37c2=_0x38b65a[_0x1ece('0x1d')];var _0x5e6797=_0xbb1d21?0x0:_0x13fea3[_0x1ece('0x1e')];var _0xab18ba=_0xbb1d21?_0x38b65a[_0x1ece('0x1d')]:_0x13fea3[_0x1ece('0x1e')]+_0x13fea3[_0x1ece('0x1c')];var _0x5152f2;if(_0xab18ba>=_0x1e37c2){_0xab18ba=_0x1e37c2;_0x5152f2=0xc8;}else{_0x5152f2=0xce;}_0x1d9a70[_0x1ece('0x18')](_0x5152f2);return _0x1d9a70['set'](_0x1ece('0x1f'),_0x5e6797+'-'+_0xab18ba+'/'+_0x1e37c2)[_0x1ece('0x1a')](_0x38b65a);}return null;};}function patchUpdates(_0x31eff8){return function(_0x175097){try{jsonpatch[_0x1ece('0x20')](_0x175097,_0x31eff8,!![]);}catch(_0x2cd0ec){return BPromise['reject'](_0x2cd0ec);}return _0x175097[_0x1ece('0x21')]();};}function saveUpdates(_0x47b491,_0x53baaf){return function(_0x7ad145){if(_0x7ad145){return _0x7ad145[_0x1ece('0x22')](_0x47b491)[_0x1ece('0x23')](function(_0x27d728){return _0x27d728;});}return null;};}function removeEntity(_0x2dd313,_0x622071){return function(_0x5d0763){if(_0x5d0763){return _0x5d0763[_0x1ece('0x24')]()[_0x1ece('0x23')](function(){var _0x3092aa=_0x5d0763[_0x1ece('0x25')]({'plain':!![]});var _0x1a2a4b=_0x1ece('0x26');return db['UserProfileResource'][_0x1ece('0x24')]({'where':{'type':_0x1a2a4b,'resourceId':_0x3092aa['id']}})[_0x1ece('0x23')](function(){return _0x5d0763;});})[_0x1ece('0x23')](function(){_0x2dd313['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xfcd37d,_0x3998c8){return function(_0x53bc13){if(!_0x53bc13){_0xfcd37d['sendStatus'](0x194);}return _0x53bc13;};}function handleError(_0x19b355,_0xef7598){_0xef7598=_0xef7598||0x1f4;return function(_0x2b95e3){logger[_0x1ece('0x27')](_0x2b95e3[_0x1ece('0x28')]);if(_0x2b95e3[_0x1ece('0x29')]){delete _0x2b95e3[_0x1ece('0x29')];}_0x19b355[_0x1ece('0x18')](_0xef7598)[_0x1ece('0x2a')](_0x2b95e3);};}exports[_0x1ece('0x2b')]=function(_0x90dd81,_0x490acc){var _0x579b7b={},_0x597037={},_0x777c81={'count':0x0,'rows':[]};var _0x382511=_[_0x1ece('0x2c')](db[_0x1ece('0x2d')]['rawAttributes'],function(_0x31ff00){return{'name':_0x31ff00[_0x1ece('0x2e')],'type':_0x31ff00[_0x1ece('0x2f')][_0x1ece('0x30')]};});_0x597037[_0x1ece('0x31')]=_['map'](_0x382511,_0x1ece('0x29'));_0x597037[_0x1ece('0x32')]=_[_0x1ece('0x33')](_0x90dd81[_0x1ece('0x32')]);_0x597037['filters']=_[_0x1ece('0x34')](_0x597037[_0x1ece('0x31')],_0x597037[_0x1ece('0x32')]);_0x579b7b[_0x1ece('0x35')]=_[_0x1ece('0x34')](_0x597037[_0x1ece('0x31')],qs[_0x1ece('0x36')](_0x90dd81[_0x1ece('0x32')]['fields']));_0x579b7b['attributes']=_0x579b7b[_0x1ece('0x35')]['length']?_0x579b7b[_0x1ece('0x35')]:_0x597037['model'];if(!_0x90dd81[_0x1ece('0x32')][_0x1ece('0x37')](_0x1ece('0x38'))){_0x579b7b[_0x1ece('0x1c')]=qs[_0x1ece('0x1c')](_0x90dd81[_0x1ece('0x32')][_0x1ece('0x1c')]);_0x579b7b[_0x1ece('0x1e')]=qs[_0x1ece('0x1e')](_0x90dd81[_0x1ece('0x32')][_0x1ece('0x1e')]);}_0x579b7b['order']=qs['sort'](_0x90dd81['query']['sort']);_0x579b7b[_0x1ece('0x39')]=qs[_0x1ece('0x3a')](_[_0x1ece('0x3b')](_0x90dd81[_0x1ece('0x32')],_0x597037[_0x1ece('0x3a')]),_0x382511);if(_0x90dd81['query'][_0x1ece('0x3c')]){_0x579b7b[_0x1ece('0x39')]=_[_0x1ece('0x3d')](_0x579b7b[_0x1ece('0x39')],{'$or':_['map'](_0x382511,function(_0x398f9a){if(_0x398f9a[_0x1ece('0x2f')]!==_0x1ece('0x3e')){var _0x2ac9e3={};_0x2ac9e3[_0x398f9a[_0x1ece('0x29')]]={'$like':'%'+_0x90dd81['query']['filter']+'%'};return _0x2ac9e3;}})});}_0x579b7b=_[_0x1ece('0x3d')]({},_0x579b7b,_0x90dd81[_0x1ece('0x3f')]);var _0x308065={'where':_0x579b7b[_0x1ece('0x39')]};return db['AnalyticCustomReport'][_0x1ece('0x1d')](_0x308065)[_0x1ece('0x23')](function(_0x233005){_0x777c81[_0x1ece('0x1d')]=_0x233005;if(_0x90dd81[_0x1ece('0x32')][_0x1ece('0x40')]){_0x579b7b[_0x1ece('0x41')]=[{'all':!![]}];}return db[_0x1ece('0x2d')][_0x1ece('0x42')](_0x579b7b);})[_0x1ece('0x23')](function(_0x4f34a8){_0x777c81[_0x1ece('0x43')]=_0x4f34a8;return _0x777c81;})[_0x1ece('0x23')](respondWithFilteredResult(_0x490acc,_0x579b7b))[_0x1ece('0x44')](handleError(_0x490acc,null));};exports[_0x1ece('0x45')]=function(_0x2d5a12,_0x179ff6){var _0xe42606={'raw':![],'where':{'id':_0x2d5a12['params']['id']}},_0x5b8cbe={};_0x5b8cbe[_0x1ece('0x31')]=_[_0x1ece('0x33')](db[_0x1ece('0x2d')][_0x1ece('0x46')]);_0x5b8cbe[_0x1ece('0x32')]=_['keys'](_0x2d5a12[_0x1ece('0x32')]);_0x5b8cbe[_0x1ece('0x3a')]=_[_0x1ece('0x34')](_0x5b8cbe['model'],_0x5b8cbe['query']);_0xe42606['attributes']=_[_0x1ece('0x34')](_0x5b8cbe[_0x1ece('0x31')],qs[_0x1ece('0x36')](_0x2d5a12[_0x1ece('0x32')][_0x1ece('0x36')]));_0xe42606[_0x1ece('0x35')]=_0xe42606['attributes']['length']?_0xe42606[_0x1ece('0x35')]:_0x5b8cbe['model'];if(_0x2d5a12[_0x1ece('0x32')][_0x1ece('0x40')]){_0xe42606[_0x1ece('0x41')]=[{'all':!![]}];}_0xe42606=_[_0x1ece('0x3d')]({},_0xe42606,_0x2d5a12['options']);return db['AnalyticCustomReport'][_0x1ece('0x47')](_0xe42606)['then'](handleEntityNotFound(_0x179ff6,null))[_0x1ece('0x23')](respondWithResult(_0x179ff6,null))[_0x1ece('0x44')](handleError(_0x179ff6,null));};exports[_0x1ece('0x48')]=function(_0x3b0cfd,_0x4ac792){return db[_0x1ece('0x2d')]['create'](_0x3b0cfd[_0x1ece('0x49')],{})['then'](function(_0x4803e8){var _0x21981a=_0x3b0cfd[_0x1ece('0x4a')][_0x1ece('0x25')]({'plain':!![]});if(!_0x21981a)throw new Error(_0x1ece('0x4b'));if(_0x21981a['role']==='user'){var _0x385bf9=_0x4803e8[_0x1ece('0x25')]({'plain':!![]});var _0x359fef=_0x1ece('0x4c');return db[_0x1ece('0x4d')][_0x1ece('0x47')]({'where':{'name':_0x359fef,'userProfileId':_0x21981a[_0x1ece('0x4e')]},'raw':!![]})[_0x1ece('0x23')](function(_0x493287){if(_0x493287&&_0x493287[_0x1ece('0x4f')]===0x0){return db[_0x1ece('0x50')][_0x1ece('0x48')]({'name':_0x385bf9[_0x1ece('0x29')],'resourceId':_0x385bf9['id'],'type':'CustomReports','sectionId':_0x493287['id']},{})['then'](function(){return _0x4803e8;});}else{return _0x4803e8;}})['catch'](function(_0x4bb239){logger[_0x1ece('0x27')](_0x1ece('0x51'),_0x4bb239);throw _0x4bb239;});}return _0x4803e8;})[_0x1ece('0x23')](respondWithResult(_0x4ac792,0xc9))[_0x1ece('0x44')](handleError(_0x4ac792,null));};exports[_0x1ece('0x22')]=function(_0x433326,_0x5e0a6f){if(_0x433326[_0x1ece('0x49')]['id']){delete _0x433326[_0x1ece('0x49')]['id'];}return db[_0x1ece('0x2d')]['find']({'where':{'id':_0x433326['params']['id']}})[_0x1ece('0x23')](handleEntityNotFound(_0x5e0a6f,null))[_0x1ece('0x23')](saveUpdates(_0x433326['body'],null))['then'](respondWithResult(_0x5e0a6f,null))[_0x1ece('0x44')](handleError(_0x5e0a6f,null));};exports[_0x1ece('0x24')]=function(_0x5cf170,_0x11f402){return db[_0x1ece('0x2d')][_0x1ece('0x47')]({'where':{'id':_0x5cf170[_0x1ece('0x52')]['id']}})[_0x1ece('0x23')](handleEntityNotFound(_0x11f402,null))[_0x1ece('0x23')](removeEntity(_0x11f402,null))['catch'](handleError(_0x11f402,null));};exports[_0x1ece('0x53')]=function(_0x291808,_0x53d8e2){var _0x5ad8de=0xa;var _0xf0a71b=[_0x1ece('0x54'),'left_join',_0x1ece('0x55'),_0x1ece('0x56')];var _0x235fb2={'SUM':_0x1ece('0x57'),'COUNT':_0x1ece('0x58'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x1ece('0x59'),'AVG':_0x1ece('0x5a'),'GROUP_CONCAT':_0x1ece('0x5b'),'GROUP_CONCAT ASC':_0x1ece('0x5c'),'GROUP_CONCAT DESC':_0x1ece('0x5d')};var _0x306557={'SEC_TO_TIME':_0x1ece('0x5e'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x1ece('0x5f'),'UNIX_TIMESTAMP':_0x1ece('0x60')};var _0x314404=function(_0x5a542a){return!_[_0x1ece('0x61')](['IS\x20NULL',_0x1ece('0x62'),'IS\x20EMPTY',_0x1ece('0x63')],_0x5a542a);};var _0x4ddcf7=function(_0x3d32b8){if(!_0x3d32b8||!_0x3d32b8['rules']['length']){return'';}for(var _0x2a8b91='(',_0x4cbb72=0x0;_0x4cbb72<_0x3d32b8[_0x1ece('0x64')][_0x1ece('0x65')];_0x4cbb72+=0x1){_0x4cbb72>0x0&&(_0x2a8b91+='\x20'+_0x3d32b8['operator']+'\x20');_0x2a8b91+=_0x3d32b8[_0x1ece('0x64')][_0x4cbb72]['group']?_0x4ddcf7(_0x3d32b8[_0x1ece('0x64')][_0x4cbb72]['group']):_0x3d32b8['rules'][_0x4cbb72][_0x1ece('0x66')]+'\x20'+_0x3d32b8[_0x1ece('0x64')][_0x4cbb72][_0x1ece('0x67')]+(_0x314404(_0x3d32b8[_0x1ece('0x64')][_0x4cbb72][_0x1ece('0x67')])?'\x20'+_0x3d32b8[_0x1ece('0x64')][_0x4cbb72][_0x1ece('0x68')]:'');}return _0x2a8b91+')';};var _0x2e8b80={'where':{'id':_0x291808[_0x1ece('0x52')]['id']}},_0x5ef8af,_0x4ca3b4,_0x59daff,_0x4ae34d,_0x396dbb;_0x2e8b80=_[_0x1ece('0x3d')]({},_0x2e8b80,_0x291808[_0x1ece('0x3f')]);return db[_0x1ece('0x2d')][_0x1ece('0x47')](_0x2e8b80)['then'](function(_0x300b6e){if(_0x300b6e){_0x5ef8af=_0x300b6e;return _0x300b6e['getFields']();}return null;})['then'](function(_0x66b5b4){if(_0x66b5b4){if(!_0x66b5b4[_0x1ece('0x65')]){throw new db[(_0x1ece('0x69'))]['ValidationErrorItem'](_0x1ece('0x6a'),0x193);}_0x4ca3b4=_0x66b5b4;return db[_0x1ece('0x6b')][_0x1ece('0x42')]({'raw':!![]});}return null;})[_0x1ece('0x23')](function(_0x800de8){if(_0x800de8){_0x59daff=_[_0x1ece('0x6c')](_0x800de8,'id');var _0x8c80ce;var _0x34f1e0=squel['select']();_0x34f1e0[_0x1ece('0x6d')](_0x5ef8af[_0x1ece('0x6e')]);for(var _0x2a360d=0x0;_0x2a360d<_0x4ca3b4[_0x1ece('0x65')];_0x2a360d+=0x1){_0x8c80ce=_0x4ca3b4[_0x2a360d]['MetricId']?_0x59daff[_0x4ca3b4[_0x2a360d][_0x1ece('0x6f')]][_0x1ece('0x70')]:_0x4ca3b4[_0x2a360d][_0x1ece('0x66')];_0x8c80ce=_0x4ca3b4[_0x2a360d][_0x1ece('0x71')]?_[_0x1ece('0x72')](_0x235fb2[_0x4ca3b4[_0x2a360d][_0x1ece('0x71')]],'%s',_0x8c80ce):_0x8c80ce;_0x8c80ce=_0x4ca3b4[_0x2a360d][_0x1ece('0x73')]?_[_0x1ece('0x72')](_0x306557[_0x4ca3b4[_0x2a360d]['format']],'%s',_0x8c80ce):_0x8c80ce;if(_0x4ca3b4[_0x2a360d]['groupBy']){_0x34f1e0['group'](_0x8c80ce);}_0x4ca3b4[_0x2a360d][_0x1ece('0x74')]&&_0x34f1e0[_0x1ece('0x75')](_0x8c80ce,_0x4ca3b4[_0x2a360d][_0x1ece('0x74')]===_0x1ece('0x76')?![]:!![]);_0x34f1e0[_0x1ece('0x66')](_0x8c80ce,_0x4ca3b4[_0x2a360d][_0x1ece('0x77')]||_0x8c80ce);}if(_0x5ef8af[_0x1ece('0x78')]){_0x5ef8af[_0x1ece('0x78')]=JSON[_0x1ece('0x79')](_0x5ef8af[_0x1ece('0x78')]);for(var _0x4e0aef=0x0;_0x4e0aef<_0x5ef8af[_0x1ece('0x78')]['length'];_0x4e0aef+=0x1){if(_0x5ef8af[_0x1ece('0x78')][_0x4e0aef][_0x1ece('0x2f')]&&_[_0x1ece('0x61')](_0xf0a71b,_0x5ef8af[_0x1ece('0x78')][_0x4e0aef]['type'])&&_0x5ef8af[_0x1ece('0x78')][_0x4e0aef][_0x1ece('0x7a')]&&_0x5ef8af[_0x1ece('0x78')][_0x4e0aef][_0x1ece('0x7b')]&&_0x5ef8af['joins'][_0x4e0aef][_0x1ece('0x7c')]){_0x34f1e0[_0x5ef8af[_0x1ece('0x78')][_0x4e0aef]['type']](_0x5ef8af[_0x1ece('0x78')][_0x4e0aef]['foreignTable'],null,util[_0x1ece('0x73')](_0x1ece('0x7d'),_0x5ef8af[_0x1ece('0x6e')],_0x5ef8af[_0x1ece('0x78')][_0x4e0aef][_0x1ece('0x7a')],_0x5ef8af['joins'][_0x4e0aef][_0x1ece('0x7b')],_0x5ef8af[_0x1ece('0x78')][_0x4e0aef][_0x1ece('0x7c')]));}}}if(_0x5ef8af['conditions']){_0x5ef8af[_0x1ece('0x7e')]=JSON[_0x1ece('0x79')](_0x5ef8af['conditions']);_0x34f1e0['where'](_0x4ddcf7(_0x5ef8af[_0x1ece('0x7e')][_0x1ece('0x7f')]));}_0x396dbb=_0x34f1e0['clone']();_0x34f1e0[_0x1ece('0x1c')](_0x5ad8de);_0x34f1e0[_0x1ece('0x1e')](0x0);logger[_0x1ece('0x80')](_0x1ece('0x81'),_0x34f1e0['toString']());return dbH[_0x1ece('0x82')][_0x1ece('0x32')](_0x34f1e0[_0x1ece('0x83')](),{'type':dbH[_0x1ece('0x82')]['QueryTypes'][_0x1ece('0x84')]});}})['then'](respondWithResult(_0x53d8e2,null))['catch'](handleError(_0x53d8e2,null));};function runReport(_0x301e5c,_0x3e2881,_0x3e4bcf){var _0x10c179=_0x3e2881[_0x1ece('0x29')];var _0x5df8f5=0xa;var _0x5d97d7=[_0x1ece('0x54'),_0x1ece('0x85'),_0x1ece('0x55'),_0x1ece('0x56')];var _0x1476cd={'SUM':_0x1ece('0x57'),'COUNT':_0x1ece('0x58'),'COUNT DISTINCT':_0x1ece('0x86'),'MAX':_0x1ece('0x87'),'MIN':'MIN(%s)','AVG':_0x1ece('0x5a'),'GROUP_CONCAT':_0x1ece('0x5b'),'GROUP_CONCAT ASC':_0x1ece('0x5c'),'GROUP_CONCAT DESC':_0x1ece('0x5d')};var _0x3cbf47={'SEC_TO_TIME':_0x1ece('0x5e'),'DATE':_0x1ece('0x88'),'HOUR':_0x1ece('0x89'),'ROUND':_0x1ece('0x5f'),'UNIX_TIMESTAMP':_0x1ece('0x60')};var _0x1496ef=function(_0x7b34f9){return!_['includes']([_0x1ece('0x8a'),'IS\x20NOT\x20NULL',_0x1ece('0x8b'),_0x1ece('0x63')],_0x7b34f9);};var _0x3d300a=function(_0x6b0923){if(!_0x6b0923||!_0x6b0923[_0x1ece('0x64')][_0x1ece('0x65')]){return'';}for(var _0x49b61a='(',_0x15b5dd=0x0;_0x15b5dd<_0x6b0923[_0x1ece('0x64')]['length'];_0x15b5dd+=0x1){_0x15b5dd>0x0&&(_0x49b61a+='\x20'+_0x6b0923['operator']+'\x20');_0x49b61a+=_0x6b0923[_0x1ece('0x64')][_0x15b5dd]['group']?_0x3d300a(_0x6b0923['rules'][_0x15b5dd][_0x1ece('0x7f')]):_0x6b0923[_0x1ece('0x64')][_0x15b5dd][_0x1ece('0x66')]+'\x20'+_0x6b0923[_0x1ece('0x64')][_0x15b5dd]['condition']+(_0x1496ef(_0x6b0923['rules'][_0x15b5dd][_0x1ece('0x67')])?'\x20'+_0x6b0923[_0x1ece('0x64')][_0x15b5dd][_0x1ece('0x68')]:'');}return _0x49b61a+')';};var _0x2364f7={'where':{'id':_0x301e5c['id']}},_0x5e8915,_0x5d9c2a,_0x231476,_0x55ae3b,_0x19c692;_0x2364f7=_[_0x1ece('0x3d')]({},_0x2364f7,_0x3e4bcf);return db[_0x1ece('0x2d')][_0x1ece('0x47')](_0x2364f7)['then'](function(_0x516ca6){if(_0x516ca6){_0x5e8915=_0x516ca6;return _0x516ca6[_0x1ece('0x8c')]();}return null;})[_0x1ece('0x23')](function(_0x2c2f6b){if(_0x2c2f6b){if(!_0x2c2f6b[_0x1ece('0x65')]){throw new db[(_0x1ece('0x69'))][(_0x1ece('0x8d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5d9c2a=_0x2c2f6b;return db[_0x1ece('0x6b')][_0x1ece('0x42')]({'raw':!![]});}return null;})[_0x1ece('0x23')](function(_0x4cde6a){if(_0x4cde6a){_0x231476=_[_0x1ece('0x6c')](_0x4cde6a,'id');var _0x521e63;var _0x1ebb6c=squel[_0x1ece('0x8e')]();_0x1ebb6c[_0x1ece('0x6d')](_0x5e8915['table']);for(var _0x2b0956=0x0;_0x2b0956<_0x5d9c2a[_0x1ece('0x65')];_0x2b0956+=0x1){_0x521e63=_0x5d9c2a[_0x2b0956]['MetricId']?_0x231476[_0x5d9c2a[_0x2b0956][_0x1ece('0x6f')]][_0x1ece('0x70')]:_0x5d9c2a[_0x2b0956]['field'];_0x521e63=_0x5d9c2a[_0x2b0956]['function']?_[_0x1ece('0x72')](_0x1476cd[_0x5d9c2a[_0x2b0956]['function']],'%s',_0x521e63):_0x521e63;_0x521e63=_0x5d9c2a[_0x2b0956]['format']?_[_0x1ece('0x72')](_0x3cbf47[_0x5d9c2a[_0x2b0956][_0x1ece('0x73')]],'%s',_0x521e63):_0x521e63;if(_0x5d9c2a[_0x2b0956]['groupBy']){_0x1ebb6c[_0x1ece('0x7f')](_0x521e63);}_0x5d9c2a[_0x2b0956][_0x1ece('0x74')]&&_0x1ebb6c[_0x1ece('0x75')](_0x521e63,_0x5d9c2a[_0x2b0956]['orderBy']===_0x1ece('0x76')?![]:!![]);_0x1ebb6c['field'](_0x521e63,_0x5d9c2a[_0x2b0956][_0x1ece('0x77')]||_0x521e63);}if(_0x5e8915[_0x1ece('0x78')]){_0x5e8915[_0x1ece('0x78')]=JSON[_0x1ece('0x79')](_0x5e8915[_0x1ece('0x78')]);for(var _0x4c3fd8=0x0;_0x4c3fd8<_0x5e8915[_0x1ece('0x78')][_0x1ece('0x65')];_0x4c3fd8+=0x1){if(_0x5e8915[_0x1ece('0x78')][_0x4c3fd8]['type']&&_[_0x1ece('0x61')](_0x5d97d7,_0x5e8915[_0x1ece('0x78')][_0x4c3fd8][_0x1ece('0x2f')])&&_0x5e8915[_0x1ece('0x78')][_0x4c3fd8][_0x1ece('0x7a')]&&_0x5e8915[_0x1ece('0x78')][_0x4c3fd8][_0x1ece('0x7b')]&&_0x5e8915[_0x1ece('0x78')][_0x4c3fd8][_0x1ece('0x7c')]){_0x1ebb6c[_0x5e8915[_0x1ece('0x78')][_0x4c3fd8]['type']](_0x5e8915[_0x1ece('0x78')][_0x4c3fd8][_0x1ece('0x7b')],null,util['format'](_0x1ece('0x7d'),_0x5e8915[_0x1ece('0x6e')],_0x5e8915[_0x1ece('0x78')][_0x4c3fd8][_0x1ece('0x7a')],_0x5e8915['joins'][_0x4c3fd8][_0x1ece('0x7b')],_0x5e8915[_0x1ece('0x78')][_0x4c3fd8]['foreignKey']));}}}if(_0x5e8915[_0x1ece('0x7e')]){_0x5e8915[_0x1ece('0x7e')]=JSON[_0x1ece('0x79')](_0x5e8915['conditions']);_0x1ebb6c['where'](_0x3d300a(_0x5e8915[_0x1ece('0x7e')]['group']));}_0x19c692=_0x1ebb6c[_0x1ece('0x8f')]();_0x1ebb6c['limit'](_0x5df8f5);_0x1ebb6c[_0x1ece('0x1e')](0x0);return;}})[_0x1ece('0x23')](function(){if(_0x3e2881['output']===_0x1ece('0x90')){return null;}var _0x335869=_['merge'](_0x3e2881,{'name':_0x3e2881['fullPath']||_0x3e2881['name']||_0x5e8915[_0x1ece('0x29')],'basename':_0x10c179,'savename':util[_0x1ece('0x73')](_0x1ece('0x91'),_0x3e2881[_0x1ece('0x29')]||_0x5e8915[_0x1ece('0x29')],require(_0x1ece('0x92'))[_0x1ece('0x93')](0x4),_0x3e2881[_0x1ece('0x94')]||'csv'),'reportId':_0x5e8915['id'],'reportType':'custom'});return db[_0x1ece('0x95')][_0x1ece('0x48')](_0x335869,{'raw':!![]});})[_0x1ece('0x23')](function(_0x4da232){if(_0x5e8915[_0x1ece('0x6e')]===_0x1ece('0x96')){_0x19c692[_0x1ece('0x39')](_0x5e8915['table']+_0x1ece('0x97'),_0x3e2881[_0x1ece('0x98')],_0x3e2881['endDate']);}else{_0x19c692[_0x1ece('0x39')](_0x5e8915['table']+_0x1ece('0x99'),_0x3e2881[_0x1ece('0x98')],_0x3e2881[_0x1ece('0x9a')]);}if(_0x4da232){logger[_0x1ece('0x9b')](_0x1ece('0x9c'),_0x19c692[_0x1ece('0x83')]());require(_0x1ece('0x9d'))[_0x1ece('0x9e')](path[_0x1ece('0x54')](__dirname,_0x1ece('0x9f'),_0x4da232[_0x1ece('0x94')]),[_0x4da232['id'],_0x19c692[_0x1ece('0x83')](),path['join'](__dirname,'../../files/reports',_0x4da232[_0x1ece('0xa0')]),_0x10c179]);return _0x4da232;}else{var _0x3b5189=squel['select']();_0x3b5189['from']('('+_0x19c692['toString']()+')','countTable');_0x3b5189['field'](_0x1ece('0xa1'),_0x1ece('0x1d'));_0x19c692[_0x1ece('0x1c')](_0x3e2881[_0x1ece('0x1c')]||_0x5df8f5);_0x19c692['offset'](_0x3e2881[_0x1ece('0x1e')]||0x0);return dbH[_0x1ece('0x82')]['query'](_0x3b5189[_0x1ece('0x83')](),{'type':dbH[_0x1ece('0x82')][_0x1ece('0xa2')][_0x1ece('0x84')]})[_0x1ece('0x23')](function(_0x21f716){if(!_0x21f716[_0x1ece('0x65')]){_0x55ae3b=0x0;}else{_0x55ae3b=_0x21f716[0x0]['count']||0x0;}return dbH['sequelize'][_0x1ece('0x32')](_0x19c692[_0x1ece('0x83')](),{'type':dbH[_0x1ece('0x82')]['QueryTypes'][_0x1ece('0x84')]});})[_0x1ece('0x23')](function(_0x7ecf27){return{'rows':_0x7ecf27||[],'count':_0x55ae3b};});}});}exports['run']=function(_0x65b08f,_0x4744d6){return runReport(_0x65b08f[_0x1ece('0x52')],_0x65b08f[_0x1ece('0x32')],_0x65b08f[_0x1ece('0x3f')])[_0x1ece('0x23')](respondWithResult(_0x4744d6,null))[_0x1ece('0x44')](handleError(_0x4744d6,null));};exports[_0x1ece('0xa3')]=runReport;exports['query']=function(_0x23356e,_0x1277bd){var _0x2af1a9=0xa;var _0x205085=['join',_0x1ece('0x85'),_0x1ece('0x55'),'cross_join'];var _0x4319ae={'SUM':_0x1ece('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x1ece('0x87'),'MIN':'MIN(%s)','AVG':_0x1ece('0x5a'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x1ece('0x5c'),'GROUP_CONCAT DESC':_0x1ece('0x5d')};var _0x26d046={'SEC_TO_TIME':_0x1ece('0x5e'),'DATE':_0x1ece('0x88'),'HOUR':_0x1ece('0x89'),'ROUND':_0x1ece('0x5f'),'UNIX_TIMESTAMP':_0x1ece('0x60')};var _0x3c3f7b=function(_0x4ac058){return!_[_0x1ece('0x61')]([_0x1ece('0x8a'),_0x1ece('0x62'),_0x1ece('0x8b'),'IS\x20NOT\x20EMPTY'],_0x4ac058);};var _0x5a0970=function(_0x71db6e){if(!_0x71db6e||!_0x71db6e['rules']['length']){return'';}for(var _0x555ead='(',_0x2baa69=0x0;_0x2baa69<_0x71db6e[_0x1ece('0x64')][_0x1ece('0x65')];_0x2baa69+=0x1){_0x2baa69>0x0&&(_0x555ead+='\x20'+_0x71db6e[_0x1ece('0xa4')]+'\x20');_0x555ead+=_0x71db6e[_0x1ece('0x64')][_0x2baa69][_0x1ece('0x7f')]?_0x5a0970(_0x71db6e['rules'][_0x2baa69][_0x1ece('0x7f')]):_0x71db6e[_0x1ece('0x64')][_0x2baa69][_0x1ece('0x66')]+'\x20'+_0x71db6e[_0x1ece('0x64')][_0x2baa69][_0x1ece('0x67')]+(_0x3c3f7b(_0x71db6e[_0x1ece('0x64')][_0x2baa69][_0x1ece('0x67')])?'\x20'+_0x71db6e[_0x1ece('0x64')][_0x2baa69][_0x1ece('0x68')]:'');}return _0x555ead+')';};var _0x377832={'where':{'id':_0x23356e[_0x1ece('0x52')]['id']}},_0x3edef6,_0x3370b1,_0x2d9027,_0x58e374,_0x341788;_0x377832=_[_0x1ece('0x3d')]({},_0x377832,_0x23356e['options']);return db[_0x1ece('0x2d')][_0x1ece('0x47')](_0x377832)['then'](function(_0x51ac9e){if(_0x51ac9e){_0x3edef6=_0x51ac9e;return _0x51ac9e[_0x1ece('0x8c')]();}return null;})[_0x1ece('0x23')](function(_0xb1c432){if(_0xb1c432){if(!_0xb1c432['length']){throw new db['Sequelize'][(_0x1ece('0x8d'))](_0x1ece('0x6a'),0x193);}_0x3370b1=_0xb1c432;return db['AnalyticMetric'][_0x1ece('0x42')]({'raw':!![]});}return null;})[_0x1ece('0x23')](function(_0x1d86e5){if(_0x1d86e5){_0x2d9027=_[_0x1ece('0x6c')](_0x1d86e5,'id');var _0x335310;var _0xe6ea76=squel[_0x1ece('0x8e')]();_0xe6ea76[_0x1ece('0x6d')](_0x3edef6[_0x1ece('0x6e')]);for(var _0x1e4706=0x0;_0x1e4706<_0x3370b1[_0x1ece('0x65')];_0x1e4706+=0x1){_0x335310=_0x3370b1[_0x1e4706]['MetricId']?_0x2d9027[_0x3370b1[_0x1e4706]['MetricId']][_0x1ece('0x70')]:_0x3370b1[_0x1e4706]['field'];_0x335310=_0x3370b1[_0x1e4706][_0x1ece('0x71')]?_['replace'](_0x4319ae[_0x3370b1[_0x1e4706]['function']],'%s',_0x335310):_0x335310;_0x335310=_0x3370b1[_0x1e4706][_0x1ece('0x73')]?_[_0x1ece('0x72')](_0x26d046[_0x3370b1[_0x1e4706]['format']],'%s',_0x335310):_0x335310;if(_0x3370b1[_0x1e4706][_0x1ece('0xa5')]){_0xe6ea76[_0x1ece('0x7f')](_0x335310);}_0x3370b1[_0x1e4706][_0x1ece('0x74')]&&_0xe6ea76[_0x1ece('0x75')](_0x335310,_0x3370b1[_0x1e4706]['orderBy']==='DESC'?![]:!![]);_0xe6ea76[_0x1ece('0x66')](_0x335310,_0x3370b1[_0x1e4706][_0x1ece('0x77')]||_0x335310);}if(_0x3edef6['joins']){_0x3edef6[_0x1ece('0x78')]=JSON[_0x1ece('0x79')](_0x3edef6[_0x1ece('0x78')]);for(var _0x16b534=0x0;_0x16b534<_0x3edef6['joins'][_0x1ece('0x65')];_0x16b534+=0x1){if(_0x3edef6[_0x1ece('0x78')][_0x16b534]['type']&&_['includes'](_0x205085,_0x3edef6[_0x1ece('0x78')][_0x16b534][_0x1ece('0x2f')])&&_0x3edef6[_0x1ece('0x78')][_0x16b534][_0x1ece('0x7a')]&&_0x3edef6[_0x1ece('0x78')][_0x16b534][_0x1ece('0x7b')]&&_0x3edef6['joins'][_0x16b534][_0x1ece('0x7c')]){_0xe6ea76[_0x3edef6[_0x1ece('0x78')][_0x16b534][_0x1ece('0x2f')]](_0x3edef6[_0x1ece('0x78')][_0x16b534][_0x1ece('0x7b')],null,util['format'](_0x1ece('0x7d'),_0x3edef6['table'],_0x3edef6[_0x1ece('0x78')][_0x16b534][_0x1ece('0x7a')],_0x3edef6[_0x1ece('0x78')][_0x16b534][_0x1ece('0x7b')],_0x3edef6['joins'][_0x16b534][_0x1ece('0x7c')]));}}}if(_0x3edef6[_0x1ece('0x7e')]){_0x3edef6[_0x1ece('0x7e')]=JSON[_0x1ece('0x79')](_0x3edef6[_0x1ece('0x7e')]);_0xe6ea76[_0x1ece('0x39')](_0x5a0970(_0x3edef6[_0x1ece('0x7e')][_0x1ece('0x7f')]));}_0x341788=_0xe6ea76[_0x1ece('0x8f')]();_0xe6ea76['limit'](_0x2af1a9);_0xe6ea76[_0x1ece('0x1e')](0x0);logger[_0x1ece('0x80')]('Limited\x20Query:',_0xe6ea76[_0x1ece('0x83')]());return dbH[_0x1ece('0x82')][_0x1ece('0x32')](_0xe6ea76[_0x1ece('0x83')](),{'type':dbH['sequelize'][_0x1ece('0xa2')][_0x1ece('0x84')]});}})[_0x1ece('0x23')](function(){return{'sql':_0x341788[_0x1ece('0x83')]()};})[_0x1ece('0x23')](respondWithResult(_0x1277bd,null))[_0x1ece('0x44')](handleError(_0x1277bd,null));}; \ No newline at end of file +var _0xe137=['info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','run','runReport','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','alias','debug','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','destroy','then','CustomReports','UserProfileResource','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','include','catch','show','AnalyticCustomReport','includeAll','find','create','body','user','get','role','Reports','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','preview','left_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','MetricId','metric','function','replace','groupBy','orderBy','DESC','joins','foreignTable','foreignKey','format','%s.%s\x20=\x20%s.%s','table','parentKey','conditions','parse','clone','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','join','right_join','cross_join','MAX(%s)','DATE(%s)','ROUND(%s)','IS\x20EMPTY','output','web','fullPath','%s-%s.%s','randomstring','generate','custom','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate'];(function(_0x4b75b9,_0x4cbbb9){var _0xd88b6=function(_0x4b4352){while(--_0x4b4352){_0x4b75b9['push'](_0x4b75b9['shift']());}};_0xd88b6(++_0x4cbbb9);}(_0xe137,0xb3));var _0x7e13=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0xe137[_0x4a3898];return _0x25ceb0;};'use strict';var emlformat=require(_0x7e13('0x0'));var rimraf=require(_0x7e13('0x1'));var zipdir=require(_0x7e13('0x2'));var jsonpatch=require(_0x7e13('0x3'));var rp=require(_0x7e13('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7e13('0x5'));var util=require('util');var path=require(_0x7e13('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7e13('0x7'));var _=require(_0x7e13('0x8'));var squel=require(_0x7e13('0x9'));var crypto=require(_0x7e13('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7e13('0xb'));var querystring=require(_0x7e13('0xc'));var Papa=require(_0x7e13('0xd'));var Redis=require(_0x7e13('0xe'));var authService=require(_0x7e13('0xf'));var qs=require(_0x7e13('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7e13('0x11'));var logger=require(_0x7e13('0x12'))(_0x7e13('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7e13('0x14'));var db=require('../../mysqldb')['db'];var dbH=require(_0x7e13('0x15'))[_0x7e13('0x16')];function respondWithStatusCode(_0x214395,_0x3800c8){_0x3800c8=_0x3800c8||0xcc;return function(_0x6bcbe0){if(_0x6bcbe0){return _0x214395[_0x7e13('0x17')](_0x3800c8);}return _0x214395[_0x7e13('0x18')](_0x3800c8)[_0x7e13('0x19')]();};}function respondWithResult(_0x1d2c07,_0x4853d7){_0x4853d7=_0x4853d7||0xc8;return function(_0x2bc3d1){if(_0x2bc3d1){return _0x1d2c07[_0x7e13('0x18')](_0x4853d7)[_0x7e13('0x1a')](_0x2bc3d1);}};}function respondWithFilteredResult(_0x266a5b,_0x51447a){return function(_0x419dbf){if(_0x419dbf){var _0x5e8896=typeof _0x51447a[_0x7e13('0x1b')]===_0x7e13('0x1c')&&typeof _0x51447a[_0x7e13('0x1d')]===_0x7e13('0x1c');var _0x483c3b=_0x419dbf[_0x7e13('0x1e')];var _0x3ea219=_0x5e8896?0x0:_0x51447a['offset'];var _0x283a5a=_0x5e8896?_0x419dbf[_0x7e13('0x1e')]:_0x51447a[_0x7e13('0x1b')]+_0x51447a[_0x7e13('0x1d')];var _0x1a6641;if(_0x283a5a>=_0x483c3b){_0x283a5a=_0x483c3b;_0x1a6641=0xc8;}else{_0x1a6641=0xce;}_0x266a5b[_0x7e13('0x18')](_0x1a6641);return _0x266a5b[_0x7e13('0x1f')](_0x7e13('0x20'),_0x3ea219+'-'+_0x283a5a+'/'+_0x483c3b)[_0x7e13('0x1a')](_0x419dbf);}return null;};}function patchUpdates(_0x76c2bd){return function(_0x20d8e4){try{jsonpatch['apply'](_0x20d8e4,_0x76c2bd,!![]);}catch(_0x1be9a8){return BPromise[_0x7e13('0x21')](_0x1be9a8);}return _0x20d8e4['save']();};}function saveUpdates(_0x58df4d,_0x2a1921){return function(_0x760bcc){if(_0x760bcc){return _0x760bcc['update'](_0x58df4d)['then'](function(_0x5835c8){return _0x5835c8;});}return null;};}function removeEntity(_0x580745,_0x432ab0){return function(_0x156e4c){if(_0x156e4c){return _0x156e4c[_0x7e13('0x22')]()[_0x7e13('0x23')](function(){var _0x1f56e9=_0x156e4c['get']({'plain':!![]});var _0xa54815=_0x7e13('0x24');return db[_0x7e13('0x25')]['destroy']({'where':{'type':_0xa54815,'resourceId':_0x1f56e9['id']}})['then'](function(){return _0x156e4c;});})[_0x7e13('0x23')](function(){_0x580745['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f3769,_0x2357b8){return function(_0x312af8){if(!_0x312af8){_0x3f3769[_0x7e13('0x17')](0x194);}return _0x312af8;};}function handleError(_0x19925a,_0x434bed){_0x434bed=_0x434bed||0x1f4;return function(_0x5d939c){logger['error'](_0x5d939c['stack']);if(_0x5d939c['name']){delete _0x5d939c[_0x7e13('0x26')];}_0x19925a['status'](_0x434bed)[_0x7e13('0x27')](_0x5d939c);};}exports[_0x7e13('0x28')]=function(_0x46c73d,_0x2e31b4){var _0x59c660={},_0x4366e1={},_0x30b68f={'count':0x0,'rows':[]};var _0x1be521=_['map'](db['AnalyticCustomReport'][_0x7e13('0x29')],function(_0xeb8809){return{'name':_0xeb8809[_0x7e13('0x2a')],'type':_0xeb8809[_0x7e13('0x2b')][_0x7e13('0x2c')]};});_0x4366e1['model']=_[_0x7e13('0x2d')](_0x1be521,_0x7e13('0x26'));_0x4366e1[_0x7e13('0x2e')]=_[_0x7e13('0x2f')](_0x46c73d['query']);_0x4366e1[_0x7e13('0x30')]=_[_0x7e13('0x31')](_0x4366e1[_0x7e13('0x32')],_0x4366e1['query']);_0x59c660[_0x7e13('0x33')]=_[_0x7e13('0x31')](_0x4366e1['model'],qs[_0x7e13('0x34')](_0x46c73d[_0x7e13('0x2e')]['fields']));_0x59c660['attributes']=_0x59c660[_0x7e13('0x33')][_0x7e13('0x35')]?_0x59c660['attributes']:_0x4366e1[_0x7e13('0x32')];if(!_0x46c73d[_0x7e13('0x2e')][_0x7e13('0x36')]('nolimit')){_0x59c660['limit']=qs[_0x7e13('0x1d')](_0x46c73d['query'][_0x7e13('0x1d')]);_0x59c660[_0x7e13('0x1b')]=qs[_0x7e13('0x1b')](_0x46c73d[_0x7e13('0x2e')][_0x7e13('0x1b')]);}_0x59c660[_0x7e13('0x37')]=qs['sort'](_0x46c73d[_0x7e13('0x2e')][_0x7e13('0x38')]);_0x59c660['where']=qs[_0x7e13('0x30')](_[_0x7e13('0x39')](_0x46c73d[_0x7e13('0x2e')],_0x4366e1[_0x7e13('0x30')]),_0x1be521);if(_0x46c73d['query'][_0x7e13('0x3a')]){_0x59c660[_0x7e13('0x3b')]=_[_0x7e13('0x3c')](_0x59c660['where'],{'$or':_[_0x7e13('0x2d')](_0x1be521,function(_0x2d70db){if(_0x2d70db['type']!=='VIRTUAL'){var _0x20bf3f={};_0x20bf3f[_0x2d70db[_0x7e13('0x26')]]={'$like':'%'+_0x46c73d['query']['filter']+'%'};return _0x20bf3f;}})});}_0x59c660=_['merge']({},_0x59c660,_0x46c73d[_0x7e13('0x3d')]);var _0x5a363f={'where':_0x59c660[_0x7e13('0x3b')]};return db['AnalyticCustomReport'][_0x7e13('0x1e')](_0x5a363f)[_0x7e13('0x23')](function(_0x147f7a){_0x30b68f['count']=_0x147f7a;if(_0x46c73d[_0x7e13('0x2e')]['includeAll']){_0x59c660[_0x7e13('0x3e')]=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0x59c660);})['then'](function(_0x14ea52){_0x30b68f['rows']=_0x14ea52;return _0x30b68f;})[_0x7e13('0x23')](respondWithFilteredResult(_0x2e31b4,_0x59c660))[_0x7e13('0x3f')](handleError(_0x2e31b4,null));};exports[_0x7e13('0x40')]=function(_0x331475,_0x4c1b2f){var _0x588ab1={'raw':![],'where':{'id':_0x331475['params']['id']}},_0xa68fb0={};_0xa68fb0[_0x7e13('0x32')]=_[_0x7e13('0x2f')](db[_0x7e13('0x41')][_0x7e13('0x29')]);_0xa68fb0[_0x7e13('0x2e')]=_[_0x7e13('0x2f')](_0x331475['query']);_0xa68fb0[_0x7e13('0x30')]=_['intersection'](_0xa68fb0[_0x7e13('0x32')],_0xa68fb0[_0x7e13('0x2e')]);_0x588ab1[_0x7e13('0x33')]=_['intersection'](_0xa68fb0[_0x7e13('0x32')],qs[_0x7e13('0x34')](_0x331475[_0x7e13('0x2e')][_0x7e13('0x34')]));_0x588ab1[_0x7e13('0x33')]=_0x588ab1[_0x7e13('0x33')][_0x7e13('0x35')]?_0x588ab1[_0x7e13('0x33')]:_0xa68fb0[_0x7e13('0x32')];if(_0x331475[_0x7e13('0x2e')][_0x7e13('0x42')]){_0x588ab1[_0x7e13('0x3e')]=[{'all':!![]}];}_0x588ab1=_[_0x7e13('0x3c')]({},_0x588ab1,_0x331475[_0x7e13('0x3d')]);return db[_0x7e13('0x41')][_0x7e13('0x43')](_0x588ab1)['then'](handleEntityNotFound(_0x4c1b2f,null))[_0x7e13('0x23')](respondWithResult(_0x4c1b2f,null))[_0x7e13('0x3f')](handleError(_0x4c1b2f,null));};exports[_0x7e13('0x44')]=function(_0x469af3,_0x4ffd3a){return db[_0x7e13('0x41')][_0x7e13('0x44')](_0x469af3[_0x7e13('0x45')],{})[_0x7e13('0x23')](function(_0xe5ef2e){var _0xb4ad27=_0x469af3[_0x7e13('0x46')][_0x7e13('0x47')]({'plain':!![]});if(!_0xb4ad27)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb4ad27[_0x7e13('0x48')]===_0x7e13('0x46')){var _0xa75a18=_0xe5ef2e[_0x7e13('0x47')]({'plain':!![]});var _0x1fdbcb=_0x7e13('0x49');return db[_0x7e13('0x4a')][_0x7e13('0x43')]({'where':{'name':_0x1fdbcb,'userProfileId':_0xb4ad27[_0x7e13('0x4b')]},'raw':!![]})['then'](function(_0x1a143b){if(_0x1a143b&&_0x1a143b[_0x7e13('0x4c')]===0x0){return db[_0x7e13('0x25')][_0x7e13('0x44')]({'name':_0xa75a18[_0x7e13('0x26')],'resourceId':_0xa75a18['id'],'type':_0x7e13('0x24'),'sectionId':_0x1a143b['id']},{})[_0x7e13('0x23')](function(){return _0xe5ef2e;});}else{return _0xe5ef2e;}})[_0x7e13('0x3f')](function(_0x379501){logger[_0x7e13('0x4d')](_0x7e13('0x4e'),_0x379501);throw _0x379501;});}return _0xe5ef2e;})[_0x7e13('0x23')](respondWithResult(_0x4ffd3a,0xc9))[_0x7e13('0x3f')](handleError(_0x4ffd3a,null));};exports[_0x7e13('0x4f')]=function(_0x5569ef,_0x2dd377){if(_0x5569ef[_0x7e13('0x45')]['id']){delete _0x5569ef['body']['id'];}return db[_0x7e13('0x41')][_0x7e13('0x43')]({'where':{'id':_0x5569ef[_0x7e13('0x50')]['id']}})[_0x7e13('0x23')](handleEntityNotFound(_0x2dd377,null))[_0x7e13('0x23')](saveUpdates(_0x5569ef[_0x7e13('0x45')],null))['then'](respondWithResult(_0x2dd377,null))[_0x7e13('0x3f')](handleError(_0x2dd377,null));};exports[_0x7e13('0x22')]=function(_0x37dca5,_0x326b68){return db['AnalyticCustomReport'][_0x7e13('0x43')]({'where':{'id':_0x37dca5['params']['id']}})[_0x7e13('0x23')](handleEntityNotFound(_0x326b68,null))[_0x7e13('0x23')](removeEntity(_0x326b68,null))['catch'](handleError(_0x326b68,null));};exports[_0x7e13('0x51')]=function(_0x3dea33,_0x483fb6){var _0x436bb4=0xa;var _0x40aca1=['join',_0x7e13('0x52'),'right_join','cross_join'];var _0x54f9ea={'SUM':_0x7e13('0x53'),'COUNT':_0x7e13('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x7e13('0x55'),'AVG':_0x7e13('0x56'),'GROUP_CONCAT':_0x7e13('0x57'),'GROUP_CONCAT ASC':_0x7e13('0x58'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x56e310={'SEC_TO_TIME':_0x7e13('0x59'),'DATE':'DATE(%s)','HOUR':_0x7e13('0x5a'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x7e13('0x5b')};var _0x2b72ed=function(_0x42fcf7){return!_[_0x7e13('0x5c')]([_0x7e13('0x5d'),_0x7e13('0x5e'),'IS\x20EMPTY',_0x7e13('0x5f')],_0x42fcf7);};var _0x564f1d=function(_0x56dfbc){if(!_0x56dfbc||!_0x56dfbc['rules']['length']){return'';}for(var _0x3eed26='(',_0x194b43=0x0;_0x194b43<_0x56dfbc[_0x7e13('0x60')][_0x7e13('0x35')];_0x194b43+=0x1){_0x194b43>0x0&&(_0x3eed26+='\x20'+_0x56dfbc[_0x7e13('0x61')]+'\x20');_0x3eed26+=_0x56dfbc[_0x7e13('0x60')][_0x194b43][_0x7e13('0x62')]?_0x564f1d(_0x56dfbc['rules'][_0x194b43]['group']):_0x56dfbc[_0x7e13('0x60')][_0x194b43][_0x7e13('0x63')]+'\x20'+_0x56dfbc[_0x7e13('0x60')][_0x194b43][_0x7e13('0x64')]+(_0x2b72ed(_0x56dfbc[_0x7e13('0x60')][_0x194b43][_0x7e13('0x64')])?'\x20'+_0x56dfbc[_0x7e13('0x60')][_0x194b43][_0x7e13('0x65')]:'');}return _0x3eed26+')';};var _0x2b4766={'where':{'id':_0x3dea33['params']['id']}},_0x689851,_0x553474,_0x4f1a31,_0x5333f8,_0x5737ad;_0x2b4766=_[_0x7e13('0x3c')]({},_0x2b4766,_0x3dea33[_0x7e13('0x3d')]);return db[_0x7e13('0x41')][_0x7e13('0x43')](_0x2b4766)[_0x7e13('0x23')](function(_0xfad94b){if(_0xfad94b){_0x689851=_0xfad94b;return _0xfad94b[_0x7e13('0x66')]();}return null;})[_0x7e13('0x23')](function(_0x3e782c){if(_0x3e782c){if(!_0x3e782c['length']){throw new db[(_0x7e13('0x67'))][(_0x7e13('0x68'))](_0x7e13('0x69'),0x193);}_0x553474=_0x3e782c;return db[_0x7e13('0x6a')][_0x7e13('0x6b')]({'raw':!![]});}return null;})[_0x7e13('0x23')](function(_0x2187cf){if(_0x2187cf){_0x4f1a31=_[_0x7e13('0x6c')](_0x2187cf,'id');var _0x4dbb07;var _0x5b9a40=squel[_0x7e13('0x6d')]();_0x5b9a40[_0x7e13('0x6e')](_0x689851['table']);for(var _0x539434=0x0;_0x539434<_0x553474[_0x7e13('0x35')];_0x539434+=0x1){_0x4dbb07=_0x553474[_0x539434][_0x7e13('0x6f')]?_0x4f1a31[_0x553474[_0x539434]['MetricId']][_0x7e13('0x70')]:_0x553474[_0x539434]['field'];_0x4dbb07=_0x553474[_0x539434][_0x7e13('0x71')]?_[_0x7e13('0x72')](_0x54f9ea[_0x553474[_0x539434][_0x7e13('0x71')]],'%s',_0x4dbb07):_0x4dbb07;_0x4dbb07=_0x553474[_0x539434]['format']?_['replace'](_0x56e310[_0x553474[_0x539434]['format']],'%s',_0x4dbb07):_0x4dbb07;if(_0x553474[_0x539434][_0x7e13('0x73')]){_0x5b9a40[_0x7e13('0x62')](_0x4dbb07);}_0x553474[_0x539434][_0x7e13('0x74')]&&_0x5b9a40[_0x7e13('0x37')](_0x4dbb07,_0x553474[_0x539434][_0x7e13('0x74')]===_0x7e13('0x75')?![]:!![]);_0x5b9a40[_0x7e13('0x63')](_0x4dbb07,_0x553474[_0x539434]['alias']||_0x4dbb07);}if(_0x689851['joins']){_0x689851['joins']=JSON['parse'](_0x689851[_0x7e13('0x76')]);for(var _0x2f447d=0x0;_0x2f447d<_0x689851['joins'][_0x7e13('0x35')];_0x2f447d+=0x1){if(_0x689851[_0x7e13('0x76')][_0x2f447d][_0x7e13('0x2b')]&&_[_0x7e13('0x5c')](_0x40aca1,_0x689851[_0x7e13('0x76')][_0x2f447d][_0x7e13('0x2b')])&&_0x689851[_0x7e13('0x76')][_0x2f447d]['parentKey']&&_0x689851[_0x7e13('0x76')][_0x2f447d][_0x7e13('0x77')]&&_0x689851[_0x7e13('0x76')][_0x2f447d][_0x7e13('0x78')]){_0x5b9a40[_0x689851[_0x7e13('0x76')][_0x2f447d]['type']](_0x689851['joins'][_0x2f447d][_0x7e13('0x77')],null,util[_0x7e13('0x79')](_0x7e13('0x7a'),_0x689851[_0x7e13('0x7b')],_0x689851[_0x7e13('0x76')][_0x2f447d][_0x7e13('0x7c')],_0x689851['joins'][_0x2f447d][_0x7e13('0x77')],_0x689851[_0x7e13('0x76')][_0x2f447d][_0x7e13('0x78')]));}}}if(_0x689851[_0x7e13('0x7d')]){_0x689851['conditions']=JSON[_0x7e13('0x7e')](_0x689851[_0x7e13('0x7d')]);_0x5b9a40[_0x7e13('0x3b')](_0x564f1d(_0x689851[_0x7e13('0x7d')]['group']));}_0x5737ad=_0x5b9a40[_0x7e13('0x7f')]();_0x5b9a40[_0x7e13('0x1d')](_0x436bb4);_0x5b9a40['offset'](0x0);logger['debug'](_0x7e13('0x80'),_0x5b9a40['toString']());return dbH[_0x7e13('0x81')][_0x7e13('0x2e')](_0x5b9a40[_0x7e13('0x82')](),{'type':dbH[_0x7e13('0x81')][_0x7e13('0x83')][_0x7e13('0x84')]});}})[_0x7e13('0x23')](respondWithResult(_0x483fb6,null))[_0x7e13('0x3f')](handleError(_0x483fb6,null));};function runReport(_0x3dd0e0,_0x5d04b1,_0x2c729a){var _0x2f8b3b=_0x5d04b1[_0x7e13('0x26')];var _0x506924=0xa;var _0x5e5d9d=[_0x7e13('0x85'),'left_join',_0x7e13('0x86'),_0x7e13('0x87')];var _0x1b1f25={'SUM':_0x7e13('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x7e13('0x88'),'MIN':_0x7e13('0x55'),'AVG':_0x7e13('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x7e13('0x58'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x56b846={'SEC_TO_TIME':_0x7e13('0x59'),'DATE':_0x7e13('0x89'),'HOUR':_0x7e13('0x5a'),'ROUND':_0x7e13('0x8a'),'UNIX_TIMESTAMP':_0x7e13('0x5b')};var _0x411872=function(_0x41c38d){return!_['includes']([_0x7e13('0x5d'),'IS\x20NOT\x20NULL',_0x7e13('0x8b'),_0x7e13('0x5f')],_0x41c38d);};var _0x37dda8=function(_0x508018){if(!_0x508018||!_0x508018[_0x7e13('0x60')]['length']){return'';}for(var _0x36e35c='(',_0x496d7e=0x0;_0x496d7e<_0x508018[_0x7e13('0x60')][_0x7e13('0x35')];_0x496d7e+=0x1){_0x496d7e>0x0&&(_0x36e35c+='\x20'+_0x508018[_0x7e13('0x61')]+'\x20');_0x36e35c+=_0x508018['rules'][_0x496d7e][_0x7e13('0x62')]?_0x37dda8(_0x508018[_0x7e13('0x60')][_0x496d7e][_0x7e13('0x62')]):_0x508018[_0x7e13('0x60')][_0x496d7e][_0x7e13('0x63')]+'\x20'+_0x508018[_0x7e13('0x60')][_0x496d7e][_0x7e13('0x64')]+(_0x411872(_0x508018[_0x7e13('0x60')][_0x496d7e][_0x7e13('0x64')])?'\x20'+_0x508018[_0x7e13('0x60')][_0x496d7e][_0x7e13('0x65')]:'');}return _0x36e35c+')';};var _0x596ade={'where':{'id':_0x3dd0e0['id']}},_0x33f460,_0x1951dd,_0x52df71,_0x4a3c53,_0x40dcd1;_0x596ade=_[_0x7e13('0x3c')]({},_0x596ade,_0x2c729a);return db[_0x7e13('0x41')]['find'](_0x596ade)['then'](function(_0x103842){if(_0x103842){_0x33f460=_0x103842;return _0x103842[_0x7e13('0x66')]();}return null;})[_0x7e13('0x23')](function(_0x4dd897){if(_0x4dd897){if(!_0x4dd897[_0x7e13('0x35')]){throw new db['Sequelize'][(_0x7e13('0x68'))](_0x7e13('0x69'),0x193);}_0x1951dd=_0x4dd897;return db[_0x7e13('0x6a')][_0x7e13('0x6b')]({'raw':!![]});}return null;})[_0x7e13('0x23')](function(_0x514c1c){if(_0x514c1c){_0x52df71=_['keyBy'](_0x514c1c,'id');var _0x3779c0;var _0x2546ff=squel[_0x7e13('0x6d')]();_0x2546ff[_0x7e13('0x6e')](_0x33f460[_0x7e13('0x7b')]);for(var _0x1f3d4d=0x0;_0x1f3d4d<_0x1951dd[_0x7e13('0x35')];_0x1f3d4d+=0x1){_0x3779c0=_0x1951dd[_0x1f3d4d][_0x7e13('0x6f')]?_0x52df71[_0x1951dd[_0x1f3d4d][_0x7e13('0x6f')]][_0x7e13('0x70')]:_0x1951dd[_0x1f3d4d][_0x7e13('0x63')];_0x3779c0=_0x1951dd[_0x1f3d4d][_0x7e13('0x71')]?_[_0x7e13('0x72')](_0x1b1f25[_0x1951dd[_0x1f3d4d]['function']],'%s',_0x3779c0):_0x3779c0;_0x3779c0=_0x1951dd[_0x1f3d4d][_0x7e13('0x79')]?_[_0x7e13('0x72')](_0x56b846[_0x1951dd[_0x1f3d4d]['format']],'%s',_0x3779c0):_0x3779c0;if(_0x1951dd[_0x1f3d4d][_0x7e13('0x73')]){_0x2546ff[_0x7e13('0x62')](_0x3779c0);}_0x1951dd[_0x1f3d4d][_0x7e13('0x74')]&&_0x2546ff['order'](_0x3779c0,_0x1951dd[_0x1f3d4d]['orderBy']===_0x7e13('0x75')?![]:!![]);_0x2546ff[_0x7e13('0x63')](_0x3779c0,_0x1951dd[_0x1f3d4d]['alias']||_0x3779c0);}if(_0x33f460[_0x7e13('0x76')]){_0x33f460[_0x7e13('0x76')]=JSON[_0x7e13('0x7e')](_0x33f460[_0x7e13('0x76')]);for(var _0x51d9be=0x0;_0x51d9be<_0x33f460[_0x7e13('0x76')][_0x7e13('0x35')];_0x51d9be+=0x1){if(_0x33f460[_0x7e13('0x76')][_0x51d9be][_0x7e13('0x2b')]&&_['includes'](_0x5e5d9d,_0x33f460[_0x7e13('0x76')][_0x51d9be][_0x7e13('0x2b')])&&_0x33f460[_0x7e13('0x76')][_0x51d9be]['parentKey']&&_0x33f460[_0x7e13('0x76')][_0x51d9be][_0x7e13('0x77')]&&_0x33f460[_0x7e13('0x76')][_0x51d9be][_0x7e13('0x78')]){_0x2546ff[_0x33f460['joins'][_0x51d9be][_0x7e13('0x2b')]](_0x33f460[_0x7e13('0x76')][_0x51d9be]['foreignTable'],null,util['format'](_0x7e13('0x7a'),_0x33f460['table'],_0x33f460['joins'][_0x51d9be][_0x7e13('0x7c')],_0x33f460['joins'][_0x51d9be][_0x7e13('0x77')],_0x33f460[_0x7e13('0x76')][_0x51d9be]['foreignKey']));}}}if(_0x33f460[_0x7e13('0x7d')]){_0x33f460[_0x7e13('0x7d')]=JSON[_0x7e13('0x7e')](_0x33f460[_0x7e13('0x7d')]);_0x2546ff[_0x7e13('0x3b')](_0x37dda8(_0x33f460[_0x7e13('0x7d')][_0x7e13('0x62')]));}_0x40dcd1=_0x2546ff[_0x7e13('0x7f')]();_0x2546ff[_0x7e13('0x1d')](_0x506924);_0x2546ff[_0x7e13('0x1b')](0x0);return;}})[_0x7e13('0x23')](function(){if(_0x5d04b1[_0x7e13('0x8c')]===_0x7e13('0x8d')){return null;}var _0x4511c4=_[_0x7e13('0x3c')](_0x5d04b1,{'name':_0x5d04b1[_0x7e13('0x8e')]||_0x5d04b1['name']||_0x33f460[_0x7e13('0x26')],'basename':_0x2f8b3b,'savename':util[_0x7e13('0x79')](_0x7e13('0x8f'),_0x5d04b1[_0x7e13('0x26')]||_0x33f460['name'],require(_0x7e13('0x90'))[_0x7e13('0x91')](0x4),_0x5d04b1['output']||'csv'),'reportId':_0x33f460['id'],'reportType':_0x7e13('0x92')});return db['AnalyticExtractedReport'][_0x7e13('0x44')](_0x4511c4,{'raw':!![]});})['then'](function(_0x12e510){if(_0x33f460[_0x7e13('0x7b')]==='cdr'){_0x40dcd1['where'](_0x33f460['table']+_0x7e13('0x93'),_0x5d04b1[_0x7e13('0x94')],_0x5d04b1['endDate']);}else{_0x40dcd1['where'](_0x33f460[_0x7e13('0x7b')]+_0x7e13('0x95'),_0x5d04b1['startDate'],_0x5d04b1[_0x7e13('0x96')]);}if(_0x12e510){logger[_0x7e13('0x97')](_0x7e13('0x98'),_0x40dcd1[_0x7e13('0x82')]());require(_0x7e13('0x99'))[_0x7e13('0x9a')](path[_0x7e13('0x85')](__dirname,_0x7e13('0x9b'),_0x12e510[_0x7e13('0x8c')]),[_0x12e510['id'],_0x40dcd1[_0x7e13('0x82')](),path['join'](__dirname,_0x7e13('0x9c'),_0x12e510[_0x7e13('0x9d')]),_0x2f8b3b]);return _0x12e510;}else{var _0xd93f33=squel[_0x7e13('0x6d')]();_0xd93f33[_0x7e13('0x6e')]('('+_0x40dcd1[_0x7e13('0x82')]()+')',_0x7e13('0x9e'));_0xd93f33[_0x7e13('0x63')]('COUNT(*)','count');_0x40dcd1[_0x7e13('0x1d')](_0x5d04b1[_0x7e13('0x1d')]||_0x506924);_0x40dcd1['offset'](_0x5d04b1[_0x7e13('0x1b')]||0x0);return dbH[_0x7e13('0x81')][_0x7e13('0x2e')](_0xd93f33['toString'](),{'type':dbH['sequelize'][_0x7e13('0x83')][_0x7e13('0x84')]})[_0x7e13('0x23')](function(_0x4ffb0f){if(!_0x4ffb0f[_0x7e13('0x35')]){_0x4a3c53=0x0;}else{_0x4a3c53=_0x4ffb0f[0x0][_0x7e13('0x1e')]||0x0;}return dbH[_0x7e13('0x81')]['query'](_0x40dcd1[_0x7e13('0x82')](),{'type':dbH[_0x7e13('0x81')]['QueryTypes'][_0x7e13('0x84')]});})['then'](function(_0x43254c){return{'rows':_0x43254c||[],'count':_0x4a3c53};});}});}exports[_0x7e13('0x9f')]=function(_0x40d3dc,_0x366b11){return runReport(_0x40d3dc[_0x7e13('0x50')],_0x40d3dc[_0x7e13('0x2e')],_0x40d3dc[_0x7e13('0x3d')])[_0x7e13('0x23')](respondWithResult(_0x366b11,null))['catch'](handleError(_0x366b11,null));};exports[_0x7e13('0xa0')]=runReport;exports[_0x7e13('0x2e')]=function(_0x759c7f,_0x2e78a2){var _0x5e0562=0xa;var _0x3befe7=[_0x7e13('0x85'),_0x7e13('0x52'),_0x7e13('0x86'),_0x7e13('0x87')];var _0x497ebb={'SUM':_0x7e13('0x53'),'COUNT':_0x7e13('0x54'),'COUNT DISTINCT':_0x7e13('0xa1'),'MAX':_0x7e13('0x88'),'MIN':'MIN(%s)','AVG':_0x7e13('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7e13('0xa2')};var _0x3ca270={'SEC_TO_TIME':_0x7e13('0x59'),'DATE':_0x7e13('0x89'),'HOUR':_0x7e13('0x5a'),'ROUND':_0x7e13('0x8a'),'UNIX_TIMESTAMP':_0x7e13('0x5b')};var _0x3881b0=function(_0x53dacd){return!_['includes']([_0x7e13('0x5d'),_0x7e13('0x5e'),_0x7e13('0x8b'),_0x7e13('0x5f')],_0x53dacd);};var _0x206e99=function(_0x505435){if(!_0x505435||!_0x505435[_0x7e13('0x60')][_0x7e13('0x35')]){return'';}for(var _0x2fdd8c='(',_0x3e9170=0x0;_0x3e9170<_0x505435[_0x7e13('0x60')][_0x7e13('0x35')];_0x3e9170+=0x1){_0x3e9170>0x0&&(_0x2fdd8c+='\x20'+_0x505435['operator']+'\x20');_0x2fdd8c+=_0x505435[_0x7e13('0x60')][_0x3e9170][_0x7e13('0x62')]?_0x206e99(_0x505435[_0x7e13('0x60')][_0x3e9170][_0x7e13('0x62')]):_0x505435[_0x7e13('0x60')][_0x3e9170][_0x7e13('0x63')]+'\x20'+_0x505435[_0x7e13('0x60')][_0x3e9170]['condition']+(_0x3881b0(_0x505435[_0x7e13('0x60')][_0x3e9170][_0x7e13('0x64')])?'\x20'+_0x505435[_0x7e13('0x60')][_0x3e9170]['value']:'');}return _0x2fdd8c+')';};var _0x17d543={'where':{'id':_0x759c7f[_0x7e13('0x50')]['id']}},_0x490d8e,_0x4d560c,_0x2c3e27,_0x4bb07c,_0x3294e8;_0x17d543=_[_0x7e13('0x3c')]({},_0x17d543,_0x759c7f[_0x7e13('0x3d')]);return db['AnalyticCustomReport'][_0x7e13('0x43')](_0x17d543)[_0x7e13('0x23')](function(_0xee1c3d){if(_0xee1c3d){_0x490d8e=_0xee1c3d;return _0xee1c3d[_0x7e13('0x66')]();}return null;})['then'](function(_0x394cad){if(_0x394cad){if(!_0x394cad['length']){throw new db['Sequelize'][(_0x7e13('0x68'))](_0x7e13('0x69'),0x193);}_0x4d560c=_0x394cad;return db['AnalyticMetric'][_0x7e13('0x6b')]({'raw':!![]});}return null;})[_0x7e13('0x23')](function(_0xe88572){if(_0xe88572){_0x2c3e27=_['keyBy'](_0xe88572,'id');var _0x4eb17d;var _0x50d51f=squel['select']();_0x50d51f[_0x7e13('0x6e')](_0x490d8e[_0x7e13('0x7b')]);for(var _0x142652=0x0;_0x142652<_0x4d560c[_0x7e13('0x35')];_0x142652+=0x1){_0x4eb17d=_0x4d560c[_0x142652]['MetricId']?_0x2c3e27[_0x4d560c[_0x142652][_0x7e13('0x6f')]]['metric']:_0x4d560c[_0x142652][_0x7e13('0x63')];_0x4eb17d=_0x4d560c[_0x142652][_0x7e13('0x71')]?_[_0x7e13('0x72')](_0x497ebb[_0x4d560c[_0x142652][_0x7e13('0x71')]],'%s',_0x4eb17d):_0x4eb17d;_0x4eb17d=_0x4d560c[_0x142652][_0x7e13('0x79')]?_['replace'](_0x3ca270[_0x4d560c[_0x142652]['format']],'%s',_0x4eb17d):_0x4eb17d;if(_0x4d560c[_0x142652][_0x7e13('0x73')]){_0x50d51f[_0x7e13('0x62')](_0x4eb17d);}_0x4d560c[_0x142652][_0x7e13('0x74')]&&_0x50d51f[_0x7e13('0x37')](_0x4eb17d,_0x4d560c[_0x142652]['orderBy']==='DESC'?![]:!![]);_0x50d51f[_0x7e13('0x63')](_0x4eb17d,_0x4d560c[_0x142652][_0x7e13('0xa3')]||_0x4eb17d);}if(_0x490d8e['joins']){_0x490d8e[_0x7e13('0x76')]=JSON[_0x7e13('0x7e')](_0x490d8e['joins']);for(var _0x5ceba9=0x0;_0x5ceba9<_0x490d8e[_0x7e13('0x76')]['length'];_0x5ceba9+=0x1){if(_0x490d8e[_0x7e13('0x76')][_0x5ceba9][_0x7e13('0x2b')]&&_['includes'](_0x3befe7,_0x490d8e['joins'][_0x5ceba9][_0x7e13('0x2b')])&&_0x490d8e[_0x7e13('0x76')][_0x5ceba9][_0x7e13('0x7c')]&&_0x490d8e[_0x7e13('0x76')][_0x5ceba9][_0x7e13('0x77')]&&_0x490d8e[_0x7e13('0x76')][_0x5ceba9][_0x7e13('0x78')]){_0x50d51f[_0x490d8e[_0x7e13('0x76')][_0x5ceba9][_0x7e13('0x2b')]](_0x490d8e[_0x7e13('0x76')][_0x5ceba9][_0x7e13('0x77')],null,util[_0x7e13('0x79')]('%s.%s\x20=\x20%s.%s',_0x490d8e[_0x7e13('0x7b')],_0x490d8e[_0x7e13('0x76')][_0x5ceba9]['parentKey'],_0x490d8e['joins'][_0x5ceba9][_0x7e13('0x77')],_0x490d8e[_0x7e13('0x76')][_0x5ceba9]['foreignKey']));}}}if(_0x490d8e[_0x7e13('0x7d')]){_0x490d8e[_0x7e13('0x7d')]=JSON[_0x7e13('0x7e')](_0x490d8e[_0x7e13('0x7d')]);_0x50d51f[_0x7e13('0x3b')](_0x206e99(_0x490d8e[_0x7e13('0x7d')][_0x7e13('0x62')]));}_0x3294e8=_0x50d51f[_0x7e13('0x7f')]();_0x50d51f[_0x7e13('0x1d')](_0x5e0562);_0x50d51f[_0x7e13('0x1b')](0x0);logger[_0x7e13('0xa4')](_0x7e13('0x80'),_0x50d51f[_0x7e13('0x82')]());return dbH[_0x7e13('0x81')][_0x7e13('0x2e')](_0x50d51f[_0x7e13('0x82')](),{'type':dbH[_0x7e13('0x81')][_0x7e13('0x83')][_0x7e13('0x84')]});}})[_0x7e13('0x23')](function(){return{'sql':_0x3294e8[_0x7e13('0x82')]()};})[_0x7e13('0x23')](respondWithResult(_0x2e78a2,null))['catch'](handleError(_0x2e78a2,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 8aea977..a9d7061 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 _0x8883=['AnalyticCustomReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','define'];(function(_0x2c6ba4,_0x5b2f52){var _0x5036ad=function(_0x422e2a){while(--_0x422e2a){_0x2c6ba4['push'](_0x2c6ba4['shift']());}};_0x5036ad(++_0x5b2f52);}(_0x8883,0xde));var _0x3888=function(_0x4cf69c,_0x5129c6){_0x4cf69c=_0x4cf69c-0x0;var _0x3cb05b=_0x8883[_0x4cf69c];return _0x3cb05b;};'use strict';var _=require(_0x3888('0x0'));var util=require(_0x3888('0x1'));var logger=require(_0x3888('0x2'))(_0x3888('0x3'));var moment=require(_0x3888('0x4'));var BPromise=require(_0x3888('0x5'));var rp=require(_0x3888('0x6'));var fs=require('fs');var path=require(_0x3888('0x7'));var rimraf=require(_0x3888('0x8'));var config=require(_0x3888('0x9'));var attributes=require(_0x3888('0xa'));module['exports']=function(_0x4dc7eb,_0x767e92){return _0x4dc7eb[_0x3888('0xb')](_0x3888('0xc'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf31b=['analytics_custom_reports','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x5c5c52,_0x36d085){var _0x4229ff=function(_0x3806df){while(--_0x3806df){_0x5c5c52['push'](_0x5c5c52['shift']());}};_0x4229ff(++_0x36d085);}(_0xf31b,0xa9));var _0xbf31=function(_0x5ccb7d,_0x546ead){_0x5ccb7d=_0x5ccb7d-0x0;var _0x53e62d=_0xf31b[_0x5ccb7d];return _0x53e62d;};'use strict';var _=require(_0xbf31('0x0'));var util=require(_0xbf31('0x1'));var logger=require('../../config/logger')(_0xbf31('0x2'));var moment=require(_0xbf31('0x3'));var BPromise=require(_0xbf31('0x4'));var rp=require(_0xbf31('0x5'));var fs=require('fs');var path=require(_0xbf31('0x6'));var rimraf=require(_0xbf31('0x7'));var config=require(_0xbf31('0x8'));var attributes=require('./analyticCustomReport.attributes');module[_0xbf31('0x9')]=function(_0x571c16,_0x40b9e9){return _0x571c16[_0xbf31('0xa')]('AnalyticCustomReport',attributes,{'tableName':_0xbf31('0xb'),'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 601e363..4633058 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 _0x66c7=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','randomstring'];(function(_0x30b3ab,_0x5b5995){var _0x4f454d=function(_0x3a069e){while(--_0x3a069e){_0x30b3ab['push'](_0x30b3ab['shift']());}};_0x4f454d(++_0x5b5995);}(_0x66c7,0x161));var _0x766c=function(_0xd341da,_0x24be3f){_0xd341da=_0xd341da-0x0;var _0x35a42b=_0x66c7[_0xd341da];return _0x35a42b;};'use strict';var _=require(_0x766c('0x0'));var util=require(_0x766c('0x1'));var moment=require(_0x766c('0x2'));var BPromise=require('bluebird');var rs=require(_0x766c('0x3'));var fs=require('fs');var Redis=require(_0x766c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x766c('0x5'));var logger=require(_0x766c('0x6'))('rpc');var config=require(_0x766c('0x7'));var jayson=require(_0x766c('0x8'));var client=jayson[_0x766c('0x9')][_0x766c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xce13b2,_0x45c180,_0x1484c9){return new BPromise(function(_0x525af9,_0x4d8cea){return client['request'](_0xce13b2,_0x1484c9)['then'](function(_0x4cc7cb){logger['info'](_0x766c('0xb'),_0x45c180,_0x766c('0xc'));logger[_0x766c('0xd')](_0x766c('0xe'),_0x45c180,_0x766c('0xc'),JSON[_0x766c('0xf')](_0x4cc7cb));if(_0x4cc7cb[_0x766c('0x10')]){if(_0x4cc7cb[_0x766c('0x10')][_0x766c('0x11')]===0x1f4){logger[_0x766c('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x45c180,_0x4cc7cb['error'][_0x766c('0x12')]);return _0x4d8cea(_0x4cc7cb[_0x766c('0x10')][_0x766c('0x12')]);}logger[_0x766c('0x10')](_0x766c('0xb'),_0x45c180,_0x4cc7cb[_0x766c('0x10')][_0x766c('0x12')]);return _0x525af9(_0x4cc7cb[_0x766c('0x10')]['message']);}else{logger[_0x766c('0x13')](_0x766c('0xb'),_0x45c180,_0x766c('0xc'));_0x525af9(_0x4cc7cb['result'][_0x766c('0x12')]);}})[_0x766c('0x14')](function(_0x3e3e87){logger[_0x766c('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x45c180,_0x3e3e87);_0x4d8cea(_0x3e3e87);});});} \ No newline at end of file +var _0x4105=['bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','http','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x4105,0x1d1));var _0x5410=function(_0x4e2b67,_0xf1e740){_0x4e2b67=_0x4e2b67-0x0;var _0x1cd340=_0x4105[_0x4e2b67];return _0x1cd340;};'use strict';var _=require(_0x5410('0x0'));var util=require(_0x5410('0x1'));var moment=require(_0x5410('0x2'));var BPromise=require(_0x5410('0x3'));var rs=require(_0x5410('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5410('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5410('0x6'));var jayson=require(_0x5410('0x7'));var client=jayson['client'][_0x5410('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58ac56,_0x536eb2,_0xb5abed){return new BPromise(function(_0x3095e9,_0x2814e5){return client['request'](_0x58ac56,_0xb5abed)['then'](function(_0x2032a3){logger[_0x5410('0x9')](_0x5410('0xa'),_0x536eb2,_0x5410('0xb'));logger['debug'](_0x5410('0xc'),_0x536eb2,_0x5410('0xb'),JSON[_0x5410('0xd')](_0x2032a3));if(_0x2032a3['error']){if(_0x2032a3[_0x5410('0xe')][_0x5410('0xf')]===0x1f4){logger[_0x5410('0xe')](_0x5410('0xa'),_0x536eb2,_0x2032a3[_0x5410('0xe')][_0x5410('0x10')]);return _0x2814e5(_0x2032a3[_0x5410('0xe')][_0x5410('0x10')]);}logger[_0x5410('0xe')](_0x5410('0xa'),_0x536eb2,_0x2032a3['error']['message']);return _0x3095e9(_0x2032a3[_0x5410('0xe')][_0x5410('0x10')]);}else{logger[_0x5410('0x9')](_0x5410('0xa'),_0x536eb2,_0x5410('0xb'));_0x3095e9(_0x2032a3['result'][_0x5410('0x10')]);}})[_0x5410('0x11')](function(_0x5bd1e1){logger[_0x5410('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x536eb2,_0x5bd1e1);_0x2814e5(_0x5bd1e1);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index b7c57bd..aebfe2a 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 _0xf76c=['delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/run','/:id/query','query','post','create'];(function(_0x581b73,_0x4fa43c){var _0x3ea0ec=function(_0x2bf299){while(--_0x2bf299){_0x581b73['push'](_0x581b73['shift']());}};_0x3ea0ec(++_0x4fa43c);}(_0xf76c,0x137));var _0xcf76=function(_0x32179c,_0x32fb68){_0x32179c=_0x32179c-0x0;var _0xad3766=_0xf76c[_0x32179c];return _0xad3766;};'use strict';var multer=require(_0xcf76('0x0'));var util=require(_0xcf76('0x1'));var path=require('path');var timeout=require(_0xcf76('0x2'));var express=require(_0xcf76('0x3'));var router=express[_0xcf76('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcf76('0x5'));var interaction=require(_0xcf76('0x6'));var config=require(_0xcf76('0x7'));var controller=require('./analyticCustomReport.controller');router[_0xcf76('0x8')]('/',auth[_0xcf76('0x9')](),controller[_0xcf76('0xa')]);router['get'](_0xcf76('0xb'),auth[_0xcf76('0x9')](),controller[_0xcf76('0xc')]);router['get'](_0xcf76('0xd'),auth[_0xcf76('0x9')](),controller['preview']);router['get'](_0xcf76('0xe'),auth[_0xcf76('0x9')](),controller['run']);router[_0xcf76('0x8')](_0xcf76('0xf'),auth[_0xcf76('0x9')](),controller[_0xcf76('0x10')]);router[_0xcf76('0x11')]('/',auth[_0xcf76('0x9')](),controller[_0xcf76('0x12')]);router['put']('/:id',auth[_0xcf76('0x9')](),controller['update']);router[_0xcf76('0x13')](_0xcf76('0xb'),auth[_0xcf76('0x9')](),controller[_0xcf76('0x14')]);module[_0xcf76('0x15')]=router; \ No newline at end of file +var _0xf900=['run','query','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','get','/:id/preview','preview','/:id/run'];(function(_0x267bb1,_0x5c29db){var _0x101caa=function(_0x2f061c){while(--_0x2f061c){_0x267bb1['push'](_0x267bb1['shift']());}};_0x101caa(++_0x5c29db);}(_0xf900,0x140));var _0x0f90=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xf900[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require(_0x0f90('0x0'));var util=require(_0x0f90('0x1'));var path=require('path');var timeout=require(_0x0f90('0x2'));var express=require(_0x0f90('0x3'));var router=express[_0x0f90('0x4')]();var fs_extra=require(_0x0f90('0x5'));var auth=require(_0x0f90('0x6'));var interaction=require(_0x0f90('0x7'));var config=require(_0x0f90('0x8'));var controller=require(_0x0f90('0x9'));router['get']('/',auth[_0x0f90('0xa')](),controller[_0x0f90('0xb')]);router[_0x0f90('0xc')]('/:id',auth[_0x0f90('0xa')](),controller['show']);router['get'](_0x0f90('0xd'),auth[_0x0f90('0xa')](),controller[_0x0f90('0xe')]);router[_0x0f90('0xc')](_0x0f90('0xf'),auth[_0x0f90('0xa')](),controller[_0x0f90('0x10')]);router[_0x0f90('0xc')]('/:id/query',auth[_0x0f90('0xa')](),controller[_0x0f90('0x11')]);router['post']('/',auth[_0x0f90('0xa')](),controller['create']);router[_0x0f90('0x12')](_0x0f90('0x13'),auth[_0x0f90('0xa')](),controller[_0x0f90('0x14')]);router[_0x0f90('0x15')]('/:id',auth[_0x0f90('0xa')](),controller[_0x0f90('0x16')]);module[_0x0f90('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 7b3695c..f08fbc9 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 _0x33c5=['STRING','TEXT','exports'];(function(_0x8eb530,_0xb4b40f){var _0x2673ab=function(_0x15651f){while(--_0x15651f){_0x8eb530['push'](_0x8eb530['shift']());}};_0x2673ab(++_0xb4b40f);}(_0x33c5,0xe6));var _0x533c=function(_0x582d0b,_0x28f609){_0x582d0b=_0x582d0b-0x0;var _0x2e93e1=_0x33c5[_0x582d0b];return _0x2e93e1;};'use strict';var Sequelize=require('sequelize');module[_0x533c('0x0')]={'name':{'type':Sequelize[_0x533c('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x533c('0x1')]},'table':{'type':Sequelize[_0x533c('0x1')]},'conditions':{'type':Sequelize[_0x533c('0x2')]},'joins':{'type':Sequelize[_0x533c('0x2')]}}; \ No newline at end of file +var _0x5fd1=['STRING','TEXT','sequelize'];(function(_0x301c34,_0x15701e){var _0x1a8c5a=function(_0x297b4f){while(--_0x297b4f){_0x301c34['push'](_0x301c34['shift']());}};_0x1a8c5a(++_0x15701e);}(_0x5fd1,0x155));var _0x15fd=function(_0x4e9160,_0x24cfe9){_0x4e9160=_0x4e9160-0x0;var _0x168a15=_0x5fd1[_0x4e9160];return _0x168a15;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'name':{'type':Sequelize[_0x15fd('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x15fd('0x1')]},'parent':{'type':Sequelize[_0x15fd('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x15fd('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index ed1a53d..b822af1 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 _0x1261=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','limit','undefined','set','json','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','error','name','index','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','count','include','findAll','rows','show','length','includeAll','options','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','params','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%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)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','conditions','parse','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','AVG(%s)','DATE(%s)','value','keyBy','select','order','%s.%s\x20=\x20%s.%s','clone','web','fullPath','randomstring','generate','output','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','Run\x20Query:','../../components/export/','savename','COUNT(*)','run','runReport','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','Sequelize','debug'];(function(_0x22a585,_0x17b18a){var _0x235bb9=function(_0x574d2b){while(--_0x574d2b){_0x22a585['push'](_0x22a585['shift']());}};_0x235bb9(++_0x17b18a);}(_0x1261,0x144));var _0x1126=function(_0x1385f0,_0x5550bb){_0x1385f0=_0x1385f0-0x0;var _0x36ca00=_0x1261[_0x1385f0];return _0x36ca00;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];var dbH=require(_0x1126('0x17'))[_0x1126('0x18')];function respondWithStatusCode(_0xca0355,_0x3f10e9){_0x3f10e9=_0x3f10e9||0xcc;return function(_0xd8ca42){if(_0xd8ca42){return _0xca0355[_0x1126('0x19')](_0x3f10e9);}return _0xca0355[_0x1126('0x1a')](_0x3f10e9)['end']();};}function respondWithResult(_0x5de9a7,_0x1af673){_0x1af673=_0x1af673||0xc8;return function(_0x154e20){if(_0x154e20){return _0x5de9a7[_0x1126('0x1a')](_0x1af673)['json'](_0x154e20);}};}function respondWithFilteredResult(_0x45149c,_0x4794a7){return function(_0x35fe9f){if(_0x35fe9f){var _0x42f379=typeof _0x4794a7[_0x1126('0x1b')]==='undefined'&&typeof _0x4794a7[_0x1126('0x1c')]===_0x1126('0x1d');var _0x4a7b49=_0x35fe9f['count'];var _0x22ae0b=_0x42f379?0x0:_0x4794a7[_0x1126('0x1b')];var _0x58d11a=_0x42f379?_0x35fe9f['count']:_0x4794a7[_0x1126('0x1b')]+_0x4794a7['limit'];var _0x22ed37;if(_0x58d11a>=_0x4a7b49){_0x58d11a=_0x4a7b49;_0x22ed37=0xc8;}else{_0x22ed37=0xce;}_0x45149c[_0x1126('0x1a')](_0x22ed37);return _0x45149c[_0x1126('0x1e')]('Content-Range',_0x22ae0b+'-'+_0x58d11a+'/'+_0x4a7b49)[_0x1126('0x1f')](_0x35fe9f);}return null;};}function patchUpdates(_0x49d209){return function(_0x56efeb){try{jsonpatch[_0x1126('0x20')](_0x56efeb,_0x49d209,!![]);}catch(_0x3a9bed){return BPromise[_0x1126('0x21')](_0x3a9bed);}return _0x56efeb[_0x1126('0x22')]();};}function saveUpdates(_0x526ca1,_0x29ab60){return function(_0x477e6a){if(_0x477e6a){return _0x477e6a['update'](_0x526ca1)[_0x1126('0x23')](function(_0x59cd8e){return _0x59cd8e;});}return null;};}function removeEntity(_0x529dd9,_0x4b57ab){return function(_0x2199d9){if(_0x2199d9){return _0x2199d9[_0x1126('0x24')]()[_0x1126('0x23')](function(){var _0x34bcf1=_0x2199d9[_0x1126('0x25')]({'plain':!![]});var _0x1b07a7=_0x1126('0x26');return db[_0x1126('0x27')]['destroy']({'where':{'type':_0x1b07a7,'resourceId':_0x34bcf1['id']}})[_0x1126('0x23')](function(){return _0x2199d9;});})[_0x1126('0x23')](function(){_0x529dd9[_0x1126('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x541bc9,_0xeb7d89){return function(_0x39bf0e){if(!_0x39bf0e){_0x541bc9['sendStatus'](0x194);}return _0x39bf0e;};}function handleError(_0x2fb797,_0x23d2bc){_0x23d2bc=_0x23d2bc||0x1f4;return function(_0x4a334a){logger[_0x1126('0x28')](_0x4a334a['stack']);if(_0x4a334a[_0x1126('0x29')]){delete _0x4a334a['name'];}_0x2fb797[_0x1126('0x1a')](_0x23d2bc)['send'](_0x4a334a);};}exports[_0x1126('0x2a')]=function(_0x5f2611,_0x5252e0){var _0x4a53ab={},_0x17646e={},_0xa8906d={'count':0x0,'rows':[]};var _0x1cef48=_['map'](db[_0x1126('0x2b')][_0x1126('0x2c')],function(_0x56f7f8){return{'name':_0x56f7f8[_0x1126('0x2d')],'type':_0x56f7f8[_0x1126('0x2e')][_0x1126('0x2f')]};});_0x17646e[_0x1126('0x30')]=_['map'](_0x1cef48,'name');_0x17646e[_0x1126('0x31')]=_[_0x1126('0x32')](_0x5f2611[_0x1126('0x31')]);_0x17646e[_0x1126('0x33')]=_['intersection'](_0x17646e[_0x1126('0x30')],_0x17646e[_0x1126('0x31')]);_0x4a53ab[_0x1126('0x34')]=_[_0x1126('0x35')](_0x17646e[_0x1126('0x30')],qs['fields'](_0x5f2611[_0x1126('0x31')][_0x1126('0x36')]));_0x4a53ab[_0x1126('0x34')]=_0x4a53ab[_0x1126('0x34')]['length']?_0x4a53ab['attributes']:_0x17646e[_0x1126('0x30')];if(!_0x5f2611[_0x1126('0x31')]['hasOwnProperty'](_0x1126('0x37'))){_0x4a53ab[_0x1126('0x1c')]=qs[_0x1126('0x1c')](_0x5f2611['query']['limit']);_0x4a53ab[_0x1126('0x1b')]=qs[_0x1126('0x1b')](_0x5f2611[_0x1126('0x31')][_0x1126('0x1b')]);}_0x4a53ab['order']=qs[_0x1126('0x38')](_0x5f2611['query'][_0x1126('0x38')]);_0x4a53ab[_0x1126('0x39')]=qs[_0x1126('0x33')](_[_0x1126('0x3a')](_0x5f2611[_0x1126('0x31')],_0x17646e['filters']),_0x1cef48);if(_0x5f2611[_0x1126('0x31')][_0x1126('0x3b')]){_0x4a53ab[_0x1126('0x39')]=_[_0x1126('0x3c')](_0x4a53ab[_0x1126('0x39')],{'$or':_[_0x1126('0x3d')](_0x1cef48,function(_0x3052f9){if(_0x3052f9['type']!==_0x1126('0x3e')){var _0x154c28={};_0x154c28[_0x3052f9[_0x1126('0x29')]]={'$like':'%'+_0x5f2611[_0x1126('0x31')][_0x1126('0x3b')]+'%'};return _0x154c28;}})});}_0x4a53ab=_['merge']({},_0x4a53ab,_0x5f2611['options']);var _0x1c4f06={'where':_0x4a53ab[_0x1126('0x39')]};return db[_0x1126('0x2b')][_0x1126('0x3f')](_0x1c4f06)[_0x1126('0x23')](function(_0x276fd5){_0xa8906d['count']=_0x276fd5;if(_0x5f2611['query']['includeAll']){_0x4a53ab[_0x1126('0x40')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x1126('0x41')](_0x4a53ab);})[_0x1126('0x23')](function(_0x3584a3){_0xa8906d[_0x1126('0x42')]=_0x3584a3;return _0xa8906d;})['then'](respondWithFilteredResult(_0x5252e0,_0x4a53ab))['catch'](handleError(_0x5252e0,null));};exports[_0x1126('0x43')]=function(_0xa93167,_0x1d63b9){var _0x5f5d3a={'raw':!![],'where':{'id':_0xa93167['params']['id']}},_0x2f8551={};_0x2f8551[_0x1126('0x30')]=_['keys'](db[_0x1126('0x2b')][_0x1126('0x2c')]);_0x2f8551[_0x1126('0x31')]=_['keys'](_0xa93167[_0x1126('0x31')]);_0x2f8551[_0x1126('0x33')]=_[_0x1126('0x35')](_0x2f8551['model'],_0x2f8551['query']);_0x5f5d3a['attributes']=_[_0x1126('0x35')](_0x2f8551['model'],qs[_0x1126('0x36')](_0xa93167['query'][_0x1126('0x36')]));_0x5f5d3a[_0x1126('0x34')]=_0x5f5d3a[_0x1126('0x34')][_0x1126('0x44')]?_0x5f5d3a[_0x1126('0x34')]:_0x2f8551['model'];if(_0xa93167[_0x1126('0x31')][_0x1126('0x45')]){_0x5f5d3a['include']=[{'all':!![]}];}_0x5f5d3a=_[_0x1126('0x3c')]({},_0x5f5d3a,_0xa93167[_0x1126('0x46')]);return db['AnalyticDefaultReport'][_0x1126('0x47')](_0x5f5d3a)[_0x1126('0x23')](handleEntityNotFound(_0x1d63b9,null))['then'](respondWithResult(_0x1d63b9,null))[_0x1126('0x48')](handleError(_0x1d63b9,null));};exports[_0x1126('0x49')]=function(_0x213a76,_0x59656d){return db[_0x1126('0x2b')][_0x1126('0x49')](_0x213a76[_0x1126('0x4a')],{})[_0x1126('0x23')](function(_0x224456){var _0x2081f2=_0x213a76[_0x1126('0x4b')][_0x1126('0x25')]({'plain':!![]});if(!_0x2081f2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2081f2[_0x1126('0x4c')]==='user'){var _0x40168e=_0x224456[_0x1126('0x25')]({'plain':!![]});var _0x4a1831='Reports';return db[_0x1126('0x4d')][_0x1126('0x47')]({'where':{'name':_0x4a1831,'userProfileId':_0x2081f2[_0x1126('0x4e')]},'raw':!![]})['then'](function(_0x3cb44c){if(_0x3cb44c&&_0x3cb44c[_0x1126('0x4f')]===0x0){return db[_0x1126('0x27')][_0x1126('0x49')]({'name':_0x40168e['name'],'resourceId':_0x40168e['id'],'type':_0x1126('0x26'),'sectionId':_0x3cb44c['id']},{})[_0x1126('0x23')](function(){return _0x224456;});}else{return _0x224456;}})['catch'](function(_0x4bcc08){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4bcc08);throw _0x4bcc08;});}return _0x224456;})[_0x1126('0x23')](respondWithResult(_0x59656d,0xc9))[_0x1126('0x48')](handleError(_0x59656d,null));};exports['update']=function(_0x16552b,_0x1c7a2b){if(_0x16552b[_0x1126('0x4a')]['id']){delete _0x16552b[_0x1126('0x4a')]['id'];}return db[_0x1126('0x2b')]['find']({'where':{'id':_0x16552b[_0x1126('0x50')]['id']}})[_0x1126('0x23')](handleEntityNotFound(_0x1c7a2b,null))['then'](saveUpdates(_0x16552b[_0x1126('0x4a')],null))[_0x1126('0x23')](respondWithResult(_0x1c7a2b,null))[_0x1126('0x48')](handleError(_0x1c7a2b,null));};exports[_0x1126('0x24')]=function(_0xc8a0f,_0x59c3d0){return db[_0x1126('0x2b')]['find']({'where':{'id':_0xc8a0f[_0x1126('0x50')]['id']}})[_0x1126('0x23')](handleEntityNotFound(_0x59c3d0,null))[_0x1126('0x23')](removeEntity(_0x59c3d0,null))['catch'](handleError(_0x59c3d0,null));};exports[_0x1126('0x51')]=function(_0x2340f8,_0x5763b4){var _0x30812d=0xa;var _0x25038f=[_0x1126('0x52'),'left_join',_0x1126('0x53'),_0x1126('0x54')];var _0x22ab18={'SUM':_0x1126('0x55'),'COUNT':_0x1126('0x56'),'COUNT DISTINCT':_0x1126('0x57'),'MAX':_0x1126('0x58'),'MIN':_0x1126('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x1126('0x5a'),'GROUP_CONCAT ASC':_0x1126('0x5b'),'GROUP_CONCAT DESC':_0x1126('0x5c')};var _0x2a5422={'SEC_TO_TIME':_0x1126('0x5d'),'DATE':'DATE(%s)','HOUR':_0x1126('0x5e'),'ROUND':_0x1126('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3767e4=function(_0x5246aa){return!_[_0x1126('0x60')]([_0x1126('0x61'),'IS\x20NOT\x20NULL',_0x1126('0x62'),_0x1126('0x63')],_0x5246aa);};var _0x375b76=function(_0x592960){if(!_0x592960||!_0x592960[_0x1126('0x64')]['length']){return'';}for(var _0x558b6e='(',_0xbdc58=0x0;_0xbdc58<_0x592960[_0x1126('0x64')][_0x1126('0x44')];_0xbdc58+=0x1){_0xbdc58>0x0&&(_0x558b6e+='\x20'+_0x592960[_0x1126('0x65')]+'\x20');_0x558b6e+=_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x66')]?_0x375b76(_0x592960[_0x1126('0x64')][_0xbdc58]['group']):_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x67')]+'\x20'+_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x68')]+(_0x3767e4(_0x592960[_0x1126('0x64')][_0xbdc58][_0x1126('0x68')])?'\x20'+_0x592960['rules'][_0xbdc58]['value']:'');}return _0x558b6e+')';};var _0x16a343={'where':{'id':_0x2340f8[_0x1126('0x50')]['id']}},_0x3921c2,_0x4bf2b3,_0x5ee130,_0x5e9260,_0x51a28d;_0x16a343=_[_0x1126('0x3c')]({},_0x16a343,_0x2340f8[_0x1126('0x46')]);return db['AnalyticDefaultReport'][_0x1126('0x47')](_0x16a343)[_0x1126('0x23')](function(_0x170bf0){if(_0x170bf0){_0x3921c2=_0x170bf0;return _0x170bf0[_0x1126('0x69')]();}return null;})[_0x1126('0x23')](function(_0x3f007b){if(_0x3f007b){if(!_0x3f007b[_0x1126('0x44')]){throw new db['Sequelize'][(_0x1126('0x6a'))](_0x1126('0x6b'),0x193);}_0x4bf2b3=_0x3f007b;return db[_0x1126('0x6c')][_0x1126('0x41')]({'raw':!![]});}return null;})[_0x1126('0x23')](function(_0x56c003){if(_0x56c003){_0x5ee130=_['keyBy'](_0x56c003,'id');var _0x15cf3d;var _0x2643d7=squel['select']();_0x2643d7[_0x1126('0x6d')](_0x3921c2[_0x1126('0x6e')]);for(var _0x366675=0x0;_0x366675<_0x4bf2b3[_0x1126('0x44')];_0x366675+=0x1){_0x15cf3d=_0x4bf2b3[_0x366675][_0x1126('0x6f')]?_0x5ee130[_0x4bf2b3[_0x366675][_0x1126('0x6f')]][_0x1126('0x70')]:_0x4bf2b3[_0x366675][_0x1126('0x67')];_0x15cf3d=_0x4bf2b3[_0x366675][_0x1126('0x71')]?_[_0x1126('0x72')](_0x22ab18[_0x4bf2b3[_0x366675][_0x1126('0x71')]],'%s',_0x15cf3d):_0x15cf3d;_0x15cf3d=_0x4bf2b3[_0x366675][_0x1126('0x73')]?_[_0x1126('0x72')](_0x2a5422[_0x4bf2b3[_0x366675]['format']],'%s',_0x15cf3d):_0x15cf3d;if(_0x4bf2b3[_0x366675][_0x1126('0x74')]){_0x2643d7[_0x1126('0x66')](_0x15cf3d);}_0x4bf2b3[_0x366675][_0x1126('0x75')]&&_0x2643d7['order'](_0x15cf3d,_0x4bf2b3[_0x366675]['orderBy']===_0x1126('0x76')?![]:!![]);_0x2643d7[_0x1126('0x67')](_0x15cf3d,_0x4bf2b3[_0x366675][_0x1126('0x77')]||_0x15cf3d);}if(_0x3921c2[_0x1126('0x78')]){_0x3921c2['joins']=JSON['parse'](_0x3921c2['joins']);for(var _0x79afca=0x0;_0x79afca<_0x3921c2[_0x1126('0x78')][_0x1126('0x44')];_0x79afca+=0x1){if(_0x3921c2[_0x1126('0x78')][_0x79afca]['type']&&_[_0x1126('0x60')](_0x25038f,_0x3921c2['joins'][_0x79afca][_0x1126('0x2e')])&&_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x79')]&&_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x7a')]&&_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x7b')]){_0x2643d7[_0x3921c2['joins'][_0x79afca][_0x1126('0x2e')]](_0x3921c2['joins'][_0x79afca][_0x1126('0x7a')],null,util[_0x1126('0x73')]('%s.%s\x20=\x20%s.%s',_0x3921c2[_0x1126('0x6e')],_0x3921c2[_0x1126('0x78')][_0x79afca]['parentKey'],_0x3921c2[_0x1126('0x78')][_0x79afca][_0x1126('0x7a')],_0x3921c2['joins'][_0x79afca]['foreignKey']));}}}if(_0x3921c2[_0x1126('0x7c')]){_0x3921c2[_0x1126('0x7c')]=JSON[_0x1126('0x7d')](_0x3921c2['conditions']);_0x2643d7['where'](_0x375b76(_0x3921c2['conditions'][_0x1126('0x66')]));}_0x51a28d=_0x2643d7['clone']();_0x2643d7['limit'](_0x30812d);_0x2643d7[_0x1126('0x1b')](0x0);logger['debug'](_0x1126('0x7e'),_0x2643d7[_0x1126('0x7f')]());return dbH['sequelize'][_0x1126('0x31')](_0x2643d7[_0x1126('0x7f')](),{'type':dbH[_0x1126('0x80')][_0x1126('0x81')][_0x1126('0x82')]});}})['then'](respondWithResult(_0x5763b4,null))[_0x1126('0x48')](handleError(_0x5763b4,null));};function runReport(_0x426faa,_0x5679ec,_0xd182b1){var _0x2d6fcf=_0x5679ec[_0x1126('0x29')];var _0x2af2d0=0xa;var _0x2598a7=[_0x1126('0x52'),_0x1126('0x83'),_0x1126('0x53'),_0x1126('0x54')];var _0x9a2af0={'SUM':_0x1126('0x55'),'COUNT':_0x1126('0x56'),'COUNT DISTINCT':_0x1126('0x57'),'MAX':_0x1126('0x58'),'MIN':_0x1126('0x59'),'AVG':_0x1126('0x84'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x1126('0x5b'),'GROUP_CONCAT DESC':_0x1126('0x5c')};var _0x33cccf={'SEC_TO_TIME':_0x1126('0x5d'),'DATE':_0x1126('0x85'),'HOUR':'HOUR(%s)','ROUND':_0x1126('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5bdb30=function(_0xb1199b){return!_[_0x1126('0x60')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x1126('0x62'),_0x1126('0x63')],_0xb1199b);};var _0x228552=function(_0x1ee970){if(!_0x1ee970||!_0x1ee970[_0x1126('0x64')][_0x1126('0x44')]){return'';}for(var _0x2d7150='(',_0x35a9a4=0x0;_0x35a9a4<_0x1ee970[_0x1126('0x64')]['length'];_0x35a9a4+=0x1){_0x35a9a4>0x0&&(_0x2d7150+='\x20'+_0x1ee970[_0x1126('0x65')]+'\x20');_0x2d7150+=_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x66')]?_0x228552(_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x66')]):_0x1ee970[_0x1126('0x64')][_0x35a9a4]['field']+'\x20'+_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x68')]+(_0x5bdb30(_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x68')])?'\x20'+_0x1ee970[_0x1126('0x64')][_0x35a9a4][_0x1126('0x86')]:'');}return _0x2d7150+')';};var _0x2418ca={'where':{'id':_0x426faa['id']}},_0x2d2dfc,_0x38eac6,_0xc3503b,_0x5d6edb,_0x50238d;_0x2418ca=_[_0x1126('0x3c')]({},_0x2418ca,_0xd182b1);return db['AnalyticDefaultReport'][_0x1126('0x47')](_0x2418ca)['then'](function(_0x4461ae){if(_0x4461ae){_0x2d2dfc=_0x4461ae;return _0x4461ae['getFields']();}return null;})[_0x1126('0x23')](function(_0x4fbd44){if(_0x4fbd44){if(!_0x4fbd44['length']){throw new db['Sequelize'][(_0x1126('0x6a'))](_0x1126('0x6b'),0x193);}_0x38eac6=_0x4fbd44;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x1126('0x23')](function(_0xe2f82d){if(_0xe2f82d){_0xc3503b=_[_0x1126('0x87')](_0xe2f82d,'id');var _0x5dfb8f;var _0x48f914=squel[_0x1126('0x88')]();_0x48f914['from'](_0x2d2dfc[_0x1126('0x6e')]);for(var _0x39d9a0=0x0;_0x39d9a0<_0x38eac6[_0x1126('0x44')];_0x39d9a0+=0x1){_0x5dfb8f=_0x38eac6[_0x39d9a0][_0x1126('0x6f')]?_0xc3503b[_0x38eac6[_0x39d9a0][_0x1126('0x6f')]]['metric']:_0x38eac6[_0x39d9a0]['field'];_0x5dfb8f=_0x38eac6[_0x39d9a0][_0x1126('0x71')]?_[_0x1126('0x72')](_0x9a2af0[_0x38eac6[_0x39d9a0][_0x1126('0x71')]],'%s',_0x5dfb8f):_0x5dfb8f;_0x5dfb8f=_0x38eac6[_0x39d9a0][_0x1126('0x73')]?_[_0x1126('0x72')](_0x33cccf[_0x38eac6[_0x39d9a0][_0x1126('0x73')]],'%s',_0x5dfb8f):_0x5dfb8f;if(_0x38eac6[_0x39d9a0][_0x1126('0x74')]){_0x48f914[_0x1126('0x66')](_0x5dfb8f);}_0x38eac6[_0x39d9a0][_0x1126('0x75')]&&_0x48f914[_0x1126('0x89')](_0x5dfb8f,_0x38eac6[_0x39d9a0][_0x1126('0x75')]==='DESC'?![]:!![]);_0x48f914[_0x1126('0x67')](_0x5dfb8f,_0x38eac6[_0x39d9a0]['alias']||_0x5dfb8f);}if(_0x2d2dfc[_0x1126('0x78')]){_0x2d2dfc['joins']=JSON[_0x1126('0x7d')](_0x2d2dfc[_0x1126('0x78')]);for(var _0x215d4d=0x0;_0x215d4d<_0x2d2dfc[_0x1126('0x78')]['length'];_0x215d4d+=0x1){if(_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x2e')]&&_['includes'](_0x2598a7,_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x2e')])&&_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x79')]&&_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x7a')]&&_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x7b')]){_0x48f914[_0x2d2dfc[_0x1126('0x78')][_0x215d4d]['type']](_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x7a')],null,util[_0x1126('0x73')](_0x1126('0x8a'),_0x2d2dfc[_0x1126('0x6e')],_0x2d2dfc['joins'][_0x215d4d][_0x1126('0x79')],_0x2d2dfc[_0x1126('0x78')][_0x215d4d][_0x1126('0x7a')],_0x2d2dfc['joins'][_0x215d4d]['foreignKey']));}}}if(_0x2d2dfc['conditions']){_0x2d2dfc[_0x1126('0x7c')]=JSON[_0x1126('0x7d')](_0x2d2dfc[_0x1126('0x7c')]);_0x48f914[_0x1126('0x39')](_0x228552(_0x2d2dfc['conditions'][_0x1126('0x66')]));}_0x50238d=_0x48f914[_0x1126('0x8b')]();_0x48f914[_0x1126('0x1c')](_0x2af2d0);_0x48f914[_0x1126('0x1b')](0x0);return;}})[_0x1126('0x23')](function(){if(_0x5679ec['output']===_0x1126('0x8c')){return null;}var _0x21c487=_['merge'](_0x5679ec,{'name':_0x5679ec[_0x1126('0x8d')]||_0x5679ec['name']||_0x2d2dfc['name'],'basename':_0x2d6fcf,'savename':util[_0x1126('0x73')]('%s-%s.%s',_0x5679ec[_0x1126('0x29')]||_0x2d2dfc[_0x1126('0x29')],require(_0x1126('0x8e'))[_0x1126('0x8f')](0x4),_0x5679ec[_0x1126('0x90')]||_0x1126('0x91')),'reportId':_0x2d2dfc['id'],'reportType':_0x1126('0x92')});return db[_0x1126('0x93')][_0x1126('0x49')](_0x21c487,{'raw':!![]});})['then'](function(_0x2577f5){if(_0x2d2dfc[_0x1126('0x6e')]===_0x1126('0x94')){_0x50238d[_0x1126('0x39')](_0x2d2dfc['table']+_0x1126('0x95'),_0x5679ec[_0x1126('0x96')],_0x5679ec[_0x1126('0x97')]);}else{_0x50238d[_0x1126('0x39')](_0x2d2dfc['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5679ec['startDate'],_0x5679ec[_0x1126('0x97')]);}if(_0x2577f5){logger['info'](_0x1126('0x98'),_0x50238d[_0x1126('0x7f')]());require('child_process')['fork'](path[_0x1126('0x52')](__dirname,_0x1126('0x99'),_0x2577f5['output']),[_0x2577f5['id'],_0x50238d[_0x1126('0x7f')](),path[_0x1126('0x52')](__dirname,'../../files/reports',_0x2577f5[_0x1126('0x9a')]),_0x2d6fcf]);return _0x2577f5;}else{var _0x4a9941=squel[_0x1126('0x88')]();_0x4a9941[_0x1126('0x6d')]('('+_0x50238d[_0x1126('0x7f')]()+')','countTable');_0x4a9941[_0x1126('0x67')](_0x1126('0x9b'),_0x1126('0x3f'));_0x50238d[_0x1126('0x1c')](_0x5679ec[_0x1126('0x1c')]||_0x2af2d0);_0x50238d[_0x1126('0x1b')](_0x5679ec[_0x1126('0x1b')]||0x0);return dbH[_0x1126('0x80')][_0x1126('0x31')](_0x4a9941[_0x1126('0x7f')](),{'type':dbH[_0x1126('0x80')][_0x1126('0x81')][_0x1126('0x82')]})[_0x1126('0x23')](function(_0x12ffa5){if(!_0x12ffa5[_0x1126('0x44')]){_0x5d6edb=0x0;}else{_0x5d6edb=_0x12ffa5[0x0][_0x1126('0x3f')]||0x0;}return dbH['sequelize'][_0x1126('0x31')](_0x50238d[_0x1126('0x7f')](),{'type':dbH['sequelize']['QueryTypes'][_0x1126('0x82')]});})[_0x1126('0x23')](function(_0x35065c){return{'rows':_0x35065c||[],'count':_0x5d6edb};});}});}exports[_0x1126('0x9c')]=function(_0x5c0215,_0x444f94){return runReport(_0x5c0215[_0x1126('0x50')],_0x5c0215['query'],_0x5c0215[_0x1126('0x46')])['then'](respondWithResult(_0x444f94,null))[_0x1126('0x48')](handleError(_0x444f94,null));};exports[_0x1126('0x9d')]=runReport;exports['query']=function(_0x4d43ad,_0xa02d9e){var _0x548f9e=0xa;var _0x5edb83=[_0x1126('0x52'),_0x1126('0x83'),_0x1126('0x53'),_0x1126('0x54')];var _0x4f29ce={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x1126('0x57'),'MAX':_0x1126('0x58'),'MIN':'MIN(%s)','AVG':_0x1126('0x84'),'GROUP_CONCAT':_0x1126('0x5a'),'GROUP_CONCAT ASC':_0x1126('0x5b'),'GROUP_CONCAT DESC':_0x1126('0x5c')};var _0x17b25d={'SEC_TO_TIME':_0x1126('0x5d'),'DATE':_0x1126('0x85'),'HOUR':_0x1126('0x5e'),'ROUND':_0x1126('0x5f'),'UNIX_TIMESTAMP':_0x1126('0x9e')};var _0x3a4a91=function(_0x55145f){return!_[_0x1126('0x60')](['IS\x20NULL',_0x1126('0x9f'),_0x1126('0x62'),_0x1126('0x63')],_0x55145f);};var _0x4c7dc7=function(_0x33a27b){if(!_0x33a27b||!_0x33a27b[_0x1126('0x64')][_0x1126('0x44')]){return'';}for(var _0x578c1b='(',_0x1562b2=0x0;_0x1562b2<_0x33a27b[_0x1126('0x64')][_0x1126('0x44')];_0x1562b2+=0x1){_0x1562b2>0x0&&(_0x578c1b+='\x20'+_0x33a27b[_0x1126('0x65')]+'\x20');_0x578c1b+=_0x33a27b[_0x1126('0x64')][_0x1562b2]['group']?_0x4c7dc7(_0x33a27b['rules'][_0x1562b2][_0x1126('0x66')]):_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x67')]+'\x20'+_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x68')]+(_0x3a4a91(_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x68')])?'\x20'+_0x33a27b[_0x1126('0x64')][_0x1562b2][_0x1126('0x86')]:'');}return _0x578c1b+')';};var _0x2fb228={'where':{'id':_0x4d43ad[_0x1126('0x50')]['id']}},_0x2c95b6,_0x4a4b43,_0x588f4f,_0x5ac4d6,_0x1168a5;_0x2fb228=_['merge']({},_0x2fb228,_0x4d43ad['options']);return db[_0x1126('0x2b')][_0x1126('0x47')](_0x2fb228)[_0x1126('0x23')](function(_0x48b088){if(_0x48b088){_0x2c95b6=_0x48b088;return _0x48b088[_0x1126('0x69')]();}return null;})[_0x1126('0x23')](function(_0x5a28f9){if(_0x5a28f9){if(!_0x5a28f9[_0x1126('0x44')]){throw new db[(_0x1126('0xa0'))][(_0x1126('0x6a'))](_0x1126('0x6b'),0x193);}_0x4a4b43=_0x5a28f9;return db[_0x1126('0x6c')]['findAll']({'raw':!![]});}return null;})[_0x1126('0x23')](function(_0x1140ec){if(_0x1140ec){_0x588f4f=_['keyBy'](_0x1140ec,'id');var _0x578f5c;var _0x559dae=squel[_0x1126('0x88')]();_0x559dae[_0x1126('0x6d')](_0x2c95b6[_0x1126('0x6e')]);for(var _0x9d7819=0x0;_0x9d7819<_0x4a4b43[_0x1126('0x44')];_0x9d7819+=0x1){_0x578f5c=_0x4a4b43[_0x9d7819]['MetricId']?_0x588f4f[_0x4a4b43[_0x9d7819][_0x1126('0x6f')]]['metric']:_0x4a4b43[_0x9d7819][_0x1126('0x67')];_0x578f5c=_0x4a4b43[_0x9d7819][_0x1126('0x71')]?_['replace'](_0x4f29ce[_0x4a4b43[_0x9d7819]['function']],'%s',_0x578f5c):_0x578f5c;_0x578f5c=_0x4a4b43[_0x9d7819][_0x1126('0x73')]?_[_0x1126('0x72')](_0x17b25d[_0x4a4b43[_0x9d7819]['format']],'%s',_0x578f5c):_0x578f5c;if(_0x4a4b43[_0x9d7819]['groupBy']){_0x559dae[_0x1126('0x66')](_0x578f5c);}_0x4a4b43[_0x9d7819][_0x1126('0x75')]&&_0x559dae[_0x1126('0x89')](_0x578f5c,_0x4a4b43[_0x9d7819][_0x1126('0x75')]===_0x1126('0x76')?![]:!![]);_0x559dae[_0x1126('0x67')](_0x578f5c,_0x4a4b43[_0x9d7819][_0x1126('0x77')]||_0x578f5c);}if(_0x2c95b6[_0x1126('0x78')]){_0x2c95b6[_0x1126('0x78')]=JSON[_0x1126('0x7d')](_0x2c95b6['joins']);for(var _0x4d6528=0x0;_0x4d6528<_0x2c95b6[_0x1126('0x78')][_0x1126('0x44')];_0x4d6528+=0x1){if(_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x2e')]&&_[_0x1126('0x60')](_0x5edb83,_0x2c95b6[_0x1126('0x78')][_0x4d6528]['type'])&&_0x2c95b6['joins'][_0x4d6528][_0x1126('0x79')]&&_0x2c95b6['joins'][_0x4d6528]['foreignTable']&&_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7b')]){_0x559dae[_0x2c95b6['joins'][_0x4d6528][_0x1126('0x2e')]](_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7a')],null,util[_0x1126('0x73')]('%s.%s\x20=\x20%s.%s',_0x2c95b6[_0x1126('0x6e')],_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x79')],_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7a')],_0x2c95b6[_0x1126('0x78')][_0x4d6528][_0x1126('0x7b')]));}}}if(_0x2c95b6['conditions']){_0x2c95b6[_0x1126('0x7c')]=JSON[_0x1126('0x7d')](_0x2c95b6[_0x1126('0x7c')]);_0x559dae[_0x1126('0x39')](_0x4c7dc7(_0x2c95b6['conditions'][_0x1126('0x66')]));}_0x1168a5=_0x559dae[_0x1126('0x8b')]();_0x559dae['limit'](_0x548f9e);_0x559dae[_0x1126('0x1b')](0x0);logger[_0x1126('0xa1')](_0x1126('0x7e'),_0x559dae['toString']());return dbH[_0x1126('0x80')][_0x1126('0x31')](_0x559dae[_0x1126('0x7f')](),{'type':dbH[_0x1126('0x80')][_0x1126('0x81')][_0x1126('0x82')]});}})['then'](function(){return{'sql':_0x1168a5[_0x1126('0x7f')]()};})[_0x1126('0x23')](respondWithResult(_0xa02d9e,null))['catch'](handleError(_0xa02d9e,null));}; \ No newline at end of file +var _0x53ec=['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','format','replace','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','SUM(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','HOUR(%s)','ROUND(%s)','condition','Sequelize','groupBy','foreignKey','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','SELECT','runReport','cross_join','COUNT(%s)','MIN(%s)','ValidationErrorItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','type','include','AnalyticDefaultReport','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','preview','join','left_join','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes'];(function(_0x2de0ee,_0x575448){var _0x4bbb06=function(_0xa162ab){while(--_0xa162ab){_0x2de0ee['push'](_0x2de0ee['shift']());}};_0x4bbb06(++_0x575448);}(_0x53ec,0x192));var _0xc53e=function(_0x35ccde,_0xbe027){_0x35ccde=_0x35ccde-0x0;var _0xbd6110=_0x53ec[_0x35ccde];return _0xbd6110;};'use strict';var emlformat=require(_0xc53e('0x0'));var rimraf=require(_0xc53e('0x1'));var zipdir=require(_0xc53e('0x2'));var jsonpatch=require(_0xc53e('0x3'));var rp=require(_0xc53e('0x4'));var moment=require(_0xc53e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc53e('0x6'));var util=require('util');var path=require(_0xc53e('0x7'));var sox=require(_0xc53e('0x8'));var csv=require('to-csv');var ejs=require(_0xc53e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0xe'));var querystring=require(_0xc53e('0xf'));var Papa=require(_0xc53e('0x10'));var Redis=require(_0xc53e('0x11'));var authService=require(_0xc53e('0x12'));var qs=require(_0xc53e('0x13'));var as=require(_0xc53e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x16'));var db=require(_0xc53e('0x17'))['db'];var dbH=require(_0xc53e('0x17'))[_0xc53e('0x18')];function respondWithStatusCode(_0x56f0e5,_0x4e74c9){_0x4e74c9=_0x4e74c9||0xcc;return function(_0x1c06cd){if(_0x1c06cd){return _0x56f0e5[_0xc53e('0x19')](_0x4e74c9);}return _0x56f0e5[_0xc53e('0x1a')](_0x4e74c9)[_0xc53e('0x1b')]();};}function respondWithResult(_0x358ef3,_0x382e87){_0x382e87=_0x382e87||0xc8;return function(_0x3dc2fa){if(_0x3dc2fa){return _0x358ef3[_0xc53e('0x1a')](_0x382e87)[_0xc53e('0x1c')](_0x3dc2fa);}};}function respondWithFilteredResult(_0x2ad6eb,_0x5b0a88){return function(_0x8a522e){if(_0x8a522e){var _0x191567=typeof _0x5b0a88[_0xc53e('0x1d')]===_0xc53e('0x1e')&&typeof _0x5b0a88[_0xc53e('0x1f')]===_0xc53e('0x1e');var _0x164016=_0x8a522e[_0xc53e('0x20')];var _0x3b550e=_0x191567?0x0:_0x5b0a88['offset'];var _0x546fab=_0x191567?_0x8a522e[_0xc53e('0x20')]:_0x5b0a88[_0xc53e('0x1d')]+_0x5b0a88[_0xc53e('0x1f')];var _0x2e85df;if(_0x546fab>=_0x164016){_0x546fab=_0x164016;_0x2e85df=0xc8;}else{_0x2e85df=0xce;}_0x2ad6eb[_0xc53e('0x1a')](_0x2e85df);return _0x2ad6eb[_0xc53e('0x21')](_0xc53e('0x22'),_0x3b550e+'-'+_0x546fab+'/'+_0x164016)[_0xc53e('0x1c')](_0x8a522e);}return null;};}function patchUpdates(_0x364c80){return function(_0x401af6){try{jsonpatch[_0xc53e('0x23')](_0x401af6,_0x364c80,!![]);}catch(_0x44fd93){return BPromise[_0xc53e('0x24')](_0x44fd93);}return _0x401af6['save']();};}function saveUpdates(_0x47cfdd,_0x531ede){return function(_0x4f4304){if(_0x4f4304){return _0x4f4304[_0xc53e('0x25')](_0x47cfdd)[_0xc53e('0x26')](function(_0x4015c8){return _0x4015c8;});}return null;};}function removeEntity(_0x180811,_0x5009e1){return function(_0x5e5377){if(_0x5e5377){return _0x5e5377[_0xc53e('0x27')]()['then'](function(){var _0x1ae55e=_0x5e5377[_0xc53e('0x28')]({'plain':!![]});var _0x443179=_0xc53e('0x29');return db[_0xc53e('0x2a')]['destroy']({'where':{'type':_0x443179,'resourceId':_0x1ae55e['id']}})[_0xc53e('0x26')](function(){return _0x5e5377;});})['then'](function(){_0x180811['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c5056,_0x57a1f5){return function(_0x28240a){if(!_0x28240a){_0x3c5056['sendStatus'](0x194);}return _0x28240a;};}function handleError(_0x24a77e,_0x5112d2){_0x5112d2=_0x5112d2||0x1f4;return function(_0x5ce216){logger[_0xc53e('0x2b')](_0x5ce216[_0xc53e('0x2c')]);if(_0x5ce216[_0xc53e('0x2d')]){delete _0x5ce216[_0xc53e('0x2d')];}_0x24a77e[_0xc53e('0x1a')](_0x5112d2)[_0xc53e('0x2e')](_0x5ce216);};}exports[_0xc53e('0x2f')]=function(_0x2a2ca9,_0x4ace0b){var _0x437893={},_0x311835={},_0x2d36c0={'count':0x0,'rows':[]};var _0x56206b=_[_0xc53e('0x30')](db['AnalyticDefaultReport'][_0xc53e('0x31')],function(_0x2467f4){return{'name':_0x2467f4['fieldName'],'type':_0x2467f4['type'][_0xc53e('0x32')]};});_0x311835[_0xc53e('0x33')]=_[_0xc53e('0x30')](_0x56206b,_0xc53e('0x2d'));_0x311835[_0xc53e('0x34')]=_[_0xc53e('0x35')](_0x2a2ca9[_0xc53e('0x34')]);_0x311835[_0xc53e('0x36')]=_['intersection'](_0x311835[_0xc53e('0x33')],_0x311835[_0xc53e('0x34')]);_0x437893[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x311835[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x39')]));_0x437893[_0xc53e('0x37')]=_0x437893['attributes'][_0xc53e('0x3a')]?_0x437893['attributes']:_0x311835[_0xc53e('0x33')];if(!_0x2a2ca9[_0xc53e('0x34')]['hasOwnProperty'](_0xc53e('0x3b'))){_0x437893[_0xc53e('0x1f')]=qs[_0xc53e('0x1f')](_0x2a2ca9['query'][_0xc53e('0x1f')]);_0x437893[_0xc53e('0x1d')]=qs[_0xc53e('0x1d')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x1d')]);}_0x437893[_0xc53e('0x3c')]=qs[_0xc53e('0x3d')](_0x2a2ca9['query'][_0xc53e('0x3d')]);_0x437893[_0xc53e('0x3e')]=qs[_0xc53e('0x36')](_['pick'](_0x2a2ca9[_0xc53e('0x34')],_0x311835['filters']),_0x56206b);if(_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x3f')]){_0x437893[_0xc53e('0x3e')]=_[_0xc53e('0x40')](_0x437893[_0xc53e('0x3e')],{'$or':_['map'](_0x56206b,function(_0x3dda55){if(_0x3dda55[_0xc53e('0x41')]!=='VIRTUAL'){var _0x5b7354={};_0x5b7354[_0x3dda55['name']]={'$like':'%'+_0x2a2ca9['query'][_0xc53e('0x3f')]+'%'};return _0x5b7354;}})});}_0x437893=_[_0xc53e('0x40')]({},_0x437893,_0x2a2ca9['options']);var _0x460ee6={'where':_0x437893['where']};return db['AnalyticDefaultReport']['count'](_0x460ee6)[_0xc53e('0x26')](function(_0x4ba96f){_0x2d36c0['count']=_0x4ba96f;if(_0x2a2ca9[_0xc53e('0x34')]['includeAll']){_0x437893[_0xc53e('0x42')]=[{'all':!![]}];}return db[_0xc53e('0x43')]['findAll'](_0x437893);})[_0xc53e('0x26')](function(_0x3a4ebc){_0x2d36c0['rows']=_0x3a4ebc;return _0x2d36c0;})[_0xc53e('0x26')](respondWithFilteredResult(_0x4ace0b,_0x437893))['catch'](handleError(_0x4ace0b,null));};exports['show']=function(_0x481e6d,_0x4efee5){var _0x887d78={'raw':!![],'where':{'id':_0x481e6d[_0xc53e('0x44')]['id']}},_0x17b586={};_0x17b586['model']=_[_0xc53e('0x35')](db[_0xc53e('0x43')]['rawAttributes']);_0x17b586['query']=_[_0xc53e('0x35')](_0x481e6d[_0xc53e('0x34')]);_0x17b586[_0xc53e('0x36')]=_['intersection'](_0x17b586[_0xc53e('0x33')],_0x17b586[_0xc53e('0x34')]);_0x887d78[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x17b586[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x481e6d[_0xc53e('0x34')]['fields']));_0x887d78[_0xc53e('0x37')]=_0x887d78[_0xc53e('0x37')][_0xc53e('0x3a')]?_0x887d78['attributes']:_0x17b586[_0xc53e('0x33')];if(_0x481e6d[_0xc53e('0x34')][_0xc53e('0x45')]){_0x887d78[_0xc53e('0x42')]=[{'all':!![]}];}_0x887d78=_[_0xc53e('0x40')]({},_0x887d78,_0x481e6d[_0xc53e('0x46')]);return db['AnalyticDefaultReport'][_0xc53e('0x47')](_0x887d78)[_0xc53e('0x26')](handleEntityNotFound(_0x4efee5,null))[_0xc53e('0x26')](respondWithResult(_0x4efee5,null))['catch'](handleError(_0x4efee5,null));};exports[_0xc53e('0x48')]=function(_0x1d2491,_0x1eeb65){return db[_0xc53e('0x43')][_0xc53e('0x48')](_0x1d2491[_0xc53e('0x49')],{})[_0xc53e('0x26')](function(_0x2ba2b4){var _0x34de2d=_0x1d2491[_0xc53e('0x4a')]['get']({'plain':!![]});if(!_0x34de2d)throw new Error(_0xc53e('0x4b'));if(_0x34de2d[_0xc53e('0x4c')]===_0xc53e('0x4a')){var _0x3d74ac=_0x2ba2b4[_0xc53e('0x28')]({'plain':!![]});var _0x52dac7='Reports';return db[_0xc53e('0x4d')]['find']({'where':{'name':_0x52dac7,'userProfileId':_0x34de2d[_0xc53e('0x4e')]},'raw':!![]})['then'](function(_0x3a49a4){if(_0x3a49a4&&_0x3a49a4[_0xc53e('0x4f')]===0x0){return db[_0xc53e('0x2a')]['create']({'name':_0x3d74ac[_0xc53e('0x2d')],'resourceId':_0x3d74ac['id'],'type':_0xc53e('0x29'),'sectionId':_0x3a49a4['id']},{})[_0xc53e('0x26')](function(){return _0x2ba2b4;});}else{return _0x2ba2b4;}})['catch'](function(_0x2f7df2){logger['error'](_0xc53e('0x50'),_0x2f7df2);throw _0x2f7df2;});}return _0x2ba2b4;})[_0xc53e('0x26')](respondWithResult(_0x1eeb65,0xc9))['catch'](handleError(_0x1eeb65,null));};exports[_0xc53e('0x25')]=function(_0x1515ea,_0x5bba72){if(_0x1515ea[_0xc53e('0x49')]['id']){delete _0x1515ea[_0xc53e('0x49')]['id'];}return db[_0xc53e('0x43')][_0xc53e('0x47')]({'where':{'id':_0x1515ea[_0xc53e('0x44')]['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x5bba72,null))[_0xc53e('0x26')](saveUpdates(_0x1515ea[_0xc53e('0x49')],null))[_0xc53e('0x26')](respondWithResult(_0x5bba72,null))[_0xc53e('0x51')](handleError(_0x5bba72,null));};exports[_0xc53e('0x27')]=function(_0x47dd5a,_0x8364f6){return db['AnalyticDefaultReport'][_0xc53e('0x47')]({'where':{'id':_0x47dd5a['params']['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x8364f6,null))[_0xc53e('0x26')](removeEntity(_0x8364f6,null))['catch'](handleError(_0x8364f6,null));};exports[_0xc53e('0x52')]=function(_0x7f0bc0,_0x9c0112){var _0x432a91=0xa;var _0x53083b=[_0xc53e('0x53'),_0xc53e('0x54'),'right_join','cross_join'];var _0x3c0aa1={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x5fcd58={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x37b091=function(_0x31e22b){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x31e22b);};var _0x13bf71=function(_0x16d8a1){if(!_0x16d8a1||!_0x16d8a1[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xdc0e49='(',_0x520738=0x0;_0x520738<_0x16d8a1[_0xc53e('0x61')]['length'];_0x520738+=0x1){_0x520738>0x0&&(_0xdc0e49+='\x20'+_0x16d8a1[_0xc53e('0x62')]+'\x20');_0xdc0e49+=_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]?_0x13bf71(_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]):_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x64')]+'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738]['condition']+(_0x37b091(_0x16d8a1['rules'][_0x520738]['condition'])?'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x65')]:'');}return _0xdc0e49+')';};var _0x37ac78={'where':{'id':_0x7f0bc0['params']['id']}},_0x25e4b6,_0x247d99,_0x160ca3,_0x3581ab,_0x5a9596;_0x37ac78=_['merge']({},_0x37ac78,_0x7f0bc0[_0xc53e('0x46')]);return db[_0xc53e('0x43')]['find'](_0x37ac78)[_0xc53e('0x26')](function(_0x235a6b){if(_0x235a6b){_0x25e4b6=_0x235a6b;return _0x235a6b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x22829b){if(_0x22829b){if(!_0x22829b[_0xc53e('0x3a')]){throw new db['Sequelize']['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x247d99=_0x22829b;return db[_0xc53e('0x68')][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x29ee08){if(_0x29ee08){_0x160ca3=_[_0xc53e('0x6a')](_0x29ee08,'id');var _0x5a1a4b;var _0x2b6734=squel[_0xc53e('0x6b')]();_0x2b6734[_0xc53e('0x6c')](_0x25e4b6[_0xc53e('0x6d')]);for(var _0x4d2609=0x0;_0x4d2609<_0x247d99[_0xc53e('0x3a')];_0x4d2609+=0x1){_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x6e')]?_0x160ca3[_0x247d99[_0x4d2609][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x247d99[_0x4d2609][_0xc53e('0x64')];_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x70')]?_['replace'](_0x3c0aa1[_0x247d99[_0x4d2609][_0xc53e('0x70')]],'%s',_0x5a1a4b):_0x5a1a4b;_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x71')]?_[_0xc53e('0x72')](_0x5fcd58[_0x247d99[_0x4d2609][_0xc53e('0x71')]],'%s',_0x5a1a4b):_0x5a1a4b;if(_0x247d99[_0x4d2609]['groupBy']){_0x2b6734['group'](_0x5a1a4b);}_0x247d99[_0x4d2609][_0xc53e('0x73')]&&_0x2b6734[_0xc53e('0x3c')](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x2b6734['field'](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x75')]||_0x5a1a4b);}if(_0x25e4b6['joins']){_0x25e4b6[_0xc53e('0x76')]=JSON['parse'](_0x25e4b6[_0xc53e('0x76')]);for(var _0x4e128a=0x0;_0x4e128a<_0x25e4b6[_0xc53e('0x76')][_0xc53e('0x3a')];_0x4e128a+=0x1){if(_0x25e4b6['joins'][_0x4e128a][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x53083b,_0x25e4b6['joins'][_0x4e128a]['type'])&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')]&&_0x25e4b6['joins'][_0x4e128a]['foreignTable']&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']){_0x2b6734[_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['type']](_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x25e4b6[_0xc53e('0x6d')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']));}}}if(_0x25e4b6[_0xc53e('0x7a')]){_0x25e4b6['conditions']=JSON[_0xc53e('0x7b')](_0x25e4b6[_0xc53e('0x7a')]);_0x2b6734[_0xc53e('0x3e')](_0x13bf71(_0x25e4b6[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x5a9596=_0x2b6734[_0xc53e('0x7c')]();_0x2b6734[_0xc53e('0x1f')](_0x432a91);_0x2b6734[_0xc53e('0x1d')](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x2b6734['toString']());return dbH[_0xc53e('0x7f')]['query'](_0x2b6734[_0xc53e('0x80')](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']});}})[_0xc53e('0x26')](respondWithResult(_0x9c0112,null))[_0xc53e('0x51')](handleError(_0x9c0112,null));};function runReport(_0x381652,_0xec3738,_0x3a84a2){var _0x508671=_0xec3738[_0xc53e('0x2d')];var _0x48e337=0xa;var _0x56c66f=[_0xc53e('0x53'),_0xc53e('0x54'),_0xc53e('0x82'),'cross_join'];var _0x35b6dc={'SUM':_0xc53e('0x83'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xc53e('0x85'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x3d2636={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':'DATE(%s)','HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x4c8112=function(_0x1a8ae4){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),'IS\x20NOT\x20EMPTY'],_0x1a8ae4);};var _0x3dac82=function(_0x325287){if(!_0x325287||!_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xe6a976='(',_0x4102bc=0x0;_0x4102bc<_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')];_0x4102bc+=0x1){_0x4102bc>0x0&&(_0xe6a976+='\x20'+_0x325287[_0xc53e('0x62')]+'\x20');_0xe6a976+=_0x325287['rules'][_0x4102bc][_0xc53e('0x63')]?_0x3dac82(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x63')]):_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x64')]+'\x20'+_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')]+(_0x4c8112(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')])?'\x20'+_0x325287['rules'][_0x4102bc][_0xc53e('0x65')]:'');}return _0xe6a976+')';};var _0x190509={'where':{'id':_0x381652['id']}},_0x110e32,_0x2135d4,_0x4bbf8a,_0x31b06d,_0x21fc8d;_0x190509=_[_0xc53e('0x40')]({},_0x190509,_0x3a84a2);return db[_0xc53e('0x43')]['find'](_0x190509)[_0xc53e('0x26')](function(_0x138870){if(_0x138870){_0x110e32=_0x138870;return _0x138870[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x621e78){if(_0x621e78){if(!_0x621e78[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))]['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x2135d4=_0x621e78;return db['AnalyticMetric'][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x3fe278){if(_0x3fe278){_0x4bbf8a=_['keyBy'](_0x3fe278,'id');var _0x7c56eb;var _0x36dffe=squel[_0xc53e('0x6b')]();_0x36dffe['from'](_0x110e32[_0xc53e('0x6d')]);for(var _0xedb93a=0x0;_0xedb93a<_0x2135d4[_0xc53e('0x3a')];_0xedb93a+=0x1){_0x7c56eb=_0x2135d4[_0xedb93a]['MetricId']?_0x4bbf8a[_0x2135d4[_0xedb93a][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x2135d4[_0xedb93a][_0xc53e('0x64')];_0x7c56eb=_0x2135d4[_0xedb93a][_0xc53e('0x70')]?_[_0xc53e('0x72')](_0x35b6dc[_0x2135d4[_0xedb93a]['function']],'%s',_0x7c56eb):_0x7c56eb;_0x7c56eb=_0x2135d4[_0xedb93a]['format']?_['replace'](_0x3d2636[_0x2135d4[_0xedb93a][_0xc53e('0x71')]],'%s',_0x7c56eb):_0x7c56eb;if(_0x2135d4[_0xedb93a][_0xc53e('0x8a')]){_0x36dffe[_0xc53e('0x63')](_0x7c56eb);}_0x2135d4[_0xedb93a][_0xc53e('0x73')]&&_0x36dffe['order'](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x73')]==='DESC'?![]:!![]);_0x36dffe[_0xc53e('0x64')](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x75')]||_0x7c56eb);}if(_0x110e32[_0xc53e('0x76')]){_0x110e32[_0xc53e('0x76')]=JSON['parse'](_0x110e32[_0xc53e('0x76')]);for(var _0xc23eef=0x0;_0xc23eef<_0x110e32[_0xc53e('0x76')][_0xc53e('0x3a')];_0xc23eef+=0x1){if(_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x56c66f,_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')])&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x8b')]){_0x36dffe[_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]](_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x110e32[_0xc53e('0x6d')],_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignTable'],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignKey']));}}}if(_0x110e32[_0xc53e('0x7a')]){_0x110e32[_0xc53e('0x7a')]=JSON['parse'](_0x110e32[_0xc53e('0x7a')]);_0x36dffe[_0xc53e('0x3e')](_0x3dac82(_0x110e32[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x21fc8d=_0x36dffe[_0xc53e('0x7c')]();_0x36dffe[_0xc53e('0x1f')](_0x48e337);_0x36dffe[_0xc53e('0x1d')](0x0);return;}})[_0xc53e('0x26')](function(){if(_0xec3738[_0xc53e('0x8c')]==='web'){return null;}var _0x37c8e6=_['merge'](_0xec3738,{'name':_0xec3738[_0xc53e('0x8d')]||_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],'basename':_0x508671,'savename':util[_0xc53e('0x71')](_0xc53e('0x8e'),_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],require(_0xc53e('0x8f'))[_0xc53e('0x90')](0x4),_0xec3738[_0xc53e('0x8c')]||_0xc53e('0x91')),'reportId':_0x110e32['id'],'reportType':_0xc53e('0x92')});return db[_0xc53e('0x93')]['create'](_0x37c8e6,{'raw':!![]});})[_0xc53e('0x26')](function(_0x575ef5){if(_0x110e32[_0xc53e('0x6d')]===_0xc53e('0x94')){_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xec3738['startDate'],_0xec3738[_0xc53e('0x95')]);}else{_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+_0xc53e('0x96'),_0xec3738['startDate'],_0xec3738['endDate']);}if(_0x575ef5){logger[_0xc53e('0x97')](_0xc53e('0x98'),_0x21fc8d[_0xc53e('0x80')]());require(_0xc53e('0x99'))[_0xc53e('0x9a')](path[_0xc53e('0x53')](__dirname,'../../components/export/',_0x575ef5[_0xc53e('0x8c')]),[_0x575ef5['id'],_0x21fc8d[_0xc53e('0x80')](),path[_0xc53e('0x53')](__dirname,_0xc53e('0x9b'),_0x575ef5[_0xc53e('0x9c')]),_0x508671]);return _0x575ef5;}else{var _0x4f527e=squel[_0xc53e('0x6b')]();_0x4f527e[_0xc53e('0x6c')]('('+_0x21fc8d[_0xc53e('0x80')]()+')',_0xc53e('0x9d'));_0x4f527e[_0xc53e('0x64')](_0xc53e('0x9e'),_0xc53e('0x20'));_0x21fc8d[_0xc53e('0x1f')](_0xec3738[_0xc53e('0x1f')]||_0x48e337);_0x21fc8d[_0xc53e('0x1d')](_0xec3738[_0xc53e('0x1d')]||0x0);return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x4f527e['toString'](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']})[_0xc53e('0x26')](function(_0x4ee56b){if(!_0x4ee56b['length']){_0x31b06d=0x0;}else{_0x31b06d=_0x4ee56b[0x0][_0xc53e('0x20')]||0x0;}return dbH['sequelize'][_0xc53e('0x34')](_0x21fc8d['toString'](),{'type':dbH[_0xc53e('0x7f')]['QueryTypes'][_0xc53e('0x9f')]});})[_0xc53e('0x26')](function(_0x10ad32){return{'rows':_0x10ad32||[],'count':_0x31b06d};});}});}exports['run']=function(_0xf3f34a,_0x5dd87e){return runReport(_0xf3f34a[_0xc53e('0x44')],_0xf3f34a[_0xc53e('0x34')],_0xf3f34a[_0xc53e('0x46')])[_0xc53e('0x26')](respondWithResult(_0x5dd87e,null))[_0xc53e('0x51')](handleError(_0x5dd87e,null));};exports[_0xc53e('0xa0')]=runReport;exports[_0xc53e('0x34')]=function(_0x265292,_0x2c776c){var _0x383f22=0xa;var _0x51f2a4=['join',_0xc53e('0x54'),'right_join',_0xc53e('0xa1')];var _0xbc960={'SUM':_0xc53e('0x83'),'COUNT':_0xc53e('0xa2'),'COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':_0xc53e('0xa3'),'AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x34cb12={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x227e0c=function(_0x4c0802){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x4c0802);};var _0x590fb6=function(_0x15d269){if(!_0x15d269||!_0x15d269[_0xc53e('0x61')]['length']){return'';}for(var _0x5253b1='(',_0x208c17=0x0;_0x208c17<_0x15d269['rules'][_0xc53e('0x3a')];_0x208c17+=0x1){_0x208c17>0x0&&(_0x5253b1+='\x20'+_0x15d269[_0xc53e('0x62')]+'\x20');_0x5253b1+=_0x15d269['rules'][_0x208c17]['group']?_0x590fb6(_0x15d269[_0xc53e('0x61')][_0x208c17]['group']):_0x15d269[_0xc53e('0x61')][_0x208c17]['field']+'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')]+(_0x227e0c(_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')])?'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17]['value']:'');}return _0x5253b1+')';};var _0x2f5d22={'where':{'id':_0x265292[_0xc53e('0x44')]['id']}},_0x478e57,_0x5e427a,_0x3e666b,_0x365a98,_0x375d8b;_0x2f5d22=_[_0xc53e('0x40')]({},_0x2f5d22,_0x265292[_0xc53e('0x46')]);return db[_0xc53e('0x43')][_0xc53e('0x47')](_0x2f5d22)[_0xc53e('0x26')](function(_0x3b778b){if(_0x3b778b){_0x478e57=_0x3b778b;return _0x3b778b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x55581a){if(_0x55581a){if(!_0x55581a[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))][(_0xc53e('0xa4'))](_0xc53e('0x67'),0x193);}_0x5e427a=_0x55581a;return db[_0xc53e('0x68')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x34c717){if(_0x34c717){_0x3e666b=_[_0xc53e('0x6a')](_0x34c717,'id');var _0x2718fe;var _0x15014e=squel[_0xc53e('0x6b')]();_0x15014e[_0xc53e('0x6c')](_0x478e57[_0xc53e('0x6d')]);for(var _0x2d80f5=0x0;_0x2d80f5<_0x5e427a[_0xc53e('0x3a')];_0x2d80f5+=0x1){_0x2718fe=_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]?_0x3e666b[_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x5e427a[_0x2d80f5][_0xc53e('0x64')];_0x2718fe=_0x5e427a[_0x2d80f5]['function']?_[_0xc53e('0x72')](_0xbc960[_0x5e427a[_0x2d80f5][_0xc53e('0x70')]],'%s',_0x2718fe):_0x2718fe;_0x2718fe=_0x5e427a[_0x2d80f5]['format']?_[_0xc53e('0x72')](_0x34cb12[_0x5e427a[_0x2d80f5][_0xc53e('0x71')]],'%s',_0x2718fe):_0x2718fe;if(_0x5e427a[_0x2d80f5][_0xc53e('0x8a')]){_0x15014e['group'](_0x2718fe);}_0x5e427a[_0x2d80f5]['orderBy']&&_0x15014e[_0xc53e('0x3c')](_0x2718fe,_0x5e427a[_0x2d80f5][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x15014e[_0xc53e('0x64')](_0x2718fe,_0x5e427a[_0x2d80f5]['alias']||_0x2718fe);}if(_0x478e57[_0xc53e('0x76')]){_0x478e57[_0xc53e('0x76')]=JSON[_0xc53e('0x7b')](_0x478e57['joins']);for(var _0x48d301=0x0;_0x48d301<_0x478e57[_0xc53e('0x76')][_0xc53e('0x3a')];_0x48d301+=0x1){if(_0x478e57[_0xc53e('0x76')][_0x48d301]['type']&&_[_0xc53e('0x5c')](_0x51f2a4,_0x478e57[_0xc53e('0x76')][_0x48d301]['type'])&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')]&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x78')]&&_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']){_0x15014e[_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x41')]](_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],null,util['format'](_0xc53e('0x79'),_0x478e57[_0xc53e('0x6d')],_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']));}}}if(_0x478e57[_0xc53e('0x7a')]){_0x478e57[_0xc53e('0x7a')]=JSON[_0xc53e('0x7b')](_0x478e57[_0xc53e('0x7a')]);_0x15014e[_0xc53e('0x3e')](_0x590fb6(_0x478e57[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x375d8b=_0x15014e[_0xc53e('0x7c')]();_0x15014e[_0xc53e('0x1f')](_0x383f22);_0x15014e['offset'](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x15014e[_0xc53e('0x80')]());return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x15014e[_0xc53e('0x80')](),{'type':dbH['sequelize'][_0xc53e('0x81')][_0xc53e('0x9f')]});}})[_0xc53e('0x26')](function(){return{'sql':_0x375d8b[_0xc53e('0x80')]()};})[_0xc53e('0x26')](respondWithResult(_0x2c776c,null))[_0xc53e('0x51')](handleError(_0x2c776c,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index dc4ca81..f530c7c 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 _0x1c35=['path','rimraf','exports','define','analytics_default_reports','util','api','request-promise'];(function(_0x13b442,_0x448c33){var _0x49d09c=function(_0x477277){while(--_0x477277){_0x13b442['push'](_0x13b442['shift']());}};_0x49d09c(++_0x448c33);}(_0x1c35,0xad));var _0x51c3=function(_0xadc093,_0x1684e1){_0xadc093=_0xadc093-0x0;var _0x1c0871=_0x1c35[_0xadc093];return _0x1c0871;};'use strict';var _=require('lodash');var util=require(_0x51c3('0x0'));var logger=require('../../config/logger')(_0x51c3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x51c3('0x2'));var fs=require('fs');var path=require(_0x51c3('0x3'));var rimraf=require(_0x51c3('0x4'));var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module[_0x51c3('0x5')]=function(_0x2b31f7,_0xb63923){return _0x2b31f7[_0x51c3('0x6')]('AnalyticDefaultReport',attributes,{'tableName':_0x51c3('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb46e=['define','analytics_default_reports','lodash','util','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x335f5c,_0xce622c){var _0x27458c=function(_0x108b7f){while(--_0x108b7f){_0x335f5c['push'](_0x335f5c['shift']());}};_0x27458c(++_0xce622c);}(_0xb46e,0x1d6));var _0xeb46=function(_0xd7138d,_0xc3196c){_0xd7138d=_0xd7138d-0x0;var _0x1768d4=_0xb46e[_0xd7138d];return _0x1768d4;};'use strict';var _=require(_0xeb46('0x0'));var util=require(_0xeb46('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xeb46('0x2'));var BPromise=require(_0xeb46('0x3'));var rp=require(_0xeb46('0x4'));var fs=require('fs');var path=require(_0xeb46('0x5'));var rimraf=require('rimraf');var config=require(_0xeb46('0x6'));var attributes=require('./analyticDefaultReport.attributes');module['exports']=function(_0x2b1089,_0x4b2c59){return _0x2b1089[_0xeb46('0x7')]('AnalyticDefaultReport',attributes,{'tableName':_0xeb46('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index b0ce863..5bdb70d 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 _0xe13d=['../../config/logger','rpc','jayson/promise','client','http','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x275708,_0x2b9ece){var _0x134b23=function(_0x1ba5f7){while(--_0x1ba5f7){_0x275708['push'](_0x275708['shift']());}};_0x134b23(++_0x2b9ece);}(_0xe13d,0x6d));var _0xde13=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xe13d[_0x13ea00];return _0x1f7347;};'use strict';var _=require('lodash');var util=require(_0xde13('0x0'));var moment=require(_0xde13('0x1'));var BPromise=require(_0xde13('0x2'));var rs=require(_0xde13('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xde13('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xde13('0x5'))(_0xde13('0x6'));var config=require('../../config/environment');var jayson=require(_0xde13('0x7'));var client=jayson[_0xde13('0x8')][_0xde13('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf3acc1,_0x1a1278,_0x2c30d9){return new BPromise(function(_0x5c8f81,_0x3e1063){return client[_0xde13('0xa')](_0xf3acc1,_0x2c30d9)['then'](function(_0x16b868){logger[_0xde13('0xb')](_0xde13('0xc'),_0x1a1278,_0xde13('0xd'));logger[_0xde13('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x1a1278,_0xde13('0xd'),JSON['stringify'](_0x16b868));if(_0x16b868[_0xde13('0xf')]){if(_0x16b868['error'][_0xde13('0x10')]===0x1f4){logger[_0xde13('0xf')](_0xde13('0xc'),_0x1a1278,_0x16b868['error'][_0xde13('0x11')]);return _0x3e1063(_0x16b868[_0xde13('0xf')]['message']);}logger[_0xde13('0xf')](_0xde13('0xc'),_0x1a1278,_0x16b868['error']['message']);return _0x5c8f81(_0x16b868[_0xde13('0xf')]['message']);}else{logger[_0xde13('0xb')](_0xde13('0xc'),_0x1a1278,'request\x20sent');_0x5c8f81(_0x16b868[_0xde13('0x12')][_0xde13('0x11')]);}})['catch'](function(_0x5ef43b){logger[_0xde13('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x1a1278,_0x5ef43b);_0x3e1063(_0x5ef43b);});});} \ No newline at end of file +var _0x69b9=['http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x4978d9,_0x203c70){var _0x540543=function(_0x2e2427){while(--_0x2e2427){_0x4978d9['push'](_0x4978d9['shift']());}};_0x540543(++_0x203c70);}(_0x69b9,0x113));var _0x969b=function(_0x2acbd5,_0x253ae1){_0x2acbd5=_0x2acbd5-0x0;var _0x251954=_0x69b9[_0x2acbd5];return _0x251954;};'use strict';var _=require(_0x969b('0x0'));var util=require(_0x969b('0x1'));var moment=require(_0x969b('0x2'));var BPromise=require(_0x969b('0x3'));var rs=require(_0x969b('0x4'));var fs=require('fs');var Redis=require(_0x969b('0x5'));var db=require(_0x969b('0x6'))['db'];var utils=require(_0x969b('0x7'));var logger=require('../../config/logger')(_0x969b('0x8'));var config=require('../../config/environment');var jayson=require(_0x969b('0x9'));var client=jayson[_0x969b('0xa')][_0x969b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x495f5a,_0x5a071f,_0x133add){return new BPromise(function(_0x1e3715,_0x264e83){return client['request'](_0x495f5a,_0x133add)[_0x969b('0xc')](function(_0x3a4733){logger[_0x969b('0xd')](_0x969b('0xe'),_0x5a071f,_0x969b('0xf'));logger['debug'](_0x969b('0x10'),_0x5a071f,_0x969b('0xf'),JSON['stringify'](_0x3a4733));if(_0x3a4733['error']){if(_0x3a4733[_0x969b('0x11')][_0x969b('0x12')]===0x1f4){logger[_0x969b('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x5a071f,_0x3a4733['error'][_0x969b('0x13')]);return _0x264e83(_0x3a4733['error'][_0x969b('0x13')]);}logger[_0x969b('0x11')](_0x969b('0xe'),_0x5a071f,_0x3a4733['error'][_0x969b('0x13')]);return _0x1e3715(_0x3a4733[_0x969b('0x11')][_0x969b('0x13')]);}else{logger[_0x969b('0xd')](_0x969b('0xe'),_0x5a071f,_0x969b('0xf'));_0x1e3715(_0x3a4733[_0x969b('0x14')][_0x969b('0x13')]);}})[_0x969b('0x15')](function(_0x1d2067){logger[_0x969b('0x11')](_0x969b('0xe'),_0x5a071f,_0x1d2067);_0x264e83(_0x1d2067);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index f744690..786680e 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 _0x60b0=['../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2b358a,_0x19b968){var _0x56e52c=function(_0x4b18f9){while(--_0x4b18f9){_0x2b358a['push'](_0x2b358a['shift']());}};_0x56e52c(++_0x19b968);}(_0x60b0,0x199));var _0x060b=function(_0x29c3b2,_0x3c12ac){_0x29c3b2=_0x29c3b2-0x0;var _0x4b3aa7=_0x60b0[_0x29c3b2];return _0x4b3aa7;};'use strict';var multer=require('multer');var util=require(_0x060b('0x0'));var path=require(_0x060b('0x1'));var timeout=require(_0x060b('0x2'));var express=require(_0x060b('0x3'));var router=express[_0x060b('0x4')]();var fs_extra=require(_0x060b('0x5'));var auth=require(_0x060b('0x6'));var interaction=require(_0x060b('0x7'));var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router[_0x060b('0x8')]('/',auth[_0x060b('0x9')](),controller[_0x060b('0xa')]);router[_0x060b('0x8')](_0x060b('0xb'),auth[_0x060b('0x9')](),controller[_0x060b('0xc')]);router[_0x060b('0x8')](_0x060b('0xd'),auth[_0x060b('0x9')](),controller[_0x060b('0xe')]);router['get'](_0x060b('0xf'),auth[_0x060b('0x9')](),controller[_0x060b('0x10')]);router[_0x060b('0x8')](_0x060b('0x11'),auth[_0x060b('0x9')](),controller[_0x060b('0x12')]);router[_0x060b('0x13')]('/',auth['isAuthenticated'](),controller[_0x060b('0x14')]);router[_0x060b('0x15')](_0x060b('0xb'),auth[_0x060b('0x9')](),controller[_0x060b('0x16')]);router[_0x060b('0x17')]('/:id',auth[_0x060b('0x9')](),controller[_0x060b('0x18')]);module[_0x060b('0x19')]=router; \ No newline at end of file +var _0xa937=['isAuthenticated','/:id','/:id/preview','preview','/:id/run','run','/:id/query','post','create','put','update','delete','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','get'];(function(_0x38ce4c,_0xfdbe8c){var _0x5d4544=function(_0x503537){while(--_0x503537){_0x38ce4c['push'](_0x38ce4c['shift']());}};_0x5d4544(++_0xfdbe8c);}(_0xa937,0xde));var _0x7a93=function(_0x34c56d,_0x224f39){_0x34c56d=_0x34c56d-0x0;var _0x2b7ac4=_0xa937[_0x34c56d];return _0x2b7ac4;};'use strict';var multer=require(_0x7a93('0x0'));var util=require(_0x7a93('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7a93('0x2'));var router=express[_0x7a93('0x3')]();var fs_extra=require(_0x7a93('0x4'));var auth=require(_0x7a93('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7a93('0x6'));var controller=require(_0x7a93('0x7'));router[_0x7a93('0x8')]('/',auth[_0x7a93('0x9')](),controller['index']);router[_0x7a93('0x8')](_0x7a93('0xa'),auth[_0x7a93('0x9')](),controller['show']);router[_0x7a93('0x8')](_0x7a93('0xb'),auth['isAuthenticated'](),controller[_0x7a93('0xc')]);router[_0x7a93('0x8')](_0x7a93('0xd'),auth[_0x7a93('0x9')](),controller[_0x7a93('0xe')]);router[_0x7a93('0x8')](_0x7a93('0xf'),auth[_0x7a93('0x9')](),controller['query']);router[_0x7a93('0x10')]('/',auth[_0x7a93('0x9')](),controller[_0x7a93('0x11')]);router[_0x7a93('0x12')]('/:id',auth[_0x7a93('0x9')](),controller[_0x7a93('0x13')]);router[_0x7a93('0x14')](_0x7a93('0xa'),auth[_0x7a93('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 69c22e4..1be4cfd 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 _0x35a0=['STRING','csv','xlsx','DATE','Loading','ENUM','scheduled','manual','INTEGER','UNSIGNED','moment','exports'];(function(_0x2ccd1b,_0x2a4669){var _0x935b59=function(_0x133568){while(--_0x133568){_0x2ccd1b['push'](_0x2ccd1b['shift']());}};_0x935b59(++_0x2a4669);}(_0x35a0,0x11e));var _0x035a=function(_0x5233f3,_0x594992){_0x5233f3=_0x5233f3-0x0;var _0x5afb4c=_0x35a0[_0x5233f3];return _0x5afb4c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x035a('0x0'));module[_0x035a('0x1')]={'name':{'type':Sequelize[_0x035a('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x035a('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x035a('0x3'),'pdf',_0x035a('0x4')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x035a('0x5')]},'status':{'type':Sequelize[_0x035a('0x2')],'defaultValue':_0x035a('0x6')},'type':{'type':Sequelize[_0x035a('0x7')]('manual',_0x035a('0x8')),'allowNull':![],'defaultValue':_0x035a('0x9')},'reportId':{'type':Sequelize[_0x035a('0xa')](0xb)[_0x035a('0xb')]},'reportType':{'type':Sequelize[_0x035a('0x2')]}}; \ No newline at end of file +var _0xb1ec=['xlsx','DATE','manual','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','pdf'];(function(_0x244cae,_0x8ac36b){var _0x5891d9=function(_0x219dce){while(--_0x219dce){_0x244cae['push'](_0x244cae['shift']());}};_0x5891d9(++_0x8ac36b);}(_0xb1ec,0xb9));var _0xcb1e=function(_0x473523,_0x891e6b){_0x473523=_0x473523-0x0;var _0x1c3657=_0xb1ec[_0x473523];return _0x1c3657;};'use strict';var Sequelize=require(_0xcb1e('0x0'));var moment=require(_0xcb1e('0x1'));module[_0xcb1e('0x2')]={'name':{'type':Sequelize[_0xcb1e('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xcb1e('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xcb1e('0x4')](_0xcb1e('0x5'),_0xcb1e('0x6'),_0xcb1e('0x7')),'allowNull':![],'defaultValue':_0xcb1e('0x5')},'savename':{'type':Sequelize[_0xcb1e('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xcb1e('0x8')]},'endDate':{'type':Sequelize[_0xcb1e('0x8')]},'status':{'type':Sequelize[_0xcb1e('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xcb1e('0x4')](_0xcb1e('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0xcb1e('0x9')},'reportId':{'type':Sequelize[_0xcb1e('0xa')](0xb)[_0xcb1e('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 54e6cbe..fdd0031 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 _0xd032=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','get','ExtractedReports','UserProfileResource','then','error','stack','name','send','index','rawAttributes','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','type','merge','options','includeAll','include','AnalyticExtractedReport','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','basename','output','existsSync','join','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','root','savename','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service'];(function(_0x405ee9,_0x222a58){var _0x52a12b=function(_0x2df4e2){while(--_0x2df4e2){_0x405ee9['push'](_0x405ee9['shift']());}};_0x52a12b(++_0x222a58);}(_0xd032,0xb6));var _0x2d03=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xd032[_0x29d915];return _0x160f86;};'use strict';var emlformat=require(_0x2d03('0x0'));var rimraf=require(_0x2d03('0x1'));var zipdir=require(_0x2d03('0x2'));var jsonpatch=require(_0x2d03('0x3'));var rp=require(_0x2d03('0x4'));var moment=require(_0x2d03('0x5'));var BPromise=require(_0x2d03('0x6'));var Mustache=require(_0x2d03('0x7'));var util=require(_0x2d03('0x8'));var path=require(_0x2d03('0x9'));var sox=require('sox');var csv=require(_0x2d03('0xa'));var ejs=require(_0x2d03('0xb'));var fs=require('fs');var fs_extra=require(_0x2d03('0xc'));var _=require(_0x2d03('0xd'));var squel=require(_0x2d03('0xe'));var crypto=require(_0x2d03('0xf'));var jsforce=require(_0x2d03('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x2d03('0xa'));var querystring=require('querystring');var Papa=require(_0x2d03('0x11'));var Redis=require(_0x2d03('0x12'));var authService=require(_0x2d03('0x13'));var qs=require(_0x2d03('0x14'));var as=require(_0x2d03('0x15'));var hardwareService=require(_0x2d03('0x16'));var logger=require(_0x2d03('0x17'))('api');var utils=require(_0x2d03('0x18'));var config=require(_0x2d03('0x19'));var licenseUtil=require(_0x2d03('0x1a'));var db=require(_0x2d03('0x1b'))['db'];function respondWithStatusCode(_0x3196f8,_0x7a3bac){_0x7a3bac=_0x7a3bac||0xcc;return function(_0x265c0a){if(_0x265c0a){return _0x3196f8[_0x2d03('0x1c')](_0x7a3bac);}return _0x3196f8[_0x2d03('0x1d')](_0x7a3bac)[_0x2d03('0x1e')]();};}function respondWithResult(_0x1f942a,_0x204a66){_0x204a66=_0x204a66||0xc8;return function(_0x2c304f){if(_0x2c304f){return _0x1f942a[_0x2d03('0x1d')](_0x204a66)[_0x2d03('0x1f')](_0x2c304f);}};}function respondWithFilteredResult(_0x2254be,_0x29b6c0){return function(_0x57786b){if(_0x57786b){var _0x1f245e=typeof _0x29b6c0[_0x2d03('0x20')]===_0x2d03('0x21')&&typeof _0x29b6c0[_0x2d03('0x22')]==='undefined';var _0x3a6741=_0x57786b[_0x2d03('0x23')];var _0x2769fe=_0x1f245e?0x0:_0x29b6c0['offset'];var _0x5e00c7=_0x1f245e?_0x57786b['count']:_0x29b6c0[_0x2d03('0x20')]+_0x29b6c0[_0x2d03('0x22')];var _0x3350af;if(_0x5e00c7>=_0x3a6741){_0x5e00c7=_0x3a6741;_0x3350af=0xc8;}else{_0x3350af=0xce;}_0x2254be[_0x2d03('0x1d')](_0x3350af);return _0x2254be['set'](_0x2d03('0x24'),_0x2769fe+'-'+_0x5e00c7+'/'+_0x3a6741)['json'](_0x57786b);}return null;};}function patchUpdates(_0x25eb07){return function(_0x2c65ce){try{jsonpatch[_0x2d03('0x25')](_0x2c65ce,_0x25eb07,!![]);}catch(_0x2c8556){return BPromise[_0x2d03('0x26')](_0x2c8556);}return _0x2c65ce[_0x2d03('0x27')]();};}function saveUpdates(_0x395fb1,_0x3254f0){return function(_0xef6454){if(_0xef6454){return _0xef6454[_0x2d03('0x28')](_0x395fb1)['then'](function(_0x11dd20){return _0x11dd20;});}return null;};}function removeEntity(_0x8c9a21,_0x253a9b){return function(_0x314271){if(_0x314271){return _0x314271[_0x2d03('0x29')]()['then'](function(){var _0x570d47=_0x314271[_0x2d03('0x2a')]({'plain':!![]});var _0x2eef91=_0x2d03('0x2b');return db[_0x2d03('0x2c')][_0x2d03('0x29')]({'where':{'type':_0x2eef91,'resourceId':_0x570d47['id']}})[_0x2d03('0x2d')](function(){return _0x314271;});})[_0x2d03('0x2d')](function(){_0x8c9a21['status'](0xcc)[_0x2d03('0x1e')]();});}};}function handleEntityNotFound(_0x4596e4,_0x23f112){return function(_0x28d37d){if(!_0x28d37d){_0x4596e4[_0x2d03('0x1c')](0x194);}return _0x28d37d;};}function handleError(_0x2a9562,_0x2ddb1d){_0x2ddb1d=_0x2ddb1d||0x1f4;return function(_0xe65a40){logger[_0x2d03('0x2e')](_0xe65a40[_0x2d03('0x2f')]);if(_0xe65a40[_0x2d03('0x30')]){delete _0xe65a40['name'];}_0x2a9562[_0x2d03('0x1d')](_0x2ddb1d)[_0x2d03('0x31')](_0xe65a40);};}exports[_0x2d03('0x32')]=function(_0x4325c9,_0x343d12){var _0x4025ce={},_0xb14426={},_0x5c9160={'count':0x0,'rows':[]};var _0x340cce=_['map'](db['AnalyticExtractedReport'][_0x2d03('0x33')],function(_0xc4b0e5){return{'name':_0xc4b0e5['fieldName'],'type':_0xc4b0e5['type']['key']};});_0xb14426[_0x2d03('0x34')]=_[_0x2d03('0x35')](_0x340cce,_0x2d03('0x30'));_0xb14426[_0x2d03('0x36')]=_[_0x2d03('0x37')](_0x4325c9[_0x2d03('0x36')]);_0xb14426[_0x2d03('0x38')]=_['intersection'](_0xb14426[_0x2d03('0x34')],_0xb14426[_0x2d03('0x36')]);_0x4025ce[_0x2d03('0x39')]=_[_0x2d03('0x3a')](_0xb14426[_0x2d03('0x34')],qs[_0x2d03('0x3b')](_0x4325c9[_0x2d03('0x36')][_0x2d03('0x3b')]));_0x4025ce['attributes']=_0x4025ce[_0x2d03('0x39')][_0x2d03('0x3c')]?_0x4025ce[_0x2d03('0x39')]:_0xb14426[_0x2d03('0x34')];if(!_0x4325c9[_0x2d03('0x36')][_0x2d03('0x3d')]('nolimit')){_0x4025ce[_0x2d03('0x22')]=qs[_0x2d03('0x22')](_0x4325c9['query'][_0x2d03('0x22')]);_0x4025ce['offset']=qs['offset'](_0x4325c9[_0x2d03('0x36')]['offset']);}_0x4025ce[_0x2d03('0x3e')]=qs[_0x2d03('0x3f')](_0x4325c9[_0x2d03('0x36')][_0x2d03('0x3f')]);_0x4025ce['where']=qs[_0x2d03('0x38')](_[_0x2d03('0x40')](_0x4325c9[_0x2d03('0x36')],_0xb14426[_0x2d03('0x38')]),_0x340cce);if(_0x4325c9[_0x2d03('0x36')][_0x2d03('0x41')]){_0x4025ce[_0x2d03('0x42')]=_['merge'](_0x4025ce[_0x2d03('0x42')],{'$or':_[_0x2d03('0x35')](_0x340cce,function(_0x4d72d0){if(_0x4d72d0[_0x2d03('0x43')]!=='VIRTUAL'){var _0x282d81={};_0x282d81[_0x4d72d0[_0x2d03('0x30')]]={'$like':'%'+_0x4325c9[_0x2d03('0x36')]['filter']+'%'};return _0x282d81;}})});}_0x4025ce=_[_0x2d03('0x44')]({},_0x4025ce,_0x4325c9[_0x2d03('0x45')]);var _0x27642e={'where':_0x4025ce[_0x2d03('0x42')]};return db['AnalyticExtractedReport'][_0x2d03('0x23')](_0x27642e)['then'](function(_0x46bc6a){_0x5c9160[_0x2d03('0x23')]=_0x46bc6a;if(_0x4325c9['query'][_0x2d03('0x46')]){_0x4025ce[_0x2d03('0x47')]=[{'all':!![]}];}return db[_0x2d03('0x48')][_0x2d03('0x49')](_0x4025ce);})[_0x2d03('0x2d')](function(_0x10ceca){_0x5c9160[_0x2d03('0x4a')]=_0x10ceca;return _0x5c9160;})[_0x2d03('0x2d')](respondWithFilteredResult(_0x343d12,_0x4025ce))[_0x2d03('0x4b')](handleError(_0x343d12,null));};exports[_0x2d03('0x4c')]=function(_0x847b85,_0x1ce6d2){var _0x4f5f0f={'raw':!![],'where':{'id':_0x847b85[_0x2d03('0x4d')]['id']}},_0x2570c0={};_0x2570c0[_0x2d03('0x34')]=_[_0x2d03('0x37')](db[_0x2d03('0x48')][_0x2d03('0x33')]);_0x2570c0[_0x2d03('0x36')]=_['keys'](_0x847b85[_0x2d03('0x36')]);_0x2570c0[_0x2d03('0x38')]=_['intersection'](_0x2570c0[_0x2d03('0x34')],_0x2570c0['query']);_0x4f5f0f[_0x2d03('0x39')]=_[_0x2d03('0x3a')](_0x2570c0[_0x2d03('0x34')],qs[_0x2d03('0x3b')](_0x847b85[_0x2d03('0x36')][_0x2d03('0x3b')]));_0x4f5f0f[_0x2d03('0x39')]=_0x4f5f0f[_0x2d03('0x39')]['length']?_0x4f5f0f[_0x2d03('0x39')]:_0x2570c0[_0x2d03('0x34')];if(_0x847b85['query'][_0x2d03('0x46')]){_0x4f5f0f['include']=[{'all':!![]}];}_0x4f5f0f=_[_0x2d03('0x44')]({},_0x4f5f0f,_0x847b85[_0x2d03('0x45')]);return db[_0x2d03('0x48')][_0x2d03('0x4e')](_0x4f5f0f)[_0x2d03('0x2d')](handleEntityNotFound(_0x1ce6d2,null))[_0x2d03('0x2d')](respondWithResult(_0x1ce6d2,null))[_0x2d03('0x4b')](handleError(_0x1ce6d2,null));};exports[_0x2d03('0x4f')]=function(_0x1643aa,_0x227eca){return db[_0x2d03('0x48')]['create'](_0x1643aa['body'],{})[_0x2d03('0x2d')](function(_0x4e24cc){var _0x7fd8d2=_0x1643aa[_0x2d03('0x50')][_0x2d03('0x2a')]({'plain':!![]});if(!_0x7fd8d2)throw new Error(_0x2d03('0x51'));if(_0x7fd8d2[_0x2d03('0x52')]==='user'){var _0x35f65e=_0x4e24cc[_0x2d03('0x2a')]({'plain':!![]});var _0x491f75=_0x2d03('0x2b');return db[_0x2d03('0x53')][_0x2d03('0x4e')]({'where':{'name':_0x491f75,'userProfileId':_0x7fd8d2['userProfileId']},'raw':!![]})['then'](function(_0x2a1f28){if(_0x2a1f28&&_0x2a1f28[_0x2d03('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x35f65e[_0x2d03('0x30')],'resourceId':_0x35f65e['id'],'type':_0x2a1f28[_0x2d03('0x30')],'sectionId':_0x2a1f28['id']},{})[_0x2d03('0x2d')](function(){return _0x4e24cc;});}else{return _0x4e24cc;}})[_0x2d03('0x4b')](function(_0x30f071){logger['error'](_0x2d03('0x55'),_0x30f071);throw _0x30f071;});}return _0x4e24cc;})[_0x2d03('0x2d')](respondWithResult(_0x227eca,0xc9))[_0x2d03('0x4b')](handleError(_0x227eca,null));};exports[_0x2d03('0x28')]=function(_0x4953d5,_0x2c1a93){if(_0x4953d5['body']['id']){delete _0x4953d5[_0x2d03('0x56')]['id'];}return db['AnalyticExtractedReport'][_0x2d03('0x4e')]({'where':{'id':_0x4953d5['params']['id']}})[_0x2d03('0x2d')](handleEntityNotFound(_0x2c1a93,null))[_0x2d03('0x2d')](saveUpdates(_0x4953d5['body'],null))[_0x2d03('0x2d')](respondWithResult(_0x2c1a93,null))[_0x2d03('0x4b')](handleError(_0x2c1a93,null));};exports[_0x2d03('0x29')]=function(_0xb4ce25,_0x5d19d4){return db['AnalyticExtractedReport'][_0x2d03('0x4e')]({'where':{'id':_0xb4ce25[_0x2d03('0x4d')]['id']}})[_0x2d03('0x2d')](handleEntityNotFound(_0x5d19d4,null))[_0x2d03('0x2d')](removeEntity(_0x5d19d4,null))['catch'](handleError(_0x5d19d4,null));};exports[_0x2d03('0x57')]=function(_0x1108d8,_0x25d799,_0x39e7e2){return db['AnalyticExtractedReport'][_0x2d03('0x4e')]({'where':{'id':_0x1108d8['params']['id']},'attributes':['name',_0x2d03('0x58'),'savename',_0x2d03('0x59')],'raw':!![]})['then'](handleEntityNotFound(_0x25d799,null))[_0x2d03('0x2d')](function(_0x1ba106){if(_0x1ba106){if(!fs[_0x2d03('0x5a')](path[_0x2d03('0x5b')](config['root'],_0x2d03('0x5c'),_0x1ba106['savename']))){throw new db['Sequelize'][(_0x2d03('0x5d'))](_0x2d03('0x5e'));}if(_0x1108d8['query'][_0x2d03('0x5f')]){return _0x25d799[_0x2d03('0x1c')](0xc8);}return _0x25d799[_0x2d03('0x57')](path[_0x2d03('0x5b')](config[_0x2d03('0x60')],_0x2d03('0x5c'),_0x1ba106[_0x2d03('0x61')]),util[_0x2d03('0x62')](_0x2d03('0x63'),_0x1ba106[_0x2d03('0x58')]||_0x1ba106[_0x2d03('0x30')],_0x1ba106[_0x2d03('0x59')][_0x2d03('0x64')]()));}})[_0x2d03('0x4b')](handleError(_0x25d799,null));}; \ No newline at end of file +var _0x1849=['count','set','Content-Range','apply','reject','save','update','then','destroy','get','sendStatus','error','stack','name','map','AnalyticExtractedReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','options','includeAll','include','rows','show','params','merge','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','output','existsSync','join','root','server/files/reports','savename','ValidationError','Report\x20not\x20found\x20or\x20empty','%s.%s','basename','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','limit'];(function(_0x19324e,_0x35cc43){var _0xcfde4c=function(_0x58d362){while(--_0x58d362){_0x19324e['push'](_0x19324e['shift']());}};_0xcfde4c(++_0x35cc43);}(_0x1849,0xfe));var _0x9184=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x1849[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x9184('0x0'));var rimraf=require(_0x9184('0x1'));var zipdir=require(_0x9184('0x2'));var jsonpatch=require(_0x9184('0x3'));var rp=require(_0x9184('0x4'));var moment=require(_0x9184('0x5'));var BPromise=require(_0x9184('0x6'));var Mustache=require(_0x9184('0x7'));var util=require(_0x9184('0x8'));var path=require(_0x9184('0x9'));var sox=require(_0x9184('0xa'));var csv=require(_0x9184('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9184('0xc'));var crypto=require(_0x9184('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9184('0xe'));var toCsv=require(_0x9184('0xb'));var querystring=require(_0x9184('0xf'));var Papa=require(_0x9184('0x10'));var Redis=require(_0x9184('0x11'));var authService=require(_0x9184('0x12'));var qs=require(_0x9184('0x13'));var as=require(_0x9184('0x14'));var hardwareService=require(_0x9184('0x15'));var logger=require(_0x9184('0x16'))(_0x9184('0x17'));var utils=require(_0x9184('0x18'));var config=require(_0x9184('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19750b,_0x20541b){_0x20541b=_0x20541b||0xcc;return function(_0x4a67cd){if(_0x4a67cd){return _0x19750b['sendStatus'](_0x20541b);}return _0x19750b[_0x9184('0x1a')](_0x20541b)[_0x9184('0x1b')]();};}function respondWithResult(_0x4ca450,_0x53d499){_0x53d499=_0x53d499||0xc8;return function(_0x52efd){if(_0x52efd){return _0x4ca450[_0x9184('0x1a')](_0x53d499)[_0x9184('0x1c')](_0x52efd);}};}function respondWithFilteredResult(_0x1ad8de,_0x92a78e){return function(_0xbbca8d){if(_0xbbca8d){var _0x388559=typeof _0x92a78e[_0x9184('0x1d')]==='undefined'&&typeof _0x92a78e[_0x9184('0x1e')]==='undefined';var _0x128533=_0xbbca8d[_0x9184('0x1f')];var _0x2e51f7=_0x388559?0x0:_0x92a78e[_0x9184('0x1d')];var _0x177f69=_0x388559?_0xbbca8d['count']:_0x92a78e[_0x9184('0x1d')]+_0x92a78e[_0x9184('0x1e')];var _0x516e06;if(_0x177f69>=_0x128533){_0x177f69=_0x128533;_0x516e06=0xc8;}else{_0x516e06=0xce;}_0x1ad8de['status'](_0x516e06);return _0x1ad8de[_0x9184('0x20')](_0x9184('0x21'),_0x2e51f7+'-'+_0x177f69+'/'+_0x128533)[_0x9184('0x1c')](_0xbbca8d);}return null;};}function patchUpdates(_0x1dec79){return function(_0x3faeb4){try{jsonpatch[_0x9184('0x22')](_0x3faeb4,_0x1dec79,!![]);}catch(_0x378d1d){return BPromise[_0x9184('0x23')](_0x378d1d);}return _0x3faeb4[_0x9184('0x24')]();};}function saveUpdates(_0x973764,_0x530ee4){return function(_0x31eff2){if(_0x31eff2){return _0x31eff2[_0x9184('0x25')](_0x973764)[_0x9184('0x26')](function(_0x55c4b4){return _0x55c4b4;});}return null;};}function removeEntity(_0x5af3f2,_0x48a69e){return function(_0xdf6988){if(_0xdf6988){return _0xdf6988[_0x9184('0x27')]()[_0x9184('0x26')](function(){var _0x2dbe78=_0xdf6988[_0x9184('0x28')]({'plain':!![]});var _0x169f48='ExtractedReports';return db['UserProfileResource'][_0x9184('0x27')]({'where':{'type':_0x169f48,'resourceId':_0x2dbe78['id']}})[_0x9184('0x26')](function(){return _0xdf6988;});})['then'](function(){_0x5af3f2['status'](0xcc)[_0x9184('0x1b')]();});}};}function handleEntityNotFound(_0xac2166,_0x31ad9f){return function(_0x5e6c61){if(!_0x5e6c61){_0xac2166[_0x9184('0x29')](0x194);}return _0x5e6c61;};}function handleError(_0x8024f9,_0x3f5f03){_0x3f5f03=_0x3f5f03||0x1f4;return function(_0x146b42){logger[_0x9184('0x2a')](_0x146b42[_0x9184('0x2b')]);if(_0x146b42[_0x9184('0x2c')]){delete _0x146b42[_0x9184('0x2c')];}_0x8024f9[_0x9184('0x1a')](_0x3f5f03)['send'](_0x146b42);};}exports['index']=function(_0x5d947c,_0x571f27){var _0x4d121a={},_0x4bddf4={},_0x41a4dd={'count':0x0,'rows':[]};var _0x391535=_[_0x9184('0x2d')](db[_0x9184('0x2e')][_0x9184('0x2f')],function(_0x1dc7bc){return{'name':_0x1dc7bc[_0x9184('0x30')],'type':_0x1dc7bc[_0x9184('0x31')]['key']};});_0x4bddf4['model']=_[_0x9184('0x2d')](_0x391535,_0x9184('0x2c'));_0x4bddf4[_0x9184('0x32')]=_[_0x9184('0x33')](_0x5d947c[_0x9184('0x32')]);_0x4bddf4[_0x9184('0x34')]=_[_0x9184('0x35')](_0x4bddf4[_0x9184('0x36')],_0x4bddf4['query']);_0x4d121a[_0x9184('0x37')]=_[_0x9184('0x35')](_0x4bddf4['model'],qs[_0x9184('0x38')](_0x5d947c[_0x9184('0x32')][_0x9184('0x38')]));_0x4d121a[_0x9184('0x37')]=_0x4d121a['attributes'][_0x9184('0x39')]?_0x4d121a[_0x9184('0x37')]:_0x4bddf4[_0x9184('0x36')];if(!_0x5d947c[_0x9184('0x32')][_0x9184('0x3a')]('nolimit')){_0x4d121a[_0x9184('0x1e')]=qs[_0x9184('0x1e')](_0x5d947c[_0x9184('0x32')][_0x9184('0x1e')]);_0x4d121a[_0x9184('0x1d')]=qs['offset'](_0x5d947c[_0x9184('0x32')][_0x9184('0x1d')]);}_0x4d121a[_0x9184('0x3b')]=qs[_0x9184('0x3c')](_0x5d947c[_0x9184('0x32')][_0x9184('0x3c')]);_0x4d121a[_0x9184('0x3d')]=qs['filters'](_[_0x9184('0x3e')](_0x5d947c['query'],_0x4bddf4[_0x9184('0x34')]),_0x391535);if(_0x5d947c[_0x9184('0x32')][_0x9184('0x3f')]){_0x4d121a[_0x9184('0x3d')]=_['merge'](_0x4d121a[_0x9184('0x3d')],{'$or':_['map'](_0x391535,function(_0x43bb97){if(_0x43bb97['type']!=='VIRTUAL'){var _0x1114e3={};_0x1114e3[_0x43bb97['name']]={'$like':'%'+_0x5d947c[_0x9184('0x32')][_0x9184('0x3f')]+'%'};return _0x1114e3;}})});}_0x4d121a=_['merge']({},_0x4d121a,_0x5d947c[_0x9184('0x40')]);var _0x43cb39={'where':_0x4d121a['where']};return db[_0x9184('0x2e')][_0x9184('0x1f')](_0x43cb39)[_0x9184('0x26')](function(_0x4f19f9){_0x41a4dd[_0x9184('0x1f')]=_0x4f19f9;if(_0x5d947c[_0x9184('0x32')][_0x9184('0x41')]){_0x4d121a[_0x9184('0x42')]=[{'all':!![]}];}return db[_0x9184('0x2e')]['findAll'](_0x4d121a);})[_0x9184('0x26')](function(_0x116811){_0x41a4dd[_0x9184('0x43')]=_0x116811;return _0x41a4dd;})[_0x9184('0x26')](respondWithFilteredResult(_0x571f27,_0x4d121a))['catch'](handleError(_0x571f27,null));};exports[_0x9184('0x44')]=function(_0x3514f3,_0x2edd30){var _0x2335c6={'raw':!![],'where':{'id':_0x3514f3[_0x9184('0x45')]['id']}},_0x414d36={};_0x414d36['model']=_[_0x9184('0x33')](db['AnalyticExtractedReport']['rawAttributes']);_0x414d36[_0x9184('0x32')]=_['keys'](_0x3514f3[_0x9184('0x32')]);_0x414d36['filters']=_[_0x9184('0x35')](_0x414d36[_0x9184('0x36')],_0x414d36['query']);_0x2335c6['attributes']=_[_0x9184('0x35')](_0x414d36[_0x9184('0x36')],qs['fields'](_0x3514f3[_0x9184('0x32')]['fields']));_0x2335c6[_0x9184('0x37')]=_0x2335c6[_0x9184('0x37')][_0x9184('0x39')]?_0x2335c6[_0x9184('0x37')]:_0x414d36[_0x9184('0x36')];if(_0x3514f3[_0x9184('0x32')][_0x9184('0x41')]){_0x2335c6[_0x9184('0x42')]=[{'all':!![]}];}_0x2335c6=_[_0x9184('0x46')]({},_0x2335c6,_0x3514f3[_0x9184('0x40')]);return db['AnalyticExtractedReport'][_0x9184('0x47')](_0x2335c6)[_0x9184('0x26')](handleEntityNotFound(_0x2edd30,null))[_0x9184('0x26')](respondWithResult(_0x2edd30,null))[_0x9184('0x48')](handleError(_0x2edd30,null));};exports[_0x9184('0x49')]=function(_0x421203,_0x1e3eb1){return db[_0x9184('0x2e')][_0x9184('0x49')](_0x421203[_0x9184('0x4a')],{})[_0x9184('0x26')](function(_0x55e236){var _0x4155cb=_0x421203[_0x9184('0x4b')][_0x9184('0x28')]({'plain':!![]});if(!_0x4155cb)throw new Error(_0x9184('0x4c'));if(_0x4155cb[_0x9184('0x4d')]===_0x9184('0x4b')){var _0x8f4cb4=_0x55e236[_0x9184('0x28')]({'plain':!![]});var _0x481028=_0x9184('0x4e');return db[_0x9184('0x4f')][_0x9184('0x47')]({'where':{'name':_0x481028,'userProfileId':_0x4155cb[_0x9184('0x50')]},'raw':!![]})[_0x9184('0x26')](function(_0x4d86ac){if(_0x4d86ac&&_0x4d86ac[_0x9184('0x51')]===0x0){return db[_0x9184('0x52')]['create']({'name':_0x8f4cb4[_0x9184('0x2c')],'resourceId':_0x8f4cb4['id'],'type':_0x4d86ac[_0x9184('0x2c')],'sectionId':_0x4d86ac['id']},{})['then'](function(){return _0x55e236;});}else{return _0x55e236;}})[_0x9184('0x48')](function(_0x7e8829){logger[_0x9184('0x2a')](_0x9184('0x53'),_0x7e8829);throw _0x7e8829;});}return _0x55e236;})['then'](respondWithResult(_0x1e3eb1,0xc9))[_0x9184('0x48')](handleError(_0x1e3eb1,null));};exports['update']=function(_0x1ec5ce,_0x43e91e){if(_0x1ec5ce[_0x9184('0x4a')]['id']){delete _0x1ec5ce['body']['id'];}return db[_0x9184('0x2e')][_0x9184('0x47')]({'where':{'id':_0x1ec5ce[_0x9184('0x45')]['id']}})[_0x9184('0x26')](handleEntityNotFound(_0x43e91e,null))[_0x9184('0x26')](saveUpdates(_0x1ec5ce[_0x9184('0x4a')],null))[_0x9184('0x26')](respondWithResult(_0x43e91e,null))[_0x9184('0x48')](handleError(_0x43e91e,null));};exports[_0x9184('0x27')]=function(_0x3fd42c,_0x2f28d0){return db['AnalyticExtractedReport'][_0x9184('0x47')]({'where':{'id':_0x3fd42c[_0x9184('0x45')]['id']}})['then'](handleEntityNotFound(_0x2f28d0,null))['then'](removeEntity(_0x2f28d0,null))['catch'](handleError(_0x2f28d0,null));};exports[_0x9184('0x54')]=function(_0x54e752,_0x5459db,_0x58f5b4){return db[_0x9184('0x2e')][_0x9184('0x47')]({'where':{'id':_0x54e752[_0x9184('0x45')]['id']},'attributes':['name','basename','savename',_0x9184('0x55')],'raw':!![]})[_0x9184('0x26')](handleEntityNotFound(_0x5459db,null))[_0x9184('0x26')](function(_0x18c59f){if(_0x18c59f){if(!fs[_0x9184('0x56')](path[_0x9184('0x57')](config[_0x9184('0x58')],_0x9184('0x59'),_0x18c59f[_0x9184('0x5a')]))){throw new db['Sequelize'][(_0x9184('0x5b'))](_0x9184('0x5c'));}if(_0x54e752[_0x9184('0x32')]['exists']){return _0x5459db[_0x9184('0x29')](0xc8);}return _0x5459db[_0x9184('0x54')](path[_0x9184('0x57')](config[_0x9184('0x58')],_0x9184('0x59'),_0x18c59f[_0x9184('0x5a')]),util['format'](_0x9184('0x5d'),_0x18c59f[_0x9184('0x5e')]||_0x18c59f['name'],_0x18c59f['output']['toLowerCase']()));}})[_0x9184('0x48')](handleError(_0x5459db,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 235e651..713a322 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 _0x8259=['./analyticExtractedReport.attributes','define','AnalyticExtractedReport','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8259,0x175));var _0x9825=function(_0x22953e,_0x5664bc){_0x22953e=_0x22953e-0x0;var _0x1058f3=_0x8259[_0x22953e];return _0x1058f3;};'use strict';var _=require(_0x9825('0x0'));var util=require(_0x9825('0x1'));var logger=require('../../config/logger')(_0x9825('0x2'));var moment=require('moment');var BPromise=require(_0x9825('0x3'));var rp=require(_0x9825('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9825('0x5'));var config=require(_0x9825('0x6'));var attributes=require(_0x9825('0x7'));module['exports']=function(_0x3d9066,_0x217348){return _0x3d9066[_0x9825('0x8')](_0x9825('0x9'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1921=['request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','api','moment'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0x1921,0x1e8));var _0x1192=function(_0x295414,_0x3c9a2e){_0x295414=_0x295414-0x0;var _0x4dcf10=_0x1921[_0x295414];return _0x4dcf10;};'use strict';var _=require('lodash');var util=require(_0x1192('0x0'));var logger=require(_0x1192('0x1'))(_0x1192('0x2'));var moment=require(_0x1192('0x3'));var BPromise=require('bluebird');var rp=require(_0x1192('0x4'));var fs=require('fs');var path=require(_0x1192('0x5'));var rimraf=require(_0x1192('0x6'));var config=require(_0x1192('0x7'));var attributes=require(_0x1192('0x8'));module['exports']=function(_0xa90653,_0x5538ba){return _0xa90653[_0x1192('0x9')](_0x1192('0xa'),attributes,{'tableName':_0x1192('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 18f4a73..1bcfc56 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 _0x930a=['AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x15f223,_0x5b716a){var _0x466b6a=function(_0x3dbaff){while(--_0x3dbaff){_0x15f223['push'](_0x15f223['shift']());}};_0x466b6a(++_0x5b716a);}(_0x930a,0xf8));var _0xa930=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x930a[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xa930('0x0'));var util=require('util');var moment=require(_0xa930('0x1'));var BPromise=require(_0xa930('0x2'));var rs=require(_0xa930('0x3'));var fs=require('fs');var Redis=require(_0xa930('0x4'));var db=require(_0xa930('0x5'))['db'];var utils=require(_0xa930('0x6'));var logger=require(_0xa930('0x7'))('rpc');var config=require(_0xa930('0x8'));var jayson=require(_0xa930('0x9'));var client=jayson[_0xa930('0xa')][_0xa930('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42b081,_0x2766e2,_0x910cb1){return new BPromise(function(_0x12fd94,_0x197c61){return client['request'](_0x42b081,_0x910cb1)['then'](function(_0x1dde95){logger[_0xa930('0xc')](_0xa930('0xd'),_0x2766e2,_0xa930('0xe'));logger[_0xa930('0xf')](_0xa930('0x10'),_0x2766e2,_0xa930('0xe'),JSON['stringify'](_0x1dde95));if(_0x1dde95[_0xa930('0x11')]){if(_0x1dde95['error'][_0xa930('0x12')]===0x1f4){logger[_0xa930('0x11')](_0xa930('0xd'),_0x2766e2,_0x1dde95[_0xa930('0x11')][_0xa930('0x13')]);return _0x197c61(_0x1dde95[_0xa930('0x11')][_0xa930('0x13')]);}logger[_0xa930('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2766e2,_0x1dde95[_0xa930('0x11')]['message']);return _0x12fd94(_0x1dde95[_0xa930('0x11')]['message']);}else{logger['info'](_0xa930('0xd'),_0x2766e2,_0xa930('0xe'));_0x12fd94(_0x1dde95[_0xa930('0x14')][_0xa930('0x13')]);}})[_0xa930('0x15')](function(_0x2d2b64){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x2766e2,_0x2d2b64);_0x197c61(_0x2d2b64);});});} \ No newline at end of file +var _0x4b96=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util'];(function(_0xa4c12b,_0x2d53f6){var _0x5128e4=function(_0x18a106){while(--_0x18a106){_0xa4c12b['push'](_0xa4c12b['shift']());}};_0x5128e4(++_0x2d53f6);}(_0x4b96,0x12e));var _0x64b9=function(_0x3f1fd5,_0x10a3fe){_0x3f1fd5=_0x3f1fd5-0x0;var _0x385726=_0x4b96[_0x3f1fd5];return _0x385726;};'use strict';var _=require(_0x64b9('0x0'));var util=require(_0x64b9('0x1'));var moment=require(_0x64b9('0x2'));var BPromise=require('bluebird');var rs=require(_0x64b9('0x3'));var fs=require('fs');var Redis=require(_0x64b9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x64b9('0x5'));var logger=require(_0x64b9('0x6'))(_0x64b9('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x64b9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51433b,_0x46adab,_0x9c08fb){return new BPromise(function(_0x3f9512,_0x405c29){return client[_0x64b9('0x9')](_0x51433b,_0x9c08fb)['then'](function(_0x22060e){logger[_0x64b9('0xa')](_0x64b9('0xb'),_0x46adab,'request\x20sent');logger[_0x64b9('0xc')](_0x64b9('0xd'),_0x46adab,_0x64b9('0xe'),JSON[_0x64b9('0xf')](_0x22060e));if(_0x22060e['error']){if(_0x22060e[_0x64b9('0x10')][_0x64b9('0x11')]===0x1f4){logger['error'](_0x64b9('0xb'),_0x46adab,_0x22060e[_0x64b9('0x10')][_0x64b9('0x12')]);return _0x405c29(_0x22060e[_0x64b9('0x10')][_0x64b9('0x12')]);}logger[_0x64b9('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x46adab,_0x22060e[_0x64b9('0x10')][_0x64b9('0x12')]);return _0x3f9512(_0x22060e[_0x64b9('0x10')][_0x64b9('0x12')]);}else{logger[_0x64b9('0xa')](_0x64b9('0xb'),_0x46adab,'request\x20sent');_0x3f9512(_0x22060e['result'][_0x64b9('0x12')]);}})['catch'](function(_0x39f91c){logger[_0x64b9('0x10')](_0x64b9('0xb'),_0x46adab,_0x39f91c);_0x405c29(_0x39f91c);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index dbe375e..da838c5 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 _0x6a4d=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x437d7f,_0x1feb46){var _0x31058c=function(_0x49dd1a){while(--_0x49dd1a){_0x437d7f['push'](_0x437d7f['shift']());}};_0x31058c(++_0x1feb46);}(_0x6a4d,0x9f));var _0xd6a4=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x6a4d[_0x5608a3];return _0x1ed50a;};'use strict';var multer=require(_0xd6a4('0x0'));var util=require(_0xd6a4('0x1'));var path=require(_0xd6a4('0x2'));var timeout=require(_0xd6a4('0x3'));var express=require(_0xd6a4('0x4'));var router=express['Router']();var fs_extra=require(_0xd6a4('0x5'));var auth=require(_0xd6a4('0x6'));var interaction=require(_0xd6a4('0x7'));var config=require(_0xd6a4('0x8'));var controller=require('./analyticExtractedReport.controller');router[_0xd6a4('0x9')]('/',auth[_0xd6a4('0xa')](),controller[_0xd6a4('0xb')]);router['get'](_0xd6a4('0xc'),auth[_0xd6a4('0xa')](),controller[_0xd6a4('0xd')]);router[_0xd6a4('0x9')](_0xd6a4('0xe'),auth[_0xd6a4('0xa')](),controller[_0xd6a4('0xf')]);router[_0xd6a4('0x10')]('/',auth[_0xd6a4('0xa')](),controller[_0xd6a4('0x11')]);router[_0xd6a4('0x12')](_0xd6a4('0xc'),auth[_0xd6a4('0xa')](),controller[_0xd6a4('0x13')]);router[_0xd6a4('0x14')](_0xd6a4('0xc'),auth[_0xd6a4('0xa')](),controller[_0xd6a4('0x15')]);module[_0xd6a4('0x16')]=router; \ No newline at end of file +var _0x10a9=['/:id','show','/:id/download','download','post','create','put','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./analyticExtractedReport.controller','isAuthenticated','get'];(function(_0x363887,_0x4f5e81){var _0x3dbf=function(_0x35a9b2){while(--_0x35a9b2){_0x363887['push'](_0x363887['shift']());}};_0x3dbf(++_0x4f5e81);}(_0x10a9,0x1e5));var _0x910a=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x10a9[_0x432682];return _0x463d05;};'use strict';var multer=require(_0x910a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x910a('0x1'));var express=require(_0x910a('0x2'));var router=express[_0x910a('0x3')]();var fs_extra=require(_0x910a('0x4'));var auth=require(_0x910a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x910a('0x6'));router['get']('/',auth[_0x910a('0x7')](),controller['index']);router[_0x910a('0x8')](_0x910a('0x9'),auth[_0x910a('0x7')](),controller[_0x910a('0xa')]);router[_0x910a('0x8')](_0x910a('0xb'),auth[_0x910a('0x7')](),controller[_0x910a('0xc')]);router[_0x910a('0xd')]('/',auth['isAuthenticated'](),controller[_0x910a('0xe')]);router[_0x910a('0xf')](_0x910a('0x9'),auth[_0x910a('0x7')](),controller[_0x910a('0x10')]);router[_0x910a('0x11')](_0x910a('0x9'),auth[_0x910a('0x7')](),controller[_0x910a('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 0e2f92e..ed83139 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 _0xd7cd=['STRING','BOOLEAN','sequelize','exports'];(function(_0xa4e2f4,_0x501e44){var _0x454e81=function(_0x3947dc){while(--_0x3947dc){_0xa4e2f4['push'](_0xa4e2f4['shift']());}};_0x454e81(++_0x501e44);}(_0xd7cd,0x11a));var _0xdd7c=function(_0x1ee158,_0x21d25a){_0x1ee158=_0x1ee158-0x0;var _0xc37464=_0xd7cd[_0x1ee158];return _0xc37464;};'use strict';var Sequelize=require(_0xdd7c('0x0'));module[_0xdd7c('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xdd7c('0x2')]},'function':{'type':Sequelize[_0xdd7c('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0xdd7c('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xdd7c('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x50b2=['TEXT','STRING','BOOLEAN','exports'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x50b2,0x157));var _0x250b=function(_0x3b791a,_0x400f19){_0x3b791a=_0x3b791a-0x0;var _0x154c99=_0x50b2[_0x3b791a];return _0x154c99;};'use strict';var Sequelize=require('sequelize');module[_0x250b('0x0')]={'field':{'type':Sequelize[_0x250b('0x1')]},'alias':{'type':Sequelize[_0x250b('0x2')]},'function':{'type':Sequelize[_0x250b('0x2')]},'format':{'type':Sequelize[_0x250b('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x250b('0x2')]},'custom':{'type':Sequelize[_0x250b('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 2483273..7b7603e 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 _0xa888=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','AnalyticFieldReport','fieldName','type','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','VIRTUAL','merge','options','where','count','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','bulkCreate','bulkDestroy','ids','sequelize','transaction','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x46a3ff,_0x470b9a){var _0x404bc2=function(_0x20f25f){while(--_0x20f25f){_0x46a3ff['push'](_0x46a3ff['shift']());}};_0x404bc2(++_0x470b9a);}(_0xa888,0x89));var _0x8a88=function(_0x2b4c71,_0x248054){_0x2b4c71=_0x2b4c71-0x0;var _0x20438f=_0xa888[_0x2b4c71];return _0x20438f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a88('0x0'));var zipdir=require(_0x8a88('0x1'));var jsonpatch=require(_0x8a88('0x2'));var rp=require(_0x8a88('0x3'));var moment=require('moment');var BPromise=require(_0x8a88('0x4'));var Mustache=require(_0x8a88('0x5'));var util=require(_0x8a88('0x6'));var path=require('path');var sox=require(_0x8a88('0x7'));var csv=require(_0x8a88('0x8'));var ejs=require(_0x8a88('0x9'));var fs=require('fs');var fs_extra=require(_0x8a88('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8a88('0xb'));var jsforce=require(_0x8a88('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8a88('0x8'));var querystring=require(_0x8a88('0xd'));var Papa=require(_0x8a88('0xe'));var Redis=require('ioredis');var authService=require(_0x8a88('0xf'));var qs=require(_0x8a88('0x10'));var as=require(_0x8a88('0x11'));var hardwareService=require(_0x8a88('0x12'));var logger=require(_0x8a88('0x13'))('api');var utils=require(_0x8a88('0x14'));var config=require(_0x8a88('0x15'));var licenseUtil=require(_0x8a88('0x16'));var db=require(_0x8a88('0x17'))['db'];function respondWithStatusCode(_0x315d2e,_0x479150){_0x479150=_0x479150||0xcc;return function(_0x309a7b){if(_0x309a7b){return _0x315d2e[_0x8a88('0x18')](_0x479150);}return _0x315d2e[_0x8a88('0x19')](_0x479150)['end']();};}function respondWithResult(_0x390acd,_0x392b5f){_0x392b5f=_0x392b5f||0xc8;return function(_0x4645f9){if(_0x4645f9){return _0x390acd['status'](_0x392b5f)[_0x8a88('0x1a')](_0x4645f9);}};}function respondWithFilteredResult(_0x46e6fb,_0x219a5e){return function(_0x3f44f0){if(_0x3f44f0){var _0x1f2b72=typeof _0x219a5e[_0x8a88('0x1b')]===_0x8a88('0x1c')&&typeof _0x219a5e[_0x8a88('0x1d')]===_0x8a88('0x1c');var _0x4910fc=_0x3f44f0['count'];var _0x51f5a2=_0x1f2b72?0x0:_0x219a5e[_0x8a88('0x1b')];var _0x3ab964=_0x1f2b72?_0x3f44f0['count']:_0x219a5e[_0x8a88('0x1b')]+_0x219a5e[_0x8a88('0x1d')];var _0x1fc5d9;if(_0x3ab964>=_0x4910fc){_0x3ab964=_0x4910fc;_0x1fc5d9=0xc8;}else{_0x1fc5d9=0xce;}_0x46e6fb[_0x8a88('0x19')](_0x1fc5d9);return _0x46e6fb[_0x8a88('0x1e')](_0x8a88('0x1f'),_0x51f5a2+'-'+_0x3ab964+'/'+_0x4910fc)[_0x8a88('0x1a')](_0x3f44f0);}return null;};}function patchUpdates(_0x321769){return function(_0x1a6eba){try{jsonpatch[_0x8a88('0x20')](_0x1a6eba,_0x321769,!![]);}catch(_0x500bbb){return BPromise[_0x8a88('0x21')](_0x500bbb);}return _0x1a6eba[_0x8a88('0x22')]();};}function saveUpdates(_0x1875a7,_0x30fd53){return function(_0x41f331){if(_0x41f331){return _0x41f331[_0x8a88('0x23')](_0x1875a7)[_0x8a88('0x24')](function(_0xe0ea19){return _0xe0ea19;});}return null;};}function removeEntity(_0x4fcede,_0x411f79){return function(_0x1c37c1){if(_0x1c37c1){return _0x1c37c1[_0x8a88('0x25')]()[_0x8a88('0x24')](function(){_0x4fcede[_0x8a88('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x274a2b,_0x49bc2d){return function(_0x1c0cd3){if(!_0x1c0cd3){_0x274a2b[_0x8a88('0x18')](0x194);}return _0x1c0cd3;};}function handleError(_0x4ebc6d,_0x55f4e9){_0x55f4e9=_0x55f4e9||0x1f4;return function(_0x39523f){logger['error'](_0x39523f[_0x8a88('0x26')]);if(_0x39523f[_0x8a88('0x27')]){delete _0x39523f[_0x8a88('0x27')];}_0x4ebc6d[_0x8a88('0x19')](_0x55f4e9)['send'](_0x39523f);};}exports[_0x8a88('0x28')]=function(_0x54f91f,_0xaa835a){var _0x208756={},_0x4d6cab={},_0x29fb6d={'count':0x0,'rows':[]};var _0x3fe060=_[_0x8a88('0x29')](db[_0x8a88('0x2a')]['rawAttributes'],function(_0x609d6b){return{'name':_0x609d6b[_0x8a88('0x2b')],'type':_0x609d6b[_0x8a88('0x2c')]['key']};});_0x4d6cab[_0x8a88('0x2d')]=_[_0x8a88('0x29')](_0x3fe060,_0x8a88('0x27'));_0x4d6cab[_0x8a88('0x2e')]=_['keys'](_0x54f91f[_0x8a88('0x2e')]);_0x4d6cab['filters']=_['intersection'](_0x4d6cab[_0x8a88('0x2d')],_0x4d6cab[_0x8a88('0x2e')]);_0x208756[_0x8a88('0x2f')]=_[_0x8a88('0x30')](_0x4d6cab['model'],qs[_0x8a88('0x31')](_0x54f91f['query'][_0x8a88('0x31')]));_0x208756[_0x8a88('0x2f')]=_0x208756[_0x8a88('0x2f')][_0x8a88('0x32')]?_0x208756[_0x8a88('0x2f')]:_0x4d6cab[_0x8a88('0x2d')];if(!_0x54f91f['query'][_0x8a88('0x33')](_0x8a88('0x34'))){_0x208756[_0x8a88('0x1d')]=qs[_0x8a88('0x1d')](_0x54f91f['query'][_0x8a88('0x1d')]);_0x208756[_0x8a88('0x1b')]=qs[_0x8a88('0x1b')](_0x54f91f[_0x8a88('0x2e')][_0x8a88('0x1b')]);}_0x208756['order']=qs[_0x8a88('0x35')](_0x54f91f['query'][_0x8a88('0x35')]);_0x208756['where']=qs[_0x8a88('0x36')](_[_0x8a88('0x37')](_0x54f91f[_0x8a88('0x2e')],_0x4d6cab[_0x8a88('0x36')]),_0x3fe060);if(_0x54f91f[_0x8a88('0x2e')][_0x8a88('0x38')]){_0x208756['where']=_['merge'](_0x208756['where'],{'$or':_[_0x8a88('0x29')](_0x3fe060,function(_0x56a920){if(_0x56a920[_0x8a88('0x2c')]!==_0x8a88('0x39')){var _0x2317cc={};_0x2317cc[_0x56a920[_0x8a88('0x27')]]={'$like':'%'+_0x54f91f[_0x8a88('0x2e')][_0x8a88('0x38')]+'%'};return _0x2317cc;}})});}_0x208756=_[_0x8a88('0x3a')]({},_0x208756,_0x54f91f[_0x8a88('0x3b')]);var _0x2fd955={'where':_0x208756[_0x8a88('0x3c')]};return db[_0x8a88('0x2a')][_0x8a88('0x3d')](_0x2fd955)[_0x8a88('0x24')](function(_0x2caa0d){_0x29fb6d['count']=_0x2caa0d;if(_0x54f91f[_0x8a88('0x2e')][_0x8a88('0x3e')]){_0x208756[_0x8a88('0x3f')]=[{'all':!![]}];}return db[_0x8a88('0x2a')][_0x8a88('0x40')](_0x208756);})[_0x8a88('0x24')](function(_0x50ed4c){_0x29fb6d[_0x8a88('0x41')]=_0x50ed4c;return _0x29fb6d;})[_0x8a88('0x24')](respondWithFilteredResult(_0xaa835a,_0x208756))[_0x8a88('0x42')](handleError(_0xaa835a,null));};exports[_0x8a88('0x43')]=function(_0x398106,_0x428007){var _0x22d411={'raw':![],'where':{'id':_0x398106[_0x8a88('0x44')]['id']}},_0x4f56ab={};_0x4f56ab[_0x8a88('0x2d')]=_[_0x8a88('0x45')](db['AnalyticFieldReport'][_0x8a88('0x46')]);_0x4f56ab[_0x8a88('0x2e')]=_[_0x8a88('0x45')](_0x398106['query']);_0x4f56ab['filters']=_[_0x8a88('0x30')](_0x4f56ab[_0x8a88('0x2d')],_0x4f56ab['query']);_0x22d411[_0x8a88('0x2f')]=_[_0x8a88('0x30')](_0x4f56ab['model'],qs[_0x8a88('0x31')](_0x398106['query'][_0x8a88('0x31')]));_0x22d411[_0x8a88('0x2f')]=_0x22d411[_0x8a88('0x2f')][_0x8a88('0x32')]?_0x22d411[_0x8a88('0x2f')]:_0x4f56ab['model'];if(_0x398106[_0x8a88('0x2e')][_0x8a88('0x3e')]){_0x22d411['include']=[{'all':!![]}];}_0x22d411=_[_0x8a88('0x3a')]({},_0x22d411,_0x398106[_0x8a88('0x3b')]);return db[_0x8a88('0x2a')][_0x8a88('0x47')](_0x22d411)[_0x8a88('0x24')](handleEntityNotFound(_0x428007,null))[_0x8a88('0x24')](respondWithResult(_0x428007,null))[_0x8a88('0x42')](handleError(_0x428007,null));};exports[_0x8a88('0x48')]=function(_0x45d00c,_0x26d756){return db['AnalyticFieldReport'][_0x8a88('0x48')](_0x45d00c[_0x8a88('0x49')],{})[_0x8a88('0x24')](respondWithResult(_0x26d756,0xc9))['catch'](handleError(_0x26d756,null));};exports[_0x8a88('0x4a')]=function(_0x7a1ee0,_0x4181e6){return db[_0x8a88('0x2a')]['bulkCreate'](_0x7a1ee0['body'],{'raw':![],'individualHooks':!![]})[_0x8a88('0x24')](respondWithResult(_0x4181e6,0xc9))[_0x8a88('0x42')](handleError(_0x4181e6,null));};exports[_0x8a88('0x23')]=function(_0x312111,_0x425a3a){if(_0x312111[_0x8a88('0x49')]['id']){delete _0x312111[_0x8a88('0x49')]['id'];}return db['AnalyticFieldReport'][_0x8a88('0x47')]({'where':{'id':_0x312111[_0x8a88('0x44')]['id']}})[_0x8a88('0x24')](handleEntityNotFound(_0x425a3a,null))['then'](saveUpdates(_0x312111['body'],null))[_0x8a88('0x24')](respondWithResult(_0x425a3a,null))[_0x8a88('0x42')](handleError(_0x425a3a,null));};exports[_0x8a88('0x25')]=function(_0x3c2427,_0x391f2f){return db[_0x8a88('0x2a')][_0x8a88('0x47')]({'where':{'id':_0x3c2427[_0x8a88('0x44')]['id']}})[_0x8a88('0x24')](handleEntityNotFound(_0x391f2f,null))[_0x8a88('0x24')](removeEntity(_0x391f2f,null))[_0x8a88('0x42')](handleError(_0x391f2f,null));};exports[_0x8a88('0x4b')]=function(_0x197a30,_0x1109a1){return db[_0x8a88('0x2a')]['destroy']({'where':{'id':_0x197a30['query'][_0x8a88('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0x8a88('0x24')](respondWithResult(_0x1109a1,0xcc))[_0x8a88('0x42')](handleError(_0x1109a1,null));};exports['addFields']=function(_0x4a1e22,_0x13a2c8,_0x2a34c6){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x4a1e22[_0x8a88('0x44')]['id']}})[_0x8a88('0x24')](handleEntityNotFound(_0x13a2c8,null))[_0x8a88('0x24')](function(_0x4603ff){if(_0x4603ff){return db[_0x8a88('0x4d')][_0x8a88('0x4e')](function(_0x433193){return db[_0x8a88('0x2a')][_0x8a88('0x25')]({'where':{'CustomReportId':_0x4a1e22['params']['id']},'transaction':_0x433193})[_0x8a88('0x24')](function(_0x7ef518){var _0x14be9e=_[_0x8a88('0x29')](_0x4a1e22['body'],function(_0x44dcde){delete _0x44dcde['id'];_0x44dcde['CustomReportId']=_0x4a1e22['params']['id'];return _0x44dcde;});return db[_0x8a88('0x2a')]['bulkCreate'](_0x14be9e,{'transaction':_0x433193});});})[_0x8a88('0x24')](function(){return db['AnalyticFieldReport'][_0x8a88('0x40')]({'where':{'CustomReportId':_0x4a1e22['params']['id']}});});}})[_0x8a88('0x24')](respondWithResult(_0x13a2c8,null))[_0x8a88('0x42')](handleError(_0x13a2c8,null));}; \ No newline at end of file +var _0xe8d6=['hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','bulkCreate','body','destroy','bulkDestroy','addFields','AnalyticCustomReport','sequelize','transaction','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','json','apply','reject','save','update','then','error','stack','name','send','index','AnalyticFieldReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields'];(function(_0x5cc118,_0x479136){var _0x87ff2b=function(_0x2e3aa7){while(--_0x2e3aa7){_0x5cc118['push'](_0x5cc118['shift']());}};_0x87ff2b(++_0x479136);}(_0xe8d6,0x107));var _0x6e8d=function(_0x48f511,_0x41ce70){_0x48f511=_0x48f511-0x0;var _0x15766a=_0xe8d6[_0x48f511];return _0x15766a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6e8d('0x0'));var zipdir=require(_0x6e8d('0x1'));var jsonpatch=require(_0x6e8d('0x2'));var rp=require('request-promise');var moment=require(_0x6e8d('0x3'));var BPromise=require(_0x6e8d('0x4'));var Mustache=require(_0x6e8d('0x5'));var util=require('util');var path=require(_0x6e8d('0x6'));var sox=require(_0x6e8d('0x7'));var csv=require(_0x6e8d('0x8'));var ejs=require(_0x6e8d('0x9'));var fs=require('fs');var fs_extra=require(_0x6e8d('0xa'));var _=require(_0x6e8d('0xb'));var squel=require(_0x6e8d('0xc'));var crypto=require(_0x6e8d('0xd'));var jsforce=require(_0x6e8d('0xe'));var deskjs=require(_0x6e8d('0xf'));var toCsv=require(_0x6e8d('0x8'));var querystring=require(_0x6e8d('0x10'));var Papa=require('papaparse');var Redis=require(_0x6e8d('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e8d('0x12'));var logger=require(_0x6e8d('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x6e8d('0x14'));var licenseUtil=require(_0x6e8d('0x15'));var db=require(_0x6e8d('0x16'))['db'];function respondWithStatusCode(_0x5c3170,_0x19f571){_0x19f571=_0x19f571||0xcc;return function(_0x13b15f){if(_0x13b15f){return _0x5c3170[_0x6e8d('0x17')](_0x19f571);}return _0x5c3170[_0x6e8d('0x18')](_0x19f571)['end']();};}function respondWithResult(_0x2e2fbc,_0x4f6c79){_0x4f6c79=_0x4f6c79||0xc8;return function(_0x2a725f){if(_0x2a725f){return _0x2e2fbc['status'](_0x4f6c79)['json'](_0x2a725f);}};}function respondWithFilteredResult(_0x4bbeef,_0x3a3aa9){return function(_0x396a56){if(_0x396a56){var _0x4c763a=typeof _0x3a3aa9['offset']===_0x6e8d('0x19')&&typeof _0x3a3aa9[_0x6e8d('0x1a')]===_0x6e8d('0x19');var _0x2390a9=_0x396a56[_0x6e8d('0x1b')];var _0x342815=_0x4c763a?0x0:_0x3a3aa9[_0x6e8d('0x1c')];var _0x133831=_0x4c763a?_0x396a56[_0x6e8d('0x1b')]:_0x3a3aa9[_0x6e8d('0x1c')]+_0x3a3aa9[_0x6e8d('0x1a')];var _0x1fb90b;if(_0x133831>=_0x2390a9){_0x133831=_0x2390a9;_0x1fb90b=0xc8;}else{_0x1fb90b=0xce;}_0x4bbeef[_0x6e8d('0x18')](_0x1fb90b);return _0x4bbeef['set']('Content-Range',_0x342815+'-'+_0x133831+'/'+_0x2390a9)[_0x6e8d('0x1d')](_0x396a56);}return null;};}function patchUpdates(_0x494898){return function(_0xa6a6c3){try{jsonpatch[_0x6e8d('0x1e')](_0xa6a6c3,_0x494898,!![]);}catch(_0x32d65f){return BPromise[_0x6e8d('0x1f')](_0x32d65f);}return _0xa6a6c3[_0x6e8d('0x20')]();};}function saveUpdates(_0x443a83,_0x20836e){return function(_0x5a6476){if(_0x5a6476){return _0x5a6476[_0x6e8d('0x21')](_0x443a83)[_0x6e8d('0x22')](function(_0x46edbd){return _0x46edbd;});}return null;};}function removeEntity(_0x10c508,_0x1d68ce){return function(_0x3ea954){if(_0x3ea954){return _0x3ea954['destroy']()[_0x6e8d('0x22')](function(){_0x10c508['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b7872,_0x3b324){return function(_0x1ad602){if(!_0x1ad602){_0x5b7872['sendStatus'](0x194);}return _0x1ad602;};}function handleError(_0x49c468,_0x2b9094){_0x2b9094=_0x2b9094||0x1f4;return function(_0x43d443){logger[_0x6e8d('0x23')](_0x43d443[_0x6e8d('0x24')]);if(_0x43d443['name']){delete _0x43d443[_0x6e8d('0x25')];}_0x49c468[_0x6e8d('0x18')](_0x2b9094)[_0x6e8d('0x26')](_0x43d443);};}exports[_0x6e8d('0x27')]=function(_0x657e7d,_0x419f9a){var _0xd0a6b7={},_0x5383b3={},_0xfe2b17={'count':0x0,'rows':[]};var _0x3f4a50=_['map'](db[_0x6e8d('0x28')][_0x6e8d('0x29')],function(_0x4a6116){return{'name':_0x4a6116[_0x6e8d('0x2a')],'type':_0x4a6116[_0x6e8d('0x2b')][_0x6e8d('0x2c')]};});_0x5383b3['model']=_[_0x6e8d('0x2d')](_0x3f4a50,_0x6e8d('0x25'));_0x5383b3[_0x6e8d('0x2e')]=_[_0x6e8d('0x2f')](_0x657e7d[_0x6e8d('0x2e')]);_0x5383b3[_0x6e8d('0x30')]=_[_0x6e8d('0x31')](_0x5383b3[_0x6e8d('0x32')],_0x5383b3[_0x6e8d('0x2e')]);_0xd0a6b7[_0x6e8d('0x33')]=_[_0x6e8d('0x31')](_0x5383b3[_0x6e8d('0x32')],qs['fields'](_0x657e7d['query'][_0x6e8d('0x34')]));_0xd0a6b7[_0x6e8d('0x33')]=_0xd0a6b7['attributes']['length']?_0xd0a6b7[_0x6e8d('0x33')]:_0x5383b3['model'];if(!_0x657e7d[_0x6e8d('0x2e')][_0x6e8d('0x35')]('nolimit')){_0xd0a6b7['limit']=qs[_0x6e8d('0x1a')](_0x657e7d[_0x6e8d('0x2e')]['limit']);_0xd0a6b7[_0x6e8d('0x1c')]=qs[_0x6e8d('0x1c')](_0x657e7d['query']['offset']);}_0xd0a6b7[_0x6e8d('0x36')]=qs[_0x6e8d('0x37')](_0x657e7d[_0x6e8d('0x2e')][_0x6e8d('0x37')]);_0xd0a6b7[_0x6e8d('0x38')]=qs[_0x6e8d('0x30')](_[_0x6e8d('0x39')](_0x657e7d[_0x6e8d('0x2e')],_0x5383b3['filters']),_0x3f4a50);if(_0x657e7d[_0x6e8d('0x2e')][_0x6e8d('0x3a')]){_0xd0a6b7[_0x6e8d('0x38')]=_[_0x6e8d('0x3b')](_0xd0a6b7['where'],{'$or':_[_0x6e8d('0x2d')](_0x3f4a50,function(_0x2ad437){if(_0x2ad437['type']!==_0x6e8d('0x3c')){var _0x24fd41={};_0x24fd41[_0x2ad437[_0x6e8d('0x25')]]={'$like':'%'+_0x657e7d['query'][_0x6e8d('0x3a')]+'%'};return _0x24fd41;}})});}_0xd0a6b7=_[_0x6e8d('0x3b')]({},_0xd0a6b7,_0x657e7d[_0x6e8d('0x3d')]);var _0x4cce69={'where':_0xd0a6b7[_0x6e8d('0x38')]};return db[_0x6e8d('0x28')]['count'](_0x4cce69)[_0x6e8d('0x22')](function(_0xefa446){_0xfe2b17[_0x6e8d('0x1b')]=_0xefa446;if(_0x657e7d['query'][_0x6e8d('0x3e')]){_0xd0a6b7[_0x6e8d('0x3f')]=[{'all':!![]}];}return db['AnalyticFieldReport']['findAll'](_0xd0a6b7);})[_0x6e8d('0x22')](function(_0x1c97e7){_0xfe2b17[_0x6e8d('0x40')]=_0x1c97e7;return _0xfe2b17;})[_0x6e8d('0x22')](respondWithFilteredResult(_0x419f9a,_0xd0a6b7))[_0x6e8d('0x41')](handleError(_0x419f9a,null));};exports[_0x6e8d('0x42')]=function(_0x2f4775,_0x11649a){var _0xb73100={'raw':![],'where':{'id':_0x2f4775[_0x6e8d('0x43')]['id']}},_0x31f738={};_0x31f738[_0x6e8d('0x32')]=_['keys'](db[_0x6e8d('0x28')]['rawAttributes']);_0x31f738[_0x6e8d('0x2e')]=_[_0x6e8d('0x2f')](_0x2f4775[_0x6e8d('0x2e')]);_0x31f738[_0x6e8d('0x30')]=_['intersection'](_0x31f738['model'],_0x31f738[_0x6e8d('0x2e')]);_0xb73100[_0x6e8d('0x33')]=_['intersection'](_0x31f738['model'],qs['fields'](_0x2f4775[_0x6e8d('0x2e')]['fields']));_0xb73100[_0x6e8d('0x33')]=_0xb73100[_0x6e8d('0x33')][_0x6e8d('0x44')]?_0xb73100[_0x6e8d('0x33')]:_0x31f738[_0x6e8d('0x32')];if(_0x2f4775['query'][_0x6e8d('0x3e')]){_0xb73100[_0x6e8d('0x3f')]=[{'all':!![]}];}_0xb73100=_['merge']({},_0xb73100,_0x2f4775['options']);return db[_0x6e8d('0x28')][_0x6e8d('0x45')](_0xb73100)[_0x6e8d('0x22')](handleEntityNotFound(_0x11649a,null))[_0x6e8d('0x22')](respondWithResult(_0x11649a,null))['catch'](handleError(_0x11649a,null));};exports[_0x6e8d('0x46')]=function(_0x29599a,_0x400a9){return db[_0x6e8d('0x28')][_0x6e8d('0x46')](_0x29599a['body'],{})[_0x6e8d('0x22')](respondWithResult(_0x400a9,0xc9))[_0x6e8d('0x41')](handleError(_0x400a9,null));};exports[_0x6e8d('0x47')]=function(_0x4e50b0,_0x5ecfc0){return db[_0x6e8d('0x28')][_0x6e8d('0x47')](_0x4e50b0[_0x6e8d('0x48')],{'raw':![],'individualHooks':!![]})[_0x6e8d('0x22')](respondWithResult(_0x5ecfc0,0xc9))[_0x6e8d('0x41')](handleError(_0x5ecfc0,null));};exports[_0x6e8d('0x21')]=function(_0x382cce,_0x298694){if(_0x382cce[_0x6e8d('0x48')]['id']){delete _0x382cce[_0x6e8d('0x48')]['id'];}return db[_0x6e8d('0x28')][_0x6e8d('0x45')]({'where':{'id':_0x382cce['params']['id']}})[_0x6e8d('0x22')](handleEntityNotFound(_0x298694,null))['then'](saveUpdates(_0x382cce['body'],null))[_0x6e8d('0x22')](respondWithResult(_0x298694,null))[_0x6e8d('0x41')](handleError(_0x298694,null));};exports[_0x6e8d('0x49')]=function(_0x1bf12b,_0x154b0f){return db[_0x6e8d('0x28')][_0x6e8d('0x45')]({'where':{'id':_0x1bf12b['params']['id']}})[_0x6e8d('0x22')](handleEntityNotFound(_0x154b0f,null))[_0x6e8d('0x22')](removeEntity(_0x154b0f,null))[_0x6e8d('0x41')](handleError(_0x154b0f,null));};exports[_0x6e8d('0x4a')]=function(_0x270585,_0xc1f84e){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x270585[_0x6e8d('0x2e')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x6e8d('0x22')](respondWithResult(_0xc1f84e,0xcc))[_0x6e8d('0x41')](handleError(_0xc1f84e,null));};exports[_0x6e8d('0x4b')]=function(_0x2ca493,_0x486cec,_0x2265a9){return db[_0x6e8d('0x4c')]['findOne']({'where':{'id':_0x2ca493[_0x6e8d('0x43')]['id']}})[_0x6e8d('0x22')](handleEntityNotFound(_0x486cec,null))[_0x6e8d('0x22')](function(_0x343cf2){if(_0x343cf2){return db[_0x6e8d('0x4d')][_0x6e8d('0x4e')](function(_0x194bc4){return db[_0x6e8d('0x28')][_0x6e8d('0x49')]({'where':{'CustomReportId':_0x2ca493[_0x6e8d('0x43')]['id']},'transaction':_0x194bc4})[_0x6e8d('0x22')](function(_0x585457){var _0x98cca4=_[_0x6e8d('0x2d')](_0x2ca493['body'],function(_0x51650b){delete _0x51650b['id'];_0x51650b['CustomReportId']=_0x2ca493[_0x6e8d('0x43')]['id'];return _0x51650b;});return db[_0x6e8d('0x28')]['bulkCreate'](_0x98cca4,{'transaction':_0x194bc4});});})[_0x6e8d('0x22')](function(){return db[_0x6e8d('0x28')]['findAll']({'where':{'CustomReportId':_0x2ca493[_0x6e8d('0x43')]['id']}});});}})['then'](respondWithResult(_0x486cec,null))[_0x6e8d('0x41')](handleError(_0x486cec,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 2bad302..191c81e 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 _0xefcd=['path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3306ce,_0xcda6ce){var _0x21af4a=function(_0x24b574){while(--_0x24b574){_0x3306ce['push'](_0x3306ce['shift']());}};_0x21af4a(++_0xcda6ce);}(_0xefcd,0x1f3));var _0xdefc=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xefcd[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0xdefc('0x0'));var logger=require(_0xdefc('0x1'))('api');var moment=require(_0xdefc('0x2'));var BPromise=require(_0xdefc('0x3'));var rp=require(_0xdefc('0x4'));var fs=require('fs');var path=require(_0xdefc('0x5'));var rimraf=require(_0xdefc('0x6'));var config=require(_0xdefc('0x7'));var attributes=require(_0xdefc('0x8'));module[_0xdefc('0x9')]=function(_0x1484f5,_0x492af3){return _0x1484f5['define'](_0xdefc('0xa'),attributes,{'tableName':_0xdefc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x340e=['rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','analytics_report_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3c8654,_0x3e23ac){var _0x50f0b8=function(_0xd90314){while(--_0xd90314){_0x3c8654['push'](_0x3c8654['shift']());}};_0x50f0b8(++_0x3e23ac);}(_0x340e,0x102));var _0xe340=function(_0x150f60,_0x59ace3){_0x150f60=_0x150f60-0x0;var _0x241c02=_0x340e[_0x150f60];return _0x241c02;};'use strict';var _=require(_0xe340('0x0'));var util=require(_0xe340('0x1'));var logger=require(_0xe340('0x2'))(_0xe340('0x3'));var moment=require(_0xe340('0x4'));var BPromise=require(_0xe340('0x5'));var rp=require(_0xe340('0x6'));var fs=require('fs');var path=require(_0xe340('0x7'));var rimraf=require(_0xe340('0x8'));var config=require(_0xe340('0x9'));var attributes=require(_0xe340('0xa'));module[_0xe340('0xb')]=function(_0x1b0efa,_0x22abda){return _0x1b0efa[_0xe340('0xc')]('AnalyticFieldReport',attributes,{'tableName':_0xe340('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 849c6a4..4c9dbea 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 _0xf8e4=['request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf8e4,0xf2));var _0x4f8e=function(_0x4179e2,_0xf2dbb){_0x4179e2=_0x4179e2-0x0;var _0x24cb50=_0xf8e4[_0x4179e2];return _0x24cb50;};'use strict';var _=require(_0x4f8e('0x0'));var util=require(_0x4f8e('0x1'));var moment=require(_0x4f8e('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f8e('0x3'));var fs=require('fs');var Redis=require(_0x4f8e('0x4'));var db=require(_0x4f8e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4f8e('0x6'));var config=require(_0x4f8e('0x7'));var jayson=require(_0x4f8e('0x8'));var client=jayson[_0x4f8e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e274,_0x41f881,_0x3b7803){return new BPromise(function(_0x4dc0ae,_0x20afaf){return client[_0x4f8e('0xa')](_0x56e274,_0x3b7803)['then'](function(_0x3c6cc5){logger[_0x4f8e('0xb')](_0x4f8e('0xc'),_0x41f881,_0x4f8e('0xd'));logger[_0x4f8e('0xe')](_0x4f8e('0xf'),_0x41f881,_0x4f8e('0xd'),JSON[_0x4f8e('0x10')](_0x3c6cc5));if(_0x3c6cc5['error']){if(_0x3c6cc5[_0x4f8e('0x11')][_0x4f8e('0x12')]===0x1f4){logger['error'](_0x4f8e('0xc'),_0x41f881,_0x3c6cc5[_0x4f8e('0x11')][_0x4f8e('0x13')]);return _0x20afaf(_0x3c6cc5[_0x4f8e('0x11')][_0x4f8e('0x13')]);}logger[_0x4f8e('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x41f881,_0x3c6cc5['error']['message']);return _0x4dc0ae(_0x3c6cc5[_0x4f8e('0x11')][_0x4f8e('0x13')]);}else{logger['info'](_0x4f8e('0xc'),_0x41f881,_0x4f8e('0xd'));_0x4dc0ae(_0x3c6cc5[_0x4f8e('0x14')][_0x4f8e('0x13')]);}})['catch'](function(_0x1c00f7){logger[_0x4f8e('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x41f881,_0x1c00f7);_0x20afaf(_0x1c00f7);});});} \ No newline at end of file +var _0x4eb8=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x2ec26a,_0x70bd9d){var _0x204b56=function(_0x58e3ef){while(--_0x58e3ef){_0x2ec26a['push'](_0x2ec26a['shift']());}};_0x204b56(++_0x70bd9d);}(_0x4eb8,0x1b5));var _0x84eb=function(_0x3eb713,_0x437874){_0x3eb713=_0x3eb713-0x0;var _0x1d7128=_0x4eb8[_0x3eb713];return _0x1d7128;};'use strict';var _=require(_0x84eb('0x0'));var util=require(_0x84eb('0x1'));var moment=require(_0x84eb('0x2'));var BPromise=require(_0x84eb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x84eb('0x4'));var db=require(_0x84eb('0x5'))['db'];var utils=require(_0x84eb('0x6'));var logger=require(_0x84eb('0x7'))(_0x84eb('0x8'));var config=require(_0x84eb('0x9'));var jayson=require(_0x84eb('0xa'));var client=jayson[_0x84eb('0xb')][_0x84eb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x594e38,_0x131076,_0x37d9e6){return new BPromise(function(_0x12b996,_0xb3d36c){return client[_0x84eb('0xd')](_0x594e38,_0x37d9e6)[_0x84eb('0xe')](function(_0xf85549){logger[_0x84eb('0xf')](_0x84eb('0x10'),_0x131076,'request\x20sent');logger[_0x84eb('0x11')](_0x84eb('0x12'),_0x131076,_0x84eb('0x13'),JSON[_0x84eb('0x14')](_0xf85549));if(_0xf85549['error']){if(_0xf85549[_0x84eb('0x15')][_0x84eb('0x16')]===0x1f4){logger[_0x84eb('0x15')](_0x84eb('0x10'),_0x131076,_0xf85549[_0x84eb('0x15')]['message']);return _0xb3d36c(_0xf85549[_0x84eb('0x15')][_0x84eb('0x17')]);}logger[_0x84eb('0x15')](_0x84eb('0x10'),_0x131076,_0xf85549[_0x84eb('0x15')][_0x84eb('0x17')]);return _0x12b996(_0xf85549[_0x84eb('0x15')][_0x84eb('0x17')]);}else{logger[_0x84eb('0xf')](_0x84eb('0x10'),_0x131076,_0x84eb('0x13'));_0x12b996(_0xf85549[_0x84eb('0x18')]['message']);}})[_0x84eb('0x19')](function(_0x1dcafc){logger[_0x84eb('0x15')](_0x84eb('0x10'),_0x131076,_0x1dcafc);_0xb3d36c(_0x1dcafc);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 569ab58..a62107c 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(_0x46eed5,_0x607464){var _0x914677=function(_0x811732){while(--_0x811732){_0x46eed5['push'](_0x46eed5['shift']());}};_0x914677(++_0x607464);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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(_0x4eb2b8,_0x1e93f2){var _0x5da0ff=function(_0x433a22){while(--_0x433a22){_0x4eb2b8['push'](_0x4eb2b8['shift']());}};_0x5da0ff(++_0x1e93f2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index fdbfba4..0af6127 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 _0x153f=['name','TEXT','sequelize','exports','STRING'];(function(_0x15a190,_0x388b0e){var _0x4d0e8f=function(_0x463477){while(--_0x463477){_0x15a190['push'](_0x15a190['shift']());}};_0x4d0e8f(++_0x388b0e);}(_0x153f,0x15b));var _0xf153=function(_0x4fc3e7,_0x2f9b1e){_0x4fc3e7=_0x4fc3e7-0x0;var _0x1c6a9d=_0x153f[_0x4fc3e7];return _0x1c6a9d;};'use strict';var Sequelize=require(_0xf153('0x0'));module[_0xf153('0x1')]={'name':{'type':Sequelize[_0xf153('0x2')],'allowNull':![],'unique':_0xf153('0x3')},'table':{'type':Sequelize[_0xf153('0x2')]},'metric':{'type':Sequelize[_0xf153('0x4')]},'description':{'type':Sequelize[_0xf153('0x2')]}}; \ No newline at end of file +var _0x205d=['STRING','TEXT','sequelize','exports'];(function(_0x2fe611,_0x259389){var _0x1d26fd=function(_0x48fa34){while(--_0x48fa34){_0x2fe611['push'](_0x2fe611['shift']());}};_0x1d26fd(++_0x259389);}(_0x205d,0xf6));var _0xd205=function(_0x206adf,_0x2ba1a3){_0x206adf=_0x206adf-0x0;var _0x171caa=_0x205d[_0x206adf];return _0x171caa;};'use strict';var Sequelize=require(_0xd205('0x0'));module[_0xd205('0x1')]={'name':{'type':Sequelize[_0xd205('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xd205('0x3')]},'description':{'type':Sequelize[_0xd205('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 509d825..235bfab 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 _0xe5b3=['undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x3d06,_0xafae0d){var _0xa8a51=function(_0x54c83b){while(--_0x54c83b){_0x3d06['push'](_0x3d06['shift']());}};_0xa8a51(++_0xafae0d);}(_0xe5b3,0x133));var _0x3e5b=function(_0x52f4d2,_0x2b0805){_0x52f4d2=_0x52f4d2-0x0;var _0x57cce5=_0xe5b3[_0x52f4d2];return _0x57cce5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];function respondWithStatusCode(_0x374068,_0x20b97b){_0x20b97b=_0x20b97b||0xcc;return function(_0x3c4eb1){if(_0x3c4eb1){return _0x374068[_0x3e5b('0x19')](_0x20b97b);}return _0x374068['status'](_0x20b97b)[_0x3e5b('0x1a')]();};}function respondWithResult(_0x5f2f9c,_0x51a188){_0x51a188=_0x51a188||0xc8;return function(_0x4d71a3){if(_0x4d71a3){return _0x5f2f9c[_0x3e5b('0x1b')](_0x51a188)[_0x3e5b('0x1c')](_0x4d71a3);}};}function respondWithFilteredResult(_0x17aaa3,_0x4fb471){return function(_0x1f81a7){if(_0x1f81a7){var _0x59ddc0=typeof _0x4fb471['offset']===_0x3e5b('0x1d')&&typeof _0x4fb471[_0x3e5b('0x1e')]==='undefined';var _0x3d58a4=_0x1f81a7[_0x3e5b('0x1f')];var _0x555002=_0x59ddc0?0x0:_0x4fb471[_0x3e5b('0x20')];var _0x3365dd=_0x59ddc0?_0x1f81a7['count']:_0x4fb471['offset']+_0x4fb471[_0x3e5b('0x1e')];var _0x20806a;if(_0x3365dd>=_0x3d58a4){_0x3365dd=_0x3d58a4;_0x20806a=0xc8;}else{_0x20806a=0xce;}_0x17aaa3[_0x3e5b('0x1b')](_0x20806a);return _0x17aaa3[_0x3e5b('0x21')](_0x3e5b('0x22'),_0x555002+'-'+_0x3365dd+'/'+_0x3d58a4)[_0x3e5b('0x1c')](_0x1f81a7);}return null;};}function patchUpdates(_0x447d36){return function(_0x21fc32){try{jsonpatch[_0x3e5b('0x23')](_0x21fc32,_0x447d36,!![]);}catch(_0x3d95f3){return BPromise[_0x3e5b('0x24')](_0x3d95f3);}return _0x21fc32[_0x3e5b('0x25')]();};}function saveUpdates(_0x2d77cc,_0x402873){return function(_0x5b46d4){if(_0x5b46d4){return _0x5b46d4[_0x3e5b('0x26')](_0x2d77cc)[_0x3e5b('0x27')](function(_0x2146d4){return _0x2146d4;});}return null;};}function removeEntity(_0x150674,_0x50039b){return function(_0x1eb80f){if(_0x1eb80f){return _0x1eb80f['destroy']()[_0x3e5b('0x27')](function(){var _0x36d960=_0x1eb80f['get']({'plain':!![]});var _0x41b684=_0x3e5b('0x28');return db[_0x3e5b('0x29')][_0x3e5b('0x2a')]({'where':{'type':_0x41b684,'resourceId':_0x36d960['id']}})[_0x3e5b('0x27')](function(){return _0x1eb80f;});})[_0x3e5b('0x27')](function(){_0x150674[_0x3e5b('0x1b')](0xcc)[_0x3e5b('0x1a')]();});}};}function handleEntityNotFound(_0x4c4b89,_0x1c7278){return function(_0x505f40){if(!_0x505f40){_0x4c4b89[_0x3e5b('0x19')](0x194);}return _0x505f40;};}function handleError(_0x4fd64b,_0x101653){_0x101653=_0x101653||0x1f4;return function(_0x1f6473){logger[_0x3e5b('0x2b')](_0x1f6473[_0x3e5b('0x2c')]);if(_0x1f6473[_0x3e5b('0x2d')]){delete _0x1f6473[_0x3e5b('0x2d')];}_0x4fd64b[_0x3e5b('0x1b')](_0x101653)[_0x3e5b('0x2e')](_0x1f6473);};}exports[_0x3e5b('0x2f')]=function(_0x112dc0,_0x1e1565){var _0x489221={},_0x21bc10={},_0x1882aa={'count':0x0,'rows':[]};var _0xa8760b=_[_0x3e5b('0x30')](db[_0x3e5b('0x31')][_0x3e5b('0x32')],function(_0x345927){return{'name':_0x345927['fieldName'],'type':_0x345927[_0x3e5b('0x33')]['key']};});_0x21bc10['model']=_[_0x3e5b('0x30')](_0xa8760b,_0x3e5b('0x2d'));_0x21bc10['query']=_[_0x3e5b('0x34')](_0x112dc0[_0x3e5b('0x35')]);_0x21bc10[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],_0x21bc10[_0x3e5b('0x35')]);_0x489221[_0x3e5b('0x39')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],qs[_0x3e5b('0x3a')](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x489221['attributes']=_0x489221[_0x3e5b('0x39')][_0x3e5b('0x3b')]?_0x489221['attributes']:_0x21bc10['model'];if(!_0x112dc0[_0x3e5b('0x35')]['hasOwnProperty'](_0x3e5b('0x3c'))){_0x489221[_0x3e5b('0x1e')]=qs[_0x3e5b('0x1e')](_0x112dc0[_0x3e5b('0x35')]['limit']);_0x489221[_0x3e5b('0x20')]=qs['offset'](_0x112dc0[_0x3e5b('0x35')]['offset']);}_0x489221['order']=qs['sort'](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3d')]);_0x489221[_0x3e5b('0x3e')]=qs[_0x3e5b('0x36')](_[_0x3e5b('0x3f')](_0x112dc0[_0x3e5b('0x35')],_0x21bc10['filters']),_0xa8760b);if(_0x112dc0['query']['filter']){_0x489221['where']=_['merge'](_0x489221['where'],{'$or':_['map'](_0xa8760b,function(_0x182bc4){if(_0x182bc4[_0x3e5b('0x33')]!==_0x3e5b('0x40')){var _0x1aafd5={};_0x1aafd5[_0x182bc4[_0x3e5b('0x2d')]]={'$like':'%'+_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x41')]+'%'};return _0x1aafd5;}})});}_0x489221=_[_0x3e5b('0x42')]({},_0x489221,_0x112dc0[_0x3e5b('0x43')]);var _0xbbc6b={'where':_0x489221[_0x3e5b('0x3e')]};return db['AnalyticMetric'][_0x3e5b('0x1f')](_0xbbc6b)[_0x3e5b('0x27')](function(_0x1e8075){_0x1882aa[_0x3e5b('0x1f')]=_0x1e8075;if(_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x44')]){_0x489221[_0x3e5b('0x45')]=[{'all':!![]}];}return db[_0x3e5b('0x31')][_0x3e5b('0x46')](_0x489221);})[_0x3e5b('0x27')](function(_0x13c8d5){_0x1882aa['rows']=_0x13c8d5;return _0x1882aa;})['then'](respondWithFilteredResult(_0x1e1565,_0x489221))['catch'](handleError(_0x1e1565,null));};exports['show']=function(_0xa99d75,_0x21ee8a){var _0x9fc025={'raw':!![],'where':{'id':_0xa99d75[_0x3e5b('0x47')]['id']}},_0x24c416={};_0x24c416[_0x3e5b('0x38')]=_[_0x3e5b('0x34')](db[_0x3e5b('0x31')][_0x3e5b('0x32')]);_0x24c416[_0x3e5b('0x35')]=_['keys'](_0xa99d75[_0x3e5b('0x35')]);_0x24c416[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x24c416[_0x3e5b('0x38')],_0x24c416[_0x3e5b('0x35')]);_0x9fc025['attributes']=_['intersection'](_0x24c416['model'],qs[_0x3e5b('0x3a')](_0xa99d75[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x9fc025['attributes']=_0x9fc025['attributes'][_0x3e5b('0x3b')]?_0x9fc025[_0x3e5b('0x39')]:_0x24c416[_0x3e5b('0x38')];if(_0xa99d75['query']['includeAll']){_0x9fc025[_0x3e5b('0x45')]=[{'all':!![]}];}_0x9fc025=_['merge']({},_0x9fc025,_0xa99d75[_0x3e5b('0x43')]);return db[_0x3e5b('0x31')][_0x3e5b('0x48')](_0x9fc025)[_0x3e5b('0x27')](handleEntityNotFound(_0x21ee8a,null))[_0x3e5b('0x27')](respondWithResult(_0x21ee8a,null))[_0x3e5b('0x49')](handleError(_0x21ee8a,null));};exports[_0x3e5b('0x4a')]=function(_0x3ea5aa,_0x339852){return db['AnalyticMetric'][_0x3e5b('0x4a')](_0x3ea5aa['body'],{})[_0x3e5b('0x27')](function(_0x2e7047){var _0x26e11e=_0x3ea5aa[_0x3e5b('0x4b')][_0x3e5b('0x4c')]({'plain':!![]});if(!_0x26e11e)throw new Error(_0x3e5b('0x4d'));if(_0x26e11e[_0x3e5b('0x4e')]===_0x3e5b('0x4b')){var _0x2b5d3d=_0x2e7047[_0x3e5b('0x4c')]({'plain':!![]});var _0xf6ca5b=_0x3e5b('0x28');return db[_0x3e5b('0x4f')]['find']({'where':{'name':_0xf6ca5b,'userProfileId':_0x26e11e[_0x3e5b('0x50')]},'raw':!![]})[_0x3e5b('0x27')](function(_0x2ca33b){if(_0x2ca33b&&_0x2ca33b[_0x3e5b('0x51')]===0x0){return db[_0x3e5b('0x29')][_0x3e5b('0x4a')]({'name':_0x2b5d3d['name'],'resourceId':_0x2b5d3d['id'],'type':_0x2ca33b[_0x3e5b('0x2d')],'sectionId':_0x2ca33b['id']},{})[_0x3e5b('0x27')](function(){return _0x2e7047;});}else{return _0x2e7047;}})[_0x3e5b('0x49')](function(_0x314d42){logger[_0x3e5b('0x2b')](_0x3e5b('0x52'),_0x314d42);throw _0x314d42;});}return _0x2e7047;})[_0x3e5b('0x27')](respondWithResult(_0x339852,0xc9))[_0x3e5b('0x49')](handleError(_0x339852,null));};exports['update']=function(_0x1e6403,_0x5e702f){if(_0x1e6403['body']['id']){delete _0x1e6403[_0x3e5b('0x53')]['id'];}return db['AnalyticMetric'][_0x3e5b('0x48')]({'where':{'id':_0x1e6403[_0x3e5b('0x47')]['id']}})[_0x3e5b('0x27')](handleEntityNotFound(_0x5e702f,null))[_0x3e5b('0x27')](saveUpdates(_0x1e6403['body'],null))['then'](respondWithResult(_0x5e702f,null))['catch'](handleError(_0x5e702f,null));};exports['destroy']=function(_0x2ab5f3,_0x999518){return db[_0x3e5b('0x31')][_0x3e5b('0x48')]({'where':{'id':_0x2ab5f3[_0x3e5b('0x47')]['id']}})['then'](handleEntityNotFound(_0x999518,null))['then'](removeEntity(_0x999518,null))[_0x3e5b('0x49')](handleError(_0x999518,null));}; \ No newline at end of file +var _0x5fc3=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','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','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','merge','create','body'];(function(_0x338122,_0x17322e){var _0x4e3846=function(_0x2c70b9){while(--_0x2c70b9){_0x338122['push'](_0x338122['shift']());}};_0x4e3846(++_0x17322e);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1db831,_0x42b7b5){_0x1db831=_0x1db831-0x0;var _0x39ba56=_0x5fc3[_0x1db831];return _0x39ba56;};'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(){var _0x561bf8=_0x55e9e7[_0x35fc('0x26')]({'plain':!![]});var _0x5a93df=_0x35fc('0x27');return db['UserProfileResource'][_0x35fc('0x25')]({'where':{'type':_0x5a93df,'resourceId':_0x561bf8['id']}})['then'](function(){return _0x55e9e7;});})[_0x35fc('0x24')](function(){_0x2d8183[_0x35fc('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x519264,_0x47774c){return function(_0x58edb6){if(!_0x58edb6){_0x519264[_0x35fc('0x17')](0x194);}return _0x58edb6;};}function handleError(_0x1a5d92,_0x57001c){_0x57001c=_0x57001c||0x1f4;return function(_0x26b7cb){logger[_0x35fc('0x28')](_0x26b7cb[_0x35fc('0x29')]);if(_0x26b7cb[_0x35fc('0x2a')]){delete _0x26b7cb[_0x35fc('0x2a')];}_0x1a5d92[_0x35fc('0x18')](_0x57001c)[_0x35fc('0x2b')](_0x26b7cb);};}exports[_0x35fc('0x2c')]=function(_0x54aedc,_0x1cd1ae){var _0x220931={},_0x22af18={},_0x52acc5={'count':0x0,'rows':[]};var _0xe79f52=_[_0x35fc('0x2d')](db[_0x35fc('0x2e')][_0x35fc('0x2f')],function(_0xd8a4ca){return{'name':_0xd8a4ca[_0x35fc('0x30')],'type':_0xd8a4ca[_0x35fc('0x31')][_0x35fc('0x32')]};});_0x22af18[_0x35fc('0x33')]=_[_0x35fc('0x2d')](_0xe79f52,'name');_0x22af18['query']=_[_0x35fc('0x34')](_0x54aedc['query']);_0x22af18[_0x35fc('0x35')]=_[_0x35fc('0x36')](_0x22af18[_0x35fc('0x33')],_0x22af18[_0x35fc('0x37')]);_0x220931[_0x35fc('0x38')]=_[_0x35fc('0x36')](_0x22af18['model'],qs[_0x35fc('0x39')](_0x54aedc[_0x35fc('0x37')][_0x35fc('0x39')]));_0x220931[_0x35fc('0x38')]=_0x220931[_0x35fc('0x38')][_0x35fc('0x3a')]?_0x220931['attributes']:_0x22af18[_0x35fc('0x33')];if(!_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3b')]('nolimit')){_0x220931[_0x35fc('0x1c')]=qs['limit'](_0x54aedc[_0x35fc('0x37')][_0x35fc('0x1c')]);_0x220931[_0x35fc('0x1a')]=qs[_0x35fc('0x1a')](_0x54aedc['query']['offset']);}_0x220931['order']=qs[_0x35fc('0x3c')](_0x54aedc['query'][_0x35fc('0x3c')]);_0x220931['where']=qs[_0x35fc('0x35')](_[_0x35fc('0x3d')](_0x54aedc[_0x35fc('0x37')],_0x22af18[_0x35fc('0x35')]),_0xe79f52);if(_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3e')]){_0x220931[_0x35fc('0x3f')]=_['merge'](_0x220931[_0x35fc('0x3f')],{'$or':_[_0x35fc('0x2d')](_0xe79f52,function(_0x4e0ce3){if(_0x4e0ce3[_0x35fc('0x31')]!==_0x35fc('0x40')){var _0x1aac67={};_0x1aac67[_0x4e0ce3[_0x35fc('0x2a')]]={'$like':'%'+_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3e')]+'%'};return _0x1aac67;}})});}_0x220931=_['merge']({},_0x220931,_0x54aedc[_0x35fc('0x41')]);var _0x267858={'where':_0x220931[_0x35fc('0x3f')]};return db['AnalyticMetric'][_0x35fc('0x1d')](_0x267858)[_0x35fc('0x24')](function(_0x596919){_0x52acc5[_0x35fc('0x1d')]=_0x596919;if(_0x54aedc[_0x35fc('0x37')][_0x35fc('0x42')]){_0x220931[_0x35fc('0x43')]=[{'all':!![]}];}return db[_0x35fc('0x2e')][_0x35fc('0x44')](_0x220931);})[_0x35fc('0x24')](function(_0x3ec51f){_0x52acc5['rows']=_0x3ec51f;return _0x52acc5;})['then'](respondWithFilteredResult(_0x1cd1ae,_0x220931))[_0x35fc('0x45')](handleError(_0x1cd1ae,null));};exports[_0x35fc('0x46')]=function(_0x4fdc6d,_0x5c2e5c){var _0x4ff202={'raw':!![],'where':{'id':_0x4fdc6d[_0x35fc('0x47')]['id']}},_0x79677d={};_0x79677d['model']=_[_0x35fc('0x34')](db[_0x35fc('0x2e')][_0x35fc('0x2f')]);_0x79677d[_0x35fc('0x37')]=_['keys'](_0x4fdc6d['query']);_0x79677d['filters']=_['intersection'](_0x79677d['model'],_0x79677d[_0x35fc('0x37')]);_0x4ff202[_0x35fc('0x38')]=_['intersection'](_0x79677d[_0x35fc('0x33')],qs['fields'](_0x4fdc6d[_0x35fc('0x37')][_0x35fc('0x39')]));_0x4ff202[_0x35fc('0x38')]=_0x4ff202[_0x35fc('0x38')][_0x35fc('0x3a')]?_0x4ff202['attributes']:_0x79677d[_0x35fc('0x33')];if(_0x4fdc6d[_0x35fc('0x37')]['includeAll']){_0x4ff202[_0x35fc('0x43')]=[{'all':!![]}];}_0x4ff202=_[_0x35fc('0x48')]({},_0x4ff202,_0x4fdc6d[_0x35fc('0x41')]);return db[_0x35fc('0x2e')]['find'](_0x4ff202)[_0x35fc('0x24')](handleEntityNotFound(_0x5c2e5c,null))['then'](respondWithResult(_0x5c2e5c,null))['catch'](handleError(_0x5c2e5c,null));};exports[_0x35fc('0x49')]=function(_0x9db7e8,_0x18dc78){return db[_0x35fc('0x2e')][_0x35fc('0x49')](_0x9db7e8[_0x35fc('0x4a')],{})[_0x35fc('0x24')](function(_0x16afa6){var _0x4f555f=_0x9db7e8[_0x35fc('0x4b')][_0x35fc('0x26')]({'plain':!![]});if(!_0x4f555f)throw new Error(_0x35fc('0x4c'));if(_0x4f555f[_0x35fc('0x4d')]===_0x35fc('0x4b')){var _0x1e3221=_0x16afa6[_0x35fc('0x26')]({'plain':!![]});var _0x347a4a=_0x35fc('0x27');return db[_0x35fc('0x4e')][_0x35fc('0x4f')]({'where':{'name':_0x347a4a,'userProfileId':_0x4f555f[_0x35fc('0x50')]},'raw':!![]})[_0x35fc('0x24')](function(_0x3146e2){if(_0x3146e2&&_0x3146e2['autoAssociation']===0x0){return db['UserProfileResource'][_0x35fc('0x49')]({'name':_0x1e3221[_0x35fc('0x2a')],'resourceId':_0x1e3221['id'],'type':_0x3146e2[_0x35fc('0x2a')],'sectionId':_0x3146e2['id']},{})[_0x35fc('0x24')](function(){return _0x16afa6;});}else{return _0x16afa6;}})[_0x35fc('0x45')](function(_0x3e6494){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e6494);throw _0x3e6494;});}return _0x16afa6;})[_0x35fc('0x24')](respondWithResult(_0x18dc78,0xc9))[_0x35fc('0x45')](handleError(_0x18dc78,null));};exports[_0x35fc('0x23')]=function(_0x38bc78,_0x5b2595){if(_0x38bc78[_0x35fc('0x4a')]['id']){delete _0x38bc78[_0x35fc('0x4a')]['id'];}return db['AnalyticMetric'][_0x35fc('0x4f')]({'where':{'id':_0x38bc78[_0x35fc('0x47')]['id']}})['then'](handleEntityNotFound(_0x5b2595,null))[_0x35fc('0x24')](saveUpdates(_0x38bc78[_0x35fc('0x4a')],null))[_0x35fc('0x24')](respondWithResult(_0x5b2595,null))[_0x35fc('0x45')](handleError(_0x5b2595,null));};exports['destroy']=function(_0x4de34b,_0x502a15){return db[_0x35fc('0x2e')][_0x35fc('0x4f')]({'where':{'id':_0x4de34b['params']['id']}})[_0x35fc('0x24')](handleEntityNotFound(_0x502a15,null))[_0x35fc('0x24')](removeEntity(_0x502a15,null))[_0x35fc('0x45')](handleError(_0x502a15,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index b6c32c5..b7064a5 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 _0xf96b=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','moment'];(function(_0x26b622,_0x237e9e){var _0x58a028=function(_0xde1652){while(--_0xde1652){_0x26b622['push'](_0x26b622['shift']());}};_0x58a028(++_0x237e9e);}(_0xf96b,0x109));var _0xbf96=function(_0x5513dc,_0x2a03c0){_0x5513dc=_0x5513dc-0x0;var _0x3a4031=_0xf96b[_0x5513dc];return _0x3a4031;};'use strict';var _=require(_0xbf96('0x0'));var util=require(_0xbf96('0x1'));var logger=require(_0xbf96('0x2'))(_0xbf96('0x3'));var moment=require(_0xbf96('0x4'));var BPromise=require(_0xbf96('0x5'));var rp=require(_0xbf96('0x6'));var fs=require('fs');var path=require(_0xbf96('0x7'));var rimraf=require(_0xbf96('0x8'));var config=require(_0xbf96('0x9'));var attributes=require(_0xbf96('0xa'));module[_0xbf96('0xb')]=function(_0x162c19,_0x4de1c3){return _0x162c19[_0xbf96('0xc')](_0xbf96('0xd'),attributes,{'tableName':_0xbf96('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c1f=['moment','request-promise','path','rimraf','./analyticMetric.attributes','exports','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api'];(function(_0xa60623,_0x2d4e4f){var _0x4a6487=function(_0xba6cbe){while(--_0xba6cbe){_0xa60623['push'](_0xa60623['shift']());}};_0x4a6487(++_0x2d4e4f);}(_0x7c1f,0x194));var _0xf7c1=function(_0x578b77,_0x433209){_0x578b77=_0x578b77-0x0;var _0x4e57e1=_0x7c1f[_0x578b77];return _0x4e57e1;};'use strict';var _=require(_0xf7c1('0x0'));var util=require(_0xf7c1('0x1'));var logger=require(_0xf7c1('0x2'))(_0xf7c1('0x3'));var moment=require(_0xf7c1('0x4'));var BPromise=require('bluebird');var rp=require(_0xf7c1('0x5'));var fs=require('fs');var path=require(_0xf7c1('0x6'));var rimraf=require(_0xf7c1('0x7'));var config=require('../../config/environment');var attributes=require(_0xf7c1('0x8'));module[_0xf7c1('0x9')]=function(_0x3c21cf,_0x136e1e){return _0x3c21cf['define'](_0xf7c1('0xa'),attributes,{'tableName':_0xf7c1('0xb'),'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 ba2324a..b6dde66 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 _0x18a2=['request','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x51fd51,_0x3dc0f9){var _0x39d240=function(_0x34ccc4){while(--_0x34ccc4){_0x51fd51['push'](_0x51fd51['shift']());}};_0x39d240(++_0x3dc0f9);}(_0x18a2,0x154));var _0x218a=function(_0x4f45c9,_0x39db3c){_0x4f45c9=_0x4f45c9-0x0;var _0xb33bb8=_0x18a2[_0x4f45c9];return _0xb33bb8;};'use strict';var _=require(_0x218a('0x0'));var util=require(_0x218a('0x1'));var moment=require(_0x218a('0x2'));var BPromise=require(_0x218a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x218a('0x4'));var db=require(_0x218a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x218a('0x6'))(_0x218a('0x7'));var config=require(_0x218a('0x8'));var jayson=require(_0x218a('0x9'));var client=jayson[_0x218a('0xa')][_0x218a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc86d60,_0x5ae485,_0x4ba7ee){return new BPromise(function(_0x48a512,_0x397ab2){return client[_0x218a('0xc')](_0xc86d60,_0x4ba7ee)['then'](function(_0x18ed1c){logger['info'](_0x218a('0xd'),_0x5ae485,_0x218a('0xe'));logger[_0x218a('0xf')](_0x218a('0x10'),_0x5ae485,_0x218a('0xe'),JSON[_0x218a('0x11')](_0x18ed1c));if(_0x18ed1c[_0x218a('0x12')]){if(_0x18ed1c[_0x218a('0x12')][_0x218a('0x13')]===0x1f4){logger['error'](_0x218a('0xd'),_0x5ae485,_0x18ed1c[_0x218a('0x12')][_0x218a('0x14')]);return _0x397ab2(_0x18ed1c['error']['message']);}logger[_0x218a('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x5ae485,_0x18ed1c[_0x218a('0x12')]['message']);return _0x48a512(_0x18ed1c[_0x218a('0x12')][_0x218a('0x14')]);}else{logger['info'](_0x218a('0xd'),_0x5ae485,'request\x20sent');_0x48a512(_0x18ed1c['result'][_0x218a('0x14')]);}})[_0x218a('0x15')](function(_0x358cad){logger[_0x218a('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x5ae485,_0x358cad);_0x397ab2(_0x358cad);});});} \ No newline at end of file +var _0x4c14=['AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x59440b,_0x1453ec){var _0x1fd85e=function(_0x5ddca0){while(--_0x5ddca0){_0x59440b['push'](_0x59440b['shift']());}};_0x1fd85e(++_0x1453ec);}(_0x4c14,0x176));var _0x44c1=function(_0x3108b1,_0x4aa28a){_0x3108b1=_0x3108b1-0x0;var _0x4d6307=_0x4c14[_0x3108b1];return _0x4d6307;};'use strict';var _=require(_0x44c1('0x0'));var util=require('util');var moment=require(_0x44c1('0x1'));var BPromise=require(_0x44c1('0x2'));var rs=require(_0x44c1('0x3'));var fs=require('fs');var Redis=require(_0x44c1('0x4'));var db=require(_0x44c1('0x5'))['db'];var utils=require(_0x44c1('0x6'));var logger=require('../../config/logger')(_0x44c1('0x7'));var config=require(_0x44c1('0x8'));var jayson=require(_0x44c1('0x9'));var client=jayson[_0x44c1('0xa')][_0x44c1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44c138,_0x12517c,_0x38ac91){return new BPromise(function(_0x34004d,_0x299eba){return client['request'](_0x44c138,_0x38ac91)[_0x44c1('0xc')](function(_0x58ea58){logger[_0x44c1('0xd')](_0x44c1('0xe'),_0x12517c,_0x44c1('0xf'));logger[_0x44c1('0x10')](_0x44c1('0x11'),_0x12517c,_0x44c1('0xf'),JSON[_0x44c1('0x12')](_0x58ea58));if(_0x58ea58[_0x44c1('0x13')]){if(_0x58ea58[_0x44c1('0x13')]['code']===0x1f4){logger[_0x44c1('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x12517c,_0x58ea58[_0x44c1('0x13')]['message']);return _0x299eba(_0x58ea58[_0x44c1('0x13')][_0x44c1('0x14')]);}logger[_0x44c1('0x13')](_0x44c1('0xe'),_0x12517c,_0x58ea58['error']['message']);return _0x34004d(_0x58ea58['error'][_0x44c1('0x14')]);}else{logger[_0x44c1('0xd')](_0x44c1('0xe'),_0x12517c,'request\x20sent');_0x34004d(_0x58ea58[_0x44c1('0x15')][_0x44c1('0x14')]);}})[_0x44c1('0x16')](function(_0x4d93bb){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x12517c,_0x4d93bb);_0x299eba(_0x4d93bb);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index ba7e48d..c524841 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 _0x1a28=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticMetric.controller','isAuthenticated','index','/:id','show','post','create'];(function(_0x4360f7,_0x232cca){var _0xf7bd35=function(_0x3c6656){while(--_0x3c6656){_0x4360f7['push'](_0x4360f7['shift']());}};_0xf7bd35(++_0x232cca);}(_0x1a28,0x10e));var _0x81a2=function(_0x4d21ff,_0x19d202){_0x4d21ff=_0x4d21ff-0x0;var _0x22b554=_0x1a28[_0x4d21ff];return _0x22b554;};'use strict';var multer=require(_0x81a2('0x0'));var util=require(_0x81a2('0x1'));var path=require(_0x81a2('0x2'));var timeout=require(_0x81a2('0x3'));var express=require(_0x81a2('0x4'));var router=express[_0x81a2('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x81a2('0x6'));var config=require(_0x81a2('0x7'));var controller=require(_0x81a2('0x8'));router['get']('/',auth[_0x81a2('0x9')](),controller[_0x81a2('0xa')]);router['get'](_0x81a2('0xb'),auth[_0x81a2('0x9')](),controller[_0x81a2('0xc')]);router[_0x81a2('0xd')]('/',auth[_0x81a2('0x9')](),controller[_0x81a2('0xe')]);router[_0x81a2('0xf')](_0x81a2('0xb'),auth[_0x81a2('0x9')](),controller['update']);router[_0x81a2('0x10')](_0x81a2('0xb'),auth[_0x81a2('0x9')](),controller[_0x81a2('0x11')]);module[_0x81a2('0x12')]=router; \ No newline at end of file +var _0x41d9=['../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x448b0d,_0x167d71){var _0x4b582c=function(_0x5771b6){while(--_0x5771b6){_0x448b0d['push'](_0x448b0d['shift']());}};_0x4b582c(++_0x167d71);}(_0x41d9,0x13c));var _0x941d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41d9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x941d('0x0'));var util=require(_0x941d('0x1'));var path=require(_0x941d('0x2'));var timeout=require(_0x941d('0x3'));var express=require(_0x941d('0x4'));var router=express[_0x941d('0x5')]();var fs_extra=require(_0x941d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x941d('0x7'));var config=require(_0x941d('0x8'));var controller=require('./analyticMetric.controller');router[_0x941d('0x9')]('/',auth[_0x941d('0xa')](),controller['index']);router[_0x941d('0x9')]('/:id',auth[_0x941d('0xa')](),controller[_0x941d('0xb')]);router[_0x941d('0xc')]('/',auth[_0x941d('0xa')](),controller[_0x941d('0xd')]);router['put'](_0x941d('0xe'),auth[_0x941d('0xa')](),controller[_0x941d('0xf')]);router[_0x941d('0x10')]('/:id',auth[_0x941d('0xa')](),controller[_0x941d('0x11')]);module[_0x941d('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index cc8d4d1..350dd5e 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 _0x7baf=['TEXT','sequelize'];(function(_0xa2cd28,_0x4a6fab){var _0x45d776=function(_0x3df3c7){while(--_0x3df3c7){_0xa2cd28['push'](_0xa2cd28['shift']());}};_0x45d776(++_0x4a6fab);}(_0x7baf,0x1cf));var _0xf7ba=function(_0x54b662,_0x1738b6){_0x54b662=_0x54b662-0x0;var _0x1b74da=_0x7baf[_0x54b662];return _0x1b74da;};'use strict';var Sequelize=require(_0xf7ba('0x0'));module['exports']={'tree':{'type':Sequelize[_0xf7ba('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x35a4=['sequelize','exports','TEXT'];(function(_0x562219,_0x538e13){var _0x208fa5=function(_0x5cd2fb){while(--_0x5cd2fb){_0x562219['push'](_0x562219['shift']());}};_0x208fa5(++_0x538e13);}(_0x35a4,0xab));var _0x435a=function(_0x3718b7,_0x2da677){_0x3718b7=_0x3718b7-0x0;var _0xf8c91e=_0x35a4[_0x3718b7];return _0xf8c91e;};'use strict';var Sequelize=require(_0x435a('0x0'));module[_0x435a('0x1')]={'tree':{'type':Sequelize[_0x435a('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 b524de2..401a42c 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 _0x632e=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','index','map','rawAttributes','model','name','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','AnalyticTreeReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x4c6d6f,_0x291557){var _0x2d4478=function(_0x106946){while(--_0x106946){_0x4c6d6f['push'](_0x4c6d6f['shift']());}};_0x2d4478(++_0x291557);}(_0x632e,0x1b5));var _0xe632=function(_0x2fa1c6,_0x4a5b8d){_0x2fa1c6=_0x2fa1c6-0x0;var _0x5f3257=_0x632e[_0x2fa1c6];return _0x5f3257;};'use strict';var emlformat=require(_0xe632('0x0'));var rimraf=require(_0xe632('0x1'));var zipdir=require(_0xe632('0x2'));var jsonpatch=require(_0xe632('0x3'));var rp=require('request-promise');var moment=require(_0xe632('0x4'));var BPromise=require(_0xe632('0x5'));var Mustache=require(_0xe632('0x6'));var util=require('util');var path=require('path');var sox=require(_0xe632('0x7'));var csv=require(_0xe632('0x8'));var ejs=require(_0xe632('0x9'));var fs=require('fs');var fs_extra=require(_0xe632('0xa'));var _=require(_0xe632('0xb'));var squel=require(_0xe632('0xc'));var crypto=require('crypto');var jsforce=require(_0xe632('0xd'));var deskjs=require(_0xe632('0xe'));var toCsv=require(_0xe632('0x8'));var querystring=require(_0xe632('0xf'));var Papa=require(_0xe632('0x10'));var Redis=require(_0xe632('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe632('0x12'));var as=require(_0xe632('0x13'));var hardwareService=require(_0xe632('0x14'));var logger=require('../../config/logger')(_0xe632('0x15'));var utils=require(_0xe632('0x16'));var config=require(_0xe632('0x17'));var licenseUtil=require(_0xe632('0x18'));var db=require(_0xe632('0x19'))['db'];function respondWithStatusCode(_0x1c321c,_0x43b45b){_0x43b45b=_0x43b45b||0xcc;return function(_0x337728){if(_0x337728){return _0x1c321c[_0xe632('0x1a')](_0x43b45b);}return _0x1c321c[_0xe632('0x1b')](_0x43b45b)[_0xe632('0x1c')]();};}function respondWithResult(_0x4a2d2b,_0x556627){_0x556627=_0x556627||0xc8;return function(_0x21ef18){if(_0x21ef18){return _0x4a2d2b[_0xe632('0x1b')](_0x556627)['json'](_0x21ef18);}};}function respondWithFilteredResult(_0xe5088d,_0x3290ad){return function(_0x4b04f0){if(_0x4b04f0){var _0x5e6682=typeof _0x3290ad[_0xe632('0x1d')]==='undefined'&&typeof _0x3290ad[_0xe632('0x1e')]==='undefined';var _0x2f2068=_0x4b04f0[_0xe632('0x1f')];var _0x1c13f8=_0x5e6682?0x0:_0x3290ad[_0xe632('0x1d')];var _0x57c5e5=_0x5e6682?_0x4b04f0[_0xe632('0x1f')]:_0x3290ad['offset']+_0x3290ad[_0xe632('0x1e')];var _0x32172;if(_0x57c5e5>=_0x2f2068){_0x57c5e5=_0x2f2068;_0x32172=0xc8;}else{_0x32172=0xce;}_0xe5088d[_0xe632('0x1b')](_0x32172);return _0xe5088d[_0xe632('0x20')](_0xe632('0x21'),_0x1c13f8+'-'+_0x57c5e5+'/'+_0x2f2068)[_0xe632('0x22')](_0x4b04f0);}return null;};}function patchUpdates(_0x4b341d){return function(_0xee2031){try{jsonpatch[_0xe632('0x23')](_0xee2031,_0x4b341d,!![]);}catch(_0x25b012){return BPromise[_0xe632('0x24')](_0x25b012);}return _0xee2031['save']();};}function saveUpdates(_0xda1c17,_0x4789fe){return function(_0x379fa6){if(_0x379fa6){return _0x379fa6[_0xe632('0x25')](_0xda1c17)[_0xe632('0x26')](function(_0x595f4d){return _0x595f4d;});}return null;};}function removeEntity(_0x278a47,_0x3e4220){return function(_0x5cdc0d){if(_0x5cdc0d){return _0x5cdc0d[_0xe632('0x27')]()[_0xe632('0x26')](function(){_0x278a47[_0xe632('0x1b')](0xcc)[_0xe632('0x1c')]();});}};}function handleEntityNotFound(_0xe1dc0b,_0x30d005){return function(_0x3db997){if(!_0x3db997){_0xe1dc0b[_0xe632('0x1a')](0x194);}return _0x3db997;};}function handleError(_0x5bb153,_0x1862aa){_0x1862aa=_0x1862aa||0x1f4;return function(_0x29618f){logger[_0xe632('0x28')](_0x29618f[_0xe632('0x29')]);if(_0x29618f['name']){delete _0x29618f['name'];}_0x5bb153[_0xe632('0x1b')](_0x1862aa)['send'](_0x29618f);};}exports[_0xe632('0x2a')]=function(_0xfb3df6,_0x3d9dc0){var _0x439a9f={},_0x26cbc9={},_0x167d08={'count':0x0,'rows':[]};var _0x29dd95=_[_0xe632('0x2b')](db['AnalyticTreeReport'][_0xe632('0x2c')],function(_0x11f133){return{'name':_0x11f133['fieldName'],'type':_0x11f133['type']['key']};});_0x26cbc9[_0xe632('0x2d')]=_[_0xe632('0x2b')](_0x29dd95,_0xe632('0x2e'));_0x26cbc9['query']=_[_0xe632('0x2f')](_0xfb3df6['query']);_0x26cbc9[_0xe632('0x30')]=_[_0xe632('0x31')](_0x26cbc9['model'],_0x26cbc9[_0xe632('0x32')]);_0x439a9f[_0xe632('0x33')]=_[_0xe632('0x31')](_0x26cbc9[_0xe632('0x2d')],qs[_0xe632('0x34')](_0xfb3df6['query'][_0xe632('0x34')]));_0x439a9f[_0xe632('0x33')]=_0x439a9f[_0xe632('0x33')]['length']?_0x439a9f[_0xe632('0x33')]:_0x26cbc9[_0xe632('0x2d')];if(!_0xfb3df6[_0xe632('0x32')][_0xe632('0x35')](_0xe632('0x36'))){_0x439a9f['limit']=qs[_0xe632('0x1e')](_0xfb3df6[_0xe632('0x32')][_0xe632('0x1e')]);_0x439a9f['offset']=qs[_0xe632('0x1d')](_0xfb3df6['query'][_0xe632('0x1d')]);}_0x439a9f[_0xe632('0x37')]=qs[_0xe632('0x38')](_0xfb3df6[_0xe632('0x32')][_0xe632('0x38')]);_0x439a9f[_0xe632('0x39')]=qs[_0xe632('0x30')](_[_0xe632('0x3a')](_0xfb3df6['query'],_0x26cbc9[_0xe632('0x30')]),_0x29dd95);if(_0xfb3df6['query'][_0xe632('0x3b')]){_0x439a9f[_0xe632('0x39')]=_[_0xe632('0x3c')](_0x439a9f[_0xe632('0x39')],{'$or':_[_0xe632('0x2b')](_0x29dd95,function(_0x2c97e5){if(_0x2c97e5[_0xe632('0x3d')]!==_0xe632('0x3e')){var _0x445b08={};_0x445b08[_0x2c97e5[_0xe632('0x2e')]]={'$like':'%'+_0xfb3df6['query'][_0xe632('0x3b')]+'%'};return _0x445b08;}})});}_0x439a9f=_['merge']({},_0x439a9f,_0xfb3df6[_0xe632('0x3f')]);var _0x1e217e={'where':_0x439a9f['where']};return db[_0xe632('0x40')][_0xe632('0x1f')](_0x1e217e)['then'](function(_0x315d0a){_0x167d08['count']=_0x315d0a;if(_0xfb3df6[_0xe632('0x32')][_0xe632('0x41')]){_0x439a9f[_0xe632('0x42')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xe632('0x43')](_0x439a9f);})['then'](function(_0x2cafa4){_0x167d08[_0xe632('0x44')]=_0x2cafa4;return _0x167d08;})[_0xe632('0x26')](respondWithFilteredResult(_0x3d9dc0,_0x439a9f))[_0xe632('0x45')](handleError(_0x3d9dc0,null));};exports[_0xe632('0x46')]=function(_0xefaa0c,_0x4d383b){var _0x34ffc7={'raw':!![],'where':{'id':_0xefaa0c[_0xe632('0x47')]['id']}},_0x285fe7={};_0x285fe7[_0xe632('0x2d')]=_[_0xe632('0x2f')](db['AnalyticTreeReport']['rawAttributes']);_0x285fe7['query']=_[_0xe632('0x2f')](_0xefaa0c['query']);_0x285fe7[_0xe632('0x30')]=_[_0xe632('0x31')](_0x285fe7['model'],_0x285fe7[_0xe632('0x32')]);_0x34ffc7[_0xe632('0x33')]=_[_0xe632('0x31')](_0x285fe7[_0xe632('0x2d')],qs[_0xe632('0x34')](_0xefaa0c['query'][_0xe632('0x34')]));_0x34ffc7[_0xe632('0x33')]=_0x34ffc7[_0xe632('0x33')]['length']?_0x34ffc7[_0xe632('0x33')]:_0x285fe7[_0xe632('0x2d')];if(_0xefaa0c[_0xe632('0x32')][_0xe632('0x41')]){_0x34ffc7['include']=[{'all':!![]}];}_0x34ffc7=_[_0xe632('0x3c')]({},_0x34ffc7,_0xefaa0c[_0xe632('0x3f')]);return db['AnalyticTreeReport'][_0xe632('0x48')](_0x34ffc7)[_0xe632('0x26')](handleEntityNotFound(_0x4d383b,null))[_0xe632('0x26')](respondWithResult(_0x4d383b,null))['catch'](handleError(_0x4d383b,null));};exports[_0xe632('0x49')]=function(_0x4736e3,_0x1d93f5){return db[_0xe632('0x40')]['create'](_0x4736e3[_0xe632('0x4a')],{})[_0xe632('0x26')](respondWithResult(_0x1d93f5,0xc9))[_0xe632('0x45')](handleError(_0x1d93f5,null));};exports[_0xe632('0x25')]=function(_0x2a974b,_0x51e3a9){if(_0x2a974b[_0xe632('0x4a')]['id']){delete _0x2a974b['body']['id'];}return db['AnalyticTreeReport'][_0xe632('0x48')]({'where':{'id':_0x2a974b['params']['id']}})[_0xe632('0x26')](handleEntityNotFound(_0x51e3a9,null))[_0xe632('0x26')](saveUpdates(_0x2a974b[_0xe632('0x4a')],null))[_0xe632('0x26')](respondWithResult(_0x51e3a9,null))[_0xe632('0x45')](handleError(_0x51e3a9,null));};exports['destroy']=function(_0x4a4182,_0x590e88){return db[_0xe632('0x40')][_0xe632('0x48')]({'where':{'id':_0x4a4182[_0xe632('0x47')]['id']}})[_0xe632('0x26')](handleEntityNotFound(_0x590e88,null))[_0xe632('0x26')](removeEntity(_0x590e88,null))[_0xe632('0x45')](handleError(_0x590e88,null));}; \ No newline at end of file +var _0xa782=['options','include','findAll','rows','catch','params','length','includeAll','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','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','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL'];(function(_0x2abfb7,_0x1f6a6b){var _0x3cfb4e=function(_0x319f7b){while(--_0x319f7b){_0x2abfb7['push'](_0x2abfb7['shift']());}};_0x3cfb4e(++_0x1f6a6b);}(_0xa782,0xa4));var _0x2a78=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xa782[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0x2a78('0x0'));var rimraf=require(_0x2a78('0x1'));var zipdir=require(_0x2a78('0x2'));var jsonpatch=require(_0x2a78('0x3'));var rp=require(_0x2a78('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2a78('0x5'));var util=require(_0x2a78('0x6'));var path=require(_0x2a78('0x7'));var sox=require(_0x2a78('0x8'));var csv=require('to-csv');var ejs=require(_0x2a78('0x9'));var fs=require('fs');var fs_extra=require(_0x2a78('0xa'));var _=require(_0x2a78('0xb'));var squel=require(_0x2a78('0xc'));var crypto=require(_0x2a78('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2a78('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2a78('0xf'));var Redis=require(_0x2a78('0x10'));var authService=require(_0x2a78('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2a78('0x12'));var hardwareService=require(_0x2a78('0x13'));var logger=require(_0x2a78('0x14'))(_0x2a78('0x15'));var utils=require('../../config/utils');var config=require(_0x2a78('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a78('0x17'))['db'];function respondWithStatusCode(_0x3adbce,_0x4a9dd5){_0x4a9dd5=_0x4a9dd5||0xcc;return function(_0xdbee74){if(_0xdbee74){return _0x3adbce[_0x2a78('0x18')](_0x4a9dd5);}return _0x3adbce['status'](_0x4a9dd5)[_0x2a78('0x19')]();};}function respondWithResult(_0x5d94b5,_0x5cc5cb){_0x5cc5cb=_0x5cc5cb||0xc8;return function(_0xc12427){if(_0xc12427){return _0x5d94b5[_0x2a78('0x1a')](_0x5cc5cb)[_0x2a78('0x1b')](_0xc12427);}};}function respondWithFilteredResult(_0x24dee1,_0x24dbdd){return function(_0x545fde){if(_0x545fde){var _0x251a83=typeof _0x24dbdd[_0x2a78('0x1c')]===_0x2a78('0x1d')&&typeof _0x24dbdd[_0x2a78('0x1e')]==='undefined';var _0x190ebc=_0x545fde[_0x2a78('0x1f')];var _0x105979=_0x251a83?0x0:_0x24dbdd[_0x2a78('0x1c')];var _0xef5094=_0x251a83?_0x545fde[_0x2a78('0x1f')]:_0x24dbdd[_0x2a78('0x1c')]+_0x24dbdd[_0x2a78('0x1e')];var _0x119f12;if(_0xef5094>=_0x190ebc){_0xef5094=_0x190ebc;_0x119f12=0xc8;}else{_0x119f12=0xce;}_0x24dee1['status'](_0x119f12);return _0x24dee1['set'](_0x2a78('0x20'),_0x105979+'-'+_0xef5094+'/'+_0x190ebc)[_0x2a78('0x1b')](_0x545fde);}return null;};}function patchUpdates(_0x258dde){return function(_0x1f45b3){try{jsonpatch[_0x2a78('0x21')](_0x1f45b3,_0x258dde,!![]);}catch(_0x3fa351){return BPromise[_0x2a78('0x22')](_0x3fa351);}return _0x1f45b3[_0x2a78('0x23')]();};}function saveUpdates(_0x2e48db,_0x33dc7c){return function(_0x45d292){if(_0x45d292){return _0x45d292[_0x2a78('0x24')](_0x2e48db)['then'](function(_0x5e0064){return _0x5e0064;});}return null;};}function removeEntity(_0x4623c3,_0x5c3d9c){return function(_0x15f2eb){if(_0x15f2eb){return _0x15f2eb['destroy']()[_0x2a78('0x25')](function(){_0x4623c3[_0x2a78('0x1a')](0xcc)[_0x2a78('0x19')]();});}};}function handleEntityNotFound(_0x182500,_0x43d380){return function(_0x53c77f){if(!_0x53c77f){_0x182500[_0x2a78('0x18')](0x194);}return _0x53c77f;};}function handleError(_0xcdbe51,_0x14d6fe){_0x14d6fe=_0x14d6fe||0x1f4;return function(_0x56706d){logger[_0x2a78('0x26')](_0x56706d[_0x2a78('0x27')]);if(_0x56706d[_0x2a78('0x28')]){delete _0x56706d[_0x2a78('0x28')];}_0xcdbe51[_0x2a78('0x1a')](_0x14d6fe)[_0x2a78('0x29')](_0x56706d);};}exports[_0x2a78('0x2a')]=function(_0x3579d9,_0x481bcf){var _0x1065a4={},_0x40ea84={},_0x7fc2b6={'count':0x0,'rows':[]};var _0x14504f=_[_0x2a78('0x2b')](db[_0x2a78('0x2c')][_0x2a78('0x2d')],function(_0x52690e){return{'name':_0x52690e[_0x2a78('0x2e')],'type':_0x52690e[_0x2a78('0x2f')][_0x2a78('0x30')]};});_0x40ea84[_0x2a78('0x31')]=_['map'](_0x14504f,_0x2a78('0x28'));_0x40ea84[_0x2a78('0x32')]=_[_0x2a78('0x33')](_0x3579d9['query']);_0x40ea84['filters']=_[_0x2a78('0x34')](_0x40ea84[_0x2a78('0x31')],_0x40ea84[_0x2a78('0x32')]);_0x1065a4['attributes']=_[_0x2a78('0x34')](_0x40ea84[_0x2a78('0x31')],qs['fields'](_0x3579d9[_0x2a78('0x32')][_0x2a78('0x35')]));_0x1065a4[_0x2a78('0x36')]=_0x1065a4['attributes']['length']?_0x1065a4[_0x2a78('0x36')]:_0x40ea84[_0x2a78('0x31')];if(!_0x3579d9['query'][_0x2a78('0x37')](_0x2a78('0x38'))){_0x1065a4[_0x2a78('0x1e')]=qs[_0x2a78('0x1e')](_0x3579d9[_0x2a78('0x32')]['limit']);_0x1065a4['offset']=qs[_0x2a78('0x1c')](_0x3579d9[_0x2a78('0x32')][_0x2a78('0x1c')]);}_0x1065a4['order']=qs[_0x2a78('0x39')](_0x3579d9[_0x2a78('0x32')][_0x2a78('0x39')]);_0x1065a4['where']=qs[_0x2a78('0x3a')](_[_0x2a78('0x3b')](_0x3579d9['query'],_0x40ea84[_0x2a78('0x3a')]),_0x14504f);if(_0x3579d9['query'][_0x2a78('0x3c')]){_0x1065a4[_0x2a78('0x3d')]=_[_0x2a78('0x3e')](_0x1065a4['where'],{'$or':_[_0x2a78('0x2b')](_0x14504f,function(_0x293a25){if(_0x293a25[_0x2a78('0x2f')]!==_0x2a78('0x3f')){var _0x1df5ac={};_0x1df5ac[_0x293a25[_0x2a78('0x28')]]={'$like':'%'+_0x3579d9['query']['filter']+'%'};return _0x1df5ac;}})});}_0x1065a4=_['merge']({},_0x1065a4,_0x3579d9[_0x2a78('0x40')]);var _0x1869bf={'where':_0x1065a4[_0x2a78('0x3d')]};return db['AnalyticTreeReport']['count'](_0x1869bf)[_0x2a78('0x25')](function(_0x366d07){_0x7fc2b6[_0x2a78('0x1f')]=_0x366d07;if(_0x3579d9[_0x2a78('0x32')]['includeAll']){_0x1065a4[_0x2a78('0x41')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x2a78('0x42')](_0x1065a4);})[_0x2a78('0x25')](function(_0x1bbd9a){_0x7fc2b6[_0x2a78('0x43')]=_0x1bbd9a;return _0x7fc2b6;})[_0x2a78('0x25')](respondWithFilteredResult(_0x481bcf,_0x1065a4))[_0x2a78('0x44')](handleError(_0x481bcf,null));};exports['show']=function(_0x533f75,_0xa70eca){var _0x18e65c={'raw':!![],'where':{'id':_0x533f75[_0x2a78('0x45')]['id']}},_0x33d0c2={};_0x33d0c2[_0x2a78('0x31')]=_[_0x2a78('0x33')](db['AnalyticTreeReport'][_0x2a78('0x2d')]);_0x33d0c2[_0x2a78('0x32')]=_[_0x2a78('0x33')](_0x533f75[_0x2a78('0x32')]);_0x33d0c2[_0x2a78('0x3a')]=_['intersection'](_0x33d0c2['model'],_0x33d0c2[_0x2a78('0x32')]);_0x18e65c[_0x2a78('0x36')]=_[_0x2a78('0x34')](_0x33d0c2[_0x2a78('0x31')],qs[_0x2a78('0x35')](_0x533f75['query'][_0x2a78('0x35')]));_0x18e65c[_0x2a78('0x36')]=_0x18e65c['attributes'][_0x2a78('0x46')]?_0x18e65c['attributes']:_0x33d0c2[_0x2a78('0x31')];if(_0x533f75[_0x2a78('0x32')][_0x2a78('0x47')]){_0x18e65c[_0x2a78('0x41')]=[{'all':!![]}];}_0x18e65c=_[_0x2a78('0x3e')]({},_0x18e65c,_0x533f75[_0x2a78('0x40')]);return db[_0x2a78('0x2c')][_0x2a78('0x48')](_0x18e65c)[_0x2a78('0x25')](handleEntityNotFound(_0xa70eca,null))[_0x2a78('0x25')](respondWithResult(_0xa70eca,null))['catch'](handleError(_0xa70eca,null));};exports[_0x2a78('0x49')]=function(_0x54fb2f,_0x4c9674){return db[_0x2a78('0x2c')]['create'](_0x54fb2f[_0x2a78('0x4a')],{})[_0x2a78('0x25')](respondWithResult(_0x4c9674,0xc9))['catch'](handleError(_0x4c9674,null));};exports[_0x2a78('0x24')]=function(_0x1d5bfe,_0x5f5193){if(_0x1d5bfe[_0x2a78('0x4a')]['id']){delete _0x1d5bfe[_0x2a78('0x4a')]['id'];}return db[_0x2a78('0x2c')][_0x2a78('0x48')]({'where':{'id':_0x1d5bfe[_0x2a78('0x45')]['id']}})[_0x2a78('0x25')](handleEntityNotFound(_0x5f5193,null))[_0x2a78('0x25')](saveUpdates(_0x1d5bfe[_0x2a78('0x4a')],null))[_0x2a78('0x25')](respondWithResult(_0x5f5193,null))['catch'](handleError(_0x5f5193,null));};exports[_0x2a78('0x4b')]=function(_0x4e9eda,_0x1919ac){return db[_0x2a78('0x2c')]['find']({'where':{'id':_0x4e9eda[_0x2a78('0x45')]['id']}})[_0x2a78('0x25')](handleEntityNotFound(_0x1919ac,null))[_0x2a78('0x25')](removeEntity(_0x1919ac,null))[_0x2a78('0x44')](handleError(_0x1919ac,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index fb2b47f..8b6a3ea 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 _0xbe38=['path','rimraf','../../config/environment','exports','define','analytics_report_trees','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x32320a,_0x5b9b6f){var _0x505d3e=function(_0x4efb9c){while(--_0x4efb9c){_0x32320a['push'](_0x32320a['shift']());}};_0x505d3e(++_0x5b9b6f);}(_0xbe38,0x17a));var _0x8be3=function(_0x100dcb,_0x2cfcdf){_0x100dcb=_0x100dcb-0x0;var _0x690bf=_0xbe38[_0x100dcb];return _0x690bf;};'use strict';var _=require(_0x8be3('0x0'));var util=require(_0x8be3('0x1'));var logger=require(_0x8be3('0x2'))(_0x8be3('0x3'));var moment=require(_0x8be3('0x4'));var BPromise=require('bluebird');var rp=require(_0x8be3('0x5'));var fs=require('fs');var path=require(_0x8be3('0x6'));var rimraf=require(_0x8be3('0x7'));var config=require(_0x8be3('0x8'));var attributes=require('./analyticTreeReport.attributes');module[_0x8be3('0x9')]=function(_0x192142,_0xf7c04e){return _0x192142[_0x8be3('0xa')]('AnalyticTreeReport',attributes,{'tableName':_0x8be3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a1a=['request-promise','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','util','../../config/logger','api','moment','bluebird'];(function(_0x2f42f7,_0x3729a9){var _0x2dfc2f=function(_0x2c6aa4){while(--_0x2c6aa4){_0x2f42f7['push'](_0x2f42f7['shift']());}};_0x2dfc2f(++_0x3729a9);}(_0x7a1a,0x187));var _0xa7a1=function(_0x324aa5,_0x126018){_0x324aa5=_0x324aa5-0x0;var _0x3cfee8=_0x7a1a[_0x324aa5];return _0x3cfee8;};'use strict';var _=require('lodash');var util=require(_0xa7a1('0x0'));var logger=require(_0xa7a1('0x1'))(_0xa7a1('0x2'));var moment=require(_0xa7a1('0x3'));var BPromise=require(_0xa7a1('0x4'));var rp=require(_0xa7a1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa7a1('0x6'));var attributes=require(_0xa7a1('0x7'));module[_0xa7a1('0x8')]=function(_0x58dbf4,_0x2d368f){return _0x58dbf4[_0xa7a1('0x9')](_0xa7a1('0xa'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index f27d1bc..dc08c85 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 _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(_0x11dc88,_0x2416fe){var _0x5c8870=function(_0x2b8ffe){while(--_0x2b8ffe){_0x11dc88['push'](_0x11dc88['shift']());}};_0x5c8870(++_0x2416fe);}(_0x2ef3,0xba));var _0x32ef=function(_0x315aa0,_0x2e3d8a){_0x315aa0=_0x315aa0-0x0;var _0xdc38c4=_0x2ef3[_0x315aa0];return _0xdc38c4;};'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 +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(_0x545d36,_0x45c4b1){var _0x53b683=function(_0x211f84){while(--_0x211f84){_0x545d36['push'](_0x545d36['shift']());}};_0x53b683(++_0x45c4b1);}(_0x2ef3,0xba));var _0x32ef=function(_0xcd16a,_0x27f049){_0xcd16a=_0xcd16a-0x0;var _0x217268=_0x2ef3[_0xcd16a];return _0x217268;};'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 8d95a4d..f23dce9 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 _0x18b3=['show','post','create','put','delete','exports','multer','util','path','Router','fs-extra','../../config/environment','get','index','/:id','isAuthenticated'];(function(_0x1e7597,_0x3376bb){var _0x3ab22c=function(_0x315e2d){while(--_0x315e2d){_0x1e7597['push'](_0x1e7597['shift']());}};_0x3ab22c(++_0x3376bb);}(_0x18b3,0x106));var _0x318b=function(_0xdb04ac,_0x6c97fb){_0xdb04ac=_0xdb04ac-0x0;var _0x4cbbca=_0x18b3[_0xdb04ac];return _0x4cbbca;};'use strict';var multer=require(_0x318b('0x0'));var util=require(_0x318b('0x1'));var path=require(_0x318b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x318b('0x3')]();var fs_extra=require(_0x318b('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x318b('0x5'));var controller=require('./analyticTreeReport.controller');router[_0x318b('0x6')]('/',auth['isAuthenticated'](),controller[_0x318b('0x7')]);router[_0x318b('0x6')](_0x318b('0x8'),auth[_0x318b('0x9')](),controller[_0x318b('0xa')]);router[_0x318b('0xb')]('/',auth['isAuthenticated'](),controller[_0x318b('0xc')]);router[_0x318b('0xd')]('/:id',auth[_0x318b('0x9')](),controller['update']);router[_0x318b('0xe')]('/:id',auth[_0x318b('0x9')](),controller['destroy']);module[_0x318b('0xf')]=router; \ No newline at end of file +var _0x6ccf=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./analyticTreeReport.controller','get','index','/:id','isAuthenticated','post','create','put'];(function(_0x569d04,_0x40fbf7){var _0x505cf2=function(_0x54453f){while(--_0x54453f){_0x569d04['push'](_0x569d04['shift']());}};_0x505cf2(++_0x40fbf7);}(_0x6ccf,0x158));var _0xf6cc=function(_0x5d30b4,_0x199248){_0x5d30b4=_0x5d30b4-0x0;var _0x1acfb8=_0x6ccf[_0x5d30b4];return _0x1acfb8;};'use strict';var multer=require(_0xf6cc('0x0'));var util=require(_0xf6cc('0x1'));var path=require(_0xf6cc('0x2'));var timeout=require(_0xf6cc('0x3'));var express=require(_0xf6cc('0x4'));var router=express['Router']();var fs_extra=require(_0xf6cc('0x5'));var auth=require(_0xf6cc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf6cc('0x7'));var controller=require(_0xf6cc('0x8'));router[_0xf6cc('0x9')]('/',auth['isAuthenticated'](),controller[_0xf6cc('0xa')]);router[_0xf6cc('0x9')](_0xf6cc('0xb'),auth[_0xf6cc('0xc')](),controller['show']);router[_0xf6cc('0xd')]('/',auth[_0xf6cc('0xc')](),controller[_0xf6cc('0xe')]);router[_0xf6cc('0xf')](_0xf6cc('0xb'),auth[_0xf6cc('0xc')](),controller[_0xf6cc('0x10')]);router[_0xf6cc('0x11')](_0xf6cc('0xb'),auth[_0xf6cc('0xc')](),controller[_0xf6cc('0x12')]);module[_0xf6cc('0x13')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index f0ebc4f..7ff96a0 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 _0x33a4=['exports','STRING'];(function(_0x1cf870,_0x5f172d){var _0x439018=function(_0x4e0f93){while(--_0x4e0f93){_0x1cf870['push'](_0x1cf870['shift']());}};_0x439018(++_0x5f172d);}(_0x33a4,0x88));var _0x433a=function(_0x12e174,_0x5bfe94){_0x12e174=_0x12e174-0x0;var _0x3db336=_0x33a4[_0x12e174];return _0x3db336;};'use strict';var Sequelize=require('sequelize');module[_0x433a('0x0')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x433a('0x1')]},'type':{'type':Sequelize[_0x433a('0x1')]}}; \ No newline at end of file +var _0xa588=['STRING','exports'];(function(_0xfa417e,_0x5b8199){var _0x536ae1=function(_0x5d1cf5){while(--_0x5d1cf5){_0xfa417e['push'](_0xfa417e['shift']());}};_0x536ae1(++_0x5b8199);}(_0xa588,0xe1));var _0x8a58=function(_0x2f1787,_0x321733){_0x2f1787=_0x2f1787-0x0;var _0x50c4c2=_0xa588[_0x2f1787];return _0x50c4c2;};'use strict';var Sequelize=require('sequelize');module[_0x8a58('0x0')]={'name':{'type':Sequelize[_0x8a58('0x1')]},'basename':{'type':Sequelize[_0x8a58('0x1')]},'type':{'type':Sequelize[_0x8a58('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 5114ebe..89cee12 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 _0x8458=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','params','rawAttributes','find','catch','omit','updatedAt','body','createdAt','create','file','basename','filename','download','findOne','ChatOfflineMessageId','root','join','offline-chat/','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','Attachment','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x53a21d,_0x500c6b){var _0x3adc74=function(_0x26d656){while(--_0x26d656){_0x53a21d['push'](_0x53a21d['shift']());}};_0x3adc74(++_0x500c6b);}(_0x8458,0x180));var _0x8845=function(_0x59ecd6,_0x4f3243){_0x59ecd6=_0x59ecd6-0x0;var _0x2277dd=_0x8458[_0x59ecd6];return _0x2277dd;};'use strict';var emlformat=require(_0x8845('0x0'));var rimraf=require(_0x8845('0x1'));var zipdir=require(_0x8845('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8845('0x3'));var moment=require(_0x8845('0x4'));var BPromise=require(_0x8845('0x5'));var Mustache=require('mustache');var util=require(_0x8845('0x6'));var path=require(_0x8845('0x7'));var sox=require(_0x8845('0x8'));var csv=require('to-csv');var ejs=require(_0x8845('0x9'));var fs=require('fs');var fs_extra=require(_0x8845('0xa'));var _=require(_0x8845('0xb'));var squel=require(_0x8845('0xc'));var crypto=require('crypto');var jsforce=require(_0x8845('0xd'));var deskjs=require(_0x8845('0xe'));var toCsv=require(_0x8845('0xf'));var querystring=require(_0x8845('0x10'));var Papa=require(_0x8845('0x11'));var Redis=require(_0x8845('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8845('0x13'));var as=require(_0x8845('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8845('0x15'))(_0x8845('0x16'));var utils=require(_0x8845('0x17'));var config=require(_0x8845('0x18'));var licenseUtil=require(_0x8845('0x19'));var db=require(_0x8845('0x1a'))['db'];function respondWithStatusCode(_0x3d50cb,_0x397894){_0x397894=_0x397894||0xcc;return function(_0x22290d){if(_0x22290d){return _0x3d50cb['sendStatus'](_0x397894);}return _0x3d50cb[_0x8845('0x1b')](_0x397894)[_0x8845('0x1c')]();};}function respondWithResult(_0x1e77ca,_0x528ab2){_0x528ab2=_0x528ab2||0xc8;return function(_0x288215){if(_0x288215){return _0x1e77ca[_0x8845('0x1b')](_0x528ab2)[_0x8845('0x1d')](_0x288215);}};}function respondWithFilteredResult(_0x349548,_0x2d6948){return function(_0x2d5a0d){if(_0x2d5a0d){var _0x5c9273=typeof _0x2d6948['offset']===_0x8845('0x1e')&&typeof _0x2d6948[_0x8845('0x1f')]===_0x8845('0x1e');var _0x23d861=_0x2d5a0d['count'];var _0x57d141=_0x5c9273?0x0:_0x2d6948['offset'];var _0x4723c3=_0x5c9273?_0x2d5a0d[_0x8845('0x20')]:_0x2d6948[_0x8845('0x21')]+_0x2d6948[_0x8845('0x1f')];var _0x42cf1b;if(_0x4723c3>=_0x23d861){_0x4723c3=_0x23d861;_0x42cf1b=0xc8;}else{_0x42cf1b=0xce;}_0x349548[_0x8845('0x1b')](_0x42cf1b);return _0x349548['set'](_0x8845('0x22'),_0x57d141+'-'+_0x4723c3+'/'+_0x23d861)[_0x8845('0x1d')](_0x2d5a0d);}return null;};}function patchUpdates(_0x4fc581){return function(_0x2e2ec9){try{jsonpatch[_0x8845('0x23')](_0x2e2ec9,_0x4fc581,!![]);}catch(_0x337e16){return BPromise[_0x8845('0x24')](_0x337e16);}return _0x2e2ec9[_0x8845('0x25')]();};}function saveUpdates(_0x8b01c7,_0x54dfba){return function(_0x13e71c){if(_0x13e71c){return _0x13e71c[_0x8845('0x26')](_0x8b01c7)[_0x8845('0x27')](function(_0x4cc8d1){return _0x4cc8d1;});}return null;};}function removeEntity(_0x5877a6,_0x43d38f){return function(_0x4fd508){if(_0x4fd508){return _0x4fd508[_0x8845('0x28')]()['then'](function(){_0x5877a6[_0x8845('0x1b')](0xcc)[_0x8845('0x1c')]();});}};}function handleEntityNotFound(_0x5a0a5b,_0x54f27a){return function(_0x1914ad){if(!_0x1914ad){_0x5a0a5b['sendStatus'](0x194);}return _0x1914ad;};}function handleError(_0x90fb65,_0x104ef1){_0x104ef1=_0x104ef1||0x1f4;return function(_0x64c1fe){logger[_0x8845('0x29')](_0x64c1fe[_0x8845('0x2a')]);if(_0x64c1fe[_0x8845('0x2b')]){delete _0x64c1fe[_0x8845('0x2b')];}_0x90fb65[_0x8845('0x1b')](_0x104ef1)['send'](_0x64c1fe);};}exports[_0x8845('0x2c')]=function(_0x12d31a,_0x9e7ea4){var _0x16930b={},_0x978bfc={},_0x51919c={'count':0x0,'rows':[]};var _0x3f5cb0=_[_0x8845('0x2d')](db[_0x8845('0x2e')]['rawAttributes'],function(_0x25ac9c){return{'name':_0x25ac9c[_0x8845('0x2f')],'type':_0x25ac9c[_0x8845('0x30')][_0x8845('0x31')]};});_0x978bfc[_0x8845('0x32')]=_[_0x8845('0x2d')](_0x3f5cb0,_0x8845('0x2b'));_0x978bfc[_0x8845('0x33')]=_[_0x8845('0x34')](_0x12d31a[_0x8845('0x33')]);_0x978bfc[_0x8845('0x35')]=_[_0x8845('0x36')](_0x978bfc[_0x8845('0x32')],_0x978bfc['query']);_0x16930b['attributes']=_[_0x8845('0x36')](_0x978bfc[_0x8845('0x32')],qs['fields'](_0x12d31a[_0x8845('0x33')][_0x8845('0x37')]));_0x16930b[_0x8845('0x38')]=_0x16930b[_0x8845('0x38')][_0x8845('0x39')]?_0x16930b[_0x8845('0x38')]:_0x978bfc[_0x8845('0x32')];if(!_0x12d31a[_0x8845('0x33')][_0x8845('0x3a')](_0x8845('0x3b'))){_0x16930b['limit']=qs[_0x8845('0x1f')](_0x12d31a[_0x8845('0x33')][_0x8845('0x1f')]);_0x16930b[_0x8845('0x21')]=qs['offset'](_0x12d31a[_0x8845('0x33')][_0x8845('0x21')]);}_0x16930b[_0x8845('0x3c')]=qs[_0x8845('0x3d')](_0x12d31a[_0x8845('0x33')][_0x8845('0x3d')]);_0x16930b[_0x8845('0x3e')]=qs['filters'](_[_0x8845('0x3f')](_0x12d31a[_0x8845('0x33')],_0x978bfc[_0x8845('0x35')]),_0x3f5cb0);if(_0x12d31a[_0x8845('0x33')][_0x8845('0x40')]){_0x16930b['where']=_[_0x8845('0x41')](_0x16930b[_0x8845('0x3e')],{'$or':_['map'](_0x3f5cb0,function(_0x3750f8){if(_0x3750f8[_0x8845('0x30')]!==_0x8845('0x42')){var _0x564830={};_0x564830[_0x3750f8[_0x8845('0x2b')]]={'$like':'%'+_0x12d31a[_0x8845('0x33')][_0x8845('0x40')]+'%'};return _0x564830;}})});}_0x16930b=_[_0x8845('0x41')]({},_0x16930b,_0x12d31a[_0x8845('0x43')]);var _0x1c9924={'where':_0x16930b[_0x8845('0x3e')]};return db[_0x8845('0x2e')]['count'](_0x1c9924)[_0x8845('0x27')](function(_0x4590d5){_0x51919c['count']=_0x4590d5;if(_0x12d31a[_0x8845('0x33')][_0x8845('0x44')]){_0x16930b[_0x8845('0x45')]=[{'all':!![]}];}return db[_0x8845('0x2e')]['findAll'](_0x16930b);})['then'](function(_0x2fe11d){_0x51919c[_0x8845('0x46')]=_0x2fe11d;return _0x51919c;})[_0x8845('0x27')](respondWithFilteredResult(_0x9e7ea4,_0x16930b))['catch'](handleError(_0x9e7ea4,null));};exports['show']=function(_0x5c7687,_0x54447e){var _0x18ec83={'raw':!![],'where':{'id':_0x5c7687[_0x8845('0x47')]['id']}},_0x19d5ac={};_0x19d5ac[_0x8845('0x32')]=_[_0x8845('0x34')](db[_0x8845('0x2e')][_0x8845('0x48')]);_0x19d5ac[_0x8845('0x33')]=_[_0x8845('0x34')](_0x5c7687[_0x8845('0x33')]);_0x19d5ac[_0x8845('0x35')]=_[_0x8845('0x36')](_0x19d5ac[_0x8845('0x32')],_0x19d5ac[_0x8845('0x33')]);_0x18ec83[_0x8845('0x38')]=_['intersection'](_0x19d5ac['model'],qs['fields'](_0x5c7687['query'][_0x8845('0x37')]));_0x18ec83[_0x8845('0x38')]=_0x18ec83[_0x8845('0x38')]['length']?_0x18ec83['attributes']:_0x19d5ac['model'];if(_0x5c7687[_0x8845('0x33')]['includeAll']){_0x18ec83[_0x8845('0x45')]=[{'all':!![]}];}_0x18ec83=_[_0x8845('0x41')]({},_0x18ec83,_0x5c7687[_0x8845('0x43')]);return db['Attachment'][_0x8845('0x49')](_0x18ec83)[_0x8845('0x27')](handleEntityNotFound(_0x54447e,null))[_0x8845('0x27')](respondWithResult(_0x54447e,null))[_0x8845('0x4a')](handleError(_0x54447e,null));};exports['clone']=function(_0x4aba3d,_0x4df1c9){var _0x41d3ae={'where':{'id':_0x4aba3d[_0x8845('0x47')]['id']}},_0x29ac7d={};_0x29ac7d[_0x8845('0x32')]=_[_0x8845('0x34')](db[_0x8845('0x2e')]['rawAttributes']);_0x41d3ae[_0x8845('0x38')]=_[_0x8845('0x36')](_0x29ac7d[_0x8845('0x32')],qs['fields'](_0x4aba3d[_0x8845('0x33')]['fields']));_0x41d3ae['attributes']=_0x41d3ae[_0x8845('0x38')][_0x8845('0x39')]?_0x41d3ae[_0x8845('0x38')]:_0x29ac7d['model'];if(_0x4aba3d[_0x8845('0x33')][_0x8845('0x44')]){_0x41d3ae[_0x8845('0x45')]=[{'all':!![]}];}_0x41d3ae=_['merge']({},_0x41d3ae,_0x4aba3d[_0x8845('0x43')]);return db[_0x8845('0x2e')]['find'](_0x41d3ae)[_0x8845('0x27')](handleEntityNotFound(_0x4df1c9,null))[_0x8845('0x27')](function(_0x4e393f){if(_0x4e393f){var _0x339721=_0x4e393f['get']({'plain':!![]});_0x339721=qs[_0x8845('0x4b')](_0x339721,['id','createdAt',_0x8845('0x4c')]);_0x4aba3d[_0x8845('0x4d')]=_['omit'](_0x4aba3d['body'],['id',_0x8845('0x4e'),_0x8845('0x4c')]);return db[_0x8845('0x2e')][_0x8845('0x4f')](_['merge'](_0x339721,_0x4aba3d[_0x8845('0x4d')]),{'include':_0x4aba3d['query']['includeAll']?[{'all':!![]}]:undefined});}})[_0x8845('0x27')](respondWithResult(_0x4df1c9,0xc9))[_0x8845('0x4a')](handleError(_0x4df1c9,null));};exports[_0x8845('0x26')]=function(_0x5ad5fd,_0x45f53a){if(_0x5ad5fd[_0x8845('0x4d')]['id']){delete _0x5ad5fd['body']['id'];}return db[_0x8845('0x2e')]['find']({'where':{'id':_0x5ad5fd[_0x8845('0x47')]['id']}})[_0x8845('0x27')](handleEntityNotFound(_0x45f53a,null))[_0x8845('0x27')](saveUpdates(_0x5ad5fd['body'],null))[_0x8845('0x27')](respondWithResult(_0x45f53a,null))['catch'](handleError(_0x45f53a,null));};exports['destroy']=function(_0x2af383,_0x1fef82){return db[_0x8845('0x2e')][_0x8845('0x49')]({'where':{'id':_0x2af383['params']['id']}})['then'](handleEntityNotFound(_0x1fef82,null))[_0x8845('0x27')](removeEntity(_0x1fef82,null))[_0x8845('0x4a')](handleError(_0x1fef82,null));};exports[_0x8845('0x4f')]=function(_0x2d42ac,_0x28e45c,_0x24c742){_0x2d42ac[_0x8845('0x4d')][_0x8845('0x2b')]=_0x2d42ac[_0x8845('0x50')]['originalname'];_0x2d42ac[_0x8845('0x4d')][_0x8845('0x51')]=_0x2d42ac[_0x8845('0x50')][_0x8845('0x52')];_0x2d42ac['body'][_0x8845('0x30')]=_0x2d42ac[_0x8845('0x50')]['mimetype'];return db['Attachment'][_0x8845('0x4f')](_0x2d42ac['body'])[_0x8845('0x27')](respondWithResult(_0x28e45c,0xc9))[_0x8845('0x4a')](handleError(_0x28e45c,null));};exports[_0x8845('0x53')]=function(_0x34f776,_0x21e12d,_0x4cf8b1){return db['Attachment'][_0x8845('0x54')]({'where':{'id':_0x34f776[_0x8845('0x47')]['id']},'raw':!![]})[_0x8845('0x27')](handleEntityNotFound(_0x21e12d,null))[_0x8845('0x27')](function(_0x35838b){if(_0x35838b){var _0x17d16e=_0x35838b[_0x8845('0x55')]!==null;var _0x17cb49=path['join'](config[_0x8845('0x56')],'server/files/attachments/');if(_0x17d16e){_0x17cb49=path[_0x8845('0x57')](_0x17cb49,_0x8845('0x58'));}var _0x7063bf=path[_0x8845('0x57')](_0x17cb49,_0x35838b[_0x8845('0x51')]);return _0x21e12d[_0x8845('0x53')](_0x7063bf);}})[_0x8845('0x4a')](handleError(_0x21e12d,null));}; \ No newline at end of file +var _0x0a4b=['merge','VIRTUAL','options','Attachment','rows','catch','includeAll','include','find','clone','params','get','createdAt','updatedAt','body','omit','create','file','originalname','basename','filename','mimetype','ChatOfflineMessageId','root','server/files/attachments/','join','download','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter'];(function(_0xa5e793,_0x4ab9b3){var _0x3e9490=function(_0x183c7b){while(--_0x183c7b){_0xa5e793['push'](_0xa5e793['shift']());}};_0x3e9490(++_0x4ab9b3);}(_0x0a4b,0x129));var _0xb0a4=function(_0x2e26fb,_0x31bf41){_0x2e26fb=_0x2e26fb-0x0;var _0x19978d=_0x0a4b[_0x2e26fb];return _0x19978d;};'use strict';var emlformat=require(_0xb0a4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb0a4('0x1'));var rp=require(_0xb0a4('0x2'));var moment=require(_0xb0a4('0x3'));var BPromise=require(_0xb0a4('0x4'));var Mustache=require(_0xb0a4('0x5'));var util=require(_0xb0a4('0x6'));var path=require(_0xb0a4('0x7'));var sox=require('sox');var csv=require(_0xb0a4('0x8'));var ejs=require(_0xb0a4('0x9'));var fs=require('fs');var fs_extra=require(_0xb0a4('0xa'));var _=require(_0xb0a4('0xb'));var squel=require(_0xb0a4('0xc'));var crypto=require('crypto');var jsforce=require(_0xb0a4('0xd'));var deskjs=require(_0xb0a4('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb0a4('0xf'));var Papa=require(_0xb0a4('0x10'));var Redis=require(_0xb0a4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb0a4('0x12'));var as=require(_0xb0a4('0x13'));var hardwareService=require(_0xb0a4('0x14'));var logger=require(_0xb0a4('0x15'))(_0xb0a4('0x16'));var utils=require(_0xb0a4('0x17'));var config=require(_0xb0a4('0x18'));var licenseUtil=require(_0xb0a4('0x19'));var db=require(_0xb0a4('0x1a'))['db'];function respondWithStatusCode(_0x5a605e,_0xdf3368){_0xdf3368=_0xdf3368||0xcc;return function(_0x54a648){if(_0x54a648){return _0x5a605e[_0xb0a4('0x1b')](_0xdf3368);}return _0x5a605e[_0xb0a4('0x1c')](_0xdf3368)[_0xb0a4('0x1d')]();};}function respondWithResult(_0x40932e,_0x522f3d){_0x522f3d=_0x522f3d||0xc8;return function(_0x33f1b9){if(_0x33f1b9){return _0x40932e['status'](_0x522f3d)[_0xb0a4('0x1e')](_0x33f1b9);}};}function respondWithFilteredResult(_0x4a183a,_0x2aa9c9){return function(_0x385fe5){if(_0x385fe5){var _0x15ceee=typeof _0x2aa9c9[_0xb0a4('0x1f')]==='undefined'&&typeof _0x2aa9c9['limit']==='undefined';var _0x50147e=_0x385fe5[_0xb0a4('0x20')];var _0x46bd79=_0x15ceee?0x0:_0x2aa9c9[_0xb0a4('0x1f')];var _0x1b0cb7=_0x15ceee?_0x385fe5[_0xb0a4('0x20')]:_0x2aa9c9['offset']+_0x2aa9c9[_0xb0a4('0x21')];var _0x1dac36;if(_0x1b0cb7>=_0x50147e){_0x1b0cb7=_0x50147e;_0x1dac36=0xc8;}else{_0x1dac36=0xce;}_0x4a183a['status'](_0x1dac36);return _0x4a183a['set'](_0xb0a4('0x22'),_0x46bd79+'-'+_0x1b0cb7+'/'+_0x50147e)['json'](_0x385fe5);}return null;};}function patchUpdates(_0x1b2620){return function(_0x2fb12d){try{jsonpatch[_0xb0a4('0x23')](_0x2fb12d,_0x1b2620,!![]);}catch(_0x589099){return BPromise[_0xb0a4('0x24')](_0x589099);}return _0x2fb12d[_0xb0a4('0x25')]();};}function saveUpdates(_0x87f3b8,_0x2e30aa){return function(_0xdef65a){if(_0xdef65a){return _0xdef65a[_0xb0a4('0x26')](_0x87f3b8)[_0xb0a4('0x27')](function(_0x309fcd){return _0x309fcd;});}return null;};}function removeEntity(_0x36f6b8,_0x3d90f1){return function(_0x85291c){if(_0x85291c){return _0x85291c[_0xb0a4('0x28')]()[_0xb0a4('0x27')](function(){_0x36f6b8[_0xb0a4('0x1c')](0xcc)[_0xb0a4('0x1d')]();});}};}function handleEntityNotFound(_0x1d5b7f,_0x1675b2){return function(_0x4d0afe){if(!_0x4d0afe){_0x1d5b7f[_0xb0a4('0x1b')](0x194);}return _0x4d0afe;};}function handleError(_0x577d2b,_0x381eac){_0x381eac=_0x381eac||0x1f4;return function(_0x11f178){logger[_0xb0a4('0x29')](_0x11f178[_0xb0a4('0x2a')]);if(_0x11f178[_0xb0a4('0x2b')]){delete _0x11f178[_0xb0a4('0x2b')];}_0x577d2b[_0xb0a4('0x1c')](_0x381eac)[_0xb0a4('0x2c')](_0x11f178);};}exports[_0xb0a4('0x2d')]=function(_0x425347,_0x112a05){var _0x178511={},_0x80e3b7={},_0x4b8b36={'count':0x0,'rows':[]};var _0x4634ba=_['map'](db['Attachment'][_0xb0a4('0x2e')],function(_0x388e4d){return{'name':_0x388e4d[_0xb0a4('0x2f')],'type':_0x388e4d[_0xb0a4('0x30')]['key']};});_0x80e3b7[_0xb0a4('0x31')]=_[_0xb0a4('0x32')](_0x4634ba,_0xb0a4('0x2b'));_0x80e3b7['query']=_[_0xb0a4('0x33')](_0x425347[_0xb0a4('0x34')]);_0x80e3b7[_0xb0a4('0x35')]=_[_0xb0a4('0x36')](_0x80e3b7[_0xb0a4('0x31')],_0x80e3b7[_0xb0a4('0x34')]);_0x178511[_0xb0a4('0x37')]=_['intersection'](_0x80e3b7[_0xb0a4('0x31')],qs[_0xb0a4('0x38')](_0x425347[_0xb0a4('0x34')][_0xb0a4('0x38')]));_0x178511['attributes']=_0x178511[_0xb0a4('0x37')][_0xb0a4('0x39')]?_0x178511[_0xb0a4('0x37')]:_0x80e3b7[_0xb0a4('0x31')];if(!_0x425347['query'][_0xb0a4('0x3a')]('nolimit')){_0x178511[_0xb0a4('0x21')]=qs[_0xb0a4('0x21')](_0x425347[_0xb0a4('0x34')][_0xb0a4('0x21')]);_0x178511[_0xb0a4('0x1f')]=qs['offset'](_0x425347['query'][_0xb0a4('0x1f')]);}_0x178511['order']=qs[_0xb0a4('0x3b')](_0x425347['query'][_0xb0a4('0x3b')]);_0x178511[_0xb0a4('0x3c')]=qs[_0xb0a4('0x35')](_[_0xb0a4('0x3d')](_0x425347[_0xb0a4('0x34')],_0x80e3b7[_0xb0a4('0x35')]),_0x4634ba);if(_0x425347['query'][_0xb0a4('0x3e')]){_0x178511[_0xb0a4('0x3c')]=_[_0xb0a4('0x3f')](_0x178511[_0xb0a4('0x3c')],{'$or':_['map'](_0x4634ba,function(_0x4bd2bf){if(_0x4bd2bf[_0xb0a4('0x30')]!==_0xb0a4('0x40')){var _0x51c0da={};_0x51c0da[_0x4bd2bf[_0xb0a4('0x2b')]]={'$like':'%'+_0x425347[_0xb0a4('0x34')][_0xb0a4('0x3e')]+'%'};return _0x51c0da;}})});}_0x178511=_['merge']({},_0x178511,_0x425347[_0xb0a4('0x41')]);var _0x1545d7={'where':_0x178511[_0xb0a4('0x3c')]};return db[_0xb0a4('0x42')][_0xb0a4('0x20')](_0x1545d7)[_0xb0a4('0x27')](function(_0x9c1fbe){_0x4b8b36[_0xb0a4('0x20')]=_0x9c1fbe;if(_0x425347['query']['includeAll']){_0x178511['include']=[{'all':!![]}];}return db[_0xb0a4('0x42')]['findAll'](_0x178511);})['then'](function(_0x512d82){_0x4b8b36[_0xb0a4('0x43')]=_0x512d82;return _0x4b8b36;})['then'](respondWithFilteredResult(_0x112a05,_0x178511))[_0xb0a4('0x44')](handleError(_0x112a05,null));};exports['show']=function(_0x2c3e93,_0x356f7f){var _0x308a26={'raw':!![],'where':{'id':_0x2c3e93['params']['id']}},_0x22b88a={};_0x22b88a['model']=_['keys'](db[_0xb0a4('0x42')][_0xb0a4('0x2e')]);_0x22b88a[_0xb0a4('0x34')]=_[_0xb0a4('0x33')](_0x2c3e93[_0xb0a4('0x34')]);_0x22b88a['filters']=_[_0xb0a4('0x36')](_0x22b88a[_0xb0a4('0x31')],_0x22b88a[_0xb0a4('0x34')]);_0x308a26[_0xb0a4('0x37')]=_[_0xb0a4('0x36')](_0x22b88a[_0xb0a4('0x31')],qs[_0xb0a4('0x38')](_0x2c3e93[_0xb0a4('0x34')][_0xb0a4('0x38')]));_0x308a26[_0xb0a4('0x37')]=_0x308a26[_0xb0a4('0x37')][_0xb0a4('0x39')]?_0x308a26[_0xb0a4('0x37')]:_0x22b88a[_0xb0a4('0x31')];if(_0x2c3e93[_0xb0a4('0x34')][_0xb0a4('0x45')]){_0x308a26[_0xb0a4('0x46')]=[{'all':!![]}];}_0x308a26=_[_0xb0a4('0x3f')]({},_0x308a26,_0x2c3e93[_0xb0a4('0x41')]);return db['Attachment'][_0xb0a4('0x47')](_0x308a26)[_0xb0a4('0x27')](handleEntityNotFound(_0x356f7f,null))[_0xb0a4('0x27')](respondWithResult(_0x356f7f,null))[_0xb0a4('0x44')](handleError(_0x356f7f,null));};exports[_0xb0a4('0x48')]=function(_0x1212f4,_0x2112d8){var _0x14357e={'where':{'id':_0x1212f4[_0xb0a4('0x49')]['id']}},_0x668623={};_0x668623[_0xb0a4('0x31')]=_[_0xb0a4('0x33')](db[_0xb0a4('0x42')][_0xb0a4('0x2e')]);_0x14357e[_0xb0a4('0x37')]=_[_0xb0a4('0x36')](_0x668623[_0xb0a4('0x31')],qs['fields'](_0x1212f4[_0xb0a4('0x34')][_0xb0a4('0x38')]));_0x14357e[_0xb0a4('0x37')]=_0x14357e['attributes'][_0xb0a4('0x39')]?_0x14357e[_0xb0a4('0x37')]:_0x668623[_0xb0a4('0x31')];if(_0x1212f4[_0xb0a4('0x34')]['includeAll']){_0x14357e['include']=[{'all':!![]}];}_0x14357e=_[_0xb0a4('0x3f')]({},_0x14357e,_0x1212f4['options']);return db['Attachment'][_0xb0a4('0x47')](_0x14357e)[_0xb0a4('0x27')](handleEntityNotFound(_0x2112d8,null))[_0xb0a4('0x27')](function(_0x36939e){if(_0x36939e){var _0x3c7b78=_0x36939e[_0xb0a4('0x4a')]({'plain':!![]});_0x3c7b78=qs['omit'](_0x3c7b78,['id',_0xb0a4('0x4b'),_0xb0a4('0x4c')]);_0x1212f4[_0xb0a4('0x4d')]=_[_0xb0a4('0x4e')](_0x1212f4[_0xb0a4('0x4d')],['id','createdAt',_0xb0a4('0x4c')]);return db[_0xb0a4('0x42')][_0xb0a4('0x4f')](_[_0xb0a4('0x3f')](_0x3c7b78,_0x1212f4[_0xb0a4('0x4d')]),{'include':_0x1212f4[_0xb0a4('0x34')][_0xb0a4('0x45')]?[{'all':!![]}]:undefined});}})[_0xb0a4('0x27')](respondWithResult(_0x2112d8,0xc9))[_0xb0a4('0x44')](handleError(_0x2112d8,null));};exports[_0xb0a4('0x26')]=function(_0x44e0be,_0x39dd14){if(_0x44e0be[_0xb0a4('0x4d')]['id']){delete _0x44e0be[_0xb0a4('0x4d')]['id'];}return db[_0xb0a4('0x42')]['find']({'where':{'id':_0x44e0be[_0xb0a4('0x49')]['id']}})[_0xb0a4('0x27')](handleEntityNotFound(_0x39dd14,null))[_0xb0a4('0x27')](saveUpdates(_0x44e0be[_0xb0a4('0x4d')],null))[_0xb0a4('0x27')](respondWithResult(_0x39dd14,null))[_0xb0a4('0x44')](handleError(_0x39dd14,null));};exports['destroy']=function(_0x3f5a55,_0x419543){return db[_0xb0a4('0x42')][_0xb0a4('0x47')]({'where':{'id':_0x3f5a55['params']['id']}})[_0xb0a4('0x27')](handleEntityNotFound(_0x419543,null))[_0xb0a4('0x27')](removeEntity(_0x419543,null))[_0xb0a4('0x44')](handleError(_0x419543,null));};exports['create']=function(_0x20c137,_0x42a52d,_0x5d8cb4){_0x20c137[_0xb0a4('0x4d')][_0xb0a4('0x2b')]=_0x20c137[_0xb0a4('0x50')][_0xb0a4('0x51')];_0x20c137[_0xb0a4('0x4d')][_0xb0a4('0x52')]=_0x20c137[_0xb0a4('0x50')][_0xb0a4('0x53')];_0x20c137[_0xb0a4('0x4d')][_0xb0a4('0x30')]=_0x20c137[_0xb0a4('0x50')][_0xb0a4('0x54')];return db[_0xb0a4('0x42')][_0xb0a4('0x4f')](_0x20c137['body'])[_0xb0a4('0x27')](respondWithResult(_0x42a52d,0xc9))[_0xb0a4('0x44')](handleError(_0x42a52d,null));};exports['download']=function(_0x55d7c8,_0x5d2081,_0x41146d){return db[_0xb0a4('0x42')]['findOne']({'where':{'id':_0x55d7c8['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x5d2081,null))[_0xb0a4('0x27')](function(_0x279c65){if(_0x279c65){var _0x412be6=_0x279c65[_0xb0a4('0x55')]!==null;var _0x354cbf=path['join'](config[_0xb0a4('0x56')],_0xb0a4('0x57'));if(_0x412be6){_0x354cbf=path[_0xb0a4('0x58')](_0x354cbf,'offline-chat/');}var _0x4b9def=path[_0xb0a4('0x58')](_0x354cbf,_0x279c65[_0xb0a4('0x52')]);return _0x5d2081[_0xb0a4('0x59')](_0x4b9def);}})['catch'](handleError(_0x5d2081,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 6cd9d47..3725a93 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 _0x3bcd=['attachments','lodash','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x418347,_0x309966){var _0x5d17e6=function(_0x57064c){while(--_0x57064c){_0x418347['push'](_0x418347['shift']());}};_0x5d17e6(++_0x309966);}(_0x3bcd,0x118));var _0xd3bc=function(_0x2acbb3,_0x29e1b4){_0x2acbb3=_0x2acbb3-0x0;var _0x5c0cc7=_0x3bcd[_0x2acbb3];return _0x5c0cc7;};'use strict';var _=require(_0xd3bc('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xd3bc('0x1'));var BPromise=require('bluebird');var rp=require(_0xd3bc('0x2'));var fs=require('fs');var path=require(_0xd3bc('0x3'));var rimraf=require(_0xd3bc('0x4'));var config=require(_0xd3bc('0x5'));var attributes=require('./attachment.attributes');module[_0xd3bc('0x6')]=function(_0x3ef738,_0x5aba9d){return _0x3ef738[_0xd3bc('0x7')]('Attachment',attributes,{'tableName':_0xd3bc('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb72b=['./attachment.attributes','exports','attachments','util','../../config/logger','api','request-promise','path','../../config/environment'];(function(_0x288867,_0x5c48a8){var _0x1a6b2e=function(_0x546727){while(--_0x546727){_0x288867['push'](_0x288867['shift']());}};_0x1a6b2e(++_0x5c48a8);}(_0xb72b,0x1a1));var _0xbb72=function(_0x559209,_0x2b2ecf){_0x559209=_0x559209-0x0;var _0x234e76=_0xb72b[_0x559209];return _0x234e76;};'use strict';var _=require('lodash');var util=require(_0xbb72('0x0'));var logger=require(_0xbb72('0x1'))(_0xbb72('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbb72('0x3'));var fs=require('fs');var path=require(_0xbb72('0x4'));var rimraf=require('rimraf');var config=require(_0xbb72('0x5'));var attributes=require(_0xbb72('0x6'));module[_0xbb72('0x7')]=function(_0x5808d3,_0x528024){return _0x5808d3['define']('Attachment',attributes,{'tableName':_0xbb72('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 6ac86ed..5c991fc 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 _0x0e9f=['info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','Attachment,\x20%s,\x20%s','message','catch','CreateAttachment','create','body','options','lodash','util','randomstring','../../config/utils','../../config/environment','jayson/promise','http','then'];(function(_0x10c9d1,_0x456b1b){var _0x517fad=function(_0x58a7de){while(--_0x58a7de){_0x10c9d1['push'](_0x10c9d1['shift']());}};_0x517fad(++_0x456b1b);}(_0x0e9f,0x116));var _0xf0e9=function(_0x25dcea,_0x4b9d89){_0x25dcea=_0x25dcea-0x0;var _0x5cb527=_0x0e9f[_0x25dcea];return _0x5cb527;};'use strict';var _=require(_0xf0e9('0x0'));var util=require(_0xf0e9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf0e9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf0e9('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xf0e9('0x4'));var jayson=require(_0xf0e9('0x5'));var client=jayson['client'][_0xf0e9('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4a35a3,_0x3f9792,_0x2fa08f){return new BPromise(function(_0x106ba0,_0x58edfe){return client['request'](_0x4a35a3,_0x2fa08f)[_0xf0e9('0x7')](function(_0x7b3146){logger[_0xf0e9('0x8')]('Attachment,\x20%s,\x20%s',_0x3f9792,_0xf0e9('0x9'));logger[_0xf0e9('0xa')](_0xf0e9('0xb'),_0x3f9792,'request\x20sent',JSON[_0xf0e9('0xc')](_0x7b3146));if(_0x7b3146[_0xf0e9('0xd')]){if(_0x7b3146[_0xf0e9('0xd')][_0xf0e9('0xe')]===0x1f4){logger['error'](_0xf0e9('0xf'),_0x3f9792,_0x7b3146['error'][_0xf0e9('0x10')]);return _0x58edfe(_0x7b3146[_0xf0e9('0xd')]['message']);}logger[_0xf0e9('0xd')](_0xf0e9('0xf'),_0x3f9792,_0x7b3146[_0xf0e9('0xd')][_0xf0e9('0x10')]);return _0x106ba0(_0x7b3146[_0xf0e9('0xd')][_0xf0e9('0x10')]);}else{logger['info'](_0xf0e9('0xf'),_0x3f9792,_0xf0e9('0x9'));_0x106ba0(_0x7b3146['result'][_0xf0e9('0x10')]);}})[_0xf0e9('0x11')](function(_0x3d0b4d){logger[_0xf0e9('0xd')]('Attachment,\x20%s,\x20%s',_0x3f9792,_0x3d0b4d);_0x58edfe(_0x3d0b4d);});});}exports[_0xf0e9('0x12')]=function(_0x2f4ee3){var _0x232115=this;return new Promise(function(_0x2987a1,_0x5444bc){return db['Attachment'][_0xf0e9('0x13')](_0x2f4ee3[_0xf0e9('0x14')],{'raw':_0x2f4ee3[_0xf0e9('0x15')]?_0x2f4ee3['options']['raw']===undefined?!![]:![]:!![]})[_0xf0e9('0x7')](function(_0x1ac91f){logger['info'](_0xf0e9('0x12'),_0x2f4ee3);logger['debug'](_0xf0e9('0x12'),_0x2f4ee3,JSON[_0xf0e9('0xc')](_0x1ac91f));_0x2987a1(_0x1ac91f);})['catch'](function(_0x5dd652){logger[_0xf0e9('0xd')](_0xf0e9('0x12'),_0x5dd652['message'],_0x2f4ee3);_0x5444bc(_0x232115[_0xf0e9('0xd')](0x1f4,_0x5dd652[_0xf0e9('0x10')]));});});}; \ No newline at end of file +var _0xcabc=['error','code','message','result','catch','CreateAttachment','Attachment','create','body','raw','then','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x3f1041,_0x3c9c76){var _0xb29e0f=function(_0x60db72){while(--_0x60db72){_0x3f1041['push'](_0x3f1041['shift']());}};_0xb29e0f(++_0x3c9c76);}(_0xcabc,0x16a));var _0xccab=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xcabc[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0xccab('0x0'));var moment=require(_0xccab('0x1'));var BPromise=require(_0xccab('0x2'));var rs=require(_0xccab('0x3'));var fs=require('fs');var Redis=require(_0xccab('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xccab('0x5'));var logger=require(_0xccab('0x6'))('rpc');var config=require(_0xccab('0x7'));var jayson=require(_0xccab('0x8'));var client=jayson[_0xccab('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x112ab8,_0x29f877,_0x24b95c){return new BPromise(function(_0x4a6f3c,_0x2c43fa){return client[_0xccab('0xa')](_0x112ab8,_0x24b95c)['then'](function(_0x401b85){logger[_0xccab('0xb')](_0xccab('0xc'),_0x29f877,_0xccab('0xd'));logger[_0xccab('0xe')]('Attachment,\x20%s,\x20%s,\x20%s',_0x29f877,'request\x20sent',JSON[_0xccab('0xf')](_0x401b85));if(_0x401b85[_0xccab('0x10')]){if(_0x401b85[_0xccab('0x10')][_0xccab('0x11')]===0x1f4){logger[_0xccab('0x10')](_0xccab('0xc'),_0x29f877,_0x401b85[_0xccab('0x10')]['message']);return _0x2c43fa(_0x401b85[_0xccab('0x10')][_0xccab('0x12')]);}logger['error'](_0xccab('0xc'),_0x29f877,_0x401b85['error']['message']);return _0x4a6f3c(_0x401b85[_0xccab('0x10')][_0xccab('0x12')]);}else{logger[_0xccab('0xb')]('Attachment,\x20%s,\x20%s',_0x29f877,_0xccab('0xd'));_0x4a6f3c(_0x401b85[_0xccab('0x13')]['message']);}})[_0xccab('0x14')](function(_0x333142){logger[_0xccab('0x10')](_0xccab('0xc'),_0x29f877,_0x333142);_0x2c43fa(_0x333142);});});}exports[_0xccab('0x15')]=function(_0x5157c6){var _0x4ba1c2=this;return new Promise(function(_0x1960e7,_0x5e1eeb){return db[_0xccab('0x16')][_0xccab('0x17')](_0x5157c6[_0xccab('0x18')],{'raw':_0x5157c6['options']?_0x5157c6['options'][_0xccab('0x19')]===undefined?!![]:![]:!![]})[_0xccab('0x1a')](function(_0x459090){logger['info'](_0xccab('0x15'),_0x5157c6);logger['debug'](_0xccab('0x15'),_0x5157c6,JSON[_0xccab('0xf')](_0x459090));_0x1960e7(_0x459090);})['catch'](function(_0x32c852){logger[_0xccab('0x10')](_0xccab('0x15'),_0x32c852[_0xccab('0x12')],_0x5157c6);_0x5e1eeb(_0x4ba1c2[_0xccab('0x10')](0x1f4,_0x32c852[_0xccab('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 6b58d80..3b9a467 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 _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4bdf64,_0x3022b2){_0x4bdf64=_0x4bdf64-0x0;var _0x9a1a19=_0x0b0e[_0x4bdf64];return _0x9a1a19;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file +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(_0x2103a3,_0x588bd6){var _0x2f7915=function(_0x44bab4){while(--_0x44bab4){_0x2103a3['push'](_0x2103a3['shift']());}};_0x2f7915(++_0x588bd6);}(_0xb10b,0x12a));var _0xbb10=function(_0x430524,_0x23b611){_0x430524=_0x430524-0x0;var _0x3a726d=_0xb10b[_0x430524];return _0x3a726d;};'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 diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index eb7aa5b..f23085a 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 _0x0ee7=['agent','blocked','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','lodash','passport','moment','../../config/environment','../../components/auth/service','signToken','login','authenticate','google','/login','email','callback','use','clientID','secret','callbackURL','Setting','allowedLoginAttempts','blockDuration','then','User','find','map','emails','user'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0ee7,0x82));var _0x70ee=function(_0x14ed05,_0x5c55c4){_0x14ed05=_0x14ed05-0x0;var _0x2ea7c6=_0x0ee7[_0x14ed05];return _0x2ea7c6;};'use strict';var _=require(_0x70ee('0x0'));var passport=require(_0x70ee('0x1'));var GoogleStrategy=require('passport-google-oauth20')['Strategy'];var moment=require(_0x70ee('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x70ee('0x3'));var signToken=require(_0x70ee('0x4'))[_0x70ee('0x5')];var utils=require('../../config/utils');exports[_0x70ee('0x6')]=passport[_0x70ee('0x7')](_0x70ee('0x8'),{'failureRedirect':_0x70ee('0x9'),'scope':['profile',_0x70ee('0xa')],'session':![]});exports[_0x70ee('0xb')]=passport[_0x70ee('0x7')](_0x70ee('0x8'),{'failureRedirect':_0x70ee('0x9'),'session':![]});passport[_0x70ee('0xc')](new GoogleStrategy({'clientID':config[_0x70ee('0x8')]?config[_0x70ee('0x8')][_0x70ee('0xd')]:'id','clientSecret':config['google']?config[_0x70ee('0x8')]['clientSecret']:_0x70ee('0xe'),'callbackURL':config[_0x70ee('0x8')]?config['google'][_0x70ee('0xf')]:''},function(_0x560b3e,_0x5eda1d,_0xbc488c,_0x1070e1){var _0x432738,_0x3d8b5d;return db[_0x70ee('0x10')]['findOne']({'where':{'id':0x1},'attributes':[_0x70ee('0x11'),_0x70ee('0x12')],'raw':!![]})[_0x70ee('0x13')](function(_0x4e2b4b){_0x432738=_0x4e2b4b;return db[_0x70ee('0x14')][_0x70ee('0x15')]({'where':{'email':_[_0x70ee('0x16')](_0xbc488c[_0x70ee('0x17')],'value'),'role':{'$or':['admin',_0x70ee('0x18'),_0x70ee('0x19')]}}});})[_0x70ee('0x13')](function(_0x199c04){_0x3d8b5d=_0x199c04;if(_0x3d8b5d){if(_0x3d8b5d['disabled']){return _0x1070e1('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x432738[_0x70ee('0x12')]>0x0){if(_0x3d8b5d[_0x70ee('0x1a')]){if(moment(_0x3d8b5d['blockedAt'])['add'](_0x432738[_0x70ee('0x12')],_0x70ee('0x1b'))>moment()){return _0x1070e1(_0x70ee('0x1c'));}else{return utils[_0x70ee('0x1d')](_0x3d8b5d,0x0,![],null)[_0x70ee('0x13')](function(){return utils[_0x70ee('0x1e')](_0x3d8b5d);})[_0x70ee('0x13')](function(){return _0x1070e1(null,_0x3d8b5d);});}}else{return utils['getLicense'](_0x3d8b5d)['then'](function(){return _0x1070e1(null,_0x3d8b5d);});}}else{return utils[_0x70ee('0x1e')](_0x3d8b5d)[_0x70ee('0x13')](function(){return _0x1070e1(null,_0x3d8b5d);});}}return _0x1070e1(_0x70ee('0x1c'));})['catch'](function(_0x5bb12e){_0x1070e1(_0x5bb12e);});})); \ No newline at end of file +var _0xfc46=['Strategy','moment','../../mysqldb','../../config/environment','signToken','../../config/utils','login','authenticate','google','profile','email','/login','use','clientID','clientSecret','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.','blocked','add','minutes','clearBlockUser','getLicense','lodash','passport-google-oauth20'];(function(_0x1e4b5a,_0x3e8dcc){var _0x2abfce=function(_0x5a667e){while(--_0x5a667e){_0x1e4b5a['push'](_0x1e4b5a['shift']());}};_0x2abfce(++_0x3e8dcc);}(_0xfc46,0x18a));var _0x6fc4=function(_0x1b4c04,_0x8d961d){_0x1b4c04=_0x1b4c04-0x0;var _0x374f5d=_0xfc46[_0x1b4c04];return _0x374f5d;};'use strict';var _=require(_0x6fc4('0x0'));var passport=require('passport');var GoogleStrategy=require(_0x6fc4('0x1'))[_0x6fc4('0x2')];var moment=require(_0x6fc4('0x3'));var db=require(_0x6fc4('0x4'))['db'];var config=require(_0x6fc4('0x5'));var signToken=require('../../components/auth/service')[_0x6fc4('0x6')];var utils=require(_0x6fc4('0x7'));exports[_0x6fc4('0x8')]=passport[_0x6fc4('0x9')](_0x6fc4('0xa'),{'failureRedirect':'/login','scope':[_0x6fc4('0xb'),_0x6fc4('0xc')],'session':![]});exports['callback']=passport[_0x6fc4('0x9')](_0x6fc4('0xa'),{'failureRedirect':_0x6fc4('0xd'),'session':![]});passport[_0x6fc4('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x6fc4('0xa')][_0x6fc4('0xf')]:'id','clientSecret':config['google']?config[_0x6fc4('0xa')][_0x6fc4('0x10')]:_0x6fc4('0x11'),'callbackURL':config[_0x6fc4('0xa')]?config['google'][_0x6fc4('0x12')]:''},function(_0x559173,_0x2840e7,_0x48bba9,_0x333eb9){var _0x3e022b,_0x4d5cc5;return db['Setting'][_0x6fc4('0x13')]({'where':{'id':0x1},'attributes':[_0x6fc4('0x14'),_0x6fc4('0x15')],'raw':!![]})[_0x6fc4('0x16')](function(_0x163a8){_0x3e022b=_0x163a8;return db[_0x6fc4('0x17')][_0x6fc4('0x18')]({'where':{'email':_[_0x6fc4('0x19')](_0x48bba9['emails'],_0x6fc4('0x1a')),'role':{'$or':[_0x6fc4('0x1b'),_0x6fc4('0x1c'),_0x6fc4('0x1d')]}}});})[_0x6fc4('0x16')](function(_0x32302a){_0x4d5cc5=_0x32302a;if(_0x4d5cc5){if(_0x4d5cc5['disabled']){return _0x333eb9(_0x6fc4('0x1e'));}else if(_0x3e022b['blockDuration']>0x0){if(_0x4d5cc5[_0x6fc4('0x1f')]){if(moment(_0x4d5cc5['blockedAt'])[_0x6fc4('0x20')](_0x3e022b[_0x6fc4('0x15')],_0x6fc4('0x21'))>moment()){return _0x333eb9(_0x6fc4('0x1e'));}else{return utils[_0x6fc4('0x22')](_0x4d5cc5,0x0,![],null)[_0x6fc4('0x16')](function(){return utils['getLicense'](_0x4d5cc5);})[_0x6fc4('0x16')](function(){return _0x333eb9(null,_0x4d5cc5);});}}else{return utils[_0x6fc4('0x23')](_0x4d5cc5)['then'](function(){return _0x333eb9(null,_0x4d5cc5);});}}else{return utils[_0x6fc4('0x23')](_0x4d5cc5)[_0x6fc4('0x16')](function(){return _0x333eb9(null,_0x4d5cc5);});}}return _0x333eb9(_0x6fc4('0x1e'));})['catch'](function(_0x3dfdc5){_0x333eb9(_0x3dfdc5);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 47ed3a5..a2e391e 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 _0x08bb=['login','setTokenCookie','exports','express','passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','/callback','callback','isMiddleware'];(function(_0x7bc63a,_0x26422a){var _0xed898e=function(_0x4a222a){while(--_0x4a222a){_0x7bc63a['push'](_0x7bc63a['shift']());}};_0xed898e(++_0x26422a);}(_0x08bb,0x177));var _0xb08b=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x08bb[_0x13e741];return _0x3f8bb3;};'use strict';var express=require(_0xb08b('0x0'));var passport=require(_0xb08b('0x1'));var router=express['Router']();var controller=require(_0xb08b('0x2'));var userController=require(_0xb08b('0x3'));var authService=require(_0xb08b('0x4'));router[_0xb08b('0x5')]('/',controller['login']);router[_0xb08b('0x5')](_0xb08b('0x6'),controller[_0xb08b('0x7')],authService[_0xb08b('0x8')],userController[_0xb08b('0x9')],authService[_0xb08b('0xa')]);module[_0xb08b('0xb')]=router; \ No newline at end of file +var _0xba07=['isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback'];(function(_0x43bb39,_0x19e9dd){var _0x52cdba=function(_0x4f071d){while(--_0x4f071d){_0x43bb39['push'](_0x43bb39['shift']());}};_0x52cdba(++_0x19e9dd);}(_0xba07,0xc6));var _0x7ba0=function(_0x2932d9,_0x431abd){_0x2932d9=_0x2932d9-0x0;var _0x2cc783=_0xba07[_0x2932d9];return _0x2cc783;};'use strict';var express=require(_0x7ba0('0x0'));var passport=require(_0x7ba0('0x1'));var router=express[_0x7ba0('0x2')]();var controller=require(_0x7ba0('0x3'));var userController=require(_0x7ba0('0x4'));var authService=require(_0x7ba0('0x5'));router[_0x7ba0('0x6')]('/',controller[_0x7ba0('0x7')]);router[_0x7ba0('0x6')](_0x7ba0('0x8'),controller[_0x7ba0('0x9')],authService[_0x7ba0('0xa')],userController['login'],authService[_0x7ba0('0xb')]);module[_0x7ba0('0xc')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 7c312ad..12e7378 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 _0x6489=['secure','user','pass','\x22%s\x22\x20<%s>','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','online','forgot','body','generate','trim','toLowerCase','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','reset','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordPattern','password','Password\x20reset!','use','util','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','then','name','salt','blocked','blockedAt','loginAttempts','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','blockDuration','minutes','clearBlockUser','add','getLicense','catch','MailAccount','email','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','port'];(function(_0x3af00b,_0x4aeeaa){var _0x48df81=function(_0x3d0cc7){while(--_0x3d0cc7){_0x3af00b['push'](_0x3af00b['shift']());}};_0x48df81(++_0x4aeeaa);}(_0x6489,0x124));var _0x9648=function(_0x20d579,_0x3f72ea){_0x20d579=_0x20d579-0x0;var _0x5e46a9=_0x6489[_0x20d579];return _0x5e46a9;};'use strict';var util=require(_0x9648('0x0'));var passport=require('passport');var LocalStrategy=require(_0x9648('0x1'))[_0x9648('0x2')];var jayson=require(_0x9648('0x3'));var _=require(_0x9648('0x4'));var rs=require(_0x9648('0x5'));var moment=require(_0x9648('0x6'));var db=require(_0x9648('0x7'))['db'];var authService=require(_0x9648('0x8'));var utils=require(_0x9648('0x9'));var client=jayson['client'][_0x9648('0xa')]({'port':0x232b});function localAuthenticate(_0x311100,_0x5b4d0a,_0x1bc58b,_0x30fb87){var _0x32fa7b,_0xd9e838;return db[_0x9648('0xb')][_0x9648('0xc')]({'where':{'id':0x1},'attributes':[_0x9648('0xd'),'blockDuration'],'raw':!![]})[_0x9648('0xe')](function(_0x3fb805){_0x32fa7b=_0x3fb805;return _0x311100[_0x9648('0xc')]({'attributes':['id',_0x9648('0xf'),'password',_0x9648('0x10'),'role','disabled',_0x9648('0x11'),_0x9648('0x12'),_0x9648('0x13')],'where':{'name':_0x5b4d0a,'role':{'$or':['admin','user','agent']}}});})['then'](function(_0x2ef816){if(!_0x2ef816||_0x2ef816&&_0x2ef816[_0x9648('0xf')]!==_0x5b4d0a){throw new Error(_0x9648('0x14'));}else{_0xd9e838=_0x2ef816;return _0xd9e838;}})[_0x9648('0xe')](function(){_0xd9e838[_0x9648('0x15')](_0x1bc58b,function(_0x233785,_0x37f2c8){var _0x28f84f=_0xd9e838[_0x9648('0x13')]+0x1;if(_0x233785){return _0x30fb87(_0x233785);}else if(!_0x37f2c8){if(_0xd9e838[_0x9648('0x16')]){return _0x30fb87(null,![],{'message':_0x9648('0x14')});}else if(_0x32fa7b[_0x9648('0xd')]>0x0){if(_0xd9e838[_0x9648('0x11')]){if(_0x32fa7b[_0x9648('0x17')]>0x0){if(moment(_0xd9e838[_0x9648('0x12')])['add'](_0x32fa7b[_0x9648('0x17')],_0x9648('0x18'))>moment()){return _0x30fb87(null,![],{'message':_0x9648('0x14')});}else{return utils['clearBlockUser'](_0xd9e838,_0x28f84f,![],null)['then'](function(){return _0x30fb87(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x30fb87(null,![],{'message':_0x9648('0x14')});}}else{if(_0x28f84f>=_0x32fa7b[_0x9648('0xd')]){return utils[_0x9648('0x19')](_0xd9e838,0x0,!![],moment())['then'](function(){return _0x30fb87(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0xd9e838,_0x28f84f,![],null)[_0x9648('0xe')](function(){return _0x30fb87(null,![],{'message':_0x9648('0x14')});});}}}else{return _0x30fb87(null,![],{'message':_0x9648('0x14')});}}else{if(_0xd9e838[_0x9648('0x16')]){return _0x30fb87(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x32fa7b['allowedLoginAttempts']>0x0){if(_0xd9e838[_0x9648('0x11')]){if(_0x32fa7b['blockDuration']>0x0){if(moment(_0xd9e838[_0x9648('0x12')])[_0x9648('0x1a')](_0x32fa7b[_0x9648('0x17')],_0x9648('0x18'))>moment()){return _0x30fb87(null,![],{'message':_0x9648('0x14')});}else{return utils[_0x9648('0x19')](_0xd9e838,0x0,![],null)[_0x9648('0xe')](function(){return utils[_0x9648('0x1b')](_0xd9e838);})[_0x9648('0xe')](function(){return _0x30fb87(null,_0xd9e838);});}}else{return _0x30fb87(null,![],{'message':_0x9648('0x14')});}}else{return utils[_0x9648('0x19')](_0xd9e838,0x0,![],null)['then'](function(){return utils[_0x9648('0x1b')](_0xd9e838);})[_0x9648('0xe')](function(){return _0x30fb87(null,_0xd9e838);})[_0x9648('0x1c')](function(_0x39463b){return _0x30fb87(null,![],_0x39463b);});}}else{if(_0xd9e838[_0x9648('0x11')]){return _0x30fb87(null,![],{'message':_0x9648('0x14')});}else{return utils[_0x9648('0x1b')](_0xd9e838)[_0x9648('0xe')](function(){return _0x30fb87(null,_0xd9e838);});}}}});})[_0x9648('0x1c')](function(_0x3e6840){return _0x30fb87(null,![],_0x3e6840);});}function sendServiceMail(_0x11c5d5){return db[_0x9648('0x1d')]['find']({'where':{'service':!![]},'attributes':['id',_0x9648('0xf'),_0x9648('0x1e')],'include':[{'model':db[_0x9648('0x1f')],'as':'Smtp'}]})[_0x9648('0xe')](function(_0x20d2df){if(!_0x20d2df){throw new Error(_0x9648('0x20'));}var _0xea458b={'tls':{'rejectUnauthorized':![]}};if(_0x20d2df[_0x9648('0x21')]['service']){_0xea458b[_0x9648('0x22')]=_0x20d2df[_0x9648('0x21')][_0x9648('0x22')];}else{_0xea458b['host']=_0x20d2df['Smtp']['host'];_0xea458b['port']=_0x20d2df[_0x9648('0x21')][_0x9648('0x23')];_0xea458b[_0x9648('0x24')]=_0x20d2df[_0x9648('0x21')][_0x9648('0x24')];}if(_0x20d2df['Smtp']['authentication']){_0xea458b['auth']={'user':_0x20d2df[_0x9648('0x21')][_0x9648('0x25')],'pass':_0x20d2df[_0x9648('0x21')][_0x9648('0x26')]};}var _0x370694={'account':_0xea458b,'message':_['merge']({'from':util['format'](_0x9648('0x27'),_0x20d2df['name'],_0x20d2df[_0x9648('0x1e')]||_0x20d2df['Smtp'][_0x9648('0x25')])},_0x11c5d5)};return client['request'](_0x9648('0x28'),_0x370694);})[_0x9648('0xe')](function(_0x14b44b){if(_0x14b44b[_0x9648('0x29')]){throw new Error(util['format'](_0x9648('0x2a'),_0x14b44b['error'][_0x9648('0x2b')]||JSON[_0x9648('0x2c')](_0x14b44b[_0x9648('0x29')])));}return!![];});}function handleError(_0x49c068,_0x367606,_0x30ff05){return _0x49c068[_0x9648('0x2d')](_0x367606||0x1f4)['send']({'message':_0x30ff05?_0x30ff05[_0x9648('0x2b')]||_0x30ff05:''});}exports[_0x9648('0x2e')]=function(_0x3a4f14,_0x551ce7,_0x1c41ee){passport[_0x9648('0x15')](_0x9648('0x2f'),function(_0x16b1fa,_0x5300bc,_0x2cefd5){var _0x417389=_0x16b1fa||_0x2cefd5;if(_0x417389){return handleError(_0x551ce7,0x191,_0x417389);}if(!_0x5300bc){return handleError(_0x551ce7,0x194,{'message':_0x9648('0x30')});}else{var _0x4d3f32={'payload':{'id':_0x5300bc['id'],'role':_0x5300bc[_0x9648('0x31')]},'options':{'expiresIn':0x15180}};return authService[_0x9648('0x32')](_0x4d3f32)['then'](function(_0xad2988){_0x551ce7['json']({'id':_0x5300bc['id'],'token':_0xad2988,'statusCall':'','isAlreadyLogged':_0x5300bc[_0x9648('0x33')]});});}})(_0x3a4f14,_0x551ce7,_0x1c41ee);};exports[_0x9648('0x34')]=function(_0x4d0bd0,_0x474702,_0x337cf8){if(!_0x4d0bd0[_0x9648('0x35')][_0x9648('0x1e')]){return handleError(_0x474702,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x483bd6=rs[_0x9648('0x36')]();_0x4d0bd0['body'][_0x9648('0x1e')]=_0x4d0bd0[_0x9648('0x35')][_0x9648('0x1e')][_0x9648('0x37')]()[_0x9648('0x38')]();var _0x5a98f9;return db[_0x9648('0xb')]['findOne']({'where':{'id':0x1},'attributes':[_0x9648('0xd'),_0x9648('0x17')],'raw':!![]})[_0x9648('0xe')](function(_0x1fda9a){_0x5a98f9=_0x1fda9a;return db[_0x9648('0x39')][_0x9648('0x3a')]({'where':{'email':_0x4d0bd0[_0x9648('0x35')][_0x9648('0x1e')]}});})[_0x9648('0xe')](function(_0xc556dd){if(!_0xc556dd){throw new Error(_0x9648('0x3b'));}if(_0xc556dd['disabled']){throw new Error(_0x9648('0x3c'));}if(_0xc556dd[_0x9648('0x11')]){if(moment(_0xc556dd['blockedAt'])[_0x9648('0x1a')](_0x5a98f9[_0x9648('0x17')],_0x9648('0x18'))>moment()){throw new Error(_0x9648('0x3d'));}else{_0xc556dd['blocked']=![];_0xc556dd['blockedAt']=null;}}_0xc556dd[_0x9648('0x3e')]=_0x483bd6;_0xc556dd[_0x9648('0x3f')]=Date['now']()+0x36ee80;return _0xc556dd[_0x9648('0x40')]();})['then'](function(){return sendServiceMail({'to':_0x4d0bd0[_0x9648('0x35')][_0x9648('0x1e')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x9648('0x41')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'https://'+_0x4d0bd0[_0x9648('0x42')][_0x9648('0x43')]+_0x9648('0x44')+_0x483bd6+'\x0a\x0a'+_0x9648('0x45')});})[_0x9648('0xe')](function(){_0x474702[_0x9648('0x2d')](0xc8)[_0x9648('0x46')]({'message':'Reset\x20Email\x20sent!'});})[_0x9648('0x1c')](function(_0x4205ac){return handleError(_0x474702,0x1f4,_0x4205ac);});};exports[_0x9648('0x47')]=function(_0x8c9fde,_0x598a9a,_0x2f3976){return db['User'][_0x9648('0x3a')]({'where':{'resetPasswordToken':_0x8c9fde[_0x9648('0x48')][_0x9648('0x49')],'resetPasswordExpires':{'$gt':Date[_0x9648('0x4a')]()}}})[_0x9648('0xe')](function(_0x33e932){if(!_0x33e932){throw new Error(_0x9648('0x4b'));}return db[_0x9648('0xb')][_0x9648('0xc')]({'attributes':['id',_0x9648('0x4c'),_0x9648('0x4d'),'passwordHistoryLimit']})[_0x9648('0xe')](function(_0x41cc1d){if(_0x41cc1d[_0x9648('0x4c')])authService[_0x9648('0x4e')](_0x8c9fde['body']['password']);if(!_0x41cc1d['enforcePasswordHistory']||!_0x33e932['previousPasswords'])return _0x33e932;authService['validatePasswordHistory'](_0x8c9fde[_0x9648('0x35')][_0x9648('0x4f')],_0x33e932['previousPasswords'],_0x41cc1d['passwordHistoryLimit']);return _0x33e932;})[_0x9648('0xe')](function(){_0x33e932[_0x9648('0x4f')]=_0x8c9fde[_0x9648('0x35')]['password'];_0x33e932['resetPasswordToken']=null;_0x33e932[_0x9648('0x3f')]=null;return _0x33e932['save']();});})[_0x9648('0xe')](function(){_0x598a9a[_0x9648('0x2d')](0xc8)['send']({'message':_0x9648('0x50')});})[_0x9648('0x1c')](function(_0x4916fa){return handleError(_0x598a9a,0x1f4,_0x4916fa);});};passport[_0x9648('0x51')](new LocalStrategy({'usernameField':_0x9648('0xf'),'passwordField':'password'},function(_0x41f98a,_0x379190,_0x1c47e1){return localAuthenticate(db[_0x9648('0x39')],_0x41f98a,_0x379190,_0x1c47e1);})); \ No newline at end of file +var _0x5615=['jayson/promise','lodash','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','allowedLoginAttempts','blockDuration','then','name','salt','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','merge','format','message','error','status','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','json','forgot','body','Email\x20parameter\x20is\x20missing','trim','findOne','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','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','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','password','enforcePasswordHistory','previousPasswords','validatePasswordHistory','resetPasswordToken','resetPasswordExpires','Password\x20reset!','use','util','passport'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5615,0xa0));var _0x5561=function(_0x5b36a3,_0x1c2b4d){_0x5b36a3=_0x5b36a3-0x0;var _0x1f3838=_0x5615[_0x5b36a3];return _0x1f3838;};'use strict';var util=require(_0x5561('0x0'));var passport=require(_0x5561('0x1'));var LocalStrategy=require('passport-local')['Strategy'];var jayson=require(_0x5561('0x2'));var _=require(_0x5561('0x3'));var rs=require(_0x5561('0x4'));var moment=require('moment');var db=require(_0x5561('0x5'))['db'];var authService=require(_0x5561('0x6'));var utils=require(_0x5561('0x7'));var client=jayson['client'][_0x5561('0x8')]({'port':0x232b});function localAuthenticate(_0x1ef83c,_0xf685a2,_0x87bae,_0x4c03f0){var _0x7bdaa,_0x5756d1;return db[_0x5561('0x9')]['findOne']({'where':{'id':0x1},'attributes':[_0x5561('0xa'),_0x5561('0xb')],'raw':!![]})[_0x5561('0xc')](function(_0x30bac3){_0x7bdaa=_0x30bac3;return _0x1ef83c['findOne']({'attributes':['id',_0x5561('0xd'),'password',_0x5561('0xe'),'role',_0x5561('0xf'),_0x5561('0x10'),_0x5561('0x11'),_0x5561('0x12')],'where':{'name':_0xf685a2,'role':{'$or':[_0x5561('0x13'),_0x5561('0x14'),_0x5561('0x15')]}}});})[_0x5561('0xc')](function(_0x45cfef){if(!_0x45cfef||_0x45cfef&&_0x45cfef[_0x5561('0xd')]!==_0xf685a2){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x5756d1=_0x45cfef;return _0x5756d1;}})[_0x5561('0xc')](function(){_0x5756d1[_0x5561('0x16')](_0x87bae,function(_0xa8f217,_0x284403){var _0x4e08e7=_0x5756d1[_0x5561('0x12')]+0x1;if(_0xa8f217){return _0x4c03f0(_0xa8f217);}else if(!_0x284403){if(_0x5756d1[_0x5561('0xf')]){return _0x4c03f0(null,![],{'message':_0x5561('0x17')});}else if(_0x7bdaa['allowedLoginAttempts']>0x0){if(_0x5756d1['blocked']){if(_0x7bdaa[_0x5561('0xb')]>0x0){if(moment(_0x5756d1[_0x5561('0x11')])[_0x5561('0x18')](_0x7bdaa[_0x5561('0xb')],_0x5561('0x19'))>moment()){return _0x4c03f0(null,![],{'message':_0x5561('0x17')});}else{return utils['clearBlockUser'](_0x5756d1,_0x4e08e7,![],null)[_0x5561('0xc')](function(){return _0x4c03f0(null,![],{'message':_0x5561('0x17')});});}}else{return _0x4c03f0(null,![],{'message':_0x5561('0x17')});}}else{if(_0x4e08e7>=_0x7bdaa[_0x5561('0xa')]){return utils[_0x5561('0x1a')](_0x5756d1,0x0,!![],moment())[_0x5561('0xc')](function(){return _0x4c03f0(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x5756d1,_0x4e08e7,![],null)[_0x5561('0xc')](function(){return _0x4c03f0(null,![],{'message':_0x5561('0x17')});});}}}else{return _0x4c03f0(null,![],{'message':_0x5561('0x17')});}}else{if(_0x5756d1[_0x5561('0xf')]){return _0x4c03f0(null,![],{'message':_0x5561('0x17')});}else if(_0x7bdaa[_0x5561('0xa')]>0x0){if(_0x5756d1['blocked']){if(_0x7bdaa[_0x5561('0xb')]>0x0){if(moment(_0x5756d1[_0x5561('0x11')])[_0x5561('0x18')](_0x7bdaa[_0x5561('0xb')],_0x5561('0x19'))>moment()){return _0x4c03f0(null,![],{'message':_0x5561('0x17')});}else{return utils['clearBlockUser'](_0x5756d1,0x0,![],null)[_0x5561('0xc')](function(){return utils[_0x5561('0x1b')](_0x5756d1);})[_0x5561('0xc')](function(){return _0x4c03f0(null,_0x5756d1);});}}else{return _0x4c03f0(null,![],{'message':_0x5561('0x17')});}}else{return utils[_0x5561('0x1a')](_0x5756d1,0x0,![],null)[_0x5561('0xc')](function(){return utils['getLicense'](_0x5756d1);})['then'](function(){return _0x4c03f0(null,_0x5756d1);})[_0x5561('0x1c')](function(_0x42e156){return _0x4c03f0(null,![],_0x42e156);});}}else{if(_0x5756d1['blocked']){return _0x4c03f0(null,![],{'message':_0x5561('0x17')});}else{return utils[_0x5561('0x1b')](_0x5756d1)[_0x5561('0xc')](function(){return _0x4c03f0(null,_0x5756d1);});}}}});})['catch'](function(_0x18c6c1){return _0x4c03f0(null,![],_0x18c6c1);});}function sendServiceMail(_0x103c27){return db[_0x5561('0x1d')][_0x5561('0x1e')]({'where':{'service':!![]},'attributes':['id',_0x5561('0xd'),_0x5561('0x1f')],'include':[{'model':db['MailServerOut'],'as':_0x5561('0x20')}]})[_0x5561('0xc')](function(_0x57ec55){if(!_0x57ec55){throw new Error(_0x5561('0x21'));}var _0x41e876={'tls':{'rejectUnauthorized':![]}};if(_0x57ec55['Smtp'][_0x5561('0x22')]){_0x41e876[_0x5561('0x22')]=_0x57ec55[_0x5561('0x20')][_0x5561('0x22')];}else{_0x41e876['host']=_0x57ec55['Smtp'][_0x5561('0x23')];_0x41e876['port']=_0x57ec55[_0x5561('0x20')][_0x5561('0x24')];_0x41e876[_0x5561('0x25')]=_0x57ec55[_0x5561('0x20')][_0x5561('0x25')];}if(_0x57ec55[_0x5561('0x20')][_0x5561('0x26')]){_0x41e876[_0x5561('0x27')]={'user':_0x57ec55[_0x5561('0x20')][_0x5561('0x14')],'pass':_0x57ec55[_0x5561('0x20')]['pass']};}var _0x172d96={'account':_0x41e876,'message':_[_0x5561('0x28')]({'from':util[_0x5561('0x29')]('\x22%s\x22\x20<%s>',_0x57ec55[_0x5561('0xd')],_0x57ec55[_0x5561('0x1f')]||_0x57ec55['Smtp'][_0x5561('0x14')])},_0x103c27)};return client['request']('SendMail',_0x172d96);})[_0x5561('0xc')](function(_0x302c56){if(_0x302c56['error']){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x302c56['error'][_0x5561('0x2a')]||JSON['stringify'](_0x302c56[_0x5561('0x2b')])));}return!![];});}function handleError(_0x108cc5,_0x3953af,_0x358175){return _0x108cc5[_0x5561('0x2c')](_0x3953af||0x1f4)[_0x5561('0x2d')]({'message':_0x358175?_0x358175[_0x5561('0x2a')]||_0x358175:''});}exports[_0x5561('0x2e')]=function(_0x2f5952,_0x5eaa88,_0x1d8dfc){passport[_0x5561('0x16')]('local',function(_0x2c4449,_0x36d9a4,_0x4926ea){var _0x360806=_0x2c4449||_0x4926ea;if(_0x360806){return handleError(_0x5eaa88,0x191,_0x360806);}if(!_0x36d9a4){return handleError(_0x5eaa88,0x194,{'message':_0x5561('0x2f')});}else{var _0x5c070b={'payload':{'id':_0x36d9a4['id'],'role':_0x36d9a4[_0x5561('0x30')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x5c070b)[_0x5561('0xc')](function(_0x51652c){_0x5eaa88[_0x5561('0x31')]({'id':_0x36d9a4['id'],'token':_0x51652c,'statusCall':'','isAlreadyLogged':_0x36d9a4['online']});});}})(_0x2f5952,_0x5eaa88,_0x1d8dfc);};exports[_0x5561('0x32')]=function(_0x29c957,_0x5c6fdb,_0x57f430){if(!_0x29c957[_0x5561('0x33')][_0x5561('0x1f')]){return handleError(_0x5c6fdb,0x1f4,{'message':_0x5561('0x34')});}var _0x25d8af=rs['generate']();_0x29c957[_0x5561('0x33')][_0x5561('0x1f')]=_0x29c957[_0x5561('0x33')][_0x5561('0x1f')][_0x5561('0x35')]()['toLowerCase']();var _0x274ef2;return db[_0x5561('0x9')][_0x5561('0x36')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x5561('0xb')],'raw':!![]})[_0x5561('0xc')](function(_0x504925){_0x274ef2=_0x504925;return db[_0x5561('0x37')][_0x5561('0x1e')]({'where':{'email':_0x29c957[_0x5561('0x33')]['email']}});})[_0x5561('0xc')](function(_0x234f2c){if(!_0x234f2c){throw new Error(_0x5561('0x38'));}if(_0x234f2c['disabled']){throw new Error(_0x5561('0x39'));}if(_0x234f2c[_0x5561('0x10')]){if(moment(_0x234f2c[_0x5561('0x11')])['add'](_0x274ef2[_0x5561('0xb')],_0x5561('0x19'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x234f2c['blocked']=![];_0x234f2c[_0x5561('0x11')]=null;}}_0x234f2c['resetPasswordToken']=_0x25d8af;_0x234f2c['resetPasswordExpires']=Date[_0x5561('0x3a')]()+0x36ee80;return _0x234f2c[_0x5561('0x3b')]();})['then'](function(){return sendServiceMail({'to':_0x29c957['body'][_0x5561('0x1f')],'subject':_0x5561('0x3c'),'text':_0x5561('0x3d')+_0x5561('0x3e')+'https://'+_0x29c957[_0x5561('0x3f')][_0x5561('0x23')]+_0x5561('0x40')+_0x25d8af+'\x0a\x0a'+_0x5561('0x41')});})[_0x5561('0xc')](function(){_0x5c6fdb[_0x5561('0x2c')](0xc8)[_0x5561('0x2d')]({'message':_0x5561('0x42')});})[_0x5561('0x1c')](function(_0x3fb4da){return handleError(_0x5c6fdb,0x1f4,_0x3fb4da);});};exports[_0x5561('0x43')]=function(_0x4a5dde,_0x29a70e,_0x525640){return db[_0x5561('0x37')][_0x5561('0x1e')]({'where':{'resetPasswordToken':_0x4a5dde[_0x5561('0x44')][_0x5561('0x45')],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x57dc57){if(!_0x57dc57){throw new Error(_0x5561('0x46'));}return db['Setting']['findOne']({'attributes':['id',_0x5561('0x47'),'enforcePasswordHistory',_0x5561('0x48')]})[_0x5561('0xc')](function(_0x310dbd){if(_0x310dbd[_0x5561('0x47')])authService['validatePasswordPattern'](_0x4a5dde['body'][_0x5561('0x49')]);if(!_0x310dbd[_0x5561('0x4a')]||!_0x57dc57[_0x5561('0x4b')])return _0x57dc57;authService[_0x5561('0x4c')](_0x4a5dde[_0x5561('0x33')]['password'],_0x57dc57[_0x5561('0x4b')],_0x310dbd['passwordHistoryLimit']);return _0x57dc57;})[_0x5561('0xc')](function(){_0x57dc57[_0x5561('0x49')]=_0x4a5dde[_0x5561('0x33')]['password'];_0x57dc57[_0x5561('0x4d')]=null;_0x57dc57[_0x5561('0x4e')]=null;return _0x57dc57[_0x5561('0x3b')]();});})['then'](function(){_0x29a70e['status'](0xc8)[_0x5561('0x2d')]({'message':_0x5561('0x4f')});})['catch'](function(_0x277140){return handleError(_0x29a70e,0x1f4,_0x277140);});};passport[_0x5561('0x50')](new LocalStrategy({'usernameField':_0x5561('0xd'),'passwordField':_0x5561('0x49')},function(_0x9c3f50,_0x2a97ed,_0x3ee911){return localAuthenticate(db['User'],_0x9c3f50,_0x2a97ed,_0x3ee911);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 3e5ed3e..01075dc 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 _0x780e=['exports','express','Router','./authLocal.controller','post','login','/forgot','forgot','/reset/:token'];(function(_0x42e10b,_0x3b4cbb){var _0x39b5ac=function(_0x1e69f1){while(--_0x1e69f1){_0x42e10b['push'](_0x42e10b['shift']());}};_0x39b5ac(++_0x3b4cbb);}(_0x780e,0x157));var _0xe780=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x780e[_0x2641f9];return _0x585741;};'use strict';var express=require(_0xe780('0x0'));var router=express[_0xe780('0x1')]();var controller=require(_0xe780('0x2'));router[_0xe780('0x3')]('/',controller[_0xe780('0x4')]);router[_0xe780('0x3')](_0xe780('0x5'),controller[_0xe780('0x6')]);router[_0xe780('0x3')](_0xe780('0x7'),controller['reset']);module[_0xe780('0x8')]=router; \ No newline at end of file +var _0x56e4=['login','forgot','reset','exports','Router','post'];(function(_0x163157,_0x5408a9){var _0x1eb3ae=function(_0x22f4de){while(--_0x22f4de){_0x163157['push'](_0x163157['shift']());}};_0x1eb3ae(++_0x5408a9);}(_0x56e4,0x166));var _0x456e=function(_0x1827b4,_0x48e579){_0x1827b4=_0x1827b4-0x0;var _0x46ad8f=_0x56e4[_0x1827b4];return _0x46ad8f;};'use strict';var express=require('express');var router=express[_0x456e('0x0')]();var controller=require('./authLocal.controller');router[_0x456e('0x1')]('/',controller[_0x456e('0x2')]);router[_0x456e('0x1')]('/forgot',controller[_0x456e('0x3')]);router[_0x456e('0x1')]('/reset/:token',controller[_0x456e('0x4')]);module[_0x456e('0x5')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 9626bf7..5a82834 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 _0x36e5=['STRING','sequelize','exports'];(function(_0x37f9a0,_0x3d268b){var _0x4f25b5=function(_0x38881a){while(--_0x38881a){_0x37f9a0['push'](_0x37f9a0['shift']());}};_0x4f25b5(++_0x3d268b);}(_0x36e5,0x196));var _0x536e=function(_0x22a8c4,_0x51c09a){_0x22a8c4=_0x22a8c4-0x0;var _0x104c6d=_0x36e5[_0x22a8c4];return _0x104c6d;};'use strict';var Sequelize=require(_0x536e('0x0'));module[_0x536e('0x1')]={'name':{'type':Sequelize[_0x536e('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x536e('0x2')]},'description':{'type':Sequelize[_0x536e('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0xbc62=['exports','STRING','INTEGER','sequelize'];(function(_0x38459f,_0x1ac4e4){var _0x5f331c=function(_0x541ed0){while(--_0x541ed0){_0x38459f['push'](_0x38459f['shift']());}};_0x5f331c(++_0x1ac4e4);}(_0xbc62,0x107));var _0x2bc6=function(_0x4244f0,_0x2bb152){_0x4244f0=_0x4244f0-0x0;var _0xec0499=_0xbc62[_0x4244f0];return _0xec0499;};'use strict';var Sequelize=require(_0x2bc6('0x0'));module[_0x2bc6('0x1')]={'name':{'type':Sequelize[_0x2bc6('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x2bc6('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x2bc6('0x3')],'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 b0c6652..e0c6245 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 _0x18e5=['body','destroy','addConditions','Condition','find','omit','getConditions','sort','where','addActions','ids','getActions','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','create'];(function(_0x5d5b96,_0x2ada70){var _0x177fb5=function(_0x2cdaf8){while(--_0x2cdaf8){_0x5d5b96['push'](_0x5d5b96['shift']());}};_0x177fb5(++_0x2ada70);}(_0x18e5,0x15d));var _0x518e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x18e5[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x518e('0x0'));var rimraf=require(_0x518e('0x1'));var zipdir=require(_0x518e('0x2'));var jsonpatch=require(_0x518e('0x3'));var rp=require(_0x518e('0x4'));var moment=require(_0x518e('0x5'));var BPromise=require(_0x518e('0x6'));var Mustache=require(_0x518e('0x7'));var util=require(_0x518e('0x8'));var path=require(_0x518e('0x9'));var sox=require(_0x518e('0xa'));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(_0x518e('0xb'));var crypto=require(_0x518e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x518e('0xd'));var toCsv=require(_0x518e('0xe'));var querystring=require(_0x518e('0xf'));var Papa=require(_0x518e('0x10'));var Redis=require(_0x518e('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x518e('0x12'));var logger=require('../../config/logger')(_0x518e('0x13'));var utils=require(_0x518e('0x14'));var config=require(_0x518e('0x15'));var licenseUtil=require(_0x518e('0x16'));var db=require(_0x518e('0x17'))['db'];function respondWithStatusCode(_0x356840,_0x4843ac){_0x4843ac=_0x4843ac||0xcc;return function(_0x3838ba){if(_0x3838ba){return _0x356840[_0x518e('0x18')](_0x4843ac);}return _0x356840[_0x518e('0x19')](_0x4843ac)[_0x518e('0x1a')]();};}function respondWithResult(_0x2a73c8,_0x5b233f){_0x5b233f=_0x5b233f||0xc8;return function(_0x45fba4){if(_0x45fba4){return _0x2a73c8[_0x518e('0x19')](_0x5b233f)['json'](_0x45fba4);}};}function respondWithFilteredResult(_0x400ed5,_0xcf7a51){return function(_0x5beb2a){if(_0x5beb2a){var _0x80572b=typeof _0xcf7a51['offset']===_0x518e('0x1b')&&typeof _0xcf7a51[_0x518e('0x1c')]===_0x518e('0x1b');var _0x435cbc=_0x5beb2a[_0x518e('0x1d')];var _0x52dfae=_0x80572b?0x0:_0xcf7a51['offset'];var _0x5174e8=_0x80572b?_0x5beb2a[_0x518e('0x1d')]:_0xcf7a51[_0x518e('0x1e')]+_0xcf7a51[_0x518e('0x1c')];var _0x3d8489;if(_0x5174e8>=_0x435cbc){_0x5174e8=_0x435cbc;_0x3d8489=0xc8;}else{_0x3d8489=0xce;}_0x400ed5[_0x518e('0x19')](_0x3d8489);return _0x400ed5[_0x518e('0x1f')](_0x518e('0x20'),_0x52dfae+'-'+_0x5174e8+'/'+_0x435cbc)['json'](_0x5beb2a);}return null;};}function patchUpdates(_0x63f2a8){return function(_0xc91c6a){try{jsonpatch['apply'](_0xc91c6a,_0x63f2a8,!![]);}catch(_0xbdd433){return BPromise[_0x518e('0x21')](_0xbdd433);}return _0xc91c6a[_0x518e('0x22')]();};}function saveUpdates(_0x3fb5d7,_0x247705){return function(_0x2e4e00){if(_0x2e4e00){return _0x2e4e00[_0x518e('0x23')](_0x3fb5d7)[_0x518e('0x24')](function(_0x50ea8b){return _0x50ea8b;});}return null;};}function removeEntity(_0x41c283,_0x91cb61){return function(_0x564f46){if(_0x564f46){return _0x564f46['destroy']()['then'](function(){_0x41c283[_0x518e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x375c1f,_0xfd1682){return function(_0x33c4b9){if(!_0x33c4b9){_0x375c1f[_0x518e('0x18')](0x194);}return _0x33c4b9;};}function handleError(_0x3f7101,_0x436661){_0x436661=_0x436661||0x1f4;return function(_0x162acb){logger['error'](_0x162acb[_0x518e('0x25')]);if(_0x162acb[_0x518e('0x26')]){delete _0x162acb[_0x518e('0x26')];}_0x3f7101['status'](_0x436661)[_0x518e('0x27')](_0x162acb);};}exports[_0x518e('0x28')]=function(_0x44c7e8,_0x455d29){var _0x531cc3={},_0x4a91b6={},_0x2f295f={'count':0x0,'rows':[]};var _0x479045=_[_0x518e('0x29')](db[_0x518e('0x2a')][_0x518e('0x2b')],function(_0x48672b){return{'name':_0x48672b[_0x518e('0x2c')],'type':_0x48672b[_0x518e('0x2d')][_0x518e('0x2e')]};});_0x4a91b6[_0x518e('0x2f')]=_['map'](_0x479045,_0x518e('0x26'));_0x4a91b6[_0x518e('0x30')]=_[_0x518e('0x31')](_0x44c7e8['query']);_0x4a91b6[_0x518e('0x32')]=_[_0x518e('0x33')](_0x4a91b6['model'],_0x4a91b6['query']);_0x531cc3[_0x518e('0x34')]=_[_0x518e('0x33')](_0x4a91b6[_0x518e('0x2f')],qs[_0x518e('0x35')](_0x44c7e8[_0x518e('0x30')][_0x518e('0x35')]));_0x531cc3[_0x518e('0x34')]=_0x531cc3['attributes']['length']?_0x531cc3['attributes']:_0x4a91b6[_0x518e('0x2f')];if(!_0x44c7e8['query'][_0x518e('0x36')](_0x518e('0x37'))){_0x531cc3['limit']=qs[_0x518e('0x1c')](_0x44c7e8['query'][_0x518e('0x1c')]);_0x531cc3[_0x518e('0x1e')]=qs['offset'](_0x44c7e8[_0x518e('0x30')][_0x518e('0x1e')]);}_0x531cc3[_0x518e('0x38')]=qs['sort'](_0x44c7e8[_0x518e('0x30')]['sort']);_0x531cc3['where']=qs[_0x518e('0x32')](_[_0x518e('0x39')](_0x44c7e8[_0x518e('0x30')],_0x4a91b6[_0x518e('0x32')]),_0x479045);if(_0x44c7e8[_0x518e('0x30')]['filter']){_0x531cc3['where']=_[_0x518e('0x3a')](_0x531cc3['where'],{'$or':_[_0x518e('0x29')](_0x479045,function(_0x125195){if(_0x125195['type']!==_0x518e('0x3b')){var _0xdeb55d={};_0xdeb55d[_0x125195[_0x518e('0x26')]]={'$like':'%'+_0x44c7e8['query'][_0x518e('0x3c')]+'%'};return _0xdeb55d;}})});}_0x531cc3=_[_0x518e('0x3a')]({},_0x531cc3,_0x44c7e8[_0x518e('0x3d')]);var _0x2db1c7={'where':_0x531cc3['where']};return db[_0x518e('0x2a')][_0x518e('0x1d')](_0x2db1c7)[_0x518e('0x24')](function(_0xb66644){_0x2f295f[_0x518e('0x1d')]=_0xb66644;if(_0x44c7e8[_0x518e('0x30')][_0x518e('0x3e')]){_0x531cc3[_0x518e('0x3f')]=[{'all':!![]}];}return db[_0x518e('0x2a')][_0x518e('0x40')](_0x531cc3);})['then'](function(_0x492ea8){_0x2f295f[_0x518e('0x41')]=_0x492ea8;return _0x2f295f;})[_0x518e('0x24')](respondWithFilteredResult(_0x455d29,_0x531cc3))[_0x518e('0x42')](handleError(_0x455d29,null));};exports[_0x518e('0x43')]=function(_0x448ec5,_0x3a4bea){var _0x1da45c={'raw':![],'where':{'id':_0x448ec5[_0x518e('0x44')]['id']}},_0x2a3267={};_0x2a3267[_0x518e('0x2f')]=_[_0x518e('0x31')](db[_0x518e('0x2a')][_0x518e('0x2b')]);_0x2a3267[_0x518e('0x30')]=_['keys'](_0x448ec5[_0x518e('0x30')]);_0x2a3267[_0x518e('0x32')]=_[_0x518e('0x33')](_0x2a3267[_0x518e('0x2f')],_0x2a3267[_0x518e('0x30')]);_0x1da45c['attributes']=_[_0x518e('0x33')](_0x2a3267['model'],qs[_0x518e('0x35')](_0x448ec5[_0x518e('0x30')][_0x518e('0x35')]));_0x1da45c[_0x518e('0x34')]=_0x1da45c[_0x518e('0x34')][_0x518e('0x45')]?_0x1da45c[_0x518e('0x34')]:_0x2a3267['model'];if(_0x448ec5[_0x518e('0x30')][_0x518e('0x3e')]){_0x1da45c[_0x518e('0x3f')]=[{'all':!![]}];}_0x1da45c=_['merge']({},_0x1da45c,_0x448ec5['options']);return db[_0x518e('0x2a')]['find'](_0x1da45c)[_0x518e('0x24')](handleEntityNotFound(_0x3a4bea,null))['then'](respondWithResult(_0x3a4bea,null))[_0x518e('0x42')](handleError(_0x3a4bea,null));};exports[_0x518e('0x46')]=function(_0x40f2ef,_0x5c0b33){return db[_0x518e('0x2a')][_0x518e('0x46')](_0x40f2ef['body'],{})[_0x518e('0x24')](respondWithResult(_0x5c0b33,0xc9))['catch'](handleError(_0x5c0b33,null));};exports[_0x518e('0x23')]=function(_0x7e759e,_0x1a6304){if(_0x7e759e[_0x518e('0x47')]['id']){delete _0x7e759e[_0x518e('0x47')]['id'];}return db['Automation']['find']({'where':{'id':_0x7e759e['params']['id']}})[_0x518e('0x24')](handleEntityNotFound(_0x1a6304,null))['then'](saveUpdates(_0x7e759e['body'],null))[_0x518e('0x24')](respondWithResult(_0x1a6304,null))['catch'](handleError(_0x1a6304,null));};exports[_0x518e('0x48')]=function(_0x5b5cdc,_0x445649){return db['Automation']['find']({'where':{'id':_0x5b5cdc['params']['id']}})['then'](handleEntityNotFound(_0x445649,null))[_0x518e('0x24')](removeEntity(_0x445649,null))[_0x518e('0x42')](handleError(_0x445649,null));};exports[_0x518e('0x49')]=function(_0x5b342e,_0x48e6eb,_0x31f9ab){return db[_0x518e('0x4a')][_0x518e('0x4b')]({'where':{'id':_0x5b342e[_0x518e('0x44')]['id']}})[_0x518e('0x24')](handleEntityNotFound(_0x48e6eb,null))[_0x518e('0x24')](function(_0x5cee06){if(_0x5cee06){return _0x5cee06[_0x518e('0x49')](_0x5b342e[_0x518e('0x47')]['ids'],_[_0x518e('0x4c')](_0x5b342e[_0x518e('0x47')],['ids','id'])||{});}})[_0x518e('0x24')](respondWithResult(_0x48e6eb,null))[_0x518e('0x42')](handleError(_0x48e6eb,null));};exports[_0x518e('0x4d')]=function(_0x437c6a,_0x29ce5f,_0x35e641){var _0x105e11={};var _0x5b9b31={};var _0x4d4d19;var _0x43b5d7;return db['Automation']['findOne']({'where':{'id':_0x437c6a[_0x518e('0x44')]['id']}})[_0x518e('0x24')](handleEntityNotFound(_0x29ce5f,null))[_0x518e('0x24')](function(_0x402149){if(_0x402149){_0x4d4d19=_0x402149;_0x5b9b31['model']=_[_0x518e('0x31')](db[_0x518e('0x4a')][_0x518e('0x2b')]);_0x5b9b31['query']=_['keys'](_0x437c6a['query']);_0x5b9b31[_0x518e('0x32')]=_['intersection'](_0x5b9b31[_0x518e('0x2f')],_0x5b9b31[_0x518e('0x30')]);_0x105e11[_0x518e('0x34')]=_[_0x518e('0x33')](_0x5b9b31[_0x518e('0x2f')],qs[_0x518e('0x35')](_0x437c6a[_0x518e('0x30')][_0x518e('0x35')]));_0x105e11[_0x518e('0x34')]=_0x105e11[_0x518e('0x34')][_0x518e('0x45')]?_0x105e11[_0x518e('0x34')]:_0x5b9b31[_0x518e('0x2f')];_0x105e11[_0x518e('0x38')]=qs[_0x518e('0x4e')](_0x437c6a['query'][_0x518e('0x4e')]);_0x105e11[_0x518e('0x4f')]=qs[_0x518e('0x32')](_[_0x518e('0x39')](_0x437c6a['query'],_0x5b9b31[_0x518e('0x32')]));if(_0x437c6a[_0x518e('0x30')][_0x518e('0x3c')]){_0x105e11[_0x518e('0x4f')]=_[_0x518e('0x3a')](_0x105e11[_0x518e('0x4f')],{'$or':_[_0x518e('0x29')](_0x105e11['attributes'],function(_0x1dbfc8){var _0x10cd29={};_0x10cd29[_0x1dbfc8]={'$like':'%'+_0x437c6a['query'][_0x518e('0x3c')]+'%'};return _0x10cd29;})});}_0x105e11=_[_0x518e('0x3a')]({},_0x105e11,_0x437c6a[_0x518e('0x3d')]);return _0x4d4d19['getConditions'](_0x105e11);}})[_0x518e('0x24')](function(_0x1d6126){if(_0x1d6126){_0x43b5d7=_0x1d6126[_0x518e('0x45')];if(!_0x437c6a[_0x518e('0x30')]['hasOwnProperty']('nolimit')){_0x105e11[_0x518e('0x1c')]=qs[_0x518e('0x1c')](_0x437c6a['query'][_0x518e('0x1c')]);_0x105e11[_0x518e('0x1e')]=qs['offset'](_0x437c6a[_0x518e('0x30')][_0x518e('0x1e')]);}return _0x4d4d19[_0x518e('0x4d')](_0x105e11);}})[_0x518e('0x24')](function(_0x48762f){if(_0x48762f){return _0x48762f?{'count':_0x43b5d7,'rows':_0x48762f}:null;}})['then'](respondWithResult(_0x29ce5f,null))[_0x518e('0x42')](handleError(_0x29ce5f,null));};exports[_0x518e('0x50')]=function(_0x251a07,_0x33f2ab,_0x3131ec){return db['Action'][_0x518e('0x4b')]({'where':{'id':_0x251a07[_0x518e('0x44')]['id']}})[_0x518e('0x24')](handleEntityNotFound(_0x33f2ab,null))['then'](function(_0x22131e){if(_0x22131e){return _0x22131e['addActions'](_0x251a07['body'][_0x518e('0x51')],_[_0x518e('0x4c')](_0x251a07['body'],[_0x518e('0x51'),'id'])||{});}})[_0x518e('0x24')](respondWithResult(_0x33f2ab,null))[_0x518e('0x42')](handleError(_0x33f2ab,null));};exports[_0x518e('0x52')]=function(_0x254bef,_0x41f57d,_0x71b7a2){var _0x54e851={};var _0x450331={};var _0x5a7d58;var _0x3ba8d5;return db[_0x518e('0x2a')][_0x518e('0x53')]({'where':{'id':_0x254bef['params']['id']}})[_0x518e('0x24')](handleEntityNotFound(_0x41f57d,null))['then'](function(_0x5525c4){if(_0x5525c4){_0x5a7d58=_0x5525c4;_0x450331[_0x518e('0x2f')]=_[_0x518e('0x31')](db['Action'][_0x518e('0x2b')]);_0x450331[_0x518e('0x30')]=_[_0x518e('0x31')](_0x254bef[_0x518e('0x30')]);_0x450331[_0x518e('0x32')]=_['intersection'](_0x450331[_0x518e('0x2f')],_0x450331[_0x518e('0x30')]);_0x54e851[_0x518e('0x34')]=_[_0x518e('0x33')](_0x450331[_0x518e('0x2f')],qs[_0x518e('0x35')](_0x254bef['query'][_0x518e('0x35')]));_0x54e851[_0x518e('0x34')]=_0x54e851[_0x518e('0x34')]['length']?_0x54e851[_0x518e('0x34')]:_0x450331['model'];_0x54e851[_0x518e('0x38')]=qs[_0x518e('0x4e')](_0x254bef[_0x518e('0x30')][_0x518e('0x4e')]);_0x54e851[_0x518e('0x4f')]=qs['filters'](_[_0x518e('0x39')](_0x254bef['query'],_0x450331[_0x518e('0x32')]));if(_0x254bef[_0x518e('0x30')]['filter']){_0x54e851['where']=_[_0x518e('0x3a')](_0x54e851['where'],{'$or':_['map'](_0x54e851[_0x518e('0x34')],function(_0x997419){var _0x41f574={};_0x41f574[_0x997419]={'$like':'%'+_0x254bef[_0x518e('0x30')]['filter']+'%'};return _0x41f574;})});}_0x54e851=_[_0x518e('0x3a')]({},_0x54e851,_0x254bef[_0x518e('0x3d')]);return _0x5a7d58[_0x518e('0x52')](_0x54e851);}})[_0x518e('0x24')](function(_0x4ea054){if(_0x4ea054){_0x3ba8d5=_0x4ea054['length'];if(!_0x254bef[_0x518e('0x30')][_0x518e('0x36')]('nolimit')){_0x54e851[_0x518e('0x1c')]=qs['limit'](_0x254bef[_0x518e('0x30')][_0x518e('0x1c')]);_0x54e851[_0x518e('0x1e')]=qs[_0x518e('0x1e')](_0x254bef[_0x518e('0x30')][_0x518e('0x1e')]);}return _0x5a7d58[_0x518e('0x52')](_0x54e851);}})[_0x518e('0x24')](function(_0x5c4b9e){if(_0x5c4b9e){return _0x5c4b9e?{'count':_0x3ba8d5,'rows':_0x5c4b9e}:null;}})[_0x518e('0x24')](respondWithResult(_0x41f57d,null))[_0x518e('0x42')](handleError(_0x41f57d,null));}; \ No newline at end of file +var _0x68d1=['filter','options','Automation','includeAll','include','findAll','catch','show','params','rawAttributes','length','find','create','body','addConditions','ids','omit','getConditions','addActions','Action','findOne','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','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','undefined','limit','count','offset','set','reject','update','then','end','error','stack','name','map','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x68d1,0xbb));var _0x168d=function(_0xac011,_0x56395){_0xac011=_0xac011-0x0;var _0x215727=_0x68d1[_0xac011];return _0x215727;};'use strict';var emlformat=require(_0x168d('0x0'));var rimraf=require(_0x168d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x168d('0x2'));var rp=require(_0x168d('0x3'));var moment=require('moment');var BPromise=require(_0x168d('0x4'));var Mustache=require(_0x168d('0x5'));var util=require(_0x168d('0x6'));var path=require(_0x168d('0x7'));var sox=require(_0x168d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x168d('0x9'));var _=require(_0x168d('0xa'));var squel=require(_0x168d('0xb'));var crypto=require(_0x168d('0xc'));var jsforce=require(_0x168d('0xd'));var deskjs=require(_0x168d('0xe'));var toCsv=require(_0x168d('0xf'));var querystring=require(_0x168d('0x10'));var Papa=require(_0x168d('0x11'));var Redis=require(_0x168d('0x12'));var authService=require(_0x168d('0x13'));var qs=require(_0x168d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x168d('0x15'));var logger=require(_0x168d('0x16'))(_0x168d('0x17'));var utils=require(_0x168d('0x18'));var config=require(_0x168d('0x19'));var licenseUtil=require(_0x168d('0x1a'));var db=require(_0x168d('0x1b'))['db'];function respondWithStatusCode(_0xfeae91,_0x5b3a7d){_0x5b3a7d=_0x5b3a7d||0xcc;return function(_0x1cb17e){if(_0x1cb17e){return _0xfeae91[_0x168d('0x1c')](_0x5b3a7d);}return _0xfeae91[_0x168d('0x1d')](_0x5b3a7d)['end']();};}function respondWithResult(_0x143eee,_0x5218b8){_0x5218b8=_0x5218b8||0xc8;return function(_0x2ad133){if(_0x2ad133){return _0x143eee[_0x168d('0x1d')](_0x5218b8)[_0x168d('0x1e')](_0x2ad133);}};}function respondWithFilteredResult(_0x31c777,_0x41e55c){return function(_0x193cae){if(_0x193cae){var _0x41989e=typeof _0x41e55c['offset']===_0x168d('0x1f')&&typeof _0x41e55c[_0x168d('0x20')]===_0x168d('0x1f');var _0x517a22=_0x193cae[_0x168d('0x21')];var _0x8b8ede=_0x41989e?0x0:_0x41e55c[_0x168d('0x22')];var _0x8af2c=_0x41989e?_0x193cae[_0x168d('0x21')]:_0x41e55c['offset']+_0x41e55c[_0x168d('0x20')];var _0x31d91a;if(_0x8af2c>=_0x517a22){_0x8af2c=_0x517a22;_0x31d91a=0xc8;}else{_0x31d91a=0xce;}_0x31c777[_0x168d('0x1d')](_0x31d91a);return _0x31c777[_0x168d('0x23')]('Content-Range',_0x8b8ede+'-'+_0x8af2c+'/'+_0x517a22)[_0x168d('0x1e')](_0x193cae);}return null;};}function patchUpdates(_0x94265c){return function(_0x5b9f78){try{jsonpatch['apply'](_0x5b9f78,_0x94265c,!![]);}catch(_0x482cbb){return BPromise[_0x168d('0x24')](_0x482cbb);}return _0x5b9f78['save']();};}function saveUpdates(_0x4ea0a9,_0x5665a8){return function(_0x54b7eb){if(_0x54b7eb){return _0x54b7eb[_0x168d('0x25')](_0x4ea0a9)[_0x168d('0x26')](function(_0x5c4339){return _0x5c4339;});}return null;};}function removeEntity(_0xc6f2ba,_0x4ace38){return function(_0x1b7297){if(_0x1b7297){return _0x1b7297['destroy']()[_0x168d('0x26')](function(){_0xc6f2ba[_0x168d('0x1d')](0xcc)[_0x168d('0x27')]();});}};}function handleEntityNotFound(_0x2aa12c,_0x2ed25c){return function(_0x1ce4ca){if(!_0x1ce4ca){_0x2aa12c[_0x168d('0x1c')](0x194);}return _0x1ce4ca;};}function handleError(_0x1a9687,_0x558883){_0x558883=_0x558883||0x1f4;return function(_0x2886c5){logger[_0x168d('0x28')](_0x2886c5[_0x168d('0x29')]);if(_0x2886c5['name']){delete _0x2886c5[_0x168d('0x2a')];}_0x1a9687[_0x168d('0x1d')](_0x558883)['send'](_0x2886c5);};}exports['index']=function(_0x555b54,_0x5f41fe){var _0x300c9c={},_0x332f32={},_0x1deb18={'count':0x0,'rows':[]};var _0x47be10=_[_0x168d('0x2b')](db['Automation']['rawAttributes'],function(_0x5e2c3b){return{'name':_0x5e2c3b[_0x168d('0x2c')],'type':_0x5e2c3b[_0x168d('0x2d')][_0x168d('0x2e')]};});_0x332f32['model']=_['map'](_0x47be10,_0x168d('0x2a'));_0x332f32[_0x168d('0x2f')]=_[_0x168d('0x30')](_0x555b54['query']);_0x332f32[_0x168d('0x31')]=_[_0x168d('0x32')](_0x332f32['model'],_0x332f32[_0x168d('0x2f')]);_0x300c9c[_0x168d('0x33')]=_[_0x168d('0x32')](_0x332f32[_0x168d('0x34')],qs[_0x168d('0x35')](_0x555b54[_0x168d('0x2f')]['fields']));_0x300c9c[_0x168d('0x33')]=_0x300c9c[_0x168d('0x33')]['length']?_0x300c9c[_0x168d('0x33')]:_0x332f32[_0x168d('0x34')];if(!_0x555b54[_0x168d('0x2f')][_0x168d('0x36')](_0x168d('0x37'))){_0x300c9c[_0x168d('0x20')]=qs['limit'](_0x555b54[_0x168d('0x2f')][_0x168d('0x20')]);_0x300c9c[_0x168d('0x22')]=qs[_0x168d('0x22')](_0x555b54[_0x168d('0x2f')][_0x168d('0x22')]);}_0x300c9c[_0x168d('0x38')]=qs[_0x168d('0x39')](_0x555b54[_0x168d('0x2f')]['sort']);_0x300c9c[_0x168d('0x3a')]=qs[_0x168d('0x31')](_[_0x168d('0x3b')](_0x555b54[_0x168d('0x2f')],_0x332f32[_0x168d('0x31')]),_0x47be10);if(_0x555b54[_0x168d('0x2f')]['filter']){_0x300c9c['where']=_[_0x168d('0x3c')](_0x300c9c[_0x168d('0x3a')],{'$or':_[_0x168d('0x2b')](_0x47be10,function(_0x1b8d2f){if(_0x1b8d2f[_0x168d('0x2d')]!==_0x168d('0x3d')){var _0x5e473e={};_0x5e473e[_0x1b8d2f['name']]={'$like':'%'+_0x555b54[_0x168d('0x2f')][_0x168d('0x3e')]+'%'};return _0x5e473e;}})});}_0x300c9c=_[_0x168d('0x3c')]({},_0x300c9c,_0x555b54[_0x168d('0x3f')]);var _0x21e7b8={'where':_0x300c9c[_0x168d('0x3a')]};return db[_0x168d('0x40')]['count'](_0x21e7b8)[_0x168d('0x26')](function(_0x4b85ee){_0x1deb18[_0x168d('0x21')]=_0x4b85ee;if(_0x555b54[_0x168d('0x2f')][_0x168d('0x41')]){_0x300c9c[_0x168d('0x42')]=[{'all':!![]}];}return db[_0x168d('0x40')][_0x168d('0x43')](_0x300c9c);})[_0x168d('0x26')](function(_0x52d7ff){_0x1deb18['rows']=_0x52d7ff;return _0x1deb18;})[_0x168d('0x26')](respondWithFilteredResult(_0x5f41fe,_0x300c9c))[_0x168d('0x44')](handleError(_0x5f41fe,null));};exports[_0x168d('0x45')]=function(_0x429a87,_0x48a2ad){var _0x4af370={'raw':![],'where':{'id':_0x429a87[_0x168d('0x46')]['id']}},_0x3ef855={};_0x3ef855[_0x168d('0x34')]=_['keys'](db[_0x168d('0x40')][_0x168d('0x47')]);_0x3ef855['query']=_[_0x168d('0x30')](_0x429a87['query']);_0x3ef855[_0x168d('0x31')]=_['intersection'](_0x3ef855[_0x168d('0x34')],_0x3ef855['query']);_0x4af370[_0x168d('0x33')]=_['intersection'](_0x3ef855[_0x168d('0x34')],qs['fields'](_0x429a87['query'][_0x168d('0x35')]));_0x4af370[_0x168d('0x33')]=_0x4af370[_0x168d('0x33')][_0x168d('0x48')]?_0x4af370[_0x168d('0x33')]:_0x3ef855['model'];if(_0x429a87['query']['includeAll']){_0x4af370[_0x168d('0x42')]=[{'all':!![]}];}_0x4af370=_['merge']({},_0x4af370,_0x429a87[_0x168d('0x3f')]);return db[_0x168d('0x40')][_0x168d('0x49')](_0x4af370)[_0x168d('0x26')](handleEntityNotFound(_0x48a2ad,null))[_0x168d('0x26')](respondWithResult(_0x48a2ad,null))['catch'](handleError(_0x48a2ad,null));};exports[_0x168d('0x4a')]=function(_0x1692c0,_0x45de80){return db[_0x168d('0x40')][_0x168d('0x4a')](_0x1692c0[_0x168d('0x4b')],{})['then'](respondWithResult(_0x45de80,0xc9))[_0x168d('0x44')](handleError(_0x45de80,null));};exports[_0x168d('0x25')]=function(_0x3ae847,_0x12fd31){if(_0x3ae847['body']['id']){delete _0x3ae847[_0x168d('0x4b')]['id'];}return db[_0x168d('0x40')][_0x168d('0x49')]({'where':{'id':_0x3ae847[_0x168d('0x46')]['id']}})['then'](handleEntityNotFound(_0x12fd31,null))[_0x168d('0x26')](saveUpdates(_0x3ae847[_0x168d('0x4b')],null))[_0x168d('0x26')](respondWithResult(_0x12fd31,null))[_0x168d('0x44')](handleError(_0x12fd31,null));};exports['destroy']=function(_0x209511,_0x11b2d3){return db[_0x168d('0x40')][_0x168d('0x49')]({'where':{'id':_0x209511['params']['id']}})[_0x168d('0x26')](handleEntityNotFound(_0x11b2d3,null))['then'](removeEntity(_0x11b2d3,null))[_0x168d('0x44')](handleError(_0x11b2d3,null));};exports['addConditions']=function(_0x4152d3,_0x395494,_0x5a93d5){return db['Condition'][_0x168d('0x49')]({'where':{'id':_0x4152d3[_0x168d('0x46')]['id']}})[_0x168d('0x26')](handleEntityNotFound(_0x395494,null))[_0x168d('0x26')](function(_0x287322){if(_0x287322){return _0x287322[_0x168d('0x4c')](_0x4152d3[_0x168d('0x4b')][_0x168d('0x4d')],_[_0x168d('0x4e')](_0x4152d3[_0x168d('0x4b')],[_0x168d('0x4d'),'id'])||{});}})[_0x168d('0x26')](respondWithResult(_0x395494,null))[_0x168d('0x44')](handleError(_0x395494,null));};exports[_0x168d('0x4f')]=function(_0x53073e,_0x311ca7,_0x48fc55){var _0xd77ee7={};var _0x473c7a={};var _0x282337;var _0x3f3f08;return db[_0x168d('0x40')]['findOne']({'where':{'id':_0x53073e[_0x168d('0x46')]['id']}})[_0x168d('0x26')](handleEntityNotFound(_0x311ca7,null))[_0x168d('0x26')](function(_0x50fffa){if(_0x50fffa){_0x282337=_0x50fffa;_0x473c7a[_0x168d('0x34')]=_[_0x168d('0x30')](db['Condition'][_0x168d('0x47')]);_0x473c7a[_0x168d('0x2f')]=_[_0x168d('0x30')](_0x53073e['query']);_0x473c7a[_0x168d('0x31')]=_['intersection'](_0x473c7a[_0x168d('0x34')],_0x473c7a[_0x168d('0x2f')]);_0xd77ee7[_0x168d('0x33')]=_[_0x168d('0x32')](_0x473c7a[_0x168d('0x34')],qs[_0x168d('0x35')](_0x53073e[_0x168d('0x2f')][_0x168d('0x35')]));_0xd77ee7['attributes']=_0xd77ee7[_0x168d('0x33')]['length']?_0xd77ee7[_0x168d('0x33')]:_0x473c7a[_0x168d('0x34')];_0xd77ee7['order']=qs['sort'](_0x53073e[_0x168d('0x2f')][_0x168d('0x39')]);_0xd77ee7['where']=qs[_0x168d('0x31')](_[_0x168d('0x3b')](_0x53073e[_0x168d('0x2f')],_0x473c7a[_0x168d('0x31')]));if(_0x53073e['query'][_0x168d('0x3e')]){_0xd77ee7[_0x168d('0x3a')]=_[_0x168d('0x3c')](_0xd77ee7[_0x168d('0x3a')],{'$or':_[_0x168d('0x2b')](_0xd77ee7['attributes'],function(_0x23c8d6){var _0x3bdf0c={};_0x3bdf0c[_0x23c8d6]={'$like':'%'+_0x53073e[_0x168d('0x2f')]['filter']+'%'};return _0x3bdf0c;})});}_0xd77ee7=_[_0x168d('0x3c')]({},_0xd77ee7,_0x53073e[_0x168d('0x3f')]);return _0x282337['getConditions'](_0xd77ee7);}})['then'](function(_0x236ee7){if(_0x236ee7){_0x3f3f08=_0x236ee7[_0x168d('0x48')];if(!_0x53073e[_0x168d('0x2f')]['hasOwnProperty'](_0x168d('0x37'))){_0xd77ee7['limit']=qs[_0x168d('0x20')](_0x53073e[_0x168d('0x2f')][_0x168d('0x20')]);_0xd77ee7['offset']=qs[_0x168d('0x22')](_0x53073e[_0x168d('0x2f')]['offset']);}return _0x282337[_0x168d('0x4f')](_0xd77ee7);}})[_0x168d('0x26')](function(_0x5cd846){if(_0x5cd846){return _0x5cd846?{'count':_0x3f3f08,'rows':_0x5cd846}:null;}})[_0x168d('0x26')](respondWithResult(_0x311ca7,null))[_0x168d('0x44')](handleError(_0x311ca7,null));};exports[_0x168d('0x50')]=function(_0x476874,_0xf8f927,_0x5e2c15){return db[_0x168d('0x51')][_0x168d('0x49')]({'where':{'id':_0x476874[_0x168d('0x46')]['id']}})['then'](handleEntityNotFound(_0xf8f927,null))[_0x168d('0x26')](function(_0x20074a){if(_0x20074a){return _0x20074a[_0x168d('0x50')](_0x476874[_0x168d('0x4b')][_0x168d('0x4d')],_[_0x168d('0x4e')](_0x476874[_0x168d('0x4b')],[_0x168d('0x4d'),'id'])||{});}})['then'](respondWithResult(_0xf8f927,null))[_0x168d('0x44')](handleError(_0xf8f927,null));};exports['getActions']=function(_0x144c7f,_0x194dd6,_0x3d8c39){var _0x376408={};var _0x1711fe={};var _0x55da5d;var _0x430e2b;return db[_0x168d('0x40')][_0x168d('0x52')]({'where':{'id':_0x144c7f['params']['id']}})['then'](handleEntityNotFound(_0x194dd6,null))[_0x168d('0x26')](function(_0x35e15c){if(_0x35e15c){_0x55da5d=_0x35e15c;_0x1711fe[_0x168d('0x34')]=_[_0x168d('0x30')](db[_0x168d('0x51')][_0x168d('0x47')]);_0x1711fe[_0x168d('0x2f')]=_[_0x168d('0x30')](_0x144c7f[_0x168d('0x2f')]);_0x1711fe[_0x168d('0x31')]=_[_0x168d('0x32')](_0x1711fe[_0x168d('0x34')],_0x1711fe[_0x168d('0x2f')]);_0x376408[_0x168d('0x33')]=_[_0x168d('0x32')](_0x1711fe[_0x168d('0x34')],qs['fields'](_0x144c7f[_0x168d('0x2f')][_0x168d('0x35')]));_0x376408['attributes']=_0x376408[_0x168d('0x33')][_0x168d('0x48')]?_0x376408['attributes']:_0x1711fe['model'];_0x376408['order']=qs[_0x168d('0x39')](_0x144c7f[_0x168d('0x2f')]['sort']);_0x376408[_0x168d('0x3a')]=qs[_0x168d('0x31')](_[_0x168d('0x3b')](_0x144c7f[_0x168d('0x2f')],_0x1711fe[_0x168d('0x31')]));if(_0x144c7f['query'][_0x168d('0x3e')]){_0x376408['where']=_[_0x168d('0x3c')](_0x376408[_0x168d('0x3a')],{'$or':_[_0x168d('0x2b')](_0x376408[_0x168d('0x33')],function(_0x4631d1){var _0x743aea={};_0x743aea[_0x4631d1]={'$like':'%'+_0x144c7f[_0x168d('0x2f')]['filter']+'%'};return _0x743aea;})});}_0x376408=_[_0x168d('0x3c')]({},_0x376408,_0x144c7f[_0x168d('0x3f')]);return _0x55da5d['getActions'](_0x376408);}})['then'](function(_0x516c15){if(_0x516c15){_0x430e2b=_0x516c15[_0x168d('0x48')];if(!_0x144c7f['query'][_0x168d('0x36')](_0x168d('0x37'))){_0x376408['limit']=qs[_0x168d('0x20')](_0x144c7f[_0x168d('0x2f')][_0x168d('0x20')]);_0x376408[_0x168d('0x22')]=qs[_0x168d('0x22')](_0x144c7f[_0x168d('0x2f')]['offset']);}return _0x55da5d['getActions'](_0x376408);}})[_0x168d('0x26')](function(_0x4244c1){if(_0x4244c1){return _0x4244c1?{'count':_0x430e2b,'rows':_0x4244c1}:null;}})[_0x168d('0x26')](respondWithResult(_0x194dd6,null))[_0x168d('0x44')](handleError(_0x194dd6,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index df7e54e..0b0bb66 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 _0xf158=['rimraf','../../config/environment','Automation','tools_automations','lodash','api','moment','bluebird','request-promise','path'];(function(_0x20d7c1,_0x26f0ab){var _0x40e03b=function(_0x2fea0c){while(--_0x2fea0c){_0x20d7c1['push'](_0x20d7c1['shift']());}};_0x40e03b(++_0x26f0ab);}(_0xf158,0x1d0));var _0x8f15=function(_0x22bf73,_0x328246){_0x22bf73=_0x22bf73-0x0;var _0x1354d5=_0xf158[_0x22bf73];return _0x1354d5;};'use strict';var _=require(_0x8f15('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8f15('0x1'));var moment=require(_0x8f15('0x2'));var BPromise=require(_0x8f15('0x3'));var rp=require(_0x8f15('0x4'));var fs=require('fs');var path=require(_0x8f15('0x5'));var rimraf=require(_0x8f15('0x6'));var config=require(_0x8f15('0x7'));var attributes=require('./automation.attributes');module['exports']=function(_0x13f0c4,_0x5905d3){return _0x13f0c4['define'](_0x8f15('0x8'),attributes,{'tableName':_0x8f15('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7426=['../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','lodash','util','../../config/logger','api','moment','rimraf'];(function(_0x94312,_0x512ea1){var _0x1a34eb=function(_0x1ea10c){while(--_0x1ea10c){_0x94312['push'](_0x94312['shift']());}};_0x1a34eb(++_0x512ea1);}(_0x7426,0xa2));var _0x6742=function(_0x3c9c45,_0x1fc52a){_0x3c9c45=_0x3c9c45-0x0;var _0x544045=_0x7426[_0x3c9c45];return _0x544045;};'use strict';var _=require(_0x6742('0x0'));var util=require(_0x6742('0x1'));var logger=require(_0x6742('0x2'))(_0x6742('0x3'));var moment=require(_0x6742('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6742('0x5'));var config=require(_0x6742('0x6'));var attributes=require(_0x6742('0x7'));module[_0x6742('0x8')]=function(_0x5e2503,_0x28afe4){return _0x5e2503[_0x6742('0x9')](_0x6742('0xa'),attributes,{'tableName':_0x6742('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index c71f300..dcbbbef 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 _0x2deb=['Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x2deb,0xdb));var _0xb2de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2deb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb2de('0x0'));var util=require(_0xb2de('0x1'));var moment=require(_0xb2de('0x2'));var BPromise=require(_0xb2de('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb2de('0x4'))['db'];var utils=require(_0xb2de('0x5'));var logger=require(_0xb2de('0x6'))(_0xb2de('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb2de('0x8')][_0xb2de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x191004,_0x49307b,_0x253d0b){return new BPromise(function(_0x1a4c44,_0x53ab0e){return client[_0xb2de('0xa')](_0x191004,_0x253d0b)[_0xb2de('0xb')](function(_0x1d40ec){logger['info'](_0xb2de('0xc'),_0x49307b,_0xb2de('0xd'));logger[_0xb2de('0xe')](_0xb2de('0xf'),_0x49307b,'request\x20sent',JSON['stringify'](_0x1d40ec));if(_0x1d40ec[_0xb2de('0x10')]){if(_0x1d40ec[_0xb2de('0x10')][_0xb2de('0x11')]===0x1f4){logger['error'](_0xb2de('0xc'),_0x49307b,_0x1d40ec[_0xb2de('0x10')][_0xb2de('0x12')]);return _0x53ab0e(_0x1d40ec['error'][_0xb2de('0x12')]);}logger['error'](_0xb2de('0xc'),_0x49307b,_0x1d40ec['error'][_0xb2de('0x12')]);return _0x1a4c44(_0x1d40ec[_0xb2de('0x10')][_0xb2de('0x12')]);}else{logger['info'](_0xb2de('0xc'),_0x49307b,_0xb2de('0xd'));_0x1a4c44(_0x1d40ec[_0xb2de('0x13')][_0xb2de('0x12')]);}})[_0xb2de('0x14')](function(_0x2dc15c){logger[_0xb2de('0x10')](_0xb2de('0xc'),_0x49307b,_0x2dc15c);_0x53ab0e(_0x2dc15c);});});} \ No newline at end of file +var _0x00ea=['rpc','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3b5abb,_0x11a93c){var _0x17f5be=function(_0x22e1fa){while(--_0x22e1fa){_0x3b5abb['push'](_0x3b5abb['shift']());}};_0x17f5be(++_0x11a93c);}(_0x00ea,0x19d));var _0xa00e=function(_0x1ae96d,_0x2d857b){_0x1ae96d=_0x1ae96d-0x0;var _0x220aca=_0x00ea[_0x1ae96d];return _0x220aca;};'use strict';var _=require('lodash');var util=require(_0xa00e('0x0'));var moment=require(_0xa00e('0x1'));var BPromise=require('bluebird');var rs=require(_0xa00e('0x2'));var fs=require('fs');var Redis=require(_0xa00e('0x3'));var db=require(_0xa00e('0x4'))['db'];var utils=require(_0xa00e('0x5'));var logger=require(_0xa00e('0x6'))(_0xa00e('0x7'));var config=require('../../config/environment');var jayson=require(_0xa00e('0x8'));var client=jayson[_0xa00e('0x9')][_0xa00e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2aab60,_0x5b09ef,_0x46f5fa){return new BPromise(function(_0x7f530c,_0x48dba0){return client[_0xa00e('0xb')](_0x2aab60,_0x46f5fa)[_0xa00e('0xc')](function(_0x48760e){logger[_0xa00e('0xd')](_0xa00e('0xe'),_0x5b09ef,_0xa00e('0xf'));logger['debug'](_0xa00e('0x10'),_0x5b09ef,_0xa00e('0xf'),JSON['stringify'](_0x48760e));if(_0x48760e[_0xa00e('0x11')]){if(_0x48760e['error'][_0xa00e('0x12')]===0x1f4){logger[_0xa00e('0x11')](_0xa00e('0xe'),_0x5b09ef,_0x48760e[_0xa00e('0x11')]['message']);return _0x48dba0(_0x48760e[_0xa00e('0x11')][_0xa00e('0x13')]);}logger['error'](_0xa00e('0xe'),_0x5b09ef,_0x48760e['error'][_0xa00e('0x13')]);return _0x7f530c(_0x48760e[_0xa00e('0x11')][_0xa00e('0x13')]);}else{logger['info']('Automation,\x20%s,\x20%s',_0x5b09ef,_0xa00e('0xf'));_0x7f530c(_0x48760e['result'][_0xa00e('0x13')]);}})[_0xa00e('0x14')](function(_0x1d0095){logger[_0xa00e('0x11')](_0xa00e('0xe'),_0x5b09ef,_0x1d0095);_0x48dba0(_0x1d0095);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 508199e..4ec8e1a 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 _0x18d6=['addConditions','/:id/actions','addActions','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','/:id/conditions','getConditions','getActions','create','post'];(function(_0x3fa903,_0x29a8b8){var _0x324764=function(_0x37c28d){while(--_0x37c28d){_0x3fa903['push'](_0x3fa903['shift']());}};_0x324764(++_0x29a8b8);}(_0x18d6,0x166));var _0x618d=function(_0x18141b,_0x45c769){_0x18141b=_0x18141b-0x0;var _0x474c30=_0x18d6[_0x18141b];return _0x474c30;};'use strict';var multer=require(_0x618d('0x0'));var util=require(_0x618d('0x1'));var path=require('path');var timeout=require(_0x618d('0x2'));var express=require(_0x618d('0x3'));var router=express[_0x618d('0x4')]();var fs_extra=require(_0x618d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x618d('0x6'));var config=require(_0x618d('0x7'));var controller=require('./automation.controller');router[_0x618d('0x8')]('/',auth['isAuthenticated'](),controller[_0x618d('0x9')]);router[_0x618d('0x8')]('/:id',auth[_0x618d('0xa')](),controller[_0x618d('0xb')]);router[_0x618d('0x8')](_0x618d('0xc'),auth[_0x618d('0xa')](),controller[_0x618d('0xd')]);router[_0x618d('0x8')]('/:id/actions',auth[_0x618d('0xa')](),controller[_0x618d('0xe')]);router['post']('/',auth[_0x618d('0xa')](),controller[_0x618d('0xf')]);router[_0x618d('0x10')](_0x618d('0xc'),auth[_0x618d('0xa')](),controller[_0x618d('0x11')]);router[_0x618d('0x10')](_0x618d('0x12'),auth[_0x618d('0xa')](),controller[_0x618d('0x13')]);router['put']('/:id',auth[_0x618d('0xa')](),controller[_0x618d('0x14')]);router[_0x618d('0x15')](_0x618d('0x16'),auth[_0x618d('0xa')](),controller[_0x618d('0x17')]);module[_0x618d('0x18')]=router; \ No newline at end of file +var _0x7aa7=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','post','create','addConditions','put','delete','destroy','exports'];(function(_0x3b4adb,_0x18f96c){var _0x22cce9=function(_0x2e85d7){while(--_0x2e85d7){_0x3b4adb['push'](_0x3b4adb['shift']());}};_0x22cce9(++_0x18f96c);}(_0x7aa7,0xfd));var _0x77aa=function(_0x3524ec,_0x24fb73){_0x3524ec=_0x3524ec-0x0;var _0x273ddc=_0x7aa7[_0x3524ec];return _0x273ddc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x77aa('0x0'));var timeout=require(_0x77aa('0x1'));var express=require(_0x77aa('0x2'));var router=express['Router']();var fs_extra=require(_0x77aa('0x3'));var auth=require(_0x77aa('0x4'));var interaction=require(_0x77aa('0x5'));var config=require(_0x77aa('0x6'));var controller=require(_0x77aa('0x7'));router[_0x77aa('0x8')]('/',auth[_0x77aa('0x9')](),controller[_0x77aa('0xa')]);router['get'](_0x77aa('0xb'),auth[_0x77aa('0x9')](),controller[_0x77aa('0xc')]);router[_0x77aa('0x8')](_0x77aa('0xd'),auth[_0x77aa('0x9')](),controller[_0x77aa('0xe')]);router['get'](_0x77aa('0xf'),auth['isAuthenticated'](),controller['getActions']);router[_0x77aa('0x10')]('/',auth[_0x77aa('0x9')](),controller[_0x77aa('0x11')]);router[_0x77aa('0x10')](_0x77aa('0xd'),auth['isAuthenticated'](),controller[_0x77aa('0x12')]);router[_0x77aa('0x10')](_0x77aa('0xf'),auth[_0x77aa('0x9')](),controller['addActions']);router[_0x77aa('0x13')](_0x77aa('0xb'),auth[_0x77aa('0x9')](),controller['update']);router[_0x77aa('0x14')]('/:id',auth[_0x77aa('0x9')](),controller[_0x77aa('0x15')]);module[_0x77aa('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 5bbdd0b..932c2cc 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 _0x0d24=['always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','ASC','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)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','name','ivr','BOOLEAN','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM'];(function(_0x156929,_0x44fa01){var _0x23a62d=function(_0x3d1217){while(--_0x3d1217){_0x156929['push'](_0x156929['shift']());}};_0x23a62d(++_0x44fa01);}(_0x0d24,0xeb));var _0x40d2=function(_0x3df276,_0x5912e7){_0x3df276=_0x3df276-0x0;var _0x3d4c1b=_0x0d24[_0x3df276];return _0x3d4c1b;};'use strict';var Sequelize=require(_0x40d2('0x0'));module['exports']={'name':{'type':Sequelize[_0x40d2('0x1')],'unique':_0x40d2('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x40d2('0x3')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x40d2('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x40d2('0x5')](0x4)[_0x40d2('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x40d2('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x40d2('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x40d2('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x40d2('0x5')](0x3)[_0x40d2('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x40d2('0x8')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x40d2('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x40d2('0x5')](0x5)[_0x40d2('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x40d2('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0x40d2('0x5')](0x3)[_0x40d2('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x40d2('0xa')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x40d2('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x40d2('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x40d2('0x5')](0x3)[_0x40d2('0x6')],'defaultValue':0x3,'comment':_0x40d2('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x40d2('0x5')](0x5)[_0x40d2('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x40d2('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x40d2('0x5')](0x3)[_0x40d2('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x40d2('0xe')},'dialTimezone':{'type':Sequelize[_0x40d2('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x40d2('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x40d2('0x10')](_0x40d2('0x11'),_0x40d2('0x12'),_0x40d2('0x13')),'defaultValue':_0x40d2('0x11')},'dialAMDActive':{'type':Sequelize[_0x40d2('0x4')],'defaultValue':0x0,'comment':_0x40d2('0x14')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x40d2('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x40d2('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x40d2('0x5')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x40d2('0x5')](0x9)[_0x40d2('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x40d2('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x40d2('0x5')](0x9)[_0x40d2('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x40d2('0x17')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x40d2('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x40d2('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x40d2('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x40d2('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x40d2('0x5')](0x9)[_0x40d2('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x40d2('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x40d2('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x40d2('0x5')](0x9)[_0x40d2('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x40d2('0x1b')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x40d2('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x40d2('0x5')](0x3)[_0x40d2('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x40d2('0x5')](0x3)[_0x40d2('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x40d2('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x40d2('0x5')](0x3)[_0x40d2('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x40d2('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x40d2('0x5')](0x5)[_0x40d2('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x40d2('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0x40d2('0x5')](0x3)[_0x40d2('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x40d2('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x40d2('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x40d2('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x40d2('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x40d2('0x5')](0x5)[_0x40d2('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x40d2('0x21')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x40d2('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x40d2('0x22')},'dialMachineRetryFrequency':{'type':Sequelize[_0x40d2('0x5')](0x5)[_0x40d2('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x40d2('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x40d2('0x23')}}; \ No newline at end of file +var _0x7508=['INTEGER','#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','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','DESC','ASC','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)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'];(function(_0xdca4a6,_0x4965f6){var _0x5c5b95=function(_0x2c8fe7){while(--_0x2c8fe7){_0xdca4a6['push'](_0xdca4a6['shift']());}};_0x5c5b95(++_0x4965f6);}(_0x7508,0xc3));var _0x8750=function(_0x92f1b,_0x57f2d6){_0x92f1b=_0x92f1b-0x0;var _0x874d22=_0x7508[_0x92f1b];return _0x874d22;};'use strict';var Sequelize=require(_0x8750('0x0'));module['exports']={'name':{'type':Sequelize[_0x8750('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x8750('0x2')]('ivr'),'allowNull':![],'defaultValue':_0x8750('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x8750('0x4')],'defaultValue':0x0,'comment':_0x8750('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x8750('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x8750('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x8750('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8750('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x8750('0x9')](0x3)[_0x8750('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8750('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8750('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8750('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x8750('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8750('0xc')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8750('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8750('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8750('0x6')],'defaultValue':0x3,'comment':_0x8750('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x8750('0x9')](0x5)[_0x8750('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8750('0xf')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8750('0x10')},'dialTimezone':{'type':Sequelize[_0x8750('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x8750('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x8750('0x2')](_0x8750('0x11'),'never','onlyIfOpen'),'defaultValue':_0x8750('0x11')},'dialAMDActive':{'type':Sequelize[_0x8750('0x4')],'defaultValue':0x0,'comment':_0x8750('0x12')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x8750('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8750('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x8750('0x9')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x8750('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8750('0x9')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8750('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8750('0x9')](0x9)[_0x8750('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8750('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x8750('0x9')](0x9)[_0x8750('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x8750('0x9')](0x9)[_0x8750('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x8750('0x9')](0x9)[_0x8750('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x8750('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8750('0x9')](0x9)[_0x8750('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x8750('0x2')](_0x8750('0x17'),_0x8750('0x18')),'defaultValue':_0x8750('0x17')},'dialPrefix':{'type':Sequelize[_0x8750('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x8750('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8750('0x19')},'dialCutDigit':{'type':Sequelize[_0x8750('0x9')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8750('0x1a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x8750('0x9')](0x3)[_0x8750('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x8750('0x9')](0x5)[_0x8750('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8750('0x1b')},'dialDropMaxRetry':{'type':Sequelize[_0x8750('0x9')](0x3)[_0x8750('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8750('0x1c')},'dialDropRetryFrequency':{'type':Sequelize[_0x8750('0x9')](0x5)[_0x8750('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8750('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8750('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x8750('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8750('0x1f')},'dialMachineMaxRetry':{'type':Sequelize[_0x8750('0x9')](0x3)[_0x8750('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x8750('0x9')](0x5)[_0x8750('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8750('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x8750('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x8750('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8750('0x21')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index de9902e..17c25b9 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 _0x124a=['insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','from','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper','onlyIfOpen','deletedAt\x20IS\x20NULL','COALESCE(phone,\x27\x27)','push','sequelize','all','removeLists','getBlackLists','addBlackLists','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','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','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','IvrCampaigns','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','length','omit','createdAt','updatedAt','role','UserProfileSection','getHoppers','findOne','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x124a,0x1b6));var _0xa124=function(_0x15f724,_0x2794ef){_0x15f724=_0x15f724-0x0;var _0x49b152=_0x124a[_0x15f724];return _0x49b152;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa124('0x0'));var zipdir=require(_0xa124('0x1'));var jsonpatch=require(_0xa124('0x2'));var rp=require(_0xa124('0x3'));var moment=require(_0xa124('0x4'));var BPromise=require(_0xa124('0x5'));var Mustache=require(_0xa124('0x6'));var util=require('util');var path=require(_0xa124('0x7'));var sox=require(_0xa124('0x8'));var csv=require(_0xa124('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa124('0xa'));var _=require(_0xa124('0xb'));var squel=require(_0xa124('0xc'));var crypto=require(_0xa124('0xd'));var jsforce=require(_0xa124('0xe'));var deskjs=require(_0xa124('0xf'));var toCsv=require(_0xa124('0x9'));var querystring=require('querystring');var Papa=require(_0xa124('0x10'));var Redis=require(_0xa124('0x11'));var authService=require(_0xa124('0x12'));var qs=require(_0xa124('0x13'));var as=require(_0xa124('0x14'));var hardwareService=require(_0xa124('0x15'));var logger=require(_0xa124('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa124('0x17'));var db=require(_0xa124('0x18'))['db'];function respondWithStatusCode(_0x2c4de1,_0xbbd946){_0xbbd946=_0xbbd946||0xcc;return function(_0x57e8ae){if(_0x57e8ae){return _0x2c4de1[_0xa124('0x19')](_0xbbd946);}return _0x2c4de1[_0xa124('0x1a')](_0xbbd946)['end']();};}function respondWithResult(_0x330150,_0x53276f){_0x53276f=_0x53276f||0xc8;return function(_0x34d8a4){if(_0x34d8a4){return _0x330150[_0xa124('0x1a')](_0x53276f)['json'](_0x34d8a4);}};}function respondWithFilteredResult(_0x4fecee,_0x2785fe){return function(_0x52988a){if(_0x52988a){var _0x478790=typeof _0x2785fe[_0xa124('0x1b')]===_0xa124('0x1c')&&typeof _0x2785fe[_0xa124('0x1d')]==='undefined';var _0x1c6ee9=_0x52988a[_0xa124('0x1e')];var _0x418887=_0x478790?0x0:_0x2785fe[_0xa124('0x1b')];var _0x44543a=_0x478790?_0x52988a[_0xa124('0x1e')]:_0x2785fe[_0xa124('0x1b')]+_0x2785fe[_0xa124('0x1d')];var _0x207bc5;if(_0x44543a>=_0x1c6ee9){_0x44543a=_0x1c6ee9;_0x207bc5=0xc8;}else{_0x207bc5=0xce;}_0x4fecee[_0xa124('0x1a')](_0x207bc5);return _0x4fecee['set'](_0xa124('0x1f'),_0x418887+'-'+_0x44543a+'/'+_0x1c6ee9)[_0xa124('0x20')](_0x52988a);}return null;};}function patchUpdates(_0x3ce151){return function(_0x2eb05d){try{jsonpatch[_0xa124('0x21')](_0x2eb05d,_0x3ce151,!![]);}catch(_0x3865d9){return BPromise[_0xa124('0x22')](_0x3865d9);}return _0x2eb05d[_0xa124('0x23')]();};}function saveUpdates(_0xe61286,_0x1a7ccc){return function(_0x1e43d8){if(_0x1e43d8){return _0x1e43d8[_0xa124('0x24')](_0xe61286)['then'](function(_0xc5ec34){return _0xc5ec34;});}return null;};}function removeEntity(_0x5698ba,_0x3a5e9e){return function(_0x294145){if(_0x294145){return _0x294145[_0xa124('0x25')]()[_0xa124('0x26')](function(){var _0x46145c=_0x294145[_0xa124('0x27')]({'plain':!![]});var _0x226495='IvrCampaigns';return db[_0xa124('0x28')][_0xa124('0x25')]({'where':{'type':_0x226495,'resourceId':_0x46145c['id']}})[_0xa124('0x26')](function(){return _0x294145;});})[_0xa124('0x26')](function(){_0x5698ba[_0xa124('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x625ada,_0x495003){return function(_0xc072aa){if(!_0xc072aa){_0x625ada[_0xa124('0x19')](0x194);}return _0xc072aa;};}function handleError(_0x2a6c96,_0x10cc6c){_0x10cc6c=_0x10cc6c||0x1f4;return function(_0x19455c){logger[_0xa124('0x29')](_0x19455c[_0xa124('0x2a')]);if(_0x19455c[_0xa124('0x2b')]){delete _0x19455c[_0xa124('0x2b')];}_0x2a6c96[_0xa124('0x1a')](_0x10cc6c)['send'](_0x19455c);};}exports[_0xa124('0x2c')]=function(_0x173a19,_0x584b36){var _0x2c8b39={},_0x10111d={},_0x323eeb={'count':0x0,'rows':[]};var _0x16d6c5=_[_0xa124('0x2d')](db[_0xa124('0x2e')][_0xa124('0x2f')],function(_0x535181){return{'name':_0x535181[_0xa124('0x30')],'type':_0x535181[_0xa124('0x31')][_0xa124('0x32')]};});_0x10111d[_0xa124('0x33')]=_['map'](_0x16d6c5,'name');_0x10111d[_0xa124('0x34')]=_[_0xa124('0x35')](_0x173a19['query']);_0x10111d['filters']=_[_0xa124('0x36')](_0x10111d[_0xa124('0x33')],_0x10111d[_0xa124('0x34')]);_0x2c8b39[_0xa124('0x37')]=_[_0xa124('0x36')](_0x10111d[_0xa124('0x33')],qs['fields'](_0x173a19[_0xa124('0x34')][_0xa124('0x38')]));_0x2c8b39[_0xa124('0x37')]=_0x2c8b39[_0xa124('0x37')]['length']?_0x2c8b39['attributes']:_0x10111d[_0xa124('0x33')];if(!_0x173a19['query'][_0xa124('0x39')](_0xa124('0x3a'))){_0x2c8b39[_0xa124('0x1d')]=qs[_0xa124('0x1d')](_0x173a19['query'][_0xa124('0x1d')]);_0x2c8b39['offset']=qs[_0xa124('0x1b')](_0x173a19[_0xa124('0x34')][_0xa124('0x1b')]);}_0x2c8b39[_0xa124('0x3b')]=qs[_0xa124('0x3c')](_0x173a19[_0xa124('0x34')][_0xa124('0x3c')]);_0x2c8b39['where']=qs[_0xa124('0x3d')](_[_0xa124('0x3e')](_0x173a19['query'],_0x10111d[_0xa124('0x3d')]),_0x16d6c5);if(_0x173a19[_0xa124('0x34')][_0xa124('0x3f')]){_0x2c8b39[_0xa124('0x40')]=_[_0xa124('0x41')](_0x2c8b39['where'],{'$or':_[_0xa124('0x2d')](_0x16d6c5,function(_0x4c0d4d){if(_0x4c0d4d[_0xa124('0x31')]!==_0xa124('0x42')){var _0x5ed138={};_0x5ed138[_0x4c0d4d[_0xa124('0x2b')]]={'$like':'%'+_0x173a19[_0xa124('0x34')]['filter']+'%'};return _0x5ed138;}})});}_0x2c8b39=_[_0xa124('0x41')]({},_0x2c8b39,_0x173a19[_0xa124('0x43')]);var _0x7409e7={'where':_0x2c8b39[_0xa124('0x40')]};return db[_0xa124('0x2e')][_0xa124('0x1e')](_0x7409e7)[_0xa124('0x26')](function(_0x3b626f){_0x323eeb[_0xa124('0x1e')]=_0x3b626f;if(_0x173a19[_0xa124('0x34')][_0xa124('0x44')]){_0x2c8b39[_0xa124('0x45')]=[{'all':!![]}];}return db[_0xa124('0x2e')][_0xa124('0x46')](_0x2c8b39);})[_0xa124('0x26')](function(_0x50efa0){_0x323eeb[_0xa124('0x47')]=_0x50efa0;return _0x323eeb;})[_0xa124('0x26')](respondWithFilteredResult(_0x584b36,_0x2c8b39))[_0xa124('0x48')](handleError(_0x584b36,null));};exports[_0xa124('0x49')]=function(_0x5ae955,_0x58dc59){var _0x57fd83={'raw':![],'where':{'id':_0x5ae955[_0xa124('0x4a')]['id']}},_0x37b5a5={};_0x37b5a5[_0xa124('0x33')]=_['keys'](db[_0xa124('0x2e')][_0xa124('0x2f')]);_0x37b5a5[_0xa124('0x34')]=_[_0xa124('0x35')](_0x5ae955['query']);_0x37b5a5[_0xa124('0x3d')]=_['intersection'](_0x37b5a5['model'],_0x37b5a5['query']);_0x57fd83[_0xa124('0x37')]=_[_0xa124('0x36')](_0x37b5a5[_0xa124('0x33')],qs[_0xa124('0x38')](_0x5ae955[_0xa124('0x34')][_0xa124('0x38')]));_0x57fd83[_0xa124('0x37')]=_0x57fd83[_0xa124('0x37')]['length']?_0x57fd83['attributes']:_0x37b5a5['model'];if(_0x5ae955['query'][_0xa124('0x44')]){_0x57fd83[_0xa124('0x45')]=[{'all':!![]}];}_0x57fd83=_[_0xa124('0x41')]({},_0x57fd83,_0x5ae955['options']);return db[_0xa124('0x2e')]['find'](_0x57fd83)[_0xa124('0x26')](handleEntityNotFound(_0x58dc59,null))['then'](respondWithResult(_0x58dc59,null))[_0xa124('0x48')](handleError(_0x58dc59,null));};exports[_0xa124('0x4b')]=function(_0x18ffce,_0x1e85b7){return db['Campaign']['create'](_0x18ffce[_0xa124('0x4c')],{})[_0xa124('0x26')](function(_0x4e2d6c){var _0x5c0466=_0x18ffce[_0xa124('0x4d')][_0xa124('0x27')]({'plain':!![]});if(!_0x5c0466)throw new Error(_0xa124('0x4e'));if(_0x5c0466['role']===_0xa124('0x4d')){var _0x2e3555=_0x4e2d6c[_0xa124('0x27')]({'plain':!![]});var _0x2b6598=_0xa124('0x4f');return db['UserProfileSection'][_0xa124('0x50')]({'where':{'name':_0x2b6598,'userProfileId':_0x5c0466[_0xa124('0x51')]},'raw':!![]})[_0xa124('0x26')](function(_0x3b4722){if(_0x3b4722&&_0x3b4722[_0xa124('0x52')]===0x0){return db['UserProfileResource'][_0xa124('0x4b')]({'name':_0x2e3555[_0xa124('0x2b')],'resourceId':_0x2e3555['id'],'type':_0x3b4722['name'],'sectionId':_0x3b4722['id']},{})['then'](function(){return _0x4e2d6c;});}else{return _0x4e2d6c;}})['catch'](function(_0x329609){logger[_0xa124('0x29')](_0xa124('0x53'),_0x329609);throw _0x329609;});}return _0x4e2d6c;})['then'](respondWithResult(_0x1e85b7,0xc9))[_0xa124('0x48')](handleError(_0x1e85b7,null));};exports['clone']=function(_0x53b894,_0x330db0){var _0x107b13={'where':{'id':_0x53b894[_0xa124('0x4a')]['id']}},_0x136e4c={};_0x136e4c[_0xa124('0x33')]=_[_0xa124('0x35')](db[_0xa124('0x2e')]['rawAttributes']);_0x107b13[_0xa124('0x37')]=_[_0xa124('0x36')](_0x136e4c[_0xa124('0x33')],qs[_0xa124('0x38')](_0x53b894['query'][_0xa124('0x38')]));_0x107b13[_0xa124('0x37')]=_0x107b13[_0xa124('0x37')][_0xa124('0x54')]?_0x107b13[_0xa124('0x37')]:_0x136e4c[_0xa124('0x33')];if(_0x53b894[_0xa124('0x34')]['includeAll']){_0x107b13['include']=[{'all':!![]}];}_0x107b13=_[_0xa124('0x41')]({},_0x107b13,_0x53b894[_0xa124('0x43')]);return db[_0xa124('0x2e')][_0xa124('0x50')](_0x107b13)['then'](handleEntityNotFound(_0x330db0,null))[_0xa124('0x26')](function(_0x3d7185){if(_0x3d7185){var _0x187e8c=_0x3d7185[_0xa124('0x27')]({'plain':!![]});_0x187e8c=qs[_0xa124('0x55')](_0x187e8c,['id',_0xa124('0x56'),_0xa124('0x57')]);_0x53b894['body']=_[_0xa124('0x55')](_0x53b894['body'],['id',_0xa124('0x56'),_0xa124('0x57')]);return db[_0xa124('0x2e')][_0xa124('0x4b')](_[_0xa124('0x41')](_0x187e8c,_0x53b894[_0xa124('0x4c')]),{'include':_0x53b894[_0xa124('0x34')][_0xa124('0x44')]?[{'all':!![]}]:undefined})[_0xa124('0x26')](function(_0x1d1f02){var _0x1bf077=_0x53b894[_0xa124('0x4d')][_0xa124('0x27')]({'plain':!![]});if(!_0x1bf077)throw new Error(_0xa124('0x4e'));if(_0x1bf077[_0xa124('0x58')]===_0xa124('0x4d')){var _0x4164e4=_0x1d1f02['get']({'plain':!![]});var _0x1c038a=_0xa124('0x4f');return db[_0xa124('0x59')][_0xa124('0x50')]({'where':{'name':_0x1c038a,'userProfileId':_0x1bf077['userProfileId']},'raw':!![]})[_0xa124('0x26')](function(_0x32ba3a){if(_0x32ba3a&&_0x32ba3a[_0xa124('0x52')]===0x0){return db['UserProfileResource'][_0xa124('0x4b')]({'name':_0x4164e4[_0xa124('0x2b')],'resourceId':_0x4164e4['id'],'type':_0x32ba3a[_0xa124('0x2b')],'sectionId':_0x32ba3a['id']},{})['then'](function(){return _0x1d1f02;});}else{return _0x1d1f02;}})['catch'](function(_0x31f38d){logger[_0xa124('0x29')](_0xa124('0x53'),_0x31f38d);throw _0x31f38d;});}return _0x1d1f02;});}})[_0xa124('0x26')](respondWithResult(_0x330db0,0xc9))['catch'](handleError(_0x330db0,null));};exports['update']=function(_0xae32bb,_0x48d7a8){if(_0xae32bb[_0xa124('0x4c')]['id']){delete _0xae32bb['body']['id'];}return db[_0xa124('0x2e')][_0xa124('0x50')]({'where':{'id':_0xae32bb[_0xa124('0x4a')]['id']}})[_0xa124('0x26')](handleEntityNotFound(_0x48d7a8,null))[_0xa124('0x26')](saveUpdates(_0xae32bb[_0xa124('0x4c')],null))[_0xa124('0x26')](respondWithResult(_0x48d7a8,null))[_0xa124('0x48')](handleError(_0x48d7a8,null));};exports['destroy']=function(_0x3613f1,_0x4da1ff){return db[_0xa124('0x2e')][_0xa124('0x50')]({'where':{'id':_0x3613f1[_0xa124('0x4a')]['id']}})[_0xa124('0x26')](handleEntityNotFound(_0x4da1ff,null))[_0xa124('0x26')](removeEntity(_0x4da1ff,null))[_0xa124('0x48')](handleError(_0x4da1ff,null));};exports[_0xa124('0x5a')]=function(_0x5db2f6,_0x370d86,_0x22c834){var _0x5cbd17={'raw':!![],'where':{}};var _0x5e70c6={};var _0x26e572={'count':0x0,'rows':[]};return db['Campaign'][_0xa124('0x5b')]({'where':{'id':_0x5db2f6[_0xa124('0x4a')]['id']}})[_0xa124('0x26')](handleEntityNotFound(_0x370d86,null))[_0xa124('0x26')](function(_0x7ec1a2){if(_0x7ec1a2){_0x5e70c6[_0xa124('0x33')]=_[_0xa124('0x35')](db['CmHopper'][_0xa124('0x2f')]);_0x5e70c6[_0xa124('0x34')]=_['keys'](_0x5db2f6[_0xa124('0x34')]);_0x5e70c6[_0xa124('0x3d')]=_[_0xa124('0x36')](_0x5e70c6['model'],_0x5e70c6['query']);_0x5cbd17[_0xa124('0x37')]=_[_0xa124('0x36')](_0x5e70c6[_0xa124('0x33')],qs['fields'](_0x5db2f6[_0xa124('0x34')][_0xa124('0x38')]));_0x5cbd17[_0xa124('0x37')]=_0x5cbd17[_0xa124('0x37')][_0xa124('0x54')]?_0x5cbd17['attributes']:_0x5e70c6['model'];if(!_0x5db2f6[_0xa124('0x34')][_0xa124('0x39')](_0xa124('0x3a'))){_0x5cbd17['limit']=qs['limit'](_0x5db2f6['query'][_0xa124('0x1d')]);_0x5cbd17[_0xa124('0x1b')]=qs[_0xa124('0x1b')](_0x5db2f6[_0xa124('0x34')]['offset']);}_0x5cbd17[_0xa124('0x3b')]=qs[_0xa124('0x3c')](_0x5db2f6['query'][_0xa124('0x3c')]);_0x5cbd17[_0xa124('0x40')]=qs[_0xa124('0x3d')](_[_0xa124('0x3e')](_0x5db2f6['query'],_0x5e70c6[_0xa124('0x3d')]));_0x5cbd17[_0xa124('0x40')][_0xa124('0x5c')]=_0x7ec1a2['id'];if(_0x5db2f6[_0xa124('0x34')]['filter']){_0x5cbd17[_0xa124('0x40')]=_[_0xa124('0x41')](_0x5cbd17[_0xa124('0x40')],{'$or':_['map'](_0x5cbd17[_0xa124('0x37')],function(_0x291fbc){var _0x494d41={};_0x494d41[_0x291fbc]={'$like':'%'+_0x5db2f6[_0xa124('0x34')][_0xa124('0x3f')]+'%'};return _0x494d41;})});}_0x5cbd17=_[_0xa124('0x41')]({},_0x5cbd17,_0x5db2f6[_0xa124('0x43')]);return db[_0xa124('0x5d')][_0xa124('0x1e')]({'where':_0x5cbd17['where']})['then'](function(_0x4f025c){_0x26e572[_0xa124('0x1e')]=_0x4f025c;if(_0x5db2f6[_0xa124('0x34')]['includeAll']){_0x5cbd17[_0xa124('0x45')]=[{'all':!![]}];}return db['CmHopper'][_0xa124('0x46')](_0x5cbd17);})[_0xa124('0x26')](function(_0x24ada7){_0x26e572[_0xa124('0x47')]=_0x24ada7;return _0x26e572;});}})['then'](respondWithFilteredResult(_0x370d86,_0x5cbd17))[_0xa124('0x48')](handleError(_0x370d86,null));};exports[_0xa124('0x5e')]=function(_0x326bb2,_0x42fa4c,_0x318b62){var _0x13a5a2={'raw':!![],'where':{}};var _0x687642={};var _0x1787f5={'count':0x0,'rows':[]};return db[_0xa124('0x2e')]['findOne']({'where':{'id':_0x326bb2[_0xa124('0x4a')]['id']}})[_0xa124('0x26')](handleEntityNotFound(_0x42fa4c,null))['then'](function(_0x2aaff0){if(_0x2aaff0){_0x687642[_0xa124('0x33')]=_['keys'](db[_0xa124('0x5f')][_0xa124('0x2f')]);_0x687642['query']=_['keys'](_0x326bb2[_0xa124('0x34')]);_0x687642['filters']=_[_0xa124('0x36')](_0x687642[_0xa124('0x33')],_0x687642[_0xa124('0x34')]);_0x13a5a2[_0xa124('0x37')]=_[_0xa124('0x36')](_0x687642[_0xa124('0x33')],qs[_0xa124('0x38')](_0x326bb2[_0xa124('0x34')]['fields']));_0x13a5a2[_0xa124('0x37')]=_0x13a5a2[_0xa124('0x37')][_0xa124('0x54')]?_0x13a5a2[_0xa124('0x37')]:_0x687642[_0xa124('0x33')];if(!_0x326bb2[_0xa124('0x34')]['hasOwnProperty'](_0xa124('0x3a'))){_0x13a5a2['limit']=qs['limit'](_0x326bb2[_0xa124('0x34')]['limit']);_0x13a5a2[_0xa124('0x1b')]=qs[_0xa124('0x1b')](_0x326bb2['query'][_0xa124('0x1b')]);}_0x13a5a2[_0xa124('0x3b')]=qs[_0xa124('0x3c')](_0x326bb2[_0xa124('0x34')][_0xa124('0x3c')]);_0x13a5a2[_0xa124('0x40')]=qs[_0xa124('0x3d')](_[_0xa124('0x3e')](_0x326bb2[_0xa124('0x34')],_0x687642[_0xa124('0x3d')]));_0x13a5a2['where'][_0xa124('0x5c')]=_0x2aaff0['id'];if(_0x326bb2[_0xa124('0x34')][_0xa124('0x3f')]){_0x13a5a2[_0xa124('0x40')]=_[_0xa124('0x41')](_0x13a5a2[_0xa124('0x40')],{'$or':_[_0xa124('0x2d')](_0x13a5a2[_0xa124('0x37')],function(_0x44261f){var _0x350eb5={};_0x350eb5[_0x44261f]={'$like':'%'+_0x326bb2['query'][_0xa124('0x3f')]+'%'};return _0x350eb5;})});}_0x13a5a2=_['merge']({},_0x13a5a2,_0x326bb2[_0xa124('0x43')]);return db[_0xa124('0x5f')]['count']({'where':_0x13a5a2[_0xa124('0x40')]})[_0xa124('0x26')](function(_0x23d2dd){_0x1787f5[_0xa124('0x1e')]=_0x23d2dd;if(_0x326bb2[_0xa124('0x34')][_0xa124('0x44')]){_0x13a5a2[_0xa124('0x45')]=[{'all':!![]}];}return db[_0xa124('0x5f')]['findAll'](_0x13a5a2);})['then'](function(_0x1635e2){_0x1787f5[_0xa124('0x47')]=_0x1635e2;return _0x1787f5;});}})['then'](respondWithFilteredResult(_0x42fa4c,_0x13a5a2))[_0xa124('0x48')](handleError(_0x42fa4c,null));};exports[_0xa124('0x60')]=function(_0x703784,_0x50809d,_0x202c2a){var _0x8aba73={'raw':!![],'where':{}};var _0x5b3961={};var _0x24baa9={'count':0x0,'rows':[]};return db[_0xa124('0x2e')]['findOne']({'where':{'id':_0x703784[_0xa124('0x4a')]['id']}})[_0xa124('0x26')](handleEntityNotFound(_0x50809d,null))[_0xa124('0x26')](function(_0x2f756a){if(_0x2f756a){_0x5b3961['model']=_[_0xa124('0x35')](db[_0xa124('0x61')][_0xa124('0x2f')]);_0x5b3961[_0xa124('0x34')]=_['keys'](_0x703784[_0xa124('0x34')]);_0x5b3961['filters']=_[_0xa124('0x36')](_0x5b3961['model'],_0x5b3961[_0xa124('0x34')]);_0x8aba73[_0xa124('0x37')]=_[_0xa124('0x36')](_0x5b3961[_0xa124('0x33')],qs[_0xa124('0x38')](_0x703784['query'][_0xa124('0x38')]));_0x8aba73['attributes']=_0x8aba73[_0xa124('0x37')][_0xa124('0x54')]?_0x8aba73[_0xa124('0x37')]:_0x5b3961['model'];if(!_0x703784[_0xa124('0x34')][_0xa124('0x39')](_0xa124('0x3a'))){_0x8aba73['limit']=qs[_0xa124('0x1d')](_0x703784[_0xa124('0x34')][_0xa124('0x1d')]);_0x8aba73[_0xa124('0x1b')]=qs[_0xa124('0x1b')](_0x703784[_0xa124('0x34')][_0xa124('0x1b')]);}_0x8aba73['order']=qs[_0xa124('0x3c')](_0x703784[_0xa124('0x34')][_0xa124('0x3c')]);_0x8aba73[_0xa124('0x40')]=qs[_0xa124('0x3d')](_[_0xa124('0x3e')](_0x703784[_0xa124('0x34')],_0x5b3961['filters']));_0x8aba73[_0xa124('0x40')][_0xa124('0x5c')]=_0x2f756a['id'];if(_0x703784[_0xa124('0x34')][_0xa124('0x3f')]){_0x8aba73[_0xa124('0x40')]=_[_0xa124('0x41')](_0x8aba73[_0xa124('0x40')],{'$or':_[_0xa124('0x2d')](_0x8aba73[_0xa124('0x37')],function(_0x10e505){var _0x83d94c={};_0x83d94c[_0x10e505]={'$like':'%'+_0x703784[_0xa124('0x34')][_0xa124('0x3f')]+'%'};return _0x83d94c;})});}_0x8aba73=_['merge']({},_0x8aba73,_0x703784['options']);return db[_0xa124('0x61')][_0xa124('0x1e')]({'where':_0x8aba73[_0xa124('0x40')]})[_0xa124('0x26')](function(_0x50b182){_0x24baa9['count']=_0x50b182;if(_0x703784[_0xa124('0x34')]['includeAll']){_0x8aba73[_0xa124('0x45')]=[{'all':!![]}];}return db[_0xa124('0x61')][_0xa124('0x46')](_0x8aba73);})[_0xa124('0x26')](function(_0x12616b){_0x24baa9['rows']=_0x12616b;return _0x24baa9;});}})[_0xa124('0x26')](respondWithFilteredResult(_0x50809d,_0x8aba73))[_0xa124('0x48')](handleError(_0x50809d,null));};exports[_0xa124('0x62')]=function(_0x3fabc9,_0x4abd2c,_0x368b6d){var _0x432839={'raw':!![],'where':{}};var _0x4f21bd={};var _0x191511={'count':0x0,'rows':[]};return db['Campaign'][_0xa124('0x5b')]({'where':{'id':_0x3fabc9[_0xa124('0x4a')]['id']}})[_0xa124('0x26')](handleEntityNotFound(_0x4abd2c,null))[_0xa124('0x26')](function(_0xc40475){if(_0xc40475){_0x4f21bd['model']=_[_0xa124('0x35')](db[_0xa124('0x63')][_0xa124('0x2f')]);_0x4f21bd['query']=_[_0xa124('0x35')](_0x3fabc9['query']);_0x4f21bd[_0xa124('0x3d')]=_[_0xa124('0x36')](_0x4f21bd[_0xa124('0x33')],_0x4f21bd['query']);_0x432839[_0xa124('0x37')]=_[_0xa124('0x36')](_0x4f21bd[_0xa124('0x33')],qs[_0xa124('0x38')](_0x3fabc9[_0xa124('0x34')][_0xa124('0x38')]));_0x432839[_0xa124('0x37')]=_0x432839[_0xa124('0x37')][_0xa124('0x54')]?_0x432839[_0xa124('0x37')]:_0x4f21bd['model'];if(!_0x3fabc9[_0xa124('0x34')]['hasOwnProperty']('nolimit')){_0x432839[_0xa124('0x1d')]=qs[_0xa124('0x1d')](_0x3fabc9[_0xa124('0x34')][_0xa124('0x1d')]);_0x432839[_0xa124('0x1b')]=qs[_0xa124('0x1b')](_0x3fabc9[_0xa124('0x34')][_0xa124('0x1b')]);}_0x432839['order']=qs[_0xa124('0x3c')](_0x3fabc9[_0xa124('0x34')][_0xa124('0x3c')]);_0x432839['where']=qs[_0xa124('0x3d')](_[_0xa124('0x3e')](_0x3fabc9[_0xa124('0x34')],_0x4f21bd[_0xa124('0x3d')]));_0x432839[_0xa124('0x40')][_0xa124('0x5c')]=_0xc40475['id'];if(_0x3fabc9[_0xa124('0x34')]['filter']){_0x432839['where']=_['merge'](_0x432839['where'],{'$or':_[_0xa124('0x2d')](_0x432839[_0xa124('0x37')],function(_0x499684){var _0x491c36={};_0x491c36[_0x499684]={'$like':'%'+_0x3fabc9[_0xa124('0x34')][_0xa124('0x3f')]+'%'};return _0x491c36;})});}_0x432839=_[_0xa124('0x41')]({},_0x432839,_0x3fabc9[_0xa124('0x43')]);return db['CmHopperBlack'][_0xa124('0x1e')]({'where':_0x432839['where']})[_0xa124('0x26')](function(_0x94c3b4){_0x191511[_0xa124('0x1e')]=_0x94c3b4;if(_0x3fabc9['query'][_0xa124('0x44')]){_0x432839[_0xa124('0x45')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xa124('0x46')](_0x432839);})['then'](function(_0xe18a50){_0x191511[_0xa124('0x47')]=_0xe18a50;return _0x191511;});}})[_0xa124('0x26')](respondWithFilteredResult(_0x4abd2c,_0x432839))['catch'](handleError(_0x4abd2c,null));};exports[_0xa124('0x64')]=function(_0x2907c3,_0xa22fe2,_0x229b0e){var _0x4f551f={};var _0x556abd={};var _0x4c6140;var _0x5eecb6;return db[_0xa124('0x2e')][_0xa124('0x5b')]({'where':{'id':_0x2907c3['params']['id']}})[_0xa124('0x26')](handleEntityNotFound(_0xa22fe2,null))['then'](function(_0x4ac930){if(_0x4ac930){_0x4c6140=_0x4ac930;_0x556abd[_0xa124('0x33')]=_[_0xa124('0x35')](db[_0xa124('0x65')]['rawAttributes']);_0x556abd[_0xa124('0x34')]=_[_0xa124('0x35')](_0x2907c3[_0xa124('0x34')]);_0x556abd[_0xa124('0x3d')]=_[_0xa124('0x36')](_0x556abd[_0xa124('0x33')],_0x556abd[_0xa124('0x34')]);_0x4f551f[_0xa124('0x37')]=_['intersection'](_0x556abd[_0xa124('0x33')],qs[_0xa124('0x38')](_0x2907c3[_0xa124('0x34')][_0xa124('0x38')]));_0x4f551f[_0xa124('0x37')]=_0x4f551f[_0xa124('0x37')][_0xa124('0x54')]?_0x4f551f['attributes']:_0x556abd[_0xa124('0x33')];_0x4f551f[_0xa124('0x3b')]=qs[_0xa124('0x3c')](_0x2907c3[_0xa124('0x34')][_0xa124('0x3c')]);_0x4f551f[_0xa124('0x40')]=qs['filters'](_['pick'](_0x2907c3[_0xa124('0x34')],_0x556abd[_0xa124('0x3d')]));if(_0x2907c3['query'][_0xa124('0x3f')]){_0x4f551f[_0xa124('0x40')]=_[_0xa124('0x41')](_0x4f551f['where'],{'$or':_[_0xa124('0x2d')](_0x4f551f['attributes'],function(_0x469496){var _0xf5b698={};_0xf5b698[_0x469496]={'$like':'%'+_0x2907c3[_0xa124('0x34')][_0xa124('0x3f')]+'%'};return _0xf5b698;})});}_0x4f551f=_[_0xa124('0x41')]({},_0x4f551f,_0x2907c3[_0xa124('0x43')]);return _0x4c6140[_0xa124('0x64')](_0x4f551f);}})[_0xa124('0x26')](function(_0x3d69df){if(_0x3d69df){_0x5eecb6=_0x3d69df[_0xa124('0x54')];if(!_0x2907c3[_0xa124('0x34')][_0xa124('0x39')](_0xa124('0x3a'))){_0x4f551f['limit']=qs[_0xa124('0x1d')](_0x2907c3[_0xa124('0x34')][_0xa124('0x1d')]);_0x4f551f[_0xa124('0x1b')]=qs[_0xa124('0x1b')](_0x2907c3[_0xa124('0x34')][_0xa124('0x1b')]);}return _0x4c6140[_0xa124('0x64')](_0x4f551f);}})[_0xa124('0x26')](function(_0x1f9960){if(_0x1f9960){return _0x1f9960?{'count':_0x5eecb6,'rows':_0x1f9960}:null;}})['then'](respondWithResult(_0xa22fe2,null))[_0xa124('0x48')](handleError(_0xa22fe2,null));};exports[_0xa124('0x66')]=function(_0x59941f,_0x5b3be5,_0x198381){var _0x255508,_0x39977a;return db[_0xa124('0x2e')][_0xa124('0x50')]({'where':{'id':_0x59941f['params']['id']}})['then'](handleEntityNotFound(_0x5b3be5,null))['then'](function(_0xdafb23){if(_0xdafb23){_0x39977a=_0xdafb23;return _0xdafb23[_0xa124('0x66')](_0x59941f['body'][_0xa124('0x67')],_[_0xa124('0x55')](_0x59941f[_0xa124('0x4c')],[_0xa124('0x67'),'id'])||{});}return null;})[_0xa124('0x68')](function(_0x3296dd){var _0x2682e4;_0x255508=_0x3296dd||[];var _0x4c732b=[];if(_0x3296dd){for(var _0x5d6ff9=0x0;_0x5d6ff9<_0x3296dd['length'];_0x5d6ff9+=0x1){var _0x27a1fd=_0x3296dd[_0x5d6ff9]['get']({'plain':!![]});_0x39977a[_0xa124('0x69')]=_0x59941f[_0xa124('0x4c')][_0xa124('0x69')]?_0x59941f[_0xa124('0x4c')][_0xa124('0x69')]:_0x39977a[_0xa124('0x69')];switch(_0x39977a[_0xa124('0x69')]){case'always':_0x2682e4=squel[_0xa124('0x6a')]()[_0xa124('0x6b')]('cm_hopper')[_0xa124('0x6c')]([_0xa124('0x6d'),_0xa124('0x6e'),_0xa124('0x6f'),_0xa124('0x70'),_0xa124('0x5c'),_0xa124('0x56'),_0xa124('0x57')],squel[_0xa124('0x71')]()[_0xa124('0x72')](_0xa124('0x6d'),_0xa124('0x6d'))[_0xa124('0x72')](_0xa124('0x73'),_0xa124('0x6e'))['field']('id','ContactId')[_0xa124('0x72')](_0x27a1fd[_0xa124('0x74')][_0xa124('0x75')](),_0xa124('0x70'))[_0xa124('0x72')](_0x59941f[_0xa124('0x4a')]['id'][_0xa124('0x75')](),_0xa124('0x5c'))['field'](_0xa124('0x73'),_0xa124('0x56'))[_0xa124('0x72')]('NOW()',_0xa124('0x57'))['from'](_0xa124('0x76'))['where']('deletedAt\x20IS\x20NULL')[_0xa124('0x40')](_0xa124('0x77'),_0x27a1fd[_0xa124('0x74')]['toString']())[_0xa124('0x40')](_0xa124('0x78'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xa124('0x71')]()[_0xa124('0x72')]('COALESCE(calleridnum,\x27\x27)')[_0xa124('0x79')](_0xa124('0x7a'))['where'](_0xa124('0x7b'),_0x59941f[_0xa124('0x4a')]['id']['toString']()))[_0xa124('0x40')](_0xa124('0x7c'),squel[_0xa124('0x71')]()[_0xa124('0x72')]('COALESCE(phone,\x27\x27)')[_0xa124('0x79')](_0xa124('0x7d'))[_0xa124('0x40')]('CampaignId\x20=\x20?',_0x59941f[_0xa124('0x4a')]['id'][_0xa124('0x75')]())))[_0xa124('0x75')]();break;case _0xa124('0x7e'):_0x2682e4=squel[_0xa124('0x6a')]()[_0xa124('0x6b')](_0xa124('0x7d'))[_0xa124('0x6c')]([_0xa124('0x6d'),_0xa124('0x6e'),'ContactId',_0xa124('0x70'),_0xa124('0x5c'),_0xa124('0x56'),_0xa124('0x57')],squel[_0xa124('0x71')]()[_0xa124('0x72')](_0xa124('0x6d'),_0xa124('0x6d'))[_0xa124('0x72')]('NOW()','scheduledAt')[_0xa124('0x72')]('id',_0xa124('0x6f'))[_0xa124('0x72')](_0x27a1fd[_0xa124('0x74')][_0xa124('0x75')](),_0xa124('0x70'))[_0xa124('0x72')](_0x59941f[_0xa124('0x4a')]['id'][_0xa124('0x75')](),_0xa124('0x5c'))[_0xa124('0x72')](_0xa124('0x73'),_0xa124('0x56'))['field'](_0xa124('0x73'),_0xa124('0x57'))[_0xa124('0x79')](_0xa124('0x76'))[_0xa124('0x40')](_0xa124('0x7f'))[_0xa124('0x40')](_0xa124('0x77'),_0x27a1fd[_0xa124('0x74')][_0xa124('0x75')]())[_0xa124('0x40')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xa124('0x7c'),squel[_0xa124('0x71')]()[_0xa124('0x72')](_0xa124('0x80'))[_0xa124('0x79')](_0xa124('0x7d'))['where']('CampaignId\x20=\x20?',_0x59941f['params']['id'][_0xa124('0x75')]())))[_0xa124('0x75')]();break;default:_0x2682e4=squel['insert']()['into']('cm_hopper')[_0xa124('0x6c')]([_0xa124('0x6d'),_0xa124('0x6e'),_0xa124('0x6f'),_0xa124('0x70'),_0xa124('0x5c'),'createdAt',_0xa124('0x57')],squel[_0xa124('0x71')]()['field']('phone',_0xa124('0x6d'))[_0xa124('0x72')]('NOW()',_0xa124('0x6e'))[_0xa124('0x72')]('id','ContactId')[_0xa124('0x72')](_0x27a1fd[_0xa124('0x74')][_0xa124('0x75')](),_0xa124('0x70'))[_0xa124('0x72')](_0x59941f['params']['id']['toString'](),'CampaignId')['field'](_0xa124('0x73'),_0xa124('0x56'))['field']('NOW()',_0xa124('0x57'))[_0xa124('0x79')](_0xa124('0x76'))['where']('deletedAt\x20IS\x20NULL')[_0xa124('0x40')](_0xa124('0x77'),_0x27a1fd[_0xa124('0x74')][_0xa124('0x75')]())['where'](_0xa124('0x78')))[_0xa124('0x75')]();}_0x4c732b[_0xa124('0x81')](db[_0xa124('0x82')][_0xa124('0x34')](_0x2682e4));}return BPromise[_0xa124('0x83')](_0x4c732b);}})[_0xa124('0x26')](function(){return _0x255508;})[_0xa124('0x26')](respondWithResult(_0x5b3be5,null))[_0xa124('0x48')](handleError(_0x5b3be5,null));};exports[_0xa124('0x84')]=function(_0x64df38,_0x51bdee,_0x300200){return db[_0xa124('0x2e')][_0xa124('0x50')]({'where':{'id':_0x64df38[_0xa124('0x4a')]['id']}})[_0xa124('0x26')](handleEntityNotFound(_0x51bdee,null))[_0xa124('0x26')](function(_0x50c552){if(_0x50c552){return _0x50c552[_0xa124('0x84')](_0x64df38['query'][_0xa124('0x67')]);}})[_0xa124('0x26')](function(_0x3d8383){if(_0x3d8383){return db[_0xa124('0x5d')][_0xa124('0x25')]({'where':{'ListId':_0x64df38[_0xa124('0x34')][_0xa124('0x67')],'CampaignId':_0x64df38[_0xa124('0x4a')]['id']}})[_0xa124('0x26')](function(){return _0x3d8383;});}})[_0xa124('0x26')](respondWithStatusCode(_0x51bdee,null))[_0xa124('0x48')](handleError(_0x51bdee,null));};exports['getBlackLists']=function(_0x39d3ef,_0x16353d,_0x10780e){var _0xb7649c={};var _0x38a74a={};var _0x42b9f6;var _0x1e3d88;return db[_0xa124('0x2e')]['findOne']({'where':{'id':_0x39d3ef['params']['id']}})[_0xa124('0x26')](handleEntityNotFound(_0x16353d,null))['then'](function(_0x2556c9){if(_0x2556c9){_0x42b9f6=_0x2556c9;_0x38a74a[_0xa124('0x33')]=_[_0xa124('0x35')](db[_0xa124('0x65')]['rawAttributes']);_0x38a74a['query']=_[_0xa124('0x35')](_0x39d3ef[_0xa124('0x34')]);_0x38a74a['filters']=_['intersection'](_0x38a74a[_0xa124('0x33')],_0x38a74a[_0xa124('0x34')]);_0xb7649c[_0xa124('0x37')]=_['intersection'](_0x38a74a['model'],qs['fields'](_0x39d3ef['query'][_0xa124('0x38')]));_0xb7649c[_0xa124('0x37')]=_0xb7649c['attributes']['length']?_0xb7649c[_0xa124('0x37')]:_0x38a74a['model'];_0xb7649c[_0xa124('0x3b')]=qs[_0xa124('0x3c')](_0x39d3ef[_0xa124('0x34')][_0xa124('0x3c')]);_0xb7649c['where']=qs[_0xa124('0x3d')](_[_0xa124('0x3e')](_0x39d3ef['query'],_0x38a74a[_0xa124('0x3d')]));if(_0x39d3ef[_0xa124('0x34')]['filter']){_0xb7649c[_0xa124('0x40')]=_[_0xa124('0x41')](_0xb7649c[_0xa124('0x40')],{'$or':_[_0xa124('0x2d')](_0xb7649c['attributes'],function(_0x2cb1c2){var _0x5489de={};_0x5489de[_0x2cb1c2]={'$like':'%'+_0x39d3ef[_0xa124('0x34')]['filter']+'%'};return _0x5489de;})});}_0xb7649c=_[_0xa124('0x41')]({},_0xb7649c,_0x39d3ef[_0xa124('0x43')]);return _0x42b9f6[_0xa124('0x85')](_0xb7649c);}})[_0xa124('0x26')](function(_0x186d04){if(_0x186d04){_0x1e3d88=_0x186d04[_0xa124('0x54')];if(!_0x39d3ef[_0xa124('0x34')][_0xa124('0x39')]('nolimit')){_0xb7649c[_0xa124('0x1d')]=qs[_0xa124('0x1d')](_0x39d3ef[_0xa124('0x34')][_0xa124('0x1d')]);_0xb7649c[_0xa124('0x1b')]=qs[_0xa124('0x1b')](_0x39d3ef[_0xa124('0x34')][_0xa124('0x1b')]);}return _0x42b9f6[_0xa124('0x85')](_0xb7649c);}})[_0xa124('0x26')](function(_0x201e8a){if(_0x201e8a){return _0x201e8a?{'count':_0x1e3d88,'rows':_0x201e8a}:null;}})[_0xa124('0x26')](respondWithResult(_0x16353d,null))[_0xa124('0x48')](handleError(_0x16353d,null));};exports[_0xa124('0x86')]=function(_0x2c3854,_0x156080,_0x59afcd){var _0x1b3290,_0xd41530;return db[_0xa124('0x2e')][_0xa124('0x50')]({'where':{'id':_0x2c3854[_0xa124('0x4a')]['id']}})[_0xa124('0x26')](handleEntityNotFound(_0x156080,null))['then'](function(_0x1e3214){if(_0x1e3214){_0xd41530=_0x1e3214;return _0x1e3214['addBlackLists'](_0x2c3854['body']['ids'],_[_0xa124('0x55')](_0x2c3854['body'],[_0xa124('0x67'),'id'])||{});}return null;})[_0xa124('0x68')](function(_0x2e4cf7){var _0x11b265;_0x1b3290=_0x2e4cf7||[];var _0x180a06=[];if(_0x2e4cf7){for(var _0x1ff806=0x0;_0x1ff806<_0x2e4cf7['length'];_0x1ff806+=0x1){var _0x4f49ea=_0x2e4cf7[_0x1ff806][_0xa124('0x27')]({'plain':!![]});_0x11b265=squel[_0xa124('0x6a')]()[_0xa124('0x6b')]('cm_hopper_black')[_0xa124('0x6c')](['phone',_0xa124('0x6f'),'ListId',_0xa124('0x5c'),'createdAt',_0xa124('0x57')],squel['select']()[_0xa124('0x72')](_0xa124('0x6d'),'phone')['field']('id',_0xa124('0x6f'))[_0xa124('0x72')](_0x4f49ea['CmListId']['toString'](),_0xa124('0x70'))[_0xa124('0x72')](_0x2c3854[_0xa124('0x4a')]['id'][_0xa124('0x75')](),_0xa124('0x5c'))[_0xa124('0x72')](_0xa124('0x73'),_0xa124('0x56'))[_0xa124('0x72')](_0xa124('0x73'),_0xa124('0x57'))[_0xa124('0x79')](_0xa124('0x76'))[_0xa124('0x40')](_0xa124('0x7f'))['where'](_0xa124('0x77'),_0x4f49ea[_0xa124('0x74')][_0xa124('0x75')]())[_0xa124('0x40')]('phone\x20IS\x20NOT\x20NULL'))[_0xa124('0x75')]();_0x180a06[_0xa124('0x81')](db[_0xa124('0x82')][_0xa124('0x34')](_0x11b265));}return BPromise[_0xa124('0x83')](_0x180a06);}})['then'](function(){return _0x1b3290;})[_0xa124('0x26')](respondWithResult(_0x156080,null))[_0xa124('0x48')](handleError(_0x156080,null));};exports[_0xa124('0x87')]=function(_0x2489d4,_0x401c1c,_0x3fb2ae){return db['Campaign'][_0xa124('0x50')]({'where':{'id':_0x2489d4[_0xa124('0x4a')]['id']}})[_0xa124('0x26')](handleEntityNotFound(_0x401c1c,null))[_0xa124('0x26')](function(_0x5e492d){if(_0x5e492d){return _0x5e492d[_0xa124('0x87')](_0x2489d4[_0xa124('0x34')]['ids']);}})['then'](function(_0x101cc8){if(_0x101cc8){return db[_0xa124('0x63')][_0xa124('0x25')]({'where':{'ListId':_0x2489d4[_0xa124('0x34')][_0xa124('0x67')],'CampaignId':_0x2489d4[_0xa124('0x4a')]['id']}})[_0xa124('0x26')](function(){return _0x101cc8;});}})[_0xa124('0x26')](respondWithStatusCode(_0x401c1c,null))[_0xa124('0x48')](handleError(_0x401c1c,null));}; \ No newline at end of file +var _0x90c5=['CampaignId','CmHopper','findAll','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','select','field','ContactId','toString','NOW()','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','cm_contacts','ListId','phone\x20IS\x20NOT\x20NULL','sequelize','all','removeLists','getBlackLists','addBlackLists','spread','cm_hopper_black','push','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','reject','save','destroy','then','get','IvrCampaigns','UserProfileResource','error','stack','name','send','map','Campaign','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','update','getHoppers'];(function(_0x4b8dfd,_0x3efad5){var _0x55b94a=function(_0x443de7){while(--_0x443de7){_0x4b8dfd['push'](_0x4b8dfd['shift']());}};_0x55b94a(++_0x3efad5);}(_0x90c5,0xb4));var _0x590c=function(_0x3c0488,_0x5c74fb){_0x3c0488=_0x3c0488-0x0;var _0x4c0f26=_0x90c5[_0x3c0488];return _0x4c0f26;};'use strict';var emlformat=require(_0x590c('0x0'));var rimraf=require(_0x590c('0x1'));var zipdir=require(_0x590c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x590c('0x3'));var moment=require(_0x590c('0x4'));var BPromise=require(_0x590c('0x5'));var Mustache=require(_0x590c('0x6'));var util=require(_0x590c('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x590c('0x8'));var fs=require('fs');var fs_extra=require(_0x590c('0x9'));var _=require(_0x590c('0xa'));var squel=require(_0x590c('0xb'));var crypto=require(_0x590c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x590c('0xd'));var toCsv=require(_0x590c('0xe'));var querystring=require('querystring');var Papa=require(_0x590c('0xf'));var Redis=require(_0x590c('0x10'));var authService=require(_0x590c('0x11'));var qs=require(_0x590c('0x12'));var as=require(_0x590c('0x13'));var hardwareService=require(_0x590c('0x14'));var logger=require(_0x590c('0x15'))(_0x590c('0x16'));var utils=require(_0x590c('0x17'));var config=require(_0x590c('0x18'));var licenseUtil=require(_0x590c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e54f6,_0x4e310c){_0x4e310c=_0x4e310c||0xcc;return function(_0x3f617b){if(_0x3f617b){return _0x2e54f6[_0x590c('0x1a')](_0x4e310c);}return _0x2e54f6[_0x590c('0x1b')](_0x4e310c)[_0x590c('0x1c')]();};}function respondWithResult(_0x4862eb,_0x3f4fcf){_0x3f4fcf=_0x3f4fcf||0xc8;return function(_0x32d4e8){if(_0x32d4e8){return _0x4862eb['status'](_0x3f4fcf)['json'](_0x32d4e8);}};}function respondWithFilteredResult(_0x332dd1,_0x908ec0){return function(_0x503922){if(_0x503922){var _0x4c0214=typeof _0x908ec0[_0x590c('0x1d')]==='undefined'&&typeof _0x908ec0['limit']===_0x590c('0x1e');var _0x560e60=_0x503922['count'];var _0x2e2332=_0x4c0214?0x0:_0x908ec0[_0x590c('0x1d')];var _0x22aac8=_0x4c0214?_0x503922[_0x590c('0x1f')]:_0x908ec0['offset']+_0x908ec0[_0x590c('0x20')];var _0x1be593;if(_0x22aac8>=_0x560e60){_0x22aac8=_0x560e60;_0x1be593=0xc8;}else{_0x1be593=0xce;}_0x332dd1[_0x590c('0x1b')](_0x1be593);return _0x332dd1['set']('Content-Range',_0x2e2332+'-'+_0x22aac8+'/'+_0x560e60)['json'](_0x503922);}return null;};}function patchUpdates(_0x4e39ba){return function(_0x207094){try{jsonpatch['apply'](_0x207094,_0x4e39ba,!![]);}catch(_0x51c5a4){return BPromise[_0x590c('0x21')](_0x51c5a4);}return _0x207094[_0x590c('0x22')]();};}function saveUpdates(_0x3d0416,_0x18371a){return function(_0x1f329f){if(_0x1f329f){return _0x1f329f['update'](_0x3d0416)['then'](function(_0x205d29){return _0x205d29;});}return null;};}function removeEntity(_0x15fe93,_0x408e90){return function(_0x3c1b20){if(_0x3c1b20){return _0x3c1b20[_0x590c('0x23')]()[_0x590c('0x24')](function(){var _0x189380=_0x3c1b20[_0x590c('0x25')]({'plain':!![]});var _0xae88dd=_0x590c('0x26');return db[_0x590c('0x27')][_0x590c('0x23')]({'where':{'type':_0xae88dd,'resourceId':_0x189380['id']}})[_0x590c('0x24')](function(){return _0x3c1b20;});})['then'](function(){_0x15fe93[_0x590c('0x1b')](0xcc)[_0x590c('0x1c')]();});}};}function handleEntityNotFound(_0x1516db,_0x30fb7e){return function(_0x17520f){if(!_0x17520f){_0x1516db[_0x590c('0x1a')](0x194);}return _0x17520f;};}function handleError(_0x1ec69d,_0xf65ed4){_0xf65ed4=_0xf65ed4||0x1f4;return function(_0x475717){logger[_0x590c('0x28')](_0x475717[_0x590c('0x29')]);if(_0x475717[_0x590c('0x2a')]){delete _0x475717[_0x590c('0x2a')];}_0x1ec69d['status'](_0xf65ed4)[_0x590c('0x2b')](_0x475717);};}exports['index']=function(_0x544961,_0x1b2250){var _0x3ff1dd={},_0x3dfdb8={},_0x407e43={'count':0x0,'rows':[]};var _0x38927d=_[_0x590c('0x2c')](db[_0x590c('0x2d')][_0x590c('0x2e')],function(_0x326832){return{'name':_0x326832[_0x590c('0x2f')],'type':_0x326832[_0x590c('0x30')]['key']};});_0x3dfdb8[_0x590c('0x31')]=_[_0x590c('0x2c')](_0x38927d,_0x590c('0x2a'));_0x3dfdb8[_0x590c('0x32')]=_[_0x590c('0x33')](_0x544961[_0x590c('0x32')]);_0x3dfdb8['filters']=_[_0x590c('0x34')](_0x3dfdb8[_0x590c('0x31')],_0x3dfdb8['query']);_0x3ff1dd[_0x590c('0x35')]=_['intersection'](_0x3dfdb8[_0x590c('0x31')],qs[_0x590c('0x36')](_0x544961['query']['fields']));_0x3ff1dd['attributes']=_0x3ff1dd['attributes'][_0x590c('0x37')]?_0x3ff1dd[_0x590c('0x35')]:_0x3dfdb8['model'];if(!_0x544961[_0x590c('0x32')][_0x590c('0x38')](_0x590c('0x39'))){_0x3ff1dd['limit']=qs[_0x590c('0x20')](_0x544961[_0x590c('0x32')][_0x590c('0x20')]);_0x3ff1dd[_0x590c('0x1d')]=qs[_0x590c('0x1d')](_0x544961[_0x590c('0x32')][_0x590c('0x1d')]);}_0x3ff1dd[_0x590c('0x3a')]=qs['sort'](_0x544961[_0x590c('0x32')][_0x590c('0x3b')]);_0x3ff1dd[_0x590c('0x3c')]=qs['filters'](_[_0x590c('0x3d')](_0x544961[_0x590c('0x32')],_0x3dfdb8[_0x590c('0x3e')]),_0x38927d);if(_0x544961[_0x590c('0x32')][_0x590c('0x3f')]){_0x3ff1dd[_0x590c('0x3c')]=_[_0x590c('0x40')](_0x3ff1dd[_0x590c('0x3c')],{'$or':_[_0x590c('0x2c')](_0x38927d,function(_0x1712eb){if(_0x1712eb['type']!==_0x590c('0x41')){var _0xb95c5d={};_0xb95c5d[_0x1712eb[_0x590c('0x2a')]]={'$like':'%'+_0x544961[_0x590c('0x32')][_0x590c('0x3f')]+'%'};return _0xb95c5d;}})});}_0x3ff1dd=_[_0x590c('0x40')]({},_0x3ff1dd,_0x544961[_0x590c('0x42')]);var _0x3253fb={'where':_0x3ff1dd[_0x590c('0x3c')]};return db[_0x590c('0x2d')][_0x590c('0x1f')](_0x3253fb)[_0x590c('0x24')](function(_0x562183){_0x407e43[_0x590c('0x1f')]=_0x562183;if(_0x544961[_0x590c('0x32')][_0x590c('0x43')]){_0x3ff1dd[_0x590c('0x44')]=[{'all':!![]}];}return db[_0x590c('0x2d')]['findAll'](_0x3ff1dd);})[_0x590c('0x24')](function(_0x576cd9){_0x407e43[_0x590c('0x45')]=_0x576cd9;return _0x407e43;})[_0x590c('0x24')](respondWithFilteredResult(_0x1b2250,_0x3ff1dd))[_0x590c('0x46')](handleError(_0x1b2250,null));};exports['show']=function(_0x366eda,_0x415391){var _0x4aa2b8={'raw':![],'where':{'id':_0x366eda[_0x590c('0x47')]['id']}},_0x15fc96={};_0x15fc96[_0x590c('0x31')]=_[_0x590c('0x33')](db['Campaign'][_0x590c('0x2e')]);_0x15fc96[_0x590c('0x32')]=_[_0x590c('0x33')](_0x366eda[_0x590c('0x32')]);_0x15fc96[_0x590c('0x3e')]=_['intersection'](_0x15fc96[_0x590c('0x31')],_0x15fc96['query']);_0x4aa2b8[_0x590c('0x35')]=_['intersection'](_0x15fc96['model'],qs[_0x590c('0x36')](_0x366eda[_0x590c('0x32')]['fields']));_0x4aa2b8['attributes']=_0x4aa2b8['attributes'][_0x590c('0x37')]?_0x4aa2b8[_0x590c('0x35')]:_0x15fc96[_0x590c('0x31')];if(_0x366eda[_0x590c('0x32')][_0x590c('0x43')]){_0x4aa2b8[_0x590c('0x44')]=[{'all':!![]}];}_0x4aa2b8=_['merge']({},_0x4aa2b8,_0x366eda['options']);return db['Campaign'][_0x590c('0x48')](_0x4aa2b8)[_0x590c('0x24')](handleEntityNotFound(_0x415391,null))[_0x590c('0x24')](respondWithResult(_0x415391,null))[_0x590c('0x46')](handleError(_0x415391,null));};exports['create']=function(_0x2e60f2,_0x144678){return db[_0x590c('0x2d')][_0x590c('0x49')](_0x2e60f2[_0x590c('0x4a')],{})[_0x590c('0x24')](function(_0x588372){var _0x28a4b2=_0x2e60f2[_0x590c('0x4b')][_0x590c('0x25')]({'plain':!![]});if(!_0x28a4b2)throw new Error(_0x590c('0x4c'));if(_0x28a4b2[_0x590c('0x4d')]===_0x590c('0x4b')){var _0x5435b5=_0x588372[_0x590c('0x25')]({'plain':!![]});var _0x29d835='IvrCampaigns';return db[_0x590c('0x4e')][_0x590c('0x48')]({'where':{'name':_0x29d835,'userProfileId':_0x28a4b2[_0x590c('0x4f')]},'raw':!![]})[_0x590c('0x24')](function(_0x481a86){if(_0x481a86&&_0x481a86[_0x590c('0x50')]===0x0){return db[_0x590c('0x27')][_0x590c('0x49')]({'name':_0x5435b5['name'],'resourceId':_0x5435b5['id'],'type':_0x481a86[_0x590c('0x2a')],'sectionId':_0x481a86['id']},{})['then'](function(){return _0x588372;});}else{return _0x588372;}})[_0x590c('0x46')](function(_0x4119a3){logger[_0x590c('0x28')](_0x590c('0x51'),_0x4119a3);throw _0x4119a3;});}return _0x588372;})[_0x590c('0x24')](respondWithResult(_0x144678,0xc9))[_0x590c('0x46')](handleError(_0x144678,null));};exports[_0x590c('0x52')]=function(_0x18322e,_0x4eb5f0){var _0x1ed5f8={'where':{'id':_0x18322e[_0x590c('0x47')]['id']}},_0x8dee3={};_0x8dee3[_0x590c('0x31')]=_[_0x590c('0x33')](db['Campaign'][_0x590c('0x2e')]);_0x1ed5f8['attributes']=_['intersection'](_0x8dee3[_0x590c('0x31')],qs[_0x590c('0x36')](_0x18322e['query'][_0x590c('0x36')]));_0x1ed5f8[_0x590c('0x35')]=_0x1ed5f8[_0x590c('0x35')][_0x590c('0x37')]?_0x1ed5f8[_0x590c('0x35')]:_0x8dee3['model'];if(_0x18322e[_0x590c('0x32')][_0x590c('0x43')]){_0x1ed5f8[_0x590c('0x44')]=[{'all':!![]}];}_0x1ed5f8=_[_0x590c('0x40')]({},_0x1ed5f8,_0x18322e['options']);return db['Campaign'][_0x590c('0x48')](_0x1ed5f8)['then'](handleEntityNotFound(_0x4eb5f0,null))[_0x590c('0x24')](function(_0x6bd12b){if(_0x6bd12b){var _0x353938=_0x6bd12b[_0x590c('0x25')]({'plain':!![]});_0x353938=qs[_0x590c('0x53')](_0x353938,['id',_0x590c('0x54'),_0x590c('0x55')]);_0x18322e['body']=_[_0x590c('0x53')](_0x18322e[_0x590c('0x4a')],['id',_0x590c('0x54'),_0x590c('0x55')]);return db['Campaign'][_0x590c('0x49')](_[_0x590c('0x40')](_0x353938,_0x18322e[_0x590c('0x4a')]),{'include':_0x18322e[_0x590c('0x32')][_0x590c('0x43')]?[{'all':!![]}]:undefined})[_0x590c('0x24')](function(_0x50c32b){var _0x275993=_0x18322e['user'][_0x590c('0x25')]({'plain':!![]});if(!_0x275993)throw new Error(_0x590c('0x4c'));if(_0x275993[_0x590c('0x4d')]===_0x590c('0x4b')){var _0x450431=_0x50c32b['get']({'plain':!![]});var _0x30c3d8=_0x590c('0x26');return db[_0x590c('0x4e')][_0x590c('0x48')]({'where':{'name':_0x30c3d8,'userProfileId':_0x275993['userProfileId']},'raw':!![]})[_0x590c('0x24')](function(_0x410c0b){if(_0x410c0b&&_0x410c0b[_0x590c('0x50')]===0x0){return db[_0x590c('0x27')]['create']({'name':_0x450431['name'],'resourceId':_0x450431['id'],'type':_0x410c0b['name'],'sectionId':_0x410c0b['id']},{})[_0x590c('0x24')](function(){return _0x50c32b;});}else{return _0x50c32b;}})[_0x590c('0x46')](function(_0x5301ea){logger[_0x590c('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5301ea);throw _0x5301ea;});}return _0x50c32b;});}})['then'](respondWithResult(_0x4eb5f0,0xc9))['catch'](handleError(_0x4eb5f0,null));};exports[_0x590c('0x56')]=function(_0x359910,_0x1efd98){if(_0x359910[_0x590c('0x4a')]['id']){delete _0x359910[_0x590c('0x4a')]['id'];}return db['Campaign'][_0x590c('0x48')]({'where':{'id':_0x359910['params']['id']}})[_0x590c('0x24')](handleEntityNotFound(_0x1efd98,null))['then'](saveUpdates(_0x359910[_0x590c('0x4a')],null))[_0x590c('0x24')](respondWithResult(_0x1efd98,null))['catch'](handleError(_0x1efd98,null));};exports[_0x590c('0x23')]=function(_0x2abe34,_0x50f6a6){return db[_0x590c('0x2d')][_0x590c('0x48')]({'where':{'id':_0x2abe34[_0x590c('0x47')]['id']}})[_0x590c('0x24')](handleEntityNotFound(_0x50f6a6,null))[_0x590c('0x24')](removeEntity(_0x50f6a6,null))[_0x590c('0x46')](handleError(_0x50f6a6,null));};exports[_0x590c('0x57')]=function(_0x4ccca8,_0x118dd1,_0x42ea48){var _0x147540={'raw':!![],'where':{}};var _0x2643c0={};var _0x9871e6={'count':0x0,'rows':[]};return db[_0x590c('0x2d')]['findOne']({'where':{'id':_0x4ccca8[_0x590c('0x47')]['id']}})[_0x590c('0x24')](handleEntityNotFound(_0x118dd1,null))['then'](function(_0x263e73){if(_0x263e73){_0x2643c0['model']=_[_0x590c('0x33')](db['CmHopper'][_0x590c('0x2e')]);_0x2643c0[_0x590c('0x32')]=_['keys'](_0x4ccca8[_0x590c('0x32')]);_0x2643c0[_0x590c('0x3e')]=_[_0x590c('0x34')](_0x2643c0[_0x590c('0x31')],_0x2643c0[_0x590c('0x32')]);_0x147540[_0x590c('0x35')]=_[_0x590c('0x34')](_0x2643c0[_0x590c('0x31')],qs[_0x590c('0x36')](_0x4ccca8[_0x590c('0x32')][_0x590c('0x36')]));_0x147540['attributes']=_0x147540[_0x590c('0x35')]['length']?_0x147540[_0x590c('0x35')]:_0x2643c0[_0x590c('0x31')];if(!_0x4ccca8[_0x590c('0x32')][_0x590c('0x38')]('nolimit')){_0x147540['limit']=qs[_0x590c('0x20')](_0x4ccca8[_0x590c('0x32')][_0x590c('0x20')]);_0x147540[_0x590c('0x1d')]=qs[_0x590c('0x1d')](_0x4ccca8[_0x590c('0x32')]['offset']);}_0x147540[_0x590c('0x3a')]=qs['sort'](_0x4ccca8[_0x590c('0x32')][_0x590c('0x3b')]);_0x147540[_0x590c('0x3c')]=qs[_0x590c('0x3e')](_['pick'](_0x4ccca8['query'],_0x2643c0[_0x590c('0x3e')]));_0x147540['where'][_0x590c('0x58')]=_0x263e73['id'];if(_0x4ccca8[_0x590c('0x32')][_0x590c('0x3f')]){_0x147540[_0x590c('0x3c')]=_[_0x590c('0x40')](_0x147540['where'],{'$or':_[_0x590c('0x2c')](_0x147540[_0x590c('0x35')],function(_0x3f76b9){var _0x4336fd={};_0x4336fd[_0x3f76b9]={'$like':'%'+_0x4ccca8['query']['filter']+'%'};return _0x4336fd;})});}_0x147540=_[_0x590c('0x40')]({},_0x147540,_0x4ccca8[_0x590c('0x42')]);return db['CmHopper'][_0x590c('0x1f')]({'where':_0x147540[_0x590c('0x3c')]})[_0x590c('0x24')](function(_0x2eba1f){_0x9871e6[_0x590c('0x1f')]=_0x2eba1f;if(_0x4ccca8['query'][_0x590c('0x43')]){_0x147540[_0x590c('0x44')]=[{'all':!![]}];}return db[_0x590c('0x59')][_0x590c('0x5a')](_0x147540);})[_0x590c('0x24')](function(_0x21b0d6){_0x9871e6[_0x590c('0x45')]=_0x21b0d6;return _0x9871e6;});}})[_0x590c('0x24')](respondWithFilteredResult(_0x118dd1,_0x147540))[_0x590c('0x46')](handleError(_0x118dd1,null));};exports['getHopperHistories']=function(_0x14fa86,_0x559b2e,_0x3b28e6){var _0x132de1={'raw':!![],'where':{}};var _0x52a1ab={};var _0xa72792={'count':0x0,'rows':[]};return db[_0x590c('0x2d')][_0x590c('0x5b')]({'where':{'id':_0x14fa86[_0x590c('0x47')]['id']}})[_0x590c('0x24')](handleEntityNotFound(_0x559b2e,null))['then'](function(_0x5a8f6d){if(_0x5a8f6d){_0x52a1ab[_0x590c('0x31')]=_[_0x590c('0x33')](db[_0x590c('0x5c')][_0x590c('0x2e')]);_0x52a1ab[_0x590c('0x32')]=_[_0x590c('0x33')](_0x14fa86[_0x590c('0x32')]);_0x52a1ab[_0x590c('0x3e')]=_['intersection'](_0x52a1ab[_0x590c('0x31')],_0x52a1ab[_0x590c('0x32')]);_0x132de1[_0x590c('0x35')]=_[_0x590c('0x34')](_0x52a1ab['model'],qs['fields'](_0x14fa86['query'][_0x590c('0x36')]));_0x132de1[_0x590c('0x35')]=_0x132de1[_0x590c('0x35')]['length']?_0x132de1['attributes']:_0x52a1ab[_0x590c('0x31')];if(!_0x14fa86[_0x590c('0x32')][_0x590c('0x38')](_0x590c('0x39'))){_0x132de1[_0x590c('0x20')]=qs[_0x590c('0x20')](_0x14fa86[_0x590c('0x32')][_0x590c('0x20')]);_0x132de1[_0x590c('0x1d')]=qs['offset'](_0x14fa86[_0x590c('0x32')][_0x590c('0x1d')]);}_0x132de1[_0x590c('0x3a')]=qs['sort'](_0x14fa86[_0x590c('0x32')][_0x590c('0x3b')]);_0x132de1[_0x590c('0x3c')]=qs[_0x590c('0x3e')](_[_0x590c('0x3d')](_0x14fa86[_0x590c('0x32')],_0x52a1ab[_0x590c('0x3e')]));_0x132de1['where'][_0x590c('0x58')]=_0x5a8f6d['id'];if(_0x14fa86['query'][_0x590c('0x3f')]){_0x132de1[_0x590c('0x3c')]=_[_0x590c('0x40')](_0x132de1[_0x590c('0x3c')],{'$or':_['map'](_0x132de1[_0x590c('0x35')],function(_0x50acd3){var _0x340ae7={};_0x340ae7[_0x50acd3]={'$like':'%'+_0x14fa86[_0x590c('0x32')][_0x590c('0x3f')]+'%'};return _0x340ae7;})});}_0x132de1=_[_0x590c('0x40')]({},_0x132de1,_0x14fa86[_0x590c('0x42')]);return db[_0x590c('0x5c')]['count']({'where':_0x132de1[_0x590c('0x3c')]})['then'](function(_0x4702a1){_0xa72792[_0x590c('0x1f')]=_0x4702a1;if(_0x14fa86[_0x590c('0x32')][_0x590c('0x43')]){_0x132de1[_0x590c('0x44')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x132de1);})[_0x590c('0x24')](function(_0x27895a){_0xa72792[_0x590c('0x45')]=_0x27895a;return _0xa72792;});}})[_0x590c('0x24')](respondWithFilteredResult(_0x559b2e,_0x132de1))[_0x590c('0x46')](handleError(_0x559b2e,null));};exports[_0x590c('0x5d')]=function(_0x56fdb1,_0x45ed12,_0x3646fe){var _0x356437={'raw':!![],'where':{}};var _0x3b2789={};var _0x111e49={'count':0x0,'rows':[]};return db[_0x590c('0x2d')][_0x590c('0x5b')]({'where':{'id':_0x56fdb1['params']['id']}})['then'](handleEntityNotFound(_0x45ed12,null))['then'](function(_0x3358c8){if(_0x3358c8){_0x3b2789[_0x590c('0x31')]=_[_0x590c('0x33')](db['CmHopperFinal'][_0x590c('0x2e')]);_0x3b2789['query']=_[_0x590c('0x33')](_0x56fdb1['query']);_0x3b2789['filters']=_[_0x590c('0x34')](_0x3b2789['model'],_0x3b2789['query']);_0x356437['attributes']=_['intersection'](_0x3b2789[_0x590c('0x31')],qs[_0x590c('0x36')](_0x56fdb1[_0x590c('0x32')][_0x590c('0x36')]));_0x356437[_0x590c('0x35')]=_0x356437[_0x590c('0x35')][_0x590c('0x37')]?_0x356437[_0x590c('0x35')]:_0x3b2789[_0x590c('0x31')];if(!_0x56fdb1[_0x590c('0x32')][_0x590c('0x38')]('nolimit')){_0x356437[_0x590c('0x20')]=qs['limit'](_0x56fdb1[_0x590c('0x32')][_0x590c('0x20')]);_0x356437[_0x590c('0x1d')]=qs['offset'](_0x56fdb1[_0x590c('0x32')][_0x590c('0x1d')]);}_0x356437[_0x590c('0x3a')]=qs[_0x590c('0x3b')](_0x56fdb1[_0x590c('0x32')]['sort']);_0x356437['where']=qs['filters'](_['pick'](_0x56fdb1[_0x590c('0x32')],_0x3b2789['filters']));_0x356437[_0x590c('0x3c')][_0x590c('0x58')]=_0x3358c8['id'];if(_0x56fdb1['query'][_0x590c('0x3f')]){_0x356437[_0x590c('0x3c')]=_[_0x590c('0x40')](_0x356437[_0x590c('0x3c')],{'$or':_['map'](_0x356437[_0x590c('0x35')],function(_0x4b09f2){var _0x133dd6={};_0x133dd6[_0x4b09f2]={'$like':'%'+_0x56fdb1['query']['filter']+'%'};return _0x133dd6;})});}_0x356437=_[_0x590c('0x40')]({},_0x356437,_0x56fdb1[_0x590c('0x42')]);return db['CmHopperFinal']['count']({'where':_0x356437[_0x590c('0x3c')]})['then'](function(_0x2f291c){_0x111e49['count']=_0x2f291c;if(_0x56fdb1[_0x590c('0x32')][_0x590c('0x43')]){_0x356437[_0x590c('0x44')]=[{'all':!![]}];}return db[_0x590c('0x5e')][_0x590c('0x5a')](_0x356437);})[_0x590c('0x24')](function(_0xbf1baa){_0x111e49['rows']=_0xbf1baa;return _0x111e49;});}})[_0x590c('0x24')](respondWithFilteredResult(_0x45ed12,_0x356437))['catch'](handleError(_0x45ed12,null));};exports['getHopperBlacks']=function(_0x467018,_0x15f738,_0x4d8b72){var _0xed9f2d={'raw':!![],'where':{}};var _0x1faaec={};var _0x474074={'count':0x0,'rows':[]};return db[_0x590c('0x2d')]['findOne']({'where':{'id':_0x467018['params']['id']}})[_0x590c('0x24')](handleEntityNotFound(_0x15f738,null))['then'](function(_0x182c32){if(_0x182c32){_0x1faaec[_0x590c('0x31')]=_[_0x590c('0x33')](db['CmHopperBlack']['rawAttributes']);_0x1faaec['query']=_[_0x590c('0x33')](_0x467018['query']);_0x1faaec[_0x590c('0x3e')]=_[_0x590c('0x34')](_0x1faaec[_0x590c('0x31')],_0x1faaec[_0x590c('0x32')]);_0xed9f2d[_0x590c('0x35')]=_[_0x590c('0x34')](_0x1faaec[_0x590c('0x31')],qs[_0x590c('0x36')](_0x467018[_0x590c('0x32')]['fields']));_0xed9f2d[_0x590c('0x35')]=_0xed9f2d[_0x590c('0x35')][_0x590c('0x37')]?_0xed9f2d[_0x590c('0x35')]:_0x1faaec['model'];if(!_0x467018[_0x590c('0x32')][_0x590c('0x38')](_0x590c('0x39'))){_0xed9f2d[_0x590c('0x20')]=qs['limit'](_0x467018[_0x590c('0x32')][_0x590c('0x20')]);_0xed9f2d[_0x590c('0x1d')]=qs[_0x590c('0x1d')](_0x467018[_0x590c('0x32')][_0x590c('0x1d')]);}_0xed9f2d[_0x590c('0x3a')]=qs['sort'](_0x467018[_0x590c('0x32')][_0x590c('0x3b')]);_0xed9f2d['where']=qs[_0x590c('0x3e')](_[_0x590c('0x3d')](_0x467018[_0x590c('0x32')],_0x1faaec[_0x590c('0x3e')]));_0xed9f2d[_0x590c('0x3c')][_0x590c('0x58')]=_0x182c32['id'];if(_0x467018[_0x590c('0x32')]['filter']){_0xed9f2d[_0x590c('0x3c')]=_[_0x590c('0x40')](_0xed9f2d['where'],{'$or':_['map'](_0xed9f2d[_0x590c('0x35')],function(_0xa6da0b){var _0x33b0be={};_0x33b0be[_0xa6da0b]={'$like':'%'+_0x467018[_0x590c('0x32')][_0x590c('0x3f')]+'%'};return _0x33b0be;})});}_0xed9f2d=_[_0x590c('0x40')]({},_0xed9f2d,_0x467018[_0x590c('0x42')]);return db[_0x590c('0x5f')][_0x590c('0x1f')]({'where':_0xed9f2d[_0x590c('0x3c')]})[_0x590c('0x24')](function(_0x4ed8d7){_0x474074['count']=_0x4ed8d7;if(_0x467018[_0x590c('0x32')][_0x590c('0x43')]){_0xed9f2d[_0x590c('0x44')]=[{'all':!![]}];}return db[_0x590c('0x5f')][_0x590c('0x5a')](_0xed9f2d);})[_0x590c('0x24')](function(_0x13ba07){_0x474074[_0x590c('0x45')]=_0x13ba07;return _0x474074;});}})[_0x590c('0x24')](respondWithFilteredResult(_0x15f738,_0xed9f2d))[_0x590c('0x46')](handleError(_0x15f738,null));};exports[_0x590c('0x60')]=function(_0x50f1f9,_0x5dc0d2,_0x13f85e){var _0x2ed354={};var _0x37fc8a={};var _0x2c92a5;var _0x75e5bc;return db[_0x590c('0x2d')][_0x590c('0x5b')]({'where':{'id':_0x50f1f9[_0x590c('0x47')]['id']}})[_0x590c('0x24')](handleEntityNotFound(_0x5dc0d2,null))['then'](function(_0x13c433){if(_0x13c433){_0x2c92a5=_0x13c433;_0x37fc8a[_0x590c('0x31')]=_[_0x590c('0x33')](db[_0x590c('0x61')]['rawAttributes']);_0x37fc8a[_0x590c('0x32')]=_[_0x590c('0x33')](_0x50f1f9[_0x590c('0x32')]);_0x37fc8a['filters']=_[_0x590c('0x34')](_0x37fc8a['model'],_0x37fc8a[_0x590c('0x32')]);_0x2ed354[_0x590c('0x35')]=_[_0x590c('0x34')](_0x37fc8a[_0x590c('0x31')],qs['fields'](_0x50f1f9[_0x590c('0x32')]['fields']));_0x2ed354['attributes']=_0x2ed354[_0x590c('0x35')][_0x590c('0x37')]?_0x2ed354['attributes']:_0x37fc8a[_0x590c('0x31')];_0x2ed354['order']=qs['sort'](_0x50f1f9['query'][_0x590c('0x3b')]);_0x2ed354[_0x590c('0x3c')]=qs[_0x590c('0x3e')](_[_0x590c('0x3d')](_0x50f1f9[_0x590c('0x32')],_0x37fc8a['filters']));if(_0x50f1f9['query']['filter']){_0x2ed354[_0x590c('0x3c')]=_[_0x590c('0x40')](_0x2ed354[_0x590c('0x3c')],{'$or':_[_0x590c('0x2c')](_0x2ed354['attributes'],function(_0x2e655d){var _0x41aaf0={};_0x41aaf0[_0x2e655d]={'$like':'%'+_0x50f1f9['query'][_0x590c('0x3f')]+'%'};return _0x41aaf0;})});}_0x2ed354=_[_0x590c('0x40')]({},_0x2ed354,_0x50f1f9[_0x590c('0x42')]);return _0x2c92a5['getLists'](_0x2ed354);}})['then'](function(_0x4ff91e){if(_0x4ff91e){_0x75e5bc=_0x4ff91e['length'];if(!_0x50f1f9[_0x590c('0x32')][_0x590c('0x38')](_0x590c('0x39'))){_0x2ed354['limit']=qs[_0x590c('0x20')](_0x50f1f9['query'][_0x590c('0x20')]);_0x2ed354[_0x590c('0x1d')]=qs['offset'](_0x50f1f9[_0x590c('0x32')][_0x590c('0x1d')]);}return _0x2c92a5['getLists'](_0x2ed354);}})[_0x590c('0x24')](function(_0x2b1299){if(_0x2b1299){return _0x2b1299?{'count':_0x75e5bc,'rows':_0x2b1299}:null;}})[_0x590c('0x24')](respondWithResult(_0x5dc0d2,null))[_0x590c('0x46')](handleError(_0x5dc0d2,null));};exports['addLists']=function(_0x23a44f,_0x37ddd9,_0x3d14fe){var _0x4c9250,_0x26895e;return db[_0x590c('0x2d')][_0x590c('0x48')]({'where':{'id':_0x23a44f[_0x590c('0x47')]['id']}})[_0x590c('0x24')](handleEntityNotFound(_0x37ddd9,null))[_0x590c('0x24')](function(_0x10d5dd){if(_0x10d5dd){_0x26895e=_0x10d5dd;return _0x10d5dd[_0x590c('0x62')](_0x23a44f[_0x590c('0x4a')][_0x590c('0x63')],_[_0x590c('0x53')](_0x23a44f['body'],['ids','id'])||{});}return null;})['spread'](function(_0x524143){var _0x5ae2f5;_0x4c9250=_0x524143||[];var _0x139316=[];if(_0x524143){for(var _0x48820e=0x0;_0x48820e<_0x524143[_0x590c('0x37')];_0x48820e+=0x1){var _0x3c9f77=_0x524143[_0x48820e][_0x590c('0x25')]({'plain':!![]});_0x26895e[_0x590c('0x64')]=_0x23a44f['body'][_0x590c('0x64')]?_0x23a44f[_0x590c('0x4a')]['dialCheckDuplicateType']:_0x26895e[_0x590c('0x64')];switch(_0x26895e['dialCheckDuplicateType']){case _0x590c('0x65'):_0x5ae2f5=squel[_0x590c('0x66')]()[_0x590c('0x67')]('cm_hopper')[_0x590c('0x68')]([_0x590c('0x69'),_0x590c('0x6a'),'ContactId','ListId',_0x590c('0x58'),_0x590c('0x54'),_0x590c('0x55')],squel[_0x590c('0x6b')]()[_0x590c('0x6c')](_0x590c('0x69'),'phone')[_0x590c('0x6c')]('NOW()',_0x590c('0x6a'))[_0x590c('0x6c')]('id',_0x590c('0x6d'))[_0x590c('0x6c')](_0x3c9f77['CmListId'][_0x590c('0x6e')](),'ListId')[_0x590c('0x6c')](_0x23a44f[_0x590c('0x47')]['id'][_0x590c('0x6e')](),_0x590c('0x58'))[_0x590c('0x6c')](_0x590c('0x6f'),'createdAt')[_0x590c('0x6c')](_0x590c('0x6f'),_0x590c('0x55'))['from']('cm_contacts')['where'](_0x590c('0x70'))[_0x590c('0x3c')](_0x590c('0x71'),_0x3c9f77[_0x590c('0x72')][_0x590c('0x6e')]())[_0x590c('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x590c('0x3c')](_0x590c('0x73'),squel[_0x590c('0x6b')]()['field'](_0x590c('0x74'))[_0x590c('0x75')]('cm_hopper_final')[_0x590c('0x3c')](_0x590c('0x76'),_0x23a44f['params']['id']['toString']()))['where'](_0x590c('0x73'),squel[_0x590c('0x6b')]()[_0x590c('0x6c')](_0x590c('0x77'))[_0x590c('0x75')](_0x590c('0x78'))[_0x590c('0x3c')]('CampaignId\x20=\x20?',_0x23a44f[_0x590c('0x47')]['id'][_0x590c('0x6e')]())))[_0x590c('0x6e')]();break;case _0x590c('0x79'):_0x5ae2f5=squel[_0x590c('0x66')]()[_0x590c('0x67')](_0x590c('0x78'))['fromQuery']([_0x590c('0x69'),_0x590c('0x6a'),_0x590c('0x6d'),'ListId',_0x590c('0x58'),_0x590c('0x54'),_0x590c('0x55')],squel[_0x590c('0x6b')]()[_0x590c('0x6c')](_0x590c('0x69'),_0x590c('0x69'))[_0x590c('0x6c')](_0x590c('0x6f'),_0x590c('0x6a'))['field']('id','ContactId')[_0x590c('0x6c')](_0x3c9f77[_0x590c('0x72')][_0x590c('0x6e')](),'ListId')[_0x590c('0x6c')](_0x23a44f[_0x590c('0x47')]['id']['toString'](),_0x590c('0x58'))[_0x590c('0x6c')](_0x590c('0x6f'),'createdAt')[_0x590c('0x6c')]('NOW()',_0x590c('0x55'))[_0x590c('0x75')](_0x590c('0x7a'))['where'](_0x590c('0x70'))[_0x590c('0x3c')](_0x590c('0x71'),_0x3c9f77[_0x590c('0x72')][_0x590c('0x6e')]())[_0x590c('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x590c('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x590c('0x6b')]()[_0x590c('0x6c')](_0x590c('0x77'))[_0x590c('0x75')](_0x590c('0x78'))['where']('CampaignId\x20=\x20?',_0x23a44f[_0x590c('0x47')]['id'][_0x590c('0x6e')]())))[_0x590c('0x6e')]();break;default:_0x5ae2f5=squel[_0x590c('0x66')]()['into'](_0x590c('0x78'))[_0x590c('0x68')]([_0x590c('0x69'),_0x590c('0x6a'),'ContactId',_0x590c('0x7b'),_0x590c('0x58'),_0x590c('0x54'),_0x590c('0x55')],squel[_0x590c('0x6b')]()[_0x590c('0x6c')](_0x590c('0x69'),_0x590c('0x69'))[_0x590c('0x6c')]('NOW()',_0x590c('0x6a'))['field']('id',_0x590c('0x6d'))[_0x590c('0x6c')](_0x3c9f77[_0x590c('0x72')][_0x590c('0x6e')](),_0x590c('0x7b'))[_0x590c('0x6c')](_0x23a44f[_0x590c('0x47')]['id'][_0x590c('0x6e')](),_0x590c('0x58'))[_0x590c('0x6c')](_0x590c('0x6f'),'createdAt')['field'](_0x590c('0x6f'),'updatedAt')[_0x590c('0x75')]('cm_contacts')['where'](_0x590c('0x70'))[_0x590c('0x3c')](_0x590c('0x71'),_0x3c9f77[_0x590c('0x72')][_0x590c('0x6e')]())[_0x590c('0x3c')](_0x590c('0x7c')))['toString']();}_0x139316['push'](db[_0x590c('0x7d')][_0x590c('0x32')](_0x5ae2f5));}return BPromise[_0x590c('0x7e')](_0x139316);}})['then'](function(){return _0x4c9250;})[_0x590c('0x24')](respondWithResult(_0x37ddd9,null))[_0x590c('0x46')](handleError(_0x37ddd9,null));};exports[_0x590c('0x7f')]=function(_0xc54b20,_0x1a6f3e,_0x1a7fc9){return db[_0x590c('0x2d')][_0x590c('0x48')]({'where':{'id':_0xc54b20[_0x590c('0x47')]['id']}})[_0x590c('0x24')](handleEntityNotFound(_0x1a6f3e,null))[_0x590c('0x24')](function(_0x249aca){if(_0x249aca){return _0x249aca[_0x590c('0x7f')](_0xc54b20[_0x590c('0x32')][_0x590c('0x63')]);}})[_0x590c('0x24')](function(_0x223995){if(_0x223995){return db[_0x590c('0x59')]['destroy']({'where':{'ListId':_0xc54b20[_0x590c('0x32')]['ids'],'CampaignId':_0xc54b20[_0x590c('0x47')]['id']}})[_0x590c('0x24')](function(){return _0x223995;});}})['then'](respondWithStatusCode(_0x1a6f3e,null))['catch'](handleError(_0x1a6f3e,null));};exports['getBlackLists']=function(_0x4cc720,_0x4b33c3,_0x167993){var _0x3fb909={};var _0x214354={};var _0x4a5585;var _0x7bc81c;return db[_0x590c('0x2d')][_0x590c('0x5b')]({'where':{'id':_0x4cc720[_0x590c('0x47')]['id']}})[_0x590c('0x24')](handleEntityNotFound(_0x4b33c3,null))[_0x590c('0x24')](function(_0xef6030){if(_0xef6030){_0x4a5585=_0xef6030;_0x214354[_0x590c('0x31')]=_[_0x590c('0x33')](db[_0x590c('0x61')]['rawAttributes']);_0x214354[_0x590c('0x32')]=_[_0x590c('0x33')](_0x4cc720[_0x590c('0x32')]);_0x214354[_0x590c('0x3e')]=_[_0x590c('0x34')](_0x214354[_0x590c('0x31')],_0x214354[_0x590c('0x32')]);_0x3fb909['attributes']=_['intersection'](_0x214354[_0x590c('0x31')],qs['fields'](_0x4cc720[_0x590c('0x32')][_0x590c('0x36')]));_0x3fb909[_0x590c('0x35')]=_0x3fb909['attributes'][_0x590c('0x37')]?_0x3fb909[_0x590c('0x35')]:_0x214354[_0x590c('0x31')];_0x3fb909[_0x590c('0x3a')]=qs[_0x590c('0x3b')](_0x4cc720[_0x590c('0x32')][_0x590c('0x3b')]);_0x3fb909['where']=qs['filters'](_['pick'](_0x4cc720[_0x590c('0x32')],_0x214354[_0x590c('0x3e')]));if(_0x4cc720['query'][_0x590c('0x3f')]){_0x3fb909['where']=_[_0x590c('0x40')](_0x3fb909[_0x590c('0x3c')],{'$or':_[_0x590c('0x2c')](_0x3fb909['attributes'],function(_0x406578){var _0x277f68={};_0x277f68[_0x406578]={'$like':'%'+_0x4cc720[_0x590c('0x32')][_0x590c('0x3f')]+'%'};return _0x277f68;})});}_0x3fb909=_[_0x590c('0x40')]({},_0x3fb909,_0x4cc720[_0x590c('0x42')]);return _0x4a5585[_0x590c('0x80')](_0x3fb909);}})[_0x590c('0x24')](function(_0x204c27){if(_0x204c27){_0x7bc81c=_0x204c27['length'];if(!_0x4cc720[_0x590c('0x32')][_0x590c('0x38')]('nolimit')){_0x3fb909['limit']=qs[_0x590c('0x20')](_0x4cc720['query'][_0x590c('0x20')]);_0x3fb909[_0x590c('0x1d')]=qs['offset'](_0x4cc720['query']['offset']);}return _0x4a5585[_0x590c('0x80')](_0x3fb909);}})['then'](function(_0x4a7550){if(_0x4a7550){return _0x4a7550?{'count':_0x7bc81c,'rows':_0x4a7550}:null;}})[_0x590c('0x24')](respondWithResult(_0x4b33c3,null))[_0x590c('0x46')](handleError(_0x4b33c3,null));};exports[_0x590c('0x81')]=function(_0x54c85a,_0x529c88,_0x22cbb5){var _0x176fb5,_0x2a5885;return db[_0x590c('0x2d')][_0x590c('0x48')]({'where':{'id':_0x54c85a[_0x590c('0x47')]['id']}})[_0x590c('0x24')](handleEntityNotFound(_0x529c88,null))[_0x590c('0x24')](function(_0x5f2d33){if(_0x5f2d33){_0x2a5885=_0x5f2d33;return _0x5f2d33['addBlackLists'](_0x54c85a[_0x590c('0x4a')]['ids'],_[_0x590c('0x53')](_0x54c85a['body'],[_0x590c('0x63'),'id'])||{});}return null;})[_0x590c('0x82')](function(_0x5b413c){var _0x163bc9;_0x176fb5=_0x5b413c||[];var _0x48048e=[];if(_0x5b413c){for(var _0x1642d1=0x0;_0x1642d1<_0x5b413c[_0x590c('0x37')];_0x1642d1+=0x1){var _0x3fc5c3=_0x5b413c[_0x1642d1][_0x590c('0x25')]({'plain':!![]});_0x163bc9=squel[_0x590c('0x66')]()[_0x590c('0x67')](_0x590c('0x83'))['fromQuery']([_0x590c('0x69'),_0x590c('0x6d'),_0x590c('0x7b'),'CampaignId',_0x590c('0x54'),_0x590c('0x55')],squel[_0x590c('0x6b')]()[_0x590c('0x6c')](_0x590c('0x69'),_0x590c('0x69'))[_0x590c('0x6c')]('id',_0x590c('0x6d'))[_0x590c('0x6c')](_0x3fc5c3[_0x590c('0x72')][_0x590c('0x6e')](),'ListId')[_0x590c('0x6c')](_0x54c85a[_0x590c('0x47')]['id'][_0x590c('0x6e')](),_0x590c('0x58'))[_0x590c('0x6c')]('NOW()',_0x590c('0x54'))[_0x590c('0x6c')](_0x590c('0x6f'),_0x590c('0x55'))['from'](_0x590c('0x7a'))[_0x590c('0x3c')](_0x590c('0x70'))[_0x590c('0x3c')](_0x590c('0x71'),_0x3fc5c3[_0x590c('0x72')][_0x590c('0x6e')]())[_0x590c('0x3c')](_0x590c('0x7c')))[_0x590c('0x6e')]();_0x48048e[_0x590c('0x84')](db['sequelize'][_0x590c('0x32')](_0x163bc9));}return BPromise['all'](_0x48048e);}})[_0x590c('0x24')](function(){return _0x176fb5;})[_0x590c('0x24')](respondWithResult(_0x529c88,null))[_0x590c('0x46')](handleError(_0x529c88,null));};exports['removeBlackLists']=function(_0x596097,_0x4c38c1,_0x2b8acd){return db[_0x590c('0x2d')][_0x590c('0x48')]({'where':{'id':_0x596097[_0x590c('0x47')]['id']}})[_0x590c('0x24')](handleEntityNotFound(_0x4c38c1,null))[_0x590c('0x24')](function(_0x31dffc){if(_0x31dffc){return _0x31dffc[_0x590c('0x85')](_0x596097[_0x590c('0x32')][_0x590c('0x63')]);}})[_0x590c('0x24')](function(_0x1a4ae5){if(_0x1a4ae5){return db[_0x590c('0x5f')][_0x590c('0x23')]({'where':{'ListId':_0x596097['query']['ids'],'CampaignId':_0x596097[_0x590c('0x47')]['id']}})[_0x590c('0x24')](function(){return _0x1a4ae5;});}})[_0x590c('0x24')](respondWithStatusCode(_0x4c38c1,null))[_0x590c('0x46')](handleError(_0x4c38c1,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 6fbc2ad..6791c22 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x186591,_0x41385c){var _0x54d42d=function(_0x50e4f9){while(--_0x50e4f9){_0x186591['push'](_0x186591['shift']());}};_0x54d42d(++_0x41385c);}(_0x7a54,0x106));var _0x47a5=function(_0x52b73a,_0x16cab9){_0x52b73a=_0x52b73a-0x0;var _0x3ae8a4=_0x7a54[_0x52b73a];return _0x3ae8a4;};'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 a01156b..1dd9699 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 _0x4853=['where','attributes','map','include','model','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetCampaign','options','raw'];(function(_0x43f881,_0xd6e5a2){var _0x365c14=function(_0x50d386){while(--_0x50d386){_0x43f881['push'](_0x43f881['shift']());}};_0x365c14(++_0xd6e5a2);}(_0x4853,0x11d));var _0x3485=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4853[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x3485('0x0'));var moment=require('moment');var BPromise=require(_0x3485('0x1'));var rs=require(_0x3485('0x2'));var fs=require('fs');var Redis=require(_0x3485('0x3'));var db=require(_0x3485('0x4'))['db'];var utils=require(_0x3485('0x5'));var logger=require(_0x3485('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3485('0x7')][_0x3485('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2442dd,_0x10ec4b,_0x41a183){return new BPromise(function(_0x29502b,_0x29db7b){return client['request'](_0x2442dd,_0x41a183)[_0x3485('0x9')](function(_0x302f8c){logger[_0x3485('0xa')](_0x3485('0xb'),_0x10ec4b,_0x3485('0xc'));logger[_0x3485('0xd')](_0x3485('0xe'),_0x10ec4b,_0x3485('0xc'),JSON[_0x3485('0xf')](_0x302f8c));if(_0x302f8c['error']){if(_0x302f8c[_0x3485('0x10')][_0x3485('0x11')]===0x1f4){logger['error']('Campaign,\x20%s,\x20%s',_0x10ec4b,_0x302f8c[_0x3485('0x10')][_0x3485('0x12')]);return _0x29db7b(_0x302f8c[_0x3485('0x10')]['message']);}logger['error']('Campaign,\x20%s,\x20%s',_0x10ec4b,_0x302f8c['error']['message']);return _0x29502b(_0x302f8c[_0x3485('0x10')][_0x3485('0x12')]);}else{logger[_0x3485('0xa')]('Campaign,\x20%s,\x20%s',_0x10ec4b,_0x3485('0xc'));_0x29502b(_0x302f8c['result']['message']);}})[_0x3485('0x13')](function(_0x50b06b){logger[_0x3485('0x10')](_0x3485('0xb'),_0x10ec4b,_0x50b06b);_0x29db7b(_0x50b06b);});});}exports[_0x3485('0x14')]=function(_0x444c00){var _0x5c151f=this;return new Promise(function(_0x585f8a,_0x5c36e4){return db['Campaign']['findAll']({'raw':_0x444c00[_0x3485('0x15')]?_0x444c00[_0x3485('0x15')][_0x3485('0x16')]===undefined?!![]:![]:!![],'where':_0x444c00[_0x3485('0x15')]?_0x444c00[_0x3485('0x15')][_0x3485('0x17')]||null:null,'attributes':_0x444c00[_0x3485('0x15')]?_0x444c00[_0x3485('0x15')][_0x3485('0x18')]||null:null,'limit':_0x444c00[_0x3485('0x15')]?_0x444c00[_0x3485('0x15')]['limit']||null:null,'include':_0x444c00['options']?_0x444c00[_0x3485('0x15')]['include']?_[_0x3485('0x19')](_0x444c00[_0x3485('0x15')][_0x3485('0x1a')],function(_0x2c846d){return{'model':db[_0x2c846d[_0x3485('0x1b')]],'as':_0x2c846d['as'],'attributes':_0x2c846d[_0x3485('0x18')],'include':_0x2c846d[_0x3485('0x1a')]?_[_0x3485('0x19')](_0x2c846d['include'],function(_0xba1190){return{'model':db[_0xba1190[_0x3485('0x1b')]],'as':_0xba1190['as'],'attributes':_0xba1190[_0x3485('0x18')],'include':_0xba1190[_0x3485('0x1a')]?_[_0x3485('0x19')](_0xba1190[_0x3485('0x1a')],function(_0x495402){return{'model':db[_0x495402[_0x3485('0x1b')]],'as':_0x495402['as'],'attributes':_0x495402[_0x3485('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3485('0x9')](function(_0x40912e){logger[_0x3485('0xa')](_0x3485('0x14'),_0x444c00);logger['debug'](_0x3485('0x14'),_0x444c00,JSON[_0x3485('0xf')](_0x40912e));_0x585f8a(_0x40912e);})[_0x3485('0x13')](function(_0x1d77d4){logger[_0x3485('0x10')]('GetCampaign',_0x1d77d4[_0x3485('0x12')],_0x444c00);_0x5c36e4(_0x5c151f['error'](0x1f4,_0x1d77d4[_0x3485('0x12')]));});});}; \ No newline at end of file +var _0xa477=['Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x2d11c4,_0x31b483){var _0x2406de=function(_0x1eda5b){while(--_0x1eda5b){_0x2d11c4['push'](_0x2d11c4['shift']());}};_0x2406de(++_0x31b483);}(_0xa477,0xe6));var _0x7a47=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa477[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x7a47('0x0'));var util=require(_0x7a47('0x1'));var moment=require('moment');var BPromise=require(_0x7a47('0x2'));var rs=require(_0x7a47('0x3'));var fs=require('fs');var Redis=require(_0x7a47('0x4'));var db=require(_0x7a47('0x5'))['db'];var utils=require(_0x7a47('0x6'));var logger=require(_0x7a47('0x7'))(_0x7a47('0x8'));var config=require('../../config/environment');var jayson=require(_0x7a47('0x9'));var client=jayson[_0x7a47('0xa')][_0x7a47('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c6e0e,_0x54e9aa,_0x47f594){return new BPromise(function(_0x4276ed,_0x49db4c){return client[_0x7a47('0xc')](_0x4c6e0e,_0x47f594)[_0x7a47('0xd')](function(_0x52eb49){logger[_0x7a47('0xe')](_0x7a47('0xf'),_0x54e9aa,_0x7a47('0x10'));logger[_0x7a47('0x11')](_0x7a47('0x12'),_0x54e9aa,'request\x20sent',JSON[_0x7a47('0x13')](_0x52eb49));if(_0x52eb49[_0x7a47('0x14')]){if(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x15')]===0x1f4){logger['error'](_0x7a47('0xf'),_0x54e9aa,_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);return _0x49db4c(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);}logger[_0x7a47('0x14')](_0x7a47('0xf'),_0x54e9aa,_0x52eb49[_0x7a47('0x14')]['message']);return _0x4276ed(_0x52eb49[_0x7a47('0x14')][_0x7a47('0x16')]);}else{logger[_0x7a47('0xe')](_0x7a47('0xf'),_0x54e9aa,'request\x20sent');_0x4276ed(_0x52eb49[_0x7a47('0x17')][_0x7a47('0x16')]);}})['catch'](function(_0x4a81fb){logger[_0x7a47('0x14')](_0x7a47('0xf'),_0x54e9aa,_0x4a81fb);_0x49db4c(_0x4a81fb);});});}exports[_0x7a47('0x18')]=function(_0x5a4e79){var _0x444c48=this;return new Promise(function(_0x4a24b6,_0x203ab4){return db[_0x7a47('0x19')][_0x7a47('0x1a')]({'raw':_0x5a4e79[_0x7a47('0x1b')]?_0x5a4e79[_0x7a47('0x1b')][_0x7a47('0x1c')]===undefined?!![]:![]:!![],'where':_0x5a4e79[_0x7a47('0x1b')]?_0x5a4e79[_0x7a47('0x1b')][_0x7a47('0x1d')]||null:null,'attributes':_0x5a4e79['options']?_0x5a4e79[_0x7a47('0x1b')][_0x7a47('0x1e')]||null:null,'limit':_0x5a4e79[_0x7a47('0x1b')]?_0x5a4e79[_0x7a47('0x1b')][_0x7a47('0x1f')]||null:null,'include':_0x5a4e79[_0x7a47('0x1b')]?_0x5a4e79[_0x7a47('0x1b')][_0x7a47('0x20')]?_[_0x7a47('0x21')](_0x5a4e79[_0x7a47('0x1b')][_0x7a47('0x20')],function(_0xe9bb12){return{'model':db[_0xe9bb12['model']],'as':_0xe9bb12['as'],'attributes':_0xe9bb12['attributes'],'include':_0xe9bb12[_0x7a47('0x20')]?_[_0x7a47('0x21')](_0xe9bb12[_0x7a47('0x20')],function(_0x3e598b){return{'model':db[_0x3e598b['model']],'as':_0x3e598b['as'],'attributes':_0x3e598b[_0x7a47('0x1e')],'include':_0x3e598b[_0x7a47('0x20')]?_['map'](_0x3e598b[_0x7a47('0x20')],function(_0x324a85){return{'model':db[_0x324a85[_0x7a47('0x22')]],'as':_0x324a85['as'],'attributes':_0x324a85[_0x7a47('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7a47('0xd')](function(_0x5b2a0c){logger[_0x7a47('0xe')](_0x7a47('0x18'),_0x5a4e79);logger[_0x7a47('0x11')](_0x7a47('0x18'),_0x5a4e79,JSON['stringify'](_0x5b2a0c));_0x4a24b6(_0x5b2a0c);})['catch'](function(_0x5d4b9c){logger[_0x7a47('0x14')](_0x7a47('0x18'),_0x5d4b9c[_0x7a47('0x16')],_0x5a4e79);_0x203ab4(_0x444c48[_0x7a47('0x14')](0x1f4,_0x5d4b9c[_0x7a47('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index c05147b..67323aa 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 _0x3172=['./campaign.controller','get','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','post','addLists','/:id','delete','destroy','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2704be,_0x2555d4){var _0x21d7b5=function(_0x5f2a1b){while(--_0x5f2a1b){_0x2704be['push'](_0x2704be['shift']());}};_0x21d7b5(++_0x2555d4);}(_0x3172,0x106));var _0x2317=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x3172[_0x5bd426];return _0x23a7eb;};'use strict';var multer=require(_0x2317('0x0'));var util=require(_0x2317('0x1'));var path=require(_0x2317('0x2'));var timeout=require(_0x2317('0x3'));var express=require(_0x2317('0x4'));var router=express[_0x2317('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2317('0x6'));var interaction=require(_0x2317('0x7'));var config=require('../../config/environment');var controller=require(_0x2317('0x8'));router[_0x2317('0x9')]('/',auth[_0x2317('0xa')](),controller['index']);router[_0x2317('0x9')]('/:id',auth[_0x2317('0xa')](),controller[_0x2317('0xb')]);router[_0x2317('0x9')](_0x2317('0xc'),auth['isAuthenticated'](),controller[_0x2317('0xd')]);router[_0x2317('0x9')](_0x2317('0xe'),auth[_0x2317('0xa')](),controller[_0x2317('0xf')]);router[_0x2317('0x9')]('/:id/hopper_finals',auth[_0x2317('0xa')](),controller[_0x2317('0x10')]);router[_0x2317('0x9')](_0x2317('0x11'),auth[_0x2317('0xa')](),controller[_0x2317('0x12')]);router[_0x2317('0x9')]('/:id/lists',auth[_0x2317('0xa')](),controller[_0x2317('0x13')]);router['get'](_0x2317('0x14'),auth[_0x2317('0xa')](),controller[_0x2317('0x15')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x2317('0x16')]('/:id/clone',auth['isAuthenticated'](),controller['clone']);router[_0x2317('0x16')]('/:id/lists',auth[_0x2317('0xa')](),controller[_0x2317('0x17')]);router[_0x2317('0x16')]('/:id/blacklists',auth['isAuthenticated'](),controller['addBlackLists']);router['put'](_0x2317('0x18'),auth[_0x2317('0xa')](),controller['update']);router[_0x2317('0x19')](_0x2317('0x18'),auth[_0x2317('0xa')](),controller[_0x2317('0x1a')]);router[_0x2317('0x19')]('/:id/lists',auth[_0x2317('0xa')](),controller[_0x2317('0x1b')]);router[_0x2317('0x19')](_0x2317('0x14'),auth['isAuthenticated'](),controller[_0x2317('0x1c')]);module[_0x2317('0x1d')]=router; \ No newline at end of file +var _0x7188=['get','index','isAuthenticated','show','getHoppers','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','create','addLists','put','/:id','delete','removeLists','removeBlackLists','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller'];(function(_0xbff16e,_0x4d9923){var _0xcb701d=function(_0x5464b4){while(--_0x5464b4){_0xbff16e['push'](_0xbff16e['shift']());}};_0xcb701d(++_0x4d9923);}(_0x7188,0x172));var _0x8718=function(_0x3c10b7,_0x10fb4a){_0x3c10b7=_0x3c10b7-0x0;var _0xbd891b=_0x7188[_0x3c10b7];return _0xbd891b;};'use strict';var multer=require('multer');var util=require(_0x8718('0x0'));var path=require('path');var timeout=require(_0x8718('0x1'));var express=require(_0x8718('0x2'));var router=express[_0x8718('0x3')]();var fs_extra=require(_0x8718('0x4'));var auth=require(_0x8718('0x5'));var interaction=require(_0x8718('0x6'));var config=require('../../config/environment');var controller=require(_0x8718('0x7'));router[_0x8718('0x8')]('/',auth['isAuthenticated'](),controller[_0x8718('0x9')]);router[_0x8718('0x8')]('/:id',auth[_0x8718('0xa')](),controller[_0x8718('0xb')]);router[_0x8718('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x8718('0xc')]);router[_0x8718('0x8')]('/:id/hopper_histories',auth[_0x8718('0xa')](),controller['getHopperHistories']);router['get']('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0x8718('0xd')]);router[_0x8718('0x8')](_0x8718('0xe'),auth[_0x8718('0xa')](),controller[_0x8718('0xf')]);router[_0x8718('0x8')](_0x8718('0x10'),auth['isAuthenticated'](),controller[_0x8718('0x11')]);router['get'](_0x8718('0x12'),auth[_0x8718('0xa')](),controller['getBlackLists']);router[_0x8718('0x13')]('/',auth[_0x8718('0xa')](),controller[_0x8718('0x14')]);router[_0x8718('0x13')]('/:id/clone',auth[_0x8718('0xa')](),controller['clone']);router[_0x8718('0x13')](_0x8718('0x10'),auth[_0x8718('0xa')](),controller[_0x8718('0x15')]);router['post'](_0x8718('0x12'),auth[_0x8718('0xa')](),controller['addBlackLists']);router[_0x8718('0x16')](_0x8718('0x17'),auth[_0x8718('0xa')](),controller['update']);router[_0x8718('0x18')](_0x8718('0x17'),auth[_0x8718('0xa')](),controller['destroy']);router['delete'](_0x8718('0x10'),auth['isAuthenticated'](),controller[_0x8718('0x19')]);router[_0x8718('0x18')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x8718('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 15a3164..f50185f 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 _0x5b26=['TEXT','getDataValue','key','sequelize','STRING'];(function(_0x46f1a6,_0xc7a582){var _0x38429a=function(_0x31adae){while(--_0x31adae){_0x46f1a6['push'](_0x46f1a6['shift']());}};_0x38429a(++_0xc7a582);}(_0x5b26,0xb7));var _0x65b2=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x5b26[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0x65b2('0x0'));module['exports']={'key':{'type':Sequelize[_0x65b2('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x65b2('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x65b2('0x3')](_0x65b2('0x4'));}}}; \ No newline at end of file +var _0xa4d7=['exports','TEXT','VIRTUAL','getDataValue','key','sequelize'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xa4d7,0x1c7));var _0x7a4d=function(_0x25e01f,_0x159194){_0x25e01f=_0x25e01f-0x0;var _0x51b4f9=_0xa4d7[_0x25e01f];return _0x51b4f9;};'use strict';var Sequelize=require(_0x7a4d('0x0'));module[_0x7a4d('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x7a4d('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x7a4d('0x3')],'get':function(){return this[_0x7a4d('0x4')](_0x7a4d('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 6a58a56..0221eda 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 _0xdcdc=['Content-Range','apply','reject','save','then','get','CannedAnswers','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','CannedAnswer','includeAll','include','findAll','rows','catch','show','params','options','find','update','body','destroy','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set'];(function(_0x2ca95e,_0x2b143b){var _0x239aa8=function(_0x102077){while(--_0x102077){_0x2ca95e['push'](_0x2ca95e['shift']());}};_0x239aa8(++_0x2b143b);}(_0xdcdc,0xea));var _0xcdcd=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xdcdc[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0xcdcd('0x0'));var rimraf=require(_0xcdcd('0x1'));var zipdir=require(_0xcdcd('0x2'));var jsonpatch=require(_0xcdcd('0x3'));var rp=require(_0xcdcd('0x4'));var moment=require(_0xcdcd('0x5'));var BPromise=require(_0xcdcd('0x6'));var Mustache=require(_0xcdcd('0x7'));var util=require(_0xcdcd('0x8'));var path=require(_0xcdcd('0x9'));var sox=require(_0xcdcd('0xa'));var csv=require(_0xcdcd('0xb'));var ejs=require(_0xcdcd('0xc'));var fs=require('fs');var fs_extra=require(_0xcdcd('0xd'));var _=require('lodash');var squel=require(_0xcdcd('0xe'));var crypto=require('crypto');var jsforce=require(_0xcdcd('0xf'));var deskjs=require(_0xcdcd('0x10'));var toCsv=require(_0xcdcd('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcdcd('0x11'));var authService=require(_0xcdcd('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xcdcd('0x13'));var hardwareService=require(_0xcdcd('0x14'));var logger=require(_0xcdcd('0x15'))(_0xcdcd('0x16'));var utils=require('../../config/utils');var config=require(_0xcdcd('0x17'));var licenseUtil=require(_0xcdcd('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x447384,_0x77eb35){_0x77eb35=_0x77eb35||0xcc;return function(_0x5eb2be){if(_0x5eb2be){return _0x447384[_0xcdcd('0x19')](_0x77eb35);}return _0x447384[_0xcdcd('0x1a')](_0x77eb35)[_0xcdcd('0x1b')]();};}function respondWithResult(_0x4babaf,_0xda91d6){_0xda91d6=_0xda91d6||0xc8;return function(_0x5598f9){if(_0x5598f9){return _0x4babaf[_0xcdcd('0x1a')](_0xda91d6)['json'](_0x5598f9);}};}function respondWithFilteredResult(_0x41f829,_0x3cfcf9){return function(_0x281acd){if(_0x281acd){var _0xc3c99b=typeof _0x3cfcf9[_0xcdcd('0x1c')]===_0xcdcd('0x1d')&&typeof _0x3cfcf9[_0xcdcd('0x1e')]==='undefined';var _0x18ddea=_0x281acd[_0xcdcd('0x1f')];var _0x45e106=_0xc3c99b?0x0:_0x3cfcf9['offset'];var _0x482d35=_0xc3c99b?_0x281acd[_0xcdcd('0x1f')]:_0x3cfcf9[_0xcdcd('0x1c')]+_0x3cfcf9[_0xcdcd('0x1e')];var _0x21d3d5;if(_0x482d35>=_0x18ddea){_0x482d35=_0x18ddea;_0x21d3d5=0xc8;}else{_0x21d3d5=0xce;}_0x41f829[_0xcdcd('0x1a')](_0x21d3d5);return _0x41f829[_0xcdcd('0x20')](_0xcdcd('0x21'),_0x45e106+'-'+_0x482d35+'/'+_0x18ddea)['json'](_0x281acd);}return null;};}function patchUpdates(_0x44e04a){return function(_0x3a6ac6){try{jsonpatch[_0xcdcd('0x22')](_0x3a6ac6,_0x44e04a,!![]);}catch(_0x206de1){return BPromise[_0xcdcd('0x23')](_0x206de1);}return _0x3a6ac6[_0xcdcd('0x24')]();};}function saveUpdates(_0x45d418,_0x28bd95){return function(_0x26d68c){if(_0x26d68c){return _0x26d68c['update'](_0x45d418)[_0xcdcd('0x25')](function(_0x36c91a){return _0x36c91a;});}return null;};}function removeEntity(_0x45a54b,_0x1559b7){return function(_0x16a303){if(_0x16a303){return _0x16a303['destroy']()[_0xcdcd('0x25')](function(){var _0x90475=_0x16a303[_0xcdcd('0x26')]({'plain':!![]});var _0x630f84=_0xcdcd('0x27');return db[_0xcdcd('0x28')]['destroy']({'where':{'type':_0x630f84,'resourceId':_0x90475['id']}})[_0xcdcd('0x25')](function(){return _0x16a303;});})[_0xcdcd('0x25')](function(){_0x45a54b[_0xcdcd('0x1a')](0xcc)[_0xcdcd('0x1b')]();});}};}function handleEntityNotFound(_0xfd64be,_0x3d7612){return function(_0x507879){if(!_0x507879){_0xfd64be[_0xcdcd('0x19')](0x194);}return _0x507879;};}function handleError(_0x587efe,_0x154ddf){_0x154ddf=_0x154ddf||0x1f4;return function(_0x29dd88){logger[_0xcdcd('0x29')](_0x29dd88[_0xcdcd('0x2a')]);if(_0x29dd88[_0xcdcd('0x2b')]){delete _0x29dd88['name'];}_0x587efe['status'](_0x154ddf)[_0xcdcd('0x2c')](_0x29dd88);};}exports[_0xcdcd('0x2d')]=function(_0x4793bb,_0x30323b){var _0x79cfe6={},_0x2b5566={},_0x53db65={'count':0x0,'rows':[]};var _0x494690=_[_0xcdcd('0x2e')](db['CannedAnswer'][_0xcdcd('0x2f')],function(_0x593813){return{'name':_0x593813[_0xcdcd('0x30')],'type':_0x593813[_0xcdcd('0x31')]['key']};});_0x2b5566[_0xcdcd('0x32')]=_[_0xcdcd('0x2e')](_0x494690,'name');_0x2b5566[_0xcdcd('0x33')]=_[_0xcdcd('0x34')](_0x4793bb[_0xcdcd('0x33')]);_0x2b5566[_0xcdcd('0x35')]=_[_0xcdcd('0x36')](_0x2b5566[_0xcdcd('0x32')],_0x2b5566['query']);_0x79cfe6[_0xcdcd('0x37')]=_[_0xcdcd('0x36')](_0x2b5566[_0xcdcd('0x32')],qs[_0xcdcd('0x38')](_0x4793bb[_0xcdcd('0x33')][_0xcdcd('0x38')]));_0x79cfe6[_0xcdcd('0x37')]=_0x79cfe6[_0xcdcd('0x37')][_0xcdcd('0x39')]?_0x79cfe6['attributes']:_0x2b5566[_0xcdcd('0x32')];if(!_0x4793bb['query'][_0xcdcd('0x3a')](_0xcdcd('0x3b'))){_0x79cfe6['limit']=qs[_0xcdcd('0x1e')](_0x4793bb[_0xcdcd('0x33')]['limit']);_0x79cfe6[_0xcdcd('0x1c')]=qs['offset'](_0x4793bb[_0xcdcd('0x33')][_0xcdcd('0x1c')]);}_0x79cfe6['order']=qs[_0xcdcd('0x3c')](_0x4793bb['query'][_0xcdcd('0x3c')]);_0x79cfe6[_0xcdcd('0x3d')]=qs[_0xcdcd('0x35')](_['pick'](_0x4793bb[_0xcdcd('0x33')],_0x2b5566['filters']),_0x494690);if(_0x4793bb[_0xcdcd('0x33')][_0xcdcd('0x3e')]){_0x79cfe6['where']=_[_0xcdcd('0x3f')](_0x79cfe6[_0xcdcd('0x3d')],{'$or':[{'key':{'$like':'%'+_0x4793bb['query'][_0xcdcd('0x3e')]+'%'}},{'value':{'$like':'%'+_0x4793bb[_0xcdcd('0x33')][_0xcdcd('0x3e')]+'%'}}]});}_0x79cfe6=_['merge']({},_0x79cfe6,_0x4793bb['options']);var _0x285af8={'where':_0x79cfe6[_0xcdcd('0x3d')]};return db[_0xcdcd('0x40')]['count'](_0x285af8)[_0xcdcd('0x25')](function(_0x396438){_0x53db65[_0xcdcd('0x1f')]=_0x396438;if(_0x4793bb[_0xcdcd('0x33')][_0xcdcd('0x41')]){_0x79cfe6[_0xcdcd('0x42')]=[{'all':!![]}];}return db[_0xcdcd('0x40')][_0xcdcd('0x43')](_0x79cfe6);})[_0xcdcd('0x25')](function(_0x1f0794){_0x53db65[_0xcdcd('0x44')]=_0x1f0794;return _0x53db65;})[_0xcdcd('0x25')](respondWithFilteredResult(_0x30323b,_0x79cfe6))[_0xcdcd('0x45')](handleError(_0x30323b,null));};exports[_0xcdcd('0x46')]=function(_0x33e7dd,_0x5e29da){var _0x522a62={'raw':!![],'where':{'id':_0x33e7dd[_0xcdcd('0x47')]['id']}},_0x5250a1={};_0x5250a1[_0xcdcd('0x32')]=_[_0xcdcd('0x34')](db[_0xcdcd('0x40')]['rawAttributes']);_0x5250a1[_0xcdcd('0x33')]=_[_0xcdcd('0x34')](_0x33e7dd['query']);_0x5250a1[_0xcdcd('0x35')]=_[_0xcdcd('0x36')](_0x5250a1[_0xcdcd('0x32')],_0x5250a1[_0xcdcd('0x33')]);_0x522a62[_0xcdcd('0x37')]=_['intersection'](_0x5250a1[_0xcdcd('0x32')],qs[_0xcdcd('0x38')](_0x33e7dd[_0xcdcd('0x33')]['fields']));_0x522a62[_0xcdcd('0x37')]=_0x522a62['attributes']['length']?_0x522a62[_0xcdcd('0x37')]:_0x5250a1['model'];if(_0x33e7dd[_0xcdcd('0x33')][_0xcdcd('0x41')]){_0x522a62[_0xcdcd('0x42')]=[{'all':!![]}];}_0x522a62=_[_0xcdcd('0x3f')]({},_0x522a62,_0x33e7dd[_0xcdcd('0x48')]);return db[_0xcdcd('0x40')][_0xcdcd('0x49')](_0x522a62)['then'](handleEntityNotFound(_0x5e29da,null))[_0xcdcd('0x25')](respondWithResult(_0x5e29da,null))[_0xcdcd('0x45')](handleError(_0x5e29da,null));};exports[_0xcdcd('0x4a')]=function(_0x4292ec,_0xb8ca68){if(_0x4292ec[_0xcdcd('0x4b')]['id']){delete _0x4292ec['body']['id'];}return db[_0xcdcd('0x40')]['find']({'where':{'id':_0x4292ec[_0xcdcd('0x47')]['id']}})[_0xcdcd('0x25')](handleEntityNotFound(_0xb8ca68,null))[_0xcdcd('0x25')](saveUpdates(_0x4292ec[_0xcdcd('0x4b')],null))[_0xcdcd('0x25')](respondWithResult(_0xb8ca68,null))[_0xcdcd('0x45')](handleError(_0xb8ca68,null));};exports[_0xcdcd('0x4c')]=function(_0x1cce78,_0x287c91){return db[_0xcdcd('0x40')][_0xcdcd('0x49')]({'where':{'id':_0x1cce78[_0xcdcd('0x47')]['id']}})[_0xcdcd('0x25')](handleEntityNotFound(_0x287c91,null))[_0xcdcd('0x25')](removeEntity(_0x287c91,null))[_0xcdcd('0x45')](handleError(_0x287c91,null));};exports[_0xcdcd('0x4d')]=function(_0x2bba6c,_0x22afd4){var _0x37891e={'key':_0x2bba6c[_0xcdcd('0x4b')][_0xcdcd('0x4e')]};if(_0x2bba6c[_0xcdcd('0x4b')][_0xcdcd('0x4f')]){_0x37891e[_0xcdcd('0x4f')]=_0x2bba6c[_0xcdcd('0x4b')][_0xcdcd('0x4f')];}else if(_0x2bba6c['body'][_0xcdcd('0x50')]){_0x37891e['SmsAccountId']=_0x2bba6c[_0xcdcd('0x4b')][_0xcdcd('0x50')];}else if(_0x2bba6c['body']['OpenchannelAccountId']){_0x37891e[_0xcdcd('0x51')]=_0x2bba6c[_0xcdcd('0x4b')][_0xcdcd('0x51')];}else if(_0x2bba6c['body'][_0xcdcd('0x52')]){_0x37891e['ChatWebsiteId']=_0x2bba6c[_0xcdcd('0x4b')]['ChatWebsiteId'];}return db[_0xcdcd('0x40')][_0xcdcd('0x49')]({'where':_0x37891e})['then'](function(_0x53d116){if(_0x53d116){throw new db[(_0xcdcd('0x53'))]['ValidationError'](_0xcdcd('0x54'));}return db[_0xcdcd('0x40')]['create'](_0x2bba6c[_0xcdcd('0x4b')]);})[_0xcdcd('0x25')](function(_0x2f4d5e){var _0x82228a=_0x2bba6c[_0xcdcd('0x55')][_0xcdcd('0x26')]({'plain':!![]});if(!_0x82228a)throw new Error(_0xcdcd('0x56'));if(_0x82228a['role']===_0xcdcd('0x55')){var _0x3f25e6=_0x2f4d5e[_0xcdcd('0x26')]({'plain':!![]});return db['UserProfileSection'][_0xcdcd('0x49')]({'where':{'name':_0xcdcd('0x27'),'userProfileId':_0x82228a[_0xcdcd('0x57')]},'raw':!![]})[_0xcdcd('0x25')](function(_0x12e3a4){if(_0x12e3a4&&_0x12e3a4[_0xcdcd('0x58')]===0x0){return db['UserProfileResource'][_0xcdcd('0x4d')]({'name':_0x3f25e6[_0xcdcd('0x2b')],'resourceId':_0x3f25e6['id'],'type':_0x12e3a4[_0xcdcd('0x2b')],'sectionId':_0x12e3a4['id']},{})['then'](function(){return _0x2f4d5e;});}else{return _0x2f4d5e;}})[_0xcdcd('0x45')](function(_0x5c0168){logger[_0xcdcd('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c0168);throw _0x5c0168;});}return _0x2f4d5e;})['then'](respondWithResult(_0x22afd4,0xc9))[_0xcdcd('0x45')](handleError(_0x22afd4,null));}; \ No newline at end of file +var _0x9a59=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','rimraf','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','get','CannedAnswers','UserProfileResource','then','end','error','stack','name','index','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','CannedAnswer','includeAll','include','findAll','catch','show','params','find','create','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.'];(function(_0x1983ab,_0x9efe34){var _0xf03bfc=function(_0x4a50c2){while(--_0x4a50c2){_0x1983ab['push'](_0x1983ab['shift']());}};_0xf03bfc(++_0x9efe34);}(_0x9a59,0x107));var _0x99a5=function(_0x5bb82b,_0x51a145){_0x5bb82b=_0x5bb82b-0x0;var _0x9feec9=_0x9a59[_0x5bb82b];return _0x9feec9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x99a5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x99a5('0x1'));var moment=require(_0x99a5('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x99a5('0x3'));var path=require(_0x99a5('0x4'));var sox=require(_0x99a5('0x5'));var csv=require(_0x99a5('0x6'));var ejs=require(_0x99a5('0x7'));var fs=require('fs');var fs_extra=require(_0x99a5('0x8'));var _=require('lodash');var squel=require(_0x99a5('0x9'));var crypto=require(_0x99a5('0xa'));var jsforce=require(_0x99a5('0xb'));var deskjs=require(_0x99a5('0xc'));var toCsv=require(_0x99a5('0x6'));var querystring=require('querystring');var Papa=require(_0x99a5('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x99a5('0xe'));var as=require(_0x99a5('0xf'));var hardwareService=require(_0x99a5('0x10'));var logger=require(_0x99a5('0x11'))(_0x99a5('0x12'));var utils=require(_0x99a5('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x99a5('0x14'));var db=require(_0x99a5('0x15'))['db'];function respondWithStatusCode(_0x42988b,_0x55ffa2){_0x55ffa2=_0x55ffa2||0xcc;return function(_0x33def2){if(_0x33def2){return _0x42988b[_0x99a5('0x16')](_0x55ffa2);}return _0x42988b[_0x99a5('0x17')](_0x55ffa2)['end']();};}function respondWithResult(_0x53039d,_0x209e43){_0x209e43=_0x209e43||0xc8;return function(_0x1c714c){if(_0x1c714c){return _0x53039d['status'](_0x209e43)[_0x99a5('0x18')](_0x1c714c);}};}function respondWithFilteredResult(_0xbcdaf1,_0x4f8283){return function(_0x249105){if(_0x249105){var _0x150519=typeof _0x4f8283[_0x99a5('0x19')]==='undefined'&&typeof _0x4f8283['limit']===_0x99a5('0x1a');var _0x504bbb=_0x249105[_0x99a5('0x1b')];var _0x4d9c44=_0x150519?0x0:_0x4f8283[_0x99a5('0x19')];var _0x2088f2=_0x150519?_0x249105[_0x99a5('0x1b')]:_0x4f8283[_0x99a5('0x19')]+_0x4f8283[_0x99a5('0x1c')];var _0x48510b;if(_0x2088f2>=_0x504bbb){_0x2088f2=_0x504bbb;_0x48510b=0xc8;}else{_0x48510b=0xce;}_0xbcdaf1[_0x99a5('0x17')](_0x48510b);return _0xbcdaf1['set'](_0x99a5('0x1d'),_0x4d9c44+'-'+_0x2088f2+'/'+_0x504bbb)[_0x99a5('0x18')](_0x249105);}return null;};}function patchUpdates(_0x27b2ed){return function(_0x4a8a7f){try{jsonpatch[_0x99a5('0x1e')](_0x4a8a7f,_0x27b2ed,!![]);}catch(_0x2450d4){return BPromise[_0x99a5('0x1f')](_0x2450d4);}return _0x4a8a7f[_0x99a5('0x20')]();};}function saveUpdates(_0x4af509,_0x288ac7){return function(_0x1b2ebd){if(_0x1b2ebd){return _0x1b2ebd[_0x99a5('0x21')](_0x4af509)['then'](function(_0x2276e1){return _0x2276e1;});}return null;};}function removeEntity(_0x10c789,_0x1c5e40){return function(_0x3322e9){if(_0x3322e9){return _0x3322e9[_0x99a5('0x22')]()['then'](function(){var _0x368e6c=_0x3322e9[_0x99a5('0x23')]({'plain':!![]});var _0x9a39ae=_0x99a5('0x24');return db[_0x99a5('0x25')][_0x99a5('0x22')]({'where':{'type':_0x9a39ae,'resourceId':_0x368e6c['id']}})[_0x99a5('0x26')](function(){return _0x3322e9;});})[_0x99a5('0x26')](function(){_0x10c789['status'](0xcc)[_0x99a5('0x27')]();});}};}function handleEntityNotFound(_0x471c20,_0x517b5f){return function(_0x411748){if(!_0x411748){_0x471c20['sendStatus'](0x194);}return _0x411748;};}function handleError(_0x1a197c,_0x29b020){_0x29b020=_0x29b020||0x1f4;return function(_0x51b7da){logger[_0x99a5('0x28')](_0x51b7da[_0x99a5('0x29')]);if(_0x51b7da[_0x99a5('0x2a')]){delete _0x51b7da['name'];}_0x1a197c['status'](_0x29b020)['send'](_0x51b7da);};}exports[_0x99a5('0x2b')]=function(_0xe6bafd,_0x159313){var _0x12e761={},_0x38c2b7={},_0x18e12e={'count':0x0,'rows':[]};var _0x17ff69=_[_0x99a5('0x2c')](db['CannedAnswer'][_0x99a5('0x2d')],function(_0x414ba2){return{'name':_0x414ba2['fieldName'],'type':_0x414ba2['type'][_0x99a5('0x2e')]};});_0x38c2b7[_0x99a5('0x2f')]=_[_0x99a5('0x2c')](_0x17ff69,_0x99a5('0x2a'));_0x38c2b7[_0x99a5('0x30')]=_[_0x99a5('0x31')](_0xe6bafd[_0x99a5('0x30')]);_0x38c2b7[_0x99a5('0x32')]=_[_0x99a5('0x33')](_0x38c2b7[_0x99a5('0x2f')],_0x38c2b7['query']);_0x12e761['attributes']=_[_0x99a5('0x33')](_0x38c2b7['model'],qs['fields'](_0xe6bafd[_0x99a5('0x30')][_0x99a5('0x34')]));_0x12e761['attributes']=_0x12e761[_0x99a5('0x35')][_0x99a5('0x36')]?_0x12e761[_0x99a5('0x35')]:_0x38c2b7['model'];if(!_0xe6bafd[_0x99a5('0x30')][_0x99a5('0x37')](_0x99a5('0x38'))){_0x12e761[_0x99a5('0x1c')]=qs[_0x99a5('0x1c')](_0xe6bafd['query'][_0x99a5('0x1c')]);_0x12e761['offset']=qs[_0x99a5('0x19')](_0xe6bafd[_0x99a5('0x30')][_0x99a5('0x19')]);}_0x12e761[_0x99a5('0x39')]=qs[_0x99a5('0x3a')](_0xe6bafd['query']['sort']);_0x12e761['where']=qs[_0x99a5('0x32')](_[_0x99a5('0x3b')](_0xe6bafd[_0x99a5('0x30')],_0x38c2b7[_0x99a5('0x32')]),_0x17ff69);if(_0xe6bafd[_0x99a5('0x30')][_0x99a5('0x3c')]){_0x12e761[_0x99a5('0x3d')]=_[_0x99a5('0x3e')](_0x12e761[_0x99a5('0x3d')],{'$or':[{'key':{'$like':'%'+_0xe6bafd[_0x99a5('0x30')][_0x99a5('0x3c')]+'%'}},{'value':{'$like':'%'+_0xe6bafd[_0x99a5('0x30')]['filter']+'%'}}]});}_0x12e761=_['merge']({},_0x12e761,_0xe6bafd[_0x99a5('0x3f')]);var _0x436c6b={'where':_0x12e761['where']};return db[_0x99a5('0x40')]['count'](_0x436c6b)[_0x99a5('0x26')](function(_0x1519b1){_0x18e12e[_0x99a5('0x1b')]=_0x1519b1;if(_0xe6bafd['query'][_0x99a5('0x41')]){_0x12e761[_0x99a5('0x42')]=[{'all':!![]}];}return db[_0x99a5('0x40')][_0x99a5('0x43')](_0x12e761);})[_0x99a5('0x26')](function(_0x140513){_0x18e12e['rows']=_0x140513;return _0x18e12e;})['then'](respondWithFilteredResult(_0x159313,_0x12e761))[_0x99a5('0x44')](handleError(_0x159313,null));};exports[_0x99a5('0x45')]=function(_0x287ebc,_0x4fb1d6){var _0x30abd3={'raw':!![],'where':{'id':_0x287ebc[_0x99a5('0x46')]['id']}},_0xf218e5={};_0xf218e5[_0x99a5('0x2f')]=_[_0x99a5('0x31')](db[_0x99a5('0x40')][_0x99a5('0x2d')]);_0xf218e5[_0x99a5('0x30')]=_[_0x99a5('0x31')](_0x287ebc[_0x99a5('0x30')]);_0xf218e5[_0x99a5('0x32')]=_[_0x99a5('0x33')](_0xf218e5['model'],_0xf218e5[_0x99a5('0x30')]);_0x30abd3[_0x99a5('0x35')]=_[_0x99a5('0x33')](_0xf218e5[_0x99a5('0x2f')],qs[_0x99a5('0x34')](_0x287ebc['query']['fields']));_0x30abd3[_0x99a5('0x35')]=_0x30abd3[_0x99a5('0x35')][_0x99a5('0x36')]?_0x30abd3[_0x99a5('0x35')]:_0xf218e5[_0x99a5('0x2f')];if(_0x287ebc[_0x99a5('0x30')][_0x99a5('0x41')]){_0x30abd3[_0x99a5('0x42')]=[{'all':!![]}];}_0x30abd3=_[_0x99a5('0x3e')]({},_0x30abd3,_0x287ebc['options']);return db['CannedAnswer'][_0x99a5('0x47')](_0x30abd3)[_0x99a5('0x26')](handleEntityNotFound(_0x4fb1d6,null))[_0x99a5('0x26')](respondWithResult(_0x4fb1d6,null))[_0x99a5('0x44')](handleError(_0x4fb1d6,null));};exports[_0x99a5('0x21')]=function(_0x5a644a,_0x31290b){if(_0x5a644a['body']['id']){delete _0x5a644a['body']['id'];}return db[_0x99a5('0x40')][_0x99a5('0x47')]({'where':{'id':_0x5a644a['params']['id']}})['then'](handleEntityNotFound(_0x31290b,null))[_0x99a5('0x26')](saveUpdates(_0x5a644a['body'],null))[_0x99a5('0x26')](respondWithResult(_0x31290b,null))[_0x99a5('0x44')](handleError(_0x31290b,null));};exports[_0x99a5('0x22')]=function(_0x256e85,_0x328a40){return db[_0x99a5('0x40')][_0x99a5('0x47')]({'where':{'id':_0x256e85[_0x99a5('0x46')]['id']}})[_0x99a5('0x26')](handleEntityNotFound(_0x328a40,null))[_0x99a5('0x26')](removeEntity(_0x328a40,null))[_0x99a5('0x44')](handleError(_0x328a40,null));};exports[_0x99a5('0x48')]=function(_0x2f29b3,_0x6bf379){var _0x15b30f={'key':_0x2f29b3['body'][_0x99a5('0x2e')]};if(_0x2f29b3[_0x99a5('0x49')][_0x99a5('0x4a')]){_0x15b30f[_0x99a5('0x4a')]=_0x2f29b3[_0x99a5('0x49')][_0x99a5('0x4a')];}else if(_0x2f29b3[_0x99a5('0x49')]['SmsAccountId']){_0x15b30f[_0x99a5('0x4b')]=_0x2f29b3[_0x99a5('0x49')]['SmsAccountId'];}else if(_0x2f29b3[_0x99a5('0x49')][_0x99a5('0x4c')]){_0x15b30f[_0x99a5('0x4c')]=_0x2f29b3[_0x99a5('0x49')][_0x99a5('0x4c')];}else if(_0x2f29b3[_0x99a5('0x49')]['ChatWebsiteId']){_0x15b30f[_0x99a5('0x4d')]=_0x2f29b3[_0x99a5('0x49')][_0x99a5('0x4d')];}return db['CannedAnswer'][_0x99a5('0x47')]({'where':_0x15b30f})[_0x99a5('0x26')](function(_0x57290e){if(_0x57290e){throw new db[(_0x99a5('0x4e'))][(_0x99a5('0x4f'))](_0x99a5('0x50'));}return db['CannedAnswer']['create'](_0x2f29b3[_0x99a5('0x49')]);})[_0x99a5('0x26')](function(_0x121e72){var _0xe9261f=_0x2f29b3['user'][_0x99a5('0x23')]({'plain':!![]});if(!_0xe9261f)throw new Error(_0x99a5('0x51'));if(_0xe9261f[_0x99a5('0x52')]===_0x99a5('0x53')){var _0x54b1ec=_0x121e72[_0x99a5('0x23')]({'plain':!![]});return db[_0x99a5('0x54')][_0x99a5('0x47')]({'where':{'name':_0x99a5('0x24'),'userProfileId':_0xe9261f[_0x99a5('0x55')]},'raw':!![]})[_0x99a5('0x26')](function(_0x1fc827){if(_0x1fc827&&_0x1fc827['autoAssociation']===0x0){return db['UserProfileResource'][_0x99a5('0x48')]({'name':_0x54b1ec[_0x99a5('0x2a')],'resourceId':_0x54b1ec['id'],'type':_0x1fc827[_0x99a5('0x2a')],'sectionId':_0x1fc827['id']},{})['then'](function(){return _0x121e72;});}else{return _0x121e72;}})[_0x99a5('0x44')](function(_0x723510){logger[_0x99a5('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x723510);throw _0x723510;});}return _0x121e72;})[_0x99a5('0x26')](respondWithResult(_0x6bf379,0xc9))[_0x99a5('0x44')](handleError(_0x6bf379,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 25d0dcf..0a2effe 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 _0xebff=['path','../../config/environment','./cannedAnswer.attributes','define','tools_canned_answers','utf8mb4','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x4147fd,_0x1e2bf6){var _0x2fd539=function(_0x54b35e){while(--_0x54b35e){_0x4147fd['push'](_0x4147fd['shift']());}};_0x2fd539(++_0x1e2bf6);}(_0xebff,0xf8));var _0xfebf=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xebff[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xfebf('0x0'));var util=require('util');var logger=require(_0xfebf('0x1'))('api');var moment=require(_0xfebf('0x2'));var BPromise=require(_0xfebf('0x3'));var rp=require(_0xfebf('0x4'));var fs=require('fs');var path=require(_0xfebf('0x5'));var rimraf=require('rimraf');var config=require(_0xfebf('0x6'));var attributes=require(_0xfebf('0x7'));module['exports']=function(_0x4a98a9,_0x4c5f06){return _0x4a98a9[_0xfebf('0x8')]('CannedAnswer',attributes,{'tableName':_0xfebf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfebf('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa095=['exports','define','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','rimraf','./cannedAnswer.attributes'];(function(_0x54a687,_0x4ce189){var _0x4b5083=function(_0x4e9dc7){while(--_0x4e9dc7){_0x54a687['push'](_0x54a687['shift']());}};_0x4b5083(++_0x4ce189);}(_0xa095,0x7c));var _0x5a09=function(_0x2a99e2,_0x1803e4){_0x2a99e2=_0x2a99e2-0x0;var _0x23fb5f=_0xa095[_0x2a99e2];return _0x23fb5f;};'use strict';var _=require(_0x5a09('0x0'));var util=require(_0x5a09('0x1'));var logger=require('../../config/logger')(_0x5a09('0x2'));var moment=require('moment');var BPromise=require(_0x5a09('0x3'));var rp=require(_0x5a09('0x4'));var fs=require('fs');var path=require(_0x5a09('0x5'));var rimraf=require(_0x5a09('0x6'));var config=require('../../config/environment');var attributes=require(_0x5a09('0x7'));module[_0x5a09('0x8')]=function(_0x25edc3,_0x327fe6){return _0x25edc3[_0x5a09('0x9')]('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5a09('0xa')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index d17459a..cc04376 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(_0x4777a6,_0x5458a3){var _0x45c05f=function(_0x2beadd){while(--_0x2beadd){_0x4777a6['push'](_0x4777a6['shift']());}};_0x45c05f(++_0x5458a3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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(_0x154a66,_0x3ff7b0){var _0xf954a3=function(_0xd6876b){while(--_0xd6876b){_0x154a66['push'](_0x154a66['shift']());}};_0xf954a3(++_0x3ff7b0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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 68fd11b..e03e6d7 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 _0x72e9=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','index','/:id','show','put','update','delete'];(function(_0x3607f3,_0x5559d9){var _0xa9a016=function(_0x372e70){while(--_0x372e70){_0x3607f3['push'](_0x3607f3['shift']());}};_0xa9a016(++_0x5559d9);}(_0x72e9,0xb5));var _0x972e=function(_0x523648,_0x13412b){_0x523648=_0x523648-0x0;var _0x20d18b=_0x72e9[_0x523648];return _0x20d18b;};'use strict';var multer=require(_0x972e('0x0'));var util=require(_0x972e('0x1'));var path=require(_0x972e('0x2'));var timeout=require(_0x972e('0x3'));var express=require(_0x972e('0x4'));var router=express['Router']();var fs_extra=require(_0x972e('0x5'));var auth=require(_0x972e('0x6'));var interaction=require(_0x972e('0x7'));var config=require(_0x972e('0x8'));var controller=require(_0x972e('0x9'));router['get']('/',auth[_0x972e('0xa')](),controller[_0x972e('0xb')]);router['get'](_0x972e('0xc'),auth[_0x972e('0xa')](),controller[_0x972e('0xd')]);router['post']('/',auth[_0x972e('0xa')](),controller['create']);router[_0x972e('0xe')](_0x972e('0xc'),auth['isAuthenticated'](),controller[_0x972e('0xf')]);router[_0x972e('0x10')]('/:id',auth[_0x972e('0xa')](),controller['destroy']);module[_0x972e('0x11')]=router; \ No newline at end of file +var _0xd9b4=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xd9b4,0x1de));var _0x4d9b=function(_0x436570,_0x29789b){_0x436570=_0x436570-0x0;var _0x2c45f7=_0xd9b4[_0x436570];return _0x2c45f7;};'use strict';var multer=require(_0x4d9b('0x0'));var util=require(_0x4d9b('0x1'));var path=require(_0x4d9b('0x2'));var timeout=require(_0x4d9b('0x3'));var express=require(_0x4d9b('0x4'));var router=express[_0x4d9b('0x5')]();var fs_extra=require(_0x4d9b('0x6'));var auth=require(_0x4d9b('0x7'));var interaction=require(_0x4d9b('0x8'));var config=require(_0x4d9b('0x9'));var controller=require(_0x4d9b('0xa'));router[_0x4d9b('0xb')]('/',auth[_0x4d9b('0xc')](),controller[_0x4d9b('0xd')]);router[_0x4d9b('0xb')](_0x4d9b('0xe'),auth[_0x4d9b('0xc')](),controller['show']);router[_0x4d9b('0xf')]('/',auth['isAuthenticated'](),controller[_0x4d9b('0x10')]);router[_0x4d9b('0x11')](_0x4d9b('0xe'),auth[_0x4d9b('0xc')](),controller[_0x4d9b('0x12')]);router[_0x4d9b('0x13')](_0x4d9b('0xe'),auth[_0x4d9b('0xc')](),controller[_0x4d9b('0x14')]);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 b95f969..ed57b23 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 _0xb5cd=['STRING','INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x554292,_0x82948a){var _0x3dd555=function(_0xab7590){while(--_0xab7590){_0x554292['push'](_0x554292['shift']());}};_0x3dd555(++_0x82948a);}(_0xb5cd,0x134));var _0xdb5c=function(_0x2beba9,_0x304957){_0x2beba9=_0x2beba9-0x0;var _0xfb6f7e=_0xb5cd[_0x2beba9];return _0xfb6f7e;};'use strict';var Sequelize=require(_0xdb5c('0x0'));module[_0xdb5c('0x1')]={'calldate':{'type':Sequelize[_0xdb5c('0x2')],'allowNull':![],'defaultValue':_0xdb5c('0x3')},'clid':{'type':Sequelize[_0xdb5c('0x4')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xdb5c('0x4')]},'dcontext':{'type':Sequelize[_0xdb5c('0x4')]},'channel':{'type':Sequelize[_0xdb5c('0x4')]},'dstchannel':{'type':Sequelize[_0xdb5c('0x4')]},'lastapp':{'type':Sequelize[_0xdb5c('0x4')]},'lastdata':{'type':Sequelize[_0xdb5c('0x4')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xdb5c('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xdb5c('0x4')]},'amaflags':{'type':Sequelize[_0xdb5c('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xdb5c('0x4')]},'linkedid':{'type':Sequelize[_0xdb5c('0x4')]},'sequence':{'type':Sequelize[_0xdb5c('0x4')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xdb5c('0x4')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7314=['INTEGER','sequelize','exports','1970-01-01\x2000:00:01','STRING'];(function(_0x48a6d0,_0x327e64){var _0x33501d=function(_0x102a47){while(--_0x102a47){_0x48a6d0['push'](_0x48a6d0['shift']());}};_0x33501d(++_0x327e64);}(_0x7314,0x100));var _0x4731=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7314[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4731('0x0'));module[_0x4731('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x4731('0x2')},'clid':{'type':Sequelize[_0x4731('0x3')]},'src':{'type':Sequelize[_0x4731('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x4731('0x3')]},'channel':{'type':Sequelize[_0x4731('0x3')]},'dstchannel':{'type':Sequelize[_0x4731('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x4731('0x3')]},'duration':{'type':Sequelize[_0x4731('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4731('0x3')]},'amaflags':{'type':Sequelize[_0x4731('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x4731('0x3')]},'userfield':{'type':Sequelize[_0x4731('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x4731('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x4731('0x3')]},'type':{'type':Sequelize[_0x4731('0x3')]},'tag':{'type':Sequelize[_0x4731('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index f5d9773..b257e22 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 _0x9b67=['where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send','map','Cdr','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort'];(function(_0x2823fd,_0x5dfcc1){var _0x2f100e=function(_0x125039){while(--_0x125039){_0x2823fd['push'](_0x2823fd['shift']());}};_0x2f100e(++_0x5dfcc1);}(_0x9b67,0xf6));var _0x79b6=function(_0x486da7,_0x2a3b90){_0x486da7=_0x486da7-0x0;var _0x161f36=_0x9b67[_0x486da7];return _0x161f36;};'use strict';var emlformat=require(_0x79b6('0x0'));var rimraf=require(_0x79b6('0x1'));var zipdir=require(_0x79b6('0x2'));var jsonpatch=require(_0x79b6('0x3'));var rp=require(_0x79b6('0x4'));var moment=require('moment');var BPromise=require(_0x79b6('0x5'));var Mustache=require(_0x79b6('0x6'));var util=require('util');var path=require('path');var sox=require(_0x79b6('0x7'));var csv=require(_0x79b6('0x8'));var ejs=require(_0x79b6('0x9'));var fs=require('fs');var fs_extra=require(_0x79b6('0xa'));var _=require(_0x79b6('0xb'));var squel=require(_0x79b6('0xc'));var crypto=require(_0x79b6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x79b6('0xe'));var toCsv=require(_0x79b6('0x8'));var querystring=require(_0x79b6('0xf'));var Papa=require(_0x79b6('0x10'));var Redis=require(_0x79b6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x79b6('0x12'));var as=require(_0x79b6('0x13'));var hardwareService=require(_0x79b6('0x14'));var logger=require(_0x79b6('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x79b6('0x16'));var licenseUtil=require(_0x79b6('0x17'));var db=require(_0x79b6('0x18'))['db'];function respondWithStatusCode(_0x526727,_0xc05a77){_0xc05a77=_0xc05a77||0xcc;return function(_0x2df08d){if(_0x2df08d){return _0x526727[_0x79b6('0x19')](_0xc05a77);}return _0x526727[_0x79b6('0x1a')](_0xc05a77)[_0x79b6('0x1b')]();};}function respondWithResult(_0x40478d,_0x19d5b2){_0x19d5b2=_0x19d5b2||0xc8;return function(_0x3ef1fa){if(_0x3ef1fa){return _0x40478d[_0x79b6('0x1a')](_0x19d5b2)[_0x79b6('0x1c')](_0x3ef1fa);}};}function respondWithFilteredResult(_0x2ac966,_0x3563cc){return function(_0x1e8bf1){if(_0x1e8bf1){var _0x4cf491=typeof _0x3563cc[_0x79b6('0x1d')]===_0x79b6('0x1e')&&typeof _0x3563cc[_0x79b6('0x1f')]===_0x79b6('0x1e');var _0x2a8788=_0x1e8bf1[_0x79b6('0x20')];var _0x131bc5=_0x4cf491?0x0:_0x3563cc[_0x79b6('0x1d')];var _0x3ff583=_0x4cf491?_0x1e8bf1[_0x79b6('0x20')]:_0x3563cc[_0x79b6('0x1d')]+_0x3563cc[_0x79b6('0x1f')];var _0x1361f6;if(_0x3ff583>=_0x2a8788){_0x3ff583=_0x2a8788;_0x1361f6=0xc8;}else{_0x1361f6=0xce;}_0x2ac966['status'](_0x1361f6);return _0x2ac966[_0x79b6('0x21')]('Content-Range',_0x131bc5+'-'+_0x3ff583+'/'+_0x2a8788)[_0x79b6('0x1c')](_0x1e8bf1);}return null;};}function patchUpdates(_0x532e65){return function(_0x28b9c2){try{jsonpatch[_0x79b6('0x22')](_0x28b9c2,_0x532e65,!![]);}catch(_0x299bed){return BPromise['reject'](_0x299bed);}return _0x28b9c2[_0x79b6('0x23')]();};}function saveUpdates(_0x30dc0b,_0x53208a){return function(_0x565f86){if(_0x565f86){return _0x565f86[_0x79b6('0x24')](_0x30dc0b)[_0x79b6('0x25')](function(_0x9bd2cc){return _0x9bd2cc;});}return null;};}function removeEntity(_0x268826,_0x3b2a2a){return function(_0x488102){if(_0x488102){return _0x488102[_0x79b6('0x26')]()[_0x79b6('0x25')](function(){_0x268826[_0x79b6('0x1a')](0xcc)[_0x79b6('0x1b')]();});}};}function handleEntityNotFound(_0x4c275d,_0x53c03c){return function(_0x40ef76){if(!_0x40ef76){_0x4c275d[_0x79b6('0x19')](0x194);}return _0x40ef76;};}function handleError(_0x37b01b,_0xc25c99){_0xc25c99=_0xc25c99||0x1f4;return function(_0x4adf15){logger[_0x79b6('0x27')](_0x4adf15['stack']);if(_0x4adf15[_0x79b6('0x28')]){delete _0x4adf15[_0x79b6('0x28')];}_0x37b01b[_0x79b6('0x1a')](_0xc25c99)[_0x79b6('0x29')](_0x4adf15);};}exports['index']=function(_0x1484e5,_0x310832){var _0x53b463={},_0x158221={},_0x2d219c={'count':0x0,'rows':[]};var _0x1b1f2b=_[_0x79b6('0x2a')](db[_0x79b6('0x2b')][_0x79b6('0x2c')],function(_0x53b2f5){return{'name':_0x53b2f5[_0x79b6('0x2d')],'type':_0x53b2f5[_0x79b6('0x2e')][_0x79b6('0x2f')]};});_0x158221[_0x79b6('0x30')]=_[_0x79b6('0x2a')](_0x1b1f2b,_0x79b6('0x28'));_0x158221['query']=_[_0x79b6('0x31')](_0x1484e5[_0x79b6('0x32')]);_0x158221[_0x79b6('0x33')]=_['intersection'](_0x158221['model'],_0x158221[_0x79b6('0x32')]);_0x53b463[_0x79b6('0x34')]=_[_0x79b6('0x35')](_0x158221[_0x79b6('0x30')],qs[_0x79b6('0x36')](_0x1484e5[_0x79b6('0x32')]['fields']));_0x53b463['attributes']=_0x53b463[_0x79b6('0x34')]['length']?_0x53b463[_0x79b6('0x34')]:_0x158221['model'];if(!_0x1484e5[_0x79b6('0x32')][_0x79b6('0x37')]('nolimit')){_0x53b463[_0x79b6('0x1f')]=qs[_0x79b6('0x1f')](_0x1484e5['query'][_0x79b6('0x1f')]);_0x53b463['offset']=qs[_0x79b6('0x1d')](_0x1484e5[_0x79b6('0x32')][_0x79b6('0x1d')]);}_0x53b463[_0x79b6('0x38')]=qs[_0x79b6('0x39')](_0x1484e5[_0x79b6('0x32')][_0x79b6('0x39')]);_0x53b463[_0x79b6('0x3a')]=qs[_0x79b6('0x33')](_[_0x79b6('0x3b')](_0x1484e5['query'],_0x158221['filters']),_0x1b1f2b);if(_0x1484e5['query'][_0x79b6('0x3c')]){_0x53b463[_0x79b6('0x3a')]=_['merge'](_0x53b463[_0x79b6('0x3a')],{'$or':_['map'](_0x1b1f2b,function(_0x179a98){if(_0x179a98[_0x79b6('0x2e')]!==_0x79b6('0x3d')){var _0x53db1d={};_0x53db1d[_0x179a98[_0x79b6('0x28')]]={'$like':'%'+_0x1484e5['query'][_0x79b6('0x3c')]+'%'};return _0x53db1d;}})});}_0x53b463=_[_0x79b6('0x3e')]({},_0x53b463,_0x1484e5[_0x79b6('0x3f')]);var _0x2feeeb={'where':_0x53b463[_0x79b6('0x3a')]};return db['Cdr']['count'](_0x2feeeb)[_0x79b6('0x25')](function(_0x48ae49){_0x2d219c[_0x79b6('0x20')]=_0x48ae49;if(_0x1484e5[_0x79b6('0x32')][_0x79b6('0x40')]){_0x53b463[_0x79b6('0x41')]=[{'all':!![]}];}return db[_0x79b6('0x2b')][_0x79b6('0x42')](_0x53b463);})[_0x79b6('0x25')](function(_0x4a7f90){_0x2d219c[_0x79b6('0x43')]=_0x4a7f90;return _0x2d219c;})[_0x79b6('0x25')](respondWithFilteredResult(_0x310832,_0x53b463))[_0x79b6('0x44')](handleError(_0x310832,null));};exports[_0x79b6('0x45')]=function(_0x568f6b,_0x12ea22){var _0x4f803c={'raw':!![],'where':{'id':_0x568f6b[_0x79b6('0x46')]['id']}},_0x4ba212={};_0x4ba212[_0x79b6('0x30')]=_[_0x79b6('0x31')](db[_0x79b6('0x2b')][_0x79b6('0x2c')]);_0x4ba212[_0x79b6('0x32')]=_[_0x79b6('0x31')](_0x568f6b[_0x79b6('0x32')]);_0x4ba212['filters']=_[_0x79b6('0x35')](_0x4ba212['model'],_0x4ba212['query']);_0x4f803c[_0x79b6('0x34')]=_[_0x79b6('0x35')](_0x4ba212[_0x79b6('0x30')],qs[_0x79b6('0x36')](_0x568f6b[_0x79b6('0x32')][_0x79b6('0x36')]));_0x4f803c[_0x79b6('0x34')]=_0x4f803c[_0x79b6('0x34')][_0x79b6('0x47')]?_0x4f803c['attributes']:_0x4ba212[_0x79b6('0x30')];if(_0x568f6b[_0x79b6('0x32')][_0x79b6('0x40')]){_0x4f803c[_0x79b6('0x41')]=[{'all':!![]}];}_0x4f803c=_[_0x79b6('0x3e')]({},_0x4f803c,_0x568f6b['options']);return db[_0x79b6('0x2b')][_0x79b6('0x48')](_0x4f803c)['then'](handleEntityNotFound(_0x12ea22,null))['then'](respondWithResult(_0x12ea22,null))[_0x79b6('0x44')](handleError(_0x12ea22,null));};exports[_0x79b6('0x49')]=function(_0x247c79,_0xa0c396){return db[_0x79b6('0x2b')][_0x79b6('0x49')](_0x247c79[_0x79b6('0x4a')],{})[_0x79b6('0x25')](respondWithResult(_0xa0c396,0xc9))[_0x79b6('0x44')](handleError(_0xa0c396,null));};exports[_0x79b6('0x24')]=function(_0x15c795,_0x39972b){if(_0x15c795[_0x79b6('0x4a')]['id']){delete _0x15c795[_0x79b6('0x4a')]['id'];}return db[_0x79b6('0x2b')][_0x79b6('0x48')]({'where':{'id':_0x15c795[_0x79b6('0x46')]['id']}})[_0x79b6('0x25')](handleEntityNotFound(_0x39972b,null))[_0x79b6('0x25')](saveUpdates(_0x15c795['body'],null))['then'](respondWithResult(_0x39972b,null))['catch'](handleError(_0x39972b,null));};exports['destroy']=function(_0x56deb2,_0x412c1e){return db[_0x79b6('0x2b')][_0x79b6('0x48')]({'where':{'id':_0x56deb2[_0x79b6('0x46')]['id']}})[_0x79b6('0x25')](handleEntityNotFound(_0x412c1e,null))[_0x79b6('0x25')](removeEntity(_0x412c1e,null))['catch'](handleError(_0x412c1e,null));};exports[_0x79b6('0x4b')]=function(_0xa2ba0e,_0x58232b){return db[_0x79b6('0x2b')]['describe']()[_0x79b6('0x25')](respondWithResult(_0x58232b,null))['catch'](handleError(_0x58232b,null));}; \ No newline at end of file +var _0x6f47=['undefined','limit','count','status','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','Cdr','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','length','find','create','body','params','describe','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset'];(function(_0x151502,_0x3f0f5a){var _0x4db056=function(_0x4cc051){while(--_0x4cc051){_0x151502['push'](_0x151502['shift']());}};_0x4db056(++_0x3f0f5a);}(_0x6f47,0xc7));var _0x76f4=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x6f47[_0x2be8c2];return _0x97f531;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x76f4('0x0'));var zipdir=require(_0x76f4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x76f4('0x2'));var moment=require('moment');var BPromise=require(_0x76f4('0x3'));var Mustache=require('mustache');var util=require(_0x76f4('0x4'));var path=require(_0x76f4('0x5'));var sox=require(_0x76f4('0x6'));var csv=require(_0x76f4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x76f4('0x8'));var _=require(_0x76f4('0x9'));var squel=require(_0x76f4('0xa'));var crypto=require('crypto');var jsforce=require(_0x76f4('0xb'));var deskjs=require(_0x76f4('0xc'));var toCsv=require(_0x76f4('0x7'));var querystring=require(_0x76f4('0xd'));var Papa=require(_0x76f4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x76f4('0xf'));var as=require(_0x76f4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x76f4('0x11'));var utils=require(_0x76f4('0x12'));var config=require(_0x76f4('0x13'));var licenseUtil=require(_0x76f4('0x14'));var db=require(_0x76f4('0x15'))['db'];function respondWithStatusCode(_0xafd21e,_0xf7e347){_0xf7e347=_0xf7e347||0xcc;return function(_0x3ec740){if(_0x3ec740){return _0xafd21e[_0x76f4('0x16')](_0xf7e347);}return _0xafd21e['status'](_0xf7e347)[_0x76f4('0x17')]();};}function respondWithResult(_0x30dabf,_0x5da1ff){_0x5da1ff=_0x5da1ff||0xc8;return function(_0x4b6021){if(_0x4b6021){return _0x30dabf['status'](_0x5da1ff)[_0x76f4('0x18')](_0x4b6021);}};}function respondWithFilteredResult(_0x3dd240,_0x979946){return function(_0x40252d){if(_0x40252d){var _0x3d8f5a=typeof _0x979946[_0x76f4('0x19')]===_0x76f4('0x1a')&&typeof _0x979946[_0x76f4('0x1b')]===_0x76f4('0x1a');var _0xb159a9=_0x40252d[_0x76f4('0x1c')];var _0x2d4bd1=_0x3d8f5a?0x0:_0x979946[_0x76f4('0x19')];var _0x38450e=_0x3d8f5a?_0x40252d[_0x76f4('0x1c')]:_0x979946[_0x76f4('0x19')]+_0x979946[_0x76f4('0x1b')];var _0x3e809f;if(_0x38450e>=_0xb159a9){_0x38450e=_0xb159a9;_0x3e809f=0xc8;}else{_0x3e809f=0xce;}_0x3dd240[_0x76f4('0x1d')](_0x3e809f);return _0x3dd240[_0x76f4('0x1e')](_0x76f4('0x1f'),_0x2d4bd1+'-'+_0x38450e+'/'+_0xb159a9)[_0x76f4('0x18')](_0x40252d);}return null;};}function patchUpdates(_0x5bf3d5){return function(_0x262937){try{jsonpatch['apply'](_0x262937,_0x5bf3d5,!![]);}catch(_0x13f3b1){return BPromise[_0x76f4('0x20')](_0x13f3b1);}return _0x262937[_0x76f4('0x21')]();};}function saveUpdates(_0x517c00,_0x567f2a){return function(_0x52da65){if(_0x52da65){return _0x52da65[_0x76f4('0x22')](_0x517c00)[_0x76f4('0x23')](function(_0x14bfe5){return _0x14bfe5;});}return null;};}function removeEntity(_0x2b6d51,_0x42ef70){return function(_0x4786c9){if(_0x4786c9){return _0x4786c9[_0x76f4('0x24')]()['then'](function(){_0x2b6d51['status'](0xcc)[_0x76f4('0x17')]();});}};}function handleEntityNotFound(_0x497913,_0x288365){return function(_0x5355bd){if(!_0x5355bd){_0x497913['sendStatus'](0x194);}return _0x5355bd;};}function handleError(_0x4f6087,_0x470242){_0x470242=_0x470242||0x1f4;return function(_0x38300d){logger[_0x76f4('0x25')](_0x38300d[_0x76f4('0x26')]);if(_0x38300d[_0x76f4('0x27')]){delete _0x38300d[_0x76f4('0x27')];}_0x4f6087['status'](_0x470242)[_0x76f4('0x28')](_0x38300d);};}exports['index']=function(_0x5346be,_0x5b3f07){var _0x10ddb4={},_0x30f02e={},_0x41dea4={'count':0x0,'rows':[]};var _0x1dea0e=_['map'](db[_0x76f4('0x29')]['rawAttributes'],function(_0x259c26){return{'name':_0x259c26[_0x76f4('0x2a')],'type':_0x259c26[_0x76f4('0x2b')][_0x76f4('0x2c')]};});_0x30f02e[_0x76f4('0x2d')]=_['map'](_0x1dea0e,'name');_0x30f02e[_0x76f4('0x2e')]=_[_0x76f4('0x2f')](_0x5346be[_0x76f4('0x2e')]);_0x30f02e[_0x76f4('0x30')]=_[_0x76f4('0x31')](_0x30f02e[_0x76f4('0x2d')],_0x30f02e[_0x76f4('0x2e')]);_0x10ddb4[_0x76f4('0x32')]=_[_0x76f4('0x31')](_0x30f02e[_0x76f4('0x2d')],qs[_0x76f4('0x33')](_0x5346be[_0x76f4('0x2e')]['fields']));_0x10ddb4['attributes']=_0x10ddb4['attributes']['length']?_0x10ddb4[_0x76f4('0x32')]:_0x30f02e[_0x76f4('0x2d')];if(!_0x5346be[_0x76f4('0x2e')][_0x76f4('0x34')](_0x76f4('0x35'))){_0x10ddb4['limit']=qs[_0x76f4('0x1b')](_0x5346be[_0x76f4('0x2e')][_0x76f4('0x1b')]);_0x10ddb4[_0x76f4('0x19')]=qs[_0x76f4('0x19')](_0x5346be[_0x76f4('0x2e')][_0x76f4('0x19')]);}_0x10ddb4[_0x76f4('0x36')]=qs[_0x76f4('0x37')](_0x5346be[_0x76f4('0x2e')][_0x76f4('0x37')]);_0x10ddb4[_0x76f4('0x38')]=qs[_0x76f4('0x30')](_[_0x76f4('0x39')](_0x5346be[_0x76f4('0x2e')],_0x30f02e[_0x76f4('0x30')]),_0x1dea0e);if(_0x5346be[_0x76f4('0x2e')][_0x76f4('0x3a')]){_0x10ddb4['where']=_[_0x76f4('0x3b')](_0x10ddb4[_0x76f4('0x38')],{'$or':_[_0x76f4('0x3c')](_0x1dea0e,function(_0x589637){if(_0x589637['type']!==_0x76f4('0x3d')){var _0x487926={};_0x487926[_0x589637[_0x76f4('0x27')]]={'$like':'%'+_0x5346be['query'][_0x76f4('0x3a')]+'%'};return _0x487926;}})});}_0x10ddb4=_[_0x76f4('0x3b')]({},_0x10ddb4,_0x5346be[_0x76f4('0x3e')]);var _0x378675={'where':_0x10ddb4[_0x76f4('0x38')]};return db[_0x76f4('0x29')][_0x76f4('0x1c')](_0x378675)[_0x76f4('0x23')](function(_0x16779e){_0x41dea4[_0x76f4('0x1c')]=_0x16779e;if(_0x5346be['query']['includeAll']){_0x10ddb4[_0x76f4('0x3f')]=[{'all':!![]}];}return db[_0x76f4('0x29')][_0x76f4('0x40')](_0x10ddb4);})[_0x76f4('0x23')](function(_0x2b7dc8){_0x41dea4[_0x76f4('0x41')]=_0x2b7dc8;return _0x41dea4;})[_0x76f4('0x23')](respondWithFilteredResult(_0x5b3f07,_0x10ddb4))[_0x76f4('0x42')](handleError(_0x5b3f07,null));};exports[_0x76f4('0x43')]=function(_0x5b667b,_0xbc3d7e){var _0xe744af={'raw':!![],'where':{'id':_0x5b667b['params']['id']}},_0x4f0d1a={};_0x4f0d1a[_0x76f4('0x2d')]=_[_0x76f4('0x2f')](db[_0x76f4('0x29')][_0x76f4('0x44')]);_0x4f0d1a[_0x76f4('0x2e')]=_['keys'](_0x5b667b[_0x76f4('0x2e')]);_0x4f0d1a[_0x76f4('0x30')]=_[_0x76f4('0x31')](_0x4f0d1a[_0x76f4('0x2d')],_0x4f0d1a[_0x76f4('0x2e')]);_0xe744af[_0x76f4('0x32')]=_['intersection'](_0x4f0d1a[_0x76f4('0x2d')],qs[_0x76f4('0x33')](_0x5b667b[_0x76f4('0x2e')]['fields']));_0xe744af['attributes']=_0xe744af[_0x76f4('0x32')][_0x76f4('0x45')]?_0xe744af[_0x76f4('0x32')]:_0x4f0d1a[_0x76f4('0x2d')];if(_0x5b667b[_0x76f4('0x2e')]['includeAll']){_0xe744af['include']=[{'all':!![]}];}_0xe744af=_[_0x76f4('0x3b')]({},_0xe744af,_0x5b667b['options']);return db[_0x76f4('0x29')][_0x76f4('0x46')](_0xe744af)['then'](handleEntityNotFound(_0xbc3d7e,null))['then'](respondWithResult(_0xbc3d7e,null))[_0x76f4('0x42')](handleError(_0xbc3d7e,null));};exports[_0x76f4('0x47')]=function(_0x3f35ce,_0x217d3a){return db['Cdr'][_0x76f4('0x47')](_0x3f35ce[_0x76f4('0x48')],{})[_0x76f4('0x23')](respondWithResult(_0x217d3a,0xc9))['catch'](handleError(_0x217d3a,null));};exports[_0x76f4('0x22')]=function(_0x6bbcf2,_0x535eca){if(_0x6bbcf2['body']['id']){delete _0x6bbcf2[_0x76f4('0x48')]['id'];}return db[_0x76f4('0x29')][_0x76f4('0x46')]({'where':{'id':_0x6bbcf2[_0x76f4('0x49')]['id']}})[_0x76f4('0x23')](handleEntityNotFound(_0x535eca,null))['then'](saveUpdates(_0x6bbcf2[_0x76f4('0x48')],null))['then'](respondWithResult(_0x535eca,null))[_0x76f4('0x42')](handleError(_0x535eca,null));};exports[_0x76f4('0x24')]=function(_0x270baf,_0x5e9a45){return db[_0x76f4('0x29')][_0x76f4('0x46')]({'where':{'id':_0x270baf['params']['id']}})[_0x76f4('0x23')](handleEntityNotFound(_0x5e9a45,null))[_0x76f4('0x23')](removeEntity(_0x5e9a45,null))[_0x76f4('0x42')](handleError(_0x5e9a45,null));};exports[_0x76f4('0x4a')]=function(_0x40ff20,_0x479c4b){return db[_0x76f4('0x29')]['describe']()[_0x76f4('0x23')](respondWithResult(_0x479c4b,null))[_0x76f4('0x42')](handleError(_0x479c4b,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index b4163e7..2ab7de5 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(_0x1eae27,_0x1e2e4a){var _0x2d7462=function(_0x23d100){while(--_0x23d100){_0x1eae27['push'](_0x1eae27['shift']());}};_0x2d7462(++_0x1e2e4a);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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(_0x306b9b,_0x5842b1){var _0x4bcca5=function(_0x29f5fe){while(--_0x29f5fe){_0x306b9b['push'](_0x306b9b['shift']());}};_0x4bcca5(++_0x5842b1);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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 b734578..efcba02 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 _0x8998=['client','http','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x3f965f,_0x9c2930){var _0x2895ca=function(_0x10e935){while(--_0x10e935){_0x3f965f['push'](_0x3f965f['shift']());}};_0x2895ca(++_0x9c2930);}(_0x8998,0xd2));var _0x8899=function(_0x242c44,_0x250f08){_0x242c44=_0x242c44-0x0;var _0x5869ad=_0x8998[_0x242c44];return _0x5869ad;};'use strict';var _=require(_0x8899('0x0'));var util=require('util');var moment=require(_0x8899('0x1'));var BPromise=require(_0x8899('0x2'));var rs=require(_0x8899('0x3'));var fs=require('fs');var Redis=require(_0x8899('0x4'));var db=require(_0x8899('0x5'))['db'];var utils=require(_0x8899('0x6'));var logger=require('../../config/logger')(_0x8899('0x7'));var config=require(_0x8899('0x8'));var jayson=require(_0x8899('0x9'));var client=jayson[_0x8899('0xa')][_0x8899('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52c003,_0x344a09,_0x51fb5e){return new BPromise(function(_0xf5bb6e,_0xdcadc7){return client['request'](_0x52c003,_0x51fb5e)['then'](function(_0x5b746b){logger[_0x8899('0xc')](_0x8899('0xd'),_0x344a09,_0x8899('0xe'));logger[_0x8899('0xf')](_0x8899('0x10'),_0x344a09,_0x8899('0xe'),JSON[_0x8899('0x11')](_0x5b746b));if(_0x5b746b[_0x8899('0x12')]){if(_0x5b746b['error'][_0x8899('0x13')]===0x1f4){logger['error'](_0x8899('0xd'),_0x344a09,_0x5b746b[_0x8899('0x12')][_0x8899('0x14')]);return _0xdcadc7(_0x5b746b[_0x8899('0x12')][_0x8899('0x14')]);}logger[_0x8899('0x12')](_0x8899('0xd'),_0x344a09,_0x5b746b['error'][_0x8899('0x14')]);return _0xf5bb6e(_0x5b746b[_0x8899('0x12')]['message']);}else{logger[_0x8899('0xc')](_0x8899('0xd'),_0x344a09,_0x8899('0xe'));_0xf5bb6e(_0x5b746b['result'][_0x8899('0x14')]);}})[_0x8899('0x15')](function(_0x9c0182){logger[_0x8899('0x12')]('Cdr,\x20%s,\x20%s',_0x344a09,_0x9c0182);_0xdcadc7(_0x9c0182);});});} \ No newline at end of file +var _0xed6c=['info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xed6c,0xb2));var _0xced6=function(_0xd0a847,_0x72562b){_0xd0a847=_0xd0a847-0x0;var _0x2536ec=_0xed6c[_0xd0a847];return _0x2536ec;};'use strict';var _=require(_0xced6('0x0'));var util=require(_0xced6('0x1'));var moment=require(_0xced6('0x2'));var BPromise=require(_0xced6('0x3'));var rs=require(_0xced6('0x4'));var fs=require('fs');var Redis=require(_0xced6('0x5'));var db=require(_0xced6('0x6'))['db'];var utils=require(_0xced6('0x7'));var logger=require(_0xced6('0x8'))(_0xced6('0x9'));var config=require('../../config/environment');var jayson=require(_0xced6('0xa'));var client=jayson[_0xced6('0xb')][_0xced6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xec8fb1,_0xae90a5,_0x159d06){return new BPromise(function(_0x1994f5,_0x59d7ce){return client[_0xced6('0xd')](_0xec8fb1,_0x159d06)['then'](function(_0x230ba7){logger[_0xced6('0xe')](_0xced6('0xf'),_0xae90a5,_0xced6('0x10'));logger[_0xced6('0x11')](_0xced6('0x12'),_0xae90a5,_0xced6('0x10'),JSON[_0xced6('0x13')](_0x230ba7));if(_0x230ba7[_0xced6('0x14')]){if(_0x230ba7[_0xced6('0x14')][_0xced6('0x15')]===0x1f4){logger[_0xced6('0x14')](_0xced6('0xf'),_0xae90a5,_0x230ba7[_0xced6('0x14')]['message']);return _0x59d7ce(_0x230ba7[_0xced6('0x14')]['message']);}logger[_0xced6('0x14')]('Cdr,\x20%s,\x20%s',_0xae90a5,_0x230ba7['error'][_0xced6('0x16')]);return _0x1994f5(_0x230ba7['error']['message']);}else{logger[_0xced6('0xe')](_0xced6('0xf'),_0xae90a5,_0xced6('0x10'));_0x1994f5(_0x230ba7[_0xced6('0x17')][_0xced6('0x16')]);}})['catch'](function(_0x12e1d7){logger[_0xced6('0x14')]('Cdr,\x20%s,\x20%s',_0xae90a5,_0x12e1d7);_0x59d7ce(_0x12e1d7);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index d06890b..9860c72 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x171fdc,_0x16ae91){var _0x3782ea=function(_0x58b691){while(--_0x58b691){_0x171fdc['push'](_0x171fdc['shift']());}};_0x3782ea(++_0x16ae91);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 493c55e..bea0add 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 _0x2a00=['exports','INTEGER','STRING','TEXT','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a00,0x180));var _0x02a0=function(_0x5efb9e,_0x47e288){_0x5efb9e=_0x5efb9e-0x0;var _0x571f58=_0x2a00[_0x5efb9e];return _0x571f58;};'use strict';var Sequelize=require(_0x02a0('0x0'));module[_0x02a0('0x1')]={'priority':{'type':Sequelize[_0x02a0('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x02a0('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x02a0('0x4')]()},'description':{'type':Sequelize[_0x02a0('0x3')]},'interval':{'type':Sequelize[_0x02a0('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xaca9=['STRING','noop','TEXT','*,*,*,*','sequelize','INTEGER'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0xaca9,0x88));var _0x9aca=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xaca9[_0x68c979];return _0x4f0001;};'use strict';var Sequelize=require(_0x9aca('0x0'));module['exports']={'priority':{'type':Sequelize[_0x9aca('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x9aca('0x2')],'allowNull':![],'defaultValue':_0x9aca('0x3')},'appdata':{'type':Sequelize[_0x9aca('0x4')]()},'description':{'type':Sequelize[_0x9aca('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9aca('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index f0bca6f..c9735fc 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 _0x7341=['zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','error','stack','name','send','show','params','keys','ChatApplication','query','filters','model','fields','attributes','length','includeAll','include','merge','options','find','catch','body'];(function(_0xfb53a4,_0x477204){var _0x4c77b1=function(_0x1cdfdf){while(--_0x1cdfdf){_0xfb53a4['push'](_0xfb53a4['shift']());}};_0x4c77b1(++_0x477204);}(_0x7341,0xe4));var _0x1734=function(_0x21d9f4,_0x4b7d83){_0x21d9f4=_0x21d9f4-0x0;var _0x66f13=_0x7341[_0x21d9f4];return _0x66f13;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1734('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1734('0x1'));var moment=require(_0x1734('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1734('0x3'));var util=require(_0x1734('0x4'));var path=require(_0x1734('0x5'));var sox=require(_0x1734('0x6'));var csv=require(_0x1734('0x7'));var ejs=require(_0x1734('0x8'));var fs=require('fs');var fs_extra=require(_0x1734('0x9'));var _=require('lodash');var squel=require(_0x1734('0xa'));var crypto=require(_0x1734('0xb'));var jsforce=require(_0x1734('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1734('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1734('0xd'));var authService=require(_0x1734('0xe'));var qs=require(_0x1734('0xf'));var as=require(_0x1734('0x10'));var hardwareService=require(_0x1734('0x11'));var logger=require(_0x1734('0x12'))(_0x1734('0x13'));var utils=require(_0x1734('0x14'));var config=require(_0x1734('0x15'));var licenseUtil=require(_0x1734('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4391a1,_0x449ab1){_0x449ab1=_0x449ab1||0xcc;return function(_0x44de07){if(_0x44de07){return _0x4391a1[_0x1734('0x17')](_0x449ab1);}return _0x4391a1[_0x1734('0x18')](_0x449ab1)[_0x1734('0x19')]();};}function respondWithResult(_0x9e7cf5,_0xd2f288){_0xd2f288=_0xd2f288||0xc8;return function(_0xb90c22){if(_0xb90c22){return _0x9e7cf5[_0x1734('0x18')](_0xd2f288)[_0x1734('0x1a')](_0xb90c22);}};}function respondWithFilteredResult(_0x27679e,_0x2162c9){return function(_0x2dd53c){if(_0x2dd53c){var _0x3989a6=typeof _0x2162c9[_0x1734('0x1b')]===_0x1734('0x1c')&&typeof _0x2162c9[_0x1734('0x1d')]===_0x1734('0x1c');var _0x56756c=_0x2dd53c['count'];var _0x1fa9c0=_0x3989a6?0x0:_0x2162c9[_0x1734('0x1b')];var _0x4a86d1=_0x3989a6?_0x2dd53c[_0x1734('0x1e')]:_0x2162c9['offset']+_0x2162c9['limit'];var _0x5b2789;if(_0x4a86d1>=_0x56756c){_0x4a86d1=_0x56756c;_0x5b2789=0xc8;}else{_0x5b2789=0xce;}_0x27679e[_0x1734('0x18')](_0x5b2789);return _0x27679e['set'](_0x1734('0x1f'),_0x1fa9c0+'-'+_0x4a86d1+'/'+_0x56756c)[_0x1734('0x1a')](_0x2dd53c);}return null;};}function patchUpdates(_0x4fc4ed){return function(_0x54b1bd){try{jsonpatch['apply'](_0x54b1bd,_0x4fc4ed,!![]);}catch(_0x1e7401){return BPromise['reject'](_0x1e7401);}return _0x54b1bd[_0x1734('0x20')]();};}function saveUpdates(_0x5ad801,_0x215ae4){return function(_0x42485f){if(_0x42485f){return _0x42485f[_0x1734('0x21')](_0x5ad801)[_0x1734('0x22')](function(_0x29bb2c){return _0x29bb2c;});}return null;};}function removeEntity(_0x45593e,_0x4285ee){return function(_0x44e420){if(_0x44e420){return _0x44e420[_0x1734('0x23')]()['then'](function(){_0x45593e[_0x1734('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e0023,_0x7478fd){return function(_0x46b2fa){if(!_0x46b2fa){_0x5e0023[_0x1734('0x17')](0x194);}return _0x46b2fa;};}function handleError(_0x157e35,_0x4435ac){_0x4435ac=_0x4435ac||0x1f4;return function(_0x2a95e3){logger[_0x1734('0x24')](_0x2a95e3[_0x1734('0x25')]);if(_0x2a95e3['name']){delete _0x2a95e3[_0x1734('0x26')];}_0x157e35['status'](_0x4435ac)[_0x1734('0x27')](_0x2a95e3);};}exports[_0x1734('0x28')]=function(_0xfca2ad,_0x52411b){var _0x3eb31b={'raw':!![],'where':{'id':_0xfca2ad[_0x1734('0x29')]['id']}},_0x3f9abe={};_0x3f9abe['model']=_[_0x1734('0x2a')](db[_0x1734('0x2b')]['rawAttributes']);_0x3f9abe[_0x1734('0x2c')]=_[_0x1734('0x2a')](_0xfca2ad[_0x1734('0x2c')]);_0x3f9abe[_0x1734('0x2d')]=_['intersection'](_0x3f9abe[_0x1734('0x2e')],_0x3f9abe[_0x1734('0x2c')]);_0x3eb31b['attributes']=_['intersection'](_0x3f9abe[_0x1734('0x2e')],qs[_0x1734('0x2f')](_0xfca2ad[_0x1734('0x2c')][_0x1734('0x2f')]));_0x3eb31b[_0x1734('0x30')]=_0x3eb31b[_0x1734('0x30')][_0x1734('0x31')]?_0x3eb31b[_0x1734('0x30')]:_0x3f9abe[_0x1734('0x2e')];if(_0xfca2ad[_0x1734('0x2c')][_0x1734('0x32')]){_0x3eb31b[_0x1734('0x33')]=[{'all':!![]}];}_0x3eb31b=_[_0x1734('0x34')]({},_0x3eb31b,_0xfca2ad[_0x1734('0x35')]);return db[_0x1734('0x2b')][_0x1734('0x36')](_0x3eb31b)[_0x1734('0x22')](handleEntityNotFound(_0x52411b,null))['then'](respondWithResult(_0x52411b,null))[_0x1734('0x37')](handleError(_0x52411b,null));};exports['update']=function(_0xc618e5,_0x462373){if(_0xc618e5[_0x1734('0x38')]['id']){delete _0xc618e5[_0x1734('0x38')]['id'];}return db[_0x1734('0x2b')][_0x1734('0x36')]({'where':{'id':_0xc618e5[_0x1734('0x29')]['id']}})[_0x1734('0x22')](handleEntityNotFound(_0x462373,null))['then'](saveUpdates(_0xc618e5[_0x1734('0x38')],null))[_0x1734('0x22')](respondWithResult(_0x462373,null))[_0x1734('0x37')](handleError(_0x462373,null));};exports[_0x1734('0x23')]=function(_0x30817d,_0x1b7caa){return db[_0x1734('0x2b')]['find']({'where':{'id':_0x30817d[_0x1734('0x29')]['id']}})[_0x1734('0x22')](handleEntityNotFound(_0x1b7caa,null))[_0x1734('0x22')](removeEntity(_0x1b7caa,null))[_0x1734('0x37')](handleError(_0x1b7caa,null));}; \ No newline at end of file +var _0x6d4a=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','update','then','destroy','error','name','send','show','params','keys','ChatApplication','rawAttributes','query','intersection','model','attributes','fields','length','includeAll','include','merge','catch','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x2ce733,_0x1a2ea2){var _0x31dc08=function(_0x15fbee){while(--_0x15fbee){_0x2ce733['push'](_0x2ce733['shift']());}};_0x31dc08(++_0x1a2ea2);}(_0x6d4a,0x117));var _0xa6d4=function(_0x1b8c8f,_0x3230d7){_0x1b8c8f=_0x1b8c8f-0x0;var _0xf51725=_0x6d4a[_0x1b8c8f];return _0xf51725;};'use strict';var emlformat=require(_0xa6d4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa6d4('0x1'));var jsonpatch=require(_0xa6d4('0x2'));var rp=require(_0xa6d4('0x3'));var moment=require(_0xa6d4('0x4'));var BPromise=require(_0xa6d4('0x5'));var Mustache=require(_0xa6d4('0x6'));var util=require(_0xa6d4('0x7'));var path=require(_0xa6d4('0x8'));var sox=require(_0xa6d4('0x9'));var csv=require(_0xa6d4('0xa'));var ejs=require(_0xa6d4('0xb'));var fs=require('fs');var fs_extra=require(_0xa6d4('0xc'));var _=require(_0xa6d4('0xd'));var squel=require(_0xa6d4('0xe'));var crypto=require('crypto');var jsforce=require(_0xa6d4('0xf'));var deskjs=require(_0xa6d4('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa6d4('0x11'));var Papa=require(_0xa6d4('0x12'));var Redis=require(_0xa6d4('0x13'));var authService=require(_0xa6d4('0x14'));var qs=require(_0xa6d4('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa6d4('0x16'));var logger=require(_0xa6d4('0x17'))('api');var utils=require(_0xa6d4('0x18'));var config=require(_0xa6d4('0x19'));var licenseUtil=require(_0xa6d4('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31ac95,_0x53b1c1){_0x53b1c1=_0x53b1c1||0xcc;return function(_0x23830f){if(_0x23830f){return _0x31ac95[_0xa6d4('0x1b')](_0x53b1c1);}return _0x31ac95['status'](_0x53b1c1)[_0xa6d4('0x1c')]();};}function respondWithResult(_0x101f40,_0x3a0d34){_0x3a0d34=_0x3a0d34||0xc8;return function(_0x9631de){if(_0x9631de){return _0x101f40[_0xa6d4('0x1d')](_0x3a0d34)[_0xa6d4('0x1e')](_0x9631de);}};}function respondWithFilteredResult(_0x2110d1,_0x3e714f){return function(_0x7420d8){if(_0x7420d8){var _0x17a926=typeof _0x3e714f[_0xa6d4('0x1f')]===_0xa6d4('0x20')&&typeof _0x3e714f['limit']===_0xa6d4('0x20');var _0x493077=_0x7420d8[_0xa6d4('0x21')];var _0x474b62=_0x17a926?0x0:_0x3e714f[_0xa6d4('0x1f')];var _0x4a7af1=_0x17a926?_0x7420d8[_0xa6d4('0x21')]:_0x3e714f[_0xa6d4('0x1f')]+_0x3e714f['limit'];var _0x3fa155;if(_0x4a7af1>=_0x493077){_0x4a7af1=_0x493077;_0x3fa155=0xc8;}else{_0x3fa155=0xce;}_0x2110d1[_0xa6d4('0x1d')](_0x3fa155);return _0x2110d1[_0xa6d4('0x22')](_0xa6d4('0x23'),_0x474b62+'-'+_0x4a7af1+'/'+_0x493077)[_0xa6d4('0x1e')](_0x7420d8);}return null;};}function patchUpdates(_0x5c40f5){return function(_0x3e0ae2){try{jsonpatch[_0xa6d4('0x24')](_0x3e0ae2,_0x5c40f5,!![]);}catch(_0xb7fbf9){return BPromise['reject'](_0xb7fbf9);}return _0x3e0ae2['save']();};}function saveUpdates(_0x3d98c2,_0x32bea3){return function(_0x46d32f){if(_0x46d32f){return _0x46d32f[_0xa6d4('0x25')](_0x3d98c2)[_0xa6d4('0x26')](function(_0x83abb5){return _0x83abb5;});}return null;};}function removeEntity(_0x4a744e,_0x1bf8cb){return function(_0xd4a69e){if(_0xd4a69e){return _0xd4a69e[_0xa6d4('0x27')]()[_0xa6d4('0x26')](function(){_0x4a744e[_0xa6d4('0x1d')](0xcc)[_0xa6d4('0x1c')]();});}};}function handleEntityNotFound(_0x4dca66,_0x3a3ed8){return function(_0x5589c5){if(!_0x5589c5){_0x4dca66[_0xa6d4('0x1b')](0x194);}return _0x5589c5;};}function handleError(_0x5928c9,_0x272759){_0x272759=_0x272759||0x1f4;return function(_0xf2f536){logger[_0xa6d4('0x28')](_0xf2f536['stack']);if(_0xf2f536[_0xa6d4('0x29')]){delete _0xf2f536[_0xa6d4('0x29')];}_0x5928c9['status'](_0x272759)[_0xa6d4('0x2a')](_0xf2f536);};}exports[_0xa6d4('0x2b')]=function(_0x501bd1,_0x581bae){var _0x44b967={'raw':!![],'where':{'id':_0x501bd1[_0xa6d4('0x2c')]['id']}},_0x378bf6={};_0x378bf6['model']=_[_0xa6d4('0x2d')](db[_0xa6d4('0x2e')][_0xa6d4('0x2f')]);_0x378bf6[_0xa6d4('0x30')]=_['keys'](_0x501bd1['query']);_0x378bf6['filters']=_[_0xa6d4('0x31')](_0x378bf6[_0xa6d4('0x32')],_0x378bf6[_0xa6d4('0x30')]);_0x44b967[_0xa6d4('0x33')]=_[_0xa6d4('0x31')](_0x378bf6[_0xa6d4('0x32')],qs[_0xa6d4('0x34')](_0x501bd1['query']['fields']));_0x44b967[_0xa6d4('0x33')]=_0x44b967[_0xa6d4('0x33')][_0xa6d4('0x35')]?_0x44b967[_0xa6d4('0x33')]:_0x378bf6[_0xa6d4('0x32')];if(_0x501bd1[_0xa6d4('0x30')][_0xa6d4('0x36')]){_0x44b967[_0xa6d4('0x37')]=[{'all':!![]}];}_0x44b967=_[_0xa6d4('0x38')]({},_0x44b967,_0x501bd1['options']);return db[_0xa6d4('0x2e')]['find'](_0x44b967)[_0xa6d4('0x26')](handleEntityNotFound(_0x581bae,null))[_0xa6d4('0x26')](respondWithResult(_0x581bae,null))[_0xa6d4('0x39')](handleError(_0x581bae,null));};exports[_0xa6d4('0x25')]=function(_0x3c9819,_0x3f3742){if(_0x3c9819[_0xa6d4('0x3a')]['id']){delete _0x3c9819['body']['id'];}return db['ChatApplication'][_0xa6d4('0x3b')]({'where':{'id':_0x3c9819[_0xa6d4('0x2c')]['id']}})['then'](handleEntityNotFound(_0x3f3742,null))[_0xa6d4('0x26')](saveUpdates(_0x3c9819['body'],null))[_0xa6d4('0x26')](respondWithResult(_0x3f3742,null))[_0xa6d4('0x39')](handleError(_0x3f3742,null));};exports['destroy']=function(_0x5f0f00,_0x350ec4){return db[_0xa6d4('0x2e')]['find']({'where':{'id':_0x5f0f00[_0xa6d4('0x2c')]['id']}})[_0xa6d4('0x26')](handleEntityNotFound(_0x350ec4,null))[_0xa6d4('0x26')](removeEntity(_0x350ec4,null))[_0xa6d4('0x39')](handleError(_0x350ec4,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index ad18aee..f748353 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 _0xfabe=['utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path','rimraf','exports','chat_applications','utf8mb4'];(function(_0x149cbc,_0x379c2b){var _0x570ef6=function(_0x25380f){while(--_0x25380f){_0x149cbc['push'](_0x149cbc['shift']());}};_0x570ef6(++_0x379c2b);}(_0xfabe,0x9b));var _0xefab=function(_0x38cd08,_0x271db8){_0x38cd08=_0x38cd08-0x0;var _0xaab638=_0xfabe[_0x38cd08];return _0xaab638;};'use strict';var _=require(_0xefab('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xefab('0x1'));var moment=require(_0xefab('0x2'));var BPromise=require(_0xefab('0x3'));var rp=require(_0xefab('0x4'));var fs=require('fs');var path=require(_0xefab('0x5'));var rimraf=require(_0xefab('0x6'));var config=require('../../config/environment');var attributes=require('./chatApplication.attributes');module[_0xefab('0x7')]=function(_0x2cf433,_0x260585){return _0x2cf433['define']('ChatApplication',attributes,{'tableName':_0xefab('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xefab('0x9'),'collate':_0xefab('0xa')});}; \ No newline at end of file +var _0xdd0c=['./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x23e363,_0x4a8453){var _0x192e82=function(_0x4e2c3c){while(--_0x4e2c3c){_0x23e363['push'](_0x23e363['shift']());}};_0x192e82(++_0x4a8453);}(_0xdd0c,0x165));var _0xcdd0=function(_0x46e468,_0x15976d){_0x46e468=_0x46e468-0x0;var _0x5a393c=_0xdd0c[_0x46e468];return _0x5a393c;};'use strict';var _=require('lodash');var util=require(_0xcdd0('0x0'));var logger=require(_0xcdd0('0x1'))(_0xcdd0('0x2'));var moment=require('moment');var BPromise=require(_0xcdd0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcdd0('0x4'));var rimraf=require(_0xcdd0('0x5'));var config=require(_0xcdd0('0x6'));var attributes=require(_0xcdd0('0x7'));module[_0xcdd0('0x8')]=function(_0x5ae472,_0x2b33fc){return _0x5ae472[_0xcdd0('0x9')](_0xcdd0('0xa'),attributes,{'tableName':_0xcdd0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcdd0('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index e59376b..0062cf2 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 _0x9fee=['rpc','../../config/environment','jayson/promise','client','http','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x23e95c,_0x322a59){var _0x54da36=function(_0x3582e9){while(--_0x3582e9){_0x23e95c['push'](_0x23e95c['shift']());}};_0x54da36(++_0x322a59);}(_0x9fee,0x67));var _0xe9fe=function(_0x993b20,_0x23f483){_0x993b20=_0x993b20-0x0;var _0x4b86f9=_0x9fee[_0x993b20];return _0x4b86f9;};'use strict';var _=require(_0xe9fe('0x0'));var util=require('util');var moment=require(_0xe9fe('0x1'));var BPromise=require(_0xe9fe('0x2'));var rs=require(_0xe9fe('0x3'));var fs=require('fs');var Redis=require(_0xe9fe('0x4'));var db=require(_0xe9fe('0x5'))['db'];var utils=require(_0xe9fe('0x6'));var logger=require('../../config/logger')(_0xe9fe('0x7'));var config=require(_0xe9fe('0x8'));var jayson=require(_0xe9fe('0x9'));var client=jayson[_0xe9fe('0xa')][_0xe9fe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17cd3e,_0x9f7ac1,_0x1b3f95){return new BPromise(function(_0x36925b,_0x10904d){return client['request'](_0x17cd3e,_0x1b3f95)['then'](function(_0x233fbc){logger[_0xe9fe('0xc')](_0xe9fe('0xd'),_0x9f7ac1,'request\x20sent');logger[_0xe9fe('0xe')](_0xe9fe('0xf'),_0x9f7ac1,_0xe9fe('0x10'),JSON[_0xe9fe('0x11')](_0x233fbc));if(_0x233fbc['error']){if(_0x233fbc[_0xe9fe('0x12')][_0xe9fe('0x13')]===0x1f4){logger[_0xe9fe('0x12')](_0xe9fe('0xd'),_0x9f7ac1,_0x233fbc[_0xe9fe('0x12')][_0xe9fe('0x14')]);return _0x10904d(_0x233fbc[_0xe9fe('0x12')][_0xe9fe('0x14')]);}logger[_0xe9fe('0x12')](_0xe9fe('0xd'),_0x9f7ac1,_0x233fbc[_0xe9fe('0x12')][_0xe9fe('0x14')]);return _0x36925b(_0x233fbc[_0xe9fe('0x12')]['message']);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x9f7ac1,_0xe9fe('0x10'));_0x36925b(_0x233fbc[_0xe9fe('0x15')]['message']);}})['catch'](function(_0x455629){logger[_0xe9fe('0x12')]('ChatApplication,\x20%s,\x20%s',_0x9f7ac1,_0x455629);_0x10904d(_0x455629);});});} \ No newline at end of file +var _0xc3c2=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util'];(function(_0x3bc8ab,_0x4f4594){var _0x1c2e1b=function(_0x3d6f92){while(--_0x3d6f92){_0x3bc8ab['push'](_0x3bc8ab['shift']());}};_0x1c2e1b(++_0x4f4594);}(_0xc3c2,0x16f));var _0x2c3c=function(_0x552b43,_0x2dcc68){_0x552b43=_0x552b43-0x0;var _0x3e01b9=_0xc3c2[_0x552b43];return _0x3e01b9;};'use strict';var _=require('lodash');var util=require(_0x2c3c('0x0'));var moment=require(_0x2c3c('0x1'));var BPromise=require(_0x2c3c('0x2'));var rs=require(_0x2c3c('0x3'));var fs=require('fs');var Redis=require(_0x2c3c('0x4'));var db=require(_0x2c3c('0x5'))['db'];var utils=require(_0x2c3c('0x6'));var logger=require('../../config/logger')(_0x2c3c('0x7'));var config=require(_0x2c3c('0x8'));var jayson=require(_0x2c3c('0x9'));var client=jayson[_0x2c3c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45f690,_0x4f7c40,_0x573055){return new BPromise(function(_0x279942,_0x4278fb){return client[_0x2c3c('0xb')](_0x45f690,_0x573055)[_0x2c3c('0xc')](function(_0x6379f9){logger[_0x2c3c('0xd')](_0x2c3c('0xe'),_0x4f7c40,_0x2c3c('0xf'));logger[_0x2c3c('0x10')](_0x2c3c('0x11'),_0x4f7c40,_0x2c3c('0xf'),JSON[_0x2c3c('0x12')](_0x6379f9));if(_0x6379f9[_0x2c3c('0x13')]){if(_0x6379f9[_0x2c3c('0x13')][_0x2c3c('0x14')]===0x1f4){logger['error'](_0x2c3c('0xe'),_0x4f7c40,_0x6379f9['error'][_0x2c3c('0x15')]);return _0x4278fb(_0x6379f9[_0x2c3c('0x13')][_0x2c3c('0x15')]);}logger[_0x2c3c('0x13')](_0x2c3c('0xe'),_0x4f7c40,_0x6379f9['error'][_0x2c3c('0x15')]);return _0x279942(_0x6379f9['error'][_0x2c3c('0x15')]);}else{logger[_0x2c3c('0xd')]('ChatApplication,\x20%s,\x20%s',_0x4f7c40,_0x2c3c('0xf'));_0x279942(_0x6379f9['result'][_0x2c3c('0x15')]);}})[_0x2c3c('0x16')](function(_0x8fed63){logger[_0x2c3c('0x13')]('ChatApplication,\x20%s,\x20%s',_0x4f7c40,_0x8fed63);_0x4278fb(_0x8fed63);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 546b5ff..453d19b 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 _0x9618=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','delete','destroy','multer','util','path'];(function(_0x130fc0,_0x5a6067){var _0x4b04f0=function(_0x24b888){while(--_0x24b888){_0x130fc0['push'](_0x130fc0['shift']());}};_0x4b04f0(++_0x5a6067);}(_0x9618,0x16d));var _0x8961=function(_0x1c6bba,_0x4c8625){_0x1c6bba=_0x1c6bba-0x0;var _0x6f8acb=_0x9618[_0x1c6bba];return _0x6f8acb;};'use strict';var multer=require(_0x8961('0x0'));var util=require(_0x8961('0x1'));var path=require(_0x8961('0x2'));var timeout=require(_0x8961('0x3'));var express=require(_0x8961('0x4'));var router=express[_0x8961('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8961('0x6'));var interaction=require(_0x8961('0x7'));var config=require(_0x8961('0x8'));var controller=require(_0x8961('0x9'));router[_0x8961('0xa')](_0x8961('0xb'),auth[_0x8961('0xc')](),controller[_0x8961('0xd')]);router['put']('/:id',auth[_0x8961('0xc')](),controller['update']);router[_0x8961('0xe')](_0x8961('0xb'),auth[_0x8961('0xc')](),controller[_0x8961('0xf')]);module['exports']=router; \ No newline at end of file +var _0x9f05=['util','path','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer'];(function(_0xce06e8,_0x149121){var _0x1ba240=function(_0x37d35d){while(--_0x37d35d){_0xce06e8['push'](_0xce06e8['shift']());}};_0x1ba240(++_0x149121);}(_0x9f05,0x1c1));var _0x59f0=function(_0x2d3382,_0x35e70b){_0x2d3382=_0x2d3382-0x0;var _0x9f09bf=_0x9f05[_0x2d3382];return _0x9f09bf;};'use strict';var multer=require(_0x59f0('0x0'));var util=require(_0x59f0('0x1'));var path=require(_0x59f0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x59f0('0x3'));var config=require(_0x59f0('0x4'));var controller=require(_0x59f0('0x5'));router[_0x59f0('0x6')](_0x59f0('0x7'),auth[_0x59f0('0x8')](),controller[_0x59f0('0x9')]);router[_0x59f0('0xa')](_0x59f0('0x7'),auth['isAuthenticated'](),controller[_0x59f0('0xb')]);router[_0x59f0('0xc')](_0x59f0('0x7'),auth[_0x59f0('0x8')](),controller[_0x59f0('0xd')]);module[_0x59f0('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index d32433d..0aae94b 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 _0x0182=['STRING','BOOLEAN','sequelize','exports'];(function(_0x1d1967,_0x52b368){var _0x5d6ce0=function(_0x41f793){while(--_0x41f793){_0x1d1967['push'](_0x1d1967['shift']());}};_0x5d6ce0(++_0x52b368);}(_0x0182,0x18a));var _0x2018=function(_0x3f670b,_0x10f414){_0x3f670b=_0x3f670b-0x0;var _0x1c0978=_0x0182[_0x3f670b];return _0x1c0978;};'use strict';var Sequelize=require(_0x2018('0x0'));module[_0x2018('0x1')]={'name':{'type':Sequelize[_0x2018('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x2018('0x2')]},'write':{'type':Sequelize[_0x2018('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x3843=['sequelize','exports','STRING'];(function(_0x3db91a,_0x425740){var _0x54c81c=function(_0x4ccf10){while(--_0x4ccf10){_0x3db91a['push'](_0x3db91a['shift']());}};_0x54c81c(++_0x425740);}(_0x3843,0x144));var _0x3384=function(_0x554fb4,_0x1db667){_0x554fb4=_0x554fb4-0x0;var _0x494205=_0x3843[_0x554fb4];return _0x494205;};'use strict';var Sequelize=require(_0x3384('0x0'));module[_0x3384('0x1')]={'name':{'type':Sequelize[_0x3384('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 3ec9290..78d56bc 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 _0x06fd=['user','toInteger','ids','omit','getMembers','findOne','User','pick','removeMembers','addMessage','ChatGroupId','getMessages','rawAttributes','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','status','end','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','sendStatus','error','stack','send','index','map','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','ChatGroup','then','includeAll','include','findAll','show','params','find','catch','create','body','describe','getUnread','ChatInternalMessage'];(function(_0x1c11f1,_0x15765b){var _0x1e7e6f=function(_0x29abb5){while(--_0x29abb5){_0x1c11f1['push'](_0x1c11f1['shift']());}};_0x1e7e6f(++_0x15765b);}(_0x06fd,0x13d));var _0xd06f=function(_0x3598bb,_0x24befa){_0x3598bb=_0x3598bb-0x0;var _0x13c837=_0x06fd[_0x3598bb];return _0x13c837;};'use strict';var emlformat=require(_0xd06f('0x0'));var rimraf=require(_0xd06f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd06f('0x2'));var rp=require(_0xd06f('0x3'));var moment=require(_0xd06f('0x4'));var BPromise=require(_0xd06f('0x5'));var Mustache=require(_0xd06f('0x6'));var util=require(_0xd06f('0x7'));var path=require(_0xd06f('0x8'));var sox=require(_0xd06f('0x9'));var csv=require(_0xd06f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd06f('0xb'));var _=require(_0xd06f('0xc'));var squel=require(_0xd06f('0xd'));var crypto=require(_0xd06f('0xe'));var jsforce=require(_0xd06f('0xf'));var deskjs=require(_0xd06f('0x10'));var toCsv=require(_0xd06f('0xa'));var querystring=require(_0xd06f('0x11'));var Papa=require(_0xd06f('0x12'));var Redis=require(_0xd06f('0x13'));var authService=require(_0xd06f('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xd06f('0x15'));var hardwareService=require(_0xd06f('0x16'));var logger=require(_0xd06f('0x17'))(_0xd06f('0x18'));var utils=require(_0xd06f('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xd06f('0x1a'));var db=require('../../mysqldb')['db'];config[_0xd06f('0x1b')]=_[_0xd06f('0x1c')](config[_0xd06f('0x1b')],{'host':_0xd06f('0x1d'),'port':0x18eb});var socket=require(_0xd06f('0x1e'))(new Redis(config[_0xd06f('0x1b')]));require(_0xd06f('0x1f'))['register'](socket);function respondWithStatusCode(_0x2be112,_0x20bd3d){_0x20bd3d=_0x20bd3d||0xcc;return function(_0x2d80f8){if(_0x2d80f8){return _0x2be112['sendStatus'](_0x20bd3d);}return _0x2be112[_0xd06f('0x20')](_0x20bd3d)[_0xd06f('0x21')]();};}function respondWithResult(_0x5d5160,_0xf4f3a3){_0xf4f3a3=_0xf4f3a3||0xc8;return function(_0xdf19fa){if(_0xdf19fa){return _0x5d5160[_0xd06f('0x20')](_0xf4f3a3)['json'](_0xdf19fa);}};}function respondWithFilteredResult(_0x19d036,_0x1b4a0e){return function(_0x30ffa5){if(_0x30ffa5){var _0x42ca60=typeof _0x1b4a0e['offset']===_0xd06f('0x22')&&typeof _0x1b4a0e[_0xd06f('0x23')]==='undefined';var _0x1a7f0f=_0x30ffa5[_0xd06f('0x24')];var _0x40ebd4=_0x42ca60?0x0:_0x1b4a0e[_0xd06f('0x25')];var _0x13f733=_0x42ca60?_0x30ffa5['count']:_0x1b4a0e[_0xd06f('0x25')]+_0x1b4a0e['limit'];var _0x202f97;if(_0x13f733>=_0x1a7f0f){_0x13f733=_0x1a7f0f;_0x202f97=0xc8;}else{_0x202f97=0xce;}_0x19d036[_0xd06f('0x20')](_0x202f97);return _0x19d036[_0xd06f('0x26')](_0xd06f('0x27'),_0x40ebd4+'-'+_0x13f733+'/'+_0x1a7f0f)['json'](_0x30ffa5);}return null;};}function patchUpdates(_0x2b28fd){return function(_0x1ac42d){try{jsonpatch['apply'](_0x1ac42d,_0x2b28fd,!![]);}catch(_0x7dee4b){return BPromise[_0xd06f('0x28')](_0x7dee4b);}return _0x1ac42d[_0xd06f('0x29')]();};}function saveUpdates(_0x387539,_0x297e07){return function(_0x10e90b){if(_0x10e90b){return _0x10e90b[_0xd06f('0x2a')](_0x387539)['then'](function(_0x3f2952){return _0x3f2952;});}return null;};}function removeEntity(_0x4cde78,_0xd81680){return function(_0x89e2b3){if(_0x89e2b3){return _0x89e2b3[_0xd06f('0x2b')]()['then'](function(){_0x4cde78['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x21abd9,_0x101e80){return function(_0x513512){if(!_0x513512){_0x21abd9[_0xd06f('0x2c')](0x194);}return _0x513512;};}function handleError(_0x6b953c,_0x4d90d3){_0x4d90d3=_0x4d90d3||0x1f4;return function(_0x4c848e){logger[_0xd06f('0x2d')](_0x4c848e[_0xd06f('0x2e')]);if(_0x4c848e['name']){delete _0x4c848e['name'];}_0x6b953c[_0xd06f('0x20')](_0x4d90d3)[_0xd06f('0x2f')](_0x4c848e);};}exports[_0xd06f('0x30')]=function(_0x1d4310,_0x5a4c63){var _0x51dc99={},_0x3e0013={},_0x15f2c4={'count':0x0,'rows':[]};var _0x3a8ff4=_[_0xd06f('0x31')](db['ChatGroup']['rawAttributes'],function(_0x12c5d9){return{'name':_0x12c5d9['fieldName'],'type':_0x12c5d9[_0xd06f('0x32')]['key']};});_0x3e0013[_0xd06f('0x33')]=_[_0xd06f('0x31')](_0x3a8ff4,_0xd06f('0x34'));_0x3e0013[_0xd06f('0x35')]=_[_0xd06f('0x36')](_0x1d4310[_0xd06f('0x35')]);_0x3e0013[_0xd06f('0x37')]=_[_0xd06f('0x38')](_0x3e0013[_0xd06f('0x33')],_0x3e0013[_0xd06f('0x35')]);_0x51dc99[_0xd06f('0x39')]=_[_0xd06f('0x38')](_0x3e0013[_0xd06f('0x33')],qs['fields'](_0x1d4310[_0xd06f('0x35')][_0xd06f('0x3a')]));_0x51dc99[_0xd06f('0x39')]=_0x51dc99[_0xd06f('0x39')][_0xd06f('0x3b')]?_0x51dc99[_0xd06f('0x39')]:_0x3e0013['model'];if(!_0x1d4310[_0xd06f('0x35')][_0xd06f('0x3c')](_0xd06f('0x3d'))){_0x51dc99[_0xd06f('0x23')]=qs['limit'](_0x1d4310[_0xd06f('0x35')][_0xd06f('0x23')]);_0x51dc99[_0xd06f('0x25')]=qs[_0xd06f('0x25')](_0x1d4310[_0xd06f('0x35')]['offset']);}_0x51dc99[_0xd06f('0x3e')]=qs['sort'](_0x1d4310['query'][_0xd06f('0x3f')]);_0x51dc99[_0xd06f('0x40')]=qs['filters'](_['pick'](_0x1d4310[_0xd06f('0x35')],_0x3e0013[_0xd06f('0x37')]),_0x3a8ff4);if(_0x1d4310[_0xd06f('0x35')][_0xd06f('0x41')]){_0x51dc99[_0xd06f('0x40')]=_[_0xd06f('0x42')](_0x51dc99[_0xd06f('0x40')],{'$or':_[_0xd06f('0x31')](_0x3a8ff4,function(_0x1c5beb){if(_0x1c5beb[_0xd06f('0x32')]!==_0xd06f('0x43')){var _0x26829e={};_0x26829e[_0x1c5beb['name']]={'$like':'%'+_0x1d4310[_0xd06f('0x35')][_0xd06f('0x41')]+'%'};return _0x26829e;}})});}_0x51dc99=_[_0xd06f('0x42')]({},_0x51dc99,_0x1d4310[_0xd06f('0x44')]);var _0x49136b={'where':_0x51dc99['where']};return db[_0xd06f('0x45')][_0xd06f('0x24')](_0x49136b)[_0xd06f('0x46')](function(_0x438e86){_0x15f2c4[_0xd06f('0x24')]=_0x438e86;if(_0x1d4310[_0xd06f('0x35')][_0xd06f('0x47')]){_0x51dc99[_0xd06f('0x48')]=[{'all':!![]}];}return db[_0xd06f('0x45')][_0xd06f('0x49')](_0x51dc99);})[_0xd06f('0x46')](function(_0x390e97){_0x15f2c4['rows']=_0x390e97;return _0x15f2c4;})[_0xd06f('0x46')](respondWithFilteredResult(_0x5a4c63,_0x51dc99))['catch'](handleError(_0x5a4c63,null));};exports[_0xd06f('0x4a')]=function(_0x1762c5,_0x3ba735){var _0xf3f179={'raw':!![],'where':{'id':_0x1762c5[_0xd06f('0x4b')]['id']}},_0x4979a9={};_0x4979a9[_0xd06f('0x33')]=_[_0xd06f('0x36')](db['ChatGroup']['rawAttributes']);_0x4979a9['query']=_[_0xd06f('0x36')](_0x1762c5[_0xd06f('0x35')]);_0x4979a9['filters']=_['intersection'](_0x4979a9[_0xd06f('0x33')],_0x4979a9[_0xd06f('0x35')]);_0xf3f179[_0xd06f('0x39')]=_['intersection'](_0x4979a9[_0xd06f('0x33')],qs[_0xd06f('0x3a')](_0x1762c5[_0xd06f('0x35')][_0xd06f('0x3a')]));_0xf3f179[_0xd06f('0x39')]=_0xf3f179[_0xd06f('0x39')][_0xd06f('0x3b')]?_0xf3f179['attributes']:_0x4979a9['model'];if(_0x1762c5[_0xd06f('0x35')]['includeAll']){_0xf3f179[_0xd06f('0x48')]=[{'all':!![]}];}_0xf3f179=_[_0xd06f('0x42')]({},_0xf3f179,_0x1762c5[_0xd06f('0x44')]);return db[_0xd06f('0x45')][_0xd06f('0x4c')](_0xf3f179)['then'](handleEntityNotFound(_0x3ba735,null))[_0xd06f('0x46')](respondWithResult(_0x3ba735,null))[_0xd06f('0x4d')](handleError(_0x3ba735,null));};exports[_0xd06f('0x4e')]=function(_0x1fd6e0,_0x21fd7a){return db[_0xd06f('0x45')][_0xd06f('0x4e')](_0x1fd6e0[_0xd06f('0x4f')],{})['then'](respondWithResult(_0x21fd7a,0xc9))[_0xd06f('0x4d')](handleError(_0x21fd7a,null));};exports[_0xd06f('0x2a')]=function(_0x1aee86,_0x54d85a){if(_0x1aee86[_0xd06f('0x4f')]['id']){delete _0x1aee86['body']['id'];}return db[_0xd06f('0x45')][_0xd06f('0x4c')]({'where':{'id':_0x1aee86[_0xd06f('0x4b')]['id']}})[_0xd06f('0x46')](handleEntityNotFound(_0x54d85a,null))[_0xd06f('0x46')](saveUpdates(_0x1aee86[_0xd06f('0x4f')],null))[_0xd06f('0x46')](respondWithResult(_0x54d85a,null))[_0xd06f('0x4d')](handleError(_0x54d85a,null));};exports['destroy']=function(_0x299b46,_0x23d72d){return db[_0xd06f('0x45')][_0xd06f('0x4c')]({'where':{'id':_0x299b46[_0xd06f('0x4b')]['id']}})[_0xd06f('0x46')](handleEntityNotFound(_0x23d72d,null))['then'](removeEntity(_0x23d72d,null))['catch'](handleError(_0x23d72d,null));};exports[_0xd06f('0x50')]=function(_0x42bae2,_0x20f18b){return db[_0xd06f('0x45')]['describe']()['then'](respondWithResult(_0x20f18b,null))[_0xd06f('0x4d')](handleError(_0x20f18b,null));};exports[_0xd06f('0x51')]=function(_0x24cfbc,_0x229fd7,_0x3ed282){return db[_0xd06f('0x52')][_0xd06f('0x24')]({'where':{'ChatGroupId':_0x24cfbc['params']['id'],'ToId':_0x24cfbc[_0xd06f('0x53')]['id'],'read':![]}})[_0xd06f('0x46')](function(_0x2fc4bf){return{'id':_[_0xd06f('0x54')](_0x24cfbc['params']['id']),'count':_0x2fc4bf};})[_0xd06f('0x46')](respondWithResult(_0x229fd7,null))[_0xd06f('0x4d')](handleError(_0x229fd7,null));};exports['addMembers']=function(_0x5b1144,_0x594987,_0x3bd816){return db[_0xd06f('0x45')][_0xd06f('0x4c')]({'where':{'id':_0x5b1144[_0xd06f('0x4b')]['id']}})[_0xd06f('0x46')](handleEntityNotFound(_0x594987,null))['then'](function(_0x139ff2){if(_0x139ff2){return _0x139ff2['addMembers'](_0x5b1144[_0xd06f('0x4f')][_0xd06f('0x55')],_[_0xd06f('0x56')](_0x5b1144[_0xd06f('0x4f')],[_0xd06f('0x55'),'id'])||{});}})[_0xd06f('0x46')](respondWithResult(_0x594987,null))['catch'](handleError(_0x594987,null));};exports[_0xd06f('0x57')]=function(_0x5defe1,_0x351baf,_0x7c787f){var _0x2f0a0e={};var _0x4627c6={};var _0x1d038b;var _0x4a3ee6;return db['ChatGroup'][_0xd06f('0x58')]({'where':{'id':_0x5defe1[_0xd06f('0x4b')]['id']}})[_0xd06f('0x46')](handleEntityNotFound(_0x351baf,null))[_0xd06f('0x46')](function(_0x140062){if(_0x140062){_0x1d038b=_0x140062;_0x4627c6[_0xd06f('0x33')]=_[_0xd06f('0x36')](db[_0xd06f('0x59')]['rawAttributes']);_0x4627c6[_0xd06f('0x35')]=_[_0xd06f('0x36')](_0x5defe1['query']);_0x4627c6[_0xd06f('0x37')]=_[_0xd06f('0x38')](_0x4627c6[_0xd06f('0x33')],_0x4627c6[_0xd06f('0x35')]);_0x2f0a0e[_0xd06f('0x39')]=_[_0xd06f('0x38')](_0x4627c6[_0xd06f('0x33')],qs[_0xd06f('0x3a')](_0x5defe1[_0xd06f('0x35')][_0xd06f('0x3a')]));_0x2f0a0e['attributes']=_0x2f0a0e[_0xd06f('0x39')][_0xd06f('0x3b')]?_0x2f0a0e[_0xd06f('0x39')]:_0x4627c6[_0xd06f('0x33')];_0x2f0a0e[_0xd06f('0x3e')]=qs['sort'](_0x5defe1[_0xd06f('0x35')][_0xd06f('0x3f')]);_0x2f0a0e[_0xd06f('0x40')]=qs[_0xd06f('0x37')](_[_0xd06f('0x5a')](_0x5defe1[_0xd06f('0x35')],_0x4627c6[_0xd06f('0x37')]));if(_0x5defe1[_0xd06f('0x35')][_0xd06f('0x41')]){_0x2f0a0e[_0xd06f('0x40')]=_[_0xd06f('0x42')](_0x2f0a0e['where'],{'$or':_[_0xd06f('0x31')](_0x2f0a0e[_0xd06f('0x39')],function(_0x4cae70){var _0x502b0d={};_0x502b0d[_0x4cae70]={'$like':'%'+_0x5defe1['query'][_0xd06f('0x41')]+'%'};return _0x502b0d;})});}_0x2f0a0e=_[_0xd06f('0x42')]({},_0x2f0a0e,_0x5defe1[_0xd06f('0x44')]);return _0x1d038b['getMembers'](_0x2f0a0e);}})[_0xd06f('0x46')](function(_0x296ec5){if(_0x296ec5){_0x4a3ee6=_0x296ec5[_0xd06f('0x3b')];if(!_0x5defe1['query']['hasOwnProperty'](_0xd06f('0x3d'))){_0x2f0a0e['limit']=qs[_0xd06f('0x23')](_0x5defe1[_0xd06f('0x35')][_0xd06f('0x23')]);_0x2f0a0e['offset']=qs[_0xd06f('0x25')](_0x5defe1[_0xd06f('0x35')][_0xd06f('0x25')]);}return _0x1d038b[_0xd06f('0x57')](_0x2f0a0e);}})[_0xd06f('0x46')](function(_0x1771b3){if(_0x1771b3){return _0x1771b3?{'count':_0x4a3ee6,'rows':_0x1771b3}:null;}})[_0xd06f('0x46')](respondWithResult(_0x351baf,null))[_0xd06f('0x4d')](handleError(_0x351baf,null));};exports[_0xd06f('0x5b')]=function(_0x4e2a17,_0x72c0a1,_0x5f0e02){return db['ChatGroup'][_0xd06f('0x4c')]({'where':{'id':_0x4e2a17[_0xd06f('0x4b')]['id']}})[_0xd06f('0x46')](handleEntityNotFound(_0x72c0a1,null))[_0xd06f('0x46')](function(_0x45ffba){if(_0x45ffba){return _0x45ffba['removeMembers'](_0x4e2a17[_0xd06f('0x35')][_0xd06f('0x55')]);}})['then'](respondWithStatusCode(_0x72c0a1,null))['catch'](handleError(_0x72c0a1,null));};exports[_0xd06f('0x5c')]=function(_0x5bb0f8,_0x460a7c,_0x9bfd6f){if(_0x5bb0f8[_0xd06f('0x4f')]['id']){delete _0x5bb0f8[_0xd06f('0x4f')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x5bb0f8[_0xd06f('0x4b')]['id']}})[_0xd06f('0x46')](handleEntityNotFound(_0x460a7c,null))[_0xd06f('0x46')](function(_0x2a88d1){if(_0x2a88d1){_0x5bb0f8[_0xd06f('0x4f')][_0xd06f('0x5d')]=_0x2a88d1['id'];return db[_0xd06f('0x52')]['create'](_0x5bb0f8[_0xd06f('0x4f')]);}})['then'](respondWithResult(_0x460a7c,null))[_0xd06f('0x4d')](handleError(_0x460a7c,null));};exports[_0xd06f('0x5e')]=function(_0x39945e,_0x92f227,_0xa44cfb){var _0x5e6467={};var _0x506cff={};var _0x374faf;var _0x5733eb;return db['ChatGroup'][_0xd06f('0x58')]({'where':{'id':_0x39945e[_0xd06f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x92f227,null))[_0xd06f('0x46')](function(_0x310bec){if(_0x310bec){_0x374faf=_0x310bec;_0x506cff[_0xd06f('0x33')]=_[_0xd06f('0x36')](db[_0xd06f('0x52')][_0xd06f('0x5f')]);_0x506cff[_0xd06f('0x35')]=_['keys'](_0x39945e['query']);_0x506cff[_0xd06f('0x37')]=_[_0xd06f('0x38')](_0x506cff['model'],_0x506cff[_0xd06f('0x35')]);_0x5e6467[_0xd06f('0x39')]=_[_0xd06f('0x38')](_0x506cff[_0xd06f('0x33')],qs[_0xd06f('0x3a')](_0x39945e[_0xd06f('0x35')][_0xd06f('0x3a')]));_0x5e6467[_0xd06f('0x39')]=_0x5e6467[_0xd06f('0x39')][_0xd06f('0x3b')]?_0x5e6467[_0xd06f('0x39')]:_0x506cff[_0xd06f('0x33')];_0x5e6467[_0xd06f('0x3e')]=qs[_0xd06f('0x3f')](_0x39945e[_0xd06f('0x35')][_0xd06f('0x3f')]);_0x5e6467[_0xd06f('0x40')]=qs[_0xd06f('0x37')](_['pick'](_0x39945e[_0xd06f('0x35')],_0x506cff[_0xd06f('0x37')]));if(_0x39945e[_0xd06f('0x35')][_0xd06f('0x41')]){_0x5e6467[_0xd06f('0x40')]=_[_0xd06f('0x42')](_0x5e6467[_0xd06f('0x40')],{'$or':_[_0xd06f('0x31')](_0x5e6467[_0xd06f('0x39')],function(_0x3cddc5){var _0x464bc2={};_0x464bc2[_0x3cddc5]={'$like':'%'+_0x39945e['query'][_0xd06f('0x41')]+'%'};return _0x464bc2;})});}if(_0x39945e[_0xd06f('0x35')]['$gte']){var _0x33a500=_0x39945e[_0xd06f('0x35')][_0xd06f('0x60')][_0xd06f('0x61')](',');var _0x226104={};_0x226104[_0x33a500[0x0]]={'$gte':moment(_0x33a500[0x1])[_0xd06f('0x62')](_0xd06f('0x63'))};_0x5e6467['where']=_[_0xd06f('0x42')](_0x5e6467[_0xd06f('0x40')],_0x226104);}_0x5e6467=_[_0xd06f('0x42')]({},_0x5e6467,_0x39945e['options']);return _0x374faf[_0xd06f('0x5e')](_0x5e6467);}})[_0xd06f('0x46')](function(_0x28c203){if(_0x28c203){_0x5733eb=_0x28c203[_0xd06f('0x3b')];if(!_0x39945e['query'][_0xd06f('0x3c')]('nolimit')){_0x5e6467[_0xd06f('0x23')]=qs[_0xd06f('0x23')](_0x39945e['query'][_0xd06f('0x23')]);_0x5e6467[_0xd06f('0x25')]=qs[_0xd06f('0x25')](_0x39945e[_0xd06f('0x35')][_0xd06f('0x25')]);}return _0x374faf['getMessages'](_0x5e6467);}})[_0xd06f('0x46')](function(_0x51dad9){if(_0x51dad9){return _0x51dad9?{'count':_0x5733eb,'rows':_0x51dad9}:null;}})[_0xd06f('0x46')](respondWithResult(_0x92f227,null))[_0xd06f('0x4d')](handleError(_0x92f227,null));}; \ No newline at end of file +var _0x5587=['getMembers','findOne','User','rawAttributes','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','json','offset','limit','undefined','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatGroup','count','includeAll','include','findAll','rows','show','params','find','create','body','catch','describe','ChatInternalMessage','user','toInteger','addMembers','ids','omit'];(function(_0xd73884,_0x2ca96d){var _0x16b79c=function(_0x1521bc){while(--_0x1521bc){_0xd73884['push'](_0xd73884['shift']());}};_0x16b79c(++_0x2ca96d);}(_0x5587,0x6e));var _0x7558=function(_0x5d6c6e,_0x6d7dd0){_0x5d6c6e=_0x5d6c6e-0x0;var _0x1afcb0=_0x5587[_0x5d6c6e];return _0x1afcb0;};'use strict';var emlformat=require(_0x7558('0x0'));var rimraf=require(_0x7558('0x1'));var zipdir=require(_0x7558('0x2'));var jsonpatch=require(_0x7558('0x3'));var rp=require(_0x7558('0x4'));var moment=require(_0x7558('0x5'));var BPromise=require(_0x7558('0x6'));var Mustache=require(_0x7558('0x7'));var util=require('util');var path=require(_0x7558('0x8'));var sox=require('sox');var csv=require(_0x7558('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7558('0xa'));var crypto=require(_0x7558('0xb'));var jsforce=require(_0x7558('0xc'));var deskjs=require(_0x7558('0xd'));var toCsv=require(_0x7558('0x9'));var querystring=require('querystring');var Papa=require(_0x7558('0xe'));var Redis=require('ioredis');var authService=require(_0x7558('0xf'));var qs=require(_0x7558('0x10'));var as=require(_0x7558('0x11'));var hardwareService=require(_0x7558('0x12'));var logger=require(_0x7558('0x13'))(_0x7558('0x14'));var utils=require(_0x7558('0x15'));var config=require(_0x7558('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7558('0x17'))['db'];config['redis']=_[_0x7558('0x18')](config[_0x7558('0x19')],{'host':_0x7558('0x1a'),'port':0x18eb});var socket=require(_0x7558('0x1b'))(new Redis(config[_0x7558('0x19')]));require(_0x7558('0x1c'))[_0x7558('0x1d')](socket);function respondWithStatusCode(_0x5a616c,_0x3ced8f){_0x3ced8f=_0x3ced8f||0xcc;return function(_0x4f4463){if(_0x4f4463){return _0x5a616c[_0x7558('0x1e')](_0x3ced8f);}return _0x5a616c[_0x7558('0x1f')](_0x3ced8f)['end']();};}function respondWithResult(_0x505eb6,_0x5b4e49){_0x5b4e49=_0x5b4e49||0xc8;return function(_0x43fee8){if(_0x43fee8){return _0x505eb6[_0x7558('0x1f')](_0x5b4e49)[_0x7558('0x20')](_0x43fee8);}};}function respondWithFilteredResult(_0x5a02fe,_0x208ee5){return function(_0x2f00e5){if(_0x2f00e5){var _0x39df8b=typeof _0x208ee5[_0x7558('0x21')]==='undefined'&&typeof _0x208ee5[_0x7558('0x22')]===_0x7558('0x23');var _0x4a2ba7=_0x2f00e5['count'];var _0x44a64d=_0x39df8b?0x0:_0x208ee5['offset'];var _0x225fc4=_0x39df8b?_0x2f00e5['count']:_0x208ee5[_0x7558('0x21')]+_0x208ee5[_0x7558('0x22')];var _0x1999f7;if(_0x225fc4>=_0x4a2ba7){_0x225fc4=_0x4a2ba7;_0x1999f7=0xc8;}else{_0x1999f7=0xce;}_0x5a02fe[_0x7558('0x1f')](_0x1999f7);return _0x5a02fe[_0x7558('0x24')](_0x7558('0x25'),_0x44a64d+'-'+_0x225fc4+'/'+_0x4a2ba7)['json'](_0x2f00e5);}return null;};}function patchUpdates(_0x6677f5){return function(_0x2e41bb){try{jsonpatch[_0x7558('0x26')](_0x2e41bb,_0x6677f5,!![]);}catch(_0x30c60a){return BPromise[_0x7558('0x27')](_0x30c60a);}return _0x2e41bb['save']();};}function saveUpdates(_0x928046,_0x558234){return function(_0x595919){if(_0x595919){return _0x595919[_0x7558('0x28')](_0x928046)[_0x7558('0x29')](function(_0x29fece){return _0x29fece;});}return null;};}function removeEntity(_0x8478bb,_0x3f9f7d){return function(_0x4ef423){if(_0x4ef423){return _0x4ef423[_0x7558('0x2a')]()[_0x7558('0x29')](function(){_0x8478bb['status'](0xcc)[_0x7558('0x2b')]();});}};}function handleEntityNotFound(_0x419842,_0xb60f25){return function(_0x4b7549){if(!_0x4b7549){_0x419842[_0x7558('0x1e')](0x194);}return _0x4b7549;};}function handleError(_0x1861ce,_0x2cfee6){_0x2cfee6=_0x2cfee6||0x1f4;return function(_0x115c4){logger[_0x7558('0x2c')](_0x115c4[_0x7558('0x2d')]);if(_0x115c4[_0x7558('0x2e')]){delete _0x115c4[_0x7558('0x2e')];}_0x1861ce['status'](_0x2cfee6)[_0x7558('0x2f')](_0x115c4);};}exports[_0x7558('0x30')]=function(_0x558940,_0x52c48b){var _0x6f8523={},_0x596351={},_0x588bf4={'count':0x0,'rows':[]};var _0xeb1b87=_[_0x7558('0x31')](db['ChatGroup']['rawAttributes'],function(_0x1a4bcc){return{'name':_0x1a4bcc['fieldName'],'type':_0x1a4bcc['type'][_0x7558('0x32')]};});_0x596351['model']=_[_0x7558('0x31')](_0xeb1b87,_0x7558('0x2e'));_0x596351[_0x7558('0x33')]=_[_0x7558('0x34')](_0x558940[_0x7558('0x33')]);_0x596351[_0x7558('0x35')]=_[_0x7558('0x36')](_0x596351[_0x7558('0x37')],_0x596351[_0x7558('0x33')]);_0x6f8523[_0x7558('0x38')]=_['intersection'](_0x596351['model'],qs[_0x7558('0x39')](_0x558940['query'][_0x7558('0x39')]));_0x6f8523[_0x7558('0x38')]=_0x6f8523[_0x7558('0x38')][_0x7558('0x3a')]?_0x6f8523['attributes']:_0x596351[_0x7558('0x37')];if(!_0x558940[_0x7558('0x33')][_0x7558('0x3b')](_0x7558('0x3c'))){_0x6f8523[_0x7558('0x22')]=qs['limit'](_0x558940[_0x7558('0x33')][_0x7558('0x22')]);_0x6f8523[_0x7558('0x21')]=qs[_0x7558('0x21')](_0x558940[_0x7558('0x33')][_0x7558('0x21')]);}_0x6f8523[_0x7558('0x3d')]=qs[_0x7558('0x3e')](_0x558940[_0x7558('0x33')]['sort']);_0x6f8523[_0x7558('0x3f')]=qs['filters'](_[_0x7558('0x40')](_0x558940['query'],_0x596351['filters']),_0xeb1b87);if(_0x558940[_0x7558('0x33')][_0x7558('0x41')]){_0x6f8523[_0x7558('0x3f')]=_[_0x7558('0x42')](_0x6f8523[_0x7558('0x3f')],{'$or':_['map'](_0xeb1b87,function(_0x2ef4d7){if(_0x2ef4d7['type']!==_0x7558('0x43')){var _0x26fde0={};_0x26fde0[_0x2ef4d7['name']]={'$like':'%'+_0x558940[_0x7558('0x33')][_0x7558('0x41')]+'%'};return _0x26fde0;}})});}_0x6f8523=_[_0x7558('0x42')]({},_0x6f8523,_0x558940[_0x7558('0x44')]);var _0x4b27a8={'where':_0x6f8523[_0x7558('0x3f')]};return db[_0x7558('0x45')][_0x7558('0x46')](_0x4b27a8)['then'](function(_0x11f4d0){_0x588bf4['count']=_0x11f4d0;if(_0x558940[_0x7558('0x33')][_0x7558('0x47')]){_0x6f8523[_0x7558('0x48')]=[{'all':!![]}];}return db['ChatGroup'][_0x7558('0x49')](_0x6f8523);})['then'](function(_0x26570d){_0x588bf4[_0x7558('0x4a')]=_0x26570d;return _0x588bf4;})[_0x7558('0x29')](respondWithFilteredResult(_0x52c48b,_0x6f8523))['catch'](handleError(_0x52c48b,null));};exports[_0x7558('0x4b')]=function(_0x89e2,_0x244862){var _0x1f6ba9={'raw':!![],'where':{'id':_0x89e2[_0x7558('0x4c')]['id']}},_0x2bbc89={};_0x2bbc89[_0x7558('0x37')]=_[_0x7558('0x34')](db[_0x7558('0x45')]['rawAttributes']);_0x2bbc89[_0x7558('0x33')]=_[_0x7558('0x34')](_0x89e2[_0x7558('0x33')]);_0x2bbc89['filters']=_['intersection'](_0x2bbc89[_0x7558('0x37')],_0x2bbc89[_0x7558('0x33')]);_0x1f6ba9['attributes']=_['intersection'](_0x2bbc89[_0x7558('0x37')],qs[_0x7558('0x39')](_0x89e2[_0x7558('0x33')]['fields']));_0x1f6ba9['attributes']=_0x1f6ba9[_0x7558('0x38')][_0x7558('0x3a')]?_0x1f6ba9[_0x7558('0x38')]:_0x2bbc89['model'];if(_0x89e2['query']['includeAll']){_0x1f6ba9[_0x7558('0x48')]=[{'all':!![]}];}_0x1f6ba9=_['merge']({},_0x1f6ba9,_0x89e2['options']);return db[_0x7558('0x45')][_0x7558('0x4d')](_0x1f6ba9)[_0x7558('0x29')](handleEntityNotFound(_0x244862,null))[_0x7558('0x29')](respondWithResult(_0x244862,null))['catch'](handleError(_0x244862,null));};exports[_0x7558('0x4e')]=function(_0x248306,_0x129a7e){return db[_0x7558('0x45')][_0x7558('0x4e')](_0x248306[_0x7558('0x4f')],{})[_0x7558('0x29')](respondWithResult(_0x129a7e,0xc9))[_0x7558('0x50')](handleError(_0x129a7e,null));};exports[_0x7558('0x28')]=function(_0x1504d6,_0x30851c){if(_0x1504d6[_0x7558('0x4f')]['id']){delete _0x1504d6[_0x7558('0x4f')]['id'];}return db[_0x7558('0x45')][_0x7558('0x4d')]({'where':{'id':_0x1504d6[_0x7558('0x4c')]['id']}})[_0x7558('0x29')](handleEntityNotFound(_0x30851c,null))[_0x7558('0x29')](saveUpdates(_0x1504d6['body'],null))[_0x7558('0x29')](respondWithResult(_0x30851c,null))[_0x7558('0x50')](handleError(_0x30851c,null));};exports[_0x7558('0x2a')]=function(_0x44043d,_0x5827f4){return db[_0x7558('0x45')][_0x7558('0x4d')]({'where':{'id':_0x44043d[_0x7558('0x4c')]['id']}})[_0x7558('0x29')](handleEntityNotFound(_0x5827f4,null))[_0x7558('0x29')](removeEntity(_0x5827f4,null))[_0x7558('0x50')](handleError(_0x5827f4,null));};exports[_0x7558('0x51')]=function(_0x2c4511,_0x42ca74){return db[_0x7558('0x45')][_0x7558('0x51')]()[_0x7558('0x29')](respondWithResult(_0x42ca74,null))[_0x7558('0x50')](handleError(_0x42ca74,null));};exports['getUnread']=function(_0x355249,_0x45700b,_0x14551c){return db[_0x7558('0x52')]['count']({'where':{'ChatGroupId':_0x355249[_0x7558('0x4c')]['id'],'ToId':_0x355249[_0x7558('0x53')]['id'],'read':![]}})[_0x7558('0x29')](function(_0x5ef917){return{'id':_[_0x7558('0x54')](_0x355249[_0x7558('0x4c')]['id']),'count':_0x5ef917};})[_0x7558('0x29')](respondWithResult(_0x45700b,null))[_0x7558('0x50')](handleError(_0x45700b,null));};exports['addMembers']=function(_0x32c7a5,_0x18f934,_0x5e8275){return db[_0x7558('0x45')]['find']({'where':{'id':_0x32c7a5[_0x7558('0x4c')]['id']}})[_0x7558('0x29')](handleEntityNotFound(_0x18f934,null))[_0x7558('0x29')](function(_0x5481e9){if(_0x5481e9){return _0x5481e9[_0x7558('0x55')](_0x32c7a5[_0x7558('0x4f')][_0x7558('0x56')],_[_0x7558('0x57')](_0x32c7a5[_0x7558('0x4f')],[_0x7558('0x56'),'id'])||{});}})[_0x7558('0x29')](respondWithResult(_0x18f934,null))['catch'](handleError(_0x18f934,null));};exports[_0x7558('0x58')]=function(_0x2e540a,_0x325737,_0x3c3381){var _0x243bc1={};var _0x53444a={};var _0xf5a3ba;var _0x309fae;return db['ChatGroup'][_0x7558('0x59')]({'where':{'id':_0x2e540a[_0x7558('0x4c')]['id']}})[_0x7558('0x29')](handleEntityNotFound(_0x325737,null))[_0x7558('0x29')](function(_0x3571f2){if(_0x3571f2){_0xf5a3ba=_0x3571f2;_0x53444a[_0x7558('0x37')]=_['keys'](db[_0x7558('0x5a')][_0x7558('0x5b')]);_0x53444a['query']=_['keys'](_0x2e540a[_0x7558('0x33')]);_0x53444a[_0x7558('0x35')]=_['intersection'](_0x53444a[_0x7558('0x37')],_0x53444a['query']);_0x243bc1[_0x7558('0x38')]=_['intersection'](_0x53444a[_0x7558('0x37')],qs['fields'](_0x2e540a[_0x7558('0x33')]['fields']));_0x243bc1[_0x7558('0x38')]=_0x243bc1['attributes'][_0x7558('0x3a')]?_0x243bc1[_0x7558('0x38')]:_0x53444a[_0x7558('0x37')];_0x243bc1[_0x7558('0x3d')]=qs['sort'](_0x2e540a[_0x7558('0x33')][_0x7558('0x3e')]);_0x243bc1[_0x7558('0x3f')]=qs['filters'](_[_0x7558('0x40')](_0x2e540a[_0x7558('0x33')],_0x53444a[_0x7558('0x35')]));if(_0x2e540a[_0x7558('0x33')][_0x7558('0x41')]){_0x243bc1['where']=_[_0x7558('0x42')](_0x243bc1['where'],{'$or':_['map'](_0x243bc1[_0x7558('0x38')],function(_0x26288c){var _0x4a454b={};_0x4a454b[_0x26288c]={'$like':'%'+_0x2e540a[_0x7558('0x33')][_0x7558('0x41')]+'%'};return _0x4a454b;})});}_0x243bc1=_[_0x7558('0x42')]({},_0x243bc1,_0x2e540a['options']);return _0xf5a3ba[_0x7558('0x58')](_0x243bc1);}})[_0x7558('0x29')](function(_0x5660c7){if(_0x5660c7){_0x309fae=_0x5660c7[_0x7558('0x3a')];if(!_0x2e540a[_0x7558('0x33')][_0x7558('0x3b')](_0x7558('0x3c'))){_0x243bc1[_0x7558('0x22')]=qs[_0x7558('0x22')](_0x2e540a[_0x7558('0x33')][_0x7558('0x22')]);_0x243bc1[_0x7558('0x21')]=qs['offset'](_0x2e540a[_0x7558('0x33')][_0x7558('0x21')]);}return _0xf5a3ba[_0x7558('0x58')](_0x243bc1);}})[_0x7558('0x29')](function(_0xf268cb){if(_0xf268cb){return _0xf268cb?{'count':_0x309fae,'rows':_0xf268cb}:null;}})[_0x7558('0x29')](respondWithResult(_0x325737,null))[_0x7558('0x50')](handleError(_0x325737,null));};exports[_0x7558('0x5c')]=function(_0x19dec0,_0x5989d4,_0xc08830){return db[_0x7558('0x45')][_0x7558('0x4d')]({'where':{'id':_0x19dec0[_0x7558('0x4c')]['id']}})[_0x7558('0x29')](handleEntityNotFound(_0x5989d4,null))[_0x7558('0x29')](function(_0x12fedc){if(_0x12fedc){return _0x12fedc['removeMembers'](_0x19dec0[_0x7558('0x33')]['ids']);}})[_0x7558('0x29')](respondWithStatusCode(_0x5989d4,null))[_0x7558('0x50')](handleError(_0x5989d4,null));};exports[_0x7558('0x5d')]=function(_0x2e3f41,_0x425227,_0x200469){if(_0x2e3f41[_0x7558('0x4f')]['id']){delete _0x2e3f41['body']['id'];}return db[_0x7558('0x45')][_0x7558('0x4d')]({'where':{'id':_0x2e3f41[_0x7558('0x4c')]['id']}})[_0x7558('0x29')](handleEntityNotFound(_0x425227,null))['then'](function(_0x457626){if(_0x457626){_0x2e3f41[_0x7558('0x4f')][_0x7558('0x5e')]=_0x457626['id'];return db[_0x7558('0x52')][_0x7558('0x4e')](_0x2e3f41[_0x7558('0x4f')]);}})[_0x7558('0x29')](respondWithResult(_0x425227,null))[_0x7558('0x50')](handleError(_0x425227,null));};exports[_0x7558('0x5f')]=function(_0x549417,_0x11c7b2,_0x4412db){var _0x4a458c={};var _0x68aabf={};var _0x11192a;var _0x660182;return db[_0x7558('0x45')][_0x7558('0x59')]({'where':{'id':_0x549417[_0x7558('0x4c')]['id']}})[_0x7558('0x29')](handleEntityNotFound(_0x11c7b2,null))[_0x7558('0x29')](function(_0x5566f9){if(_0x5566f9){_0x11192a=_0x5566f9;_0x68aabf[_0x7558('0x37')]=_[_0x7558('0x34')](db[_0x7558('0x52')]['rawAttributes']);_0x68aabf['query']=_[_0x7558('0x34')](_0x549417[_0x7558('0x33')]);_0x68aabf[_0x7558('0x35')]=_['intersection'](_0x68aabf[_0x7558('0x37')],_0x68aabf[_0x7558('0x33')]);_0x4a458c[_0x7558('0x38')]=_['intersection'](_0x68aabf[_0x7558('0x37')],qs[_0x7558('0x39')](_0x549417[_0x7558('0x33')][_0x7558('0x39')]));_0x4a458c['attributes']=_0x4a458c[_0x7558('0x38')][_0x7558('0x3a')]?_0x4a458c['attributes']:_0x68aabf[_0x7558('0x37')];_0x4a458c['order']=qs[_0x7558('0x3e')](_0x549417['query'][_0x7558('0x3e')]);_0x4a458c[_0x7558('0x3f')]=qs[_0x7558('0x35')](_[_0x7558('0x40')](_0x549417[_0x7558('0x33')],_0x68aabf[_0x7558('0x35')]));if(_0x549417[_0x7558('0x33')][_0x7558('0x41')]){_0x4a458c[_0x7558('0x3f')]=_[_0x7558('0x42')](_0x4a458c[_0x7558('0x3f')],{'$or':_[_0x7558('0x31')](_0x4a458c['attributes'],function(_0x5eec25){var _0x278f8e={};_0x278f8e[_0x5eec25]={'$like':'%'+_0x549417[_0x7558('0x33')][_0x7558('0x41')]+'%'};return _0x278f8e;})});}if(_0x549417[_0x7558('0x33')][_0x7558('0x60')]){var _0x387179=_0x549417[_0x7558('0x33')][_0x7558('0x60')][_0x7558('0x61')](',');var _0x2413b0={};_0x2413b0[_0x387179[0x0]]={'$gte':moment(_0x387179[0x1])[_0x7558('0x62')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4a458c['where']=_[_0x7558('0x42')](_0x4a458c['where'],_0x2413b0);}_0x4a458c=_[_0x7558('0x42')]({},_0x4a458c,_0x549417[_0x7558('0x44')]);return _0x11192a[_0x7558('0x5f')](_0x4a458c);}})[_0x7558('0x29')](function(_0x3d3d33){if(_0x3d3d33){_0x660182=_0x3d3d33[_0x7558('0x3a')];if(!_0x549417[_0x7558('0x33')][_0x7558('0x3b')]('nolimit')){_0x4a458c[_0x7558('0x22')]=qs[_0x7558('0x22')](_0x549417['query'][_0x7558('0x22')]);_0x4a458c['offset']=qs[_0x7558('0x21')](_0x549417[_0x7558('0x33')][_0x7558('0x21')]);}return _0x11192a[_0x7558('0x5f')](_0x4a458c);}})[_0x7558('0x29')](function(_0x12cb2e){if(_0x12cb2e){return _0x12cb2e?{'count':_0x660182,'rows':_0x12cb2e}:null;}})['then'](respondWithResult(_0x11c7b2,null))[_0x7558('0x50')](handleError(_0x11c7b2,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index c61304d..11d5443 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 _0x7d8d=['hook','exports','events','../../mysqldb','ChatGroup','save','remove','emit','hasOwnProperty'];(function(_0x38c102,_0x48cd17){var _0x14ad4a=function(_0x399e29){while(--_0x399e29){_0x38c102['push'](_0x38c102['shift']());}};_0x14ad4a(++_0x48cd17);}(_0x7d8d,0x134));var _0xd7d8=function(_0x34736e,_0x37b8ae){_0x34736e=_0x34736e-0x0;var _0x4df4e7=_0x7d8d[_0x34736e];return _0x4df4e7;};'use strict';var EventEmitter=require(_0xd7d8('0x0'));var ChatGroup=require(_0xd7d8('0x1'))['db'][_0xd7d8('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd7d8('0x3'),'afterUpdate':'update','afterDestroy':_0xd7d8('0x4')};function emitEvent(_0x12de2f){return function(_0xb37a2b,_0x443200,_0x4a2da3){ChatGroupEvents[_0xd7d8('0x5')](_0x12de2f+':'+_0xb37a2b['id'],_0xb37a2b);ChatGroupEvents[_0xd7d8('0x5')](_0x12de2f,_0xb37a2b);_0x4a2da3(null);};}for(var e in events){if(events[_0xd7d8('0x6')](e)){var event=events[e];ChatGroup[_0xd7d8('0x7')](e,emitEvent(event));}}module[_0xd7d8('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0xf23e=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x17b2ab,_0x43a8dd){var _0x242a20=function(_0x3f0fe1){while(--_0x3f0fe1){_0x17b2ab['push'](_0x17b2ab['shift']());}};_0x242a20(++_0x43a8dd);}(_0xf23e,0xd2));var _0xef23=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0xf23e[_0x1a72f3];return _0x57ef47;};'use strict';var EventEmitter=require(_0xef23('0x0'));var ChatGroup=require(_0xef23('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xef23('0x2')](0x0);var events={'afterCreate':_0xef23('0x3'),'afterUpdate':_0xef23('0x4'),'afterDestroy':_0xef23('0x5')};function emitEvent(_0x48a4e6){return function(_0x4a747a,_0x3a8cb1,_0x36c0c5){ChatGroupEvents[_0xef23('0x6')](_0x48a4e6+':'+_0x4a747a['id'],_0x4a747a);ChatGroupEvents[_0xef23('0x6')](_0x48a4e6,_0x4a747a);_0x36c0c5(null);};}for(var e in events){if(events[_0xef23('0x7')](e)){var event=events[e];ChatGroup[_0xef23('0x8')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index d44c8d6..990f075 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 _0x4a10=['lodash','../../config/logger','api','moment','bluebird','path','./chatGroup.attributes','exports','define','chat_groups'];(function(_0x3f1f0f,_0x1e5798){var _0x4e467a=function(_0x219446){while(--_0x219446){_0x3f1f0f['push'](_0x3f1f0f['shift']());}};_0x4e467a(++_0x1e5798);}(_0x4a10,0xc8));var _0x04a1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4a10[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x04a1('0x0'));var util=require('util');var logger=require(_0x04a1('0x1'))(_0x04a1('0x2'));var moment=require(_0x04a1('0x3'));var BPromise=require(_0x04a1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x04a1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x04a1('0x6'));module[_0x04a1('0x7')]=function(_0x108f55,_0x329991){return _0x108f55[_0x04a1('0x8')]('ChatGroup',attributes,{'tableName':_0x04a1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc95=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatGroup','chat_groups','util','../../config/logger','api','moment'];(function(_0x59ed8c,_0x497c0f){var _0x2ae760=function(_0x5e0c08){while(--_0x5e0c08){_0x59ed8c['push'](_0x59ed8c['shift']());}};_0x2ae760(++_0x497c0f);}(_0xcc95,0x10d));var _0x5cc9=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0xcc95[_0x4b174a];return _0x3cd7bf;};'use strict';var _=require('lodash');var util=require(_0x5cc9('0x0'));var logger=require(_0x5cc9('0x1'))(_0x5cc9('0x2'));var moment=require(_0x5cc9('0x3'));var BPromise=require(_0x5cc9('0x4'));var rp=require(_0x5cc9('0x5'));var fs=require('fs');var path=require(_0x5cc9('0x6'));var rimraf=require(_0x5cc9('0x7'));var config=require(_0x5cc9('0x8'));var attributes=require('./chatGroup.attributes');module[_0x5cc9('0x9')]=function(_0x3a5e73,_0x34068b){return _0x3a5e73[_0x5cc9('0xa')](_0x5cc9('0xb'),attributes,{'tableName':_0x5cc9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index f5c42bd..1e1f043 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 _0x6737=['info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','socket.io-emitter','./chatGroup.socket','register','then'];(function(_0x34986e,_0x12f718){var _0x115ef9=function(_0x519bd6){while(--_0x519bd6){_0x34986e['push'](_0x34986e['shift']());}};_0x115ef9(++_0x12f718);}(_0x6737,0xe2));var _0x7673=function(_0xc866fc,_0x203d1b){_0xc866fc=_0xc866fc-0x0;var _0x55bfbe=_0x6737[_0xc866fc];return _0x55bfbe;};'use strict';var _=require('lodash');var util=require(_0x7673('0x0'));var moment=require(_0x7673('0x1'));var BPromise=require('bluebird');var rs=require(_0x7673('0x2'));var fs=require('fs');var Redis=require(_0x7673('0x3'));var db=require(_0x7673('0x4'))['db'];var utils=require(_0x7673('0x5'));var logger=require('../../config/logger')(_0x7673('0x6'));var config=require(_0x7673('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7673('0x8')][_0x7673('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7673('0xa'))(new Redis(config['redis']));require(_0x7673('0xb'))[_0x7673('0xc')](socket);function respondWithRpcPromise(_0x5bfae2,_0x29fdbc,_0x331f57){return new BPromise(function(_0x35c1b3,_0x4d40ce){return client['request'](_0x5bfae2,_0x331f57)[_0x7673('0xd')](function(_0x571b87){logger[_0x7673('0xe')](_0x7673('0xf'),_0x29fdbc,_0x7673('0x10'));logger[_0x7673('0x11')](_0x7673('0x12'),_0x29fdbc,_0x7673('0x10'),JSON[_0x7673('0x13')](_0x571b87));if(_0x571b87[_0x7673('0x14')]){if(_0x571b87[_0x7673('0x14')][_0x7673('0x15')]===0x1f4){logger['error'](_0x7673('0xf'),_0x29fdbc,_0x571b87[_0x7673('0x14')][_0x7673('0x16')]);return _0x4d40ce(_0x571b87[_0x7673('0x14')][_0x7673('0x16')]);}logger[_0x7673('0x14')](_0x7673('0xf'),_0x29fdbc,_0x571b87['error']['message']);return _0x35c1b3(_0x571b87[_0x7673('0x14')][_0x7673('0x16')]);}else{logger['info'](_0x7673('0xf'),_0x29fdbc,_0x7673('0x10'));_0x35c1b3(_0x571b87['result'][_0x7673('0x16')]);}})[_0x7673('0x17')](function(_0x1015ba){logger['error']('ChatGroup,\x20%s,\x20%s',_0x29fdbc,_0x1015ba);_0x4d40ce(_0x1015ba);});});} \ No newline at end of file +var _0xaa19=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatGroup.socket','register','then','request\x20sent','debug','stringify','error','message','ChatGroup,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xaa19,0x79));var _0x9aa1=function(_0x2ed115,_0x5877d6){_0x2ed115=_0x2ed115-0x0;var _0x73d26f=_0xaa19[_0x2ed115];return _0x73d26f;};'use strict';var _=require(_0x9aa1('0x0'));var util=require(_0x9aa1('0x1'));var moment=require(_0x9aa1('0x2'));var BPromise=require(_0x9aa1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9aa1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9aa1('0x5'));var logger=require('../../config/logger')(_0x9aa1('0x6'));var config=require(_0x9aa1('0x7'));var jayson=require(_0x9aa1('0x8'));var client=jayson['client'][_0x9aa1('0x9')]({'port':0x232a});config[_0x9aa1('0xa')]=_[_0x9aa1('0xb')](config['redis'],{'host':_0x9aa1('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9aa1('0xd'))[_0x9aa1('0xe')](socket);function respondWithRpcPromise(_0x458c96,_0x3cd39b,_0x48448b){return new BPromise(function(_0x5e76cc,_0x1c31c3){return client['request'](_0x458c96,_0x48448b)[_0x9aa1('0xf')](function(_0x4b3352){logger['info']('ChatGroup,\x20%s,\x20%s',_0x3cd39b,_0x9aa1('0x10'));logger[_0x9aa1('0x11')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x3cd39b,_0x9aa1('0x10'),JSON[_0x9aa1('0x12')](_0x4b3352));if(_0x4b3352[_0x9aa1('0x13')]){if(_0x4b3352['error']['code']===0x1f4){logger[_0x9aa1('0x13')]('ChatGroup,\x20%s,\x20%s',_0x3cd39b,_0x4b3352[_0x9aa1('0x13')]['message']);return _0x1c31c3(_0x4b3352[_0x9aa1('0x13')][_0x9aa1('0x14')]);}logger[_0x9aa1('0x13')](_0x9aa1('0x15'),_0x3cd39b,_0x4b3352['error']['message']);return _0x5e76cc(_0x4b3352[_0x9aa1('0x13')][_0x9aa1('0x14')]);}else{logger[_0x9aa1('0x16')](_0x9aa1('0x15'),_0x3cd39b,_0x9aa1('0x10'));_0x5e76cc(_0x4b3352[_0x9aa1('0x17')][_0x9aa1('0x14')]);}})[_0x9aa1('0x18')](function(_0x356201){logger[_0x9aa1('0x13')](_0x9aa1('0x15'),_0x3cd39b,_0x356201);_0x1c31c3(_0x356201);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index cfccaa1..cd357b1 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 _0x148a=['length','./chatGroup.events','removeListener','register'];(function(_0x28dbf0,_0x99c79b){var _0x45bc21=function(_0x1def22){while(--_0x1def22){_0x28dbf0['push'](_0x28dbf0['shift']());}};_0x45bc21(++_0x99c79b);}(_0x148a,0x91));var _0xa148=function(_0x2aaf51,_0x2dbb49){_0x2aaf51=_0x2aaf51-0x0;var _0xbafd19=_0x148a[_0x2aaf51];return _0xbafd19;};'use strict';var ChatGroupEvents=require(_0xa148('0x0'));var events=['save','remove','update'];function createListener(_0xd3b940,_0x5af152){return function(_0x40667d){_0x5af152['emit'](_0xd3b940,_0x40667d);};}function removeListener(_0x2031b2,_0x2ab467){return function(){ChatGroupEvents[_0xa148('0x1')](_0x2031b2,_0x2ab467);};}exports[_0xa148('0x2')]=function(_0x590567){for(var _0x55cc93=0x0,_0xd6431a=events[_0xa148('0x3')];_0x55cc93<_0xd6431a;_0x55cc93++){var _0x5ea3d2=events[_0x55cc93];var _0x106997=createListener('chatGroup:'+_0x5ea3d2,_0x590567);ChatGroupEvents['on'](_0x5ea3d2,_0x106997);}}; \ No newline at end of file +var _0x2422=['chatGroup:','./chatGroup.events','save','remove','update','emit'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x2422,0x18d));var _0x2242=function(_0x3b2044,_0x10a5a6){_0x3b2044=_0x3b2044-0x0;var _0x484ab8=_0x2422[_0x3b2044];return _0x484ab8;};'use strict';var ChatGroupEvents=require(_0x2242('0x0'));var events=[_0x2242('0x1'),_0x2242('0x2'),_0x2242('0x3')];function createListener(_0x18e70b,_0x4108e5){return function(_0x232623){_0x4108e5[_0x2242('0x4')](_0x18e70b,_0x232623);};}function removeListener(_0x2e29be,_0x1362d5){return function(){ChatGroupEvents['removeListener'](_0x2e29be,_0x1362d5);};}exports['register']=function(_0x23779f){for(var _0x3ac895=0x0,_0x452000=events['length'];_0x3ac895<_0x452000;_0x3ac895++){var _0xef89e6=events[_0x3ac895];var _0x4954d6=createListener(_0x2242('0x5')+_0xef89e6,_0x23779f);ChatGroupEvents['on'](_0xef89e6,_0x4954d6);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 7a27ac6..122e7dc 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 _0xd94d=['/:id/members','getMembers','/:id/messages','post','addMessage','put','/:id','update','delete','destroy','removeMembers','exports','util','path','express','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id/unread','getUnread'];(function(_0x1a3cc7,_0x2900e3){var _0x338438=function(_0x5a4872){while(--_0x5a4872){_0x1a3cc7['push'](_0x1a3cc7['shift']());}};_0x338438(++_0x2900e3);}(_0xd94d,0x151));var _0xdd94=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd94d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xdd94('0x0'));var path=require(_0xdd94('0x1'));var timeout=require('connect-timeout');var express=require(_0xdd94('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdd94('0x3'));var config=require(_0xdd94('0x4'));var controller=require(_0xdd94('0x5'));router[_0xdd94('0x6')]('/',auth[_0xdd94('0x7')](),controller[_0xdd94('0x8')]);router[_0xdd94('0x6')](_0xdd94('0x9'),auth[_0xdd94('0x7')](),controller[_0xdd94('0xa')]);router['get']('/:id',auth[_0xdd94('0x7')](),controller['show']);router['get'](_0xdd94('0xb'),auth[_0xdd94('0x7')](),controller[_0xdd94('0xc')]);router[_0xdd94('0x6')](_0xdd94('0xd'),auth[_0xdd94('0x7')](),controller[_0xdd94('0xe')]);router[_0xdd94('0x6')](_0xdd94('0xf'),auth[_0xdd94('0x7')](),controller['getMessages']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xdd94('0x10')](_0xdd94('0xd'),auth[_0xdd94('0x7')](),controller['addMembers']);router[_0xdd94('0x10')]('/:id/messages',auth['isAuthenticated'](),controller[_0xdd94('0x11')]);router[_0xdd94('0x12')](_0xdd94('0x13'),auth[_0xdd94('0x7')](),controller[_0xdd94('0x14')]);router[_0xdd94('0x15')](_0xdd94('0x13'),auth[_0xdd94('0x7')](),controller[_0xdd94('0x16')]);router[_0xdd94('0x15')](_0xdd94('0xd'),auth[_0xdd94('0x7')](),controller[_0xdd94('0x17')]);module[_0xdd94('0x18')]=router; \ No newline at end of file +var _0x08eb=['get','isAuthenticated','describe','/:id','show','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','put','update','destroy','delete','removeMembers','multer','util','path','connect-timeout','Router','../../components/interaction/service','./chatGroup.controller'];(function(_0x11f541,_0x287622){var _0xc9be7d=function(_0x4a54b9){while(--_0x4a54b9){_0x11f541['push'](_0x11f541['shift']());}};_0xc9be7d(++_0x287622);}(_0x08eb,0x8f));var _0xb08e=function(_0x2f0224,_0x1ee67d){_0x2f0224=_0x2f0224-0x0;var _0x1ec93d=_0x08eb[_0x2f0224];return _0x1ec93d;};'use strict';var multer=require(_0xb08e('0x0'));var util=require(_0xb08e('0x1'));var path=require(_0xb08e('0x2'));var timeout=require(_0xb08e('0x3'));var express=require('express');var router=express[_0xb08e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb08e('0x5'));var config=require('../../config/environment');var controller=require(_0xb08e('0x6'));router[_0xb08e('0x7')]('/',auth[_0xb08e('0x8')](),controller['index']);router[_0xb08e('0x7')]('/describe',auth[_0xb08e('0x8')](),controller[_0xb08e('0x9')]);router[_0xb08e('0x7')](_0xb08e('0xa'),auth[_0xb08e('0x8')](),controller[_0xb08e('0xb')]);router['get']('/:id/unread',auth[_0xb08e('0x8')](),controller[_0xb08e('0xc')]);router[_0xb08e('0x7')](_0xb08e('0xd'),auth[_0xb08e('0x8')](),controller[_0xb08e('0xe')]);router[_0xb08e('0x7')](_0xb08e('0xf'),auth[_0xb08e('0x8')](),controller[_0xb08e('0x10')]);router[_0xb08e('0x11')]('/',auth['isAuthenticated'](),controller[_0xb08e('0x12')]);router[_0xb08e('0x11')](_0xb08e('0xd'),auth[_0xb08e('0x8')](),controller[_0xb08e('0x13')]);router[_0xb08e('0x11')](_0xb08e('0xf'),auth[_0xb08e('0x8')](),controller['addMessage']);router[_0xb08e('0x14')](_0xb08e('0xa'),auth[_0xb08e('0x8')](),controller[_0xb08e('0x15')]);router['delete'](_0xb08e('0xa'),auth[_0xb08e('0x8')](),controller[_0xb08e('0x16')]);router[_0xb08e('0x17')](_0xb08e('0xd'),auth[_0xb08e('0x8')](),controller[_0xb08e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index fc516ab..c5e59e1 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 _0x3ee7=['exports','ENUM','thumb','star','TEXT','STRING','DATE','long'];(function(_0x1672a9,_0x19b36a){var _0x36ebaf=function(_0x711273){while(--_0x711273){_0x1672a9['push'](_0x1672a9['shift']());}};_0x36ebaf(++_0x19b36a);}(_0x3ee7,0x98));var _0x73ee=function(_0x2db65c,_0x5bfc65){_0x2db65c=_0x2db65c-0x0;var _0x57ebb2=_0x3ee7[_0x2db65c];return _0x57ebb2;};'use strict';var Sequelize=require('sequelize');module[_0x73ee('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x73ee('0x1')]('star',_0x73ee('0x2')),'defaultValue':_0x73ee('0x3')},'ratingMessage':{'type':Sequelize[_0x73ee('0x4')]},'pathTranscript':{'type':Sequelize[_0x73ee('0x4')]},'mailTranscript':{'type':Sequelize[_0x73ee('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x73ee('0x6')]},'disposition':{'type':Sequelize[_0x73ee('0x5')]},'secondDisposition':{'type':Sequelize[_0x73ee('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x73ee('0x5')]},'browserName':{'type':Sequelize[_0x73ee('0x5')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x73ee('0x5')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x73ee('0x5')]},'deviceVendor':{'type':Sequelize[_0x73ee('0x5')]},'deviceType':{'type':Sequelize[_0x73ee('0x5')]},'referer':{'type':Sequelize[_0x73ee('0x4')]},'customerIp':{'type':Sequelize[_0x73ee('0x5')]},'formData':{'type':Sequelize['TEXT'](_0x73ee('0x7'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x73ee('0x1')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x73ee('0x5')]},'customerPort':{'type':Sequelize[_0x73ee('0x5')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xbc87=['sequelize','INTEGER','ENUM','star','TEXT','STRING','DATE','long','out'];(function(_0x20574e,_0x39ddd2){var _0x4b06f1=function(_0x3a348b){while(--_0x3a348b){_0x20574e['push'](_0x20574e['shift']());}};_0x4b06f1(++_0x39ddd2);}(_0xbc87,0x144));var _0x7bc8=function(_0x3db622,_0x32953f){_0x3db622=_0x3db622-0x0;var _0xf6f42d=_0xbc87[_0x3db622];return _0xf6f42d;};'use strict';var Sequelize=require(_0x7bc8('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x7bc8('0x1')]},'ratingType':{'type':Sequelize[_0x7bc8('0x2')](_0x7bc8('0x3'),'thumb'),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x7bc8('0x4')]},'pathTranscript':{'type':Sequelize[_0x7bc8('0x4')]},'mailTranscript':{'type':Sequelize[_0x7bc8('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x7bc8('0x6')]},'disposition':{'type':Sequelize[_0x7bc8('0x5')]},'secondDisposition':{'type':Sequelize[_0x7bc8('0x5')]},'thirdDisposition':{'type':Sequelize[_0x7bc8('0x5')]},'note':{'type':Sequelize[_0x7bc8('0x5')]},'browserName':{'type':Sequelize[_0x7bc8('0x5')]},'browserVersion':{'type':Sequelize[_0x7bc8('0x5')]},'osName':{'type':Sequelize[_0x7bc8('0x5')]},'osVersion':{'type':Sequelize[_0x7bc8('0x5')]},'deviceModel':{'type':Sequelize[_0x7bc8('0x5')]},'deviceVendor':{'type':Sequelize[_0x7bc8('0x5')]},'deviceType':{'type':Sequelize[_0x7bc8('0x5')]},'referer':{'type':Sequelize[_0x7bc8('0x4')]},'customerIp':{'type':Sequelize[_0x7bc8('0x5')]},'formData':{'type':Sequelize['TEXT'](_0x7bc8('0x7'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x7bc8('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x7bc8('0x2')]('in',_0x7bc8('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x7bc8('0x5')]},'customerPort':{'type':Sequelize[_0x7bc8('0x5')]},'vidaooSessionId':{'type':Sequelize[_0x7bc8('0x4')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 9d87b44..c0662d2 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 _0xda2d=['update','destroy','name','send','render','merge','agent','interaction','account','Users','map','Tags','split','forEach','TagIds','index','ChatInteraction','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','nolimit','order','sort','filters','pick','field','color','tools_tags','select','u.id','u.fullname','from','user_has_chat_interactions','left_join','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','start','body','some','compact','where','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','toString','sequelize','keyBy','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','ChatInteractionId','push','show','params','include','options','create','describe','findOne','ChatWebsiteId','vidaooEscalation','vidaooTopic','vidaooApiKey','fullname','email','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow','vidaooMetadata','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','CmContact','abandon','Interaction\x20already\x20assigned','disposition','attachmentUpload','file','filename','mimetype','attachmentDownload','closed','Unauthorized','attachId','ChatOfflineMessageId','join','offline-chat/','basename','download','close','mailTranscript','root','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','Messages','ChatWebsite','format','%s%d','agentAlias','customer','Visitor','website_alias','UserId','System','agent_alias','alias','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','getMyMessages','addTags','setTags','findAll','chatInteractionTags:save','removeTags','unix','server','tmp','files','attachments','firstName','lastName','Attachment','Account','Owner','get','Chat','N.A.','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','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','end','status','json','offset','undefined','limit','count','set','reject','save'];(function(_0xf9431c,_0x4754b5){var _0x53fc33=function(_0x50ac6c){while(--_0x50ac6c){_0xf9431c['push'](_0xf9431c['shift']());}};_0x53fc33(++_0x4754b5);}(_0xda2d,0x102));var _0xdda2=function(_0x13bb01,_0x35c93f){_0x13bb01=_0x13bb01-0x0;var _0x12677f=_0xda2d[_0x13bb01];return _0x12677f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdda2('0x0'));var zipdir=require(_0xdda2('0x1'));var jsonpatch=require(_0xdda2('0x2'));var rp=require(_0xdda2('0x3'));var moment=require(_0xdda2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xdda2('0x5'));var sox=require(_0xdda2('0x6'));var csv=require(_0xdda2('0x7'));var ejs=require(_0xdda2('0x8'));var fs=require('fs');var fs_extra=require(_0xdda2('0x9'));var _=require(_0xdda2('0xa'));var squel=require(_0xdda2('0xb'));var crypto=require(_0xdda2('0xc'));var jsforce=require(_0xdda2('0xd'));var deskjs=require(_0xdda2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdda2('0xf'));var Papa=require(_0xdda2('0x10'));var Redis=require('ioredis');var authService=require(_0xdda2('0x11'));var qs=require(_0xdda2('0x12'));var as=require(_0xdda2('0x13'));var pdf=require(_0xdda2('0x14'));var hardwareService=require(_0xdda2('0x15'));var logger=require(_0xdda2('0x16'))(_0xdda2('0x17'));var utils=require(_0xdda2('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xdda2('0x19')]=_[_0xdda2('0x1a')](config[_0xdda2('0x19')],{'host':_0xdda2('0x1b'),'port':0x18eb});var socket=require(_0xdda2('0x1c'))(new Redis(config[_0xdda2('0x19')]));require(_0xdda2('0x1d'))['register'](socket);var jayson=require(_0xdda2('0x1e'));var client=jayson['client'][_0xdda2('0x1f')]({'port':0x232b});var client9004=jayson[_0xdda2('0x20')][_0xdda2('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x457764,_0x1922b1,_0x5d8a83,_0x55d674){return new BPromise(function(_0x43f67b,_0x518c6d){var _0x1a5192=_0x55d674||client;return _0x1a5192[_0xdda2('0x21')](_0x457764,_0x5d8a83)[_0xdda2('0x22')](function(_0x2b6ee8){logger[_0xdda2('0x23')](_0xdda2('0x24'),_0x1922b1,_0xdda2('0x25'));logger[_0xdda2('0x26')](_0xdda2('0x27'),_0x1922b1,_0xdda2('0x25'),JSON[_0xdda2('0x28')](_0x2b6ee8));if(_0x2b6ee8[_0xdda2('0x29')]){if(_0x2b6ee8['error'][_0xdda2('0x2a')]===0x1f4){logger['error'](_0xdda2('0x24'),_0x1922b1,_0x2b6ee8[_0xdda2('0x29')][_0xdda2('0x2b')]);return _0x518c6d(_0x2b6ee8['error'][_0xdda2('0x2b')]);}logger['error'](_0xdda2('0x24'),_0x1922b1,_0x2b6ee8[_0xdda2('0x29')]['message']);return _0x43f67b(_0x2b6ee8[_0xdda2('0x29')][_0xdda2('0x2b')]);}else{logger[_0xdda2('0x23')](_0xdda2('0x24'),_0x1922b1,_0xdda2('0x25'));_0x43f67b(_0x2b6ee8['result'][_0xdda2('0x2b')]);}})[_0xdda2('0x2c')](function(_0x2391a5){logger[_0xdda2('0x29')]('ChatInteraction,\x20%s,\x20%s',_0x1922b1,_0x2391a5);_0x518c6d(_0x2391a5);});});}function respondWithStatusCode(_0x4e97dc,_0x28da54){_0x28da54=_0x28da54||0xcc;return function(_0x4567e7){if(_0x4567e7){return _0x4e97dc[_0xdda2('0x2d')](_0x28da54);}return _0x4e97dc['status'](_0x28da54)[_0xdda2('0x2e')]();};}function respondWithResult(_0x5d26ae,_0x2e755b){_0x2e755b=_0x2e755b||0xc8;return function(_0xe53dee){if(_0xe53dee){return _0x5d26ae[_0xdda2('0x2f')](_0x2e755b)[_0xdda2('0x30')](_0xe53dee);}};}function respondWithFilteredResult(_0x4bb8a4,_0x24c37d){return function(_0x255bbc){if(_0x255bbc){var _0x53acb5=typeof _0x24c37d[_0xdda2('0x31')]===_0xdda2('0x32')&&typeof _0x24c37d[_0xdda2('0x33')]===_0xdda2('0x32');var _0x5540e5=_0x255bbc[_0xdda2('0x34')];var _0x5e107f=_0x53acb5?0x0:_0x24c37d['offset'];var _0x1ca9f3=_0x53acb5?_0x255bbc['count']:_0x24c37d[_0xdda2('0x31')]+_0x24c37d['limit'];var _0x53ff76;if(_0x1ca9f3>=_0x5540e5){_0x1ca9f3=_0x5540e5;_0x53ff76=0xc8;}else{_0x53ff76=0xce;}_0x4bb8a4['status'](_0x53ff76);return _0x4bb8a4[_0xdda2('0x35')]('Content-Range',_0x5e107f+'-'+_0x1ca9f3+'/'+_0x5540e5)[_0xdda2('0x30')](_0x255bbc);}return null;};}function patchUpdates(_0x508664){return function(_0x5cba58){try{jsonpatch['apply'](_0x5cba58,_0x508664,!![]);}catch(_0x4637c1){return BPromise[_0xdda2('0x36')](_0x4637c1);}return _0x5cba58[_0xdda2('0x37')]();};}function saveUpdates(_0x2fd592,_0x12e96d){return function(_0x644a24){if(_0x644a24){return _0x644a24[_0xdda2('0x38')](_0x2fd592)[_0xdda2('0x22')](function(_0x3cddbd){return _0x3cddbd;});}return null;};}function removeEntity(_0x2bcf47,_0x4a32ea){return function(_0x461621){if(_0x461621){return _0x461621[_0xdda2('0x39')]()[_0xdda2('0x22')](function(){_0x2bcf47[_0xdda2('0x2f')](0xcc)[_0xdda2('0x2e')]();});}};}function handleEntityNotFound(_0x33c4b0,_0x45d3ad){return function(_0x5835cd){if(!_0x5835cd){_0x33c4b0['sendStatus'](0x194);}return _0x5835cd;};}function handleError(_0xa03f5,_0x1cf553){_0x1cf553=_0x1cf553||0x1f4;return function(_0x40eb19){logger['error'](_0x40eb19['stack']);if(_0x40eb19[_0xdda2('0x3a')]){delete _0x40eb19[_0xdda2('0x3a')];}_0xa03f5[_0xdda2('0x2f')](_0x1cf553)[_0xdda2('0x3b')](_0x40eb19);};}function getMustacheRender(_0x246001,_0x5ab419){return Mustache[_0xdda2('0x3c')](_0x246001,_[_0xdda2('0x3d')](_0x5ab419['body'],{'contact':_0x5ab419['contact'],'message':_0x5ab419[_0xdda2('0x2b')],'agent':_0x5ab419[_0xdda2('0x3e')],'interaction':_0x5ab419[_0xdda2('0x3f')],'account':_0x5ab419[_0xdda2('0x40')]}))||'';}function getInteractionUsers(_0x20969d,_0x585eba){return new BPromise(function(_0x2e7847,_0x226de2){try{if(_0x585eba[_0x20969d['id']]){_0x20969d[_0xdda2('0x41')]=_[_0xdda2('0x42')](_0x585eba[_0x20969d['id']],function(_0x50c4ae){return{'id':_0x50c4ae['id'],'fullname':_0x50c4ae['fullname']};});}}catch(_0x203972){_0x226de2(_0x203972);}_0x2e7847(_0x20969d);});}function getInteractionTags(_0x2e0524,_0x7a25fe){return new BPromise(function(_0x5a92e9,_0x1bb2a7){try{if(_0x2e0524['TagIds']){_0x2e0524[_0xdda2('0x43')]=[];_0x2e0524['TagIds'][_0xdda2('0x44')](',')[_0xdda2('0x45')](function(_0x1db762){_0x2e0524[_0xdda2('0x43')]['push'](_0x7a25fe[_0x1db762]);});}delete _0x2e0524[_0xdda2('0x46')];}catch(_0x574f8f){_0x1bb2a7(_0x574f8f);}_0x5a92e9(_0x2e0524);});}function updateChatInteraction(_0x392f70,_0x4d3b78,_0x1d1678){return new BPromise(function(_0x12589b,_0x153acf){return getInteractionUsers(_0x392f70,_0x1d1678)[_0xdda2('0x22')](function(_0x38dc03){return getInteractionTags(_0x38dc03,_0x4d3b78);})['then'](function(_0x1e29dc){_0x12589b(_0x1e29dc);})[_0xdda2('0x2c')](function(_0x54735b){_0x153acf(_0x54735b);});});}exports[_0xdda2('0x47')]=function(_0x546847,_0x292e70){var _0x45c802={},_0x1741a0={},_0x355b6a={'count':0x0,'rows':[]};var _0x3f1f9b=_[_0xdda2('0x42')](db[_0xdda2('0x48')][_0xdda2('0x49')],function(_0xff55){return{'name':_0xff55[_0xdda2('0x4a')],'type':_0xff55[_0xdda2('0x4b')][_0xdda2('0x4c')]};});_0x1741a0[_0xdda2('0x4d')]=_['map'](_0x3f1f9b,'name');_0x1741a0['query']=_[_0xdda2('0x4e')](_0x546847[_0xdda2('0x4f')]);_0x1741a0['filters']=_[_0xdda2('0x50')](_0x1741a0[_0xdda2('0x4d')],_0x1741a0[_0xdda2('0x4f')]);_0x45c802['attributes']=_[_0xdda2('0x50')](_0x1741a0[_0xdda2('0x4d')],qs['fields'](_0x546847['query'][_0xdda2('0x51')]));_0x45c802['attributes']=_0x45c802[_0xdda2('0x52')]['length']?_0x45c802[_0xdda2('0x52')]:_0x1741a0[_0xdda2('0x4d')];if(!_0x546847['query']['hasOwnProperty'](_0xdda2('0x53'))){_0x45c802[_0xdda2('0x33')]=qs[_0xdda2('0x33')](_0x546847[_0xdda2('0x4f')]['limit']);_0x45c802[_0xdda2('0x31')]=qs[_0xdda2('0x31')](_0x546847[_0xdda2('0x4f')][_0xdda2('0x31')]);}_0x45c802[_0xdda2('0x54')]=qs['sort'](_0x546847[_0xdda2('0x4f')][_0xdda2('0x55')]);_0x45c802['where']=qs[_0xdda2('0x56')](_[_0xdda2('0x57')](_0x546847[_0xdda2('0x4f')],_0x1741a0[_0xdda2('0x56')]),_0x3f1f9b);var _0x161d7b=[];var _0x265169=squel['select']()[_0xdda2('0x58')]('id')['field'](_0xdda2('0x3a'))['field'](_0xdda2('0x59'))['from'](_0xdda2('0x5a'));var _0x11c8b1=squel[_0xdda2('0x5b')]()[_0xdda2('0x58')](_0xdda2('0x5c'))[_0xdda2('0x58')](_0xdda2('0x5d'))[_0xdda2('0x58')]('ui.ChatInteractionId')[_0xdda2('0x5e')](_0xdda2('0x5f'),'ui')[_0xdda2('0x60')]('users','u',_0xdda2('0x61'));var _0x1c2d24=squel['select']()[_0xdda2('0x5e')]('chat_interactions','i')[_0xdda2('0x60')](_0xdda2('0x62'),'c',_0xdda2('0x63'))[_0xdda2('0x60')](_0xdda2('0x64'),'o','o.id\x20=\x20i.UserId')['left_join']('chat_websites','a',_0xdda2('0x65'))[_0xdda2('0x60')]('chat_messages','me',_0xdda2('0x66'))[_0xdda2('0x60')](_0xdda2('0x67'),'it','it.ChatInteractionId\x20=\x20i.id')[_0xdda2('0x60')](_0xdda2('0x5a'),'t',_0xdda2('0x68'));var _0x58ae15=squel[_0xdda2('0x69')]();var _0x4495e5=[];var _0x7eb83f=squel[_0xdda2('0x69')]();var _0x5d8602;if(_0x546847[_0xdda2('0x4f')]['search']){_0x5d8602=as['parseSearch'](_0x546847['query'][_0xdda2('0x6a')]);var _0x35b38a=_0x5d8602[_0xdda2('0x6b')];for(var _0x433cb0=0x0;_0x433cb0<_0x5d8602[_0xdda2('0x6c')][_0xdda2('0x6d')];_0x433cb0++){var _0x29a739=_0x5d8602[_0xdda2('0x6c')][_0x433cb0];var _0x269ad1='i';var _0x138c2f=_[_0xdda2('0x6e')](_0x3f1f9b,['name',_0x29a739[_0xdda2('0x58')]]);if(!_0x138c2f){switch(_0x29a739[_0xdda2('0x58')]){case _0xdda2('0x6f'):if(_0x29a739[_0xdda2('0x70')]==0x1){_0x1c2d24[_0xdda2('0x71')]('`'+_0x29a739[_0xdda2('0x58')]+_0xdda2('0x72'));}else{_0x1c2d24['having']('`'+_0x29a739[_0xdda2('0x58')]+_0xdda2('0x73'));}break;case _0xdda2('0x74'):if(_0x29a739[_0xdda2('0x75')]===_0xdda2('0x76')){if(_0x29a739['value'][_0xdda2('0x44')]('\x20')[_0xdda2('0x6d')]>0x1){_0x58ae15[_0x35b38a](_0xdda2('0x77'),qs[_0xdda2('0x78')](_0x29a739[_0xdda2('0x70')]),null);}else{var _0x4a6f28='%'+_0x29a739[_0xdda2('0x70')]+'%';_0x58ae15[_0x35b38a](_0xdda2('0x79'),_0x4a6f28,_0x4a6f28,_0x4a6f28);}}else{_0x138c2f=_[_0xdda2('0x6e')](_0x3f1f9b,[_0xdda2('0x3a'),_0xdda2('0x7a')]);_0x29a739['field']=_0xdda2('0x7a');_0x27780e=as[_0xdda2('0x7b')](_0x269ad1,_0x138c2f[_0xdda2('0x4b')],_0x29a739);_0x58ae15[_0x35b38a](_0x27780e['text'],_0x27780e[_0xdda2('0x70')]['start'],_0x27780e[_0xdda2('0x70')][_0xdda2('0x2e')]);}break;case _0xdda2('0x7c'):var _0x5c351c=_0x29a739[_0xdda2('0x70')][_0xdda2('0x44')](',')['map'](function(_0x13c0d9){return Number(_0x13c0d9);});_0x5c351c['forEach'](function(_0x3d645b){_0x7eb83f['or'](_0xdda2('0x7d'),'%,'+_0x3d645b+',%');});_0x4495e5=_[_0xdda2('0x7e')](_0x4495e5,_0x5c351c);break;case _0xdda2('0x7f'):if(_0x29a739[_0xdda2('0x75')]==='$substring'){_0x58ae15[_0x35b38a]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x29a739[_0xdda2('0x70')]+'%',null);}else{_0x138c2f=_[_0xdda2('0x6e')](_0x3f1f9b,['name','UserId']);_0x29a739[_0xdda2('0x58')]='UserId';_0x27780e=as[_0xdda2('0x7b')](_0x269ad1,_0x138c2f[_0xdda2('0x4b')],_0x29a739);_0x58ae15[_0x35b38a](_0x27780e['text'],_0x27780e[_0xdda2('0x70')][_0xdda2('0x80')],_0x27780e[_0xdda2('0x70')][_0xdda2('0x2e')]);}break;case _0xdda2('0x81'):_0x27780e=as[_0xdda2('0x7b')]('me',null,_0x29a739);_0x58ae15[_0x35b38a](_0x27780e['text'],_0x27780e[_0xdda2('0x70')][_0xdda2('0x80')],_0x27780e[_0xdda2('0x70')]['end']);break;}}else{var _0x27780e=as[_0xdda2('0x7b')](_0x269ad1,_0x138c2f['type'],_0x29a739);_0x58ae15[_0x35b38a](_0x27780e['text'],_0x27780e[_0xdda2('0x70')][_0xdda2('0x80')],_0x27780e[_0xdda2('0x70')]['end']);}}}else{var _0x585a72=_(_0x546847[_0xdda2('0x4f')])['keys']()[_0xdda2('0x42')](function(_0x150dcd){return _[_0xdda2('0x82')](_0x3f1f9b,[_0xdda2('0x3a'),_0x150dcd])?_0x150dcd:undefined;})[_0xdda2('0x83')]()[_0xdda2('0x70')]();if(!_['isEmpty'](_0x585a72)){_0x585a72['forEach'](function(_0x218b96){if(_0x218b96==='ChatWebsiteId'){_0x1c2d24[_0xdda2('0x84')](_0xdda2('0x85'),[][_0xdda2('0x86')](_0x546847[_0xdda2('0x4f')][_0x218b96]));}else if(_0x218b96===_0xdda2('0x87')){var _0x104024=JSON[_0xdda2('0x88')](_0x546847[_0xdda2('0x4f')][_0x218b96])[_0xdda2('0x89')];var _0x495a28=JSON[_0xdda2('0x88')](_0x546847[_0xdda2('0x4f')][_0x218b96])[_0xdda2('0x8a')];_0x1c2d24[_0xdda2('0x84')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x104024,_0x495a28);}else{if(_0x546847[_0xdda2('0x4f')][_0x218b96]===_0xdda2('0x8b')){_0x1c2d24[_0xdda2('0x84')]('i.'+_0x218b96+_0xdda2('0x8c'));}else{_0x1c2d24['where']('i.'+_0x218b96+'\x20=\x20?',_0x546847[_0xdda2('0x4f')][_0x218b96]);}}});}if(_0x546847[_0xdda2('0x4f')][_0xdda2('0x8d')]){if(_0x546847[_0xdda2('0x4f')]['read']==0x1){_0x1c2d24[_0xdda2('0x71')](_0xdda2('0x8e'));}else{_0x1c2d24[_0xdda2('0x71')](_0xdda2('0x8f'));}}if(_0x546847[_0xdda2('0x4f')][_0xdda2('0x90')]){_0x4495e5=_[_0xdda2('0x91')](_0x546847[_0xdda2('0x4f')][_0xdda2('0x90')])?_0x546847[_0xdda2('0x4f')][_0xdda2('0x90')]:new Array(_0x546847[_0xdda2('0x4f')][_0xdda2('0x90')]);_0x4495e5[_0xdda2('0x45')](function(_0x2411e8){_0x7eb83f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2411e8+',%');});}if(_0x546847[_0xdda2('0x4f')][_0xdda2('0x92')]){var _0x58fcea=_0x546847['query'][_0xdda2('0x92')][_0xdda2('0x93')]('\x5c','\x5c\x5c')[_0xdda2('0x93')](/'/g,'\x27\x27');if(qs[_0xdda2('0x94')](_0x58fcea)){_0x58ae15['or'](_0xdda2('0x95'),_0x58fcea+'%');}else{_0x58ae15['or'](_0xdda2('0x96'),qs['getFullTextValue'](_0x58fcea))['or'](_0xdda2('0x97'),_0x58fcea+'%');}}}_0x1c2d24[_0xdda2('0x84')](_0x58ae15);_0x1c2d24[_0xdda2('0x98')](_0xdda2('0x99'));var _0x563be8={'type':db[_0xdda2('0x9a')]['QueryTypes'][_0xdda2('0x9b')],'raw':!![]};var _0x6b6dad=_0x1c2d24['clone']();_0x6b6dad[_0xdda2('0x58')](_0xdda2('0x99'));_0x6b6dad[_0xdda2('0x58')](_0xdda2('0x9c'),_0xdda2('0x6f'));if(_0x45c802[_0xdda2('0x54')]){_0x45c802[_0xdda2('0x54')][_0xdda2('0x45')](function(_0x3a375d){var _0x3e82bb=_0x3a375d[0x0]===_0xdda2('0x9d')?_0x3a375d[0x0]:'i.'+_0x3a375d[0x0];_0x1c2d24['order'](_0x3e82bb,_0x3a375d[0x1]===_0xdda2('0x9e')?![]:!![]);});}if(!_[_0xdda2('0x9f')](_0x4495e5)){_0x1c2d24[_0xdda2('0x71')](_0x7eb83f);_0x6b6dad[_0xdda2('0x84')](_0xdda2('0xa0'),_0x4495e5);}BPromise['resolve']()[_0xdda2('0x22')](function(){if(!_0x5d8602){if(_0x546847[_0xdda2('0x4f')]['ChatWebsiteId'])return;_0x6b6dad[_0xdda2('0x84')](_0xdda2('0xa1'));_0x1c2d24['where']('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x546847[_0xdda2('0xa2')][_0xdda2('0xa3')]!==_0xdda2('0x3e'))return;return _0x546847[_0xdda2('0xa2')][_0xdda2('0xa4')]({'attributes':['id'],'raw':!![]})[_0xdda2('0x22')](function(_0x525e93){if(_[_0xdda2('0x9f')](_0x525e93)){_0x6b6dad[_0xdda2('0x84')]('i.ChatWebsiteId\x20IS\x20NULL');_0x1c2d24[_0xdda2('0x84')](_0xdda2('0xa5'));}else{_0x6b6dad['where'](_0xdda2('0x85'),_[_0xdda2('0x42')](_0x525e93,'id'));_0x1c2d24[_0xdda2('0x84')]('i.ChatWebsiteId\x20IN\x20?',_[_0xdda2('0x42')](_0x525e93,'id'));}});})['then'](function(){if(_0x546847[_0xdda2('0xa2')][_0xdda2('0xa3')]===_0xdda2('0x3e')&&!_0x5d8602&&!_0x546847[_0xdda2('0x4f')]['ChatWebsiteId'])return[];return db['sequelize'][_0xdda2('0x4f')](_0x6b6dad[_0xdda2('0xa6')](),_0x563be8);})['then'](function(_0x468e32){_0x355b6a[_0xdda2('0x34')]=_0x468e32[_0xdda2('0x6d')];if(_0x355b6a[_0xdda2('0x34')]===0x0)return[];return db[_0xdda2('0xa7')][_0xdda2('0x4f')](_0x265169[_0xdda2('0xa6')](),_0x563be8)[_0xdda2('0x22')](function(_0x3046c1){_0x161d7b=_[_0xdda2('0xa8')](_0x3046c1,'id');_0x563be8=_[_0xdda2('0x3d')](_0x563be8,{'model':db[_0xdda2('0x48')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x546847['query']['fields']){_0x45c802['attributes'][_0xdda2('0x45')](function(_0x4edf20){_0x1c2d24[_0xdda2('0x58')]('i.'+_0x4edf20);});}else{_0x1c2d24[_0xdda2('0x58')](_0xdda2('0x9c'),_0xdda2('0x6f'));_0x1c2d24['field'](_0xdda2('0xa9'),_0xdda2('0xaa'));_0x1c2d24[_0xdda2('0x58')]('a.mandatoryDisposition',_0xdda2('0xab'));_0x1c2d24[_0xdda2('0x58')](_0xdda2('0xac'),'contactName');_0x1c2d24['field'](_0xdda2('0xad'));_0x1c2d24[_0xdda2('0x58')](_0xdda2('0xae'),'Contact.firstName');_0x1c2d24[_0xdda2('0x58')](_0xdda2('0xaf'),_0xdda2('0xb0'));_0x1c2d24[_0xdda2('0x58')](_0xdda2('0xb1'),_0xdda2('0xb2'));_0x1c2d24[_0xdda2('0x58')]('c.phone',_0xdda2('0xb3'));_0x1c2d24[_0xdda2('0x58')](_0xdda2('0xb4'),_0xdda2('0xb5'));_0x1c2d24['field'](_0xdda2('0xb6'),_0xdda2('0xb7'));_0x1c2d24[_0xdda2('0x58')](_0xdda2('0xb8'),'Owner.fullname');_0x1c2d24['field']('o.internal',_0xdda2('0xb9'));_0x1c2d24[_0xdda2('0x58')](_0xdda2('0xba'),_0xdda2('0x46'));}if(_0x45c802[_0xdda2('0x33')])_0x1c2d24[_0xdda2('0x33')](_0x45c802['limit']);if(_0x45c802[_0xdda2('0x31')])_0x1c2d24[_0xdda2('0x31')](_0x45c802[_0xdda2('0x31')]);return db[_0xdda2('0xa7')][_0xdda2('0x4f')](_0x1c2d24[_0xdda2('0xa6')](),_0x563be8);})[_0xdda2('0x22')](function(_0xbfd011){if(_0xbfd011['length']>0x0)_0x11c8b1[_0xdda2('0x84')]('ui.ChatInteractionId\x20IN\x20?',_[_0xdda2('0x42')](_0xbfd011,'id'));return db['sequelize'][_0xdda2('0x4f')](_0x11c8b1['toString'](),_0x563be8)[_0xdda2('0x22')](function(_0x31e555){var _0x329d18=_[_0xdda2('0xbb')](_0x31e555,_0xdda2('0xbc'));var _0x18a102=[];_0xbfd011[_0xdda2('0x45')](function(_0x28ba40){_0x18a102[_0xdda2('0xbd')](updateChatInteraction(_0x28ba40,_0x161d7b,_0x329d18));});return BPromise['all'](_0x18a102);});});})[_0xdda2('0x22')](function(_0x434d79){_0x355b6a['rows']=_0x434d79;return _0x355b6a;})[_0xdda2('0x22')](respondWithFilteredResult(_0x292e70,_0x45c802))[_0xdda2('0x2c')](handleError(_0x292e70,null));};exports[_0xdda2('0xbe')]=function(_0x5600da,_0x1702ae){var _0x21ade3={'raw':![],'where':{'id':_0x5600da[_0xdda2('0xbf')]['id']}},_0x251408={};_0x251408[_0xdda2('0x4d')]=_[_0xdda2('0x4e')](db[_0xdda2('0x48')][_0xdda2('0x49')]);_0x251408[_0xdda2('0x4f')]=_[_0xdda2('0x4e')](_0x5600da['query']);_0x251408[_0xdda2('0x56')]=_[_0xdda2('0x50')](_0x251408[_0xdda2('0x4d')],_0x251408[_0xdda2('0x4f')]);_0x21ade3[_0xdda2('0x52')]=_['intersection'](_0x251408[_0xdda2('0x4d')],qs[_0xdda2('0x51')](_0x5600da[_0xdda2('0x4f')]['fields']));_0x21ade3[_0xdda2('0x52')]=_0x21ade3[_0xdda2('0x52')][_0xdda2('0x6d')]?_0x21ade3['attributes']:_0x251408[_0xdda2('0x4d')];if(_0x5600da['query']['includeAll']){_0x21ade3[_0xdda2('0xc0')]=[{'all':!![]}];}_0x21ade3=_[_0xdda2('0x3d')]({},_0x21ade3,_0x5600da[_0xdda2('0xc1')]);return db[_0xdda2('0x48')][_0xdda2('0x6e')](_0x21ade3)[_0xdda2('0x22')](handleEntityNotFound(_0x1702ae,null))[_0xdda2('0x22')](respondWithResult(_0x1702ae,null))['catch'](handleError(_0x1702ae,null));};exports['create']=function(_0x3aab39,_0x1c1cf6){return db[_0xdda2('0x48')][_0xdda2('0xc2')](_0x3aab39[_0xdda2('0x81')],{})['then'](respondWithResult(_0x1c1cf6,0xc9))[_0xdda2('0x2c')](handleError(_0x1c1cf6,null));};exports[_0xdda2('0x38')]=function(_0x489cda,_0x233494){if(_0x489cda[_0xdda2('0x81')]['id']){delete _0x489cda[_0xdda2('0x81')]['id'];}return db[_0xdda2('0x48')][_0xdda2('0x6e')]({'where':{'id':_0x489cda[_0xdda2('0xbf')]['id']}})[_0xdda2('0x22')](handleEntityNotFound(_0x233494,null))[_0xdda2('0x22')](saveUpdates(_0x489cda[_0xdda2('0x81')],null))[_0xdda2('0x22')](respondWithResult(_0x233494,null))[_0xdda2('0x2c')](handleError(_0x233494,null));};exports[_0xdda2('0x39')]=function(_0x416993,_0x47b7a5){return db[_0xdda2('0x48')]['find']({'where':{'id':_0x416993[_0xdda2('0xbf')]['id']}})[_0xdda2('0x22')](handleEntityNotFound(_0x47b7a5,null))[_0xdda2('0x22')](removeEntity(_0x47b7a5,null))['catch'](handleError(_0x47b7a5,null));};exports[_0xdda2('0xc3')]=function(_0xb93d3b,_0x3d59cb){return db['ChatInteraction'][_0xdda2('0xc3')]()[_0xdda2('0x22')](respondWithResult(_0x3d59cb,null))[_0xdda2('0x2c')](handleError(_0x3d59cb,null));};exports['createVidaooSession']=function(_0x5916cb,_0x123065){var _0x5611a0=_0x5916cb[_0xdda2('0xbf')]['id'];var _0x174eb9;var _0x23b9bd;var _0x182570;return db['ChatInteraction'][_0xdda2('0xc4')]({'where':{'id':_0x5611a0}})['then'](function(_0x5a1e60){_0x174eb9=_0x5a1e60;return db['ChatWebsite']['findOne']({'where':{'id':_0x5a1e60[_0xdda2('0xc5')]},'attributes':['id','vidaooApiKey',_0xdda2('0xc6'),_0xdda2('0xc7'),'vidaooNote','vidaooMetadata'],'raw':!![]});})[_0xdda2('0x22')](function(_0x255853){if(_0x255853&&_0x255853[_0xdda2('0xc8')]&&_0x255853[_0xdda2('0xc6')]){_0x23b9bd=_0x255853;var _0x55d25d={'interaction':{'id':_0x5611a0},'agent':{'id':_0x5916cb['user']['id'],'name':_0x5916cb[_0xdda2('0xa2')][_0xdda2('0x3a')],'fullname':_0x5916cb[_0xdda2('0xa2')][_0xdda2('0xc9')],'email':_0x5916cb['user'][_0xdda2('0xca')]},'contact':_0x5916cb[_0xdda2('0x81')][_0xdda2('0xcb')],'account':_0x5916cb[_0xdda2('0x81')][_0xdda2('0x40')]};var _0x1fdc68={'rejectUnauthorized':![],'method':_0xdda2('0xcc'),'url':_0xdda2('0xcd'),'headers':{'X-APIKEY':_0x255853[_0xdda2('0xc8')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5916cb[_0xdda2('0xa2')][_0xdda2('0xca')]],'buttons':null,'topic':_0x23b9bd[_0xdda2('0xc7')],'note':_[_0xdda2('0xce')](_0x23b9bd[_0xdda2('0xcf')])?null:getMustacheRender(_0x23b9bd[_0xdda2('0xcf')],_0x55d25d),'metadata':null},'redirect':_0xdda2('0xd0'),'json':!![]};try{if(!_['isNull'](_0x23b9bd[_0xdda2('0xd1')])){var _0x1e5460=getMustacheRender(_0x23b9bd[_0xdda2('0xd1')],_0x55d25d);var _0xa386d1=JSON[_0xdda2('0x88')](_0x1e5460);_0x1fdc68[_0xdda2('0x81')][_0xdda2('0xd2')]=_0xa386d1;}}catch(_0x1945bc){throw new db[(_0xdda2('0x9a'))][(_0xdda2('0xd3'))](_0xdda2('0xd4'));}return rp(_0x1fdc68);}else{throw new db[(_0xdda2('0x9a'))][(_0xdda2('0xd3'))](_0xdda2('0xd5'));}})[_0xdda2('0x22')](function(_0x5308f1){_0x182570=_0x5308f1;if(_0x182570['id']){var _0x17c084={'body':_0x182570[_0xdda2('0xd6')],'ChatWebsiteId':_0x23b9bd['id'],'ChatInteractionId':_0x174eb9['id'],'direction':_0xdda2('0xd7'),'UserId':_0x5916cb[_0xdda2('0xa2')]['id']};return db[_0xdda2('0xd8')][_0xdda2('0xc2')](_0x17c084,{});}else{throw new db[(_0xdda2('0x9a'))][(_0xdda2('0xd3'))](_0xdda2('0xd9'));}})[_0xdda2('0x22')](function(){return _0x174eb9['updateAttributes']({'vidaooSessionId':_0x182570['id']});})[_0xdda2('0x22')](respondWithResult(_0x123065,null))['catch'](handleError(_0x123065,null));};exports['customUpdate']=function(_0xfd249a,_0x142e6a){if(_0xfd249a[_0xdda2('0x81')]['id']){delete _0xfd249a[_0xdda2('0x81')]['id'];}return db[_0xdda2('0x48')]['find']({'where':{'id':_0xfd249a[_0xdda2('0xbf')]['id']},'include':[{'model':db[_0xdda2('0xda')],'as':_0xdda2('0x74')}]})[_0xdda2('0x22')](handleEntityNotFound(_0x142e6a,null))[_0xdda2('0x22')](saveUpdates(_0xfd249a[_0xdda2('0x81')],null))[_0xdda2('0x22')](respondWithResult(_0x142e6a,null))[_0xdda2('0x2c')](handleError(_0x142e6a,null));};exports['abandon']=function(_0x5738f9,_0x3795b2,_0x38902f){if(_0x5738f9[_0xdda2('0x81')]['id']){delete _0x5738f9['body']['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x5738f9[_0xdda2('0xbf')]['id']}})[_0xdda2('0x22')](function(_0x253ca6){if(!_0x253ca6){logger[_0xdda2('0x29')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xdda2('0xdb'),0x194,'entity\x20not\x20found');_0x3795b2[_0xdda2('0x2d')](0x194);}else{if(_0x253ca6['UserId']){throw new db[(_0xdda2('0x9a'))][(_0xdda2('0xd3'))](_0xdda2('0xdc'));}}return _0x253ca6;})['then'](function(_0x335dc1){if(_0x335dc1){return _0x335dc1[_0xdda2('0x38')]({'closed':_0x5738f9[_0xdda2('0x81')]['closed'],'disposition':_0x5738f9[_0xdda2('0x81')][_0xdda2('0xdd')]})['then'](function(_0x1ec330){return _0x1ec330;});}})[_0xdda2('0x22')](function(_0x48e6e6){return respondWithRpcPromise('AbandonInteraction','abandon',_0x5738f9[_0xdda2('0x81')],client9004);})['then'](respondWithResult(_0x3795b2,null))['catch'](handleError(_0x3795b2,null));};exports[_0xdda2('0xde')]=function(_0x4444b4,_0x2279f8,_0x40e6a9){_0x4444b4[_0xdda2('0x81')][_0xdda2('0x3a')]=_0x4444b4['file']['originalname'];_0x4444b4[_0xdda2('0x81')]['basename']=_0x4444b4[_0xdda2('0xdf')][_0xdda2('0xe0')];_0x4444b4[_0xdda2('0x81')][_0xdda2('0x4b')]=_0x4444b4[_0xdda2('0xdf')][_0xdda2('0xe1')];return db['Attachment'][_0xdda2('0xc2')](_0x4444b4['body'])[_0xdda2('0x22')](respondWithResult(_0x2279f8,0xc9))[_0xdda2('0x2c')](handleError(_0x2279f8,null));};exports[_0xdda2('0xe2')]=function(_0x245ab5,_0x1001ce,_0x343795){return db[_0xdda2('0x48')][_0xdda2('0xc4')]({'where':{'id':_0x245ab5[_0xdda2('0xbf')]['id']},'raw':!![]})[_0xdda2('0x22')](handleEntityNotFound(_0x1001ce,null))[_0xdda2('0x22')](function(_0x3fb6a2){if(_0x3fb6a2){if(_0x3fb6a2[_0xdda2('0xe3')]){return _0x1001ce[_0xdda2('0x2f')](0x193)[_0xdda2('0x30')]({'status':0x193,'message':_0xdda2('0xe4')});}return db['Attachment'][_0xdda2('0xc4')]({'where':{'id':_0x245ab5[_0xdda2('0x4f')][_0xdda2('0xe5')]},'raw':!![]})[_0xdda2('0x22')](handleEntityNotFound(_0x1001ce,null));}})[_0xdda2('0x22')](function(_0xb42ead){if(_0xb42ead){var _0x29aa4e=_0xb42ead[_0xdda2('0xe6')]!==null;var _0xb38883=path[_0xdda2('0xe7')](config['root'],'server/files/attachments/');if(_0x29aa4e){_0xb38883=path['join'](_0xb38883,_0xdda2('0xe8'));}var _0x447793=path['join'](_0xb38883,_0xb42ead[_0xdda2('0xe9')]);return _0x1001ce[_0xdda2('0xea')](_0x447793);}})[_0xdda2('0x2c')](handleError(_0x1001ce,null));};exports[_0xdda2('0xeb')]=function(_0x105176,_0x1b4d6c){var _0x4aecf6=null;var _0x11d373=null;var _0x5898cf=null;var _0x319929=null;if(_0x105176[_0xdda2('0x81')]['id']){delete _0x105176[_0xdda2('0x81')]['id'];}if(_0x105176['body'][_0xdda2('0xec')]){_0x319929=path[_0xdda2('0xe7')](config[_0xdda2('0xed')],_0xdda2('0xee'),util['format'](_0xdda2('0xef'),Date[_0xdda2('0xf0')]()));_0x105176[_0xdda2('0x81')][_0xdda2('0xf1')]=_0x319929;}return db[_0xdda2('0x48')]['find']({'where':{'id':_0x105176[_0xdda2('0xbf')]['id']},'include':[{'model':db['ChatMessage'],'as':_0xdda2('0xf2'),'include':[{'model':db[_0xdda2('0x7f')],'as':_0xdda2('0x7f')}]}]})['then'](handleEntityNotFound(_0x1b4d6c,null))[_0xdda2('0x22')](saveUpdates(_0x105176[_0xdda2('0x81')],null))[_0xdda2('0x22')](function(_0x1894fc){if(_0x1894fc){_0x4aecf6=_0x1894fc;return db[_0xdda2('0xf3')][_0xdda2('0x6e')]({'where':{'id':_0x4aecf6[_0xdda2('0xc5')]}});}})[_0xdda2('0x22')](function(_0x469635){if(_0x469635){_0x5898cf=_0x469635;return db[_0xdda2('0xda')][_0xdda2('0x6e')]({'where':{'id':_0x4aecf6[_0xdda2('0x7a')]}});}})[_0xdda2('0x22')](function(_0x1d2039){if(_0x1d2039){_0x11d373=_0x1d2039;if(_0x319929){var _0xee0164=null;for(var _0x58fa2a=0x1;_0x58fa2a<_0x4aecf6[_0xdda2('0xf2')]['length'];++_0x58fa2a){_0xee0164=_0x4aecf6[_0xdda2('0xf2')][_0x58fa2a];var _0xbe4ca=_0xee0164['UserId']?util[_0xdda2('0xf4')](_0xdda2('0xf5'),_0x5898cf[_0xdda2('0xf6')],_0xee0164['UserId']):'System';var _0x5c88b4=_0x105176[_0xdda2('0x81')][_0xdda2('0xf7')]||util[_0xdda2('0xf4')]('%s%d',_0xdda2('0xf8'),_0xee0164[_0xdda2('0x7a')]);switch(_0x5898cf['agentIdentifier']){case _0xdda2('0xf9'):_0xbe4ca=_0xee0164[_0xdda2('0xfa')]?util[_0xdda2('0xf4')]('%s%d',_0x5898cf[_0xdda2('0xf6')],_0xee0164[_0xdda2('0xfa')]):_0xdda2('0xfb');break;case _0xdda2('0xfc'):_0xbe4ca=_0xee0164[_0xdda2('0xfa')]?_0xee0164['User'][_0xdda2('0xfd')]||_0xee0164['User'][_0xdda2('0xc9')]:_0xdda2('0xfb');break;case _0xdda2('0xfe'):_0xbe4ca=_0xee0164['UserId']?_0xee0164['User'][_0xdda2('0xc9')]:_0xdda2('0xfb');break;default:_0xbe4ca=_0xee0164[_0xdda2('0xfa')]?util[_0xdda2('0xf4')](_0xdda2('0xf5'),_0x5898cf[_0xdda2('0xf6')],_0xee0164[_0xdda2('0xfa')]):'System';}var _0x2506bb=util[_0xdda2('0xf4')]('[%s]\x20%s:\x20%s\x0a',moment(_0xee0164[_0xdda2('0x87')])[_0xdda2('0xf4')](_0xdda2('0xff')),_0xee0164[_0xdda2('0x100')]==='in'?_0x5c88b4:_0xbe4ca,_0xee0164[_0xdda2('0x81')]);if(!_0xee0164['secret']){fs[_0xdda2('0x101')](_0x319929,_0x2506bb);}}return db[_0xdda2('0x102')][_0xdda2('0xc4')]({'where':{'service':!![]},'include':[{'model':db[_0xdda2('0x103')],'as':_0xdda2('0x104'),'raw':!![]}]});}}})['then'](function(_0x4dcc77){if(_0x4dcc77&&_0x4dcc77[_0xdda2('0x104')]&&_0x105176[_0xdda2('0x81')]){var _0xbcc6b9={'tls':{'rejectUnauthorized':![]}};if(_0x4dcc77[_0xdda2('0x104')]['service']){_0xbcc6b9['service']=_0x4dcc77[_0xdda2('0x104')][_0xdda2('0x105')];}else{_0xbcc6b9[_0xdda2('0x106')]=_0x4dcc77[_0xdda2('0x104')][_0xdda2('0x106')];_0xbcc6b9[_0xdda2('0x107')]=_0x4dcc77[_0xdda2('0x104')]['port'];_0xbcc6b9['secure']=_0x4dcc77[_0xdda2('0x104')][_0xdda2('0x108')];}if(_0x4dcc77['Smtp'][_0xdda2('0x109')]){_0xbcc6b9[_0xdda2('0x10a')]={'user':_0x4dcc77[_0xdda2('0x104')][_0xdda2('0xa2')],'pass':_0x4dcc77['Smtp'][_0xdda2('0x10b')]};}return respondWithRpcPromise(_0xdda2('0x10c'),_0xdda2('0x10d'),{'account':_0xbcc6b9,'message':{'from':util[_0xdda2('0xf4')]('\x22%s\x22\x20<%s>',_0x4dcc77[_0xdda2('0x3a')],_0x4dcc77['email']||_0x4dcc77['Smtp']['user']),'to':_0x105176[_0xdda2('0x81')][_0xdda2('0xec')],'subject':_0xdda2('0x10e'),'text':util[_0xdda2('0xf4')](_0xdda2('0x10f'),_0x105176['body'][_0xdda2('0xec')]),'attachments':[{'path':_0x319929}]}})[_0xdda2('0x22')](function(){return _0x4aecf6;})['catch'](function(_0x202a23){console[_0xdda2('0x29')](_0x202a23);});}else{return _0x4aecf6;}})[_0xdda2('0x22')](respondWithStatusCode(_0x1b4d6c,0xc8))[_0xdda2('0x2c')](handleError(_0x1b4d6c,null));};exports[_0xdda2('0x110')]=function(_0x12a7f4,_0x62b26e,_0x642b33){return db['ChatMessage']['find']({'where':{'id':_0x12a7f4[_0xdda2('0xbf')]['id']}})[_0xdda2('0x22')](handleEntityNotFound(_0x62b26e,null))[_0xdda2('0x22')](function(_0x2139ff){if(_0x2139ff){return _0x2139ff[_0xdda2('0x110')](_0x12a7f4[_0xdda2('0x81')][_0xdda2('0x111')],_[_0xdda2('0x112')](_0x12a7f4[_0xdda2('0x81')],[_0xdda2('0x111'),'id'])||{});}})[_0xdda2('0x22')](respondWithResult(_0x62b26e,null))['catch'](handleError(_0x62b26e,null));};exports[_0xdda2('0x113')]=function(_0x3da9e4,_0x5fa59e,_0x6280b0){var _0x228f40={'raw':![],'where':{}};var _0x27ff5d={};var _0x325be9={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xdda2('0xc4')]({'where':{'id':_0x3da9e4[_0xdda2('0xbf')]['id']}})[_0xdda2('0x22')](handleEntityNotFound(_0x5fa59e,null))[_0xdda2('0x22')](function(_0x11db0f){if(_0x11db0f){_0x27ff5d['model']=_[_0xdda2('0x4e')](db[_0xdda2('0xd8')][_0xdda2('0x49')]);_0x27ff5d[_0xdda2('0x4f')]=_[_0xdda2('0x4e')](_0x3da9e4['query']);_0x27ff5d[_0xdda2('0x56')]=_['intersection'](_0x27ff5d['model'],_0x27ff5d[_0xdda2('0x4f')]);_0x228f40['attributes']=_[_0xdda2('0x50')](_0x27ff5d[_0xdda2('0x4d')],qs[_0xdda2('0x51')](_0x3da9e4[_0xdda2('0x4f')][_0xdda2('0x51')]));_0x228f40[_0xdda2('0x52')]=_0x228f40[_0xdda2('0x52')][_0xdda2('0x6d')]?_0x228f40[_0xdda2('0x52')]:_0x27ff5d[_0xdda2('0x4d')];if(!_0x3da9e4[_0xdda2('0x4f')][_0xdda2('0x114')](_0xdda2('0x53'))){_0x228f40[_0xdda2('0x33')]=qs[_0xdda2('0x33')](_0x3da9e4[_0xdda2('0x4f')]['limit']);_0x228f40['offset']=qs[_0xdda2('0x31')](_0x3da9e4[_0xdda2('0x4f')]['offset']);}_0x228f40[_0xdda2('0x54')]=qs[_0xdda2('0x55')](_0x3da9e4[_0xdda2('0x4f')]['sort']);_0x228f40['where']=qs[_0xdda2('0x56')](_[_0xdda2('0x57')](_0x3da9e4['query'],_0x27ff5d[_0xdda2('0x56')]));_0x228f40[_0xdda2('0x84')][_0xdda2('0xbc')]=_0x11db0f['id'];if(_0x3da9e4[_0xdda2('0x4f')][_0xdda2('0x92')]){_0x228f40[_0xdda2('0x84')]=_[_0xdda2('0x3d')](_0x228f40[_0xdda2('0x84')],{'$or':_[_0xdda2('0x42')](_0x228f40[_0xdda2('0x52')],function(_0x39a334){var _0xeedb00={};_0xeedb00[_0x39a334]={'$like':'%'+_0x3da9e4['query'][_0xdda2('0x92')]+'%'};return _0xeedb00;})});}if(_0x3da9e4['query']['$gte']){var _0x27765b=_0x3da9e4[_0xdda2('0x4f')][_0xdda2('0x89')][_0xdda2('0x44')](',');var _0x4d288d={};_0x4d288d[_0x27765b[0x0]]={'$gte':moment(_0x27765b[0x1])[_0xdda2('0xf4')](_0xdda2('0x115'))};_0x228f40[_0xdda2('0x84')]=_[_0xdda2('0x3d')](_0x228f40['where'],_0x4d288d);}_0x228f40=_['merge']({},_0x228f40,_0x3da9e4[_0xdda2('0xc1')]);return db[_0xdda2('0xd8')][_0xdda2('0x34')]({'where':_0x228f40[_0xdda2('0x84')]})[_0xdda2('0x22')](function(_0x1f8f48){_0x325be9[_0xdda2('0x34')]=_0x1f8f48;if(_0x3da9e4[_0xdda2('0x4f')][_0xdda2('0x116')]){_0x228f40[_0xdda2('0xc0')]=[{'all':!![]}];}return db[_0xdda2('0xd8')]['findAll'](_0x228f40);})[_0xdda2('0x22')](function(_0x4dbada){_0x325be9[_0xdda2('0x117')]=_0x4dbada;return _0x325be9;});}})['then'](respondWithFilteredResult(_0x5fa59e,_0x228f40))[_0xdda2('0x2c')](handleError(_0x5fa59e,null));};exports[_0xdda2('0x118')]=function(_0x25650a,_0x3410ec,_0x59441d){var _0x4948ae={'where':{}},_0x472860={},_0x32564c={'count':0x0,'rows':[]};return db[_0xdda2('0x48')][_0xdda2('0xc4')]({'where':{'id':_0x25650a['params']['id']}})[_0xdda2('0x22')](handleEntityNotFound(_0x3410ec,null))[_0xdda2('0x22')](function(_0x316316){if(_0x316316){_0x472860[_0xdda2('0x4d')]=_[_0xdda2('0x4e')](db[_0xdda2('0xd8')][_0xdda2('0x49')]);_0x472860[_0xdda2('0x4f')]=_[_0xdda2('0x4e')](_0x25650a[_0xdda2('0x4f')]);_0x472860[_0xdda2('0x56')]=_[_0xdda2('0x50')](_0x472860[_0xdda2('0x4d')],_0x472860[_0xdda2('0x4f')]);_0x4948ae['attributes']=_[_0xdda2('0x50')](_0x472860[_0xdda2('0x4d')],qs['fields'](_0x25650a[_0xdda2('0x4f')][_0xdda2('0x51')]));_0x4948ae[_0xdda2('0x52')]=_0x4948ae[_0xdda2('0x52')][_0xdda2('0x6d')]?_0x4948ae[_0xdda2('0x52')]:_0x472860['model'];if(!_0x25650a[_0xdda2('0x4f')][_0xdda2('0x114')](_0xdda2('0x53'))){_0x4948ae['limit']=qs[_0xdda2('0x33')](_0x25650a[_0xdda2('0x4f')][_0xdda2('0x33')]);_0x4948ae[_0xdda2('0x31')]=qs['offset'](_0x25650a['query']['offset']);}_0x4948ae[_0xdda2('0x54')]=qs[_0xdda2('0x55')](_0x25650a[_0xdda2('0x4f')][_0xdda2('0x55')]);_0x4948ae['where']=qs[_0xdda2('0x56')](_[_0xdda2('0x57')](_0x25650a['query'],_0x472860[_0xdda2('0x56')]));_0x4948ae[_0xdda2('0x84')]['ChatInteractionId']=_0x316316['id'];if(_0x25650a[_0xdda2('0x4f')]['filter']){_0x4948ae[_0xdda2('0x84')]=_[_0xdda2('0x3d')](_0x4948ae['where'],{'$or':_[_0xdda2('0x42')](_0x4948ae[_0xdda2('0x52')],function(_0x57cf2b){var _0x30e01c={};_0x30e01c[_0x57cf2b]={'$like':'%'+_0x25650a[_0xdda2('0x4f')]['filter']+'%'};return _0x30e01c;})});}_0x4948ae[_0xdda2('0x84')]['secret']=![];if(_0x25650a[_0xdda2('0x4f')]['id']){_0x4948ae[_0xdda2('0x84')]['id']={'$gt':_0x25650a[_0xdda2('0x4f')]['id']};}_0x4948ae=_[_0xdda2('0x3d')]({},_0x4948ae,_0x25650a[_0xdda2('0xc1')]);return db[_0xdda2('0xd8')][_0xdda2('0x34')]({'where':_0x4948ae[_0xdda2('0x84')]})['then'](function(_0x5343eb){_0x32564c[_0xdda2('0x34')]=_0x5343eb;_0x4948ae['include']=[];if(_0x25650a[_0xdda2('0x4f')]['includeAgent']){_0x4948ae['include'][_0xdda2('0xbd')]({'model':db[_0xdda2('0x7f')],'as':_0xdda2('0x7f'),'attributes':['id',_0xdda2('0xc9'),_0xdda2('0xfd')]});}if(_0x25650a[_0xdda2('0x4f')][_0xdda2('0x116')]){_0x4948ae[_0xdda2('0xc0')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x4948ae);})[_0xdda2('0x22')](function(_0x1eb2df){_0x32564c[_0xdda2('0x117')]=_0x1eb2df;return _0x32564c;});}})[_0xdda2('0x22')](respondWithFilteredResult(_0x3410ec,_0x4948ae))[_0xdda2('0x2c')](handleError(_0x3410ec,null));};exports[_0xdda2('0x119')]=function(_0x198e16,_0x12d2a9,_0xc6dbe4){return db[_0xdda2('0x48')][_0xdda2('0x6e')]({'where':{'id':_0x198e16[_0xdda2('0xbf')]['id']}})[_0xdda2('0x22')](handleEntityNotFound(_0x12d2a9,null))['then'](function(_0xaabf31){if(_0xaabf31){return _0xaabf31[_0xdda2('0x11a')](_0x198e16[_0xdda2('0x81')][_0xdda2('0x111')],_[_0xdda2('0x112')](_0x198e16[_0xdda2('0x81')],[_0xdda2('0x111'),'id'])||{})['spread'](function(){return db[_0xdda2('0x7c')][_0xdda2('0x11b')]({'attributes':['id',_0xdda2('0x3a'),_0xdda2('0x59')],'where':{'id':_0x198e16[_0xdda2('0x81')][_0xdda2('0x111')]}});})[_0xdda2('0x22')](function(_0x39b18f){socket['emit'](_0xdda2('0x11c'),{'id':Number(_0x198e16['params']['id']),'tags':_0x39b18f||[]});return{'id':Number(_0x198e16['params']['id']),'tags':_0x39b18f||[]};});}})[_0xdda2('0x22')](respondWithResult(_0x12d2a9,null))[_0xdda2('0x2c')](handleError(_0x12d2a9,null));};exports[_0xdda2('0x11d')]=function(_0xa13c22,_0x3b8dca,_0x1bbd6e){return db[_0xdda2('0x48')][_0xdda2('0x6e')]({'where':{'id':_0xa13c22['params']['id']}})[_0xdda2('0x22')](handleEntityNotFound(_0x3b8dca,null))['then'](function(_0x4e85b0){if(_0x4e85b0){return _0x4e85b0[_0xdda2('0x11d')](_0xa13c22[_0xdda2('0x4f')][_0xdda2('0x111')]);}})[_0xdda2('0x22')](respondWithStatusCode(_0x3b8dca,null))[_0xdda2('0x2c')](handleError(_0x3b8dca,null));};exports['download']=function(_0x18d90c,_0xeae3c3){var _0x47a929=moment()[_0xdda2('0x11e')]()[_0xdda2('0xa6')]();var _0x1ebdd0=path[_0xdda2('0xe7')](config[_0xdda2('0xed')],_0xdda2('0x11f'),'files',_0xdda2('0x120'));var _0x5496df=path[_0xdda2('0xe7')](config[_0xdda2('0xed')],'server',_0xdda2('0x121'),_0xdda2('0x122'));var _0x5671bf=path['join'](_0x1ebdd0,_0x47a929);var _0x35cdcd=util['format']('transcript-%d-%s.zip',_0x18d90c['params']['id'],_0x47a929);var _0xc13cd3=path[_0xdda2('0xe7')](_0x1ebdd0,_0x35cdcd);var _0x20f56f=[];_0x20f56f[_0xdda2('0xbd')]({'model':db[_0xdda2('0x7f')],'as':'User','attributes':['id',_0xdda2('0xc9')],'raw':!![]});_0x20f56f[_0xdda2('0xbd')]({'model':db[_0xdda2('0xda')],'as':_0xdda2('0x74'),'attributes':['id',_0xdda2('0x123'),_0xdda2('0x124')],'raw':!![]});if(_0x18d90c[_0xdda2('0x4f')]['attachments']){_0x20f56f['push']({'model':db[_0xdda2('0x125')],'as':_0xdda2('0x125'),'raw':!![]});}var _0x749b15=[{'model':db[_0xdda2('0xd8')],'as':_0xdda2('0xf2'),'attributes':['id',_0xdda2('0x81'),_0xdda2('0x87'),_0xdda2('0x100'),'secret','read'],'include':_0x20f56f}];_0x749b15['push']({'model':db[_0xdda2('0xf3')],'as':_0xdda2('0x126'),'attributes':['id',_0xdda2('0x3a')]});_0x749b15[_0xdda2('0xbd')]({'model':db[_0xdda2('0x7f')],'as':_0xdda2('0x127'),'attributes':['id','fullname']});return db[_0xdda2('0x48')][_0xdda2('0x6e')]({'where':{'id':_0x18d90c['params']['id']},'include':_0x749b15})[_0xdda2('0x22')](handleEntityNotFound(_0xeae3c3,null))[_0xdda2('0x22')](function(_0x50b325){if(_0x50b325){var _0x35ea7f=_0x50b325[_0xdda2('0x128')]({'plain':!![]});fs['mkdirSync'](_0x5671bf);var _0x10719d={'channel':_0xdda2('0x129'),'account':_0x35ea7f[_0xdda2('0x126')]['name'],'agent':_0x35ea7f[_0xdda2('0x127')]?_0x35ea7f[_0xdda2('0x127')][_0xdda2('0xc9')]:_0xdda2('0x12a'),'createdAt':moment(_0x35ea7f[_0xdda2('0x87')])[_0xdda2('0xf4')]('YYYY-MM-DD\x20HH:mm:ss')[_0xdda2('0xa6')](),'closedAt':_0x35ea7f[_0xdda2('0xe3')]?moment(_0x35ea7f['closedAt'])[_0xdda2('0xf4')](_0xdda2('0x115'))['toString']():'','disposition':_0x35ea7f[_0xdda2('0xdd')],'chatInfo':{'browser':_0x35ea7f[_0xdda2('0x12b')],'os':_0x35ea7f[_0xdda2('0x12c')],'referer':_0x35ea7f[_0xdda2('0x12d')],'customerIp':_0x35ea7f[_0xdda2('0x12e')],'customerPort':_0x35ea7f[_0xdda2('0x12f')]?_0x35ea7f[_0xdda2('0x12f')]:_0xdda2('0x12a')},'messages':_(_0x35ea7f[_0xdda2('0xf2')])[_0xdda2('0x130')]()[_0xdda2('0x92')]({'secret':![]})[_0xdda2('0x42')](function(_0x57f1ad){if(_0x57f1ad[_0xdda2('0x125')]){var _0x8fa72e=path[_0xdda2('0xe7')](_0x5496df,_0x57f1ad['Attachment']['basename']);if(fs[_0xdda2('0x131')](_0x8fa72e)){fs[_0xdda2('0x132')](_0x8fa72e)['pipe'](fs['createWriteStream'](path[_0xdda2('0xe7')](_0x5671bf,_0x57f1ad['Attachment'][_0xdda2('0xe9')])));}}return{'date':moment(_0x57f1ad[_0xdda2('0x87')])['format'](_0xdda2('0x115'))[_0xdda2('0xa6')](),'sender':_0x57f1ad[_0xdda2('0x100')]===_0xdda2('0xd7')?_0x57f1ad[_0xdda2('0x7f')]?_0x57f1ad[_0xdda2('0x7f')]['fullname']:'System':_0x57f1ad[_0xdda2('0x74')][_0xdda2('0x123')]+(_0x57f1ad[_0xdda2('0x74')][_0xdda2('0x124')]?'\x20'+_0x57f1ad[_0xdda2('0x74')][_0xdda2('0x124')]:''),'body':_0x57f1ad[_0xdda2('0x125')]?_0x57f1ad[_0xdda2('0x125')][_0xdda2('0xe9')]:_0x57f1ad[_0xdda2('0x81')],'direction':_0x57f1ad[_0xdda2('0x100')]===_0xdda2('0xd7')?'A':'C','secret':_0x57f1ad['secret'],'read':_0x57f1ad[_0xdda2('0x8d')],'attachment':_0x57f1ad[_0xdda2('0x125')]};})['value']()};return ejs[_0xdda2('0x133')](path['join'](config[_0xdda2('0xed')],_0xdda2('0x11f'),_0xdda2('0x134'),_0xdda2('0x135')),{'interaction':_0x10719d})[_0xdda2('0x22')](function(_0x3d8f28){var _0x1826a9=path['join'](_0x5671bf,'transcript-'+_0x35ea7f['id']+'-'+_0x47a929+_0xdda2('0x136'));var _0x20b702={'path':_0x1826a9,'channel':_0xdda2('0x129'),'interactionId':_0x35ea7f['id']};return pdf[_0xdda2('0x137')](_0x3d8f28,_0x20b702);})[_0xdda2('0x22')](function(){return new BPromise(function(_0xf9ca6e,_0x3eb4b7){zipdir(_0x5671bf,{'saveTo':_0xc13cd3},function(_0x5eb398,_0x315585){if(_0x5eb398)return _0x3eb4b7(_0x5eb398);return _0xf9ca6e(_0x315585);});})['then'](function(){return new BPromise(function(_0x4f20d3,_0x1685e4){rimraf(_0x5671bf,function(_0x5dbd5d){if(_0x5dbd5d)_0x1685e4(_0x5dbd5d);return _0x4f20d3();});});})['then'](function(){return _0xeae3c3['download'](_0xc13cd3,_0x35cdcd,function(_0x43c68a){if(_0x43c68a){console['log'](_0xdda2('0x138'),_0x43c68a);}else{fs[_0xdda2('0x139')](_0xc13cd3);}});});});}else{return _0xeae3c3['sendStatus'](0xc8);}})[_0xdda2('0x2c')](handleError(_0xeae3c3,null));}; \ No newline at end of file +var _0x087b=['jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','ChatInteraction,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','name','render','body','contact','agent','interaction','Users','map','fullname','TagIds','Tags','split','forEach','index','ChatInteraction','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filters','select','field','color','from','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','keys','compact','isEmpty','ChatWebsiteId','concat','createdAt','parse','$gte','null','where','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','c.email','Contact.email','Contact.phone','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','push','all','show','params','rawAttributes','include','options','catch','create','describe','ChatWebsite','findOne','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','updateAttributes','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','disposition','file','filename','attachmentDownload','closed','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','root','offline-chat/','basename','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','%s%d','agentAlias','System','customer','Visitor','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','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','ids','getMessages','nolimit','filter','findAll','rows','getMyMessages','includeAll','addTags','setTags','chatInteractionTags:save','removeTags','unix','files','server','attachments','transcript-%d-%s.zip','firstName','Account','Owner','YYYY-MM-DD\x20HH:mm:ss','referer','customerIp','customerPort','N.A.','tail','existsSync','pipe','createWriteStream','out','lastName','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register'];(function(_0x4feb9c,_0x19a66b){var _0x341ce3=function(_0x32aba6){while(--_0x32aba6){_0x4feb9c['push'](_0x4feb9c['shift']());}};_0x341ce3(++_0x19a66b);}(_0x087b,0x11a));var _0xb087=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0x087b[_0x4ed520];return _0x4415a6;};'use strict';var emlformat=require(_0xb087('0x0'));var rimraf=require(_0xb087('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb087('0x2'));var moment=require('moment');var BPromise=require(_0xb087('0x3'));var Mustache=require(_0xb087('0x4'));var util=require(_0xb087('0x5'));var path=require(_0xb087('0x6'));var sox=require(_0xb087('0x7'));var csv=require(_0xb087('0x8'));var ejs=require(_0xb087('0x9'));var fs=require('fs');var fs_extra=require(_0xb087('0xa'));var _=require(_0xb087('0xb'));var squel=require(_0xb087('0xc'));var crypto=require(_0xb087('0xd'));var jsforce=require(_0xb087('0xe'));var deskjs=require(_0xb087('0xf'));var toCsv=require(_0xb087('0x8'));var querystring=require(_0xb087('0x10'));var Papa=require(_0xb087('0x11'));var Redis=require(_0xb087('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb087('0x13'));var as=require(_0xb087('0x14'));var pdf=require(_0xb087('0x15'));var hardwareService=require(_0xb087('0x16'));var logger=require(_0xb087('0x17'))(_0xb087('0x18'));var utils=require(_0xb087('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xb087('0x1a'));var db=require(_0xb087('0x1b'))['db'];config[_0xb087('0x1c')]=_['defaults'](config[_0xb087('0x1c')],{'host':_0xb087('0x1d'),'port':0x18eb});var socket=require(_0xb087('0x1e'))(new Redis(config[_0xb087('0x1c')]));require(_0xb087('0x1f'))[_0xb087('0x20')](socket);var jayson=require(_0xb087('0x21'));var client=jayson[_0xb087('0x22')][_0xb087('0x23')]({'port':0x232b});var client9004=jayson[_0xb087('0x22')]['http']({'port':0x232c});function respondWithRpcPromise(_0x43e576,_0x412b48,_0x597478,_0xcc4426){return new BPromise(function(_0x2b83b7,_0x2e9e74){var _0x5bb80b=_0xcc4426||client;return _0x5bb80b[_0xb087('0x24')](_0x43e576,_0x597478)[_0xb087('0x25')](function(_0x17200d){logger[_0xb087('0x26')]('ChatInteraction,\x20%s,\x20%s',_0x412b48,_0xb087('0x27'));logger[_0xb087('0x28')](_0xb087('0x29'),_0x412b48,_0xb087('0x27'),JSON['stringify'](_0x17200d));if(_0x17200d['error']){if(_0x17200d['error']['code']===0x1f4){logger[_0xb087('0x2a')](_0xb087('0x2b'),_0x412b48,_0x17200d[_0xb087('0x2a')][_0xb087('0x2c')]);return _0x2e9e74(_0x17200d[_0xb087('0x2a')][_0xb087('0x2c')]);}logger[_0xb087('0x2a')]('ChatInteraction,\x20%s,\x20%s',_0x412b48,_0x17200d[_0xb087('0x2a')][_0xb087('0x2c')]);return _0x2b83b7(_0x17200d[_0xb087('0x2a')][_0xb087('0x2c')]);}else{logger[_0xb087('0x26')]('ChatInteraction,\x20%s,\x20%s',_0x412b48,_0xb087('0x27'));_0x2b83b7(_0x17200d[_0xb087('0x2d')]['message']);}})['catch'](function(_0x50745a){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x412b48,_0x50745a);_0x2e9e74(_0x50745a);});});}function respondWithStatusCode(_0x304840,_0x45685d){_0x45685d=_0x45685d||0xcc;return function(_0x1d124f){if(_0x1d124f){return _0x304840[_0xb087('0x2e')](_0x45685d);}return _0x304840[_0xb087('0x2f')](_0x45685d)[_0xb087('0x30')]();};}function respondWithResult(_0xf3f41f,_0x35a52c){_0x35a52c=_0x35a52c||0xc8;return function(_0x6cfb22){if(_0x6cfb22){return _0xf3f41f[_0xb087('0x2f')](_0x35a52c)[_0xb087('0x31')](_0x6cfb22);}};}function respondWithFilteredResult(_0x31e3e6,_0xb0baf6){return function(_0x263259){if(_0x263259){var _0x593b78=typeof _0xb0baf6[_0xb087('0x32')]===_0xb087('0x33')&&typeof _0xb0baf6[_0xb087('0x34')]===_0xb087('0x33');var _0x22d441=_0x263259[_0xb087('0x35')];var _0x2e1c57=_0x593b78?0x0:_0xb0baf6[_0xb087('0x32')];var _0x53a535=_0x593b78?_0x263259['count']:_0xb0baf6[_0xb087('0x32')]+_0xb0baf6[_0xb087('0x34')];var _0x4cb5a8;if(_0x53a535>=_0x22d441){_0x53a535=_0x22d441;_0x4cb5a8=0xc8;}else{_0x4cb5a8=0xce;}_0x31e3e6[_0xb087('0x2f')](_0x4cb5a8);return _0x31e3e6[_0xb087('0x36')](_0xb087('0x37'),_0x2e1c57+'-'+_0x53a535+'/'+_0x22d441)[_0xb087('0x31')](_0x263259);}return null;};}function patchUpdates(_0x3c61c4){return function(_0x427905){try{jsonpatch[_0xb087('0x38')](_0x427905,_0x3c61c4,!![]);}catch(_0x3b7ace){return BPromise[_0xb087('0x39')](_0x3b7ace);}return _0x427905[_0xb087('0x3a')]();};}function saveUpdates(_0x442a5e,_0x3069b5){return function(_0x57ae94){if(_0x57ae94){return _0x57ae94[_0xb087('0x3b')](_0x442a5e)['then'](function(_0x906987){return _0x906987;});}return null;};}function removeEntity(_0x296e9b,_0x738e68){return function(_0xd0659e){if(_0xd0659e){return _0xd0659e[_0xb087('0x3c')]()[_0xb087('0x25')](function(){_0x296e9b[_0xb087('0x2f')](0xcc)[_0xb087('0x30')]();});}};}function handleEntityNotFound(_0x8a4c3c,_0x521c3f){return function(_0x5814c2){if(!_0x5814c2){_0x8a4c3c[_0xb087('0x2e')](0x194);}return _0x5814c2;};}function handleError(_0x3c4f33,_0x1ce1ef){_0x1ce1ef=_0x1ce1ef||0x1f4;return function(_0x2d2902){logger[_0xb087('0x2a')](_0x2d2902['stack']);if(_0x2d2902[_0xb087('0x3d')]){delete _0x2d2902[_0xb087('0x3d')];}_0x3c4f33['status'](_0x1ce1ef)['send'](_0x2d2902);};}function getMustacheRender(_0x1726c2,_0x1c7d90){return Mustache[_0xb087('0x3e')](_0x1726c2,_['merge'](_0x1c7d90[_0xb087('0x3f')],{'contact':_0x1c7d90[_0xb087('0x40')],'message':_0x1c7d90[_0xb087('0x2c')],'agent':_0x1c7d90[_0xb087('0x41')],'interaction':_0x1c7d90[_0xb087('0x42')],'account':_0x1c7d90['account']}))||'';}function getInteractionUsers(_0x7e1315,_0x5bb6bc){return new BPromise(function(_0x18e23f,_0x5a582d){try{if(_0x5bb6bc[_0x7e1315['id']]){_0x7e1315[_0xb087('0x43')]=_[_0xb087('0x44')](_0x5bb6bc[_0x7e1315['id']],function(_0x513332){return{'id':_0x513332['id'],'fullname':_0x513332[_0xb087('0x45')]};});}}catch(_0x5aa11d){_0x5a582d(_0x5aa11d);}_0x18e23f(_0x7e1315);});}function getInteractionTags(_0x46d12a,_0x4a360c){return new BPromise(function(_0x2d2c74,_0x326934){try{if(_0x46d12a[_0xb087('0x46')]){_0x46d12a[_0xb087('0x47')]=[];_0x46d12a[_0xb087('0x46')][_0xb087('0x48')](',')[_0xb087('0x49')](function(_0x5e7690){_0x46d12a[_0xb087('0x47')]['push'](_0x4a360c[_0x5e7690]);});}delete _0x46d12a[_0xb087('0x46')];}catch(_0x2d71c2){_0x326934(_0x2d71c2);}_0x2d2c74(_0x46d12a);});}function updateChatInteraction(_0x5b6924,_0xb662bf,_0x45dc6f){return new BPromise(function(_0x7650c5,_0x4c33cc){return getInteractionUsers(_0x5b6924,_0x45dc6f)[_0xb087('0x25')](function(_0x4a9ccb){return getInteractionTags(_0x4a9ccb,_0xb662bf);})[_0xb087('0x25')](function(_0x32b9d3){_0x7650c5(_0x32b9d3);})['catch'](function(_0x38cb9d){_0x4c33cc(_0x38cb9d);});});}exports[_0xb087('0x4a')]=function(_0x4addbd,_0x2b969a){var _0x171778={},_0x54eb11={},_0x93ada7={'count':0x0,'rows':[]};var _0x46c713=_[_0xb087('0x44')](db[_0xb087('0x4b')]['rawAttributes'],function(_0x47902e){return{'name':_0x47902e[_0xb087('0x4c')],'type':_0x47902e[_0xb087('0x4d')][_0xb087('0x4e')]};});_0x54eb11[_0xb087('0x4f')]=_[_0xb087('0x44')](_0x46c713,_0xb087('0x3d'));_0x54eb11['query']=_['keys'](_0x4addbd[_0xb087('0x50')]);_0x54eb11['filters']=_[_0xb087('0x51')](_0x54eb11[_0xb087('0x4f')],_0x54eb11[_0xb087('0x50')]);_0x171778[_0xb087('0x52')]=_['intersection'](_0x54eb11[_0xb087('0x4f')],qs['fields'](_0x4addbd[_0xb087('0x50')][_0xb087('0x53')]));_0x171778[_0xb087('0x52')]=_0x171778[_0xb087('0x52')][_0xb087('0x54')]?_0x171778['attributes']:_0x54eb11[_0xb087('0x4f')];if(!_0x4addbd[_0xb087('0x50')][_0xb087('0x55')]('nolimit')){_0x171778[_0xb087('0x34')]=qs['limit'](_0x4addbd['query'][_0xb087('0x34')]);_0x171778[_0xb087('0x32')]=qs['offset'](_0x4addbd[_0xb087('0x50')][_0xb087('0x32')]);}_0x171778[_0xb087('0x56')]=qs['sort'](_0x4addbd['query'][_0xb087('0x57')]);_0x171778['where']=qs['filters'](_[_0xb087('0x58')](_0x4addbd[_0xb087('0x50')],_0x54eb11[_0xb087('0x59')]),_0x46c713);var _0x4067cf=[];var _0x2bf92f=squel[_0xb087('0x5a')]()[_0xb087('0x5b')]('id')[_0xb087('0x5b')](_0xb087('0x3d'))[_0xb087('0x5b')](_0xb087('0x5c'))[_0xb087('0x5d')]('tools_tags');var _0x46d570=squel[_0xb087('0x5a')]()['field'](_0xb087('0x5e'))[_0xb087('0x5b')](_0xb087('0x5f'))[_0xb087('0x5b')](_0xb087('0x60'))[_0xb087('0x5d')](_0xb087('0x61'),'ui')[_0xb087('0x62')](_0xb087('0x63'),'u',_0xb087('0x64'));var _0x17c6d0=squel['select']()[_0xb087('0x5d')]('chat_interactions','i')[_0xb087('0x62')]('cm_contacts','c',_0xb087('0x65'))[_0xb087('0x62')](_0xb087('0x63'),'o',_0xb087('0x66'))[_0xb087('0x62')](_0xb087('0x67'),'a',_0xb087('0x68'))[_0xb087('0x62')](_0xb087('0x69'),'me',_0xb087('0x6a'))[_0xb087('0x62')](_0xb087('0x6b'),'it',_0xb087('0x6c'))[_0xb087('0x62')](_0xb087('0x6d'),'t',_0xb087('0x6e'));var _0x217f26=squel[_0xb087('0x6f')]();var _0x40ff74=[];var _0xe3cb2=squel[_0xb087('0x6f')]();var _0x459c5b;if(_0x4addbd['query'][_0xb087('0x70')]){_0x459c5b=as[_0xb087('0x71')](_0x4addbd[_0xb087('0x50')]['search']);var _0x4099cc=_0x459c5b[_0xb087('0x72')];for(var _0x5685b1=0x0;_0x5685b1<_0x459c5b[_0xb087('0x73')][_0xb087('0x54')];_0x5685b1++){var _0x2e3a14=_0x459c5b['conditions'][_0x5685b1];var _0x133c58='i';var _0x257894=_[_0xb087('0x74')](_0x46c713,[_0xb087('0x3d'),_0x2e3a14[_0xb087('0x5b')]]);if(!_0x257894){switch(_0x2e3a14[_0xb087('0x5b')]){case _0xb087('0x75'):if(_0x2e3a14[_0xb087('0x76')]==0x1){_0x17c6d0['having']('`'+_0x2e3a14[_0xb087('0x5b')]+_0xb087('0x77'));}else{_0x17c6d0[_0xb087('0x78')]('`'+_0x2e3a14['field']+_0xb087('0x79'));}break;case'Contact':if(_0x2e3a14['operator']===_0xb087('0x7a')){if(_0x2e3a14[_0xb087('0x76')]['split']('\x20')[_0xb087('0x54')]>0x1){_0x217f26[_0x4099cc]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb087('0x7b')](_0x2e3a14[_0xb087('0x76')]),null);}else{var _0x5938ad='%'+_0x2e3a14['value']+'%';_0x217f26[_0x4099cc](_0xb087('0x7c'),_0x5938ad,_0x5938ad,_0x5938ad);}}else{_0x257894=_['find'](_0x46c713,['name',_0xb087('0x7d')]);_0x2e3a14['field']=_0xb087('0x7d');_0x390309=as['buildExpression'](_0x133c58,_0x257894[_0xb087('0x4d')],_0x2e3a14);_0x217f26[_0x4099cc](_0x390309[_0xb087('0x7e')],_0x390309[_0xb087('0x76')][_0xb087('0x7f')],_0x390309[_0xb087('0x76')][_0xb087('0x30')]);}break;case'Tag':var _0x200869=_0x2e3a14['value'][_0xb087('0x48')](',')[_0xb087('0x44')](function(_0x1060e1){return Number(_0x1060e1);});_0x200869['forEach'](function(_0x298bbb){_0xe3cb2['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x298bbb+',%');});_0x40ff74=_[_0xb087('0x80')](_0x40ff74,_0x200869);break;case _0xb087('0x81'):if(_0x2e3a14[_0xb087('0x82')]===_0xb087('0x7a')){_0x217f26[_0x4099cc](_0xb087('0x83'),'%'+_0x2e3a14[_0xb087('0x76')]+'%',null);}else{_0x257894=_['find'](_0x46c713,[_0xb087('0x3d'),_0xb087('0x84')]);_0x2e3a14['field']=_0xb087('0x84');_0x390309=as['buildExpression'](_0x133c58,_0x257894[_0xb087('0x4d')],_0x2e3a14);_0x217f26[_0x4099cc](_0x390309[_0xb087('0x7e')],_0x390309[_0xb087('0x76')][_0xb087('0x7f')],_0x390309[_0xb087('0x76')][_0xb087('0x30')]);}break;case _0xb087('0x3f'):_0x390309=as[_0xb087('0x85')]('me',null,_0x2e3a14);_0x217f26[_0x4099cc](_0x390309['text'],_0x390309['value']['start'],_0x390309[_0xb087('0x76')]['end']);break;}}else{var _0x390309=as['buildExpression'](_0x133c58,_0x257894[_0xb087('0x4d')],_0x2e3a14);_0x217f26[_0x4099cc](_0x390309[_0xb087('0x7e')],_0x390309[_0xb087('0x76')][_0xb087('0x7f')],_0x390309['value'][_0xb087('0x30')]);}}}else{var _0x53f04a=_(_0x4addbd[_0xb087('0x50')])[_0xb087('0x86')]()[_0xb087('0x44')](function(_0x42f4a3){return _['some'](_0x46c713,['name',_0x42f4a3])?_0x42f4a3:undefined;})[_0xb087('0x87')]()['value']();if(!_[_0xb087('0x88')](_0x53f04a)){_0x53f04a[_0xb087('0x49')](function(_0x2ca987){if(_0x2ca987===_0xb087('0x89')){_0x17c6d0['where']('i.ChatWebsiteId\x20IN\x20?',[][_0xb087('0x8a')](_0x4addbd['query'][_0x2ca987]));}else if(_0x2ca987===_0xb087('0x8b')){var _0x1c7cd7=JSON[_0xb087('0x8c')](_0x4addbd[_0xb087('0x50')][_0x2ca987])[_0xb087('0x8d')];var _0x581ad4=JSON[_0xb087('0x8c')](_0x4addbd[_0xb087('0x50')][_0x2ca987])['$lte'];_0x17c6d0['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1c7cd7,_0x581ad4);}else{if(_0x4addbd[_0xb087('0x50')][_0x2ca987]===_0xb087('0x8e')){_0x17c6d0[_0xb087('0x8f')]('i.'+_0x2ca987+_0xb087('0x90'));}else{_0x17c6d0[_0xb087('0x8f')]('i.'+_0x2ca987+_0xb087('0x91'),_0x4addbd['query'][_0x2ca987]);}}});}if(_0x4addbd[_0xb087('0x50')][_0xb087('0x92')]){if(_0x4addbd[_0xb087('0x50')][_0xb087('0x92')]==0x1){_0x17c6d0[_0xb087('0x78')](_0xb087('0x93'));}else{_0x17c6d0[_0xb087('0x78')]('`unreadMessages`\x20>\x200');}}if(_0x4addbd[_0xb087('0x50')][_0xb087('0x94')]){_0x40ff74=_[_0xb087('0x95')](_0x4addbd['query'][_0xb087('0x94')])?_0x4addbd['query'][_0xb087('0x94')]:new Array(_0x4addbd[_0xb087('0x50')][_0xb087('0x94')]);_0x40ff74[_0xb087('0x49')](function(_0x463791){_0xe3cb2['or'](_0xb087('0x96'),'%,'+_0x463791+',%');});}if(_0x4addbd['query']['filter']){var _0x1e7a22=_0x4addbd[_0xb087('0x50')]['filter'][_0xb087('0x97')]('\x5c','\x5c\x5c')[_0xb087('0x97')](/'/g,'\x27\x27');if(qs[_0xb087('0x98')](_0x1e7a22)){_0x217f26['or'](_0xb087('0x99'),_0x1e7a22+'%');}else{_0x217f26['or'](_0xb087('0x9a'),qs[_0xb087('0x7b')](_0x1e7a22))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x1e7a22+'%');}}}_0x17c6d0[_0xb087('0x8f')](_0x217f26);_0x17c6d0[_0xb087('0x9b')](_0xb087('0x9c'));var _0x3114ce={'type':db[_0xb087('0x9d')][_0xb087('0x9e')][_0xb087('0x9f')],'raw':!![]};var _0x1fc613=_0x17c6d0[_0xb087('0xa0')]();_0x1fc613['field'](_0xb087('0x9c'));_0x1fc613['field'](_0xb087('0xa1'),_0xb087('0x75'));if(_0x171778['order']){_0x171778[_0xb087('0x56')][_0xb087('0x49')](function(_0x8b1a5b){var _0x2a076b=_0x8b1a5b[0x0]===_0xb087('0xa2')?_0x8b1a5b[0x0]:'i.'+_0x8b1a5b[0x0];_0x17c6d0[_0xb087('0x56')](_0x2a076b,_0x8b1a5b[0x1]==='DESC'?![]:!![]);});}if(!_[_0xb087('0x88')](_0x40ff74)){_0x17c6d0[_0xb087('0x78')](_0xe3cb2);_0x1fc613[_0xb087('0x8f')](_0xb087('0xa3'),_0x40ff74);}BPromise[_0xb087('0xa4')]()['then'](function(){if(!_0x459c5b){if(_0x4addbd[_0xb087('0x50')][_0xb087('0x89')])return;_0x1fc613[_0xb087('0x8f')](_0xb087('0xa5'));_0x17c6d0[_0xb087('0x8f')](_0xb087('0xa5'));return;}if(_0x4addbd[_0xb087('0xa6')][_0xb087('0xa7')]!==_0xb087('0x41'))return;return _0x4addbd[_0xb087('0xa6')][_0xb087('0xa8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x59121a){if(_[_0xb087('0x88')](_0x59121a)){_0x1fc613[_0xb087('0x8f')](_0xb087('0xa9'));_0x17c6d0[_0xb087('0x8f')](_0xb087('0xa9'));}else{_0x1fc613['where'](_0xb087('0xaa'),_[_0xb087('0x44')](_0x59121a,'id'));_0x17c6d0[_0xb087('0x8f')](_0xb087('0xaa'),_[_0xb087('0x44')](_0x59121a,'id'));}});})[_0xb087('0x25')](function(){if(_0x4addbd['user'][_0xb087('0xa7')]==='agent'&&!_0x459c5b&&!_0x4addbd['query'][_0xb087('0x89')])return[];return db[_0xb087('0xab')][_0xb087('0x50')](_0x1fc613[_0xb087('0xac')](),_0x3114ce);})['then'](function(_0x313c9b){_0x93ada7[_0xb087('0x35')]=_0x313c9b['length'];if(_0x93ada7[_0xb087('0x35')]===0x0)return[];return db['sequelize']['query'](_0x2bf92f[_0xb087('0xac')](),_0x3114ce)[_0xb087('0x25')](function(_0x414cb4){_0x4067cf=_[_0xb087('0xad')](_0x414cb4,'id');_0x3114ce=_[_0xb087('0xae')](_0x3114ce,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4addbd[_0xb087('0x50')][_0xb087('0x53')]){_0x171778[_0xb087('0x52')][_0xb087('0x49')](function(_0x48e2c6){_0x17c6d0['field']('i.'+_0x48e2c6);});}else{_0x17c6d0['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xb087('0x75'));_0x17c6d0[_0xb087('0x5b')](_0xb087('0xaf'),_0xb087('0xb0'));_0x17c6d0[_0xb087('0x5b')](_0xb087('0xb1'),_0xb087('0xb2'));_0x17c6d0['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xb087('0xa2'));_0x17c6d0[_0xb087('0x5b')](_0xb087('0xb3'));_0x17c6d0[_0xb087('0x5b')]('c.firstName',_0xb087('0xb4'));_0x17c6d0['field'](_0xb087('0xb5'),'Contact.lastName');_0x17c6d0[_0xb087('0x5b')](_0xb087('0xb6'),_0xb087('0xb7'));_0x17c6d0[_0xb087('0x5b')]('c.phone',_0xb087('0xb8'));_0x17c6d0['field']('c.mobile','Contact.mobile');_0x17c6d0[_0xb087('0x5b')]('c.fax',_0xb087('0xb9'));_0x17c6d0[_0xb087('0x5b')](_0xb087('0xba'),_0xb087('0xbb'));_0x17c6d0[_0xb087('0x5b')](_0xb087('0xbc'),_0xb087('0xbd'));_0x17c6d0[_0xb087('0x5b')](_0xb087('0xbe'),_0xb087('0x46'));}if(_0x171778[_0xb087('0x34')])_0x17c6d0[_0xb087('0x34')](_0x171778[_0xb087('0x34')]);if(_0x171778[_0xb087('0x32')])_0x17c6d0[_0xb087('0x32')](_0x171778[_0xb087('0x32')]);return db[_0xb087('0xab')][_0xb087('0x50')](_0x17c6d0['toString'](),_0x3114ce);})[_0xb087('0x25')](function(_0x5c2a14){if(_0x5c2a14[_0xb087('0x54')]>0x0)_0x46d570[_0xb087('0x8f')](_0xb087('0xbf'),_[_0xb087('0x44')](_0x5c2a14,'id'));return db[_0xb087('0xab')][_0xb087('0x50')](_0x46d570[_0xb087('0xac')](),_0x3114ce)['then'](function(_0x5103ab){var _0x5194f2=_[_0xb087('0xc0')](_0x5103ab,_0xb087('0xc1'));var _0x3a403f=[];_0x5c2a14[_0xb087('0x49')](function(_0x18b90b){_0x3a403f[_0xb087('0xc2')](updateChatInteraction(_0x18b90b,_0x4067cf,_0x5194f2));});return BPromise[_0xb087('0xc3')](_0x3a403f);});});})[_0xb087('0x25')](function(_0x181c56){_0x93ada7['rows']=_0x181c56;return _0x93ada7;})[_0xb087('0x25')](respondWithFilteredResult(_0x2b969a,_0x171778))['catch'](handleError(_0x2b969a,null));};exports[_0xb087('0xc4')]=function(_0x25910a,_0x597d80){var _0x4c3aef={'raw':![],'where':{'id':_0x25910a[_0xb087('0xc5')]['id']}},_0x2f2597={};_0x2f2597[_0xb087('0x4f')]=_[_0xb087('0x86')](db['ChatInteraction'][_0xb087('0xc6')]);_0x2f2597[_0xb087('0x50')]=_['keys'](_0x25910a['query']);_0x2f2597[_0xb087('0x59')]=_['intersection'](_0x2f2597['model'],_0x2f2597[_0xb087('0x50')]);_0x4c3aef['attributes']=_[_0xb087('0x51')](_0x2f2597[_0xb087('0x4f')],qs[_0xb087('0x53')](_0x25910a[_0xb087('0x50')][_0xb087('0x53')]));_0x4c3aef[_0xb087('0x52')]=_0x4c3aef[_0xb087('0x52')][_0xb087('0x54')]?_0x4c3aef['attributes']:_0x2f2597[_0xb087('0x4f')];if(_0x25910a['query']['includeAll']){_0x4c3aef[_0xb087('0xc7')]=[{'all':!![]}];}_0x4c3aef=_[_0xb087('0xae')]({},_0x4c3aef,_0x25910a[_0xb087('0xc8')]);return db['ChatInteraction'][_0xb087('0x74')](_0x4c3aef)[_0xb087('0x25')](handleEntityNotFound(_0x597d80,null))[_0xb087('0x25')](respondWithResult(_0x597d80,null))[_0xb087('0xc9')](handleError(_0x597d80,null));};exports['create']=function(_0x1f3ecb,_0x3e865d){return db[_0xb087('0x4b')][_0xb087('0xca')](_0x1f3ecb[_0xb087('0x3f')],{})[_0xb087('0x25')](respondWithResult(_0x3e865d,0xc9))[_0xb087('0xc9')](handleError(_0x3e865d,null));};exports['update']=function(_0x1de68b,_0xfc3490){if(_0x1de68b[_0xb087('0x3f')]['id']){delete _0x1de68b[_0xb087('0x3f')]['id'];}return db[_0xb087('0x4b')][_0xb087('0x74')]({'where':{'id':_0x1de68b['params']['id']}})[_0xb087('0x25')](handleEntityNotFound(_0xfc3490,null))[_0xb087('0x25')](saveUpdates(_0x1de68b[_0xb087('0x3f')],null))['then'](respondWithResult(_0xfc3490,null))['catch'](handleError(_0xfc3490,null));};exports[_0xb087('0x3c')]=function(_0x12c676,_0xee09f5){return db[_0xb087('0x4b')][_0xb087('0x74')]({'where':{'id':_0x12c676[_0xb087('0xc5')]['id']}})[_0xb087('0x25')](handleEntityNotFound(_0xee09f5,null))[_0xb087('0x25')](removeEntity(_0xee09f5,null))[_0xb087('0xc9')](handleError(_0xee09f5,null));};exports[_0xb087('0xcb')]=function(_0x5ef263,_0x1a7486){return db[_0xb087('0x4b')][_0xb087('0xcb')]()[_0xb087('0x25')](respondWithResult(_0x1a7486,null))[_0xb087('0xc9')](handleError(_0x1a7486,null));};exports['createVidaooSession']=function(_0x33756c,_0x2e8eb1){var _0x189e0a=_0x33756c[_0xb087('0xc5')]['id'];var _0x52268a;var _0x259ac0;var _0x547968;return db[_0xb087('0x4b')]['findOne']({'where':{'id':_0x189e0a}})['then'](function(_0x321da9){_0x52268a=_0x321da9;return db[_0xb087('0xcc')][_0xb087('0xcd')]({'where':{'id':_0x321da9['ChatWebsiteId']},'attributes':['id','vidaooApiKey',_0xb087('0xce'),_0xb087('0xcf'),_0xb087('0xd0'),_0xb087('0xd1')],'raw':!![]});})[_0xb087('0x25')](function(_0x48a94f){if(_0x48a94f&&_0x48a94f[_0xb087('0xd2')]&&_0x48a94f[_0xb087('0xce')]){_0x259ac0=_0x48a94f;var _0x290338={'interaction':{'id':_0x189e0a},'agent':{'id':_0x33756c[_0xb087('0xa6')]['id'],'name':_0x33756c[_0xb087('0xa6')][_0xb087('0x3d')],'fullname':_0x33756c['user']['fullname'],'email':_0x33756c[_0xb087('0xa6')][_0xb087('0xd3')]},'contact':_0x33756c['body'][_0xb087('0x40')],'account':_0x33756c['body']['account']};var _0x471c54={'rejectUnauthorized':![],'method':_0xb087('0xd4'),'url':_0xb087('0xd5'),'headers':{'X-APIKEY':_0x48a94f[_0xb087('0xd2')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x33756c[_0xb087('0xa6')][_0xb087('0xd3')]],'buttons':null,'topic':_0x259ac0[_0xb087('0xcf')],'note':_[_0xb087('0xd6')](_0x259ac0[_0xb087('0xd0')])?null:getMustacheRender(_0x259ac0[_0xb087('0xd0')],_0x290338),'metadata':null},'redirect':'follow','json':!![]};try{if(!_['isNull'](_0x259ac0['vidaooMetadata'])){var _0x2ebe58=getMustacheRender(_0x259ac0['vidaooMetadata'],_0x290338);var _0x173a1b=JSON['parse'](_0x2ebe58);_0x471c54['body'][_0xb087('0xd7')]=_0x173a1b;}}catch(_0x2e3036){throw new db[(_0xb087('0x9d'))][(_0xb087('0xd8'))](_0xb087('0xd9'));}return rp(_0x471c54);}else{throw new db[(_0xb087('0x9d'))][(_0xb087('0xd8'))](_0xb087('0xda'));}})[_0xb087('0x25')](function(_0x2fdcee){_0x547968=_0x2fdcee;if(_0x547968['id']){var _0x5ae13d={'body':_0x547968[_0xb087('0xdb')],'ChatWebsiteId':_0x259ac0['id'],'ChatInteractionId':_0x52268a['id'],'direction':'out','UserId':_0x33756c[_0xb087('0xa6')]['id']};return db[_0xb087('0xdc')]['create'](_0x5ae13d,{});}else{throw new db[(_0xb087('0x9d'))][(_0xb087('0xd8'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x52268a[_0xb087('0xdd')]({'vidaooSessionId':_0x547968['id']});})['then'](respondWithResult(_0x2e8eb1,null))[_0xb087('0xc9')](handleError(_0x2e8eb1,null));};exports['customUpdate']=function(_0x1e04ff,_0x1a99a3){if(_0x1e04ff[_0xb087('0x3f')]['id']){delete _0x1e04ff['body']['id'];}return db[_0xb087('0x4b')][_0xb087('0x74')]({'where':{'id':_0x1e04ff[_0xb087('0xc5')]['id']},'include':[{'model':db[_0xb087('0xde')],'as':_0xb087('0xdf')}]})[_0xb087('0x25')](handleEntityNotFound(_0x1a99a3,null))[_0xb087('0x25')](saveUpdates(_0x1e04ff[_0xb087('0x3f')],null))[_0xb087('0x25')](respondWithResult(_0x1a99a3,null))[_0xb087('0xc9')](handleError(_0x1a99a3,null));};exports['abandon']=function(_0x3a5432,_0x520aa9,_0x31d03d){if(_0x3a5432[_0xb087('0x3f')]['id']){delete _0x3a5432[_0xb087('0x3f')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x3a5432['params']['id']}})[_0xb087('0x25')](function(_0xfaa17f){if(!_0xfaa17f){logger[_0xb087('0x2a')](_0xb087('0xe0'),_0xb087('0xe1'),0x194,_0xb087('0xe2'));_0x520aa9[_0xb087('0x2e')](0x194);}else{if(_0xfaa17f['UserId']){throw new db[(_0xb087('0x9d'))]['ValidationError']('Interaction\x20already\x20assigned');}}return _0xfaa17f;})['then'](function(_0x4cde01){if(_0x4cde01){return _0x4cde01[_0xb087('0x3b')]({'closed':_0x3a5432[_0xb087('0x3f')]['closed'],'disposition':_0x3a5432[_0xb087('0x3f')][_0xb087('0xe3')]})[_0xb087('0x25')](function(_0x500a2b){return _0x500a2b;});}})[_0xb087('0x25')](function(_0x11a1a5){return respondWithRpcPromise('AbandonInteraction',_0xb087('0xe1'),_0x3a5432[_0xb087('0x3f')],client9004);})[_0xb087('0x25')](respondWithResult(_0x520aa9,null))[_0xb087('0xc9')](handleError(_0x520aa9,null));};exports['attachmentUpload']=function(_0x270e65,_0x10c680,_0x164371){_0x270e65[_0xb087('0x3f')][_0xb087('0x3d')]=_0x270e65[_0xb087('0xe4')]['originalname'];_0x270e65[_0xb087('0x3f')]['basename']=_0x270e65[_0xb087('0xe4')][_0xb087('0xe5')];_0x270e65['body'][_0xb087('0x4d')]=_0x270e65['file']['mimetype'];return db['Attachment'][_0xb087('0xca')](_0x270e65[_0xb087('0x3f')])[_0xb087('0x25')](respondWithResult(_0x10c680,0xc9))[_0xb087('0xc9')](handleError(_0x10c680,null));};exports[_0xb087('0xe6')]=function(_0x1e0751,_0x2831b4,_0x218fe3){return db['ChatInteraction'][_0xb087('0xcd')]({'where':{'id':_0x1e0751['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2831b4,null))[_0xb087('0x25')](function(_0x1babd3){if(_0x1babd3){if(_0x1babd3[_0xb087('0xe7')]){return _0x2831b4['status'](0x193)['json']({'status':0x193,'message':_0xb087('0xe8')});}return db[_0xb087('0xe9')][_0xb087('0xcd')]({'where':{'id':_0x1e0751[_0xb087('0x50')][_0xb087('0xea')]},'raw':!![]})[_0xb087('0x25')](handleEntityNotFound(_0x2831b4,null));}})['then'](function(_0x52341e){if(_0x52341e){var _0x54eed6=_0x52341e[_0xb087('0xeb')]!==null;var _0x12d277=path[_0xb087('0xec')](config[_0xb087('0xed')],'server/files/attachments/');if(_0x54eed6){_0x12d277=path[_0xb087('0xec')](_0x12d277,_0xb087('0xee'));}var _0x1b5422=path[_0xb087('0xec')](_0x12d277,_0x52341e[_0xb087('0xef')]);return _0x2831b4[_0xb087('0xf0')](_0x1b5422);}})[_0xb087('0xc9')](handleError(_0x2831b4,null));};exports[_0xb087('0xf1')]=function(_0x120012,_0x385065){var _0x56e768=null;var _0x5a2142=null;var _0x24171a=null;var _0x39577d=null;if(_0x120012[_0xb087('0x3f')]['id']){delete _0x120012[_0xb087('0x3f')]['id'];}if(_0x120012[_0xb087('0x3f')][_0xb087('0xf2')]){_0x39577d=path[_0xb087('0xec')](config[_0xb087('0xed')],_0xb087('0xf3'),util[_0xb087('0xf4')](_0xb087('0xf5'),Date[_0xb087('0xf6')]()));_0x120012[_0xb087('0x3f')][_0xb087('0xf7')]=_0x39577d;}return db[_0xb087('0x4b')][_0xb087('0x74')]({'where':{'id':_0x120012[_0xb087('0xc5')]['id']},'include':[{'model':db[_0xb087('0xdc')],'as':_0xb087('0xf8'),'include':[{'model':db[_0xb087('0x81')],'as':_0xb087('0x81')}]}]})[_0xb087('0x25')](handleEntityNotFound(_0x385065,null))[_0xb087('0x25')](saveUpdates(_0x120012[_0xb087('0x3f')],null))[_0xb087('0x25')](function(_0x365d41){if(_0x365d41){_0x56e768=_0x365d41;return db[_0xb087('0xcc')][_0xb087('0x74')]({'where':{'id':_0x56e768[_0xb087('0x89')]}});}})[_0xb087('0x25')](function(_0x159082){if(_0x159082){_0x24171a=_0x159082;return db[_0xb087('0xde')][_0xb087('0x74')]({'where':{'id':_0x56e768[_0xb087('0x7d')]}});}})[_0xb087('0x25')](function(_0x2d8c34){if(_0x2d8c34){_0x5a2142=_0x2d8c34;if(_0x39577d){var _0x5a50a1=null;for(var _0x57186a=0x1;_0x57186a<_0x56e768['Messages'][_0xb087('0x54')];++_0x57186a){_0x5a50a1=_0x56e768[_0xb087('0xf8')][_0x57186a];var _0x4cbc90=_0x5a50a1[_0xb087('0x84')]?util['format'](_0xb087('0xf9'),_0x24171a[_0xb087('0xfa')],_0x5a50a1[_0xb087('0x84')]):_0xb087('0xfb');var _0x39f701=_0x120012[_0xb087('0x3f')][_0xb087('0xfc')]||util[_0xb087('0xf4')](_0xb087('0xf9'),_0xb087('0xfd'),_0x5a50a1[_0xb087('0x7d')]);switch(_0x24171a['agentIdentifier']){case _0xb087('0xfe'):_0x4cbc90=_0x5a50a1[_0xb087('0x84')]?util[_0xb087('0xf4')](_0xb087('0xf9'),_0x24171a['agentAlias'],_0x5a50a1[_0xb087('0x84')]):_0xb087('0xfb');break;case _0xb087('0xff'):_0x4cbc90=_0x5a50a1[_0xb087('0x84')]?_0x5a50a1[_0xb087('0x81')][_0xb087('0x100')]||_0x5a50a1[_0xb087('0x81')][_0xb087('0x45')]:_0xb087('0xfb');break;case _0xb087('0x101'):_0x4cbc90=_0x5a50a1[_0xb087('0x84')]?_0x5a50a1[_0xb087('0x81')][_0xb087('0x45')]:_0xb087('0xfb');break;default:_0x4cbc90=_0x5a50a1[_0xb087('0x84')]?util[_0xb087('0xf4')](_0xb087('0xf9'),_0x24171a[_0xb087('0xfa')],_0x5a50a1['UserId']):_0xb087('0xfb');}var _0x2c85ed=util[_0xb087('0xf4')](_0xb087('0x102'),moment(_0x5a50a1['createdAt'])[_0xb087('0xf4')](_0xb087('0x103')),_0x5a50a1[_0xb087('0x104')]==='in'?_0x39f701:_0x4cbc90,_0x5a50a1[_0xb087('0x3f')]);if(!_0x5a50a1[_0xb087('0x105')]){fs['appendFileSync'](_0x39577d,_0x2c85ed);}}return db[_0xb087('0x106')][_0xb087('0xcd')]({'where':{'service':!![]},'include':[{'model':db[_0xb087('0x107')],'as':_0xb087('0x108'),'raw':!![]}]});}}})[_0xb087('0x25')](function(_0x17ad89){if(_0x17ad89&&_0x17ad89[_0xb087('0x108')]&&_0x120012[_0xb087('0x3f')]){var _0x58a76b={'tls':{'rejectUnauthorized':![]}};if(_0x17ad89[_0xb087('0x108')][_0xb087('0x109')]){_0x58a76b['service']=_0x17ad89[_0xb087('0x108')][_0xb087('0x109')];}else{_0x58a76b['host']=_0x17ad89[_0xb087('0x108')][_0xb087('0x10a')];_0x58a76b[_0xb087('0x10b')]=_0x17ad89[_0xb087('0x108')][_0xb087('0x10b')];_0x58a76b[_0xb087('0x10c')]=_0x17ad89[_0xb087('0x108')]['secure'];}if(_0x17ad89[_0xb087('0x108')][_0xb087('0x10d')]){_0x58a76b[_0xb087('0x10e')]={'user':_0x17ad89[_0xb087('0x108')][_0xb087('0xa6')],'pass':_0x17ad89[_0xb087('0x108')]['pass']};}return respondWithRpcPromise(_0xb087('0x10f'),_0xb087('0x110'),{'account':_0x58a76b,'message':{'from':util[_0xb087('0xf4')](_0xb087('0x111'),_0x17ad89[_0xb087('0x3d')],_0x17ad89['email']||_0x17ad89[_0xb087('0x108')][_0xb087('0xa6')]),'to':_0x120012[_0xb087('0x3f')]['mailTranscript'],'subject':_0xb087('0x112'),'text':util['format'](_0xb087('0x113'),_0x120012['body'][_0xb087('0xf2')]),'attachments':[{'path':_0x39577d}]}})['then'](function(){return _0x56e768;})[_0xb087('0xc9')](function(_0x3d916e){console['error'](_0x3d916e);});}else{return _0x56e768;}})[_0xb087('0x25')](respondWithStatusCode(_0x385065,0xc8))['catch'](handleError(_0x385065,null));};exports['addMessage']=function(_0x5180ad,_0x396660,_0x4b2169){return db[_0xb087('0xdc')]['find']({'where':{'id':_0x5180ad['params']['id']}})[_0xb087('0x25')](handleEntityNotFound(_0x396660,null))[_0xb087('0x25')](function(_0x371655){if(_0x371655){return _0x371655[_0xb087('0x114')](_0x5180ad[_0xb087('0x3f')]['ids'],_[_0xb087('0x115')](_0x5180ad[_0xb087('0x3f')],[_0xb087('0x116'),'id'])||{});}})[_0xb087('0x25')](respondWithResult(_0x396660,null))[_0xb087('0xc9')](handleError(_0x396660,null));};exports[_0xb087('0x117')]=function(_0x1ca818,_0x2ec638,_0x57d42a){var _0x451c8a={'raw':![],'where':{}};var _0x3768db={};var _0x1db8ba={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xb087('0xcd')]({'where':{'id':_0x1ca818[_0xb087('0xc5')]['id']}})[_0xb087('0x25')](handleEntityNotFound(_0x2ec638,null))['then'](function(_0x4904ea){if(_0x4904ea){_0x3768db[_0xb087('0x4f')]=_[_0xb087('0x86')](db[_0xb087('0xdc')][_0xb087('0xc6')]);_0x3768db['query']=_[_0xb087('0x86')](_0x1ca818[_0xb087('0x50')]);_0x3768db[_0xb087('0x59')]=_[_0xb087('0x51')](_0x3768db[_0xb087('0x4f')],_0x3768db['query']);_0x451c8a['attributes']=_[_0xb087('0x51')](_0x3768db[_0xb087('0x4f')],qs['fields'](_0x1ca818[_0xb087('0x50')][_0xb087('0x53')]));_0x451c8a[_0xb087('0x52')]=_0x451c8a[_0xb087('0x52')][_0xb087('0x54')]?_0x451c8a[_0xb087('0x52')]:_0x3768db[_0xb087('0x4f')];if(!_0x1ca818['query'][_0xb087('0x55')](_0xb087('0x118'))){_0x451c8a[_0xb087('0x34')]=qs['limit'](_0x1ca818['query'][_0xb087('0x34')]);_0x451c8a[_0xb087('0x32')]=qs[_0xb087('0x32')](_0x1ca818[_0xb087('0x50')]['offset']);}_0x451c8a[_0xb087('0x56')]=qs[_0xb087('0x57')](_0x1ca818[_0xb087('0x50')]['sort']);_0x451c8a['where']=qs[_0xb087('0x59')](_['pick'](_0x1ca818[_0xb087('0x50')],_0x3768db[_0xb087('0x59')]));_0x451c8a['where']['ChatInteractionId']=_0x4904ea['id'];if(_0x1ca818[_0xb087('0x50')][_0xb087('0x119')]){_0x451c8a[_0xb087('0x8f')]=_[_0xb087('0xae')](_0x451c8a['where'],{'$or':_[_0xb087('0x44')](_0x451c8a['attributes'],function(_0x52cc1a){var _0x117552={};_0x117552[_0x52cc1a]={'$like':'%'+_0x1ca818[_0xb087('0x50')][_0xb087('0x119')]+'%'};return _0x117552;})});}if(_0x1ca818[_0xb087('0x50')][_0xb087('0x8d')]){var _0x484bb5=_0x1ca818[_0xb087('0x50')]['$gte']['split'](',');var _0x46f8cf={};_0x46f8cf[_0x484bb5[0x0]]={'$gte':moment(_0x484bb5[0x1])[_0xb087('0xf4')]('YYYY-MM-DD\x20HH:mm:ss')};_0x451c8a[_0xb087('0x8f')]=_[_0xb087('0xae')](_0x451c8a[_0xb087('0x8f')],_0x46f8cf);}_0x451c8a=_[_0xb087('0xae')]({},_0x451c8a,_0x1ca818['options']);return db[_0xb087('0xdc')][_0xb087('0x35')]({'where':_0x451c8a[_0xb087('0x8f')]})[_0xb087('0x25')](function(_0x2c3d1b){_0x1db8ba['count']=_0x2c3d1b;if(_0x1ca818['query']['includeAll']){_0x451c8a[_0xb087('0xc7')]=[{'all':!![]}];}return db['ChatMessage'][_0xb087('0x11a')](_0x451c8a);})[_0xb087('0x25')](function(_0x4c1577){_0x1db8ba[_0xb087('0x11b')]=_0x4c1577;return _0x1db8ba;});}})[_0xb087('0x25')](respondWithFilteredResult(_0x2ec638,_0x451c8a))[_0xb087('0xc9')](handleError(_0x2ec638,null));};exports[_0xb087('0x11c')]=function(_0xad3eae,_0xb6682a,_0x1dbeb1){var _0x2caa79={'where':{}},_0x521e0c={},_0x1ffbd9={'count':0x0,'rows':[]};return db[_0xb087('0x4b')][_0xb087('0xcd')]({'where':{'id':_0xad3eae['params']['id']}})[_0xb087('0x25')](handleEntityNotFound(_0xb6682a,null))[_0xb087('0x25')](function(_0x3fd51b){if(_0x3fd51b){_0x521e0c[_0xb087('0x4f')]=_['keys'](db['ChatMessage'][_0xb087('0xc6')]);_0x521e0c[_0xb087('0x50')]=_[_0xb087('0x86')](_0xad3eae[_0xb087('0x50')]);_0x521e0c[_0xb087('0x59')]=_[_0xb087('0x51')](_0x521e0c['model'],_0x521e0c['query']);_0x2caa79[_0xb087('0x52')]=_[_0xb087('0x51')](_0x521e0c[_0xb087('0x4f')],qs[_0xb087('0x53')](_0xad3eae['query'][_0xb087('0x53')]));_0x2caa79[_0xb087('0x52')]=_0x2caa79[_0xb087('0x52')][_0xb087('0x54')]?_0x2caa79[_0xb087('0x52')]:_0x521e0c[_0xb087('0x4f')];if(!_0xad3eae[_0xb087('0x50')][_0xb087('0x55')](_0xb087('0x118'))){_0x2caa79[_0xb087('0x34')]=qs[_0xb087('0x34')](_0xad3eae[_0xb087('0x50')][_0xb087('0x34')]);_0x2caa79[_0xb087('0x32')]=qs[_0xb087('0x32')](_0xad3eae[_0xb087('0x50')][_0xb087('0x32')]);}_0x2caa79[_0xb087('0x56')]=qs[_0xb087('0x57')](_0xad3eae[_0xb087('0x50')]['sort']);_0x2caa79[_0xb087('0x8f')]=qs[_0xb087('0x59')](_['pick'](_0xad3eae[_0xb087('0x50')],_0x521e0c[_0xb087('0x59')]));_0x2caa79[_0xb087('0x8f')]['ChatInteractionId']=_0x3fd51b['id'];if(_0xad3eae[_0xb087('0x50')]['filter']){_0x2caa79['where']=_[_0xb087('0xae')](_0x2caa79[_0xb087('0x8f')],{'$or':_[_0xb087('0x44')](_0x2caa79[_0xb087('0x52')],function(_0x4a1749){var _0x300e08={};_0x300e08[_0x4a1749]={'$like':'%'+_0xad3eae['query'][_0xb087('0x119')]+'%'};return _0x300e08;})});}_0x2caa79[_0xb087('0x8f')][_0xb087('0x105')]=![];if(_0xad3eae['query']['id']){_0x2caa79['where']['id']={'$gt':_0xad3eae[_0xb087('0x50')]['id']};}_0x2caa79=_['merge']({},_0x2caa79,_0xad3eae['options']);return db[_0xb087('0xdc')][_0xb087('0x35')]({'where':_0x2caa79['where']})[_0xb087('0x25')](function(_0x241c68){_0x1ffbd9[_0xb087('0x35')]=_0x241c68;_0x2caa79[_0xb087('0xc7')]=[];if(_0xad3eae['query']['includeAgent']){_0x2caa79[_0xb087('0xc7')][_0xb087('0xc2')]({'model':db[_0xb087('0x81')],'as':_0xb087('0x81'),'attributes':['id','fullname',_0xb087('0x100')]});}if(_0xad3eae[_0xb087('0x50')][_0xb087('0x11d')]){_0x2caa79[_0xb087('0xc7')]=[{'all':!![]}];}return db[_0xb087('0xdc')][_0xb087('0x11a')](_0x2caa79);})[_0xb087('0x25')](function(_0x3b5740){_0x1ffbd9['rows']=_0x3b5740;return _0x1ffbd9;});}})[_0xb087('0x25')](respondWithFilteredResult(_0xb6682a,_0x2caa79))[_0xb087('0xc9')](handleError(_0xb6682a,null));};exports[_0xb087('0x11e')]=function(_0x594ddc,_0x30521e,_0x13acd8){return db[_0xb087('0x4b')][_0xb087('0x74')]({'where':{'id':_0x594ddc[_0xb087('0xc5')]['id']}})[_0xb087('0x25')](handleEntityNotFound(_0x30521e,null))['then'](function(_0x528edd){if(_0x528edd){return _0x528edd[_0xb087('0x11f')](_0x594ddc[_0xb087('0x3f')][_0xb087('0x116')],_[_0xb087('0x115')](_0x594ddc[_0xb087('0x3f')],[_0xb087('0x116'),'id'])||{})['spread'](function(){return db['Tag'][_0xb087('0x11a')]({'attributes':['id',_0xb087('0x3d'),'color'],'where':{'id':_0x594ddc['body'][_0xb087('0x116')]}});})[_0xb087('0x25')](function(_0x24ae87){socket['emit'](_0xb087('0x120'),{'id':Number(_0x594ddc[_0xb087('0xc5')]['id']),'tags':_0x24ae87||[]});return{'id':Number(_0x594ddc['params']['id']),'tags':_0x24ae87||[]};});}})[_0xb087('0x25')](respondWithResult(_0x30521e,null))['catch'](handleError(_0x30521e,null));};exports['removeTags']=function(_0x592d18,_0x5cbda4,_0x5a182e){return db[_0xb087('0x4b')]['find']({'where':{'id':_0x592d18[_0xb087('0xc5')]['id']}})[_0xb087('0x25')](handleEntityNotFound(_0x5cbda4,null))['then'](function(_0x12f2b2){if(_0x12f2b2){return _0x12f2b2[_0xb087('0x121')](_0x592d18[_0xb087('0x50')][_0xb087('0x116')]);}})['then'](respondWithStatusCode(_0x5cbda4,null))[_0xb087('0xc9')](handleError(_0x5cbda4,null));};exports[_0xb087('0xf0')]=function(_0x17d60b,_0x5df18d){var _0x538812=moment()[_0xb087('0x122')]()[_0xb087('0xac')]();var _0x39732b=path[_0xb087('0xec')](config[_0xb087('0xed')],'server',_0xb087('0x123'),'tmp');var _0x1d8582=path[_0xb087('0xec')](config['root'],_0xb087('0x124'),'files',_0xb087('0x125'));var _0x3f2e19=path[_0xb087('0xec')](_0x39732b,_0x538812);var _0x2d500c=util[_0xb087('0xf4')](_0xb087('0x126'),_0x17d60b[_0xb087('0xc5')]['id'],_0x538812);var _0x407837=path['join'](_0x39732b,_0x2d500c);var _0x220896=[];_0x220896[_0xb087('0xc2')]({'model':db[_0xb087('0x81')],'as':_0xb087('0x81'),'attributes':['id',_0xb087('0x45')],'raw':!![]});_0x220896[_0xb087('0xc2')]({'model':db[_0xb087('0xde')],'as':_0xb087('0xdf'),'attributes':['id',_0xb087('0x127'),'lastName'],'raw':!![]});if(_0x17d60b[_0xb087('0x50')][_0xb087('0x125')]){_0x220896[_0xb087('0xc2')]({'model':db[_0xb087('0xe9')],'as':_0xb087('0xe9'),'raw':!![]});}var _0x6fa760=[{'model':db['ChatMessage'],'as':_0xb087('0xf8'),'attributes':['id',_0xb087('0x3f'),_0xb087('0x8b'),'direction',_0xb087('0x105'),_0xb087('0x92')],'include':_0x220896}];_0x6fa760[_0xb087('0xc2')]({'model':db['ChatWebsite'],'as':_0xb087('0x128'),'attributes':['id',_0xb087('0x3d')]});_0x6fa760['push']({'model':db[_0xb087('0x81')],'as':_0xb087('0x129'),'attributes':['id',_0xb087('0x45')]});return db[_0xb087('0x4b')][_0xb087('0x74')]({'where':{'id':_0x17d60b['params']['id']},'include':_0x6fa760})[_0xb087('0x25')](handleEntityNotFound(_0x5df18d,null))[_0xb087('0x25')](function(_0x196111){if(_0x196111){var _0x2711ed=_0x196111['get']({'plain':!![]});fs['mkdirSync'](_0x3f2e19);var _0x2aa136={'channel':'Chat','account':_0x2711ed[_0xb087('0x128')][_0xb087('0x3d')],'agent':_0x2711ed['Owner']?_0x2711ed[_0xb087('0x129')][_0xb087('0x45')]:'N.A.','createdAt':moment(_0x2711ed['createdAt'])[_0xb087('0xf4')](_0xb087('0x12a'))[_0xb087('0xac')](),'closedAt':_0x2711ed['closed']?moment(_0x2711ed['closedAt'])['format'](_0xb087('0x12a'))[_0xb087('0xac')]():'','disposition':_0x2711ed[_0xb087('0xe3')],'chatInfo':{'browser':_0x2711ed['browserName'],'os':_0x2711ed['osName'],'referer':_0x2711ed[_0xb087('0x12b')],'customerIp':_0x2711ed[_0xb087('0x12c')],'customerPort':_0x2711ed[_0xb087('0x12d')]?_0x2711ed[_0xb087('0x12d')]:_0xb087('0x12e')},'messages':_(_0x2711ed[_0xb087('0xf8')])[_0xb087('0x12f')]()[_0xb087('0x119')]({'secret':![]})[_0xb087('0x44')](function(_0x4392f7){if(_0x4392f7[_0xb087('0xe9')]){var _0x2ce41b=path[_0xb087('0xec')](_0x1d8582,_0x4392f7[_0xb087('0xe9')][_0xb087('0xef')]);if(fs[_0xb087('0x130')](_0x2ce41b)){fs['createReadStream'](_0x2ce41b)[_0xb087('0x131')](fs[_0xb087('0x132')](path['join'](_0x3f2e19,_0x4392f7['Attachment'][_0xb087('0xef')])));}}return{'date':moment(_0x4392f7[_0xb087('0x8b')])[_0xb087('0xf4')](_0xb087('0x12a'))['toString'](),'sender':_0x4392f7[_0xb087('0x104')]===_0xb087('0x133')?_0x4392f7['User']?_0x4392f7['User'][_0xb087('0x45')]:_0xb087('0xfb'):_0x4392f7[_0xb087('0xdf')]['firstName']+(_0x4392f7[_0xb087('0xdf')][_0xb087('0x134')]?'\x20'+_0x4392f7[_0xb087('0xdf')][_0xb087('0x134')]:''),'body':_0x4392f7[_0xb087('0xe9')]?_0x4392f7[_0xb087('0xe9')][_0xb087('0xef')]:_0x4392f7['body'],'direction':_0x4392f7[_0xb087('0x104')]===_0xb087('0x133')?'A':'C','secret':_0x4392f7[_0xb087('0x105')],'read':_0x4392f7[_0xb087('0x92')],'attachment':_0x4392f7[_0xb087('0xe9')]};})['value']()};return ejs['renderFile'](path[_0xb087('0xec')](config[_0xb087('0xed')],_0xb087('0x124'),'views',_0xb087('0x135')),{'interaction':_0x2aa136})[_0xb087('0x25')](function(_0x3e4bec){var _0x52b038=path[_0xb087('0xec')](_0x3f2e19,_0xb087('0x136')+_0x2711ed['id']+'-'+_0x538812+_0xb087('0x137'));var _0x4e6b9f={'path':_0x52b038,'channel':'Chat','interactionId':_0x2711ed['id']};return pdf['createPdfFromHTML'](_0x3e4bec,_0x4e6b9f);})[_0xb087('0x25')](function(){return new BPromise(function(_0x22dea9,_0x1c9337){zipdir(_0x3f2e19,{'saveTo':_0x407837},function(_0x3d0278,_0x1c8982){if(_0x3d0278)return _0x1c9337(_0x3d0278);return _0x22dea9(_0x1c8982);});})[_0xb087('0x25')](function(){return new BPromise(function(_0x31b3e7,_0x6b8337){rimraf(_0x3f2e19,function(_0x348c92){if(_0x348c92)_0x6b8337(_0x348c92);return _0x31b3e7();});});})[_0xb087('0x25')](function(){return _0x5df18d[_0xb087('0xf0')](_0x407837,_0x2d500c,function(_0x218e1c){if(_0x218e1c){console[_0xb087('0x138')](_0xb087('0x139'),_0x218e1c);}else{fs[_0xb087('0x13a')](_0x407837);}});});});}else{return _0x5df18d[_0xb087('0x2e')](0xc8);}})[_0xb087('0xc9')](handleError(_0x5df18d,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index d1098d3..de52a2d 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 _0x0dcc=['ChatInteraction','setMaxListeners','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x16dd98,_0x11d346){var _0xfc7fb3=function(_0x40d7d8){while(--_0x40d7d8){_0x16dd98['push'](_0x16dd98['shift']());}};_0xfc7fb3(++_0x11d346);}(_0x0dcc,0x174));var _0xc0dc=function(_0x3aa654,_0x314823){_0x3aa654=_0x3aa654-0x0;var _0x4d826f=_0x0dcc[_0x3aa654];return _0x4d826f;};'use strict';var EventEmitter=require(_0xc0dc('0x0'));var ChatInteraction=require(_0xc0dc('0x1'))['db'][_0xc0dc('0x2')];var ChatMessage=require(_0xc0dc('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xc0dc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4b56ad){return function(_0x21f498,_0x3ee96e,_0x58d830){_0x21f498[_0xc0dc('0x4')]({'attributes':['id'],'raw':!![]})['then'](function(_0x292515){_0x21f498[_0xc0dc('0x5')](_0xc0dc('0x6'),_0x292515[_0xc0dc('0x7')](function(_0xe0ed65){return{'id':_0xe0ed65['id']};}));return ChatMessage[_0xc0dc('0x8')]({'where':{'ChatInteractionId':_0x21f498['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc0dc('0x9')](function(_0x3fa4c5){_0x21f498[_0xc0dc('0x5')](_0xc0dc('0xa'),_0x3fa4c5[_0xc0dc('0xb')]);ChatInteractionEvents[_0xc0dc('0xc')](_0x4b56ad+':'+_0x21f498['id'],_0x21f498);ChatInteractionEvents[_0xc0dc('0xc')](_0x4b56ad,_0x21f498);_0x58d830(null);})[_0xc0dc('0xd')](_0x58d830(null));};}for(var e in events){if(events[_0xc0dc('0xe')](e)){var event=events[e];ChatInteraction[_0xc0dc('0xf')](e,emitEvent(event));}}module[_0xc0dc('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0xd7c7=['setDataValue','Users','unreadMessages','length','emit','catch','exports','events','../../mysqldb','ChatInteraction','ChatMessage','save','update','remove'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xd7c7,0x173));var _0x7d7c=function(_0x4994cb,_0x22cdd3){_0x4994cb=_0x4994cb-0x0;var _0x3324d0=_0xd7c7[_0x4994cb];return _0x3324d0;};'use strict';var EventEmitter=require(_0x7d7c('0x0'));var ChatInteraction=require(_0x7d7c('0x1'))['db'][_0x7d7c('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0x7d7c('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7d7c('0x4'),'afterUpdate':_0x7d7c('0x5'),'afterDestroy':_0x7d7c('0x6')};function emitEvent(_0x4e0814){return function(_0x101771,_0xe2cf4c,_0x1fd274){_0x101771['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x11b9b7){_0x101771[_0x7d7c('0x7')](_0x7d7c('0x8'),_0x11b9b7['map'](function(_0x5c5581){return{'id':_0x5c5581['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x101771['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1bb75f){_0x101771[_0x7d7c('0x7')](_0x7d7c('0x9'),_0x1bb75f[_0x7d7c('0xa')]);ChatInteractionEvents[_0x7d7c('0xb')](_0x4e0814+':'+_0x101771['id'],_0x101771);ChatInteractionEvents[_0x7d7c('0xb')](_0x4e0814,_0x101771);_0x1fd274(null);})[_0x7d7c('0xc')](_0x1fd274(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x7d7c('0xd')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 8383690..1dcdce6 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 _0x08a0=['define','ChatInteraction','chat_interactions','closedAt','format','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatInteraction.attributes'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x08a0,0x66));var _0x008a=function(_0x4697fa,_0x21c841){_0x4697fa=_0x4697fa-0x0;var _0x390950=_0x08a0[_0x4697fa];return _0x390950;};'use strict';var _=require(_0x008a('0x0'));var util=require(_0x008a('0x1'));var logger=require(_0x008a('0x2'))(_0x008a('0x3'));var moment=require(_0x008a('0x4'));var BPromise=require(_0x008a('0x5'));var rp=require(_0x008a('0x6'));var fs=require('fs');var path=require(_0x008a('0x7'));var rimraf=require(_0x008a('0x8'));var config=require('../../config/environment');var attributes=require(_0x008a('0x9'));module['exports']=function(_0x409843,_0x2feb7f){return _0x409843[_0x008a('0xa')](_0x008a('0xb'),attributes,{'tableName':_0x008a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x30858c,_0x5a05e0,_0x372eae){if(_0x30858c['changed']('closed')){_0x30858c[_0x008a('0xd')]=moment()[_0x008a('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x372eae(null,_0x30858c);}},'charset':_0x008a('0xf'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7c80=['ChatInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x4810b8,_0x549a3c){var _0x505e94=function(_0x81186c){while(--_0x81186c){_0x4810b8['push'](_0x4810b8['shift']());}};_0x505e94(++_0x549a3c);}(_0x7c80,0x7e));var _0x07c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c80[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x07c8('0x0'));var logger=require(_0x07c8('0x1'))('api');var moment=require(_0x07c8('0x2'));var BPromise=require(_0x07c8('0x3'));var rp=require(_0x07c8('0x4'));var fs=require('fs');var path=require(_0x07c8('0x5'));var rimraf=require(_0x07c8('0x6'));var config=require(_0x07c8('0x7'));var attributes=require('./chatInteraction.attributes');module[_0x07c8('0x8')]=function(_0x376e35,_0x16696f){return _0x376e35[_0x07c8('0x9')](_0x07c8('0xa'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x32960c,_0x2a6b16,_0x4c33c0){if(_0x32960c['changed'](_0x07c8('0xb'))){_0x32960c[_0x07c8('0xc')]=moment()[_0x07c8('0xd')](_0x07c8('0xe'));}_0x4c33c0(null,_0x32960c);}},'charset':_0x07c8('0xf'),'collate':_0x07c8('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index dfc653b..20b2ecc 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 _0x1a0e=['UpdateChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatInteraction,\x20%s,\x20%s','result','catch','ChatInteraction','update','body','options','raw','where','attributes','limit','then','info'];(function(_0xf8df6c,_0x4e2c4a){var _0xde757f=function(_0x66e1c0){while(--_0x66e1c0){_0xf8df6c['push'](_0xf8df6c['shift']());}};_0xde757f(++_0x4e2c4a);}(_0x1a0e,0x167));var _0xe1a0=function(_0x5c88c8,_0x2c04cf){_0x5c88c8=_0x5c88c8-0x0;var _0x7b15d5=_0x1a0e[_0x5c88c8];return _0x7b15d5;};'use strict';var _=require(_0xe1a0('0x0'));var util=require(_0xe1a0('0x1'));var moment=require(_0xe1a0('0x2'));var BPromise=require('bluebird');var rs=require(_0xe1a0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe1a0('0x4'));var logger=require(_0xe1a0('0x5'))(_0xe1a0('0x6'));var config=require(_0xe1a0('0x7'));var jayson=require(_0xe1a0('0x8'));var client=jayson[_0xe1a0('0x9')][_0xe1a0('0xa')]({'port':0x232a});config[_0xe1a0('0xb')]=_[_0xe1a0('0xc')](config[_0xe1a0('0xb')],{'host':_0xe1a0('0xd'),'port':0x18eb});var socket=require(_0xe1a0('0xe'))(new Redis(config[_0xe1a0('0xb')]));require(_0xe1a0('0xf'))[_0xe1a0('0x10')](socket);function respondWithRpcPromise(_0x4400ee,_0x4e60ed,_0x50f36f){return new BPromise(function(_0x160679,_0x65ac46){return client[_0xe1a0('0x11')](_0x4400ee,_0x50f36f)['then'](function(_0x1f8186){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x4e60ed,_0xe1a0('0x12'));logger[_0xe1a0('0x13')](_0xe1a0('0x14'),_0x4e60ed,'request\x20sent',JSON[_0xe1a0('0x15')](_0x1f8186));if(_0x1f8186[_0xe1a0('0x16')]){if(_0x1f8186[_0xe1a0('0x16')]['code']===0x1f4){logger[_0xe1a0('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x4e60ed,_0x1f8186[_0xe1a0('0x16')][_0xe1a0('0x17')]);return _0x65ac46(_0x1f8186[_0xe1a0('0x16')][_0xe1a0('0x17')]);}logger[_0xe1a0('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x4e60ed,_0x1f8186[_0xe1a0('0x16')][_0xe1a0('0x17')]);return _0x160679(_0x1f8186[_0xe1a0('0x16')][_0xe1a0('0x17')]);}else{logger['info'](_0xe1a0('0x18'),_0x4e60ed,_0xe1a0('0x12'));_0x160679(_0x1f8186[_0xe1a0('0x19')][_0xe1a0('0x17')]);}})[_0xe1a0('0x1a')](function(_0x2e50e4){logger[_0xe1a0('0x16')](_0xe1a0('0x18'),_0x4e60ed,_0x2e50e4);_0x65ac46(_0x2e50e4);});});}exports['UpdateChatInteraction']=function(_0x54d723){var _0x21c63d=this;return new Promise(function(_0x415401,_0x1d8ddc){return db[_0xe1a0('0x1b')][_0xe1a0('0x1c')](_0x54d723[_0xe1a0('0x1d')],{'raw':_0x54d723[_0xe1a0('0x1e')]?_0x54d723[_0xe1a0('0x1e')][_0xe1a0('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54d723[_0xe1a0('0x1e')]?_0x54d723[_0xe1a0('0x1e')][_0xe1a0('0x20')]||null:null,'attributes':_0x54d723[_0xe1a0('0x1e')]?_0x54d723[_0xe1a0('0x1e')][_0xe1a0('0x21')]||null:null,'limit':_0x54d723['options']?_0x54d723[_0xe1a0('0x1e')][_0xe1a0('0x22')]||null:null})[_0xe1a0('0x23')](function(_0x5c1e9e){logger[_0xe1a0('0x24')](_0xe1a0('0x25'),_0x54d723);logger[_0xe1a0('0x13')](_0xe1a0('0x25'),_0x54d723,JSON['stringify'](_0x5c1e9e));_0x415401(_0x5c1e9e);})[_0xe1a0('0x1a')](function(_0x16c398){logger['error'](_0xe1a0('0x25'),_0x16c398[_0xe1a0('0x17')],_0x54d723);_0x1d8ddc(_0x21c63d['error'](0x1f4,_0x16c398[_0xe1a0('0x17')]));});});};exports['AddTagsToChatInteraction']=function(_0xe528a6){return new Promise(function(_0x2363b1,_0x18cddc){return db[_0xe1a0('0x1b')][_0xe1a0('0x26')]({'where':_0xe528a6['options']?_0xe528a6[_0xe1a0('0x1e')][_0xe1a0('0x20')]||null:null})[_0xe1a0('0x23')](function(_0x4dd7c4){if(_0x4dd7c4){return _0x4dd7c4[_0xe1a0('0x27')](_0xe528a6['body'][_0xe1a0('0x28')],_[_0xe1a0('0x29')](_0xe528a6[_0xe1a0('0x1d')],[_0xe1a0('0x28'),'id'])||{});}})[_0xe1a0('0x2a')](function(_0x46a4fd){logger[_0xe1a0('0x24')](_0xe1a0('0x2b'),_0xe528a6);logger['debug'](_0xe1a0('0x2b'),_0xe528a6,JSON['stringify'](_0x46a4fd));_0x2363b1(_0x46a4fd);})[_0xe1a0('0x1a')](function(_0x134ebf){logger[_0xe1a0('0x16')](_0xe1a0('0x2b'),_0x134ebf['message'],_0xe528a6);_0x18cddc(_this[_0xe1a0('0x16')](0x1f4,_0x134ebf['message']));});});}; \ No newline at end of file +var _0xaf87=['../../config/environment','jayson/promise','client','redis','localhost','register','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateChatInteraction','ChatInteraction','update','options','attributes','catch','addTags','ids','omit','body','spread','AddTags','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf87,0x1b4));var _0x7af8=function(_0x1077a9,_0x2f4705){_0x1077a9=_0x1077a9-0x0;var _0x273e1c=_0xaf87[_0x1077a9];return _0x273e1c;};'use strict';var _=require(_0x7af8('0x0'));var util=require(_0x7af8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7af8('0x2'));var fs=require('fs');var Redis=require(_0x7af8('0x3'));var db=require(_0x7af8('0x4'))['db'];var utils=require(_0x7af8('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x7af8('0x6'));var jayson=require(_0x7af8('0x7'));var client=jayson[_0x7af8('0x8')]['http']({'port':0x232a});config[_0x7af8('0x9')]=_['defaults'](config[_0x7af8('0x9')],{'host':_0x7af8('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7af8('0x9')]));require('./chatInteraction.socket')[_0x7af8('0xb')](socket);function respondWithRpcPromise(_0x7e4330,_0x232925,_0x15cd0a){return new BPromise(function(_0x5582b1,_0x5d55e6){return client[_0x7af8('0xc')](_0x7e4330,_0x15cd0a)['then'](function(_0x585403){logger[_0x7af8('0xd')](_0x7af8('0xe'),_0x232925,_0x7af8('0xf'));logger[_0x7af8('0x10')](_0x7af8('0x11'),_0x232925,'request\x20sent',JSON[_0x7af8('0x12')](_0x585403));if(_0x585403[_0x7af8('0x13')]){if(_0x585403[_0x7af8('0x13')]['code']===0x1f4){logger[_0x7af8('0x13')](_0x7af8('0xe'),_0x232925,_0x585403['error'][_0x7af8('0x14')]);return _0x5d55e6(_0x585403[_0x7af8('0x13')][_0x7af8('0x14')]);}logger[_0x7af8('0x13')](_0x7af8('0xe'),_0x232925,_0x585403[_0x7af8('0x13')][_0x7af8('0x14')]);return _0x5582b1(_0x585403['error'][_0x7af8('0x14')]);}else{logger[_0x7af8('0xd')](_0x7af8('0xe'),_0x232925,_0x7af8('0xf'));_0x5582b1(_0x585403[_0x7af8('0x15')]['message']);}})['catch'](function(_0x3e89bd){logger[_0x7af8('0x13')](_0x7af8('0xe'),_0x232925,_0x3e89bd);_0x5d55e6(_0x3e89bd);});});}exports[_0x7af8('0x16')]=function(_0x153eaf){var _0x33e7dc=this;return new Promise(function(_0x556fb8,_0x30713c){return db[_0x7af8('0x17')][_0x7af8('0x18')](_0x153eaf['body'],{'raw':_0x153eaf['options']?_0x153eaf[_0x7af8('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x153eaf[_0x7af8('0x19')]?_0x153eaf[_0x7af8('0x19')]['where']||null:null,'attributes':_0x153eaf['options']?_0x153eaf[_0x7af8('0x19')][_0x7af8('0x1a')]||null:null,'limit':_0x153eaf['options']?_0x153eaf[_0x7af8('0x19')]['limit']||null:null})['then'](function(_0x476989){logger[_0x7af8('0xd')](_0x7af8('0x16'),_0x153eaf);logger[_0x7af8('0x10')](_0x7af8('0x16'),_0x153eaf,JSON[_0x7af8('0x12')](_0x476989));_0x556fb8(_0x476989);})[_0x7af8('0x1b')](function(_0x3b389c){logger['error'](_0x7af8('0x16'),_0x3b389c[_0x7af8('0x14')],_0x153eaf);_0x30713c(_0x33e7dc[_0x7af8('0x13')](0x1f4,_0x3b389c['message']));});});};exports['AddTagsToChatInteraction']=function(_0x5ae03c){return new Promise(function(_0x20c614,_0x2c8205){return db[_0x7af8('0x17')]['find']({'where':_0x5ae03c[_0x7af8('0x19')]?_0x5ae03c[_0x7af8('0x19')]['where']||null:null})['then'](function(_0x2f5018){if(_0x2f5018){return _0x2f5018[_0x7af8('0x1c')](_0x5ae03c['body'][_0x7af8('0x1d')],_[_0x7af8('0x1e')](_0x5ae03c[_0x7af8('0x1f')],['ids','id'])||{});}})[_0x7af8('0x20')](function(_0x540c69){logger[_0x7af8('0xd')](_0x7af8('0x21'),_0x5ae03c);logger[_0x7af8('0x10')](_0x7af8('0x21'),_0x5ae03c,JSON[_0x7af8('0x12')](_0x540c69));_0x20c614(_0x540c69);})[_0x7af8('0x1b')](function(_0x3040f8){logger[_0x7af8('0x13')]('AddTags',_0x3040f8[_0x7af8('0x14')],_0x5ae03c);_0x2c8205(_this[_0x7af8('0x13')](0x1f4,_0x3040f8[_0x7af8('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 6805db9..bf85c74 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 _0xec12=['save','update','emit','register','length','chatInteraction:','./chatInteraction.events'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xec12,0x1bf));var _0x2ec1=function(_0x55912c,_0xfe0245){_0x55912c=_0x55912c-0x0;var _0x2a5ca5=_0xec12[_0x55912c];return _0x2a5ca5;};'use strict';var ChatInteractionEvents=require(_0x2ec1('0x0'));var events=[_0x2ec1('0x1'),'remove',_0x2ec1('0x2')];function createListener(_0xb7d773,_0x341518){return function(_0x158287){_0x341518[_0x2ec1('0x3')](_0xb7d773,_0x158287);};}function removeListener(_0x2ddf1a,_0x3f612a){return function(){ChatInteractionEvents['removeListener'](_0x2ddf1a,_0x3f612a);};}exports[_0x2ec1('0x4')]=function(_0x334af7){for(var _0x249e61=0x0,_0x390d99=events[_0x2ec1('0x5')];_0x249e61<_0x390d99;_0x249e61++){var _0x46d3e6=events[_0x249e61];var _0x63aa1b=createListener(_0x2ec1('0x6')+_0x46d3e6,_0x334af7);ChatInteractionEvents['on'](_0x46d3e6,_0x63aa1b);}}; \ No newline at end of file +var _0xe01b=['emit','length','chatInteraction:','./chatInteraction.events','save','remove','update'];(function(_0x39ded1,_0xaee436){var _0x2e248e=function(_0x193df3){while(--_0x193df3){_0x39ded1['push'](_0x39ded1['shift']());}};_0x2e248e(++_0xaee436);}(_0xe01b,0x7a));var _0xbe01=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0xe01b[_0x256b72];return _0x2183e3;};'use strict';var ChatInteractionEvents=require(_0xbe01('0x0'));var events=[_0xbe01('0x1'),_0xbe01('0x2'),_0xbe01('0x3')];function createListener(_0x4c5001,_0x1ac197){return function(_0x353a07){_0x1ac197[_0xbe01('0x4')](_0x4c5001,_0x353a07);};}function removeListener(_0x30091f,_0x54b073){return function(){ChatInteractionEvents['removeListener'](_0x30091f,_0x54b073);};}exports['register']=function(_0x1d6b7f){for(var _0x2a70dd=0x0,_0x47bc30=events[_0xbe01('0x5')];_0x2a70dd<_0x47bc30;_0x2a70dd++){var _0x233497=events[_0x2a70dd];var _0x90f4=createListener(_0xbe01('0x6')+_0x233497,_0x1d6b7f);ChatInteractionEvents['on'](_0x233497,_0x90f4);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 98203fb..0e03a3e 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 _0x317a=['originalname','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','addTags','put','/:id','chatinteraction:update','update','/:id/custom_update','customUpdate','abandon','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','get','/describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','getMyMessages','/:id/download','download','post','createVidaooSession','diskStorage','server/files/attachments/','format','%s-%s','now'];(function(_0x2de0ec,_0x38812f){var _0x13aa7b=function(_0x340176){while(--_0x340176){_0x2de0ec['push'](_0x2de0ec['shift']());}};_0x13aa7b(++_0x38812f);}(_0x317a,0xae));var _0xa317=function(_0x46ec32,_0x1e842f){_0x46ec32=_0x46ec32-0x0;var _0x338f60=_0x317a[_0x46ec32];return _0x338f60;};'use strict';var multer=require(_0xa317('0x0'));var util=require(_0xa317('0x1'));var path=require(_0xa317('0x2'));var timeout=require('connect-timeout');var express=require(_0xa317('0x3'));var router=express[_0xa317('0x4')]();var fs_extra=require(_0xa317('0x5'));var auth=require(_0xa317('0x6'));var interaction=require(_0xa317('0x7'));var config=require(_0xa317('0x8'));var controller=require(_0xa317('0x9'));router['get']('/',auth[_0xa317('0xa')](),controller[_0xa317('0xb')]);router[_0xa317('0xc')](_0xa317('0xd'),auth[_0xa317('0xa')](),controller['describe']);router[_0xa317('0xc')]('/:id',auth[_0xa317('0xe')](),controller[_0xa317('0xf')]);router[_0xa317('0xc')](_0xa317('0x10'),auth[_0xa317('0xe')](),controller[_0xa317('0x11')]);router['get'](_0xa317('0x12'),auth['isAuthenticated'](),controller[_0xa317('0x13')]);router[_0xa317('0xc')]('/:id/my_messages',auth[_0xa317('0xe')](),controller[_0xa317('0x14')]);router['get'](_0xa317('0x15'),auth[_0xa317('0xa')](),controller[_0xa317('0x16')]);router[_0xa317('0x17')]('/',auth[_0xa317('0xa')](),controller['create']);router[_0xa317('0x17')]('/:id/vidaoo',auth[_0xa317('0xa')](),controller[_0xa317('0x18')]);var upload=multer({'storage':multer[_0xa317('0x19')]({'destination':function(_0x24d77a,_0x28be0f,_0x155a77){_0x155a77(null,path['join'](config['root'],_0xa317('0x1a')));},'filename':function(_0x26367e,_0x4eb517,_0x1355c8){_0x1355c8(null,util[_0xa317('0x1b')](_0xa317('0x1c'),Date[_0xa317('0x1d')](),_0x4eb517[_0xa317('0x1e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa317('0x17')](_0xa317('0x1f'),upload[_0xa317('0x20')](_0xa317('0x21')),controller[_0xa317('0x22')]);router[_0xa317('0x17')]('/:id/messages',auth[_0xa317('0xe')](),controller[_0xa317('0x23')]);router[_0xa317('0x17')](_0xa317('0x24'),auth[_0xa317('0xa')](),interaction[_0xa317('0x25')](_0xa317('0x26'),'chatinteraction:addtags'),controller[_0xa317('0x27')]);router[_0xa317('0x28')](_0xa317('0x29'),auth['isAuthenticated'](),interaction['tracked'](_0xa317('0x26'),_0xa317('0x2a')),controller[_0xa317('0x2b')]);router['put'](_0xa317('0x2c'),controller[_0xa317('0x2d')]);router[_0xa317('0x28')]('/:id/abandon',auth['isChatInteractionAuthorized'](),controller[_0xa317('0x2e')]);router[_0xa317('0x28')]('/:id/close',controller['close']);router['delete'](_0xa317('0x29'),auth[_0xa317('0xa')](),interaction[_0xa317('0x25')]('chat',_0xa317('0x2f')),controller[_0xa317('0x30')]);router['delete'](_0xa317('0x24'),auth[_0xa317('0xa')](),controller[_0xa317('0x31')]);module[_0xa317('0x32')]=router; \ No newline at end of file +var _0xa9f4=['attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','download','post','/:id/vidaoo','diskStorage','root','server/files/attachments/','format','%s-%s','now','originalname','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','chat','addTags','put','tracked','chatinteraction:update','update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','destroy','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0xa9f4,0xbe));var _0x4a9f=function(_0xb3192b,_0x7d4ca8){_0xb3192b=_0xb3192b-0x0;var _0x55c461=_0xa9f4[_0xb3192b];return _0x55c461;};'use strict';var multer=require(_0x4a9f('0x0'));var util=require(_0x4a9f('0x1'));var path=require(_0x4a9f('0x2'));var timeout=require(_0x4a9f('0x3'));var express=require(_0x4a9f('0x4'));var router=express[_0x4a9f('0x5')]();var fs_extra=require(_0x4a9f('0x6'));var auth=require(_0x4a9f('0x7'));var interaction=require(_0x4a9f('0x8'));var config=require(_0x4a9f('0x9'));var controller=require(_0x4a9f('0xa'));router[_0x4a9f('0xb')]('/',auth[_0x4a9f('0xc')](),controller[_0x4a9f('0xd')]);router[_0x4a9f('0xb')](_0x4a9f('0xe'),auth['isAuthenticated'](),controller[_0x4a9f('0xf')]);router[_0x4a9f('0xb')](_0x4a9f('0x10'),auth[_0x4a9f('0x11')](),controller['show']);router[_0x4a9f('0xb')]('/:id/attachment_download',auth[_0x4a9f('0x11')](),controller[_0x4a9f('0x12')]);router['get'](_0x4a9f('0x13'),auth[_0x4a9f('0xc')](),controller['getMessages']);router['get'](_0x4a9f('0x14'),auth['isChatInteractionAuthorized'](),controller[_0x4a9f('0x15')]);router[_0x4a9f('0xb')]('/:id/download',auth[_0x4a9f('0xc')](),controller[_0x4a9f('0x16')]);router[_0x4a9f('0x17')]('/',auth[_0x4a9f('0xc')](),controller['create']);router['post'](_0x4a9f('0x18'),auth[_0x4a9f('0xc')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x4a9f('0x19')]({'destination':function(_0x9c193a,_0x4be61b,_0x568fc1){_0x568fc1(null,path['join'](config[_0x4a9f('0x1a')],_0x4a9f('0x1b')));},'filename':function(_0x5064cf,_0x571148,_0x469197){_0x469197(null,util[_0x4a9f('0x1c')](_0x4a9f('0x1d'),Date[_0x4a9f('0x1e')](),_0x571148[_0x4a9f('0x1f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x4a9f('0x17')](_0x4a9f('0x20'),upload[_0x4a9f('0x21')](_0x4a9f('0x22')),controller[_0x4a9f('0x23')]);router['post'](_0x4a9f('0x13'),auth[_0x4a9f('0x11')](),controller[_0x4a9f('0x24')]);router[_0x4a9f('0x17')](_0x4a9f('0x25'),auth[_0x4a9f('0xc')](),interaction['tracked'](_0x4a9f('0x26'),'chatinteraction:addtags'),controller[_0x4a9f('0x27')]);router[_0x4a9f('0x28')](_0x4a9f('0x10'),auth[_0x4a9f('0xc')](),interaction[_0x4a9f('0x29')](_0x4a9f('0x26'),_0x4a9f('0x2a')),controller[_0x4a9f('0x2b')]);router[_0x4a9f('0x28')]('/:id/custom_update',controller[_0x4a9f('0x2c')]);router[_0x4a9f('0x28')](_0x4a9f('0x2d'),auth['isChatInteractionAuthorized'](),controller[_0x4a9f('0x2e')]);router[_0x4a9f('0x28')](_0x4a9f('0x2f'),controller[_0x4a9f('0x30')]);router[_0x4a9f('0x31')](_0x4a9f('0x10'),auth[_0x4a9f('0xc')](),interaction[_0x4a9f('0x29')]('chat','chatinteraction:destroy'),controller[_0x4a9f('0x32')]);router[_0x4a9f('0x31')](_0x4a9f('0x25'),auth[_0x4a9f('0xc')](),controller[_0x4a9f('0x33')]);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 7177c51..8e6b99f 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 _0x0eab=['TEXT','medium','BOOLEAN','INTEGER','exports'];(function(_0x29dacb,_0x1e6ae4){var _0x52c9b8=function(_0x525e82){while(--_0x525e82){_0x29dacb['push'](_0x29dacb['shift']());}};_0x52c9b8(++_0x1e6ae4);}(_0x0eab,0x11c));var _0xb0ea=function(_0x394983,_0x1bc2ff){_0x394983=_0x394983-0x0;var _0x294f16=_0x0eab[_0x394983];return _0x294f16;};'use strict';var Sequelize=require('sequelize');module[_0xb0ea('0x0')]={'body':{'type':Sequelize[_0xb0ea('0x1')](_0xb0ea('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xb0ea('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xb0ea('0x4')]}}; \ No newline at end of file +var _0x57f5=['TEXT','INTEGER','exports'];(function(_0x4642b0,_0x541c72){var _0x5e52d3=function(_0x50b0ed){while(--_0x50b0ed){_0x4642b0['push'](_0x4642b0['shift']());}};_0x5e52d3(++_0x541c72);}(_0x57f5,0xfb));var _0x557f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x57f5[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x557f('0x0')]={'body':{'type':Sequelize[_0x557f('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x557f('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index abef509..ed54cff 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 _0xdc6d=['mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','ChatInternalMessage','includeAll','include','catch','show','params','find','create','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','findAll','agent','admin','user','fullname','role','internal','online','allowmessenger','-online','VoiceQueue','Agents','userProfileId','autoAssociation','isEmpty','push','read','-createdAt','all','eml-format','rimraf','zip-dir','request-promise'];(function(_0xe23713,_0x419a1b){var _0x1ac7ce=function(_0x2f51c2){while(--_0x2f51c2){_0xe23713['push'](_0xe23713['shift']());}};_0x1ac7ce(++_0x419a1b);}(_0xdc6d,0x13a));var _0xddc6=function(_0x7588a,_0x1329c9){_0x7588a=_0x7588a-0x0;var _0x4a67ef=_0xdc6d[_0x7588a];return _0x4a67ef;};'use strict';var emlformat=require(_0xddc6('0x0'));var rimraf=require(_0xddc6('0x1'));var zipdir=require(_0xddc6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xddc6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xddc6('0x4'));var util=require(_0xddc6('0x5'));var path=require(_0xddc6('0x6'));var sox=require(_0xddc6('0x7'));var csv=require('to-csv');var ejs=require(_0xddc6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xddc6('0x9'));var squel=require(_0xddc6('0xa'));var crypto=require(_0xddc6('0xb'));var jsforce=require(_0xddc6('0xc'));var deskjs=require(_0xddc6('0xd'));var toCsv=require(_0xddc6('0xe'));var querystring=require(_0xddc6('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xddc6('0x10'));var qs=require(_0xddc6('0x11'));var as=require(_0xddc6('0x12'));var hardwareService=require(_0xddc6('0x13'));var logger=require(_0xddc6('0x14'))('api');var utils=require(_0xddc6('0x15'));var config=require(_0xddc6('0x16'));var licenseUtil=require(_0xddc6('0x17'));var db=require(_0xddc6('0x18'))['db'];config[_0xddc6('0x19')]=_[_0xddc6('0x1a')](config[_0xddc6('0x19')],{'host':_0xddc6('0x1b'),'port':0x18eb});var socket=require(_0xddc6('0x1c'))(new Redis(config['redis']));require(_0xddc6('0x1d'))[_0xddc6('0x1e')](socket);function respondWithStatusCode(_0x1298f9,_0x31e1b2){_0x31e1b2=_0x31e1b2||0xcc;return function(_0x156d8b){if(_0x156d8b){return _0x1298f9[_0xddc6('0x1f')](_0x31e1b2);}return _0x1298f9[_0xddc6('0x20')](_0x31e1b2)['end']();};}function respondWithResult(_0x42c112,_0x191cac){_0x191cac=_0x191cac||0xc8;return function(_0x53c483){if(_0x53c483){return _0x42c112[_0xddc6('0x20')](_0x191cac)[_0xddc6('0x21')](_0x53c483);}};}function respondWithFilteredResult(_0x54925d,_0x57212a){return function(_0x31be5d){if(_0x31be5d){var _0x5d9823=typeof _0x57212a[_0xddc6('0x22')]==='undefined'&&typeof _0x57212a[_0xddc6('0x23')]===_0xddc6('0x24');var _0x3813ef=_0x31be5d['count'];var _0x5cf52f=_0x5d9823?0x0:_0x57212a[_0xddc6('0x22')];var _0x41dc43=_0x5d9823?_0x31be5d[_0xddc6('0x25')]:_0x57212a[_0xddc6('0x22')]+_0x57212a[_0xddc6('0x23')];var _0x370f9f;if(_0x41dc43>=_0x3813ef){_0x41dc43=_0x3813ef;_0x370f9f=0xc8;}else{_0x370f9f=0xce;}_0x54925d[_0xddc6('0x20')](_0x370f9f);return _0x54925d['set'](_0xddc6('0x26'),_0x5cf52f+'-'+_0x41dc43+'/'+_0x3813ef)[_0xddc6('0x21')](_0x31be5d);}return null;};}function patchUpdates(_0x4d5f7b){return function(_0x2bdc07){try{jsonpatch[_0xddc6('0x27')](_0x2bdc07,_0x4d5f7b,!![]);}catch(_0x2f066a){return BPromise[_0xddc6('0x28')](_0x2f066a);}return _0x2bdc07['save']();};}function saveUpdates(_0x429f58,_0x2b2a04){return function(_0x309827){if(_0x309827){return _0x309827[_0xddc6('0x29')](_0x429f58)[_0xddc6('0x2a')](function(_0x285574){return _0x285574;});}return null;};}function removeEntity(_0x6638c5,_0x1b3e45){return function(_0x4106e0){if(_0x4106e0){return _0x4106e0[_0xddc6('0x2b')]()[_0xddc6('0x2a')](function(){_0x6638c5['status'](0xcc)[_0xddc6('0x2c')]();});}};}function handleEntityNotFound(_0x3811df,_0x2d6602){return function(_0x93ed9f){if(!_0x93ed9f){_0x3811df[_0xddc6('0x1f')](0x194);}return _0x93ed9f;};}function handleError(_0x432b92,_0x51b3ab){_0x51b3ab=_0x51b3ab||0x1f4;return function(_0x2e89b4){logger[_0xddc6('0x2d')](_0x2e89b4[_0xddc6('0x2e')]);if(_0x2e89b4['name']){delete _0x2e89b4[_0xddc6('0x2f')];}_0x432b92['status'](_0x51b3ab)[_0xddc6('0x30')](_0x2e89b4);};}exports[_0xddc6('0x31')]=function(_0x329305,_0x91af83){var _0x2376bb={},_0x47232f={},_0x3def83={'count':0x0,'rows':[]};var _0x2875c2=_[_0xddc6('0x32')](db['ChatInternalMessage'][_0xddc6('0x33')],function(_0x42b2d9){return{'name':_0x42b2d9['fieldName'],'type':_0x42b2d9[_0xddc6('0x34')][_0xddc6('0x35')]};});_0x47232f[_0xddc6('0x36')]=_[_0xddc6('0x32')](_0x2875c2,'name');_0x47232f[_0xddc6('0x37')]=_[_0xddc6('0x38')](_0x329305[_0xddc6('0x37')]);_0x47232f[_0xddc6('0x39')]=_[_0xddc6('0x3a')](_0x47232f[_0xddc6('0x36')],_0x47232f[_0xddc6('0x37')]);_0x2376bb['attributes']=_[_0xddc6('0x3a')](_0x47232f[_0xddc6('0x36')],qs[_0xddc6('0x3b')](_0x329305['query']['fields']));_0x2376bb[_0xddc6('0x3c')]=_0x2376bb['attributes'][_0xddc6('0x3d')]?_0x2376bb[_0xddc6('0x3c')]:_0x47232f['model'];if(!_0x329305['query'][_0xddc6('0x3e')](_0xddc6('0x3f'))){_0x2376bb[_0xddc6('0x23')]=qs['limit'](_0x329305[_0xddc6('0x37')][_0xddc6('0x23')]);_0x2376bb['offset']=qs['offset'](_0x329305[_0xddc6('0x37')][_0xddc6('0x22')]);}_0x2376bb[_0xddc6('0x40')]=qs[_0xddc6('0x41')](_0x329305[_0xddc6('0x37')]['sort']);_0x2376bb['where']=qs['filters'](_['pick'](_0x329305[_0xddc6('0x37')],_0x47232f[_0xddc6('0x39')]),_0x2875c2);if(_0x329305[_0xddc6('0x37')][_0xddc6('0x42')]){_0x2376bb[_0xddc6('0x43')]=_[_0xddc6('0x44')](_0x2376bb[_0xddc6('0x43')],{'$or':_[_0xddc6('0x32')](_0x2875c2,function(_0x172108){if(_0x172108[_0xddc6('0x34')]!==_0xddc6('0x45')){var _0x29b6b4={};_0x29b6b4[_0x172108['name']]={'$like':'%'+_0x329305[_0xddc6('0x37')][_0xddc6('0x42')]+'%'};return _0x29b6b4;}})});}_0x2376bb=_[_0xddc6('0x44')]({},_0x2376bb,_0x329305[_0xddc6('0x46')]);var _0x731da2={'where':_0x2376bb[_0xddc6('0x43')]};return db[_0xddc6('0x47')][_0xddc6('0x25')](_0x731da2)[_0xddc6('0x2a')](function(_0x5ba0c8){_0x3def83[_0xddc6('0x25')]=_0x5ba0c8;if(_0x329305[_0xddc6('0x37')][_0xddc6('0x48')]){_0x2376bb[_0xddc6('0x49')]=[{'all':!![]}];}return db[_0xddc6('0x47')]['findAll'](_0x2376bb);})[_0xddc6('0x2a')](function(_0x184c70){_0x3def83['rows']=_0x184c70;return _0x3def83;})['then'](respondWithFilteredResult(_0x91af83,_0x2376bb))[_0xddc6('0x4a')](handleError(_0x91af83,null));};exports[_0xddc6('0x4b')]=function(_0x4d6842,_0x39bf04){var _0x188622={'raw':!![],'where':{'id':_0x4d6842[_0xddc6('0x4c')]['id']}},_0x1004ed={};_0x1004ed[_0xddc6('0x36')]=_[_0xddc6('0x38')](db[_0xddc6('0x47')][_0xddc6('0x33')]);_0x1004ed['query']=_[_0xddc6('0x38')](_0x4d6842['query']);_0x1004ed['filters']=_['intersection'](_0x1004ed[_0xddc6('0x36')],_0x1004ed[_0xddc6('0x37')]);_0x188622[_0xddc6('0x3c')]=_['intersection'](_0x1004ed[_0xddc6('0x36')],qs[_0xddc6('0x3b')](_0x4d6842[_0xddc6('0x37')][_0xddc6('0x3b')]));_0x188622['attributes']=_0x188622['attributes'][_0xddc6('0x3d')]?_0x188622[_0xddc6('0x3c')]:_0x1004ed[_0xddc6('0x36')];if(_0x4d6842[_0xddc6('0x37')][_0xddc6('0x48')]){_0x188622[_0xddc6('0x49')]=[{'all':!![]}];}_0x188622=_['merge']({},_0x188622,_0x4d6842['options']);return db[_0xddc6('0x47')][_0xddc6('0x4d')](_0x188622)[_0xddc6('0x2a')](handleEntityNotFound(_0x39bf04,null))['then'](respondWithResult(_0x39bf04,null))[_0xddc6('0x4a')](handleError(_0x39bf04,null));};exports['create']=function(_0x1895b4,_0x15247c){return db['ChatInternalMessage'][_0xddc6('0x4e')](_0x1895b4['body'],{})['then'](respondWithResult(_0x15247c,0xc9))[_0xddc6('0x4a')](handleError(_0x15247c,null));};exports[_0xddc6('0x29')]=function(_0x266b57,_0x35299b){if(_0x266b57[_0xddc6('0x4f')]['id']){delete _0x266b57[_0xddc6('0x4f')]['id'];}return db[_0xddc6('0x47')][_0xddc6('0x4d')]({'where':{'id':_0x266b57['params']['id']}})['then'](handleEntityNotFound(_0x35299b,null))[_0xddc6('0x2a')](saveUpdates(_0x266b57[_0xddc6('0x4f')],null))[_0xddc6('0x2a')](respondWithResult(_0x35299b,null))[_0xddc6('0x4a')](handleError(_0x35299b,null));};exports[_0xddc6('0x2b')]=function(_0xf626bf,_0x43789){return db[_0xddc6('0x47')][_0xddc6('0x4d')]({'where':{'id':_0xf626bf[_0xddc6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x43789,null))['then'](removeEntity(_0x43789,null))['catch'](handleError(_0x43789,null));};exports[_0xddc6('0x50')]=function(_0x1d1658,_0x264965){return db[_0xddc6('0x47')]['describe']()[_0xddc6('0x2a')](respondWithResult(_0x264965,null))[_0xddc6('0x4a')](handleError(_0x264965,null));};function wrapUser(_0x9c1fa){return function(_0x39a2e1){var _0x5a5d88=_0x9c1fa[_0xddc6('0x51')]({'plain':!![]});_0x5a5d88[_0xddc6('0x52')]=[];if(_0x39a2e1){_0x5a5d88[_0xddc6('0x53')]=_0x39a2e1[_0xddc6('0x54')];_0x5a5d88[_0xddc6('0x55')]=_0x39a2e1;}else{_0x5a5d88['lastMessageAt']=moment(0x0)['format'](_0xddc6('0x56'));_0x5a5d88[_0xddc6('0x55')]={};}return _0x5a5d88;};}exports['getUsers']=function(_0x5eeca9,_0x5e7963,_0x5a9fef){var _0x3796a5=[];return db['User'][_0xddc6('0x57')]({'where':{'role':[_0xddc6('0x58'),_0xddc6('0x59'),_0xddc6('0x5a')]},'attributes':['id',_0xddc6('0x5b'),_0xddc6('0x2f'),_0xddc6('0x5c'),'userpic',_0xddc6('0x5d'),_0xddc6('0x5e'),'lastLoginAt',_0xddc6('0x5f'),'showWebBar'],'order':qs[_0xddc6('0x41')](_0xddc6('0x60')),'include':[{'model':db[_0xddc6('0x61')],'as':'VoiceQueues','attributes':['id',_0xddc6('0x2f'),'type'],'through':{'attributes':[]}}]})[_0xddc6('0x2a')](function(_0x2c205b){if(_0x2c205b){var _0x49ee4b=_0x5eeca9[_0xddc6('0x5a')][_0xddc6('0x51')]({'plain':!![]});if(!_0x49ee4b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49ee4b[_0xddc6('0x5c')]===_0xddc6('0x5a')){return db['UserProfileSection'][_0xddc6('0x4d')]({'where':{'name':_0xddc6('0x62'),'userProfileId':_0x49ee4b[_0xddc6('0x63')]},'raw':!![]})[_0xddc6('0x2a')](function(_0x20db95){if(_0x20db95){if(_0x20db95[_0xddc6('0x64')]===0x0){return db['UserProfileResource'][_0xddc6('0x57')]({'where':{'sectionId':_0x20db95['id']},'raw':!![]})['then'](function(_0x8a53c1){var _0x4c534f=[];if(_[_0xddc6('0x65')](_0x8a53c1)){_0x4c534f=_['filter'](_0x2c205b,function(_0x29351a){if(_0x29351a[_0xddc6('0x5c')]!==_0xddc6('0x58')){return _0x29351a;}});return _0x4c534f;}else{for(var _0xa58a66=0x0;_0xa58a66<_0x2c205b['length'];_0xa58a66++){var _0x1e5d80=_0x2c205b[_0xa58a66];if(_0x1e5d80[_0xddc6('0x5c')]===_0xddc6('0x58')){var _0x1a79a3=_[_0xddc6('0x4d')](_0x8a53c1,function(_0x3f4e09){return _0x3f4e09['resourceId']===_0x1e5d80['id'];});if(_0x1a79a3)_0x4c534f[_0xddc6('0x66')](_0x1e5d80);}else{_0x4c534f[_0xddc6('0x66')](_0x1e5d80);}}return _0x4c534f;}});}else{return _0x2c205b;}}else{var _0x4f0885=_[_0xddc6('0x42')](_0x2c205b,function(_0x5cade6){if(_0x5cade6[_0xddc6('0x5c')]!==_0xddc6('0x58')){return _0x5cade6;}});return _0x4f0885;}});}else{return _0x2c205b;}}})[_0xddc6('0x2a')](function(_0x405129){var _0x595c42=[];if(_0x405129){_0x3796a5=_0x405129;for(var _0x2386a9=0x0;_0x2386a9<_0x405129['length'];_0x2386a9+=0x1){_0x3796a5[_0x2386a9][_0xddc6('0x52')]=[];_0x595c42['push'](db[_0xddc6('0x47')][_0xddc6('0x4d')]({'where':{'FromId':[_0x5eeca9[_0xddc6('0x5a')]['id'],_0x405129[_0x2386a9]['id']],'ToId':[_0x5eeca9['user']['id'],_0x405129[_0x2386a9]['id']],'ChatGroupId':null},'attributes':['id','createdAt','FromId','ToId',_0xddc6('0x67'),_0xddc6('0x4f')],'order':qs[_0xddc6('0x41')](_0xddc6('0x68')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xddc6('0x2a')](wrapUser(_0x405129[_0x2386a9])));}return BPromise[_0xddc6('0x69')](_0x595c42);}return[];})[_0xddc6('0x2a')](function(_0x324ef4){return{'rows':_0x324ef4,'count':_0x324ef4[_0xddc6('0x3d')]};})[_0xddc6('0x2a')](respondWithResult(_0x5e7963,null))[_0xddc6('0x4a')](handleError(_0x5e7963,null));}; \ No newline at end of file +var _0xb8cb=['stack','name','send','index','map','rawAttributes','fieldName','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','ChatInternalMessage','includeAll','include','findAll','catch','length','options','find','create','body','params','describe','get','messages','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','agent','admin','user','role','userpic','internal','lastLoginAt','allowmessenger','showWebBar','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','push','createdAt','FromId','ToId','read','all','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','offset','limit','count','set','Content-Range','json','apply','save','update','then','destroy','end','error'];(function(_0x4a2acb,_0x263021){var _0x3ec7fa=function(_0x218fbf){while(--_0x218fbf){_0x4a2acb['push'](_0x4a2acb['shift']());}};_0x3ec7fa(++_0x263021);}(_0xb8cb,0x188));var _0xbb8c=function(_0x2cf4f1,_0x81dac6){_0x2cf4f1=_0x2cf4f1-0x0;var _0x574a66=_0xb8cb[_0x2cf4f1];return _0x574a66;};'use strict';var emlformat=require(_0xbb8c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb8c('0x1'));var jsonpatch=require(_0xbb8c('0x2'));var rp=require(_0xbb8c('0x3'));var moment=require(_0xbb8c('0x4'));var BPromise=require(_0xbb8c('0x5'));var Mustache=require(_0xbb8c('0x6'));var util=require('util');var path=require(_0xbb8c('0x7'));var sox=require('sox');var csv=require(_0xbb8c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb8c('0x9'));var _=require('lodash');var squel=require(_0xbb8c('0xa'));var crypto=require(_0xbb8c('0xb'));var jsforce=require(_0xbb8c('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbb8c('0xd'));var Redis=require(_0xbb8c('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbb8c('0xf'));var hardwareService=require(_0xbb8c('0x10'));var logger=require(_0xbb8c('0x11'))(_0xbb8c('0x12'));var utils=require(_0xbb8c('0x13'));var config=require(_0xbb8c('0x14'));var licenseUtil=require(_0xbb8c('0x15'));var db=require(_0xbb8c('0x16'))['db'];config[_0xbb8c('0x17')]=_[_0xbb8c('0x18')](config['redis'],{'host':_0xbb8c('0x19'),'port':0x18eb});var socket=require(_0xbb8c('0x1a'))(new Redis(config['redis']));require(_0xbb8c('0x1b'))[_0xbb8c('0x1c')](socket);function respondWithStatusCode(_0x19380b,_0x52bb2b){_0x52bb2b=_0x52bb2b||0xcc;return function(_0x349904){if(_0x349904){return _0x19380b[_0xbb8c('0x1d')](_0x52bb2b);}return _0x19380b[_0xbb8c('0x1e')](_0x52bb2b)['end']();};}function respondWithResult(_0x4b35c7,_0x61482a){_0x61482a=_0x61482a||0xc8;return function(_0x5a7a11){if(_0x5a7a11){return _0x4b35c7['status'](_0x61482a)['json'](_0x5a7a11);}};}function respondWithFilteredResult(_0x531d54,_0x1042e5){return function(_0x32d077){if(_0x32d077){var _0x28789b=typeof _0x1042e5[_0xbb8c('0x1f')]==='undefined'&&typeof _0x1042e5[_0xbb8c('0x20')]==='undefined';var _0x967293=_0x32d077[_0xbb8c('0x21')];var _0x3096b3=_0x28789b?0x0:_0x1042e5[_0xbb8c('0x1f')];var _0x5162b1=_0x28789b?_0x32d077['count']:_0x1042e5[_0xbb8c('0x1f')]+_0x1042e5[_0xbb8c('0x20')];var _0x5845ee;if(_0x5162b1>=_0x967293){_0x5162b1=_0x967293;_0x5845ee=0xc8;}else{_0x5845ee=0xce;}_0x531d54['status'](_0x5845ee);return _0x531d54[_0xbb8c('0x22')](_0xbb8c('0x23'),_0x3096b3+'-'+_0x5162b1+'/'+_0x967293)[_0xbb8c('0x24')](_0x32d077);}return null;};}function patchUpdates(_0x648b55){return function(_0x5ecc08){try{jsonpatch[_0xbb8c('0x25')](_0x5ecc08,_0x648b55,!![]);}catch(_0x5307b1){return BPromise['reject'](_0x5307b1);}return _0x5ecc08[_0xbb8c('0x26')]();};}function saveUpdates(_0x177581,_0x2d572f){return function(_0x124c6e){if(_0x124c6e){return _0x124c6e[_0xbb8c('0x27')](_0x177581)[_0xbb8c('0x28')](function(_0x212529){return _0x212529;});}return null;};}function removeEntity(_0x3c158a,_0x365723){return function(_0x2303f8){if(_0x2303f8){return _0x2303f8[_0xbb8c('0x29')]()[_0xbb8c('0x28')](function(){_0x3c158a[_0xbb8c('0x1e')](0xcc)[_0xbb8c('0x2a')]();});}};}function handleEntityNotFound(_0xe69607,_0x446238){return function(_0xfd53a6){if(!_0xfd53a6){_0xe69607[_0xbb8c('0x1d')](0x194);}return _0xfd53a6;};}function handleError(_0x18713a,_0x4cc480){_0x4cc480=_0x4cc480||0x1f4;return function(_0x554030){logger[_0xbb8c('0x2b')](_0x554030[_0xbb8c('0x2c')]);if(_0x554030[_0xbb8c('0x2d')]){delete _0x554030[_0xbb8c('0x2d')];}_0x18713a[_0xbb8c('0x1e')](_0x4cc480)[_0xbb8c('0x2e')](_0x554030);};}exports[_0xbb8c('0x2f')]=function(_0x5461b0,_0x504951){var _0x5ba687={},_0x439d66={},_0xd51612={'count':0x0,'rows':[]};var _0x58a85f=_[_0xbb8c('0x30')](db['ChatInternalMessage'][_0xbb8c('0x31')],function(_0x1d58d4){return{'name':_0x1d58d4[_0xbb8c('0x32')],'type':_0x1d58d4['type']['key']};});_0x439d66['model']=_[_0xbb8c('0x30')](_0x58a85f,_0xbb8c('0x2d'));_0x439d66['query']=_[_0xbb8c('0x33')](_0x5461b0[_0xbb8c('0x34')]);_0x439d66[_0xbb8c('0x35')]=_[_0xbb8c('0x36')](_0x439d66['model'],_0x439d66['query']);_0x5ba687['attributes']=_[_0xbb8c('0x36')](_0x439d66[_0xbb8c('0x37')],qs[_0xbb8c('0x38')](_0x5461b0['query'][_0xbb8c('0x38')]));_0x5ba687[_0xbb8c('0x39')]=_0x5ba687[_0xbb8c('0x39')]['length']?_0x5ba687[_0xbb8c('0x39')]:_0x439d66[_0xbb8c('0x37')];if(!_0x5461b0[_0xbb8c('0x34')][_0xbb8c('0x3a')](_0xbb8c('0x3b'))){_0x5ba687[_0xbb8c('0x20')]=qs['limit'](_0x5461b0[_0xbb8c('0x34')][_0xbb8c('0x20')]);_0x5ba687[_0xbb8c('0x1f')]=qs[_0xbb8c('0x1f')](_0x5461b0[_0xbb8c('0x34')][_0xbb8c('0x1f')]);}_0x5ba687[_0xbb8c('0x3c')]=qs[_0xbb8c('0x3d')](_0x5461b0[_0xbb8c('0x34')]['sort']);_0x5ba687['where']=qs[_0xbb8c('0x35')](_[_0xbb8c('0x3e')](_0x5461b0[_0xbb8c('0x34')],_0x439d66[_0xbb8c('0x35')]),_0x58a85f);if(_0x5461b0['query'][_0xbb8c('0x3f')]){_0x5ba687[_0xbb8c('0x40')]=_['merge'](_0x5ba687['where'],{'$or':_[_0xbb8c('0x30')](_0x58a85f,function(_0xae6228){if(_0xae6228[_0xbb8c('0x41')]!==_0xbb8c('0x42')){var _0x1e82f7={};_0x1e82f7[_0xae6228[_0xbb8c('0x2d')]]={'$like':'%'+_0x5461b0[_0xbb8c('0x34')][_0xbb8c('0x3f')]+'%'};return _0x1e82f7;}})});}_0x5ba687=_[_0xbb8c('0x43')]({},_0x5ba687,_0x5461b0['options']);var _0x3984a4={'where':_0x5ba687[_0xbb8c('0x40')]};return db[_0xbb8c('0x44')]['count'](_0x3984a4)[_0xbb8c('0x28')](function(_0x3df52d){_0xd51612[_0xbb8c('0x21')]=_0x3df52d;if(_0x5461b0[_0xbb8c('0x34')][_0xbb8c('0x45')]){_0x5ba687[_0xbb8c('0x46')]=[{'all':!![]}];}return db[_0xbb8c('0x44')][_0xbb8c('0x47')](_0x5ba687);})['then'](function(_0xe5acfa){_0xd51612['rows']=_0xe5acfa;return _0xd51612;})['then'](respondWithFilteredResult(_0x504951,_0x5ba687))[_0xbb8c('0x48')](handleError(_0x504951,null));};exports['show']=function(_0x1e3513,_0x3079e7){var _0x1fff72={'raw':!![],'where':{'id':_0x1e3513['params']['id']}},_0x56af41={};_0x56af41[_0xbb8c('0x37')]=_[_0xbb8c('0x33')](db[_0xbb8c('0x44')][_0xbb8c('0x31')]);_0x56af41[_0xbb8c('0x34')]=_['keys'](_0x1e3513[_0xbb8c('0x34')]);_0x56af41[_0xbb8c('0x35')]=_['intersection'](_0x56af41['model'],_0x56af41[_0xbb8c('0x34')]);_0x1fff72[_0xbb8c('0x39')]=_[_0xbb8c('0x36')](_0x56af41[_0xbb8c('0x37')],qs[_0xbb8c('0x38')](_0x1e3513['query'][_0xbb8c('0x38')]));_0x1fff72[_0xbb8c('0x39')]=_0x1fff72[_0xbb8c('0x39')][_0xbb8c('0x49')]?_0x1fff72[_0xbb8c('0x39')]:_0x56af41[_0xbb8c('0x37')];if(_0x1e3513[_0xbb8c('0x34')][_0xbb8c('0x45')]){_0x1fff72[_0xbb8c('0x46')]=[{'all':!![]}];}_0x1fff72=_['merge']({},_0x1fff72,_0x1e3513[_0xbb8c('0x4a')]);return db[_0xbb8c('0x44')][_0xbb8c('0x4b')](_0x1fff72)[_0xbb8c('0x28')](handleEntityNotFound(_0x3079e7,null))[_0xbb8c('0x28')](respondWithResult(_0x3079e7,null))[_0xbb8c('0x48')](handleError(_0x3079e7,null));};exports[_0xbb8c('0x4c')]=function(_0x5666ff,_0x4cf050){return db[_0xbb8c('0x44')][_0xbb8c('0x4c')](_0x5666ff[_0xbb8c('0x4d')],{})[_0xbb8c('0x28')](respondWithResult(_0x4cf050,0xc9))['catch'](handleError(_0x4cf050,null));};exports[_0xbb8c('0x27')]=function(_0x4253ee,_0x1b1e0e){if(_0x4253ee[_0xbb8c('0x4d')]['id']){delete _0x4253ee[_0xbb8c('0x4d')]['id'];}return db[_0xbb8c('0x44')][_0xbb8c('0x4b')]({'where':{'id':_0x4253ee[_0xbb8c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1b1e0e,null))[_0xbb8c('0x28')](saveUpdates(_0x4253ee[_0xbb8c('0x4d')],null))[_0xbb8c('0x28')](respondWithResult(_0x1b1e0e,null))[_0xbb8c('0x48')](handleError(_0x1b1e0e,null));};exports[_0xbb8c('0x29')]=function(_0x5a40fa,_0x25627c){return db[_0xbb8c('0x44')][_0xbb8c('0x4b')]({'where':{'id':_0x5a40fa['params']['id']}})[_0xbb8c('0x28')](handleEntityNotFound(_0x25627c,null))[_0xbb8c('0x28')](removeEntity(_0x25627c,null))[_0xbb8c('0x48')](handleError(_0x25627c,null));};exports[_0xbb8c('0x4f')]=function(_0x497234,_0x234ef9){return db[_0xbb8c('0x44')]['describe']()[_0xbb8c('0x28')](respondWithResult(_0x234ef9,null))['catch'](handleError(_0x234ef9,null));};function wrapUser(_0x1554b8){return function(_0x4d4f1e){var _0x2cd664=_0x1554b8[_0xbb8c('0x50')]({'plain':!![]});_0x2cd664[_0xbb8c('0x51')]=[];if(_0x4d4f1e){_0x2cd664[_0xbb8c('0x52')]=_0x4d4f1e['createdAt'];_0x2cd664['lastMessage']=_0x4d4f1e;}else{_0x2cd664[_0xbb8c('0x52')]=moment(0x0)[_0xbb8c('0x53')](_0xbb8c('0x54'));_0x2cd664[_0xbb8c('0x55')]={};}return _0x2cd664;};}exports[_0xbb8c('0x56')]=function(_0x420230,_0x5e1414,_0x2a92ab){var _0x30318d=[];return db[_0xbb8c('0x57')][_0xbb8c('0x47')]({'where':{'role':[_0xbb8c('0x58'),_0xbb8c('0x59'),_0xbb8c('0x5a')]},'attributes':['id','fullname',_0xbb8c('0x2d'),_0xbb8c('0x5b'),_0xbb8c('0x5c'),_0xbb8c('0x5d'),'online',_0xbb8c('0x5e'),_0xbb8c('0x5f'),_0xbb8c('0x60')],'order':qs['sort']('-online'),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id',_0xbb8c('0x2d'),_0xbb8c('0x41')],'through':{'attributes':[]}}]})[_0xbb8c('0x28')](function(_0x3e2734){if(_0x3e2734){var _0x266a40=_0x420230[_0xbb8c('0x5a')][_0xbb8c('0x50')]({'plain':!![]});if(!_0x266a40)throw new Error(_0xbb8c('0x61'));if(_0x266a40[_0xbb8c('0x5b')]==='user'){return db[_0xbb8c('0x62')][_0xbb8c('0x4b')]({'where':{'name':_0xbb8c('0x63'),'userProfileId':_0x266a40[_0xbb8c('0x64')]},'raw':!![]})[_0xbb8c('0x28')](function(_0x4326a5){if(_0x4326a5){if(_0x4326a5[_0xbb8c('0x65')]===0x0){return db[_0xbb8c('0x66')][_0xbb8c('0x47')]({'where':{'sectionId':_0x4326a5['id']},'raw':!![]})[_0xbb8c('0x28')](function(_0x2d0d15){var _0x2ff6de=[];if(_['isEmpty'](_0x2d0d15)){_0x2ff6de=_[_0xbb8c('0x3f')](_0x3e2734,function(_0x4d869c){if(_0x4d869c[_0xbb8c('0x5b')]!==_0xbb8c('0x58')){return _0x4d869c;}});return _0x2ff6de;}else{for(var _0x4e2f59=0x0;_0x4e2f59<_0x3e2734[_0xbb8c('0x49')];_0x4e2f59++){var _0x308f9a=_0x3e2734[_0x4e2f59];if(_0x308f9a['role']===_0xbb8c('0x58')){var _0x1f77b2=_[_0xbb8c('0x4b')](_0x2d0d15,function(_0x24a4df){return _0x24a4df['resourceId']===_0x308f9a['id'];});if(_0x1f77b2)_0x2ff6de[_0xbb8c('0x67')](_0x308f9a);}else{_0x2ff6de[_0xbb8c('0x67')](_0x308f9a);}}return _0x2ff6de;}});}else{return _0x3e2734;}}else{var _0x18ae02=_[_0xbb8c('0x3f')](_0x3e2734,function(_0x3d5dc2){if(_0x3d5dc2['role']!==_0xbb8c('0x58')){return _0x3d5dc2;}});return _0x18ae02;}});}else{return _0x3e2734;}}})['then'](function(_0x884903){var _0x45a512=[];if(_0x884903){_0x30318d=_0x884903;for(var _0x40de9c=0x0;_0x40de9c<_0x884903[_0xbb8c('0x49')];_0x40de9c+=0x1){_0x30318d[_0x40de9c][_0xbb8c('0x51')]=[];_0x45a512[_0xbb8c('0x67')](db[_0xbb8c('0x44')][_0xbb8c('0x4b')]({'where':{'FromId':[_0x420230['user']['id'],_0x884903[_0x40de9c]['id']],'ToId':[_0x420230[_0xbb8c('0x5a')]['id'],_0x884903[_0x40de9c]['id']],'ChatGroupId':null},'attributes':['id',_0xbb8c('0x68'),_0xbb8c('0x69'),_0xbb8c('0x6a'),_0xbb8c('0x6b'),_0xbb8c('0x4d')],'order':qs[_0xbb8c('0x3d')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xbb8c('0x28')](wrapUser(_0x884903[_0x40de9c])));}return BPromise[_0xbb8c('0x6c')](_0x45a512);}return[];})[_0xbb8c('0x28')](function(_0x3e8728){return{'rows':_0x3e8728,'count':_0x3e8728['length']};})['then'](respondWithResult(_0x5e1414,null))[_0xbb8c('0x48')](handleError(_0x5e1414,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index e0ef6a5..a30b89e 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 _0x889c=['update','emit','hasOwnProperty','exports','events','setMaxListeners','save'];(function(_0x18b191,_0x4e0684){var _0x43e146=function(_0x4b464e){while(--_0x4b464e){_0x18b191['push'](_0x18b191['shift']());}};_0x43e146(++_0x4e0684);}(_0x889c,0x12a));var _0xc889=function(_0x15d0b7,_0x46205a){_0x15d0b7=_0x15d0b7-0x0;var _0x18ed18=_0x889c[_0x15d0b7];return _0x18ed18;};'use strict';var EventEmitter=require(_0xc889('0x0'));var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xc889('0x1')](0x0);var events={'afterCreate':_0xc889('0x2'),'afterUpdate':_0xc889('0x3'),'afterDestroy':'remove'};function emitEvent(_0x33e1fa){return function(_0x4202c6,_0x353e5f,_0x32131d){ChatInternalMessageEvents[_0xc889('0x4')](_0x33e1fa+':'+_0x4202c6['id'],_0x4202c6);ChatInternalMessageEvents[_0xc889('0x4')](_0x33e1fa,_0x4202c6);_0x32131d(null);};}for(var e in events){if(events[_0xc889('0x5')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xc889('0x6')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x707b=['exports','events','../../mysqldb','ChatInternalMessage','save','emit'];(function(_0x4b2b03,_0xbf34ee){var _0x1bf0ed=function(_0x562785){while(--_0x562785){_0x4b2b03['push'](_0x4b2b03['shift']());}};_0x1bf0ed(++_0xbf34ee);}(_0x707b,0xdf));var _0xb707=function(_0x309e57,_0xe1c277){_0x309e57=_0x309e57-0x0;var _0x313c98=_0x707b[_0x309e57];return _0x313c98;};'use strict';var EventEmitter=require(_0xb707('0x0'));var ChatInternalMessage=require(_0xb707('0x1'))['db'][_0xb707('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb707('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xe4c060){return function(_0x5db6ce,_0x39cd37,_0x157b23){ChatInternalMessageEvents[_0xb707('0x4')](_0xe4c060+':'+_0x5db6ce['id'],_0x5db6ce);ChatInternalMessageEvents['emit'](_0xe4c060,_0x5db6ce);_0x157b23(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xb707('0x5')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 18b1679..cdf6ab3 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 _0x5c37=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./chatInternalMessage.attributes','exports','define','utf8mb4'];(function(_0x53de6d,_0x244850){var _0x386bf2=function(_0x104136){while(--_0x104136){_0x53de6d['push'](_0x53de6d['shift']());}};_0x386bf2(++_0x244850);}(_0x5c37,0xd8));var _0x75c3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5c37[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x75c3('0x0'));var util=require(_0x75c3('0x1'));var logger=require(_0x75c3('0x2'))(_0x75c3('0x3'));var moment=require(_0x75c3('0x4'));var BPromise=require(_0x75c3('0x5'));var rp=require(_0x75c3('0x6'));var fs=require('fs');var path=require(_0x75c3('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x75c3('0x8'));module[_0x75c3('0x9')]=function(_0x556ba1,_0x3d6e71){return _0x556ba1[_0x75c3('0xa')]('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x75c3('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc2e0=['util','bluebird','request-promise','rimraf','exports','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','lodash'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0xc2e0,0xfb));var _0x0c2e=function(_0x52d881,_0x3a47c9){_0x52d881=_0x52d881-0x0;var _0x41d8af=_0xc2e0[_0x52d881];return _0x41d8af;};'use strict';var _=require(_0x0c2e('0x0'));var util=require(_0x0c2e('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0c2e('0x2'));var rp=require(_0x0c2e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0c2e('0x4'));var config=require('../../config/environment');var attributes=require('./chatInternalMessage.attributes');module[_0x0c2e('0x5')]=function(_0x563b1a,_0x514d89){return _0x563b1a['define'](_0x0c2e('0x6'),attributes,{'tableName':_0x0c2e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0c2e('0x8')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index e7ddd34..1ac5404 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 _0xdc39=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird'];(function(_0x3669b6,_0x45083a){var _0xc34609=function(_0x47ee49){while(--_0x47ee49){_0x3669b6['push'](_0x3669b6['shift']());}};_0xc34609(++_0x45083a);}(_0xdc39,0x169));var _0x9dc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc39[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x9dc3('0x0'));var moment=require(_0x9dc3('0x1'));var BPromise=require(_0x9dc3('0x2'));var rs=require(_0x9dc3('0x3'));var fs=require('fs');var Redis=require(_0x9dc3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9dc3('0x5'));var logger=require(_0x9dc3('0x6'))(_0x9dc3('0x7'));var config=require(_0x9dc3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9dc3('0x9')][_0x9dc3('0xa')]({'port':0x232a});config[_0x9dc3('0xb')]=_['defaults'](config['redis'],{'host':_0x9dc3('0xc'),'port':0x18eb});var socket=require(_0x9dc3('0xd'))(new Redis(config[_0x9dc3('0xb')]));require(_0x9dc3('0xe'))['register'](socket);function respondWithRpcPromise(_0x4c1ca6,_0x28d064,_0x43ed46){return new BPromise(function(_0x36bdb7,_0x53f37b){return client[_0x9dc3('0xf')](_0x4c1ca6,_0x43ed46)[_0x9dc3('0x10')](function(_0x29ba7c){logger[_0x9dc3('0x11')](_0x9dc3('0x12'),_0x28d064,_0x9dc3('0x13'));logger[_0x9dc3('0x14')](_0x9dc3('0x15'),_0x28d064,_0x9dc3('0x13'),JSON[_0x9dc3('0x16')](_0x29ba7c));if(_0x29ba7c[_0x9dc3('0x17')]){if(_0x29ba7c['error']['code']===0x1f4){logger[_0x9dc3('0x17')](_0x9dc3('0x12'),_0x28d064,_0x29ba7c[_0x9dc3('0x17')][_0x9dc3('0x18')]);return _0x53f37b(_0x29ba7c[_0x9dc3('0x17')][_0x9dc3('0x18')]);}logger[_0x9dc3('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x28d064,_0x29ba7c[_0x9dc3('0x17')][_0x9dc3('0x18')]);return _0x36bdb7(_0x29ba7c['error'][_0x9dc3('0x18')]);}else{logger[_0x9dc3('0x11')](_0x9dc3('0x12'),_0x28d064,_0x9dc3('0x13'));_0x36bdb7(_0x29ba7c[_0x9dc3('0x19')][_0x9dc3('0x18')]);}})['catch'](function(_0x5a3ff4){logger[_0x9dc3('0x17')](_0x9dc3('0x12'),_0x28d064,_0x5a3ff4);_0x53f37b(_0x5a3ff4);});});} \ No newline at end of file +var _0xeae4=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatInternalMessage.socket','register','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x1c2a31,_0x5ab97a){var _0xaabd37=function(_0x509d64){while(--_0x509d64){_0x1c2a31['push'](_0x1c2a31['shift']());}};_0xaabd37(++_0x5ab97a);}(_0xeae4,0x78));var _0x4eae=function(_0x2fb6e3,_0x1282d2){_0x2fb6e3=_0x2fb6e3-0x0;var _0xe2db47=_0xeae4[_0x2fb6e3];return _0xe2db47;};'use strict';var _=require(_0x4eae('0x0'));var util=require(_0x4eae('0x1'));var moment=require('moment');var BPromise=require(_0x4eae('0x2'));var rs=require(_0x4eae('0x3'));var fs=require('fs');var Redis=require(_0x4eae('0x4'));var db=require(_0x4eae('0x5'))['db'];var utils=require(_0x4eae('0x6'));var logger=require('../../config/logger')(_0x4eae('0x7'));var config=require(_0x4eae('0x8'));var jayson=require(_0x4eae('0x9'));var client=jayson[_0x4eae('0xa')][_0x4eae('0xb')]({'port':0x232a});config[_0x4eae('0xc')]=_[_0x4eae('0xd')](config[_0x4eae('0xc')],{'host':_0x4eae('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4eae('0xc')]));require(_0x4eae('0xf'))[_0x4eae('0x10')](socket);function respondWithRpcPromise(_0x48da8a,_0x8f9aab,_0x4b9d93){return new BPromise(function(_0x171bdc,_0x5e309a){return client['request'](_0x48da8a,_0x4b9d93)[_0x4eae('0x11')](function(_0x117e54){logger[_0x4eae('0x12')](_0x4eae('0x13'),_0x8f9aab,_0x4eae('0x14'));logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x8f9aab,_0x4eae('0x14'),JSON[_0x4eae('0x15')](_0x117e54));if(_0x117e54[_0x4eae('0x16')]){if(_0x117e54[_0x4eae('0x16')]['code']===0x1f4){logger[_0x4eae('0x16')](_0x4eae('0x13'),_0x8f9aab,_0x117e54['error'][_0x4eae('0x17')]);return _0x5e309a(_0x117e54[_0x4eae('0x16')][_0x4eae('0x17')]);}logger['error'](_0x4eae('0x13'),_0x8f9aab,_0x117e54[_0x4eae('0x16')][_0x4eae('0x17')]);return _0x171bdc(_0x117e54['error']['message']);}else{logger[_0x4eae('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x8f9aab,'request\x20sent');_0x171bdc(_0x117e54['result'][_0x4eae('0x17')]);}})[_0x4eae('0x18')](function(_0x25e2f6){logger[_0x4eae('0x16')](_0x4eae('0x13'),_0x8f9aab,_0x25e2f6);_0x5e309a(_0x25e2f6);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index c6620b5..8dcdcda 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 _0x83a5=['./chatInternalMessage.events','save','remove','update','emit','length','chatInternalMessage:'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x83a5,0x111));var _0x583a=function(_0x2bd72b,_0x4fd8ed){_0x2bd72b=_0x2bd72b-0x0;var _0x279f43=_0x83a5[_0x2bd72b];return _0x279f43;};'use strict';var ChatInternalMessageEvents=require(_0x583a('0x0'));var events=[_0x583a('0x1'),_0x583a('0x2'),_0x583a('0x3')];function createListener(_0x93d1fd,_0x54633b){return function(_0x51bf25){_0x54633b[_0x583a('0x4')](_0x93d1fd,_0x51bf25);};}function removeListener(_0x3b46db,_0x5831fc){return function(){ChatInternalMessageEvents['removeListener'](_0x3b46db,_0x5831fc);};}exports['register']=function(_0x24ebb4){for(var _0x1cc13e=0x0,_0x10c9f1=events[_0x583a('0x5')];_0x1cc13e<_0x10c9f1;_0x1cc13e++){var _0x42e431=events[_0x1cc13e];var _0x263fc3=createListener(_0x583a('0x6')+_0x42e431,_0x24ebb4);ChatInternalMessageEvents['on'](_0x42e431,_0x263fc3);}}; \ No newline at end of file +var _0xce8d=['remove','update','emit','removeListener','length','./chatInternalMessage.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xce8d,0x11f));var _0xdce8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce8d[_0x3dd15e];return _0x231fd0;};'use strict';var ChatInternalMessageEvents=require(_0xdce8('0x0'));var events=['save',_0xdce8('0x1'),_0xdce8('0x2')];function createListener(_0x4ae4cf,_0x91eaa6){return function(_0x5d5b9a){_0x91eaa6[_0xdce8('0x3')](_0x4ae4cf,_0x5d5b9a);};}function removeListener(_0x57eeb1,_0x3429a1){return function(){ChatInternalMessageEvents[_0xdce8('0x4')](_0x57eeb1,_0x3429a1);};}exports['register']=function(_0x4675d1){for(var _0x4f1144=0x0,_0x218524=events[_0xdce8('0x5')];_0x4f1144<_0x218524;_0x4f1144++){var _0x222ab4=events[_0x4f1144];var _0x36788a=createListener('chatInternalMessage:'+_0x222ab4,_0x4675d1);ChatInternalMessageEvents['on'](_0x222ab4,_0x36788a);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 0144f3f..ac67b04 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 _0xc7ad=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','isAuthenticated','index','get','/describe','/users','/:id','show','post','create','update'];(function(_0x5ecdcd,_0x443ae3){var _0x27d6ab=function(_0x3e86cd){while(--_0x3e86cd){_0x5ecdcd['push'](_0x5ecdcd['shift']());}};_0x27d6ab(++_0x443ae3);}(_0xc7ad,0x163));var _0xdc7a=function(_0xc36673,_0x3abdf4){_0xc36673=_0xc36673-0x0;var _0x54eb69=_0xc7ad[_0xc36673];return _0x54eb69;};'use strict';var multer=require(_0xdc7a('0x0'));var util=require(_0xdc7a('0x1'));var path=require('path');var timeout=require(_0xdc7a('0x2'));var express=require(_0xdc7a('0x3'));var router=express[_0xdc7a('0x4')]();var fs_extra=require(_0xdc7a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdc7a('0x6'));var config=require(_0xdc7a('0x7'));var controller=require(_0xdc7a('0x8'));router['get']('/',auth[_0xdc7a('0x9')](),controller[_0xdc7a('0xa')]);router[_0xdc7a('0xb')](_0xdc7a('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xdc7a('0xb')](_0xdc7a('0xd'),auth[_0xdc7a('0x9')](),controller['getUsers']);router[_0xdc7a('0xb')](_0xdc7a('0xe'),auth[_0xdc7a('0x9')](),controller[_0xdc7a('0xf')]);router[_0xdc7a('0x10')]('/',auth['isAuthenticated'](),controller[_0xdc7a('0x11')]);router['put']('/:id',controller[_0xdc7a('0x12')]);router[_0xdc7a('0x13')]('/:id',auth[_0xdc7a('0x9')](),controller[_0xdc7a('0x14')]);module[_0xdc7a('0x15')]=router; \ No newline at end of file +var _0x207e=['show','post','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','describe','/users','getUsers','/:id'];(function(_0x54aaf0,_0x39bd60){var _0xd8fa4d=function(_0x1b0849){while(--_0x1b0849){_0x54aaf0['push'](_0x54aaf0['shift']());}};_0xd8fa4d(++_0x39bd60);}(_0x207e,0x8a));var _0xe207=function(_0x4eee57,_0x34ccc0){_0x4eee57=_0x4eee57-0x0;var _0x3a5259=_0x207e[_0x4eee57];return _0x3a5259;};'use strict';var multer=require(_0xe207('0x0'));var util=require(_0xe207('0x1'));var path=require(_0xe207('0x2'));var timeout=require(_0xe207('0x3'));var express=require(_0xe207('0x4'));var router=express[_0xe207('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe207('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe207('0x7'));var controller=require(_0xe207('0x8'));router[_0xe207('0x9')]('/',auth[_0xe207('0xa')](),controller[_0xe207('0xb')]);router[_0xe207('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xe207('0xc')]);router['get'](_0xe207('0xd'),auth[_0xe207('0xa')](),controller[_0xe207('0xe')]);router[_0xe207('0x9')](_0xe207('0xf'),auth[_0xe207('0xa')](),controller[_0xe207('0x10')]);router[_0xe207('0x11')]('/',auth[_0xe207('0xa')](),controller[_0xe207('0x12')]);router[_0xe207('0x13')](_0xe207('0xf'),controller[_0xe207('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe207('0x15')]);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 abdd498..707eb7a 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 _0x4a1d=['DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x468331,_0x292b65){var _0x20e335=function(_0x510d08){while(--_0x510d08){_0x468331['push'](_0x468331['shift']());}};_0x20e335(++_0x292b65);}(_0x4a1d,0x77));var _0xd4a1=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x4a1d[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require(_0xd4a1('0x0'));module[_0xd4a1('0x1')]={'body':{'type':Sequelize[_0xd4a1('0x2')](_0xd4a1('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xd4a1('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xd4a1('0x5')]('in',_0xd4a1('0x6')),'defaultValue':_0xd4a1('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd4a1('0x7')]},'providerName':{'type':Sequelize[_0xd4a1('0x8')]},'providerResponse':{'type':Sequelize[_0xd4a1('0x2')]}}; \ No newline at end of file +var _0x7916=['out','STRING','sequelize','TEXT','medium','BOOLEAN','ENUM'];(function(_0x53b8e0,_0x55d46e){var _0x10630c=function(_0x3189aa){while(--_0x3189aa){_0x53b8e0['push'](_0x53b8e0['shift']());}};_0x10630c(++_0x55d46e);}(_0x7916,0x128));var _0x6791=function(_0x204ef6,_0x14dc9b){_0x204ef6=_0x204ef6-0x0;var _0x5e3a4b=_0x7916[_0x204ef6];return _0x5e3a4b;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'body':{'type':Sequelize[_0x6791('0x1')](_0x6791('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x6791('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6791('0x4')]('in',_0x6791('0x5')),'defaultValue':_0x6791('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x6791('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index ac5b1b1..b131e90 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 _0x0283=['EventManager','rejectmessage','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./chatMessage.socket','client','http','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','length','includeAll','find','create','body','destroy','describe','accept','chat','readAt','UserId','user','agent','get','ChatInteraction','ChatInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','parse','formData','reject','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SELECT','contact','format'];(function(_0x3f8c5b,_0x17ba5f){var _0x18122d=function(_0x56efa0){while(--_0x56efa0){_0x3f8c5b['push'](_0x3f8c5b['shift']());}};_0x18122d(++_0x17ba5f);}(_0x0283,0x88));var _0x3028=function(_0x49a57c,_0x2eb02c){_0x49a57c=_0x49a57c-0x0;var _0x4e0316=_0x0283[_0x49a57c];return _0x4e0316;};'use strict';var emlformat=require(_0x3028('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3028('0x1'));var rp=require(_0x3028('0x2'));var moment=require(_0x3028('0x3'));var BPromise=require(_0x3028('0x4'));var Mustache=require(_0x3028('0x5'));var util=require(_0x3028('0x6'));var path=require(_0x3028('0x7'));var sox=require(_0x3028('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3028('0x9'));var _=require(_0x3028('0xa'));var squel=require(_0x3028('0xb'));var crypto=require(_0x3028('0xc'));var jsforce=require(_0x3028('0xd'));var deskjs=require(_0x3028('0xe'));var toCsv=require(_0x3028('0xf'));var querystring=require(_0x3028('0x10'));var Papa=require(_0x3028('0x11'));var Redis=require(_0x3028('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3028('0x13'));var as=require(_0x3028('0x14'));var hardwareService=require(_0x3028('0x15'));var logger=require(_0x3028('0x16'))(_0x3028('0x17'));var utils=require(_0x3028('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x3028('0x19'));var db=require('../../mysqldb')['db'];config[_0x3028('0x1a')]=_['defaults'](config[_0x3028('0x1a')],{'host':_0x3028('0x1b'),'port':0x18eb});var socket=require(_0x3028('0x1c'))(new Redis(config[_0x3028('0x1a')]));require(_0x3028('0x1d'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x3028('0x1e')][_0x3028('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x3028('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x14e845,_0x932421,_0x4e498b,_0x217961){return new BPromise(function(_0x1a0364,_0x36d43e){var _0x411d0e=_0x217961||client;return _0x411d0e['request'](_0x14e845,_0x4e498b)['then'](function(_0x335626){logger[_0x3028('0x20')](_0x3028('0x21'),_0x932421,_0x3028('0x22'));logger['debug'](_0x3028('0x23'),_0x932421,_0x3028('0x22'),JSON[_0x3028('0x24')](_0x335626));if(_0x335626[_0x3028('0x25')]){if(_0x335626[_0x3028('0x25')][_0x3028('0x26')]===0x1f4){logger[_0x3028('0x25')](_0x3028('0x21'),_0x932421,_0x335626[_0x3028('0x25')][_0x3028('0x27')]);return _0x36d43e(_0x335626[_0x3028('0x25')]['message']);}logger[_0x3028('0x25')]('ChatMessage,\x20%s,\x20%s',_0x932421,_0x335626[_0x3028('0x25')][_0x3028('0x27')]);return _0x1a0364(_0x335626[_0x3028('0x25')][_0x3028('0x27')]);}else{logger[_0x3028('0x20')]('ChatMessage,\x20%s,\x20%s',_0x932421,'request\x20sent');_0x1a0364(_0x335626['result']['message']);}})[_0x3028('0x28')](function(_0xa853f5){logger[_0x3028('0x25')]('ChatMessage,\x20%s,\x20%s',_0x932421,_0xa853f5);_0x36d43e(_0xa853f5);});});}function respondWithStatusCode(_0x44a34f,_0x2ea29b){_0x2ea29b=_0x2ea29b||0xcc;return function(_0x128957){if(_0x128957){return _0x44a34f[_0x3028('0x29')](_0x2ea29b);}return _0x44a34f[_0x3028('0x2a')](_0x2ea29b)[_0x3028('0x2b')]();};}function respondWithResult(_0x26fcdd,_0x54e5ae){_0x54e5ae=_0x54e5ae||0xc8;return function(_0x24bad8){if(_0x24bad8){return _0x26fcdd['status'](_0x54e5ae)[_0x3028('0x2c')](_0x24bad8);}};}function respondWithFilteredResult(_0x34a0eb,_0x2e4c83){return function(_0x20465d){if(_0x20465d){var _0x4ea575=typeof _0x2e4c83[_0x3028('0x2d')]===_0x3028('0x2e')&&typeof _0x2e4c83[_0x3028('0x2f')]===_0x3028('0x2e');var _0x25da4c=_0x20465d['count'];var _0x3d6b62=_0x4ea575?0x0:_0x2e4c83[_0x3028('0x2d')];var _0x31d5e9=_0x4ea575?_0x20465d[_0x3028('0x30')]:_0x2e4c83[_0x3028('0x2d')]+_0x2e4c83[_0x3028('0x2f')];var _0x3627d9;if(_0x31d5e9>=_0x25da4c){_0x31d5e9=_0x25da4c;_0x3627d9=0xc8;}else{_0x3627d9=0xce;}_0x34a0eb['status'](_0x3627d9);return _0x34a0eb[_0x3028('0x31')](_0x3028('0x32'),_0x3d6b62+'-'+_0x31d5e9+'/'+_0x25da4c)[_0x3028('0x2c')](_0x20465d);}return null;};}function patchUpdates(_0x8695bb){return function(_0x1586d2){try{jsonpatch['apply'](_0x1586d2,_0x8695bb,!![]);}catch(_0x47a57e){return BPromise['reject'](_0x47a57e);}return _0x1586d2[_0x3028('0x33')]();};}function saveUpdates(_0x59945e,_0xb8cb71){return function(_0x464529){if(_0x464529){return _0x464529[_0x3028('0x34')](_0x59945e)[_0x3028('0x35')](function(_0x3ce6a5){return _0x3ce6a5;});}return null;};}function removeEntity(_0x132acc,_0x2c0210){return function(_0x8ae1e4){if(_0x8ae1e4){return _0x8ae1e4['destroy']()['then'](function(){_0x132acc['status'](0xcc)[_0x3028('0x2b')]();});}};}function handleEntityNotFound(_0x333c1e,_0x231bef){return function(_0x484eac){if(!_0x484eac){_0x333c1e['sendStatus'](0x194);}return _0x484eac;};}function handleError(_0x461cb2,_0x4d2c52){_0x4d2c52=_0x4d2c52||0x1f4;return function(_0x50d016){logger[_0x3028('0x25')](_0x50d016[_0x3028('0x36')]);if(_0x50d016['name']){delete _0x50d016[_0x3028('0x37')];}_0x461cb2[_0x3028('0x2a')](_0x4d2c52)[_0x3028('0x38')](_0x50d016);};}exports[_0x3028('0x39')]=function(_0x119506,_0x38c5b1){var _0x5c789c={},_0x51c3b7={},_0x26d53d={'count':0x0,'rows':[]};var _0x1c1ae2=_[_0x3028('0x3a')](db[_0x3028('0x3b')][_0x3028('0x3c')],function(_0x191712){return{'name':_0x191712[_0x3028('0x3d')],'type':_0x191712[_0x3028('0x3e')]['key']};});_0x51c3b7[_0x3028('0x3f')]=_[_0x3028('0x3a')](_0x1c1ae2,_0x3028('0x37'));_0x51c3b7['query']=_[_0x3028('0x40')](_0x119506[_0x3028('0x41')]);_0x51c3b7[_0x3028('0x42')]=_[_0x3028('0x43')](_0x51c3b7[_0x3028('0x3f')],_0x51c3b7['query']);_0x5c789c[_0x3028('0x44')]=_[_0x3028('0x43')](_0x51c3b7[_0x3028('0x3f')],qs[_0x3028('0x45')](_0x119506[_0x3028('0x41')][_0x3028('0x45')]));_0x5c789c[_0x3028('0x44')]=_0x5c789c['attributes']['length']?_0x5c789c[_0x3028('0x44')]:_0x51c3b7['model'];if(!_0x119506[_0x3028('0x41')][_0x3028('0x46')](_0x3028('0x47'))){_0x5c789c[_0x3028('0x2f')]=qs['limit'](_0x119506[_0x3028('0x41')]['limit']);_0x5c789c['offset']=qs['offset'](_0x119506['query']['offset']);}_0x5c789c[_0x3028('0x48')]=qs['sort'](_0x119506[_0x3028('0x41')][_0x3028('0x49')]);_0x5c789c[_0x3028('0x4a')]=qs[_0x3028('0x42')](_['pick'](_0x119506[_0x3028('0x41')],_0x51c3b7[_0x3028('0x42')]),_0x1c1ae2);if(_0x119506[_0x3028('0x41')][_0x3028('0x4b')]){_0x5c789c['where']=_[_0x3028('0x4c')](_0x5c789c[_0x3028('0x4a')],{'$or':_[_0x3028('0x3a')](_0x1c1ae2,function(_0x5c1e7c){if(_0x5c1e7c['type']!==_0x3028('0x4d')){var _0x3d1244={};_0x3d1244[_0x5c1e7c[_0x3028('0x37')]]={'$like':'%'+_0x119506[_0x3028('0x41')][_0x3028('0x4b')]+'%'};return _0x3d1244;}})});}_0x5c789c=_[_0x3028('0x4c')]({},_0x5c789c,_0x119506[_0x3028('0x4e')]);var _0x3cc533={'where':_0x5c789c[_0x3028('0x4a')]};return db['ChatMessage'][_0x3028('0x30')](_0x3cc533)[_0x3028('0x35')](function(_0x1c3a29){_0x26d53d[_0x3028('0x30')]=_0x1c3a29;if(_0x119506[_0x3028('0x41')]['includeAll']){_0x5c789c[_0x3028('0x4f')]=[{'all':!![]}];}return db[_0x3028('0x3b')][_0x3028('0x50')](_0x5c789c);})[_0x3028('0x35')](function(_0x26ca6d){_0x26d53d[_0x3028('0x51')]=_0x26ca6d;return _0x26d53d;})[_0x3028('0x35')](respondWithFilteredResult(_0x38c5b1,_0x5c789c))[_0x3028('0x28')](handleError(_0x38c5b1,null));};exports[_0x3028('0x52')]=function(_0x43175f,_0x556ee2){var _0x3f1d5d={'raw':!![],'where':{'id':_0x43175f[_0x3028('0x53')]['id']}},_0x4613d5={};_0x4613d5[_0x3028('0x3f')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x4613d5['query']=_[_0x3028('0x40')](_0x43175f[_0x3028('0x41')]);_0x4613d5['filters']=_[_0x3028('0x43')](_0x4613d5[_0x3028('0x3f')],_0x4613d5['query']);_0x3f1d5d[_0x3028('0x44')]=_[_0x3028('0x43')](_0x4613d5['model'],qs[_0x3028('0x45')](_0x43175f[_0x3028('0x41')][_0x3028('0x45')]));_0x3f1d5d[_0x3028('0x44')]=_0x3f1d5d[_0x3028('0x44')][_0x3028('0x54')]?_0x3f1d5d['attributes']:_0x4613d5[_0x3028('0x3f')];if(_0x43175f[_0x3028('0x41')][_0x3028('0x55')]){_0x3f1d5d[_0x3028('0x4f')]=[{'all':!![]}];}_0x3f1d5d=_[_0x3028('0x4c')]({},_0x3f1d5d,_0x43175f[_0x3028('0x4e')]);return db[_0x3028('0x3b')][_0x3028('0x56')](_0x3f1d5d)[_0x3028('0x35')](handleEntityNotFound(_0x556ee2,null))[_0x3028('0x35')](respondWithResult(_0x556ee2,null))[_0x3028('0x28')](handleError(_0x556ee2,null));};exports[_0x3028('0x57')]=function(_0x4ae249,_0x423056){return db[_0x3028('0x3b')]['create'](_0x4ae249[_0x3028('0x58')],{})[_0x3028('0x35')](respondWithResult(_0x423056,0xc9))['catch'](handleError(_0x423056,null));};exports[_0x3028('0x34')]=function(_0x7447b2,_0x5a1ce4){if(_0x7447b2[_0x3028('0x58')]['id']){delete _0x7447b2[_0x3028('0x58')]['id'];}return db[_0x3028('0x3b')]['find']({'where':{'id':_0x7447b2[_0x3028('0x53')]['id']}})[_0x3028('0x35')](handleEntityNotFound(_0x5a1ce4,null))[_0x3028('0x35')](saveUpdates(_0x7447b2['body'],null))[_0x3028('0x35')](respondWithResult(_0x5a1ce4,null))['catch'](handleError(_0x5a1ce4,null));};exports[_0x3028('0x59')]=function(_0x1488aa,_0x3b45e3){return db[_0x3028('0x3b')][_0x3028('0x56')]({'where':{'id':_0x1488aa[_0x3028('0x53')]['id']}})[_0x3028('0x35')](handleEntityNotFound(_0x3b45e3,null))[_0x3028('0x35')](removeEntity(_0x3b45e3,null))[_0x3028('0x28')](handleError(_0x3b45e3,null));};exports[_0x3028('0x5a')]=function(_0xd8ced5,_0x2638e){return db['ChatMessage'][_0x3028('0x5a')]()[_0x3028('0x35')](respondWithResult(_0x2638e,null))['catch'](handleError(_0x2638e,null));};var interaction_log=require(_0x3028('0x16'))('chat-interactions');exports[_0x3028('0x5b')]=function(_0x265f16,_0x315166,_0x1f1fff){var _0x23f759={'agent':{},'channel':_0x3028('0x5c')};if(_0x265f16[_0x3028('0x58')]['id']){delete _0x265f16[_0x3028('0x58')]['id'];}_0x265f16['body']['read']=!![];_0x265f16[_0x3028('0x58')][_0x3028('0x5d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x265f16[_0x3028('0x58')][_0x3028('0x5e')]=_0x265f16[_0x3028('0x58')]['UserId']||_0x265f16[_0x3028('0x5f')]['id'];_0x23f759[_0x3028('0x60')]['id']=_0x265f16[_0x3028('0x58')]['UserId'];return db['ChatMessage'][_0x3028('0x56')]({'where':{'id':_0x265f16[_0x3028('0x53')]['id'],'UserId':null}})[_0x3028('0x35')](handleEntityNotFound(_0x315166,null))['then'](saveUpdates(_0x265f16[_0x3028('0x58')],null))[_0x3028('0x35')](function(_0x8de80f){if(_0x8de80f){_0x23f759['message']=_0x8de80f[_0x3028('0x61')]({'plain':!![]});return db[_0x3028('0x62')][_0x3028('0x56')]({'where':{'id':_0x8de80f[_0x3028('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x315166,null))[_0x3028('0x35')](function(_0x1eca6a){if(_0x1eca6a){return _0x1eca6a['update']({'UserId':_0x265f16['body']['UserId'],'read1stAt':_['isNil'](_0x1eca6a[_0x3028('0x64')])?moment()['format'](_0x3028('0x65')):undefined});}return null;})[_0x3028('0x35')](function(_0x3341ee){if(_0x3341ee){_0x23f759[_0x3028('0x66')]=_0x3341ee[_0x3028('0x61')]({'plain':!![]});interaction_log['info'](_0x3028('0x67'),_0x265f16[_0x3028('0x5f')]['id'],_0x265f16[_0x3028('0x5f')][_0x3028('0x37')],_0x265f16[_0x3028('0x5f')][_0x3028('0x68')],_0x23f759['interaction']['id'],_0x265f16[_0x3028('0x58')]?JSON[_0x3028('0x24')](_0x265f16['body']):_0x3028('0x69'));return respondWithRpcPromise(_0x3028('0x6a'),_0x3028('0x6b'),_0x23f759);}return null;})[_0x3028('0x35')](function(_0x2cb649){var _0x523039='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2cb649[_0x3028('0x27')][_0x3028('0x6c')];return db[_0x3028('0x6d')][_0x3028('0x41')](_0x523039,{'type':db[_0x3028('0x6e')][_0x3028('0x6f')]['SELECT'],'raw':!![]})[_0x3028('0x35')](function(_0x27a071){return _0x27a071;});})[_0x3028('0x35')](function(_0x4f7d6d){if(_0x4f7d6d){_0x23f759[_0x3028('0x27')]['contact']=_0x4f7d6d[0x0];if(!_0x265f16['body']['UserId'])return;return db[_0x3028('0x70')][_0x3028('0x56')]({'where':{'id':_0x265f16['body']['UserId'],'role':'agent'},'attributes':['id',_0x3028('0x37'),_0x3028('0x71'),_0x3028('0x72'),_0x3028('0x73')],'raw':!![]});}return null;})[_0x3028('0x35')](function(_0x105d20){if(!_0x105d20)return null;_0x23f759[_0x3028('0x27')]['agent']=_0x105d20;return _0x23f759;})[_0x3028('0x35')](function(_0x56252a){if(_0x56252a){if(_0x265f16[_0x3028('0x58')][_0x3028('0x74')]){_0x23f759[_0x3028('0x27')][_0x3028('0x75')]=util['format'](_0x3028('0x76'),_0x265f16[_0x3028('0x5f')][_0x3028('0x37')]);_0x23f759[_0x3028('0x27')][_0x3028('0x77')]=_0x23f759[_0x3028('0x77')];_0x23f759[_0x3028('0x27')][_0x3028('0x78')]=_0x23f759[_0x3028('0x77')];_0x23f759[_0x3028('0x27')][_0x3028('0x79')]='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_['merge'](_0x23f759[_0x3028('0x27')],JSON[_0x3028('0x7a')](_0x23f759['interaction'][_0x3028('0x7b')]))},client9002)[_0x3028('0x35')](function(){return _0x23f759;});}return _0x23f759;}return null;})[_0x3028('0x35')](respondWithResult(_0x315166,null))[_0x3028('0x28')](handleError(_0x315166,null));};var interaction_log=require(_0x3028('0x16'))('chat-interactions');exports[_0x3028('0x7c')]=function(_0x1775af,_0x85f41c,_0x36360f){var _0x5ede8a={'agent':{},'channel':_0x3028('0x5c')};if(_0x1775af[_0x3028('0x58')]['id']){delete _0x1775af[_0x3028('0x58')]['id'];}_0x1775af[_0x3028('0x58')]['UserId']=_0x1775af['body'][_0x3028('0x5e')]||_0x1775af['user']['id'];_0x5ede8a[_0x3028('0x60')]['id']=_0x1775af[_0x3028('0x58')][_0x3028('0x5e')];return db[_0x3028('0x3b')][_0x3028('0x56')]({'where':{'id':_0x1775af[_0x3028('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x85f41c,null))[_0x3028('0x35')](function(_0x156492){if(_0x156492){_0x5ede8a[_0x3028('0x27')]=_0x156492['get']({'plain':!![]});return db[_0x3028('0x62')][_0x3028('0x56')]({'where':{'id':_0x156492['ChatInteractionId']}});}return null;})[_0x3028('0x35')](handleEntityNotFound(_0x85f41c,null))[_0x3028('0x35')](function(_0x3ae354){if(_0x3ae354){_0x5ede8a[_0x3028('0x66')]=_0x3ae354[_0x3028('0x61')]({'plain':!![]});interaction_log[_0x3028('0x20')](_0x3028('0x7d'),_0x1775af['user']['id'],_0x1775af[_0x3028('0x5f')][_0x3028('0x37')],_0x1775af['user'][_0x3028('0x68')],_0x5ede8a[_0x3028('0x66')]['id'],_0x1775af[_0x3028('0x58')]?JSON[_0x3028('0x24')](_0x1775af['body']):_0x3028('0x69'));return respondWithRpcPromise(_0x3028('0x7e'),_0x3028('0x7f'),_0x5ede8a);}return null;})['then'](function(_0x44f793){var _0x3d6f94=_0x3028('0x80')+_0x44f793[_0x3028('0x27')][_0x3028('0x6c')];return db[_0x3028('0x6d')][_0x3028('0x41')](_0x3d6f94,{'type':db[_0x3028('0x6e')][_0x3028('0x6f')][_0x3028('0x81')],'raw':!![]})[_0x3028('0x35')](function(_0x416a22){return _0x416a22;});})['then'](function(_0x26a272){if(_0x26a272){_0x5ede8a[_0x3028('0x27')][_0x3028('0x82')]=_0x26a272[0x0];if(!_0x1775af[_0x3028('0x58')][_0x3028('0x5e')])return;return db[_0x3028('0x70')]['find']({'where':{'id':_0x1775af[_0x3028('0x58')][_0x3028('0x5e')],'role':'agent'},'attributes':['id',_0x3028('0x37'),_0x3028('0x71'),_0x3028('0x72'),'internal'],'raw':!![]});}return null;})[_0x3028('0x35')](function(_0x96add7){if(!_0x96add7)return null;_0x5ede8a['message'][_0x3028('0x60')]=_0x96add7;return _0x5ede8a;})[_0x3028('0x35')](function(_0x2dfc7e){if(_0x2dfc7e){_0x2dfc7e['message'][_0x3028('0x75')]=util[_0x3028('0x83')]('SIP/%s',_0x1775af[_0x3028('0x5f')][_0x3028('0x37')]);_0x2dfc7e[_0x3028('0x27')][_0x3028('0x77')]=_0x5ede8a['channel'];_0x2dfc7e[_0x3028('0x27')]['motionChannel']=_0x5ede8a[_0x3028('0x77')];_0x2dfc7e[_0x3028('0x27')][_0x3028('0x79')]='reject';respondWithRpcPromise(_0x3028('0x84'),_0x3028('0x84'),{'event':_0x3028('0x85'),'message':_['merge'](_0x5ede8a['message'],JSON[_0x3028('0x7a')](_0x5ede8a[_0x3028('0x66')][_0x3028('0x7b')]))},client9002);return _0x5ede8a;}return null;})['then'](respondWithResult(_0x85f41c,null))['catch'](handleError(_0x85f41c,null));}; \ No newline at end of file +var _0x0dfc=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','client','http','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','undefined','limit','count','offset','status','Content-Range','json','apply','then','destroy','stack','name','send','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','ChatMessage','includeAll','include','rows','show','params','options','find','create','body','describe','accept','chat','read','format','agent','get','ChatInteractionId','UserId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','motionChannel','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','reject','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x3d2a39,_0x4e0506){var _0x452043=function(_0x25d797){while(--_0x25d797){_0x3d2a39['push'](_0x3d2a39['shift']());}};_0x452043(++_0x4e0506);}(_0x0dfc,0x7a));var _0xc0df=function(_0x351b52,_0x171378){_0x351b52=_0x351b52-0x0;var _0x2a58ed=_0x0dfc[_0x351b52];return _0x2a58ed;};'use strict';var emlformat=require(_0xc0df('0x0'));var rimraf=require(_0xc0df('0x1'));var zipdir=require(_0xc0df('0x2'));var jsonpatch=require(_0xc0df('0x3'));var rp=require(_0xc0df('0x4'));var moment=require(_0xc0df('0x5'));var BPromise=require(_0xc0df('0x6'));var Mustache=require('mustache');var util=require(_0xc0df('0x7'));var path=require(_0xc0df('0x8'));var sox=require(_0xc0df('0x9'));var csv=require(_0xc0df('0xa'));var ejs=require(_0xc0df('0xb'));var fs=require('fs');var fs_extra=require(_0xc0df('0xc'));var _=require('lodash');var squel=require(_0xc0df('0xd'));var crypto=require(_0xc0df('0xe'));var jsforce=require(_0xc0df('0xf'));var deskjs=require(_0xc0df('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc0df('0x11'));var Papa=require(_0xc0df('0x12'));var Redis=require(_0xc0df('0x13'));var authService=require(_0xc0df('0x14'));var qs=require(_0xc0df('0x15'));var as=require(_0xc0df('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc0df('0x17'))('api');var utils=require(_0xc0df('0x18'));var config=require(_0xc0df('0x19'));var licenseUtil=require(_0xc0df('0x1a'));var db=require(_0xc0df('0x1b'))['db'];config[_0xc0df('0x1c')]=_[_0xc0df('0x1d')](config['redis'],{'host':_0xc0df('0x1e'),'port':0x18eb});var socket=require(_0xc0df('0x1f'))(new Redis(config[_0xc0df('0x1c')]));require(_0xc0df('0x20'))[_0xc0df('0x21')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc0df('0x22')][_0xc0df('0x23')]({'port':0x232c});var client9002=jayson[_0xc0df('0x22')][_0xc0df('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x2e4730,_0x20428b,_0x4659f6,_0x393a5c){return new BPromise(function(_0x44e66e,_0x271bd5){var _0x53b673=_0x393a5c||client;return _0x53b673[_0xc0df('0x24')](_0x2e4730,_0x4659f6)['then'](function(_0x1268dc){logger[_0xc0df('0x25')](_0xc0df('0x26'),_0x20428b,_0xc0df('0x27'));logger[_0xc0df('0x28')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x20428b,'request\x20sent',JSON[_0xc0df('0x29')](_0x1268dc));if(_0x1268dc[_0xc0df('0x2a')]){if(_0x1268dc[_0xc0df('0x2a')][_0xc0df('0x2b')]===0x1f4){logger[_0xc0df('0x2a')]('ChatMessage,\x20%s,\x20%s',_0x20428b,_0x1268dc[_0xc0df('0x2a')][_0xc0df('0x2c')]);return _0x271bd5(_0x1268dc[_0xc0df('0x2a')][_0xc0df('0x2c')]);}logger[_0xc0df('0x2a')]('ChatMessage,\x20%s,\x20%s',_0x20428b,_0x1268dc[_0xc0df('0x2a')][_0xc0df('0x2c')]);return _0x44e66e(_0x1268dc['error'][_0xc0df('0x2c')]);}else{logger['info'](_0xc0df('0x26'),_0x20428b,_0xc0df('0x27'));_0x44e66e(_0x1268dc[_0xc0df('0x2d')][_0xc0df('0x2c')]);}})[_0xc0df('0x2e')](function(_0x452a28){logger['error'](_0xc0df('0x26'),_0x20428b,_0x452a28);_0x271bd5(_0x452a28);});});}function respondWithStatusCode(_0x3aa8b2,_0x4f8f66){_0x4f8f66=_0x4f8f66||0xcc;return function(_0x1a4d15){if(_0x1a4d15){return _0x3aa8b2[_0xc0df('0x2f')](_0x4f8f66);}return _0x3aa8b2['status'](_0x4f8f66)[_0xc0df('0x30')]();};}function respondWithResult(_0x5d3b8d,_0x524f24){_0x524f24=_0x524f24||0xc8;return function(_0x44161c){if(_0x44161c){return _0x5d3b8d['status'](_0x524f24)['json'](_0x44161c);}};}function respondWithFilteredResult(_0x4b4d52,_0x125ff8){return function(_0x1ad2b4){if(_0x1ad2b4){var _0x5b1d90=typeof _0x125ff8['offset']===_0xc0df('0x31')&&typeof _0x125ff8[_0xc0df('0x32')]===_0xc0df('0x31');var _0x4a2c0d=_0x1ad2b4[_0xc0df('0x33')];var _0x40fdb6=_0x5b1d90?0x0:_0x125ff8[_0xc0df('0x34')];var _0x58f6e1=_0x5b1d90?_0x1ad2b4[_0xc0df('0x33')]:_0x125ff8['offset']+_0x125ff8[_0xc0df('0x32')];var _0x5d669f;if(_0x58f6e1>=_0x4a2c0d){_0x58f6e1=_0x4a2c0d;_0x5d669f=0xc8;}else{_0x5d669f=0xce;}_0x4b4d52[_0xc0df('0x35')](_0x5d669f);return _0x4b4d52['set'](_0xc0df('0x36'),_0x40fdb6+'-'+_0x58f6e1+'/'+_0x4a2c0d)[_0xc0df('0x37')](_0x1ad2b4);}return null;};}function patchUpdates(_0xc2555){return function(_0x59b67a){try{jsonpatch[_0xc0df('0x38')](_0x59b67a,_0xc2555,!![]);}catch(_0x2a73ae){return BPromise['reject'](_0x2a73ae);}return _0x59b67a['save']();};}function saveUpdates(_0x377061,_0x5ef525){return function(_0x3f654c){if(_0x3f654c){return _0x3f654c['update'](_0x377061)[_0xc0df('0x39')](function(_0x2f3b26){return _0x2f3b26;});}return null;};}function removeEntity(_0x4d683e,_0x48a2df){return function(_0x2cf122){if(_0x2cf122){return _0x2cf122[_0xc0df('0x3a')]()[_0xc0df('0x39')](function(){_0x4d683e[_0xc0df('0x35')](0xcc)[_0xc0df('0x30')]();});}};}function handleEntityNotFound(_0x264af6,_0x47c4ce){return function(_0x1319c7){if(!_0x1319c7){_0x264af6[_0xc0df('0x2f')](0x194);}return _0x1319c7;};}function handleError(_0x10ebe2,_0x412cd9){_0x412cd9=_0x412cd9||0x1f4;return function(_0x59ab04){logger[_0xc0df('0x2a')](_0x59ab04[_0xc0df('0x3b')]);if(_0x59ab04[_0xc0df('0x3c')]){delete _0x59ab04[_0xc0df('0x3c')];}_0x10ebe2['status'](_0x412cd9)[_0xc0df('0x3d')](_0x59ab04);};}exports['index']=function(_0x29312f,_0x49914e){var _0x1bbecb={},_0x182623={},_0x26721c={'count':0x0,'rows':[]};var _0x79e0a7=_[_0xc0df('0x3e')](db['ChatMessage'][_0xc0df('0x3f')],function(_0x439cf2){return{'name':_0x439cf2[_0xc0df('0x40')],'type':_0x439cf2['type'][_0xc0df('0x41')]};});_0x182623['model']=_[_0xc0df('0x3e')](_0x79e0a7,'name');_0x182623[_0xc0df('0x42')]=_[_0xc0df('0x43')](_0x29312f[_0xc0df('0x42')]);_0x182623[_0xc0df('0x44')]=_[_0xc0df('0x45')](_0x182623[_0xc0df('0x46')],_0x182623[_0xc0df('0x42')]);_0x1bbecb[_0xc0df('0x47')]=_[_0xc0df('0x45')](_0x182623['model'],qs['fields'](_0x29312f[_0xc0df('0x42')][_0xc0df('0x48')]));_0x1bbecb[_0xc0df('0x47')]=_0x1bbecb[_0xc0df('0x47')][_0xc0df('0x49')]?_0x1bbecb[_0xc0df('0x47')]:_0x182623[_0xc0df('0x46')];if(!_0x29312f[_0xc0df('0x42')]['hasOwnProperty'](_0xc0df('0x4a'))){_0x1bbecb[_0xc0df('0x32')]=qs['limit'](_0x29312f[_0xc0df('0x42')]['limit']);_0x1bbecb['offset']=qs[_0xc0df('0x34')](_0x29312f['query'][_0xc0df('0x34')]);}_0x1bbecb[_0xc0df('0x4b')]=qs[_0xc0df('0x4c')](_0x29312f[_0xc0df('0x42')][_0xc0df('0x4c')]);_0x1bbecb[_0xc0df('0x4d')]=qs[_0xc0df('0x44')](_[_0xc0df('0x4e')](_0x29312f[_0xc0df('0x42')],_0x182623[_0xc0df('0x44')]),_0x79e0a7);if(_0x29312f[_0xc0df('0x42')]['filter']){_0x1bbecb[_0xc0df('0x4d')]=_[_0xc0df('0x4f')](_0x1bbecb[_0xc0df('0x4d')],{'$or':_['map'](_0x79e0a7,function(_0x2c342d){if(_0x2c342d[_0xc0df('0x50')]!==_0xc0df('0x51')){var _0x1cc447={};_0x1cc447[_0x2c342d[_0xc0df('0x3c')]]={'$like':'%'+_0x29312f[_0xc0df('0x42')][_0xc0df('0x52')]+'%'};return _0x1cc447;}})});}_0x1bbecb=_[_0xc0df('0x4f')]({},_0x1bbecb,_0x29312f['options']);var _0x2fb88b={'where':_0x1bbecb[_0xc0df('0x4d')]};return db[_0xc0df('0x53')][_0xc0df('0x33')](_0x2fb88b)[_0xc0df('0x39')](function(_0x8c9fd3){_0x26721c[_0xc0df('0x33')]=_0x8c9fd3;if(_0x29312f[_0xc0df('0x42')][_0xc0df('0x54')]){_0x1bbecb[_0xc0df('0x55')]=[{'all':!![]}];}return db[_0xc0df('0x53')]['findAll'](_0x1bbecb);})['then'](function(_0xfd56f0){_0x26721c[_0xc0df('0x56')]=_0xfd56f0;return _0x26721c;})[_0xc0df('0x39')](respondWithFilteredResult(_0x49914e,_0x1bbecb))[_0xc0df('0x2e')](handleError(_0x49914e,null));};exports[_0xc0df('0x57')]=function(_0x430a7e,_0x2a44b7){var _0x5ea576={'raw':!![],'where':{'id':_0x430a7e[_0xc0df('0x58')]['id']}},_0x38a04b={};_0x38a04b['model']=_[_0xc0df('0x43')](db[_0xc0df('0x53')]['rawAttributes']);_0x38a04b[_0xc0df('0x42')]=_[_0xc0df('0x43')](_0x430a7e['query']);_0x38a04b[_0xc0df('0x44')]=_[_0xc0df('0x45')](_0x38a04b[_0xc0df('0x46')],_0x38a04b['query']);_0x5ea576['attributes']=_[_0xc0df('0x45')](_0x38a04b[_0xc0df('0x46')],qs[_0xc0df('0x48')](_0x430a7e['query'][_0xc0df('0x48')]));_0x5ea576[_0xc0df('0x47')]=_0x5ea576['attributes']['length']?_0x5ea576[_0xc0df('0x47')]:_0x38a04b[_0xc0df('0x46')];if(_0x430a7e[_0xc0df('0x42')][_0xc0df('0x54')]){_0x5ea576['include']=[{'all':!![]}];}_0x5ea576=_['merge']({},_0x5ea576,_0x430a7e[_0xc0df('0x59')]);return db['ChatMessage'][_0xc0df('0x5a')](_0x5ea576)[_0xc0df('0x39')](handleEntityNotFound(_0x2a44b7,null))[_0xc0df('0x39')](respondWithResult(_0x2a44b7,null))[_0xc0df('0x2e')](handleError(_0x2a44b7,null));};exports[_0xc0df('0x5b')]=function(_0x1a79cd,_0x590073){return db[_0xc0df('0x53')][_0xc0df('0x5b')](_0x1a79cd[_0xc0df('0x5c')],{})[_0xc0df('0x39')](respondWithResult(_0x590073,0xc9))['catch'](handleError(_0x590073,null));};exports['update']=function(_0x4f576d,_0x16b149){if(_0x4f576d[_0xc0df('0x5c')]['id']){delete _0x4f576d['body']['id'];}return db[_0xc0df('0x53')][_0xc0df('0x5a')]({'where':{'id':_0x4f576d[_0xc0df('0x58')]['id']}})[_0xc0df('0x39')](handleEntityNotFound(_0x16b149,null))[_0xc0df('0x39')](saveUpdates(_0x4f576d[_0xc0df('0x5c')],null))['then'](respondWithResult(_0x16b149,null))[_0xc0df('0x2e')](handleError(_0x16b149,null));};exports['destroy']=function(_0x53707c,_0x1057d1){return db['ChatMessage'][_0xc0df('0x5a')]({'where':{'id':_0x53707c['params']['id']}})[_0xc0df('0x39')](handleEntityNotFound(_0x1057d1,null))[_0xc0df('0x39')](removeEntity(_0x1057d1,null))[_0xc0df('0x2e')](handleError(_0x1057d1,null));};exports[_0xc0df('0x5d')]=function(_0x1c53be,_0x24ad23){return db['ChatMessage'][_0xc0df('0x5d')]()[_0xc0df('0x39')](respondWithResult(_0x24ad23,null))[_0xc0df('0x2e')](handleError(_0x24ad23,null));};var interaction_log=require(_0xc0df('0x17'))('chat-interactions');exports[_0xc0df('0x5e')]=function(_0xe19d0b,_0x2103d9,_0x247f2b){var _0x514d72={'agent':{},'channel':_0xc0df('0x5f')};if(_0xe19d0b[_0xc0df('0x5c')]['id']){delete _0xe19d0b[_0xc0df('0x5c')]['id'];}_0xe19d0b['body'][_0xc0df('0x60')]=!![];_0xe19d0b[_0xc0df('0x5c')]['readAt']=moment()[_0xc0df('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0xe19d0b['body']['UserId']=_0xe19d0b['body']['UserId']||_0xe19d0b['user']['id'];_0x514d72[_0xc0df('0x62')]['id']=_0xe19d0b[_0xc0df('0x5c')]['UserId'];return db[_0xc0df('0x53')][_0xc0df('0x5a')]({'where':{'id':_0xe19d0b[_0xc0df('0x58')]['id'],'UserId':null}})[_0xc0df('0x39')](handleEntityNotFound(_0x2103d9,null))[_0xc0df('0x39')](saveUpdates(_0xe19d0b[_0xc0df('0x5c')],null))['then'](function(_0xd60bb0){if(_0xd60bb0){_0x514d72[_0xc0df('0x2c')]=_0xd60bb0[_0xc0df('0x63')]({'plain':!![]});return db['ChatInteraction'][_0xc0df('0x5a')]({'where':{'id':_0xd60bb0[_0xc0df('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x2103d9,null))['then'](function(_0x561f65){if(_0x561f65){return _0x561f65['update']({'UserId':_0xe19d0b[_0xc0df('0x5c')][_0xc0df('0x65')],'read1stAt':_['isNil'](_0x561f65[_0xc0df('0x66')])?moment()[_0xc0df('0x61')](_0xc0df('0x67')):undefined});}return null;})[_0xc0df('0x39')](function(_0x12177f){if(_0x12177f){_0x514d72[_0xc0df('0x68')]=_0x12177f[_0xc0df('0x63')]({'plain':!![]});interaction_log['info'](_0xc0df('0x69'),_0xe19d0b['user']['id'],_0xe19d0b[_0xc0df('0x6a')][_0xc0df('0x3c')],_0xe19d0b[_0xc0df('0x6a')][_0xc0df('0x6b')],_0x514d72[_0xc0df('0x68')]['id'],_0xe19d0b[_0xc0df('0x5c')]?JSON[_0xc0df('0x29')](_0xe19d0b[_0xc0df('0x5c')]):_0xc0df('0x6c'));return respondWithRpcPromise('AcceptMessage',_0xc0df('0x6d'),_0x514d72);}return null;})[_0xc0df('0x39')](function(_0x409be1){var _0x301751='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x409be1[_0xc0df('0x2c')][_0xc0df('0x6e')];return db['sequelize']['query'](_0x301751,{'type':db[_0xc0df('0x6f')][_0xc0df('0x70')][_0xc0df('0x71')],'raw':!![]})[_0xc0df('0x39')](function(_0x4d1689){return _0x4d1689;});})[_0xc0df('0x39')](function(_0x3428dc){if(_0x3428dc){_0x514d72['message'][_0xc0df('0x72')]=_0x3428dc[0x0];if(!_0xe19d0b[_0xc0df('0x5c')]['UserId'])return;return db[_0xc0df('0x73')][_0xc0df('0x5a')]({'where':{'id':_0xe19d0b['body'][_0xc0df('0x65')],'role':'agent'},'attributes':['id','name',_0xc0df('0x74'),_0xc0df('0x75'),_0xc0df('0x76')],'raw':!![]});}return null;})[_0xc0df('0x39')](function(_0x133160){if(!_0x133160)return null;_0x514d72['message'][_0xc0df('0x62')]=_0x133160;return _0x514d72;})['then'](function(_0x1c2cb0){if(_0x1c2cb0){if(_0xe19d0b[_0xc0df('0x5c')][_0xc0df('0x77')]){_0x514d72[_0xc0df('0x2c')][_0xc0df('0x78')]=util[_0xc0df('0x61')]('SIP/%s',_0xe19d0b[_0xc0df('0x6a')][_0xc0df('0x3c')]);_0x514d72['message']['channel']=_0x514d72['channel'];_0x514d72[_0xc0df('0x2c')][_0xc0df('0x79')]=_0x514d72[_0xc0df('0x7a')];_0x514d72[_0xc0df('0x2c')][_0xc0df('0x7b')]=_0xc0df('0x5e');return respondWithRpcPromise('EventManager',_0xc0df('0x7c'),{'event':_0xc0df('0x7d'),'message':_[_0xc0df('0x4f')](_0x514d72['message'],JSON[_0xc0df('0x7e')](_0x514d72[_0xc0df('0x68')][_0xc0df('0x7f')]))},client9002)['then'](function(){return _0x514d72;});}return _0x514d72;}return null;})[_0xc0df('0x39')](respondWithResult(_0x2103d9,null))[_0xc0df('0x2e')](handleError(_0x2103d9,null));};var interaction_log=require(_0xc0df('0x17'))(_0xc0df('0x80'));exports['reject']=function(_0x2d24f1,_0x4fdf75,_0x21a7cb){var _0x1a5150={'agent':{},'channel':_0xc0df('0x5f')};if(_0x2d24f1[_0xc0df('0x5c')]['id']){delete _0x2d24f1['body']['id'];}_0x2d24f1[_0xc0df('0x5c')][_0xc0df('0x65')]=_0x2d24f1[_0xc0df('0x5c')][_0xc0df('0x65')]||_0x2d24f1[_0xc0df('0x6a')]['id'];_0x1a5150[_0xc0df('0x62')]['id']=_0x2d24f1[_0xc0df('0x5c')][_0xc0df('0x65')];return db[_0xc0df('0x53')][_0xc0df('0x5a')]({'where':{'id':_0x2d24f1[_0xc0df('0x58')]['id'],'UserId':null}})[_0xc0df('0x39')](handleEntityNotFound(_0x4fdf75,null))[_0xc0df('0x39')](function(_0x1ca290){if(_0x1ca290){_0x1a5150['message']=_0x1ca290[_0xc0df('0x63')]({'plain':!![]});return db['ChatInteraction'][_0xc0df('0x5a')]({'where':{'id':_0x1ca290['ChatInteractionId']}});}return null;})[_0xc0df('0x39')](handleEntityNotFound(_0x4fdf75,null))[_0xc0df('0x39')](function(_0x35a633){if(_0x35a633){_0x1a5150[_0xc0df('0x68')]=_0x35a633['get']({'plain':!![]});interaction_log['info'](_0xc0df('0x81'),_0x2d24f1['user']['id'],_0x2d24f1['user']['name'],_0x2d24f1['user']['role'],_0x1a5150['interaction']['id'],_0x2d24f1[_0xc0df('0x5c')]?JSON[_0xc0df('0x29')](_0x2d24f1[_0xc0df('0x5c')]):'null');return respondWithRpcPromise('RejectMessage',_0xc0df('0x82'),_0x1a5150);}return null;})[_0xc0df('0x39')](function(_0xebc513){var _0x1530d3=_0xc0df('0x83')+_0xebc513['message'][_0xc0df('0x6e')];return db[_0xc0df('0x84')]['query'](_0x1530d3,{'type':db[_0xc0df('0x6f')][_0xc0df('0x70')][_0xc0df('0x71')],'raw':!![]})[_0xc0df('0x39')](function(_0x2d11d5){return _0x2d11d5;});})['then'](function(_0x21d0b3){if(_0x21d0b3){_0x1a5150[_0xc0df('0x2c')]['contact']=_0x21d0b3[0x0];if(!_0x2d24f1[_0xc0df('0x5c')][_0xc0df('0x65')])return;return db[_0xc0df('0x73')][_0xc0df('0x5a')]({'where':{'id':_0x2d24f1[_0xc0df('0x5c')][_0xc0df('0x65')],'role':_0xc0df('0x62')},'attributes':['id',_0xc0df('0x3c'),_0xc0df('0x74'),_0xc0df('0x75'),_0xc0df('0x76')],'raw':!![]});}return null;})[_0xc0df('0x39')](function(_0x3625b1){if(!_0x3625b1)return null;_0x1a5150[_0xc0df('0x2c')][_0xc0df('0x62')]=_0x3625b1;return _0x1a5150;})[_0xc0df('0x39')](function(_0x76f039){if(_0x76f039){_0x76f039[_0xc0df('0x2c')][_0xc0df('0x78')]=util[_0xc0df('0x61')]('SIP/%s',_0x2d24f1['user'][_0xc0df('0x3c')]);_0x76f039[_0xc0df('0x2c')]['channel']=_0x1a5150[_0xc0df('0x7a')];_0x76f039[_0xc0df('0x2c')]['motionChannel']=_0x1a5150[_0xc0df('0x7a')];_0x76f039['message']['event']=_0xc0df('0x85');respondWithRpcPromise(_0xc0df('0x7c'),_0xc0df('0x7c'),{'event':_0xc0df('0x86'),'message':_[_0xc0df('0x4f')](_0x1a5150['message'],JSON[_0xc0df('0x7e')](_0x1a5150[_0xc0df('0x68')][_0xc0df('0x7f')]))},client9002);return _0x1a5150;}return null;})['then'](respondWithResult(_0x4fdf75,null))[_0xc0df('0x2e')](handleError(_0x4fdf75,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 9ab3198..9e9fa47 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 _0x65ae=['remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners','save'];(function(_0x1ec65c,_0x354923){var _0x5249c2=function(_0x451341){while(--_0x451341){_0x1ec65c['push'](_0x1ec65c['shift']());}};_0x5249c2(++_0x354923);}(_0x65ae,0x1ed));var _0xe65a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x65ae[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xe65a('0x0'));var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xe65a('0x1')](0x0);var events={'afterCreate':_0xe65a('0x2'),'afterUpdate':'update','afterDestroy':_0xe65a('0x3')};function emitEvent(_0x47c0f3){return function(_0x587cc8,_0x55230e,_0x1101dc){ChatMessageEvents[_0xe65a('0x4')](_0x47c0f3+':'+_0x587cc8['id'],_0x587cc8);ChatMessageEvents['emit'](_0x47c0f3,_0x587cc8);_0x1101dc(null);};}for(var e in events){if(events[_0xe65a('0x5')](e)){var event=events[e];ChatMessage[_0xe65a('0x6')](e,emitEvent(event));}}module[_0xe65a('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0xedc9=['setMaxListeners','save','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage'];(function(_0xab4d08,_0x4de007){var _0x29f61a=function(_0x1492fe){while(--_0x1492fe){_0xab4d08['push'](_0xab4d08['shift']());}};_0x29f61a(++_0x4de007);}(_0xedc9,0x102));var _0x9edc=function(_0x317d4e,_0x3de942){_0x317d4e=_0x317d4e-0x0;var _0x56ce3d=_0xedc9[_0x317d4e];return _0x56ce3d;};'use strict';var EventEmitter=require(_0x9edc('0x0'));var ChatMessage=require(_0x9edc('0x1'))['db'][_0x9edc('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x9edc('0x3')](0x0);var events={'afterCreate':_0x9edc('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x34bca7){return function(_0x176f24,_0x13bc05,_0x2ee059){ChatMessageEvents[_0x9edc('0x5')](_0x34bca7+':'+_0x176f24['id'],_0x176f24);ChatMessageEvents[_0x9edc('0x5')](_0x34bca7,_0x176f24);_0x2ee059(null);};}for(var e in events){if(events[_0x9edc('0x6')](e)){var event=events[e];ChatMessage[_0x9edc('0x7')](e,emitEvent(event));}}module[_0x9edc('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index e7c6cef..c54ccbb 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 _0x7140=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','chat_messages','fti_chat_messages','body','FULLTEXT','get','direction','toLowerCase','out','UserId','ChatInteraction','findOne','update','catch','error','utf8mb4_unicode_ci','lodash','util'];(function(_0x846a4e,_0x3c09df){var _0x5ea714=function(_0x27020b){while(--_0x27020b){_0x846a4e['push'](_0x846a4e['shift']());}};_0x5ea714(++_0x3c09df);}(_0x7140,0xbb));var _0x0714=function(_0x4ea6af,_0x4aa32e){_0x4ea6af=_0x4ea6af-0x0;var _0x4cb1e6=_0x7140[_0x4ea6af];return _0x4cb1e6;};'use strict';var _=require(_0x0714('0x0'));var util=require(_0x0714('0x1'));var logger=require(_0x0714('0x2'))(_0x0714('0x3'));var moment=require(_0x0714('0x4'));var BPromise=require(_0x0714('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0714('0x6'));var rimraf=require(_0x0714('0x7'));var config=require(_0x0714('0x8'));var attributes=require(_0x0714('0x9'));module[_0x0714('0xa')]=function(_0x322d89,_0x4faa0c){return _0x322d89[_0x0714('0xb')]('ChatMessage',attributes,{'tableName':_0x0714('0xc'),'paranoid':![],'indexes':[{'name':_0x0714('0xd'),'fields':[_0x0714('0xe')],'type':_0x0714('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xeab8fb,_0x4092d3,_0x15b59f){var _0x144504=_0x322d89['models'];var _0x47f1ac=_0xeab8fb[_0x0714('0x10')]({'plain':!![]});if(_0x47f1ac[_0x0714('0x11')][_0x0714('0x12')]()==='in'||_0x47f1ac[_0x0714('0x11')][_0x0714('0x12')]()===_0x0714('0x13')&&!_0x47f1ac['secret']&&!_['isNil'](_0x47f1ac[_0x0714('0x14')])){_0x144504[_0x0714('0x15')][_0x0714('0x16')]({'where':{'id':_0x47f1ac['ChatInteractionId']}})['then'](function(_0x34b268){if(_0x34b268){_0x34b268[_0x0714('0x17')]({'lastMsgAt':_0x47f1ac['createdAt'],'lastMsgDirection':_0x47f1ac['direction'][_0x0714('0x12')]()});}})[_0x0714('0x18')](function(_0x76178e){console[_0x0714('0x19')](_0x76178e);});}_0x15b59f();}},'charset':'utf8mb4','collate':_0x0714('0x1a')});}; \ No newline at end of file +var _0xcefe=['api','moment','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','define','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','ChatInteraction','findOne','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x10f2b0,_0x37c84c){var _0xa4cf05=function(_0x2a3435){while(--_0x2a3435){_0x10f2b0['push'](_0x10f2b0['shift']());}};_0xa4cf05(++_0x37c84c);}(_0xcefe,0x15a));var _0xecef=function(_0x446267,_0x42e31){_0x446267=_0x446267-0x0;var _0x57caae=_0xcefe[_0x446267];return _0x57caae;};'use strict';var _=require(_0xecef('0x0'));var util=require('util');var logger=require(_0xecef('0x1'))(_0xecef('0x2'));var moment=require(_0xecef('0x3'));var BPromise=require('bluebird');var rp=require(_0xecef('0x4'));var fs=require('fs');var path=require(_0xecef('0x5'));var rimraf=require(_0xecef('0x6'));var config=require(_0xecef('0x7'));var attributes=require(_0xecef('0x8'));module['exports']=function(_0x5bc733,_0x147289){return _0x5bc733[_0xecef('0x9')]('ChatMessage',attributes,{'tableName':_0xecef('0xa'),'paranoid':![],'indexes':[{'name':_0xecef('0xb'),'fields':[_0xecef('0xc')],'type':_0xecef('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x41bb3f,_0x361e61,_0x36cc1b){var _0x316a26=_0x5bc733[_0xecef('0xe')];var _0x43e0c0=_0x41bb3f[_0xecef('0xf')]({'plain':!![]});if(_0x43e0c0[_0xecef('0x10')][_0xecef('0x11')]()==='in'||_0x43e0c0[_0xecef('0x10')][_0xecef('0x11')]()===_0xecef('0x12')&&!_0x43e0c0[_0xecef('0x13')]&&!_['isNil'](_0x43e0c0[_0xecef('0x14')])){_0x316a26[_0xecef('0x15')][_0xecef('0x16')]({'where':{'id':_0x43e0c0['ChatInteractionId']}})[_0xecef('0x17')](function(_0x29e515){if(_0x29e515){_0x29e515[_0xecef('0x18')]({'lastMsgAt':_0x43e0c0[_0xecef('0x19')],'lastMsgDirection':_0x43e0c0[_0xecef('0x10')][_0xecef('0x11')]()});}})[_0xecef('0x1a')](function(_0x29e69b){console[_0xecef('0x1b')](_0x29e69b);});}_0x36cc1b();}},'charset':'utf8mb4','collate':_0xecef('0x1c')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index f4f1902..92b8980 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 _0x7a40=['result','catch','CreateChatMessage','ChatMessage','body','options','debug','stringify','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','error','code','message','info'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x7a40,0x19b));var _0x07a4=function(_0x5c0e35,_0x40e697){_0x5c0e35=_0x5c0e35-0x0;var _0x3380fd=_0x7a40[_0x5c0e35];return _0x3380fd;};'use strict';var _=require(_0x07a4('0x0'));var util=require(_0x07a4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x07a4('0x2'));var db=require(_0x07a4('0x3'))['db'];var utils=require(_0x07a4('0x4'));var logger=require('../../config/logger')(_0x07a4('0x5'));var config=require(_0x07a4('0x6'));var jayson=require(_0x07a4('0x7'));var client=jayson[_0x07a4('0x8')][_0x07a4('0x9')]({'port':0x232a});config[_0x07a4('0xa')]=_[_0x07a4('0xb')](config[_0x07a4('0xa')],{'host':_0x07a4('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x07a4('0xa')]));require(_0x07a4('0xd'))[_0x07a4('0xe')](socket);function respondWithRpcPromise(_0x3edc3a,_0x4a3995,_0x3744e2){return new BPromise(function(_0x745e6f,_0x1713d2){return client[_0x07a4('0xf')](_0x3edc3a,_0x3744e2)[_0x07a4('0x10')](function(_0x283994){logger['info'](_0x07a4('0x11'),_0x4a3995,_0x07a4('0x12'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x4a3995,_0x07a4('0x12'),JSON['stringify'](_0x283994));if(_0x283994[_0x07a4('0x13')]){if(_0x283994[_0x07a4('0x13')][_0x07a4('0x14')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x4a3995,_0x283994[_0x07a4('0x13')][_0x07a4('0x15')]);return _0x1713d2(_0x283994[_0x07a4('0x13')][_0x07a4('0x15')]);}logger[_0x07a4('0x13')](_0x07a4('0x11'),_0x4a3995,_0x283994[_0x07a4('0x13')][_0x07a4('0x15')]);return _0x745e6f(_0x283994['error'][_0x07a4('0x15')]);}else{logger[_0x07a4('0x16')](_0x07a4('0x11'),_0x4a3995,'request\x20sent');_0x745e6f(_0x283994[_0x07a4('0x17')][_0x07a4('0x15')]);}})[_0x07a4('0x18')](function(_0x2eeb04){logger[_0x07a4('0x13')](_0x07a4('0x11'),_0x4a3995,_0x2eeb04);_0x1713d2(_0x2eeb04);});});}exports[_0x07a4('0x19')]=function(_0x143c3e){var _0x2f5478=this;return new Promise(function(_0x17cfe3,_0x4bbdc6){return db[_0x07a4('0x1a')]['create'](_0x143c3e[_0x07a4('0x1b')],{'raw':_0x143c3e[_0x07a4('0x1c')]?_0x143c3e[_0x07a4('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x07a4('0x10')](function(_0x43a81d){logger[_0x07a4('0x16')](_0x07a4('0x19'),_0x143c3e);logger[_0x07a4('0x1d')](_0x07a4('0x19'),_0x143c3e,JSON[_0x07a4('0x1e')](_0x43a81d));_0x17cfe3(_0x43a81d);})[_0x07a4('0x18')](function(_0x1f624d){logger['error'](_0x07a4('0x19'),_0x1f624d[_0x07a4('0x15')],_0x143c3e);_0x4bbdc6(_0x2f5478[_0x07a4('0x13')](0x1f4,_0x1f624d[_0x07a4('0x15')]));});});}; \ No newline at end of file +var _0x27e9=['CreateChatMessage','ChatMessage','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x17406e,_0x1049fd){var _0x2bfc5a=function(_0x2aae05){while(--_0x2aae05){_0x17406e['push'](_0x17406e['shift']());}};_0x2bfc5a(++_0x1049fd);}(_0x27e9,0x116));var _0x927e=function(_0x2faa64,_0x6f5fe0){_0x2faa64=_0x2faa64-0x0;var _0x29f12f=_0x27e9[_0x2faa64];return _0x29f12f;};'use strict';var _=require(_0x927e('0x0'));var util=require(_0x927e('0x1'));var moment=require('moment');var BPromise=require(_0x927e('0x2'));var rs=require(_0x927e('0x3'));var fs=require('fs');var Redis=require(_0x927e('0x4'));var db=require(_0x927e('0x5'))['db'];var utils=require(_0x927e('0x6'));var logger=require(_0x927e('0x7'))('rpc');var config=require(_0x927e('0x8'));var jayson=require(_0x927e('0x9'));var client=jayson[_0x927e('0xa')]['http']({'port':0x232a});config[_0x927e('0xb')]=_[_0x927e('0xc')](config[_0x927e('0xb')],{'host':_0x927e('0xd'),'port':0x18eb});var socket=require(_0x927e('0xe'))(new Redis(config[_0x927e('0xb')]));require('./chatMessage.socket')[_0x927e('0xf')](socket);function respondWithRpcPromise(_0x359338,_0x5d1336,_0x26242e){return new BPromise(function(_0x2ecbfa,_0x8f9fd1){return client[_0x927e('0x10')](_0x359338,_0x26242e)[_0x927e('0x11')](function(_0x225a25){logger[_0x927e('0x12')](_0x927e('0x13'),_0x5d1336,_0x927e('0x14'));logger['debug'](_0x927e('0x15'),_0x5d1336,_0x927e('0x14'),JSON[_0x927e('0x16')](_0x225a25));if(_0x225a25[_0x927e('0x17')]){if(_0x225a25['error'][_0x927e('0x18')]===0x1f4){logger['error'](_0x927e('0x13'),_0x5d1336,_0x225a25['error'][_0x927e('0x19')]);return _0x8f9fd1(_0x225a25['error'][_0x927e('0x19')]);}logger[_0x927e('0x17')](_0x927e('0x13'),_0x5d1336,_0x225a25[_0x927e('0x17')]['message']);return _0x2ecbfa(_0x225a25[_0x927e('0x17')][_0x927e('0x19')]);}else{logger['info'](_0x927e('0x13'),_0x5d1336,_0x927e('0x14'));_0x2ecbfa(_0x225a25[_0x927e('0x1a')][_0x927e('0x19')]);}})[_0x927e('0x1b')](function(_0x43ee4a){logger[_0x927e('0x17')](_0x927e('0x13'),_0x5d1336,_0x43ee4a);_0x8f9fd1(_0x43ee4a);});});}exports[_0x927e('0x1c')]=function(_0x23afc4){var _0x30892c=this;return new Promise(function(_0x58c2f7,_0x3f20e6){return db[_0x927e('0x1d')][_0x927e('0x1e')](_0x23afc4[_0x927e('0x1f')],{'raw':_0x23afc4[_0x927e('0x20')]?_0x23afc4[_0x927e('0x20')][_0x927e('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x40d8ce){logger[_0x927e('0x12')]('CreateChatMessage',_0x23afc4);logger['debug'](_0x927e('0x1c'),_0x23afc4,JSON['stringify'](_0x40d8ce));_0x58c2f7(_0x40d8ce);})[_0x927e('0x1b')](function(_0x59413c){logger[_0x927e('0x17')](_0x927e('0x1c'),_0x59413c[_0x927e('0x19')],_0x23afc4);_0x3f20e6(_0x30892c[_0x927e('0x17')](0x1f4,_0x59413c[_0x927e('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 71f0db6..2dac4fa 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 _0x1ef3=['chatMessage:','./chatMessage.events','save','update','emit','removeListener','register','length'];(function(_0x5ce99f,_0x648dd1){var _0x187558=function(_0x302bb8){while(--_0x302bb8){_0x5ce99f['push'](_0x5ce99f['shift']());}};_0x187558(++_0x648dd1);}(_0x1ef3,0x69));var _0x31ef=function(_0x53cbc5,_0xdfb0ac){_0x53cbc5=_0x53cbc5-0x0;var _0x10cc2e=_0x1ef3[_0x53cbc5];return _0x10cc2e;};'use strict';var ChatMessageEvents=require(_0x31ef('0x0'));var events=[_0x31ef('0x1'),'remove',_0x31ef('0x2')];function createListener(_0x24447b,_0x30dbd7){return function(_0x4df75f){_0x30dbd7[_0x31ef('0x3')](_0x24447b,_0x4df75f);};}function removeListener(_0x58388a,_0x49ce87){return function(){ChatMessageEvents[_0x31ef('0x4')](_0x58388a,_0x49ce87);};}exports[_0x31ef('0x5')]=function(_0x81db4){for(var _0x454b60=0x0,_0x185f8c=events[_0x31ef('0x6')];_0x454b60<_0x185f8c;_0x454b60++){var _0x554347=events[_0x454b60];var _0xf94594=createListener(_0x31ef('0x7')+_0x554347,_0x81db4);ChatMessageEvents['on'](_0x554347,_0xf94594);}}; \ No newline at end of file +var _0x8ca9=['length','chatMessage:','./chatMessage.events','save','remove','update','register'];(function(_0x3779cf,_0x4f316a){var _0x264263=function(_0x2163de){while(--_0x2163de){_0x3779cf['push'](_0x3779cf['shift']());}};_0x264263(++_0x4f316a);}(_0x8ca9,0x9c));var _0x98ca=function(_0xb6298b,_0x2631cc){_0xb6298b=_0xb6298b-0x0;var _0x3239d9=_0x8ca9[_0xb6298b];return _0x3239d9;};'use strict';var ChatMessageEvents=require(_0x98ca('0x0'));var events=[_0x98ca('0x1'),_0x98ca('0x2'),_0x98ca('0x3')];function createListener(_0x3d9153,_0x22047f){return function(_0xe479d6){_0x22047f['emit'](_0x3d9153,_0xe479d6);};}function removeListener(_0x4c230f,_0x142793){return function(){ChatMessageEvents['removeListener'](_0x4c230f,_0x142793);};}exports[_0x98ca('0x4')]=function(_0x48415d){for(var _0x219619=0x0,_0xca4097=events[_0x98ca('0x5')];_0x219619<_0xca4097;_0x219619++){var _0x2852a0=events[_0x219619];var _0x323c95=createListener(_0x98ca('0x6')+_0x2852a0,_0x48415d);ChatMessageEvents['on'](_0x2852a0,_0x323c95);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index ab79fae..07733c9 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 _0x673f=['index','/describe','describe','/:id','show','tracked','chatmessage:create','create','put','update','/:id/accept','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x2ed8f3,_0x4aa12f){var _0x525a55=function(_0x4cfb58){while(--_0x4cfb58){_0x2ed8f3['push'](_0x2ed8f3['shift']());}};_0x525a55(++_0x4aa12f);}(_0x673f,0x73));var _0xf673=function(_0x730669,_0x6302a9){_0x730669=_0x730669-0x0;var _0x58a406=_0x673f[_0x730669];return _0x58a406;};'use strict';var multer=require(_0xf673('0x0'));var util=require(_0xf673('0x1'));var path=require('path');var timeout=require(_0xf673('0x2'));var express=require(_0xf673('0x3'));var router=express[_0xf673('0x4')]();var fs_extra=require(_0xf673('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf673('0x6'));var config=require(_0xf673('0x7'));var controller=require('./chatMessage.controller');router[_0xf673('0x8')]('/',auth[_0xf673('0x9')](),controller[_0xf673('0xa')]);router[_0xf673('0x8')](_0xf673('0xb'),auth['isAuthenticated'](),controller[_0xf673('0xc')]);router[_0xf673('0x8')](_0xf673('0xd'),auth['isAuthenticated'](),controller[_0xf673('0xe')]);router['post']('/',auth[_0xf673('0x9')](),interaction[_0xf673('0xf')]('chat',_0xf673('0x10')),controller[_0xf673('0x11')]);router[_0xf673('0x12')](_0xf673('0xd'),controller[_0xf673('0x13')]);router['put'](_0xf673('0x14'),auth[_0xf673('0x9')](),controller['accept']);router['put']('/:id/reject',auth[_0xf673('0x9')](),controller[_0xf673('0x15')]);router[_0xf673('0x16')]('/:id',auth[_0xf673('0x9')](),controller[_0xf673('0x17')]);module[_0xf673('0x18')]=router; \ No newline at end of file +var _0x3eaf=['../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','/:id/accept','accept','reject','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x3eaf,0x180));var _0xf3ea=function(_0x2e9626,_0x22c5a1){_0x2e9626=_0x2e9626-0x0;var _0x292f9c=_0x3eaf[_0x2e9626];return _0x292f9c;};'use strict';var multer=require(_0xf3ea('0x0'));var util=require(_0xf3ea('0x1'));var path=require(_0xf3ea('0x2'));var timeout=require('connect-timeout');var express=require(_0xf3ea('0x3'));var router=express[_0xf3ea('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf3ea('0x5'));var interaction=require(_0xf3ea('0x6'));var config=require(_0xf3ea('0x7'));var controller=require(_0xf3ea('0x8'));router[_0xf3ea('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf3ea('0x9')]('/describe',auth[_0xf3ea('0xa')](),controller[_0xf3ea('0xb')]);router['get'](_0xf3ea('0xc'),auth[_0xf3ea('0xa')](),controller[_0xf3ea('0xd')]);router[_0xf3ea('0xe')]('/',auth[_0xf3ea('0xa')](),interaction[_0xf3ea('0xf')](_0xf3ea('0x10'),_0xf3ea('0x11')),controller[_0xf3ea('0x12')]);router[_0xf3ea('0x13')](_0xf3ea('0xc'),controller['update']);router[_0xf3ea('0x13')](_0xf3ea('0x14'),auth['isAuthenticated'](),controller[_0xf3ea('0x15')]);router[_0xf3ea('0x13')]('/:id/reject',auth[_0xf3ea('0xa')](),controller[_0xf3ea('0x16')]);router[_0xf3ea('0x17')](_0xf3ea('0xc'),auth[_0xf3ea('0xa')](),controller[_0xf3ea('0x18')]);module[_0xf3ea('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index e61b81c..8704df4 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 _0xc83b=['medium','TEXT'];(function(_0x9c765f,_0x452200){var _0xcf23b1=function(_0x1198dd){while(--_0x1198dd){_0x9c765f['push'](_0x9c765f['shift']());}};_0xcf23b1(++_0x452200);}(_0xc83b,0x149));var _0xbc83=function(_0x5c280d,_0xd67fa0){_0x5c280d=_0x5c280d-0x0;var _0x460137=_0xc83b[_0x5c280d];return _0x460137;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xbc83('0x0')](_0xbc83('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x15f4=['TEXT','medium','sequelize'];(function(_0x5b7788,_0x309ae5){var _0x573871=function(_0x5c79fd){while(--_0x5c79fd){_0x5b7788['push'](_0x5b7788['shift']());}};_0x573871(++_0x309ae5);}(_0x15f4,0x167));var _0x415f=function(_0x4275af,_0x54d474){_0x4275af=_0x4275af-0x0;var _0x317cb6=_0x15f4[_0x4275af];return _0x317cb6;};'use strict';var Sequelize=require(_0x415f('0x0'));module['exports']={'body':{'type':Sequelize[_0x415f('0x1')](_0x415f('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 6c425f3..3212d82 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(_0x2af254,_0x4ee33f){var _0x574281=function(_0x448964){while(--_0x448964){_0x2af254['push'](_0x2af254['shift']());}};_0x574281(++_0x4ee33f);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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 _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x7a54,0x106));var _0x47a5=function(_0x579a37,_0x255448){_0x579a37=_0x579a37-0x0;var _0x12e8dc=_0x7a54[_0x579a37];return _0x12e8dc;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 3fdab1d..fb88e2b 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 _0x69e5=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports'];(function(_0x1cf4de,_0x144315){var _0x2987fd=function(_0xba7fd2){while(--_0xba7fd2){_0x1cf4de['push'](_0x1cf4de['shift']());}};_0x2987fd(++_0x144315);}(_0x69e5,0xf4));var _0x569e=function(_0x3fad5a,_0x2d3b02){_0x3fad5a=_0x3fad5a-0x0;var _0x4ca713=_0x69e5[_0x3fad5a];return _0x4ca713;};'use strict';var _=require(_0x569e('0x0'));var util=require('util');var logger=require(_0x569e('0x1'))(_0x569e('0x2'));var moment=require(_0x569e('0x3'));var BPromise=require(_0x569e('0x4'));var rp=require(_0x569e('0x5'));var fs=require('fs');var path=require(_0x569e('0x6'));var rimraf=require(_0x569e('0x7'));var config=require(_0x569e('0x8'));var attributes=require(_0x569e('0x9'));module[_0x569e('0xa')]=function(_0x408a99,_0x1d5531){return _0x408a99[_0x569e('0xb')](_0x569e('0xc'),attributes,{'tableName':_0x569e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x569e('0xe')});}; \ No newline at end of file +var _0xb00a=['bluebird','path','rimraf','../../config/environment','exports','define','ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x38df12,_0x40fbea){var _0x4cbe9=function(_0x3bfd91){while(--_0x3bfd91){_0x38df12['push'](_0x38df12['shift']());}};_0x4cbe9(++_0x40fbea);}(_0xb00a,0xa3));var _0xab00=function(_0x3cbdab,_0x3b2a8c){_0x3cbdab=_0x3cbdab-0x0;var _0x312b74=_0xb00a[_0x3cbdab];return _0x312b74;};'use strict';var _=require('lodash');var util=require(_0xab00('0x0'));var logger=require(_0xab00('0x1'))('api');var moment=require('moment');var BPromise=require(_0xab00('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xab00('0x3'));var rimraf=require(_0xab00('0x4'));var config=require(_0xab00('0x5'));var attributes=require('./chatOfflineMessage.attributes');module[_0xab00('0x6')]=function(_0x470e2f,_0x3b47ae){return _0x470e2f[_0xab00('0x7')](_0xab00('0x8'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xab00('0x9'),'collate':_0xab00('0xa')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 6120d2f..1c83fa9 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 _0x51d0=['ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x51d0,0xcd));var _0x051d=function(_0x1cd47d,_0x55bc75){_0x1cd47d=_0x1cd47d-0x0;var _0x29d52f=_0x51d0[_0x1cd47d];return _0x29d52f;};'use strict';var _=require(_0x051d('0x0'));var util=require(_0x051d('0x1'));var moment=require(_0x051d('0x2'));var BPromise=require(_0x051d('0x3'));var rs=require(_0x051d('0x4'));var fs=require('fs');var Redis=require(_0x051d('0x5'));var db=require(_0x051d('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x051d('0x7'));var config=require(_0x051d('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1849c6,_0x374f48,_0x388fcd){return new BPromise(function(_0x3e3273,_0x322098){return client[_0x051d('0x9')](_0x1849c6,_0x388fcd)[_0x051d('0xa')](function(_0x43cf43){logger[_0x051d('0xb')](_0x051d('0xc'),_0x374f48,_0x051d('0xd'));logger[_0x051d('0xe')](_0x051d('0xf'),_0x374f48,_0x051d('0xd'),JSON[_0x051d('0x10')](_0x43cf43));if(_0x43cf43[_0x051d('0x11')]){if(_0x43cf43[_0x051d('0x11')][_0x051d('0x12')]===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x374f48,_0x43cf43[_0x051d('0x11')][_0x051d('0x13')]);return _0x322098(_0x43cf43[_0x051d('0x11')]['message']);}logger['error'](_0x051d('0xc'),_0x374f48,_0x43cf43[_0x051d('0x11')]['message']);return _0x3e3273(_0x43cf43[_0x051d('0x11')][_0x051d('0x13')]);}else{logger['info'](_0x051d('0xc'),_0x374f48,_0x051d('0xd'));_0x3e3273(_0x43cf43[_0x051d('0x14')][_0x051d('0x13')]);}})[_0x051d('0x15')](function(_0x12b9b0){logger['error'](_0x051d('0xc'),_0x374f48,_0x12b9b0);_0x322098(_0x12b9b0);});});} \ No newline at end of file +var _0xadc5=['debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x47d12e,_0x2d0ada){var _0x1250dc=function(_0x21a5e8){while(--_0x21a5e8){_0x47d12e['push'](_0x47d12e['shift']());}};_0x1250dc(++_0x2d0ada);}(_0xadc5,0x1bd));var _0x5adc=function(_0x4f5185,_0x3f5e83){_0x4f5185=_0x4f5185-0x0;var _0x4f70d8=_0xadc5[_0x4f5185];return _0x4f70d8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5adc('0x0'));var BPromise=require(_0x5adc('0x1'));var rs=require(_0x5adc('0x2'));var fs=require('fs');var Redis=require(_0x5adc('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5adc('0x4'))(_0x5adc('0x5'));var config=require(_0x5adc('0x6'));var jayson=require(_0x5adc('0x7'));var client=jayson[_0x5adc('0x8')][_0x5adc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d8bf0,_0x44182d,_0x467654){return new BPromise(function(_0xc27950,_0x19b10e){return client[_0x5adc('0xa')](_0x2d8bf0,_0x467654)[_0x5adc('0xb')](function(_0x1c86dc){logger[_0x5adc('0xc')](_0x5adc('0xd'),_0x44182d,_0x5adc('0xe'));logger[_0x5adc('0xf')](_0x5adc('0x10'),_0x44182d,_0x5adc('0xe'),JSON[_0x5adc('0x11')](_0x1c86dc));if(_0x1c86dc[_0x5adc('0x12')]){if(_0x1c86dc[_0x5adc('0x12')][_0x5adc('0x13')]===0x1f4){logger[_0x5adc('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x44182d,_0x1c86dc[_0x5adc('0x12')][_0x5adc('0x14')]);return _0x19b10e(_0x1c86dc[_0x5adc('0x12')][_0x5adc('0x14')]);}logger[_0x5adc('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x44182d,_0x1c86dc[_0x5adc('0x12')][_0x5adc('0x14')]);return _0xc27950(_0x1c86dc['error'][_0x5adc('0x14')]);}else{logger[_0x5adc('0xc')](_0x5adc('0xd'),_0x44182d,_0x5adc('0xe'));_0xc27950(_0x1c86dc[_0x5adc('0x15')][_0x5adc('0x14')]);}})[_0x5adc('0x16')](function(_0x4412d9){logger[_0x5adc('0x12')](_0x5adc('0xd'),_0x44182d,_0x4412d9);_0x19b10e(_0x4412d9);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 2d3d584..3e0906f 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 _0x3b5a=['express','Router','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','put','delete','destroy','multer','util','path','connect-timeout'];(function(_0x4f90af,_0x14b70c){var _0x5e62c0=function(_0x4aa5b6){while(--_0x4aa5b6){_0x4f90af['push'](_0x4f90af['shift']());}};_0x5e62c0(++_0x14b70c);}(_0x3b5a,0x19c));var _0xa3b5=function(_0xcbfa6d,_0x3fd46d){_0xcbfa6d=_0xcbfa6d-0x0;var _0x156e91=_0x3b5a[_0xcbfa6d];return _0x156e91;};'use strict';var multer=require(_0xa3b5('0x0'));var util=require(_0xa3b5('0x1'));var path=require(_0xa3b5('0x2'));var timeout=require(_0xa3b5('0x3'));var express=require(_0xa3b5('0x4'));var router=express[_0xa3b5('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa3b5('0x6'));var controller=require('./chatOfflineMessage.controller');router[_0xa3b5('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa3b5('0x7')](_0xa3b5('0x8'),auth[_0xa3b5('0x9')](),controller[_0xa3b5('0xa')]);router[_0xa3b5('0x7')](_0xa3b5('0xb'),auth[_0xa3b5('0x9')](),controller[_0xa3b5('0xc')]);router['post']('/',auth[_0xa3b5('0x9')](),controller['create']);router[_0xa3b5('0xd')](_0xa3b5('0xb'),auth[_0xa3b5('0x9')](),controller['update']);router[_0xa3b5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xa3b5('0xf')]);module['exports']=router; \ No newline at end of file +var _0x2979=['../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','connect-timeout','express','Router','fs-extra'];(function(_0x52c71f,_0x5aa1e9){var _0x4063a1=function(_0xca8971){while(--_0xca8971){_0x52c71f['push'](_0x52c71f['shift']());}};_0x4063a1(++_0x5aa1e9);}(_0x2979,0x74));var _0x9297=function(_0x51ee74,_0x18e42e){_0x51ee74=_0x51ee74-0x0;var _0x1971dd=_0x2979[_0x51ee74];return _0x1971dd;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x9297('0x0'));var express=require(_0x9297('0x1'));var router=express[_0x9297('0x2')]();var fs_extra=require(_0x9297('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9297('0x4'));var controller=require(_0x9297('0x5'));router[_0x9297('0x6')]('/',auth[_0x9297('0x7')](),controller[_0x9297('0x8')]);router[_0x9297('0x6')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x9297('0x9'),auth[_0x9297('0x7')](),controller[_0x9297('0xa')]);router['post']('/',auth[_0x9297('0x7')](),controller['create']);router[_0x9297('0xb')](_0x9297('0x9'),auth['isAuthenticated'](),controller[_0x9297('0xc')]);router[_0x9297('0xd')](_0x9297('0x9'),auth[_0x9297('0x7')](),controller['destroy']);module[_0x9297('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index e1afbca..88afb91 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 _0x6066=['ENUM','mouseOver','timeout','STRING','INTEGER','sequelize'];(function(_0x3062da,_0x352b8f){var _0x1c95ba=function(_0x203c3e){while(--_0x203c3e){_0x3062da['push'](_0x3062da['shift']());}};_0x1c95ba(++_0x352b8f);}(_0x6066,0xa7));var _0x6606=function(_0xfd495c,_0x4a3c1a){_0xfd495c=_0xfd495c-0x0;var _0x561dd8=_0x6066[_0xfd495c];return _0x561dd8;};'use strict';var Sequelize=require(_0x6606('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6606('0x1')](_0x6606('0x2'),_0x6606('0x3')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x6606('0x4')]},'timeout':{'type':Sequelize[_0x6606('0x5')]}}; \ No newline at end of file +var _0x8109=['mouseOver','INTEGER','sequelize','exports','STRING'];(function(_0x474bc7,_0x2b7561){var _0x17566c=function(_0x1b1220){while(--_0x1b1220){_0x474bc7['push'](_0x474bc7['shift']());}};_0x17566c(++_0x2b7561);}(_0x8109,0x1ce));var _0x9810=function(_0x53146b,_0x599c6e){_0x53146b=_0x53146b-0x0;var _0x25b2b3=_0x8109[_0x53146b];return _0x25b2b3;};'use strict';var Sequelize=require(_0x9810('0x0'));module[_0x9810('0x1')]={'name':{'type':Sequelize[_0x9810('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x9810('0x3'),'timeout'),'defaultValue':_0x9810('0x3')},'selector':{'type':Sequelize[_0x9810('0x2')]},'timeout':{'type':Sequelize[_0x9810('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index addd9cf..ab27b29 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 _0x4016=['then','destroy','error','stack','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','rimraf','zip-dir','bluebird','util','path','ejs','fs-extra','squel','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x4016,0x131));var _0x6401=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4016[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6401('0x0'));var zipdir=require(_0x6401('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6401('0x2'));var Mustache=require('mustache');var util=require(_0x6401('0x3'));var path=require(_0x6401('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6401('0x5'));var fs=require('fs');var fs_extra=require(_0x6401('0x6'));var _=require('lodash');var squel=require(_0x6401('0x7'));var crypto=require('crypto');var jsforce=require(_0x6401('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x6401('0x9'));var querystring=require(_0x6401('0xa'));var Papa=require(_0x6401('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6401('0xc'));var as=require(_0x6401('0xd'));var hardwareService=require(_0x6401('0xe'));var logger=require('../../config/logger')(_0x6401('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6401('0x10'));var db=require(_0x6401('0x11'))['db'];function respondWithStatusCode(_0x26ec93,_0x45e88a){_0x45e88a=_0x45e88a||0xcc;return function(_0xf7fc5){if(_0xf7fc5){return _0x26ec93[_0x6401('0x12')](_0x45e88a);}return _0x26ec93[_0x6401('0x13')](_0x45e88a)[_0x6401('0x14')]();};}function respondWithResult(_0x381c17,_0x1f6edf){_0x1f6edf=_0x1f6edf||0xc8;return function(_0x45fcea){if(_0x45fcea){return _0x381c17[_0x6401('0x13')](_0x1f6edf)[_0x6401('0x15')](_0x45fcea);}};}function respondWithFilteredResult(_0x29fedc,_0x4c740a){return function(_0x1b510e){if(_0x1b510e){var _0x1fd3b8=typeof _0x4c740a[_0x6401('0x16')]===_0x6401('0x17')&&typeof _0x4c740a[_0x6401('0x18')]===_0x6401('0x17');var _0x4521b6=_0x1b510e['count'];var _0x55ca87=_0x1fd3b8?0x0:_0x4c740a[_0x6401('0x16')];var _0x50eda7=_0x1fd3b8?_0x1b510e[_0x6401('0x19')]:_0x4c740a[_0x6401('0x16')]+_0x4c740a[_0x6401('0x18')];var _0x3c3a6c;if(_0x50eda7>=_0x4521b6){_0x50eda7=_0x4521b6;_0x3c3a6c=0xc8;}else{_0x3c3a6c=0xce;}_0x29fedc[_0x6401('0x13')](_0x3c3a6c);return _0x29fedc[_0x6401('0x1a')](_0x6401('0x1b'),_0x55ca87+'-'+_0x50eda7+'/'+_0x4521b6)['json'](_0x1b510e);}return null;};}function patchUpdates(_0x10fd3c){return function(_0x44525b){try{jsonpatch[_0x6401('0x1c')](_0x44525b,_0x10fd3c,!![]);}catch(_0x1757ab){return BPromise['reject'](_0x1757ab);}return _0x44525b[_0x6401('0x1d')]();};}function saveUpdates(_0x343d25,_0x4ed76d){return function(_0x20b445){if(_0x20b445){return _0x20b445[_0x6401('0x1e')](_0x343d25)[_0x6401('0x1f')](function(_0xdea921){return _0xdea921;});}return null;};}function removeEntity(_0x19d6a0,_0x39bca3){return function(_0xed5d29){if(_0xed5d29){return _0xed5d29[_0x6401('0x20')]()[_0x6401('0x1f')](function(){_0x19d6a0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55818a,_0xee5737){return function(_0x12f19a){if(!_0x12f19a){_0x55818a[_0x6401('0x12')](0x194);}return _0x12f19a;};}function handleError(_0x4e6d9f,_0x3b1d99){_0x3b1d99=_0x3b1d99||0x1f4;return function(_0x102f69){logger[_0x6401('0x21')](_0x102f69[_0x6401('0x22')]);if(_0x102f69['name']){delete _0x102f69['name'];}_0x4e6d9f[_0x6401('0x13')](_0x3b1d99)[_0x6401('0x23')](_0x102f69);};}exports[_0x6401('0x24')]=function(_0x466a35,_0x549b8c){var _0x7f6e88={'raw':!![],'where':{'id':_0x466a35[_0x6401('0x25')]['id']}},_0x43e089={};_0x43e089[_0x6401('0x26')]=_[_0x6401('0x27')](db[_0x6401('0x28')][_0x6401('0x29')]);_0x43e089[_0x6401('0x2a')]=_['keys'](_0x466a35[_0x6401('0x2a')]);_0x43e089[_0x6401('0x2b')]=_[_0x6401('0x2c')](_0x43e089[_0x6401('0x26')],_0x43e089['query']);_0x7f6e88[_0x6401('0x2d')]=_[_0x6401('0x2c')](_0x43e089[_0x6401('0x26')],qs['fields'](_0x466a35['query'][_0x6401('0x2e')]));_0x7f6e88['attributes']=_0x7f6e88[_0x6401('0x2d')][_0x6401('0x2f')]?_0x7f6e88[_0x6401('0x2d')]:_0x43e089[_0x6401('0x26')];if(_0x466a35[_0x6401('0x2a')][_0x6401('0x30')]){_0x7f6e88[_0x6401('0x31')]=[{'all':!![]}];}_0x7f6e88=_[_0x6401('0x32')]({},_0x7f6e88,_0x466a35[_0x6401('0x33')]);return db['ChatProactiveAction'][_0x6401('0x34')](_0x7f6e88)[_0x6401('0x1f')](handleEntityNotFound(_0x549b8c,null))[_0x6401('0x1f')](respondWithResult(_0x549b8c,null))[_0x6401('0x35')](handleError(_0x549b8c,null));};exports[_0x6401('0x36')]=function(_0x556354,_0xd7a00f){return db[_0x6401('0x28')]['create'](_0x556354[_0x6401('0x37')],{})['then'](respondWithResult(_0xd7a00f,0xc9))[_0x6401('0x35')](handleError(_0xd7a00f,null));};exports[_0x6401('0x1e')]=function(_0x5317f8,_0x444339){if(_0x5317f8[_0x6401('0x37')]['id']){delete _0x5317f8[_0x6401('0x37')]['id'];}return db[_0x6401('0x28')]['find']({'where':{'id':_0x5317f8[_0x6401('0x25')]['id']}})[_0x6401('0x1f')](handleEntityNotFound(_0x444339,null))[_0x6401('0x1f')](saveUpdates(_0x5317f8['body'],null))[_0x6401('0x1f')](respondWithResult(_0x444339,null))[_0x6401('0x35')](handleError(_0x444339,null));};exports['destroy']=function(_0x79d73f,_0x337d1c){return db[_0x6401('0x28')][_0x6401('0x34')]({'where':{'id':_0x79d73f[_0x6401('0x25')]['id']}})[_0x6401('0x1f')](handleEntityNotFound(_0x337d1c,null))[_0x6401('0x1f')](removeEntity(_0x337d1c,null))[_0x6401('0x35')](handleError(_0x337d1c,null));}; \ No newline at end of file +var _0xc090=['papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','sendStatus','error','name','send','show','params','model','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','merge','options','find','catch','body','update','ChatProactiveAction','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring'];(function(_0x52dfa5,_0x49ac28){var _0x49970d=function(_0x3e0e9e){while(--_0x3e0e9e){_0x52dfa5['push'](_0x52dfa5['shift']());}};_0x49970d(++_0x49ac28);}(_0xc090,0x112));var _0x0c09=function(_0x36f104,_0xfae805){_0x36f104=_0x36f104-0x0;var _0x985b3d=_0xc090[_0x36f104];return _0x985b3d;};'use strict';var emlformat=require(_0x0c09('0x0'));var rimraf=require(_0x0c09('0x1'));var zipdir=require(_0x0c09('0x2'));var jsonpatch=require(_0x0c09('0x3'));var rp=require(_0x0c09('0x4'));var moment=require(_0x0c09('0x5'));var BPromise=require(_0x0c09('0x6'));var Mustache=require(_0x0c09('0x7'));var util=require(_0x0c09('0x8'));var path=require('path');var sox=require(_0x0c09('0x9'));var csv=require(_0x0c09('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0c09('0xb'));var squel=require('squel');var crypto=require(_0x0c09('0xc'));var jsforce=require(_0x0c09('0xd'));var deskjs=require(_0x0c09('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0c09('0xf'));var Papa=require(_0x0c09('0x10'));var Redis=require('ioredis');var authService=require(_0x0c09('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0c09('0x12'));var hardwareService=require(_0x0c09('0x13'));var logger=require(_0x0c09('0x14'))(_0x0c09('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0c09('0x16'))['db'];function respondWithStatusCode(_0x5d1d77,_0x59df8b){_0x59df8b=_0x59df8b||0xcc;return function(_0xbe8522){if(_0xbe8522){return _0x5d1d77['sendStatus'](_0x59df8b);}return _0x5d1d77[_0x0c09('0x17')](_0x59df8b)[_0x0c09('0x18')]();};}function respondWithResult(_0x21c45b,_0xeb18fb){_0xeb18fb=_0xeb18fb||0xc8;return function(_0x388b2e){if(_0x388b2e){return _0x21c45b[_0x0c09('0x17')](_0xeb18fb)[_0x0c09('0x19')](_0x388b2e);}};}function respondWithFilteredResult(_0x2dcdae,_0x367c86){return function(_0x264d21){if(_0x264d21){var _0x482dc1=typeof _0x367c86[_0x0c09('0x1a')]===_0x0c09('0x1b')&&typeof _0x367c86[_0x0c09('0x1c')]===_0x0c09('0x1b');var _0x20ad8a=_0x264d21[_0x0c09('0x1d')];var _0x2d610d=_0x482dc1?0x0:_0x367c86[_0x0c09('0x1a')];var _0xffc47=_0x482dc1?_0x264d21[_0x0c09('0x1d')]:_0x367c86[_0x0c09('0x1a')]+_0x367c86[_0x0c09('0x1c')];var _0x519eea;if(_0xffc47>=_0x20ad8a){_0xffc47=_0x20ad8a;_0x519eea=0xc8;}else{_0x519eea=0xce;}_0x2dcdae[_0x0c09('0x17')](_0x519eea);return _0x2dcdae[_0x0c09('0x1e')]('Content-Range',_0x2d610d+'-'+_0xffc47+'/'+_0x20ad8a)['json'](_0x264d21);}return null;};}function patchUpdates(_0x2af860){return function(_0x205962){try{jsonpatch[_0x0c09('0x1f')](_0x205962,_0x2af860,!![]);}catch(_0x48c124){return BPromise[_0x0c09('0x20')](_0x48c124);}return _0x205962[_0x0c09('0x21')]();};}function saveUpdates(_0x3206b5,_0x5488ac){return function(_0x301938){if(_0x301938){return _0x301938['update'](_0x3206b5)[_0x0c09('0x22')](function(_0x39452e){return _0x39452e;});}return null;};}function removeEntity(_0x3aaabf,_0x1dc995){return function(_0xad7cf9){if(_0xad7cf9){return _0xad7cf9[_0x0c09('0x23')]()[_0x0c09('0x22')](function(){_0x3aaabf[_0x0c09('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x544ac4,_0xcf0257){return function(_0x1b7731){if(!_0x1b7731){_0x544ac4[_0x0c09('0x24')](0x194);}return _0x1b7731;};}function handleError(_0x63bd83,_0x36e0c0){_0x36e0c0=_0x36e0c0||0x1f4;return function(_0x449262){logger[_0x0c09('0x25')](_0x449262['stack']);if(_0x449262['name']){delete _0x449262[_0x0c09('0x26')];}_0x63bd83[_0x0c09('0x17')](_0x36e0c0)[_0x0c09('0x27')](_0x449262);};}exports[_0x0c09('0x28')]=function(_0x2ce4e9,_0x61a907){var _0x1dee90={'raw':!![],'where':{'id':_0x2ce4e9[_0x0c09('0x29')]['id']}},_0x376742={};_0x376742[_0x0c09('0x2a')]=_['keys'](db['ChatProactiveAction'][_0x0c09('0x2b')]);_0x376742[_0x0c09('0x2c')]=_['keys'](_0x2ce4e9[_0x0c09('0x2c')]);_0x376742[_0x0c09('0x2d')]=_[_0x0c09('0x2e')](_0x376742[_0x0c09('0x2a')],_0x376742[_0x0c09('0x2c')]);_0x1dee90[_0x0c09('0x2f')]=_['intersection'](_0x376742[_0x0c09('0x2a')],qs[_0x0c09('0x30')](_0x2ce4e9[_0x0c09('0x2c')]['fields']));_0x1dee90[_0x0c09('0x2f')]=_0x1dee90['attributes']['length']?_0x1dee90['attributes']:_0x376742[_0x0c09('0x2a')];if(_0x2ce4e9[_0x0c09('0x2c')][_0x0c09('0x31')]){_0x1dee90[_0x0c09('0x32')]=[{'all':!![]}];}_0x1dee90=_[_0x0c09('0x33')]({},_0x1dee90,_0x2ce4e9[_0x0c09('0x34')]);return db['ChatProactiveAction'][_0x0c09('0x35')](_0x1dee90)[_0x0c09('0x22')](handleEntityNotFound(_0x61a907,null))['then'](respondWithResult(_0x61a907,null))[_0x0c09('0x36')](handleError(_0x61a907,null));};exports['create']=function(_0x5728f2,_0x3dde4a){return db['ChatProactiveAction']['create'](_0x5728f2[_0x0c09('0x37')],{})[_0x0c09('0x22')](respondWithResult(_0x3dde4a,0xc9))[_0x0c09('0x36')](handleError(_0x3dde4a,null));};exports[_0x0c09('0x38')]=function(_0x39cd87,_0x1b602c){if(_0x39cd87[_0x0c09('0x37')]['id']){delete _0x39cd87['body']['id'];}return db[_0x0c09('0x39')][_0x0c09('0x35')]({'where':{'id':_0x39cd87[_0x0c09('0x29')]['id']}})[_0x0c09('0x22')](handleEntityNotFound(_0x1b602c,null))[_0x0c09('0x22')](saveUpdates(_0x39cd87[_0x0c09('0x37')],null))[_0x0c09('0x22')](respondWithResult(_0x1b602c,null))[_0x0c09('0x36')](handleError(_0x1b602c,null));};exports[_0x0c09('0x23')]=function(_0x56ac67,_0x25be9c){return db[_0x0c09('0x39')][_0x0c09('0x35')]({'where':{'id':_0x56ac67[_0x0c09('0x29')]['id']}})[_0x0c09('0x22')](handleEntityNotFound(_0x25be9c,null))[_0x0c09('0x22')](removeEntity(_0x25be9c,null))[_0x0c09('0x36')](handleError(_0x25be9c,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index ff84384..2d0e571 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 _0x729a=['ChatProactiveAction','chat_proactive_actions','util','api','moment','request-promise','path','rimraf','./chatProactiveAction.attributes','exports','define'];(function(_0x2d7c70,_0x56305c){var _0x45d604=function(_0x2b6142){while(--_0x2b6142){_0x2d7c70['push'](_0x2d7c70['shift']());}};_0x45d604(++_0x56305c);}(_0x729a,0x1c5));var _0xa729=function(_0x5efe28,_0x410eb8){_0x5efe28=_0x5efe28-0x0;var _0x260c7a=_0x729a[_0x5efe28];return _0x260c7a;};'use strict';var _=require('lodash');var util=require(_0xa729('0x0'));var logger=require('../../config/logger')(_0xa729('0x1'));var moment=require(_0xa729('0x2'));var BPromise=require('bluebird');var rp=require(_0xa729('0x3'));var fs=require('fs');var path=require(_0xa729('0x4'));var rimraf=require(_0xa729('0x5'));var config=require('../../config/environment');var attributes=require(_0xa729('0x6'));module[_0xa729('0x7')]=function(_0x99c33f,_0x3ee917){return _0x99c33f[_0xa729('0x8')](_0xa729('0x9'),attributes,{'tableName':_0xa729('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x349b=['./chatProactiveAction.attributes','exports','ChatProactiveAction','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1ea2b4,_0x2235e2){var _0x3cab45=function(_0x4ce8cc){while(--_0x4ce8cc){_0x1ea2b4['push'](_0x1ea2b4['shift']());}};_0x3cab45(++_0x2235e2);}(_0x349b,0x16b));var _0xb349=function(_0x30d9be,_0x4259e5){_0x30d9be=_0x30d9be-0x0;var _0xce6de5=_0x349b[_0x30d9be];return _0xce6de5;};'use strict';var _=require(_0xb349('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb349('0x1'));var moment=require(_0xb349('0x2'));var BPromise=require(_0xb349('0x3'));var rp=require(_0xb349('0x4'));var fs=require('fs');var path=require(_0xb349('0x5'));var rimraf=require(_0xb349('0x6'));var config=require('../../config/environment');var attributes=require(_0xb349('0x7'));module[_0xb349('0x8')]=function(_0x3ac5c5,_0x199be8){return _0x3ac5c5['define'](_0xb349('0x9'),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 44fbf89..4fe9ee4 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 _0xb266=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','../../mysqldb'];(function(_0x13ab4c,_0x4c09fe){var _0x4c1e4f=function(_0x508fbc){while(--_0x508fbc){_0x13ab4c['push'](_0x13ab4c['shift']());}};_0x4c1e4f(++_0x4c09fe);}(_0xb266,0x18b));var _0x6b26=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xb266[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x6b26('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6b26('0x1'));var rs=require(_0x6b26('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b26('0x3'))['db'];var utils=require(_0x6b26('0x4'));var logger=require(_0x6b26('0x5'))(_0x6b26('0x6'));var config=require(_0x6b26('0x7'));var jayson=require(_0x6b26('0x8'));var client=jayson[_0x6b26('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x516e58,_0x19c952,_0x51a134){return new BPromise(function(_0x32509e,_0x2ba722){return client['request'](_0x516e58,_0x51a134)[_0x6b26('0xa')](function(_0x28456f){logger[_0x6b26('0xb')]('ChatProactiveAction,\x20%s,\x20%s',_0x19c952,_0x6b26('0xc'));logger[_0x6b26('0xd')](_0x6b26('0xe'),_0x19c952,_0x6b26('0xc'),JSON[_0x6b26('0xf')](_0x28456f));if(_0x28456f['error']){if(_0x28456f[_0x6b26('0x10')][_0x6b26('0x11')]===0x1f4){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x19c952,_0x28456f[_0x6b26('0x10')]['message']);return _0x2ba722(_0x28456f[_0x6b26('0x10')][_0x6b26('0x12')]);}logger[_0x6b26('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x19c952,_0x28456f[_0x6b26('0x10')][_0x6b26('0x12')]);return _0x32509e(_0x28456f[_0x6b26('0x10')][_0x6b26('0x12')]);}else{logger[_0x6b26('0xb')]('ChatProactiveAction,\x20%s,\x20%s',_0x19c952,_0x6b26('0xc'));_0x32509e(_0x28456f[_0x6b26('0x13')][_0x6b26('0x12')]);}})[_0x6b26('0x14')](function(_0x49061a){logger[_0x6b26('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x19c952,_0x49061a);_0x2ba722(_0x49061a);});});} \ No newline at end of file +var _0xb8b2=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','lodash','util','moment'];(function(_0x297f87,_0x529eec){var _0x1f33a1=function(_0x431bf1){while(--_0x431bf1){_0x297f87['push'](_0x297f87['shift']());}};_0x1f33a1(++_0x529eec);}(_0xb8b2,0x11a));var _0x2b8b=function(_0x43776a,_0x4eb74c){_0x43776a=_0x43776a-0x0;var _0x18eb8f=_0xb8b2[_0x43776a];return _0x18eb8f;};'use strict';var _=require(_0x2b8b('0x0'));var util=require(_0x2b8b('0x1'));var moment=require(_0x2b8b('0x2'));var BPromise=require(_0x2b8b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b8b('0x4'));var db=require(_0x2b8b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2b8b('0x6'))(_0x2b8b('0x7'));var config=require(_0x2b8b('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x182dc8,_0x44fd59,_0x4e749d){return new BPromise(function(_0x807766,_0x32bcbe){return client[_0x2b8b('0x9')](_0x182dc8,_0x4e749d)[_0x2b8b('0xa')](function(_0x2bacd5){logger[_0x2b8b('0xb')](_0x2b8b('0xc'),_0x44fd59,'request\x20sent');logger[_0x2b8b('0xd')](_0x2b8b('0xe'),_0x44fd59,_0x2b8b('0xf'),JSON[_0x2b8b('0x10')](_0x2bacd5));if(_0x2bacd5['error']){if(_0x2bacd5['error']['code']===0x1f4){logger['error'](_0x2b8b('0xc'),_0x44fd59,_0x2bacd5['error']['message']);return _0x32bcbe(_0x2bacd5['error']['message']);}logger[_0x2b8b('0x11')](_0x2b8b('0xc'),_0x44fd59,_0x2bacd5[_0x2b8b('0x11')][_0x2b8b('0x12')]);return _0x807766(_0x2bacd5[_0x2b8b('0x11')]['message']);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x44fd59,_0x2b8b('0xf'));_0x807766(_0x2bacd5['result']['message']);}})['catch'](function(_0x7cbecc){logger[_0x2b8b('0x11')](_0x2b8b('0xc'),_0x44fd59,_0x7cbecc);_0x32bcbe(_0x7cbecc);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index dee0d3e..788c754 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 _0x55ca=['multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','create','destroy','exports'];(function(_0x29bb31,_0x689236){var _0x22cced=function(_0x46b58c){while(--_0x46b58c){_0x29bb31['push'](_0x29bb31['shift']());}};_0x22cced(++_0x689236);}(_0x55ca,0x126));var _0xa55c=function(_0x3dc587,_0x2ebc6c){_0x3dc587=_0x3dc587-0x0;var _0x29f93a=_0x55ca[_0x3dc587];return _0x29f93a;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')](_0xa55c('0x8'),auth[_0xa55c('0x9')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x9')](),controller[_0xa55c('0xb')]);router['put'](_0xa55c('0x8'),auth[_0xa55c('0x9')](),controller['update']);router['delete'](_0xa55c('0x8'),auth[_0xa55c('0x9')](),controller[_0xa55c('0xc')]);module[_0xa55c('0xd')]=router; \ No newline at end of file +var _0x038b=['isAuthenticated','/:id','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','show','post'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x038b,0x114));var _0xb038=function(_0x27f865,_0x25b6c5){_0x27f865=_0x27f865-0x0;var _0x121c3c=_0x038b[_0x27f865];return _0x121c3c;};'use strict';var multer=require('multer');var util=require(_0xb038('0x0'));var path=require(_0xb038('0x1'));var timeout=require(_0xb038('0x2'));var express=require('express');var router=express[_0xb038('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb038('0x4'));var interaction=require(_0xb038('0x5'));var config=require('../../config/environment');var controller=require(_0xb038('0x6'));router[_0xb038('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xb038('0x8')]);router[_0xb038('0x9')]('/',auth[_0xb038('0xa')](),controller['create']);router['put'](_0xb038('0xb'),auth[_0xb038('0xa')](),controller['update']);router['delete'](_0xb038('0xb'),auth[_0xb038('0xa')](),controller['destroy']);module[_0xb038('0xc')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 42a0ad6..33d4aa2 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 _0x3c4f=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','INTEGER'];(function(_0x2ed7b0,_0x3ef860){var _0x2f138a=function(_0x14cbb4){while(--_0x14cbb4){_0x2ed7b0['push'](_0x2ed7b0['shift']());}};_0x2f138a(++_0x3ef860);}(_0x3c4f,0x18c));var _0xf3c4=function(_0x43404c,_0x589709){_0x43404c=_0x43404c-0x0;var _0x28ce07=_0x3c4f[_0x43404c];return _0x28ce07;};'use strict';var Sequelize=require(_0xf3c4('0x0'));module[_0xf3c4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf3c4('0x2')]},'timeout':{'type':Sequelize[_0xf3c4('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf3c4('0x4')](_0xf3c4('0x5'),_0xf3c4('0x6'),_0xf3c4('0x7'))}}; \ No newline at end of file +var _0xa9d3=['INTEGER','beepall','roundrobin','exports','STRING'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xa9d3,0x9e));var _0x3a9d=function(_0x154148,_0x429c05){_0x154148=_0x154148-0x0;var _0x44f5a2=_0xa9d3[_0x154148];return _0x44f5a2;};'use strict';var Sequelize=require('sequelize');module[_0x3a9d('0x0')]={'name':{'type':Sequelize[_0x3a9d('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x3a9d('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x3a9d('0x3'),_0x3a9d('0x4'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 9159fd7..de584aa 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 _0x339d=['voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','emit','removeTeams','select','from','team_has_chat_queues','join','user_has_teams','ut.UserId\x20=\x20?','push','QueryTypes','every','includes','all','union','compact','value','removeAgents','forEach','addAgents','omit','userChatQueue:save','isArray','userChatQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','count','offset','set','save','update','UserProfileResource','destroy','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','limit','sort','pick','filters','filter','where','merge','VIRTUAL','include','rows','show','keys','options','find','create','body','user','role','get','ChatQueues','userProfileId','autoAssociation','params','getMembers','findOne','UserChatQueue','hasOwnProperty','order','ChatQueueId','findAll','User','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','ids','Agents','online'];(function(_0x234e45,_0xbd8fe){var _0x411856=function(_0x2da5be){while(--_0x2da5be){_0x234e45['push'](_0x234e45['shift']());}};_0x411856(++_0xbd8fe);}(_0x339d,0x14c));var _0xd339=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x339d[_0x47fd36];return _0x21a0fc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd339('0x0'));var zipdir=require(_0xd339('0x1'));var jsonpatch=require(_0xd339('0x2'));var rp=require(_0xd339('0x3'));var moment=require('moment');var BPromise=require(_0xd339('0x4'));var Mustache=require(_0xd339('0x5'));var util=require(_0xd339('0x6'));var path=require(_0xd339('0x7'));var sox=require(_0xd339('0x8'));var csv=require(_0xd339('0x9'));var ejs=require(_0xd339('0xa'));var fs=require('fs');var fs_extra=require(_0xd339('0xb'));var _=require(_0xd339('0xc'));var squel=require(_0xd339('0xd'));var crypto=require(_0xd339('0xe'));var jsforce=require(_0xd339('0xf'));var deskjs=require(_0xd339('0x10'));var toCsv=require(_0xd339('0x9'));var querystring=require('querystring');var Papa=require(_0xd339('0x11'));var Redis=require(_0xd339('0x12'));var authService=require(_0xd339('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd339('0x14'));var hardwareService=require(_0xd339('0x15'));var logger=require(_0xd339('0x16'))(_0xd339('0x17'));var utils=require(_0xd339('0x18'));var config=require(_0xd339('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd339('0x1a'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xd339('0x1b'),'port':0x18eb});var socket=require(_0xd339('0x1c'))(new Redis(config[_0xd339('0x1d')]));require(_0xd339('0x1e'))[_0xd339('0x1f')](socket);var jayson=require(_0xd339('0x20'));var client=jayson[_0xd339('0x21')][_0xd339('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x242c05,_0x2f86e5,_0x11292d,_0x50e4ad){return new BPromise(function(_0x1a222e,_0x5ab49f){var _0x6031c1=_0x50e4ad||client;return _0x6031c1[_0xd339('0x23')](_0x242c05,_0x11292d)[_0xd339('0x24')](function(_0x5ded79){logger[_0xd339('0x25')](_0xd339('0x26'),_0x2f86e5,_0xd339('0x27'));logger[_0xd339('0x28')](_0xd339('0x29'),_0x2f86e5,'request\x20sent',JSON['stringify'](_0x5ded79));if(_0x5ded79[_0xd339('0x2a')]){if(_0x5ded79[_0xd339('0x2a')][_0xd339('0x2b')]===0x1f4){logger['error'](_0xd339('0x26'),_0x2f86e5,_0x5ded79[_0xd339('0x2a')]['message']);return _0x5ab49f(_0x5ded79[_0xd339('0x2a')]['message']);}logger[_0xd339('0x2a')]('ChatQueue,\x20%s,\x20%s',_0x2f86e5,_0x5ded79[_0xd339('0x2a')][_0xd339('0x2c')]);return _0x1a222e(_0x5ded79[_0xd339('0x2a')]['message']);}else{logger[_0xd339('0x25')](_0xd339('0x26'),_0x2f86e5,_0xd339('0x27'));_0x1a222e(_0x5ded79['result'][_0xd339('0x2c')]);}})[_0xd339('0x2d')](function(_0x2585ba){logger['error'](_0xd339('0x26'),_0x2f86e5,_0x2585ba);_0x5ab49f(_0x2585ba);});});}function respondWithStatusCode(_0x5bb781,_0x565442){_0x565442=_0x565442||0xcc;return function(_0x55109a){if(_0x55109a){return _0x5bb781[_0xd339('0x2e')](_0x565442);}return _0x5bb781[_0xd339('0x2f')](_0x565442)[_0xd339('0x30')]();};}function respondWithResult(_0x2d7b26,_0x438ec8){_0x438ec8=_0x438ec8||0xc8;return function(_0xd58b22){if(_0xd58b22){return _0x2d7b26[_0xd339('0x2f')](_0x438ec8)[_0xd339('0x31')](_0xd58b22);}};}function respondWithFilteredResult(_0x30c701,_0xc070b7){return function(_0x3a6d8b){if(_0x3a6d8b){var _0x9c6198=typeof _0xc070b7['offset']==='undefined'&&typeof _0xc070b7['limit']==='undefined';var _0x329833=_0x3a6d8b[_0xd339('0x32')];var _0x59524d=_0x9c6198?0x0:_0xc070b7[_0xd339('0x33')];var _0x122263=_0x9c6198?_0x3a6d8b[_0xd339('0x32')]:_0xc070b7[_0xd339('0x33')]+_0xc070b7['limit'];var _0x58ee90;if(_0x122263>=_0x329833){_0x122263=_0x329833;_0x58ee90=0xc8;}else{_0x58ee90=0xce;}_0x30c701[_0xd339('0x2f')](_0x58ee90);return _0x30c701[_0xd339('0x34')]('Content-Range',_0x59524d+'-'+_0x122263+'/'+_0x329833)[_0xd339('0x31')](_0x3a6d8b);}return null;};}function patchUpdates(_0x2b2a29){return function(_0x5cb3e2){try{jsonpatch['apply'](_0x5cb3e2,_0x2b2a29,!![]);}catch(_0x59b137){return BPromise['reject'](_0x59b137);}return _0x5cb3e2[_0xd339('0x35')]();};}function saveUpdates(_0x4c2ba6,_0x2de9c6){return function(_0x1595b4){if(_0x1595b4){return _0x1595b4[_0xd339('0x36')](_0x4c2ba6)['then'](function(_0x56e65c){return _0x56e65c;});}return null;};}function removeEntity(_0x4f34d4,_0x4cc9c2){return function(_0x2a0e3c){if(_0x2a0e3c){return _0x2a0e3c['destroy']()[_0xd339('0x24')](function(){var _0x38cdee=_0x2a0e3c['get']({'plain':!![]});var _0x3a9a5d='ChatQueues';return db[_0xd339('0x37')][_0xd339('0x38')]({'where':{'type':_0x3a9a5d,'resourceId':_0x38cdee['id']}})['then'](function(){return _0x2a0e3c;});})[_0xd339('0x24')](function(){_0x4f34d4[_0xd339('0x2f')](0xcc)[_0xd339('0x30')]();});}};}function handleEntityNotFound(_0xc151ac,_0x48fb47){return function(_0x27a985){if(!_0x27a985){_0xc151ac[_0xd339('0x2e')](0x194);}return _0x27a985;};}function handleError(_0x200924,_0x1472c7){_0x1472c7=_0x1472c7||0x1f4;return function(_0x3a31b6){logger[_0xd339('0x2a')](_0x3a31b6[_0xd339('0x39')]);if(_0x3a31b6['name']){delete _0x3a31b6[_0xd339('0x3a')];}_0x200924[_0xd339('0x2f')](_0x1472c7)[_0xd339('0x3b')](_0x3a31b6);};}exports[_0xd339('0x3c')]=function(_0x35b7d1,_0x2d9b9a){var _0x5590f8={},_0xa879a0={},_0x3decb9={'count':0x0,'rows':[]};var _0x1da689=_[_0xd339('0x3d')](db[_0xd339('0x3e')][_0xd339('0x3f')],function(_0x3da856){return{'name':_0x3da856[_0xd339('0x40')],'type':_0x3da856[_0xd339('0x41')][_0xd339('0x42')]};});_0xa879a0[_0xd339('0x43')]=_[_0xd339('0x3d')](_0x1da689,_0xd339('0x3a'));_0xa879a0[_0xd339('0x44')]=_['keys'](_0x35b7d1['query']);_0xa879a0['filters']=_[_0xd339('0x45')](_0xa879a0[_0xd339('0x43')],_0xa879a0['query']);_0x5590f8[_0xd339('0x46')]=_['intersection'](_0xa879a0[_0xd339('0x43')],qs[_0xd339('0x47')](_0x35b7d1[_0xd339('0x44')][_0xd339('0x47')]));_0x5590f8[_0xd339('0x46')]=_0x5590f8['attributes'][_0xd339('0x48')]?_0x5590f8[_0xd339('0x46')]:_0xa879a0[_0xd339('0x43')];if(!_0x35b7d1['query']['hasOwnProperty'](_0xd339('0x49'))){_0x5590f8[_0xd339('0x4a')]=qs[_0xd339('0x4a')](_0x35b7d1[_0xd339('0x44')]['limit']);_0x5590f8['offset']=qs[_0xd339('0x33')](_0x35b7d1['query']['offset']);}_0x5590f8['order']=qs[_0xd339('0x4b')](_0x35b7d1[_0xd339('0x44')][_0xd339('0x4b')]);_0x5590f8['where']=qs['filters'](_[_0xd339('0x4c')](_0x35b7d1['query'],_0xa879a0[_0xd339('0x4d')]),_0x1da689);if(_0x35b7d1[_0xd339('0x44')][_0xd339('0x4e')]){_0x5590f8[_0xd339('0x4f')]=_[_0xd339('0x50')](_0x5590f8[_0xd339('0x4f')],{'$or':_[_0xd339('0x3d')](_0x1da689,function(_0x1bd133){if(_0x1bd133[_0xd339('0x41')]!==_0xd339('0x51')){var _0x46e21b={};_0x46e21b[_0x1bd133[_0xd339('0x3a')]]={'$like':'%'+_0x35b7d1['query'][_0xd339('0x4e')]+'%'};return _0x46e21b;}})});}_0x5590f8=_['merge']({},_0x5590f8,_0x35b7d1['options']);var _0x501da4={'where':_0x5590f8[_0xd339('0x4f')]};return db[_0xd339('0x3e')][_0xd339('0x32')](_0x501da4)[_0xd339('0x24')](function(_0x39dcda){_0x3decb9[_0xd339('0x32')]=_0x39dcda;if(_0x35b7d1[_0xd339('0x44')]['includeAll']){_0x5590f8[_0xd339('0x52')]=[{'all':!![]}];}return db[_0xd339('0x3e')]['findAll'](_0x5590f8);})['then'](function(_0x32690a){_0x3decb9[_0xd339('0x53')]=_0x32690a;return _0x3decb9;})[_0xd339('0x24')](respondWithFilteredResult(_0x2d9b9a,_0x5590f8))[_0xd339('0x2d')](handleError(_0x2d9b9a,null));};exports[_0xd339('0x54')]=function(_0x360716,_0x4ff5b8){var _0x211eba={'raw':!![],'where':{'id':_0x360716['params']['id']}},_0x4691f6={};_0x4691f6[_0xd339('0x43')]=_[_0xd339('0x55')](db[_0xd339('0x3e')]['rawAttributes']);_0x4691f6[_0xd339('0x44')]=_[_0xd339('0x55')](_0x360716['query']);_0x4691f6[_0xd339('0x4d')]=_[_0xd339('0x45')](_0x4691f6[_0xd339('0x43')],_0x4691f6[_0xd339('0x44')]);_0x211eba[_0xd339('0x46')]=_[_0xd339('0x45')](_0x4691f6[_0xd339('0x43')],qs['fields'](_0x360716[_0xd339('0x44')]['fields']));_0x211eba[_0xd339('0x46')]=_0x211eba[_0xd339('0x46')]['length']?_0x211eba['attributes']:_0x4691f6['model'];if(_0x360716['query']['includeAll']){_0x211eba[_0xd339('0x52')]=[{'all':!![]}];}_0x211eba=_['merge']({},_0x211eba,_0x360716[_0xd339('0x56')]);return db[_0xd339('0x3e')][_0xd339('0x57')](_0x211eba)[_0xd339('0x24')](handleEntityNotFound(_0x4ff5b8,null))[_0xd339('0x24')](respondWithResult(_0x4ff5b8,null))[_0xd339('0x2d')](handleError(_0x4ff5b8,null));};exports[_0xd339('0x58')]=function(_0xecb299,_0x5864c2){return db['ChatQueue']['create'](_0xecb299[_0xd339('0x59')],{})['then'](function(_0x44f694){var _0x26ba04=_0xecb299[_0xd339('0x5a')]['get']({'plain':!![]});if(!_0x26ba04)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26ba04[_0xd339('0x5b')]==='user'){var _0x5e3302=_0x44f694[_0xd339('0x5c')]({'plain':!![]});var _0x4ff9fa=_0xd339('0x5d');return db['UserProfileSection'][_0xd339('0x57')]({'where':{'name':_0x4ff9fa,'userProfileId':_0x26ba04[_0xd339('0x5e')]},'raw':!![]})[_0xd339('0x24')](function(_0x29ee84){if(_0x29ee84&&_0x29ee84[_0xd339('0x5f')]===0x0){return db[_0xd339('0x37')][_0xd339('0x58')]({'name':_0x5e3302[_0xd339('0x3a')],'resourceId':_0x5e3302['id'],'type':_0x29ee84[_0xd339('0x3a')],'sectionId':_0x29ee84['id']},{})[_0xd339('0x24')](function(){return _0x44f694;});}else{return _0x44f694;}})[_0xd339('0x2d')](function(_0x53e76a){logger[_0xd339('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53e76a);throw _0x53e76a;});}return _0x44f694;})[_0xd339('0x24')](respondWithResult(_0x5864c2,0xc9))[_0xd339('0x2d')](handleError(_0x5864c2,null));};exports[_0xd339('0x36')]=function(_0x47a37d,_0x226e03){if(_0x47a37d[_0xd339('0x59')]['id']){delete _0x47a37d['body']['id'];}return db[_0xd339('0x3e')][_0xd339('0x57')]({'where':{'id':_0x47a37d[_0xd339('0x60')]['id']}})[_0xd339('0x24')](handleEntityNotFound(_0x226e03,null))[_0xd339('0x24')](saveUpdates(_0x47a37d['body'],null))[_0xd339('0x24')](respondWithResult(_0x226e03,null))['catch'](handleError(_0x226e03,null));};exports[_0xd339('0x38')]=function(_0x49e69c,_0xb9c93a){return db[_0xd339('0x3e')][_0xd339('0x57')]({'where':{'id':_0x49e69c['params']['id']}})[_0xd339('0x24')](handleEntityNotFound(_0xb9c93a,null))['then'](removeEntity(_0xb9c93a,null))[_0xd339('0x2d')](handleError(_0xb9c93a,null));};exports['describe']=function(_0x3b0480,_0x22de48){return db[_0xd339('0x3e')]['describe']()[_0xd339('0x24')](respondWithResult(_0x22de48,null))[_0xd339('0x2d')](handleError(_0x22de48,null));};exports[_0xd339('0x61')]=function(_0x5ca8dc,_0x174916,_0x49fa3a){var _0x722aea={'raw':!![],'where':{}},_0x2d0965={},_0x911510;return db[_0xd339('0x3e')][_0xd339('0x62')]({'where':{'id':_0x5ca8dc['params']['id']}})[_0xd339('0x24')](handleEntityNotFound(_0x174916,null))['then'](function(_0x3e90f7){if(_0x3e90f7){_0x911510=_0x3e90f7[_0xd339('0x5c')]({'plain':!![]});_0x2d0965['model']=_[_0xd339('0x55')](db[_0xd339('0x63')][_0xd339('0x3f')]);_0x2d0965[_0xd339('0x44')]=_[_0xd339('0x55')](_0x5ca8dc[_0xd339('0x44')]);_0x2d0965[_0xd339('0x4d')]=_[_0xd339('0x45')](_0x2d0965[_0xd339('0x43')],_0x2d0965['query']);_0x722aea[_0xd339('0x46')]=_['intersection'](_0x2d0965[_0xd339('0x43')],qs[_0xd339('0x47')](_0x5ca8dc[_0xd339('0x44')][_0xd339('0x47')]));_0x722aea[_0xd339('0x46')]=_0x722aea[_0xd339('0x46')][_0xd339('0x48')]?_0x722aea[_0xd339('0x46')]:_0x2d0965['model'];if(!_0x5ca8dc[_0xd339('0x44')][_0xd339('0x64')](_0xd339('0x49'))){_0x722aea[_0xd339('0x4a')]=qs['limit'](_0x5ca8dc[_0xd339('0x44')][_0xd339('0x4a')]);_0x722aea[_0xd339('0x33')]=qs[_0xd339('0x33')](_0x5ca8dc['query'][_0xd339('0x33')]);}_0x722aea[_0xd339('0x65')]=qs[_0xd339('0x4b')](_0x5ca8dc[_0xd339('0x44')]['sort']);_0x722aea[_0xd339('0x4f')]=qs[_0xd339('0x4d')](_[_0xd339('0x4c')](_0x5ca8dc['query'],_0x2d0965[_0xd339('0x4d')]));_0x722aea['where'][_0xd339('0x66')]=_0x3e90f7['id'];if(_0x5ca8dc['query'][_0xd339('0x4e')]){_0x722aea[_0xd339('0x4f')]=_['merge'](_0x722aea['where'],{'$or':_[_0xd339('0x3d')](_0x722aea['attributes'],function(_0x5a6a2d){var _0x384c43={};_0x384c43[_0x5a6a2d]={'$like':'%'+_0x5ca8dc[_0xd339('0x44')]['filter']+'%'};return _0x384c43;})});}_0x722aea=_[_0xd339('0x50')]({},_0x722aea,_0x5ca8dc['options']);return db[_0xd339('0x63')][_0xd339('0x67')](_0x722aea);}})[_0xd339('0x24')](function(_0x2440c8){if(_0x2440c8){return db[_0xd339('0x68')]['findAndCountAll']({'where':{'id':_[_0xd339('0x3d')](_0x2440c8,_0xd339('0x69')),'role':_0xd339('0x6a')},'attributes':['id',_0xd339('0x3a'),_0xd339('0x6b'),_0xd339('0x6c'),_0xd339('0x6d')]});}})[_0xd339('0x24')](function(_0x53d2a0){if(_0x53d2a0){return{'count':_0x53d2a0[_0xd339('0x32')],'rows':_[_0xd339('0x3d')](_0x53d2a0[_0xd339('0x53')],function(_0x49791f){return{'membername':_0x49791f['name'],'UserId':_0x49791f['id'],'queue_name':_0x911510['name'],'ChatQueueId':_0x911510['id'],'interface':util[_0xd339('0x6e')](_0xd339('0x6f'),_0xd339('0x70'),_0x49791f['name']),'penalty':0x0,'paused':_0x49791f[_0xd339('0x6b')],'createdAt':_0x49791f[_0xd339('0x6d')],'updatedAt':_0x49791f[_0xd339('0x6c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x174916,_0x722aea))[_0xd339('0x2d')](handleError(_0x174916,null));};exports[_0xd339('0x71')]=function(_0x1da7b2,_0x17e1a0,_0x543197){var _0x30ed28={};var _0x5754b1={};var _0x480738;var _0x399064;return db[_0xd339('0x3e')][_0xd339('0x62')]({'where':{'id':_0x1da7b2[_0xd339('0x60')]['id']}})[_0xd339('0x24')](handleEntityNotFound(_0x17e1a0,null))['then'](function(_0x3791b1){if(_0x3791b1){_0x480738=_0x3791b1;_0x5754b1[_0xd339('0x43')]=_['keys'](db[_0xd339('0x72')]['rawAttributes']);_0x5754b1[_0xd339('0x44')]=_['keys'](_0x1da7b2[_0xd339('0x44')]);_0x5754b1[_0xd339('0x4d')]=_[_0xd339('0x45')](_0x5754b1['model'],_0x5754b1[_0xd339('0x44')]);_0x30ed28[_0xd339('0x46')]=_[_0xd339('0x45')](_0x5754b1[_0xd339('0x43')],qs['fields'](_0x1da7b2[_0xd339('0x44')][_0xd339('0x47')]));_0x30ed28[_0xd339('0x46')]=_0x30ed28[_0xd339('0x46')]['length']?_0x30ed28[_0xd339('0x46')]:_0x5754b1[_0xd339('0x43')];_0x30ed28['order']=qs[_0xd339('0x4b')](_0x1da7b2[_0xd339('0x44')][_0xd339('0x4b')]);_0x30ed28[_0xd339('0x4f')]=qs[_0xd339('0x4d')](_[_0xd339('0x4c')](_0x1da7b2[_0xd339('0x44')],_0x5754b1[_0xd339('0x4d')]));if(_0x1da7b2[_0xd339('0x44')][_0xd339('0x4e')]){_0x30ed28[_0xd339('0x4f')]=_['merge'](_0x30ed28[_0xd339('0x4f')],{'$or':_[_0xd339('0x3d')](_0x30ed28[_0xd339('0x46')],function(_0x327b2f){var _0x457cc1={};_0x457cc1[_0x327b2f]={'$like':'%'+_0x1da7b2[_0xd339('0x44')][_0xd339('0x4e')]+'%'};return _0x457cc1;})});}_0x30ed28=_['merge']({},_0x30ed28,_0x1da7b2[_0xd339('0x56')]);return _0x480738[_0xd339('0x71')](_0x30ed28);}})[_0xd339('0x24')](function(_0x2ea8d5){if(_0x2ea8d5){_0x399064=_0x2ea8d5['length'];if(!_0x1da7b2[_0xd339('0x44')][_0xd339('0x64')](_0xd339('0x49'))){_0x30ed28[_0xd339('0x4a')]=qs[_0xd339('0x4a')](_0x1da7b2['query'][_0xd339('0x4a')]);_0x30ed28[_0xd339('0x33')]=qs[_0xd339('0x33')](_0x1da7b2[_0xd339('0x44')][_0xd339('0x33')]);}return _0x480738[_0xd339('0x71')](_0x30ed28);}})[_0xd339('0x24')](function(_0xa5f632){if(_0xa5f632){return _0xa5f632?{'count':_0x399064,'rows':_0xa5f632}:null;}})[_0xd339('0x24')](respondWithResult(_0x17e1a0,null))[_0xd339('0x2d')](handleError(_0x17e1a0,null));};exports['addTeams']=function(_0x26ec34,_0x540b15,_0x4fb112){var _0x654f0b=_0x26ec34[_0xd339('0x59')][_0xd339('0x73')];return db[_0xd339('0x72')][_0xd339('0x67')]({'where':{'id':_0x654f0b},'attributes':['id'],'include':[{'model':db[_0xd339('0x68')],'as':_0xd339('0x74'),'attributes':['id',_0xd339('0x3a'),_0xd339('0x75'),_0xd339('0x76'),_0xd339('0x77')],'raw':!![]}]})['then'](function(_0x3ddcaf){if(_0x3ddcaf){var _0x49ce21=_[_0xd339('0x78')](_0x3ddcaf,function(_0x53e284){var _0x54075a=_0x53e284[_0xd339('0x5c')]({'plain':!![]});return _0x54075a[_0xd339('0x74')];});return db[_0xd339('0x3e')]['find']({'where':{'id':_0x26ec34['params']['id']}})[_0xd339('0x24')](function(_0x309dda){return db[_0xd339('0x79')][_0xd339('0x7a')](function(_0x228bd1){return _0x309dda[_0xd339('0x7b')](_0x654f0b,{'transaction':_0x228bd1})[_0xd339('0x24')](function(){return BPromise[_0xd339('0x7c')](_0x49ce21,function(_0x4a5f8e){return db['UserChatQueue'][_0xd339('0x7d')]({'where':{'UserId':_0x4a5f8e['id'],'ChatQueueId':_0x26ec34['params']['id']},'transaction':_0x228bd1});});})['then'](function(){_0x49ce21['forEach'](function(_0x310550){socket[_0xd339('0x7e')]('userChatQueue:save',{'UserId':_0x310550['id'],'ChatQueueId':_0x309dda['id']});});});});});}})[_0xd339('0x24')](respondWithStatusCode(_0x540b15,null))[_0xd339('0x2d')](handleError(_0x540b15,null));};exports[_0xd339('0x7f')]=function(_0x280bce,_0x12a0d6,_0x3c4798){return db[_0xd339('0x72')][_0xd339('0x67')]({'where':{'id':_0x280bce['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xd339('0x24')](handleEntityNotFound(_0x12a0d6,null))[_0xd339('0x24')](function(_0x34c4e1){var _0x5766b6=_[_0xd339('0x3d')](_0x34c4e1,'id');var _0x25b950=[];var _0x298403=[];var _0x218aea=squel[_0xd339('0x80')]();_0x218aea['field']('tq.TeamId')[_0xd339('0x81')](_0xd339('0x82'),'tq')[_0xd339('0x83')](_0xd339('0x84'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('ChatQueueId\x20=\x20?',_0x280bce['params']['id']);for(var _0x34a4d3=0x0;_0x34a4d3<_0x34c4e1[_0xd339('0x48')];_0x34a4d3+=0x1){let _0x14f2f5=_0x34c4e1[_0x34a4d3];for(var _0xc60975=0x0;_0xc60975<_0x14f2f5[_0xd339('0x74')][_0xd339('0x48')];_0xc60975+=0x1){let _0x4525d1=_0x14f2f5[_0xd339('0x74')][_0xc60975];var _0x511741=_0x218aea['clone']();_0x511741[_0xd339('0x4f')](_0xd339('0x85'),_0x4525d1['id']);_0x298403[_0xd339('0x86')](db[_0xd339('0x79')][_0xd339('0x44')](_0x511741['toString'](),{'type':db[_0xd339('0x79')][_0xd339('0x87')]['SELECT']})[_0xd339('0x24')](function(_0x4e40d3){if(_0x4e40d3[_0xd339('0x48')]===0x1){return _0x4525d1['id'];}else{var _0x3287c8=_[_0xd339('0x88')](_['map'](_0x4e40d3,'TeamId'),function(_0x2af64e){return _[_0xd339('0x89')](_0x5766b6,_0x2af64e);});if(_0x3287c8){return _0x4525d1['id'];}}}));}}return BPromise[_0xd339('0x8a')](_0x298403)[_0xd339('0x24')](function(_0x233d81){_0x25b950=_(_0x25b950)[_0xd339('0x8b')](_0x233d81)[_0xd339('0x8c')]()[_0xd339('0x8d')]();return db[_0xd339('0x3e')][_0xd339('0x57')]({'where':{'id':_0x280bce['params']['id']}})[_0xd339('0x24')](function(_0x3947d1){return db['sequelize'][_0xd339('0x7a')](function(_0x240be8){return _0x3947d1[_0xd339('0x7f')](_0x280bce[_0xd339('0x44')]['ids'],{'transaction':_0x240be8})[_0xd339('0x24')](function(){if(!_['isEmpty'](_0x25b950)){return _0x3947d1[_0xd339('0x8e')](_0x25b950,{'transaction':_0x240be8});}})['then'](function(){_0x25b950[_0xd339('0x8f')](function(_0x4e7d7d){socket[_0xd339('0x7e')]('userChatQueue:remove',{'UserId':_0x4e7d7d,'ChatQueueId':_0x3947d1['id']});});});});});});})[_0xd339('0x24')](respondWithStatusCode(_0x12a0d6,null))[_0xd339('0x2d')](handleError(_0x12a0d6,null));};exports['addAgents']=function(_0xa926c2,_0x133a65,_0x414ba0){return db[_0xd339('0x3e')][_0xd339('0x57')]({'where':{'id':_0xa926c2[_0xd339('0x60')]['id']}})[_0xd339('0x24')](handleEntityNotFound(_0x133a65,null))[_0xd339('0x24')](function(_0x43940c){if(_0x43940c){return _0x43940c[_0xd339('0x90')](_0xa926c2[_0xd339('0x59')][_0xd339('0x73')],_[_0xd339('0x91')](_0xa926c2['body'],[_0xd339('0x73'),'id'])||{})['spread'](function(_0x54ab3a){for(var _0x279872=0x0;_0x279872<_0xa926c2['body'][_0xd339('0x73')][_0xd339('0x48')];_0x279872+=0x1){socket[_0xd339('0x7e')](_0xd339('0x92'),{'UserId':Number(_0xa926c2['body'][_0xd339('0x73')][_0x279872]),'ChatQueueId':Number(_0xa926c2['params']['id'])});}return _0x54ab3a;});}})[_0xd339('0x24')](respondWithResult(_0x133a65,null))[_0xd339('0x2d')](handleError(_0x133a65,null));};exports[_0xd339('0x8e')]=function(_0x47c6f1,_0x561d4b,_0x220927){return db[_0xd339('0x3e')]['find']({'where':{'id':_0x47c6f1[_0xd339('0x60')]['id']}})[_0xd339('0x24')](handleEntityNotFound(_0x561d4b,null))[_0xd339('0x24')](function(_0x5de296){if(_0x5de296){return _0x5de296['removeAgents'](_0x47c6f1[_0xd339('0x44')][_0xd339('0x73')])[_0xd339('0x24')](function(){if(_[_0xd339('0x93')](_0x47c6f1[_0xd339('0x44')][_0xd339('0x73')])){for(var _0x4e4a67=0x0;_0x4e4a67<_0x47c6f1['query']['ids'][_0xd339('0x48')];_0x4e4a67+=0x1){socket['emit'](_0xd339('0x94'),{'UserId':Number(_0x47c6f1[_0xd339('0x44')][_0xd339('0x73')][_0x4e4a67]),'ChatQueueId':Number(_0x47c6f1[_0xd339('0x60')]['id'])});}}else{socket['emit'](_0xd339('0x94'),{'UserId':Number(_0x47c6f1[_0xd339('0x44')][_0xd339('0x73')]),'ChatQueueId':Number(_0x47c6f1[_0xd339('0x60')]['id'])});}});}})[_0xd339('0x24')](respondWithStatusCode(_0x561d4b,null))['catch'](handleError(_0x561d4b,null));};exports[_0xd339('0x95')]=function(_0x267149,_0x421ee6,_0x579f10){var _0x184c42={};var _0xc1dd0a={};var _0x156f57;var _0x1ef422;return db[_0xd339('0x3e')]['findOne']({'where':{'id':_0x267149[_0xd339('0x60')]['id']}})[_0xd339('0x24')](handleEntityNotFound(_0x421ee6,null))[_0xd339('0x24')](function(_0x321f0b){if(_0x321f0b){_0x156f57=_0x321f0b;_0xc1dd0a['model']=_[_0xd339('0x55')](db['User'][_0xd339('0x3f')]);_0xc1dd0a['query']=_[_0xd339('0x55')](_0x267149[_0xd339('0x44')]);_0xc1dd0a['filters']=_['intersection'](_0xc1dd0a['model'],_0xc1dd0a[_0xd339('0x44')]);_0x184c42[_0xd339('0x46')]=_['intersection'](_0xc1dd0a['model'],qs[_0xd339('0x47')](_0x267149[_0xd339('0x44')]['fields']));_0x184c42[_0xd339('0x46')]=_0x184c42[_0xd339('0x46')][_0xd339('0x48')]?_0x184c42['attributes']:_0xc1dd0a[_0xd339('0x43')];_0x184c42[_0xd339('0x65')]=qs['sort'](_0x267149[_0xd339('0x44')][_0xd339('0x4b')]);_0x184c42[_0xd339('0x4f')]=qs[_0xd339('0x4d')](_[_0xd339('0x4c')](_0x267149[_0xd339('0x44')],_0xc1dd0a[_0xd339('0x4d')]));if(_0x267149[_0xd339('0x44')][_0xd339('0x4e')]){_0x184c42[_0xd339('0x4f')]=_[_0xd339('0x50')](_0x184c42[_0xd339('0x4f')],{'$or':_[_0xd339('0x3d')](_0x184c42[_0xd339('0x46')],function(_0x5f49d6){var _0x35f8ea={};_0x35f8ea[_0x5f49d6]={'$like':'%'+_0x267149[_0xd339('0x44')]['filter']+'%'};return _0x35f8ea;})});}_0x184c42=_['merge']({},_0x184c42,_0x267149[_0xd339('0x56')]);return _0x156f57['getAgents'](_0x184c42);}})['then'](function(_0x955771){if(_0x955771){_0x1ef422=_0x955771[_0xd339('0x48')];if(!_0x267149[_0xd339('0x44')][_0xd339('0x64')](_0xd339('0x49'))){_0x184c42[_0xd339('0x4a')]=qs[_0xd339('0x4a')](_0x267149[_0xd339('0x44')][_0xd339('0x4a')]);_0x184c42['offset']=qs[_0xd339('0x33')](_0x267149[_0xd339('0x44')]['offset']);}return _0x156f57[_0xd339('0x95')](_0x184c42);}})[_0xd339('0x24')](function(_0x2a14e0){if(_0x2a14e0){return _0x2a14e0?{'count':_0x1ef422,'rows':_0x2a14e0}:null;}})['then'](respondWithResult(_0x421ee6,null))[_0xd339('0x2d')](handleError(_0x421ee6,null));}; \ No newline at end of file +var _0xcdc4=['field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','Agents','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','emit','userChatQueue:remove','addAgents','omit','spread','getAgents','pick','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','http','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','ChatQueues','sendStatus','stack','name','index','map','ChatQueue','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserChatQueue','length','ChatQueueId','findAndCountAll','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','User','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','forEach','userChatQueue:save','removeTeams','ids'];(function(_0x4f203d,_0x485658){var _0x512282=function(_0x409d79){while(--_0x409d79){_0x4f203d['push'](_0x4f203d['shift']());}};_0x512282(++_0x485658);}(_0xcdc4,0x151));var _0x4cdc=function(_0x18313b,_0x5c914f){_0x18313b=_0x18313b-0x0;var _0x2ba97d=_0xcdc4[_0x18313b];return _0x2ba97d;};'use strict';var emlformat=require(_0x4cdc('0x0'));var rimraf=require(_0x4cdc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4cdc('0x2'));var moment=require(_0x4cdc('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4cdc('0x4'));var util=require(_0x4cdc('0x5'));var path=require(_0x4cdc('0x6'));var sox=require(_0x4cdc('0x7'));var csv=require(_0x4cdc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4cdc('0x9'));var squel=require(_0x4cdc('0xa'));var crypto=require('crypto');var jsforce=require(_0x4cdc('0xb'));var deskjs=require(_0x4cdc('0xc'));var toCsv=require(_0x4cdc('0x8'));var querystring=require('querystring');var Papa=require(_0x4cdc('0xd'));var Redis=require(_0x4cdc('0xe'));var authService=require(_0x4cdc('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4cdc('0x10'));var hardwareService=require(_0x4cdc('0x11'));var logger=require(_0x4cdc('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x4cdc('0x13'));var licenseUtil=require(_0x4cdc('0x14'));var db=require(_0x4cdc('0x15'))['db'];config['redis']=_['defaults'](config[_0x4cdc('0x16')],{'host':_0x4cdc('0x17'),'port':0x18eb});var socket=require(_0x4cdc('0x18'))(new Redis(config[_0x4cdc('0x16')]));require('./chatQueue.socket')[_0x4cdc('0x19')](socket);var jayson=require(_0x4cdc('0x1a'));var client=jayson['client'][_0x4cdc('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4b2c67,_0xfd77c2,_0x3b4758,_0x1dc43d){return new BPromise(function(_0x5608b0,_0x394bd2){var _0x5a860d=_0x1dc43d||client;return _0x5a860d[_0x4cdc('0x1c')](_0x4b2c67,_0x3b4758)[_0x4cdc('0x1d')](function(_0x4d7ad0){logger[_0x4cdc('0x1e')]('ChatQueue,\x20%s,\x20%s',_0xfd77c2,_0x4cdc('0x1f'));logger[_0x4cdc('0x20')](_0x4cdc('0x21'),_0xfd77c2,_0x4cdc('0x1f'),JSON[_0x4cdc('0x22')](_0x4d7ad0));if(_0x4d7ad0[_0x4cdc('0x23')]){if(_0x4d7ad0['error'][_0x4cdc('0x24')]===0x1f4){logger[_0x4cdc('0x23')](_0x4cdc('0x25'),_0xfd77c2,_0x4d7ad0[_0x4cdc('0x23')][_0x4cdc('0x26')]);return _0x394bd2(_0x4d7ad0[_0x4cdc('0x23')][_0x4cdc('0x26')]);}logger[_0x4cdc('0x23')](_0x4cdc('0x25'),_0xfd77c2,_0x4d7ad0[_0x4cdc('0x23')][_0x4cdc('0x26')]);return _0x5608b0(_0x4d7ad0[_0x4cdc('0x23')][_0x4cdc('0x26')]);}else{logger[_0x4cdc('0x1e')]('ChatQueue,\x20%s,\x20%s',_0xfd77c2,_0x4cdc('0x1f'));_0x5608b0(_0x4d7ad0[_0x4cdc('0x27')]['message']);}})['catch'](function(_0x5dc2a8){logger['error'](_0x4cdc('0x25'),_0xfd77c2,_0x5dc2a8);_0x394bd2(_0x5dc2a8);});});}function respondWithStatusCode(_0x4bcb66,_0x16786e){_0x16786e=_0x16786e||0xcc;return function(_0x1ae64e){if(_0x1ae64e){return _0x4bcb66['sendStatus'](_0x16786e);}return _0x4bcb66[_0x4cdc('0x28')](_0x16786e)[_0x4cdc('0x29')]();};}function respondWithResult(_0x4ad6ed,_0x40fa07){_0x40fa07=_0x40fa07||0xc8;return function(_0x47c280){if(_0x47c280){return _0x4ad6ed['status'](_0x40fa07)[_0x4cdc('0x2a')](_0x47c280);}};}function respondWithFilteredResult(_0x215a1e,_0x385985){return function(_0x49670f){if(_0x49670f){var _0x5177b5=typeof _0x385985[_0x4cdc('0x2b')]===_0x4cdc('0x2c')&&typeof _0x385985['limit']===_0x4cdc('0x2c');var _0x2073c8=_0x49670f[_0x4cdc('0x2d')];var _0x484ee5=_0x5177b5?0x0:_0x385985[_0x4cdc('0x2b')];var _0x435034=_0x5177b5?_0x49670f['count']:_0x385985[_0x4cdc('0x2b')]+_0x385985[_0x4cdc('0x2e')];var _0x577273;if(_0x435034>=_0x2073c8){_0x435034=_0x2073c8;_0x577273=0xc8;}else{_0x577273=0xce;}_0x215a1e[_0x4cdc('0x28')](_0x577273);return _0x215a1e[_0x4cdc('0x2f')](_0x4cdc('0x30'),_0x484ee5+'-'+_0x435034+'/'+_0x2073c8)[_0x4cdc('0x2a')](_0x49670f);}return null;};}function patchUpdates(_0x8e9be9){return function(_0xdf4356){try{jsonpatch[_0x4cdc('0x31')](_0xdf4356,_0x8e9be9,!![]);}catch(_0x385f12){return BPromise[_0x4cdc('0x32')](_0x385f12);}return _0xdf4356[_0x4cdc('0x33')]();};}function saveUpdates(_0xca1641,_0x2c17dd){return function(_0x34ce13){if(_0x34ce13){return _0x34ce13[_0x4cdc('0x34')](_0xca1641)[_0x4cdc('0x1d')](function(_0x496647){return _0x496647;});}return null;};}function removeEntity(_0x1ce63d,_0x55f0e9){return function(_0x16d841){if(_0x16d841){return _0x16d841[_0x4cdc('0x35')]()[_0x4cdc('0x1d')](function(){var _0x760d7f=_0x16d841['get']({'plain':!![]});var _0x3b6017=_0x4cdc('0x36');return db['UserProfileResource'][_0x4cdc('0x35')]({'where':{'type':_0x3b6017,'resourceId':_0x760d7f['id']}})[_0x4cdc('0x1d')](function(){return _0x16d841;});})[_0x4cdc('0x1d')](function(){_0x1ce63d[_0x4cdc('0x28')](0xcc)[_0x4cdc('0x29')]();});}};}function handleEntityNotFound(_0x3c08e5,_0x4b3bd7){return function(_0x15c506){if(!_0x15c506){_0x3c08e5[_0x4cdc('0x37')](0x194);}return _0x15c506;};}function handleError(_0x59d2b7,_0x4f3acb){_0x4f3acb=_0x4f3acb||0x1f4;return function(_0x3f9512){logger[_0x4cdc('0x23')](_0x3f9512[_0x4cdc('0x38')]);if(_0x3f9512['name']){delete _0x3f9512[_0x4cdc('0x39')];}_0x59d2b7['status'](_0x4f3acb)['send'](_0x3f9512);};}exports[_0x4cdc('0x3a')]=function(_0x27377d,_0x19eb6a){var _0x177099={},_0x344265={},_0x4213d3={'count':0x0,'rows':[]};var _0x214677=_[_0x4cdc('0x3b')](db[_0x4cdc('0x3c')]['rawAttributes'],function(_0x1c9f2b){return{'name':_0x1c9f2b['fieldName'],'type':_0x1c9f2b[_0x4cdc('0x3d')][_0x4cdc('0x3e')]};});_0x344265[_0x4cdc('0x3f')]=_['map'](_0x214677,'name');_0x344265[_0x4cdc('0x40')]=_['keys'](_0x27377d[_0x4cdc('0x40')]);_0x344265[_0x4cdc('0x41')]=_[_0x4cdc('0x42')](_0x344265[_0x4cdc('0x3f')],_0x344265[_0x4cdc('0x40')]);_0x177099[_0x4cdc('0x43')]=_[_0x4cdc('0x42')](_0x344265[_0x4cdc('0x3f')],qs[_0x4cdc('0x44')](_0x27377d[_0x4cdc('0x40')][_0x4cdc('0x44')]));_0x177099[_0x4cdc('0x43')]=_0x177099[_0x4cdc('0x43')]['length']?_0x177099['attributes']:_0x344265[_0x4cdc('0x3f')];if(!_0x27377d[_0x4cdc('0x40')][_0x4cdc('0x45')](_0x4cdc('0x46'))){_0x177099[_0x4cdc('0x2e')]=qs[_0x4cdc('0x2e')](_0x27377d[_0x4cdc('0x40')]['limit']);_0x177099['offset']=qs[_0x4cdc('0x2b')](_0x27377d[_0x4cdc('0x40')][_0x4cdc('0x2b')]);}_0x177099[_0x4cdc('0x47')]=qs[_0x4cdc('0x48')](_0x27377d[_0x4cdc('0x40')][_0x4cdc('0x48')]);_0x177099[_0x4cdc('0x49')]=qs[_0x4cdc('0x41')](_['pick'](_0x27377d[_0x4cdc('0x40')],_0x344265[_0x4cdc('0x41')]),_0x214677);if(_0x27377d[_0x4cdc('0x40')][_0x4cdc('0x4a')]){_0x177099['where']=_[_0x4cdc('0x4b')](_0x177099['where'],{'$or':_[_0x4cdc('0x3b')](_0x214677,function(_0x3106a4){if(_0x3106a4[_0x4cdc('0x3d')]!==_0x4cdc('0x4c')){var _0x4caaf3={};_0x4caaf3[_0x3106a4[_0x4cdc('0x39')]]={'$like':'%'+_0x27377d[_0x4cdc('0x40')][_0x4cdc('0x4a')]+'%'};return _0x4caaf3;}})});}_0x177099=_[_0x4cdc('0x4b')]({},_0x177099,_0x27377d[_0x4cdc('0x4d')]);var _0x5de949={'where':_0x177099[_0x4cdc('0x49')]};return db[_0x4cdc('0x3c')][_0x4cdc('0x2d')](_0x5de949)[_0x4cdc('0x1d')](function(_0x24e44c){_0x4213d3[_0x4cdc('0x2d')]=_0x24e44c;if(_0x27377d['query']['includeAll']){_0x177099[_0x4cdc('0x4e')]=[{'all':!![]}];}return db[_0x4cdc('0x3c')][_0x4cdc('0x4f')](_0x177099);})[_0x4cdc('0x1d')](function(_0x2b0ff5){_0x4213d3[_0x4cdc('0x50')]=_0x2b0ff5;return _0x4213d3;})[_0x4cdc('0x1d')](respondWithFilteredResult(_0x19eb6a,_0x177099))[_0x4cdc('0x51')](handleError(_0x19eb6a,null));};exports[_0x4cdc('0x52')]=function(_0x1e3b3f,_0x3762dc){var _0x48689f={'raw':!![],'where':{'id':_0x1e3b3f[_0x4cdc('0x53')]['id']}},_0x51ab6d={};_0x51ab6d['model']=_[_0x4cdc('0x54')](db[_0x4cdc('0x3c')][_0x4cdc('0x55')]);_0x51ab6d[_0x4cdc('0x40')]=_[_0x4cdc('0x54')](_0x1e3b3f[_0x4cdc('0x40')]);_0x51ab6d[_0x4cdc('0x41')]=_[_0x4cdc('0x42')](_0x51ab6d['model'],_0x51ab6d[_0x4cdc('0x40')]);_0x48689f[_0x4cdc('0x43')]=_[_0x4cdc('0x42')](_0x51ab6d[_0x4cdc('0x3f')],qs[_0x4cdc('0x44')](_0x1e3b3f[_0x4cdc('0x40')]['fields']));_0x48689f[_0x4cdc('0x43')]=_0x48689f['attributes']['length']?_0x48689f['attributes']:_0x51ab6d[_0x4cdc('0x3f')];if(_0x1e3b3f[_0x4cdc('0x40')][_0x4cdc('0x56')]){_0x48689f['include']=[{'all':!![]}];}_0x48689f=_[_0x4cdc('0x4b')]({},_0x48689f,_0x1e3b3f[_0x4cdc('0x4d')]);return db[_0x4cdc('0x3c')]['find'](_0x48689f)[_0x4cdc('0x1d')](handleEntityNotFound(_0x3762dc,null))[_0x4cdc('0x1d')](respondWithResult(_0x3762dc,null))[_0x4cdc('0x51')](handleError(_0x3762dc,null));};exports['create']=function(_0x1becf0,_0x5e3cab){return db[_0x4cdc('0x3c')][_0x4cdc('0x57')](_0x1becf0['body'],{})[_0x4cdc('0x1d')](function(_0x1db7f7){var _0x3f78d2=_0x1becf0[_0x4cdc('0x58')][_0x4cdc('0x59')]({'plain':!![]});if(!_0x3f78d2)throw new Error(_0x4cdc('0x5a'));if(_0x3f78d2[_0x4cdc('0x5b')]===_0x4cdc('0x58')){var _0x2c15e1=_0x1db7f7[_0x4cdc('0x59')]({'plain':!![]});var _0x3ad6bd=_0x4cdc('0x36');return db[_0x4cdc('0x5c')][_0x4cdc('0x5d')]({'where':{'name':_0x3ad6bd,'userProfileId':_0x3f78d2[_0x4cdc('0x5e')]},'raw':!![]})[_0x4cdc('0x1d')](function(_0x26587a){if(_0x26587a&&_0x26587a[_0x4cdc('0x5f')]===0x0){return db[_0x4cdc('0x60')][_0x4cdc('0x57')]({'name':_0x2c15e1[_0x4cdc('0x39')],'resourceId':_0x2c15e1['id'],'type':_0x26587a['name'],'sectionId':_0x26587a['id']},{})[_0x4cdc('0x1d')](function(){return _0x1db7f7;});}else{return _0x1db7f7;}})[_0x4cdc('0x51')](function(_0x4419ad){logger[_0x4cdc('0x23')](_0x4cdc('0x61'),_0x4419ad);throw _0x4419ad;});}return _0x1db7f7;})[_0x4cdc('0x1d')](respondWithResult(_0x5e3cab,0xc9))[_0x4cdc('0x51')](handleError(_0x5e3cab,null));};exports[_0x4cdc('0x34')]=function(_0x4eff1a,_0x230e9e){if(_0x4eff1a[_0x4cdc('0x62')]['id']){delete _0x4eff1a[_0x4cdc('0x62')]['id'];}return db[_0x4cdc('0x3c')][_0x4cdc('0x5d')]({'where':{'id':_0x4eff1a['params']['id']}})[_0x4cdc('0x1d')](handleEntityNotFound(_0x230e9e,null))[_0x4cdc('0x1d')](saveUpdates(_0x4eff1a[_0x4cdc('0x62')],null))[_0x4cdc('0x1d')](respondWithResult(_0x230e9e,null))[_0x4cdc('0x51')](handleError(_0x230e9e,null));};exports[_0x4cdc('0x35')]=function(_0x38656b,_0x374252){return db[_0x4cdc('0x3c')][_0x4cdc('0x5d')]({'where':{'id':_0x38656b[_0x4cdc('0x53')]['id']}})['then'](handleEntityNotFound(_0x374252,null))[_0x4cdc('0x1d')](removeEntity(_0x374252,null))[_0x4cdc('0x51')](handleError(_0x374252,null));};exports[_0x4cdc('0x63')]=function(_0x21c811,_0x35ff5b){return db[_0x4cdc('0x3c')][_0x4cdc('0x63')]()[_0x4cdc('0x1d')](respondWithResult(_0x35ff5b,null))[_0x4cdc('0x51')](handleError(_0x35ff5b,null));};exports[_0x4cdc('0x64')]=function(_0x3b7bea,_0xef68cf,_0x270439){var _0x306363={'raw':!![],'where':{}},_0x3d445a={},_0x39b5b3;return db['ChatQueue']['findOne']({'where':{'id':_0x3b7bea[_0x4cdc('0x53')]['id']}})['then'](handleEntityNotFound(_0xef68cf,null))[_0x4cdc('0x1d')](function(_0x941e80){if(_0x941e80){_0x39b5b3=_0x941e80[_0x4cdc('0x59')]({'plain':!![]});_0x3d445a['model']=_[_0x4cdc('0x54')](db[_0x4cdc('0x65')][_0x4cdc('0x55')]);_0x3d445a[_0x4cdc('0x40')]=_[_0x4cdc('0x54')](_0x3b7bea[_0x4cdc('0x40')]);_0x3d445a[_0x4cdc('0x41')]=_['intersection'](_0x3d445a[_0x4cdc('0x3f')],_0x3d445a['query']);_0x306363[_0x4cdc('0x43')]=_['intersection'](_0x3d445a[_0x4cdc('0x3f')],qs[_0x4cdc('0x44')](_0x3b7bea[_0x4cdc('0x40')][_0x4cdc('0x44')]));_0x306363['attributes']=_0x306363[_0x4cdc('0x43')][_0x4cdc('0x66')]?_0x306363[_0x4cdc('0x43')]:_0x3d445a['model'];if(!_0x3b7bea[_0x4cdc('0x40')][_0x4cdc('0x45')](_0x4cdc('0x46'))){_0x306363[_0x4cdc('0x2e')]=qs[_0x4cdc('0x2e')](_0x3b7bea[_0x4cdc('0x40')][_0x4cdc('0x2e')]);_0x306363[_0x4cdc('0x2b')]=qs[_0x4cdc('0x2b')](_0x3b7bea[_0x4cdc('0x40')][_0x4cdc('0x2b')]);}_0x306363[_0x4cdc('0x47')]=qs['sort'](_0x3b7bea['query'][_0x4cdc('0x48')]);_0x306363[_0x4cdc('0x49')]=qs['filters'](_['pick'](_0x3b7bea['query'],_0x3d445a[_0x4cdc('0x41')]));_0x306363[_0x4cdc('0x49')][_0x4cdc('0x67')]=_0x941e80['id'];if(_0x3b7bea[_0x4cdc('0x40')][_0x4cdc('0x4a')]){_0x306363[_0x4cdc('0x49')]=_[_0x4cdc('0x4b')](_0x306363['where'],{'$or':_[_0x4cdc('0x3b')](_0x306363['attributes'],function(_0x6fd36e){var _0x1bad9c={};_0x1bad9c[_0x6fd36e]={'$like':'%'+_0x3b7bea[_0x4cdc('0x40')][_0x4cdc('0x4a')]+'%'};return _0x1bad9c;})});}_0x306363=_[_0x4cdc('0x4b')]({},_0x306363,_0x3b7bea[_0x4cdc('0x4d')]);return db[_0x4cdc('0x65')][_0x4cdc('0x4f')](_0x306363);}})[_0x4cdc('0x1d')](function(_0xbd2a04){if(_0xbd2a04){return db['User'][_0x4cdc('0x68')]({'where':{'id':_[_0x4cdc('0x3b')](_0xbd2a04,'UserId'),'role':'agent'},'attributes':['id','name','chatPause',_0x4cdc('0x69'),_0x4cdc('0x6a')]});}})[_0x4cdc('0x1d')](function(_0x2e8563){if(_0x2e8563){return{'count':_0x2e8563[_0x4cdc('0x2d')],'rows':_[_0x4cdc('0x3b')](_0x2e8563[_0x4cdc('0x50')],function(_0x7eb24e){return{'membername':_0x7eb24e[_0x4cdc('0x39')],'UserId':_0x7eb24e['id'],'queue_name':_0x39b5b3['name'],'ChatQueueId':_0x39b5b3['id'],'interface':util[_0x4cdc('0x6b')](_0x4cdc('0x6c'),_0x4cdc('0x6d'),_0x7eb24e[_0x4cdc('0x39')]),'penalty':0x0,'paused':_0x7eb24e['chatPause'],'createdAt':_0x7eb24e[_0x4cdc('0x6a')],'updatedAt':_0x7eb24e[_0x4cdc('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4cdc('0x1d')](respondWithFilteredResult(_0xef68cf,_0x306363))[_0x4cdc('0x51')](handleError(_0xef68cf,null));};exports[_0x4cdc('0x6e')]=function(_0x4dba35,_0x34e948,_0x4fb29b){var _0x1a3f7a={};var _0x49c459={};var _0x5cf3ae;var _0x3cf1d9;return db[_0x4cdc('0x3c')][_0x4cdc('0x6f')]({'where':{'id':_0x4dba35[_0x4cdc('0x53')]['id']}})['then'](handleEntityNotFound(_0x34e948,null))[_0x4cdc('0x1d')](function(_0x1ba230){if(_0x1ba230){_0x5cf3ae=_0x1ba230;_0x49c459['model']=_[_0x4cdc('0x54')](db[_0x4cdc('0x70')][_0x4cdc('0x55')]);_0x49c459[_0x4cdc('0x40')]=_[_0x4cdc('0x54')](_0x4dba35[_0x4cdc('0x40')]);_0x49c459['filters']=_[_0x4cdc('0x42')](_0x49c459['model'],_0x49c459[_0x4cdc('0x40')]);_0x1a3f7a[_0x4cdc('0x43')]=_[_0x4cdc('0x42')](_0x49c459[_0x4cdc('0x3f')],qs['fields'](_0x4dba35[_0x4cdc('0x40')][_0x4cdc('0x44')]));_0x1a3f7a[_0x4cdc('0x43')]=_0x1a3f7a['attributes'][_0x4cdc('0x66')]?_0x1a3f7a['attributes']:_0x49c459['model'];_0x1a3f7a[_0x4cdc('0x47')]=qs[_0x4cdc('0x48')](_0x4dba35['query'][_0x4cdc('0x48')]);_0x1a3f7a[_0x4cdc('0x49')]=qs['filters'](_['pick'](_0x4dba35[_0x4cdc('0x40')],_0x49c459[_0x4cdc('0x41')]));if(_0x4dba35[_0x4cdc('0x40')][_0x4cdc('0x4a')]){_0x1a3f7a['where']=_[_0x4cdc('0x4b')](_0x1a3f7a['where'],{'$or':_[_0x4cdc('0x3b')](_0x1a3f7a[_0x4cdc('0x43')],function(_0x47c584){var _0x3faa95={};_0x3faa95[_0x47c584]={'$like':'%'+_0x4dba35[_0x4cdc('0x40')][_0x4cdc('0x4a')]+'%'};return _0x3faa95;})});}_0x1a3f7a=_[_0x4cdc('0x4b')]({},_0x1a3f7a,_0x4dba35['options']);return _0x5cf3ae['getTeams'](_0x1a3f7a);}})[_0x4cdc('0x1d')](function(_0x3e87c4){if(_0x3e87c4){_0x3cf1d9=_0x3e87c4[_0x4cdc('0x66')];if(!_0x4dba35[_0x4cdc('0x40')][_0x4cdc('0x45')]('nolimit')){_0x1a3f7a[_0x4cdc('0x2e')]=qs[_0x4cdc('0x2e')](_0x4dba35[_0x4cdc('0x40')][_0x4cdc('0x2e')]);_0x1a3f7a[_0x4cdc('0x2b')]=qs[_0x4cdc('0x2b')](_0x4dba35[_0x4cdc('0x40')]['offset']);}return _0x5cf3ae[_0x4cdc('0x6e')](_0x1a3f7a);}})[_0x4cdc('0x1d')](function(_0x1e155b){if(_0x1e155b){return _0x1e155b?{'count':_0x3cf1d9,'rows':_0x1e155b}:null;}})[_0x4cdc('0x1d')](respondWithResult(_0x34e948,null))[_0x4cdc('0x51')](handleError(_0x34e948,null));};exports['addTeams']=function(_0x564108,_0x118d42,_0xf5edb9){var _0x5dd120=_0x564108[_0x4cdc('0x62')]['ids'];return db[_0x4cdc('0x70')][_0x4cdc('0x4f')]({'where':{'id':_0x5dd120},'attributes':['id'],'include':[{'model':db[_0x4cdc('0x71')],'as':'Agents','attributes':['id',_0x4cdc('0x39'),_0x4cdc('0x72'),_0x4cdc('0x73'),_0x4cdc('0x74')],'raw':!![]}]})[_0x4cdc('0x1d')](function(_0x5d7582){if(_0x5d7582){var _0x68e70c=_[_0x4cdc('0x75')](_0x5d7582,function(_0x20bfc7){var _0x4e63cb=_0x20bfc7['get']({'plain':!![]});return _0x4e63cb['Agents'];});return db[_0x4cdc('0x3c')][_0x4cdc('0x5d')]({'where':{'id':_0x564108[_0x4cdc('0x53')]['id']}})[_0x4cdc('0x1d')](function(_0x29efab){return db[_0x4cdc('0x76')][_0x4cdc('0x77')](function(_0x2bd381){return _0x29efab[_0x4cdc('0x78')](_0x5dd120,{'transaction':_0x2bd381})[_0x4cdc('0x1d')](function(){return BPromise['each'](_0x68e70c,function(_0x35a3d7){return db['UserChatQueue']['findOrCreate']({'where':{'UserId':_0x35a3d7['id'],'ChatQueueId':_0x564108[_0x4cdc('0x53')]['id']},'transaction':_0x2bd381});});})[_0x4cdc('0x1d')](function(){_0x68e70c[_0x4cdc('0x79')](function(_0x1b1095){socket['emit'](_0x4cdc('0x7a'),{'UserId':_0x1b1095['id'],'ChatQueueId':_0x29efab['id']});});});});});}})[_0x4cdc('0x1d')](respondWithStatusCode(_0x118d42,null))[_0x4cdc('0x51')](handleError(_0x118d42,null));};exports[_0x4cdc('0x7b')]=function(_0x2ef483,_0x1aee2d,_0x35585d){return db['Team'][_0x4cdc('0x4f')]({'where':{'id':_0x2ef483[_0x4cdc('0x40')][_0x4cdc('0x7c')]},'attributes':['id'],'include':[{'model':db[_0x4cdc('0x71')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x4cdc('0x1d')](handleEntityNotFound(_0x1aee2d,null))[_0x4cdc('0x1d')](function(_0x30eb22){var _0x3634c2=_['map'](_0x30eb22,'id');var _0x16a417=[];var _0x5ce506=[];var _0x51c9c2=squel['select']();_0x51c9c2[_0x4cdc('0x7d')](_0x4cdc('0x7e'))[_0x4cdc('0x7f')](_0x4cdc('0x80'),'tq')[_0x4cdc('0x81')](_0x4cdc('0x82'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x4cdc('0x83'),_0x2ef483[_0x4cdc('0x53')]['id']);for(var _0x238e17=0x0;_0x238e17<_0x30eb22['length'];_0x238e17+=0x1){let _0x140d52=_0x30eb22[_0x238e17];for(var _0x439c3a=0x0;_0x439c3a<_0x140d52[_0x4cdc('0x84')]['length'];_0x439c3a+=0x1){let _0x2f8c87=_0x140d52[_0x4cdc('0x84')][_0x439c3a];var _0x4bb33f=_0x51c9c2[_0x4cdc('0x85')]();_0x4bb33f['where'](_0x4cdc('0x86'),_0x2f8c87['id']);_0x5ce506[_0x4cdc('0x87')](db[_0x4cdc('0x76')]['query'](_0x4bb33f[_0x4cdc('0x88')](),{'type':db[_0x4cdc('0x76')][_0x4cdc('0x89')][_0x4cdc('0x8a')]})['then'](function(_0x25ed56){if(_0x25ed56[_0x4cdc('0x66')]===0x1){return _0x2f8c87['id'];}else{var _0x344a0e=_['every'](_[_0x4cdc('0x3b')](_0x25ed56,_0x4cdc('0x8b')),function(_0x1e17b3){return _[_0x4cdc('0x8c')](_0x3634c2,_0x1e17b3);});if(_0x344a0e){return _0x2f8c87['id'];}}}));}}return BPromise[_0x4cdc('0x8d')](_0x5ce506)['then'](function(_0x2b1a35){_0x16a417=_(_0x16a417)[_0x4cdc('0x8e')](_0x2b1a35)[_0x4cdc('0x8f')]()[_0x4cdc('0x90')]();return db[_0x4cdc('0x3c')][_0x4cdc('0x5d')]({'where':{'id':_0x2ef483['params']['id']}})[_0x4cdc('0x1d')](function(_0x4e0ffd){return db[_0x4cdc('0x76')]['transaction'](function(_0xd395ea){return _0x4e0ffd[_0x4cdc('0x7b')](_0x2ef483[_0x4cdc('0x40')][_0x4cdc('0x7c')],{'transaction':_0xd395ea})[_0x4cdc('0x1d')](function(){if(!_[_0x4cdc('0x91')](_0x16a417)){return _0x4e0ffd[_0x4cdc('0x92')](_0x16a417,{'transaction':_0xd395ea});}})['then'](function(){_0x16a417['forEach'](function(_0x5ddc93){socket[_0x4cdc('0x93')](_0x4cdc('0x94'),{'UserId':_0x5ddc93,'ChatQueueId':_0x4e0ffd['id']});});});});});});})[_0x4cdc('0x1d')](respondWithStatusCode(_0x1aee2d,null))[_0x4cdc('0x51')](handleError(_0x1aee2d,null));};exports[_0x4cdc('0x95')]=function(_0x647cf1,_0x27e4de,_0x123e17){return db[_0x4cdc('0x3c')][_0x4cdc('0x5d')]({'where':{'id':_0x647cf1[_0x4cdc('0x53')]['id']}})['then'](handleEntityNotFound(_0x27e4de,null))[_0x4cdc('0x1d')](function(_0x28c06f){if(_0x28c06f){return _0x28c06f[_0x4cdc('0x95')](_0x647cf1[_0x4cdc('0x62')][_0x4cdc('0x7c')],_[_0x4cdc('0x96')](_0x647cf1['body'],[_0x4cdc('0x7c'),'id'])||{})[_0x4cdc('0x97')](function(_0x52e95f){for(var _0x1af842=0x0;_0x1af842<_0x647cf1[_0x4cdc('0x62')][_0x4cdc('0x7c')][_0x4cdc('0x66')];_0x1af842+=0x1){socket['emit'](_0x4cdc('0x7a'),{'UserId':Number(_0x647cf1[_0x4cdc('0x62')][_0x4cdc('0x7c')][_0x1af842]),'ChatQueueId':Number(_0x647cf1[_0x4cdc('0x53')]['id'])});}return _0x52e95f;});}})[_0x4cdc('0x1d')](respondWithResult(_0x27e4de,null))[_0x4cdc('0x51')](handleError(_0x27e4de,null));};exports[_0x4cdc('0x92')]=function(_0x413179,_0x593e1e,_0xfbcce5){return db[_0x4cdc('0x3c')][_0x4cdc('0x5d')]({'where':{'id':_0x413179[_0x4cdc('0x53')]['id']}})['then'](handleEntityNotFound(_0x593e1e,null))['then'](function(_0x3b5b6f){if(_0x3b5b6f){return _0x3b5b6f[_0x4cdc('0x92')](_0x413179[_0x4cdc('0x40')][_0x4cdc('0x7c')])[_0x4cdc('0x1d')](function(){if(_['isArray'](_0x413179[_0x4cdc('0x40')]['ids'])){for(var _0x2a916f=0x0;_0x2a916f<_0x413179['query']['ids'][_0x4cdc('0x66')];_0x2a916f+=0x1){socket[_0x4cdc('0x93')](_0x4cdc('0x94'),{'UserId':Number(_0x413179[_0x4cdc('0x40')][_0x4cdc('0x7c')][_0x2a916f]),'ChatQueueId':Number(_0x413179['params']['id'])});}}else{socket['emit'](_0x4cdc('0x94'),{'UserId':Number(_0x413179[_0x4cdc('0x40')][_0x4cdc('0x7c')]),'ChatQueueId':Number(_0x413179['params']['id'])});}});}})[_0x4cdc('0x1d')](respondWithStatusCode(_0x593e1e,null))[_0x4cdc('0x51')](handleError(_0x593e1e,null));};exports[_0x4cdc('0x98')]=function(_0x47f0c0,_0x2cae64,_0x363a0b){var _0x160d51={};var _0x394ff4={};var _0x4d4403;var _0x3f431a;return db[_0x4cdc('0x3c')]['findOne']({'where':{'id':_0x47f0c0[_0x4cdc('0x53')]['id']}})[_0x4cdc('0x1d')](handleEntityNotFound(_0x2cae64,null))[_0x4cdc('0x1d')](function(_0x181032){if(_0x181032){_0x4d4403=_0x181032;_0x394ff4[_0x4cdc('0x3f')]=_[_0x4cdc('0x54')](db[_0x4cdc('0x71')][_0x4cdc('0x55')]);_0x394ff4[_0x4cdc('0x40')]=_[_0x4cdc('0x54')](_0x47f0c0[_0x4cdc('0x40')]);_0x394ff4[_0x4cdc('0x41')]=_['intersection'](_0x394ff4['model'],_0x394ff4[_0x4cdc('0x40')]);_0x160d51['attributes']=_[_0x4cdc('0x42')](_0x394ff4[_0x4cdc('0x3f')],qs[_0x4cdc('0x44')](_0x47f0c0[_0x4cdc('0x40')][_0x4cdc('0x44')]));_0x160d51['attributes']=_0x160d51[_0x4cdc('0x43')]['length']?_0x160d51[_0x4cdc('0x43')]:_0x394ff4['model'];_0x160d51[_0x4cdc('0x47')]=qs[_0x4cdc('0x48')](_0x47f0c0['query'][_0x4cdc('0x48')]);_0x160d51[_0x4cdc('0x49')]=qs[_0x4cdc('0x41')](_[_0x4cdc('0x99')](_0x47f0c0[_0x4cdc('0x40')],_0x394ff4[_0x4cdc('0x41')]));if(_0x47f0c0[_0x4cdc('0x40')][_0x4cdc('0x4a')]){_0x160d51[_0x4cdc('0x49')]=_['merge'](_0x160d51['where'],{'$or':_[_0x4cdc('0x3b')](_0x160d51[_0x4cdc('0x43')],function(_0x812d77){var _0x428031={};_0x428031[_0x812d77]={'$like':'%'+_0x47f0c0[_0x4cdc('0x40')]['filter']+'%'};return _0x428031;})});}_0x160d51=_[_0x4cdc('0x4b')]({},_0x160d51,_0x47f0c0['options']);return _0x4d4403['getAgents'](_0x160d51);}})[_0x4cdc('0x1d')](function(_0x166d40){if(_0x166d40){_0x3f431a=_0x166d40['length'];if(!_0x47f0c0['query'][_0x4cdc('0x45')]('nolimit')){_0x160d51['limit']=qs['limit'](_0x47f0c0[_0x4cdc('0x40')][_0x4cdc('0x2e')]);_0x160d51[_0x4cdc('0x2b')]=qs[_0x4cdc('0x2b')](_0x47f0c0[_0x4cdc('0x40')][_0x4cdc('0x2b')]);}return _0x4d4403[_0x4cdc('0x98')](_0x160d51);}})['then'](function(_0x4ae80a){if(_0x4ae80a){return _0x4ae80a?{'count':_0x3f431a,'rows':_0x4ae80a}:null;}})[_0x4cdc('0x1d')](respondWithResult(_0x2cae64,null))[_0x4cdc('0x51')](handleError(_0x2cae64,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 8b90a8d..576db9e 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 _0xdf71=['setMaxListeners','save','update','remove','emit','hook','exports','events','ChatQueue'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xdf71,0x1d2));var _0x1df7=function(_0x5bbb39,_0x26dddd){_0x5bbb39=_0x5bbb39-0x0;var _0x4b7eb0=_0xdf71[_0x5bbb39];return _0x4b7eb0;};'use strict';var EventEmitter=require(_0x1df7('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x1df7('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x1df7('0x2')](0x0);var events={'afterCreate':_0x1df7('0x3'),'afterUpdate':_0x1df7('0x4'),'afterDestroy':_0x1df7('0x5')};function emitEvent(_0x43490d){return function(_0x436544,_0x570cbd,_0xc9e362){ChatQueueEvents[_0x1df7('0x6')](_0x43490d+':'+_0x436544['id'],_0x436544);ChatQueueEvents['emit'](_0x43490d,_0x436544);_0xc9e362(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x1df7('0x7')](e,emitEvent(event));}}module[_0x1df7('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0x20da=['remove','emit','exports','events','../../mysqldb','ChatQueue','setMaxListeners','update'];(function(_0x65656f,_0x23d7fd){var _0x5824c9=function(_0x369f7f){while(--_0x369f7f){_0x65656f['push'](_0x65656f['shift']());}};_0x5824c9(++_0x23d7fd);}(_0x20da,0xcb));var _0xa20d=function(_0x32ab21,_0x26ca1b){_0x32ab21=_0x32ab21-0x0;var _0x3c9408=_0x20da[_0x32ab21];return _0x3c9408;};'use strict';var EventEmitter=require(_0xa20d('0x0'));var ChatQueue=require(_0xa20d('0x1'))['db'][_0xa20d('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xa20d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa20d('0x4'),'afterDestroy':_0xa20d('0x5')};function emitEvent(_0x16e90a){return function(_0x3ae6ba,_0x416aeb,_0x17b952){ChatQueueEvents[_0xa20d('0x6')](_0x16e90a+':'+_0x3ae6ba['id'],_0x3ae6ba);ChatQueueEvents[_0xa20d('0x6')](_0x16e90a,_0x3ae6ba);_0x17b952(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0xa20d('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index aad9b84..14c79d0 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 _0x2cbd=['api','request-promise','path','../../config/environment','./chatQueue.attributes','exports','define','chat_queues','lodash','util','../../config/logger'];(function(_0x3f0b30,_0x159bc8){var _0x2748a5=function(_0x3b42cc){while(--_0x3b42cc){_0x3f0b30['push'](_0x3f0b30['shift']());}};_0x2748a5(++_0x159bc8);}(_0x2cbd,0x8c));var _0xd2cb=function(_0x53e3fa,_0x50c5f2){_0x53e3fa=_0x53e3fa-0x0;var _0xe8584a=_0x2cbd[_0x53e3fa];return _0xe8584a;};'use strict';var _=require(_0xd2cb('0x0'));var util=require(_0xd2cb('0x1'));var logger=require(_0xd2cb('0x2'))(_0xd2cb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd2cb('0x4'));var fs=require('fs');var path=require(_0xd2cb('0x5'));var rimraf=require('rimraf');var config=require(_0xd2cb('0x6'));var attributes=require(_0xd2cb('0x7'));module[_0xd2cb('0x8')]=function(_0x5adffa,_0x48f40e){return _0x5adffa[_0xd2cb('0x9')]('ChatQueue',attributes,{'tableName':_0xd2cb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb2db=['path','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x374785,_0x4f71b8){var _0x572c40=function(_0x1cf7b0){while(--_0x1cf7b0){_0x374785['push'](_0x374785['shift']());}};_0x572c40(++_0x4f71b8);}(_0xb2db,0xca));var _0xbb2d=function(_0x19d0bb,_0x1fcc68){_0x19d0bb=_0x19d0bb-0x0;var _0x1bc556=_0xb2db[_0x19d0bb];return _0x1bc556;};'use strict';var _=require('lodash');var util=require(_0xbb2d('0x0'));var logger=require(_0xbb2d('0x1'))(_0xbb2d('0x2'));var moment=require(_0xbb2d('0x3'));var BPromise=require(_0xbb2d('0x4'));var rp=require(_0xbb2d('0x5'));var fs=require('fs');var path=require(_0xbb2d('0x6'));var rimraf=require('rimraf');var config=require(_0xbb2d('0x7'));var attributes=require(_0xbb2d('0x8'));module[_0xbb2d('0x9')]=function(_0x4768d3,_0x798452){return _0x4768d3[_0xbb2d('0xa')](_0xbb2d('0xb'),attributes,{'tableName':_0xbb2d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 94fa47d..73deaa9 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 _0x173d=['map','model','ShowChatQueue','ChatQueue','find','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetChatQueue','findAll','options','raw','where','attributes','limit','include'];(function(_0x3f2fdb,_0x1f311c){var _0x4bbcb2=function(_0x2eeec8){while(--_0x2eeec8){_0x3f2fdb['push'](_0x3f2fdb['shift']());}};_0x4bbcb2(++_0x1f311c);}(_0x173d,0x108));var _0xd173=function(_0x2db063,_0x1b2e29){_0x2db063=_0x2db063-0x0;var _0xa933be=_0x173d[_0x2db063];return _0xa933be;};'use strict';var _=require('lodash');var util=require(_0xd173('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd173('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd173('0x2'))['db'];var utils=require(_0xd173('0x3'));var logger=require(_0xd173('0x4'))(_0xd173('0x5'));var config=require(_0xd173('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd173('0x7')][_0xd173('0x8')]({'port':0x232a});config[_0xd173('0x9')]=_['defaults'](config[_0xd173('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xd173('0xa'))(new Redis(config['redis']));require('./chatQueue.socket')[_0xd173('0xb')](socket);function respondWithRpcPromise(_0x40aece,_0x4f37ea,_0x2ac519){return new BPromise(function(_0x1e1bd5,_0x4b0ac9){return client[_0xd173('0xc')](_0x40aece,_0x2ac519)[_0xd173('0xd')](function(_0x1b4bd1){logger[_0xd173('0xe')](_0xd173('0xf'),_0x4f37ea,_0xd173('0x10'));logger[_0xd173('0x11')](_0xd173('0x12'),_0x4f37ea,_0xd173('0x10'),JSON[_0xd173('0x13')](_0x1b4bd1));if(_0x1b4bd1[_0xd173('0x14')]){if(_0x1b4bd1[_0xd173('0x14')]['code']===0x1f4){logger[_0xd173('0x14')]('ChatQueue,\x20%s,\x20%s',_0x4f37ea,_0x1b4bd1[_0xd173('0x14')][_0xd173('0x15')]);return _0x4b0ac9(_0x1b4bd1['error'][_0xd173('0x15')]);}logger[_0xd173('0x14')](_0xd173('0xf'),_0x4f37ea,_0x1b4bd1[_0xd173('0x14')]['message']);return _0x1e1bd5(_0x1b4bd1['error'][_0xd173('0x15')]);}else{logger[_0xd173('0xe')](_0xd173('0xf'),_0x4f37ea,'request\x20sent');_0x1e1bd5(_0x1b4bd1[_0xd173('0x16')][_0xd173('0x15')]);}})[_0xd173('0x17')](function(_0x262eac){logger['error']('ChatQueue,\x20%s,\x20%s',_0x4f37ea,_0x262eac);_0x4b0ac9(_0x262eac);});});}exports[_0xd173('0x18')]=function(_0xec34f9){var _0x38be1d=this;return new Promise(function(_0x35c2d8,_0x58e9ff){return db['ChatQueue'][_0xd173('0x19')]({'raw':_0xec34f9[_0xd173('0x1a')]?_0xec34f9['options'][_0xd173('0x1b')]===undefined?!![]:![]:!![],'where':_0xec34f9[_0xd173('0x1a')]?_0xec34f9['options'][_0xd173('0x1c')]||null:null,'attributes':_0xec34f9[_0xd173('0x1a')]?_0xec34f9['options'][_0xd173('0x1d')]||null:null,'limit':_0xec34f9[_0xd173('0x1a')]?_0xec34f9['options'][_0xd173('0x1e')]||null:null,'include':_0xec34f9[_0xd173('0x1a')]?_0xec34f9[_0xd173('0x1a')][_0xd173('0x1f')]?_[_0xd173('0x20')](_0xec34f9[_0xd173('0x1a')]['include'],function(_0x57f971){return{'model':db[_0x57f971[_0xd173('0x21')]],'as':_0x57f971['as'],'attributes':_0x57f971[_0xd173('0x1d')],'include':_0x57f971[_0xd173('0x1f')]?_[_0xd173('0x20')](_0x57f971[_0xd173('0x1f')],function(_0x378a07){return{'model':db[_0x378a07[_0xd173('0x21')]],'as':_0x378a07['as'],'attributes':_0x378a07[_0xd173('0x1d')],'include':_0x378a07['include']?_['map'](_0x378a07[_0xd173('0x1f')],function(_0x15035c){return{'model':db[_0x15035c['model']],'as':_0x15035c['as'],'attributes':_0x15035c['attributes']};}):[]};}):[]};}):[]:[]})[_0xd173('0xd')](function(_0x38a389){logger[_0xd173('0xe')](_0xd173('0x18'),_0xec34f9);logger[_0xd173('0x11')](_0xd173('0x18'),_0xec34f9,JSON['stringify'](_0x38a389));_0x35c2d8(_0x38a389);})['catch'](function(_0x142273){logger[_0xd173('0x14')]('GetChatQueue',_0x142273[_0xd173('0x15')],_0xec34f9);_0x58e9ff(_0x38be1d[_0xd173('0x14')](0x1f4,_0x142273[_0xd173('0x15')]));});});};exports[_0xd173('0x22')]=function(_0x1def05){var _0x4dfcd8=this;return new Promise(function(_0x4957d4,_0x5f4ea4){return db[_0xd173('0x23')][_0xd173('0x24')]({'raw':_0x1def05['options']?_0x1def05[_0xd173('0x1a')][_0xd173('0x1b')]===undefined?!![]:![]:!![],'where':_0x1def05[_0xd173('0x1a')]?_0x1def05[_0xd173('0x1a')][_0xd173('0x1c')]||null:null,'attributes':_0x1def05['options']?_0x1def05[_0xd173('0x1a')][_0xd173('0x1d')]||null:null,'include':_0x1def05[_0xd173('0x1a')]?_0x1def05[_0xd173('0x1a')][_0xd173('0x1f')]?_[_0xd173('0x20')](_0x1def05['options'][_0xd173('0x1f')],function(_0x3b0855){return{'model':db[_0x3b0855[_0xd173('0x21')]],'as':_0x3b0855['as'],'attributes':_0x3b0855['attributes'],'include':_0x3b0855['include']?_[_0xd173('0x20')](_0x3b0855[_0xd173('0x1f')],function(_0x37ef2d){return{'model':db[_0x37ef2d['model']],'as':_0x37ef2d['as'],'attributes':_0x37ef2d[_0xd173('0x1d')],'include':_0x37ef2d[_0xd173('0x1f')]?_[_0xd173('0x20')](_0x37ef2d[_0xd173('0x1f')],function(_0x2ceec8){return{'model':db[_0x2ceec8['model']],'as':_0x2ceec8['as'],'attributes':_0x2ceec8[_0xd173('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x19a966){logger[_0xd173('0xe')](_0xd173('0x22'),_0x1def05);logger['debug']('ShowChatQueue',_0x1def05,JSON[_0xd173('0x13')](_0x19a966));_0x4957d4(_0x19a966);})['catch'](function(_0x22808d){logger[_0xd173('0x14')]('ShowChatQueue',_0x22808d['message'],_0x1def05);_0x5f4ea4(_0x4dfcd8[_0xd173('0x14')](0x1f4,_0x22808d[_0xd173('0x15')]));});});}; \ No newline at end of file +var _0x7ae6=['localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatQueue','findAll','options','raw','attributes','limit','map','include','model','ShowChatQueue','find','where','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis'];(function(_0x5c08cb,_0x456960){var _0x147907=function(_0x1da1be){while(--_0x1da1be){_0x5c08cb['push'](_0x5c08cb['shift']());}};_0x147907(++_0x456960);}(_0x7ae6,0x94));var _0x67ae=function(_0x4219dc,_0x45af02){_0x4219dc=_0x4219dc-0x0;var _0xfe8ac6=_0x7ae6[_0x4219dc];return _0xfe8ac6;};'use strict';var _=require('lodash');var util=require(_0x67ae('0x0'));var moment=require('moment');var BPromise=require(_0x67ae('0x1'));var rs=require(_0x67ae('0x2'));var fs=require('fs');var Redis=require(_0x67ae('0x3'));var db=require(_0x67ae('0x4'))['db'];var utils=require(_0x67ae('0x5'));var logger=require(_0x67ae('0x6'))('rpc');var config=require(_0x67ae('0x7'));var jayson=require(_0x67ae('0x8'));var client=jayson[_0x67ae('0x9')][_0x67ae('0xa')]({'port':0x232a});config[_0x67ae('0xb')]=_['defaults'](config[_0x67ae('0xb')],{'host':_0x67ae('0xc'),'port':0x18eb});var socket=require(_0x67ae('0xd'))(new Redis(config[_0x67ae('0xb')]));require(_0x67ae('0xe'))[_0x67ae('0xf')](socket);function respondWithRpcPromise(_0x46140e,_0x417111,_0x4d278b){return new BPromise(function(_0x28d20a,_0x3143cb){return client[_0x67ae('0x10')](_0x46140e,_0x4d278b)[_0x67ae('0x11')](function(_0xf3f46b){logger[_0x67ae('0x12')](_0x67ae('0x13'),_0x417111,_0x67ae('0x14'));logger[_0x67ae('0x15')](_0x67ae('0x16'),_0x417111,_0x67ae('0x14'),JSON[_0x67ae('0x17')](_0xf3f46b));if(_0xf3f46b[_0x67ae('0x18')]){if(_0xf3f46b[_0x67ae('0x18')][_0x67ae('0x19')]===0x1f4){logger['error'](_0x67ae('0x13'),_0x417111,_0xf3f46b[_0x67ae('0x18')][_0x67ae('0x1a')]);return _0x3143cb(_0xf3f46b['error']['message']);}logger[_0x67ae('0x18')]('ChatQueue,\x20%s,\x20%s',_0x417111,_0xf3f46b['error'][_0x67ae('0x1a')]);return _0x28d20a(_0xf3f46b[_0x67ae('0x18')]['message']);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x417111,_0x67ae('0x14'));_0x28d20a(_0xf3f46b['result'][_0x67ae('0x1a')]);}})['catch'](function(_0x3654fd){logger[_0x67ae('0x18')](_0x67ae('0x13'),_0x417111,_0x3654fd);_0x3143cb(_0x3654fd);});});}exports['GetChatQueue']=function(_0x30606a){var _0x18876d=this;return new Promise(function(_0x23ca2c,_0xbe6112){return db[_0x67ae('0x1b')][_0x67ae('0x1c')]({'raw':_0x30606a[_0x67ae('0x1d')]?_0x30606a['options'][_0x67ae('0x1e')]===undefined?!![]:![]:!![],'where':_0x30606a[_0x67ae('0x1d')]?_0x30606a['options']['where']||null:null,'attributes':_0x30606a['options']?_0x30606a[_0x67ae('0x1d')][_0x67ae('0x1f')]||null:null,'limit':_0x30606a[_0x67ae('0x1d')]?_0x30606a['options'][_0x67ae('0x20')]||null:null,'include':_0x30606a[_0x67ae('0x1d')]?_0x30606a['options']['include']?_[_0x67ae('0x21')](_0x30606a[_0x67ae('0x1d')][_0x67ae('0x22')],function(_0x219d03){return{'model':db[_0x219d03[_0x67ae('0x23')]],'as':_0x219d03['as'],'attributes':_0x219d03[_0x67ae('0x1f')],'include':_0x219d03[_0x67ae('0x22')]?_[_0x67ae('0x21')](_0x219d03[_0x67ae('0x22')],function(_0x479b8a){return{'model':db[_0x479b8a[_0x67ae('0x23')]],'as':_0x479b8a['as'],'attributes':_0x479b8a['attributes'],'include':_0x479b8a[_0x67ae('0x22')]?_[_0x67ae('0x21')](_0x479b8a[_0x67ae('0x22')],function(_0x266d26){return{'model':db[_0x266d26[_0x67ae('0x23')]],'as':_0x266d26['as'],'attributes':_0x266d26[_0x67ae('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x67ae('0x11')](function(_0x361f98){logger['info']('GetChatQueue',_0x30606a);logger['debug']('GetChatQueue',_0x30606a,JSON[_0x67ae('0x17')](_0x361f98));_0x23ca2c(_0x361f98);})['catch'](function(_0x5c3020){logger[_0x67ae('0x18')]('GetChatQueue',_0x5c3020[_0x67ae('0x1a')],_0x30606a);_0xbe6112(_0x18876d['error'](0x1f4,_0x5c3020['message']));});});};exports[_0x67ae('0x24')]=function(_0x2d2eb6){var _0x5696db=this;return new Promise(function(_0x503cc5,_0x416e23){return db['ChatQueue'][_0x67ae('0x25')]({'raw':_0x2d2eb6[_0x67ae('0x1d')]?_0x2d2eb6[_0x67ae('0x1d')][_0x67ae('0x1e')]===undefined?!![]:![]:!![],'where':_0x2d2eb6[_0x67ae('0x1d')]?_0x2d2eb6['options'][_0x67ae('0x26')]||null:null,'attributes':_0x2d2eb6[_0x67ae('0x1d')]?_0x2d2eb6[_0x67ae('0x1d')][_0x67ae('0x1f')]||null:null,'include':_0x2d2eb6[_0x67ae('0x1d')]?_0x2d2eb6[_0x67ae('0x1d')]['include']?_[_0x67ae('0x21')](_0x2d2eb6['options'][_0x67ae('0x22')],function(_0x1b655d){return{'model':db[_0x1b655d[_0x67ae('0x23')]],'as':_0x1b655d['as'],'attributes':_0x1b655d['attributes'],'include':_0x1b655d[_0x67ae('0x22')]?_[_0x67ae('0x21')](_0x1b655d[_0x67ae('0x22')],function(_0x23e758){return{'model':db[_0x23e758[_0x67ae('0x23')]],'as':_0x23e758['as'],'attributes':_0x23e758[_0x67ae('0x1f')],'include':_0x23e758[_0x67ae('0x22')]?_[_0x67ae('0x21')](_0x23e758['include'],function(_0x42ef2b){return{'model':db[_0x42ef2b['model']],'as':_0x42ef2b['as'],'attributes':_0x42ef2b[_0x67ae('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x67ae('0x11')](function(_0x82ba8c){logger[_0x67ae('0x12')]('ShowChatQueue',_0x2d2eb6);logger['debug']('ShowChatQueue',_0x2d2eb6,JSON[_0x67ae('0x17')](_0x82ba8c));_0x503cc5(_0x82ba8c);})[_0x67ae('0x27')](function(_0x5f60c7){logger['error']('ShowChatQueue',_0x5f60c7[_0x67ae('0x1a')],_0x2d2eb6);_0x416e23(_0x5696db[_0x67ae('0x18')](0x1f4,_0x5f60c7[_0x67ae('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index bde2cd4..0810613 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb332=['emit','register','./chatQueue.events','remove','update'];(function(_0x38eb23,_0x196e8b){var _0x48506a=function(_0x36edb0){while(--_0x36edb0){_0x38eb23['push'](_0x38eb23['shift']());}};_0x48506a(++_0x196e8b);}(_0xb332,0xd9));var _0x2b33=function(_0xfc406a,_0x4479e1){_0xfc406a=_0xfc406a-0x0;var _0x395473=_0xb332[_0xfc406a];return _0x395473;};'use strict';var ChatQueueEvents=require(_0x2b33('0x0'));var events=['save',_0x2b33('0x1'),_0x2b33('0x2')];function createListener(_0x5ee720,_0xf8c6a7){return function(_0x548a70){_0xf8c6a7[_0x2b33('0x3')](_0x5ee720,_0x548a70);};}function removeListener(_0x4c6634,_0x34b111){return function(){ChatQueueEvents['removeListener'](_0x4c6634,_0x34b111);};}exports[_0x2b33('0x4')]=function(_0x22d66){for(var _0x478214=0x0,_0x461d44=events['length'];_0x478214<_0x461d44;_0x478214++){var _0x5ccf2d=events[_0x478214];var _0x4302b7=createListener('chatQueue:'+_0x5ccf2d,_0x22d66);ChatQueueEvents['on'](_0x5ccf2d,_0x4302b7);}}; \ No newline at end of file +var _0x0faf=['update','emit','removeListener','length','chatQueue:','./chatQueue.events','remove'];(function(_0x2288e9,_0x15e163){var _0x24bec9=function(_0xf4dd47){while(--_0xf4dd47){_0x2288e9['push'](_0x2288e9['shift']());}};_0x24bec9(++_0x15e163);}(_0x0faf,0x132));var _0xf0fa=function(_0x4ccf7f,_0x161ffd){_0x4ccf7f=_0x4ccf7f-0x0;var _0x1953f0=_0x0faf[_0x4ccf7f];return _0x1953f0;};'use strict';var ChatQueueEvents=require(_0xf0fa('0x0'));var events=['save',_0xf0fa('0x1'),_0xf0fa('0x2')];function createListener(_0x2c6207,_0x35a260){return function(_0xccb93e){_0x35a260[_0xf0fa('0x3')](_0x2c6207,_0xccb93e);};}function removeListener(_0x515b12,_0xc83253){return function(){ChatQueueEvents[_0xf0fa('0x4')](_0x515b12,_0xc83253);};}exports['register']=function(_0x3637a3){for(var _0x44ffa0=0x0,_0x25b5c4=events[_0xf0fa('0x5')];_0x44ffa0<_0x25b5c4;_0x44ffa0++){var _0x2db1d9=events[_0x44ffa0];var _0x587865=createListener(_0xf0fa('0x6')+_0x2db1d9,_0x3637a3);ChatQueueEvents['on'](_0x2db1d9,_0x587865);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index eb8ebdf..93cf5f5 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 _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3e74,0x175));var _0x43e7=function(_0x514185,_0x43fdae){_0x514185=_0x514185-0x0;var _0x1dc129=_0x3e74[_0x514185];return _0x1dc129;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x12457c,_0x27e0d5){var _0x426147=function(_0x2bdda3){while(--_0x2bdda3){_0x12457c['push'](_0x12457c['shift']());}};_0x426147(++_0x27e0d5);}(_0x008c,0x188));var _0xc008=function(_0x44f315,_0x5a799f){_0x44f315=_0x44f315-0x0;var _0x20478e=_0x008c[_0x44f315];return _0x20478e;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index cc25ba6..0749344 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 _0xbb0d=['DATE','moment','sequelize','STRING'];(function(_0x20bc03,_0x209513){var _0x397bbe=function(_0x5dcfb3){while(--_0x5dcfb3){_0x20bc03['push'](_0x20bc03['shift']());}};_0x397bbe(++_0x209513);}(_0xbb0d,0x1ad));var _0xdbb0=function(_0x2dafa9,_0x5d5061){_0x2dafa9=_0x2dafa9-0x0;var _0x1b61ca=_0xbb0d[_0x2dafa9];return _0x1b61ca;};'use strict';var moment=require(_0xdbb0('0x0'));var Sequelize=require(_0xdbb0('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xdbb0('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xdbb0('0x2')]},'joinAt':{'type':Sequelize[_0xdbb0('0x3')]},'leaveAt':{'type':Sequelize[_0xdbb0('0x3')]},'acceptAt':{'type':Sequelize[_0xdbb0('0x3')]},'exitAt':{'type':Sequelize[_0xdbb0('0x3')]},'reason':{'type':Sequelize[_0xdbb0('0x2')]}}; \ No newline at end of file +var _0xb416=['sequelize','STRING','DATE','moment'];(function(_0x727b91,_0x56d897){var _0x423ea1=function(_0x223ba0){while(--_0x223ba0){_0x727b91['push'](_0x727b91['shift']());}};_0x423ea1(++_0x56d897);}(_0xb416,0x173));var _0x6b41=function(_0x422c48,_0x1f722e){_0x422c48=_0x422c48-0x0;var _0x51a366=_0xb416[_0x422c48];return _0x51a366;};'use strict';var moment=require(_0x6b41('0x0'));var Sequelize=require(_0x6b41('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x6b41('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x6b41('0x2')]},'joinAt':{'type':Sequelize[_0x6b41('0x3')]},'leaveAt':{'type':Sequelize[_0x6b41('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x6b41('0x3')]},'reason':{'type':Sequelize[_0x6b41('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 2858ef3..511bd6c 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 _0x3595=['map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','reject','update','then','destroy','error','stack','name','index'];(function(_0x143f31,_0x3f6c02){var _0x351ae4=function(_0x5698db){while(--_0x5698db){_0x143f31['push'](_0x143f31['shift']());}};_0x351ae4(++_0x3f6c02);}(_0x3595,0x147));var _0x5359=function(_0xb3279c,_0x5e67c5){_0xb3279c=_0xb3279c-0x0;var _0x1a5843=_0x3595[_0xb3279c];return _0x1a5843;};'use strict';var emlformat=require(_0x5359('0x0'));var rimraf=require(_0x5359('0x1'));var zipdir=require(_0x5359('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5359('0x3'));var moment=require(_0x5359('0x4'));var BPromise=require(_0x5359('0x5'));var Mustache=require(_0x5359('0x6'));var util=require(_0x5359('0x7'));var path=require(_0x5359('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5359('0x9'));var fs=require('fs');var fs_extra=require(_0x5359('0xa'));var _=require(_0x5359('0xb'));var squel=require(_0x5359('0xc'));var crypto=require(_0x5359('0xd'));var jsforce=require(_0x5359('0xe'));var deskjs=require(_0x5359('0xf'));var toCsv=require(_0x5359('0x10'));var querystring=require(_0x5359('0x11'));var Papa=require(_0x5359('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5359('0x13'));var logger=require(_0x5359('0x14'))(_0x5359('0x15'));var utils=require(_0x5359('0x16'));var config=require(_0x5359('0x17'));var licenseUtil=require(_0x5359('0x18'));var db=require(_0x5359('0x19'))['db'];function respondWithStatusCode(_0x343282,_0xcf081){_0xcf081=_0xcf081||0xcc;return function(_0x2a42b1){if(_0x2a42b1){return _0x343282[_0x5359('0x1a')](_0xcf081);}return _0x343282[_0x5359('0x1b')](_0xcf081)[_0x5359('0x1c')]();};}function respondWithResult(_0xb1a895,_0x48099c){_0x48099c=_0x48099c||0xc8;return function(_0x51b3b7){if(_0x51b3b7){return _0xb1a895[_0x5359('0x1b')](_0x48099c)[_0x5359('0x1d')](_0x51b3b7);}};}function respondWithFilteredResult(_0x11d494,_0xa146f5){return function(_0xcdc03e){if(_0xcdc03e){var _0x44c489=typeof _0xa146f5['offset']==='undefined'&&typeof _0xa146f5[_0x5359('0x1e')]===_0x5359('0x1f');var _0x4de994=_0xcdc03e[_0x5359('0x20')];var _0x21184f=_0x44c489?0x0:_0xa146f5[_0x5359('0x21')];var _0x2d0962=_0x44c489?_0xcdc03e['count']:_0xa146f5['offset']+_0xa146f5['limit'];var _0x3f9d7b;if(_0x2d0962>=_0x4de994){_0x2d0962=_0x4de994;_0x3f9d7b=0xc8;}else{_0x3f9d7b=0xce;}_0x11d494[_0x5359('0x1b')](_0x3f9d7b);return _0x11d494['set'](_0x5359('0x22'),_0x21184f+'-'+_0x2d0962+'/'+_0x4de994)[_0x5359('0x1d')](_0xcdc03e);}return null;};}function patchUpdates(_0x45bf1c){return function(_0x41ab92){try{jsonpatch['apply'](_0x41ab92,_0x45bf1c,!![]);}catch(_0x5ad9fc){return BPromise[_0x5359('0x23')](_0x5ad9fc);}return _0x41ab92['save']();};}function saveUpdates(_0x21abeb,_0x27749e){return function(_0x3d3c0c){if(_0x3d3c0c){return _0x3d3c0c[_0x5359('0x24')](_0x21abeb)[_0x5359('0x25')](function(_0x51fc69){return _0x51fc69;});}return null;};}function removeEntity(_0x4a4667,_0x280392){return function(_0xc2eb10){if(_0xc2eb10){return _0xc2eb10[_0x5359('0x26')]()[_0x5359('0x25')](function(){_0x4a4667[_0x5359('0x1b')](0xcc)[_0x5359('0x1c')]();});}};}function handleEntityNotFound(_0x3b0d2f,_0x2771ea){return function(_0x3fea11){if(!_0x3fea11){_0x3b0d2f['sendStatus'](0x194);}return _0x3fea11;};}function handleError(_0x12052a,_0xbb59f4){_0xbb59f4=_0xbb59f4||0x1f4;return function(_0x23f192){logger[_0x5359('0x27')](_0x23f192[_0x5359('0x28')]);if(_0x23f192[_0x5359('0x29')]){delete _0x23f192['name'];}_0x12052a[_0x5359('0x1b')](_0xbb59f4)['send'](_0x23f192);};}exports[_0x5359('0x2a')]=function(_0x4b130a,_0x1d6810){var _0xdc839b={},_0x47cac5={},_0x9fc4a={'count':0x0,'rows':[]};var _0x5766e3=_[_0x5359('0x2b')](db[_0x5359('0x2c')][_0x5359('0x2d')],function(_0x10ae78){return{'name':_0x10ae78[_0x5359('0x2e')],'type':_0x10ae78[_0x5359('0x2f')][_0x5359('0x30')]};});_0x47cac5[_0x5359('0x31')]=_[_0x5359('0x2b')](_0x5766e3,_0x5359('0x29'));_0x47cac5[_0x5359('0x32')]=_[_0x5359('0x33')](_0x4b130a[_0x5359('0x32')]);_0x47cac5[_0x5359('0x34')]=_[_0x5359('0x35')](_0x47cac5[_0x5359('0x31')],_0x47cac5[_0x5359('0x32')]);_0xdc839b[_0x5359('0x36')]=_['intersection'](_0x47cac5[_0x5359('0x31')],qs[_0x5359('0x37')](_0x4b130a['query']['fields']));_0xdc839b[_0x5359('0x36')]=_0xdc839b[_0x5359('0x36')][_0x5359('0x38')]?_0xdc839b[_0x5359('0x36')]:_0x47cac5['model'];if(!_0x4b130a[_0x5359('0x32')]['hasOwnProperty'](_0x5359('0x39'))){_0xdc839b[_0x5359('0x1e')]=qs[_0x5359('0x1e')](_0x4b130a[_0x5359('0x32')][_0x5359('0x1e')]);_0xdc839b[_0x5359('0x21')]=qs[_0x5359('0x21')](_0x4b130a[_0x5359('0x32')][_0x5359('0x21')]);}_0xdc839b[_0x5359('0x3a')]=qs[_0x5359('0x3b')](_0x4b130a[_0x5359('0x32')]['sort']);_0xdc839b['where']=qs['filters'](_[_0x5359('0x3c')](_0x4b130a[_0x5359('0x32')],_0x47cac5['filters']),_0x5766e3);if(_0x4b130a['query'][_0x5359('0x3d')]){_0xdc839b[_0x5359('0x3e')]=_[_0x5359('0x3f')](_0xdc839b[_0x5359('0x3e')],{'$or':_[_0x5359('0x2b')](_0x5766e3,function(_0x19fd15){if(_0x19fd15['type']!=='VIRTUAL'){var _0x29f233={};_0x29f233[_0x19fd15[_0x5359('0x29')]]={'$like':'%'+_0x4b130a[_0x5359('0x32')][_0x5359('0x3d')]+'%'};return _0x29f233;}})});}_0xdc839b=_[_0x5359('0x3f')]({},_0xdc839b,_0x4b130a[_0x5359('0x40')]);var _0x1d6e43={'where':_0xdc839b[_0x5359('0x3e')]};return db['ChatQueueReport'][_0x5359('0x20')](_0x1d6e43)['then'](function(_0x48250b){_0x9fc4a[_0x5359('0x20')]=_0x48250b;if(_0x4b130a[_0x5359('0x32')][_0x5359('0x41')]){_0xdc839b[_0x5359('0x42')]=[{'all':!![]}];}return db[_0x5359('0x2c')][_0x5359('0x43')](_0xdc839b);})['then'](function(_0x2fbab1){_0x9fc4a[_0x5359('0x44')]=_0x2fbab1;return _0x9fc4a;})[_0x5359('0x25')](respondWithFilteredResult(_0x1d6810,_0xdc839b))[_0x5359('0x45')](handleError(_0x1d6810,null));};exports['show']=function(_0x1ea447,_0x514178){var _0x23dc72={'raw':!![],'where':{'id':_0x1ea447[_0x5359('0x46')]['id']}},_0x204cab={};_0x204cab[_0x5359('0x31')]=_[_0x5359('0x33')](db[_0x5359('0x2c')][_0x5359('0x2d')]);_0x204cab[_0x5359('0x32')]=_[_0x5359('0x33')](_0x1ea447[_0x5359('0x32')]);_0x204cab[_0x5359('0x34')]=_[_0x5359('0x35')](_0x204cab['model'],_0x204cab[_0x5359('0x32')]);_0x23dc72[_0x5359('0x36')]=_[_0x5359('0x35')](_0x204cab[_0x5359('0x31')],qs[_0x5359('0x37')](_0x1ea447[_0x5359('0x32')][_0x5359('0x37')]));_0x23dc72['attributes']=_0x23dc72[_0x5359('0x36')]['length']?_0x23dc72[_0x5359('0x36')]:_0x204cab[_0x5359('0x31')];if(_0x1ea447[_0x5359('0x32')][_0x5359('0x41')]){_0x23dc72[_0x5359('0x42')]=[{'all':!![]}];}_0x23dc72=_['merge']({},_0x23dc72,_0x1ea447[_0x5359('0x40')]);return db[_0x5359('0x2c')]['find'](_0x23dc72)[_0x5359('0x25')](handleEntityNotFound(_0x514178,null))[_0x5359('0x25')](respondWithResult(_0x514178,null))[_0x5359('0x45')](handleError(_0x514178,null));};exports[_0x5359('0x47')]=function(_0x488d17,_0x3fcb9f){return db[_0x5359('0x2c')][_0x5359('0x47')](_0x488d17[_0x5359('0x48')],{})[_0x5359('0x25')](respondWithResult(_0x3fcb9f,0xc9))[_0x5359('0x45')](handleError(_0x3fcb9f,null));};exports[_0x5359('0x24')]=function(_0x2a043e,_0x4a023c){if(_0x2a043e[_0x5359('0x48')]['id']){delete _0x2a043e[_0x5359('0x48')]['id'];}return db[_0x5359('0x2c')]['find']({'where':{'id':_0x2a043e[_0x5359('0x46')]['id']}})[_0x5359('0x25')](handleEntityNotFound(_0x4a023c,null))['then'](saveUpdates(_0x2a043e[_0x5359('0x48')],null))[_0x5359('0x25')](respondWithResult(_0x4a023c,null))[_0x5359('0x45')](handleError(_0x4a023c,null));};exports[_0x5359('0x26')]=function(_0x53aa10,_0x5803bd){return db[_0x5359('0x2c')]['find']({'where':{'id':_0x53aa10['params']['id']}})['then'](handleEntityNotFound(_0x5803bd,null))[_0x5359('0x25')](removeEntity(_0x5803bd,null))[_0x5359('0x45')](handleError(_0x5803bd,null));};exports[_0x5359('0x49')]=function(_0xdc7882,_0x213456){return db[_0x5359('0x2c')]['describe']()[_0x5359('0x25')](respondWithResult(_0x213456,null))['catch'](handleError(_0x213456,null));}; \ No newline at end of file +var _0x02ca=['update','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','where','pick','filter','merge','type','options','include','ChatQueueReport','findAll','rows','catch','params','includeAll','create','body'];(function(_0x22b252,_0x2fa785){var _0x72a312=function(_0x399974){while(--_0x399974){_0x22b252['push'](_0x22b252['shift']());}};_0x72a312(++_0x2fa785);}(_0x02ca,0x97));var _0xa02c=function(_0x1537f6,_0x1cfcd2){_0x1537f6=_0x1537f6-0x0;var _0x4fcfb3=_0x02ca[_0x1537f6];return _0x4fcfb3;};'use strict';var emlformat=require(_0xa02c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa02c('0x1'));var jsonpatch=require(_0xa02c('0x2'));var rp=require(_0xa02c('0x3'));var moment=require(_0xa02c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa02c('0x5'));var util=require(_0xa02c('0x6'));var path=require(_0xa02c('0x7'));var sox=require(_0xa02c('0x8'));var csv=require(_0xa02c('0x9'));var ejs=require(_0xa02c('0xa'));var fs=require('fs');var fs_extra=require(_0xa02c('0xb'));var _=require(_0xa02c('0xc'));var squel=require(_0xa02c('0xd'));var crypto=require(_0xa02c('0xe'));var jsforce=require(_0xa02c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa02c('0x9'));var querystring=require(_0xa02c('0x10'));var Papa=require(_0xa02c('0x11'));var Redis=require(_0xa02c('0x12'));var authService=require(_0xa02c('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa02c('0x14'));var utils=require(_0xa02c('0x15'));var config=require(_0xa02c('0x16'));var licenseUtil=require(_0xa02c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x456fd5,_0x3719d4){_0x3719d4=_0x3719d4||0xcc;return function(_0x9cb7ba){if(_0x9cb7ba){return _0x456fd5[_0xa02c('0x18')](_0x3719d4);}return _0x456fd5['status'](_0x3719d4)[_0xa02c('0x19')]();};}function respondWithResult(_0xefaee9,_0x3b24e5){_0x3b24e5=_0x3b24e5||0xc8;return function(_0x546729){if(_0x546729){return _0xefaee9[_0xa02c('0x1a')](_0x3b24e5)[_0xa02c('0x1b')](_0x546729);}};}function respondWithFilteredResult(_0x5eeece,_0x35f533){return function(_0x2a3604){if(_0x2a3604){var _0x4bc36d=typeof _0x35f533[_0xa02c('0x1c')]===_0xa02c('0x1d')&&typeof _0x35f533[_0xa02c('0x1e')]==='undefined';var _0x3c1bba=_0x2a3604['count'];var _0x4d7cb5=_0x4bc36d?0x0:_0x35f533['offset'];var _0x3fcc66=_0x4bc36d?_0x2a3604[_0xa02c('0x1f')]:_0x35f533[_0xa02c('0x1c')]+_0x35f533['limit'];var _0x12688a;if(_0x3fcc66>=_0x3c1bba){_0x3fcc66=_0x3c1bba;_0x12688a=0xc8;}else{_0x12688a=0xce;}_0x5eeece['status'](_0x12688a);return _0x5eeece[_0xa02c('0x20')](_0xa02c('0x21'),_0x4d7cb5+'-'+_0x3fcc66+'/'+_0x3c1bba)[_0xa02c('0x1b')](_0x2a3604);}return null;};}function patchUpdates(_0x476777){return function(_0x56406d){try{jsonpatch[_0xa02c('0x22')](_0x56406d,_0x476777,!![]);}catch(_0x4fb1db){return BPromise[_0xa02c('0x23')](_0x4fb1db);}return _0x56406d[_0xa02c('0x24')]();};}function saveUpdates(_0x45f7b0,_0x5b10b4){return function(_0x4787c7){if(_0x4787c7){return _0x4787c7['update'](_0x45f7b0)[_0xa02c('0x25')](function(_0x2ee242){return _0x2ee242;});}return null;};}function removeEntity(_0x2e4e9d,_0x514ef1){return function(_0x4ba050){if(_0x4ba050){return _0x4ba050[_0xa02c('0x26')]()[_0xa02c('0x25')](function(){_0x2e4e9d[_0xa02c('0x1a')](0xcc)[_0xa02c('0x19')]();});}};}function handleEntityNotFound(_0x437308,_0x58496c){return function(_0x4de358){if(!_0x4de358){_0x437308[_0xa02c('0x18')](0x194);}return _0x4de358;};}function handleError(_0x2277d2,_0x320a8d){_0x320a8d=_0x320a8d||0x1f4;return function(_0x39124e){logger[_0xa02c('0x27')](_0x39124e[_0xa02c('0x28')]);if(_0x39124e[_0xa02c('0x29')]){delete _0x39124e[_0xa02c('0x29')];}_0x2277d2['status'](_0x320a8d)[_0xa02c('0x2a')](_0x39124e);};}exports[_0xa02c('0x2b')]=function(_0x31b520,_0x67d524){var _0x267ab4={},_0x402f72={},_0x19f1c9={'count':0x0,'rows':[]};var _0x1dfc2c=_[_0xa02c('0x2c')](db['ChatQueueReport'][_0xa02c('0x2d')],function(_0xb9f91){return{'name':_0xb9f91[_0xa02c('0x2e')],'type':_0xb9f91['type']['key']};});_0x402f72[_0xa02c('0x2f')]=_[_0xa02c('0x2c')](_0x1dfc2c,_0xa02c('0x29'));_0x402f72[_0xa02c('0x30')]=_[_0xa02c('0x31')](_0x31b520[_0xa02c('0x30')]);_0x402f72[_0xa02c('0x32')]=_[_0xa02c('0x33')](_0x402f72[_0xa02c('0x2f')],_0x402f72[_0xa02c('0x30')]);_0x267ab4['attributes']=_['intersection'](_0x402f72[_0xa02c('0x2f')],qs[_0xa02c('0x34')](_0x31b520[_0xa02c('0x30')][_0xa02c('0x34')]));_0x267ab4[_0xa02c('0x35')]=_0x267ab4[_0xa02c('0x35')][_0xa02c('0x36')]?_0x267ab4[_0xa02c('0x35')]:_0x402f72[_0xa02c('0x2f')];if(!_0x31b520[_0xa02c('0x30')][_0xa02c('0x37')]('nolimit')){_0x267ab4[_0xa02c('0x1e')]=qs[_0xa02c('0x1e')](_0x31b520[_0xa02c('0x30')][_0xa02c('0x1e')]);_0x267ab4['offset']=qs['offset'](_0x31b520[_0xa02c('0x30')][_0xa02c('0x1c')]);}_0x267ab4['order']=qs['sort'](_0x31b520['query']['sort']);_0x267ab4[_0xa02c('0x38')]=qs[_0xa02c('0x32')](_[_0xa02c('0x39')](_0x31b520[_0xa02c('0x30')],_0x402f72['filters']),_0x1dfc2c);if(_0x31b520[_0xa02c('0x30')][_0xa02c('0x3a')]){_0x267ab4[_0xa02c('0x38')]=_[_0xa02c('0x3b')](_0x267ab4[_0xa02c('0x38')],{'$or':_[_0xa02c('0x2c')](_0x1dfc2c,function(_0x2ab794){if(_0x2ab794[_0xa02c('0x3c')]!=='VIRTUAL'){var _0x5b957b={};_0x5b957b[_0x2ab794[_0xa02c('0x29')]]={'$like':'%'+_0x31b520[_0xa02c('0x30')][_0xa02c('0x3a')]+'%'};return _0x5b957b;}})});}_0x267ab4=_[_0xa02c('0x3b')]({},_0x267ab4,_0x31b520[_0xa02c('0x3d')]);var _0x2a491b={'where':_0x267ab4[_0xa02c('0x38')]};return db['ChatQueueReport'][_0xa02c('0x1f')](_0x2a491b)[_0xa02c('0x25')](function(_0x33a9a3){_0x19f1c9[_0xa02c('0x1f')]=_0x33a9a3;if(_0x31b520['query']['includeAll']){_0x267ab4[_0xa02c('0x3e')]=[{'all':!![]}];}return db[_0xa02c('0x3f')][_0xa02c('0x40')](_0x267ab4);})['then'](function(_0x5d2ca0){_0x19f1c9[_0xa02c('0x41')]=_0x5d2ca0;return _0x19f1c9;})['then'](respondWithFilteredResult(_0x67d524,_0x267ab4))[_0xa02c('0x42')](handleError(_0x67d524,null));};exports['show']=function(_0x43b52a,_0x48996d){var _0x5ab62c={'raw':!![],'where':{'id':_0x43b52a[_0xa02c('0x43')]['id']}},_0x4a84c4={};_0x4a84c4['model']=_['keys'](db['ChatQueueReport'][_0xa02c('0x2d')]);_0x4a84c4['query']=_['keys'](_0x43b52a[_0xa02c('0x30')]);_0x4a84c4[_0xa02c('0x32')]=_[_0xa02c('0x33')](_0x4a84c4[_0xa02c('0x2f')],_0x4a84c4[_0xa02c('0x30')]);_0x5ab62c['attributes']=_[_0xa02c('0x33')](_0x4a84c4[_0xa02c('0x2f')],qs[_0xa02c('0x34')](_0x43b52a[_0xa02c('0x30')]['fields']));_0x5ab62c[_0xa02c('0x35')]=_0x5ab62c[_0xa02c('0x35')][_0xa02c('0x36')]?_0x5ab62c[_0xa02c('0x35')]:_0x4a84c4['model'];if(_0x43b52a[_0xa02c('0x30')][_0xa02c('0x44')]){_0x5ab62c['include']=[{'all':!![]}];}_0x5ab62c=_[_0xa02c('0x3b')]({},_0x5ab62c,_0x43b52a[_0xa02c('0x3d')]);return db[_0xa02c('0x3f')]['find'](_0x5ab62c)[_0xa02c('0x25')](handleEntityNotFound(_0x48996d,null))[_0xa02c('0x25')](respondWithResult(_0x48996d,null))[_0xa02c('0x42')](handleError(_0x48996d,null));};exports[_0xa02c('0x45')]=function(_0x282f1e,_0x4f11b2){return db['ChatQueueReport'][_0xa02c('0x45')](_0x282f1e[_0xa02c('0x46')],{})[_0xa02c('0x25')](respondWithResult(_0x4f11b2,0xc9))[_0xa02c('0x42')](handleError(_0x4f11b2,null));};exports[_0xa02c('0x47')]=function(_0x128a87,_0x538df7){if(_0x128a87[_0xa02c('0x46')]['id']){delete _0x128a87[_0xa02c('0x46')]['id'];}return db[_0xa02c('0x3f')][_0xa02c('0x48')]({'where':{'id':_0x128a87[_0xa02c('0x43')]['id']}})[_0xa02c('0x25')](handleEntityNotFound(_0x538df7,null))['then'](saveUpdates(_0x128a87['body'],null))['then'](respondWithResult(_0x538df7,null))[_0xa02c('0x42')](handleError(_0x538df7,null));};exports['destroy']=function(_0x115c9f,_0x1cae2a){return db[_0xa02c('0x3f')][_0xa02c('0x48')]({'where':{'id':_0x115c9f[_0xa02c('0x43')]['id']}})[_0xa02c('0x25')](handleEntityNotFound(_0x1cae2a,null))[_0xa02c('0x25')](removeEntity(_0x1cae2a,null))['catch'](handleError(_0x1cae2a,null));};exports[_0xa02c('0x49')]=function(_0x59d77f,_0x57a1a0){return db['ChatQueueReport'][_0xa02c('0x49')]()['then'](respondWithResult(_0x57a1a0,null))[_0xa02c('0x42')](handleError(_0x57a1a0,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 90abe7c..d9f2809 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x2d48dc,_0xaea7f7){var _0x4a9f1c=function(_0x5c6679){while(--_0x5c6679){_0x2d48dc['push'](_0x2d48dc['shift']());}};_0x4a9f1c(++_0xaea7f7);}(_0x757a,0xde));var _0xa757=function(_0x19ebf1,_0xe31b48){_0x19ebf1=_0x19ebf1-0x0;var _0x4091d1=_0x757a[_0x19ebf1];return _0x4091d1;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x5c883f,_0x38f092){var _0x4210cc=function(_0x51be71){while(--_0x51be71){_0x5c883f['push'](_0x5c883f['shift']());}};_0x4210cc(++_0x38f092);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index b8608b2..069b43d 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 _0x6867=['where','attributes','limit','UpdateChatQueueReport','catch','util','moment','ioredis','../../mysqldb','../../config/environment','then','info','ChatQueueReport,\x20%s,\x20%s','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateChatQueueReport','create','body','options','debug','ChatQueueReport','raw'];(function(_0x15d096,_0x3ef81c){var _0x491ec1=function(_0x52d031){while(--_0x52d031){_0x15d096['push'](_0x15d096['shift']());}};_0x491ec1(++_0x3ef81c);}(_0x6867,0x1b5));var _0x7686=function(_0x58ba62,_0x252d9f){_0x58ba62=_0x58ba62-0x0;var _0x57628f=_0x6867[_0x58ba62];return _0x57628f;};'use strict';var _=require('lodash');var util=require(_0x7686('0x0'));var moment=require(_0x7686('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7686('0x2'));var db=require(_0x7686('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7686('0x4'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5154a5,_0x59cfd2,_0x384635){return new BPromise(function(_0xda8e36,_0x44ccf3){return client['request'](_0x5154a5,_0x384635)[_0x7686('0x5')](function(_0x1232fc){logger[_0x7686('0x6')](_0x7686('0x7'),_0x59cfd2,'request\x20sent');logger['debug'](_0x7686('0x8'),_0x59cfd2,_0x7686('0x9'),JSON[_0x7686('0xa')](_0x1232fc));if(_0x1232fc[_0x7686('0xb')]){if(_0x1232fc[_0x7686('0xb')][_0x7686('0xc')]===0x1f4){logger[_0x7686('0xb')](_0x7686('0x7'),_0x59cfd2,_0x1232fc[_0x7686('0xb')][_0x7686('0xd')]);return _0x44ccf3(_0x1232fc[_0x7686('0xb')][_0x7686('0xd')]);}logger['error'](_0x7686('0x7'),_0x59cfd2,_0x1232fc[_0x7686('0xb')][_0x7686('0xd')]);return _0xda8e36(_0x1232fc[_0x7686('0xb')][_0x7686('0xd')]);}else{logger['info'](_0x7686('0x7'),_0x59cfd2,_0x7686('0x9'));_0xda8e36(_0x1232fc[_0x7686('0xe')]['message']);}})['catch'](function(_0x43e73e){logger['error'](_0x7686('0x7'),_0x59cfd2,_0x43e73e);_0x44ccf3(_0x43e73e);});});}exports[_0x7686('0xf')]=function(_0x9bfe17){var _0x4dac0e=this;return new Promise(function(_0x99fc16,_0x3545b6){return db['ChatQueueReport'][_0x7686('0x10')](_0x9bfe17[_0x7686('0x11')],{'raw':_0x9bfe17[_0x7686('0x12')]?_0x9bfe17[_0x7686('0x12')]['raw']===undefined?!![]:![]:!![]})[_0x7686('0x5')](function(_0xd095a6){logger[_0x7686('0x6')](_0x7686('0xf'),_0x9bfe17);logger[_0x7686('0x13')](_0x7686('0xf'),_0x9bfe17,JSON[_0x7686('0xa')](_0xd095a6));_0x99fc16(_0xd095a6);})['catch'](function(_0x22c796){logger[_0x7686('0xb')](_0x7686('0xf'),_0x22c796[_0x7686('0xd')],_0x9bfe17);_0x3545b6(_0x4dac0e[_0x7686('0xb')](0x1f4,_0x22c796[_0x7686('0xd')]));});});};exports['UpdateChatQueueReport']=function(_0x2eb790){var _0x2eb7eb=this;return new Promise(function(_0x4fb463,_0x20b036){return db[_0x7686('0x14')]['update'](_0x2eb790[_0x7686('0x11')],{'raw':_0x2eb790[_0x7686('0x12')]?_0x2eb790['options'][_0x7686('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2eb790[_0x7686('0x12')]?_0x2eb790['options'][_0x7686('0x16')]||null:null,'attributes':_0x2eb790['options']?_0x2eb790[_0x7686('0x12')][_0x7686('0x17')]||null:null,'limit':_0x2eb790[_0x7686('0x12')]?_0x2eb790[_0x7686('0x12')][_0x7686('0x18')]||null:null})[_0x7686('0x5')](function(_0xbd948a){logger[_0x7686('0x6')]('UpdateChatQueueReport',_0x2eb790);logger[_0x7686('0x13')](_0x7686('0x19'),_0x2eb790,JSON['stringify'](_0xbd948a));_0x4fb463(_0xbd948a);})[_0x7686('0x1a')](function(_0x24320c){logger[_0x7686('0xb')](_0x7686('0x19'),_0x24320c['message'],_0x2eb790);_0x20b036(_0x2eb7eb[_0x7686('0xb')](0x1f4,_0x24320c['message']));});});}; \ No newline at end of file +var _0x467a=['raw','where','attributes','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','request','info','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','catch','ChatQueueReport','create','body','options','then','CreateChatQueueReport','UpdateChatQueueReport','update'];(function(_0x21dd3e,_0x31afc5){var _0x281451=function(_0x55707e){while(--_0x55707e){_0x21dd3e['push'](_0x21dd3e['shift']());}};_0x281451(++_0x31afc5);}(_0x467a,0x124));var _0xa467=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x467a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa467('0x0'));var util=require('util');var moment=require(_0xa467('0x1'));var BPromise=require(_0xa467('0x2'));var rs=require(_0xa467('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa467('0x4'))['db'];var utils=require(_0xa467('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xa467('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa467('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2258bf,_0x52c0ad,_0xca8d9){return new BPromise(function(_0x34dc84,_0x19964f){return client[_0xa467('0x8')](_0x2258bf,_0xca8d9)['then'](function(_0x4bc5ef){logger[_0xa467('0x9')]('ChatQueueReport,\x20%s,\x20%s',_0x52c0ad,'request\x20sent');logger[_0xa467('0xa')](_0xa467('0xb'),_0x52c0ad,_0xa467('0xc'),JSON[_0xa467('0xd')](_0x4bc5ef));if(_0x4bc5ef[_0xa467('0xe')]){if(_0x4bc5ef['error'][_0xa467('0xf')]===0x1f4){logger[_0xa467('0xe')](_0xa467('0x10'),_0x52c0ad,_0x4bc5ef[_0xa467('0xe')]['message']);return _0x19964f(_0x4bc5ef[_0xa467('0xe')][_0xa467('0x11')]);}logger[_0xa467('0xe')](_0xa467('0x10'),_0x52c0ad,_0x4bc5ef[_0xa467('0xe')]['message']);return _0x34dc84(_0x4bc5ef[_0xa467('0xe')][_0xa467('0x11')]);}else{logger[_0xa467('0x9')]('ChatQueueReport,\x20%s,\x20%s',_0x52c0ad,_0xa467('0xc'));_0x34dc84(_0x4bc5ef[_0xa467('0x12')]['message']);}})[_0xa467('0x13')](function(_0x48599b){logger[_0xa467('0xe')](_0xa467('0x10'),_0x52c0ad,_0x48599b);_0x19964f(_0x48599b);});});}exports['CreateChatQueueReport']=function(_0x44965e){var _0x15730b=this;return new Promise(function(_0x49db82,_0x141344){return db[_0xa467('0x14')][_0xa467('0x15')](_0x44965e[_0xa467('0x16')],{'raw':_0x44965e['options']?_0x44965e[_0xa467('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xa467('0x18')](function(_0x2c0f26){logger[_0xa467('0x9')](_0xa467('0x19'),_0x44965e);logger[_0xa467('0xa')](_0xa467('0x19'),_0x44965e,JSON[_0xa467('0xd')](_0x2c0f26));_0x49db82(_0x2c0f26);})[_0xa467('0x13')](function(_0x309889){logger[_0xa467('0xe')](_0xa467('0x19'),_0x309889[_0xa467('0x11')],_0x44965e);_0x141344(_0x15730b['error'](0x1f4,_0x309889[_0xa467('0x11')]));});});};exports[_0xa467('0x1a')]=function(_0x2c1804){var _0x1e00d0=this;return new Promise(function(_0x364f7f,_0x20a9c9){return db[_0xa467('0x14')][_0xa467('0x1b')](_0x2c1804[_0xa467('0x16')],{'raw':_0x2c1804['options']?_0x2c1804['options'][_0xa467('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c1804['options']?_0x2c1804[_0xa467('0x17')][_0xa467('0x1d')]||null:null,'attributes':_0x2c1804['options']?_0x2c1804[_0xa467('0x17')][_0xa467('0x1e')]||null:null,'limit':_0x2c1804[_0xa467('0x17')]?_0x2c1804[_0xa467('0x17')][_0xa467('0x1f')]||null:null})[_0xa467('0x18')](function(_0xe2301e){logger['info'](_0xa467('0x1a'),_0x2c1804);logger[_0xa467('0xa')](_0xa467('0x1a'),_0x2c1804,JSON[_0xa467('0xd')](_0xe2301e));_0x364f7f(_0xe2301e);})[_0xa467('0x13')](function(_0x20872d){logger[_0xa467('0xe')](_0xa467('0x1a'),_0x20872d[_0xa467('0x11')],_0x2c1804);_0x20a9c9(_0x1e00d0[_0xa467('0xe')](0x1f4,_0x20872d['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 83a8066..7ffdf9c 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 _0x8b72=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete'];(function(_0x2f6950,_0x317c38){var _0x57728c=function(_0x2a9672){while(--_0x2a9672){_0x2f6950['push'](_0x2f6950['shift']());}};_0x57728c(++_0x317c38);}(_0x8b72,0x1a6));var _0x28b7=function(_0x1ef9ed,_0x5d0e59){_0x1ef9ed=_0x1ef9ed-0x0;var _0x2eec97=_0x8b72[_0x1ef9ed];return _0x2eec97;};'use strict';var multer=require(_0x28b7('0x0'));var util=require(_0x28b7('0x1'));var path=require(_0x28b7('0x2'));var timeout=require(_0x28b7('0x3'));var express=require('express');var router=express[_0x28b7('0x4')]();var fs_extra=require(_0x28b7('0x5'));var auth=require(_0x28b7('0x6'));var interaction=require(_0x28b7('0x7'));var config=require(_0x28b7('0x8'));var controller=require('./chatQueueReport.controller');router[_0x28b7('0x9')]('/',auth[_0x28b7('0xa')](),controller[_0x28b7('0xb')]);router[_0x28b7('0x9')](_0x28b7('0xc'),auth[_0x28b7('0xa')](),controller[_0x28b7('0xd')]);router[_0x28b7('0x9')](_0x28b7('0xe'),auth[_0x28b7('0xa')](),controller[_0x28b7('0xf')]);router['post']('/',auth[_0x28b7('0xa')](),controller[_0x28b7('0x10')]);router[_0x28b7('0x11')](_0x28b7('0xe'),auth[_0x28b7('0xa')](),controller['update']);router[_0x28b7('0x12')](_0x28b7('0xe'),auth[_0x28b7('0xa')](),controller[_0x28b7('0x13')]);module[_0x28b7('0x14')]=router; \ No newline at end of file +var _0xf882=['update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','post','create','put','/:id'];(function(_0x4a1883,_0x437f8e){var _0x32e815=function(_0x5e33a3){while(--_0x5e33a3){_0x4a1883['push'](_0x4a1883['shift']());}};_0x32e815(++_0x437f8e);}(_0xf882,0x138));var _0x2f88=function(_0x41df00,_0x2125b7){_0x41df00=_0x41df00-0x0;var _0x4e6378=_0xf882[_0x41df00];return _0x4e6378;};'use strict';var multer=require('multer');var util=require(_0x2f88('0x0'));var path=require('path');var timeout=require(_0x2f88('0x1'));var express=require(_0x2f88('0x2'));var router=express[_0x2f88('0x3')]();var fs_extra=require(_0x2f88('0x4'));var auth=require(_0x2f88('0x5'));var interaction=require(_0x2f88('0x6'));var config=require(_0x2f88('0x7'));var controller=require(_0x2f88('0x8'));router[_0x2f88('0x9')]('/',auth[_0x2f88('0xa')](),controller[_0x2f88('0xb')]);router[_0x2f88('0x9')](_0x2f88('0xc'),auth[_0x2f88('0xa')](),controller[_0x2f88('0xd')]);router[_0x2f88('0x9')]('/:id',auth[_0x2f88('0xa')](),controller['show']);router[_0x2f88('0xe')]('/',auth[_0x2f88('0xa')](),controller[_0x2f88('0xf')]);router[_0x2f88('0x10')](_0x2f88('0x11'),auth['isAuthenticated'](),controller[_0x2f88('0x12')]);router[_0x2f88('0x13')](_0x2f88('0x11'),auth[_0x2f88('0xa')](),controller[_0x2f88('0x14')]);module[_0x2f88('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 3d85f2f..1cac293 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x5b93f8,_0xffefcd){var _0x1430ec=function(_0xee6cc1){while(--_0xee6cc1){_0x5b93f8['push'](_0x5b93f8['shift']());}};_0x1430ec(++_0xffefcd);}(_0x008c,0x188));var _0xc008=function(_0x3df822,_0x299495){_0x3df822=_0x3df822-0x0;var _0x4e457d=_0x008c[_0x3df822];return _0x4e457d;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x284fd3,_0x21eb0d){var _0x3ad39b=function(_0xcb1752){while(--_0xcb1752){_0x284fd3['push'](_0x284fd3['shift']());}};_0x3ad39b(++_0x21eb0d);}(_0xf4eb,0xec));var _0xbf4e=function(_0x586867,_0x20cdbd){_0x586867=_0x586867-0x0;var _0x1c2237=_0xf4eb[_0x586867];return _0x1c2237;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index d8df5cf..7f660de 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 _0x758b=['api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','findAll','rows','catch','params','length','includeAll','include','options','find','create','body','update','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0xfaf19d,_0x57304b){var _0x14a9d9=function(_0x5337fc){while(--_0x5337fc){_0xfaf19d['push'](_0xfaf19d['shift']());}};_0x14a9d9(++_0x57304b);}(_0x758b,0x1c4));var _0xb758=function(_0x36bfe3,_0x358938){_0x36bfe3=_0x36bfe3-0x0;var _0x9b0436=_0x758b[_0x36bfe3];return _0x9b0436;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb758('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb758('0x1'));var rp=require(_0xb758('0x2'));var moment=require(_0xb758('0x3'));var BPromise=require(_0xb758('0x4'));var Mustache=require(_0xb758('0x5'));var util=require(_0xb758('0x6'));var path=require(_0xb758('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb758('0x8'));var fs=require('fs');var fs_extra=require(_0xb758('0x9'));var _=require(_0xb758('0xa'));var squel=require(_0xb758('0xb'));var crypto=require(_0xb758('0xc'));var jsforce=require(_0xb758('0xd'));var deskjs=require(_0xb758('0xe'));var toCsv=require(_0xb758('0xf'));var querystring=require(_0xb758('0x10'));var Papa=require(_0xb758('0x11'));var Redis=require(_0xb758('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb758('0x13'));var as=require(_0xb758('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb758('0x15'))(_0xb758('0x16'));var utils=require(_0xb758('0x17'));var config=require(_0xb758('0x18'));var licenseUtil=require(_0xb758('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28c8e7,_0x144f6d){_0x144f6d=_0x144f6d||0xcc;return function(_0x513751){if(_0x513751){return _0x28c8e7[_0xb758('0x1a')](_0x144f6d);}return _0x28c8e7[_0xb758('0x1b')](_0x144f6d)[_0xb758('0x1c')]();};}function respondWithResult(_0x3ac008,_0x4f326a){_0x4f326a=_0x4f326a||0xc8;return function(_0x62a8dd){if(_0x62a8dd){return _0x3ac008[_0xb758('0x1b')](_0x4f326a)[_0xb758('0x1d')](_0x62a8dd);}};}function respondWithFilteredResult(_0xfc25b8,_0x72f92e){return function(_0x4db7e2){if(_0x4db7e2){var _0x2414bf=typeof _0x72f92e[_0xb758('0x1e')]===_0xb758('0x1f')&&typeof _0x72f92e[_0xb758('0x20')]===_0xb758('0x1f');var _0x4272ba=_0x4db7e2[_0xb758('0x21')];var _0x3fa3e4=_0x2414bf?0x0:_0x72f92e[_0xb758('0x1e')];var _0x3d2e61=_0x2414bf?_0x4db7e2[_0xb758('0x21')]:_0x72f92e[_0xb758('0x1e')]+_0x72f92e['limit'];var _0x428bd7;if(_0x3d2e61>=_0x4272ba){_0x3d2e61=_0x4272ba;_0x428bd7=0xc8;}else{_0x428bd7=0xce;}_0xfc25b8[_0xb758('0x1b')](_0x428bd7);return _0xfc25b8[_0xb758('0x22')](_0xb758('0x23'),_0x3fa3e4+'-'+_0x3d2e61+'/'+_0x4272ba)[_0xb758('0x1d')](_0x4db7e2);}return null;};}function patchUpdates(_0xb55f36){return function(_0x33bf4f){try{jsonpatch[_0xb758('0x24')](_0x33bf4f,_0xb55f36,!![]);}catch(_0x492fe9){return BPromise[_0xb758('0x25')](_0x492fe9);}return _0x33bf4f[_0xb758('0x26')]();};}function saveUpdates(_0x3bc521,_0x28b178){return function(_0x19c2e5){if(_0x19c2e5){return _0x19c2e5['update'](_0x3bc521)[_0xb758('0x27')](function(_0x504a0b){return _0x504a0b;});}return null;};}function removeEntity(_0x42b4e6,_0x28f00d){return function(_0x4e01d3){if(_0x4e01d3){return _0x4e01d3[_0xb758('0x28')]()[_0xb758('0x27')](function(){_0x42b4e6[_0xb758('0x1b')](0xcc)[_0xb758('0x1c')]();});}};}function handleEntityNotFound(_0x216df3,_0x339512){return function(_0x4c4e6b){if(!_0x4c4e6b){_0x216df3['sendStatus'](0x194);}return _0x4c4e6b;};}function handleError(_0x33f1e5,_0x4f1903){_0x4f1903=_0x4f1903||0x1f4;return function(_0x102919){logger[_0xb758('0x29')](_0x102919['stack']);if(_0x102919[_0xb758('0x2a')]){delete _0x102919[_0xb758('0x2a')];}_0x33f1e5[_0xb758('0x1b')](_0x4f1903)[_0xb758('0x2b')](_0x102919);};}exports['index']=function(_0x32cc04,_0x42f3b6){var _0x1c1683={},_0x168dd2={},_0x3f4e67={'count':0x0,'rows':[]};var _0x30b11a=_[_0xb758('0x2c')](db[_0xb758('0x2d')][_0xb758('0x2e')],function(_0x5673c9){return{'name':_0x5673c9[_0xb758('0x2f')],'type':_0x5673c9[_0xb758('0x30')][_0xb758('0x31')]};});_0x168dd2[_0xb758('0x32')]=_[_0xb758('0x2c')](_0x30b11a,_0xb758('0x2a'));_0x168dd2['query']=_[_0xb758('0x33')](_0x32cc04[_0xb758('0x34')]);_0x168dd2[_0xb758('0x35')]=_[_0xb758('0x36')](_0x168dd2[_0xb758('0x32')],_0x168dd2[_0xb758('0x34')]);_0x1c1683[_0xb758('0x37')]=_[_0xb758('0x36')](_0x168dd2[_0xb758('0x32')],qs['fields'](_0x32cc04[_0xb758('0x34')][_0xb758('0x38')]));_0x1c1683[_0xb758('0x37')]=_0x1c1683[_0xb758('0x37')]['length']?_0x1c1683[_0xb758('0x37')]:_0x168dd2[_0xb758('0x32')];if(!_0x32cc04[_0xb758('0x34')][_0xb758('0x39')](_0xb758('0x3a'))){_0x1c1683[_0xb758('0x20')]=qs['limit'](_0x32cc04[_0xb758('0x34')][_0xb758('0x20')]);_0x1c1683[_0xb758('0x1e')]=qs[_0xb758('0x1e')](_0x32cc04[_0xb758('0x34')][_0xb758('0x1e')]);}_0x1c1683[_0xb758('0x3b')]=qs[_0xb758('0x3c')](_0x32cc04[_0xb758('0x34')][_0xb758('0x3c')]);_0x1c1683['where']=qs[_0xb758('0x35')](_[_0xb758('0x3d')](_0x32cc04['query'],_0x168dd2[_0xb758('0x35')]),_0x30b11a);if(_0x32cc04[_0xb758('0x34')][_0xb758('0x3e')]){_0x1c1683[_0xb758('0x3f')]=_[_0xb758('0x40')](_0x1c1683[_0xb758('0x3f')],{'$or':_['map'](_0x30b11a,function(_0x5d2eae){if(_0x5d2eae[_0xb758('0x30')]!==_0xb758('0x41')){var _0x2a4adc={};_0x2a4adc[_0x5d2eae[_0xb758('0x2a')]]={'$like':'%'+_0x32cc04[_0xb758('0x34')][_0xb758('0x3e')]+'%'};return _0x2a4adc;}})});}_0x1c1683=_[_0xb758('0x40')]({},_0x1c1683,_0x32cc04['options']);var _0xe7b598={'where':_0x1c1683['where']};return db[_0xb758('0x2d')][_0xb758('0x21')](_0xe7b598)[_0xb758('0x27')](function(_0x3f1da2){_0x3f4e67[_0xb758('0x21')]=_0x3f1da2;if(_0x32cc04[_0xb758('0x34')]['includeAll']){_0x1c1683['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0xb758('0x42')](_0x1c1683);})[_0xb758('0x27')](function(_0x542913){_0x3f4e67[_0xb758('0x43')]=_0x542913;return _0x3f4e67;})[_0xb758('0x27')](respondWithFilteredResult(_0x42f3b6,_0x1c1683))[_0xb758('0x44')](handleError(_0x42f3b6,null));};exports['show']=function(_0x39e324,_0x28ce7){var _0x43509c={'raw':!![],'where':{'id':_0x39e324[_0xb758('0x45')]['id']}},_0x326516={};_0x326516['model']=_['keys'](db[_0xb758('0x2d')][_0xb758('0x2e')]);_0x326516[_0xb758('0x34')]=_[_0xb758('0x33')](_0x39e324[_0xb758('0x34')]);_0x326516['filters']=_[_0xb758('0x36')](_0x326516[_0xb758('0x32')],_0x326516[_0xb758('0x34')]);_0x43509c[_0xb758('0x37')]=_[_0xb758('0x36')](_0x326516[_0xb758('0x32')],qs[_0xb758('0x38')](_0x39e324[_0xb758('0x34')]['fields']));_0x43509c['attributes']=_0x43509c[_0xb758('0x37')][_0xb758('0x46')]?_0x43509c[_0xb758('0x37')]:_0x326516[_0xb758('0x32')];if(_0x39e324['query'][_0xb758('0x47')]){_0x43509c[_0xb758('0x48')]=[{'all':!![]}];}_0x43509c=_[_0xb758('0x40')]({},_0x43509c,_0x39e324[_0xb758('0x49')]);return db['ChatTransferReport'][_0xb758('0x4a')](_0x43509c)[_0xb758('0x27')](handleEntityNotFound(_0x28ce7,null))[_0xb758('0x27')](respondWithResult(_0x28ce7,null))['catch'](handleError(_0x28ce7,null));};exports[_0xb758('0x4b')]=function(_0x2287d4,_0x5d8a72){return db[_0xb758('0x2d')]['create'](_0x2287d4[_0xb758('0x4c')],{})['then'](respondWithResult(_0x5d8a72,0xc9))['catch'](handleError(_0x5d8a72,null));};exports[_0xb758('0x4d')]=function(_0x5ba37d,_0x3dcce1){if(_0x5ba37d[_0xb758('0x4c')]['id']){delete _0x5ba37d['body']['id'];}return db[_0xb758('0x2d')][_0xb758('0x4a')]({'where':{'id':_0x5ba37d[_0xb758('0x45')]['id']}})[_0xb758('0x27')](handleEntityNotFound(_0x3dcce1,null))[_0xb758('0x27')](saveUpdates(_0x5ba37d['body'],null))[_0xb758('0x27')](respondWithResult(_0x3dcce1,null))[_0xb758('0x44')](handleError(_0x3dcce1,null));};exports[_0xb758('0x28')]=function(_0x4f27dc,_0x15b894){return db[_0xb758('0x2d')]['find']({'where':{'id':_0x4f27dc[_0xb758('0x45')]['id']}})['then'](handleEntityNotFound(_0x15b894,null))[_0xb758('0x27')](removeEntity(_0x15b894,null))['catch'](handleError(_0x15b894,null));};exports[_0xb758('0x4e')]=function(_0x588276,_0x552e68){return db[_0xb758('0x2d')]['describe']()[_0xb758('0x27')](respondWithResult(_0x552e68,null))[_0xb758('0x44')](handleError(_0x552e68,null));}; \ No newline at end of file +var _0xc808=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','offset','count','status','set','Content-Range','reject','save','then','destroy','error','stack','name','index','ChatTransferReport','rawAttributes','fieldName','key','model','map','query','filters','attributes','intersection','fields','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','keys','length','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x10bf5d,_0x10a3a9){var _0x27f511=function(_0x209cf3){while(--_0x209cf3){_0x10bf5d['push'](_0x10bf5d['shift']());}};_0x27f511(++_0x10a3a9);}(_0xc808,0x97));var _0x8c80=function(_0x219cc1,_0x3d03b5){_0x219cc1=_0x219cc1-0x0;var _0x177034=_0xc808[_0x219cc1];return _0x177034;};'use strict';var emlformat=require(_0x8c80('0x0'));var rimraf=require(_0x8c80('0x1'));var zipdir=require(_0x8c80('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c80('0x3'));var moment=require(_0x8c80('0x4'));var BPromise=require(_0x8c80('0x5'));var Mustache=require(_0x8c80('0x6'));var util=require(_0x8c80('0x7'));var path=require(_0x8c80('0x8'));var sox=require(_0x8c80('0x9'));var csv=require(_0x8c80('0xa'));var ejs=require(_0x8c80('0xb'));var fs=require('fs');var fs_extra=require(_0x8c80('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8c80('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8c80('0xe'));var toCsv=require(_0x8c80('0xa'));var querystring=require('querystring');var Papa=require(_0x8c80('0xf'));var Redis=require(_0x8c80('0x10'));var authService=require(_0x8c80('0x11'));var qs=require(_0x8c80('0x12'));var as=require(_0x8c80('0x13'));var hardwareService=require(_0x8c80('0x14'));var logger=require(_0x8c80('0x15'))(_0x8c80('0x16'));var utils=require(_0x8c80('0x17'));var config=require(_0x8c80('0x18'));var licenseUtil=require(_0x8c80('0x19'));var db=require(_0x8c80('0x1a'))['db'];function respondWithStatusCode(_0x1aa841,_0x2432d8){_0x2432d8=_0x2432d8||0xcc;return function(_0x4ed424){if(_0x4ed424){return _0x1aa841[_0x8c80('0x1b')](_0x2432d8);}return _0x1aa841['status'](_0x2432d8)[_0x8c80('0x1c')]();};}function respondWithResult(_0x328a87,_0x46da68){_0x46da68=_0x46da68||0xc8;return function(_0x5a4881){if(_0x5a4881){return _0x328a87['status'](_0x46da68)[_0x8c80('0x1d')](_0x5a4881);}};}function respondWithFilteredResult(_0x374c48,_0xc38cfc){return function(_0x2c01a8){if(_0x2c01a8){var _0x314570=typeof _0xc38cfc['offset']===_0x8c80('0x1e')&&typeof _0xc38cfc[_0x8c80('0x1f')]==='undefined';var _0x401070=_0x2c01a8['count'];var _0x384023=_0x314570?0x0:_0xc38cfc[_0x8c80('0x20')];var _0xe60216=_0x314570?_0x2c01a8[_0x8c80('0x21')]:_0xc38cfc[_0x8c80('0x20')]+_0xc38cfc['limit'];var _0x42f5be;if(_0xe60216>=_0x401070){_0xe60216=_0x401070;_0x42f5be=0xc8;}else{_0x42f5be=0xce;}_0x374c48[_0x8c80('0x22')](_0x42f5be);return _0x374c48[_0x8c80('0x23')](_0x8c80('0x24'),_0x384023+'-'+_0xe60216+'/'+_0x401070)[_0x8c80('0x1d')](_0x2c01a8);}return null;};}function patchUpdates(_0x39bdcb){return function(_0x2d1771){try{jsonpatch['apply'](_0x2d1771,_0x39bdcb,!![]);}catch(_0x56fbb5){return BPromise[_0x8c80('0x25')](_0x56fbb5);}return _0x2d1771[_0x8c80('0x26')]();};}function saveUpdates(_0x103bf7,_0x7bc10){return function(_0x53f225){if(_0x53f225){return _0x53f225['update'](_0x103bf7)[_0x8c80('0x27')](function(_0x355438){return _0x355438;});}return null;};}function removeEntity(_0x5d5d11,_0x48a404){return function(_0x2de3df){if(_0x2de3df){return _0x2de3df[_0x8c80('0x28')]()[_0x8c80('0x27')](function(){_0x5d5d11[_0x8c80('0x22')](0xcc)[_0x8c80('0x1c')]();});}};}function handleEntityNotFound(_0x157bb5,_0x2d8b55){return function(_0xce1986){if(!_0xce1986){_0x157bb5[_0x8c80('0x1b')](0x194);}return _0xce1986;};}function handleError(_0x2005b6,_0x587635){_0x587635=_0x587635||0x1f4;return function(_0x11a075){logger[_0x8c80('0x29')](_0x11a075[_0x8c80('0x2a')]);if(_0x11a075[_0x8c80('0x2b')]){delete _0x11a075['name'];}_0x2005b6[_0x8c80('0x22')](_0x587635)['send'](_0x11a075);};}exports[_0x8c80('0x2c')]=function(_0xa5293b,_0x5d1d4c){var _0x5f297c={},_0x4c267c={},_0x4a4303={'count':0x0,'rows':[]};var _0x48f24c=_['map'](db[_0x8c80('0x2d')][_0x8c80('0x2e')],function(_0x44ca9a){return{'name':_0x44ca9a[_0x8c80('0x2f')],'type':_0x44ca9a['type'][_0x8c80('0x30')]};});_0x4c267c[_0x8c80('0x31')]=_[_0x8c80('0x32')](_0x48f24c,'name');_0x4c267c[_0x8c80('0x33')]=_['keys'](_0xa5293b[_0x8c80('0x33')]);_0x4c267c[_0x8c80('0x34')]=_['intersection'](_0x4c267c[_0x8c80('0x31')],_0x4c267c[_0x8c80('0x33')]);_0x5f297c[_0x8c80('0x35')]=_[_0x8c80('0x36')](_0x4c267c[_0x8c80('0x31')],qs['fields'](_0xa5293b[_0x8c80('0x33')][_0x8c80('0x37')]));_0x5f297c['attributes']=_0x5f297c[_0x8c80('0x35')]['length']?_0x5f297c['attributes']:_0x4c267c[_0x8c80('0x31')];if(!_0xa5293b[_0x8c80('0x33')]['hasOwnProperty'](_0x8c80('0x38'))){_0x5f297c[_0x8c80('0x1f')]=qs['limit'](_0xa5293b['query'][_0x8c80('0x1f')]);_0x5f297c[_0x8c80('0x20')]=qs['offset'](_0xa5293b['query'][_0x8c80('0x20')]);}_0x5f297c[_0x8c80('0x39')]=qs[_0x8c80('0x3a')](_0xa5293b['query'][_0x8c80('0x3a')]);_0x5f297c[_0x8c80('0x3b')]=qs[_0x8c80('0x34')](_['pick'](_0xa5293b[_0x8c80('0x33')],_0x4c267c['filters']),_0x48f24c);if(_0xa5293b[_0x8c80('0x33')]['filter']){_0x5f297c[_0x8c80('0x3b')]=_[_0x8c80('0x3c')](_0x5f297c[_0x8c80('0x3b')],{'$or':_[_0x8c80('0x32')](_0x48f24c,function(_0x4dbb4a){if(_0x4dbb4a[_0x8c80('0x3d')]!==_0x8c80('0x3e')){var _0x4e576c={};_0x4e576c[_0x4dbb4a[_0x8c80('0x2b')]]={'$like':'%'+_0xa5293b[_0x8c80('0x33')][_0x8c80('0x3f')]+'%'};return _0x4e576c;}})});}_0x5f297c=_[_0x8c80('0x3c')]({},_0x5f297c,_0xa5293b[_0x8c80('0x40')]);var _0xa2cb92={'where':_0x5f297c[_0x8c80('0x3b')]};return db[_0x8c80('0x2d')][_0x8c80('0x21')](_0xa2cb92)[_0x8c80('0x27')](function(_0x55a084){_0x4a4303[_0x8c80('0x21')]=_0x55a084;if(_0xa5293b[_0x8c80('0x33')][_0x8c80('0x41')]){_0x5f297c[_0x8c80('0x42')]=[{'all':!![]}];}return db[_0x8c80('0x2d')]['findAll'](_0x5f297c);})[_0x8c80('0x27')](function(_0x1d531b){_0x4a4303[_0x8c80('0x43')]=_0x1d531b;return _0x4a4303;})[_0x8c80('0x27')](respondWithFilteredResult(_0x5d1d4c,_0x5f297c))[_0x8c80('0x44')](handleError(_0x5d1d4c,null));};exports[_0x8c80('0x45')]=function(_0x2662cd,_0x2f0768){var _0x3b99eb={'raw':!![],'where':{'id':_0x2662cd['params']['id']}},_0x2786fd={};_0x2786fd[_0x8c80('0x31')]=_[_0x8c80('0x46')](db[_0x8c80('0x2d')][_0x8c80('0x2e')]);_0x2786fd[_0x8c80('0x33')]=_[_0x8c80('0x46')](_0x2662cd[_0x8c80('0x33')]);_0x2786fd['filters']=_[_0x8c80('0x36')](_0x2786fd[_0x8c80('0x31')],_0x2786fd[_0x8c80('0x33')]);_0x3b99eb['attributes']=_[_0x8c80('0x36')](_0x2786fd[_0x8c80('0x31')],qs[_0x8c80('0x37')](_0x2662cd[_0x8c80('0x33')]['fields']));_0x3b99eb[_0x8c80('0x35')]=_0x3b99eb[_0x8c80('0x35')][_0x8c80('0x47')]?_0x3b99eb['attributes']:_0x2786fd[_0x8c80('0x31')];if(_0x2662cd[_0x8c80('0x33')][_0x8c80('0x41')]){_0x3b99eb[_0x8c80('0x42')]=[{'all':!![]}];}_0x3b99eb=_[_0x8c80('0x3c')]({},_0x3b99eb,_0x2662cd[_0x8c80('0x40')]);return db[_0x8c80('0x2d')][_0x8c80('0x48')](_0x3b99eb)['then'](handleEntityNotFound(_0x2f0768,null))[_0x8c80('0x27')](respondWithResult(_0x2f0768,null))[_0x8c80('0x44')](handleError(_0x2f0768,null));};exports[_0x8c80('0x49')]=function(_0x3d6c7d,_0x457509){return db[_0x8c80('0x2d')][_0x8c80('0x49')](_0x3d6c7d[_0x8c80('0x4a')],{})[_0x8c80('0x27')](respondWithResult(_0x457509,0xc9))[_0x8c80('0x44')](handleError(_0x457509,null));};exports[_0x8c80('0x4b')]=function(_0x4cda3c,_0x387905){if(_0x4cda3c[_0x8c80('0x4a')]['id']){delete _0x4cda3c[_0x8c80('0x4a')]['id'];}return db['ChatTransferReport'][_0x8c80('0x48')]({'where':{'id':_0x4cda3c['params']['id']}})['then'](handleEntityNotFound(_0x387905,null))[_0x8c80('0x27')](saveUpdates(_0x4cda3c[_0x8c80('0x4a')],null))[_0x8c80('0x27')](respondWithResult(_0x387905,null))[_0x8c80('0x44')](handleError(_0x387905,null));};exports[_0x8c80('0x28')]=function(_0x24dc95,_0x44adea){return db[_0x8c80('0x2d')][_0x8c80('0x48')]({'where':{'id':_0x24dc95[_0x8c80('0x4c')]['id']}})[_0x8c80('0x27')](handleEntityNotFound(_0x44adea,null))[_0x8c80('0x27')](removeEntity(_0x44adea,null))[_0x8c80('0x44')](handleError(_0x44adea,null));};exports[_0x8c80('0x4d')]=function(_0x162f36,_0x3e1c8d){return db[_0x8c80('0x2d')][_0x8c80('0x4d')]()['then'](respondWithResult(_0x3e1c8d,null))[_0x8c80('0x44')](handleError(_0x3e1c8d,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index cde8049..8291c9f 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 _0x69e0=['uniqueid','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','exports','define','ChatTransferReport'];(function(_0x164488,_0x2ffead){var _0x13539f=function(_0x4976c2){while(--_0x4976c2){_0x164488['push'](_0x164488['shift']());}};_0x13539f(++_0x2ffead);}(_0x69e0,0xfe));var _0x069e=function(_0xa1e7a3,_0x2b127c){_0xa1e7a3=_0xa1e7a3-0x0;var _0x1a53f5=_0x69e0[_0xa1e7a3];return _0x1a53f5;};'use strict';var _=require(_0x069e('0x0'));var util=require(_0x069e('0x1'));var logger=require(_0x069e('0x2'))('api');var moment=require(_0x069e('0x3'));var BPromise=require(_0x069e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x069e('0x5'));var rimraf=require('rimraf');var config=require(_0x069e('0x6'));var attributes=require('./chatTransferReport.attributes');module[_0x069e('0x7')]=function(_0x5d3bbc,_0x5e56aa){return _0x5d3bbc[_0x069e('0x8')](_0x069e('0x9'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x069e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf6b4=['define','ChatTransferReport','uniqueid','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes'];(function(_0xf3f0cc,_0x5a6ff3){var _0x30935a=function(_0x180114){while(--_0x180114){_0xf3f0cc['push'](_0xf3f0cc['shift']());}};_0x30935a(++_0x5a6ff3);}(_0xf6b4,0xc9));var _0x4f6b=function(_0x178ca4,_0x5aaa16){_0x178ca4=_0x178ca4-0x0;var _0x57f6a8=_0xf6b4[_0x178ca4];return _0x57f6a8;};'use strict';var _=require(_0x4f6b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4f6b('0x1'));var BPromise=require(_0x4f6b('0x2'));var rp=require(_0x4f6b('0x3'));var fs=require('fs');var path=require(_0x4f6b('0x4'));var rimraf=require(_0x4f6b('0x5'));var config=require(_0x4f6b('0x6'));var attributes=require(_0x4f6b('0x7'));module['exports']=function(_0x442265,_0x313c59){return _0x442265[_0x4f6b('0x8')](_0x4f6b('0x9'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4f6b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 7ce40ba..fac8a62 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 _0x2d84=['message','ChatTransferReport,\x20%s,\x20%s','result','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x22392c,_0x3d66c2){var _0xafef9f=function(_0x470dac){while(--_0x470dac){_0x22392c['push'](_0x22392c['shift']());}};_0xafef9f(++_0x3d66c2);}(_0x2d84,0xa4));var _0x42d8=function(_0x4d0adf,_0x3c627c){_0x4d0adf=_0x4d0adf-0x0;var _0x3d53e8=_0x2d84[_0x4d0adf];return _0x3d53e8;};'use strict';var _=require(_0x42d8('0x0'));var util=require(_0x42d8('0x1'));var moment=require('moment');var BPromise=require(_0x42d8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x42d8('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x42d8('0x4'))(_0x42d8('0x5'));var config=require(_0x42d8('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x42d8('0x7')][_0x42d8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5be28f,_0x52c474,_0x214306){return new BPromise(function(_0x44f0b5,_0x27338f){return client[_0x42d8('0x9')](_0x5be28f,_0x214306)['then'](function(_0x4db990){logger[_0x42d8('0xa')]('ChatTransferReport,\x20%s,\x20%s',_0x52c474,_0x42d8('0xb'));logger[_0x42d8('0xc')](_0x42d8('0xd'),_0x52c474,_0x42d8('0xb'),JSON['stringify'](_0x4db990));if(_0x4db990[_0x42d8('0xe')]){if(_0x4db990[_0x42d8('0xe')][_0x42d8('0xf')]===0x1f4){logger[_0x42d8('0xe')]('ChatTransferReport,\x20%s,\x20%s',_0x52c474,_0x4db990[_0x42d8('0xe')]['message']);return _0x27338f(_0x4db990[_0x42d8('0xe')][_0x42d8('0x10')]);}logger[_0x42d8('0xe')](_0x42d8('0x11'),_0x52c474,_0x4db990[_0x42d8('0xe')]['message']);return _0x44f0b5(_0x4db990[_0x42d8('0xe')][_0x42d8('0x10')]);}else{logger[_0x42d8('0xa')](_0x42d8('0x11'),_0x52c474,_0x42d8('0xb'));_0x44f0b5(_0x4db990[_0x42d8('0x12')][_0x42d8('0x10')]);}})[_0x42d8('0x13')](function(_0xd874af){logger[_0x42d8('0xe')]('ChatTransferReport,\x20%s,\x20%s',_0x52c474,_0xd874af);_0x27338f(_0xd874af);});});} \ No newline at end of file +var _0xc2fe=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xc2fe,0x149));var _0xec2f=function(_0x3f8261,_0x2a51ec){_0x3f8261=_0x3f8261-0x0;var _0x17a540=_0xc2fe[_0x3f8261];return _0x17a540;};'use strict';var _=require(_0xec2f('0x0'));var util=require(_0xec2f('0x1'));var moment=require('moment');var BPromise=require(_0xec2f('0x2'));var rs=require(_0xec2f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xec2f('0x4'))['db'];var utils=require(_0xec2f('0x5'));var logger=require(_0xec2f('0x6'))(_0xec2f('0x7'));var config=require(_0xec2f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xec2f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x353971,_0x3ec63b,_0x44b804){return new BPromise(function(_0x5150c1,_0x5e6e4c){return client[_0xec2f('0xa')](_0x353971,_0x44b804)[_0xec2f('0xb')](function(_0x53bfd9){logger['info'](_0xec2f('0xc'),_0x3ec63b,_0xec2f('0xd'));logger[_0xec2f('0xe')](_0xec2f('0xf'),_0x3ec63b,'request\x20sent',JSON[_0xec2f('0x10')](_0x53bfd9));if(_0x53bfd9[_0xec2f('0x11')]){if(_0x53bfd9[_0xec2f('0x11')]['code']===0x1f4){logger[_0xec2f('0x11')](_0xec2f('0xc'),_0x3ec63b,_0x53bfd9['error'][_0xec2f('0x12')]);return _0x5e6e4c(_0x53bfd9[_0xec2f('0x11')][_0xec2f('0x12')]);}logger[_0xec2f('0x11')](_0xec2f('0xc'),_0x3ec63b,_0x53bfd9[_0xec2f('0x11')][_0xec2f('0x12')]);return _0x5150c1(_0x53bfd9[_0xec2f('0x11')]['message']);}else{logger[_0xec2f('0x13')](_0xec2f('0xc'),_0x3ec63b,_0xec2f('0xd'));_0x5150c1(_0x53bfd9[_0xec2f('0x14')][_0xec2f('0x12')]);}})[_0xec2f('0x15')](function(_0x405839){logger[_0xec2f('0x11')](_0xec2f('0xc'),_0x3ec63b,_0x405839);_0x5e6e4c(_0x405839);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 08708a0..2097353 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 _0xa948=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','exports','multer','path','express','Router'];(function(_0x3c28c0,_0x1cb29d){var _0x12cc9f=function(_0x33d0f7){while(--_0x33d0f7){_0x3c28c0['push'](_0x3c28c0['shift']());}};_0x12cc9f(++_0x1cb29d);}(_0xa948,0x178));var _0x8a94=function(_0x4cd685,_0x472697){_0x4cd685=_0x4cd685-0x0;var _0x37743e=_0xa948[_0x4cd685];return _0x37743e;};'use strict';var multer=require(_0x8a94('0x0'));var util=require('util');var path=require(_0x8a94('0x1'));var timeout=require('connect-timeout');var express=require(_0x8a94('0x2'));var router=express[_0x8a94('0x3')]();var fs_extra=require(_0x8a94('0x4'));var auth=require(_0x8a94('0x5'));var interaction=require(_0x8a94('0x6'));var config=require(_0x8a94('0x7'));var controller=require('./chatTransferReport.controller');router[_0x8a94('0x8')]('/',auth[_0x8a94('0x9')](),controller[_0x8a94('0xa')]);router[_0x8a94('0x8')](_0x8a94('0xb'),auth[_0x8a94('0x9')](),controller['describe']);router[_0x8a94('0x8')](_0x8a94('0xc'),auth['isAuthenticated'](),controller[_0x8a94('0xd')]);router[_0x8a94('0xe')]('/',auth['isAuthenticated'](),controller[_0x8a94('0xf')]);router[_0x8a94('0x10')](_0x8a94('0xc'),auth[_0x8a94('0x9')](),controller[_0x8a94('0x11')]);router[_0x8a94('0x12')](_0x8a94('0xc'),auth[_0x8a94('0x9')](),controller['destroy']);module[_0x8a94('0x13')]=router; \ No newline at end of file +var _0x4daa=['show','post','put','/:id','update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','./chatTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x271e46,_0x2626ef){var _0x5951df=function(_0x4ce493){while(--_0x4ce493){_0x271e46['push'](_0x271e46['shift']());}};_0x5951df(++_0x2626ef);}(_0x4daa,0x14b));var _0xa4da=function(_0x213f3d,_0x31c31f){_0x213f3d=_0x213f3d-0x0;var _0x238251=_0x4daa[_0x213f3d];return _0x238251;};'use strict';var multer=require(_0xa4da('0x0'));var util=require('util');var path=require(_0xa4da('0x1'));var timeout=require(_0xa4da('0x2'));var express=require('express');var router=express[_0xa4da('0x3')]();var fs_extra=require(_0xa4da('0x4'));var auth=require(_0xa4da('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa4da('0x6'));router[_0xa4da('0x7')]('/',auth[_0xa4da('0x8')](),controller[_0xa4da('0x9')]);router[_0xa4da('0x7')](_0xa4da('0xa'),auth[_0xa4da('0x8')](),controller['describe']);router[_0xa4da('0x7')]('/:id',auth[_0xa4da('0x8')](),controller[_0xa4da('0xb')]);router[_0xa4da('0xc')]('/',auth[_0xa4da('0x8')](),controller['create']);router[_0xa4da('0xd')](_0xa4da('0xe'),auth[_0xa4da('0x8')](),controller[_0xa4da('0xf')]);router[_0xa4da('0x10')](_0xa4da('0xe'),auth[_0xa4da('0x8')](),controller['destroy']);module[_0xa4da('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 24c100f..3cf46eb 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 _0x9a93=['website_alias','bottom_right','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email','#011F6A','#ffffff','BOOLEAN','rounded','squared','Send','INTEGER','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','ENUM','star','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','Comments','Leave\x20your\x20comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x9a93,0x192));var _0x39a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a93[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x39a9('0x0'));var rs=require(_0x39a9('0x1'));module['exports']={'name':{'type':Sequelize[_0x39a9('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x39a9('0x2')],'allowNull':![],'unique':_0x39a9('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x39a9('0x2')],'defaultValue':_0x39a9('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize[_0x39a9('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x39a9('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x39a9('0x2')],'allowNull':![],'defaultValue':_0x39a9('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x39a9('0x2')],'allowNull':![],'defaultValue':_0x39a9('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x39a9('0x2')]},'animation':{'type':Sequelize[_0x39a9('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x39a9('0x8'),_0x39a9('0x9')),'defaultValue':_0x39a9('0x8')},'header_online':{'type':Sequelize[_0x39a9('0x2')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x39a9('0x2')],'defaultValue':_0x39a9('0xa')},'header_offline':{'type':Sequelize[_0x39a9('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x39a9('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x39a9('0xb')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x39a9('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x39a9('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x39a9('0xc')]},'closingQuestion':{'type':Sequelize[_0x39a9('0x2')],'defaultValue':_0x39a9('0xd')},'formSubmitSuccessMessage':{'type':Sequelize[_0x39a9('0x2')],'defaultValue':_0x39a9('0xe')},'formSubmitFailureMessage':{'type':Sequelize[_0x39a9('0x2')],'defaultValue':_0x39a9('0xf')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x39a9('0x10')},'placeholderMessage':{'type':Sequelize[_0x39a9('0x2')],'defaultValue':_0x39a9('0x11')},'closingMessage':{'type':Sequelize[_0x39a9('0x2')],'defaultValue':_0x39a9('0x12')},'closingMessageButton':{'type':Sequelize[_0x39a9('0x2')],'defaultValue':_0x39a9('0xa')},'skipMessageButton':{'type':Sequelize[_0x39a9('0x2')],'defaultValue':_0x39a9('0x13')},'conditionAgreement':{'type':Sequelize[_0x39a9('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x39a9('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x39a9('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x39a9('0x14')},'ratingType':{'type':Sequelize[_0x39a9('0x15')]('star','thumb'),'defaultValue':_0x39a9('0x16')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x39a9('0xc')],'defaultValue':function(){return JSON[_0x39a9('0x17')]({'items':[{'type':_0x39a9('0x18'),'variable':null,'config':{'placeholder':_0x39a9('0x19'),'type':_0x39a9('0x1a'),'required':!![]},'props':{'title':_0x39a9('0x19'),'helpText':''}},{'type':_0x39a9('0x18'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x39a9('0x4'),'type':_0x39a9('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x39a9('0x1b')](_0x39a9('0x1c'))?JSON[_0x39a9('0x1d')](this[_0x39a9('0x1b')](_0x39a9('0x1c'))):{};},'set':function(_0x4b31e5){return this[_0x39a9('0x1e')](_0x39a9('0x1c'),JSON['stringify'](_0x4b31e5));}},'offlineForm':{'type':Sequelize[_0x39a9('0xc')],'defaultValue':function(){return JSON[_0x39a9('0x17')]({'items':[{'type':_0x39a9('0x18'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x39a9('0x4'),'type':'email'},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':_0x39a9('0x1f'),'helpText':_0x39a9('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0x39a9('0x1b')]('offlineForm')?JSON['parse'](this[_0x39a9('0x1b')](_0x39a9('0x21'))):{};},'set':function(_0x570486){return this[_0x39a9('0x1e')]('offlineForm',JSON[_0x39a9('0x17')](_0x570486));}},'token':{'type':Sequelize[_0x39a9('0x2')],'defaultValue':function(){return rs[_0x39a9('0x22')]();}},'autoclose':{'type':Sequelize[_0x39a9('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x39a9('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x39a9('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x39a9('0x2')]},'forwardOffline':{'type':Sequelize[_0x39a9('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x39a9('0x2')]},'waitingTitle':{'type':Sequelize[_0x39a9('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x39a9('0x2')],'defaultValue':_0x39a9('0x23')},'offlineMessageSubject':{'type':Sequelize[_0x39a9('0x2')],'defaultValue':_0x39a9('0x24')},'offlineMessageBody':{'type':Sequelize[_0x39a9('0x2')],'defaultValue':_0x39a9('0x25')},'enableUnmanagedNote':{'type':Sequelize[_0x39a9('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x39a9('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x39a9('0x2')],'defaultValue':_0x39a9('0x13')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x39a9('0xa')},'enableCustomerAttachment':{'type':Sequelize[_0x39a9('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x39a9('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x39a9('0xc')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x39a9('0x2')]},'notificationTemplate':{'type':Sequelize[_0x39a9('0xc')],'defaultValue':function(){return _0x39a9('0x26');}},'notificationSound':{'type':Sequelize[_0x39a9('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x39a9('0x2')],'defaultValue':_0x39a9('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0x39a9('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x39a9('0x28')},'verticalAlignment':{'type':Sequelize[_0x39a9('0xb')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x39a9('0x29')},'defaultTitle':{'type':Sequelize[_0x39a9('0x2')]},'customerAvatar':{'type':Sequelize[_0x39a9('0xc')]},'showCustomerAvatar':{'type':Sequelize[_0x39a9('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x39a9('0xb')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x39a9('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x39a9('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x39a9('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x39a9('0x2a')},'systemAvatar':{'type':Sequelize[_0x39a9('0xc')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x39a9('0xb')],'comment':_0x39a9('0x2b')},'mandatoryDisposition':{'type':Sequelize[_0x39a9('0x7')],'defaultValue':![],'comment':_0x39a9('0x2c'),'set':function(_0x5be09a){if(!_0x5be09a)this[_0x39a9('0x1e')](_0x39a9('0x2d'),null);this[_0x39a9('0x1e')](_0x39a9('0x2e'),_0x5be09a);}},'vidaooEscalation':{'type':Sequelize[_0x39a9('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x39a9('0x2')]},'vidaooTopic':{'type':Sequelize[_0x39a9('0x2')],'allowNull':![],'defaultValue':_0x39a9('0x2f')},'vidaooNote':{'type':Sequelize[_0x39a9('0x2')],'defaultValue':function(){return _0x39a9('0x30');}},'vidaooMetadata':{'type':Sequelize[_0x39a9('0xc')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x39a9('0xc')]}}; \ No newline at end of file +var _0x5618=['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','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','ENUM','squared','rounded','We\x20are\x20here!','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','thumb','input','text','name','onlineForm','parse','setDataValue','stringify','textarea','Comments','getDataValue','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Skip','website_alias','bottom_right','alternate','#fafafa'];(function(_0x4975e3,_0xb81a29){var _0x2e8b32=function(_0x14fca6){while(--_0x14fca6){_0x4975e3['push'](_0x4975e3['shift']());}};_0x2e8b32(++_0xb81a29);}(_0x5618,0x143));var _0x8561=function(_0x968d62,_0x8ab40d){_0x968d62=_0x968d62-0x0;var _0x13ee25=_0x5618[_0x968d62];return _0x13ee25;};'use strict';var Sequelize=require(_0x8561('0x0'));var rs=require('randomstring');module[_0x8561('0x1')]={'name':{'type':Sequelize[_0x8561('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x8561('0x2')],'allowNull':![],'unique':_0x8561('0x3')},'description':{'type':Sequelize[_0x8561('0x2')]},'mapKey':{'type':Sequelize[_0x8561('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x8561('0x2')],'defaultValue':_0x8561('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x8561('0x2')],'defaultValue':_0x8561('0x5')},'customerAlias':{'type':Sequelize[_0x8561('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x8561('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8561('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x8561('0x2')],'allowNull':![],'defaultValue':_0x8561('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x8561('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x8561('0x9')]('rounded',_0x8561('0xa')),'defaultValue':_0x8561('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x8561('0xc')},'start_chat_button':{'type':Sequelize[_0x8561('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x8561('0xd')},'header_offline':{'type':Sequelize[_0x8561('0x2')],'defaultValue':_0x8561('0xe')},'download_transcript':{'type':Sequelize[_0x8561('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x8561('0xf')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x8561('0x2')],'defaultValue':_0x8561('0x10')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x8561('0x11')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x8561('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x8561('0x2')],'defaultValue':_0x8561('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0x8561('0x2')],'defaultValue':_0x8561('0x14')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x8561('0x15')},'placeholderMessage':{'type':Sequelize[_0x8561('0x2')],'defaultValue':_0x8561('0x16')},'closingMessage':{'type':Sequelize[_0x8561('0x2')],'defaultValue':_0x8561('0x17')},'closingMessageButton':{'type':Sequelize[_0x8561('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x8561('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x8561('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x8561('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x8561('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x8561('0x2')],'defaultValue':_0x8561('0x18')},'ratingType':{'type':Sequelize['ENUM'](_0x8561('0x19'),_0x8561('0x1a')),'defaultValue':_0x8561('0x19')},'ratingStarsNumber':{'type':Sequelize[_0x8561('0xf')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x8561('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x8561('0x1b'),'variable':null,'config':{'placeholder':'name','type':_0x8561('0x1c'),'required':!![]},'props':{'title':_0x8561('0x1d'),'helpText':''}},{'type':'input','props':{'title':_0x8561('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x8561('0x4'),'type':_0x8561('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x8561('0x1e'))?JSON[_0x8561('0x1f')](this['getDataValue'](_0x8561('0x1e'))):{};},'set':function(_0x6a4e03){return this[_0x8561('0x20')](_0x8561('0x1e'),JSON[_0x8561('0x21')](_0x6a4e03));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x8561('0x21')]({'items':[{'type':_0x8561('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x8561('0x4'),'type':'email'},'variable':null},{'type':_0x8561('0x22'),'config':{'placeholder':_0x8561('0x23')},'props':{'title':_0x8561('0x23'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x8561('0x24')](_0x8561('0x25'))?JSON[_0x8561('0x1f')](this[_0x8561('0x24')]('offlineForm')):{};},'set':function(_0x190986){return this[_0x8561('0x20')]('offlineForm',JSON[_0x8561('0x21')](_0x190986));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x8561('0x26')]();}},'autoclose':{'type':Sequelize[_0x8561('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x8561('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x8561('0x2')]},'forwardOffline':{'type':Sequelize[_0x8561('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x8561('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x8561('0x27')},'waitingMessage':{'type':Sequelize[_0x8561('0x2')],'defaultValue':_0x8561('0x28')},'offlineMessageSubject':{'type':Sequelize[_0x8561('0x2')],'defaultValue':_0x8561('0x29')},'offlineMessageBody':{'type':Sequelize[_0x8561('0x2')],'defaultValue':_0x8561('0x2a')},'enableUnmanagedNote':{'type':Sequelize[_0x8561('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x8561('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x8561('0x2')],'defaultValue':_0x8561('0x2b')},'sendUnmanaged':{'type':Sequelize[_0x8561('0x2')],'defaultValue':_0x8561('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x8561('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x8561('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x8561('0x2')]},'notificationTemplate':{'type':Sequelize[_0x8561('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x8561('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8561('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x8561('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x8561('0x2')],'defaultValue':_0x8561('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize[_0x8561('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x8561('0x2d')},'verticalAlignment':{'type':Sequelize[_0x8561('0xf')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x8561('0x2')],'defaultValue':_0x8561('0x2e')},'defaultTitle':{'type':Sequelize[_0x8561('0x2')]},'customerAvatar':{'type':Sequelize[_0x8561('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x8561('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x8561('0xf')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x8561('0x2')],'allowNull':![],'defaultValue':_0x8561('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x8561('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8561('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x8561('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x8561('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x8561('0x30')},'mandatoryDisposition':{'type':Sequelize[_0x8561('0x8')],'defaultValue':![],'comment':_0x8561('0x31'),'set':function(_0x58d7a0){if(!_0x58d7a0)this[_0x8561('0x20')](_0x8561('0x32'),null);this['setDataValue']('mandatoryDisposition',_0x58d7a0);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x8561('0x2')]},'vidaooTopic':{'type':Sequelize[_0x8561('0x2')],'allowNull':![],'defaultValue':_0x8561('0x33')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x8561('0x34');}},'vidaooMetadata':{'type':Sequelize[_0x8561('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x8561('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x8561('0x11')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 05328df..3e9834a 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 _0x309b=['headers','user-agent','getResult','chat','ValidationError','no\x20available\x20attributes','updatedAt','difference','CompanyId','ListId','from','from\x20is\x20mandatory','Sequelize','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','CmContact','Contacts','DESC','ChatApplication','Applications','List','applications','list','orderBy','asc','account','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','x-real-port','browser','%s\x20%s','version','unknown','format','device','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','externalUrl','interaction','lastName','messageId','autoclose','push','close','*,*,*,*','ChatMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','EventManager','offline','files','createdAt','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','toPairs','ChatOfflineMessage','originalname','attachments','offline-chat','transaction','Attachment','bulkCreate','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','openNewInteraction','MailAccountId','mimetype','subjectOffline','toPairsIn','mapValues','firstName','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','server','Could\x20not\x20remove\x20attachment\x20file','addInteraction','Contact','fullname','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','iftime\x20%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','increment','all','server/files/chat/iframe.ejs','x-real-ip','connection','referer','replace','render','alignment','verticalAlignment','color_button','backgroundColor','addApplications','sequelize','Transaction','READ_COMMITTED','findAndCountAll','priority','finally','json','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','offlineForm','onlineForm','items','getOfflineMessages','Attachments','addAgents','omit','emit','userChatWebsite:save','removeAgents','isArray','getAgents','bluebird','util','path','ejs','fs-extra','ioredis','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./chatWebsite.socket','http','client','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','offset','undefined','count','limit','set','update','destroy','get','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','ChatWebsite','includeAll','include','findAll','rows','catch','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','getDispositions','findOne','Disposition','nolimit','ChatWebsiteId','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addLogo','sitepic','addAvatar','agentAvatar','file','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','../../config/license/util','getLicense','custom','isNil','join','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x309b,0x1c9));var _0xb309=function(_0x435e1c,_0x148724){_0x435e1c=_0x435e1c-0x0;var _0x551fe6=_0x309b[_0x435e1c];return _0x551fe6;};'use strict';var BPromise=require(_0xb309('0x0'));var Mustache=require('mustache');var util=require(_0xb309('0x1'));var path=require(_0xb309('0x2'));var ejs=require(_0xb309('0x3'));var fs=require('fs');var fs_extra=require(_0xb309('0x4'));var _=require('lodash');var querystring=require('querystring');var Redis=require(_0xb309('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0xb309('0x6'))(_0xb309('0x7'));var config=require(_0xb309('0x8'));var db=require('../../mysqldb')['db'];config[_0xb309('0x9')]=_[_0xb309('0xa')](config[_0xb309('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xb309('0xb'))(new Redis(config[_0xb309('0x9')]));require(_0xb309('0xc'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xb309('0xd')]({'port':0x232c});var client9002=jayson[_0xb309('0xe')][_0xb309('0xd')]({'port':0x232a});var client9003=jayson['client'][_0xb309('0xd')]({'port':0x232b});var client9001=jayson[_0xb309('0xe')][_0xb309('0xd')]({'port':0x2329});function respondWithRpcPromise(_0x41c7bb,_0x5f4be4,_0x46490e,_0x19cb3c){return new BPromise(function(_0x380b6f,_0x39e47c){var _0x2deba5=_0x19cb3c||client;return _0x2deba5[_0xb309('0xf')](_0x41c7bb,_0x46490e)[_0xb309('0x10')](function(_0x42abfb){logger[_0xb309('0x11')](_0xb309('0x12'),_0x5f4be4,_0xb309('0x13'));logger[_0xb309('0x14')](_0xb309('0x15'),_0x5f4be4,_0xb309('0x13'),JSON[_0xb309('0x16')](_0x42abfb));if(_0x42abfb[_0xb309('0x17')]){if(_0x42abfb[_0xb309('0x17')][_0xb309('0x18')]===0x1f4){logger[_0xb309('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x5f4be4,_0x42abfb[_0xb309('0x17')]['message']);return _0x39e47c(_0x42abfb['error']['message']);}logger[_0xb309('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x5f4be4,_0x42abfb[_0xb309('0x17')][_0xb309('0x19')]);return _0x380b6f(_0x42abfb['error']['message']);}else{logger[_0xb309('0x11')](_0xb309('0x12'),_0x5f4be4,_0xb309('0x13'));_0x380b6f(_0x42abfb[_0xb309('0x1a')][_0xb309('0x19')]);}})['catch'](function(_0x363f27){logger[_0xb309('0x17')](_0xb309('0x12'),_0x5f4be4,_0x363f27);_0x39e47c(_0x363f27);});});}function respondWithStatusCode(_0x17f83a,_0x203117){_0x203117=_0x203117||0xcc;return function(_0x3652cf){if(_0x3652cf){return _0x17f83a[_0xb309('0x1b')](_0x203117);}return _0x17f83a[_0xb309('0x1c')](_0x203117)[_0xb309('0x1d')]();};}function respondWithResult(_0x546597,_0x54e880){_0x54e880=_0x54e880||0xc8;return function(_0x3e032e){if(_0x3e032e){return _0x546597[_0xb309('0x1c')](_0x54e880)['json'](_0x3e032e);}};}function respondWithFilteredResult(_0x4df740,_0x509ec3){return function(_0x3b2005){if(_0x3b2005){var _0xc7a7af=typeof _0x509ec3[_0xb309('0x1e')]===_0xb309('0x1f')&&typeof _0x509ec3['limit']===_0xb309('0x1f');var _0x49574a=_0x3b2005[_0xb309('0x20')];var _0xf71cd9=_0xc7a7af?0x0:_0x509ec3['offset'];var _0x3784f4=_0xc7a7af?_0x3b2005[_0xb309('0x20')]:_0x509ec3['offset']+_0x509ec3[_0xb309('0x21')];var _0x1870eb;if(_0x3784f4>=_0x49574a){_0x3784f4=_0x49574a;_0x1870eb=0xc8;}else{_0x1870eb=0xce;}_0x4df740['status'](_0x1870eb);return _0x4df740[_0xb309('0x22')]('Content-Range',_0xf71cd9+'-'+_0x3784f4+'/'+_0x49574a)['json'](_0x3b2005);}return null;};}function saveUpdates(_0x26fdcf){return function(_0x544fb5){if(_0x544fb5){return _0x544fb5[_0xb309('0x23')](_0x26fdcf)['then'](function(_0x5dd946){return _0x5dd946;});}return null;};}function removeEntity(_0x340b28){return function(_0x5b46eb){if(_0x5b46eb){return _0x5b46eb[_0xb309('0x24')]()['then'](function(){var _0xdbdff8=_0x5b46eb[_0xb309('0x25')]({'plain':!![]});var _0x527b17='ChatWebsites';return db[_0xb309('0x26')][_0xb309('0x24')]({'where':{'type':_0x527b17,'resourceId':_0xdbdff8['id']}})[_0xb309('0x10')](function(){return _0x5b46eb;});})[_0xb309('0x10')](function(){_0x340b28[_0xb309('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3da124){return function(_0x30c0f9){if(!_0x30c0f9){_0x3da124[_0xb309('0x1b')](0x194);}return _0x30c0f9;};}function handleError(_0x29000d,_0x2c85c2){_0x2c85c2=_0x2c85c2||0x1f4;return function(_0x411ab4){logger[_0xb309('0x17')](_0x411ab4[_0xb309('0x27')]);if(_0x411ab4[_0xb309('0x28')]){delete _0x411ab4[_0xb309('0x28')];}_0x29000d[_0xb309('0x1c')](_0x2c85c2)[_0xb309('0x29')](_0x411ab4);};}exports['index']=function(_0x4a91c4,_0x2f62ee){var _0x461a9c={'include':[{'model':db[_0xb309('0x2a')],'as':_0xb309('0x2b')}]},_0x2162c2={},_0x516e8b={'count':0x0,'rows':[]};var _0x3cbeeb=_[_0xb309('0x2c')](db['ChatWebsite'][_0xb309('0x2d')],function(_0x233873){return{'name':_0x233873['fieldName'],'type':_0x233873['type'][_0xb309('0x2e')]};});_0x2162c2[_0xb309('0x2f')]=_['map'](_0x3cbeeb,_0xb309('0x28'));_0x2162c2['query']=_[_0xb309('0x30')](_0x4a91c4[_0xb309('0x31')]);_0x2162c2[_0xb309('0x32')]=_[_0xb309('0x33')](_0x2162c2[_0xb309('0x2f')],_0x2162c2[_0xb309('0x31')]);_0x461a9c[_0xb309('0x34')]=_[_0xb309('0x33')](_0x2162c2['model'],qs[_0xb309('0x35')](_0x4a91c4[_0xb309('0x31')][_0xb309('0x35')]));_0x461a9c[_0xb309('0x34')]=_0x461a9c[_0xb309('0x34')][_0xb309('0x36')]?_0x461a9c['attributes']:_0x2162c2['model'];if(!_0x4a91c4[_0xb309('0x31')][_0xb309('0x37')]('nolimit')){_0x461a9c[_0xb309('0x21')]=qs[_0xb309('0x21')](_0x4a91c4[_0xb309('0x31')][_0xb309('0x21')]);_0x461a9c['offset']=qs[_0xb309('0x1e')](_0x4a91c4[_0xb309('0x31')][_0xb309('0x1e')]);}_0x461a9c[_0xb309('0x38')]=qs[_0xb309('0x39')](_0x4a91c4['query']['sort']);_0x461a9c[_0xb309('0x3a')]=qs['filters'](_[_0xb309('0x3b')](_0x4a91c4[_0xb309('0x31')],_0x2162c2[_0xb309('0x32')]),_0x3cbeeb);if(_0x4a91c4[_0xb309('0x31')][_0xb309('0x3c')]){_0x461a9c['where']=_[_0xb309('0x3d')](_0x461a9c[_0xb309('0x3a')],{'$or':_[_0xb309('0x2c')](_0x3cbeeb,function(_0x539c61){if(_0x539c61[_0xb309('0x3e')]!==_0xb309('0x3f')){var _0x51f77c={};_0x51f77c[_0x539c61[_0xb309('0x28')]]={'$like':'%'+_0x4a91c4['query']['filter']+'%'};return _0x51f77c;}})});}_0x461a9c=_[_0xb309('0x3d')]({},_0x461a9c,_0x4a91c4[_0xb309('0x40')]);var _0x59d545={'where':_0x461a9c['where']};return db[_0xb309('0x41')][_0xb309('0x20')](_0x59d545)[_0xb309('0x10')](function(_0x2b71e9){_0x516e8b[_0xb309('0x20')]=_0x2b71e9;if(_0x4a91c4['query'][_0xb309('0x42')]){_0x461a9c[_0xb309('0x43')]=[{'all':!![]}];}return db[_0xb309('0x41')][_0xb309('0x44')](_0x461a9c);})['then'](function(_0x16142c){_0x516e8b[_0xb309('0x45')]=_0x16142c;return _0x516e8b;})[_0xb309('0x10')](respondWithFilteredResult(_0x2f62ee,_0x461a9c))[_0xb309('0x46')](handleError(_0x2f62ee,null));};exports['show']=function(_0x43bdec,_0x1b33d8){var _0x27a0bc={'raw':![],'where':{'id':_0x43bdec[_0xb309('0x47')]['id']},'include':[{'model':db[_0xb309('0x2a')],'as':'mandatoryDispositionPause'}]},_0x525e76={};_0x525e76[_0xb309('0x2f')]=_[_0xb309('0x30')](db[_0xb309('0x41')][_0xb309('0x2d')]);_0x525e76[_0xb309('0x31')]=_['keys'](_0x43bdec['query']);_0x525e76[_0xb309('0x32')]=_['intersection'](_0x525e76[_0xb309('0x2f')],_0x525e76[_0xb309('0x31')]);_0x27a0bc['attributes']=_['intersection'](_0x525e76[_0xb309('0x2f')],qs[_0xb309('0x35')](_0x43bdec[_0xb309('0x31')][_0xb309('0x35')]));_0x27a0bc[_0xb309('0x34')]=_0x27a0bc[_0xb309('0x34')][_0xb309('0x36')]?_0x27a0bc[_0xb309('0x34')]:_0x525e76[_0xb309('0x2f')];if(_0x43bdec[_0xb309('0x31')]['includeAll']){_0x27a0bc[_0xb309('0x43')]=[{'all':!![]}];}_0x27a0bc=_[_0xb309('0x3d')]({},_0x27a0bc,_0x43bdec[_0xb309('0x40')]);return db[_0xb309('0x41')][_0xb309('0x48')](_0x27a0bc)['then'](handleEntityNotFound(_0x1b33d8,null))[_0xb309('0x10')](respondWithResult(_0x1b33d8,null))[_0xb309('0x46')](handleError(_0x1b33d8,null));};exports[_0xb309('0x49')]=function(_0x2c95d0,_0x58f254){return db[_0xb309('0x41')][_0xb309('0x49')](_0x2c95d0['body'],{})[_0xb309('0x10')](function(_0xeae350){var _0x476ffe=_0x2c95d0[_0xb309('0x4a')][_0xb309('0x25')]({'plain':!![]});if(!_0x476ffe)throw new Error(_0xb309('0x4b'));if(_0x476ffe[_0xb309('0x4c')]===_0xb309('0x4a')){var _0x39731e=_0xeae350[_0xb309('0x25')]({'plain':!![]});var _0x108771=_0xb309('0x4d');return db[_0xb309('0x4e')][_0xb309('0x48')]({'where':{'name':_0x108771,'userProfileId':_0x476ffe['userProfileId']},'raw':!![]})[_0xb309('0x10')](function(_0x7704c9){if(_0x7704c9&&_0x7704c9[_0xb309('0x4f')]===0x0){return db[_0xb309('0x26')][_0xb309('0x49')]({'name':_0x39731e[_0xb309('0x28')],'resourceId':_0x39731e['id'],'type':_0x7704c9[_0xb309('0x28')],'sectionId':_0x7704c9['id']},{})[_0xb309('0x10')](function(){return _0xeae350;});}else{return _0xeae350;}})[_0xb309('0x46')](function(_0x87a542){logger[_0xb309('0x17')](_0xb309('0x50'),_0x87a542);throw _0x87a542;});}return _0xeae350;})['then'](respondWithResult(_0x58f254,0xc9))[_0xb309('0x46')](handleError(_0x58f254,null));};exports[_0xb309('0x23')]=function(_0x4367c4,_0x45fbb4){if(_0x4367c4[_0xb309('0x51')]['id']){delete _0x4367c4[_0xb309('0x51')]['id'];}return db[_0xb309('0x41')][_0xb309('0x48')]({'where':{'id':_0x4367c4[_0xb309('0x47')]['id']},'include':[{'model':db[_0xb309('0x2a')],'as':_0xb309('0x2b')}]})[_0xb309('0x10')](handleEntityNotFound(_0x45fbb4,null))[_0xb309('0x10')](saveUpdates(_0x4367c4[_0xb309('0x51')],null))[_0xb309('0x10')](respondWithResult(_0x45fbb4,null))[_0xb309('0x46')](handleError(_0x45fbb4,null));};exports['destroy']=function(_0x290712,_0x27d19f){return db[_0xb309('0x41')][_0xb309('0x48')]({'where':{'id':_0x290712[_0xb309('0x47')]['id']}})[_0xb309('0x10')](handleEntityNotFound(_0x27d19f,null))[_0xb309('0x10')](removeEntity(_0x27d19f,null))[_0xb309('0x46')](handleError(_0x27d19f,null));};exports[_0xb309('0x52')]=function(_0x255992,_0x209676){return db[_0xb309('0x41')]['describe']()[_0xb309('0x10')](respondWithResult(_0x209676,null))[_0xb309('0x46')](handleError(_0x209676,null));};exports[_0xb309('0x53')]=function(_0x29c8d1,_0x1165b8){if(_0x29c8d1[_0xb309('0x51')]['id']){delete _0x29c8d1['body']['id'];}return db[_0xb309('0x41')][_0xb309('0x48')]({'where':{'id':_0x29c8d1[_0xb309('0x47')]['id']}})[_0xb309('0x10')](handleEntityNotFound(_0x1165b8,null))['then'](function(_0xc91413){if(_0xc91413){_0x29c8d1[_0xb309('0x51')]['ChatWebsiteId']=_0xc91413['id'];return db['Disposition'][_0xb309('0x49')](_0x29c8d1['body']);}})[_0xb309('0x10')](respondWithResult(_0x1165b8,null))[_0xb309('0x46')](handleError(_0x1165b8,null));};exports[_0xb309('0x54')]=function(_0x5d30eb,_0x45e14f){var _0x20ae26={'raw':![],'where':{}};var _0x3a30eb={};var _0x10c6c4={'count':0x0,'rows':[]};return db[_0xb309('0x41')][_0xb309('0x55')]({'where':{'id':_0x5d30eb['params']['id']}})['then'](handleEntityNotFound(_0x45e14f,null))[_0xb309('0x10')](function(_0x328dcd){if(_0x328dcd){_0x3a30eb[_0xb309('0x2f')]=_[_0xb309('0x30')](db[_0xb309('0x56')][_0xb309('0x2d')]);_0x3a30eb['query']=_['keys'](_0x5d30eb[_0xb309('0x31')]);_0x3a30eb[_0xb309('0x32')]=_[_0xb309('0x33')](_0x3a30eb[_0xb309('0x2f')],_0x3a30eb['query']);_0x20ae26[_0xb309('0x34')]=_['intersection'](_0x3a30eb[_0xb309('0x2f')],qs[_0xb309('0x35')](_0x5d30eb[_0xb309('0x31')][_0xb309('0x35')]));_0x20ae26[_0xb309('0x34')]=_0x20ae26[_0xb309('0x34')][_0xb309('0x36')]?_0x20ae26[_0xb309('0x34')]:_0x3a30eb['model'];if(!_0x5d30eb[_0xb309('0x31')]['hasOwnProperty'](_0xb309('0x57'))){_0x20ae26[_0xb309('0x21')]=qs[_0xb309('0x21')](_0x5d30eb[_0xb309('0x31')][_0xb309('0x21')]);_0x20ae26[_0xb309('0x1e')]=qs[_0xb309('0x1e')](_0x5d30eb[_0xb309('0x31')][_0xb309('0x1e')]);}_0x20ae26[_0xb309('0x38')]=qs['sort'](_0x5d30eb[_0xb309('0x31')]['sort']);_0x20ae26[_0xb309('0x3a')]=qs[_0xb309('0x32')](_['pick'](_0x5d30eb[_0xb309('0x31')],_0x3a30eb[_0xb309('0x32')]));_0x20ae26[_0xb309('0x3a')][_0xb309('0x58')]=_0x328dcd['id'];if(_0x5d30eb['query'][_0xb309('0x3c')]){_0x20ae26[_0xb309('0x3a')]=_[_0xb309('0x3d')](_0x20ae26[_0xb309('0x3a')],{'$or':_[_0xb309('0x2c')](_0x20ae26[_0xb309('0x34')],function(_0xcf72aa){var _0x5295c3={};_0x5295c3[_0xcf72aa]={'$like':'%'+_0x5d30eb[_0xb309('0x31')]['filter']+'%'};return _0x5295c3;})});}_0x20ae26=_['merge']({},_0x20ae26,_0x5d30eb[_0xb309('0x40')]);return db[_0xb309('0x56')]['count']({'where':_0x20ae26[_0xb309('0x3a')]})[_0xb309('0x10')](function(_0x14681e){_0x10c6c4['count']=_0x14681e;if(_0x5d30eb[_0xb309('0x31')][_0xb309('0x42')]){_0x20ae26[_0xb309('0x43')]=[{'all':!![]}];}return db[_0xb309('0x56')][_0xb309('0x44')](_0x20ae26);})[_0xb309('0x10')](function(_0x19e40f){_0x10c6c4[_0xb309('0x45')]=_0x19e40f;return _0x10c6c4;});}})[_0xb309('0x10')](respondWithFilteredResult(_0x45e14f,_0x20ae26))['catch'](handleError(_0x45e14f,null));};exports[_0xb309('0x59')]=function(_0x5176f0,_0x351a1a){return db[_0xb309('0x41')][_0xb309('0x48')]({'where':{'id':_0x5176f0['params']['id']}})['then'](handleEntityNotFound(_0x351a1a,null))[_0xb309('0x10')](function(_0x524850){if(_0x524850){return _0x524850[_0xb309('0x59')](_0x5176f0[_0xb309('0x31')]['ids']);}})[_0xb309('0x10')](respondWithStatusCode(_0x351a1a,null))[_0xb309('0x46')](handleError(_0x351a1a,null));};exports[_0xb309('0x5a')]=function(_0x5705a4,_0x13c66e){if(_0x5705a4[_0xb309('0x51')]['id']){delete _0x5705a4[_0xb309('0x51')]['id'];}return db[_0xb309('0x41')][_0xb309('0x48')]({'where':{'id':_0x5705a4[_0xb309('0x47')]['id']}})[_0xb309('0x10')](handleEntityNotFound(_0x13c66e,null))[_0xb309('0x10')](function(_0x1eaddc){if(_0x1eaddc){_0x5705a4['body']['ChatWebsiteId']=_0x1eaddc['id'];return db[_0xb309('0x5b')]['create'](_0x5705a4[_0xb309('0x51')]);}})['then'](respondWithResult(_0x13c66e,null))[_0xb309('0x46')](handleError(_0x13c66e,null));};exports[_0xb309('0x5c')]=function(_0x551f58,_0x3522eb){var _0xfd9ef0={'raw':![],'where':{}};var _0x2bbdb5={};var _0x558858={'count':0x0,'rows':[]};return db[_0xb309('0x41')]['findOne']({'where':{'id':_0x551f58['params']['id']}})[_0xb309('0x10')](handleEntityNotFound(_0x3522eb,null))[_0xb309('0x10')](function(_0x52f3b2){if(_0x52f3b2){_0x2bbdb5[_0xb309('0x2f')]=_[_0xb309('0x30')](db[_0xb309('0x5b')]['rawAttributes']);_0x2bbdb5['query']=_[_0xb309('0x30')](_0x551f58[_0xb309('0x31')]);_0x2bbdb5[_0xb309('0x32')]=_['intersection'](_0x2bbdb5[_0xb309('0x2f')],_0x2bbdb5[_0xb309('0x31')]);_0xfd9ef0[_0xb309('0x34')]=_[_0xb309('0x33')](_0x2bbdb5[_0xb309('0x2f')],qs['fields'](_0x551f58['query'][_0xb309('0x35')]));_0xfd9ef0[_0xb309('0x34')]=_0xfd9ef0['attributes'][_0xb309('0x36')]?_0xfd9ef0[_0xb309('0x34')]:_0x2bbdb5[_0xb309('0x2f')];if(!_0x551f58[_0xb309('0x31')][_0xb309('0x37')](_0xb309('0x57'))){_0xfd9ef0[_0xb309('0x21')]=qs[_0xb309('0x21')](_0x551f58['query'][_0xb309('0x21')]);_0xfd9ef0[_0xb309('0x1e')]=qs[_0xb309('0x1e')](_0x551f58[_0xb309('0x31')]['offset']);}_0xfd9ef0[_0xb309('0x38')]=qs[_0xb309('0x39')](_0x551f58[_0xb309('0x31')][_0xb309('0x39')]);_0xfd9ef0['where']=qs['filters'](_['pick'](_0x551f58[_0xb309('0x31')],_0x2bbdb5['filters']));_0xfd9ef0[_0xb309('0x3a')][_0xb309('0x58')]=_0x52f3b2['id'];if(_0x551f58[_0xb309('0x31')][_0xb309('0x3c')]){_0xfd9ef0[_0xb309('0x3a')]=_[_0xb309('0x3d')](_0xfd9ef0[_0xb309('0x3a')],{'$or':_[_0xb309('0x2c')](_0xfd9ef0['attributes'],function(_0x5ee290){var _0x2739de={};_0x2739de[_0x5ee290]={'$like':'%'+_0x551f58[_0xb309('0x31')][_0xb309('0x3c')]+'%'};return _0x2739de;})});}_0xfd9ef0=_[_0xb309('0x3d')]({},_0xfd9ef0,_0x551f58[_0xb309('0x40')]);return db[_0xb309('0x5b')]['count']({'where':_0xfd9ef0[_0xb309('0x3a')]})[_0xb309('0x10')](function(_0x1e4d95){_0x558858[_0xb309('0x20')]=_0x1e4d95;if(_0x551f58[_0xb309('0x31')][_0xb309('0x42')]){_0xfd9ef0[_0xb309('0x43')]=[{'all':!![]}];}return db['CannedAnswer'][_0xb309('0x44')](_0xfd9ef0);})[_0xb309('0x10')](function(_0x49d406){_0x558858[_0xb309('0x45')]=_0x49d406;return _0x558858;});}})[_0xb309('0x10')](respondWithFilteredResult(_0x3522eb,_0xfd9ef0))[_0xb309('0x46')](handleError(_0x3522eb,null));};exports[_0xb309('0x5d')]=function(_0x53e5b5,_0x568d60){return db[_0xb309('0x41')][_0xb309('0x48')]({'where':{'id':_0x53e5b5[_0xb309('0x47')]['id']}})[_0xb309('0x10')](handleEntityNotFound(_0x568d60,null))[_0xb309('0x10')](function(_0x25a025){if(_0x25a025){return _0x25a025[_0xb309('0x5d')](_0x53e5b5['query'][_0xb309('0x5e')]);}})[_0xb309('0x10')](respondWithStatusCode(_0x568d60,null))[_0xb309('0x46')](handleError(_0x568d60,null));};exports[_0xb309('0x5f')]=function(_0x29a2fa,_0x3bcff0){_0x29a2fa[_0xb309('0x51')][_0xb309('0x60')]=_0x29a2fa['file']['filename'];return db['ChatWebsite'][_0xb309('0x48')]({'where':{'id':_0x29a2fa[_0xb309('0x47')]['id']}})[_0xb309('0x10')](handleEntityNotFound(_0x3bcff0,null))['then'](saveUpdates(_0x29a2fa['body'],null))[_0xb309('0x10')](respondWithResult(_0x3bcff0,null))[_0xb309('0x46')](handleError(_0x3bcff0,null));};exports[_0xb309('0x61')]=function(_0x1ce0ab,_0x3b81d8){_0x1ce0ab['body'][_0xb309('0x62')]=_0x1ce0ab[_0xb309('0x63')][_0xb309('0x64')];return db[_0xb309('0x41')][_0xb309('0x48')]({'where':{'id':_0x1ce0ab[_0xb309('0x47')]['id']}})['then'](handleEntityNotFound(_0x3b81d8,null))[_0xb309('0x10')](saveUpdates(_0x1ce0ab[_0xb309('0x51')],null))['then'](respondWithResult(_0x3b81d8,null))[_0xb309('0x46')](handleError(_0x3b81d8,null));};exports[_0xb309('0x65')]=function(_0x3db0a4,_0x3f94ed){_0x3db0a4[_0xb309('0x51')][_0xb309('0x66')]=_0x3db0a4['file'][_0xb309('0x64')];return db[_0xb309('0x41')][_0xb309('0x48')]({'where':{'id':_0x3db0a4['params']['id']}})[_0xb309('0x10')](handleEntityNotFound(_0x3f94ed,null))['then'](saveUpdates(_0x3db0a4[_0xb309('0x51')],null))[_0xb309('0x10')](respondWithResult(_0x3f94ed,null))[_0xb309('0x46')](handleError(_0x3f94ed,null));};exports[_0xb309('0x67')]=function(_0x19bbf6,_0xd37669){_0x19bbf6['body'][_0xb309('0x68')]=_0x19bbf6[_0xb309('0x63')][_0xb309('0x64')];return db[_0xb309('0x41')][_0xb309('0x48')]({'where':{'id':_0x19bbf6[_0xb309('0x47')]['id']}})['then'](handleEntityNotFound(_0xd37669,null))[_0xb309('0x10')](saveUpdates(_0x19bbf6[_0xb309('0x51')],null))[_0xb309('0x10')](respondWithResult(_0xd37669,null))['catch'](handleError(_0xd37669,null));};exports[_0xb309('0x69')]=function(_0x40585d,_0x854523){var _0x26bdb0=path['join'](config[_0xb309('0x6a')],'server/files/images/logos/default_logo.svg');var _0x301b73={'where':{'id':_0x40585d['params']['id']},'attributes':['id',_0xb309('0x60')],'raw':!![]};var _0x50784a=![];return require(_0xb309('0x6b'))[_0xb309('0x6c')]()[_0xb309('0x10')](function(_0xfdbcfe){if(_0xfdbcfe){_0x50784a=_0xfdbcfe[_0xb309('0x6d')];}})[_0xb309('0x10')](function(){return db['ChatWebsite']['find'](_0x301b73);})[_0xb309('0x10')](handleEntityNotFound(_0x854523,null))['then'](function(_0x3322ac){if(_0x3322ac){if(!_[_0xb309('0x6e')](_0x3322ac[_0xb309('0x60')])){if(fs['existsSync'](path[_0xb309('0x6f')](config['root'],_0xb309('0x70'),_0x3322ac[_0xb309('0x60')]))&&_0x50784a){_0x26bdb0=path[_0xb309('0x6f')](config['root'],_0xb309('0x70'),_0x3322ac[_0xb309('0x60')]);}}return _0x854523[_0xb309('0x71')](_0x26bdb0);}})['catch'](handleError(_0x854523,null));};exports['getAvatar']=function(_0x3123aa,_0x2300da){var _0x2254fb=path[_0xb309('0x6f')](config[_0xb309('0x6a')],_0xb309('0x72'));var _0x40c170={'where':{'id':_0x3123aa['params']['id']},'attributes':['id',_0xb309('0x62')],'raw':!![]};return db['ChatWebsite'][_0xb309('0x48')](_0x40c170)[_0xb309('0x10')](handleEntityNotFound(_0x2300da,null))[_0xb309('0x10')](function(_0x37c48f){if(_0x37c48f){if(!_['isNil'](_0x37c48f[_0xb309('0x62')])){if(fs[_0xb309('0x73')](path['join'](config[_0xb309('0x6a')],_0xb309('0x74'),_0x37c48f[_0xb309('0x62')]))){_0x2254fb=path[_0xb309('0x6f')](config[_0xb309('0x6a')],'server/files/images/avatars/',_0x37c48f[_0xb309('0x62')]);}}return _0x2300da[_0xb309('0x71')](_0x2254fb);}})[_0xb309('0x46')](handleError(_0x2300da,null));};exports[_0xb309('0x75')]=function(_0x585665,_0x374005){var _0xea384c=path[_0xb309('0x6f')](config[_0xb309('0x6a')],_0xb309('0x76'));var _0x599bdf={'where':{'id':_0x585665[_0xb309('0x47')]['id']},'attributes':['id',_0xb309('0x66'),_0xb309('0x77')],'raw':!![]};return db[_0xb309('0x41')][_0xb309('0x48')](_0x599bdf)[_0xb309('0x10')](handleEntityNotFound(_0x374005,null))[_0xb309('0x10')](function(_0x400687){if(_0x400687){if(!_['isNil'](_0x400687['customerAvatar'])){if(fs[_0xb309('0x73')](path['join'](config[_0xb309('0x6a')],_0xb309('0x74'),_0x400687[_0xb309('0x66')]))&&_0x400687[_0xb309('0x77')]){_0xea384c=path[_0xb309('0x6f')](config[_0xb309('0x6a')],_0xb309('0x74'),_0x400687[_0xb309('0x66')]);}}return _0x374005[_0xb309('0x71')](_0xea384c);}})[_0xb309('0x46')](handleError(_0x374005,null));};exports[_0xb309('0x78')]=function(_0x35a4e1,_0x2cce1c){var _0x3a61a7=path[_0xb309('0x6f')](config[_0xb309('0x6a')],_0xb309('0x79'));var _0x4914f6={'where':{'id':_0x35a4e1['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xb309('0x41')][_0xb309('0x48')](_0x4914f6)[_0xb309('0x10')](handleEntityNotFound(_0x2cce1c,null))['then'](function(_0x2bc649){if(_0x2bc649){if(!_[_0xb309('0x6e')](_0x2bc649[_0xb309('0x68')])){if(fs[_0xb309('0x73')](path[_0xb309('0x6f')](config[_0xb309('0x6a')],_0xb309('0x74'),_0x2bc649[_0xb309('0x68')]))){_0x3a61a7=path['join'](config[_0xb309('0x6a')],'server/files/images/avatars/',_0x2bc649['systemAvatar']);}}return _0x2cce1c['download'](_0x3a61a7);}})[_0xb309('0x46')](handleError(_0x2cce1c,null));};exports[_0xb309('0x7a')]=function(_0x181e04,_0x1082f8){var _0x4673c8=require(_0xb309('0x7b'));var _0x195fac=new _0x4673c8();var _0x36170f=_0x195fac[_0xb309('0x7c')](_0x181e04[_0xb309('0x7d')][_0xb309('0x7e')])[_0xb309('0x7f')]();var _0x35bcb5={'body':_0x181e04[_0xb309('0x51')],'channel':_0xb309('0x80')};var _0x33c047=[];var _0x5acbad=[];var _0x4bed99={};var _0x231ef8=![];return db['CmContact'][_0xb309('0x52')]()[_0xb309('0x10')](function(_0x44e63d){if(!_0x44e63d){throw new db['Sequelize'][(_0xb309('0x81'))](_0xb309('0x82'));}_0x33c047=_['difference'](_[_0xb309('0x30')](_0x44e63d),['createdAt',_0xb309('0x83')]);_0x5acbad=_[_0xb309('0x84')](_[_0xb309('0x30')](_0x44e63d),['createdAt',_0xb309('0x83'),_0xb309('0x85'),_0xb309('0x86')]);if(_0x181e04['body']['id']){delete _0x181e04[_0xb309('0x51')]['id'];}if(_[_0xb309('0x6e')](_0x181e04['body'][_0xb309('0x87')])){throw new db['Sequelize'][(_0xb309('0x81'))](_0xb309('0x88'));}if(_[_0xb309('0x6e')](_0x181e04[_0xb309('0x51')][_0xb309('0x51')])||_0x181e04[_0xb309('0x51')][_0xb309('0x51')]===''){throw new db[(_0xb309('0x89'))]['ValidationError'](_0xb309('0x8a'));}if(_[_0xb309('0x6e')](_0x181e04[_0xb309('0x51')][_0xb309('0x8b')])){throw new db[(_0xb309('0x89'))][(_0xb309('0x81'))](_0xb309('0x8c')+_0x5acbad);}if(!_['includes'](_0x5acbad,_0x181e04['body'][_0xb309('0x8b')])){throw new db[(_0xb309('0x89'))][(_0xb309('0x81'))](_0xb309('0x8d')+_0x5acbad);}_0x4bed99[_0x181e04[_0xb309('0x51')][_0xb309('0x8b')]]=_0x181e04[_0xb309('0x51')][_0xb309('0x87')];})[_0xb309('0x10')](function(){return db[_0xb309('0x41')][_0xb309('0x48')]({'where':{'id':_0x181e04[_0xb309('0x47')]['id']},'include':[{'model':db[_0xb309('0x8e')],'as':'List','include':[{'model':db[_0xb309('0x8f')],'as':_0xb309('0x90'),'where':_0x4bed99,'limit':0x1,'order':[[_0xb309('0x83'),_0xb309('0x91')]]}]},{'model':db[_0xb309('0x92')],'as':_0xb309('0x93')}]});})['then'](handleEntityNotFound(_0x1082f8,null))[_0xb309('0x10')](function(_0x2452ed){if(_0x2452ed&&_0x2452ed[_0xb309('0x94')]){_0x35bcb5['account']=_0x2452ed;_0x35bcb5[_0xb309('0x95')]=_0x2452ed[_0xb309('0x93')];_0x35bcb5[_0xb309('0x96')]=_0x2452ed[_0xb309('0x94')];_0x35bcb5['applications']=_[_0xb309('0x97')](_0x35bcb5[_0xb309('0x95')],['priority'],[_0xb309('0x98')]);if(_0x35bcb5['account'][_0xb309('0x93')]){delete _0x35bcb5['account'][_0xb309('0x93')];}if(_0x35bcb5['account'][_0xb309('0x94')]&&_0x35bcb5[_0xb309('0x99')][_0xb309('0x94')][_0xb309('0x90')][_0xb309('0x36')]){return _0x35bcb5['account'][_0xb309('0x94')][_0xb309('0x90')][0x0];}var _0xd88c6b=_[_0xb309('0xa')](_0x181e04[_0xb309('0x51')],{'firstName':_0x181e04[_0xb309('0x51')]['from'],'ListId':_0x2452ed[_0xb309('0x86')]});_0xd88c6b[_0x181e04[_0xb309('0x51')]['mapKey']]=_0x181e04[_0xb309('0x51')][_0xb309('0x87')];return db['CmContact'][_0xb309('0x49')](_0xd88c6b,{'fields':_0x33c047,'raw':!![]});}})['then'](handleEntityNotFound(_0x1082f8,null))[_0xb309('0x10')](function(_0x2b7cce){_0x35bcb5[_0xb309('0x9a')]=_0x2b7cce;var _0x137b0c=_0x181e04[_0xb309('0x51')][_0xb309('0x9b')];if(_0x181e04[_0xb309('0x7d')][_0xb309('0x9c')]){_0x137b0c=_0x181e04['headers'][_0xb309('0x9c')];}else if(_0x181e04[_0xb309('0x7d')][_0xb309('0x9d')]){_0x137b0c=_[_0xb309('0x9e')](_0x181e04[_0xb309('0x7d')][_0xb309('0x9d')]['split'](','));}if(_0x2b7cce){var _0x3ddd0d={'ContactId':_0x2b7cce['id'],'ChatWebsiteId':_0x181e04[_0xb309('0x47')]['id'],'from':(_0x2b7cce['firstName']||'')+'\x20'+(_0x2b7cce['lastName']||''),'customerIp':_0x137b0c,'customerPort':_0x181e04['headers'][_0xb309('0x9f')]?_0x181e04[_0xb309('0x7d')][_0xb309('0x9f')]:null,'referer':_0x181e04[_0xb309('0x51')]['referer'],'browserName':_0x36170f['browser']['name']&&_0x36170f[_0xb309('0xa0')]['version']?util['format'](_0xb309('0xa1'),_0x36170f['browser'][_0xb309('0x28')],_0x36170f['browser'][_0xb309('0xa2')]):_0xb309('0xa3'),'browserVersion':_0x36170f[_0xb309('0xa0')][_0xb309('0xa2')]||'unknown','osName':util[_0xb309('0xa4')](_0xb309('0xa1'),_0x36170f['os'][_0xb309('0x28')],_0x36170f['os']['version']),'osVersion':_0x36170f['os'][_0xb309('0xa2')],'deviceModel':_0x36170f[_0xb309('0xa5')][_0xb309('0x2f')]&&_0x36170f[_0xb309('0xa5')]['vendor']?util[_0xb309('0xa4')](_0xb309('0xa6'),_0x36170f[_0xb309('0xa5')][_0xb309('0x2f')],_0x36170f[_0xb309('0xa5')][_0xb309('0xa7')],_0x36170f[_0xb309('0xa5')]['type']):null,'deviceVendor':_0x36170f[_0xb309('0xa5')][_0xb309('0xa7')],'deviceType':_0x36170f[_0xb309('0xa5')][_0xb309('0x3e')],'formData':JSON[_0xb309('0x16')](_0x181e04[_0xb309('0x51')])};var _0x221017={'ChatWebsiteId':_0x181e04[_0xb309('0x47')]['id'],'closed':![]};if(_0x181e04['body'][_0xb309('0xa8')]){_0x221017['threadId']=_0x181e04[_0xb309('0x51')][_0xb309('0xa8')];return db[_0xb309('0xa9')][_0xb309('0x48')]({'where':_0x221017})[_0xb309('0x10')](function(_0x479081){if(_0x479081){return[_0x479081,![]];}_0x3ddd0d['threadId']=_0x181e04[_0xb309('0x51')][_0xb309('0xa8')];_0x3ddd0d[_0xb309('0xaa')]=_0x181e04[_0xb309('0x51')][_0xb309('0xaa')];return db['ChatInteraction']['create'](_0x3ddd0d)[_0xb309('0x10')](function(_0x24e5b0){return[_0x24e5b0,!![]];});});}_0x221017['ContactId']=_0x2b7cce['id'];if(_0x181e04[_0xb309('0x51')][_0xb309('0xab')]&&_0x181e04[_0xb309('0x51')][_0xb309('0xab')]['id']){_0x221017['id']=_0x181e04[_0xb309('0x51')][_0xb309('0xab')]['id'];return db[_0xb309('0xa9')][_0xb309('0x48')]({'where':_0x221017})[_0xb309('0x10')](function(_0x2a63ee){if(_0x2a63ee){return[_0x2a63ee,![]];}return db[_0xb309('0xa9')][_0xb309('0x49')](_0x3ddd0d)[_0xb309('0x10')](function(_0x585910){return[_0x585910,!![]];});});}return db[_0xb309('0xa9')][_0xb309('0x49')](_0x3ddd0d)[_0xb309('0x10')](function(_0x3c22ed){return[_0x3c22ed,!![]];});}})['spread'](function(_0x509caa,_0x3e63d2){if(_0x509caa){_0x231ef8=_0x3e63d2;if(!_0x3e63d2){var _0x1d13d0={'from':(_0x35bcb5['contact']['firstName']||'')+'\x20'+(_0x35bcb5[_0xb309('0x9a')][_0xb309('0xac')]||'')};if(_0x181e04['body'][_0xb309('0xa8')]&&_0x181e04['body'][_0xb309('0xad')]&&_0x181e04['body'][_0xb309('0xa8')]!=_0x181e04[_0xb309('0x51')][_0xb309('0xad')]){_0x1d13d0[_0xb309('0xa8')]=_0x181e04[_0xb309('0x51')]['messageId'];}return _0x509caa[_0xb309('0x23')](_0x1d13d0);}else{return _0x509caa;}}})[_0xb309('0x10')](function(_0x221f90){_0x35bcb5['interaction']=_0x221f90[_0xb309('0x25')]({'plain':!![]});_0x35bcb5['interaction']['created']=_0x231ef8;if(_0x35bcb5[_0xb309('0xab')]['created']){if(_0x35bcb5[_0xb309('0x99')][_0xb309('0xae')]){_0x35bcb5[_0xb309('0x95')][_0xb309('0xaf')]({'id':0x0,'priority':_0x35bcb5[_0xb309('0x95')][_0xb309('0x36')]+0x1,'app':_0xb309('0xb0'),'appdata':'unmanaged','interval':_0xb309('0xb1')});}}return db[_0xb309('0xb2')][_0xb309('0x49')]({'body':_0x181e04[_0xb309('0x51')][_0xb309('0x51')],'ChatWebsiteId':_0x181e04[_0xb309('0x47')]['id'],'ChatInteractionId':_0x221f90['id'],'direction':'in','ContactId':_0x35bcb5['contact']['id'],'AttachmentId':_0x181e04[_0xb309('0x51')]['AttachmentId']});})[_0xb309('0x10')](function(_0x448822){_0x35bcb5[_0xb309('0x19')]=_0x448822;if(_0x35bcb5[_0xb309('0xab')][_0xb309('0xb3')]){return db[_0xb309('0xb4')]['find']({'attributes':['id',_0xb309('0x28')],'where':{'id':_0x35bcb5[_0xb309('0xab')][_0xb309('0xb3')]}})['then'](function(_0x42c1e4){if(_0x42c1e4){_0x35bcb5[_0xb309('0x95')][_0xb309('0xb5')]({'id':0x0,'priority':0x0,'app':_0xb309('0xb6'),'appdata':_0x42c1e4['name']+','+(_0x35bcb5[_0xb309('0x99')][_0xb309('0xb7')]||0xa),'interval':_0xb309('0xb1')});_0x35bcb5[_0xb309('0xb8')]=!![];}return respondWithRpcPromise('Start',_0xb309('0xb9'),_0x35bcb5);});}return respondWithRpcPromise('Start',_0xb309('0xb9'),_0x35bcb5);})[_0xb309('0x10')](function(_0x479133){respondWithRpcPromise(_0xb309('0xba'),'EventManager',{'event':_0xb309('0x7a'),'message':_0x479133},client9002);return _0x479133;})['then'](respondWithResult(_0x1082f8,null))[_0xb309('0x46')](handleError(_0x1082f8,null));};exports[_0xb309('0xbb')]=function(_0x404c48,_0x5153de){var _0x1300c7,_0x1260d1,_0x3d94e3;var _0x2705f4=[];var _0xc990a={};var _0x5b141e=_0x404c48[_0xb309('0xbc')]||[];var _0x1daa24=[];var _0x420e35;return db['CmContact'][_0xb309('0x52')]()[_0xb309('0x10')](function(_0x551da6){if(!_0x551da6){throw new db[(_0xb309('0x89'))]['ValidationError']('no\x20available\x20attributes');}_0x2705f4=_[_0xb309('0x84')](_[_0xb309('0x30')](_0x551da6),[_0xb309('0xbd'),_0xb309('0x83'),'CompanyId',_0xb309('0x86')]);if(_0x404c48[_0xb309('0x51')]['id']){delete _0x404c48[_0xb309('0x51')]['id'];}if(_[_0xb309('0x6e')](_0x404c48[_0xb309('0x51')][_0xb309('0x87')])){throw _0x5153de[_0xb309('0x1c')](0x1f4)[_0xb309('0x29')](new db[(_0xb309('0x89'))]['ValidationError'](_0xb309('0x88')));}if(_[_0xb309('0x6e')](_0x404c48[_0xb309('0x51')][_0xb309('0x51')])||_0x404c48[_0xb309('0x51')][_0xb309('0x51')]===''){throw _0x5153de[_0xb309('0x1c')](0x1f4)[_0xb309('0x29')](new db['Sequelize'][(_0xb309('0x81'))](_0xb309('0x8a')));}if(_['isNil'](_0x404c48['body']['mapKeyOffline'])){throw _0x5153de['status'](0x1f4)['send'](new db['Sequelize'][(_0xb309('0x81'))](_0xb309('0xbe')+_0x2705f4));}if(!_[_0xb309('0xbf')](_0x2705f4,_0x404c48[_0xb309('0x51')][_0xb309('0xc0')])){throw _0x5153de[_0xb309('0x1c')](0x1f4)[_0xb309('0x29')](new db['Sequelize']['ValidationError'](_0xb309('0xc1')+_0x2705f4));}_0xc990a[_0x404c48[_0xb309('0x51')]['mapKeyOffline']]=_0x404c48[_0xb309('0x51')][_0xb309('0x87')];})[_0xb309('0x10')](function(){return db[_0xb309('0x41')][_0xb309('0x48')]({'where':{'id':_0x404c48['params']['id']},'include':[{'model':db[_0xb309('0x8e')],'as':_0xb309('0x94')},{'model':db[_0xb309('0xc2')],'as':_0xb309('0xc2')}]});})['then'](handleEntityNotFound(_0x5153de,null))[_0xb309('0x10')](function(_0x4e0636){if(_0x4e0636&&_0x4e0636[_0xb309('0x94')]){_0x1260d1=_0x4e0636;var _0x580e23=_[_0xb309('0xa')](_0x404c48['body'],{'firstName':_0x404c48[_0xb309('0x51')][_0xb309('0x87')],'phone':_0x404c48[_0xb309('0x51')][_0xb309('0x87')],'ListId':_0x4e0636[_0xb309('0x86')]});_0x580e23[_0x404c48[_0xb309('0x51')][_0xb309('0xc0')]]=_0x404c48[_0xb309('0x51')]['from'];return db[_0xb309('0x8f')][_0xb309('0xc3')]({'where':_0xc990a,'defaults':_0x580e23});}})[_0xb309('0xc4')](function(_0x2e7e01){if(_0x2e7e01){_0x3d94e3=_0x2e7e01;var _0x4931d8=fs[_0xb309('0xc5')](path['join'](config[_0xb309('0x6a')],_0xb309('0xc6')),'utf8');var _0x1989ab=ejs['render'](_0x4931d8,{'body':_[_0xb309('0xc7')](_0x404c48[_0xb309('0x51')][_0xb309('0x51')]),'bodyTitle':_0x1260d1['offlineMessageBody']});return db[_0xb309('0xc8')][_0xb309('0x49')]({'body':_0x1989ab,'ContactId':_0x2e7e01['id'],'ChatWebsiteId':_0x1260d1['id']});}})[_0xb309('0x10')](function(_0x48dde3){_0x420e35=_0x48dde3;if(_0x5b141e[_0xb309('0x36')]){var _0x318ddf=_0x5b141e[_0xb309('0x2c')](function(_0x331763){return{'name':_0x331763[_0xb309('0xc9')],'basename':_0x331763[_0xb309('0x64')],'type':_0x331763['mimetype'],'ChatOfflineMessageId':_0x48dde3['id']};});_0x1daa24=_0x318ddf[_0xb309('0x2c')](_0x90c9fc=>{var _0x321724={'filename':_0x90c9fc[_0xb309('0x28')],'path':path[_0xb309('0x6f')](config['root'],'server',_0xb309('0xbc'),_0xb309('0xca'),_0xb309('0xcb'),_0x90c9fc['basename'])};return _0x321724;});if(!_0x1260d1['openNewInteraction']){return db['sequelize'][_0xb309('0xcc')](function(_0x127415){return db[_0xb309('0xcd')][_0xb309('0xce')](_0x318ddf,{'transaction':_0x127415});});}}})[_0xb309('0x10')](function(){if(_0x420e35){_0x1300c7=_0x420e35;return db[_0xb309('0xc2')]['findOne']({'where':{'active':!![]},'include':[{'model':db['MailServerOut'],'as':_0xb309('0xcf'),'raw':!![]}]});}})[_0xb309('0x10')](function(_0x37027e){if(_0x37027e&&_0x37027e['Smtp']&&_0x1260d1[_0xb309('0xd0')]&&_0x1260d1[_0xb309('0xd1')]){var _0x583dc0={'tls':{'rejectUnauthorized':![]}};if(_0x37027e[_0xb309('0xcf')][_0xb309('0xd2')]){_0x583dc0[_0xb309('0xd2')]=_0x37027e['Smtp'][_0xb309('0xd2')];}else{_0x583dc0['host']=_0x37027e['Smtp'][_0xb309('0xd3')];_0x583dc0['port']=_0x37027e[_0xb309('0xcf')][_0xb309('0xd4')];_0x583dc0[_0xb309('0xd5')]=_0x37027e[_0xb309('0xcf')][_0xb309('0xd5')];}if(_0x37027e[_0xb309('0xcf')]['authentication']){_0x583dc0['auth']={'user':_0x37027e[_0xb309('0xcf')][_0xb309('0x4a')],'pass':_0x37027e[_0xb309('0xcf')][_0xb309('0xd6')]};}return respondWithRpcPromise(_0xb309('0xd7'),_0xb309('0xd8'),{'account':_0x583dc0,'message':{'from':util[_0xb309('0xa4')](_0xb309('0xd9'),_0x37027e[_0xb309('0x28')],_0x37027e[_0xb309('0xda')]||_0x37027e['Smtp'][_0xb309('0x4a')]),'to':_0x1260d1['forwardOfflineAddress'],'subject':_0x1260d1['offlineMessageSubject'],'html':_0x1300c7[_0xb309('0x51')],'attachments':_0x1daa24}},client9003)[_0xb309('0x10')](function(){return _0x1300c7;})[_0xb309('0x46')](function(_0x2b1341){console[_0xb309('0x17')](_0x2b1341);});}})[_0xb309('0x10')](function(){if(_0x1260d1&&_0x1260d1[_0xb309('0xdb')]&&_0x1260d1[_0xb309('0xdc')]){var _0x3e1f5d=[];if(_0x5b141e[_0xb309('0x36')]){_0x3e1f5d=_0x5b141e['map'](function(_0x5905b4){return{'name':_0x5905b4[_0xb309('0xc9')],'basename':_0x5905b4[_0xb309('0x64')],'type':_0x5905b4[_0xb309('0xdd')],'ChatOfflineMessageId':_0x420e35['id']};});}var _0x47ee67;if(!_[_0xb309('0x6e')](_0x1260d1[_0xb309('0xde')])){var _0x2286dc=_[_0xb309('0x2c')](_0x404c48[_0xb309('0x51')],function(_0x57bfa1){return _0x57bfa1;});var _0x1a1a58=_[_0xb309('0xdf')](_0x2286dc)[0x0];var _0x2addca=_[_0xb309('0xe0')](_0x1a1a58,function(_0x42ba7d){return _0x42ba7d;});_0x47ee67=_0x2addca[0x1][_0x1260d1[_0xb309('0xde')]];}var _0x41cc9c={'from':_0x3d94e3[_0xb309('0xda')],'firstName':_0x3d94e3[_0xb309('0xe1')],'lastName':_0x3d94e3[_0xb309('0xac')],'mapKey':_0xb309('0xda'),'message':{'from':_0x3d94e3['email'],'to':_0x1260d1[_0xb309('0xc2')][_0xb309('0xda')],'cc':'','subject':_[_0xb309('0x6e')](_0x47ee67)?_0x1260d1[_0xb309('0xe2')]:_0x47ee67,'messageId':'','sentAt':new Date(),'attach':_0x3e1f5d[_0xb309('0x36')],'attachments':_0x3e1f5d,'originChannel':_0xb309('0xe3'),'ChatWebsiteId':_0x1260d1['id'],'ChatOfflineMessageId':_0x1300c7['id'],'originTo':_0x1260d1['MailAccount']['email']},'body':_0x1300c7[_0xb309('0x51')]};var _0x3c6e65={'account':{'id':_0x1260d1[_0xb309('0xdc')]},'body':_0x41cc9c,'log':_0xb309('0xe4')};return respondWithRpcPromise('NotifyMailAccount',_0xb309('0xe5'),_0x3c6e65,client9001)[_0xb309('0x10')](function(){return _0x1300c7;})['catch'](function(_0x4ee0a2){console[_0xb309('0x17')](_0x4ee0a2);});}return;})['then'](function(){if(_0x1300c7){return _0x1300c7;}})[_0xb309('0x10')](respondWithResult(_0x5153de,null))[_0xb309('0x46')](function(_0xe28dc3){console['error']('catch',_0xe28dc3);for(var _0x1c5bfd of _0x5b141e){var _0x52a913=path[_0xb309('0x6f')](config[_0xb309('0x6a')],_0xb309('0xe6'),_0xb309('0xbc'),'attachments','offline-chat',_0x1c5bfd[_0xb309('0x64')]);fs_extra['remove'](_0x52a913)[_0xb309('0x46')](function(_0x521118){console[_0xb309('0x17')](_0xb309('0xe7'),_0x52a913,_0x521118);});}});};exports['addInteraction']=function(_0x1774ca,_0x4a7774){return db[_0xb309('0xa9')][_0xb309('0x48')]({'where':{'id':_0x1774ca[_0xb309('0x47')]['id']}})[_0xb309('0x10')](handleEntityNotFound(_0x4a7774,null))[_0xb309('0x10')](function(_0x1cada6){if(_0x1cada6){return _0x1cada6[_0xb309('0xe8')](_0x1774ca['body'][_0xb309('0x5e')],_['omit'](_0x1774ca['body'],['ids','id'])||{});}})[_0xb309('0x10')](respondWithResult(_0x4a7774,null))[_0xb309('0x46')](handleError(_0x4a7774,null));};exports['getInteractions']=function(_0x42ca7c,_0x1bb4c2){var _0x22db1e={'raw':![],'where':{}};var _0x59c597={};var _0x38663c={'count':0x0,'rows':[]};return db[_0xb309('0x41')][_0xb309('0x55')]({'where':{'id':_0x42ca7c[_0xb309('0x47')]['id']}})[_0xb309('0x10')](handleEntityNotFound(_0x1bb4c2,null))['then'](function(_0x3d2972){if(_0x3d2972){_0x59c597[_0xb309('0x2f')]=_[_0xb309('0x30')](db['ChatInteraction'][_0xb309('0x2d')]);_0x59c597[_0xb309('0x31')]=_[_0xb309('0x30')](_0x42ca7c[_0xb309('0x31')]);_0x59c597[_0xb309('0x32')]=_[_0xb309('0x33')](_0x59c597[_0xb309('0x2f')],_0x59c597[_0xb309('0x31')]);_0x22db1e['attributes']=_[_0xb309('0x33')](_0x59c597['model'],qs[_0xb309('0x35')](_0x42ca7c[_0xb309('0x31')][_0xb309('0x35')]));_0x22db1e['attributes']=_0x22db1e[_0xb309('0x34')][_0xb309('0x36')]?_0x22db1e[_0xb309('0x34')]:_0x59c597['model'];if(!_0x42ca7c[_0xb309('0x31')][_0xb309('0x37')](_0xb309('0x57'))){_0x22db1e[_0xb309('0x21')]=qs['limit'](_0x42ca7c[_0xb309('0x31')][_0xb309('0x21')]);_0x22db1e[_0xb309('0x1e')]=qs[_0xb309('0x1e')](_0x42ca7c[_0xb309('0x31')]['offset']);}_0x22db1e[_0xb309('0x38')]=qs[_0xb309('0x39')](_0x42ca7c[_0xb309('0x31')][_0xb309('0x39')]);_0x22db1e[_0xb309('0x3a')]=qs[_0xb309('0x32')](_[_0xb309('0x3b')](_0x42ca7c[_0xb309('0x31')],_0x59c597[_0xb309('0x32')]));_0x22db1e[_0xb309('0x3a')][_0xb309('0x58')]=_0x3d2972['id'];if(_0x42ca7c['query'][_0xb309('0x3c')]){_0x22db1e[_0xb309('0x3a')]=_[_0xb309('0x3d')](_0x22db1e[_0xb309('0x3a')],{'$or':_[_0xb309('0x2c')](_0x22db1e[_0xb309('0x34')],function(_0x51bae8){var _0x23dc44={};_0x23dc44[_0x51bae8]={'$like':'%'+_0x42ca7c['query'][_0xb309('0x3c')]+'%'};return _0x23dc44;})});}_0x22db1e=_['merge']({},_0x22db1e,_0x42ca7c['options']);return db[_0xb309('0xa9')][_0xb309('0x20')]({'where':_0x22db1e['where']})[_0xb309('0x10')](function(_0x4cc3c0){_0x38663c[_0xb309('0x20')]=_0x4cc3c0;if(_0x42ca7c[_0xb309('0x31')]['includeAll']){_0x22db1e[_0xb309('0x43')]=[{'model':db[_0xb309('0x8f')],'as':_0xb309('0xe9'),'required':![]},{'model':db[_0xb309('0xb4')],'as':'Owner','attributes':['name',_0xb309('0xea'),'internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0xb309('0xeb')],'where':_0x42ca7c[_0xb309('0x31')][_0xb309('0xec')]?{'id':_0x42ca7c[_0xb309('0x31')][_0xb309('0xec')]}:undefined,'required':_0x42ca7c['query'][_0xb309('0xec')]?!![]:![]}];}return db['ChatInteraction'][_0xb309('0x44')](_0x22db1e);})['then'](function(_0x320282){_0x38663c[_0xb309('0x45')]=_0x320282;return _0x38663c;});}})['then'](respondWithFilteredResult(_0x1bb4c2,_0x22db1e))[_0xb309('0x46')](handleError(_0x1bb4c2,null));};function iftimePromise(_0xa0dd6e,_0x2887a4){return respondWithRpcPromise(_0xb309('0xed'),_0xb309('0xee'),{'command':_0x2887a4[_0xb309('0xef')]?util[_0xb309('0xa4')](_0xb309('0xf0'),_0xa0dd6e['interval'],_0x2887a4[_0xb309('0xef')]):util['format'](_0xb309('0xf1'),_0xa0dd6e[_0xb309('0xf2')])},client9002)[_0xb309('0x10')](function(_0x5ac511){var _0x1560f9=_0x5ac511&&_0x5ac511[_0xb309('0xf3')](_0xb309('0xf4'))>=0x0?!![]:![];logger[_0xb309('0x11')](_0xb309('0xf5'),_0x2887a4['id'],_0xa0dd6e['id'],_0xa0dd6e[_0xb309('0xf2')],_0x1560f9?_0xb309('0xf6'):_0xb309('0xf7'),_0x2887a4[_0xb309('0xef')]?_0x2887a4[_0xb309('0xef')]:_0xb309('0xf8'));return _0x1560f9;})[_0xb309('0x46')](function(_0x19fb29){logger[_0xb309('0x17')](_0xb309('0xf5'),_0x2887a4['id'],_0xa0dd6e['id'],_0xa0dd6e[_0xb309('0xf2')],util['inspect'](_0x19fb29,{'showHidden':![],'depth':null}),_0x2887a4[_0xb309('0xef')]?_0x2887a4[_0xb309('0xef')]:'No\x20timezone');return![];});}exports['getSnippet']=function(_0x59e0e4,_0x43d639){var _0x9e2b5f=0x0;var _0x478964=0x0;var _0x50be23=![];var _0x39c69f;var _0x3a2354;return db[_0xb309('0x41')][_0xb309('0x48')]({'where':{'id':_0x59e0e4[_0xb309('0x47')]['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db[_0xb309('0xf9')],'as':_0xb309('0xfa'),'attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x43d639,null))[_0xb309('0x10')](function(_0x2e80ec){if(_0x2e80ec){_0x39c69f=_0x2e80ec;return _0x2e80ec[_0xb309('0xfb')]({'raw':!![]});}})[_0xb309('0x10')](function(_0x33a826){if(_0x39c69f){if(_0x33a826){_0x3a2354=_0x33a826;}}return require(_0xb309('0x6b'))['getLicense']();})[_0xb309('0x10')](function(_0x140230){if(_0x140230){_0x478964=_0x140230[_0xb309('0xfc')];_0x50be23=_0x140230[_0xb309('0x6d')];}})[_0xb309('0x10')](function(){return db['ChatInteraction'][_0xb309('0x20')]({'where':{'closed':![]}});})[_0xb309('0x10')](function(_0x4e1d89){_0x9e2b5f=_0x4e1d89;if(_0x478964&&_0x4e1d89>_0x478964){return db['License'][_0xb309('0x55')]({'where':{'id':0x1}})[_0xb309('0x10')](function(_0x11d092){if(_0x11d092){_0x11d092[_0xb309('0xfd')]('chatLicenseExceeded');}});}})[_0xb309('0x10')](function(){if(_0x39c69f[_0xb309('0xf9')]&&_0x39c69f[_0xb309('0xf9')][_0xb309('0xfa')]){var _0x1ef93d=[];for(var _0x467552=0x0;_0x467552<_0x39c69f[_0xb309('0xf9')][_0xb309('0xfa')][_0xb309('0x36')];_0x467552++){var _0x153d17=_0x39c69f[_0xb309('0xf9')][_0xb309('0xfa')][_0x467552][_0xb309('0x25')]({'plain':!![]});_0x1ef93d[_0xb309('0xaf')](iftimePromise(_0x153d17,_0x39c69f));}return BPromise[_0xb309('0xfe')](_0x1ef93d)[_0xb309('0x10')](function(_0x44e9b7){return _['some'](_0x44e9b7);});}else{return!![];}})['then'](function(_0x3ccd9c){var _0x5b98a0=fs[_0xb309('0xc5')](path[_0xb309('0x6f')](config['root'],_0xb309('0xff')),'utf8');var _0xb0e22b={'remote':_0x39c69f['remote'],'query':querystring[_0xb309('0x16')](_[_0xb309('0x3d')](_0x39c69f[_0xb309('0x25')]({'plain':!![]}),{'customerIp':_0x59e0e4['headers'][_0xb309('0x9d')]||_0x59e0e4[_0xb309('0x7d')][_0xb309('0x100')]||_0x59e0e4[_0xb309('0x101')]['remoteAddress']||_0x59e0e4['ip'],'referer':_0x59e0e4[_0xb309('0x7d')][_0xb309('0x102')],'openedInteractions':_0x9e2b5f,'maxInteractions':_0x478964,'virtual':_0x50be23[_0xb309('0xfc')],'online':_0x3ccd9c,'custom':_0x50be23}))[_0xb309('0x103')](/'/g,'\x5c\x27')};_0x43d639[_0xb309('0x29')](ejs['render'](Mustache[_0xb309('0x104')](_0x5b98a0,_0xb0e22b),{'proactiveActions':_0x3a2354,'alignment':_0x39c69f[_0xb309('0x105')],'verticalAlignment':_0x39c69f[_0xb309('0x106')],'div_color':_0x39c69f['color'],'text_color':_0x39c69f['textColor'],'button_color':_0x39c69f[_0xb309('0x107')],'background_color':_0x39c69f[_0xb309('0x108')]}));})[_0xb309('0x46')](handleError(_0x43d639,null));};exports[_0xb309('0x109')]=function(_0x5e66d6,_0x5f4372){var _0x5bb3eb=_0x5e66d6['params']['id'];var _0x347a47=_0x5e66d6['body'];var _0x213b49=0xc8;var _0x79803d=null;return db[_0xb309('0x10a')][_0xb309('0xcc')]({'isolationLevel':db[_0xb309('0x10a')][_0xb309('0x10b')]['ISOLATION_LEVELS'][_0xb309('0x10c')]},function(_0x231f2c){return db[_0xb309('0x41')][_0xb309('0x55')]({'where':{'id':_0x5bb3eb},'transaction':_0x231f2c})[_0xb309('0x10')](function(_0x4e474e){if(_0x4e474e){return db['ChatApplication'][_0xb309('0x24')]({'where':{'ChatWebsiteId':_0x5bb3eb},'transaction':_0x231f2c})[_0xb309('0x10')](function(){var _0x375b24=_[_0xb309('0x2c')](_0x347a47,function(_0x52c17b){_0x52c17b[_0xb309('0x58')]=_0x5bb3eb;return _0x52c17b;});return db[_0xb309('0x92')]['bulkCreate'](_0x375b24,{'transaction':_0x231f2c});});}else{_0x213b49=0x194;_0x79803d=[];}});})[_0xb309('0x10')](function(){if(_0x213b49!==0x194){return db[_0xb309('0x92')][_0xb309('0x10d')]({'where':{'ChatWebsiteId':_0x5bb3eb},'order':_0xb309('0x10e')})[_0xb309('0x10')](function(_0x1af97f){_0x79803d=_0x1af97f;});}})[_0xb309('0x46')](function(_0x10a331){_0x213b49=0x1f4;logger[_0xb309('0x17')](_0x10a331[_0xb309('0x27')]);if(_0x10a331[_0xb309('0x28')]){delete _0x10a331[_0xb309('0x28')];}_0x79803d=_0x10a331;})[_0xb309('0x10f')](function(){if(_0x79803d===null){_0x5f4372[_0xb309('0x1b')](_0x213b49);}else{if(_0x213b49===0x1f4){_0x5f4372[_0xb309('0x1c')](_0x213b49)['send'](_0x79803d);}else{_0x5f4372[_0xb309('0x1c')](_0x213b49)[_0xb309('0x110')](_0x79803d);}}});};exports[_0xb309('0x111')]=function(_0x1c98f5,_0x6d626e){var _0x209a0b={};var _0x36e41c={};var _0x944170;var _0x174026;return db[_0xb309('0x41')][_0xb309('0x55')]({'where':{'id':_0x1c98f5[_0xb309('0x47')]['id']}})[_0xb309('0x10')](handleEntityNotFound(_0x6d626e,null))[_0xb309('0x10')](function(_0x3163ba){if(_0x3163ba){_0x944170=_0x3163ba;_0x36e41c[_0xb309('0x2f')]=_[_0xb309('0x30')](db[_0xb309('0x92')][_0xb309('0x2d')]);_0x36e41c[_0xb309('0x31')]=_['keys'](_0x1c98f5[_0xb309('0x31')]);_0x36e41c[_0xb309('0x32')]=_[_0xb309('0x33')](_0x36e41c[_0xb309('0x2f')],_0x36e41c[_0xb309('0x31')]);_0x209a0b[_0xb309('0x34')]=_['intersection'](_0x36e41c[_0xb309('0x2f')],qs[_0xb309('0x35')](_0x1c98f5[_0xb309('0x31')]['fields']));_0x209a0b[_0xb309('0x34')]=_0x209a0b['attributes']['length']?_0x209a0b[_0xb309('0x34')]:_0x36e41c['model'];_0x209a0b[_0xb309('0x38')]=qs[_0xb309('0x39')](_0x1c98f5['query'][_0xb309('0x39')]);_0x209a0b[_0xb309('0x3a')]=qs[_0xb309('0x32')](_[_0xb309('0x3b')](_0x1c98f5[_0xb309('0x31')],_0x36e41c[_0xb309('0x32')]));if(_0x1c98f5[_0xb309('0x31')][_0xb309('0x3c')]){_0x209a0b[_0xb309('0x3a')]=_[_0xb309('0x3d')](_0x209a0b[_0xb309('0x3a')],{'$or':_[_0xb309('0x2c')](_0x209a0b[_0xb309('0x34')],function(_0x1f87b6){var _0x4968c9={};_0x4968c9[_0x1f87b6]={'$like':'%'+_0x1c98f5['query'][_0xb309('0x3c')]+'%'};return _0x4968c9;})});}_0x209a0b=_[_0xb309('0x3d')]({},_0x209a0b,_0x1c98f5[_0xb309('0x40')]);return _0x944170['getApplications'](_0x209a0b);}})[_0xb309('0x10')](function(_0x20f1e4){if(_0x20f1e4){_0x174026=_0x20f1e4[_0xb309('0x36')];if(!_0x1c98f5[_0xb309('0x31')]['hasOwnProperty'](_0xb309('0x57'))){_0x209a0b[_0xb309('0x21')]=qs[_0xb309('0x21')](_0x1c98f5['query'][_0xb309('0x21')]);_0x209a0b[_0xb309('0x1e')]=qs['offset'](_0x1c98f5[_0xb309('0x31')][_0xb309('0x1e')]);}return _0x944170[_0xb309('0x111')](_0x209a0b);}})[_0xb309('0x10')](function(_0x2d59af){if(_0x2d59af){return _0x2d59af?{'count':_0x174026,'rows':_0x2d59af}:null;}})[_0xb309('0x10')](respondWithResult(_0x6d626e,null))[_0xb309('0x46')](handleError(_0x6d626e,null));};exports[_0xb309('0x112')]=function(_0x1653c7,_0x209cb8){return db[_0xb309('0x113')][_0xb309('0x48')]({'where':{'id':_0x1653c7[_0xb309('0x47')]['id']}})[_0xb309('0x10')](handleEntityNotFound(_0x209cb8,null))[_0xb309('0x10')](function(_0x1267b9){if(_0x1267b9){return _0x1267b9[_0xb309('0x112')](_0x1653c7[_0xb309('0x51')][_0xb309('0x5e')],_['omit'](_0x1653c7[_0xb309('0x51')],['ids','id'])||{});}})[_0xb309('0x10')](respondWithResult(_0x209cb8,null))['catch'](handleError(_0x209cb8,null));};exports[_0xb309('0xfb')]=function(_0x23238a,_0x5efff4){var _0x39a3a5={};var _0x3af08f={};var _0x42862c;var _0x54670a;return db[_0xb309('0x41')]['findOne']({'where':{'id':_0x23238a['params']['id']}})[_0xb309('0x10')](handleEntityNotFound(_0x5efff4,null))['then'](function(_0x36da79){if(_0x36da79){_0x42862c=_0x36da79;_0x3af08f[_0xb309('0x2f')]=_[_0xb309('0x30')](db[_0xb309('0x114')][_0xb309('0x2d')]);_0x3af08f[_0xb309('0x31')]=_[_0xb309('0x30')](_0x23238a[_0xb309('0x31')]);_0x3af08f[_0xb309('0x32')]=_[_0xb309('0x33')](_0x3af08f[_0xb309('0x2f')],_0x3af08f[_0xb309('0x31')]);_0x39a3a5[_0xb309('0x34')]=_[_0xb309('0x33')](_0x3af08f[_0xb309('0x2f')],qs[_0xb309('0x35')](_0x23238a[_0xb309('0x31')][_0xb309('0x35')]));_0x39a3a5[_0xb309('0x34')]=_0x39a3a5['attributes'][_0xb309('0x36')]?_0x39a3a5[_0xb309('0x34')]:_0x3af08f[_0xb309('0x2f')];_0x39a3a5['order']=qs[_0xb309('0x39')](_0x23238a[_0xb309('0x31')][_0xb309('0x39')]);_0x39a3a5[_0xb309('0x3a')]=qs['filters'](_[_0xb309('0x3b')](_0x23238a[_0xb309('0x31')],_0x3af08f[_0xb309('0x32')]));if(_0x23238a[_0xb309('0x31')][_0xb309('0x3c')]){_0x39a3a5['where']=_['merge'](_0x39a3a5['where'],{'$or':_['map'](_0x39a3a5[_0xb309('0x34')],function(_0x5c36d5){var _0x2127f3={};_0x2127f3[_0x5c36d5]={'$like':'%'+_0x23238a[_0xb309('0x31')][_0xb309('0x3c')]+'%'};return _0x2127f3;})});}_0x39a3a5=_[_0xb309('0x3d')]({},_0x39a3a5,_0x23238a[_0xb309('0x40')]);return _0x42862c[_0xb309('0xfb')](_0x39a3a5);}})[_0xb309('0x10')](function(_0x5ecec6){if(_0x5ecec6){_0x54670a=_0x5ecec6['length'];if(!_0x23238a[_0xb309('0x31')][_0xb309('0x37')](_0xb309('0x57'))){_0x39a3a5['limit']=qs['limit'](_0x23238a[_0xb309('0x31')][_0xb309('0x21')]);_0x39a3a5[_0xb309('0x1e')]=qs['offset'](_0x23238a[_0xb309('0x31')][_0xb309('0x1e')]);}return _0x42862c[_0xb309('0xfb')](_0x39a3a5);}})[_0xb309('0x10')](function(_0x39f921){if(_0x39f921){return _0x39f921?{'count':_0x54670a,'rows':_0x39f921}:null;}})[_0xb309('0x10')](respondWithResult(_0x5efff4,null))['catch'](handleError(_0x5efff4,null));};exports[_0xb309('0x115')]=function(_0x55762a,_0x41f7d7){var _0x39d2c0=_0x55762a['query'][_0xb309('0x116')]==='false'?_0xb309('0x117'):_0xb309('0x118');return db[_0xb309('0x41')][_0xb309('0x48')]({'attributes':['id',_0x39d2c0],'where':{'id':_0x55762a[_0xb309('0x47')]['id']}})[_0xb309('0x10')](handleEntityNotFound(_0x41f7d7,null))[_0xb309('0x10')](function(_0x5bbb69){if(_0x5bbb69){var _0x5ae02d=_0x5bbb69[_0x39d2c0];var _0x14826f=_0x5ae02d&&_0x5ae02d[_0xb309('0x119')]?_0x5ae02d[_0xb309('0x119')]:[];_0x41f7d7['send']({'fromKey':_[_0xb309('0x6e')](_0x5ae02d['fromKey'])?undefined:_0x5ae02d['fromKey'],'count':_0x14826f[_0xb309('0x36')],'rows':_0x14826f});}})[_0xb309('0x46')](handleError(_0x41f7d7,null));};exports[_0xb309('0x11a')]=function(_0x26e005,_0x25ba2d){var _0x4b9f90={'raw':![],'where':{}};var _0x58a00f={};var _0x10f4c5={'count':0x0,'rows':[]};return db[_0xb309('0x41')]['findOne']({'where':{'id':_0x26e005[_0xb309('0x47')]['id']}})[_0xb309('0x10')](handleEntityNotFound(_0x25ba2d,null))[_0xb309('0x10')](function(_0x2fd04b){if(_0x2fd04b){_0x58a00f['model']=_[_0xb309('0x30')](db[_0xb309('0xc8')]['rawAttributes']);_0x58a00f[_0xb309('0x31')]=_['keys'](_0x26e005[_0xb309('0x31')]);_0x58a00f[_0xb309('0x32')]=_[_0xb309('0x33')](_0x58a00f[_0xb309('0x2f')],_0x58a00f['query']);_0x4b9f90[_0xb309('0x34')]=_[_0xb309('0x33')](_0x58a00f[_0xb309('0x2f')],qs[_0xb309('0x35')](_0x26e005[_0xb309('0x31')]['fields']));_0x4b9f90[_0xb309('0x34')]=_0x4b9f90[_0xb309('0x34')][_0xb309('0x36')]?_0x4b9f90[_0xb309('0x34')]:_0x58a00f['model'];if(!_0x26e005[_0xb309('0x31')][_0xb309('0x37')](_0xb309('0x57'))){_0x4b9f90['limit']=qs['limit'](_0x26e005[_0xb309('0x31')][_0xb309('0x21')]);_0x4b9f90[_0xb309('0x1e')]=qs[_0xb309('0x1e')](_0x26e005['query'][_0xb309('0x1e')]);}_0x4b9f90['order']=qs['sort'](_0x26e005[_0xb309('0x31')][_0xb309('0x39')]);_0x4b9f90[_0xb309('0x3a')]=qs[_0xb309('0x32')](_[_0xb309('0x3b')](_0x26e005[_0xb309('0x31')],_0x58a00f[_0xb309('0x32')]));_0x4b9f90[_0xb309('0x3a')][_0xb309('0x58')]=_0x2fd04b['id'];if(_0x26e005[_0xb309('0x31')][_0xb309('0x3c')]){_0x4b9f90['where']=_[_0xb309('0x3d')](_0x4b9f90[_0xb309('0x3a')],{'$or':_[_0xb309('0x2c')](_0x4b9f90[_0xb309('0x34')],function(_0x1a7788){var _0x46ee6a={};_0x46ee6a[_0x1a7788]={'$like':'%'+_0x26e005[_0xb309('0x31')][_0xb309('0x3c')]+'%'};return _0x46ee6a;})});}_0x4b9f90=_[_0xb309('0x3d')]({},_0x4b9f90,_0x26e005['options']);return db[_0xb309('0xc8')][_0xb309('0x20')]({'where':_0x4b9f90[_0xb309('0x3a')]})[_0xb309('0x10')](function(_0x3c577){_0x10f4c5[_0xb309('0x20')]=_0x3c577;if(_0x26e005[_0xb309('0x31')]['includeAll']){_0x4b9f90[_0xb309('0x43')]=[{'all':!![]}];}else{_0x4b9f90['include']=[{'model':db['CmContact'],'as':_0xb309('0xe9'),'required':![]},{'model':db[_0xb309('0xcd')],'as':_0xb309('0x11b'),'required':![]}];}return db[_0xb309('0xc8')][_0xb309('0x44')](_0x4b9f90);})['then'](function(_0x4576a3){_0x10f4c5[_0xb309('0x45')]=_0x4576a3;return _0x10f4c5;});}})[_0xb309('0x10')](respondWithFilteredResult(_0x25ba2d,_0x4b9f90))['catch'](handleError(_0x25ba2d,null));};exports[_0xb309('0x11c')]=function(_0x20ac85,_0x3ecea9){return db[_0xb309('0x41')][_0xb309('0x48')]({'where':{'id':_0x20ac85[_0xb309('0x47')]['id']}})[_0xb309('0x10')](handleEntityNotFound(_0x3ecea9,null))[_0xb309('0x10')](function(_0x357458){if(_0x357458){return _0x357458[_0xb309('0x11c')](_0x20ac85[_0xb309('0x51')]['ids'],_[_0xb309('0x11d')](_0x20ac85['body'],[_0xb309('0x5e'),'id'])||{})[_0xb309('0xc4')](function(_0x3dfc6c){for(var _0x304ea4=0x0;_0x304ea4<_0x20ac85[_0xb309('0x51')][_0xb309('0x5e')][_0xb309('0x36')];_0x304ea4+=0x1){socket[_0xb309('0x11e')](_0xb309('0x11f'),{'UserId':Number(_0x20ac85[_0xb309('0x51')][_0xb309('0x5e')][_0x304ea4]),'ChatWebsiteId':Number(_0x20ac85['params']['id'])});}return _0x3dfc6c;});}})[_0xb309('0x10')](respondWithResult(_0x3ecea9,null))[_0xb309('0x46')](handleError(_0x3ecea9,null));};exports[_0xb309('0x120')]=function(_0x2d7c85,_0x55eb07){return db['ChatWebsite'][_0xb309('0x48')]({'where':{'id':_0x2d7c85[_0xb309('0x47')]['id']}})['then'](handleEntityNotFound(_0x55eb07,null))[_0xb309('0x10')](function(_0x332e34){if(_0x332e34){return _0x332e34[_0xb309('0x120')](_0x2d7c85[_0xb309('0x31')][_0xb309('0x5e')])[_0xb309('0x10')](function(){if(_[_0xb309('0x121')](_0x2d7c85['query']['ids'])){for(var _0x257ae1=0x0;_0x257ae1<_0x2d7c85['query'][_0xb309('0x5e')]['length'];_0x257ae1+=0x1){socket[_0xb309('0x11e')]('userChatWebsite:remove',{'UserId':Number(_0x2d7c85[_0xb309('0x31')][_0xb309('0x5e')][_0x257ae1]),'ChatWebsiteId':Number(_0x2d7c85[_0xb309('0x47')]['id'])});}}else{socket[_0xb309('0x11e')]('userChatWebsite:remove',{'UserId':Number(_0x2d7c85[_0xb309('0x31')]['ids']),'ChatWebsiteId':Number(_0x2d7c85[_0xb309('0x47')]['id'])});}});}})[_0xb309('0x10')](respondWithStatusCode(_0x55eb07,null))[_0xb309('0x46')](handleError(_0x55eb07,null));};exports[_0xb309('0x122')]=function(_0x4c437f,_0x46cc18){var _0x4a0b9a={};var _0x155a9a={};var _0x5c600f;var _0x5013e1;return db[_0xb309('0x41')][_0xb309('0x55')]({'where':{'id':_0x4c437f[_0xb309('0x47')]['id']}})[_0xb309('0x10')](handleEntityNotFound(_0x46cc18,null))[_0xb309('0x10')](function(_0x43dc8c){if(_0x43dc8c){_0x5c600f=_0x43dc8c;_0x155a9a[_0xb309('0x2f')]=_[_0xb309('0x30')](db[_0xb309('0xb4')][_0xb309('0x2d')]);_0x155a9a[_0xb309('0x31')]=_[_0xb309('0x30')](_0x4c437f[_0xb309('0x31')]);_0x155a9a['filters']=_[_0xb309('0x33')](_0x155a9a[_0xb309('0x2f')],_0x155a9a[_0xb309('0x31')]);_0x4a0b9a[_0xb309('0x34')]=_['intersection'](_0x155a9a[_0xb309('0x2f')],qs[_0xb309('0x35')](_0x4c437f['query']['fields']));_0x4a0b9a['attributes']=_0x4a0b9a['attributes'][_0xb309('0x36')]?_0x4a0b9a['attributes']:_0x155a9a['model'];_0x4a0b9a[_0xb309('0x38')]=qs[_0xb309('0x39')](_0x4c437f['query'][_0xb309('0x39')]);_0x4a0b9a[_0xb309('0x3a')]=qs['filters'](_[_0xb309('0x3b')](_0x4c437f[_0xb309('0x31')],_0x155a9a[_0xb309('0x32')]));if(_0x4c437f[_0xb309('0x31')][_0xb309('0x3c')]){_0x4a0b9a[_0xb309('0x3a')]=_[_0xb309('0x3d')](_0x4a0b9a[_0xb309('0x3a')],{'$or':_['map'](_0x4a0b9a[_0xb309('0x34')],function(_0x148896){var _0x22bfca={};_0x22bfca[_0x148896]={'$like':'%'+_0x4c437f[_0xb309('0x31')][_0xb309('0x3c')]+'%'};return _0x22bfca;})});}_0x4a0b9a=_[_0xb309('0x3d')]({},_0x4a0b9a,_0x4c437f[_0xb309('0x40')]);return _0x5c600f[_0xb309('0x122')](_0x4a0b9a);}})[_0xb309('0x10')](function(_0x835b15){if(_0x835b15){_0x5013e1=_0x835b15['length'];if(!_0x4c437f[_0xb309('0x31')]['hasOwnProperty'](_0xb309('0x57'))){_0x4a0b9a[_0xb309('0x21')]=qs['limit'](_0x4c437f[_0xb309('0x31')][_0xb309('0x21')]);_0x4a0b9a[_0xb309('0x1e')]=qs['offset'](_0x4c437f['query'][_0xb309('0x1e')]);}return _0x5c600f['getAgents'](_0x4a0b9a);}})[_0xb309('0x10')](function(_0x3fa92e){if(_0x3fa92e){return _0x3fa92e?{'count':_0x5013e1,'rows':_0x3fa92e}:null;}})[_0xb309('0x10')](respondWithResult(_0x46cc18,null))[_0xb309('0x46')](handleError(_0x46cc18,null));}; \ No newline at end of file +var _0xeced=['systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','agentAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','headers','user-agent','getResult','chat','CmContact','ValidationError','no\x20available\x20attributes','updatedAt','difference','CompanyId','from','Sequelize','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','Applications','account','applications','priority','asc','ListId','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','version','format','%s\x20%s','browser','unknown','device','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','offline','files','send','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline','MailAccount','findOrCreate','readFileSync','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','attachments','offline-chat','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','MailAccountId','toPairsIn','mapValues','subjectOffline','offlineMessageSubject','Chat','NotifyMailAccount','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Owner','fullname','internal','Tags','color','tag','getSnippet','timezone','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','Intervals','License','increment','all','some','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','referer','virtual','replace','render','alignment','verticalAlignment','textColor','color_button','backgroundColor','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','findAndCountAll','finally','getApplications','chatProactiveAction','addProactiveActions','getProactiveActions','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Contact','addAgents','emit','userChatWebsite:remove','getAgents','User','bluebird','mustache','util','lodash','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./chatWebsite.socket','register','client','http','info','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','destroy','then','get','ChatWebsites','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','params','keys','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','getDispositions','Disposition','length','rows','removeDispositions','ids','CannedAnswer','getAnswers','findOne','includeAll','addLogo','sitepic','filename','addAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar'];(function(_0x50da13,_0x45915c){var _0x2b5999=function(_0x2b1f7f){while(--_0x2b1f7f){_0x50da13['push'](_0x50da13['shift']());}};_0x2b5999(++_0x45915c);}(_0xeced,0x1e2));var _0xdece=function(_0x3818e8,_0x127a59){_0x3818e8=_0x3818e8-0x0;var _0x4a6a9=_0xeced[_0x3818e8];return _0x4a6a9;};'use strict';var BPromise=require(_0xdece('0x0'));var Mustache=require(_0xdece('0x1'));var util=require(_0xdece('0x2'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdece('0x3'));var querystring=require(_0xdece('0x4'));var Redis=require('ioredis');var qs=require(_0xdece('0x5'));var logger=require(_0xdece('0x6'))(_0xdece('0x7'));var config=require(_0xdece('0x8'));var db=require(_0xdece('0x9'))['db'];config['redis']=_[_0xdece('0xa')](config[_0xdece('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xdece('0xc'))(new Redis(config[_0xdece('0xb')]));require(_0xdece('0xd'))[_0xdece('0xe')](socket);var jayson=require('jayson/promise');var client=jayson[_0xdece('0xf')][_0xdece('0x10')]({'port':0x232c});var client9002=jayson[_0xdece('0xf')][_0xdece('0x10')]({'port':0x232a});var client9003=jayson['client']['http']({'port':0x232b});var client9001=jayson['client']['http']({'port':0x2329});function respondWithRpcPromise(_0x11681b,_0x8001f4,_0x241640,_0x23c623){return new BPromise(function(_0x3150cf,_0x27e1c){var _0x348448=_0x23c623||client;return _0x348448['request'](_0x11681b,_0x241640)['then'](function(_0x3b5660){logger[_0xdece('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x8001f4,'request\x20sent');logger[_0xdece('0x12')](_0xdece('0x13'),_0x8001f4,_0xdece('0x14'),JSON[_0xdece('0x15')](_0x3b5660));if(_0x3b5660[_0xdece('0x16')]){if(_0x3b5660[_0xdece('0x16')]['code']===0x1f4){logger[_0xdece('0x16')](_0xdece('0x17'),_0x8001f4,_0x3b5660[_0xdece('0x16')][_0xdece('0x18')]);return _0x27e1c(_0x3b5660[_0xdece('0x16')]['message']);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x8001f4,_0x3b5660['error'][_0xdece('0x18')]);return _0x3150cf(_0x3b5660[_0xdece('0x16')]['message']);}else{logger[_0xdece('0x11')](_0xdece('0x17'),_0x8001f4,_0xdece('0x14'));_0x3150cf(_0x3b5660[_0xdece('0x19')][_0xdece('0x18')]);}})[_0xdece('0x1a')](function(_0x112a96){logger[_0xdece('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x8001f4,_0x112a96);_0x27e1c(_0x112a96);});});}function respondWithStatusCode(_0x1fbbac,_0x5b4050){_0x5b4050=_0x5b4050||0xcc;return function(_0x4161b2){if(_0x4161b2){return _0x1fbbac[_0xdece('0x1b')](_0x5b4050);}return _0x1fbbac[_0xdece('0x1c')](_0x5b4050)[_0xdece('0x1d')]();};}function respondWithResult(_0x20e392,_0x3c2945){_0x3c2945=_0x3c2945||0xc8;return function(_0x3d41cc){if(_0x3d41cc){return _0x20e392['status'](_0x3c2945)['json'](_0x3d41cc);}};}function respondWithFilteredResult(_0x1364d9,_0x250da0){return function(_0x4a5ae9){if(_0x4a5ae9){var _0x20f2cf=typeof _0x250da0[_0xdece('0x1e')]===_0xdece('0x1f')&&typeof _0x250da0[_0xdece('0x20')]===_0xdece('0x1f');var _0x1c0ca9=_0x4a5ae9[_0xdece('0x21')];var _0x53c9e0=_0x20f2cf?0x0:_0x250da0['offset'];var _0x5da62a=_0x20f2cf?_0x4a5ae9[_0xdece('0x21')]:_0x250da0['offset']+_0x250da0[_0xdece('0x20')];var _0x359a4e;if(_0x5da62a>=_0x1c0ca9){_0x5da62a=_0x1c0ca9;_0x359a4e=0xc8;}else{_0x359a4e=0xce;}_0x1364d9['status'](_0x359a4e);return _0x1364d9[_0xdece('0x22')](_0xdece('0x23'),_0x53c9e0+'-'+_0x5da62a+'/'+_0x1c0ca9)[_0xdece('0x24')](_0x4a5ae9);}return null;};}function saveUpdates(_0x567424){return function(_0x10868a){if(_0x10868a){return _0x10868a[_0xdece('0x25')](_0x567424)['then'](function(_0x20d463){return _0x20d463;});}return null;};}function removeEntity(_0x4332c3){return function(_0xd5db4a){if(_0xd5db4a){return _0xd5db4a[_0xdece('0x26')]()[_0xdece('0x27')](function(){var _0x728843=_0xd5db4a[_0xdece('0x28')]({'plain':!![]});var _0x427e0f=_0xdece('0x29');return db[_0xdece('0x2a')][_0xdece('0x26')]({'where':{'type':_0x427e0f,'resourceId':_0x728843['id']}})[_0xdece('0x27')](function(){return _0xd5db4a;});})['then'](function(){_0x4332c3[_0xdece('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x520486){return function(_0x2d6bcb){if(!_0x2d6bcb){_0x520486[_0xdece('0x1b')](0x194);}return _0x2d6bcb;};}function handleError(_0x5af92e,_0x48a438){_0x48a438=_0x48a438||0x1f4;return function(_0x3b893e){logger['error'](_0x3b893e[_0xdece('0x2b')]);if(_0x3b893e['name']){delete _0x3b893e[_0xdece('0x2c')];}_0x5af92e[_0xdece('0x1c')](_0x48a438)['send'](_0x3b893e);};}exports[_0xdece('0x2d')]=function(_0x3ab930,_0x250520){var _0x251162={'include':[{'model':db[_0xdece('0x2e')],'as':_0xdece('0x2f')}]},_0x11b2ae={},_0x166c6b={'count':0x0,'rows':[]};var _0x4d3ed2=_[_0xdece('0x30')](db[_0xdece('0x31')][_0xdece('0x32')],function(_0x5d4c43){return{'name':_0x5d4c43[_0xdece('0x33')],'type':_0x5d4c43[_0xdece('0x34')][_0xdece('0x35')]};});_0x11b2ae[_0xdece('0x36')]=_[_0xdece('0x30')](_0x4d3ed2,_0xdece('0x2c'));_0x11b2ae[_0xdece('0x37')]=_['keys'](_0x3ab930[_0xdece('0x37')]);_0x11b2ae[_0xdece('0x38')]=_['intersection'](_0x11b2ae[_0xdece('0x36')],_0x11b2ae[_0xdece('0x37')]);_0x251162[_0xdece('0x39')]=_[_0xdece('0x3a')](_0x11b2ae[_0xdece('0x36')],qs['fields'](_0x3ab930[_0xdece('0x37')]['fields']));_0x251162[_0xdece('0x39')]=_0x251162[_0xdece('0x39')]['length']?_0x251162[_0xdece('0x39')]:_0x11b2ae[_0xdece('0x36')];if(!_0x3ab930['query'][_0xdece('0x3b')](_0xdece('0x3c'))){_0x251162[_0xdece('0x20')]=qs[_0xdece('0x20')](_0x3ab930[_0xdece('0x37')][_0xdece('0x20')]);_0x251162[_0xdece('0x1e')]=qs[_0xdece('0x1e')](_0x3ab930[_0xdece('0x37')][_0xdece('0x1e')]);}_0x251162[_0xdece('0x3d')]=qs[_0xdece('0x3e')](_0x3ab930[_0xdece('0x37')][_0xdece('0x3e')]);_0x251162[_0xdece('0x3f')]=qs[_0xdece('0x38')](_[_0xdece('0x40')](_0x3ab930[_0xdece('0x37')],_0x11b2ae['filters']),_0x4d3ed2);if(_0x3ab930[_0xdece('0x37')]['filter']){_0x251162['where']=_[_0xdece('0x41')](_0x251162['where'],{'$or':_[_0xdece('0x30')](_0x4d3ed2,function(_0x12f2a0){if(_0x12f2a0[_0xdece('0x34')]!==_0xdece('0x42')){var _0x65b829={};_0x65b829[_0x12f2a0['name']]={'$like':'%'+_0x3ab930['query'][_0xdece('0x43')]+'%'};return _0x65b829;}})});}_0x251162=_[_0xdece('0x41')]({},_0x251162,_0x3ab930[_0xdece('0x44')]);var _0x2da674={'where':_0x251162[_0xdece('0x3f')]};return db[_0xdece('0x31')][_0xdece('0x21')](_0x2da674)[_0xdece('0x27')](function(_0x16b2a2){_0x166c6b[_0xdece('0x21')]=_0x16b2a2;if(_0x3ab930[_0xdece('0x37')]['includeAll']){_0x251162[_0xdece('0x45')]=[{'all':!![]}];}return db[_0xdece('0x31')][_0xdece('0x46')](_0x251162);})[_0xdece('0x27')](function(_0x1ec133){_0x166c6b['rows']=_0x1ec133;return _0x166c6b;})[_0xdece('0x27')](respondWithFilteredResult(_0x250520,_0x251162))['catch'](handleError(_0x250520,null));};exports['show']=function(_0x423396,_0x244bbb){var _0x2aff03={'raw':![],'where':{'id':_0x423396[_0xdece('0x47')]['id']},'include':[{'model':db[_0xdece('0x2e')],'as':_0xdece('0x2f')}]},_0x206f1e={};_0x206f1e[_0xdece('0x36')]=_['keys'](db[_0xdece('0x31')][_0xdece('0x32')]);_0x206f1e['query']=_[_0xdece('0x48')](_0x423396[_0xdece('0x37')]);_0x206f1e[_0xdece('0x38')]=_['intersection'](_0x206f1e[_0xdece('0x36')],_0x206f1e[_0xdece('0x37')]);_0x2aff03['attributes']=_['intersection'](_0x206f1e['model'],qs[_0xdece('0x49')](_0x423396[_0xdece('0x37')][_0xdece('0x49')]));_0x2aff03[_0xdece('0x39')]=_0x2aff03['attributes']['length']?_0x2aff03[_0xdece('0x39')]:_0x206f1e[_0xdece('0x36')];if(_0x423396['query']['includeAll']){_0x2aff03['include']=[{'all':!![]}];}_0x2aff03=_[_0xdece('0x41')]({},_0x2aff03,_0x423396[_0xdece('0x44')]);return db[_0xdece('0x31')]['find'](_0x2aff03)[_0xdece('0x27')](handleEntityNotFound(_0x244bbb,null))[_0xdece('0x27')](respondWithResult(_0x244bbb,null))[_0xdece('0x1a')](handleError(_0x244bbb,null));};exports[_0xdece('0x4a')]=function(_0x3d2b32,_0x3718e3){return db[_0xdece('0x31')][_0xdece('0x4a')](_0x3d2b32[_0xdece('0x4b')],{})[_0xdece('0x27')](function(_0x195bcf){var _0x2b1c5d=_0x3d2b32[_0xdece('0x4c')][_0xdece('0x28')]({'plain':!![]});if(!_0x2b1c5d)throw new Error(_0xdece('0x4d'));if(_0x2b1c5d[_0xdece('0x4e')]===_0xdece('0x4c')){var _0x23d4a7=_0x195bcf[_0xdece('0x28')]({'plain':!![]});var _0x3b4631=_0xdece('0x29');return db['UserProfileSection'][_0xdece('0x4f')]({'where':{'name':_0x3b4631,'userProfileId':_0x2b1c5d[_0xdece('0x50')]},'raw':!![]})[_0xdece('0x27')](function(_0x50a042){if(_0x50a042&&_0x50a042[_0xdece('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x23d4a7['name'],'resourceId':_0x23d4a7['id'],'type':_0x50a042[_0xdece('0x2c')],'sectionId':_0x50a042['id']},{})[_0xdece('0x27')](function(){return _0x195bcf;});}else{return _0x195bcf;}})[_0xdece('0x1a')](function(_0x43402f){logger[_0xdece('0x16')](_0xdece('0x52'),_0x43402f);throw _0x43402f;});}return _0x195bcf;})[_0xdece('0x27')](respondWithResult(_0x3718e3,0xc9))[_0xdece('0x1a')](handleError(_0x3718e3,null));};exports['update']=function(_0x3f7a46,_0x2f555e){if(_0x3f7a46[_0xdece('0x4b')]['id']){delete _0x3f7a46[_0xdece('0x4b')]['id'];}return db[_0xdece('0x31')]['find']({'where':{'id':_0x3f7a46['params']['id']},'include':[{'model':db[_0xdece('0x2e')],'as':_0xdece('0x2f')}]})[_0xdece('0x27')](handleEntityNotFound(_0x2f555e,null))[_0xdece('0x27')](saveUpdates(_0x3f7a46['body'],null))[_0xdece('0x27')](respondWithResult(_0x2f555e,null))[_0xdece('0x1a')](handleError(_0x2f555e,null));};exports['destroy']=function(_0x4f0256,_0x4fbed4){return db['ChatWebsite'][_0xdece('0x4f')]({'where':{'id':_0x4f0256['params']['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x4fbed4,null))[_0xdece('0x27')](removeEntity(_0x4fbed4,null))['catch'](handleError(_0x4fbed4,null));};exports[_0xdece('0x53')]=function(_0x2f9aff,_0x381209){return db[_0xdece('0x31')][_0xdece('0x53')]()['then'](respondWithResult(_0x381209,null))[_0xdece('0x1a')](handleError(_0x381209,null));};exports[_0xdece('0x54')]=function(_0x49d1ef,_0x50642b){if(_0x49d1ef[_0xdece('0x4b')]['id']){delete _0x49d1ef[_0xdece('0x4b')]['id'];}return db[_0xdece('0x31')][_0xdece('0x4f')]({'where':{'id':_0x49d1ef[_0xdece('0x47')]['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x50642b,null))['then'](function(_0x339f41){if(_0x339f41){_0x49d1ef[_0xdece('0x4b')][_0xdece('0x55')]=_0x339f41['id'];return db['Disposition']['create'](_0x49d1ef['body']);}})[_0xdece('0x27')](respondWithResult(_0x50642b,null))[_0xdece('0x1a')](handleError(_0x50642b,null));};exports[_0xdece('0x56')]=function(_0x48f53c,_0x408ce3){var _0x38adb8={'raw':![],'where':{}};var _0x566f00={};var _0x3a7d5e={'count':0x0,'rows':[]};return db[_0xdece('0x31')]['findOne']({'where':{'id':_0x48f53c[_0xdece('0x47')]['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x408ce3,null))[_0xdece('0x27')](function(_0x4d805c){if(_0x4d805c){_0x566f00[_0xdece('0x36')]=_['keys'](db[_0xdece('0x57')]['rawAttributes']);_0x566f00[_0xdece('0x37')]=_[_0xdece('0x48')](_0x48f53c[_0xdece('0x37')]);_0x566f00['filters']=_[_0xdece('0x3a')](_0x566f00[_0xdece('0x36')],_0x566f00[_0xdece('0x37')]);_0x38adb8[_0xdece('0x39')]=_['intersection'](_0x566f00[_0xdece('0x36')],qs['fields'](_0x48f53c[_0xdece('0x37')][_0xdece('0x49')]));_0x38adb8['attributes']=_0x38adb8[_0xdece('0x39')][_0xdece('0x58')]?_0x38adb8[_0xdece('0x39')]:_0x566f00[_0xdece('0x36')];if(!_0x48f53c[_0xdece('0x37')]['hasOwnProperty'](_0xdece('0x3c'))){_0x38adb8['limit']=qs[_0xdece('0x20')](_0x48f53c['query']['limit']);_0x38adb8[_0xdece('0x1e')]=qs[_0xdece('0x1e')](_0x48f53c[_0xdece('0x37')][_0xdece('0x1e')]);}_0x38adb8[_0xdece('0x3d')]=qs[_0xdece('0x3e')](_0x48f53c['query'][_0xdece('0x3e')]);_0x38adb8['where']=qs[_0xdece('0x38')](_['pick'](_0x48f53c['query'],_0x566f00[_0xdece('0x38')]));_0x38adb8[_0xdece('0x3f')][_0xdece('0x55')]=_0x4d805c['id'];if(_0x48f53c[_0xdece('0x37')][_0xdece('0x43')]){_0x38adb8['where']=_['merge'](_0x38adb8[_0xdece('0x3f')],{'$or':_[_0xdece('0x30')](_0x38adb8[_0xdece('0x39')],function(_0x1a5e08){var _0x4da96b={};_0x4da96b[_0x1a5e08]={'$like':'%'+_0x48f53c[_0xdece('0x37')][_0xdece('0x43')]+'%'};return _0x4da96b;})});}_0x38adb8=_['merge']({},_0x38adb8,_0x48f53c['options']);return db[_0xdece('0x57')]['count']({'where':_0x38adb8[_0xdece('0x3f')]})[_0xdece('0x27')](function(_0x221611){_0x3a7d5e['count']=_0x221611;if(_0x48f53c[_0xdece('0x37')]['includeAll']){_0x38adb8[_0xdece('0x45')]=[{'all':!![]}];}return db[_0xdece('0x57')][_0xdece('0x46')](_0x38adb8);})[_0xdece('0x27')](function(_0x1d919d){_0x3a7d5e[_0xdece('0x59')]=_0x1d919d;return _0x3a7d5e;});}})[_0xdece('0x27')](respondWithFilteredResult(_0x408ce3,_0x38adb8))[_0xdece('0x1a')](handleError(_0x408ce3,null));};exports[_0xdece('0x5a')]=function(_0x597581,_0x575e6e){return db[_0xdece('0x31')][_0xdece('0x4f')]({'where':{'id':_0x597581[_0xdece('0x47')]['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x575e6e,null))[_0xdece('0x27')](function(_0x17ef37){if(_0x17ef37){return _0x17ef37[_0xdece('0x5a')](_0x597581[_0xdece('0x37')][_0xdece('0x5b')]);}})[_0xdece('0x27')](respondWithStatusCode(_0x575e6e,null))[_0xdece('0x1a')](handleError(_0x575e6e,null));};exports['addAnswer']=function(_0x50044d,_0xb9d6b7){if(_0x50044d[_0xdece('0x4b')]['id']){delete _0x50044d[_0xdece('0x4b')]['id'];}return db['ChatWebsite'][_0xdece('0x4f')]({'where':{'id':_0x50044d['params']['id']}})[_0xdece('0x27')](handleEntityNotFound(_0xb9d6b7,null))[_0xdece('0x27')](function(_0x253338){if(_0x253338){_0x50044d[_0xdece('0x4b')][_0xdece('0x55')]=_0x253338['id'];return db[_0xdece('0x5c')]['create'](_0x50044d[_0xdece('0x4b')]);}})['then'](respondWithResult(_0xb9d6b7,null))[_0xdece('0x1a')](handleError(_0xb9d6b7,null));};exports[_0xdece('0x5d')]=function(_0x45c875,_0x33f8fe){var _0x205ef4={'raw':![],'where':{}};var _0x9fd0fb={};var _0x269fd8={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xdece('0x5e')]({'where':{'id':_0x45c875[_0xdece('0x47')]['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x33f8fe,null))[_0xdece('0x27')](function(_0xb4ce56){if(_0xb4ce56){_0x9fd0fb['model']=_['keys'](db['CannedAnswer'][_0xdece('0x32')]);_0x9fd0fb[_0xdece('0x37')]=_[_0xdece('0x48')](_0x45c875[_0xdece('0x37')]);_0x9fd0fb[_0xdece('0x38')]=_[_0xdece('0x3a')](_0x9fd0fb[_0xdece('0x36')],_0x9fd0fb[_0xdece('0x37')]);_0x205ef4[_0xdece('0x39')]=_['intersection'](_0x9fd0fb[_0xdece('0x36')],qs[_0xdece('0x49')](_0x45c875[_0xdece('0x37')][_0xdece('0x49')]));_0x205ef4[_0xdece('0x39')]=_0x205ef4[_0xdece('0x39')][_0xdece('0x58')]?_0x205ef4[_0xdece('0x39')]:_0x9fd0fb[_0xdece('0x36')];if(!_0x45c875[_0xdece('0x37')]['hasOwnProperty'](_0xdece('0x3c'))){_0x205ef4[_0xdece('0x20')]=qs['limit'](_0x45c875['query'][_0xdece('0x20')]);_0x205ef4['offset']=qs[_0xdece('0x1e')](_0x45c875[_0xdece('0x37')][_0xdece('0x1e')]);}_0x205ef4[_0xdece('0x3d')]=qs[_0xdece('0x3e')](_0x45c875[_0xdece('0x37')][_0xdece('0x3e')]);_0x205ef4[_0xdece('0x3f')]=qs[_0xdece('0x38')](_[_0xdece('0x40')](_0x45c875[_0xdece('0x37')],_0x9fd0fb[_0xdece('0x38')]));_0x205ef4[_0xdece('0x3f')][_0xdece('0x55')]=_0xb4ce56['id'];if(_0x45c875[_0xdece('0x37')]['filter']){_0x205ef4[_0xdece('0x3f')]=_[_0xdece('0x41')](_0x205ef4[_0xdece('0x3f')],{'$or':_[_0xdece('0x30')](_0x205ef4[_0xdece('0x39')],function(_0x542f0c){var _0x1e9bc1={};_0x1e9bc1[_0x542f0c]={'$like':'%'+_0x45c875[_0xdece('0x37')][_0xdece('0x43')]+'%'};return _0x1e9bc1;})});}_0x205ef4=_[_0xdece('0x41')]({},_0x205ef4,_0x45c875['options']);return db['CannedAnswer'][_0xdece('0x21')]({'where':_0x205ef4[_0xdece('0x3f')]})[_0xdece('0x27')](function(_0x35ad45){_0x269fd8[_0xdece('0x21')]=_0x35ad45;if(_0x45c875['query'][_0xdece('0x5f')]){_0x205ef4[_0xdece('0x45')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x205ef4);})[_0xdece('0x27')](function(_0x106ba2){_0x269fd8[_0xdece('0x59')]=_0x106ba2;return _0x269fd8;});}})[_0xdece('0x27')](respondWithFilteredResult(_0x33f8fe,_0x205ef4))['catch'](handleError(_0x33f8fe,null));};exports['removeAnswers']=function(_0x2021c3,_0x384a67){return db[_0xdece('0x31')]['find']({'where':{'id':_0x2021c3[_0xdece('0x47')]['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x384a67,null))[_0xdece('0x27')](function(_0x20fa84){if(_0x20fa84){return _0x20fa84['removeAnswers'](_0x2021c3['query']['ids']);}})[_0xdece('0x27')](respondWithStatusCode(_0x384a67,null))['catch'](handleError(_0x384a67,null));};exports[_0xdece('0x60')]=function(_0x1e619f,_0x2128bf){_0x1e619f['body'][_0xdece('0x61')]=_0x1e619f['file'][_0xdece('0x62')];return db[_0xdece('0x31')][_0xdece('0x4f')]({'where':{'id':_0x1e619f[_0xdece('0x47')]['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x2128bf,null))[_0xdece('0x27')](saveUpdates(_0x1e619f['body'],null))[_0xdece('0x27')](respondWithResult(_0x2128bf,null))[_0xdece('0x1a')](handleError(_0x2128bf,null));};exports[_0xdece('0x63')]=function(_0x31e56d,_0x5ee7ad){_0x31e56d[_0xdece('0x4b')]['agentAvatar']=_0x31e56d[_0xdece('0x64')][_0xdece('0x62')];return db[_0xdece('0x31')]['find']({'where':{'id':_0x31e56d['params']['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x5ee7ad,null))[_0xdece('0x27')](saveUpdates(_0x31e56d['body'],null))[_0xdece('0x27')](respondWithResult(_0x5ee7ad,null))[_0xdece('0x1a')](handleError(_0x5ee7ad,null));};exports[_0xdece('0x65')]=function(_0x234a51,_0x2fdfaa){_0x234a51[_0xdece('0x4b')][_0xdece('0x66')]=_0x234a51[_0xdece('0x64')][_0xdece('0x62')];return db[_0xdece('0x31')][_0xdece('0x4f')]({'where':{'id':_0x234a51[_0xdece('0x47')]['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x2fdfaa,null))[_0xdece('0x27')](saveUpdates(_0x234a51[_0xdece('0x4b')],null))[_0xdece('0x27')](respondWithResult(_0x2fdfaa,null))[_0xdece('0x1a')](handleError(_0x2fdfaa,null));};exports[_0xdece('0x67')]=function(_0x105ac4,_0x29a28e){_0x105ac4[_0xdece('0x4b')][_0xdece('0x68')]=_0x105ac4[_0xdece('0x64')][_0xdece('0x62')];return db[_0xdece('0x31')]['find']({'where':{'id':_0x105ac4[_0xdece('0x47')]['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x29a28e,null))['then'](saveUpdates(_0x105ac4[_0xdece('0x4b')],null))[_0xdece('0x27')](respondWithResult(_0x29a28e,null))[_0xdece('0x1a')](handleError(_0x29a28e,null));};exports[_0xdece('0x69')]=function(_0x31b2f3,_0x40eab5){var _0xf73dfa=path[_0xdece('0x6a')](config[_0xdece('0x6b')],_0xdece('0x6c'));var _0x2623c9={'where':{'id':_0x31b2f3[_0xdece('0x47')]['id']},'attributes':['id',_0xdece('0x61')],'raw':!![]};var _0x2fc86e=![];return require(_0xdece('0x6d'))[_0xdece('0x6e')]()[_0xdece('0x27')](function(_0x544e3a){if(_0x544e3a){_0x2fc86e=_0x544e3a[_0xdece('0x6f')];}})[_0xdece('0x27')](function(){return db[_0xdece('0x31')][_0xdece('0x4f')](_0x2623c9);})[_0xdece('0x27')](handleEntityNotFound(_0x40eab5,null))[_0xdece('0x27')](function(_0x59aa56){if(_0x59aa56){if(!_[_0xdece('0x70')](_0x59aa56[_0xdece('0x61')])){if(fs[_0xdece('0x71')](path[_0xdece('0x6a')](config['root'],_0xdece('0x72'),_0x59aa56[_0xdece('0x61')]))&&_0x2fc86e){_0xf73dfa=path[_0xdece('0x6a')](config['root'],_0xdece('0x72'),_0x59aa56[_0xdece('0x61')]);}}return _0x40eab5[_0xdece('0x73')](_0xf73dfa);}})[_0xdece('0x1a')](handleError(_0x40eab5,null));};exports[_0xdece('0x74')]=function(_0x1c09c6,_0x463500){var _0x4bb690=path[_0xdece('0x6a')](config['root'],'server/files/images/avatars/default_avatar.png');var _0x4cd003={'where':{'id':_0x1c09c6['params']['id']},'attributes':['id',_0xdece('0x75')],'raw':!![]};return db['ChatWebsite'][_0xdece('0x4f')](_0x4cd003)['then'](handleEntityNotFound(_0x463500,null))[_0xdece('0x27')](function(_0x322f91){if(_0x322f91){if(!_[_0xdece('0x70')](_0x322f91['agentAvatar'])){if(fs[_0xdece('0x71')](path[_0xdece('0x6a')](config['root'],_0xdece('0x76'),_0x322f91[_0xdece('0x75')]))){_0x4bb690=path[_0xdece('0x6a')](config['root'],'server/files/images/avatars/',_0x322f91[_0xdece('0x75')]);}}return _0x463500[_0xdece('0x73')](_0x4bb690);}})[_0xdece('0x1a')](handleError(_0x463500,null));};exports[_0xdece('0x77')]=function(_0x4e61cf,_0xd178ec){var _0x5f15f5=path['join'](config[_0xdece('0x6b')],_0xdece('0x78'));var _0x37d86b={'where':{'id':_0x4e61cf[_0xdece('0x47')]['id']},'attributes':['id',_0xdece('0x66'),_0xdece('0x79')],'raw':!![]};return db[_0xdece('0x31')][_0xdece('0x4f')](_0x37d86b)['then'](handleEntityNotFound(_0xd178ec,null))[_0xdece('0x27')](function(_0x15f2d6){if(_0x15f2d6){if(!_['isNil'](_0x15f2d6[_0xdece('0x66')])){if(fs['existsSync'](path[_0xdece('0x6a')](config[_0xdece('0x6b')],_0xdece('0x76'),_0x15f2d6['customerAvatar']))&&_0x15f2d6[_0xdece('0x79')]){_0x5f15f5=path[_0xdece('0x6a')](config['root'],_0xdece('0x76'),_0x15f2d6[_0xdece('0x66')]);}}return _0xd178ec[_0xdece('0x73')](_0x5f15f5);}})['catch'](handleError(_0xd178ec,null));};exports['getSystemAvatar']=function(_0x2b2bf7,_0xfd14dd){var _0x261908=path[_0xdece('0x6a')](config[_0xdece('0x6b')],'server/files/images/avatars/system_avatar.png');var _0x396974={'where':{'id':_0x2b2bf7[_0xdece('0x47')]['id']},'attributes':['id',_0xdece('0x68')],'raw':!![]};return db[_0xdece('0x31')]['find'](_0x396974)[_0xdece('0x27')](handleEntityNotFound(_0xfd14dd,null))[_0xdece('0x27')](function(_0x196167){if(_0x196167){if(!_[_0xdece('0x70')](_0x196167[_0xdece('0x68')])){if(fs[_0xdece('0x71')](path[_0xdece('0x6a')](config[_0xdece('0x6b')],'server/files/images/avatars/',_0x196167[_0xdece('0x68')]))){_0x261908=path[_0xdece('0x6a')](config['root'],_0xdece('0x76'),_0x196167[_0xdece('0x68')]);}}return _0xfd14dd[_0xdece('0x73')](_0x261908);}})['catch'](handleError(_0xfd14dd,null));};exports['notify']=function(_0x534ad7,_0x4bba23){var _0x5ccf62=require('user-agent-parser');var _0x40d4f0=new _0x5ccf62();var _0xd1c76=_0x40d4f0['setUA'](_0x534ad7[_0xdece('0x7a')][_0xdece('0x7b')])[_0xdece('0x7c')]();var _0x485efa={'body':_0x534ad7['body'],'channel':_0xdece('0x7d')};var _0xe14b6e=[];var _0x2838e6=[];var _0x480db5={};var _0x38c3b9=![];return db[_0xdece('0x7e')][_0xdece('0x53')]()[_0xdece('0x27')](function(_0x4393ef){if(!_0x4393ef){throw new db['Sequelize'][(_0xdece('0x7f'))](_0xdece('0x80'));}_0xe14b6e=_['difference'](_[_0xdece('0x48')](_0x4393ef),['createdAt',_0xdece('0x81')]);_0x2838e6=_[_0xdece('0x82')](_['keys'](_0x4393ef),['createdAt','updatedAt',_0xdece('0x83'),'ListId']);if(_0x534ad7[_0xdece('0x4b')]['id']){delete _0x534ad7[_0xdece('0x4b')]['id'];}if(_[_0xdece('0x70')](_0x534ad7[_0xdece('0x4b')][_0xdece('0x84')])){throw new db[(_0xdece('0x85'))][(_0xdece('0x7f'))]('from\x20is\x20mandatory');}if(_[_0xdece('0x70')](_0x534ad7[_0xdece('0x4b')][_0xdece('0x4b')])||_0x534ad7[_0xdece('0x4b')][_0xdece('0x4b')]===''){throw new db[(_0xdece('0x85'))][(_0xdece('0x7f'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xdece('0x70')](_0x534ad7['body'][_0xdece('0x86')])){throw new db[(_0xdece('0x85'))][(_0xdece('0x7f'))](_0xdece('0x87')+_0x2838e6);}if(!_['includes'](_0x2838e6,_0x534ad7[_0xdece('0x4b')]['mapKey'])){throw new db['Sequelize'][(_0xdece('0x7f'))](_0xdece('0x88')+_0x2838e6);}_0x480db5[_0x534ad7[_0xdece('0x4b')][_0xdece('0x86')]]=_0x534ad7[_0xdece('0x4b')][_0xdece('0x84')];})[_0xdece('0x27')](function(){return db['ChatWebsite'][_0xdece('0x4f')]({'where':{'id':_0x534ad7[_0xdece('0x47')]['id']},'include':[{'model':db[_0xdece('0x89')],'as':_0xdece('0x8a'),'include':[{'model':db['CmContact'],'as':_0xdece('0x8b'),'where':_0x480db5,'limit':0x1,'order':[['updatedAt',_0xdece('0x8c')]]}]},{'model':db['ChatApplication'],'as':_0xdece('0x8d')}]});})[_0xdece('0x27')](handleEntityNotFound(_0x4bba23,null))[_0xdece('0x27')](function(_0x9e438a){if(_0x9e438a&&_0x9e438a[_0xdece('0x8a')]){_0x485efa[_0xdece('0x8e')]=_0x9e438a;_0x485efa[_0xdece('0x8f')]=_0x9e438a['Applications'];_0x485efa['list']=_0x9e438a['List'];_0x485efa[_0xdece('0x8f')]=_['orderBy'](_0x485efa['applications'],[_0xdece('0x90')],[_0xdece('0x91')]);if(_0x485efa[_0xdece('0x8e')][_0xdece('0x8d')]){delete _0x485efa[_0xdece('0x8e')]['Applications'];}if(_0x485efa[_0xdece('0x8e')]['List']&&_0x485efa[_0xdece('0x8e')][_0xdece('0x8a')][_0xdece('0x8b')][_0xdece('0x58')]){return _0x485efa[_0xdece('0x8e')][_0xdece('0x8a')]['Contacts'][0x0];}var _0x48e46d=_[_0xdece('0xa')](_0x534ad7[_0xdece('0x4b')],{'firstName':_0x534ad7[_0xdece('0x4b')][_0xdece('0x84')],'ListId':_0x9e438a[_0xdece('0x92')]});_0x48e46d[_0x534ad7[_0xdece('0x4b')][_0xdece('0x86')]]=_0x534ad7['body']['from'];return db[_0xdece('0x7e')]['create'](_0x48e46d,{'fields':_0xe14b6e,'raw':!![]});}})[_0xdece('0x27')](handleEntityNotFound(_0x4bba23,null))[_0xdece('0x27')](function(_0x1958a6){_0x485efa[_0xdece('0x93')]=_0x1958a6;var _0x352318=_0x534ad7[_0xdece('0x4b')][_0xdece('0x94')];if(_0x534ad7[_0xdece('0x7a')][_0xdece('0x95')]){_0x352318=_0x534ad7[_0xdece('0x7a')][_0xdece('0x95')];}else if(_0x534ad7[_0xdece('0x7a')][_0xdece('0x96')]){_0x352318=_['first'](_0x534ad7[_0xdece('0x7a')][_0xdece('0x96')][_0xdece('0x97')](','));}if(_0x1958a6){var _0x41fdfc={'ContactId':_0x1958a6['id'],'ChatWebsiteId':_0x534ad7[_0xdece('0x47')]['id'],'from':(_0x1958a6[_0xdece('0x98')]||'')+'\x20'+(_0x1958a6[_0xdece('0x99')]||''),'customerIp':_0x352318,'customerPort':_0x534ad7[_0xdece('0x7a')][_0xdece('0x9a')]?_0x534ad7['headers'][_0xdece('0x9a')]:null,'referer':_0x534ad7[_0xdece('0x4b')]['referer'],'browserName':_0xd1c76['browser'][_0xdece('0x2c')]&&_0xd1c76['browser'][_0xdece('0x9b')]?util[_0xdece('0x9c')](_0xdece('0x9d'),_0xd1c76[_0xdece('0x9e')][_0xdece('0x2c')],_0xd1c76[_0xdece('0x9e')][_0xdece('0x9b')]):_0xdece('0x9f'),'browserVersion':_0xd1c76[_0xdece('0x9e')]['version']||'unknown','osName':util['format'](_0xdece('0x9d'),_0xd1c76['os']['name'],_0xd1c76['os']['version']),'osVersion':_0xd1c76['os']['version'],'deviceModel':_0xd1c76[_0xdece('0xa0')][_0xdece('0x36')]&&_0xd1c76[_0xdece('0xa0')]['vendor']?util[_0xdece('0x9c')](_0xdece('0xa1'),_0xd1c76['device']['model'],_0xd1c76[_0xdece('0xa0')]['vendor'],_0xd1c76[_0xdece('0xa0')][_0xdece('0x34')]):null,'deviceVendor':_0xd1c76[_0xdece('0xa0')]['vendor'],'deviceType':_0xd1c76[_0xdece('0xa0')]['type'],'formData':JSON[_0xdece('0x15')](_0x534ad7['body'])};var _0x106a41={'ChatWebsiteId':_0x534ad7[_0xdece('0x47')]['id'],'closed':![]};if(_0x534ad7['body'][_0xdece('0xa2')]){_0x106a41[_0xdece('0xa2')]=_0x534ad7['body'][_0xdece('0xa2')];return db[_0xdece('0xa3')]['find']({'where':_0x106a41})['then'](function(_0x487bd1){if(_0x487bd1){return[_0x487bd1,![]];}_0x41fdfc[_0xdece('0xa2')]=_0x534ad7[_0xdece('0x4b')][_0xdece('0xa2')];_0x41fdfc[_0xdece('0xa4')]=_0x534ad7['body'][_0xdece('0xa4')];return db[_0xdece('0xa3')][_0xdece('0x4a')](_0x41fdfc)['then'](function(_0x13458e){return[_0x13458e,!![]];});});}_0x106a41[_0xdece('0xa5')]=_0x1958a6['id'];if(_0x534ad7[_0xdece('0x4b')][_0xdece('0xa6')]&&_0x534ad7[_0xdece('0x4b')][_0xdece('0xa6')]['id']){_0x106a41['id']=_0x534ad7[_0xdece('0x4b')][_0xdece('0xa6')]['id'];return db[_0xdece('0xa3')][_0xdece('0x4f')]({'where':_0x106a41})[_0xdece('0x27')](function(_0x2a53f4){if(_0x2a53f4){return[_0x2a53f4,![]];}return db[_0xdece('0xa3')][_0xdece('0x4a')](_0x41fdfc)['then'](function(_0x1143a0){return[_0x1143a0,!![]];});});}return db[_0xdece('0xa3')][_0xdece('0x4a')](_0x41fdfc)[_0xdece('0x27')](function(_0x1aa00b){return[_0x1aa00b,!![]];});}})[_0xdece('0xa7')](function(_0x3a937d,_0x4276ad){if(_0x3a937d){_0x38c3b9=_0x4276ad;if(!_0x4276ad){var _0x58bc1e={'from':(_0x485efa[_0xdece('0x93')][_0xdece('0x98')]||'')+'\x20'+(_0x485efa[_0xdece('0x93')]['lastName']||'')};if(_0x534ad7['body'][_0xdece('0xa2')]&&_0x534ad7[_0xdece('0x4b')][_0xdece('0xa8')]&&_0x534ad7[_0xdece('0x4b')]['threadId']!=_0x534ad7[_0xdece('0x4b')][_0xdece('0xa8')]){_0x58bc1e['threadId']=_0x534ad7[_0xdece('0x4b')][_0xdece('0xa8')];}return _0x3a937d['update'](_0x58bc1e);}else{return _0x3a937d;}}})[_0xdece('0x27')](function(_0x1fe3bd){_0x485efa[_0xdece('0xa6')]=_0x1fe3bd[_0xdece('0x28')]({'plain':!![]});_0x485efa[_0xdece('0xa6')]['created']=_0x38c3b9;if(_0x485efa['interaction'][_0xdece('0xa9')]){if(_0x485efa[_0xdece('0x8e')][_0xdece('0xaa')]){_0x485efa[_0xdece('0x8f')][_0xdece('0xab')]({'id':0x0,'priority':_0x485efa[_0xdece('0x8f')][_0xdece('0x58')]+0x1,'app':_0xdece('0xac'),'appdata':_0xdece('0xad'),'interval':_0xdece('0xae')});}}return db[_0xdece('0xaf')][_0xdece('0x4a')]({'body':_0x534ad7[_0xdece('0x4b')][_0xdece('0x4b')],'ChatWebsiteId':_0x534ad7[_0xdece('0x47')]['id'],'ChatInteractionId':_0x1fe3bd['id'],'direction':'in','ContactId':_0x485efa[_0xdece('0x93')]['id'],'AttachmentId':_0x534ad7['body'][_0xdece('0xb0')]});})[_0xdece('0x27')](function(_0x3ae8d9){_0x485efa[_0xdece('0x18')]=_0x3ae8d9;if(_0x485efa[_0xdece('0xa6')][_0xdece('0xb1')]){return db['User']['find']({'attributes':['id',_0xdece('0x2c')],'where':{'id':_0x485efa[_0xdece('0xa6')]['UserId']}})[_0xdece('0x27')](function(_0x558d99){if(_0x558d99){_0x485efa[_0xdece('0x8f')]['unshift']({'id':0x0,'priority':0x0,'app':_0xdece('0xb2'),'appdata':_0x558d99['name']+','+(_0x485efa[_0xdece('0x8e')][_0xdece('0xb3')]||0xa),'interval':_0xdece('0xae')});_0x485efa[_0xdece('0xb4')]=!![];}return respondWithRpcPromise(_0xdece('0xb5'),_0xdece('0xb6'),_0x485efa);});}return respondWithRpcPromise(_0xdece('0xb5'),_0xdece('0xb6'),_0x485efa);})[_0xdece('0x27')](function(_0x472877){respondWithRpcPromise(_0xdece('0xb7'),_0xdece('0xb7'),{'event':_0xdece('0xb8'),'message':_0x472877},client9002);return _0x472877;})['then'](respondWithResult(_0x4bba23,null))[_0xdece('0x1a')](handleError(_0x4bba23,null));};exports[_0xdece('0xb9')]=function(_0x5065e1,_0x3d32b2){var _0x4efff4,_0x43c12a,_0x270883;var _0x2b80d2=[];var _0x324202={};var _0x45d1aa=_0x5065e1[_0xdece('0xba')]||[];var _0x173d5d=[];var _0x119fe0;return db[_0xdece('0x7e')]['describe']()[_0xdece('0x27')](function(_0x410a86){if(!_0x410a86){throw new db[(_0xdece('0x85'))]['ValidationError'](_0xdece('0x80'));}_0x2b80d2=_[_0xdece('0x82')](_[_0xdece('0x48')](_0x410a86),['createdAt',_0xdece('0x81'),_0xdece('0x83'),_0xdece('0x92')]);if(_0x5065e1['body']['id']){delete _0x5065e1['body']['id'];}if(_[_0xdece('0x70')](_0x5065e1[_0xdece('0x4b')][_0xdece('0x84')])){throw _0x3d32b2[_0xdece('0x1c')](0x1f4)[_0xdece('0xbb')](new db[(_0xdece('0x85'))][(_0xdece('0x7f'))](_0xdece('0xbc')));}if(_[_0xdece('0x70')](_0x5065e1[_0xdece('0x4b')][_0xdece('0x4b')])||_0x5065e1[_0xdece('0x4b')]['body']===''){throw _0x3d32b2[_0xdece('0x1c')](0x1f4)['send'](new db[(_0xdece('0x85'))]['ValidationError'](_0xdece('0xbd')));}if(_['isNil'](_0x5065e1['body']['mapKeyOffline'])){throw _0x3d32b2[_0xdece('0x1c')](0x1f4)[_0xdece('0xbb')](new db[(_0xdece('0x85'))][(_0xdece('0x7f'))](_0xdece('0xbe')+_0x2b80d2));}if(!_[_0xdece('0xbf')](_0x2b80d2,_0x5065e1[_0xdece('0x4b')][_0xdece('0xc0')])){throw _0x3d32b2[_0xdece('0x1c')](0x1f4)[_0xdece('0xbb')](new db[(_0xdece('0x85'))][(_0xdece('0x7f'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2b80d2));}_0x324202[_0x5065e1['body'][_0xdece('0xc0')]]=_0x5065e1[_0xdece('0x4b')][_0xdece('0x84')];})[_0xdece('0x27')](function(){return db['ChatWebsite'][_0xdece('0x4f')]({'where':{'id':_0x5065e1['params']['id']},'include':[{'model':db['CmList'],'as':_0xdece('0x8a')},{'model':db[_0xdece('0xc1')],'as':_0xdece('0xc1')}]});})['then'](handleEntityNotFound(_0x3d32b2,null))[_0xdece('0x27')](function(_0x506bce){if(_0x506bce&&_0x506bce[_0xdece('0x8a')]){_0x43c12a=_0x506bce;var _0x44dbe4=_[_0xdece('0xa')](_0x5065e1[_0xdece('0x4b')],{'firstName':_0x5065e1[_0xdece('0x4b')][_0xdece('0x84')],'phone':_0x5065e1[_0xdece('0x4b')][_0xdece('0x84')],'ListId':_0x506bce[_0xdece('0x92')]});_0x44dbe4[_0x5065e1[_0xdece('0x4b')][_0xdece('0xc0')]]=_0x5065e1[_0xdece('0x4b')][_0xdece('0x84')];return db[_0xdece('0x7e')][_0xdece('0xc2')]({'where':_0x324202,'defaults':_0x44dbe4});}})[_0xdece('0xa7')](function(_0x19b464){if(_0x19b464){_0x270883=_0x19b464;var _0x308616=fs[_0xdece('0xc3')](path[_0xdece('0x6a')](config[_0xdece('0x6b')],'server/files/templates/chatOfflineMessage.ejs'),_0xdece('0xc4'));var _0x2551e7=ejs['render'](_0x308616,{'body':_[_0xdece('0xc5')](_0x5065e1[_0xdece('0x4b')][_0xdece('0x4b')]),'bodyTitle':_0x43c12a[_0xdece('0xc6')]});return db[_0xdece('0xc7')][_0xdece('0x4a')]({'body':_0x2551e7,'ContactId':_0x19b464['id'],'ChatWebsiteId':_0x43c12a['id']});}})['then'](function(_0x4c3a70){_0x119fe0=_0x4c3a70;if(_0x45d1aa[_0xdece('0x58')]){var _0x58ffc2=_0x45d1aa[_0xdece('0x30')](function(_0x41efa7){return{'name':_0x41efa7[_0xdece('0xc8')],'basename':_0x41efa7[_0xdece('0x62')],'type':_0x41efa7[_0xdece('0xc9')],'ChatOfflineMessageId':_0x4c3a70['id']};});_0x173d5d=_0x58ffc2[_0xdece('0x30')](_0x3389d5=>{var _0x4746c5={'filename':_0x3389d5[_0xdece('0x2c')],'path':path[_0xdece('0x6a')](config[_0xdece('0x6b')],_0xdece('0xca'),_0xdece('0xba'),_0xdece('0xcb'),_0xdece('0xcc'),_0x3389d5['basename'])};return _0x4746c5;});if(!_0x43c12a[_0xdece('0xcd')]){return db[_0xdece('0xce')][_0xdece('0xcf')](function(_0x2b7aaf){return db[_0xdece('0xd0')][_0xdece('0xd1')](_0x58ffc2,{'transaction':_0x2b7aaf});});}}})[_0xdece('0x27')](function(){if(_0x119fe0){_0x4efff4=_0x119fe0;return db['MailAccount']['findOne']({'where':{'active':!![]},'include':[{'model':db[_0xdece('0xd2')],'as':'Smtp','raw':!![]}]});}})[_0xdece('0x27')](function(_0x4576a7){if(_0x4576a7&&_0x4576a7[_0xdece('0xd3')]&&_0x43c12a[_0xdece('0xd4')]&&_0x43c12a[_0xdece('0xd5')]){var _0x2ee9de={'tls':{'rejectUnauthorized':![]}};if(_0x4576a7[_0xdece('0xd3')][_0xdece('0xd6')]){_0x2ee9de[_0xdece('0xd6')]=_0x4576a7['Smtp'][_0xdece('0xd6')];}else{_0x2ee9de['host']=_0x4576a7['Smtp'][_0xdece('0xd7')];_0x2ee9de[_0xdece('0xd8')]=_0x4576a7[_0xdece('0xd3')][_0xdece('0xd8')];_0x2ee9de['secure']=_0x4576a7['Smtp']['secure'];}if(_0x4576a7['Smtp'][_0xdece('0xd9')]){_0x2ee9de[_0xdece('0xda')]={'user':_0x4576a7['Smtp']['user'],'pass':_0x4576a7[_0xdece('0xd3')][_0xdece('0xdb')]};}return respondWithRpcPromise(_0xdece('0xdc'),_0xdece('0xdd'),{'account':_0x2ee9de,'message':{'from':util['format'](_0xdece('0xde'),_0x4576a7[_0xdece('0x2c')],_0x4576a7[_0xdece('0xdf')]||_0x4576a7['Smtp']['user']),'to':_0x43c12a[_0xdece('0xd5')],'subject':_0x43c12a['offlineMessageSubject'],'html':_0x4efff4[_0xdece('0x4b')],'attachments':_0x173d5d}},client9003)[_0xdece('0x27')](function(){return _0x4efff4;})[_0xdece('0x1a')](function(_0x4e13ff){console[_0xdece('0x16')](_0x4e13ff);});}})[_0xdece('0x27')](function(){if(_0x43c12a&&_0x43c12a[_0xdece('0xcd')]&&_0x43c12a[_0xdece('0xe0')]){var _0x1a93de=[];if(_0x45d1aa[_0xdece('0x58')]){_0x1a93de=_0x45d1aa[_0xdece('0x30')](function(_0x1aa321){return{'name':_0x1aa321[_0xdece('0xc8')],'basename':_0x1aa321[_0xdece('0x62')],'type':_0x1aa321[_0xdece('0xc9')],'ChatOfflineMessageId':_0x119fe0['id']};});}var _0x5526d9;if(!_[_0xdece('0x70')](_0x43c12a['subjectOffline'])){var _0x312e66=_[_0xdece('0x30')](_0x5065e1[_0xdece('0x4b')],function(_0x11d4ba){return _0x11d4ba;});var _0x57bf15=_[_0xdece('0xe1')](_0x312e66)[0x0];var _0x305e9c=_[_0xdece('0xe2')](_0x57bf15,function(_0x5519e4){return _0x5519e4;});_0x5526d9=_0x305e9c[0x1][_0x43c12a[_0xdece('0xe3')]];}var _0x3d1984={'from':_0x270883[_0xdece('0xdf')],'firstName':_0x270883[_0xdece('0x98')],'lastName':_0x270883['lastName'],'mapKey':'email','message':{'from':_0x270883[_0xdece('0xdf')],'to':_0x43c12a[_0xdece('0xc1')][_0xdece('0xdf')],'cc':'','subject':_['isNil'](_0x5526d9)?_0x43c12a[_0xdece('0xe4')]:_0x5526d9,'messageId':'','sentAt':new Date(),'attach':_0x1a93de[_0xdece('0x58')],'attachments':_0x1a93de,'originChannel':_0xdece('0xe5'),'ChatWebsiteId':_0x43c12a['id'],'ChatOfflineMessageId':_0x4efff4['id'],'originTo':_0x43c12a[_0xdece('0xc1')][_0xdece('0xdf')]},'body':_0x4efff4[_0xdece('0x4b')]};var _0x3c7c19={'account':{'id':_0x43c12a[_0xdece('0xe0')]},'body':_0x3d1984,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xdece('0xe6'),'notifyMail',_0x3c7c19,client9001)['then'](function(){return _0x4efff4;})['catch'](function(_0xced384){console['error'](_0xced384);});}return;})[_0xdece('0x27')](function(){if(_0x4efff4){return _0x4efff4;}})[_0xdece('0x27')](respondWithResult(_0x3d32b2,null))[_0xdece('0x1a')](function(_0x955ddd){console[_0xdece('0x16')](_0xdece('0x1a'),_0x955ddd);for(var _0x144107 of _0x45d1aa){var _0x10c1f2=path[_0xdece('0x6a')](config[_0xdece('0x6b')],_0xdece('0xca'),_0xdece('0xba'),_0xdece('0xcb'),'offline-chat',_0x144107['filename']);fs_extra['remove'](_0x10c1f2)[_0xdece('0x1a')](function(_0xc78e7c){console[_0xdece('0x16')](_0xdece('0xe7'),_0x10c1f2,_0xc78e7c);});}});};exports[_0xdece('0xe8')]=function(_0x7e24ff,_0x2944ea){return db[_0xdece('0xa3')][_0xdece('0x4f')]({'where':{'id':_0x7e24ff['params']['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x2944ea,null))[_0xdece('0x27')](function(_0x403d9b){if(_0x403d9b){return _0x403d9b[_0xdece('0xe8')](_0x7e24ff[_0xdece('0x4b')][_0xdece('0x5b')],_[_0xdece('0xe9')](_0x7e24ff['body'],[_0xdece('0x5b'),'id'])||{});}})[_0xdece('0x27')](respondWithResult(_0x2944ea,null))[_0xdece('0x1a')](handleError(_0x2944ea,null));};exports[_0xdece('0xea')]=function(_0x357f6b,_0x463f6f){var _0x485558={'raw':![],'where':{}};var _0x3bbb9f={};var _0x38d7b5={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x357f6b[_0xdece('0x47')]['id']}})['then'](handleEntityNotFound(_0x463f6f,null))[_0xdece('0x27')](function(_0x45d9d3){if(_0x45d9d3){_0x3bbb9f[_0xdece('0x36')]=_['keys'](db[_0xdece('0xa3')]['rawAttributes']);_0x3bbb9f[_0xdece('0x37')]=_[_0xdece('0x48')](_0x357f6b[_0xdece('0x37')]);_0x3bbb9f[_0xdece('0x38')]=_[_0xdece('0x3a')](_0x3bbb9f[_0xdece('0x36')],_0x3bbb9f[_0xdece('0x37')]);_0x485558[_0xdece('0x39')]=_[_0xdece('0x3a')](_0x3bbb9f[_0xdece('0x36')],qs[_0xdece('0x49')](_0x357f6b[_0xdece('0x37')]['fields']));_0x485558[_0xdece('0x39')]=_0x485558['attributes']['length']?_0x485558[_0xdece('0x39')]:_0x3bbb9f[_0xdece('0x36')];if(!_0x357f6b[_0xdece('0x37')][_0xdece('0x3b')](_0xdece('0x3c'))){_0x485558[_0xdece('0x20')]=qs[_0xdece('0x20')](_0x357f6b[_0xdece('0x37')][_0xdece('0x20')]);_0x485558['offset']=qs[_0xdece('0x1e')](_0x357f6b[_0xdece('0x37')][_0xdece('0x1e')]);}_0x485558[_0xdece('0x3d')]=qs[_0xdece('0x3e')](_0x357f6b[_0xdece('0x37')][_0xdece('0x3e')]);_0x485558['where']=qs[_0xdece('0x38')](_[_0xdece('0x40')](_0x357f6b[_0xdece('0x37')],_0x3bbb9f['filters']));_0x485558[_0xdece('0x3f')][_0xdece('0x55')]=_0x45d9d3['id'];if(_0x357f6b[_0xdece('0x37')]['filter']){_0x485558[_0xdece('0x3f')]=_[_0xdece('0x41')](_0x485558[_0xdece('0x3f')],{'$or':_[_0xdece('0x30')](_0x485558[_0xdece('0x39')],function(_0x2c7145){var _0xf2deee={};_0xf2deee[_0x2c7145]={'$like':'%'+_0x357f6b[_0xdece('0x37')][_0xdece('0x43')]+'%'};return _0xf2deee;})});}_0x485558=_[_0xdece('0x41')]({},_0x485558,_0x357f6b[_0xdece('0x44')]);return db['ChatInteraction'][_0xdece('0x21')]({'where':_0x485558[_0xdece('0x3f')]})[_0xdece('0x27')](function(_0x2fcced){_0x38d7b5['count']=_0x2fcced;if(_0x357f6b['query']['includeAll']){_0x485558['include']=[{'model':db[_0xdece('0x7e')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xdece('0xeb'),'attributes':[_0xdece('0x2c'),_0xdece('0xec'),_0xdece('0xed')],'required':![]},{'model':db['Tag'],'as':_0xdece('0xee'),'attributes':['id',_0xdece('0x2c'),_0xdece('0xef')],'where':_0x357f6b[_0xdece('0x37')][_0xdece('0xf0')]?{'id':_0x357f6b[_0xdece('0x37')][_0xdece('0xf0')]}:undefined,'required':_0x357f6b['query'][_0xdece('0xf0')]?!![]:![]}];}return db[_0xdece('0xa3')]['findAll'](_0x485558);})['then'](function(_0x402c52){_0x38d7b5[_0xdece('0x59')]=_0x402c52;return _0x38d7b5;});}})[_0xdece('0x27')](respondWithFilteredResult(_0x463f6f,_0x485558))[_0xdece('0x1a')](handleError(_0x463f6f,null));};function iftimePromise(_0x5a8292,_0x2bfc17){return respondWithRpcPromise('Command',_0xdece('0xf1'),{'command':_0x2bfc17[_0xdece('0xf2')]?util['format']('iftime\x20%s,%s',_0x5a8292[_0xdece('0xf3')],_0x2bfc17[_0xdece('0xf2')]):util[_0xdece('0x9c')](_0xdece('0xf4'),_0x5a8292[_0xdece('0xf3')])},client9002)[_0xdece('0x27')](function(_0x1aaab6){var _0x3513f0=_0x1aaab6&&_0x1aaab6[_0xdece('0xf5')](_0xdece('0xf6'))>=0x0?!![]:![];logger[_0xdece('0x11')](_0xdece('0xf7'),_0x2bfc17['id'],_0x5a8292['id'],_0x5a8292['interval'],_0x3513f0?'ONLINE':'OFFLINE',_0x2bfc17[_0xdece('0xf2')]?_0x2bfc17[_0xdece('0xf2')]:'No\x20timezone');return _0x3513f0;})[_0xdece('0x1a')](function(_0x2c2389){logger['error'](_0xdece('0xf7'),_0x2bfc17['id'],_0x5a8292['id'],_0x5a8292[_0xdece('0xf3')],util[_0xdece('0xf8')](_0x2c2389,{'showHidden':![],'depth':null}),_0x2bfc17[_0xdece('0xf2')]?_0x2bfc17[_0xdece('0xf2')]:'No\x20timezone');return![];});}exports[_0xdece('0xf1')]=function(_0x4a393a,_0x528be6){var _0x26a092=0x0;var _0x4d8d6b=0x0;var _0x34ec78=![];var _0x47c86f;var _0x54e94c;return db[_0xdece('0x31')]['find']({'where':{'id':_0x4a393a[_0xdece('0x47')]['id']},'include':[{'model':db[_0xdece('0xf9')],'as':_0xdece('0xf9'),'include':[{'model':db[_0xdece('0xf9')],'as':_0xdece('0xfa'),'attributes':['id',_0xdece('0xf3')],'raw':!![]}]}]})[_0xdece('0x27')](handleEntityNotFound(_0x528be6,null))[_0xdece('0x27')](function(_0x27821b){if(_0x27821b){_0x47c86f=_0x27821b;return _0x27821b['getProactiveActions']({'raw':!![]});}})[_0xdece('0x27')](function(_0x4bef23){if(_0x47c86f){if(_0x4bef23){_0x54e94c=_0x4bef23;}}return require(_0xdece('0x6d'))[_0xdece('0x6e')]();})[_0xdece('0x27')](function(_0x118c53){if(_0x118c53){_0x4d8d6b=_0x118c53['virtual'];_0x34ec78=_0x118c53[_0xdece('0x6f')];}})[_0xdece('0x27')](function(){return db[_0xdece('0xa3')][_0xdece('0x21')]({'where':{'closed':![]}});})[_0xdece('0x27')](function(_0x2402af){_0x26a092=_0x2402af;if(_0x4d8d6b&&_0x2402af>_0x4d8d6b){return db[_0xdece('0xfb')][_0xdece('0x5e')]({'where':{'id':0x1}})['then'](function(_0x53d05d){if(_0x53d05d){_0x53d05d[_0xdece('0xfc')]('chatLicenseExceeded');}});}})[_0xdece('0x27')](function(){if(_0x47c86f['Interval']&&_0x47c86f[_0xdece('0xf9')][_0xdece('0xfa')]){var _0x4c01e8=[];for(var _0x551104=0x0;_0x551104<_0x47c86f[_0xdece('0xf9')][_0xdece('0xfa')]['length'];_0x551104++){var _0x272bfc=_0x47c86f['Interval']['Intervals'][_0x551104][_0xdece('0x28')]({'plain':!![]});_0x4c01e8[_0xdece('0xab')](iftimePromise(_0x272bfc,_0x47c86f));}return BPromise[_0xdece('0xfd')](_0x4c01e8)[_0xdece('0x27')](function(_0x60e630){return _[_0xdece('0xfe')](_0x60e630);});}else{return!![];}})[_0xdece('0x27')](function(_0xa70643){var _0x2b6ccc=fs[_0xdece('0xc3')](path[_0xdece('0x6a')](config[_0xdece('0x6b')],_0xdece('0xff')),_0xdece('0xc4'));var _0x359f9b={'remote':_0x47c86f[_0xdece('0x100')],'query':querystring['stringify'](_[_0xdece('0x41')](_0x47c86f[_0xdece('0x28')]({'plain':!![]}),{'customerIp':_0x4a393a[_0xdece('0x7a')][_0xdece('0x96')]||_0x4a393a['headers'][_0xdece('0x101')]||_0x4a393a[_0xdece('0x102')][_0xdece('0x103')]||_0x4a393a['ip'],'referer':_0x4a393a[_0xdece('0x7a')][_0xdece('0x104')],'openedInteractions':_0x26a092,'maxInteractions':_0x4d8d6b,'virtual':_0x34ec78[_0xdece('0x105')],'online':_0xa70643,'custom':_0x34ec78}))[_0xdece('0x106')](/'/g,'\x5c\x27')};_0x528be6['send'](ejs[_0xdece('0x107')](Mustache[_0xdece('0x107')](_0x2b6ccc,_0x359f9b),{'proactiveActions':_0x54e94c,'alignment':_0x47c86f[_0xdece('0x108')],'verticalAlignment':_0x47c86f[_0xdece('0x109')],'div_color':_0x47c86f[_0xdece('0xef')],'text_color':_0x47c86f[_0xdece('0x10a')],'button_color':_0x47c86f[_0xdece('0x10b')],'background_color':_0x47c86f[_0xdece('0x10c')]}));})[_0xdece('0x1a')](handleError(_0x528be6,null));};exports[_0xdece('0x10d')]=function(_0x2042d8,_0x46f25d){var _0xba7e99=_0x2042d8[_0xdece('0x47')]['id'];var _0x756c75=_0x2042d8['body'];var _0x4fbcc2=0xc8;var _0x341279=null;return db[_0xdece('0xce')][_0xdece('0xcf')]({'isolationLevel':db[_0xdece('0xce')][_0xdece('0x10e')][_0xdece('0x10f')][_0xdece('0x110')]},function(_0x544153){return db[_0xdece('0x31')]['findOne']({'where':{'id':_0xba7e99},'transaction':_0x544153})[_0xdece('0x27')](function(_0xe3d0e6){if(_0xe3d0e6){return db[_0xdece('0x111')][_0xdece('0x26')]({'where':{'ChatWebsiteId':_0xba7e99},'transaction':_0x544153})['then'](function(){var _0x4c936f=_[_0xdece('0x30')](_0x756c75,function(_0x311e04){_0x311e04['ChatWebsiteId']=_0xba7e99;return _0x311e04;});return db['ChatApplication'][_0xdece('0xd1')](_0x4c936f,{'transaction':_0x544153});});}else{_0x4fbcc2=0x194;_0x341279=[];}});})[_0xdece('0x27')](function(){if(_0x4fbcc2!==0x194){return db[_0xdece('0x111')][_0xdece('0x112')]({'where':{'ChatWebsiteId':_0xba7e99},'order':_0xdece('0x90')})['then'](function(_0x160fa1){_0x341279=_0x160fa1;});}})[_0xdece('0x1a')](function(_0x2e0369){_0x4fbcc2=0x1f4;logger[_0xdece('0x16')](_0x2e0369[_0xdece('0x2b')]);if(_0x2e0369[_0xdece('0x2c')]){delete _0x2e0369[_0xdece('0x2c')];}_0x341279=_0x2e0369;})[_0xdece('0x113')](function(){if(_0x341279===null){_0x46f25d[_0xdece('0x1b')](_0x4fbcc2);}else{if(_0x4fbcc2===0x1f4){_0x46f25d[_0xdece('0x1c')](_0x4fbcc2)[_0xdece('0xbb')](_0x341279);}else{_0x46f25d[_0xdece('0x1c')](_0x4fbcc2)[_0xdece('0x24')](_0x341279);}}});};exports[_0xdece('0x114')]=function(_0x52c5e7,_0x2ccad1){var _0x523c22={};var _0x553171={};var _0x19020f;var _0x5c685c;return db['ChatWebsite'][_0xdece('0x5e')]({'where':{'id':_0x52c5e7['params']['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x2ccad1,null))['then'](function(_0x5c386c){if(_0x5c386c){_0x19020f=_0x5c386c;_0x553171['model']=_[_0xdece('0x48')](db[_0xdece('0x111')][_0xdece('0x32')]);_0x553171[_0xdece('0x37')]=_[_0xdece('0x48')](_0x52c5e7['query']);_0x553171[_0xdece('0x38')]=_['intersection'](_0x553171[_0xdece('0x36')],_0x553171[_0xdece('0x37')]);_0x523c22[_0xdece('0x39')]=_['intersection'](_0x553171['model'],qs[_0xdece('0x49')](_0x52c5e7[_0xdece('0x37')][_0xdece('0x49')]));_0x523c22['attributes']=_0x523c22['attributes']['length']?_0x523c22[_0xdece('0x39')]:_0x553171[_0xdece('0x36')];_0x523c22[_0xdece('0x3d')]=qs['sort'](_0x52c5e7[_0xdece('0x37')]['sort']);_0x523c22[_0xdece('0x3f')]=qs[_0xdece('0x38')](_[_0xdece('0x40')](_0x52c5e7[_0xdece('0x37')],_0x553171[_0xdece('0x38')]));if(_0x52c5e7['query'][_0xdece('0x43')]){_0x523c22[_0xdece('0x3f')]=_['merge'](_0x523c22['where'],{'$or':_['map'](_0x523c22[_0xdece('0x39')],function(_0x117f48){var _0x43b00f={};_0x43b00f[_0x117f48]={'$like':'%'+_0x52c5e7[_0xdece('0x37')][_0xdece('0x43')]+'%'};return _0x43b00f;})});}_0x523c22=_['merge']({},_0x523c22,_0x52c5e7[_0xdece('0x44')]);return _0x19020f['getApplications'](_0x523c22);}})['then'](function(_0xef18ca){if(_0xef18ca){_0x5c685c=_0xef18ca[_0xdece('0x58')];if(!_0x52c5e7[_0xdece('0x37')]['hasOwnProperty'](_0xdece('0x3c'))){_0x523c22['limit']=qs[_0xdece('0x20')](_0x52c5e7[_0xdece('0x37')][_0xdece('0x20')]);_0x523c22[_0xdece('0x1e')]=qs[_0xdece('0x1e')](_0x52c5e7[_0xdece('0x37')][_0xdece('0x1e')]);}return _0x19020f['getApplications'](_0x523c22);}})[_0xdece('0x27')](function(_0x46e2ca){if(_0x46e2ca){return _0x46e2ca?{'count':_0x5c685c,'rows':_0x46e2ca}:null;}})[_0xdece('0x27')](respondWithResult(_0x2ccad1,null))['catch'](handleError(_0x2ccad1,null));};exports['addProactiveActions']=function(_0x4fec68,_0x44f635){return db[_0xdece('0x115')][_0xdece('0x4f')]({'where':{'id':_0x4fec68[_0xdece('0x47')]['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x44f635,null))[_0xdece('0x27')](function(_0x46e204){if(_0x46e204){return _0x46e204[_0xdece('0x116')](_0x4fec68[_0xdece('0x4b')]['ids'],_[_0xdece('0xe9')](_0x4fec68[_0xdece('0x4b')],[_0xdece('0x5b'),'id'])||{});}})['then'](respondWithResult(_0x44f635,null))[_0xdece('0x1a')](handleError(_0x44f635,null));};exports[_0xdece('0x117')]=function(_0x3f58de,_0x3026c7){var _0x197af5={};var _0x29408b={};var _0xd1d731;var _0x5affce;return db[_0xdece('0x31')][_0xdece('0x5e')]({'where':{'id':_0x3f58de[_0xdece('0x47')]['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x3026c7,null))[_0xdece('0x27')](function(_0x5d257e){if(_0x5d257e){_0xd1d731=_0x5d257e;_0x29408b[_0xdece('0x36')]=_[_0xdece('0x48')](db['ChatProactiveAction'][_0xdece('0x32')]);_0x29408b[_0xdece('0x37')]=_['keys'](_0x3f58de[_0xdece('0x37')]);_0x29408b[_0xdece('0x38')]=_['intersection'](_0x29408b[_0xdece('0x36')],_0x29408b[_0xdece('0x37')]);_0x197af5[_0xdece('0x39')]=_['intersection'](_0x29408b[_0xdece('0x36')],qs[_0xdece('0x49')](_0x3f58de[_0xdece('0x37')][_0xdece('0x49')]));_0x197af5[_0xdece('0x39')]=_0x197af5[_0xdece('0x39')][_0xdece('0x58')]?_0x197af5[_0xdece('0x39')]:_0x29408b[_0xdece('0x36')];_0x197af5[_0xdece('0x3d')]=qs[_0xdece('0x3e')](_0x3f58de[_0xdece('0x37')]['sort']);_0x197af5[_0xdece('0x3f')]=qs['filters'](_['pick'](_0x3f58de[_0xdece('0x37')],_0x29408b[_0xdece('0x38')]));if(_0x3f58de['query'][_0xdece('0x43')]){_0x197af5[_0xdece('0x3f')]=_[_0xdece('0x41')](_0x197af5['where'],{'$or':_[_0xdece('0x30')](_0x197af5[_0xdece('0x39')],function(_0x3b1246){var _0x5583bb={};_0x5583bb[_0x3b1246]={'$like':'%'+_0x3f58de[_0xdece('0x37')][_0xdece('0x43')]+'%'};return _0x5583bb;})});}_0x197af5=_[_0xdece('0x41')]({},_0x197af5,_0x3f58de[_0xdece('0x44')]);return _0xd1d731[_0xdece('0x117')](_0x197af5);}})[_0xdece('0x27')](function(_0x2a19f2){if(_0x2a19f2){_0x5affce=_0x2a19f2[_0xdece('0x58')];if(!_0x3f58de[_0xdece('0x37')][_0xdece('0x3b')](_0xdece('0x3c'))){_0x197af5[_0xdece('0x20')]=qs['limit'](_0x3f58de[_0xdece('0x37')]['limit']);_0x197af5[_0xdece('0x1e')]=qs[_0xdece('0x1e')](_0x3f58de['query'][_0xdece('0x1e')]);}return _0xd1d731['getProactiveActions'](_0x197af5);}})[_0xdece('0x27')](function(_0x4dfe21){if(_0x4dfe21){return _0x4dfe21?{'count':_0x5affce,'rows':_0x4dfe21}:null;}})[_0xdece('0x27')](respondWithResult(_0x3026c7,null))[_0xdece('0x1a')](handleError(_0x3026c7,null));};exports['getFields']=function(_0x5b4098,_0x1a5083){var _0x22349f=_0x5b4098[_0xdece('0x37')][_0xdece('0x118')]===_0xdece('0x119')?_0xdece('0x11a'):_0xdece('0x11b');return db['ChatWebsite']['find']({'attributes':['id',_0x22349f],'where':{'id':_0x5b4098[_0xdece('0x47')]['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x1a5083,null))[_0xdece('0x27')](function(_0xdfaa4c){if(_0xdfaa4c){var _0x4411ad=_0xdfaa4c[_0x22349f];var _0x49352b=_0x4411ad&&_0x4411ad[_0xdece('0x11c')]?_0x4411ad[_0xdece('0x11c')]:[];_0x1a5083[_0xdece('0xbb')]({'fromKey':_['isNil'](_0x4411ad[_0xdece('0x11d')])?undefined:_0x4411ad[_0xdece('0x11d')],'count':_0x49352b['length'],'rows':_0x49352b});}})[_0xdece('0x1a')](handleError(_0x1a5083,null));};exports[_0xdece('0x11e')]=function(_0x3907fa,_0x3e9a8f){var _0xf07038={'raw':![],'where':{}};var _0x401a91={};var _0x1d53a3={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x3907fa[_0xdece('0x47')]['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x3e9a8f,null))[_0xdece('0x27')](function(_0x61912e){if(_0x61912e){_0x401a91[_0xdece('0x36')]=_['keys'](db[_0xdece('0xc7')][_0xdece('0x32')]);_0x401a91[_0xdece('0x37')]=_[_0xdece('0x48')](_0x3907fa['query']);_0x401a91[_0xdece('0x38')]=_[_0xdece('0x3a')](_0x401a91[_0xdece('0x36')],_0x401a91[_0xdece('0x37')]);_0xf07038['attributes']=_[_0xdece('0x3a')](_0x401a91['model'],qs[_0xdece('0x49')](_0x3907fa['query'][_0xdece('0x49')]));_0xf07038[_0xdece('0x39')]=_0xf07038[_0xdece('0x39')][_0xdece('0x58')]?_0xf07038[_0xdece('0x39')]:_0x401a91['model'];if(!_0x3907fa['query'][_0xdece('0x3b')](_0xdece('0x3c'))){_0xf07038['limit']=qs[_0xdece('0x20')](_0x3907fa[_0xdece('0x37')]['limit']);_0xf07038[_0xdece('0x1e')]=qs[_0xdece('0x1e')](_0x3907fa[_0xdece('0x37')][_0xdece('0x1e')]);}_0xf07038[_0xdece('0x3d')]=qs[_0xdece('0x3e')](_0x3907fa['query'][_0xdece('0x3e')]);_0xf07038[_0xdece('0x3f')]=qs[_0xdece('0x38')](_[_0xdece('0x40')](_0x3907fa['query'],_0x401a91[_0xdece('0x38')]));_0xf07038[_0xdece('0x3f')][_0xdece('0x55')]=_0x61912e['id'];if(_0x3907fa['query'][_0xdece('0x43')]){_0xf07038[_0xdece('0x3f')]=_['merge'](_0xf07038[_0xdece('0x3f')],{'$or':_[_0xdece('0x30')](_0xf07038['attributes'],function(_0x34416e){var _0x48ac0b={};_0x48ac0b[_0x34416e]={'$like':'%'+_0x3907fa[_0xdece('0x37')][_0xdece('0x43')]+'%'};return _0x48ac0b;})});}_0xf07038=_[_0xdece('0x41')]({},_0xf07038,_0x3907fa[_0xdece('0x44')]);return db[_0xdece('0xc7')][_0xdece('0x21')]({'where':_0xf07038['where']})[_0xdece('0x27')](function(_0x4f00de){_0x1d53a3[_0xdece('0x21')]=_0x4f00de;if(_0x3907fa[_0xdece('0x37')][_0xdece('0x5f')]){_0xf07038[_0xdece('0x45')]=[{'all':!![]}];}else{_0xf07038[_0xdece('0x45')]=[{'model':db[_0xdece('0x7e')],'as':_0xdece('0x11f'),'required':![]},{'model':db['Attachment'],'as':'Attachments','required':![]}];}return db[_0xdece('0xc7')][_0xdece('0x46')](_0xf07038);})[_0xdece('0x27')](function(_0x5afcc2){_0x1d53a3[_0xdece('0x59')]=_0x5afcc2;return _0x1d53a3;});}})[_0xdece('0x27')](respondWithFilteredResult(_0x3e9a8f,_0xf07038))[_0xdece('0x1a')](handleError(_0x3e9a8f,null));};exports[_0xdece('0x120')]=function(_0x1e8252,_0x438aff){return db['ChatWebsite']['find']({'where':{'id':_0x1e8252['params']['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x438aff,null))[_0xdece('0x27')](function(_0x153a22){if(_0x153a22){return _0x153a22[_0xdece('0x120')](_0x1e8252[_0xdece('0x4b')][_0xdece('0x5b')],_[_0xdece('0xe9')](_0x1e8252['body'],['ids','id'])||{})[_0xdece('0xa7')](function(_0x304086){for(var _0x41555f=0x0;_0x41555f<_0x1e8252[_0xdece('0x4b')][_0xdece('0x5b')]['length'];_0x41555f+=0x1){socket[_0xdece('0x121')]('userChatWebsite:save',{'UserId':Number(_0x1e8252['body'][_0xdece('0x5b')][_0x41555f]),'ChatWebsiteId':Number(_0x1e8252[_0xdece('0x47')]['id'])});}return _0x304086;});}})[_0xdece('0x27')](respondWithResult(_0x438aff,null))[_0xdece('0x1a')](handleError(_0x438aff,null));};exports['removeAgents']=function(_0x1302cf,_0x52f736){return db[_0xdece('0x31')]['find']({'where':{'id':_0x1302cf['params']['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x52f736,null))[_0xdece('0x27')](function(_0x1303b8){if(_0x1303b8){return _0x1303b8['removeAgents'](_0x1302cf[_0xdece('0x37')]['ids'])['then'](function(){if(_['isArray'](_0x1302cf['query'][_0xdece('0x5b')])){for(var _0x155e0c=0x0;_0x155e0c<_0x1302cf['query'][_0xdece('0x5b')]['length'];_0x155e0c+=0x1){socket[_0xdece('0x121')]('userChatWebsite:remove',{'UserId':Number(_0x1302cf[_0xdece('0x37')]['ids'][_0x155e0c]),'ChatWebsiteId':Number(_0x1302cf[_0xdece('0x47')]['id'])});}}else{socket['emit'](_0xdece('0x122'),{'UserId':Number(_0x1302cf[_0xdece('0x37')][_0xdece('0x5b')]),'ChatWebsiteId':Number(_0x1302cf[_0xdece('0x47')]['id'])});}});}})[_0xdece('0x27')](respondWithStatusCode(_0x52f736,null))[_0xdece('0x1a')](handleError(_0x52f736,null));};exports[_0xdece('0x123')]=function(_0x2a21b0,_0x48f8f9){var _0x5db2ac={};var _0x49f9d3={};var _0x591e69;var _0xcb6533;return db['ChatWebsite'][_0xdece('0x5e')]({'where':{'id':_0x2a21b0[_0xdece('0x47')]['id']}})[_0xdece('0x27')](handleEntityNotFound(_0x48f8f9,null))[_0xdece('0x27')](function(_0x50b636){if(_0x50b636){_0x591e69=_0x50b636;_0x49f9d3[_0xdece('0x36')]=_[_0xdece('0x48')](db[_0xdece('0x124')][_0xdece('0x32')]);_0x49f9d3['query']=_['keys'](_0x2a21b0[_0xdece('0x37')]);_0x49f9d3[_0xdece('0x38')]=_['intersection'](_0x49f9d3['model'],_0x49f9d3[_0xdece('0x37')]);_0x5db2ac[_0xdece('0x39')]=_[_0xdece('0x3a')](_0x49f9d3[_0xdece('0x36')],qs[_0xdece('0x49')](_0x2a21b0[_0xdece('0x37')]['fields']));_0x5db2ac[_0xdece('0x39')]=_0x5db2ac['attributes']['length']?_0x5db2ac['attributes']:_0x49f9d3[_0xdece('0x36')];_0x5db2ac[_0xdece('0x3d')]=qs[_0xdece('0x3e')](_0x2a21b0[_0xdece('0x37')][_0xdece('0x3e')]);_0x5db2ac[_0xdece('0x3f')]=qs['filters'](_[_0xdece('0x40')](_0x2a21b0[_0xdece('0x37')],_0x49f9d3[_0xdece('0x38')]));if(_0x2a21b0[_0xdece('0x37')][_0xdece('0x43')]){_0x5db2ac[_0xdece('0x3f')]=_['merge'](_0x5db2ac['where'],{'$or':_[_0xdece('0x30')](_0x5db2ac['attributes'],function(_0x5bc81b){var _0xacc150={};_0xacc150[_0x5bc81b]={'$like':'%'+_0x2a21b0[_0xdece('0x37')][_0xdece('0x43')]+'%'};return _0xacc150;})});}_0x5db2ac=_['merge']({},_0x5db2ac,_0x2a21b0[_0xdece('0x44')]);return _0x591e69[_0xdece('0x123')](_0x5db2ac);}})['then'](function(_0x310b6b){if(_0x310b6b){_0xcb6533=_0x310b6b[_0xdece('0x58')];if(!_0x2a21b0[_0xdece('0x37')][_0xdece('0x3b')]('nolimit')){_0x5db2ac[_0xdece('0x20')]=qs['limit'](_0x2a21b0['query']['limit']);_0x5db2ac['offset']=qs[_0xdece('0x1e')](_0x2a21b0[_0xdece('0x37')][_0xdece('0x1e')]);}return _0x591e69['getAgents'](_0x5db2ac);}})['then'](function(_0xfad6b6){if(_0xfad6b6){return _0xfad6b6?{'count':_0xcb6533,'rows':_0xfad6b6}:null;}})[_0xdece('0x27')](respondWithResult(_0x48f8f9,null))[_0xdece('0x1a')](handleError(_0x48f8f9,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 188bb90..05fac65 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 _0x17c4=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update'];(function(_0x5b013d,_0xc7691c){var _0x2b6eef=function(_0x3143ca){while(--_0x3143ca){_0x5b013d['push'](_0x5b013d['shift']());}};_0x2b6eef(++_0xc7691c);}(_0x17c4,0x102));var _0x417c=function(_0x2ea6f5,_0x4adfc4){_0x2ea6f5=_0x2ea6f5-0x0;var _0x2a88b5=_0x17c4[_0x2ea6f5];return _0x2a88b5;};'use strict';var EventEmitter=require(_0x417c('0x0'));var ChatWebsite=require(_0x417c('0x1'))['db'][_0x417c('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x417c('0x3')](0x0);var events={'afterCreate':_0x417c('0x4'),'afterUpdate':_0x417c('0x5'),'afterDestroy':_0x417c('0x6')};function emitEvent(_0x74b351){return function(_0x212ac0,_0x413ee5,_0x33ae56){ChatWebsiteEvents['emit'](_0x74b351+':'+_0x212ac0['id'],_0x212ac0);ChatWebsiteEvents[_0x417c('0x7')](_0x74b351,_0x212ac0);_0x33ae56(null);};}for(var e in events){if(events[_0x417c('0x8')](e)){var event=events[e];ChatWebsite[_0x417c('0x9')](e,emitEvent(event));}}module[_0x417c('0xa')]=ChatWebsiteEvents; \ No newline at end of file +var _0x2830=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2830,0x117));var _0x0283=function(_0x43d7f1,_0x11a1eb){_0x43d7f1=_0x43d7f1-0x0;var _0x470f7e=_0x2830[_0x43d7f1];return _0x470f7e;};'use strict';var EventEmitter=require(_0x0283('0x0'));var ChatWebsite=require(_0x0283('0x1'))['db'][_0x0283('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x0283('0x3')](0x0);var events={'afterCreate':_0x0283('0x4'),'afterUpdate':_0x0283('0x5'),'afterDestroy':_0x0283('0x6')};function emitEvent(_0x56984a){return function(_0x414c89,_0x4aa050,_0x1a8998){ChatWebsiteEvents[_0x0283('0x7')](_0x56984a+':'+_0x414c89['id'],_0x414c89);ChatWebsiteEvents[_0x0283('0x7')](_0x56984a,_0x414c89);_0x1a8998(null);};}for(var e in events){if(events[_0x0283('0x8')](e)){var event=events[e];ChatWebsite[_0x0283('0x9')](e,emitEvent(event));}}module[_0x0283('0xa')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 4c41d40..ecf6f18 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 _0x0663=['ChatWebsite','chat_websites','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./chatWebsite.attributes'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x0663,0x1cd));var _0x3066=function(_0x4e53d1,_0x6a8a56){_0x4e53d1=_0x4e53d1-0x0;var _0x4913cf=_0x0663[_0x4e53d1];return _0x4913cf;};'use strict';var _=require('lodash');var util=require(_0x3066('0x0'));var logger=require(_0x3066('0x1'))('api');var moment=require(_0x3066('0x2'));var BPromise=require(_0x3066('0x3'));var rp=require(_0x3066('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3066('0x5'));var attributes=require(_0x3066('0x6'));module['exports']=function(_0x886505,_0x48908c){return _0x886505['define'](_0x3066('0x7'),attributes,{'tableName':_0x3066('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf1a1=['define','ChatWebsite','chat_websites','../../config/logger','api','bluebird','../../config/environment','./chatWebsite.attributes','exports'];(function(_0x10ad76,_0x4fc94a){var _0x1ced1a=function(_0x45e5c7){while(--_0x45e5c7){_0x10ad76['push'](_0x10ad76['shift']());}};_0x1ced1a(++_0x4fc94a);}(_0xf1a1,0x66));var _0x1f1a=function(_0x1d3168,_0x43b8f9){_0x1d3168=_0x1d3168-0x0;var _0x497266=_0xf1a1[_0x1d3168];return _0x497266;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1f1a('0x0'))(_0x1f1a('0x1'));var moment=require('moment');var BPromise=require(_0x1f1a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1f1a('0x3'));var attributes=require(_0x1f1a('0x4'));module[_0x1f1a('0x5')]=function(_0x4b848b,_0x53f7b9){return _0x4b848b[_0x1f1a('0x6')](_0x1f1a('0x7'),attributes,{'tableName':_0x1f1a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index e13d83e..85b0ed8 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 _0x4fd8=['rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0xf72d1c,_0x2167c3){var _0x5d1a77=function(_0xfcc3ce){while(--_0xfcc3ce){_0xf72d1c['push'](_0xf72d1c['shift']());}};_0x5d1a77(++_0x2167c3);}(_0x4fd8,0xd2));var _0x84fd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4fd8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x84fd('0x0'));var util=require('util');var moment=require(_0x84fd('0x1'));var BPromise=require(_0x84fd('0x2'));var rs=require(_0x84fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x84fd('0x4'))['db'];var utils=require(_0x84fd('0x5'));var logger=require('../../config/logger')(_0x84fd('0x6'));var config=require(_0x84fd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x84fd('0x8')][_0x84fd('0x9')]({'port':0x232a});config[_0x84fd('0xa')]=_[_0x84fd('0xb')](config['redis'],{'host':_0x84fd('0xc'),'port':0x18eb});var socket=require(_0x84fd('0xd'))(new Redis(config[_0x84fd('0xa')]));require(_0x84fd('0xe'))[_0x84fd('0xf')](socket);function respondWithRpcPromise(_0x437420,_0x5813ec,_0x4180f5){return new BPromise(function(_0x186a6a,_0x4b11e9){return client[_0x84fd('0x10')](_0x437420,_0x4180f5)[_0x84fd('0x11')](function(_0xbcf14){logger[_0x84fd('0x12')](_0x84fd('0x13'),_0x5813ec,_0x84fd('0x14'));logger[_0x84fd('0x15')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x5813ec,'request\x20sent',JSON[_0x84fd('0x16')](_0xbcf14));if(_0xbcf14[_0x84fd('0x17')]){if(_0xbcf14[_0x84fd('0x17')]['code']===0x1f4){logger[_0x84fd('0x17')](_0x84fd('0x13'),_0x5813ec,_0xbcf14[_0x84fd('0x17')][_0x84fd('0x18')]);return _0x4b11e9(_0xbcf14[_0x84fd('0x17')][_0x84fd('0x18')]);}logger[_0x84fd('0x17')](_0x84fd('0x13'),_0x5813ec,_0xbcf14[_0x84fd('0x17')][_0x84fd('0x18')]);return _0x186a6a(_0xbcf14[_0x84fd('0x17')]['message']);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x5813ec,_0x84fd('0x14'));_0x186a6a(_0xbcf14[_0x84fd('0x19')][_0x84fd('0x18')]);}})[_0x84fd('0x1a')](function(_0x5a628d){logger[_0x84fd('0x17')](_0x84fd('0x13'),_0x5813ec,_0x5a628d);_0x4b11e9(_0x5a628d);});});} \ No newline at end of file +var _0x5632=['request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','stringify','error','message'];(function(_0x458ed6,_0x504646){var _0xa5dfd9=function(_0x504e7b){while(--_0x504e7b){_0x458ed6['push'](_0x458ed6['shift']());}};_0xa5dfd9(++_0x504646);}(_0x5632,0x1b3));var _0x2563=function(_0xfb0f99,_0x4048ad){_0xfb0f99=_0xfb0f99-0x0;var _0x3faf0b=_0x5632[_0xfb0f99];return _0x3faf0b;};'use strict';var _=require(_0x2563('0x0'));var util=require(_0x2563('0x1'));var moment=require(_0x2563('0x2'));var BPromise=require(_0x2563('0x3'));var rs=require(_0x2563('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2563('0x5'))['db'];var utils=require(_0x2563('0x6'));var logger=require('../../config/logger')(_0x2563('0x7'));var config=require(_0x2563('0x8'));var jayson=require(_0x2563('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x2563('0xa')]=_[_0x2563('0xb')](config['redis'],{'host':_0x2563('0xc'),'port':0x18eb});var socket=require(_0x2563('0xd'))(new Redis(config[_0x2563('0xa')]));require(_0x2563('0xe'))[_0x2563('0xf')](socket);function respondWithRpcPromise(_0x36a210,_0x50af74,_0x3a5a79){return new BPromise(function(_0x2304e7,_0x52697c){return client[_0x2563('0x10')](_0x36a210,_0x3a5a79)[_0x2563('0x11')](function(_0x482c75){logger[_0x2563('0x12')](_0x2563('0x13'),_0x50af74,'request\x20sent');logger[_0x2563('0x14')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x50af74,'request\x20sent',JSON[_0x2563('0x15')](_0x482c75));if(_0x482c75[_0x2563('0x16')]){if(_0x482c75[_0x2563('0x16')]['code']===0x1f4){logger[_0x2563('0x16')](_0x2563('0x13'),_0x50af74,_0x482c75[_0x2563('0x16')][_0x2563('0x17')]);return _0x52697c(_0x482c75[_0x2563('0x16')][_0x2563('0x17')]);}logger[_0x2563('0x16')](_0x2563('0x13'),_0x50af74,_0x482c75[_0x2563('0x16')][_0x2563('0x17')]);return _0x2304e7(_0x482c75['error']['message']);}else{logger[_0x2563('0x12')](_0x2563('0x13'),_0x50af74,_0x2563('0x18'));_0x2304e7(_0x482c75[_0x2563('0x19')][_0x2563('0x17')]);}})[_0x2563('0x1a')](function(_0x54f0a4){logger['error'](_0x2563('0x13'),_0x50af74,_0x54f0a4);_0x52697c(_0x54f0a4);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index e13db75..9a0b0b6 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 _0xa6c3=['removeListener','./chatWebsite.events','save'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa6c3,0x193));var _0x3a6c=function(_0x999b85,_0x1edc2b){_0x999b85=_0x999b85-0x0;var _0x1d7124=_0xa6c3[_0x999b85];return _0x1d7124;};'use strict';var ChatWebsiteEvents=require(_0x3a6c('0x0'));var events=[_0x3a6c('0x1'),'remove','update'];function createListener(_0x3db869,_0x2a77cc){return function(_0x5d5515){_0x2a77cc['emit'](_0x3db869,_0x5d5515);};}function removeListener(_0x30fac8,_0x32fbe1){return function(){ChatWebsiteEvents[_0x3a6c('0x2')](_0x30fac8,_0x32fbe1);};}exports['register']=function(_0x19a4ad){for(var _0xb7f50d=0x0,_0x4fd75e=events['length'];_0xb7f50d<_0x4fd75e;_0xb7f50d++){var _0x200d0f=events[_0xb7f50d];var _0x10df07=createListener('chatWebsite:'+_0x200d0f,_0x19a4ad);ChatWebsiteEvents['on'](_0x200d0f,_0x10df07);}}; \ No newline at end of file +var _0x1697=['register','length','save','remove','update','emit','removeListener'];(function(_0x31abee,_0x11ff0c){var _0x3c1761=function(_0x2b5062){while(--_0x2b5062){_0x31abee['push'](_0x31abee['shift']());}};_0x3c1761(++_0x11ff0c);}(_0x1697,0xfe));var _0x7169=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x1697[_0x1035c1];return _0x308d67;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x7169('0x0'),_0x7169('0x1'),_0x7169('0x2')];function createListener(_0x1f7a39,_0x379de3){return function(_0x5bd18c){_0x379de3[_0x7169('0x3')](_0x1f7a39,_0x5bd18c);};}function removeListener(_0x5d362e,_0x1aaf25){return function(){ChatWebsiteEvents[_0x7169('0x4')](_0x5d362e,_0x1aaf25);};}exports[_0x7169('0x5')]=function(_0x294970){for(var _0xf012e2=0x0,_0x20b48e=events[_0x7169('0x6')];_0xf012e2<_0x20b48e;_0xf012e2++){var _0x4460f4=events[_0xf012e2];var _0x2845c5=createListener('chatWebsite:'+_0x4460f4,_0x294970);ChatWebsiteEvents['on'](_0x4460f4,_0x2845c5);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 25377a0..15660b0 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 _0xd24e=['removeDispositions','removeAnswers','removeAgents','exports','multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','/:id/snippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','addAvatar','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','server/files','offline-chat','ensureDir','replace','extname','any','addApplications','addAgents','put','/:id','update','delete','destroy'];(function(_0x187d29,_0x2dce45){var _0x21bbea=function(_0x27019a){while(--_0x27019a){_0x187d29['push'](_0x187d29['shift']());}};_0x21bbea(++_0x2dce45);}(_0xd24e,0xd6));var _0xed24=function(_0xfaf676,_0x3c6d39){_0xfaf676=_0xfaf676-0x0;var _0x3a0248=_0xd24e[_0xfaf676];return _0x3a0248;};'use strict';var multer=require(_0xed24('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xed24('0x1'));var router=express[_0xed24('0x2')]();var fs_extra=require(_0xed24('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xed24('0x4'));var config=require(_0xed24('0x5'));var controller=require(_0xed24('0x6'));router[_0xed24('0x7')]('/',auth[_0xed24('0x8')](),controller[_0xed24('0x9')]);router[_0xed24('0x7')](_0xed24('0xa'),auth[_0xed24('0x8')](),controller[_0xed24('0xb')]);router[_0xed24('0x7')]('/:id',auth[_0xed24('0x8')](),controller[_0xed24('0xc')]);router['get'](_0xed24('0xd'),auth['isAuthenticated'](),controller[_0xed24('0xe')]);router[_0xed24('0x7')](_0xed24('0xf'),auth[_0xed24('0x8')](),controller[_0xed24('0x10')]);router[_0xed24('0x7')](_0xed24('0x11'),controller['getLogo']);router[_0xed24('0x7')](_0xed24('0x12'),controller[_0xed24('0x13')]);router['get'](_0xed24('0x14'),controller[_0xed24('0x15')]);router['get']('/:id/system_avatar',controller[_0xed24('0x16')]);router[_0xed24('0x7')](_0xed24('0x17'),auth[_0xed24('0x8')](),controller['getInteractions']);router['get'](_0xed24('0x18'),controller['getSnippet']);router[_0xed24('0x7')](_0xed24('0x19'),auth['isAuthenticated'](),controller['getApplications']);router[_0xed24('0x7')](_0xed24('0x1a'),auth['isAuthenticated'](),controller[_0xed24('0x1b')]);router[_0xed24('0x7')](_0xed24('0x1c'),controller['getFields']);router[_0xed24('0x7')](_0xed24('0x1d'),auth[_0xed24('0x8')](),controller[_0xed24('0x1e')]);router[_0xed24('0x7')](_0xed24('0x1f'),auth[_0xed24('0x8')](),controller[_0xed24('0x20')]);router[_0xed24('0x21')]('/',auth[_0xed24('0x8')](),controller[_0xed24('0x22')]);router[_0xed24('0x21')](_0xed24('0xd'),auth[_0xed24('0x8')](),controller[_0xed24('0x23')]);router[_0xed24('0x21')]('/:id/canned_answers',auth[_0xed24('0x8')](),controller[_0xed24('0x24')]);var upload=multer({'storage':multer[_0xed24('0x25')]({'destination':function(_0x17ccea,_0x4f4d0f,_0x12056d){_0x12056d(null,path[_0xed24('0x26')](config[_0xed24('0x27')],_0xed24('0x28')));},'filename':function(_0x48dbfe,_0x407f30,_0x88fcb0){_0x88fcb0(null,util[_0xed24('0x29')](_0xed24('0x2a'),Date[_0xed24('0x2b')](),_0x407f30[_0xed24('0x2c')]));}})});router[_0xed24('0x21')](_0xed24('0x11'),upload[_0xed24('0x2d')](_0xed24('0x2e')),controller[_0xed24('0x2f')]);var upload=multer({'storage':multer[_0xed24('0x25')]({'destination':function(_0x4a2bf7,_0x5b327c,_0x55aa22){_0x55aa22(null,path[_0xed24('0x26')](config[_0xed24('0x27')],_0xed24('0x30')));},'filename':function(_0x374f36,_0x350ff2,_0x3a3bb1){_0x3a3bb1(null,util[_0xed24('0x29')]('%s-%s',Date[_0xed24('0x2b')](),_0x350ff2[_0xed24('0x2c')]));}})});router[_0xed24('0x21')](_0xed24('0x12'),upload[_0xed24('0x2d')](_0xed24('0x2e')),controller[_0xed24('0x31')]);var upload=multer({'storage':multer[_0xed24('0x25')]({'destination':function(_0x1ac9f3,_0x4c0da9,_0x2874ed){_0x2874ed(null,path[_0xed24('0x26')](config[_0xed24('0x27')],_0xed24('0x30')));},'filename':function(_0x3f96d4,_0x419c86,_0x20f4c5){_0x20f4c5(null,util[_0xed24('0x29')](_0xed24('0x2a'),Date[_0xed24('0x2b')](),_0x419c86[_0xed24('0x2c')]));}})});router['post'](_0xed24('0x14'),upload['single'](_0xed24('0x2e')),controller[_0xed24('0x32')]);var upload=multer({'storage':multer[_0xed24('0x25')]({'destination':function(_0x8f9e5a,_0x1cb6d1,_0x189cb2){_0x189cb2(null,path[_0xed24('0x26')](config[_0xed24('0x27')],_0xed24('0x30')));},'filename':function(_0x37f1cb,_0x406525,_0x5d5ebb){_0x5d5ebb(null,util[_0xed24('0x29')](_0xed24('0x2a'),Date[_0xed24('0x2b')](),_0x406525['originalname']));}})});router[_0xed24('0x21')](_0xed24('0x33'),upload[_0xed24('0x2d')](_0xed24('0x2e')),controller[_0xed24('0x34')]);router[_0xed24('0x21')]('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x5154aa,_0x2cd41d,_0x166b8c){const _0x13af2a=path['join'](config['root'],_0xed24('0x35'),'attachments',_0xed24('0x36'));fs_extra[_0xed24('0x37')](_0x13af2a,function(){_0x166b8c(null,_0x13af2a);});},'filename':function(_0x259e28,_0x251af3,_0x26b418){const _0xaf378c=_0x251af3[_0xed24('0x2c')][_0xed24('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1d981e=path[_0xed24('0x39')](_0xaf378c);const _0x3ad613=Date[_0xed24('0x2b')]()+'-'+_0xaf378c[_0xed24('0x38')](_0x1d981e,'')+_0x1d981e;_0x26b418(null,_0x3ad613);}})});router[_0xed24('0x21')]('/:id/offline',offlineUploadMulter[_0xed24('0x3a')](),controller['offline']);router[_0xed24('0x21')](_0xed24('0x17'),auth['isAuthenticated'](),controller['addInteraction']);router[_0xed24('0x21')](_0xed24('0x19'),auth[_0xed24('0x8')](),controller[_0xed24('0x3b')]);router[_0xed24('0x21')](_0xed24('0x1a'),auth[_0xed24('0x8')](),controller['addProactiveActions']);router[_0xed24('0x21')]('/:id/users',auth[_0xed24('0x8')](),controller[_0xed24('0x3c')]);router[_0xed24('0x3d')](_0xed24('0x3e'),auth[_0xed24('0x8')](),controller[_0xed24('0x3f')]);router[_0xed24('0x40')]('/:id',auth[_0xed24('0x8')](),controller[_0xed24('0x41')]);router['delete'](_0xed24('0xd'),auth[_0xed24('0x8')](),controller[_0xed24('0x42')]);router[_0xed24('0x40')]('/:id/canned_answers',auth[_0xed24('0x8')](),controller[_0xed24('0x43')]);router['delete'](_0xed24('0x1f'),auth['isAuthenticated'](),controller[_0xed24('0x44')]);module[_0xed24('0x45')]=router; \ No newline at end of file +var _0x158e=['create','addDisposition','diskStorage','join','root','format','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','extname','/:id/offline','any','/:id/interactions','addInteraction','addApplications','put','update','delete','/:id/dispositions','removeAnswers','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/:id','getDispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','getAgents','post'];(function(_0x45d80c,_0x35c0ff){var _0x449a98=function(_0x1b5ab7){while(--_0x1b5ab7){_0x45d80c['push'](_0x45d80c['shift']());}};_0x449a98(++_0x35c0ff);}(_0x158e,0xab));var _0xe158=function(_0x105dd9,_0x1a3e6b){_0x105dd9=_0x105dd9-0x0;var _0x1acd3a=_0x158e[_0x105dd9];return _0x1acd3a;};'use strict';var multer=require(_0xe158('0x0'));var util=require(_0xe158('0x1'));var path=require(_0xe158('0x2'));var timeout=require(_0xe158('0x3'));var express=require(_0xe158('0x4'));var router=express[_0xe158('0x5')]();var fs_extra=require(_0xe158('0x6'));var auth=require(_0xe158('0x7'));var interaction=require(_0xe158('0x8'));var config=require(_0xe158('0x9'));var controller=require(_0xe158('0xa'));router['get']('/',auth[_0xe158('0xb')](),controller[_0xe158('0xc')]);router[_0xe158('0xd')]('/describe',auth[_0xe158('0xb')](),controller['describe']);router[_0xe158('0xd')](_0xe158('0xe'),auth[_0xe158('0xb')](),controller['show']);router[_0xe158('0xd')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xe158('0xf')]);router[_0xe158('0xd')](_0xe158('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xe158('0xd')](_0xe158('0x11'),controller[_0xe158('0x12')]);router['get'](_0xe158('0x13'),controller[_0xe158('0x14')]);router['get'](_0xe158('0x15'),controller[_0xe158('0x16')]);router['get'](_0xe158('0x17'),controller[_0xe158('0x18')]);router[_0xe158('0xd')]('/:id/interactions',auth[_0xe158('0xb')](),controller['getInteractions']);router[_0xe158('0xd')](_0xe158('0x19'),controller[_0xe158('0x1a')]);router['get']('/:id/applications',auth[_0xe158('0xb')](),controller[_0xe158('0x1b')]);router[_0xe158('0xd')](_0xe158('0x1c'),auth[_0xe158('0xb')](),controller[_0xe158('0x1d')]);router[_0xe158('0xd')](_0xe158('0x1e'),controller[_0xe158('0x1f')]);router[_0xe158('0xd')](_0xe158('0x20'),auth[_0xe158('0xb')](),controller[_0xe158('0x21')]);router[_0xe158('0xd')]('/:id/users',auth[_0xe158('0xb')](),controller[_0xe158('0x22')]);router[_0xe158('0x23')]('/',auth['isAuthenticated'](),controller[_0xe158('0x24')]);router['post']('/:id/dispositions',auth[_0xe158('0xb')](),controller[_0xe158('0x25')]);router['post'](_0xe158('0x10'),auth[_0xe158('0xb')](),controller['addAnswer']);var upload=multer({'storage':multer[_0xe158('0x26')]({'destination':function(_0x57f260,_0x318883,_0x2665fd){_0x2665fd(null,path[_0xe158('0x27')](config[_0xe158('0x28')],'server/files/images/logos/'));},'filename':function(_0x3e4819,_0x41fe1d,_0x201714){_0x201714(null,util[_0xe158('0x29')](_0xe158('0x2a'),Date[_0xe158('0x2b')](),_0x41fe1d[_0xe158('0x2c')]));}})});router[_0xe158('0x23')](_0xe158('0x11'),upload[_0xe158('0x2d')](_0xe158('0x2e')),controller[_0xe158('0x2f')]);var upload=multer({'storage':multer[_0xe158('0x26')]({'destination':function(_0x2de55e,_0x48694f,_0x3cc405){_0x3cc405(null,path['join'](config[_0xe158('0x28')],_0xe158('0x30')));},'filename':function(_0x1a34d3,_0x1866c0,_0x53d2ae){_0x53d2ae(null,util['format']('%s-%s',Date['now'](),_0x1866c0['originalname']));}})});router[_0xe158('0x23')](_0xe158('0x13'),upload['single'](_0xe158('0x2e')),controller['addAvatar']);var upload=multer({'storage':multer[_0xe158('0x26')]({'destination':function(_0x37e586,_0x27b388,_0x1d55ae){_0x1d55ae(null,path[_0xe158('0x27')](config[_0xe158('0x28')],_0xe158('0x30')));},'filename':function(_0x420346,_0x3cd480,_0x444fd8){_0x444fd8(null,util['format'](_0xe158('0x2a'),Date['now'](),_0x3cd480[_0xe158('0x2c')]));}})});router[_0xe158('0x23')](_0xe158('0x15'),upload['single'](_0xe158('0x2e')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xe158('0x26')]({'destination':function(_0x1e52f1,_0x17c2d9,_0x1f0fcb){_0x1f0fcb(null,path['join'](config[_0xe158('0x28')],_0xe158('0x30')));},'filename':function(_0x2b4e30,_0x16cbb9,_0x4826b4){_0x4826b4(null,util[_0xe158('0x29')](_0xe158('0x2a'),Date[_0xe158('0x2b')](),_0x16cbb9['originalname']));}})});router[_0xe158('0x23')](_0xe158('0x17'),upload[_0xe158('0x2d')](_0xe158('0x2e')),controller['addSystemAvatar']);router[_0xe158('0x23')](_0xe158('0x31'),controller[_0xe158('0x32')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x107c56,_0x399eeb,_0x43a109){const _0x9f6ad9=path[_0xe158('0x27')](config[_0xe158('0x28')],_0xe158('0x33'),_0xe158('0x34'),_0xe158('0x35'));fs_extra[_0xe158('0x36')](_0x9f6ad9,function(){_0x43a109(null,_0x9f6ad9);});},'filename':function(_0x463b53,_0x206d53,_0xad0700){const _0x149b89=_0x206d53['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x4b7c7f=path[_0xe158('0x37')](_0x149b89);const _0x5bd481=Date[_0xe158('0x2b')]()+'-'+_0x149b89['replace'](_0x4b7c7f,'')+_0x4b7c7f;_0xad0700(null,_0x5bd481);}})});router[_0xe158('0x23')](_0xe158('0x38'),offlineUploadMulter[_0xe158('0x39')](),controller['offline']);router['post'](_0xe158('0x3a'),auth['isAuthenticated'](),controller[_0xe158('0x3b')]);router[_0xe158('0x23')]('/:id/applications',auth[_0xe158('0xb')](),controller[_0xe158('0x3c')]);router[_0xe158('0x23')](_0xe158('0x1c'),auth[_0xe158('0xb')](),controller['addProactiveActions']);router[_0xe158('0x23')]('/:id/users',auth[_0xe158('0xb')](),controller['addAgents']);router[_0xe158('0x3d')]('/:id',auth[_0xe158('0xb')](),controller[_0xe158('0x3e')]);router[_0xe158('0x3f')](_0xe158('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0xe158('0x3f')](_0xe158('0x40'),auth[_0xe158('0xb')](),controller['removeDispositions']);router[_0xe158('0x3f')](_0xe158('0x10'),auth['isAuthenticated'](),controller[_0xe158('0x41')]);router['delete'](_0xe158('0x42'),auth['isAuthenticated'](),controller[_0xe158('0x43')]);module[_0xe158('0x44')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 5ece2e9..977b8af 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 _0xc627=['ENUM','Google','exports','STRING'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xc627,0x14a));var _0x7c62=function(_0x30f7e0,_0x455121){_0x30f7e0=_0x30f7e0-0x0;var _0x2c82f3=_0xc627[_0x30f7e0];return _0x2c82f3;};'use strict';var Sequelize=require('sequelize');module[_0x7c62('0x0')]={'name':{'type':Sequelize[_0x7c62('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x7c62('0x2')]('AmazonAWS',_0x7c62('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x7c62('0x1')]},'data2':{'type':Sequelize[_0x7c62('0x1')]}}; \ No newline at end of file +var _0x9aac=['Google','sequelize','STRING','ENUM'];(function(_0x7df60e,_0x201b90){var _0x1554fb=function(_0xaaf762){while(--_0xaaf762){_0x7df60e['push'](_0x7df60e['shift']());}};_0x1554fb(++_0x201b90);}(_0x9aac,0x135));var _0xc9aa=function(_0x36cd7f,_0x396c9a){_0x36cd7f=_0x36cd7f-0x0;var _0x16d0ff=_0x9aac[_0x36cd7f];return _0x16d0ff;};'use strict';var Sequelize=require(_0xc9aa('0x0'));module['exports']={'name':{'type':Sequelize[_0xc9aa('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xc9aa('0x2')]('AmazonAWS',_0xc9aa('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xc9aa('0x1')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index d551186..ef58035 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 _0x0b0e=['hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','include','find','create','body','params','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','CloudProvider','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length'];(function(_0x3cffb7,_0x4e48ec){var _0x568e0c=function(_0x495ace){while(--_0x495ace){_0x3cffb7['push'](_0x3cffb7['shift']());}};_0x568e0c(++_0x4e48ec);}(_0x0b0e,0x187));var _0xe0b0=function(_0x35468d,_0x2a7240){_0x35468d=_0x35468d-0x0;var _0x30da52=_0x0b0e[_0x35468d];return _0x30da52;};'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['CloudProvider'][_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['CloudProvider'][_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['CloudProvider']['find']({'where':{'id':_0x19ee71[_0xe0b0('0x49')]['id']}})['then'](handleEntityNotFound(_0xf9e694,null))['then'](removeEntity(_0xf9e694,null))[_0xe0b0('0x43')](handleError(_0xf9e694,null));}; \ No newline at end of file +var _0xdb28=['error','stack','name','send','index','CloudProvider','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','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'];(function(_0x32eebe,_0x39e1d9){var _0x320061=function(_0x2a5da5){while(--_0x2a5da5){_0x32eebe['push'](_0x32eebe['shift']());}};_0x320061(++_0x39e1d9);}(_0xdb28,0x106));var _0x8db2=function(_0x135aaa,_0x28f53e){_0x135aaa=_0x135aaa-0x0;var _0x1e9a05=_0xdb28[_0x135aaa];return _0x1e9a05;};'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']=[{'all':!![]}];}return db[_0x8db2('0x2b')][_0x8db2('0x40')](_0x21bae5);})['then'](function(_0x49a7ae){_0x3124d5[_0x8db2('0x41')]=_0x49a7ae;return _0x3124d5;})['then'](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x42')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x43')]=function(_0x313130,_0x307783){var _0xb4fe2c={'raw':!![],'where':{'id':_0x313130[_0x8db2('0x44')]['id']}},_0x30d606={};_0x30d606['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x45')]);_0x30d606[_0x8db2('0x30')]=_['keys'](_0x313130[_0x8db2('0x30')]);_0x30d606[_0x8db2('0x39')]=_[_0x8db2('0x46')](_0x30d606[_0x8db2('0x32')],_0x30d606['query']);_0xb4fe2c[_0x8db2('0x34')]=_['intersection'](_0x30d606[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x313130[_0x8db2('0x30')]['fields']));_0xb4fe2c['attributes']=_0xb4fe2c[_0x8db2('0x34')]['length']?_0xb4fe2c[_0x8db2('0x34')]:_0x30d606[_0x8db2('0x32')];if(_0x313130[_0x8db2('0x30')][_0x8db2('0x3f')]){_0xb4fe2c[_0x8db2('0x47')]=[{'all':!![]}];}_0xb4fe2c=_[_0x8db2('0x3d')]({},_0xb4fe2c,_0x313130[_0x8db2('0x3e')]);return db[_0x8db2('0x2b')][_0x8db2('0x48')](_0xb4fe2c)[_0x8db2('0x24')](handleEntityNotFound(_0x307783,null))[_0x8db2('0x24')](respondWithResult(_0x307783,null))[_0x8db2('0x42')](handleError(_0x307783,null));};exports['create']=function(_0x449109,_0x2ada52){return db[_0x8db2('0x2b')][_0x8db2('0x49')](_0x449109['body'],{})['then'](respondWithResult(_0x2ada52,0xc9))[_0x8db2('0x42')](handleError(_0x2ada52,null));};exports[_0x8db2('0x23')]=function(_0x164020,_0x4c66e5){if(_0x164020['body']['id']){delete _0x164020['body']['id'];}return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x164020[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x4c66e5,null))[_0x8db2('0x24')](saveUpdates(_0x164020[_0x8db2('0x4a')],null))[_0x8db2('0x24')](respondWithResult(_0x4c66e5,null))['catch'](handleError(_0x4c66e5,null));};exports['destroy']=function(_0x3d29bc,_0x18c6ef){return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x3d29bc[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x18c6ef,null))[_0x8db2('0x24')](removeEntity(_0x18c6ef,null))[_0x8db2('0x42')](handleError(_0x18c6ef,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index a2b4199..b01c9de 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 _0x98ef=['cloud_providers','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x98ef,0x17a));var _0xf98e=function(_0xb80db7,_0x4ff6b2){_0xb80db7=_0xb80db7-0x0;var _0x232a65=_0x98ef[_0xb80db7];return _0x232a65;};'use strict';var _=require(_0xf98e('0x0'));var util=require(_0xf98e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf98e('0x2'));var BPromise=require(_0xf98e('0x3'));var rp=require(_0xf98e('0x4'));var fs=require('fs');var path=require(_0xf98e('0x5'));var rimraf=require(_0xf98e('0x6'));var config=require(_0xf98e('0x7'));var attributes=require(_0xf98e('0x8'));module[_0xf98e('0x9')]=function(_0x39c8e7,_0x1a1f74){return _0x39c8e7[_0xf98e('0xa')](_0xf98e('0xb'),attributes,{'tableName':_0xf98e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1d3=['bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','define','lodash','api','moment'];(function(_0x3e6980,_0x190736){var _0x5697dc=function(_0xb86ad8){while(--_0xb86ad8){_0x3e6980['push'](_0x3e6980['shift']());}};_0x5697dc(++_0x190736);}(_0xe1d3,0x1e7));var _0x3e1d=function(_0x2fab31,_0x581f28){_0x2fab31=_0x2fab31-0x0;var _0xfb15ee=_0xe1d3[_0x2fab31];return _0xfb15ee;};'use strict';var _=require(_0x3e1d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3e1d('0x1'));var moment=require(_0x3e1d('0x2'));var BPromise=require(_0x3e1d('0x3'));var rp=require(_0x3e1d('0x4'));var fs=require('fs');var path=require(_0x3e1d('0x5'));var rimraf=require(_0x3e1d('0x6'));var config=require(_0x3e1d('0x7'));var attributes=require(_0x3e1d('0x8'));module['exports']=function(_0xb9a2ab,_0x2f3b05){return _0xb9a2ab[_0x3e1d('0x9')]('CloudProvider',attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 1123a9a..abbd2d2 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 _0x17a7=['CloudProvider,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info'];(function(_0xa0be1c,_0x152d5d){var _0x546eec=function(_0x371eae){while(--_0x371eae){_0xa0be1c['push'](_0xa0be1c['shift']());}};_0x546eec(++_0x152d5d);}(_0x17a7,0xc2));var _0x717a=function(_0xe347f2,_0x52e6ac){_0xe347f2=_0xe347f2-0x0;var _0x449aee=_0x17a7[_0xe347f2];return _0x449aee;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x717a('0x0'));var rs=require(_0x717a('0x1'));var fs=require('fs');var Redis=require(_0x717a('0x2'));var db=require(_0x717a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x717a('0x4'))('rpc');var config=require(_0x717a('0x5'));var jayson=require(_0x717a('0x6'));var client=jayson['client'][_0x717a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1ca7a6,_0xd7d2ce,_0x311738){return new BPromise(function(_0x536824,_0x1066d4){return client['request'](_0x1ca7a6,_0x311738)[_0x717a('0x8')](function(_0x567130){logger[_0x717a('0x9')](_0x717a('0xa'),_0xd7d2ce,_0x717a('0xb'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0xd7d2ce,_0x717a('0xb'),JSON[_0x717a('0xc')](_0x567130));if(_0x567130[_0x717a('0xd')]){if(_0x567130[_0x717a('0xd')][_0x717a('0xe')]===0x1f4){logger['error'](_0x717a('0xa'),_0xd7d2ce,_0x567130['error'][_0x717a('0xf')]);return _0x1066d4(_0x567130['error']['message']);}logger['error']('CloudProvider,\x20%s,\x20%s',_0xd7d2ce,_0x567130[_0x717a('0xd')]['message']);return _0x536824(_0x567130[_0x717a('0xd')]['message']);}else{logger[_0x717a('0x9')]('CloudProvider,\x20%s,\x20%s',_0xd7d2ce,_0x717a('0xb'));_0x536824(_0x567130[_0x717a('0x10')][_0x717a('0xf')]);}})['catch'](function(_0x186b4d){logger['error'](_0x717a('0xa'),_0xd7d2ce,_0x186b4d);_0x1066d4(_0x186b4d);});});} \ No newline at end of file +var _0x3e22=['http','request','then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','code','error','CloudProvider,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client'];(function(_0x469ac7,_0x38e416){var _0x22f3b0=function(_0x1a1447){while(--_0x1a1447){_0x469ac7['push'](_0x469ac7['shift']());}};_0x22f3b0(++_0x38e416);}(_0x3e22,0xa8));var _0x23e2=function(_0x306d5d,_0x3293d5){_0x306d5d=_0x306d5d-0x0;var _0xb5cee4=_0x3e22[_0x306d5d];return _0xb5cee4;};'use strict';var _=require('lodash');var util=require(_0x23e2('0x0'));var moment=require('moment');var BPromise=require(_0x23e2('0x1'));var rs=require(_0x23e2('0x2'));var fs=require('fs');var Redis=require(_0x23e2('0x3'));var db=require(_0x23e2('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x23e2('0x5'));var config=require(_0x23e2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x23e2('0x7')][_0x23e2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a8351,_0x927fbb,_0xb71434){return new BPromise(function(_0x4c13ae,_0x64c91b){return client[_0x23e2('0x9')](_0x3a8351,_0xb71434)[_0x23e2('0xa')](function(_0x75da0a){logger[_0x23e2('0xb')]('CloudProvider,\x20%s,\x20%s',_0x927fbb,_0x23e2('0xc'));logger[_0x23e2('0xd')](_0x23e2('0xe'),_0x927fbb,_0x23e2('0xc'),JSON[_0x23e2('0xf')](_0x75da0a));if(_0x75da0a['error']){if(_0x75da0a['error'][_0x23e2('0x10')]===0x1f4){logger[_0x23e2('0x11')](_0x23e2('0x12'),_0x927fbb,_0x75da0a[_0x23e2('0x11')][_0x23e2('0x13')]);return _0x64c91b(_0x75da0a[_0x23e2('0x11')][_0x23e2('0x13')]);}logger[_0x23e2('0x11')](_0x23e2('0x12'),_0x927fbb,_0x75da0a[_0x23e2('0x11')][_0x23e2('0x13')]);return _0x4c13ae(_0x75da0a[_0x23e2('0x11')][_0x23e2('0x13')]);}else{logger[_0x23e2('0xb')]('CloudProvider,\x20%s,\x20%s',_0x927fbb,_0x23e2('0xc'));_0x4c13ae(_0x75da0a[_0x23e2('0x14')][_0x23e2('0x13')]);}})[_0x23e2('0x15')](function(_0x276c2d){logger[_0x23e2('0x11')](_0x23e2('0x12'),_0x927fbb,_0x276c2d);_0x64c91b(_0x276c2d);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 9858800..1770124 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 _0x745d=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x38b777,_0x58b31e){var _0x41da2c=function(_0x1e929a){while(--_0x1e929a){_0x38b777['push'](_0x38b777['shift']());}};_0x41da2c(++_0x58b31e);}(_0x745d,0xec));var _0xd745=function(_0x383a25,_0x1c34c7){_0x383a25=_0x383a25-0x0;var _0x465e8e=_0x745d[_0x383a25];return _0x465e8e;};'use strict';var multer=require(_0xd745('0x0'));var util=require(_0xd745('0x1'));var path=require(_0xd745('0x2'));var timeout=require(_0xd745('0x3'));var express=require(_0xd745('0x4'));var router=express['Router']();var fs_extra=require(_0xd745('0x5'));var auth=require(_0xd745('0x6'));var interaction=require(_0xd745('0x7'));var config=require(_0xd745('0x8'));var controller=require(_0xd745('0x9'));router[_0xd745('0xa')]('/',auth[_0xd745('0xb')](),controller['index']);router[_0xd745('0xa')](_0xd745('0xc'),auth[_0xd745('0xb')](),controller[_0xd745('0xd')]);router[_0xd745('0xe')]('/',auth[_0xd745('0xb')](),controller[_0xd745('0xf')]);router['put']('/:id',auth[_0xd745('0xb')](),controller[_0xd745('0x10')]);router[_0xd745('0x11')](_0xd745('0xc'),auth[_0xd745('0xb')](),controller[_0xd745('0x12')]);module[_0xd745('0x13')]=router; \ No newline at end of file +var _0xc0e3=['update','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id'];(function(_0x3b1b23,_0x21bccd){var _0x1efc85=function(_0x102a95){while(--_0x102a95){_0x3b1b23['push'](_0x3b1b23['shift']());}};_0x1efc85(++_0x21bccd);}(_0xc0e3,0x1a5));var _0x3c0e=function(_0x2d72ab,_0x5a97f5){_0x2d72ab=_0x2d72ab-0x0;var _0x256423=_0xc0e3[_0x2d72ab];return _0x256423;};'use strict';var multer=require(_0x3c0e('0x0'));var util=require('util');var path=require(_0x3c0e('0x1'));var timeout=require(_0x3c0e('0x2'));var express=require('express');var router=express[_0x3c0e('0x3')]();var fs_extra=require(_0x3c0e('0x4'));var auth=require(_0x3c0e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3c0e('0x6'));var controller=require(_0x3c0e('0x7'));router[_0x3c0e('0x8')]('/',auth[_0x3c0e('0x9')](),controller[_0x3c0e('0xa')]);router[_0x3c0e('0x8')]('/:id',auth[_0x3c0e('0x9')](),controller[_0x3c0e('0xb')]);router[_0x3c0e('0xc')]('/',auth[_0x3c0e('0x9')](),controller[_0x3c0e('0xd')]);router[_0x3c0e('0xe')](_0x3c0e('0xf'),auth['isAuthenticated'](),controller[_0x3c0e('0x10')]);router[_0x3c0e('0x11')](_0x3c0e('0xf'),auth['isAuthenticated'](),controller[_0x3c0e('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 4fff228..a316ca7 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 _0x46fb=['name','STRING','sequelize','exports'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x46fb,0x1ce));var _0xb46f=function(_0x4c3f46,_0x41f5ce){_0x4c3f46=_0x4c3f46-0x0;var _0x3a094a=_0x46fb[_0x4c3f46];return _0x3a094a;};'use strict';var Sequelize=require(_0xb46f('0x0'));module[_0xb46f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb46f('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xb46f('0x3')]},'companyId':{'type':Sequelize[_0xb46f('0x3')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xb46f('0x3')]},'fax':{'type':Sequelize[_0xb46f('0x3')]},'type':{'type':Sequelize[_0xb46f('0x3')]},'street':{'type':Sequelize[_0xb46f('0x3')]},'postalCode':{'type':Sequelize[_0xb46f('0x3')]},'city':{'type':Sequelize[_0xb46f('0x3')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xb46f('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xb46f('0x3')]},'sStreet':{'type':Sequelize[_0xb46f('0x3')]},'sPostalCode':{'type':Sequelize[_0xb46f('0x3')]},'sCity':{'type':Sequelize[_0xb46f('0x3')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb46f('0x3')]}}; \ No newline at end of file +var _0x4635=['sequelize','exports','STRING','name'];(function(_0x3b150c,_0x2f93f8){var _0x5cd414=function(_0x26305e){while(--_0x26305e){_0x3b150c['push'](_0x3b150c['shift']());}};_0x5cd414(++_0x2f93f8);}(_0x4635,0x80));var _0x5463=function(_0x5c638f,_0x176046){_0x5c638f=_0x5c638f-0x0;var _0x5b8b44=_0x4635[_0x5c638f];return _0x5b8b44;};'use strict';var Sequelize=require(_0x5463('0x0'));module[_0x5463('0x1')]={'name':{'type':Sequelize[_0x5463('0x2')],'unique':_0x5463('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x5463('0x2')]},'companyId':{'type':Sequelize[_0x5463('0x2')]},'website':{'type':Sequelize[_0x5463('0x2')]},'phone':{'type':Sequelize[_0x5463('0x2')]},'fax':{'type':Sequelize[_0x5463('0x2')]},'type':{'type':Sequelize[_0x5463('0x2')]},'street':{'type':Sequelize[_0x5463('0x2')]},'postalCode':{'type':Sequelize[_0x5463('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x5463('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x5463('0x2')]},'sStreet':{'type':Sequelize[_0x5463('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x5463('0x2')]},'sCountry':{'type':Sequelize[_0x5463('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 02c88a4..0adc231 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 _0x31f4=['ids','getContacts','findOne','fields','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Companies','UserProfileResource','end','error','name','send','index','CmCompany','keys','query','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','map','options','include','findAll','rows','catch','params','model','rawAttributes','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','CmContact','addContacts'];(function(_0x4e6eac,_0x3f4365){var _0x79f963=function(_0x36fc3c){while(--_0x36fc3c){_0x4e6eac['push'](_0x4e6eac['shift']());}};_0x79f963(++_0x3f4365);}(_0x31f4,0xb9));var _0x431f=function(_0x207811,_0x3420a6){_0x207811=_0x207811-0x0;var _0x170d56=_0x31f4[_0x207811];return _0x170d56;};'use strict';var emlformat=require(_0x431f('0x0'));var rimraf=require(_0x431f('0x1'));var zipdir=require(_0x431f('0x2'));var jsonpatch=require(_0x431f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x431f('0x4'));var Mustache=require(_0x431f('0x5'));var util=require('util');var path=require('path');var sox=require(_0x431f('0x6'));var csv=require(_0x431f('0x7'));var ejs=require(_0x431f('0x8'));var fs=require('fs');var fs_extra=require(_0x431f('0x9'));var _=require(_0x431f('0xa'));var squel=require(_0x431f('0xb'));var crypto=require(_0x431f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x431f('0xd'));var toCsv=require(_0x431f('0x7'));var querystring=require('querystring');var Papa=require(_0x431f('0xe'));var Redis=require(_0x431f('0xf'));var authService=require(_0x431f('0x10'));var qs=require(_0x431f('0x11'));var as=require(_0x431f('0x12'));var hardwareService=require(_0x431f('0x13'));var logger=require('../../config/logger')(_0x431f('0x14'));var utils=require(_0x431f('0x15'));var config=require(_0x431f('0x16'));var licenseUtil=require(_0x431f('0x17'));var db=require(_0x431f('0x18'))['db'];function respondWithStatusCode(_0xaa9172,_0x9aace6){_0x9aace6=_0x9aace6||0xcc;return function(_0x275d13){if(_0x275d13){return _0xaa9172[_0x431f('0x19')](_0x9aace6);}return _0xaa9172[_0x431f('0x1a')](_0x9aace6)['end']();};}function respondWithResult(_0x54d8dd,_0x5a4ba2){_0x5a4ba2=_0x5a4ba2||0xc8;return function(_0x4b8fb6){if(_0x4b8fb6){return _0x54d8dd['status'](_0x5a4ba2)[_0x431f('0x1b')](_0x4b8fb6);}};}function respondWithFilteredResult(_0x1cf455,_0x50b751){return function(_0x377333){if(_0x377333){var _0x2af4c7=typeof _0x50b751['offset']===_0x431f('0x1c')&&typeof _0x50b751[_0x431f('0x1d')]===_0x431f('0x1c');var _0xfa8889=_0x377333[_0x431f('0x1e')];var _0x3b29c8=_0x2af4c7?0x0:_0x50b751[_0x431f('0x1f')];var _0x4a5ed3=_0x2af4c7?_0x377333[_0x431f('0x1e')]:_0x50b751[_0x431f('0x1f')]+_0x50b751[_0x431f('0x1d')];var _0x4cff79;if(_0x4a5ed3>=_0xfa8889){_0x4a5ed3=_0xfa8889;_0x4cff79=0xc8;}else{_0x4cff79=0xce;}_0x1cf455[_0x431f('0x1a')](_0x4cff79);return _0x1cf455[_0x431f('0x20')](_0x431f('0x21'),_0x3b29c8+'-'+_0x4a5ed3+'/'+_0xfa8889)[_0x431f('0x1b')](_0x377333);}return null;};}function patchUpdates(_0x466ec4){return function(_0x1e142f){try{jsonpatch[_0x431f('0x22')](_0x1e142f,_0x466ec4,!![]);}catch(_0x32c963){return BPromise[_0x431f('0x23')](_0x32c963);}return _0x1e142f[_0x431f('0x24')]();};}function saveUpdates(_0x56b8e9,_0xd09961){return function(_0x1c515d){if(_0x1c515d){return _0x1c515d[_0x431f('0x25')](_0x56b8e9)[_0x431f('0x26')](function(_0xbc6245){return _0xbc6245;});}return null;};}function removeEntity(_0x5d4967,_0x1b4ce6){return function(_0x3a7b52){if(_0x3a7b52){return _0x3a7b52[_0x431f('0x27')]()[_0x431f('0x26')](function(){var _0x4c876b=_0x3a7b52[_0x431f('0x28')]({'plain':!![]});var _0x4be5e0=_0x431f('0x29');return db[_0x431f('0x2a')][_0x431f('0x27')]({'where':{'type':_0x4be5e0,'resourceId':_0x4c876b['id']}})[_0x431f('0x26')](function(){return _0x3a7b52;});})[_0x431f('0x26')](function(){_0x5d4967[_0x431f('0x1a')](0xcc)[_0x431f('0x2b')]();});}};}function handleEntityNotFound(_0x1b17d6,_0x24e49b){return function(_0x6052dc){if(!_0x6052dc){_0x1b17d6[_0x431f('0x19')](0x194);}return _0x6052dc;};}function handleError(_0x7c652a,_0x27d46b){_0x27d46b=_0x27d46b||0x1f4;return function(_0x30954a){logger[_0x431f('0x2c')](_0x30954a['stack']);if(_0x30954a[_0x431f('0x2d')]){delete _0x30954a['name'];}_0x7c652a['status'](_0x27d46b)[_0x431f('0x2e')](_0x30954a);};}exports[_0x431f('0x2f')]=function(_0x5bb2ea,_0x2fa309){var _0x20c0ea={},_0x5e6b97={},_0x30f274={'count':0x0,'rows':[]};return db[_0x431f('0x30')]['describe']()[_0x431f('0x26')](function(_0x15d657){_0x5e6b97['model']=_[_0x431f('0x31')](_0x15d657);_0x5e6b97[_0x431f('0x32')]=_['keys'](_0x5bb2ea[_0x431f('0x32')]);_0x5e6b97[_0x431f('0x33')]=_[_0x431f('0x34')](_0x5e6b97['model'],_0x5e6b97[_0x431f('0x32')]);_0x20c0ea[_0x431f('0x35')]=_[_0x431f('0x34')](_0x5e6b97['model'],qs['fields'](_0x5bb2ea[_0x431f('0x32')]['fields']));_0x20c0ea[_0x431f('0x35')]=_0x20c0ea[_0x431f('0x35')][_0x431f('0x36')]?_0x20c0ea['attributes']:_0x5e6b97['model'];if(!_0x5bb2ea[_0x431f('0x32')]['hasOwnProperty'](_0x431f('0x37'))){_0x20c0ea[_0x431f('0x1d')]=qs[_0x431f('0x1d')](_0x5bb2ea['query'][_0x431f('0x1d')]);_0x20c0ea[_0x431f('0x1f')]=qs[_0x431f('0x1f')](_0x5bb2ea[_0x431f('0x32')][_0x431f('0x1f')]);}_0x20c0ea[_0x431f('0x38')]=qs['sort'](_0x5bb2ea[_0x431f('0x32')][_0x431f('0x39')]);_0x20c0ea[_0x431f('0x3a')]=qs[_0x431f('0x33')](_[_0x431f('0x3b')](_0x5bb2ea['query'],_0x5e6b97[_0x431f('0x33')]),_0x15d657);if(_0x5bb2ea[_0x431f('0x32')][_0x431f('0x3c')]){_0x20c0ea[_0x431f('0x3a')]=_[_0x431f('0x3d')](_0x20c0ea[_0x431f('0x3a')],{'$or':_[_0x431f('0x3e')](_0x20c0ea['attributes'],function(_0x32165a){var _0x40105e={};_0x40105e[_0x32165a]={'$like':'%'+_0x5bb2ea[_0x431f('0x32')][_0x431f('0x3c')]+'%'};return _0x40105e;})});}_0x20c0ea=_['merge']({},_0x20c0ea,_0x5bb2ea[_0x431f('0x3f')]);var _0x80fe0={'where':_0x20c0ea['where']};return db[_0x431f('0x30')][_0x431f('0x1e')](_0x80fe0)[_0x431f('0x26')](function(_0x1ac8c5){_0x30f274[_0x431f('0x1e')]=_0x1ac8c5;if(_0x5bb2ea[_0x431f('0x32')]['includeAll']){_0x20c0ea[_0x431f('0x40')]=[{'all':!![]}];}return db[_0x431f('0x30')][_0x431f('0x41')](_0x20c0ea);})[_0x431f('0x26')](function(_0x410cde){_0x30f274[_0x431f('0x42')]=_0x410cde;return _0x30f274;})[_0x431f('0x26')](respondWithFilteredResult(_0x2fa309,_0x20c0ea))[_0x431f('0x43')](handleError(_0x2fa309,null));})[_0x431f('0x43')](handleError(_0x2fa309,null));};exports['show']=function(_0x3851bf,_0x582daa){var _0x5ae499={'raw':![],'where':{'id':_0x3851bf[_0x431f('0x44')]['id']}},_0x590c1e={};_0x590c1e[_0x431f('0x45')]=_[_0x431f('0x31')](db[_0x431f('0x30')][_0x431f('0x46')]);_0x590c1e[_0x431f('0x32')]=_[_0x431f('0x31')](_0x3851bf[_0x431f('0x32')]);_0x590c1e['filters']=_[_0x431f('0x34')](_0x590c1e[_0x431f('0x45')],_0x590c1e[_0x431f('0x32')]);_0x5ae499[_0x431f('0x35')]=_[_0x431f('0x34')](_0x590c1e[_0x431f('0x45')],qs['fields'](_0x3851bf['query']['fields']));_0x5ae499[_0x431f('0x35')]=_0x5ae499[_0x431f('0x35')][_0x431f('0x36')]?_0x5ae499[_0x431f('0x35')]:_0x590c1e['model'];if(_0x3851bf[_0x431f('0x32')][_0x431f('0x47')]){_0x5ae499[_0x431f('0x40')]=[{'all':!![]}];}_0x5ae499=_[_0x431f('0x3d')]({},_0x5ae499,_0x3851bf['options']);return db[_0x431f('0x30')][_0x431f('0x48')](_0x5ae499)[_0x431f('0x26')](handleEntityNotFound(_0x582daa,null))[_0x431f('0x26')](respondWithResult(_0x582daa,null))[_0x431f('0x43')](handleError(_0x582daa,null));};exports[_0x431f('0x49')]=function(_0x524e2d,_0x39f509){return db[_0x431f('0x30')][_0x431f('0x49')](_0x524e2d['body'],{})[_0x431f('0x26')](function(_0x1358f4){var _0x35c2f9=_0x524e2d[_0x431f('0x4a')][_0x431f('0x28')]({'plain':!![]});if(!_0x35c2f9)throw new Error(_0x431f('0x4b'));if(_0x35c2f9[_0x431f('0x4c')]==='user'){var _0x7f70c5=_0x1358f4[_0x431f('0x28')]({'plain':!![]});var _0x522c74=_0x431f('0x29');return db[_0x431f('0x4d')]['find']({'where':{'name':_0x522c74,'userProfileId':_0x35c2f9[_0x431f('0x4e')]},'raw':!![]})[_0x431f('0x26')](function(_0x1afb9c){if(_0x1afb9c&&_0x1afb9c[_0x431f('0x4f')]===0x0){return db['UserProfileResource'][_0x431f('0x49')]({'name':_0x7f70c5[_0x431f('0x2d')],'resourceId':_0x7f70c5['id'],'type':_0x1afb9c[_0x431f('0x2d')],'sectionId':_0x1afb9c['id']},{})['then'](function(){return _0x1358f4;});}else{return _0x1358f4;}})[_0x431f('0x43')](function(_0x5a7cea){logger['error'](_0x431f('0x50'),_0x5a7cea);throw _0x5a7cea;});}return _0x1358f4;})[_0x431f('0x26')](respondWithResult(_0x39f509,0xc9))[_0x431f('0x43')](handleError(_0x39f509,null));};exports[_0x431f('0x25')]=function(_0x5da53f,_0x39d627){if(_0x5da53f[_0x431f('0x51')]['id']){delete _0x5da53f['body']['id'];}return db['CmCompany']['find']({'where':{'id':_0x5da53f[_0x431f('0x44')]['id']}})[_0x431f('0x26')](handleEntityNotFound(_0x39d627,null))[_0x431f('0x26')](saveUpdates(_0x5da53f[_0x431f('0x51')],null))[_0x431f('0x26')](respondWithResult(_0x39d627,null))[_0x431f('0x43')](handleError(_0x39d627,null));};exports[_0x431f('0x27')]=function(_0x3f3b97,_0x305e5a){return db[_0x431f('0x30')][_0x431f('0x48')]({'where':{'id':_0x3f3b97['params']['id']}})[_0x431f('0x26')](handleEntityNotFound(_0x305e5a,null))['then'](removeEntity(_0x305e5a,null))['catch'](handleError(_0x305e5a,null));};exports[_0x431f('0x52')]=function(_0x10c2f4,_0x13c320){return db[_0x431f('0x30')][_0x431f('0x52')]()[_0x431f('0x26')](respondWithResult(_0x13c320,null))['catch'](handleError(_0x13c320,null));};exports['addContacts']=function(_0x1caeca,_0x34ce79,_0x32b0a1){return db[_0x431f('0x53')]['find']({'where':{'id':_0x1caeca['params']['id']}})[_0x431f('0x26')](handleEntityNotFound(_0x34ce79,null))['then'](function(_0x2d78e1){if(_0x2d78e1){return _0x2d78e1[_0x431f('0x54')](_0x1caeca[_0x431f('0x51')][_0x431f('0x55')],_['omit'](_0x1caeca[_0x431f('0x51')],[_0x431f('0x55'),'id'])||{});}})[_0x431f('0x26')](respondWithResult(_0x34ce79,null))[_0x431f('0x43')](handleError(_0x34ce79,null));};exports[_0x431f('0x56')]=function(_0x498083,_0x372639,_0x564864){var _0x29be72={};var _0x51fd7b={};var _0x318bd6;var _0x38867b;return db[_0x431f('0x30')][_0x431f('0x57')]({'where':{'id':_0x498083[_0x431f('0x44')]['id']}})[_0x431f('0x26')](handleEntityNotFound(_0x372639,null))[_0x431f('0x26')](function(_0xf5fcdc){if(_0xf5fcdc){_0x318bd6=_0xf5fcdc;_0x51fd7b['model']=_[_0x431f('0x31')](db[_0x431f('0x53')][_0x431f('0x46')]);_0x51fd7b[_0x431f('0x32')]=_[_0x431f('0x31')](_0x498083[_0x431f('0x32')]);_0x51fd7b[_0x431f('0x33')]=_['intersection'](_0x51fd7b[_0x431f('0x45')],_0x51fd7b['query']);_0x29be72[_0x431f('0x35')]=_['intersection'](_0x51fd7b['model'],qs[_0x431f('0x58')](_0x498083[_0x431f('0x32')][_0x431f('0x58')]));_0x29be72['attributes']=_0x29be72[_0x431f('0x35')][_0x431f('0x36')]?_0x29be72['attributes']:_0x51fd7b['model'];_0x29be72[_0x431f('0x38')]=qs[_0x431f('0x39')](_0x498083[_0x431f('0x32')]['sort']);_0x29be72['where']=qs['filters'](_['pick'](_0x498083[_0x431f('0x32')],_0x51fd7b[_0x431f('0x33')]));if(_0x498083[_0x431f('0x32')][_0x431f('0x3c')]){_0x29be72[_0x431f('0x3a')]=_[_0x431f('0x3d')](_0x29be72[_0x431f('0x3a')],{'$or':_['map'](_0x29be72['attributes'],function(_0x1c6402){var _0x6a4591={};_0x6a4591[_0x1c6402]={'$like':'%'+_0x498083[_0x431f('0x32')][_0x431f('0x3c')]+'%'};return _0x6a4591;})});}_0x29be72=_['merge']({},_0x29be72,_0x498083['options']);return _0x318bd6['getContacts'](_0x29be72);}})['then'](function(_0x11be15){if(_0x11be15){_0x38867b=_0x11be15[_0x431f('0x36')];if(!_0x498083['query'][_0x431f('0x59')]('nolimit')){_0x29be72['limit']=qs[_0x431f('0x1d')](_0x498083[_0x431f('0x32')][_0x431f('0x1d')]);_0x29be72[_0x431f('0x1f')]=qs[_0x431f('0x1f')](_0x498083[_0x431f('0x32')][_0x431f('0x1f')]);}return _0x318bd6['getContacts'](_0x29be72);}})[_0x431f('0x26')](function(_0x5a877b){if(_0x5a877b){return _0x5a877b?{'count':_0x38867b,'rows':_0x5a877b}:null;}})['then'](respondWithResult(_0x372639,null))[_0x431f('0x43')](handleError(_0x372639,null));}; \ No newline at end of file +var _0x0be0=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','Companies','UserProfileResource','destroy','end','stack','name','send','index','describe','model','keys','filters','intersection','query','fields','attributes','length','order','sort','filter','where','merge','map','includeAll','include','CmCompany','findAll','rows','catch','show','params','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','CmContact','addContacts','ids','findOne','rawAttributes','pick','options','getContacts','hasOwnProperty','nolimit'];(function(_0x3aed29,_0x242a8a){var _0x5379ef=function(_0x9c19d5){while(--_0x9c19d5){_0x3aed29['push'](_0x3aed29['shift']());}};_0x5379ef(++_0x242a8a);}(_0x0be0,0x1e0));var _0x00be=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x0be0[_0x1035c1];return _0x308d67;};'use strict';var emlformat=require(_0x00be('0x0'));var rimraf=require(_0x00be('0x1'));var zipdir=require(_0x00be('0x2'));var jsonpatch=require(_0x00be('0x3'));var rp=require('request-promise');var moment=require(_0x00be('0x4'));var BPromise=require(_0x00be('0x5'));var Mustache=require(_0x00be('0x6'));var util=require('util');var path=require(_0x00be('0x7'));var sox=require(_0x00be('0x8'));var csv=require(_0x00be('0x9'));var ejs=require(_0x00be('0xa'));var fs=require('fs');var fs_extra=require(_0x00be('0xb'));var _=require(_0x00be('0xc'));var squel=require(_0x00be('0xd'));var crypto=require(_0x00be('0xe'));var jsforce=require(_0x00be('0xf'));var deskjs=require(_0x00be('0x10'));var toCsv=require('to-csv');var querystring=require(_0x00be('0x11'));var Papa=require(_0x00be('0x12'));var Redis=require(_0x00be('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x00be('0x14'));var as=require(_0x00be('0x15'));var hardwareService=require(_0x00be('0x16'));var logger=require(_0x00be('0x17'))(_0x00be('0x18'));var utils=require(_0x00be('0x19'));var config=require(_0x00be('0x1a'));var licenseUtil=require(_0x00be('0x1b'));var db=require(_0x00be('0x1c'))['db'];function respondWithStatusCode(_0x3a1e21,_0x1041e2){_0x1041e2=_0x1041e2||0xcc;return function(_0x493524){if(_0x493524){return _0x3a1e21[_0x00be('0x1d')](_0x1041e2);}return _0x3a1e21[_0x00be('0x1e')](_0x1041e2)['end']();};}function respondWithResult(_0x16718f,_0x592942){_0x592942=_0x592942||0xc8;return function(_0x307142){if(_0x307142){return _0x16718f[_0x00be('0x1e')](_0x592942)[_0x00be('0x1f')](_0x307142);}};}function respondWithFilteredResult(_0x58bdc8,_0x22557b){return function(_0x170535){if(_0x170535){var _0x3b8e5c=typeof _0x22557b[_0x00be('0x20')]===_0x00be('0x21')&&typeof _0x22557b[_0x00be('0x22')]===_0x00be('0x21');var _0x4a5da6=_0x170535[_0x00be('0x23')];var _0x407175=_0x3b8e5c?0x0:_0x22557b[_0x00be('0x20')];var _0x10c331=_0x3b8e5c?_0x170535['count']:_0x22557b[_0x00be('0x20')]+_0x22557b[_0x00be('0x22')];var _0x5c8bfa;if(_0x10c331>=_0x4a5da6){_0x10c331=_0x4a5da6;_0x5c8bfa=0xc8;}else{_0x5c8bfa=0xce;}_0x58bdc8[_0x00be('0x1e')](_0x5c8bfa);return _0x58bdc8[_0x00be('0x24')](_0x00be('0x25'),_0x407175+'-'+_0x10c331+'/'+_0x4a5da6)[_0x00be('0x1f')](_0x170535);}return null;};}function patchUpdates(_0x4f51e9){return function(_0x3d16c2){try{jsonpatch[_0x00be('0x26')](_0x3d16c2,_0x4f51e9,!![]);}catch(_0x126c8a){return BPromise[_0x00be('0x27')](_0x126c8a);}return _0x3d16c2[_0x00be('0x28')]();};}function saveUpdates(_0x5a4c2a,_0x44bd25){return function(_0x433bc4){if(_0x433bc4){return _0x433bc4[_0x00be('0x29')](_0x5a4c2a)[_0x00be('0x2a')](function(_0x290b48){return _0x290b48;});}return null;};}function removeEntity(_0xf7c974,_0x1327a6){return function(_0x326657){if(_0x326657){return _0x326657['destroy']()[_0x00be('0x2a')](function(){var _0x113cbc=_0x326657[_0x00be('0x2b')]({'plain':!![]});var _0x2a9086=_0x00be('0x2c');return db[_0x00be('0x2d')][_0x00be('0x2e')]({'where':{'type':_0x2a9086,'resourceId':_0x113cbc['id']}})[_0x00be('0x2a')](function(){return _0x326657;});})[_0x00be('0x2a')](function(){_0xf7c974[_0x00be('0x1e')](0xcc)[_0x00be('0x2f')]();});}};}function handleEntityNotFound(_0x4f7183,_0xe717ee){return function(_0x5b72e7){if(!_0x5b72e7){_0x4f7183[_0x00be('0x1d')](0x194);}return _0x5b72e7;};}function handleError(_0x4083b7,_0x361592){_0x361592=_0x361592||0x1f4;return function(_0x295f95){logger['error'](_0x295f95[_0x00be('0x30')]);if(_0x295f95[_0x00be('0x31')]){delete _0x295f95[_0x00be('0x31')];}_0x4083b7[_0x00be('0x1e')](_0x361592)[_0x00be('0x32')](_0x295f95);};}exports[_0x00be('0x33')]=function(_0x349391,_0x4aa99b){var _0x23f22b={},_0x1f5bdf={},_0x30f038={'count':0x0,'rows':[]};return db['CmCompany'][_0x00be('0x34')]()[_0x00be('0x2a')](function(_0x27c96f){_0x1f5bdf[_0x00be('0x35')]=_[_0x00be('0x36')](_0x27c96f);_0x1f5bdf['query']=_['keys'](_0x349391['query']);_0x1f5bdf[_0x00be('0x37')]=_[_0x00be('0x38')](_0x1f5bdf[_0x00be('0x35')],_0x1f5bdf[_0x00be('0x39')]);_0x23f22b['attributes']=_[_0x00be('0x38')](_0x1f5bdf[_0x00be('0x35')],qs[_0x00be('0x3a')](_0x349391[_0x00be('0x39')]['fields']));_0x23f22b[_0x00be('0x3b')]=_0x23f22b[_0x00be('0x3b')][_0x00be('0x3c')]?_0x23f22b[_0x00be('0x3b')]:_0x1f5bdf['model'];if(!_0x349391[_0x00be('0x39')]['hasOwnProperty']('nolimit')){_0x23f22b[_0x00be('0x22')]=qs['limit'](_0x349391[_0x00be('0x39')]['limit']);_0x23f22b[_0x00be('0x20')]=qs[_0x00be('0x20')](_0x349391['query']['offset']);}_0x23f22b[_0x00be('0x3d')]=qs[_0x00be('0x3e')](_0x349391[_0x00be('0x39')][_0x00be('0x3e')]);_0x23f22b['where']=qs[_0x00be('0x37')](_['pick'](_0x349391[_0x00be('0x39')],_0x1f5bdf[_0x00be('0x37')]),_0x27c96f);if(_0x349391[_0x00be('0x39')][_0x00be('0x3f')]){_0x23f22b[_0x00be('0x40')]=_[_0x00be('0x41')](_0x23f22b[_0x00be('0x40')],{'$or':_[_0x00be('0x42')](_0x23f22b[_0x00be('0x3b')],function(_0x38ad51){var _0x534ee9={};_0x534ee9[_0x38ad51]={'$like':'%'+_0x349391[_0x00be('0x39')]['filter']+'%'};return _0x534ee9;})});}_0x23f22b=_['merge']({},_0x23f22b,_0x349391['options']);var _0xd04ead={'where':_0x23f22b['where']};return db['CmCompany'][_0x00be('0x23')](_0xd04ead)[_0x00be('0x2a')](function(_0x594bab){_0x30f038[_0x00be('0x23')]=_0x594bab;if(_0x349391['query'][_0x00be('0x43')]){_0x23f22b[_0x00be('0x44')]=[{'all':!![]}];}return db[_0x00be('0x45')][_0x00be('0x46')](_0x23f22b);})[_0x00be('0x2a')](function(_0x41edd6){_0x30f038[_0x00be('0x47')]=_0x41edd6;return _0x30f038;})['then'](respondWithFilteredResult(_0x4aa99b,_0x23f22b))[_0x00be('0x48')](handleError(_0x4aa99b,null));})[_0x00be('0x48')](handleError(_0x4aa99b,null));};exports[_0x00be('0x49')]=function(_0x230418,_0x108ff6){var _0x468104={'raw':![],'where':{'id':_0x230418[_0x00be('0x4a')]['id']}},_0x1a7799={};_0x1a7799['model']=_['keys'](db[_0x00be('0x45')]['rawAttributes']);_0x1a7799[_0x00be('0x39')]=_[_0x00be('0x36')](_0x230418[_0x00be('0x39')]);_0x1a7799['filters']=_[_0x00be('0x38')](_0x1a7799['model'],_0x1a7799[_0x00be('0x39')]);_0x468104['attributes']=_[_0x00be('0x38')](_0x1a7799[_0x00be('0x35')],qs[_0x00be('0x3a')](_0x230418[_0x00be('0x39')]['fields']));_0x468104[_0x00be('0x3b')]=_0x468104['attributes'][_0x00be('0x3c')]?_0x468104[_0x00be('0x3b')]:_0x1a7799[_0x00be('0x35')];if(_0x230418[_0x00be('0x39')][_0x00be('0x43')]){_0x468104[_0x00be('0x44')]=[{'all':!![]}];}_0x468104=_[_0x00be('0x41')]({},_0x468104,_0x230418['options']);return db[_0x00be('0x45')][_0x00be('0x4b')](_0x468104)[_0x00be('0x2a')](handleEntityNotFound(_0x108ff6,null))['then'](respondWithResult(_0x108ff6,null))[_0x00be('0x48')](handleError(_0x108ff6,null));};exports[_0x00be('0x4c')]=function(_0x1261e1,_0x362e5c){return db['CmCompany'][_0x00be('0x4c')](_0x1261e1[_0x00be('0x4d')],{})[_0x00be('0x2a')](function(_0x40bbba){var _0x210445=_0x1261e1[_0x00be('0x4e')][_0x00be('0x2b')]({'plain':!![]});if(!_0x210445)throw new Error(_0x00be('0x4f'));if(_0x210445[_0x00be('0x50')]===_0x00be('0x4e')){var _0x11ea1e=_0x40bbba['get']({'plain':!![]});var _0x43e2e0='Companies';return db[_0x00be('0x51')][_0x00be('0x4b')]({'where':{'name':_0x43e2e0,'userProfileId':_0x210445[_0x00be('0x52')]},'raw':!![]})[_0x00be('0x2a')](function(_0x3d9faf){if(_0x3d9faf&&_0x3d9faf[_0x00be('0x53')]===0x0){return db[_0x00be('0x2d')]['create']({'name':_0x11ea1e['name'],'resourceId':_0x11ea1e['id'],'type':_0x3d9faf[_0x00be('0x31')],'sectionId':_0x3d9faf['id']},{})[_0x00be('0x2a')](function(){return _0x40bbba;});}else{return _0x40bbba;}})[_0x00be('0x48')](function(_0x31f59a){logger[_0x00be('0x54')](_0x00be('0x55'),_0x31f59a);throw _0x31f59a;});}return _0x40bbba;})[_0x00be('0x2a')](respondWithResult(_0x362e5c,0xc9))[_0x00be('0x48')](handleError(_0x362e5c,null));};exports[_0x00be('0x29')]=function(_0x4f042f,_0x164edd){if(_0x4f042f['body']['id']){delete _0x4f042f[_0x00be('0x4d')]['id'];}return db['CmCompany'][_0x00be('0x4b')]({'where':{'id':_0x4f042f[_0x00be('0x4a')]['id']}})['then'](handleEntityNotFound(_0x164edd,null))[_0x00be('0x2a')](saveUpdates(_0x4f042f['body'],null))[_0x00be('0x2a')](respondWithResult(_0x164edd,null))['catch'](handleError(_0x164edd,null));};exports[_0x00be('0x2e')]=function(_0xe32014,_0x2b3940){return db[_0x00be('0x45')][_0x00be('0x4b')]({'where':{'id':_0xe32014[_0x00be('0x4a')]['id']}})[_0x00be('0x2a')](handleEntityNotFound(_0x2b3940,null))[_0x00be('0x2a')](removeEntity(_0x2b3940,null))[_0x00be('0x48')](handleError(_0x2b3940,null));};exports[_0x00be('0x34')]=function(_0x12ca85,_0x495664){return db[_0x00be('0x45')]['describe']()[_0x00be('0x2a')](respondWithResult(_0x495664,null))['catch'](handleError(_0x495664,null));};exports['addContacts']=function(_0x25df21,_0x52509a,_0x118358){return db[_0x00be('0x56')][_0x00be('0x4b')]({'where':{'id':_0x25df21[_0x00be('0x4a')]['id']}})[_0x00be('0x2a')](handleEntityNotFound(_0x52509a,null))[_0x00be('0x2a')](function(_0x143758){if(_0x143758){return _0x143758[_0x00be('0x57')](_0x25df21[_0x00be('0x4d')][_0x00be('0x58')],_['omit'](_0x25df21[_0x00be('0x4d')],[_0x00be('0x58'),'id'])||{});}})[_0x00be('0x2a')](respondWithResult(_0x52509a,null))[_0x00be('0x48')](handleError(_0x52509a,null));};exports['getContacts']=function(_0x2586ed,_0x56fcb9,_0x5c631a){var _0x36371e={};var _0x3d00ae={};var _0x4dfb12;var _0x582f9f;return db[_0x00be('0x45')][_0x00be('0x59')]({'where':{'id':_0x2586ed['params']['id']}})[_0x00be('0x2a')](handleEntityNotFound(_0x56fcb9,null))[_0x00be('0x2a')](function(_0x214081){if(_0x214081){_0x4dfb12=_0x214081;_0x3d00ae[_0x00be('0x35')]=_['keys'](db[_0x00be('0x56')][_0x00be('0x5a')]);_0x3d00ae[_0x00be('0x39')]=_[_0x00be('0x36')](_0x2586ed['query']);_0x3d00ae[_0x00be('0x37')]=_[_0x00be('0x38')](_0x3d00ae[_0x00be('0x35')],_0x3d00ae[_0x00be('0x39')]);_0x36371e[_0x00be('0x3b')]=_['intersection'](_0x3d00ae[_0x00be('0x35')],qs[_0x00be('0x3a')](_0x2586ed[_0x00be('0x39')][_0x00be('0x3a')]));_0x36371e[_0x00be('0x3b')]=_0x36371e[_0x00be('0x3b')][_0x00be('0x3c')]?_0x36371e[_0x00be('0x3b')]:_0x3d00ae[_0x00be('0x35')];_0x36371e[_0x00be('0x3d')]=qs[_0x00be('0x3e')](_0x2586ed['query'][_0x00be('0x3e')]);_0x36371e['where']=qs[_0x00be('0x37')](_[_0x00be('0x5b')](_0x2586ed[_0x00be('0x39')],_0x3d00ae[_0x00be('0x37')]));if(_0x2586ed[_0x00be('0x39')]['filter']){_0x36371e[_0x00be('0x40')]=_[_0x00be('0x41')](_0x36371e[_0x00be('0x40')],{'$or':_['map'](_0x36371e[_0x00be('0x3b')],function(_0x36355e){var _0x31504a={};_0x31504a[_0x36355e]={'$like':'%'+_0x2586ed['query'][_0x00be('0x3f')]+'%'};return _0x31504a;})});}_0x36371e=_[_0x00be('0x41')]({},_0x36371e,_0x2586ed[_0x00be('0x5c')]);return _0x4dfb12[_0x00be('0x5d')](_0x36371e);}})[_0x00be('0x2a')](function(_0x378250){if(_0x378250){_0x582f9f=_0x378250[_0x00be('0x3c')];if(!_0x2586ed[_0x00be('0x39')][_0x00be('0x5e')](_0x00be('0x5f'))){_0x36371e[_0x00be('0x22')]=qs[_0x00be('0x22')](_0x2586ed[_0x00be('0x39')][_0x00be('0x22')]);_0x36371e[_0x00be('0x20')]=qs[_0x00be('0x20')](_0x2586ed[_0x00be('0x39')][_0x00be('0x20')]);}return _0x4dfb12[_0x00be('0x5d')](_0x36371e);}})[_0x00be('0x2a')](function(_0x1c76bf){if(_0x1c76bf){return _0x1c76bf?{'count':_0x582f9f,'rows':_0x1c76bf}:null;}})[_0x00be('0x2a')](respondWithResult(_0x56fcb9,null))['catch'](handleError(_0x56fcb9,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 680c0de..7952608 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 _0x12cd=['../../config/environment','exports','define','CmCompany','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x352950,_0x280e70){var _0x4dd15e=function(_0x284310){while(--_0x284310){_0x352950['push'](_0x352950['shift']());}};_0x4dd15e(++_0x280e70);}(_0x12cd,0x93));var _0xd12c=function(_0x127536,_0x1ec8e6){_0x127536=_0x127536-0x0;var _0x479510=_0x12cd[_0x127536];return _0x479510;};'use strict';var _=require(_0xd12c('0x0'));var util=require('util');var logger=require(_0xd12c('0x1'))(_0xd12c('0x2'));var moment=require(_0xd12c('0x3'));var BPromise=require('bluebird');var rp=require(_0xd12c('0x4'));var fs=require('fs');var path=require(_0xd12c('0x5'));var rimraf=require(_0xd12c('0x6'));var config=require(_0xd12c('0x7'));var attributes=require('./cmCompany.attributes');module[_0xd12c('0x8')]=function(_0x1ed858,_0x5bd5d5){return _0x1ed858[_0xd12c('0x9')](_0xd12c('0xa'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a44=['define','CmCompany','cm_companies','lodash','util','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports'];(function(_0x4cce60,_0x3321e0){var _0x82e062=function(_0x4cb5f8){while(--_0x4cb5f8){_0x4cce60['push'](_0x4cce60['shift']());}};_0x82e062(++_0x3321e0);}(_0x2a44,0x1c6));var _0x42a4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2a44[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x42a4('0x0'));var util=require(_0x42a4('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x42a4('0x2'));var fs=require('fs');var path=require(_0x42a4('0x3'));var rimraf=require(_0x42a4('0x4'));var config=require(_0x42a4('0x5'));var attributes=require(_0x42a4('0x6'));module[_0x42a4('0x7')]=function(_0x43f4dd,_0x55e3e0){return _0x43f4dd[_0x42a4('0x8')](_0x42a4('0x9'),attributes,{'tableName':_0x42a4('0xa'),'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 809eb33..6578a92 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 _0xd45c=['info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xd45c,0x121));var _0xcd45=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xd45c[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xcd45('0x0'));var util=require(_0xcd45('0x1'));var moment=require(_0xcd45('0x2'));var BPromise=require(_0xcd45('0x3'));var rs=require(_0xcd45('0x4'));var fs=require('fs');var Redis=require(_0xcd45('0x5'));var db=require(_0xcd45('0x6'))['db'];var utils=require(_0xcd45('0x7'));var logger=require(_0xcd45('0x8'))(_0xcd45('0x9'));var config=require('../../config/environment');var jayson=require(_0xcd45('0xa'));var client=jayson[_0xcd45('0xb')][_0xcd45('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2cfd33,_0x5d4097,_0x55c535){return new BPromise(function(_0xb94c6d,_0x4629b1){return client[_0xcd45('0xd')](_0x2cfd33,_0x55c535)[_0xcd45('0xe')](function(_0x1a2602){logger['info'](_0xcd45('0xf'),_0x5d4097,_0xcd45('0x10'));logger[_0xcd45('0x11')](_0xcd45('0x12'),_0x5d4097,_0xcd45('0x10'),JSON[_0xcd45('0x13')](_0x1a2602));if(_0x1a2602[_0xcd45('0x14')]){if(_0x1a2602[_0xcd45('0x14')][_0xcd45('0x15')]===0x1f4){logger['error'](_0xcd45('0xf'),_0x5d4097,_0x1a2602[_0xcd45('0x14')][_0xcd45('0x16')]);return _0x4629b1(_0x1a2602['error'][_0xcd45('0x16')]);}logger['error']('CmCompany,\x20%s,\x20%s',_0x5d4097,_0x1a2602['error'][_0xcd45('0x16')]);return _0xb94c6d(_0x1a2602['error'][_0xcd45('0x16')]);}else{logger[_0xcd45('0x17')](_0xcd45('0xf'),_0x5d4097,'request\x20sent');_0xb94c6d(_0x1a2602[_0xcd45('0x18')]['message']);}})[_0xcd45('0x19')](function(_0x4f5f22){logger[_0xcd45('0x14')](_0xcd45('0xf'),_0x5d4097,_0x4f5f22);_0x4629b1(_0x4f5f22);});});} \ No newline at end of file +var _0x49ea=['message','info','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error'];(function(_0x3b584b,_0x39dc34){var _0x38559d=function(_0x2cbf9e){while(--_0x2cbf9e){_0x3b584b['push'](_0x3b584b['shift']());}};_0x38559d(++_0x39dc34);}(_0x49ea,0x17e));var _0xa49e=function(_0x2a6059,_0x10e31e){_0x2a6059=_0x2a6059-0x0;var _0x5a4182=_0x49ea[_0x2a6059];return _0x5a4182;};'use strict';var _=require('lodash');var util=require(_0xa49e('0x0'));var moment=require('moment');var BPromise=require(_0xa49e('0x1'));var rs=require(_0xa49e('0x2'));var fs=require('fs');var Redis=require(_0xa49e('0x3'));var db=require(_0xa49e('0x4'))['db'];var utils=require(_0xa49e('0x5'));var logger=require(_0xa49e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa49e('0x7'));var client=jayson[_0xa49e('0x8')][_0xa49e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x147e4f,_0x3a8d3b,_0x217648){return new BPromise(function(_0x448db8,_0x5b4fcd){return client[_0xa49e('0xa')](_0x147e4f,_0x217648)[_0xa49e('0xb')](function(_0x51d3f4){logger['info'](_0xa49e('0xc'),_0x3a8d3b,_0xa49e('0xd'));logger[_0xa49e('0xe')](_0xa49e('0xf'),_0x3a8d3b,_0xa49e('0xd'),JSON['stringify'](_0x51d3f4));if(_0x51d3f4[_0xa49e('0x10')]){if(_0x51d3f4[_0xa49e('0x10')]['code']===0x1f4){logger[_0xa49e('0x10')](_0xa49e('0xc'),_0x3a8d3b,_0x51d3f4[_0xa49e('0x10')]['message']);return _0x5b4fcd(_0x51d3f4[_0xa49e('0x10')][_0xa49e('0x11')]);}logger[_0xa49e('0x10')](_0xa49e('0xc'),_0x3a8d3b,_0x51d3f4[_0xa49e('0x10')][_0xa49e('0x11')]);return _0x448db8(_0x51d3f4[_0xa49e('0x10')][_0xa49e('0x11')]);}else{logger[_0xa49e('0x12')](_0xa49e('0xc'),_0x3a8d3b,_0xa49e('0xd'));_0x448db8(_0x51d3f4['result'][_0xa49e('0x11')]);}})['catch'](function(_0x2e510c){logger[_0xa49e('0x10')]('CmCompany,\x20%s,\x20%s',_0x3a8d3b,_0x2e510c);_0x5b4fcd(_0x2e510c);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index c0e4946..0086f4e 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 _0x35a6=['fs-extra','../../components/auth/service','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/contacts','post','create','addContacts','update','delete','destroy','exports','path','connect-timeout','express','Router'];(function(_0x42e289,_0x1698c6){var _0x4df318=function(_0x5e81f4){while(--_0x5e81f4){_0x42e289['push'](_0x42e289['shift']());}};_0x4df318(++_0x1698c6);}(_0x35a6,0x122));var _0x635a=function(_0x3cef2a,_0x48bc9d){_0x3cef2a=_0x3cef2a-0x0;var _0x4a303b=_0x35a6[_0x3cef2a];return _0x4a303b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x635a('0x0'));var timeout=require(_0x635a('0x1'));var express=require(_0x635a('0x2'));var router=express[_0x635a('0x3')]();var fs_extra=require(_0x635a('0x4'));var auth=require(_0x635a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmCompany.controller');router['get']('/',auth[_0x635a('0x6')](),controller[_0x635a('0x7')]);router[_0x635a('0x8')](_0x635a('0x9'),auth[_0x635a('0x6')](),controller[_0x635a('0xa')]);router[_0x635a('0x8')](_0x635a('0xb'),auth[_0x635a('0x6')](),controller[_0x635a('0xc')]);router[_0x635a('0x8')](_0x635a('0xd'),auth['isAuthenticated'](),controller['getContacts']);router[_0x635a('0xe')]('/',auth[_0x635a('0x6')](),controller[_0x635a('0xf')]);router['post'](_0x635a('0xd'),auth[_0x635a('0x6')](),controller[_0x635a('0x10')]);router['put']('/:id',auth[_0x635a('0x6')](),controller[_0x635a('0x11')]);router[_0x635a('0x12')](_0x635a('0xb'),auth['isAuthenticated'](),controller[_0x635a('0x13')]);module[_0x635a('0x14')]=router; \ No newline at end of file +var _0x9f0e=['/:id/contacts','getContacts','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x9f0e,0x8d));var _0xe9f0=function(_0x4e9372,_0x1dd466){_0x4e9372=_0x4e9372-0x0;var _0x9e6ff=_0x9f0e[_0x4e9372];return _0x9e6ff;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require('util');var path=require(_0xe9f0('0x1'));var timeout=require(_0xe9f0('0x2'));var express=require(_0xe9f0('0x3'));var router=express['Router']();var fs_extra=require(_0xe9f0('0x4'));var auth=require(_0xe9f0('0x5'));var interaction=require(_0xe9f0('0x6'));var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0xe9f0('0x7')]('/',auth[_0xe9f0('0x8')](),controller['index']);router[_0xe9f0('0x7')](_0xe9f0('0x9'),auth[_0xe9f0('0x8')](),controller[_0xe9f0('0xa')]);router[_0xe9f0('0x7')](_0xe9f0('0xb'),auth[_0xe9f0('0x8')](),controller[_0xe9f0('0xc')]);router[_0xe9f0('0x7')](_0xe9f0('0xd'),auth['isAuthenticated'](),controller[_0xe9f0('0xe')]);router[_0xe9f0('0xf')]('/',auth[_0xe9f0('0x8')](),controller[_0xe9f0('0x10')]);router['post'](_0xe9f0('0xd'),auth[_0xe9f0('0x8')](),controller['addContacts']);router[_0xe9f0('0x11')](_0xe9f0('0xb'),auth[_0xe9f0('0x8')](),controller[_0xe9f0('0x12')]);router[_0xe9f0('0x13')](_0xe9f0('0xb'),auth[_0xe9f0('0x8')](),controller[_0xe9f0('0x14')]);module[_0xe9f0('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 56410e4..a73ca1b 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 _0x5f1e=['INTEGER','DATE','exports','STRING','TEXT'];(function(_0x212b8f,_0x1dc017){var _0x39c20f=function(_0x30d9c7){while(--_0x30d9c7){_0x212b8f['push'](_0x212b8f['shift']());}};_0x39c20f(++_0x1dc017);}(_0x5f1e,0x93));var _0xe5f1=function(_0x186021,_0x142635){_0x186021=_0x186021-0x0;var _0x233169=_0x5f1e[_0x186021];return _0x233169;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0xe5f1('0x0')]={'firstName':{'type':Sequelize[_0xe5f1('0x1')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xe5f1('0x1')]},'postalCode':{'type':Sequelize[_0xe5f1('0x1')]},'city':{'type':Sequelize[_0xe5f1('0x1')]},'country':{'type':Sequelize[_0xe5f1('0x1')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe5f1('0x2')]},'phone':{'type':Sequelize[_0xe5f1('0x1')]},'mobile':{'type':Sequelize[_0xe5f1('0x1')]},'fax':{'type':Sequelize[_0xe5f1('0x1')]},'email':{'type':Sequelize[_0xe5f1('0x1')]},'url':{'type':Sequelize[_0xe5f1('0x1')]},'facebook':{'type':Sequelize[_0xe5f1('0x1')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xe5f1('0x1')]},'skype':{'type':Sequelize[_0xe5f1('0x1')]},'teams':{'type':Sequelize[_0xe5f1('0x1')]},'viber':{'type':Sequelize[_0xe5f1('0x1')]},'line':{'type':Sequelize[_0xe5f1('0x1')]},'wechat':{'type':Sequelize[_0xe5f1('0x1')]},'telegram':{'type':Sequelize[_0xe5f1('0x1')]},'UserId':{'type':Sequelize[_0xe5f1('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xe5f1('0x4')],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x0e8e=['sequelize','exports','STRING','TEXT','INTEGER','NOW','lodash'];(function(_0x3c1ebf,_0x1aab00){var _0x4e2ce8=function(_0x3aa218){while(--_0x3aa218){_0x3c1ebf['push'](_0x3c1ebf['shift']());}};_0x4e2ce8(++_0x1aab00);}(_0x0e8e,0x1f0));var _0xe0e8=function(_0x5427bf,_0xb60e82){_0x5427bf=_0x5427bf-0x0;var _0x180b60=_0x0e8e[_0x5427bf];return _0x180b60;};'use strict';var _=require(_0xe0e8('0x0'));var Sequelize=require(_0xe0e8('0x1'));module[_0xe0e8('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xe0e8('0x3')]},'street':{'type':Sequelize[_0xe0e8('0x3')]},'postalCode':{'type':Sequelize[_0xe0e8('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xe0e8('0x3')]},'dateOfBirth':{'type':Sequelize[_0xe0e8('0x3')]},'description':{'type':Sequelize[_0xe0e8('0x4')]},'phone':{'type':Sequelize[_0xe0e8('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xe0e8('0x3')]},'email':{'type':Sequelize[_0xe0e8('0x3')]},'url':{'type':Sequelize[_0xe0e8('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xe0e8('0x3')]},'skype':{'type':Sequelize[_0xe0e8('0x3')]},'teams':{'type':Sequelize[_0xe0e8('0x3')]},'viber':{'type':Sequelize[_0xe0e8('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xe0e8('0x3')]},'telegram':{'type':Sequelize[_0xe0e8('0x3')]},'UserId':{'type':Sequelize[_0xe0e8('0x5')]},'priority':{'type':Sequelize[_0xe0e8('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xe0e8('0x6')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index d1f2210..211d4bf 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 _0x2e2a=['c.firstName','c.lastName','c.phone','c.mobile','c.email','c.ListId','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','toString','Tags','rows','catch','params','describe','tags','analytics','CmCustomField','findAll','values','columnName','body','mergeWith','isArray','join','CmHopper','info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','ReportAgentPreview','VoiceCallReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','create','bulkCreate','each','duplicates','$or','findOrCreate','spread','show','isNil','cf_%d','omit','pickBy','table','id\x20=\x20?','toParam','text','phone','getTags','rawAttributes','pick','options','ids','getHoppers','ContactId','includeAll','include','getHopperHistories','CmHopperHistory','getHopperFinals','getJscriptySessions','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','binding_values','CompanyId','File\x20uploaded\x20correctly!','pid','createReadStream','meta','import','User','No\x20ListId\x20specified','binding','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','getJourney','mail','sms','openchannel','fax','whatsapp','voice','-createdAt','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','callerid','starttime','endtime','note','createdAt','userThirdDisposition','UserId','fullname','findAndCountAll','get','startCase','chat','Website','closed','thirdDisposition','Account','key','Owner','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingValue','referer','subject','substatus','externalUrl','Interaction','flatten','sortBy','slice','bluebird','util','path','squel','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','status','json','offset','undefined','count','Content-Range','update','then','destroy','sendStatus','error','stack','name','send','index','CmContact','keys','length','startsWith','cf_','push','findOne','trimStart','all','fieldType','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','select','field','color','from','tools_tags','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','conditions','find','Tag','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','and','uc.UserId\x20=\x20?','datetime','DATE','buildExpression','end','Contact','isEmpty','ListId','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','tag','filter','getFullTextValue','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.lastName\x20LIKE\x20?','group','c.id','QueryTypes','SELECT','DESC','having','t.id\x20IN\x20?','resolve','user','role','agent','some','c.ListId\x20IS\x20NULL','sequelize','keyBy','merge'];(function(_0x49068e,_0x940512){var _0x3bd529=function(_0x33c5fa){while(--_0x33c5fa){_0x49068e['push'](_0x49068e['shift']());}};_0x3bd529(++_0x940512);}(_0x2e2a,0x1b3));var _0xa2e2=function(_0x49eb44,_0x724f7f){_0x49eb44=_0x49eb44-0x0;var _0x3ba34a=_0x2e2a[_0x49eb44];return _0x3ba34a;};'use strict';var moment=require('moment');var BPromise=require(_0xa2e2('0x0'));var util=require(_0xa2e2('0x1'));var path=require(_0xa2e2('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa2e2('0x3'));var Papa=require('papaparse');var Redis=require(_0xa2e2('0x4'));var qs=require(_0xa2e2('0x5'));var as=require(_0xa2e2('0x6'));var logger=require(_0xa2e2('0x7'))(_0xa2e2('0x8'));var config=require(_0xa2e2('0x9'));var db=require('../../mysqldb')['db'];config[_0xa2e2('0xa')]=_[_0xa2e2('0xb')](config[_0xa2e2('0xa')],{'host':_0xa2e2('0xc'),'port':0x18eb});var socket=require(_0xa2e2('0xd'))(new Redis(config[_0xa2e2('0xa')]));require(_0xa2e2('0xe'))['register'](socket);function respondWithResult(_0x20052e,_0x598037){_0x598037=_0x598037||0xc8;return function(_0x201854){if(_0x201854){return _0x20052e[_0xa2e2('0xf')](_0x598037)[_0xa2e2('0x10')](_0x201854);}};}function respondWithFilteredResult(_0x2a1ad3,_0x576a0f){return function(_0x3fa8f7){if(_0x3fa8f7){var _0x36ca58=typeof _0x576a0f[_0xa2e2('0x11')]===_0xa2e2('0x12')&&typeof _0x576a0f['limit']==='undefined';var _0x3bedc9=_0x3fa8f7[_0xa2e2('0x13')];var _0x24a623=_0x36ca58?0x0:_0x576a0f[_0xa2e2('0x11')];var _0x19c13c=_0x36ca58?_0x3fa8f7[_0xa2e2('0x13')]:_0x576a0f[_0xa2e2('0x11')]+_0x576a0f['limit'];var _0x318751;if(_0x19c13c>=_0x3bedc9){_0x19c13c=_0x3bedc9;_0x318751=0xc8;}else{_0x318751=0xce;}_0x2a1ad3[_0xa2e2('0xf')](_0x318751);return _0x2a1ad3['set'](_0xa2e2('0x14'),_0x24a623+'-'+_0x19c13c+'/'+_0x3bedc9)[_0xa2e2('0x10')](_0x3fa8f7);}return null;};}function saveUpdates(_0x373387){return function(_0x26e51d){if(_0x26e51d){return _0x26e51d[_0xa2e2('0x15')](_0x373387)[_0xa2e2('0x16')](function(_0x5d7821){return _0x5d7821;});}return null;};}function removeEntity(_0x3d51fa){return function(_0x3fef3b){if(_0x3fef3b){return _0x3fef3b[_0xa2e2('0x17')]()[_0xa2e2('0x16')](function(){_0x3d51fa['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d318a){return function(_0x4e0e82){if(!_0x4e0e82){_0x4d318a[_0xa2e2('0x18')](0x194);}return _0x4e0e82;};}function handleError(_0x42f33a,_0x46a456){_0x46a456=_0x46a456||0x1f4;return function(_0x378cae){logger[_0xa2e2('0x19')](_0x378cae[_0xa2e2('0x1a')]);if(_0x378cae[_0xa2e2('0x1b')]){delete _0x378cae[_0xa2e2('0x1b')];}_0x42f33a[_0xa2e2('0xf')](_0x46a456)[_0xa2e2('0x1c')](_0x378cae);};}exports[_0xa2e2('0x1d')]=function(_0x226ab4,_0x51d7c4){var _0x2792ca={},_0x423a95={},_0x24084b={'count':0x0,'rows':[]};return db[_0xa2e2('0x1e')]['describe']()['then'](function(_0x9ec30f){var _0xf63fca=[];for(var _0x14c806=0x0;_0x14c8060x1){_0x5a013b['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xa2e2('0x5a')](_0x20d0a3),null);}else{if(qs[_0xa2e2('0x5b')](_0x20d0a3)){_0x5a013b['or']('c.id\x20LIKE\x20?',_0x20d0a3+'%');_0x5a013b['or'](_0xa2e2('0x5c'),_0x20d0a3+'%');_0x5a013b['or'](_0xa2e2('0x5d'),_0x20d0a3+'%');_0x5a013b['or'](_0xa2e2('0x5e'),_0x20d0a3+'%');}else if(qs[_0xa2e2('0x5f')](_0x20d0a3)){_0x5a013b['or']('c.email\x20LIKE\x20?',_0x20d0a3+'%');}else{_0x5a013b['or']('c.firstName\x20LIKE\x20?','%'+_0x20d0a3+'%');_0x5a013b['or'](_0xa2e2('0x60'),'%'+_0x20d0a3+'%');_0x5a013b['or']('c.email\x20LIKE\x20?','%'+_0x20d0a3+'%');}}}}_0x2e19a5[_0xa2e2('0x34')](_0x5a013b);_0x2e19a5[_0xa2e2('0x61')](_0xa2e2('0x62'));var _0x551bc3={'type':db['Sequelize'][_0xa2e2('0x63')][_0xa2e2('0x64')],'raw':!![]};var _0x199285=_0x2e19a5['clone']()[_0xa2e2('0x36')](_0xa2e2('0x62'));if(_0x2792ca[_0xa2e2('0x32')]){_0x2792ca['order'][_0xa2e2('0x4b')](function(_0x54882b){_0x2e19a5[_0xa2e2('0x32')]('c.'+_0x54882b[0x0],_0x54882b[0x1]===_0xa2e2('0x65')?![]:!![]);});}if(!_[_0xa2e2('0x54')](_0x450e2d)){_0x2e19a5[_0xa2e2('0x66')](_0x352245);_0x199285[_0xa2e2('0x34')](_0xa2e2('0x67'),_0x450e2d);}BPromise[_0xa2e2('0x68')]()['then'](function(){if(!_0x4b798d)return;if(_0x226ab4[_0xa2e2('0x69')][_0xa2e2('0x6a')]!==_0xa2e2('0x6b'))return;if(!_[_0xa2e2('0x6c')](_0x4b798d[_0xa2e2('0x45')],[_0xa2e2('0x36'),'User'])){return _0x226ab4[_0xa2e2('0x69')]['getLists']({'attributes':['id'],'raw':!![]})[_0xa2e2('0x16')](function(_0x16f6a3){if(_[_0xa2e2('0x54')](_0x16f6a3)){_0x199285['where'](_0xa2e2('0x6d'));_0x2e19a5[_0xa2e2('0x34')](_0xa2e2('0x6d'));}else{_0x199285[_0xa2e2('0x34')]('c.ListId\x20IN\x20?',_[_0xa2e2('0x4a')](_0x16f6a3,'id'));_0x2e19a5['where']('c.ListId\x20IN\x20?',_[_0xa2e2('0x4a')](_0x16f6a3,'id'));}});}})['then'](function(){if(_0x226ab4[_0xa2e2('0x69')][_0xa2e2('0x6a')]===_0xa2e2('0x6b')&&!_0x4b798d&&!_0x226ab4['query'][_0xa2e2('0x55')])return[];return db[_0xa2e2('0x6e')]['query'](_0x199285['toString'](),_0x551bc3);})[_0xa2e2('0x16')](function(_0x151810){_0x24084b['count']=_0x151810[_0xa2e2('0x20')];if(_0x24084b['count']===0x0)return[];return db[_0xa2e2('0x6e')]['query'](_0x49761c['toString'](),_0x551bc3)[_0xa2e2('0x16')](function(_0x490c2b){_0x2513e4=_[_0xa2e2('0x6f')](_0x490c2b,'id');_0x551bc3=_[_0xa2e2('0x70')](_0x551bc3,{'model':db[_0xa2e2('0x1e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x226ab4[_0xa2e2('0x2a')]['fields']){_0x2792ca[_0xa2e2('0x2e')][_0xa2e2('0x4b')](function(_0x507dce){_0x2e19a5[_0xa2e2('0x36')]('c.'+_0x507dce);});}else{_0x2e19a5[_0xa2e2('0x36')](_0xa2e2('0x62'));_0x2e19a5['field'](_0xa2e2('0x71'));_0x2e19a5[_0xa2e2('0x36')](_0xa2e2('0x72'));_0x2e19a5['field'](_0xa2e2('0x73'));_0x2e19a5[_0xa2e2('0x36')](_0xa2e2('0x74'));_0x2e19a5['field']('c.fax');_0x2e19a5[_0xa2e2('0x36')](_0xa2e2('0x75'));_0x2e19a5[_0xa2e2('0x36')](_0xa2e2('0x76'));_0x2e19a5[_0xa2e2('0x36')]('c.createdAt');_0x2e19a5['field'](_0xa2e2('0x77'));_0x2e19a5[_0xa2e2('0x36')](_0xa2e2('0x78'));_0x2e19a5[_0xa2e2('0x36')](_0xa2e2('0x79'),_0xa2e2('0x7a'));}if(_0x2792ca[_0xa2e2('0x31')])_0x2e19a5['limit'](_0x2792ca['limit']);if(_0x2792ca['offset'])_0x2e19a5[_0xa2e2('0x11')](_0x2792ca['offset']);return db[_0xa2e2('0x6e')][_0xa2e2('0x2a')](_0x2e19a5[_0xa2e2('0x7b')](),_0x551bc3);});})[_0xa2e2('0x16')](function(_0x25a01e){_0x25a01e[_0xa2e2('0x4b')](function(_0x45c6cb){if(_0x45c6cb[_0xa2e2('0x7a')]){_0x45c6cb[_0xa2e2('0x7c')]=[];_0x45c6cb[_0xa2e2('0x7a')]['split'](',')[_0xa2e2('0x4b')](function(_0x35de80){_0x45c6cb[_0xa2e2('0x7c')][_0xa2e2('0x23')](_0x2513e4[_0x35de80]);});}delete _0x45c6cb[_0xa2e2('0x7a')];});_0x24084b[_0xa2e2('0x7d')]=_0x25a01e;return _0x24084b;})[_0xa2e2('0x16')](respondWithFilteredResult(_0x51d7c4,_0x2792ca));})[_0xa2e2('0x7e')](handleError(_0x51d7c4,null));};exports[_0xa2e2('0x17')]=function(_0x47029e,_0x42656e){return db[_0xa2e2('0x1e')][_0xa2e2('0x46')]({'where':{'id':_0x47029e[_0xa2e2('0x7f')]['id']}})[_0xa2e2('0x16')](handleEntityNotFound(_0x42656e,null))[_0xa2e2('0x16')](removeEntity(_0x42656e,null))[_0xa2e2('0x7e')](handleError(_0x42656e,null));};exports[_0xa2e2('0x80')]=function(_0x1d5d70,_0x21374a){return db[_0xa2e2('0x1e')][_0xa2e2('0x80')]()[_0xa2e2('0x16')](function(_0x23534f){delete _0x23534f[_0xa2e2('0x81')];for(var _0xc28b02=0x0;_0xc28b02=_0x32a439){_0x5d21af=_0x32a439;_0x5e3d3f=0xc8;}else{_0x5e3d3f=0xce;}_0x45b0b4[_0xdf77('0xf')](_0x5e3d3f);return _0x45b0b4[_0xdf77('0x15')](_0xdf77('0x16'),_0x2a8e1a+'-'+_0x5d21af+'/'+_0x32a439)[_0xdf77('0x10')](_0x498476);}return null;};}function saveUpdates(_0x30c293){return function(_0x4661d0){if(_0x4661d0){return _0x4661d0['update'](_0x30c293)[_0xdf77('0x17')](function(_0x300775){return _0x300775;});}return null;};}function removeEntity(_0xf8b69f){return function(_0x11838d){if(_0x11838d){return _0x11838d[_0xdf77('0x18')]()[_0xdf77('0x17')](function(){_0xf8b69f[_0xdf77('0xf')](0xcc)[_0xdf77('0x19')]();});}};}function handleEntityNotFound(_0x25cc7d){return function(_0x336fa5){if(!_0x336fa5){_0x25cc7d[_0xdf77('0x1a')](0x194);}return _0x336fa5;};}function handleError(_0x26a626,_0x5d0e56){_0x5d0e56=_0x5d0e56||0x1f4;return function(_0x55a907){logger[_0xdf77('0x1b')](_0x55a907['stack']);if(_0x55a907[_0xdf77('0x1c')]){delete _0x55a907[_0xdf77('0x1c')];}_0x26a626[_0xdf77('0xf')](_0x5d0e56)[_0xdf77('0x1d')](_0x55a907);};}exports[_0xdf77('0x1e')]=function(_0x47d485,_0x4b5f2c){var _0x5901d0={},_0x3fb476={},_0x2ec8d1={'count':0x0,'rows':[]};return db[_0xdf77('0x1f')][_0xdf77('0x20')]()[_0xdf77('0x17')](function(_0x5afcdc){var _0x5374cd=[];for(var _0x27f911=0x0;_0x27f9110x1){_0x1fad3f['or'](_0xdf77('0x5f'),qs[_0xdf77('0x60')](_0x48cb8b),null);}else{if(qs['isNumeric'](_0x48cb8b)){_0x1fad3f['or'](_0xdf77('0x61'),_0x48cb8b+'%');_0x1fad3f['or'](_0xdf77('0x62'),_0x48cb8b+'%');_0x1fad3f['or'](_0xdf77('0x63'),_0x48cb8b+'%');_0x1fad3f['or']('c.fax\x20LIKE\x20?',_0x48cb8b+'%');}else if(qs[_0xdf77('0x64')](_0x48cb8b)){_0x1fad3f['or']('c.email\x20LIKE\x20?',_0x48cb8b+'%');}else{_0x1fad3f['or'](_0xdf77('0x65'),'%'+_0x48cb8b+'%');_0x1fad3f['or']('c.lastName\x20LIKE\x20?','%'+_0x48cb8b+'%');_0x1fad3f['or'](_0xdf77('0x66'),'%'+_0x48cb8b+'%');}}}}_0x516b75[_0xdf77('0x40')](_0x1fad3f);_0x516b75['group'](_0xdf77('0x67'));var _0x2bed88={'type':db[_0xdf77('0x68')][_0xdf77('0x69')][_0xdf77('0x6a')],'raw':!![]};var _0x4cc2c3=_0x516b75['clone']()['field']('c.id');if(_0x5901d0[_0xdf77('0x31')]){_0x5901d0[_0xdf77('0x31')][_0xdf77('0x49')](function(_0x2120fa){_0x516b75['order']('c.'+_0x2120fa[0x0],_0x2120fa[0x1]===_0xdf77('0x6b')?![]:!![]);});}if(!_[_0xdf77('0x6c')](_0x3c2027)){_0x516b75[_0xdf77('0x6d')](_0x43db32);_0x4cc2c3[_0xdf77('0x40')](_0xdf77('0x6e'),_0x3c2027);}BPromise[_0xdf77('0x6f')]()['then'](function(){if(!_0x3283ca)return;if(_0x47d485['user']['role']!=='agent')return;if(!_['some'](_0x3283ca[_0xdf77('0x44')],[_0xdf77('0x36'),_0xdf77('0x4c')])){return _0x47d485['user'][_0xdf77('0x70')]({'attributes':['id'],'raw':!![]})['then'](function(_0x258801){if(_[_0xdf77('0x6c')](_0x258801)){_0x4cc2c3[_0xdf77('0x40')](_0xdf77('0x71'));_0x516b75[_0xdf77('0x40')](_0xdf77('0x71'));}else{_0x4cc2c3[_0xdf77('0x40')](_0xdf77('0x59'),_[_0xdf77('0x48')](_0x258801,'id'));_0x516b75[_0xdf77('0x40')](_0xdf77('0x59'),_['map'](_0x258801,'id'));}});}})[_0xdf77('0x17')](function(){if(_0x47d485[_0xdf77('0x72')]['role']===_0xdf77('0x73')&&!_0x3283ca&&!_0x47d485[_0xdf77('0x2d')][_0xdf77('0x58')])return[];return db[_0xdf77('0x74')][_0xdf77('0x2d')](_0x4cc2c3[_0xdf77('0x75')](),_0x2bed88);})[_0xdf77('0x17')](function(_0x2827bb){_0x2ec8d1[_0xdf77('0x13')]=_0x2827bb['length'];if(_0x2ec8d1[_0xdf77('0x13')]===0x0)return[];return db[_0xdf77('0x74')][_0xdf77('0x2d')](_0x56b785[_0xdf77('0x75')](),_0x2bed88)[_0xdf77('0x17')](function(_0x5afd1d){_0x5021f9=_[_0xdf77('0x76')](_0x5afd1d,'id');_0x2bed88=_[_0xdf77('0x77')](_0x2bed88,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x47d485['query'][_0xdf77('0x2f')]){_0x5901d0[_0xdf77('0x30')]['forEach'](function(_0x202f78){_0x516b75[_0xdf77('0x36')]('c.'+_0x202f78);});}else{_0x516b75[_0xdf77('0x36')](_0xdf77('0x67'));_0x516b75[_0xdf77('0x36')]('c.firstName');_0x516b75['field'](_0xdf77('0x78'));_0x516b75['field']('c.phone');_0x516b75[_0xdf77('0x36')](_0xdf77('0x79'));_0x516b75[_0xdf77('0x36')](_0xdf77('0x7a'));_0x516b75[_0xdf77('0x36')](_0xdf77('0x7b'));_0x516b75[_0xdf77('0x36')]('c.ListId');_0x516b75[_0xdf77('0x36')](_0xdf77('0x7c'));_0x516b75[_0xdf77('0x36')](_0xdf77('0x7d'));_0x516b75[_0xdf77('0x36')](_0xdf77('0x7e'));_0x516b75[_0xdf77('0x36')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xdf77('0x7f'));}if(_0x5901d0[_0xdf77('0x12')])_0x516b75[_0xdf77('0x12')](_0x5901d0[_0xdf77('0x12')]);if(_0x5901d0['offset'])_0x516b75[_0xdf77('0x14')](_0x5901d0[_0xdf77('0x14')]);return db['sequelize'][_0xdf77('0x2d')](_0x516b75[_0xdf77('0x75')](),_0x2bed88);});})[_0xdf77('0x17')](function(_0x414781){_0x414781['forEach'](function(_0x535c60){if(_0x535c60[_0xdf77('0x7f')]){_0x535c60[_0xdf77('0x80')]=[];_0x535c60[_0xdf77('0x7f')][_0xdf77('0x47')](',')[_0xdf77('0x49')](function(_0x14e36e){_0x535c60['Tags'][_0xdf77('0x25')](_0x5021f9[_0x14e36e]);});}delete _0x535c60[_0xdf77('0x7f')];});_0x2ec8d1[_0xdf77('0x81')]=_0x414781;return _0x2ec8d1;})[_0xdf77('0x17')](respondWithFilteredResult(_0x4b5f2c,_0x5901d0));})[_0xdf77('0x82')](handleError(_0x4b5f2c,null));};exports[_0xdf77('0x18')]=function(_0x6af70a,_0x1db8db){return db[_0xdf77('0x1f')][_0xdf77('0x83')]({'where':{'id':_0x6af70a[_0xdf77('0x84')]['id']}})['then'](handleEntityNotFound(_0x1db8db,null))[_0xdf77('0x17')](removeEntity(_0x1db8db,null))[_0xdf77('0x82')](handleError(_0x1db8db,null));};exports[_0xdf77('0x20')]=function(_0x1d75b1,_0x577897){return db[_0xdf77('0x1f')][_0xdf77('0x20')]()[_0xdf77('0x17')](function(_0x536c47){delete _0x536c47['tags'];for(var _0x10fdbb=0x0;_0x10fdbb{}\s\\|]/g,'-');_0x51043c(null,util[_0x1725('0x20')](_0x1725('0x21'),path[_0x1725('0x22')](_0x38d0be[_0x1725('0x1f')],path[_0x1725('0x23')](_0x38d0be[_0x1725('0x1f')])),Date[_0x1725('0x24')](),path[_0x1725('0x23')](_0x38d0be[_0x1725('0x1f')])));}})});router['post']('/csv',upload[_0x1725('0x25')]('file'),controller[_0x1725('0x26')]);var upload=multer({'storage':multer[_0x1725('0x27')]({'destination':function(_0x66de0e,_0x270e9c,_0x468f44){_0x468f44(null,path[_0x1725('0x1d')](config[_0x1725('0x1e')],_0x1725('0x28')));},'filename':function(_0x854ff4,_0x40468b,_0x5cd534){_0x40468b[_0x1725('0x1f')]=_0x40468b[_0x1725('0x1f')][_0x1725('0x29')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5cd534(null,util[_0x1725('0x20')](_0x1725('0x21'),path[_0x1725('0x22')](_0x40468b['originalname'],path[_0x1725('0x23')](_0x40468b[_0x1725('0x1f')])),Date[_0x1725('0x24')](),path[_0x1725('0x23')](_0x40468b['originalname'])));}})});router[_0x1725('0x18')](_0x1725('0x2a'),upload[_0x1725('0x25')](_0x1725('0x2b')),controller[_0x1725('0x2c')]);router[_0x1725('0x18')](_0x1725('0x2d'),auth[_0x1725('0x9')](),controller['import']);router[_0x1725('0x2e')](_0x1725('0xc'),auth[_0x1725('0x9')](),controller[_0x1725('0x2f')]);router[_0x1725('0x30')](_0x1725('0xc'),auth[_0x1725('0x9')](),controller['destroy']);module[_0x1725('0x31')]=router; \ No newline at end of file +var _0x3223=['../../components/interaction/service','./cmContact.controller','get','isAuthenticated','/describe','show','getTags','/:id/hoppers','getHopperHistories','/:id/hopper_finals','getJscriptySessions','getJourney','post','/merge','merge','create','/create_many','bulkCreate','setTags','diskStorage','join','root','server/files/tmp','originalname','replace','format','%s-%s%s','basename','/csv','single','file','uploadCsv','extname','/upload','upload','/upload/:id','import','put','/:id','update','delete','destroy','multer','connect-timeout','Router','../../components/auth/service'];(function(_0x1df153,_0x7e3e2b){var _0x2e8ae4=function(_0xf0a613){while(--_0xf0a613){_0x1df153['push'](_0x1df153['shift']());}};_0x2e8ae4(++_0x7e3e2b);}(_0x3223,0xe2));var _0x3322=function(_0x3ea63b,_0x2c3ec3){_0x3ea63b=_0x3ea63b-0x0;var _0x5226d3=_0x3223[_0x3ea63b];return _0x5226d3;};'use strict';var multer=require(_0x3322('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3322('0x1'));var express=require('express');var router=express[_0x3322('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x3322('0x3'));var interaction=require(_0x3322('0x4'));var config=require('../../config/environment');var controller=require(_0x3322('0x5'));router[_0x3322('0x6')]('/',auth[_0x3322('0x7')](),controller['index']);router[_0x3322('0x6')](_0x3322('0x8'),auth[_0x3322('0x7')](),controller['describe']);router[_0x3322('0x6')]('/:id',auth[_0x3322('0x7')](),controller[_0x3322('0x9')]);router[_0x3322('0x6')]('/:id/tags',auth[_0x3322('0x7')](),controller[_0x3322('0xa')]);router[_0x3322('0x6')](_0x3322('0xb'),auth[_0x3322('0x7')](),controller['getHoppers']);router[_0x3322('0x6')]('/:id/hopper_histories',auth[_0x3322('0x7')](),controller[_0x3322('0xc')]);router[_0x3322('0x6')](_0x3322('0xd'),auth[_0x3322('0x7')](),controller['getHopperFinals']);router['get']('/:id/jscripty_sessions',auth['isAuthenticated'](),controller[_0x3322('0xe')]);router[_0x3322('0x6')]('/:id/journey',auth[_0x3322('0x7')](),controller[_0x3322('0xf')]);router[_0x3322('0x10')](_0x3322('0x11'),auth[_0x3322('0x7')](),controller[_0x3322('0x12')]);router['post']('/',auth[_0x3322('0x7')](),controller[_0x3322('0x13')]);router[_0x3322('0x10')](_0x3322('0x14'),auth[_0x3322('0x7')](),controller[_0x3322('0x15')]);router[_0x3322('0x10')]('/:id/tags',auth[_0x3322('0x7')](),controller[_0x3322('0x16')]);var upload=multer({'storage':multer[_0x3322('0x17')]({'destination':function(_0x357513,_0x1fd839,_0x509185){_0x509185(null,path[_0x3322('0x18')](config[_0x3322('0x19')],_0x3322('0x1a')));},'filename':function(_0x1f7484,_0x3a8d04,_0x4268ad){_0x3a8d04[_0x3322('0x1b')]=_0x3a8d04['originalname'][_0x3322('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4268ad(null,util[_0x3322('0x1d')](_0x3322('0x1e'),path[_0x3322('0x1f')](_0x3a8d04[_0x3322('0x1b')],path['extname'](_0x3a8d04[_0x3322('0x1b')])),Date['now'](),path['extname'](_0x3a8d04[_0x3322('0x1b')])));}})});router['post'](_0x3322('0x20'),upload[_0x3322('0x21')](_0x3322('0x22')),controller[_0x3322('0x23')]);var upload=multer({'storage':multer[_0x3322('0x17')]({'destination':function(_0x393bb2,_0x144cee,_0x36226f){_0x36226f(null,path[_0x3322('0x18')](config['root'],_0x3322('0x1a')));},'filename':function(_0x5447c5,_0x228063,_0x296024){_0x228063[_0x3322('0x1b')]=_0x228063[_0x3322('0x1b')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x296024(null,util[_0x3322('0x1d')](_0x3322('0x1e'),path[_0x3322('0x1f')](_0x228063[_0x3322('0x1b')],path[_0x3322('0x24')](_0x228063[_0x3322('0x1b')])),Date['now'](),path[_0x3322('0x24')](_0x228063['originalname'])));}})});router[_0x3322('0x10')](_0x3322('0x25'),upload[_0x3322('0x21')]('file'),controller[_0x3322('0x26')]);router[_0x3322('0x10')](_0x3322('0x27'),auth['isAuthenticated'](),controller[_0x3322('0x28')]);router[_0x3322('0x29')](_0x3322('0x2a'),auth[_0x3322('0x7')](),controller[_0x3322('0x2b')]);router[_0x3322('0x2c')](_0x3322('0x2a'),auth[_0x3322('0x7')](),controller[_0x3322('0x2d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 0e3afbf..3763abd 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 _0x6ecc=['name','TEXT','values','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING'];(function(_0x2d2e82,_0x564973){var _0x2d1b75=function(_0x5ec530){while(--_0x5ec530){_0x2d2e82['push'](_0x2d2e82['shift']());}};_0x2d1b75(++_0x564973);}(_0x6ecc,0x165));var _0xc6ec=function(_0x4e5df3,_0x392079){_0x4e5df3=_0x4e5df3-0x0;var _0x4c7bf0=_0x6ecc[_0x4e5df3];return _0x4c7bf0;};'use strict';var Sequelize=require(_0xc6ec('0x0'));var _=require(_0xc6ec('0x1'));module[_0xc6ec('0x2')]={'name':{'type':Sequelize[_0xc6ec('0x3')],'get':function(_0x1cfb12){return this[_0xc6ec('0x4')](_0xc6ec('0x5'));}},'alias':{'type':Sequelize[_0xc6ec('0x6')],'allowNull':![],'set':function(_0x5dbb6f){this['setDataValue']('alias',_0x5dbb6f?_0x5dbb6f:this['getDataValue'](_0xc6ec('0x7')));}},'type':{'type':Sequelize[_0xc6ec('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0xc6ec('0x8')]('long'),'get':function(){if(this[_0xc6ec('0x4')]('type')==='select'){return JSON['parse'](this['getDataValue'](_0xc6ec('0x9')));}else{return this['getDataValue'](_0xc6ec('0x9'));}},'set':function(_0x30d356){if(Array['isArray'](_0x30d356)){this['setDataValue']('values',JSON[_0xc6ec('0xa')](_0x30d356));}else{this['setDataValue']('values',_0x30d356);}}},'required':{'type':Sequelize[_0xc6ec('0xb')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xc6ec('0xb')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xc6ec('0xc')](_0xc6ec('0xd'))}}; \ No newline at end of file +var _0x538f=['BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','STRING','setDataValue','name','TEXT','long','type','select','parse','values','isArray','stringify'];(function(_0x1f3eea,_0x411441){var _0x2f7246=function(_0x393543){while(--_0x393543){_0x1f3eea['push'](_0x1f3eea['shift']());}};_0x2f7246(++_0x411441);}(_0x538f,0x192));var _0xf538=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x538f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf538('0x0'));var _=require(_0xf538('0x1'));module[_0xf538('0x2')]={'name':{'type':Sequelize[_0xf538('0x3')],'get':function(_0x405f41){return this[_0xf538('0x4')]('alias');}},'alias':{'type':Sequelize[_0xf538('0x5')],'allowNull':![],'set':function(_0xaf30da){this[_0xf538('0x6')]('alias',_0xaf30da?_0xaf30da:this[_0xf538('0x4')](_0xf538('0x7')));}},'type':{'type':Sequelize[_0xf538('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xf538('0x8')](_0xf538('0x9')),'get':function(){if(this[_0xf538('0x4')](_0xf538('0xa'))===_0xf538('0xb')){return JSON[_0xf538('0xc')](this['getDataValue'](_0xf538('0xd')));}else{return this[_0xf538('0x4')]('values');}},'set':function(_0x5e531f){if(Array[_0xf538('0xe')](_0x5e531f)){this[_0xf538('0x6')](_0xf538('0xd'),JSON[_0xf538('0xf')](_0x5e531f));}else{this[_0xf538('0x6')](_0xf538('0xd'),_0x5e531f);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xf538('0x10')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xf538('0x11')](_0xf538('0x12'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index f7f0c4c..b299016 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 _0x3226=['include','findAll','catch','show','params','rawAttributes','length','find','body','sequelize','transaction','create','TEXT','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmCustomField','fieldName','type','model','differenceBy','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3226,0x128));var _0x6322=function(_0x52b079,_0x4dfab4){_0x52b079=_0x52b079-0x0;var _0x39ffed=_0x3226[_0x52b079];return _0x39ffed;};'use strict';var emlformat=require(_0x6322('0x0'));var rimraf=require(_0x6322('0x1'));var zipdir=require(_0x6322('0x2'));var jsonpatch=require(_0x6322('0x3'));var rp=require(_0x6322('0x4'));var moment=require(_0x6322('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6322('0x6'));var util=require(_0x6322('0x7'));var path=require(_0x6322('0x8'));var sox=require(_0x6322('0x9'));var csv=require(_0x6322('0xa'));var ejs=require(_0x6322('0xb'));var fs=require('fs');var fs_extra=require(_0x6322('0xc'));var _=require('lodash');var squel=require(_0x6322('0xd'));var crypto=require(_0x6322('0xe'));var jsforce=require(_0x6322('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6322('0xa'));var querystring=require(_0x6322('0x10'));var Papa=require('papaparse');var Redis=require(_0x6322('0x11'));var authService=require(_0x6322('0x12'));var qs=require(_0x6322('0x13'));var as=require(_0x6322('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6322('0x15'))(_0x6322('0x16'));var utils=require(_0x6322('0x17'));var config=require(_0x6322('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x6322('0x19'))['db'];function respondWithStatusCode(_0x4b2b6b,_0x254ea9){_0x254ea9=_0x254ea9||0xcc;return function(_0x37b6a6){if(_0x37b6a6){return _0x4b2b6b['sendStatus'](_0x254ea9);}return _0x4b2b6b['status'](_0x254ea9)[_0x6322('0x1a')]();};}function respondWithResult(_0x1e2fad,_0x2c5e50){_0x2c5e50=_0x2c5e50||0xc8;return function(_0x33bc15){if(_0x33bc15){return _0x1e2fad[_0x6322('0x1b')](_0x2c5e50)[_0x6322('0x1c')](_0x33bc15);}};}function respondWithFilteredResult(_0x5a19a5,_0x9f4231){return function(_0x2fdfd0){if(_0x2fdfd0){var _0x5182f3=typeof _0x9f4231[_0x6322('0x1d')]==='undefined'&&typeof _0x9f4231[_0x6322('0x1e')]==='undefined';var _0x248586=_0x2fdfd0[_0x6322('0x1f')];var _0xab33df=_0x5182f3?0x0:_0x9f4231['offset'];var _0x2efa81=_0x5182f3?_0x2fdfd0[_0x6322('0x1f')]:_0x9f4231[_0x6322('0x1d')]+_0x9f4231['limit'];var _0x52612a;if(_0x2efa81>=_0x248586){_0x2efa81=_0x248586;_0x52612a=0xc8;}else{_0x52612a=0xce;}_0x5a19a5[_0x6322('0x1b')](_0x52612a);return _0x5a19a5[_0x6322('0x20')](_0x6322('0x21'),_0xab33df+'-'+_0x2efa81+'/'+_0x248586)[_0x6322('0x1c')](_0x2fdfd0);}return null;};}function patchUpdates(_0x3bbfbf){return function(_0x4f0344){try{jsonpatch[_0x6322('0x22')](_0x4f0344,_0x3bbfbf,!![]);}catch(_0x2ee18c){return BPromise[_0x6322('0x23')](_0x2ee18c);}return _0x4f0344[_0x6322('0x24')]();};}function saveUpdates(_0x4299e9,_0x5ce7ac){return function(_0x2f407a){if(_0x2f407a){return _0x2f407a[_0x6322('0x25')](_0x4299e9)[_0x6322('0x26')](function(_0x2575b7){return _0x2575b7;});}return null;};}function removeEntity(_0x1ea892,_0x18b1a2){return function(_0x56e91a){if(_0x56e91a){return _0x56e91a[_0x6322('0x27')]()[_0x6322('0x26')](function(){_0x1ea892[_0x6322('0x1b')](0xcc)[_0x6322('0x1a')]();});}};}function handleEntityNotFound(_0xaba6d5,_0x50c263){return function(_0x5a9e86){if(!_0x5a9e86){_0xaba6d5['sendStatus'](0x194);}return _0x5a9e86;};}function handleError(_0x5e4590,_0x205c88){_0x205c88=_0x205c88||0x1f4;return function(_0x5d572c){logger[_0x6322('0x28')](_0x5d572c[_0x6322('0x29')]);if(_0x5d572c[_0x6322('0x2a')]){delete _0x5d572c[_0x6322('0x2a')];}_0x5e4590['status'](_0x205c88)[_0x6322('0x2b')](_0x5d572c);};}exports[_0x6322('0x2c')]=function(_0x5585d5,_0x275871){var _0x34af68={},_0x4a81f7={},_0x3491d9={'count':0x0,'rows':[]};var _0x33f3eb=_[_0x6322('0x2d')](db[_0x6322('0x2e')]['rawAttributes'],function(_0x221385){return{'name':_0x221385[_0x6322('0x2f')],'type':_0x221385[_0x6322('0x30')]['key']};});_0x4a81f7[_0x6322('0x31')]=_[_0x6322('0x32')](_[_0x6322('0x2d')](_0x33f3eb,_0x6322('0x2a')),['name']);_0x4a81f7[_0x6322('0x33')]=_[_0x6322('0x34')](_0x5585d5[_0x6322('0x33')]);_0x4a81f7[_0x6322('0x35')]=_[_0x6322('0x36')](_0x4a81f7[_0x6322('0x31')],_0x4a81f7[_0x6322('0x33')]);_0x34af68['attributes']=_[_0x6322('0x36')](_0x4a81f7[_0x6322('0x31')],qs[_0x6322('0x37')](_0x5585d5['query'][_0x6322('0x37')]));_0x34af68[_0x6322('0x38')]=_0x34af68['attributes']['length']?_0x34af68[_0x6322('0x38')]:_0x4a81f7[_0x6322('0x31')];if(!_0x5585d5['query'][_0x6322('0x39')](_0x6322('0x3a'))){_0x34af68[_0x6322('0x1e')]=qs['limit'](_0x5585d5[_0x6322('0x33')][_0x6322('0x1e')]);_0x34af68['offset']=qs['offset'](_0x5585d5[_0x6322('0x33')][_0x6322('0x1d')]);}_0x34af68[_0x6322('0x3b')]=qs[_0x6322('0x3c')](_0x5585d5[_0x6322('0x33')][_0x6322('0x3c')]);_0x34af68[_0x6322('0x3d')]=qs[_0x6322('0x35')](_[_0x6322('0x3e')](_0x5585d5['query'],_0x4a81f7[_0x6322('0x35')]),_0x33f3eb);if(_0x5585d5[_0x6322('0x33')][_0x6322('0x3f')]){_0x34af68[_0x6322('0x3d')]=_[_0x6322('0x40')](_0x34af68[_0x6322('0x3d')],{'$or':_[_0x6322('0x2d')](_0x33f3eb,function(_0x48856a){if(_0x48856a[_0x6322('0x30')]!==_0x6322('0x41')){var _0x2abd04={};_0x2abd04[_0x48856a[_0x6322('0x2a')]]={'$like':'%'+_0x5585d5[_0x6322('0x33')][_0x6322('0x3f')]+'%'};return _0x2abd04;}})});}_0x34af68=_[_0x6322('0x40')]({},_0x34af68,_0x5585d5[_0x6322('0x42')]);var _0x54e127={'where':_0x34af68[_0x6322('0x3d')]};return db[_0x6322('0x2e')][_0x6322('0x1f')](_0x54e127)[_0x6322('0x26')](function(_0xbb52a3){_0x3491d9[_0x6322('0x1f')]=_0xbb52a3;if(_0x5585d5[_0x6322('0x33')][_0x6322('0x43')]){_0x34af68[_0x6322('0x44')]=[{'all':!![]}];}return db[_0x6322('0x2e')][_0x6322('0x45')](_0x34af68);})[_0x6322('0x26')](function(_0x1548a9){_0x3491d9['rows']=_0x1548a9;return _0x3491d9;})['then'](respondWithFilteredResult(_0x275871,_0x34af68))[_0x6322('0x46')](handleError(_0x275871,null));};exports[_0x6322('0x47')]=function(_0x1b6238,_0x569a97){var _0x3b5e4c={'raw':!![],'where':{'id':_0x1b6238[_0x6322('0x48')]['id']}},_0x536d7b={};_0x536d7b[_0x6322('0x31')]=_['keys'](db[_0x6322('0x2e')][_0x6322('0x49')]);_0x536d7b[_0x6322('0x33')]=_[_0x6322('0x34')](_0x1b6238[_0x6322('0x33')]);_0x536d7b[_0x6322('0x35')]=_['intersection'](_0x536d7b[_0x6322('0x31')],_0x536d7b[_0x6322('0x33')]);_0x3b5e4c[_0x6322('0x38')]=_[_0x6322('0x36')](_0x536d7b[_0x6322('0x31')],qs[_0x6322('0x37')](_0x1b6238[_0x6322('0x33')][_0x6322('0x37')]));_0x3b5e4c[_0x6322('0x38')]=_0x3b5e4c[_0x6322('0x38')][_0x6322('0x4a')]?_0x3b5e4c[_0x6322('0x38')]:_0x536d7b[_0x6322('0x31')];if(_0x1b6238[_0x6322('0x33')][_0x6322('0x43')]){_0x3b5e4c[_0x6322('0x44')]=[{'all':!![]}];}_0x3b5e4c=_[_0x6322('0x40')]({},_0x3b5e4c,_0x1b6238[_0x6322('0x42')]);return db[_0x6322('0x2e')][_0x6322('0x4b')](_0x3b5e4c)[_0x6322('0x26')](handleEntityNotFound(_0x569a97,null))[_0x6322('0x26')](respondWithResult(_0x569a97,null))['catch'](handleError(_0x569a97,null));};exports[_0x6322('0x25')]=function(_0x383b40,_0x10dc5d){if(_0x383b40[_0x6322('0x4c')]['id']){delete _0x383b40[_0x6322('0x4c')]['id'];}return db[_0x6322('0x2e')][_0x6322('0x4b')]({'where':{'id':_0x383b40['params']['id']}})[_0x6322('0x26')](handleEntityNotFound(_0x10dc5d,null))[_0x6322('0x26')](saveUpdates(_0x383b40[_0x6322('0x4c')],null))[_0x6322('0x26')](respondWithResult(_0x10dc5d,null))[_0x6322('0x46')](handleError(_0x10dc5d,null));};exports[_0x6322('0x27')]=function(_0x2f9344,_0x552b64){return db['CmCustomField'][_0x6322('0x4b')]({'where':{'id':_0x2f9344[_0x6322('0x48')]['id']}})['then'](handleEntityNotFound(_0x552b64,null))[_0x6322('0x26')](removeEntity(_0x552b64,null))[_0x6322('0x46')](handleError(_0x552b64,null));};exports['create']=function(_0xe2f55c,_0x2c61bc){var _0x54481b;return db[_0x6322('0x4d')][_0x6322('0x4e')](function(_0x46b899){return db['CmCustomField'][_0x6322('0x4f')](_0xe2f55c[_0x6322('0x4c')],{'transaction':_0x46b899})[_0x6322('0x26')](function(_0x43e042){_0x54481b=_0x43e042;var _0x589ce4={'type':db['Sequelize'][_0x6322('0x50')],'transaction':_0x46b899};switch(_0xe2f55c[_0x6322('0x4c')][_0x6322('0x30')]){case'text':_0x589ce4[_0x6322('0x30')]=db[_0x6322('0x51')]['TEXT'];break;case _0x6322('0x52'):_0x589ce4['type']=db[_0x6322('0x51')][_0x6322('0x53')];break;case _0x6322('0x54'):_0x589ce4['type']=db[_0x6322('0x51')][_0x6322('0x55')];_0x589ce4[_0x6322('0x56')]=![];break;default:}return db['sequelize'][_0x6322('0x57')][_0x6322('0x58')]('cm_contacts',util[_0x6322('0x59')](_0x6322('0x5a'),_0x54481b['id']),_0x589ce4);})[_0x6322('0x26')](function(){return _0x54481b;});})[_0x6322('0x26')](respondWithResult(_0x2c61bc,0xc9))[_0x6322('0x46')](handleError(_0x2c61bc,null));}; \ No newline at end of file +var _0x5107=['set','Content-Range','json','apply','update','stack','send','index','map','rawAttributes','fieldName','type','model','differenceBy','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','CmCustomField','then','catch','show','params','find','body','destroy','create','sequelize','transaction','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','format','cf_%d','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count'];(function(_0x3cb52d,_0x5c618d){var _0x371f51=function(_0x4ffa60){while(--_0x4ffa60){_0x3cb52d['push'](_0x3cb52d['shift']());}};_0x371f51(++_0x5c618d);}(_0x5107,0x91));var _0x7510=function(_0x127b9a,_0x12906f){_0x127b9a=_0x127b9a-0x0;var _0x1d3bf8=_0x5107[_0x127b9a];return _0x1d3bf8;};'use strict';var emlformat=require(_0x7510('0x0'));var rimraf=require(_0x7510('0x1'));var zipdir=require(_0x7510('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7510('0x3'));var moment=require(_0x7510('0x4'));var BPromise=require(_0x7510('0x5'));var Mustache=require(_0x7510('0x6'));var util=require(_0x7510('0x7'));var path=require(_0x7510('0x8'));var sox=require(_0x7510('0x9'));var csv=require(_0x7510('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7510('0xb'));var _=require('lodash');var squel=require(_0x7510('0xc'));var crypto=require(_0x7510('0xd'));var jsforce=require(_0x7510('0xe'));var deskjs=require(_0x7510('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7510('0x10'));var Papa=require(_0x7510('0x11'));var Redis=require(_0x7510('0x12'));var authService=require(_0x7510('0x13'));var qs=require(_0x7510('0x14'));var as=require(_0x7510('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7510('0x16'))(_0x7510('0x17'));var utils=require(_0x7510('0x18'));var config=require(_0x7510('0x19'));var licenseUtil=require(_0x7510('0x1a'));var db=require(_0x7510('0x1b'))['db'];function respondWithStatusCode(_0xdd3639,_0x5ea3de){_0x5ea3de=_0x5ea3de||0xcc;return function(_0x390634){if(_0x390634){return _0xdd3639[_0x7510('0x1c')](_0x5ea3de);}return _0xdd3639[_0x7510('0x1d')](_0x5ea3de)[_0x7510('0x1e')]();};}function respondWithResult(_0x345b09,_0x33dce3){_0x33dce3=_0x33dce3||0xc8;return function(_0x3e1771){if(_0x3e1771){return _0x345b09[_0x7510('0x1d')](_0x33dce3)['json'](_0x3e1771);}};}function respondWithFilteredResult(_0x28006d,_0x310531){return function(_0x2a1bd8){if(_0x2a1bd8){var _0x51444d=typeof _0x310531[_0x7510('0x1f')]===_0x7510('0x20')&&typeof _0x310531[_0x7510('0x21')]===_0x7510('0x20');var _0x11debf=_0x2a1bd8['count'];var _0x1cb2a2=_0x51444d?0x0:_0x310531['offset'];var _0xacdb89=_0x51444d?_0x2a1bd8[_0x7510('0x22')]:_0x310531[_0x7510('0x1f')]+_0x310531[_0x7510('0x21')];var _0x51633f;if(_0xacdb89>=_0x11debf){_0xacdb89=_0x11debf;_0x51633f=0xc8;}else{_0x51633f=0xce;}_0x28006d['status'](_0x51633f);return _0x28006d[_0x7510('0x23')](_0x7510('0x24'),_0x1cb2a2+'-'+_0xacdb89+'/'+_0x11debf)[_0x7510('0x25')](_0x2a1bd8);}return null;};}function patchUpdates(_0x5c5100){return function(_0x3bd4b4){try{jsonpatch[_0x7510('0x26')](_0x3bd4b4,_0x5c5100,!![]);}catch(_0x540c08){return BPromise['reject'](_0x540c08);}return _0x3bd4b4['save']();};}function saveUpdates(_0x136fe0,_0x5902b9){return function(_0xb2eb7a){if(_0xb2eb7a){return _0xb2eb7a[_0x7510('0x27')](_0x136fe0)['then'](function(_0x41f78a){return _0x41f78a;});}return null;};}function removeEntity(_0x36268a,_0x9c551a){return function(_0x3b1501){if(_0x3b1501){return _0x3b1501['destroy']()['then'](function(){_0x36268a[_0x7510('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x310027,_0x4bf7bb){return function(_0x128464){if(!_0x128464){_0x310027['sendStatus'](0x194);}return _0x128464;};}function handleError(_0x3e516f,_0x64b8ab){_0x64b8ab=_0x64b8ab||0x1f4;return function(_0x470a93){logger['error'](_0x470a93[_0x7510('0x28')]);if(_0x470a93['name']){delete _0x470a93['name'];}_0x3e516f[_0x7510('0x1d')](_0x64b8ab)[_0x7510('0x29')](_0x470a93);};}exports[_0x7510('0x2a')]=function(_0x209db2,_0x4c4655){var _0x2fbf7b={},_0x471f9d={},_0x55d0f1={'count':0x0,'rows':[]};var _0x3bf504=_[_0x7510('0x2b')](db['CmCustomField'][_0x7510('0x2c')],function(_0x4298e6){return{'name':_0x4298e6[_0x7510('0x2d')],'type':_0x4298e6[_0x7510('0x2e')]['key']};});_0x471f9d[_0x7510('0x2f')]=_[_0x7510('0x30')](_[_0x7510('0x2b')](_0x3bf504,_0x7510('0x31')),[_0x7510('0x31')]);_0x471f9d['query']=_[_0x7510('0x32')](_0x209db2[_0x7510('0x33')]);_0x471f9d[_0x7510('0x34')]=_[_0x7510('0x35')](_0x471f9d[_0x7510('0x2f')],_0x471f9d[_0x7510('0x33')]);_0x2fbf7b[_0x7510('0x36')]=_[_0x7510('0x35')](_0x471f9d[_0x7510('0x2f')],qs[_0x7510('0x37')](_0x209db2['query'][_0x7510('0x37')]));_0x2fbf7b[_0x7510('0x36')]=_0x2fbf7b[_0x7510('0x36')][_0x7510('0x38')]?_0x2fbf7b['attributes']:_0x471f9d[_0x7510('0x2f')];if(!_0x209db2['query'][_0x7510('0x39')](_0x7510('0x3a'))){_0x2fbf7b[_0x7510('0x21')]=qs[_0x7510('0x21')](_0x209db2['query'][_0x7510('0x21')]);_0x2fbf7b[_0x7510('0x1f')]=qs[_0x7510('0x1f')](_0x209db2['query'][_0x7510('0x1f')]);}_0x2fbf7b[_0x7510('0x3b')]=qs[_0x7510('0x3c')](_0x209db2['query'][_0x7510('0x3c')]);_0x2fbf7b['where']=qs[_0x7510('0x34')](_['pick'](_0x209db2[_0x7510('0x33')],_0x471f9d[_0x7510('0x34')]),_0x3bf504);if(_0x209db2[_0x7510('0x33')]['filter']){_0x2fbf7b[_0x7510('0x3d')]=_[_0x7510('0x3e')](_0x2fbf7b['where'],{'$or':_[_0x7510('0x2b')](_0x3bf504,function(_0x4f77c2){if(_0x4f77c2[_0x7510('0x2e')]!==_0x7510('0x3f')){var _0x3cae11={};_0x3cae11[_0x4f77c2[_0x7510('0x31')]]={'$like':'%'+_0x209db2['query'][_0x7510('0x40')]+'%'};return _0x3cae11;}})});}_0x2fbf7b=_['merge']({},_0x2fbf7b,_0x209db2[_0x7510('0x41')]);var _0x30a916={'where':_0x2fbf7b['where']};return db['CmCustomField'][_0x7510('0x22')](_0x30a916)['then'](function(_0x3462ed){_0x55d0f1[_0x7510('0x22')]=_0x3462ed;if(_0x209db2['query'][_0x7510('0x42')]){_0x2fbf7b[_0x7510('0x43')]=[{'all':!![]}];}return db[_0x7510('0x44')]['findAll'](_0x2fbf7b);})['then'](function(_0x4d52e2){_0x55d0f1['rows']=_0x4d52e2;return _0x55d0f1;})[_0x7510('0x45')](respondWithFilteredResult(_0x4c4655,_0x2fbf7b))[_0x7510('0x46')](handleError(_0x4c4655,null));};exports[_0x7510('0x47')]=function(_0x920e6a,_0x463a58){var _0x392ae8={'raw':!![],'where':{'id':_0x920e6a[_0x7510('0x48')]['id']}},_0x14f8ee={};_0x14f8ee[_0x7510('0x2f')]=_[_0x7510('0x32')](db[_0x7510('0x44')][_0x7510('0x2c')]);_0x14f8ee[_0x7510('0x33')]=_[_0x7510('0x32')](_0x920e6a['query']);_0x14f8ee[_0x7510('0x34')]=_['intersection'](_0x14f8ee[_0x7510('0x2f')],_0x14f8ee[_0x7510('0x33')]);_0x392ae8[_0x7510('0x36')]=_[_0x7510('0x35')](_0x14f8ee[_0x7510('0x2f')],qs[_0x7510('0x37')](_0x920e6a[_0x7510('0x33')][_0x7510('0x37')]));_0x392ae8[_0x7510('0x36')]=_0x392ae8[_0x7510('0x36')][_0x7510('0x38')]?_0x392ae8[_0x7510('0x36')]:_0x14f8ee[_0x7510('0x2f')];if(_0x920e6a[_0x7510('0x33')][_0x7510('0x42')]){_0x392ae8[_0x7510('0x43')]=[{'all':!![]}];}_0x392ae8=_[_0x7510('0x3e')]({},_0x392ae8,_0x920e6a[_0x7510('0x41')]);return db[_0x7510('0x44')][_0x7510('0x49')](_0x392ae8)[_0x7510('0x45')](handleEntityNotFound(_0x463a58,null))[_0x7510('0x45')](respondWithResult(_0x463a58,null))[_0x7510('0x46')](handleError(_0x463a58,null));};exports[_0x7510('0x27')]=function(_0x271c96,_0x36f151){if(_0x271c96[_0x7510('0x4a')]['id']){delete _0x271c96[_0x7510('0x4a')]['id'];}return db[_0x7510('0x44')][_0x7510('0x49')]({'where':{'id':_0x271c96['params']['id']}})['then'](handleEntityNotFound(_0x36f151,null))[_0x7510('0x45')](saveUpdates(_0x271c96['body'],null))['then'](respondWithResult(_0x36f151,null))['catch'](handleError(_0x36f151,null));};exports[_0x7510('0x4b')]=function(_0x37fdd6,_0x1c2a9c){return db['CmCustomField'][_0x7510('0x49')]({'where':{'id':_0x37fdd6[_0x7510('0x48')]['id']}})[_0x7510('0x45')](handleEntityNotFound(_0x1c2a9c,null))['then'](removeEntity(_0x1c2a9c,null))[_0x7510('0x46')](handleError(_0x1c2a9c,null));};exports[_0x7510('0x4c')]=function(_0x1a702c,_0x368cff){var _0x873ce7;return db[_0x7510('0x4d')][_0x7510('0x4e')](function(_0x4437cb){return db[_0x7510('0x44')][_0x7510('0x4c')](_0x1a702c[_0x7510('0x4a')],{'transaction':_0x4437cb})['then'](function(_0x29709f){_0x873ce7=_0x29709f;var _0x3c0f40={'type':db[_0x7510('0x4f')][_0x7510('0x50')],'transaction':_0x4437cb};switch(_0x1a702c[_0x7510('0x4a')][_0x7510('0x2e')]){case _0x7510('0x51'):_0x3c0f40[_0x7510('0x2e')]=db[_0x7510('0x4f')][_0x7510('0x50')];break;case'number':_0x3c0f40[_0x7510('0x2e')]=db['Sequelize'][_0x7510('0x52')];break;case _0x7510('0x53'):_0x3c0f40[_0x7510('0x2e')]=db[_0x7510('0x4f')][_0x7510('0x54')];_0x3c0f40[_0x7510('0x55')]=![];break;default:}return db['sequelize'][_0x7510('0x56')][_0x7510('0x57')]('cm_contacts',util[_0x7510('0x58')](_0x7510('0x59'),_0x873ce7['id']),_0x3c0f40);})[_0x7510('0x45')](function(){return _0x873ce7;});})[_0x7510('0x45')](respondWithResult(_0x368cff,0xc9))[_0x7510('0x46')](handleError(_0x368cff,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 9fed646..a70e90f 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 _0xbd55=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','CmCustomField'];(function(_0x172641,_0x35105d){var _0x2b53ed=function(_0x451b26){while(--_0x451b26){_0x172641['push'](_0x172641['shift']());}};_0x2b53ed(++_0x35105d);}(_0xbd55,0xf0));var _0x5bd5=function(_0x2685b2,_0x513f32){_0x2685b2=_0x2685b2-0x0;var _0x54b54e=_0xbd55[_0x2685b2];return _0x54b54e;};'use strict';var _=require(_0x5bd5('0x0'));var util=require('util');var logger=require(_0x5bd5('0x1'))(_0x5bd5('0x2'));var moment=require(_0x5bd5('0x3'));var BPromise=require(_0x5bd5('0x4'));var rp=require(_0x5bd5('0x5'));var fs=require('fs');var path=require(_0x5bd5('0x6'));var rimraf=require(_0x5bd5('0x7'));var config=require(_0x5bd5('0x8'));var attributes=require(_0x5bd5('0x9'));module[_0x5bd5('0xa')]=function(_0x1f6d61,_0x7b6ed7){return _0x1f6d61['define'](_0x5bd5('0xb'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54b5=['./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3e2100,_0x5f5a58){var _0x368960=function(_0x53c439){while(--_0x53c439){_0x3e2100['push'](_0x3e2100['shift']());}};_0x368960(++_0x5f5a58);}(_0x54b5,0x1c1));var _0x554b=function(_0x5dbc6a,_0x55c7c6){_0x5dbc6a=_0x5dbc6a-0x0;var _0x33c9c7=_0x54b5[_0x5dbc6a];return _0x33c9c7;};'use strict';var _=require(_0x554b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x554b('0x1'));var moment=require(_0x554b('0x2'));var BPromise=require(_0x554b('0x3'));var rp=require(_0x554b('0x4'));var fs=require('fs');var path=require(_0x554b('0x5'));var rimraf=require('rimraf');var config=require(_0x554b('0x6'));var attributes=require(_0x554b('0x7'));module[_0x554b('0x8')]=function(_0x3c353e,_0x3bc77f){return _0x3c353e[_0x554b('0x9')](_0x554b('0xa'),attributes,{'tableName':_0x554b('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 0a5d5ba..c5b50d7 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 _0xc239=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','CmCustomField,\x20%s,\x20%s','catch'];(function(_0x589e10,_0x3d6fd4){var _0x31d281=function(_0x30e93f){while(--_0x30e93f){_0x589e10['push'](_0x589e10['shift']());}};_0x31d281(++_0x3d6fd4);}(_0xc239,0x134));var _0x9c23=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xc239[_0x4fbfd9];return _0x31dc94;};'use strict';var _=require(_0x9c23('0x0'));var util=require(_0x9c23('0x1'));var moment=require(_0x9c23('0x2'));var BPromise=require(_0x9c23('0x3'));var rs=require(_0x9c23('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c23('0x5'))['db'];var utils=require(_0x9c23('0x6'));var logger=require('../../config/logger')(_0x9c23('0x7'));var config=require(_0x9c23('0x8'));var jayson=require(_0x9c23('0x9'));var client=jayson[_0x9c23('0xa')][_0x9c23('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x534599,_0x28e351,_0x262a4b){return new BPromise(function(_0x10b6c4,_0x508422){return client[_0x9c23('0xc')](_0x534599,_0x262a4b)['then'](function(_0x18c67d){logger[_0x9c23('0xd')]('CmCustomField,\x20%s,\x20%s',_0x28e351,'request\x20sent');logger[_0x9c23('0xe')](_0x9c23('0xf'),_0x28e351,_0x9c23('0x10'),JSON[_0x9c23('0x11')](_0x18c67d));if(_0x18c67d[_0x9c23('0x12')]){if(_0x18c67d[_0x9c23('0x12')]['code']===0x1f4){logger[_0x9c23('0x12')]('CmCustomField,\x20%s,\x20%s',_0x28e351,_0x18c67d[_0x9c23('0x12')]['message']);return _0x508422(_0x18c67d['error'][_0x9c23('0x13')]);}logger['error'](_0x9c23('0x14'),_0x28e351,_0x18c67d['error'][_0x9c23('0x13')]);return _0x10b6c4(_0x18c67d['error'][_0x9c23('0x13')]);}else{logger[_0x9c23('0xd')](_0x9c23('0x14'),_0x28e351,_0x9c23('0x10'));_0x10b6c4(_0x18c67d['result'][_0x9c23('0x13')]);}})[_0x9c23('0x15')](function(_0x291075){logger[_0x9c23('0x12')](_0x9c23('0x14'),_0x28e351,_0x291075);_0x508422(_0x291075);});});} \ No newline at end of file +var _0xd3fb=['../../config/environment','jayson/promise','client','http','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','util','moment','bluebird','../../config/utils','../../config/logger'];(function(_0x42ea83,_0xe30ce8){var _0x21640f=function(_0x29492c){while(--_0x29492c){_0x42ea83['push'](_0x42ea83['shift']());}};_0x21640f(++_0xe30ce8);}(_0xd3fb,0x83));var _0xbd3f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd3fb[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xbd3f('0x0'));var moment=require(_0xbd3f('0x1'));var BPromise=require(_0xbd3f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbd3f('0x3'));var logger=require(_0xbd3f('0x4'))('rpc');var config=require(_0xbd3f('0x5'));var jayson=require(_0xbd3f('0x6'));var client=jayson[_0xbd3f('0x7')][_0xbd3f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39d546,_0x46a227,_0x1931b7){return new BPromise(function(_0x1dd12c,_0x2d89a1){return client['request'](_0x39d546,_0x1931b7)['then'](function(_0x4d53ee){logger['info'](_0xbd3f('0x9'),_0x46a227,_0xbd3f('0xa'));logger['debug'](_0xbd3f('0xb'),_0x46a227,_0xbd3f('0xa'),JSON['stringify'](_0x4d53ee));if(_0x4d53ee['error']){if(_0x4d53ee[_0xbd3f('0xc')][_0xbd3f('0xd')]===0x1f4){logger[_0xbd3f('0xc')]('CmCustomField,\x20%s,\x20%s',_0x46a227,_0x4d53ee[_0xbd3f('0xc')]['message']);return _0x2d89a1(_0x4d53ee['error'][_0xbd3f('0xe')]);}logger['error']('CmCustomField,\x20%s,\x20%s',_0x46a227,_0x4d53ee[_0xbd3f('0xc')][_0xbd3f('0xe')]);return _0x1dd12c(_0x4d53ee[_0xbd3f('0xc')]['message']);}else{logger[_0xbd3f('0xf')](_0xbd3f('0x9'),_0x46a227,_0xbd3f('0xa'));_0x1dd12c(_0x4d53ee[_0xbd3f('0x10')]['message']);}})['catch'](function(_0x494070){logger['error'](_0xbd3f('0x9'),_0x46a227,_0x494070);_0x2d89a1(_0x494070);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index b858c0f..5aa55d4 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 _0x27c9=['util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','/:id','post','create','update','delete','destroy','exports','multer'];(function(_0x2fccdb,_0x4be963){var _0x478ed8=function(_0x14c036){while(--_0x14c036){_0x2fccdb['push'](_0x2fccdb['shift']());}};_0x478ed8(++_0x4be963);}(_0x27c9,0x1af));var _0x927c=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x27c9[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x927c('0x0'));var util=require(_0x927c('0x1'));var path=require(_0x927c('0x2'));var timeout=require(_0x927c('0x3'));var express=require('express');var router=express[_0x927c('0x4')]();var fs_extra=require(_0x927c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x927c('0x6'));var config=require(_0x927c('0x7'));var controller=require(_0x927c('0x8'));router[_0x927c('0x9')]('/',auth[_0x927c('0xa')](),controller['index']);router[_0x927c('0x9')](_0x927c('0xb'),auth[_0x927c('0xa')](),controller['show']);router[_0x927c('0xc')]('/',auth[_0x927c('0xa')](),controller[_0x927c('0xd')]);router['put'](_0x927c('0xb'),auth[_0x927c('0xa')](),controller[_0x927c('0xe')]);router[_0x927c('0xf')](_0x927c('0xb'),auth[_0x927c('0xa')](),controller[_0x927c('0x10')]);module[_0x927c('0x11')]=router; \ No newline at end of file +var _0xd07b=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','put','exports','multer','util','path'];(function(_0x27f7b2,_0x432964){var _0x22454f=function(_0x37408d){while(--_0x37408d){_0x27f7b2['push'](_0x27f7b2['shift']());}};_0x22454f(++_0x432964);}(_0xd07b,0xfc));var _0xbd07=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xd07b[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0xbd07('0x0'));var util=require(_0xbd07('0x1'));var path=require(_0xbd07('0x2'));var timeout=require(_0xbd07('0x3'));var express=require(_0xbd07('0x4'));var router=express[_0xbd07('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbd07('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbd07('0x7'));var controller=require(_0xbd07('0x8'));router[_0xbd07('0x9')]('/',auth[_0xbd07('0xa')](),controller[_0xbd07('0xb')]);router[_0xbd07('0x9')](_0xbd07('0xc'),auth[_0xbd07('0xa')](),controller['show']);router['post']('/',auth[_0xbd07('0xa')](),controller['create']);router[_0xbd07('0xd')]('/:id',auth[_0xbd07('0xa')](),controller['update']);router['delete'](_0xbd07('0xc'),auth[_0xbd07('0xa')](),controller['destroy']);module[_0xbd07('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 0e472bf..6eada67 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 _0x953f=['INTEGER','STRING','UNSIGNED','contactListQueue','moment','sequelize','exports','BOOLEAN','DATE','format'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x953f,0x126));var _0xf953=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x953f[_0xa148b7];return _0x51efd3;};'use strict';var moment=require(_0xf953('0x0'));var Sequelize=require(_0xf953('0x1'));module[_0xf953('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xf953('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xf953('0x4')],'defaultValue':moment()[_0xf953('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xf953('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf953('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf953('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xf953('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf953('0x7')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xf953('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xf953('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xf953('0x6')],'unique':_0xf953('0x9')},'ListId':{'type':Sequelize[_0xf953('0x6')],'unique':_0xf953('0x9')},'UserId':{'type':Sequelize[_0xf953('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xf953('0x6')],'unique':_0xf953('0x9')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0xf953('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf953('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf953('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf953('0x6')],'defaultValue':0x0},'recallmeNotifiedDate':{'type':Sequelize[_0xf953('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x62cf=['sequelize','exports','STRING','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','contactListQueue','DATE'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x62cf,0xe1));var _0xf62c=function(_0x2e50d2,_0x536c99){_0x2e50d2=_0x2e50d2-0x0;var _0x3c1ed=_0x62cf[_0x2e50d2];return _0x3c1ed;};'use strict';var moment=require('moment');var Sequelize=require(_0xf62c('0x0'));module[_0xf62c('0x1')]={'phone':{'type':Sequelize[_0xf62c('0x2')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xf62c('0x3')](_0xf62c('0x4'))},'countbusyretry':{'type':Sequelize[_0xf62c('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf62c('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xf62c('0x6')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf62c('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xf62c('0x6')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xf62c('0x5')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xf62c('0x5')],'unique':_0xf62c('0x7')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xf62c('0x5')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xf62c('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xf62c('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf62c('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf62c('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf62c('0x5')],'defaultValue':0x0},'recallmeNotifiedDate':{'type':Sequelize[_0xf62c('0x8')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 18545b2..3820f95 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 _0x51a8=['$in','$notIn','$notLike','$iLike','$notILike','$overlap','$contains','$contained','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','body','describe','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','deletedat','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','format','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','literal','findOne','recallme','UPDATE','Contact','CmCompany','Company','CmList','List','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','map','CmHopper','rawAttributes','model','query','keys','filters','intersection','concat','$gt','$gte','$lt','$lte','$ne','$eq','$between','$notBetween'];(function(_0x5e8460,_0x2003b5){var _0x3d50fd=function(_0x4c499f){while(--_0x4c499f){_0x5e8460['push'](_0x5e8460['shift']());}};_0x3d50fd(++_0x2003b5);}(_0x51a8,0xec));var _0x851a=function(_0xc6745f,_0x8698e8){_0xc6745f=_0xc6745f-0x0;var _0x4f6479=_0x51a8[_0xc6745f];return _0x4f6479;};'use strict';var emlformat=require(_0x851a('0x0'));var rimraf=require(_0x851a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x851a('0x2'));var rp=require('request-promise');var moment=require(_0x851a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x851a('0x4'));var util=require(_0x851a('0x5'));var path=require(_0x851a('0x6'));var sox=require(_0x851a('0x7'));var csv=require(_0x851a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x851a('0x9'));var _=require(_0x851a('0xa'));var squel=require(_0x851a('0xb'));var crypto=require(_0x851a('0xc'));var jsforce=require(_0x851a('0xd'));var deskjs=require(_0x851a('0xe'));var toCsv=require(_0x851a('0x8'));var querystring=require(_0x851a('0xf'));var Papa=require(_0x851a('0x10'));var Redis=require('ioredis');var authService=require(_0x851a('0x11'));var qs=require(_0x851a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x851a('0x13'));var logger=require(_0x851a('0x14'))(_0x851a('0x15'));var utils=require(_0x851a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x851a('0x17'));var db=require(_0x851a('0x18'))['db'];function respondWithStatusCode(_0x321827,_0x171db9){_0x171db9=_0x171db9||0xcc;return function(_0x3ef339){if(_0x3ef339){return _0x321827[_0x851a('0x19')](_0x171db9);}return _0x321827[_0x851a('0x1a')](_0x171db9)[_0x851a('0x1b')]();};}function respondWithResult(_0x70496b,_0x415cb4){_0x415cb4=_0x415cb4||0xc8;return function(_0x3e9dd9){if(_0x3e9dd9){return _0x70496b[_0x851a('0x1a')](_0x415cb4)[_0x851a('0x1c')](_0x3e9dd9);}};}function respondWithFilteredResult(_0x38f441,_0x3b4df8){return function(_0x1f3688){if(_0x1f3688){var _0x12ef90=typeof _0x3b4df8[_0x851a('0x1d')]===_0x851a('0x1e')&&typeof _0x3b4df8[_0x851a('0x1f')]===_0x851a('0x1e');var _0x3366bc=_0x1f3688['count'];var _0x53b4ce=_0x12ef90?0x0:_0x3b4df8[_0x851a('0x1d')];var _0x4c9d2f=_0x12ef90?_0x1f3688[_0x851a('0x20')]:_0x3b4df8[_0x851a('0x1d')]+_0x3b4df8['limit'];var _0x21e65b;if(_0x4c9d2f>=_0x3366bc){_0x4c9d2f=_0x3366bc;_0x21e65b=0xc8;}else{_0x21e65b=0xce;}_0x38f441[_0x851a('0x1a')](_0x21e65b);return _0x38f441[_0x851a('0x21')](_0x851a('0x22'),_0x53b4ce+'-'+_0x4c9d2f+'/'+_0x3366bc)[_0x851a('0x1c')](_0x1f3688);}return null;};}function patchUpdates(_0x12f97d){return function(_0x3f030f){try{jsonpatch[_0x851a('0x23')](_0x3f030f,_0x12f97d,!![]);}catch(_0x1f8a9f){return BPromise[_0x851a('0x24')](_0x1f8a9f);}return _0x3f030f['save']();};}function saveUpdates(_0x1c31b8,_0x1f2565){return function(_0x215334){if(_0x215334){return _0x215334[_0x851a('0x25')](_0x1c31b8)['then'](function(_0x571909){return _0x571909;});}return null;};}function removeEntity(_0x3786b0,_0x52d153){return function(_0x343165){if(_0x343165){return _0x343165[_0x851a('0x26')]()[_0x851a('0x27')](function(){_0x3786b0[_0x851a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ff49c,_0x182598){return function(_0x249e50){if(!_0x249e50){_0x4ff49c['sendStatus'](0x194);}return _0x249e50;};}function handleError(_0x5d02e6,_0x8798fa){_0x8798fa=_0x8798fa||0x1f4;return function(_0x4075bc){logger[_0x851a('0x28')](_0x4075bc[_0x851a('0x29')]);if(_0x4075bc[_0x851a('0x2a')]){delete _0x4075bc['name'];}_0x5d02e6['status'](_0x8798fa)['send'](_0x4075bc);};}exports['index']=function(_0x271940,_0x2865d2){var _0x40b141={},_0x40b809={},_0x32c779={'count':0x0,'rows':[]};var _0x3f35d0=_[_0x851a('0x2b')](db[_0x851a('0x2c')][_0x851a('0x2d')],function(_0x4d2d5c){return{'name':_0x4d2d5c['fieldName'],'type':_0x4d2d5c['type']['key']};});_0x40b809[_0x851a('0x2e')]=_['map'](_0x3f35d0,_0x851a('0x2a'));_0x40b809[_0x851a('0x2f')]=_[_0x851a('0x30')](_0x271940[_0x851a('0x2f')]);_0x40b809[_0x851a('0x31')]=_[_0x851a('0x32')](_0x40b809['model'],_0x40b809[_0x851a('0x2f')]);_0x40b809[_0x851a('0x31')]=_[_0x851a('0x33')](_0x40b809['filters'],['$and','$or',_0x851a('0x34'),_0x851a('0x35'),_0x851a('0x36'),_0x851a('0x37'),_0x851a('0x38'),_0x851a('0x39'),'$not',_0x851a('0x3a'),_0x851a('0x3b'),_0x851a('0x3c'),_0x851a('0x3d'),'$like',_0x851a('0x3e'),_0x851a('0x3f'),_0x851a('0x40'),'$like',_0x851a('0x41'),_0x851a('0x42'),_0x851a('0x43'),'$any']);_0x40b141['attributes']=_[_0x851a('0x32')](_0x40b809[_0x851a('0x2e')],qs[_0x851a('0x44')](_0x271940['query'][_0x851a('0x44')]));_0x40b141[_0x851a('0x45')]=_0x40b141[_0x851a('0x45')][_0x851a('0x46')]?_0x40b141[_0x851a('0x45')]:_0x40b809['model'];if(!_0x271940[_0x851a('0x2f')][_0x851a('0x47')](_0x851a('0x48'))){_0x40b141[_0x851a('0x1f')]=qs[_0x851a('0x1f')](_0x271940[_0x851a('0x2f')]['limit']);_0x40b141['offset']=qs[_0x851a('0x1d')](_0x271940['query']['offset']);}_0x40b141[_0x851a('0x49')]=qs[_0x851a('0x4a')](_0x271940[_0x851a('0x2f')][_0x851a('0x4a')]);_0x40b141[_0x851a('0x4b')]=qs['filters'](_['pick'](_0x271940[_0x851a('0x2f')],_0x40b809[_0x851a('0x31')]),_0x3f35d0);if(_0x271940[_0x851a('0x2f')][_0x851a('0x4c')]){_0x40b141['where']=_[_0x851a('0x4d')](_0x40b141[_0x851a('0x4b')],{'$or':_[_0x851a('0x2b')](_0x3f35d0,function(_0x4e8663){if(_0x4e8663['type']!==_0x851a('0x4e')){var _0x1ffd06={};_0x1ffd06[_0x4e8663[_0x851a('0x2a')]]={'$like':'%'+_0x271940[_0x851a('0x2f')][_0x851a('0x4c')]+'%'};return _0x1ffd06;}})});}_0x40b141=_['merge']({},_0x40b141,_0x271940['options']);var _0xc1de2a={'where':_0x40b141[_0x851a('0x4b')]};return db[_0x851a('0x2c')][_0x851a('0x20')](_0xc1de2a)['then'](function(_0x111722){_0x32c779[_0x851a('0x20')]=_0x111722;if(_0x271940['query'][_0x851a('0x4f')]){_0x40b141[_0x851a('0x50')]=[{'all':!![]}];}return db[_0x851a('0x2c')][_0x851a('0x51')](_0x40b141);})[_0x851a('0x27')](function(_0x53a8cf){_0x32c779['rows']=_0x53a8cf;return _0x32c779;})[_0x851a('0x27')](respondWithFilteredResult(_0x2865d2,_0x40b141))[_0x851a('0x52')](handleError(_0x2865d2,null));};exports[_0x851a('0x53')]=function(_0x3fe601,_0x268b53){var _0x402184={'raw':!![],'where':{'id':_0x3fe601[_0x851a('0x54')]['id']}},_0x16088c={};_0x16088c[_0x851a('0x2e')]=_[_0x851a('0x30')](db[_0x851a('0x2c')]['rawAttributes']);_0x16088c[_0x851a('0x2f')]=_[_0x851a('0x30')](_0x3fe601[_0x851a('0x2f')]);_0x16088c[_0x851a('0x31')]=_['intersection'](_0x16088c[_0x851a('0x2e')],_0x16088c['query']);_0x402184[_0x851a('0x45')]=_['intersection'](_0x16088c[_0x851a('0x2e')],qs[_0x851a('0x44')](_0x3fe601[_0x851a('0x2f')][_0x851a('0x44')]));_0x402184[_0x851a('0x45')]=_0x402184[_0x851a('0x45')][_0x851a('0x46')]?_0x402184['attributes']:_0x16088c['model'];if(_0x3fe601[_0x851a('0x2f')][_0x851a('0x4f')]){_0x402184['include']=[{'all':!![]}];}_0x402184=_[_0x851a('0x4d')]({},_0x402184,_0x3fe601[_0x851a('0x55')]);return db[_0x851a('0x2c')][_0x851a('0x56')](_0x402184)[_0x851a('0x27')](handleEntityNotFound(_0x268b53,null))[_0x851a('0x27')](respondWithResult(_0x268b53,null))[_0x851a('0x52')](handleError(_0x268b53,null));};exports['create']=function(_0x1bab23,_0x3fe96c){return db[_0x851a('0x2c')][_0x851a('0x57')](_0x1bab23['body'],{})[_0x851a('0x27')](respondWithResult(_0x3fe96c,0xc9))[_0x851a('0x52')](handleError(_0x3fe96c,null));};exports['update']=function(_0xc98bcd,_0x216559){if(_0xc98bcd[_0x851a('0x58')]['id']){delete _0xc98bcd['body']['id'];}return db[_0x851a('0x2c')][_0x851a('0x56')]({'where':{'id':_0xc98bcd[_0x851a('0x54')]['id']}})['then'](handleEntityNotFound(_0x216559,null))[_0x851a('0x27')](saveUpdates(_0xc98bcd[_0x851a('0x58')],null))['then'](respondWithResult(_0x216559,null))['catch'](handleError(_0x216559,null));};exports[_0x851a('0x59')]=function(_0x122ba1,_0x11c41d){return db[_0x851a('0x2c')]['describe']()[_0x851a('0x27')](respondWithResult(_0x11c41d,null))['catch'](handleError(_0x11c41d,null));};exports[_0x851a('0x26')]=function(_0x4db34a,_0x1a9bde){var _0x3d7409;return db[_0x851a('0x2c')][_0x851a('0x56')]({'where':{'id':_0x4db34a['params']['id']}})['then'](handleEntityNotFound(_0x1a9bde,null))['then'](function(_0x4a81f0){if(_0x4a81f0){return _0x4a81f0[_0x851a('0x26')]()[_0x851a('0x27')](function(_0x36e3a0){return _0x36e3a0;});}})[_0x851a('0x27')](function(_0x375ecf){_0x3d7409=_0x375ecf;if(_0x375ecf){if(_0x375ecf[_0x851a('0x5a')]||_0x375ecf['CampaignId']){return db[_0x375ecf[_0x851a('0x5a')]?_0x851a('0x5b'):_0x851a('0x5c')][_0x851a('0x56')]({'where':{'id':_0x375ecf['VoiceQueueId']?_0x375ecf['VoiceQueueId']:_0x375ecf[_0x851a('0x5d')]},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x587c8d){var _0x6568e={};if(_0x587c8d){_[_0x851a('0x4d')](_0x6568e,_[_0x851a('0x5e')](_0x3d7409[_0x851a('0x5f')],[_0x851a('0x60'),_0x851a('0x61'),'id']));_0x6568e[_0x851a('0x62')]=0x15;_0x6568e[_0x851a('0x63')]=_0x851a('0x64');_0x6568e[_0x851a('0x65')]=_0x587c8d['name'];_0x6568e[_0x851a('0x66')]=_0x4db34a[_0x851a('0x67')][_0x851a('0x2a')];_0x6568e['UserId']=_0x4db34a['user']['id'];_0x6568e[_0x851a('0x64')]=!![];_0x6568e[_0x851a('0x68')]=moment()['format'](_0x851a('0x69'));_0x6568e['calleridnum']=_0x3d7409[_0x851a('0x6a')];_0x6568e[_0x851a('0x6b')]=_0x3d7409['VoiceQueueId']?_0x851a('0x6c'):_0x851a('0x6d');return db[_0x851a('0x6e')][_0x851a('0x56')]({'where':{'id':_0x6568e[_0x851a('0x6f')]},'attributes':[_0x851a('0x70'),'lastName']})['then'](function(_0x37690a){if(!_[_0x851a('0x71')](_0x1a9bde)&&!_[_0x851a('0x71')](_0x37690a[_0x851a('0x70')])){_0x6568e[_0x851a('0x72')]=_0x37690a[_0x851a('0x70')];if(!_[_0x851a('0x71')](_0x37690a[_0x851a('0x73')])){_0x6568e['calleridname']+='\x20'+_0x37690a[_0x851a('0x73')];}}})[_0x851a('0x74')](function(){return db[_0x851a('0x75')][_0x851a('0x57')](_0x6568e);});}})[_0x851a('0x27')](function(){return _0x1a9bde[_0x851a('0x1a')](0xcc)[_0x851a('0x1b')]();})[_0x851a('0x52')](handleError(_0x1a9bde,null));};exports[_0x851a('0x76')]=function(_0x362c59,_0x5e0497,_0x28b850){var _0x3507db=[];return db[_0x851a('0x6e')][_0x851a('0x59')]()['then'](function(_0x395bdf){_0x3507db=_[_0x851a('0x30')](_0x395bdf);return _0x362c59[_0x851a('0x67')][_0x851a('0x77')]({'where':{'type':_0x851a('0x78'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x851a('0x79'),_0x851a('0x7a')],'raw':!![]});})[_0x851a('0x27')](function(_0x313723){if(_0x313723&&_0x313723['length']){return db[_0x851a('0x7b')]['transaction'](function(_0x52a249){var _0x3c463f={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x851a('0x7c')](_0x851a('0x69'))},'VoiceQueueId':{'$in':_['map'](_0x313723,'id')},'$or':[{'UserId':null},{'UserId':_0x362c59[_0x851a('0x67')]['id']}]};var _0x2727cd={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x313723)[_0x851a('0x4c')]([_0x851a('0x7a'),0x0])[_0x851a('0x2b')]('id')[_0x851a('0x7d')]()},'$or':[{'UserId':null},{'UserId':_0x362c59['user']['id']}]};var _0x3e7a17={'$or':[_0x3c463f,_0x2727cd]};var _0x3c8377=[];if(_0x362c59[_0x851a('0x58')][_0x851a('0x7e')]&&_0x362c59['body'][_0x851a('0x7e')]===_0x851a('0x7f')){if(!_[_0x851a('0x80')](_0x362c59[_0x851a('0x58')][_0x851a('0x81')])){_0x3e7a17['id']={'$in':_0x362c59['body'][_0x851a('0x81')]};}_0x3c8377=[[_0x851a('0x82'),_0x851a('0x83')],[_0x851a('0x84'),_0x313723[0x0][_0x851a('0x79')]===_0x851a('0x83')?_0x851a('0x85'):_0x851a('0x83')],db[_0x851a('0x7b')]['literal'](_0x851a('0x86')),['id','DESC']];}else{if(!_['isEmpty'](_0x362c59['body'][_0x851a('0x81')])){_0x3e7a17['id']={'$notIn':_0x362c59[_0x851a('0x58')][_0x851a('0x81')]};}_0x3c8377=[[_0x851a('0x82'),_0x851a('0x85')],['scheduledAt',_0x313723[0x0][_0x851a('0x79')]],db[_0x851a('0x7b')][_0x851a('0x87')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x851a('0x83')]];}return db[_0x851a('0x2c')][_0x851a('0x88')]({'attributes':['id','scheduledat',_0x851a('0x89')],'where':_0x3e7a17,'order':_0x3c8377,'transaction':_0x52a249,'lock':_0x52a249['LOCK'][_0x851a('0x8a')],'include':[{'model':db[_0x851a('0x6e')],'as':_0x851a('0x8b'),'attributes':_0x3507db,'include':[{'model':db[_0x851a('0x8c')],'as':_0x851a('0x8d'),'attributes':['id',_0x851a('0x2a')]}]},{'model':db[_0x851a('0x8e')],'as':_0x851a('0x8f'),'attributes':['id',_0x851a('0x2a')]},{'model':db[_0x851a('0x5b')],'as':'Queue','attributes':['id',_0x851a('0x2a'),_0x851a('0x90')]}]})[_0x851a('0x27')](function(_0x469918){if(_0x469918){return _0x469918[_0x851a('0x25')]({'UserId':_0x362c59['user']['id']},{'transaction':_0x52a249});}});});}})['then'](handleEntityNotFound(_0x5e0497,null))['then'](respondWithResult(_0x5e0497,null))['catch'](handleError(_0x5e0497,null));};exports[_0x851a('0x91')]=function(_0x4543f5,_0x5e335a,_0x2a6ed4){return _0x4543f5[_0x851a('0x67')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x851a('0x27')](function(_0x50ff2d){if(_0x50ff2d&&_0x50ff2d['length']){return db[_0x851a('0x2c')][_0x851a('0x20')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x851a('0x69'))},'VoiceQueueId':{'$in':_['map'](_0x50ff2d,'id')},'$or':[{'UserId':null},{'UserId':_0x4543f5[_0x851a('0x67')]['id']}]}});}return 0x0;})[_0x851a('0x27')](function(_0x32c995){if(!_[_0x851a('0x71')](_0x32c995)&&_[_0x851a('0x92')](_0x32c995)){return _0x5e335a[_0x851a('0x1a')](0xc8)[_0x851a('0x1c')]({'contacts':_0x32c995});}else{logger[_0x851a('0x28')](_0x851a('0x93'),_0x851a('0x91'),0x194,'entity\x20not\x20found');_0x5e335a['sendStatus'](0x194);}})['catch'](handleError(_0x5e335a,null));}; \ No newline at end of file +var _0x53d5=['List','Queue','getOpenContacts','getVoiceQueues','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','then','destroy','error','name','index','CmHopper','fieldName','type','key','model','map','query','filters','intersection','concat','$or','$gt','$gte','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$iLike','$notILike','$overlap','$any','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','keys','find','create','body','update','describe','VoiceQueueId','Campaign','CampaignId','omit','dataValues','updatedAt','state','statedesc','deleted','campaign','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','ivr','CmContact','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','isEmpty','hopperIds','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList'];(function(_0x40bd56,_0x2491d1){var _0x20947d=function(_0x26a39c){while(--_0x26a39c){_0x40bd56['push'](_0x40bd56['shift']());}};_0x20947d(++_0x2491d1);}(_0x53d5,0x1cc));var _0x553d=function(_0x2f09f7,_0x461707){_0x2f09f7=_0x2f09f7-0x0;var _0x1b266c=_0x53d5[_0x2f09f7];return _0x1b266c;};'use strict';var emlformat=require(_0x553d('0x0'));var rimraf=require(_0x553d('0x1'));var zipdir=require(_0x553d('0x2'));var jsonpatch=require(_0x553d('0x3'));var rp=require(_0x553d('0x4'));var moment=require(_0x553d('0x5'));var BPromise=require(_0x553d('0x6'));var Mustache=require('mustache');var util=require(_0x553d('0x7'));var path=require(_0x553d('0x8'));var sox=require(_0x553d('0x9'));var csv=require(_0x553d('0xa'));var ejs=require(_0x553d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x553d('0xc'));var squel=require(_0x553d('0xd'));var crypto=require(_0x553d('0xe'));var jsforce=require(_0x553d('0xf'));var deskjs=require(_0x553d('0x10'));var toCsv=require(_0x553d('0xa'));var querystring=require(_0x553d('0x11'));var Papa=require(_0x553d('0x12'));var Redis=require(_0x553d('0x13'));var authService=require(_0x553d('0x14'));var qs=require(_0x553d('0x15'));var as=require(_0x553d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x553d('0x17'));var utils=require('../../config/utils');var config=require(_0x553d('0x18'));var licenseUtil=require(_0x553d('0x19'));var db=require(_0x553d('0x1a'))['db'];function respondWithStatusCode(_0x1a54ea,_0x41f6c1){_0x41f6c1=_0x41f6c1||0xcc;return function(_0x4285c0){if(_0x4285c0){return _0x1a54ea[_0x553d('0x1b')](_0x41f6c1);}return _0x1a54ea[_0x553d('0x1c')](_0x41f6c1)[_0x553d('0x1d')]();};}function respondWithResult(_0x32b169,_0x3cb13c){_0x3cb13c=_0x3cb13c||0xc8;return function(_0xd11e74){if(_0xd11e74){return _0x32b169['status'](_0x3cb13c)[_0x553d('0x1e')](_0xd11e74);}};}function respondWithFilteredResult(_0x5caa96,_0x1d4f35){return function(_0x2de0c1){if(_0x2de0c1){var _0x12b505=typeof _0x1d4f35['offset']==='undefined'&&typeof _0x1d4f35[_0x553d('0x1f')]===_0x553d('0x20');var _0x2857c5=_0x2de0c1['count'];var _0x2ab468=_0x12b505?0x0:_0x1d4f35[_0x553d('0x21')];var _0x343ce5=_0x12b505?_0x2de0c1[_0x553d('0x22')]:_0x1d4f35[_0x553d('0x21')]+_0x1d4f35[_0x553d('0x1f')];var _0x719651;if(_0x343ce5>=_0x2857c5){_0x343ce5=_0x2857c5;_0x719651=0xc8;}else{_0x719651=0xce;}_0x5caa96[_0x553d('0x1c')](_0x719651);return _0x5caa96[_0x553d('0x23')](_0x553d('0x24'),_0x2ab468+'-'+_0x343ce5+'/'+_0x2857c5)[_0x553d('0x1e')](_0x2de0c1);}return null;};}function patchUpdates(_0x4950e7){return function(_0x11bc86){try{jsonpatch[_0x553d('0x25')](_0x11bc86,_0x4950e7,!![]);}catch(_0x4c5f0f){return BPromise[_0x553d('0x26')](_0x4c5f0f);}return _0x11bc86[_0x553d('0x27')]();};}function saveUpdates(_0x4d00e3,_0x5bbd2d){return function(_0x4a6e0e){if(_0x4a6e0e){return _0x4a6e0e['update'](_0x4d00e3)[_0x553d('0x28')](function(_0x53b217){return _0x53b217;});}return null;};}function removeEntity(_0x82dd3a,_0xacc984){return function(_0x2e4f1b){if(_0x2e4f1b){return _0x2e4f1b[_0x553d('0x29')]()[_0x553d('0x28')](function(){_0x82dd3a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2caed9,_0x491dc2){return function(_0x576c56){if(!_0x576c56){_0x2caed9[_0x553d('0x1b')](0x194);}return _0x576c56;};}function handleError(_0x517a1c,_0x677832){_0x677832=_0x677832||0x1f4;return function(_0x2c0484){logger[_0x553d('0x2a')](_0x2c0484['stack']);if(_0x2c0484[_0x553d('0x2b')]){delete _0x2c0484[_0x553d('0x2b')];}_0x517a1c[_0x553d('0x1c')](_0x677832)['send'](_0x2c0484);};}exports[_0x553d('0x2c')]=function(_0x39943d,_0x2bf05d){var _0x50fbc3={},_0x37ddd7={},_0x180a66={'count':0x0,'rows':[]};var _0xc3d157=_['map'](db[_0x553d('0x2d')]['rawAttributes'],function(_0x174fea){return{'name':_0x174fea[_0x553d('0x2e')],'type':_0x174fea[_0x553d('0x2f')][_0x553d('0x30')]};});_0x37ddd7[_0x553d('0x31')]=_[_0x553d('0x32')](_0xc3d157,_0x553d('0x2b'));_0x37ddd7[_0x553d('0x33')]=_['keys'](_0x39943d[_0x553d('0x33')]);_0x37ddd7[_0x553d('0x34')]=_[_0x553d('0x35')](_0x37ddd7[_0x553d('0x31')],_0x37ddd7[_0x553d('0x33')]);_0x37ddd7[_0x553d('0x34')]=_[_0x553d('0x36')](_0x37ddd7[_0x553d('0x34')],['$and',_0x553d('0x37'),_0x553d('0x38'),_0x553d('0x39'),'$lt',_0x553d('0x3a'),_0x553d('0x3b'),_0x553d('0x3c'),_0x553d('0x3d'),_0x553d('0x3e'),_0x553d('0x3f'),_0x553d('0x40'),_0x553d('0x41'),'$like','$notLike',_0x553d('0x42'),_0x553d('0x43'),'$like',_0x553d('0x44'),'$contains','$contained',_0x553d('0x45')]);_0x50fbc3['attributes']=_[_0x553d('0x35')](_0x37ddd7['model'],qs[_0x553d('0x46')](_0x39943d[_0x553d('0x33')]['fields']));_0x50fbc3['attributes']=_0x50fbc3[_0x553d('0x47')][_0x553d('0x48')]?_0x50fbc3[_0x553d('0x47')]:_0x37ddd7[_0x553d('0x31')];if(!_0x39943d['query'][_0x553d('0x49')](_0x553d('0x4a'))){_0x50fbc3['limit']=qs[_0x553d('0x1f')](_0x39943d['query'][_0x553d('0x1f')]);_0x50fbc3[_0x553d('0x21')]=qs[_0x553d('0x21')](_0x39943d[_0x553d('0x33')]['offset']);}_0x50fbc3['order']=qs[_0x553d('0x4b')](_0x39943d[_0x553d('0x33')][_0x553d('0x4b')]);_0x50fbc3[_0x553d('0x4c')]=qs[_0x553d('0x34')](_[_0x553d('0x4d')](_0x39943d[_0x553d('0x33')],_0x37ddd7[_0x553d('0x34')]),_0xc3d157);if(_0x39943d[_0x553d('0x33')][_0x553d('0x4e')]){_0x50fbc3['where']=_[_0x553d('0x4f')](_0x50fbc3[_0x553d('0x4c')],{'$or':_['map'](_0xc3d157,function(_0x3fce6f){if(_0x3fce6f[_0x553d('0x2f')]!=='VIRTUAL'){var _0x1caab8={};_0x1caab8[_0x3fce6f[_0x553d('0x2b')]]={'$like':'%'+_0x39943d[_0x553d('0x33')][_0x553d('0x4e')]+'%'};return _0x1caab8;}})});}_0x50fbc3=_[_0x553d('0x4f')]({},_0x50fbc3,_0x39943d[_0x553d('0x50')]);var _0x596b71={'where':_0x50fbc3[_0x553d('0x4c')]};return db[_0x553d('0x2d')][_0x553d('0x22')](_0x596b71)['then'](function(_0x247bdf){_0x180a66[_0x553d('0x22')]=_0x247bdf;if(_0x39943d['query'][_0x553d('0x51')]){_0x50fbc3[_0x553d('0x52')]=[{'all':!![]}];}return db[_0x553d('0x2d')][_0x553d('0x53')](_0x50fbc3);})[_0x553d('0x28')](function(_0x39d602){_0x180a66[_0x553d('0x54')]=_0x39d602;return _0x180a66;})[_0x553d('0x28')](respondWithFilteredResult(_0x2bf05d,_0x50fbc3))[_0x553d('0x55')](handleError(_0x2bf05d,null));};exports['show']=function(_0x75a3da,_0x541f4f){var _0x17532b={'raw':!![],'where':{'id':_0x75a3da[_0x553d('0x56')]['id']}},_0x4868b8={};_0x4868b8[_0x553d('0x31')]=_['keys'](db[_0x553d('0x2d')][_0x553d('0x57')]);_0x4868b8[_0x553d('0x33')]=_[_0x553d('0x58')](_0x75a3da[_0x553d('0x33')]);_0x4868b8['filters']=_[_0x553d('0x35')](_0x4868b8['model'],_0x4868b8[_0x553d('0x33')]);_0x17532b[_0x553d('0x47')]=_[_0x553d('0x35')](_0x4868b8[_0x553d('0x31')],qs[_0x553d('0x46')](_0x75a3da[_0x553d('0x33')][_0x553d('0x46')]));_0x17532b[_0x553d('0x47')]=_0x17532b[_0x553d('0x47')][_0x553d('0x48')]?_0x17532b[_0x553d('0x47')]:_0x4868b8[_0x553d('0x31')];if(_0x75a3da[_0x553d('0x33')][_0x553d('0x51')]){_0x17532b[_0x553d('0x52')]=[{'all':!![]}];}_0x17532b=_[_0x553d('0x4f')]({},_0x17532b,_0x75a3da[_0x553d('0x50')]);return db['CmHopper'][_0x553d('0x59')](_0x17532b)[_0x553d('0x28')](handleEntityNotFound(_0x541f4f,null))[_0x553d('0x28')](respondWithResult(_0x541f4f,null))[_0x553d('0x55')](handleError(_0x541f4f,null));};exports['create']=function(_0x5a5df4,_0x1ef10a){return db[_0x553d('0x2d')][_0x553d('0x5a')](_0x5a5df4[_0x553d('0x5b')],{})[_0x553d('0x28')](respondWithResult(_0x1ef10a,0xc9))[_0x553d('0x55')](handleError(_0x1ef10a,null));};exports[_0x553d('0x5c')]=function(_0x10053b,_0x126d57){if(_0x10053b['body']['id']){delete _0x10053b[_0x553d('0x5b')]['id'];}return db[_0x553d('0x2d')][_0x553d('0x59')]({'where':{'id':_0x10053b[_0x553d('0x56')]['id']}})['then'](handleEntityNotFound(_0x126d57,null))['then'](saveUpdates(_0x10053b[_0x553d('0x5b')],null))[_0x553d('0x28')](respondWithResult(_0x126d57,null))[_0x553d('0x55')](handleError(_0x126d57,null));};exports[_0x553d('0x5d')]=function(_0x2bb795,_0x1f0a5c){return db[_0x553d('0x2d')][_0x553d('0x5d')]()['then'](respondWithResult(_0x1f0a5c,null))[_0x553d('0x55')](handleError(_0x1f0a5c,null));};exports['destroy']=function(_0x1bdec1,_0x4e8179){var _0x3b5169;return db['CmHopper']['find']({'where':{'id':_0x1bdec1[_0x553d('0x56')]['id']}})[_0x553d('0x28')](handleEntityNotFound(_0x4e8179,null))['then'](function(_0x26f753){if(_0x26f753){return _0x26f753[_0x553d('0x29')]()[_0x553d('0x28')](function(_0x47ac58){return _0x47ac58;});}})[_0x553d('0x28')](function(_0x3bccbd){_0x3b5169=_0x3bccbd;if(_0x3bccbd){if(_0x3bccbd[_0x553d('0x5e')]||_0x3bccbd['CampaignId']){return db[_0x3bccbd['VoiceQueueId']?'VoiceQueue':_0x553d('0x5f')]['find']({'where':{'id':_0x3bccbd[_0x553d('0x5e')]?_0x3bccbd[_0x553d('0x5e')]:_0x3bccbd[_0x553d('0x60')]},'attributes':['id',_0x553d('0x2b')],'raw':!![]});}}})[_0x553d('0x28')](function(_0x50b4b8){var _0x295159={};if(_0x50b4b8){_[_0x553d('0x4f')](_0x295159,_[_0x553d('0x61')](_0x3b5169[_0x553d('0x62')],['createdAt',_0x553d('0x63'),'id']));_0x295159[_0x553d('0x64')]=0x15;_0x295159[_0x553d('0x65')]=_0x553d('0x66');_0x295159[_0x553d('0x67')]=_0x50b4b8[_0x553d('0x2b')];_0x295159['membername']=_0x1bdec1[_0x553d('0x68')][_0x553d('0x2b')];_0x295159[_0x553d('0x69')]=_0x1bdec1[_0x553d('0x68')]['id'];_0x295159['deleted']=!![];_0x295159[_0x553d('0x6a')]=moment()[_0x553d('0x6b')](_0x553d('0x6c'));_0x295159[_0x553d('0x6d')]=_0x3b5169['phone'];_0x295159[_0x553d('0x6e')]=_0x3b5169[_0x553d('0x5e')]?'queue':_0x553d('0x6f');return db[_0x553d('0x70')][_0x553d('0x59')]({'where':{'id':_0x295159['ContactId']},'attributes':[_0x553d('0x71'),_0x553d('0x72')]})[_0x553d('0x28')](function(_0x40f086){if(!_[_0x553d('0x73')](_0x4e8179)&&!_[_0x553d('0x73')](_0x40f086[_0x553d('0x71')])){_0x295159[_0x553d('0x74')]=_0x40f086[_0x553d('0x71')];if(!_[_0x553d('0x73')](_0x40f086[_0x553d('0x72')])){_0x295159[_0x553d('0x74')]+='\x20'+_0x40f086[_0x553d('0x72')];}}})[_0x553d('0x75')](function(){return db[_0x553d('0x76')][_0x553d('0x5a')](_0x295159);});}})[_0x553d('0x28')](function(){return _0x4e8179[_0x553d('0x1c')](0xcc)[_0x553d('0x1d')]();})[_0x553d('0x55')](handleError(_0x4e8179,null));};exports[_0x553d('0x77')]=function(_0x4a535f,_0x2fac68,_0x23a51c){var _0x494803=[];return db['CmContact'][_0x553d('0x5d')]()[_0x553d('0x28')](function(_0x22afce){_0x494803=_[_0x553d('0x58')](_0x22afce);return _0x4a535f[_0x553d('0x68')]['getVoiceQueues']({'where':{'type':_0x553d('0x78'),'dialActive':!![],'dialMethod':_0x553d('0x79')},'attributes':['id',_0x553d('0x7a'),_0x553d('0x7b')],'raw':!![]});})[_0x553d('0x28')](function(_0x4926e1){if(_0x4926e1&&_0x4926e1[_0x553d('0x48')]){return db[_0x553d('0x7c')][_0x553d('0x7d')](function(_0x356814){var _0x58e4d0={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x553d('0x6c'))},'VoiceQueueId':{'$in':_['map'](_0x4926e1,'id')},'$or':[{'UserId':null},{'UserId':_0x4a535f[_0x553d('0x68')]['id']}]};var _0x2f9724={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4926e1)['filter'](['dialPreviewAutoRecallMe',0x0])[_0x553d('0x32')]('id')[_0x553d('0x7e')]()},'$or':[{'UserId':null},{'UserId':_0x4a535f[_0x553d('0x68')]['id']}]};var _0x33836f={'$or':[_0x58e4d0,_0x2f9724]};var _0x399104=[];if(_0x4a535f[_0x553d('0x5b')][_0x553d('0x7f')]&&_0x4a535f['body'][_0x553d('0x7f')]==='prev'){if(!_[_0x553d('0x80')](_0x4a535f[_0x553d('0x5b')][_0x553d('0x81')])){_0x33836f['id']={'$in':_0x4a535f[_0x553d('0x5b')][_0x553d('0x81')]};}_0x399104=[['priority',_0x553d('0x82')],[_0x553d('0x83'),_0x4926e1[0x0][_0x553d('0x7a')]===_0x553d('0x82')?_0x553d('0x84'):_0x553d('0x82')],db[_0x553d('0x7c')][_0x553d('0x85')](_0x553d('0x86')),['id',_0x553d('0x84')]];}else{if(!_['isEmpty'](_0x4a535f[_0x553d('0x5b')][_0x553d('0x81')])){_0x33836f['id']={'$notIn':_0x4a535f[_0x553d('0x5b')][_0x553d('0x81')]};}_0x399104=[['priority','DESC'],[_0x553d('0x83'),_0x4926e1[0x0][_0x553d('0x7a')]],db['sequelize'][_0x553d('0x85')](_0x553d('0x87')),['id',_0x553d('0x82')]];}return db[_0x553d('0x2d')][_0x553d('0x88')]({'attributes':['id',_0x553d('0x89'),'recallme'],'where':_0x33836f,'order':_0x399104,'transaction':_0x356814,'lock':_0x356814[_0x553d('0x8a')][_0x553d('0x8b')],'include':[{'model':db[_0x553d('0x70')],'as':_0x553d('0x8c'),'attributes':_0x494803,'include':[{'model':db[_0x553d('0x8d')],'as':_0x553d('0x8e'),'attributes':['id',_0x553d('0x2b')]}]},{'model':db[_0x553d('0x8f')],'as':_0x553d('0x90'),'attributes':['id',_0x553d('0x2b')]},{'model':db['VoiceQueue'],'as':_0x553d('0x91'),'attributes':['id',_0x553d('0x2b'),'dialActive']}]})[_0x553d('0x28')](function(_0x25b48f){if(_0x25b48f){return _0x25b48f[_0x553d('0x5c')]({'UserId':_0x4a535f['user']['id']},{'transaction':_0x356814});}});});}})[_0x553d('0x28')](handleEntityNotFound(_0x2fac68,null))[_0x553d('0x28')](respondWithResult(_0x2fac68,null))[_0x553d('0x55')](handleError(_0x2fac68,null));};exports[_0x553d('0x92')]=function(_0x6972f3,_0x421157,_0x52687d){return _0x6972f3[_0x553d('0x68')][_0x553d('0x93')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x553d('0x79')},'attributes':['id'],'raw':!![]})[_0x553d('0x28')](function(_0x543e75){if(_0x543e75&&_0x543e75[_0x553d('0x48')]){return db['CmHopper']['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x553d('0x32')](_0x543e75,'id')},'$or':[{'UserId':null},{'UserId':_0x6972f3['user']['id']}]}});}return 0x0;})[_0x553d('0x28')](function(_0x2e1763){if(!_['isNil'](_0x2e1763)&&_[_0x553d('0x94')](_0x2e1763)){return _0x421157[_0x553d('0x1c')](0xc8)['json']({'contacts':_0x2e1763});}else{logger[_0x553d('0x2a')](_0x553d('0x95'),_0x553d('0x92'),0x194,_0x553d('0x96'));_0x421157['sendStatus'](0x194);}})['catch'](handleError(_0x421157,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index b125361..4e8e8b5 100644 --- a/server/api/cmHopper/cmHopper.model.js +++ b/server/api/cmHopper/cmHopper.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2675=['path','rimraf','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority','lodash','moment','bluebird'];(function(_0x492e32,_0x2e0a93){var _0x4a335e=function(_0x1f4998){while(--_0x1f4998){_0x492e32['push'](_0x492e32['shift']());}};_0x4a335e(++_0x2e0a93);}(_0x2675,0x75));var _0x5267=function(_0x3ebb4b,_0x4ff0b7){_0x3ebb4b=_0x3ebb4b-0x0;var _0x3083f1=_0x2675[_0x3ebb4b];return _0x3083f1;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5267('0x1'));var BPromise=require(_0x5267('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5267('0x3'));var rimraf=require(_0x5267('0x4'));var config=require('../../config/environment');var attributes=require(_0x5267('0x5'));module[_0x5267('0x6')]=function(_0x4bd042,_0x10f92c){return _0x4bd042[_0x5267('0x7')](_0x5267('0x8'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x5267('0x9'),'fields':[_0x5267('0x9')]},{'name':'phone','fields':[_0x5267('0xa')]},{'name':'priority','fields':[_0x5267('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc6ac=['./cmHopper.attributes','exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x43bd79,_0x248d41){_0x43bd79=_0x43bd79-0x0;var _0x4c8174=_0xc6ac[_0x43bd79];return _0x4c8174;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var logger=require(_0xcc6a('0x2'))(_0xcc6a('0x3'));var moment=require(_0xcc6a('0x4'));var BPromise=require(_0xcc6a('0x5'));var rp=require(_0xcc6a('0x6'));var fs=require('fs');var path=require(_0xcc6a('0x7'));var rimraf=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var attributes=require(_0xcc6a('0xa'));module[_0xcc6a('0xb')]=function(_0x12330e,_0x197bd7){return _0x12330e['define'](_0xcc6a('0xc'),attributes,{'tableName':_0xcc6a('0xd'),'paranoid':![],'indexes':[{'name':_0xcc6a('0xe'),'fields':['scheduledat']},{'name':_0xcc6a('0xf'),'fields':[_0xcc6a('0xf')]},{'name':_0xcc6a('0x10'),'fields':[_0xcc6a('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index e431916..338ce21 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 _0x1a00=['UserId','push','all','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','GetContactRecallMe','order','GetCmHopperPreview','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','interval','NOW()\x20+\x20INTERVAL\x20','name','CmList','List','literal','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CmHopper','options','raw','where','attributes','map','include','model','GetCmHopper','debug','find','ShowCmHopper','create','CreateCmHopper','update','limit','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','body','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','findAll','LOCK','UPDATE','Contact','keys','User','Agent','voicePause'];(function(_0x4c36f5,_0x41891a){var _0x1b2af2=function(_0x3ae08c){while(--_0x3ae08c){_0x4c36f5['push'](_0x4c36f5['shift']());}};_0x1b2af2(++_0x41891a);}(_0x1a00,0x1c9));var _0x01a0=function(_0x1da6d3,_0x340cfe){_0x1da6d3=_0x1da6d3-0x0;var _0x816e24=_0x1a00[_0x1da6d3];return _0x816e24;};'use strict';var _=require(_0x01a0('0x0'));var util=require(_0x01a0('0x1'));var moment=require(_0x01a0('0x2'));var BPromise=require(_0x01a0('0x3'));var rs=require(_0x01a0('0x4'));var fs=require('fs');var Redis=require(_0x01a0('0x5'));var db=require(_0x01a0('0x6'))['db'];var utils=require(_0x01a0('0x7'));var logger=require('../../config/logger')(_0x01a0('0x8'));var config=require(_0x01a0('0x9'));var jayson=require(_0x01a0('0xa'));const {validateExpressRequest}=require('twilio/lib/webhooks/webhooks');var client=jayson[_0x01a0('0xb')][_0x01a0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xa8c6e7,_0x2c4a9b,_0x59dce6){return new BPromise(function(_0x1cf6b5,_0x496e00){return client[_0x01a0('0xd')](_0xa8c6e7,_0x59dce6)[_0x01a0('0xe')](function(_0xc226b8){logger[_0x01a0('0xf')](_0x01a0('0x10'),_0x2c4a9b,_0x01a0('0x11'));logger['debug'](_0x01a0('0x12'),_0x2c4a9b,'request\x20sent',JSON[_0x01a0('0x13')](_0xc226b8));if(_0xc226b8[_0x01a0('0x14')]){if(_0xc226b8[_0x01a0('0x14')][_0x01a0('0x15')]===0x1f4){logger[_0x01a0('0x14')]('CmHopper,\x20%s,\x20%s',_0x2c4a9b,_0xc226b8[_0x01a0('0x14')][_0x01a0('0x16')]);return _0x496e00(_0xc226b8['error'][_0x01a0('0x16')]);}logger[_0x01a0('0x14')](_0x01a0('0x10'),_0x2c4a9b,_0xc226b8['error'][_0x01a0('0x16')]);return _0x1cf6b5(_0xc226b8[_0x01a0('0x14')][_0x01a0('0x16')]);}else{logger[_0x01a0('0xf')]('CmHopper,\x20%s,\x20%s',_0x2c4a9b,_0x01a0('0x11'));_0x1cf6b5(_0xc226b8['result']['message']);}})[_0x01a0('0x17')](function(_0x5bb9b5){logger[_0x01a0('0x14')](_0x01a0('0x10'),_0x2c4a9b,_0x5bb9b5);_0x496e00(_0x5bb9b5);});});}exports['GetCmHopper']=function(_0x19ed64){var _0x204760=this;return new Promise(function(_0x199899,_0x541a63){return db[_0x01a0('0x18')]['findAll']({'raw':_0x19ed64[_0x01a0('0x19')]?_0x19ed64[_0x01a0('0x19')][_0x01a0('0x1a')]===undefined?!![]:![]:!![],'where':_0x19ed64[_0x01a0('0x19')]?_0x19ed64[_0x01a0('0x19')][_0x01a0('0x1b')]||null:null,'attributes':_0x19ed64[_0x01a0('0x19')]?_0x19ed64[_0x01a0('0x19')][_0x01a0('0x1c')]||null:null,'limit':_0x19ed64[_0x01a0('0x19')]?_0x19ed64[_0x01a0('0x19')]['limit']||null:null,'include':_0x19ed64[_0x01a0('0x19')]?_0x19ed64['options']['include']?_[_0x01a0('0x1d')](_0x19ed64[_0x01a0('0x19')][_0x01a0('0x1e')],function(_0xf6a79b){return{'model':db[_0xf6a79b['model']],'as':_0xf6a79b['as'],'attributes':_0xf6a79b[_0x01a0('0x1c')],'include':_0xf6a79b[_0x01a0('0x1e')]?_[_0x01a0('0x1d')](_0xf6a79b[_0x01a0('0x1e')],function(_0x52e83a){return{'model':db[_0x52e83a[_0x01a0('0x1f')]],'as':_0x52e83a['as'],'attributes':_0x52e83a['attributes'],'include':_0x52e83a['include']?_[_0x01a0('0x1d')](_0x52e83a[_0x01a0('0x1e')],function(_0x443ca0){return{'model':db[_0x443ca0[_0x01a0('0x1f')]],'as':_0x443ca0['as'],'attributes':_0x443ca0[_0x01a0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x01a0('0xe')](function(_0x5bccd3){logger[_0x01a0('0xf')](_0x01a0('0x20'),_0x19ed64);logger[_0x01a0('0x21')](_0x01a0('0x20'),_0x19ed64,JSON[_0x01a0('0x13')](_0x5bccd3));_0x199899(_0x5bccd3);})['catch'](function(_0x2056a4){logger['error'](_0x01a0('0x20'),_0x2056a4[_0x01a0('0x16')],_0x19ed64);_0x541a63(_0x204760[_0x01a0('0x14')](0x1f4,_0x2056a4[_0x01a0('0x16')]));});});};exports['ShowCmHopper']=function(_0x14a52b){var _0x5c41c2=this;return new Promise(function(_0x2f6b66,_0x2a3ffb){return db[_0x01a0('0x18')][_0x01a0('0x22')]({'raw':_0x14a52b[_0x01a0('0x19')]?_0x14a52b['options'][_0x01a0('0x1a')]===undefined?!![]:![]:!![],'where':_0x14a52b[_0x01a0('0x19')]?_0x14a52b['options'][_0x01a0('0x1b')]||null:null,'attributes':_0x14a52b[_0x01a0('0x19')]?_0x14a52b[_0x01a0('0x19')]['attributes']||null:null,'include':_0x14a52b['options']?_0x14a52b['options']['include']?_[_0x01a0('0x1d')](_0x14a52b[_0x01a0('0x19')][_0x01a0('0x1e')],function(_0x1354c3){return{'model':db[_0x1354c3[_0x01a0('0x1f')]],'as':_0x1354c3['as'],'attributes':_0x1354c3[_0x01a0('0x1c')],'include':_0x1354c3[_0x01a0('0x1e')]?_[_0x01a0('0x1d')](_0x1354c3['include'],function(_0x16b39e){return{'model':db[_0x16b39e[_0x01a0('0x1f')]],'as':_0x16b39e['as'],'attributes':_0x16b39e[_0x01a0('0x1c')],'include':_0x16b39e[_0x01a0('0x1e')]?_[_0x01a0('0x1d')](_0x16b39e['include'],function(_0x4338eb){return{'model':db[_0x4338eb[_0x01a0('0x1f')]],'as':_0x4338eb['as'],'attributes':_0x4338eb[_0x01a0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x01a0('0xe')](function(_0x24f2e1){logger[_0x01a0('0xf')](_0x01a0('0x23'),_0x14a52b);logger[_0x01a0('0x21')]('ShowCmHopper',_0x14a52b,JSON[_0x01a0('0x13')](_0x24f2e1));_0x2f6b66(_0x24f2e1);})[_0x01a0('0x17')](function(_0x538c19){logger[_0x01a0('0x14')](_0x01a0('0x23'),_0x538c19[_0x01a0('0x16')],_0x14a52b);_0x2a3ffb(_0x5c41c2['error'](0x1f4,_0x538c19[_0x01a0('0x16')]));});});};exports['CreateCmHopper']=function(_0x5d41d4){var _0x572456=this;return new Promise(function(_0x40110b,_0x170834){return db[_0x01a0('0x18')][_0x01a0('0x24')](_0x5d41d4['body'],{'raw':_0x5d41d4['options']?_0x5d41d4[_0x01a0('0x19')][_0x01a0('0x1a')]===undefined?!![]:![]:!![]})[_0x01a0('0xe')](function(_0x166b5c){logger[_0x01a0('0xf')](_0x01a0('0x25'),_0x5d41d4);logger['debug'](_0x01a0('0x25'),_0x5d41d4,JSON['stringify'](_0x166b5c));_0x40110b(_0x166b5c);})[_0x01a0('0x17')](function(_0x39e3bd){logger['error'](_0x01a0('0x25'),_0x39e3bd['message'],_0x5d41d4);_0x170834(_0x572456['error'](0x1f4,_0x39e3bd[_0x01a0('0x16')]));});});};exports['UpdateCmHopper']=function(_0x2c2fef){var _0x4d983c=this;return new Promise(function(_0x1d3834,_0x3d4eca){return db[_0x01a0('0x18')][_0x01a0('0x26')](_0x2c2fef['body'],{'raw':_0x2c2fef[_0x01a0('0x19')]?_0x2c2fef[_0x01a0('0x19')][_0x01a0('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c2fef[_0x01a0('0x19')]?_0x2c2fef['options'][_0x01a0('0x1b')]||null:null,'attributes':_0x2c2fef['options']?_0x2c2fef[_0x01a0('0x19')]['attributes']||null:null,'limit':_0x2c2fef[_0x01a0('0x19')]?_0x2c2fef[_0x01a0('0x19')][_0x01a0('0x27')]||null:null})[_0x01a0('0xe')](function(_0x51b377){logger[_0x01a0('0xf')](_0x01a0('0x28'),_0x2c2fef);logger[_0x01a0('0xf')](_0x01a0('0x29'),JSON[_0x01a0('0x13')](_0x2c2fef[_0x01a0('0x19')][_0x01a0('0x1b')]),_0x2c2fef[_0x01a0('0x2a')][_0x01a0('0x2b')]);logger[_0x01a0('0x21')](_0x01a0('0x28'),_0x2c2fef,JSON[_0x01a0('0x13')](_0x51b377));_0x1d3834(_0x51b377);})[_0x01a0('0x17')](function(_0x314c13){logger[_0x01a0('0x14')]('UpdateCmHopper',_0x314c13[_0x01a0('0x16')],_0x2c2fef);_0x3d4eca(_0x4d983c[_0x01a0('0x14')](0x1f4,_0x314c13[_0x01a0('0x16')]));});});};exports[_0x01a0('0x2c')]=function(_0x23735d){var _0x400032=this;return new Promise(function(_0x3b2bb0,_0x249c82){return db[_0x01a0('0x18')][_0x01a0('0x2d')]({'where':_0x23735d['options']?_0x23735d[_0x01a0('0x19')][_0x01a0('0x1b')]||null:null})[_0x01a0('0xe')](function(_0x2b7e73){logger[_0x01a0('0xf')](_0x01a0('0x2c'),_0x23735d);logger[_0x01a0('0x21')]('DestroyCmHopper',_0x23735d,JSON[_0x01a0('0x13')](_0x2b7e73));_0x3b2bb0(_0x2b7e73);})[_0x01a0('0x17')](function(_0x99f9fa){logger[_0x01a0('0x14')](_0x01a0('0x2c'),_0x99f9fa['message'],_0x23735d);_0x249c82(_0x400032[_0x01a0('0x14')](0x1f4,_0x99f9fa['message']));});});};exports[_0x01a0('0x2e')]=function(_0x2d3117){var _0x32ea1f=this;return new Promise(function(_0x32c863,_0x78db2d){return db[_0x01a0('0x2f')][_0x01a0('0x30')]()[_0x01a0('0xe')](function(_0x17a3fd){return db[_0x01a0('0x31')][_0x01a0('0x32')](function(_0x3f2fa0){return db[_0x01a0('0x18')][_0x01a0('0x33')]({'where':_0x2d3117[_0x01a0('0x19')]?_0x2d3117[_0x01a0('0x19')][_0x01a0('0x1b')]||null:null,'attributes':_0x2d3117[_0x01a0('0x19')]?_0x2d3117[_0x01a0('0x19')][_0x01a0('0x1c')]||null:null,'limit':_0x2d3117[_0x01a0('0x19')]?_0x2d3117['options']['limit']||null:null,'order':_0x2d3117[_0x01a0('0x19')]?_0x2d3117[_0x01a0('0x19')]['order']||null:null,'transaction':_0x3f2fa0,'lock':_0x3f2fa0[_0x01a0('0x34')][_0x01a0('0x35')],'include':[{'model':db[_0x01a0('0x2f')],'as':_0x01a0('0x36'),'attributes':_[_0x01a0('0x37')](_0x17a3fd)},{'model':db[_0x01a0('0x38')],'as':_0x01a0('0x39'),'attributes':['id','name',_0x01a0('0x3a')]}]})[_0x01a0('0xe')](function(_0x3e8ea6){var _0x3e0a82=[];var _0x51edd1=[];for(var _0x495e2f=0x0;_0x495e2f<_0x3e8ea6['length'];_0x495e2f+=0x1){var _0x555f04=_0x3e8ea6[_0x495e2f][_0x01a0('0x3b')];if(_0x555f04===null){_0x3e0a82[_0x01a0('0x3c')](_0x3e8ea6[_0x495e2f][_0x01a0('0x26')](_0x2d3117[_0x01a0('0x2a')],{'transaction':_0x3f2fa0}));}else if(!_0x51edd1['includes'](_0x555f04)){_0x51edd1['push'](_0x555f04);_0x3e0a82[_0x01a0('0x3c')](_0x3e8ea6[_0x495e2f][_0x01a0('0x26')](_0x2d3117[_0x01a0('0x2a')],{'transaction':_0x3f2fa0}));}}return BPromise[_0x01a0('0x3d')](_0x3e0a82);});})['then'](function(_0x5c0021){logger[_0x01a0('0xf')](_0x01a0('0x2e'),_0x2d3117);if(_0x5c0021[_0x01a0('0x3e')]>0x0){logger['info'](_0x01a0('0x3f'),_0x5c0021[0x0][_0x01a0('0x40')]['id'],_0x5c0021[0x0][_0x01a0('0x40')][_0x01a0('0x41')],_0x5c0021[0x0][_0x01a0('0x40')]['active']);}logger[_0x01a0('0x21')](_0x01a0('0x2e'),_0x2d3117,JSON[_0x01a0('0x13')](_0x5c0021));_0x32c863(_0x5c0021);})[_0x01a0('0x17')](function(_0x2c9ccb){logger[_0x01a0('0x14')](_0x01a0('0x2e'),_0x2c9ccb[_0x01a0('0x16')],_0x2d3117);_0x78db2d(_0x32ea1f[_0x01a0('0x14')](0x1f4,_0x2c9ccb['message']));});});});};exports[_0x01a0('0x42')]=function(_0x1830f8){var _0x3943df=this;return new Promise(function(_0xf79456,_0x21e7ae){return db['sequelize']['transaction'](function(_0x3fa8f6){return db[_0x01a0('0x43')][_0x01a0('0x24')](_0x1830f8[_0x01a0('0x2a')],{'raw':_0x1830f8[_0x01a0('0x19')]?_0x1830f8[_0x01a0('0x19')][_0x01a0('0x1a')]===undefined?!![]:![]:!![],'transaction':_0x3fa8f6})['then'](function(){logger[_0x01a0('0xf')](_0x01a0('0x44'),JSON[_0x01a0('0x13')](_0x1830f8[_0x01a0('0x19')][_0x01a0('0x1b')]),_0x1830f8[_0x01a0('0x19')]['where']['active']);return db[_0x01a0('0x18')][_0x01a0('0x2d')]({'where':_0x1830f8[_0x01a0('0x19')]?_0x1830f8[_0x01a0('0x19')]['where']||null:null,'transaction':_0x3fa8f6});});})[_0x01a0('0xe')](function(_0x48667f){logger['info'](_0x01a0('0x42'),_0x1830f8);logger[_0x01a0('0x21')](_0x01a0('0x42'),_0x1830f8,JSON[_0x01a0('0x13')](_0x48667f));_0xf79456(_0x48667f);})[_0x01a0('0x17')](function(_0x22022f){logger[_0x01a0('0x14')](_0x01a0('0x42'),_0x22022f[_0x01a0('0x16')],_0x1830f8);_0x21e7ae(_0x3943df[_0x01a0('0x14')](0x1f4,_0x22022f['message']));});});};exports[_0x01a0('0x45')]=function(_0x353e33){var _0x9e7977=this;return new Promise(function(_0x176276,_0x291283){return db[_0x01a0('0x18')][_0x01a0('0x33')]({'raw':_0x353e33[_0x01a0('0x19')]?_0x353e33[_0x01a0('0x19')][_0x01a0('0x1a')]===undefined?!![]:![]:!![],'where':_0x353e33[_0x01a0('0x19')]?_0x353e33[_0x01a0('0x19')]['where']||null:null,'attributes':[[db[_0x01a0('0x31')]['fn'](_0x01a0('0x46'),db[_0x01a0('0x31')]['fn']('IF',db['sequelize']['literal'](_0x01a0('0x47')+util[_0x01a0('0x48')](_0x01a0('0x49'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0x01a0('0xe')](function(_0x15ef39){logger['info']('CountReScheduled',_0x353e33);logger['debug'](_0x01a0('0x45'),_0x353e33,JSON['stringify'](_0x15ef39));_0x176276(_0x15ef39);})['catch'](function(_0xd16458){logger[_0x01a0('0x14')](_0x01a0('0x45'),_0xd16458[_0x01a0('0x16')],_0x353e33);_0x291283(_0x9e7977['error'](0x1f4,_0xd16458['message']));});});};exports[_0x01a0('0x4a')]=function(_0x433ff4){var _0x13336a=this;return new Promise(function(_0x32afd3,_0x53ba07){return db[_0x01a0('0x2f')][_0x01a0('0x30')]()[_0x01a0('0xe')](function(_0x15c827){return db[_0x01a0('0x31')][_0x01a0('0x32')](function(_0x1f2606){return db[_0x01a0('0x18')][_0x01a0('0x33')]({'where':_0x433ff4['options']?_0x433ff4[_0x01a0('0x19')]['where']||null:null,'attributes':_0x433ff4[_0x01a0('0x19')]?_0x433ff4[_0x01a0('0x19')][_0x01a0('0x1c')]||null:null,'limit':0x1,'order':_0x433ff4[_0x01a0('0x19')]?_0x433ff4['options'][_0x01a0('0x4b')]||null:null,'group':db[_0x01a0('0x18')][_0x01a0('0x3b')],'transaction':_0x1f2606,'lock':_0x1f2606[_0x01a0('0x34')]['UPDATE'],'include':_0x433ff4[_0x01a0('0x19')]?_0x433ff4[_0x01a0('0x19')][_0x01a0('0x1e')]?_[_0x01a0('0x1d')](_0x433ff4['options'][_0x01a0('0x1e')],function(_0x2b3480){return{'model':db[_0x2b3480[_0x01a0('0x1f')]],'as':_0x2b3480['as'],'attributes':_0x2b3480[_0x01a0('0x1c')],'include':_0x2b3480['include']?_[_0x01a0('0x1d')](_0x2b3480[_0x01a0('0x1e')],function(_0xdc52c4){return{'model':db[_0xdc52c4['model']],'as':_0xdc52c4['as'],'attributes':_0xdc52c4['attributes'],'include':_0xdc52c4[_0x01a0('0x1e')]?_[_0x01a0('0x1d')](_0xdc52c4['include'],function(_0x60b0e2){return{'model':db[_0x60b0e2[_0x01a0('0x1f')]],'as':_0x60b0e2['as'],'attributes':_0x60b0e2['attributes']};}):[]};}):[]};}):[]:[]})[_0x01a0('0xe')](function(_0x26a3af){var _0x941de2=[];for(var _0x350deb=0x0;_0x350deb<_0x26a3af['length'];_0x350deb+=0x1){_0x941de2[_0x01a0('0x3c')](_0x26a3af[_0x350deb][_0x01a0('0x26')](_0x433ff4['body'],{'transaction':_0x1f2606}));}return BPromise[_0x01a0('0x3d')](_0x941de2);});})[_0x01a0('0xe')](function(_0x260ec7){logger['info'](_0x01a0('0x4a'),_0x433ff4);logger[_0x01a0('0x21')](_0x01a0('0x4a'),_0x433ff4,JSON['stringify'](_0x260ec7));_0x32afd3(_0x260ec7);})['catch'](function(_0x3a8cc7){logger[_0x01a0('0x14')](_0x01a0('0x4a'),_0x3a8cc7[_0x01a0('0x16')],_0x433ff4);_0x53ba07(_0x13336a[_0x01a0('0x14')](0x1f4,_0x3a8cc7['message']));});});});};exports[_0x01a0('0x4c')]=function(_0x57ae9a){var _0x140d4a=this;return new Promise(function(_0x1a30c7,_0x2e0f39){db[_0x01a0('0x2f')]['describe']()[_0x01a0('0xe')](function(_0xb4e8bb){return db[_0x01a0('0x18')][_0x01a0('0x33')]({'raw':_0x57ae9a[_0x01a0('0x19')]?_0x57ae9a['options'][_0x01a0('0x1a')]===undefined?!![]:![]:!![],'where':_0x57ae9a[_0x01a0('0x19')]?_0x57ae9a[_0x01a0('0x19')][_0x01a0('0x1b')]||null:null,'attributes':_0x57ae9a[_0x01a0('0x19')]?_0x57ae9a[_0x01a0('0x19')][_0x01a0('0x1c')]||null:null,'limit':_0x57ae9a[_0x01a0('0x19')]?_0x57ae9a[_0x01a0('0x19')][_0x01a0('0x27')]||null:null,'include':_0x57ae9a[_0x01a0('0x19')]?_0x57ae9a[_0x01a0('0x19')][_0x01a0('0x1e')]?_[_0x01a0('0x1d')](_0x57ae9a[_0x01a0('0x19')][_0x01a0('0x1e')],function(_0x4d2f6c){return{'model':db[_0x4d2f6c[_0x01a0('0x1f')]],'as':_0x4d2f6c['as'],'attributes':_0x4d2f6c['as']===_0x01a0('0x36')?_['keys'](_0xb4e8bb):_0x4d2f6c[_0x01a0('0x1c')],'include':_0x4d2f6c['include']?_['map'](_0x4d2f6c['include'],function(_0x284042){return{'model':db[_0x284042['model']],'as':_0x284042['as'],'attributes':_0x284042['attributes'],'include':_0x284042['include']?_['map'](_0x284042['include'],function(_0x4cf7ab){return{'model':db[_0x4cf7ab[_0x01a0('0x1f')]],'as':_0x4cf7ab['as'],'attributes':_0x4cf7ab[_0x01a0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x01a0('0xe')](function(_0x1e30a9){logger[_0x01a0('0xf')]('GetCmHopper',_0x57ae9a);logger[_0x01a0('0x21')](_0x01a0('0x20'),_0x57ae9a,JSON[_0x01a0('0x13')](_0x1e30a9));_0x1a30c7(_0x1e30a9);})['catch'](function(_0x46aca5){logger['error'](_0x01a0('0x20'),_0x46aca5[_0x01a0('0x16')],_0x57ae9a);_0x2e0f39(_0x140d4a[_0x01a0('0x14')](0x1f4,_0x46aca5[_0x01a0('0x16')]));});});});};exports[_0x01a0('0x4d')]=function(_0x61fed2){var _0x54247b=this;return new Promise(function(_0x33c112,_0x432c81){return db['sequelize']['transaction'](function(_0x352bd9){return db['CmHopper'][_0x01a0('0x26')]({'active':![]},{'where':{},'transaction':_0x352bd9})[_0x01a0('0xe')](function(_0x3fac7a){logger[_0x01a0('0xf')](_0x01a0('0x4d'),_0x61fed2);logger['debug'](_0x01a0('0x4d'),_0x61fed2,JSON[_0x01a0('0x13')](_0x3fac7a));_0x33c112(_0x3fac7a);})['catch'](function(_0x154244){logger[_0x01a0('0x14')](_0x01a0('0x4d'),_0x154244['message'],_0x61fed2);_0x432c81(_0x54247b['error'](0x1f4,_0x154244[_0x01a0('0x16')]));});});});};exports[_0x01a0('0x4e')]=function(_0x4304c9){var _0x10c38c=this;var _0x1e5475=_0x4304c9[_0x01a0('0x2a')][_0x01a0('0x1b')][_0x01a0('0x4f')];var _0x1a5742=_0x4304c9[_0x01a0('0x2a')][_0x01a0('0x1b')][_0x01a0('0x50')];return new Promise(function(_0x2de59a,_0x1ca957){return db['CmHopper'][_0x01a0('0x33')]({'where':{'voiceQueueId':_0x1e5475,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db['sequelize']['literal'](_0x01a0('0x51')+_0x1a5742+'\x20MINUTE')}},'include':[{'model':db[_0x01a0('0x2f')],'as':'Contact'},{'model':db['User'],'as':_0x01a0('0x39'),'attributes':['id',_0x01a0('0x52'),_0x01a0('0x3a')]},{'model':db[_0x01a0('0x53')],'as':_0x01a0('0x54')}]})['then'](function(_0x117ca0){return db[_0x01a0('0x31')][_0x01a0('0x32')](function(_0x1c631b){return db[_0x01a0('0x18')][_0x01a0('0x26')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x1e5475,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x01a0('0x31')][_0x01a0('0x55')](_0x01a0('0x51')+_0x1a5742+'\x20MINUTE')}},'transaction':_0x1c631b})[_0x01a0('0xe')](function(_0xaa99a8){_0x2de59a(_0x117ca0);})[_0x01a0('0x17')](function(_0x51dd4a){logger[_0x01a0('0x14')](_0x01a0('0x4e'),_0x51dd4a[_0x01a0('0x16')],_0x4304c9);_0x1ca957(validateExpressRequest);});});})['catch'](function(_0x44a650){logger['error'](_0x01a0('0x4e'),_0x44a650[_0x01a0('0x16')],_0x4304c9);_0x1ca957(_0x10c38c[_0x01a0('0x14')](0x1f4,_0x44a650['message']));});});}; \ No newline at end of file +var _0xace5=['code','message','result','catch','GetCmHopper','findAll','options','raw','where','attributes','limit','include','model','map','ShowCmHopper','find','info','CmHopper','body','CreateCmHopper','UpdateCmHopper','update','active','DestroyCmHopper','GetContactDialer','CmContact','describe','transaction','order','LOCK','UPDATE','keys','User','Agent','name','voicePause','UserId','push','includes','all','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','MoveContactManagedDialer','CountReScheduled','sequelize','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','GetCmHopperPreview','Contact','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','CmList','List','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','twilio/lib/webhooks/webhooks','http','then','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x15ec64,_0x5bbcf4){var _0x371e91=function(_0x251e5b){while(--_0x251e5b){_0x15ec64['push'](_0x15ec64['shift']());}};_0x371e91(++_0x5bbcf4);}(_0xace5,0x1e5));var _0x5ace=function(_0x594415,_0x53ba11){_0x594415=_0x594415-0x0;var _0x471772=_0xace5[_0x594415];return _0x471772;};'use strict';var _=require(_0x5ace('0x0'));var util=require('util');var moment=require(_0x5ace('0x1'));var BPromise=require(_0x5ace('0x2'));var rs=require(_0x5ace('0x3'));var fs=require('fs');var Redis=require(_0x5ace('0x4'));var db=require(_0x5ace('0x5'))['db'];var utils=require(_0x5ace('0x6'));var logger=require('../../config/logger')(_0x5ace('0x7'));var config=require(_0x5ace('0x8'));var jayson=require(_0x5ace('0x9'));const {validateExpressRequest}=require(_0x5ace('0xa'));var client=jayson['client'][_0x5ace('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2db07f,_0xcb479b,_0x5c998a){return new BPromise(function(_0x5b8f26,_0x1a7b77){return client['request'](_0x2db07f,_0x5c998a)[_0x5ace('0xc')](function(_0xd6a7d1){logger['info'](_0x5ace('0xd'),_0xcb479b,_0x5ace('0xe'));logger[_0x5ace('0xf')](_0x5ace('0x10'),_0xcb479b,_0x5ace('0xe'),JSON[_0x5ace('0x11')](_0xd6a7d1));if(_0xd6a7d1[_0x5ace('0x12')]){if(_0xd6a7d1['error'][_0x5ace('0x13')]===0x1f4){logger[_0x5ace('0x12')]('CmHopper,\x20%s,\x20%s',_0xcb479b,_0xd6a7d1[_0x5ace('0x12')][_0x5ace('0x14')]);return _0x1a7b77(_0xd6a7d1[_0x5ace('0x12')][_0x5ace('0x14')]);}logger[_0x5ace('0x12')](_0x5ace('0xd'),_0xcb479b,_0xd6a7d1['error']['message']);return _0x5b8f26(_0xd6a7d1[_0x5ace('0x12')][_0x5ace('0x14')]);}else{logger['info'](_0x5ace('0xd'),_0xcb479b,_0x5ace('0xe'));_0x5b8f26(_0xd6a7d1[_0x5ace('0x15')][_0x5ace('0x14')]);}})[_0x5ace('0x16')](function(_0x3e60a1){logger[_0x5ace('0x12')](_0x5ace('0xd'),_0xcb479b,_0x3e60a1);_0x1a7b77(_0x3e60a1);});});}exports[_0x5ace('0x17')]=function(_0x481ea8){var _0x300cec=this;return new Promise(function(_0x28b470,_0x71fb10){return db['CmHopper'][_0x5ace('0x18')]({'raw':_0x481ea8['options']?_0x481ea8[_0x5ace('0x19')][_0x5ace('0x1a')]===undefined?!![]:![]:!![],'where':_0x481ea8[_0x5ace('0x19')]?_0x481ea8[_0x5ace('0x19')][_0x5ace('0x1b')]||null:null,'attributes':_0x481ea8[_0x5ace('0x19')]?_0x481ea8['options'][_0x5ace('0x1c')]||null:null,'limit':_0x481ea8[_0x5ace('0x19')]?_0x481ea8['options'][_0x5ace('0x1d')]||null:null,'include':_0x481ea8[_0x5ace('0x19')]?_0x481ea8['options'][_0x5ace('0x1e')]?_['map'](_0x481ea8[_0x5ace('0x19')][_0x5ace('0x1e')],function(_0x37d3af){return{'model':db[_0x37d3af[_0x5ace('0x1f')]],'as':_0x37d3af['as'],'attributes':_0x37d3af[_0x5ace('0x1c')],'include':_0x37d3af[_0x5ace('0x1e')]?_[_0x5ace('0x20')](_0x37d3af[_0x5ace('0x1e')],function(_0x723bb8){return{'model':db[_0x723bb8['model']],'as':_0x723bb8['as'],'attributes':_0x723bb8['attributes'],'include':_0x723bb8[_0x5ace('0x1e')]?_[_0x5ace('0x20')](_0x723bb8[_0x5ace('0x1e')],function(_0x539b62){return{'model':db[_0x539b62[_0x5ace('0x1f')]],'as':_0x539b62['as'],'attributes':_0x539b62[_0x5ace('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5ace('0xc')](function(_0x4b97cf){logger['info'](_0x5ace('0x17'),_0x481ea8);logger[_0x5ace('0xf')](_0x5ace('0x17'),_0x481ea8,JSON[_0x5ace('0x11')](_0x4b97cf));_0x28b470(_0x4b97cf);})[_0x5ace('0x16')](function(_0xbdc079){logger['error'](_0x5ace('0x17'),_0xbdc079[_0x5ace('0x14')],_0x481ea8);_0x71fb10(_0x300cec[_0x5ace('0x12')](0x1f4,_0xbdc079[_0x5ace('0x14')]));});});};exports[_0x5ace('0x21')]=function(_0x4fa158){var _0x40d20e=this;return new Promise(function(_0x5982fd,_0x230f62){return db['CmHopper'][_0x5ace('0x22')]({'raw':_0x4fa158[_0x5ace('0x19')]?_0x4fa158['options'][_0x5ace('0x1a')]===undefined?!![]:![]:!![],'where':_0x4fa158[_0x5ace('0x19')]?_0x4fa158[_0x5ace('0x19')][_0x5ace('0x1b')]||null:null,'attributes':_0x4fa158[_0x5ace('0x19')]?_0x4fa158[_0x5ace('0x19')][_0x5ace('0x1c')]||null:null,'include':_0x4fa158[_0x5ace('0x19')]?_0x4fa158['options']['include']?_[_0x5ace('0x20')](_0x4fa158[_0x5ace('0x19')][_0x5ace('0x1e')],function(_0x43ad2d){return{'model':db[_0x43ad2d[_0x5ace('0x1f')]],'as':_0x43ad2d['as'],'attributes':_0x43ad2d[_0x5ace('0x1c')],'include':_0x43ad2d[_0x5ace('0x1e')]?_[_0x5ace('0x20')](_0x43ad2d[_0x5ace('0x1e')],function(_0x352cd8){return{'model':db[_0x352cd8[_0x5ace('0x1f')]],'as':_0x352cd8['as'],'attributes':_0x352cd8['attributes'],'include':_0x352cd8[_0x5ace('0x1e')]?_['map'](_0x352cd8[_0x5ace('0x1e')],function(_0x53fcdd){return{'model':db[_0x53fcdd[_0x5ace('0x1f')]],'as':_0x53fcdd['as'],'attributes':_0x53fcdd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x39394f){logger[_0x5ace('0x23')]('ShowCmHopper',_0x4fa158);logger[_0x5ace('0xf')](_0x5ace('0x21'),_0x4fa158,JSON[_0x5ace('0x11')](_0x39394f));_0x5982fd(_0x39394f);})[_0x5ace('0x16')](function(_0x392f9c){logger['error']('ShowCmHopper',_0x392f9c[_0x5ace('0x14')],_0x4fa158);_0x230f62(_0x40d20e[_0x5ace('0x12')](0x1f4,_0x392f9c['message']));});});};exports['CreateCmHopper']=function(_0x30c116){var _0x194998=this;return new Promise(function(_0x5e0932,_0x2022d4){return db[_0x5ace('0x24')]['create'](_0x30c116[_0x5ace('0x25')],{'raw':_0x30c116[_0x5ace('0x19')]?_0x30c116[_0x5ace('0x19')][_0x5ace('0x1a')]===undefined?!![]:![]:!![]})[_0x5ace('0xc')](function(_0x184d0a){logger['info']('CreateCmHopper',_0x30c116);logger[_0x5ace('0xf')](_0x5ace('0x26'),_0x30c116,JSON['stringify'](_0x184d0a));_0x5e0932(_0x184d0a);})[_0x5ace('0x16')](function(_0xc54ae6){logger['error']('CreateCmHopper',_0xc54ae6['message'],_0x30c116);_0x2022d4(_0x194998[_0x5ace('0x12')](0x1f4,_0xc54ae6[_0x5ace('0x14')]));});});};exports[_0x5ace('0x27')]=function(_0x324ef0){var _0x3cfd9f=this;return new Promise(function(_0x326be3,_0x23df69){return db[_0x5ace('0x24')][_0x5ace('0x28')](_0x324ef0['body'],{'raw':_0x324ef0[_0x5ace('0x19')]?_0x324ef0['options'][_0x5ace('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x324ef0['options']?_0x324ef0[_0x5ace('0x19')][_0x5ace('0x1b')]||null:null,'attributes':_0x324ef0[_0x5ace('0x19')]?_0x324ef0[_0x5ace('0x19')][_0x5ace('0x1c')]||null:null,'limit':_0x324ef0[_0x5ace('0x19')]?_0x324ef0[_0x5ace('0x19')][_0x5ace('0x1d')]||null:null})[_0x5ace('0xc')](function(_0x2694d2){logger[_0x5ace('0x23')](_0x5ace('0x27'),_0x324ef0);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x324ef0[_0x5ace('0x19')][_0x5ace('0x1b')]),_0x324ef0['body'][_0x5ace('0x29')]);logger[_0x5ace('0xf')](_0x5ace('0x27'),_0x324ef0,JSON[_0x5ace('0x11')](_0x2694d2));_0x326be3(_0x2694d2);})['catch'](function(_0x2d2d77){logger['error']('UpdateCmHopper',_0x2d2d77['message'],_0x324ef0);_0x23df69(_0x3cfd9f[_0x5ace('0x12')](0x1f4,_0x2d2d77['message']));});});};exports[_0x5ace('0x2a')]=function(_0x1f4676){var _0x3caf12=this;return new Promise(function(_0x3cc78d,_0x21acd9){return db['CmHopper']['destroy']({'where':_0x1f4676[_0x5ace('0x19')]?_0x1f4676[_0x5ace('0x19')][_0x5ace('0x1b')]||null:null})['then'](function(_0x484b4f){logger[_0x5ace('0x23')](_0x5ace('0x2a'),_0x1f4676);logger[_0x5ace('0xf')](_0x5ace('0x2a'),_0x1f4676,JSON[_0x5ace('0x11')](_0x484b4f));_0x3cc78d(_0x484b4f);})[_0x5ace('0x16')](function(_0x46d39b){logger[_0x5ace('0x12')](_0x5ace('0x2a'),_0x46d39b[_0x5ace('0x14')],_0x1f4676);_0x21acd9(_0x3caf12[_0x5ace('0x12')](0x1f4,_0x46d39b[_0x5ace('0x14')]));});});};exports[_0x5ace('0x2b')]=function(_0x535f75){var _0x11f75a=this;return new Promise(function(_0x3a1a2d,_0x71c431){return db[_0x5ace('0x2c')][_0x5ace('0x2d')]()['then'](function(_0x17adfd){return db['sequelize'][_0x5ace('0x2e')](function(_0x4ad3ff){return db[_0x5ace('0x24')][_0x5ace('0x18')]({'where':_0x535f75[_0x5ace('0x19')]?_0x535f75[_0x5ace('0x19')][_0x5ace('0x1b')]||null:null,'attributes':_0x535f75[_0x5ace('0x19')]?_0x535f75[_0x5ace('0x19')]['attributes']||null:null,'limit':_0x535f75[_0x5ace('0x19')]?_0x535f75['options'][_0x5ace('0x1d')]||null:null,'order':_0x535f75[_0x5ace('0x19')]?_0x535f75[_0x5ace('0x19')][_0x5ace('0x2f')]||null:null,'transaction':_0x4ad3ff,'lock':_0x4ad3ff[_0x5ace('0x30')][_0x5ace('0x31')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_[_0x5ace('0x32')](_0x17adfd)},{'model':db[_0x5ace('0x33')],'as':_0x5ace('0x34'),'attributes':['id',_0x5ace('0x35'),_0x5ace('0x36')]}]})[_0x5ace('0xc')](function(_0x383d84){var _0x3b3726=[];var _0xdfec34=[];for(var _0x1abeb5=0x0;_0x1abeb5<_0x383d84['length'];_0x1abeb5+=0x1){var _0x1b69f9=_0x383d84[_0x1abeb5][_0x5ace('0x37')];if(_0x1b69f9===null){_0x3b3726[_0x5ace('0x38')](_0x383d84[_0x1abeb5]['update'](_0x535f75[_0x5ace('0x25')],{'transaction':_0x4ad3ff}));}else if(!_0xdfec34[_0x5ace('0x39')](_0x1b69f9)){_0xdfec34['push'](_0x1b69f9);_0x3b3726[_0x5ace('0x38')](_0x383d84[_0x1abeb5][_0x5ace('0x28')](_0x535f75[_0x5ace('0x25')],{'transaction':_0x4ad3ff}));}}return BPromise[_0x5ace('0x3a')](_0x3b3726);});})['then'](function(_0x155d02){logger[_0x5ace('0x23')](_0x5ace('0x2b'),_0x535f75);if(_0x155d02[_0x5ace('0x3b')]>0x0){logger['info'](_0x5ace('0x3c'),_0x155d02[0x0][_0x5ace('0x3d')]['id'],_0x155d02[0x0][_0x5ace('0x3d')]['ContactId'],_0x155d02[0x0][_0x5ace('0x3d')][_0x5ace('0x29')]);}logger[_0x5ace('0xf')](_0x5ace('0x2b'),_0x535f75,JSON[_0x5ace('0x11')](_0x155d02));_0x3a1a2d(_0x155d02);})['catch'](function(_0x5ea1e6){logger[_0x5ace('0x12')](_0x5ace('0x2b'),_0x5ea1e6[_0x5ace('0x14')],_0x535f75);_0x71c431(_0x11f75a[_0x5ace('0x12')](0x1f4,_0x5ea1e6[_0x5ace('0x14')]));});});});};exports['MoveContactManagedDialer']=function(_0x5df473){var _0x11cad5=this;return new Promise(function(_0x52eba2,_0xe4293e){return db['sequelize']['transaction'](function(_0x4b9fd2){return db['CmHopperFinal'][_0x5ace('0x3e')](_0x5df473[_0x5ace('0x25')],{'raw':_0x5df473[_0x5ace('0x19')]?_0x5df473['options'][_0x5ace('0x1a')]===undefined?!![]:![]:!![],'transaction':_0x4b9fd2})['then'](function(){logger[_0x5ace('0x23')](_0x5ace('0x3f'),JSON[_0x5ace('0x11')](_0x5df473['options']['where']),_0x5df473[_0x5ace('0x19')][_0x5ace('0x1b')][_0x5ace('0x29')]);return db[_0x5ace('0x24')][_0x5ace('0x40')]({'where':_0x5df473[_0x5ace('0x19')]?_0x5df473[_0x5ace('0x19')]['where']||null:null,'transaction':_0x4b9fd2});});})['then'](function(_0x11cebe){logger[_0x5ace('0x23')](_0x5ace('0x41'),_0x5df473);logger[_0x5ace('0xf')]('MoveContactManagedDialer',_0x5df473,JSON[_0x5ace('0x11')](_0x11cebe));_0x52eba2(_0x11cebe);})[_0x5ace('0x16')](function(_0x2bfc50){logger[_0x5ace('0x12')](_0x5ace('0x41'),_0x2bfc50['message'],_0x5df473);_0xe4293e(_0x11cad5['error'](0x1f4,_0x2bfc50[_0x5ace('0x14')]));});});};exports[_0x5ace('0x42')]=function(_0x1f1856){var _0xd8abd4=this;return new Promise(function(_0x41e35a,_0x360fb1){return db[_0x5ace('0x24')]['findAll']({'raw':_0x1f1856[_0x5ace('0x19')]?_0x1f1856['options'][_0x5ace('0x1a')]===undefined?!![]:![]:!![],'where':_0x1f1856[_0x5ace('0x19')]?_0x1f1856[_0x5ace('0x19')]['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x5ace('0x43')]['fn']('IF',db[_0x5ace('0x43')][_0x5ace('0x44')](_0x5ace('0x45')+util[_0x5ace('0x46')](_0x5ace('0x47'),moment()[_0x5ace('0x46')](_0x5ace('0x48')))+_0x5ace('0x49')))),'contactsRescheduled']]})[_0x5ace('0xc')](function(_0x240fc6){logger['info'](_0x5ace('0x42'),_0x1f1856);logger[_0x5ace('0xf')]('CountReScheduled',_0x1f1856,JSON[_0x5ace('0x11')](_0x240fc6));_0x41e35a(_0x240fc6);})['catch'](function(_0x5377d8){logger[_0x5ace('0x12')]('CountReScheduled',_0x5377d8[_0x5ace('0x14')],_0x1f1856);_0x360fb1(_0xd8abd4[_0x5ace('0x12')](0x1f4,_0x5377d8[_0x5ace('0x14')]));});});};exports[_0x5ace('0x4a')]=function(_0x2f628d){var _0x3a46dc=this;return new Promise(function(_0x326d3e,_0x17c638){return db['CmContact']['describe']()[_0x5ace('0xc')](function(_0x59da57){return db['sequelize'][_0x5ace('0x2e')](function(_0x45d051){return db[_0x5ace('0x24')]['findAll']({'where':_0x2f628d[_0x5ace('0x19')]?_0x2f628d[_0x5ace('0x19')][_0x5ace('0x1b')]||null:null,'attributes':_0x2f628d[_0x5ace('0x19')]?_0x2f628d[_0x5ace('0x19')]['attributes']||null:null,'limit':0x1,'order':_0x2f628d[_0x5ace('0x19')]?_0x2f628d[_0x5ace('0x19')][_0x5ace('0x2f')]||null:null,'group':db[_0x5ace('0x24')]['UserId'],'transaction':_0x45d051,'lock':_0x45d051['LOCK'][_0x5ace('0x31')],'include':_0x2f628d[_0x5ace('0x19')]?_0x2f628d['options'][_0x5ace('0x1e')]?_[_0x5ace('0x20')](_0x2f628d[_0x5ace('0x19')][_0x5ace('0x1e')],function(_0x18e5a1){return{'model':db[_0x18e5a1[_0x5ace('0x1f')]],'as':_0x18e5a1['as'],'attributes':_0x18e5a1[_0x5ace('0x1c')],'include':_0x18e5a1['include']?_[_0x5ace('0x20')](_0x18e5a1[_0x5ace('0x1e')],function(_0x181048){return{'model':db[_0x181048[_0x5ace('0x1f')]],'as':_0x181048['as'],'attributes':_0x181048['attributes'],'include':_0x181048[_0x5ace('0x1e')]?_[_0x5ace('0x20')](_0x181048[_0x5ace('0x1e')],function(_0x2bfe22){return{'model':db[_0x2bfe22['model']],'as':_0x2bfe22['as'],'attributes':_0x2bfe22[_0x5ace('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5ace('0xc')](function(_0x858819){var _0x440e12=[];for(var _0x3225f8=0x0;_0x3225f8<_0x858819[_0x5ace('0x3b')];_0x3225f8+=0x1){_0x440e12['push'](_0x858819[_0x3225f8][_0x5ace('0x28')](_0x2f628d[_0x5ace('0x25')],{'transaction':_0x45d051}));}return BPromise[_0x5ace('0x3a')](_0x440e12);});})[_0x5ace('0xc')](function(_0x2db0eb){logger[_0x5ace('0x23')](_0x5ace('0x4a'),_0x2f628d);logger[_0x5ace('0xf')](_0x5ace('0x4a'),_0x2f628d,JSON[_0x5ace('0x11')](_0x2db0eb));_0x326d3e(_0x2db0eb);})[_0x5ace('0x16')](function(_0x56ab9a){logger[_0x5ace('0x12')](_0x5ace('0x4a'),_0x56ab9a['message'],_0x2f628d);_0x17c638(_0x3a46dc[_0x5ace('0x12')](0x1f4,_0x56ab9a[_0x5ace('0x14')]));});});});};exports[_0x5ace('0x4b')]=function(_0x16118e){var _0x15fd31=this;return new Promise(function(_0x422301,_0x183ba5){db[_0x5ace('0x2c')][_0x5ace('0x2d')]()[_0x5ace('0xc')](function(_0x19c0e8){return db[_0x5ace('0x24')][_0x5ace('0x18')]({'raw':_0x16118e['options']?_0x16118e[_0x5ace('0x19')][_0x5ace('0x1a')]===undefined?!![]:![]:!![],'where':_0x16118e[_0x5ace('0x19')]?_0x16118e['options']['where']||null:null,'attributes':_0x16118e[_0x5ace('0x19')]?_0x16118e[_0x5ace('0x19')][_0x5ace('0x1c')]||null:null,'limit':_0x16118e[_0x5ace('0x19')]?_0x16118e['options'][_0x5ace('0x1d')]||null:null,'include':_0x16118e[_0x5ace('0x19')]?_0x16118e[_0x5ace('0x19')]['include']?_[_0x5ace('0x20')](_0x16118e[_0x5ace('0x19')][_0x5ace('0x1e')],function(_0x28558d){return{'model':db[_0x28558d[_0x5ace('0x1f')]],'as':_0x28558d['as'],'attributes':_0x28558d['as']===_0x5ace('0x4c')?_[_0x5ace('0x32')](_0x19c0e8):_0x28558d[_0x5ace('0x1c')],'include':_0x28558d['include']?_['map'](_0x28558d[_0x5ace('0x1e')],function(_0x3d11a9){return{'model':db[_0x3d11a9[_0x5ace('0x1f')]],'as':_0x3d11a9['as'],'attributes':_0x3d11a9[_0x5ace('0x1c')],'include':_0x3d11a9['include']?_[_0x5ace('0x20')](_0x3d11a9[_0x5ace('0x1e')],function(_0x5c1e9a){return{'model':db[_0x5c1e9a[_0x5ace('0x1f')]],'as':_0x5c1e9a['as'],'attributes':_0x5c1e9a['attributes']};}):[]};}):[]};}):[]:[]})[_0x5ace('0xc')](function(_0x2a2044){logger[_0x5ace('0x23')](_0x5ace('0x17'),_0x16118e);logger[_0x5ace('0xf')](_0x5ace('0x17'),_0x16118e,JSON['stringify'](_0x2a2044));_0x422301(_0x2a2044);})['catch'](function(_0x355443){logger[_0x5ace('0x12')]('GetCmHopper',_0x355443['message'],_0x16118e);_0x183ba5(_0x15fd31['error'](0x1f4,_0x355443['message']));});});});};exports[_0x5ace('0x4d')]=function(_0x1ea97a){var _0x4cb05e=this;return new Promise(function(_0x277d79,_0x110a4c){return db['sequelize'][_0x5ace('0x2e')](function(_0x22e161){return db['CmHopper'][_0x5ace('0x28')]({'active':![]},{'where':{},'transaction':_0x22e161})[_0x5ace('0xc')](function(_0x4e6db2){logger[_0x5ace('0x23')](_0x5ace('0x4d'),_0x1ea97a);logger[_0x5ace('0xf')]('ResetActiveCalls',_0x1ea97a,JSON[_0x5ace('0x11')](_0x4e6db2));_0x277d79(_0x4e6db2);})[_0x5ace('0x16')](function(_0x5d3e6c){logger['error'](_0x5ace('0x4d'),_0x5d3e6c[_0x5ace('0x14')],_0x1ea97a);_0x110a4c(_0x4cb05e[_0x5ace('0x12')](0x1f4,_0x5d3e6c[_0x5ace('0x14')]));});});});};exports[_0x5ace('0x4e')]=function(_0x1f8a89){var _0x64da28=this;var _0x40a066=_0x1f8a89[_0x5ace('0x25')][_0x5ace('0x1b')][_0x5ace('0x4f')];var _0x57ab33=_0x1f8a89[_0x5ace('0x25')][_0x5ace('0x1b')]['interval'];return new Promise(function(_0x242a32,_0x1ec39c){return db['CmHopper'][_0x5ace('0x18')]({'where':{'voiceQueueId':_0x40a066,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x5ace('0x43')]['literal'](_0x5ace('0x50')+_0x57ab33+_0x5ace('0x51'))}},'include':[{'model':db['CmContact'],'as':_0x5ace('0x4c')},{'model':db[_0x5ace('0x33')],'as':_0x5ace('0x34'),'attributes':['id',_0x5ace('0x35'),_0x5ace('0x36')]},{'model':db[_0x5ace('0x52')],'as':_0x5ace('0x53')}]})[_0x5ace('0xc')](function(_0x2e9bab){return db['sequelize']['transaction'](function(_0x28fc72){return db[_0x5ace('0x24')][_0x5ace('0x28')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x40a066,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x5ace('0x43')]['literal'](_0x5ace('0x50')+_0x57ab33+_0x5ace('0x51'))}},'transaction':_0x28fc72})[_0x5ace('0xc')](function(_0x21c68e){_0x242a32(_0x2e9bab);})['catch'](function(_0x52ac32){logger['error'](_0x5ace('0x4e'),_0x52ac32[_0x5ace('0x14')],_0x1f8a89);_0x1ec39c(validateExpressRequest);});});})[_0x5ace('0x16')](function(_0x775101){logger[_0x5ace('0x12')](_0x5ace('0x4e'),_0x775101[_0x5ace('0x14')],_0x1f8a89);_0x1ec39c(_0x64da28[_0x5ace('0x12')](0x1f4,_0x775101['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 35a66d9..7e99d8b 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 _0x4ed9=['./cmHopper.controller','isAuthenticated','index','get','/describe','describe','/opencontacts','getOpenContacts','post','create','/preview','getPreview','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x1230b9,_0xc27ede){var _0x34ebec=function(_0x32f0fc){while(--_0x32f0fc){_0x1230b9['push'](_0x1230b9['shift']());}};_0x34ebec(++_0xc27ede);}(_0x4ed9,0x8f));var _0x94ed=function(_0x112f35,_0x5d0eb6){_0x112f35=_0x112f35-0x0;var _0x1224d9=_0x4ed9[_0x112f35];return _0x1224d9;};'use strict';var multer=require(_0x94ed('0x0'));var util=require(_0x94ed('0x1'));var path=require('path');var timeout=require(_0x94ed('0x2'));var express=require(_0x94ed('0x3'));var router=express['Router']();var fs_extra=require(_0x94ed('0x4'));var auth=require(_0x94ed('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x94ed('0x6'));var controller=require(_0x94ed('0x7'));router['get']('/',auth[_0x94ed('0x8')](),controller[_0x94ed('0x9')]);router[_0x94ed('0xa')](_0x94ed('0xb'),auth['isAuthenticated'](),controller[_0x94ed('0xc')]);router[_0x94ed('0xa')](_0x94ed('0xd'),auth[_0x94ed('0x8')](),controller[_0x94ed('0xe')]);router['get']('/:id',auth[_0x94ed('0x8')](),controller['show']);router[_0x94ed('0xf')]('/',auth['isAuthenticated'](),controller[_0x94ed('0x10')]);router[_0x94ed('0xf')](_0x94ed('0x11'),auth[_0x94ed('0x8')](),controller[_0x94ed('0x12')]);router[_0x94ed('0x13')](_0x94ed('0x14'),auth[_0x94ed('0x8')](),controller[_0x94ed('0x15')]);router[_0x94ed('0x16')](_0x94ed('0x14'),auth[_0x94ed('0x8')](),controller[_0x94ed('0x17')]);module[_0x94ed('0x18')]=router; \ No newline at end of file +var _0x3468=['/preview','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','isAuthenticated','get','/describe','/opencontacts','/:id','show','post','create'];(function(_0xb89c20,_0x427d28){var _0x1df11e=function(_0x367133){while(--_0x367133){_0xb89c20['push'](_0xb89c20['shift']());}};_0x1df11e(++_0x427d28);}(_0x3468,0xb6));var _0x8346=function(_0x4a18f4,_0x17220e){_0x4a18f4=_0x4a18f4-0x0;var _0x383f64=_0x3468[_0x4a18f4];return _0x383f64;};'use strict';var multer=require(_0x8346('0x0'));var util=require(_0x8346('0x1'));var path=require(_0x8346('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8346('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8346('0x4'));var interaction=require(_0x8346('0x5'));var config=require(_0x8346('0x6'));var controller=require(_0x8346('0x7'));router['get']('/',auth[_0x8346('0x8')](),controller['index']);router[_0x8346('0x9')](_0x8346('0xa'),auth[_0x8346('0x8')](),controller['describe']);router['get'](_0x8346('0xb'),auth[_0x8346('0x8')](),controller['getOpenContacts']);router[_0x8346('0x9')](_0x8346('0xc'),auth[_0x8346('0x8')](),controller[_0x8346('0xd')]);router[_0x8346('0xe')]('/',auth[_0x8346('0x8')](),controller[_0x8346('0xf')]);router[_0x8346('0xe')](_0x8346('0x10'),auth[_0x8346('0x8')](),controller['getPreview']);router[_0x8346('0x11')](_0x8346('0xc'),auth[_0x8346('0x8')](),controller[_0x8346('0x12')]);router[_0x8346('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x8346('0x14')]);module[_0x8346('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 51dff21..de386ef 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 _0xcdb1=['contactListQueue','sequelize','exports','STRING','INTEGER'];(function(_0x90382e,_0x5638fe){var _0x1da484=function(_0x19a02c){while(--_0x19a02c){_0x90382e['push'](_0x90382e['shift']());}};_0x1da484(++_0x5638fe);}(_0xcdb1,0x1eb));var _0x1cdb=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xcdb1[_0x3ab51d];return _0x29a04e;};'use strict';var moment=require('moment');var Sequelize=require(_0x1cdb('0x0'));module[_0x1cdb('0x1')]={'phone':{'type':Sequelize[_0x1cdb('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x1cdb('0x3')],'unique':_0x1cdb('0x4')},'ListId':{'type':Sequelize[_0x1cdb('0x3')],'unique':_0x1cdb('0x4')},'VoiceQueueId':{'type':Sequelize[_0x1cdb('0x3')],'unique':_0x1cdb('0x4')}}; \ No newline at end of file +var _0xef2a=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x4f3cb2,_0x31b881){var _0x57f275=function(_0x4c7cca){while(--_0x4c7cca){_0x4f3cb2['push'](_0x4f3cb2['shift']());}};_0x57f275(++_0x31b881);}(_0xef2a,0x1a0));var _0xaef2=function(_0x5e3148,_0x44f5dd){_0x5e3148=_0x5e3148-0x0;var _0x31e5b6=_0xef2a[_0x5e3148];return _0x31e5b6;};'use strict';var moment=require(_0xaef2('0x0'));var Sequelize=require(_0xaef2('0x1'));module[_0xaef2('0x2')]={'phone':{'type':Sequelize[_0xaef2('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xaef2('0x4')],'unique':_0xaef2('0x5')},'ListId':{'type':Sequelize[_0xaef2('0x4')],'unique':_0xaef2('0x5')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xaef2('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 7b9331c..2819608 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 _0xd950=['destroy','error','stack','name','send','index','CmHopperBlack','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','then'];(function(_0x4d26f1,_0x5dd1db){var _0x166c5b=function(_0x44e04f){while(--_0x44e04f){_0x4d26f1['push'](_0x4d26f1['shift']());}};_0x166c5b(++_0x5dd1db);}(_0xd950,0x17f));var _0x0d95=function(_0xff8b69,_0x53e425){_0xff8b69=_0xff8b69-0x0;var _0x5ae319=_0xd950[_0xff8b69];return _0x5ae319;};'use strict';var emlformat=require(_0x0d95('0x0'));var rimraf=require(_0x0d95('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0d95('0x2'));var rp=require(_0x0d95('0x3'));var moment=require(_0x0d95('0x4'));var BPromise=require(_0x0d95('0x5'));var Mustache=require(_0x0d95('0x6'));var util=require(_0x0d95('0x7'));var path=require(_0x0d95('0x8'));var sox=require('sox');var csv=require(_0x0d95('0x9'));var ejs=require(_0x0d95('0xa'));var fs=require('fs');var fs_extra=require(_0x0d95('0xb'));var _=require(_0x0d95('0xc'));var squel=require('squel');var crypto=require(_0x0d95('0xd'));var jsforce=require(_0x0d95('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0d95('0x9'));var querystring=require('querystring');var Papa=require(_0x0d95('0xf'));var Redis=require(_0x0d95('0x10'));var authService=require(_0x0d95('0x11'));var qs=require(_0x0d95('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d95('0x13'));var logger=require(_0x0d95('0x14'))(_0x0d95('0x15'));var utils=require('../../config/utils');var config=require(_0x0d95('0x16'));var licenseUtil=require(_0x0d95('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b65c0,_0x4d716c){_0x4d716c=_0x4d716c||0xcc;return function(_0x5ab0cd){if(_0x5ab0cd){return _0x3b65c0[_0x0d95('0x18')](_0x4d716c);}return _0x3b65c0[_0x0d95('0x19')](_0x4d716c)[_0x0d95('0x1a')]();};}function respondWithResult(_0x2f4c07,_0x5c423a){_0x5c423a=_0x5c423a||0xc8;return function(_0xa97388){if(_0xa97388){return _0x2f4c07[_0x0d95('0x19')](_0x5c423a)[_0x0d95('0x1b')](_0xa97388);}};}function respondWithFilteredResult(_0x216a5e,_0x403318){return function(_0x239941){if(_0x239941){var _0x588d3e=typeof _0x403318['offset']===_0x0d95('0x1c')&&typeof _0x403318[_0x0d95('0x1d')]==='undefined';var _0x49246c=_0x239941[_0x0d95('0x1e')];var _0x501f29=_0x588d3e?0x0:_0x403318[_0x0d95('0x1f')];var _0x371bfc=_0x588d3e?_0x239941[_0x0d95('0x1e')]:_0x403318[_0x0d95('0x1f')]+_0x403318[_0x0d95('0x1d')];var _0x104428;if(_0x371bfc>=_0x49246c){_0x371bfc=_0x49246c;_0x104428=0xc8;}else{_0x104428=0xce;}_0x216a5e[_0x0d95('0x19')](_0x104428);return _0x216a5e[_0x0d95('0x20')]('Content-Range',_0x501f29+'-'+_0x371bfc+'/'+_0x49246c)[_0x0d95('0x1b')](_0x239941);}return null;};}function patchUpdates(_0xdc9501){return function(_0x546b63){try{jsonpatch['apply'](_0x546b63,_0xdc9501,!![]);}catch(_0x28b452){return BPromise[_0x0d95('0x21')](_0x28b452);}return _0x546b63[_0x0d95('0x22')]();};}function saveUpdates(_0x2d2f9e,_0x6c52a2){return function(_0x34d061){if(_0x34d061){return _0x34d061[_0x0d95('0x23')](_0x2d2f9e)[_0x0d95('0x24')](function(_0x23030c){return _0x23030c;});}return null;};}function removeEntity(_0x497a9c,_0x2b21d1){return function(_0x4422ce){if(_0x4422ce){return _0x4422ce[_0x0d95('0x25')]()[_0x0d95('0x24')](function(){_0x497a9c[_0x0d95('0x19')](0xcc)[_0x0d95('0x1a')]();});}};}function handleEntityNotFound(_0x18e577,_0x1d85d9){return function(_0x5cc148){if(!_0x5cc148){_0x18e577[_0x0d95('0x18')](0x194);}return _0x5cc148;};}function handleError(_0x1f27ac,_0x358f71){_0x358f71=_0x358f71||0x1f4;return function(_0x4de6bd){logger[_0x0d95('0x26')](_0x4de6bd[_0x0d95('0x27')]);if(_0x4de6bd[_0x0d95('0x28')]){delete _0x4de6bd[_0x0d95('0x28')];}_0x1f27ac[_0x0d95('0x19')](_0x358f71)[_0x0d95('0x29')](_0x4de6bd);};}exports[_0x0d95('0x2a')]=function(_0x4a2b0f,_0x3a7c78){var _0x2a66f1={},_0x3a9279={},_0xab2f0d={'count':0x0,'rows':[]};var _0x59b3d6=_['map'](db[_0x0d95('0x2b')][_0x0d95('0x2c')],function(_0xf1bcf3){return{'name':_0xf1bcf3[_0x0d95('0x2d')],'type':_0xf1bcf3[_0x0d95('0x2e')]['key']};});_0x3a9279[_0x0d95('0x2f')]=_[_0x0d95('0x30')](_0x59b3d6,_0x0d95('0x28'));_0x3a9279[_0x0d95('0x31')]=_[_0x0d95('0x32')](_0x4a2b0f[_0x0d95('0x31')]);_0x3a9279[_0x0d95('0x33')]=_[_0x0d95('0x34')](_0x3a9279['model'],_0x3a9279['query']);_0x2a66f1['attributes']=_[_0x0d95('0x34')](_0x3a9279['model'],qs[_0x0d95('0x35')](_0x4a2b0f[_0x0d95('0x31')]['fields']));_0x2a66f1[_0x0d95('0x36')]=_0x2a66f1[_0x0d95('0x36')][_0x0d95('0x37')]?_0x2a66f1[_0x0d95('0x36')]:_0x3a9279['model'];if(!_0x4a2b0f[_0x0d95('0x31')]['hasOwnProperty']('nolimit')){_0x2a66f1[_0x0d95('0x1d')]=qs[_0x0d95('0x1d')](_0x4a2b0f[_0x0d95('0x31')]['limit']);_0x2a66f1[_0x0d95('0x1f')]=qs['offset'](_0x4a2b0f['query'][_0x0d95('0x1f')]);}_0x2a66f1['order']=qs[_0x0d95('0x38')](_0x4a2b0f[_0x0d95('0x31')][_0x0d95('0x38')]);_0x2a66f1[_0x0d95('0x39')]=qs[_0x0d95('0x33')](_['pick'](_0x4a2b0f[_0x0d95('0x31')],_0x3a9279[_0x0d95('0x33')]),_0x59b3d6);if(_0x4a2b0f[_0x0d95('0x31')][_0x0d95('0x3a')]){_0x2a66f1[_0x0d95('0x39')]=_['merge'](_0x2a66f1[_0x0d95('0x39')],{'$or':_['map'](_0x59b3d6,function(_0x3da239){if(_0x3da239[_0x0d95('0x2e')]!==_0x0d95('0x3b')){var _0x243b8={};_0x243b8[_0x3da239[_0x0d95('0x28')]]={'$like':'%'+_0x4a2b0f[_0x0d95('0x31')][_0x0d95('0x3a')]+'%'};return _0x243b8;}})});}_0x2a66f1=_[_0x0d95('0x3c')]({},_0x2a66f1,_0x4a2b0f[_0x0d95('0x3d')]);var _0x5e74df={'where':_0x2a66f1[_0x0d95('0x39')]};return db[_0x0d95('0x2b')][_0x0d95('0x1e')](_0x5e74df)[_0x0d95('0x24')](function(_0x3f1ccd){_0xab2f0d['count']=_0x3f1ccd;if(_0x4a2b0f[_0x0d95('0x31')][_0x0d95('0x3e')]){_0x2a66f1[_0x0d95('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x0d95('0x40')](_0x2a66f1);})[_0x0d95('0x24')](function(_0x3e1e9b){_0xab2f0d['rows']=_0x3e1e9b;return _0xab2f0d;})['then'](respondWithFilteredResult(_0x3a7c78,_0x2a66f1))[_0x0d95('0x41')](handleError(_0x3a7c78,null));};exports['show']=function(_0x54dac3,_0xfb9e6a){var _0xeb0806={'raw':!![],'where':{'id':_0x54dac3['params']['id']}},_0x57ec27={};_0x57ec27[_0x0d95('0x2f')]=_[_0x0d95('0x32')](db['CmHopperBlack']['rawAttributes']);_0x57ec27[_0x0d95('0x31')]=_['keys'](_0x54dac3[_0x0d95('0x31')]);_0x57ec27[_0x0d95('0x33')]=_[_0x0d95('0x34')](_0x57ec27['model'],_0x57ec27[_0x0d95('0x31')]);_0xeb0806['attributes']=_[_0x0d95('0x34')](_0x57ec27[_0x0d95('0x2f')],qs[_0x0d95('0x35')](_0x54dac3['query'][_0x0d95('0x35')]));_0xeb0806[_0x0d95('0x36')]=_0xeb0806['attributes'][_0x0d95('0x37')]?_0xeb0806[_0x0d95('0x36')]:_0x57ec27[_0x0d95('0x2f')];if(_0x54dac3[_0x0d95('0x31')][_0x0d95('0x3e')]){_0xeb0806[_0x0d95('0x3f')]=[{'all':!![]}];}_0xeb0806=_[_0x0d95('0x3c')]({},_0xeb0806,_0x54dac3[_0x0d95('0x3d')]);return db[_0x0d95('0x2b')]['find'](_0xeb0806)['then'](handleEntityNotFound(_0xfb9e6a,null))[_0x0d95('0x24')](respondWithResult(_0xfb9e6a,null))[_0x0d95('0x41')](handleError(_0xfb9e6a,null));};exports[_0x0d95('0x23')]=function(_0x52f1cb,_0x25e673){if(_0x52f1cb[_0x0d95('0x42')]['id']){delete _0x52f1cb[_0x0d95('0x42')]['id'];}return db[_0x0d95('0x2b')][_0x0d95('0x43')]({'where':{'id':_0x52f1cb[_0x0d95('0x44')]['id']}})[_0x0d95('0x24')](handleEntityNotFound(_0x25e673,null))[_0x0d95('0x24')](saveUpdates(_0x52f1cb[_0x0d95('0x42')],null))[_0x0d95('0x24')](respondWithResult(_0x25e673,null))[_0x0d95('0x41')](handleError(_0x25e673,null));};exports['destroy']=function(_0x3461e7,_0x7b7a45){return db[_0x0d95('0x2b')]['find']({'where':{'id':_0x3461e7['params']['id']}})[_0x0d95('0x24')](handleEntityNotFound(_0x7b7a45,null))[_0x0d95('0x24')](removeEntity(_0x7b7a45,null))['catch'](handleError(_0x7b7a45,null));};exports[_0x0d95('0x45')]=function(_0x5aafad,_0x3c5140){return db[_0x0d95('0x2b')][_0x0d95('0x45')]()[_0x0d95('0x24')](respondWithResult(_0x3c5140,null))[_0x0d95('0x41')](handleError(_0x3c5140,null));}; \ No newline at end of file +var _0xfba9=['include','findAll','rows','show','params','find','body','catch','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfba9,0x9b));var _0x9fba=function(_0x4715b7,_0x4dedec){_0x4715b7=_0x4715b7-0x0;var _0x11d72a=_0xfba9[_0x4715b7];return _0x11d72a;};'use strict';var emlformat=require(_0x9fba('0x0'));var rimraf=require(_0x9fba('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9fba('0x2'));var rp=require('request-promise');var moment=require(_0x9fba('0x3'));var BPromise=require(_0x9fba('0x4'));var Mustache=require(_0x9fba('0x5'));var util=require('util');var path=require(_0x9fba('0x6'));var sox=require(_0x9fba('0x7'));var csv=require('to-csv');var ejs=require(_0x9fba('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9fba('0x9'));var squel=require(_0x9fba('0xa'));var crypto=require(_0x9fba('0xb'));var jsforce=require(_0x9fba('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9fba('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9fba('0xe'));var qs=require(_0x9fba('0xf'));var as=require(_0x9fba('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9fba('0x11'))(_0x9fba('0x12'));var utils=require(_0x9fba('0x13'));var config=require(_0x9fba('0x14'));var licenseUtil=require(_0x9fba('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x554900,_0x48f72b){_0x48f72b=_0x48f72b||0xcc;return function(_0x13d5fe){if(_0x13d5fe){return _0x554900[_0x9fba('0x16')](_0x48f72b);}return _0x554900[_0x9fba('0x17')](_0x48f72b)['end']();};}function respondWithResult(_0x31c3c8,_0x567d98){_0x567d98=_0x567d98||0xc8;return function(_0x385e35){if(_0x385e35){return _0x31c3c8[_0x9fba('0x17')](_0x567d98)[_0x9fba('0x18')](_0x385e35);}};}function respondWithFilteredResult(_0x1de69d,_0x56507e){return function(_0x3196d2){if(_0x3196d2){var _0x38da4c=typeof _0x56507e[_0x9fba('0x19')]===_0x9fba('0x1a')&&typeof _0x56507e[_0x9fba('0x1b')]===_0x9fba('0x1a');var _0x556715=_0x3196d2[_0x9fba('0x1c')];var _0x547b1e=_0x38da4c?0x0:_0x56507e[_0x9fba('0x19')];var _0x71934f=_0x38da4c?_0x3196d2['count']:_0x56507e[_0x9fba('0x19')]+_0x56507e[_0x9fba('0x1b')];var _0x198b9e;if(_0x71934f>=_0x556715){_0x71934f=_0x556715;_0x198b9e=0xc8;}else{_0x198b9e=0xce;}_0x1de69d['status'](_0x198b9e);return _0x1de69d[_0x9fba('0x1d')]('Content-Range',_0x547b1e+'-'+_0x71934f+'/'+_0x556715)[_0x9fba('0x18')](_0x3196d2);}return null;};}function patchUpdates(_0x5c3b77){return function(_0x1cd1c2){try{jsonpatch[_0x9fba('0x1e')](_0x1cd1c2,_0x5c3b77,!![]);}catch(_0x36a234){return BPromise[_0x9fba('0x1f')](_0x36a234);}return _0x1cd1c2[_0x9fba('0x20')]();};}function saveUpdates(_0x5e90f5,_0x117579){return function(_0x2fe52b){if(_0x2fe52b){return _0x2fe52b[_0x9fba('0x21')](_0x5e90f5)[_0x9fba('0x22')](function(_0x335242){return _0x335242;});}return null;};}function removeEntity(_0x2776f8,_0x5a7acd){return function(_0x4f33e8){if(_0x4f33e8){return _0x4f33e8[_0x9fba('0x23')]()[_0x9fba('0x22')](function(){_0x2776f8[_0x9fba('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe59943,_0x116a49){return function(_0x37ff8b){if(!_0x37ff8b){_0xe59943['sendStatus'](0x194);}return _0x37ff8b;};}function handleError(_0x4e5c55,_0x4a7a6d){_0x4a7a6d=_0x4a7a6d||0x1f4;return function(_0x237033){logger['error'](_0x237033['stack']);if(_0x237033[_0x9fba('0x24')]){delete _0x237033[_0x9fba('0x24')];}_0x4e5c55[_0x9fba('0x17')](_0x4a7a6d)[_0x9fba('0x25')](_0x237033);};}exports[_0x9fba('0x26')]=function(_0x200eea,_0x21fd21){var _0x2eb9dc={},_0x48f96c={},_0x21acc8={'count':0x0,'rows':[]};var _0x55dd6c=_[_0x9fba('0x27')](db[_0x9fba('0x28')][_0x9fba('0x29')],function(_0x5967b3){return{'name':_0x5967b3[_0x9fba('0x2a')],'type':_0x5967b3[_0x9fba('0x2b')][_0x9fba('0x2c')]};});_0x48f96c[_0x9fba('0x2d')]=_['map'](_0x55dd6c,_0x9fba('0x24'));_0x48f96c[_0x9fba('0x2e')]=_[_0x9fba('0x2f')](_0x200eea[_0x9fba('0x2e')]);_0x48f96c[_0x9fba('0x30')]=_[_0x9fba('0x31')](_0x48f96c[_0x9fba('0x2d')],_0x48f96c[_0x9fba('0x2e')]);_0x2eb9dc[_0x9fba('0x32')]=_['intersection'](_0x48f96c[_0x9fba('0x2d')],qs[_0x9fba('0x33')](_0x200eea[_0x9fba('0x2e')]['fields']));_0x2eb9dc[_0x9fba('0x32')]=_0x2eb9dc[_0x9fba('0x32')][_0x9fba('0x34')]?_0x2eb9dc[_0x9fba('0x32')]:_0x48f96c[_0x9fba('0x2d')];if(!_0x200eea[_0x9fba('0x2e')][_0x9fba('0x35')](_0x9fba('0x36'))){_0x2eb9dc[_0x9fba('0x1b')]=qs[_0x9fba('0x1b')](_0x200eea[_0x9fba('0x2e')][_0x9fba('0x1b')]);_0x2eb9dc[_0x9fba('0x19')]=qs[_0x9fba('0x19')](_0x200eea['query'][_0x9fba('0x19')]);}_0x2eb9dc[_0x9fba('0x37')]=qs[_0x9fba('0x38')](_0x200eea[_0x9fba('0x2e')]['sort']);_0x2eb9dc['where']=qs[_0x9fba('0x30')](_[_0x9fba('0x39')](_0x200eea[_0x9fba('0x2e')],_0x48f96c['filters']),_0x55dd6c);if(_0x200eea[_0x9fba('0x2e')][_0x9fba('0x3a')]){_0x2eb9dc[_0x9fba('0x3b')]=_[_0x9fba('0x3c')](_0x2eb9dc['where'],{'$or':_['map'](_0x55dd6c,function(_0x1fb3eb){if(_0x1fb3eb[_0x9fba('0x2b')]!==_0x9fba('0x3d')){var _0x20dd9f={};_0x20dd9f[_0x1fb3eb['name']]={'$like':'%'+_0x200eea[_0x9fba('0x2e')][_0x9fba('0x3a')]+'%'};return _0x20dd9f;}})});}_0x2eb9dc=_['merge']({},_0x2eb9dc,_0x200eea[_0x9fba('0x3e')]);var _0x58c8b5={'where':_0x2eb9dc[_0x9fba('0x3b')]};return db[_0x9fba('0x28')][_0x9fba('0x1c')](_0x58c8b5)[_0x9fba('0x22')](function(_0x21bca9){_0x21acc8[_0x9fba('0x1c')]=_0x21bca9;if(_0x200eea[_0x9fba('0x2e')][_0x9fba('0x3f')]){_0x2eb9dc[_0x9fba('0x40')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x9fba('0x41')](_0x2eb9dc);})['then'](function(_0x5b1906){_0x21acc8[_0x9fba('0x42')]=_0x5b1906;return _0x21acc8;})[_0x9fba('0x22')](respondWithFilteredResult(_0x21fd21,_0x2eb9dc))['catch'](handleError(_0x21fd21,null));};exports[_0x9fba('0x43')]=function(_0x48f7f4,_0x30f1ce){var _0xc7078a={'raw':!![],'where':{'id':_0x48f7f4[_0x9fba('0x44')]['id']}},_0x42377a={};_0x42377a['model']=_[_0x9fba('0x2f')](db[_0x9fba('0x28')]['rawAttributes']);_0x42377a['query']=_[_0x9fba('0x2f')](_0x48f7f4[_0x9fba('0x2e')]);_0x42377a[_0x9fba('0x30')]=_['intersection'](_0x42377a[_0x9fba('0x2d')],_0x42377a['query']);_0xc7078a[_0x9fba('0x32')]=_[_0x9fba('0x31')](_0x42377a['model'],qs[_0x9fba('0x33')](_0x48f7f4['query']['fields']));_0xc7078a[_0x9fba('0x32')]=_0xc7078a[_0x9fba('0x32')][_0x9fba('0x34')]?_0xc7078a[_0x9fba('0x32')]:_0x42377a[_0x9fba('0x2d')];if(_0x48f7f4['query'][_0x9fba('0x3f')]){_0xc7078a[_0x9fba('0x40')]=[{'all':!![]}];}_0xc7078a=_[_0x9fba('0x3c')]({},_0xc7078a,_0x48f7f4[_0x9fba('0x3e')]);return db[_0x9fba('0x28')][_0x9fba('0x45')](_0xc7078a)['then'](handleEntityNotFound(_0x30f1ce,null))[_0x9fba('0x22')](respondWithResult(_0x30f1ce,null))['catch'](handleError(_0x30f1ce,null));};exports[_0x9fba('0x21')]=function(_0x4820d5,_0x2eaea7){if(_0x4820d5['body']['id']){delete _0x4820d5[_0x9fba('0x46')]['id'];}return db[_0x9fba('0x28')]['find']({'where':{'id':_0x4820d5[_0x9fba('0x44')]['id']}})['then'](handleEntityNotFound(_0x2eaea7,null))[_0x9fba('0x22')](saveUpdates(_0x4820d5[_0x9fba('0x46')],null))['then'](respondWithResult(_0x2eaea7,null))[_0x9fba('0x47')](handleError(_0x2eaea7,null));};exports[_0x9fba('0x23')]=function(_0x33257c,_0xc19fdf){return db[_0x9fba('0x28')][_0x9fba('0x45')]({'where':{'id':_0x33257c['params']['id']}})[_0x9fba('0x22')](handleEntityNotFound(_0xc19fdf,null))[_0x9fba('0x22')](removeEntity(_0xc19fdf,null))[_0x9fba('0x47')](handleError(_0xc19fdf,null));};exports['describe']=function(_0x3546a7,_0x454f8a){return db[_0x9fba('0x28')][_0x9fba('0x48')]()[_0x9fba('0x22')](respondWithResult(_0x454f8a,null))['catch'](handleError(_0x454f8a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index ff928bd..63ed852 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 _0xf945=['lodash','../../config/logger','api','moment','bluebird','rimraf','exports','define','CmHopperBlack'];(function(_0x185334,_0x4630ac){var _0xf2e59a=function(_0x3cc497){while(--_0x3cc497){_0x185334['push'](_0x185334['shift']());}};_0xf2e59a(++_0x4630ac);}(_0xf945,0x7e));var _0x5f94=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf945[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x5f94('0x0'));var util=require('util');var logger=require(_0x5f94('0x1'))(_0x5f94('0x2'));var moment=require(_0x5f94('0x3'));var BPromise=require(_0x5f94('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5f94('0x5'));var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module[_0x5f94('0x6')]=function(_0x599e82,_0x53a7ef){return _0x599e82[_0x5f94('0x7')](_0x5f94('0x8'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4e5=['exports','cm_hopper_black','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0x34ddf1,_0x494e77){var _0x264cd6=function(_0x3b1d1a){while(--_0x3b1d1a){_0x34ddf1['push'](_0x34ddf1['shift']());}};_0x264cd6(++_0x494e77);}(_0xe4e5,0x1c4));var _0x5e4e=function(_0x5ad14c,_0x986b8f){_0x5ad14c=_0x5ad14c-0x0;var _0x53f498=_0xe4e5[_0x5ad14c];return _0x53f498;};'use strict';var _=require(_0x5e4e('0x0'));var util=require(_0x5e4e('0x1'));var logger=require(_0x5e4e('0x2'))(_0x5e4e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5e4e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5e4e('0x5'));var config=require(_0x5e4e('0x6'));var attributes=require('./cmHopperBlack.attributes');module[_0x5e4e('0x7')]=function(_0x211329,_0x17a949){return _0x211329['define']('CmHopperBlack',attributes,{'tableName':_0x5e4e('0x8'),'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 f6823ce..d5b6874 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 _0x2dfc=['lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','CmHopperBlack,\x20%s,\x20%s','message','info','result','GetCmHopperBlack','CmHopperBlack','options','raw','attributes','limit','include','map','model','stringify','catch','UpdateCmHopperBlack','body','where','DestroyCmHopperBlack'];(function(_0x36d33e,_0x5c4e6a){var _0x70d74d=function(_0x2989ac){while(--_0x2989ac){_0x36d33e['push'](_0x36d33e['shift']());}};_0x70d74d(++_0x5c4e6a);}(_0x2dfc,0x6c));var _0xc2df=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x2dfc[_0x432682];return _0x463d05;};'use strict';var _=require(_0xc2df('0x0'));var util=require('util');var moment=require(_0xc2df('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc2df('0x2'));var db=require(_0xc2df('0x3'))['db'];var utils=require(_0xc2df('0x4'));var logger=require(_0xc2df('0x5'))(_0xc2df('0x6'));var config=require(_0xc2df('0x7'));var jayson=require(_0xc2df('0x8'));var client=jayson[_0xc2df('0x9')][_0xc2df('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30c858,_0x311892,_0x19dd68){return new BPromise(function(_0x127406,_0x2abaa0){return client[_0xc2df('0xb')](_0x30c858,_0x19dd68)[_0xc2df('0xc')](function(_0x458e26){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x311892,_0xc2df('0xd'));logger[_0xc2df('0xe')](_0xc2df('0xf'),_0x311892,_0xc2df('0xd'),JSON['stringify'](_0x458e26));if(_0x458e26[_0xc2df('0x10')]){if(_0x458e26[_0xc2df('0x10')]['code']===0x1f4){logger[_0xc2df('0x10')](_0xc2df('0x11'),_0x311892,_0x458e26[_0xc2df('0x10')][_0xc2df('0x12')]);return _0x2abaa0(_0x458e26[_0xc2df('0x10')][_0xc2df('0x12')]);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x311892,_0x458e26[_0xc2df('0x10')][_0xc2df('0x12')]);return _0x127406(_0x458e26[_0xc2df('0x10')][_0xc2df('0x12')]);}else{logger[_0xc2df('0x13')](_0xc2df('0x11'),_0x311892,_0xc2df('0xd'));_0x127406(_0x458e26[_0xc2df('0x14')][_0xc2df('0x12')]);}})['catch'](function(_0x1450a5){logger[_0xc2df('0x10')](_0xc2df('0x11'),_0x311892,_0x1450a5);_0x2abaa0(_0x1450a5);});});}exports[_0xc2df('0x15')]=function(_0x5c2cbc){var _0xe8e39c=this;return new Promise(function(_0x3985f1,_0x1cbcb6){return db[_0xc2df('0x16')]['findAll']({'raw':_0x5c2cbc[_0xc2df('0x17')]?_0x5c2cbc[_0xc2df('0x17')][_0xc2df('0x18')]===undefined?!![]:![]:!![],'where':_0x5c2cbc[_0xc2df('0x17')]?_0x5c2cbc[_0xc2df('0x17')]['where']||null:null,'attributes':_0x5c2cbc[_0xc2df('0x17')]?_0x5c2cbc[_0xc2df('0x17')][_0xc2df('0x19')]||null:null,'limit':_0x5c2cbc[_0xc2df('0x17')]?_0x5c2cbc[_0xc2df('0x17')][_0xc2df('0x1a')]||null:null,'include':_0x5c2cbc[_0xc2df('0x17')]?_0x5c2cbc[_0xc2df('0x17')][_0xc2df('0x1b')]?_[_0xc2df('0x1c')](_0x5c2cbc['options'][_0xc2df('0x1b')],function(_0x1e7d98){return{'model':db[_0x1e7d98['model']],'as':_0x1e7d98['as'],'attributes':_0x1e7d98[_0xc2df('0x19')],'include':_0x1e7d98[_0xc2df('0x1b')]?_[_0xc2df('0x1c')](_0x1e7d98['include'],function(_0x29c023){return{'model':db[_0x29c023[_0xc2df('0x1d')]],'as':_0x29c023['as'],'attributes':_0x29c023[_0xc2df('0x19')],'include':_0x29c023[_0xc2df('0x1b')]?_['map'](_0x29c023[_0xc2df('0x1b')],function(_0x3e9a04){return{'model':db[_0x3e9a04[_0xc2df('0x1d')]],'as':_0x3e9a04['as'],'attributes':_0x3e9a04['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a27f0){logger[_0xc2df('0x13')](_0xc2df('0x15'),_0x5c2cbc);logger[_0xc2df('0xe')](_0xc2df('0x15'),_0x5c2cbc,JSON[_0xc2df('0x1e')](_0x5a27f0));_0x3985f1(_0x5a27f0);})[_0xc2df('0x1f')](function(_0x20953c){logger[_0xc2df('0x10')](_0xc2df('0x15'),_0x20953c[_0xc2df('0x12')],_0x5c2cbc);_0x1cbcb6(_0xe8e39c[_0xc2df('0x10')](0x1f4,_0x20953c['message']));});});};exports[_0xc2df('0x20')]=function(_0x1370ca){var _0x5a7053=this;return new Promise(function(_0x48c36b,_0x5a82cd){return db['CmHopperBlack']['update'](_0x1370ca[_0xc2df('0x21')],{'raw':_0x1370ca['options']?_0x1370ca[_0xc2df('0x17')][_0xc2df('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1370ca[_0xc2df('0x17')]?_0x1370ca[_0xc2df('0x17')][_0xc2df('0x22')]||null:null,'attributes':_0x1370ca[_0xc2df('0x17')]?_0x1370ca[_0xc2df('0x17')][_0xc2df('0x19')]||null:null,'limit':_0x1370ca[_0xc2df('0x17')]?_0x1370ca[_0xc2df('0x17')][_0xc2df('0x1a')]||null:null})[_0xc2df('0xc')](function(_0x31cb8f){logger[_0xc2df('0x13')](_0xc2df('0x20'),_0x1370ca);logger[_0xc2df('0xe')](_0xc2df('0x20'),_0x1370ca,JSON['stringify'](_0x31cb8f));_0x48c36b(_0x31cb8f);})['catch'](function(_0x4f0d38){logger[_0xc2df('0x10')]('UpdateCmHopperBlack',_0x4f0d38[_0xc2df('0x12')],_0x1370ca);_0x5a82cd(_0x5a7053['error'](0x1f4,_0x4f0d38[_0xc2df('0x12')]));});});};exports['DestroyCmHopperBlack']=function(_0x2bf0ad){var _0x4ea7d8=this;return new Promise(function(_0x4a85d3,_0x353e94){return db['CmHopperBlack']['destroy']({'where':_0x2bf0ad[_0xc2df('0x17')]?_0x2bf0ad[_0xc2df('0x17')][_0xc2df('0x22')]||null:null})[_0xc2df('0xc')](function(_0x52c034){logger[_0xc2df('0x13')]('DestroyCmHopperBlack',_0x2bf0ad);logger[_0xc2df('0xe')](_0xc2df('0x23'),_0x2bf0ad,JSON[_0xc2df('0x1e')](_0x52c034));_0x4a85d3(_0x52c034);})['catch'](function(_0x3b6606){logger[_0xc2df('0x10')](_0xc2df('0x23'),_0x3b6606['message'],_0x2bf0ad);_0x353e94(_0x4ea7d8['error'](0x1f4,_0x3b6606[_0xc2df('0x12')]));});});}; \ No newline at end of file +var _0xd2df=['include','model','UpdateCmHopperBlack','CmHopperBlack','update','body','raw','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopperBlack','options','where','attributes','limit','map'];(function(_0x1d0184,_0x3fa782){var _0x364129=function(_0x14475f){while(--_0x14475f){_0x1d0184['push'](_0x1d0184['shift']());}};_0x364129(++_0x3fa782);}(_0xd2df,0x18e));var _0xfd2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2df[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfd2d('0x0'));var util=require(_0xfd2d('0x1'));var moment=require(_0xfd2d('0x2'));var BPromise=require(_0xfd2d('0x3'));var rs=require(_0xfd2d('0x4'));var fs=require('fs');var Redis=require(_0xfd2d('0x5'));var db=require(_0xfd2d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfd2d('0x7'))(_0xfd2d('0x8'));var config=require(_0xfd2d('0x9'));var jayson=require(_0xfd2d('0xa'));var client=jayson['client'][_0xfd2d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3702eb,_0x2ac5ad,_0x1d2e07){return new BPromise(function(_0x504ff9,_0x9de6db){return client[_0xfd2d('0xc')](_0x3702eb,_0x1d2e07)[_0xfd2d('0xd')](function(_0x379924){logger[_0xfd2d('0xe')](_0xfd2d('0xf'),_0x2ac5ad,_0xfd2d('0x10'));logger[_0xfd2d('0x11')](_0xfd2d('0x12'),_0x2ac5ad,'request\x20sent',JSON[_0xfd2d('0x13')](_0x379924));if(_0x379924['error']){if(_0x379924[_0xfd2d('0x14')][_0xfd2d('0x15')]===0x1f4){logger['error'](_0xfd2d('0xf'),_0x2ac5ad,_0x379924[_0xfd2d('0x14')][_0xfd2d('0x16')]);return _0x9de6db(_0x379924[_0xfd2d('0x14')]['message']);}logger[_0xfd2d('0x14')](_0xfd2d('0xf'),_0x2ac5ad,_0x379924[_0xfd2d('0x14')][_0xfd2d('0x16')]);return _0x504ff9(_0x379924[_0xfd2d('0x14')][_0xfd2d('0x16')]);}else{logger[_0xfd2d('0xe')](_0xfd2d('0xf'),_0x2ac5ad,'request\x20sent');_0x504ff9(_0x379924[_0xfd2d('0x17')]['message']);}})[_0xfd2d('0x18')](function(_0x59dbae){logger[_0xfd2d('0x14')](_0xfd2d('0xf'),_0x2ac5ad,_0x59dbae);_0x9de6db(_0x59dbae);});});}exports[_0xfd2d('0x19')]=function(_0x2714ad){var _0x235115=this;return new Promise(function(_0x364b58,_0x25e080){return db['CmHopperBlack']['findAll']({'raw':_0x2714ad[_0xfd2d('0x1a')]?_0x2714ad[_0xfd2d('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2714ad['options']?_0x2714ad[_0xfd2d('0x1a')][_0xfd2d('0x1b')]||null:null,'attributes':_0x2714ad[_0xfd2d('0x1a')]?_0x2714ad[_0xfd2d('0x1a')][_0xfd2d('0x1c')]||null:null,'limit':_0x2714ad[_0xfd2d('0x1a')]?_0x2714ad[_0xfd2d('0x1a')][_0xfd2d('0x1d')]||null:null,'include':_0x2714ad['options']?_0x2714ad['options']['include']?_[_0xfd2d('0x1e')](_0x2714ad[_0xfd2d('0x1a')][_0xfd2d('0x1f')],function(_0x5b07d5){return{'model':db[_0x5b07d5[_0xfd2d('0x20')]],'as':_0x5b07d5['as'],'attributes':_0x5b07d5['attributes'],'include':_0x5b07d5['include']?_[_0xfd2d('0x1e')](_0x5b07d5['include'],function(_0x4a28da){return{'model':db[_0x4a28da[_0xfd2d('0x20')]],'as':_0x4a28da['as'],'attributes':_0x4a28da['attributes'],'include':_0x4a28da[_0xfd2d('0x1f')]?_[_0xfd2d('0x1e')](_0x4a28da[_0xfd2d('0x1f')],function(_0x58ef58){return{'model':db[_0x58ef58['model']],'as':_0x58ef58['as'],'attributes':_0x58ef58[_0xfd2d('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c6ae7){logger[_0xfd2d('0xe')](_0xfd2d('0x19'),_0x2714ad);logger[_0xfd2d('0x11')](_0xfd2d('0x19'),_0x2714ad,JSON[_0xfd2d('0x13')](_0x3c6ae7));_0x364b58(_0x3c6ae7);})['catch'](function(_0x22afc0){logger[_0xfd2d('0x14')]('GetCmHopperBlack',_0x22afc0['message'],_0x2714ad);_0x25e080(_0x235115[_0xfd2d('0x14')](0x1f4,_0x22afc0[_0xfd2d('0x16')]));});});};exports[_0xfd2d('0x21')]=function(_0x1e1a82){var _0x3da84d=this;return new Promise(function(_0x2f69b5,_0xb74f00){return db[_0xfd2d('0x22')][_0xfd2d('0x23')](_0x1e1a82[_0xfd2d('0x24')],{'raw':_0x1e1a82[_0xfd2d('0x1a')]?_0x1e1a82[_0xfd2d('0x1a')][_0xfd2d('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e1a82[_0xfd2d('0x1a')]?_0x1e1a82[_0xfd2d('0x1a')][_0xfd2d('0x1b')]||null:null,'attributes':_0x1e1a82['options']?_0x1e1a82[_0xfd2d('0x1a')][_0xfd2d('0x1c')]||null:null,'limit':_0x1e1a82['options']?_0x1e1a82[_0xfd2d('0x1a')][_0xfd2d('0x1d')]||null:null})[_0xfd2d('0xd')](function(_0xfce205){logger['info'](_0xfd2d('0x21'),_0x1e1a82);logger[_0xfd2d('0x11')](_0xfd2d('0x21'),_0x1e1a82,JSON['stringify'](_0xfce205));_0x2f69b5(_0xfce205);})[_0xfd2d('0x18')](function(_0x2aa7b8){logger['error'](_0xfd2d('0x21'),_0x2aa7b8[_0xfd2d('0x16')],_0x1e1a82);_0xb74f00(_0x3da84d[_0xfd2d('0x14')](0x1f4,_0x2aa7b8[_0xfd2d('0x16')]));});});};exports['DestroyCmHopperBlack']=function(_0x599c94){var _0x34c408=this;return new Promise(function(_0x2dca8d,_0x30d731){return db[_0xfd2d('0x22')]['destroy']({'where':_0x599c94['options']?_0x599c94[_0xfd2d('0x1a')][_0xfd2d('0x1b')]||null:null})['then'](function(_0x44a3b8){logger[_0xfd2d('0xe')](_0xfd2d('0x26'),_0x599c94);logger[_0xfd2d('0x11')](_0xfd2d('0x26'),_0x599c94,JSON['stringify'](_0x44a3b8));_0x2dca8d(_0x44a3b8);})['catch'](function(_0x5bb87c){logger[_0xfd2d('0x14')](_0xfd2d('0x26'),_0x5bb87c[_0xfd2d('0x16')],_0x599c94);_0x30d731(_0x34c408[_0xfd2d('0x14')](0x1f4,_0x5bb87c[_0xfd2d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 2c9c217..8a6d466 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 _0x3f8a=['describe','/:id','show','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe'];(function(_0x2a2567,_0x1f0796){var _0x358040=function(_0x1f3ae1){while(--_0x1f3ae1){_0x2a2567['push'](_0x2a2567['shift']());}};_0x358040(++_0x1f0796);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x2e2aa1,_0x47387d){_0x2e2aa1=_0x2e2aa1-0x0;var _0x4ca231=_0x3f8a[_0x2e2aa1];return _0x4ca231;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var fs_extra=require(_0xa3f8('0x5'));var auth=require(_0xa3f8('0x6'));var interaction=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var controller=require(_0xa3f8('0x9'));router[_0xa3f8('0xa')]('/',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xc')]);router[_0xa3f8('0xa')](_0xa3f8('0xd'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xe')]);router[_0xa3f8('0xa')](_0xa3f8('0xf'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x10')]);router['put'](_0xa3f8('0xf'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x11')]);router[_0xa3f8('0x12')]('/:id',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x13')]);module[_0xa3f8('0x14')]=router; \ No newline at end of file +var _0xd101=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','put'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd101,0xc1));var _0x1d10=function(_0x3d9606,_0x276fb5){_0x3d9606=_0x3d9606-0x0;var _0x1f10b7=_0xd101[_0x3d9606];return _0x1f10b7;};'use strict';var multer=require(_0x1d10('0x0'));var util=require('util');var path=require(_0x1d10('0x1'));var timeout=require(_0x1d10('0x2'));var express=require(_0x1d10('0x3'));var router=express[_0x1d10('0x4')]();var fs_extra=require(_0x1d10('0x5'));var auth=require(_0x1d10('0x6'));var interaction=require(_0x1d10('0x7'));var config=require(_0x1d10('0x8'));var controller=require('./cmHopperBlack.controller');router[_0x1d10('0x9')]('/',auth[_0x1d10('0xa')](),controller[_0x1d10('0xb')]);router[_0x1d10('0x9')](_0x1d10('0xc'),auth[_0x1d10('0xa')](),controller[_0x1d10('0xd')]);router[_0x1d10('0x9')](_0x1d10('0xe'),auth[_0x1d10('0xa')](),controller[_0x1d10('0xf')]);router[_0x1d10('0x10')](_0x1d10('0xe'),auth[_0x1d10('0xa')](),controller[_0x1d10('0x11')]);router[_0x1d10('0x12')](_0x1d10('0xe'),auth['isAuthenticated'](),controller[_0x1d10('0x13')]);module[_0x1d10('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 9af443b..9f75fdc 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 _0x1b04=['getDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','moment','exports','INTEGER','DATE','STRING'];(function(_0x5cdd77,_0x40b884){var _0x1a216c=function(_0x52de32){while(--_0x52de32){_0x5cdd77['push'](_0x5cdd77['shift']());}};_0x1a216c(++_0x40b884);}(_0x1b04,0xf8));var _0x41b0=function(_0x37b529,_0x6724e7){_0x37b529=_0x37b529-0x0;var _0x116152=_0x1b04[_0x37b529];return _0x116152;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x41b0('0x0'));module[_0x41b0('0x1')]={'state':{'type':Sequelize[_0x41b0('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x41b0('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x41b0('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x41b0('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x41b0('0x4')]},'originatecalleridname':{'type':Sequelize[_0x41b0('0x4')]},'calleridnum':{'type':Sequelize[_0x41b0('0x4')]},'calleridname':{'type':Sequelize[_0x41b0('0x4')]},'starttime':{'type':Sequelize[_0x41b0('0x3')]},'responsetime':{'type':Sequelize[_0x41b0('0x3')]},'answertime':{'type':Sequelize[_0x41b0('0x3')]},'droptime':{'type':Sequelize[_0x41b0('0x3')]},'endtime':{'type':Sequelize[_0x41b0('0x3')]},'ringtime':{'type':Sequelize[_0x41b0('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x41b0('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x41b0('0x4')]},'membername':{'type':Sequelize[_0x41b0('0x4')]},'reason':{'type':Sequelize[_0x41b0('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x41b0('0x4')]},'dispositionat':{'type':Sequelize[_0x41b0('0x3')],'set':function(_0x5ad0a1){var _0x3befa8=this[_0x41b0('0x5')]('endtime');if(_0x3befa8&&_0x5ad0a1){this['setDataValue'](_0x41b0('0x6'),moment(_0x5ad0a1)[_0x41b0('0x7')](moment(_0x3befa8),_0x41b0('0x8')));}return this['setDataValue'](_0x41b0('0x9'),_0x5ad0a1);}},'amd':{'type':Sequelize[_0x41b0('0xa')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x41b0('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x41b0('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x41b0('0x3')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x41b0('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x41b0('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x41b0('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x41b0('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x41b0('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x41b0('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb640=['exports','STRING','DATE','INTEGER','getDataValue','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','moment'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xb640,0x83));var _0x0b64=function(_0x47ad93,_0x1868ba){_0x47ad93=_0x47ad93-0x0;var _0x3c7cc9=_0xb640[_0x47ad93];return _0x3c7cc9;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0b64('0x0'));module[_0x0b64('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x0b64('0x2')]},'scheduledat':{'type':Sequelize[_0x0b64('0x3')]},'countbusyretry':{'type':Sequelize[_0x0b64('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0b64('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0b64('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0b64('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x0b64('0x2')]},'originatecalleridname':{'type':Sequelize[_0x0b64('0x2')]},'calleridnum':{'type':Sequelize[_0x0b64('0x2')]},'calleridname':{'type':Sequelize[_0x0b64('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x0b64('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x0b64('0x3')]},'endtime':{'type':Sequelize[_0x0b64('0x3')]},'ringtime':{'type':Sequelize[_0x0b64('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0b64('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0b64('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0b64('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0b64('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x0b64('0x2')]},'reason':{'type':Sequelize[_0x0b64('0x2')]},'disposition':{'type':Sequelize[_0x0b64('0x2')]},'secondDisposition':{'type':Sequelize[_0x0b64('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x4be0d6){var _0x116eba=this[_0x0b64('0x5')](_0x0b64('0x6'));if(_0x116eba&&_0x4be0d6){this[_0x0b64('0x7')](_0x0b64('0x8'),moment(_0x4be0d6)[_0x0b64('0x9')](moment(_0x116eba),_0x0b64('0xa')));}return this[_0x0b64('0x7')]('dispositionat',_0x4be0d6);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x0b64('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x0b64('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x0b64('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x0b64('0x3')]},'callback':{'type':Sequelize[_0x0b64('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0b64('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0b64('0x3')]},'deleted':{'type':Sequelize[_0x0b64('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x0b64('0x3')]},'recallme':{'type':Sequelize[_0x0b64('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x0b64('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x0b64('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0b64('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0b64('0x4')],'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/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 1c8fef7..3140427 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 _0x7c09=['sox','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../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','save','update','then','destroy','stack','name','send','index','map','CmHopperFinal','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','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','answeringMachine','countContactsIvrCampaignHopperFinal','noSuchContacts','noAnswerContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','createdAt','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','state\x20=\x204','checkContactHopper','CmHopper','findOne','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path'];(function(_0x4cee82,_0x2d0579){var _0x122741=function(_0x370fcf){while(--_0x370fcf){_0x4cee82['push'](_0x4cee82['shift']());}};_0x122741(++_0x2d0579);}(_0x7c09,0x102));var _0x97c0=function(_0x236b79,_0x237548){_0x236b79=_0x236b79-0x0;var _0x2b39b0=_0x7c09[_0x236b79];return _0x2b39b0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x97c0('0x0'));var zipdir=require(_0x97c0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x97c0('0x2'));var moment=require(_0x97c0('0x3'));var BPromise=require(_0x97c0('0x4'));var Mustache=require(_0x97c0('0x5'));var util=require(_0x97c0('0x6'));var path=require(_0x97c0('0x7'));var sox=require(_0x97c0('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x97c0('0x9'));var squel=require(_0x97c0('0xa'));var crypto=require(_0x97c0('0xb'));var jsforce=require(_0x97c0('0xc'));var deskjs=require(_0x97c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x97c0('0xe'));var Papa=require('papaparse');var Redis=require(_0x97c0('0xf'));var authService=require(_0x97c0('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97c0('0x11'));var logger=require(_0x97c0('0x12'))(_0x97c0('0x13'));var utils=require(_0x97c0('0x14'));var config=require(_0x97c0('0x15'));var licenseUtil=require(_0x97c0('0x16'));var db=require(_0x97c0('0x17'))['db'];function respondWithStatusCode(_0x39a3b4,_0x9ca3c1){_0x9ca3c1=_0x9ca3c1||0xcc;return function(_0x2ecf34){if(_0x2ecf34){return _0x39a3b4[_0x97c0('0x18')](_0x9ca3c1);}return _0x39a3b4[_0x97c0('0x19')](_0x9ca3c1)[_0x97c0('0x1a')]();};}function respondWithResult(_0x514782,_0x3f2fc2){_0x3f2fc2=_0x3f2fc2||0xc8;return function(_0x15b336){if(_0x15b336){return _0x514782[_0x97c0('0x19')](_0x3f2fc2)['json'](_0x15b336);}};}function respondWithFilteredResult(_0x42027d,_0x9ca6a8){return function(_0x379951){if(_0x379951){var _0x21e5f7=typeof _0x9ca6a8[_0x97c0('0x1b')]===_0x97c0('0x1c')&&typeof _0x9ca6a8['limit']===_0x97c0('0x1c');var _0x3ae7c4=_0x379951['count'];var _0x560ac0=_0x21e5f7?0x0:_0x9ca6a8[_0x97c0('0x1b')];var _0x179d43=_0x21e5f7?_0x379951[_0x97c0('0x1d')]:_0x9ca6a8[_0x97c0('0x1b')]+_0x9ca6a8[_0x97c0('0x1e')];var _0x4fed42;if(_0x179d43>=_0x3ae7c4){_0x179d43=_0x3ae7c4;_0x4fed42=0xc8;}else{_0x4fed42=0xce;}_0x42027d[_0x97c0('0x19')](_0x4fed42);return _0x42027d[_0x97c0('0x1f')](_0x97c0('0x20'),_0x560ac0+'-'+_0x179d43+'/'+_0x3ae7c4)['json'](_0x379951);}return null;};}function patchUpdates(_0x554122){return function(_0x2b74a2){try{jsonpatch[_0x97c0('0x21')](_0x2b74a2,_0x554122,!![]);}catch(_0x169f19){return BPromise['reject'](_0x169f19);}return _0x2b74a2[_0x97c0('0x22')]();};}function saveUpdates(_0x20bc4c,_0x31ffb7){return function(_0x272314){if(_0x272314){return _0x272314[_0x97c0('0x23')](_0x20bc4c)[_0x97c0('0x24')](function(_0x9dff60){return _0x9dff60;});}return null;};}function removeEntity(_0x5ac457,_0x60ab00){return function(_0x29b3aa){if(_0x29b3aa){return _0x29b3aa[_0x97c0('0x25')]()[_0x97c0('0x24')](function(){_0x5ac457['status'](0xcc)[_0x97c0('0x1a')]();});}};}function handleEntityNotFound(_0x14cada,_0x52a429){return function(_0x2ec9d6){if(!_0x2ec9d6){_0x14cada[_0x97c0('0x18')](0x194);}return _0x2ec9d6;};}function handleError(_0x447316,_0x4af5a5){_0x4af5a5=_0x4af5a5||0x1f4;return function(_0x4f11ba){logger['error'](_0x4f11ba[_0x97c0('0x26')]);if(_0x4f11ba[_0x97c0('0x27')]){delete _0x4f11ba[_0x97c0('0x27')];}_0x447316[_0x97c0('0x19')](_0x4af5a5)[_0x97c0('0x28')](_0x4f11ba);};}exports[_0x97c0('0x29')]=function(_0x4a3645,_0x10e47e){var _0x1c183f={},_0x325090={},_0x4ad645={'count':0x0,'rows':[]};var _0x14617c=_[_0x97c0('0x2a')](db[_0x97c0('0x2b')][_0x97c0('0x2c')],function(_0x2a7b2b){return{'name':_0x2a7b2b['fieldName'],'type':_0x2a7b2b['type'][_0x97c0('0x2d')]};});_0x325090[_0x97c0('0x2e')]=_[_0x97c0('0x2a')](_0x14617c,'name');_0x325090[_0x97c0('0x2f')]=_[_0x97c0('0x30')](_0x4a3645['query']);_0x325090[_0x97c0('0x31')]=_[_0x97c0('0x32')](_0x325090[_0x97c0('0x2e')],_0x325090[_0x97c0('0x2f')]);_0x1c183f[_0x97c0('0x33')]=_[_0x97c0('0x32')](_0x325090[_0x97c0('0x2e')],qs[_0x97c0('0x34')](_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x34')]));_0x1c183f[_0x97c0('0x33')]=_0x1c183f[_0x97c0('0x33')][_0x97c0('0x35')]?_0x1c183f[_0x97c0('0x33')]:_0x325090[_0x97c0('0x2e')];if(!_0x4a3645['query'][_0x97c0('0x36')](_0x97c0('0x37'))){_0x1c183f[_0x97c0('0x1e')]=qs[_0x97c0('0x1e')](_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x1e')]);_0x1c183f[_0x97c0('0x1b')]=qs[_0x97c0('0x1b')](_0x4a3645['query'][_0x97c0('0x1b')]);}_0x1c183f['order']=qs[_0x97c0('0x38')](_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x38')]);_0x1c183f[_0x97c0('0x39')]=qs[_0x97c0('0x31')](_[_0x97c0('0x3a')](_0x4a3645[_0x97c0('0x2f')],_0x325090[_0x97c0('0x31')]),_0x14617c);if(_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x3b')]){_0x1c183f[_0x97c0('0x39')]=_['merge'](_0x1c183f[_0x97c0('0x39')],{'$or':_[_0x97c0('0x2a')](_0x14617c,function(_0x4d47b1){if(_0x4d47b1[_0x97c0('0x3c')]!==_0x97c0('0x3d')){var _0x2aeffc={};_0x2aeffc[_0x4d47b1[_0x97c0('0x27')]]={'$like':'%'+_0x4a3645['query'][_0x97c0('0x3b')]+'%'};return _0x2aeffc;}})});}_0x1c183f=_['merge']({},_0x1c183f,_0x4a3645[_0x97c0('0x3e')]);var _0x64cfcd={'where':_0x1c183f['where']};return db[_0x97c0('0x2b')][_0x97c0('0x1d')](_0x64cfcd)[_0x97c0('0x24')](function(_0xb13649){_0x4ad645[_0x97c0('0x1d')]=_0xb13649;if(_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x3f')]){_0x1c183f[_0x97c0('0x40')]=[{'all':!![]}];}return db[_0x97c0('0x2b')][_0x97c0('0x41')](_0x1c183f);})[_0x97c0('0x24')](function(_0x2cca4c){_0x4ad645[_0x97c0('0x42')]=_0x2cca4c;return _0x4ad645;})['then'](respondWithFilteredResult(_0x10e47e,_0x1c183f))[_0x97c0('0x43')](handleError(_0x10e47e,null));};exports[_0x97c0('0x44')]=function(_0x1dc6ff,_0x142421){var _0x312fce={'raw':!![],'where':{'id':_0x1dc6ff[_0x97c0('0x45')]['id']}},_0x375ebc={};_0x375ebc['model']=_['keys'](db[_0x97c0('0x2b')][_0x97c0('0x2c')]);_0x375ebc[_0x97c0('0x2f')]=_[_0x97c0('0x30')](_0x1dc6ff[_0x97c0('0x2f')]);_0x375ebc['filters']=_['intersection'](_0x375ebc['model'],_0x375ebc[_0x97c0('0x2f')]);_0x312fce['attributes']=_['intersection'](_0x375ebc[_0x97c0('0x2e')],qs[_0x97c0('0x34')](_0x1dc6ff[_0x97c0('0x2f')][_0x97c0('0x34')]));_0x312fce[_0x97c0('0x33')]=_0x312fce['attributes'][_0x97c0('0x35')]?_0x312fce[_0x97c0('0x33')]:_0x375ebc[_0x97c0('0x2e')];if(_0x1dc6ff[_0x97c0('0x2f')][_0x97c0('0x3f')]){_0x312fce[_0x97c0('0x40')]=[{'all':!![]}];}_0x312fce=_[_0x97c0('0x46')]({},_0x312fce,_0x1dc6ff[_0x97c0('0x3e')]);return db[_0x97c0('0x2b')][_0x97c0('0x47')](_0x312fce)['then'](handleEntityNotFound(_0x142421,null))[_0x97c0('0x24')](respondWithResult(_0x142421,null))[_0x97c0('0x43')](handleError(_0x142421,null));};exports[_0x97c0('0x48')]=function(_0x276c98,_0x4ff0a5){return db['CmHopperFinal'][_0x97c0('0x48')]()[_0x97c0('0x24')](respondWithResult(_0x4ff0a5,null))[_0x97c0('0x43')](handleError(_0x4ff0a5,null));};exports['update']=function(_0x3e09d5,_0xac56ac){if(_0x3e09d5[_0x97c0('0x49')][_0x97c0('0x4a')]){delete _0x3e09d5[_0x97c0('0x49')]['uniqueid'];}return db[_0x97c0('0x2b')][_0x97c0('0x47')]({'where':{'uniqueid':_0x3e09d5[_0x97c0('0x45')]['id']}})['then'](handleEntityNotFound(_0xac56ac,null))['then'](saveUpdates(_0x3e09d5[_0x97c0('0x49')],null))['then'](respondWithResult(_0xac56ac,null))['catch'](handleError(_0xac56ac,null));};exports[_0x97c0('0x4b')]=function(_0x20e2a5,_0x23c7ad,_0x53a255){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x20e2a5[_0x97c0('0x45')]['id']},'attributes':[[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x4f')))),'noSuchContacts'],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x50')))),'noAnswerContacts'],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db['sequelize']['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x51')))),_0x97c0('0x52')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x53')))),_0x97c0('0x54')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x55')))),_0x97c0('0x56')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x57')))),_0x97c0('0x58')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x59')))),'reCallContacts'],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x97c0('0x5a')]]})[_0x97c0('0x24')](handleEntityNotFound(_0x23c7ad,null))[_0x97c0('0x24')](respondWithResult(_0x23c7ad,null))[_0x97c0('0x43')](handleError(_0x23c7ad,null));};exports[_0x97c0('0x5b')]=function(_0x2bb5d3,_0x52643e,_0x3349df){return db[_0x97c0('0x2b')][_0x97c0('0x41')]({'raw':![],'where':{'CampaignId':_0x2bb5d3[_0x97c0('0x45')]['id']},'attributes':[[db['sequelize']['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')]('`state`\x20=\x200,\x201,\x20null'))),_0x97c0('0x5c')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x50')))),_0x97c0('0x5d')],[db['sequelize']['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x51')))),_0x97c0('0x52')],[db[_0x97c0('0x4c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')]('`state`\x20=\x208,\x201,\x20null'))),_0x97c0('0x54')],[db['sequelize']['fn']('COUNT',db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x55')))),'dropContacts'],[db['sequelize']['fn']('COUNT',db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x57')))),_0x97c0('0x58')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x59')))),_0x97c0('0x5e')],[db[_0x97c0('0x4c')]['fn']('COUNT',db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x5f')))),_0x97c0('0x5a')]]})['then'](handleEntityNotFound(_0x52643e,null))[_0x97c0('0x24')](respondWithResult(_0x52643e,null))[_0x97c0('0x43')](handleError(_0x52643e,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x4116c9,_0x30ffa8,_0x1cfe22){return db['VoiceQueue'][_0x97c0('0x47')]({'where':{'id':_0x4116c9[_0x97c0('0x45')]['id']}})[_0x97c0('0x24')](handleEntityNotFound(_0x30ffa8,null))[_0x97c0('0x24')](function(_0x4d40cd){var _0x4ee6a2;if(_0x4d40cd){_0x4ee6a2=squel['insert']()[_0x97c0('0x60')](_0x97c0('0x61'))[_0x97c0('0x62')]([_0x97c0('0x63'),_0x97c0('0x64'),_0x97c0('0x65'),_0x97c0('0x66'),_0x97c0('0x67'),'createdAt','updatedAt'],squel[_0x97c0('0x68')]()['field']('ANY_VALUE(calleridnum)','phone')[_0x97c0('0x69')](_0x97c0('0x6a'),_0x97c0('0x64'))[_0x97c0('0x69')](_0x97c0('0x6b'),'ContactId')['field'](_0x97c0('0x6c'),_0x97c0('0x66'))[_0x97c0('0x69')](_0x97c0('0x6d'),'VoiceQueueId')[_0x97c0('0x69')]('NOW()',_0x97c0('0x6e'))[_0x97c0('0x69')](_0x97c0('0x6a'),_0x97c0('0x6f'))[_0x97c0('0x70')](_0x97c0('0x71'))[_0x97c0('0x39')](_0x97c0('0x72'),_0x4116c9[_0x97c0('0x45')]['id'][_0x97c0('0x73')]())['where'](_0x97c0('0x74'),_0x4116c9['body']['state'][_0x97c0('0x73')]())[_0x97c0('0x39')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x97c0('0x39')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x97c0('0x68')]()[_0x97c0('0x69')]('phone')[_0x97c0('0x70')]('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0x4116c9[_0x97c0('0x45')]['id'][_0x97c0('0x73')]()))['where'](_0x97c0('0x75'),squel[_0x97c0('0x68')]()[_0x97c0('0x69')](_0x97c0('0x76'))[_0x97c0('0x70')](_0x97c0('0x71'))[_0x97c0('0x39')](_0x97c0('0x72'),_0x4116c9['params']['id'][_0x97c0('0x73')]())['where']('state\x20=\x204'))[_0x97c0('0x77')]('ContactId'))[_0x97c0('0x73')]();return db[_0x97c0('0x4c')]['query'](_0x4ee6a2);}return[];})[_0x97c0('0x24')](respondWithResult(_0x30ffa8,null))[_0x97c0('0x43')](handleError(_0x30ffa8,null));};exports[_0x97c0('0x78')]=function(_0x5bb9de,_0x388ba1,_0x550a68){return db[_0x97c0('0x79')][_0x97c0('0x47')]({'where':{'id':_0x5bb9de[_0x97c0('0x45')]['id']}})['then'](handleEntityNotFound(_0x388ba1,null))[_0x97c0('0x24')](function(_0x44f6bc){var _0x37cdb3;if(_0x44f6bc){_0x37cdb3=squel[_0x97c0('0x7a')]()['into'](_0x97c0('0x61'))[_0x97c0('0x62')]([_0x97c0('0x63'),_0x97c0('0x64'),_0x97c0('0x65'),'ListId',_0x97c0('0x7b'),_0x97c0('0x6e'),'updatedAt'],squel['select']()[_0x97c0('0x69')](_0x97c0('0x7c'),_0x97c0('0x63'))['field']('NOW()',_0x97c0('0x64'))['field'](_0x97c0('0x6b'),_0x97c0('0x65'))[_0x97c0('0x69')](_0x97c0('0x6c'),_0x97c0('0x66'))[_0x97c0('0x69')](_0x97c0('0x7d'),'CampaignId')[_0x97c0('0x69')](_0x97c0('0x6a'),_0x97c0('0x6e'))[_0x97c0('0x69')](_0x97c0('0x6a'),_0x97c0('0x6f'))[_0x97c0('0x70')](_0x97c0('0x71'))[_0x97c0('0x39')](_0x97c0('0x7e'),_0x5bb9de[_0x97c0('0x45')]['id'][_0x97c0('0x73')]())[_0x97c0('0x39')](_0x97c0('0x74'),_0x5bb9de['body'][_0x97c0('0x7f')][_0x97c0('0x73')]())[_0x97c0('0x39')](_0x97c0('0x80'))['where'](_0x97c0('0x75'),squel[_0x97c0('0x68')]()[_0x97c0('0x69')](_0x97c0('0x63'))[_0x97c0('0x70')](_0x97c0('0x61'))[_0x97c0('0x39')]('CampaignId\x20=\x20?',_0x5bb9de[_0x97c0('0x45')]['id']['toString']()))[_0x97c0('0x39')](_0x97c0('0x75'),squel[_0x97c0('0x68')]()['field'](_0x97c0('0x76'))[_0x97c0('0x70')](_0x97c0('0x71'))[_0x97c0('0x39')](_0x97c0('0x7e'),_0x5bb9de['params']['id'][_0x97c0('0x73')]())['where'](_0x97c0('0x81')))[_0x97c0('0x77')]('ContactId'))[_0x97c0('0x73')]();return db[_0x97c0('0x4c')][_0x97c0('0x2f')](_0x37cdb3);}return[];})[_0x97c0('0x24')](respondWithResult(_0x388ba1,null))[_0x97c0('0x43')](handleError(_0x388ba1,null));};exports[_0x97c0('0x82')]=function(_0x3ebd11,_0x44b374,_0x493e62){return db[_0x97c0('0x83')][_0x97c0('0x84')]({'where':{'VoiceQueueId':_0x3ebd11[_0x97c0('0x49')]['VoiceQueueId'],'CampaignId':_0x3ebd11['body'][_0x97c0('0x7b')],'ContactId':_0x3ebd11[_0x97c0('0x49')][_0x97c0('0x65')]}})[_0x97c0('0x24')](handleEntityNotFound(_0x44b374,null))[_0x97c0('0x24')](function(_0x120d78){if(_0x120d78){return _0x120d78;}return null;})[_0x97c0('0x24')](respondWithResult(_0x44b374,null))[_0x97c0('0x43')](handleError(_0x44b374,null));}; \ No newline at end of file +var _0x5d17=['ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','state\x20=\x204','moveContactsIvrCampaignHopperFinal','into','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','group','checkContactHopper','findOne','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../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','then','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','model','map','query','intersection','attributes','fields','length','nolimit','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','describe','update','body','uniqueid','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','literal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','countContactsIvrCampaignHopperFinal','congestionContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()'];(function(_0x1aed80,_0x3ca6f6){var _0x43961e=function(_0x43bf2b){while(--_0x43bf2b){_0x1aed80['push'](_0x1aed80['shift']());}};_0x43961e(++_0x3ca6f6);}(_0x5d17,0x114));var _0x75d1=function(_0xed6f46,_0x1c9006){_0xed6f46=_0xed6f46-0x0;var _0x5b267c=_0x5d17[_0xed6f46];return _0x5b267c;};'use strict';var emlformat=require(_0x75d1('0x0'));var rimraf=require(_0x75d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x75d1('0x2'));var moment=require(_0x75d1('0x3'));var BPromise=require(_0x75d1('0x4'));var Mustache=require('mustache');var util=require(_0x75d1('0x5'));var path=require(_0x75d1('0x6'));var sox=require(_0x75d1('0x7'));var csv=require(_0x75d1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75d1('0x9'));var _=require(_0x75d1('0xa'));var squel=require(_0x75d1('0xb'));var crypto=require(_0x75d1('0xc'));var jsforce=require(_0x75d1('0xd'));var deskjs=require(_0x75d1('0xe'));var toCsv=require(_0x75d1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x75d1('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x75d1('0x10'));var hardwareService=require(_0x75d1('0x11'));var logger=require('../../config/logger')(_0x75d1('0x12'));var utils=require(_0x75d1('0x13'));var config=require(_0x75d1('0x14'));var licenseUtil=require(_0x75d1('0x15'));var db=require(_0x75d1('0x16'))['db'];function respondWithStatusCode(_0xd089cf,_0x49667a){_0x49667a=_0x49667a||0xcc;return function(_0x19e825){if(_0x19e825){return _0xd089cf[_0x75d1('0x17')](_0x49667a);}return _0xd089cf[_0x75d1('0x18')](_0x49667a)[_0x75d1('0x19')]();};}function respondWithResult(_0x49d723,_0x553697){_0x553697=_0x553697||0xc8;return function(_0x55b8a0){if(_0x55b8a0){return _0x49d723[_0x75d1('0x18')](_0x553697)[_0x75d1('0x1a')](_0x55b8a0);}};}function respondWithFilteredResult(_0x2fd022,_0x52e649){return function(_0x1f9620){if(_0x1f9620){var _0x3fff9b=typeof _0x52e649[_0x75d1('0x1b')]===_0x75d1('0x1c')&&typeof _0x52e649[_0x75d1('0x1d')]===_0x75d1('0x1c');var _0x2845bc=_0x1f9620[_0x75d1('0x1e')];var _0x1bc5de=_0x3fff9b?0x0:_0x52e649[_0x75d1('0x1b')];var _0x2c2a6d=_0x3fff9b?_0x1f9620['count']:_0x52e649['offset']+_0x52e649[_0x75d1('0x1d')];var _0x42b7ac;if(_0x2c2a6d>=_0x2845bc){_0x2c2a6d=_0x2845bc;_0x42b7ac=0xc8;}else{_0x42b7ac=0xce;}_0x2fd022['status'](_0x42b7ac);return _0x2fd022[_0x75d1('0x1f')](_0x75d1('0x20'),_0x1bc5de+'-'+_0x2c2a6d+'/'+_0x2845bc)[_0x75d1('0x1a')](_0x1f9620);}return null;};}function patchUpdates(_0xf6cc70){return function(_0xa42dbe){try{jsonpatch[_0x75d1('0x21')](_0xa42dbe,_0xf6cc70,!![]);}catch(_0x51d3b0){return BPromise[_0x75d1('0x22')](_0x51d3b0);}return _0xa42dbe[_0x75d1('0x23')]();};}function saveUpdates(_0x501cc7,_0x1cb58c){return function(_0x641ea4){if(_0x641ea4){return _0x641ea4['update'](_0x501cc7)[_0x75d1('0x24')](function(_0x5e70ec){return _0x5e70ec;});}return null;};}function removeEntity(_0x3a85c0,_0xc256af){return function(_0x345cf5){if(_0x345cf5){return _0x345cf5['destroy']()['then'](function(){_0x3a85c0[_0x75d1('0x18')](0xcc)[_0x75d1('0x19')]();});}};}function handleEntityNotFound(_0x315ce5,_0x18184b){return function(_0x51d043){if(!_0x51d043){_0x315ce5[_0x75d1('0x17')](0x194);}return _0x51d043;};}function handleError(_0x2b5848,_0x367238){_0x367238=_0x367238||0x1f4;return function(_0x51138e){logger['error'](_0x51138e['stack']);if(_0x51138e[_0x75d1('0x25')]){delete _0x51138e[_0x75d1('0x25')];}_0x2b5848[_0x75d1('0x18')](_0x367238)[_0x75d1('0x26')](_0x51138e);};}exports[_0x75d1('0x27')]=function(_0x519ceb,_0x4d292e){var _0x410e16={},_0x197f52={},_0x4967b5={'count':0x0,'rows':[]};var _0x2408b6=_['map'](db[_0x75d1('0x28')][_0x75d1('0x29')],function(_0x91e7c9){return{'name':_0x91e7c9[_0x75d1('0x2a')],'type':_0x91e7c9[_0x75d1('0x2b')]['key']};});_0x197f52[_0x75d1('0x2c')]=_[_0x75d1('0x2d')](_0x2408b6,_0x75d1('0x25'));_0x197f52[_0x75d1('0x2e')]=_['keys'](_0x519ceb[_0x75d1('0x2e')]);_0x197f52['filters']=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],_0x197f52['query']);_0x410e16[_0x75d1('0x30')]=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x519ceb[_0x75d1('0x2e')]['fields']));_0x410e16[_0x75d1('0x30')]=_0x410e16[_0x75d1('0x30')][_0x75d1('0x32')]?_0x410e16[_0x75d1('0x30')]:_0x197f52['model'];if(!_0x519ceb['query']['hasOwnProperty'](_0x75d1('0x33'))){_0x410e16[_0x75d1('0x1d')]=qs[_0x75d1('0x1d')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1d')]);_0x410e16[_0x75d1('0x1b')]=qs[_0x75d1('0x1b')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1b')]);}_0x410e16['order']=qs[_0x75d1('0x34')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x34')]);_0x410e16[_0x75d1('0x35')]=qs[_0x75d1('0x36')](_['pick'](_0x519ceb['query'],_0x197f52['filters']),_0x2408b6);if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x37')]){_0x410e16[_0x75d1('0x35')]=_[_0x75d1('0x38')](_0x410e16[_0x75d1('0x35')],{'$or':_[_0x75d1('0x2d')](_0x2408b6,function(_0x48f9f3){if(_0x48f9f3['type']!=='VIRTUAL'){var _0x3f2569={};_0x3f2569[_0x48f9f3['name']]={'$like':'%'+_0x519ceb['query'][_0x75d1('0x37')]+'%'};return _0x3f2569;}})});}_0x410e16=_[_0x75d1('0x38')]({},_0x410e16,_0x519ceb[_0x75d1('0x39')]);var _0x46854c={'where':_0x410e16['where']};return db[_0x75d1('0x28')][_0x75d1('0x1e')](_0x46854c)[_0x75d1('0x24')](function(_0x3d4137){_0x4967b5[_0x75d1('0x1e')]=_0x3d4137;if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x410e16[_0x75d1('0x3b')]=[{'all':!![]}];}return db[_0x75d1('0x28')][_0x75d1('0x3c')](_0x410e16);})[_0x75d1('0x24')](function(_0x93922f){_0x4967b5[_0x75d1('0x3d')]=_0x93922f;return _0x4967b5;})[_0x75d1('0x24')](respondWithFilteredResult(_0x4d292e,_0x410e16))[_0x75d1('0x3e')](handleError(_0x4d292e,null));};exports[_0x75d1('0x3f')]=function(_0x25f689,_0x2ad3ef){var _0x42c18c={'raw':!![],'where':{'id':_0x25f689[_0x75d1('0x40')]['id']}},_0x2384aa={};_0x2384aa[_0x75d1('0x2c')]=_['keys'](db['CmHopperFinal'][_0x75d1('0x29')]);_0x2384aa[_0x75d1('0x2e')]=_[_0x75d1('0x41')](_0x25f689[_0x75d1('0x2e')]);_0x2384aa['filters']=_[_0x75d1('0x2f')](_0x2384aa[_0x75d1('0x2c')],_0x2384aa[_0x75d1('0x2e')]);_0x42c18c[_0x75d1('0x30')]=_['intersection'](_0x2384aa[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x25f689[_0x75d1('0x2e')][_0x75d1('0x31')]));_0x42c18c['attributes']=_0x42c18c[_0x75d1('0x30')]['length']?_0x42c18c[_0x75d1('0x30')]:_0x2384aa[_0x75d1('0x2c')];if(_0x25f689[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x42c18c[_0x75d1('0x3b')]=[{'all':!![]}];}_0x42c18c=_[_0x75d1('0x38')]({},_0x42c18c,_0x25f689['options']);return db[_0x75d1('0x28')]['find'](_0x42c18c)['then'](handleEntityNotFound(_0x2ad3ef,null))[_0x75d1('0x24')](respondWithResult(_0x2ad3ef,null))[_0x75d1('0x3e')](handleError(_0x2ad3ef,null));};exports[_0x75d1('0x42')]=function(_0x12bd67,_0x16f744){return db[_0x75d1('0x28')][_0x75d1('0x42')]()['then'](respondWithResult(_0x16f744,null))['catch'](handleError(_0x16f744,null));};exports[_0x75d1('0x43')]=function(_0x8ce3d2,_0x50def3){if(_0x8ce3d2[_0x75d1('0x44')][_0x75d1('0x45')]){delete _0x8ce3d2[_0x75d1('0x44')]['uniqueid'];}return db[_0x75d1('0x28')][_0x75d1('0x46')]({'where':{'uniqueid':_0x8ce3d2[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x50def3,null))[_0x75d1('0x24')](saveUpdates(_0x8ce3d2[_0x75d1('0x44')],null))[_0x75d1('0x24')](respondWithResult(_0x50def3,null))['catch'](handleError(_0x50def3,null));};exports[_0x75d1('0x47')]=function(_0x382195,_0x16b3c0,_0x395e0b){return db[_0x75d1('0x28')][_0x75d1('0x3c')]({'raw':![],'where':{'VoiceQueueId':_0x382195[_0x75d1('0x40')]['id']},'attributes':[[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x51')))),'congestionContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),_0x75d1('0x55')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),_0x75d1('0x57')],[db['sequelize']['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})['then'](handleEntityNotFound(_0x16b3c0,null))[_0x75d1('0x24')](respondWithResult(_0x16b3c0,null))[_0x75d1('0x3e')](handleError(_0x16b3c0,null));};exports[_0x75d1('0x59')]=function(_0x16cc70,_0x5d2219,_0x22ce12){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x16cc70[_0x75d1('0x40')]['id']},'attributes':[[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x51')))),_0x75d1('0x5a')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),'abandonedContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),'reCallContacts'],[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})[_0x75d1('0x24')](handleEntityNotFound(_0x5d2219,null))[_0x75d1('0x24')](respondWithResult(_0x5d2219,null))['catch'](handleError(_0x5d2219,null));};exports[_0x75d1('0x5b')]=function(_0x1f9ac2,_0x290587,_0x1baaca){return db[_0x75d1('0x5c')]['find']({'where':{'id':_0x1f9ac2['params']['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x290587,null))['then'](function(_0x3f15f3){var _0xf29a9f;if(_0x3f15f3){_0xf29a9f=squel[_0x75d1('0x5d')]()['into']('cm_hopper')[_0x75d1('0x5e')](['phone',_0x75d1('0x5f'),_0x75d1('0x60'),_0x75d1('0x61'),'VoiceQueueId',_0x75d1('0x62'),_0x75d1('0x63')],squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x66'),_0x75d1('0x67'))[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')](_0x75d1('0x69'),_0x75d1('0x60'))[_0x75d1('0x65')](_0x75d1('0x6a'),'ListId')['field'](_0x75d1('0x6b'),_0x75d1('0x6c'))['field'](_0x75d1('0x68'),'createdAt')['field']('NOW()',_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2['params']['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x1f9ac2[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()['field']('phone')['from'](_0x75d1('0x74'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2[_0x75d1('0x40')]['id'][_0x75d1('0x70')]()))[_0x75d1('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x75d1('0x64')]()[_0x75d1('0x65')]('calleridnum')[_0x75d1('0x6d')]('cm_hopper_final')['where']('VoiceQueueId\x20=\x20?',_0x1f9ac2[_0x75d1('0x40')]['id']['toString']())['where'](_0x75d1('0x75')))['group'](_0x75d1('0x60')))[_0x75d1('0x70')]();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0xf29a9f);}return[];})[_0x75d1('0x24')](respondWithResult(_0x290587,null))[_0x75d1('0x3e')](handleError(_0x290587,null));};exports[_0x75d1('0x76')]=function(_0x217347,_0x51b682,_0x195a0a){return db['Campaign'][_0x75d1('0x46')]({'where':{'id':_0x217347[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x51b682,null))['then'](function(_0x10bc92){var _0x150735;if(_0x10bc92){_0x150735=squel[_0x75d1('0x5d')]()[_0x75d1('0x77')](_0x75d1('0x74'))[_0x75d1('0x5e')]([_0x75d1('0x67'),'scheduledAt',_0x75d1('0x60'),_0x75d1('0x61'),_0x75d1('0x78'),_0x75d1('0x62'),_0x75d1('0x63')],squel['select']()['field'](_0x75d1('0x66'),'phone')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')]('ANY_VALUE(ContactId)','ContactId')[_0x75d1('0x65')](_0x75d1('0x6a'),_0x75d1('0x61'))[_0x75d1('0x65')](_0x75d1('0x79'),'CampaignId')[_0x75d1('0x65')](_0x75d1('0x68'),'createdAt')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')]('CampaignId\x20=\x20?',_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x217347[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x67'))[_0x75d1('0x6d')]('cm_hopper')[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id']['toString']()))[_0x75d1('0x35')](_0x75d1('0x73'),squel['select']()[_0x75d1('0x65')](_0x75d1('0x7b'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')]('state\x20=\x204'))[_0x75d1('0x7c')](_0x75d1('0x60')))['toString']();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0x150735);}return[];})['then'](respondWithResult(_0x51b682,null))['catch'](handleError(_0x51b682,null));};exports[_0x75d1('0x7d')]=function(_0x44a017,_0x4d8e5d,_0x1f3a7e){return db['CmHopper'][_0x75d1('0x7e')]({'where':{'VoiceQueueId':_0x44a017['body'][_0x75d1('0x6c')],'CampaignId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x78')],'ContactId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x60')]}})[_0x75d1('0x24')](handleEntityNotFound(_0x4d8e5d,null))[_0x75d1('0x24')](function(_0x205e82){if(_0x205e82){return _0x205e82;}return null;})[_0x75d1('0x24')](respondWithResult(_0x4d8e5d,null))[_0x75d1('0x3e')](handleError(_0x4d8e5d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 0da3cf4..dc7607f 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 _0x9a5c=['CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./cmHopperFinal.attributes','exports','define'];(function(_0xf7300,_0xc26936){var _0x1c8466=function(_0x19f7df){while(--_0x19f7df){_0xf7300['push'](_0xf7300['shift']());}};_0x1c8466(++_0xc26936);}(_0x9a5c,0x6d));var _0xc9a5=function(_0x3d8291,_0x560e85){_0x3d8291=_0x3d8291-0x0;var _0x2bad5c=_0x9a5c[_0x3d8291];return _0x2bad5c;};'use strict';var _=require(_0xc9a5('0x0'));var util=require(_0xc9a5('0x1'));var logger=require(_0xc9a5('0x2'))(_0xc9a5('0x3'));var moment=require(_0xc9a5('0x4'));var BPromise=require(_0xc9a5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc9a5('0x6'));var rimraf=require(_0xc9a5('0x7'));var config=require('../../config/environment');var attributes=require(_0xc9a5('0x8'));module[_0xc9a5('0x9')]=function(_0x320e5c,_0x3cae5f){return _0x320e5c[_0xc9a5('0xa')](_0xc9a5('0xb'),attributes,{'tableName':_0xc9a5('0xc'),'paranoid':![],'indexes':[{'name':_0xc9a5('0xd'),'fields':[_0xc9a5('0xd')]},{'name':_0xc9a5('0xe'),'fields':[_0xc9a5('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeaf3=['./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x2d3a4d,_0x47561e){var _0x3a94a3=function(_0x2f48da){while(--_0x2f48da){_0x2d3a4d['push'](_0x2d3a4d['shift']());}};_0x3a94a3(++_0x47561e);}(_0xeaf3,0x1b3));var _0x3eaf=function(_0x16a210,_0x2046a2){_0x16a210=_0x16a210-0x0;var _0x10b5ec=_0xeaf3[_0x16a210];return _0x10b5ec;};'use strict';var _=require(_0x3eaf('0x0'));var util=require(_0x3eaf('0x1'));var logger=require('../../config/logger')(_0x3eaf('0x2'));var moment=require(_0x3eaf('0x3'));var BPromise=require('bluebird');var rp=require(_0x3eaf('0x4'));var fs=require('fs');var path=require(_0x3eaf('0x5'));var rimraf=require(_0x3eaf('0x6'));var config=require('../../config/environment');var attributes=require(_0x3eaf('0x7'));module[_0x3eaf('0x8')]=function(_0x1e9d4e,_0x4beb9a){return _0x1e9d4e['define'](_0x3eaf('0x9'),attributes,{'tableName':_0x3eaf('0xa'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x3eaf('0xb')]},{'name':_0x3eaf('0xc'),'fields':[_0x3eaf('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 5db61d6..f9ee10e 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x30fdaa,_0x1d2ce8){var _0x1d4a0a=function(_0x3138c1){while(--_0x3138c1){_0x30fdaa['push'](_0x30fdaa['shift']());}};_0x1d4a0a(++_0x1d2ce8);}(_0x7a54,0x106));var _0x47a5=function(_0x192ffe,_0x30429d){_0x192ffe=_0x192ffe-0x0;var _0x10e4a6=_0x7a54[_0x192ffe];return _0x10e4a6;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x381c68,_0x3f08a7){var _0x46833b=function(_0x3f9b5e){while(--_0x3f9b5e){_0x381c68['push'](_0x381c68['shift']());}};_0x46833b(++_0x3f08a7);}(_0xb10b,0x12a));var _0xbb10=function(_0x5a09e9,_0x391256){_0x5a09e9=_0x5a09e9-0x0;var _0x5e4735=_0xb10b[_0x5a09e9];return _0x5e4735;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index d2a163e..e6f2192 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 _0x8156=['../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','/:id','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3dd593,_0x2a5b2c){var _0x65c418=function(_0x2ee045){while(--_0x2ee045){_0x3dd593['push'](_0x3dd593['shift']());}};_0x65c418(++_0x2a5b2c);}(_0x8156,0xad));var _0x6815=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8156[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x6815('0x0'));var path=require(_0x6815('0x1'));var timeout=require(_0x6815('0x2'));var express=require(_0x6815('0x3'));var router=express[_0x6815('0x4')]();var fs_extra=require(_0x6815('0x5'));var auth=require(_0x6815('0x6'));var interaction=require(_0x6815('0x7'));var config=require(_0x6815('0x8'));var controller=require(_0x6815('0x9'));router[_0x6815('0xa')]('/',auth[_0x6815('0xb')](),controller[_0x6815('0xc')]);router[_0x6815('0xa')](_0x6815('0xd'),auth[_0x6815('0xb')](),controller[_0x6815('0xe')]);router[_0x6815('0xa')]('/:id',auth[_0x6815('0xb')](),controller[_0x6815('0xf')]);router[_0x6815('0xa')](_0x6815('0x10'),auth[_0x6815('0xb')](),controller[_0x6815('0x11')]);router[_0x6815('0xa')](_0x6815('0x12'),auth[_0x6815('0xb')](),controller[_0x6815('0x13')]);router['post'](_0x6815('0x14'),auth[_0x6815('0xb')](),controller[_0x6815('0x15')]);router[_0x6815('0x16')](_0x6815('0x17'),auth[_0x6815('0xb')](),controller[_0x6815('0x18')]);router[_0x6815('0x16')](_0x6815('0x19'),auth[_0x6815('0xb')](),controller['checkContactHopper']);router[_0x6815('0x1a')](_0x6815('0x1b'),auth[_0x6815('0xb')](),controller[_0x6815('0x1c')]);module[_0x6815('0x1d')]=router; \ No newline at end of file +var _0x71af=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','multer'];(function(_0xc85fd9,_0x12ef82){var _0x1cb181=function(_0x94ce1b){while(--_0x94ce1b){_0xc85fd9['push'](_0xc85fd9['shift']());}};_0x1cb181(++_0x12ef82);}(_0x71af,0x194));var _0xf71a=function(_0x5199a9,_0x4c77cb){_0x5199a9=_0x5199a9-0x0;var _0x404655=_0x71af[_0x5199a9];return _0x404655;};'use strict';var multer=require(_0xf71a('0x0'));var util=require(_0xf71a('0x1'));var path=require('path');var timeout=require(_0xf71a('0x2'));var express=require(_0xf71a('0x3'));var router=express[_0xf71a('0x4')]();var fs_extra=require(_0xf71a('0x5'));var auth=require(_0xf71a('0x6'));var interaction=require(_0xf71a('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0xf71a('0x8')]('/',auth[_0xf71a('0x9')](),controller[_0xf71a('0xa')]);router[_0xf71a('0x8')](_0xf71a('0xb'),auth[_0xf71a('0x9')](),controller[_0xf71a('0xc')]);router[_0xf71a('0x8')](_0xf71a('0xd'),auth[_0xf71a('0x9')](),controller['show']);router[_0xf71a('0x8')](_0xf71a('0xe'),auth['isAuthenticated'](),controller[_0xf71a('0xf')]);router[_0xf71a('0x8')](_0xf71a('0x10'),auth[_0xf71a('0x9')](),controller[_0xf71a('0x11')]);router['post'](_0xf71a('0x12'),auth[_0xf71a('0x9')](),controller[_0xf71a('0x13')]);router[_0xf71a('0x14')](_0xf71a('0x15'),auth[_0xf71a('0x9')](),controller[_0xf71a('0x16')]);router[_0xf71a('0x14')](_0xf71a('0x17'),auth['isAuthenticated'](),controller[_0xf71a('0x18')]);router[_0xf71a('0x19')](_0xf71a('0xd'),auth[_0xf71a('0x9')](),controller['update']);module[_0xf71a('0x1a')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 1ab4c90..c6d4ca3 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 _0x9394=['DATE','BOOLEAN','exports','INTEGER','STRING'];(function(_0x357f0a,_0x37aa60){var _0x10d41b=function(_0x3ef2e1){while(--_0x3ef2e1){_0x357f0a['push'](_0x357f0a['shift']());}};_0x10d41b(++_0x37aa60);}(_0x9394,0x1d3));var _0x4939=function(_0x8e9386,_0x3cc60f){_0x8e9386=_0x8e9386-0x0;var _0x4abf26=_0x9394[_0x8e9386];return _0x4abf26;};'use strict';var Sequelize=require('sequelize');module[_0x4939('0x0')]={'state':{'type':Sequelize[_0x4939('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x4939('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x4939('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4939('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4939('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x4939('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x4939('0x2')]},'originatecalleridname':{'type':Sequelize[_0x4939('0x2')]},'calleridnum':{'type':Sequelize[_0x4939('0x2')]},'calleridname':{'type':Sequelize[_0x4939('0x2')]},'starttime':{'type':Sequelize[_0x4939('0x3')]},'responsetime':{'type':Sequelize[_0x4939('0x3')]},'answertime':{'type':Sequelize[_0x4939('0x3')]},'droptime':{'type':Sequelize[_0x4939('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x4939('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x4939('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x4939('0x2')]},'campaign':{'type':Sequelize[_0x4939('0x2')]},'campaigntype':{'type':Sequelize[_0x4939('0x2')]},'membername':{'type':Sequelize[_0x4939('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x4939('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x4939('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x4939('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4939('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4939('0x3')]},'recallme':{'type':Sequelize[_0x4939('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x4939('0x3')]},'edited':{'type':Sequelize[_0x4939('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x4939('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4939('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4939('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4939('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4939('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa23d=['BOOLEAN','INTEGER','STRING','DATE'];(function(_0x52e9a6,_0x37ae6f){var _0x2ee971=function(_0x5191c9){while(--_0x5191c9){_0x52e9a6['push'](_0x52e9a6['shift']());}};_0x2ee971(++_0x37ae6f);}(_0xa23d,0x7d));var _0xda23=function(_0x3e8cf2,_0x178b47){_0x3e8cf2=_0x3e8cf2-0x0;var _0xc8fdc3=_0xa23d[_0x3e8cf2];return _0xc8fdc3;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0xda23('0x0')](0x2)},'statedesc':{'type':Sequelize[_0xda23('0x1')]},'scheduledat':{'type':Sequelize[_0xda23('0x2')]},'countbusyretry':{'type':Sequelize[_0xda23('0x0')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xda23('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xda23('0x0')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xda23('0x0')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xda23('0x1')]},'originatecalleridname':{'type':Sequelize[_0xda23('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xda23('0x1')]},'starttime':{'type':Sequelize[_0xda23('0x2')]},'responsetime':{'type':Sequelize[_0xda23('0x2')]},'answertime':{'type':Sequelize[_0xda23('0x2')]},'droptime':{'type':Sequelize[_0xda23('0x2')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xda23('0x0')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xda23('0x0')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xda23('0x0')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xda23('0x0')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xda23('0x1')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xda23('0x1')]},'membername':{'type':Sequelize[_0xda23('0x1')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xda23('0x3')],'defaultValue':![]},'fax':{'type':Sequelize[_0xda23('0x3')],'defaultValue':![]},'callback':{'type':Sequelize[_0xda23('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xda23('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xda23('0x2')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0xda23('0x3')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xda23('0x0')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xda23('0x0')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xda23('0x0')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xda23('0x0')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 618c92a..3c699a9 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 _0x12d5=['name','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','merge','filter','options','includeAll','rows','catch','show','params','include','create','describe','body','uniqueid','find','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','index','map','CmHopperHistory','rawAttributes','fieldName','type','model'];(function(_0x373e27,_0x527f8d){var _0x4a336f=function(_0x2cf6c0){while(--_0x2cf6c0){_0x373e27['push'](_0x373e27['shift']());}};_0x4a336f(++_0x527f8d);}(_0x12d5,0x149));var _0x512d=function(_0x55ddaa,_0x236ca2){_0x55ddaa=_0x55ddaa-0x0;var _0x243981=_0x12d5[_0x55ddaa];return _0x243981;};'use strict';var emlformat=require(_0x512d('0x0'));var rimraf=require(_0x512d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x512d('0x2'));var moment=require(_0x512d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x512d('0x4'));var util=require(_0x512d('0x5'));var path=require(_0x512d('0x6'));var sox=require(_0x512d('0x7'));var csv=require(_0x512d('0x8'));var ejs=require(_0x512d('0x9'));var fs=require('fs');var fs_extra=require(_0x512d('0xa'));var _=require(_0x512d('0xb'));var squel=require('squel');var crypto=require(_0x512d('0xc'));var jsforce=require(_0x512d('0xd'));var deskjs=require(_0x512d('0xe'));var toCsv=require(_0x512d('0x8'));var querystring=require('querystring');var Papa=require(_0x512d('0xf'));var Redis=require(_0x512d('0x10'));var authService=require(_0x512d('0x11'));var qs=require(_0x512d('0x12'));var as=require(_0x512d('0x13'));var hardwareService=require(_0x512d('0x14'));var logger=require(_0x512d('0x15'))(_0x512d('0x16'));var utils=require(_0x512d('0x17'));var config=require(_0x512d('0x18'));var licenseUtil=require(_0x512d('0x19'));var db=require(_0x512d('0x1a'))['db'];function respondWithStatusCode(_0x25e1b6,_0x207d5d){_0x207d5d=_0x207d5d||0xcc;return function(_0x1dd08a){if(_0x1dd08a){return _0x25e1b6['sendStatus'](_0x207d5d);}return _0x25e1b6[_0x512d('0x1b')](_0x207d5d)[_0x512d('0x1c')]();};}function respondWithResult(_0x235523,_0x86f1de){_0x86f1de=_0x86f1de||0xc8;return function(_0x94e364){if(_0x94e364){return _0x235523[_0x512d('0x1b')](_0x86f1de)[_0x512d('0x1d')](_0x94e364);}};}function respondWithFilteredResult(_0x357d5b,_0x38f195){return function(_0x32e074){if(_0x32e074){var _0x588e6d=typeof _0x38f195[_0x512d('0x1e')]===_0x512d('0x1f')&&typeof _0x38f195[_0x512d('0x20')]===_0x512d('0x1f');var _0x325356=_0x32e074[_0x512d('0x21')];var _0x55a1ad=_0x588e6d?0x0:_0x38f195[_0x512d('0x1e')];var _0x10973b=_0x588e6d?_0x32e074['count']:_0x38f195[_0x512d('0x1e')]+_0x38f195[_0x512d('0x20')];var _0x298a7c;if(_0x10973b>=_0x325356){_0x10973b=_0x325356;_0x298a7c=0xc8;}else{_0x298a7c=0xce;}_0x357d5b[_0x512d('0x1b')](_0x298a7c);return _0x357d5b[_0x512d('0x22')](_0x512d('0x23'),_0x55a1ad+'-'+_0x10973b+'/'+_0x325356)[_0x512d('0x1d')](_0x32e074);}return null;};}function patchUpdates(_0x573ab1){return function(_0x3be11c){try{jsonpatch[_0x512d('0x24')](_0x3be11c,_0x573ab1,!![]);}catch(_0x2b4196){return BPromise[_0x512d('0x25')](_0x2b4196);}return _0x3be11c[_0x512d('0x26')]();};}function saveUpdates(_0x43e2d3,_0x24d0bb){return function(_0x2cf107){if(_0x2cf107){return _0x2cf107[_0x512d('0x27')](_0x43e2d3)[_0x512d('0x28')](function(_0x46f76b){return _0x46f76b;});}return null;};}function removeEntity(_0x53d067,_0x30e3fe){return function(_0x164320){if(_0x164320){return _0x164320[_0x512d('0x29')]()[_0x512d('0x28')](function(){_0x53d067[_0x512d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18e193,_0x2c652e){return function(_0x2afb79){if(!_0x2afb79){_0x18e193[_0x512d('0x2a')](0x194);}return _0x2afb79;};}function handleError(_0x412821,_0x3b1340){_0x3b1340=_0x3b1340||0x1f4;return function(_0x4a9749){logger['error'](_0x4a9749[_0x512d('0x2b')]);if(_0x4a9749['name']){delete _0x4a9749['name'];}_0x412821[_0x512d('0x1b')](_0x3b1340)['send'](_0x4a9749);};}exports[_0x512d('0x2c')]=function(_0x154c2b,_0x418151){var _0x1360bc={},_0x2f0e52={},_0x5d7b16={'count':0x0,'rows':[]};var _0x16ea7c=_[_0x512d('0x2d')](db[_0x512d('0x2e')][_0x512d('0x2f')],function(_0x55a8f4){return{'name':_0x55a8f4[_0x512d('0x30')],'type':_0x55a8f4[_0x512d('0x31')]['key']};});_0x2f0e52[_0x512d('0x32')]=_[_0x512d('0x2d')](_0x16ea7c,_0x512d('0x33'));_0x2f0e52[_0x512d('0x34')]=_[_0x512d('0x35')](_0x154c2b['query']);_0x2f0e52[_0x512d('0x36')]=_[_0x512d('0x37')](_0x2f0e52['model'],_0x2f0e52[_0x512d('0x34')]);_0x1360bc[_0x512d('0x38')]=_[_0x512d('0x37')](_0x2f0e52[_0x512d('0x32')],qs[_0x512d('0x39')](_0x154c2b['query'][_0x512d('0x39')]));_0x1360bc[_0x512d('0x38')]=_0x1360bc[_0x512d('0x38')]['length']?_0x1360bc[_0x512d('0x38')]:_0x2f0e52[_0x512d('0x32')];if(!_0x154c2b[_0x512d('0x34')]['hasOwnProperty'](_0x512d('0x3a'))){_0x1360bc[_0x512d('0x20')]=qs[_0x512d('0x20')](_0x154c2b['query'][_0x512d('0x20')]);_0x1360bc[_0x512d('0x1e')]=qs['offset'](_0x154c2b['query'][_0x512d('0x1e')]);}_0x1360bc['order']=qs['sort'](_0x154c2b[_0x512d('0x34')][_0x512d('0x3b')]);_0x1360bc[_0x512d('0x3c')]=qs[_0x512d('0x36')](_[_0x512d('0x3d')](_0x154c2b[_0x512d('0x34')],_0x2f0e52[_0x512d('0x36')]),_0x16ea7c);if(_0x154c2b[_0x512d('0x34')]['filter']){_0x1360bc[_0x512d('0x3c')]=_[_0x512d('0x3e')](_0x1360bc[_0x512d('0x3c')],{'$or':_[_0x512d('0x2d')](_0x16ea7c,function(_0x50d1e7){if(_0x50d1e7[_0x512d('0x31')]!=='VIRTUAL'){var _0x561407={};_0x561407[_0x50d1e7['name']]={'$like':'%'+_0x154c2b[_0x512d('0x34')][_0x512d('0x3f')]+'%'};return _0x561407;}})});}_0x1360bc=_[_0x512d('0x3e')]({},_0x1360bc,_0x154c2b[_0x512d('0x40')]);var _0xf0ce8d={'where':_0x1360bc[_0x512d('0x3c')]};return db[_0x512d('0x2e')][_0x512d('0x21')](_0xf0ce8d)['then'](function(_0x29e883){_0x5d7b16[_0x512d('0x21')]=_0x29e883;if(_0x154c2b[_0x512d('0x34')][_0x512d('0x41')]){_0x1360bc['include']=[{'all':!![]}];}return db[_0x512d('0x2e')]['findAll'](_0x1360bc);})[_0x512d('0x28')](function(_0xcdf84a){_0x5d7b16[_0x512d('0x42')]=_0xcdf84a;return _0x5d7b16;})[_0x512d('0x28')](respondWithFilteredResult(_0x418151,_0x1360bc))[_0x512d('0x43')](handleError(_0x418151,null));};exports[_0x512d('0x44')]=function(_0x2956d0,_0x3d7ce){var _0x35a0c5={'raw':!![],'where':{'id':_0x2956d0[_0x512d('0x45')]['id']}},_0x173332={};_0x173332[_0x512d('0x32')]=_[_0x512d('0x35')](db[_0x512d('0x2e')][_0x512d('0x2f')]);_0x173332['query']=_[_0x512d('0x35')](_0x2956d0['query']);_0x173332[_0x512d('0x36')]=_[_0x512d('0x37')](_0x173332[_0x512d('0x32')],_0x173332[_0x512d('0x34')]);_0x35a0c5[_0x512d('0x38')]=_[_0x512d('0x37')](_0x173332[_0x512d('0x32')],qs[_0x512d('0x39')](_0x2956d0[_0x512d('0x34')]['fields']));_0x35a0c5[_0x512d('0x38')]=_0x35a0c5[_0x512d('0x38')]['length']?_0x35a0c5[_0x512d('0x38')]:_0x173332[_0x512d('0x32')];if(_0x2956d0[_0x512d('0x34')][_0x512d('0x41')]){_0x35a0c5[_0x512d('0x46')]=[{'all':!![]}];}_0x35a0c5=_[_0x512d('0x3e')]({},_0x35a0c5,_0x2956d0[_0x512d('0x40')]);return db['CmHopperHistory']['find'](_0x35a0c5)[_0x512d('0x28')](handleEntityNotFound(_0x3d7ce,null))[_0x512d('0x28')](respondWithResult(_0x3d7ce,null))[_0x512d('0x43')](handleError(_0x3d7ce,null));};exports[_0x512d('0x47')]=function(_0x545984,_0x4ab8d8){return db[_0x512d('0x2e')][_0x512d('0x47')](_0x545984['body'],{})[_0x512d('0x28')](respondWithResult(_0x4ab8d8,0xc9))[_0x512d('0x43')](handleError(_0x4ab8d8,null));};exports['describe']=function(_0x4a8939,_0x2aa1f3){return db['CmHopperHistory'][_0x512d('0x48')]()[_0x512d('0x28')](respondWithResult(_0x2aa1f3,null))['catch'](handleError(_0x2aa1f3,null));};exports[_0x512d('0x27')]=function(_0x401de2,_0x11d1b7){if(_0x401de2[_0x512d('0x49')][_0x512d('0x4a')]){delete _0x401de2[_0x512d('0x49')]['uniqueid'];}return db[_0x512d('0x2e')][_0x512d('0x4b')]({'where':{'uniqueid':_0x401de2['params']['id']}})[_0x512d('0x28')](handleEntityNotFound(_0x11d1b7,null))['then'](saveUpdates(_0x401de2[_0x512d('0x49')],null))[_0x512d('0x28')](respondWithResult(_0x11d1b7,null))['catch'](handleError(_0x11d1b7,null));}; \ No newline at end of file +var _0x1369=['intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','reject','save','update','destroy','then','error','stack','name','send','map','CmHopperHistory','fieldName','type','model','query','keys','filters'];(function(_0x1d3ece,_0x3fb359){var _0x1ba5d2=function(_0xaa2729){while(--_0xaa2729){_0x1d3ece['push'](_0x1d3ece['shift']());}};_0x1ba5d2(++_0x3fb359);}(_0x1369,0xae));var _0x9136=function(_0x5eef9e,_0x317fcf){_0x5eef9e=_0x5eef9e-0x0;var _0x45192c=_0x1369[_0x5eef9e];return _0x45192c;};'use strict';var emlformat=require(_0x9136('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9136('0x1'));var jsonpatch=require(_0x9136('0x2'));var rp=require(_0x9136('0x3'));var moment=require(_0x9136('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9136('0x5'));var util=require(_0x9136('0x6'));var path=require(_0x9136('0x7'));var sox=require(_0x9136('0x8'));var csv=require(_0x9136('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9136('0xa'));var _=require('lodash');var squel=require(_0x9136('0xb'));var crypto=require(_0x9136('0xc'));var jsforce=require(_0x9136('0xd'));var deskjs=require(_0x9136('0xe'));var toCsv=require(_0x9136('0x9'));var querystring=require(_0x9136('0xf'));var Papa=require(_0x9136('0x10'));var Redis=require(_0x9136('0x11'));var authService=require(_0x9136('0x12'));var qs=require(_0x9136('0x13'));var as=require(_0x9136('0x14'));var hardwareService=require(_0x9136('0x15'));var logger=require('../../config/logger')(_0x9136('0x16'));var utils=require('../../config/utils');var config=require(_0x9136('0x17'));var licenseUtil=require(_0x9136('0x18'));var db=require(_0x9136('0x19'))['db'];function respondWithStatusCode(_0x478a3f,_0x3512f2){_0x3512f2=_0x3512f2||0xcc;return function(_0x35534e){if(_0x35534e){return _0x478a3f[_0x9136('0x1a')](_0x3512f2);}return _0x478a3f[_0x9136('0x1b')](_0x3512f2)[_0x9136('0x1c')]();};}function respondWithResult(_0x5908b6,_0x12ddff){_0x12ddff=_0x12ddff||0xc8;return function(_0x588165){if(_0x588165){return _0x5908b6[_0x9136('0x1b')](_0x12ddff)[_0x9136('0x1d')](_0x588165);}};}function respondWithFilteredResult(_0x470ee9,_0x37287a){return function(_0x497048){if(_0x497048){var _0x3afab6=typeof _0x37287a['offset']==='undefined'&&typeof _0x37287a['limit']===_0x9136('0x1e');var _0x31b996=_0x497048[_0x9136('0x1f')];var _0x246cf6=_0x3afab6?0x0:_0x37287a[_0x9136('0x20')];var _0x3dffb1=_0x3afab6?_0x497048[_0x9136('0x1f')]:_0x37287a['offset']+_0x37287a[_0x9136('0x21')];var _0x53130b;if(_0x3dffb1>=_0x31b996){_0x3dffb1=_0x31b996;_0x53130b=0xc8;}else{_0x53130b=0xce;}_0x470ee9[_0x9136('0x1b')](_0x53130b);return _0x470ee9['set']('Content-Range',_0x246cf6+'-'+_0x3dffb1+'/'+_0x31b996)[_0x9136('0x1d')](_0x497048);}return null;};}function patchUpdates(_0x21d278){return function(_0x33895a){try{jsonpatch['apply'](_0x33895a,_0x21d278,!![]);}catch(_0x42291e){return BPromise[_0x9136('0x22')](_0x42291e);}return _0x33895a[_0x9136('0x23')]();};}function saveUpdates(_0x5a6abb,_0x5d50be){return function(_0x2c61b7){if(_0x2c61b7){return _0x2c61b7[_0x9136('0x24')](_0x5a6abb)['then'](function(_0x11904c){return _0x11904c;});}return null;};}function removeEntity(_0x5ad558,_0x1b7429){return function(_0x1f59d6){if(_0x1f59d6){return _0x1f59d6[_0x9136('0x25')]()[_0x9136('0x26')](function(){_0x5ad558['status'](0xcc)[_0x9136('0x1c')]();});}};}function handleEntityNotFound(_0xbf1f4c,_0x1e8857){return function(_0x57ffa1){if(!_0x57ffa1){_0xbf1f4c['sendStatus'](0x194);}return _0x57ffa1;};}function handleError(_0x6df202,_0x4a107a){_0x4a107a=_0x4a107a||0x1f4;return function(_0x22a80){logger[_0x9136('0x27')](_0x22a80[_0x9136('0x28')]);if(_0x22a80[_0x9136('0x29')]){delete _0x22a80[_0x9136('0x29')];}_0x6df202['status'](_0x4a107a)[_0x9136('0x2a')](_0x22a80);};}exports['index']=function(_0x1722d5,_0xe18c0f){var _0xca0d48={},_0x564f45={},_0x38f76d={'count':0x0,'rows':[]};var _0x57f594=_[_0x9136('0x2b')](db[_0x9136('0x2c')]['rawAttributes'],function(_0x56b5f8){return{'name':_0x56b5f8[_0x9136('0x2d')],'type':_0x56b5f8[_0x9136('0x2e')]['key']};});_0x564f45[_0x9136('0x2f')]=_[_0x9136('0x2b')](_0x57f594,_0x9136('0x29'));_0x564f45[_0x9136('0x30')]=_[_0x9136('0x31')](_0x1722d5['query']);_0x564f45[_0x9136('0x32')]=_[_0x9136('0x33')](_0x564f45[_0x9136('0x2f')],_0x564f45[_0x9136('0x30')]);_0xca0d48[_0x9136('0x34')]=_[_0x9136('0x33')](_0x564f45[_0x9136('0x2f')],qs['fields'](_0x1722d5[_0x9136('0x30')]['fields']));_0xca0d48[_0x9136('0x34')]=_0xca0d48[_0x9136('0x34')][_0x9136('0x35')]?_0xca0d48[_0x9136('0x34')]:_0x564f45[_0x9136('0x2f')];if(!_0x1722d5['query'][_0x9136('0x36')](_0x9136('0x37'))){_0xca0d48[_0x9136('0x21')]=qs[_0x9136('0x21')](_0x1722d5[_0x9136('0x30')]['limit']);_0xca0d48[_0x9136('0x20')]=qs[_0x9136('0x20')](_0x1722d5['query'][_0x9136('0x20')]);}_0xca0d48[_0x9136('0x38')]=qs[_0x9136('0x39')](_0x1722d5[_0x9136('0x30')]['sort']);_0xca0d48[_0x9136('0x3a')]=qs[_0x9136('0x32')](_[_0x9136('0x3b')](_0x1722d5[_0x9136('0x30')],_0x564f45[_0x9136('0x32')]),_0x57f594);if(_0x1722d5[_0x9136('0x30')]['filter']){_0xca0d48[_0x9136('0x3a')]=_[_0x9136('0x3c')](_0xca0d48[_0x9136('0x3a')],{'$or':_[_0x9136('0x2b')](_0x57f594,function(_0x438179){if(_0x438179[_0x9136('0x2e')]!==_0x9136('0x3d')){var _0x37558c={};_0x37558c[_0x438179[_0x9136('0x29')]]={'$like':'%'+_0x1722d5['query'][_0x9136('0x3e')]+'%'};return _0x37558c;}})});}_0xca0d48=_[_0x9136('0x3c')]({},_0xca0d48,_0x1722d5['options']);var _0x38075d={'where':_0xca0d48[_0x9136('0x3a')]};return db['CmHopperHistory'][_0x9136('0x1f')](_0x38075d)[_0x9136('0x26')](function(_0x29b38f){_0x38f76d[_0x9136('0x1f')]=_0x29b38f;if(_0x1722d5[_0x9136('0x30')][_0x9136('0x3f')]){_0xca0d48[_0x9136('0x40')]=[{'all':!![]}];}return db[_0x9136('0x2c')][_0x9136('0x41')](_0xca0d48);})['then'](function(_0x52664f){_0x38f76d[_0x9136('0x42')]=_0x52664f;return _0x38f76d;})[_0x9136('0x26')](respondWithFilteredResult(_0xe18c0f,_0xca0d48))[_0x9136('0x43')](handleError(_0xe18c0f,null));};exports[_0x9136('0x44')]=function(_0x3cda98,_0x1800d8){var _0x5cdac4={'raw':!![],'where':{'id':_0x3cda98[_0x9136('0x45')]['id']}},_0x2f845b={};_0x2f845b[_0x9136('0x2f')]=_[_0x9136('0x31')](db[_0x9136('0x2c')][_0x9136('0x46')]);_0x2f845b[_0x9136('0x30')]=_[_0x9136('0x31')](_0x3cda98[_0x9136('0x30')]);_0x2f845b[_0x9136('0x32')]=_[_0x9136('0x33')](_0x2f845b[_0x9136('0x2f')],_0x2f845b[_0x9136('0x30')]);_0x5cdac4['attributes']=_[_0x9136('0x33')](_0x2f845b[_0x9136('0x2f')],qs['fields'](_0x3cda98[_0x9136('0x30')]['fields']));_0x5cdac4['attributes']=_0x5cdac4[_0x9136('0x34')]['length']?_0x5cdac4[_0x9136('0x34')]:_0x2f845b[_0x9136('0x2f')];if(_0x3cda98['query'][_0x9136('0x3f')]){_0x5cdac4['include']=[{'all':!![]}];}_0x5cdac4=_['merge']({},_0x5cdac4,_0x3cda98['options']);return db[_0x9136('0x2c')][_0x9136('0x47')](_0x5cdac4)[_0x9136('0x26')](handleEntityNotFound(_0x1800d8,null))[_0x9136('0x26')](respondWithResult(_0x1800d8,null))['catch'](handleError(_0x1800d8,null));};exports['create']=function(_0x4db224,_0x33cc61){return db['CmHopperHistory'][_0x9136('0x48')](_0x4db224['body'],{})[_0x9136('0x26')](respondWithResult(_0x33cc61,0xc9))[_0x9136('0x43')](handleError(_0x33cc61,null));};exports['describe']=function(_0x167679,_0x434420){return db[_0x9136('0x2c')]['describe']()[_0x9136('0x26')](respondWithResult(_0x434420,null))[_0x9136('0x43')](handleError(_0x434420,null));};exports[_0x9136('0x24')]=function(_0x4dafea,_0x160b69){if(_0x4dafea[_0x9136('0x49')][_0x9136('0x4a')]){delete _0x4dafea[_0x9136('0x49')]['uniqueid'];}return db[_0x9136('0x2c')]['find']({'where':{'uniqueid':_0x4dafea[_0x9136('0x45')]['id']}})[_0x9136('0x26')](handleEntityNotFound(_0x160b69,null))[_0x9136('0x26')](saveUpdates(_0x4dafea['body'],null))['then'](respondWithResult(_0x160b69,null))[_0x9136('0x43')](handleError(_0x160b69,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 2190788..402306c 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 _0xde46=['request-promise','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api'];(function(_0x164a45,_0x44acef){var _0x1a88a0=function(_0x149bee){while(--_0x149bee){_0x164a45['push'](_0x164a45['shift']());}};_0x1a88a0(++_0x44acef);}(_0xde46,0x14e));var _0x6de4=function(_0x2f0ae2,_0x38819b){_0x2f0ae2=_0x2f0ae2-0x0;var _0x135db1=_0xde46[_0x2f0ae2];return _0x135db1;};'use strict';var _=require(_0x6de4('0x0'));var util=require(_0x6de4('0x1'));var logger=require(_0x6de4('0x2'))(_0x6de4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6de4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6de4('0x5'));var config=require(_0x6de4('0x6'));var attributes=require(_0x6de4('0x7'));module[_0x6de4('0x8')]=function(_0x525dcc,_0x47eb32){return _0x525dcc[_0x6de4('0x9')]('CmHopperHistory',attributes,{'tableName':_0x6de4('0xa'),'paranoid':![],'indexes':[{'name':_0x6de4('0xb'),'fields':['endtime']},{'name':_0x6de4('0xc'),'fields':[_0x6de4('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfc4f=['bluebird','request-promise','path','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','endtime','uniqueid','util','../../config/logger','api','moment'];(function(_0xc853e,_0x1d1da1){var _0x2ffae2=function(_0x259c20){while(--_0x259c20){_0xc853e['push'](_0xc853e['shift']());}};_0x2ffae2(++_0x1d1da1);}(_0xfc4f,0x192));var _0xffc4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xfc4f[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xffc4('0x0'));var logger=require(_0xffc4('0x1'))(_0xffc4('0x2'));var moment=require(_0xffc4('0x3'));var BPromise=require(_0xffc4('0x4'));var rp=require(_0xffc4('0x5'));var fs=require('fs');var path=require(_0xffc4('0x6'));var rimraf=require('rimraf');var config=require(_0xffc4('0x7'));var attributes=require(_0xffc4('0x8'));module[_0xffc4('0x9')]=function(_0x2efa5f,_0x4cd469){return _0x2efa5f[_0xffc4('0xa')](_0xffc4('0xb'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xffc4('0xc'),'fields':[_0xffc4('0xc')]},{'name':_0xffc4('0xd'),'fields':[_0xffc4('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 94e11f0..d66e6de 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 _0x7235=['CmHopperHistory','body','options','catch','AvgHandleTime','raw','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','findAll','where','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','name','ivrAnswerCallsDay','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','CreateCmHopperHistory'];(function(_0x45fe9c,_0x55e0d7){var _0x233d48=function(_0xa2ba2e){while(--_0xa2ba2e){_0x45fe9c['push'](_0x45fe9c['shift']());}};_0x233d48(++_0x55e0d7);}(_0x7235,0x77));var _0x5723=function(_0x14b306,_0x2bcb14){_0x14b306=_0x14b306-0x0;var _0x2dbde6=_0x7235[_0x14b306];return _0x2dbde6;};'use strict';var _=require(_0x5723('0x0'));var util=require(_0x5723('0x1'));var moment=require(_0x5723('0x2'));var BPromise=require(_0x5723('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5723('0x4'));var db=require(_0x5723('0x5'))['db'];var utils=require(_0x5723('0x6'));var logger=require(_0x5723('0x7'))(_0x5723('0x8'));var config=require(_0x5723('0x9'));var jayson=require(_0x5723('0xa'));var client=jayson[_0x5723('0xb')][_0x5723('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x380fd3,_0xb7f250,_0x3d627d){return new BPromise(function(_0x41ca1c,_0x4301f1){return client[_0x5723('0xd')](_0x380fd3,_0x3d627d)[_0x5723('0xe')](function(_0x167901){logger['info'](_0x5723('0xf'),_0xb7f250,_0x5723('0x10'));logger[_0x5723('0x11')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0xb7f250,_0x5723('0x10'),JSON[_0x5723('0x12')](_0x167901));if(_0x167901[_0x5723('0x13')]){if(_0x167901[_0x5723('0x13')][_0x5723('0x14')]===0x1f4){logger[_0x5723('0x13')](_0x5723('0xf'),_0xb7f250,_0x167901[_0x5723('0x13')]['message']);return _0x4301f1(_0x167901['error'][_0x5723('0x15')]);}logger[_0x5723('0x13')](_0x5723('0xf'),_0xb7f250,_0x167901['error'][_0x5723('0x15')]);return _0x41ca1c(_0x167901['error'][_0x5723('0x15')]);}else{logger[_0x5723('0x16')]('CmHopperHistory,\x20%s,\x20%s',_0xb7f250,'request\x20sent');_0x41ca1c(_0x167901[_0x5723('0x17')][_0x5723('0x15')]);}})['catch'](function(_0x46d66b){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0xb7f250,_0x46d66b);_0x4301f1(_0x46d66b);});});}exports[_0x5723('0x18')]=function(_0x454ce1){var _0x3c8025=this;return new Promise(function(_0x11f3b3,_0x2c0d63){return db[_0x5723('0x19')]['create'](_0x454ce1[_0x5723('0x1a')],{'raw':_0x454ce1[_0x5723('0x1b')]?_0x454ce1['options']['raw']===undefined?!![]:![]:!![]})[_0x5723('0xe')](function(_0x27d3ec){logger['info'](_0x5723('0x18'),_0x454ce1);logger['debug'](_0x5723('0x18'),_0x454ce1,JSON[_0x5723('0x12')](_0x27d3ec));_0x11f3b3(_0x27d3ec);})[_0x5723('0x1c')](function(_0x2dc8a6){logger[_0x5723('0x13')]('CreateCmHopperHistory',_0x2dc8a6[_0x5723('0x15')],_0x454ce1);_0x2c0d63(_0x3c8025[_0x5723('0x13')](0x1f4,_0x2dc8a6[_0x5723('0x15')]));});});};exports[_0x5723('0x1d')]=function(_0x149530){var _0x40ae14=this;return new Promise(function(_0x4a5505,_0x3ffbfa){return db['CmHopperHistory']['findAll']({'raw':_0x149530[_0x5723('0x1b')]?_0x149530[_0x5723('0x1b')][_0x5723('0x1e')]===undefined?!![]:![]:!![],'where':_0x149530[_0x5723('0x1b')]?_0x149530['options']['where']||null:null,'attributes':[[db[_0x5723('0x1f')]['fn'](_0x5723('0x20'),db['sequelize'][_0x5723('0x21')]('id')),_0x5723('0x22')],[db[_0x5723('0x1f')]['fn'](_0x5723('0x20'),db[_0x5723('0x1f')]['fn']('IF',db['sequelize'][_0x5723('0x23')](_0x5723('0x24')))),_0x5723('0x25')],[db[_0x5723('0x1f')]['fn'](_0x5723('0x20'),db[_0x5723('0x1f')]['fn']('IF',db[_0x5723('0x1f')][_0x5723('0x23')](_0x5723('0x26')))),_0x5723('0x27')],[db[_0x5723('0x1f')]['fn'](_0x5723('0x20'),db[_0x5723('0x1f')]['fn']('IF',db['sequelize'][_0x5723('0x23')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x5723('0x1f')]['fn'](_0x5723('0x28'),db['sequelize']['fn']('IF',db[_0x5723('0x1f')][_0x5723('0x23')](_0x5723('0x29')))),_0x5723('0x2a')],[db[_0x5723('0x1f')]['fn']('AVG',db[_0x5723('0x1f')]['fn']('IF',db[_0x5723('0x1f')][_0x5723('0x23')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x5723('0x2b')]]})[_0x5723('0xe')](function(_0x5c8f07){logger[_0x5723('0x16')](_0x5723('0x1d'),_0x149530);logger[_0x5723('0x11')](_0x5723('0x1d'),_0x149530,JSON[_0x5723('0x12')](_0x5c8f07));_0x4a5505(_0x5c8f07);})[_0x5723('0x1c')](function(_0x230f5e){logger[_0x5723('0x13')]('AvgHandleTime',_0x230f5e[_0x5723('0x15')],_0x149530);_0x3ffbfa(_0x40ae14['error'](0x1f4,_0x230f5e[_0x5723('0x15')]));});});};exports[_0x5723('0x2c')]=function(_0x234005){var _0xed908a=this;return new Promise(function(_0x313299,_0x2c5288){return db[_0x5723('0x19')][_0x5723('0x2d')]({'raw':_0x234005[_0x5723('0x1b')]?_0x234005['options']['raw']===undefined?!![]:![]:!![],'where':_0x234005['options']?_0x234005['options'][_0x5723('0x2e')]||null:null,'attributes':[[_0x5723('0x2f'),'name'],[db[_0x5723('0x1f')]['fn'](_0x5723('0x20'),db[_0x5723('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x5723('0x30')))),_0x5723('0x31')],[db[_0x5723('0x1f')]['fn'](_0x5723('0x20'),db[_0x5723('0x1f')]['fn']('IF',db[_0x5723('0x1f')][_0x5723('0x23')](_0x5723('0x32')))),_0x5723('0x33')],[db[_0x5723('0x1f')]['fn'](_0x5723('0x20'),db[_0x5723('0x1f')]['fn']('IF',db[_0x5723('0x1f')][_0x5723('0x23')](_0x5723('0x24')))),_0x5723('0x34')],[db[_0x5723('0x1f')]['fn'](_0x5723('0x20'),db[_0x5723('0x1f')]['fn']('IF',db['sequelize'][_0x5723('0x23')]('`state`\x20=\x205,\x201,\x20null'))),_0x5723('0x35')],[db[_0x5723('0x1f')]['fn']('COUNT',db[_0x5723('0x1f')]['fn']('IF',db[_0x5723('0x1f')][_0x5723('0x23')](_0x5723('0x36')))),_0x5723('0x37')],[db[_0x5723('0x1f')]['fn'](_0x5723('0x20'),db[_0x5723('0x1f')]['fn']('IF',db[_0x5723('0x1f')][_0x5723('0x23')](_0x5723('0x38')))),_0x5723('0x39')],[db['sequelize']['fn'](_0x5723('0x20'),db[_0x5723('0x1f')]['fn']('IF',db[_0x5723('0x1f')][_0x5723('0x23')](_0x5723('0x3a')))),_0x5723('0x3b')],[db[_0x5723('0x1f')]['fn'](_0x5723('0x20'),db[_0x5723('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x5723('0x3c')))),'outboundUnknownCallsDay'],[db[_0x5723('0x1f')]['fn'](_0x5723('0x20'),db[_0x5723('0x1f')]['fn']('IF',db['sequelize'][_0x5723('0x23')]('`state`\x20=\x2013,\x201,\x20null'))),_0x5723('0x3d')],[db[_0x5723('0x1f')]['fn'](_0x5723('0x20'),db['sequelize']['fn']('IF',db[_0x5723('0x1f')][_0x5723('0x23')](_0x5723('0x3e')))),'outboundOriginateFailureCallsDay'],[db[_0x5723('0x1f')]['fn'](_0x5723('0x20'),db[_0x5723('0x1f')]['fn']('IF',db[_0x5723('0x1f')][_0x5723('0x23')](_0x5723('0x3f')))),_0x5723('0x40')],[db[_0x5723('0x1f')]['fn'](_0x5723('0x20'),db[_0x5723('0x1f')]['fn']('IF',db[_0x5723('0x1f')]['literal'](_0x5723('0x41')))),_0x5723('0x42')],[db['sequelize']['fn'](_0x5723('0x20'),db[_0x5723('0x1f')]['fn']('IF',db[_0x5723('0x1f')][_0x5723('0x23')](_0x5723('0x43')))),_0x5723('0x40')],[db[_0x5723('0x1f')]['fn'](_0x5723('0x20'),db[_0x5723('0x1f')]['fn']('IF',db[_0x5723('0x1f')][_0x5723('0x23')](_0x5723('0x44')))),'outboundReCallsDay']],'group':[_0x5723('0x2f')]})[_0x5723('0xe')](function(_0x373275){logger[_0x5723('0x16')](_0x5723('0x2c'),_0x234005);logger[_0x5723('0x11')](_0x5723('0x2c'),_0x234005,JSON[_0x5723('0x12')](_0x373275));_0x313299(_0x373275);})[_0x5723('0x1c')](function(_0x301c56){logger[_0x5723('0x13')](_0x5723('0x2c'),_0x301c56[_0x5723('0x15')],_0x234005);_0x2c5288(_0xed908a['error'](0x1f4,_0x301c56[_0x5723('0x15')]));});});};exports[_0x5723('0x45')]=function(_0x3a94dc){var _0x3b8fb5=this;return new Promise(function(_0x4045cf,_0x9100f){return db[_0x5723('0x19')][_0x5723('0x2d')]({'raw':_0x3a94dc['options']?_0x3a94dc[_0x5723('0x1b')][_0x5723('0x1e')]===undefined?!![]:![]:!![],'where':_0x3a94dc[_0x5723('0x1b')]?_0x3a94dc[_0x5723('0x1b')][_0x5723('0x2e')]||null:null,'attributes':[[_0x5723('0x2f'),_0x5723('0x46')],[db[_0x5723('0x1f')]['fn'](_0x5723('0x20'),db[_0x5723('0x1f')][_0x5723('0x21')]('id')),'ivrTotalCallsDays'],[db[_0x5723('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x5723('0x24')))),_0x5723('0x47')]],'group':[_0x5723('0x2f')]})['then'](function(_0x427457){logger['info'](_0x5723('0x45'),_0x3a94dc);logger[_0x5723('0x11')](_0x5723('0x45'),_0x3a94dc,JSON['stringify'](_0x427457));_0x4045cf(_0x427457);})[_0x5723('0x1c')](function(_0x1ec1b2){logger[_0x5723('0x13')](_0x5723('0x45'),_0x1ec1b2[_0x5723('0x15')],_0x3a94dc);_0x9100f(_0x3b8fb5[_0x5723('0x13')](0x1f4,_0x1ec1b2[_0x5723('0x15')]));});});}; \ No newline at end of file +var _0x94ca=['name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CmHopperHistory','create','body','options','raw','then','CreateCmHopperHistory','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory'];(function(_0x46bec7,_0xc6e95f){var _0x46be32=function(_0x366044){while(--_0x366044){_0x46bec7['push'](_0x46bec7['shift']());}};_0x46be32(++_0xc6e95f);}(_0x94ca,0xde));var _0xa94c=function(_0xbbeaac,_0x2da9a0){_0xbbeaac=_0xbbeaac-0x0;var _0x11ca51=_0x94ca[_0xbbeaac];return _0x11ca51;};'use strict';var _=require(_0xa94c('0x0'));var util=require(_0xa94c('0x1'));var moment=require(_0xa94c('0x2'));var BPromise=require(_0xa94c('0x3'));var rs=require(_0xa94c('0x4'));var fs=require('fs');var Redis=require(_0xa94c('0x5'));var db=require(_0xa94c('0x6'))['db'];var utils=require(_0xa94c('0x7'));var logger=require(_0xa94c('0x8'))(_0xa94c('0x9'));var config=require(_0xa94c('0xa'));var jayson=require(_0xa94c('0xb'));var client=jayson[_0xa94c('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14111f,_0x14766b,_0x421883){return new BPromise(function(_0x46f724,_0x579f29){return client['request'](_0x14111f,_0x421883)['then'](function(_0x5dcf28){logger[_0xa94c('0xd')](_0xa94c('0xe'),_0x14766b,'request\x20sent');logger[_0xa94c('0xf')](_0xa94c('0x10'),_0x14766b,_0xa94c('0x11'),JSON[_0xa94c('0x12')](_0x5dcf28));if(_0x5dcf28[_0xa94c('0x13')]){if(_0x5dcf28[_0xa94c('0x13')]['code']===0x1f4){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x14766b,_0x5dcf28[_0xa94c('0x13')][_0xa94c('0x14')]);return _0x579f29(_0x5dcf28[_0xa94c('0x13')][_0xa94c('0x14')]);}logger[_0xa94c('0x13')](_0xa94c('0xe'),_0x14766b,_0x5dcf28[_0xa94c('0x13')][_0xa94c('0x14')]);return _0x46f724(_0x5dcf28[_0xa94c('0x13')]['message']);}else{logger[_0xa94c('0xd')](_0xa94c('0xe'),_0x14766b,_0xa94c('0x11'));_0x46f724(_0x5dcf28[_0xa94c('0x15')]['message']);}})[_0xa94c('0x16')](function(_0x2ff7aa){logger[_0xa94c('0x13')](_0xa94c('0xe'),_0x14766b,_0x2ff7aa);_0x579f29(_0x2ff7aa);});});}exports['CreateCmHopperHistory']=function(_0x4c9867){var _0xadb156=this;return new Promise(function(_0x2aadc3,_0x4cefe3){return db[_0xa94c('0x17')][_0xa94c('0x18')](_0x4c9867[_0xa94c('0x19')],{'raw':_0x4c9867[_0xa94c('0x1a')]?_0x4c9867[_0xa94c('0x1a')][_0xa94c('0x1b')]===undefined?!![]:![]:!![]})[_0xa94c('0x1c')](function(_0x3b925c){logger[_0xa94c('0xd')](_0xa94c('0x1d'),_0x4c9867);logger[_0xa94c('0xf')](_0xa94c('0x1d'),_0x4c9867,JSON[_0xa94c('0x12')](_0x3b925c));_0x2aadc3(_0x3b925c);})['catch'](function(_0x52f0db){logger['error']('CreateCmHopperHistory',_0x52f0db[_0xa94c('0x14')],_0x4c9867);_0x4cefe3(_0xadb156[_0xa94c('0x13')](0x1f4,_0x52f0db[_0xa94c('0x14')]));});});};exports['AvgHandleTime']=function(_0x2be2fe){var _0x3164e8=this;return new Promise(function(_0x102e4a,_0x48c9bd){return db['CmHopperHistory'][_0xa94c('0x1e')]({'raw':_0x2be2fe[_0xa94c('0x1a')]?_0x2be2fe[_0xa94c('0x1a')][_0xa94c('0x1b')]===undefined?!![]:![]:!![],'where':_0x2be2fe['options']?_0x2be2fe[_0xa94c('0x1a')][_0xa94c('0x1f')]||null:null,'attributes':[[db[_0xa94c('0x20')]['fn'](_0xa94c('0x21'),db['sequelize'][_0xa94c('0x22')]('id')),_0xa94c('0x23')],[db[_0xa94c('0x20')]['fn'](_0xa94c('0x21'),db[_0xa94c('0x20')]['fn']('IF',db[_0xa94c('0x20')][_0xa94c('0x24')](_0xa94c('0x25')))),_0xa94c('0x26')],[db[_0xa94c('0x20')]['fn']('COUNT',db[_0xa94c('0x20')]['fn']('IF',db[_0xa94c('0x20')][_0xa94c('0x24')](_0xa94c('0x27')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xa94c('0x20')]['fn']('COUNT',db[_0xa94c('0x20')]['fn']('IF',db['sequelize'][_0xa94c('0x24')](_0xa94c('0x28')))),_0xa94c('0x29')],[db[_0xa94c('0x20')]['fn'](_0xa94c('0x2a'),db['sequelize']['fn']('IF',db[_0xa94c('0x20')]['literal'](_0xa94c('0x2b')))),_0xa94c('0x2c')],[db[_0xa94c('0x20')]['fn']('AVG',db[_0xa94c('0x20')]['fn']('IF',db[_0xa94c('0x20')][_0xa94c('0x24')](_0xa94c('0x2d')))),_0xa94c('0x2e')]]})[_0xa94c('0x1c')](function(_0x3f57ae){logger[_0xa94c('0xd')](_0xa94c('0x2f'),_0x2be2fe);logger[_0xa94c('0xf')](_0xa94c('0x2f'),_0x2be2fe,JSON[_0xa94c('0x12')](_0x3f57ae));_0x102e4a(_0x3f57ae);})[_0xa94c('0x16')](function(_0x40116f){logger[_0xa94c('0x13')](_0xa94c('0x2f'),_0x40116f[_0xa94c('0x14')],_0x2be2fe);_0x48c9bd(_0x3164e8[_0xa94c('0x13')](0x1f4,_0x40116f[_0xa94c('0x14')]));});});};exports[_0xa94c('0x30')]=function(_0x32927f){var _0x48002d=this;return new Promise(function(_0x3354eb,_0x4f5ba8){return db['CmHopperHistory'][_0xa94c('0x1e')]({'raw':_0x32927f[_0xa94c('0x1a')]?_0x32927f[_0xa94c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x32927f[_0xa94c('0x1a')]?_0x32927f['options']['where']||null:null,'attributes':[[_0xa94c('0x31'),'name'],[db[_0xa94c('0x20')]['fn'](_0xa94c('0x21'),db[_0xa94c('0x20')]['fn']('IF',db[_0xa94c('0x20')][_0xa94c('0x24')](_0xa94c('0x32')))),_0xa94c('0x33')],[db[_0xa94c('0x20')]['fn'](_0xa94c('0x21'),db[_0xa94c('0x20')]['fn']('IF',db[_0xa94c('0x20')][_0xa94c('0x24')](_0xa94c('0x34')))),_0xa94c('0x35')],[db[_0xa94c('0x20')]['fn'](_0xa94c('0x21'),db[_0xa94c('0x20')]['fn']('IF',db[_0xa94c('0x20')][_0xa94c('0x24')](_0xa94c('0x25')))),'outboundAnswerCallsDay'],[db[_0xa94c('0x20')]['fn']('COUNT',db[_0xa94c('0x20')]['fn']('IF',db[_0xa94c('0x20')][_0xa94c('0x24')]('`state`\x20=\x205,\x201,\x20null'))),_0xa94c('0x36')],[db['sequelize']['fn']('COUNT',db[_0xa94c('0x20')]['fn']('IF',db['sequelize'][_0xa94c('0x24')](_0xa94c('0x37')))),_0xa94c('0x38')],[db[_0xa94c('0x20')]['fn'](_0xa94c('0x21'),db[_0xa94c('0x20')]['fn']('IF',db[_0xa94c('0x20')][_0xa94c('0x24')](_0xa94c('0x39')))),'outboundDropCallsDayTimeout'],[db[_0xa94c('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xa94c('0x24')](_0xa94c('0x3a')))),_0xa94c('0x3b')],[db[_0xa94c('0x20')]['fn']('COUNT',db[_0xa94c('0x20')]['fn']('IF',db[_0xa94c('0x20')][_0xa94c('0x24')](_0xa94c('0x3c')))),_0xa94c('0x3d')],[db[_0xa94c('0x20')]['fn'](_0xa94c('0x21'),db['sequelize']['fn']('IF',db[_0xa94c('0x20')][_0xa94c('0x24')](_0xa94c('0x3e')))),_0xa94c('0x3f')],[db[_0xa94c('0x20')]['fn'](_0xa94c('0x21'),db[_0xa94c('0x20')]['fn']('IF',db['sequelize'][_0xa94c('0x24')]('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db[_0xa94c('0x20')]['fn'](_0xa94c('0x21'),db[_0xa94c('0x20')]['fn']('IF',db[_0xa94c('0x20')][_0xa94c('0x24')]('`state`\x20=\x2018,\x201,\x20null'))),_0xa94c('0x40')],[db[_0xa94c('0x20')]['fn'](_0xa94c('0x21'),db['sequelize']['fn']('IF',db[_0xa94c('0x20')][_0xa94c('0x24')](_0xa94c('0x41')))),_0xa94c('0x42')],[db[_0xa94c('0x20')]['fn'](_0xa94c('0x21'),db[_0xa94c('0x20')]['fn']('IF',db[_0xa94c('0x20')][_0xa94c('0x24')](_0xa94c('0x43')))),_0xa94c('0x40')],[db[_0xa94c('0x20')]['fn'](_0xa94c('0x21'),db[_0xa94c('0x20')]['fn']('IF',db[_0xa94c('0x20')][_0xa94c('0x24')](_0xa94c('0x44')))),'outboundReCallsDay']],'group':[_0xa94c('0x31')]})['then'](function(_0x26a231){logger['info'](_0xa94c('0x30'),_0x32927f);logger[_0xa94c('0xf')](_0xa94c('0x30'),_0x32927f,JSON['stringify'](_0x26a231));_0x3354eb(_0x26a231);})[_0xa94c('0x16')](function(_0x40330a){logger['error']('GetVoiceQueueHopperHistory',_0x40330a[_0xa94c('0x14')],_0x32927f);_0x4f5ba8(_0x48002d[_0xa94c('0x13')](0x1f4,_0x40330a[_0xa94c('0x14')]));});});};exports[_0xa94c('0x45')]=function(_0x121ebd){var _0xd220bc=this;return new Promise(function(_0x205b42,_0x4f48a1){return db['CmHopperHistory'][_0xa94c('0x1e')]({'raw':_0x121ebd[_0xa94c('0x1a')]?_0x121ebd[_0xa94c('0x1a')][_0xa94c('0x1b')]===undefined?!![]:![]:!![],'where':_0x121ebd[_0xa94c('0x1a')]?_0x121ebd[_0xa94c('0x1a')][_0xa94c('0x1f')]||null:null,'attributes':[[_0xa94c('0x31'),_0xa94c('0x46')],[db[_0xa94c('0x20')]['fn'](_0xa94c('0x21'),db[_0xa94c('0x20')][_0xa94c('0x22')]('id')),_0xa94c('0x47')],[db[_0xa94c('0x20')]['fn'](_0xa94c('0x21'),db[_0xa94c('0x20')]['fn']('IF',db[_0xa94c('0x20')][_0xa94c('0x24')]('`state`\x20=\x204,\x201,\x20null'))),_0xa94c('0x48')]],'group':['campaign']})[_0xa94c('0x1c')](function(_0x4a3a36){logger[_0xa94c('0xd')](_0xa94c('0x45'),_0x121ebd);logger[_0xa94c('0xf')](_0xa94c('0x45'),_0x121ebd,JSON[_0xa94c('0x12')](_0x4a3a36));_0x205b42(_0x4a3a36);})[_0xa94c('0x16')](function(_0xa499e9){logger[_0xa94c('0x13')]('GetCampaignHopperHistory',_0xa499e9[_0xa94c('0x14')],_0x121ebd);_0x4f48a1(_0xd220bc[_0xa94c('0x13')](0x1f4,_0xa499e9[_0xa94c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 0b8c165..6290221 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 _0x5306=['get','/describe','isAuthenticated','/:id','show','post','create','put','update','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x5306,0xbe));var _0x6530=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5306[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x6530('0x0'));var util=require('util');var path=require(_0x6530('0x1'));var timeout=require(_0x6530('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6530('0x3'));var interaction=require(_0x6530('0x4'));var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6530('0x5')](_0x6530('0x6'),auth[_0x6530('0x7')](),controller['describe']);router['get'](_0x6530('0x8'),auth['isAuthenticated'](),controller[_0x6530('0x9')]);router[_0x6530('0xa')]('/',auth[_0x6530('0x7')](),controller[_0x6530('0xb')]);router[_0x6530('0xc')]('/:id',auth[_0x6530('0x7')](),controller[_0x6530('0xd')]);module[_0x6530('0xe')]=router; \ No newline at end of file +var _0xf6d6=['./cmHopperHistory.controller','get','index','/describe','isAuthenticated','describe','/:id','create','put','update','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x2442b0,_0x21aca4){var _0x691afd=function(_0x2217d5){while(--_0x2217d5){_0x2442b0['push'](_0x2442b0['shift']());}};_0x691afd(++_0x21aca4);}(_0xf6d6,0x1a9));var _0x6f6d=function(_0x2d654a,_0x1c6ee0){_0x2d654a=_0x2d654a-0x0;var _0x1444d8=_0xf6d6[_0x2d654a];return _0x1444d8;};'use strict';var multer=require(_0x6f6d('0x0'));var util=require(_0x6f6d('0x1'));var path=require('path');var timeout=require(_0x6f6d('0x2'));var express=require(_0x6f6d('0x3'));var router=express[_0x6f6d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6f6d('0x5'));var config=require(_0x6f6d('0x6'));var controller=require(_0x6f6d('0x7'));router[_0x6f6d('0x8')]('/',auth['isAuthenticated'](),controller[_0x6f6d('0x9')]);router[_0x6f6d('0x8')](_0x6f6d('0xa'),auth[_0x6f6d('0xb')](),controller[_0x6f6d('0xc')]);router[_0x6f6d('0x8')](_0x6f6d('0xd'),auth[_0x6f6d('0xb')](),controller['show']);router['post']('/',auth[_0x6f6d('0xb')](),controller[_0x6f6d('0xe')]);router[_0x6f6d('0xf')](_0x6f6d('0xd'),auth['isAuthenticated'](),controller[_0x6f6d('0x10')]);module[_0x6f6d('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index a0a77f5..12559d9 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 _0x9009=['sequelize','STRING','name'];(function(_0xee5d2a,_0x534134){var _0x346948=function(_0x458fdf){while(--_0x458fdf){_0xee5d2a['push'](_0xee5d2a['shift']());}};_0x346948(++_0x534134);}(_0x9009,0x1d4));var _0x9900=function(_0x22c34e,_0x315d87){_0x22c34e=_0x22c34e-0x0;var _0x1d1d3f=_0x9009[_0x22c34e];return _0x1d1d3f;};'use strict';var Sequelize=require(_0x9900('0x0'));module['exports']={'name':{'type':Sequelize[_0x9900('0x1')],'unique':_0x9900('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x9900('0x1')]}}; \ No newline at end of file +var _0xf8b2=['STRING','name','sequelize','exports'];(function(_0xdfb302,_0x3056b0){var _0x4c7735=function(_0x2d29cc){while(--_0x2d29cc){_0xdfb302['push'](_0xdfb302['shift']());}};_0x4c7735(++_0x3056b0);}(_0xf8b2,0x15e));var _0x2f8b=function(_0x2aeb58,_0x575b09){_0x2aeb58=_0x2aeb58-0x0;var _0x1f5acc=_0xf8b2[_0x2aeb58];return _0x1f5acc;};'use strict';var Sequelize=require(_0x2f8b('0x0'));module[_0x2f8b('0x1')]={'name':{'type':Sequelize[_0x2f8b('0x2')],'unique':_0x2f8b('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2f8b('0x2')]},'dialPrefix':{'type':Sequelize[_0x2f8b('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index b27b4fa..71cc93d 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 _0xc467=['describe','addDisposition','ListId','findOne','Disposition','hasOwnProperty','order','pick','removeDispositions','ids','tags','isArray','join','push','each','CmContact','omit','dataValues','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContacts','getContactsCsv','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','Content-type','download','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','undefined','offset','count','limit','set','apply','reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','model','keys','filters','query','attributes','intersection','fields','length','nolimit','sort','where','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Lists','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params'];(function(_0x1ac998,_0x2673cf){var _0x8e2640=function(_0x434e5c){while(--_0x434e5c){_0x1ac998['push'](_0x1ac998['shift']());}};_0x8e2640(++_0x2673cf);}(_0xc467,0xcb));var _0x7c46=function(_0x421eeb,_0x3d3e3e){_0x421eeb=_0x421eeb-0x0;var _0x2c7371=_0xc467[_0x421eeb];return _0x2c7371;};'use strict';var emlformat=require(_0x7c46('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7c46('0x1'));var rp=require(_0x7c46('0x2'));var moment=require(_0x7c46('0x3'));var BPromise=require(_0x7c46('0x4'));var Mustache=require('mustache');var util=require(_0x7c46('0x5'));var path=require(_0x7c46('0x6'));var sox=require(_0x7c46('0x7'));var csv=require(_0x7c46('0x8'));var ejs=require(_0x7c46('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7c46('0xa'));var crypto=require(_0x7c46('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7c46('0xc'));var toCsv=require(_0x7c46('0x8'));var querystring=require(_0x7c46('0xd'));var Papa=require(_0x7c46('0xe'));var Redis=require('ioredis');var authService=require(_0x7c46('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7c46('0x10'));var hardwareService=require(_0x7c46('0x11'));var logger=require(_0x7c46('0x12'))(_0x7c46('0x13'));var utils=require(_0x7c46('0x14'));var config=require(_0x7c46('0x15'));var licenseUtil=require(_0x7c46('0x16'));var db=require(_0x7c46('0x17'))['db'];config[_0x7c46('0x18')]=_[_0x7c46('0x19')](config['redis'],{'host':_0x7c46('0x1a'),'port':0x18eb});var socket=require(_0x7c46('0x1b'))(new Redis(config[_0x7c46('0x18')]));require(_0x7c46('0x1c'))[_0x7c46('0x1d')](socket);function respondWithStatusCode(_0x5e3fbe,_0xf61b5f){_0xf61b5f=_0xf61b5f||0xcc;return function(_0x30e9cd){if(_0x30e9cd){return _0x5e3fbe[_0x7c46('0x1e')](_0xf61b5f);}return _0x5e3fbe[_0x7c46('0x1f')](_0xf61b5f)[_0x7c46('0x20')]();};}function respondWithResult(_0x1422e6,_0x3a5950){_0x3a5950=_0x3a5950||0xc8;return function(_0x14a095){if(_0x14a095){return _0x1422e6[_0x7c46('0x1f')](_0x3a5950)[_0x7c46('0x21')](_0x14a095);}};}function respondWithFilteredResult(_0x29a8db,_0x43c432){return function(_0x452011){if(_0x452011){var _0x259ff7=typeof _0x43c432['offset']==='undefined'&&typeof _0x43c432['limit']===_0x7c46('0x22');var _0x456382=_0x452011['count'];var _0x14488a=_0x259ff7?0x0:_0x43c432[_0x7c46('0x23')];var _0x3bb99e=_0x259ff7?_0x452011[_0x7c46('0x24')]:_0x43c432[_0x7c46('0x23')]+_0x43c432[_0x7c46('0x25')];var _0x2da8f7;if(_0x3bb99e>=_0x456382){_0x3bb99e=_0x456382;_0x2da8f7=0xc8;}else{_0x2da8f7=0xce;}_0x29a8db[_0x7c46('0x1f')](_0x2da8f7);return _0x29a8db[_0x7c46('0x26')]('Content-Range',_0x14488a+'-'+_0x3bb99e+'/'+_0x456382)[_0x7c46('0x21')](_0x452011);}return null;};}function patchUpdates(_0x56633a){return function(_0x2ece74){try{jsonpatch[_0x7c46('0x27')](_0x2ece74,_0x56633a,!![]);}catch(_0x17cc28){return BPromise[_0x7c46('0x28')](_0x17cc28);}return _0x2ece74[_0x7c46('0x29')]();};}function saveUpdates(_0x25fb7e,_0x63f9de){return function(_0x2806f9){if(_0x2806f9){return _0x2806f9[_0x7c46('0x2a')](_0x25fb7e)['then'](function(_0x832650){return _0x832650;});}return null;};}function removeEntity(_0x723677,_0x5a36c6){return function(_0x21bae6){if(_0x21bae6){return _0x21bae6[_0x7c46('0x2b')]()[_0x7c46('0x2c')](function(){var _0x459370=_0x21bae6[_0x7c46('0x2d')]({'plain':!![]});var _0x1c5f0f='Lists';return db[_0x7c46('0x2e')][_0x7c46('0x2b')]({'where':{'type':_0x1c5f0f,'resourceId':_0x459370['id']}})[_0x7c46('0x2c')](function(){return _0x21bae6;});})[_0x7c46('0x2c')](function(){_0x723677[_0x7c46('0x1f')](0xcc)[_0x7c46('0x20')]();});}};}function handleEntityNotFound(_0x5481b6,_0x1a6f36){return function(_0x532ea9){if(!_0x532ea9){_0x5481b6[_0x7c46('0x1e')](0x194);}return _0x532ea9;};}function handleError(_0x408175,_0x624408){_0x624408=_0x624408||0x1f4;return function(_0x591193){logger[_0x7c46('0x2f')](_0x591193[_0x7c46('0x30')]);if(_0x591193[_0x7c46('0x31')]){delete _0x591193[_0x7c46('0x31')];}_0x408175[_0x7c46('0x1f')](_0x624408)[_0x7c46('0x32')](_0x591193);};}exports[_0x7c46('0x33')]=function(_0x14d447,_0x4dccd7){var _0x274b2f={},_0xa43da6={},_0x4c2957={'count':0x0,'rows':[]};var _0x590ac0=_[_0x7c46('0x34')](db[_0x7c46('0x35')][_0x7c46('0x36')],function(_0x450ffa){return{'name':_0x450ffa[_0x7c46('0x37')],'type':_0x450ffa[_0x7c46('0x38')]['key']};});_0xa43da6[_0x7c46('0x39')]=_[_0x7c46('0x34')](_0x590ac0,_0x7c46('0x31'));_0xa43da6['query']=_[_0x7c46('0x3a')](_0x14d447['query']);_0xa43da6[_0x7c46('0x3b')]=_['intersection'](_0xa43da6[_0x7c46('0x39')],_0xa43da6[_0x7c46('0x3c')]);_0x274b2f[_0x7c46('0x3d')]=_[_0x7c46('0x3e')](_0xa43da6[_0x7c46('0x39')],qs[_0x7c46('0x3f')](_0x14d447[_0x7c46('0x3c')][_0x7c46('0x3f')]));_0x274b2f['attributes']=_0x274b2f[_0x7c46('0x3d')][_0x7c46('0x40')]?_0x274b2f[_0x7c46('0x3d')]:_0xa43da6[_0x7c46('0x39')];if(!_0x14d447[_0x7c46('0x3c')]['hasOwnProperty'](_0x7c46('0x41'))){_0x274b2f[_0x7c46('0x25')]=qs[_0x7c46('0x25')](_0x14d447[_0x7c46('0x3c')]['limit']);_0x274b2f[_0x7c46('0x23')]=qs[_0x7c46('0x23')](_0x14d447[_0x7c46('0x3c')][_0x7c46('0x23')]);}_0x274b2f['order']=qs['sort'](_0x14d447[_0x7c46('0x3c')][_0x7c46('0x42')]);_0x274b2f[_0x7c46('0x43')]=qs[_0x7c46('0x3b')](_['pick'](_0x14d447[_0x7c46('0x3c')],_0xa43da6['filters']),_0x590ac0);if(_0x14d447['query']['filter']){_0x274b2f['where']=_[_0x7c46('0x44')](_0x274b2f['where'],{'$or':_[_0x7c46('0x34')](_0x590ac0,function(_0x5ec9cc){if(_0x5ec9cc[_0x7c46('0x38')]!==_0x7c46('0x45')){var _0x27d74e={};_0x27d74e[_0x5ec9cc['name']]={'$like':'%'+_0x14d447['query'][_0x7c46('0x46')]+'%'};return _0x27d74e;}})});}_0x274b2f=_[_0x7c46('0x44')]({},_0x274b2f,_0x14d447['options']);var _0x440d08={'where':_0x274b2f[_0x7c46('0x43')]};return db[_0x7c46('0x35')][_0x7c46('0x24')](_0x440d08)[_0x7c46('0x2c')](function(_0x2351e9){_0x4c2957[_0x7c46('0x24')]=_0x2351e9;if(_0x14d447[_0x7c46('0x3c')][_0x7c46('0x47')]){_0x274b2f['include']=[{'all':!![]}];}return db[_0x7c46('0x35')][_0x7c46('0x48')](_0x274b2f);})[_0x7c46('0x2c')](function(_0x137f5a){_0x4c2957[_0x7c46('0x49')]=_0x137f5a;return _0x4c2957;})[_0x7c46('0x2c')](respondWithFilteredResult(_0x4dccd7,_0x274b2f))[_0x7c46('0x4a')](handleError(_0x4dccd7,null));};exports[_0x7c46('0x4b')]=function(_0xef0984,_0x5cf540){var _0x2cd95c={'raw':![],'where':{'id':_0xef0984['params']['id']}},_0x1d4304={};_0x1d4304['model']=_['keys'](db[_0x7c46('0x35')][_0x7c46('0x36')]);_0x1d4304[_0x7c46('0x3c')]=_['keys'](_0xef0984[_0x7c46('0x3c')]);_0x1d4304[_0x7c46('0x3b')]=_[_0x7c46('0x3e')](_0x1d4304[_0x7c46('0x39')],_0x1d4304[_0x7c46('0x3c')]);_0x2cd95c[_0x7c46('0x3d')]=_[_0x7c46('0x3e')](_0x1d4304['model'],qs['fields'](_0xef0984['query']['fields']));_0x2cd95c[_0x7c46('0x3d')]=_0x2cd95c[_0x7c46('0x3d')][_0x7c46('0x40')]?_0x2cd95c['attributes']:_0x1d4304[_0x7c46('0x39')];if(_0xef0984[_0x7c46('0x3c')]['includeAll']){_0x2cd95c[_0x7c46('0x4c')]=[{'all':!![]}];}_0x2cd95c=_[_0x7c46('0x44')]({},_0x2cd95c,_0xef0984[_0x7c46('0x4d')]);return db[_0x7c46('0x35')][_0x7c46('0x4e')](_0x2cd95c)[_0x7c46('0x2c')](handleEntityNotFound(_0x5cf540,null))[_0x7c46('0x2c')](respondWithResult(_0x5cf540,null))[_0x7c46('0x4a')](handleError(_0x5cf540,null));};exports[_0x7c46('0x4f')]=function(_0x12977a,_0x47f657){return db[_0x7c46('0x35')][_0x7c46('0x4f')](_0x12977a[_0x7c46('0x50')],{})[_0x7c46('0x2c')](function(_0x40cc93){var _0x3ee782=_0x12977a[_0x7c46('0x51')]['get']({'plain':!![]});if(!_0x3ee782)throw new Error(_0x7c46('0x52'));if(_0x3ee782['role']==='user'){var _0x810f0d=_0x40cc93[_0x7c46('0x2d')]({'plain':!![]});var _0x58d09c=_0x7c46('0x53');return db[_0x7c46('0x54')][_0x7c46('0x4e')]({'where':{'name':_0x58d09c,'userProfileId':_0x3ee782['userProfileId']},'raw':!![]})[_0x7c46('0x2c')](function(_0x4d0b14){if(_0x4d0b14&&_0x4d0b14['autoAssociation']===0x0){return db[_0x7c46('0x2e')][_0x7c46('0x4f')]({'name':_0x810f0d[_0x7c46('0x31')],'resourceId':_0x810f0d['id'],'type':_0x4d0b14[_0x7c46('0x31')],'sectionId':_0x4d0b14['id']},{})['then'](function(){return _0x40cc93;});}else{return _0x40cc93;}})[_0x7c46('0x4a')](function(_0x2e7e3f){logger[_0x7c46('0x2f')](_0x7c46('0x55'),_0x2e7e3f);throw _0x2e7e3f;});}return _0x40cc93;})[_0x7c46('0x2c')](respondWithResult(_0x47f657,0xc9))[_0x7c46('0x4a')](handleError(_0x47f657,null));};exports[_0x7c46('0x2a')]=function(_0x1dd3b8,_0x507c5a){if(_0x1dd3b8['body']['id']){delete _0x1dd3b8['body']['id'];}return db['CmList']['find']({'where':{'id':_0x1dd3b8[_0x7c46('0x56')]['id']}})[_0x7c46('0x2c')](handleEntityNotFound(_0x507c5a,null))[_0x7c46('0x2c')](saveUpdates(_0x1dd3b8[_0x7c46('0x50')],null))[_0x7c46('0x2c')](respondWithResult(_0x507c5a,null))[_0x7c46('0x4a')](handleError(_0x507c5a,null));};exports['destroy']=function(_0xec7bcf,_0x32fe2a){return db[_0x7c46('0x35')][_0x7c46('0x4e')]({'where':{'id':_0xec7bcf[_0x7c46('0x56')]['id']}})[_0x7c46('0x2c')](handleEntityNotFound(_0x32fe2a,null))[_0x7c46('0x2c')](removeEntity(_0x32fe2a,null))['catch'](handleError(_0x32fe2a,null));};exports[_0x7c46('0x57')]=function(_0x1bbe94,_0x3bd8c1){return db['CmList']['describe']()[_0x7c46('0x2c')](respondWithResult(_0x3bd8c1,null))[_0x7c46('0x4a')](handleError(_0x3bd8c1,null));};exports[_0x7c46('0x58')]=function(_0x4848e2,_0x426451,_0x3c5a1f){if(_0x4848e2['body']['id']){delete _0x4848e2[_0x7c46('0x50')]['id'];}return db['CmList'][_0x7c46('0x4e')]({'where':{'id':_0x4848e2[_0x7c46('0x56')]['id']}})[_0x7c46('0x2c')](handleEntityNotFound(_0x426451,null))[_0x7c46('0x2c')](function(_0x566114){if(_0x566114){_0x4848e2[_0x7c46('0x50')][_0x7c46('0x59')]=_0x566114['id'];return db['Disposition'][_0x7c46('0x4f')](_0x4848e2[_0x7c46('0x50')]);}})[_0x7c46('0x2c')](respondWithResult(_0x426451,null))['catch'](handleError(_0x426451,null));};exports['getDispositions']=function(_0x4f119a,_0x52383e,_0xc3caea){var _0x16ac88={'raw':![],'where':{}};var _0x582a17={};var _0x4f45a5={'count':0x0,'rows':[]};return db[_0x7c46('0x35')][_0x7c46('0x5a')]({'where':{'id':_0x4f119a['params']['id']}})[_0x7c46('0x2c')](handleEntityNotFound(_0x52383e,null))[_0x7c46('0x2c')](function(_0x24855d){if(_0x24855d){_0x582a17['model']=_['keys'](db[_0x7c46('0x5b')][_0x7c46('0x36')]);_0x582a17[_0x7c46('0x3c')]=_['keys'](_0x4f119a[_0x7c46('0x3c')]);_0x582a17[_0x7c46('0x3b')]=_['intersection'](_0x582a17[_0x7c46('0x39')],_0x582a17[_0x7c46('0x3c')]);_0x16ac88[_0x7c46('0x3d')]=_[_0x7c46('0x3e')](_0x582a17[_0x7c46('0x39')],qs[_0x7c46('0x3f')](_0x4f119a[_0x7c46('0x3c')][_0x7c46('0x3f')]));_0x16ac88[_0x7c46('0x3d')]=_0x16ac88[_0x7c46('0x3d')][_0x7c46('0x40')]?_0x16ac88[_0x7c46('0x3d')]:_0x582a17[_0x7c46('0x39')];if(!_0x4f119a[_0x7c46('0x3c')][_0x7c46('0x5c')](_0x7c46('0x41'))){_0x16ac88[_0x7c46('0x25')]=qs[_0x7c46('0x25')](_0x4f119a[_0x7c46('0x3c')][_0x7c46('0x25')]);_0x16ac88[_0x7c46('0x23')]=qs[_0x7c46('0x23')](_0x4f119a[_0x7c46('0x3c')][_0x7c46('0x23')]);}_0x16ac88[_0x7c46('0x5d')]=qs[_0x7c46('0x42')](_0x4f119a[_0x7c46('0x3c')][_0x7c46('0x42')]);_0x16ac88[_0x7c46('0x43')]=qs[_0x7c46('0x3b')](_[_0x7c46('0x5e')](_0x4f119a['query'],_0x582a17[_0x7c46('0x3b')]));_0x16ac88[_0x7c46('0x43')]['ListId']=_0x24855d['id'];if(_0x4f119a['query'][_0x7c46('0x46')]){_0x16ac88['where']=_[_0x7c46('0x44')](_0x16ac88[_0x7c46('0x43')],{'$or':_[_0x7c46('0x34')](_0x16ac88['attributes'],function(_0x2303ea){var _0x44a3df={};_0x44a3df[_0x2303ea]={'$like':'%'+_0x4f119a[_0x7c46('0x3c')][_0x7c46('0x46')]+'%'};return _0x44a3df;})});}_0x16ac88=_[_0x7c46('0x44')]({},_0x16ac88,_0x4f119a[_0x7c46('0x4d')]);return db[_0x7c46('0x5b')]['count']({'where':_0x16ac88[_0x7c46('0x43')]})[_0x7c46('0x2c')](function(_0x3f337c){_0x4f45a5[_0x7c46('0x24')]=_0x3f337c;if(_0x4f119a[_0x7c46('0x3c')]['includeAll']){_0x16ac88[_0x7c46('0x4c')]=[{'all':!![]}];}return db[_0x7c46('0x5b')][_0x7c46('0x48')](_0x16ac88);})[_0x7c46('0x2c')](function(_0x960980){_0x4f45a5['rows']=_0x960980;return _0x4f45a5;});}})[_0x7c46('0x2c')](respondWithFilteredResult(_0x52383e,_0x16ac88))[_0x7c46('0x4a')](handleError(_0x52383e,null));};exports[_0x7c46('0x5f')]=function(_0x6fed19,_0x1ea9f3,_0x3421af){return db[_0x7c46('0x35')]['find']({'where':{'id':_0x6fed19[_0x7c46('0x56')]['id']}})['then'](handleEntityNotFound(_0x1ea9f3,null))[_0x7c46('0x2c')](function(_0x11a2fb){if(_0x11a2fb){return _0x11a2fb['removeDispositions'](_0x6fed19[_0x7c46('0x3c')][_0x7c46('0x60')]);}})[_0x7c46('0x2c')](respondWithStatusCode(_0x1ea9f3,null))[_0x7c46('0x4a')](handleError(_0x1ea9f3,null));};exports['addContacts']=function(_0x1b51e9,_0x45f1c3,_0x24f9c6){return db[_0x7c46('0x35')][_0x7c46('0x4e')]({'where':{'id':_0x1b51e9[_0x7c46('0x56')]['id']}})['then'](handleEntityNotFound(_0x45f1c3,null))[_0x7c46('0x2c')](function(_0x12b708){if(_0x12b708){var _0x31cf2c=[];var _0x172f2a={'success':[],'errors':[]};return db['CmContact'][_0x7c46('0x57')]()[_0x7c46('0x2c')](function(_0x5673b3){if(_0x1b51e9[_0x7c46('0x50')][_0x7c46('0x61')]&&_[_0x7c46('0x62')](_0x1b51e9[_0x7c46('0x50')]['tags'])){if(_0x1b51e9[_0x7c46('0x50')]['tags'][_0x7c46('0x40')]){_0x1b51e9[_0x7c46('0x50')][_0x7c46('0x61')]=_0x1b51e9['body']['tags'][_0x7c46('0x63')](';')+';';}else{_0x1b51e9[_0x7c46('0x50')][_0x7c46('0x61')]=null;}}else{_0x1b51e9['body']['tags']=null;}if(_0x1b51e9[_0x7c46('0x50')]&&_[_0x7c46('0x62')](_0x1b51e9[_0x7c46('0x50')])){for(var _0x1fd46c=0x0;_0x1fd46c<_0x1b51e9[_0x7c46('0x50')][_0x7c46('0x40')];_0x1fd46c+=0x1){_0x1b51e9[_0x7c46('0x50')][_0x1fd46c][_0x7c46('0x59')]=_0x1b51e9[_0x7c46('0x56')]['id'];_0x31cf2c[_0x7c46('0x64')](_0x1b51e9[_0x7c46('0x50')][_0x1fd46c]);}return BPromise[_0x7c46('0x65')](_0x31cf2c,function(_0x455257){return db[_0x7c46('0x66')][_0x7c46('0x4f')](_[_0x7c46('0x67')](_0x455257,['ids','id'])||{},{'fields':_['keys'](_0x5673b3),'raw':!![]})['then'](function(_0x843ea7){_0x172f2a['success']['push'](_0x843ea7[_0x7c46('0x68')]);})[_0x7c46('0x4a')](function(_0x115685){_0x172f2a['errors'][_0x7c46('0x64')]({'data':_0x455257,'error':_0x115685['message']});});})[_0x7c46('0x2c')](function(_0x4de158){return _0x172f2a;})[_0x7c46('0x4a')](function(_0x54acf0){return _0x54acf0;});}else{_0x45f1c3[_0x7c46('0x1f')](0x190)[_0x7c46('0x21')]({'message':_0x7c46('0x69')});}});}})['then'](respondWithResult(_0x45f1c3,null))[_0x7c46('0x4a')](handleError(_0x45f1c3,null));};exports['getContacts']=function(_0x4a686f,_0x2faca8,_0x35cc68){var _0x26f987;return db[_0x7c46('0x35')]['find']({'where':{'id':_0x4a686f['params']['id']},'include':[{'model':db[_0x7c46('0x6a')],'as':_0x7c46('0x6b')}]})[_0x7c46('0x2c')](handleEntityNotFound(_0x2faca8,null))[_0x7c46('0x2c')](function(_0x2f28c5){if(_0x2f28c5){_0x26f987=_0x2f28c5;return db['CmContact'][_0x7c46('0x36')];}})[_0x7c46('0x2c')](function(_0x3b1f8b){if(_0x3b1f8b){var _0x5c7d39={};var _0x1ea333={};_0x1ea333[_0x7c46('0x39')]=_[_0x7c46('0x6c')](_[_0x7c46('0x3a')](_0x3b1f8b),_[_0x7c46('0x34')](_0x26f987[_0x7c46('0x6b')],function(_0x5d0afb){return util[_0x7c46('0x6d')](_0x7c46('0x6e'),_0x5d0afb['id']);}));_0x1ea333[_0x7c46('0x3c')]=_['keys'](_0x4a686f[_0x7c46('0x3c')]);_0x1ea333[_0x7c46('0x3b')]=_[_0x7c46('0x3e')](_0x1ea333[_0x7c46('0x39')],_0x1ea333[_0x7c46('0x3c')]);_0x5c7d39['attributes']=_[_0x7c46('0x3e')](_0x1ea333[_0x7c46('0x39')],qs[_0x7c46('0x3f')](_0x4a686f[_0x7c46('0x3c')][_0x7c46('0x3f')]));_0x5c7d39[_0x7c46('0x3d')]=_0x5c7d39[_0x7c46('0x3d')][_0x7c46('0x40')]?_0x5c7d39[_0x7c46('0x3d')]:_0x1ea333['model'];if(!_0x4a686f[_0x7c46('0x3c')]['hasOwnProperty'](_0x7c46('0x41'))){_0x5c7d39[_0x7c46('0x25')]=qs[_0x7c46('0x25')](_0x4a686f[_0x7c46('0x3c')][_0x7c46('0x25')]);_0x5c7d39[_0x7c46('0x23')]=qs[_0x7c46('0x23')](_0x4a686f['query']['offset']);}_0x5c7d39[_0x7c46('0x5d')]=qs['sort'](_0x4a686f[_0x7c46('0x3c')][_0x7c46('0x42')]);_0x5c7d39[_0x7c46('0x43')]=qs[_0x7c46('0x3b')](_[_0x7c46('0x5e')](_0x4a686f[_0x7c46('0x3c')],_0x1ea333[_0x7c46('0x3b')]));_0x5c7d39[_0x7c46('0x6f')]=!![];if(_0x4a686f[_0x7c46('0x3c')][_0x7c46('0x46')]){_0x5c7d39[_0x7c46('0x43')]=_[_0x7c46('0x44')](_0x5c7d39['where'],{'$or':_[_0x7c46('0x34')](_0x5c7d39[_0x7c46('0x3d')],function(_0x19b8e5){var _0x1abcde={};_0x1abcde[_0x19b8e5]={'$like':'%'+_0x4a686f['query'][_0x7c46('0x46')]+'%'};return _0x1abcde;})});}_0x5c7d39=_['merge']({},_0x5c7d39,_0x4a686f[_0x7c46('0x4d')]);return _0x26f987[_0x7c46('0x70')](_0x5c7d39);}})[_0x7c46('0x2c')](respondWithResult(_0x2faca8,null))[_0x7c46('0x4a')](handleError(_0x2faca8,null));};exports[_0x7c46('0x71')]=function(_0x24fde4,_0x3f104f,_0x285dcb){var _0x168e91;return db[_0x7c46('0x35')][_0x7c46('0x4e')]({'where':{'id':_0x24fde4[_0x7c46('0x56')]['id']},'include':[{'model':db[_0x7c46('0x6a')],'as':_0x7c46('0x6b')}]})[_0x7c46('0x2c')](handleEntityNotFound(_0x3f104f,null))[_0x7c46('0x2c')](function(_0x24855e){if(_0x24855e){_0x168e91=_0x24855e;return db[_0x7c46('0x66')]['rawAttributes'];}})[_0x7c46('0x2c')](function(_0x60ec76){if(_0x60ec76){var _0x2a99f7={};var _0x26ca73={};_0x26ca73[_0x7c46('0x39')]=_[_0x7c46('0x6c')](_[_0x7c46('0x3a')](_0x60ec76),_[_0x7c46('0x34')](_0x168e91[_0x7c46('0x6b')],function(_0x4a9bfc){return util[_0x7c46('0x6d')](_0x7c46('0x6e'),_0x4a9bfc['id']);}));_0x26ca73['query']=_['keys'](_0x24fde4['query']);_0x26ca73[_0x7c46('0x3b')]=_[_0x7c46('0x3e')](_0x26ca73[_0x7c46('0x39')],_0x26ca73['query']);_0x2a99f7[_0x7c46('0x3d')]=_[_0x7c46('0x3e')](_0x26ca73['model'],qs[_0x7c46('0x3f')](_0x24fde4[_0x7c46('0x3c')][_0x7c46('0x3f')]));_0x2a99f7['attributes']=_0x2a99f7[_0x7c46('0x3d')][_0x7c46('0x40')]?_0x2a99f7['attributes']:_0x26ca73[_0x7c46('0x39')];if(!_0x24fde4[_0x7c46('0x3c')][_0x7c46('0x5c')](_0x7c46('0x41'))){_0x2a99f7[_0x7c46('0x25')]=qs['limit'](_0x24fde4[_0x7c46('0x3c')]['limit']);_0x2a99f7[_0x7c46('0x23')]=qs['offset'](_0x24fde4[_0x7c46('0x3c')]['offset']);}_0x2a99f7[_0x7c46('0x5d')]=qs['sort'](_0x24fde4[_0x7c46('0x3c')][_0x7c46('0x42')]);_0x2a99f7['where']=qs[_0x7c46('0x3b')](_[_0x7c46('0x5e')](_0x24fde4[_0x7c46('0x3c')],_0x26ca73['filters']));_0x2a99f7['raw']=!![];if(_0x24fde4[_0x7c46('0x3c')][_0x7c46('0x46')]){_0x2a99f7[_0x7c46('0x43')]=_[_0x7c46('0x44')](_0x2a99f7['where'],{'$or':_[_0x7c46('0x34')](_0x2a99f7['attributes'],function(_0x405827){var _0x380c71={};_0x380c71[_0x405827]={'$like':'%'+_0x24fde4[_0x7c46('0x3c')][_0x7c46('0x46')]+'%'};return _0x380c71;})});}_0x2a99f7=_[_0x7c46('0x44')]({},_0x2a99f7,_0x24fde4[_0x7c46('0x4d')]);return _0x168e91['getContacts'](_0x2a99f7);}})[_0x7c46('0x2c')](function(_0x42415f){if(!_[_0x7c46('0x72')](_0x42415f)){var _0x26e8c6=toCsv(_0x42415f);var _0x5e924b=Date[_0x7c46('0x73')]();fs[_0x7c46('0x74')](util['format'](_0x7c46('0x75'),_0x168e91['id'],_0x5e924b),_0x26e8c6);_0x3f104f[_0x7c46('0x76')](_0x7c46('0x77'),'attachment;\x20filename='+util[_0x7c46('0x6d')]('list_%d_%s.csv',_0x168e91['id'],_0x5e924b));_0x3f104f[_0x7c46('0x76')](_0x7c46('0x78'),'text/csv');return _0x3f104f[_0x7c46('0x79')](util[_0x7c46('0x6d')](_0x7c46('0x75'),_0x168e91['id'],_0x5e924b));}else{return _0x3f104f[_0x7c46('0x1e')](0xcc);}})[_0x7c46('0x4a')](handleError(_0x3f104f,null));};exports['addCustomField']=function(_0x47df62,_0x550cd1,_0x3dd35c){var _0x253ce3;delete _0x47df62['body']['id'];return db['CmList'][_0x7c46('0x5a')]({'where':{'id':_0x47df62['params']['id']}})[_0x7c46('0x2c')](handleEntityNotFound(_0x550cd1,null))[_0x7c46('0x2c')](function(_0x21ee4a){if(_0x21ee4a){return db[_0x7c46('0x7a')][_0x7c46('0x7b')](function(_0x49d9ed){return db['CmCustomField'][_0x7c46('0x4f')](_0x47df62[_0x7c46('0x50')],{'transaction':_0x49d9ed})[_0x7c46('0x2c')](function(_0x4745b0){_0x253ce3=_0x4745b0;return _0x21ee4a[_0x7c46('0x7c')](_0x4745b0,{'transaction':_0x49d9ed});})[_0x7c46('0x2c')](function(){var _0x1bcc22={'type':db[_0x7c46('0x7d')][_0x7c46('0x7e')],'transaction':_0x49d9ed};switch(_0x47df62[_0x7c46('0x50')]['type']){case _0x7c46('0x7f'):_0x1bcc22['type']=db[_0x7c46('0x7d')][_0x7c46('0x7e')];break;case _0x7c46('0x80'):_0x1bcc22[_0x7c46('0x38')]=db[_0x7c46('0x7d')]['INTEGER'];break;case _0x7c46('0x81'):_0x1bcc22['type']=db['Sequelize'][_0x7c46('0x82')];_0x1bcc22[_0x7c46('0x83')]=![];break;default:}return db[_0x7c46('0x7a')][_0x7c46('0x84')][_0x7c46('0x85')](_0x7c46('0x86'),util[_0x7c46('0x6d')]('cf_%s',_0x253ce3['id']),_0x1bcc22);})[_0x7c46('0x2c')](function(){return _0x253ce3;});});}})['then'](respondWithResult(_0x550cd1,null))[_0x7c46('0x4a')](handleError(_0x550cd1,null));};exports[_0x7c46('0x87')]=function(_0x584867,_0x5c30d5,_0x56ce3c){var _0x246cd6={};var _0x377859={};var _0xf34d8e;var _0x473fc6;return db[_0x7c46('0x35')][_0x7c46('0x5a')]({'where':{'id':_0x584867[_0x7c46('0x56')]['id']}})[_0x7c46('0x2c')](handleEntityNotFound(_0x5c30d5,null))[_0x7c46('0x2c')](function(_0x5431ba){if(_0x5431ba){_0xf34d8e=_0x5431ba;_0x377859[_0x7c46('0x39')]=_['keys'](db[_0x7c46('0x6a')][_0x7c46('0x36')]);_0x377859['query']=_[_0x7c46('0x3a')](_0x584867[_0x7c46('0x3c')]);_0x377859['filters']=_['intersection'](_0x377859[_0x7c46('0x39')],_0x377859[_0x7c46('0x3c')]);_0x246cd6['attributes']=_['intersection'](_0x377859[_0x7c46('0x39')],qs[_0x7c46('0x3f')](_0x584867[_0x7c46('0x3c')]['fields']));_0x246cd6[_0x7c46('0x3d')]=_0x246cd6[_0x7c46('0x3d')][_0x7c46('0x40')]?_0x246cd6[_0x7c46('0x3d')]:_0x377859[_0x7c46('0x39')];_0x246cd6[_0x7c46('0x5d')]=qs['sort'](_0x584867['query'][_0x7c46('0x42')]);_0x246cd6[_0x7c46('0x43')]=qs[_0x7c46('0x3b')](_[_0x7c46('0x5e')](_0x584867['query'],_0x377859[_0x7c46('0x3b')]));_0x246cd6[_0x7c46('0x43')]=_['merge'](_0x246cd6[_0x7c46('0x43')],{'$or':[{'ListId':_0x5431ba['id']},{'ListId':null}]});if(_0x584867[_0x7c46('0x3c')][_0x7c46('0x46')]){_0x246cd6['where']=_[_0x7c46('0x44')](_0x246cd6[_0x7c46('0x43')],{'$or':_[_0x7c46('0x34')](_0x246cd6[_0x7c46('0x3d')],function(_0x429561){var _0x24ba4a={};_0x24ba4a[_0x429561]={'$like':'%'+_0x584867['query'][_0x7c46('0x46')]+'%'};return _0x24ba4a;})});}_0x246cd6=_[_0x7c46('0x44')]({},_0x246cd6,_0x584867[_0x7c46('0x4d')]);return db['CmCustomField'][_0x7c46('0x88')](_0x246cd6);}})[_0x7c46('0x2c')](respondWithResult(_0x5c30d5,null))['catch'](handleError(_0x5c30d5,null));};exports[_0x7c46('0x89')]=function(_0x431908,_0x4a1978,_0x1eff9f){return db[_0x7c46('0x35')][_0x7c46('0x4e')]({'where':{'id':_0x431908[_0x7c46('0x56')]['id']}})[_0x7c46('0x2c')](handleEntityNotFound(_0x4a1978,null))[_0x7c46('0x2c')](function(_0x57e706){if(_0x57e706){return _0x57e706[_0x7c46('0x89')](_0x431908[_0x7c46('0x50')]['ids'],_[_0x7c46('0x67')](_0x431908[_0x7c46('0x50')],[_0x7c46('0x60'),'id'])||{})[_0x7c46('0x8a')](function(_0x520260){for(var _0x24d716=0x0;_0x24d716<_0x431908[_0x7c46('0x50')][_0x7c46('0x60')][_0x7c46('0x40')];_0x24d716+=0x1){socket[_0x7c46('0x8b')](_0x7c46('0x8c'),{'UserId':Number(_0x431908[_0x7c46('0x50')][_0x7c46('0x60')][_0x24d716]),'CmListId':Number(_0x431908[_0x7c46('0x56')]['id'])});}return _0x520260;});}})[_0x7c46('0x2c')](respondWithResult(_0x4a1978,null))[_0x7c46('0x4a')](handleError(_0x4a1978,null));};exports[_0x7c46('0x8d')]=function(_0xc739fa,_0x4defff,_0x57165e){return db[_0x7c46('0x35')][_0x7c46('0x4e')]({'where':{'id':_0xc739fa[_0x7c46('0x56')]['id']}})['then'](handleEntityNotFound(_0x4defff,null))['then'](function(_0x5b7b23){if(_0x5b7b23){return _0x5b7b23[_0x7c46('0x8d')](_0xc739fa[_0x7c46('0x3c')][_0x7c46('0x60')])[_0x7c46('0x2c')](function(){if(_[_0x7c46('0x62')](_0xc739fa[_0x7c46('0x3c')][_0x7c46('0x60')])){for(var _0x57d05c=0x0;_0x57d05c<_0xc739fa[_0x7c46('0x3c')][_0x7c46('0x60')]['length'];_0x57d05c+=0x1){socket[_0x7c46('0x8b')](_0x7c46('0x8e'),{'UserId':Number(_0xc739fa[_0x7c46('0x3c')]['ids'][_0x57d05c]),'CmListId':Number(_0xc739fa[_0x7c46('0x56')]['id'])});}}else{socket[_0x7c46('0x8b')]('userCmList:remove',{'UserId':Number(_0xc739fa[_0x7c46('0x3c')]['ids']),'CmListId':Number(_0xc739fa['params']['id'])});}});}})[_0x7c46('0x2c')](respondWithStatusCode(_0x4defff,null))[_0x7c46('0x4a')](handleError(_0x4defff,null));};exports[_0x7c46('0x8f')]=function(_0x2c3fbc,_0x45377c,_0x33c7c0){var _0x2b4064={};var _0x1a1ced={};var _0x22452a;var _0x54fb58;return db[_0x7c46('0x35')]['findOne']({'where':{'id':_0x2c3fbc[_0x7c46('0x56')]['id']}})['then'](handleEntityNotFound(_0x45377c,null))[_0x7c46('0x2c')](function(_0x5c4dae){if(_0x5c4dae){_0x22452a=_0x5c4dae;_0x1a1ced[_0x7c46('0x39')]=_[_0x7c46('0x3a')](db[_0x7c46('0x90')][_0x7c46('0x36')]);_0x1a1ced['query']=_[_0x7c46('0x3a')](_0x2c3fbc['query']);_0x1a1ced[_0x7c46('0x3b')]=_['intersection'](_0x1a1ced[_0x7c46('0x39')],_0x1a1ced[_0x7c46('0x3c')]);_0x2b4064[_0x7c46('0x3d')]=_[_0x7c46('0x3e')](_0x1a1ced['model'],qs[_0x7c46('0x3f')](_0x2c3fbc['query']['fields']));_0x2b4064[_0x7c46('0x3d')]=_0x2b4064['attributes'][_0x7c46('0x40')]?_0x2b4064[_0x7c46('0x3d')]:_0x1a1ced[_0x7c46('0x39')];_0x2b4064[_0x7c46('0x5d')]=qs[_0x7c46('0x42')](_0x2c3fbc[_0x7c46('0x3c')][_0x7c46('0x42')]);_0x2b4064[_0x7c46('0x43')]=qs['filters'](_[_0x7c46('0x5e')](_0x2c3fbc[_0x7c46('0x3c')],_0x1a1ced[_0x7c46('0x3b')]));if(_0x2c3fbc[_0x7c46('0x3c')][_0x7c46('0x46')]){_0x2b4064[_0x7c46('0x43')]=_[_0x7c46('0x44')](_0x2b4064['where'],{'$or':_['map'](_0x2b4064[_0x7c46('0x3d')],function(_0x75db00){var _0x3e8724={};_0x3e8724[_0x75db00]={'$like':'%'+_0x2c3fbc[_0x7c46('0x3c')][_0x7c46('0x46')]+'%'};return _0x3e8724;})});}_0x2b4064=_['merge']({},_0x2b4064,_0x2c3fbc['options']);return _0x22452a['getAgents'](_0x2b4064);}})['then'](function(_0x15d73d){if(_0x15d73d){_0x54fb58=_0x15d73d[_0x7c46('0x40')];if(!_0x2c3fbc[_0x7c46('0x3c')][_0x7c46('0x5c')](_0x7c46('0x41'))){_0x2b4064[_0x7c46('0x25')]=qs[_0x7c46('0x25')](_0x2c3fbc[_0x7c46('0x3c')][_0x7c46('0x25')]);_0x2b4064['offset']=qs[_0x7c46('0x23')](_0x2c3fbc['query'][_0x7c46('0x23')]);}return _0x22452a[_0x7c46('0x8f')](_0x2b4064);}})[_0x7c46('0x2c')](function(_0x50dfff){if(_0x50dfff){return _0x50dfff?{'count':_0x54fb58,'rows':_0x50dfff}:null;}})[_0x7c46('0x2c')](respondWithResult(_0x45377c,null))[_0x7c46('0x4a')](handleError(_0x45377c,null));}; \ No newline at end of file +var _0x068e=['cf_%d','getContactsCsv','concat','raw','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','text/csv','addCustomFields','Sequelize','TEXT','INTEGER','defaultValue','sequelize','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./cmList.socket','register','sendStatus','status','offset','undefined','limit','Content-Range','json','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','options','count','includeAll','include','findAll','rows','catch','params','merge','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','addContacts','CmContact','tags','isArray','push','each','omit','success','dataValues','errors','message','getContacts','CmCustomField','CustomFields','format'];(function(_0x48a96f,_0x530059){var _0x3ff3ef=function(_0x286059){while(--_0x286059){_0x48a96f['push'](_0x48a96f['shift']());}};_0x3ff3ef(++_0x530059);}(_0x068e,0x1cc));var _0xe068=function(_0x50d299,_0x53d765){_0x50d299=_0x50d299-0x0;var _0x2fa985=_0x068e[_0x50d299];return _0x2fa985;};'use strict';var emlformat=require(_0xe068('0x0'));var rimraf=require(_0xe068('0x1'));var zipdir=require(_0xe068('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe068('0x3'));var moment=require(_0xe068('0x4'));var BPromise=require(_0xe068('0x5'));var Mustache=require(_0xe068('0x6'));var util=require(_0xe068('0x7'));var path=require(_0xe068('0x8'));var sox=require(_0xe068('0x9'));var csv=require(_0xe068('0xa'));var ejs=require(_0xe068('0xb'));var fs=require('fs');var fs_extra=require(_0xe068('0xc'));var _=require(_0xe068('0xd'));var squel=require(_0xe068('0xe'));var crypto=require('crypto');var jsforce=require(_0xe068('0xf'));var deskjs=require(_0xe068('0x10'));var toCsv=require(_0xe068('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe068('0x11'));var authService=require(_0xe068('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe068('0x13'));var hardwareService=require(_0xe068('0x14'));var logger=require(_0xe068('0x15'))(_0xe068('0x16'));var utils=require('../../config/utils');var config=require(_0xe068('0x17'));var licenseUtil=require(_0xe068('0x18'));var db=require(_0xe068('0x19'))['db'];config['redis']=_['defaults'](config[_0xe068('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xe068('0x1b'))(new Redis(config['redis']));require(_0xe068('0x1c'))[_0xe068('0x1d')](socket);function respondWithStatusCode(_0x588bdd,_0x53a352){_0x53a352=_0x53a352||0xcc;return function(_0x5e9f25){if(_0x5e9f25){return _0x588bdd[_0xe068('0x1e')](_0x53a352);}return _0x588bdd[_0xe068('0x1f')](_0x53a352)['end']();};}function respondWithResult(_0x4cdd8c,_0x24a1d7){_0x24a1d7=_0x24a1d7||0xc8;return function(_0x9f5e52){if(_0x9f5e52){return _0x4cdd8c[_0xe068('0x1f')](_0x24a1d7)['json'](_0x9f5e52);}};}function respondWithFilteredResult(_0x1e005c,_0x1a833e){return function(_0x2cd1e4){if(_0x2cd1e4){var _0x48d7ff=typeof _0x1a833e[_0xe068('0x20')]===_0xe068('0x21')&&typeof _0x1a833e[_0xe068('0x22')]===_0xe068('0x21');var _0x2b026d=_0x2cd1e4['count'];var _0x1fa548=_0x48d7ff?0x0:_0x1a833e[_0xe068('0x20')];var _0x339a76=_0x48d7ff?_0x2cd1e4['count']:_0x1a833e['offset']+_0x1a833e['limit'];var _0x30251b;if(_0x339a76>=_0x2b026d){_0x339a76=_0x2b026d;_0x30251b=0xc8;}else{_0x30251b=0xce;}_0x1e005c['status'](_0x30251b);return _0x1e005c['set'](_0xe068('0x23'),_0x1fa548+'-'+_0x339a76+'/'+_0x2b026d)[_0xe068('0x24')](_0x2cd1e4);}return null;};}function patchUpdates(_0x3a18af){return function(_0x236e95){try{jsonpatch[_0xe068('0x25')](_0x236e95,_0x3a18af,!![]);}catch(_0x2a3eae){return BPromise[_0xe068('0x26')](_0x2a3eae);}return _0x236e95[_0xe068('0x27')]();};}function saveUpdates(_0x395801,_0x92b653){return function(_0x2cb2b9){if(_0x2cb2b9){return _0x2cb2b9[_0xe068('0x28')](_0x395801)[_0xe068('0x29')](function(_0x1312d2){return _0x1312d2;});}return null;};}function removeEntity(_0x332da3,_0xaaefcc){return function(_0x248484){if(_0x248484){return _0x248484[_0xe068('0x2a')]()[_0xe068('0x29')](function(){var _0x4653f5=_0x248484[_0xe068('0x2b')]({'plain':!![]});var _0x38a042=_0xe068('0x2c');return db[_0xe068('0x2d')][_0xe068('0x2a')]({'where':{'type':_0x38a042,'resourceId':_0x4653f5['id']}})[_0xe068('0x29')](function(){return _0x248484;});})[_0xe068('0x29')](function(){_0x332da3[_0xe068('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5013c9,_0x44c88d){return function(_0x1f4856){if(!_0x1f4856){_0x5013c9['sendStatus'](0x194);}return _0x1f4856;};}function handleError(_0x164257,_0x2621dd){_0x2621dd=_0x2621dd||0x1f4;return function(_0x4a4de5){logger[_0xe068('0x2e')](_0x4a4de5[_0xe068('0x2f')]);if(_0x4a4de5[_0xe068('0x30')]){delete _0x4a4de5[_0xe068('0x30')];}_0x164257[_0xe068('0x1f')](_0x2621dd)[_0xe068('0x31')](_0x4a4de5);};}exports[_0xe068('0x32')]=function(_0x4dd1c9,_0x5302a2){var _0x3f9d4c={},_0x4818a7={},_0x41561e={'count':0x0,'rows':[]};var _0x52dc06=_[_0xe068('0x33')](db[_0xe068('0x34')][_0xe068('0x35')],function(_0x141424){return{'name':_0x141424['fieldName'],'type':_0x141424[_0xe068('0x36')][_0xe068('0x37')]};});_0x4818a7[_0xe068('0x38')]=_[_0xe068('0x33')](_0x52dc06,_0xe068('0x30'));_0x4818a7[_0xe068('0x39')]=_[_0xe068('0x3a')](_0x4dd1c9[_0xe068('0x39')]);_0x4818a7[_0xe068('0x3b')]=_[_0xe068('0x3c')](_0x4818a7[_0xe068('0x38')],_0x4818a7['query']);_0x3f9d4c[_0xe068('0x3d')]=_[_0xe068('0x3c')](_0x4818a7['model'],qs[_0xe068('0x3e')](_0x4dd1c9[_0xe068('0x39')][_0xe068('0x3e')]));_0x3f9d4c[_0xe068('0x3d')]=_0x3f9d4c['attributes'][_0xe068('0x3f')]?_0x3f9d4c[_0xe068('0x3d')]:_0x4818a7['model'];if(!_0x4dd1c9[_0xe068('0x39')][_0xe068('0x40')]('nolimit')){_0x3f9d4c['limit']=qs['limit'](_0x4dd1c9['query'][_0xe068('0x22')]);_0x3f9d4c['offset']=qs[_0xe068('0x20')](_0x4dd1c9[_0xe068('0x39')][_0xe068('0x20')]);}_0x3f9d4c[_0xe068('0x41')]=qs[_0xe068('0x42')](_0x4dd1c9[_0xe068('0x39')][_0xe068('0x42')]);_0x3f9d4c[_0xe068('0x43')]=qs[_0xe068('0x3b')](_[_0xe068('0x44')](_0x4dd1c9[_0xe068('0x39')],_0x4818a7[_0xe068('0x3b')]),_0x52dc06);if(_0x4dd1c9[_0xe068('0x39')][_0xe068('0x45')]){_0x3f9d4c[_0xe068('0x43')]=_['merge'](_0x3f9d4c[_0xe068('0x43')],{'$or':_[_0xe068('0x33')](_0x52dc06,function(_0x164ebb){if(_0x164ebb['type']!=='VIRTUAL'){var _0x80e309={};_0x80e309[_0x164ebb[_0xe068('0x30')]]={'$like':'%'+_0x4dd1c9[_0xe068('0x39')]['filter']+'%'};return _0x80e309;}})});}_0x3f9d4c=_['merge']({},_0x3f9d4c,_0x4dd1c9[_0xe068('0x46')]);var _0x6f2284={'where':_0x3f9d4c['where']};return db[_0xe068('0x34')]['count'](_0x6f2284)[_0xe068('0x29')](function(_0x348ca6){_0x41561e[_0xe068('0x47')]=_0x348ca6;if(_0x4dd1c9[_0xe068('0x39')][_0xe068('0x48')]){_0x3f9d4c[_0xe068('0x49')]=[{'all':!![]}];}return db['CmList'][_0xe068('0x4a')](_0x3f9d4c);})['then'](function(_0x28add5){_0x41561e[_0xe068('0x4b')]=_0x28add5;return _0x41561e;})[_0xe068('0x29')](respondWithFilteredResult(_0x5302a2,_0x3f9d4c))[_0xe068('0x4c')](handleError(_0x5302a2,null));};exports['show']=function(_0x577cc6,_0x457f20){var _0xdf6a05={'raw':![],'where':{'id':_0x577cc6[_0xe068('0x4d')]['id']}},_0x4672ad={};_0x4672ad['model']=_[_0xe068('0x3a')](db[_0xe068('0x34')][_0xe068('0x35')]);_0x4672ad['query']=_[_0xe068('0x3a')](_0x577cc6['query']);_0x4672ad[_0xe068('0x3b')]=_[_0xe068('0x3c')](_0x4672ad['model'],_0x4672ad['query']);_0xdf6a05['attributes']=_[_0xe068('0x3c')](_0x4672ad['model'],qs[_0xe068('0x3e')](_0x577cc6['query'][_0xe068('0x3e')]));_0xdf6a05['attributes']=_0xdf6a05[_0xe068('0x3d')][_0xe068('0x3f')]?_0xdf6a05[_0xe068('0x3d')]:_0x4672ad[_0xe068('0x38')];if(_0x577cc6[_0xe068('0x39')][_0xe068('0x48')]){_0xdf6a05['include']=[{'all':!![]}];}_0xdf6a05=_[_0xe068('0x4e')]({},_0xdf6a05,_0x577cc6[_0xe068('0x46')]);return db['CmList']['find'](_0xdf6a05)[_0xe068('0x29')](handleEntityNotFound(_0x457f20,null))[_0xe068('0x29')](respondWithResult(_0x457f20,null))[_0xe068('0x4c')](handleError(_0x457f20,null));};exports[_0xe068('0x4f')]=function(_0x2fe48b,_0x623fed){return db[_0xe068('0x34')][_0xe068('0x4f')](_0x2fe48b[_0xe068('0x50')],{})[_0xe068('0x29')](function(_0x5a2c65){var _0x46d197=_0x2fe48b['user'][_0xe068('0x2b')]({'plain':!![]});if(!_0x46d197)throw new Error(_0xe068('0x51'));if(_0x46d197[_0xe068('0x52')]===_0xe068('0x53')){var _0x27ef84=_0x5a2c65[_0xe068('0x2b')]({'plain':!![]});var _0x20d785=_0xe068('0x2c');return db[_0xe068('0x54')][_0xe068('0x55')]({'where':{'name':_0x20d785,'userProfileId':_0x46d197[_0xe068('0x56')]},'raw':!![]})[_0xe068('0x29')](function(_0x1f5047){if(_0x1f5047&&_0x1f5047['autoAssociation']===0x0){return db[_0xe068('0x2d')][_0xe068('0x4f')]({'name':_0x27ef84[_0xe068('0x30')],'resourceId':_0x27ef84['id'],'type':_0x1f5047[_0xe068('0x30')],'sectionId':_0x1f5047['id']},{})[_0xe068('0x29')](function(){return _0x5a2c65;});}else{return _0x5a2c65;}})[_0xe068('0x4c')](function(_0x391085){logger[_0xe068('0x2e')](_0xe068('0x57'),_0x391085);throw _0x391085;});}return _0x5a2c65;})[_0xe068('0x29')](respondWithResult(_0x623fed,0xc9))[_0xe068('0x4c')](handleError(_0x623fed,null));};exports[_0xe068('0x28')]=function(_0x4938bb,_0x5c5733){if(_0x4938bb[_0xe068('0x50')]['id']){delete _0x4938bb[_0xe068('0x50')]['id'];}return db[_0xe068('0x34')]['find']({'where':{'id':_0x4938bb[_0xe068('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5c5733,null))['then'](saveUpdates(_0x4938bb[_0xe068('0x50')],null))[_0xe068('0x29')](respondWithResult(_0x5c5733,null))[_0xe068('0x4c')](handleError(_0x5c5733,null));};exports[_0xe068('0x2a')]=function(_0x4252a6,_0x500188){return db[_0xe068('0x34')]['find']({'where':{'id':_0x4252a6['params']['id']}})[_0xe068('0x29')](handleEntityNotFound(_0x500188,null))[_0xe068('0x29')](removeEntity(_0x500188,null))[_0xe068('0x4c')](handleError(_0x500188,null));};exports[_0xe068('0x58')]=function(_0x431ae8,_0x2c82c2){return db['CmList']['describe']()[_0xe068('0x29')](respondWithResult(_0x2c82c2,null))['catch'](handleError(_0x2c82c2,null));};exports[_0xe068('0x59')]=function(_0xb45e33,_0x447645,_0x1c1f73){if(_0xb45e33[_0xe068('0x50')]['id']){delete _0xb45e33[_0xe068('0x50')]['id'];}return db[_0xe068('0x34')][_0xe068('0x55')]({'where':{'id':_0xb45e33[_0xe068('0x4d')]['id']}})[_0xe068('0x29')](handleEntityNotFound(_0x447645,null))[_0xe068('0x29')](function(_0x5b4481){if(_0x5b4481){_0xb45e33[_0xe068('0x50')][_0xe068('0x5a')]=_0x5b4481['id'];return db[_0xe068('0x5b')][_0xe068('0x4f')](_0xb45e33[_0xe068('0x50')]);}})[_0xe068('0x29')](respondWithResult(_0x447645,null))['catch'](handleError(_0x447645,null));};exports[_0xe068('0x5c')]=function(_0x508bda,_0x1ca2fe,_0x571fcb){var _0x4df14b={'raw':![],'where':{}};var _0x4d76a8={};var _0x45db2f={'count':0x0,'rows':[]};return db[_0xe068('0x34')][_0xe068('0x5d')]({'where':{'id':_0x508bda[_0xe068('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1ca2fe,null))[_0xe068('0x29')](function(_0x4f34e6){if(_0x4f34e6){_0x4d76a8[_0xe068('0x38')]=_[_0xe068('0x3a')](db[_0xe068('0x5b')][_0xe068('0x35')]);_0x4d76a8[_0xe068('0x39')]=_[_0xe068('0x3a')](_0x508bda[_0xe068('0x39')]);_0x4d76a8[_0xe068('0x3b')]=_[_0xe068('0x3c')](_0x4d76a8['model'],_0x4d76a8['query']);_0x4df14b[_0xe068('0x3d')]=_[_0xe068('0x3c')](_0x4d76a8[_0xe068('0x38')],qs['fields'](_0x508bda[_0xe068('0x39')][_0xe068('0x3e')]));_0x4df14b[_0xe068('0x3d')]=_0x4df14b[_0xe068('0x3d')][_0xe068('0x3f')]?_0x4df14b[_0xe068('0x3d')]:_0x4d76a8[_0xe068('0x38')];if(!_0x508bda['query'][_0xe068('0x40')](_0xe068('0x5e'))){_0x4df14b[_0xe068('0x22')]=qs[_0xe068('0x22')](_0x508bda['query'][_0xe068('0x22')]);_0x4df14b[_0xe068('0x20')]=qs[_0xe068('0x20')](_0x508bda[_0xe068('0x39')]['offset']);}_0x4df14b[_0xe068('0x41')]=qs[_0xe068('0x42')](_0x508bda[_0xe068('0x39')][_0xe068('0x42')]);_0x4df14b[_0xe068('0x43')]=qs[_0xe068('0x3b')](_[_0xe068('0x44')](_0x508bda[_0xe068('0x39')],_0x4d76a8['filters']));_0x4df14b[_0xe068('0x43')][_0xe068('0x5a')]=_0x4f34e6['id'];if(_0x508bda['query'][_0xe068('0x45')]){_0x4df14b[_0xe068('0x43')]=_[_0xe068('0x4e')](_0x4df14b[_0xe068('0x43')],{'$or':_[_0xe068('0x33')](_0x4df14b[_0xe068('0x3d')],function(_0x15bc28){var _0xd7e451={};_0xd7e451[_0x15bc28]={'$like':'%'+_0x508bda[_0xe068('0x39')][_0xe068('0x45')]+'%'};return _0xd7e451;})});}_0x4df14b=_[_0xe068('0x4e')]({},_0x4df14b,_0x508bda['options']);return db['Disposition'][_0xe068('0x47')]({'where':_0x4df14b['where']})['then'](function(_0x1cf522){_0x45db2f[_0xe068('0x47')]=_0x1cf522;if(_0x508bda[_0xe068('0x39')][_0xe068('0x48')]){_0x4df14b[_0xe068('0x49')]=[{'all':!![]}];}return db[_0xe068('0x5b')][_0xe068('0x4a')](_0x4df14b);})[_0xe068('0x29')](function(_0x422dc1){_0x45db2f[_0xe068('0x4b')]=_0x422dc1;return _0x45db2f;});}})['then'](respondWithFilteredResult(_0x1ca2fe,_0x4df14b))[_0xe068('0x4c')](handleError(_0x1ca2fe,null));};exports['removeDispositions']=function(_0xed7571,_0x397ba1,_0x23e2be){return db[_0xe068('0x34')]['find']({'where':{'id':_0xed7571[_0xe068('0x4d')]['id']}})[_0xe068('0x29')](handleEntityNotFound(_0x397ba1,null))[_0xe068('0x29')](function(_0x4c73af){if(_0x4c73af){return _0x4c73af[_0xe068('0x5f')](_0xed7571[_0xe068('0x39')][_0xe068('0x60')]);}})[_0xe068('0x29')](respondWithStatusCode(_0x397ba1,null))[_0xe068('0x4c')](handleError(_0x397ba1,null));};exports[_0xe068('0x61')]=function(_0x1d260e,_0x4f6221,_0x16c917){return db[_0xe068('0x34')][_0xe068('0x55')]({'where':{'id':_0x1d260e[_0xe068('0x4d')]['id']}})[_0xe068('0x29')](handleEntityNotFound(_0x4f6221,null))[_0xe068('0x29')](function(_0x313941){if(_0x313941){var _0x34d40f=[];var _0x575f6b={'success':[],'errors':[]};return db[_0xe068('0x62')][_0xe068('0x58')]()['then'](function(_0x40b877){if(_0x1d260e['body'][_0xe068('0x63')]&&_[_0xe068('0x64')](_0x1d260e[_0xe068('0x50')]['tags'])){if(_0x1d260e[_0xe068('0x50')][_0xe068('0x63')][_0xe068('0x3f')]){_0x1d260e['body'][_0xe068('0x63')]=_0x1d260e['body'][_0xe068('0x63')]['join'](';')+';';}else{_0x1d260e[_0xe068('0x50')][_0xe068('0x63')]=null;}}else{_0x1d260e[_0xe068('0x50')]['tags']=null;}if(_0x1d260e['body']&&_[_0xe068('0x64')](_0x1d260e[_0xe068('0x50')])){for(var _0x120023=0x0;_0x120023<_0x1d260e[_0xe068('0x50')][_0xe068('0x3f')];_0x120023+=0x1){_0x1d260e[_0xe068('0x50')][_0x120023][_0xe068('0x5a')]=_0x1d260e[_0xe068('0x4d')]['id'];_0x34d40f[_0xe068('0x65')](_0x1d260e[_0xe068('0x50')][_0x120023]);}return BPromise[_0xe068('0x66')](_0x34d40f,function(_0x2bdf51){return db[_0xe068('0x62')][_0xe068('0x4f')](_[_0xe068('0x67')](_0x2bdf51,[_0xe068('0x60'),'id'])||{},{'fields':_[_0xe068('0x3a')](_0x40b877),'raw':!![]})['then'](function(_0x7aa663){_0x575f6b[_0xe068('0x68')][_0xe068('0x65')](_0x7aa663[_0xe068('0x69')]);})[_0xe068('0x4c')](function(_0x5a4fd1){_0x575f6b[_0xe068('0x6a')][_0xe068('0x65')]({'data':_0x2bdf51,'error':_0x5a4fd1[_0xe068('0x6b')]});});})[_0xe068('0x29')](function(_0x57726d){return _0x575f6b;})[_0xe068('0x4c')](function(_0x2f15f2){return _0x2f15f2;});}else{_0x4f6221[_0xe068('0x1f')](0x190)[_0xe068('0x24')]({'message':'Malformed\x20request\x20syntax'});}});}})['then'](respondWithResult(_0x4f6221,null))[_0xe068('0x4c')](handleError(_0x4f6221,null));};exports[_0xe068('0x6c')]=function(_0x434ece,_0x123c43,_0x3781e2){var _0x1bc03f;return db['CmList'][_0xe068('0x55')]({'where':{'id':_0x434ece[_0xe068('0x4d')]['id']},'include':[{'model':db[_0xe068('0x6d')],'as':_0xe068('0x6e')}]})[_0xe068('0x29')](handleEntityNotFound(_0x123c43,null))[_0xe068('0x29')](function(_0x2d581f){if(_0x2d581f){_0x1bc03f=_0x2d581f;return db[_0xe068('0x62')][_0xe068('0x35')];}})[_0xe068('0x29')](function(_0xc6ecfb){if(_0xc6ecfb){var _0x90d9ab={};var _0x4c5517={};_0x4c5517[_0xe068('0x38')]=_['concat'](_[_0xe068('0x3a')](_0xc6ecfb),_[_0xe068('0x33')](_0x1bc03f['CustomFields'],function(_0x155ba1){return util[_0xe068('0x6f')](_0xe068('0x70'),_0x155ba1['id']);}));_0x4c5517['query']=_['keys'](_0x434ece[_0xe068('0x39')]);_0x4c5517[_0xe068('0x3b')]=_[_0xe068('0x3c')](_0x4c5517[_0xe068('0x38')],_0x4c5517['query']);_0x90d9ab['attributes']=_['intersection'](_0x4c5517[_0xe068('0x38')],qs['fields'](_0x434ece['query'][_0xe068('0x3e')]));_0x90d9ab[_0xe068('0x3d')]=_0x90d9ab[_0xe068('0x3d')][_0xe068('0x3f')]?_0x90d9ab['attributes']:_0x4c5517[_0xe068('0x38')];if(!_0x434ece['query'][_0xe068('0x40')]('nolimit')){_0x90d9ab[_0xe068('0x22')]=qs[_0xe068('0x22')](_0x434ece[_0xe068('0x39')][_0xe068('0x22')]);_0x90d9ab[_0xe068('0x20')]=qs[_0xe068('0x20')](_0x434ece[_0xe068('0x39')][_0xe068('0x20')]);}_0x90d9ab['order']=qs[_0xe068('0x42')](_0x434ece['query'][_0xe068('0x42')]);_0x90d9ab[_0xe068('0x43')]=qs['filters'](_[_0xe068('0x44')](_0x434ece['query'],_0x4c5517[_0xe068('0x3b')]));_0x90d9ab['raw']=!![];if(_0x434ece['query'][_0xe068('0x45')]){_0x90d9ab[_0xe068('0x43')]=_[_0xe068('0x4e')](_0x90d9ab[_0xe068('0x43')],{'$or':_[_0xe068('0x33')](_0x90d9ab[_0xe068('0x3d')],function(_0x294952){var _0x1ea672={};_0x1ea672[_0x294952]={'$like':'%'+_0x434ece['query'][_0xe068('0x45')]+'%'};return _0x1ea672;})});}_0x90d9ab=_['merge']({},_0x90d9ab,_0x434ece[_0xe068('0x46')]);return _0x1bc03f[_0xe068('0x6c')](_0x90d9ab);}})[_0xe068('0x29')](respondWithResult(_0x123c43,null))['catch'](handleError(_0x123c43,null));};exports[_0xe068('0x71')]=function(_0x31ade8,_0xc18eb9,_0x59e7f0){var _0x188d7b;return db[_0xe068('0x34')]['find']({'where':{'id':_0x31ade8[_0xe068('0x4d')]['id']},'include':[{'model':db[_0xe068('0x6d')],'as':_0xe068('0x6e')}]})[_0xe068('0x29')](handleEntityNotFound(_0xc18eb9,null))[_0xe068('0x29')](function(_0xb7b3bd){if(_0xb7b3bd){_0x188d7b=_0xb7b3bd;return db['CmContact'][_0xe068('0x35')];}})['then'](function(_0x3efeea){if(_0x3efeea){var _0x6c73bd={};var _0x17e7cf={};_0x17e7cf[_0xe068('0x38')]=_[_0xe068('0x72')](_[_0xe068('0x3a')](_0x3efeea),_[_0xe068('0x33')](_0x188d7b[_0xe068('0x6e')],function(_0x423eb9){return util[_0xe068('0x6f')]('cf_%d',_0x423eb9['id']);}));_0x17e7cf['query']=_[_0xe068('0x3a')](_0x31ade8[_0xe068('0x39')]);_0x17e7cf[_0xe068('0x3b')]=_[_0xe068('0x3c')](_0x17e7cf[_0xe068('0x38')],_0x17e7cf[_0xe068('0x39')]);_0x6c73bd[_0xe068('0x3d')]=_[_0xe068('0x3c')](_0x17e7cf[_0xe068('0x38')],qs[_0xe068('0x3e')](_0x31ade8[_0xe068('0x39')][_0xe068('0x3e')]));_0x6c73bd['attributes']=_0x6c73bd[_0xe068('0x3d')][_0xe068('0x3f')]?_0x6c73bd[_0xe068('0x3d')]:_0x17e7cf['model'];if(!_0x31ade8[_0xe068('0x39')][_0xe068('0x40')](_0xe068('0x5e'))){_0x6c73bd[_0xe068('0x22')]=qs['limit'](_0x31ade8[_0xe068('0x39')][_0xe068('0x22')]);_0x6c73bd['offset']=qs[_0xe068('0x20')](_0x31ade8['query'][_0xe068('0x20')]);}_0x6c73bd['order']=qs[_0xe068('0x42')](_0x31ade8[_0xe068('0x39')]['sort']);_0x6c73bd[_0xe068('0x43')]=qs[_0xe068('0x3b')](_['pick'](_0x31ade8[_0xe068('0x39')],_0x17e7cf[_0xe068('0x3b')]));_0x6c73bd[_0xe068('0x73')]=!![];if(_0x31ade8[_0xe068('0x39')][_0xe068('0x45')]){_0x6c73bd['where']=_[_0xe068('0x4e')](_0x6c73bd['where'],{'$or':_[_0xe068('0x33')](_0x6c73bd[_0xe068('0x3d')],function(_0x489a15){var _0x2bdb11={};_0x2bdb11[_0x489a15]={'$like':'%'+_0x31ade8['query'][_0xe068('0x45')]+'%'};return _0x2bdb11;})});}_0x6c73bd=_['merge']({},_0x6c73bd,_0x31ade8[_0xe068('0x46')]);return _0x188d7b['getContacts'](_0x6c73bd);}})[_0xe068('0x29')](function(_0x2aaa5e){if(!_[_0xe068('0x74')](_0x2aaa5e)){var _0x5d0bdd=toCsv(_0x2aaa5e);var _0x4ba2eb=Date[_0xe068('0x75')]();fs[_0xe068('0x76')](util['format'](_0xe068('0x77'),_0x188d7b['id'],_0x4ba2eb),_0x5d0bdd);_0xc18eb9['setHeader'](_0xe068('0x78'),_0xe068('0x79')+util[_0xe068('0x6f')](_0xe068('0x7a'),_0x188d7b['id'],_0x4ba2eb));_0xc18eb9[_0xe068('0x7b')](_0xe068('0x7c'),_0xe068('0x7d'));return _0xc18eb9['download'](util['format']('/tmp/list_%d_%s.csv',_0x188d7b['id'],_0x4ba2eb));}else{return _0xc18eb9['sendStatus'](0xcc);}})['catch'](handleError(_0xc18eb9,null));};exports['addCustomField']=function(_0x534738,_0x53cd26,_0x34ad2b){var _0x131cfe;delete _0x534738[_0xe068('0x50')]['id'];return db['CmList'][_0xe068('0x5d')]({'where':{'id':_0x534738[_0xe068('0x4d')]['id']}})[_0xe068('0x29')](handleEntityNotFound(_0x53cd26,null))[_0xe068('0x29')](function(_0x3d5651){if(_0x3d5651){return db['sequelize']['transaction'](function(_0x1cdd90){return db[_0xe068('0x6d')][_0xe068('0x4f')](_0x534738[_0xe068('0x50')],{'transaction':_0x1cdd90})[_0xe068('0x29')](function(_0x23276f){_0x131cfe=_0x23276f;return _0x3d5651[_0xe068('0x7e')](_0x23276f,{'transaction':_0x1cdd90});})[_0xe068('0x29')](function(){var _0x531294={'type':db[_0xe068('0x7f')][_0xe068('0x80')],'transaction':_0x1cdd90};switch(_0x534738[_0xe068('0x50')][_0xe068('0x36')]){case'text':_0x531294[_0xe068('0x36')]=db[_0xe068('0x7f')]['TEXT'];break;case'number':_0x531294[_0xe068('0x36')]=db['Sequelize'][_0xe068('0x81')];break;case'switch':_0x531294[_0xe068('0x36')]=db[_0xe068('0x7f')]['BOOLEAN'];_0x531294[_0xe068('0x82')]=![];break;default:}return db[_0xe068('0x83')]['queryInterface']['addColumn'](_0xe068('0x84'),util['format'](_0xe068('0x85'),_0x131cfe['id']),_0x531294);})[_0xe068('0x29')](function(){return _0x131cfe;});});}})[_0xe068('0x29')](respondWithResult(_0x53cd26,null))[_0xe068('0x4c')](handleError(_0x53cd26,null));};exports[_0xe068('0x86')]=function(_0x5136f5,_0xfe3f1d,_0x7c148a){var _0xdc57a8={};var _0x1b6d5a={};var _0x369334;var _0x52d449;return db[_0xe068('0x34')][_0xe068('0x5d')]({'where':{'id':_0x5136f5[_0xe068('0x4d')]['id']}})[_0xe068('0x29')](handleEntityNotFound(_0xfe3f1d,null))['then'](function(_0x232e00){if(_0x232e00){_0x369334=_0x232e00;_0x1b6d5a[_0xe068('0x38')]=_[_0xe068('0x3a')](db[_0xe068('0x6d')][_0xe068('0x35')]);_0x1b6d5a['query']=_['keys'](_0x5136f5['query']);_0x1b6d5a[_0xe068('0x3b')]=_['intersection'](_0x1b6d5a[_0xe068('0x38')],_0x1b6d5a[_0xe068('0x39')]);_0xdc57a8[_0xe068('0x3d')]=_[_0xe068('0x3c')](_0x1b6d5a[_0xe068('0x38')],qs['fields'](_0x5136f5['query'][_0xe068('0x3e')]));_0xdc57a8[_0xe068('0x3d')]=_0xdc57a8[_0xe068('0x3d')][_0xe068('0x3f')]?_0xdc57a8[_0xe068('0x3d')]:_0x1b6d5a['model'];_0xdc57a8[_0xe068('0x41')]=qs[_0xe068('0x42')](_0x5136f5[_0xe068('0x39')][_0xe068('0x42')]);_0xdc57a8[_0xe068('0x43')]=qs['filters'](_[_0xe068('0x44')](_0x5136f5[_0xe068('0x39')],_0x1b6d5a[_0xe068('0x3b')]));_0xdc57a8[_0xe068('0x43')]=_[_0xe068('0x4e')](_0xdc57a8['where'],{'$or':[{'ListId':_0x232e00['id']},{'ListId':null}]});if(_0x5136f5[_0xe068('0x39')][_0xe068('0x45')]){_0xdc57a8['where']=_['merge'](_0xdc57a8['where'],{'$or':_[_0xe068('0x33')](_0xdc57a8['attributes'],function(_0x17306f){var _0x40b2cd={};_0x40b2cd[_0x17306f]={'$like':'%'+_0x5136f5[_0xe068('0x39')][_0xe068('0x45')]+'%'};return _0x40b2cd;})});}_0xdc57a8=_[_0xe068('0x4e')]({},_0xdc57a8,_0x5136f5[_0xe068('0x46')]);return db['CmCustomField'][_0xe068('0x87')](_0xdc57a8);}})[_0xe068('0x29')](respondWithResult(_0xfe3f1d,null))[_0xe068('0x4c')](handleError(_0xfe3f1d,null));};exports[_0xe068('0x88')]=function(_0x2448b8,_0x5d8f3e,_0x4c7f19){return db['CmList'][_0xe068('0x55')]({'where':{'id':_0x2448b8['params']['id']}})[_0xe068('0x29')](handleEntityNotFound(_0x5d8f3e,null))[_0xe068('0x29')](function(_0x51ba64){if(_0x51ba64){return _0x51ba64[_0xe068('0x88')](_0x2448b8[_0xe068('0x50')]['ids'],_['omit'](_0x2448b8[_0xe068('0x50')],[_0xe068('0x60'),'id'])||{})[_0xe068('0x89')](function(_0x5974c8){for(var _0x436693=0x0;_0x436693<_0x2448b8[_0xe068('0x50')]['ids'][_0xe068('0x3f')];_0x436693+=0x1){socket['emit'](_0xe068('0x8a'),{'UserId':Number(_0x2448b8['body']['ids'][_0x436693]),'CmListId':Number(_0x2448b8[_0xe068('0x4d')]['id'])});}return _0x5974c8;});}})['then'](respondWithResult(_0x5d8f3e,null))[_0xe068('0x4c')](handleError(_0x5d8f3e,null));};exports[_0xe068('0x8b')]=function(_0x5ec3be,_0x5b29d3,_0xcdc80){return db[_0xe068('0x34')][_0xe068('0x55')]({'where':{'id':_0x5ec3be[_0xe068('0x4d')]['id']}})[_0xe068('0x29')](handleEntityNotFound(_0x5b29d3,null))[_0xe068('0x29')](function(_0x4b22cf){if(_0x4b22cf){return _0x4b22cf[_0xe068('0x8b')](_0x5ec3be[_0xe068('0x39')][_0xe068('0x60')])[_0xe068('0x29')](function(){if(_[_0xe068('0x64')](_0x5ec3be['query'][_0xe068('0x60')])){for(var _0x59b690=0x0;_0x59b690<_0x5ec3be['query'][_0xe068('0x60')][_0xe068('0x3f')];_0x59b690+=0x1){socket[_0xe068('0x8c')]('userCmList:remove',{'UserId':Number(_0x5ec3be[_0xe068('0x39')][_0xe068('0x60')][_0x59b690]),'CmListId':Number(_0x5ec3be[_0xe068('0x4d')]['id'])});}}else{socket['emit'](_0xe068('0x8d'),{'UserId':Number(_0x5ec3be[_0xe068('0x39')]['ids']),'CmListId':Number(_0x5ec3be[_0xe068('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x5b29d3,null))[_0xe068('0x4c')](handleError(_0x5b29d3,null));};exports[_0xe068('0x8e')]=function(_0x23db6a,_0x3aa762,_0xf879c3){var _0x78629a={};var _0x2f0ad9={};var _0x4565c4;var _0x15e4e9;return db[_0xe068('0x34')][_0xe068('0x5d')]({'where':{'id':_0x23db6a[_0xe068('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3aa762,null))['then'](function(_0x3a07ca){if(_0x3a07ca){_0x4565c4=_0x3a07ca;_0x2f0ad9[_0xe068('0x38')]=_[_0xe068('0x3a')](db['User'][_0xe068('0x35')]);_0x2f0ad9['query']=_[_0xe068('0x3a')](_0x23db6a[_0xe068('0x39')]);_0x2f0ad9[_0xe068('0x3b')]=_['intersection'](_0x2f0ad9[_0xe068('0x38')],_0x2f0ad9['query']);_0x78629a['attributes']=_[_0xe068('0x3c')](_0x2f0ad9['model'],qs[_0xe068('0x3e')](_0x23db6a['query'][_0xe068('0x3e')]));_0x78629a[_0xe068('0x3d')]=_0x78629a[_0xe068('0x3d')]['length']?_0x78629a['attributes']:_0x2f0ad9['model'];_0x78629a[_0xe068('0x41')]=qs[_0xe068('0x42')](_0x23db6a[_0xe068('0x39')][_0xe068('0x42')]);_0x78629a['where']=qs[_0xe068('0x3b')](_[_0xe068('0x44')](_0x23db6a[_0xe068('0x39')],_0x2f0ad9['filters']));if(_0x23db6a[_0xe068('0x39')]['filter']){_0x78629a[_0xe068('0x43')]=_['merge'](_0x78629a['where'],{'$or':_[_0xe068('0x33')](_0x78629a[_0xe068('0x3d')],function(_0xb7e77f){var _0x15b0b7={};_0x15b0b7[_0xb7e77f]={'$like':'%'+_0x23db6a['query'][_0xe068('0x45')]+'%'};return _0x15b0b7;})});}_0x78629a=_[_0xe068('0x4e')]({},_0x78629a,_0x23db6a[_0xe068('0x46')]);return _0x4565c4[_0xe068('0x8e')](_0x78629a);}})['then'](function(_0x3f5931){if(_0x3f5931){_0x15e4e9=_0x3f5931['length'];if(!_0x23db6a[_0xe068('0x39')][_0xe068('0x40')](_0xe068('0x5e'))){_0x78629a[_0xe068('0x22')]=qs[_0xe068('0x22')](_0x23db6a[_0xe068('0x39')][_0xe068('0x22')]);_0x78629a[_0xe068('0x20')]=qs[_0xe068('0x20')](_0x23db6a[_0xe068('0x39')][_0xe068('0x20')]);}return _0x4565c4[_0xe068('0x8e')](_0x78629a);}})[_0xe068('0x29')](function(_0xe9f260){if(_0xe9f260){return _0xe9f260?{'count':_0x15e4e9,'rows':_0xe9f260}:null;}})[_0xe068('0x29')](respondWithResult(_0x3aa762,null))[_0xe068('0x4c')](handleError(_0x3aa762,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index f436453..3602ad0 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3e74,0x175));var _0x43e7=function(_0x357a87,_0x661f25){_0x357a87=_0x357a87-0x0;var _0x5c3205=_0x3e74[_0x357a87];return _0x5c3205;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file +var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x214aa7,_0x57de97){var _0x2aef7a=function(_0x2225a1){while(--_0x2225a1){_0x214aa7['push'](_0x214aa7['shift']());}};_0x2aef7a(++_0x57de97);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 264b680..2f10c13 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(_0x2dee2f,_0x19572f){var _0x327c18=function(_0x130ec0){while(--_0x130ec0){_0x2dee2f['push'](_0x2dee2f['shift']());}};_0x327c18(++_0x19572f);}(_0x91a7,0xe7));var _0x791a=function(_0x13c7b2,_0xadf2c4){_0x13c7b2=_0x13c7b2-0x0;var _0x413912=_0x91a7[_0x13c7b2];return _0x413912;};'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 _0x5ff3=['cm_lists','util','api','bluebird','request-promise','path','rimraf','./cmList.attributes','exports','define'];(function(_0x3dc2d6,_0x345dab){var _0x9d670b=function(_0x4fa133){while(--_0x4fa133){_0x3dc2d6['push'](_0x3dc2d6['shift']());}};_0x9d670b(++_0x345dab);}(_0x5ff3,0x17d));var _0x35ff=function(_0x416849,_0x43d9ff){_0x416849=_0x416849-0x0;var _0x49835b=_0x5ff3[_0x416849];return _0x49835b;};'use strict';var _=require('lodash');var util=require(_0x35ff('0x0'));var logger=require('../../config/logger')(_0x35ff('0x1'));var moment=require('moment');var BPromise=require(_0x35ff('0x2'));var rp=require(_0x35ff('0x3'));var fs=require('fs');var path=require(_0x35ff('0x4'));var rimraf=require(_0x35ff('0x5'));var config=require('../../config/environment');var attributes=require(_0x35ff('0x6'));module[_0x35ff('0x7')]=function(_0x2e9873,_0x11e738){return _0x2e9873[_0x35ff('0x8')]('CmList',attributes,{'tableName':_0x35ff('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index d270d15..284b6fa 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 _0x5648=['message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./cmList.socket','register','request','info','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x16e08a,_0x32c582){var _0x531c5d=function(_0x108496){while(--_0x108496){_0x16e08a['push'](_0x16e08a['shift']());}};_0x531c5d(++_0x32c582);}(_0x5648,0xd3));var _0x8564=function(_0x172123,_0x22e4a1){_0x172123=_0x172123-0x0;var _0x418840=_0x5648[_0x172123];return _0x418840;};'use strict';var _=require('lodash');var util=require(_0x8564('0x0'));var moment=require(_0x8564('0x1'));var BPromise=require(_0x8564('0x2'));var rs=require(_0x8564('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8564('0x4'))['db'];var utils=require(_0x8564('0x5'));var logger=require('../../config/logger')(_0x8564('0x6'));var config=require(_0x8564('0x7'));var jayson=require(_0x8564('0x8'));var client=jayson['client'][_0x8564('0x9')]({'port':0x232a});config['redis']=_[_0x8564('0xa')](config[_0x8564('0xb')],{'host':_0x8564('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8564('0xb')]));require(_0x8564('0xd'))[_0x8564('0xe')](socket);function respondWithRpcPromise(_0x3f1127,_0x13715a,_0x594f84){return new BPromise(function(_0x30e584,_0x40504b){return client[_0x8564('0xf')](_0x3f1127,_0x594f84)['then'](function(_0x14985c){logger[_0x8564('0x10')](_0x8564('0x11'),_0x13715a,_0x8564('0x12'));logger[_0x8564('0x13')]('CmList,\x20%s,\x20%s,\x20%s',_0x13715a,'request\x20sent',JSON[_0x8564('0x14')](_0x14985c));if(_0x14985c[_0x8564('0x15')]){if(_0x14985c[_0x8564('0x15')][_0x8564('0x16')]===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x13715a,_0x14985c['error']['message']);return _0x40504b(_0x14985c[_0x8564('0x15')][_0x8564('0x17')]);}logger[_0x8564('0x15')](_0x8564('0x11'),_0x13715a,_0x14985c['error']['message']);return _0x30e584(_0x14985c[_0x8564('0x15')][_0x8564('0x17')]);}else{logger[_0x8564('0x10')](_0x8564('0x11'),_0x13715a,_0x8564('0x12'));_0x30e584(_0x14985c[_0x8564('0x18')][_0x8564('0x17')]);}})[_0x8564('0x19')](function(_0x210849){logger[_0x8564('0x15')](_0x8564('0x11'),_0x13715a,_0x210849);_0x40504b(_0x210849);});});} \ No newline at end of file +var _0x007a=['./cmList.socket','register','request','CmList,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x1cda7c,_0x4eb813){var _0x4c9b9b=function(_0x2ec2bc){while(--_0x2ec2bc){_0x1cda7c['push'](_0x1cda7c['shift']());}};_0x4c9b9b(++_0x4eb813);}(_0x007a,0xa8));var _0xa007=function(_0x10772c,_0x1df6ad){_0x10772c=_0x10772c-0x0;var _0x806119=_0x007a[_0x10772c];return _0x806119;};'use strict';var _=require(_0xa007('0x0'));var util=require(_0xa007('0x1'));var moment=require(_0xa007('0x2'));var BPromise=require(_0xa007('0x3'));var rs=require(_0xa007('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa007('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa007('0x6'))('rpc');var config=require(_0xa007('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa007('0x8')][_0xa007('0x9')]({'port':0x232a});config['redis']=_[_0xa007('0xa')](config[_0xa007('0xb')],{'host':_0xa007('0xc'),'port':0x18eb});var socket=require(_0xa007('0xd'))(new Redis(config[_0xa007('0xb')]));require(_0xa007('0xe'))[_0xa007('0xf')](socket);function respondWithRpcPromise(_0x3bec9e,_0x1e80e0,_0x40f8c3){return new BPromise(function(_0x174172,_0x6d0e46){return client[_0xa007('0x10')](_0x3bec9e,_0x40f8c3)['then'](function(_0x1f43ce){logger['info'](_0xa007('0x11'),_0x1e80e0,_0xa007('0x12'));logger[_0xa007('0x13')]('CmList,\x20%s,\x20%s,\x20%s',_0x1e80e0,'request\x20sent',JSON['stringify'](_0x1f43ce));if(_0x1f43ce['error']){if(_0x1f43ce[_0xa007('0x14')][_0xa007('0x15')]===0x1f4){logger[_0xa007('0x14')](_0xa007('0x11'),_0x1e80e0,_0x1f43ce[_0xa007('0x14')][_0xa007('0x16')]);return _0x6d0e46(_0x1f43ce[_0xa007('0x14')][_0xa007('0x16')]);}logger[_0xa007('0x14')]('CmList,\x20%s,\x20%s',_0x1e80e0,_0x1f43ce[_0xa007('0x14')][_0xa007('0x16')]);return _0x174172(_0x1f43ce[_0xa007('0x14')][_0xa007('0x16')]);}else{logger[_0xa007('0x17')]('CmList,\x20%s,\x20%s',_0x1e80e0,_0xa007('0x12'));_0x174172(_0x1f43ce[_0xa007('0x18')]['message']);}})[_0xa007('0x19')](function(_0x4dcb0f){logger[_0xa007('0x14')](_0xa007('0x11'),_0x1e80e0,_0x4dcb0f);_0x6d0e46(_0x4dcb0f);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 64eba66..851583c 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 _0xa069=['register','length','cmList:','save','remove','update','emit'];(function(_0x37858a,_0xdec527){var _0x306823=function(_0x4bb180){while(--_0x4bb180){_0x37858a['push'](_0x37858a['shift']());}};_0x306823(++_0xdec527);}(_0xa069,0x1bc));var _0x9a06=function(_0x13f7e6,_0x3a5511){_0x13f7e6=_0x13f7e6-0x0;var _0x468da0=_0xa069[_0x13f7e6];return _0x468da0;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x9a06('0x0'),_0x9a06('0x1'),_0x9a06('0x2')];function createListener(_0x5a4b8e,_0x5cbe91){return function(_0x2c5d4b){_0x5cbe91[_0x9a06('0x3')](_0x5a4b8e,_0x2c5d4b);};}function removeListener(_0x400749,_0x1f8068){return function(){CmListEvents['removeListener'](_0x400749,_0x1f8068);};}exports[_0x9a06('0x4')]=function(_0x196d89){for(var _0x1fc3aa=0x0,_0x25d150=events[_0x9a06('0x5')];_0x1fc3aa<_0x25d150;_0x1fc3aa++){var _0x1b961d=events[_0x1fc3aa];var _0x1ce965=createListener(_0x9a06('0x6')+_0x1b961d,_0x196d89);CmListEvents['on'](_0x1b961d,_0x1ce965);}}; \ No newline at end of file +var _0xa2b1=['register','length','./cmList.events','save','update','emit'];(function(_0xf5b06d,_0x588cfc){var _0x28c5cf=function(_0x31c69d){while(--_0x31c69d){_0xf5b06d['push'](_0xf5b06d['shift']());}};_0x28c5cf(++_0x588cfc);}(_0xa2b1,0x158));var _0x1a2b=function(_0x1f2e00,_0x20627f){_0x1f2e00=_0x1f2e00-0x0;var _0x2e3c84=_0xa2b1[_0x1f2e00];return _0x2e3c84;};'use strict';var CmListEvents=require(_0x1a2b('0x0'));var events=[_0x1a2b('0x1'),'remove',_0x1a2b('0x2')];function createListener(_0x52e4f2,_0x47c2bf){return function(_0x2b01a4){_0x47c2bf[_0x1a2b('0x3')](_0x52e4f2,_0x2b01a4);};}function removeListener(_0x381b65,_0x2339e9){return function(){CmListEvents['removeListener'](_0x381b65,_0x2339e9);};}exports[_0x1a2b('0x4')]=function(_0x3aebac){for(var _0x437fab=0x0,_0x3ce956=events[_0x1a2b('0x5')];_0x437fab<_0x3ce956;_0x437fab++){var _0x2c019f=events[_0x437fab];var _0x4bf49f=createListener('cmList:'+_0x2c019f,_0x3aebac);CmListEvents['on'](_0x2c019f,_0x4bf49f);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index a6c2ce3..e063f05 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 _0x34bd=['create','post','addContacts','addCustomField','addAgents','delete','destroy','removeDispositions','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmList.controller','get','isAuthenticated','/describe','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users'];(function(_0x5b5b2b,_0x310069){var _0x4f9e26=function(_0x109a5b){while(--_0x109a5b){_0x5b5b2b['push'](_0x5b5b2b['shift']());}};_0x4f9e26(++_0x310069);}(_0x34bd,0x10e));var _0xd34b=function(_0x322522,_0x4db288){_0x322522=_0x322522-0x0;var _0x293bcf=_0x34bd[_0x322522];return _0x293bcf;};'use strict';var multer=require(_0xd34b('0x0'));var util=require('util');var path=require(_0xd34b('0x1'));var timeout=require(_0xd34b('0x2'));var express=require(_0xd34b('0x3'));var router=express[_0xd34b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd34b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd34b('0x6'));var controller=require(_0xd34b('0x7'));router[_0xd34b('0x8')]('/',auth[_0xd34b('0x9')](),controller['index']);router['get'](_0xd34b('0xa'),auth[_0xd34b('0x9')](),controller['describe']);router[_0xd34b('0x8')]('/:id',auth[_0xd34b('0x9')](),controller['show']);router[_0xd34b('0x8')](_0xd34b('0xb'),auth[_0xd34b('0x9')](),controller[_0xd34b('0xc')]);router[_0xd34b('0x8')](_0xd34b('0xd'),auth[_0xd34b('0x9')](),controller[_0xd34b('0xe')]);router[_0xd34b('0x8')](_0xd34b('0xf'),auth[_0xd34b('0x9')](),controller[_0xd34b('0x10')]);router['get'](_0xd34b('0x11'),auth[_0xd34b('0x9')](),controller[_0xd34b('0x12')]);router[_0xd34b('0x8')](_0xd34b('0x13'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0xd34b('0x9')](),controller[_0xd34b('0x14')]);router['post'](_0xd34b('0xb'),auth[_0xd34b('0x9')](),controller['addDisposition']);router[_0xd34b('0x15')](_0xd34b('0xd'),auth[_0xd34b('0x9')](),controller[_0xd34b('0x16')]);router[_0xd34b('0x15')](_0xd34b('0x11'),auth[_0xd34b('0x9')](),controller[_0xd34b('0x17')]);router['post'](_0xd34b('0x13'),auth[_0xd34b('0x9')](),controller[_0xd34b('0x18')]);router['put']('/:id',auth[_0xd34b('0x9')](),controller['update']);router[_0xd34b('0x19')]('/:id',auth[_0xd34b('0x9')](),controller[_0xd34b('0x1a')]);router[_0xd34b('0x19')](_0xd34b('0xb'),auth[_0xd34b('0x9')](),controller[_0xd34b('0x1b')]);router[_0xd34b('0x19')](_0xd34b('0x13'),auth[_0xd34b('0x9')](),controller['removeAgents']);module[_0xd34b('0x1c')]=router; \ No newline at end of file +var _0x3d16=['/:id/dispositions','addDisposition','addAgents','update','delete','removeDispositions','removeAgents','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','describe','/:id','show','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','/:id/users','getAgents','post'];(function(_0x2669f5,_0x11aa08){var _0x10ed5c=function(_0x2978c0){while(--_0x2978c0){_0x2669f5['push'](_0x2669f5['shift']());}};_0x10ed5c(++_0x11aa08);}(_0x3d16,0xb6));var _0x63d1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d16[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x63d1('0x0'));var timeout=require(_0x63d1('0x1'));var express=require('express');var router=express[_0x63d1('0x2')]();var fs_extra=require(_0x63d1('0x3'));var auth=require(_0x63d1('0x4'));var interaction=require(_0x63d1('0x5'));var config=require(_0x63d1('0x6'));var controller=require(_0x63d1('0x7'));router[_0x63d1('0x8')]('/',auth[_0x63d1('0x9')](),controller['index']);router[_0x63d1('0x8')]('/describe',auth[_0x63d1('0x9')](),controller[_0x63d1('0xa')]);router[_0x63d1('0x8')](_0x63d1('0xb'),auth[_0x63d1('0x9')](),controller[_0x63d1('0xc')]);router[_0x63d1('0x8')]('/:id/dispositions',auth[_0x63d1('0x9')](),controller[_0x63d1('0xd')]);router[_0x63d1('0x8')](_0x63d1('0xe'),auth[_0x63d1('0x9')](),controller[_0x63d1('0xf')]);router[_0x63d1('0x8')](_0x63d1('0x10'),auth[_0x63d1('0x9')](),controller['getContactsCsv']);router['get'](_0x63d1('0x11'),auth[_0x63d1('0x9')](),controller['getCustomFields']);router[_0x63d1('0x8')](_0x63d1('0x12'),auth[_0x63d1('0x9')](),controller[_0x63d1('0x13')]);router[_0x63d1('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x63d1('0x14')](_0x63d1('0x15'),auth['isAuthenticated'](),controller[_0x63d1('0x16')]);router[_0x63d1('0x14')](_0x63d1('0xe'),auth[_0x63d1('0x9')](),controller['addContacts']);router[_0x63d1('0x14')]('/:id/fields',auth['isAuthenticated'](),controller['addCustomField']);router[_0x63d1('0x14')]('/:id/users',auth['isAuthenticated'](),controller[_0x63d1('0x17')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x63d1('0x18')]);router[_0x63d1('0x19')](_0x63d1('0xb'),auth[_0x63d1('0x9')](),controller['destroy']);router['delete'](_0x63d1('0x15'),auth[_0x63d1('0x9')](),controller[_0x63d1('0x1a')]);router[_0x63d1('0x19')](_0x63d1('0x12'),auth[_0x63d1('0x9')](),controller[_0x63d1('0x1b')]);module[_0x63d1('0x1c')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index d24b5d1..1d6339b 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 _0xc21f=['exports','VIRTUAL','getDataValue','field','STRING','sequelize'];(function(_0x487496,_0x249683){var _0x539dc8=function(_0x2c38e1){while(--_0x2c38e1){_0x487496['push'](_0x487496['shift']());}};_0x539dc8(++_0x249683);}(_0xc21f,0x77));var _0xfc21=function(_0x3d6dd4,_0x561d8c){_0x3d6dd4=_0x3d6dd4-0x0;var _0x5d2428=_0xc21f[_0x3d6dd4];return _0x5d2428;};'use strict';var Sequelize=require(_0xfc21('0x0'));module[_0xfc21('0x1')]={'name':{'type':Sequelize[_0xfc21('0x2')],'get':function(_0xedfc18){return this[_0xfc21('0x3')](_0xfc21('0x4'));}},'field':{'type':Sequelize[_0xfc21('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0xfc21('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0xfc21('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0x78cc=['VIRTUAL','getDataValue','field','STRING','sequelize','exports'];(function(_0x14bfd6,_0x5f3cf4){var _0x2c35ae=function(_0x1663a3){while(--_0x1663a3){_0x14bfd6['push'](_0x14bfd6['shift']());}};_0x2c35ae(++_0x5f3cf4);}(_0x78cc,0x1d8));var _0xc78c=function(_0x3fe078,_0x45c7f5){_0x3fe078=_0x3fe078-0x0;var _0x19db27=_0x78cc[_0x3fe078];return _0x19db27;};'use strict';var Sequelize=require(_0xc78c('0x0'));module[_0xc78c('0x1')]={'name':{'type':Sequelize[_0xc78c('0x2')],'get':function(_0x7b7fb2){return this[_0xc78c('0x3')](_0xc78c('0x4'));}},'field':{'type':Sequelize[_0xc78c('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0xc78c('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0xc78c('0x5')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 179d9a7..58a506b 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(_0x2c7391,_0x36b058){var _0x3b6c8d=function(_0x311fce){while(--_0x311fce){_0x2c7391['push'](_0x2c7391['shift']());}};_0x3b6c8d(++_0x36b058);}(_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 _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x3d8f38,_0x2a35b6){var _0x4ccf8c=function(_0x152b32){while(--_0x152b32){_0x3d8f38['push'](_0x3d8f38['shift']());}};_0x4ccf8c(++_0x2a35b6);}(_0x7a54,0x106));var _0x47a5=function(_0x3b917d,_0x59f67f){_0x3b917d=_0x3b917d-0x0;var _0x8dd7bd=_0x7a54[_0x3b917d];return _0x8dd7bd;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 84fb901..f6d2172 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 _0x5b75=['request-promise','path','../../config/environment','./condition.attributes','exports','define','Condition','lodash','../../config/logger','api','moment','bluebird'];(function(_0xdb703c,_0x2feb75){var _0x31bb23=function(_0x4ae204){while(--_0x4ae204){_0xdb703c['push'](_0xdb703c['shift']());}};_0x31bb23(++_0x2feb75);}(_0x5b75,0x187));var _0x55b7=function(_0x9b2c44,_0x11522d){_0x9b2c44=_0x9b2c44-0x0;var _0x5044e5=_0x5b75[_0x9b2c44];return _0x5044e5;};'use strict';var _=require(_0x55b7('0x0'));var util=require('util');var logger=require(_0x55b7('0x1'))(_0x55b7('0x2'));var moment=require(_0x55b7('0x3'));var BPromise=require(_0x55b7('0x4'));var rp=require(_0x55b7('0x5'));var fs=require('fs');var path=require(_0x55b7('0x6'));var rimraf=require('rimraf');var config=require(_0x55b7('0x7'));var attributes=require(_0x55b7('0x8'));module[_0x55b7('0x9')]=function(_0x36317b,_0x1d4658){return _0x36317b[_0x55b7('0xa')](_0x55b7('0xb'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb256=['moment','bluebird','request-promise','path','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','lodash','util'];(function(_0x9b671a,_0x67166b){var _0x311286=function(_0x44ba72){while(--_0x44ba72){_0x9b671a['push'](_0x9b671a['shift']());}};_0x311286(++_0x67166b);}(_0xb256,0x106));var _0x6b25=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xb256[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require(_0x6b25('0x0'));var util=require(_0x6b25('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6b25('0x2'));var BPromise=require(_0x6b25('0x3'));var rp=require(_0x6b25('0x4'));var fs=require('fs');var path=require(_0x6b25('0x5'));var rimraf=require('rimraf');var config=require(_0x6b25('0x6'));var attributes=require(_0x6b25('0x7'));module[_0x6b25('0x8')]=function(_0x2173aa,_0x4cb312){return _0x2173aa[_0x6b25('0x9')](_0x6b25('0xa'),attributes,{'tableName':_0x6b25('0xb'),'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 e375465..e33c2f0 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 _0xa949=['util','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','request','info','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x21a618,_0x47a792){var _0x22fd86=function(_0x4c2c3c){while(--_0x4c2c3c){_0x21a618['push'](_0x21a618['shift']());}};_0x22fd86(++_0x47a792);}(_0xa949,0xd7));var _0x9a94=function(_0x3a971c,_0x4dfdca){_0x3a971c=_0x3a971c-0x0;var _0x107f75=_0xa949[_0x3a971c];return _0x107f75;};'use strict';var _=require(_0x9a94('0x0'));var util=require(_0x9a94('0x1'));var moment=require('moment');var BPromise=require(_0x9a94('0x2'));var rs=require(_0x9a94('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a94('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9a94('0x5'));var config=require('../../config/environment');var jayson=require(_0x9a94('0x6'));var client=jayson[_0x9a94('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x305dfe,_0x467e4c,_0x5ed475){return new BPromise(function(_0x521b2e,_0x4ab936){return client[_0x9a94('0x8')](_0x305dfe,_0x5ed475)['then'](function(_0x18a5fb){logger[_0x9a94('0x9')](_0x9a94('0xa'),_0x467e4c,_0x9a94('0xb'));logger['debug'](_0x9a94('0xc'),_0x467e4c,_0x9a94('0xb'),JSON[_0x9a94('0xd')](_0x18a5fb));if(_0x18a5fb[_0x9a94('0xe')]){if(_0x18a5fb[_0x9a94('0xe')][_0x9a94('0xf')]===0x1f4){logger[_0x9a94('0xe')](_0x9a94('0xa'),_0x467e4c,_0x18a5fb[_0x9a94('0xe')][_0x9a94('0x10')]);return _0x4ab936(_0x18a5fb[_0x9a94('0xe')][_0x9a94('0x10')]);}logger[_0x9a94('0xe')]('Condition,\x20%s,\x20%s',_0x467e4c,_0x18a5fb['error'][_0x9a94('0x10')]);return _0x521b2e(_0x18a5fb[_0x9a94('0xe')][_0x9a94('0x10')]);}else{logger[_0x9a94('0x9')](_0x9a94('0xa'),_0x467e4c,_0x9a94('0xb'));_0x521b2e(_0x18a5fb[_0x9a94('0x11')][_0x9a94('0x10')]);}})['catch'](function(_0x5931d9){logger['error']('Condition,\x20%s,\x20%s',_0x467e4c,_0x5931d9);_0x4ab936(_0x5931d9);});});} \ No newline at end of file +var _0x9360=['jayson/promise','client','http','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9360,0xd2));var _0x0936=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9360[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0936('0x0'));var util=require(_0x0936('0x1'));var moment=require(_0x0936('0x2'));var BPromise=require(_0x0936('0x3'));var rs=require(_0x0936('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0936('0x5'))['db'];var utils=require(_0x0936('0x6'));var logger=require(_0x0936('0x7'))(_0x0936('0x8'));var config=require(_0x0936('0x9'));var jayson=require(_0x0936('0xa'));var client=jayson[_0x0936('0xb')][_0x0936('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x493c05,_0x27a23c,_0x530c44){return new BPromise(function(_0x5161da,_0xa4fa52){return client['request'](_0x493c05,_0x530c44)['then'](function(_0x38c77e){logger[_0x0936('0xd')](_0x0936('0xe'),_0x27a23c,'request\x20sent');logger[_0x0936('0xf')](_0x0936('0x10'),_0x27a23c,'request\x20sent',JSON[_0x0936('0x11')](_0x38c77e));if(_0x38c77e['error']){if(_0x38c77e['error'][_0x0936('0x12')]===0x1f4){logger[_0x0936('0x13')](_0x0936('0xe'),_0x27a23c,_0x38c77e[_0x0936('0x13')][_0x0936('0x14')]);return _0xa4fa52(_0x38c77e['error'][_0x0936('0x14')]);}logger[_0x0936('0x13')](_0x0936('0xe'),_0x27a23c,_0x38c77e[_0x0936('0x13')][_0x0936('0x14')]);return _0x5161da(_0x38c77e[_0x0936('0x13')]['message']);}else{logger[_0x0936('0xd')](_0x0936('0xe'),_0x27a23c,_0x0936('0x15'));_0x5161da(_0x38c77e['result'][_0x0936('0x14')]);}})['catch'](function(_0xd0bd71){logger[_0x0936('0x13')]('Condition,\x20%s,\x20%s',_0x27a23c,_0xd0bd71);_0xa4fa52(_0xd0bd71);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 0a3d6a7..071e523 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 _0x2336=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','put','/:id','destroy','multer'];(function(_0x4290a1,_0x440091){var _0x4df672=function(_0x6e3082){while(--_0x6e3082){_0x4290a1['push'](_0x4290a1['shift']());}};_0x4df672(++_0x440091);}(_0x2336,0x154));var _0x6233=function(_0x579baf,_0x4aaafa){_0x579baf=_0x579baf-0x0;var _0x4c601a=_0x2336[_0x579baf];return _0x4c601a;};'use strict';var multer=require(_0x6233('0x0'));var util=require(_0x6233('0x1'));var path=require('path');var timeout=require(_0x6233('0x2'));var express=require(_0x6233('0x3'));var router=express[_0x6233('0x4')]();var fs_extra=require(_0x6233('0x5'));var auth=require(_0x6233('0x6'));var interaction=require(_0x6233('0x7'));var config=require('../../config/environment');var controller=require('./condition.controller');router[_0x6233('0x8')](_0x6233('0x9'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x6233('0xa')]);module['exports']=router; \ No newline at end of file +var _0x2ea7=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','delete','/:id','isAuthenticated','destroy'];(function(_0x3e8dba,_0x39cb30){var _0x1dd9eb=function(_0x406040){while(--_0x406040){_0x3e8dba['push'](_0x3e8dba['shift']());}};_0x1dd9eb(++_0x39cb30);}(_0x2ea7,0x1ec));var _0x72ea=function(_0x33bf01,_0x1898f9){_0x33bf01=_0x33bf01-0x0;var _0x1d1cd2=_0x2ea7[_0x33bf01];return _0x1d1cd2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x72ea('0x0'));var timeout=require('connect-timeout');var express=require(_0x72ea('0x1'));var router=express[_0x72ea('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x72ea('0x3'));var interaction=require(_0x72ea('0x4'));var config=require(_0x72ea('0x5'));var controller=require(_0x72ea('0x6'));router[_0x72ea('0x7')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x72ea('0x8')](_0x72ea('0x9'),auth[_0x72ea('0xa')](),controller[_0x72ea('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 011ed16..8170a46 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['STRING','name'];(function(_0xe919cf,_0x2d624d){var _0x1f3667=function(_0x206bcc){while(--_0x206bcc){_0xe919cf['push'](_0xe919cf['shift']());}};_0x1f3667(++_0x2d624d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x178856,_0x41f045){var _0x3c7fe7=function(_0x4d9ce4){while(--_0x4d9ce4){_0x178856['push'](_0x178856['shift']());}};_0x3c7fe7(++_0x41f045);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 68cce9c..7830500 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 _0xc869=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','body','updatedAt','userProfileId','iframe','attrUrl','value','attrPath','attrs','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','order','hasOwnProperty','nolimit','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','./dashboard.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','params','keys','length','include','find','create'];(function(_0x35f2e8,_0x4108ca){var _0x120d8b=function(_0xc56fb5){while(--_0xc56fb5){_0x35f2e8['push'](_0x35f2e8['shift']());}};_0x120d8b(++_0x4108ca);}(_0xc869,0x192));var _0x9c86=function(_0x47c736,_0x5b285b){_0x47c736=_0x47c736-0x0;var _0x149e95=_0xc869[_0x47c736];return _0x149e95;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9c86('0x0'));var jsonpatch=require(_0x9c86('0x1'));var rp=require(_0x9c86('0x2'));var moment=require(_0x9c86('0x3'));var BPromise=require(_0x9c86('0x4'));var Mustache=require(_0x9c86('0x5'));var util=require(_0x9c86('0x6'));var path=require('path');var sox=require(_0x9c86('0x7'));var csv=require('to-csv');var ejs=require(_0x9c86('0x8'));var fs=require('fs');var fs_extra=require(_0x9c86('0x9'));var _=require(_0x9c86('0xa'));var squel=require(_0x9c86('0xb'));var crypto=require(_0x9c86('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9c86('0xd'));var toCsv=require(_0x9c86('0xe'));var querystring=require(_0x9c86('0xf'));var Papa=require(_0x9c86('0x10'));var Redis=require('ioredis');var authService=require(_0x9c86('0x11'));var qs=require(_0x9c86('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9c86('0x13'))(_0x9c86('0x14'));var utils=require(_0x9c86('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9c86('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x9c86('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9c86('0x18')]));require(_0x9c86('0x19'))[_0x9c86('0x1a')](socket);function respondWithStatusCode(_0x36f660,_0x25dea1){_0x25dea1=_0x25dea1||0xcc;return function(_0x5ad30a){if(_0x5ad30a){return _0x36f660[_0x9c86('0x1b')](_0x25dea1);}return _0x36f660['status'](_0x25dea1)[_0x9c86('0x1c')]();};}function respondWithResult(_0x32c88d,_0x130728){_0x130728=_0x130728||0xc8;return function(_0x2ac7e3){if(_0x2ac7e3){return _0x32c88d[_0x9c86('0x1d')](_0x130728)[_0x9c86('0x1e')](_0x2ac7e3);}};}function respondWithFilteredResult(_0x204d9a,_0x43fd12){return function(_0x54ba6d){if(_0x54ba6d){var _0x1de045=typeof _0x43fd12[_0x9c86('0x1f')]===_0x9c86('0x20')&&typeof _0x43fd12[_0x9c86('0x21')]===_0x9c86('0x20');var _0x460f0d=_0x54ba6d[_0x9c86('0x22')];var _0x15aeda=_0x1de045?0x0:_0x43fd12['offset'];var _0x97c6ef=_0x1de045?_0x54ba6d[_0x9c86('0x22')]:_0x43fd12[_0x9c86('0x1f')]+_0x43fd12['limit'];var _0x38ae72;if(_0x97c6ef>=_0x460f0d){_0x97c6ef=_0x460f0d;_0x38ae72=0xc8;}else{_0x38ae72=0xce;}_0x204d9a[_0x9c86('0x1d')](_0x38ae72);return _0x204d9a[_0x9c86('0x23')]('Content-Range',_0x15aeda+'-'+_0x97c6ef+'/'+_0x460f0d)[_0x9c86('0x1e')](_0x54ba6d);}return null;};}function patchUpdates(_0x58f065){return function(_0x2c8c71){try{jsonpatch[_0x9c86('0x24')](_0x2c8c71,_0x58f065,!![]);}catch(_0xaffb71){return BPromise[_0x9c86('0x25')](_0xaffb71);}return _0x2c8c71[_0x9c86('0x26')]();};}function saveUpdates(_0xe4943e,_0x4b05a5){return function(_0x4761b1){if(_0x4761b1){return _0x4761b1[_0x9c86('0x27')](_0xe4943e)[_0x9c86('0x28')](function(_0xf38c6){return _0xf38c6;});}return null;};}function removeEntity(_0x1ddc9d,_0x32c466){return function(_0x3bc7c4){if(_0x3bc7c4){return _0x3bc7c4[_0x9c86('0x29')]()[_0x9c86('0x28')](function(){var _0x3e5bfc=_0x3bc7c4[_0x9c86('0x2a')]({'plain':!![]});var _0x2ea371=_0x9c86('0x2b');return db[_0x9c86('0x2c')]['destroy']({'where':{'type':_0x2ea371,'resourceId':_0x3e5bfc['id']}})['then'](function(){return _0x3bc7c4;});})[_0x9c86('0x28')](function(){_0x1ddc9d[_0x9c86('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28074a,_0x2d07dc){return function(_0x559835){if(!_0x559835){_0x28074a['sendStatus'](0x194);}return _0x559835;};}function handleError(_0x517f52,_0x525ab2){_0x525ab2=_0x525ab2||0x1f4;return function(_0x37cf5d){logger[_0x9c86('0x2d')](_0x37cf5d[_0x9c86('0x2e')]);if(_0x37cf5d[_0x9c86('0x2f')]){delete _0x37cf5d[_0x9c86('0x2f')];}_0x517f52[_0x9c86('0x1d')](_0x525ab2)[_0x9c86('0x30')](_0x37cf5d);};}exports[_0x9c86('0x31')]=function(_0x129ce3,_0x30a1dd){var _0xa4a7ad={},_0x180c4a={},_0x2cdb60={'count':0x0,'rows':[]};var _0x166399=_[_0x9c86('0x32')](db[_0x9c86('0x33')][_0x9c86('0x34')],function(_0xb02de8){return{'name':_0xb02de8[_0x9c86('0x35')],'type':_0xb02de8['type'][_0x9c86('0x36')]};});_0x180c4a[_0x9c86('0x37')]=_[_0x9c86('0x32')](_0x166399,_0x9c86('0x2f'));_0x180c4a[_0x9c86('0x38')]=_['keys'](_0x129ce3[_0x9c86('0x38')]);_0x180c4a['filters']=_[_0x9c86('0x39')](_0x180c4a[_0x9c86('0x37')],_0x180c4a[_0x9c86('0x38')]);_0xa4a7ad['attributes']=_[_0x9c86('0x39')](_0x180c4a[_0x9c86('0x37')],qs[_0x9c86('0x3a')](_0x129ce3[_0x9c86('0x38')]['fields']));_0xa4a7ad[_0x9c86('0x3b')]=_0xa4a7ad[_0x9c86('0x3b')]['length']?_0xa4a7ad[_0x9c86('0x3b')]:_0x180c4a[_0x9c86('0x37')];if(!_0x129ce3['query']['hasOwnProperty']('nolimit')){_0xa4a7ad[_0x9c86('0x21')]=qs['limit'](_0x129ce3['query'][_0x9c86('0x21')]);_0xa4a7ad[_0x9c86('0x1f')]=qs['offset'](_0x129ce3[_0x9c86('0x38')][_0x9c86('0x1f')]);}_0xa4a7ad['order']=qs[_0x9c86('0x3c')](_0x129ce3[_0x9c86('0x38')]['sort']);_0xa4a7ad[_0x9c86('0x3d')]=qs[_0x9c86('0x3e')](_[_0x9c86('0x3f')](_0x129ce3['query'],_0x180c4a[_0x9c86('0x3e')]),_0x166399);if(_0x129ce3[_0x9c86('0x38')][_0x9c86('0x40')]){_0xa4a7ad['where']=_[_0x9c86('0x41')](_0xa4a7ad['where'],{'$or':_[_0x9c86('0x32')](_0x166399,function(_0x48afd0){if(_0x48afd0[_0x9c86('0x42')]!==_0x9c86('0x43')){var _0x4264dd={};_0x4264dd[_0x48afd0['name']]={'$like':'%'+_0x129ce3[_0x9c86('0x38')][_0x9c86('0x40')]+'%'};return _0x4264dd;}})});}_0xa4a7ad=_[_0x9c86('0x41')]({},_0xa4a7ad,_0x129ce3[_0x9c86('0x44')]);var _0x33e4e9={'where':_0xa4a7ad[_0x9c86('0x3d')]};return db[_0x9c86('0x33')][_0x9c86('0x22')](_0x33e4e9)[_0x9c86('0x28')](function(_0x1c81c5){_0x2cdb60[_0x9c86('0x22')]=_0x1c81c5;if(_0x129ce3[_0x9c86('0x38')][_0x9c86('0x45')]){_0xa4a7ad['include']=[{'all':!![]}];}return db[_0x9c86('0x33')]['findAll'](_0xa4a7ad);})['then'](function(_0x23e4b9){_0x2cdb60[_0x9c86('0x46')]=_0x23e4b9;return _0x2cdb60;})[_0x9c86('0x28')](respondWithFilteredResult(_0x30a1dd,_0xa4a7ad))[_0x9c86('0x47')](handleError(_0x30a1dd,null));};exports['show']=function(_0x3ce980,_0x3d1f1a){var _0x518144={'raw':![],'where':{'id':_0x3ce980[_0x9c86('0x48')]['id']}},_0x9c28f2={};_0x9c28f2[_0x9c86('0x37')]=_['keys'](db[_0x9c86('0x33')][_0x9c86('0x34')]);_0x9c28f2[_0x9c86('0x38')]=_[_0x9c86('0x49')](_0x3ce980[_0x9c86('0x38')]);_0x9c28f2[_0x9c86('0x3e')]=_[_0x9c86('0x39')](_0x9c28f2['model'],_0x9c28f2[_0x9c86('0x38')]);_0x518144[_0x9c86('0x3b')]=_['intersection'](_0x9c28f2[_0x9c86('0x37')],qs['fields'](_0x3ce980[_0x9c86('0x38')][_0x9c86('0x3a')]));_0x518144[_0x9c86('0x3b')]=_0x518144['attributes'][_0x9c86('0x4a')]?_0x518144['attributes']:_0x9c28f2[_0x9c86('0x37')];if(_0x3ce980[_0x9c86('0x38')][_0x9c86('0x45')]){_0x518144[_0x9c86('0x4b')]=[{'all':!![]}];}_0x518144=_[_0x9c86('0x41')]({},_0x518144,_0x3ce980[_0x9c86('0x44')]);return db['Dashboard'][_0x9c86('0x4c')](_0x518144)[_0x9c86('0x28')](handleEntityNotFound(_0x3d1f1a,null))[_0x9c86('0x28')](respondWithResult(_0x3d1f1a,null))[_0x9c86('0x47')](handleError(_0x3d1f1a,null));};exports['create']=function(_0x4cddbc,_0x40b2ea){return db['Dashboard'][_0x9c86('0x4d')](_0x4cddbc['body'],{})[_0x9c86('0x28')](function(_0x597faa){var _0x353845=_0x4cddbc[_0x9c86('0x4e')][_0x9c86('0x2a')]({'plain':!![]});if(!_0x353845)throw new Error(_0x9c86('0x4f'));if(_0x353845[_0x9c86('0x50')]===_0x9c86('0x4e')){var _0x1d7c14=_0x597faa['get']({'plain':!![]});var _0x564d8f=_0x9c86('0x2b');return db[_0x9c86('0x51')]['find']({'where':{'name':_0x564d8f,'userProfileId':_0x353845['userProfileId']},'raw':!![]})[_0x9c86('0x28')](function(_0xe21dd0){if(_0xe21dd0&&_0xe21dd0[_0x9c86('0x52')]===0x0){return db[_0x9c86('0x2c')]['create']({'name':_0x1d7c14['name'],'resourceId':_0x1d7c14['id'],'type':_0xe21dd0[_0x9c86('0x2f')],'sectionId':_0xe21dd0['id']},{})[_0x9c86('0x28')](function(){return _0x597faa;});}else{return _0x597faa;}})[_0x9c86('0x47')](function(_0x253a13){logger['error'](_0x9c86('0x53'),_0x253a13);throw _0x253a13;});}return _0x597faa;})['then'](respondWithResult(_0x40b2ea,0xc9))[_0x9c86('0x47')](handleError(_0x40b2ea,null));};exports['clone']=function(_0x567ee9,_0xe601a1){var _0x19b0b2={'where':{'id':_0x567ee9[_0x9c86('0x48')]['id']}},_0x12e648={};_0x12e648[_0x9c86('0x37')]=_['keys'](db[_0x9c86('0x33')][_0x9c86('0x34')]);_0x19b0b2[_0x9c86('0x3b')]=_[_0x9c86('0x39')](_0x12e648[_0x9c86('0x37')],qs[_0x9c86('0x3a')](_0x567ee9['query'][_0x9c86('0x3a')]));_0x19b0b2[_0x9c86('0x3b')]=_0x19b0b2[_0x9c86('0x3b')][_0x9c86('0x4a')]?_0x19b0b2[_0x9c86('0x3b')]:_0x12e648['model'];if(_0x567ee9['query'][_0x9c86('0x45')]){_0x19b0b2[_0x9c86('0x4b')]=[{'all':!![]}];}_0x19b0b2=_[_0x9c86('0x41')]({},_0x19b0b2,_0x567ee9[_0x9c86('0x44')]);return db[_0x9c86('0x33')][_0x9c86('0x4c')](_0x19b0b2)[_0x9c86('0x28')](handleEntityNotFound(_0xe601a1,null))['then'](function(_0x2044e5){if(_0x2044e5){var _0x447717=_0x2044e5[_0x9c86('0x2a')]({'plain':!![]});_0x447717=qs[_0x9c86('0x54')](_0x447717,['id','createdAt','updatedAt']);_0x567ee9[_0x9c86('0x55')]=_[_0x9c86('0x54')](_0x567ee9[_0x9c86('0x55')],['id','createdAt',_0x9c86('0x56')]);return db[_0x9c86('0x33')]['create'](_[_0x9c86('0x41')](_0x447717,_0x567ee9[_0x9c86('0x55')]),{'include':_0x567ee9[_0x9c86('0x38')][_0x9c86('0x45')]?[{'all':!![]}]:undefined})['then'](function(_0x42427a){var _0x372c69=_0x567ee9['user']['get']({'plain':!![]});if(!_0x372c69)throw new Error(_0x9c86('0x4f'));if(_0x372c69[_0x9c86('0x50')]==='user'){var _0x21f01b=_0x42427a[_0x9c86('0x2a')]({'plain':!![]});var _0x2a62de='CustomDashboards';return db[_0x9c86('0x51')][_0x9c86('0x4c')]({'where':{'name':_0x2a62de,'userProfileId':_0x372c69[_0x9c86('0x57')]},'raw':!![]})[_0x9c86('0x28')](function(_0x47fabb){if(_0x47fabb&&_0x47fabb[_0x9c86('0x52')]===0x0){return db['UserProfileResource'][_0x9c86('0x4d')]({'name':_0x21f01b[_0x9c86('0x2f')],'resourceId':_0x21f01b['id'],'type':_0x47fabb['name'],'sectionId':_0x47fabb['id']},{})[_0x9c86('0x28')](function(){return _0x42427a;});}else{return _0x42427a;}})[_0x9c86('0x47')](function(_0x22a244){logger[_0x9c86('0x2d')](_0x9c86('0x53'),_0x22a244);throw _0x22a244;});}return _0x42427a;});}})['then'](respondWithResult(_0xe601a1,0xc9))[_0x9c86('0x47')](handleError(_0xe601a1,null));};exports['update']=function(_0x2c81a0,_0x12d678){if(_0x2c81a0[_0x9c86('0x55')]['id']){delete _0x2c81a0[_0x9c86('0x55')]['id'];}return db[_0x9c86('0x33')][_0x9c86('0x4c')]({'where':{'id':_0x2c81a0[_0x9c86('0x48')]['id']}})[_0x9c86('0x28')](handleEntityNotFound(_0x12d678,null))[_0x9c86('0x28')](saveUpdates(_0x2c81a0[_0x9c86('0x55')],null))[_0x9c86('0x28')](respondWithResult(_0x12d678,null))[_0x9c86('0x47')](handleError(_0x12d678,null));};exports[_0x9c86('0x29')]=function(_0x2c21af,_0x517f16){return db['Dashboard'][_0x9c86('0x4c')]({'where':{'id':_0x2c21af[_0x9c86('0x48')]['id']}})[_0x9c86('0x28')](handleEntityNotFound(_0x517f16,null))[_0x9c86('0x28')](removeEntity(_0x517f16,null))[_0x9c86('0x47')](handleError(_0x517f16,null));};function widgetAttributes(_0x32fb63){try{switch(_0x32fb63[_0x9c86('0x42')]){case _0x9c86('0x58'):return[{'name':_0x9c86('0x59'),'value':_0x32fb63['attrUrl']||(_0x32fb63['attrs']&&_0x32fb63['attrs'][0x0]?_0x32fb63['attrs'][0x0][_0x9c86('0x5a')]:undefined)||'https://'}];case'custom':return[{'name':_0x9c86('0x5b'),'value':_0x32fb63['attrPath']||(_0x32fb63['attrs']&&_0x32fb63[_0x9c86('0x5c')][0x0]?_0x32fb63[_0x9c86('0x5c')][0x0]['value']:undefined)||''}];case _0x9c86('0x5d'):return[{'name':_0x9c86('0x5e'),'value':_0x32fb63['attrHourFormat']||(_0x32fb63[_0x9c86('0x5c')]&&_0x32fb63[_0x9c86('0x5c')][0x0]?_0x32fb63[_0x9c86('0x5c')][0x0][_0x9c86('0x5a')]:undefined)||_0x9c86('0x5f')},{'name':_0x9c86('0x60'),'value':_0x32fb63['attrTimezone']||(_0x32fb63[_0x9c86('0x5c')]&&_0x32fb63[_0x9c86('0x5c')][0x1]?_0x32fb63['attrs'][0x1][_0x9c86('0x5a')]:undefined)||_0x9c86('0x61')},{'name':_0x9c86('0x62'),'value':_0x32fb63[_0x9c86('0x62')]||(_0x32fb63[_0x9c86('0x5c')]&&_0x32fb63[_0x9c86('0x5c')][0x2]?_0x32fb63[_0x9c86('0x5c')][0x2]['value']:undefined)||0xc}];case _0x9c86('0x63'):return[{'name':_0x9c86('0x64'),'value':_0x32fb63[_0x9c86('0x64')]||(_0x32fb63[_0x9c86('0x5c')]&&_0x32fb63[_0x9c86('0x5c')][0x0]?_0x32fb63[_0x9c86('0x5c')][0x0][_0x9c86('0x5a')]:undefined)||_0x9c86('0x65')},{'name':_0x9c86('0x66'),'value':_0x32fb63['attrVoiceQueues']||(_0x32fb63['attrs']&&_0x32fb63[_0x9c86('0x5c')][0x1]?_0x32fb63[_0x9c86('0x5c')][0x1][_0x9c86('0x5a')]:undefined)||[]},{'name':_0x9c86('0x62'),'value':_0x32fb63['attrFontSize']||(_0x32fb63[_0x9c86('0x5c')]&&_0x32fb63['attrs'][0x2]?_0x32fb63[_0x9c86('0x5c')][0x2]['value']:undefined)||0x14}];case _0x9c86('0x67'):case _0x9c86('0x68'):return[{'name':_0x9c86('0x69'),'value':_0x32fb63[_0x9c86('0x69')]||(_0x32fb63[_0x9c86('0x5c')]&&_0x32fb63['attrs'][0x0]?_0x32fb63[_0x9c86('0x5c')][0x0]['value']:undefined)||_0x9c86('0x65')},{'name':_0x9c86('0x6a'),'value':_0x32fb63[_0x9c86('0x6a')]||(_0x32fb63[_0x9c86('0x5c')]&&_0x32fb63['attrs'][0x1]?_0x32fb63[_0x9c86('0x5c')][0x1][_0x9c86('0x5a')]:undefined)||null},{'name':_0x9c86('0x6b'),'value':_0x32fb63[_0x9c86('0x6b')]||(_0x32fb63['attrs']&&_0x32fb63[_0x9c86('0x5c')][0x2]?_0x32fb63[_0x9c86('0x5c')][0x2]['value']:undefined)||null},{'name':_0x9c86('0x66'),'value':_0x32fb63[_0x9c86('0x66')]||(_0x32fb63[_0x9c86('0x5c')]&&_0x32fb63[_0x9c86('0x5c')][0x3]?_0x32fb63['attrs'][0x3][_0x9c86('0x5a')]:undefined)||[]}];case _0x9c86('0x6c'):return[{'name':_0x9c86('0x6d'),'type':_0x32fb63[_0x9c86('0x6e')]||(_0x32fb63['attrs']&&_0x32fb63['attrs'][0x0]?_0x32fb63[_0x9c86('0x5c')][0x0]['type']:undefined)||null,'value':_0x32fb63[_0x9c86('0x6d')]||(_0x32fb63[_0x9c86('0x5c')]&&_0x32fb63[_0x9c86('0x5c')][0x0]?_0x32fb63['attrs'][0x0][_0x9c86('0x5a')]:undefined)||null},{'name':'attrRefresh','value':_0x32fb63['attrRefresh']||(_0x32fb63[_0x9c86('0x5c')]&&_0x32fb63[_0x9c86('0x5c')][0x1]?_0x32fb63[_0x9c86('0x5c')][0x1][_0x9c86('0x5a')]:undefined)||0x0}];default:return[];}}catch(_0x239a00){logger['error'](_0x9c86('0x6f'),JSON[_0x9c86('0x70')](_0x239a00));return[];}}exports[_0x9c86('0x71')]=function(_0x5a49b4,_0x334984,_0x1a916e){if(_0x5a49b4['body']['id']){delete _0x5a49b4[_0x9c86('0x55')]['id'];}return db[_0x9c86('0x33')][_0x9c86('0x4c')]({'where':{'id':_0x5a49b4[_0x9c86('0x48')]['id']}})['then'](handleEntityNotFound(_0x334984,null))[_0x9c86('0x28')](function(_0x19fe33){if(_0x19fe33){_0x5a49b4['body'][_0x9c86('0x72')]=_0x19fe33['id'];_0x5a49b4['body']['attrs']=widgetAttributes(_0x5a49b4[_0x9c86('0x55')]);return db[_0x9c86('0x73')][_0x9c86('0x4d')](_0x5a49b4['body']);}})[_0x9c86('0x28')](respondWithResult(_0x334984,null))[_0x9c86('0x47')](handleError(_0x334984,null));};exports[_0x9c86('0x74')]=function(_0x1e33fa,_0x4ebb22,_0x3892c5){var _0x3de2c6={};var _0x18b89d={};var _0x538aab;var _0x2a5361;return db[_0x9c86('0x33')]['findOne']({'where':{'id':_0x1e33fa['params']['id']}})[_0x9c86('0x28')](handleEntityNotFound(_0x4ebb22,null))[_0x9c86('0x28')](function(_0x4bffdc){if(_0x4bffdc){_0x538aab=_0x4bffdc;_0x18b89d[_0x9c86('0x37')]=_[_0x9c86('0x49')](db[_0x9c86('0x73')]['rawAttributes']);_0x18b89d[_0x9c86('0x38')]=_[_0x9c86('0x49')](_0x1e33fa[_0x9c86('0x38')]);_0x18b89d['filters']=_[_0x9c86('0x39')](_0x18b89d[_0x9c86('0x37')],_0x18b89d[_0x9c86('0x38')]);_0x3de2c6[_0x9c86('0x3b')]=_[_0x9c86('0x39')](_0x18b89d['model'],qs[_0x9c86('0x3a')](_0x1e33fa[_0x9c86('0x38')]['fields']));_0x3de2c6[_0x9c86('0x3b')]=_0x3de2c6[_0x9c86('0x3b')][_0x9c86('0x4a')]?_0x3de2c6[_0x9c86('0x3b')]:_0x18b89d[_0x9c86('0x37')];_0x3de2c6[_0x9c86('0x75')]=qs[_0x9c86('0x3c')](_0x1e33fa['query'][_0x9c86('0x3c')]);_0x3de2c6[_0x9c86('0x3d')]=qs[_0x9c86('0x3e')](_['pick'](_0x1e33fa[_0x9c86('0x38')],_0x18b89d[_0x9c86('0x3e')]));if(_0x1e33fa[_0x9c86('0x38')]['filter']){_0x3de2c6[_0x9c86('0x3d')]=_[_0x9c86('0x41')](_0x3de2c6['where'],{'$or':_[_0x9c86('0x32')](_0x3de2c6[_0x9c86('0x3b')],function(_0x390d7b){var _0x20ac29={};_0x20ac29[_0x390d7b]={'$like':'%'+_0x1e33fa[_0x9c86('0x38')][_0x9c86('0x40')]+'%'};return _0x20ac29;})});}_0x3de2c6=_['merge']({},_0x3de2c6,_0x1e33fa['options']);return _0x538aab[_0x9c86('0x74')](_0x3de2c6);}})[_0x9c86('0x28')](function(_0x1e6df1){if(_0x1e6df1){_0x2a5361=_0x1e6df1[_0x9c86('0x4a')];if(!_0x1e33fa[_0x9c86('0x38')][_0x9c86('0x76')](_0x9c86('0x77'))){_0x3de2c6[_0x9c86('0x21')]=qs[_0x9c86('0x21')](_0x1e33fa['query'][_0x9c86('0x21')]);_0x3de2c6['offset']=qs['offset'](_0x1e33fa[_0x9c86('0x38')][_0x9c86('0x1f')]);}return _0x538aab[_0x9c86('0x74')](_0x3de2c6);}})[_0x9c86('0x28')](function(_0x4a3800){if(_0x4a3800){return _0x4a3800?{'count':_0x2a5361,'rows':_0x4a3800}:null;}})[_0x9c86('0x28')](respondWithResult(_0x4ebb22,null))[_0x9c86('0x47')](handleError(_0x4ebb22,null));}; \ No newline at end of file +var _0x8e61=['sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','stack','name','map','rawAttributes','fieldName','type','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Dashboard','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','clone','omit','createdAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','attrUrl','attrs','https://','custom','attrPath','value','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','addItem','DashboardId','DashboardItem','getItems','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./dashboard.socket','register'];(function(_0xc57fa4,_0x447484){var _0xc1b7bc=function(_0x309322){while(--_0x309322){_0xc57fa4['push'](_0xc57fa4['shift']());}};_0xc1b7bc(++_0x447484);}(_0x8e61,0x152));var _0x18e6=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x8e61[_0x1694f5];return _0x5b4321;};'use strict';var emlformat=require(_0x18e6('0x0'));var rimraf=require(_0x18e6('0x1'));var zipdir=require(_0x18e6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x18e6('0x3'));var moment=require(_0x18e6('0x4'));var BPromise=require(_0x18e6('0x5'));var Mustache=require(_0x18e6('0x6'));var util=require('util');var path=require(_0x18e6('0x7'));var sox=require(_0x18e6('0x8'));var csv=require(_0x18e6('0x9'));var ejs=require(_0x18e6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x18e6('0xb'));var squel=require(_0x18e6('0xc'));var crypto=require('crypto');var jsforce=require(_0x18e6('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x18e6('0xe'));var Papa=require(_0x18e6('0xf'));var Redis=require(_0x18e6('0x10'));var authService=require(_0x18e6('0x11'));var qs=require(_0x18e6('0x12'));var as=require(_0x18e6('0x13'));var hardwareService=require(_0x18e6('0x14'));var logger=require(_0x18e6('0x15'))('api');var utils=require(_0x18e6('0x16'));var config=require(_0x18e6('0x17'));var licenseUtil=require(_0x18e6('0x18'));var db=require(_0x18e6('0x19'))['db'];config[_0x18e6('0x1a')]=_[_0x18e6('0x1b')](config[_0x18e6('0x1a')],{'host':_0x18e6('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x18e6('0x1a')]));require(_0x18e6('0x1d'))[_0x18e6('0x1e')](socket);function respondWithStatusCode(_0x568343,_0x656cbb){_0x656cbb=_0x656cbb||0xcc;return function(_0x4a203a){if(_0x4a203a){return _0x568343[_0x18e6('0x1f')](_0x656cbb);}return _0x568343[_0x18e6('0x20')](_0x656cbb)[_0x18e6('0x21')]();};}function respondWithResult(_0x445398,_0x525956){_0x525956=_0x525956||0xc8;return function(_0x233189){if(_0x233189){return _0x445398[_0x18e6('0x20')](_0x525956)[_0x18e6('0x22')](_0x233189);}};}function respondWithFilteredResult(_0xe3ae07,_0x131a11){return function(_0x344588){if(_0x344588){var _0x4247a0=typeof _0x131a11[_0x18e6('0x23')]==='undefined'&&typeof _0x131a11[_0x18e6('0x24')]==='undefined';var _0x27ed7b=_0x344588[_0x18e6('0x25')];var _0x3fdfe1=_0x4247a0?0x0:_0x131a11['offset'];var _0x48d14e=_0x4247a0?_0x344588[_0x18e6('0x25')]:_0x131a11[_0x18e6('0x23')]+_0x131a11[_0x18e6('0x24')];var _0x276768;if(_0x48d14e>=_0x27ed7b){_0x48d14e=_0x27ed7b;_0x276768=0xc8;}else{_0x276768=0xce;}_0xe3ae07[_0x18e6('0x20')](_0x276768);return _0xe3ae07[_0x18e6('0x26')](_0x18e6('0x27'),_0x3fdfe1+'-'+_0x48d14e+'/'+_0x27ed7b)[_0x18e6('0x22')](_0x344588);}return null;};}function patchUpdates(_0x2ccc9e){return function(_0x21f87e){try{jsonpatch[_0x18e6('0x28')](_0x21f87e,_0x2ccc9e,!![]);}catch(_0x41555a){return BPromise[_0x18e6('0x29')](_0x41555a);}return _0x21f87e[_0x18e6('0x2a')]();};}function saveUpdates(_0x49673d,_0x54d164){return function(_0x2fa135){if(_0x2fa135){return _0x2fa135[_0x18e6('0x2b')](_0x49673d)[_0x18e6('0x2c')](function(_0x12768e){return _0x12768e;});}return null;};}function removeEntity(_0x48850d,_0xc87b5c){return function(_0x2e3555){if(_0x2e3555){return _0x2e3555[_0x18e6('0x2d')]()[_0x18e6('0x2c')](function(){var _0x7e2367=_0x2e3555[_0x18e6('0x2e')]({'plain':!![]});var _0x39c8c6=_0x18e6('0x2f');return db[_0x18e6('0x30')]['destroy']({'where':{'type':_0x39c8c6,'resourceId':_0x7e2367['id']}})[_0x18e6('0x2c')](function(){return _0x2e3555;});})[_0x18e6('0x2c')](function(){_0x48850d[_0x18e6('0x20')](0xcc)[_0x18e6('0x21')]();});}};}function handleEntityNotFound(_0x345ed5,_0x349903){return function(_0xc9dbee){if(!_0xc9dbee){_0x345ed5['sendStatus'](0x194);}return _0xc9dbee;};}function handleError(_0x5e0cd8,_0x5c687f){_0x5c687f=_0x5c687f||0x1f4;return function(_0x4036e6){logger['error'](_0x4036e6[_0x18e6('0x31')]);if(_0x4036e6[_0x18e6('0x32')]){delete _0x4036e6[_0x18e6('0x32')];}_0x5e0cd8[_0x18e6('0x20')](_0x5c687f)['send'](_0x4036e6);};}exports['index']=function(_0x1ca1ce,_0x15e9a3){var _0x26454c={},_0x200ed3={},_0x4c7fc9={'count':0x0,'rows':[]};var _0x4f8e2a=_[_0x18e6('0x33')](db['Dashboard'][_0x18e6('0x34')],function(_0x24e26d){return{'name':_0x24e26d[_0x18e6('0x35')],'type':_0x24e26d[_0x18e6('0x36')]['key']};});_0x200ed3['model']=_['map'](_0x4f8e2a,_0x18e6('0x32'));_0x200ed3[_0x18e6('0x37')]=_['keys'](_0x1ca1ce['query']);_0x200ed3[_0x18e6('0x38')]=_['intersection'](_0x200ed3[_0x18e6('0x39')],_0x200ed3[_0x18e6('0x37')]);_0x26454c[_0x18e6('0x3a')]=_[_0x18e6('0x3b')](_0x200ed3[_0x18e6('0x39')],qs[_0x18e6('0x3c')](_0x1ca1ce[_0x18e6('0x37')][_0x18e6('0x3c')]));_0x26454c['attributes']=_0x26454c[_0x18e6('0x3a')][_0x18e6('0x3d')]?_0x26454c[_0x18e6('0x3a')]:_0x200ed3[_0x18e6('0x39')];if(!_0x1ca1ce[_0x18e6('0x37')][_0x18e6('0x3e')](_0x18e6('0x3f'))){_0x26454c[_0x18e6('0x24')]=qs[_0x18e6('0x24')](_0x1ca1ce['query'][_0x18e6('0x24')]);_0x26454c[_0x18e6('0x23')]=qs['offset'](_0x1ca1ce['query'][_0x18e6('0x23')]);}_0x26454c[_0x18e6('0x40')]=qs[_0x18e6('0x41')](_0x1ca1ce['query']['sort']);_0x26454c[_0x18e6('0x42')]=qs[_0x18e6('0x38')](_[_0x18e6('0x43')](_0x1ca1ce['query'],_0x200ed3[_0x18e6('0x38')]),_0x4f8e2a);if(_0x1ca1ce['query'][_0x18e6('0x44')]){_0x26454c[_0x18e6('0x42')]=_[_0x18e6('0x45')](_0x26454c[_0x18e6('0x42')],{'$or':_[_0x18e6('0x33')](_0x4f8e2a,function(_0xf651b6){if(_0xf651b6[_0x18e6('0x36')]!==_0x18e6('0x46')){var _0x1ac0d7={};_0x1ac0d7[_0xf651b6[_0x18e6('0x32')]]={'$like':'%'+_0x1ca1ce[_0x18e6('0x37')][_0x18e6('0x44')]+'%'};return _0x1ac0d7;}})});}_0x26454c=_[_0x18e6('0x45')]({},_0x26454c,_0x1ca1ce[_0x18e6('0x47')]);var _0x766210={'where':_0x26454c[_0x18e6('0x42')]};return db[_0x18e6('0x48')][_0x18e6('0x25')](_0x766210)[_0x18e6('0x2c')](function(_0x1576f7){_0x4c7fc9[_0x18e6('0x25')]=_0x1576f7;if(_0x1ca1ce[_0x18e6('0x37')][_0x18e6('0x49')]){_0x26454c[_0x18e6('0x4a')]=[{'all':!![]}];}return db['Dashboard'][_0x18e6('0x4b')](_0x26454c);})[_0x18e6('0x2c')](function(_0x1e4c90){_0x4c7fc9[_0x18e6('0x4c')]=_0x1e4c90;return _0x4c7fc9;})[_0x18e6('0x2c')](respondWithFilteredResult(_0x15e9a3,_0x26454c))[_0x18e6('0x4d')](handleError(_0x15e9a3,null));};exports[_0x18e6('0x4e')]=function(_0xbc2429,_0x24cd23){var _0x6e8980={'raw':![],'where':{'id':_0xbc2429[_0x18e6('0x4f')]['id']}},_0x58bed4={};_0x58bed4[_0x18e6('0x39')]=_[_0x18e6('0x50')](db['Dashboard'][_0x18e6('0x34')]);_0x58bed4[_0x18e6('0x37')]=_[_0x18e6('0x50')](_0xbc2429[_0x18e6('0x37')]);_0x58bed4[_0x18e6('0x38')]=_['intersection'](_0x58bed4[_0x18e6('0x39')],_0x58bed4[_0x18e6('0x37')]);_0x6e8980[_0x18e6('0x3a')]=_[_0x18e6('0x3b')](_0x58bed4[_0x18e6('0x39')],qs[_0x18e6('0x3c')](_0xbc2429[_0x18e6('0x37')]['fields']));_0x6e8980[_0x18e6('0x3a')]=_0x6e8980[_0x18e6('0x3a')][_0x18e6('0x3d')]?_0x6e8980[_0x18e6('0x3a')]:_0x58bed4['model'];if(_0xbc2429[_0x18e6('0x37')][_0x18e6('0x49')]){_0x6e8980[_0x18e6('0x4a')]=[{'all':!![]}];}_0x6e8980=_[_0x18e6('0x45')]({},_0x6e8980,_0xbc2429['options']);return db[_0x18e6('0x48')][_0x18e6('0x51')](_0x6e8980)[_0x18e6('0x2c')](handleEntityNotFound(_0x24cd23,null))[_0x18e6('0x2c')](respondWithResult(_0x24cd23,null))['catch'](handleError(_0x24cd23,null));};exports[_0x18e6('0x52')]=function(_0x266873,_0x4841fc){return db[_0x18e6('0x48')][_0x18e6('0x52')](_0x266873[_0x18e6('0x53')],{})[_0x18e6('0x2c')](function(_0x5dafb1){var _0x542284=_0x266873[_0x18e6('0x54')]['get']({'plain':!![]});if(!_0x542284)throw new Error(_0x18e6('0x55'));if(_0x542284[_0x18e6('0x56')]===_0x18e6('0x54')){var _0x52cbf1=_0x5dafb1[_0x18e6('0x2e')]({'plain':!![]});var _0x3a7db5='CustomDashboards';return db[_0x18e6('0x57')][_0x18e6('0x51')]({'where':{'name':_0x3a7db5,'userProfileId':_0x542284[_0x18e6('0x58')]},'raw':!![]})['then'](function(_0x4722b7){if(_0x4722b7&&_0x4722b7[_0x18e6('0x59')]===0x0){return db[_0x18e6('0x30')][_0x18e6('0x52')]({'name':_0x52cbf1[_0x18e6('0x32')],'resourceId':_0x52cbf1['id'],'type':_0x4722b7[_0x18e6('0x32')],'sectionId':_0x4722b7['id']},{})['then'](function(){return _0x5dafb1;});}else{return _0x5dafb1;}})[_0x18e6('0x4d')](function(_0x3893c0){logger[_0x18e6('0x5a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3893c0);throw _0x3893c0;});}return _0x5dafb1;})[_0x18e6('0x2c')](respondWithResult(_0x4841fc,0xc9))[_0x18e6('0x4d')](handleError(_0x4841fc,null));};exports[_0x18e6('0x5b')]=function(_0x2272f5,_0x32a428){var _0x32b14f={'where':{'id':_0x2272f5[_0x18e6('0x4f')]['id']}},_0x161332={};_0x161332[_0x18e6('0x39')]=_[_0x18e6('0x50')](db[_0x18e6('0x48')][_0x18e6('0x34')]);_0x32b14f['attributes']=_[_0x18e6('0x3b')](_0x161332['model'],qs[_0x18e6('0x3c')](_0x2272f5[_0x18e6('0x37')]['fields']));_0x32b14f['attributes']=_0x32b14f['attributes'][_0x18e6('0x3d')]?_0x32b14f[_0x18e6('0x3a')]:_0x161332[_0x18e6('0x39')];if(_0x2272f5['query'][_0x18e6('0x49')]){_0x32b14f[_0x18e6('0x4a')]=[{'all':!![]}];}_0x32b14f=_[_0x18e6('0x45')]({},_0x32b14f,_0x2272f5['options']);return db[_0x18e6('0x48')][_0x18e6('0x51')](_0x32b14f)['then'](handleEntityNotFound(_0x32a428,null))[_0x18e6('0x2c')](function(_0x4b8f61){if(_0x4b8f61){var _0x270b9b=_0x4b8f61[_0x18e6('0x2e')]({'plain':!![]});_0x270b9b=qs[_0x18e6('0x5c')](_0x270b9b,['id',_0x18e6('0x5d'),'updatedAt']);_0x2272f5[_0x18e6('0x53')]=_[_0x18e6('0x5c')](_0x2272f5[_0x18e6('0x53')],['id',_0x18e6('0x5d'),'updatedAt']);return db[_0x18e6('0x48')][_0x18e6('0x52')](_[_0x18e6('0x45')](_0x270b9b,_0x2272f5[_0x18e6('0x53')]),{'include':_0x2272f5[_0x18e6('0x37')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x36ee2c){var _0x59060a=_0x2272f5[_0x18e6('0x54')][_0x18e6('0x2e')]({'plain':!![]});if(!_0x59060a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59060a['role']===_0x18e6('0x54')){var _0x14033=_0x36ee2c[_0x18e6('0x2e')]({'plain':!![]});var _0x3d8c6a='CustomDashboards';return db[_0x18e6('0x57')][_0x18e6('0x51')]({'where':{'name':_0x3d8c6a,'userProfileId':_0x59060a[_0x18e6('0x58')]},'raw':!![]})[_0x18e6('0x2c')](function(_0x53415e){if(_0x53415e&&_0x53415e['autoAssociation']===0x0){return db[_0x18e6('0x30')][_0x18e6('0x52')]({'name':_0x14033[_0x18e6('0x32')],'resourceId':_0x14033['id'],'type':_0x53415e[_0x18e6('0x32')],'sectionId':_0x53415e['id']},{})[_0x18e6('0x2c')](function(){return _0x36ee2c;});}else{return _0x36ee2c;}})[_0x18e6('0x4d')](function(_0x3e74cb){logger[_0x18e6('0x5a')](_0x18e6('0x5e'),_0x3e74cb);throw _0x3e74cb;});}return _0x36ee2c;});}})['then'](respondWithResult(_0x32a428,0xc9))[_0x18e6('0x4d')](handleError(_0x32a428,null));};exports['update']=function(_0x720718,_0x37f53b){if(_0x720718[_0x18e6('0x53')]['id']){delete _0x720718[_0x18e6('0x53')]['id'];}return db[_0x18e6('0x48')][_0x18e6('0x51')]({'where':{'id':_0x720718['params']['id']}})[_0x18e6('0x2c')](handleEntityNotFound(_0x37f53b,null))[_0x18e6('0x2c')](saveUpdates(_0x720718[_0x18e6('0x53')],null))[_0x18e6('0x2c')](respondWithResult(_0x37f53b,null))[_0x18e6('0x4d')](handleError(_0x37f53b,null));};exports[_0x18e6('0x2d')]=function(_0x32c11e,_0x53df93){return db[_0x18e6('0x48')]['find']({'where':{'id':_0x32c11e['params']['id']}})[_0x18e6('0x2c')](handleEntityNotFound(_0x53df93,null))[_0x18e6('0x2c')](removeEntity(_0x53df93,null))['catch'](handleError(_0x53df93,null));};function widgetAttributes(_0x186339){try{switch(_0x186339[_0x18e6('0x36')]){case'iframe':return[{'name':_0x18e6('0x5f'),'value':_0x186339[_0x18e6('0x5f')]||(_0x186339[_0x18e6('0x60')]&&_0x186339[_0x18e6('0x60')][0x0]?_0x186339[_0x18e6('0x60')][0x0]['value']:undefined)||_0x18e6('0x61')}];case _0x18e6('0x62'):return[{'name':_0x18e6('0x63'),'value':_0x186339[_0x18e6('0x63')]||(_0x186339[_0x18e6('0x60')]&&_0x186339['attrs'][0x0]?_0x186339['attrs'][0x0][_0x18e6('0x64')]:undefined)||''}];case'clock':return[{'name':_0x18e6('0x65'),'value':_0x186339[_0x18e6('0x65')]||(_0x186339[_0x18e6('0x60')]&&_0x186339[_0x18e6('0x60')][0x0]?_0x186339[_0x18e6('0x60')][0x0]['value']:undefined)||_0x18e6('0x66')},{'name':'attrTimezone','value':_0x186339[_0x18e6('0x67')]||(_0x186339[_0x18e6('0x60')]&&_0x186339[_0x18e6('0x60')][0x1]?_0x186339[_0x18e6('0x60')][0x1]['value']:undefined)||_0x18e6('0x68')},{'name':_0x18e6('0x69'),'value':_0x186339[_0x18e6('0x69')]||(_0x186339['attrs']&&_0x186339[_0x18e6('0x60')][0x2]?_0x186339[_0x18e6('0x60')][0x2][_0x18e6('0x64')]:undefined)||0xc}];case _0x18e6('0x6a'):return[{'name':_0x18e6('0x6b'),'value':_0x186339[_0x18e6('0x6b')]||(_0x186339[_0x18e6('0x60')]&&_0x186339[_0x18e6('0x60')][0x0]?_0x186339['attrs'][0x0][_0x18e6('0x64')]:undefined)||_0x18e6('0x6c')},{'name':_0x18e6('0x6d'),'value':_0x186339[_0x18e6('0x6d')]||(_0x186339[_0x18e6('0x60')]&&_0x186339[_0x18e6('0x60')][0x1]?_0x186339['attrs'][0x1][_0x18e6('0x64')]:undefined)||[]},{'name':_0x18e6('0x69'),'value':_0x186339[_0x18e6('0x69')]||(_0x186339[_0x18e6('0x60')]&&_0x186339[_0x18e6('0x60')][0x2]?_0x186339[_0x18e6('0x60')][0x2][_0x18e6('0x64')]:undefined)||0x14}];case'multibar-chart':case _0x18e6('0x6e'):return[{'name':_0x18e6('0x6f'),'value':_0x186339['attrSerie1']||(_0x186339[_0x18e6('0x60')]&&_0x186339[_0x18e6('0x60')][0x0]?_0x186339[_0x18e6('0x60')][0x0][_0x18e6('0x64')]:undefined)||_0x18e6('0x6c')},{'name':_0x18e6('0x70'),'value':_0x186339[_0x18e6('0x70')]||(_0x186339[_0x18e6('0x60')]&&_0x186339['attrs'][0x1]?_0x186339[_0x18e6('0x60')][0x1]['value']:undefined)||null},{'name':_0x18e6('0x71'),'value':_0x186339[_0x18e6('0x71')]||(_0x186339[_0x18e6('0x60')]&&_0x186339[_0x18e6('0x60')][0x2]?_0x186339[_0x18e6('0x60')][0x2][_0x18e6('0x64')]:undefined)||null},{'name':_0x18e6('0x6d'),'value':_0x186339[_0x18e6('0x6d')]||(_0x186339[_0x18e6('0x60')]&&_0x186339[_0x18e6('0x60')][0x3]?_0x186339['attrs'][0x3]['value']:undefined)||[]}];case _0x18e6('0x72'):return[{'name':_0x18e6('0x73'),'type':_0x186339[_0x18e6('0x74')]||(_0x186339['attrs']&&_0x186339[_0x18e6('0x60')][0x0]?_0x186339['attrs'][0x0][_0x18e6('0x36')]:undefined)||null,'value':_0x186339['attrReport']||(_0x186339['attrs']&&_0x186339[_0x18e6('0x60')][0x0]?_0x186339['attrs'][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x186339[_0x18e6('0x75')]||(_0x186339[_0x18e6('0x60')]&&_0x186339[_0x18e6('0x60')][0x1]?_0x186339[_0x18e6('0x60')][0x1][_0x18e6('0x64')]:undefined)||0x0}];default:return[];}}catch(_0x5f459d){logger['error']('widgetAttributes:\x20%s',JSON[_0x18e6('0x76')](_0x5f459d));return[];}}exports[_0x18e6('0x77')]=function(_0x3f64ff,_0x4a0f5a,_0x29fdff){if(_0x3f64ff[_0x18e6('0x53')]['id']){delete _0x3f64ff['body']['id'];}return db['Dashboard']['find']({'where':{'id':_0x3f64ff['params']['id']}})[_0x18e6('0x2c')](handleEntityNotFound(_0x4a0f5a,null))['then'](function(_0x316a32){if(_0x316a32){_0x3f64ff[_0x18e6('0x53')][_0x18e6('0x78')]=_0x316a32['id'];_0x3f64ff[_0x18e6('0x53')][_0x18e6('0x60')]=widgetAttributes(_0x3f64ff['body']);return db[_0x18e6('0x79')][_0x18e6('0x52')](_0x3f64ff[_0x18e6('0x53')]);}})[_0x18e6('0x2c')](respondWithResult(_0x4a0f5a,null))[_0x18e6('0x4d')](handleError(_0x4a0f5a,null));};exports['getItems']=function(_0x3886a5,_0x520478,_0x5f04b6){var _0x5c0789={};var _0x4e95c1={};var _0x147c04;var _0x5679cb;return db[_0x18e6('0x48')]['findOne']({'where':{'id':_0x3886a5['params']['id']}})['then'](handleEntityNotFound(_0x520478,null))[_0x18e6('0x2c')](function(_0xd12832){if(_0xd12832){_0x147c04=_0xd12832;_0x4e95c1[_0x18e6('0x39')]=_[_0x18e6('0x50')](db[_0x18e6('0x79')][_0x18e6('0x34')]);_0x4e95c1[_0x18e6('0x37')]=_[_0x18e6('0x50')](_0x3886a5[_0x18e6('0x37')]);_0x4e95c1[_0x18e6('0x38')]=_[_0x18e6('0x3b')](_0x4e95c1[_0x18e6('0x39')],_0x4e95c1[_0x18e6('0x37')]);_0x5c0789[_0x18e6('0x3a')]=_[_0x18e6('0x3b')](_0x4e95c1[_0x18e6('0x39')],qs[_0x18e6('0x3c')](_0x3886a5[_0x18e6('0x37')][_0x18e6('0x3c')]));_0x5c0789[_0x18e6('0x3a')]=_0x5c0789['attributes'][_0x18e6('0x3d')]?_0x5c0789[_0x18e6('0x3a')]:_0x4e95c1[_0x18e6('0x39')];_0x5c0789[_0x18e6('0x40')]=qs[_0x18e6('0x41')](_0x3886a5['query'][_0x18e6('0x41')]);_0x5c0789[_0x18e6('0x42')]=qs[_0x18e6('0x38')](_[_0x18e6('0x43')](_0x3886a5['query'],_0x4e95c1[_0x18e6('0x38')]));if(_0x3886a5[_0x18e6('0x37')]['filter']){_0x5c0789[_0x18e6('0x42')]=_[_0x18e6('0x45')](_0x5c0789[_0x18e6('0x42')],{'$or':_[_0x18e6('0x33')](_0x5c0789['attributes'],function(_0x243683){var _0x23a7f1={};_0x23a7f1[_0x243683]={'$like':'%'+_0x3886a5[_0x18e6('0x37')][_0x18e6('0x44')]+'%'};return _0x23a7f1;})});}_0x5c0789=_[_0x18e6('0x45')]({},_0x5c0789,_0x3886a5['options']);return _0x147c04[_0x18e6('0x7a')](_0x5c0789);}})[_0x18e6('0x2c')](function(_0x47fbfc){if(_0x47fbfc){_0x5679cb=_0x47fbfc['length'];if(!_0x3886a5[_0x18e6('0x37')][_0x18e6('0x3e')](_0x18e6('0x3f'))){_0x5c0789[_0x18e6('0x24')]=qs['limit'](_0x3886a5['query'][_0x18e6('0x24')]);_0x5c0789[_0x18e6('0x23')]=qs['offset'](_0x3886a5[_0x18e6('0x37')][_0x18e6('0x23')]);}return _0x147c04[_0x18e6('0x7a')](_0x5c0789);}})[_0x18e6('0x2c')](function(_0x560cd1){if(_0x560cd1){return _0x560cd1?{'count':_0x5679cb,'rows':_0x560cd1}:null;}})['then'](respondWithResult(_0x520478,null))[_0x18e6('0x4d')](handleError(_0x520478,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 6ba9dd1..0cf5014 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 _0x246b=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','Dashboard','setMaxListeners'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x246b,0x176));var _0xb246=function(_0x3544c5,_0x29947f){_0x3544c5=_0x3544c5-0x0;var _0x5ec3cb=_0x246b[_0x3544c5];return _0x5ec3cb;};'use strict';var EventEmitter=require(_0xb246('0x0'));var Dashboard=require(_0xb246('0x1'))['db'][_0xb246('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xb246('0x3')](0x0);var events={'afterCreate':_0xb246('0x4'),'afterUpdate':'update','afterDestroy':_0xb246('0x5')};function emitEvent(_0x346ca8){return function(_0x18ad07,_0x42719f,_0x52fffe){DashboardEvents['emit'](_0x346ca8+':'+_0x18ad07['id'],_0x18ad07);DashboardEvents[_0xb246('0x6')](_0x346ca8,_0x18ad07);_0x52fffe(null);};}for(var e in events){if(events[_0xb246('0x7')](e)){var event=events[e];Dashboard[_0xb246('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x0c32=['hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','save','remove','emit'];(function(_0x5e60cf,_0x43d8e9){var _0x108087=function(_0x487028){while(--_0x487028){_0x5e60cf['push'](_0x5e60cf['shift']());}};_0x108087(++_0x43d8e9);}(_0x0c32,0x158));var _0x20c3=function(_0xf6d826,_0x2fde0f){_0xf6d826=_0xf6d826-0x0;var _0x13057a=_0x0c32[_0xf6d826];return _0x13057a;};'use strict';var EventEmitter=require(_0x20c3('0x0'));var Dashboard=require(_0x20c3('0x1'))['db'][_0x20c3('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x20c3('0x3')](0x0);var events={'afterCreate':_0x20c3('0x4'),'afterUpdate':'update','afterDestroy':_0x20c3('0x5')};function emitEvent(_0x58f349){return function(_0x16e633,_0x2da504,_0x1cffb3){DashboardEvents[_0x20c3('0x6')](_0x58f349+':'+_0x16e633['id'],_0x16e633);DashboardEvents[_0x20c3('0x6')](_0x58f349,_0x16e633);_0x1cffb3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x20c3('0x7')](e,emitEvent(event));}}module[_0x20c3('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 191f3d1..e2821c6 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 _0xca24=['exports','Dashboard','dashboards','util','moment','bluebird','request-promise','path','rimraf','./dashboard.attributes'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xca24,0x17f));var _0x4ca2=function(_0x5e3983,_0x2c3e17){_0x5e3983=_0x5e3983-0x0;var _0x1a3072=_0xca24[_0x5e3983];return _0x1a3072;};'use strict';var _=require('lodash');var util=require(_0x4ca2('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x4ca2('0x1'));var BPromise=require(_0x4ca2('0x2'));var rp=require(_0x4ca2('0x3'));var fs=require('fs');var path=require(_0x4ca2('0x4'));var rimraf=require(_0x4ca2('0x5'));var config=require('../../config/environment');var attributes=require(_0x4ca2('0x6'));module[_0x4ca2('0x7')]=function(_0x1e77e9,_0x5adaee){return _0x1e77e9['define'](_0x4ca2('0x8'),attributes,{'tableName':_0x4ca2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdfcb=['rimraf','define','dashboards','lodash','../../config/logger','bluebird','request-promise'];(function(_0x11f1ea,_0x381b65){var _0x5af5f8=function(_0x4e3ded){while(--_0x4e3ded){_0x11f1ea['push'](_0x11f1ea['shift']());}};_0x5af5f8(++_0x381b65);}(_0xdfcb,0x10d));var _0xbdfc=function(_0x38af48,_0x400460){_0x38af48=_0x38af48-0x0;var _0x445384=_0xdfcb[_0x38af48];return _0x445384;};'use strict';var _=require(_0xbdfc('0x0'));var util=require('util');var logger=require(_0xbdfc('0x1'))('api');var moment=require('moment');var BPromise=require(_0xbdfc('0x2'));var rp=require(_0xbdfc('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbdfc('0x4'));var config=require('../../config/environment');var attributes=require('./dashboard.attributes');module['exports']=function(_0x95d7fa,_0x1f6ff3){return _0x95d7fa[_0xbdfc('0x5')]('Dashboard',attributes,{'tableName':_0xbdfc('0x6'),'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 96d9968..a7e0fa8 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 _0x12f0=['catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./dashboard.socket','register','request','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','Dashboard,\x20%s,\x20%s','message','result'];(function(_0x4317bd,_0x429314){var _0x4953ba=function(_0x5592b7){while(--_0x5592b7){_0x4317bd['push'](_0x4317bd['shift']());}};_0x4953ba(++_0x429314);}(_0x12f0,0xcc));var _0x012f=function(_0x41b6a3,_0x58d1b1){_0x41b6a3=_0x41b6a3-0x0;var _0x524f0f=_0x12f0[_0x41b6a3];return _0x524f0f;};'use strict';var _=require('lodash');var util=require(_0x012f('0x0'));var moment=require(_0x012f('0x1'));var BPromise=require(_0x012f('0x2'));var rs=require(_0x012f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x012f('0x4'))['db'];var utils=require(_0x012f('0x5'));var logger=require(_0x012f('0x6'))(_0x012f('0x7'));var config=require(_0x012f('0x8'));var jayson=require(_0x012f('0x9'));var client=jayson[_0x012f('0xa')][_0x012f('0xb')]({'port':0x232a});config['redis']=_[_0x012f('0xc')](config['redis'],{'host':_0x012f('0xd'),'port':0x18eb});var socket=require(_0x012f('0xe'))(new Redis(config[_0x012f('0xf')]));require(_0x012f('0x10'))[_0x012f('0x11')](socket);function respondWithRpcPromise(_0x9398d5,_0x4c246b,_0x55cbd5){return new BPromise(function(_0x3080b7,_0x79d283){return client[_0x012f('0x12')](_0x9398d5,_0x55cbd5)['then'](function(_0x47c22c){logger[_0x012f('0x13')]('Dashboard,\x20%s,\x20%s',_0x4c246b,_0x012f('0x14'));logger[_0x012f('0x15')](_0x012f('0x16'),_0x4c246b,_0x012f('0x14'),JSON['stringify'](_0x47c22c));if(_0x47c22c[_0x012f('0x17')]){if(_0x47c22c[_0x012f('0x17')][_0x012f('0x18')]===0x1f4){logger[_0x012f('0x17')](_0x012f('0x19'),_0x4c246b,_0x47c22c[_0x012f('0x17')][_0x012f('0x1a')]);return _0x79d283(_0x47c22c[_0x012f('0x17')][_0x012f('0x1a')]);}logger['error'](_0x012f('0x19'),_0x4c246b,_0x47c22c[_0x012f('0x17')][_0x012f('0x1a')]);return _0x3080b7(_0x47c22c[_0x012f('0x17')][_0x012f('0x1a')]);}else{logger[_0x012f('0x13')](_0x012f('0x19'),_0x4c246b,'request\x20sent');_0x3080b7(_0x47c22c[_0x012f('0x1b')][_0x012f('0x1a')]);}})[_0x012f('0x1c')](function(_0x5311a3){logger['error'](_0x012f('0x19'),_0x4c246b,_0x5311a3);_0x79d283(_0x5311a3);});});} \ No newline at end of file +var _0x6dbb=['Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then'];(function(_0x3df5ce,_0x4edc02){var _0x54f27f=function(_0x148962){while(--_0x148962){_0x3df5ce['push'](_0x3df5ce['shift']());}};_0x54f27f(++_0x4edc02);}(_0x6dbb,0x10f));var _0xb6db=function(_0x2a059a,_0xc5c6f1){_0x2a059a=_0x2a059a-0x0;var _0x16b9fa=_0x6dbb[_0x2a059a];return _0x16b9fa;};'use strict';var _=require(_0xb6db('0x0'));var util=require(_0xb6db('0x1'));var moment=require('moment');var BPromise=require(_0xb6db('0x2'));var rs=require(_0xb6db('0x3'));var fs=require('fs');var Redis=require(_0xb6db('0x4'));var db=require(_0xb6db('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb6db('0x6'))(_0xb6db('0x7'));var config=require(_0xb6db('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb6db('0x9')][_0xb6db('0xa')]({'port':0x232a});config[_0xb6db('0xb')]=_[_0xb6db('0xc')](config[_0xb6db('0xb')],{'host':_0xb6db('0xd'),'port':0x18eb});var socket=require(_0xb6db('0xe'))(new Redis(config['redis']));require(_0xb6db('0xf'))[_0xb6db('0x10')](socket);function respondWithRpcPromise(_0x87ad35,_0x484a62,_0x38932e){return new BPromise(function(_0x4194e0,_0x1776fc){return client[_0xb6db('0x11')](_0x87ad35,_0x38932e)[_0xb6db('0x12')](function(_0x346b22){logger['info'](_0xb6db('0x13'),_0x484a62,'request\x20sent');logger[_0xb6db('0x14')](_0xb6db('0x15'),_0x484a62,_0xb6db('0x16'),JSON['stringify'](_0x346b22));if(_0x346b22[_0xb6db('0x17')]){if(_0x346b22[_0xb6db('0x17')][_0xb6db('0x18')]===0x1f4){logger[_0xb6db('0x17')](_0xb6db('0x13'),_0x484a62,_0x346b22[_0xb6db('0x17')][_0xb6db('0x19')]);return _0x1776fc(_0x346b22[_0xb6db('0x17')][_0xb6db('0x19')]);}logger[_0xb6db('0x17')](_0xb6db('0x13'),_0x484a62,_0x346b22[_0xb6db('0x17')]['message']);return _0x4194e0(_0x346b22[_0xb6db('0x17')][_0xb6db('0x19')]);}else{logger[_0xb6db('0x1a')](_0xb6db('0x13'),_0x484a62,_0xb6db('0x16'));_0x4194e0(_0x346b22[_0xb6db('0x1b')][_0xb6db('0x19')]);}})[_0xb6db('0x1c')](function(_0x51a83c){logger['error'](_0xb6db('0x13'),_0x484a62,_0x51a83c);_0x1776fc(_0x51a83c);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 92578d9..0c27d87 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 _0xe4b0=['removeListener','length','dashboard:','./dashboard.events','save','remove','update','emit'];(function(_0x5eb3a9,_0x2ed2a7){var _0x384800=function(_0xa88281){while(--_0xa88281){_0x5eb3a9['push'](_0x5eb3a9['shift']());}};_0x384800(++_0x2ed2a7);}(_0xe4b0,0x13b));var _0x0e4b=function(_0x45f6cb,_0x531af6){_0x45f6cb=_0x45f6cb-0x0;var _0x5b7f93=_0xe4b0[_0x45f6cb];return _0x5b7f93;};'use strict';var DashboardEvents=require(_0x0e4b('0x0'));var events=[_0x0e4b('0x1'),_0x0e4b('0x2'),_0x0e4b('0x3')];function createListener(_0x2aacf3,_0x4a132d){return function(_0x292a70){_0x4a132d[_0x0e4b('0x4')](_0x2aacf3,_0x292a70);};}function removeListener(_0x649cba,_0x5c5ac8){return function(){DashboardEvents[_0x0e4b('0x5')](_0x649cba,_0x5c5ac8);};}exports['register']=function(_0x36bf30){for(var _0x4ad9b0=0x0,_0x2c719f=events[_0x0e4b('0x6')];_0x4ad9b0<_0x2c719f;_0x4ad9b0++){var _0x1fffe1=events[_0x4ad9b0];var _0x5efe6e=createListener(_0x0e4b('0x7')+_0x1fffe1,_0x36bf30);DashboardEvents['on'](_0x1fffe1,_0x5efe6e);}}; \ No newline at end of file +var _0xe79c=['dashboard:','./dashboard.events','save','update','emit','removeListener','length'];(function(_0x32eb4a,_0x427efa){var _0x527133=function(_0x36e8fa){while(--_0x36e8fa){_0x32eb4a['push'](_0x32eb4a['shift']());}};_0x527133(++_0x427efa);}(_0xe79c,0x1a5));var _0xce79=function(_0x2b03e4,_0xe14ca3){_0x2b03e4=_0x2b03e4-0x0;var _0x18f6aa=_0xe79c[_0x2b03e4];return _0x18f6aa;};'use strict';var DashboardEvents=require(_0xce79('0x0'));var events=[_0xce79('0x1'),'remove',_0xce79('0x2')];function createListener(_0x5ab112,_0x3cd26c){return function(_0x2304c6){_0x3cd26c[_0xce79('0x3')](_0x5ab112,_0x2304c6);};}function removeListener(_0x5ace3a,_0x41b3e4){return function(){DashboardEvents[_0xce79('0x4')](_0x5ace3a,_0x41b3e4);};}exports['register']=function(_0x1964a1){for(var _0x53f5aa=0x0,_0x338452=events[_0xce79('0x5')];_0x53f5aa<_0x338452;_0x53f5aa++){var _0x4ce670=events[_0x53f5aa];var _0x16e5b6=createListener(_0xce79('0x6')+_0x4ce670,_0x1964a1);DashboardEvents['on'](_0x4ce670,_0x16e5b6);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index c2f4051..ad3928d 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 _0x67d9=['connect-timeout','Router','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','create','post','/:id/clone','clone','addItem','put','destroy','multer','util','path'];(function(_0x57fa65,_0x4e1547){var _0x472f13=function(_0x4b1389){while(--_0x4b1389){_0x57fa65['push'](_0x57fa65['shift']());}};_0x472f13(++_0x4e1547);}(_0x67d9,0xe4));var _0x967d=function(_0x1c1a18,_0x3db226){_0x1c1a18=_0x1c1a18-0x0;var _0x5c3400=_0x67d9[_0x1c1a18];return _0x5c3400;};'use strict';var multer=require(_0x967d('0x0'));var util=require(_0x967d('0x1'));var path=require(_0x967d('0x2'));var timeout=require(_0x967d('0x3'));var express=require('express');var router=express[_0x967d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x967d('0x5'));var controller=require(_0x967d('0x6'));router[_0x967d('0x7')]('/',auth[_0x967d('0x8')](),controller[_0x967d('0x9')]);router[_0x967d('0x7')](_0x967d('0xa'),auth[_0x967d('0x8')](),controller[_0x967d('0xb')]);router[_0x967d('0x7')](_0x967d('0xc'),auth['isAuthenticated'](),controller[_0x967d('0xd')]);router['post']('/',auth[_0x967d('0x8')](),controller[_0x967d('0xe')]);router[_0x967d('0xf')](_0x967d('0x10'),auth['isAuthenticated'](),controller[_0x967d('0x11')]);router[_0x967d('0xf')](_0x967d('0xc'),auth[_0x967d('0x8')](),controller[_0x967d('0x12')]);router[_0x967d('0x13')](_0x967d('0xa'),auth[_0x967d('0x8')](),controller['update']);router['delete'](_0x967d('0xa'),auth['isAuthenticated'](),controller[_0x967d('0x14')]);module['exports']=router; \ No newline at end of file +var _0xee9e=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/items','getItems','post','/:id/clone','clone','addItem','put','update','delete','exports','multer'];(function(_0x3f853a,_0x5a1036){var _0x2e342b=function(_0x43d45a){while(--_0x43d45a){_0x3f853a['push'](_0x3f853a['shift']());}};_0x2e342b(++_0x5a1036);}(_0xee9e,0xb7));var _0xeee9=function(_0xeecc3c,_0x529b5b){_0xeecc3c=_0xeecc3c-0x0;var _0x280dbc=_0xee9e[_0xeecc3c];return _0x280dbc;};'use strict';var multer=require(_0xeee9('0x0'));var util=require(_0xeee9('0x1'));var path=require(_0xeee9('0x2'));var timeout=require(_0xeee9('0x3'));var express=require(_0xeee9('0x4'));var router=express[_0xeee9('0x5')]();var fs_extra=require(_0xeee9('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xeee9('0x7'));var config=require(_0xeee9('0x8'));var controller=require('./dashboard.controller');router['get']('/',auth[_0xeee9('0x9')](),controller[_0xeee9('0xa')]);router[_0xeee9('0xb')](_0xeee9('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xeee9('0xb')](_0xeee9('0xd'),auth['isAuthenticated'](),controller[_0xeee9('0xe')]);router['post']('/',auth[_0xeee9('0x9')](),controller['create']);router[_0xeee9('0xf')](_0xeee9('0x10'),auth[_0xeee9('0x9')](),controller[_0xeee9('0x11')]);router[_0xeee9('0xf')]('/:id/items',auth[_0xeee9('0x9')](),controller[_0xeee9('0x12')]);router[_0xeee9('0x13')]('/:id',auth[_0xeee9('0x9')](),controller[_0xeee9('0x14')]);router[_0xeee9('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xeee9('0x16')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index cd03c00..b806385 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 _0x5d17=['#ffffff','sequelize','squel','STRING','TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x14a513,_0x3239f){var _0x47236c=function(_0x394191){while(--_0x394191){_0x14a513['push'](_0x14a513['shift']());}};_0x47236c(++_0x3239f);}(_0x5d17,0x114));var _0x75d1=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x5d17[_0x4b7b62];return _0x2280df;};'use strict';var Sequelize=require(_0x75d1('0x0'));var squel=require(_0x75d1('0x1'));var _=require('lodash');module['exports']={'title':{'type':Sequelize[_0x75d1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x75d1('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x75d1('0x3')]('long'),'get':function(){try{return JSON[_0x75d1('0x4')](this[_0x75d1('0x5')](_0x75d1('0x6')));}catch(_0x32bd45){return[];}},'set':function(_0x56ac0a){try{this[_0x75d1('0x7')](_0x75d1('0x6'),JSON[_0x75d1('0x8')](_0x56ac0a));}catch(_0x1ee61b){this[_0x75d1('0x7')](_0x75d1('0x6'),JSON[_0x75d1('0x8')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x75d1('0x9')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x75d1('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x75d1('0x2')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x75d1('0x2')]},'titleFontSize':{'type':Sequelize[_0x75d1('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0xabce=['squel','lodash','exports','STRING','long','parse','getDataValue','attrs','setDataValue','INTEGER','#ffffff','#2196f3','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabce,0x103));var _0xeabc=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xabce[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0xeabc('0x0'));var squel=require(_0xeabc('0x1'));var _=require(_0xeabc('0x2'));module[_0xeabc('0x3')]={'title':{'type':Sequelize[_0xeabc('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xeabc('0x5')),'get':function(){try{return JSON[_0xeabc('0x6')](this[_0xeabc('0x7')]('attrs'));}catch(_0x54e4a8){return[];}},'set':function(_0x1b07a8){try{this['setDataValue'](_0xeabc('0x8'),JSON['stringify'](_0x1b07a8));}catch(_0x3bdc29){this[_0xeabc('0x9')](_0xeabc('0x8'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xeabc('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xeabc('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xeabc('0xa')]},'col':{'type':Sequelize[_0xeabc('0xa')]},'background':{'type':Sequelize[_0xeabc('0x4')],'allowNull':![],'defaultValue':_0xeabc('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xeabc('0x4')],'allowNull':![],'defaultValue':_0xeabc('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xeabc('0x4')]},'titleFontSize':{'type':Sequelize[_0xeabc('0xa')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index cdfc86b..896898e 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 _0x7b5b=['end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','show','params','model','keys','query','filters','intersection','attributes','fields','includeAll','merge','options','DashboardItem','find','catch','destroy','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s','stringify','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','status'];(function(_0x510188,_0x3adb38){var _0x4b63a8=function(_0x5d1e47){while(--_0x5d1e47){_0x510188['push'](_0x510188['shift']());}};_0x4b63a8(++_0x3adb38);}(_0x7b5b,0x14a));var _0xb7b5=function(_0x5c770,_0x5af413){_0x5c770=_0x5c770-0x0;var _0x51f52e=_0x7b5b[_0x5c770];return _0x51f52e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb7b5('0x0'));var zipdir=require(_0xb7b5('0x1'));var jsonpatch=require(_0xb7b5('0x2'));var rp=require(_0xb7b5('0x3'));var moment=require(_0xb7b5('0x4'));var BPromise=require(_0xb7b5('0x5'));var Mustache=require(_0xb7b5('0x6'));var util=require(_0xb7b5('0x7'));var path=require(_0xb7b5('0x8'));var sox=require(_0xb7b5('0x9'));var csv=require(_0xb7b5('0xa'));var ejs=require(_0xb7b5('0xb'));var fs=require('fs');var fs_extra=require(_0xb7b5('0xc'));var _=require(_0xb7b5('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb7b5('0xe'));var deskjs=require(_0xb7b5('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb7b5('0x10'));var Redis=require(_0xb7b5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb7b5('0x12'));var as=require(_0xb7b5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb7b5('0x14'));var utils=require(_0xb7b5('0x15'));var config=require(_0xb7b5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb7b5('0x17'))['db'];config[_0xb7b5('0x18')]=_['defaults'](config['redis'],{'host':_0xb7b5('0x19'),'port':0x18eb});var socket=require(_0xb7b5('0x1a'))(new Redis(config[_0xb7b5('0x18')]));require(_0xb7b5('0x1b'))[_0xb7b5('0x1c')](socket);function respondWithStatusCode(_0x1e23ba,_0x37ef65){_0x37ef65=_0x37ef65||0xcc;return function(_0x11bec6){if(_0x11bec6){return _0x1e23ba['sendStatus'](_0x37ef65);}return _0x1e23ba[_0xb7b5('0x1d')](_0x37ef65)[_0xb7b5('0x1e')]();};}function respondWithResult(_0x5def9e,_0x241fcb){_0x241fcb=_0x241fcb||0xc8;return function(_0x5c4adc){if(_0x5c4adc){return _0x5def9e[_0xb7b5('0x1d')](_0x241fcb)['json'](_0x5c4adc);}};}function respondWithFilteredResult(_0x55f17a,_0x2dcc32){return function(_0x14ff87){if(_0x14ff87){var _0x26ae81=typeof _0x2dcc32[_0xb7b5('0x1f')]==='undefined'&&typeof _0x2dcc32['limit']===_0xb7b5('0x20');var _0x460042=_0x14ff87[_0xb7b5('0x21')];var _0x503b1e=_0x26ae81?0x0:_0x2dcc32[_0xb7b5('0x1f')];var _0x4e9fc2=_0x26ae81?_0x14ff87[_0xb7b5('0x21')]:_0x2dcc32[_0xb7b5('0x1f')]+_0x2dcc32['limit'];var _0xd11b80;if(_0x4e9fc2>=_0x460042){_0x4e9fc2=_0x460042;_0xd11b80=0xc8;}else{_0xd11b80=0xce;}_0x55f17a[_0xb7b5('0x1d')](_0xd11b80);return _0x55f17a[_0xb7b5('0x22')](_0xb7b5('0x23'),_0x503b1e+'-'+_0x4e9fc2+'/'+_0x460042)[_0xb7b5('0x24')](_0x14ff87);}return null;};}function patchUpdates(_0x55221b){return function(_0x317248){try{jsonpatch[_0xb7b5('0x25')](_0x317248,_0x55221b,!![]);}catch(_0x22a073){return BPromise[_0xb7b5('0x26')](_0x22a073);}return _0x317248[_0xb7b5('0x27')]();};}function saveUpdates(_0xb11413,_0x36a7db){return function(_0x377cf2){if(_0x377cf2){return _0x377cf2[_0xb7b5('0x28')](_0xb11413)[_0xb7b5('0x29')](function(_0x5e6f41){return _0x5e6f41;});}return null;};}function removeEntity(_0x4f0ef3,_0x52c97d){return function(_0x4ad7e6){if(_0x4ad7e6){return _0x4ad7e6['destroy']()[_0xb7b5('0x29')](function(){_0x4f0ef3[_0xb7b5('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x268cfa,_0x437bce){return function(_0x1ba866){if(!_0x1ba866){_0x268cfa['sendStatus'](0x194);}return _0x1ba866;};}function handleError(_0xc99b46,_0x222713){_0x222713=_0x222713||0x1f4;return function(_0x5d2193){logger[_0xb7b5('0x2a')](_0x5d2193[_0xb7b5('0x2b')]);if(_0x5d2193[_0xb7b5('0x2c')]){delete _0x5d2193['name'];}_0xc99b46[_0xb7b5('0x1d')](_0x222713)[_0xb7b5('0x2d')](_0x5d2193);};}exports[_0xb7b5('0x2e')]=function(_0x2f822f,_0x6f9bfd){var _0x554da6={'raw':![],'where':{'id':_0x2f822f[_0xb7b5('0x2f')]['id']}},_0x14dbe3={};_0x14dbe3[_0xb7b5('0x30')]=_[_0xb7b5('0x31')](db['DashboardItem']['rawAttributes']);_0x14dbe3[_0xb7b5('0x32')]=_[_0xb7b5('0x31')](_0x2f822f['query']);_0x14dbe3[_0xb7b5('0x33')]=_[_0xb7b5('0x34')](_0x14dbe3['model'],_0x14dbe3[_0xb7b5('0x32')]);_0x554da6[_0xb7b5('0x35')]=_['intersection'](_0x14dbe3['model'],qs[_0xb7b5('0x36')](_0x2f822f[_0xb7b5('0x32')][_0xb7b5('0x36')]));_0x554da6['attributes']=_0x554da6['attributes']['length']?_0x554da6[_0xb7b5('0x35')]:_0x14dbe3[_0xb7b5('0x30')];if(_0x2f822f['query'][_0xb7b5('0x37')]){_0x554da6['include']=[{'all':!![]}];}_0x554da6=_[_0xb7b5('0x38')]({},_0x554da6,_0x2f822f[_0xb7b5('0x39')]);return db[_0xb7b5('0x3a')][_0xb7b5('0x3b')](_0x554da6)[_0xb7b5('0x29')](handleEntityNotFound(_0x6f9bfd,null))[_0xb7b5('0x29')](respondWithResult(_0x6f9bfd,null))[_0xb7b5('0x3c')](handleError(_0x6f9bfd,null));};exports[_0xb7b5('0x3d')]=function(_0x2ec8cb,_0x25c11f){return db[_0xb7b5('0x3a')][_0xb7b5('0x3b')]({'where':{'id':_0x2ec8cb[_0xb7b5('0x2f')]['id']}})['then'](handleEntityNotFound(_0x25c11f,null))['then'](removeEntity(_0x25c11f,null))[_0xb7b5('0x3c')](handleError(_0x25c11f,null));};function widgetAttributes(_0x4d6d9e){try{switch(_0x4d6d9e['type']){case _0xb7b5('0x3e'):return[{'name':_0xb7b5('0x3f'),'value':_0x4d6d9e[_0xb7b5('0x3f')]||(_0x4d6d9e[_0xb7b5('0x40')]&&_0x4d6d9e[_0xb7b5('0x40')][0x0]?_0x4d6d9e[_0xb7b5('0x40')][0x0][_0xb7b5('0x41')]:undefined)||'https://'}];case _0xb7b5('0x42'):return[{'name':'attrPath','value':_0x4d6d9e[_0xb7b5('0x43')]||(_0x4d6d9e[_0xb7b5('0x40')]&&_0x4d6d9e['attrs'][0x0]?_0x4d6d9e['attrs'][0x0]['value']:undefined)||''}];case _0xb7b5('0x44'):return[{'name':_0xb7b5('0x45'),'value':_0x4d6d9e[_0xb7b5('0x45')]||(_0x4d6d9e[_0xb7b5('0x40')]&&_0x4d6d9e[_0xb7b5('0x40')][0x0]?_0x4d6d9e[_0xb7b5('0x40')][0x0]['value']:undefined)||_0xb7b5('0x46')},{'name':'attrTimezone','value':_0x4d6d9e[_0xb7b5('0x47')]||(_0x4d6d9e[_0xb7b5('0x40')]&&_0x4d6d9e[_0xb7b5('0x40')][0x1]?_0x4d6d9e[_0xb7b5('0x40')][0x1][_0xb7b5('0x41')]:undefined)||_0xb7b5('0x48')},{'name':'attrFontSize','value':_0x4d6d9e[_0xb7b5('0x49')]||(_0x4d6d9e[_0xb7b5('0x40')]&&_0x4d6d9e[_0xb7b5('0x40')][0x2]?_0x4d6d9e[_0xb7b5('0x40')][0x2]['value']:undefined)||0xc}];case _0xb7b5('0x4a'):return[{'name':_0xb7b5('0x4b'),'value':_0x4d6d9e['attrMetric']||(_0x4d6d9e[_0xb7b5('0x40')]&&_0x4d6d9e[_0xb7b5('0x40')][0x0]?_0x4d6d9e[_0xb7b5('0x40')][0x0][_0xb7b5('0x41')]:undefined)||_0xb7b5('0x4c')},{'name':_0xb7b5('0x4d'),'value':_0x4d6d9e[_0xb7b5('0x4d')]||(_0x4d6d9e[_0xb7b5('0x40')]&&_0x4d6d9e['attrs'][0x1]?_0x4d6d9e[_0xb7b5('0x40')][0x1]['value']:undefined)||[]},{'name':_0xb7b5('0x49'),'value':_0x4d6d9e[_0xb7b5('0x49')]||(_0x4d6d9e[_0xb7b5('0x40')]&&_0x4d6d9e[_0xb7b5('0x40')][0x2]?_0x4d6d9e['attrs'][0x2][_0xb7b5('0x41')]:undefined)||0x14}];case _0xb7b5('0x4e'):case'pie-chart':return[{'name':_0xb7b5('0x4f'),'value':_0x4d6d9e[_0xb7b5('0x4f')]||(_0x4d6d9e['attrs']&&_0x4d6d9e['attrs'][0x0]?_0x4d6d9e[_0xb7b5('0x40')][0x0][_0xb7b5('0x41')]:undefined)||_0xb7b5('0x4c')},{'name':'attrSerie2','value':_0x4d6d9e[_0xb7b5('0x50')]||(_0x4d6d9e['attrs']&&_0x4d6d9e[_0xb7b5('0x40')][0x1]?_0x4d6d9e[_0xb7b5('0x40')][0x1][_0xb7b5('0x41')]:undefined)||null},{'name':'attrSerie3','value':_0x4d6d9e[_0xb7b5('0x51')]||(_0x4d6d9e[_0xb7b5('0x40')]&&_0x4d6d9e[_0xb7b5('0x40')][0x2]?_0x4d6d9e[_0xb7b5('0x40')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x4d6d9e[_0xb7b5('0x4d')]||(_0x4d6d9e[_0xb7b5('0x40')]&&_0x4d6d9e[_0xb7b5('0x40')][0x3]?_0x4d6d9e[_0xb7b5('0x40')][0x3][_0xb7b5('0x41')]:undefined)||[]}];case _0xb7b5('0x52'):return[{'name':_0xb7b5('0x53'),'type':_0x4d6d9e[_0xb7b5('0x54')]||(_0x4d6d9e[_0xb7b5('0x40')]&&_0x4d6d9e[_0xb7b5('0x40')][0x0]?_0x4d6d9e[_0xb7b5('0x40')][0x0][_0xb7b5('0x55')]:undefined)||null,'value':_0x4d6d9e[_0xb7b5('0x53')]||(_0x4d6d9e[_0xb7b5('0x40')]&&_0x4d6d9e[_0xb7b5('0x40')][0x0]?_0x4d6d9e['attrs'][0x0][_0xb7b5('0x41')]:undefined)||null},{'name':'attrRefresh','value':_0x4d6d9e[_0xb7b5('0x56')]||(_0x4d6d9e[_0xb7b5('0x40')]&&_0x4d6d9e[_0xb7b5('0x40')][0x1]?_0x4d6d9e['attrs'][0x1][_0xb7b5('0x41')]:undefined)||0x0}];default:return[];}}catch(_0x52c32a){logger['error'](_0xb7b5('0x57'),JSON[_0xb7b5('0x58')](_0x52c32a));return[];}}exports['create']=function(_0x17f3b0,_0x1184e1){if(_0x17f3b0['body']){_0x17f3b0[_0xb7b5('0x59')][_0xb7b5('0x40')]=widgetAttributes(_0x17f3b0['body']);}return db['DashboardItem']['create'](_0x17f3b0['body'],{})[_0xb7b5('0x29')](respondWithResult(_0x1184e1,0xc9))['catch'](handleError(_0x1184e1,null));};exports[_0xb7b5('0x28')]=function(_0x5ec6a5,_0x506232){if(_0x5ec6a5['body']['id']){delete _0x5ec6a5[_0xb7b5('0x59')]['id'];}_0x5ec6a5[_0xb7b5('0x59')][_0xb7b5('0x40')]=widgetAttributes(_0x5ec6a5[_0xb7b5('0x59')]);return db[_0xb7b5('0x3a')]['find']({'where':{'id':_0x5ec6a5[_0xb7b5('0x2f')]['id']}})[_0xb7b5('0x29')](handleEntityNotFound(_0x506232,null))[_0xb7b5('0x29')](saveUpdates(_0x5ec6a5[_0xb7b5('0x59')],null))[_0xb7b5('0x29')](respondWithResult(_0x506232,null))[_0xb7b5('0x3c')](handleError(_0x506232,null));}; \ No newline at end of file +var _0x07b5=['widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','params','model','keys','DashboardItem','rawAttributes','query','intersection','attributes','fields','includeAll','include','merge','options','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh'];(function(_0x1a8e9d,_0x34808a){var _0x5a9810=function(_0x5d6717){while(--_0x5d6717){_0x1a8e9d['push'](_0x1a8e9d['shift']());}};_0x5a9810(++_0x34808a);}(_0x07b5,0x10f));var _0x507b=function(_0x2da357,_0x1f9b2f){_0x2da357=_0x2da357-0x0;var _0x138fdd=_0x07b5[_0x2da357];return _0x138fdd;};'use strict';var emlformat=require(_0x507b('0x0'));var rimraf=require(_0x507b('0x1'));var zipdir=require(_0x507b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x507b('0x3'));var BPromise=require(_0x507b('0x4'));var Mustache=require(_0x507b('0x5'));var util=require(_0x507b('0x6'));var path=require(_0x507b('0x7'));var sox=require('sox');var csv=require(_0x507b('0x8'));var ejs=require(_0x507b('0x9'));var fs=require('fs');var fs_extra=require(_0x507b('0xa'));var _=require(_0x507b('0xb'));var squel=require('squel');var crypto=require(_0x507b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x507b('0x8'));var querystring=require(_0x507b('0xd'));var Papa=require(_0x507b('0xe'));var Redis=require(_0x507b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x507b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x507b('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x507b('0x12'));var licenseUtil=require(_0x507b('0x13'));var db=require(_0x507b('0x14'))['db'];config['redis']=_[_0x507b('0x15')](config[_0x507b('0x16')],{'host':_0x507b('0x17'),'port':0x18eb});var socket=require(_0x507b('0x18'))(new Redis(config['redis']));require(_0x507b('0x19'))[_0x507b('0x1a')](socket);function respondWithStatusCode(_0x58a1c9,_0x46a294){_0x46a294=_0x46a294||0xcc;return function(_0x52be32){if(_0x52be32){return _0x58a1c9[_0x507b('0x1b')](_0x46a294);}return _0x58a1c9[_0x507b('0x1c')](_0x46a294)[_0x507b('0x1d')]();};}function respondWithResult(_0x24329e,_0x5d39a3){_0x5d39a3=_0x5d39a3||0xc8;return function(_0x3d9e9b){if(_0x3d9e9b){return _0x24329e[_0x507b('0x1c')](_0x5d39a3)[_0x507b('0x1e')](_0x3d9e9b);}};}function respondWithFilteredResult(_0x21ac54,_0x59ca99){return function(_0xa82240){if(_0xa82240){var _0x150ab9=typeof _0x59ca99[_0x507b('0x1f')]==='undefined'&&typeof _0x59ca99[_0x507b('0x20')]===_0x507b('0x21');var _0x1b1fe1=_0xa82240[_0x507b('0x22')];var _0x4efee7=_0x150ab9?0x0:_0x59ca99[_0x507b('0x1f')];var _0xd1da35=_0x150ab9?_0xa82240['count']:_0x59ca99[_0x507b('0x1f')]+_0x59ca99['limit'];var _0x47a502;if(_0xd1da35>=_0x1b1fe1){_0xd1da35=_0x1b1fe1;_0x47a502=0xc8;}else{_0x47a502=0xce;}_0x21ac54[_0x507b('0x1c')](_0x47a502);return _0x21ac54[_0x507b('0x23')]('Content-Range',_0x4efee7+'-'+_0xd1da35+'/'+_0x1b1fe1)[_0x507b('0x1e')](_0xa82240);}return null;};}function patchUpdates(_0x2c36c4){return function(_0x48ba23){try{jsonpatch[_0x507b('0x24')](_0x48ba23,_0x2c36c4,!![]);}catch(_0x205a37){return BPromise[_0x507b('0x25')](_0x205a37);}return _0x48ba23[_0x507b('0x26')]();};}function saveUpdates(_0x2d6a4e,_0x13e9b2){return function(_0x41bb76){if(_0x41bb76){return _0x41bb76[_0x507b('0x27')](_0x2d6a4e)[_0x507b('0x28')](function(_0x7c634f){return _0x7c634f;});}return null;};}function removeEntity(_0x588fbd,_0x58e180){return function(_0x21809c){if(_0x21809c){return _0x21809c[_0x507b('0x29')]()[_0x507b('0x28')](function(){_0x588fbd[_0x507b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e6cda,_0x485443){return function(_0x1cd9d9){if(!_0x1cd9d9){_0x4e6cda[_0x507b('0x1b')](0x194);}return _0x1cd9d9;};}function handleError(_0x20746,_0x221255){_0x221255=_0x221255||0x1f4;return function(_0x3717a4){logger[_0x507b('0x2a')](_0x3717a4[_0x507b('0x2b')]);if(_0x3717a4[_0x507b('0x2c')]){delete _0x3717a4[_0x507b('0x2c')];}_0x20746['status'](_0x221255)[_0x507b('0x2d')](_0x3717a4);};}exports['show']=function(_0x29228a,_0x4d0ad2){var _0x3fd01d={'raw':![],'where':{'id':_0x29228a[_0x507b('0x2e')]['id']}},_0x54f1ff={};_0x54f1ff[_0x507b('0x2f')]=_[_0x507b('0x30')](db[_0x507b('0x31')][_0x507b('0x32')]);_0x54f1ff[_0x507b('0x33')]=_['keys'](_0x29228a['query']);_0x54f1ff['filters']=_[_0x507b('0x34')](_0x54f1ff[_0x507b('0x2f')],_0x54f1ff[_0x507b('0x33')]);_0x3fd01d[_0x507b('0x35')]=_[_0x507b('0x34')](_0x54f1ff['model'],qs[_0x507b('0x36')](_0x29228a[_0x507b('0x33')][_0x507b('0x36')]));_0x3fd01d[_0x507b('0x35')]=_0x3fd01d[_0x507b('0x35')]['length']?_0x3fd01d[_0x507b('0x35')]:_0x54f1ff[_0x507b('0x2f')];if(_0x29228a[_0x507b('0x33')][_0x507b('0x37')]){_0x3fd01d[_0x507b('0x38')]=[{'all':!![]}];}_0x3fd01d=_[_0x507b('0x39')]({},_0x3fd01d,_0x29228a[_0x507b('0x3a')]);return db[_0x507b('0x31')][_0x507b('0x3b')](_0x3fd01d)[_0x507b('0x28')](handleEntityNotFound(_0x4d0ad2,null))[_0x507b('0x28')](respondWithResult(_0x4d0ad2,null))[_0x507b('0x3c')](handleError(_0x4d0ad2,null));};exports[_0x507b('0x29')]=function(_0x53496a,_0x361816){return db[_0x507b('0x31')]['find']({'where':{'id':_0x53496a[_0x507b('0x2e')]['id']}})[_0x507b('0x28')](handleEntityNotFound(_0x361816,null))[_0x507b('0x28')](removeEntity(_0x361816,null))[_0x507b('0x3c')](handleError(_0x361816,null));};function widgetAttributes(_0x52ca51){try{switch(_0x52ca51[_0x507b('0x3d')]){case _0x507b('0x3e'):return[{'name':_0x507b('0x3f'),'value':_0x52ca51[_0x507b('0x3f')]||(_0x52ca51[_0x507b('0x40')]&&_0x52ca51['attrs'][0x0]?_0x52ca51['attrs'][0x0][_0x507b('0x41')]:undefined)||_0x507b('0x42')}];case _0x507b('0x43'):return[{'name':_0x507b('0x44'),'value':_0x52ca51[_0x507b('0x44')]||(_0x52ca51[_0x507b('0x40')]&&_0x52ca51[_0x507b('0x40')][0x0]?_0x52ca51[_0x507b('0x40')][0x0][_0x507b('0x41')]:undefined)||''}];case _0x507b('0x45'):return[{'name':_0x507b('0x46'),'value':_0x52ca51['attrHourFormat']||(_0x52ca51['attrs']&&_0x52ca51[_0x507b('0x40')][0x0]?_0x52ca51[_0x507b('0x40')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x507b('0x47'),'value':_0x52ca51[_0x507b('0x47')]||(_0x52ca51[_0x507b('0x40')]&&_0x52ca51['attrs'][0x1]?_0x52ca51[_0x507b('0x40')][0x1][_0x507b('0x41')]:undefined)||_0x507b('0x48')},{'name':_0x507b('0x49'),'value':_0x52ca51['attrFontSize']||(_0x52ca51[_0x507b('0x40')]&&_0x52ca51[_0x507b('0x40')][0x2]?_0x52ca51['attrs'][0x2][_0x507b('0x41')]:undefined)||0xc}];case _0x507b('0x4a'):return[{'name':_0x507b('0x4b'),'value':_0x52ca51[_0x507b('0x4b')]||(_0x52ca51['attrs']&&_0x52ca51['attrs'][0x0]?_0x52ca51[_0x507b('0x40')][0x0][_0x507b('0x41')]:undefined)||_0x507b('0x4c')},{'name':_0x507b('0x4d'),'value':_0x52ca51[_0x507b('0x4d')]||(_0x52ca51[_0x507b('0x40')]&&_0x52ca51[_0x507b('0x40')][0x1]?_0x52ca51[_0x507b('0x40')][0x1]['value']:undefined)||[]},{'name':_0x507b('0x49'),'value':_0x52ca51[_0x507b('0x49')]||(_0x52ca51[_0x507b('0x40')]&&_0x52ca51[_0x507b('0x40')][0x2]?_0x52ca51[_0x507b('0x40')][0x2]['value']:undefined)||0x14}];case _0x507b('0x4e'):case'pie-chart':return[{'name':'attrSerie1','value':_0x52ca51['attrSerie1']||(_0x52ca51['attrs']&&_0x52ca51[_0x507b('0x40')][0x0]?_0x52ca51['attrs'][0x0]['value']:undefined)||'total'},{'name':'attrSerie2','value':_0x52ca51[_0x507b('0x4f')]||(_0x52ca51['attrs']&&_0x52ca51[_0x507b('0x40')][0x1]?_0x52ca51[_0x507b('0x40')][0x1][_0x507b('0x41')]:undefined)||null},{'name':'attrSerie3','value':_0x52ca51[_0x507b('0x50')]||(_0x52ca51[_0x507b('0x40')]&&_0x52ca51['attrs'][0x2]?_0x52ca51[_0x507b('0x40')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x52ca51[_0x507b('0x4d')]||(_0x52ca51[_0x507b('0x40')]&&_0x52ca51[_0x507b('0x40')][0x3]?_0x52ca51[_0x507b('0x40')][0x3][_0x507b('0x41')]:undefined)||[]}];case _0x507b('0x51'):return[{'name':_0x507b('0x52'),'type':_0x52ca51[_0x507b('0x53')]||(_0x52ca51[_0x507b('0x40')]&&_0x52ca51[_0x507b('0x40')][0x0]?_0x52ca51[_0x507b('0x40')][0x0][_0x507b('0x3d')]:undefined)||null,'value':_0x52ca51[_0x507b('0x52')]||(_0x52ca51[_0x507b('0x40')]&&_0x52ca51[_0x507b('0x40')][0x0]?_0x52ca51[_0x507b('0x40')][0x0][_0x507b('0x41')]:undefined)||null},{'name':_0x507b('0x54'),'value':_0x52ca51['attrRefresh']||(_0x52ca51[_0x507b('0x40')]&&_0x52ca51[_0x507b('0x40')][0x1]?_0x52ca51[_0x507b('0x40')][0x1][_0x507b('0x41')]:undefined)||0x0}];default:return[];}}catch(_0xa1808f){logger[_0x507b('0x2a')](_0x507b('0x55'),JSON[_0x507b('0x56')](_0xa1808f));return[];}}exports[_0x507b('0x57')]=function(_0x359a1b,_0x511e28){if(_0x359a1b[_0x507b('0x58')]){_0x359a1b['body'][_0x507b('0x40')]=widgetAttributes(_0x359a1b[_0x507b('0x58')]);}return db[_0x507b('0x31')][_0x507b('0x57')](_0x359a1b[_0x507b('0x58')],{})[_0x507b('0x28')](respondWithResult(_0x511e28,0xc9))[_0x507b('0x3c')](handleError(_0x511e28,null));};exports[_0x507b('0x27')]=function(_0x385096,_0x41838b){if(_0x385096['body']['id']){delete _0x385096['body']['id'];}_0x385096[_0x507b('0x58')][_0x507b('0x40')]=widgetAttributes(_0x385096[_0x507b('0x58')]);return db[_0x507b('0x31')][_0x507b('0x3b')]({'where':{'id':_0x385096[_0x507b('0x2e')]['id']}})['then'](handleEntityNotFound(_0x41838b,null))[_0x507b('0x28')](saveUpdates(_0x385096[_0x507b('0x58')],null))[_0x507b('0x28')](respondWithResult(_0x41838b,null))[_0x507b('0x3c')](handleError(_0x41838b,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 0ceaf03..791ac39 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 _0xc6c0=['emit','hook','exports','events','DashboardItem','setMaxListeners','save','update','remove'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0xc6c0,0x13e));var _0x0c6c=function(_0x4c1ec2,_0x4f42b7){_0x4c1ec2=_0x4c1ec2-0x0;var _0x3f6f1c=_0xc6c0[_0x4c1ec2];return _0x3f6f1c;};'use strict';var EventEmitter=require(_0x0c6c('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x0c6c('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x0c6c('0x2')](0x0);var events={'afterCreate':_0x0c6c('0x3'),'afterUpdate':_0x0c6c('0x4'),'afterDestroy':_0x0c6c('0x5')};function emitEvent(_0x1d9169){return function(_0x27032,_0x6f9f0f,_0x43801c){DashboardItemEvents[_0x0c6c('0x6')](_0x1d9169+':'+_0x27032['id'],_0x27032);DashboardItemEvents['emit'](_0x1d9169,_0x27032);_0x43801c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x0c6c('0x7')](e,emitEvent(event));}}module[_0x0c6c('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0x706c=['../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x14e09f,_0xca27e7){var _0x54a4d2=function(_0x55bdab){while(--_0x55bdab){_0x14e09f['push'](_0x14e09f['shift']());}};_0x54a4d2(++_0xca27e7);}(_0x706c,0xd1));var _0xc706=function(_0x5ca0b3,_0x33f5ef){_0x5ca0b3=_0x5ca0b3-0x0;var _0x6ba806=_0x706c[_0x5ca0b3];return _0x6ba806;};'use strict';var EventEmitter=require(_0xc706('0x0'));var DashboardItem=require(_0xc706('0x1'))['db'][_0xc706('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xc706('0x3')](0x0);var events={'afterCreate':_0xc706('0x4'),'afterUpdate':_0xc706('0x5'),'afterDestroy':_0xc706('0x6')};function emitEvent(_0x2c147b){return function(_0x376f59,_0x5c827a,_0x46605e){DashboardItemEvents[_0xc706('0x7')](_0x2c147b+':'+_0x376f59['id'],_0x376f59);DashboardItemEvents[_0xc706('0x7')](_0x2c147b,_0x376f59);_0x46605e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xc706('0x8')](e,emitEvent(event));}}module[_0xc706('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 5c02e3b..89493dd 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 _0x0e46=['lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items'];(function(_0x4e1641,_0x224500){var _0x390157=function(_0x56d2fb){while(--_0x56d2fb){_0x4e1641['push'](_0x4e1641['shift']());}};_0x390157(++_0x224500);}(_0x0e46,0x120));var _0x60e4=function(_0x467ef6,_0x932cef){_0x467ef6=_0x467ef6-0x0;var _0x3e4aa2=_0x0e46[_0x467ef6];return _0x3e4aa2;};'use strict';var _=require(_0x60e4('0x0'));var util=require('util');var logger=require(_0x60e4('0x1'))('api');var moment=require(_0x60e4('0x2'));var BPromise=require('bluebird');var rp=require(_0x60e4('0x3'));var fs=require('fs');var path=require(_0x60e4('0x4'));var rimraf=require(_0x60e4('0x5'));var config=require(_0x60e4('0x6'));var attributes=require(_0x60e4('0x7'));module[_0x60e4('0x8')]=function(_0x146455,_0x2fdff4){return _0x146455[_0x60e4('0x9')](_0x60e4('0xa'),attributes,{'tableName':_0x60e4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8ae=['bluebird','request-promise','path','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment'];(function(_0xdbb6cb,_0x3b8fda){var _0x476b50=function(_0x470ebb){while(--_0x470ebb){_0xdbb6cb['push'](_0xdbb6cb['shift']());}};_0x476b50(++_0x3b8fda);}(_0xd8ae,0x183));var _0xed8a=function(_0x514745,_0x4a2031){_0x514745=_0x514745-0x0;var _0x58a4d2=_0xd8ae[_0x514745];return _0x58a4d2;};'use strict';var _=require(_0xed8a('0x0'));var util=require(_0xed8a('0x1'));var logger=require(_0xed8a('0x2'))(_0xed8a('0x3'));var moment=require(_0xed8a('0x4'));var BPromise=require(_0xed8a('0x5'));var rp=require(_0xed8a('0x6'));var fs=require('fs');var path=require(_0xed8a('0x7'));var rimraf=require('rimraf');var config=require(_0xed8a('0x8'));var attributes=require(_0xed8a('0x9'));module[_0xed8a('0xa')]=function(_0x19ca95,_0x4b779e){return _0x19ca95[_0xed8a('0xb')](_0xed8a('0xc'),attributes,{'tableName':_0xed8a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index fe60cea..298bb8a 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 _0xe6ea=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe6ea,0x11a));var _0xae6e=function(_0x90b942,_0x5bdb98){_0x90b942=_0x90b942-0x0;var _0x11fe66=_0xe6ea[_0x90b942];return _0x11fe66;};'use strict';var _=require('lodash');var util=require(_0xae6e('0x0'));var moment=require(_0xae6e('0x1'));var BPromise=require(_0xae6e('0x2'));var rs=require(_0xae6e('0x3'));var fs=require('fs');var Redis=require(_0xae6e('0x4'));var db=require(_0xae6e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xae6e('0x6'))(_0xae6e('0x7'));var config=require('../../config/environment');var jayson=require(_0xae6e('0x8'));var client=jayson[_0xae6e('0x9')][_0xae6e('0xa')]({'port':0x232a});config[_0xae6e('0xb')]=_[_0xae6e('0xc')](config['redis'],{'host':_0xae6e('0xd'),'port':0x18eb});var socket=require(_0xae6e('0xe'))(new Redis(config[_0xae6e('0xb')]));require('./dashboardItem.socket')[_0xae6e('0xf')](socket);function respondWithRpcPromise(_0x2eb136,_0x5674b3,_0x9acc03){return new BPromise(function(_0x1623e7,_0x14c542){return client[_0xae6e('0x10')](_0x2eb136,_0x9acc03)[_0xae6e('0x11')](function(_0x2e8e41){logger['info'](_0xae6e('0x12'),_0x5674b3,_0xae6e('0x13'));logger[_0xae6e('0x14')](_0xae6e('0x15'),_0x5674b3,'request\x20sent',JSON['stringify'](_0x2e8e41));if(_0x2e8e41['error']){if(_0x2e8e41[_0xae6e('0x16')][_0xae6e('0x17')]===0x1f4){logger[_0xae6e('0x16')]('DashboardItem,\x20%s,\x20%s',_0x5674b3,_0x2e8e41[_0xae6e('0x16')]['message']);return _0x14c542(_0x2e8e41[_0xae6e('0x16')]['message']);}logger[_0xae6e('0x16')]('DashboardItem,\x20%s,\x20%s',_0x5674b3,_0x2e8e41[_0xae6e('0x16')][_0xae6e('0x18')]);return _0x1623e7(_0x2e8e41[_0xae6e('0x16')][_0xae6e('0x18')]);}else{logger[_0xae6e('0x19')](_0xae6e('0x12'),_0x5674b3,_0xae6e('0x13'));_0x1623e7(_0x2e8e41[_0xae6e('0x1a')][_0xae6e('0x18')]);}})[_0xae6e('0x1b')](function(_0x5921d0){logger[_0xae6e('0x16')](_0xae6e('0x12'),_0x5674b3,_0x5921d0);_0x14c542(_0x5921d0);});});} \ No newline at end of file +var _0x7bb7=['redis','socket.io-emitter','./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults'];(function(_0x1b8fc6,_0x5857b4){var _0x11cd9f=function(_0x10f5ad){while(--_0x10f5ad){_0x1b8fc6['push'](_0x1b8fc6['shift']());}};_0x11cd9f(++_0x5857b4);}(_0x7bb7,0x1ea));var _0x77bb=function(_0x4f2130,_0x28fd7e){_0x4f2130=_0x4f2130-0x0;var _0x3d45dd=_0x7bb7[_0x4f2130];return _0x3d45dd;};'use strict';var _=require('lodash');var util=require(_0x77bb('0x0'));var moment=require(_0x77bb('0x1'));var BPromise=require(_0x77bb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x77bb('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x77bb('0x4'))(_0x77bb('0x5'));var config=require('../../config/environment');var jayson=require(_0x77bb('0x6'));var client=jayson[_0x77bb('0x7')][_0x77bb('0x8')]({'port':0x232a});config['redis']=_[_0x77bb('0x9')](config[_0x77bb('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x77bb('0xb'))(new Redis(config[_0x77bb('0xa')]));require(_0x77bb('0xc'))[_0x77bb('0xd')](socket);function respondWithRpcPromise(_0x18c92e,_0x28d6a8,_0x2ec5f1){return new BPromise(function(_0x1538bd,_0x26e5d8){return client['request'](_0x18c92e,_0x2ec5f1)[_0x77bb('0xe')](function(_0x438746){logger[_0x77bb('0xf')](_0x77bb('0x10'),_0x28d6a8,'request\x20sent');logger[_0x77bb('0x11')](_0x77bb('0x12'),_0x28d6a8,_0x77bb('0x13'),JSON[_0x77bb('0x14')](_0x438746));if(_0x438746[_0x77bb('0x15')]){if(_0x438746[_0x77bb('0x15')][_0x77bb('0x16')]===0x1f4){logger[_0x77bb('0x15')]('DashboardItem,\x20%s,\x20%s',_0x28d6a8,_0x438746[_0x77bb('0x15')][_0x77bb('0x17')]);return _0x26e5d8(_0x438746[_0x77bb('0x15')]['message']);}logger['error'](_0x77bb('0x10'),_0x28d6a8,_0x438746[_0x77bb('0x15')][_0x77bb('0x17')]);return _0x1538bd(_0x438746[_0x77bb('0x15')][_0x77bb('0x17')]);}else{logger[_0x77bb('0xf')]('DashboardItem,\x20%s,\x20%s',_0x28d6a8,_0x77bb('0x13'));_0x1538bd(_0x438746['result'][_0x77bb('0x17')]);}})[_0x77bb('0x18')](function(_0x490d53){logger[_0x77bb('0x15')]('DashboardItem,\x20%s,\x20%s',_0x28d6a8,_0x490d53);_0x26e5d8(_0x490d53);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index dfce18d..5e82086 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 _0x2cf1=['save','removeListener','register','length','dashboardItem:','./dashboardItem.events'];(function(_0x3e7555,_0x442ce2){var _0x3719e9=function(_0x1825e1){while(--_0x1825e1){_0x3e7555['push'](_0x3e7555['shift']());}};_0x3719e9(++_0x442ce2);}(_0x2cf1,0x1b5));var _0x12cf=function(_0x3cd006,_0x145722){_0x3cd006=_0x3cd006-0x0;var _0x38246f=_0x2cf1[_0x3cd006];return _0x38246f;};'use strict';var DashboardItemEvents=require(_0x12cf('0x0'));var events=[_0x12cf('0x1'),'remove','update'];function createListener(_0x574ca2,_0xd3f54d){return function(_0x5d7788){_0xd3f54d['emit'](_0x574ca2,_0x5d7788);};}function removeListener(_0x490a58,_0x432d98){return function(){DashboardItemEvents[_0x12cf('0x2')](_0x490a58,_0x432d98);};}exports[_0x12cf('0x3')]=function(_0x4437f2){for(var _0x21bac1=0x0,_0x1c113b=events[_0x12cf('0x4')];_0x21bac1<_0x1c113b;_0x21bac1++){var _0x37d880=events[_0x21bac1];var _0x48d1a0=createListener(_0x12cf('0x5')+_0x37d880,_0x4437f2);DashboardItemEvents['on'](_0x37d880,_0x48d1a0);}}; \ No newline at end of file +var _0x1377=['remove','update','emit','removeListener','length','dashboardItem:','./dashboardItem.events','save'];(function(_0x20259c,_0xe43fb2){var _0x4d988e=function(_0x2097b9){while(--_0x2097b9){_0x20259c['push'](_0x20259c['shift']());}};_0x4d988e(++_0xe43fb2);}(_0x1377,0xfe));var _0x7137=function(_0x4b4ca5,_0x46fc17){_0x4b4ca5=_0x4b4ca5-0x0;var _0x406893=_0x1377[_0x4b4ca5];return _0x406893;};'use strict';var DashboardItemEvents=require(_0x7137('0x0'));var events=[_0x7137('0x1'),_0x7137('0x2'),_0x7137('0x3')];function createListener(_0x3876d9,_0x2bba75){return function(_0x134d35){_0x2bba75[_0x7137('0x4')](_0x3876d9,_0x134d35);};}function removeListener(_0xe216fc,_0x213439){return function(){DashboardItemEvents[_0x7137('0x5')](_0xe216fc,_0x213439);};}exports['register']=function(_0x261b98){for(var _0x51671f=0x0,_0x3d926a=events[_0x7137('0x6')];_0x51671f<_0x3d926a;_0x51671f++){var _0x287f58=events[_0x51671f];var _0x4d4ecb=createListener(_0x7137('0x7')+_0x287f58,_0x261b98);DashboardItemEvents['on'](_0x287f58,_0x4d4ecb);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 8d7ae98..437f80c 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 _0x0400=['./dashboardItem.controller','get','/:id','isAuthenticated','show','post','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x168ba1,_0x1be414){var _0x5cc97c=function(_0x461d6e){while(--_0x461d6e){_0x168ba1['push'](_0x168ba1['shift']());}};_0x5cc97c(++_0x1be414);}(_0x0400,0x1ea));var _0x0040=function(_0xd21fe7,_0x225a39){_0xd21fe7=_0xd21fe7-0x0;var _0x14d570=_0x0400[_0xd21fe7];return _0x14d570;};'use strict';var multer=require(_0x0040('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0040('0x1'));var express=require(_0x0040('0x2'));var router=express['Router']();var fs_extra=require(_0x0040('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0040('0x4'));var config=require(_0x0040('0x5'));var controller=require(_0x0040('0x6'));router[_0x0040('0x7')](_0x0040('0x8'),auth[_0x0040('0x9')](),controller[_0x0040('0xa')]);router[_0x0040('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x0040('0x8'),auth['isAuthenticated'](),controller[_0x0040('0xc')]);router[_0x0040('0xd')]('/:id',auth[_0x0040('0x9')](),controller[_0x0040('0xe')]);module[_0x0040('0xf')]=router; \ No newline at end of file +var _0x6d34=['get','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller'];(function(_0x14a513,_0x3239f){var _0x47236c=function(_0x394191){while(--_0x394191){_0x14a513['push'](_0x14a513['shift']());}};_0x47236c(++_0x3239f);}(_0x6d34,0x160));var _0x46d3=function(_0x472001,_0x564809){_0x472001=_0x472001-0x0;var _0x659007=_0x6d34[_0x472001];return _0x659007;};'use strict';var multer=require(_0x46d3('0x0'));var util=require(_0x46d3('0x1'));var path=require('path');var timeout=require(_0x46d3('0x2'));var express=require('express');var router=express[_0x46d3('0x3')]();var fs_extra=require(_0x46d3('0x4'));var auth=require(_0x46d3('0x5'));var interaction=require(_0x46d3('0x6'));var config=require(_0x46d3('0x7'));var controller=require(_0x46d3('0x8'));router[_0x46d3('0x9')](_0x46d3('0xa'),auth[_0x46d3('0xb')](),controller[_0x46d3('0xc')]);router[_0x46d3('0xd')]('/',auth['isAuthenticated'](),controller[_0x46d3('0xe')]);router['put'](_0x46d3('0xa'),auth['isAuthenticated'](),controller[_0x46d3('0xf')]);router[_0x46d3('0x10')](_0x46d3('0xa'),auth[_0x46d3('0xb')](),controller[_0x46d3('0x11')]);module[_0x46d3('0x12')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 774f3bc..bc8c56f 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 _0x9bdd=['ENUM','second','first','STRING','sequelize','exports'];(function(_0x3d34da,_0x3abcc1){var _0xcf6af8=function(_0x300a53){while(--_0x300a53){_0x3d34da['push'](_0x3d34da['shift']());}};_0xcf6af8(++_0x3abcc1);}(_0x9bdd,0xa6));var _0xd9bd=function(_0x572703,_0x4b0dfa){_0x572703=_0x572703-0x0;var _0x291a9a=_0x9bdd[_0x572703];return _0x291a9a;};'use strict';var Sequelize=require(_0xd9bd('0x0'));module[_0xd9bd('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0xd9bd('0x2')]('first',_0xd9bd('0x3'),'third'),'allowNull':![],'defaultValue':_0xd9bd('0x4')},'description':{'type':Sequelize[_0xd9bd('0x5')]}}; \ No newline at end of file +var _0x2b2a=['STRING','ENUM','first','second','third','sequelize','exports'];(function(_0x3c9154,_0xd2e6d5){var _0x1b4708=function(_0x212415){while(--_0x212415){_0x3c9154['push'](_0x3c9154['shift']());}};_0x1b4708(++_0xd2e6d5);}(_0x2b2a,0xc2));var _0xa2b2=function(_0xfcbcb8,_0x35bf6b){_0xfcbcb8=_0xfcbcb8-0x0;var _0x1b1f97=_0x2b2a[_0xfcbcb8];return _0x1b1f97;};'use strict';var Sequelize=require(_0xa2b2('0x0'));module[_0xa2b2('0x1')]={'name':{'type':Sequelize[_0xa2b2('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xa2b2('0x3')](_0xa2b2('0x4'),_0xa2b2('0x5'),_0xa2b2('0x6')),'allowNull':![],'defaultValue':_0xa2b2('0x4')},'description':{'type':Sequelize[_0xa2b2('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 8ee44a5..10b205a 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 _0x54c7=['key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','findAll','rows','catch','keys','include','options','create','body','user','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Dispositions','sendStatus','error','name','send','index','map','Disposition','rawAttributes','fieldName'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x54c7,0x161));var _0x754c=function(_0x221048,_0x4e3940){_0x221048=_0x221048-0x0;var _0x3ae073=_0x54c7[_0x221048];return _0x3ae073;};'use strict';var emlformat=require(_0x754c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x754c('0x1'));var jsonpatch=require(_0x754c('0x2'));var rp=require(_0x754c('0x3'));var moment=require(_0x754c('0x4'));var BPromise=require(_0x754c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x754c('0x6'));var csv=require(_0x754c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x754c('0x8'));var _=require(_0x754c('0x9'));var squel=require(_0x754c('0xa'));var crypto=require('crypto');var jsforce=require(_0x754c('0xb'));var deskjs=require(_0x754c('0xc'));var toCsv=require(_0x754c('0x7'));var querystring=require(_0x754c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x754c('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x754c('0xf'));var hardwareService=require(_0x754c('0x10'));var logger=require(_0x754c('0x11'))(_0x754c('0x12'));var utils=require('../../config/utils');var config=require(_0x754c('0x13'));var licenseUtil=require(_0x754c('0x14'));var db=require(_0x754c('0x15'))['db'];function respondWithStatusCode(_0x45be58,_0x40cf4e){_0x40cf4e=_0x40cf4e||0xcc;return function(_0x2db2ad){if(_0x2db2ad){return _0x45be58['sendStatus'](_0x40cf4e);}return _0x45be58[_0x754c('0x16')](_0x40cf4e)[_0x754c('0x17')]();};}function respondWithResult(_0x42b753,_0x2bffd4){_0x2bffd4=_0x2bffd4||0xc8;return function(_0x155405){if(_0x155405){return _0x42b753[_0x754c('0x16')](_0x2bffd4)[_0x754c('0x18')](_0x155405);}};}function respondWithFilteredResult(_0x3bfcb4,_0x149944){return function(_0x5247c0){if(_0x5247c0){var _0xe46e48=typeof _0x149944['offset']===_0x754c('0x19')&&typeof _0x149944['limit']==='undefined';var _0x5ac811=_0x5247c0['count'];var _0x10e0eb=_0xe46e48?0x0:_0x149944['offset'];var _0x17e63d=_0xe46e48?_0x5247c0[_0x754c('0x1a')]:_0x149944['offset']+_0x149944[_0x754c('0x1b')];var _0x84c0de;if(_0x17e63d>=_0x5ac811){_0x17e63d=_0x5ac811;_0x84c0de=0xc8;}else{_0x84c0de=0xce;}_0x3bfcb4[_0x754c('0x16')](_0x84c0de);return _0x3bfcb4[_0x754c('0x1c')](_0x754c('0x1d'),_0x10e0eb+'-'+_0x17e63d+'/'+_0x5ac811)[_0x754c('0x18')](_0x5247c0);}return null;};}function patchUpdates(_0x1ff2cd){return function(_0x54b4cf){try{jsonpatch[_0x754c('0x1e')](_0x54b4cf,_0x1ff2cd,!![]);}catch(_0x11203b){return BPromise[_0x754c('0x1f')](_0x11203b);}return _0x54b4cf[_0x754c('0x20')]();};}function saveUpdates(_0x727d4d,_0x4bf0bc){return function(_0x3f9e4f){if(_0x3f9e4f){return _0x3f9e4f[_0x754c('0x21')](_0x727d4d)[_0x754c('0x22')](function(_0x12f56b){return _0x12f56b;});}return null;};}function removeEntity(_0x371852,_0x21ef92){return function(_0x2c0c41){if(_0x2c0c41){return _0x2c0c41[_0x754c('0x23')]()[_0x754c('0x22')](function(){var _0x3b9130=_0x2c0c41[_0x754c('0x24')]({'plain':!![]});var _0x5148a6=_0x754c('0x25');return db['UserProfileResource'][_0x754c('0x23')]({'where':{'type':_0x5148a6,'resourceId':_0x3b9130['id']}})[_0x754c('0x22')](function(){return _0x2c0c41;});})['then'](function(){_0x371852[_0x754c('0x16')](0xcc)[_0x754c('0x17')]();});}};}function handleEntityNotFound(_0x33b68f,_0x1c1810){return function(_0x55d713){if(!_0x55d713){_0x33b68f[_0x754c('0x26')](0x194);}return _0x55d713;};}function handleError(_0x43856b,_0xd5a84b){_0xd5a84b=_0xd5a84b||0x1f4;return function(_0x60c280){logger[_0x754c('0x27')](_0x60c280['stack']);if(_0x60c280['name']){delete _0x60c280[_0x754c('0x28')];}_0x43856b[_0x754c('0x16')](_0xd5a84b)[_0x754c('0x29')](_0x60c280);};}exports[_0x754c('0x2a')]=function(_0x4ffc9a,_0x1e5582){var _0x445fd9={},_0x30560e={},_0x58a073={'count':0x0,'rows':[]};var _0x234b7d=_[_0x754c('0x2b')](db[_0x754c('0x2c')][_0x754c('0x2d')],function(_0xac7387){return{'name':_0xac7387[_0x754c('0x2e')],'type':_0xac7387['type'][_0x754c('0x2f')]};});_0x30560e[_0x754c('0x30')]=_['map'](_0x234b7d,_0x754c('0x28'));_0x30560e[_0x754c('0x31')]=_['keys'](_0x4ffc9a[_0x754c('0x31')]);_0x30560e[_0x754c('0x32')]=_[_0x754c('0x33')](_0x30560e['model'],_0x30560e[_0x754c('0x31')]);_0x445fd9[_0x754c('0x34')]=_['intersection'](_0x30560e[_0x754c('0x30')],qs[_0x754c('0x35')](_0x4ffc9a[_0x754c('0x31')][_0x754c('0x35')]));_0x445fd9[_0x754c('0x34')]=_0x445fd9[_0x754c('0x34')][_0x754c('0x36')]?_0x445fd9[_0x754c('0x34')]:_0x30560e[_0x754c('0x30')];if(!_0x4ffc9a[_0x754c('0x31')][_0x754c('0x37')]('nolimit')){_0x445fd9[_0x754c('0x1b')]=qs[_0x754c('0x1b')](_0x4ffc9a[_0x754c('0x31')]['limit']);_0x445fd9[_0x754c('0x38')]=qs[_0x754c('0x38')](_0x4ffc9a[_0x754c('0x31')][_0x754c('0x38')]);}_0x445fd9[_0x754c('0x39')]=qs[_0x754c('0x3a')](_0x4ffc9a['query'][_0x754c('0x3a')]);_0x445fd9[_0x754c('0x3b')]=qs['filters'](_[_0x754c('0x3c')](_0x4ffc9a['query'],_0x30560e[_0x754c('0x32')]),_0x234b7d);if(_0x4ffc9a[_0x754c('0x31')][_0x754c('0x3d')]){_0x445fd9[_0x754c('0x3b')]=_[_0x754c('0x3e')](_0x445fd9[_0x754c('0x3b')],{'$or':_['map'](_0x234b7d,function(_0x800bf2){if(_0x800bf2[_0x754c('0x3f')]!==_0x754c('0x40')){var _0xe7520d={};_0xe7520d[_0x800bf2[_0x754c('0x28')]]={'$like':'%'+_0x4ffc9a['query']['filter']+'%'};return _0xe7520d;}})});}_0x445fd9=_[_0x754c('0x3e')]({},_0x445fd9,_0x4ffc9a['options']);var _0x515a82={'where':_0x445fd9[_0x754c('0x3b')]};return db[_0x754c('0x2c')][_0x754c('0x1a')](_0x515a82)['then'](function(_0x438038){_0x58a073[_0x754c('0x1a')]=_0x438038;if(_0x4ffc9a[_0x754c('0x31')]['includeAll']){_0x445fd9['include']=[{'all':!![]}];}return db[_0x754c('0x2c')][_0x754c('0x41')](_0x445fd9);})[_0x754c('0x22')](function(_0x3e5de8){_0x58a073[_0x754c('0x42')]=_0x3e5de8;return _0x58a073;})[_0x754c('0x22')](respondWithFilteredResult(_0x1e5582,_0x445fd9))[_0x754c('0x43')](handleError(_0x1e5582,null));};exports['show']=function(_0x5a75bc,_0x156a32){var _0x4f6a0f={'raw':!![],'where':{'id':_0x5a75bc['params']['id']}},_0xda00be={};_0xda00be[_0x754c('0x30')]=_['keys'](db[_0x754c('0x2c')]['rawAttributes']);_0xda00be['query']=_[_0x754c('0x44')](_0x5a75bc[_0x754c('0x31')]);_0xda00be['filters']=_['intersection'](_0xda00be['model'],_0xda00be[_0x754c('0x31')]);_0x4f6a0f['attributes']=_[_0x754c('0x33')](_0xda00be['model'],qs[_0x754c('0x35')](_0x5a75bc[_0x754c('0x31')][_0x754c('0x35')]));_0x4f6a0f[_0x754c('0x34')]=_0x4f6a0f['attributes'][_0x754c('0x36')]?_0x4f6a0f[_0x754c('0x34')]:_0xda00be[_0x754c('0x30')];if(_0x5a75bc[_0x754c('0x31')]['includeAll']){_0x4f6a0f[_0x754c('0x45')]=[{'all':!![]}];}_0x4f6a0f=_[_0x754c('0x3e')]({},_0x4f6a0f,_0x5a75bc[_0x754c('0x46')]);return db[_0x754c('0x2c')]['find'](_0x4f6a0f)[_0x754c('0x22')](handleEntityNotFound(_0x156a32,null))[_0x754c('0x22')](respondWithResult(_0x156a32,null))['catch'](handleError(_0x156a32,null));};exports[_0x754c('0x47')]=function(_0x366990,_0x565244){return db[_0x754c('0x2c')][_0x754c('0x47')](_0x366990[_0x754c('0x48')],{})[_0x754c('0x22')](function(_0x545cc4){var _0x81b9a=_0x366990[_0x754c('0x49')][_0x754c('0x24')]({'plain':!![]});if(!_0x81b9a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x81b9a['role']===_0x754c('0x49')){var _0x2164b9=_0x545cc4[_0x754c('0x24')]({'plain':!![]});var _0x184dec='Dispositions';return db[_0x754c('0x4a')][_0x754c('0x4b')]({'where':{'name':_0x184dec,'userProfileId':_0x81b9a[_0x754c('0x4c')]},'raw':!![]})[_0x754c('0x22')](function(_0x3f99bd){if(_0x3f99bd&&_0x3f99bd['autoAssociation']===0x0){return db[_0x754c('0x4d')][_0x754c('0x47')]({'name':_0x2164b9[_0x754c('0x28')],'resourceId':_0x2164b9['id'],'type':_0x3f99bd[_0x754c('0x28')],'sectionId':_0x3f99bd['id']},{})[_0x754c('0x22')](function(){return _0x545cc4;});}else{return _0x545cc4;}})[_0x754c('0x43')](function(_0x37946a){logger[_0x754c('0x27')](_0x754c('0x4e'),_0x37946a);throw _0x37946a;});}return _0x545cc4;})[_0x754c('0x22')](respondWithResult(_0x565244,0xc9))[_0x754c('0x43')](handleError(_0x565244,null));};exports['update']=function(_0x4c2e2d,_0x3489d7){if(_0x4c2e2d[_0x754c('0x48')]['id']){delete _0x4c2e2d[_0x754c('0x48')]['id'];}return db[_0x754c('0x2c')]['find']({'where':{'id':_0x4c2e2d['params']['id']}})[_0x754c('0x22')](handleEntityNotFound(_0x3489d7,null))['then'](saveUpdates(_0x4c2e2d[_0x754c('0x48')],null))[_0x754c('0x22')](respondWithResult(_0x3489d7,null))[_0x754c('0x43')](handleError(_0x3489d7,null));};exports[_0x754c('0x23')]=function(_0x140488,_0x38cd12){return db['Disposition']['find']({'where':{'id':_0x140488[_0x754c('0x4f')]['id']}})[_0x754c('0x22')](handleEntityNotFound(_0x38cd12,null))[_0x754c('0x22')](removeEntity(_0x38cd12,null))[_0x754c('0x43')](handleError(_0x38cd12,null));}; \ No newline at end of file +var _0x29e8=['Dispositions','UserProfileResource','error','stack','name','send','index','Disposition','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','fs-extra','crypto','desk.js','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','count','limit','update','then','destroy','get'];(function(_0x323fff,_0x38f93e){var _0x326de5=function(_0x5520f9){while(--_0x5520f9){_0x323fff['push'](_0x323fff['shift']());}};_0x326de5(++_0x38f93e);}(_0x29e8,0x116));var _0x829e=function(_0x4eb1e2,_0x181732){_0x4eb1e2=_0x4eb1e2-0x0;var _0x23576a=_0x29e8[_0x4eb1e2];return _0x23576a;};'use strict';var emlformat=require(_0x829e('0x0'));var rimraf=require(_0x829e('0x1'));var zipdir=require(_0x829e('0x2'));var jsonpatch=require(_0x829e('0x3'));var rp=require('request-promise');var moment=require(_0x829e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x829e('0x5'));var util=require(_0x829e('0x6'));var path=require(_0x829e('0x7'));var sox=require(_0x829e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x829e('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x829e('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x829e('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x829e('0xc'));var Redis=require(_0x829e('0xd'));var authService=require(_0x829e('0xe'));var qs=require(_0x829e('0xf'));var as=require(_0x829e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x829e('0x11'))(_0x829e('0x12'));var utils=require(_0x829e('0x13'));var config=require(_0x829e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x829e('0x15'))['db'];function respondWithStatusCode(_0x74950b,_0x3a1697){_0x3a1697=_0x3a1697||0xcc;return function(_0x5b4107){if(_0x5b4107){return _0x74950b[_0x829e('0x16')](_0x3a1697);}return _0x74950b[_0x829e('0x17')](_0x3a1697)[_0x829e('0x18')]();};}function respondWithResult(_0x1f81bb,_0x2f7c64){_0x2f7c64=_0x2f7c64||0xc8;return function(_0x2162a8){if(_0x2162a8){return _0x1f81bb['status'](_0x2f7c64)[_0x829e('0x19')](_0x2162a8);}};}function respondWithFilteredResult(_0xc48685,_0x4b6de9){return function(_0x599f8b){if(_0x599f8b){var _0x39fd66=typeof _0x4b6de9[_0x829e('0x1a')]===_0x829e('0x1b')&&typeof _0x4b6de9['limit']==='undefined';var _0x8bdd5f=_0x599f8b['count'];var _0x2a7f8d=_0x39fd66?0x0:_0x4b6de9[_0x829e('0x1a')];var _0x5d43a0=_0x39fd66?_0x599f8b[_0x829e('0x1c')]:_0x4b6de9[_0x829e('0x1a')]+_0x4b6de9[_0x829e('0x1d')];var _0x22f012;if(_0x5d43a0>=_0x8bdd5f){_0x5d43a0=_0x8bdd5f;_0x22f012=0xc8;}else{_0x22f012=0xce;}_0xc48685['status'](_0x22f012);return _0xc48685['set']('Content-Range',_0x2a7f8d+'-'+_0x5d43a0+'/'+_0x8bdd5f)[_0x829e('0x19')](_0x599f8b);}return null;};}function patchUpdates(_0x44196d){return function(_0x370d2c){try{jsonpatch['apply'](_0x370d2c,_0x44196d,!![]);}catch(_0x5605dd){return BPromise['reject'](_0x5605dd);}return _0x370d2c['save']();};}function saveUpdates(_0x1fc75f,_0x30f9ca){return function(_0x4b5711){if(_0x4b5711){return _0x4b5711[_0x829e('0x1e')](_0x1fc75f)[_0x829e('0x1f')](function(_0x244b66){return _0x244b66;});}return null;};}function removeEntity(_0x5e264b,_0x1efdba){return function(_0x4e1082){if(_0x4e1082){return _0x4e1082[_0x829e('0x20')]()[_0x829e('0x1f')](function(){var _0x460ee9=_0x4e1082[_0x829e('0x21')]({'plain':!![]});var _0x37a6c1=_0x829e('0x22');return db[_0x829e('0x23')][_0x829e('0x20')]({'where':{'type':_0x37a6c1,'resourceId':_0x460ee9['id']}})[_0x829e('0x1f')](function(){return _0x4e1082;});})['then'](function(){_0x5e264b[_0x829e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e40ee,_0x4eb580){return function(_0x3c61d2){if(!_0x3c61d2){_0x5e40ee[_0x829e('0x16')](0x194);}return _0x3c61d2;};}function handleError(_0x2bfe6f,_0x3aae73){_0x3aae73=_0x3aae73||0x1f4;return function(_0xffd177){logger[_0x829e('0x24')](_0xffd177[_0x829e('0x25')]);if(_0xffd177['name']){delete _0xffd177[_0x829e('0x26')];}_0x2bfe6f[_0x829e('0x17')](_0x3aae73)[_0x829e('0x27')](_0xffd177);};}exports[_0x829e('0x28')]=function(_0x39a625,_0xa0c589){var _0x3cc330={},_0x5d9a23={},_0x2a9939={'count':0x0,'rows':[]};var _0x15c295=_['map'](db[_0x829e('0x29')]['rawAttributes'],function(_0x32a48f){return{'name':_0x32a48f['fieldName'],'type':_0x32a48f['type'][_0x829e('0x2a')]};});_0x5d9a23[_0x829e('0x2b')]=_[_0x829e('0x2c')](_0x15c295,_0x829e('0x26'));_0x5d9a23[_0x829e('0x2d')]=_[_0x829e('0x2e')](_0x39a625[_0x829e('0x2d')]);_0x5d9a23[_0x829e('0x2f')]=_[_0x829e('0x30')](_0x5d9a23[_0x829e('0x2b')],_0x5d9a23[_0x829e('0x2d')]);_0x3cc330[_0x829e('0x31')]=_['intersection'](_0x5d9a23[_0x829e('0x2b')],qs['fields'](_0x39a625[_0x829e('0x2d')][_0x829e('0x32')]));_0x3cc330[_0x829e('0x31')]=_0x3cc330[_0x829e('0x31')][_0x829e('0x33')]?_0x3cc330[_0x829e('0x31')]:_0x5d9a23[_0x829e('0x2b')];if(!_0x39a625[_0x829e('0x2d')][_0x829e('0x34')](_0x829e('0x35'))){_0x3cc330[_0x829e('0x1d')]=qs[_0x829e('0x1d')](_0x39a625[_0x829e('0x2d')][_0x829e('0x1d')]);_0x3cc330[_0x829e('0x1a')]=qs['offset'](_0x39a625['query']['offset']);}_0x3cc330[_0x829e('0x36')]=qs['sort'](_0x39a625['query'][_0x829e('0x37')]);_0x3cc330[_0x829e('0x38')]=qs[_0x829e('0x2f')](_[_0x829e('0x39')](_0x39a625[_0x829e('0x2d')],_0x5d9a23['filters']),_0x15c295);if(_0x39a625[_0x829e('0x2d')][_0x829e('0x3a')]){_0x3cc330[_0x829e('0x38')]=_[_0x829e('0x3b')](_0x3cc330['where'],{'$or':_[_0x829e('0x2c')](_0x15c295,function(_0x20d524){if(_0x20d524[_0x829e('0x3c')]!==_0x829e('0x3d')){var _0x10127d={};_0x10127d[_0x20d524[_0x829e('0x26')]]={'$like':'%'+_0x39a625[_0x829e('0x2d')][_0x829e('0x3a')]+'%'};return _0x10127d;}})});}_0x3cc330=_[_0x829e('0x3b')]({},_0x3cc330,_0x39a625[_0x829e('0x3e')]);var _0x11917d={'where':_0x3cc330[_0x829e('0x38')]};return db[_0x829e('0x29')][_0x829e('0x1c')](_0x11917d)[_0x829e('0x1f')](function(_0x132a2e){_0x2a9939[_0x829e('0x1c')]=_0x132a2e;if(_0x39a625[_0x829e('0x2d')][_0x829e('0x3f')]){_0x3cc330[_0x829e('0x40')]=[{'all':!![]}];}return db[_0x829e('0x29')]['findAll'](_0x3cc330);})[_0x829e('0x1f')](function(_0x37acd7){_0x2a9939[_0x829e('0x41')]=_0x37acd7;return _0x2a9939;})['then'](respondWithFilteredResult(_0xa0c589,_0x3cc330))[_0x829e('0x42')](handleError(_0xa0c589,null));};exports[_0x829e('0x43')]=function(_0x16d364,_0x14da29){var _0x2a485b={'raw':!![],'where':{'id':_0x16d364['params']['id']}},_0x3f8987={};_0x3f8987['model']=_[_0x829e('0x2e')](db[_0x829e('0x29')][_0x829e('0x44')]);_0x3f8987[_0x829e('0x2d')]=_[_0x829e('0x2e')](_0x16d364['query']);_0x3f8987[_0x829e('0x2f')]=_['intersection'](_0x3f8987['model'],_0x3f8987['query']);_0x2a485b[_0x829e('0x31')]=_[_0x829e('0x30')](_0x3f8987[_0x829e('0x2b')],qs['fields'](_0x16d364['query'][_0x829e('0x32')]));_0x2a485b['attributes']=_0x2a485b['attributes'][_0x829e('0x33')]?_0x2a485b[_0x829e('0x31')]:_0x3f8987[_0x829e('0x2b')];if(_0x16d364['query'][_0x829e('0x3f')]){_0x2a485b[_0x829e('0x40')]=[{'all':!![]}];}_0x2a485b=_['merge']({},_0x2a485b,_0x16d364[_0x829e('0x3e')]);return db[_0x829e('0x29')][_0x829e('0x45')](_0x2a485b)['then'](handleEntityNotFound(_0x14da29,null))['then'](respondWithResult(_0x14da29,null))[_0x829e('0x42')](handleError(_0x14da29,null));};exports[_0x829e('0x46')]=function(_0x38f8bf,_0x3f4655){return db[_0x829e('0x29')][_0x829e('0x46')](_0x38f8bf[_0x829e('0x47')],{})[_0x829e('0x1f')](function(_0x15784c){var _0x17679e=_0x38f8bf[_0x829e('0x48')][_0x829e('0x21')]({'plain':!![]});if(!_0x17679e)throw new Error(_0x829e('0x49'));if(_0x17679e[_0x829e('0x4a')]==='user'){var _0xbff9cc=_0x15784c[_0x829e('0x21')]({'plain':!![]});var _0x16b627=_0x829e('0x22');return db['UserProfileSection'][_0x829e('0x45')]({'where':{'name':_0x16b627,'userProfileId':_0x17679e['userProfileId']},'raw':!![]})['then'](function(_0x4a2b33){if(_0x4a2b33&&_0x4a2b33[_0x829e('0x4b')]===0x0){return db[_0x829e('0x23')][_0x829e('0x46')]({'name':_0xbff9cc['name'],'resourceId':_0xbff9cc['id'],'type':_0x4a2b33['name'],'sectionId':_0x4a2b33['id']},{})[_0x829e('0x1f')](function(){return _0x15784c;});}else{return _0x15784c;}})[_0x829e('0x42')](function(_0x200693){logger[_0x829e('0x24')](_0x829e('0x4c'),_0x200693);throw _0x200693;});}return _0x15784c;})[_0x829e('0x1f')](respondWithResult(_0x3f4655,0xc9))[_0x829e('0x42')](handleError(_0x3f4655,null));};exports[_0x829e('0x1e')]=function(_0x1d4655,_0x17edd3){if(_0x1d4655[_0x829e('0x47')]['id']){delete _0x1d4655[_0x829e('0x47')]['id'];}return db[_0x829e('0x29')][_0x829e('0x45')]({'where':{'id':_0x1d4655[_0x829e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x17edd3,null))[_0x829e('0x1f')](saveUpdates(_0x1d4655[_0x829e('0x47')],null))[_0x829e('0x1f')](respondWithResult(_0x17edd3,null))[_0x829e('0x42')](handleError(_0x17edd3,null));};exports[_0x829e('0x20')]=function(_0x2203ae,_0x29b906){return db[_0x829e('0x29')][_0x829e('0x45')]({'where':{'id':_0x2203ae[_0x829e('0x4d')]['id']}})[_0x829e('0x1f')](handleEntityNotFound(_0x29b906,null))[_0x829e('0x1f')](removeEntity(_0x29b906,null))[_0x829e('0x42')](handleError(_0x29b906,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index d3c4553..10caf9c 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 _0xb722=['bluebird','path','rimraf','../../config/environment','./disposition.attributes','define','Disposition','tools_dispositions','name_voice','ListId','name_chat','name','name_mail','SmsAccountId','name_fax','util','../../config/logger','api'];(function(_0x1b76d8,_0x2e8a00){var _0x40f446=function(_0x37db13){while(--_0x37db13){_0x1b76d8['push'](_0x1b76d8['shift']());}};_0x40f446(++_0x2e8a00);}(_0xb722,0x1d1));var _0x2b72=function(_0x5557af,_0x3fb83e){_0x5557af=_0x5557af-0x0;var _0x48d269=_0xb722[_0x5557af];return _0x48d269;};'use strict';var _=require('lodash');var util=require(_0x2b72('0x0'));var logger=require(_0x2b72('0x1'))(_0x2b72('0x2'));var moment=require('moment');var BPromise=require(_0x2b72('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2b72('0x4'));var rimraf=require(_0x2b72('0x5'));var config=require(_0x2b72('0x6'));var attributes=require(_0x2b72('0x7'));module['exports']=function(_0x50aa2e,_0x1fe23c){return _0x50aa2e[_0x2b72('0x8')](_0x2b72('0x9'),attributes,{'tableName':_0x2b72('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x2b72('0xb'),'fields':['name',_0x2b72('0xc')]},{'unique':!![],'name':_0x2b72('0xd'),'fields':[_0x2b72('0xe'),'ChatWebsiteId']},{'unique':!![],'name':_0x2b72('0xf'),'fields':[_0x2b72('0xe'),'MailAccountId']},{'unique':!![],'name':'name_sms','fields':['name',_0x2b72('0x10')]},{'unique':!![],'name':_0x2b72('0x11'),'fields':[_0x2b72('0xe'),'FaxAccountId']},{'unique':!![],'name':'name_openchannel','fields':[_0x2b72('0xe'),'OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':['name','WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb846=['FaxAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','name_chat','name_mail','MailAccountId','name_sms','SmsAccountId'];(function(_0x20f96d,_0x23e67f){var _0x9a7524=function(_0x57c732){while(--_0x57c732){_0x20f96d['push'](_0x20f96d['shift']());}};_0x9a7524(++_0x23e67f);}(_0xb846,0x101));var _0x6b84=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xb846[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require('lodash');var util=require(_0x6b84('0x0'));var logger=require(_0x6b84('0x1'))(_0x6b84('0x2'));var moment=require(_0x6b84('0x3'));var BPromise=require(_0x6b84('0x4'));var rp=require(_0x6b84('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6b84('0x6'));var attributes=require(_0x6b84('0x7'));module[_0x6b84('0x8')]=function(_0x441259,_0x217dc1){return _0x441259[_0x6b84('0x9')](_0x6b84('0xa'),attributes,{'tableName':_0x6b84('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x6b84('0xc'),'fields':[_0x6b84('0xd'),'ListId']},{'unique':!![],'name':_0x6b84('0xe'),'fields':[_0x6b84('0xd'),'ChatWebsiteId']},{'unique':!![],'name':_0x6b84('0xf'),'fields':[_0x6b84('0xd'),_0x6b84('0x10')]},{'unique':!![],'name':_0x6b84('0x11'),'fields':[_0x6b84('0xd'),_0x6b84('0x12')]},{'unique':!![],'name':'name_fax','fields':[_0x6b84('0xd'),_0x6b84('0x13')]},{'unique':!![],'name':_0x6b84('0x14'),'fields':[_0x6b84('0xd'),_0x6b84('0x15')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x6b84('0xd'),_0x6b84('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 06b446f..c09e890 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(_0x26acf7,_0x8c0281){var _0xada882=function(_0x409b1a){while(--_0x409b1a){_0x26acf7['push'](_0x26acf7['shift']());}};_0xada882(++_0x8c0281);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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(_0x321b88,_0x3f23d6){var _0x464329=function(_0x41b541){while(--_0x41b541){_0x321b88['push'](_0x321b88['shift']());}};_0x464329(++_0x3f23d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index bb70873..55422cc 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 _0xf8db=['show','create','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x2479dd,_0x4b97ae){var _0xffcb0b=function(_0x172049){while(--_0x172049){_0x2479dd['push'](_0x2479dd['shift']());}};_0xffcb0b(++_0x4b97ae);}(_0xf8db,0x15d));var _0xbf8d=function(_0x242919,_0x2e78ef){_0x242919=_0x242919-0x0;var _0xcc5fdb=_0xf8db[_0x242919];return _0xcc5fdb;};'use strict';var multer=require(_0xbf8d('0x0'));var util=require('util');var path=require(_0xbf8d('0x1'));var timeout=require(_0xbf8d('0x2'));var express=require(_0xbf8d('0x3'));var router=express[_0xbf8d('0x4')]();var fs_extra=require(_0xbf8d('0x5'));var auth=require(_0xbf8d('0x6'));var interaction=require(_0xbf8d('0x7'));var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0xbf8d('0x8')]('/',auth[_0xbf8d('0x9')](),controller[_0xbf8d('0xa')]);router[_0xbf8d('0x8')]('/:id',auth[_0xbf8d('0x9')](),controller[_0xbf8d('0xb')]);router['post']('/',auth[_0xbf8d('0x9')](),controller[_0xbf8d('0xc')]);router['put'](_0xbf8d('0xd'),auth[_0xbf8d('0x9')](),controller[_0xbf8d('0xe')]);router[_0xbf8d('0xf')]('/:id',auth[_0xbf8d('0x9')](),controller[_0xbf8d('0x10')]);module[_0xbf8d('0x11')]=router; \ No newline at end of file +var _0xb05d=['../../config/environment','./disposition.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x24a801,_0x4d1b37){var _0x478e3f=function(_0x4ef853){while(--_0x4ef853){_0x24a801['push'](_0x24a801['shift']());}};_0x478e3f(++_0x4d1b37);}(_0xb05d,0xdf));var _0xdb05=function(_0x1fa760,_0x1bf063){_0x1fa760=_0x1fa760-0x0;var _0xd8eda1=_0xb05d[_0x1fa760];return _0xd8eda1;};'use strict';var multer=require('multer');var util=require(_0xdb05('0x0'));var path=require(_0xdb05('0x1'));var timeout=require(_0xdb05('0x2'));var express=require(_0xdb05('0x3'));var router=express[_0xdb05('0x4')]();var fs_extra=require(_0xdb05('0x5'));var auth=require(_0xdb05('0x6'));var interaction=require(_0xdb05('0x7'));var config=require(_0xdb05('0x8'));var controller=require(_0xdb05('0x9'));router[_0xdb05('0xa')]('/',auth[_0xdb05('0xb')](),controller[_0xdb05('0xc')]);router['get']('/:id',auth[_0xdb05('0xb')](),controller[_0xdb05('0xd')]);router['post']('/',auth[_0xdb05('0xb')](),controller[_0xdb05('0xe')]);router[_0xdb05('0xf')](_0xdb05('0x10'),auth[_0xdb05('0xb')](),controller[_0xdb05('0x11')]);router[_0xdb05('0x12')](_0xdb05('0x10'),auth[_0xdb05('0xb')](),controller[_0xdb05('0x13')]);module[_0xdb05('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 0a32b02..cb5f647 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 _0xf32b=['exports','STRING','yes','ENUM','2400','4800','7200','9600','14400','12000','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf32b,0x7c));var _0xbf32=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xf32b[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0xbf32('0x0'));module[_0xbf32('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbf32('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0xbf32('0x3'),'no'),'defaultValue':_0xbf32('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xbf32('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xbf32('0x4')](_0xbf32('0x5'),_0xbf32('0x6'),_0xbf32('0x7'),_0xbf32('0x8'),'12000',_0xbf32('0x9')),'defaultValue':_0xbf32('0x6')},'maxrate':{'type':Sequelize[_0xbf32('0x4')]('2400',_0xbf32('0x6'),_0xbf32('0x7'),'9600',_0xbf32('0xa'),'14400'),'defaultValue':_0xbf32('0x9')},'modem':{'type':Sequelize[_0xbf32('0x2')],'defaultValue':_0xbf32('0xb')},'gateway':{'type':Sequelize[_0xbf32('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xbf32('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xbf32('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xbf32('0x4')](_0xbf32('0xd'),_0xbf32('0xe'),_0xbf32('0xf'),_0xbf32('0x10')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0xbf32('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xbf32('0x11')],'defaultValue':function(){return _0xbf32('0x12');}},'notificationSound':{'type':Sequelize[_0xbf32('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbf32('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbf32('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbf32('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbf32('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbf32('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0xbf32('0x14')},'mandatoryDisposition':{'type':Sequelize[_0xbf32('0x13')],'defaultValue':![],'comment':_0xbf32('0x15'),'set':function(_0x3914f6){if(!_0x3914f6)this['setDataValue'](_0xbf32('0x16'),null);this[_0xbf32('0x17')](_0xbf32('0x18'),_0x3914f6);}}}; \ No newline at end of file +var _0x9ad1=['sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','9600','12000','14400','INTEGER','IAX','DADHI','KHOMP','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x47b0b0,_0x3bdc6e){var _0x3ebba3=function(_0x187e63){while(--_0x187e63){_0x47b0b0['push'](_0x47b0b0['shift']());}};_0x3ebba3(++_0x3bdc6e);}(_0x9ad1,0x78));var _0x19ad=function(_0x2ce810,_0x373b88){_0x2ce810=_0x2ce810-0x0;var _0x514506=_0x9ad1[_0x2ce810];return _0x514506;};'use strict';var Sequelize=require(_0x19ad('0x0'));module[_0x19ad('0x1')]={'name':{'type':Sequelize[_0x19ad('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x19ad('0x2')]},'ecm':{'type':Sequelize[_0x19ad('0x3')]('yes','no'),'defaultValue':_0x19ad('0x4')},'headerinfo':{'type':Sequelize[_0x19ad('0x2')],'defaultValue':_0x19ad('0x5')},'localstationid':{'type':Sequelize[_0x19ad('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x19ad('0x3')](_0x19ad('0x6'),_0x19ad('0x7'),_0x19ad('0x8'),_0x19ad('0x9'),_0x19ad('0xa'),_0x19ad('0xb')),'defaultValue':_0x19ad('0x7')},'maxrate':{'type':Sequelize[_0x19ad('0x3')](_0x19ad('0x6'),_0x19ad('0x7'),_0x19ad('0x8'),_0x19ad('0x9'),'12000',_0x19ad('0xb')),'defaultValue':_0x19ad('0xb')},'modem':{'type':Sequelize[_0x19ad('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x19ad('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x19ad('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x19ad('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x19ad('0x3')]('SIP',_0x19ad('0xd'),_0x19ad('0xe'),_0x19ad('0xf')),'defaultValue':_0x19ad('0x10')},'key':{'type':Sequelize[_0x19ad('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x19ad('0x11')],'defaultValue':function(){return _0x19ad('0x12');}},'notificationSound':{'type':Sequelize[_0x19ad('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x19ad('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x19ad('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x19ad('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x19ad('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x19ad('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x19ad('0xc')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x19ad('0x13')],'defaultValue':![],'comment':_0x19ad('0x14'),'set':function(_0x4a9a6b){if(!_0x4a9a6b)this[_0x19ad('0x15')](_0x19ad('0x16'),null);this[_0x19ad('0x15')](_0x19ad('0x17'),_0x4a9a6b);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 06d9f5c..2c6fa83 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 _0x5dd4=['CmContact','User','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll','finally','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','priority','appdata','Answer','push','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','minrate','modem','t38timeout','FAXOPT(','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','ListId','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','ContactId','dataValues','Messages','SendFax','info','SendFaxRpc,\x20%s','addAgents','spread','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','FaxAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','sendStatus','end','offset','undefined','limit','count','status','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','FaxAccount','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','options','includeAll','include','findAll','catch','show','params','rawAttributes','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','pick','filter','removeDispositions','addAnswer','CannedAnswer','getAnswers','order','rows','removeAnswers','ids','addInteraction','FaxInteraction','omit'];(function(_0x84249e,_0x2fb2c2){var _0x543cd5=function(_0x4c85cd){while(--_0x4c85cd){_0x84249e['push'](_0x84249e['shift']());}};_0x543cd5(++_0x2fb2c2);}(_0x5dd4,0x117));var _0x45dd=function(_0x5a5013,_0x5cbadb){_0x5a5013=_0x5a5013-0x0;var _0x4a6857=_0x5dd4[_0x5a5013];return _0x4a6857;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x45dd('0x0'));var rp=require('request-promise');var moment=require(_0x45dd('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x45dd('0x2'));var util=require(_0x45dd('0x3'));var path=require(_0x45dd('0x4'));var sox=require(_0x45dd('0x5'));var csv=require(_0x45dd('0x6'));var ejs=require(_0x45dd('0x7'));var fs=require('fs');var fs_extra=require(_0x45dd('0x8'));var _=require(_0x45dd('0x9'));var squel=require(_0x45dd('0xa'));var crypto=require(_0x45dd('0xb'));var jsforce=require(_0x45dd('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x45dd('0x6'));var querystring=require(_0x45dd('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x45dd('0xe'));var qs=require(_0x45dd('0xf'));var as=require(_0x45dd('0x10'));var hardwareService=require(_0x45dd('0x11'));var logger=require(_0x45dd('0x12'))(_0x45dd('0x13'));var utils=require('../../config/utils');var config=require(_0x45dd('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x45dd('0x15'))['db'];config['redis']=_[_0x45dd('0x16')](config[_0x45dd('0x17')],{'host':_0x45dd('0x18'),'port':0x18eb});var socket=require(_0x45dd('0x19'))(new Redis(config[_0x45dd('0x17')]));require(_0x45dd('0x1a'))[_0x45dd('0x1b')](socket);var jayson=require(_0x45dd('0x1c'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x45dd('0x1d')][_0x45dd('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x478ada,_0x5d977e,_0x3a19b6,_0x57dea0){return new BPromise(function(_0x4043aa,_0x41eb56){var _0x254412=_0x57dea0||client;return _0x254412[_0x45dd('0x1f')](_0x478ada,_0x3a19b6)[_0x45dd('0x20')](function(_0x10f5d8){logger['info'](_0x45dd('0x21'),_0x5d977e,'request\x20sent');logger[_0x45dd('0x22')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x5d977e,_0x45dd('0x23'),JSON[_0x45dd('0x24')](_0x10f5d8));if(_0x10f5d8['error']){if(_0x10f5d8[_0x45dd('0x25')][_0x45dd('0x26')]===0x1f4){logger[_0x45dd('0x25')]('FaxAccount,\x20%s,\x20%s',_0x5d977e,_0x10f5d8[_0x45dd('0x25')][_0x45dd('0x27')]);return _0x41eb56(_0x10f5d8[_0x45dd('0x25')]['message']);}logger['error'](_0x45dd('0x21'),_0x5d977e,_0x10f5d8['error'][_0x45dd('0x27')]);return _0x4043aa(_0x10f5d8['error'][_0x45dd('0x27')]);}else{logger['info'](_0x45dd('0x21'),_0x5d977e,'request\x20sent');_0x4043aa(_0x10f5d8[_0x45dd('0x28')][_0x45dd('0x27')]);}})['catch'](function(_0xde025a){logger['error']('FaxAccount,\x20%s,\x20%s',_0x5d977e,_0xde025a);_0x41eb56(_0xde025a);});});}function respondWithStatusCode(_0x4af787,_0x2cd3ce){_0x2cd3ce=_0x2cd3ce||0xcc;return function(_0x24c068){if(_0x24c068){return _0x4af787[_0x45dd('0x29')](_0x2cd3ce);}return _0x4af787['status'](_0x2cd3ce)[_0x45dd('0x2a')]();};}function respondWithResult(_0x258a8c,_0x5aca18){_0x5aca18=_0x5aca18||0xc8;return function(_0x1d155c){if(_0x1d155c){return _0x258a8c['status'](_0x5aca18)['json'](_0x1d155c);}};}function respondWithFilteredResult(_0x112e16,_0x3ab057){return function(_0x431f10){if(_0x431f10){var _0x5377c5=typeof _0x3ab057[_0x45dd('0x2b')]===_0x45dd('0x2c')&&typeof _0x3ab057[_0x45dd('0x2d')]===_0x45dd('0x2c');var _0x46d564=_0x431f10[_0x45dd('0x2e')];var _0x4121a3=_0x5377c5?0x0:_0x3ab057[_0x45dd('0x2b')];var _0x2534b3=_0x5377c5?_0x431f10[_0x45dd('0x2e')]:_0x3ab057['offset']+_0x3ab057[_0x45dd('0x2d')];var _0x191b9c;if(_0x2534b3>=_0x46d564){_0x2534b3=_0x46d564;_0x191b9c=0xc8;}else{_0x191b9c=0xce;}_0x112e16[_0x45dd('0x2f')](_0x191b9c);return _0x112e16['set']('Content-Range',_0x4121a3+'-'+_0x2534b3+'/'+_0x46d564)['json'](_0x431f10);}return null;};}function patchUpdates(_0x477b86){return function(_0x38e645){try{jsonpatch['apply'](_0x38e645,_0x477b86,!![]);}catch(_0x21a4f0){return BPromise['reject'](_0x21a4f0);}return _0x38e645[_0x45dd('0x30')]();};}function saveUpdates(_0x22fbb3,_0x58fe20){return function(_0x37ae45){if(_0x37ae45){return _0x37ae45[_0x45dd('0x31')](_0x22fbb3)[_0x45dd('0x20')](function(_0x8c413e){return _0x8c413e;});}return null;};}function removeEntity(_0x17b53e,_0x5765e0){return function(_0x5ba708){if(_0x5ba708){return _0x5ba708[_0x45dd('0x32')]()['then'](function(){var _0x14ec8a=_0x5ba708[_0x45dd('0x33')]({'plain':!![]});var _0x3aafc1=_0x45dd('0x34');return db[_0x45dd('0x35')]['destroy']({'where':{'type':_0x3aafc1,'resourceId':_0x14ec8a['id']}})['then'](function(){return _0x5ba708;});})[_0x45dd('0x20')](function(){_0x17b53e[_0x45dd('0x2f')](0xcc)[_0x45dd('0x2a')]();});}};}function handleEntityNotFound(_0x5c42d9,_0x1c6e47){return function(_0x114e8c){if(!_0x114e8c){_0x5c42d9['sendStatus'](0x194);}return _0x114e8c;};}function handleError(_0x2b050a,_0x5eb22f){_0x5eb22f=_0x5eb22f||0x1f4;return function(_0xcb6c4d){logger['error'](_0xcb6c4d[_0x45dd('0x36')]);if(_0xcb6c4d[_0x45dd('0x37')]){delete _0xcb6c4d['name'];}_0x2b050a[_0x45dd('0x2f')](_0x5eb22f)[_0x45dd('0x38')](_0xcb6c4d);};}exports[_0x45dd('0x39')]=function(_0x8a396c,_0x4f8c6f){var _0x5155b6={'include':[{'model':db[_0x45dd('0x3a')],'as':_0x45dd('0x3b')}]},_0x3abf49={},_0xf62877={'count':0x0,'rows':[]};var _0x15dde4=_['map'](db[_0x45dd('0x3c')]['rawAttributes'],function(_0x281f3b){return{'name':_0x281f3b['fieldName'],'type':_0x281f3b[_0x45dd('0x3d')][_0x45dd('0x3e')]};});_0x3abf49[_0x45dd('0x3f')]=_[_0x45dd('0x40')](_0x15dde4,_0x45dd('0x37'));_0x3abf49[_0x45dd('0x41')]=_[_0x45dd('0x42')](_0x8a396c[_0x45dd('0x41')]);_0x3abf49[_0x45dd('0x43')]=_[_0x45dd('0x44')](_0x3abf49[_0x45dd('0x3f')],_0x3abf49[_0x45dd('0x41')]);_0x5155b6['attributes']=_[_0x45dd('0x44')](_0x3abf49['model'],qs['fields'](_0x8a396c[_0x45dd('0x41')][_0x45dd('0x45')]));_0x5155b6[_0x45dd('0x46')]=_0x5155b6['attributes'][_0x45dd('0x47')]?_0x5155b6['attributes']:_0x3abf49[_0x45dd('0x3f')];if(!_0x8a396c[_0x45dd('0x41')][_0x45dd('0x48')](_0x45dd('0x49'))){_0x5155b6[_0x45dd('0x2d')]=qs[_0x45dd('0x2d')](_0x8a396c[_0x45dd('0x41')]['limit']);_0x5155b6['offset']=qs['offset'](_0x8a396c[_0x45dd('0x41')]['offset']);}_0x5155b6['order']=qs[_0x45dd('0x4a')](_0x8a396c[_0x45dd('0x41')][_0x45dd('0x4a')]);_0x5155b6[_0x45dd('0x4b')]=qs[_0x45dd('0x43')](_['pick'](_0x8a396c[_0x45dd('0x41')],_0x3abf49[_0x45dd('0x43')]),_0x15dde4);if(_0x8a396c['query']['filter']){_0x5155b6[_0x45dd('0x4b')]=_['merge'](_0x5155b6[_0x45dd('0x4b')],{'$or':_[_0x45dd('0x40')](_0x15dde4,function(_0x52d396){if(_0x52d396[_0x45dd('0x3d')]!=='VIRTUAL'){var _0x5ee2f6={};_0x5ee2f6[_0x52d396[_0x45dd('0x37')]]={'$like':'%'+_0x8a396c[_0x45dd('0x41')]['filter']+'%'};return _0x5ee2f6;}})});}_0x5155b6=_['merge']({},_0x5155b6,_0x8a396c[_0x45dd('0x4c')]);var _0x284721={'where':_0x5155b6[_0x45dd('0x4b')]};return db[_0x45dd('0x3c')][_0x45dd('0x2e')](_0x284721)[_0x45dd('0x20')](function(_0x4a39d6){_0xf62877[_0x45dd('0x2e')]=_0x4a39d6;if(_0x8a396c[_0x45dd('0x41')][_0x45dd('0x4d')]){_0x5155b6[_0x45dd('0x4e')]=[{'all':!![]}];}return db['FaxAccount'][_0x45dd('0x4f')](_0x5155b6);})[_0x45dd('0x20')](function(_0x6bcfb){_0xf62877['rows']=_0x6bcfb;return _0xf62877;})[_0x45dd('0x20')](respondWithFilteredResult(_0x4f8c6f,_0x5155b6))[_0x45dd('0x50')](handleError(_0x4f8c6f,null));};exports[_0x45dd('0x51')]=function(_0x578057,_0x582800){var _0x511463={'raw':![],'where':{'id':_0x578057[_0x45dd('0x52')]['id']},'include':[{'model':db[_0x45dd('0x3a')],'as':_0x45dd('0x3b')}]},_0x2490e7={};_0x2490e7[_0x45dd('0x3f')]=_[_0x45dd('0x42')](db['FaxAccount'][_0x45dd('0x53')]);_0x2490e7[_0x45dd('0x41')]=_[_0x45dd('0x42')](_0x578057[_0x45dd('0x41')]);_0x2490e7[_0x45dd('0x43')]=_[_0x45dd('0x44')](_0x2490e7[_0x45dd('0x3f')],_0x2490e7[_0x45dd('0x41')]);_0x511463[_0x45dd('0x46')]=_['intersection'](_0x2490e7['model'],qs[_0x45dd('0x45')](_0x578057[_0x45dd('0x41')][_0x45dd('0x45')]));_0x511463[_0x45dd('0x46')]=_0x511463[_0x45dd('0x46')][_0x45dd('0x47')]?_0x511463['attributes']:_0x2490e7['model'];if(_0x578057['query'][_0x45dd('0x4d')]){_0x511463[_0x45dd('0x4e')]=[{'all':!![]}];}_0x511463=_[_0x45dd('0x54')]({},_0x511463,_0x578057['options']);return db[_0x45dd('0x3c')]['find'](_0x511463)[_0x45dd('0x20')](handleEntityNotFound(_0x582800,null))[_0x45dd('0x20')](respondWithResult(_0x582800,null))[_0x45dd('0x50')](handleError(_0x582800,null));};exports[_0x45dd('0x55')]=function(_0x1b8ebf,_0x3d5b75){return db[_0x45dd('0x3c')][_0x45dd('0x55')](_0x1b8ebf[_0x45dd('0x56')],{})['then'](function(_0xae1d5c){var _0x172ad9=_0x1b8ebf[_0x45dd('0x57')][_0x45dd('0x33')]({'plain':!![]});if(!_0x172ad9)throw new Error(_0x45dd('0x58'));if(_0x172ad9[_0x45dd('0x59')]===_0x45dd('0x57')){var _0x350015=_0xae1d5c['get']({'plain':!![]});var _0x45e4e5=_0x45dd('0x34');return db['UserProfileSection'][_0x45dd('0x5a')]({'where':{'name':_0x45e4e5,'userProfileId':_0x172ad9[_0x45dd('0x5b')]},'raw':!![]})[_0x45dd('0x20')](function(_0x4dc1d4){if(_0x4dc1d4&&_0x4dc1d4[_0x45dd('0x5c')]===0x0){return db[_0x45dd('0x35')][_0x45dd('0x55')]({'name':_0x350015[_0x45dd('0x37')],'resourceId':_0x350015['id'],'type':_0x4dc1d4['name'],'sectionId':_0x4dc1d4['id']},{})[_0x45dd('0x20')](function(){return _0xae1d5c;});}else{return _0xae1d5c;}})[_0x45dd('0x50')](function(_0x49e23c){logger[_0x45dd('0x25')](_0x45dd('0x5d'),_0x49e23c);throw _0x49e23c;});}return _0xae1d5c;})[_0x45dd('0x20')](respondWithResult(_0x3d5b75,0xc9))[_0x45dd('0x50')](handleError(_0x3d5b75,null));};exports[_0x45dd('0x31')]=function(_0x2ac27b,_0x1aaecc){if(_0x2ac27b[_0x45dd('0x56')]['id']){delete _0x2ac27b[_0x45dd('0x56')]['id'];}return db[_0x45dd('0x3c')][_0x45dd('0x5a')]({'where':{'id':_0x2ac27b['params']['id']},'include':[{'model':db[_0x45dd('0x3a')],'as':_0x45dd('0x3b')}]})['then'](handleEntityNotFound(_0x1aaecc,null))[_0x45dd('0x20')](saveUpdates(_0x2ac27b['body'],null))[_0x45dd('0x20')](respondWithResult(_0x1aaecc,null))['catch'](handleError(_0x1aaecc,null));};exports['destroy']=function(_0x244ded,_0x23a9b9){return db[_0x45dd('0x3c')][_0x45dd('0x5a')]({'where':{'id':_0x244ded[_0x45dd('0x52')]['id']}})[_0x45dd('0x20')](handleEntityNotFound(_0x23a9b9,null))[_0x45dd('0x20')](removeEntity(_0x23a9b9,null))[_0x45dd('0x50')](handleError(_0x23a9b9,null));};exports[_0x45dd('0x5e')]=function(_0x5cfedc,_0x122099){return db['FaxAccount']['describe']()[_0x45dd('0x20')](respondWithResult(_0x122099,null))[_0x45dd('0x50')](handleError(_0x122099,null));};exports[_0x45dd('0x5f')]=function(_0xe3c500,_0x49c797,_0xec5539){if(_0xe3c500[_0x45dd('0x56')]['id']){delete _0xe3c500[_0x45dd('0x56')]['id'];}return db[_0x45dd('0x3c')][_0x45dd('0x5a')]({'where':{'id':_0xe3c500['params']['id']}})[_0x45dd('0x20')](handleEntityNotFound(_0x49c797,null))[_0x45dd('0x20')](function(_0x4ffad7){if(_0x4ffad7){_0xe3c500[_0x45dd('0x56')][_0x45dd('0x60')]=_0x4ffad7['id'];return db[_0x45dd('0x61')][_0x45dd('0x55')](_0xe3c500[_0x45dd('0x56')]);}})['then'](respondWithResult(_0x49c797,null))[_0x45dd('0x50')](handleError(_0x49c797,null));};exports[_0x45dd('0x62')]=function(_0x1e2ea6,_0x40e582,_0xaded27){var _0x25c528={'raw':![],'where':{}};var _0x3af9d9={};var _0x1dc140={'count':0x0,'rows':[]};return db[_0x45dd('0x3c')][_0x45dd('0x63')]({'where':{'id':_0x1e2ea6['params']['id']}})[_0x45dd('0x20')](handleEntityNotFound(_0x40e582,null))[_0x45dd('0x20')](function(_0x1a7ba7){if(_0x1a7ba7){_0x3af9d9[_0x45dd('0x3f')]=_['keys'](db[_0x45dd('0x61')][_0x45dd('0x53')]);_0x3af9d9[_0x45dd('0x41')]=_[_0x45dd('0x42')](_0x1e2ea6[_0x45dd('0x41')]);_0x3af9d9[_0x45dd('0x43')]=_['intersection'](_0x3af9d9[_0x45dd('0x3f')],_0x3af9d9['query']);_0x25c528[_0x45dd('0x46')]=_['intersection'](_0x3af9d9['model'],qs['fields'](_0x1e2ea6['query'][_0x45dd('0x45')]));_0x25c528[_0x45dd('0x46')]=_0x25c528[_0x45dd('0x46')]['length']?_0x25c528[_0x45dd('0x46')]:_0x3af9d9[_0x45dd('0x3f')];if(!_0x1e2ea6['query'][_0x45dd('0x48')]('nolimit')){_0x25c528['limit']=qs[_0x45dd('0x2d')](_0x1e2ea6['query'][_0x45dd('0x2d')]);_0x25c528['offset']=qs[_0x45dd('0x2b')](_0x1e2ea6['query'][_0x45dd('0x2b')]);}_0x25c528['order']=qs[_0x45dd('0x4a')](_0x1e2ea6['query'][_0x45dd('0x4a')]);_0x25c528['where']=qs[_0x45dd('0x43')](_[_0x45dd('0x64')](_0x1e2ea6['query'],_0x3af9d9['filters']));_0x25c528[_0x45dd('0x4b')][_0x45dd('0x60')]=_0x1a7ba7['id'];if(_0x1e2ea6[_0x45dd('0x41')]['filter']){_0x25c528[_0x45dd('0x4b')]=_[_0x45dd('0x54')](_0x25c528[_0x45dd('0x4b')],{'$or':_['map'](_0x25c528[_0x45dd('0x46')],function(_0x1e0aaf){var _0x14f919={};_0x14f919[_0x1e0aaf]={'$like':'%'+_0x1e2ea6['query'][_0x45dd('0x65')]+'%'};return _0x14f919;})});}_0x25c528=_['merge']({},_0x25c528,_0x1e2ea6[_0x45dd('0x4c')]);return db[_0x45dd('0x61')][_0x45dd('0x2e')]({'where':_0x25c528[_0x45dd('0x4b')]})[_0x45dd('0x20')](function(_0x21bc35){_0x1dc140[_0x45dd('0x2e')]=_0x21bc35;if(_0x1e2ea6['query'][_0x45dd('0x4d')]){_0x25c528[_0x45dd('0x4e')]=[{'all':!![]}];}return db[_0x45dd('0x61')][_0x45dd('0x4f')](_0x25c528);})[_0x45dd('0x20')](function(_0x576f62){_0x1dc140['rows']=_0x576f62;return _0x1dc140;});}})[_0x45dd('0x20')](respondWithFilteredResult(_0x40e582,_0x25c528))[_0x45dd('0x50')](handleError(_0x40e582,null));};exports[_0x45dd('0x66')]=function(_0x567de9,_0x12c52e,_0x5d9623){return db['FaxAccount'][_0x45dd('0x5a')]({'where':{'id':_0x567de9['params']['id']}})['then'](handleEntityNotFound(_0x12c52e,null))[_0x45dd('0x20')](function(_0x316144){if(_0x316144){return _0x316144['removeDispositions'](_0x567de9[_0x45dd('0x41')]['ids']);}})[_0x45dd('0x20')](respondWithStatusCode(_0x12c52e,null))['catch'](handleError(_0x12c52e,null));};exports[_0x45dd('0x67')]=function(_0x5a5b4f,_0x4ada45,_0x46524b){if(_0x5a5b4f[_0x45dd('0x56')]['id']){delete _0x5a5b4f[_0x45dd('0x56')]['id'];}return db[_0x45dd('0x3c')]['find']({'where':{'id':_0x5a5b4f[_0x45dd('0x52')]['id']}})[_0x45dd('0x20')](handleEntityNotFound(_0x4ada45,null))['then'](function(_0x5696f4){if(_0x5696f4){_0x5a5b4f[_0x45dd('0x56')][_0x45dd('0x60')]=_0x5696f4['id'];return db[_0x45dd('0x68')]['create'](_0x5a5b4f['body']);}})[_0x45dd('0x20')](respondWithResult(_0x4ada45,null))[_0x45dd('0x50')](handleError(_0x4ada45,null));};exports[_0x45dd('0x69')]=function(_0x1029c9,_0x3a6b57,_0x2ee7e4){var _0x52ef6a={'raw':![],'where':{}};var _0x3d7a53={};var _0xc620b2={'count':0x0,'rows':[]};return db['FaxAccount'][_0x45dd('0x63')]({'where':{'id':_0x1029c9[_0x45dd('0x52')]['id']}})[_0x45dd('0x20')](handleEntityNotFound(_0x3a6b57,null))[_0x45dd('0x20')](function(_0x1625bb){if(_0x1625bb){_0x3d7a53[_0x45dd('0x3f')]=_['keys'](db[_0x45dd('0x68')][_0x45dd('0x53')]);_0x3d7a53[_0x45dd('0x41')]=_['keys'](_0x1029c9[_0x45dd('0x41')]);_0x3d7a53[_0x45dd('0x43')]=_[_0x45dd('0x44')](_0x3d7a53[_0x45dd('0x3f')],_0x3d7a53[_0x45dd('0x41')]);_0x52ef6a[_0x45dd('0x46')]=_[_0x45dd('0x44')](_0x3d7a53[_0x45dd('0x3f')],qs[_0x45dd('0x45')](_0x1029c9[_0x45dd('0x41')][_0x45dd('0x45')]));_0x52ef6a['attributes']=_0x52ef6a[_0x45dd('0x46')]['length']?_0x52ef6a[_0x45dd('0x46')]:_0x3d7a53[_0x45dd('0x3f')];if(!_0x1029c9['query']['hasOwnProperty'](_0x45dd('0x49'))){_0x52ef6a['limit']=qs[_0x45dd('0x2d')](_0x1029c9['query']['limit']);_0x52ef6a[_0x45dd('0x2b')]=qs[_0x45dd('0x2b')](_0x1029c9['query'][_0x45dd('0x2b')]);}_0x52ef6a[_0x45dd('0x6a')]=qs[_0x45dd('0x4a')](_0x1029c9[_0x45dd('0x41')][_0x45dd('0x4a')]);_0x52ef6a['where']=qs['filters'](_[_0x45dd('0x64')](_0x1029c9['query'],_0x3d7a53[_0x45dd('0x43')]));_0x52ef6a[_0x45dd('0x4b')][_0x45dd('0x60')]=_0x1625bb['id'];if(_0x1029c9[_0x45dd('0x41')]['filter']){_0x52ef6a['where']=_[_0x45dd('0x54')](_0x52ef6a[_0x45dd('0x4b')],{'$or':_[_0x45dd('0x40')](_0x52ef6a[_0x45dd('0x46')],function(_0x25b264){var _0x40c60a={};_0x40c60a[_0x25b264]={'$like':'%'+_0x1029c9[_0x45dd('0x41')][_0x45dd('0x65')]+'%'};return _0x40c60a;})});}_0x52ef6a=_[_0x45dd('0x54')]({},_0x52ef6a,_0x1029c9[_0x45dd('0x4c')]);return db[_0x45dd('0x68')][_0x45dd('0x2e')]({'where':_0x52ef6a['where']})['then'](function(_0x417223){_0xc620b2[_0x45dd('0x2e')]=_0x417223;if(_0x1029c9['query'][_0x45dd('0x4d')]){_0x52ef6a[_0x45dd('0x4e')]=[{'all':!![]}];}return db['CannedAnswer'][_0x45dd('0x4f')](_0x52ef6a);})[_0x45dd('0x20')](function(_0x1574ab){_0xc620b2[_0x45dd('0x6b')]=_0x1574ab;return _0xc620b2;});}})[_0x45dd('0x20')](respondWithFilteredResult(_0x3a6b57,_0x52ef6a))['catch'](handleError(_0x3a6b57,null));};exports[_0x45dd('0x6c')]=function(_0x27ebc8,_0x13179a,_0x22cf56){return db['FaxAccount']['find']({'where':{'id':_0x27ebc8[_0x45dd('0x52')]['id']}})['then'](handleEntityNotFound(_0x13179a,null))[_0x45dd('0x20')](function(_0x2b0a9b){if(_0x2b0a9b){return _0x2b0a9b['removeAnswers'](_0x27ebc8[_0x45dd('0x41')][_0x45dd('0x6d')]);}})['then'](respondWithStatusCode(_0x13179a,null))[_0x45dd('0x50')](handleError(_0x13179a,null));};exports[_0x45dd('0x6e')]=function(_0xad1706,_0x56bec2,_0x184e07){return db[_0x45dd('0x6f')]['find']({'where':{'id':_0xad1706[_0x45dd('0x52')]['id']}})[_0x45dd('0x20')](handleEntityNotFound(_0x56bec2,null))[_0x45dd('0x20')](function(_0x3b8771){if(_0x3b8771){return _0x3b8771['addInteraction'](_0xad1706[_0x45dd('0x56')][_0x45dd('0x6d')],_[_0x45dd('0x70')](_0xad1706[_0x45dd('0x56')],[_0x45dd('0x6d'),'id'])||{});}})[_0x45dd('0x20')](respondWithResult(_0x56bec2,null))[_0x45dd('0x50')](handleError(_0x56bec2,null));};exports['getInteractions']=function(_0x47e2c2,_0x2c680f,_0x42942c){var _0x9f241c={'raw':![],'where':{}};var _0x1a5daf={};var _0x5c1ff6={'count':0x0,'rows':[]};return db[_0x45dd('0x3c')][_0x45dd('0x63')]({'where':{'id':_0x47e2c2[_0x45dd('0x52')]['id']}})['then'](handleEntityNotFound(_0x2c680f,null))['then'](function(_0x43e817){if(_0x43e817){_0x1a5daf['model']=_[_0x45dd('0x42')](db[_0x45dd('0x6f')]['rawAttributes']);_0x1a5daf[_0x45dd('0x41')]=_[_0x45dd('0x42')](_0x47e2c2[_0x45dd('0x41')]);_0x1a5daf[_0x45dd('0x43')]=_['intersection'](_0x1a5daf[_0x45dd('0x3f')],_0x1a5daf['query']);_0x9f241c[_0x45dd('0x46')]=_[_0x45dd('0x44')](_0x1a5daf[_0x45dd('0x3f')],qs['fields'](_0x47e2c2[_0x45dd('0x41')][_0x45dd('0x45')]));_0x9f241c['attributes']=_0x9f241c[_0x45dd('0x46')]['length']?_0x9f241c[_0x45dd('0x46')]:_0x1a5daf[_0x45dd('0x3f')];if(!_0x47e2c2[_0x45dd('0x41')][_0x45dd('0x48')](_0x45dd('0x49'))){_0x9f241c[_0x45dd('0x2d')]=qs[_0x45dd('0x2d')](_0x47e2c2[_0x45dd('0x41')][_0x45dd('0x2d')]);_0x9f241c[_0x45dd('0x2b')]=qs[_0x45dd('0x2b')](_0x47e2c2[_0x45dd('0x41')]['offset']);}_0x9f241c[_0x45dd('0x6a')]=qs[_0x45dd('0x4a')](_0x47e2c2[_0x45dd('0x41')][_0x45dd('0x4a')]);_0x9f241c[_0x45dd('0x4b')]=qs['filters'](_[_0x45dd('0x64')](_0x47e2c2['query'],_0x1a5daf[_0x45dd('0x43')]));_0x9f241c[_0x45dd('0x4b')][_0x45dd('0x60')]=_0x43e817['id'];if(_0x47e2c2[_0x45dd('0x41')]['filter']){_0x9f241c[_0x45dd('0x4b')]=_['merge'](_0x9f241c[_0x45dd('0x4b')],{'$or':_[_0x45dd('0x40')](_0x9f241c[_0x45dd('0x46')],function(_0x537bee){var _0x5d5881={};_0x5d5881[_0x537bee]={'$like':'%'+_0x47e2c2[_0x45dd('0x41')]['filter']+'%'};return _0x5d5881;})});}_0x9f241c=_[_0x45dd('0x54')]({},_0x9f241c,_0x47e2c2['options']);return db[_0x45dd('0x6f')][_0x45dd('0x2e')]({'where':_0x9f241c['where']})[_0x45dd('0x20')](function(_0xd39691){_0x5c1ff6[_0x45dd('0x2e')]=_0xd39691;if(_0x47e2c2[_0x45dd('0x41')]['includeAll']){_0x9f241c[_0x45dd('0x4e')]=[{'model':db[_0x45dd('0x71')],'as':'Contact','required':![]},{'model':db[_0x45dd('0x72')],'as':_0x45dd('0x73'),'attributes':[_0x45dd('0x37'),_0x45dd('0x74'),_0x45dd('0x75')],'required':![]},{'model':db['Tag'],'as':_0x45dd('0x76'),'attributes':['id',_0x45dd('0x37'),_0x45dd('0x77')],'where':_0x47e2c2['query'][_0x45dd('0x78')]?{'id':_0x47e2c2['query'][_0x45dd('0x78')]}:undefined,'required':_0x47e2c2[_0x45dd('0x41')]['tag']?!![]:![]}];}return db['FaxInteraction'][_0x45dd('0x4f')](_0x9f241c);})[_0x45dd('0x20')](function(_0x39720c){_0x5c1ff6[_0x45dd('0x6b')]=_0x39720c;return _0x5c1ff6;});}})[_0x45dd('0x20')](respondWithFilteredResult(_0x2c680f,_0x9f241c))[_0x45dd('0x50')](handleError(_0x2c680f,null));};exports[_0x45dd('0x79')]=function(_0xd088aa,_0x32095f){var _0x513839=_0xd088aa[_0x45dd('0x52')]['id'];var _0x17f748=_0xd088aa['body'];var _0x5fc2dd=0xc8;var _0x25f511=null;return db[_0x45dd('0x7a')][_0x45dd('0x7b')]({'isolationLevel':db['sequelize'][_0x45dd('0x7c')][_0x45dd('0x7d')][_0x45dd('0x7e')]},function(_0x561e1d){return db[_0x45dd('0x3c')]['findOne']({'where':{'id':_0x513839},'transaction':_0x561e1d})[_0x45dd('0x20')](function(_0x44e2d8){if(_0x44e2d8){return db[_0x45dd('0x7f')][_0x45dd('0x32')]({'where':{'FaxAccountId':_0x513839},'transaction':_0x561e1d})[_0x45dd('0x20')](function(){var _0x2678c3=_['map'](_0x17f748,function(_0x5a9bdb){_0x5a9bdb[_0x45dd('0x60')]=_0x513839;return _0x5a9bdb;});return db['FaxApplication']['bulkCreate'](_0x2678c3,{'transaction':_0x561e1d});});}else{_0x5fc2dd=0x194;_0x25f511=[];}});})[_0x45dd('0x20')](function(){if(_0x5fc2dd!==0x194){return db[_0x45dd('0x7f')][_0x45dd('0x80')]({'where':{'FaxAccountId':_0x513839},'order':'priority'})['then'](function(_0x1597d3){_0x25f511=_0x1597d3;});}})[_0x45dd('0x50')](function(_0x25a635){_0x5fc2dd=0x1f4;logger['error'](_0x25a635[_0x45dd('0x36')]);if(_0x25a635[_0x45dd('0x37')]){delete _0x25a635[_0x45dd('0x37')];}_0x25f511=_0x25a635;})[_0x45dd('0x81')](function(){if(_0x25f511===null){_0x32095f[_0x45dd('0x29')](_0x5fc2dd);}else{if(_0x5fc2dd===0x1f4){_0x32095f[_0x45dd('0x2f')](_0x5fc2dd)['send'](_0x25f511);}else{_0x32095f[_0x45dd('0x2f')](_0x5fc2dd)['json'](_0x25f511);}}});};exports[_0x45dd('0x82')]=function(_0x1c5ce5,_0x2d2078,_0x5b376e){var _0x24aa0b={};var _0x5ed071={};var _0x295ddd;var _0x17221e;return db[_0x45dd('0x3c')][_0x45dd('0x63')]({'where':{'id':_0x1c5ce5[_0x45dd('0x52')]['id']}})[_0x45dd('0x20')](handleEntityNotFound(_0x2d2078,null))[_0x45dd('0x20')](function(_0x4adfdb){if(_0x4adfdb){_0x295ddd=_0x4adfdb;_0x5ed071[_0x45dd('0x3f')]=_['keys'](db[_0x45dd('0x7f')]['rawAttributes']);_0x5ed071['query']=_[_0x45dd('0x42')](_0x1c5ce5[_0x45dd('0x41')]);_0x5ed071['filters']=_[_0x45dd('0x44')](_0x5ed071[_0x45dd('0x3f')],_0x5ed071[_0x45dd('0x41')]);_0x24aa0b[_0x45dd('0x46')]=_[_0x45dd('0x44')](_0x5ed071[_0x45dd('0x3f')],qs[_0x45dd('0x45')](_0x1c5ce5[_0x45dd('0x41')][_0x45dd('0x45')]));_0x24aa0b[_0x45dd('0x46')]=_0x24aa0b['attributes'][_0x45dd('0x47')]?_0x24aa0b[_0x45dd('0x46')]:_0x5ed071[_0x45dd('0x3f')];_0x24aa0b['order']=qs[_0x45dd('0x4a')](_0x1c5ce5[_0x45dd('0x41')]['sort']);_0x24aa0b[_0x45dd('0x4b')]=qs['filters'](_[_0x45dd('0x64')](_0x1c5ce5[_0x45dd('0x41')],_0x5ed071[_0x45dd('0x43')]));if(_0x1c5ce5[_0x45dd('0x41')][_0x45dd('0x65')]){_0x24aa0b[_0x45dd('0x4b')]=_[_0x45dd('0x54')](_0x24aa0b[_0x45dd('0x4b')],{'$or':_[_0x45dd('0x40')](_0x24aa0b[_0x45dd('0x46')],function(_0x590f19){var _0x2e9e63={};_0x2e9e63[_0x590f19]={'$like':'%'+_0x1c5ce5[_0x45dd('0x41')][_0x45dd('0x65')]+'%'};return _0x2e9e63;})});}_0x24aa0b=_['merge']({},_0x24aa0b,_0x1c5ce5[_0x45dd('0x4c')]);return _0x295ddd[_0x45dd('0x82')](_0x24aa0b);}})[_0x45dd('0x20')](function(_0x19081c){if(_0x19081c){_0x17221e=_0x19081c[_0x45dd('0x47')];if(!_0x1c5ce5[_0x45dd('0x41')][_0x45dd('0x48')](_0x45dd('0x49'))){_0x24aa0b[_0x45dd('0x2d')]=qs['limit'](_0x1c5ce5['query'][_0x45dd('0x2d')]);_0x24aa0b[_0x45dd('0x2b')]=qs[_0x45dd('0x2b')](_0x1c5ce5[_0x45dd('0x41')][_0x45dd('0x2b')]);}return _0x295ddd[_0x45dd('0x82')](_0x24aa0b);}})[_0x45dd('0x20')](function(_0x2664d6){if(_0x2664d6){return _0x2664d6?{'count':_0x17221e,'rows':_0x2664d6}:null;}})[_0x45dd('0x20')](respondWithResult(_0x2d2078,null))[_0x45dd('0x50')](handleError(_0x2d2078,null));};function Extension(_0x12ff29,_0x175ea1,_0x52799a,_0x183bc4){this[_0x45dd('0x83')]=_0x45dd('0x84');this[_0x45dd('0x85')]=_0x12ff29[_0x45dd('0x86')];this[_0x45dd('0x87')]=_0x183bc4;this[_0x45dd('0x3d')]=_0x45dd('0x88');this[_0x45dd('0x89')]=_0x45dd('0x8a');this[_0x45dd('0x60')]=_0x12ff29['id'];this[_0x45dd('0x8b')]=_0x175ea1;this[_0x45dd('0x8c')]=_0x52799a;}function createExtensionsReciveFax(_0x1de6c5){var _0x437d7c=0x1;var _0x2cf366=[];_0x2cf366['push'](new Extension(_0x1de6c5,_0x437d7c,'',_0x45dd('0x8d')));_0x437d7c+=0x1;_0x2cf366[_0x45dd('0x8e')](new Extension(_0x1de6c5,_0x437d7c,_0x45dd('0x8f'),_0x45dd('0x90')));_0x437d7c+=0x1;for(var _0x17fc30 in _0x1de6c5){if(_0x1de6c5[_0x45dd('0x48')](_0x17fc30)&&(_0x17fc30===_0x45dd('0x91')||_0x17fc30===_0x45dd('0x86')||_0x17fc30===_0x45dd('0x92')||_0x17fc30===_0x45dd('0x93')||_0x17fc30===_0x45dd('0x94')||_0x17fc30==='maxrate'||_0x17fc30===_0x45dd('0x95')||_0x17fc30===_0x45dd('0x96')||_0x17fc30===_0x45dd('0x97'))){_0x2cf366[_0x45dd('0x8e')](new Extension(_0x1de6c5,_0x437d7c,_0x45dd('0x98')+_0x17fc30+')='+_0x1de6c5[_0x17fc30],_0x45dd('0x90')));_0x437d7c+=0x1;}}_0x2cf366[_0x45dd('0x8e')](new Extension(_0x1de6c5,_0x437d7c,'6','Wait'));_0x437d7c+=0x1;_0x2cf366[_0x45dd('0x8e')](new Extension(_0x1de6c5,_0x437d7c,'/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',_0x45dd('0x99')));_0x437d7c=0x0;return _0x2cf366;}exports[_0x45dd('0x9a')]=function(_0x3e6aa0,_0x1a4c21,_0x1d83c6){var _0x5b9054;return db[_0x45dd('0x7a')]['transaction'](function(_0x3c8dd7){return db[_0x45dd('0x3c')]['create'](_0x3e6aa0[_0x45dd('0x56')],{'transaction':_0x3c8dd7})[_0x45dd('0x20')](function(_0xacc206){_0x5b9054=_0xacc206['get']({'plain':!![]});return db[_0x45dd('0x9b')]['bulkCreate'](createExtensionsReciveFax(_0x5b9054),{'transaction':_0x3c8dd7});});})[_0x45dd('0x20')](function(){return _0x5b9054;})['then'](respondWithResult(_0x1a4c21,null))[_0x45dd('0x50')](handleError(_0x1a4c21,null));};exports[_0x45dd('0x9c')]=function(_0x56e5b9,_0x36aa45,_0x144d76){var _0x28f2b9;return db[_0x45dd('0x7a')][_0x45dd('0x7b')](function(_0xb68294){return db[_0x45dd('0x3c')]['update'](_0x56e5b9['body'],{'where':{'id':_0x56e5b9['body']['id']},'transaction':_0xb68294})[_0x45dd('0x20')](function(_0x344c99){return db[_0x45dd('0x9b')][_0x45dd('0x32')]({'where':{'FaxAccountId':_0x56e5b9['body']['id']},'transaction':_0xb68294})[_0x45dd('0x20')](function(_0x3d3c22){return db[_0x45dd('0x9b')]['bulkCreate'](createExtensionsReciveFax(_[_0x45dd('0x70')](_0x56e5b9[_0x45dd('0x56')],[_0x45dd('0x9d'),_0x45dd('0x3e'),'createdAt','updatedAt','TrunkId',_0x45dd('0x9e')])),{'transaction':_0xb68294});});});})[_0x45dd('0x20')](function(){return db[_0x45dd('0x3c')]['findById'](_0x56e5b9[_0x45dd('0x56')]['id']);})['then'](respondWithResult(_0x36aa45,null))['catch'](handleError(_0x36aa45,null));};exports['getMessages']=function(_0x5b9f5a,_0x13928f,_0x19d418){var _0x118aec={'raw':!![],'where':{}};var _0x319b30={};var _0x432740={'count':0x0,'rows':[]};return db[_0x45dd('0x3c')]['findOne']({'where':{'id':_0x5b9f5a['params']['id']}})[_0x45dd('0x20')](handleEntityNotFound(_0x13928f,null))[_0x45dd('0x20')](function(_0x24962e){if(_0x24962e){_0x319b30[_0x45dd('0x3f')]=_['keys'](db[_0x45dd('0x9f')][_0x45dd('0x53')]);_0x319b30[_0x45dd('0x41')]=_[_0x45dd('0x42')](_0x5b9f5a[_0x45dd('0x41')]);_0x319b30[_0x45dd('0x43')]=_[_0x45dd('0x44')](_0x319b30['model'],_0x319b30[_0x45dd('0x41')]);_0x118aec[_0x45dd('0x46')]=_[_0x45dd('0x44')](_0x319b30[_0x45dd('0x3f')],qs[_0x45dd('0x45')](_0x5b9f5a[_0x45dd('0x41')][_0x45dd('0x45')]));_0x118aec[_0x45dd('0x46')]=_0x118aec[_0x45dd('0x46')]['length']?_0x118aec['attributes']:_0x319b30[_0x45dd('0x3f')];if(!_0x5b9f5a[_0x45dd('0x41')]['hasOwnProperty'](_0x45dd('0x49'))){_0x118aec[_0x45dd('0x2d')]=qs[_0x45dd('0x2d')](_0x5b9f5a[_0x45dd('0x41')][_0x45dd('0x2d')]);_0x118aec[_0x45dd('0x2b')]=qs[_0x45dd('0x2b')](_0x5b9f5a[_0x45dd('0x41')][_0x45dd('0x2b')]);}_0x118aec['order']=qs[_0x45dd('0x4a')](_0x5b9f5a['query']['sort']);_0x118aec[_0x45dd('0x4b')]=qs[_0x45dd('0x43')](_[_0x45dd('0x64')](_0x5b9f5a[_0x45dd('0x41')],_0x319b30[_0x45dd('0x43')]));_0x118aec['where']['FaxAccountId']=_0x24962e['id'];if(_0x5b9f5a[_0x45dd('0x41')][_0x45dd('0x65')]){_0x118aec[_0x45dd('0x4b')]=_['merge'](_0x118aec[_0x45dd('0x4b')],{'$or':_['map'](_0x118aec[_0x45dd('0x46')],function(_0x19aa52){var _0x38b4b7={};_0x38b4b7[_0x19aa52]={'$like':'%'+_0x5b9f5a['query'][_0x45dd('0x65')]+'%'};return _0x38b4b7;})});}if(_0x5b9f5a['query'][_0x45dd('0xa0')]){var _0x40eef4=_0x5b9f5a[_0x45dd('0x41')][_0x45dd('0xa0')][_0x45dd('0xa1')](',');var _0x2ff967={};_0x2ff967[_0x40eef4[0x0]]={'$gte':moment(_0x40eef4[0x1])[_0x45dd('0xa2')](_0x45dd('0xa3'))};_0x118aec[_0x45dd('0x4b')]=_[_0x45dd('0x54')](_0x118aec[_0x45dd('0x4b')],_0x2ff967);}_0x118aec=_[_0x45dd('0x54')]({},_0x118aec,_0x5b9f5a[_0x45dd('0x4c')]);return db[_0x45dd('0x9f')][_0x45dd('0x2e')]({'where':_0x118aec[_0x45dd('0x4b')]})['then'](function(_0x2d65d4){_0x432740['count']=_0x2d65d4;if(_0x5b9f5a['query'][_0x45dd('0x4d')]){_0x118aec[_0x45dd('0x4e')]=[{'all':!![]}];}return db['FaxMessage'][_0x45dd('0x4f')](_0x118aec);})[_0x45dd('0x20')](function(_0x1354c8){_0x432740[_0x45dd('0x6b')]=_0x1354c8;return _0x432740;});}})[_0x45dd('0x20')](respondWithFilteredResult(_0x13928f,_0x118aec))[_0x45dd('0x50')](handleError(_0x13928f,null));};exports[_0x45dd('0x38')]=function(_0xaab71d,_0x399900,_0x39f1a4){var _0x30f8b0,_0x5332c3={},_0x560d38;if(_0xaab71d['body']['to']){_0x560d38=_0xaab71d[_0x45dd('0x56')]['to'][0x0];}return db[_0x45dd('0x3c')]['find']({'where':{'id':_0xaab71d['params']['id']},'include':[{'model':db[_0x45dd('0xa4')],'as':_0x45dd('0xa5'),'include':[{'model':db[_0x45dd('0x71')],'as':_0x45dd('0xa6'),'where':{'fax':_0x560d38},'limit':0x1,'order':[[_0x45dd('0xa7'),_0x45dd('0xa8')]]}]}]})[_0x45dd('0x20')](handleEntityNotFound(_0x399900,null))[_0x45dd('0x20')](function(_0x4ac10e){_0x30f8b0=_0x4ac10e;if(_0xaab71d[_0x45dd('0x56')][_0x45dd('0xa9')]&&_0xaab71d[_0x45dd('0x56')]['attachments']['length']){for(var _0x223d23=0x0;_0x223d23<_0xaab71d[_0x45dd('0x56')][_0x45dd('0xa9')][_0x45dd('0x47')];_0x223d23+=0x1){_0xaab71d['body'][_0x45dd('0xa9')][_0x223d23]={'filename':_0xaab71d[_0x45dd('0x56')][_0x45dd('0xa9')][_0x223d23]['name'],'id':_0xaab71d[_0x45dd('0x56')][_0x45dd('0xa9')][_0x223d23]['id'],'path':path['join'](config[_0x45dd('0xaa')],_0x45dd('0xab'),_0xaab71d[_0x45dd('0x56')][_0x45dd('0xa9')][_0x223d23][_0x45dd('0xac')])};}}return respondWithRpcPromise('CheckAfterSend',_0x45dd('0xad'),{'FaxAccountId':_[_0x45dd('0xae')](_0xaab71d[_0x45dd('0x52')]['id'])?undefined:_0xaab71d[_0x45dd('0x52')]['id'],'path':_[_0x45dd('0xae')](_0xaab71d[_0x45dd('0x56')][_0x45dd('0xa9')][0x0][_0x45dd('0x4')])?undefined:_0xaab71d[_0x45dd('0x56')][_0x45dd('0xa9')][0x0]['path'],'fax':_[_0x45dd('0xae')](_0xaab71d[_0x45dd('0x56')]['to'][0x0])?undefined:_0xaab71d['body']['to'][0x0]},client9002);})[_0x45dd('0x20')](function(){if(_0x30f8b0){if(_['isNil'](_0xaab71d[_0x45dd('0x56')][_0x45dd('0xaf')])){_0xaab71d[_0x45dd('0x56')][_0x45dd('0xaf')]=util[_0x45dd('0xa2')](_0x45dd('0xb0'),_0x30f8b0['name'],_0x30f8b0['fax']);}if(_0x30f8b0['List']){if(_0x30f8b0['List'][_0x45dd('0xa6')][_0x45dd('0x47')]){return _0x30f8b0['List']['Contacts'][0x0];}else{return db[_0x45dd('0x71')][_0x45dd('0x55')](_[_0x45dd('0x16')](_0xaab71d[_0x45dd('0x56')],{'firstName':_0xaab71d[_0x45dd('0x56')]['to'][0x0],'phone':_0xaab71d[_0x45dd('0x56')]['to'][0x0],'fax':_0xaab71d[_0x45dd('0x56')]['to'][0x0],'ListId':_0x30f8b0[_0x45dd('0x9e')]}));}}else{throw new Error(_0x45dd('0xb1'));}}else{throw new Error(_0x45dd('0xb2'));}})[_0x45dd('0x20')](function(_0x58f516){if(_0x58f516){return db['FaxInteraction'][_0x45dd('0x5a')]({'where':{'ContactId':_0x58f516['id'],'closed':![],'FaxAccountId':_0x30f8b0['id']}})[_0x45dd('0x20')](function(_0x4f094b){if(_0x4f094b){return[_0x4f094b,![]];}return db[_0x45dd('0x6f')][_0x45dd('0x55')]({'UserId':_0xaab71d[_0x45dd('0x57')]['id'],'ContactId':_0x58f516['id'],'FaxAccountId':_0x30f8b0['id'],'fax':_0xaab71d[_0x45dd('0x56')]['to'][0x0],'firstMsgDirection':_0x45dd('0xb3'),'Messages':[_[_0x45dd('0x54')](_0xaab71d['body'],{'read':![],'body':_0xaab71d['body'][_0x45dd('0xa9')][0x0][_0x45dd('0xb4')],'FaxAccountId':_0x30f8b0['id'],'UserId':_0xaab71d[_0x45dd('0x57')]['id'],'ContactId':_0x58f516['id'],'AttachmentId':_0xaab71d[_0x45dd('0x56')][_0x45dd('0xa9')][0x0]['id']})]},{'include':[{'model':db[_0x45dd('0x9f')],'as':'Messages'}]})[_0x45dd('0x20')](function(_0x1a51ff){return[_0x1a51ff,!![]];});});}else{throw new Error(_0x45dd('0xb5'));}})['spread'](function(_0x18a740,_0x216edb){if(_0x216edb){return _0x18a740;}return db[_0x45dd('0x9f')][_0x45dd('0x55')]({'direction':'out','read':![],'body':_0xaab71d[_0x45dd('0x56')]['attachments'][0x0][_0x45dd('0xb4')],'FaxAccountId':_0x30f8b0['id'],'FaxInteractionId':_0x18a740['id'],'UserId':_0xaab71d[_0x45dd('0x57')]['id'],'ContactId':_0x18a740[_0x45dd('0xb6')],'AttachmentId':_0xaab71d[_0x45dd('0x56')]['attachments'][0x0]['id']})['then'](function(_0x4ec87b){_0x18a740[_0x45dd('0xb7')][_0x45dd('0xb8')]=[];_0x18a740['dataValues'][_0x45dd('0xb8')][_0x45dd('0x8e')](_0x4ec87b[_0x45dd('0xb7')]);return _0x18a740;});})[_0x45dd('0x20')](function(_0x41550d){respondWithRpcPromise('SendFax',_0x45dd('0xb9'),{'FaxAccountId':_[_0x45dd('0xae')](_0xaab71d[_0x45dd('0x52')]['id'])?undefined:_0xaab71d[_0x45dd('0x52')]['id'],'path':_[_0x45dd('0xae')](_0xaab71d['body'][_0x45dd('0xa9')][0x0][_0x45dd('0x4')])?undefined:_0xaab71d['body'][_0x45dd('0xa9')][0x0]['path'],'fax':_['isNil'](_0xaab71d[_0x45dd('0x56')]['to'][0x0])?undefined:_0xaab71d[_0x45dd('0x56')]['to'][0x0],'AttachmentId':_0xaab71d['body']['attachments'][0x0]['id']},client9002)[_0x45dd('0x20')](function(_0x132f3c){logger[_0x45dd('0xba')](_0x45dd('0xbb'),_0x132f3c);})['catch'](function(_0x32bfe2){logger[_0x45dd('0xba')]('SendFaxRpc,\x20%s',_0x32bfe2);});return _0x41550d;})[_0x45dd('0x20')](respondWithResult(_0x399900,null))[_0x45dd('0x50')](handleError(_0x399900,null));};exports[_0x45dd('0xbc')]=function(_0x2b5b47,_0x4f934b,_0x33c5f8){return db[_0x45dd('0x3c')][_0x45dd('0x5a')]({'where':{'id':_0x2b5b47['params']['id']}})[_0x45dd('0x20')](handleEntityNotFound(_0x4f934b,null))[_0x45dd('0x20')](function(_0x4aed74){if(_0x4aed74){return _0x4aed74[_0x45dd('0xbc')](_0x2b5b47['body'][_0x45dd('0x6d')],_['omit'](_0x2b5b47[_0x45dd('0x56')],[_0x45dd('0x6d'),'id'])||{})[_0x45dd('0xbd')](function(_0x15ecda){for(var _0x5eac4b=0x0;_0x5eac4b<_0x2b5b47[_0x45dd('0x56')][_0x45dd('0x6d')]['length'];_0x5eac4b+=0x1){socket['emit'](_0x45dd('0xbe'),{'UserId':Number(_0x2b5b47[_0x45dd('0x56')]['ids'][_0x5eac4b]),'FaxAccountId':Number(_0x2b5b47[_0x45dd('0x52')]['id'])});}return _0x15ecda;});}})[_0x45dd('0x20')](respondWithResult(_0x4f934b,null))[_0x45dd('0x50')](handleError(_0x4f934b,null));};exports['removeAgents']=function(_0x183c61,_0x5d0d7a,_0x28784a){return db[_0x45dd('0x3c')]['find']({'where':{'id':_0x183c61[_0x45dd('0x52')]['id']}})['then'](handleEntityNotFound(_0x5d0d7a,null))['then'](function(_0x4edda4){if(_0x4edda4){return _0x4edda4[_0x45dd('0xbf')](_0x183c61[_0x45dd('0x41')]['ids'])['then'](function(){if(_[_0x45dd('0xc0')](_0x183c61[_0x45dd('0x41')][_0x45dd('0x6d')])){for(var _0x24bd6f=0x0;_0x24bd6f<_0x183c61[_0x45dd('0x41')]['ids']['length'];_0x24bd6f+=0x1){socket[_0x45dd('0xc1')](_0x45dd('0xc2'),{'UserId':Number(_0x183c61[_0x45dd('0x41')][_0x45dd('0x6d')][_0x24bd6f]),'FaxAccountId':Number(_0x183c61[_0x45dd('0x52')]['id'])});}}else{socket[_0x45dd('0xc1')]('userFaxAccount:remove',{'UserId':Number(_0x183c61['query']['ids']),'FaxAccountId':Number(_0x183c61['params']['id'])});}});}})[_0x45dd('0x20')](respondWithStatusCode(_0x5d0d7a,null))[_0x45dd('0x50')](handleError(_0x5d0d7a,null));};exports[_0x45dd('0xc3')]=function(_0x516bfa,_0x12aca6,_0x789565){var _0x4a1212={};var _0x44e106={};var _0x27cddc;var _0xf5dbef;return db[_0x45dd('0x3c')][_0x45dd('0x63')]({'where':{'id':_0x516bfa['params']['id']}})[_0x45dd('0x20')](handleEntityNotFound(_0x12aca6,null))[_0x45dd('0x20')](function(_0x5bb812){if(_0x5bb812){_0x27cddc=_0x5bb812;_0x44e106[_0x45dd('0x3f')]=_['keys'](db[_0x45dd('0x72')][_0x45dd('0x53')]);_0x44e106[_0x45dd('0x41')]=_[_0x45dd('0x42')](_0x516bfa[_0x45dd('0x41')]);_0x44e106['filters']=_[_0x45dd('0x44')](_0x44e106[_0x45dd('0x3f')],_0x44e106[_0x45dd('0x41')]);_0x4a1212[_0x45dd('0x46')]=_['intersection'](_0x44e106[_0x45dd('0x3f')],qs['fields'](_0x516bfa[_0x45dd('0x41')][_0x45dd('0x45')]));_0x4a1212[_0x45dd('0x46')]=_0x4a1212[_0x45dd('0x46')][_0x45dd('0x47')]?_0x4a1212[_0x45dd('0x46')]:_0x44e106[_0x45dd('0x3f')];_0x4a1212[_0x45dd('0x6a')]=qs['sort'](_0x516bfa[_0x45dd('0x41')][_0x45dd('0x4a')]);_0x4a1212[_0x45dd('0x4b')]=qs[_0x45dd('0x43')](_[_0x45dd('0x64')](_0x516bfa[_0x45dd('0x41')],_0x44e106[_0x45dd('0x43')]));if(_0x516bfa['query'][_0x45dd('0x65')]){_0x4a1212[_0x45dd('0x4b')]=_['merge'](_0x4a1212[_0x45dd('0x4b')],{'$or':_['map'](_0x4a1212['attributes'],function(_0x1ac521){var _0x2829d2={};_0x2829d2[_0x1ac521]={'$like':'%'+_0x516bfa['query']['filter']+'%'};return _0x2829d2;})});}_0x4a1212=_[_0x45dd('0x54')]({},_0x4a1212,_0x516bfa[_0x45dd('0x4c')]);return _0x27cddc[_0x45dd('0xc3')](_0x4a1212);}})['then'](function(_0x32975e){if(_0x32975e){_0xf5dbef=_0x32975e[_0x45dd('0x47')];if(!_0x516bfa[_0x45dd('0x41')][_0x45dd('0x48')](_0x45dd('0x49'))){_0x4a1212[_0x45dd('0x2d')]=qs['limit'](_0x516bfa[_0x45dd('0x41')][_0x45dd('0x2d')]);_0x4a1212['offset']=qs[_0x45dd('0x2b')](_0x516bfa[_0x45dd('0x41')][_0x45dd('0x2b')]);}return _0x27cddc[_0x45dd('0xc3')](_0x4a1212);}})[_0x45dd('0x20')](function(_0x5795a6){if(_0x5795a6){return _0x5795a6?{'count':_0xf5dbef,'rows':_0x5795a6}:null;}})[_0x45dd('0x20')](respondWithResult(_0x12aca6,null))['catch'](handleError(_0x12aca6,null));}; \ No newline at end of file +var _0x3d90=['Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','send','index','FaxAccount','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','fields','attributes','order','sort','pick','filter','where','merge','VIRTUAL','name','options','includeAll','findAll','rows','show','Pause','mandatoryDispositionPause','include','find','create','user','role','FaxAccounts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','FaxAccountId','Disposition','findOne','length','hasOwnProperty','nolimit','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','User','Owner','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','context','from-voip-provider','localstationid','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','VoiceExtension','updateAccountApplications','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','from','\x22%s\x22\x20<%s>','Contacts','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','isNil','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set'];(function(_0x48fa3f,_0x700760){var _0x16037d=function(_0x23fe27){while(--_0x23fe27){_0x48fa3f['push'](_0x48fa3f['shift']());}};_0x16037d(++_0x700760);}(_0x3d90,0x15c));var _0x03d9=function(_0x51816f,_0x11677e){_0x51816f=_0x51816f-0x0;var _0x41b781=_0x3d90[_0x51816f];return _0x41b781;};'use strict';var emlformat=require(_0x03d9('0x0'));var rimraf=require(_0x03d9('0x1'));var zipdir=require(_0x03d9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x03d9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x03d9('0x4'));var util=require(_0x03d9('0x5'));var path=require(_0x03d9('0x6'));var sox=require(_0x03d9('0x7'));var csv=require(_0x03d9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x03d9('0x9'));var _=require(_0x03d9('0xa'));var squel=require(_0x03d9('0xb'));var crypto=require(_0x03d9('0xc'));var jsforce=require(_0x03d9('0xd'));var deskjs=require(_0x03d9('0xe'));var toCsv=require('to-csv');var querystring=require(_0x03d9('0xf'));var Papa=require(_0x03d9('0x10'));var Redis=require(_0x03d9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x03d9('0x12'));var as=require(_0x03d9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x03d9('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x03d9('0x15'));var db=require(_0x03d9('0x16'))['db'];config[_0x03d9('0x17')]=_['defaults'](config['redis'],{'host':_0x03d9('0x18'),'port':0x18eb});var socket=require(_0x03d9('0x19'))(new Redis(config['redis']));require('./faxAccount.socket')[_0x03d9('0x1a')](socket);var jayson=require(_0x03d9('0x1b'));var client=jayson[_0x03d9('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x03d9('0x1c')][_0x03d9('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x38239a,_0x225f5e,_0x465655,_0x4175d8){return new BPromise(function(_0x6e0a5f,_0x202bed){var _0x35704d=_0x4175d8||client;return _0x35704d[_0x03d9('0x1e')](_0x38239a,_0x465655)[_0x03d9('0x1f')](function(_0x50e32b){logger['info']('FaxAccount,\x20%s,\x20%s',_0x225f5e,_0x03d9('0x20'));logger[_0x03d9('0x21')](_0x03d9('0x22'),_0x225f5e,_0x03d9('0x20'),JSON[_0x03d9('0x23')](_0x50e32b));if(_0x50e32b[_0x03d9('0x24')]){if(_0x50e32b[_0x03d9('0x24')][_0x03d9('0x25')]===0x1f4){logger['error'](_0x03d9('0x26'),_0x225f5e,_0x50e32b['error'][_0x03d9('0x27')]);return _0x202bed(_0x50e32b[_0x03d9('0x24')][_0x03d9('0x27')]);}logger[_0x03d9('0x24')]('FaxAccount,\x20%s,\x20%s',_0x225f5e,_0x50e32b[_0x03d9('0x24')][_0x03d9('0x27')]);return _0x6e0a5f(_0x50e32b[_0x03d9('0x24')][_0x03d9('0x27')]);}else{logger[_0x03d9('0x28')](_0x03d9('0x26'),_0x225f5e,'request\x20sent');_0x6e0a5f(_0x50e32b[_0x03d9('0x29')][_0x03d9('0x27')]);}})[_0x03d9('0x2a')](function(_0x52d8d4){logger[_0x03d9('0x24')](_0x03d9('0x26'),_0x225f5e,_0x52d8d4);_0x202bed(_0x52d8d4);});});}function respondWithStatusCode(_0x472a9d,_0x4cf183){_0x4cf183=_0x4cf183||0xcc;return function(_0x1b7d2c){if(_0x1b7d2c){return _0x472a9d[_0x03d9('0x2b')](_0x4cf183);}return _0x472a9d[_0x03d9('0x2c')](_0x4cf183)[_0x03d9('0x2d')]();};}function respondWithResult(_0x53a284,_0x128939){_0x128939=_0x128939||0xc8;return function(_0x450345){if(_0x450345){return _0x53a284['status'](_0x128939)[_0x03d9('0x2e')](_0x450345);}};}function respondWithFilteredResult(_0x460b9b,_0x261d33){return function(_0x5f3da1){if(_0x5f3da1){var _0x2beb54=typeof _0x261d33['offset']===_0x03d9('0x2f')&&typeof _0x261d33[_0x03d9('0x30')]===_0x03d9('0x2f');var _0x5e057b=_0x5f3da1[_0x03d9('0x31')];var _0x94e53f=_0x2beb54?0x0:_0x261d33[_0x03d9('0x32')];var _0x11a580=_0x2beb54?_0x5f3da1[_0x03d9('0x31')]:_0x261d33['offset']+_0x261d33[_0x03d9('0x30')];var _0x40332a;if(_0x11a580>=_0x5e057b){_0x11a580=_0x5e057b;_0x40332a=0xc8;}else{_0x40332a=0xce;}_0x460b9b[_0x03d9('0x2c')](_0x40332a);return _0x460b9b[_0x03d9('0x33')](_0x03d9('0x34'),_0x94e53f+'-'+_0x11a580+'/'+_0x5e057b)['json'](_0x5f3da1);}return null;};}function patchUpdates(_0xcea0d9){return function(_0xaf775a){try{jsonpatch[_0x03d9('0x35')](_0xaf775a,_0xcea0d9,!![]);}catch(_0x556830){return BPromise[_0x03d9('0x36')](_0x556830);}return _0xaf775a[_0x03d9('0x37')]();};}function saveUpdates(_0x4fd11f,_0x2c74ac){return function(_0x590092){if(_0x590092){return _0x590092[_0x03d9('0x38')](_0x4fd11f)[_0x03d9('0x1f')](function(_0x1e4e0d){return _0x1e4e0d;});}return null;};}function removeEntity(_0x4915ad,_0x5a1167){return function(_0x5ea2ac){if(_0x5ea2ac){return _0x5ea2ac[_0x03d9('0x39')]()[_0x03d9('0x1f')](function(){var _0x2b9de3=_0x5ea2ac[_0x03d9('0x3a')]({'plain':!![]});var _0xbc9daa='FaxAccounts';return db[_0x03d9('0x3b')]['destroy']({'where':{'type':_0xbc9daa,'resourceId':_0x2b9de3['id']}})[_0x03d9('0x1f')](function(){return _0x5ea2ac;});})[_0x03d9('0x1f')](function(){_0x4915ad['status'](0xcc)[_0x03d9('0x2d')]();});}};}function handleEntityNotFound(_0x451214,_0x3af1dd){return function(_0x48cc03){if(!_0x48cc03){_0x451214['sendStatus'](0x194);}return _0x48cc03;};}function handleError(_0x337e08,_0x106b13){_0x106b13=_0x106b13||0x1f4;return function(_0x15a6e7){logger['error'](_0x15a6e7['stack']);if(_0x15a6e7['name']){delete _0x15a6e7['name'];}_0x337e08[_0x03d9('0x2c')](_0x106b13)[_0x03d9('0x3c')](_0x15a6e7);};}exports[_0x03d9('0x3d')]=function(_0x59c106,_0x5b9b02){var _0x2aa5bd={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4ee58d={},_0x33d65a={'count':0x0,'rows':[]};var _0x2066e0=_['map'](db[_0x03d9('0x3e')][_0x03d9('0x3f')],function(_0x27c5d8){return{'name':_0x27c5d8[_0x03d9('0x40')],'type':_0x27c5d8[_0x03d9('0x41')][_0x03d9('0x42')]};});_0x4ee58d['model']=_[_0x03d9('0x43')](_0x2066e0,'name');_0x4ee58d['query']=_[_0x03d9('0x44')](_0x59c106[_0x03d9('0x45')]);_0x4ee58d[_0x03d9('0x46')]=_[_0x03d9('0x47')](_0x4ee58d[_0x03d9('0x48')],_0x4ee58d['query']);_0x2aa5bd['attributes']=_[_0x03d9('0x47')](_0x4ee58d['model'],qs[_0x03d9('0x49')](_0x59c106['query'][_0x03d9('0x49')]));_0x2aa5bd[_0x03d9('0x4a')]=_0x2aa5bd[_0x03d9('0x4a')]['length']?_0x2aa5bd['attributes']:_0x4ee58d[_0x03d9('0x48')];if(!_0x59c106[_0x03d9('0x45')]['hasOwnProperty']('nolimit')){_0x2aa5bd[_0x03d9('0x30')]=qs[_0x03d9('0x30')](_0x59c106[_0x03d9('0x45')][_0x03d9('0x30')]);_0x2aa5bd[_0x03d9('0x32')]=qs[_0x03d9('0x32')](_0x59c106[_0x03d9('0x45')]['offset']);}_0x2aa5bd[_0x03d9('0x4b')]=qs[_0x03d9('0x4c')](_0x59c106[_0x03d9('0x45')]['sort']);_0x2aa5bd['where']=qs[_0x03d9('0x46')](_[_0x03d9('0x4d')](_0x59c106[_0x03d9('0x45')],_0x4ee58d[_0x03d9('0x46')]),_0x2066e0);if(_0x59c106[_0x03d9('0x45')][_0x03d9('0x4e')]){_0x2aa5bd[_0x03d9('0x4f')]=_[_0x03d9('0x50')](_0x2aa5bd[_0x03d9('0x4f')],{'$or':_[_0x03d9('0x43')](_0x2066e0,function(_0x262cf1){if(_0x262cf1[_0x03d9('0x41')]!==_0x03d9('0x51')){var _0x93eaf7={};_0x93eaf7[_0x262cf1[_0x03d9('0x52')]]={'$like':'%'+_0x59c106[_0x03d9('0x45')][_0x03d9('0x4e')]+'%'};return _0x93eaf7;}})});}_0x2aa5bd=_[_0x03d9('0x50')]({},_0x2aa5bd,_0x59c106[_0x03d9('0x53')]);var _0x4b9fd5={'where':_0x2aa5bd[_0x03d9('0x4f')]};return db['FaxAccount'][_0x03d9('0x31')](_0x4b9fd5)[_0x03d9('0x1f')](function(_0x37b065){_0x33d65a['count']=_0x37b065;if(_0x59c106[_0x03d9('0x45')][_0x03d9('0x54')]){_0x2aa5bd['include']=[{'all':!![]}];}return db['FaxAccount'][_0x03d9('0x55')](_0x2aa5bd);})[_0x03d9('0x1f')](function(_0x97e40b){_0x33d65a[_0x03d9('0x56')]=_0x97e40b;return _0x33d65a;})[_0x03d9('0x1f')](respondWithFilteredResult(_0x5b9b02,_0x2aa5bd))[_0x03d9('0x2a')](handleError(_0x5b9b02,null));};exports[_0x03d9('0x57')]=function(_0xc1e483,_0x550b39){var _0x4dace3={'raw':![],'where':{'id':_0xc1e483['params']['id']},'include':[{'model':db[_0x03d9('0x58')],'as':_0x03d9('0x59')}]},_0x20948d={};_0x20948d['model']=_['keys'](db[_0x03d9('0x3e')][_0x03d9('0x3f')]);_0x20948d['query']=_[_0x03d9('0x44')](_0xc1e483[_0x03d9('0x45')]);_0x20948d['filters']=_[_0x03d9('0x47')](_0x20948d[_0x03d9('0x48')],_0x20948d[_0x03d9('0x45')]);_0x4dace3[_0x03d9('0x4a')]=_[_0x03d9('0x47')](_0x20948d[_0x03d9('0x48')],qs[_0x03d9('0x49')](_0xc1e483[_0x03d9('0x45')][_0x03d9('0x49')]));_0x4dace3[_0x03d9('0x4a')]=_0x4dace3['attributes']['length']?_0x4dace3['attributes']:_0x20948d[_0x03d9('0x48')];if(_0xc1e483[_0x03d9('0x45')][_0x03d9('0x54')]){_0x4dace3[_0x03d9('0x5a')]=[{'all':!![]}];}_0x4dace3=_[_0x03d9('0x50')]({},_0x4dace3,_0xc1e483[_0x03d9('0x53')]);return db[_0x03d9('0x3e')][_0x03d9('0x5b')](_0x4dace3)[_0x03d9('0x1f')](handleEntityNotFound(_0x550b39,null))['then'](respondWithResult(_0x550b39,null))[_0x03d9('0x2a')](handleError(_0x550b39,null));};exports[_0x03d9('0x5c')]=function(_0x463498,_0x57cd4a){return db['FaxAccount']['create'](_0x463498['body'],{})[_0x03d9('0x1f')](function(_0x56f04b){var _0x1c20e2=_0x463498[_0x03d9('0x5d')][_0x03d9('0x3a')]({'plain':!![]});if(!_0x1c20e2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c20e2[_0x03d9('0x5e')]===_0x03d9('0x5d')){var _0x21f99a=_0x56f04b['get']({'plain':!![]});var _0x22272a=_0x03d9('0x5f');return db['UserProfileSection'][_0x03d9('0x5b')]({'where':{'name':_0x22272a,'userProfileId':_0x1c20e2['userProfileId']},'raw':!![]})[_0x03d9('0x1f')](function(_0x482e36){if(_0x482e36&&_0x482e36[_0x03d9('0x60')]===0x0){return db[_0x03d9('0x3b')][_0x03d9('0x5c')]({'name':_0x21f99a[_0x03d9('0x52')],'resourceId':_0x21f99a['id'],'type':_0x482e36[_0x03d9('0x52')],'sectionId':_0x482e36['id']},{})[_0x03d9('0x1f')](function(){return _0x56f04b;});}else{return _0x56f04b;}})['catch'](function(_0x530dd7){logger['error'](_0x03d9('0x61'),_0x530dd7);throw _0x530dd7;});}return _0x56f04b;})['then'](respondWithResult(_0x57cd4a,0xc9))[_0x03d9('0x2a')](handleError(_0x57cd4a,null));};exports[_0x03d9('0x38')]=function(_0x18cdbb,_0x5a7e33){if(_0x18cdbb[_0x03d9('0x62')]['id']){delete _0x18cdbb['body']['id'];}return db[_0x03d9('0x3e')]['find']({'where':{'id':_0x18cdbb[_0x03d9('0x63')]['id']},'include':[{'model':db[_0x03d9('0x58')],'as':_0x03d9('0x59')}]})['then'](handleEntityNotFound(_0x5a7e33,null))[_0x03d9('0x1f')](saveUpdates(_0x18cdbb[_0x03d9('0x62')],null))[_0x03d9('0x1f')](respondWithResult(_0x5a7e33,null))[_0x03d9('0x2a')](handleError(_0x5a7e33,null));};exports[_0x03d9('0x39')]=function(_0x318191,_0x7bdc61){return db[_0x03d9('0x3e')][_0x03d9('0x5b')]({'where':{'id':_0x318191[_0x03d9('0x63')]['id']}})[_0x03d9('0x1f')](handleEntityNotFound(_0x7bdc61,null))[_0x03d9('0x1f')](removeEntity(_0x7bdc61,null))[_0x03d9('0x2a')](handleError(_0x7bdc61,null));};exports[_0x03d9('0x64')]=function(_0x39e328,_0x19ad24){return db[_0x03d9('0x3e')][_0x03d9('0x64')]()[_0x03d9('0x1f')](respondWithResult(_0x19ad24,null))[_0x03d9('0x2a')](handleError(_0x19ad24,null));};exports[_0x03d9('0x65')]=function(_0x1ee80d,_0x45b88c,_0x2b4bba){if(_0x1ee80d[_0x03d9('0x62')]['id']){delete _0x1ee80d[_0x03d9('0x62')]['id'];}return db[_0x03d9('0x3e')]['find']({'where':{'id':_0x1ee80d[_0x03d9('0x63')]['id']}})[_0x03d9('0x1f')](handleEntityNotFound(_0x45b88c,null))[_0x03d9('0x1f')](function(_0x33e5d1){if(_0x33e5d1){_0x1ee80d['body'][_0x03d9('0x66')]=_0x33e5d1['id'];return db[_0x03d9('0x67')][_0x03d9('0x5c')](_0x1ee80d['body']);}})[_0x03d9('0x1f')](respondWithResult(_0x45b88c,null))[_0x03d9('0x2a')](handleError(_0x45b88c,null));};exports['getDispositions']=function(_0x4070b8,_0x4f6d1c,_0xbc8fd5){var _0x29b3f4={'raw':![],'where':{}};var _0x2079d5={};var _0x10f29a={'count':0x0,'rows':[]};return db['FaxAccount'][_0x03d9('0x68')]({'where':{'id':_0x4070b8['params']['id']}})[_0x03d9('0x1f')](handleEntityNotFound(_0x4f6d1c,null))['then'](function(_0x88176e){if(_0x88176e){_0x2079d5['model']=_['keys'](db['Disposition'][_0x03d9('0x3f')]);_0x2079d5[_0x03d9('0x45')]=_['keys'](_0x4070b8[_0x03d9('0x45')]);_0x2079d5[_0x03d9('0x46')]=_[_0x03d9('0x47')](_0x2079d5['model'],_0x2079d5['query']);_0x29b3f4[_0x03d9('0x4a')]=_[_0x03d9('0x47')](_0x2079d5[_0x03d9('0x48')],qs[_0x03d9('0x49')](_0x4070b8[_0x03d9('0x45')][_0x03d9('0x49')]));_0x29b3f4[_0x03d9('0x4a')]=_0x29b3f4['attributes'][_0x03d9('0x69')]?_0x29b3f4[_0x03d9('0x4a')]:_0x2079d5[_0x03d9('0x48')];if(!_0x4070b8[_0x03d9('0x45')][_0x03d9('0x6a')](_0x03d9('0x6b'))){_0x29b3f4[_0x03d9('0x30')]=qs[_0x03d9('0x30')](_0x4070b8[_0x03d9('0x45')][_0x03d9('0x30')]);_0x29b3f4['offset']=qs[_0x03d9('0x32')](_0x4070b8[_0x03d9('0x45')][_0x03d9('0x32')]);}_0x29b3f4['order']=qs[_0x03d9('0x4c')](_0x4070b8[_0x03d9('0x45')]['sort']);_0x29b3f4['where']=qs[_0x03d9('0x46')](_[_0x03d9('0x4d')](_0x4070b8[_0x03d9('0x45')],_0x2079d5[_0x03d9('0x46')]));_0x29b3f4[_0x03d9('0x4f')][_0x03d9('0x66')]=_0x88176e['id'];if(_0x4070b8[_0x03d9('0x45')][_0x03d9('0x4e')]){_0x29b3f4['where']=_[_0x03d9('0x50')](_0x29b3f4[_0x03d9('0x4f')],{'$or':_[_0x03d9('0x43')](_0x29b3f4[_0x03d9('0x4a')],function(_0x373620){var _0xbebc52={};_0xbebc52[_0x373620]={'$like':'%'+_0x4070b8[_0x03d9('0x45')][_0x03d9('0x4e')]+'%'};return _0xbebc52;})});}_0x29b3f4=_[_0x03d9('0x50')]({},_0x29b3f4,_0x4070b8['options']);return db['Disposition'][_0x03d9('0x31')]({'where':_0x29b3f4[_0x03d9('0x4f')]})['then'](function(_0x569186){_0x10f29a['count']=_0x569186;if(_0x4070b8[_0x03d9('0x45')]['includeAll']){_0x29b3f4['include']=[{'all':!![]}];}return db['Disposition'][_0x03d9('0x55')](_0x29b3f4);})[_0x03d9('0x1f')](function(_0x3e4cdc){_0x10f29a[_0x03d9('0x56')]=_0x3e4cdc;return _0x10f29a;});}})[_0x03d9('0x1f')](respondWithFilteredResult(_0x4f6d1c,_0x29b3f4))['catch'](handleError(_0x4f6d1c,null));};exports[_0x03d9('0x6c')]=function(_0xacaf27,_0x1f5713,_0x39eb10){return db[_0x03d9('0x3e')][_0x03d9('0x5b')]({'where':{'id':_0xacaf27['params']['id']}})[_0x03d9('0x1f')](handleEntityNotFound(_0x1f5713,null))[_0x03d9('0x1f')](function(_0x18ef6f){if(_0x18ef6f){return _0x18ef6f[_0x03d9('0x6c')](_0xacaf27[_0x03d9('0x45')][_0x03d9('0x6d')]);}})['then'](respondWithStatusCode(_0x1f5713,null))[_0x03d9('0x2a')](handleError(_0x1f5713,null));};exports['addAnswer']=function(_0x586217,_0x505b39,_0x4e9efe){if(_0x586217[_0x03d9('0x62')]['id']){delete _0x586217[_0x03d9('0x62')]['id'];}return db[_0x03d9('0x3e')][_0x03d9('0x5b')]({'where':{'id':_0x586217[_0x03d9('0x63')]['id']}})[_0x03d9('0x1f')](handleEntityNotFound(_0x505b39,null))[_0x03d9('0x1f')](function(_0x323c8f){if(_0x323c8f){_0x586217['body'][_0x03d9('0x66')]=_0x323c8f['id'];return db[_0x03d9('0x6e')]['create'](_0x586217[_0x03d9('0x62')]);}})['then'](respondWithResult(_0x505b39,null))[_0x03d9('0x2a')](handleError(_0x505b39,null));};exports[_0x03d9('0x6f')]=function(_0x45fcc2,_0x3cae90,_0x3e5901){var _0x353e34={'raw':![],'where':{}};var _0x5cebdb={};var _0x100954={'count':0x0,'rows':[]};return db[_0x03d9('0x3e')][_0x03d9('0x68')]({'where':{'id':_0x45fcc2[_0x03d9('0x63')]['id']}})[_0x03d9('0x1f')](handleEntityNotFound(_0x3cae90,null))[_0x03d9('0x1f')](function(_0x5f3f4b){if(_0x5f3f4b){_0x5cebdb[_0x03d9('0x48')]=_[_0x03d9('0x44')](db[_0x03d9('0x6e')]['rawAttributes']);_0x5cebdb['query']=_[_0x03d9('0x44')](_0x45fcc2[_0x03d9('0x45')]);_0x5cebdb[_0x03d9('0x46')]=_[_0x03d9('0x47')](_0x5cebdb[_0x03d9('0x48')],_0x5cebdb['query']);_0x353e34['attributes']=_[_0x03d9('0x47')](_0x5cebdb[_0x03d9('0x48')],qs[_0x03d9('0x49')](_0x45fcc2[_0x03d9('0x45')][_0x03d9('0x49')]));_0x353e34[_0x03d9('0x4a')]=_0x353e34[_0x03d9('0x4a')][_0x03d9('0x69')]?_0x353e34[_0x03d9('0x4a')]:_0x5cebdb[_0x03d9('0x48')];if(!_0x45fcc2[_0x03d9('0x45')][_0x03d9('0x6a')]('nolimit')){_0x353e34[_0x03d9('0x30')]=qs[_0x03d9('0x30')](_0x45fcc2[_0x03d9('0x45')][_0x03d9('0x30')]);_0x353e34[_0x03d9('0x32')]=qs[_0x03d9('0x32')](_0x45fcc2[_0x03d9('0x45')][_0x03d9('0x32')]);}_0x353e34[_0x03d9('0x4b')]=qs['sort'](_0x45fcc2[_0x03d9('0x45')]['sort']);_0x353e34[_0x03d9('0x4f')]=qs[_0x03d9('0x46')](_[_0x03d9('0x4d')](_0x45fcc2[_0x03d9('0x45')],_0x5cebdb[_0x03d9('0x46')]));_0x353e34[_0x03d9('0x4f')]['FaxAccountId']=_0x5f3f4b['id'];if(_0x45fcc2[_0x03d9('0x45')][_0x03d9('0x4e')]){_0x353e34[_0x03d9('0x4f')]=_[_0x03d9('0x50')](_0x353e34['where'],{'$or':_[_0x03d9('0x43')](_0x353e34['attributes'],function(_0x4e4d2f){var _0x13e1af={};_0x13e1af[_0x4e4d2f]={'$like':'%'+_0x45fcc2[_0x03d9('0x45')][_0x03d9('0x4e')]+'%'};return _0x13e1af;})});}_0x353e34=_[_0x03d9('0x50')]({},_0x353e34,_0x45fcc2[_0x03d9('0x53')]);return db[_0x03d9('0x6e')][_0x03d9('0x31')]({'where':_0x353e34[_0x03d9('0x4f')]})[_0x03d9('0x1f')](function(_0x5555a0){_0x100954[_0x03d9('0x31')]=_0x5555a0;if(_0x45fcc2[_0x03d9('0x45')][_0x03d9('0x54')]){_0x353e34['include']=[{'all':!![]}];}return db[_0x03d9('0x6e')][_0x03d9('0x55')](_0x353e34);})['then'](function(_0x68ea06){_0x100954[_0x03d9('0x56')]=_0x68ea06;return _0x100954;});}})['then'](respondWithFilteredResult(_0x3cae90,_0x353e34))[_0x03d9('0x2a')](handleError(_0x3cae90,null));};exports[_0x03d9('0x70')]=function(_0x317610,_0x2c1735,_0x350632){return db['FaxAccount']['find']({'where':{'id':_0x317610[_0x03d9('0x63')]['id']}})[_0x03d9('0x1f')](handleEntityNotFound(_0x2c1735,null))[_0x03d9('0x1f')](function(_0x3a1dee){if(_0x3a1dee){return _0x3a1dee[_0x03d9('0x70')](_0x317610[_0x03d9('0x45')][_0x03d9('0x6d')]);}})[_0x03d9('0x1f')](respondWithStatusCode(_0x2c1735,null))[_0x03d9('0x2a')](handleError(_0x2c1735,null));};exports[_0x03d9('0x71')]=function(_0x2fbe60,_0x43d754,_0x4c9f82){return db['FaxInteraction'][_0x03d9('0x5b')]({'where':{'id':_0x2fbe60[_0x03d9('0x63')]['id']}})['then'](handleEntityNotFound(_0x43d754,null))['then'](function(_0x4c3b8d){if(_0x4c3b8d){return _0x4c3b8d[_0x03d9('0x71')](_0x2fbe60[_0x03d9('0x62')][_0x03d9('0x6d')],_[_0x03d9('0x72')](_0x2fbe60['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x43d754,null))[_0x03d9('0x2a')](handleError(_0x43d754,null));};exports[_0x03d9('0x73')]=function(_0x90327d,_0x4eb6a5,_0x106509){var _0x5a5a46={'raw':![],'where':{}};var _0x4fb93a={};var _0x487b61={'count':0x0,'rows':[]};return db[_0x03d9('0x3e')]['findOne']({'where':{'id':_0x90327d[_0x03d9('0x63')]['id']}})[_0x03d9('0x1f')](handleEntityNotFound(_0x4eb6a5,null))[_0x03d9('0x1f')](function(_0x485041){if(_0x485041){_0x4fb93a[_0x03d9('0x48')]=_[_0x03d9('0x44')](db['FaxInteraction'][_0x03d9('0x3f')]);_0x4fb93a[_0x03d9('0x45')]=_[_0x03d9('0x44')](_0x90327d[_0x03d9('0x45')]);_0x4fb93a[_0x03d9('0x46')]=_[_0x03d9('0x47')](_0x4fb93a[_0x03d9('0x48')],_0x4fb93a['query']);_0x5a5a46['attributes']=_[_0x03d9('0x47')](_0x4fb93a['model'],qs[_0x03d9('0x49')](_0x90327d[_0x03d9('0x45')]['fields']));_0x5a5a46['attributes']=_0x5a5a46[_0x03d9('0x4a')]['length']?_0x5a5a46[_0x03d9('0x4a')]:_0x4fb93a[_0x03d9('0x48')];if(!_0x90327d[_0x03d9('0x45')][_0x03d9('0x6a')]('nolimit')){_0x5a5a46[_0x03d9('0x30')]=qs[_0x03d9('0x30')](_0x90327d[_0x03d9('0x45')][_0x03d9('0x30')]);_0x5a5a46['offset']=qs[_0x03d9('0x32')](_0x90327d[_0x03d9('0x45')][_0x03d9('0x32')]);}_0x5a5a46[_0x03d9('0x4b')]=qs[_0x03d9('0x4c')](_0x90327d['query'][_0x03d9('0x4c')]);_0x5a5a46[_0x03d9('0x4f')]=qs[_0x03d9('0x46')](_[_0x03d9('0x4d')](_0x90327d[_0x03d9('0x45')],_0x4fb93a['filters']));_0x5a5a46['where']['FaxAccountId']=_0x485041['id'];if(_0x90327d['query'][_0x03d9('0x4e')]){_0x5a5a46[_0x03d9('0x4f')]=_['merge'](_0x5a5a46['where'],{'$or':_[_0x03d9('0x43')](_0x5a5a46[_0x03d9('0x4a')],function(_0x52f688){var _0x3168b7={};_0x3168b7[_0x52f688]={'$like':'%'+_0x90327d[_0x03d9('0x45')][_0x03d9('0x4e')]+'%'};return _0x3168b7;})});}_0x5a5a46=_[_0x03d9('0x50')]({},_0x5a5a46,_0x90327d[_0x03d9('0x53')]);return db[_0x03d9('0x74')][_0x03d9('0x31')]({'where':_0x5a5a46[_0x03d9('0x4f')]})[_0x03d9('0x1f')](function(_0x131d5d){_0x487b61[_0x03d9('0x31')]=_0x131d5d;if(_0x90327d[_0x03d9('0x45')][_0x03d9('0x54')]){_0x5a5a46[_0x03d9('0x5a')]=[{'model':db[_0x03d9('0x75')],'as':'Contact','required':![]},{'model':db[_0x03d9('0x76')],'as':_0x03d9('0x77'),'attributes':[_0x03d9('0x52'),_0x03d9('0x78'),_0x03d9('0x79')],'required':![]},{'model':db['Tag'],'as':_0x03d9('0x7a'),'attributes':['id','name',_0x03d9('0x7b')],'where':_0x90327d['query']['tag']?{'id':_0x90327d[_0x03d9('0x45')][_0x03d9('0x7c')]}:undefined,'required':_0x90327d[_0x03d9('0x45')][_0x03d9('0x7c')]?!![]:![]}];}return db['FaxInteraction']['findAll'](_0x5a5a46);})[_0x03d9('0x1f')](function(_0x1d21ee){_0x487b61['rows']=_0x1d21ee;return _0x487b61;});}})[_0x03d9('0x1f')](respondWithFilteredResult(_0x4eb6a5,_0x5a5a46))[_0x03d9('0x2a')](handleError(_0x4eb6a5,null));};exports[_0x03d9('0x7d')]=function(_0x2ec672,_0x2c1ea0){var _0x3f3d42=_0x2ec672[_0x03d9('0x63')]['id'];var _0x285784=_0x2ec672['body'];var _0x140ddb=0xc8;var _0x295631=null;return db[_0x03d9('0x7e')][_0x03d9('0x7f')]({'isolationLevel':db['sequelize'][_0x03d9('0x80')][_0x03d9('0x81')][_0x03d9('0x82')]},function(_0x290f89){return db['FaxAccount'][_0x03d9('0x68')]({'where':{'id':_0x3f3d42},'transaction':_0x290f89})[_0x03d9('0x1f')](function(_0x25a725){if(_0x25a725){return db[_0x03d9('0x83')]['destroy']({'where':{'FaxAccountId':_0x3f3d42},'transaction':_0x290f89})[_0x03d9('0x1f')](function(){var _0x4d4276=_[_0x03d9('0x43')](_0x285784,function(_0x2b5b70){_0x2b5b70[_0x03d9('0x66')]=_0x3f3d42;return _0x2b5b70;});return db[_0x03d9('0x83')][_0x03d9('0x84')](_0x4d4276,{'transaction':_0x290f89});});}else{_0x140ddb=0x194;_0x295631=[];}});})[_0x03d9('0x1f')](function(){if(_0x140ddb!==0x194){return db[_0x03d9('0x83')][_0x03d9('0x85')]({'where':{'FaxAccountId':_0x3f3d42},'order':_0x03d9('0x86')})['then'](function(_0x3a42c5){_0x295631=_0x3a42c5;});}})[_0x03d9('0x2a')](function(_0x3e0d9f){_0x140ddb=0x1f4;logger['error'](_0x3e0d9f[_0x03d9('0x87')]);if(_0x3e0d9f['name']){delete _0x3e0d9f[_0x03d9('0x52')];}_0x295631=_0x3e0d9f;})[_0x03d9('0x88')](function(){if(_0x295631===null){_0x2c1ea0[_0x03d9('0x2b')](_0x140ddb);}else{if(_0x140ddb===0x1f4){_0x2c1ea0[_0x03d9('0x2c')](_0x140ddb)[_0x03d9('0x3c')](_0x295631);}else{_0x2c1ea0[_0x03d9('0x2c')](_0x140ddb)[_0x03d9('0x2e')](_0x295631);}}});};exports[_0x03d9('0x89')]=function(_0x2db705,_0x318c3d,_0x20e1b5){var _0x2c77aa={};var _0x2b31a5={};var _0x59def3;var _0x155fc3;return db[_0x03d9('0x3e')][_0x03d9('0x68')]({'where':{'id':_0x2db705['params']['id']}})['then'](handleEntityNotFound(_0x318c3d,null))['then'](function(_0x390273){if(_0x390273){_0x59def3=_0x390273;_0x2b31a5[_0x03d9('0x48')]=_['keys'](db[_0x03d9('0x83')][_0x03d9('0x3f')]);_0x2b31a5[_0x03d9('0x45')]=_[_0x03d9('0x44')](_0x2db705['query']);_0x2b31a5[_0x03d9('0x46')]=_[_0x03d9('0x47')](_0x2b31a5[_0x03d9('0x48')],_0x2b31a5['query']);_0x2c77aa['attributes']=_[_0x03d9('0x47')](_0x2b31a5[_0x03d9('0x48')],qs[_0x03d9('0x49')](_0x2db705['query'][_0x03d9('0x49')]));_0x2c77aa['attributes']=_0x2c77aa[_0x03d9('0x4a')][_0x03d9('0x69')]?_0x2c77aa['attributes']:_0x2b31a5['model'];_0x2c77aa['order']=qs[_0x03d9('0x4c')](_0x2db705[_0x03d9('0x45')][_0x03d9('0x4c')]);_0x2c77aa[_0x03d9('0x4f')]=qs[_0x03d9('0x46')](_[_0x03d9('0x4d')](_0x2db705[_0x03d9('0x45')],_0x2b31a5['filters']));if(_0x2db705[_0x03d9('0x45')][_0x03d9('0x4e')]){_0x2c77aa[_0x03d9('0x4f')]=_['merge'](_0x2c77aa[_0x03d9('0x4f')],{'$or':_[_0x03d9('0x43')](_0x2c77aa[_0x03d9('0x4a')],function(_0x175330){var _0xd988aa={};_0xd988aa[_0x175330]={'$like':'%'+_0x2db705['query']['filter']+'%'};return _0xd988aa;})});}_0x2c77aa=_[_0x03d9('0x50')]({},_0x2c77aa,_0x2db705[_0x03d9('0x53')]);return _0x59def3[_0x03d9('0x89')](_0x2c77aa);}})[_0x03d9('0x1f')](function(_0x79687d){if(_0x79687d){_0x155fc3=_0x79687d[_0x03d9('0x69')];if(!_0x2db705[_0x03d9('0x45')]['hasOwnProperty'](_0x03d9('0x6b'))){_0x2c77aa[_0x03d9('0x30')]=qs[_0x03d9('0x30')](_0x2db705[_0x03d9('0x45')][_0x03d9('0x30')]);_0x2c77aa[_0x03d9('0x32')]=qs['offset'](_0x2db705[_0x03d9('0x45')][_0x03d9('0x32')]);}return _0x59def3['getApplications'](_0x2c77aa);}})['then'](function(_0x4e9e1a){if(_0x4e9e1a){return _0x4e9e1a?{'count':_0x155fc3,'rows':_0x4e9e1a}:null;}})[_0x03d9('0x1f')](respondWithResult(_0x318c3d,null))['catch'](handleError(_0x318c3d,null));};function Extension(_0x4a9eec,_0x5907cd,_0xefe17f,_0x4cad11){this[_0x03d9('0x8a')]=_0x03d9('0x8b');this['exten']=_0x4a9eec[_0x03d9('0x8c')];this['app']=_0x4cad11;this[_0x03d9('0x41')]=_0x03d9('0x8d');this[_0x03d9('0x8e')]=_0x03d9('0x8f');this[_0x03d9('0x66')]=_0x4a9eec['id'];this[_0x03d9('0x86')]=_0x5907cd;this[_0x03d9('0x90')]=_0xefe17f;}function createExtensionsReciveFax(_0x18cb2e){var _0x33eeac=0x1;var _0x594a0b=[];_0x594a0b[_0x03d9('0x91')](new Extension(_0x18cb2e,_0x33eeac,'',_0x03d9('0x92')));_0x33eeac+=0x1;_0x594a0b[_0x03d9('0x91')](new Extension(_0x18cb2e,_0x33eeac,_0x03d9('0x93'),_0x03d9('0x94')));_0x33eeac+=0x1;for(var _0xf11304 in _0x18cb2e){if(_0x18cb2e[_0x03d9('0x6a')](_0xf11304)&&(_0xf11304==='ecm'||_0xf11304===_0x03d9('0x8c')||_0xf11304==='gateway'||_0xf11304===_0x03d9('0x95')||_0xf11304===_0x03d9('0x96')||_0xf11304===_0x03d9('0x97')||_0xf11304===_0x03d9('0x98')||_0xf11304===_0x03d9('0x99')||_0xf11304===_0x03d9('0x9a'))){_0x594a0b[_0x03d9('0x91')](new Extension(_0x18cb2e,_0x33eeac,_0x03d9('0x9b')+_0xf11304+')='+_0x18cb2e[_0xf11304],'Set'));_0x33eeac+=0x1;}}_0x594a0b[_0x03d9('0x91')](new Extension(_0x18cb2e,_0x33eeac,'6',_0x03d9('0x9c')));_0x33eeac+=0x1;_0x594a0b[_0x03d9('0x91')](new Extension(_0x18cb2e,_0x33eeac,_0x03d9('0x9d'),'ReceiveFax'));_0x33eeac=0x0;return _0x594a0b;}exports['addAccountApplications']=function(_0x319f84,_0x29eb3a,_0x2860c3){var _0x183fc5;return db[_0x03d9('0x7e')][_0x03d9('0x7f')](function(_0x51f8d9){return db[_0x03d9('0x3e')]['create'](_0x319f84[_0x03d9('0x62')],{'transaction':_0x51f8d9})[_0x03d9('0x1f')](function(_0x589930){_0x183fc5=_0x589930[_0x03d9('0x3a')]({'plain':!![]});return db[_0x03d9('0x9e')][_0x03d9('0x84')](createExtensionsReciveFax(_0x183fc5),{'transaction':_0x51f8d9});});})[_0x03d9('0x1f')](function(){return _0x183fc5;})[_0x03d9('0x1f')](respondWithResult(_0x29eb3a,null))['catch'](handleError(_0x29eb3a,null));};exports[_0x03d9('0x9f')]=function(_0x1fa161,_0x313ff4,_0x2fdf16){var _0x59f1ef;return db[_0x03d9('0x7e')][_0x03d9('0x7f')](function(_0x119c14){return db[_0x03d9('0x3e')][_0x03d9('0x38')](_0x1fa161[_0x03d9('0x62')],{'where':{'id':_0x1fa161[_0x03d9('0x62')]['id']},'transaction':_0x119c14})['then'](function(_0x4ede97){return db[_0x03d9('0x9e')][_0x03d9('0x39')]({'where':{'FaxAccountId':_0x1fa161[_0x03d9('0x62')]['id']},'transaction':_0x119c14})[_0x03d9('0x1f')](function(_0x189b1e){return db[_0x03d9('0x9e')]['bulkCreate'](createExtensionsReciveFax(_[_0x03d9('0x72')](_0x1fa161[_0x03d9('0x62')],['tech',_0x03d9('0x42'),_0x03d9('0xa0'),_0x03d9('0xa1'),_0x03d9('0xa2'),_0x03d9('0xa3')])),{'transaction':_0x119c14});});});})['then'](function(){return db[_0x03d9('0x3e')][_0x03d9('0xa4')](_0x1fa161[_0x03d9('0x62')]['id']);})[_0x03d9('0x1f')](respondWithResult(_0x313ff4,null))['catch'](handleError(_0x313ff4,null));};exports[_0x03d9('0xa5')]=function(_0x573c8b,_0x17ca0a,_0x34285b){var _0x1fd6f1={'raw':!![],'where':{}};var _0xd652f0={};var _0x281a9e={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x573c8b[_0x03d9('0x63')]['id']}})['then'](handleEntityNotFound(_0x17ca0a,null))[_0x03d9('0x1f')](function(_0x4eca4b){if(_0x4eca4b){_0xd652f0[_0x03d9('0x48')]=_[_0x03d9('0x44')](db[_0x03d9('0xa6')][_0x03d9('0x3f')]);_0xd652f0[_0x03d9('0x45')]=_[_0x03d9('0x44')](_0x573c8b['query']);_0xd652f0[_0x03d9('0x46')]=_['intersection'](_0xd652f0[_0x03d9('0x48')],_0xd652f0[_0x03d9('0x45')]);_0x1fd6f1[_0x03d9('0x4a')]=_['intersection'](_0xd652f0[_0x03d9('0x48')],qs[_0x03d9('0x49')](_0x573c8b[_0x03d9('0x45')][_0x03d9('0x49')]));_0x1fd6f1[_0x03d9('0x4a')]=_0x1fd6f1['attributes'][_0x03d9('0x69')]?_0x1fd6f1[_0x03d9('0x4a')]:_0xd652f0[_0x03d9('0x48')];if(!_0x573c8b[_0x03d9('0x45')][_0x03d9('0x6a')](_0x03d9('0x6b'))){_0x1fd6f1[_0x03d9('0x30')]=qs[_0x03d9('0x30')](_0x573c8b[_0x03d9('0x45')][_0x03d9('0x30')]);_0x1fd6f1['offset']=qs[_0x03d9('0x32')](_0x573c8b[_0x03d9('0x45')]['offset']);}_0x1fd6f1[_0x03d9('0x4b')]=qs[_0x03d9('0x4c')](_0x573c8b[_0x03d9('0x45')][_0x03d9('0x4c')]);_0x1fd6f1[_0x03d9('0x4f')]=qs[_0x03d9('0x46')](_[_0x03d9('0x4d')](_0x573c8b['query'],_0xd652f0[_0x03d9('0x46')]));_0x1fd6f1[_0x03d9('0x4f')][_0x03d9('0x66')]=_0x4eca4b['id'];if(_0x573c8b[_0x03d9('0x45')][_0x03d9('0x4e')]){_0x1fd6f1[_0x03d9('0x4f')]=_[_0x03d9('0x50')](_0x1fd6f1['where'],{'$or':_[_0x03d9('0x43')](_0x1fd6f1[_0x03d9('0x4a')],function(_0x3b3d43){var _0x2a7a3d={};_0x2a7a3d[_0x3b3d43]={'$like':'%'+_0x573c8b['query'][_0x03d9('0x4e')]+'%'};return _0x2a7a3d;})});}if(_0x573c8b[_0x03d9('0x45')][_0x03d9('0xa7')]){var _0x84c3f=_0x573c8b[_0x03d9('0x45')][_0x03d9('0xa7')][_0x03d9('0xa8')](',');var _0x4283f0={};_0x4283f0[_0x84c3f[0x0]]={'$gte':moment(_0x84c3f[0x1])[_0x03d9('0xa9')](_0x03d9('0xaa'))};_0x1fd6f1[_0x03d9('0x4f')]=_['merge'](_0x1fd6f1['where'],_0x4283f0);}_0x1fd6f1=_[_0x03d9('0x50')]({},_0x1fd6f1,_0x573c8b[_0x03d9('0x53')]);return db[_0x03d9('0xa6')]['count']({'where':_0x1fd6f1[_0x03d9('0x4f')]})[_0x03d9('0x1f')](function(_0x5f0713){_0x281a9e['count']=_0x5f0713;if(_0x573c8b[_0x03d9('0x45')][_0x03d9('0x54')]){_0x1fd6f1[_0x03d9('0x5a')]=[{'all':!![]}];}return db[_0x03d9('0xa6')][_0x03d9('0x55')](_0x1fd6f1);})[_0x03d9('0x1f')](function(_0x3d2afe){_0x281a9e['rows']=_0x3d2afe;return _0x281a9e;});}})[_0x03d9('0x1f')](respondWithFilteredResult(_0x17ca0a,_0x1fd6f1))[_0x03d9('0x2a')](handleError(_0x17ca0a,null));};exports[_0x03d9('0x3c')]=function(_0x19f498,_0x5987cf,_0x3d0938){var _0x3ea751,_0x6ad030={},_0x4392bc;if(_0x19f498[_0x03d9('0x62')]['to']){_0x4392bc=_0x19f498[_0x03d9('0x62')]['to'][0x0];}return db[_0x03d9('0x3e')][_0x03d9('0x5b')]({'where':{'id':_0x19f498[_0x03d9('0x63')]['id']},'include':[{'model':db['CmList'],'as':_0x03d9('0xab'),'include':[{'model':db[_0x03d9('0x75')],'as':'Contacts','where':{'fax':_0x4392bc},'limit':0x1,'order':[[_0x03d9('0xa1'),_0x03d9('0xac')]]}]}]})['then'](handleEntityNotFound(_0x5987cf,null))[_0x03d9('0x1f')](function(_0x381650){_0x3ea751=_0x381650;if(_0x19f498[_0x03d9('0x62')][_0x03d9('0xad')]&&_0x19f498[_0x03d9('0x62')]['attachments'][_0x03d9('0x69')]){for(var _0x20da7a=0x0;_0x20da7a<_0x19f498[_0x03d9('0x62')][_0x03d9('0xad')]['length'];_0x20da7a+=0x1){_0x19f498[_0x03d9('0x62')][_0x03d9('0xad')][_0x20da7a]={'filename':_0x19f498[_0x03d9('0x62')][_0x03d9('0xad')][_0x20da7a]['name'],'id':_0x19f498[_0x03d9('0x62')][_0x03d9('0xad')][_0x20da7a]['id'],'path':path[_0x03d9('0xae')](config[_0x03d9('0xaf')],_0x03d9('0xb0'),_0x19f498[_0x03d9('0x62')][_0x03d9('0xad')][_0x20da7a][_0x03d9('0xb1')])};}}return respondWithRpcPromise(_0x03d9('0xb2'),'CheckAfterSend',{'FaxAccountId':_['isNil'](_0x19f498['params']['id'])?undefined:_0x19f498[_0x03d9('0x63')]['id'],'path':_['isNil'](_0x19f498[_0x03d9('0x62')][_0x03d9('0xad')][0x0][_0x03d9('0x6')])?undefined:_0x19f498[_0x03d9('0x62')][_0x03d9('0xad')][0x0]['path'],'fax':_['isNil'](_0x19f498['body']['to'][0x0])?undefined:_0x19f498[_0x03d9('0x62')]['to'][0x0]},client9002);})[_0x03d9('0x1f')](function(){if(_0x3ea751){if(_['isNil'](_0x19f498['body'][_0x03d9('0xb3')])){_0x19f498[_0x03d9('0x62')][_0x03d9('0xb3')]=util[_0x03d9('0xa9')](_0x03d9('0xb4'),_0x3ea751[_0x03d9('0x52')],_0x3ea751['fax']);}if(_0x3ea751[_0x03d9('0xab')]){if(_0x3ea751[_0x03d9('0xab')][_0x03d9('0xb5')][_0x03d9('0x69')]){return _0x3ea751[_0x03d9('0xab')][_0x03d9('0xb5')][0x0];}else{return db[_0x03d9('0x75')][_0x03d9('0x5c')](_[_0x03d9('0xb6')](_0x19f498['body'],{'firstName':_0x19f498[_0x03d9('0x62')]['to'][0x0],'phone':_0x19f498[_0x03d9('0x62')]['to'][0x0],'fax':_0x19f498[_0x03d9('0x62')]['to'][0x0],'ListId':_0x3ea751[_0x03d9('0xa3')]}));}}else{throw new Error(_0x03d9('0xb7'));}}else{throw new Error(_0x03d9('0xb8'));}})[_0x03d9('0x1f')](function(_0x47d5ff){if(_0x47d5ff){return db['FaxInteraction'][_0x03d9('0x5b')]({'where':{'ContactId':_0x47d5ff['id'],'closed':![],'FaxAccountId':_0x3ea751['id']}})['then'](function(_0x5ef07b){if(_0x5ef07b){return[_0x5ef07b,![]];}return db[_0x03d9('0x74')][_0x03d9('0x5c')]({'UserId':_0x19f498[_0x03d9('0x5d')]['id'],'ContactId':_0x47d5ff['id'],'FaxAccountId':_0x3ea751['id'],'fax':_0x19f498[_0x03d9('0x62')]['to'][0x0],'firstMsgDirection':_0x03d9('0xb9'),'Messages':[_[_0x03d9('0x50')](_0x19f498[_0x03d9('0x62')],{'read':![],'body':_0x19f498['body'][_0x03d9('0xad')][0x0]['filename'],'FaxAccountId':_0x3ea751['id'],'UserId':_0x19f498[_0x03d9('0x5d')]['id'],'ContactId':_0x47d5ff['id'],'AttachmentId':_0x19f498[_0x03d9('0x62')]['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x03d9('0xba')}]})[_0x03d9('0x1f')](function(_0x34f804){return[_0x34f804,!![]];});});}else{throw new Error(_0x03d9('0xbb'));}})[_0x03d9('0xbc')](function(_0x1ba323,_0x59d90f){if(_0x59d90f){return _0x1ba323;}return db[_0x03d9('0xa6')][_0x03d9('0x5c')]({'direction':_0x03d9('0xb9'),'read':![],'body':_0x19f498[_0x03d9('0x62')][_0x03d9('0xad')][0x0]['filename'],'FaxAccountId':_0x3ea751['id'],'FaxInteractionId':_0x1ba323['id'],'UserId':_0x19f498[_0x03d9('0x5d')]['id'],'ContactId':_0x1ba323[_0x03d9('0xbd')],'AttachmentId':_0x19f498[_0x03d9('0x62')][_0x03d9('0xad')][0x0]['id']})[_0x03d9('0x1f')](function(_0x186a51){_0x1ba323[_0x03d9('0xbe')][_0x03d9('0xba')]=[];_0x1ba323['dataValues'][_0x03d9('0xba')][_0x03d9('0x91')](_0x186a51[_0x03d9('0xbe')]);return _0x1ba323;});})[_0x03d9('0x1f')](function(_0x297d12){respondWithRpcPromise(_0x03d9('0xbf'),_0x03d9('0xbf'),{'FaxAccountId':_[_0x03d9('0xc0')](_0x19f498[_0x03d9('0x63')]['id'])?undefined:_0x19f498[_0x03d9('0x63')]['id'],'path':_[_0x03d9('0xc0')](_0x19f498[_0x03d9('0x62')]['attachments'][0x0][_0x03d9('0x6')])?undefined:_0x19f498[_0x03d9('0x62')][_0x03d9('0xad')][0x0]['path'],'fax':_[_0x03d9('0xc0')](_0x19f498['body']['to'][0x0])?undefined:_0x19f498[_0x03d9('0x62')]['to'][0x0],'AttachmentId':_0x19f498['body']['attachments'][0x0]['id']},client9002)['then'](function(_0xcb2428){logger[_0x03d9('0x28')](_0x03d9('0xc1'),_0xcb2428);})[_0x03d9('0x2a')](function(_0x5cadad){logger[_0x03d9('0x28')](_0x03d9('0xc1'),_0x5cadad);});return _0x297d12;})[_0x03d9('0x1f')](respondWithResult(_0x5987cf,null))['catch'](handleError(_0x5987cf,null));};exports['addAgents']=function(_0x5bac79,_0x1b11b9,_0x596414){return db['FaxAccount'][_0x03d9('0x5b')]({'where':{'id':_0x5bac79[_0x03d9('0x63')]['id']}})[_0x03d9('0x1f')](handleEntityNotFound(_0x1b11b9,null))[_0x03d9('0x1f')](function(_0x5612e3){if(_0x5612e3){return _0x5612e3[_0x03d9('0xc2')](_0x5bac79['body']['ids'],_['omit'](_0x5bac79[_0x03d9('0x62')],[_0x03d9('0x6d'),'id'])||{})[_0x03d9('0xbc')](function(_0x43a36a){for(var _0x39ff63=0x0;_0x39ff63<_0x5bac79[_0x03d9('0x62')][_0x03d9('0x6d')]['length'];_0x39ff63+=0x1){socket[_0x03d9('0xc3')]('userFaxAccount:save',{'UserId':Number(_0x5bac79[_0x03d9('0x62')][_0x03d9('0x6d')][_0x39ff63]),'FaxAccountId':Number(_0x5bac79['params']['id'])});}return _0x43a36a;});}})[_0x03d9('0x1f')](respondWithResult(_0x1b11b9,null))[_0x03d9('0x2a')](handleError(_0x1b11b9,null));};exports[_0x03d9('0xc4')]=function(_0x277185,_0x46c9a9,_0xa8dc6c){return db[_0x03d9('0x3e')][_0x03d9('0x5b')]({'where':{'id':_0x277185[_0x03d9('0x63')]['id']}})[_0x03d9('0x1f')](handleEntityNotFound(_0x46c9a9,null))['then'](function(_0x4d5f45){if(_0x4d5f45){return _0x4d5f45[_0x03d9('0xc4')](_0x277185[_0x03d9('0x45')][_0x03d9('0x6d')])[_0x03d9('0x1f')](function(){if(_[_0x03d9('0xc5')](_0x277185[_0x03d9('0x45')]['ids'])){for(var _0x536eca=0x0;_0x536eca<_0x277185[_0x03d9('0x45')]['ids'][_0x03d9('0x69')];_0x536eca+=0x1){socket[_0x03d9('0xc3')](_0x03d9('0xc6'),{'UserId':Number(_0x277185['query'][_0x03d9('0x6d')][_0x536eca]),'FaxAccountId':Number(_0x277185[_0x03d9('0x63')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x277185['query'][_0x03d9('0x6d')]),'FaxAccountId':Number(_0x277185[_0x03d9('0x63')]['id'])});}});}})[_0x03d9('0x1f')](respondWithStatusCode(_0x46c9a9,null))['catch'](handleError(_0x46c9a9,null));};exports['getAgents']=function(_0x4959a2,_0x382cff,_0x434896){var _0xfe6d4c={};var _0x1b2cfb={};var _0x1da6e7;var _0x53ffc3;return db[_0x03d9('0x3e')][_0x03d9('0x68')]({'where':{'id':_0x4959a2[_0x03d9('0x63')]['id']}})['then'](handleEntityNotFound(_0x382cff,null))[_0x03d9('0x1f')](function(_0x238796){if(_0x238796){_0x1da6e7=_0x238796;_0x1b2cfb[_0x03d9('0x48')]=_['keys'](db[_0x03d9('0x76')][_0x03d9('0x3f')]);_0x1b2cfb[_0x03d9('0x45')]=_['keys'](_0x4959a2[_0x03d9('0x45')]);_0x1b2cfb['filters']=_[_0x03d9('0x47')](_0x1b2cfb[_0x03d9('0x48')],_0x1b2cfb[_0x03d9('0x45')]);_0xfe6d4c[_0x03d9('0x4a')]=_['intersection'](_0x1b2cfb[_0x03d9('0x48')],qs['fields'](_0x4959a2[_0x03d9('0x45')][_0x03d9('0x49')]));_0xfe6d4c['attributes']=_0xfe6d4c['attributes'][_0x03d9('0x69')]?_0xfe6d4c[_0x03d9('0x4a')]:_0x1b2cfb[_0x03d9('0x48')];_0xfe6d4c['order']=qs[_0x03d9('0x4c')](_0x4959a2[_0x03d9('0x45')][_0x03d9('0x4c')]);_0xfe6d4c[_0x03d9('0x4f')]=qs['filters'](_[_0x03d9('0x4d')](_0x4959a2[_0x03d9('0x45')],_0x1b2cfb[_0x03d9('0x46')]));if(_0x4959a2[_0x03d9('0x45')][_0x03d9('0x4e')]){_0xfe6d4c[_0x03d9('0x4f')]=_[_0x03d9('0x50')](_0xfe6d4c[_0x03d9('0x4f')],{'$or':_[_0x03d9('0x43')](_0xfe6d4c[_0x03d9('0x4a')],function(_0x5a08b9){var _0x5f2dc6={};_0x5f2dc6[_0x5a08b9]={'$like':'%'+_0x4959a2[_0x03d9('0x45')][_0x03d9('0x4e')]+'%'};return _0x5f2dc6;})});}_0xfe6d4c=_[_0x03d9('0x50')]({},_0xfe6d4c,_0x4959a2[_0x03d9('0x53')]);return _0x1da6e7['getAgents'](_0xfe6d4c);}})['then'](function(_0xf85902){if(_0xf85902){_0x53ffc3=_0xf85902[_0x03d9('0x69')];if(!_0x4959a2[_0x03d9('0x45')]['hasOwnProperty'](_0x03d9('0x6b'))){_0xfe6d4c['limit']=qs[_0x03d9('0x30')](_0x4959a2['query'][_0x03d9('0x30')]);_0xfe6d4c[_0x03d9('0x32')]=qs[_0x03d9('0x32')](_0x4959a2[_0x03d9('0x45')]['offset']);}return _0x1da6e7[_0x03d9('0xc7')](_0xfe6d4c);}})['then'](function(_0x2c350d){if(_0x2c350d){return _0x2c350d?{'count':_0x53ffc3,'rows':_0x2c350d}:null;}})['then'](respondWithResult(_0x382cff,null))['catch'](handleError(_0x382cff,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 9f8e0ac..95f05f1 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 _0x1784=['update','remove','emit','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x1784,0x14f));var _0x4178=function(_0x413f2a,_0x1006e4){_0x413f2a=_0x413f2a-0x0;var _0x1932ec=_0x1784[_0x413f2a];return _0x1932ec;};'use strict';var EventEmitter=require(_0x4178('0x0'));var FaxAccount=require(_0x4178('0x1'))['db'][_0x4178('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x4178('0x3')](0x0);var events={'afterCreate':_0x4178('0x4'),'afterUpdate':_0x4178('0x5'),'afterDestroy':_0x4178('0x6')};function emitEvent(_0x20a161){return function(_0x46cf0b,_0x2485d9,_0x537832){FaxAccountEvents['emit'](_0x20a161+':'+_0x46cf0b['id'],_0x46cf0b);FaxAccountEvents[_0x4178('0x7')](_0x20a161,_0x46cf0b);_0x537832(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x4178('0x8')](e,emitEvent(event));}}module[_0x4178('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0x1740=['update','emit','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save'];(function(_0x4f9f88,_0x42b799){var _0x490fb7=function(_0x540f88){while(--_0x540f88){_0x4f9f88['push'](_0x4f9f88['shift']());}};_0x490fb7(++_0x42b799);}(_0x1740,0x1c6));var _0x0174=function(_0x17a582,_0x21bfb1){_0x17a582=_0x17a582-0x0;var _0x3d5bd7=_0x1740[_0x17a582];return _0x3d5bd7;};'use strict';var EventEmitter=require(_0x0174('0x0'));var FaxAccount=require(_0x0174('0x1'))['db'][_0x0174('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x0174('0x3')](0x0);var events={'afterCreate':_0x0174('0x4'),'afterUpdate':_0x0174('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2a333f){return function(_0x235956,_0x4a702e,_0x5bda34){FaxAccountEvents[_0x0174('0x6')](_0x2a333f+':'+_0x235956['id'],_0x235956);FaxAccountEvents[_0x0174('0x6')](_0x2a333f,_0x235956);_0x5bda34(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x0174('0x7')](e,emitEvent(event));}}module[_0x0174('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 466e9af..4a26b37 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 _0x6a08=['FaxAccount','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./faxAccount.attributes','define'];(function(_0x3b56b5,_0x5096f0){var _0x2bd3b9=function(_0x287282){while(--_0x287282){_0x3b56b5['push'](_0x3b56b5['shift']());}};_0x2bd3b9(++_0x5096f0);}(_0x6a08,0xc9));var _0x86a0=function(_0xa3fadc,_0xd1e16){_0xa3fadc=_0xa3fadc-0x0;var _0x23ecb8=_0x6a08[_0xa3fadc];return _0x23ecb8;};'use strict';var _=require(_0x86a0('0x0'));var util=require('util');var logger=require(_0x86a0('0x1'))(_0x86a0('0x2'));var moment=require(_0x86a0('0x3'));var BPromise=require(_0x86a0('0x4'));var rp=require(_0x86a0('0x5'));var fs=require('fs');var path=require(_0x86a0('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x86a0('0x7'));module['exports']=function(_0x35d75f,_0x4bd74d){return _0x35d75f[_0x86a0('0x8')](_0x86a0('0x9'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc065=['fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxAccount.attributes','define','FaxAccount'];(function(_0x474c66,_0xbce925){var _0xcbd9bf=function(_0x44019d){while(--_0x44019d){_0x474c66['push'](_0x474c66['shift']());}};_0xcbd9bf(++_0xbce925);}(_0xc065,0x187));var _0x5c06=function(_0xd0d98d,_0x34a193){_0xd0d98d=_0xd0d98d-0x0;var _0x5373cd=_0xc065[_0xd0d98d];return _0x5373cd;};'use strict';var _=require(_0x5c06('0x0'));var util=require(_0x5c06('0x1'));var logger=require(_0x5c06('0x2'))(_0x5c06('0x3'));var moment=require(_0x5c06('0x4'));var BPromise=require(_0x5c06('0x5'));var rp=require(_0x5c06('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5c06('0x7'));var config=require(_0x5c06('0x8'));var attributes=require(_0x5c06('0x9'));module['exports']=function(_0x42f2a6,_0x142ff6){return _0x42f2a6[_0x5c06('0xa')](_0x5c06('0xb'),attributes,{'tableName':_0x5c06('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index fa35029..3a62a6b 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 _0x873d=['applications','orderBy','priority','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','Start','startRouting','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./faxAccount.socket','register','request','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','limit','include','model','map','then','catch','NotifyFaxAccount','fax','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','keys','CompanyId','ListId','body','from','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','Contacts','FaxApplication','Applications','List','get'];(function(_0x43ad33,_0x4d1bf4){var _0x52910c=function(_0x3d4925){while(--_0x3d4925){_0x43ad33['push'](_0x43ad33['shift']());}};_0x52910c(++_0x4d1bf4);}(_0x873d,0xda));var _0xd873=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x873d[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0xd873('0x0'));var util=require(_0xd873('0x1'));var moment=require(_0xd873('0x2'));var BPromise=require(_0xd873('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd873('0x4'));var db=require(_0xd873('0x5'))['db'];var utils=require(_0xd873('0x6'));var logger=require(_0xd873('0x7'))(_0xd873('0x8'));var config=require(_0xd873('0x9'));var jayson=require(_0xd873('0xa'));var client=jayson[_0xd873('0xb')][_0xd873('0xc')]({'port':0x232c});config['redis']=_[_0xd873('0xd')](config[_0xd873('0xe')],{'host':_0xd873('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd873('0x10'))[_0xd873('0x11')](socket);function respondWithRpcPromise(_0x3d43b3,_0xdfa1b0,_0x30580f){return new BPromise(function(_0x466372,_0x14ff53){return client[_0xd873('0x12')](_0x3d43b3,_0x30580f)['then'](function(_0x42ea9d){logger[_0xd873('0x13')]('FaxAccount,\x20%s,\x20%s',_0xdfa1b0,_0xd873('0x14'));logger[_0xd873('0x15')](_0xd873('0x16'),_0xdfa1b0,_0xd873('0x14'),JSON[_0xd873('0x17')](_0x42ea9d));if(_0x42ea9d[_0xd873('0x18')]){if(_0x42ea9d[_0xd873('0x18')][_0xd873('0x19')]===0x1f4){logger[_0xd873('0x18')]('FaxAccount,\x20%s,\x20%s',_0xdfa1b0,_0x42ea9d[_0xd873('0x18')]['message']);return _0x14ff53(_0x42ea9d[_0xd873('0x18')][_0xd873('0x1a')]);}logger[_0xd873('0x18')]('FaxAccount,\x20%s,\x20%s',_0xdfa1b0,_0x42ea9d[_0xd873('0x18')]['message']);return _0x466372(_0x42ea9d[_0xd873('0x18')]['message']);}else{logger[_0xd873('0x13')](_0xd873('0x1b'),_0xdfa1b0,_0xd873('0x14'));_0x466372(_0x42ea9d['result'][_0xd873('0x1a')]);}})['catch'](function(_0x1dbcd0){logger[_0xd873('0x18')](_0xd873('0x1b'),_0xdfa1b0,_0x1dbcd0);_0x14ff53(_0x1dbcd0);});});}exports[_0xd873('0x1c')]=function(_0x12b674){var _0x5ef356=this;return new Promise(function(_0x10a03b,_0x477937){return db[_0xd873('0x1d')][_0xd873('0x1e')]({'raw':_0x12b674[_0xd873('0x1f')]?_0x12b674[_0xd873('0x1f')][_0xd873('0x20')]===undefined?!![]:![]:!![],'where':_0x12b674[_0xd873('0x1f')]?_0x12b674[_0xd873('0x1f')]['where']||null:null,'attributes':_0x12b674[_0xd873('0x1f')]?_0x12b674[_0xd873('0x1f')][_0xd873('0x21')]||null:null,'limit':_0x12b674[_0xd873('0x1f')]?_0x12b674[_0xd873('0x1f')][_0xd873('0x22')]||null:null,'include':_0x12b674['options']?_0x12b674[_0xd873('0x1f')][_0xd873('0x23')]?_['map'](_0x12b674['options'][_0xd873('0x23')],function(_0x52252a){return{'model':db[_0x52252a[_0xd873('0x24')]],'as':_0x52252a['as'],'attributes':_0x52252a[_0xd873('0x21')],'include':_0x52252a[_0xd873('0x23')]?_[_0xd873('0x25')](_0x52252a[_0xd873('0x23')],function(_0x298c4a){return{'model':db[_0x298c4a[_0xd873('0x24')]],'as':_0x298c4a['as'],'attributes':_0x298c4a[_0xd873('0x21')],'include':_0x298c4a[_0xd873('0x23')]?_[_0xd873('0x25')](_0x298c4a[_0xd873('0x23')],function(_0x2a054c){return{'model':db[_0x2a054c['model']],'as':_0x2a054c['as'],'attributes':_0x2a054c['attributes']};}):[]};}):[]};}):[]:[]})[_0xd873('0x26')](function(_0x3d7314){logger[_0xd873('0x13')](_0xd873('0x1c'),_0x12b674);logger['debug'](_0xd873('0x1c'),_0x12b674,JSON[_0xd873('0x17')](_0x3d7314));_0x10a03b(_0x3d7314);})[_0xd873('0x27')](function(_0x3d4024){logger[_0xd873('0x18')]('GetFaxAccount',_0x3d4024[_0xd873('0x1a')],_0x12b674);_0x477937(_0x5ef356[_0xd873('0x18')](0x1f4,_0x3d4024[_0xd873('0x1a')]));});});};exports[_0xd873('0x28')]=function(_0x813bdf,_0x2f1ee0,_0x7ec6dd){var _0x37a936=this;return new Promise(function(_0x4206ca,_0x1bf842){var _0x3b2543={'body':_0x813bdf['body'],'channel':_0xd873('0x29')};var _0xef21a4=[];var _0x25cb62=[];var _0x35dc64={};return db[_0xd873('0x2a')][_0xd873('0x2b')]()[_0xd873('0x26')](function(_0x44bf1e){if(!_0x44bf1e){throw new db['Sequelize'][(_0xd873('0x2c'))](_0xd873('0x2d'));}_0xef21a4=_[_0xd873('0x2e')](_['keys'](_0x44bf1e),[_0xd873('0x2f'),_0xd873('0x30')]);_0x25cb62=_[_0xd873('0x2e')](_[_0xd873('0x31')](_0x44bf1e),[_0xd873('0x2f'),_0xd873('0x30'),_0xd873('0x32'),_0xd873('0x33')]);if(_0x813bdf[_0xd873('0x34')]['id']){delete _0x813bdf[_0xd873('0x34')]['id'];}if(_['isNil'](_0x813bdf['body'][_0xd873('0x35')])){throw new db['Sequelize']['ValidationError'](_0xd873('0x36'));}if(_['isNil'](_0x813bdf[_0xd873('0x34')][_0xd873('0x34')])||_0x813bdf['body']['body']===''){throw new db[(_0xd873('0x37'))][(_0xd873('0x2c'))](_0xd873('0x38'));}if(_[_0xd873('0x39')](_0x813bdf[_0xd873('0x34')][_0xd873('0x3a')])){throw new db[(_0xd873('0x37'))]['ValidationError'](_0xd873('0x3b')+_0x25cb62);}if(!_[_0xd873('0x3c')](_0x25cb62,_0x813bdf[_0xd873('0x34')][_0xd873('0x3a')])){throw new db[(_0xd873('0x37'))][(_0xd873('0x2c'))](_0xd873('0x3d')+_0x25cb62);}_0x35dc64[_0x813bdf[_0xd873('0x34')]['mapKey']]=_0x813bdf['body'][_0xd873('0x35')];})['then'](function(){return db['FaxAccount'][_0xd873('0x3e')]({'where':{'id':_0x813bdf[_0xd873('0x3f')]['id']},'include':[{'model':db[_0xd873('0x40')],'as':'List','include':[{'model':db[_0xd873('0x2a')],'as':_0xd873('0x41'),'where':_0x35dc64,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xd873('0x42')],'as':_0xd873('0x43')}]});})[_0xd873('0x26')](function(_0x167eac){if(_0x167eac&&_0x167eac[_0xd873('0x44')]){var _0x468d96=_0x167eac[_0xd873('0x45')]({'plain':!![]});_0x3b2543['account']=_0x468d96;_0x3b2543['applications']=_0x468d96[_0xd873('0x43')];_0x3b2543['list']=_0x468d96['List'];_0x3b2543[_0xd873('0x46')]=_[_0xd873('0x47')](_0x3b2543[_0xd873('0x46')],[_0xd873('0x48')],[_0xd873('0x49')]);if(_0x3b2543[_0xd873('0x3f')][_0xd873('0x43')]){delete _0x3b2543['account']['Applications'];}if(_0x3b2543[_0xd873('0x3f')][_0xd873('0x44')]&&_0x3b2543['account'][_0xd873('0x44')]['Contacts'][_0xd873('0x4a')]){return _0x3b2543[_0xd873('0x3f')][_0xd873('0x44')]['Contacts'][0x0];}var _0x4327d8=_[_0xd873('0xd')](_0x813bdf['body'],{'firstName':_0x813bdf[_0xd873('0x34')][_0xd873('0x35')],'ListId':_0x468d96['ListId']});_0x4327d8[_0x813bdf[_0xd873('0x34')][_0xd873('0x3a')]]=_0x813bdf['body'][_0xd873('0x35')];return db[_0xd873('0x2a')][_0xd873('0x4b')](_0x4327d8,{'fields':_0xef21a4,'raw':!![]});}})[_0xd873('0x26')](function(_0x1fba0b){_0x3b2543[_0xd873('0x4c')]=_0x1fba0b;if(_0x1fba0b){var _0x7241a3={'ContactId':_0x1fba0b['id'],'FaxAccountId':_0x813bdf['account']['id'],'fax':_0x1fba0b[_0xd873('0x29')]};return db[_0xd873('0x4d')][_0xd873('0x3e')]({'where':{'ContactId':_0x1fba0b['id'],'closed':![],'FaxAccountId':_0x813bdf[_0xd873('0x3f')]['id']}})[_0xd873('0x26')](function(_0x4e6497){if(_0x4e6497){return[_0x4e6497,![]];}return db[_0xd873('0x4d')][_0xd873('0x4b')](_0x7241a3)[_0xd873('0x26')](function(_0x212797){return[_0x212797,!![]];});});}else{throw new Error(_0xd873('0x4e'));}})[_0xd873('0x4f')](function(_0x5078ce,_0x41db32){var _0x3947c8=_0x5078ce[_0xd873('0x45')]({'plain':!![]});if(_0x41db32){if(_0x3b2543['account'][_0xd873('0x50')]){_0x3b2543['applications']['push']({'id':0x0,'priority':_0x3b2543['applications'][_0xd873('0x4a')]+0x1,'app':_0xd873('0x51'),'appdata':_0xd873('0x52'),'interval':_0xd873('0x53')});}_0x3947c8[_0xd873('0x54')]=!![];}else{_0x3947c8['created']=![];}_0x3b2543[_0xd873('0x55')]=_0x3947c8;return db[_0xd873('0x56')]['create']({'body':_0x813bdf[_0xd873('0x34')][_0xd873('0x34')],'FaxAccountId':_0x813bdf[_0xd873('0x3f')]['id'],'FaxInteractionId':_0x5078ce['id'],'direction':'in','ContactId':_0x5078ce[_0xd873('0x57')],'AttachmentId':_0x813bdf[_0xd873('0x34')][_0xd873('0x58')]});})[_0xd873('0x26')](function(_0xd3232b){_0x3b2543[_0xd873('0x1a')]=_0xd3232b;if(_0x3b2543['interaction'][_0xd873('0x59')]){return db[_0xd873('0x5a')][_0xd873('0x3e')]({'attributes':['id',_0xd873('0x5b')],'where':{'id':_0x3b2543['interaction'][_0xd873('0x59')]}})[_0xd873('0x26')](function(_0x307536){if(_0x307536){_0x3b2543['applications'][_0xd873('0x5c')]({'id':0x0,'priority':0x0,'app':_0xd873('0x5d'),'appdata':_0x307536[_0xd873('0x5b')]+','+(_0x3b2543[_0xd873('0x3f')]['waitForTheAssignedAgent']||0xa),'interval':_0xd873('0x53')});}return respondWithRpcPromise(_0xd873('0x5e'),_0xd873('0x5f'),_0x3b2543);});}return respondWithRpcPromise(_0xd873('0x5e'),_0xd873('0x5f'),_0x3b2543);})[_0xd873('0x26')](function(_0xd57c4f){_0x4206ca(_0xd57c4f);})[_0xd873('0x27')](function(_0x10f1c6){_0x1bf842(_0x37a936[_0xd873('0x18')](0x1f4,_0x10f1c6[_0xd873('0x1a')]));});});}; \ No newline at end of file +var _0x7b10=['model','map','NotifyFaxAccount','body','fax','CmContact','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','difference','CompanyId','isNil','from','Sequelize','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','Contacts','FaxApplication','Applications','get','applications','list','orderBy','priority','asc','length','create','contact','find','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','User','name','UserId','agent','startRouting','Start','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','localhost','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','message','error','result','catch','GetFaxAccount','FaxAccount','options','attributes','include'];(function(_0x5e45e9,_0x36f8fd){var _0xfd13e6=function(_0x43ad5c){while(--_0x43ad5c){_0x5e45e9['push'](_0x5e45e9['shift']());}};_0xfd13e6(++_0x36f8fd);}(_0x7b10,0x17c));var _0x07b1=function(_0x2a13dd,_0x354785){_0x2a13dd=_0x2a13dd-0x0;var _0x3bae10=_0x7b10[_0x2a13dd];return _0x3bae10;};'use strict';var _=require(_0x07b1('0x0'));var util=require(_0x07b1('0x1'));var moment=require(_0x07b1('0x2'));var BPromise=require(_0x07b1('0x3'));var rs=require(_0x07b1('0x4'));var fs=require('fs');var Redis=require(_0x07b1('0x5'));var db=require(_0x07b1('0x6'))['db'];var utils=require(_0x07b1('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x07b1('0x8'));var jayson=require(_0x07b1('0x9'));var client=jayson[_0x07b1('0xa')]['http']({'port':0x232c});config[_0x07b1('0xb')]=_[_0x07b1('0xc')](config[_0x07b1('0xb')],{'host':_0x07b1('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x590f8f,_0x39ef2e,_0x4cce9e){return new BPromise(function(_0x830668,_0x5c3960){return client[_0x07b1('0xe')](_0x590f8f,_0x4cce9e)[_0x07b1('0xf')](function(_0x46e3a8){logger[_0x07b1('0x10')](_0x07b1('0x11'),_0x39ef2e,_0x07b1('0x12'));logger[_0x07b1('0x13')](_0x07b1('0x14'),_0x39ef2e,_0x07b1('0x12'),JSON['stringify'](_0x46e3a8));if(_0x46e3a8['error']){if(_0x46e3a8['error']['code']===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x39ef2e,_0x46e3a8['error'][_0x07b1('0x15')]);return _0x5c3960(_0x46e3a8[_0x07b1('0x16')][_0x07b1('0x15')]);}logger[_0x07b1('0x16')]('FaxAccount,\x20%s,\x20%s',_0x39ef2e,_0x46e3a8[_0x07b1('0x16')][_0x07b1('0x15')]);return _0x830668(_0x46e3a8[_0x07b1('0x16')][_0x07b1('0x15')]);}else{logger[_0x07b1('0x10')](_0x07b1('0x11'),_0x39ef2e,_0x07b1('0x12'));_0x830668(_0x46e3a8[_0x07b1('0x17')][_0x07b1('0x15')]);}})[_0x07b1('0x18')](function(_0x2ea9b5){logger['error'](_0x07b1('0x11'),_0x39ef2e,_0x2ea9b5);_0x5c3960(_0x2ea9b5);});});}exports[_0x07b1('0x19')]=function(_0x557508){var _0x11d7b6=this;return new Promise(function(_0x570e3e,_0x522db9){return db[_0x07b1('0x1a')]['findAll']({'raw':_0x557508[_0x07b1('0x1b')]?_0x557508[_0x07b1('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x557508[_0x07b1('0x1b')]?_0x557508[_0x07b1('0x1b')]['where']||null:null,'attributes':_0x557508[_0x07b1('0x1b')]?_0x557508[_0x07b1('0x1b')][_0x07b1('0x1c')]||null:null,'limit':_0x557508[_0x07b1('0x1b')]?_0x557508[_0x07b1('0x1b')]['limit']||null:null,'include':_0x557508[_0x07b1('0x1b')]?_0x557508['options']['include']?_['map'](_0x557508[_0x07b1('0x1b')][_0x07b1('0x1d')],function(_0x2f5dbc){return{'model':db[_0x2f5dbc[_0x07b1('0x1e')]],'as':_0x2f5dbc['as'],'attributes':_0x2f5dbc[_0x07b1('0x1c')],'include':_0x2f5dbc[_0x07b1('0x1d')]?_['map'](_0x2f5dbc[_0x07b1('0x1d')],function(_0x2e68c0){return{'model':db[_0x2e68c0[_0x07b1('0x1e')]],'as':_0x2e68c0['as'],'attributes':_0x2e68c0[_0x07b1('0x1c')],'include':_0x2e68c0[_0x07b1('0x1d')]?_[_0x07b1('0x1f')](_0x2e68c0[_0x07b1('0x1d')],function(_0x3f13df){return{'model':db[_0x3f13df[_0x07b1('0x1e')]],'as':_0x3f13df['as'],'attributes':_0x3f13df[_0x07b1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x07b1('0xf')](function(_0x1f9548){logger[_0x07b1('0x10')]('GetFaxAccount',_0x557508);logger[_0x07b1('0x13')](_0x07b1('0x19'),_0x557508,JSON['stringify'](_0x1f9548));_0x570e3e(_0x1f9548);})[_0x07b1('0x18')](function(_0x316fbe){logger[_0x07b1('0x16')](_0x07b1('0x19'),_0x316fbe[_0x07b1('0x15')],_0x557508);_0x522db9(_0x11d7b6[_0x07b1('0x16')](0x1f4,_0x316fbe[_0x07b1('0x15')]));});});};exports[_0x07b1('0x20')]=function(_0x39b2f1,_0x324429,_0x2fb1f6){var _0x3b62c4=this;return new Promise(function(_0x538e3c,_0x56aa15){var _0x597010={'body':_0x39b2f1[_0x07b1('0x21')],'channel':_0x07b1('0x22')};var _0x38ccef=[];var _0x2d1f2a=[];var _0x29b133={};return db[_0x07b1('0x23')]['describe']()[_0x07b1('0xf')](function(_0x59a7e4){if(!_0x59a7e4){throw new db['Sequelize'][(_0x07b1('0x24'))](_0x07b1('0x25'));}_0x38ccef=_['difference'](_[_0x07b1('0x26')](_0x59a7e4),[_0x07b1('0x27'),_0x07b1('0x28')]);_0x2d1f2a=_[_0x07b1('0x29')](_['keys'](_0x59a7e4),[_0x07b1('0x27'),_0x07b1('0x28'),_0x07b1('0x2a'),'ListId']);if(_0x39b2f1[_0x07b1('0x21')]['id']){delete _0x39b2f1[_0x07b1('0x21')]['id'];}if(_[_0x07b1('0x2b')](_0x39b2f1[_0x07b1('0x21')][_0x07b1('0x2c')])){throw new db[(_0x07b1('0x2d'))][(_0x07b1('0x24'))](_0x07b1('0x2e'));}if(_[_0x07b1('0x2b')](_0x39b2f1[_0x07b1('0x21')][_0x07b1('0x21')])||_0x39b2f1['body'][_0x07b1('0x21')]===''){throw new db[(_0x07b1('0x2d'))][(_0x07b1('0x24'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x07b1('0x2b')](_0x39b2f1[_0x07b1('0x21')][_0x07b1('0x2f')])){throw new db['Sequelize'][(_0x07b1('0x24'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2d1f2a);}if(!_[_0x07b1('0x30')](_0x2d1f2a,_0x39b2f1['body'][_0x07b1('0x2f')])){throw new db['Sequelize'][(_0x07b1('0x24'))](_0x07b1('0x31')+_0x2d1f2a);}_0x29b133[_0x39b2f1[_0x07b1('0x21')]['mapKey']]=_0x39b2f1[_0x07b1('0x21')][_0x07b1('0x2c')];})[_0x07b1('0xf')](function(){return db[_0x07b1('0x1a')]['find']({'where':{'id':_0x39b2f1[_0x07b1('0x32')]['id']},'include':[{'model':db['CmList'],'as':_0x07b1('0x33'),'include':[{'model':db[_0x07b1('0x23')],'as':_0x07b1('0x34'),'where':_0x29b133,'limit':0x1,'order':[[_0x07b1('0x28'),'DESC']]}]},{'model':db[_0x07b1('0x35')],'as':_0x07b1('0x36')}]});})['then'](function(_0x3051ff){if(_0x3051ff&&_0x3051ff[_0x07b1('0x33')]){var _0x1b6aa2=_0x3051ff[_0x07b1('0x37')]({'plain':!![]});_0x597010['account']=_0x1b6aa2;_0x597010[_0x07b1('0x38')]=_0x1b6aa2[_0x07b1('0x36')];_0x597010[_0x07b1('0x39')]=_0x1b6aa2[_0x07b1('0x33')];_0x597010[_0x07b1('0x38')]=_[_0x07b1('0x3a')](_0x597010[_0x07b1('0x38')],[_0x07b1('0x3b')],[_0x07b1('0x3c')]);if(_0x597010[_0x07b1('0x32')][_0x07b1('0x36')]){delete _0x597010[_0x07b1('0x32')][_0x07b1('0x36')];}if(_0x597010[_0x07b1('0x32')][_0x07b1('0x33')]&&_0x597010[_0x07b1('0x32')]['List']['Contacts'][_0x07b1('0x3d')]){return _0x597010['account'][_0x07b1('0x33')][_0x07b1('0x34')][0x0];}var _0x4bba20=_['defaults'](_0x39b2f1['body'],{'firstName':_0x39b2f1[_0x07b1('0x21')]['from'],'ListId':_0x1b6aa2['ListId']});_0x4bba20[_0x39b2f1[_0x07b1('0x21')][_0x07b1('0x2f')]]=_0x39b2f1['body'][_0x07b1('0x2c')];return db[_0x07b1('0x23')][_0x07b1('0x3e')](_0x4bba20,{'fields':_0x38ccef,'raw':!![]});}})[_0x07b1('0xf')](function(_0x2d5e8a){_0x597010[_0x07b1('0x3f')]=_0x2d5e8a;if(_0x2d5e8a){var _0x9d7760={'ContactId':_0x2d5e8a['id'],'FaxAccountId':_0x39b2f1[_0x07b1('0x32')]['id'],'fax':_0x2d5e8a[_0x07b1('0x22')]};return db['FaxInteraction'][_0x07b1('0x40')]({'where':{'ContactId':_0x2d5e8a['id'],'closed':![],'FaxAccountId':_0x39b2f1[_0x07b1('0x32')]['id']}})[_0x07b1('0xf')](function(_0xa276e2){if(_0xa276e2){return[_0xa276e2,![]];}return db[_0x07b1('0x41')][_0x07b1('0x3e')](_0x9d7760)[_0x07b1('0xf')](function(_0x26a77e){return[_0x26a77e,!![]];});});}else{throw new Error(_0x07b1('0x42'));}})[_0x07b1('0x43')](function(_0x3524c3,_0x336c3a){var _0x549ee7=_0x3524c3['get']({'plain':!![]});if(_0x336c3a){if(_0x597010[_0x07b1('0x32')][_0x07b1('0x44')]){_0x597010[_0x07b1('0x38')][_0x07b1('0x45')]({'id':0x0,'priority':_0x597010[_0x07b1('0x38')][_0x07b1('0x3d')]+0x1,'app':'close','appdata':_0x07b1('0x46'),'interval':_0x07b1('0x47')});}_0x549ee7['created']=!![];}else{_0x549ee7[_0x07b1('0x48')]=![];}_0x597010[_0x07b1('0x49')]=_0x549ee7;return db[_0x07b1('0x4a')][_0x07b1('0x3e')]({'body':_0x39b2f1['body'][_0x07b1('0x21')],'FaxAccountId':_0x39b2f1[_0x07b1('0x32')]['id'],'FaxInteractionId':_0x3524c3['id'],'direction':'in','ContactId':_0x3524c3['ContactId'],'AttachmentId':_0x39b2f1[_0x07b1('0x21')][_0x07b1('0x4b')]});})[_0x07b1('0xf')](function(_0x48c164){_0x597010[_0x07b1('0x15')]=_0x48c164;if(_0x597010[_0x07b1('0x49')]['UserId']){return db[_0x07b1('0x4c')][_0x07b1('0x40')]({'attributes':['id',_0x07b1('0x4d')],'where':{'id':_0x597010[_0x07b1('0x49')][_0x07b1('0x4e')]}})['then'](function(_0x3df11b){if(_0x3df11b){_0x597010[_0x07b1('0x38')]['unshift']({'id':0x0,'priority':0x0,'app':_0x07b1('0x4f'),'appdata':_0x3df11b[_0x07b1('0x4d')]+','+(_0x597010['account']['waitForTheAssignedAgent']||0xa),'interval':_0x07b1('0x47')});}return respondWithRpcPromise('Start',_0x07b1('0x50'),_0x597010);});}return respondWithRpcPromise(_0x07b1('0x51'),_0x07b1('0x50'),_0x597010);})[_0x07b1('0xf')](function(_0x224c0d){_0x538e3c(_0x224c0d);})[_0x07b1('0x18')](function(_0x5818db){_0x56aa15(_0x3b62c4[_0x07b1('0x16')](0x1f4,_0x5818db[_0x07b1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index c113bba..57ffffc 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 _0x3d9d=['register','length','./faxAccount.events','save','remove','emit','removeListener'];(function(_0x41f6dc,_0x2bd02d){var _0x3ada9d=function(_0x1ff8c8){while(--_0x1ff8c8){_0x41f6dc['push'](_0x41f6dc['shift']());}};_0x3ada9d(++_0x2bd02d);}(_0x3d9d,0x1bb));var _0xd3d9=function(_0x173fac,_0x2d6f72){_0x173fac=_0x173fac-0x0;var _0x1c5914=_0x3d9d[_0x173fac];return _0x1c5914;};'use strict';var FaxAccountEvents=require(_0xd3d9('0x0'));var events=[_0xd3d9('0x1'),_0xd3d9('0x2'),'update'];function createListener(_0x3762cd,_0x2a6ca7){return function(_0x471c7b){_0x2a6ca7[_0xd3d9('0x3')](_0x3762cd,_0x471c7b);};}function removeListener(_0x5adfc3,_0xceeee2){return function(){FaxAccountEvents[_0xd3d9('0x4')](_0x5adfc3,_0xceeee2);};}exports[_0xd3d9('0x5')]=function(_0x2b3376){for(var _0x81d42e=0x0,_0x3319ff=events[_0xd3d9('0x6')];_0x81d42e<_0x3319ff;_0x81d42e++){var _0x1feb26=events[_0x81d42e];var _0x4f3588=createListener('faxAccount:'+_0x1feb26,_0x2b3376);FaxAccountEvents['on'](_0x1feb26,_0x4f3588);}}; \ No newline at end of file +var _0x92db=['removeListener','register','length','faxAccount:','remove','emit'];(function(_0x5f50eb,_0x3e7d18){var _0xb912b6=function(_0x19d99d){while(--_0x19d99d){_0x5f50eb['push'](_0x5f50eb['shift']());}};_0xb912b6(++_0x3e7d18);}(_0x92db,0x154));var _0xb92d=function(_0x17873c,_0x5b6a58){_0x17873c=_0x17873c-0x0;var _0x547a57=_0x92db[_0x17873c];return _0x547a57;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=['save',_0xb92d('0x0'),'update'];function createListener(_0x38f67c,_0x1bdb5f){return function(_0x27f844){_0x1bdb5f[_0xb92d('0x1')](_0x38f67c,_0x27f844);};}function removeListener(_0x20d3cd,_0x13e901){return function(){FaxAccountEvents[_0xb92d('0x2')](_0x20d3cd,_0x13e901);};}exports[_0xb92d('0x3')]=function(_0x4c69fe){for(var _0x66771c=0x0,_0x3fab49=events[_0xb92d('0x4')];_0x66771c<_0x3fab49;_0x66771c++){var _0x5e52e2=events[_0x66771c];var _0x386775=createListener(_0xb92d('0x5')+_0x5e52e2,_0x4c69fe);FaxAccountEvents['on'](_0x5e52e2,_0x386775);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 165f678..8a73723 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 _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0xe7606f,_0x346042){var _0x5e117e=function(_0x166892){while(--_0x166892){_0xe7606f['push'](_0xe7606f['shift']());}};_0x5e117e(++_0x346042);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x49c008,_0x15dfd1){var _0x2626e4=function(_0xc1bfbd){while(--_0xc1bfbd){_0x49c008['push'](_0x49c008['shift']());}};_0x2626e4(++_0x15dfd1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 0299a29..ddae938 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 _0xdb1b=['exports','INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x553502,_0x4d2c0c){var _0x246c37=function(_0x36698a){while(--_0x36698a){_0x553502['push'](_0x553502['shift']());}};_0x246c37(++_0x4d2c0c);}(_0xdb1b,0x179));var _0xbdb1=function(_0x4911ec,_0x13e08c){_0x4911ec=_0x4911ec-0x0;var _0x32e692=_0xdb1b[_0x4911ec];return _0x32e692;};'use strict';var Sequelize=require(_0xbdb1('0x0'));module[_0xbdb1('0x1')]={'priority':{'type':Sequelize[_0xbdb1('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xbdb1('0x3')],'allowNull':![],'defaultValue':_0xbdb1('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xbdb1('0x3')]},'interval':{'type':Sequelize[_0xbdb1('0x3')],'defaultValue':_0xbdb1('0x5')}}; \ No newline at end of file +var _0x2abf=['TEXT','sequelize','exports','INTEGER','STRING'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x2abf,0x182));var _0xf2ab=function(_0x28833b,_0x7b4698){_0x28833b=_0x28833b-0x0;var _0x20c7c1=_0x2abf[_0x28833b];return _0x20c7c1;};'use strict';var Sequelize=require(_0xf2ab('0x0'));module[_0xf2ab('0x1')]={'priority':{'type':Sequelize[_0xf2ab('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf2ab('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf2ab('0x4')]()},'description':{'type':Sequelize[_0xf2ab('0x3')]},'interval':{'type':Sequelize[_0xf2ab('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 3d3d125..7800413 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 _0x3009=['fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','show','include','create','body','find','params','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','reject','save','update','then','destroy','error','stack','name','send','index','FaxApplication','rawAttributes','fieldName','map','query','keys','filters','intersection','model','attributes'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x3009,0x131));var _0x9300=function(_0x25a11b,_0x1b533d){_0x25a11b=_0x25a11b-0x0;var _0x472d7e=_0x3009[_0x25a11b];return _0x472d7e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9300('0x0'));var jsonpatch=require(_0x9300('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9300('0x2'));var Mustache=require(_0x9300('0x3'));var util=require(_0x9300('0x4'));var path=require('path');var sox=require(_0x9300('0x5'));var csv=require(_0x9300('0x6'));var ejs=require(_0x9300('0x7'));var fs=require('fs');var fs_extra=require(_0x9300('0x8'));var _=require(_0x9300('0x9'));var squel=require(_0x9300('0xa'));var crypto=require(_0x9300('0xb'));var jsforce=require(_0x9300('0xc'));var deskjs=require(_0x9300('0xd'));var toCsv=require(_0x9300('0x6'));var querystring=require(_0x9300('0xe'));var Papa=require('papaparse');var Redis=require(_0x9300('0xf'));var authService=require(_0x9300('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9300('0x11'));var hardwareService=require(_0x9300('0x12'));var logger=require('../../config/logger')(_0x9300('0x13'));var utils=require(_0x9300('0x14'));var config=require(_0x9300('0x15'));var licenseUtil=require(_0x9300('0x16'));var db=require(_0x9300('0x17'))['db'];function respondWithStatusCode(_0x573df9,_0x5d3422){_0x5d3422=_0x5d3422||0xcc;return function(_0x4bf565){if(_0x4bf565){return _0x573df9[_0x9300('0x18')](_0x5d3422);}return _0x573df9[_0x9300('0x19')](_0x5d3422)['end']();};}function respondWithResult(_0x2eb582,_0x5c99b4){_0x5c99b4=_0x5c99b4||0xc8;return function(_0x25135a){if(_0x25135a){return _0x2eb582[_0x9300('0x19')](_0x5c99b4)[_0x9300('0x1a')](_0x25135a);}};}function respondWithFilteredResult(_0x2efb39,_0x65793d){return function(_0x40fc7a){if(_0x40fc7a){var _0x431a66=typeof _0x65793d[_0x9300('0x1b')]==='undefined'&&typeof _0x65793d[_0x9300('0x1c')]==='undefined';var _0x33c451=_0x40fc7a['count'];var _0x225283=_0x431a66?0x0:_0x65793d[_0x9300('0x1b')];var _0x42bb5d=_0x431a66?_0x40fc7a[_0x9300('0x1d')]:_0x65793d[_0x9300('0x1b')]+_0x65793d['limit'];var _0x1565cb;if(_0x42bb5d>=_0x33c451){_0x42bb5d=_0x33c451;_0x1565cb=0xc8;}else{_0x1565cb=0xce;}_0x2efb39[_0x9300('0x19')](_0x1565cb);return _0x2efb39['set']('Content-Range',_0x225283+'-'+_0x42bb5d+'/'+_0x33c451)[_0x9300('0x1a')](_0x40fc7a);}return null;};}function patchUpdates(_0x2d884e){return function(_0x13c1d0){try{jsonpatch['apply'](_0x13c1d0,_0x2d884e,!![]);}catch(_0x328ac2){return BPromise[_0x9300('0x1e')](_0x328ac2);}return _0x13c1d0[_0x9300('0x1f')]();};}function saveUpdates(_0x127aae,_0x4889b6){return function(_0x26630a){if(_0x26630a){return _0x26630a[_0x9300('0x20')](_0x127aae)[_0x9300('0x21')](function(_0x53c7c8){return _0x53c7c8;});}return null;};}function removeEntity(_0x3893da,_0xeaa7be){return function(_0x5ab23e){if(_0x5ab23e){return _0x5ab23e[_0x9300('0x22')]()['then'](function(){_0x3893da[_0x9300('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3db73b,_0x563fad){return function(_0x3b99d8){if(!_0x3b99d8){_0x3db73b[_0x9300('0x18')](0x194);}return _0x3b99d8;};}function handleError(_0x424eb0,_0xa6e037){_0xa6e037=_0xa6e037||0x1f4;return function(_0x293956){logger[_0x9300('0x23')](_0x293956[_0x9300('0x24')]);if(_0x293956[_0x9300('0x25')]){delete _0x293956[_0x9300('0x25')];}_0x424eb0[_0x9300('0x19')](_0xa6e037)[_0x9300('0x26')](_0x293956);};}exports[_0x9300('0x27')]=function(_0x2d3296,_0x32a6a4){var _0x101116={},_0x4aedcf={},_0x33d7ca={'count':0x0,'rows':[]};var _0x511d83=_['map'](db[_0x9300('0x28')][_0x9300('0x29')],function(_0x52c25d){return{'name':_0x52c25d[_0x9300('0x2a')],'type':_0x52c25d['type']['key']};});_0x4aedcf['model']=_[_0x9300('0x2b')](_0x511d83,_0x9300('0x25'));_0x4aedcf[_0x9300('0x2c')]=_[_0x9300('0x2d')](_0x2d3296[_0x9300('0x2c')]);_0x4aedcf[_0x9300('0x2e')]=_[_0x9300('0x2f')](_0x4aedcf[_0x9300('0x30')],_0x4aedcf[_0x9300('0x2c')]);_0x101116[_0x9300('0x31')]=_['intersection'](_0x4aedcf[_0x9300('0x30')],qs[_0x9300('0x32')](_0x2d3296[_0x9300('0x2c')][_0x9300('0x32')]));_0x101116[_0x9300('0x31')]=_0x101116[_0x9300('0x31')][_0x9300('0x33')]?_0x101116[_0x9300('0x31')]:_0x4aedcf['model'];if(!_0x2d3296[_0x9300('0x2c')][_0x9300('0x34')](_0x9300('0x35'))){_0x101116[_0x9300('0x1c')]=qs[_0x9300('0x1c')](_0x2d3296[_0x9300('0x2c')][_0x9300('0x1c')]);_0x101116[_0x9300('0x1b')]=qs[_0x9300('0x1b')](_0x2d3296[_0x9300('0x2c')]['offset']);}_0x101116['order']=qs[_0x9300('0x36')](_0x2d3296[_0x9300('0x2c')][_0x9300('0x36')]);_0x101116[_0x9300('0x37')]=qs['filters'](_[_0x9300('0x38')](_0x2d3296['query'],_0x4aedcf[_0x9300('0x2e')]),_0x511d83);if(_0x2d3296['query'][_0x9300('0x39')]){_0x101116[_0x9300('0x37')]=_[_0x9300('0x3a')](_0x101116['where'],{'$or':_['map'](_0x511d83,function(_0x2d7600){if(_0x2d7600[_0x9300('0x3b')]!==_0x9300('0x3c')){var _0x15492c={};_0x15492c[_0x2d7600[_0x9300('0x25')]]={'$like':'%'+_0x2d3296['query']['filter']+'%'};return _0x15492c;}})});}_0x101116=_[_0x9300('0x3a')]({},_0x101116,_0x2d3296[_0x9300('0x3d')]);var _0x29e295={'where':_0x101116['where']};return db[_0x9300('0x28')][_0x9300('0x1d')](_0x29e295)[_0x9300('0x21')](function(_0x4a7a08){_0x33d7ca[_0x9300('0x1d')]=_0x4a7a08;if(_0x2d3296[_0x9300('0x2c')][_0x9300('0x3e')]){_0x101116['include']=[{'all':!![]}];}return db['FaxApplication'][_0x9300('0x3f')](_0x101116);})[_0x9300('0x21')](function(_0x8cf1fb){_0x33d7ca['rows']=_0x8cf1fb;return _0x33d7ca;})[_0x9300('0x21')](respondWithFilteredResult(_0x32a6a4,_0x101116))[_0x9300('0x40')](handleError(_0x32a6a4,null));};exports[_0x9300('0x41')]=function(_0x4341b8,_0x504ed4){var _0x49cc77={'raw':!![],'where':{'id':_0x4341b8['params']['id']}},_0x8be584={};_0x8be584[_0x9300('0x30')]=_[_0x9300('0x2d')](db[_0x9300('0x28')][_0x9300('0x29')]);_0x8be584[_0x9300('0x2c')]=_[_0x9300('0x2d')](_0x4341b8['query']);_0x8be584['filters']=_['intersection'](_0x8be584['model'],_0x8be584[_0x9300('0x2c')]);_0x49cc77[_0x9300('0x31')]=_[_0x9300('0x2f')](_0x8be584['model'],qs[_0x9300('0x32')](_0x4341b8[_0x9300('0x2c')]['fields']));_0x49cc77[_0x9300('0x31')]=_0x49cc77[_0x9300('0x31')][_0x9300('0x33')]?_0x49cc77['attributes']:_0x8be584[_0x9300('0x30')];if(_0x4341b8[_0x9300('0x2c')][_0x9300('0x3e')]){_0x49cc77[_0x9300('0x42')]=[{'all':!![]}];}_0x49cc77=_[_0x9300('0x3a')]({},_0x49cc77,_0x4341b8[_0x9300('0x3d')]);return db[_0x9300('0x28')]['find'](_0x49cc77)[_0x9300('0x21')](handleEntityNotFound(_0x504ed4,null))['then'](respondWithResult(_0x504ed4,null))['catch'](handleError(_0x504ed4,null));};exports[_0x9300('0x43')]=function(_0x1cee5a,_0x4ec385){return db[_0x9300('0x28')]['create'](_0x1cee5a[_0x9300('0x44')],{})['then'](respondWithResult(_0x4ec385,0xc9))['catch'](handleError(_0x4ec385,null));};exports[_0x9300('0x20')]=function(_0x381962,_0x49ebf7){if(_0x381962[_0x9300('0x44')]['id']){delete _0x381962[_0x9300('0x44')]['id'];}return db['FaxApplication'][_0x9300('0x45')]({'where':{'id':_0x381962[_0x9300('0x46')]['id']}})[_0x9300('0x21')](handleEntityNotFound(_0x49ebf7,null))[_0x9300('0x21')](saveUpdates(_0x381962[_0x9300('0x44')],null))[_0x9300('0x21')](respondWithResult(_0x49ebf7,null))[_0x9300('0x40')](handleError(_0x49ebf7,null));};exports[_0x9300('0x22')]=function(_0x5cecd7,_0x49e455){return db[_0x9300('0x28')][_0x9300('0x45')]({'where':{'id':_0x5cecd7[_0x9300('0x46')]['id']}})[_0x9300('0x21')](handleEntityNotFound(_0x49e455,null))[_0x9300('0x21')](removeEntity(_0x49e455,null))[_0x9300('0x40')](handleError(_0x49e455,null));}; \ No newline at end of file +var _0x977a=['options','then','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','error','stack','name','index','map','FaxApplication','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge'];(function(_0xb87143,_0x32d55a){var _0x3b57bd=function(_0x1c00bd){while(--_0x1c00bd){_0xb87143['push'](_0xb87143['shift']());}};_0x3b57bd(++_0x32d55a);}(_0x977a,0xa7));var _0xa977=function(_0x42fdeb,_0x310c4b){_0x42fdeb=_0x42fdeb-0x0;var _0x50bc60=_0x977a[_0x42fdeb];return _0x50bc60;};'use strict';var emlformat=require(_0xa977('0x0'));var rimraf=require(_0xa977('0x1'));var zipdir=require(_0xa977('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa977('0x3'));var moment=require(_0xa977('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa977('0x5'));var util=require(_0xa977('0x6'));var path=require(_0xa977('0x7'));var sox=require(_0xa977('0x8'));var csv=require(_0xa977('0x9'));var ejs=require(_0xa977('0xa'));var fs=require('fs');var fs_extra=require(_0xa977('0xb'));var _=require(_0xa977('0xc'));var squel=require(_0xa977('0xd'));var crypto=require(_0xa977('0xe'));var jsforce=require(_0xa977('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa977('0x9'));var querystring=require(_0xa977('0x10'));var Papa=require('papaparse');var Redis=require(_0xa977('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa977('0x12'));var as=require(_0xa977('0x13'));var hardwareService=require(_0xa977('0x14'));var logger=require(_0xa977('0x15'))(_0xa977('0x16'));var utils=require(_0xa977('0x17'));var config=require(_0xa977('0x18'));var licenseUtil=require(_0xa977('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4400ef,_0xf9a99){_0xf9a99=_0xf9a99||0xcc;return function(_0x11468f){if(_0x11468f){return _0x4400ef['sendStatus'](_0xf9a99);}return _0x4400ef[_0xa977('0x1a')](_0xf9a99)['end']();};}function respondWithResult(_0x3fabca,_0x4d9e4b){_0x4d9e4b=_0x4d9e4b||0xc8;return function(_0x13a31a){if(_0x13a31a){return _0x3fabca[_0xa977('0x1a')](_0x4d9e4b)['json'](_0x13a31a);}};}function respondWithFilteredResult(_0x4d5689,_0x299f39){return function(_0x3a24e0){if(_0x3a24e0){var _0x9c2d39=typeof _0x299f39[_0xa977('0x1b')]==='undefined'&&typeof _0x299f39['limit']===_0xa977('0x1c');var _0x52a5cf=_0x3a24e0['count'];var _0x1d5bdb=_0x9c2d39?0x0:_0x299f39[_0xa977('0x1b')];var _0x2afb0a=_0x9c2d39?_0x3a24e0[_0xa977('0x1d')]:_0x299f39[_0xa977('0x1b')]+_0x299f39[_0xa977('0x1e')];var _0xa10edf;if(_0x2afb0a>=_0x52a5cf){_0x2afb0a=_0x52a5cf;_0xa10edf=0xc8;}else{_0xa10edf=0xce;}_0x4d5689[_0xa977('0x1a')](_0xa10edf);return _0x4d5689[_0xa977('0x1f')](_0xa977('0x20'),_0x1d5bdb+'-'+_0x2afb0a+'/'+_0x52a5cf)['json'](_0x3a24e0);}return null;};}function patchUpdates(_0x57dd57){return function(_0x536066){try{jsonpatch[_0xa977('0x21')](_0x536066,_0x57dd57,!![]);}catch(_0x40d240){return BPromise[_0xa977('0x22')](_0x40d240);}return _0x536066[_0xa977('0x23')]();};}function saveUpdates(_0x359b05,_0x6148a8){return function(_0x179108){if(_0x179108){return _0x179108[_0xa977('0x24')](_0x359b05)['then'](function(_0xb8de68){return _0xb8de68;});}return null;};}function removeEntity(_0x2ef370,_0x4efb10){return function(_0x267511){if(_0x267511){return _0x267511[_0xa977('0x25')]()['then'](function(){_0x2ef370['status'](0xcc)[_0xa977('0x26')]();});}};}function handleEntityNotFound(_0x53d9bd,_0x113793){return function(_0x493ab7){if(!_0x493ab7){_0x53d9bd[_0xa977('0x27')](0x194);}return _0x493ab7;};}function handleError(_0x359d91,_0x21e77a){_0x21e77a=_0x21e77a||0x1f4;return function(_0x279e03){logger[_0xa977('0x28')](_0x279e03[_0xa977('0x29')]);if(_0x279e03[_0xa977('0x2a')]){delete _0x279e03[_0xa977('0x2a')];}_0x359d91[_0xa977('0x1a')](_0x21e77a)['send'](_0x279e03);};}exports[_0xa977('0x2b')]=function(_0x248675,_0x3f32fb){var _0x332853={},_0x33d103={},_0x5933ca={'count':0x0,'rows':[]};var _0x89f13f=_[_0xa977('0x2c')](db[_0xa977('0x2d')][_0xa977('0x2e')],function(_0x221e92){return{'name':_0x221e92['fieldName'],'type':_0x221e92[_0xa977('0x2f')][_0xa977('0x30')]};});_0x33d103[_0xa977('0x31')]=_[_0xa977('0x2c')](_0x89f13f,_0xa977('0x2a'));_0x33d103[_0xa977('0x32')]=_[_0xa977('0x33')](_0x248675[_0xa977('0x32')]);_0x33d103[_0xa977('0x34')]=_[_0xa977('0x35')](_0x33d103['model'],_0x33d103['query']);_0x332853[_0xa977('0x36')]=_[_0xa977('0x35')](_0x33d103[_0xa977('0x31')],qs[_0xa977('0x37')](_0x248675[_0xa977('0x32')][_0xa977('0x37')]));_0x332853['attributes']=_0x332853[_0xa977('0x36')]['length']?_0x332853[_0xa977('0x36')]:_0x33d103[_0xa977('0x31')];if(!_0x248675[_0xa977('0x32')][_0xa977('0x38')](_0xa977('0x39'))){_0x332853[_0xa977('0x1e')]=qs[_0xa977('0x1e')](_0x248675['query'][_0xa977('0x1e')]);_0x332853[_0xa977('0x1b')]=qs['offset'](_0x248675['query'][_0xa977('0x1b')]);}_0x332853[_0xa977('0x3a')]=qs[_0xa977('0x3b')](_0x248675[_0xa977('0x32')]['sort']);_0x332853['where']=qs[_0xa977('0x34')](_[_0xa977('0x3c')](_0x248675[_0xa977('0x32')],_0x33d103[_0xa977('0x34')]),_0x89f13f);if(_0x248675[_0xa977('0x32')][_0xa977('0x3d')]){_0x332853[_0xa977('0x3e')]=_[_0xa977('0x3f')](_0x332853[_0xa977('0x3e')],{'$or':_[_0xa977('0x2c')](_0x89f13f,function(_0x3aab8b){if(_0x3aab8b[_0xa977('0x2f')]!=='VIRTUAL'){var _0x49b12f={};_0x49b12f[_0x3aab8b[_0xa977('0x2a')]]={'$like':'%'+_0x248675[_0xa977('0x32')][_0xa977('0x3d')]+'%'};return _0x49b12f;}})});}_0x332853=_['merge']({},_0x332853,_0x248675[_0xa977('0x40')]);var _0x38c458={'where':_0x332853[_0xa977('0x3e')]};return db[_0xa977('0x2d')][_0xa977('0x1d')](_0x38c458)[_0xa977('0x41')](function(_0x147369){_0x5933ca[_0xa977('0x1d')]=_0x147369;if(_0x248675['query']['includeAll']){_0x332853[_0xa977('0x42')]=[{'all':!![]}];}return db['FaxApplication'][_0xa977('0x43')](_0x332853);})[_0xa977('0x41')](function(_0x445511){_0x5933ca[_0xa977('0x44')]=_0x445511;return _0x5933ca;})[_0xa977('0x41')](respondWithFilteredResult(_0x3f32fb,_0x332853))[_0xa977('0x45')](handleError(_0x3f32fb,null));};exports[_0xa977('0x46')]=function(_0x35f32a,_0xc5d78a){var _0x40cc5b={'raw':!![],'where':{'id':_0x35f32a[_0xa977('0x47')]['id']}},_0x1153fb={};_0x1153fb[_0xa977('0x31')]=_['keys'](db[_0xa977('0x2d')][_0xa977('0x2e')]);_0x1153fb[_0xa977('0x32')]=_[_0xa977('0x33')](_0x35f32a['query']);_0x1153fb[_0xa977('0x34')]=_[_0xa977('0x35')](_0x1153fb[_0xa977('0x31')],_0x1153fb['query']);_0x40cc5b[_0xa977('0x36')]=_[_0xa977('0x35')](_0x1153fb[_0xa977('0x31')],qs['fields'](_0x35f32a['query'][_0xa977('0x37')]));_0x40cc5b[_0xa977('0x36')]=_0x40cc5b[_0xa977('0x36')][_0xa977('0x48')]?_0x40cc5b[_0xa977('0x36')]:_0x1153fb[_0xa977('0x31')];if(_0x35f32a[_0xa977('0x32')][_0xa977('0x49')]){_0x40cc5b[_0xa977('0x42')]=[{'all':!![]}];}_0x40cc5b=_['merge']({},_0x40cc5b,_0x35f32a[_0xa977('0x40')]);return db[_0xa977('0x2d')][_0xa977('0x4a')](_0x40cc5b)[_0xa977('0x41')](handleEntityNotFound(_0xc5d78a,null))[_0xa977('0x41')](respondWithResult(_0xc5d78a,null))[_0xa977('0x45')](handleError(_0xc5d78a,null));};exports[_0xa977('0x4b')]=function(_0x46ba98,_0x45da71){return db[_0xa977('0x2d')][_0xa977('0x4b')](_0x46ba98[_0xa977('0x4c')],{})[_0xa977('0x41')](respondWithResult(_0x45da71,0xc9))['catch'](handleError(_0x45da71,null));};exports['update']=function(_0x2b8d49,_0x3420a9){if(_0x2b8d49[_0xa977('0x4c')]['id']){delete _0x2b8d49[_0xa977('0x4c')]['id'];}return db[_0xa977('0x2d')]['find']({'where':{'id':_0x2b8d49['params']['id']}})[_0xa977('0x41')](handleEntityNotFound(_0x3420a9,null))[_0xa977('0x41')](saveUpdates(_0x2b8d49[_0xa977('0x4c')],null))[_0xa977('0x41')](respondWithResult(_0x3420a9,null))['catch'](handleError(_0x3420a9,null));};exports[_0xa977('0x25')]=function(_0x36e27c,_0x5bb294){return db[_0xa977('0x2d')][_0xa977('0x4a')]({'where':{'id':_0x36e27c[_0xa977('0x47')]['id']}})[_0xa977('0x41')](handleEntityNotFound(_0x5bb294,null))['then'](removeEntity(_0x5bb294,null))[_0xa977('0x45')](handleError(_0x5bb294,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 4ab2cbf..1ba65f9 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 _0x26d5=['fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','FaxApplication'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x26d5,0xb9));var _0x526d=function(_0x1baba9,_0x2185b0){_0x1baba9=_0x1baba9-0x0;var _0x228ba3=_0x26d5[_0x1baba9];return _0x228ba3;};'use strict';var _=require(_0x526d('0x0'));var util=require(_0x526d('0x1'));var logger=require(_0x526d('0x2'))(_0x526d('0x3'));var moment=require(_0x526d('0x4'));var BPromise=require(_0x526d('0x5'));var rp=require(_0x526d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x526d('0x7'));var config=require(_0x526d('0x8'));var attributes=require('./faxApplication.attributes');module['exports']=function(_0x4f7196,_0x578615){return _0x4f7196[_0x526d('0x9')](_0x526d('0xa'),attributes,{'tableName':_0x526d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x526d('0xc'),'collate':_0x526d('0xd')});}; \ No newline at end of file +var _0x66e0=['./faxApplication.attributes','exports','define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x26373e,_0x1586ad){var _0x56b09d=function(_0x27cee9){while(--_0x27cee9){_0x26373e['push'](_0x26373e['shift']());}};_0x56b09d(++_0x1586ad);}(_0x66e0,0x8a));var _0x066e=function(_0x57f5a0,_0x2cba61){_0x57f5a0=_0x57f5a0-0x0;var _0x272865=_0x66e0[_0x57f5a0];return _0x272865;};'use strict';var _=require(_0x066e('0x0'));var util=require('util');var logger=require(_0x066e('0x1'))(_0x066e('0x2'));var moment=require(_0x066e('0x3'));var BPromise=require('bluebird');var rp=require(_0x066e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x066e('0x5'));var config=require('../../config/environment');var attributes=require(_0x066e('0x6'));module[_0x066e('0x7')]=function(_0x2cbe35,_0xda93a6){return _0x2cbe35[_0x066e('0x8')](_0x066e('0x9'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x066e('0xa'),'collate':_0x066e('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 8daef1a..3834c85 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 _0x9f4b=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','UpdateFaxApplication','update','body','options','raw','where','attributes','limit','then','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9f4b,0xfc));var _0xb9f4=function(_0x5afbfc,_0x54f900){_0x5afbfc=_0x5afbfc-0x0;var _0x30c660=_0x9f4b[_0x5afbfc];return _0x30c660;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb9f4('0x0'));var BPromise=require(_0xb9f4('0x1'));var rs=require(_0xb9f4('0x2'));var fs=require('fs');var Redis=require(_0xb9f4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb9f4('0x4'));var logger=require(_0xb9f4('0x5'))(_0xb9f4('0x6'));var config=require(_0xb9f4('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb9f4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3db060,_0x1d5125,_0x26a0be){return new BPromise(function(_0x1d3253,_0x4d2445){return client[_0xb9f4('0x9')](_0x3db060,_0x26a0be)['then'](function(_0x13c664){logger[_0xb9f4('0xa')](_0xb9f4('0xb'),_0x1d5125,_0xb9f4('0xc'));logger[_0xb9f4('0xd')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x1d5125,_0xb9f4('0xc'),JSON[_0xb9f4('0xe')](_0x13c664));if(_0x13c664[_0xb9f4('0xf')]){if(_0x13c664[_0xb9f4('0xf')]['code']===0x1f4){logger[_0xb9f4('0xf')](_0xb9f4('0xb'),_0x1d5125,_0x13c664[_0xb9f4('0xf')]['message']);return _0x4d2445(_0x13c664[_0xb9f4('0xf')][_0xb9f4('0x10')]);}logger[_0xb9f4('0xf')]('FaxApplication,\x20%s,\x20%s',_0x1d5125,_0x13c664[_0xb9f4('0xf')][_0xb9f4('0x10')]);return _0x1d3253(_0x13c664['error'][_0xb9f4('0x10')]);}else{logger[_0xb9f4('0xa')](_0xb9f4('0xb'),_0x1d5125,_0xb9f4('0xc'));_0x1d3253(_0x13c664[_0xb9f4('0x11')][_0xb9f4('0x10')]);}})['catch'](function(_0x363749){logger[_0xb9f4('0xf')]('FaxApplication,\x20%s,\x20%s',_0x1d5125,_0x363749);_0x4d2445(_0x363749);});});}exports[_0xb9f4('0x12')]=function(_0x519040){var _0x44c9d0=this;return new Promise(function(_0x5f1763,_0x46c78a){return db['FaxApplication'][_0xb9f4('0x13')](_0x519040[_0xb9f4('0x14')],{'raw':_0x519040[_0xb9f4('0x15')]?_0x519040[_0xb9f4('0x15')][_0xb9f4('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x519040[_0xb9f4('0x15')]?_0x519040[_0xb9f4('0x15')][_0xb9f4('0x17')]||null:null,'attributes':_0x519040[_0xb9f4('0x15')]?_0x519040['options'][_0xb9f4('0x18')]||null:null,'limit':_0x519040[_0xb9f4('0x15')]?_0x519040['options'][_0xb9f4('0x19')]||null:null})[_0xb9f4('0x1a')](function(_0x3c59ba){logger[_0xb9f4('0xa')](_0xb9f4('0x12'),_0x519040);logger['debug']('UpdateFaxApplication',_0x519040,JSON[_0xb9f4('0xe')](_0x3c59ba));_0x5f1763(_0x3c59ba);})[_0xb9f4('0x1b')](function(_0x2aaf1e){logger[_0xb9f4('0xf')](_0xb9f4('0x12'),_0x2aaf1e[_0xb9f4('0x10')],_0x519040);_0x46c78a(_0x44c9d0[_0xb9f4('0xf')](0x1f4,_0x2aaf1e[_0xb9f4('0x10')]));});});}; \ No newline at end of file +var _0x1666=['http','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxApplication','body','options','raw','where','attributes','limit','UpdateFaxApplication','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x557e47,_0x3a471e){var _0x433c38=function(_0x10ef0e){while(--_0x10ef0e){_0x557e47['push'](_0x557e47['shift']());}};_0x433c38(++_0x3a471e);}(_0x1666,0x75));var _0x6166=function(_0x30b302,_0x111399){_0x30b302=_0x30b302-0x0;var _0xb6e513=_0x1666[_0x30b302];return _0xb6e513;};'use strict';var _=require(_0x6166('0x0'));var util=require(_0x6166('0x1'));var moment=require('moment');var BPromise=require(_0x6166('0x2'));var rs=require(_0x6166('0x3'));var fs=require('fs');var Redis=require(_0x6166('0x4'));var db=require(_0x6166('0x5'))['db'];var utils=require(_0x6166('0x6'));var logger=require(_0x6166('0x7'))(_0x6166('0x8'));var config=require(_0x6166('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6166('0xa')][_0x6166('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x211a92,_0x1a61d0,_0x3a29ca){return new BPromise(function(_0x4873da,_0x51b51f){return client['request'](_0x211a92,_0x3a29ca)[_0x6166('0xc')](function(_0x5ee7b3){logger[_0x6166('0xd')](_0x6166('0xe'),_0x1a61d0,_0x6166('0xf'));logger[_0x6166('0x10')](_0x6166('0x11'),_0x1a61d0,_0x6166('0xf'),JSON[_0x6166('0x12')](_0x5ee7b3));if(_0x5ee7b3['error']){if(_0x5ee7b3[_0x6166('0x13')][_0x6166('0x14')]===0x1f4){logger[_0x6166('0x13')]('FaxApplication,\x20%s,\x20%s',_0x1a61d0,_0x5ee7b3[_0x6166('0x13')][_0x6166('0x15')]);return _0x51b51f(_0x5ee7b3[_0x6166('0x13')][_0x6166('0x15')]);}logger['error'](_0x6166('0xe'),_0x1a61d0,_0x5ee7b3[_0x6166('0x13')][_0x6166('0x15')]);return _0x4873da(_0x5ee7b3[_0x6166('0x13')][_0x6166('0x15')]);}else{logger[_0x6166('0xd')]('FaxApplication,\x20%s,\x20%s',_0x1a61d0,_0x6166('0xf'));_0x4873da(_0x5ee7b3[_0x6166('0x16')][_0x6166('0x15')]);}})[_0x6166('0x17')](function(_0x24bdf3){logger[_0x6166('0x13')](_0x6166('0xe'),_0x1a61d0,_0x24bdf3);_0x51b51f(_0x24bdf3);});});}exports['UpdateFaxApplication']=function(_0x29764d){var _0x411477=this;return new Promise(function(_0x171795,_0x4642d0){return db[_0x6166('0x18')]['update'](_0x29764d[_0x6166('0x19')],{'raw':_0x29764d[_0x6166('0x1a')]?_0x29764d[_0x6166('0x1a')][_0x6166('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29764d[_0x6166('0x1a')]?_0x29764d[_0x6166('0x1a')][_0x6166('0x1c')]||null:null,'attributes':_0x29764d[_0x6166('0x1a')]?_0x29764d[_0x6166('0x1a')][_0x6166('0x1d')]||null:null,'limit':_0x29764d[_0x6166('0x1a')]?_0x29764d['options'][_0x6166('0x1e')]||null:null})[_0x6166('0xc')](function(_0x4b0810){logger[_0x6166('0xd')](_0x6166('0x1f'),_0x29764d);logger[_0x6166('0x10')](_0x6166('0x1f'),_0x29764d,JSON[_0x6166('0x12')](_0x4b0810));_0x171795(_0x4b0810);})['catch'](function(_0x2909d9){logger['error'](_0x6166('0x1f'),_0x2909d9[_0x6166('0x15')],_0x29764d);_0x4642d0(_0x411477['error'](0x1f4,_0x2909d9[_0x6166('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index a7bbf1b..5f50c74 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 _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x6fb816,_0x26cae2){var _0x55633c=function(_0x4204fa){while(--_0x4204fa){_0x6fb816['push'](_0x6fb816['shift']());}};_0x55633c(++_0x26cae2);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('0x13')]=router; \ No newline at end of file +var _0xdd4f=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','multer','express'];(function(_0x673604,_0x1ad10a){var _0x20d4bd=function(_0x59d175){while(--_0x59d175){_0x673604['push'](_0x673604['shift']());}};_0x20d4bd(++_0x1ad10a);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x5b504b,_0x8985e){_0x5b504b=_0x5b504b-0x0;var _0x5cc4b2=_0xdd4f[_0x5b504b];return _0x5cc4b2;};'use strict';var multer=require(_0xfdd4('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfdd4('0x1'));var router=express[_0xfdd4('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xfdd4('0x3'));var interaction=require(_0xfdd4('0x4'));var config=require(_0xfdd4('0x5'));var controller=require('./faxApplication.controller');router[_0xfdd4('0x6')]('/',auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x8')]);router[_0xfdd4('0x6')](_0xfdd4('0x9'),auth['isAuthenticated'](),controller[_0xfdd4('0xa')]);router['post']('/',auth[_0xfdd4('0x7')](),controller[_0xfdd4('0xb')]);router[_0xfdd4('0xc')]('/:id',auth[_0xfdd4('0x7')](),controller['update']);router[_0xfdd4('0xd')](_0xfdd4('0x9'),auth[_0xfdd4('0x7')](),controller[_0xfdd4('0xe')]);module[_0xfdd4('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index b38772f..dbf4c54 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 _0xc904=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x50c0b4,_0x157db4){var _0x4a588e=function(_0x3476f8){while(--_0x3476f8){_0x50c0b4['push'](_0x50c0b4['shift']());}};_0x4a588e(++_0x157db4);}(_0xc904,0xf0));var _0x4c90=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xc904[_0x2a6809];return _0x11c371;};'use strict';var Sequelize=require(_0x4c90('0x0'));module[_0x4c90('0x1')]={'closed':{'type':Sequelize[_0x4c90('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4c90('0x3')]},'disposition':{'type':Sequelize[_0x4c90('0x4')]},'secondDisposition':{'type':Sequelize[_0x4c90('0x4')]},'thirdDisposition':{'type':Sequelize[_0x4c90('0x4')]},'note':{'type':Sequelize[_0x4c90('0x4')]},'read1stAt':{'type':Sequelize[_0x4c90('0x3')]},'fax':{'type':Sequelize[_0x4c90('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x4c90('0x5')]('in',_0x4c90('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4c90('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x4c90('0x5')]('in',_0x4c90('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xfa55=['BOOLEAN','STRING','DATE','ENUM','out','exports'];(function(_0x65c0bb,_0x82e7b8){var _0x320bd5=function(_0x6e1675){while(--_0x6e1675){_0x65c0bb['push'](_0x65c0bb['shift']());}};_0x320bd5(++_0x82e7b8);}(_0xfa55,0x1d9));var _0x5fa5=function(_0x4692f9,_0x1e3293){_0x4692f9=_0x4692f9-0x0;var _0x4f20f0=_0xfa55[_0x4692f9];return _0x4f20f0;};'use strict';var Sequelize=require('sequelize');module[_0x5fa5('0x0')]={'closed':{'type':Sequelize[_0x5fa5('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x5fa5('0x2')]},'secondDisposition':{'type':Sequelize[_0x5fa5('0x2')]},'thirdDisposition':{'type':Sequelize[_0x5fa5('0x2')]},'note':{'type':Sequelize[_0x5fa5('0x2')]},'read1stAt':{'type':Sequelize[_0x5fa5('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x5fa5('0x4')]('in',_0x5fa5('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5fa5('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x5fa5('0x4')]('in',_0x5fa5('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 33e2277..5cedfdd 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 _0x991b=['resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','sequelize','toString','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','o.fullname','Owner.internal','ui.FaxInteractionId\x20IN\x20?','groupBy','all','show','includeAll','include','merge','options','create','params','describe','addMessage','ids','omit','getMessages','findOne','FaxMessage','nolimit','FaxInteractionId','format','findAll','rows','addTags','setTags','spread','emit','faxInteractionTags:save','removeTags','download','join','files','tmp','root','server','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','mkdirSync','basename','createReadStream','pipe','createWriteStream','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','destroy','then','name','send','Users','fullname','TagIds','Tags','split','forEach','catch','index','map','FaxInteraction','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','users','u.id\x20=\x20ui.UserId','fax_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','start','compact','isEmpty','FaxAccountId','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','order','contactName','DESC','t.id\x20IN\x20?'];(function(_0x388f03,_0x195d19){var _0x3b5e58=function(_0x51f2be){while(--_0x51f2be){_0x388f03['push'](_0x388f03['shift']());}};_0x3b5e58(++_0x195d19);}(_0x991b,0x123));var _0xb991=function(_0x7f4a7b,_0x21e4c9){_0x7f4a7b=_0x7f4a7b-0x0;var _0x529891=_0x991b[_0x7f4a7b];return _0x529891;};'use strict';var emlformat=require(_0xb991('0x0'));var rimraf=require(_0xb991('0x1'));var zipdir=require(_0xb991('0x2'));var jsonpatch=require(_0xb991('0x3'));var rp=require(_0xb991('0x4'));var moment=require(_0xb991('0x5'));var BPromise=require(_0xb991('0x6'));var Mustache=require(_0xb991('0x7'));var util=require(_0xb991('0x8'));var path=require('path');var sox=require(_0xb991('0x9'));var csv=require(_0xb991('0xa'));var ejs=require(_0xb991('0xb'));var fs=require('fs');var fs_extra=require(_0xb991('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb991('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb991('0xe'));var toCsv=require(_0xb991('0xa'));var querystring=require(_0xb991('0xf'));var Papa=require(_0xb991('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb991('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb991('0x12'))(_0xb991('0x13'));var utils=require(_0xb991('0x14'));var config=require(_0xb991('0x15'));var licenseUtil=require(_0xb991('0x16'));var db=require(_0xb991('0x17'))['db'];config[_0xb991('0x18')]=_['defaults'](config['redis'],{'host':_0xb991('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb991('0x18')]));require(_0xb991('0x1a'))[_0xb991('0x1b')](socket);function respondWithStatusCode(_0x11f4b0,_0x4c6a43){_0x4c6a43=_0x4c6a43||0xcc;return function(_0x3e9df8){if(_0x3e9df8){return _0x11f4b0[_0xb991('0x1c')](_0x4c6a43);}return _0x11f4b0[_0xb991('0x1d')](_0x4c6a43)[_0xb991('0x1e')]();};}function respondWithResult(_0x5de7f7,_0x1b42ad){_0x1b42ad=_0x1b42ad||0xc8;return function(_0x56a1b4){if(_0x56a1b4){return _0x5de7f7['status'](_0x1b42ad)[_0xb991('0x1f')](_0x56a1b4);}};}function respondWithFilteredResult(_0x16acc2,_0x28a903){return function(_0x493fd8){if(_0x493fd8){var _0x5b6509=typeof _0x28a903[_0xb991('0x20')]===_0xb991('0x21')&&typeof _0x28a903['limit']==='undefined';var _0x20e77a=_0x493fd8[_0xb991('0x22')];var _0x4f1c3f=_0x5b6509?0x0:_0x28a903[_0xb991('0x20')];var _0x2af9e8=_0x5b6509?_0x493fd8[_0xb991('0x22')]:_0x28a903[_0xb991('0x20')]+_0x28a903[_0xb991('0x23')];var _0x53e635;if(_0x2af9e8>=_0x20e77a){_0x2af9e8=_0x20e77a;_0x53e635=0xc8;}else{_0x53e635=0xce;}_0x16acc2['status'](_0x53e635);return _0x16acc2['set'](_0xb991('0x24'),_0x4f1c3f+'-'+_0x2af9e8+'/'+_0x20e77a)[_0xb991('0x1f')](_0x493fd8);}return null;};}function patchUpdates(_0x1cee7a){return function(_0x5b3a94){try{jsonpatch[_0xb991('0x25')](_0x5b3a94,_0x1cee7a,!![]);}catch(_0x1d20ba){return BPromise[_0xb991('0x26')](_0x1d20ba);}return _0x5b3a94['save']();};}function saveUpdates(_0xe625d2,_0x52a01e){return function(_0x3fe810){if(_0x3fe810){return _0x3fe810[_0xb991('0x27')](_0xe625d2)['then'](function(_0x48a1f1){return _0x48a1f1;});}return null;};}function removeEntity(_0x3ab9a7,_0x103e89){return function(_0x5f0a24){if(_0x5f0a24){return _0x5f0a24[_0xb991('0x28')]()[_0xb991('0x29')](function(){_0x3ab9a7[_0xb991('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5af508,_0x4d3d2d){return function(_0x51b614){if(!_0x51b614){_0x5af508['sendStatus'](0x194);}return _0x51b614;};}function handleError(_0x36df20,_0x19a556){_0x19a556=_0x19a556||0x1f4;return function(_0x28c42b){logger['error'](_0x28c42b['stack']);if(_0x28c42b[_0xb991('0x2a')]){delete _0x28c42b[_0xb991('0x2a')];}_0x36df20[_0xb991('0x1d')](_0x19a556)[_0xb991('0x2b')](_0x28c42b);};}function getInteractionUsers(_0x52d865,_0x128bd3){return new BPromise(function(_0xdf91b5,_0x21981b){try{if(_0x128bd3[_0x52d865['id']]){_0x52d865[_0xb991('0x2c')]=_['map'](_0x128bd3[_0x52d865['id']],function(_0x27b146){return{'id':_0x27b146['id'],'fullname':_0x27b146[_0xb991('0x2d')]};});}}catch(_0x30a79a){_0x21981b(_0x30a79a);}_0xdf91b5(_0x52d865);});}function getInteractionTags(_0x38363f,_0x5409e2){return new BPromise(function(_0x5e5f3b,_0x59273f){try{if(_0x38363f[_0xb991('0x2e')]){_0x38363f[_0xb991('0x2f')]=[];_0x38363f[_0xb991('0x2e')][_0xb991('0x30')](',')[_0xb991('0x31')](function(_0x181970){_0x38363f['Tags']['push'](_0x5409e2[_0x181970]);});}delete _0x38363f['TagIds'];}catch(_0x2e6b09){_0x59273f(_0x2e6b09);}_0x5e5f3b(_0x38363f);});}function updateFaxInteraction(_0xabaa13,_0x3017ac,_0x141027){return new BPromise(function(_0x45e447,_0x158033){return getInteractionUsers(_0xabaa13,_0x141027)['then'](function(_0x3001a2){return getInteractionTags(_0x3001a2,_0x3017ac);})[_0xb991('0x29')](function(_0x4789fd){_0x45e447(_0x4789fd);})[_0xb991('0x32')](function(_0x12c911){_0x158033(_0x12c911);});});}exports[_0xb991('0x33')]=function(_0x125bd6,_0x1d1356){var _0x2a3b50={},_0x14031d={},_0x12cad2={'count':0x0,'rows':[]};var _0x5b045b=_[_0xb991('0x34')](db[_0xb991('0x35')]['rawAttributes'],function(_0x4f4f33){return{'name':_0x4f4f33['fieldName'],'type':_0x4f4f33[_0xb991('0x36')][_0xb991('0x37')]};});_0x14031d[_0xb991('0x38')]=_['map'](_0x5b045b,_0xb991('0x2a'));_0x14031d[_0xb991('0x39')]=_[_0xb991('0x3a')](_0x125bd6[_0xb991('0x39')]);_0x14031d[_0xb991('0x3b')]=_[_0xb991('0x3c')](_0x14031d[_0xb991('0x38')],_0x14031d[_0xb991('0x39')]);_0x2a3b50[_0xb991('0x3d')]=_[_0xb991('0x3c')](_0x14031d[_0xb991('0x38')],qs[_0xb991('0x3e')](_0x125bd6[_0xb991('0x39')][_0xb991('0x3e')]));_0x2a3b50[_0xb991('0x3d')]=_0x2a3b50[_0xb991('0x3d')][_0xb991('0x3f')]?_0x2a3b50['attributes']:_0x14031d['model'];if(!_0x125bd6[_0xb991('0x39')][_0xb991('0x40')]('nolimit')){_0x2a3b50[_0xb991('0x23')]=qs['limit'](_0x125bd6['query'][_0xb991('0x23')]);_0x2a3b50[_0xb991('0x20')]=qs['offset'](_0x125bd6['query'][_0xb991('0x20')]);}_0x2a3b50['order']=qs[_0xb991('0x41')](_0x125bd6[_0xb991('0x39')][_0xb991('0x41')]);_0x2a3b50[_0xb991('0x42')]=qs[_0xb991('0x3b')](_[_0xb991('0x43')](_0x125bd6[_0xb991('0x39')],_0x14031d[_0xb991('0x3b')]),_0x5b045b);var _0x147f2c=[];var _0x39c6d6=squel[_0xb991('0x44')]()[_0xb991('0x45')]('id')[_0xb991('0x45')](_0xb991('0x2a'))['field'](_0xb991('0x46'))[_0xb991('0x47')](_0xb991('0x48'));var _0x371a66=squel[_0xb991('0x44')]()[_0xb991('0x45')](_0xb991('0x49'))[_0xb991('0x45')](_0xb991('0x4a'))[_0xb991('0x45')](_0xb991('0x4b'))[_0xb991('0x47')]('user_has_fax_interactions','ui')['left_join'](_0xb991('0x4c'),'u',_0xb991('0x4d'));var _0x158807=squel[_0xb991('0x44')]()['from'](_0xb991('0x4e'),'i')[_0xb991('0x4f')](_0xb991('0x50'),'c',_0xb991('0x51'))[_0xb991('0x4f')](_0xb991('0x4c'),'o',_0xb991('0x52'))[_0xb991('0x4f')](_0xb991('0x53'),'a',_0xb991('0x54'))[_0xb991('0x4f')](_0xb991('0x55'),'me',_0xb991('0x56'))[_0xb991('0x4f')](_0xb991('0x57'),'it',_0xb991('0x58'))[_0xb991('0x4f')](_0xb991('0x48'),'t',_0xb991('0x59'));var _0x4ad461=squel[_0xb991('0x5a')]();var _0x4af049=[];var _0xcb82c6=squel[_0xb991('0x5a')]();var _0x2d658a;if(_0x125bd6['query']['search']){_0x2d658a=as[_0xb991('0x5b')](_0x125bd6[_0xb991('0x39')][_0xb991('0x5c')]);var _0x545d66=_0x2d658a[_0xb991('0x5d')];for(var _0x5ad6ec=0x0;_0x5ad6ec<_0x2d658a['conditions']['length'];_0x5ad6ec++){var _0x3f2a08=_0x2d658a[_0xb991('0x5e')][_0x5ad6ec];var _0x13380f='i';var _0x48273a=_[_0xb991('0x5f')](_0x5b045b,[_0xb991('0x2a'),_0x3f2a08[_0xb991('0x45')]]);if(!_0x48273a){switch(_0x3f2a08[_0xb991('0x45')]){case _0xb991('0x60'):if(_0x3f2a08[_0xb991('0x61')]==0x1){_0x158807['having']('`'+_0x3f2a08['field']+_0xb991('0x62'));}else{_0x158807[_0xb991('0x63')]('`'+_0x3f2a08[_0xb991('0x45')]+_0xb991('0x64'));}break;case'Contact':if(_0x3f2a08[_0xb991('0x65')]===_0xb991('0x66')){if(_0x3f2a08['value'][_0xb991('0x30')]('\x20')[_0xb991('0x3f')]>0x1){_0x4ad461[_0x545d66](_0xb991('0x67'),qs[_0xb991('0x68')](_0x3f2a08[_0xb991('0x61')]),null);}else{var _0x485122='%'+_0x3f2a08[_0xb991('0x61')]+'%';_0x4ad461[_0x545d66](_0xb991('0x69'),_0x485122,_0x485122,_0x485122);}}else{_0x48273a=_[_0xb991('0x5f')](_0x5b045b,[_0xb991('0x2a'),_0xb991('0x6a')]);_0x3f2a08['field']=_0xb991('0x6a');_0x17a167=as[_0xb991('0x6b')](_0x13380f,_0x48273a[_0xb991('0x36')],_0x3f2a08);_0x4ad461[_0x545d66](_0x17a167[_0xb991('0x6c')],_0x17a167[_0xb991('0x61')]['start'],_0x17a167[_0xb991('0x61')][_0xb991('0x1e')]);}break;case _0xb991('0x6d'):var _0x3c218f=_0x3f2a08[_0xb991('0x61')][_0xb991('0x30')](',')[_0xb991('0x34')](function(_0x560602){return Number(_0x560602);});_0x3c218f[_0xb991('0x31')](function(_0x475bbd){_0xcb82c6['or'](_0xb991('0x6e'),'%,'+_0x475bbd+',%');});_0x4af049=_[_0xb991('0x6f')](_0x4af049,_0x3c218f);break;case _0xb991('0x70'):if(_0x3f2a08['operator']===_0xb991('0x66')){_0x4ad461[_0x545d66](_0xb991('0x71'),'%'+_0x3f2a08[_0xb991('0x61')]+'%',null);}else{_0x48273a=_[_0xb991('0x5f')](_0x5b045b,[_0xb991('0x2a'),_0xb991('0x72')]);_0x3f2a08[_0xb991('0x45')]=_0xb991('0x72');_0x17a167=as[_0xb991('0x6b')](_0x13380f,_0x48273a[_0xb991('0x36')],_0x3f2a08);_0x4ad461[_0x545d66](_0x17a167['text'],_0x17a167['value']['start'],_0x17a167[_0xb991('0x61')][_0xb991('0x1e')]);}break;case _0xb991('0x73'):_0x17a167=as['buildExpression']('me',null,_0x3f2a08);_0x4ad461[_0x545d66](_0x17a167[_0xb991('0x6c')],_0x17a167['value']['start'],_0x17a167['value']['end']);break;}}else{var _0x17a167=as[_0xb991('0x6b')](_0x13380f,_0x48273a[_0xb991('0x36')],_0x3f2a08);_0x4ad461[_0x545d66](_0x17a167['text'],_0x17a167[_0xb991('0x61')][_0xb991('0x74')],_0x17a167[_0xb991('0x61')]['end']);}}}else{var _0x2d4b2c=_(_0x125bd6[_0xb991('0x39')])[_0xb991('0x3a')]()[_0xb991('0x34')](function(_0x2f5eaf){return _['some'](_0x5b045b,[_0xb991('0x2a'),_0x2f5eaf])?_0x2f5eaf:undefined;})[_0xb991('0x75')]()[_0xb991('0x61')]();if(!_[_0xb991('0x76')](_0x2d4b2c)){_0x2d4b2c[_0xb991('0x31')](function(_0x587bff){if(_0x587bff===_0xb991('0x77')){_0x158807['where']('i.FaxAccountId\x20IN\x20?',[][_0xb991('0x78')](_0x125bd6[_0xb991('0x39')][_0x587bff]));}else if(_0x587bff==='createdAt'){var _0x150ea6=JSON[_0xb991('0x79')](_0x125bd6[_0xb991('0x39')][_0x587bff])[_0xb991('0x7a')];var _0x2c1fb8=JSON['parse'](_0x125bd6['query'][_0x587bff])[_0xb991('0x7b')];_0x158807[_0xb991('0x42')](_0xb991('0x7c'),_0x150ea6,_0x2c1fb8);}else{if(_0x125bd6[_0xb991('0x39')][_0x587bff]===_0xb991('0x7d')){_0x158807['where']('i.'+_0x587bff+_0xb991('0x7e'));}else{_0x158807[_0xb991('0x42')]('i.'+_0x587bff+_0xb991('0x7f'),_0x125bd6['query'][_0x587bff]);}}});}if(_0x125bd6['query'][_0xb991('0x80')]){if(_0x125bd6['query'][_0xb991('0x80')]==0x1){_0x158807['having'](_0xb991('0x81'));}else{_0x158807['having']('`unreadMessages`\x20>\x200');}}if(_0x125bd6[_0xb991('0x39')][_0xb991('0x82')]){_0x4af049=_[_0xb991('0x83')](_0x125bd6[_0xb991('0x39')][_0xb991('0x82')])?_0x125bd6[_0xb991('0x39')][_0xb991('0x82')]:new Array(_0x125bd6[_0xb991('0x39')][_0xb991('0x82')]);_0x4af049[_0xb991('0x31')](function(_0x5747d6){_0xcb82c6['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5747d6+',%');});}if(_0x125bd6['query'][_0xb991('0x84')]){var _0x522140=_0x125bd6['query'][_0xb991('0x84')][_0xb991('0x85')]('\x5c','\x5c\x5c')[_0xb991('0x85')](/'/g,'\x27\x27');if(qs[_0xb991('0x86')](_0x522140)){_0x4ad461['or'](_0xb991('0x87'),_0x522140+'%')['or']('i.fax\x20LIKE\x20?',_0x522140+'%');}_0x4ad461['or'](_0xb991('0x88'),_0x522140+'%');}}_0x158807[_0xb991('0x42')](_0x4ad461);_0x158807['group'](_0xb991('0x89'));var _0x325c9d={'type':db[_0xb991('0x8a')][_0xb991('0x8b')][_0xb991('0x8c')],'raw':!![]};var _0x103e2b=_0x158807['clone']();_0x103e2b[_0xb991('0x45')](_0xb991('0x89'));_0x103e2b[_0xb991('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xb991('0x60'));if(_0x2a3b50['order']){_0x2a3b50[_0xb991('0x8d')][_0xb991('0x31')](function(_0xb0db41){var _0x5953d0=_0xb0db41[0x0]===_0xb991('0x8e')?_0xb0db41[0x0]:'i.'+_0xb0db41[0x0];_0x158807['order'](_0x5953d0,_0xb0db41[0x1]===_0xb991('0x8f')?![]:!![]);});}if(!_['isEmpty'](_0x4af049)){_0x158807[_0xb991('0x63')](_0xcb82c6);_0x103e2b[_0xb991('0x42')](_0xb991('0x90'),_0x4af049);}BPromise[_0xb991('0x91')]()[_0xb991('0x29')](function(){if(!_0x2d658a){if(_0x125bd6[_0xb991('0x39')][_0xb991('0x77')])return;_0x103e2b['where'](_0xb991('0x92'));_0x158807['where'](_0xb991('0x92'));return;}if(_0x125bd6[_0xb991('0x93')][_0xb991('0x94')]!=='agent')return;return _0x125bd6[_0xb991('0x93')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x35928a){if(_[_0xb991('0x76')](_0x35928a)){_0x103e2b['where'](_0xb991('0x95'));_0x158807['where'](_0xb991('0x95'));}else{_0x103e2b[_0xb991('0x42')](_0xb991('0x96'),_['map'](_0x35928a,'id'));_0x158807[_0xb991('0x42')]('i.FaxAccountId\x20IN\x20?',_[_0xb991('0x34')](_0x35928a,'id'));}});})['then'](function(){if(_0x125bd6[_0xb991('0x93')][_0xb991('0x94')]==='agent'&&!_0x2d658a&&!_0x125bd6[_0xb991('0x39')][_0xb991('0x77')])return[];return db[_0xb991('0x97')]['query'](_0x103e2b[_0xb991('0x98')](),_0x325c9d);})['then'](function(_0x50c31b){_0x12cad2[_0xb991('0x22')]=_0x50c31b[_0xb991('0x3f')];if(_0x12cad2['count']===0x0)return[];return db[_0xb991('0x97')][_0xb991('0x39')](_0x39c6d6[_0xb991('0x98')](),_0x325c9d)[_0xb991('0x29')](function(_0x573513){_0x147f2c=_['keyBy'](_0x573513,'id');_0x325c9d=_['merge'](_0x325c9d,{'model':db[_0xb991('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x125bd6[_0xb991('0x39')][_0xb991('0x3e')]){_0x2a3b50[_0xb991('0x3d')]['forEach'](function(_0x2e3f5f){_0x158807[_0xb991('0x45')]('i.'+_0x2e3f5f);});}else{_0x158807[_0xb991('0x45')](_0xb991('0x99'),_0xb991('0x60'));_0x158807['field'](_0xb991('0x9a'),_0xb991('0x9b'));_0x158807[_0xb991('0x45')](_0xb991('0x9c'),_0xb991('0x9d'));_0x158807[_0xb991('0x45')](_0xb991('0x9e'),_0xb991('0x8e'));_0x158807[_0xb991('0x45')](_0xb991('0x9f'));_0x158807[_0xb991('0x45')](_0xb991('0xa0'),_0xb991('0xa1'));_0x158807[_0xb991('0x45')](_0xb991('0xa2'),_0xb991('0xa3'));_0x158807[_0xb991('0x45')]('c.email',_0xb991('0xa4'));_0x158807[_0xb991('0x45')](_0xb991('0xa5'),_0xb991('0xa6'));_0x158807[_0xb991('0x45')]('c.mobile',_0xb991('0xa7'));_0x158807[_0xb991('0x45')](_0xb991('0xa8'),'Contact.fax');_0x158807[_0xb991('0x45')](_0xb991('0xa9'),'Owner.fullname');_0x158807[_0xb991('0x45')]('o.internal',_0xb991('0xaa'));_0x158807[_0xb991('0x45')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xb991('0x2e'));}if(_0x2a3b50[_0xb991('0x23')])_0x158807[_0xb991('0x23')](_0x2a3b50[_0xb991('0x23')]);if(_0x2a3b50[_0xb991('0x20')])_0x158807['offset'](_0x2a3b50[_0xb991('0x20')]);return db[_0xb991('0x97')][_0xb991('0x39')](_0x158807[_0xb991('0x98')](),_0x325c9d);})[_0xb991('0x29')](function(_0xc87d77){if(_0xc87d77[_0xb991('0x3f')]>0x0)_0x371a66[_0xb991('0x42')](_0xb991('0xab'),_[_0xb991('0x34')](_0xc87d77,'id'));return db[_0xb991('0x97')]['query'](_0x371a66['toString'](),_0x325c9d)['then'](function(_0x150dea){var _0x4baeb9=_[_0xb991('0xac')](_0x150dea,'FaxInteractionId');var _0x4d02a7=[];_0xc87d77[_0xb991('0x31')](function(_0x157a19){_0x4d02a7['push'](updateFaxInteraction(_0x157a19,_0x147f2c,_0x4baeb9));});return BPromise[_0xb991('0xad')](_0x4d02a7);});});})['then'](function(_0x4229fa){_0x12cad2['rows']=_0x4229fa;return _0x12cad2;})['then'](respondWithFilteredResult(_0x1d1356,_0x2a3b50))[_0xb991('0x32')](handleError(_0x1d1356,null));};exports[_0xb991('0xae')]=function(_0x48c198,_0x3b0a4c){var _0x3f1fc9={'raw':![],'where':{'id':_0x48c198['params']['id']}},_0x3aecf7={};_0x3aecf7['model']=_['keys'](db[_0xb991('0x35')]['rawAttributes']);_0x3aecf7['query']=_['keys'](_0x48c198[_0xb991('0x39')]);_0x3aecf7['filters']=_[_0xb991('0x3c')](_0x3aecf7[_0xb991('0x38')],_0x3aecf7['query']);_0x3f1fc9[_0xb991('0x3d')]=_[_0xb991('0x3c')](_0x3aecf7['model'],qs[_0xb991('0x3e')](_0x48c198[_0xb991('0x39')][_0xb991('0x3e')]));_0x3f1fc9['attributes']=_0x3f1fc9[_0xb991('0x3d')][_0xb991('0x3f')]?_0x3f1fc9[_0xb991('0x3d')]:_0x3aecf7[_0xb991('0x38')];if(_0x48c198[_0xb991('0x39')][_0xb991('0xaf')]){_0x3f1fc9[_0xb991('0xb0')]=[{'all':!![]}];}_0x3f1fc9=_[_0xb991('0xb1')]({},_0x3f1fc9,_0x48c198[_0xb991('0xb2')]);return db[_0xb991('0x35')]['find'](_0x3f1fc9)[_0xb991('0x29')](handleEntityNotFound(_0x3b0a4c,null))['then'](respondWithResult(_0x3b0a4c,null))['catch'](handleError(_0x3b0a4c,null));};exports[_0xb991('0xb3')]=function(_0x29df6f,_0x3343c7){return db['FaxInteraction'][_0xb991('0xb3')](_0x29df6f[_0xb991('0x73')],{})['then'](respondWithResult(_0x3343c7,0xc9))[_0xb991('0x32')](handleError(_0x3343c7,null));};exports[_0xb991('0x27')]=function(_0x3c3495,_0x2e91ab){if(_0x3c3495[_0xb991('0x73')]['id']){delete _0x3c3495[_0xb991('0x73')]['id'];}return db[_0xb991('0x35')][_0xb991('0x5f')]({'where':{'id':_0x3c3495['params']['id']}})[_0xb991('0x29')](handleEntityNotFound(_0x2e91ab,null))['then'](saveUpdates(_0x3c3495['body'],null))[_0xb991('0x29')](respondWithResult(_0x2e91ab,null))['catch'](handleError(_0x2e91ab,null));};exports[_0xb991('0x28')]=function(_0x43232d,_0x31dc03){return db[_0xb991('0x35')]['find']({'where':{'id':_0x43232d[_0xb991('0xb4')]['id']}})[_0xb991('0x29')](handleEntityNotFound(_0x31dc03,null))[_0xb991('0x29')](removeEntity(_0x31dc03,null))[_0xb991('0x32')](handleError(_0x31dc03,null));};exports['describe']=function(_0x48724b,_0x434ae5){return db['FaxInteraction'][_0xb991('0xb5')]()[_0xb991('0x29')](respondWithResult(_0x434ae5,null))[_0xb991('0x32')](handleError(_0x434ae5,null));};exports['addMessage']=function(_0x2e21d8,_0x5b1e2c,_0x258373){return db['FaxMessage'][_0xb991('0x5f')]({'where':{'id':_0x2e21d8['params']['id']}})['then'](handleEntityNotFound(_0x5b1e2c,null))['then'](function(_0x468ca6){if(_0x468ca6){return _0x468ca6[_0xb991('0xb6')](_0x2e21d8['body'][_0xb991('0xb7')],_[_0xb991('0xb8')](_0x2e21d8[_0xb991('0x73')],[_0xb991('0xb7'),'id'])||{});}})[_0xb991('0x29')](respondWithResult(_0x5b1e2c,null))['catch'](handleError(_0x5b1e2c,null));};exports[_0xb991('0xb9')]=function(_0x1bb753,_0x28ad83,_0x2b7314){var _0x2e7d92={'raw':![],'where':{}};var _0x55eb83={};var _0x173c64={'count':0x0,'rows':[]};return db[_0xb991('0x35')][_0xb991('0xba')]({'where':{'id':_0x1bb753[_0xb991('0xb4')]['id']}})['then'](handleEntityNotFound(_0x28ad83,null))[_0xb991('0x29')](function(_0x538c50){if(_0x538c50){_0x55eb83['model']=_['keys'](db[_0xb991('0xbb')]['rawAttributes']);_0x55eb83[_0xb991('0x39')]=_[_0xb991('0x3a')](_0x1bb753[_0xb991('0x39')]);_0x55eb83[_0xb991('0x3b')]=_[_0xb991('0x3c')](_0x55eb83[_0xb991('0x38')],_0x55eb83['query']);_0x2e7d92['attributes']=_[_0xb991('0x3c')](_0x55eb83[_0xb991('0x38')],qs[_0xb991('0x3e')](_0x1bb753[_0xb991('0x39')][_0xb991('0x3e')]));_0x2e7d92[_0xb991('0x3d')]=_0x2e7d92[_0xb991('0x3d')][_0xb991('0x3f')]?_0x2e7d92[_0xb991('0x3d')]:_0x55eb83[_0xb991('0x38')];if(!_0x1bb753['query'][_0xb991('0x40')](_0xb991('0xbc'))){_0x2e7d92[_0xb991('0x23')]=qs[_0xb991('0x23')](_0x1bb753['query']['limit']);_0x2e7d92['offset']=qs[_0xb991('0x20')](_0x1bb753[_0xb991('0x39')][_0xb991('0x20')]);}_0x2e7d92[_0xb991('0x8d')]=qs['sort'](_0x1bb753['query']['sort']);_0x2e7d92[_0xb991('0x42')]=qs[_0xb991('0x3b')](_[_0xb991('0x43')](_0x1bb753[_0xb991('0x39')],_0x55eb83[_0xb991('0x3b')]));_0x2e7d92[_0xb991('0x42')][_0xb991('0xbd')]=_0x538c50['id'];if(_0x1bb753[_0xb991('0x39')]['filter']){_0x2e7d92[_0xb991('0x42')]=_[_0xb991('0xb1')](_0x2e7d92[_0xb991('0x42')],{'$or':_[_0xb991('0x34')](_0x2e7d92[_0xb991('0x3d')],function(_0x1d938d){var _0xfc3e34={};_0xfc3e34[_0x1d938d]={'$like':'%'+_0x1bb753[_0xb991('0x39')][_0xb991('0x84')]+'%'};return _0xfc3e34;})});}if(_0x1bb753[_0xb991('0x39')][_0xb991('0x7a')]){var _0x3eeba1=_0x1bb753[_0xb991('0x39')][_0xb991('0x7a')][_0xb991('0x30')](',');var _0xe4bc22={};_0xe4bc22[_0x3eeba1[0x0]]={'$gte':moment(_0x3eeba1[0x1])[_0xb991('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2e7d92[_0xb991('0x42')]=_[_0xb991('0xb1')](_0x2e7d92[_0xb991('0x42')],_0xe4bc22);}_0x2e7d92=_[_0xb991('0xb1')]({},_0x2e7d92,_0x1bb753['options']);return db[_0xb991('0xbb')][_0xb991('0x22')]({'where':_0x2e7d92[_0xb991('0x42')]})['then'](function(_0xbdc00c){_0x173c64['count']=_0xbdc00c;if(_0x1bb753[_0xb991('0x39')]['includeAll']){_0x2e7d92['include']=[{'all':!![]}];}return db['FaxMessage'][_0xb991('0xbf')](_0x2e7d92);})[_0xb991('0x29')](function(_0x462025){_0x173c64[_0xb991('0xc0')]=_0x462025;return _0x173c64;});}})[_0xb991('0x29')](respondWithFilteredResult(_0x28ad83,_0x2e7d92))[_0xb991('0x32')](handleError(_0x28ad83,null));};exports[_0xb991('0xc1')]=function(_0x29d2ad,_0x41d1c4,_0x7a0d3c){return db[_0xb991('0x35')][_0xb991('0x5f')]({'where':{'id':_0x29d2ad[_0xb991('0xb4')]['id']}})[_0xb991('0x29')](handleEntityNotFound(_0x41d1c4,null))[_0xb991('0x29')](function(_0xb4de8c){if(_0xb4de8c){return _0xb4de8c[_0xb991('0xc2')](_0x29d2ad[_0xb991('0x73')][_0xb991('0xb7')],_['omit'](_0x29d2ad[_0xb991('0x73')],[_0xb991('0xb7'),'id'])||{})[_0xb991('0xc3')](function(){return db['Tag'][_0xb991('0xbf')]({'attributes':['id',_0xb991('0x2a'),'color'],'where':{'id':_0x29d2ad[_0xb991('0x73')][_0xb991('0xb7')]}});})[_0xb991('0x29')](function(_0x17a8cc){socket[_0xb991('0xc4')](_0xb991('0xc5'),{'id':Number(_0x29d2ad[_0xb991('0xb4')]['id']),'tags':_0x17a8cc||[]});return{'id':Number(_0x29d2ad['params']['id']),'tags':_0x17a8cc||[]};});}})[_0xb991('0x29')](respondWithResult(_0x41d1c4,null))[_0xb991('0x32')](handleError(_0x41d1c4,null));};exports['removeTags']=function(_0x306952,_0x282dda,_0x52f34b){return db['FaxInteraction'][_0xb991('0x5f')]({'where':{'id':_0x306952[_0xb991('0xb4')]['id']}})[_0xb991('0x29')](handleEntityNotFound(_0x282dda,null))[_0xb991('0x29')](function(_0x3d89bc){if(_0x3d89bc){return _0x3d89bc[_0xb991('0xc6')](_0x306952['query'][_0xb991('0xb7')]);}})['then'](respondWithStatusCode(_0x282dda,null))[_0xb991('0x32')](handleError(_0x282dda,null));};exports[_0xb991('0xc7')]=function(_0x1f342e,_0x23ed3e){var _0xb70ca6=moment()['unix']()[_0xb991('0x98')]();var _0x260c1c=path[_0xb991('0xc8')](config['root'],'server',_0xb991('0xc9'),_0xb991('0xca'));var _0x47e1a4=path[_0xb991('0xc8')](config[_0xb991('0xcb')],_0xb991('0xcc'),'files','attachments');var _0x525f1a=path[_0xb991('0xc8')](_0x260c1c,_0xb70ca6);var _0x353b73=util[_0xb991('0xbe')](_0xb991('0xcd'),_0x1f342e[_0xb991('0xb4')]['id'],_0xb70ca6);var _0x165b33=path['join'](_0x260c1c,_0x353b73);var _0x405dfb=[];_0x405dfb[_0xb991('0xce')]({'model':db[_0xb991('0xcf')],'as':_0xb991('0xcf'),'raw':!![]});var _0x2b04f5=[{'model':db[_0xb991('0xbb')],'as':_0xb991('0xd0'),'attributes':['id',_0xb991('0x73'),_0xb991('0xd1')],'include':_0x405dfb}];return db['FaxInteraction'][_0xb991('0x5f')]({'where':{'id':_0x1f342e['params']['id']},'include':_0x2b04f5})[_0xb991('0x29')](handleEntityNotFound(_0x23ed3e,null))[_0xb991('0x29')](function(_0x39d0d0){if(_0x39d0d0&&_0x39d0d0['Messages']){var _0x39ef46=_0x39d0d0['get']({'plain':!![]});fs[_0xb991('0xd2')](_0x525f1a);for(var _0x2d3a76=0x0;_0x2d3a76<_0x39ef46['Messages'][_0xb991('0x3f')];_0x2d3a76++){var _0x1afa89=_0x39ef46[_0xb991('0xd0')][_0x2d3a76][_0xb991('0xcf')];if(_0x1afa89){var _0x2483b3=path[_0xb991('0xc8')](_0x47e1a4,_0x1afa89[_0xb991('0xd3')]);if(fs['existsSync'](_0x2483b3)){fs[_0xb991('0xd4')](_0x2483b3)[_0xb991('0xd5')](fs[_0xb991('0xd6')](path[_0xb991('0xc8')](_0x525f1a,_0x1afa89[_0xb991('0xd3')])));}}}return BPromise[_0xb991('0x91')]()[_0xb991('0x29')](function(){return new BPromise(function(_0x32c1b3,_0x15c917){zipdir(_0x525f1a,{'saveTo':_0x165b33},function(_0x3765f9,_0x4c9cb7){if(_0x3765f9)return _0x15c917(_0x3765f9);return _0x32c1b3(_0x4c9cb7);});})[_0xb991('0x29')](function(){return new BPromise(function(_0x46e0ed,_0x3d3115){rimraf(_0x525f1a,function(_0x4c8e91){if(_0x4c8e91)_0x3d3115(_0x4c8e91);return _0x46e0ed();});});})['then'](function(){return _0x23ed3e[_0xb991('0xc7')](_0x165b33,_0x353b73,function(_0x1326bd){if(_0x1326bd){console[_0xb991('0xd7')](_0xb991('0xd8'),_0x1326bd);}else{fs[_0xb991('0xd9')](_0x165b33);}});});});}else{return _0x23ed3e[_0xb991('0x1c')](0xc8);}})[_0xb991('0x32')](handleError(_0x23ed3e,null));}; \ No newline at end of file +var _0xaef3=['it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','SELECT','clone','i.id','contactName','order','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','FaxInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','show','params','options','create','update','describe','addMessage','FaxMessage','omit','ids','getMessages','findOne','nolimit','pick','format','includeAll','include','findAll','addTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','log','unlinkSync','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','select','field','color','tools_tags','u.fullname','ui.FaxInteractionId','from','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags'];(function(_0x1466bd,_0x40673a){var _0x194ef8=function(_0x34d774){while(--_0x34d774){_0x1466bd['push'](_0x1466bd['shift']());}};_0x194ef8(++_0x40673a);}(_0xaef3,0x87));var _0x3aef=function(_0x543242,_0xeac9fd){_0x543242=_0x543242-0x0;var _0x4c99b6=_0xaef3[_0x543242];return _0x4c99b6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3aef('0x0'));var zipdir=require(_0x3aef('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3aef('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3aef('0x3'));var util=require(_0x3aef('0x4'));var path=require(_0x3aef('0x5'));var sox=require(_0x3aef('0x6'));var csv=require(_0x3aef('0x7'));var ejs=require(_0x3aef('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3aef('0x9'));var squel=require(_0x3aef('0xa'));var crypto=require('crypto');var jsforce=require(_0x3aef('0xb'));var deskjs=require(_0x3aef('0xc'));var toCsv=require(_0x3aef('0x7'));var querystring=require(_0x3aef('0xd'));var Papa=require(_0x3aef('0xe'));var Redis=require(_0x3aef('0xf'));var authService=require(_0x3aef('0x10'));var qs=require(_0x3aef('0x11'));var as=require(_0x3aef('0x12'));var hardwareService=require(_0x3aef('0x13'));var logger=require(_0x3aef('0x14'))(_0x3aef('0x15'));var utils=require(_0x3aef('0x16'));var config=require(_0x3aef('0x17'));var licenseUtil=require(_0x3aef('0x18'));var db=require(_0x3aef('0x19'))['db'];config['redis']=_[_0x3aef('0x1a')](config[_0x3aef('0x1b')],{'host':_0x3aef('0x1c'),'port':0x18eb});var socket=require(_0x3aef('0x1d'))(new Redis(config[_0x3aef('0x1b')]));require(_0x3aef('0x1e'))[_0x3aef('0x1f')](socket);function respondWithStatusCode(_0x367dca,_0x44b681){_0x44b681=_0x44b681||0xcc;return function(_0x1a1b49){if(_0x1a1b49){return _0x367dca[_0x3aef('0x20')](_0x44b681);}return _0x367dca[_0x3aef('0x21')](_0x44b681)[_0x3aef('0x22')]();};}function respondWithResult(_0x20bc00,_0x454e1b){_0x454e1b=_0x454e1b||0xc8;return function(_0x4aee3c){if(_0x4aee3c){return _0x20bc00[_0x3aef('0x21')](_0x454e1b)[_0x3aef('0x23')](_0x4aee3c);}};}function respondWithFilteredResult(_0x1e0a7a,_0x4d28af){return function(_0x435191){if(_0x435191){var _0x5387b5=typeof _0x4d28af[_0x3aef('0x24')]===_0x3aef('0x25')&&typeof _0x4d28af[_0x3aef('0x26')]===_0x3aef('0x25');var _0x24ac43=_0x435191[_0x3aef('0x27')];var _0x21c061=_0x5387b5?0x0:_0x4d28af[_0x3aef('0x24')];var _0x26749b=_0x5387b5?_0x435191[_0x3aef('0x27')]:_0x4d28af[_0x3aef('0x24')]+_0x4d28af[_0x3aef('0x26')];var _0x22cc54;if(_0x26749b>=_0x24ac43){_0x26749b=_0x24ac43;_0x22cc54=0xc8;}else{_0x22cc54=0xce;}_0x1e0a7a['status'](_0x22cc54);return _0x1e0a7a[_0x3aef('0x28')](_0x3aef('0x29'),_0x21c061+'-'+_0x26749b+'/'+_0x24ac43)[_0x3aef('0x23')](_0x435191);}return null;};}function patchUpdates(_0x50b0fc){return function(_0x25e618){try{jsonpatch[_0x3aef('0x2a')](_0x25e618,_0x50b0fc,!![]);}catch(_0x337540){return BPromise[_0x3aef('0x2b')](_0x337540);}return _0x25e618[_0x3aef('0x2c')]();};}function saveUpdates(_0x5ea44c,_0x10c8e1){return function(_0x4dcc6b){if(_0x4dcc6b){return _0x4dcc6b['update'](_0x5ea44c)[_0x3aef('0x2d')](function(_0x2a22c1){return _0x2a22c1;});}return null;};}function removeEntity(_0x394c2f,_0x22c237){return function(_0x163153){if(_0x163153){return _0x163153[_0x3aef('0x2e')]()[_0x3aef('0x2d')](function(){_0x394c2f[_0x3aef('0x21')](0xcc)[_0x3aef('0x22')]();});}};}function handleEntityNotFound(_0x3b04f1,_0x1efbc4){return function(_0x42e784){if(!_0x42e784){_0x3b04f1[_0x3aef('0x20')](0x194);}return _0x42e784;};}function handleError(_0x10e9b8,_0x18262b){_0x18262b=_0x18262b||0x1f4;return function(_0x5239f7){logger[_0x3aef('0x2f')](_0x5239f7[_0x3aef('0x30')]);if(_0x5239f7[_0x3aef('0x31')]){delete _0x5239f7[_0x3aef('0x31')];}_0x10e9b8[_0x3aef('0x21')](_0x18262b)[_0x3aef('0x32')](_0x5239f7);};}function getInteractionUsers(_0x264f79,_0x3ee4ac){return new BPromise(function(_0x1e1392,_0x4cd970){try{if(_0x3ee4ac[_0x264f79['id']]){_0x264f79[_0x3aef('0x33')]=_[_0x3aef('0x34')](_0x3ee4ac[_0x264f79['id']],function(_0x2a440f){return{'id':_0x2a440f['id'],'fullname':_0x2a440f[_0x3aef('0x35')]};});}}catch(_0x1cdacd){_0x4cd970(_0x1cdacd);}_0x1e1392(_0x264f79);});}function getInteractionTags(_0x4d39d4,_0x2a6d88){return new BPromise(function(_0x14cc5d,_0x101203){try{if(_0x4d39d4[_0x3aef('0x36')]){_0x4d39d4[_0x3aef('0x37')]=[];_0x4d39d4['TagIds'][_0x3aef('0x38')](',')[_0x3aef('0x39')](function(_0x1d9567){_0x4d39d4[_0x3aef('0x37')][_0x3aef('0x3a')](_0x2a6d88[_0x1d9567]);});}delete _0x4d39d4[_0x3aef('0x36')];}catch(_0x2c828a){_0x101203(_0x2c828a);}_0x14cc5d(_0x4d39d4);});}function updateFaxInteraction(_0x2d56fd,_0x283b34,_0x3dff43){return new BPromise(function(_0x1ddeb3,_0x51aa9b){return getInteractionUsers(_0x2d56fd,_0x3dff43)['then'](function(_0x699ca0){return getInteractionTags(_0x699ca0,_0x283b34);})['then'](function(_0x2c4b89){_0x1ddeb3(_0x2c4b89);})[_0x3aef('0x3b')](function(_0x4c2ffe){_0x51aa9b(_0x4c2ffe);});});}exports['index']=function(_0x169f05,_0x585e05){var _0x36f66a={},_0x3f203e={},_0x2f5401={'count':0x0,'rows':[]};var _0x5a8fa5=_[_0x3aef('0x34')](db['FaxInteraction'][_0x3aef('0x3c')],function(_0x120d8c){return{'name':_0x120d8c[_0x3aef('0x3d')],'type':_0x120d8c[_0x3aef('0x3e')][_0x3aef('0x3f')]};});_0x3f203e[_0x3aef('0x40')]=_[_0x3aef('0x34')](_0x5a8fa5,_0x3aef('0x31'));_0x3f203e['query']=_[_0x3aef('0x41')](_0x169f05[_0x3aef('0x42')]);_0x3f203e[_0x3aef('0x43')]=_[_0x3aef('0x44')](_0x3f203e[_0x3aef('0x40')],_0x3f203e[_0x3aef('0x42')]);_0x36f66a['attributes']=_['intersection'](_0x3f203e[_0x3aef('0x40')],qs[_0x3aef('0x45')](_0x169f05[_0x3aef('0x42')][_0x3aef('0x45')]));_0x36f66a[_0x3aef('0x46')]=_0x36f66a[_0x3aef('0x46')][_0x3aef('0x47')]?_0x36f66a[_0x3aef('0x46')]:_0x3f203e[_0x3aef('0x40')];if(!_0x169f05[_0x3aef('0x42')][_0x3aef('0x48')]('nolimit')){_0x36f66a[_0x3aef('0x26')]=qs[_0x3aef('0x26')](_0x169f05[_0x3aef('0x42')][_0x3aef('0x26')]);_0x36f66a[_0x3aef('0x24')]=qs[_0x3aef('0x24')](_0x169f05['query'][_0x3aef('0x24')]);}_0x36f66a['order']=qs[_0x3aef('0x49')](_0x169f05[_0x3aef('0x42')][_0x3aef('0x49')]);_0x36f66a['where']=qs[_0x3aef('0x43')](_['pick'](_0x169f05[_0x3aef('0x42')],_0x3f203e[_0x3aef('0x43')]),_0x5a8fa5);var _0x13a58b=[];var _0x4c19b3=squel[_0x3aef('0x4a')]()[_0x3aef('0x4b')]('id')[_0x3aef('0x4b')](_0x3aef('0x31'))['field'](_0x3aef('0x4c'))['from'](_0x3aef('0x4d'));var _0x4b6fce=squel['select']()[_0x3aef('0x4b')]('u.id')[_0x3aef('0x4b')](_0x3aef('0x4e'))[_0x3aef('0x4b')](_0x3aef('0x4f'))[_0x3aef('0x50')](_0x3aef('0x51'),'ui')[_0x3aef('0x52')](_0x3aef('0x53'),'u',_0x3aef('0x54'));var _0x57e28f=squel[_0x3aef('0x4a')]()['from']('fax_interactions','i')[_0x3aef('0x52')](_0x3aef('0x55'),'c',_0x3aef('0x56'))[_0x3aef('0x52')](_0x3aef('0x53'),'o',_0x3aef('0x57'))['left_join'](_0x3aef('0x58'),'a',_0x3aef('0x59'))['left_join'](_0x3aef('0x5a'),'me',_0x3aef('0x5b'))[_0x3aef('0x52')](_0x3aef('0x5c'),'it',_0x3aef('0x5d'))[_0x3aef('0x52')](_0x3aef('0x4d'),'t',_0x3aef('0x5e'));var _0x321e50=squel[_0x3aef('0x5f')]();var _0x8a57dc=[];var _0x32ae81=squel['expr']();var _0x253c3e;if(_0x169f05['query'][_0x3aef('0x60')]){_0x253c3e=as[_0x3aef('0x61')](_0x169f05[_0x3aef('0x42')][_0x3aef('0x60')]);var _0x439d9c=_0x253c3e['sqlOperator'];for(var _0x53eeb8=0x0;_0x53eeb8<_0x253c3e['conditions']['length'];_0x53eeb8++){var _0x3d4658=_0x253c3e['conditions'][_0x53eeb8];var _0x2c3813='i';var _0x585e48=_[_0x3aef('0x62')](_0x5a8fa5,[_0x3aef('0x31'),_0x3d4658['field']]);if(!_0x585e48){switch(_0x3d4658['field']){case _0x3aef('0x63'):if(_0x3d4658[_0x3aef('0x64')]==0x1){_0x57e28f['having']('`'+_0x3d4658[_0x3aef('0x4b')]+_0x3aef('0x65'));}else{_0x57e28f['having']('`'+_0x3d4658[_0x3aef('0x4b')]+_0x3aef('0x66'));}break;case _0x3aef('0x67'):if(_0x3d4658[_0x3aef('0x68')]===_0x3aef('0x69')){if(_0x3d4658[_0x3aef('0x64')][_0x3aef('0x38')]('\x20')[_0x3aef('0x47')]>0x1){_0x321e50[_0x439d9c](_0x3aef('0x6a'),qs[_0x3aef('0x6b')](_0x3d4658[_0x3aef('0x64')]),null);}else{var _0x5521ce='%'+_0x3d4658[_0x3aef('0x64')]+'%';_0x321e50[_0x439d9c](_0x3aef('0x6c'),_0x5521ce,_0x5521ce,_0x5521ce);}}else{_0x585e48=_['find'](_0x5a8fa5,[_0x3aef('0x31'),_0x3aef('0x6d')]);_0x3d4658[_0x3aef('0x4b')]=_0x3aef('0x6d');_0x43810c=as[_0x3aef('0x6e')](_0x2c3813,_0x585e48['type'],_0x3d4658);_0x321e50[_0x439d9c](_0x43810c[_0x3aef('0x6f')],_0x43810c[_0x3aef('0x64')][_0x3aef('0x70')],_0x43810c[_0x3aef('0x64')][_0x3aef('0x22')]);}break;case _0x3aef('0x71'):var _0x39224b=_0x3d4658[_0x3aef('0x64')][_0x3aef('0x38')](',')['map'](function(_0x1bfcb4){return Number(_0x1bfcb4);});_0x39224b[_0x3aef('0x39')](function(_0x5784f9){_0x32ae81['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5784f9+',%');});_0x8a57dc=_[_0x3aef('0x72')](_0x8a57dc,_0x39224b);break;case _0x3aef('0x73'):if(_0x3d4658[_0x3aef('0x68')]===_0x3aef('0x69')){_0x321e50[_0x439d9c](_0x3aef('0x74'),'%'+_0x3d4658[_0x3aef('0x64')]+'%',null);}else{_0x585e48=_[_0x3aef('0x62')](_0x5a8fa5,[_0x3aef('0x31'),_0x3aef('0x75')]);_0x3d4658[_0x3aef('0x4b')]=_0x3aef('0x75');_0x43810c=as[_0x3aef('0x6e')](_0x2c3813,_0x585e48[_0x3aef('0x3e')],_0x3d4658);_0x321e50[_0x439d9c](_0x43810c[_0x3aef('0x6f')],_0x43810c[_0x3aef('0x64')]['start'],_0x43810c['value'][_0x3aef('0x22')]);}break;case _0x3aef('0x76'):_0x43810c=as[_0x3aef('0x6e')]('me',null,_0x3d4658);_0x321e50[_0x439d9c](_0x43810c['text'],_0x43810c[_0x3aef('0x64')][_0x3aef('0x70')],_0x43810c['value'][_0x3aef('0x22')]);break;}}else{var _0x43810c=as[_0x3aef('0x6e')](_0x2c3813,_0x585e48[_0x3aef('0x3e')],_0x3d4658);_0x321e50[_0x439d9c](_0x43810c[_0x3aef('0x6f')],_0x43810c['value'][_0x3aef('0x70')],_0x43810c['value']['end']);}}}else{var _0x3d0eb8=_(_0x169f05[_0x3aef('0x42')])[_0x3aef('0x41')]()[_0x3aef('0x34')](function(_0x4418b1){return _['some'](_0x5a8fa5,[_0x3aef('0x31'),_0x4418b1])?_0x4418b1:undefined;})[_0x3aef('0x77')]()[_0x3aef('0x64')]();if(!_[_0x3aef('0x78')](_0x3d0eb8)){_0x3d0eb8[_0x3aef('0x39')](function(_0x5149a5){if(_0x5149a5===_0x3aef('0x79')){_0x57e28f['where'](_0x3aef('0x7a'),[]['concat'](_0x169f05[_0x3aef('0x42')][_0x5149a5]));}else if(_0x5149a5===_0x3aef('0x7b')){var _0x30aba0=JSON[_0x3aef('0x7c')](_0x169f05['query'][_0x5149a5])[_0x3aef('0x7d')];var _0x23aaa6=JSON[_0x3aef('0x7c')](_0x169f05[_0x3aef('0x42')][_0x5149a5])[_0x3aef('0x7e')];_0x57e28f[_0x3aef('0x7f')](_0x3aef('0x80'),_0x30aba0,_0x23aaa6);}else{if(_0x169f05[_0x3aef('0x42')][_0x5149a5]===_0x3aef('0x81')){_0x57e28f[_0x3aef('0x7f')]('i.'+_0x5149a5+_0x3aef('0x82'));}else{_0x57e28f[_0x3aef('0x7f')]('i.'+_0x5149a5+_0x3aef('0x83'),_0x169f05[_0x3aef('0x42')][_0x5149a5]);}}});}if(_0x169f05[_0x3aef('0x42')]['read']){if(_0x169f05[_0x3aef('0x42')][_0x3aef('0x84')]==0x1){_0x57e28f[_0x3aef('0x85')](_0x3aef('0x86'));}else{_0x57e28f[_0x3aef('0x85')]('`unreadMessages`\x20>\x200');}}if(_0x169f05[_0x3aef('0x42')][_0x3aef('0x87')]){_0x8a57dc=_[_0x3aef('0x88')](_0x169f05[_0x3aef('0x42')][_0x3aef('0x87')])?_0x169f05[_0x3aef('0x42')]['tag']:new Array(_0x169f05[_0x3aef('0x42')][_0x3aef('0x87')]);_0x8a57dc[_0x3aef('0x39')](function(_0x1ac642){_0x32ae81['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1ac642+',%');});}if(_0x169f05[_0x3aef('0x42')][_0x3aef('0x89')]){var _0x2969f0=_0x169f05[_0x3aef('0x42')][_0x3aef('0x89')][_0x3aef('0x8a')]('\x5c','\x5c\x5c')[_0x3aef('0x8a')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x2969f0)){_0x321e50['or'](_0x3aef('0x8b'),_0x2969f0+'%')['or'](_0x3aef('0x8c'),_0x2969f0+'%');}_0x321e50['or'](_0x3aef('0x8d'),_0x2969f0+'%');}}_0x57e28f[_0x3aef('0x7f')](_0x321e50);_0x57e28f[_0x3aef('0x8e')]('i.id');var _0xe67c0={'type':db['Sequelize']['QueryTypes'][_0x3aef('0x8f')],'raw':!![]};var _0x1a6aff=_0x57e28f[_0x3aef('0x90')]();_0x1a6aff[_0x3aef('0x4b')](_0x3aef('0x91'));_0x1a6aff[_0x3aef('0x4b')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x36f66a['order']){_0x36f66a['order']['forEach'](function(_0xfdd8fc){var _0x33de7a=_0xfdd8fc[0x0]===_0x3aef('0x92')?_0xfdd8fc[0x0]:'i.'+_0xfdd8fc[0x0];_0x57e28f[_0x3aef('0x93')](_0x33de7a,_0xfdd8fc[0x1]===_0x3aef('0x94')?![]:!![]);});}if(!_[_0x3aef('0x78')](_0x8a57dc)){_0x57e28f[_0x3aef('0x85')](_0x32ae81);_0x1a6aff['where'](_0x3aef('0x95'),_0x8a57dc);}BPromise[_0x3aef('0x96')]()[_0x3aef('0x2d')](function(){if(!_0x253c3e){if(_0x169f05[_0x3aef('0x42')]['FaxAccountId'])return;_0x1a6aff[_0x3aef('0x7f')](_0x3aef('0x97'));_0x57e28f[_0x3aef('0x7f')](_0x3aef('0x97'));return;}if(_0x169f05[_0x3aef('0x98')][_0x3aef('0x99')]!==_0x3aef('0x9a'))return;return _0x169f05[_0x3aef('0x98')][_0x3aef('0x9b')]({'attributes':['id'],'raw':!![]})[_0x3aef('0x2d')](function(_0xd19bc3){if(_[_0x3aef('0x78')](_0xd19bc3)){_0x1a6aff[_0x3aef('0x7f')](_0x3aef('0x9c'));_0x57e28f[_0x3aef('0x7f')](_0x3aef('0x9c'));}else{_0x1a6aff[_0x3aef('0x7f')](_0x3aef('0x7a'),_[_0x3aef('0x34')](_0xd19bc3,'id'));_0x57e28f[_0x3aef('0x7f')](_0x3aef('0x7a'),_['map'](_0xd19bc3,'id'));}});})[_0x3aef('0x2d')](function(){if(_0x169f05['user'][_0x3aef('0x99')]===_0x3aef('0x9a')&&!_0x253c3e&&!_0x169f05['query']['FaxAccountId'])return[];return db['sequelize'][_0x3aef('0x42')](_0x1a6aff[_0x3aef('0x9d')](),_0xe67c0);})[_0x3aef('0x2d')](function(_0x536c79){_0x2f5401[_0x3aef('0x27')]=_0x536c79[_0x3aef('0x47')];if(_0x2f5401[_0x3aef('0x27')]===0x0)return[];return db[_0x3aef('0x9e')][_0x3aef('0x42')](_0x4c19b3['toString'](),_0xe67c0)['then'](function(_0x3b6f7e){_0x13a58b=_[_0x3aef('0x9f')](_0x3b6f7e,'id');_0xe67c0=_[_0x3aef('0xa0')](_0xe67c0,{'model':db[_0x3aef('0xa1')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x169f05[_0x3aef('0x42')][_0x3aef('0x45')]){_0x36f66a[_0x3aef('0x46')][_0x3aef('0x39')](function(_0x3b90c9){_0x57e28f[_0x3aef('0x4b')]('i.'+_0x3b90c9);});}else{_0x57e28f[_0x3aef('0x4b')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x3aef('0x63'));_0x57e28f['field'](_0x3aef('0xa2'),_0x3aef('0xa3'));_0x57e28f[_0x3aef('0x4b')](_0x3aef('0xa4'),_0x3aef('0xa5'));_0x57e28f['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x3aef('0x92'));_0x57e28f[_0x3aef('0x4b')](_0x3aef('0xa6'));_0x57e28f[_0x3aef('0x4b')](_0x3aef('0xa7'),_0x3aef('0xa8'));_0x57e28f[_0x3aef('0x4b')](_0x3aef('0xa9'),_0x3aef('0xaa'));_0x57e28f[_0x3aef('0x4b')]('c.email',_0x3aef('0xab'));_0x57e28f[_0x3aef('0x4b')](_0x3aef('0xac'),_0x3aef('0xad'));_0x57e28f[_0x3aef('0x4b')](_0x3aef('0xae'),_0x3aef('0xaf'));_0x57e28f[_0x3aef('0x4b')](_0x3aef('0xb0'),_0x3aef('0xb1'));_0x57e28f[_0x3aef('0x4b')](_0x3aef('0xb2'),_0x3aef('0xb3'));_0x57e28f[_0x3aef('0x4b')](_0x3aef('0xb4'),_0x3aef('0xb5'));_0x57e28f['field'](_0x3aef('0xb6'),'TagIds');}if(_0x36f66a['limit'])_0x57e28f[_0x3aef('0x26')](_0x36f66a[_0x3aef('0x26')]);if(_0x36f66a[_0x3aef('0x24')])_0x57e28f[_0x3aef('0x24')](_0x36f66a['offset']);return db['sequelize'][_0x3aef('0x42')](_0x57e28f['toString'](),_0xe67c0);})[_0x3aef('0x2d')](function(_0x323fbe){if(_0x323fbe[_0x3aef('0x47')]>0x0)_0x4b6fce[_0x3aef('0x7f')](_0x3aef('0xb7'),_[_0x3aef('0x34')](_0x323fbe,'id'));return db[_0x3aef('0x9e')][_0x3aef('0x42')](_0x4b6fce[_0x3aef('0x9d')](),_0xe67c0)[_0x3aef('0x2d')](function(_0x4baebe){var _0x103b34=_[_0x3aef('0xb8')](_0x4baebe,_0x3aef('0xb9'));var _0x294778=[];_0x323fbe['forEach'](function(_0x11d869){_0x294778[_0x3aef('0x3a')](updateFaxInteraction(_0x11d869,_0x13a58b,_0x103b34));});return BPromise[_0x3aef('0xba')](_0x294778);});});})[_0x3aef('0x2d')](function(_0x539a4b){_0x2f5401['rows']=_0x539a4b;return _0x2f5401;})['then'](respondWithFilteredResult(_0x585e05,_0x36f66a))['catch'](handleError(_0x585e05,null));};exports[_0x3aef('0xbb')]=function(_0x2bea25,_0x1413de){var _0x3d98db={'raw':![],'where':{'id':_0x2bea25[_0x3aef('0xbc')]['id']}},_0x328b87={};_0x328b87[_0x3aef('0x40')]=_[_0x3aef('0x41')](db[_0x3aef('0xa1')][_0x3aef('0x3c')]);_0x328b87['query']=_['keys'](_0x2bea25[_0x3aef('0x42')]);_0x328b87[_0x3aef('0x43')]=_['intersection'](_0x328b87['model'],_0x328b87[_0x3aef('0x42')]);_0x3d98db[_0x3aef('0x46')]=_['intersection'](_0x328b87[_0x3aef('0x40')],qs[_0x3aef('0x45')](_0x2bea25[_0x3aef('0x42')][_0x3aef('0x45')]));_0x3d98db['attributes']=_0x3d98db[_0x3aef('0x46')][_0x3aef('0x47')]?_0x3d98db['attributes']:_0x328b87['model'];if(_0x2bea25[_0x3aef('0x42')]['includeAll']){_0x3d98db['include']=[{'all':!![]}];}_0x3d98db=_[_0x3aef('0xa0')]({},_0x3d98db,_0x2bea25[_0x3aef('0xbd')]);return db[_0x3aef('0xa1')]['find'](_0x3d98db)['then'](handleEntityNotFound(_0x1413de,null))[_0x3aef('0x2d')](respondWithResult(_0x1413de,null))[_0x3aef('0x3b')](handleError(_0x1413de,null));};exports[_0x3aef('0xbe')]=function(_0x393c2c,_0x181f20){return db[_0x3aef('0xa1')][_0x3aef('0xbe')](_0x393c2c[_0x3aef('0x76')],{})[_0x3aef('0x2d')](respondWithResult(_0x181f20,0xc9))['catch'](handleError(_0x181f20,null));};exports[_0x3aef('0xbf')]=function(_0x16d0c2,_0x2bc66b){if(_0x16d0c2['body']['id']){delete _0x16d0c2['body']['id'];}return db[_0x3aef('0xa1')]['find']({'where':{'id':_0x16d0c2[_0x3aef('0xbc')]['id']}})['then'](handleEntityNotFound(_0x2bc66b,null))[_0x3aef('0x2d')](saveUpdates(_0x16d0c2['body'],null))[_0x3aef('0x2d')](respondWithResult(_0x2bc66b,null))['catch'](handleError(_0x2bc66b,null));};exports[_0x3aef('0x2e')]=function(_0x10ffbf,_0x1ee622){return db[_0x3aef('0xa1')][_0x3aef('0x62')]({'where':{'id':_0x10ffbf['params']['id']}})[_0x3aef('0x2d')](handleEntityNotFound(_0x1ee622,null))[_0x3aef('0x2d')](removeEntity(_0x1ee622,null))[_0x3aef('0x3b')](handleError(_0x1ee622,null));};exports[_0x3aef('0xc0')]=function(_0x70f34a,_0xcd093b){return db[_0x3aef('0xa1')][_0x3aef('0xc0')]()[_0x3aef('0x2d')](respondWithResult(_0xcd093b,null))[_0x3aef('0x3b')](handleError(_0xcd093b,null));};exports[_0x3aef('0xc1')]=function(_0x1620c7,_0x3e6b33,_0x1078fb){return db[_0x3aef('0xc2')]['find']({'where':{'id':_0x1620c7['params']['id']}})[_0x3aef('0x2d')](handleEntityNotFound(_0x3e6b33,null))[_0x3aef('0x2d')](function(_0x58e0bb){if(_0x58e0bb){return _0x58e0bb[_0x3aef('0xc1')](_0x1620c7[_0x3aef('0x76')]['ids'],_[_0x3aef('0xc3')](_0x1620c7[_0x3aef('0x76')],[_0x3aef('0xc4'),'id'])||{});}})[_0x3aef('0x2d')](respondWithResult(_0x3e6b33,null))[_0x3aef('0x3b')](handleError(_0x3e6b33,null));};exports[_0x3aef('0xc5')]=function(_0x32c585,_0x3273a9,_0x3a27f0){var _0x51841c={'raw':![],'where':{}};var _0x30d8b4={};var _0x1399bd={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x3aef('0xc6')]({'where':{'id':_0x32c585[_0x3aef('0xbc')]['id']}})['then'](handleEntityNotFound(_0x3273a9,null))['then'](function(_0x9848f8){if(_0x9848f8){_0x30d8b4[_0x3aef('0x40')]=_[_0x3aef('0x41')](db['FaxMessage'][_0x3aef('0x3c')]);_0x30d8b4[_0x3aef('0x42')]=_[_0x3aef('0x41')](_0x32c585[_0x3aef('0x42')]);_0x30d8b4[_0x3aef('0x43')]=_[_0x3aef('0x44')](_0x30d8b4[_0x3aef('0x40')],_0x30d8b4[_0x3aef('0x42')]);_0x51841c[_0x3aef('0x46')]=_[_0x3aef('0x44')](_0x30d8b4['model'],qs[_0x3aef('0x45')](_0x32c585[_0x3aef('0x42')][_0x3aef('0x45')]));_0x51841c[_0x3aef('0x46')]=_0x51841c['attributes'][_0x3aef('0x47')]?_0x51841c['attributes']:_0x30d8b4[_0x3aef('0x40')];if(!_0x32c585['query'][_0x3aef('0x48')](_0x3aef('0xc7'))){_0x51841c[_0x3aef('0x26')]=qs[_0x3aef('0x26')](_0x32c585[_0x3aef('0x42')]['limit']);_0x51841c[_0x3aef('0x24')]=qs[_0x3aef('0x24')](_0x32c585[_0x3aef('0x42')]['offset']);}_0x51841c[_0x3aef('0x93')]=qs[_0x3aef('0x49')](_0x32c585[_0x3aef('0x42')][_0x3aef('0x49')]);_0x51841c[_0x3aef('0x7f')]=qs['filters'](_[_0x3aef('0xc8')](_0x32c585[_0x3aef('0x42')],_0x30d8b4['filters']));_0x51841c[_0x3aef('0x7f')][_0x3aef('0xb9')]=_0x9848f8['id'];if(_0x32c585[_0x3aef('0x42')][_0x3aef('0x89')]){_0x51841c['where']=_[_0x3aef('0xa0')](_0x51841c['where'],{'$or':_[_0x3aef('0x34')](_0x51841c[_0x3aef('0x46')],function(_0x1f3358){var _0x4c3afb={};_0x4c3afb[_0x1f3358]={'$like':'%'+_0x32c585['query'][_0x3aef('0x89')]+'%'};return _0x4c3afb;})});}if(_0x32c585[_0x3aef('0x42')][_0x3aef('0x7d')]){var _0x54463e=_0x32c585[_0x3aef('0x42')][_0x3aef('0x7d')]['split'](',');var _0x37215a={};_0x37215a[_0x54463e[0x0]]={'$gte':moment(_0x54463e[0x1])[_0x3aef('0xc9')]('YYYY-MM-DD\x20HH:mm:ss')};_0x51841c[_0x3aef('0x7f')]=_[_0x3aef('0xa0')](_0x51841c['where'],_0x37215a);}_0x51841c=_[_0x3aef('0xa0')]({},_0x51841c,_0x32c585[_0x3aef('0xbd')]);return db[_0x3aef('0xc2')][_0x3aef('0x27')]({'where':_0x51841c['where']})[_0x3aef('0x2d')](function(_0x130556){_0x1399bd[_0x3aef('0x27')]=_0x130556;if(_0x32c585[_0x3aef('0x42')][_0x3aef('0xca')]){_0x51841c[_0x3aef('0xcb')]=[{'all':!![]}];}return db['FaxMessage'][_0x3aef('0xcc')](_0x51841c);})[_0x3aef('0x2d')](function(_0x2bc4df){_0x1399bd['rows']=_0x2bc4df;return _0x1399bd;});}})[_0x3aef('0x2d')](respondWithFilteredResult(_0x3273a9,_0x51841c))[_0x3aef('0x3b')](handleError(_0x3273a9,null));};exports[_0x3aef('0xcd')]=function(_0x37d052,_0x139201,_0x21fb41){return db[_0x3aef('0xa1')]['find']({'where':{'id':_0x37d052['params']['id']}})[_0x3aef('0x2d')](handleEntityNotFound(_0x139201,null))[_0x3aef('0x2d')](function(_0x469d3d){if(_0x469d3d){return _0x469d3d['setTags'](_0x37d052['body'][_0x3aef('0xc4')],_['omit'](_0x37d052[_0x3aef('0x76')],[_0x3aef('0xc4'),'id'])||{})[_0x3aef('0xce')](function(){return db['Tag'][_0x3aef('0xcc')]({'attributes':['id','name',_0x3aef('0x4c')],'where':{'id':_0x37d052['body']['ids']}});})['then'](function(_0x34c2fd){socket[_0x3aef('0xcf')](_0x3aef('0xd0'),{'id':Number(_0x37d052['params']['id']),'tags':_0x34c2fd||[]});return{'id':Number(_0x37d052[_0x3aef('0xbc')]['id']),'tags':_0x34c2fd||[]};});}})[_0x3aef('0x2d')](respondWithResult(_0x139201,null))[_0x3aef('0x3b')](handleError(_0x139201,null));};exports[_0x3aef('0xd1')]=function(_0x4f73dc,_0x16769b,_0x491527){return db[_0x3aef('0xa1')][_0x3aef('0x62')]({'where':{'id':_0x4f73dc[_0x3aef('0xbc')]['id']}})[_0x3aef('0x2d')](handleEntityNotFound(_0x16769b,null))[_0x3aef('0x2d')](function(_0x206df7){if(_0x206df7){return _0x206df7[_0x3aef('0xd1')](_0x4f73dc[_0x3aef('0x42')]['ids']);}})[_0x3aef('0x2d')](respondWithStatusCode(_0x16769b,null))[_0x3aef('0x3b')](handleError(_0x16769b,null));};exports[_0x3aef('0xd2')]=function(_0x250efe,_0x4a12f9){var _0x41cf3a=moment()[_0x3aef('0xd3')]()[_0x3aef('0x9d')]();var _0x257b66=path[_0x3aef('0xd4')](config[_0x3aef('0xd5')],_0x3aef('0xd6'),_0x3aef('0xd7'),_0x3aef('0xd8'));var _0x55e01c=path[_0x3aef('0xd4')](config[_0x3aef('0xd5')],_0x3aef('0xd6'),_0x3aef('0xd7'),_0x3aef('0xd9'));var _0x2ecc30=path[_0x3aef('0xd4')](_0x257b66,_0x41cf3a);var _0x446a01=util['format'](_0x3aef('0xda'),_0x250efe[_0x3aef('0xbc')]['id'],_0x41cf3a);var _0x2d1932=path[_0x3aef('0xd4')](_0x257b66,_0x446a01);var _0x16937e=[];_0x16937e[_0x3aef('0x3a')]({'model':db[_0x3aef('0xdb')],'as':'Attachment','raw':!![]});var _0x2b7e11=[{'model':db[_0x3aef('0xc2')],'as':_0x3aef('0xdc'),'attributes':['id',_0x3aef('0x76'),_0x3aef('0x7b')],'include':_0x16937e}];return db['FaxInteraction']['find']({'where':{'id':_0x250efe[_0x3aef('0xbc')]['id']},'include':_0x2b7e11})[_0x3aef('0x2d')](handleEntityNotFound(_0x4a12f9,null))[_0x3aef('0x2d')](function(_0x3b1d4e){if(_0x3b1d4e&&_0x3b1d4e['Messages']){var _0x27ae4a=_0x3b1d4e[_0x3aef('0xdd')]({'plain':!![]});fs[_0x3aef('0xde')](_0x2ecc30);for(var _0x2782fe=0x0;_0x2782fe<_0x27ae4a[_0x3aef('0xdc')][_0x3aef('0x47')];_0x2782fe++){var _0x5a396b=_0x27ae4a['Messages'][_0x2782fe]['Attachment'];if(_0x5a396b){var _0x51b0b1=path[_0x3aef('0xd4')](_0x55e01c,_0x5a396b[_0x3aef('0xdf')]);if(fs[_0x3aef('0xe0')](_0x51b0b1)){fs[_0x3aef('0xe1')](_0x51b0b1)['pipe'](fs['createWriteStream'](path[_0x3aef('0xd4')](_0x2ecc30,_0x5a396b['basename'])));}}}return BPromise[_0x3aef('0x96')]()[_0x3aef('0x2d')](function(){return new BPromise(function(_0x1a469a,_0x46f906){zipdir(_0x2ecc30,{'saveTo':_0x2d1932},function(_0x437491,_0x12a18b){if(_0x437491)return _0x46f906(_0x437491);return _0x1a469a(_0x12a18b);});})['then'](function(){return new BPromise(function(_0x327f41,_0x16f79c){rimraf(_0x2ecc30,function(_0x1179e2){if(_0x1179e2)_0x16f79c(_0x1179e2);return _0x327f41();});});})[_0x3aef('0x2d')](function(){return _0x4a12f9[_0x3aef('0xd2')](_0x2d1932,_0x446a01,function(_0x2ca210){if(_0x2ca210){console[_0x3aef('0xe2')]('err',_0x2ca210);}else{fs[_0x3aef('0xe3')](_0x2d1932);}});});});}else{return _0x4a12f9[_0x3aef('0x20')](0xc8);}})[_0x3aef('0x3b')](handleError(_0x4a12f9,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index e00cd6d..cef00fd 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 _0x934a=['../../mysqldb','FaxInteraction','FaxMessage','save','update','remove','Users','map','findAll','setDataValue','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x32e54a,_0x59fc0d){var _0x109af4=function(_0x564be8){while(--_0x564be8){_0x32e54a['push'](_0x32e54a['shift']());}};_0x109af4(++_0x59fc0d);}(_0x934a,0x1b9));var _0xa934=function(_0x471268,_0x5ce885){_0x471268=_0x471268-0x0;var _0x1298f3=_0x934a[_0x471268];return _0x1298f3;};'use strict';var EventEmitter=require(_0xa934('0x0'));var FaxInteraction=require(_0xa934('0x1'))['db'][_0xa934('0x2')];var FaxMessage=require(_0xa934('0x1'))['db'][_0xa934('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa934('0x4'),'afterUpdate':_0xa934('0x5'),'afterDestroy':_0xa934('0x6')};function emitEvent(_0x57ac18){return function(_0x32b862,_0xd9c1ba,_0x1132fb){_0x32b862['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0xfd576b){_0x32b862['setDataValue'](_0xa934('0x7'),_0xfd576b[_0xa934('0x8')](function(_0x1de1bc){return{'id':_0x1de1bc['id']};}));return FaxMessage[_0xa934('0x9')]({'where':{'FaxInteractionId':_0x32b862['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x41d592){_0x32b862[_0xa934('0xa')]('unreadMessages',_0x41d592[_0xa934('0xb')]);FaxInteractionEvents[_0xa934('0xc')](_0x57ac18+':'+_0x32b862['id'],_0x32b862);FaxInteractionEvents[_0xa934('0xc')](_0x57ac18,_0x32b862);_0x1132fb(null);})[_0xa934('0xd')](_0x1132fb(null));};}for(var e in events){if(events[_0xa934('0xe')](e)){var event=events[e];FaxInteraction[_0xa934('0xf')](e,emitEvent(event));}}module[_0xa934('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x808f=['findAll','then','length','emit','catch','hasOwnProperty','hook','FaxInteraction','../../mysqldb','setMaxListeners','save','setDataValue','map'];(function(_0xc0dad,_0xc4e4ae){var _0x4e843c=function(_0x58e2c6){while(--_0x58e2c6){_0xc0dad['push'](_0xc0dad['shift']());}};_0x4e843c(++_0xc4e4ae);}(_0x808f,0x166));var _0xf808=function(_0x1cc410,_0x1b3d93){_0x1cc410=_0x1cc410-0x0;var _0x78dbca=_0x808f[_0x1cc410];return _0x78dbca;};'use strict';var EventEmitter=require('events');var FaxInteraction=require('../../mysqldb')['db'][_0xf808('0x0')];var FaxMessage=require(_0xf808('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xf808('0x2')](0x0);var events={'afterCreate':_0xf808('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5127bf){return function(_0x37e642,_0x548aa9,_0x20fa7d){_0x37e642['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x2e9ce5){_0x37e642[_0xf808('0x4')]('Users',_0x2e9ce5[_0xf808('0x5')](function(_0x49780a){return{'id':_0x49780a['id']};}));return FaxMessage[_0xf808('0x6')]({'where':{'FaxInteractionId':_0x37e642['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf808('0x7')](function(_0x27f905){_0x37e642['setDataValue']('unreadMessages',_0x27f905[_0xf808('0x8')]);FaxInteractionEvents['emit'](_0x5127bf+':'+_0x37e642['id'],_0x37e642);FaxInteractionEvents[_0xf808('0x9')](_0x5127bf,_0x37e642);_0x20fa7d(null);})[_0xf808('0xa')](_0x20fa7d(null));};}for(var e in events){if(events[_0xf808('0xb')](e)){var event=events[e];FaxInteraction[_0xf808('0xc')](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 0aa9d3c..9ea7bfe 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 _0x3f3d=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','fax_interactions','closedAt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3f3d,0xd4));var _0xd3f3=function(_0x59684c,_0x4f23bd){_0x59684c=_0x59684c-0x0;var _0x6e9beb=_0x3f3d[_0x59684c];return _0x6e9beb;};'use strict';var _=require(_0xd3f3('0x0'));var util=require('util');var logger=require(_0xd3f3('0x1'))(_0xd3f3('0x2'));var moment=require(_0xd3f3('0x3'));var BPromise=require('bluebird');var rp=require(_0xd3f3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd3f3('0x5'));var config=require(_0xd3f3('0x6'));var attributes=require(_0xd3f3('0x7'));module[_0xd3f3('0x8')]=function(_0x1ad010,_0x3e639d){return _0x1ad010[_0xd3f3('0x9')]('FaxInteraction',attributes,{'tableName':_0xd3f3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1e18b8,_0x4c8f0e,_0x588580){if(_0x1e18b8['changed']('closed')){_0x1e18b8[_0xd3f3('0xb')]=moment()[_0xd3f3('0xc')](_0xd3f3('0xd'));}_0x588580(null,_0x1e18b8);}}});}; \ No newline at end of file +var _0x81b7=['define','changed','closedAt','format','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','exports'];(function(_0x49c46d,_0x260508){var _0x46fbf1=function(_0x1b2801){while(--_0x1b2801){_0x49c46d['push'](_0x49c46d['shift']());}};_0x46fbf1(++_0x260508);}(_0x81b7,0x1f2));var _0x781b=function(_0x37c0ae,_0x429eb1){_0x37c0ae=_0x37c0ae-0x0;var _0x4cd294=_0x81b7[_0x37c0ae];return _0x4cd294;};'use strict';var _=require('lodash');var util=require(_0x781b('0x0'));var logger=require(_0x781b('0x1'))(_0x781b('0x2'));var moment=require(_0x781b('0x3'));var BPromise=require('bluebird');var rp=require(_0x781b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x781b('0x5'));var config=require(_0x781b('0x6'));var attributes=require(_0x781b('0x7'));module[_0x781b('0x8')]=function(_0x5eed8e,_0x3d9d36){return _0x5eed8e[_0x781b('0x9')]('FaxInteraction',attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3de3cd,_0x33c04b,_0x1fa67d){if(_0x3de3cd[_0x781b('0xa')]('closed')){_0x3de3cd[_0x781b('0xb')]=moment()[_0x781b('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x1fa67d(null,_0x3de3cd);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index dd26a94..7071a6b 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 _0x76a7=['stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','body','options','raw','where','attributes','limit','AddTagsToFaxInteraction','find','addTags','ids','AddTags','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x2ff75c,_0x2d7c8c){var _0x41b448=function(_0x315c15){while(--_0x315c15){_0x2ff75c['push'](_0x2ff75c['shift']());}};_0x41b448(++_0x2d7c8c);}(_0x76a7,0x1f3));var _0x776a=function(_0x2fe08b,_0x54a8c5){_0x2fe08b=_0x2fe08b-0x0;var _0x5d4912=_0x76a7[_0x2fe08b];return _0x5d4912;};'use strict';var _=require(_0x776a('0x0'));var util=require('util');var moment=require(_0x776a('0x1'));var BPromise=require(_0x776a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x776a('0x3'));var db=require(_0x776a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x776a('0x5'))('rpc');var config=require(_0x776a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x776a('0x7')][_0x776a('0x8')]({'port':0x232a});config[_0x776a('0x9')]=_[_0x776a('0xa')](config['redis'],{'host':_0x776a('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x776a('0x9')]));require(_0x776a('0xc'))[_0x776a('0xd')](socket);function respondWithRpcPromise(_0xcf15ac,_0x1f2e2b,_0x353cac){return new BPromise(function(_0x2fc167,_0x56bab4){return client[_0x776a('0xe')](_0xcf15ac,_0x353cac)[_0x776a('0xf')](function(_0x558e9c){logger[_0x776a('0x10')](_0x776a('0x11'),_0x1f2e2b,_0x776a('0x12'));logger[_0x776a('0x13')](_0x776a('0x14'),_0x1f2e2b,'request\x20sent',JSON[_0x776a('0x15')](_0x558e9c));if(_0x558e9c[_0x776a('0x16')]){if(_0x558e9c[_0x776a('0x16')][_0x776a('0x17')]===0x1f4){logger[_0x776a('0x16')](_0x776a('0x11'),_0x1f2e2b,_0x558e9c[_0x776a('0x16')][_0x776a('0x18')]);return _0x56bab4(_0x558e9c['error'][_0x776a('0x18')]);}logger[_0x776a('0x16')](_0x776a('0x11'),_0x1f2e2b,_0x558e9c[_0x776a('0x16')][_0x776a('0x18')]);return _0x2fc167(_0x558e9c[_0x776a('0x16')][_0x776a('0x18')]);}else{logger[_0x776a('0x10')](_0x776a('0x11'),_0x1f2e2b,_0x776a('0x12'));_0x2fc167(_0x558e9c[_0x776a('0x19')][_0x776a('0x18')]);}})[_0x776a('0x1a')](function(_0x5031a9){logger[_0x776a('0x16')](_0x776a('0x11'),_0x1f2e2b,_0x5031a9);_0x56bab4(_0x5031a9);});});}exports[_0x776a('0x1b')]=function(_0xfe4950){var _0x18a07f=this;return new Promise(function(_0x343628,_0x2b53b9){return db[_0x776a('0x1c')]['update'](_0xfe4950[_0x776a('0x1d')],{'raw':_0xfe4950[_0x776a('0x1e')]?_0xfe4950[_0x776a('0x1e')][_0x776a('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfe4950[_0x776a('0x1e')]?_0xfe4950[_0x776a('0x1e')][_0x776a('0x20')]||null:null,'attributes':_0xfe4950[_0x776a('0x1e')]?_0xfe4950['options'][_0x776a('0x21')]||null:null,'limit':_0xfe4950[_0x776a('0x1e')]?_0xfe4950[_0x776a('0x1e')][_0x776a('0x22')]||null:null})[_0x776a('0xf')](function(_0xe8bd7a){logger['info'](_0x776a('0x1b'),_0xfe4950);logger[_0x776a('0x13')](_0x776a('0x1b'),_0xfe4950,JSON[_0x776a('0x15')](_0xe8bd7a));_0x343628(_0xe8bd7a);})[_0x776a('0x1a')](function(_0x506a4f){logger[_0x776a('0x16')]('UpdateFaxInteraction',_0x506a4f[_0x776a('0x18')],_0xfe4950);_0x2b53b9(_0x18a07f[_0x776a('0x16')](0x1f4,_0x506a4f[_0x776a('0x18')]));});});};exports[_0x776a('0x23')]=function(_0x18eb2f){return new Promise(function(_0x19a253,_0x226e9c){return db[_0x776a('0x1c')][_0x776a('0x24')]({'where':_0x18eb2f[_0x776a('0x1e')]?_0x18eb2f[_0x776a('0x1e')][_0x776a('0x20')]||null:null})[_0x776a('0xf')](function(_0x366a27){if(_0x366a27){return _0x366a27[_0x776a('0x25')](_0x18eb2f[_0x776a('0x1d')][_0x776a('0x26')],_['omit'](_0x18eb2f[_0x776a('0x1d')],['ids','id'])||{});}})['spread'](function(_0x344157){logger[_0x776a('0x10')]('AddTags',_0x18eb2f);logger[_0x776a('0x13')](_0x776a('0x27'),_0x18eb2f,JSON[_0x776a('0x15')](_0x344157));_0x19a253(_0x344157);})[_0x776a('0x1a')](function(_0x5dae89){logger['error'](_0x776a('0x27'),_0x5dae89['message'],_0x18eb2f);_0x226e9c(_this[_0x776a('0x16')](0x1f4,_0x5dae89[_0x776a('0x18')]));});});}; \ No newline at end of file +var _0x6f6a=['then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','debug','stringify','AddTagsToFaxInteraction','find','ids','omit','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request'];(function(_0x298b56,_0x44d566){var _0x3fcc7c=function(_0x111d55){while(--_0x111d55){_0x298b56['push'](_0x298b56['shift']());}};_0x3fcc7c(++_0x44d566);}(_0x6f6a,0x131));var _0xa6f6=function(_0x141d2f,_0x54fcb5){_0x141d2f=_0x141d2f-0x0;var _0x54da2d=_0x6f6a[_0x141d2f];return _0x54da2d;};'use strict';var _=require(_0xa6f6('0x0'));var util=require(_0xa6f6('0x1'));var moment=require('moment');var BPromise=require(_0xa6f6('0x2'));var rs=require(_0xa6f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa6f6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa6f6('0x5'))(_0xa6f6('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa6f6('0x7')][_0xa6f6('0x8')]({'port':0x232a});config[_0xa6f6('0x9')]=_['defaults'](config[_0xa6f6('0x9')],{'host':_0xa6f6('0xa'),'port':0x18eb});var socket=require(_0xa6f6('0xb'))(new Redis(config['redis']));require(_0xa6f6('0xc'))[_0xa6f6('0xd')](socket);function respondWithRpcPromise(_0x16f4cf,_0x556458,_0x56ab33){return new BPromise(function(_0x1f2021,_0x57f7a0){return client[_0xa6f6('0xe')](_0x16f4cf,_0x56ab33)[_0xa6f6('0xf')](function(_0x43a35e){logger[_0xa6f6('0x10')](_0xa6f6('0x11'),_0x556458,_0xa6f6('0x12'));logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x556458,_0xa6f6('0x12'),JSON['stringify'](_0x43a35e));if(_0x43a35e[_0xa6f6('0x13')]){if(_0x43a35e[_0xa6f6('0x13')][_0xa6f6('0x14')]===0x1f4){logger[_0xa6f6('0x13')](_0xa6f6('0x11'),_0x556458,_0x43a35e[_0xa6f6('0x13')][_0xa6f6('0x15')]);return _0x57f7a0(_0x43a35e[_0xa6f6('0x13')]['message']);}logger['error'](_0xa6f6('0x11'),_0x556458,_0x43a35e[_0xa6f6('0x13')][_0xa6f6('0x15')]);return _0x1f2021(_0x43a35e[_0xa6f6('0x13')]['message']);}else{logger[_0xa6f6('0x10')](_0xa6f6('0x11'),_0x556458,'request\x20sent');_0x1f2021(_0x43a35e[_0xa6f6('0x16')][_0xa6f6('0x15')]);}})[_0xa6f6('0x17')](function(_0xf5f3b3){logger['error'](_0xa6f6('0x11'),_0x556458,_0xf5f3b3);_0x57f7a0(_0xf5f3b3);});});}exports[_0xa6f6('0x18')]=function(_0x407c54){var _0x193656=this;return new Promise(function(_0x2a39a9,_0x5b3201){return db[_0xa6f6('0x19')][_0xa6f6('0x1a')](_0x407c54[_0xa6f6('0x1b')],{'raw':_0x407c54[_0xa6f6('0x1c')]?_0x407c54[_0xa6f6('0x1c')][_0xa6f6('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x407c54['options']?_0x407c54[_0xa6f6('0x1c')][_0xa6f6('0x1e')]||null:null,'attributes':_0x407c54[_0xa6f6('0x1c')]?_0x407c54[_0xa6f6('0x1c')][_0xa6f6('0x1f')]||null:null,'limit':_0x407c54[_0xa6f6('0x1c')]?_0x407c54[_0xa6f6('0x1c')][_0xa6f6('0x20')]||null:null})[_0xa6f6('0xf')](function(_0x73cc3f){logger['info'](_0xa6f6('0x18'),_0x407c54);logger[_0xa6f6('0x21')](_0xa6f6('0x18'),_0x407c54,JSON[_0xa6f6('0x22')](_0x73cc3f));_0x2a39a9(_0x73cc3f);})[_0xa6f6('0x17')](function(_0x4f9dac){logger['error'](_0xa6f6('0x18'),_0x4f9dac[_0xa6f6('0x15')],_0x407c54);_0x5b3201(_0x193656[_0xa6f6('0x13')](0x1f4,_0x4f9dac['message']));});});};exports[_0xa6f6('0x23')]=function(_0x17c187){return new Promise(function(_0x129d91,_0x198d01){return db['FaxInteraction'][_0xa6f6('0x24')]({'where':_0x17c187[_0xa6f6('0x1c')]?_0x17c187[_0xa6f6('0x1c')][_0xa6f6('0x1e')]||null:null})[_0xa6f6('0xf')](function(_0x41b78b){if(_0x41b78b){return _0x41b78b['addTags'](_0x17c187[_0xa6f6('0x1b')][_0xa6f6('0x25')],_[_0xa6f6('0x26')](_0x17c187[_0xa6f6('0x1b')],[_0xa6f6('0x25'),'id'])||{});}})['spread'](function(_0x45aec3){logger['info'](_0xa6f6('0x27'),_0x17c187);logger['debug']('AddTags',_0x17c187,JSON[_0xa6f6('0x22')](_0x45aec3));_0x129d91(_0x45aec3);})['catch'](function(_0x591de){logger[_0xa6f6('0x13')](_0xa6f6('0x27'),_0x591de['message'],_0x17c187);_0x198d01(_this[_0xa6f6('0x13')](0x1f4,_0x591de[_0xa6f6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 80f29f7..15a9466 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 _0xb810=['update','emit','length','./faxInteraction.events','save','remove'];(function(_0xab649b,_0x1519e9){var _0x3b7584=function(_0x4b878e){while(--_0x4b878e){_0xab649b['push'](_0xab649b['shift']());}};_0x3b7584(++_0x1519e9);}(_0xb810,0x14d));var _0x0b81=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xb810[_0x7e2eb0];return _0xd92de4;};'use strict';var FaxInteractionEvents=require(_0x0b81('0x0'));var events=[_0x0b81('0x1'),_0x0b81('0x2'),_0x0b81('0x3')];function createListener(_0x22011b,_0x282868){return function(_0x11cf6a){_0x282868[_0x0b81('0x4')](_0x22011b,_0x11cf6a);};}function removeListener(_0x4a5c53,_0x563bda){return function(){FaxInteractionEvents['removeListener'](_0x4a5c53,_0x563bda);};}exports['register']=function(_0x46bd1e){for(var _0xca3ef=0x0,_0x370569=events[_0x0b81('0x5')];_0xca3ef<_0x370569;_0xca3ef++){var _0x405e76=events[_0xca3ef];var _0x15a5f0=createListener('faxInteraction:'+_0x405e76,_0x46bd1e);FaxInteractionEvents['on'](_0x405e76,_0x15a5f0);}}; \ No newline at end of file +var _0xa641=['faxInteraction:','remove','emit','register','length'];(function(_0x20c0e7,_0x4e172a){var _0x405098=function(_0x45853d){while(--_0x45853d){_0x20c0e7['push'](_0x20c0e7['shift']());}};_0x405098(++_0x4e172a);}(_0xa641,0xc4));var _0x1a64=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xa641[_0x45783c];return _0x1161da;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save',_0x1a64('0x0'),'update'];function createListener(_0x35d1a5,_0x5a9c13){return function(_0xa860d7){_0x5a9c13[_0x1a64('0x1')](_0x35d1a5,_0xa860d7);};}function removeListener(_0x1f4bca,_0x503a57){return function(){FaxInteractionEvents['removeListener'](_0x1f4bca,_0x503a57);};}exports[_0x1a64('0x2')]=function(_0x1b72b0){for(var _0x5ab91e=0x0,_0x174315=events[_0x1a64('0x3')];_0x5ab91e<_0x174315;_0x5ab91e++){var _0x22193f=events[_0x5ab91e];var _0x238ae2=createListener(_0x1a64('0x4')+_0x22193f,_0x1b72b0);FaxInteractionEvents['on'](_0x22193f,_0x238ae2);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index ab9cee3..a438873 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 _0xced4=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./faxInteraction.controller','isAuthenticated','get','describe','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','fax','faxinteraction:addtags','addTags','put','/:id','tracked','faxinteraction:update','update','delete','destroy','removeTags'];(function(_0x29de96,_0x42cc38){var _0x1b9352=function(_0x4a288a){while(--_0x4a288a){_0x29de96['push'](_0x29de96['shift']());}};_0x1b9352(++_0x42cc38);}(_0xced4,0x1c3));var _0x4ced=function(_0x39531c,_0x4e4dfb){_0x39531c=_0x39531c-0x0;var _0x9dfc07=_0xced4[_0x39531c];return _0x9dfc07;};'use strict';var multer=require(_0x4ced('0x0'));var util=require(_0x4ced('0x1'));var path=require(_0x4ced('0x2'));var timeout=require(_0x4ced('0x3'));var express=require(_0x4ced('0x4'));var router=express[_0x4ced('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4ced('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4ced('0x7'));router['get']('/',auth[_0x4ced('0x8')](),controller['index']);router[_0x4ced('0x9')]('/describe',auth[_0x4ced('0x8')](),controller[_0x4ced('0xa')]);router[_0x4ced('0x9')]('/:id',auth[_0x4ced('0x8')](),controller['show']);router['get'](_0x4ced('0xb'),auth[_0x4ced('0x8')](),controller['getMessages']);router[_0x4ced('0x9')](_0x4ced('0xc'),auth[_0x4ced('0x8')](),controller[_0x4ced('0xd')]);router[_0x4ced('0xe')]('/',auth[_0x4ced('0x8')](),controller[_0x4ced('0xf')]);router[_0x4ced('0xe')]('/:id/messages',auth['isAuthenticated'](),controller[_0x4ced('0x10')]);router[_0x4ced('0xe')](_0x4ced('0x11'),auth[_0x4ced('0x8')](),interaction['tracked'](_0x4ced('0x12'),_0x4ced('0x13')),controller[_0x4ced('0x14')]);router[_0x4ced('0x15')](_0x4ced('0x16'),auth['isAuthenticated'](),interaction[_0x4ced('0x17')](_0x4ced('0x12'),_0x4ced('0x18')),controller[_0x4ced('0x19')]);router[_0x4ced('0x1a')](_0x4ced('0x16'),auth[_0x4ced('0x8')](),interaction['tracked']('fax','faxinteraction:destroy'),controller[_0x4ced('0x1b')]);router[_0x4ced('0x1a')](_0x4ced('0x11'),auth['isAuthenticated'](),controller[_0x4ced('0x1c')]);module[_0x4ced('0x1d')]=router; \ No newline at end of file +var _0xa07c=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','fax','faxinteraction:addtags','addTags','/:id','faxinteraction:update','update','tracked','faxinteraction:destroy','destroy','removeTags','multer','path'];(function(_0x3452a8,_0x4bfaa4){var _0x233814=function(_0x40b537){while(--_0x40b537){_0x3452a8['push'](_0x3452a8['shift']());}};_0x233814(++_0x4bfaa4);}(_0xa07c,0x11e));var _0xca07=function(_0x4b702b,_0x5636fc){_0x4b702b=_0x4b702b-0x0;var _0x9549=_0xa07c[_0x4b702b];return _0x9549;};'use strict';var multer=require(_0xca07('0x0'));var util=require('util');var path=require(_0xca07('0x1'));var timeout=require(_0xca07('0x2'));var express=require(_0xca07('0x3'));var router=express[_0xca07('0x4')]();var fs_extra=require(_0xca07('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xca07('0x6'));var config=require(_0xca07('0x7'));var controller=require(_0xca07('0x8'));router[_0xca07('0x9')]('/',auth[_0xca07('0xa')](),controller[_0xca07('0xb')]);router[_0xca07('0x9')](_0xca07('0xc'),auth[_0xca07('0xa')](),controller[_0xca07('0xd')]);router[_0xca07('0x9')]('/:id',auth[_0xca07('0xa')](),controller['show']);router[_0xca07('0x9')](_0xca07('0xe'),auth[_0xca07('0xa')](),controller[_0xca07('0xf')]);router['get'](_0xca07('0x10'),auth[_0xca07('0xa')](),controller[_0xca07('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xca07('0x12')]);router[_0xca07('0x13')]('/:id/messages',auth[_0xca07('0xa')](),controller[_0xca07('0x14')]);router[_0xca07('0x13')](_0xca07('0x15'),auth[_0xca07('0xa')](),interaction['tracked'](_0xca07('0x16'),_0xca07('0x17')),controller[_0xca07('0x18')]);router['put'](_0xca07('0x19'),auth[_0xca07('0xa')](),interaction['tracked']('fax',_0xca07('0x1a')),controller[_0xca07('0x1b')]);router['delete'](_0xca07('0x19'),auth['isAuthenticated'](),interaction[_0xca07('0x1c')](_0xca07('0x16'),_0xca07('0x1d')),controller[_0xca07('0x1e')]);router['delete'](_0xca07('0x15'),auth['isAuthenticated'](),controller[_0xca07('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 76c87a3..d15c077 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 _0xe107=['TEXT','medium','BOOLEAN','out','DATE','sequelize'];(function(_0xc7438e,_0x1d8cff){var _0x3e69c2=function(_0x320d79){while(--_0x320d79){_0xc7438e['push'](_0xc7438e['shift']());}};_0x3e69c2(++_0x1d8cff);}(_0xe107,0xb3));var _0x7e10=function(_0x4d912e,_0x5f19fd){_0x4d912e=_0x4d912e-0x0;var _0x53f979=_0xe107[_0x4d912e];return _0x53f979;};'use strict';var Sequelize=require(_0x7e10('0x0'));module['exports']={'body':{'type':Sequelize[_0x7e10('0x1')](_0x7e10('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x7e10('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x7e10('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x7e10('0x5')]}}; \ No newline at end of file +var _0xf9f7=['exports','TEXT','medium','BOOLEAN','ENUM','DATE','sequelize'];(function(_0x5769db,_0x134827){var _0x52b820=function(_0x342af7){while(--_0x342af7){_0x5769db['push'](_0x5769db['shift']());}};_0x52b820(++_0x134827);}(_0xf9f7,0xdf));var _0x7f9f=function(_0xc6879,_0x84a966){_0xc6879=_0xc6879-0x0;var _0x54f7a4=_0xf9f7[_0xc6879];return _0x54f7a4;};'use strict';var Sequelize=require(_0x7f9f('0x0'));module[_0x7f9f('0x1')]={'body':{'type':Sequelize[_0x7f9f('0x2')](_0x7f9f('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x7f9f('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7f9f('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x7f9f('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x7f9f('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 17fcf69..ee7a5f1 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 _0xf0d8=['email','internal','interface','channel','motionChannel','event','EventManager','acceptmessage','fax','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','contact','SIP/%s','rejectmessage','create','CmContact','findOne','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','join','root','server','files','attachments','Attachment','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','client','http','request','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','includeAll','include','FaxMessage','rows','show','params','find','catch','body','../../config/logger','fax-interactions','accept','read','format','UserId','user','agent','get','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','User','fullname'];(function(_0x240ac1,_0x276045){var _0x1c9fc5=function(_0x41ee2b){while(--_0x41ee2b){_0x240ac1['push'](_0x240ac1['shift']());}};_0x1c9fc5(++_0x276045);}(_0xf0d8,0x144));var _0x8f0d=function(_0x293514,_0x118462){_0x293514=_0x293514-0x0;var _0x1d765e=_0xf0d8[_0x293514];return _0x1d765e;};'use strict';var emlformat=require(_0x8f0d('0x0'));var rimraf=require(_0x8f0d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8f0d('0x2'));var rp=require(_0x8f0d('0x3'));var moment=require(_0x8f0d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8f0d('0x5'));var util=require('util');var path=require(_0x8f0d('0x6'));var sox=require(_0x8f0d('0x7'));var csv=require(_0x8f0d('0x8'));var ejs=require(_0x8f0d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8f0d('0xa'));var crypto=require(_0x8f0d('0xb'));var jsforce=require(_0x8f0d('0xc'));var deskjs=require(_0x8f0d('0xd'));var toCsv=require(_0x8f0d('0x8'));var querystring=require(_0x8f0d('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8f0d('0xf'));var qs=require(_0x8f0d('0x10'));var as=require(_0x8f0d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8f0d('0x12'));var utils=require(_0x8f0d('0x13'));var config=require(_0x8f0d('0x14'));var licenseUtil=require(_0x8f0d('0x15'));var db=require(_0x8f0d('0x16'))['db'];config[_0x8f0d('0x17')]=_[_0x8f0d('0x18')](config[_0x8f0d('0x17')],{'host':_0x8f0d('0x19'),'port':0x18eb});var socket=require(_0x8f0d('0x1a'))(new Redis(config[_0x8f0d('0x17')]));require(_0x8f0d('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x8f0d('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x8f0d('0x1c')][_0x8f0d('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4ac3c5,_0x4dc572,_0x53cc4a,_0x2992b3){return new BPromise(function(_0x5c3345,_0x1dd4ad){var _0x5aa564=_0x2992b3||client;return _0x5aa564[_0x8f0d('0x1e')](_0x4ac3c5,_0x53cc4a)['then'](function(_0x5de0ce){logger['info'](_0x8f0d('0x1f'),_0x4dc572,_0x8f0d('0x20'));logger[_0x8f0d('0x21')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x4dc572,'request\x20sent',JSON[_0x8f0d('0x22')](_0x5de0ce));if(_0x5de0ce[_0x8f0d('0x23')]){if(_0x5de0ce[_0x8f0d('0x23')][_0x8f0d('0x24')]===0x1f4){logger[_0x8f0d('0x23')](_0x8f0d('0x1f'),_0x4dc572,_0x5de0ce[_0x8f0d('0x23')][_0x8f0d('0x25')]);return _0x1dd4ad(_0x5de0ce['error'][_0x8f0d('0x25')]);}logger[_0x8f0d('0x23')]('FaxMessage,\x20%s,\x20%s',_0x4dc572,_0x5de0ce['error'][_0x8f0d('0x25')]);return _0x5c3345(_0x5de0ce[_0x8f0d('0x23')][_0x8f0d('0x25')]);}else{logger[_0x8f0d('0x26')]('FaxMessage,\x20%s,\x20%s',_0x4dc572,'request\x20sent');_0x5c3345(_0x5de0ce[_0x8f0d('0x27')]['message']);}})['catch'](function(_0x5a2a2d){logger[_0x8f0d('0x23')](_0x8f0d('0x1f'),_0x4dc572,_0x5a2a2d);_0x1dd4ad(_0x5a2a2d);});});}function respondWithStatusCode(_0x261319,_0x45fae3){_0x45fae3=_0x45fae3||0xcc;return function(_0x57e945){if(_0x57e945){return _0x261319['sendStatus'](_0x45fae3);}return _0x261319['status'](_0x45fae3)[_0x8f0d('0x28')]();};}function respondWithResult(_0x4049eb,_0x1cc29d){_0x1cc29d=_0x1cc29d||0xc8;return function(_0x60d878){if(_0x60d878){return _0x4049eb['status'](_0x1cc29d)[_0x8f0d('0x29')](_0x60d878);}};}function respondWithFilteredResult(_0x4d1ba4,_0x506177){return function(_0x253a89){if(_0x253a89){var _0x5bfe65=typeof _0x506177[_0x8f0d('0x2a')]===_0x8f0d('0x2b')&&typeof _0x506177[_0x8f0d('0x2c')]===_0x8f0d('0x2b');var _0x3cbd2c=_0x253a89[_0x8f0d('0x2d')];var _0x9523d1=_0x5bfe65?0x0:_0x506177['offset'];var _0x1d4535=_0x5bfe65?_0x253a89[_0x8f0d('0x2d')]:_0x506177['offset']+_0x506177['limit'];var _0x113205;if(_0x1d4535>=_0x3cbd2c){_0x1d4535=_0x3cbd2c;_0x113205=0xc8;}else{_0x113205=0xce;}_0x4d1ba4[_0x8f0d('0x2e')](_0x113205);return _0x4d1ba4[_0x8f0d('0x2f')](_0x8f0d('0x30'),_0x9523d1+'-'+_0x1d4535+'/'+_0x3cbd2c)[_0x8f0d('0x29')](_0x253a89);}return null;};}function patchUpdates(_0x470d62){return function(_0x2bdf95){try{jsonpatch[_0x8f0d('0x31')](_0x2bdf95,_0x470d62,!![]);}catch(_0x3a76a7){return BPromise[_0x8f0d('0x32')](_0x3a76a7);}return _0x2bdf95[_0x8f0d('0x33')]();};}function saveUpdates(_0x4f5ee3,_0x484b3b){return function(_0x3e249c){if(_0x3e249c){return _0x3e249c[_0x8f0d('0x34')](_0x4f5ee3)[_0x8f0d('0x35')](function(_0x230fd0){return _0x230fd0;});}return null;};}function removeEntity(_0x4670bb,_0x2a6cc1){return function(_0x9ce2a9){if(_0x9ce2a9){return _0x9ce2a9[_0x8f0d('0x36')]()[_0x8f0d('0x35')](function(){_0x4670bb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x52c3c0,_0x4461c0){return function(_0x4d0be9){if(!_0x4d0be9){_0x52c3c0[_0x8f0d('0x37')](0x194);}return _0x4d0be9;};}function handleError(_0x14c83c,_0x30e9e6){_0x30e9e6=_0x30e9e6||0x1f4;return function(_0x4ce68c){logger[_0x8f0d('0x23')](_0x4ce68c['stack']);if(_0x4ce68c[_0x8f0d('0x38')]){delete _0x4ce68c[_0x8f0d('0x38')];}_0x14c83c['status'](_0x30e9e6)[_0x8f0d('0x39')](_0x4ce68c);};}exports['index']=function(_0x269628,_0x1391e9){var _0x26e3aa={},_0x5af107={},_0x434f77={'count':0x0,'rows':[]};var _0x139ee9=_[_0x8f0d('0x3a')](db['FaxMessage'][_0x8f0d('0x3b')],function(_0x158f68){return{'name':_0x158f68[_0x8f0d('0x3c')],'type':_0x158f68[_0x8f0d('0x3d')][_0x8f0d('0x3e')]};});_0x5af107[_0x8f0d('0x3f')]=_[_0x8f0d('0x3a')](_0x139ee9,'name');_0x5af107['query']=_[_0x8f0d('0x40')](_0x269628[_0x8f0d('0x41')]);_0x5af107[_0x8f0d('0x42')]=_['intersection'](_0x5af107[_0x8f0d('0x3f')],_0x5af107[_0x8f0d('0x41')]);_0x26e3aa['attributes']=_[_0x8f0d('0x43')](_0x5af107[_0x8f0d('0x3f')],qs[_0x8f0d('0x44')](_0x269628['query'][_0x8f0d('0x44')]));_0x26e3aa[_0x8f0d('0x45')]=_0x26e3aa[_0x8f0d('0x45')][_0x8f0d('0x46')]?_0x26e3aa['attributes']:_0x5af107[_0x8f0d('0x3f')];if(!_0x269628[_0x8f0d('0x41')][_0x8f0d('0x47')](_0x8f0d('0x48'))){_0x26e3aa[_0x8f0d('0x2c')]=qs['limit'](_0x269628['query']['limit']);_0x26e3aa[_0x8f0d('0x2a')]=qs[_0x8f0d('0x2a')](_0x269628[_0x8f0d('0x41')]['offset']);}_0x26e3aa[_0x8f0d('0x49')]=qs[_0x8f0d('0x4a')](_0x269628[_0x8f0d('0x41')][_0x8f0d('0x4a')]);_0x26e3aa['where']=qs[_0x8f0d('0x42')](_[_0x8f0d('0x4b')](_0x269628[_0x8f0d('0x41')],_0x5af107[_0x8f0d('0x42')]),_0x139ee9);if(_0x269628[_0x8f0d('0x41')]['filter']){_0x26e3aa[_0x8f0d('0x4c')]=_[_0x8f0d('0x4d')](_0x26e3aa[_0x8f0d('0x4c')],{'$or':_[_0x8f0d('0x3a')](_0x139ee9,function(_0x1c0db6){if(_0x1c0db6[_0x8f0d('0x3d')]!=='VIRTUAL'){var _0xa8fcd1={};_0xa8fcd1[_0x1c0db6[_0x8f0d('0x38')]]={'$like':'%'+_0x269628[_0x8f0d('0x41')][_0x8f0d('0x4e')]+'%'};return _0xa8fcd1;}})});}_0x26e3aa=_[_0x8f0d('0x4d')]({},_0x26e3aa,_0x269628[_0x8f0d('0x4f')]);var _0x45f1bf={'where':_0x26e3aa[_0x8f0d('0x4c')]};return db['FaxMessage']['count'](_0x45f1bf)[_0x8f0d('0x35')](function(_0x48cd27){_0x434f77['count']=_0x48cd27;if(_0x269628[_0x8f0d('0x41')][_0x8f0d('0x50')]){_0x26e3aa[_0x8f0d('0x51')]=[{'all':!![]}];}return db[_0x8f0d('0x52')]['findAll'](_0x26e3aa);})[_0x8f0d('0x35')](function(_0xc35a5c){_0x434f77[_0x8f0d('0x53')]=_0xc35a5c;return _0x434f77;})[_0x8f0d('0x35')](respondWithFilteredResult(_0x1391e9,_0x26e3aa))['catch'](handleError(_0x1391e9,null));};exports[_0x8f0d('0x54')]=function(_0x197519,_0xa3343){var _0x13ecf9={'raw':!![],'where':{'id':_0x197519[_0x8f0d('0x55')]['id']}},_0xb872a6={};_0xb872a6[_0x8f0d('0x3f')]=_[_0x8f0d('0x40')](db['FaxMessage']['rawAttributes']);_0xb872a6[_0x8f0d('0x41')]=_[_0x8f0d('0x40')](_0x197519[_0x8f0d('0x41')]);_0xb872a6[_0x8f0d('0x42')]=_[_0x8f0d('0x43')](_0xb872a6[_0x8f0d('0x3f')],_0xb872a6[_0x8f0d('0x41')]);_0x13ecf9['attributes']=_['intersection'](_0xb872a6[_0x8f0d('0x3f')],qs[_0x8f0d('0x44')](_0x197519[_0x8f0d('0x41')][_0x8f0d('0x44')]));_0x13ecf9[_0x8f0d('0x45')]=_0x13ecf9[_0x8f0d('0x45')][_0x8f0d('0x46')]?_0x13ecf9[_0x8f0d('0x45')]:_0xb872a6[_0x8f0d('0x3f')];if(_0x197519[_0x8f0d('0x41')][_0x8f0d('0x50')]){_0x13ecf9['include']=[{'all':!![]}];}_0x13ecf9=_['merge']({},_0x13ecf9,_0x197519[_0x8f0d('0x4f')]);return db[_0x8f0d('0x52')][_0x8f0d('0x56')](_0x13ecf9)['then'](handleEntityNotFound(_0xa3343,null))[_0x8f0d('0x35')](respondWithResult(_0xa3343,null))[_0x8f0d('0x57')](handleError(_0xa3343,null));};exports[_0x8f0d('0x34')]=function(_0x324679,_0x1a749b){if(_0x324679[_0x8f0d('0x58')]['id']){delete _0x324679[_0x8f0d('0x58')]['id'];}return db[_0x8f0d('0x52')][_0x8f0d('0x56')]({'where':{'id':_0x324679[_0x8f0d('0x55')]['id']}})[_0x8f0d('0x35')](handleEntityNotFound(_0x1a749b,null))[_0x8f0d('0x35')](saveUpdates(_0x324679['body'],null))[_0x8f0d('0x35')](respondWithResult(_0x1a749b,null))[_0x8f0d('0x57')](handleError(_0x1a749b,null));};exports['destroy']=function(_0x2f35d9,_0x1cd129){return db['FaxMessage']['find']({'where':{'id':_0x2f35d9[_0x8f0d('0x55')]['id']}})['then'](handleEntityNotFound(_0x1cd129,null))[_0x8f0d('0x35')](removeEntity(_0x1cd129,null))[_0x8f0d('0x57')](handleError(_0x1cd129,null));};exports['describe']=function(_0x212303,_0x54074a){return db['FaxMessage']['describe']()[_0x8f0d('0x35')](respondWithResult(_0x54074a,null))[_0x8f0d('0x57')](handleError(_0x54074a,null));};var interaction_log=require(_0x8f0d('0x59'))(_0x8f0d('0x5a'));exports[_0x8f0d('0x5b')]=function(_0x13fb72,_0x3b4a05,_0x538df3){var _0x4db3ee={'agent':{},'channel':'fax'};if(_0x13fb72[_0x8f0d('0x58')]['id']){delete _0x13fb72[_0x8f0d('0x58')]['id'];}_0x13fb72['body'][_0x8f0d('0x5c')]=!![];_0x13fb72[_0x8f0d('0x58')]['readAt']=moment()[_0x8f0d('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x13fb72['body'][_0x8f0d('0x5e')]=_0x13fb72[_0x8f0d('0x58')][_0x8f0d('0x5e')]||_0x13fb72[_0x8f0d('0x5f')]['id'];_0x4db3ee[_0x8f0d('0x60')]['id']=_0x13fb72['body'][_0x8f0d('0x5e')];return db['FaxMessage'][_0x8f0d('0x56')]({'where':{'id':_0x13fb72['params']['id'],'UserId':null}})[_0x8f0d('0x35')](handleEntityNotFound(_0x3b4a05,null))[_0x8f0d('0x35')](saveUpdates(_0x13fb72[_0x8f0d('0x58')],null))[_0x8f0d('0x35')](function(_0x55c152){if(_0x55c152){_0x4db3ee[_0x8f0d('0x25')]=_0x55c152[_0x8f0d('0x61')]({'plain':!![]});return db['FaxInteraction'][_0x8f0d('0x56')]({'where':{'id':_0x55c152[_0x8f0d('0x62')]}});}return null;})[_0x8f0d('0x35')](handleEntityNotFound(_0x3b4a05,null))[_0x8f0d('0x35')](function(_0x40f292){if(_0x40f292){return _0x40f292[_0x8f0d('0x34')]({'UserId':_0x13fb72[_0x8f0d('0x58')][_0x8f0d('0x5e')],'read1stAt':_[_0x8f0d('0x63')](_0x40f292[_0x8f0d('0x64')])?moment()[_0x8f0d('0x5d')](_0x8f0d('0x65')):undefined});}return null;})['then'](function(_0x3239fe){if(_0x3239fe){_0x4db3ee[_0x8f0d('0x66')]=_0x3239fe['get']({'plain':!![]});interaction_log[_0x8f0d('0x26')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x13fb72[_0x8f0d('0x5f')]['id'],_0x13fb72[_0x8f0d('0x5f')]['name'],_0x13fb72[_0x8f0d('0x5f')][_0x8f0d('0x67')],_0x4db3ee[_0x8f0d('0x66')]['id'],_0x13fb72['body']?JSON[_0x8f0d('0x22')](_0x13fb72[_0x8f0d('0x58')]):_0x8f0d('0x68'));return respondWithRpcPromise(_0x8f0d('0x69'),_0x8f0d('0x6a'),_0x4db3ee);}return null;})[_0x8f0d('0x35')](function(_0x59ca41){var _0x7b9e18=_0x8f0d('0x6b')+_0x59ca41[_0x8f0d('0x25')][_0x8f0d('0x6c')];return db[_0x8f0d('0x6d')][_0x8f0d('0x41')](_0x7b9e18,{'type':db[_0x8f0d('0x6e')][_0x8f0d('0x6f')]['SELECT'],'raw':!![]})[_0x8f0d('0x35')](function(_0x23a137){return _0x23a137;});})[_0x8f0d('0x35')](function(_0x247b5b){if(_0x247b5b){_0x4db3ee[_0x8f0d('0x25')]['contact']=_0x247b5b[0x0];if(!_0x13fb72[_0x8f0d('0x58')][_0x8f0d('0x5e')])return;return db[_0x8f0d('0x70')][_0x8f0d('0x56')]({'where':{'id':_0x13fb72[_0x8f0d('0x58')][_0x8f0d('0x5e')],'role':_0x8f0d('0x60')},'attributes':['id','name',_0x8f0d('0x71'),_0x8f0d('0x72'),_0x8f0d('0x73')],'raw':!![]});}return null;})[_0x8f0d('0x35')](function(_0x33d571){if(!_0x33d571)return null;_0x4db3ee[_0x8f0d('0x25')][_0x8f0d('0x60')]=_0x33d571;return _0x4db3ee;})['then'](function(_0x1ee3a9){if(_0x1ee3a9){if(_0x13fb72['body']['manual']){_0x4db3ee[_0x8f0d('0x25')][_0x8f0d('0x74')]=util[_0x8f0d('0x5d')]('SIP/%s',_0x13fb72['user'][_0x8f0d('0x38')]);_0x4db3ee[_0x8f0d('0x25')]['channel']=_0x4db3ee[_0x8f0d('0x75')];_0x4db3ee[_0x8f0d('0x25')][_0x8f0d('0x76')]=_0x4db3ee['channel'];_0x4db3ee[_0x8f0d('0x25')][_0x8f0d('0x77')]=_0x8f0d('0x5b');return respondWithRpcPromise(_0x8f0d('0x78'),_0x8f0d('0x78'),{'event':_0x8f0d('0x79'),'message':_0x4db3ee['message']},client9002)['then'](function(){return _0x4db3ee;});}return _0x4db3ee;}return null;})[_0x8f0d('0x35')](respondWithResult(_0x3b4a05,null))['catch'](handleError(_0x3b4a05,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports['reject']=function(_0x16499e,_0x15278,_0x23accf){var _0x439b07={'agent':{},'channel':_0x8f0d('0x7a')};if(_0x16499e[_0x8f0d('0x58')]['id']){delete _0x16499e[_0x8f0d('0x58')]['id'];}_0x16499e[_0x8f0d('0x58')][_0x8f0d('0x5e')]=_0x16499e[_0x8f0d('0x58')][_0x8f0d('0x5e')]||_0x16499e['user']['id'];_0x439b07[_0x8f0d('0x60')]['id']=_0x16499e[_0x8f0d('0x58')][_0x8f0d('0x5e')];return db[_0x8f0d('0x52')][_0x8f0d('0x56')]({'where':{'id':_0x16499e['params']['id'],'UserId':null}})[_0x8f0d('0x35')](handleEntityNotFound(_0x15278,null))[_0x8f0d('0x35')](function(_0x118aee){if(_0x118aee){_0x439b07[_0x8f0d('0x25')]=_0x118aee[_0x8f0d('0x61')]({'plain':!![]});return db[_0x8f0d('0x7b')][_0x8f0d('0x56')]({'where':{'id':_0x118aee['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x15278,null))[_0x8f0d('0x35')](function(_0x48214d){if(_0x48214d){_0x439b07[_0x8f0d('0x66')]=_0x48214d[_0x8f0d('0x61')]({'plain':!![]});interaction_log[_0x8f0d('0x26')](_0x8f0d('0x7c'),_0x16499e[_0x8f0d('0x5f')]['id'],_0x16499e[_0x8f0d('0x5f')][_0x8f0d('0x38')],_0x16499e[_0x8f0d('0x5f')][_0x8f0d('0x67')],_0x439b07['interaction']['id'],_0x16499e[_0x8f0d('0x58')]?JSON[_0x8f0d('0x22')](_0x16499e[_0x8f0d('0x58')]):_0x8f0d('0x68'));return respondWithRpcPromise(_0x8f0d('0x7d'),_0x8f0d('0x7e'),_0x439b07);}return null;})[_0x8f0d('0x35')](function(_0x139780){var _0x3f2cb8=_0x8f0d('0x6b')+_0x139780[_0x8f0d('0x25')][_0x8f0d('0x6c')];return db[_0x8f0d('0x6d')][_0x8f0d('0x41')](_0x3f2cb8,{'type':db['Sequelize'][_0x8f0d('0x6f')][_0x8f0d('0x7f')],'raw':!![]})['then'](function(_0x18c7b9){return _0x18c7b9;});})[_0x8f0d('0x35')](function(_0x35f43e){if(_0x35f43e){_0x439b07['message'][_0x8f0d('0x80')]=_0x35f43e[0x0];if(!_0x16499e[_0x8f0d('0x58')][_0x8f0d('0x5e')])return;return db['User'][_0x8f0d('0x56')]({'where':{'id':_0x16499e[_0x8f0d('0x58')]['UserId'],'role':'agent'},'attributes':['id','name',_0x8f0d('0x71'),_0x8f0d('0x72'),_0x8f0d('0x73')],'raw':!![]});}return null;})[_0x8f0d('0x35')](function(_0x41df3c){if(!_0x41df3c)return null;_0x439b07['message'][_0x8f0d('0x60')]=_0x41df3c;return _0x439b07;})[_0x8f0d('0x35')](function(_0x4838f4){if(_0x4838f4){_0x4838f4[_0x8f0d('0x25')][_0x8f0d('0x74')]=util[_0x8f0d('0x5d')](_0x8f0d('0x81'),_0x16499e[_0x8f0d('0x5f')][_0x8f0d('0x38')]);_0x4838f4[_0x8f0d('0x25')][_0x8f0d('0x75')]=_0x439b07[_0x8f0d('0x75')];_0x4838f4[_0x8f0d('0x25')][_0x8f0d('0x76')]=_0x439b07[_0x8f0d('0x75')];_0x4838f4['message'][_0x8f0d('0x77')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0x8f0d('0x82'),'message':_0x4838f4['message']},client9002);return _0x439b07;}return null;})['then'](respondWithResult(_0x15278,null))[_0x8f0d('0x57')](handleError(_0x15278,null));};exports[_0x8f0d('0x83')]=function(_0x5a4a99,_0x21c5f1){var _0x3dea84;return db[_0x8f0d('0x52')]['create'](_0x5a4a99['body'],{})[_0x8f0d('0x35')](function(_0x3b40d2){_0x3dea84=_0x3b40d2;return db[_0x8f0d('0x84')][_0x8f0d('0x85')]({'where':{'id':_0x3dea84[_0x8f0d('0x6c')]}});})[_0x8f0d('0x35')](function(_0x453f9e){if(_['isNil'](_0x453f9e)){return;}else{_0x3dea84[_0x8f0d('0x7a')]=_0x453f9e['fax'];return db['Attachment'][_0x8f0d('0x85')]({'where':{'id':_0x3dea84['AttachmentId']}});}})[_0x8f0d('0x35')](function(_0x3e5d31){return respondWithRpcPromise('SendFax',_0x8f0d('0x86'),{'FaxAccountId':_['isNil'](_0x5a4a99[_0x8f0d('0x58')])?undefined:_0x5a4a99[_0x8f0d('0x58')][_0x8f0d('0x87')],'path':_[_0x8f0d('0x63')](_0x3e5d31)?undefined:util[_0x8f0d('0x5d')](_0x8f0d('0x88'),_0x3e5d31[_0x8f0d('0x89')]),'fax':_[_0x8f0d('0x63')](_0x3dea84[_0x8f0d('0x7a')])?undefined:_0x3dea84[_0x8f0d('0x7a')],'AttachmentId':_0x3dea84[_0x8f0d('0x8a')]},client9002);})['then'](respondWithResult(_0x21c5f1,0xc9))[_0x8f0d('0x57')](handleError(_0x21c5f1,null));};exports[_0x8f0d('0x8b')]=function(_0x43daad,_0x52a4a9){var _0x31105e=path[_0x8f0d('0x8c')](config[_0x8f0d('0x8d')],_0x8f0d('0x8e'),_0x8f0d('0x8f'),_0x8f0d('0x90'));return db[_0x8f0d('0x52')][_0x8f0d('0x56')]({'where':{'id':_0x43daad[_0x8f0d('0x55')]['id']},'include':[{'model':db[_0x8f0d('0x91')],'as':_0x8f0d('0x91')}]})[_0x8f0d('0x35')](handleEntityNotFound(_0x52a4a9,null))[_0x8f0d('0x35')](function(_0x2bc667){if(_0x2bc667){return _0x52a4a9[_0x8f0d('0x8b')](path[_0x8f0d('0x8c')](_0x31105e,_0x2bc667[_0x8f0d('0x91')][_0x8f0d('0x89')]));}})['catch'](handleError(_0x52a4a9,null));}; \ No newline at end of file +var _0x770b=['lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','set','apply','save','update','destroy','status','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','includeAll','include','rows','show','params','options','find','body','describe','../../config/logger','fax-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','interaction','role','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','fullname','email','internal','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','fax','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','User','interface','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','root','server','files','attachments','join','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra'];(function(_0x29851d,_0x1a7baf){var _0x4d142f=function(_0x531542){while(--_0x531542){_0x29851d['push'](_0x29851d['shift']());}};_0x4d142f(++_0x1a7baf);}(_0x770b,0x81));var _0xb770=function(_0xfc406a,_0x4479e1){_0xfc406a=_0xfc406a-0x0;var _0x395473=_0x770b[_0xfc406a];return _0x395473;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb770('0x0'));var zipdir=require(_0xb770('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb770('0x2'));var moment=require(_0xb770('0x3'));var BPromise=require(_0xb770('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb770('0x5'));var sox=require('sox');var csv=require(_0xb770('0x6'));var ejs=require(_0xb770('0x7'));var fs=require('fs');var fs_extra=require(_0xb770('0x8'));var _=require(_0xb770('0x9'));var squel=require(_0xb770('0xa'));var crypto=require(_0xb770('0xb'));var jsforce=require(_0xb770('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb770('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb770('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xb770('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb770('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xb770('0x11'),'port':0x18eb});var socket=require(_0xb770('0x12'))(new Redis(config['redis']));require('./faxMessage.socket')[_0xb770('0x13')](socket);var jayson=require(_0xb770('0x14'));var client=jayson[_0xb770('0x15')]['http']({'port':0x232c});var client9002=jayson['client'][_0xb770('0x16')]({'port':0x232a});function respondWithRpcPromise(_0xf01715,_0x18c461,_0x42f617,_0x31e7e2){return new BPromise(function(_0x567634,_0x4d3133){var _0x38d84a=_0x31e7e2||client;return _0x38d84a[_0xb770('0x17')](_0xf01715,_0x42f617)[_0xb770('0x18')](function(_0x1bfe2e){logger[_0xb770('0x19')]('FaxMessage,\x20%s,\x20%s',_0x18c461,_0xb770('0x1a'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x18c461,_0xb770('0x1a'),JSON['stringify'](_0x1bfe2e));if(_0x1bfe2e[_0xb770('0x1b')]){if(_0x1bfe2e['error'][_0xb770('0x1c')]===0x1f4){logger[_0xb770('0x1b')](_0xb770('0x1d'),_0x18c461,_0x1bfe2e[_0xb770('0x1b')][_0xb770('0x1e')]);return _0x4d3133(_0x1bfe2e[_0xb770('0x1b')][_0xb770('0x1e')]);}logger[_0xb770('0x1b')]('FaxMessage,\x20%s,\x20%s',_0x18c461,_0x1bfe2e[_0xb770('0x1b')][_0xb770('0x1e')]);return _0x567634(_0x1bfe2e[_0xb770('0x1b')]['message']);}else{logger['info'](_0xb770('0x1d'),_0x18c461,'request\x20sent');_0x567634(_0x1bfe2e[_0xb770('0x1f')][_0xb770('0x1e')]);}})[_0xb770('0x20')](function(_0x29846f){logger['error'](_0xb770('0x1d'),_0x18c461,_0x29846f);_0x4d3133(_0x29846f);});});}function respondWithStatusCode(_0x1797fb,_0x456a14){_0x456a14=_0x456a14||0xcc;return function(_0x2bcaca){if(_0x2bcaca){return _0x1797fb[_0xb770('0x21')](_0x456a14);}return _0x1797fb['status'](_0x456a14)[_0xb770('0x22')]();};}function respondWithResult(_0x132069,_0x4a7d4f){_0x4a7d4f=_0x4a7d4f||0xc8;return function(_0xc2405f){if(_0xc2405f){return _0x132069['status'](_0x4a7d4f)[_0xb770('0x23')](_0xc2405f);}};}function respondWithFilteredResult(_0x628654,_0x30fc82){return function(_0x42104c){if(_0x42104c){var _0x2097bc=typeof _0x30fc82[_0xb770('0x24')]===_0xb770('0x25')&&typeof _0x30fc82[_0xb770('0x26')]===_0xb770('0x25');var _0x33fce0=_0x42104c['count'];var _0x1f26dc=_0x2097bc?0x0:_0x30fc82[_0xb770('0x24')];var _0x4f82d9=_0x2097bc?_0x42104c[_0xb770('0x27')]:_0x30fc82[_0xb770('0x24')]+_0x30fc82[_0xb770('0x26')];var _0x40c954;if(_0x4f82d9>=_0x33fce0){_0x4f82d9=_0x33fce0;_0x40c954=0xc8;}else{_0x40c954=0xce;}_0x628654['status'](_0x40c954);return _0x628654[_0xb770('0x28')]('Content-Range',_0x1f26dc+'-'+_0x4f82d9+'/'+_0x33fce0)[_0xb770('0x23')](_0x42104c);}return null;};}function patchUpdates(_0x2948b1){return function(_0x3c9b17){try{jsonpatch[_0xb770('0x29')](_0x3c9b17,_0x2948b1,!![]);}catch(_0x18e82b){return BPromise['reject'](_0x18e82b);}return _0x3c9b17[_0xb770('0x2a')]();};}function saveUpdates(_0x3f079d,_0x130c99){return function(_0x583d84){if(_0x583d84){return _0x583d84[_0xb770('0x2b')](_0x3f079d)[_0xb770('0x18')](function(_0x5a2dfe){return _0x5a2dfe;});}return null;};}function removeEntity(_0x2825e2,_0x291540){return function(_0x52ce8e){if(_0x52ce8e){return _0x52ce8e[_0xb770('0x2c')]()['then'](function(){_0x2825e2[_0xb770('0x2d')](0xcc)[_0xb770('0x22')]();});}};}function handleEntityNotFound(_0x5a5b9f,_0x3d59d7){return function(_0x5c521a){if(!_0x5c521a){_0x5a5b9f['sendStatus'](0x194);}return _0x5c521a;};}function handleError(_0x2b0c3e,_0x998164){_0x998164=_0x998164||0x1f4;return function(_0x2b25ad){logger[_0xb770('0x1b')](_0x2b25ad[_0xb770('0x2e')]);if(_0x2b25ad[_0xb770('0x2f')]){delete _0x2b25ad[_0xb770('0x2f')];}_0x2b0c3e[_0xb770('0x2d')](_0x998164)[_0xb770('0x30')](_0x2b25ad);};}exports[_0xb770('0x31')]=function(_0x49d631,_0x407211){var _0x4039f4={},_0x51ac12={},_0x8250e3={'count':0x0,'rows':[]};var _0x13a014=_[_0xb770('0x32')](db[_0xb770('0x33')][_0xb770('0x34')],function(_0x555ea9){return{'name':_0x555ea9[_0xb770('0x35')],'type':_0x555ea9['type'][_0xb770('0x36')]};});_0x51ac12['model']=_[_0xb770('0x32')](_0x13a014,_0xb770('0x2f'));_0x51ac12[_0xb770('0x37')]=_[_0xb770('0x38')](_0x49d631['query']);_0x51ac12[_0xb770('0x39')]=_['intersection'](_0x51ac12[_0xb770('0x3a')],_0x51ac12[_0xb770('0x37')]);_0x4039f4['attributes']=_[_0xb770('0x3b')](_0x51ac12[_0xb770('0x3a')],qs['fields'](_0x49d631[_0xb770('0x37')][_0xb770('0x3c')]));_0x4039f4[_0xb770('0x3d')]=_0x4039f4[_0xb770('0x3d')][_0xb770('0x3e')]?_0x4039f4[_0xb770('0x3d')]:_0x51ac12[_0xb770('0x3a')];if(!_0x49d631[_0xb770('0x37')][_0xb770('0x3f')](_0xb770('0x40'))){_0x4039f4['limit']=qs[_0xb770('0x26')](_0x49d631[_0xb770('0x37')][_0xb770('0x26')]);_0x4039f4[_0xb770('0x24')]=qs[_0xb770('0x24')](_0x49d631['query'][_0xb770('0x24')]);}_0x4039f4[_0xb770('0x41')]=qs[_0xb770('0x42')](_0x49d631[_0xb770('0x37')][_0xb770('0x42')]);_0x4039f4[_0xb770('0x43')]=qs[_0xb770('0x39')](_[_0xb770('0x44')](_0x49d631[_0xb770('0x37')],_0x51ac12[_0xb770('0x39')]),_0x13a014);if(_0x49d631[_0xb770('0x37')]['filter']){_0x4039f4[_0xb770('0x43')]=_['merge'](_0x4039f4[_0xb770('0x43')],{'$or':_[_0xb770('0x32')](_0x13a014,function(_0x1de325){if(_0x1de325[_0xb770('0x45')]!==_0xb770('0x46')){var _0x472038={};_0x472038[_0x1de325['name']]={'$like':'%'+_0x49d631['query'][_0xb770('0x47')]+'%'};return _0x472038;}})});}_0x4039f4=_[_0xb770('0x48')]({},_0x4039f4,_0x49d631['options']);var _0x5802ff={'where':_0x4039f4[_0xb770('0x43')]};return db[_0xb770('0x33')][_0xb770('0x27')](_0x5802ff)[_0xb770('0x18')](function(_0x1f5d67){_0x8250e3[_0xb770('0x27')]=_0x1f5d67;if(_0x49d631['query'][_0xb770('0x49')]){_0x4039f4[_0xb770('0x4a')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x4039f4);})['then'](function(_0x2cee56){_0x8250e3[_0xb770('0x4b')]=_0x2cee56;return _0x8250e3;})[_0xb770('0x18')](respondWithFilteredResult(_0x407211,_0x4039f4))[_0xb770('0x20')](handleError(_0x407211,null));};exports[_0xb770('0x4c')]=function(_0x9523f1,_0x209101){var _0x2e5409={'raw':!![],'where':{'id':_0x9523f1[_0xb770('0x4d')]['id']}},_0xa6b2b8={};_0xa6b2b8[_0xb770('0x3a')]=_[_0xb770('0x38')](db[_0xb770('0x33')][_0xb770('0x34')]);_0xa6b2b8[_0xb770('0x37')]=_[_0xb770('0x38')](_0x9523f1[_0xb770('0x37')]);_0xa6b2b8[_0xb770('0x39')]=_['intersection'](_0xa6b2b8[_0xb770('0x3a')],_0xa6b2b8['query']);_0x2e5409[_0xb770('0x3d')]=_[_0xb770('0x3b')](_0xa6b2b8[_0xb770('0x3a')],qs['fields'](_0x9523f1[_0xb770('0x37')]['fields']));_0x2e5409['attributes']=_0x2e5409[_0xb770('0x3d')][_0xb770('0x3e')]?_0x2e5409['attributes']:_0xa6b2b8[_0xb770('0x3a')];if(_0x9523f1[_0xb770('0x37')][_0xb770('0x49')]){_0x2e5409[_0xb770('0x4a')]=[{'all':!![]}];}_0x2e5409=_[_0xb770('0x48')]({},_0x2e5409,_0x9523f1[_0xb770('0x4e')]);return db[_0xb770('0x33')][_0xb770('0x4f')](_0x2e5409)['then'](handleEntityNotFound(_0x209101,null))['then'](respondWithResult(_0x209101,null))[_0xb770('0x20')](handleError(_0x209101,null));};exports[_0xb770('0x2b')]=function(_0x2a13ef,_0x102816){if(_0x2a13ef[_0xb770('0x50')]['id']){delete _0x2a13ef['body']['id'];}return db[_0xb770('0x33')][_0xb770('0x4f')]({'where':{'id':_0x2a13ef['params']['id']}})[_0xb770('0x18')](handleEntityNotFound(_0x102816,null))[_0xb770('0x18')](saveUpdates(_0x2a13ef[_0xb770('0x50')],null))[_0xb770('0x18')](respondWithResult(_0x102816,null))['catch'](handleError(_0x102816,null));};exports[_0xb770('0x2c')]=function(_0x1e874f,_0x1bb436){return db['FaxMessage'][_0xb770('0x4f')]({'where':{'id':_0x1e874f['params']['id']}})[_0xb770('0x18')](handleEntityNotFound(_0x1bb436,null))['then'](removeEntity(_0x1bb436,null))[_0xb770('0x20')](handleError(_0x1bb436,null));};exports[_0xb770('0x51')]=function(_0x219e4b,_0x33fc18){return db[_0xb770('0x33')][_0xb770('0x51')]()[_0xb770('0x18')](respondWithResult(_0x33fc18,null))[_0xb770('0x20')](handleError(_0x33fc18,null));};var interaction_log=require(_0xb770('0x52'))(_0xb770('0x53'));exports[_0xb770('0x54')]=function(_0x3ee12e,_0x25f7ac,_0x412d12){var _0x184c8b={'agent':{},'channel':'fax'};if(_0x3ee12e[_0xb770('0x50')]['id']){delete _0x3ee12e['body']['id'];}_0x3ee12e['body']['read']=!![];_0x3ee12e['body'][_0xb770('0x55')]=moment()[_0xb770('0x56')](_0xb770('0x57'));_0x3ee12e[_0xb770('0x50')][_0xb770('0x58')]=_0x3ee12e[_0xb770('0x50')][_0xb770('0x58')]||_0x3ee12e[_0xb770('0x59')]['id'];_0x184c8b[_0xb770('0x5a')]['id']=_0x3ee12e[_0xb770('0x50')][_0xb770('0x58')];return db[_0xb770('0x33')][_0xb770('0x4f')]({'where':{'id':_0x3ee12e[_0xb770('0x4d')]['id'],'UserId':null}})[_0xb770('0x18')](handleEntityNotFound(_0x25f7ac,null))[_0xb770('0x18')](saveUpdates(_0x3ee12e[_0xb770('0x50')],null))['then'](function(_0x8219db){if(_0x8219db){_0x184c8b[_0xb770('0x1e')]=_0x8219db[_0xb770('0x5b')]({'plain':!![]});return db[_0xb770('0x5c')][_0xb770('0x4f')]({'where':{'id':_0x8219db[_0xb770('0x5d')]}});}return null;})['then'](handleEntityNotFound(_0x25f7ac,null))[_0xb770('0x18')](function(_0x2d6c22){if(_0x2d6c22){return _0x2d6c22[_0xb770('0x2b')]({'UserId':_0x3ee12e[_0xb770('0x50')][_0xb770('0x58')],'read1stAt':_[_0xb770('0x5e')](_0x2d6c22['read1stAt'])?moment()['format'](_0xb770('0x57')):undefined});}return null;})[_0xb770('0x18')](function(_0x51e1f7){if(_0x51e1f7){_0x184c8b[_0xb770('0x5f')]=_0x51e1f7[_0xb770('0x5b')]({'plain':!![]});interaction_log[_0xb770('0x19')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3ee12e[_0xb770('0x59')]['id'],_0x3ee12e[_0xb770('0x59')][_0xb770('0x2f')],_0x3ee12e[_0xb770('0x59')][_0xb770('0x60')],_0x184c8b[_0xb770('0x5f')]['id'],_0x3ee12e[_0xb770('0x50')]?JSON[_0xb770('0x61')](_0x3ee12e[_0xb770('0x50')]):'null');return respondWithRpcPromise(_0xb770('0x62'),_0xb770('0x63'),_0x184c8b);}return null;})[_0xb770('0x18')](function(_0x4a6937){var _0x52e542=_0xb770('0x64')+_0x4a6937[_0xb770('0x1e')][_0xb770('0x65')];return db[_0xb770('0x66')][_0xb770('0x37')](_0x52e542,{'type':db[_0xb770('0x67')][_0xb770('0x68')]['SELECT'],'raw':!![]})[_0xb770('0x18')](function(_0xb268c8){return _0xb268c8;});})[_0xb770('0x18')](function(_0x1ab10d){if(_0x1ab10d){_0x184c8b[_0xb770('0x1e')][_0xb770('0x69')]=_0x1ab10d[0x0];if(!_0x3ee12e[_0xb770('0x50')][_0xb770('0x58')])return;return db['User'][_0xb770('0x4f')]({'where':{'id':_0x3ee12e[_0xb770('0x50')][_0xb770('0x58')],'role':_0xb770('0x5a')},'attributes':['id',_0xb770('0x2f'),_0xb770('0x6a'),_0xb770('0x6b'),_0xb770('0x6c')],'raw':!![]});}return null;})[_0xb770('0x18')](function(_0x1cf568){if(!_0x1cf568)return null;_0x184c8b[_0xb770('0x1e')][_0xb770('0x5a')]=_0x1cf568;return _0x184c8b;})[_0xb770('0x18')](function(_0x37822c){if(_0x37822c){if(_0x3ee12e[_0xb770('0x50')]['manual']){_0x184c8b[_0xb770('0x1e')]['interface']=util['format'](_0xb770('0x6d'),_0x3ee12e[_0xb770('0x59')]['name']);_0x184c8b[_0xb770('0x1e')][_0xb770('0x6e')]=_0x184c8b['channel'];_0x184c8b[_0xb770('0x1e')][_0xb770('0x6f')]=_0x184c8b[_0xb770('0x6e')];_0x184c8b[_0xb770('0x1e')][_0xb770('0x70')]=_0xb770('0x54');return respondWithRpcPromise(_0xb770('0x71'),_0xb770('0x71'),{'event':_0xb770('0x72'),'message':_0x184c8b['message']},client9002)[_0xb770('0x18')](function(){return _0x184c8b;});}return _0x184c8b;}return null;})[_0xb770('0x18')](respondWithResult(_0x25f7ac,null))[_0xb770('0x20')](handleError(_0x25f7ac,null));};var interaction_log=require(_0xb770('0x52'))(_0xb770('0x53'));exports[_0xb770('0x73')]=function(_0x120e4d,_0x5b4ff7,_0x43b8c7){var _0x518e9d={'agent':{},'channel':_0xb770('0x74')};if(_0x120e4d[_0xb770('0x50')]['id']){delete _0x120e4d[_0xb770('0x50')]['id'];}_0x120e4d[_0xb770('0x50')][_0xb770('0x58')]=_0x120e4d[_0xb770('0x50')]['UserId']||_0x120e4d[_0xb770('0x59')]['id'];_0x518e9d[_0xb770('0x5a')]['id']=_0x120e4d['body']['UserId'];return db['FaxMessage'][_0xb770('0x4f')]({'where':{'id':_0x120e4d[_0xb770('0x4d')]['id'],'UserId':null}})[_0xb770('0x18')](handleEntityNotFound(_0x5b4ff7,null))[_0xb770('0x18')](function(_0x2f1492){if(_0x2f1492){_0x518e9d[_0xb770('0x1e')]=_0x2f1492['get']({'plain':!![]});return db[_0xb770('0x5c')][_0xb770('0x4f')]({'where':{'id':_0x2f1492[_0xb770('0x5d')]}});}return null;})[_0xb770('0x18')](handleEntityNotFound(_0x5b4ff7,null))[_0xb770('0x18')](function(_0x133c9e){if(_0x133c9e){_0x518e9d[_0xb770('0x5f')]=_0x133c9e[_0xb770('0x5b')]({'plain':!![]});interaction_log[_0xb770('0x19')](_0xb770('0x75'),_0x120e4d[_0xb770('0x59')]['id'],_0x120e4d[_0xb770('0x59')][_0xb770('0x2f')],_0x120e4d[_0xb770('0x59')]['role'],_0x518e9d['interaction']['id'],_0x120e4d[_0xb770('0x50')]?JSON[_0xb770('0x61')](_0x120e4d[_0xb770('0x50')]):'null');return respondWithRpcPromise(_0xb770('0x76'),_0xb770('0x77'),_0x518e9d);}return null;})[_0xb770('0x18')](function(_0x14f596){var _0x4cc9f6=_0xb770('0x64')+_0x14f596[_0xb770('0x1e')][_0xb770('0x65')];return db[_0xb770('0x66')][_0xb770('0x37')](_0x4cc9f6,{'type':db['Sequelize']['QueryTypes'][_0xb770('0x78')],'raw':!![]})[_0xb770('0x18')](function(_0x292587){return _0x292587;});})[_0xb770('0x18')](function(_0x4b505c){if(_0x4b505c){_0x518e9d[_0xb770('0x1e')][_0xb770('0x69')]=_0x4b505c[0x0];if(!_0x120e4d[_0xb770('0x50')][_0xb770('0x58')])return;return db[_0xb770('0x79')][_0xb770('0x4f')]({'where':{'id':_0x120e4d[_0xb770('0x50')][_0xb770('0x58')],'role':_0xb770('0x5a')},'attributes':['id','name',_0xb770('0x6a'),_0xb770('0x6b'),_0xb770('0x6c')],'raw':!![]});}return null;})[_0xb770('0x18')](function(_0x5f408b){if(!_0x5f408b)return null;_0x518e9d['message'][_0xb770('0x5a')]=_0x5f408b;return _0x518e9d;})[_0xb770('0x18')](function(_0x5dfadf){if(_0x5dfadf){_0x5dfadf[_0xb770('0x1e')][_0xb770('0x7a')]=util[_0xb770('0x56')](_0xb770('0x6d'),_0x120e4d[_0xb770('0x59')][_0xb770('0x2f')]);_0x5dfadf[_0xb770('0x1e')]['channel']=_0x518e9d['channel'];_0x5dfadf[_0xb770('0x1e')][_0xb770('0x6f')]=_0x518e9d[_0xb770('0x6e')];_0x5dfadf[_0xb770('0x1e')]['event']=_0xb770('0x73');respondWithRpcPromise(_0xb770('0x71'),'EventManager',{'event':'rejectmessage','message':_0x5dfadf[_0xb770('0x1e')]},client9002);return _0x518e9d;}return null;})[_0xb770('0x18')](respondWithResult(_0x5b4ff7,null))[_0xb770('0x20')](handleError(_0x5b4ff7,null));};exports[_0xb770('0x7b')]=function(_0x1938be,_0x3f015d){var _0x5d8acd;return db[_0xb770('0x33')]['create'](_0x1938be[_0xb770('0x50')],{})['then'](function(_0x2ceb2e){_0x5d8acd=_0x2ceb2e;return db[_0xb770('0x7c')][_0xb770('0x7d')]({'where':{'id':_0x5d8acd[_0xb770('0x65')]}});})[_0xb770('0x18')](function(_0x680ffb){if(_['isNil'](_0x680ffb)){return;}else{_0x5d8acd[_0xb770('0x74')]=_0x680ffb[_0xb770('0x74')];return db[_0xb770('0x7e')][_0xb770('0x7d')]({'where':{'id':_0x5d8acd[_0xb770('0x7f')]}});}})[_0xb770('0x18')](function(_0x451f03){return respondWithRpcPromise(_0xb770('0x80'),_0xb770('0x80'),{'FaxAccountId':_['isNil'](_0x1938be['body'])?undefined:_0x1938be[_0xb770('0x50')][_0xb770('0x81')],'path':_[_0xb770('0x5e')](_0x451f03)?undefined:util[_0xb770('0x56')](_0xb770('0x82'),_0x451f03[_0xb770('0x83')]),'fax':_['isNil'](_0x5d8acd[_0xb770('0x74')])?undefined:_0x5d8acd[_0xb770('0x74')],'AttachmentId':_0x5d8acd['AttachmentId']},client9002);})['then'](respondWithResult(_0x3f015d,0xc9))[_0xb770('0x20')](handleError(_0x3f015d,null));};exports[_0xb770('0x84')]=function(_0x58a52f,_0x41fd69){var _0x2021b8=path['join'](config[_0xb770('0x85')],_0xb770('0x86'),_0xb770('0x87'),_0xb770('0x88'));return db['FaxMessage']['find']({'where':{'id':_0x58a52f[_0xb770('0x4d')]['id']},'include':[{'model':db[_0xb770('0x7e')],'as':_0xb770('0x7e')}]})[_0xb770('0x18')](handleEntityNotFound(_0x41fd69,null))['then'](function(_0x3b8714){if(_0x3b8714){return _0x41fd69['download'](path[_0xb770('0x89')](_0x2021b8,_0x3b8714[_0xb770('0x7e')][_0xb770('0x83')]));}})[_0xb770('0x20')](handleError(_0x41fd69,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 556ed4e..a5c9163 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 _0xd101=['hasOwnProperty','hook','exports','events','FaxMessage','setMaxListeners','save','update','remove','emit'];(function(_0x264308,_0x19b772){var _0x3f15dd=function(_0xb644bd){while(--_0xb644bd){_0x264308['push'](_0x264308['shift']());}};_0x3f15dd(++_0x19b772);}(_0xd101,0xc1));var _0x1d10=function(_0x49b206,_0x29e0d1){_0x49b206=_0x49b206-0x0;var _0x161f19=_0xd101[_0x49b206];return _0x161f19;};'use strict';var EventEmitter=require(_0x1d10('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x1d10('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x1d10('0x2')](0x0);var events={'afterCreate':_0x1d10('0x3'),'afterUpdate':_0x1d10('0x4'),'afterDestroy':_0x1d10('0x5')};function emitEvent(_0x25b425){return function(_0x12c320,_0x1e83e0,_0x5c5c42){FaxMessageEvents[_0x1d10('0x6')](_0x25b425+':'+_0x12c320['id'],_0x12c320);FaxMessageEvents[_0x1d10('0x6')](_0x25b425,_0x12c320);_0x5c5c42(null);};}for(var e in events){if(events[_0x1d10('0x7')](e)){var event=events[e];FaxMessage[_0x1d10('0x8')](e,emitEvent(event));}}module[_0x1d10('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x4312=['FaxMessage','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0x4312,0xaf));var _0x2431=function(_0x171dbc,_0x1e46fe){_0x171dbc=_0x171dbc-0x0;var _0x455fc6=_0x4312[_0x171dbc];return _0x455fc6;};'use strict';var EventEmitter=require('events');var FaxMessage=require('../../mysqldb')['db'][_0x2431('0x0')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x2431('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2431('0x2'),'afterDestroy':_0x2431('0x3')};function emitEvent(_0x728b00){return function(_0x237ac5,_0x22db34,_0xbf4fd6){FaxMessageEvents['emit'](_0x728b00+':'+_0x237ac5['id'],_0x237ac5);FaxMessageEvents[_0x2431('0x4')](_0x728b00,_0x237ac5);_0xbf4fd6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x2431('0x5')](e,emitEvent(event));}}module[_0x2431('0x6')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index f03adff..53dab18 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 _0xe838=['bluebird','rimraf','../../config/environment','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','FaxInteractionId','update','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x31696e,_0x25e543){var _0x52f943=function(_0x1e5d26){while(--_0x1e5d26){_0x31696e['push'](_0x31696e['shift']());}};_0x52f943(++_0x25e543);}(_0xe838,0x1c7));var _0x8e83=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe838[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x8e83('0x0'));var util=require(_0x8e83('0x1'));var logger=require(_0x8e83('0x2'))(_0x8e83('0x3'));var moment=require('moment');var BPromise=require(_0x8e83('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8e83('0x5'));var config=require(_0x8e83('0x6'));var attributes=require('./faxMessage.attributes');module[_0x8e83('0x7')]=function(_0x49da2f,_0x45923a){return _0x49da2f[_0x8e83('0x8')](_0x8e83('0x9'),attributes,{'tableName':_0x8e83('0xa'),'paranoid':![],'indexes':[{'name':_0x8e83('0xb'),'fields':[_0x8e83('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x58a679,_0x58105e,_0x45c60b){var _0x5d807d=_0x49da2f[_0x8e83('0xd')];var _0x555c83=_0x58a679[_0x8e83('0xe')]({'plain':!![]});if(_0x555c83[_0x8e83('0xf')][_0x8e83('0x10')]()==='in'||_0x555c83[_0x8e83('0xf')]['toLowerCase']()===_0x8e83('0x11')&&!_0x555c83[_0x8e83('0x12')]&&!_[_0x8e83('0x13')](_0x555c83[_0x8e83('0x14')])){_0x5d807d['FaxInteraction'][_0x8e83('0x15')]({'where':{'id':_0x555c83[_0x8e83('0x16')]}})['then'](function(_0x2f7a9b){if(_0x2f7a9b){_0x2f7a9b[_0x8e83('0x17')]({'lastMsgAt':_0x555c83['createdAt'],'lastMsgDirection':_0x555c83[_0x8e83('0xf')][_0x8e83('0x10')]()});}})['catch'](function(_0x5da484){console[_0x8e83('0x18')](_0x5da484);});}_0x45c60b();}},'charset':_0x8e83('0x19'),'collate':_0x8e83('0x1a')});}; \ No newline at end of file +var _0x4ffb=['body','FULLTEXT','models','toLowerCase','direction','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','createdAt','catch','error','utf8mb4','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define','fax_messages'];(function(_0xf72fb9,_0x509c7b){var _0x4fab55=function(_0x5c8007){while(--_0x5c8007){_0xf72fb9['push'](_0xf72fb9['shift']());}};_0x4fab55(++_0x509c7b);}(_0x4ffb,0x123));var _0xb4ff=function(_0x10c4f9,_0x100fb4){_0x10c4f9=_0x10c4f9-0x0;var _0x522b09=_0x4ffb[_0x10c4f9];return _0x522b09;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb4ff('0x0'))(_0xb4ff('0x1'));var moment=require(_0xb4ff('0x2'));var BPromise=require(_0xb4ff('0x3'));var rp=require(_0xb4ff('0x4'));var fs=require('fs');var path=require(_0xb4ff('0x5'));var rimraf=require(_0xb4ff('0x6'));var config=require('../../config/environment');var attributes=require('./faxMessage.attributes');module['exports']=function(_0x48a5f3,_0x4da686){return _0x48a5f3[_0xb4ff('0x7')]('FaxMessage',attributes,{'tableName':_0xb4ff('0x8'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xb4ff('0x9')],'type':_0xb4ff('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x201a12,_0x481b18,_0x174936){var _0x47b637=_0x48a5f3[_0xb4ff('0xb')];var _0x3373e3=_0x201a12['get']({'plain':!![]});if(_0x3373e3['direction'][_0xb4ff('0xc')]()==='in'||_0x3373e3[_0xb4ff('0xd')][_0xb4ff('0xc')]()==='out'&&!_0x3373e3[_0xb4ff('0xe')]&&!_[_0xb4ff('0xf')](_0x3373e3[_0xb4ff('0x10')])){_0x47b637[_0xb4ff('0x11')][_0xb4ff('0x12')]({'where':{'id':_0x3373e3[_0xb4ff('0x13')]}})[_0xb4ff('0x14')](function(_0x5143b4){if(_0x5143b4){_0x5143b4['update']({'lastMsgAt':_0x3373e3[_0xb4ff('0x15')],'lastMsgDirection':_0x3373e3[_0xb4ff('0xd')][_0xb4ff('0xc')]()});}})[_0xb4ff('0x16')](function(_0x1a3022){console[_0xb4ff('0x17')](_0x1a3022);});}_0x174936();}},'charset':_0xb4ff('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 633cc9c..e15ccfe 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 _0xb458=['info','result','catch','FaxMessage','create','body','options','then','CreateFaxMessage','update','raw','where','attributes','UpdateFaxMessage','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','./faxMessage.socket','register','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xb458,0x103));var _0x8b45=function(_0x1d5d3f,_0x3a9d08){_0x1d5d3f=_0x1d5d3f-0x0;var _0x6f9221=_0xb458[_0x1d5d3f];return _0x6f9221;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b45('0x3'));var db=require(_0x8b45('0x4'))['db'];var utils=require(_0x8b45('0x5'));var logger=require(_0x8b45('0x6'))('rpc');var config=require(_0x8b45('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8b45('0x8')]({'port':0x232a});config[_0x8b45('0x9')]=_[_0x8b45('0xa')](config[_0x8b45('0x9')],{'host':_0x8b45('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8b45('0x9')]));require(_0x8b45('0xc'))[_0x8b45('0xd')](socket);function respondWithRpcPromise(_0x2bc809,_0x2f7117,_0x499899){return new BPromise(function(_0x2a4c83,_0x7cc49b){return client['request'](_0x2bc809,_0x499899)['then'](function(_0x5bb708){logger['info'](_0x8b45('0xe'),_0x2f7117,_0x8b45('0xf'));logger[_0x8b45('0x10')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x2f7117,_0x8b45('0xf'),JSON[_0x8b45('0x11')](_0x5bb708));if(_0x5bb708[_0x8b45('0x12')]){if(_0x5bb708[_0x8b45('0x12')][_0x8b45('0x13')]===0x1f4){logger[_0x8b45('0x12')]('FaxMessage,\x20%s,\x20%s',_0x2f7117,_0x5bb708['error'][_0x8b45('0x14')]);return _0x7cc49b(_0x5bb708[_0x8b45('0x12')][_0x8b45('0x14')]);}logger[_0x8b45('0x12')](_0x8b45('0xe'),_0x2f7117,_0x5bb708[_0x8b45('0x12')][_0x8b45('0x14')]);return _0x2a4c83(_0x5bb708[_0x8b45('0x12')][_0x8b45('0x14')]);}else{logger[_0x8b45('0x15')](_0x8b45('0xe'),_0x2f7117,_0x8b45('0xf'));_0x2a4c83(_0x5bb708[_0x8b45('0x16')][_0x8b45('0x14')]);}})[_0x8b45('0x17')](function(_0x31c6b4){logger[_0x8b45('0x12')](_0x8b45('0xe'),_0x2f7117,_0x31c6b4);_0x7cc49b(_0x31c6b4);});});}exports['CreateFaxMessage']=function(_0x25e8a1){var _0x2db2d1=this;return new Promise(function(_0x1767d5,_0x46e21a){return db[_0x8b45('0x18')][_0x8b45('0x19')](_0x25e8a1[_0x8b45('0x1a')],{'raw':_0x25e8a1[_0x8b45('0x1b')]?_0x25e8a1['options']['raw']===undefined?!![]:![]:!![]})[_0x8b45('0x1c')](function(_0x580e17){logger[_0x8b45('0x15')](_0x8b45('0x1d'),_0x25e8a1);logger[_0x8b45('0x10')](_0x8b45('0x1d'),_0x25e8a1,JSON[_0x8b45('0x11')](_0x580e17));_0x1767d5(_0x580e17);})[_0x8b45('0x17')](function(_0x32b12b){logger['error']('CreateFaxMessage',_0x32b12b[_0x8b45('0x14')],_0x25e8a1);_0x46e21a(_0x2db2d1[_0x8b45('0x12')](0x1f4,_0x32b12b['message']));});});};exports['UpdateFaxMessage']=function(_0x129c35){var _0x32f6f0=this;return new Promise(function(_0x2ca2d9,_0x2f37bc){return db['FaxMessage'][_0x8b45('0x1e')](_0x129c35[_0x8b45('0x1a')],{'raw':_0x129c35[_0x8b45('0x1b')]?_0x129c35[_0x8b45('0x1b')][_0x8b45('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x129c35[_0x8b45('0x1b')]?_0x129c35[_0x8b45('0x1b')][_0x8b45('0x20')]||null:null,'attributes':_0x129c35[_0x8b45('0x1b')]?_0x129c35[_0x8b45('0x1b')][_0x8b45('0x21')]||null:null,'limit':_0x129c35[_0x8b45('0x1b')]?_0x129c35[_0x8b45('0x1b')]['limit']||null:null})[_0x8b45('0x1c')](function(_0x36db96){logger[_0x8b45('0x15')](_0x8b45('0x22'),_0x129c35);logger[_0x8b45('0x10')](_0x8b45('0x22'),_0x129c35,JSON[_0x8b45('0x11')](_0x36db96));_0x2ca2d9(_0x36db96);})[_0x8b45('0x17')](function(_0x5d8938){logger[_0x8b45('0x12')](_0x8b45('0x22'),_0x5d8938[_0x8b45('0x14')],_0x129c35);_0x2f37bc(_0x32f6f0[_0x8b45('0x12')](0x1f4,_0x5d8938[_0x8b45('0x14')]));});});}; \ No newline at end of file +var _0x425d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateFaxMessage','FaxMessage','body','options','raw','catch','UpdateFaxMessage','where','attributes','limit'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x425d,0x1e0));var _0xd425=function(_0x445dc4,_0x3764da){_0x445dc4=_0x445dc4-0x0;var _0x19f060=_0x425d[_0x445dc4];return _0x19f060;};'use strict';var _=require(_0xd425('0x0'));var util=require('util');var moment=require(_0xd425('0x1'));var BPromise=require(_0xd425('0x2'));var rs=require(_0xd425('0x3'));var fs=require('fs');var Redis=require(_0xd425('0x4'));var db=require(_0xd425('0x5'))['db'];var utils=require(_0xd425('0x6'));var logger=require(_0xd425('0x7'))('rpc');var config=require(_0xd425('0x8'));var jayson=require(_0xd425('0x9'));var client=jayson[_0xd425('0xa')][_0xd425('0xb')]({'port':0x232a});config[_0xd425('0xc')]=_[_0xd425('0xd')](config['redis'],{'host':_0xd425('0xe'),'port':0x18eb});var socket=require(_0xd425('0xf'))(new Redis(config[_0xd425('0xc')]));require(_0xd425('0x10'))[_0xd425('0x11')](socket);function respondWithRpcPromise(_0x2beb20,_0x30111e,_0x1969ba){return new BPromise(function(_0x3a7a01,_0x35a7f4){return client[_0xd425('0x12')](_0x2beb20,_0x1969ba)[_0xd425('0x13')](function(_0x26f6d2){logger[_0xd425('0x14')](_0xd425('0x15'),_0x30111e,_0xd425('0x16'));logger[_0xd425('0x17')](_0xd425('0x18'),_0x30111e,_0xd425('0x16'),JSON[_0xd425('0x19')](_0x26f6d2));if(_0x26f6d2['error']){if(_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1b')]===0x1f4){logger[_0xd425('0x1a')]('FaxMessage,\x20%s,\x20%s',_0x30111e,_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1c')]);return _0x35a7f4(_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1c')]);}logger[_0xd425('0x1a')]('FaxMessage,\x20%s,\x20%s',_0x30111e,_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1c')]);return _0x3a7a01(_0x26f6d2[_0xd425('0x1a')][_0xd425('0x1c')]);}else{logger['info'](_0xd425('0x15'),_0x30111e,_0xd425('0x16'));_0x3a7a01(_0x26f6d2[_0xd425('0x1d')][_0xd425('0x1c')]);}})['catch'](function(_0x58a0c1){logger['error']('FaxMessage,\x20%s,\x20%s',_0x30111e,_0x58a0c1);_0x35a7f4(_0x58a0c1);});});}exports[_0xd425('0x1e')]=function(_0xb92870){var _0x3c98db=this;return new Promise(function(_0x5e797a,_0x355af0){return db[_0xd425('0x1f')]['create'](_0xb92870[_0xd425('0x20')],{'raw':_0xb92870[_0xd425('0x21')]?_0xb92870[_0xd425('0x21')][_0xd425('0x22')]===undefined?!![]:![]:!![]})[_0xd425('0x13')](function(_0xb240c4){logger[_0xd425('0x14')](_0xd425('0x1e'),_0xb92870);logger[_0xd425('0x17')](_0xd425('0x1e'),_0xb92870,JSON[_0xd425('0x19')](_0xb240c4));_0x5e797a(_0xb240c4);})[_0xd425('0x23')](function(_0x47f44a){logger[_0xd425('0x1a')](_0xd425('0x1e'),_0x47f44a[_0xd425('0x1c')],_0xb92870);_0x355af0(_0x3c98db[_0xd425('0x1a')](0x1f4,_0x47f44a[_0xd425('0x1c')]));});});};exports[_0xd425('0x24')]=function(_0x3c3402){var _0x577e4b=this;return new Promise(function(_0x12f951,_0x177de2){return db[_0xd425('0x1f')]['update'](_0x3c3402[_0xd425('0x20')],{'raw':_0x3c3402[_0xd425('0x21')]?_0x3c3402[_0xd425('0x21')][_0xd425('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c3402[_0xd425('0x21')]?_0x3c3402[_0xd425('0x21')][_0xd425('0x25')]||null:null,'attributes':_0x3c3402[_0xd425('0x21')]?_0x3c3402[_0xd425('0x21')][_0xd425('0x26')]||null:null,'limit':_0x3c3402['options']?_0x3c3402[_0xd425('0x21')][_0xd425('0x27')]||null:null})[_0xd425('0x13')](function(_0x3695dd){logger[_0xd425('0x14')](_0xd425('0x24'),_0x3c3402);logger[_0xd425('0x17')](_0xd425('0x24'),_0x3c3402,JSON[_0xd425('0x19')](_0x3695dd));_0x12f951(_0x3695dd);})[_0xd425('0x23')](function(_0x3583b0){logger['error'](_0xd425('0x24'),_0x3583b0[_0xd425('0x1c')],_0x3c3402);_0x177de2(_0x577e4b[_0xd425('0x1a')](0x1f4,_0x3583b0[_0xd425('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index c9289f4..43e1e36 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 _0xf10c=['length','faxMessage:','./faxMessage.events','remove','update','removeListener','register'];(function(_0x12fa5c,_0x116924){var _0x3f0a97=function(_0x54eee9){while(--_0x54eee9){_0x12fa5c['push'](_0x12fa5c['shift']());}};_0x3f0a97(++_0x116924);}(_0xf10c,0x1d7));var _0xcf10=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf10c[_0x3dd15e];return _0x231fd0;};'use strict';var FaxMessageEvents=require(_0xcf10('0x0'));var events=['save',_0xcf10('0x1'),_0xcf10('0x2')];function createListener(_0x5ac403,_0x4cbe94){return function(_0xf87bdb){_0x4cbe94['emit'](_0x5ac403,_0xf87bdb);};}function removeListener(_0x4c8a7f,_0xc837c0){return function(){FaxMessageEvents[_0xcf10('0x3')](_0x4c8a7f,_0xc837c0);};}exports[_0xcf10('0x4')]=function(_0x325339){for(var _0x19941c=0x0,_0x391b60=events[_0xcf10('0x5')];_0x19941c<_0x391b60;_0x19941c++){var _0x50e0d7=events[_0x19941c];var _0x1a31d8=createListener(_0xcf10('0x6')+_0x50e0d7,_0x325339);FaxMessageEvents['on'](_0x50e0d7,_0x1a31d8);}}; \ No newline at end of file +var _0x38fb=['removeListener','register','length','faxMessage:','save','remove','update','emit'];(function(_0x41463e,_0x3f25f3){var _0x37320a=function(_0x2027a8){while(--_0x2027a8){_0x41463e['push'](_0x41463e['shift']());}};_0x37320a(++_0x3f25f3);}(_0x38fb,0x7c));var _0xb38f=function(_0x1dd82f,_0x52acb7){_0x1dd82f=_0x1dd82f-0x0;var _0x353ca4=_0x38fb[_0x1dd82f];return _0x353ca4;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0xb38f('0x0'),_0xb38f('0x1'),_0xb38f('0x2')];function createListener(_0x1a882d,_0x43f058){return function(_0x4d97e6){_0x43f058[_0xb38f('0x3')](_0x1a882d,_0x4d97e6);};}function removeListener(_0x2a0b7a,_0x3cb8e2){return function(){FaxMessageEvents[_0xb38f('0x4')](_0x2a0b7a,_0x3cb8e2);};}exports[_0xb38f('0x5')]=function(_0x1ae081){for(var _0x40e046=0x0,_0x327b38=events[_0xb38f('0x6')];_0x40e046<_0x327b38;_0x40e046++){var _0x1f54d4=events[_0x40e046];var _0x4475a0=createListener(_0xb38f('0x7')+_0x1f54d4,_0x1ae081);FaxMessageEvents['on'](_0x1f54d4,_0x4475a0);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index d50e666..f05a509 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 _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(_0x282391,_0x3737ef){var _0x5cb657=function(_0x2b4ff4){while(--_0x2b4ff4){_0x282391['push'](_0x282391['shift']());}};_0x5cb657(++_0x3737ef);}(_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 +var _0xeb74=['Router','fs-extra','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','describe','show','/:id/download','download','post','fax','faxmessage:create','create','put','/:id','update','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x42d6ce,_0x529e73){var _0x4d8bed=function(_0x5cc906){while(--_0x5cc906){_0x42d6ce['push'](_0x42d6ce['shift']());}};_0x4d8bed(++_0x529e73);}(_0xeb74,0xe3));var _0x4eb7=function(_0x521f0c,_0x5ccf39){_0x521f0c=_0x521f0c-0x0;var _0x1e7f1c=_0xeb74[_0x521f0c];return _0x1e7f1c;};'use strict';var multer=require(_0x4eb7('0x0'));var util=require(_0x4eb7('0x1'));var path=require(_0x4eb7('0x2'));var timeout=require(_0x4eb7('0x3'));var express=require(_0x4eb7('0x4'));var router=express[_0x4eb7('0x5')]();var fs_extra=require(_0x4eb7('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4eb7('0x7'));var config=require(_0x4eb7('0x8'));var controller=require(_0x4eb7('0x9'));router[_0x4eb7('0xa')]('/',auth[_0x4eb7('0xb')](),controller['index']);router[_0x4eb7('0xa')]('/describe',auth[_0x4eb7('0xb')](),controller[_0x4eb7('0xc')]);router['get']('/:id',auth[_0x4eb7('0xb')](),controller[_0x4eb7('0xd')]);router['get'](_0x4eb7('0xe'),auth['isAuthenticated'](),controller[_0x4eb7('0xf')]);router[_0x4eb7('0x10')]('/',auth[_0x4eb7('0xb')](),interaction['tracked'](_0x4eb7('0x11'),_0x4eb7('0x12')),controller[_0x4eb7('0x13')]);router[_0x4eb7('0x14')](_0x4eb7('0x15'),auth[_0x4eb7('0xb')](),controller[_0x4eb7('0x16')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0x4eb7('0x17')]);router['put'](_0x4eb7('0x18'),auth[_0x4eb7('0xb')](),controller[_0x4eb7('0x19')]);router[_0x4eb7('0x1a')](_0x4eb7('0x15'),auth[_0x4eb7('0xb')](),controller[_0x4eb7('0x1b')]);module[_0x4eb7('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index b217c60..082fd80 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 _0x15b9=['STRING','INTEGER','ENUM','rrmemory','roundrobin','exports','name'];(function(_0x4f14c5,_0x485e41){var _0x52ea51=function(_0x573cb9){while(--_0x573cb9){_0x4f14c5['push'](_0x4f14c5['shift']());}};_0x52ea51(++_0x485e41);}(_0x15b9,0xb4));var _0x915b=function(_0x2d982d,_0x121028){_0x2d982d=_0x2d982d-0x0;var _0x4f36b0=_0x15b9[_0x2d982d];return _0x4f36b0;};'use strict';var Sequelize=require('sequelize');module[_0x915b('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x915b('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x915b('0x2')]},'timeout':{'type':Sequelize[_0x915b('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x915b('0x4')](_0x915b('0x5'),'beepall',_0x915b('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x915b('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9219=['STRING','rrmemory','INTEGER'];(function(_0x1cb25f,_0x4112d7){var _0x2e7bdd=function(_0x2980bd){while(--_0x2980bd){_0x1cb25f['push'](_0x1cb25f['shift']());}};_0x2e7bdd(++_0x4112d7);}(_0x9219,0x19e));var _0x9921=function(_0x3a7559,_0xc15f1f){_0x3a7559=_0x3a7559-0x0;var _0x345b1e=_0x9219[_0x3a7559];return _0x345b1e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9921('0x0')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x9921('0x1'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x9921('0x2')],'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 b0c6fa9..571f7c1 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 _0xbd57=['rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','catch','params','describe','getMembers','UserFaxQueue','hasOwnProperty','UserId','faxPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','findOne','addTeams','ids','Team','User','Agents','voicePause','flatMap','sequelize','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','QueryTypes','SELECT','every','TeamId','includes','union','compact','transaction','removeAgents','forEach','userFaxQueue:remove','addAgents','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','FaxQueues','UserProfileResource','error','name','send','index','map','FaxQueue','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','keys'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbd57,0x1cf));var _0x7bd5=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbd57[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x7bd5('0x0'));var rimraf=require(_0x7bd5('0x1'));var zipdir=require(_0x7bd5('0x2'));var jsonpatch=require(_0x7bd5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7bd5('0x4'));var Mustache=require(_0x7bd5('0x5'));var util=require(_0x7bd5('0x6'));var path=require(_0x7bd5('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bd5('0x8'));var _=require(_0x7bd5('0x9'));var squel=require(_0x7bd5('0xa'));var crypto=require(_0x7bd5('0xb'));var jsforce=require(_0x7bd5('0xc'));var deskjs=require(_0x7bd5('0xd'));var toCsv=require(_0x7bd5('0xe'));var querystring=require('querystring');var Papa=require(_0x7bd5('0xf'));var Redis=require(_0x7bd5('0x10'));var authService=require(_0x7bd5('0x11'));var qs=require(_0x7bd5('0x12'));var as=require(_0x7bd5('0x13'));var hardwareService=require(_0x7bd5('0x14'));var logger=require(_0x7bd5('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7bd5('0x16'));var db=require(_0x7bd5('0x17'))['db'];config[_0x7bd5('0x18')]=_[_0x7bd5('0x19')](config[_0x7bd5('0x18')],{'host':_0x7bd5('0x1a'),'port':0x18eb});var socket=require(_0x7bd5('0x1b'))(new Redis(config[_0x7bd5('0x18')]));require('./faxQueue.socket')[_0x7bd5('0x1c')](socket);function respondWithStatusCode(_0x5232b0,_0x44cc32){_0x44cc32=_0x44cc32||0xcc;return function(_0x2b847d){if(_0x2b847d){return _0x5232b0[_0x7bd5('0x1d')](_0x44cc32);}return _0x5232b0['status'](_0x44cc32)[_0x7bd5('0x1e')]();};}function respondWithResult(_0x4cfea5,_0xeec9c4){_0xeec9c4=_0xeec9c4||0xc8;return function(_0x20a0ac){if(_0x20a0ac){return _0x4cfea5[_0x7bd5('0x1f')](_0xeec9c4)[_0x7bd5('0x20')](_0x20a0ac);}};}function respondWithFilteredResult(_0x2ac86e,_0x12fd16){return function(_0x160444){if(_0x160444){var _0x3f0bb9=typeof _0x12fd16[_0x7bd5('0x21')]==='undefined'&&typeof _0x12fd16[_0x7bd5('0x22')]==='undefined';var _0x3692b8=_0x160444['count'];var _0xb027c9=_0x3f0bb9?0x0:_0x12fd16['offset'];var _0x34427f=_0x3f0bb9?_0x160444[_0x7bd5('0x23')]:_0x12fd16[_0x7bd5('0x21')]+_0x12fd16['limit'];var _0x39898f;if(_0x34427f>=_0x3692b8){_0x34427f=_0x3692b8;_0x39898f=0xc8;}else{_0x39898f=0xce;}_0x2ac86e[_0x7bd5('0x1f')](_0x39898f);return _0x2ac86e[_0x7bd5('0x24')](_0x7bd5('0x25'),_0xb027c9+'-'+_0x34427f+'/'+_0x3692b8)[_0x7bd5('0x20')](_0x160444);}return null;};}function patchUpdates(_0x421e90){return function(_0x21c8d1){try{jsonpatch[_0x7bd5('0x26')](_0x21c8d1,_0x421e90,!![]);}catch(_0x45a5e7){return BPromise[_0x7bd5('0x27')](_0x45a5e7);}return _0x21c8d1[_0x7bd5('0x28')]();};}function saveUpdates(_0x201e7e,_0x55403b){return function(_0x48d024){if(_0x48d024){return _0x48d024[_0x7bd5('0x29')](_0x201e7e)[_0x7bd5('0x2a')](function(_0xe8a640){return _0xe8a640;});}return null;};}function removeEntity(_0x10ce15,_0x56aa6d){return function(_0x37cf2b){if(_0x37cf2b){return _0x37cf2b[_0x7bd5('0x2b')]()[_0x7bd5('0x2a')](function(){var _0x3045fa=_0x37cf2b[_0x7bd5('0x2c')]({'plain':!![]});var _0x461a86=_0x7bd5('0x2d');return db[_0x7bd5('0x2e')][_0x7bd5('0x2b')]({'where':{'type':_0x461a86,'resourceId':_0x3045fa['id']}})[_0x7bd5('0x2a')](function(){return _0x37cf2b;});})[_0x7bd5('0x2a')](function(){_0x10ce15[_0x7bd5('0x1f')](0xcc)[_0x7bd5('0x1e')]();});}};}function handleEntityNotFound(_0x27fff1,_0x4a8fe8){return function(_0x4ed726){if(!_0x4ed726){_0x27fff1[_0x7bd5('0x1d')](0x194);}return _0x4ed726;};}function handleError(_0x3e8ed3,_0x3c6d1f){_0x3c6d1f=_0x3c6d1f||0x1f4;return function(_0x477f5f){logger[_0x7bd5('0x2f')](_0x477f5f['stack']);if(_0x477f5f[_0x7bd5('0x30')]){delete _0x477f5f[_0x7bd5('0x30')];}_0x3e8ed3[_0x7bd5('0x1f')](_0x3c6d1f)[_0x7bd5('0x31')](_0x477f5f);};}exports[_0x7bd5('0x32')]=function(_0x202dc9,_0x38ade3){var _0x27021e={},_0x1308c6={},_0x5051b7={'count':0x0,'rows':[]};var _0x51f629=_[_0x7bd5('0x33')](db[_0x7bd5('0x34')]['rawAttributes'],function(_0x3fb860){return{'name':_0x3fb860[_0x7bd5('0x35')],'type':_0x3fb860[_0x7bd5('0x36')][_0x7bd5('0x37')]};});_0x1308c6['model']=_['map'](_0x51f629,_0x7bd5('0x30'));_0x1308c6[_0x7bd5('0x38')]=_['keys'](_0x202dc9[_0x7bd5('0x38')]);_0x1308c6[_0x7bd5('0x39')]=_[_0x7bd5('0x3a')](_0x1308c6[_0x7bd5('0x3b')],_0x1308c6[_0x7bd5('0x38')]);_0x27021e[_0x7bd5('0x3c')]=_[_0x7bd5('0x3a')](_0x1308c6['model'],qs[_0x7bd5('0x3d')](_0x202dc9[_0x7bd5('0x38')][_0x7bd5('0x3d')]));_0x27021e['attributes']=_0x27021e[_0x7bd5('0x3c')][_0x7bd5('0x3e')]?_0x27021e[_0x7bd5('0x3c')]:_0x1308c6[_0x7bd5('0x3b')];if(!_0x202dc9[_0x7bd5('0x38')]['hasOwnProperty'](_0x7bd5('0x3f'))){_0x27021e[_0x7bd5('0x22')]=qs['limit'](_0x202dc9[_0x7bd5('0x38')]['limit']);_0x27021e['offset']=qs[_0x7bd5('0x21')](_0x202dc9[_0x7bd5('0x38')][_0x7bd5('0x21')]);}_0x27021e[_0x7bd5('0x40')]=qs[_0x7bd5('0x41')](_0x202dc9[_0x7bd5('0x38')][_0x7bd5('0x41')]);_0x27021e[_0x7bd5('0x42')]=qs[_0x7bd5('0x39')](_[_0x7bd5('0x43')](_0x202dc9['query'],_0x1308c6['filters']),_0x51f629);if(_0x202dc9['query'][_0x7bd5('0x44')]){_0x27021e[_0x7bd5('0x42')]=_[_0x7bd5('0x45')](_0x27021e[_0x7bd5('0x42')],{'$or':_[_0x7bd5('0x33')](_0x51f629,function(_0x24c3fe){if(_0x24c3fe[_0x7bd5('0x36')]!==_0x7bd5('0x46')){var _0x3027b1={};_0x3027b1[_0x24c3fe['name']]={'$like':'%'+_0x202dc9[_0x7bd5('0x38')][_0x7bd5('0x44')]+'%'};return _0x3027b1;}})});}_0x27021e=_['merge']({},_0x27021e,_0x202dc9[_0x7bd5('0x47')]);var _0x434892={'where':_0x27021e[_0x7bd5('0x42')]};return db[_0x7bd5('0x34')]['count'](_0x434892)[_0x7bd5('0x2a')](function(_0x810a78){_0x5051b7[_0x7bd5('0x23')]=_0x810a78;if(_0x202dc9[_0x7bd5('0x38')][_0x7bd5('0x48')]){_0x27021e['include']=[{'all':!![]}];}return db[_0x7bd5('0x34')][_0x7bd5('0x49')](_0x27021e);})[_0x7bd5('0x2a')](function(_0x27d659){_0x5051b7[_0x7bd5('0x4a')]=_0x27d659;return _0x5051b7;})[_0x7bd5('0x2a')](respondWithFilteredResult(_0x38ade3,_0x27021e))['catch'](handleError(_0x38ade3,null));};exports[_0x7bd5('0x4b')]=function(_0x4a53df,_0x3784b2){var _0x4de2b7={'raw':!![],'where':{'id':_0x4a53df['params']['id']}},_0x6f442a={};_0x6f442a['model']=_[_0x7bd5('0x4c')](db[_0x7bd5('0x34')][_0x7bd5('0x4d')]);_0x6f442a['query']=_['keys'](_0x4a53df[_0x7bd5('0x38')]);_0x6f442a[_0x7bd5('0x39')]=_[_0x7bd5('0x3a')](_0x6f442a[_0x7bd5('0x3b')],_0x6f442a['query']);_0x4de2b7['attributes']=_[_0x7bd5('0x3a')](_0x6f442a[_0x7bd5('0x3b')],qs[_0x7bd5('0x3d')](_0x4a53df[_0x7bd5('0x38')][_0x7bd5('0x3d')]));_0x4de2b7[_0x7bd5('0x3c')]=_0x4de2b7[_0x7bd5('0x3c')][_0x7bd5('0x3e')]?_0x4de2b7[_0x7bd5('0x3c')]:_0x6f442a[_0x7bd5('0x3b')];if(_0x4a53df[_0x7bd5('0x38')][_0x7bd5('0x48')]){_0x4de2b7[_0x7bd5('0x4e')]=[{'all':!![]}];}_0x4de2b7=_['merge']({},_0x4de2b7,_0x4a53df[_0x7bd5('0x47')]);return db[_0x7bd5('0x34')][_0x7bd5('0x4f')](_0x4de2b7)['then'](handleEntityNotFound(_0x3784b2,null))[_0x7bd5('0x2a')](respondWithResult(_0x3784b2,null))['catch'](handleError(_0x3784b2,null));};exports['create']=function(_0x31e933,_0x4b0a19){return db['FaxQueue'][_0x7bd5('0x50')](_0x31e933[_0x7bd5('0x51')],{})[_0x7bd5('0x2a')](function(_0x5c2ad2){var _0x44bb75=_0x31e933[_0x7bd5('0x52')][_0x7bd5('0x2c')]({'plain':!![]});if(!_0x44bb75)throw new Error(_0x7bd5('0x53'));if(_0x44bb75['role']==='user'){var _0x665b95=_0x5c2ad2[_0x7bd5('0x2c')]({'plain':!![]});var _0x545bd4=_0x7bd5('0x2d');return db[_0x7bd5('0x54')]['find']({'where':{'name':_0x545bd4,'userProfileId':_0x44bb75[_0x7bd5('0x55')]},'raw':!![]})[_0x7bd5('0x2a')](function(_0x3a4b03){if(_0x3a4b03&&_0x3a4b03[_0x7bd5('0x56')]===0x0){return db[_0x7bd5('0x2e')][_0x7bd5('0x50')]({'name':_0x665b95[_0x7bd5('0x30')],'resourceId':_0x665b95['id'],'type':_0x3a4b03[_0x7bd5('0x30')],'sectionId':_0x3a4b03['id']},{})[_0x7bd5('0x2a')](function(){return _0x5c2ad2;});}else{return _0x5c2ad2;}})[_0x7bd5('0x57')](function(_0x5d8d50){logger[_0x7bd5('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d8d50);throw _0x5d8d50;});}return _0x5c2ad2;})[_0x7bd5('0x2a')](respondWithResult(_0x4b0a19,0xc9))['catch'](handleError(_0x4b0a19,null));};exports[_0x7bd5('0x29')]=function(_0x85a942,_0x32816f){if(_0x85a942[_0x7bd5('0x51')]['id']){delete _0x85a942[_0x7bd5('0x51')]['id'];}return db[_0x7bd5('0x34')][_0x7bd5('0x4f')]({'where':{'id':_0x85a942['params']['id']}})[_0x7bd5('0x2a')](handleEntityNotFound(_0x32816f,null))[_0x7bd5('0x2a')](saveUpdates(_0x85a942['body'],null))[_0x7bd5('0x2a')](respondWithResult(_0x32816f,null))['catch'](handleError(_0x32816f,null));};exports[_0x7bd5('0x2b')]=function(_0x411fb4,_0x1d2411){return db[_0x7bd5('0x34')]['find']({'where':{'id':_0x411fb4[_0x7bd5('0x58')]['id']}})['then'](handleEntityNotFound(_0x1d2411,null))['then'](removeEntity(_0x1d2411,null))['catch'](handleError(_0x1d2411,null));};exports[_0x7bd5('0x59')]=function(_0x36c8bc,_0x4a4edb){return db[_0x7bd5('0x34')][_0x7bd5('0x59')]()[_0x7bd5('0x2a')](respondWithResult(_0x4a4edb,null))['catch'](handleError(_0x4a4edb,null));};exports[_0x7bd5('0x5a')]=function(_0x43f705,_0x46657c,_0x12de9e){var _0x5c4f27={'raw':!![],'where':{}},_0x2ec14e={},_0xcd6518;return db[_0x7bd5('0x34')]['findOne']({'where':{'id':_0x43f705[_0x7bd5('0x58')]['id']}})[_0x7bd5('0x2a')](handleEntityNotFound(_0x46657c,null))[_0x7bd5('0x2a')](function(_0x1f1d8a){if(_0x1f1d8a){_0xcd6518=_0x1f1d8a[_0x7bd5('0x2c')]({'plain':!![]});_0x2ec14e['model']=_[_0x7bd5('0x4c')](db[_0x7bd5('0x5b')][_0x7bd5('0x4d')]);_0x2ec14e[_0x7bd5('0x38')]=_[_0x7bd5('0x4c')](_0x43f705[_0x7bd5('0x38')]);_0x2ec14e[_0x7bd5('0x39')]=_[_0x7bd5('0x3a')](_0x2ec14e['model'],_0x2ec14e[_0x7bd5('0x38')]);_0x5c4f27[_0x7bd5('0x3c')]=_[_0x7bd5('0x3a')](_0x2ec14e[_0x7bd5('0x3b')],qs[_0x7bd5('0x3d')](_0x43f705[_0x7bd5('0x38')][_0x7bd5('0x3d')]));_0x5c4f27['attributes']=_0x5c4f27[_0x7bd5('0x3c')][_0x7bd5('0x3e')]?_0x5c4f27['attributes']:_0x2ec14e[_0x7bd5('0x3b')];if(!_0x43f705[_0x7bd5('0x38')][_0x7bd5('0x5c')](_0x7bd5('0x3f'))){_0x5c4f27[_0x7bd5('0x22')]=qs[_0x7bd5('0x22')](_0x43f705[_0x7bd5('0x38')][_0x7bd5('0x22')]);_0x5c4f27[_0x7bd5('0x21')]=qs[_0x7bd5('0x21')](_0x43f705[_0x7bd5('0x38')]['offset']);}_0x5c4f27[_0x7bd5('0x40')]=qs[_0x7bd5('0x41')](_0x43f705[_0x7bd5('0x38')][_0x7bd5('0x41')]);_0x5c4f27[_0x7bd5('0x42')]=qs['filters'](_[_0x7bd5('0x43')](_0x43f705[_0x7bd5('0x38')],_0x2ec14e[_0x7bd5('0x39')]));_0x5c4f27[_0x7bd5('0x42')]['FaxQueueId']=_0x1f1d8a['id'];if(_0x43f705[_0x7bd5('0x38')][_0x7bd5('0x44')]){_0x5c4f27[_0x7bd5('0x42')]=_[_0x7bd5('0x45')](_0x5c4f27[_0x7bd5('0x42')],{'$or':_['map'](_0x5c4f27[_0x7bd5('0x3c')],function(_0x3fe02f){var _0x3bc056={};_0x3bc056[_0x3fe02f]={'$like':'%'+_0x43f705[_0x7bd5('0x38')][_0x7bd5('0x44')]+'%'};return _0x3bc056;})});}_0x5c4f27=_[_0x7bd5('0x45')]({},_0x5c4f27,_0x43f705[_0x7bd5('0x47')]);return db[_0x7bd5('0x5b')][_0x7bd5('0x49')](_0x5c4f27);}})[_0x7bd5('0x2a')](function(_0x40d942){if(_0x40d942){return db['User']['findAndCountAll']({'where':{'id':_[_0x7bd5('0x33')](_0x40d942,_0x7bd5('0x5d')),'role':'agent'},'attributes':['id','name',_0x7bd5('0x5e'),_0x7bd5('0x5f'),'createdAt']});}})['then'](function(_0x2f89c0){if(_0x2f89c0){return{'count':_0x2f89c0[_0x7bd5('0x23')],'rows':_[_0x7bd5('0x33')](_0x2f89c0['rows'],function(_0xee944d){return{'membername':_0xee944d[_0x7bd5('0x30')],'UserId':_0xee944d['id'],'queue_name':_0xcd6518[_0x7bd5('0x30')],'FaxQueueId':_0xcd6518['id'],'interface':util[_0x7bd5('0x60')](_0x7bd5('0x61'),_0x7bd5('0x62'),_0xee944d[_0x7bd5('0x30')]),'penalty':0x0,'paused':_0xee944d[_0x7bd5('0x5e')],'createdAt':_0xee944d[_0x7bd5('0x63')],'updatedAt':_0xee944d[_0x7bd5('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7bd5('0x2a')](respondWithFilteredResult(_0x46657c,_0x5c4f27))[_0x7bd5('0x57')](handleError(_0x46657c,null));};exports[_0x7bd5('0x64')]=function(_0x3cd9ec,_0x4ff161,_0x11c29b){var _0x543ba9={};var _0x1de95b={};var _0x2e602f;var _0x4fe4f2;return db[_0x7bd5('0x34')][_0x7bd5('0x65')]({'where':{'id':_0x3cd9ec[_0x7bd5('0x58')]['id']}})[_0x7bd5('0x2a')](handleEntityNotFound(_0x4ff161,null))['then'](function(_0x238439){if(_0x238439){_0x2e602f=_0x238439;_0x1de95b[_0x7bd5('0x3b')]=_[_0x7bd5('0x4c')](db['Team'][_0x7bd5('0x4d')]);_0x1de95b['query']=_[_0x7bd5('0x4c')](_0x3cd9ec[_0x7bd5('0x38')]);_0x1de95b[_0x7bd5('0x39')]=_[_0x7bd5('0x3a')](_0x1de95b['model'],_0x1de95b[_0x7bd5('0x38')]);_0x543ba9[_0x7bd5('0x3c')]=_['intersection'](_0x1de95b[_0x7bd5('0x3b')],qs[_0x7bd5('0x3d')](_0x3cd9ec[_0x7bd5('0x38')][_0x7bd5('0x3d')]));_0x543ba9[_0x7bd5('0x3c')]=_0x543ba9[_0x7bd5('0x3c')][_0x7bd5('0x3e')]?_0x543ba9['attributes']:_0x1de95b[_0x7bd5('0x3b')];_0x543ba9['order']=qs[_0x7bd5('0x41')](_0x3cd9ec[_0x7bd5('0x38')][_0x7bd5('0x41')]);_0x543ba9[_0x7bd5('0x42')]=qs[_0x7bd5('0x39')](_['pick'](_0x3cd9ec['query'],_0x1de95b[_0x7bd5('0x39')]));if(_0x3cd9ec[_0x7bd5('0x38')]['filter']){_0x543ba9['where']=_[_0x7bd5('0x45')](_0x543ba9[_0x7bd5('0x42')],{'$or':_[_0x7bd5('0x33')](_0x543ba9[_0x7bd5('0x3c')],function(_0x11a346){var _0x5cf5ba={};_0x5cf5ba[_0x11a346]={'$like':'%'+_0x3cd9ec[_0x7bd5('0x38')]['filter']+'%'};return _0x5cf5ba;})});}_0x543ba9=_[_0x7bd5('0x45')]({},_0x543ba9,_0x3cd9ec['options']);return _0x2e602f[_0x7bd5('0x64')](_0x543ba9);}})[_0x7bd5('0x2a')](function(_0x4b8cb6){if(_0x4b8cb6){_0x4fe4f2=_0x4b8cb6['length'];if(!_0x3cd9ec[_0x7bd5('0x38')][_0x7bd5('0x5c')](_0x7bd5('0x3f'))){_0x543ba9[_0x7bd5('0x22')]=qs[_0x7bd5('0x22')](_0x3cd9ec[_0x7bd5('0x38')][_0x7bd5('0x22')]);_0x543ba9[_0x7bd5('0x21')]=qs[_0x7bd5('0x21')](_0x3cd9ec[_0x7bd5('0x38')][_0x7bd5('0x21')]);}return _0x2e602f[_0x7bd5('0x64')](_0x543ba9);}})[_0x7bd5('0x2a')](function(_0x8d5575){if(_0x8d5575){return _0x8d5575?{'count':_0x4fe4f2,'rows':_0x8d5575}:null;}})[_0x7bd5('0x2a')](respondWithResult(_0x4ff161,null))[_0x7bd5('0x57')](handleError(_0x4ff161,null));};exports[_0x7bd5('0x66')]=function(_0x5b180f,_0xc8983f,_0x26ebac){var _0x4eb15f=_0x5b180f['body'][_0x7bd5('0x67')];return db[_0x7bd5('0x68')][_0x7bd5('0x49')]({'where':{'id':_0x4eb15f},'attributes':['id'],'include':[{'model':db[_0x7bd5('0x69')],'as':_0x7bd5('0x6a'),'attributes':['id',_0x7bd5('0x30'),'online',_0x7bd5('0x6b'),'interface'],'raw':!![]}]})[_0x7bd5('0x2a')](function(_0xbddd0){if(_0xbddd0){var _0xcfe7dc=_[_0x7bd5('0x6c')](_0xbddd0,function(_0x48e4b9){var _0x3777fd=_0x48e4b9[_0x7bd5('0x2c')]({'plain':!![]});return _0x3777fd['Agents'];});return db['FaxQueue'][_0x7bd5('0x4f')]({'where':{'id':_0x5b180f[_0x7bd5('0x58')]['id']}})['then'](function(_0x168e70){return db[_0x7bd5('0x6d')]['transaction'](function(_0x3b6b6c){return _0x168e70[_0x7bd5('0x66')](_0x4eb15f,{'transaction':_0x3b6b6c})[_0x7bd5('0x2a')](function(){return BPromise['each'](_0xcfe7dc,function(_0x1b5e6d){return db[_0x7bd5('0x5b')]['findOrCreate']({'where':{'UserId':_0x1b5e6d['id'],'FaxQueueId':_0x5b180f['params']['id']},'transaction':_0x3b6b6c});});})[_0x7bd5('0x2a')](function(){_0xcfe7dc['forEach'](function(_0x415dc0){socket[_0x7bd5('0x6e')](_0x7bd5('0x6f'),{'UserId':_0x415dc0['id'],'FaxQueueId':_0x168e70['id']});});});});});}})[_0x7bd5('0x2a')](respondWithStatusCode(_0xc8983f,null))[_0x7bd5('0x57')](handleError(_0xc8983f,null));};exports[_0x7bd5('0x70')]=function(_0x2bb3ec,_0x18859e,_0x343391){return db[_0x7bd5('0x68')]['findAll']({'where':{'id':_0x2bb3ec[_0x7bd5('0x38')][_0x7bd5('0x67')]},'attributes':['id'],'include':[{'model':db[_0x7bd5('0x69')],'as':_0x7bd5('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x7bd5('0x2a')](handleEntityNotFound(_0x18859e,null))[_0x7bd5('0x2a')](function(_0x4a1283){var _0x19e524=_[_0x7bd5('0x33')](_0x4a1283,'id');var _0x212337=[];var _0x1d90c5=[];var _0x47734c=squel[_0x7bd5('0x71')]();_0x47734c[_0x7bd5('0x72')](_0x7bd5('0x73'))['from']('team_has_fax_queues','tq')['join'](_0x7bd5('0x74'),'ut',_0x7bd5('0x75'))[_0x7bd5('0x42')](_0x7bd5('0x76'),_0x2bb3ec[_0x7bd5('0x58')]['id']);for(var _0x306ec6=0x0;_0x306ec6<_0x4a1283[_0x7bd5('0x3e')];_0x306ec6+=0x1){let _0x33f702=_0x4a1283[_0x306ec6];for(var _0x55087a=0x0;_0x55087a<_0x33f702['Agents'][_0x7bd5('0x3e')];_0x55087a+=0x1){let _0x1660ea=_0x33f702[_0x7bd5('0x6a')][_0x55087a];var _0xf708eb=_0x47734c[_0x7bd5('0x77')]();_0xf708eb[_0x7bd5('0x42')]('ut.UserId\x20=\x20?',_0x1660ea['id']);_0x1d90c5[_0x7bd5('0x78')](db['sequelize'][_0x7bd5('0x38')](_0xf708eb['toString'](),{'type':db[_0x7bd5('0x6d')][_0x7bd5('0x79')][_0x7bd5('0x7a')]})[_0x7bd5('0x2a')](function(_0x500b64){if(_0x500b64[_0x7bd5('0x3e')]===0x1){return _0x1660ea['id'];}else{var _0x4ff65f=_[_0x7bd5('0x7b')](_[_0x7bd5('0x33')](_0x500b64,_0x7bd5('0x7c')),function(_0x3bdba2){return _[_0x7bd5('0x7d')](_0x19e524,_0x3bdba2);});if(_0x4ff65f){return _0x1660ea['id'];}}}));}}return BPromise['all'](_0x1d90c5)[_0x7bd5('0x2a')](function(_0x1b72d5){_0x212337=_(_0x212337)[_0x7bd5('0x7e')](_0x1b72d5)[_0x7bd5('0x7f')]()['value']();return db[_0x7bd5('0x34')][_0x7bd5('0x4f')]({'where':{'id':_0x2bb3ec[_0x7bd5('0x58')]['id']}})[_0x7bd5('0x2a')](function(_0x544c9e){return db[_0x7bd5('0x6d')][_0x7bd5('0x80')](function(_0x4e49f4){return _0x544c9e[_0x7bd5('0x70')](_0x2bb3ec['query'][_0x7bd5('0x67')],{'transaction':_0x4e49f4})[_0x7bd5('0x2a')](function(){if(!_['isEmpty'](_0x212337)){return _0x544c9e[_0x7bd5('0x81')](_0x212337,{'transaction':_0x4e49f4});}})[_0x7bd5('0x2a')](function(){_0x212337[_0x7bd5('0x82')](function(_0x5c29b8){socket['emit'](_0x7bd5('0x83'),{'UserId':_0x5c29b8,'FaxQueueId':_0x544c9e['id']});});});});});});})[_0x7bd5('0x2a')](respondWithStatusCode(_0x18859e,null))[_0x7bd5('0x57')](handleError(_0x18859e,null));};exports[_0x7bd5('0x84')]=function(_0x3bc72b,_0x41c5eb,_0x27c8de){return db[_0x7bd5('0x34')][_0x7bd5('0x4f')]({'where':{'id':_0x3bc72b['params']['id']}})[_0x7bd5('0x2a')](handleEntityNotFound(_0x41c5eb,null))[_0x7bd5('0x2a')](function(_0x39e914){if(_0x39e914){return _0x39e914['addAgents'](_0x3bc72b[_0x7bd5('0x51')]['ids'],_['omit'](_0x3bc72b[_0x7bd5('0x51')],[_0x7bd5('0x67'),'id'])||{})[_0x7bd5('0x85')](function(_0x482e22){for(var _0x41a7ec=0x0;_0x41a7ec<_0x3bc72b[_0x7bd5('0x51')][_0x7bd5('0x67')][_0x7bd5('0x3e')];_0x41a7ec+=0x1){socket[_0x7bd5('0x6e')](_0x7bd5('0x6f'),{'UserId':Number(_0x3bc72b[_0x7bd5('0x51')][_0x7bd5('0x67')][_0x41a7ec]),'FaxQueueId':Number(_0x3bc72b[_0x7bd5('0x58')]['id'])});}return _0x482e22;});}})['then'](respondWithResult(_0x41c5eb,null))[_0x7bd5('0x57')](handleError(_0x41c5eb,null));};exports[_0x7bd5('0x81')]=function(_0x2863cd,_0x2aee33,_0xbd5093){return db[_0x7bd5('0x34')][_0x7bd5('0x4f')]({'where':{'id':_0x2863cd[_0x7bd5('0x58')]['id']}})['then'](handleEntityNotFound(_0x2aee33,null))[_0x7bd5('0x2a')](function(_0x34ca20){if(_0x34ca20){return _0x34ca20[_0x7bd5('0x81')](_0x2863cd[_0x7bd5('0x38')][_0x7bd5('0x67')])[_0x7bd5('0x2a')](function(){if(_['isArray'](_0x2863cd[_0x7bd5('0x38')][_0x7bd5('0x67')])){for(var _0x5ba71a=0x0;_0x5ba71a<_0x2863cd['query'][_0x7bd5('0x67')][_0x7bd5('0x3e')];_0x5ba71a+=0x1){socket[_0x7bd5('0x6e')](_0x7bd5('0x83'),{'UserId':Number(_0x2863cd[_0x7bd5('0x38')][_0x7bd5('0x67')][_0x5ba71a]),'FaxQueueId':Number(_0x2863cd['params']['id'])});}}else{socket[_0x7bd5('0x6e')]('userFaxQueue:remove',{'UserId':Number(_0x2863cd[_0x7bd5('0x38')]['ids']),'FaxQueueId':Number(_0x2863cd[_0x7bd5('0x58')]['id'])});}});}})[_0x7bd5('0x2a')](respondWithStatusCode(_0x2aee33,null))[_0x7bd5('0x57')](handleError(_0x2aee33,null));};exports[_0x7bd5('0x86')]=function(_0xaf5f3b,_0x3cf839,_0x2ccb79){var _0x201881={};var _0x9918b8={};var _0x7900a4;var _0x48d972;return db[_0x7bd5('0x34')][_0x7bd5('0x65')]({'where':{'id':_0xaf5f3b[_0x7bd5('0x58')]['id']}})[_0x7bd5('0x2a')](handleEntityNotFound(_0x3cf839,null))[_0x7bd5('0x2a')](function(_0x589fea){if(_0x589fea){_0x7900a4=_0x589fea;_0x9918b8[_0x7bd5('0x3b')]=_['keys'](db[_0x7bd5('0x69')][_0x7bd5('0x4d')]);_0x9918b8[_0x7bd5('0x38')]=_['keys'](_0xaf5f3b[_0x7bd5('0x38')]);_0x9918b8[_0x7bd5('0x39')]=_[_0x7bd5('0x3a')](_0x9918b8[_0x7bd5('0x3b')],_0x9918b8[_0x7bd5('0x38')]);_0x201881[_0x7bd5('0x3c')]=_[_0x7bd5('0x3a')](_0x9918b8[_0x7bd5('0x3b')],qs[_0x7bd5('0x3d')](_0xaf5f3b[_0x7bd5('0x38')][_0x7bd5('0x3d')]));_0x201881['attributes']=_0x201881['attributes'][_0x7bd5('0x3e')]?_0x201881[_0x7bd5('0x3c')]:_0x9918b8[_0x7bd5('0x3b')];_0x201881[_0x7bd5('0x40')]=qs['sort'](_0xaf5f3b[_0x7bd5('0x38')][_0x7bd5('0x41')]);_0x201881['where']=qs[_0x7bd5('0x39')](_['pick'](_0xaf5f3b[_0x7bd5('0x38')],_0x9918b8[_0x7bd5('0x39')]));if(_0xaf5f3b[_0x7bd5('0x38')][_0x7bd5('0x44')]){_0x201881[_0x7bd5('0x42')]=_[_0x7bd5('0x45')](_0x201881['where'],{'$or':_[_0x7bd5('0x33')](_0x201881['attributes'],function(_0x1cbd0e){var _0x414241={};_0x414241[_0x1cbd0e]={'$like':'%'+_0xaf5f3b[_0x7bd5('0x38')][_0x7bd5('0x44')]+'%'};return _0x414241;})});}_0x201881=_[_0x7bd5('0x45')]({},_0x201881,_0xaf5f3b['options']);return _0x7900a4[_0x7bd5('0x86')](_0x201881);}})[_0x7bd5('0x2a')](function(_0x1fa16a){if(_0x1fa16a){_0x48d972=_0x1fa16a[_0x7bd5('0x3e')];if(!_0xaf5f3b['query'][_0x7bd5('0x5c')](_0x7bd5('0x3f'))){_0x201881[_0x7bd5('0x22')]=qs['limit'](_0xaf5f3b[_0x7bd5('0x38')][_0x7bd5('0x22')]);_0x201881[_0x7bd5('0x21')]=qs[_0x7bd5('0x21')](_0xaf5f3b['query'][_0x7bd5('0x21')]);}return _0x7900a4[_0x7bd5('0x86')](_0x201881);}})[_0x7bd5('0x2a')](function(_0x52f7da){if(_0x52f7da){return _0x52f7da?{'count':_0x48d972,'rows':_0x52f7da}:null;}})[_0x7bd5('0x2a')](respondWithResult(_0x3cf839,null))[_0x7bd5('0x57')](handleError(_0x3cf839,null));}; \ No newline at end of file +var _0xedfe=['offset','set','Content-Range','apply','reject','save','update','then','destroy','get','stack','name','send','index','map','FaxQueue','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','count','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserFaxQueue','rawAttributes','FaxQueueId','merge','findAndCountAll','UserId','agent','faxPause','updatedAt','format','getTeams','Team','addTeams','ids','User','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','emit','userFaxQueue:save','removeTeams','select','tq.TeamId','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','union','isEmpty','removeAgents','addAgents','omit','isArray','userFaxQueue:remove','getAgents','findOne','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','limit','undefined'];(function(_0x1e08fa,_0x2177b8){var _0x48a80f=function(_0x38c6d3){while(--_0x38c6d3){_0x1e08fa['push'](_0x1e08fa['shift']());}};_0x48a80f(++_0x2177b8);}(_0xedfe,0x182));var _0xeedf=function(_0x14b3fb,_0x569124){_0x14b3fb=_0x14b3fb-0x0;var _0x3a7342=_0xedfe[_0x14b3fb];return _0x3a7342;};'use strict';var emlformat=require(_0xeedf('0x0'));var rimraf=require(_0xeedf('0x1'));var zipdir=require(_0xeedf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeedf('0x3'));var moment=require(_0xeedf('0x4'));var BPromise=require(_0xeedf('0x5'));var Mustache=require(_0xeedf('0x6'));var util=require(_0xeedf('0x7'));var path=require(_0xeedf('0x8'));var sox=require('sox');var csv=require(_0xeedf('0x9'));var ejs=require(_0xeedf('0xa'));var fs=require('fs');var fs_extra=require(_0xeedf('0xb'));var _=require(_0xeedf('0xc'));var squel=require('squel');var crypto=require(_0xeedf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xeedf('0xe'));var toCsv=require(_0xeedf('0x9'));var querystring=require(_0xeedf('0xf'));var Papa=require('papaparse');var Redis=require(_0xeedf('0x10'));var authService=require(_0xeedf('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xeedf('0x12'));var hardwareService=require(_0xeedf('0x13'));var logger=require(_0xeedf('0x14'))(_0xeedf('0x15'));var utils=require('../../config/utils');var config=require(_0xeedf('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xeedf('0x17'))['db'];config['redis']=_[_0xeedf('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xeedf('0x19'))(new Redis(config['redis']));require(_0xeedf('0x1a'))[_0xeedf('0x1b')](socket);function respondWithStatusCode(_0x48a2ce,_0x1908d){_0x1908d=_0x1908d||0xcc;return function(_0x5c9a68){if(_0x5c9a68){return _0x48a2ce[_0xeedf('0x1c')](_0x1908d);}return _0x48a2ce[_0xeedf('0x1d')](_0x1908d)[_0xeedf('0x1e')]();};}function respondWithResult(_0x4a5603,_0x515993){_0x515993=_0x515993||0xc8;return function(_0x524909){if(_0x524909){return _0x4a5603['status'](_0x515993)[_0xeedf('0x1f')](_0x524909);}};}function respondWithFilteredResult(_0x107620,_0x17a8f1){return function(_0x1f60f3){if(_0x1f60f3){var _0x248f37=typeof _0x17a8f1['offset']==='undefined'&&typeof _0x17a8f1[_0xeedf('0x20')]===_0xeedf('0x21');var _0x15e3cd=_0x1f60f3['count'];var _0x3401f1=_0x248f37?0x0:_0x17a8f1[_0xeedf('0x22')];var _0x44a520=_0x248f37?_0x1f60f3['count']:_0x17a8f1[_0xeedf('0x22')]+_0x17a8f1[_0xeedf('0x20')];var _0x18e4df;if(_0x44a520>=_0x15e3cd){_0x44a520=_0x15e3cd;_0x18e4df=0xc8;}else{_0x18e4df=0xce;}_0x107620['status'](_0x18e4df);return _0x107620[_0xeedf('0x23')](_0xeedf('0x24'),_0x3401f1+'-'+_0x44a520+'/'+_0x15e3cd)['json'](_0x1f60f3);}return null;};}function patchUpdates(_0x2c024e){return function(_0x5ee5c1){try{jsonpatch[_0xeedf('0x25')](_0x5ee5c1,_0x2c024e,!![]);}catch(_0x2ec7dc){return BPromise[_0xeedf('0x26')](_0x2ec7dc);}return _0x5ee5c1[_0xeedf('0x27')]();};}function saveUpdates(_0x393565,_0x113c0f){return function(_0x243463){if(_0x243463){return _0x243463[_0xeedf('0x28')](_0x393565)[_0xeedf('0x29')](function(_0x13b2c4){return _0x13b2c4;});}return null;};}function removeEntity(_0x11e73b,_0x404864){return function(_0x4af9d7){if(_0x4af9d7){return _0x4af9d7[_0xeedf('0x2a')]()[_0xeedf('0x29')](function(){var _0x86c8cc=_0x4af9d7[_0xeedf('0x2b')]({'plain':!![]});var _0x4b09b6='FaxQueues';return db['UserProfileResource'][_0xeedf('0x2a')]({'where':{'type':_0x4b09b6,'resourceId':_0x86c8cc['id']}})[_0xeedf('0x29')](function(){return _0x4af9d7;});})[_0xeedf('0x29')](function(){_0x11e73b[_0xeedf('0x1d')](0xcc)[_0xeedf('0x1e')]();});}};}function handleEntityNotFound(_0x50d73b,_0x1518e4){return function(_0x1dee52){if(!_0x1dee52){_0x50d73b[_0xeedf('0x1c')](0x194);}return _0x1dee52;};}function handleError(_0x31a12a,_0x27ac3b){_0x27ac3b=_0x27ac3b||0x1f4;return function(_0x24f200){logger['error'](_0x24f200[_0xeedf('0x2c')]);if(_0x24f200[_0xeedf('0x2d')]){delete _0x24f200[_0xeedf('0x2d')];}_0x31a12a[_0xeedf('0x1d')](_0x27ac3b)[_0xeedf('0x2e')](_0x24f200);};}exports[_0xeedf('0x2f')]=function(_0xd54d61,_0x3c777e){var _0x492021={},_0x29a995={},_0x229428={'count':0x0,'rows':[]};var _0x100ecb=_[_0xeedf('0x30')](db[_0xeedf('0x31')]['rawAttributes'],function(_0x530463){return{'name':_0x530463[_0xeedf('0x32')],'type':_0x530463[_0xeedf('0x33')][_0xeedf('0x34')]};});_0x29a995[_0xeedf('0x35')]=_[_0xeedf('0x30')](_0x100ecb,_0xeedf('0x2d'));_0x29a995[_0xeedf('0x36')]=_[_0xeedf('0x37')](_0xd54d61[_0xeedf('0x36')]);_0x29a995[_0xeedf('0x38')]=_[_0xeedf('0x39')](_0x29a995[_0xeedf('0x35')],_0x29a995[_0xeedf('0x36')]);_0x492021[_0xeedf('0x3a')]=_[_0xeedf('0x39')](_0x29a995[_0xeedf('0x35')],qs[_0xeedf('0x3b')](_0xd54d61[_0xeedf('0x36')][_0xeedf('0x3b')]));_0x492021['attributes']=_0x492021['attributes'][_0xeedf('0x3c')]?_0x492021['attributes']:_0x29a995[_0xeedf('0x35')];if(!_0xd54d61[_0xeedf('0x36')][_0xeedf('0x3d')](_0xeedf('0x3e'))){_0x492021[_0xeedf('0x20')]=qs[_0xeedf('0x20')](_0xd54d61[_0xeedf('0x36')][_0xeedf('0x20')]);_0x492021[_0xeedf('0x22')]=qs[_0xeedf('0x22')](_0xd54d61[_0xeedf('0x36')][_0xeedf('0x22')]);}_0x492021[_0xeedf('0x3f')]=qs[_0xeedf('0x40')](_0xd54d61[_0xeedf('0x36')][_0xeedf('0x40')]);_0x492021['where']=qs[_0xeedf('0x38')](_[_0xeedf('0x41')](_0xd54d61['query'],_0x29a995['filters']),_0x100ecb);if(_0xd54d61[_0xeedf('0x36')][_0xeedf('0x42')]){_0x492021[_0xeedf('0x43')]=_['merge'](_0x492021[_0xeedf('0x43')],{'$or':_['map'](_0x100ecb,function(_0x7d0b1f){if(_0x7d0b1f[_0xeedf('0x33')]!=='VIRTUAL'){var _0x582003={};_0x582003[_0x7d0b1f[_0xeedf('0x2d')]]={'$like':'%'+_0xd54d61[_0xeedf('0x36')][_0xeedf('0x42')]+'%'};return _0x582003;}})});}_0x492021=_['merge']({},_0x492021,_0xd54d61['options']);var _0x3a12d8={'where':_0x492021['where']};return db[_0xeedf('0x31')][_0xeedf('0x44')](_0x3a12d8)[_0xeedf('0x29')](function(_0x3e5ba4){_0x229428[_0xeedf('0x44')]=_0x3e5ba4;if(_0xd54d61[_0xeedf('0x36')][_0xeedf('0x45')]){_0x492021[_0xeedf('0x46')]=[{'all':!![]}];}return db['FaxQueue'][_0xeedf('0x47')](_0x492021);})[_0xeedf('0x29')](function(_0x4c7709){_0x229428[_0xeedf('0x48')]=_0x4c7709;return _0x229428;})[_0xeedf('0x29')](respondWithFilteredResult(_0x3c777e,_0x492021))[_0xeedf('0x49')](handleError(_0x3c777e,null));};exports[_0xeedf('0x4a')]=function(_0x53f645,_0x649693){var _0x39ea97={'raw':!![],'where':{'id':_0x53f645[_0xeedf('0x4b')]['id']}},_0x581c88={};_0x581c88[_0xeedf('0x35')]=_['keys'](db[_0xeedf('0x31')]['rawAttributes']);_0x581c88[_0xeedf('0x36')]=_[_0xeedf('0x37')](_0x53f645[_0xeedf('0x36')]);_0x581c88['filters']=_[_0xeedf('0x39')](_0x581c88[_0xeedf('0x35')],_0x581c88[_0xeedf('0x36')]);_0x39ea97['attributes']=_[_0xeedf('0x39')](_0x581c88[_0xeedf('0x35')],qs[_0xeedf('0x3b')](_0x53f645['query'][_0xeedf('0x3b')]));_0x39ea97[_0xeedf('0x3a')]=_0x39ea97[_0xeedf('0x3a')][_0xeedf('0x3c')]?_0x39ea97['attributes']:_0x581c88['model'];if(_0x53f645['query'][_0xeedf('0x45')]){_0x39ea97[_0xeedf('0x46')]=[{'all':!![]}];}_0x39ea97=_['merge']({},_0x39ea97,_0x53f645[_0xeedf('0x4c')]);return db[_0xeedf('0x31')][_0xeedf('0x4d')](_0x39ea97)[_0xeedf('0x29')](handleEntityNotFound(_0x649693,null))[_0xeedf('0x29')](respondWithResult(_0x649693,null))['catch'](handleError(_0x649693,null));};exports[_0xeedf('0x4e')]=function(_0xa14d89,_0x460199){return db[_0xeedf('0x31')]['create'](_0xa14d89[_0xeedf('0x4f')],{})[_0xeedf('0x29')](function(_0x1ad177){var _0x410b88=_0xa14d89[_0xeedf('0x50')][_0xeedf('0x2b')]({'plain':!![]});if(!_0x410b88)throw new Error(_0xeedf('0x51'));if(_0x410b88[_0xeedf('0x52')]===_0xeedf('0x50')){var _0x419023=_0x1ad177['get']({'plain':!![]});var _0xbc9b8b='FaxQueues';return db['UserProfileSection']['find']({'where':{'name':_0xbc9b8b,'userProfileId':_0x410b88[_0xeedf('0x53')]},'raw':!![]})[_0xeedf('0x29')](function(_0x5d338f){if(_0x5d338f&&_0x5d338f[_0xeedf('0x54')]===0x0){return db[_0xeedf('0x55')][_0xeedf('0x4e')]({'name':_0x419023[_0xeedf('0x2d')],'resourceId':_0x419023['id'],'type':_0x5d338f[_0xeedf('0x2d')],'sectionId':_0x5d338f['id']},{})[_0xeedf('0x29')](function(){return _0x1ad177;});}else{return _0x1ad177;}})[_0xeedf('0x49')](function(_0x29f4b0){logger[_0xeedf('0x56')](_0xeedf('0x57'),_0x29f4b0);throw _0x29f4b0;});}return _0x1ad177;})['then'](respondWithResult(_0x460199,0xc9))[_0xeedf('0x49')](handleError(_0x460199,null));};exports['update']=function(_0x598927,_0x27775c){if(_0x598927['body']['id']){delete _0x598927[_0xeedf('0x4f')]['id'];}return db[_0xeedf('0x31')]['find']({'where':{'id':_0x598927[_0xeedf('0x4b')]['id']}})[_0xeedf('0x29')](handleEntityNotFound(_0x27775c,null))[_0xeedf('0x29')](saveUpdates(_0x598927[_0xeedf('0x4f')],null))['then'](respondWithResult(_0x27775c,null))[_0xeedf('0x49')](handleError(_0x27775c,null));};exports[_0xeedf('0x2a')]=function(_0x181d97,_0x5285e2){return db[_0xeedf('0x31')][_0xeedf('0x4d')]({'where':{'id':_0x181d97[_0xeedf('0x4b')]['id']}})[_0xeedf('0x29')](handleEntityNotFound(_0x5285e2,null))[_0xeedf('0x29')](removeEntity(_0x5285e2,null))[_0xeedf('0x49')](handleError(_0x5285e2,null));};exports['describe']=function(_0x3f9adb,_0x49741e){return db['FaxQueue'][_0xeedf('0x58')]()[_0xeedf('0x29')](respondWithResult(_0x49741e,null))[_0xeedf('0x49')](handleError(_0x49741e,null));};exports[_0xeedf('0x59')]=function(_0x1710cb,_0x2f4ccd,_0x29b7eb){var _0x1bee39={'raw':!![],'where':{}},_0x4194e6={},_0x2febb6;return db['FaxQueue']['findOne']({'where':{'id':_0x1710cb[_0xeedf('0x4b')]['id']}})[_0xeedf('0x29')](handleEntityNotFound(_0x2f4ccd,null))[_0xeedf('0x29')](function(_0xb86c83){if(_0xb86c83){_0x2febb6=_0xb86c83[_0xeedf('0x2b')]({'plain':!![]});_0x4194e6[_0xeedf('0x35')]=_[_0xeedf('0x37')](db[_0xeedf('0x5a')][_0xeedf('0x5b')]);_0x4194e6[_0xeedf('0x36')]=_[_0xeedf('0x37')](_0x1710cb[_0xeedf('0x36')]);_0x4194e6[_0xeedf('0x38')]=_['intersection'](_0x4194e6[_0xeedf('0x35')],_0x4194e6[_0xeedf('0x36')]);_0x1bee39['attributes']=_[_0xeedf('0x39')](_0x4194e6[_0xeedf('0x35')],qs['fields'](_0x1710cb[_0xeedf('0x36')][_0xeedf('0x3b')]));_0x1bee39['attributes']=_0x1bee39[_0xeedf('0x3a')]['length']?_0x1bee39[_0xeedf('0x3a')]:_0x4194e6[_0xeedf('0x35')];if(!_0x1710cb[_0xeedf('0x36')][_0xeedf('0x3d')](_0xeedf('0x3e'))){_0x1bee39[_0xeedf('0x20')]=qs[_0xeedf('0x20')](_0x1710cb[_0xeedf('0x36')][_0xeedf('0x20')]);_0x1bee39[_0xeedf('0x22')]=qs['offset'](_0x1710cb[_0xeedf('0x36')][_0xeedf('0x22')]);}_0x1bee39['order']=qs[_0xeedf('0x40')](_0x1710cb[_0xeedf('0x36')][_0xeedf('0x40')]);_0x1bee39[_0xeedf('0x43')]=qs['filters'](_[_0xeedf('0x41')](_0x1710cb[_0xeedf('0x36')],_0x4194e6['filters']));_0x1bee39[_0xeedf('0x43')][_0xeedf('0x5c')]=_0xb86c83['id'];if(_0x1710cb[_0xeedf('0x36')]['filter']){_0x1bee39[_0xeedf('0x43')]=_[_0xeedf('0x5d')](_0x1bee39[_0xeedf('0x43')],{'$or':_[_0xeedf('0x30')](_0x1bee39[_0xeedf('0x3a')],function(_0x13300b){var _0x2b3e49={};_0x2b3e49[_0x13300b]={'$like':'%'+_0x1710cb[_0xeedf('0x36')][_0xeedf('0x42')]+'%'};return _0x2b3e49;})});}_0x1bee39=_[_0xeedf('0x5d')]({},_0x1bee39,_0x1710cb[_0xeedf('0x4c')]);return db['UserFaxQueue'][_0xeedf('0x47')](_0x1bee39);}})['then'](function(_0x1e32e1){if(_0x1e32e1){return db['User'][_0xeedf('0x5e')]({'where':{'id':_[_0xeedf('0x30')](_0x1e32e1,_0xeedf('0x5f')),'role':_0xeedf('0x60')},'attributes':['id',_0xeedf('0x2d'),_0xeedf('0x61'),_0xeedf('0x62'),'createdAt']});}})[_0xeedf('0x29')](function(_0x47ac4a){if(_0x47ac4a){return{'count':_0x47ac4a['count'],'rows':_['map'](_0x47ac4a[_0xeedf('0x48')],function(_0x1b01f6){return{'membername':_0x1b01f6[_0xeedf('0x2d')],'UserId':_0x1b01f6['id'],'queue_name':_0x2febb6[_0xeedf('0x2d')],'FaxQueueId':_0x2febb6['id'],'interface':util[_0xeedf('0x63')]('%s/%s','SIP',_0x1b01f6['name']),'penalty':0x0,'paused':_0x1b01f6['faxPause'],'createdAt':_0x1b01f6['createdAt'],'updatedAt':_0x1b01f6[_0xeedf('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xeedf('0x29')](respondWithFilteredResult(_0x2f4ccd,_0x1bee39))[_0xeedf('0x49')](handleError(_0x2f4ccd,null));};exports[_0xeedf('0x64')]=function(_0x187463,_0x4f7a80,_0x26ca9a){var _0x27833e={};var _0x4d7e7a={};var _0x30535c;var _0x3bc68a;return db[_0xeedf('0x31')]['findOne']({'where':{'id':_0x187463[_0xeedf('0x4b')]['id']}})[_0xeedf('0x29')](handleEntityNotFound(_0x4f7a80,null))[_0xeedf('0x29')](function(_0x16802d){if(_0x16802d){_0x30535c=_0x16802d;_0x4d7e7a[_0xeedf('0x35')]=_[_0xeedf('0x37')](db[_0xeedf('0x65')][_0xeedf('0x5b')]);_0x4d7e7a[_0xeedf('0x36')]=_[_0xeedf('0x37')](_0x187463[_0xeedf('0x36')]);_0x4d7e7a[_0xeedf('0x38')]=_[_0xeedf('0x39')](_0x4d7e7a[_0xeedf('0x35')],_0x4d7e7a[_0xeedf('0x36')]);_0x27833e[_0xeedf('0x3a')]=_['intersection'](_0x4d7e7a[_0xeedf('0x35')],qs['fields'](_0x187463[_0xeedf('0x36')]['fields']));_0x27833e[_0xeedf('0x3a')]=_0x27833e[_0xeedf('0x3a')]['length']?_0x27833e[_0xeedf('0x3a')]:_0x4d7e7a[_0xeedf('0x35')];_0x27833e[_0xeedf('0x3f')]=qs[_0xeedf('0x40')](_0x187463[_0xeedf('0x36')][_0xeedf('0x40')]);_0x27833e[_0xeedf('0x43')]=qs[_0xeedf('0x38')](_[_0xeedf('0x41')](_0x187463[_0xeedf('0x36')],_0x4d7e7a[_0xeedf('0x38')]));if(_0x187463[_0xeedf('0x36')][_0xeedf('0x42')]){_0x27833e['where']=_[_0xeedf('0x5d')](_0x27833e[_0xeedf('0x43')],{'$or':_[_0xeedf('0x30')](_0x27833e[_0xeedf('0x3a')],function(_0x324806){var _0x385734={};_0x385734[_0x324806]={'$like':'%'+_0x187463[_0xeedf('0x36')][_0xeedf('0x42')]+'%'};return _0x385734;})});}_0x27833e=_[_0xeedf('0x5d')]({},_0x27833e,_0x187463[_0xeedf('0x4c')]);return _0x30535c[_0xeedf('0x64')](_0x27833e);}})[_0xeedf('0x29')](function(_0xef8f79){if(_0xef8f79){_0x3bc68a=_0xef8f79[_0xeedf('0x3c')];if(!_0x187463['query'][_0xeedf('0x3d')](_0xeedf('0x3e'))){_0x27833e[_0xeedf('0x20')]=qs['limit'](_0x187463[_0xeedf('0x36')][_0xeedf('0x20')]);_0x27833e['offset']=qs['offset'](_0x187463['query']['offset']);}return _0x30535c['getTeams'](_0x27833e);}})[_0xeedf('0x29')](function(_0x3a9776){if(_0x3a9776){return _0x3a9776?{'count':_0x3bc68a,'rows':_0x3a9776}:null;}})['then'](respondWithResult(_0x4f7a80,null))[_0xeedf('0x49')](handleError(_0x4f7a80,null));};exports[_0xeedf('0x66')]=function(_0x3248e1,_0x30f33f,_0xdc3dd1){var _0xf8920d=_0x3248e1[_0xeedf('0x4f')][_0xeedf('0x67')];return db[_0xeedf('0x65')][_0xeedf('0x47')]({'where':{'id':_0xf8920d},'attributes':['id'],'include':[{'model':db[_0xeedf('0x68')],'as':'Agents','attributes':['id','name',_0xeedf('0x69'),_0xeedf('0x6a'),_0xeedf('0x6b')],'raw':!![]}]})[_0xeedf('0x29')](function(_0x360f46){if(_0x360f46){var _0x15e6ef=_[_0xeedf('0x6c')](_0x360f46,function(_0x4652a8){var _0xb231ff=_0x4652a8[_0xeedf('0x2b')]({'plain':!![]});return _0xb231ff[_0xeedf('0x6d')];});return db[_0xeedf('0x31')][_0xeedf('0x4d')]({'where':{'id':_0x3248e1[_0xeedf('0x4b')]['id']}})[_0xeedf('0x29')](function(_0x591abc){return db[_0xeedf('0x6e')][_0xeedf('0x6f')](function(_0x2a0d6f){return _0x591abc[_0xeedf('0x66')](_0xf8920d,{'transaction':_0x2a0d6f})[_0xeedf('0x29')](function(){return BPromise[_0xeedf('0x70')](_0x15e6ef,function(_0x10a367){return db[_0xeedf('0x5a')][_0xeedf('0x71')]({'where':{'UserId':_0x10a367['id'],'FaxQueueId':_0x3248e1[_0xeedf('0x4b')]['id']},'transaction':_0x2a0d6f});});})['then'](function(){_0x15e6ef['forEach'](function(_0x4ac866){socket[_0xeedf('0x72')](_0xeedf('0x73'),{'UserId':_0x4ac866['id'],'FaxQueueId':_0x591abc['id']});});});});});}})[_0xeedf('0x29')](respondWithStatusCode(_0x30f33f,null))[_0xeedf('0x49')](handleError(_0x30f33f,null));};exports[_0xeedf('0x74')]=function(_0x50d2d9,_0x1af30e,_0x2fdac7){return db[_0xeedf('0x65')][_0xeedf('0x47')]({'where':{'id':_0x50d2d9[_0xeedf('0x36')][_0xeedf('0x67')]},'attributes':['id'],'include':[{'model':db[_0xeedf('0x68')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1af30e,null))[_0xeedf('0x29')](function(_0x56348f){var _0x13fa35=_[_0xeedf('0x30')](_0x56348f,'id');var _0x39d690=[];var _0xfcecb3=[];var _0x53e00a=squel[_0xeedf('0x75')]();_0x53e00a['field'](_0xeedf('0x76'))[_0xeedf('0x77')](_0xeedf('0x78'),'tq')[_0xeedf('0x79')]('user_has_teams','ut',_0xeedf('0x7a'))[_0xeedf('0x43')](_0xeedf('0x7b'),_0x50d2d9[_0xeedf('0x4b')]['id']);for(var _0x2be469=0x0;_0x2be469<_0x56348f[_0xeedf('0x3c')];_0x2be469+=0x1){let _0x3e5d35=_0x56348f[_0x2be469];for(var _0x6c5cac=0x0;_0x6c5cac<_0x3e5d35[_0xeedf('0x6d')]['length'];_0x6c5cac+=0x1){let _0x4f52f0=_0x3e5d35[_0xeedf('0x6d')][_0x6c5cac];var _0x2775d6=_0x53e00a[_0xeedf('0x7c')]();_0x2775d6['where'](_0xeedf('0x7d'),_0x4f52f0['id']);_0xfcecb3[_0xeedf('0x7e')](db[_0xeedf('0x6e')][_0xeedf('0x36')](_0x2775d6[_0xeedf('0x7f')](),{'type':db[_0xeedf('0x6e')][_0xeedf('0x80')][_0xeedf('0x81')]})['then'](function(_0x2033d9){if(_0x2033d9[_0xeedf('0x3c')]===0x1){return _0x4f52f0['id'];}else{var _0x41b39a=_['every'](_['map'](_0x2033d9,_0xeedf('0x82')),function(_0x422cc0){return _['includes'](_0x13fa35,_0x422cc0);});if(_0x41b39a){return _0x4f52f0['id'];}}}));}}return BPromise['all'](_0xfcecb3)[_0xeedf('0x29')](function(_0x5ce1c7){_0x39d690=_(_0x39d690)[_0xeedf('0x83')](_0x5ce1c7)['compact']()['value']();return db[_0xeedf('0x31')][_0xeedf('0x4d')]({'where':{'id':_0x50d2d9['params']['id']}})[_0xeedf('0x29')](function(_0x2312e0){return db[_0xeedf('0x6e')][_0xeedf('0x6f')](function(_0x4312b6){return _0x2312e0[_0xeedf('0x74')](_0x50d2d9['query']['ids'],{'transaction':_0x4312b6})[_0xeedf('0x29')](function(){if(!_[_0xeedf('0x84')](_0x39d690)){return _0x2312e0[_0xeedf('0x85')](_0x39d690,{'transaction':_0x4312b6});}})[_0xeedf('0x29')](function(){_0x39d690['forEach'](function(_0x17d070){socket['emit']('userFaxQueue:remove',{'UserId':_0x17d070,'FaxQueueId':_0x2312e0['id']});});});});});});})[_0xeedf('0x29')](respondWithStatusCode(_0x1af30e,null))[_0xeedf('0x49')](handleError(_0x1af30e,null));};exports[_0xeedf('0x86')]=function(_0x2e995e,_0x5a9a8a,_0x2be643){return db[_0xeedf('0x31')]['find']({'where':{'id':_0x2e995e[_0xeedf('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5a9a8a,null))[_0xeedf('0x29')](function(_0x244555){if(_0x244555){return _0x244555['addAgents'](_0x2e995e[_0xeedf('0x4f')][_0xeedf('0x67')],_[_0xeedf('0x87')](_0x2e995e[_0xeedf('0x4f')],[_0xeedf('0x67'),'id'])||{})['spread'](function(_0x1aba27){for(var _0x5b17fd=0x0;_0x5b17fd<_0x2e995e['body'][_0xeedf('0x67')][_0xeedf('0x3c')];_0x5b17fd+=0x1){socket['emit']('userFaxQueue:save',{'UserId':Number(_0x2e995e['body'][_0xeedf('0x67')][_0x5b17fd]),'FaxQueueId':Number(_0x2e995e['params']['id'])});}return _0x1aba27;});}})[_0xeedf('0x29')](respondWithResult(_0x5a9a8a,null))[_0xeedf('0x49')](handleError(_0x5a9a8a,null));};exports[_0xeedf('0x85')]=function(_0x5f5dd3,_0x4f10bd,_0x188612){return db[_0xeedf('0x31')][_0xeedf('0x4d')]({'where':{'id':_0x5f5dd3[_0xeedf('0x4b')]['id']}})[_0xeedf('0x29')](handleEntityNotFound(_0x4f10bd,null))[_0xeedf('0x29')](function(_0x4621f0){if(_0x4621f0){return _0x4621f0[_0xeedf('0x85')](_0x5f5dd3['query'][_0xeedf('0x67')])[_0xeedf('0x29')](function(){if(_[_0xeedf('0x88')](_0x5f5dd3['query'][_0xeedf('0x67')])){for(var _0x27e2d8=0x0;_0x27e2d8<_0x5f5dd3[_0xeedf('0x36')]['ids'][_0xeedf('0x3c')];_0x27e2d8+=0x1){socket[_0xeedf('0x72')](_0xeedf('0x89'),{'UserId':Number(_0x5f5dd3[_0xeedf('0x36')]['ids'][_0x27e2d8]),'FaxQueueId':Number(_0x5f5dd3[_0xeedf('0x4b')]['id'])});}}else{socket[_0xeedf('0x72')](_0xeedf('0x89'),{'UserId':Number(_0x5f5dd3['query'][_0xeedf('0x67')]),'FaxQueueId':Number(_0x5f5dd3[_0xeedf('0x4b')]['id'])});}});}})[_0xeedf('0x29')](respondWithStatusCode(_0x4f10bd,null))[_0xeedf('0x49')](handleError(_0x4f10bd,null));};exports[_0xeedf('0x8a')]=function(_0x59d6c5,_0x2ff3cc,_0x2c3ba8){var _0x468494={};var _0x1b15a8={};var _0x432c40;var _0x106e16;return db[_0xeedf('0x31')][_0xeedf('0x8b')]({'where':{'id':_0x59d6c5[_0xeedf('0x4b')]['id']}})[_0xeedf('0x29')](handleEntityNotFound(_0x2ff3cc,null))[_0xeedf('0x29')](function(_0x104d83){if(_0x104d83){_0x432c40=_0x104d83;_0x1b15a8[_0xeedf('0x35')]=_['keys'](db['User']['rawAttributes']);_0x1b15a8[_0xeedf('0x36')]=_['keys'](_0x59d6c5[_0xeedf('0x36')]);_0x1b15a8[_0xeedf('0x38')]=_[_0xeedf('0x39')](_0x1b15a8[_0xeedf('0x35')],_0x1b15a8[_0xeedf('0x36')]);_0x468494[_0xeedf('0x3a')]=_[_0xeedf('0x39')](_0x1b15a8[_0xeedf('0x35')],qs[_0xeedf('0x3b')](_0x59d6c5[_0xeedf('0x36')]['fields']));_0x468494['attributes']=_0x468494[_0xeedf('0x3a')][_0xeedf('0x3c')]?_0x468494[_0xeedf('0x3a')]:_0x1b15a8[_0xeedf('0x35')];_0x468494['order']=qs[_0xeedf('0x40')](_0x59d6c5['query'][_0xeedf('0x40')]);_0x468494[_0xeedf('0x43')]=qs[_0xeedf('0x38')](_['pick'](_0x59d6c5['query'],_0x1b15a8[_0xeedf('0x38')]));if(_0x59d6c5[_0xeedf('0x36')][_0xeedf('0x42')]){_0x468494[_0xeedf('0x43')]=_[_0xeedf('0x5d')](_0x468494[_0xeedf('0x43')],{'$or':_['map'](_0x468494['attributes'],function(_0xb569dc){var _0x420c19={};_0x420c19[_0xb569dc]={'$like':'%'+_0x59d6c5[_0xeedf('0x36')][_0xeedf('0x42')]+'%'};return _0x420c19;})});}_0x468494=_[_0xeedf('0x5d')]({},_0x468494,_0x59d6c5['options']);return _0x432c40[_0xeedf('0x8a')](_0x468494);}})['then'](function(_0x45b6ee){if(_0x45b6ee){_0x106e16=_0x45b6ee[_0xeedf('0x3c')];if(!_0x59d6c5['query'][_0xeedf('0x3d')](_0xeedf('0x3e'))){_0x468494['limit']=qs[_0xeedf('0x20')](_0x59d6c5[_0xeedf('0x36')][_0xeedf('0x20')]);_0x468494[_0xeedf('0x22')]=qs[_0xeedf('0x22')](_0x59d6c5[_0xeedf('0x36')]['offset']);}return _0x432c40[_0xeedf('0x8a')](_0x468494);}})['then'](function(_0x20e929){if(_0x20e929){return _0x20e929?{'count':_0x106e16,'rows':_0x20e929}:null;}})[_0xeedf('0x29')](respondWithResult(_0x2ff3cc,null))[_0xeedf('0x49')](handleError(_0x2ff3cc,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 249dbe1..ca9688c 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 _0xc319=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','save','update','remove','emit'];(function(_0x215082,_0xa0582f){var _0x5ae39a=function(_0x33b193){while(--_0x33b193){_0x215082['push'](_0x215082['shift']());}};_0x5ae39a(++_0xa0582f);}(_0xc319,0x8f));var _0x9c31=function(_0x2e771b,_0x4ac29b){_0x2e771b=_0x2e771b-0x0;var _0x2407fc=_0xc319[_0x2e771b];return _0x2407fc;};'use strict';var EventEmitter=require(_0x9c31('0x0'));var FaxQueue=require(_0x9c31('0x1'))['db'][_0x9c31('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9c31('0x3'),'afterUpdate':_0x9c31('0x4'),'afterDestroy':_0x9c31('0x5')};function emitEvent(_0x379adf){return function(_0x58c15c,_0x1563ef,_0x479e86){FaxQueueEvents[_0x9c31('0x6')](_0x379adf+':'+_0x58c15c['id'],_0x58c15c);FaxQueueEvents['emit'](_0x379adf,_0x58c15c);_0x479e86(null);};}for(var e in events){if(events[_0x9c31('0x7')](e)){var event=events[e];FaxQueue[_0x9c31('0x8')](e,emitEvent(event));}}module[_0x9c31('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0x80d2=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxQueue','save'];(function(_0x225c40,_0x3882eb){var _0x59bdfa=function(_0x1a8626){while(--_0x1a8626){_0x225c40['push'](_0x225c40['shift']());}};_0x59bdfa(++_0x3882eb);}(_0x80d2,0x13c));var _0x280d=function(_0x3c3ece,_0x4e1149){_0x3c3ece=_0x3c3ece-0x0;var _0x708fc8=_0x80d2[_0x3c3ece];return _0x708fc8;};'use strict';var EventEmitter=require(_0x280d('0x0'));var FaxQueue=require(_0x280d('0x1'))['db'][_0x280d('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x280d('0x3'),'afterUpdate':'update','afterDestroy':_0x280d('0x4')};function emitEvent(_0x4d8e4f){return function(_0x371a63,_0x3c301e,_0x1a89ff){FaxQueueEvents[_0x280d('0x5')](_0x4d8e4f+':'+_0x371a63['id'],_0x371a63);FaxQueueEvents['emit'](_0x4d8e4f,_0x371a63);_0x1a89ff(null);};}for(var e in events){if(events[_0x280d('0x6')](e)){var event=events[e];FaxQueue[_0x280d('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 784d7c0..82c685e 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 _0xba29=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','FaxQueue','fax_queues'];(function(_0x328b40,_0x370642){var _0x556a56=function(_0x467553){while(--_0x467553){_0x328b40['push'](_0x328b40['shift']());}};_0x556a56(++_0x370642);}(_0xba29,0x10e));var _0x9ba2=function(_0x793676,_0x21a7aa){_0x793676=_0x793676-0x0;var _0x19d6d2=_0xba29[_0x793676];return _0x19d6d2;};'use strict';var _=require('lodash');var util=require(_0x9ba2('0x0'));var logger=require(_0x9ba2('0x1'))(_0x9ba2('0x2'));var moment=require(_0x9ba2('0x3'));var BPromise=require(_0x9ba2('0x4'));var rp=require(_0x9ba2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ba2('0x6'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0x9ba2('0x7')]=function(_0x12d539,_0x20c8dd){return _0x12d539['define'](_0x9ba2('0x8'),attributes,{'tableName':_0x9ba2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x21b2=['FaxQueue','fax_queues','lodash','util','../../config/logger','bluebird','path','rimraf','exports'];(function(_0x5b26cb,_0x527ab0){var _0x563d12=function(_0x472b38){while(--_0x472b38){_0x5b26cb['push'](_0x5b26cb['shift']());}};_0x563d12(++_0x527ab0);}(_0x21b2,0x1e8));var _0x221b=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x21b2[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0x221b('0x0'));var util=require(_0x221b('0x1'));var logger=require(_0x221b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x221b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x221b('0x4'));var rimraf=require(_0x221b('0x5'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0x221b('0x6')]=function(_0x1a4a17,_0x37b9eb){return _0x1a4a17['define'](_0x221b('0x7'),attributes,{'tableName':_0x221b('0x8'),'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 1b9ad2c..604e6d7 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 _0x6118=['options','raw','where','attributes','include','map','model','catch','ShowFaxQueue','find','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','localhost','socket.io-emitter','./faxQueue.socket','register','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFaxQueue','FaxQueue','findAll'];(function(_0x42d1f8,_0x22e529){var _0x40d234=function(_0xd59b57){while(--_0xd59b57){_0x42d1f8['push'](_0x42d1f8['shift']());}};_0x40d234(++_0x22e529);}(_0x6118,0x160));var _0x8611=function(_0x15fc3c,_0x35665b){_0x15fc3c=_0x15fc3c-0x0;var _0x94c5c8=_0x6118[_0x15fc3c];return _0x94c5c8;};'use strict';var _=require(_0x8611('0x0'));var util=require(_0x8611('0x1'));var moment=require(_0x8611('0x2'));var BPromise=require(_0x8611('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8611('0x4'))['db'];var utils=require(_0x8611('0x5'));var logger=require(_0x8611('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8611('0x7'));var client=jayson[_0x8611('0x8')]['http']({'port':0x232a});config[_0x8611('0x9')]=_['defaults'](config['redis'],{'host':_0x8611('0xa'),'port':0x18eb});var socket=require(_0x8611('0xb'))(new Redis(config[_0x8611('0x9')]));require(_0x8611('0xc'))[_0x8611('0xd')](socket);function respondWithRpcPromise(_0x301729,_0x36d188,_0x57c521){return new BPromise(function(_0x2590e2,_0x80752f){return client['request'](_0x301729,_0x57c521)[_0x8611('0xe')](function(_0x58cfb0){logger[_0x8611('0xf')](_0x8611('0x10'),_0x36d188,_0x8611('0x11'));logger[_0x8611('0x12')](_0x8611('0x13'),_0x36d188,_0x8611('0x11'),JSON[_0x8611('0x14')](_0x58cfb0));if(_0x58cfb0[_0x8611('0x15')]){if(_0x58cfb0[_0x8611('0x15')][_0x8611('0x16')]===0x1f4){logger[_0x8611('0x15')](_0x8611('0x10'),_0x36d188,_0x58cfb0[_0x8611('0x15')][_0x8611('0x17')]);return _0x80752f(_0x58cfb0[_0x8611('0x15')]['message']);}logger['error']('FaxQueue,\x20%s,\x20%s',_0x36d188,_0x58cfb0['error'][_0x8611('0x17')]);return _0x2590e2(_0x58cfb0[_0x8611('0x15')][_0x8611('0x17')]);}else{logger[_0x8611('0xf')](_0x8611('0x10'),_0x36d188,_0x8611('0x11'));_0x2590e2(_0x58cfb0[_0x8611('0x18')][_0x8611('0x17')]);}})['catch'](function(_0x1012b5){logger[_0x8611('0x15')](_0x8611('0x10'),_0x36d188,_0x1012b5);_0x80752f(_0x1012b5);});});}exports[_0x8611('0x19')]=function(_0x54d7e0){var _0x1084ff=this;return new Promise(function(_0x37825f,_0x5bfd00){return db[_0x8611('0x1a')][_0x8611('0x1b')]({'raw':_0x54d7e0['options']?_0x54d7e0[_0x8611('0x1c')][_0x8611('0x1d')]===undefined?!![]:![]:!![],'where':_0x54d7e0[_0x8611('0x1c')]?_0x54d7e0[_0x8611('0x1c')][_0x8611('0x1e')]||null:null,'attributes':_0x54d7e0['options']?_0x54d7e0[_0x8611('0x1c')][_0x8611('0x1f')]||null:null,'limit':_0x54d7e0['options']?_0x54d7e0[_0x8611('0x1c')]['limit']||null:null,'include':_0x54d7e0['options']?_0x54d7e0[_0x8611('0x1c')][_0x8611('0x20')]?_[_0x8611('0x21')](_0x54d7e0[_0x8611('0x1c')]['include'],function(_0x4bdf5a){return{'model':db[_0x4bdf5a[_0x8611('0x22')]],'as':_0x4bdf5a['as'],'attributes':_0x4bdf5a[_0x8611('0x1f')],'include':_0x4bdf5a[_0x8611('0x20')]?_[_0x8611('0x21')](_0x4bdf5a[_0x8611('0x20')],function(_0xb7e6a0){return{'model':db[_0xb7e6a0['model']],'as':_0xb7e6a0['as'],'attributes':_0xb7e6a0['attributes'],'include':_0xb7e6a0['include']?_['map'](_0xb7e6a0[_0x8611('0x20')],function(_0x19b0e4){return{'model':db[_0x19b0e4[_0x8611('0x22')]],'as':_0x19b0e4['as'],'attributes':_0x19b0e4[_0x8611('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8611('0xe')](function(_0x50d830){logger[_0x8611('0xf')](_0x8611('0x19'),_0x54d7e0);logger[_0x8611('0x12')](_0x8611('0x19'),_0x54d7e0,JSON[_0x8611('0x14')](_0x50d830));_0x37825f(_0x50d830);})[_0x8611('0x23')](function(_0x430027){logger[_0x8611('0x15')](_0x8611('0x19'),_0x430027[_0x8611('0x17')],_0x54d7e0);_0x5bfd00(_0x1084ff[_0x8611('0x15')](0x1f4,_0x430027['message']));});});};exports[_0x8611('0x24')]=function(_0x5b3296){var _0x96380e=this;return new Promise(function(_0x3e0c71,_0x747b04){return db[_0x8611('0x1a')][_0x8611('0x25')]({'raw':_0x5b3296[_0x8611('0x1c')]?_0x5b3296[_0x8611('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x5b3296[_0x8611('0x1c')]?_0x5b3296[_0x8611('0x1c')]['where']||null:null,'attributes':_0x5b3296[_0x8611('0x1c')]?_0x5b3296[_0x8611('0x1c')]['attributes']||null:null,'include':_0x5b3296[_0x8611('0x1c')]?_0x5b3296[_0x8611('0x1c')][_0x8611('0x20')]?_[_0x8611('0x21')](_0x5b3296[_0x8611('0x1c')][_0x8611('0x20')],function(_0x213288){return{'model':db[_0x213288[_0x8611('0x22')]],'as':_0x213288['as'],'attributes':_0x213288['attributes'],'include':_0x213288[_0x8611('0x20')]?_[_0x8611('0x21')](_0x213288['include'],function(_0x3850f5){return{'model':db[_0x3850f5['model']],'as':_0x3850f5['as'],'attributes':_0x3850f5[_0x8611('0x1f')],'include':_0x3850f5[_0x8611('0x20')]?_['map'](_0x3850f5[_0x8611('0x20')],function(_0x21dd03){return{'model':db[_0x21dd03[_0x8611('0x22')]],'as':_0x21dd03['as'],'attributes':_0x21dd03['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5578de){logger['info'](_0x8611('0x24'),_0x5b3296);logger['debug'](_0x8611('0x24'),_0x5b3296,JSON['stringify'](_0x5578de));_0x3e0c71(_0x5578de);})[_0x8611('0x23')](function(_0x560214){logger[_0x8611('0x15')]('ShowFaxQueue',_0x560214[_0x8611('0x17')],_0x5b3296);_0x747b04(_0x96380e[_0x8611('0x15')](0x1f4,_0x560214[_0x8611('0x17')]));});});}; \ No newline at end of file +var _0x2580=['result','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','GetFaxQueue','catch','ShowFaxQueue','find','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','request','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x2580,0x88));var _0x0258=function(_0x8d99aa,_0x33de9e){_0x8d99aa=_0x8d99aa-0x0;var _0x43a1c7=_0x2580[_0x8d99aa];return _0x43a1c7;};'use strict';var _=require('lodash');var util=require(_0x0258('0x0'));var moment=require(_0x0258('0x1'));var BPromise=require(_0x0258('0x2'));var rs=require(_0x0258('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0258('0x4'));var logger=require(_0x0258('0x5'))(_0x0258('0x6'));var config=require('../../config/environment');var jayson=require(_0x0258('0x7'));var client=jayson[_0x0258('0x8')][_0x0258('0x9')]({'port':0x232a});config['redis']=_[_0x0258('0xa')](config['redis'],{'host':_0x0258('0xb'),'port':0x18eb});var socket=require(_0x0258('0xc'))(new Redis(config[_0x0258('0xd')]));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x3b8170,_0x14b43e,_0x1186db){return new BPromise(function(_0x34353c,_0x12830f){return client[_0x0258('0xe')](_0x3b8170,_0x1186db)['then'](function(_0x166c24){logger[_0x0258('0xf')](_0x0258('0x10'),_0x14b43e,'request\x20sent');logger[_0x0258('0x11')](_0x0258('0x12'),_0x14b43e,_0x0258('0x13'),JSON[_0x0258('0x14')](_0x166c24));if(_0x166c24[_0x0258('0x15')]){if(_0x166c24[_0x0258('0x15')][_0x0258('0x16')]===0x1f4){logger[_0x0258('0x15')]('FaxQueue,\x20%s,\x20%s',_0x14b43e,_0x166c24[_0x0258('0x15')]['message']);return _0x12830f(_0x166c24[_0x0258('0x15')][_0x0258('0x17')]);}logger['error'](_0x0258('0x10'),_0x14b43e,_0x166c24[_0x0258('0x15')][_0x0258('0x17')]);return _0x34353c(_0x166c24[_0x0258('0x15')][_0x0258('0x17')]);}else{logger[_0x0258('0xf')](_0x0258('0x10'),_0x14b43e,_0x0258('0x13'));_0x34353c(_0x166c24[_0x0258('0x18')][_0x0258('0x17')]);}})['catch'](function(_0x4cc7bd){logger['error'](_0x0258('0x10'),_0x14b43e,_0x4cc7bd);_0x12830f(_0x4cc7bd);});});}exports['GetFaxQueue']=function(_0x2dba07){var _0x22cc2e=this;return new Promise(function(_0x1b0262,_0x48cf16){return db[_0x0258('0x19')][_0x0258('0x1a')]({'raw':_0x2dba07[_0x0258('0x1b')]?_0x2dba07[_0x0258('0x1b')][_0x0258('0x1c')]===undefined?!![]:![]:!![],'where':_0x2dba07[_0x0258('0x1b')]?_0x2dba07[_0x0258('0x1b')][_0x0258('0x1d')]||null:null,'attributes':_0x2dba07['options']?_0x2dba07[_0x0258('0x1b')][_0x0258('0x1e')]||null:null,'limit':_0x2dba07[_0x0258('0x1b')]?_0x2dba07[_0x0258('0x1b')][_0x0258('0x1f')]||null:null,'include':_0x2dba07[_0x0258('0x1b')]?_0x2dba07[_0x0258('0x1b')][_0x0258('0x20')]?_[_0x0258('0x21')](_0x2dba07['options'][_0x0258('0x20')],function(_0x45a8c3){return{'model':db[_0x45a8c3[_0x0258('0x22')]],'as':_0x45a8c3['as'],'attributes':_0x45a8c3[_0x0258('0x1e')],'include':_0x45a8c3['include']?_[_0x0258('0x21')](_0x45a8c3[_0x0258('0x20')],function(_0x10fc49){return{'model':db[_0x10fc49[_0x0258('0x22')]],'as':_0x10fc49['as'],'attributes':_0x10fc49[_0x0258('0x1e')],'include':_0x10fc49[_0x0258('0x20')]?_[_0x0258('0x21')](_0x10fc49['include'],function(_0x40fab2){return{'model':db[_0x40fab2[_0x0258('0x22')]],'as':_0x40fab2['as'],'attributes':_0x40fab2[_0x0258('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0258('0x23')](function(_0x314da5){logger[_0x0258('0xf')](_0x0258('0x24'),_0x2dba07);logger[_0x0258('0x11')]('GetFaxQueue',_0x2dba07,JSON['stringify'](_0x314da5));_0x1b0262(_0x314da5);})[_0x0258('0x25')](function(_0x1a77d4){logger[_0x0258('0x15')](_0x0258('0x24'),_0x1a77d4[_0x0258('0x17')],_0x2dba07);_0x48cf16(_0x22cc2e[_0x0258('0x15')](0x1f4,_0x1a77d4[_0x0258('0x17')]));});});};exports[_0x0258('0x26')]=function(_0x5c9b5c){var _0x4ed1c9=this;return new Promise(function(_0x364995,_0x1d08a4){return db['FaxQueue'][_0x0258('0x27')]({'raw':_0x5c9b5c[_0x0258('0x1b')]?_0x5c9b5c[_0x0258('0x1b')][_0x0258('0x1c')]===undefined?!![]:![]:!![],'where':_0x5c9b5c[_0x0258('0x1b')]?_0x5c9b5c['options'][_0x0258('0x1d')]||null:null,'attributes':_0x5c9b5c[_0x0258('0x1b')]?_0x5c9b5c['options'][_0x0258('0x1e')]||null:null,'include':_0x5c9b5c[_0x0258('0x1b')]?_0x5c9b5c[_0x0258('0x1b')][_0x0258('0x20')]?_[_0x0258('0x21')](_0x5c9b5c[_0x0258('0x1b')][_0x0258('0x20')],function(_0x491932){return{'model':db[_0x491932[_0x0258('0x22')]],'as':_0x491932['as'],'attributes':_0x491932[_0x0258('0x1e')],'include':_0x491932[_0x0258('0x20')]?_[_0x0258('0x21')](_0x491932[_0x0258('0x20')],function(_0x4c31ff){return{'model':db[_0x4c31ff['model']],'as':_0x4c31ff['as'],'attributes':_0x4c31ff[_0x0258('0x1e')],'include':_0x4c31ff[_0x0258('0x20')]?_[_0x0258('0x21')](_0x4c31ff[_0x0258('0x20')],function(_0x3ea3df){return{'model':db[_0x3ea3df[_0x0258('0x22')]],'as':_0x3ea3df['as'],'attributes':_0x3ea3df[_0x0258('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0258('0x23')](function(_0x20b4dd){logger['info']('ShowFaxQueue',_0x5c9b5c);logger[_0x0258('0x11')](_0x0258('0x26'),_0x5c9b5c,JSON[_0x0258('0x14')](_0x20b4dd));_0x364995(_0x20b4dd);})[_0x0258('0x25')](function(_0x22ab05){logger[_0x0258('0x15')]('ShowFaxQueue',_0x22ab05[_0x0258('0x17')],_0x5c9b5c);_0x1d08a4(_0x4ed1c9[_0x0258('0x15')](0x1f4,_0x22ab05[_0x0258('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index dcfd9b0..f5c0ce6 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 _0x3bd7=['length','faxQueue:','./faxQueue.events','save','remove','removeListener','register'];(function(_0x4accf5,_0x5975fa){var _0x2819e9=function(_0x4d3aa0){while(--_0x4d3aa0){_0x4accf5['push'](_0x4accf5['shift']());}};_0x2819e9(++_0x5975fa);}(_0x3bd7,0x167));var _0x73bd=function(_0x445c98,_0x132bf7){_0x445c98=_0x445c98-0x0;var _0x2fe913=_0x3bd7[_0x445c98];return _0x2fe913;};'use strict';var FaxQueueEvents=require(_0x73bd('0x0'));var events=[_0x73bd('0x1'),_0x73bd('0x2'),'update'];function createListener(_0x235cfb,_0xd618ea){return function(_0x9d397c){_0xd618ea['emit'](_0x235cfb,_0x9d397c);};}function removeListener(_0x288143,_0x2f3e29){return function(){FaxQueueEvents[_0x73bd('0x3')](_0x288143,_0x2f3e29);};}exports[_0x73bd('0x4')]=function(_0x8897c2){for(var _0x1efc81=0x0,_0x5051a9=events[_0x73bd('0x5')];_0x1efc81<_0x5051a9;_0x1efc81++){var _0xca398e=events[_0x1efc81];var _0x52f078=createListener(_0x73bd('0x6')+_0xca398e,_0x8897c2);FaxQueueEvents['on'](_0xca398e,_0x52f078);}}; \ No newline at end of file +var _0xa7af=['remove','update','emit','removeListener','register','faxQueue:','./faxQueue.events','save'];(function(_0x18fb82,_0x24cc8e){var _0x43ffbf=function(_0x362163){while(--_0x362163){_0x18fb82['push'](_0x18fb82['shift']());}};_0x43ffbf(++_0x24cc8e);}(_0xa7af,0x13e));var _0xfa7a=function(_0x148a63,_0x3c1877){_0x148a63=_0x148a63-0x0;var _0x4694fa=_0xa7af[_0x148a63];return _0x4694fa;};'use strict';var FaxQueueEvents=require(_0xfa7a('0x0'));var events=[_0xfa7a('0x1'),_0xfa7a('0x2'),_0xfa7a('0x3')];function createListener(_0x243e71,_0x4f3e90){return function(_0x30abf8){_0x4f3e90[_0xfa7a('0x4')](_0x243e71,_0x30abf8);};}function removeListener(_0x109bce,_0x38f167){return function(){FaxQueueEvents[_0xfa7a('0x5')](_0x109bce,_0x38f167);};}exports[_0xfa7a('0x6')]=function(_0x5401e0){for(var _0x5d6eef=0x0,_0x4f4b05=events['length'];_0x5d6eef<_0x4f4b05;_0x5d6eef++){var _0x4f7eff=events[_0x5d6eef];var _0x46fbcf=createListener(_0xfa7a('0x7')+_0x4f7eff,_0x5401e0);FaxQueueEvents['on'](_0x4f7eff,_0x46fbcf);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 131c665..1e304cf 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 _0x9536=['put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents'];(function(_0x4ec59d,_0x48f165){var _0x1d128a=function(_0x589a8b){while(--_0x589a8b){_0x4ec59d['push'](_0x4ec59d['shift']());}};_0x1d128a(++_0x48f165);}(_0x9536,0x179));var _0x6953=function(_0x14a0a0,_0x45d0cf){_0x14a0a0=_0x14a0a0-0x0;var _0x56b651=_0x9536[_0x14a0a0];return _0x56b651;};'use strict';var multer=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var path=require(_0x6953('0x2'));var timeout=require(_0x6953('0x3'));var express=require('express');var router=express[_0x6953('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6953('0x5'));var interaction=require(_0x6953('0x6'));var config=require(_0x6953('0x7'));var controller=require(_0x6953('0x8'));router[_0x6953('0x9')]('/',auth['isAuthenticated'](),controller[_0x6953('0xa')]);router[_0x6953('0x9')](_0x6953('0xb'),auth[_0x6953('0xc')](),controller[_0x6953('0xd')]);router['get'](_0x6953('0xe'),auth[_0x6953('0xc')](),controller[_0x6953('0xf')]);router['get'](_0x6953('0x10'),auth[_0x6953('0xc')](),controller[_0x6953('0x11')]);router[_0x6953('0x9')](_0x6953('0x12'),auth[_0x6953('0xc')](),controller[_0x6953('0x13')]);router[_0x6953('0x9')](_0x6953('0x14'),auth['isAuthenticated'](),controller[_0x6953('0x15')]);router['post']('/',auth[_0x6953('0xc')](),controller[_0x6953('0x16')]);router[_0x6953('0x17')](_0x6953('0x12'),auth[_0x6953('0xc')](),controller[_0x6953('0x18')]);router[_0x6953('0x17')](_0x6953('0x14'),auth[_0x6953('0xc')](),controller[_0x6953('0x19')]);router[_0x6953('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x6953('0x1b')]);router[_0x6953('0x1c')](_0x6953('0xe'),auth[_0x6953('0xc')](),controller['destroy']);router[_0x6953('0x1c')](_0x6953('0x12'),auth['isAuthenticated'](),controller[_0x6953('0x1d')]);router[_0x6953('0x1c')](_0x6953('0x14'),auth[_0x6953('0xc')](),controller[_0x6953('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xa9fc=['create','addTeams','addAgents','update','destroy','removeTeams','delete','/:id/users','removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','index','/describe','isAuthenticated','describe','get','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0xa9fc,0x19f));var _0xca9f=function(_0xc69f39,_0x2ce0cf){_0xc69f39=_0xc69f39-0x0;var _0x93be41=_0xa9fc[_0xc69f39];return _0x93be41;};'use strict';var multer=require(_0xca9f('0x0'));var util=require(_0xca9f('0x1'));var path=require(_0xca9f('0x2'));var timeout=require(_0xca9f('0x3'));var express=require(_0xca9f('0x4'));var router=express['Router']();var fs_extra=require(_0xca9f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xca9f('0x6'));var config=require(_0xca9f('0x7'));var controller=require('./faxQueue.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xca9f('0x8')]);router['get'](_0xca9f('0x9'),auth[_0xca9f('0xa')](),controller[_0xca9f('0xb')]);router[_0xca9f('0xc')](_0xca9f('0xd'),auth[_0xca9f('0xa')](),controller[_0xca9f('0xe')]);router[_0xca9f('0xc')]('/:id/members',auth[_0xca9f('0xa')](),controller[_0xca9f('0xf')]);router[_0xca9f('0xc')](_0xca9f('0x10'),auth['isAuthenticated'](),controller[_0xca9f('0x11')]);router[_0xca9f('0xc')]('/:id/users',auth[_0xca9f('0xa')](),controller[_0xca9f('0x12')]);router[_0xca9f('0x13')]('/',auth[_0xca9f('0xa')](),controller[_0xca9f('0x14')]);router[_0xca9f('0x13')](_0xca9f('0x10'),auth[_0xca9f('0xa')](),controller[_0xca9f('0x15')]);router[_0xca9f('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0xca9f('0x16')]);router['put']('/:id',auth[_0xca9f('0xa')](),controller[_0xca9f('0x17')]);router['delete'](_0xca9f('0xd'),auth['isAuthenticated'](),controller[_0xca9f('0x18')]);router['delete'](_0xca9f('0x10'),auth[_0xca9f('0xa')](),controller[_0xca9f('0x19')]);router[_0xca9f('0x1a')](_0xca9f('0x1b'),auth['isAuthenticated'](),controller[_0xca9f('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 6b3e6f2..13daad9 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 _0xd540=['STRING','sequelize','exports'];(function(_0x33e217,_0x199681){var _0x5d32ba=function(_0x1c3465){while(--_0x1c3465){_0x33e217['push'](_0x33e217['shift']());}};_0x5d32ba(++_0x199681);}(_0xd540,0x124));var _0x0d54=function(_0x2f62b9,_0x86e6aa){_0x2f62b9=_0x2f62b9-0x0;var _0x4c42df=_0xd540[_0x2f62b9];return _0x4c42df;};'use strict';var moment=require('moment');var Sequelize=require(_0x0d54('0x0'));module[_0x0d54('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x0d54('0x2')]}}; \ No newline at end of file +var _0x62b8=['exports','STRING','DATE','moment'];(function(_0x2efb60,_0xd14bd9){var _0x3992dc=function(_0x2b161e){while(--_0x2b161e){_0x2efb60['push'](_0x2efb60['shift']());}};_0x3992dc(++_0xd14bd9);}(_0x62b8,0xd3));var _0x862b=function(_0x879e31,_0x139d02){_0x879e31=_0x879e31-0x0;var _0x3467e8=_0x62b8[_0x879e31];return _0x3467e8;};'use strict';var moment=require(_0x862b('0x0'));var Sequelize=require('sequelize');module[_0x862b('0x1')]={'uniqueid':{'type':Sequelize[_0x862b('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x862b('0x3')]},'leaveAt':{'type':Sequelize[_0x862b('0x3')]},'acceptAt':{'type':Sequelize[_0x862b('0x3')]},'exitAt':{'type':Sequelize[_0x862b('0x3')]},'reason':{'type':Sequelize[_0x862b('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index a28606f..8e5414a 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 _0x3657=['request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','send','FaxQueueReport','rawAttributes','fieldName','type','key','model','map','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir'];(function(_0x5801e6,_0x41cd69){var _0x4b03b6=function(_0x2aa098){while(--_0x2aa098){_0x5801e6['push'](_0x5801e6['shift']());}};_0x4b03b6(++_0x41cd69);}(_0x3657,0x183));var _0x7365=function(_0x77d286,_0x1ddc6d){_0x77d286=_0x77d286-0x0;var _0x5446a5=_0x3657[_0x77d286];return _0x5446a5;};'use strict';var emlformat=require(_0x7365('0x0'));var rimraf=require(_0x7365('0x1'));var zipdir=require(_0x7365('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7365('0x3'));var moment=require(_0x7365('0x4'));var BPromise=require(_0x7365('0x5'));var Mustache=require(_0x7365('0x6'));var util=require('util');var path=require(_0x7365('0x7'));var sox=require(_0x7365('0x8'));var csv=require(_0x7365('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7365('0xa'));var _=require(_0x7365('0xb'));var squel=require(_0x7365('0xc'));var crypto=require('crypto');var jsforce=require(_0x7365('0xd'));var deskjs=require(_0x7365('0xe'));var toCsv=require(_0x7365('0x9'));var querystring=require('querystring');var Papa=require(_0x7365('0xf'));var Redis=require(_0x7365('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7365('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7365('0x12'));var logger=require(_0x7365('0x13'))(_0x7365('0x14'));var utils=require('../../config/utils');var config=require(_0x7365('0x15'));var licenseUtil=require(_0x7365('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1179b8,_0x33b248){_0x33b248=_0x33b248||0xcc;return function(_0x30c2a1){if(_0x30c2a1){return _0x1179b8[_0x7365('0x17')](_0x33b248);}return _0x1179b8[_0x7365('0x18')](_0x33b248)['end']();};}function respondWithResult(_0x2ba19c,_0x52f309){_0x52f309=_0x52f309||0xc8;return function(_0x39faaf){if(_0x39faaf){return _0x2ba19c['status'](_0x52f309)['json'](_0x39faaf);}};}function respondWithFilteredResult(_0xf753a3,_0x21548f){return function(_0x26cf47){if(_0x26cf47){var _0xb73d63=typeof _0x21548f[_0x7365('0x19')]==='undefined'&&typeof _0x21548f['limit']===_0x7365('0x1a');var _0x32980a=_0x26cf47['count'];var _0x337e7f=_0xb73d63?0x0:_0x21548f[_0x7365('0x19')];var _0x30dfe9=_0xb73d63?_0x26cf47[_0x7365('0x1b')]:_0x21548f[_0x7365('0x19')]+_0x21548f[_0x7365('0x1c')];var _0x3f52aa;if(_0x30dfe9>=_0x32980a){_0x30dfe9=_0x32980a;_0x3f52aa=0xc8;}else{_0x3f52aa=0xce;}_0xf753a3[_0x7365('0x18')](_0x3f52aa);return _0xf753a3[_0x7365('0x1d')](_0x7365('0x1e'),_0x337e7f+'-'+_0x30dfe9+'/'+_0x32980a)[_0x7365('0x1f')](_0x26cf47);}return null;};}function patchUpdates(_0x463d01){return function(_0x3d9027){try{jsonpatch[_0x7365('0x20')](_0x3d9027,_0x463d01,!![]);}catch(_0x3434bf){return BPromise[_0x7365('0x21')](_0x3434bf);}return _0x3d9027[_0x7365('0x22')]();};}function saveUpdates(_0x577bc3,_0x5da4fb){return function(_0x3c3571){if(_0x3c3571){return _0x3c3571[_0x7365('0x23')](_0x577bc3)[_0x7365('0x24')](function(_0x45cfe1){return _0x45cfe1;});}return null;};}function removeEntity(_0x43670f,_0x431fa1){return function(_0x582b65){if(_0x582b65){return _0x582b65[_0x7365('0x25')]()[_0x7365('0x24')](function(){_0x43670f[_0x7365('0x18')](0xcc)[_0x7365('0x26')]();});}};}function handleEntityNotFound(_0x680d5b,_0x4dcd6b){return function(_0xc7f5fa){if(!_0xc7f5fa){_0x680d5b[_0x7365('0x17')](0x194);}return _0xc7f5fa;};}function handleError(_0x36669d,_0x353fcb){_0x353fcb=_0x353fcb||0x1f4;return function(_0x4f9bd3){logger[_0x7365('0x27')](_0x4f9bd3[_0x7365('0x28')]);if(_0x4f9bd3['name']){delete _0x4f9bd3['name'];}_0x36669d[_0x7365('0x18')](_0x353fcb)[_0x7365('0x29')](_0x4f9bd3);};}exports['index']=function(_0x3d1e72,_0x53f45e){var _0x1a8b9a={},_0x53a97d={},_0x53bc37={'count':0x0,'rows':[]};var _0x3e986a=_['map'](db[_0x7365('0x2a')][_0x7365('0x2b')],function(_0x29277b){return{'name':_0x29277b[_0x7365('0x2c')],'type':_0x29277b[_0x7365('0x2d')][_0x7365('0x2e')]};});_0x53a97d[_0x7365('0x2f')]=_[_0x7365('0x30')](_0x3e986a,_0x7365('0x31'));_0x53a97d[_0x7365('0x32')]=_[_0x7365('0x33')](_0x3d1e72[_0x7365('0x32')]);_0x53a97d['filters']=_[_0x7365('0x34')](_0x53a97d['model'],_0x53a97d[_0x7365('0x32')]);_0x1a8b9a[_0x7365('0x35')]=_[_0x7365('0x34')](_0x53a97d['model'],qs['fields'](_0x3d1e72['query'][_0x7365('0x36')]));_0x1a8b9a[_0x7365('0x35')]=_0x1a8b9a[_0x7365('0x35')][_0x7365('0x37')]?_0x1a8b9a[_0x7365('0x35')]:_0x53a97d[_0x7365('0x2f')];if(!_0x3d1e72['query'][_0x7365('0x38')](_0x7365('0x39'))){_0x1a8b9a[_0x7365('0x1c')]=qs['limit'](_0x3d1e72['query']['limit']);_0x1a8b9a[_0x7365('0x19')]=qs[_0x7365('0x19')](_0x3d1e72[_0x7365('0x32')][_0x7365('0x19')]);}_0x1a8b9a[_0x7365('0x3a')]=qs[_0x7365('0x3b')](_0x3d1e72[_0x7365('0x32')][_0x7365('0x3b')]);_0x1a8b9a[_0x7365('0x3c')]=qs[_0x7365('0x3d')](_[_0x7365('0x3e')](_0x3d1e72['query'],_0x53a97d['filters']),_0x3e986a);if(_0x3d1e72[_0x7365('0x32')]['filter']){_0x1a8b9a[_0x7365('0x3c')]=_[_0x7365('0x3f')](_0x1a8b9a['where'],{'$or':_[_0x7365('0x30')](_0x3e986a,function(_0x511ddd){if(_0x511ddd[_0x7365('0x2d')]!==_0x7365('0x40')){var _0x3329be={};_0x3329be[_0x511ddd[_0x7365('0x31')]]={'$like':'%'+_0x3d1e72[_0x7365('0x32')][_0x7365('0x41')]+'%'};return _0x3329be;}})});}_0x1a8b9a=_[_0x7365('0x3f')]({},_0x1a8b9a,_0x3d1e72[_0x7365('0x42')]);var _0x1c4570={'where':_0x1a8b9a[_0x7365('0x3c')]};return db['FaxQueueReport'][_0x7365('0x1b')](_0x1c4570)['then'](function(_0x5cb584){_0x53bc37[_0x7365('0x1b')]=_0x5cb584;if(_0x3d1e72[_0x7365('0x32')][_0x7365('0x43')]){_0x1a8b9a[_0x7365('0x44')]=[{'all':!![]}];}return db[_0x7365('0x2a')][_0x7365('0x45')](_0x1a8b9a);})[_0x7365('0x24')](function(_0x4e646e){_0x53bc37[_0x7365('0x46')]=_0x4e646e;return _0x53bc37;})[_0x7365('0x24')](respondWithFilteredResult(_0x53f45e,_0x1a8b9a))[_0x7365('0x47')](handleError(_0x53f45e,null));};exports[_0x7365('0x48')]=function(_0x103fe1,_0x10dec3){var _0x276d3b={'raw':!![],'where':{'id':_0x103fe1[_0x7365('0x49')]['id']}},_0x3276c8={};_0x3276c8[_0x7365('0x2f')]=_[_0x7365('0x33')](db['FaxQueueReport']['rawAttributes']);_0x3276c8['query']=_[_0x7365('0x33')](_0x103fe1[_0x7365('0x32')]);_0x3276c8[_0x7365('0x3d')]=_[_0x7365('0x34')](_0x3276c8[_0x7365('0x2f')],_0x3276c8[_0x7365('0x32')]);_0x276d3b[_0x7365('0x35')]=_['intersection'](_0x3276c8[_0x7365('0x2f')],qs[_0x7365('0x36')](_0x103fe1['query'][_0x7365('0x36')]));_0x276d3b['attributes']=_0x276d3b['attributes'][_0x7365('0x37')]?_0x276d3b[_0x7365('0x35')]:_0x3276c8[_0x7365('0x2f')];if(_0x103fe1[_0x7365('0x32')]['includeAll']){_0x276d3b[_0x7365('0x44')]=[{'all':!![]}];}_0x276d3b=_[_0x7365('0x3f')]({},_0x276d3b,_0x103fe1[_0x7365('0x42')]);return db[_0x7365('0x2a')][_0x7365('0x4a')](_0x276d3b)[_0x7365('0x24')](handleEntityNotFound(_0x10dec3,null))['then'](respondWithResult(_0x10dec3,null))['catch'](handleError(_0x10dec3,null));};exports[_0x7365('0x4b')]=function(_0x40bb20,_0x5a327b){return db['FaxQueueReport'][_0x7365('0x4b')](_0x40bb20[_0x7365('0x4c')],{})[_0x7365('0x24')](respondWithResult(_0x5a327b,0xc9))[_0x7365('0x47')](handleError(_0x5a327b,null));};exports[_0x7365('0x23')]=function(_0x4333a9,_0x4543af){if(_0x4333a9['body']['id']){delete _0x4333a9[_0x7365('0x4c')]['id'];}return db[_0x7365('0x2a')][_0x7365('0x4a')]({'where':{'id':_0x4333a9[_0x7365('0x49')]['id']}})[_0x7365('0x24')](handleEntityNotFound(_0x4543af,null))[_0x7365('0x24')](saveUpdates(_0x4333a9['body'],null))[_0x7365('0x24')](respondWithResult(_0x4543af,null))[_0x7365('0x47')](handleError(_0x4543af,null));};exports[_0x7365('0x25')]=function(_0x38e9ff,_0x3c164a){return db['FaxQueueReport']['find']({'where':{'id':_0x38e9ff[_0x7365('0x49')]['id']}})[_0x7365('0x24')](handleEntityNotFound(_0x3c164a,null))[_0x7365('0x24')](removeEntity(_0x3c164a,null))['catch'](handleError(_0x3c164a,null));};exports[_0x7365('0x4d')]=function(_0xb4f90f,_0x94943f){return db[_0x7365('0x2a')]['describe']()[_0x7365('0x24')](respondWithResult(_0x94943f,null))[_0x7365('0x47')](handleError(_0x94943f,null));}; \ No newline at end of file +var _0x74b1=['send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','filter','options','include','findAll','rows','catch','show','includeAll','create','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','squel','crypto','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','stack','name'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x74b1,0xb5));var _0x174b=function(_0x30f07a,_0x98341){_0x30f07a=_0x30f07a-0x0;var _0xb38461=_0x74b1[_0x30f07a];return _0xb38461;};'use strict';var emlformat=require(_0x174b('0x0'));var rimraf=require(_0x174b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x174b('0x2'));var rp=require(_0x174b('0x3'));var moment=require('moment');var BPromise=require(_0x174b('0x4'));var Mustache=require(_0x174b('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x174b('0x6'));var ejs=require(_0x174b('0x7'));var fs=require('fs');var fs_extra=require(_0x174b('0x8'));var _=require('lodash');var squel=require(_0x174b('0x9'));var crypto=require(_0x174b('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x174b('0x6'));var querystring=require('querystring');var Papa=require(_0x174b('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x174b('0xc'));var as=require(_0x174b('0xd'));var hardwareService=require(_0x174b('0xe'));var logger=require(_0x174b('0xf'))(_0x174b('0x10'));var utils=require(_0x174b('0x11'));var config=require(_0x174b('0x12'));var licenseUtil=require(_0x174b('0x13'));var db=require(_0x174b('0x14'))['db'];function respondWithStatusCode(_0x4ea947,_0x70fa85){_0x70fa85=_0x70fa85||0xcc;return function(_0xc996e){if(_0xc996e){return _0x4ea947[_0x174b('0x15')](_0x70fa85);}return _0x4ea947[_0x174b('0x16')](_0x70fa85)[_0x174b('0x17')]();};}function respondWithResult(_0x44b778,_0xe9c224){_0xe9c224=_0xe9c224||0xc8;return function(_0x43143b){if(_0x43143b){return _0x44b778[_0x174b('0x16')](_0xe9c224)['json'](_0x43143b);}};}function respondWithFilteredResult(_0x1c5579,_0xde8235){return function(_0x210a3c){if(_0x210a3c){var _0x4a7aeb=typeof _0xde8235['offset']===_0x174b('0x18')&&typeof _0xde8235[_0x174b('0x19')]===_0x174b('0x18');var _0x209dd4=_0x210a3c[_0x174b('0x1a')];var _0x31f801=_0x4a7aeb?0x0:_0xde8235['offset'];var _0x1049dc=_0x4a7aeb?_0x210a3c[_0x174b('0x1a')]:_0xde8235[_0x174b('0x1b')]+_0xde8235[_0x174b('0x19')];var _0x2bef75;if(_0x1049dc>=_0x209dd4){_0x1049dc=_0x209dd4;_0x2bef75=0xc8;}else{_0x2bef75=0xce;}_0x1c5579[_0x174b('0x16')](_0x2bef75);return _0x1c5579[_0x174b('0x1c')](_0x174b('0x1d'),_0x31f801+'-'+_0x1049dc+'/'+_0x209dd4)[_0x174b('0x1e')](_0x210a3c);}return null;};}function patchUpdates(_0x1458a1){return function(_0x4e58f0){try{jsonpatch[_0x174b('0x1f')](_0x4e58f0,_0x1458a1,!![]);}catch(_0x49d32e){return BPromise['reject'](_0x49d32e);}return _0x4e58f0[_0x174b('0x20')]();};}function saveUpdates(_0x568b3f,_0x537ac3){return function(_0x2c09ad){if(_0x2c09ad){return _0x2c09ad[_0x174b('0x21')](_0x568b3f)[_0x174b('0x22')](function(_0x55f2ac){return _0x55f2ac;});}return null;};}function removeEntity(_0x150304,_0x4da1da){return function(_0x3b57c5){if(_0x3b57c5){return _0x3b57c5[_0x174b('0x23')]()[_0x174b('0x22')](function(){_0x150304[_0x174b('0x16')](0xcc)[_0x174b('0x17')]();});}};}function handleEntityNotFound(_0x242295,_0x487929){return function(_0x493561){if(!_0x493561){_0x242295[_0x174b('0x15')](0x194);}return _0x493561;};}function handleError(_0x17161c,_0x7c34f1){_0x7c34f1=_0x7c34f1||0x1f4;return function(_0x10507d){logger['error'](_0x10507d[_0x174b('0x24')]);if(_0x10507d[_0x174b('0x25')]){delete _0x10507d['name'];}_0x17161c[_0x174b('0x16')](_0x7c34f1)[_0x174b('0x26')](_0x10507d);};}exports[_0x174b('0x27')]=function(_0x50f947,_0x28ffef){var _0x2aea81={},_0x557d62={},_0x2c6189={'count':0x0,'rows':[]};var _0x555dc1=_[_0x174b('0x28')](db[_0x174b('0x29')][_0x174b('0x2a')],function(_0x3e6fb0){return{'name':_0x3e6fb0[_0x174b('0x2b')],'type':_0x3e6fb0[_0x174b('0x2c')][_0x174b('0x2d')]};});_0x557d62[_0x174b('0x2e')]=_[_0x174b('0x28')](_0x555dc1,'name');_0x557d62[_0x174b('0x2f')]=_[_0x174b('0x30')](_0x50f947[_0x174b('0x2f')]);_0x557d62['filters']=_[_0x174b('0x31')](_0x557d62['model'],_0x557d62['query']);_0x2aea81[_0x174b('0x32')]=_[_0x174b('0x31')](_0x557d62[_0x174b('0x2e')],qs[_0x174b('0x33')](_0x50f947['query'][_0x174b('0x33')]));_0x2aea81[_0x174b('0x32')]=_0x2aea81[_0x174b('0x32')][_0x174b('0x34')]?_0x2aea81[_0x174b('0x32')]:_0x557d62[_0x174b('0x2e')];if(!_0x50f947[_0x174b('0x2f')]['hasOwnProperty'](_0x174b('0x35'))){_0x2aea81['limit']=qs['limit'](_0x50f947[_0x174b('0x2f')][_0x174b('0x19')]);_0x2aea81[_0x174b('0x1b')]=qs[_0x174b('0x1b')](_0x50f947[_0x174b('0x2f')]['offset']);}_0x2aea81[_0x174b('0x36')]=qs[_0x174b('0x37')](_0x50f947[_0x174b('0x2f')][_0x174b('0x37')]);_0x2aea81[_0x174b('0x38')]=qs[_0x174b('0x39')](_[_0x174b('0x3a')](_0x50f947[_0x174b('0x2f')],_0x557d62[_0x174b('0x39')]),_0x555dc1);if(_0x50f947['query']['filter']){_0x2aea81[_0x174b('0x38')]=_[_0x174b('0x3b')](_0x2aea81[_0x174b('0x38')],{'$or':_[_0x174b('0x28')](_0x555dc1,function(_0xd0a6c4){if(_0xd0a6c4['type']!=='VIRTUAL'){var _0x1d37c6={};_0x1d37c6[_0xd0a6c4[_0x174b('0x25')]]={'$like':'%'+_0x50f947['query'][_0x174b('0x3c')]+'%'};return _0x1d37c6;}})});}_0x2aea81=_[_0x174b('0x3b')]({},_0x2aea81,_0x50f947[_0x174b('0x3d')]);var _0x3a5aaf={'where':_0x2aea81[_0x174b('0x38')]};return db[_0x174b('0x29')]['count'](_0x3a5aaf)['then'](function(_0x3caeab){_0x2c6189[_0x174b('0x1a')]=_0x3caeab;if(_0x50f947[_0x174b('0x2f')]['includeAll']){_0x2aea81[_0x174b('0x3e')]=[{'all':!![]}];}return db[_0x174b('0x29')][_0x174b('0x3f')](_0x2aea81);})[_0x174b('0x22')](function(_0x1d1d2b){_0x2c6189[_0x174b('0x40')]=_0x1d1d2b;return _0x2c6189;})[_0x174b('0x22')](respondWithFilteredResult(_0x28ffef,_0x2aea81))[_0x174b('0x41')](handleError(_0x28ffef,null));};exports[_0x174b('0x42')]=function(_0x41991d,_0x4f2c68){var _0x22097a={'raw':!![],'where':{'id':_0x41991d['params']['id']}},_0xf9dd00={};_0xf9dd00[_0x174b('0x2e')]=_['keys'](db[_0x174b('0x29')][_0x174b('0x2a')]);_0xf9dd00[_0x174b('0x2f')]=_['keys'](_0x41991d[_0x174b('0x2f')]);_0xf9dd00[_0x174b('0x39')]=_['intersection'](_0xf9dd00['model'],_0xf9dd00[_0x174b('0x2f')]);_0x22097a[_0x174b('0x32')]=_['intersection'](_0xf9dd00['model'],qs[_0x174b('0x33')](_0x41991d[_0x174b('0x2f')][_0x174b('0x33')]));_0x22097a[_0x174b('0x32')]=_0x22097a['attributes'][_0x174b('0x34')]?_0x22097a['attributes']:_0xf9dd00['model'];if(_0x41991d[_0x174b('0x2f')][_0x174b('0x43')]){_0x22097a[_0x174b('0x3e')]=[{'all':!![]}];}_0x22097a=_['merge']({},_0x22097a,_0x41991d[_0x174b('0x3d')]);return db['FaxQueueReport']['find'](_0x22097a)[_0x174b('0x22')](handleEntityNotFound(_0x4f2c68,null))[_0x174b('0x22')](respondWithResult(_0x4f2c68,null))['catch'](handleError(_0x4f2c68,null));};exports[_0x174b('0x44')]=function(_0x35cf49,_0x3cd6f4){return db[_0x174b('0x29')][_0x174b('0x44')](_0x35cf49[_0x174b('0x45')],{})[_0x174b('0x22')](respondWithResult(_0x3cd6f4,0xc9))[_0x174b('0x41')](handleError(_0x3cd6f4,null));};exports[_0x174b('0x21')]=function(_0x565ad0,_0x4cd165){if(_0x565ad0['body']['id']){delete _0x565ad0[_0x174b('0x45')]['id'];}return db[_0x174b('0x29')][_0x174b('0x46')]({'where':{'id':_0x565ad0[_0x174b('0x47')]['id']}})[_0x174b('0x22')](handleEntityNotFound(_0x4cd165,null))[_0x174b('0x22')](saveUpdates(_0x565ad0['body'],null))['then'](respondWithResult(_0x4cd165,null))[_0x174b('0x41')](handleError(_0x4cd165,null));};exports[_0x174b('0x23')]=function(_0x41d309,_0x102531){return db[_0x174b('0x29')][_0x174b('0x46')]({'where':{'id':_0x41d309[_0x174b('0x47')]['id']}})[_0x174b('0x22')](handleEntityNotFound(_0x102531,null))[_0x174b('0x22')](removeEntity(_0x102531,null))['catch'](handleError(_0x102531,null));};exports[_0x174b('0x48')]=function(_0x140d95,_0x6e217a){return db[_0x174b('0x29')][_0x174b('0x48')]()[_0x174b('0x22')](respondWithResult(_0x6e217a,null))[_0x174b('0x41')](handleError(_0x6e217a,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 908d32b..00e18a9 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 _0xe14b=['bluebird','path','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','moment'];(function(_0x4e5dd8,_0x38045a){var _0x16f71e=function(_0x34298f){while(--_0x34298f){_0x4e5dd8['push'](_0x4e5dd8['shift']());}};_0x16f71e(++_0x38045a);}(_0xe14b,0x93));var _0xbe14=function(_0x452cc3,_0x3bca5c){_0x452cc3=_0x452cc3-0x0;var _0x10bd3e=_0xe14b[_0x452cc3];return _0x10bd3e;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','define','report_fax_queue','uniqueid','util'];(function(_0xebf33a,_0x39ecd3){var _0x2cc7fe=function(_0x5ee9f6){while(--_0x5ee9f6){_0xebf33a['push'](_0xebf33a['shift']());}};_0x2cc7fe(++_0x39ecd3);}(_0x1261,0x144));var _0x1126=function(_0x1c1577,_0x1d4d6d){_0x1c1577=_0x1c1577-0x0;var _0x566d1f=_0x1261[_0x1c1577];return _0x566d1f;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('FaxQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 45afa8e..9c5705d 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 _0x0ac5=['request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','info','catch','FaxQueueReport','options','raw','debug','CreateFaxQueueReport','update','body','where','attributes','UpdateFaxQueueReport','util','moment','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request','then'];(function(_0x34f545,_0x2bd2ee){var _0x1ff6b8=function(_0x582e3b){while(--_0x582e3b){_0x34f545['push'](_0x34f545['shift']());}};_0x1ff6b8(++_0x2bd2ee);}(_0x0ac5,0xf3));var _0x50ac=function(_0x4c670e,_0x5e3606){_0x4c670e=_0x4c670e-0x0;var _0x4a1c21=_0x0ac5[_0x4c670e];return _0x4a1c21;};'use strict';var _=require('lodash');var util=require(_0x50ac('0x0'));var moment=require(_0x50ac('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x50ac('0x2'));var db=require(_0x50ac('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x50ac('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x50ac('0x5'));var client=jayson['client'][_0x50ac('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1eb10f,_0x587749,_0x3488b9){return new BPromise(function(_0x53390f,_0xda8590){return client[_0x50ac('0x7')](_0x1eb10f,_0x3488b9)[_0x50ac('0x8')](function(_0x4fb818){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x587749,_0x50ac('0x9'));logger['debug'](_0x50ac('0xa'),_0x587749,_0x50ac('0x9'),JSON[_0x50ac('0xb')](_0x4fb818));if(_0x4fb818['error']){if(_0x4fb818[_0x50ac('0xc')][_0x50ac('0xd')]===0x1f4){logger[_0x50ac('0xc')](_0x50ac('0xe'),_0x587749,_0x4fb818[_0x50ac('0xc')][_0x50ac('0xf')]);return _0xda8590(_0x4fb818[_0x50ac('0xc')][_0x50ac('0xf')]);}logger[_0x50ac('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x587749,_0x4fb818[_0x50ac('0xc')][_0x50ac('0xf')]);return _0x53390f(_0x4fb818['error'][_0x50ac('0xf')]);}else{logger[_0x50ac('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x587749,_0x50ac('0x9'));_0x53390f(_0x4fb818['result']['message']);}})[_0x50ac('0x11')](function(_0x47d7a0){logger['error'](_0x50ac('0xe'),_0x587749,_0x47d7a0);_0xda8590(_0x47d7a0);});});}exports['CreateFaxQueueReport']=function(_0x4a1707){var _0x3037c8=this;return new Promise(function(_0x5c7f1c,_0x2ddaea){return db[_0x50ac('0x12')]['create'](_0x4a1707['body'],{'raw':_0x4a1707[_0x50ac('0x13')]?_0x4a1707[_0x50ac('0x13')][_0x50ac('0x14')]===undefined?!![]:![]:!![]})['then'](function(_0x1b44f0){logger[_0x50ac('0x10')]('CreateFaxQueueReport',_0x4a1707);logger[_0x50ac('0x15')](_0x50ac('0x16'),_0x4a1707,JSON[_0x50ac('0xb')](_0x1b44f0));_0x5c7f1c(_0x1b44f0);})['catch'](function(_0x1faed9){logger[_0x50ac('0xc')](_0x50ac('0x16'),_0x1faed9['message'],_0x4a1707);_0x2ddaea(_0x3037c8[_0x50ac('0xc')](0x1f4,_0x1faed9['message']));});});};exports['UpdateFaxQueueReport']=function(_0x6e2d89){var _0x41a331=this;return new Promise(function(_0x105a10,_0x576b91){return db['FaxQueueReport'][_0x50ac('0x17')](_0x6e2d89[_0x50ac('0x18')],{'raw':_0x6e2d89[_0x50ac('0x13')]?_0x6e2d89[_0x50ac('0x13')][_0x50ac('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6e2d89['options']?_0x6e2d89[_0x50ac('0x13')][_0x50ac('0x19')]||null:null,'attributes':_0x6e2d89['options']?_0x6e2d89[_0x50ac('0x13')][_0x50ac('0x1a')]||null:null,'limit':_0x6e2d89[_0x50ac('0x13')]?_0x6e2d89[_0x50ac('0x13')]['limit']||null:null})['then'](function(_0x498568){logger[_0x50ac('0x10')](_0x50ac('0x1b'),_0x6e2d89);logger[_0x50ac('0x15')](_0x50ac('0x1b'),_0x6e2d89,JSON['stringify'](_0x498568));_0x105a10(_0x498568);})[_0x50ac('0x11')](function(_0x371a5f){logger[_0x50ac('0xc')](_0x50ac('0x1b'),_0x371a5f['message'],_0x6e2d89);_0x576b91(_0x41a331[_0x50ac('0xc')](0x1f4,_0x371a5f[_0x50ac('0xf')]));});});}; \ No newline at end of file +var _0x4a01=['info','UpdateFaxQueueReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','where','attributes','limit'];(function(_0x4bf793,_0x404922){var _0x55a44b=function(_0xbbc6c0){while(--_0xbbc6c0){_0x4bf793['push'](_0x4bf793['shift']());}};_0x55a44b(++_0x404922);}(_0x4a01,0x1d0));var _0x14a0=function(_0x4d9ad5,_0x32de0b){_0x4d9ad5=_0x4d9ad5-0x0;var _0x587b8f=_0x4a01[_0x4d9ad5];return _0x587b8f;};'use strict';var _=require(_0x14a0('0x0'));var util=require(_0x14a0('0x1'));var moment=require(_0x14a0('0x2'));var BPromise=require(_0x14a0('0x3'));var rs=require(_0x14a0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x14a0('0x5'))['db'];var utils=require(_0x14a0('0x6'));var logger=require(_0x14a0('0x7'))(_0x14a0('0x8'));var config=require(_0x14a0('0x9'));var jayson=require(_0x14a0('0xa'));var client=jayson[_0x14a0('0xb')][_0x14a0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5b352a,_0x28c930,_0x1da412){return new BPromise(function(_0x4bae53,_0x18e9d9){return client['request'](_0x5b352a,_0x1da412)[_0x14a0('0xd')](function(_0x5b58b1){logger['info'](_0x14a0('0xe'),_0x28c930,_0x14a0('0xf'));logger[_0x14a0('0x10')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x28c930,'request\x20sent',JSON[_0x14a0('0x11')](_0x5b58b1));if(_0x5b58b1[_0x14a0('0x12')]){if(_0x5b58b1[_0x14a0('0x12')][_0x14a0('0x13')]===0x1f4){logger[_0x14a0('0x12')](_0x14a0('0xe'),_0x28c930,_0x5b58b1[_0x14a0('0x12')][_0x14a0('0x14')]);return _0x18e9d9(_0x5b58b1[_0x14a0('0x12')][_0x14a0('0x14')]);}logger[_0x14a0('0x12')](_0x14a0('0xe'),_0x28c930,_0x5b58b1[_0x14a0('0x12')]['message']);return _0x4bae53(_0x5b58b1[_0x14a0('0x12')]['message']);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x28c930,_0x14a0('0xf'));_0x4bae53(_0x5b58b1[_0x14a0('0x15')]['message']);}})[_0x14a0('0x16')](function(_0x5239dc){logger[_0x14a0('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x28c930,_0x5239dc);_0x18e9d9(_0x5239dc);});});}exports[_0x14a0('0x17')]=function(_0x497df0){var _0x45286e=this;return new Promise(function(_0x14e9cc,_0x12870d){return db[_0x14a0('0x18')][_0x14a0('0x19')](_0x497df0[_0x14a0('0x1a')],{'raw':_0x497df0[_0x14a0('0x1b')]?_0x497df0[_0x14a0('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x14a0('0xd')](function(_0x3eb70d){logger['info'](_0x14a0('0x17'),_0x497df0);logger['debug'](_0x14a0('0x17'),_0x497df0,JSON['stringify'](_0x3eb70d));_0x14e9cc(_0x3eb70d);})[_0x14a0('0x16')](function(_0x852d12){logger[_0x14a0('0x12')]('CreateFaxQueueReport',_0x852d12[_0x14a0('0x14')],_0x497df0);_0x12870d(_0x45286e[_0x14a0('0x12')](0x1f4,_0x852d12[_0x14a0('0x14')]));});});};exports['UpdateFaxQueueReport']=function(_0x110a79){var _0x1749b0=this;return new Promise(function(_0x53f878,_0x17c675){return db[_0x14a0('0x18')]['update'](_0x110a79[_0x14a0('0x1a')],{'raw':_0x110a79[_0x14a0('0x1b')]?_0x110a79[_0x14a0('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x110a79[_0x14a0('0x1b')]?_0x110a79[_0x14a0('0x1b')][_0x14a0('0x1c')]||null:null,'attributes':_0x110a79[_0x14a0('0x1b')]?_0x110a79[_0x14a0('0x1b')][_0x14a0('0x1d')]||null:null,'limit':_0x110a79['options']?_0x110a79['options'][_0x14a0('0x1e')]||null:null})['then'](function(_0x2fe8f6){logger[_0x14a0('0x1f')](_0x14a0('0x20'),_0x110a79);logger[_0x14a0('0x10')](_0x14a0('0x20'),_0x110a79,JSON[_0x14a0('0x11')](_0x2fe8f6));_0x53f878(_0x2fe8f6);})['catch'](function(_0x4446fc){logger['error']('UpdateFaxQueueReport',_0x4446fc[_0x14a0('0x14')],_0x110a79);_0x17c675(_0x1749b0[_0x14a0('0x12')](0x1f4,_0x4446fc[_0x14a0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 165e821..a277f27 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 _0x4027=['isAuthenticated','/describe','describe','post','create','put','/:id','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get'];(function(_0x13992d,_0x3029ea){var _0x3d15bf=function(_0x3444f7){while(--_0x3444f7){_0x13992d['push'](_0x13992d['shift']());}};_0x3d15bf(++_0x3029ea);}(_0x4027,0x7c));var _0x7402=function(_0x221507,_0x25a1e9){_0x221507=_0x221507-0x0;var _0x5535d2=_0x4027[_0x221507];return _0x5535d2;};'use strict';var multer=require('multer');var util=require(_0x7402('0x0'));var path=require(_0x7402('0x1'));var timeout=require(_0x7402('0x2'));var express=require('express');var router=express[_0x7402('0x3')]();var fs_extra=require(_0x7402('0x4'));var auth=require(_0x7402('0x5'));var interaction=require(_0x7402('0x6'));var config=require('../../config/environment');var controller=require(_0x7402('0x7'));router[_0x7402('0x8')]('/',auth[_0x7402('0x9')](),controller['index']);router[_0x7402('0x8')](_0x7402('0xa'),auth['isAuthenticated'](),controller[_0x7402('0xb')]);router[_0x7402('0x8')]('/:id',auth[_0x7402('0x9')](),controller['show']);router[_0x7402('0xc')]('/',auth[_0x7402('0x9')](),controller[_0x7402('0xd')]);router[_0x7402('0xe')](_0x7402('0xf'),auth[_0x7402('0x9')](),controller[_0x7402('0x10')]);router['delete']('/:id',auth[_0x7402('0x9')](),controller[_0x7402('0x11')]);module[_0x7402('0x12')]=router; \ No newline at end of file +var _0x4e5f=['delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','/:id'];(function(_0x233c6c,_0x3d10fc){var _0x2b9334=function(_0x1eee51){while(--_0x1eee51){_0x233c6c['push'](_0x233c6c['shift']());}};_0x2b9334(++_0x3d10fc);}(_0x4e5f,0x10d));var _0xf4e5=function(_0x27afe4,_0x646a11){_0x27afe4=_0x27afe4-0x0;var _0xab9355=_0x4e5f[_0x27afe4];return _0xab9355;};'use strict';var multer=require(_0xf4e5('0x0'));var util=require('util');var path=require(_0xf4e5('0x1'));var timeout=require('connect-timeout');var express=require(_0xf4e5('0x2'));var router=express[_0xf4e5('0x3')]();var fs_extra=require(_0xf4e5('0x4'));var auth=require(_0xf4e5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf4e5('0x6'));var controller=require(_0xf4e5('0x7'));router[_0xf4e5('0x8')]('/',auth[_0xf4e5('0x9')](),controller[_0xf4e5('0xa')]);router[_0xf4e5('0x8')](_0xf4e5('0xb'),auth[_0xf4e5('0x9')](),controller[_0xf4e5('0xc')]);router[_0xf4e5('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xf4e5('0xd')]);router[_0xf4e5('0xe')]('/',auth[_0xf4e5('0x9')](),controller['create']);router['put'](_0xf4e5('0xf'),auth[_0xf4e5('0x9')](),controller['update']);router[_0xf4e5('0x10')]('/:id',auth[_0xf4e5('0x9')](),controller[_0xf4e5('0x11')]);module[_0xf4e5('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index c326395..699011b 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x48566c,_0x350754){var _0x1a76c8=function(_0x4a64f4){while(--_0x4a64f4){_0x48566c['push'](_0x48566c['shift']());}};_0x1a76c8(++_0x350754);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x14a862,_0x2b559d){_0x14a862=_0x14a862-0x0;var _0x245eb5=_0xcb91[_0x14a862];return _0x245eb5;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x424357,_0x9ebe3e){var _0x29c68e=function(_0x663b5d){while(--_0x663b5d){_0x424357['push'](_0x424357['shift']());}};_0x29c68e(++_0x9ebe3e);}(_0x4b84,0x1cc));var _0x44b8=function(_0x367a3d,_0x452717){_0x367a3d=_0x367a3d-0x0;var _0x460539=_0x4b84[_0x367a3d];return _0x460539;};'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/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 5bb1b2c..6d3e50b 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 _0xc188=['model','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','params','length','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','keys','query','intersection'];(function(_0x477aab,_0x4d08fd){var _0x2cd294=function(_0x4e0c85){while(--_0x4e0c85){_0x477aab['push'](_0x477aab['shift']());}};_0x2cd294(++_0x4d08fd);}(_0xc188,0xb4));var _0x8c18=function(_0x29c425,_0x4cc8aa){_0x29c425=_0x29c425-0x0;var _0xf5e207=_0xc188[_0x29c425];return _0xf5e207;};'use strict';var emlformat=require(_0x8c18('0x0'));var rimraf=require(_0x8c18('0x1'));var zipdir=require(_0x8c18('0x2'));var jsonpatch=require(_0x8c18('0x3'));var rp=require('request-promise');var moment=require(_0x8c18('0x4'));var BPromise=require(_0x8c18('0x5'));var Mustache=require(_0x8c18('0x6'));var util=require(_0x8c18('0x7'));var path=require(_0x8c18('0x8'));var sox=require(_0x8c18('0x9'));var csv=require('to-csv');var ejs=require(_0x8c18('0xa'));var fs=require('fs');var fs_extra=require(_0x8c18('0xb'));var _=require(_0x8c18('0xc'));var squel=require('squel');var crypto=require(_0x8c18('0xd'));var jsforce=require(_0x8c18('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8c18('0xf'));var querystring=require(_0x8c18('0x10'));var Papa=require(_0x8c18('0x11'));var Redis=require(_0x8c18('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8c18('0x13'));var as=require(_0x8c18('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c18('0x15'))(_0x8c18('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8c18('0x17'));var db=require(_0x8c18('0x18'))['db'];function respondWithStatusCode(_0x3093fc,_0x5295aa){_0x5295aa=_0x5295aa||0xcc;return function(_0x15c011){if(_0x15c011){return _0x3093fc[_0x8c18('0x19')](_0x5295aa);}return _0x3093fc[_0x8c18('0x1a')](_0x5295aa)['end']();};}function respondWithResult(_0x12d4d0,_0x509d28){_0x509d28=_0x509d28||0xc8;return function(_0x4b39e0){if(_0x4b39e0){return _0x12d4d0[_0x8c18('0x1a')](_0x509d28)[_0x8c18('0x1b')](_0x4b39e0);}};}function respondWithFilteredResult(_0x4ae9ab,_0x58222f){return function(_0x344822){if(_0x344822){var _0x165c3a=typeof _0x58222f[_0x8c18('0x1c')]===_0x8c18('0x1d')&&typeof _0x58222f['limit']===_0x8c18('0x1d');var _0x53dd98=_0x344822['count'];var _0x2a6005=_0x165c3a?0x0:_0x58222f[_0x8c18('0x1c')];var _0x2e3c37=_0x165c3a?_0x344822[_0x8c18('0x1e')]:_0x58222f[_0x8c18('0x1c')]+_0x58222f['limit'];var _0x4292f5;if(_0x2e3c37>=_0x53dd98){_0x2e3c37=_0x53dd98;_0x4292f5=0xc8;}else{_0x4292f5=0xce;}_0x4ae9ab['status'](_0x4292f5);return _0x4ae9ab[_0x8c18('0x1f')](_0x8c18('0x20'),_0x2a6005+'-'+_0x2e3c37+'/'+_0x53dd98)[_0x8c18('0x1b')](_0x344822);}return null;};}function patchUpdates(_0x4c8987){return function(_0x2cb893){try{jsonpatch[_0x8c18('0x21')](_0x2cb893,_0x4c8987,!![]);}catch(_0x2d4f35){return BPromise[_0x8c18('0x22')](_0x2d4f35);}return _0x2cb893[_0x8c18('0x23')]();};}function saveUpdates(_0x491f23,_0x21cb4e){return function(_0x1ea84e){if(_0x1ea84e){return _0x1ea84e[_0x8c18('0x24')](_0x491f23)[_0x8c18('0x25')](function(_0x3cd6c8){return _0x3cd6c8;});}return null;};}function removeEntity(_0x1b32b1,_0x4d9ee1){return function(_0x10859d){if(_0x10859d){return _0x10859d[_0x8c18('0x26')]()[_0x8c18('0x25')](function(){_0x1b32b1[_0x8c18('0x1a')](0xcc)[_0x8c18('0x27')]();});}};}function handleEntityNotFound(_0x251043,_0xc4a7cf){return function(_0x5b6130){if(!_0x5b6130){_0x251043[_0x8c18('0x19')](0x194);}return _0x5b6130;};}function handleError(_0x91b4e9,_0x149f22){_0x149f22=_0x149f22||0x1f4;return function(_0x2bf802){logger[_0x8c18('0x28')](_0x2bf802[_0x8c18('0x29')]);if(_0x2bf802[_0x8c18('0x2a')]){delete _0x2bf802[_0x8c18('0x2a')];}_0x91b4e9['status'](_0x149f22)[_0x8c18('0x2b')](_0x2bf802);};}exports[_0x8c18('0x2c')]=function(_0x5d9efe,_0x46444d){var _0xcc3437={},_0x18ade7={},_0x13a614={'count':0x0,'rows':[]};var _0x543b3c=_[_0x8c18('0x2d')](db[_0x8c18('0x2e')][_0x8c18('0x2f')],function(_0x5e995a){return{'name':_0x5e995a[_0x8c18('0x30')],'type':_0x5e995a[_0x8c18('0x31')][_0x8c18('0x32')]};});_0x18ade7['model']=_['map'](_0x543b3c,_0x8c18('0x2a'));_0x18ade7['query']=_[_0x8c18('0x33')](_0x5d9efe[_0x8c18('0x34')]);_0x18ade7['filters']=_[_0x8c18('0x35')](_0x18ade7[_0x8c18('0x36')],_0x18ade7[_0x8c18('0x34')]);_0xcc3437[_0x8c18('0x37')]=_[_0x8c18('0x35')](_0x18ade7[_0x8c18('0x36')],qs[_0x8c18('0x38')](_0x5d9efe[_0x8c18('0x34')][_0x8c18('0x38')]));_0xcc3437[_0x8c18('0x37')]=_0xcc3437[_0x8c18('0x37')]['length']?_0xcc3437[_0x8c18('0x37')]:_0x18ade7[_0x8c18('0x36')];if(!_0x5d9efe[_0x8c18('0x34')][_0x8c18('0x39')](_0x8c18('0x3a'))){_0xcc3437[_0x8c18('0x3b')]=qs['limit'](_0x5d9efe['query']['limit']);_0xcc3437[_0x8c18('0x1c')]=qs['offset'](_0x5d9efe[_0x8c18('0x34')][_0x8c18('0x1c')]);}_0xcc3437['order']=qs[_0x8c18('0x3c')](_0x5d9efe['query']['sort']);_0xcc3437[_0x8c18('0x3d')]=qs[_0x8c18('0x3e')](_[_0x8c18('0x3f')](_0x5d9efe[_0x8c18('0x34')],_0x18ade7['filters']),_0x543b3c);if(_0x5d9efe[_0x8c18('0x34')][_0x8c18('0x40')]){_0xcc3437[_0x8c18('0x3d')]=_[_0x8c18('0x41')](_0xcc3437[_0x8c18('0x3d')],{'$or':_[_0x8c18('0x2d')](_0x543b3c,function(_0x2e1af1){if(_0x2e1af1[_0x8c18('0x31')]!==_0x8c18('0x42')){var _0x1a0f3a={};_0x1a0f3a[_0x2e1af1[_0x8c18('0x2a')]]={'$like':'%'+_0x5d9efe[_0x8c18('0x34')][_0x8c18('0x40')]+'%'};return _0x1a0f3a;}})});}_0xcc3437=_['merge']({},_0xcc3437,_0x5d9efe[_0x8c18('0x43')]);var _0x4afb1e={'where':_0xcc3437[_0x8c18('0x3d')]};return db['FaxTransferReport'][_0x8c18('0x1e')](_0x4afb1e)[_0x8c18('0x25')](function(_0x382758){_0x13a614['count']=_0x382758;if(_0x5d9efe['query'][_0x8c18('0x44')]){_0xcc3437['include']=[{'all':!![]}];}return db[_0x8c18('0x2e')][_0x8c18('0x45')](_0xcc3437);})['then'](function(_0x2e5adb){_0x13a614['rows']=_0x2e5adb;return _0x13a614;})[_0x8c18('0x25')](respondWithFilteredResult(_0x46444d,_0xcc3437))[_0x8c18('0x46')](handleError(_0x46444d,null));};exports['show']=function(_0x2a5dc2,_0x110411){var _0x3e0adf={'raw':!![],'where':{'id':_0x2a5dc2[_0x8c18('0x47')]['id']}},_0x1d588e={};_0x1d588e[_0x8c18('0x36')]=_[_0x8c18('0x33')](db[_0x8c18('0x2e')]['rawAttributes']);_0x1d588e[_0x8c18('0x34')]=_[_0x8c18('0x33')](_0x2a5dc2['query']);_0x1d588e[_0x8c18('0x3e')]=_['intersection'](_0x1d588e[_0x8c18('0x36')],_0x1d588e[_0x8c18('0x34')]);_0x3e0adf[_0x8c18('0x37')]=_['intersection'](_0x1d588e['model'],qs[_0x8c18('0x38')](_0x2a5dc2[_0x8c18('0x34')][_0x8c18('0x38')]));_0x3e0adf[_0x8c18('0x37')]=_0x3e0adf['attributes'][_0x8c18('0x48')]?_0x3e0adf[_0x8c18('0x37')]:_0x1d588e['model'];if(_0x2a5dc2['query'][_0x8c18('0x44')]){_0x3e0adf[_0x8c18('0x49')]=[{'all':!![]}];}_0x3e0adf=_['merge']({},_0x3e0adf,_0x2a5dc2[_0x8c18('0x43')]);return db[_0x8c18('0x2e')][_0x8c18('0x4a')](_0x3e0adf)['then'](handleEntityNotFound(_0x110411,null))[_0x8c18('0x25')](respondWithResult(_0x110411,null))['catch'](handleError(_0x110411,null));};exports[_0x8c18('0x4b')]=function(_0x333f08,_0x31290f){return db[_0x8c18('0x2e')]['create'](_0x333f08[_0x8c18('0x4c')],{})[_0x8c18('0x25')](respondWithResult(_0x31290f,0xc9))[_0x8c18('0x46')](handleError(_0x31290f,null));};exports[_0x8c18('0x24')]=function(_0x1e21a6,_0x5ed75e){if(_0x1e21a6[_0x8c18('0x4c')]['id']){delete _0x1e21a6[_0x8c18('0x4c')]['id'];}return db[_0x8c18('0x2e')]['find']({'where':{'id':_0x1e21a6[_0x8c18('0x47')]['id']}})[_0x8c18('0x25')](handleEntityNotFound(_0x5ed75e,null))[_0x8c18('0x25')](saveUpdates(_0x1e21a6[_0x8c18('0x4c')],null))['then'](respondWithResult(_0x5ed75e,null))[_0x8c18('0x46')](handleError(_0x5ed75e,null));};exports[_0x8c18('0x26')]=function(_0x3a18c0,_0x76a2a4){return db['FaxTransferReport'][_0x8c18('0x4a')]({'where':{'id':_0x3a18c0[_0x8c18('0x47')]['id']}})['then'](handleEntityNotFound(_0x76a2a4,null))[_0x8c18('0x25')](removeEntity(_0x76a2a4,null))['catch'](handleError(_0x76a2a4,null));};exports[_0x8c18('0x4d')]=function(_0x1f31c7,_0x5700e8){return db[_0x8c18('0x2e')]['describe']()[_0x8c18('0x25')](respondWithResult(_0x5700e8,null))[_0x8c18('0x46')](handleError(_0x5700e8,null));}; \ No newline at end of file +var _0x0826=['to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','json','apply','reject','save','destroy','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','then','includeAll','rows','show','params','fields','include','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox'];(function(_0x1f4b18,_0x4e777c){var _0xde3957=function(_0x1dcbbc){while(--_0x1dcbbc){_0x1f4b18['push'](_0x1f4b18['shift']());}};_0xde3957(++_0x4e777c);}(_0x0826,0x8d));var _0x6082=function(_0x2f838a,_0x13bb0f){_0x2f838a=_0x2f838a-0x0;var _0x317747=_0x0826[_0x2f838a];return _0x317747;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6082('0x0'));var zipdir=require(_0x6082('0x1'));var jsonpatch=require(_0x6082('0x2'));var rp=require(_0x6082('0x3'));var moment=require('moment');var BPromise=require(_0x6082('0x4'));var Mustache=require(_0x6082('0x5'));var util=require(_0x6082('0x6'));var path=require(_0x6082('0x7'));var sox=require(_0x6082('0x8'));var csv=require(_0x6082('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6082('0xa'));var _=require(_0x6082('0xb'));var squel=require('squel');var crypto=require(_0x6082('0xc'));var jsforce=require(_0x6082('0xd'));var deskjs=require(_0x6082('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6082('0xf'));var Redis=require(_0x6082('0x10'));var authService=require(_0x6082('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6082('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6082('0x13'));var utils=require(_0x6082('0x14'));var config=require(_0x6082('0x15'));var licenseUtil=require(_0x6082('0x16'));var db=require(_0x6082('0x17'))['db'];function respondWithStatusCode(_0x58e68d,_0x18a319){_0x18a319=_0x18a319||0xcc;return function(_0x2906d5){if(_0x2906d5){return _0x58e68d[_0x6082('0x18')](_0x18a319);}return _0x58e68d['status'](_0x18a319)[_0x6082('0x19')]();};}function respondWithResult(_0x12646e,_0x1246b3){_0x1246b3=_0x1246b3||0xc8;return function(_0x1d0940){if(_0x1d0940){return _0x12646e[_0x6082('0x1a')](_0x1246b3)['json'](_0x1d0940);}};}function respondWithFilteredResult(_0xee10fb,_0x5ca96a){return function(_0x253630){if(_0x253630){var _0x411014=typeof _0x5ca96a[_0x6082('0x1b')]===_0x6082('0x1c')&&typeof _0x5ca96a[_0x6082('0x1d')]===_0x6082('0x1c');var _0x8f1e27=_0x253630[_0x6082('0x1e')];var _0x14b2ba=_0x411014?0x0:_0x5ca96a['offset'];var _0x1d4606=_0x411014?_0x253630[_0x6082('0x1e')]:_0x5ca96a['offset']+_0x5ca96a['limit'];var _0x1cc743;if(_0x1d4606>=_0x8f1e27){_0x1d4606=_0x8f1e27;_0x1cc743=0xc8;}else{_0x1cc743=0xce;}_0xee10fb['status'](_0x1cc743);return _0xee10fb['set']('Content-Range',_0x14b2ba+'-'+_0x1d4606+'/'+_0x8f1e27)[_0x6082('0x1f')](_0x253630);}return null;};}function patchUpdates(_0x48263b){return function(_0x2d5a3b){try{jsonpatch[_0x6082('0x20')](_0x2d5a3b,_0x48263b,!![]);}catch(_0x318b5d){return BPromise[_0x6082('0x21')](_0x318b5d);}return _0x2d5a3b[_0x6082('0x22')]();};}function saveUpdates(_0x330aec,_0x4d9f47){return function(_0x8b859d){if(_0x8b859d){return _0x8b859d['update'](_0x330aec)['then'](function(_0x41ec84){return _0x41ec84;});}return null;};}function removeEntity(_0x26766a,_0x53345a){return function(_0x2a9c29){if(_0x2a9c29){return _0x2a9c29[_0x6082('0x23')]()['then'](function(){_0x26766a[_0x6082('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dada9,_0x49d978){return function(_0x751abe){if(!_0x751abe){_0x4dada9['sendStatus'](0x194);}return _0x751abe;};}function handleError(_0x23311e,_0x75f986){_0x75f986=_0x75f986||0x1f4;return function(_0x4119e3){logger[_0x6082('0x24')](_0x4119e3[_0x6082('0x25')]);if(_0x4119e3['name']){delete _0x4119e3[_0x6082('0x26')];}_0x23311e[_0x6082('0x1a')](_0x75f986)[_0x6082('0x27')](_0x4119e3);};}exports[_0x6082('0x28')]=function(_0x2e052e,_0x12f1d1){var _0x48302c={},_0x3b18f8={},_0x37bba8={'count':0x0,'rows':[]};var _0x5e40ff=_[_0x6082('0x29')](db[_0x6082('0x2a')][_0x6082('0x2b')],function(_0x45ef95){return{'name':_0x45ef95[_0x6082('0x2c')],'type':_0x45ef95[_0x6082('0x2d')][_0x6082('0x2e')]};});_0x3b18f8[_0x6082('0x2f')]=_[_0x6082('0x29')](_0x5e40ff,'name');_0x3b18f8[_0x6082('0x30')]=_[_0x6082('0x31')](_0x2e052e['query']);_0x3b18f8[_0x6082('0x32')]=_[_0x6082('0x33')](_0x3b18f8[_0x6082('0x2f')],_0x3b18f8[_0x6082('0x30')]);_0x48302c[_0x6082('0x34')]=_[_0x6082('0x33')](_0x3b18f8[_0x6082('0x2f')],qs['fields'](_0x2e052e['query']['fields']));_0x48302c[_0x6082('0x34')]=_0x48302c['attributes'][_0x6082('0x35')]?_0x48302c[_0x6082('0x34')]:_0x3b18f8[_0x6082('0x2f')];if(!_0x2e052e[_0x6082('0x30')][_0x6082('0x36')](_0x6082('0x37'))){_0x48302c['limit']=qs[_0x6082('0x1d')](_0x2e052e[_0x6082('0x30')]['limit']);_0x48302c['offset']=qs[_0x6082('0x1b')](_0x2e052e[_0x6082('0x30')]['offset']);}_0x48302c[_0x6082('0x38')]=qs[_0x6082('0x39')](_0x2e052e[_0x6082('0x30')][_0x6082('0x39')]);_0x48302c['where']=qs[_0x6082('0x32')](_[_0x6082('0x3a')](_0x2e052e[_0x6082('0x30')],_0x3b18f8['filters']),_0x5e40ff);if(_0x2e052e[_0x6082('0x30')][_0x6082('0x3b')]){_0x48302c['where']=_[_0x6082('0x3c')](_0x48302c[_0x6082('0x3d')],{'$or':_[_0x6082('0x29')](_0x5e40ff,function(_0x10b0a1){if(_0x10b0a1[_0x6082('0x2d')]!=='VIRTUAL'){var _0x51f5b9={};_0x51f5b9[_0x10b0a1['name']]={'$like':'%'+_0x2e052e[_0x6082('0x30')]['filter']+'%'};return _0x51f5b9;}})});}_0x48302c=_[_0x6082('0x3c')]({},_0x48302c,_0x2e052e[_0x6082('0x3e')]);var _0x326213={'where':_0x48302c[_0x6082('0x3d')]};return db['FaxTransferReport']['count'](_0x326213)[_0x6082('0x3f')](function(_0x3a57e5){_0x37bba8[_0x6082('0x1e')]=_0x3a57e5;if(_0x2e052e[_0x6082('0x30')][_0x6082('0x40')]){_0x48302c['include']=[{'all':!![]}];}return db['FaxTransferReport']['findAll'](_0x48302c);})['then'](function(_0x4e53e1){_0x37bba8[_0x6082('0x41')]=_0x4e53e1;return _0x37bba8;})[_0x6082('0x3f')](respondWithFilteredResult(_0x12f1d1,_0x48302c))['catch'](handleError(_0x12f1d1,null));};exports[_0x6082('0x42')]=function(_0x23ab36,_0x2806f7){var _0x4e1efa={'raw':!![],'where':{'id':_0x23ab36[_0x6082('0x43')]['id']}},_0x18680d={};_0x18680d[_0x6082('0x2f')]=_[_0x6082('0x31')](db[_0x6082('0x2a')][_0x6082('0x2b')]);_0x18680d[_0x6082('0x30')]=_[_0x6082('0x31')](_0x23ab36['query']);_0x18680d[_0x6082('0x32')]=_[_0x6082('0x33')](_0x18680d[_0x6082('0x2f')],_0x18680d[_0x6082('0x30')]);_0x4e1efa[_0x6082('0x34')]=_['intersection'](_0x18680d[_0x6082('0x2f')],qs[_0x6082('0x44')](_0x23ab36[_0x6082('0x30')]['fields']));_0x4e1efa['attributes']=_0x4e1efa[_0x6082('0x34')][_0x6082('0x35')]?_0x4e1efa['attributes']:_0x18680d['model'];if(_0x23ab36[_0x6082('0x30')][_0x6082('0x40')]){_0x4e1efa[_0x6082('0x45')]=[{'all':!![]}];}_0x4e1efa=_[_0x6082('0x3c')]({},_0x4e1efa,_0x23ab36[_0x6082('0x3e')]);return db[_0x6082('0x2a')][_0x6082('0x46')](_0x4e1efa)['then'](handleEntityNotFound(_0x2806f7,null))['then'](respondWithResult(_0x2806f7,null))[_0x6082('0x47')](handleError(_0x2806f7,null));};exports[_0x6082('0x48')]=function(_0x2db853,_0x1305cc){return db[_0x6082('0x2a')][_0x6082('0x48')](_0x2db853[_0x6082('0x49')],{})[_0x6082('0x3f')](respondWithResult(_0x1305cc,0xc9))[_0x6082('0x47')](handleError(_0x1305cc,null));};exports['update']=function(_0x23e49d,_0x25be29){if(_0x23e49d[_0x6082('0x49')]['id']){delete _0x23e49d[_0x6082('0x49')]['id'];}return db[_0x6082('0x2a')]['find']({'where':{'id':_0x23e49d['params']['id']}})[_0x6082('0x3f')](handleEntityNotFound(_0x25be29,null))['then'](saveUpdates(_0x23e49d[_0x6082('0x49')],null))[_0x6082('0x3f')](respondWithResult(_0x25be29,null))['catch'](handleError(_0x25be29,null));};exports[_0x6082('0x23')]=function(_0x178dd6,_0x124da2){return db[_0x6082('0x2a')][_0x6082('0x46')]({'where':{'id':_0x178dd6['params']['id']}})['then'](handleEntityNotFound(_0x124da2,null))[_0x6082('0x3f')](removeEntity(_0x124da2,null))[_0x6082('0x47')](handleError(_0x124da2,null));};exports[_0x6082('0x4a')]=function(_0x439afe,_0x44c6b1){return db['FaxTransferReport']['describe']()[_0x6082('0x3f')](respondWithResult(_0x44c6b1,null))[_0x6082('0x47')](handleError(_0x44c6b1,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index fb6d17b..e3b603f 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 _0xe1fc=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./faxTransferReport.attributes','exports','define','uniqueid','lodash'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xe1fc,0x1e3));var _0xce1f=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0xe1fc[_0x58dc25];return _0x21b0a7;};'use strict';var _=require(_0xce1f('0x0'));var util=require('util');var logger=require(_0xce1f('0x1'))(_0xce1f('0x2'));var moment=require('moment');var BPromise=require(_0xce1f('0x3'));var rp=require(_0xce1f('0x4'));var fs=require('fs');var path=require(_0xce1f('0x5'));var rimraf=require('rimraf');var config=require(_0xce1f('0x6'));var attributes=require(_0xce1f('0x7'));module[_0xce1f('0x8')]=function(_0x1987b6,_0x1f0569){return _0x1987b6[_0xce1f('0x9')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xce1f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5332=['../../config/logger','api','moment','request-promise','path','rimraf','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash'];(function(_0x5390a3,_0x4d60f7){var _0x45d220=function(_0x47904f){while(--_0x47904f){_0x5390a3['push'](_0x5390a3['shift']());}};_0x45d220(++_0x4d60f7);}(_0x5332,0x12a));var _0x2533=function(_0x36f05b,_0x1db03f){_0x36f05b=_0x36f05b-0x0;var _0x125fb=_0x5332[_0x36f05b];return _0x125fb;};'use strict';var _=require(_0x2533('0x0'));var util=require('util');var logger=require(_0x2533('0x1'))(_0x2533('0x2'));var moment=require(_0x2533('0x3'));var BPromise=require('bluebird');var rp=require(_0x2533('0x4'));var fs=require('fs');var path=require(_0x2533('0x5'));var rimraf=require(_0x2533('0x6'));var config=require('../../config/environment');var attributes=require(_0x2533('0x7'));module[_0x2533('0x8')]=function(_0x4bc6dc,_0x5ec155){return _0x4bc6dc[_0x2533('0x9')](_0x2533('0xa'),attributes,{'tableName':_0x2533('0xb'),'paranoid':![],'indexes':[{'name':_0x2533('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index b852e32..fd95d87 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 _0xfd33=['jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','error','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x241df0,_0x5352d0){var _0x36f64f=function(_0x765bcb){while(--_0x765bcb){_0x241df0['push'](_0x241df0['shift']());}};_0x36f64f(++_0x5352d0);}(_0xfd33,0x1af));var _0x3fd3=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xfd33[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0x3fd3('0x0'));var util=require(_0x3fd3('0x1'));var moment=require(_0x3fd3('0x2'));var BPromise=require('bluebird');var rs=require(_0x3fd3('0x3'));var fs=require('fs');var Redis=require(_0x3fd3('0x4'));var db=require(_0x3fd3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3fd3('0x6'))(_0x3fd3('0x7'));var config=require(_0x3fd3('0x8'));var jayson=require(_0x3fd3('0x9'));var client=jayson[_0x3fd3('0xa')][_0x3fd3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31e6fe,_0x87d09c,_0x777e8c){return new BPromise(function(_0x1e5e2c,_0x14be01){return client[_0x3fd3('0xc')](_0x31e6fe,_0x777e8c)[_0x3fd3('0xd')](function(_0x203559){logger[_0x3fd3('0xe')](_0x3fd3('0xf'),_0x87d09c,_0x3fd3('0x10'));logger['debug']('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x87d09c,_0x3fd3('0x10'),JSON['stringify'](_0x203559));if(_0x203559['error']){if(_0x203559[_0x3fd3('0x11')]['code']===0x1f4){logger[_0x3fd3('0x11')](_0x3fd3('0xf'),_0x87d09c,_0x203559[_0x3fd3('0x11')][_0x3fd3('0x12')]);return _0x14be01(_0x203559[_0x3fd3('0x11')][_0x3fd3('0x12')]);}logger['error'](_0x3fd3('0xf'),_0x87d09c,_0x203559['error'][_0x3fd3('0x12')]);return _0x1e5e2c(_0x203559[_0x3fd3('0x11')]['message']);}else{logger[_0x3fd3('0xe')](_0x3fd3('0xf'),_0x87d09c,_0x3fd3('0x10'));_0x1e5e2c(_0x203559[_0x3fd3('0x13')][_0x3fd3('0x12')]);}})['catch'](function(_0x45ac4d){logger['error'](_0x3fd3('0xf'),_0x87d09c,_0x45ac4d);_0x14be01(_0x45ac4d);});});} \ No newline at end of file +var _0x0db4=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x529c40,_0x4c262f){var _0x2ccd4d=function(_0x5c778f){while(--_0x5c778f){_0x529c40['push'](_0x529c40['shift']());}};_0x2ccd4d(++_0x4c262f);}(_0x0db4,0xab));var _0x40db=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x0db4[_0x5a9c0c];return _0x53c77d;};'use strict';var _=require(_0x40db('0x0'));var util=require('util');var moment=require(_0x40db('0x1'));var BPromise=require(_0x40db('0x2'));var rs=require(_0x40db('0x3'));var fs=require('fs');var Redis=require(_0x40db('0x4'));var db=require(_0x40db('0x5'))['db'];var utils=require(_0x40db('0x6'));var logger=require('../../config/logger')(_0x40db('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x40db('0x8')][_0x40db('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43d8de,_0x830999,_0x17cb1f){return new BPromise(function(_0x14a1f0,_0x26e635){return client[_0x40db('0xa')](_0x43d8de,_0x17cb1f)[_0x40db('0xb')](function(_0x1243ee){logger['info'](_0x40db('0xc'),_0x830999,_0x40db('0xd'));logger[_0x40db('0xe')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x830999,_0x40db('0xd'),JSON[_0x40db('0xf')](_0x1243ee));if(_0x1243ee[_0x40db('0x10')]){if(_0x1243ee['error']['code']===0x1f4){logger['error'](_0x40db('0xc'),_0x830999,_0x1243ee[_0x40db('0x10')][_0x40db('0x11')]);return _0x26e635(_0x1243ee[_0x40db('0x10')]['message']);}logger['error'](_0x40db('0xc'),_0x830999,_0x1243ee['error']['message']);return _0x14a1f0(_0x1243ee[_0x40db('0x10')][_0x40db('0x11')]);}else{logger['info'](_0x40db('0xc'),_0x830999,'request\x20sent');_0x14a1f0(_0x1243ee[_0x40db('0x12')][_0x40db('0x11')]);}})['catch'](function(_0x5f964e){logger[_0x40db('0x10')](_0x40db('0xc'),_0x830999,_0x5f964e);_0x26e635(_0x5f964e);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 243e200..3a63817 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 _0x2aab=['index','describe','/:id','show','put','update','delete','exports','util','express','fs-extra','../../config/environment','./faxTransferReport.controller','get','isAuthenticated'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x2aab,0x1e8));var _0xb2aa=function(_0x1db3f7,_0x473af1){_0x1db3f7=_0x1db3f7-0x0;var _0x3d6f52=_0x2aab[_0x1db3f7];return _0x3d6f52;};'use strict';var multer=require('multer');var util=require(_0xb2aa('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb2aa('0x1'));var router=express['Router']();var fs_extra=require(_0xb2aa('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb2aa('0x3'));var controller=require(_0xb2aa('0x4'));router[_0xb2aa('0x5')]('/',auth[_0xb2aa('0x6')](),controller[_0xb2aa('0x7')]);router[_0xb2aa('0x5')]('/describe',auth['isAuthenticated'](),controller[_0xb2aa('0x8')]);router[_0xb2aa('0x5')](_0xb2aa('0x9'),auth[_0xb2aa('0x6')](),controller[_0xb2aa('0xa')]);router['post']('/',auth[_0xb2aa('0x6')](),controller['create']);router[_0xb2aa('0xb')](_0xb2aa('0x9'),auth[_0xb2aa('0x6')](),controller[_0xb2aa('0xc')]);router[_0xb2aa('0xd')](_0xb2aa('0x9'),auth[_0xb2aa('0x6')](),controller['destroy']);module[_0xb2aa('0xe')]=router; \ No newline at end of file +var _0x003e=['/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x34f1e7,_0x566996){var _0x8155d2=function(_0x5b59b6){while(--_0x5b59b6){_0x34f1e7['push'](_0x34f1e7['shift']());}};_0x8155d2(++_0x566996);}(_0x003e,0x15b));var _0xe003=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x003e[_0x2235bf];return _0x4c3a64;};'use strict';var multer=require(_0xe003('0x0'));var util=require(_0xe003('0x1'));var path=require(_0xe003('0x2'));var timeout=require(_0xe003('0x3'));var express=require('express');var router=express[_0xe003('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe003('0x5'));var interaction=require(_0xe003('0x6'));var config=require('../../config/environment');var controller=require('./faxTransferReport.controller');router[_0xe003('0x7')]('/',auth[_0xe003('0x8')](),controller[_0xe003('0x9')]);router[_0xe003('0x7')](_0xe003('0xa'),auth[_0xe003('0x8')](),controller[_0xe003('0xb')]);router[_0xe003('0x7')](_0xe003('0xc'),auth['isAuthenticated'](),controller[_0xe003('0xd')]);router[_0xe003('0xe')]('/',auth[_0xe003('0x8')](),controller[_0xe003('0xf')]);router[_0xe003('0x10')]('/:id',auth[_0xe003('0x8')](),controller[_0xe003('0x11')]);router[_0xe003('0x12')]('/:id',auth[_0xe003('0x8')](),controller[_0xe003('0x13')]);module[_0xe003('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 97b8c49..d86dbcd 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 _0xc5f0=['fs-extra','../../components/auth/service','../../config/environment','./intDeskAccount.controller','index','/:id','isAuthenticated','get','/:id/configurations','getConfigurations','/:id/fields','post','create','put','update','delete','destroy','exports','multer','connect-timeout','Router'];(function(_0x41d432,_0x20e878){var _0x1650f9=function(_0x27f177){while(--_0x27f177){_0x41d432['push'](_0x41d432['shift']());}};_0x1650f9(++_0x20e878);}(_0xc5f0,0x177));var _0x0c5f=function(_0x2d460c,_0x4f08c0){_0x2d460c=_0x2d460c-0x0;var _0xf6fc4c=_0xc5f0[_0x2d460c];return _0xf6fc4c;};'use strict';var multer=require(_0x0c5f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0c5f('0x1'));var express=require('express');var router=express[_0x0c5f('0x2')]();var fs_extra=require(_0x0c5f('0x3'));var auth=require(_0x0c5f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0c5f('0x5'));var controller=require(_0x0c5f('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0c5f('0x7')]);router['get'](_0x0c5f('0x8'),auth[_0x0c5f('0x9')](),controller['show']);router[_0x0c5f('0xa')](_0x0c5f('0xb'),auth['isAuthenticated'](),controller[_0x0c5f('0xc')]);router['get'](_0x0c5f('0xd'),auth[_0x0c5f('0x9')](),controller['getFields']);router[_0x0c5f('0xe')]('/',auth[_0x0c5f('0x9')](),controller[_0x0c5f('0xf')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x0c5f('0x10')]('/:id',auth[_0x0c5f('0x9')](),controller[_0x0c5f('0x11')]);router[_0x0c5f('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x0c5f('0x13')]);module[_0x0c5f('0x14')]=router; \ No newline at end of file +var _0xc21d=['update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xc21d,0xdf));var _0xdc21=function(_0x55d46b,_0xbd504c){_0x55d46b=_0x55d46b-0x0;var _0x4a1f2d=_0xc21d[_0x55d46b];return _0x4a1f2d;};'use strict';var multer=require(_0xdc21('0x0'));var util=require(_0xdc21('0x1'));var path=require(_0xdc21('0x2'));var timeout=require('connect-timeout');var express=require(_0xdc21('0x3'));var router=express[_0xdc21('0x4')]();var fs_extra=require(_0xdc21('0x5'));var auth=require(_0xdc21('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdc21('0x7'));var controller=require('./intDeskAccount.controller');router[_0xdc21('0x8')]('/',auth[_0xdc21('0x9')](),controller['index']);router['get'](_0xdc21('0xa'),auth[_0xdc21('0x9')](),controller[_0xdc21('0xb')]);router[_0xdc21('0x8')](_0xdc21('0xc'),auth[_0xdc21('0x9')](),controller['getConfigurations']);router['get'](_0xdc21('0xd'),auth['isAuthenticated'](),controller[_0xdc21('0xe')]);router[_0xdc21('0xf')]('/',auth[_0xdc21('0x9')](),controller[_0xdc21('0x10')]);router[_0xdc21('0xf')](_0xdc21('0xc'),auth[_0xdc21('0x9')](),controller[_0xdc21('0x11')]);router[_0xdc21('0x12')](_0xdc21('0xa'),auth[_0xdc21('0x9')](),controller[_0xdc21('0x13')]);router['delete'](_0xdc21('0xa'),auth[_0xdc21('0x9')](),controller[_0xdc21('0x14')]);module[_0xdc21('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 079647e..13f749a 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 _0x0266=['sequelize','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x46e5ca,_0x2661a0){var _0x2d055d=function(_0x58b071){while(--_0x58b071){_0x46e5ca['push'](_0x46e5ca['shift']());}};_0x2d055d(++_0x2661a0);}(_0x0266,0x17a));var _0x6026=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0266[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x6026('0x0'));module['exports']={'name':{'type':Sequelize[_0x6026('0x1')]},'description':{'type':Sequelize[_0x6026('0x1')]},'username':{'type':Sequelize[_0x6026('0x1')]},'remoteUri':{'type':Sequelize[_0x6026('0x1')]},'authType':{'type':Sequelize[_0x6026('0x2')]('basic'),'defaultValue':_0x6026('0x3')},'password':{'type':Sequelize[_0x6026('0x1')]},'consumerKey':{'type':Sequelize[_0x6026('0x1')]},'consumerSecret':{'type':Sequelize[_0x6026('0x1')]},'token':{'type':Sequelize[_0x6026('0x1')]},'tokenSecret':{'type':Sequelize[_0x6026('0x1')]},'serverUrl':{'type':Sequelize[_0x6026('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x6026('0x4'),_0x6026('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xf288=['exports','STRING','basic','ENUM','integrationTab','sequelize'];(function(_0x5f3884,_0x243e63){var _0x40e269=function(_0x114fa7){while(--_0x114fa7){_0x5f3884['push'](_0x5f3884['shift']());}};_0x40e269(++_0x243e63);}(_0xf288,0x1c1));var _0x8f28=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xf288[_0x5f309e];return _0x487b5e;};'use strict';var Sequelize=require(_0x8f28('0x0'));module[_0x8f28('0x1')]={'name':{'type':Sequelize[_0x8f28('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x8f28('0x2')]},'remoteUri':{'type':Sequelize[_0x8f28('0x2')]},'authType':{'type':Sequelize['ENUM'](_0x8f28('0x3')),'defaultValue':_0x8f28('0x3')},'password':{'type':Sequelize[_0x8f28('0x2')]},'consumerKey':{'type':Sequelize[_0x8f28('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x8f28('0x2')]},'tokenSecret':{'type':Sequelize[_0x8f28('0x2')]},'serverUrl':{'type':Sequelize[_0x8f28('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8f28('0x4')]('integrationTab','newTab'),'defaultValue':_0x8f28('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index cf8b168..977cbf6 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 _0xfaae=['desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','pick','options','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','DeskConfiguration','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','concat','_embedded','entries','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xfaae,0x1c8));var _0xefaa=function(_0x110106,_0x31399e){_0x110106=_0x110106-0x0;var _0x333932=_0xfaae[_0x110106];return _0x333932;};'use strict';var emlformat=require(_0xefaa('0x0'));var rimraf=require(_0xefaa('0x1'));var zipdir=require(_0xefaa('0x2'));var jsonpatch=require(_0xefaa('0x3'));var rp=require(_0xefaa('0x4'));var moment=require('moment');var BPromise=require(_0xefaa('0x5'));var Mustache=require(_0xefaa('0x6'));var util=require(_0xefaa('0x7'));var path=require(_0xefaa('0x8'));var sox=require(_0xefaa('0x9'));var csv=require('to-csv');var ejs=require(_0xefaa('0xa'));var fs=require('fs');var fs_extra=require(_0xefaa('0xb'));var _=require(_0xefaa('0xc'));var squel=require(_0xefaa('0xd'));var crypto=require(_0xefaa('0xe'));var jsforce=require(_0xefaa('0xf'));var deskjs=require(_0xefaa('0x10'));var toCsv=require(_0xefaa('0x11'));var querystring=require('querystring');var Papa=require(_0xefaa('0x12'));var Redis=require(_0xefaa('0x13'));var authService=require(_0xefaa('0x14'));var qs=require(_0xefaa('0x15'));var as=require(_0xefaa('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xefaa('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xefaa('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x428e52,_0x48019a){_0x48019a=_0x48019a||0xcc;return function(_0x43c317){if(_0x43c317){return _0x428e52['sendStatus'](_0x48019a);}return _0x428e52['status'](_0x48019a)[_0xefaa('0x19')]();};}function respondWithResult(_0x24efd1,_0x422654){_0x422654=_0x422654||0xc8;return function(_0x889f0c){if(_0x889f0c){return _0x24efd1[_0xefaa('0x1a')](_0x422654)[_0xefaa('0x1b')](_0x889f0c);}};}function respondWithFilteredResult(_0x4eda87,_0x18d0f7){return function(_0x125362){if(_0x125362){var _0x5e0038=typeof _0x18d0f7[_0xefaa('0x1c')]===_0xefaa('0x1d')&&typeof _0x18d0f7[_0xefaa('0x1e')]===_0xefaa('0x1d');var _0x1585aa=_0x125362[_0xefaa('0x1f')];var _0x4bc93c=_0x5e0038?0x0:_0x18d0f7[_0xefaa('0x1c')];var _0x41a58e=_0x5e0038?_0x125362[_0xefaa('0x1f')]:_0x18d0f7[_0xefaa('0x1c')]+_0x18d0f7[_0xefaa('0x1e')];var _0x37f4dd;if(_0x41a58e>=_0x1585aa){_0x41a58e=_0x1585aa;_0x37f4dd=0xc8;}else{_0x37f4dd=0xce;}_0x4eda87[_0xefaa('0x1a')](_0x37f4dd);return _0x4eda87[_0xefaa('0x20')](_0xefaa('0x21'),_0x4bc93c+'-'+_0x41a58e+'/'+_0x1585aa)[_0xefaa('0x1b')](_0x125362);}return null;};}function patchUpdates(_0x20a8ea){return function(_0x2e421c){try{jsonpatch[_0xefaa('0x22')](_0x2e421c,_0x20a8ea,!![]);}catch(_0xa8e2d){return BPromise[_0xefaa('0x23')](_0xa8e2d);}return _0x2e421c[_0xefaa('0x24')]();};}function saveUpdates(_0x2f83d2,_0xf63011){return function(_0x498a39){if(_0x498a39){return _0x498a39[_0xefaa('0x25')](_0x2f83d2)[_0xefaa('0x26')](function(_0x53eeaa){return _0x53eeaa;});}return null;};}function removeEntity(_0x220daa,_0x1b361d){return function(_0x25d956){if(_0x25d956){return _0x25d956[_0xefaa('0x27')]()[_0xefaa('0x26')](function(){_0x220daa['status'](0xcc)[_0xefaa('0x19')]();});}};}function handleEntityNotFound(_0x3db214,_0x21ddfc){return function(_0x114d51){if(!_0x114d51){_0x3db214[_0xefaa('0x28')](0x194);}return _0x114d51;};}function handleError(_0x402808,_0x1d5c0d){_0x1d5c0d=_0x1d5c0d||0x1f4;return function(_0x51c017){logger[_0xefaa('0x29')](_0x51c017['stack']);if(_0x51c017[_0xefaa('0x2a')]){delete _0x51c017['name'];}_0x402808[_0xefaa('0x1a')](_0x1d5c0d)[_0xefaa('0x2b')](_0x51c017);};}exports[_0xefaa('0x2c')]=function(_0x43f4f9,_0x5839e6){var _0x3f1006={},_0x411f98={},_0x40ab0d={'count':0x0,'rows':[]};var _0x22590b=_[_0xefaa('0x2d')](db[_0xefaa('0x2e')][_0xefaa('0x2f')],function(_0x537be8){return{'name':_0x537be8[_0xefaa('0x30')],'type':_0x537be8[_0xefaa('0x31')]['key']};});_0x411f98[_0xefaa('0x32')]=_[_0xefaa('0x2d')](_0x22590b,_0xefaa('0x2a'));_0x411f98[_0xefaa('0x33')]=_[_0xefaa('0x34')](_0x43f4f9['query']);_0x411f98['filters']=_[_0xefaa('0x35')](_0x411f98[_0xefaa('0x32')],_0x411f98[_0xefaa('0x33')]);_0x3f1006[_0xefaa('0x36')]=_[_0xefaa('0x35')](_0x411f98[_0xefaa('0x32')],qs[_0xefaa('0x37')](_0x43f4f9[_0xefaa('0x33')]['fields']));_0x3f1006[_0xefaa('0x36')]=_0x3f1006[_0xefaa('0x36')][_0xefaa('0x38')]?_0x3f1006['attributes']:_0x411f98[_0xefaa('0x32')];if(!_0x43f4f9[_0xefaa('0x33')][_0xefaa('0x39')]('nolimit')){_0x3f1006[_0xefaa('0x1e')]=qs['limit'](_0x43f4f9['query'][_0xefaa('0x1e')]);_0x3f1006[_0xefaa('0x1c')]=qs[_0xefaa('0x1c')](_0x43f4f9['query'][_0xefaa('0x1c')]);}_0x3f1006[_0xefaa('0x3a')]=qs[_0xefaa('0x3b')](_0x43f4f9['query'][_0xefaa('0x3b')]);_0x3f1006[_0xefaa('0x3c')]=qs[_0xefaa('0x3d')](_['pick'](_0x43f4f9[_0xefaa('0x33')],_0x411f98[_0xefaa('0x3d')]),_0x22590b);if(_0x43f4f9[_0xefaa('0x33')]['filter']){_0x3f1006[_0xefaa('0x3c')]=_[_0xefaa('0x3e')](_0x3f1006[_0xefaa('0x3c')],{'$or':_[_0xefaa('0x2d')](_0x22590b,function(_0x30e9c4){if(_0x30e9c4[_0xefaa('0x31')]!==_0xefaa('0x3f')){var _0x1abf39={};_0x1abf39[_0x30e9c4[_0xefaa('0x2a')]]={'$like':'%'+_0x43f4f9[_0xefaa('0x33')][_0xefaa('0x40')]+'%'};return _0x1abf39;}})});}_0x3f1006=_[_0xefaa('0x3e')]({},_0x3f1006,_0x43f4f9['options']);var _0x2bd572={'where':_0x3f1006[_0xefaa('0x3c')]};return db[_0xefaa('0x2e')][_0xefaa('0x1f')](_0x2bd572)[_0xefaa('0x26')](function(_0x27cb59){_0x40ab0d['count']=_0x27cb59;if(_0x43f4f9[_0xefaa('0x33')][_0xefaa('0x41')]){_0x3f1006[_0xefaa('0x42')]=[{'all':!![]}];}return db[_0xefaa('0x2e')][_0xefaa('0x43')](_0x3f1006);})[_0xefaa('0x26')](function(_0x285fee){_0x40ab0d[_0xefaa('0x44')]=_0x285fee;return _0x40ab0d;})['then'](respondWithFilteredResult(_0x5839e6,_0x3f1006))[_0xefaa('0x45')](handleError(_0x5839e6,null));};exports[_0xefaa('0x46')]=function(_0x2b2e30,_0x1b6f1c){var _0x43ddf7={'raw':![],'where':{'id':_0x2b2e30[_0xefaa('0x47')]['id']}},_0x29f25f={};_0x29f25f[_0xefaa('0x32')]=_[_0xefaa('0x34')](db[_0xefaa('0x2e')][_0xefaa('0x2f')]);_0x29f25f[_0xefaa('0x33')]=_['keys'](_0x2b2e30[_0xefaa('0x33')]);_0x29f25f[_0xefaa('0x3d')]=_[_0xefaa('0x35')](_0x29f25f['model'],_0x29f25f['query']);_0x43ddf7['attributes']=_[_0xefaa('0x35')](_0x29f25f[_0xefaa('0x32')],qs[_0xefaa('0x37')](_0x2b2e30[_0xefaa('0x33')][_0xefaa('0x37')]));_0x43ddf7[_0xefaa('0x36')]=_0x43ddf7[_0xefaa('0x36')][_0xefaa('0x38')]?_0x43ddf7[_0xefaa('0x36')]:_0x29f25f[_0xefaa('0x32')];if(_0x2b2e30[_0xefaa('0x33')][_0xefaa('0x41')]){_0x43ddf7[_0xefaa('0x42')]=[{'all':!![]}];}_0x43ddf7=_[_0xefaa('0x3e')]({},_0x43ddf7,_0x2b2e30['options']);return db[_0xefaa('0x2e')][_0xefaa('0x48')](_0x43ddf7)['then'](handleEntityNotFound(_0x1b6f1c,null))[_0xefaa('0x26')](respondWithResult(_0x1b6f1c,null))[_0xefaa('0x45')](handleError(_0x1b6f1c,null));};exports[_0xefaa('0x49')]=function(_0x24c8cf,_0x2bd33f){return db[_0xefaa('0x2e')][_0xefaa('0x49')](_0x24c8cf[_0xefaa('0x4a')],{})['then'](respondWithResult(_0x2bd33f,0xc9))['catch'](handleError(_0x2bd33f,null));};exports[_0xefaa('0x25')]=function(_0x2d7e1f,_0x28ab59){if(_0x2d7e1f['body']['id']){delete _0x2d7e1f[_0xefaa('0x4a')]['id'];}return db[_0xefaa('0x2e')][_0xefaa('0x48')]({'where':{'id':_0x2d7e1f[_0xefaa('0x47')]['id']}})[_0xefaa('0x26')](handleEntityNotFound(_0x28ab59,null))['then'](saveUpdates(_0x2d7e1f[_0xefaa('0x4a')],null))['then'](respondWithResult(_0x28ab59,null))[_0xefaa('0x45')](handleError(_0x28ab59,null));};exports[_0xefaa('0x27')]=function(_0x49f756,_0x1a3348){return db[_0xefaa('0x2e')][_0xefaa('0x48')]({'where':{'id':_0x49f756[_0xefaa('0x47')]['id']}})['then'](handleEntityNotFound(_0x1a3348,null))[_0xefaa('0x26')](removeEntity(_0x1a3348,null))['catch'](handleError(_0x1a3348,null));};exports[_0xefaa('0x4b')]=function(_0x1fcfc4,_0x4d148d,_0x45405e){var _0xe6122={};var _0x760b87={};var _0x1648b2;var _0x5dd770;return db['DeskAccount'][_0xefaa('0x4c')]({'where':{'id':_0x1fcfc4[_0xefaa('0x47')]['id']}})[_0xefaa('0x26')](handleEntityNotFound(_0x4d148d,null))[_0xefaa('0x26')](function(_0x5a106e){if(_0x5a106e){_0x1648b2=_0x5a106e;_0x760b87['model']=_['keys'](db['DeskConfiguration'][_0xefaa('0x2f')]);_0x760b87[_0xefaa('0x33')]=_[_0xefaa('0x34')](_0x1fcfc4[_0xefaa('0x33')]);_0x760b87[_0xefaa('0x3d')]=_[_0xefaa('0x35')](_0x760b87['model'],_0x760b87[_0xefaa('0x33')]);_0xe6122[_0xefaa('0x36')]=_[_0xefaa('0x35')](_0x760b87['model'],qs[_0xefaa('0x37')](_0x1fcfc4['query'][_0xefaa('0x37')]));_0xe6122[_0xefaa('0x36')]=_0xe6122[_0xefaa('0x36')]['length']?_0xe6122[_0xefaa('0x36')]:_0x760b87[_0xefaa('0x32')];_0xe6122['order']=qs['sort'](_0x1fcfc4[_0xefaa('0x33')][_0xefaa('0x3b')]);_0xe6122[_0xefaa('0x3c')]=qs[_0xefaa('0x3d')](_[_0xefaa('0x4d')](_0x1fcfc4[_0xefaa('0x33')],_0x760b87[_0xefaa('0x3d')]));if(_0x1fcfc4[_0xefaa('0x33')][_0xefaa('0x40')]){_0xe6122[_0xefaa('0x3c')]=_[_0xefaa('0x3e')](_0xe6122[_0xefaa('0x3c')],{'$or':_['map'](_0xe6122[_0xefaa('0x36')],function(_0x35f3d2){var _0x1a8516={};_0x1a8516[_0x35f3d2]={'$like':'%'+_0x1fcfc4[_0xefaa('0x33')]['filter']+'%'};return _0x1a8516;})});}_0xe6122=_[_0xefaa('0x3e')]({},_0xe6122,_0x1fcfc4[_0xefaa('0x4e')]);return _0x1648b2[_0xefaa('0x4b')](_0xe6122);}})[_0xefaa('0x26')](function(_0x5371d8){if(_0x5371d8){_0x5dd770=_0x5371d8[_0xefaa('0x38')];if(!_0x1fcfc4['query'][_0xefaa('0x39')](_0xefaa('0x4f'))){_0xe6122[_0xefaa('0x1e')]=qs[_0xefaa('0x1e')](_0x1fcfc4[_0xefaa('0x33')][_0xefaa('0x1e')]);_0xe6122[_0xefaa('0x1c')]=qs[_0xefaa('0x1c')](_0x1fcfc4[_0xefaa('0x33')][_0xefaa('0x1c')]);}return _0x1648b2[_0xefaa('0x4b')](_0xe6122);}})[_0xefaa('0x26')](function(_0x4b436c){if(_0x4b436c){return _0x4b436c?{'count':_0x5dd770,'rows':_0x4b436c}:null;}})[_0xefaa('0x26')](respondWithResult(_0x4d148d,null))['catch'](handleError(_0x4d148d,null));};exports[_0xefaa('0x50')]=function(_0x43ba00,_0x167c4e,_0x25182a){if(_0x43ba00['body']['id']){delete _0x43ba00[_0xefaa('0x4a')]['id'];}return db[_0xefaa('0x2e')]['findOne']({'where':{'id':_0x43ba00[_0xefaa('0x47')]['id']}})[_0xefaa('0x26')](handleEntityNotFound(_0x167c4e,null))['then'](function(_0x54d028){if(_0x54d028){_0x43ba00[_0xefaa('0x4a')][_0xefaa('0x51')]=_0x54d028['id'];_0x43ba00[_0xefaa('0x4a')][_0xefaa('0x52')]=integrations['getSubjects'](_0x43ba00[_0xefaa('0x4a')][_0xefaa('0x53')],_0x43ba00[_0xefaa('0x4a')][_0xefaa('0x31')]);_0x43ba00['body'][_0xefaa('0x54')]=integrations['getDescriptions'](_0x43ba00[_0xefaa('0x4a')]['channel'],_0x43ba00['body'][_0xefaa('0x31')]);return db[_0xefaa('0x55')]['create'](_0x43ba00[_0xefaa('0x4a')],{'include':[{'model':db[_0xefaa('0x56')],'as':_0xefaa('0x52')},{'model':db[_0xefaa('0x56')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x167c4e,null))[_0xefaa('0x45')](handleError(_0x167c4e,null));};exports[_0xefaa('0x57')]=function(_0x22defa,_0x4d5b51,_0x86205d){var _0x464222=[{'name':_0xefaa('0x58'),'label':_0xefaa('0x58'),'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 _0x3ccc5b='';return db[_0xefaa('0x2e')][_0xefaa('0x4c')]({'where':{'id':_0x22defa['params']['id']},'attributes':['id',_0xefaa('0x59'),_0xefaa('0x5a'),_0xefaa('0x5b'),_0xefaa('0x5c'),_0xefaa('0x5d'),_0xefaa('0x5e'),_0xefaa('0x5f'),_0xefaa('0x60')]})[_0xefaa('0x26')](handleEntityNotFound(_0x4d5b51,null))[_0xefaa('0x26')](function(_0x5378b8){if(_0x5378b8){_0x3ccc5b=_0x5378b8[_0xefaa('0x59')];var _0x5825f0=_0x3ccc5b[_0xefaa('0x61')](-0x1);if(_0x5825f0==='/'){_0x3ccc5b=_0x3ccc5b[_0xefaa('0x62')](0x0,_0x3ccc5b['lastIndexOf'](_0x5825f0));}var _0x161ab3={'method':_0xefaa('0x63'),'uri':util[_0xefaa('0x64')](_0xefaa('0x65'),_0x3ccc5b),'headers':{'Content-Type':_0xefaa('0x66'),'Accept':_0xefaa('0x66')},'json':!![]};if(_0x5378b8[_0xefaa('0x5a')]===_0xefaa('0x67')){_0x161ab3[_0xefaa('0x68')][_0xefaa('0x69')]=util['format'](_0xefaa('0x6a'),new Buffer(util[_0xefaa('0x64')](_0xefaa('0x6b'),_0x5378b8[_0xefaa('0x5b')],_0x5378b8[_0xefaa('0x5c')]))[_0xefaa('0x6c')]('base64'));}return rp(_0x161ab3)['then'](function(_0x430c8f){return _0x464222[_0xefaa('0x6d')](_[_0xefaa('0x2d')](_0x430c8f[_0xefaa('0x6e')][_0xefaa('0x6f')],function(_0x4054ec){return{'id':_0x4054ec[_0xefaa('0x2a')],'name':_0x4054ec[_0xefaa('0x2a')],'type':_0x4054ec[_0xefaa('0x31')],'active':_0x4054ec['active'],'label':_0x4054ec[_0xefaa('0x70')],'custom':!![]};}));});}})[_0xefaa('0x26')](function(_0x3b87cb){return{'count':_0x3b87cb['length'],'rows':_0x3b87cb};})[_0xefaa('0x26')](respondWithResult(_0x4d5b51,null))['catch'](function(_0x17e917){var _0x492957=_0x22defa[_0xefaa('0x33')]['test']?0x1f4:_0x17e917[_0xefaa('0x71')]||0x1f4;logger[_0xefaa('0x29')](_0xefaa('0x72'),'getFields',_0x492957,JSON[_0xefaa('0x73')](_0x17e917));delete _0x17e917[_0xefaa('0x2a')];if(_0x492957===0x191){_0x492957=0x190;}_0x4d5b51[_0xefaa('0x1a')](_0x492957)[_0xefaa('0x2b')](_0x22defa[_0xefaa('0x33')][_0xefaa('0x74')]?{'message':_0xefaa('0x75'),'statusCode':_0x17e917['statusCode']}:_0x17e917);});}; \ No newline at end of file +var _0xf009=['json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','index','DeskAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','includeAll','include','find','create','body','destroy','getConfigurations','findOne','DeskConfiguration','nolimit','addConfiguration','AccountId','getSubjects','channel','getDescriptions','Descriptions','getFields','priority','remoteUri','authType','consumerSecret','token','tokenSecret','substring','lastIndexOf','GET','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','format','%s:%s','username','password','base64','concat','map','_embedded','entries','active','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xf009,0xcf));var _0x9f00=function(_0x2ff8ae,_0x459670){_0x2ff8ae=_0x2ff8ae-0x0;var _0x52d112=_0xf009[_0x2ff8ae];return _0x52d112;};'use strict';var emlformat=require(_0x9f00('0x0'));var rimraf=require(_0x9f00('0x1'));var zipdir=require(_0x9f00('0x2'));var jsonpatch=require(_0x9f00('0x3'));var rp=require(_0x9f00('0x4'));var moment=require(_0x9f00('0x5'));var BPromise=require(_0x9f00('0x6'));var Mustache=require('mustache');var util=require(_0x9f00('0x7'));var path=require(_0x9f00('0x8'));var sox=require(_0x9f00('0x9'));var csv=require(_0x9f00('0xa'));var ejs=require(_0x9f00('0xb'));var fs=require('fs');var fs_extra=require(_0x9f00('0xc'));var _=require('lodash');var squel=require(_0x9f00('0xd'));var crypto=require('crypto');var jsforce=require(_0x9f00('0xe'));var deskjs=require(_0x9f00('0xf'));var toCsv=require(_0x9f00('0xa'));var querystring=require(_0x9f00('0x10'));var Papa=require('papaparse');var Redis=require(_0x9f00('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9f00('0x12'));var hardwareService=require(_0x9f00('0x13'));var logger=require(_0x9f00('0x14'))(_0x9f00('0x15'));var utils=require('../../config/utils');var config=require(_0x9f00('0x16'));var licenseUtil=require(_0x9f00('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9f00('0x18'));function respondWithStatusCode(_0x54791f,_0x53e81b){_0x53e81b=_0x53e81b||0xcc;return function(_0x39235d){if(_0x39235d){return _0x54791f['sendStatus'](_0x53e81b);}return _0x54791f[_0x9f00('0x19')](_0x53e81b)[_0x9f00('0x1a')]();};}function respondWithResult(_0x480e8b,_0x48dc67){_0x48dc67=_0x48dc67||0xc8;return function(_0xc3cdb){if(_0xc3cdb){return _0x480e8b[_0x9f00('0x19')](_0x48dc67)[_0x9f00('0x1b')](_0xc3cdb);}};}function respondWithFilteredResult(_0x19c642,_0x1dbf63){return function(_0x3b0ead){if(_0x3b0ead){var _0x19777d=typeof _0x1dbf63[_0x9f00('0x1c')]===_0x9f00('0x1d')&&typeof _0x1dbf63['limit']===_0x9f00('0x1d');var _0x45a2dd=_0x3b0ead[_0x9f00('0x1e')];var _0x155324=_0x19777d?0x0:_0x1dbf63[_0x9f00('0x1c')];var _0x5cec2d=_0x19777d?_0x3b0ead[_0x9f00('0x1e')]:_0x1dbf63['offset']+_0x1dbf63[_0x9f00('0x1f')];var _0x187051;if(_0x5cec2d>=_0x45a2dd){_0x5cec2d=_0x45a2dd;_0x187051=0xc8;}else{_0x187051=0xce;}_0x19c642[_0x9f00('0x19')](_0x187051);return _0x19c642[_0x9f00('0x20')](_0x9f00('0x21'),_0x155324+'-'+_0x5cec2d+'/'+_0x45a2dd)[_0x9f00('0x1b')](_0x3b0ead);}return null;};}function patchUpdates(_0x420308){return function(_0xde847d){try{jsonpatch[_0x9f00('0x22')](_0xde847d,_0x420308,!![]);}catch(_0x17aacc){return BPromise[_0x9f00('0x23')](_0x17aacc);}return _0xde847d['save']();};}function saveUpdates(_0x38c0c0,_0x8b7faf){return function(_0x4c844b){if(_0x4c844b){return _0x4c844b[_0x9f00('0x24')](_0x38c0c0)[_0x9f00('0x25')](function(_0x5384e7){return _0x5384e7;});}return null;};}function removeEntity(_0x34487c,_0x45a55b){return function(_0x1ff373){if(_0x1ff373){return _0x1ff373['destroy']()['then'](function(){_0x34487c[_0x9f00('0x19')](0xcc)[_0x9f00('0x1a')]();});}};}function handleEntityNotFound(_0x166cbe,_0x4d0df5){return function(_0x20fcd8){if(!_0x20fcd8){_0x166cbe[_0x9f00('0x26')](0x194);}return _0x20fcd8;};}function handleError(_0x3d83c5,_0x3dbe1a){_0x3dbe1a=_0x3dbe1a||0x1f4;return function(_0x1a7db9){logger[_0x9f00('0x27')](_0x1a7db9[_0x9f00('0x28')]);if(_0x1a7db9['name']){delete _0x1a7db9[_0x9f00('0x29')];}_0x3d83c5[_0x9f00('0x19')](_0x3dbe1a)['send'](_0x1a7db9);};}exports[_0x9f00('0x2a')]=function(_0x1404ca,_0xd31c02){var _0x5d8f67={},_0x1ceaab={},_0x192dd={'count':0x0,'rows':[]};var _0x57006e=_['map'](db[_0x9f00('0x2b')]['rawAttributes'],function(_0x447bf0){return{'name':_0x447bf0[_0x9f00('0x2c')],'type':_0x447bf0[_0x9f00('0x2d')][_0x9f00('0x2e')]};});_0x1ceaab[_0x9f00('0x2f')]=_['map'](_0x57006e,_0x9f00('0x29'));_0x1ceaab[_0x9f00('0x30')]=_[_0x9f00('0x31')](_0x1404ca[_0x9f00('0x30')]);_0x1ceaab[_0x9f00('0x32')]=_[_0x9f00('0x33')](_0x1ceaab[_0x9f00('0x2f')],_0x1ceaab[_0x9f00('0x30')]);_0x5d8f67[_0x9f00('0x34')]=_[_0x9f00('0x33')](_0x1ceaab[_0x9f00('0x2f')],qs[_0x9f00('0x35')](_0x1404ca[_0x9f00('0x30')][_0x9f00('0x35')]));_0x5d8f67[_0x9f00('0x34')]=_0x5d8f67[_0x9f00('0x34')][_0x9f00('0x36')]?_0x5d8f67[_0x9f00('0x34')]:_0x1ceaab[_0x9f00('0x2f')];if(!_0x1404ca[_0x9f00('0x30')][_0x9f00('0x37')]('nolimit')){_0x5d8f67[_0x9f00('0x1f')]=qs[_0x9f00('0x1f')](_0x1404ca[_0x9f00('0x30')][_0x9f00('0x1f')]);_0x5d8f67[_0x9f00('0x1c')]=qs[_0x9f00('0x1c')](_0x1404ca[_0x9f00('0x30')][_0x9f00('0x1c')]);}_0x5d8f67[_0x9f00('0x38')]=qs[_0x9f00('0x39')](_0x1404ca[_0x9f00('0x30')][_0x9f00('0x39')]);_0x5d8f67[_0x9f00('0x3a')]=qs['filters'](_['pick'](_0x1404ca[_0x9f00('0x30')],_0x1ceaab[_0x9f00('0x32')]),_0x57006e);if(_0x1404ca[_0x9f00('0x30')][_0x9f00('0x3b')]){_0x5d8f67[_0x9f00('0x3a')]=_[_0x9f00('0x3c')](_0x5d8f67[_0x9f00('0x3a')],{'$or':_['map'](_0x57006e,function(_0x4bb36b){if(_0x4bb36b[_0x9f00('0x2d')]!==_0x9f00('0x3d')){var _0x468f5e={};_0x468f5e[_0x4bb36b[_0x9f00('0x29')]]={'$like':'%'+_0x1404ca[_0x9f00('0x30')][_0x9f00('0x3b')]+'%'};return _0x468f5e;}})});}_0x5d8f67=_[_0x9f00('0x3c')]({},_0x5d8f67,_0x1404ca[_0x9f00('0x3e')]);var _0x4b06d2={'where':_0x5d8f67[_0x9f00('0x3a')]};return db[_0x9f00('0x2b')][_0x9f00('0x1e')](_0x4b06d2)[_0x9f00('0x25')](function(_0x1b734c){_0x192dd['count']=_0x1b734c;if(_0x1404ca[_0x9f00('0x30')]['includeAll']){_0x5d8f67['include']=[{'all':!![]}];}return db['DeskAccount'][_0x9f00('0x3f')](_0x5d8f67);})[_0x9f00('0x25')](function(_0x2f7a50){_0x192dd[_0x9f00('0x40')]=_0x2f7a50;return _0x192dd;})[_0x9f00('0x25')](respondWithFilteredResult(_0xd31c02,_0x5d8f67))[_0x9f00('0x41')](handleError(_0xd31c02,null));};exports[_0x9f00('0x42')]=function(_0x246802,_0xd039ce){var _0xfc6fe={'raw':![],'where':{'id':_0x246802[_0x9f00('0x43')]['id']}},_0x36c88c={};_0x36c88c[_0x9f00('0x2f')]=_[_0x9f00('0x31')](db['DeskAccount'][_0x9f00('0x44')]);_0x36c88c[_0x9f00('0x30')]=_[_0x9f00('0x31')](_0x246802[_0x9f00('0x30')]);_0x36c88c['filters']=_[_0x9f00('0x33')](_0x36c88c[_0x9f00('0x2f')],_0x36c88c['query']);_0xfc6fe[_0x9f00('0x34')]=_[_0x9f00('0x33')](_0x36c88c[_0x9f00('0x2f')],qs[_0x9f00('0x35')](_0x246802[_0x9f00('0x30')][_0x9f00('0x35')]));_0xfc6fe[_0x9f00('0x34')]=_0xfc6fe['attributes']['length']?_0xfc6fe[_0x9f00('0x34')]:_0x36c88c[_0x9f00('0x2f')];if(_0x246802[_0x9f00('0x30')][_0x9f00('0x45')]){_0xfc6fe[_0x9f00('0x46')]=[{'all':!![]}];}_0xfc6fe=_[_0x9f00('0x3c')]({},_0xfc6fe,_0x246802[_0x9f00('0x3e')]);return db[_0x9f00('0x2b')][_0x9f00('0x47')](_0xfc6fe)[_0x9f00('0x25')](handleEntityNotFound(_0xd039ce,null))[_0x9f00('0x25')](respondWithResult(_0xd039ce,null))['catch'](handleError(_0xd039ce,null));};exports[_0x9f00('0x48')]=function(_0x53c9f7,_0x2edcf8){return db[_0x9f00('0x2b')][_0x9f00('0x48')](_0x53c9f7[_0x9f00('0x49')],{})[_0x9f00('0x25')](respondWithResult(_0x2edcf8,0xc9))[_0x9f00('0x41')](handleError(_0x2edcf8,null));};exports[_0x9f00('0x24')]=function(_0x239227,_0x2a5b4f){if(_0x239227[_0x9f00('0x49')]['id']){delete _0x239227[_0x9f00('0x49')]['id'];}return db[_0x9f00('0x2b')]['find']({'where':{'id':_0x239227['params']['id']}})[_0x9f00('0x25')](handleEntityNotFound(_0x2a5b4f,null))[_0x9f00('0x25')](saveUpdates(_0x239227[_0x9f00('0x49')],null))[_0x9f00('0x25')](respondWithResult(_0x2a5b4f,null))['catch'](handleError(_0x2a5b4f,null));};exports[_0x9f00('0x4a')]=function(_0x35a82c,_0x1af9be){return db[_0x9f00('0x2b')][_0x9f00('0x47')]({'where':{'id':_0x35a82c[_0x9f00('0x43')]['id']}})['then'](handleEntityNotFound(_0x1af9be,null))[_0x9f00('0x25')](removeEntity(_0x1af9be,null))[_0x9f00('0x41')](handleError(_0x1af9be,null));};exports[_0x9f00('0x4b')]=function(_0x4066ac,_0x57a7ee,_0x2b3e4a){var _0x1fb41b={};var _0x507946={};var _0x2e117a;var _0x44b86c;return db['DeskAccount'][_0x9f00('0x4c')]({'where':{'id':_0x4066ac[_0x9f00('0x43')]['id']}})[_0x9f00('0x25')](handleEntityNotFound(_0x57a7ee,null))['then'](function(_0x5d411c){if(_0x5d411c){_0x2e117a=_0x5d411c;_0x507946['model']=_[_0x9f00('0x31')](db[_0x9f00('0x4d')][_0x9f00('0x44')]);_0x507946[_0x9f00('0x30')]=_[_0x9f00('0x31')](_0x4066ac[_0x9f00('0x30')]);_0x507946[_0x9f00('0x32')]=_['intersection'](_0x507946['model'],_0x507946['query']);_0x1fb41b[_0x9f00('0x34')]=_['intersection'](_0x507946['model'],qs[_0x9f00('0x35')](_0x4066ac[_0x9f00('0x30')][_0x9f00('0x35')]));_0x1fb41b[_0x9f00('0x34')]=_0x1fb41b[_0x9f00('0x34')][_0x9f00('0x36')]?_0x1fb41b[_0x9f00('0x34')]:_0x507946['model'];_0x1fb41b[_0x9f00('0x38')]=qs[_0x9f00('0x39')](_0x4066ac[_0x9f00('0x30')][_0x9f00('0x39')]);_0x1fb41b[_0x9f00('0x3a')]=qs[_0x9f00('0x32')](_['pick'](_0x4066ac['query'],_0x507946[_0x9f00('0x32')]));if(_0x4066ac['query']['filter']){_0x1fb41b[_0x9f00('0x3a')]=_['merge'](_0x1fb41b[_0x9f00('0x3a')],{'$or':_['map'](_0x1fb41b[_0x9f00('0x34')],function(_0x1e3f20){var _0x6a4fbd={};_0x6a4fbd[_0x1e3f20]={'$like':'%'+_0x4066ac[_0x9f00('0x30')]['filter']+'%'};return _0x6a4fbd;})});}_0x1fb41b=_[_0x9f00('0x3c')]({},_0x1fb41b,_0x4066ac['options']);return _0x2e117a[_0x9f00('0x4b')](_0x1fb41b);}})[_0x9f00('0x25')](function(_0x3e8af8){if(_0x3e8af8){_0x44b86c=_0x3e8af8[_0x9f00('0x36')];if(!_0x4066ac[_0x9f00('0x30')][_0x9f00('0x37')](_0x9f00('0x4e'))){_0x1fb41b['limit']=qs[_0x9f00('0x1f')](_0x4066ac[_0x9f00('0x30')][_0x9f00('0x1f')]);_0x1fb41b[_0x9f00('0x1c')]=qs[_0x9f00('0x1c')](_0x4066ac[_0x9f00('0x30')][_0x9f00('0x1c')]);}return _0x2e117a[_0x9f00('0x4b')](_0x1fb41b);}})[_0x9f00('0x25')](function(_0x45c252){if(_0x45c252){return _0x45c252?{'count':_0x44b86c,'rows':_0x45c252}:null;}})[_0x9f00('0x25')](respondWithResult(_0x57a7ee,null))[_0x9f00('0x41')](handleError(_0x57a7ee,null));};exports[_0x9f00('0x4f')]=function(_0x1b62c9,_0x106a8c,_0x54603e){if(_0x1b62c9[_0x9f00('0x49')]['id']){delete _0x1b62c9['body']['id'];}return db[_0x9f00('0x2b')][_0x9f00('0x4c')]({'where':{'id':_0x1b62c9[_0x9f00('0x43')]['id']}})[_0x9f00('0x25')](handleEntityNotFound(_0x106a8c,null))[_0x9f00('0x25')](function(_0x27b9ec){if(_0x27b9ec){_0x1b62c9['body'][_0x9f00('0x50')]=_0x27b9ec['id'];_0x1b62c9['body']['Subjects']=integrations[_0x9f00('0x51')](_0x1b62c9[_0x9f00('0x49')][_0x9f00('0x52')],_0x1b62c9[_0x9f00('0x49')][_0x9f00('0x2d')]);_0x1b62c9[_0x9f00('0x49')]['Descriptions']=integrations[_0x9f00('0x53')](_0x1b62c9['body'][_0x9f00('0x52')],_0x1b62c9[_0x9f00('0x49')][_0x9f00('0x2d')]);return db[_0x9f00('0x4d')][_0x9f00('0x48')](_0x1b62c9[_0x9f00('0x49')],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db['DeskField'],'as':_0x9f00('0x54')}]});}return null;})['then'](respondWithResult(_0x106a8c,null))[_0x9f00('0x41')](handleError(_0x106a8c,null));};exports[_0x9f00('0x55')]=function(_0xdb58a2,_0x195604,_0x1128ab){var _0x4403f9=[{'name':_0x9f00('0x56'),'label':_0x9f00('0x56'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x5dcc8e='';return db['DeskAccount']['findOne']({'where':{'id':_0xdb58a2['params']['id']},'attributes':['id',_0x9f00('0x57'),_0x9f00('0x58'),'username','password','consumerKey',_0x9f00('0x59'),_0x9f00('0x5a'),_0x9f00('0x5b')]})[_0x9f00('0x25')](handleEntityNotFound(_0x195604,null))['then'](function(_0x5af32c){if(_0x5af32c){_0x5dcc8e=_0x5af32c[_0x9f00('0x57')];var _0x9668a5=_0x5dcc8e['slice'](-0x1);if(_0x9668a5==='/'){_0x5dcc8e=_0x5dcc8e[_0x9f00('0x5c')](0x0,_0x5dcc8e[_0x9f00('0x5d')](_0x9668a5));}var _0x4c0b8c={'method':_0x9f00('0x5e'),'uri':util['format'](_0x9f00('0x5f'),_0x5dcc8e),'headers':{'Content-Type':_0x9f00('0x60'),'Accept':'application/json'},'json':!![]};if(_0x5af32c[_0x9f00('0x58')]===_0x9f00('0x61')){_0x4c0b8c[_0x9f00('0x62')][_0x9f00('0x63')]=util['format'](_0x9f00('0x64'),new Buffer(util[_0x9f00('0x65')](_0x9f00('0x66'),_0x5af32c[_0x9f00('0x67')],_0x5af32c[_0x9f00('0x68')]))['toString'](_0x9f00('0x69')));}return rp(_0x4c0b8c)[_0x9f00('0x25')](function(_0x59f730){return _0x4403f9[_0x9f00('0x6a')](_[_0x9f00('0x6b')](_0x59f730[_0x9f00('0x6c')][_0x9f00('0x6d')],function(_0x1e58a8){return{'id':_0x1e58a8[_0x9f00('0x29')],'name':_0x1e58a8['name'],'type':_0x1e58a8[_0x9f00('0x2d')],'active':_0x1e58a8[_0x9f00('0x6e')],'label':_0x1e58a8['label'],'custom':!![]};}));});}})[_0x9f00('0x25')](function(_0x147ea0){return{'count':_0x147ea0[_0x9f00('0x36')],'rows':_0x147ea0};})[_0x9f00('0x25')](respondWithResult(_0x195604,null))['catch'](function(_0x46ae6a){var _0x387732=_0xdb58a2[_0x9f00('0x30')]['test']?0x1f4:_0x46ae6a[_0x9f00('0x6f')]||0x1f4;logger['error'](_0x9f00('0x70'),_0x9f00('0x55'),_0x387732,JSON[_0x9f00('0x71')](_0x46ae6a));delete _0x46ae6a[_0x9f00('0x29')];if(_0x387732===0x191){_0x387732=0x190;}_0x195604[_0x9f00('0x19')](_0x387732)[_0x9f00('0x72')](_0xdb58a2['query'][_0x9f00('0x73')]?{'message':_0x9f00('0x74'),'statusCode':_0x46ae6a[_0x9f00('0x6f')]}:_0x46ae6a);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 35ef8a2..ad1202b 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 _0x22ca=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','define','DeskAccount','int_desk_accounts'];(function(_0x113ee2,_0x47ac2f){var _0x311b91=function(_0x172234){while(--_0x172234){_0x113ee2['push'](_0x113ee2['shift']());}};_0x311b91(++_0x47ac2f);}(_0x22ca,0x154));var _0xa22c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x22ca[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xa22c('0x0'));var logger=require(_0xa22c('0x1'))(_0xa22c('0x2'));var moment=require('moment');var BPromise=require(_0xa22c('0x3'));var rp=require(_0xa22c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa22c('0x5'));var config=require(_0xa22c('0x6'));var attributes=require('./intDeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5d472d,_0x4675c1){return _0x5d472d[_0xa22c('0x7')](_0xa22c('0x8'),attributes,{'tableName':_0xa22c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66f8=['int_desk_accounts','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define'];(function(_0x32da28,_0x4b085c){var _0x36f805=function(_0x2cf598){while(--_0x2cf598){_0x32da28['push'](_0x32da28['shift']());}};_0x36f805(++_0x4b085c);}(_0x66f8,0xe5));var _0x866f=function(_0x5ee0b9,_0xa1cf4d){_0x5ee0b9=_0x5ee0b9-0x0;var _0x97037a=_0x66f8[_0x5ee0b9];return _0x97037a;};'use strict';var _=require(_0x866f('0x0'));var util=require(_0x866f('0x1'));var logger=require(_0x866f('0x2'))('api');var moment=require(_0x866f('0x3'));var BPromise=require('bluebird');var rp=require(_0x866f('0x4'));var fs=require('fs');var path=require(_0x866f('0x5'));var rimraf=require(_0x866f('0x6'));var config=require(_0x866f('0x7'));var attributes=require(_0x866f('0x8'));var integrations=require(_0x866f('0x9'));module['exports']=function(_0x3c1d40,_0x309973){return _0x3c1d40[_0x866f('0xa')]('DeskAccount',attributes,{'tableName':_0x866f('0xb'),'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 7f85fb1..030b953 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 _0xb441=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','attributes','limit','include','model','map','ShowDeskAccount','where','debug','lodash'];(function(_0x41e96,_0x4c9b00){var _0x2f16cf=function(_0x3c6cb4){while(--_0x3c6cb4){_0x41e96['push'](_0x41e96['shift']());}};_0x2f16cf(++_0x4c9b00);}(_0xb441,0x1ed));var _0x1b44=function(_0x5aa8e0,_0x1e552c){_0x5aa8e0=_0x5aa8e0-0x0;var _0x4f4060=_0xb441[_0x5aa8e0];return _0x4f4060;};'use strict';var _=require(_0x1b44('0x0'));var util=require(_0x1b44('0x1'));var moment=require(_0x1b44('0x2'));var BPromise=require('bluebird');var rs=require(_0x1b44('0x3'));var fs=require('fs');var Redis=require(_0x1b44('0x4'));var db=require(_0x1b44('0x5'))['db'];var utils=require(_0x1b44('0x6'));var logger=require(_0x1b44('0x7'))(_0x1b44('0x8'));var config=require(_0x1b44('0x9'));var jayson=require(_0x1b44('0xa'));var client=jayson[_0x1b44('0xb')][_0x1b44('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3a9761,_0x97b0ef,_0x15dd12){return new BPromise(function(_0x50f42e,_0xe65a76){return client[_0x1b44('0xd')](_0x3a9761,_0x15dd12)[_0x1b44('0xe')](function(_0x5c5302){logger[_0x1b44('0xf')](_0x1b44('0x10'),_0x97b0ef,'request\x20sent');logger['debug'](_0x1b44('0x11'),_0x97b0ef,_0x1b44('0x12'),JSON[_0x1b44('0x13')](_0x5c5302));if(_0x5c5302[_0x1b44('0x14')]){if(_0x5c5302['error'][_0x1b44('0x15')]===0x1f4){logger[_0x1b44('0x14')](_0x1b44('0x10'),_0x97b0ef,_0x5c5302[_0x1b44('0x14')]['message']);return _0xe65a76(_0x5c5302[_0x1b44('0x14')]['message']);}logger[_0x1b44('0x14')](_0x1b44('0x10'),_0x97b0ef,_0x5c5302[_0x1b44('0x14')][_0x1b44('0x16')]);return _0x50f42e(_0x5c5302[_0x1b44('0x14')][_0x1b44('0x16')]);}else{logger[_0x1b44('0xf')]('DeskAccount,\x20%s,\x20%s',_0x97b0ef,'request\x20sent');_0x50f42e(_0x5c5302[_0x1b44('0x17')][_0x1b44('0x16')]);}})[_0x1b44('0x18')](function(_0x57e30d){logger[_0x1b44('0x14')](_0x1b44('0x10'),_0x97b0ef,_0x57e30d);_0xe65a76(_0x57e30d);});});}exports[_0x1b44('0x19')]=function(_0x58bac9){var _0x2ae088=this;return new Promise(function(_0x3618e4,_0x2edf7e){return db[_0x1b44('0x1a')][_0x1b44('0x1b')]({'raw':_0x58bac9[_0x1b44('0x1c')]?_0x58bac9[_0x1b44('0x1c')][_0x1b44('0x1d')]===undefined?!![]:![]:!![],'where':_0x58bac9[_0x1b44('0x1c')]?_0x58bac9[_0x1b44('0x1c')]['where']||null:null,'attributes':_0x58bac9[_0x1b44('0x1c')]?_0x58bac9[_0x1b44('0x1c')][_0x1b44('0x1e')]||null:null,'limit':_0x58bac9['options']?_0x58bac9[_0x1b44('0x1c')][_0x1b44('0x1f')]||null:null,'include':_0x58bac9[_0x1b44('0x1c')]?_0x58bac9['options'][_0x1b44('0x20')]?_['map'](_0x58bac9[_0x1b44('0x1c')][_0x1b44('0x20')],function(_0x58f4f0){return{'model':db[_0x58f4f0[_0x1b44('0x21')]],'as':_0x58f4f0['as'],'attributes':_0x58f4f0['attributes'],'include':_0x58f4f0[_0x1b44('0x20')]?_['map'](_0x58f4f0[_0x1b44('0x20')],function(_0x2d24c4){return{'model':db[_0x2d24c4['model']],'as':_0x2d24c4['as'],'attributes':_0x2d24c4['attributes'],'include':_0x2d24c4[_0x1b44('0x20')]?_[_0x1b44('0x22')](_0x2d24c4['include'],function(_0x560721){return{'model':db[_0x560721['model']],'as':_0x560721['as'],'attributes':_0x560721[_0x1b44('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1b44('0xe')](function(_0x3cd02f){logger[_0x1b44('0xf')](_0x1b44('0x19'),_0x58bac9);logger['debug']('GetDeskAccount',_0x58bac9,JSON[_0x1b44('0x13')](_0x3cd02f));_0x3618e4(_0x3cd02f);})[_0x1b44('0x18')](function(_0x564c69){logger[_0x1b44('0x14')](_0x1b44('0x19'),_0x564c69[_0x1b44('0x16')],_0x58bac9);_0x2edf7e(_0x2ae088['error'](0x1f4,_0x564c69[_0x1b44('0x16')]));});});};exports[_0x1b44('0x23')]=function(_0x149593){var _0x49c42c=this;return new Promise(function(_0x6e6d2d,_0x39dc8f){return db[_0x1b44('0x1a')]['find']({'raw':_0x149593[_0x1b44('0x1c')]?_0x149593['options'][_0x1b44('0x1d')]===undefined?!![]:![]:!![],'where':_0x149593['options']?_0x149593[_0x1b44('0x1c')][_0x1b44('0x24')]||null:null,'attributes':_0x149593[_0x1b44('0x1c')]?_0x149593[_0x1b44('0x1c')][_0x1b44('0x1e')]||null:null,'include':_0x149593[_0x1b44('0x1c')]?_0x149593[_0x1b44('0x1c')][_0x1b44('0x20')]?_[_0x1b44('0x22')](_0x149593[_0x1b44('0x1c')][_0x1b44('0x20')],function(_0x57edee){return{'model':db[_0x57edee['model']],'as':_0x57edee['as'],'attributes':_0x57edee[_0x1b44('0x1e')],'include':_0x57edee[_0x1b44('0x20')]?_[_0x1b44('0x22')](_0x57edee[_0x1b44('0x20')],function(_0x550e99){return{'model':db[_0x550e99[_0x1b44('0x21')]],'as':_0x550e99['as'],'attributes':_0x550e99[_0x1b44('0x1e')],'include':_0x550e99[_0x1b44('0x20')]?_[_0x1b44('0x22')](_0x550e99['include'],function(_0x181058){return{'model':db[_0x181058[_0x1b44('0x21')]],'as':_0x181058['as'],'attributes':_0x181058['attributes']};}):[]};}):[]};}):[]:[]})[_0x1b44('0xe')](function(_0x2e23c3){logger['info'](_0x1b44('0x23'),_0x149593);logger[_0x1b44('0x25')](_0x1b44('0x23'),_0x149593,JSON[_0x1b44('0x13')](_0x2e23c3));_0x6e6d2d(_0x2e23c3);})['catch'](function(_0x37f512){logger['error']('ShowDeskAccount',_0x37f512[_0x1b44('0x16')],_0x149593);_0x39dc8f(_0x49c42c[_0x1b44('0x14')](0x1f4,_0x37f512[_0x1b44('0x16')]));});});}; \ No newline at end of file +var _0x307a=['limit','include','model','attributes','GetDeskAccount','ShowDeskAccount','find','map','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','DeskAccount','findAll','options','raw','where'];(function(_0x4c7c25,_0x1e16a8){var _0x297619=function(_0x453f76){while(--_0x453f76){_0x4c7c25['push'](_0x4c7c25['shift']());}};_0x297619(++_0x1e16a8);}(_0x307a,0x189));var _0xa307=function(_0x2afe16,_0x29a39c){_0x2afe16=_0x2afe16-0x0;var _0x649df=_0x307a[_0x2afe16];return _0x649df;};'use strict';var _=require(_0xa307('0x0'));var util=require(_0xa307('0x1'));var moment=require(_0xa307('0x2'));var BPromise=require('bluebird');var rs=require(_0xa307('0x3'));var fs=require('fs');var Redis=require(_0xa307('0x4'));var db=require(_0xa307('0x5'))['db'];var utils=require(_0xa307('0x6'));var logger=require(_0xa307('0x7'))(_0xa307('0x8'));var config=require('../../config/environment');var jayson=require(_0xa307('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x30b798,_0x29ed30,_0xcc2a26){return new BPromise(function(_0x23cce2,_0x3921f7){return client[_0xa307('0xa')](_0x30b798,_0xcc2a26)[_0xa307('0xb')](function(_0x3bd5e4){logger['info'](_0xa307('0xc'),_0x29ed30,_0xa307('0xd'));logger[_0xa307('0xe')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x29ed30,'request\x20sent',JSON[_0xa307('0xf')](_0x3bd5e4));if(_0x3bd5e4[_0xa307('0x10')]){if(_0x3bd5e4[_0xa307('0x10')][_0xa307('0x11')]===0x1f4){logger[_0xa307('0x10')](_0xa307('0xc'),_0x29ed30,_0x3bd5e4['error'][_0xa307('0x12')]);return _0x3921f7(_0x3bd5e4[_0xa307('0x10')][_0xa307('0x12')]);}logger[_0xa307('0x10')](_0xa307('0xc'),_0x29ed30,_0x3bd5e4[_0xa307('0x10')][_0xa307('0x12')]);return _0x23cce2(_0x3bd5e4['error']['message']);}else{logger[_0xa307('0x13')]('DeskAccount,\x20%s,\x20%s',_0x29ed30,_0xa307('0xd'));_0x23cce2(_0x3bd5e4[_0xa307('0x14')]['message']);}})[_0xa307('0x15')](function(_0x3d8e38){logger['error'](_0xa307('0xc'),_0x29ed30,_0x3d8e38);_0x3921f7(_0x3d8e38);});});}exports['GetDeskAccount']=function(_0x53ff37){var _0x336b39=this;return new Promise(function(_0x12b0c9,_0x35b738){return db[_0xa307('0x16')][_0xa307('0x17')]({'raw':_0x53ff37[_0xa307('0x18')]?_0x53ff37[_0xa307('0x18')][_0xa307('0x19')]===undefined?!![]:![]:!![],'where':_0x53ff37[_0xa307('0x18')]?_0x53ff37[_0xa307('0x18')][_0xa307('0x1a')]||null:null,'attributes':_0x53ff37[_0xa307('0x18')]?_0x53ff37[_0xa307('0x18')]['attributes']||null:null,'limit':_0x53ff37[_0xa307('0x18')]?_0x53ff37['options'][_0xa307('0x1b')]||null:null,'include':_0x53ff37[_0xa307('0x18')]?_0x53ff37['options'][_0xa307('0x1c')]?_['map'](_0x53ff37['options']['include'],function(_0x499443){return{'model':db[_0x499443[_0xa307('0x1d')]],'as':_0x499443['as'],'attributes':_0x499443[_0xa307('0x1e')],'include':_0x499443[_0xa307('0x1c')]?_['map'](_0x499443[_0xa307('0x1c')],function(_0x1abde4){return{'model':db[_0x1abde4[_0xa307('0x1d')]],'as':_0x1abde4['as'],'attributes':_0x1abde4[_0xa307('0x1e')],'include':_0x1abde4[_0xa307('0x1c')]?_['map'](_0x1abde4[_0xa307('0x1c')],function(_0x1b0500){return{'model':db[_0x1b0500[_0xa307('0x1d')]],'as':_0x1b0500['as'],'attributes':_0x1b0500[_0xa307('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa307('0xb')](function(_0xe626ca){logger[_0xa307('0x13')](_0xa307('0x1f'),_0x53ff37);logger[_0xa307('0xe')](_0xa307('0x1f'),_0x53ff37,JSON[_0xa307('0xf')](_0xe626ca));_0x12b0c9(_0xe626ca);})['catch'](function(_0x5a0875){logger[_0xa307('0x10')](_0xa307('0x1f'),_0x5a0875['message'],_0x53ff37);_0x35b738(_0x336b39[_0xa307('0x10')](0x1f4,_0x5a0875['message']));});});};exports[_0xa307('0x20')]=function(_0x9a61dc){var _0x4e27f0=this;return new Promise(function(_0x46d2fa,_0x5d164c){return db['DeskAccount'][_0xa307('0x21')]({'raw':_0x9a61dc[_0xa307('0x18')]?_0x9a61dc[_0xa307('0x18')][_0xa307('0x19')]===undefined?!![]:![]:!![],'where':_0x9a61dc[_0xa307('0x18')]?_0x9a61dc[_0xa307('0x18')]['where']||null:null,'attributes':_0x9a61dc[_0xa307('0x18')]?_0x9a61dc[_0xa307('0x18')][_0xa307('0x1e')]||null:null,'include':_0x9a61dc[_0xa307('0x18')]?_0x9a61dc[_0xa307('0x18')][_0xa307('0x1c')]?_[_0xa307('0x22')](_0x9a61dc[_0xa307('0x18')][_0xa307('0x1c')],function(_0x3f78b4){return{'model':db[_0x3f78b4[_0xa307('0x1d')]],'as':_0x3f78b4['as'],'attributes':_0x3f78b4[_0xa307('0x1e')],'include':_0x3f78b4[_0xa307('0x1c')]?_[_0xa307('0x22')](_0x3f78b4[_0xa307('0x1c')],function(_0x5e46e9){return{'model':db[_0x5e46e9[_0xa307('0x1d')]],'as':_0x5e46e9['as'],'attributes':_0x5e46e9['attributes'],'include':_0x5e46e9['include']?_['map'](_0x5e46e9[_0xa307('0x1c')],function(_0x9e9fc4){return{'model':db[_0x9e9fc4[_0xa307('0x1d')]],'as':_0x9e9fc4['as'],'attributes':_0x9e9fc4[_0xa307('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa307('0xb')](function(_0x3312d6){logger['info']('ShowDeskAccount',_0x9a61dc);logger['debug'](_0xa307('0x20'),_0x9a61dc,JSON[_0xa307('0xf')](_0x3312d6));_0x46d2fa(_0x3312d6);})[_0xa307('0x15')](function(_0x1eb45a){logger[_0xa307('0x10')](_0xa307('0x20'),_0x1eb45a[_0xa307('0x12')],_0x9a61dc);_0x5d164c(_0x4e27f0['error'](0x1f4,_0x1eb45a[_0xa307('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index f586f0a..d049e68 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x371d15,_0xd98587){var _0x32afdf=function(_0x587ba3){while(--_0x587ba3){_0x371d15['push'](_0x371d15['shift']());}};_0x32afdf(++_0xd98587);}(_0x55ca,0x126));var _0xa55c=function(_0x4cdcdc,_0x34eac7){_0x4cdcdc=_0x4cdcdc-0x0;var _0x4704ce=_0x55ca[_0x4cdcdc];return _0x4704ce;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file +var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x2cb3eb,_0x4d83aa){var _0x2759ee=function(_0x4108a0){while(--_0x4108a0){_0x2cb3eb['push'](_0x2cb3eb['shift']());}};_0x2759ee(++_0x4d83aa);}(_0x55ca,0x126));var _0xa55c=function(_0x114c1c,_0x5bfd6d){_0x114c1c=_0x114c1c-0x0;var _0x50a0a6=_0x55ca[_0x114c1c];return _0x50a0a6;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index f8a9c74..f1084d2 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 _0x7cc8=['STRING','exports'];(function(_0x5872bb,_0x4bc758){var _0x392d2c=function(_0xf719c6){while(--_0xf719c6){_0x5872bb['push'](_0x5872bb['shift']());}};_0x392d2c(++_0x4bc758);}(_0x7cc8,0xf1));var _0x87cc=function(_0x2c4dd3,_0x16393d){_0x2c4dd3=_0x2c4dd3-0x0;var _0x2dd1dc=_0x7cc8[_0x2c4dd3];return _0x2dd1dc;};'use strict';var Sequelize=require('sequelize');module[_0x87cc('0x0')]={'name':{'type':Sequelize[_0x87cc('0x1')]},'description':{'type':Sequelize[_0x87cc('0x1')]}}; \ No newline at end of file +var _0x11e7=['STRING','sequelize','exports'];(function(_0x5676e6,_0x3af67d){var _0x4401a2=function(_0x436998){while(--_0x436998){_0x5676e6['push'](_0x5676e6['shift']());}};_0x4401a2(++_0x3af67d);}(_0x11e7,0x1ba));var _0x711e=function(_0x694277,_0x2e03a3){_0x694277=_0x694277-0x0;var _0x1e2511=_0x11e7[_0x694277];return _0x1e2511;};'use strict';var Sequelize=require(_0x711e('0x0'));module[_0x711e('0x1')]={'name':{'type':Sequelize[_0x711e('0x2')]},'description':{'type':Sequelize[_0x711e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 298ff01..7a838e0 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 _0x530d=['DeskConfiguration','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','nolimit','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','getFields','findOne','length','order','hasOwnProperty','DeskField','getTags','setTags','eml-format','rimraf','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','update','then','destroy','error','name','send','index','map'];(function(_0x2866c7,_0x197fdd){var _0x3c5db2=function(_0x5f40db){while(--_0x5f40db){_0x2866c7['push'](_0x2866c7['shift']());}};_0x3c5db2(++_0x197fdd);}(_0x530d,0xb5));var _0xd530=function(_0x4745b3,_0x4a3abc){_0x4745b3=_0x4745b3-0x0;var _0x575273=_0x530d[_0x4745b3];return _0x575273;};'use strict';var emlformat=require(_0xd530('0x0'));var rimraf=require(_0xd530('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd530('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd530('0x3'));var Mustache=require(_0xd530('0x4'));var util=require('util');var path=require('path');var sox=require(_0xd530('0x5'));var csv=require(_0xd530('0x6'));var ejs=require(_0xd530('0x7'));var fs=require('fs');var fs_extra=require(_0xd530('0x8'));var _=require('lodash');var squel=require(_0xd530('0x9'));var crypto=require(_0xd530('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd530('0xb'));var toCsv=require(_0xd530('0x6'));var querystring=require(_0xd530('0xc'));var Papa=require('papaparse');var Redis=require(_0xd530('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd530('0xe'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd530('0xf'));var licenseUtil=require(_0xd530('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xae302b,_0x4cd7f1){_0x4cd7f1=_0x4cd7f1||0xcc;return function(_0x4bada8){if(_0x4bada8){return _0xae302b[_0xd530('0x11')](_0x4cd7f1);}return _0xae302b[_0xd530('0x12')](_0x4cd7f1)[_0xd530('0x13')]();};}function respondWithResult(_0x45aa5c,_0x3e1843){_0x3e1843=_0x3e1843||0xc8;return function(_0x52191f){if(_0x52191f){return _0x45aa5c[_0xd530('0x12')](_0x3e1843)['json'](_0x52191f);}};}function respondWithFilteredResult(_0x23b45d,_0x2704bf){return function(_0x58b9cc){if(_0x58b9cc){var _0x48e5cb=typeof _0x2704bf[_0xd530('0x14')]===_0xd530('0x15')&&typeof _0x2704bf[_0xd530('0x16')]===_0xd530('0x15');var _0x1f2ec3=_0x58b9cc[_0xd530('0x17')];var _0x42ab45=_0x48e5cb?0x0:_0x2704bf[_0xd530('0x14')];var _0x148a52=_0x48e5cb?_0x58b9cc[_0xd530('0x17')]:_0x2704bf[_0xd530('0x14')]+_0x2704bf[_0xd530('0x16')];var _0x32b4a7;if(_0x148a52>=_0x1f2ec3){_0x148a52=_0x1f2ec3;_0x32b4a7=0xc8;}else{_0x32b4a7=0xce;}_0x23b45d[_0xd530('0x12')](_0x32b4a7);return _0x23b45d['set'](_0xd530('0x18'),_0x42ab45+'-'+_0x148a52+'/'+_0x1f2ec3)[_0xd530('0x19')](_0x58b9cc);}return null;};}function patchUpdates(_0x432bc4){return function(_0x191186){try{jsonpatch[_0xd530('0x1a')](_0x191186,_0x432bc4,!![]);}catch(_0x51a132){return BPromise['reject'](_0x51a132);}return _0x191186['save']();};}function saveUpdates(_0x3455f7,_0x1d5395){return function(_0x50bf27){if(_0x50bf27){return _0x50bf27[_0xd530('0x1b')](_0x3455f7)[_0xd530('0x1c')](function(_0x228900){return _0x228900;});}return null;};}function removeEntity(_0x12253e,_0x50bc84){return function(_0x476812){if(_0x476812){return _0x476812[_0xd530('0x1d')]()[_0xd530('0x1c')](function(){_0x12253e['status'](0xcc)[_0xd530('0x13')]();});}};}function handleEntityNotFound(_0x3d9ca7,_0x341085){return function(_0x5b8b98){if(!_0x5b8b98){_0x3d9ca7[_0xd530('0x11')](0x194);}return _0x5b8b98;};}function handleError(_0x20f1f2,_0x4313aa){_0x4313aa=_0x4313aa||0x1f4;return function(_0x47a63b){logger[_0xd530('0x1e')](_0x47a63b['stack']);if(_0x47a63b[_0xd530('0x1f')]){delete _0x47a63b['name'];}_0x20f1f2[_0xd530('0x12')](_0x4313aa)[_0xd530('0x20')](_0x47a63b);};}exports[_0xd530('0x21')]=function(_0x2e2535,_0x52d067){var _0x402353={},_0x26cae1={},_0x49181={'count':0x0,'rows':[]};var _0x4ec5cc=_[_0xd530('0x22')](db[_0xd530('0x23')][_0xd530('0x24')],function(_0x1b52e4){return{'name':_0x1b52e4[_0xd530('0x25')],'type':_0x1b52e4['type'][_0xd530('0x26')]};});_0x26cae1['model']=_[_0xd530('0x22')](_0x4ec5cc,_0xd530('0x1f'));_0x26cae1[_0xd530('0x27')]=_['keys'](_0x2e2535['query']);_0x26cae1[_0xd530('0x28')]=_[_0xd530('0x29')](_0x26cae1[_0xd530('0x2a')],_0x26cae1['query']);_0x402353[_0xd530('0x2b')]=_[_0xd530('0x29')](_0x26cae1['model'],qs['fields'](_0x2e2535['query'][_0xd530('0x2c')]));_0x402353[_0xd530('0x2b')]=_0x402353[_0xd530('0x2b')]['length']?_0x402353[_0xd530('0x2b')]:_0x26cae1[_0xd530('0x2a')];if(!_0x2e2535[_0xd530('0x27')]['hasOwnProperty'](_0xd530('0x2d'))){_0x402353[_0xd530('0x16')]=qs['limit'](_0x2e2535[_0xd530('0x27')]['limit']);_0x402353[_0xd530('0x14')]=qs[_0xd530('0x14')](_0x2e2535[_0xd530('0x27')]['offset']);}_0x402353['order']=qs[_0xd530('0x2e')](_0x2e2535[_0xd530('0x27')]['sort']);_0x402353['where']=qs[_0xd530('0x28')](_[_0xd530('0x2f')](_0x2e2535[_0xd530('0x27')],_0x26cae1[_0xd530('0x28')]),_0x4ec5cc);if(_0x2e2535['query'][_0xd530('0x30')]){_0x402353[_0xd530('0x31')]=_[_0xd530('0x32')](_0x402353[_0xd530('0x31')],{'$or':_[_0xd530('0x22')](_0x4ec5cc,function(_0x588efb){if(_0x588efb[_0xd530('0x33')]!=='VIRTUAL'){var _0x1b5c64={};_0x1b5c64[_0x588efb['name']]={'$like':'%'+_0x2e2535[_0xd530('0x27')][_0xd530('0x30')]+'%'};return _0x1b5c64;}})});}_0x402353=_[_0xd530('0x32')]({},_0x402353,_0x2e2535[_0xd530('0x34')]);var _0x173078={'where':_0x402353[_0xd530('0x31')]};return db[_0xd530('0x23')]['count'](_0x173078)[_0xd530('0x1c')](function(_0x18ae77){_0x49181['count']=_0x18ae77;if(_0x2e2535[_0xd530('0x27')][_0xd530('0x35')]){_0x402353[_0xd530('0x36')]=[{'all':!![]}];}return db[_0xd530('0x23')][_0xd530('0x37')](_0x402353);})[_0xd530('0x1c')](function(_0x5bc97c){_0x49181[_0xd530('0x38')]=_0x5bc97c;return _0x49181;})[_0xd530('0x1c')](respondWithFilteredResult(_0x52d067,_0x402353))[_0xd530('0x39')](handleError(_0x52d067,null));};exports[_0xd530('0x3a')]=function(_0x505db4,_0x3f99cb){var _0xbdf85f={'raw':![],'where':{'id':_0x505db4[_0xd530('0x3b')]['id']}},_0x3ca280={};_0x3ca280[_0xd530('0x2a')]=_[_0xd530('0x3c')](db[_0xd530('0x23')][_0xd530('0x24')]);_0x3ca280['query']=_['keys'](_0x505db4[_0xd530('0x27')]);_0x3ca280[_0xd530('0x28')]=_['intersection'](_0x3ca280['model'],_0x3ca280['query']);_0xbdf85f[_0xd530('0x2b')]=_['intersection'](_0x3ca280[_0xd530('0x2a')],qs[_0xd530('0x2c')](_0x505db4[_0xd530('0x27')]['fields']));_0xbdf85f[_0xd530('0x2b')]=_0xbdf85f['attributes']['length']?_0xbdf85f[_0xd530('0x2b')]:_0x3ca280[_0xd530('0x2a')];if(_0x505db4['query'][_0xd530('0x35')]){_0xbdf85f[_0xd530('0x36')]=[{'all':!![]}];}_0xbdf85f=_['merge']({},_0xbdf85f,_0x505db4[_0xd530('0x34')]);return db['DeskConfiguration']['find'](_0xbdf85f)['then'](handleEntityNotFound(_0x3f99cb,null))[_0xd530('0x1c')](respondWithResult(_0x3f99cb,null))['catch'](handleError(_0x3f99cb,null));};exports[_0xd530('0x3d')]=function(_0x1357e3,_0x3b29f9){return db[_0xd530('0x23')][_0xd530('0x3d')](_0x1357e3[_0xd530('0x3e')],{})[_0xd530('0x1c')](respondWithResult(_0x3b29f9,0xc9))[_0xd530('0x39')](handleError(_0x3b29f9,null));};exports['update']=function(_0x4ddba3,_0x177389){if(_0x4ddba3[_0xd530('0x3e')]['id']){delete _0x4ddba3[_0xd530('0x3e')]['id'];}return db[_0xd530('0x23')][_0xd530('0x3f')]({'where':{'id':_0x4ddba3[_0xd530('0x3b')]['id']}})[_0xd530('0x1c')](handleEntityNotFound(_0x177389,null))[_0xd530('0x1c')](saveUpdates(_0x4ddba3[_0xd530('0x3e')],null))['then'](respondWithResult(_0x177389,null))[_0xd530('0x39')](handleError(_0x177389,null));};exports[_0xd530('0x1d')]=function(_0x4ddd64,_0x2ca8f7){return db[_0xd530('0x23')]['find']({'where':{'id':_0x4ddd64[_0xd530('0x3b')]['id']}})[_0xd530('0x1c')](handleEntityNotFound(_0x2ca8f7,null))[_0xd530('0x1c')](removeEntity(_0x2ca8f7,null))[_0xd530('0x39')](handleError(_0x2ca8f7,null));};exports[_0xd530('0x40')]=function(_0x44d1e7,_0x373263,_0xecdc78){var _0x1a2eff={};var _0x386bba={};var _0xa8c37e;var _0x165c19;return db[_0xd530('0x23')][_0xd530('0x41')]({'where':{'id':_0x44d1e7[_0xd530('0x3b')]['id']}})[_0xd530('0x1c')](handleEntityNotFound(_0x373263,null))[_0xd530('0x1c')](function(_0x3fc0c7){if(_0x3fc0c7){_0xa8c37e=_0x3fc0c7;_0x386bba['model']=_[_0xd530('0x3c')](db['DeskField']['rawAttributes']);_0x386bba[_0xd530('0x27')]=_[_0xd530('0x3c')](_0x44d1e7[_0xd530('0x27')]);_0x386bba[_0xd530('0x28')]=_[_0xd530('0x29')](_0x386bba[_0xd530('0x2a')],_0x386bba[_0xd530('0x27')]);_0x1a2eff['attributes']=_[_0xd530('0x29')](_0x386bba['model'],qs[_0xd530('0x2c')](_0x44d1e7[_0xd530('0x27')]['fields']));_0x1a2eff[_0xd530('0x2b')]=_0x1a2eff['attributes'][_0xd530('0x42')]?_0x1a2eff[_0xd530('0x2b')]:_0x386bba[_0xd530('0x2a')];_0x1a2eff[_0xd530('0x43')]=qs[_0xd530('0x2e')](_0x44d1e7['query']['sort']);_0x1a2eff[_0xd530('0x31')]=qs[_0xd530('0x28')](_[_0xd530('0x2f')](_0x44d1e7[_0xd530('0x27')],_0x386bba['filters']));if(_0x44d1e7[_0xd530('0x27')][_0xd530('0x30')]){_0x1a2eff[_0xd530('0x31')]=_[_0xd530('0x32')](_0x1a2eff['where'],{'$or':_['map'](_0x1a2eff[_0xd530('0x2b')],function(_0x4808b4){var _0xc32dca={};_0xc32dca[_0x4808b4]={'$like':'%'+_0x44d1e7[_0xd530('0x27')]['filter']+'%'};return _0xc32dca;})});}_0x1a2eff=_[_0xd530('0x32')]({},_0x1a2eff,_0x44d1e7[_0xd530('0x34')]);return _0xa8c37e[_0xd530('0x40')](_0x1a2eff);}})['then'](function(_0x27e52b){if(_0x27e52b){_0x165c19=_0x27e52b[_0xd530('0x42')];if(!_0x44d1e7[_0xd530('0x27')]['hasOwnProperty'](_0xd530('0x2d'))){_0x1a2eff[_0xd530('0x16')]=qs[_0xd530('0x16')](_0x44d1e7['query']['limit']);_0x1a2eff[_0xd530('0x14')]=qs[_0xd530('0x14')](_0x44d1e7[_0xd530('0x27')][_0xd530('0x14')]);}return _0xa8c37e['getFields'](_0x1a2eff);}})[_0xd530('0x1c')](function(_0x159be1){if(_0x159be1){return _0x159be1?{'count':_0x165c19,'rows':_0x159be1}:null;}})[_0xd530('0x1c')](respondWithResult(_0x373263,null))['catch'](handleError(_0x373263,null));};exports['getSubjects']=function(_0x3d1dd2,_0x41e527,_0x20ae0d){var _0x1ee5f1={};var _0x79f030={};var _0x3e9fb6;var _0x48ff95;return db[_0xd530('0x23')][_0xd530('0x41')]({'where':{'id':_0x3d1dd2[_0xd530('0x3b')]['id']}})['then'](handleEntityNotFound(_0x41e527,null))[_0xd530('0x1c')](function(_0x20510d){if(_0x20510d){_0x3e9fb6=_0x20510d;_0x79f030[_0xd530('0x2a')]=_['keys'](db['DeskField'][_0xd530('0x24')]);_0x79f030[_0xd530('0x27')]=_[_0xd530('0x3c')](_0x3d1dd2[_0xd530('0x27')]);_0x79f030['filters']=_['intersection'](_0x79f030[_0xd530('0x2a')],_0x79f030['query']);_0x1ee5f1[_0xd530('0x2b')]=_['intersection'](_0x79f030[_0xd530('0x2a')],qs[_0xd530('0x2c')](_0x3d1dd2[_0xd530('0x27')][_0xd530('0x2c')]));_0x1ee5f1['attributes']=_0x1ee5f1[_0xd530('0x2b')]['length']?_0x1ee5f1[_0xd530('0x2b')]:_0x79f030[_0xd530('0x2a')];_0x1ee5f1['order']=qs['sort'](_0x3d1dd2[_0xd530('0x27')][_0xd530('0x2e')]);_0x1ee5f1['where']=qs['filters'](_['pick'](_0x3d1dd2[_0xd530('0x27')],_0x79f030[_0xd530('0x28')]));if(_0x3d1dd2[_0xd530('0x27')][_0xd530('0x30')]){_0x1ee5f1[_0xd530('0x31')]=_['merge'](_0x1ee5f1['where'],{'$or':_[_0xd530('0x22')](_0x1ee5f1[_0xd530('0x2b')],function(_0x48ea93){var _0x5caddd={};_0x5caddd[_0x48ea93]={'$like':'%'+_0x3d1dd2['query']['filter']+'%'};return _0x5caddd;})});}_0x1ee5f1=_[_0xd530('0x32')]({},_0x1ee5f1,_0x3d1dd2[_0xd530('0x34')]);return _0x3e9fb6['getSubjects'](_0x1ee5f1);}})[_0xd530('0x1c')](function(_0x5bbe4e){if(_0x5bbe4e){_0x48ff95=_0x5bbe4e[_0xd530('0x42')];if(!_0x3d1dd2[_0xd530('0x27')][_0xd530('0x44')]('nolimit')){_0x1ee5f1[_0xd530('0x16')]=qs[_0xd530('0x16')](_0x3d1dd2['query']['limit']);_0x1ee5f1[_0xd530('0x14')]=qs[_0xd530('0x14')](_0x3d1dd2['query'][_0xd530('0x14')]);}return _0x3e9fb6['getSubjects'](_0x1ee5f1);}})[_0xd530('0x1c')](function(_0x23d009){if(_0x23d009){return _0x23d009?{'count':_0x48ff95,'rows':_0x23d009}:null;}})[_0xd530('0x1c')](respondWithResult(_0x41e527,null))['catch'](handleError(_0x41e527,null));};exports['getDescriptions']=function(_0x3c3d36,_0xb031ce,_0x4cedea){var _0x2a6f95={};var _0x5c5e0f={};var _0x522ca6;var _0x2f5180;return db['DeskConfiguration'][_0xd530('0x41')]({'where':{'id':_0x3c3d36[_0xd530('0x3b')]['id']}})[_0xd530('0x1c')](handleEntityNotFound(_0xb031ce,null))['then'](function(_0xbca5be){if(_0xbca5be){_0x522ca6=_0xbca5be;_0x5c5e0f['model']=_['keys'](db[_0xd530('0x45')][_0xd530('0x24')]);_0x5c5e0f[_0xd530('0x27')]=_[_0xd530('0x3c')](_0x3c3d36[_0xd530('0x27')]);_0x5c5e0f[_0xd530('0x28')]=_[_0xd530('0x29')](_0x5c5e0f[_0xd530('0x2a')],_0x5c5e0f[_0xd530('0x27')]);_0x2a6f95[_0xd530('0x2b')]=_[_0xd530('0x29')](_0x5c5e0f[_0xd530('0x2a')],qs['fields'](_0x3c3d36['query'][_0xd530('0x2c')]));_0x2a6f95['attributes']=_0x2a6f95[_0xd530('0x2b')]['length']?_0x2a6f95[_0xd530('0x2b')]:_0x5c5e0f[_0xd530('0x2a')];_0x2a6f95[_0xd530('0x43')]=qs[_0xd530('0x2e')](_0x3c3d36[_0xd530('0x27')][_0xd530('0x2e')]);_0x2a6f95[_0xd530('0x31')]=qs['filters'](_['pick'](_0x3c3d36[_0xd530('0x27')],_0x5c5e0f[_0xd530('0x28')]));if(_0x3c3d36[_0xd530('0x27')][_0xd530('0x30')]){_0x2a6f95[_0xd530('0x31')]=_['merge'](_0x2a6f95[_0xd530('0x31')],{'$or':_[_0xd530('0x22')](_0x2a6f95['attributes'],function(_0x29e80e){var _0x190c4c={};_0x190c4c[_0x29e80e]={'$like':'%'+_0x3c3d36['query']['filter']+'%'};return _0x190c4c;})});}_0x2a6f95=_['merge']({},_0x2a6f95,_0x3c3d36[_0xd530('0x34')]);return _0x522ca6['getDescriptions'](_0x2a6f95);}})['then'](function(_0x2d4c0b){if(_0x2d4c0b){_0x2f5180=_0x2d4c0b[_0xd530('0x42')];if(!_0x3c3d36['query'][_0xd530('0x44')](_0xd530('0x2d'))){_0x2a6f95[_0xd530('0x16')]=qs[_0xd530('0x16')](_0x3c3d36[_0xd530('0x27')][_0xd530('0x16')]);_0x2a6f95['offset']=qs['offset'](_0x3c3d36[_0xd530('0x27')][_0xd530('0x14')]);}return _0x522ca6['getDescriptions'](_0x2a6f95);}})[_0xd530('0x1c')](function(_0x49450e){if(_0x49450e){return _0x49450e?{'count':_0x2f5180,'rows':_0x49450e}:null;}})['then'](respondWithResult(_0xb031ce,null))[_0xd530('0x39')](handleError(_0xb031ce,null));};exports['getTags']=function(_0x40a1cc,_0x217442,_0x52c11f){var _0x9ab62a={};var _0x3c98a3={};var _0x1d43c9;var _0x5370af;return db[_0xd530('0x23')][_0xd530('0x41')]({'where':{'id':_0x40a1cc['params']['id']}})[_0xd530('0x1c')](handleEntityNotFound(_0x217442,null))[_0xd530('0x1c')](function(_0x4b6add){if(_0x4b6add){_0x1d43c9=_0x4b6add;_0x3c98a3[_0xd530('0x2a')]=_[_0xd530('0x3c')](db['Tag']['rawAttributes']);_0x3c98a3[_0xd530('0x27')]=_['keys'](_0x40a1cc[_0xd530('0x27')]);_0x3c98a3[_0xd530('0x28')]=_[_0xd530('0x29')](_0x3c98a3[_0xd530('0x2a')],_0x3c98a3[_0xd530('0x27')]);_0x9ab62a[_0xd530('0x2b')]=_[_0xd530('0x29')](_0x3c98a3[_0xd530('0x2a')],qs[_0xd530('0x2c')](_0x40a1cc[_0xd530('0x27')][_0xd530('0x2c')]));_0x9ab62a[_0xd530('0x2b')]=_0x9ab62a[_0xd530('0x2b')][_0xd530('0x42')]?_0x9ab62a[_0xd530('0x2b')]:_0x3c98a3[_0xd530('0x2a')];_0x9ab62a[_0xd530('0x43')]=qs['sort'](_0x40a1cc[_0xd530('0x27')][_0xd530('0x2e')]);_0x9ab62a[_0xd530('0x31')]=qs[_0xd530('0x28')](_[_0xd530('0x2f')](_0x40a1cc[_0xd530('0x27')],_0x3c98a3[_0xd530('0x28')]));if(_0x40a1cc['query'][_0xd530('0x30')]){_0x9ab62a[_0xd530('0x31')]=_[_0xd530('0x32')](_0x9ab62a[_0xd530('0x31')],{'$or':_[_0xd530('0x22')](_0x9ab62a['attributes'],function(_0x4f5fc4){var _0x587041={};_0x587041[_0x4f5fc4]={'$like':'%'+_0x40a1cc[_0xd530('0x27')]['filter']+'%'};return _0x587041;})});}_0x9ab62a=_[_0xd530('0x32')]({},_0x9ab62a,_0x40a1cc['options']);return _0x1d43c9[_0xd530('0x46')](_0x9ab62a);}})[_0xd530('0x1c')](function(_0x45fdb6){if(_0x45fdb6){_0x5370af=_0x45fdb6['length'];if(!_0x40a1cc['query'][_0xd530('0x44')](_0xd530('0x2d'))){_0x9ab62a[_0xd530('0x16')]=qs[_0xd530('0x16')](_0x40a1cc['query'][_0xd530('0x16')]);_0x9ab62a[_0xd530('0x14')]=qs['offset'](_0x40a1cc['query'][_0xd530('0x14')]);}return _0x1d43c9[_0xd530('0x46')](_0x9ab62a);}})['then'](function(_0x4f8a4c){if(_0x4f8a4c){return _0x4f8a4c?{'count':_0x5370af,'rows':_0x4f8a4c}:null;}})[_0xd530('0x1c')](respondWithResult(_0x217442,null))[_0xd530('0x39')](handleError(_0x217442,null));};exports[_0xd530('0x47')]=function(_0x28ac95,_0x5cd22a,_0x4ccdc6){if(_0x28ac95['body']['id']){delete _0x28ac95[_0xd530('0x3e')]['id'];}return db[_0xd530('0x23')][_0xd530('0x41')]({'where':{'id':_0x28ac95[_0xd530('0x3b')]['id']}})[_0xd530('0x1c')](handleEntityNotFound(_0x5cd22a,null))[_0xd530('0x1c')](function(_0x49fb93){if(_0x49fb93){return _0x49fb93[_0xd530('0x47')](_0x28ac95[_0xd530('0x3e')]['ids']||[]);}return null;})[_0xd530('0x1c')](respondWithResult(_0x5cd22a,null))['catch'](handleError(_0x5cd22a,null));}; \ No newline at end of file +var _0x9de1=['ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','send','index','DeskConfiguration','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','fields','find','create','body','getFields','findOne','DeskField','merge','getSubjects','getDescriptions','pick','getTags','setTags','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv'];(function(_0x42eac1,_0x1b6bbb){var _0xedcf1c=function(_0x3d69f6){while(--_0x3d69f6){_0x42eac1['push'](_0x42eac1['shift']());}};_0xedcf1c(++_0x1b6bbb);}(_0x9de1,0x14a));var _0x19de=function(_0x2076ad,_0x14468a){_0x2076ad=_0x2076ad-0x0;var _0x23d332=_0x9de1[_0x2076ad];return _0x23d332;};'use strict';var emlformat=require(_0x19de('0x0'));var rimraf=require(_0x19de('0x1'));var zipdir=require(_0x19de('0x2'));var jsonpatch=require(_0x19de('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x19de('0x4'));var Mustache=require(_0x19de('0x5'));var util=require(_0x19de('0x6'));var path=require(_0x19de('0x7'));var sox=require(_0x19de('0x8'));var csv=require(_0x19de('0x9'));var ejs=require(_0x19de('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x19de('0xb'));var squel=require(_0x19de('0xc'));var crypto=require('crypto');var jsforce=require(_0x19de('0xd'));var deskjs=require(_0x19de('0xe'));var toCsv=require(_0x19de('0x9'));var querystring=require(_0x19de('0xf'));var Papa=require(_0x19de('0x10'));var Redis=require('ioredis');var authService=require(_0x19de('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x19de('0x12'));var logger=require(_0x19de('0x13'))(_0x19de('0x14'));var utils=require(_0x19de('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x19de('0x16'));var db=require(_0x19de('0x17'))['db'];function respondWithStatusCode(_0x28209e,_0x3501cc){_0x3501cc=_0x3501cc||0xcc;return function(_0x490fcf){if(_0x490fcf){return _0x28209e[_0x19de('0x18')](_0x3501cc);}return _0x28209e[_0x19de('0x19')](_0x3501cc)['end']();};}function respondWithResult(_0x390d12,_0x2f9926){_0x2f9926=_0x2f9926||0xc8;return function(_0x50b7ad){if(_0x50b7ad){return _0x390d12['status'](_0x2f9926)[_0x19de('0x1a')](_0x50b7ad);}};}function respondWithFilteredResult(_0xa329e3,_0xe6e93){return function(_0x3da9b5){if(_0x3da9b5){var _0x44d202=typeof _0xe6e93['offset']===_0x19de('0x1b')&&typeof _0xe6e93['limit']===_0x19de('0x1b');var _0x17be52=_0x3da9b5[_0x19de('0x1c')];var _0x5cba88=_0x44d202?0x0:_0xe6e93[_0x19de('0x1d')];var _0x85cf99=_0x44d202?_0x3da9b5[_0x19de('0x1c')]:_0xe6e93[_0x19de('0x1d')]+_0xe6e93[_0x19de('0x1e')];var _0x55b53e;if(_0x85cf99>=_0x17be52){_0x85cf99=_0x17be52;_0x55b53e=0xc8;}else{_0x55b53e=0xce;}_0xa329e3[_0x19de('0x19')](_0x55b53e);return _0xa329e3[_0x19de('0x1f')](_0x19de('0x20'),_0x5cba88+'-'+_0x85cf99+'/'+_0x17be52)['json'](_0x3da9b5);}return null;};}function patchUpdates(_0xd03af1){return function(_0x43edaf){try{jsonpatch[_0x19de('0x21')](_0x43edaf,_0xd03af1,!![]);}catch(_0x192609){return BPromise[_0x19de('0x22')](_0x192609);}return _0x43edaf[_0x19de('0x23')]();};}function saveUpdates(_0x534ac4,_0x16fe96){return function(_0x46a0bb){if(_0x46a0bb){return _0x46a0bb[_0x19de('0x24')](_0x534ac4)[_0x19de('0x25')](function(_0x48f952){return _0x48f952;});}return null;};}function removeEntity(_0x39d301,_0x154118){return function(_0x56b3f4){if(_0x56b3f4){return _0x56b3f4[_0x19de('0x26')]()[_0x19de('0x25')](function(){_0x39d301[_0x19de('0x19')](0xcc)[_0x19de('0x27')]();});}};}function handleEntityNotFound(_0x5e21b7,_0x20db84){return function(_0x13e758){if(!_0x13e758){_0x5e21b7['sendStatus'](0x194);}return _0x13e758;};}function handleError(_0x4341d9,_0x3fc583){_0x3fc583=_0x3fc583||0x1f4;return function(_0x175872){logger[_0x19de('0x28')](_0x175872[_0x19de('0x29')]);if(_0x175872['name']){delete _0x175872['name'];}_0x4341d9[_0x19de('0x19')](_0x3fc583)[_0x19de('0x2a')](_0x175872);};}exports[_0x19de('0x2b')]=function(_0x2fff0c,_0x26cfdf){var _0x564b4c={},_0x362604={},_0x579dd0={'count':0x0,'rows':[]};var _0x3dd5bf=_['map'](db[_0x19de('0x2c')][_0x19de('0x2d')],function(_0x9d60e7){return{'name':_0x9d60e7[_0x19de('0x2e')],'type':_0x9d60e7[_0x19de('0x2f')][_0x19de('0x30')]};});_0x362604[_0x19de('0x31')]=_[_0x19de('0x32')](_0x3dd5bf,_0x19de('0x33'));_0x362604[_0x19de('0x34')]=_[_0x19de('0x35')](_0x2fff0c['query']);_0x362604[_0x19de('0x36')]=_['intersection'](_0x362604[_0x19de('0x31')],_0x362604[_0x19de('0x34')]);_0x564b4c[_0x19de('0x37')]=_[_0x19de('0x38')](_0x362604['model'],qs['fields'](_0x2fff0c[_0x19de('0x34')]['fields']));_0x564b4c['attributes']=_0x564b4c[_0x19de('0x37')][_0x19de('0x39')]?_0x564b4c[_0x19de('0x37')]:_0x362604['model'];if(!_0x2fff0c[_0x19de('0x34')][_0x19de('0x3a')](_0x19de('0x3b'))){_0x564b4c[_0x19de('0x1e')]=qs[_0x19de('0x1e')](_0x2fff0c[_0x19de('0x34')][_0x19de('0x1e')]);_0x564b4c['offset']=qs[_0x19de('0x1d')](_0x2fff0c['query'][_0x19de('0x1d')]);}_0x564b4c[_0x19de('0x3c')]=qs[_0x19de('0x3d')](_0x2fff0c[_0x19de('0x34')][_0x19de('0x3d')]);_0x564b4c[_0x19de('0x3e')]=qs[_0x19de('0x36')](_['pick'](_0x2fff0c[_0x19de('0x34')],_0x362604[_0x19de('0x36')]),_0x3dd5bf);if(_0x2fff0c[_0x19de('0x34')]['filter']){_0x564b4c[_0x19de('0x3e')]=_['merge'](_0x564b4c['where'],{'$or':_[_0x19de('0x32')](_0x3dd5bf,function(_0x20067c){if(_0x20067c[_0x19de('0x2f')]!==_0x19de('0x3f')){var _0x384a67={};_0x384a67[_0x20067c[_0x19de('0x33')]]={'$like':'%'+_0x2fff0c[_0x19de('0x34')][_0x19de('0x40')]+'%'};return _0x384a67;}})});}_0x564b4c=_['merge']({},_0x564b4c,_0x2fff0c[_0x19de('0x41')]);var _0x129b2b={'where':_0x564b4c['where']};return db['DeskConfiguration']['count'](_0x129b2b)[_0x19de('0x25')](function(_0x374943){_0x579dd0[_0x19de('0x1c')]=_0x374943;if(_0x2fff0c[_0x19de('0x34')][_0x19de('0x42')]){_0x564b4c[_0x19de('0x43')]=[{'all':!![]}];}return db[_0x19de('0x2c')]['findAll'](_0x564b4c);})['then'](function(_0x3b58d6){_0x579dd0[_0x19de('0x44')]=_0x3b58d6;return _0x579dd0;})[_0x19de('0x25')](respondWithFilteredResult(_0x26cfdf,_0x564b4c))[_0x19de('0x45')](handleError(_0x26cfdf,null));};exports[_0x19de('0x46')]=function(_0x810785,_0x36a5c3){var _0x37da4c={'raw':![],'where':{'id':_0x810785[_0x19de('0x47')]['id']}},_0x1fa2a5={};_0x1fa2a5[_0x19de('0x31')]=_[_0x19de('0x35')](db[_0x19de('0x2c')][_0x19de('0x2d')]);_0x1fa2a5['query']=_['keys'](_0x810785[_0x19de('0x34')]);_0x1fa2a5['filters']=_[_0x19de('0x38')](_0x1fa2a5[_0x19de('0x31')],_0x1fa2a5[_0x19de('0x34')]);_0x37da4c[_0x19de('0x37')]=_[_0x19de('0x38')](_0x1fa2a5[_0x19de('0x31')],qs['fields'](_0x810785[_0x19de('0x34')][_0x19de('0x48')]));_0x37da4c[_0x19de('0x37')]=_0x37da4c[_0x19de('0x37')]['length']?_0x37da4c[_0x19de('0x37')]:_0x1fa2a5[_0x19de('0x31')];if(_0x810785[_0x19de('0x34')][_0x19de('0x42')]){_0x37da4c[_0x19de('0x43')]=[{'all':!![]}];}_0x37da4c=_['merge']({},_0x37da4c,_0x810785[_0x19de('0x41')]);return db['DeskConfiguration'][_0x19de('0x49')](_0x37da4c)[_0x19de('0x25')](handleEntityNotFound(_0x36a5c3,null))[_0x19de('0x25')](respondWithResult(_0x36a5c3,null))['catch'](handleError(_0x36a5c3,null));};exports['create']=function(_0x48b4a6,_0x5ed921){return db[_0x19de('0x2c')][_0x19de('0x4a')](_0x48b4a6[_0x19de('0x4b')],{})['then'](respondWithResult(_0x5ed921,0xc9))['catch'](handleError(_0x5ed921,null));};exports[_0x19de('0x24')]=function(_0x24c7b1,_0xcc7d1d){if(_0x24c7b1[_0x19de('0x4b')]['id']){delete _0x24c7b1[_0x19de('0x4b')]['id'];}return db['DeskConfiguration'][_0x19de('0x49')]({'where':{'id':_0x24c7b1[_0x19de('0x47')]['id']}})[_0x19de('0x25')](handleEntityNotFound(_0xcc7d1d,null))[_0x19de('0x25')](saveUpdates(_0x24c7b1[_0x19de('0x4b')],null))[_0x19de('0x25')](respondWithResult(_0xcc7d1d,null))[_0x19de('0x45')](handleError(_0xcc7d1d,null));};exports[_0x19de('0x26')]=function(_0x315ffa,_0x27114d){return db[_0x19de('0x2c')]['find']({'where':{'id':_0x315ffa[_0x19de('0x47')]['id']}})['then'](handleEntityNotFound(_0x27114d,null))[_0x19de('0x25')](removeEntity(_0x27114d,null))[_0x19de('0x45')](handleError(_0x27114d,null));};exports[_0x19de('0x4c')]=function(_0x57427d,_0x916857,_0x1f6234){var _0x7440c1={};var _0x47ffed={};var _0x2ba66d;var _0x4a79e7;return db['DeskConfiguration'][_0x19de('0x4d')]({'where':{'id':_0x57427d[_0x19de('0x47')]['id']}})['then'](handleEntityNotFound(_0x916857,null))[_0x19de('0x25')](function(_0x37d2db){if(_0x37d2db){_0x2ba66d=_0x37d2db;_0x47ffed[_0x19de('0x31')]=_['keys'](db[_0x19de('0x4e')][_0x19de('0x2d')]);_0x47ffed[_0x19de('0x34')]=_[_0x19de('0x35')](_0x57427d[_0x19de('0x34')]);_0x47ffed[_0x19de('0x36')]=_['intersection'](_0x47ffed[_0x19de('0x31')],_0x47ffed[_0x19de('0x34')]);_0x7440c1[_0x19de('0x37')]=_[_0x19de('0x38')](_0x47ffed[_0x19de('0x31')],qs[_0x19de('0x48')](_0x57427d['query']['fields']));_0x7440c1['attributes']=_0x7440c1[_0x19de('0x37')][_0x19de('0x39')]?_0x7440c1[_0x19de('0x37')]:_0x47ffed[_0x19de('0x31')];_0x7440c1[_0x19de('0x3c')]=qs['sort'](_0x57427d[_0x19de('0x34')][_0x19de('0x3d')]);_0x7440c1[_0x19de('0x3e')]=qs['filters'](_['pick'](_0x57427d[_0x19de('0x34')],_0x47ffed[_0x19de('0x36')]));if(_0x57427d[_0x19de('0x34')][_0x19de('0x40')]){_0x7440c1[_0x19de('0x3e')]=_['merge'](_0x7440c1[_0x19de('0x3e')],{'$or':_[_0x19de('0x32')](_0x7440c1['attributes'],function(_0x190c2c){var _0x2ff56c={};_0x2ff56c[_0x190c2c]={'$like':'%'+_0x57427d['query'][_0x19de('0x40')]+'%'};return _0x2ff56c;})});}_0x7440c1=_[_0x19de('0x4f')]({},_0x7440c1,_0x57427d[_0x19de('0x41')]);return _0x2ba66d[_0x19de('0x4c')](_0x7440c1);}})['then'](function(_0x2711e1){if(_0x2711e1){_0x4a79e7=_0x2711e1[_0x19de('0x39')];if(!_0x57427d[_0x19de('0x34')]['hasOwnProperty'](_0x19de('0x3b'))){_0x7440c1[_0x19de('0x1e')]=qs[_0x19de('0x1e')](_0x57427d['query']['limit']);_0x7440c1[_0x19de('0x1d')]=qs[_0x19de('0x1d')](_0x57427d[_0x19de('0x34')][_0x19de('0x1d')]);}return _0x2ba66d[_0x19de('0x4c')](_0x7440c1);}})[_0x19de('0x25')](function(_0x36019a){if(_0x36019a){return _0x36019a?{'count':_0x4a79e7,'rows':_0x36019a}:null;}})[_0x19de('0x25')](respondWithResult(_0x916857,null))[_0x19de('0x45')](handleError(_0x916857,null));};exports[_0x19de('0x50')]=function(_0x32e345,_0x586676,_0x22e24e){var _0x4ce5f6={};var _0xa65a80={};var _0x582d40;var _0x14a3e2;return db[_0x19de('0x2c')][_0x19de('0x4d')]({'where':{'id':_0x32e345['params']['id']}})[_0x19de('0x25')](handleEntityNotFound(_0x586676,null))[_0x19de('0x25')](function(_0x279de0){if(_0x279de0){_0x582d40=_0x279de0;_0xa65a80[_0x19de('0x31')]=_[_0x19de('0x35')](db[_0x19de('0x4e')][_0x19de('0x2d')]);_0xa65a80['query']=_[_0x19de('0x35')](_0x32e345[_0x19de('0x34')]);_0xa65a80[_0x19de('0x36')]=_[_0x19de('0x38')](_0xa65a80[_0x19de('0x31')],_0xa65a80[_0x19de('0x34')]);_0x4ce5f6['attributes']=_[_0x19de('0x38')](_0xa65a80[_0x19de('0x31')],qs[_0x19de('0x48')](_0x32e345[_0x19de('0x34')][_0x19de('0x48')]));_0x4ce5f6[_0x19de('0x37')]=_0x4ce5f6[_0x19de('0x37')]['length']?_0x4ce5f6[_0x19de('0x37')]:_0xa65a80[_0x19de('0x31')];_0x4ce5f6[_0x19de('0x3c')]=qs[_0x19de('0x3d')](_0x32e345[_0x19de('0x34')][_0x19de('0x3d')]);_0x4ce5f6[_0x19de('0x3e')]=qs['filters'](_['pick'](_0x32e345['query'],_0xa65a80['filters']));if(_0x32e345[_0x19de('0x34')][_0x19de('0x40')]){_0x4ce5f6[_0x19de('0x3e')]=_[_0x19de('0x4f')](_0x4ce5f6[_0x19de('0x3e')],{'$or':_[_0x19de('0x32')](_0x4ce5f6[_0x19de('0x37')],function(_0xe5131d){var _0x488fe5={};_0x488fe5[_0xe5131d]={'$like':'%'+_0x32e345[_0x19de('0x34')][_0x19de('0x40')]+'%'};return _0x488fe5;})});}_0x4ce5f6=_[_0x19de('0x4f')]({},_0x4ce5f6,_0x32e345[_0x19de('0x41')]);return _0x582d40[_0x19de('0x50')](_0x4ce5f6);}})[_0x19de('0x25')](function(_0x54eef0){if(_0x54eef0){_0x14a3e2=_0x54eef0[_0x19de('0x39')];if(!_0x32e345[_0x19de('0x34')][_0x19de('0x3a')](_0x19de('0x3b'))){_0x4ce5f6[_0x19de('0x1e')]=qs[_0x19de('0x1e')](_0x32e345[_0x19de('0x34')][_0x19de('0x1e')]);_0x4ce5f6[_0x19de('0x1d')]=qs[_0x19de('0x1d')](_0x32e345[_0x19de('0x34')][_0x19de('0x1d')]);}return _0x582d40[_0x19de('0x50')](_0x4ce5f6);}})[_0x19de('0x25')](function(_0xad7e4e){if(_0xad7e4e){return _0xad7e4e?{'count':_0x14a3e2,'rows':_0xad7e4e}:null;}})['then'](respondWithResult(_0x586676,null))[_0x19de('0x45')](handleError(_0x586676,null));};exports[_0x19de('0x51')]=function(_0x4d27ab,_0x2ccd4a,_0x245425){var _0x114ff0={};var _0x3ce274={};var _0xcb4ac;var _0x469039;return db[_0x19de('0x2c')][_0x19de('0x4d')]({'where':{'id':_0x4d27ab[_0x19de('0x47')]['id']}})[_0x19de('0x25')](handleEntityNotFound(_0x2ccd4a,null))['then'](function(_0xf51999){if(_0xf51999){_0xcb4ac=_0xf51999;_0x3ce274['model']=_['keys'](db[_0x19de('0x4e')][_0x19de('0x2d')]);_0x3ce274[_0x19de('0x34')]=_[_0x19de('0x35')](_0x4d27ab[_0x19de('0x34')]);_0x3ce274['filters']=_[_0x19de('0x38')](_0x3ce274[_0x19de('0x31')],_0x3ce274[_0x19de('0x34')]);_0x114ff0[_0x19de('0x37')]=_['intersection'](_0x3ce274[_0x19de('0x31')],qs[_0x19de('0x48')](_0x4d27ab['query'][_0x19de('0x48')]));_0x114ff0[_0x19de('0x37')]=_0x114ff0[_0x19de('0x37')][_0x19de('0x39')]?_0x114ff0[_0x19de('0x37')]:_0x3ce274[_0x19de('0x31')];_0x114ff0[_0x19de('0x3c')]=qs[_0x19de('0x3d')](_0x4d27ab[_0x19de('0x34')][_0x19de('0x3d')]);_0x114ff0[_0x19de('0x3e')]=qs[_0x19de('0x36')](_[_0x19de('0x52')](_0x4d27ab[_0x19de('0x34')],_0x3ce274[_0x19de('0x36')]));if(_0x4d27ab[_0x19de('0x34')][_0x19de('0x40')]){_0x114ff0['where']=_[_0x19de('0x4f')](_0x114ff0['where'],{'$or':_['map'](_0x114ff0[_0x19de('0x37')],function(_0x4e03ca){var _0x25d6d7={};_0x25d6d7[_0x4e03ca]={'$like':'%'+_0x4d27ab[_0x19de('0x34')]['filter']+'%'};return _0x25d6d7;})});}_0x114ff0=_[_0x19de('0x4f')]({},_0x114ff0,_0x4d27ab[_0x19de('0x41')]);return _0xcb4ac[_0x19de('0x51')](_0x114ff0);}})['then'](function(_0x3f7bae){if(_0x3f7bae){_0x469039=_0x3f7bae[_0x19de('0x39')];if(!_0x4d27ab[_0x19de('0x34')][_0x19de('0x3a')](_0x19de('0x3b'))){_0x114ff0[_0x19de('0x1e')]=qs[_0x19de('0x1e')](_0x4d27ab['query'][_0x19de('0x1e')]);_0x114ff0[_0x19de('0x1d')]=qs['offset'](_0x4d27ab[_0x19de('0x34')]['offset']);}return _0xcb4ac[_0x19de('0x51')](_0x114ff0);}})['then'](function(_0x23ac1a){if(_0x23ac1a){return _0x23ac1a?{'count':_0x469039,'rows':_0x23ac1a}:null;}})[_0x19de('0x25')](respondWithResult(_0x2ccd4a,null))[_0x19de('0x45')](handleError(_0x2ccd4a,null));};exports[_0x19de('0x53')]=function(_0x242130,_0x193c6d,_0x3d628e){var _0x2ed2b3={};var _0xe82096={};var _0x3c9bfb;var _0x324694;return db['DeskConfiguration']['findOne']({'where':{'id':_0x242130[_0x19de('0x47')]['id']}})[_0x19de('0x25')](handleEntityNotFound(_0x193c6d,null))[_0x19de('0x25')](function(_0x128e87){if(_0x128e87){_0x3c9bfb=_0x128e87;_0xe82096[_0x19de('0x31')]=_[_0x19de('0x35')](db['Tag']['rawAttributes']);_0xe82096[_0x19de('0x34')]=_['keys'](_0x242130[_0x19de('0x34')]);_0xe82096[_0x19de('0x36')]=_[_0x19de('0x38')](_0xe82096[_0x19de('0x31')],_0xe82096['query']);_0x2ed2b3[_0x19de('0x37')]=_[_0x19de('0x38')](_0xe82096['model'],qs[_0x19de('0x48')](_0x242130['query'][_0x19de('0x48')]));_0x2ed2b3['attributes']=_0x2ed2b3[_0x19de('0x37')][_0x19de('0x39')]?_0x2ed2b3[_0x19de('0x37')]:_0xe82096[_0x19de('0x31')];_0x2ed2b3[_0x19de('0x3c')]=qs[_0x19de('0x3d')](_0x242130['query'][_0x19de('0x3d')]);_0x2ed2b3[_0x19de('0x3e')]=qs[_0x19de('0x36')](_[_0x19de('0x52')](_0x242130[_0x19de('0x34')],_0xe82096[_0x19de('0x36')]));if(_0x242130[_0x19de('0x34')][_0x19de('0x40')]){_0x2ed2b3[_0x19de('0x3e')]=_[_0x19de('0x4f')](_0x2ed2b3[_0x19de('0x3e')],{'$or':_['map'](_0x2ed2b3[_0x19de('0x37')],function(_0x2ce82e){var _0x4de396={};_0x4de396[_0x2ce82e]={'$like':'%'+_0x242130['query'][_0x19de('0x40')]+'%'};return _0x4de396;})});}_0x2ed2b3=_[_0x19de('0x4f')]({},_0x2ed2b3,_0x242130[_0x19de('0x41')]);return _0x3c9bfb[_0x19de('0x53')](_0x2ed2b3);}})['then'](function(_0x5f41bf){if(_0x5f41bf){_0x324694=_0x5f41bf[_0x19de('0x39')];if(!_0x242130[_0x19de('0x34')][_0x19de('0x3a')](_0x19de('0x3b'))){_0x2ed2b3[_0x19de('0x1e')]=qs[_0x19de('0x1e')](_0x242130[_0x19de('0x34')][_0x19de('0x1e')]);_0x2ed2b3[_0x19de('0x1d')]=qs[_0x19de('0x1d')](_0x242130['query'][_0x19de('0x1d')]);}return _0x3c9bfb[_0x19de('0x53')](_0x2ed2b3);}})[_0x19de('0x25')](function(_0x46d93c){if(_0x46d93c){return _0x46d93c?{'count':_0x324694,'rows':_0x46d93c}:null;}})['then'](respondWithResult(_0x193c6d,null))['catch'](handleError(_0x193c6d,null));};exports[_0x19de('0x54')]=function(_0x56ce32,_0x571a2d,_0x1f46a5){if(_0x56ce32['body']['id']){delete _0x56ce32['body']['id'];}return db[_0x19de('0x2c')][_0x19de('0x4d')]({'where':{'id':_0x56ce32[_0x19de('0x47')]['id']}})[_0x19de('0x25')](handleEntityNotFound(_0x571a2d,null))['then'](function(_0x5760f0){if(_0x5760f0){return _0x5760f0[_0x19de('0x54')](_0x56ce32[_0x19de('0x4b')]['ids']||[]);}return null;})['then'](respondWithResult(_0x571a2d,null))[_0x19de('0x45')](handleError(_0x571a2d,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 3464c64..0b31060 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 _0xb50d=['rimraf','../../config/environment','define','DeskConfiguration','int_desk_configurations','../../config/logger','api','bluebird','request-promise','path'];(function(_0x26773e,_0x4d778f){var _0x5627ac=function(_0x38da18){while(--_0x38da18){_0x26773e['push'](_0x26773e['shift']());}};_0x5627ac(++_0x4d778f);}(_0xb50d,0xf5));var _0xdb50=function(_0x5e2916,_0x2cf216){_0x5e2916=_0x5e2916-0x0;var _0x376fab=_0xb50d[_0x5e2916];return _0x376fab;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdb50('0x0'))(_0xdb50('0x1'));var moment=require('moment');var BPromise=require(_0xdb50('0x2'));var rp=require(_0xdb50('0x3'));var fs=require('fs');var path=require(_0xdb50('0x4'));var rimraf=require(_0xdb50('0x5'));var config=require(_0xdb50('0x6'));var attributes=require('./intDeskConfiguration.attributes');module['exports']=function(_0x44bfbc,_0xe3c447){return _0x44bfbc[_0xdb50('0x7')](_0xdb50('0x8'),attributes,{'tableName':_0xdb50('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb720=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','define','DeskConfiguration','int_desk_configurations','lodash','../../config/logger'];(function(_0xe5b349,_0x5f06e4){var _0x26b0ad=function(_0x1a97f1){while(--_0x1a97f1){_0xe5b349['push'](_0xe5b349['shift']());}};_0x26b0ad(++_0x5f06e4);}(_0xb720,0x191));var _0x0b72=function(_0x497d6d,_0xff7558){_0x497d6d=_0x497d6d-0x0;var _0x4a1d9a=_0xb720[_0x497d6d];return _0x4a1d9a;};'use strict';var _=require(_0x0b72('0x0'));var util=require('util');var logger=require(_0x0b72('0x1'))(_0x0b72('0x2'));var moment=require(_0x0b72('0x3'));var BPromise=require(_0x0b72('0x4'));var rp=require(_0x0b72('0x5'));var fs=require('fs');var path=require(_0x0b72('0x6'));var rimraf=require(_0x0b72('0x7'));var config=require(_0x0b72('0x8'));var attributes=require(_0x0b72('0x9'));module['exports']=function(_0x1fbb71,_0x51679c){return _0x1fbb71[_0x0b72('0xa')](_0x0b72('0xb'),attributes,{'tableName':_0x0b72('0xc'),'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 b5858fb..0e4f253 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 _0xffb1=['message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s'];(function(_0x2e249d,_0x41b7e7){var _0x1faa37=function(_0x1422b4){while(--_0x1422b4){_0x2e249d['push'](_0x2e249d['shift']());}};_0x1faa37(++_0x41b7e7);}(_0xffb1,0x93));var _0x1ffb=function(_0x2678d6,_0x4e2001){_0x2678d6=_0x2678d6-0x0;var _0x475503=_0xffb1[_0x2678d6];return _0x475503;};'use strict';var _=require(_0x1ffb('0x0'));var util=require(_0x1ffb('0x1'));var moment=require(_0x1ffb('0x2'));var BPromise=require(_0x1ffb('0x3'));var rs=require(_0x1ffb('0x4'));var fs=require('fs');var Redis=require(_0x1ffb('0x5'));var db=require(_0x1ffb('0x6'))['db'];var utils=require(_0x1ffb('0x7'));var logger=require(_0x1ffb('0x8'))(_0x1ffb('0x9'));var config=require('../../config/environment');var jayson=require(_0x1ffb('0xa'));var client=jayson[_0x1ffb('0xb')][_0x1ffb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2bfa98,_0x1d294a,_0x5bae77){return new BPromise(function(_0x1787b1,_0x4bcfb6){return client['request'](_0x2bfa98,_0x5bae77)[_0x1ffb('0xd')](function(_0x251538){logger[_0x1ffb('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x1d294a,'request\x20sent');logger[_0x1ffb('0xf')](_0x1ffb('0x10'),_0x1d294a,'request\x20sent',JSON[_0x1ffb('0x11')](_0x251538));if(_0x251538['error']){if(_0x251538[_0x1ffb('0x12')][_0x1ffb('0x13')]===0x1f4){logger[_0x1ffb('0x12')](_0x1ffb('0x14'),_0x1d294a,_0x251538[_0x1ffb('0x12')][_0x1ffb('0x15')]);return _0x4bcfb6(_0x251538['error'][_0x1ffb('0x15')]);}logger[_0x1ffb('0x12')](_0x1ffb('0x14'),_0x1d294a,_0x251538['error'][_0x1ffb('0x15')]);return _0x1787b1(_0x251538['error']['message']);}else{logger['info'](_0x1ffb('0x14'),_0x1d294a,_0x1ffb('0x16'));_0x1787b1(_0x251538['result'][_0x1ffb('0x15')]);}})[_0x1ffb('0x17')](function(_0x1a1f21){logger[_0x1ffb('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x1d294a,_0x1a1f21);_0x4bcfb6(_0x1a1f21);});});} \ No newline at end of file +var _0x5458=['rpc','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x431807,_0x187385){var _0x51d062=function(_0x2bd6a6){while(--_0x2bd6a6){_0x431807['push'](_0x431807['shift']());}};_0x51d062(++_0x187385);}(_0x5458,0x1c7));var _0x8545=function(_0x386451,_0x5945fd){_0x386451=_0x386451-0x0;var _0x30de1e=_0x5458[_0x386451];return _0x30de1e;};'use strict';var _=require(_0x8545('0x0'));var util=require(_0x8545('0x1'));var moment=require(_0x8545('0x2'));var BPromise=require('bluebird');var rs=require(_0x8545('0x3'));var fs=require('fs');var Redis=require(_0x8545('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8545('0x5'));var logger=require(_0x8545('0x6'))(_0x8545('0x7'));var config=require('../../config/environment');var jayson=require(_0x8545('0x8'));var client=jayson[_0x8545('0x9')][_0x8545('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x359d01,_0x5062c7,_0x291bc9){return new BPromise(function(_0x507ed8,_0x2cc4f4){return client[_0x8545('0xb')](_0x359d01,_0x291bc9)[_0x8545('0xc')](function(_0x10931d){logger[_0x8545('0xd')](_0x8545('0xe'),_0x5062c7,_0x8545('0xf'));logger[_0x8545('0x10')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5062c7,_0x8545('0xf'),JSON[_0x8545('0x11')](_0x10931d));if(_0x10931d[_0x8545('0x12')]){if(_0x10931d['error'][_0x8545('0x13')]===0x1f4){logger[_0x8545('0x12')](_0x8545('0xe'),_0x5062c7,_0x10931d[_0x8545('0x12')][_0x8545('0x14')]);return _0x2cc4f4(_0x10931d[_0x8545('0x12')][_0x8545('0x14')]);}logger[_0x8545('0x12')](_0x8545('0xe'),_0x5062c7,_0x10931d['error'][_0x8545('0x14')]);return _0x507ed8(_0x10931d[_0x8545('0x12')]['message']);}else{logger[_0x8545('0xd')](_0x8545('0xe'),_0x5062c7,_0x8545('0xf'));_0x507ed8(_0x10931d['result'][_0x8545('0x14')]);}})[_0x8545('0x15')](function(_0x3374f7){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x5062c7,_0x3374f7);_0x2cc4f4(_0x3374f7);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index f5af589..1d7f4dc 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 _0x340e=['multer','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete','exports'];(function(_0xdfe78a,_0x39023f){var _0x2ce43d=function(_0x5b579a){while(--_0x5b579a){_0xdfe78a['push'](_0xdfe78a['shift']());}};_0x2ce43d(++_0x39023f);}(_0x340e,0x1dc));var _0xe340=function(_0xc62816,_0x9602fc){_0xc62816=_0xc62816-0x0;var _0x43a0bd=_0x340e[_0xc62816];return _0x43a0bd;};'use strict';var multer=require(_0xe340('0x0'));var util=require('util');var path=require(_0xe340('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe340('0x2')]();var fs_extra=require(_0xe340('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe340('0x4'));var config=require(_0xe340('0x5'));var controller=require(_0xe340('0x6'));router['get']('/',auth[_0xe340('0x7')](),controller['index']);router[_0xe340('0x8')](_0xe340('0x9'),auth[_0xe340('0x7')](),controller[_0xe340('0xa')]);router[_0xe340('0xb')]('/',auth['isAuthenticated'](),controller[_0xe340('0xc')]);router[_0xe340('0xd')](_0xe340('0x9'),auth['isAuthenticated'](),controller[_0xe340('0xe')]);router[_0xe340('0xf')](_0xe340('0x9'),auth[_0xe340('0x7')](),controller['destroy']);module[_0xe340('0x10')]=router; \ No newline at end of file +var _0x0942=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','index','/:id','show','post','isAuthenticated','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x0942,0x11a));var _0x2094=function(_0x5956a1,_0x231b31){_0x5956a1=_0x5956a1-0x0;var _0x6d2204=_0x0942[_0x5956a1];return _0x6d2204;};'use strict';var multer=require('multer');var util=require(_0x2094('0x0'));var path=require(_0x2094('0x1'));var timeout=require(_0x2094('0x2'));var express=require(_0x2094('0x3'));var router=express[_0x2094('0x4')]();var fs_extra=require(_0x2094('0x5'));var auth=require(_0x2094('0x6'));var interaction=require(_0x2094('0x7'));var config=require('../../config/environment');var controller=require(_0x2094('0x8'));router[_0x2094('0x9')]('/',auth['isAuthenticated'](),controller[_0x2094('0xa')]);router[_0x2094('0x9')](_0x2094('0xb'),auth['isAuthenticated'](),controller[_0x2094('0xc')]);router[_0x2094('0xd')]('/',auth[_0x2094('0xe')](),controller['create']);router[_0x2094('0xf')](_0x2094('0xb'),auth[_0x2094('0xe')](),controller['update']);router[_0x2094('0x10')](_0x2094('0xb'),auth[_0x2094('0xe')](),controller[_0x2094('0x11')]);module[_0x2094('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index a283c7e..ff68c04 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 _0xff32=['exports','ENUM','string','variable','keyValue','STRING','customVariable','BOOLEAN','sequelize'];(function(_0x1f4711,_0x2b6e7f){var _0x38db67=function(_0x4ac425){while(--_0x4ac425){_0x1f4711['push'](_0x1f4711['shift']());}};_0x38db67(++_0x2b6e7f);}(_0xff32,0x74));var _0x2ff3=function(_0x4c0622,_0x5dacaf){_0x4c0622=_0x4c0622-0x0;var _0x1799d8=_0xff32[_0x4c0622];return _0x1799d8;};'use strict';var Sequelize=require(_0x2ff3('0x0'));module[_0x2ff3('0x1')]={'type':{'type':Sequelize[_0x2ff3('0x2')](_0x2ff3('0x3'),_0x2ff3('0x4'),'customVariable',_0x2ff3('0x5'),'picklist'),'defaultValue':_0x2ff3('0x3')},'content':{'type':Sequelize[_0x2ff3('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2ff3('0x2')](_0x2ff3('0x3'),_0x2ff3('0x4'),_0x2ff3('0x7'))},'keyContent':{'type':Sequelize[_0x2ff3('0x6')]},'idField':{'type':Sequelize[_0x2ff3('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x2ff3('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2ff3('0x6')]}}; \ No newline at end of file +var _0x0bd5=['customVariable','keyValue','picklist','STRING','ENUM','variable','BOOLEAN','sequelize','exports','string'];(function(_0x13b701,_0xf8a5ee){var _0x18d4a2=function(_0x17014b){while(--_0x17014b){_0x13b701['push'](_0x13b701['shift']());}};_0x18d4a2(++_0xf8a5ee);}(_0x0bd5,0xc5));var _0x50bd=function(_0x2cc161,_0x3880fc){_0x2cc161=_0x2cc161-0x0;var _0xbc6aac=_0x0bd5[_0x2cc161];return _0xbc6aac;};'use strict';var Sequelize=require(_0x50bd('0x0'));module[_0x50bd('0x1')]={'type':{'type':Sequelize['ENUM'](_0x50bd('0x2'),'variable',_0x50bd('0x3'),_0x50bd('0x4'),_0x50bd('0x5')),'defaultValue':_0x50bd('0x2')},'content':{'type':Sequelize[_0x50bd('0x6')]},'key':{'type':Sequelize[_0x50bd('0x6')]},'keyType':{'type':Sequelize[_0x50bd('0x7')]('string',_0x50bd('0x8'),_0x50bd('0x3'))},'keyContent':{'type':Sequelize[_0x50bd('0x6')]},'idField':{'type':Sequelize[_0x50bd('0x6')]},'nameField':{'type':Sequelize[_0x50bd('0x6')]},'customField':{'type':Sequelize[_0x50bd('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index b3dc922..29ca21e 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 _0x6e2e=['create','update','body','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','destroy','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','DeskField','then','includeAll','findAll','catch','keys','include','find'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x6e2e,0xd9));var _0xe6e2=function(_0x4a3e73,_0x4fea7c){_0x4a3e73=_0x4a3e73-0x0;var _0x2d8eb9=_0x6e2e[_0x4a3e73];return _0x2d8eb9;};'use strict';var emlformat=require(_0xe6e2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe6e2('0x1'));var jsonpatch=require(_0xe6e2('0x2'));var rp=require(_0xe6e2('0x3'));var moment=require('moment');var BPromise=require(_0xe6e2('0x4'));var Mustache=require(_0xe6e2('0x5'));var util=require(_0xe6e2('0x6'));var path=require(_0xe6e2('0x7'));var sox=require(_0xe6e2('0x8'));var csv=require(_0xe6e2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe6e2('0xa'));var squel=require(_0xe6e2('0xb'));var crypto=require(_0xe6e2('0xc'));var jsforce=require(_0xe6e2('0xd'));var deskjs=require(_0xe6e2('0xe'));var toCsv=require(_0xe6e2('0x9'));var querystring=require(_0xe6e2('0xf'));var Papa=require(_0xe6e2('0x10'));var Redis=require('ioredis');var authService=require(_0xe6e2('0x11'));var qs=require(_0xe6e2('0x12'));var as=require(_0xe6e2('0x13'));var hardwareService=require(_0xe6e2('0x14'));var logger=require('../../config/logger')(_0xe6e2('0x15'));var utils=require(_0xe6e2('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22e18c,_0x2f93fc){_0x2f93fc=_0x2f93fc||0xcc;return function(_0x1ecc4b){if(_0x1ecc4b){return _0x22e18c[_0xe6e2('0x17')](_0x2f93fc);}return _0x22e18c['status'](_0x2f93fc)[_0xe6e2('0x18')]();};}function respondWithResult(_0x313fe5,_0x45c840){_0x45c840=_0x45c840||0xc8;return function(_0x140aea){if(_0x140aea){return _0x313fe5[_0xe6e2('0x19')](_0x45c840)[_0xe6e2('0x1a')](_0x140aea);}};}function respondWithFilteredResult(_0x555ac6,_0x58f326){return function(_0x544400){if(_0x544400){var _0x16287a=typeof _0x58f326['offset']===_0xe6e2('0x1b')&&typeof _0x58f326[_0xe6e2('0x1c')]===_0xe6e2('0x1b');var _0x4fc201=_0x544400[_0xe6e2('0x1d')];var _0x55485c=_0x16287a?0x0:_0x58f326[_0xe6e2('0x1e')];var _0x21e8c2=_0x16287a?_0x544400[_0xe6e2('0x1d')]:_0x58f326['offset']+_0x58f326[_0xe6e2('0x1c')];var _0x3c7a94;if(_0x21e8c2>=_0x4fc201){_0x21e8c2=_0x4fc201;_0x3c7a94=0xc8;}else{_0x3c7a94=0xce;}_0x555ac6['status'](_0x3c7a94);return _0x555ac6[_0xe6e2('0x1f')](_0xe6e2('0x20'),_0x55485c+'-'+_0x21e8c2+'/'+_0x4fc201)[_0xe6e2('0x1a')](_0x544400);}return null;};}function patchUpdates(_0x43b948){return function(_0x1542cd){try{jsonpatch['apply'](_0x1542cd,_0x43b948,!![]);}catch(_0x58cb9a){return BPromise[_0xe6e2('0x21')](_0x58cb9a);}return _0x1542cd['save']();};}function saveUpdates(_0x405ad2,_0x2c7a98){return function(_0x458bfc){if(_0x458bfc){return _0x458bfc['update'](_0x405ad2)['then'](function(_0x80cb7){return _0x80cb7;});}return null;};}function removeEntity(_0x50cdb3,_0x4846b7){return function(_0x48adf8){if(_0x48adf8){return _0x48adf8[_0xe6e2('0x22')]()['then'](function(){_0x50cdb3[_0xe6e2('0x19')](0xcc)[_0xe6e2('0x18')]();});}};}function handleEntityNotFound(_0x23b524,_0x408b32){return function(_0x263187){if(!_0x263187){_0x23b524[_0xe6e2('0x17')](0x194);}return _0x263187;};}function handleError(_0x21fe9a,_0x4a9344){_0x4a9344=_0x4a9344||0x1f4;return function(_0x981f69){logger[_0xe6e2('0x23')](_0x981f69[_0xe6e2('0x24')]);if(_0x981f69['name']){delete _0x981f69[_0xe6e2('0x25')];}_0x21fe9a[_0xe6e2('0x19')](_0x4a9344)['send'](_0x981f69);};}exports['index']=function(_0x163dbf,_0x469eb0){var _0x5c14f1={},_0x2b3589={},_0x451186={'count':0x0,'rows':[]};var _0x194b8d=_[_0xe6e2('0x26')](db['DeskField'][_0xe6e2('0x27')],function(_0x6809c2){return{'name':_0x6809c2[_0xe6e2('0x28')],'type':_0x6809c2[_0xe6e2('0x29')][_0xe6e2('0x2a')]};});_0x2b3589[_0xe6e2('0x2b')]=_[_0xe6e2('0x26')](_0x194b8d,_0xe6e2('0x25'));_0x2b3589[_0xe6e2('0x2c')]=_['keys'](_0x163dbf[_0xe6e2('0x2c')]);_0x2b3589[_0xe6e2('0x2d')]=_[_0xe6e2('0x2e')](_0x2b3589[_0xe6e2('0x2b')],_0x2b3589[_0xe6e2('0x2c')]);_0x5c14f1['attributes']=_[_0xe6e2('0x2e')](_0x2b3589[_0xe6e2('0x2b')],qs['fields'](_0x163dbf['query'][_0xe6e2('0x2f')]));_0x5c14f1[_0xe6e2('0x30')]=_0x5c14f1[_0xe6e2('0x30')][_0xe6e2('0x31')]?_0x5c14f1[_0xe6e2('0x30')]:_0x2b3589[_0xe6e2('0x2b')];if(!_0x163dbf[_0xe6e2('0x2c')][_0xe6e2('0x32')](_0xe6e2('0x33'))){_0x5c14f1[_0xe6e2('0x1c')]=qs[_0xe6e2('0x1c')](_0x163dbf[_0xe6e2('0x2c')][_0xe6e2('0x1c')]);_0x5c14f1['offset']=qs[_0xe6e2('0x1e')](_0x163dbf['query'][_0xe6e2('0x1e')]);}_0x5c14f1[_0xe6e2('0x34')]=qs[_0xe6e2('0x35')](_0x163dbf['query'][_0xe6e2('0x35')]);_0x5c14f1[_0xe6e2('0x36')]=qs[_0xe6e2('0x2d')](_[_0xe6e2('0x37')](_0x163dbf[_0xe6e2('0x2c')],_0x2b3589[_0xe6e2('0x2d')]),_0x194b8d);if(_0x163dbf[_0xe6e2('0x2c')][_0xe6e2('0x38')]){_0x5c14f1[_0xe6e2('0x36')]=_[_0xe6e2('0x39')](_0x5c14f1['where'],{'$or':_[_0xe6e2('0x26')](_0x194b8d,function(_0x49fa6d){if(_0x49fa6d[_0xe6e2('0x29')]!=='VIRTUAL'){var _0x24c0a9={};_0x24c0a9[_0x49fa6d[_0xe6e2('0x25')]]={'$like':'%'+_0x163dbf[_0xe6e2('0x2c')][_0xe6e2('0x38')]+'%'};return _0x24c0a9;}})});}_0x5c14f1=_[_0xe6e2('0x39')]({},_0x5c14f1,_0x163dbf[_0xe6e2('0x3a')]);var _0x5ccc60={'where':_0x5c14f1['where']};return db[_0xe6e2('0x3b')][_0xe6e2('0x1d')](_0x5ccc60)[_0xe6e2('0x3c')](function(_0x2845dd){_0x451186[_0xe6e2('0x1d')]=_0x2845dd;if(_0x163dbf[_0xe6e2('0x2c')][_0xe6e2('0x3d')]){_0x5c14f1['include']=[{'all':!![]}];}return db[_0xe6e2('0x3b')][_0xe6e2('0x3e')](_0x5c14f1);})[_0xe6e2('0x3c')](function(_0x4b705c){_0x451186['rows']=_0x4b705c;return _0x451186;})[_0xe6e2('0x3c')](respondWithFilteredResult(_0x469eb0,_0x5c14f1))[_0xe6e2('0x3f')](handleError(_0x469eb0,null));};exports['show']=function(_0x36e32b,_0x2e39eb){var _0x170589={'raw':!![],'where':{'id':_0x36e32b['params']['id']}},_0x2fa4de={};_0x2fa4de[_0xe6e2('0x2b')]=_[_0xe6e2('0x40')](db[_0xe6e2('0x3b')][_0xe6e2('0x27')]);_0x2fa4de['query']=_['keys'](_0x36e32b[_0xe6e2('0x2c')]);_0x2fa4de[_0xe6e2('0x2d')]=_[_0xe6e2('0x2e')](_0x2fa4de[_0xe6e2('0x2b')],_0x2fa4de['query']);_0x170589[_0xe6e2('0x30')]=_[_0xe6e2('0x2e')](_0x2fa4de[_0xe6e2('0x2b')],qs[_0xe6e2('0x2f')](_0x36e32b[_0xe6e2('0x2c')][_0xe6e2('0x2f')]));_0x170589[_0xe6e2('0x30')]=_0x170589[_0xe6e2('0x30')][_0xe6e2('0x31')]?_0x170589['attributes']:_0x2fa4de['model'];if(_0x36e32b[_0xe6e2('0x2c')][_0xe6e2('0x3d')]){_0x170589[_0xe6e2('0x41')]=[{'all':!![]}];}_0x170589=_[_0xe6e2('0x39')]({},_0x170589,_0x36e32b[_0xe6e2('0x3a')]);return db[_0xe6e2('0x3b')][_0xe6e2('0x42')](_0x170589)['then'](handleEntityNotFound(_0x2e39eb,null))[_0xe6e2('0x3c')](respondWithResult(_0x2e39eb,null))[_0xe6e2('0x3f')](handleError(_0x2e39eb,null));};exports[_0xe6e2('0x43')]=function(_0xdc89d5,_0x42a6ac){return db['DeskField']['create'](_0xdc89d5['body'],{})[_0xe6e2('0x3c')](respondWithResult(_0x42a6ac,0xc9))['catch'](handleError(_0x42a6ac,null));};exports[_0xe6e2('0x44')]=function(_0x328405,_0x556c86){if(_0x328405[_0xe6e2('0x45')]['id']){delete _0x328405[_0xe6e2('0x45')]['id'];}return db['DeskField'][_0xe6e2('0x42')]({'where':{'id':_0x328405[_0xe6e2('0x46')]['id']}})[_0xe6e2('0x3c')](handleEntityNotFound(_0x556c86,null))[_0xe6e2('0x3c')](saveUpdates(_0x328405[_0xe6e2('0x45')],null))[_0xe6e2('0x3c')](respondWithResult(_0x556c86,null))[_0xe6e2('0x3f')](handleError(_0x556c86,null));};exports[_0xe6e2('0x22')]=function(_0x412148,_0x4e7d66){return db['DeskField'][_0xe6e2('0x42')]({'where':{'id':_0x412148[_0xe6e2('0x46')]['id']}})[_0xe6e2('0x3c')](handleEntityNotFound(_0x4e7d66,null))['then'](removeEntity(_0x4e7d66,null))['catch'](handleError(_0x4e7d66,null));}; \ No newline at end of file +var _0x0650=['rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','DeskField','include','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','name'];(function(_0x39819d,_0x3adc5a){var _0x55abd0=function(_0x10d3f7){while(--_0x10d3f7){_0x39819d['push'](_0x39819d['shift']());}};_0x55abd0(++_0x3adc5a);}(_0x0650,0xed));var _0x0065=function(_0x2f7270,_0x307af1){_0x2f7270=_0x2f7270-0x0;var _0xe1d89a=_0x0650[_0x2f7270];return _0xe1d89a;};'use strict';var emlformat=require(_0x0065('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0065('0x1'));var jsonpatch=require(_0x0065('0x2'));var rp=require('request-promise');var moment=require(_0x0065('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0065('0x4'));var util=require(_0x0065('0x5'));var path=require(_0x0065('0x6'));var sox=require('sox');var csv=require(_0x0065('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0065('0x8'));var crypto=require(_0x0065('0x9'));var jsforce=require(_0x0065('0xa'));var deskjs=require(_0x0065('0xb'));var toCsv=require(_0x0065('0x7'));var querystring=require(_0x0065('0xc'));var Papa=require(_0x0065('0xd'));var Redis=require(_0x0065('0xe'));var authService=require(_0x0065('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0065('0x10'));var hardwareService=require(_0x0065('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0065('0x12'));var licenseUtil=require(_0x0065('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45c7d1,_0x4255f6){_0x4255f6=_0x4255f6||0xcc;return function(_0x4c6296){if(_0x4c6296){return _0x45c7d1[_0x0065('0x14')](_0x4255f6);}return _0x45c7d1[_0x0065('0x15')](_0x4255f6)['end']();};}function respondWithResult(_0x5ae653,_0x1b9b1e){_0x1b9b1e=_0x1b9b1e||0xc8;return function(_0x5c0b74){if(_0x5c0b74){return _0x5ae653['status'](_0x1b9b1e)[_0x0065('0x16')](_0x5c0b74);}};}function respondWithFilteredResult(_0x5773d6,_0x38a870){return function(_0x48d817){if(_0x48d817){var _0x391fc1=typeof _0x38a870[_0x0065('0x17')]===_0x0065('0x18')&&typeof _0x38a870[_0x0065('0x19')]===_0x0065('0x18');var _0x34b0e2=_0x48d817[_0x0065('0x1a')];var _0x393d6e=_0x391fc1?0x0:_0x38a870['offset'];var _0x18bfa1=_0x391fc1?_0x48d817[_0x0065('0x1a')]:_0x38a870['offset']+_0x38a870[_0x0065('0x19')];var _0x3a0517;if(_0x18bfa1>=_0x34b0e2){_0x18bfa1=_0x34b0e2;_0x3a0517=0xc8;}else{_0x3a0517=0xce;}_0x5773d6[_0x0065('0x15')](_0x3a0517);return _0x5773d6[_0x0065('0x1b')](_0x0065('0x1c'),_0x393d6e+'-'+_0x18bfa1+'/'+_0x34b0e2)[_0x0065('0x16')](_0x48d817);}return null;};}function patchUpdates(_0x319e7a){return function(_0x529e30){try{jsonpatch['apply'](_0x529e30,_0x319e7a,!![]);}catch(_0x4b1213){return BPromise[_0x0065('0x1d')](_0x4b1213);}return _0x529e30[_0x0065('0x1e')]();};}function saveUpdates(_0x5b60c3,_0x2de3ae){return function(_0x5f1733){if(_0x5f1733){return _0x5f1733[_0x0065('0x1f')](_0x5b60c3)[_0x0065('0x20')](function(_0x3ec265){return _0x3ec265;});}return null;};}function removeEntity(_0x376452,_0x161b4c){return function(_0x1efa70){if(_0x1efa70){return _0x1efa70[_0x0065('0x21')]()['then'](function(){_0x376452[_0x0065('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b4a4e,_0x3c715a){return function(_0x5924b3){if(!_0x5924b3){_0x4b4a4e[_0x0065('0x14')](0x194);}return _0x5924b3;};}function handleError(_0x6bf13b,_0x5db92c){_0x5db92c=_0x5db92c||0x1f4;return function(_0x123604){logger['error'](_0x123604['stack']);if(_0x123604[_0x0065('0x22')]){delete _0x123604[_0x0065('0x22')];}_0x6bf13b['status'](_0x5db92c)['send'](_0x123604);};}exports['index']=function(_0x51e091,_0x2e554f){var _0x1a977a={},_0x1f8813={},_0x369d08={'count':0x0,'rows':[]};var _0x4f15f5=_['map'](db['DeskField'][_0x0065('0x23')],function(_0x3a5286){return{'name':_0x3a5286[_0x0065('0x24')],'type':_0x3a5286['type'][_0x0065('0x25')]};});_0x1f8813[_0x0065('0x26')]=_['map'](_0x4f15f5,_0x0065('0x22'));_0x1f8813[_0x0065('0x27')]=_[_0x0065('0x28')](_0x51e091[_0x0065('0x27')]);_0x1f8813[_0x0065('0x29')]=_[_0x0065('0x2a')](_0x1f8813[_0x0065('0x26')],_0x1f8813[_0x0065('0x27')]);_0x1a977a['attributes']=_['intersection'](_0x1f8813['model'],qs[_0x0065('0x2b')](_0x51e091[_0x0065('0x27')][_0x0065('0x2b')]));_0x1a977a[_0x0065('0x2c')]=_0x1a977a[_0x0065('0x2c')][_0x0065('0x2d')]?_0x1a977a[_0x0065('0x2c')]:_0x1f8813['model'];if(!_0x51e091[_0x0065('0x27')][_0x0065('0x2e')](_0x0065('0x2f'))){_0x1a977a[_0x0065('0x19')]=qs[_0x0065('0x19')](_0x51e091['query'][_0x0065('0x19')]);_0x1a977a[_0x0065('0x17')]=qs[_0x0065('0x17')](_0x51e091[_0x0065('0x27')][_0x0065('0x17')]);}_0x1a977a[_0x0065('0x30')]=qs[_0x0065('0x31')](_0x51e091[_0x0065('0x27')][_0x0065('0x31')]);_0x1a977a[_0x0065('0x32')]=qs['filters'](_[_0x0065('0x33')](_0x51e091[_0x0065('0x27')],_0x1f8813[_0x0065('0x29')]),_0x4f15f5);if(_0x51e091['query'][_0x0065('0x34')]){_0x1a977a[_0x0065('0x32')]=_[_0x0065('0x35')](_0x1a977a[_0x0065('0x32')],{'$or':_[_0x0065('0x36')](_0x4f15f5,function(_0x231986){if(_0x231986['type']!==_0x0065('0x37')){var _0x2d1ba9={};_0x2d1ba9[_0x231986[_0x0065('0x22')]]={'$like':'%'+_0x51e091['query'][_0x0065('0x34')]+'%'};return _0x2d1ba9;}})});}_0x1a977a=_['merge']({},_0x1a977a,_0x51e091[_0x0065('0x38')]);var _0x37a434={'where':_0x1a977a['where']};return db[_0x0065('0x39')][_0x0065('0x1a')](_0x37a434)[_0x0065('0x20')](function(_0x3c1d6b){_0x369d08[_0x0065('0x1a')]=_0x3c1d6b;if(_0x51e091[_0x0065('0x27')]['includeAll']){_0x1a977a[_0x0065('0x3a')]=[{'all':!![]}];}return db[_0x0065('0x39')][_0x0065('0x3b')](_0x1a977a);})[_0x0065('0x20')](function(_0x1d251d){_0x369d08[_0x0065('0x3c')]=_0x1d251d;return _0x369d08;})[_0x0065('0x20')](respondWithFilteredResult(_0x2e554f,_0x1a977a))[_0x0065('0x3d')](handleError(_0x2e554f,null));};exports[_0x0065('0x3e')]=function(_0x41d6f7,_0x26cef9){var _0x32ab66={'raw':!![],'where':{'id':_0x41d6f7[_0x0065('0x3f')]['id']}},_0x35722d={};_0x35722d[_0x0065('0x26')]=_[_0x0065('0x28')](db[_0x0065('0x39')][_0x0065('0x23')]);_0x35722d[_0x0065('0x27')]=_[_0x0065('0x28')](_0x41d6f7[_0x0065('0x27')]);_0x35722d[_0x0065('0x29')]=_[_0x0065('0x2a')](_0x35722d['model'],_0x35722d[_0x0065('0x27')]);_0x32ab66['attributes']=_[_0x0065('0x2a')](_0x35722d['model'],qs[_0x0065('0x2b')](_0x41d6f7['query'][_0x0065('0x2b')]));_0x32ab66[_0x0065('0x2c')]=_0x32ab66[_0x0065('0x2c')]['length']?_0x32ab66['attributes']:_0x35722d[_0x0065('0x26')];if(_0x41d6f7[_0x0065('0x27')][_0x0065('0x40')]){_0x32ab66[_0x0065('0x3a')]=[{'all':!![]}];}_0x32ab66=_['merge']({},_0x32ab66,_0x41d6f7[_0x0065('0x38')]);return db[_0x0065('0x39')][_0x0065('0x41')](_0x32ab66)[_0x0065('0x20')](handleEntityNotFound(_0x26cef9,null))[_0x0065('0x20')](respondWithResult(_0x26cef9,null))['catch'](handleError(_0x26cef9,null));};exports[_0x0065('0x42')]=function(_0x5ef382,_0x339730){return db[_0x0065('0x39')][_0x0065('0x42')](_0x5ef382[_0x0065('0x43')],{})['then'](respondWithResult(_0x339730,0xc9))[_0x0065('0x3d')](handleError(_0x339730,null));};exports['update']=function(_0x86fa3d,_0x20b727){if(_0x86fa3d[_0x0065('0x43')]['id']){delete _0x86fa3d[_0x0065('0x43')]['id'];}return db[_0x0065('0x39')][_0x0065('0x41')]({'where':{'id':_0x86fa3d[_0x0065('0x3f')]['id']}})[_0x0065('0x20')](handleEntityNotFound(_0x20b727,null))[_0x0065('0x20')](saveUpdates(_0x86fa3d[_0x0065('0x43')],null))[_0x0065('0x20')](respondWithResult(_0x20b727,null))['catch'](handleError(_0x20b727,null));};exports[_0x0065('0x21')]=function(_0xcd7d13,_0x277b74){return db[_0x0065('0x39')][_0x0065('0x41')]({'where':{'id':_0xcd7d13[_0x0065('0x3f')]['id']}})[_0x0065('0x20')](handleEntityNotFound(_0x277b74,null))['then'](removeEntity(_0x277b74,null))['catch'](handleError(_0x277b74,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index f16c171..6e0e4f8 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 _0x6d79=['api','bluebird','request-promise','path','../../config/environment','./intDeskField.attributes','define','DeskField','int_desk_fields','desk_unique_index','idField','lodash','util','../../config/logger'];(function(_0x534deb,_0x21de0c){var _0x1b3238=function(_0x5a5406){while(--_0x5a5406){_0x534deb['push'](_0x534deb['shift']());}};_0x1b3238(++_0x21de0c);}(_0x6d79,0x1cb));var _0x96d7=function(_0x292d2d,_0x4f3845){_0x292d2d=_0x292d2d-0x0;var _0x55f52=_0x6d79[_0x292d2d];return _0x55f52;};'use strict';var _=require(_0x96d7('0x0'));var util=require(_0x96d7('0x1'));var logger=require(_0x96d7('0x2'))(_0x96d7('0x3'));var moment=require('moment');var BPromise=require(_0x96d7('0x4'));var rp=require(_0x96d7('0x5'));var fs=require('fs');var path=require(_0x96d7('0x6'));var rimraf=require('rimraf');var config=require(_0x96d7('0x7'));var attributes=require(_0x96d7('0x8'));module['exports']=function(_0x41c75e,_0x572328){return _0x41c75e[_0x96d7('0x9')](_0x96d7('0xa'),attributes,{'tableName':_0x96d7('0xb'),'paranoid':![],'indexes':[{'name':_0x96d7('0xc'),'fields':[_0x96d7('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x49af=['int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','path','rimraf','define'];(function(_0x3df04e,_0x333c95){var _0x5c1c69=function(_0x260e9e){while(--_0x260e9e){_0x3df04e['push'](_0x3df04e['shift']());}};_0x5c1c69(++_0x333c95);}(_0x49af,0x1a8));var _0xf49a=function(_0x14349e,_0x38d20b){_0x14349e=_0x14349e-0x0;var _0x16d9e8=_0x49af[_0x14349e];return _0x16d9e8;};'use strict';var _=require(_0xf49a('0x0'));var util=require(_0xf49a('0x1'));var logger=require(_0xf49a('0x2'))(_0xf49a('0x3'));var moment=require(_0xf49a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf49a('0x5'));var rimraf=require(_0xf49a('0x6'));var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module['exports']=function(_0x32eefb,_0x138bb9){return _0x32eefb[_0xf49a('0x7')]('DeskField',attributes,{'tableName':_0xf49a('0x8'),'paranoid':![],'indexes':[{'name':_0xf49a('0x9'),'fields':[_0xf49a('0xa'),_0xf49a('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 5598bfe..5881e64 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 _0xe497=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskField,\x20%s,\x20%s','message','result','lodash','moment','bluebird'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe497,0x107));var _0x7e49=function(_0x1c10fe,_0x13ede9){_0x1c10fe=_0x1c10fe-0x0;var _0x149be9=_0xe497[_0x1c10fe];return _0x149be9;};'use strict';var _=require(_0x7e49('0x0'));var util=require('util');var moment=require(_0x7e49('0x1'));var BPromise=require(_0x7e49('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e49('0x3'))['db'];var utils=require(_0x7e49('0x4'));var logger=require(_0x7e49('0x5'))(_0x7e49('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7e49('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed66c,_0xe1e622,_0x5dd028){return new BPromise(function(_0xf899e,_0x52b94b){return client[_0x7e49('0x8')](_0x4ed66c,_0x5dd028)[_0x7e49('0x9')](function(_0xc5a548){logger[_0x7e49('0xa')]('DeskField,\x20%s,\x20%s',_0xe1e622,_0x7e49('0xb'));logger['debug'](_0x7e49('0xc'),_0xe1e622,'request\x20sent',JSON[_0x7e49('0xd')](_0xc5a548));if(_0xc5a548[_0x7e49('0xe')]){if(_0xc5a548[_0x7e49('0xe')][_0x7e49('0xf')]===0x1f4){logger[_0x7e49('0xe')](_0x7e49('0x10'),_0xe1e622,_0xc5a548[_0x7e49('0xe')][_0x7e49('0x11')]);return _0x52b94b(_0xc5a548[_0x7e49('0xe')][_0x7e49('0x11')]);}logger[_0x7e49('0xe')](_0x7e49('0x10'),_0xe1e622,_0xc5a548['error'][_0x7e49('0x11')]);return _0xf899e(_0xc5a548[_0x7e49('0xe')][_0x7e49('0x11')]);}else{logger[_0x7e49('0xa')](_0x7e49('0x10'),_0xe1e622,'request\x20sent');_0xf899e(_0xc5a548[_0x7e49('0x12')][_0x7e49('0x11')]);}})['catch'](function(_0xcbe0e2){logger['error']('DeskField,\x20%s,\x20%s',_0xe1e622,_0xcbe0e2);_0x52b94b(_0xcbe0e2);});});} \ No newline at end of file +var _0xd7c3=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x32ab72,_0x47dd1b){var _0x83eea5=function(_0x5dc26c){while(--_0x5dc26c){_0x32ab72['push'](_0x32ab72['shift']());}};_0x83eea5(++_0x47dd1b);}(_0xd7c3,0x1c6));var _0x3d7c=function(_0x51c1b8,_0x222df4){_0x51c1b8=_0x51c1b8-0x0;var _0x2a56ca=_0xd7c3[_0x51c1b8];return _0x2a56ca;};'use strict';var _=require(_0x3d7c('0x0'));var util=require(_0x3d7c('0x1'));var moment=require(_0x3d7c('0x2'));var BPromise=require(_0x3d7c('0x3'));var rs=require(_0x3d7c('0x4'));var fs=require('fs');var Redis=require(_0x3d7c('0x5'));var db=require(_0x3d7c('0x6'))['db'];var utils=require(_0x3d7c('0x7'));var logger=require(_0x3d7c('0x8'))(_0x3d7c('0x9'));var config=require('../../config/environment');var jayson=require(_0x3d7c('0xa'));var client=jayson['client'][_0x3d7c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a62d1,_0x1218c8,_0x81cc8){return new BPromise(function(_0x25aef0,_0x11a459){return client[_0x3d7c('0xc')](_0x5a62d1,_0x81cc8)[_0x3d7c('0xd')](function(_0x27be8a){logger['info'](_0x3d7c('0xe'),_0x1218c8,_0x3d7c('0xf'));logger['debug'](_0x3d7c('0x10'),_0x1218c8,_0x3d7c('0xf'),JSON[_0x3d7c('0x11')](_0x27be8a));if(_0x27be8a['error']){if(_0x27be8a[_0x3d7c('0x12')]['code']===0x1f4){logger[_0x3d7c('0x12')]('DeskField,\x20%s,\x20%s',_0x1218c8,_0x27be8a[_0x3d7c('0x12')]['message']);return _0x11a459(_0x27be8a['error'][_0x3d7c('0x13')]);}logger['error'](_0x3d7c('0xe'),_0x1218c8,_0x27be8a['error'][_0x3d7c('0x13')]);return _0x25aef0(_0x27be8a[_0x3d7c('0x12')][_0x3d7c('0x13')]);}else{logger[_0x3d7c('0x14')](_0x3d7c('0xe'),_0x1218c8,_0x3d7c('0xf'));_0x25aef0(_0x27be8a[_0x3d7c('0x15')][_0x3d7c('0x13')]);}})[_0x3d7c('0x16')](function(_0x10b646){logger[_0x3d7c('0x12')](_0x3d7c('0xe'),_0x1218c8,_0x10b646);_0x11a459(_0x10b646);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index e0c30df..6e213bc 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 _0x20d5=['post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getFields'];(function(_0x4ede49,_0x6d04da){var _0x2cedbe=function(_0x1ed1fd){while(--_0x1ed1fd){_0x4ede49['push'](_0x4ede49['shift']());}};_0x2cedbe(++_0x6d04da);}(_0x20d5,0x181));var _0x520d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x20d5[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x520d('0x0'));var util=require(_0x520d('0x1'));var path=require('path');var timeout=require(_0x520d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x520d('0x3'));var interaction=require(_0x520d('0x4'));var config=require(_0x520d('0x5'));var controller=require(_0x520d('0x6'));router[_0x520d('0x7')]('/',auth['isAuthenticated'](),controller[_0x520d('0x8')]);router[_0x520d('0x7')](_0x520d('0x9'),auth[_0x520d('0xa')](),controller[_0x520d('0xb')]);router[_0x520d('0x7')](_0x520d('0xc'),auth[_0x520d('0xa')](),controller['getConfigurations']);router[_0x520d('0x7')]('/:id/fields',auth[_0x520d('0xa')](),controller[_0x520d('0xd')]);router[_0x520d('0xe')]('/',auth[_0x520d('0xa')](),controller[_0x520d('0xf')]);router[_0x520d('0xe')]('/:id/configurations',auth[_0x520d('0xa')](),controller['addConfiguration']);router[_0x520d('0x10')](_0x520d('0x9'),auth[_0x520d('0xa')](),controller[_0x520d('0x11')]);router[_0x520d('0x12')](_0x520d('0x9'),auth[_0x520d('0xa')](),controller[_0x520d('0x13')]);module[_0x520d('0x14')]=router; \ No newline at end of file +var _0xd982=['/:id','/:id/fields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index'];(function(_0x447338,_0x31ddb3){var _0x5e4ffd=function(_0x118347){while(--_0x118347){_0x447338['push'](_0x447338['shift']());}};_0x5e4ffd(++_0x31ddb3);}(_0xd982,0x67));var _0x2d98=function(_0x4a21cb,_0x1b0e50){_0x4a21cb=_0x4a21cb-0x0;var _0x584789=_0xd982[_0x4a21cb];return _0x584789;};'use strict';var multer=require(_0x2d98('0x0'));var util=require(_0x2d98('0x1'));var path=require(_0x2d98('0x2'));var timeout=require(_0x2d98('0x3'));var express=require(_0x2d98('0x4'));var router=express[_0x2d98('0x5')]();var fs_extra=require(_0x2d98('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2d98('0x7'));var controller=require(_0x2d98('0x8'));router[_0x2d98('0x9')]('/',auth[_0x2d98('0xa')](),controller[_0x2d98('0xb')]);router[_0x2d98('0x9')](_0x2d98('0xc'),auth[_0x2d98('0xa')](),controller['show']);router[_0x2d98('0x9')]('/:id/configurations',auth[_0x2d98('0xa')](),controller['getConfigurations']);router[_0x2d98('0x9')](_0x2d98('0xd'),auth[_0x2d98('0xa')](),controller['getFields']);router[_0x2d98('0xe')]('/',auth[_0x2d98('0xa')](),controller[_0x2d98('0xf')]);router[_0x2d98('0xe')](_0x2d98('0x10'),auth[_0x2d98('0xa')](),controller[_0x2d98('0x11')]);router[_0x2d98('0x12')](_0x2d98('0xc'),auth[_0x2d98('0xa')](),controller[_0x2d98('0x13')]);router[_0x2d98('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x2d98('0x15')]);module[_0x2d98('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 79b5fa6..6a35cd0 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 _0x5d9d=['exports','STRING'];(function(_0x41acff,_0x46ba01){var _0x36b20a=function(_0x130006){while(--_0x130006){_0x41acff['push'](_0x41acff['shift']());}};_0x36b20a(++_0x46ba01);}(_0x5d9d,0xcc));var _0xd5d9=function(_0x30a785,_0x322092){_0x30a785=_0x30a785-0x0;var _0x20b52a=_0x5d9d[_0x30a785];return _0x20b52a;};'use strict';var Sequelize=require('sequelize');module[_0xd5d9('0x0')]={'name':{'type':Sequelize[_0xd5d9('0x1')]},'username':{'type':Sequelize[_0xd5d9('0x1')]},'password':{'type':Sequelize[_0xd5d9('0x1')]},'remoteUri':{'type':Sequelize[_0xd5d9('0x1')]},'tenantId':{'type':Sequelize[_0xd5d9('0x1')]},'clientId':{'type':Sequelize[_0xd5d9('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd5d9('0x1')]}}; \ No newline at end of file +var _0x5081=['exports','STRING','sequelize'];(function(_0x5a48fd,_0x3592bb){var _0x263659=function(_0xddb66d){while(--_0xddb66d){_0x5a48fd['push'](_0x5a48fd['shift']());}};_0x263659(++_0x3592bb);}(_0x5081,0x1a0));var _0x1508=function(_0x421968,_0x597958){_0x421968=_0x421968-0x0;var _0x306dae=_0x5081[_0x421968];return _0x306dae;};'use strict';var Sequelize=require(_0x1508('0x0'));module[_0x1508('0x1')]={'name':{'type':Sequelize[_0x1508('0x2')]},'username':{'type':Sequelize[_0x1508('0x2')]},'password':{'type':Sequelize[_0x1508('0x2')]},'remoteUri':{'type':Sequelize[_0x1508('0x2')]},'tenantId':{'type':Sequelize[_0x1508('0x2')]},'clientId':{'type':Sequelize[_0x1508('0x2')]},'clientSecret':{'type':Sequelize[_0x1508('0x2')]},'serverUrl':{'type':Sequelize[_0x1508('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x1508('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 9e8f374..d3a5cb1 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 _0x8c99=['LogicalName','DisplayName','Label',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','stack','name','send','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','Dynamics365Account','then','include','findAll','rows','show','keys','length','includeAll','find','create','body','catch','update','params','destroy','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Configuration','Dynamics365Field','getFields','ticketType','incident','Incident','PhoneCall','description','customerid','caseorigincode','subject','phonenumber','regardingobjectid','accountidname','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','productidname','productserialnumber','resolvebykpiidname','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','concat','username','password','tenantId','remoteUri','lastIndexOf','https://login.microsoftonline.com/','/oauth2/token','clientSecret','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','GET',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','remove','includes','forEach','@odata.type','PicklistAttributeMetadata','push','MetadataId','all','isNil','substring','BooleanAttributeMetadata','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','error','Wrong\x20credentials','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','UserLocalizedLabel'];(function(_0x329b6d,_0x4d2e0c){var _0x25799b=function(_0x27ce39){while(--_0x27ce39){_0x329b6d['push'](_0x329b6d['shift']());}};_0x25799b(++_0x4d2e0c);}(_0x8c99,0x1a8));var _0x98c9=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0x8c99[_0x9aada2];return _0x196dff;};'use strict';var emlformat=require(_0x98c9('0x0'));var rimraf=require(_0x98c9('0x1'));var zipdir=require(_0x98c9('0x2'));var jsonpatch=require(_0x98c9('0x3'));var rp=require(_0x98c9('0x4'));var moment=require(_0x98c9('0x5'));var BPromise=require(_0x98c9('0x6'));var Mustache=require(_0x98c9('0x7'));var util=require(_0x98c9('0x8'));var path=require(_0x98c9('0x9'));var sox=require(_0x98c9('0xa'));var csv=require(_0x98c9('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x98c9('0xc'));var _=require(_0x98c9('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x98c9('0xe'));var toCsv=require(_0x98c9('0xb'));var querystring=require(_0x98c9('0xf'));var Papa=require(_0x98c9('0x10'));var Redis=require(_0x98c9('0x11'));var authService=require(_0x98c9('0x12'));var qs=require(_0x98c9('0x13'));var as=require(_0x98c9('0x14'));var hardwareService=require(_0x98c9('0x15'));var logger=require(_0x98c9('0x16'))(_0x98c9('0x17'));var utils=require('../../config/utils');var config=require(_0x98c9('0x18'));var licenseUtil=require(_0x98c9('0x19'));var db=require(_0x98c9('0x1a'))['db'];var integrations=require(_0x98c9('0x1b'));function respondWithStatusCode(_0x506c26,_0x2dd2d3){_0x2dd2d3=_0x2dd2d3||0xcc;return function(_0x312cda){if(_0x312cda){return _0x506c26[_0x98c9('0x1c')](_0x2dd2d3);}return _0x506c26[_0x98c9('0x1d')](_0x2dd2d3)[_0x98c9('0x1e')]();};}function respondWithResult(_0x5b52f0,_0x2b0819){_0x2b0819=_0x2b0819||0xc8;return function(_0x29f4d0){if(_0x29f4d0){return _0x5b52f0[_0x98c9('0x1d')](_0x2b0819)[_0x98c9('0x1f')](_0x29f4d0);}};}function respondWithFilteredResult(_0x1e498c,_0x3bc4bd){return function(_0x30e81b){if(_0x30e81b){var _0x1d5dfc=typeof _0x3bc4bd[_0x98c9('0x20')]===_0x98c9('0x21')&&typeof _0x3bc4bd[_0x98c9('0x22')]===_0x98c9('0x21');var _0x3d54cf=_0x30e81b[_0x98c9('0x23')];var _0x534903=_0x1d5dfc?0x0:_0x3bc4bd[_0x98c9('0x20')];var _0x22fe71=_0x1d5dfc?_0x30e81b['count']:_0x3bc4bd[_0x98c9('0x20')]+_0x3bc4bd['limit'];var _0x405d22;if(_0x22fe71>=_0x3d54cf){_0x22fe71=_0x3d54cf;_0x405d22=0xc8;}else{_0x405d22=0xce;}_0x1e498c[_0x98c9('0x1d')](_0x405d22);return _0x1e498c[_0x98c9('0x24')](_0x98c9('0x25'),_0x534903+'-'+_0x22fe71+'/'+_0x3d54cf)['json'](_0x30e81b);}return null;};}function patchUpdates(_0x3e6845){return function(_0x2d012a){try{jsonpatch[_0x98c9('0x26')](_0x2d012a,_0x3e6845,!![]);}catch(_0x20aafd){return BPromise['reject'](_0x20aafd);}return _0x2d012a[_0x98c9('0x27')]();};}function saveUpdates(_0x3a2fb2,_0x18bd33){return function(_0x2116e5){if(_0x2116e5){return _0x2116e5['update'](_0x3a2fb2)['then'](function(_0x44a4ae){return _0x44a4ae;});}return null;};}function removeEntity(_0x4373cc,_0xca3425){return function(_0x52fe03){if(_0x52fe03){return _0x52fe03['destroy']()['then'](function(){_0x4373cc[_0x98c9('0x1d')](0xcc)[_0x98c9('0x1e')]();});}};}function handleEntityNotFound(_0x5e383f,_0x339de0){return function(_0x2b3562){if(!_0x2b3562){_0x5e383f[_0x98c9('0x1c')](0x194);}return _0x2b3562;};}function handleError(_0x10cde2,_0x3f503a){_0x3f503a=_0x3f503a||0x1f4;return function(_0x25b2d4){logger['error'](_0x25b2d4[_0x98c9('0x28')]);if(_0x25b2d4[_0x98c9('0x29')]){delete _0x25b2d4[_0x98c9('0x29')];}_0x10cde2[_0x98c9('0x1d')](_0x3f503a)[_0x98c9('0x2a')](_0x25b2d4);};}exports['index']=function(_0xf25270,_0x33c270){var _0x58c6e3={},_0x1c1d8e={},_0x49549c={'count':0x0,'rows':[]};var _0x5a3b8b=_[_0x98c9('0x2b')](db['Dynamics365Account'][_0x98c9('0x2c')],function(_0x244a88){return{'name':_0x244a88[_0x98c9('0x2d')],'type':_0x244a88[_0x98c9('0x2e')][_0x98c9('0x2f')]};});_0x1c1d8e['model']=_['map'](_0x5a3b8b,_0x98c9('0x29'));_0x1c1d8e[_0x98c9('0x30')]=_['keys'](_0xf25270[_0x98c9('0x30')]);_0x1c1d8e[_0x98c9('0x31')]=_[_0x98c9('0x32')](_0x1c1d8e[_0x98c9('0x33')],_0x1c1d8e[_0x98c9('0x30')]);_0x58c6e3['attributes']=_[_0x98c9('0x32')](_0x1c1d8e[_0x98c9('0x33')],qs['fields'](_0xf25270['query'][_0x98c9('0x34')]));_0x58c6e3[_0x98c9('0x35')]=_0x58c6e3[_0x98c9('0x35')]['length']?_0x58c6e3[_0x98c9('0x35')]:_0x1c1d8e[_0x98c9('0x33')];if(!_0xf25270[_0x98c9('0x30')][_0x98c9('0x36')](_0x98c9('0x37'))){_0x58c6e3['limit']=qs[_0x98c9('0x22')](_0xf25270['query'][_0x98c9('0x22')]);_0x58c6e3[_0x98c9('0x20')]=qs['offset'](_0xf25270[_0x98c9('0x30')][_0x98c9('0x20')]);}_0x58c6e3[_0x98c9('0x38')]=qs['sort'](_0xf25270[_0x98c9('0x30')][_0x98c9('0x39')]);_0x58c6e3[_0x98c9('0x3a')]=qs['filters'](_[_0x98c9('0x3b')](_0xf25270['query'],_0x1c1d8e['filters']),_0x5a3b8b);if(_0xf25270[_0x98c9('0x30')][_0x98c9('0x3c')]){_0x58c6e3[_0x98c9('0x3a')]=_['merge'](_0x58c6e3['where'],{'$or':_[_0x98c9('0x2b')](_0x5a3b8b,function(_0x2a7408){if(_0x2a7408[_0x98c9('0x2e')]!==_0x98c9('0x3d')){var _0x421aa4={};_0x421aa4[_0x2a7408[_0x98c9('0x29')]]={'$like':'%'+_0xf25270[_0x98c9('0x30')][_0x98c9('0x3c')]+'%'};return _0x421aa4;}})});}_0x58c6e3=_[_0x98c9('0x3e')]({},_0x58c6e3,_0xf25270[_0x98c9('0x3f')]);var _0x107687={'where':_0x58c6e3[_0x98c9('0x3a')]};return db[_0x98c9('0x40')][_0x98c9('0x23')](_0x107687)[_0x98c9('0x41')](function(_0x5743fb){_0x49549c['count']=_0x5743fb;if(_0xf25270[_0x98c9('0x30')]['includeAll']){_0x58c6e3[_0x98c9('0x42')]=[{'all':!![]}];}return db[_0x98c9('0x40')][_0x98c9('0x43')](_0x58c6e3);})[_0x98c9('0x41')](function(_0x4c166d){_0x49549c[_0x98c9('0x44')]=_0x4c166d;return _0x49549c;})[_0x98c9('0x41')](respondWithFilteredResult(_0x33c270,_0x58c6e3))['catch'](handleError(_0x33c270,null));};exports[_0x98c9('0x45')]=function(_0x2f5372,_0x150282){var _0x5b4c0d={'raw':![],'where':{'id':_0x2f5372['params']['id']}},_0x127389={};_0x127389['model']=_[_0x98c9('0x46')](db[_0x98c9('0x40')][_0x98c9('0x2c')]);_0x127389[_0x98c9('0x30')]=_[_0x98c9('0x46')](_0x2f5372[_0x98c9('0x30')]);_0x127389['filters']=_[_0x98c9('0x32')](_0x127389[_0x98c9('0x33')],_0x127389[_0x98c9('0x30')]);_0x5b4c0d[_0x98c9('0x35')]=_[_0x98c9('0x32')](_0x127389[_0x98c9('0x33')],qs['fields'](_0x2f5372[_0x98c9('0x30')][_0x98c9('0x34')]));_0x5b4c0d['attributes']=_0x5b4c0d[_0x98c9('0x35')][_0x98c9('0x47')]?_0x5b4c0d[_0x98c9('0x35')]:_0x127389[_0x98c9('0x33')];if(_0x2f5372[_0x98c9('0x30')][_0x98c9('0x48')]){_0x5b4c0d[_0x98c9('0x42')]=[{'all':!![]}];}_0x5b4c0d=_[_0x98c9('0x3e')]({},_0x5b4c0d,_0x2f5372['options']);return db['Dynamics365Account'][_0x98c9('0x49')](_0x5b4c0d)[_0x98c9('0x41')](handleEntityNotFound(_0x150282,null))[_0x98c9('0x41')](respondWithResult(_0x150282,null))['catch'](handleError(_0x150282,null));};exports[_0x98c9('0x4a')]=function(_0x5f175f,_0x5bb8df){return db['Dynamics365Account'][_0x98c9('0x4a')](_0x5f175f[_0x98c9('0x4b')],{})[_0x98c9('0x41')](respondWithResult(_0x5bb8df,0xc9))[_0x98c9('0x4c')](handleError(_0x5bb8df,null));};exports[_0x98c9('0x4d')]=function(_0x18efcd,_0x3b70b0){if(_0x18efcd['body']['id']){delete _0x18efcd[_0x98c9('0x4b')]['id'];}return db[_0x98c9('0x40')][_0x98c9('0x49')]({'where':{'id':_0x18efcd[_0x98c9('0x4e')]['id']}})[_0x98c9('0x41')](handleEntityNotFound(_0x3b70b0,null))[_0x98c9('0x41')](saveUpdates(_0x18efcd[_0x98c9('0x4b')],null))[_0x98c9('0x41')](respondWithResult(_0x3b70b0,null))[_0x98c9('0x4c')](handleError(_0x3b70b0,null));};exports[_0x98c9('0x4f')]=function(_0x148489,_0x142cf5){return db['Dynamics365Account'][_0x98c9('0x49')]({'where':{'id':_0x148489[_0x98c9('0x4e')]['id']}})[_0x98c9('0x41')](handleEntityNotFound(_0x142cf5,null))[_0x98c9('0x41')](removeEntity(_0x142cf5,null))[_0x98c9('0x4c')](handleError(_0x142cf5,null));};exports[_0x98c9('0x50')]=function(_0x1c78d1,_0x1d03ee,_0x16af0c){var _0x37bd31={};var _0x568671={};var _0xc9bbb4;var _0x4cc3ac;return db[_0x98c9('0x40')][_0x98c9('0x51')]({'where':{'id':_0x1c78d1[_0x98c9('0x4e')]['id']}})[_0x98c9('0x41')](handleEntityNotFound(_0x1d03ee,null))[_0x98c9('0x41')](function(_0x4c26b2){if(_0x4c26b2){_0xc9bbb4=_0x4c26b2;_0x568671[_0x98c9('0x33')]=_[_0x98c9('0x46')](db['Dynamics365Configuration']['rawAttributes']);_0x568671[_0x98c9('0x30')]=_[_0x98c9('0x46')](_0x1c78d1[_0x98c9('0x30')]);_0x568671[_0x98c9('0x31')]=_['intersection'](_0x568671[_0x98c9('0x33')],_0x568671[_0x98c9('0x30')]);_0x37bd31[_0x98c9('0x35')]=_[_0x98c9('0x32')](_0x568671[_0x98c9('0x33')],qs[_0x98c9('0x34')](_0x1c78d1['query'][_0x98c9('0x34')]));_0x37bd31[_0x98c9('0x35')]=_0x37bd31[_0x98c9('0x35')]['length']?_0x37bd31[_0x98c9('0x35')]:_0x568671[_0x98c9('0x33')];_0x37bd31[_0x98c9('0x38')]=qs[_0x98c9('0x39')](_0x1c78d1['query'][_0x98c9('0x39')]);_0x37bd31[_0x98c9('0x3a')]=qs[_0x98c9('0x31')](_[_0x98c9('0x3b')](_0x1c78d1[_0x98c9('0x30')],_0x568671[_0x98c9('0x31')]));if(_0x1c78d1[_0x98c9('0x30')][_0x98c9('0x3c')]){_0x37bd31[_0x98c9('0x3a')]=_[_0x98c9('0x3e')](_0x37bd31[_0x98c9('0x3a')],{'$or':_['map'](_0x37bd31[_0x98c9('0x35')],function(_0x363888){var _0x154643={};_0x154643[_0x363888]={'$like':'%'+_0x1c78d1[_0x98c9('0x30')]['filter']+'%'};return _0x154643;})});}_0x37bd31=_['merge']({},_0x37bd31,_0x1c78d1[_0x98c9('0x3f')]);return _0xc9bbb4[_0x98c9('0x50')](_0x37bd31);}})['then'](function(_0x3caf73){if(_0x3caf73){_0x4cc3ac=_0x3caf73[_0x98c9('0x47')];if(!_0x1c78d1[_0x98c9('0x30')][_0x98c9('0x36')](_0x98c9('0x37'))){_0x37bd31[_0x98c9('0x22')]=qs[_0x98c9('0x22')](_0x1c78d1[_0x98c9('0x30')][_0x98c9('0x22')]);_0x37bd31[_0x98c9('0x20')]=qs[_0x98c9('0x20')](_0x1c78d1[_0x98c9('0x30')]['offset']);}return _0xc9bbb4['getConfigurations'](_0x37bd31);}})[_0x98c9('0x41')](function(_0x57e0ce){if(_0x57e0ce){return _0x57e0ce?{'count':_0x4cc3ac,'rows':_0x57e0ce}:null;}})[_0x98c9('0x41')](respondWithResult(_0x1d03ee,null))[_0x98c9('0x4c')](handleError(_0x1d03ee,null));};exports[_0x98c9('0x52')]=function(_0x59ad99,_0x5508a7,_0x91684b){if(_0x59ad99['body']['id']){delete _0x59ad99['body']['id'];}return db[_0x98c9('0x40')][_0x98c9('0x51')]({'where':{'id':_0x59ad99['params']['id']}})['then'](handleEntityNotFound(_0x5508a7,null))['then'](function(_0x3e3ca3){if(_0x3e3ca3){_0x59ad99[_0x98c9('0x4b')][_0x98c9('0x53')]=_0x3e3ca3['id'];_0x59ad99[_0x98c9('0x4b')][_0x98c9('0x54')]=integrations[_0x98c9('0x55')](_0x59ad99['body']['channel'],_0x59ad99[_0x98c9('0x4b')]['type']);_0x59ad99[_0x98c9('0x4b')][_0x98c9('0x56')]=integrations[_0x98c9('0x57')](_0x59ad99[_0x98c9('0x4b')][_0x98c9('0x58')],_0x59ad99[_0x98c9('0x4b')]['type']);return db[_0x98c9('0x59')][_0x98c9('0x4a')](_0x59ad99['body'],{'include':[{'model':db[_0x98c9('0x5a')],'as':_0x98c9('0x54')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x5508a7,null))[_0x98c9('0x4c')](handleError(_0x5508a7,null));};exports[_0x98c9('0x5b')]=function(_0x1e0a68,_0x457d19,_0x510d28){var _0x930639=_0x1e0a68[_0x98c9('0x30')][_0x98c9('0x5c')];var _0x32c3a0=_0x930639===_0x98c9('0x5d')?_0x98c9('0x5e'):_0x98c9('0x5f');var _0x145fc8='';var _0x43b2a2='';var _0x28d601='';var _0x59f60d='';var _0x3f7b6e='';var _0x2cafc6='';var _0x147af2='';var _0x5ece14='';var _0x501d6e=['title',_0x98c9('0x60'),_0x98c9('0x61'),'ownerid',_0x98c9('0x62'),_0x98c9('0x63'),_0x98c9('0x64'),_0x98c9('0x65'),'directioncode','phonecall_activity_parties'];var _0x2c53ff=[_0x98c9('0x66'),_0x98c9('0x67'),_0x98c9('0x68'),'billedserviceunits',_0x98c9('0x69'),_0x98c9('0x6a'),_0x98c9('0x6b'),'contractidname','createdbyexternalpartyname',_0x98c9('0x6c'),_0x98c9('0x6d'),_0x98c9('0x6e'),_0x98c9('0x6f'),_0x98c9('0x70'),_0x98c9('0x71'),_0x98c9('0x72'),_0x98c9('0x73'),'customeridyominame',_0x98c9('0x74'),_0x98c9('0x75'),_0x98c9('0x76'),'entityimage_url',_0x98c9('0x77'),_0x98c9('0x78'),_0x98c9('0x79'),_0x98c9('0x7a'),_0x98c9('0x7b'),'influencescore',_0x98c9('0x7c'),_0x98c9('0x7d'),_0x98c9('0x7e'),'modifiedbyexternalpartyname',_0x98c9('0x7f'),'modifiedbyname',_0x98c9('0x80'),'modifiedon',_0x98c9('0x81'),_0x98c9('0x82'),_0x98c9('0x83'),'msdyn_iotalertname','numberofchildincidents','onholdtime',_0x98c9('0x84'),_0x98c9('0x85'),_0x98c9('0x86'),_0x98c9('0x87'),_0x98c9('0x88'),_0x98c9('0x89'),'primarycontactidyominame','prioritycodename',_0x98c9('0x8a'),_0x98c9('0x8b'),'resolveby',_0x98c9('0x8c'),'responseby',_0x98c9('0x8d'),'responsiblecontactidyominame',_0x98c9('0x8e'),_0x98c9('0x8f'),_0x98c9('0x90'),_0x98c9('0x91'),_0x98c9('0x92'),'statuscode',_0x98c9('0x93'),_0x98c9('0x94'),_0x98c9('0x95'),_0x98c9('0x96'),'traversedpath',_0x98c9('0x97'),'versionnumber'];var _0x253ea6=_0x501d6e[_0x98c9('0x98')](_0x2c53ff);return db[_0x98c9('0x40')][_0x98c9('0x51')]({'where':{'id':_0x1e0a68[_0x98c9('0x4e')]['id']},'attributes':['id',_0x98c9('0x99'),_0x98c9('0x9a'),'remoteUri',_0x98c9('0x9b'),'clientId','clientSecret']})['then'](handleEntityNotFound(_0x457d19,null))['then'](function(_0x146509){if(_0x146509){_0x5ece14=_0x146509[_0x98c9('0x9c')];var _0x459719=_0x5ece14['slice'](-0x1);if(_0x459719==='/'){_0x5ece14=_0x5ece14['substring'](0x0,_0x5ece14[_0x98c9('0x9d')](_0x459719));}_0x147af2=util['format']('%s/api/data/v9.0/',_0x5ece14);var _0x32f567={'method':'POST','uri':_0x98c9('0x9e')+_0x146509[_0x98c9('0x9b')]+_0x98c9('0x9f'),'form':{'client_id':_0x146509['clientId'],'resource':_0x5ece14,'username':_0x146509[_0x98c9('0x99')],'password':_0x146509[_0x98c9('0x9a')],'grant_type':'password','client_secret':_0x146509[_0x98c9('0xa0')]},'json':!![]};return rp(_0x32f567);}})[_0x98c9('0x41')](function(_0x186d55){_0x2cafc6=_0x186d55[_0x98c9('0xa1')];var _0x4eee7f={'method':'GET','uri':encodeURI(_0x147af2+_0x98c9('0xa2')+_0x32c3a0+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x2cafc6,'If-None-Match':null,'OData-Version':_0x98c9('0xa3')},'json':!![]};return rp(_0x4eee7f);})[_0x98c9('0x41')](function(_0x345dca){var _0x568c77=_0x345dca[_0x98c9('0xa4')][0x0];var _0x263f2d=_0x568c77['MetadataId'];var _0x1071d6={'method':_0x98c9('0xa5'),'uri':_0x147af2+'EntityDefinitions('+_0x263f2d+_0x98c9('0xa6'),'headers':{'Authorization':_0x98c9('0xa7')+_0x2cafc6,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1071d6);})[_0x98c9('0x41')](function(_0x55b348){_0x145fc8=_0x55b348;_0x43b2a2=_0x145fc8[_0x98c9('0xa8')];_0x43b2a2=_[_0x98c9('0xa9')](_0x43b2a2,function(_0x468e98){return!_0x253ea6[_0x98c9('0xaa')](_0x468e98['LogicalName']);});var _0x29233e=[];var _0x1f2969=[];_0x43b2a2[_0x98c9('0xab')](function(_0x5037b6){if(_0x5037b6[_0x98c9('0xac')]){var _0x50ab4c=_0x5037b6[_0x98c9('0xac')]['substring'](_0x5037b6['@odata.type'][_0x98c9('0x9d')]('.')+0x1);if(_0x50ab4c===_0x98c9('0xad')){_0x29233e[_0x98c9('0xae')](getSelectList(_0x147af2,_0x930639,_0x1f2969,_0x145fc8[_0x98c9('0xaf')],_0x5037b6[_0x98c9('0xaf')],_0x2cafc6));}}});return Promise[_0x98c9('0xb0')](_0x29233e);})['then'](function(_0x332468){_0x28d601=_0x332468[0x0];var _0x19d538=[];var _0x3ad0be=[];_0x43b2a2[_0x98c9('0xab')](function(_0x19c810){if(!_[_0x98c9('0xb1')](_0x19c810[_0x98c9('0xac')])){var _0x2862dd=_0x19c810['@odata.type'][_0x98c9('0xb2')](_0x19c810[_0x98c9('0xac')][_0x98c9('0x9d')]('.')+0x1);if(_0x2862dd===_0x98c9('0xb3')){_0x19d538['push'](getBooleanList(_0x147af2,_0x930639,_0x3ad0be,_0x145fc8[_0x98c9('0xaf')],_0x19c810[_0x98c9('0xaf')],_0x2cafc6));}}});return Promise[_0x98c9('0xb0')](_0x19d538);})['then'](function(_0x4313da){_0x59f60d=_0x4313da[0x0];var _0x5751e9=[];var _0x5d3b3d=[];_0x43b2a2['forEach'](function(_0x5cff86){if(_0x5cff86[_0x98c9('0xac')]){var _0x2a8762=_0x5cff86[_0x98c9('0xac')]['substring'](_0x5cff86[_0x98c9('0xac')][_0x98c9('0x9d')]('.')+0x1);if(_0x2a8762===_0x98c9('0xb4')||_0x2a8762==='DoubleAttributeMetadata'||_0x2a8762===_0x98c9('0xb5')||_0x2a8762===_0x98c9('0xb6')||_0x2a8762===_0x98c9('0xb7')||_0x2a8762===_0x98c9('0xb8')||_0x2a8762===_0x98c9('0xb9')||_0x2a8762===_0x98c9('0xba')||_0x2a8762===_0x98c9('0xbb')||_0x2a8762===_0x98c9('0xbc')){_0x5751e9['push'](getInputList(_0x147af2,_0x930639,_0x2a8762,_0x5d3b3d,_0x145fc8[_0x98c9('0xaf')],_0x5cff86[_0x98c9('0xaf')],_0x2cafc6));}}});return Promise[_0x98c9('0xb0')](_0x5751e9);})['then'](function(_0x2c32cd){_0x3f7b6e=_0x2c32cd[0x0];var _0x5188a7=_0x28d601[_0x98c9('0x98')](_0x59f60d)[_0x98c9('0x98')](_0x3f7b6e);var _0x28448f={'count':_0x5188a7[_0x98c9('0x47')],'rows':_0x5188a7};return _0x28448f;})[_0x98c9('0x41')](respondWithResult(_0x457d19,null))[_0x98c9('0x4c')](function(_0x496862){var _0x46296f=_0x1e0a68[_0x98c9('0x30')][_0x98c9('0xbd')]?0x1f4:_0x496862[_0x98c9('0xbe')]||0x1f4;logger[_0x98c9('0xbf')](_0x496862['stack']);delete _0x496862[_0x98c9('0x29')];if(_0x46296f===0x191){_0x46296f=0x190;}_0x457d19['status'](_0x46296f)[_0x98c9('0x2a')](_0x1e0a68[_0x98c9('0x30')]['test']?{'message':_0x98c9('0xc0'),'statusCode':_0x496862[_0x98c9('0xbe')]}:_0x496862);});};function getSelectList(_0xf799a8,_0x55d821,_0x13bbc0,_0x139347,_0x44b408,_0x575fa3){var _0x1889a6={'method':'GET','uri':_0xf799a8+_0x98c9('0xc1')+_0x139347+_0x98c9('0xc2')+_0x44b408+_0x98c9('0xc3')+_0x98c9('0xc4'),'headers':{'Authorization':_0x98c9('0xa7')+_0x575fa3,'If-None-Match':null,'OData-Version':_0x98c9('0xa3')},'json':!![]};return rp(_0x1889a6)['then'](function(_0x14bae7){var _0x33c377=[];var _0x611435=_0x14bae7[_0x98c9('0xc5')][_0x98c9('0xc6')];_0x611435[_0x98c9('0xab')](function(_0x5b0c79){_0x33c377[_0x98c9('0xae')]({'name':_0x5b0c79['Label'][_0x98c9('0xc7')]['Label'],'value':String(_0x5b0c79['Value'])});});var _0x96247d={'id':_0x55d821+'_'+_0x14bae7[_0x98c9('0xc8')],'name':_0x14bae7[_0x98c9('0xc9')][_0x98c9('0xc7')][_0x98c9('0xca')],'custom':![],'options':_0x33c377};_0x13bbc0[_0x98c9('0xae')](_0x96247d);return _0x13bbc0;});}function getBooleanList(_0xdd8d72,_0x8972f5,_0x2b6368,_0xf7c03e,_0x3c71b6,_0xc77f87){var _0x595888={'method':_0x98c9('0xa5'),'uri':_0xdd8d72+_0x98c9('0xc1')+_0xf7c03e+_0x98c9('0xc2')+_0x3c71b6+_0x98c9('0xcb'),'headers':{'Authorization':_0x98c9('0xa7')+_0xc77f87,'If-None-Match':null,'OData-Version':_0x98c9('0xa3')},'json':!![]};return rp(_0x595888)[_0x98c9('0x41')](function(_0x5abc0c){var _0x275035=[];_0x275035[_0x98c9('0xae')]({'name':_0x5abc0c[_0x98c9('0xc5')][_0x98c9('0xcc')][_0x98c9('0xca')]['UserLocalizedLabel']['Label'],'value':_0x98c9('0xcd')},{'name':_0x5abc0c[_0x98c9('0xc5')][_0x98c9('0xce')][_0x98c9('0xca')][_0x98c9('0xc7')][_0x98c9('0xca')],'value':'false'});var _0x56cc25={'id':_0x8972f5+'_'+_0x5abc0c[_0x98c9('0xc8')],'name':_0x5abc0c[_0x98c9('0xc9')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x275035};_0x2b6368[_0x98c9('0xae')](_0x56cc25);return _0x2b6368;});}function getInputList(_0x385250,_0x18bd88,_0x13a034,_0x2a3fe3,_0x3b5b74,_0x462450,_0x396028){var _0x3173ad={'method':_0x98c9('0xa5'),'uri':_0x385250+'EntityDefinitions('+_0x3b5b74+')/Attributes('+_0x462450+')/Microsoft.Dynamics.CRM.'+_0x13a034+_0x98c9('0xcf'),'headers':{'Authorization':_0x98c9('0xa7')+_0x396028,'If-None-Match':null,'OData-Version':_0x98c9('0xa3')},'json':!![]};return rp(_0x3173ad)['then'](function(_0x597801){var _0x115f5c={'id':_0x18bd88+'_'+_0x597801[_0x98c9('0xc8')],'name':_0x597801[_0x98c9('0xc9')][_0x98c9('0xc7')]?_0x597801[_0x98c9('0xc9')][_0x98c9('0xc7')][_0x98c9('0xca')]:_0x597801[_0x98c9('0xc8')],'custom':![],'options':[]};_0x2a3fe3['push'](_0x115f5c);return _0x2a3fe3;});} \ No newline at end of file +var _0xa73a=['params','length','include','find','create','body','getConfigurations','Dynamics365Configuration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','incident','Incident','description','customerid','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidname','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','concat','username','password','remoteUri','tenantId','substring','lastIndexOf','format','POST','https://login.microsoftonline.com/','clientId','clientSecret','access_token','GET','value',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','4.0','Attributes','LogicalName','@odata.type','PicklistAttributeMetadata','MetadataId','all','forEach','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','statusCode','error','send','Wrong\x20credentials','EntityDefinitions(',')/Attributes(','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','?$select=DisplayName,LogicalName','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../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','name','map','Dynamics365Account','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa73a,0x82));var _0xaa73=function(_0x39f34f,_0x298f45){_0x39f34f=_0x39f34f-0x0;var _0x59fee1=_0xa73a[_0x39f34f];return _0x59fee1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaa73('0x0'));var zipdir=require(_0xaa73('0x1'));var jsonpatch=require(_0xaa73('0x2'));var rp=require(_0xaa73('0x3'));var moment=require(_0xaa73('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xaa73('0x5'));var sox=require(_0xaa73('0x6'));var csv=require(_0xaa73('0x7'));var ejs=require(_0xaa73('0x8'));var fs=require('fs');var fs_extra=require(_0xaa73('0x9'));var _=require(_0xaa73('0xa'));var squel=require(_0xaa73('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaa73('0xc'));var toCsv=require(_0xaa73('0x7'));var querystring=require(_0xaa73('0xd'));var Papa=require(_0xaa73('0xe'));var Redis=require(_0xaa73('0xf'));var authService=require(_0xaa73('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa73('0x11'));var logger=require('../../config/logger')(_0xaa73('0x12'));var utils=require('../../config/utils');var config=require(_0xaa73('0x13'));var licenseUtil=require(_0xaa73('0x14'));var db=require(_0xaa73('0x15'))['db'];var integrations=require(_0xaa73('0x16'));function respondWithStatusCode(_0x44915e,_0x213aa1){_0x213aa1=_0x213aa1||0xcc;return function(_0x5e3bba){if(_0x5e3bba){return _0x44915e[_0xaa73('0x17')](_0x213aa1);}return _0x44915e[_0xaa73('0x18')](_0x213aa1)[_0xaa73('0x19')]();};}function respondWithResult(_0x457922,_0xc4a8e){_0xc4a8e=_0xc4a8e||0xc8;return function(_0x319e55){if(_0x319e55){return _0x457922[_0xaa73('0x18')](_0xc4a8e)[_0xaa73('0x1a')](_0x319e55);}};}function respondWithFilteredResult(_0x339c82,_0x5a4174){return function(_0x409d07){if(_0x409d07){var _0x5e2932=typeof _0x5a4174[_0xaa73('0x1b')]===_0xaa73('0x1c')&&typeof _0x5a4174[_0xaa73('0x1d')]==='undefined';var _0x5ed9d6=_0x409d07[_0xaa73('0x1e')];var _0x5cc83b=_0x5e2932?0x0:_0x5a4174[_0xaa73('0x1b')];var _0x388ded=_0x5e2932?_0x409d07['count']:_0x5a4174[_0xaa73('0x1b')]+_0x5a4174[_0xaa73('0x1d')];var _0x2de907;if(_0x388ded>=_0x5ed9d6){_0x388ded=_0x5ed9d6;_0x2de907=0xc8;}else{_0x2de907=0xce;}_0x339c82[_0xaa73('0x18')](_0x2de907);return _0x339c82[_0xaa73('0x1f')](_0xaa73('0x20'),_0x5cc83b+'-'+_0x388ded+'/'+_0x5ed9d6)['json'](_0x409d07);}return null;};}function patchUpdates(_0x551790){return function(_0x53d9e8){try{jsonpatch[_0xaa73('0x21')](_0x53d9e8,_0x551790,!![]);}catch(_0x3f5c37){return BPromise[_0xaa73('0x22')](_0x3f5c37);}return _0x53d9e8[_0xaa73('0x23')]();};}function saveUpdates(_0x53b746,_0x5ac0c5){return function(_0x5303eb){if(_0x5303eb){return _0x5303eb[_0xaa73('0x24')](_0x53b746)[_0xaa73('0x25')](function(_0x2d7798){return _0x2d7798;});}return null;};}function removeEntity(_0x346d57,_0x482795){return function(_0x233764){if(_0x233764){return _0x233764[_0xaa73('0x26')]()[_0xaa73('0x25')](function(){_0x346d57['status'](0xcc)[_0xaa73('0x19')]();});}};}function handleEntityNotFound(_0x88731,_0x2e34a8){return function(_0x16cc63){if(!_0x16cc63){_0x88731[_0xaa73('0x17')](0x194);}return _0x16cc63;};}function handleError(_0x1253aa,_0x1ed112){_0x1ed112=_0x1ed112||0x1f4;return function(_0x3ab19f){logger['error'](_0x3ab19f['stack']);if(_0x3ab19f['name']){delete _0x3ab19f[_0xaa73('0x27')];}_0x1253aa['status'](_0x1ed112)['send'](_0x3ab19f);};}exports['index']=function(_0x7b7f86,_0x344e31){var _0x5613a4={},_0x532ded={},_0x5ce12c={'count':0x0,'rows':[]};var _0x35e714=_[_0xaa73('0x28')](db[_0xaa73('0x29')][_0xaa73('0x2a')],function(_0x4d69f0){return{'name':_0x4d69f0[_0xaa73('0x2b')],'type':_0x4d69f0['type'][_0xaa73('0x2c')]};});_0x532ded['model']=_['map'](_0x35e714,_0xaa73('0x27'));_0x532ded[_0xaa73('0x2d')]=_[_0xaa73('0x2e')](_0x7b7f86[_0xaa73('0x2d')]);_0x532ded['filters']=_[_0xaa73('0x2f')](_0x532ded[_0xaa73('0x30')],_0x532ded[_0xaa73('0x2d')]);_0x5613a4[_0xaa73('0x31')]=_[_0xaa73('0x2f')](_0x532ded[_0xaa73('0x30')],qs[_0xaa73('0x32')](_0x7b7f86[_0xaa73('0x2d')][_0xaa73('0x32')]));_0x5613a4['attributes']=_0x5613a4['attributes']['length']?_0x5613a4[_0xaa73('0x31')]:_0x532ded[_0xaa73('0x30')];if(!_0x7b7f86[_0xaa73('0x2d')][_0xaa73('0x33')](_0xaa73('0x34'))){_0x5613a4[_0xaa73('0x1d')]=qs[_0xaa73('0x1d')](_0x7b7f86[_0xaa73('0x2d')][_0xaa73('0x1d')]);_0x5613a4[_0xaa73('0x1b')]=qs['offset'](_0x7b7f86['query'][_0xaa73('0x1b')]);}_0x5613a4[_0xaa73('0x35')]=qs[_0xaa73('0x36')](_0x7b7f86[_0xaa73('0x2d')][_0xaa73('0x36')]);_0x5613a4[_0xaa73('0x37')]=qs[_0xaa73('0x38')](_[_0xaa73('0x39')](_0x7b7f86['query'],_0x532ded[_0xaa73('0x38')]),_0x35e714);if(_0x7b7f86[_0xaa73('0x2d')][_0xaa73('0x3a')]){_0x5613a4[_0xaa73('0x37')]=_[_0xaa73('0x3b')](_0x5613a4[_0xaa73('0x37')],{'$or':_['map'](_0x35e714,function(_0x448f8c){if(_0x448f8c[_0xaa73('0x3c')]!==_0xaa73('0x3d')){var _0x10f145={};_0x10f145[_0x448f8c['name']]={'$like':'%'+_0x7b7f86[_0xaa73('0x2d')]['filter']+'%'};return _0x10f145;}})});}_0x5613a4=_['merge']({},_0x5613a4,_0x7b7f86[_0xaa73('0x3e')]);var _0x309e6c={'where':_0x5613a4['where']};return db['Dynamics365Account']['count'](_0x309e6c)['then'](function(_0x639e19){_0x5ce12c[_0xaa73('0x1e')]=_0x639e19;if(_0x7b7f86[_0xaa73('0x2d')][_0xaa73('0x3f')]){_0x5613a4['include']=[{'all':!![]}];}return db[_0xaa73('0x29')][_0xaa73('0x40')](_0x5613a4);})[_0xaa73('0x25')](function(_0x474847){_0x5ce12c[_0xaa73('0x41')]=_0x474847;return _0x5ce12c;})['then'](respondWithFilteredResult(_0x344e31,_0x5613a4))[_0xaa73('0x42')](handleError(_0x344e31,null));};exports[_0xaa73('0x43')]=function(_0x28d590,_0x534e41){var _0x3ba022={'raw':![],'where':{'id':_0x28d590[_0xaa73('0x44')]['id']}},_0x2ba630={};_0x2ba630[_0xaa73('0x30')]=_[_0xaa73('0x2e')](db[_0xaa73('0x29')][_0xaa73('0x2a')]);_0x2ba630[_0xaa73('0x2d')]=_['keys'](_0x28d590[_0xaa73('0x2d')]);_0x2ba630[_0xaa73('0x38')]=_[_0xaa73('0x2f')](_0x2ba630[_0xaa73('0x30')],_0x2ba630[_0xaa73('0x2d')]);_0x3ba022[_0xaa73('0x31')]=_[_0xaa73('0x2f')](_0x2ba630['model'],qs['fields'](_0x28d590[_0xaa73('0x2d')][_0xaa73('0x32')]));_0x3ba022[_0xaa73('0x31')]=_0x3ba022[_0xaa73('0x31')][_0xaa73('0x45')]?_0x3ba022['attributes']:_0x2ba630[_0xaa73('0x30')];if(_0x28d590[_0xaa73('0x2d')][_0xaa73('0x3f')]){_0x3ba022[_0xaa73('0x46')]=[{'all':!![]}];}_0x3ba022=_[_0xaa73('0x3b')]({},_0x3ba022,_0x28d590[_0xaa73('0x3e')]);return db[_0xaa73('0x29')][_0xaa73('0x47')](_0x3ba022)['then'](handleEntityNotFound(_0x534e41,null))[_0xaa73('0x25')](respondWithResult(_0x534e41,null))[_0xaa73('0x42')](handleError(_0x534e41,null));};exports['create']=function(_0x5d9a5b,_0x341d2c){return db['Dynamics365Account'][_0xaa73('0x48')](_0x5d9a5b['body'],{})['then'](respondWithResult(_0x341d2c,0xc9))[_0xaa73('0x42')](handleError(_0x341d2c,null));};exports[_0xaa73('0x24')]=function(_0x2dd8e0,_0x1f6cde){if(_0x2dd8e0[_0xaa73('0x49')]['id']){delete _0x2dd8e0[_0xaa73('0x49')]['id'];}return db[_0xaa73('0x29')][_0xaa73('0x47')]({'where':{'id':_0x2dd8e0['params']['id']}})[_0xaa73('0x25')](handleEntityNotFound(_0x1f6cde,null))[_0xaa73('0x25')](saveUpdates(_0x2dd8e0['body'],null))[_0xaa73('0x25')](respondWithResult(_0x1f6cde,null))[_0xaa73('0x42')](handleError(_0x1f6cde,null));};exports[_0xaa73('0x26')]=function(_0x4ac6c8,_0x5a5032){return db['Dynamics365Account'][_0xaa73('0x47')]({'where':{'id':_0x4ac6c8['params']['id']}})['then'](handleEntityNotFound(_0x5a5032,null))[_0xaa73('0x25')](removeEntity(_0x5a5032,null))['catch'](handleError(_0x5a5032,null));};exports[_0xaa73('0x4a')]=function(_0x4ca2b7,_0x4dee94,_0x1d658f){var _0x590179={};var _0x18a96f={};var _0x3098bb;var _0x3501cb;return db[_0xaa73('0x29')]['findOne']({'where':{'id':_0x4ca2b7[_0xaa73('0x44')]['id']}})[_0xaa73('0x25')](handleEntityNotFound(_0x4dee94,null))['then'](function(_0x38f984){if(_0x38f984){_0x3098bb=_0x38f984;_0x18a96f[_0xaa73('0x30')]=_[_0xaa73('0x2e')](db[_0xaa73('0x4b')]['rawAttributes']);_0x18a96f[_0xaa73('0x2d')]=_[_0xaa73('0x2e')](_0x4ca2b7['query']);_0x18a96f['filters']=_[_0xaa73('0x2f')](_0x18a96f[_0xaa73('0x30')],_0x18a96f[_0xaa73('0x2d')]);_0x590179[_0xaa73('0x31')]=_[_0xaa73('0x2f')](_0x18a96f[_0xaa73('0x30')],qs[_0xaa73('0x32')](_0x4ca2b7[_0xaa73('0x2d')]['fields']));_0x590179[_0xaa73('0x31')]=_0x590179[_0xaa73('0x31')][_0xaa73('0x45')]?_0x590179[_0xaa73('0x31')]:_0x18a96f['model'];_0x590179['order']=qs['sort'](_0x4ca2b7[_0xaa73('0x2d')][_0xaa73('0x36')]);_0x590179[_0xaa73('0x37')]=qs[_0xaa73('0x38')](_['pick'](_0x4ca2b7[_0xaa73('0x2d')],_0x18a96f[_0xaa73('0x38')]));if(_0x4ca2b7[_0xaa73('0x2d')][_0xaa73('0x3a')]){_0x590179['where']=_['merge'](_0x590179[_0xaa73('0x37')],{'$or':_[_0xaa73('0x28')](_0x590179[_0xaa73('0x31')],function(_0x19217e){var _0x50e654={};_0x50e654[_0x19217e]={'$like':'%'+_0x4ca2b7[_0xaa73('0x2d')][_0xaa73('0x3a')]+'%'};return _0x50e654;})});}_0x590179=_[_0xaa73('0x3b')]({},_0x590179,_0x4ca2b7[_0xaa73('0x3e')]);return _0x3098bb[_0xaa73('0x4a')](_0x590179);}})[_0xaa73('0x25')](function(_0x23c21e){if(_0x23c21e){_0x3501cb=_0x23c21e[_0xaa73('0x45')];if(!_0x4ca2b7[_0xaa73('0x2d')][_0xaa73('0x33')](_0xaa73('0x34'))){_0x590179[_0xaa73('0x1d')]=qs[_0xaa73('0x1d')](_0x4ca2b7[_0xaa73('0x2d')][_0xaa73('0x1d')]);_0x590179[_0xaa73('0x1b')]=qs[_0xaa73('0x1b')](_0x4ca2b7['query'][_0xaa73('0x1b')]);}return _0x3098bb[_0xaa73('0x4a')](_0x590179);}})[_0xaa73('0x25')](function(_0x57993c){if(_0x57993c){return _0x57993c?{'count':_0x3501cb,'rows':_0x57993c}:null;}})[_0xaa73('0x25')](respondWithResult(_0x4dee94,null))['catch'](handleError(_0x4dee94,null));};exports['addConfiguration']=function(_0x6a7bd6,_0x545342,_0x3eecd3){if(_0x6a7bd6[_0xaa73('0x49')]['id']){delete _0x6a7bd6[_0xaa73('0x49')]['id'];}return db['Dynamics365Account'][_0xaa73('0x4c')]({'where':{'id':_0x6a7bd6[_0xaa73('0x44')]['id']}})[_0xaa73('0x25')](handleEntityNotFound(_0x545342,null))[_0xaa73('0x25')](function(_0x39b517){if(_0x39b517){_0x6a7bd6[_0xaa73('0x49')][_0xaa73('0x4d')]=_0x39b517['id'];_0x6a7bd6[_0xaa73('0x49')][_0xaa73('0x4e')]=integrations[_0xaa73('0x4f')](_0x6a7bd6[_0xaa73('0x49')][_0xaa73('0x50')],_0x6a7bd6[_0xaa73('0x49')]['type']);_0x6a7bd6[_0xaa73('0x49')][_0xaa73('0x51')]=integrations[_0xaa73('0x52')](_0x6a7bd6[_0xaa73('0x49')][_0xaa73('0x50')],_0x6a7bd6['body'][_0xaa73('0x3c')]);return db[_0xaa73('0x4b')][_0xaa73('0x48')](_0x6a7bd6[_0xaa73('0x49')],{'include':[{'model':db[_0xaa73('0x53')],'as':'Subjects'},{'model':db[_0xaa73('0x53')],'as':_0xaa73('0x51')}]});}return null;})['then'](respondWithResult(_0x545342,null))[_0xaa73('0x42')](handleError(_0x545342,null));};exports[_0xaa73('0x54')]=function(_0x1c6b41,_0x1b1792,_0x5da602){var _0x28db5f=_0x1c6b41[_0xaa73('0x2d')][_0xaa73('0x55')];var _0x1c61c2=_0x28db5f===_0xaa73('0x56')?_0xaa73('0x57'):'PhoneCall';var _0xdbb7d8='';var _0x8bd6d1='';var _0x517a18='';var _0x48f472='';var _0x942a7='';var _0x548266='';var _0x2f60f3='';var _0x1a53cb='';var _0x3a63b4=['title',_0xaa73('0x58'),_0xaa73('0x59'),'ownerid','caseorigincode',_0xaa73('0x5a'),'phonenumber',_0xaa73('0x5b'),_0xaa73('0x5c'),_0xaa73('0x5d')];var _0xb4dcd3=[_0xaa73('0x5e'),_0xaa73('0x5f'),_0xaa73('0x60'),_0xaa73('0x61'),_0xaa73('0x62'),_0xaa73('0x63'),_0xaa73('0x64'),'contractidname',_0xaa73('0x65'),'createdbyexternalpartyyominame',_0xaa73('0x66'),_0xaa73('0x67'),_0xaa73('0x68'),'createdonbehalfbyname',_0xaa73('0x69'),_0xaa73('0x6a'),_0xaa73('0x6b'),_0xaa73('0x6c'),'emailaddress','entitlementidname','entityimage_timestamp',_0xaa73('0x6d'),_0xaa73('0x6e'),_0xaa73('0x6f'),_0xaa73('0x70'),_0xaa73('0x71'),'importsequencenumber',_0xaa73('0x72'),'kbarticleidname',_0xaa73('0x73'),_0xaa73('0x74'),'modifiedbyexternalpartyname',_0xaa73('0x75'),_0xaa73('0x76'),_0xaa73('0x77'),_0xaa73('0x78'),_0xaa73('0x79'),'modifiedonbehalfbyyominame','msdyn_incidenttypename',_0xaa73('0x7a'),_0xaa73('0x7b'),'onholdtime',_0xaa73('0x7c'),_0xaa73('0x7d'),_0xaa73('0x7e'),'owneridyominame',_0xaa73('0x7f'),_0xaa73('0x80'),'primarycontactidyominame',_0xaa73('0x81'),_0xaa73('0x82'),_0xaa73('0x83'),_0xaa73('0x84'),_0xaa73('0x85'),_0xaa73('0x86'),_0xaa73('0x87'),'responsiblecontactidyominame',_0xaa73('0x88'),'slainvokedidname','slaname',_0xaa73('0x89'),_0xaa73('0x8a'),_0xaa73('0x8b'),_0xaa73('0x8c'),_0xaa73('0x8d'),_0xaa73('0x8e'),_0xaa73('0x8f'),_0xaa73('0x90'),'utcconversiontimezonecode','versionnumber'];var _0x12f2c9=_0x3a63b4[_0xaa73('0x91')](_0xb4dcd3);return db[_0xaa73('0x29')][_0xaa73('0x4c')]({'where':{'id':_0x1c6b41[_0xaa73('0x44')]['id']},'attributes':['id',_0xaa73('0x92'),_0xaa73('0x93'),_0xaa73('0x94'),_0xaa73('0x95'),'clientId','clientSecret']})['then'](handleEntityNotFound(_0x1b1792,null))[_0xaa73('0x25')](function(_0x3cc5fb){if(_0x3cc5fb){_0x1a53cb=_0x3cc5fb[_0xaa73('0x94')];var _0x33fed3=_0x1a53cb['slice'](-0x1);if(_0x33fed3==='/'){_0x1a53cb=_0x1a53cb[_0xaa73('0x96')](0x0,_0x1a53cb[_0xaa73('0x97')](_0x33fed3));}_0x2f60f3=util[_0xaa73('0x98')]('%s/api/data/v9.0/',_0x1a53cb);var _0x45be09={'method':_0xaa73('0x99'),'uri':_0xaa73('0x9a')+_0x3cc5fb[_0xaa73('0x95')]+'/oauth2/token','form':{'client_id':_0x3cc5fb[_0xaa73('0x9b')],'resource':_0x1a53cb,'username':_0x3cc5fb[_0xaa73('0x92')],'password':_0x3cc5fb['password'],'grant_type':_0xaa73('0x93'),'client_secret':_0x3cc5fb[_0xaa73('0x9c')]},'json':!![]};return rp(_0x45be09);}})[_0xaa73('0x25')](function(_0xf9a491){_0x548266=_0xf9a491[_0xaa73('0x9d')];var _0x56122e={'method':_0xaa73('0x9e'),'uri':encodeURI(_0x2f60f3+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x1c61c2+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x548266,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x56122e);})[_0xaa73('0x25')](function(_0x20ab60){var _0x94ffeb=_0x20ab60[_0xaa73('0x9f')][0x0];var _0x46c4ae=_0x94ffeb['MetadataId'];var _0x546b78={'method':_0xaa73('0x9e'),'uri':_0x2f60f3+'EntityDefinitions('+_0x46c4ae+_0xaa73('0xa0'),'headers':{'Authorization':_0xaa73('0xa1')+_0x548266,'If-None-Match':null,'OData-Version':_0xaa73('0xa2')},'json':!![]};return rp(_0x546b78);})[_0xaa73('0x25')](function(_0x1e7b64){_0xdbb7d8=_0x1e7b64;_0x8bd6d1=_0xdbb7d8[_0xaa73('0xa3')];_0x8bd6d1=_['remove'](_0x8bd6d1,function(_0x16a55e){return!_0x12f2c9['includes'](_0x16a55e[_0xaa73('0xa4')]);});var _0x2aa375=[];var _0x2f1bf7=[];_0x8bd6d1['forEach'](function(_0x20343d){if(_0x20343d[_0xaa73('0xa5')]){var _0x2ea62c=_0x20343d['@odata.type']['substring'](_0x20343d['@odata.type'][_0xaa73('0x97')]('.')+0x1);if(_0x2ea62c===_0xaa73('0xa6')){_0x2aa375['push'](getSelectList(_0x2f60f3,_0x28db5f,_0x2f1bf7,_0xdbb7d8[_0xaa73('0xa7')],_0x20343d[_0xaa73('0xa7')],_0x548266));}}});return Promise[_0xaa73('0xa8')](_0x2aa375);})['then'](function(_0x9c1eb9){_0x517a18=_0x9c1eb9[0x0];var _0x4f8fdf=[];var _0x2a47df=[];_0x8bd6d1[_0xaa73('0xa9')](function(_0x20d825){if(!_[_0xaa73('0xaa')](_0x20d825[_0xaa73('0xa5')])){var _0x1fde88=_0x20d825[_0xaa73('0xa5')][_0xaa73('0x96')](_0x20d825['@odata.type'][_0xaa73('0x97')]('.')+0x1);if(_0x1fde88===_0xaa73('0xab')){_0x4f8fdf[_0xaa73('0xac')](getBooleanList(_0x2f60f3,_0x28db5f,_0x2a47df,_0xdbb7d8[_0xaa73('0xa7')],_0x20d825[_0xaa73('0xa7')],_0x548266));}}});return Promise[_0xaa73('0xa8')](_0x4f8fdf);})[_0xaa73('0x25')](function(_0x330eb4){_0x48f472=_0x330eb4[0x0];var _0x2bb87f=[];var _0x28417c=[];_0x8bd6d1[_0xaa73('0xa9')](function(_0x1f9e5d){if(_0x1f9e5d[_0xaa73('0xa5')]){var _0x2e3049=_0x1f9e5d[_0xaa73('0xa5')][_0xaa73('0x96')](_0x1f9e5d[_0xaa73('0xa5')][_0xaa73('0x97')]('.')+0x1);if(_0x2e3049===_0xaa73('0xad')||_0x2e3049===_0xaa73('0xae')||_0x2e3049==='BigIntAttributeMetadata'||_0x2e3049===_0xaa73('0xaf')||_0x2e3049===_0xaa73('0xb0')||_0x2e3049==='DateTimeAttributeMetadata'||_0x2e3049==='StatusAttributeMetadata'||_0x2e3049===_0xaa73('0xb1')||_0x2e3049==='StateAttributeMetadata'||_0x2e3049===_0xaa73('0xb2')){_0x2bb87f[_0xaa73('0xac')](getInputList(_0x2f60f3,_0x28db5f,_0x2e3049,_0x28417c,_0xdbb7d8[_0xaa73('0xa7')],_0x1f9e5d[_0xaa73('0xa7')],_0x548266));}}});return Promise['all'](_0x2bb87f);})['then'](function(_0x146c25){_0x942a7=_0x146c25[0x0];var _0x1b3ba9=_0x517a18['concat'](_0x48f472)[_0xaa73('0x91')](_0x942a7);var _0x5904f2={'count':_0x1b3ba9[_0xaa73('0x45')],'rows':_0x1b3ba9};return _0x5904f2;})[_0xaa73('0x25')](respondWithResult(_0x1b1792,null))['catch'](function(_0x276a07){var _0x68e8d9=_0x1c6b41['query'][_0xaa73('0xb3')]?0x1f4:_0x276a07[_0xaa73('0xb4')]||0x1f4;logger[_0xaa73('0xb5')](_0x276a07['stack']);delete _0x276a07[_0xaa73('0x27')];if(_0x68e8d9===0x191){_0x68e8d9=0x190;}_0x1b1792[_0xaa73('0x18')](_0x68e8d9)[_0xaa73('0xb6')](_0x1c6b41['query'][_0xaa73('0xb3')]?{'message':_0xaa73('0xb7'),'statusCode':_0x276a07[_0xaa73('0xb4')]}:_0x276a07);});};function getSelectList(_0x458415,_0x199031,_0x48fc34,_0x5abf96,_0x7885d2,_0xeaebfa){var _0x4ad5fd={'method':_0xaa73('0x9e'),'uri':_0x458415+_0xaa73('0xb8')+_0x5abf96+_0xaa73('0xb9')+_0x7885d2+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0xaa73('0xa1')+_0xeaebfa,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4ad5fd)[_0xaa73('0x25')](function(_0x30a8d5){var _0x231812=[];var _0x48f526=_0x30a8d5[_0xaa73('0xba')][_0xaa73('0xbb')];_0x48f526['forEach'](function(_0xbc8113){_0x231812[_0xaa73('0xac')]({'name':_0xbc8113[_0xaa73('0xbc')][_0xaa73('0xbd')][_0xaa73('0xbc')],'value':String(_0xbc8113[_0xaa73('0xbe')])});});var _0xfcd97d={'id':_0x199031+'_'+_0x30a8d5[_0xaa73('0xa4')],'name':_0x30a8d5[_0xaa73('0xbf')][_0xaa73('0xbd')][_0xaa73('0xbc')],'custom':![],'options':_0x231812};_0x48fc34[_0xaa73('0xac')](_0xfcd97d);return _0x48fc34;});}function getBooleanList(_0x2ed8ce,_0xdd17b5,_0x357831,_0x3457c5,_0x5a2444,_0x25e974){var _0x57f510={'method':'GET','uri':_0x2ed8ce+_0xaa73('0xb8')+_0x3457c5+_0xaa73('0xb9')+_0x5a2444+_0xaa73('0xc0'),'headers':{'Authorization':'Bearer\x20'+_0x25e974,'If-None-Match':null,'OData-Version':_0xaa73('0xa2')},'json':!![]};return rp(_0x57f510)[_0xaa73('0x25')](function(_0x20cc24){var _0x3cc480=[];_0x3cc480[_0xaa73('0xac')]({'name':_0x20cc24['OptionSet'][_0xaa73('0xc1')][_0xaa73('0xbc')]['UserLocalizedLabel'][_0xaa73('0xbc')],'value':_0xaa73('0xc2')},{'name':_0x20cc24[_0xaa73('0xba')][_0xaa73('0xc3')][_0xaa73('0xbc')][_0xaa73('0xbd')][_0xaa73('0xbc')],'value':_0xaa73('0xc4')});var _0x41c349={'id':_0xdd17b5+'_'+_0x20cc24[_0xaa73('0xa4')],'name':_0x20cc24[_0xaa73('0xbf')][_0xaa73('0xbd')][_0xaa73('0xbc')],'custom':![],'options':_0x3cc480};_0x357831['push'](_0x41c349);return _0x357831;});}function getInputList(_0x34eefb,_0x3a4966,_0x43591f,_0x3295f5,_0x24d294,_0x257e31,_0x1bfc30){var _0x3eafd0={'method':_0xaa73('0x9e'),'uri':_0x34eefb+_0xaa73('0xb8')+_0x24d294+_0xaa73('0xb9')+_0x257e31+')/Microsoft.Dynamics.CRM.'+_0x43591f+_0xaa73('0xc5'),'headers':{'Authorization':'Bearer\x20'+_0x1bfc30,'If-None-Match':null,'OData-Version':_0xaa73('0xa2')},'json':!![]};return rp(_0x3eafd0)[_0xaa73('0x25')](function(_0x306426){var _0xf41e6b={'id':_0x3a4966+'_'+_0x306426[_0xaa73('0xa4')],'name':_0x306426[_0xaa73('0xbf')]['UserLocalizedLabel']?_0x306426[_0xaa73('0xbf')][_0xaa73('0xbd')][_0xaa73('0xbc')]:_0x306426[_0xaa73('0xa4')],'custom':![],'options':[]};_0x3295f5[_0xaa73('0xac')](_0xf41e6b);return _0x3295f5;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 0026c48..b952a0b 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 _0xa9e0=['define','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x1dbe2e,_0x5cfe95){var _0x56a4fa=function(_0x187305){while(--_0x187305){_0x1dbe2e['push'](_0x1dbe2e['shift']());}};_0x56a4fa(++_0x5cfe95);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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'));var integrations=require(_0x0a9e('0x8'));module['exports']=function(_0x219af0,_0x441e3a){return _0x219af0[_0x0a9e('0x9')]('Dynamics365Account',attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x1468ee,_0x8356ce){var _0x5cc2cc=function(_0x407f25){while(--_0x407f25){_0x1468ee['push'](_0x1468ee['shift']());}};_0x5cc2cc(++_0x8356ce);}(_0x757a,0xde));var _0xa757=function(_0xd57373,_0xc2fd8e){_0xd57373=_0xd57373-0x0;var _0xdea237=_0x757a[_0xd57373];return _0xdea237;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 9ab9734..ed6ee52 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 _0x64b1=['http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetDynamics365Account','findAll','raw','options','where','attributes','limit','include','map','model','Dynamics365Account','ShowDynamics365Account','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x64b1,0x1ab));var _0x164b=function(_0x2680e9,_0x5c852f){_0x2680e9=_0x2680e9-0x0;var _0x2bfa85=_0x64b1[_0x2680e9];return _0x2bfa85;};'use strict';var _=require('lodash');var util=require(_0x164b('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x164b('0x1'));var fs=require('fs');var Redis=require(_0x164b('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x164b('0x3'));var logger=require('../../config/logger')(_0x164b('0x4'));var config=require(_0x164b('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x164b('0x6')][_0x164b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x466e94,_0x3f58b2,_0x522706){return new BPromise(function(_0x82898,_0x38eb98){return client[_0x164b('0x8')](_0x466e94,_0x522706)[_0x164b('0x9')](function(_0x554b94){logger[_0x164b('0xa')](_0x164b('0xb'),_0x3f58b2,_0x164b('0xc'));logger[_0x164b('0xd')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x3f58b2,_0x164b('0xc'),JSON[_0x164b('0xe')](_0x554b94));if(_0x554b94[_0x164b('0xf')]){if(_0x554b94['error']['code']===0x1f4){logger[_0x164b('0xf')](_0x164b('0xb'),_0x3f58b2,_0x554b94[_0x164b('0xf')][_0x164b('0x10')]);return _0x38eb98(_0x554b94[_0x164b('0xf')][_0x164b('0x10')]);}logger[_0x164b('0xf')](_0x164b('0xb'),_0x3f58b2,_0x554b94[_0x164b('0xf')][_0x164b('0x10')]);return _0x82898(_0x554b94[_0x164b('0xf')][_0x164b('0x10')]);}else{logger[_0x164b('0xa')]('Dynamics365Account,\x20%s,\x20%s',_0x3f58b2,_0x164b('0xc'));_0x82898(_0x554b94[_0x164b('0x11')][_0x164b('0x10')]);}})[_0x164b('0x12')](function(_0x35a3dd){logger[_0x164b('0xf')](_0x164b('0xb'),_0x3f58b2,_0x35a3dd);_0x38eb98(_0x35a3dd);});});}exports[_0x164b('0x13')]=function(_0x107179){var _0xe44f32=this;return new Promise(function(_0x20a1b4,_0x24d0e0){return db['Dynamics365Account'][_0x164b('0x14')]({'raw':_0x107179['options']?_0x107179['options'][_0x164b('0x15')]===undefined?!![]:![]:!![],'where':_0x107179[_0x164b('0x16')]?_0x107179[_0x164b('0x16')][_0x164b('0x17')]||null:null,'attributes':_0x107179[_0x164b('0x16')]?_0x107179[_0x164b('0x16')][_0x164b('0x18')]||null:null,'limit':_0x107179[_0x164b('0x16')]?_0x107179[_0x164b('0x16')][_0x164b('0x19')]||null:null,'include':_0x107179['options']?_0x107179['options'][_0x164b('0x1a')]?_[_0x164b('0x1b')](_0x107179[_0x164b('0x16')][_0x164b('0x1a')],function(_0x3d5c83){return{'model':db[_0x3d5c83['model']],'as':_0x3d5c83['as'],'attributes':_0x3d5c83['attributes'],'include':_0x3d5c83['include']?_[_0x164b('0x1b')](_0x3d5c83['include'],function(_0x36caa5){return{'model':db[_0x36caa5[_0x164b('0x1c')]],'as':_0x36caa5['as'],'attributes':_0x36caa5[_0x164b('0x18')],'include':_0x36caa5[_0x164b('0x1a')]?_[_0x164b('0x1b')](_0x36caa5[_0x164b('0x1a')],function(_0x430d67){return{'model':db[_0x430d67[_0x164b('0x1c')]],'as':_0x430d67['as'],'attributes':_0x430d67[_0x164b('0x18')]};}):[]};}):[]};}):[]:[]})[_0x164b('0x9')](function(_0x38c143){logger['info'](_0x164b('0x13'),_0x107179);logger['debug'](_0x164b('0x13'),_0x107179,JSON['stringify'](_0x38c143));_0x20a1b4(_0x38c143);})['catch'](function(_0x4eb3f3){logger['error'](_0x164b('0x13'),_0x4eb3f3[_0x164b('0x10')],_0x107179);_0x24d0e0(_0xe44f32[_0x164b('0xf')](0x1f4,_0x4eb3f3[_0x164b('0x10')]));});});};exports['ShowDynamics365Account']=function(_0x40049c){var _0xaa6a5b=this;return new Promise(function(_0x5372b4,_0x17db9e){return db[_0x164b('0x1d')]['find']({'raw':_0x40049c[_0x164b('0x16')]?_0x40049c[_0x164b('0x16')][_0x164b('0x15')]===undefined?!![]:![]:!![],'where':_0x40049c[_0x164b('0x16')]?_0x40049c['options'][_0x164b('0x17')]||null:null,'attributes':_0x40049c[_0x164b('0x16')]?_0x40049c[_0x164b('0x16')][_0x164b('0x18')]||null:null,'include':_0x40049c[_0x164b('0x16')]?_0x40049c[_0x164b('0x16')][_0x164b('0x1a')]?_['map'](_0x40049c['options'][_0x164b('0x1a')],function(_0x595fa6){return{'model':db[_0x595fa6[_0x164b('0x1c')]],'as':_0x595fa6['as'],'attributes':_0x595fa6['attributes'],'include':_0x595fa6[_0x164b('0x1a')]?_[_0x164b('0x1b')](_0x595fa6[_0x164b('0x1a')],function(_0x522901){return{'model':db[_0x522901[_0x164b('0x1c')]],'as':_0x522901['as'],'attributes':_0x522901[_0x164b('0x18')],'include':_0x522901['include']?_['map'](_0x522901[_0x164b('0x1a')],function(_0x486523){return{'model':db[_0x486523[_0x164b('0x1c')]],'as':_0x486523['as'],'attributes':_0x486523[_0x164b('0x18')]};}):[]};}):[]};}):[]:[]})[_0x164b('0x9')](function(_0x5bd4e4){logger[_0x164b('0xa')](_0x164b('0x1e'),_0x40049c);logger['debug']('ShowDynamics365Account',_0x40049c,JSON[_0x164b('0xe')](_0x5bd4e4));_0x5372b4(_0x5bd4e4);})['catch'](function(_0x1f81e1){logger['error'](_0x164b('0x1e'),_0x1f81e1[_0x164b('0x10')],_0x40049c);_0x17db9e(_0xaa6a5b[_0x164b('0xf')](0x1f4,_0x1f81e1['message']));});});}; \ No newline at end of file +var _0xd73c=['limit','include','map','model','ShowDynamics365Account','find','info','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes'];(function(_0x2bc2b0,_0x538725){var _0x4f9699=function(_0x54cfd6){while(--_0x54cfd6){_0x2bc2b0['push'](_0x2bc2b0['shift']());}};_0x4f9699(++_0x538725);}(_0xd73c,0x76));var _0xcd73=function(_0x35a447,_0x3e1f5a){_0x35a447=_0x35a447-0x0;var _0x3eea6d=_0xd73c[_0x35a447];return _0x3eea6d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcd73('0x0'));var BPromise=require(_0xcd73('0x1'));var rs=require(_0xcd73('0x2'));var fs=require('fs');var Redis=require(_0xcd73('0x3'));var db=require(_0xcd73('0x4'))['db'];var utils=require(_0xcd73('0x5'));var logger=require('../../config/logger')(_0xcd73('0x6'));var config=require(_0xcd73('0x7'));var jayson=require(_0xcd73('0x8'));var client=jayson[_0xcd73('0x9')][_0xcd73('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f596e,_0x4feaf9,_0xc51f21){return new BPromise(function(_0x5f4132,_0x2f9d17){return client[_0xcd73('0xb')](_0x4f596e,_0xc51f21)[_0xcd73('0xc')](function(_0x3476e6){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x4feaf9,_0xcd73('0xd'));logger[_0xcd73('0xe')](_0xcd73('0xf'),_0x4feaf9,_0xcd73('0xd'),JSON[_0xcd73('0x10')](_0x3476e6));if(_0x3476e6[_0xcd73('0x11')]){if(_0x3476e6[_0xcd73('0x11')][_0xcd73('0x12')]===0x1f4){logger[_0xcd73('0x11')](_0xcd73('0x13'),_0x4feaf9,_0x3476e6[_0xcd73('0x11')]['message']);return _0x2f9d17(_0x3476e6[_0xcd73('0x11')][_0xcd73('0x14')]);}logger[_0xcd73('0x11')](_0xcd73('0x13'),_0x4feaf9,_0x3476e6['error'][_0xcd73('0x14')]);return _0x5f4132(_0x3476e6[_0xcd73('0x11')][_0xcd73('0x14')]);}else{logger['info'](_0xcd73('0x13'),_0x4feaf9,_0xcd73('0xd'));_0x5f4132(_0x3476e6[_0xcd73('0x15')][_0xcd73('0x14')]);}})[_0xcd73('0x16')](function(_0x27fce4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x4feaf9,_0x27fce4);_0x2f9d17(_0x27fce4);});});}exports[_0xcd73('0x17')]=function(_0x5a335){var _0x5d20a9=this;return new Promise(function(_0x266025,_0xc3a011){return db[_0xcd73('0x18')][_0xcd73('0x19')]({'raw':_0x5a335[_0xcd73('0x1a')]?_0x5a335['options'][_0xcd73('0x1b')]===undefined?!![]:![]:!![],'where':_0x5a335[_0xcd73('0x1a')]?_0x5a335[_0xcd73('0x1a')][_0xcd73('0x1c')]||null:null,'attributes':_0x5a335['options']?_0x5a335[_0xcd73('0x1a')][_0xcd73('0x1d')]||null:null,'limit':_0x5a335['options']?_0x5a335['options'][_0xcd73('0x1e')]||null:null,'include':_0x5a335['options']?_0x5a335[_0xcd73('0x1a')][_0xcd73('0x1f')]?_[_0xcd73('0x20')](_0x5a335['options'][_0xcd73('0x1f')],function(_0x26e58e){return{'model':db[_0x26e58e[_0xcd73('0x21')]],'as':_0x26e58e['as'],'attributes':_0x26e58e[_0xcd73('0x1d')],'include':_0x26e58e['include']?_[_0xcd73('0x20')](_0x26e58e['include'],function(_0x196989){return{'model':db[_0x196989['model']],'as':_0x196989['as'],'attributes':_0x196989[_0xcd73('0x1d')],'include':_0x196989['include']?_[_0xcd73('0x20')](_0x196989[_0xcd73('0x1f')],function(_0x32436e){return{'model':db[_0x32436e[_0xcd73('0x21')]],'as':_0x32436e['as'],'attributes':_0x32436e[_0xcd73('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcd73('0xc')](function(_0x14f7c6){logger['info'](_0xcd73('0x17'),_0x5a335);logger['debug']('GetDynamics365Account',_0x5a335,JSON[_0xcd73('0x10')](_0x14f7c6));_0x266025(_0x14f7c6);})[_0xcd73('0x16')](function(_0x252404){logger[_0xcd73('0x11')](_0xcd73('0x17'),_0x252404['message'],_0x5a335);_0xc3a011(_0x5d20a9[_0xcd73('0x11')](0x1f4,_0x252404[_0xcd73('0x14')]));});});};exports[_0xcd73('0x22')]=function(_0x140d7c){var _0x233fed=this;return new Promise(function(_0x4dc8fc,_0x583b15){return db[_0xcd73('0x18')][_0xcd73('0x23')]({'raw':_0x140d7c['options']?_0x140d7c[_0xcd73('0x1a')][_0xcd73('0x1b')]===undefined?!![]:![]:!![],'where':_0x140d7c[_0xcd73('0x1a')]?_0x140d7c['options']['where']||null:null,'attributes':_0x140d7c[_0xcd73('0x1a')]?_0x140d7c['options'][_0xcd73('0x1d')]||null:null,'include':_0x140d7c[_0xcd73('0x1a')]?_0x140d7c[_0xcd73('0x1a')][_0xcd73('0x1f')]?_[_0xcd73('0x20')](_0x140d7c[_0xcd73('0x1a')][_0xcd73('0x1f')],function(_0x503deb){return{'model':db[_0x503deb[_0xcd73('0x21')]],'as':_0x503deb['as'],'attributes':_0x503deb['attributes'],'include':_0x503deb[_0xcd73('0x1f')]?_[_0xcd73('0x20')](_0x503deb[_0xcd73('0x1f')],function(_0x451ddb){return{'model':db[_0x451ddb[_0xcd73('0x21')]],'as':_0x451ddb['as'],'attributes':_0x451ddb[_0xcd73('0x1d')],'include':_0x451ddb[_0xcd73('0x1f')]?_[_0xcd73('0x20')](_0x451ddb[_0xcd73('0x1f')],function(_0x26e7bc){return{'model':db[_0x26e7bc[_0xcd73('0x21')]],'as':_0x26e7bc['as'],'attributes':_0x26e7bc[_0xcd73('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcd73('0xc')](function(_0x13dec1){logger[_0xcd73('0x24')]('ShowDynamics365Account',_0x140d7c);logger[_0xcd73('0xe')](_0xcd73('0x22'),_0x140d7c,JSON[_0xcd73('0x10')](_0x13dec1));_0x4dc8fc(_0x13dec1);})['catch'](function(_0x3c6644){logger[_0xcd73('0x11')]('ShowDynamics365Account',_0x3c6644[_0xcd73('0x14')],_0x140d7c);_0x583b15(_0x233fed[_0xcd73('0x11')](0x1f4,_0x3c6644['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index d382e8e..9f741bf 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 _0xc022=['getFields','/:id/subjects','getDescriptions','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intDynamics365Configuration.controller','index','isAuthenticated','show','get','/:id/fields'];(function(_0xca19df,_0xda79a5){var _0x512318=function(_0x530920){while(--_0x530920){_0xca19df['push'](_0xca19df['shift']());}};_0x512318(++_0xda79a5);}(_0xc022,0x173));var _0x2c02=function(_0x1a0303,_0x6508d3){_0x1a0303=_0x1a0303-0x0;var _0x4f9bee=_0xc022[_0x1a0303];return _0x4f9bee;};'use strict';var multer=require('multer');var util=require(_0x2c02('0x0'));var path=require(_0x2c02('0x1'));var timeout=require(_0x2c02('0x2'));var express=require(_0x2c02('0x3'));var router=express[_0x2c02('0x4')]();var fs_extra=require(_0x2c02('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2c02('0x6'));var config=require('../../config/environment');var controller=require(_0x2c02('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x2c02('0x8')]);router['get']('/:id',auth[_0x2c02('0x9')](),controller[_0x2c02('0xa')]);router[_0x2c02('0xb')](_0x2c02('0xc'),auth['isAuthenticated'](),controller[_0x2c02('0xd')]);router[_0x2c02('0xb')](_0x2c02('0xe'),auth[_0x2c02('0x9')](),controller['getSubjects']);router[_0x2c02('0xb')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x2c02('0xf')]);router[_0x2c02('0x10')]('/',auth['isAuthenticated'](),controller[_0x2c02('0x11')]);router[_0x2c02('0x12')](_0x2c02('0x13'),auth[_0x2c02('0x9')](),controller[_0x2c02('0x14')]);router[_0x2c02('0x15')](_0x2c02('0x13'),auth['isAuthenticated'](),controller[_0x2c02('0x16')]);module[_0x2c02('0x17')]=router; \ No newline at end of file +var _0xb350=['isAuthenticated','index','/:id','show','getFields','getSubjects','/:id/descriptions','post','create','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get'];(function(_0x2820f8,_0x2bdbdc){var _0x1e1413=function(_0x592e45){while(--_0x592e45){_0x2820f8['push'](_0x2820f8['shift']());}};_0x1e1413(++_0x2bdbdc);}(_0xb350,0x6f));var _0x0b35=function(_0x35e24b,_0x6eb583){_0x35e24b=_0x35e24b-0x0;var _0x193ca0=_0xb350[_0x35e24b];return _0x193ca0;};'use strict';var multer=require(_0x0b35('0x0'));var util=require(_0x0b35('0x1'));var path=require(_0x0b35('0x2'));var timeout=require(_0x0b35('0x3'));var express=require('express');var router=express[_0x0b35('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0b35('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0b35('0x6'));var controller=require(_0x0b35('0x7'));router[_0x0b35('0x8')]('/',auth[_0x0b35('0x9')](),controller[_0x0b35('0xa')]);router[_0x0b35('0x8')](_0x0b35('0xb'),auth[_0x0b35('0x9')](),controller[_0x0b35('0xc')]);router['get']('/:id/fields',auth[_0x0b35('0x9')](),controller[_0x0b35('0xd')]);router[_0x0b35('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x0b35('0xe')]);router[_0x0b35('0x8')](_0x0b35('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x0b35('0x10')]('/',auth['isAuthenticated'](),controller[_0x0b35('0x11')]);router['put'](_0x0b35('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x0b35('0xb'),auth[_0x0b35('0x9')](),controller[_0x0b35('0x12')]);module[_0x0b35('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 2fc38c0..63e984a 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 _0x0b11=['sequelize','STRING','ENUM','incident','phonecall'];(function(_0x401b7b,_0x6e5f2a){var _0x5891fa=function(_0x3dd67a){while(--_0x3dd67a){_0x401b7b['push'](_0x401b7b['shift']());}};_0x5891fa(++_0x6e5f2a);}(_0x0b11,0xdc));var _0x10b1=function(_0x266e5b,_0x1b2845){_0x266e5b=_0x266e5b-0x0;var _0x565aee=_0x0b11[_0x266e5b];return _0x565aee;};'use strict';var Sequelize=require(_0x10b1('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x10b1('0x1')]},'ticketType':{'type':Sequelize[_0x10b1('0x2')](_0x10b1('0x3'),_0x10b1('0x4')),'defaultValue':_0x10b1('0x3')}}; \ No newline at end of file +var _0x6e23=['incident','phonecall','sequelize','exports','STRING'];(function(_0x210092,_0x502813){var _0xd733b6=function(_0x10f89a){while(--_0x10f89a){_0x210092['push'](_0x210092['shift']());}};_0xd733b6(++_0x502813);}(_0x6e23,0x156));var _0x36e2=function(_0x36bd7c,_0x11c15d){_0x36bd7c=_0x36bd7c-0x0;var _0x3ea205=_0x6e23[_0x36bd7c];return _0x3ea205;};'use strict';var Sequelize=require(_0x36e2('0x0'));module[_0x36e2('0x1')]={'name':{'type':Sequelize[_0x36e2('0x2')]},'description':{'type':Sequelize[_0x36e2('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x36e2('0x3'),_0x36e2('0x4')),'defaultValue':_0x36e2('0x3')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 69904d0..73e751f 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 _0xfde2=['util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','status','sendStatus','error','stack','name','send','index','Dynamics365Configuration','rawAttributes','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','type','VIRTUAL','options','include','findAll','catch','show','params','includeAll','create','body','find','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x2c028b,_0x75ff75){var _0x81c7a0=function(_0x4566be){while(--_0x4566be){_0x2c028b['push'](_0x2c028b['shift']());}};_0x81c7a0(++_0x75ff75);}(_0xfde2,0x189));var _0x2fde=function(_0x419912,_0x988212){_0x419912=_0x419912-0x0;var _0x5c0ff3=_0xfde2[_0x419912];return _0x5c0ff3;};'use strict';var emlformat=require(_0x2fde('0x0'));var rimraf=require(_0x2fde('0x1'));var zipdir=require(_0x2fde('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2fde('0x3'));var moment=require(_0x2fde('0x4'));var BPromise=require(_0x2fde('0x5'));var Mustache=require(_0x2fde('0x6'));var util=require(_0x2fde('0x7'));var path=require('path');var sox=require(_0x2fde('0x8'));var csv=require(_0x2fde('0x9'));var ejs=require(_0x2fde('0xa'));var fs=require('fs');var fs_extra=require(_0x2fde('0xb'));var _=require(_0x2fde('0xc'));var squel=require('squel');var crypto=require(_0x2fde('0xd'));var jsforce=require(_0x2fde('0xe'));var deskjs=require(_0x2fde('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2fde('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2fde('0x11'));var hardwareService=require(_0x2fde('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x2fde('0x13'));var config=require(_0x2fde('0x14'));var licenseUtil=require(_0x2fde('0x15'));var db=require(_0x2fde('0x16'))['db'];function respondWithStatusCode(_0x25a647,_0x9ffa73){_0x9ffa73=_0x9ffa73||0xcc;return function(_0x1fac36){if(_0x1fac36){return _0x25a647['sendStatus'](_0x9ffa73);}return _0x25a647['status'](_0x9ffa73)[_0x2fde('0x17')]();};}function respondWithResult(_0x267751,_0x167848){_0x167848=_0x167848||0xc8;return function(_0x2b1be){if(_0x2b1be){return _0x267751['status'](_0x167848)[_0x2fde('0x18')](_0x2b1be);}};}function respondWithFilteredResult(_0x4f4d7c,_0x8deb8a){return function(_0x2b924c){if(_0x2b924c){var _0x59fe38=typeof _0x8deb8a[_0x2fde('0x19')]===_0x2fde('0x1a')&&typeof _0x8deb8a[_0x2fde('0x1b')]===_0x2fde('0x1a');var _0x4ce292=_0x2b924c[_0x2fde('0x1c')];var _0x14bdb1=_0x59fe38?0x0:_0x8deb8a[_0x2fde('0x19')];var _0x4c07b3=_0x59fe38?_0x2b924c[_0x2fde('0x1c')]:_0x8deb8a[_0x2fde('0x19')]+_0x8deb8a['limit'];var _0x5ba543;if(_0x4c07b3>=_0x4ce292){_0x4c07b3=_0x4ce292;_0x5ba543=0xc8;}else{_0x5ba543=0xce;}_0x4f4d7c['status'](_0x5ba543);return _0x4f4d7c[_0x2fde('0x1d')](_0x2fde('0x1e'),_0x14bdb1+'-'+_0x4c07b3+'/'+_0x4ce292)[_0x2fde('0x18')](_0x2b924c);}return null;};}function patchUpdates(_0x1f929c){return function(_0x54f1ba){try{jsonpatch[_0x2fde('0x1f')](_0x54f1ba,_0x1f929c,!![]);}catch(_0xb6eb04){return BPromise[_0x2fde('0x20')](_0xb6eb04);}return _0x54f1ba['save']();};}function saveUpdates(_0x2183d3,_0xecda3){return function(_0x56cc94){if(_0x56cc94){return _0x56cc94[_0x2fde('0x21')](_0x2183d3)[_0x2fde('0x22')](function(_0x1c1929){return _0x1c1929;});}return null;};}function removeEntity(_0x3688dd,_0x48cbc6){return function(_0x36e04d){if(_0x36e04d){return _0x36e04d[_0x2fde('0x23')]()[_0x2fde('0x22')](function(){_0x3688dd[_0x2fde('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19766a,_0x7330e7){return function(_0x465351){if(!_0x465351){_0x19766a[_0x2fde('0x25')](0x194);}return _0x465351;};}function handleError(_0x423c98,_0x1dd121){_0x1dd121=_0x1dd121||0x1f4;return function(_0x19befc){logger[_0x2fde('0x26')](_0x19befc[_0x2fde('0x27')]);if(_0x19befc[_0x2fde('0x28')]){delete _0x19befc[_0x2fde('0x28')];}_0x423c98[_0x2fde('0x24')](_0x1dd121)[_0x2fde('0x29')](_0x19befc);};}exports[_0x2fde('0x2a')]=function(_0x16116d,_0x43293f){var _0x4bf0b3={},_0x2d1180={},_0xed8004={'count':0x0,'rows':[]};var _0x306d93=_['map'](db[_0x2fde('0x2b')][_0x2fde('0x2c')],function(_0x7fda54){return{'name':_0x7fda54['fieldName'],'type':_0x7fda54['type'][_0x2fde('0x2d')]};});_0x2d1180['model']=_['map'](_0x306d93,_0x2fde('0x28'));_0x2d1180['query']=_[_0x2fde('0x2e')](_0x16116d[_0x2fde('0x2f')]);_0x2d1180[_0x2fde('0x30')]=_['intersection'](_0x2d1180[_0x2fde('0x31')],_0x2d1180[_0x2fde('0x2f')]);_0x4bf0b3[_0x2fde('0x32')]=_[_0x2fde('0x33')](_0x2d1180['model'],qs['fields'](_0x16116d['query'][_0x2fde('0x34')]));_0x4bf0b3[_0x2fde('0x32')]=_0x4bf0b3[_0x2fde('0x32')][_0x2fde('0x35')]?_0x4bf0b3[_0x2fde('0x32')]:_0x2d1180[_0x2fde('0x31')];if(!_0x16116d[_0x2fde('0x2f')][_0x2fde('0x36')](_0x2fde('0x37'))){_0x4bf0b3[_0x2fde('0x1b')]=qs[_0x2fde('0x1b')](_0x16116d[_0x2fde('0x2f')][_0x2fde('0x1b')]);_0x4bf0b3[_0x2fde('0x19')]=qs['offset'](_0x16116d[_0x2fde('0x2f')][_0x2fde('0x19')]);}_0x4bf0b3[_0x2fde('0x38')]=qs[_0x2fde('0x39')](_0x16116d[_0x2fde('0x2f')]['sort']);_0x4bf0b3['where']=qs[_0x2fde('0x30')](_[_0x2fde('0x3a')](_0x16116d[_0x2fde('0x2f')],_0x2d1180[_0x2fde('0x30')]),_0x306d93);if(_0x16116d[_0x2fde('0x2f')][_0x2fde('0x3b')]){_0x4bf0b3[_0x2fde('0x3c')]=_[_0x2fde('0x3d')](_0x4bf0b3[_0x2fde('0x3c')],{'$or':_[_0x2fde('0x3e')](_0x306d93,function(_0x2b8c5f){if(_0x2b8c5f[_0x2fde('0x3f')]!==_0x2fde('0x40')){var _0x5e8930={};_0x5e8930[_0x2b8c5f['name']]={'$like':'%'+_0x16116d[_0x2fde('0x2f')][_0x2fde('0x3b')]+'%'};return _0x5e8930;}})});}_0x4bf0b3=_[_0x2fde('0x3d')]({},_0x4bf0b3,_0x16116d[_0x2fde('0x41')]);var _0x462e02={'where':_0x4bf0b3[_0x2fde('0x3c')]};return db[_0x2fde('0x2b')][_0x2fde('0x1c')](_0x462e02)[_0x2fde('0x22')](function(_0x21ad45){_0xed8004[_0x2fde('0x1c')]=_0x21ad45;if(_0x16116d[_0x2fde('0x2f')]['includeAll']){_0x4bf0b3[_0x2fde('0x42')]=[{'all':!![]}];}return db[_0x2fde('0x2b')][_0x2fde('0x43')](_0x4bf0b3);})[_0x2fde('0x22')](function(_0x32eeb1){_0xed8004['rows']=_0x32eeb1;return _0xed8004;})['then'](respondWithFilteredResult(_0x43293f,_0x4bf0b3))[_0x2fde('0x44')](handleError(_0x43293f,null));};exports[_0x2fde('0x45')]=function(_0x35b048,_0x3d3519){var _0xc57ba={'raw':![],'where':{'id':_0x35b048[_0x2fde('0x46')]['id']}},_0x4acf9c={};_0x4acf9c[_0x2fde('0x31')]=_[_0x2fde('0x2e')](db[_0x2fde('0x2b')][_0x2fde('0x2c')]);_0x4acf9c[_0x2fde('0x2f')]=_[_0x2fde('0x2e')](_0x35b048[_0x2fde('0x2f')]);_0x4acf9c['filters']=_[_0x2fde('0x33')](_0x4acf9c[_0x2fde('0x31')],_0x4acf9c[_0x2fde('0x2f')]);_0xc57ba[_0x2fde('0x32')]=_[_0x2fde('0x33')](_0x4acf9c[_0x2fde('0x31')],qs[_0x2fde('0x34')](_0x35b048[_0x2fde('0x2f')][_0x2fde('0x34')]));_0xc57ba[_0x2fde('0x32')]=_0xc57ba[_0x2fde('0x32')][_0x2fde('0x35')]?_0xc57ba[_0x2fde('0x32')]:_0x4acf9c[_0x2fde('0x31')];if(_0x35b048[_0x2fde('0x2f')][_0x2fde('0x47')]){_0xc57ba[_0x2fde('0x42')]=[{'all':!![]}];}_0xc57ba=_[_0x2fde('0x3d')]({},_0xc57ba,_0x35b048[_0x2fde('0x41')]);return db[_0x2fde('0x2b')]['find'](_0xc57ba)[_0x2fde('0x22')](handleEntityNotFound(_0x3d3519,null))[_0x2fde('0x22')](respondWithResult(_0x3d3519,null))[_0x2fde('0x44')](handleError(_0x3d3519,null));};exports['create']=function(_0xae1087,_0x163d5){return db[_0x2fde('0x2b')][_0x2fde('0x48')](_0xae1087[_0x2fde('0x49')],{})['then'](respondWithResult(_0x163d5,0xc9))[_0x2fde('0x44')](handleError(_0x163d5,null));};exports['update']=function(_0x4c0883,_0x43adb3){if(_0x4c0883[_0x2fde('0x49')]['id']){delete _0x4c0883['body']['id'];}return db[_0x2fde('0x2b')][_0x2fde('0x4a')]({'where':{'id':_0x4c0883[_0x2fde('0x46')]['id']}})['then'](handleEntityNotFound(_0x43adb3,null))['then'](saveUpdates(_0x4c0883[_0x2fde('0x49')],null))[_0x2fde('0x22')](respondWithResult(_0x43adb3,null))[_0x2fde('0x44')](handleError(_0x43adb3,null));};exports['destroy']=function(_0x22c6bd,_0xd08236){return db[_0x2fde('0x2b')][_0x2fde('0x4a')]({'where':{'id':_0x22c6bd[_0x2fde('0x46')]['id']}})[_0x2fde('0x22')](handleEntityNotFound(_0xd08236,null))[_0x2fde('0x22')](removeEntity(_0xd08236,null))[_0x2fde('0x44')](handleError(_0xd08236,null));};exports[_0x2fde('0x4b')]=function(_0x324625,_0x37040a,_0x437261){var _0x1d31da={};var _0x4e483e={};var _0x27641c;var _0x3cfaaf;return db[_0x2fde('0x2b')][_0x2fde('0x4c')]({'where':{'id':_0x324625[_0x2fde('0x46')]['id']}})['then'](handleEntityNotFound(_0x37040a,null))[_0x2fde('0x22')](function(_0x4e6378){if(_0x4e6378){_0x27641c=_0x4e6378;_0x4e483e['model']=_[_0x2fde('0x2e')](db[_0x2fde('0x4d')][_0x2fde('0x2c')]);_0x4e483e['query']=_[_0x2fde('0x2e')](_0x324625['query']);_0x4e483e[_0x2fde('0x30')]=_['intersection'](_0x4e483e[_0x2fde('0x31')],_0x4e483e[_0x2fde('0x2f')]);_0x1d31da[_0x2fde('0x32')]=_[_0x2fde('0x33')](_0x4e483e['model'],qs[_0x2fde('0x34')](_0x324625['query']['fields']));_0x1d31da[_0x2fde('0x32')]=_0x1d31da[_0x2fde('0x32')][_0x2fde('0x35')]?_0x1d31da[_0x2fde('0x32')]:_0x4e483e[_0x2fde('0x31')];_0x1d31da['order']=qs['sort'](_0x324625[_0x2fde('0x2f')][_0x2fde('0x39')]);_0x1d31da['where']=qs['filters'](_[_0x2fde('0x3a')](_0x324625[_0x2fde('0x2f')],_0x4e483e['filters']));if(_0x324625['query'][_0x2fde('0x3b')]){_0x1d31da[_0x2fde('0x3c')]=_[_0x2fde('0x3d')](_0x1d31da[_0x2fde('0x3c')],{'$or':_[_0x2fde('0x3e')](_0x1d31da['attributes'],function(_0x3bf63c){var _0x9aa8e0={};_0x9aa8e0[_0x3bf63c]={'$like':'%'+_0x324625['query'][_0x2fde('0x3b')]+'%'};return _0x9aa8e0;})});}_0x1d31da=_['merge']({},_0x1d31da,_0x324625[_0x2fde('0x41')]);return _0x27641c[_0x2fde('0x4b')](_0x1d31da);}})[_0x2fde('0x22')](function(_0x54630b){if(_0x54630b){_0x3cfaaf=_0x54630b['length'];if(!_0x324625[_0x2fde('0x2f')]['hasOwnProperty'](_0x2fde('0x37'))){_0x1d31da[_0x2fde('0x1b')]=qs[_0x2fde('0x1b')](_0x324625[_0x2fde('0x2f')]['limit']);_0x1d31da[_0x2fde('0x19')]=qs[_0x2fde('0x19')](_0x324625[_0x2fde('0x2f')][_0x2fde('0x19')]);}return _0x27641c['getFields'](_0x1d31da);}})['then'](function(_0x2d58a2){if(_0x2d58a2){return _0x2d58a2?{'count':_0x3cfaaf,'rows':_0x2d58a2}:null;}})[_0x2fde('0x22')](respondWithResult(_0x37040a,null))[_0x2fde('0x44')](handleError(_0x37040a,null));};exports['getSubjects']=function(_0x275e01,_0x2e7321,_0x36a508){var _0x21ac16={};var _0x1daeb3={};var _0x372d82;var _0x14098d;return db[_0x2fde('0x2b')]['findOne']({'where':{'id':_0x275e01['params']['id']}})[_0x2fde('0x22')](handleEntityNotFound(_0x2e7321,null))['then'](function(_0xd3aa59){if(_0xd3aa59){_0x372d82=_0xd3aa59;_0x1daeb3[_0x2fde('0x31')]=_[_0x2fde('0x2e')](db[_0x2fde('0x4d')][_0x2fde('0x2c')]);_0x1daeb3['query']=_[_0x2fde('0x2e')](_0x275e01[_0x2fde('0x2f')]);_0x1daeb3['filters']=_['intersection'](_0x1daeb3[_0x2fde('0x31')],_0x1daeb3[_0x2fde('0x2f')]);_0x21ac16[_0x2fde('0x32')]=_[_0x2fde('0x33')](_0x1daeb3[_0x2fde('0x31')],qs[_0x2fde('0x34')](_0x275e01[_0x2fde('0x2f')][_0x2fde('0x34')]));_0x21ac16[_0x2fde('0x32')]=_0x21ac16[_0x2fde('0x32')][_0x2fde('0x35')]?_0x21ac16['attributes']:_0x1daeb3[_0x2fde('0x31')];_0x21ac16[_0x2fde('0x38')]=qs[_0x2fde('0x39')](_0x275e01[_0x2fde('0x2f')][_0x2fde('0x39')]);_0x21ac16[_0x2fde('0x3c')]=qs[_0x2fde('0x30')](_[_0x2fde('0x3a')](_0x275e01[_0x2fde('0x2f')],_0x1daeb3[_0x2fde('0x30')]));if(_0x275e01['query'][_0x2fde('0x3b')]){_0x21ac16[_0x2fde('0x3c')]=_[_0x2fde('0x3d')](_0x21ac16[_0x2fde('0x3c')],{'$or':_[_0x2fde('0x3e')](_0x21ac16[_0x2fde('0x32')],function(_0x344680){var _0x368e00={};_0x368e00[_0x344680]={'$like':'%'+_0x275e01[_0x2fde('0x2f')][_0x2fde('0x3b')]+'%'};return _0x368e00;})});}_0x21ac16=_[_0x2fde('0x3d')]({},_0x21ac16,_0x275e01[_0x2fde('0x41')]);return _0x372d82[_0x2fde('0x4e')](_0x21ac16);}})[_0x2fde('0x22')](function(_0x1deada){if(_0x1deada){_0x14098d=_0x1deada[_0x2fde('0x35')];if(!_0x275e01[_0x2fde('0x2f')][_0x2fde('0x36')]('nolimit')){_0x21ac16[_0x2fde('0x1b')]=qs[_0x2fde('0x1b')](_0x275e01['query']['limit']);_0x21ac16['offset']=qs[_0x2fde('0x19')](_0x275e01['query']['offset']);}return _0x372d82[_0x2fde('0x4e')](_0x21ac16);}})[_0x2fde('0x22')](function(_0xc17535){if(_0xc17535){return _0xc17535?{'count':_0x14098d,'rows':_0xc17535}:null;}})[_0x2fde('0x22')](respondWithResult(_0x2e7321,null))[_0x2fde('0x44')](handleError(_0x2e7321,null));};exports[_0x2fde('0x4f')]=function(_0x1c823d,_0x23bbad,_0x22534e){var _0x378de9={};var _0x85eb29={};var _0x422cb7;var _0x24cac9;return db[_0x2fde('0x2b')][_0x2fde('0x4c')]({'where':{'id':_0x1c823d['params']['id']}})[_0x2fde('0x22')](handleEntityNotFound(_0x23bbad,null))['then'](function(_0x240874){if(_0x240874){_0x422cb7=_0x240874;_0x85eb29[_0x2fde('0x31')]=_[_0x2fde('0x2e')](db['Dynamics365Field']['rawAttributes']);_0x85eb29[_0x2fde('0x2f')]=_[_0x2fde('0x2e')](_0x1c823d[_0x2fde('0x2f')]);_0x85eb29[_0x2fde('0x30')]=_[_0x2fde('0x33')](_0x85eb29['model'],_0x85eb29[_0x2fde('0x2f')]);_0x378de9[_0x2fde('0x32')]=_['intersection'](_0x85eb29[_0x2fde('0x31')],qs[_0x2fde('0x34')](_0x1c823d['query'][_0x2fde('0x34')]));_0x378de9[_0x2fde('0x32')]=_0x378de9[_0x2fde('0x32')][_0x2fde('0x35')]?_0x378de9[_0x2fde('0x32')]:_0x85eb29[_0x2fde('0x31')];_0x378de9[_0x2fde('0x38')]=qs[_0x2fde('0x39')](_0x1c823d[_0x2fde('0x2f')]['sort']);_0x378de9['where']=qs[_0x2fde('0x30')](_[_0x2fde('0x3a')](_0x1c823d[_0x2fde('0x2f')],_0x85eb29[_0x2fde('0x30')]));if(_0x1c823d[_0x2fde('0x2f')][_0x2fde('0x3b')]){_0x378de9['where']=_[_0x2fde('0x3d')](_0x378de9['where'],{'$or':_['map'](_0x378de9['attributes'],function(_0x128ede){var _0x4653bc={};_0x4653bc[_0x128ede]={'$like':'%'+_0x1c823d[_0x2fde('0x2f')][_0x2fde('0x3b')]+'%'};return _0x4653bc;})});}_0x378de9=_[_0x2fde('0x3d')]({},_0x378de9,_0x1c823d[_0x2fde('0x41')]);return _0x422cb7['getDescriptions'](_0x378de9);}})[_0x2fde('0x22')](function(_0x13bef9){if(_0x13bef9){_0x24cac9=_0x13bef9[_0x2fde('0x35')];if(!_0x1c823d[_0x2fde('0x2f')]['hasOwnProperty']('nolimit')){_0x378de9[_0x2fde('0x1b')]=qs[_0x2fde('0x1b')](_0x1c823d[_0x2fde('0x2f')][_0x2fde('0x1b')]);_0x378de9[_0x2fde('0x19')]=qs[_0x2fde('0x19')](_0x1c823d[_0x2fde('0x2f')]['offset']);}return _0x422cb7[_0x2fde('0x4f')](_0x378de9);}})[_0x2fde('0x22')](function(_0x18b693){if(_0x18b693){return _0x18b693?{'count':_0x24cac9,'rows':_0x18b693}:null;}})[_0x2fde('0x22')](respondWithResult(_0x23bbad,null))[_0x2fde('0x44')](handleError(_0x23bbad,null));}; \ No newline at end of file +var _0xcd81=['moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','end','sendStatus','error','name','send','index','map','Dynamics365Configuration','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','create','body','find','destroy','getFields','pick','Dynamics365Field','order','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3522a3,_0x38acd3){var _0x2f51b1=function(_0x31a264){while(--_0x31a264){_0x3522a3['push'](_0x3522a3['shift']());}};_0x2f51b1(++_0x38acd3);}(_0xcd81,0x1f3));var _0x1cd8=function(_0x5e1dc8,_0x580e18){_0x5e1dc8=_0x5e1dc8-0x0;var _0x440553=_0xcd81[_0x5e1dc8];return _0x440553;};'use strict';var emlformat=require(_0x1cd8('0x0'));var rimraf=require(_0x1cd8('0x1'));var zipdir=require(_0x1cd8('0x2'));var jsonpatch=require(_0x1cd8('0x3'));var rp=require(_0x1cd8('0x4'));var moment=require(_0x1cd8('0x5'));var BPromise=require(_0x1cd8('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1cd8('0x7'));var sox=require(_0x1cd8('0x8'));var csv=require(_0x1cd8('0x9'));var ejs=require(_0x1cd8('0xa'));var fs=require('fs');var fs_extra=require(_0x1cd8('0xb'));var _=require(_0x1cd8('0xc'));var squel=require(_0x1cd8('0xd'));var crypto=require(_0x1cd8('0xe'));var jsforce=require(_0x1cd8('0xf'));var deskjs=require(_0x1cd8('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1cd8('0x11'));var Redis=require('ioredis');var authService=require(_0x1cd8('0x12'));var qs=require(_0x1cd8('0x13'));var as=require(_0x1cd8('0x14'));var hardwareService=require(_0x1cd8('0x15'));var logger=require(_0x1cd8('0x16'))(_0x1cd8('0x17'));var utils=require('../../config/utils');var config=require(_0x1cd8('0x18'));var licenseUtil=require(_0x1cd8('0x19'));var db=require(_0x1cd8('0x1a'))['db'];function respondWithStatusCode(_0x378e93,_0x36a024){_0x36a024=_0x36a024||0xcc;return function(_0x2bcee8){if(_0x2bcee8){return _0x378e93['sendStatus'](_0x36a024);}return _0x378e93[_0x1cd8('0x1b')](_0x36a024)['end']();};}function respondWithResult(_0x26ecd5,_0x3cc70d){_0x3cc70d=_0x3cc70d||0xc8;return function(_0x31508b){if(_0x31508b){return _0x26ecd5['status'](_0x3cc70d)[_0x1cd8('0x1c')](_0x31508b);}};}function respondWithFilteredResult(_0x535c3f,_0x371a43){return function(_0x420ff4){if(_0x420ff4){var _0x33c76c=typeof _0x371a43[_0x1cd8('0x1d')]===_0x1cd8('0x1e')&&typeof _0x371a43[_0x1cd8('0x1f')]===_0x1cd8('0x1e');var _0x2ef4c4=_0x420ff4[_0x1cd8('0x20')];var _0x4e7293=_0x33c76c?0x0:_0x371a43[_0x1cd8('0x1d')];var _0x12142a=_0x33c76c?_0x420ff4[_0x1cd8('0x20')]:_0x371a43['offset']+_0x371a43['limit'];var _0x98d602;if(_0x12142a>=_0x2ef4c4){_0x12142a=_0x2ef4c4;_0x98d602=0xc8;}else{_0x98d602=0xce;}_0x535c3f[_0x1cd8('0x1b')](_0x98d602);return _0x535c3f['set'](_0x1cd8('0x21'),_0x4e7293+'-'+_0x12142a+'/'+_0x2ef4c4)[_0x1cd8('0x1c')](_0x420ff4);}return null;};}function patchUpdates(_0x33db02){return function(_0x3c228e){try{jsonpatch[_0x1cd8('0x22')](_0x3c228e,_0x33db02,!![]);}catch(_0x33a7bc){return BPromise[_0x1cd8('0x23')](_0x33a7bc);}return _0x3c228e[_0x1cd8('0x24')]();};}function saveUpdates(_0x1aa90a,_0x2e0119){return function(_0x57462d){if(_0x57462d){return _0x57462d[_0x1cd8('0x25')](_0x1aa90a)[_0x1cd8('0x26')](function(_0x5f2c33){return _0x5f2c33;});}return null;};}function removeEntity(_0x22b418,_0xc86eab){return function(_0x30633e){if(_0x30633e){return _0x30633e['destroy']()['then'](function(){_0x22b418[_0x1cd8('0x1b')](0xcc)[_0x1cd8('0x27')]();});}};}function handleEntityNotFound(_0x30ff65,_0x2223fc){return function(_0x1aeebf){if(!_0x1aeebf){_0x30ff65[_0x1cd8('0x28')](0x194);}return _0x1aeebf;};}function handleError(_0x42b03b,_0x22cd4d){_0x22cd4d=_0x22cd4d||0x1f4;return function(_0xea27f1){logger[_0x1cd8('0x29')](_0xea27f1['stack']);if(_0xea27f1[_0x1cd8('0x2a')]){delete _0xea27f1['name'];}_0x42b03b[_0x1cd8('0x1b')](_0x22cd4d)[_0x1cd8('0x2b')](_0xea27f1);};}exports[_0x1cd8('0x2c')]=function(_0x183801,_0x42cc8f){var _0x4b7e6d={},_0x2c8f27={},_0x179efa={'count':0x0,'rows':[]};var _0xc88ad5=_[_0x1cd8('0x2d')](db[_0x1cd8('0x2e')]['rawAttributes'],function(_0x3a5579){return{'name':_0x3a5579[_0x1cd8('0x2f')],'type':_0x3a5579[_0x1cd8('0x30')][_0x1cd8('0x31')]};});_0x2c8f27[_0x1cd8('0x32')]=_[_0x1cd8('0x2d')](_0xc88ad5,_0x1cd8('0x2a'));_0x2c8f27['query']=_['keys'](_0x183801['query']);_0x2c8f27[_0x1cd8('0x33')]=_[_0x1cd8('0x34')](_0x2c8f27[_0x1cd8('0x32')],_0x2c8f27[_0x1cd8('0x35')]);_0x4b7e6d[_0x1cd8('0x36')]=_[_0x1cd8('0x34')](_0x2c8f27[_0x1cd8('0x32')],qs[_0x1cd8('0x37')](_0x183801[_0x1cd8('0x35')][_0x1cd8('0x37')]));_0x4b7e6d['attributes']=_0x4b7e6d[_0x1cd8('0x36')][_0x1cd8('0x38')]?_0x4b7e6d[_0x1cd8('0x36')]:_0x2c8f27[_0x1cd8('0x32')];if(!_0x183801['query'][_0x1cd8('0x39')](_0x1cd8('0x3a'))){_0x4b7e6d['limit']=qs[_0x1cd8('0x1f')](_0x183801[_0x1cd8('0x35')][_0x1cd8('0x1f')]);_0x4b7e6d[_0x1cd8('0x1d')]=qs['offset'](_0x183801[_0x1cd8('0x35')][_0x1cd8('0x1d')]);}_0x4b7e6d['order']=qs[_0x1cd8('0x3b')](_0x183801[_0x1cd8('0x35')][_0x1cd8('0x3b')]);_0x4b7e6d[_0x1cd8('0x3c')]=qs[_0x1cd8('0x33')](_['pick'](_0x183801['query'],_0x2c8f27[_0x1cd8('0x33')]),_0xc88ad5);if(_0x183801['query'][_0x1cd8('0x3d')]){_0x4b7e6d[_0x1cd8('0x3c')]=_[_0x1cd8('0x3e')](_0x4b7e6d[_0x1cd8('0x3c')],{'$or':_[_0x1cd8('0x2d')](_0xc88ad5,function(_0x1924ac){if(_0x1924ac[_0x1cd8('0x30')]!==_0x1cd8('0x3f')){var _0x519582={};_0x519582[_0x1924ac[_0x1cd8('0x2a')]]={'$like':'%'+_0x183801[_0x1cd8('0x35')][_0x1cd8('0x3d')]+'%'};return _0x519582;}})});}_0x4b7e6d=_[_0x1cd8('0x3e')]({},_0x4b7e6d,_0x183801[_0x1cd8('0x40')]);var _0x2be532={'where':_0x4b7e6d[_0x1cd8('0x3c')]};return db[_0x1cd8('0x2e')][_0x1cd8('0x20')](_0x2be532)['then'](function(_0x216099){_0x179efa[_0x1cd8('0x20')]=_0x216099;if(_0x183801[_0x1cd8('0x35')][_0x1cd8('0x41')]){_0x4b7e6d[_0x1cd8('0x42')]=[{'all':!![]}];}return db[_0x1cd8('0x2e')][_0x1cd8('0x43')](_0x4b7e6d);})[_0x1cd8('0x26')](function(_0xe5eca5){_0x179efa[_0x1cd8('0x44')]=_0xe5eca5;return _0x179efa;})['then'](respondWithFilteredResult(_0x42cc8f,_0x4b7e6d))[_0x1cd8('0x45')](handleError(_0x42cc8f,null));};exports['show']=function(_0x4c9ff3,_0x599504){var _0x75036f={'raw':![],'where':{'id':_0x4c9ff3[_0x1cd8('0x46')]['id']}},_0x39a0df={};_0x39a0df[_0x1cd8('0x32')]=_[_0x1cd8('0x47')](db[_0x1cd8('0x2e')][_0x1cd8('0x48')]);_0x39a0df[_0x1cd8('0x35')]=_['keys'](_0x4c9ff3['query']);_0x39a0df[_0x1cd8('0x33')]=_[_0x1cd8('0x34')](_0x39a0df[_0x1cd8('0x32')],_0x39a0df[_0x1cd8('0x35')]);_0x75036f[_0x1cd8('0x36')]=_['intersection'](_0x39a0df[_0x1cd8('0x32')],qs[_0x1cd8('0x37')](_0x4c9ff3[_0x1cd8('0x35')][_0x1cd8('0x37')]));_0x75036f[_0x1cd8('0x36')]=_0x75036f[_0x1cd8('0x36')][_0x1cd8('0x38')]?_0x75036f[_0x1cd8('0x36')]:_0x39a0df[_0x1cd8('0x32')];if(_0x4c9ff3['query']['includeAll']){_0x75036f[_0x1cd8('0x42')]=[{'all':!![]}];}_0x75036f=_['merge']({},_0x75036f,_0x4c9ff3[_0x1cd8('0x40')]);return db[_0x1cd8('0x2e')]['find'](_0x75036f)['then'](handleEntityNotFound(_0x599504,null))['then'](respondWithResult(_0x599504,null))['catch'](handleError(_0x599504,null));};exports['create']=function(_0x50797c,_0x3ff802){return db[_0x1cd8('0x2e')][_0x1cd8('0x49')](_0x50797c['body'],{})[_0x1cd8('0x26')](respondWithResult(_0x3ff802,0xc9))[_0x1cd8('0x45')](handleError(_0x3ff802,null));};exports[_0x1cd8('0x25')]=function(_0x17b532,_0x37ae8d){if(_0x17b532['body']['id']){delete _0x17b532[_0x1cd8('0x4a')]['id'];}return db[_0x1cd8('0x2e')][_0x1cd8('0x4b')]({'where':{'id':_0x17b532[_0x1cd8('0x46')]['id']}})[_0x1cd8('0x26')](handleEntityNotFound(_0x37ae8d,null))[_0x1cd8('0x26')](saveUpdates(_0x17b532[_0x1cd8('0x4a')],null))['then'](respondWithResult(_0x37ae8d,null))[_0x1cd8('0x45')](handleError(_0x37ae8d,null));};exports[_0x1cd8('0x4c')]=function(_0x1fa3a3,_0x4530ee){return db['Dynamics365Configuration'][_0x1cd8('0x4b')]({'where':{'id':_0x1fa3a3['params']['id']}})[_0x1cd8('0x26')](handleEntityNotFound(_0x4530ee,null))[_0x1cd8('0x26')](removeEntity(_0x4530ee,null))[_0x1cd8('0x45')](handleError(_0x4530ee,null));};exports[_0x1cd8('0x4d')]=function(_0x3d0c5f,_0x146045,_0x1cce45){var _0x267fe5={};var _0x101e13={};var _0x484130;var _0x1b2581;return db[_0x1cd8('0x2e')]['findOne']({'where':{'id':_0x3d0c5f[_0x1cd8('0x46')]['id']}})[_0x1cd8('0x26')](handleEntityNotFound(_0x146045,null))[_0x1cd8('0x26')](function(_0x17c57e){if(_0x17c57e){_0x484130=_0x17c57e;_0x101e13[_0x1cd8('0x32')]=_[_0x1cd8('0x47')](db['Dynamics365Field'][_0x1cd8('0x48')]);_0x101e13['query']=_[_0x1cd8('0x47')](_0x3d0c5f['query']);_0x101e13['filters']=_[_0x1cd8('0x34')](_0x101e13['model'],_0x101e13[_0x1cd8('0x35')]);_0x267fe5[_0x1cd8('0x36')]=_[_0x1cd8('0x34')](_0x101e13[_0x1cd8('0x32')],qs[_0x1cd8('0x37')](_0x3d0c5f['query'][_0x1cd8('0x37')]));_0x267fe5[_0x1cd8('0x36')]=_0x267fe5[_0x1cd8('0x36')][_0x1cd8('0x38')]?_0x267fe5[_0x1cd8('0x36')]:_0x101e13['model'];_0x267fe5['order']=qs['sort'](_0x3d0c5f[_0x1cd8('0x35')]['sort']);_0x267fe5[_0x1cd8('0x3c')]=qs[_0x1cd8('0x33')](_[_0x1cd8('0x4e')](_0x3d0c5f[_0x1cd8('0x35')],_0x101e13[_0x1cd8('0x33')]));if(_0x3d0c5f[_0x1cd8('0x35')][_0x1cd8('0x3d')]){_0x267fe5[_0x1cd8('0x3c')]=_[_0x1cd8('0x3e')](_0x267fe5[_0x1cd8('0x3c')],{'$or':_['map'](_0x267fe5['attributes'],function(_0x252081){var _0xaa4700={};_0xaa4700[_0x252081]={'$like':'%'+_0x3d0c5f[_0x1cd8('0x35')][_0x1cd8('0x3d')]+'%'};return _0xaa4700;})});}_0x267fe5=_[_0x1cd8('0x3e')]({},_0x267fe5,_0x3d0c5f[_0x1cd8('0x40')]);return _0x484130[_0x1cd8('0x4d')](_0x267fe5);}})['then'](function(_0x2747d6){if(_0x2747d6){_0x1b2581=_0x2747d6['length'];if(!_0x3d0c5f[_0x1cd8('0x35')][_0x1cd8('0x39')](_0x1cd8('0x3a'))){_0x267fe5[_0x1cd8('0x1f')]=qs['limit'](_0x3d0c5f['query'][_0x1cd8('0x1f')]);_0x267fe5['offset']=qs[_0x1cd8('0x1d')](_0x3d0c5f['query'][_0x1cd8('0x1d')]);}return _0x484130[_0x1cd8('0x4d')](_0x267fe5);}})[_0x1cd8('0x26')](function(_0x5f09ab){if(_0x5f09ab){return _0x5f09ab?{'count':_0x1b2581,'rows':_0x5f09ab}:null;}})[_0x1cd8('0x26')](respondWithResult(_0x146045,null))['catch'](handleError(_0x146045,null));};exports['getSubjects']=function(_0x410592,_0x254e0e,_0x12f5b7){var _0x48fb72={};var _0x2769cc={};var _0x47b317;var _0x55ce64;return db[_0x1cd8('0x2e')]['findOne']({'where':{'id':_0x410592['params']['id']}})[_0x1cd8('0x26')](handleEntityNotFound(_0x254e0e,null))[_0x1cd8('0x26')](function(_0x5bd92c){if(_0x5bd92c){_0x47b317=_0x5bd92c;_0x2769cc['model']=_['keys'](db[_0x1cd8('0x4f')]['rawAttributes']);_0x2769cc[_0x1cd8('0x35')]=_[_0x1cd8('0x47')](_0x410592[_0x1cd8('0x35')]);_0x2769cc[_0x1cd8('0x33')]=_['intersection'](_0x2769cc[_0x1cd8('0x32')],_0x2769cc[_0x1cd8('0x35')]);_0x48fb72[_0x1cd8('0x36')]=_[_0x1cd8('0x34')](_0x2769cc[_0x1cd8('0x32')],qs[_0x1cd8('0x37')](_0x410592['query'][_0x1cd8('0x37')]));_0x48fb72[_0x1cd8('0x36')]=_0x48fb72[_0x1cd8('0x36')][_0x1cd8('0x38')]?_0x48fb72[_0x1cd8('0x36')]:_0x2769cc['model'];_0x48fb72[_0x1cd8('0x50')]=qs[_0x1cd8('0x3b')](_0x410592[_0x1cd8('0x35')][_0x1cd8('0x3b')]);_0x48fb72['where']=qs[_0x1cd8('0x33')](_[_0x1cd8('0x4e')](_0x410592[_0x1cd8('0x35')],_0x2769cc[_0x1cd8('0x33')]));if(_0x410592['query'][_0x1cd8('0x3d')]){_0x48fb72[_0x1cd8('0x3c')]=_[_0x1cd8('0x3e')](_0x48fb72[_0x1cd8('0x3c')],{'$or':_[_0x1cd8('0x2d')](_0x48fb72[_0x1cd8('0x36')],function(_0x202a84){var _0x40808c={};_0x40808c[_0x202a84]={'$like':'%'+_0x410592[_0x1cd8('0x35')]['filter']+'%'};return _0x40808c;})});}_0x48fb72=_[_0x1cd8('0x3e')]({},_0x48fb72,_0x410592[_0x1cd8('0x40')]);return _0x47b317[_0x1cd8('0x51')](_0x48fb72);}})[_0x1cd8('0x26')](function(_0x519b7b){if(_0x519b7b){_0x55ce64=_0x519b7b[_0x1cd8('0x38')];if(!_0x410592[_0x1cd8('0x35')][_0x1cd8('0x39')]('nolimit')){_0x48fb72[_0x1cd8('0x1f')]=qs[_0x1cd8('0x1f')](_0x410592[_0x1cd8('0x35')][_0x1cd8('0x1f')]);_0x48fb72[_0x1cd8('0x1d')]=qs[_0x1cd8('0x1d')](_0x410592[_0x1cd8('0x35')][_0x1cd8('0x1d')]);}return _0x47b317['getSubjects'](_0x48fb72);}})[_0x1cd8('0x26')](function(_0x221c0d){if(_0x221c0d){return _0x221c0d?{'count':_0x55ce64,'rows':_0x221c0d}:null;}})[_0x1cd8('0x26')](respondWithResult(_0x254e0e,null))[_0x1cd8('0x45')](handleError(_0x254e0e,null));};exports['getDescriptions']=function(_0x12283d,_0xb28e2f,_0x15a47b){var _0x426d68={};var _0x18f08f={};var _0x40fc9b;var _0x31604a;return db[_0x1cd8('0x2e')][_0x1cd8('0x52')]({'where':{'id':_0x12283d[_0x1cd8('0x46')]['id']}})[_0x1cd8('0x26')](handleEntityNotFound(_0xb28e2f,null))[_0x1cd8('0x26')](function(_0x97547b){if(_0x97547b){_0x40fc9b=_0x97547b;_0x18f08f['model']=_[_0x1cd8('0x47')](db[_0x1cd8('0x4f')]['rawAttributes']);_0x18f08f['query']=_[_0x1cd8('0x47')](_0x12283d['query']);_0x18f08f[_0x1cd8('0x33')]=_['intersection'](_0x18f08f[_0x1cd8('0x32')],_0x18f08f[_0x1cd8('0x35')]);_0x426d68[_0x1cd8('0x36')]=_[_0x1cd8('0x34')](_0x18f08f[_0x1cd8('0x32')],qs[_0x1cd8('0x37')](_0x12283d['query']['fields']));_0x426d68[_0x1cd8('0x36')]=_0x426d68[_0x1cd8('0x36')][_0x1cd8('0x38')]?_0x426d68['attributes']:_0x18f08f['model'];_0x426d68[_0x1cd8('0x50')]=qs[_0x1cd8('0x3b')](_0x12283d[_0x1cd8('0x35')][_0x1cd8('0x3b')]);_0x426d68[_0x1cd8('0x3c')]=qs[_0x1cd8('0x33')](_[_0x1cd8('0x4e')](_0x12283d[_0x1cd8('0x35')],_0x18f08f[_0x1cd8('0x33')]));if(_0x12283d[_0x1cd8('0x35')]['filter']){_0x426d68['where']=_['merge'](_0x426d68[_0x1cd8('0x3c')],{'$or':_[_0x1cd8('0x2d')](_0x426d68[_0x1cd8('0x36')],function(_0x44ac19){var _0x23198b={};_0x23198b[_0x44ac19]={'$like':'%'+_0x12283d[_0x1cd8('0x35')]['filter']+'%'};return _0x23198b;})});}_0x426d68=_[_0x1cd8('0x3e')]({},_0x426d68,_0x12283d[_0x1cd8('0x40')]);return _0x40fc9b['getDescriptions'](_0x426d68);}})['then'](function(_0x31348e){if(_0x31348e){_0x31604a=_0x31348e[_0x1cd8('0x38')];if(!_0x12283d[_0x1cd8('0x35')][_0x1cd8('0x39')](_0x1cd8('0x3a'))){_0x426d68[_0x1cd8('0x1f')]=qs['limit'](_0x12283d[_0x1cd8('0x35')][_0x1cd8('0x1f')]);_0x426d68[_0x1cd8('0x1d')]=qs[_0x1cd8('0x1d')](_0x12283d[_0x1cd8('0x35')][_0x1cd8('0x1d')]);}return _0x40fc9b[_0x1cd8('0x53')](_0x426d68);}})[_0x1cd8('0x26')](function(_0xac3e57){if(_0xac3e57){return _0xac3e57?{'count':_0x31604a,'rows':_0xac3e57}:null;}})[_0x1cd8('0x26')](respondWithResult(_0xb28e2f,null))[_0x1cd8('0x45')](handleError(_0xb28e2f,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index a277e53..12f5096 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 _0x81bd=['../../config/environment','./intDynamics365Configuration.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x15fb5a,_0x12814b){var _0x55f948=function(_0x33325e){while(--_0x33325e){_0x15fb5a['push'](_0x15fb5a['shift']());}};_0x55f948(++_0x12814b);}(_0x81bd,0x7c));var _0xd81b=function(_0x4aec19,_0x144670){_0x4aec19=_0x4aec19-0x0;var _0x27a282=_0x81bd[_0x4aec19];return _0x27a282;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var logger=require(_0xd81b('0x2'))(_0xd81b('0x3'));var moment=require(_0xd81b('0x4'));var BPromise=require(_0xd81b('0x5'));var rp=require(_0xd81b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd81b('0x7'));var config=require(_0xd81b('0x8'));var attributes=require(_0xd81b('0x9'));module['exports']=function(_0x42a0aa,_0x34eb73){return _0x42a0aa[_0xd81b('0xa')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','Dynamics365Configuration','int_dynamics365_configurations','lodash','../../config/logger','api','moment','path','../../config/environment','./intDynamics365Configuration.attributes'];(function(_0x3dd991,_0x4bef12){var _0x251609=function(_0x371481){while(--_0x371481){_0x3dd991['push'](_0x3dd991['shift']());}};_0x251609(++_0x4bef12);}(_0x3e74,0x175));var _0x43e7=function(_0x20948c,_0x141b4e){_0x20948c=_0x20948c-0x0;var _0x18cdc8=_0x3e74[_0x20948c];return _0x18cdc8;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 4946da8..f4c2c0e 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 _0x5285=['http','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x5d085e,_0x47382e){var _0x3ac3c5=function(_0x4f51c4){while(--_0x4f51c4){_0x5d085e['push'](_0x5d085e['shift']());}};_0x3ac3c5(++_0x47382e);}(_0x5285,0x106));var _0x5528=function(_0x132d12,_0x2c9799){_0x132d12=_0x132d12-0x0;var _0x1c3163=_0x5285[_0x132d12];return _0x1c3163;};'use strict';var _=require(_0x5528('0x0'));var util=require(_0x5528('0x1'));var moment=require(_0x5528('0x2'));var BPromise=require(_0x5528('0x3'));var rs=require(_0x5528('0x4'));var fs=require('fs');var Redis=require(_0x5528('0x5'));var db=require(_0x5528('0x6'))['db'];var utils=require(_0x5528('0x7'));var logger=require(_0x5528('0x8'))('rpc');var config=require(_0x5528('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5528('0xa')][_0x5528('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xafdc9,_0x4ce7a6,_0x536935){return new BPromise(function(_0x39dc2a,_0x214f95){return client['request'](_0xafdc9,_0x536935)[_0x5528('0xc')](function(_0x65c33f){logger[_0x5528('0xd')](_0x5528('0xe'),_0x4ce7a6,_0x5528('0xf'));logger[_0x5528('0x10')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x4ce7a6,_0x5528('0xf'),JSON['stringify'](_0x65c33f));if(_0x65c33f[_0x5528('0x11')]){if(_0x65c33f[_0x5528('0x11')][_0x5528('0x12')]===0x1f4){logger[_0x5528('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4ce7a6,_0x65c33f[_0x5528('0x11')][_0x5528('0x13')]);return _0x214f95(_0x65c33f[_0x5528('0x11')][_0x5528('0x13')]);}logger['error'](_0x5528('0xe'),_0x4ce7a6,_0x65c33f[_0x5528('0x11')][_0x5528('0x13')]);return _0x39dc2a(_0x65c33f[_0x5528('0x11')][_0x5528('0x13')]);}else{logger['info'](_0x5528('0xe'),_0x4ce7a6,_0x5528('0xf'));_0x39dc2a(_0x65c33f[_0x5528('0x14')][_0x5528('0x13')]);}})['catch'](function(_0x58ca4d){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x4ce7a6,_0x58ca4d);_0x214f95(_0x58ca4d);});});} \ No newline at end of file +var _0x9fbd=['Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','bluebird','ioredis','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x34a284,_0x207084){var _0x2ec13b=function(_0x197011){while(--_0x197011){_0x34a284['push'](_0x34a284['shift']());}};_0x2ec13b(++_0x207084);}(_0x9fbd,0x82));var _0xd9fb=function(_0x160bef,_0x26ee0a){_0x160bef=_0x160bef-0x0;var _0x24acc6=_0x9fbd[_0x160bef];return _0x24acc6;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xd9fb('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd9fb('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd9fb('0x2'));var config=require(_0xd9fb('0x3'));var jayson=require(_0xd9fb('0x4'));var client=jayson['client'][_0xd9fb('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x32aab5,_0x58dcbc,_0x2d7bca){return new BPromise(function(_0x2e63fd,_0x4d3723){return client[_0xd9fb('0x6')](_0x32aab5,_0x2d7bca)[_0xd9fb('0x7')](function(_0x49f4be){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x58dcbc,_0xd9fb('0x8'));logger[_0xd9fb('0x9')](_0xd9fb('0xa'),_0x58dcbc,_0xd9fb('0x8'),JSON[_0xd9fb('0xb')](_0x49f4be));if(_0x49f4be[_0xd9fb('0xc')]){if(_0x49f4be['error'][_0xd9fb('0xd')]===0x1f4){logger[_0xd9fb('0xc')](_0xd9fb('0xe'),_0x58dcbc,_0x49f4be[_0xd9fb('0xc')][_0xd9fb('0xf')]);return _0x4d3723(_0x49f4be['error'][_0xd9fb('0xf')]);}logger['error'](_0xd9fb('0xe'),_0x58dcbc,_0x49f4be['error'][_0xd9fb('0xf')]);return _0x2e63fd(_0x49f4be[_0xd9fb('0xc')][_0xd9fb('0xf')]);}else{logger['info'](_0xd9fb('0xe'),_0x58dcbc,_0xd9fb('0x8'));_0x2e63fd(_0x49f4be[_0xd9fb('0x10')]['message']);}})[_0xd9fb('0x11')](function(_0xe013ec){logger[_0xd9fb('0xc')](_0xd9fb('0xe'),_0x58dcbc,_0xe013ec);_0x4d3723(_0xe013ec);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index f226de0..429d0cf 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 _0xc118=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','index','/:id','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc118,0x124));var _0x8c11=function(_0x45009a,_0x135760){_0x45009a=_0x45009a-0x0;var _0x5cd7fc=_0xc118[_0x45009a];return _0x5cd7fc;};'use strict';var multer=require(_0x8c11('0x0'));var util=require(_0x8c11('0x1'));var path=require(_0x8c11('0x2'));var timeout=require(_0x8c11('0x3'));var express=require(_0x8c11('0x4'));var router=express['Router']();var fs_extra=require(_0x8c11('0x5'));var auth=require(_0x8c11('0x6'));var interaction=require(_0x8c11('0x7'));var config=require(_0x8c11('0x8'));var controller=require(_0x8c11('0x9'));router[_0x8c11('0xa')]('/',auth['isAuthenticated'](),controller[_0x8c11('0xb')]);router['get'](_0x8c11('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x8c11('0xd')]('/',auth[_0x8c11('0xe')](),controller[_0x8c11('0xf')]);router[_0x8c11('0x10')]('/:id',auth[_0x8c11('0xe')](),controller[_0x8c11('0x11')]);router[_0x8c11('0x12')](_0x8c11('0xc'),auth['isAuthenticated'](),controller[_0x8c11('0x13')]);module[_0x8c11('0x14')]=router; \ No newline at end of file +var _0x350d=['create','update','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','/:id','show'];(function(_0x3f7bcd,_0x12db13){var _0x331a0b=function(_0x4b7430){while(--_0x4b7430){_0x3f7bcd['push'](_0x3f7bcd['shift']());}};_0x331a0b(++_0x12db13);}(_0x350d,0xb4));var _0xd350=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x350d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd350('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd350('0x1'));var express=require('express');var router=express[_0xd350('0x2')]();var fs_extra=require(_0xd350('0x3'));var auth=require(_0xd350('0x4'));var interaction=require(_0xd350('0x5'));var config=require(_0xd350('0x6'));var controller=require(_0xd350('0x7'));router[_0xd350('0x8')]('/',auth[_0xd350('0x9')](),controller['index']);router[_0xd350('0x8')](_0xd350('0xa'),auth[_0xd350('0x9')](),controller[_0xd350('0xb')]);router['post']('/',auth[_0xd350('0x9')](),controller[_0xd350('0xc')]);router['put'](_0xd350('0xa'),auth[_0xd350('0x9')](),controller[_0xd350('0xd')]);router['delete']('/:id',auth[_0xd350('0x9')](),controller[_0xd350('0xe')]);module[_0xd350('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 14efb6f..bbfa73e 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 _0x4117=['variable','keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','string'];(function(_0x3b601a,_0x1fcc08){var _0x3b4d2b=function(_0x5e5d8b){while(--_0x5e5d8b){_0x3b601a['push'](_0x3b601a['shift']());}};_0x3b4d2b(++_0x1fcc08);}(_0x4117,0x156));var _0x7411=function(_0x1da3dd,_0x1f428b){_0x1da3dd=_0x1da3dd-0x0;var _0x37ef5e=_0x4117[_0x1da3dd];return _0x37ef5e;};'use strict';var Sequelize=require(_0x7411('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x7411('0x1'),_0x7411('0x2'),'customVariable',_0x7411('0x3'),_0x7411('0x4')),'defaultValue':_0x7411('0x1')},'content':{'type':Sequelize[_0x7411('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x7411('0x1'),'variable',_0x7411('0x6'))},'keyContent':{'type':Sequelize[_0x7411('0x5')]},'idField':{'type':Sequelize[_0x7411('0x5')]},'nameField':{'type':Sequelize[_0x7411('0x5')]},'customField':{'type':Sequelize[_0x7411('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7411('0x5')]}}; \ No newline at end of file +var _0x59ec=['sequelize','exports','ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN'];(function(_0x4261dc,_0x14919c){var _0xc81ca3=function(_0x176f65){while(--_0x176f65){_0x4261dc['push'](_0x4261dc['shift']());}};_0xc81ca3(++_0x14919c);}(_0x59ec,0x19e));var _0xc59e=function(_0x5eb408,_0x376f7e){_0x5eb408=_0x5eb408-0x0;var _0x193299=_0x59ec[_0x5eb408];return _0x193299;};'use strict';var Sequelize=require(_0xc59e('0x0'));module[_0xc59e('0x1')]={'type':{'type':Sequelize[_0xc59e('0x2')](_0xc59e('0x3'),_0xc59e('0x4'),_0xc59e('0x5'),'keyValue',_0xc59e('0x6')),'defaultValue':_0xc59e('0x3')},'content':{'type':Sequelize[_0xc59e('0x7')]},'key':{'type':Sequelize[_0xc59e('0x7')]},'keyType':{'type':Sequelize[_0xc59e('0x2')](_0xc59e('0x3'),_0xc59e('0x4'),_0xc59e('0x5'))},'keyContent':{'type':Sequelize[_0xc59e('0x7')]},'idField':{'type':Sequelize[_0xc59e('0x7')]},'nameField':{'type':Sequelize[_0xc59e('0x7')]},'customField':{'type':Sequelize[_0xc59e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc59e('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index e86d50c..39bae4e 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 _0xf501=['pick','map','VIRTUAL','filter','merge','options','includeAll','include','rows','show','params','catch','create','body','Dynamics365Field','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where'];(function(_0x55477e,_0x286dea){var _0x58b303=function(_0x294bb3){while(--_0x294bb3){_0x55477e['push'](_0x55477e['shift']());}};_0x58b303(++_0x286dea);}(_0xf501,0xf7));var _0x1f50=function(_0xee213e,_0xb33561){_0xee213e=_0xee213e-0x0;var _0x3542f1=_0xf501[_0xee213e];return _0x3542f1;};'use strict';var emlformat=require(_0x1f50('0x0'));var rimraf=require(_0x1f50('0x1'));var zipdir=require(_0x1f50('0x2'));var jsonpatch=require(_0x1f50('0x3'));var rp=require(_0x1f50('0x4'));var moment=require(_0x1f50('0x5'));var BPromise=require(_0x1f50('0x6'));var Mustache=require(_0x1f50('0x7'));var util=require(_0x1f50('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x1f50('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1f50('0xa'));var _=require(_0x1f50('0xb'));var squel=require('squel');var crypto=require(_0x1f50('0xc'));var jsforce=require(_0x1f50('0xd'));var deskjs=require(_0x1f50('0xe'));var toCsv=require(_0x1f50('0x9'));var querystring=require(_0x1f50('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1f50('0x10'));var qs=require(_0x1f50('0x11'));var as=require(_0x1f50('0x12'));var hardwareService=require(_0x1f50('0x13'));var logger=require(_0x1f50('0x14'))(_0x1f50('0x15'));var utils=require(_0x1f50('0x16'));var config=require(_0x1f50('0x17'));var licenseUtil=require(_0x1f50('0x18'));var db=require(_0x1f50('0x19'))['db'];function respondWithStatusCode(_0x51a000,_0x302b71){_0x302b71=_0x302b71||0xcc;return function(_0x21385a){if(_0x21385a){return _0x51a000[_0x1f50('0x1a')](_0x302b71);}return _0x51a000[_0x1f50('0x1b')](_0x302b71)[_0x1f50('0x1c')]();};}function respondWithResult(_0x17aa06,_0x4f04c8){_0x4f04c8=_0x4f04c8||0xc8;return function(_0x59662c){if(_0x59662c){return _0x17aa06[_0x1f50('0x1b')](_0x4f04c8)[_0x1f50('0x1d')](_0x59662c);}};}function respondWithFilteredResult(_0x24b273,_0x4f6c2b){return function(_0x461281){if(_0x461281){var _0x151de8=typeof _0x4f6c2b[_0x1f50('0x1e')]==='undefined'&&typeof _0x4f6c2b[_0x1f50('0x1f')]==='undefined';var _0x1c52b7=_0x461281[_0x1f50('0x20')];var _0x45bf17=_0x151de8?0x0:_0x4f6c2b['offset'];var _0x299b02=_0x151de8?_0x461281['count']:_0x4f6c2b[_0x1f50('0x1e')]+_0x4f6c2b['limit'];var _0x474912;if(_0x299b02>=_0x1c52b7){_0x299b02=_0x1c52b7;_0x474912=0xc8;}else{_0x474912=0xce;}_0x24b273[_0x1f50('0x1b')](_0x474912);return _0x24b273[_0x1f50('0x21')](_0x1f50('0x22'),_0x45bf17+'-'+_0x299b02+'/'+_0x1c52b7)[_0x1f50('0x1d')](_0x461281);}return null;};}function patchUpdates(_0x115e05){return function(_0x599fdd){try{jsonpatch[_0x1f50('0x23')](_0x599fdd,_0x115e05,!![]);}catch(_0x272872){return BPromise[_0x1f50('0x24')](_0x272872);}return _0x599fdd[_0x1f50('0x25')]();};}function saveUpdates(_0x42e2b6,_0x493efb){return function(_0x9fcf4){if(_0x9fcf4){return _0x9fcf4[_0x1f50('0x26')](_0x42e2b6)['then'](function(_0x59220f){return _0x59220f;});}return null;};}function removeEntity(_0x48ff4d,_0x3ac082){return function(_0x36a1db){if(_0x36a1db){return _0x36a1db[_0x1f50('0x27')]()[_0x1f50('0x28')](function(){_0x48ff4d[_0x1f50('0x1b')](0xcc)[_0x1f50('0x1c')]();});}};}function handleEntityNotFound(_0x58e81a,_0x22e119){return function(_0x13d6ab){if(!_0x13d6ab){_0x58e81a['sendStatus'](0x194);}return _0x13d6ab;};}function handleError(_0xda586d,_0x582d67){_0x582d67=_0x582d67||0x1f4;return function(_0x34db34){logger[_0x1f50('0x29')](_0x34db34['stack']);if(_0x34db34[_0x1f50('0x2a')]){delete _0x34db34['name'];}_0xda586d[_0x1f50('0x1b')](_0x582d67)[_0x1f50('0x2b')](_0x34db34);};}exports[_0x1f50('0x2c')]=function(_0x28b4b8,_0x26dc48){var _0x1146fc={},_0x19c9e6={},_0x288d1b={'count':0x0,'rows':[]};var _0x77a212=_['map'](db['Dynamics365Field'][_0x1f50('0x2d')],function(_0x470760){return{'name':_0x470760[_0x1f50('0x2e')],'type':_0x470760[_0x1f50('0x2f')][_0x1f50('0x30')]};});_0x19c9e6[_0x1f50('0x31')]=_['map'](_0x77a212,'name');_0x19c9e6['query']=_[_0x1f50('0x32')](_0x28b4b8[_0x1f50('0x33')]);_0x19c9e6[_0x1f50('0x34')]=_['intersection'](_0x19c9e6[_0x1f50('0x31')],_0x19c9e6['query']);_0x1146fc[_0x1f50('0x35')]=_[_0x1f50('0x36')](_0x19c9e6[_0x1f50('0x31')],qs['fields'](_0x28b4b8[_0x1f50('0x33')][_0x1f50('0x37')]));_0x1146fc[_0x1f50('0x35')]=_0x1146fc[_0x1f50('0x35')][_0x1f50('0x38')]?_0x1146fc[_0x1f50('0x35')]:_0x19c9e6['model'];if(!_0x28b4b8[_0x1f50('0x33')]['hasOwnProperty'](_0x1f50('0x39'))){_0x1146fc[_0x1f50('0x1f')]=qs['limit'](_0x28b4b8[_0x1f50('0x33')][_0x1f50('0x1f')]);_0x1146fc[_0x1f50('0x1e')]=qs['offset'](_0x28b4b8[_0x1f50('0x33')][_0x1f50('0x1e')]);}_0x1146fc[_0x1f50('0x3a')]=qs[_0x1f50('0x3b')](_0x28b4b8[_0x1f50('0x33')]['sort']);_0x1146fc[_0x1f50('0x3c')]=qs[_0x1f50('0x34')](_[_0x1f50('0x3d')](_0x28b4b8['query'],_0x19c9e6[_0x1f50('0x34')]),_0x77a212);if(_0x28b4b8[_0x1f50('0x33')]['filter']){_0x1146fc['where']=_['merge'](_0x1146fc[_0x1f50('0x3c')],{'$or':_[_0x1f50('0x3e')](_0x77a212,function(_0x35833a){if(_0x35833a['type']!==_0x1f50('0x3f')){var _0x1b2e92={};_0x1b2e92[_0x35833a[_0x1f50('0x2a')]]={'$like':'%'+_0x28b4b8[_0x1f50('0x33')][_0x1f50('0x40')]+'%'};return _0x1b2e92;}})});}_0x1146fc=_[_0x1f50('0x41')]({},_0x1146fc,_0x28b4b8[_0x1f50('0x42')]);var _0x5d6a3a={'where':_0x1146fc[_0x1f50('0x3c')]};return db['Dynamics365Field']['count'](_0x5d6a3a)['then'](function(_0x29192d){_0x288d1b['count']=_0x29192d;if(_0x28b4b8['query'][_0x1f50('0x43')]){_0x1146fc[_0x1f50('0x44')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x1146fc);})[_0x1f50('0x28')](function(_0x330470){_0x288d1b[_0x1f50('0x45')]=_0x330470;return _0x288d1b;})['then'](respondWithFilteredResult(_0x26dc48,_0x1146fc))['catch'](handleError(_0x26dc48,null));};exports[_0x1f50('0x46')]=function(_0x25fc19,_0x5af8ec){var _0x53b1ec={'raw':!![],'where':{'id':_0x25fc19[_0x1f50('0x47')]['id']}},_0x1ad9c9={};_0x1ad9c9[_0x1f50('0x31')]=_[_0x1f50('0x32')](db['Dynamics365Field']['rawAttributes']);_0x1ad9c9[_0x1f50('0x33')]=_[_0x1f50('0x32')](_0x25fc19['query']);_0x1ad9c9[_0x1f50('0x34')]=_[_0x1f50('0x36')](_0x1ad9c9[_0x1f50('0x31')],_0x1ad9c9['query']);_0x53b1ec[_0x1f50('0x35')]=_[_0x1f50('0x36')](_0x1ad9c9['model'],qs['fields'](_0x25fc19[_0x1f50('0x33')][_0x1f50('0x37')]));_0x53b1ec[_0x1f50('0x35')]=_0x53b1ec[_0x1f50('0x35')]['length']?_0x53b1ec[_0x1f50('0x35')]:_0x1ad9c9[_0x1f50('0x31')];if(_0x25fc19[_0x1f50('0x33')][_0x1f50('0x43')]){_0x53b1ec['include']=[{'all':!![]}];}_0x53b1ec=_[_0x1f50('0x41')]({},_0x53b1ec,_0x25fc19[_0x1f50('0x42')]);return db['Dynamics365Field']['find'](_0x53b1ec)[_0x1f50('0x28')](handleEntityNotFound(_0x5af8ec,null))[_0x1f50('0x28')](respondWithResult(_0x5af8ec,null))[_0x1f50('0x48')](handleError(_0x5af8ec,null));};exports[_0x1f50('0x49')]=function(_0x1da161,_0x19cc69){return db['Dynamics365Field'][_0x1f50('0x49')](_0x1da161['body'],{})[_0x1f50('0x28')](respondWithResult(_0x19cc69,0xc9))[_0x1f50('0x48')](handleError(_0x19cc69,null));};exports[_0x1f50('0x26')]=function(_0x35c3be,_0x5e39c7){if(_0x35c3be[_0x1f50('0x4a')]['id']){delete _0x35c3be[_0x1f50('0x4a')]['id'];}return db[_0x1f50('0x4b')][_0x1f50('0x4c')]({'where':{'id':_0x35c3be['params']['id']}})[_0x1f50('0x28')](handleEntityNotFound(_0x5e39c7,null))[_0x1f50('0x28')](saveUpdates(_0x35c3be['body'],null))[_0x1f50('0x28')](respondWithResult(_0x5e39c7,null))['catch'](handleError(_0x5e39c7,null));};exports[_0x1f50('0x27')]=function(_0x2f7e73,_0x414ea6){return db[_0x1f50('0x4b')][_0x1f50('0x4c')]({'where':{'id':_0x2f7e73[_0x1f50('0x47')]['id']}})[_0x1f50('0x28')](handleEntityNotFound(_0x414ea6,null))[_0x1f50('0x28')](removeEntity(_0x414ea6,null))['catch'](handleError(_0x414ea6,null));}; \ No newline at end of file +var _0x9648=['end','json','undefined','limit','count','offset','set','apply','reject','update','then','stack','send','index','map','rawAttributes','fieldName','key','name','query','intersection','model','fields','attributes','length','nolimit','sort','where','filters','merge','options','Dynamics365Field','includeAll','findAll','catch','show','params','keys','include','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x3b39a0,_0x277194){var _0xc739e8=function(_0x2dbb3b){while(--_0x2dbb3b){_0x3b39a0['push'](_0x3b39a0['shift']());}};_0xc739e8(++_0x277194);}(_0x9648,0x142));var _0x8964=function(_0x1ca376,_0x53bbf7){_0x1ca376=_0x1ca376-0x0;var _0x4dbe51=_0x9648[_0x1ca376];return _0x4dbe51;};'use strict';var emlformat=require(_0x8964('0x0'));var rimraf=require(_0x8964('0x1'));var zipdir=require(_0x8964('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8964('0x3'));var moment=require(_0x8964('0x4'));var BPromise=require(_0x8964('0x5'));var Mustache=require(_0x8964('0x6'));var util=require(_0x8964('0x7'));var path=require(_0x8964('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8964('0x9'));var fs=require('fs');var fs_extra=require(_0x8964('0xa'));var _=require('lodash');var squel=require(_0x8964('0xb'));var crypto=require(_0x8964('0xc'));var jsforce=require(_0x8964('0xd'));var deskjs=require(_0x8964('0xe'));var toCsv=require(_0x8964('0xf'));var querystring=require(_0x8964('0x10'));var Papa=require('papaparse');var Redis=require(_0x8964('0x11'));var authService=require(_0x8964('0x12'));var qs=require(_0x8964('0x13'));var as=require(_0x8964('0x14'));var hardwareService=require(_0x8964('0x15'));var logger=require('../../config/logger')(_0x8964('0x16'));var utils=require(_0x8964('0x17'));var config=require(_0x8964('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8964('0x19'))['db'];function respondWithStatusCode(_0x25796e,_0x1d452c){_0x1d452c=_0x1d452c||0xcc;return function(_0x5989e3){if(_0x5989e3){return _0x25796e[_0x8964('0x1a')](_0x1d452c);}return _0x25796e[_0x8964('0x1b')](_0x1d452c)[_0x8964('0x1c')]();};}function respondWithResult(_0x823b86,_0x262aaa){_0x262aaa=_0x262aaa||0xc8;return function(_0x2328b3){if(_0x2328b3){return _0x823b86[_0x8964('0x1b')](_0x262aaa)[_0x8964('0x1d')](_0x2328b3);}};}function respondWithFilteredResult(_0x2cb6e7,_0x1d6d9b){return function(_0x2543b0){if(_0x2543b0){var _0x1c63cf=typeof _0x1d6d9b['offset']===_0x8964('0x1e')&&typeof _0x1d6d9b[_0x8964('0x1f')]===_0x8964('0x1e');var _0xd4be10=_0x2543b0[_0x8964('0x20')];var _0x2619f4=_0x1c63cf?0x0:_0x1d6d9b[_0x8964('0x21')];var _0x33d7c9=_0x1c63cf?_0x2543b0[_0x8964('0x20')]:_0x1d6d9b[_0x8964('0x21')]+_0x1d6d9b[_0x8964('0x1f')];var _0x42d463;if(_0x33d7c9>=_0xd4be10){_0x33d7c9=_0xd4be10;_0x42d463=0xc8;}else{_0x42d463=0xce;}_0x2cb6e7[_0x8964('0x1b')](_0x42d463);return _0x2cb6e7[_0x8964('0x22')]('Content-Range',_0x2619f4+'-'+_0x33d7c9+'/'+_0xd4be10)[_0x8964('0x1d')](_0x2543b0);}return null;};}function patchUpdates(_0x47eea7){return function(_0x320d1b){try{jsonpatch[_0x8964('0x23')](_0x320d1b,_0x47eea7,!![]);}catch(_0x503201){return BPromise[_0x8964('0x24')](_0x503201);}return _0x320d1b['save']();};}function saveUpdates(_0x4c359d,_0x45d3fa){return function(_0x31ea66){if(_0x31ea66){return _0x31ea66[_0x8964('0x25')](_0x4c359d)[_0x8964('0x26')](function(_0x485075){return _0x485075;});}return null;};}function removeEntity(_0xea6d8d,_0x4cea70){return function(_0x8cb1f0){if(_0x8cb1f0){return _0x8cb1f0['destroy']()[_0x8964('0x26')](function(){_0xea6d8d[_0x8964('0x1b')](0xcc)[_0x8964('0x1c')]();});}};}function handleEntityNotFound(_0x4e68c8,_0x9d828b){return function(_0xeb81fd){if(!_0xeb81fd){_0x4e68c8[_0x8964('0x1a')](0x194);}return _0xeb81fd;};}function handleError(_0x4fcfd6,_0x226e85){_0x226e85=_0x226e85||0x1f4;return function(_0x5b658f){logger['error'](_0x5b658f[_0x8964('0x27')]);if(_0x5b658f['name']){delete _0x5b658f['name'];}_0x4fcfd6[_0x8964('0x1b')](_0x226e85)[_0x8964('0x28')](_0x5b658f);};}exports[_0x8964('0x29')]=function(_0x40475b,_0x481828){var _0x28cf4f={},_0x2b0fdb={},_0x41009e={'count':0x0,'rows':[]};var _0x57b478=_[_0x8964('0x2a')](db['Dynamics365Field'][_0x8964('0x2b')],function(_0x2dba3e){return{'name':_0x2dba3e[_0x8964('0x2c')],'type':_0x2dba3e['type'][_0x8964('0x2d')]};});_0x2b0fdb['model']=_[_0x8964('0x2a')](_0x57b478,_0x8964('0x2e'));_0x2b0fdb[_0x8964('0x2f')]=_['keys'](_0x40475b['query']);_0x2b0fdb['filters']=_[_0x8964('0x30')](_0x2b0fdb[_0x8964('0x31')],_0x2b0fdb[_0x8964('0x2f')]);_0x28cf4f['attributes']=_['intersection'](_0x2b0fdb[_0x8964('0x31')],qs[_0x8964('0x32')](_0x40475b[_0x8964('0x2f')][_0x8964('0x32')]));_0x28cf4f[_0x8964('0x33')]=_0x28cf4f['attributes'][_0x8964('0x34')]?_0x28cf4f['attributes']:_0x2b0fdb[_0x8964('0x31')];if(!_0x40475b[_0x8964('0x2f')]['hasOwnProperty'](_0x8964('0x35'))){_0x28cf4f[_0x8964('0x1f')]=qs[_0x8964('0x1f')](_0x40475b[_0x8964('0x2f')][_0x8964('0x1f')]);_0x28cf4f[_0x8964('0x21')]=qs[_0x8964('0x21')](_0x40475b['query'][_0x8964('0x21')]);}_0x28cf4f['order']=qs[_0x8964('0x36')](_0x40475b['query'][_0x8964('0x36')]);_0x28cf4f[_0x8964('0x37')]=qs[_0x8964('0x38')](_['pick'](_0x40475b[_0x8964('0x2f')],_0x2b0fdb[_0x8964('0x38')]),_0x57b478);if(_0x40475b[_0x8964('0x2f')]['filter']){_0x28cf4f[_0x8964('0x37')]=_[_0x8964('0x39')](_0x28cf4f['where'],{'$or':_['map'](_0x57b478,function(_0x3efb61){if(_0x3efb61['type']!=='VIRTUAL'){var _0x547557={};_0x547557[_0x3efb61[_0x8964('0x2e')]]={'$like':'%'+_0x40475b['query']['filter']+'%'};return _0x547557;}})});}_0x28cf4f=_[_0x8964('0x39')]({},_0x28cf4f,_0x40475b[_0x8964('0x3a')]);var _0x42f250={'where':_0x28cf4f[_0x8964('0x37')]};return db[_0x8964('0x3b')][_0x8964('0x20')](_0x42f250)[_0x8964('0x26')](function(_0x2ff5fd){_0x41009e[_0x8964('0x20')]=_0x2ff5fd;if(_0x40475b[_0x8964('0x2f')][_0x8964('0x3c')]){_0x28cf4f['include']=[{'all':!![]}];}return db[_0x8964('0x3b')][_0x8964('0x3d')](_0x28cf4f);})[_0x8964('0x26')](function(_0x509ad5){_0x41009e['rows']=_0x509ad5;return _0x41009e;})['then'](respondWithFilteredResult(_0x481828,_0x28cf4f))[_0x8964('0x3e')](handleError(_0x481828,null));};exports[_0x8964('0x3f')]=function(_0xb9bc08,_0x20f4be){var _0x133bef={'raw':!![],'where':{'id':_0xb9bc08[_0x8964('0x40')]['id']}},_0x196f8b={};_0x196f8b[_0x8964('0x31')]=_[_0x8964('0x41')](db[_0x8964('0x3b')][_0x8964('0x2b')]);_0x196f8b['query']=_[_0x8964('0x41')](_0xb9bc08[_0x8964('0x2f')]);_0x196f8b[_0x8964('0x38')]=_['intersection'](_0x196f8b[_0x8964('0x31')],_0x196f8b[_0x8964('0x2f')]);_0x133bef[_0x8964('0x33')]=_['intersection'](_0x196f8b[_0x8964('0x31')],qs[_0x8964('0x32')](_0xb9bc08[_0x8964('0x2f')][_0x8964('0x32')]));_0x133bef[_0x8964('0x33')]=_0x133bef['attributes']['length']?_0x133bef[_0x8964('0x33')]:_0x196f8b[_0x8964('0x31')];if(_0xb9bc08[_0x8964('0x2f')][_0x8964('0x3c')]){_0x133bef[_0x8964('0x42')]=[{'all':!![]}];}_0x133bef=_['merge']({},_0x133bef,_0xb9bc08[_0x8964('0x3a')]);return db[_0x8964('0x3b')][_0x8964('0x43')](_0x133bef)[_0x8964('0x26')](handleEntityNotFound(_0x20f4be,null))[_0x8964('0x26')](respondWithResult(_0x20f4be,null))[_0x8964('0x3e')](handleError(_0x20f4be,null));};exports[_0x8964('0x44')]=function(_0xe7c997,_0x1277fa){return db[_0x8964('0x3b')][_0x8964('0x44')](_0xe7c997['body'],{})[_0x8964('0x26')](respondWithResult(_0x1277fa,0xc9))[_0x8964('0x3e')](handleError(_0x1277fa,null));};exports[_0x8964('0x25')]=function(_0x2c57b0,_0x15434b){if(_0x2c57b0[_0x8964('0x45')]['id']){delete _0x2c57b0[_0x8964('0x45')]['id'];}return db[_0x8964('0x3b')][_0x8964('0x43')]({'where':{'id':_0x2c57b0['params']['id']}})[_0x8964('0x26')](handleEntityNotFound(_0x15434b,null))[_0x8964('0x26')](saveUpdates(_0x2c57b0[_0x8964('0x45')],null))[_0x8964('0x26')](respondWithResult(_0x15434b,null))[_0x8964('0x3e')](handleError(_0x15434b,null));};exports['destroy']=function(_0x39a254,_0x9e03a9){return db[_0x8964('0x3b')][_0x8964('0x43')]({'where':{'id':_0x39a254[_0x8964('0x40')]['id']}})[_0x8964('0x26')](handleEntityNotFound(_0x9e03a9,null))[_0x8964('0x26')](removeEntity(_0x9e03a9,null))[_0x8964('0x3e')](handleError(_0x9e03a9,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 2317e61..759d83e 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 _0x6c42=['request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','define','Dynamics365Field','dynamics365_unique_index','idField','FieldId','../../config/logger','api','moment'];(function(_0x2dc2df,_0x5e8375){var _0x33d604=function(_0x411332){while(--_0x411332){_0x2dc2df['push'](_0x2dc2df['shift']());}};_0x33d604(++_0x5e8375);}(_0x6c42,0x135));var _0x26c4=function(_0x3e8270,_0x293590){_0x3e8270=_0x3e8270-0x0;var _0x1ccde9=_0x6c42[_0x3e8270];return _0x1ccde9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x26c4('0x0'))(_0x26c4('0x1'));var moment=require(_0x26c4('0x2'));var BPromise=require('bluebird');var rp=require(_0x26c4('0x3'));var fs=require('fs');var path=require(_0x26c4('0x4'));var rimraf=require(_0x26c4('0x5'));var config=require(_0x26c4('0x6'));var attributes=require(_0x26c4('0x7'));module['exports']=function(_0xaa1cbb,_0x1e5361){return _0xaa1cbb[_0x26c4('0x8')](_0x26c4('0x9'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x26c4('0xa'),'fields':[_0x26c4('0xb'),_0x26c4('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa520=['int_dynamics365_fields','idField','FieldId','../../config/logger','api','bluebird','request-promise','path','rimraf','./intDynamics365Field.attributes','define','Dynamics365Field'];(function(_0x1b860b,_0x3f1a88){var _0x36fe97=function(_0x44b17f){while(--_0x44b17f){_0x1b860b['push'](_0x1b860b['shift']());}};_0x36fe97(++_0x3f1a88);}(_0xa520,0x117));var _0x0a52=function(_0x473473,_0x127961){_0x473473=_0x473473-0x0;var _0x2dd1a0=_0xa520[_0x473473];return _0x2dd1a0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0a52('0x0'))(_0x0a52('0x1'));var moment=require('moment');var BPromise=require(_0x0a52('0x2'));var rp=require(_0x0a52('0x3'));var fs=require('fs');var path=require(_0x0a52('0x4'));var rimraf=require(_0x0a52('0x5'));var config=require('../../config/environment');var attributes=require(_0x0a52('0x6'));module['exports']=function(_0x918327,_0x4b0882){return _0x918327[_0x0a52('0x7')](_0x0a52('0x8'),attributes,{'tableName':_0x0a52('0x9'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x0a52('0xa'),_0x0a52('0xb')],'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 7d02f6c..4130bf9 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 _0x6d9b=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x6d9b,0x79));var _0xb6d9=function(_0x5c3550,_0x3a7055){_0x5c3550=_0x5c3550-0x0;var _0x5e487c=_0x6d9b[_0x5c3550];return _0x5e487c;};'use strict';var _=require('lodash');var util=require(_0xb6d9('0x0'));var moment=require(_0xb6d9('0x1'));var BPromise=require(_0xb6d9('0x2'));var rs=require(_0xb6d9('0x3'));var fs=require('fs');var Redis=require(_0xb6d9('0x4'));var db=require(_0xb6d9('0x5'))['db'];var utils=require(_0xb6d9('0x6'));var logger=require('../../config/logger')(_0xb6d9('0x7'));var config=require(_0xb6d9('0x8'));var jayson=require(_0xb6d9('0x9'));var client=jayson['client'][_0xb6d9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31e1b9,_0x5f0aa0,_0x35a3e9){return new BPromise(function(_0x2733c1,_0x3c7579){return client[_0xb6d9('0xb')](_0x31e1b9,_0x35a3e9)[_0xb6d9('0xc')](function(_0x594843){logger[_0xb6d9('0xd')](_0xb6d9('0xe'),_0x5f0aa0,'request\x20sent');logger[_0xb6d9('0xf')](_0xb6d9('0x10'),_0x5f0aa0,_0xb6d9('0x11'),JSON[_0xb6d9('0x12')](_0x594843));if(_0x594843[_0xb6d9('0x13')]){if(_0x594843['error'][_0xb6d9('0x14')]===0x1f4){logger[_0xb6d9('0x13')](_0xb6d9('0xe'),_0x5f0aa0,_0x594843[_0xb6d9('0x13')][_0xb6d9('0x15')]);return _0x3c7579(_0x594843[_0xb6d9('0x13')][_0xb6d9('0x15')]);}logger[_0xb6d9('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x5f0aa0,_0x594843[_0xb6d9('0x13')][_0xb6d9('0x15')]);return _0x2733c1(_0x594843[_0xb6d9('0x13')][_0xb6d9('0x15')]);}else{logger[_0xb6d9('0xd')](_0xb6d9('0xe'),_0x5f0aa0,'request\x20sent');_0x2733c1(_0x594843[_0xb6d9('0x16')][_0xb6d9('0x15')]);}})[_0xb6d9('0x17')](function(_0x829ffa){logger[_0xb6d9('0x13')](_0xb6d9('0xe'),_0x5f0aa0,_0x829ffa);_0x3c7579(_0x829ffa);});});} \ No newline at end of file +var _0x642b=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0x279ce8,_0xf46108){var _0x3bd98f=function(_0x9875f3){while(--_0x9875f3){_0x279ce8['push'](_0x279ce8['shift']());}};_0x3bd98f(++_0xf46108);}(_0x642b,0x85));var _0xb642=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x642b[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0xb642('0x0'));var util=require(_0xb642('0x1'));var moment=require(_0xb642('0x2'));var BPromise=require(_0xb642('0x3'));var rs=require(_0xb642('0x4'));var fs=require('fs');var Redis=require(_0xb642('0x5'));var db=require(_0xb642('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb642('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb642('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x68a7fa,_0x41aea3,_0x1c50ba){return new BPromise(function(_0x3c7e89,_0x2ebc02){return client[_0xb642('0x9')](_0x68a7fa,_0x1c50ba)[_0xb642('0xa')](function(_0x48546f){logger[_0xb642('0xb')](_0xb642('0xc'),_0x41aea3,_0xb642('0xd'));logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x41aea3,_0xb642('0xd'),JSON[_0xb642('0xe')](_0x48546f));if(_0x48546f[_0xb642('0xf')]){if(_0x48546f['error'][_0xb642('0x10')]===0x1f4){logger['error'](_0xb642('0xc'),_0x41aea3,_0x48546f['error']['message']);return _0x2ebc02(_0x48546f[_0xb642('0xf')][_0xb642('0x11')]);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x41aea3,_0x48546f[_0xb642('0xf')][_0xb642('0x11')]);return _0x3c7e89(_0x48546f[_0xb642('0xf')]['message']);}else{logger[_0xb642('0xb')](_0xb642('0xc'),_0x41aea3,_0xb642('0xd'));_0x3c7e89(_0x48546f['result'][_0xb642('0x11')]);}})[_0xb642('0x12')](function(_0x370e82){logger[_0xb642('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x41aea3,_0x370e82);_0x2ebc02(_0x370e82);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index b7e674c..e2bcbcb 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 _0x1074=['get','/:id/configurations','isAuthenticated','getConfigurations','getFields','create','addConfiguration','put','/:id','update','delete','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1074,0x1c3));var _0x4107=function(_0x27bd2c,_0x24bd98){_0x27bd2c=_0x27bd2c-0x0;var _0x3784ea=_0x1074[_0x27bd2c];return _0x3784ea;};'use strict';var multer=require(_0x4107('0x0'));var util=require(_0x4107('0x1'));var path=require(_0x4107('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4107('0x3')]();var fs_extra=require(_0x4107('0x4'));var auth=require(_0x4107('0x5'));var interaction=require(_0x4107('0x6'));var config=require('../../config/environment');var controller=require(_0x4107('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x4107('0x8')]);router[_0x4107('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x4107('0xa'),auth[_0x4107('0xb')](),controller[_0x4107('0xc')]);router[_0x4107('0x9')]('/:id/fields',auth[_0x4107('0xb')](),controller[_0x4107('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4107('0xe')]);router['post']('/:id/configurations',auth[_0x4107('0xb')](),controller[_0x4107('0xf')]);router[_0x4107('0x10')](_0x4107('0x11'),auth[_0x4107('0xb')](),controller[_0x4107('0x12')]);router[_0x4107('0x13')]('/:id',auth[_0x4107('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd6be=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','put','update','delete','exports','util','path','connect-timeout'];(function(_0x5b49b5,_0xe5b574){var _0x2c87d1=function(_0x3253a6){while(--_0x3253a6){_0x5b49b5['push'](_0x5b49b5['shift']());}};_0x2c87d1(++_0xe5b574);}(_0xd6be,0x8d));var _0xed6b=function(_0x514eb5,_0x532d5e){_0x514eb5=_0x514eb5-0x0;var _0x54d9fb=_0xd6be[_0x514eb5];return _0x54d9fb;};'use strict';var multer=require('multer');var util=require(_0xed6b('0x0'));var path=require(_0xed6b('0x1'));var timeout=require(_0xed6b('0x2'));var express=require(_0xed6b('0x3'));var router=express[_0xed6b('0x4')]();var fs_extra=require(_0xed6b('0x5'));var auth=require(_0xed6b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xed6b('0x7'));var controller=require(_0xed6b('0x8'));router[_0xed6b('0x9')]('/',auth['isAuthenticated'](),controller[_0xed6b('0xa')]);router[_0xed6b('0x9')](_0xed6b('0xb'),auth[_0xed6b('0xc')](),controller[_0xed6b('0xd')]);router[_0xed6b('0x9')](_0xed6b('0xe'),auth['isAuthenticated'](),controller[_0xed6b('0xf')]);router[_0xed6b('0x9')]('/:id/fields',auth[_0xed6b('0xc')](),controller[_0xed6b('0x10')]);router['post']('/',auth[_0xed6b('0xc')](),controller[_0xed6b('0x11')]);router[_0xed6b('0x12')]('/:id/configurations',auth[_0xed6b('0xc')](),controller[_0xed6b('0x13')]);router[_0xed6b('0x14')](_0xed6b('0xb'),auth[_0xed6b('0xc')](),controller[_0xed6b('0x15')]);router[_0xed6b('0x16')]('/:id',auth[_0xed6b('0xc')](),controller['destroy']);module[_0xed6b('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 1bb9f85..7337cfc 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 _0xb78e=['username','remoteUri','sequelize','exports','STRING'];(function(_0x46bec2,_0x36cde0){var _0x39b857=function(_0xf29a34){while(--_0xf29a34){_0x46bec2['push'](_0x46bec2['shift']());}};_0x39b857(++_0x36cde0);}(_0xb78e,0x1c9));var _0xeb78=function(_0x57e20b,_0x530136){_0x57e20b=_0x57e20b-0x0;var _0x3f1180=_0xb78e[_0x57e20b];return _0x3f1180;};'use strict';var Sequelize=require(_0xeb78('0x0'));module[_0xeb78('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xeb78('0x2')]},'username':{'type':Sequelize[_0xeb78('0x2')],'unique':_0xeb78('0x3')},'apiKey':{'type':Sequelize[_0xeb78('0x2')]},'remoteUri':{'type':Sequelize[_0xeb78('0x2')],'unique':_0xeb78('0x4')},'serverUrl':{'type':Sequelize[_0xeb78('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x065e=['sequelize','STRING','username'];(function(_0x2a558d,_0x2df0ff){var _0xa7bc9c=function(_0x12a30e){while(--_0x12a30e){_0x2a558d['push'](_0x2a558d['shift']());}};_0xa7bc9c(++_0x2df0ff);}(_0x065e,0x1a7));var _0xe065=function(_0x15dda2,_0x103eeb){_0x15dda2=_0x15dda2-0x0;var _0x6f6d1c=_0x065e[_0x15dda2];return _0x6f6d1c;};'use strict';var Sequelize=require(_0xe065('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe065('0x1')],'unique':_0xe065('0x2')},'apiKey':{'type':Sequelize[_0xe065('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xe065('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 83f4468..5023ff1 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 _0x9efc=['reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','FreshdeskAccount','includeAll','findAll','rows','catch','find','create','body','params','findOne','FreshdeskConfiguration','pick','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','type','Descriptions','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','api/v2/ticket_fields','%s:X','toString','base64','requester','subject','agent','priority','group','ticket_type','company','includes','default','custom_text','custom_dropdown','choices','capitalize','test','statusCode','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../components/integrations/configuration','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply'];(function(_0x39e1f0,_0x207762){var _0x45569f=function(_0x431947){while(--_0x431947){_0x39e1f0['push'](_0x39e1f0['shift']());}};_0x45569f(++_0x207762);}(_0x9efc,0x19c));var _0xc9ef=function(_0x1defb2,_0x429099){_0x1defb2=_0x1defb2-0x0;var _0xad8973=_0x9efc[_0x1defb2];return _0xad8973;};'use strict';var emlformat=require(_0xc9ef('0x0'));var rimraf=require(_0xc9ef('0x1'));var zipdir=require(_0xc9ef('0x2'));var jsonpatch=require(_0xc9ef('0x3'));var rp=require(_0xc9ef('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc9ef('0x5'));var util=require('util');var path=require(_0xc9ef('0x6'));var sox=require('sox');var csv=require(_0xc9ef('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc9ef('0x8'));var _=require(_0xc9ef('0x9'));var squel=require(_0xc9ef('0xa'));var crypto=require(_0xc9ef('0xb'));var jsforce=require(_0xc9ef('0xc'));var deskjs=require(_0xc9ef('0xd'));var toCsv=require(_0xc9ef('0x7'));var querystring=require(_0xc9ef('0xe'));var Papa=require(_0xc9ef('0xf'));var Redis=require(_0xc9ef('0x10'));var authService=require(_0xc9ef('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc9ef('0x12'));var logger=require('../../config/logger')(_0xc9ef('0x13'));var utils=require('../../config/utils');var config=require(_0xc9ef('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xc9ef('0x15'));function respondWithStatusCode(_0x35fb8b,_0x2ce47b){_0x2ce47b=_0x2ce47b||0xcc;return function(_0xc08ffd){if(_0xc08ffd){return _0x35fb8b[_0xc9ef('0x16')](_0x2ce47b);}return _0x35fb8b[_0xc9ef('0x17')](_0x2ce47b)[_0xc9ef('0x18')]();};}function respondWithResult(_0x19f4ab,_0x106a92){_0x106a92=_0x106a92||0xc8;return function(_0x437385){if(_0x437385){return _0x19f4ab[_0xc9ef('0x17')](_0x106a92)['json'](_0x437385);}};}function respondWithFilteredResult(_0x1665e8,_0x181c2b){return function(_0xc63528){if(_0xc63528){var _0x215be8=typeof _0x181c2b[_0xc9ef('0x19')]==='undefined'&&typeof _0x181c2b[_0xc9ef('0x1a')]===_0xc9ef('0x1b');var _0x1a56bd=_0xc63528[_0xc9ef('0x1c')];var _0x292e06=_0x215be8?0x0:_0x181c2b[_0xc9ef('0x19')];var _0x1a2519=_0x215be8?_0xc63528[_0xc9ef('0x1c')]:_0x181c2b[_0xc9ef('0x19')]+_0x181c2b[_0xc9ef('0x1a')];var _0x2fc01a;if(_0x1a2519>=_0x1a56bd){_0x1a2519=_0x1a56bd;_0x2fc01a=0xc8;}else{_0x2fc01a=0xce;}_0x1665e8[_0xc9ef('0x17')](_0x2fc01a);return _0x1665e8[_0xc9ef('0x1d')](_0xc9ef('0x1e'),_0x292e06+'-'+_0x1a2519+'/'+_0x1a56bd)['json'](_0xc63528);}return null;};}function patchUpdates(_0x13f7d6){return function(_0x3d1f5e){try{jsonpatch[_0xc9ef('0x1f')](_0x3d1f5e,_0x13f7d6,!![]);}catch(_0x5f20d4){return BPromise[_0xc9ef('0x20')](_0x5f20d4);}return _0x3d1f5e[_0xc9ef('0x21')]();};}function saveUpdates(_0x1ffff8,_0x2bc10b){return function(_0x5c5212){if(_0x5c5212){return _0x5c5212[_0xc9ef('0x22')](_0x1ffff8)[_0xc9ef('0x23')](function(_0x486dc1){return _0x486dc1;});}return null;};}function removeEntity(_0x3357e3,_0xcd720a){return function(_0x51b8dd){if(_0x51b8dd){return _0x51b8dd[_0xc9ef('0x24')]()[_0xc9ef('0x23')](function(){_0x3357e3[_0xc9ef('0x17')](0xcc)[_0xc9ef('0x18')]();});}};}function handleEntityNotFound(_0x55cdab,_0x1c6422){return function(_0x3b425f){if(!_0x3b425f){_0x55cdab[_0xc9ef('0x16')](0x194);}return _0x3b425f;};}function handleError(_0xec1e62,_0x53bf57){_0x53bf57=_0x53bf57||0x1f4;return function(_0x4b070d){logger[_0xc9ef('0x25')](_0x4b070d[_0xc9ef('0x26')]);if(_0x4b070d[_0xc9ef('0x27')]){delete _0x4b070d['name'];}_0xec1e62[_0xc9ef('0x17')](_0x53bf57)[_0xc9ef('0x28')](_0x4b070d);};}exports[_0xc9ef('0x29')]=function(_0x4042fc,_0x147812){var _0x58f88d={},_0x56dca7={},_0x458546={'count':0x0,'rows':[]};var _0x19d5f1=_['map'](db['FreshdeskAccount'][_0xc9ef('0x2a')],function(_0x4ec594){return{'name':_0x4ec594[_0xc9ef('0x2b')],'type':_0x4ec594['type'][_0xc9ef('0x2c')]};});_0x56dca7[_0xc9ef('0x2d')]=_[_0xc9ef('0x2e')](_0x19d5f1,_0xc9ef('0x27'));_0x56dca7[_0xc9ef('0x2f')]=_[_0xc9ef('0x30')](_0x4042fc['query']);_0x56dca7[_0xc9ef('0x31')]=_[_0xc9ef('0x32')](_0x56dca7['model'],_0x56dca7[_0xc9ef('0x2f')]);_0x58f88d[_0xc9ef('0x33')]=_[_0xc9ef('0x32')](_0x56dca7[_0xc9ef('0x2d')],qs[_0xc9ef('0x34')](_0x4042fc['query'][_0xc9ef('0x34')]));_0x58f88d[_0xc9ef('0x33')]=_0x58f88d[_0xc9ef('0x33')][_0xc9ef('0x35')]?_0x58f88d[_0xc9ef('0x33')]:_0x56dca7['model'];if(!_0x4042fc['query'][_0xc9ef('0x36')](_0xc9ef('0x37'))){_0x58f88d[_0xc9ef('0x1a')]=qs['limit'](_0x4042fc['query'][_0xc9ef('0x1a')]);_0x58f88d[_0xc9ef('0x19')]=qs['offset'](_0x4042fc['query'][_0xc9ef('0x19')]);}_0x58f88d[_0xc9ef('0x38')]=qs[_0xc9ef('0x39')](_0x4042fc['query'][_0xc9ef('0x39')]);_0x58f88d[_0xc9ef('0x3a')]=qs[_0xc9ef('0x31')](_['pick'](_0x4042fc[_0xc9ef('0x2f')],_0x56dca7[_0xc9ef('0x31')]),_0x19d5f1);if(_0x4042fc[_0xc9ef('0x2f')]['filter']){_0x58f88d['where']=_[_0xc9ef('0x3b')](_0x58f88d[_0xc9ef('0x3a')],{'$or':_['map'](_0x19d5f1,function(_0x972833){if(_0x972833['type']!==_0xc9ef('0x3c')){var _0x39c564={};_0x39c564[_0x972833[_0xc9ef('0x27')]]={'$like':'%'+_0x4042fc['query'][_0xc9ef('0x3d')]+'%'};return _0x39c564;}})});}_0x58f88d=_[_0xc9ef('0x3b')]({},_0x58f88d,_0x4042fc[_0xc9ef('0x3e')]);var _0x115422={'where':_0x58f88d[_0xc9ef('0x3a')]};return db[_0xc9ef('0x3f')][_0xc9ef('0x1c')](_0x115422)[_0xc9ef('0x23')](function(_0x33678d){_0x458546['count']=_0x33678d;if(_0x4042fc[_0xc9ef('0x2f')][_0xc9ef('0x40')]){_0x58f88d['include']=[{'all':!![]}];}return db[_0xc9ef('0x3f')][_0xc9ef('0x41')](_0x58f88d);})[_0xc9ef('0x23')](function(_0x179a8f){_0x458546[_0xc9ef('0x42')]=_0x179a8f;return _0x458546;})[_0xc9ef('0x23')](respondWithFilteredResult(_0x147812,_0x58f88d))[_0xc9ef('0x43')](handleError(_0x147812,null));};exports['show']=function(_0x397b33,_0x4900c8){var _0x42e7c0={'raw':![],'where':{'id':_0x397b33['params']['id']}},_0x5f2b8c={};_0x5f2b8c[_0xc9ef('0x2d')]=_[_0xc9ef('0x30')](db[_0xc9ef('0x3f')][_0xc9ef('0x2a')]);_0x5f2b8c[_0xc9ef('0x2f')]=_[_0xc9ef('0x30')](_0x397b33[_0xc9ef('0x2f')]);_0x5f2b8c[_0xc9ef('0x31')]=_['intersection'](_0x5f2b8c[_0xc9ef('0x2d')],_0x5f2b8c['query']);_0x42e7c0[_0xc9ef('0x33')]=_[_0xc9ef('0x32')](_0x5f2b8c[_0xc9ef('0x2d')],qs[_0xc9ef('0x34')](_0x397b33['query'][_0xc9ef('0x34')]));_0x42e7c0[_0xc9ef('0x33')]=_0x42e7c0[_0xc9ef('0x33')][_0xc9ef('0x35')]?_0x42e7c0['attributes']:_0x5f2b8c[_0xc9ef('0x2d')];if(_0x397b33[_0xc9ef('0x2f')][_0xc9ef('0x40')]){_0x42e7c0['include']=[{'all':!![]}];}_0x42e7c0=_['merge']({},_0x42e7c0,_0x397b33[_0xc9ef('0x3e')]);return db[_0xc9ef('0x3f')][_0xc9ef('0x44')](_0x42e7c0)['then'](handleEntityNotFound(_0x4900c8,null))[_0xc9ef('0x23')](respondWithResult(_0x4900c8,null))['catch'](handleError(_0x4900c8,null));};exports[_0xc9ef('0x45')]=function(_0x262300,_0x28545a){return db[_0xc9ef('0x3f')][_0xc9ef('0x45')](_0x262300['body'],{})[_0xc9ef('0x23')](respondWithResult(_0x28545a,0xc9))['catch'](handleError(_0x28545a,null));};exports[_0xc9ef('0x22')]=function(_0x25f67a,_0x3c635b){if(_0x25f67a[_0xc9ef('0x46')]['id']){delete _0x25f67a[_0xc9ef('0x46')]['id'];}return db[_0xc9ef('0x3f')][_0xc9ef('0x44')]({'where':{'id':_0x25f67a[_0xc9ef('0x47')]['id']}})[_0xc9ef('0x23')](handleEntityNotFound(_0x3c635b,null))[_0xc9ef('0x23')](saveUpdates(_0x25f67a[_0xc9ef('0x46')],null))[_0xc9ef('0x23')](respondWithResult(_0x3c635b,null))[_0xc9ef('0x43')](handleError(_0x3c635b,null));};exports[_0xc9ef('0x24')]=function(_0x849a3e,_0x46d3b3){return db[_0xc9ef('0x3f')][_0xc9ef('0x44')]({'where':{'id':_0x849a3e[_0xc9ef('0x47')]['id']}})[_0xc9ef('0x23')](handleEntityNotFound(_0x46d3b3,null))[_0xc9ef('0x23')](removeEntity(_0x46d3b3,null))['catch'](handleError(_0x46d3b3,null));};exports['getConfigurations']=function(_0x66a935,_0x5da3ee,_0x1ee0cf){var _0x5dd437={};var _0x211229={};var _0x303a44;var _0x180280;return db[_0xc9ef('0x3f')][_0xc9ef('0x48')]({'where':{'id':_0x66a935[_0xc9ef('0x47')]['id']}})[_0xc9ef('0x23')](handleEntityNotFound(_0x5da3ee,null))[_0xc9ef('0x23')](function(_0xb47df){if(_0xb47df){_0x303a44=_0xb47df;_0x211229[_0xc9ef('0x2d')]=_[_0xc9ef('0x30')](db[_0xc9ef('0x49')][_0xc9ef('0x2a')]);_0x211229[_0xc9ef('0x2f')]=_['keys'](_0x66a935['query']);_0x211229['filters']=_[_0xc9ef('0x32')](_0x211229['model'],_0x211229['query']);_0x5dd437[_0xc9ef('0x33')]=_[_0xc9ef('0x32')](_0x211229['model'],qs[_0xc9ef('0x34')](_0x66a935[_0xc9ef('0x2f')]['fields']));_0x5dd437[_0xc9ef('0x33')]=_0x5dd437[_0xc9ef('0x33')][_0xc9ef('0x35')]?_0x5dd437[_0xc9ef('0x33')]:_0x211229[_0xc9ef('0x2d')];_0x5dd437[_0xc9ef('0x38')]=qs[_0xc9ef('0x39')](_0x66a935[_0xc9ef('0x2f')][_0xc9ef('0x39')]);_0x5dd437[_0xc9ef('0x3a')]=qs[_0xc9ef('0x31')](_[_0xc9ef('0x4a')](_0x66a935[_0xc9ef('0x2f')],_0x211229[_0xc9ef('0x31')]));if(_0x66a935[_0xc9ef('0x2f')]['filter']){_0x5dd437[_0xc9ef('0x3a')]=_[_0xc9ef('0x3b')](_0x5dd437[_0xc9ef('0x3a')],{'$or':_[_0xc9ef('0x2e')](_0x5dd437['attributes'],function(_0x1b9971){var _0x43b4c1={};_0x43b4c1[_0x1b9971]={'$like':'%'+_0x66a935[_0xc9ef('0x2f')][_0xc9ef('0x3d')]+'%'};return _0x43b4c1;})});}_0x5dd437=_[_0xc9ef('0x3b')]({},_0x5dd437,_0x66a935['options']);return _0x303a44['getConfigurations'](_0x5dd437);}})[_0xc9ef('0x23')](function(_0x9097f6){if(_0x9097f6){_0x180280=_0x9097f6[_0xc9ef('0x35')];if(!_0x66a935[_0xc9ef('0x2f')][_0xc9ef('0x36')](_0xc9ef('0x37'))){_0x5dd437['limit']=qs[_0xc9ef('0x1a')](_0x66a935['query'][_0xc9ef('0x1a')]);_0x5dd437['offset']=qs[_0xc9ef('0x19')](_0x66a935[_0xc9ef('0x2f')][_0xc9ef('0x19')]);}return _0x303a44[_0xc9ef('0x4b')](_0x5dd437);}})['then'](function(_0x83601b){if(_0x83601b){return _0x83601b?{'count':_0x180280,'rows':_0x83601b}:null;}})[_0xc9ef('0x23')](respondWithResult(_0x5da3ee,null))[_0xc9ef('0x43')](handleError(_0x5da3ee,null));};exports[_0xc9ef('0x4c')]=function(_0x448177,_0x437930,_0x17c757){if(_0x448177['body']['id']){delete _0x448177[_0xc9ef('0x46')]['id'];}return db[_0xc9ef('0x3f')][_0xc9ef('0x48')]({'where':{'id':_0x448177[_0xc9ef('0x47')]['id']}})['then'](handleEntityNotFound(_0x437930,null))[_0xc9ef('0x23')](function(_0x7f67a){if(_0x7f67a){_0x448177[_0xc9ef('0x46')][_0xc9ef('0x4d')]=_0x7f67a['id'];_0x448177['body'][_0xc9ef('0x4e')]=integrations[_0xc9ef('0x4f')](_0x448177['body'][_0xc9ef('0x50')],_0x448177[_0xc9ef('0x46')]['type']);_0x448177[_0xc9ef('0x46')]['Descriptions']=integrations[_0xc9ef('0x51')](_0x448177[_0xc9ef('0x46')]['channel'],_0x448177['body'][_0xc9ef('0x52')]);return db[_0xc9ef('0x49')][_0xc9ef('0x45')](_0x448177[_0xc9ef('0x46')],{'include':[{'model':db['FreshdeskField'],'as':_0xc9ef('0x4e')},{'model':db['FreshdeskField'],'as':_0xc9ef('0x53')}]});}return null;})[_0xc9ef('0x23')](respondWithResult(_0x437930,null))[_0xc9ef('0x43')](handleError(_0x437930,null));};exports['getFields']=function(_0x525555,_0x14d108,_0x338df8){var _0x5859a2='';return db['FreshdeskAccount'][_0xc9ef('0x48')]({'where':{'id':_0x525555['params']['id']},'attributes':['id',_0xc9ef('0x54'),_0xc9ef('0x55')]})['then'](handleEntityNotFound(_0x14d108,null))[_0xc9ef('0x23')](function(_0x52269e){if(_0x52269e){_0x5859a2=_0x52269e[_0xc9ef('0x54')];var _0x5971f8=_0x5859a2[_0xc9ef('0x56')](-0x1);if(_0x5971f8==='/'){_0x5859a2=_0x5859a2[_0xc9ef('0x57')](0x0,_0x5859a2[_0xc9ef('0x58')](_0x5971f8));}return rp({'method':_0xc9ef('0x59'),'uri':util[_0xc9ef('0x5a')]('%s/%s',_0x5859a2,_0xc9ef('0x5b')),'headers':{'Authorization':util[_0xc9ef('0x5a')]('Basic\x20%s',new Buffer(util[_0xc9ef('0x5a')](_0xc9ef('0x5c'),_0x52269e[_0xc9ef('0x55')]))[_0xc9ef('0x5d')](_0xc9ef('0x5e')))},'json':!![]});}})[_0xc9ef('0x23')](function(_0x90d6bc){if(_0x90d6bc){var _0x11dc8b=[_0xc9ef('0x5f'),_0xc9ef('0x60'),_0xc9ef('0x61'),'description',_0xc9ef('0x17'),_0xc9ef('0x62'),_0xc9ef('0x63'),'source',_0xc9ef('0x64'),_0xc9ef('0x63'),_0xc9ef('0x65')];_['remove'](_0x90d6bc,function(_0x2ca308){return _0x11dc8b[_0xc9ef('0x66')](_0x2ca308[_0xc9ef('0x27')])||!_0x2ca308[_0xc9ef('0x67')]&&_0x2ca308[_0xc9ef('0x52')]!==_0xc9ef('0x68')&&_0x2ca308[_0xc9ef('0x52')]!==_0xc9ef('0x69');});return{'count':_0x90d6bc[_0xc9ef('0x35')],'rows':_['map'](_0x90d6bc,function(_0x151eac){return{'id':_0x151eac[_0xc9ef('0x27')],'name':_0x151eac['label'],'custom':!_0x151eac[_0xc9ef('0x67')],'options':_0x151eac['choices']?_[_0xc9ef('0x2e')](_0x151eac[_0xc9ef('0x6a')],function(_0x1742e3){return{'name':_[_0xc9ef('0x6b')](_0x1742e3),'value':_0x1742e3};}):[]};})};}})[_0xc9ef('0x23')](respondWithResult(_0x14d108,null))[_0xc9ef('0x43')](function(_0x426cc6){var _0x5ac887=_0x525555[_0xc9ef('0x2f')][_0xc9ef('0x6c')]?0x1f4:_0x426cc6[_0xc9ef('0x6d')]||0x1f4;logger[_0xc9ef('0x25')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x5ac887,JSON[_0xc9ef('0x6e')](_0x426cc6));delete _0x426cc6[_0xc9ef('0x27')];if(_0x5ac887===0x191){_0x5ac887=0x190;}_0x14d108[_0xc9ef('0x17')](_0x5ac887)[_0xc9ef('0x28')](_0x525555[_0xc9ef('0x2f')][_0xc9ef('0x6c')]?{'message':'Wrong\x20credentials','statusCode':_0x426cc6[_0xc9ef('0x6d')]}:_0x426cc6);});}; \ No newline at end of file +var _0xd49c=['api/v2/ticket_fields','Basic\x20%s','%s:X','toString','priority','source','ticket_type','group','company','remove','default','custom_text','custom_dropdown','label','choices','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','rimraf','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','limit','undefined','offset','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','send','index','map','FreshdeskAccount','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','count','include','findAll','rows','show','params','includeAll','options','find','catch','create','body','destroy','getConfigurations','order','findOne','AccountId','Subjects','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format'];(function(_0x51637c,_0x5bb102){var _0x6c6cd3=function(_0x50ba86){while(--_0x50ba86){_0x51637c['push'](_0x51637c['shift']());}};_0x6c6cd3(++_0x5bb102);}(_0xd49c,0x1d8));var _0xcd49=function(_0xd5b576,_0x53d48a){_0xd5b576=_0xd5b576-0x0;var _0x3bea2f=_0xd49c[_0xd5b576];return _0x3bea2f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcd49('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcd49('0x1'));var rp=require(_0xcd49('0x2'));var moment=require('moment');var BPromise=require(_0xcd49('0x3'));var Mustache=require('mustache');var util=require(_0xcd49('0x4'));var path=require('path');var sox=require(_0xcd49('0x5'));var csv=require(_0xcd49('0x6'));var ejs=require(_0xcd49('0x7'));var fs=require('fs');var fs_extra=require(_0xcd49('0x8'));var _=require(_0xcd49('0x9'));var squel=require(_0xcd49('0xa'));var crypto=require(_0xcd49('0xb'));var jsforce=require(_0xcd49('0xc'));var deskjs=require(_0xcd49('0xd'));var toCsv=require(_0xcd49('0x6'));var querystring=require(_0xcd49('0xe'));var Papa=require('papaparse');var Redis=require(_0xcd49('0xf'));var authService=require(_0xcd49('0x10'));var qs=require(_0xcd49('0x11'));var as=require(_0xcd49('0x12'));var hardwareService=require(_0xcd49('0x13'));var logger=require(_0xcd49('0x14'))(_0xcd49('0x15'));var utils=require(_0xcd49('0x16'));var config=require(_0xcd49('0x17'));var licenseUtil=require(_0xcd49('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5b8c8d,_0x2e817d){_0x2e817d=_0x2e817d||0xcc;return function(_0xfda206){if(_0xfda206){return _0x5b8c8d['sendStatus'](_0x2e817d);}return _0x5b8c8d[_0xcd49('0x19')](_0x2e817d)[_0xcd49('0x1a')]();};}function respondWithResult(_0x5c7d8c,_0x26f20){_0x26f20=_0x26f20||0xc8;return function(_0x227c38){if(_0x227c38){return _0x5c7d8c[_0xcd49('0x19')](_0x26f20)[_0xcd49('0x1b')](_0x227c38);}};}function respondWithFilteredResult(_0x1e2275,_0x328755){return function(_0x5a0c6e){if(_0x5a0c6e){var _0x4b090e=typeof _0x328755['offset']==='undefined'&&typeof _0x328755[_0xcd49('0x1c')]===_0xcd49('0x1d');var _0x43b97d=_0x5a0c6e['count'];var _0x3074a4=_0x4b090e?0x0:_0x328755[_0xcd49('0x1e')];var _0x9c7262=_0x4b090e?_0x5a0c6e['count']:_0x328755[_0xcd49('0x1e')]+_0x328755[_0xcd49('0x1c')];var _0x322add;if(_0x9c7262>=_0x43b97d){_0x9c7262=_0x43b97d;_0x322add=0xc8;}else{_0x322add=0xce;}_0x1e2275[_0xcd49('0x19')](_0x322add);return _0x1e2275[_0xcd49('0x1f')](_0xcd49('0x20'),_0x3074a4+'-'+_0x9c7262+'/'+_0x43b97d)[_0xcd49('0x1b')](_0x5a0c6e);}return null;};}function patchUpdates(_0x9475c1){return function(_0x383235){try{jsonpatch['apply'](_0x383235,_0x9475c1,!![]);}catch(_0x243f1a){return BPromise[_0xcd49('0x21')](_0x243f1a);}return _0x383235[_0xcd49('0x22')]();};}function saveUpdates(_0x5829d1,_0x4fdab7){return function(_0x5e4835){if(_0x5e4835){return _0x5e4835[_0xcd49('0x23')](_0x5829d1)[_0xcd49('0x24')](function(_0x57bc92){return _0x57bc92;});}return null;};}function removeEntity(_0x1f649c,_0x400669){return function(_0x978310){if(_0x978310){return _0x978310['destroy']()[_0xcd49('0x24')](function(){_0x1f649c[_0xcd49('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38d05a,_0x22c0ed){return function(_0x58afd6){if(!_0x58afd6){_0x38d05a[_0xcd49('0x25')](0x194);}return _0x58afd6;};}function handleError(_0xc3897c,_0x77a7eb){_0x77a7eb=_0x77a7eb||0x1f4;return function(_0x42bdfd){logger[_0xcd49('0x26')](_0x42bdfd[_0xcd49('0x27')]);if(_0x42bdfd[_0xcd49('0x28')]){delete _0x42bdfd[_0xcd49('0x28')];}_0xc3897c[_0xcd49('0x19')](_0x77a7eb)[_0xcd49('0x29')](_0x42bdfd);};}exports[_0xcd49('0x2a')]=function(_0x5cb1c8,_0x3be5e6){var _0x567557={},_0x43a448={},_0x468029={'count':0x0,'rows':[]};var _0x5a43cb=_[_0xcd49('0x2b')](db[_0xcd49('0x2c')]['rawAttributes'],function(_0x339dc0){return{'name':_0x339dc0[_0xcd49('0x2d')],'type':_0x339dc0[_0xcd49('0x2e')][_0xcd49('0x2f')]};});_0x43a448[_0xcd49('0x30')]=_[_0xcd49('0x2b')](_0x5a43cb,'name');_0x43a448['query']=_[_0xcd49('0x31')](_0x5cb1c8[_0xcd49('0x32')]);_0x43a448[_0xcd49('0x33')]=_[_0xcd49('0x34')](_0x43a448[_0xcd49('0x30')],_0x43a448[_0xcd49('0x32')]);_0x567557[_0xcd49('0x35')]=_[_0xcd49('0x34')](_0x43a448[_0xcd49('0x30')],qs[_0xcd49('0x36')](_0x5cb1c8[_0xcd49('0x32')][_0xcd49('0x36')]));_0x567557[_0xcd49('0x35')]=_0x567557['attributes'][_0xcd49('0x37')]?_0x567557[_0xcd49('0x35')]:_0x43a448['model'];if(!_0x5cb1c8['query'][_0xcd49('0x38')](_0xcd49('0x39'))){_0x567557['limit']=qs[_0xcd49('0x1c')](_0x5cb1c8[_0xcd49('0x32')][_0xcd49('0x1c')]);_0x567557[_0xcd49('0x1e')]=qs[_0xcd49('0x1e')](_0x5cb1c8[_0xcd49('0x32')][_0xcd49('0x1e')]);}_0x567557['order']=qs[_0xcd49('0x3a')](_0x5cb1c8[_0xcd49('0x32')][_0xcd49('0x3a')]);_0x567557[_0xcd49('0x3b')]=qs[_0xcd49('0x33')](_[_0xcd49('0x3c')](_0x5cb1c8['query'],_0x43a448[_0xcd49('0x33')]),_0x5a43cb);if(_0x5cb1c8[_0xcd49('0x32')][_0xcd49('0x3d')]){_0x567557['where']=_[_0xcd49('0x3e')](_0x567557[_0xcd49('0x3b')],{'$or':_[_0xcd49('0x2b')](_0x5a43cb,function(_0x265fa4){if(_0x265fa4[_0xcd49('0x2e')]!==_0xcd49('0x3f')){var _0x463e2b={};_0x463e2b[_0x265fa4[_0xcd49('0x28')]]={'$like':'%'+_0x5cb1c8[_0xcd49('0x32')][_0xcd49('0x3d')]+'%'};return _0x463e2b;}})});}_0x567557=_['merge']({},_0x567557,_0x5cb1c8['options']);var _0x2e3d84={'where':_0x567557[_0xcd49('0x3b')]};return db[_0xcd49('0x2c')][_0xcd49('0x40')](_0x2e3d84)[_0xcd49('0x24')](function(_0x5124b6){_0x468029[_0xcd49('0x40')]=_0x5124b6;if(_0x5cb1c8[_0xcd49('0x32')]['includeAll']){_0x567557[_0xcd49('0x41')]=[{'all':!![]}];}return db[_0xcd49('0x2c')][_0xcd49('0x42')](_0x567557);})[_0xcd49('0x24')](function(_0x452a89){_0x468029[_0xcd49('0x43')]=_0x452a89;return _0x468029;})[_0xcd49('0x24')](respondWithFilteredResult(_0x3be5e6,_0x567557))['catch'](handleError(_0x3be5e6,null));};exports[_0xcd49('0x44')]=function(_0x4f3dd7,_0x470e4d){var _0x1a8685={'raw':![],'where':{'id':_0x4f3dd7[_0xcd49('0x45')]['id']}},_0x54631f={};_0x54631f[_0xcd49('0x30')]=_['keys'](db[_0xcd49('0x2c')]['rawAttributes']);_0x54631f[_0xcd49('0x32')]=_[_0xcd49('0x31')](_0x4f3dd7[_0xcd49('0x32')]);_0x54631f['filters']=_[_0xcd49('0x34')](_0x54631f['model'],_0x54631f['query']);_0x1a8685[_0xcd49('0x35')]=_[_0xcd49('0x34')](_0x54631f['model'],qs[_0xcd49('0x36')](_0x4f3dd7[_0xcd49('0x32')][_0xcd49('0x36')]));_0x1a8685[_0xcd49('0x35')]=_0x1a8685[_0xcd49('0x35')]['length']?_0x1a8685[_0xcd49('0x35')]:_0x54631f[_0xcd49('0x30')];if(_0x4f3dd7[_0xcd49('0x32')][_0xcd49('0x46')]){_0x1a8685['include']=[{'all':!![]}];}_0x1a8685=_[_0xcd49('0x3e')]({},_0x1a8685,_0x4f3dd7[_0xcd49('0x47')]);return db[_0xcd49('0x2c')][_0xcd49('0x48')](_0x1a8685)[_0xcd49('0x24')](handleEntityNotFound(_0x470e4d,null))[_0xcd49('0x24')](respondWithResult(_0x470e4d,null))[_0xcd49('0x49')](handleError(_0x470e4d,null));};exports[_0xcd49('0x4a')]=function(_0x38676b,_0x5b11cc){return db[_0xcd49('0x2c')]['create'](_0x38676b[_0xcd49('0x4b')],{})[_0xcd49('0x24')](respondWithResult(_0x5b11cc,0xc9))[_0xcd49('0x49')](handleError(_0x5b11cc,null));};exports[_0xcd49('0x23')]=function(_0x268cc1,_0x5cc9c5){if(_0x268cc1['body']['id']){delete _0x268cc1['body']['id'];}return db[_0xcd49('0x2c')][_0xcd49('0x48')]({'where':{'id':_0x268cc1['params']['id']}})[_0xcd49('0x24')](handleEntityNotFound(_0x5cc9c5,null))[_0xcd49('0x24')](saveUpdates(_0x268cc1[_0xcd49('0x4b')],null))['then'](respondWithResult(_0x5cc9c5,null))['catch'](handleError(_0x5cc9c5,null));};exports[_0xcd49('0x4c')]=function(_0x5b47d3,_0x440990){return db[_0xcd49('0x2c')][_0xcd49('0x48')]({'where':{'id':_0x5b47d3[_0xcd49('0x45')]['id']}})[_0xcd49('0x24')](handleEntityNotFound(_0x440990,null))['then'](removeEntity(_0x440990,null))[_0xcd49('0x49')](handleError(_0x440990,null));};exports[_0xcd49('0x4d')]=function(_0x4cbb15,_0xe4e023,_0x518428){var _0x2def45={};var _0x183f37={};var _0x5822df;var _0x1c95d1;return db[_0xcd49('0x2c')]['findOne']({'where':{'id':_0x4cbb15[_0xcd49('0x45')]['id']}})['then'](handleEntityNotFound(_0xe4e023,null))[_0xcd49('0x24')](function(_0xe6231a){if(_0xe6231a){_0x5822df=_0xe6231a;_0x183f37[_0xcd49('0x30')]=_[_0xcd49('0x31')](db['FreshdeskConfiguration']['rawAttributes']);_0x183f37[_0xcd49('0x32')]=_[_0xcd49('0x31')](_0x4cbb15[_0xcd49('0x32')]);_0x183f37[_0xcd49('0x33')]=_[_0xcd49('0x34')](_0x183f37['model'],_0x183f37[_0xcd49('0x32')]);_0x2def45['attributes']=_[_0xcd49('0x34')](_0x183f37[_0xcd49('0x30')],qs[_0xcd49('0x36')](_0x4cbb15['query'][_0xcd49('0x36')]));_0x2def45['attributes']=_0x2def45[_0xcd49('0x35')]['length']?_0x2def45['attributes']:_0x183f37[_0xcd49('0x30')];_0x2def45[_0xcd49('0x4e')]=qs[_0xcd49('0x3a')](_0x4cbb15['query'][_0xcd49('0x3a')]);_0x2def45[_0xcd49('0x3b')]=qs['filters'](_['pick'](_0x4cbb15[_0xcd49('0x32')],_0x183f37[_0xcd49('0x33')]));if(_0x4cbb15[_0xcd49('0x32')][_0xcd49('0x3d')]){_0x2def45['where']=_[_0xcd49('0x3e')](_0x2def45[_0xcd49('0x3b')],{'$or':_['map'](_0x2def45[_0xcd49('0x35')],function(_0x13d5d6){var _0x3a5ac0={};_0x3a5ac0[_0x13d5d6]={'$like':'%'+_0x4cbb15[_0xcd49('0x32')][_0xcd49('0x3d')]+'%'};return _0x3a5ac0;})});}_0x2def45=_['merge']({},_0x2def45,_0x4cbb15[_0xcd49('0x47')]);return _0x5822df[_0xcd49('0x4d')](_0x2def45);}})[_0xcd49('0x24')](function(_0x21cc84){if(_0x21cc84){_0x1c95d1=_0x21cc84[_0xcd49('0x37')];if(!_0x4cbb15[_0xcd49('0x32')]['hasOwnProperty'](_0xcd49('0x39'))){_0x2def45[_0xcd49('0x1c')]=qs['limit'](_0x4cbb15[_0xcd49('0x32')]['limit']);_0x2def45[_0xcd49('0x1e')]=qs[_0xcd49('0x1e')](_0x4cbb15[_0xcd49('0x32')]['offset']);}return _0x5822df[_0xcd49('0x4d')](_0x2def45);}})[_0xcd49('0x24')](function(_0x5002eb){if(_0x5002eb){return _0x5002eb?{'count':_0x1c95d1,'rows':_0x5002eb}:null;}})[_0xcd49('0x24')](respondWithResult(_0xe4e023,null))['catch'](handleError(_0xe4e023,null));};exports['addConfiguration']=function(_0x171e47,_0x2a22ce,_0x4f3d07){if(_0x171e47[_0xcd49('0x4b')]['id']){delete _0x171e47[_0xcd49('0x4b')]['id'];}return db[_0xcd49('0x2c')][_0xcd49('0x4f')]({'where':{'id':_0x171e47['params']['id']}})[_0xcd49('0x24')](handleEntityNotFound(_0x2a22ce,null))[_0xcd49('0x24')](function(_0x2c9584){if(_0x2c9584){_0x171e47['body'][_0xcd49('0x50')]=_0x2c9584['id'];_0x171e47['body'][_0xcd49('0x51')]=integrations['getSubjects'](_0x171e47[_0xcd49('0x4b')]['channel'],_0x171e47[_0xcd49('0x4b')][_0xcd49('0x2e')]);_0x171e47[_0xcd49('0x4b')][_0xcd49('0x52')]=integrations[_0xcd49('0x53')](_0x171e47['body']['channel'],_0x171e47[_0xcd49('0x4b')][_0xcd49('0x2e')]);return db['FreshdeskConfiguration'][_0xcd49('0x4a')](_0x171e47[_0xcd49('0x4b')],{'include':[{'model':db['FreshdeskField'],'as':_0xcd49('0x51')},{'model':db[_0xcd49('0x54')],'as':_0xcd49('0x52')}]});}return null;})['then'](respondWithResult(_0x2a22ce,null))[_0xcd49('0x49')](handleError(_0x2a22ce,null));};exports[_0xcd49('0x55')]=function(_0xad1b0e,_0x5efe18,_0x3626a4){var _0x222da2='';return db[_0xcd49('0x2c')][_0xcd49('0x4f')]({'where':{'id':_0xad1b0e[_0xcd49('0x45')]['id']},'attributes':['id',_0xcd49('0x56'),_0xcd49('0x57')]})[_0xcd49('0x24')](handleEntityNotFound(_0x5efe18,null))[_0xcd49('0x24')](function(_0x4cc4cb){if(_0x4cc4cb){_0x222da2=_0x4cc4cb[_0xcd49('0x56')];var _0x82257b=_0x222da2[_0xcd49('0x58')](-0x1);if(_0x82257b==='/'){_0x222da2=_0x222da2[_0xcd49('0x59')](0x0,_0x222da2[_0xcd49('0x5a')](_0x82257b));}return rp({'method':_0xcd49('0x5b'),'uri':util[_0xcd49('0x5c')]('%s/%s',_0x222da2,_0xcd49('0x5d')),'headers':{'Authorization':util[_0xcd49('0x5c')](_0xcd49('0x5e'),new Buffer(util['format'](_0xcd49('0x5f'),_0x4cc4cb[_0xcd49('0x57')]))[_0xcd49('0x60')]('base64'))},'json':!![]});}})[_0xcd49('0x24')](function(_0x403cab){if(_0x403cab){var _0x209e23=['requester','subject','agent','description',_0xcd49('0x19'),_0xcd49('0x61'),'group',_0xcd49('0x62'),_0xcd49('0x63'),_0xcd49('0x64'),_0xcd49('0x65')];_[_0xcd49('0x66')](_0x403cab,function(_0x3b4f32){return _0x209e23['includes'](_0x3b4f32[_0xcd49('0x28')])||!_0x3b4f32[_0xcd49('0x67')]&&_0x3b4f32[_0xcd49('0x2e')]!==_0xcd49('0x68')&&_0x3b4f32[_0xcd49('0x2e')]!==_0xcd49('0x69');});return{'count':_0x403cab[_0xcd49('0x37')],'rows':_[_0xcd49('0x2b')](_0x403cab,function(_0x3b69f7){return{'id':_0x3b69f7[_0xcd49('0x28')],'name':_0x3b69f7[_0xcd49('0x6a')],'custom':!_0x3b69f7[_0xcd49('0x67')],'options':_0x3b69f7[_0xcd49('0x6b')]?_[_0xcd49('0x2b')](_0x3b69f7[_0xcd49('0x6b')],function(_0x4f3092){return{'name':_['capitalize'](_0x4f3092),'value':_0x4f3092};}):[]};})};}})[_0xcd49('0x24')](respondWithResult(_0x5efe18,null))[_0xcd49('0x49')](function(_0x37f450){var _0x36c8a4=_0xad1b0e['query'][_0xcd49('0x6c')]?0x1f4:_0x37f450['statusCode']||0x1f4;logger[_0xcd49('0x26')](_0xcd49('0x6d'),'getFields',_0x36c8a4,JSON[_0xcd49('0x6e')](_0x37f450));delete _0x37f450['name'];if(_0x36c8a4===0x191){_0x36c8a4=0x190;}_0x5efe18[_0xcd49('0x19')](_0x36c8a4)['send'](_0xad1b0e['query'][_0xcd49('0x6c')]?{'message':_0xcd49('0x6f'),'statusCode':_0x37f450[_0xcd49('0x70')]}:_0x37f450);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 003aca0..2286d0e 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 _0x0c77=['moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api'];(function(_0x5e562c,_0x2fcbff){var _0x4bd9d1=function(_0x5e1400){while(--_0x5e1400){_0x5e562c['push'](_0x5e562c['shift']());}};_0x4bd9d1(++_0x2fcbff);}(_0x0c77,0x175));var _0x70c7=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x0c77[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x70c7('0x0'));var util=require(_0x70c7('0x1'));var logger=require(_0x70c7('0x2'))(_0x70c7('0x3'));var moment=require(_0x70c7('0x4'));var BPromise=require('bluebird');var rp=require(_0x70c7('0x5'));var fs=require('fs');var path=require(_0x70c7('0x6'));var rimraf=require(_0x70c7('0x7'));var config=require(_0x70c7('0x8'));var attributes=require(_0x70c7('0x9'));var integrations=require(_0x70c7('0xa'));module['exports']=function(_0x70f0c2,_0x5a855d){return _0x70f0c2['define'](_0x70c7('0xb'),attributes,{'tableName':_0x70c7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7034=['../../components/integrations/configuration','exports','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','bluebird','path','../../config/environment'];(function(_0x58175c,_0x2d9373){var _0x55b88f=function(_0x13ed84){while(--_0x13ed84){_0x58175c['push'](_0x58175c['shift']());}};_0x55b88f(++_0x2d9373);}(_0x7034,0xc2));var _0x4703=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x7034[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0x4703('0x0'));var util=require(_0x4703('0x1'));var logger=require(_0x4703('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4703('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4703('0x4'));var rimraf=require('rimraf');var config=require(_0x4703('0x5'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x4703('0x6'));module[_0x4703('0x7')]=function(_0x43de24,_0x360f1b){return _0x43de24['define'](_0x4703('0x8'),attributes,{'tableName':_0x4703('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 99acabd..9025d3c 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 _0x96a6=['catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','attributes','limit','map','model','include','ShowFreshdeskAccount','find','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x28db4a,_0x6d6d5a){var _0x3bf87e=function(_0x3e0f75){while(--_0x3e0f75){_0x28db4a['push'](_0x28db4a['shift']());}};_0x3bf87e(++_0x6d6d5a);}(_0x96a6,0xfd));var _0x696a=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x96a6[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x696a('0x0'));var util=require(_0x696a('0x1'));var moment=require('moment');var BPromise=require(_0x696a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x696a('0x3'));var logger=require(_0x696a('0x4'))(_0x696a('0x5'));var config=require(_0x696a('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x33beb4,_0xff3f8d,_0x5082dc){return new BPromise(function(_0x94f30,_0x3ca502){return client[_0x696a('0x7')](_0x33beb4,_0x5082dc)[_0x696a('0x8')](function(_0x86d2ca){logger[_0x696a('0x9')](_0x696a('0xa'),_0xff3f8d,_0x696a('0xb'));logger[_0x696a('0xc')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0xff3f8d,_0x696a('0xb'),JSON['stringify'](_0x86d2ca));if(_0x86d2ca[_0x696a('0xd')]){if(_0x86d2ca[_0x696a('0xd')][_0x696a('0xe')]===0x1f4){logger[_0x696a('0xd')](_0x696a('0xa'),_0xff3f8d,_0x86d2ca[_0x696a('0xd')][_0x696a('0xf')]);return _0x3ca502(_0x86d2ca['error']['message']);}logger[_0x696a('0xd')](_0x696a('0xa'),_0xff3f8d,_0x86d2ca[_0x696a('0xd')][_0x696a('0xf')]);return _0x94f30(_0x86d2ca[_0x696a('0xd')][_0x696a('0xf')]);}else{logger[_0x696a('0x9')](_0x696a('0xa'),_0xff3f8d,'request\x20sent');_0x94f30(_0x86d2ca[_0x696a('0x10')]['message']);}})[_0x696a('0x11')](function(_0x33fccf){logger['error'](_0x696a('0xa'),_0xff3f8d,_0x33fccf);_0x3ca502(_0x33fccf);});});}exports[_0x696a('0x12')]=function(_0x43e93c){var _0x57a0dd=this;return new Promise(function(_0x2e2bbd,_0x5d0f22){return db[_0x696a('0x13')][_0x696a('0x14')]({'raw':_0x43e93c[_0x696a('0x15')]?_0x43e93c[_0x696a('0x15')][_0x696a('0x16')]===undefined?!![]:![]:!![],'where':_0x43e93c['options']?_0x43e93c[_0x696a('0x15')]['where']||null:null,'attributes':_0x43e93c[_0x696a('0x15')]?_0x43e93c[_0x696a('0x15')][_0x696a('0x17')]||null:null,'limit':_0x43e93c[_0x696a('0x15')]?_0x43e93c[_0x696a('0x15')][_0x696a('0x18')]||null:null,'include':_0x43e93c[_0x696a('0x15')]?_0x43e93c[_0x696a('0x15')]['include']?_[_0x696a('0x19')](_0x43e93c[_0x696a('0x15')]['include'],function(_0x2f412b){return{'model':db[_0x2f412b[_0x696a('0x1a')]],'as':_0x2f412b['as'],'attributes':_0x2f412b['attributes'],'include':_0x2f412b[_0x696a('0x1b')]?_[_0x696a('0x19')](_0x2f412b[_0x696a('0x1b')],function(_0x86669f){return{'model':db[_0x86669f[_0x696a('0x1a')]],'as':_0x86669f['as'],'attributes':_0x86669f['attributes'],'include':_0x86669f[_0x696a('0x1b')]?_[_0x696a('0x19')](_0x86669f[_0x696a('0x1b')],function(_0x3ace9a){return{'model':db[_0x3ace9a[_0x696a('0x1a')]],'as':_0x3ace9a['as'],'attributes':_0x3ace9a['attributes']};}):[]};}):[]};}):[]:[]})[_0x696a('0x8')](function(_0x3bd37d){logger['info']('GetFreshdeskAccount',_0x43e93c);logger['debug'](_0x696a('0x12'),_0x43e93c,JSON['stringify'](_0x3bd37d));_0x2e2bbd(_0x3bd37d);})[_0x696a('0x11')](function(_0x12ed66){logger['error'](_0x696a('0x12'),_0x12ed66['message'],_0x43e93c);_0x5d0f22(_0x57a0dd[_0x696a('0xd')](0x1f4,_0x12ed66[_0x696a('0xf')]));});});};exports[_0x696a('0x1c')]=function(_0x1329d3){var _0x15366b=this;return new Promise(function(_0x2ff7ae,_0x58cf17){return db[_0x696a('0x13')][_0x696a('0x1d')]({'raw':_0x1329d3[_0x696a('0x15')]?_0x1329d3[_0x696a('0x15')][_0x696a('0x16')]===undefined?!![]:![]:!![],'where':_0x1329d3[_0x696a('0x15')]?_0x1329d3[_0x696a('0x15')]['where']||null:null,'attributes':_0x1329d3[_0x696a('0x15')]?_0x1329d3[_0x696a('0x15')][_0x696a('0x17')]||null:null,'include':_0x1329d3[_0x696a('0x15')]?_0x1329d3[_0x696a('0x15')]['include']?_[_0x696a('0x19')](_0x1329d3['options'][_0x696a('0x1b')],function(_0x1e95e2){return{'model':db[_0x1e95e2[_0x696a('0x1a')]],'as':_0x1e95e2['as'],'attributes':_0x1e95e2['attributes'],'include':_0x1e95e2[_0x696a('0x1b')]?_[_0x696a('0x19')](_0x1e95e2[_0x696a('0x1b')],function(_0x2d45c6){return{'model':db[_0x2d45c6['model']],'as':_0x2d45c6['as'],'attributes':_0x2d45c6['attributes'],'include':_0x2d45c6[_0x696a('0x1b')]?_[_0x696a('0x19')](_0x2d45c6[_0x696a('0x1b')],function(_0x1e2546){return{'model':db[_0x1e2546['model']],'as':_0x1e2546['as'],'attributes':_0x1e2546['attributes']};}):[]};}):[]};}):[]:[]})[_0x696a('0x8')](function(_0x129a01){logger[_0x696a('0x9')](_0x696a('0x1c'),_0x1329d3);logger[_0x696a('0xc')](_0x696a('0x1c'),_0x1329d3,JSON['stringify'](_0x129a01));_0x2ff7ae(_0x129a01);})[_0x696a('0x11')](function(_0x58ceae){logger[_0x696a('0xd')]('ShowFreshdeskAccount',_0x58ceae[_0x696a('0xf')],_0x1329d3);_0x58cf17(_0x15366b[_0x696a('0xd')](0x1f4,_0x58ceae[_0x696a('0xf')]));});});}; \ No newline at end of file +var _0x19da=['FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','attributes','limit','map','include','model','ShowFreshdeskAccount','raw','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x302ebe,_0x4f4943){var _0x3c7926=function(_0x462042){while(--_0x462042){_0x302ebe['push'](_0x302ebe['shift']());}};_0x3c7926(++_0x4f4943);}(_0x19da,0x9f));var _0xa19d=function(_0x340380,_0x4bd2a8){_0x340380=_0x340380-0x0;var _0x49ce1c=_0x19da[_0x340380];return _0x49ce1c;};'use strict';var _=require('lodash');var util=require(_0xa19d('0x0'));var moment=require('moment');var BPromise=require(_0xa19d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa19d('0x2'));var db=require(_0xa19d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa19d('0x4'))(_0xa19d('0x5'));var config=require('../../config/environment');var jayson=require(_0xa19d('0x6'));var client=jayson[_0xa19d('0x7')][_0xa19d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x14dc68,_0x32da37,_0x4b4627){return new BPromise(function(_0x197c4e,_0x4e6638){return client[_0xa19d('0x9')](_0x14dc68,_0x4b4627)[_0xa19d('0xa')](function(_0x538dea){logger['info'](_0xa19d('0xb'),_0x32da37,_0xa19d('0xc'));logger[_0xa19d('0xd')](_0xa19d('0xe'),_0x32da37,_0xa19d('0xc'),JSON[_0xa19d('0xf')](_0x538dea));if(_0x538dea['error']){if(_0x538dea['error'][_0xa19d('0x10')]===0x1f4){logger[_0xa19d('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x32da37,_0x538dea['error'][_0xa19d('0x12')]);return _0x4e6638(_0x538dea[_0xa19d('0x11')]['message']);}logger[_0xa19d('0x11')](_0xa19d('0xb'),_0x32da37,_0x538dea[_0xa19d('0x11')]['message']);return _0x197c4e(_0x538dea[_0xa19d('0x11')]['message']);}else{logger[_0xa19d('0x13')](_0xa19d('0xb'),_0x32da37,_0xa19d('0xc'));_0x197c4e(_0x538dea[_0xa19d('0x14')][_0xa19d('0x12')]);}})[_0xa19d('0x15')](function(_0x2f2774){logger[_0xa19d('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x32da37,_0x2f2774);_0x4e6638(_0x2f2774);});});}exports[_0xa19d('0x16')]=function(_0x57c6e9){var _0x3d25b4=this;return new Promise(function(_0xe493f1,_0x29941f){return db[_0xa19d('0x17')][_0xa19d('0x18')]({'raw':_0x57c6e9[_0xa19d('0x19')]?_0x57c6e9[_0xa19d('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x57c6e9[_0xa19d('0x19')]?_0x57c6e9[_0xa19d('0x19')][_0xa19d('0x1a')]||null:null,'attributes':_0x57c6e9[_0xa19d('0x19')]?_0x57c6e9[_0xa19d('0x19')][_0xa19d('0x1b')]||null:null,'limit':_0x57c6e9[_0xa19d('0x19')]?_0x57c6e9[_0xa19d('0x19')][_0xa19d('0x1c')]||null:null,'include':_0x57c6e9['options']?_0x57c6e9[_0xa19d('0x19')]['include']?_[_0xa19d('0x1d')](_0x57c6e9[_0xa19d('0x19')][_0xa19d('0x1e')],function(_0x206e88){return{'model':db[_0x206e88[_0xa19d('0x1f')]],'as':_0x206e88['as'],'attributes':_0x206e88[_0xa19d('0x1b')],'include':_0x206e88[_0xa19d('0x1e')]?_[_0xa19d('0x1d')](_0x206e88[_0xa19d('0x1e')],function(_0x43afdc){return{'model':db[_0x43afdc[_0xa19d('0x1f')]],'as':_0x43afdc['as'],'attributes':_0x43afdc[_0xa19d('0x1b')],'include':_0x43afdc[_0xa19d('0x1e')]?_[_0xa19d('0x1d')](_0x43afdc[_0xa19d('0x1e')],function(_0x2f4df8){return{'model':db[_0x2f4df8[_0xa19d('0x1f')]],'as':_0x2f4df8['as'],'attributes':_0x2f4df8[_0xa19d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa19d('0xa')](function(_0x45eeeb){logger[_0xa19d('0x13')]('GetFreshdeskAccount',_0x57c6e9);logger['debug']('GetFreshdeskAccount',_0x57c6e9,JSON[_0xa19d('0xf')](_0x45eeeb));_0xe493f1(_0x45eeeb);})[_0xa19d('0x15')](function(_0x387bfa){logger[_0xa19d('0x11')](_0xa19d('0x16'),_0x387bfa['message'],_0x57c6e9);_0x29941f(_0x3d25b4[_0xa19d('0x11')](0x1f4,_0x387bfa[_0xa19d('0x12')]));});});};exports[_0xa19d('0x20')]=function(_0x2cb94a){var _0x57f03e=this;return new Promise(function(_0x340ca4,_0x31c621){return db[_0xa19d('0x17')]['find']({'raw':_0x2cb94a['options']?_0x2cb94a[_0xa19d('0x19')][_0xa19d('0x21')]===undefined?!![]:![]:!![],'where':_0x2cb94a['options']?_0x2cb94a[_0xa19d('0x19')][_0xa19d('0x1a')]||null:null,'attributes':_0x2cb94a['options']?_0x2cb94a[_0xa19d('0x19')][_0xa19d('0x1b')]||null:null,'include':_0x2cb94a[_0xa19d('0x19')]?_0x2cb94a[_0xa19d('0x19')][_0xa19d('0x1e')]?_['map'](_0x2cb94a[_0xa19d('0x19')][_0xa19d('0x1e')],function(_0x132ec2){return{'model':db[_0x132ec2[_0xa19d('0x1f')]],'as':_0x132ec2['as'],'attributes':_0x132ec2[_0xa19d('0x1b')],'include':_0x132ec2['include']?_[_0xa19d('0x1d')](_0x132ec2[_0xa19d('0x1e')],function(_0x8ece04){return{'model':db[_0x8ece04[_0xa19d('0x1f')]],'as':_0x8ece04['as'],'attributes':_0x8ece04[_0xa19d('0x1b')],'include':_0x8ece04[_0xa19d('0x1e')]?_[_0xa19d('0x1d')](_0x8ece04[_0xa19d('0x1e')],function(_0x520894){return{'model':db[_0x520894['model']],'as':_0x520894['as'],'attributes':_0x520894[_0xa19d('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x392a1a){logger[_0xa19d('0x13')]('ShowFreshdeskAccount',_0x2cb94a);logger[_0xa19d('0xd')](_0xa19d('0x20'),_0x2cb94a,JSON[_0xa19d('0xf')](_0x392a1a));_0x340ca4(_0x392a1a);})['catch'](function(_0x20c3b8){logger[_0xa19d('0x11')](_0xa19d('0x20'),_0x20c3b8['message'],_0x2cb94a);_0x31c621(_0x57f03e[_0xa19d('0x11')](0x1f4,_0x20c3b8[_0xa19d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index c622144..7409cc3 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 _0xabeb=['/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index'];(function(_0x4d9403,_0x33c5f0){var _0x5eef11=function(_0x50bb5c){while(--_0x50bb5c){_0x4d9403['push'](_0x4d9403['shift']());}};_0x5eef11(++_0x33c5f0);}(_0xabeb,0x1d2));var _0xbabe=function(_0x432af8,_0x477b3d){_0x432af8=_0x432af8-0x0;var _0x228f4f=_0xabeb[_0x432af8];return _0x228f4f;};'use strict';var multer=require(_0xbabe('0x0'));var util=require(_0xbabe('0x1'));var path=require(_0xbabe('0x2'));var timeout=require('connect-timeout');var express=require(_0xbabe('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbabe('0x4'));var interaction=require(_0xbabe('0x5'));var config=require(_0xbabe('0x6'));var controller=require(_0xbabe('0x7'));router[_0xbabe('0x8')]('/',auth['isAuthenticated'](),controller[_0xbabe('0x9')]);router[_0xbabe('0x8')](_0xbabe('0xa'),auth[_0xbabe('0xb')](),controller[_0xbabe('0xc')]);router[_0xbabe('0x8')](_0xbabe('0xd'),auth['isAuthenticated'](),controller[_0xbabe('0xe')]);router[_0xbabe('0x8')](_0xbabe('0xf'),auth[_0xbabe('0xb')](),controller['getSubjects']);router[_0xbabe('0x8')](_0xbabe('0x10'),auth['isAuthenticated'](),controller[_0xbabe('0x11')]);router[_0xbabe('0x8')](_0xbabe('0x12'),auth[_0xbabe('0xb')](),controller[_0xbabe('0x13')]);router[_0xbabe('0x14')]('/',auth[_0xbabe('0xb')](),controller[_0xbabe('0x15')]);router[_0xbabe('0x14')](_0xbabe('0x12'),auth[_0xbabe('0xb')](),controller[_0xbabe('0x16')]);router[_0xbabe('0x17')]('/:id',auth[_0xbabe('0xb')](),controller[_0xbabe('0x18')]);router[_0xbabe('0x19')]('/:id',auth[_0xbabe('0xb')](),controller[_0xbabe('0x1a')]);module[_0xbabe('0x1b')]=router; \ No newline at end of file +var _0xace8=['getSubjects','/:id/descriptions','getDescriptions','getTags','create','post','/:id/tags','setTags','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id/fields','isAuthenticated','getFields','/:id/subjects'];(function(_0x9ea933,_0x565d76){var _0x4fdcd0=function(_0x1b1b59){while(--_0x1b1b59){_0x9ea933['push'](_0x9ea933['shift']());}};_0x4fdcd0(++_0x565d76);}(_0xace8,0x95));var _0x8ace=function(_0x4bfb87,_0x2ed356){_0x4bfb87=_0x4bfb87-0x0;var _0x2b4e25=_0xace8[_0x4bfb87];return _0x2b4e25;};'use strict';var multer=require(_0x8ace('0x0'));var util=require(_0x8ace('0x1'));var path=require(_0x8ace('0x2'));var timeout=require('connect-timeout');var express=require(_0x8ace('0x3'));var router=express[_0x8ace('0x4')]();var fs_extra=require(_0x8ace('0x5'));var auth=require(_0x8ace('0x6'));var interaction=require(_0x8ace('0x7'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0x8ace('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8ace('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x8ace('0x9'),auth[_0x8ace('0xa')](),controller[_0x8ace('0xb')]);router['get'](_0x8ace('0xc'),auth[_0x8ace('0xa')](),controller[_0x8ace('0xd')]);router[_0x8ace('0x8')](_0x8ace('0xe'),auth[_0x8ace('0xa')](),controller[_0x8ace('0xf')]);router[_0x8ace('0x8')]('/:id/tags',auth[_0x8ace('0xa')](),controller[_0x8ace('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8ace('0x11')]);router[_0x8ace('0x12')](_0x8ace('0x13'),auth[_0x8ace('0xa')](),controller[_0x8ace('0x14')]);router[_0x8ace('0x15')](_0x8ace('0x16'),auth[_0x8ace('0xa')](),controller[_0x8ace('0x17')]);router[_0x8ace('0x18')](_0x8ace('0x16'),auth[_0x8ace('0xa')](),controller[_0x8ace('0x19')]);module[_0x8ace('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index efbe9f0..8897592 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 _0x78a4=['sequelize','exports','STRING'];(function(_0x20a005,_0x3267c4){var _0x318723=function(_0x4dd1e8){while(--_0x4dd1e8){_0x20a005['push'](_0x20a005['shift']());}};_0x318723(++_0x3267c4);}(_0x78a4,0x162));var _0x478a=function(_0x4df6f9,_0x44bd65){_0x4df6f9=_0x4df6f9-0x0;var _0x4b1a73=_0x78a4[_0x4df6f9];return _0x4b1a73;};'use strict';var Sequelize=require(_0x478a('0x0'));module[_0x478a('0x1')]={'name':{'type':Sequelize[_0x478a('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8a8b=['STRING','sequelize'];(function(_0x5e1c27,_0x260e92){var _0x18886d=function(_0x45a499){while(--_0x45a499){_0x5e1c27['push'](_0x5e1c27['shift']());}};_0x18886d(++_0x260e92);}(_0x8a8b,0xa5));var _0xb8a8=function(_0x3bec09,_0x50d686){_0x3bec09=_0x3bec09-0x0;var _0x4f30de=_0x8a8b[_0x3bec09];return _0x4f30de;};'use strict';var Sequelize=require(_0xb8a8('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb8a8('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 688ea77..dc3cca2 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 _0xe215=['body','params','getFields','findOne','FreshdeskField','length','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','model','name','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','options','includeAll','findAll','catch','show','find'];(function(_0x127438,_0x5456b7){var _0x588c31=function(_0x1d8451){while(--_0x1d8451){_0x127438['push'](_0x127438['shift']());}};_0x588c31(++_0x5456b7);}(_0xe215,0x1db));var _0x5e21=function(_0x182212,_0x430f48){_0x182212=_0x182212-0x0;var _0x57a061=_0xe215[_0x182212];return _0x57a061;};'use strict';var emlformat=require(_0x5e21('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5e21('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5e21('0x2'));var moment=require(_0x5e21('0x3'));var BPromise=require(_0x5e21('0x4'));var Mustache=require(_0x5e21('0x5'));var util=require(_0x5e21('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x5e21('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5e21('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x5e21('0x9'));var toCsv=require(_0x5e21('0x7'));var querystring=require(_0x5e21('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5e21('0xb'));var qs=require(_0x5e21('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e21('0xd'));var logger=require(_0x5e21('0xe'))(_0x5e21('0xf'));var utils=require(_0x5e21('0x10'));var config=require(_0x5e21('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x5e21('0x12'))['db'];function respondWithStatusCode(_0x49bc6f,_0x3bd7c0){_0x3bd7c0=_0x3bd7c0||0xcc;return function(_0x257c82){if(_0x257c82){return _0x49bc6f[_0x5e21('0x13')](_0x3bd7c0);}return _0x49bc6f[_0x5e21('0x14')](_0x3bd7c0)['end']();};}function respondWithResult(_0x5dc786,_0x108375){_0x108375=_0x108375||0xc8;return function(_0xad8e38){if(_0xad8e38){return _0x5dc786[_0x5e21('0x14')](_0x108375)[_0x5e21('0x15')](_0xad8e38);}};}function respondWithFilteredResult(_0x2f1600,_0x4844b8){return function(_0x306096){if(_0x306096){var _0x496c25=typeof _0x4844b8['offset']==='undefined'&&typeof _0x4844b8[_0x5e21('0x16')]===_0x5e21('0x17');var _0x139c3f=_0x306096[_0x5e21('0x18')];var _0x4227d5=_0x496c25?0x0:_0x4844b8['offset'];var _0x545c09=_0x496c25?_0x306096[_0x5e21('0x18')]:_0x4844b8[_0x5e21('0x19')]+_0x4844b8[_0x5e21('0x16')];var _0x18e087;if(_0x545c09>=_0x139c3f){_0x545c09=_0x139c3f;_0x18e087=0xc8;}else{_0x18e087=0xce;}_0x2f1600['status'](_0x18e087);return _0x2f1600[_0x5e21('0x1a')](_0x5e21('0x1b'),_0x4227d5+'-'+_0x545c09+'/'+_0x139c3f)[_0x5e21('0x15')](_0x306096);}return null;};}function patchUpdates(_0x50dc4d){return function(_0x187bb9){try{jsonpatch[_0x5e21('0x1c')](_0x187bb9,_0x50dc4d,!![]);}catch(_0x589411){return BPromise[_0x5e21('0x1d')](_0x589411);}return _0x187bb9[_0x5e21('0x1e')]();};}function saveUpdates(_0x35e5b6,_0xba2bcb){return function(_0x4f8e85){if(_0x4f8e85){return _0x4f8e85[_0x5e21('0x1f')](_0x35e5b6)[_0x5e21('0x20')](function(_0x2e7f71){return _0x2e7f71;});}return null;};}function removeEntity(_0x37c690,_0x822f77){return function(_0x4c371b){if(_0x4c371b){return _0x4c371b[_0x5e21('0x21')]()[_0x5e21('0x20')](function(){_0x37c690['status'](0xcc)[_0x5e21('0x22')]();});}};}function handleEntityNotFound(_0x5111df,_0x1aa0cc){return function(_0x22451c){if(!_0x22451c){_0x5111df[_0x5e21('0x13')](0x194);}return _0x22451c;};}function handleError(_0x4cfd41,_0x34fc0e){_0x34fc0e=_0x34fc0e||0x1f4;return function(_0x571660){logger[_0x5e21('0x23')](_0x571660['stack']);if(_0x571660['name']){delete _0x571660['name'];}_0x4cfd41[_0x5e21('0x14')](_0x34fc0e)[_0x5e21('0x24')](_0x571660);};}exports[_0x5e21('0x25')]=function(_0x436da4,_0x4476a1){var _0x3379a3={},_0x143443={},_0x2c7ca1={'count':0x0,'rows':[]};var _0x45ad93=_[_0x5e21('0x26')](db[_0x5e21('0x27')][_0x5e21('0x28')],function(_0xd0721e){return{'name':_0xd0721e[_0x5e21('0x29')],'type':_0xd0721e['type']['key']};});_0x143443[_0x5e21('0x2a')]=_[_0x5e21('0x26')](_0x45ad93,_0x5e21('0x2b'));_0x143443['query']=_[_0x5e21('0x2c')](_0x436da4[_0x5e21('0x2d')]);_0x143443[_0x5e21('0x2e')]=_[_0x5e21('0x2f')](_0x143443[_0x5e21('0x2a')],_0x143443[_0x5e21('0x2d')]);_0x3379a3[_0x5e21('0x30')]=_[_0x5e21('0x2f')](_0x143443[_0x5e21('0x2a')],qs[_0x5e21('0x31')](_0x436da4[_0x5e21('0x2d')]['fields']));_0x3379a3['attributes']=_0x3379a3[_0x5e21('0x30')]['length']?_0x3379a3[_0x5e21('0x30')]:_0x143443[_0x5e21('0x2a')];if(!_0x436da4['query'][_0x5e21('0x32')](_0x5e21('0x33'))){_0x3379a3[_0x5e21('0x16')]=qs[_0x5e21('0x16')](_0x436da4['query'][_0x5e21('0x16')]);_0x3379a3[_0x5e21('0x19')]=qs[_0x5e21('0x19')](_0x436da4[_0x5e21('0x2d')][_0x5e21('0x19')]);}_0x3379a3[_0x5e21('0x34')]=qs[_0x5e21('0x35')](_0x436da4[_0x5e21('0x2d')]['sort']);_0x3379a3['where']=qs[_0x5e21('0x2e')](_['pick'](_0x436da4[_0x5e21('0x2d')],_0x143443[_0x5e21('0x2e')]),_0x45ad93);if(_0x436da4['query'][_0x5e21('0x36')]){_0x3379a3[_0x5e21('0x37')]=_[_0x5e21('0x38')](_0x3379a3[_0x5e21('0x37')],{'$or':_['map'](_0x45ad93,function(_0x50dc7f){if(_0x50dc7f[_0x5e21('0x39')]!=='VIRTUAL'){var _0x2e0269={};_0x2e0269[_0x50dc7f[_0x5e21('0x2b')]]={'$like':'%'+_0x436da4[_0x5e21('0x2d')][_0x5e21('0x36')]+'%'};return _0x2e0269;}})});}_0x3379a3=_[_0x5e21('0x38')]({},_0x3379a3,_0x436da4[_0x5e21('0x3a')]);var _0xe1ecbe={'where':_0x3379a3[_0x5e21('0x37')]};return db['FreshdeskConfiguration'][_0x5e21('0x18')](_0xe1ecbe)[_0x5e21('0x20')](function(_0x2d00dc){_0x2c7ca1[_0x5e21('0x18')]=_0x2d00dc;if(_0x436da4[_0x5e21('0x2d')][_0x5e21('0x3b')]){_0x3379a3['include']=[{'all':!![]}];}return db[_0x5e21('0x27')][_0x5e21('0x3c')](_0x3379a3);})[_0x5e21('0x20')](function(_0x4cfebd){_0x2c7ca1['rows']=_0x4cfebd;return _0x2c7ca1;})['then'](respondWithFilteredResult(_0x4476a1,_0x3379a3))[_0x5e21('0x3d')](handleError(_0x4476a1,null));};exports[_0x5e21('0x3e')]=function(_0x2074e4,_0x5c44c4){var _0x37f8c8={'raw':![],'where':{'id':_0x2074e4['params']['id']}},_0x24fc64={};_0x24fc64[_0x5e21('0x2a')]=_['keys'](db[_0x5e21('0x27')][_0x5e21('0x28')]);_0x24fc64[_0x5e21('0x2d')]=_[_0x5e21('0x2c')](_0x2074e4['query']);_0x24fc64[_0x5e21('0x2e')]=_[_0x5e21('0x2f')](_0x24fc64['model'],_0x24fc64['query']);_0x37f8c8['attributes']=_[_0x5e21('0x2f')](_0x24fc64[_0x5e21('0x2a')],qs[_0x5e21('0x31')](_0x2074e4[_0x5e21('0x2d')][_0x5e21('0x31')]));_0x37f8c8[_0x5e21('0x30')]=_0x37f8c8['attributes']['length']?_0x37f8c8[_0x5e21('0x30')]:_0x24fc64['model'];if(_0x2074e4[_0x5e21('0x2d')]['includeAll']){_0x37f8c8['include']=[{'all':!![]}];}_0x37f8c8=_['merge']({},_0x37f8c8,_0x2074e4[_0x5e21('0x3a')]);return db[_0x5e21('0x27')][_0x5e21('0x3f')](_0x37f8c8)[_0x5e21('0x20')](handleEntityNotFound(_0x5c44c4,null))[_0x5e21('0x20')](respondWithResult(_0x5c44c4,null))[_0x5e21('0x3d')](handleError(_0x5c44c4,null));};exports['create']=function(_0x1bbf5e,_0x2291ff){return db[_0x5e21('0x27')]['create'](_0x1bbf5e[_0x5e21('0x40')],{})['then'](respondWithResult(_0x2291ff,0xc9))[_0x5e21('0x3d')](handleError(_0x2291ff,null));};exports[_0x5e21('0x1f')]=function(_0x3da01b,_0x1b1438){if(_0x3da01b['body']['id']){delete _0x3da01b['body']['id'];}return db[_0x5e21('0x27')][_0x5e21('0x3f')]({'where':{'id':_0x3da01b['params']['id']}})[_0x5e21('0x20')](handleEntityNotFound(_0x1b1438,null))[_0x5e21('0x20')](saveUpdates(_0x3da01b['body'],null))[_0x5e21('0x20')](respondWithResult(_0x1b1438,null))[_0x5e21('0x3d')](handleError(_0x1b1438,null));};exports[_0x5e21('0x21')]=function(_0x503e2b,_0x92c243){return db[_0x5e21('0x27')][_0x5e21('0x3f')]({'where':{'id':_0x503e2b[_0x5e21('0x41')]['id']}})[_0x5e21('0x20')](handleEntityNotFound(_0x92c243,null))[_0x5e21('0x20')](removeEntity(_0x92c243,null))[_0x5e21('0x3d')](handleError(_0x92c243,null));};exports[_0x5e21('0x42')]=function(_0x22f9b6,_0x6e85fe,_0x48137a){var _0x1248f3={};var _0x1a4ec8={};var _0x37eb93;var _0x9bec1;return db[_0x5e21('0x27')][_0x5e21('0x43')]({'where':{'id':_0x22f9b6[_0x5e21('0x41')]['id']}})[_0x5e21('0x20')](handleEntityNotFound(_0x6e85fe,null))[_0x5e21('0x20')](function(_0x105b9c){if(_0x105b9c){_0x37eb93=_0x105b9c;_0x1a4ec8[_0x5e21('0x2a')]=_[_0x5e21('0x2c')](db[_0x5e21('0x44')][_0x5e21('0x28')]);_0x1a4ec8['query']=_[_0x5e21('0x2c')](_0x22f9b6[_0x5e21('0x2d')]);_0x1a4ec8[_0x5e21('0x2e')]=_['intersection'](_0x1a4ec8[_0x5e21('0x2a')],_0x1a4ec8[_0x5e21('0x2d')]);_0x1248f3[_0x5e21('0x30')]=_[_0x5e21('0x2f')](_0x1a4ec8[_0x5e21('0x2a')],qs[_0x5e21('0x31')](_0x22f9b6[_0x5e21('0x2d')][_0x5e21('0x31')]));_0x1248f3[_0x5e21('0x30')]=_0x1248f3[_0x5e21('0x30')][_0x5e21('0x45')]?_0x1248f3[_0x5e21('0x30')]:_0x1a4ec8['model'];_0x1248f3['order']=qs[_0x5e21('0x35')](_0x22f9b6['query'][_0x5e21('0x35')]);_0x1248f3[_0x5e21('0x37')]=qs['filters'](_[_0x5e21('0x46')](_0x22f9b6[_0x5e21('0x2d')],_0x1a4ec8['filters']));if(_0x22f9b6[_0x5e21('0x2d')][_0x5e21('0x36')]){_0x1248f3['where']=_[_0x5e21('0x38')](_0x1248f3[_0x5e21('0x37')],{'$or':_['map'](_0x1248f3['attributes'],function(_0x18f439){var _0x47b168={};_0x47b168[_0x18f439]={'$like':'%'+_0x22f9b6[_0x5e21('0x2d')][_0x5e21('0x36')]+'%'};return _0x47b168;})});}_0x1248f3=_[_0x5e21('0x38')]({},_0x1248f3,_0x22f9b6['options']);return _0x37eb93[_0x5e21('0x42')](_0x1248f3);}})['then'](function(_0x586cd5){if(_0x586cd5){_0x9bec1=_0x586cd5[_0x5e21('0x45')];if(!_0x22f9b6[_0x5e21('0x2d')][_0x5e21('0x32')](_0x5e21('0x33'))){_0x1248f3['limit']=qs[_0x5e21('0x16')](_0x22f9b6[_0x5e21('0x2d')][_0x5e21('0x16')]);_0x1248f3[_0x5e21('0x19')]=qs['offset'](_0x22f9b6[_0x5e21('0x2d')]['offset']);}return _0x37eb93['getFields'](_0x1248f3);}})[_0x5e21('0x20')](function(_0x20551f){if(_0x20551f){return _0x20551f?{'count':_0x9bec1,'rows':_0x20551f}:null;}})[_0x5e21('0x20')](respondWithResult(_0x6e85fe,null))['catch'](handleError(_0x6e85fe,null));};exports[_0x5e21('0x47')]=function(_0x10745c,_0x2901ed,_0x427586){var _0x2e3a68={};var _0x1fc1f4={};var _0x430114;var _0x3eb7f7;return db[_0x5e21('0x27')]['findOne']({'where':{'id':_0x10745c[_0x5e21('0x41')]['id']}})[_0x5e21('0x20')](handleEntityNotFound(_0x2901ed,null))[_0x5e21('0x20')](function(_0x21621f){if(_0x21621f){_0x430114=_0x21621f;_0x1fc1f4[_0x5e21('0x2a')]=_['keys'](db['FreshdeskField'][_0x5e21('0x28')]);_0x1fc1f4[_0x5e21('0x2d')]=_[_0x5e21('0x2c')](_0x10745c['query']);_0x1fc1f4[_0x5e21('0x2e')]=_[_0x5e21('0x2f')](_0x1fc1f4[_0x5e21('0x2a')],_0x1fc1f4['query']);_0x2e3a68['attributes']=_[_0x5e21('0x2f')](_0x1fc1f4[_0x5e21('0x2a')],qs['fields'](_0x10745c[_0x5e21('0x2d')]['fields']));_0x2e3a68[_0x5e21('0x30')]=_0x2e3a68[_0x5e21('0x30')][_0x5e21('0x45')]?_0x2e3a68[_0x5e21('0x30')]:_0x1fc1f4[_0x5e21('0x2a')];_0x2e3a68['order']=qs[_0x5e21('0x35')](_0x10745c[_0x5e21('0x2d')]['sort']);_0x2e3a68[_0x5e21('0x37')]=qs['filters'](_[_0x5e21('0x46')](_0x10745c[_0x5e21('0x2d')],_0x1fc1f4['filters']));if(_0x10745c['query'][_0x5e21('0x36')]){_0x2e3a68['where']=_[_0x5e21('0x38')](_0x2e3a68[_0x5e21('0x37')],{'$or':_[_0x5e21('0x26')](_0x2e3a68['attributes'],function(_0x130396){var _0x42d8e9={};_0x42d8e9[_0x130396]={'$like':'%'+_0x10745c[_0x5e21('0x2d')][_0x5e21('0x36')]+'%'};return _0x42d8e9;})});}_0x2e3a68=_[_0x5e21('0x38')]({},_0x2e3a68,_0x10745c[_0x5e21('0x3a')]);return _0x430114[_0x5e21('0x47')](_0x2e3a68);}})[_0x5e21('0x20')](function(_0x50c5c7){if(_0x50c5c7){_0x3eb7f7=_0x50c5c7['length'];if(!_0x10745c['query']['hasOwnProperty'](_0x5e21('0x33'))){_0x2e3a68[_0x5e21('0x16')]=qs[_0x5e21('0x16')](_0x10745c['query'][_0x5e21('0x16')]);_0x2e3a68[_0x5e21('0x19')]=qs[_0x5e21('0x19')](_0x10745c[_0x5e21('0x2d')][_0x5e21('0x19')]);}return _0x430114['getSubjects'](_0x2e3a68);}})['then'](function(_0x283d49){if(_0x283d49){return _0x283d49?{'count':_0x3eb7f7,'rows':_0x283d49}:null;}})['then'](respondWithResult(_0x2901ed,null))[_0x5e21('0x3d')](handleError(_0x2901ed,null));};exports['getDescriptions']=function(_0x3335f0,_0x2f9fa7,_0x27c605){var _0x47f331={};var _0x2c706a={};var _0x27e29c;var _0x5ca5a8;return db[_0x5e21('0x27')]['findOne']({'where':{'id':_0x3335f0[_0x5e21('0x41')]['id']}})[_0x5e21('0x20')](handleEntityNotFound(_0x2f9fa7,null))['then'](function(_0x583291){if(_0x583291){_0x27e29c=_0x583291;_0x2c706a[_0x5e21('0x2a')]=_['keys'](db[_0x5e21('0x44')]['rawAttributes']);_0x2c706a[_0x5e21('0x2d')]=_[_0x5e21('0x2c')](_0x3335f0[_0x5e21('0x2d')]);_0x2c706a[_0x5e21('0x2e')]=_[_0x5e21('0x2f')](_0x2c706a[_0x5e21('0x2a')],_0x2c706a[_0x5e21('0x2d')]);_0x47f331[_0x5e21('0x30')]=_[_0x5e21('0x2f')](_0x2c706a[_0x5e21('0x2a')],qs[_0x5e21('0x31')](_0x3335f0[_0x5e21('0x2d')][_0x5e21('0x31')]));_0x47f331[_0x5e21('0x30')]=_0x47f331[_0x5e21('0x30')][_0x5e21('0x45')]?_0x47f331[_0x5e21('0x30')]:_0x2c706a[_0x5e21('0x2a')];_0x47f331[_0x5e21('0x34')]=qs[_0x5e21('0x35')](_0x3335f0['query']['sort']);_0x47f331['where']=qs[_0x5e21('0x2e')](_[_0x5e21('0x46')](_0x3335f0[_0x5e21('0x2d')],_0x2c706a['filters']));if(_0x3335f0[_0x5e21('0x2d')][_0x5e21('0x36')]){_0x47f331[_0x5e21('0x37')]=_[_0x5e21('0x38')](_0x47f331[_0x5e21('0x37')],{'$or':_[_0x5e21('0x26')](_0x47f331['attributes'],function(_0x341ead){var _0x5789ec={};_0x5789ec[_0x341ead]={'$like':'%'+_0x3335f0['query'][_0x5e21('0x36')]+'%'};return _0x5789ec;})});}_0x47f331=_['merge']({},_0x47f331,_0x3335f0['options']);return _0x27e29c[_0x5e21('0x48')](_0x47f331);}})[_0x5e21('0x20')](function(_0x4c26d3){if(_0x4c26d3){_0x5ca5a8=_0x4c26d3[_0x5e21('0x45')];if(!_0x3335f0[_0x5e21('0x2d')][_0x5e21('0x32')](_0x5e21('0x33'))){_0x47f331[_0x5e21('0x16')]=qs[_0x5e21('0x16')](_0x3335f0[_0x5e21('0x2d')]['limit']);_0x47f331[_0x5e21('0x19')]=qs[_0x5e21('0x19')](_0x3335f0[_0x5e21('0x2d')]['offset']);}return _0x27e29c[_0x5e21('0x48')](_0x47f331);}})[_0x5e21('0x20')](function(_0x4a0412){if(_0x4a0412){return _0x4a0412?{'count':_0x5ca5a8,'rows':_0x4a0412}:null;}})[_0x5e21('0x20')](respondWithResult(_0x2f9fa7,null))[_0x5e21('0x3d')](handleError(_0x2f9fa7,null));};exports[_0x5e21('0x49')]=function(_0x404383,_0x5636da,_0x4a6839){var _0x4c1950={};var _0x31ce2d={};var _0x3ce67e;var _0x1ae677;return db[_0x5e21('0x27')][_0x5e21('0x43')]({'where':{'id':_0x404383[_0x5e21('0x41')]['id']}})[_0x5e21('0x20')](handleEntityNotFound(_0x5636da,null))[_0x5e21('0x20')](function(_0xceaa5){if(_0xceaa5){_0x3ce67e=_0xceaa5;_0x31ce2d[_0x5e21('0x2a')]=_[_0x5e21('0x2c')](db[_0x5e21('0x4a')]['rawAttributes']);_0x31ce2d[_0x5e21('0x2d')]=_[_0x5e21('0x2c')](_0x404383[_0x5e21('0x2d')]);_0x31ce2d['filters']=_[_0x5e21('0x2f')](_0x31ce2d[_0x5e21('0x2a')],_0x31ce2d[_0x5e21('0x2d')]);_0x4c1950[_0x5e21('0x30')]=_['intersection'](_0x31ce2d['model'],qs[_0x5e21('0x31')](_0x404383['query'][_0x5e21('0x31')]));_0x4c1950['attributes']=_0x4c1950[_0x5e21('0x30')]['length']?_0x4c1950[_0x5e21('0x30')]:_0x31ce2d[_0x5e21('0x2a')];_0x4c1950[_0x5e21('0x34')]=qs[_0x5e21('0x35')](_0x404383[_0x5e21('0x2d')][_0x5e21('0x35')]);_0x4c1950['where']=qs['filters'](_['pick'](_0x404383[_0x5e21('0x2d')],_0x31ce2d[_0x5e21('0x2e')]));if(_0x404383['query'][_0x5e21('0x36')]){_0x4c1950[_0x5e21('0x37')]=_[_0x5e21('0x38')](_0x4c1950[_0x5e21('0x37')],{'$or':_['map'](_0x4c1950['attributes'],function(_0x1358c9){var _0x34cf63={};_0x34cf63[_0x1358c9]={'$like':'%'+_0x404383['query'][_0x5e21('0x36')]+'%'};return _0x34cf63;})});}_0x4c1950=_[_0x5e21('0x38')]({},_0x4c1950,_0x404383[_0x5e21('0x3a')]);return _0x3ce67e[_0x5e21('0x49')](_0x4c1950);}})[_0x5e21('0x20')](function(_0x2485a4){if(_0x2485a4){_0x1ae677=_0x2485a4[_0x5e21('0x45')];if(!_0x404383[_0x5e21('0x2d')]['hasOwnProperty'](_0x5e21('0x33'))){_0x4c1950[_0x5e21('0x16')]=qs['limit'](_0x404383[_0x5e21('0x2d')][_0x5e21('0x16')]);_0x4c1950[_0x5e21('0x19')]=qs['offset'](_0x404383[_0x5e21('0x2d')][_0x5e21('0x19')]);}return _0x3ce67e[_0x5e21('0x49')](_0x4c1950);}})[_0x5e21('0x20')](function(_0x3f5ee8){if(_0x3f5ee8){return _0x3f5ee8?{'count':_0x1ae677,'rows':_0x3f5ee8}:null;}})[_0x5e21('0x20')](respondWithResult(_0x5636da,null))[_0x5e21('0x3d')](handleError(_0x5636da,null));};exports['setTags']=function(_0x23d694,_0x3389d3,_0x50f474){if(_0x23d694['body']['id']){delete _0x23d694[_0x5e21('0x40')]['id'];}return db[_0x5e21('0x27')][_0x5e21('0x43')]({'where':{'id':_0x23d694[_0x5e21('0x41')]['id']}})[_0x5e21('0x20')](handleEntityNotFound(_0x3389d3,null))[_0x5e21('0x20')](function(_0x5e5b1d){if(_0x5e5b1d){return _0x5e5b1d[_0x5e21('0x4b')](_0x23d694[_0x5e21('0x40')][_0x5e21('0x4c')]||[]);}return null;})['then'](respondWithResult(_0x3389d3,null))[_0x5e21('0x3d')](handleError(_0x3389d3,null));}; \ No newline at end of file +var _0x00ee=['name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','FreshdeskConfiguration','includeAll','include','findAll','catch','show','params','keys','create','body','find','findOne','FreshdeskField','sort','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','undefined','offset','count','limit','Content-Range','reject','save','update','then','destroy','end','error','stack'];(function(_0xe89cf8,_0x24a844){var _0x1d3a49=function(_0x5171cc){while(--_0x5171cc){_0xe89cf8['push'](_0xe89cf8['shift']());}};_0x1d3a49(++_0x24a844);}(_0x00ee,0x170));var _0xe00e=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0x00ee[_0x4394b6];return _0x360244;};'use strict';var emlformat=require(_0xe00e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe00e('0x1'));var rp=require('request-promise');var moment=require(_0xe00e('0x2'));var BPromise=require(_0xe00e('0x3'));var Mustache=require(_0xe00e('0x4'));var util=require('util');var path=require(_0xe00e('0x5'));var sox=require(_0xe00e('0x6'));var csv=require(_0xe00e('0x7'));var ejs=require(_0xe00e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe00e('0x9'));var squel=require(_0xe00e('0xa'));var crypto=require(_0xe00e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe00e('0xc'));var toCsv=require(_0xe00e('0x7'));var querystring=require('querystring');var Papa=require(_0xe00e('0xd'));var Redis=require(_0xe00e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe00e('0xf'));var as=require(_0xe00e('0x10'));var hardwareService=require(_0xe00e('0x11'));var logger=require(_0xe00e('0x12'))('api');var utils=require(_0xe00e('0x13'));var config=require(_0xe00e('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45c182,_0x144739){_0x144739=_0x144739||0xcc;return function(_0x5e66b0){if(_0x5e66b0){return _0x45c182[_0xe00e('0x15')](_0x144739);}return _0x45c182[_0xe00e('0x16')](_0x144739)['end']();};}function respondWithResult(_0x5a35e6,_0x20eba5){_0x20eba5=_0x20eba5||0xc8;return function(_0x41e27c){if(_0x41e27c){return _0x5a35e6['status'](_0x20eba5)[_0xe00e('0x17')](_0x41e27c);}};}function respondWithFilteredResult(_0x2e033d,_0x28116b){return function(_0xbe773b){if(_0xbe773b){var _0x1efc8a=typeof _0x28116b['offset']===_0xe00e('0x18')&&typeof _0x28116b['limit']===_0xe00e('0x18');var _0x42b579=_0xbe773b['count'];var _0x2714cd=_0x1efc8a?0x0:_0x28116b[_0xe00e('0x19')];var _0x7b1d96=_0x1efc8a?_0xbe773b[_0xe00e('0x1a')]:_0x28116b['offset']+_0x28116b[_0xe00e('0x1b')];var _0x414a05;if(_0x7b1d96>=_0x42b579){_0x7b1d96=_0x42b579;_0x414a05=0xc8;}else{_0x414a05=0xce;}_0x2e033d[_0xe00e('0x16')](_0x414a05);return _0x2e033d['set'](_0xe00e('0x1c'),_0x2714cd+'-'+_0x7b1d96+'/'+_0x42b579)[_0xe00e('0x17')](_0xbe773b);}return null;};}function patchUpdates(_0x10a19a){return function(_0x5ca19f){try{jsonpatch['apply'](_0x5ca19f,_0x10a19a,!![]);}catch(_0x4903bb){return BPromise[_0xe00e('0x1d')](_0x4903bb);}return _0x5ca19f[_0xe00e('0x1e')]();};}function saveUpdates(_0x2f9e06,_0x45ae78){return function(_0x4bc2f5){if(_0x4bc2f5){return _0x4bc2f5[_0xe00e('0x1f')](_0x2f9e06)[_0xe00e('0x20')](function(_0x4fa196){return _0x4fa196;});}return null;};}function removeEntity(_0x45482d,_0x43c051){return function(_0x8ac687){if(_0x8ac687){return _0x8ac687[_0xe00e('0x21')]()[_0xe00e('0x20')](function(){_0x45482d[_0xe00e('0x16')](0xcc)[_0xe00e('0x22')]();});}};}function handleEntityNotFound(_0x44e403,_0x3eb6fd){return function(_0x1266fa){if(!_0x1266fa){_0x44e403[_0xe00e('0x15')](0x194);}return _0x1266fa;};}function handleError(_0x281388,_0x2864a4){_0x2864a4=_0x2864a4||0x1f4;return function(_0x1816b1){logger[_0xe00e('0x23')](_0x1816b1[_0xe00e('0x24')]);if(_0x1816b1[_0xe00e('0x25')]){delete _0x1816b1[_0xe00e('0x25')];}_0x281388[_0xe00e('0x16')](_0x2864a4)[_0xe00e('0x26')](_0x1816b1);};}exports['index']=function(_0x3fd8bd,_0x444d00){var _0x285631={},_0x573732={},_0x4af56d={'count':0x0,'rows':[]};var _0x30395d=_[_0xe00e('0x27')](db['FreshdeskConfiguration'][_0xe00e('0x28')],function(_0x17c97b){return{'name':_0x17c97b[_0xe00e('0x29')],'type':_0x17c97b[_0xe00e('0x2a')][_0xe00e('0x2b')]};});_0x573732[_0xe00e('0x2c')]=_[_0xe00e('0x27')](_0x30395d,'name');_0x573732[_0xe00e('0x2d')]=_['keys'](_0x3fd8bd[_0xe00e('0x2d')]);_0x573732[_0xe00e('0x2e')]=_[_0xe00e('0x2f')](_0x573732[_0xe00e('0x2c')],_0x573732[_0xe00e('0x2d')]);_0x285631[_0xe00e('0x30')]=_[_0xe00e('0x2f')](_0x573732[_0xe00e('0x2c')],qs[_0xe00e('0x31')](_0x3fd8bd[_0xe00e('0x2d')][_0xe00e('0x31')]));_0x285631['attributes']=_0x285631[_0xe00e('0x30')][_0xe00e('0x32')]?_0x285631[_0xe00e('0x30')]:_0x573732['model'];if(!_0x3fd8bd['query'][_0xe00e('0x33')](_0xe00e('0x34'))){_0x285631[_0xe00e('0x1b')]=qs[_0xe00e('0x1b')](_0x3fd8bd[_0xe00e('0x2d')][_0xe00e('0x1b')]);_0x285631['offset']=qs[_0xe00e('0x19')](_0x3fd8bd[_0xe00e('0x2d')][_0xe00e('0x19')]);}_0x285631[_0xe00e('0x35')]=qs['sort'](_0x3fd8bd['query']['sort']);_0x285631[_0xe00e('0x36')]=qs[_0xe00e('0x2e')](_[_0xe00e('0x37')](_0x3fd8bd['query'],_0x573732['filters']),_0x30395d);if(_0x3fd8bd['query'][_0xe00e('0x38')]){_0x285631[_0xe00e('0x36')]=_[_0xe00e('0x39')](_0x285631['where'],{'$or':_[_0xe00e('0x27')](_0x30395d,function(_0x45ecd9){if(_0x45ecd9[_0xe00e('0x2a')]!==_0xe00e('0x3a')){var _0x3cc9db={};_0x3cc9db[_0x45ecd9[_0xe00e('0x25')]]={'$like':'%'+_0x3fd8bd[_0xe00e('0x2d')][_0xe00e('0x38')]+'%'};return _0x3cc9db;}})});}_0x285631=_[_0xe00e('0x39')]({},_0x285631,_0x3fd8bd[_0xe00e('0x3b')]);var _0x46aa4e={'where':_0x285631[_0xe00e('0x36')]};return db[_0xe00e('0x3c')][_0xe00e('0x1a')](_0x46aa4e)[_0xe00e('0x20')](function(_0x5193){_0x4af56d[_0xe00e('0x1a')]=_0x5193;if(_0x3fd8bd['query'][_0xe00e('0x3d')]){_0x285631[_0xe00e('0x3e')]=[{'all':!![]}];}return db[_0xe00e('0x3c')][_0xe00e('0x3f')](_0x285631);})['then'](function(_0x15d255){_0x4af56d['rows']=_0x15d255;return _0x4af56d;})[_0xe00e('0x20')](respondWithFilteredResult(_0x444d00,_0x285631))[_0xe00e('0x40')](handleError(_0x444d00,null));};exports[_0xe00e('0x41')]=function(_0x3f065c,_0x16a3b9){var _0x231138={'raw':![],'where':{'id':_0x3f065c[_0xe00e('0x42')]['id']}},_0x111e80={};_0x111e80[_0xe00e('0x2c')]=_[_0xe00e('0x43')](db[_0xe00e('0x3c')][_0xe00e('0x28')]);_0x111e80[_0xe00e('0x2d')]=_['keys'](_0x3f065c[_0xe00e('0x2d')]);_0x111e80['filters']=_['intersection'](_0x111e80[_0xe00e('0x2c')],_0x111e80[_0xe00e('0x2d')]);_0x231138[_0xe00e('0x30')]=_[_0xe00e('0x2f')](_0x111e80[_0xe00e('0x2c')],qs[_0xe00e('0x31')](_0x3f065c[_0xe00e('0x2d')][_0xe00e('0x31')]));_0x231138['attributes']=_0x231138[_0xe00e('0x30')][_0xe00e('0x32')]?_0x231138[_0xe00e('0x30')]:_0x111e80[_0xe00e('0x2c')];if(_0x3f065c[_0xe00e('0x2d')][_0xe00e('0x3d')]){_0x231138[_0xe00e('0x3e')]=[{'all':!![]}];}_0x231138=_[_0xe00e('0x39')]({},_0x231138,_0x3f065c['options']);return db['FreshdeskConfiguration']['find'](_0x231138)[_0xe00e('0x20')](handleEntityNotFound(_0x16a3b9,null))[_0xe00e('0x20')](respondWithResult(_0x16a3b9,null))[_0xe00e('0x40')](handleError(_0x16a3b9,null));};exports[_0xe00e('0x44')]=function(_0x5082ca,_0x46e718){return db[_0xe00e('0x3c')]['create'](_0x5082ca[_0xe00e('0x45')],{})['then'](respondWithResult(_0x46e718,0xc9))[_0xe00e('0x40')](handleError(_0x46e718,null));};exports[_0xe00e('0x1f')]=function(_0xd4e300,_0xa361f0){if(_0xd4e300[_0xe00e('0x45')]['id']){delete _0xd4e300[_0xe00e('0x45')]['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0xd4e300[_0xe00e('0x42')]['id']}})['then'](handleEntityNotFound(_0xa361f0,null))[_0xe00e('0x20')](saveUpdates(_0xd4e300[_0xe00e('0x45')],null))['then'](respondWithResult(_0xa361f0,null))['catch'](handleError(_0xa361f0,null));};exports[_0xe00e('0x21')]=function(_0xa5cd95,_0x46f2f3){return db[_0xe00e('0x3c')][_0xe00e('0x46')]({'where':{'id':_0xa5cd95[_0xe00e('0x42')]['id']}})[_0xe00e('0x20')](handleEntityNotFound(_0x46f2f3,null))[_0xe00e('0x20')](removeEntity(_0x46f2f3,null))[_0xe00e('0x40')](handleError(_0x46f2f3,null));};exports['getFields']=function(_0x5d8f4e,_0x4fef1a,_0x307404){var _0x5ab92d={};var _0x13766a={};var _0x5c2bc7;var _0xc99aad;return db[_0xe00e('0x3c')][_0xe00e('0x47')]({'where':{'id':_0x5d8f4e['params']['id']}})[_0xe00e('0x20')](handleEntityNotFound(_0x4fef1a,null))[_0xe00e('0x20')](function(_0x32bdba){if(_0x32bdba){_0x5c2bc7=_0x32bdba;_0x13766a[_0xe00e('0x2c')]=_[_0xe00e('0x43')](db[_0xe00e('0x48')][_0xe00e('0x28')]);_0x13766a[_0xe00e('0x2d')]=_[_0xe00e('0x43')](_0x5d8f4e[_0xe00e('0x2d')]);_0x13766a['filters']=_[_0xe00e('0x2f')](_0x13766a[_0xe00e('0x2c')],_0x13766a[_0xe00e('0x2d')]);_0x5ab92d[_0xe00e('0x30')]=_[_0xe00e('0x2f')](_0x13766a[_0xe00e('0x2c')],qs[_0xe00e('0x31')](_0x5d8f4e[_0xe00e('0x2d')]['fields']));_0x5ab92d[_0xe00e('0x30')]=_0x5ab92d[_0xe00e('0x30')][_0xe00e('0x32')]?_0x5ab92d[_0xe00e('0x30')]:_0x13766a[_0xe00e('0x2c')];_0x5ab92d['order']=qs[_0xe00e('0x49')](_0x5d8f4e[_0xe00e('0x2d')][_0xe00e('0x49')]);_0x5ab92d[_0xe00e('0x36')]=qs[_0xe00e('0x2e')](_[_0xe00e('0x37')](_0x5d8f4e['query'],_0x13766a[_0xe00e('0x2e')]));if(_0x5d8f4e[_0xe00e('0x2d')][_0xe00e('0x38')]){_0x5ab92d[_0xe00e('0x36')]=_[_0xe00e('0x39')](_0x5ab92d[_0xe00e('0x36')],{'$or':_[_0xe00e('0x27')](_0x5ab92d['attributes'],function(_0x2dbf90){var _0x3b0494={};_0x3b0494[_0x2dbf90]={'$like':'%'+_0x5d8f4e['query']['filter']+'%'};return _0x3b0494;})});}_0x5ab92d=_[_0xe00e('0x39')]({},_0x5ab92d,_0x5d8f4e[_0xe00e('0x3b')]);return _0x5c2bc7['getFields'](_0x5ab92d);}})[_0xe00e('0x20')](function(_0x2ce671){if(_0x2ce671){_0xc99aad=_0x2ce671[_0xe00e('0x32')];if(!_0x5d8f4e[_0xe00e('0x2d')]['hasOwnProperty']('nolimit')){_0x5ab92d[_0xe00e('0x1b')]=qs[_0xe00e('0x1b')](_0x5d8f4e['query'][_0xe00e('0x1b')]);_0x5ab92d[_0xe00e('0x19')]=qs[_0xe00e('0x19')](_0x5d8f4e[_0xe00e('0x2d')][_0xe00e('0x19')]);}return _0x5c2bc7[_0xe00e('0x4a')](_0x5ab92d);}})[_0xe00e('0x20')](function(_0x3abc5a){if(_0x3abc5a){return _0x3abc5a?{'count':_0xc99aad,'rows':_0x3abc5a}:null;}})[_0xe00e('0x20')](respondWithResult(_0x4fef1a,null))[_0xe00e('0x40')](handleError(_0x4fef1a,null));};exports[_0xe00e('0x4b')]=function(_0x9926f6,_0x70b2d,_0x4cf918){var _0x40eea5={};var _0x13ebb4={};var _0x4c4dfc;var _0x5b391e;return db[_0xe00e('0x3c')][_0xe00e('0x47')]({'where':{'id':_0x9926f6[_0xe00e('0x42')]['id']}})[_0xe00e('0x20')](handleEntityNotFound(_0x70b2d,null))[_0xe00e('0x20')](function(_0x1f33a9){if(_0x1f33a9){_0x4c4dfc=_0x1f33a9;_0x13ebb4[_0xe00e('0x2c')]=_[_0xe00e('0x43')](db[_0xe00e('0x48')]['rawAttributes']);_0x13ebb4[_0xe00e('0x2d')]=_['keys'](_0x9926f6[_0xe00e('0x2d')]);_0x13ebb4['filters']=_[_0xe00e('0x2f')](_0x13ebb4[_0xe00e('0x2c')],_0x13ebb4[_0xe00e('0x2d')]);_0x40eea5[_0xe00e('0x30')]=_[_0xe00e('0x2f')](_0x13ebb4[_0xe00e('0x2c')],qs[_0xe00e('0x31')](_0x9926f6['query']['fields']));_0x40eea5[_0xe00e('0x30')]=_0x40eea5[_0xe00e('0x30')][_0xe00e('0x32')]?_0x40eea5[_0xe00e('0x30')]:_0x13ebb4[_0xe00e('0x2c')];_0x40eea5[_0xe00e('0x35')]=qs['sort'](_0x9926f6[_0xe00e('0x2d')]['sort']);_0x40eea5[_0xe00e('0x36')]=qs[_0xe00e('0x2e')](_[_0xe00e('0x37')](_0x9926f6['query'],_0x13ebb4[_0xe00e('0x2e')]));if(_0x9926f6[_0xe00e('0x2d')][_0xe00e('0x38')]){_0x40eea5['where']=_[_0xe00e('0x39')](_0x40eea5[_0xe00e('0x36')],{'$or':_[_0xe00e('0x27')](_0x40eea5[_0xe00e('0x30')],function(_0x5a53ab){var _0x37092b={};_0x37092b[_0x5a53ab]={'$like':'%'+_0x9926f6['query'][_0xe00e('0x38')]+'%'};return _0x37092b;})});}_0x40eea5=_[_0xe00e('0x39')]({},_0x40eea5,_0x9926f6[_0xe00e('0x3b')]);return _0x4c4dfc['getSubjects'](_0x40eea5);}})[_0xe00e('0x20')](function(_0x50e324){if(_0x50e324){_0x5b391e=_0x50e324[_0xe00e('0x32')];if(!_0x9926f6['query'][_0xe00e('0x33')](_0xe00e('0x34'))){_0x40eea5['limit']=qs[_0xe00e('0x1b')](_0x9926f6['query'][_0xe00e('0x1b')]);_0x40eea5[_0xe00e('0x19')]=qs[_0xe00e('0x19')](_0x9926f6[_0xe00e('0x2d')][_0xe00e('0x19')]);}return _0x4c4dfc['getSubjects'](_0x40eea5);}})[_0xe00e('0x20')](function(_0x229305){if(_0x229305){return _0x229305?{'count':_0x5b391e,'rows':_0x229305}:null;}})['then'](respondWithResult(_0x70b2d,null))[_0xe00e('0x40')](handleError(_0x70b2d,null));};exports[_0xe00e('0x4c')]=function(_0x3155a9,_0x239614,_0x25d3ff){var _0x8d9c44={};var _0x21f776={};var _0x5c53f2;var _0x197a1a;return db['FreshdeskConfiguration'][_0xe00e('0x47')]({'where':{'id':_0x3155a9['params']['id']}})[_0xe00e('0x20')](handleEntityNotFound(_0x239614,null))[_0xe00e('0x20')](function(_0x4b0a72){if(_0x4b0a72){_0x5c53f2=_0x4b0a72;_0x21f776['model']=_[_0xe00e('0x43')](db[_0xe00e('0x48')][_0xe00e('0x28')]);_0x21f776['query']=_[_0xe00e('0x43')](_0x3155a9[_0xe00e('0x2d')]);_0x21f776[_0xe00e('0x2e')]=_['intersection'](_0x21f776['model'],_0x21f776[_0xe00e('0x2d')]);_0x8d9c44['attributes']=_[_0xe00e('0x2f')](_0x21f776[_0xe00e('0x2c')],qs[_0xe00e('0x31')](_0x3155a9[_0xe00e('0x2d')][_0xe00e('0x31')]));_0x8d9c44[_0xe00e('0x30')]=_0x8d9c44[_0xe00e('0x30')][_0xe00e('0x32')]?_0x8d9c44['attributes']:_0x21f776[_0xe00e('0x2c')];_0x8d9c44[_0xe00e('0x35')]=qs[_0xe00e('0x49')](_0x3155a9['query']['sort']);_0x8d9c44['where']=qs['filters'](_[_0xe00e('0x37')](_0x3155a9[_0xe00e('0x2d')],_0x21f776[_0xe00e('0x2e')]));if(_0x3155a9[_0xe00e('0x2d')]['filter']){_0x8d9c44[_0xe00e('0x36')]=_['merge'](_0x8d9c44[_0xe00e('0x36')],{'$or':_['map'](_0x8d9c44[_0xe00e('0x30')],function(_0x22aaaf){var _0x50dc2e={};_0x50dc2e[_0x22aaaf]={'$like':'%'+_0x3155a9[_0xe00e('0x2d')][_0xe00e('0x38')]+'%'};return _0x50dc2e;})});}_0x8d9c44=_[_0xe00e('0x39')]({},_0x8d9c44,_0x3155a9[_0xe00e('0x3b')]);return _0x5c53f2[_0xe00e('0x4c')](_0x8d9c44);}})['then'](function(_0x5bddba){if(_0x5bddba){_0x197a1a=_0x5bddba['length'];if(!_0x3155a9['query'][_0xe00e('0x33')](_0xe00e('0x34'))){_0x8d9c44['limit']=qs[_0xe00e('0x1b')](_0x3155a9['query']['limit']);_0x8d9c44[_0xe00e('0x19')]=qs[_0xe00e('0x19')](_0x3155a9[_0xe00e('0x2d')]['offset']);}return _0x5c53f2[_0xe00e('0x4c')](_0x8d9c44);}})[_0xe00e('0x20')](function(_0x5dbe59){if(_0x5dbe59){return _0x5dbe59?{'count':_0x197a1a,'rows':_0x5dbe59}:null;}})[_0xe00e('0x20')](respondWithResult(_0x239614,null))[_0xe00e('0x40')](handleError(_0x239614,null));};exports[_0xe00e('0x4d')]=function(_0x1c91e9,_0x542f8b,_0x208644){var _0x48b6d4={};var _0x48a0f8={};var _0x3c54c2;var _0x3ae55c;return db[_0xe00e('0x3c')]['findOne']({'where':{'id':_0x1c91e9[_0xe00e('0x42')]['id']}})[_0xe00e('0x20')](handleEntityNotFound(_0x542f8b,null))[_0xe00e('0x20')](function(_0x21433a){if(_0x21433a){_0x3c54c2=_0x21433a;_0x48a0f8[_0xe00e('0x2c')]=_[_0xe00e('0x43')](db[_0xe00e('0x4e')][_0xe00e('0x28')]);_0x48a0f8['query']=_[_0xe00e('0x43')](_0x1c91e9[_0xe00e('0x2d')]);_0x48a0f8[_0xe00e('0x2e')]=_[_0xe00e('0x2f')](_0x48a0f8['model'],_0x48a0f8[_0xe00e('0x2d')]);_0x48b6d4['attributes']=_[_0xe00e('0x2f')](_0x48a0f8[_0xe00e('0x2c')],qs[_0xe00e('0x31')](_0x1c91e9[_0xe00e('0x2d')][_0xe00e('0x31')]));_0x48b6d4[_0xe00e('0x30')]=_0x48b6d4[_0xe00e('0x30')]['length']?_0x48b6d4[_0xe00e('0x30')]:_0x48a0f8['model'];_0x48b6d4['order']=qs[_0xe00e('0x49')](_0x1c91e9[_0xe00e('0x2d')][_0xe00e('0x49')]);_0x48b6d4['where']=qs['filters'](_['pick'](_0x1c91e9[_0xe00e('0x2d')],_0x48a0f8[_0xe00e('0x2e')]));if(_0x1c91e9[_0xe00e('0x2d')][_0xe00e('0x38')]){_0x48b6d4[_0xe00e('0x36')]=_['merge'](_0x48b6d4[_0xe00e('0x36')],{'$or':_['map'](_0x48b6d4[_0xe00e('0x30')],function(_0x10e2f7){var _0x39b0de={};_0x39b0de[_0x10e2f7]={'$like':'%'+_0x1c91e9['query'][_0xe00e('0x38')]+'%'};return _0x39b0de;})});}_0x48b6d4=_[_0xe00e('0x39')]({},_0x48b6d4,_0x1c91e9[_0xe00e('0x3b')]);return _0x3c54c2[_0xe00e('0x4d')](_0x48b6d4);}})['then'](function(_0x342e3b){if(_0x342e3b){_0x3ae55c=_0x342e3b['length'];if(!_0x1c91e9[_0xe00e('0x2d')][_0xe00e('0x33')](_0xe00e('0x34'))){_0x48b6d4[_0xe00e('0x1b')]=qs[_0xe00e('0x1b')](_0x1c91e9['query']['limit']);_0x48b6d4[_0xe00e('0x19')]=qs[_0xe00e('0x19')](_0x1c91e9[_0xe00e('0x2d')][_0xe00e('0x19')]);}return _0x3c54c2['getTags'](_0x48b6d4);}})[_0xe00e('0x20')](function(_0x470342){if(_0x470342){return _0x470342?{'count':_0x3ae55c,'rows':_0x470342}:null;}})['then'](respondWithResult(_0x542f8b,null))[_0xe00e('0x40')](handleError(_0x542f8b,null));};exports[_0xe00e('0x4f')]=function(_0x4b8a69,_0x7ebc3b,_0x3d1141){if(_0x4b8a69[_0xe00e('0x45')]['id']){delete _0x4b8a69[_0xe00e('0x45')]['id'];}return db[_0xe00e('0x3c')][_0xe00e('0x47')]({'where':{'id':_0x4b8a69[_0xe00e('0x42')]['id']}})[_0xe00e('0x20')](handleEntityNotFound(_0x7ebc3b,null))[_0xe00e('0x20')](function(_0x1f249a){if(_0x1f249a){return _0x1f249a['setTags'](_0x4b8a69['body'][_0xe00e('0x50')]||[]);}return null;})[_0xe00e('0x20')](respondWithResult(_0x7ebc3b,null))[_0xe00e('0x40')](handleError(_0x7ebc3b,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index ab4c625..42e017a 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 _0xaa01=['define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports'];(function(_0x30b29f,_0x3de460){var _0x195c63=function(_0x1fae0b){while(--_0x1fae0b){_0x30b29f['push'](_0x30b29f['shift']());}};_0x195c63(++_0x3de460);}(_0xaa01,0x1d4));var _0x1aa0=function(_0x4d5d16,_0x4e7f54){_0x4d5d16=_0x4d5d16-0x0;var _0x459076=_0xaa01[_0x4d5d16];return _0x459076;};'use strict';var _=require(_0x1aa0('0x0'));var util=require(_0x1aa0('0x1'));var logger=require(_0x1aa0('0x2'))(_0x1aa0('0x3'));var moment=require(_0x1aa0('0x4'));var BPromise=require(_0x1aa0('0x5'));var rp=require(_0x1aa0('0x6'));var fs=require('fs');var path=require(_0x1aa0('0x7'));var rimraf=require(_0x1aa0('0x8'));var config=require(_0x1aa0('0x9'));var attributes=require(_0x1aa0('0xa'));module[_0x1aa0('0xb')]=function(_0x58d0c6,_0x675243){return _0x58d0c6[_0x1aa0('0xc')](_0x1aa0('0xd'),attributes,{'tableName':_0x1aa0('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b59=['../../config/environment','exports','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x371b42,_0x3964d0){var _0x1adbe7=function(_0x1d1c18){while(--_0x1d1c18){_0x371b42['push'](_0x371b42['shift']());}};_0x1adbe7(++_0x3964d0);}(_0x3b59,0xa0));var _0x93b5=function(_0x232b8f,_0x18b3c2){_0x232b8f=_0x232b8f-0x0;var _0x3fdc20=_0x3b59[_0x232b8f];return _0x3fdc20;};'use strict';var _=require(_0x93b5('0x0'));var util=require(_0x93b5('0x1'));var logger=require(_0x93b5('0x2'))('api');var moment=require(_0x93b5('0x3'));var BPromise=require(_0x93b5('0x4'));var rp=require(_0x93b5('0x5'));var fs=require('fs');var path=require(_0x93b5('0x6'));var rimraf=require(_0x93b5('0x7'));var config=require(_0x93b5('0x8'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x93b5('0x9')]=function(_0x54df0c,_0x5aedde){return _0x54df0c['define'](_0x93b5('0xa'),attributes,{'tableName':_0x93b5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 5343c1d..754f904 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 _0xa949=['http','info','request\x20sent','debug','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x387408,_0x1cc48f){var _0x54e8cb=function(_0x33141b){while(--_0x33141b){_0x387408['push'](_0x387408['shift']());}};_0x54e8cb(++_0x1cc48f);}(_0xa949,0x197));var _0x9a94=function(_0xab0720,_0x2da8b8){_0xab0720=_0xab0720-0x0;var _0x381507=_0xa949[_0xab0720];return _0x381507;};'use strict';var _=require(_0x9a94('0x0'));var util=require(_0x9a94('0x1'));var moment=require(_0x9a94('0x2'));var BPromise=require(_0x9a94('0x3'));var rs=require(_0x9a94('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a94('0x5'))['db'];var utils=require(_0x9a94('0x6'));var logger=require(_0x9a94('0x7'))('rpc');var config=require(_0x9a94('0x8'));var jayson=require(_0x9a94('0x9'));var client=jayson[_0x9a94('0xa')][_0x9a94('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2fe8c8,_0x934dff,_0x2b4cc6){return new BPromise(function(_0x2d3e55,_0x4a0157){return client['request'](_0x2fe8c8,_0x2b4cc6)['then'](function(_0x12c9c8){logger[_0x9a94('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x934dff,_0x9a94('0xd'));logger[_0x9a94('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x934dff,'request\x20sent',JSON[_0x9a94('0xf')](_0x12c9c8));if(_0x12c9c8[_0x9a94('0x10')]){if(_0x12c9c8[_0x9a94('0x10')][_0x9a94('0x11')]===0x1f4){logger[_0x9a94('0x10')](_0x9a94('0x12'),_0x934dff,_0x12c9c8[_0x9a94('0x10')][_0x9a94('0x13')]);return _0x4a0157(_0x12c9c8['error']['message']);}logger[_0x9a94('0x10')](_0x9a94('0x12'),_0x934dff,_0x12c9c8[_0x9a94('0x10')][_0x9a94('0x13')]);return _0x2d3e55(_0x12c9c8['error'][_0x9a94('0x13')]);}else{logger['info'](_0x9a94('0x12'),_0x934dff,_0x9a94('0xd'));_0x2d3e55(_0x12c9c8[_0x9a94('0x14')][_0x9a94('0x13')]);}})[_0x9a94('0x15')](function(_0xcfd565){logger[_0x9a94('0x10')](_0x9a94('0x12'),_0x934dff,_0xcfd565);_0x4a0157(_0xcfd565);});});} \ No newline at end of file +var _0xe7a2=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x540178,_0x1feb3d){var _0x58a85c=function(_0x1c4861){while(--_0x1c4861){_0x540178['push'](_0x540178['shift']());}};_0x58a85c(++_0x1feb3d);}(_0xe7a2,0x1ca));var _0x2e7a=function(_0x487496,_0x249683){_0x487496=_0x487496-0x0;var _0x539dc8=_0xe7a2[_0x487496];return _0x539dc8;};'use strict';var _=require(_0x2e7a('0x0'));var util=require(_0x2e7a('0x1'));var moment=require(_0x2e7a('0x2'));var BPromise=require(_0x2e7a('0x3'));var rs=require(_0x2e7a('0x4'));var fs=require('fs');var Redis=require(_0x2e7a('0x5'));var db=require(_0x2e7a('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2e7a('0x7'));var jayson=require(_0x2e7a('0x8'));var client=jayson[_0x2e7a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x141634,_0x868e2d,_0x5f2ee4){return new BPromise(function(_0x10b383,_0x4b9947){return client[_0x2e7a('0xa')](_0x141634,_0x5f2ee4)[_0x2e7a('0xb')](function(_0x70b3b){logger['info'](_0x2e7a('0xc'),_0x868e2d,_0x2e7a('0xd'));logger[_0x2e7a('0xe')](_0x2e7a('0xf'),_0x868e2d,'request\x20sent',JSON[_0x2e7a('0x10')](_0x70b3b));if(_0x70b3b[_0x2e7a('0x11')]){if(_0x70b3b[_0x2e7a('0x11')][_0x2e7a('0x12')]===0x1f4){logger[_0x2e7a('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x868e2d,_0x70b3b[_0x2e7a('0x11')][_0x2e7a('0x13')]);return _0x4b9947(_0x70b3b['error'][_0x2e7a('0x13')]);}logger[_0x2e7a('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x868e2d,_0x70b3b[_0x2e7a('0x11')][_0x2e7a('0x13')]);return _0x10b383(_0x70b3b[_0x2e7a('0x11')]['message']);}else{logger[_0x2e7a('0x14')](_0x2e7a('0xc'),_0x868e2d,_0x2e7a('0xd'));_0x10b383(_0x70b3b[_0x2e7a('0x15')][_0x2e7a('0x13')]);}})[_0x2e7a('0x16')](function(_0xed649b){logger['error'](_0x2e7a('0xc'),_0x868e2d,_0xed649b);_0x4b9947(_0xed649b);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index f7d1609..ed239b0 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 _0x7e38=['put','/:id','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','index','show','post','isAuthenticated','create'];(function(_0x1e3671,_0x9ae4fc){var _0x48d5f5=function(_0xfab713){while(--_0xfab713){_0x1e3671['push'](_0x1e3671['shift']());}};_0x48d5f5(++_0x9ae4fc);}(_0x7e38,0xe9));var _0x87e3=function(_0x5de3f0,_0x4c3306){_0x5de3f0=_0x5de3f0-0x0;var _0x17f0f6=_0x7e38[_0x5de3f0];return _0x17f0f6;};'use strict';var multer=require(_0x87e3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x87e3('0x1'));var express=require(_0x87e3('0x2'));var router=express[_0x87e3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x87e3('0x4'));var interaction=require(_0x87e3('0x5'));var config=require(_0x87e3('0x6'));var controller=require(_0x87e3('0x7'));router[_0x87e3('0x8')]('/',auth['isAuthenticated'](),controller[_0x87e3('0x9')]);router[_0x87e3('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x87e3('0xa')]);router[_0x87e3('0xb')]('/',auth[_0x87e3('0xc')](),controller[_0x87e3('0xd')]);router[_0x87e3('0xe')](_0x87e3('0xf'),auth[_0x87e3('0xc')](),controller['update']);router[_0x87e3('0x10')](_0x87e3('0xf'),auth[_0x87e3('0xc')](),controller[_0x87e3('0x11')]);module[_0x87e3('0x12')]=router; \ No newline at end of file +var _0x6101=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','index','/:id','isAuthenticated','show','create','put','update','delete','exports','multer','util'];(function(_0x1f43be,_0x1906d1){var _0x24a829=function(_0x30215e){while(--_0x30215e){_0x1f43be['push'](_0x1f43be['shift']());}};_0x24a829(++_0x1906d1);}(_0x6101,0x142));var _0x1610=function(_0x2d3ca8,_0x7e6b00){_0x2d3ca8=_0x2d3ca8-0x0;var _0x47dbaf=_0x6101[_0x2d3ca8];return _0x47dbaf;};'use strict';var multer=require(_0x1610('0x0'));var util=require(_0x1610('0x1'));var path=require(_0x1610('0x2'));var timeout=require(_0x1610('0x3'));var express=require(_0x1610('0x4'));var router=express[_0x1610('0x5')]();var fs_extra=require(_0x1610('0x6'));var auth=require(_0x1610('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1610('0x8'));var controller=require('./intFreshdeskField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1610('0x9')]);router['get'](_0x1610('0xa'),auth[_0x1610('0xb')](),controller[_0x1610('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1610('0xd')]);router[_0x1610('0xe')](_0x1610('0xa'),auth['isAuthenticated'](),controller[_0x1610('0xf')]);router[_0x1610('0x10')](_0x1610('0xa'),auth[_0x1610('0xb')](),controller['destroy']);module[_0x1610('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 f31323d..74cc489 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 _0x9301=['BOOLEAN','sequelize','exports','ENUM','string','variable','picklist','STRING','customVariable'];(function(_0xce5e5c,_0x175633){var _0x93ebc1=function(_0x4d34ab){while(--_0x4d34ab){_0xce5e5c['push'](_0xce5e5c['shift']());}};_0x93ebc1(++_0x175633);}(_0x9301,0x196));var _0x1930=function(_0x1f4df0,_0x11af56){_0x1f4df0=_0x1f4df0-0x0;var _0x4c898d=_0x9301[_0x1f4df0];return _0x4c898d;};'use strict';var Sequelize=require(_0x1930('0x0'));module[_0x1930('0x1')]={'type':{'type':Sequelize[_0x1930('0x2')](_0x1930('0x3'),_0x1930('0x4'),'customVariable','keyValue',_0x1930('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x1930('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1930('0x2')](_0x1930('0x3'),_0x1930('0x4'),_0x1930('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1930('0x6')]},'nameField':{'type':Sequelize[_0x1930('0x6')]},'customField':{'type':Sequelize[_0x1930('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1930('0x6')]}}; \ No newline at end of file +var _0xa9d9=['sequelize','ENUM','variable','customVariable','keyValue','STRING','string','BOOLEAN'];(function(_0x147265,_0x3fb22a){var _0xa7cd46=function(_0x25f432){while(--_0x25f432){_0x147265['push'](_0x147265['shift']());}};_0xa7cd46(++_0x3fb22a);}(_0xa9d9,0x1c0));var _0x9a9d=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9d9[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x9a9d('0x0'));module['exports']={'type':{'type':Sequelize[_0x9a9d('0x1')]('string',_0x9a9d('0x2'),_0x9a9d('0x3'),_0x9a9d('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9a9d('0x5')]},'keyType':{'type':Sequelize[_0x9a9d('0x1')](_0x9a9d('0x6'),_0x9a9d('0x2'),_0x9a9d('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9a9d('0x5')]},'nameField':{'type':Sequelize[_0x9a9d('0x5')]},'customField':{'type':Sequelize[_0x9a9d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index eca70e4..e93fabc 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 _0xec56=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','FreshdeskField','rawAttributes','fieldName','type','key','query','filters','attributes','model','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','intersection','include','find','catch','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x35b3ed,_0x1f38c7){var _0x6f3f1d=function(_0x4480f0){while(--_0x4480f0){_0x35b3ed['push'](_0x35b3ed['shift']());}};_0x6f3f1d(++_0x1f38c7);}(_0xec56,0x1bd));var _0x6ec5=function(_0x341947,_0x49c7f){_0x341947=_0x341947-0x0;var _0x46a055=_0xec56[_0x341947];return _0x46a055;};'use strict';var emlformat=require(_0x6ec5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6ec5('0x1'));var rp=require(_0x6ec5('0x2'));var moment=require(_0x6ec5('0x3'));var BPromise=require(_0x6ec5('0x4'));var Mustache=require(_0x6ec5('0x5'));var util=require(_0x6ec5('0x6'));var path=require(_0x6ec5('0x7'));var sox=require(_0x6ec5('0x8'));var csv=require(_0x6ec5('0x9'));var ejs=require(_0x6ec5('0xa'));var fs=require('fs');var fs_extra=require(_0x6ec5('0xb'));var _=require(_0x6ec5('0xc'));var squel=require(_0x6ec5('0xd'));var crypto=require(_0x6ec5('0xe'));var jsforce=require(_0x6ec5('0xf'));var deskjs=require(_0x6ec5('0x10'));var toCsv=require(_0x6ec5('0x9'));var querystring=require(_0x6ec5('0x11'));var Papa=require(_0x6ec5('0x12'));var Redis=require('ioredis');var authService=require(_0x6ec5('0x13'));var qs=require(_0x6ec5('0x14'));var as=require(_0x6ec5('0x15'));var hardwareService=require(_0x6ec5('0x16'));var logger=require(_0x6ec5('0x17'))(_0x6ec5('0x18'));var utils=require(_0x6ec5('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x6ec5('0x1a'));var db=require(_0x6ec5('0x1b'))['db'];function respondWithStatusCode(_0x2b1f61,_0xb04ab6){_0xb04ab6=_0xb04ab6||0xcc;return function(_0x135aaf){if(_0x135aaf){return _0x2b1f61[_0x6ec5('0x1c')](_0xb04ab6);}return _0x2b1f61[_0x6ec5('0x1d')](_0xb04ab6)[_0x6ec5('0x1e')]();};}function respondWithResult(_0x5166ad,_0x3ed07a){_0x3ed07a=_0x3ed07a||0xc8;return function(_0x4d1510){if(_0x4d1510){return _0x5166ad[_0x6ec5('0x1d')](_0x3ed07a)[_0x6ec5('0x1f')](_0x4d1510);}};}function respondWithFilteredResult(_0x4a4e3c,_0x9fc0e7){return function(_0xdc0b10){if(_0xdc0b10){var _0x4d09fe=typeof _0x9fc0e7[_0x6ec5('0x20')]===_0x6ec5('0x21')&&typeof _0x9fc0e7[_0x6ec5('0x22')]===_0x6ec5('0x21');var _0x23b3e3=_0xdc0b10[_0x6ec5('0x23')];var _0x1dbee9=_0x4d09fe?0x0:_0x9fc0e7[_0x6ec5('0x20')];var _0x2608c0=_0x4d09fe?_0xdc0b10[_0x6ec5('0x23')]:_0x9fc0e7[_0x6ec5('0x20')]+_0x9fc0e7[_0x6ec5('0x22')];var _0x437f0f;if(_0x2608c0>=_0x23b3e3){_0x2608c0=_0x23b3e3;_0x437f0f=0xc8;}else{_0x437f0f=0xce;}_0x4a4e3c[_0x6ec5('0x1d')](_0x437f0f);return _0x4a4e3c[_0x6ec5('0x24')](_0x6ec5('0x25'),_0x1dbee9+'-'+_0x2608c0+'/'+_0x23b3e3)[_0x6ec5('0x1f')](_0xdc0b10);}return null;};}function patchUpdates(_0x4abd5d){return function(_0x272532){try{jsonpatch[_0x6ec5('0x26')](_0x272532,_0x4abd5d,!![]);}catch(_0xd045b){return BPromise[_0x6ec5('0x27')](_0xd045b);}return _0x272532[_0x6ec5('0x28')]();};}function saveUpdates(_0x38a821,_0x18243f){return function(_0x48733b){if(_0x48733b){return _0x48733b[_0x6ec5('0x29')](_0x38a821)[_0x6ec5('0x2a')](function(_0x358d18){return _0x358d18;});}return null;};}function removeEntity(_0x1560c6,_0x57060c){return function(_0x27f631){if(_0x27f631){return _0x27f631[_0x6ec5('0x2b')]()['then'](function(){_0x1560c6[_0x6ec5('0x1d')](0xcc)[_0x6ec5('0x1e')]();});}};}function handleEntityNotFound(_0xb4d269,_0x5078e8){return function(_0x1b779a){if(!_0x1b779a){_0xb4d269[_0x6ec5('0x1c')](0x194);}return _0x1b779a;};}function handleError(_0x197ea8,_0x462488){_0x462488=_0x462488||0x1f4;return function(_0x425fac){logger['error'](_0x425fac[_0x6ec5('0x2c')]);if(_0x425fac[_0x6ec5('0x2d')]){delete _0x425fac['name'];}_0x197ea8[_0x6ec5('0x1d')](_0x462488)[_0x6ec5('0x2e')](_0x425fac);};}exports['index']=function(_0x3d36cb,_0x3229db){var _0x3bbf16={},_0xa227ff={},_0x116659={'count':0x0,'rows':[]};var _0x5a30ba=_[_0x6ec5('0x2f')](db[_0x6ec5('0x30')][_0x6ec5('0x31')],function(_0x174164){return{'name':_0x174164[_0x6ec5('0x32')],'type':_0x174164[_0x6ec5('0x33')][_0x6ec5('0x34')]};});_0xa227ff['model']=_[_0x6ec5('0x2f')](_0x5a30ba,'name');_0xa227ff[_0x6ec5('0x35')]=_['keys'](_0x3d36cb[_0x6ec5('0x35')]);_0xa227ff[_0x6ec5('0x36')]=_['intersection'](_0xa227ff['model'],_0xa227ff[_0x6ec5('0x35')]);_0x3bbf16[_0x6ec5('0x37')]=_['intersection'](_0xa227ff[_0x6ec5('0x38')],qs[_0x6ec5('0x39')](_0x3d36cb['query'][_0x6ec5('0x39')]));_0x3bbf16[_0x6ec5('0x37')]=_0x3bbf16[_0x6ec5('0x37')][_0x6ec5('0x3a')]?_0x3bbf16[_0x6ec5('0x37')]:_0xa227ff[_0x6ec5('0x38')];if(!_0x3d36cb[_0x6ec5('0x35')][_0x6ec5('0x3b')]('nolimit')){_0x3bbf16[_0x6ec5('0x22')]=qs['limit'](_0x3d36cb[_0x6ec5('0x35')][_0x6ec5('0x22')]);_0x3bbf16[_0x6ec5('0x20')]=qs[_0x6ec5('0x20')](_0x3d36cb[_0x6ec5('0x35')][_0x6ec5('0x20')]);}_0x3bbf16[_0x6ec5('0x3c')]=qs[_0x6ec5('0x3d')](_0x3d36cb[_0x6ec5('0x35')][_0x6ec5('0x3d')]);_0x3bbf16[_0x6ec5('0x3e')]=qs['filters'](_['pick'](_0x3d36cb[_0x6ec5('0x35')],_0xa227ff['filters']),_0x5a30ba);if(_0x3d36cb[_0x6ec5('0x35')][_0x6ec5('0x3f')]){_0x3bbf16[_0x6ec5('0x3e')]=_[_0x6ec5('0x40')](_0x3bbf16[_0x6ec5('0x3e')],{'$or':_[_0x6ec5('0x2f')](_0x5a30ba,function(_0x2fa588){if(_0x2fa588['type']!==_0x6ec5('0x41')){var _0xc79bb3={};_0xc79bb3[_0x2fa588[_0x6ec5('0x2d')]]={'$like':'%'+_0x3d36cb[_0x6ec5('0x35')][_0x6ec5('0x3f')]+'%'};return _0xc79bb3;}})});}_0x3bbf16=_[_0x6ec5('0x40')]({},_0x3bbf16,_0x3d36cb[_0x6ec5('0x42')]);var _0x4354e4={'where':_0x3bbf16[_0x6ec5('0x3e')]};return db['FreshdeskField'][_0x6ec5('0x23')](_0x4354e4)['then'](function(_0x19ac12){_0x116659['count']=_0x19ac12;if(_0x3d36cb[_0x6ec5('0x35')][_0x6ec5('0x43')]){_0x3bbf16['include']=[{'all':!![]}];}return db[_0x6ec5('0x30')][_0x6ec5('0x44')](_0x3bbf16);})[_0x6ec5('0x2a')](function(_0x48c019){_0x116659[_0x6ec5('0x45')]=_0x48c019;return _0x116659;})[_0x6ec5('0x2a')](respondWithFilteredResult(_0x3229db,_0x3bbf16))['catch'](handleError(_0x3229db,null));};exports[_0x6ec5('0x46')]=function(_0x19055e,_0x22e6a2){var _0xb8324={'raw':!![],'where':{'id':_0x19055e[_0x6ec5('0x47')]['id']}},_0x43d858={};_0x43d858[_0x6ec5('0x38')]=_[_0x6ec5('0x48')](db[_0x6ec5('0x30')][_0x6ec5('0x31')]);_0x43d858[_0x6ec5('0x35')]=_['keys'](_0x19055e[_0x6ec5('0x35')]);_0x43d858[_0x6ec5('0x36')]=_[_0x6ec5('0x49')](_0x43d858[_0x6ec5('0x38')],_0x43d858['query']);_0xb8324[_0x6ec5('0x37')]=_[_0x6ec5('0x49')](_0x43d858['model'],qs[_0x6ec5('0x39')](_0x19055e['query'][_0x6ec5('0x39')]));_0xb8324[_0x6ec5('0x37')]=_0xb8324[_0x6ec5('0x37')][_0x6ec5('0x3a')]?_0xb8324['attributes']:_0x43d858['model'];if(_0x19055e[_0x6ec5('0x35')]['includeAll']){_0xb8324[_0x6ec5('0x4a')]=[{'all':!![]}];}_0xb8324=_[_0x6ec5('0x40')]({},_0xb8324,_0x19055e[_0x6ec5('0x42')]);return db[_0x6ec5('0x30')][_0x6ec5('0x4b')](_0xb8324)['then'](handleEntityNotFound(_0x22e6a2,null))['then'](respondWithResult(_0x22e6a2,null))[_0x6ec5('0x4c')](handleError(_0x22e6a2,null));};exports[_0x6ec5('0x4d')]=function(_0x5c3aa9,_0x45972a){return db[_0x6ec5('0x30')][_0x6ec5('0x4d')](_0x5c3aa9[_0x6ec5('0x4e')],{})[_0x6ec5('0x2a')](respondWithResult(_0x45972a,0xc9))[_0x6ec5('0x4c')](handleError(_0x45972a,null));};exports[_0x6ec5('0x29')]=function(_0xd265c,_0x1c5e2f){if(_0xd265c[_0x6ec5('0x4e')]['id']){delete _0xd265c[_0x6ec5('0x4e')]['id'];}return db['FreshdeskField'][_0x6ec5('0x4b')]({'where':{'id':_0xd265c['params']['id']}})[_0x6ec5('0x2a')](handleEntityNotFound(_0x1c5e2f,null))[_0x6ec5('0x2a')](saveUpdates(_0xd265c['body'],null))[_0x6ec5('0x2a')](respondWithResult(_0x1c5e2f,null))[_0x6ec5('0x4c')](handleError(_0x1c5e2f,null));};exports['destroy']=function(_0x23a64d,_0x21a910){return db['FreshdeskField']['find']({'where':{'id':_0x23a64d[_0x6ec5('0x47')]['id']}})['then'](handleEntityNotFound(_0x21a910,null))['then'](removeEntity(_0x21a910,null))[_0x6ec5('0x4c')](handleError(_0x21a910,null));}; \ No newline at end of file +var _0x7341=['keys','includeAll','find','catch','create','body','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskField','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes'];(function(_0x2bd55e,_0x5a1a96){var _0x59ad37=function(_0x2f9f67){while(--_0x2f9f67){_0x2bd55e['push'](_0x2bd55e['shift']());}};_0x59ad37(++_0x5a1a96);}(_0x7341,0xe4));var _0x1734=function(_0x224bac,_0x54a556){_0x224bac=_0x224bac-0x0;var _0x3bb888=_0x7341[_0x224bac];return _0x3bb888;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1734('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1734('0x1'));var moment=require(_0x1734('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1734('0x3'));var util=require(_0x1734('0x4'));var path=require(_0x1734('0x5'));var sox=require(_0x1734('0x6'));var csv=require(_0x1734('0x7'));var ejs=require(_0x1734('0x8'));var fs=require('fs');var fs_extra=require(_0x1734('0x9'));var _=require('lodash');var squel=require(_0x1734('0xa'));var crypto=require(_0x1734('0xb'));var jsforce=require(_0x1734('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1734('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1734('0xd'));var authService=require(_0x1734('0xe'));var qs=require(_0x1734('0xf'));var as=require(_0x1734('0x10'));var hardwareService=require(_0x1734('0x11'));var logger=require(_0x1734('0x12'))(_0x1734('0x13'));var utils=require(_0x1734('0x14'));var config=require(_0x1734('0x15'));var licenseUtil=require(_0x1734('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4391a1,_0x449ab1){_0x449ab1=_0x449ab1||0xcc;return function(_0x44de07){if(_0x44de07){return _0x4391a1[_0x1734('0x17')](_0x449ab1);}return _0x4391a1[_0x1734('0x18')](_0x449ab1)[_0x1734('0x19')]();};}function respondWithResult(_0x9e7cf5,_0xd2f288){_0xd2f288=_0xd2f288||0xc8;return function(_0xb90c22){if(_0xb90c22){return _0x9e7cf5[_0x1734('0x18')](_0xd2f288)[_0x1734('0x1a')](_0xb90c22);}};}function respondWithFilteredResult(_0x27679e,_0x2162c9){return function(_0x2dd53c){if(_0x2dd53c){var _0x3989a6=typeof _0x2162c9[_0x1734('0x1b')]===_0x1734('0x1c')&&typeof _0x2162c9[_0x1734('0x1d')]===_0x1734('0x1c');var _0x56756c=_0x2dd53c['count'];var _0x1fa9c0=_0x3989a6?0x0:_0x2162c9[_0x1734('0x1b')];var _0x4a86d1=_0x3989a6?_0x2dd53c[_0x1734('0x1e')]:_0x2162c9['offset']+_0x2162c9['limit'];var _0x5b2789;if(_0x4a86d1>=_0x56756c){_0x4a86d1=_0x56756c;_0x5b2789=0xc8;}else{_0x5b2789=0xce;}_0x27679e[_0x1734('0x18')](_0x5b2789);return _0x27679e['set'](_0x1734('0x1f'),_0x1fa9c0+'-'+_0x4a86d1+'/'+_0x56756c)[_0x1734('0x1a')](_0x2dd53c);}return null;};}function patchUpdates(_0x4fc4ed){return function(_0x54b1bd){try{jsonpatch['apply'](_0x54b1bd,_0x4fc4ed,!![]);}catch(_0x1e7401){return BPromise['reject'](_0x1e7401);}return _0x54b1bd[_0x1734('0x20')]();};}function saveUpdates(_0x5ad801,_0x215ae4){return function(_0x42485f){if(_0x42485f){return _0x42485f[_0x1734('0x21')](_0x5ad801)[_0x1734('0x22')](function(_0x29bb2c){return _0x29bb2c;});}return null;};}function removeEntity(_0x45593e,_0x4285ee){return function(_0x44e420){if(_0x44e420){return _0x44e420[_0x1734('0x23')]()['then'](function(){_0x45593e[_0x1734('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e0023,_0x7478fd){return function(_0x46b2fa){if(!_0x46b2fa){_0x5e0023[_0x1734('0x17')](0x194);}return _0x46b2fa;};}function handleError(_0x157e35,_0x4435ac){_0x4435ac=_0x4435ac||0x1f4;return function(_0x2a95e3){logger[_0x1734('0x24')](_0x2a95e3[_0x1734('0x25')]);if(_0x2a95e3['name']){delete _0x2a95e3[_0x1734('0x26')];}_0x157e35['status'](_0x4435ac)[_0x1734('0x27')](_0x2a95e3);};}exports[_0x1734('0x28')]=function(_0xfca2ad,_0x52411b){var _0x3eb31b={},_0x3f9abe={},_0xf2d136={'count':0x0,'rows':[]};var _0x50efce=_[_0x1734('0x29')](db[_0x1734('0x2a')]['rawAttributes'],function(_0x1bd659){return{'name':_0x1bd659[_0x1734('0x2b')],'type':_0x1bd659[_0x1734('0x2c')][_0x1734('0x2d')]};});_0x3f9abe['model']=_[_0x1734('0x29')](_0x50efce,_0x1734('0x26'));_0x3f9abe['query']=_['keys'](_0xfca2ad[_0x1734('0x2e')]);_0x3f9abe[_0x1734('0x2f')]=_[_0x1734('0x30')](_0x3f9abe[_0x1734('0x31')],_0x3f9abe[_0x1734('0x2e')]);_0x3eb31b[_0x1734('0x32')]=_[_0x1734('0x30')](_0x3f9abe[_0x1734('0x31')],qs[_0x1734('0x33')](_0xfca2ad[_0x1734('0x2e')][_0x1734('0x33')]));_0x3eb31b[_0x1734('0x32')]=_0x3eb31b[_0x1734('0x32')][_0x1734('0x34')]?_0x3eb31b[_0x1734('0x32')]:_0x3f9abe[_0x1734('0x31')];if(!_0xfca2ad[_0x1734('0x2e')]['hasOwnProperty'](_0x1734('0x35'))){_0x3eb31b['limit']=qs[_0x1734('0x1d')](_0xfca2ad[_0x1734('0x2e')][_0x1734('0x1d')]);_0x3eb31b[_0x1734('0x1b')]=qs[_0x1734('0x1b')](_0xfca2ad[_0x1734('0x2e')][_0x1734('0x1b')]);}_0x3eb31b[_0x1734('0x36')]=qs['sort'](_0xfca2ad[_0x1734('0x2e')][_0x1734('0x37')]);_0x3eb31b[_0x1734('0x38')]=qs[_0x1734('0x2f')](_[_0x1734('0x39')](_0xfca2ad[_0x1734('0x2e')],_0x3f9abe[_0x1734('0x2f')]),_0x50efce);if(_0xfca2ad['query'][_0x1734('0x3a')]){_0x3eb31b[_0x1734('0x38')]=_[_0x1734('0x3b')](_0x3eb31b[_0x1734('0x38')],{'$or':_[_0x1734('0x29')](_0x50efce,function(_0x177068){if(_0x177068[_0x1734('0x2c')]!==_0x1734('0x3c')){var _0x4a6602={};_0x4a6602[_0x177068[_0x1734('0x26')]]={'$like':'%'+_0xfca2ad['query'][_0x1734('0x3a')]+'%'};return _0x4a6602;}})});}_0x3eb31b=_[_0x1734('0x3b')]({},_0x3eb31b,_0xfca2ad[_0x1734('0x3d')]);var _0x387aab={'where':_0x3eb31b[_0x1734('0x38')]};return db[_0x1734('0x2a')][_0x1734('0x1e')](_0x387aab)[_0x1734('0x22')](function(_0x54b877){_0xf2d136[_0x1734('0x1e')]=_0x54b877;if(_0xfca2ad[_0x1734('0x2e')]['includeAll']){_0x3eb31b[_0x1734('0x3e')]=[{'all':!![]}];}return db[_0x1734('0x2a')][_0x1734('0x3f')](_0x3eb31b);})[_0x1734('0x22')](function(_0x5f34e1){_0xf2d136[_0x1734('0x40')]=_0x5f34e1;return _0xf2d136;})['then'](respondWithFilteredResult(_0x52411b,_0x3eb31b))['catch'](handleError(_0x52411b,null));};exports[_0x1734('0x41')]=function(_0x3549ad,_0x13e4ea){var _0x71f9c1={'raw':!![],'where':{'id':_0x3549ad[_0x1734('0x42')]['id']}},_0x4fc418={};_0x4fc418[_0x1734('0x31')]=_['keys'](db[_0x1734('0x2a')][_0x1734('0x43')]);_0x4fc418['query']=_[_0x1734('0x44')](_0x3549ad['query']);_0x4fc418[_0x1734('0x2f')]=_[_0x1734('0x30')](_0x4fc418[_0x1734('0x31')],_0x4fc418[_0x1734('0x2e')]);_0x71f9c1[_0x1734('0x32')]=_[_0x1734('0x30')](_0x4fc418[_0x1734('0x31')],qs['fields'](_0x3549ad[_0x1734('0x2e')][_0x1734('0x33')]));_0x71f9c1['attributes']=_0x71f9c1[_0x1734('0x32')][_0x1734('0x34')]?_0x71f9c1[_0x1734('0x32')]:_0x4fc418[_0x1734('0x31')];if(_0x3549ad['query'][_0x1734('0x45')]){_0x71f9c1[_0x1734('0x3e')]=[{'all':!![]}];}_0x71f9c1=_[_0x1734('0x3b')]({},_0x71f9c1,_0x3549ad['options']);return db[_0x1734('0x2a')][_0x1734('0x46')](_0x71f9c1)[_0x1734('0x22')](handleEntityNotFound(_0x13e4ea,null))[_0x1734('0x22')](respondWithResult(_0x13e4ea,null))[_0x1734('0x47')](handleError(_0x13e4ea,null));};exports[_0x1734('0x48')]=function(_0xc45b98,_0x8bfed7){return db[_0x1734('0x2a')][_0x1734('0x48')](_0xc45b98[_0x1734('0x49')],{})[_0x1734('0x22')](respondWithResult(_0x8bfed7,0xc9))[_0x1734('0x47')](handleError(_0x8bfed7,null));};exports[_0x1734('0x21')]=function(_0x470110,_0x121c8c){if(_0x470110[_0x1734('0x49')]['id']){delete _0x470110[_0x1734('0x49')]['id'];}return db['FreshdeskField'][_0x1734('0x46')]({'where':{'id':_0x470110['params']['id']}})[_0x1734('0x22')](handleEntityNotFound(_0x121c8c,null))[_0x1734('0x22')](saveUpdates(_0x470110[_0x1734('0x49')],null))[_0x1734('0x22')](respondWithResult(_0x121c8c,null))['catch'](handleError(_0x121c8c,null));};exports['destroy']=function(_0x294097,_0xe86f1f){return db['FreshdeskField'][_0x1734('0x46')]({'where':{'id':_0x294097[_0x1734('0x42')]['id']}})[_0x1734('0x22')](handleEntityNotFound(_0xe86f1f,null))[_0x1734('0x22')](removeEntity(_0xe86f1f,null))[_0x1734('0x47')](handleError(_0xe86f1f,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 479d266..05dfe8d 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 _0x3dd1=['../../config/logger','api','moment','request-promise','path','exports','define','FreshdeskField','int_freshdesk_fields','FieldId','lodash','util'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x3dd1,0x112));var _0x13dd=function(_0x293ea9,_0x3df09a){_0x293ea9=_0x293ea9-0x0;var _0x3d52f5=_0x3dd1[_0x293ea9];return _0x3d52f5;};'use strict';var _=require(_0x13dd('0x0'));var util=require(_0x13dd('0x1'));var logger=require(_0x13dd('0x2'))(_0x13dd('0x3'));var moment=require(_0x13dd('0x4'));var BPromise=require('bluebird');var rp=require(_0x13dd('0x5'));var fs=require('fs');var path=require(_0x13dd('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshdeskField.attributes');module[_0x13dd('0x7')]=function(_0x139e96,_0x579567){return _0x139e96[_0x13dd('0x8')](_0x13dd('0x9'),attributes,{'tableName':_0x13dd('0xa'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField',_0x13dd('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2739=['api','moment','bluebird','request-promise','rimraf','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','FieldId','util','../../config/logger'];(function(_0x5ca52d,_0x3a4a22){var _0x89e54e=function(_0x54bdf4){while(--_0x54bdf4){_0x5ca52d['push'](_0x5ca52d['shift']());}};_0x89e54e(++_0x3a4a22);}(_0x2739,0x14e));var _0x9273=function(_0x5b8bb9,_0x38dd57){_0x5b8bb9=_0x5b8bb9-0x0;var _0x1bf028=_0x2739[_0x5b8bb9];return _0x1bf028;};'use strict';var _=require('lodash');var util=require(_0x9273('0x0'));var logger=require(_0x9273('0x1'))(_0x9273('0x2'));var moment=require(_0x9273('0x3'));var BPromise=require(_0x9273('0x4'));var rp=require(_0x9273('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9273('0x6'));var config=require('../../config/environment');var attributes=require(_0x9273('0x7'));module[_0x9273('0x8')]=function(_0x435e46,_0x5a7e3b){return _0x435e46['define'](_0x9273('0x9'),attributes,{'tableName':_0x9273('0xa'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField',_0x9273('0xb')],'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 d865c3d..dcf4979 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 _0x262f=['lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch'];(function(_0x5737f3,_0x174729){var _0x29332f=function(_0x1380ef){while(--_0x1380ef){_0x5737f3['push'](_0x5737f3['shift']());}};_0x29332f(++_0x174729);}(_0x262f,0x64));var _0xf262=function(_0x3e37e6,_0x22dd74){_0x3e37e6=_0x3e37e6-0x0;var _0xea6828=_0x262f[_0x3e37e6];return _0xea6828;};'use strict';var _=require(_0xf262('0x0'));var util=require(_0xf262('0x1'));var moment=require(_0xf262('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf262('0x3'));var db=require(_0xf262('0x4'))['db'];var utils=require(_0xf262('0x5'));var logger=require(_0xf262('0x6'))(_0xf262('0x7'));var config=require(_0xf262('0x8'));var jayson=require(_0xf262('0x9'));var client=jayson['client'][_0xf262('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x206542,_0x3f81bd,_0x31036d){return new BPromise(function(_0x46ba19,_0xc6901a){return client['request'](_0x206542,_0x31036d)[_0xf262('0xb')](function(_0xcef9fa){logger[_0xf262('0xc')](_0xf262('0xd'),_0x3f81bd,'request\x20sent');logger[_0xf262('0xe')](_0xf262('0xf'),_0x3f81bd,_0xf262('0x10'),JSON['stringify'](_0xcef9fa));if(_0xcef9fa[_0xf262('0x11')]){if(_0xcef9fa[_0xf262('0x11')]['code']===0x1f4){logger[_0xf262('0x11')](_0xf262('0xd'),_0x3f81bd,_0xcef9fa[_0xf262('0x11')][_0xf262('0x12')]);return _0xc6901a(_0xcef9fa[_0xf262('0x11')][_0xf262('0x12')]);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x3f81bd,_0xcef9fa['error']['message']);return _0x46ba19(_0xcef9fa[_0xf262('0x11')][_0xf262('0x12')]);}else{logger[_0xf262('0xc')](_0xf262('0xd'),_0x3f81bd,'request\x20sent');_0x46ba19(_0xcef9fa['result']['message']);}})[_0xf262('0x13')](function(_0x57e68d){logger['error'](_0xf262('0xd'),_0x3f81bd,_0x57e68d);_0xc6901a(_0x57e68d);});});} \ No newline at end of file +var _0x80a1=['request','then','info','FreshdeskField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4935fa,_0x5ea8a7){var _0x106c76=function(_0xbe9d9b){while(--_0xbe9d9b){_0x4935fa['push'](_0x4935fa['shift']());}};_0x106c76(++_0x5ea8a7);}(_0x80a1,0x1d7));var _0x180a=function(_0x3e665d,_0xef863d){_0x3e665d=_0x3e665d-0x0;var _0x24a155=_0x80a1[_0x3e665d];return _0x24a155;};'use strict';var _=require(_0x180a('0x0'));var util=require(_0x180a('0x1'));var moment=require(_0x180a('0x2'));var BPromise=require(_0x180a('0x3'));var rs=require(_0x180a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x180a('0x5'))['db'];var utils=require(_0x180a('0x6'));var logger=require(_0x180a('0x7'))(_0x180a('0x8'));var config=require(_0x180a('0x9'));var jayson=require(_0x180a('0xa'));var client=jayson[_0x180a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a0f93,_0x45e823,_0x9717bf){return new BPromise(function(_0x38ba7b,_0xb3d300){return client[_0x180a('0xc')](_0x3a0f93,_0x9717bf)[_0x180a('0xd')](function(_0x177339){logger[_0x180a('0xe')](_0x180a('0xf'),_0x45e823,'request\x20sent');logger[_0x180a('0x10')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x45e823,_0x180a('0x11'),JSON[_0x180a('0x12')](_0x177339));if(_0x177339[_0x180a('0x13')]){if(_0x177339['error'][_0x180a('0x14')]===0x1f4){logger[_0x180a('0x13')]('FreshdeskField,\x20%s,\x20%s',_0x45e823,_0x177339[_0x180a('0x13')][_0x180a('0x15')]);return _0xb3d300(_0x177339[_0x180a('0x13')][_0x180a('0x15')]);}logger[_0x180a('0x13')]('FreshdeskField,\x20%s,\x20%s',_0x45e823,_0x177339[_0x180a('0x13')][_0x180a('0x15')]);return _0x38ba7b(_0x177339['error'][_0x180a('0x15')]);}else{logger['info'](_0x180a('0xf'),_0x45e823,_0x180a('0x11'));_0x38ba7b(_0x177339[_0x180a('0x16')]['message']);}})['catch'](function(_0x4d2a98){logger['error'](_0x180a('0xf'),_0x45e823,_0x4d2a98);_0xb3d300(_0x4d2a98);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 9d50fed..bf415ef 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 _0x0713=['destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','delete'];(function(_0x485621,_0x47cd67){var _0x3e409e=function(_0x4ffe0d){while(--_0x4ffe0d){_0x485621['push'](_0x485621['shift']());}};_0x3e409e(++_0x47cd67);}(_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'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['getConfigurations']);router[_0x3071('0x8')](_0x3071('0xe'),auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x10')]('/',auth['isAuthenticated'](),controller[_0x3071('0x11')]);router[_0x3071('0x10')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x12')]);router['put']('/:id',auth[_0x3071('0x9')](),controller['update']);router[_0x3071('0x13')](_0x3071('0xb'),auth['isAuthenticated'](),controller[_0x3071('0x14')]);module['exports']=router; \ No newline at end of file +var _0x57f8=['/:id','/:id/configurations','/:id/fields','post','create','addConfiguration','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated'];(function(_0x28f9c0,_0x2c977f){var _0x55bbc7=function(_0x5b5a1f){while(--_0x5b5a1f){_0x28f9c0['push'](_0x28f9c0['shift']());}};_0x55bbc7(++_0x2c977f);}(_0x57f8,0x198));var _0x857f=function(_0x504f4c,_0x1aedf0){_0x504f4c=_0x504f4c-0x0;var _0x3e7570=_0x57f8[_0x504f4c];return _0x3e7570;};'use strict';var multer=require('multer');var util=require(_0x857f('0x0'));var path=require(_0x857f('0x1'));var timeout=require(_0x857f('0x2'));var express=require(_0x857f('0x3'));var router=express[_0x857f('0x4')]();var fs_extra=require(_0x857f('0x5'));var auth=require(_0x857f('0x6'));var interaction=require(_0x857f('0x7'));var config=require(_0x857f('0x8'));var controller=require(_0x857f('0x9'));router[_0x857f('0xa')]('/',auth[_0x857f('0xb')](),controller['index']);router[_0x857f('0xa')](_0x857f('0xc'),auth[_0x857f('0xb')](),controller['show']);router[_0x857f('0xa')](_0x857f('0xd'),auth[_0x857f('0xb')](),controller['getConfigurations']);router[_0x857f('0xa')](_0x857f('0xe'),auth[_0x857f('0xb')](),controller['getFields']);router[_0x857f('0xf')]('/',auth[_0x857f('0xb')](),controller[_0x857f('0x10')]);router[_0x857f('0xf')](_0x857f('0xd'),auth[_0x857f('0xb')](),controller[_0x857f('0x11')]);router['put'](_0x857f('0xc'),auth[_0x857f('0xb')](),controller[_0x857f('0x12')]);router[_0x857f('0x13')](_0x857f('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x857f('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 04f068b..b0530bb 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 _0x4b17=['username','sequelize','STRING'];(function(_0x288084,_0x5751b1){var _0x433697=function(_0x58096c){while(--_0x58096c){_0x288084['push'](_0x288084['shift']());}};_0x433697(++_0x5751b1);}(_0x4b17,0x10f));var _0x74b1=function(_0x1265ed,_0x4b85e8){_0x1265ed=_0x1265ed-0x0;var _0x5ac459=_0x4b17[_0x1265ed];return _0x5ac459;};'use strict';var Sequelize=require(_0x74b1('0x0'));module['exports']={'name':{'type':Sequelize[_0x74b1('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x74b1('0x1')],'unique':_0x74b1('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x74b1('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x1c9a=['sequelize','STRING','username','remoteUri'];(function(_0x25ed8a,_0x3fe82b){var _0xa8d0ee=function(_0xbb0641){while(--_0xbb0641){_0x25ed8a['push'](_0x25ed8a['shift']());}};_0xa8d0ee(++_0x3fe82b);}(_0x1c9a,0x98));var _0xa1c9=function(_0x1392e2,_0x379b89){_0x1392e2=_0x1392e2-0x0;var _0x152369=_0x1c9a[_0x1392e2];return _0x152369;};'use strict';var Sequelize=require(_0xa1c9('0x0'));module['exports']={'name':{'type':Sequelize[_0xa1c9('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa1c9('0x1')],'unique':_0xa1c9('0x2')},'apiKey':{'type':Sequelize[_0xa1c9('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xa1c9('0x3')},'serverUrl':{'type':Sequelize[_0xa1c9('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index b89f0ec..6676135 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 _0xf4e2=['util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','map','FreshsalesAccount','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','catch','create','body','find','getConfigurations','findOne','FreshsalesConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','substring','lastIndexOf','GET','format','%s%s','apiKey','users','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xf4e2,0xcb));var _0x2f4e=function(_0x5cceb8,_0xa8e57a){_0x5cceb8=_0x5cceb8-0x0;var _0xeaf4be=_0xf4e2[_0x5cceb8];return _0xeaf4be;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2f4e('0x0'));var zipdir=require(_0x2f4e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2f4e('0x2'));var BPromise=require(_0x2f4e('0x3'));var Mustache=require(_0x2f4e('0x4'));var util=require(_0x2f4e('0x5'));var path=require(_0x2f4e('0x6'));var sox=require(_0x2f4e('0x7'));var csv=require('to-csv');var ejs=require(_0x2f4e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2f4e('0x9'));var squel=require(_0x2f4e('0xa'));var crypto=require(_0x2f4e('0xb'));var jsforce=require(_0x2f4e('0xc'));var deskjs=require(_0x2f4e('0xd'));var toCsv=require(_0x2f4e('0xe'));var querystring=require(_0x2f4e('0xf'));var Papa=require(_0x2f4e('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2f4e('0x11'));var as=require(_0x2f4e('0x12'));var hardwareService=require(_0x2f4e('0x13'));var logger=require(_0x2f4e('0x14'))(_0x2f4e('0x15'));var utils=require(_0x2f4e('0x16'));var config=require(_0x2f4e('0x17'));var licenseUtil=require(_0x2f4e('0x18'));var db=require(_0x2f4e('0x19'))['db'];var integrations=require(_0x2f4e('0x1a'));function respondWithStatusCode(_0x2d9c48,_0x4910a5){_0x4910a5=_0x4910a5||0xcc;return function(_0x343f85){if(_0x343f85){return _0x2d9c48[_0x2f4e('0x1b')](_0x4910a5);}return _0x2d9c48[_0x2f4e('0x1c')](_0x4910a5)['end']();};}function respondWithResult(_0x349b8b,_0x1ae5b1){_0x1ae5b1=_0x1ae5b1||0xc8;return function(_0x5ea031){if(_0x5ea031){return _0x349b8b[_0x2f4e('0x1c')](_0x1ae5b1)[_0x2f4e('0x1d')](_0x5ea031);}};}function respondWithFilteredResult(_0xaf0f,_0x5db64e){return function(_0x3c4840){if(_0x3c4840){var _0x40e153=typeof _0x5db64e[_0x2f4e('0x1e')]===_0x2f4e('0x1f')&&typeof _0x5db64e[_0x2f4e('0x20')]==='undefined';var _0x4b0ca5=_0x3c4840['count'];var _0x1aa4f0=_0x40e153?0x0:_0x5db64e['offset'];var _0xf3230f=_0x40e153?_0x3c4840[_0x2f4e('0x21')]:_0x5db64e[_0x2f4e('0x1e')]+_0x5db64e[_0x2f4e('0x20')];var _0x12888d;if(_0xf3230f>=_0x4b0ca5){_0xf3230f=_0x4b0ca5;_0x12888d=0xc8;}else{_0x12888d=0xce;}_0xaf0f[_0x2f4e('0x1c')](_0x12888d);return _0xaf0f[_0x2f4e('0x22')](_0x2f4e('0x23'),_0x1aa4f0+'-'+_0xf3230f+'/'+_0x4b0ca5)[_0x2f4e('0x1d')](_0x3c4840);}return null;};}function patchUpdates(_0x3fa5d8){return function(_0x4bba1e){try{jsonpatch[_0x2f4e('0x24')](_0x4bba1e,_0x3fa5d8,!![]);}catch(_0x2498cd){return BPromise['reject'](_0x2498cd);}return _0x4bba1e[_0x2f4e('0x25')]();};}function saveUpdates(_0x142e78,_0x46727d){return function(_0x2c1f9f){if(_0x2c1f9f){return _0x2c1f9f[_0x2f4e('0x26')](_0x142e78)[_0x2f4e('0x27')](function(_0x2d6b98){return _0x2d6b98;});}return null;};}function removeEntity(_0x278612,_0x1a0fe7){return function(_0x177e4d){if(_0x177e4d){return _0x177e4d[_0x2f4e('0x28')]()[_0x2f4e('0x27')](function(){_0x278612[_0x2f4e('0x1c')](0xcc)[_0x2f4e('0x29')]();});}};}function handleEntityNotFound(_0x41ac28,_0x2f02da){return function(_0x20a98c){if(!_0x20a98c){_0x41ac28[_0x2f4e('0x1b')](0x194);}return _0x20a98c;};}function handleError(_0x39b65d,_0x4507f9){_0x4507f9=_0x4507f9||0x1f4;return function(_0x2d8f0d){logger[_0x2f4e('0x2a')](_0x2d8f0d[_0x2f4e('0x2b')]);if(_0x2d8f0d[_0x2f4e('0x2c')]){delete _0x2d8f0d[_0x2f4e('0x2c')];}_0x39b65d[_0x2f4e('0x1c')](_0x4507f9)[_0x2f4e('0x2d')](_0x2d8f0d);};}exports['index']=function(_0x2801a1,_0x37c56e){var _0x5d5297={},_0x2b4415={},_0x5d345b={'count':0x0,'rows':[]};var _0x388b00=_[_0x2f4e('0x2e')](db[_0x2f4e('0x2f')]['rawAttributes'],function(_0x10dc0e){return{'name':_0x10dc0e[_0x2f4e('0x30')],'type':_0x10dc0e[_0x2f4e('0x31')][_0x2f4e('0x32')]};});_0x2b4415[_0x2f4e('0x33')]=_[_0x2f4e('0x2e')](_0x388b00,'name');_0x2b4415[_0x2f4e('0x34')]=_[_0x2f4e('0x35')](_0x2801a1[_0x2f4e('0x34')]);_0x2b4415['filters']=_[_0x2f4e('0x36')](_0x2b4415[_0x2f4e('0x33')],_0x2b4415[_0x2f4e('0x34')]);_0x5d5297[_0x2f4e('0x37')]=_[_0x2f4e('0x36')](_0x2b4415['model'],qs[_0x2f4e('0x38')](_0x2801a1['query'][_0x2f4e('0x38')]));_0x5d5297[_0x2f4e('0x37')]=_0x5d5297[_0x2f4e('0x37')][_0x2f4e('0x39')]?_0x5d5297[_0x2f4e('0x37')]:_0x2b4415[_0x2f4e('0x33')];if(!_0x2801a1['query']['hasOwnProperty'](_0x2f4e('0x3a'))){_0x5d5297[_0x2f4e('0x20')]=qs[_0x2f4e('0x20')](_0x2801a1[_0x2f4e('0x34')][_0x2f4e('0x20')]);_0x5d5297[_0x2f4e('0x1e')]=qs['offset'](_0x2801a1[_0x2f4e('0x34')]['offset']);}_0x5d5297['order']=qs['sort'](_0x2801a1[_0x2f4e('0x34')][_0x2f4e('0x3b')]);_0x5d5297['where']=qs[_0x2f4e('0x3c')](_[_0x2f4e('0x3d')](_0x2801a1[_0x2f4e('0x34')],_0x2b4415[_0x2f4e('0x3c')]),_0x388b00);if(_0x2801a1[_0x2f4e('0x34')][_0x2f4e('0x3e')]){_0x5d5297['where']=_[_0x2f4e('0x3f')](_0x5d5297[_0x2f4e('0x40')],{'$or':_[_0x2f4e('0x2e')](_0x388b00,function(_0x4a3243){if(_0x4a3243[_0x2f4e('0x31')]!==_0x2f4e('0x41')){var _0x13fc37={};_0x13fc37[_0x4a3243[_0x2f4e('0x2c')]]={'$like':'%'+_0x2801a1[_0x2f4e('0x34')][_0x2f4e('0x3e')]+'%'};return _0x13fc37;}})});}_0x5d5297=_[_0x2f4e('0x3f')]({},_0x5d5297,_0x2801a1[_0x2f4e('0x42')]);var _0x383d2b={'where':_0x5d5297[_0x2f4e('0x40')]};return db[_0x2f4e('0x2f')][_0x2f4e('0x21')](_0x383d2b)[_0x2f4e('0x27')](function(_0x237a67){_0x5d345b[_0x2f4e('0x21')]=_0x237a67;if(_0x2801a1[_0x2f4e('0x34')][_0x2f4e('0x43')]){_0x5d5297[_0x2f4e('0x44')]=[{'all':!![]}];}return db[_0x2f4e('0x2f')][_0x2f4e('0x45')](_0x5d5297);})[_0x2f4e('0x27')](function(_0x117c34){_0x5d345b['rows']=_0x117c34;return _0x5d345b;})['then'](respondWithFilteredResult(_0x37c56e,_0x5d5297))['catch'](handleError(_0x37c56e,null));};exports[_0x2f4e('0x46')]=function(_0x1154db,_0x3b2d37){var _0xb8521f={'raw':![],'where':{'id':_0x1154db[_0x2f4e('0x47')]['id']}},_0x33b2a4={};_0x33b2a4['model']=_['keys'](db[_0x2f4e('0x2f')][_0x2f4e('0x48')]);_0x33b2a4[_0x2f4e('0x34')]=_[_0x2f4e('0x35')](_0x1154db['query']);_0x33b2a4[_0x2f4e('0x3c')]=_[_0x2f4e('0x36')](_0x33b2a4[_0x2f4e('0x33')],_0x33b2a4['query']);_0xb8521f['attributes']=_[_0x2f4e('0x36')](_0x33b2a4['model'],qs['fields'](_0x1154db[_0x2f4e('0x34')][_0x2f4e('0x38')]));_0xb8521f[_0x2f4e('0x37')]=_0xb8521f['attributes']['length']?_0xb8521f[_0x2f4e('0x37')]:_0x33b2a4['model'];if(_0x1154db[_0x2f4e('0x34')][_0x2f4e('0x43')]){_0xb8521f[_0x2f4e('0x44')]=[{'all':!![]}];}_0xb8521f=_[_0x2f4e('0x3f')]({},_0xb8521f,_0x1154db['options']);return db[_0x2f4e('0x2f')]['find'](_0xb8521f)[_0x2f4e('0x27')](handleEntityNotFound(_0x3b2d37,null))['then'](respondWithResult(_0x3b2d37,null))[_0x2f4e('0x49')](handleError(_0x3b2d37,null));};exports[_0x2f4e('0x4a')]=function(_0x2f7c36,_0x3dc1a9){return db[_0x2f4e('0x2f')]['create'](_0x2f7c36['body'],{})['then'](respondWithResult(_0x3dc1a9,0xc9))[_0x2f4e('0x49')](handleError(_0x3dc1a9,null));};exports[_0x2f4e('0x26')]=function(_0x1b9eb8,_0x47dd07){if(_0x1b9eb8[_0x2f4e('0x4b')]['id']){delete _0x1b9eb8['body']['id'];}return db[_0x2f4e('0x2f')]['find']({'where':{'id':_0x1b9eb8[_0x2f4e('0x47')]['id']}})['then'](handleEntityNotFound(_0x47dd07,null))[_0x2f4e('0x27')](saveUpdates(_0x1b9eb8['body'],null))[_0x2f4e('0x27')](respondWithResult(_0x47dd07,null))[_0x2f4e('0x49')](handleError(_0x47dd07,null));};exports[_0x2f4e('0x28')]=function(_0x19b045,_0x5c1dc2){return db[_0x2f4e('0x2f')][_0x2f4e('0x4c')]({'where':{'id':_0x19b045[_0x2f4e('0x47')]['id']}})[_0x2f4e('0x27')](handleEntityNotFound(_0x5c1dc2,null))[_0x2f4e('0x27')](removeEntity(_0x5c1dc2,null))[_0x2f4e('0x49')](handleError(_0x5c1dc2,null));};exports[_0x2f4e('0x4d')]=function(_0x18bc29,_0x246dbc,_0x854631){var _0x5bb7b1={};var _0x341072={};var _0x293df6;var _0x831daa;return db[_0x2f4e('0x2f')][_0x2f4e('0x4e')]({'where':{'id':_0x18bc29[_0x2f4e('0x47')]['id']}})[_0x2f4e('0x27')](handleEntityNotFound(_0x246dbc,null))[_0x2f4e('0x27')](function(_0x14cbcf){if(_0x14cbcf){_0x293df6=_0x14cbcf;_0x341072[_0x2f4e('0x33')]=_[_0x2f4e('0x35')](db[_0x2f4e('0x4f')]['rawAttributes']);_0x341072[_0x2f4e('0x34')]=_[_0x2f4e('0x35')](_0x18bc29[_0x2f4e('0x34')]);_0x341072[_0x2f4e('0x3c')]=_['intersection'](_0x341072['model'],_0x341072['query']);_0x5bb7b1[_0x2f4e('0x37')]=_[_0x2f4e('0x36')](_0x341072[_0x2f4e('0x33')],qs['fields'](_0x18bc29[_0x2f4e('0x34')][_0x2f4e('0x38')]));_0x5bb7b1[_0x2f4e('0x37')]=_0x5bb7b1['attributes']['length']?_0x5bb7b1[_0x2f4e('0x37')]:_0x341072['model'];_0x5bb7b1['order']=qs[_0x2f4e('0x3b')](_0x18bc29[_0x2f4e('0x34')][_0x2f4e('0x3b')]);_0x5bb7b1[_0x2f4e('0x40')]=qs[_0x2f4e('0x3c')](_[_0x2f4e('0x3d')](_0x18bc29[_0x2f4e('0x34')],_0x341072[_0x2f4e('0x3c')]));if(_0x18bc29[_0x2f4e('0x34')]['filter']){_0x5bb7b1[_0x2f4e('0x40')]=_[_0x2f4e('0x3f')](_0x5bb7b1['where'],{'$or':_[_0x2f4e('0x2e')](_0x5bb7b1[_0x2f4e('0x37')],function(_0x4e93f1){var _0x449427={};_0x449427[_0x4e93f1]={'$like':'%'+_0x18bc29[_0x2f4e('0x34')]['filter']+'%'};return _0x449427;})});}_0x5bb7b1=_[_0x2f4e('0x3f')]({},_0x5bb7b1,_0x18bc29[_0x2f4e('0x42')]);return _0x293df6[_0x2f4e('0x4d')](_0x5bb7b1);}})[_0x2f4e('0x27')](function(_0x4b5ab6){if(_0x4b5ab6){_0x831daa=_0x4b5ab6[_0x2f4e('0x39')];if(!_0x18bc29[_0x2f4e('0x34')][_0x2f4e('0x50')](_0x2f4e('0x3a'))){_0x5bb7b1[_0x2f4e('0x20')]=qs[_0x2f4e('0x20')](_0x18bc29[_0x2f4e('0x34')][_0x2f4e('0x20')]);_0x5bb7b1[_0x2f4e('0x1e')]=qs['offset'](_0x18bc29['query'][_0x2f4e('0x1e')]);}return _0x293df6[_0x2f4e('0x4d')](_0x5bb7b1);}})[_0x2f4e('0x27')](function(_0x26d845){if(_0x26d845){return _0x26d845?{'count':_0x831daa,'rows':_0x26d845}:null;}})[_0x2f4e('0x27')](respondWithResult(_0x246dbc,null))[_0x2f4e('0x49')](handleError(_0x246dbc,null));};exports[_0x2f4e('0x51')]=function(_0x22026b,_0x49bcf9,_0x10113a){if(_0x22026b[_0x2f4e('0x4b')]['id']){delete _0x22026b[_0x2f4e('0x4b')]['id'];}return db[_0x2f4e('0x2f')][_0x2f4e('0x4e')]({'where':{'id':_0x22026b[_0x2f4e('0x47')]['id']}})['then'](handleEntityNotFound(_0x49bcf9,null))[_0x2f4e('0x27')](function(_0x1681f5){if(_0x1681f5){_0x22026b[_0x2f4e('0x4b')][_0x2f4e('0x52')]=_0x1681f5['id'];_0x22026b['body'][_0x2f4e('0x53')]=integrations[_0x2f4e('0x54')](_0x22026b[_0x2f4e('0x4b')]['channel'],_0x22026b['body'][_0x2f4e('0x31')]);_0x22026b['body'][_0x2f4e('0x55')]=integrations[_0x2f4e('0x56')](_0x22026b[_0x2f4e('0x4b')]['channel'],_0x22026b[_0x2f4e('0x4b')][_0x2f4e('0x31')]);return db[_0x2f4e('0x4f')][_0x2f4e('0x4a')](_0x22026b[_0x2f4e('0x4b')],{'include':[{'model':db[_0x2f4e('0x57')],'as':_0x2f4e('0x53')},{'model':db['FreshsalesField'],'as':_0x2f4e('0x55')}]});}return null;})[_0x2f4e('0x27')](respondWithResult(_0x49bcf9,null))[_0x2f4e('0x49')](handleError(_0x49bcf9,null));};exports[_0x2f4e('0x58')]=function(_0x59bbd1,_0x1e26ff,_0x243ec1){var _0x42ab31='';var _0x16873e='';return db['FreshsalesAccount'][_0x2f4e('0x4e')]({'where':{'id':_0x59bbd1['params']['id']},'attributes':['id',_0x2f4e('0x59'),_0x2f4e('0x5a'),'apiKey']})[_0x2f4e('0x27')](handleEntityNotFound(_0x1e26ff,null))[_0x2f4e('0x27')](function(_0x3e5017){if(_0x3e5017){_0x16873e=_0x3e5017[_0x2f4e('0x59')];_0x42ab31=_0x3e5017[_0x2f4e('0x5a')];var _0x5e96b8=_0x3e5017[_0x2f4e('0x5a')]['slice'](-0x1);if(_0x5e96b8==='/'){_0x42ab31=_0x42ab31[_0x2f4e('0x5b')](0x0,_0x42ab31[_0x2f4e('0x5c')](_0x5e96b8));}return rp({'method':_0x2f4e('0x5d'),'uri':util[_0x2f4e('0x5e')](_0x2f4e('0x5f'),_0x42ab31,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x3e5017[_0x2f4e('0x60')]},'json':!![]});}})['then'](function(_0x3bcc90){if(_0x3bcc90){var _0x3ed699=_0x3bcc90[_0x2f4e('0x61')];var _0x5524c3=![];var _0x3a08d2=null;for(_0x3a08d2=0x0;_0x3a08d2<_0x3ed699['length'];_0x3a08d2++){if(_0x3ed699[_0x3a08d2]['email']===_0x16873e){_0x5524c3=!![];}}if(_0x5524c3){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x2f4e('0x62')});}}})['then'](respondWithResult(_0x1e26ff,null))[_0x2f4e('0x49')](function(_0x1aa693){var _0x4dd6a7=_0x59bbd1[_0x2f4e('0x34')][_0x2f4e('0x63')]?0x1f4:_0x1aa693[_0x2f4e('0x64')]||0x1f4;logger[_0x2f4e('0x2a')](_0x2f4e('0x65'),'getFields',_0x4dd6a7,JSON[_0x2f4e('0x66')](_0x1aa693));delete _0x1aa693['name'];if(_0x4dd6a7===0x191){_0x4dd6a7=0x190;}_0x1e26ff[_0x2f4e('0x1c')](_0x4dd6a7)['send'](_0x59bbd1[_0x2f4e('0x34')][_0x2f4e('0x63')]?{'message':_0x2f4e('0x67'),'statusCode':_0x1aa693[_0x2f4e('0x64')]}:_0x1aa693);});}; \ No newline at end of file +var _0x8b10=['destroy','getConfigurations','findOne','pick','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshsalesConfiguration','FreshsalesField','getFields','username','apiKey','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Requested\x20Resource\x20not\x20Found','test','error','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','options','findAll','then','catch','show','params','fields','includeAll','find','create','body'];(function(_0x5b604f,_0x1e5a25){var _0x33df77=function(_0xe359c4){while(--_0xe359c4){_0x5b604f['push'](_0x5b604f['shift']());}};_0x33df77(++_0x1e5a25);}(_0x8b10,0x7b));var _0x08b1=function(_0x485bb8,_0x3757e7){_0x485bb8=_0x485bb8-0x0;var _0x5d5c74=_0x8b10[_0x485bb8];return _0x5d5c74;};'use strict';var emlformat=require(_0x08b1('0x0'));var rimraf=require(_0x08b1('0x1'));var zipdir=require(_0x08b1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x08b1('0x3'));var moment=require(_0x08b1('0x4'));var BPromise=require(_0x08b1('0x5'));var Mustache=require(_0x08b1('0x6'));var util=require('util');var path=require('path');var sox=require(_0x08b1('0x7'));var csv=require(_0x08b1('0x8'));var ejs=require(_0x08b1('0x9'));var fs=require('fs');var fs_extra=require(_0x08b1('0xa'));var _=require(_0x08b1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x08b1('0xc'));var deskjs=require(_0x08b1('0xd'));var toCsv=require(_0x08b1('0x8'));var querystring=require(_0x08b1('0xe'));var Papa=require('papaparse');var Redis=require(_0x08b1('0xf'));var authService=require(_0x08b1('0x10'));var qs=require(_0x08b1('0x11'));var as=require(_0x08b1('0x12'));var hardwareService=require(_0x08b1('0x13'));var logger=require('../../config/logger')(_0x08b1('0x14'));var utils=require('../../config/utils');var config=require(_0x08b1('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x08b1('0x16'));function respondWithStatusCode(_0x2d4e3c,_0x5eaa84){_0x5eaa84=_0x5eaa84||0xcc;return function(_0x45aeeb){if(_0x45aeeb){return _0x2d4e3c[_0x08b1('0x17')](_0x5eaa84);}return _0x2d4e3c[_0x08b1('0x18')](_0x5eaa84)[_0x08b1('0x19')]();};}function respondWithResult(_0x1a4838,_0x5ea837){_0x5ea837=_0x5ea837||0xc8;return function(_0x18ad90){if(_0x18ad90){return _0x1a4838[_0x08b1('0x18')](_0x5ea837)[_0x08b1('0x1a')](_0x18ad90);}};}function respondWithFilteredResult(_0x5b6586,_0xfa213f){return function(_0x5244c5){if(_0x5244c5){var _0x413bf0=typeof _0xfa213f[_0x08b1('0x1b')]===_0x08b1('0x1c')&&typeof _0xfa213f['limit']===_0x08b1('0x1c');var _0xe97be7=_0x5244c5[_0x08b1('0x1d')];var _0x5a024f=_0x413bf0?0x0:_0xfa213f[_0x08b1('0x1b')];var _0x36f58e=_0x413bf0?_0x5244c5[_0x08b1('0x1d')]:_0xfa213f['offset']+_0xfa213f[_0x08b1('0x1e')];var _0x26cd6c;if(_0x36f58e>=_0xe97be7){_0x36f58e=_0xe97be7;_0x26cd6c=0xc8;}else{_0x26cd6c=0xce;}_0x5b6586[_0x08b1('0x18')](_0x26cd6c);return _0x5b6586['set'](_0x08b1('0x1f'),_0x5a024f+'-'+_0x36f58e+'/'+_0xe97be7)[_0x08b1('0x1a')](_0x5244c5);}return null;};}function patchUpdates(_0x439647){return function(_0x8b89a4){try{jsonpatch['apply'](_0x8b89a4,_0x439647,!![]);}catch(_0x279bab){return BPromise[_0x08b1('0x20')](_0x279bab);}return _0x8b89a4[_0x08b1('0x21')]();};}function saveUpdates(_0x2d787f,_0x3c4ced){return function(_0x2bfd99){if(_0x2bfd99){return _0x2bfd99[_0x08b1('0x22')](_0x2d787f)['then'](function(_0x5d2dc1){return _0x5d2dc1;});}return null;};}function removeEntity(_0x2c4706,_0x3c4127){return function(_0x5203d5){if(_0x5203d5){return _0x5203d5['destroy']()['then'](function(){_0x2c4706[_0x08b1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45e4f9,_0x1d6e03){return function(_0x48075d){if(!_0x48075d){_0x45e4f9[_0x08b1('0x17')](0x194);}return _0x48075d;};}function handleError(_0x3e5132,_0x2514a5){_0x2514a5=_0x2514a5||0x1f4;return function(_0x1d7af8){logger['error'](_0x1d7af8[_0x08b1('0x23')]);if(_0x1d7af8['name']){delete _0x1d7af8[_0x08b1('0x24')];}_0x3e5132[_0x08b1('0x18')](_0x2514a5)[_0x08b1('0x25')](_0x1d7af8);};}exports[_0x08b1('0x26')]=function(_0x275e42,_0xa8610b){var _0x1e8f01={},_0x4c24c7={},_0x40f01f={'count':0x0,'rows':[]};var _0x38cf8d=_[_0x08b1('0x27')](db[_0x08b1('0x28')][_0x08b1('0x29')],function(_0x5bc2e0){return{'name':_0x5bc2e0[_0x08b1('0x2a')],'type':_0x5bc2e0['type']['key']};});_0x4c24c7['model']=_[_0x08b1('0x27')](_0x38cf8d,'name');_0x4c24c7['query']=_[_0x08b1('0x2b')](_0x275e42[_0x08b1('0x2c')]);_0x4c24c7[_0x08b1('0x2d')]=_[_0x08b1('0x2e')](_0x4c24c7[_0x08b1('0x2f')],_0x4c24c7[_0x08b1('0x2c')]);_0x1e8f01['attributes']=_[_0x08b1('0x2e')](_0x4c24c7[_0x08b1('0x2f')],qs['fields'](_0x275e42[_0x08b1('0x2c')]['fields']));_0x1e8f01[_0x08b1('0x30')]=_0x1e8f01[_0x08b1('0x30')][_0x08b1('0x31')]?_0x1e8f01[_0x08b1('0x30')]:_0x4c24c7[_0x08b1('0x2f')];if(!_0x275e42[_0x08b1('0x2c')][_0x08b1('0x32')](_0x08b1('0x33'))){_0x1e8f01[_0x08b1('0x1e')]=qs[_0x08b1('0x1e')](_0x275e42[_0x08b1('0x2c')][_0x08b1('0x1e')]);_0x1e8f01[_0x08b1('0x1b')]=qs['offset'](_0x275e42[_0x08b1('0x2c')][_0x08b1('0x1b')]);}_0x1e8f01[_0x08b1('0x34')]=qs[_0x08b1('0x35')](_0x275e42['query'][_0x08b1('0x35')]);_0x1e8f01[_0x08b1('0x36')]=qs[_0x08b1('0x2d')](_['pick'](_0x275e42['query'],_0x4c24c7[_0x08b1('0x2d')]),_0x38cf8d);if(_0x275e42['query'][_0x08b1('0x37')]){_0x1e8f01[_0x08b1('0x36')]=_['merge'](_0x1e8f01[_0x08b1('0x36')],{'$or':_[_0x08b1('0x27')](_0x38cf8d,function(_0x558e24){if(_0x558e24[_0x08b1('0x38')]!=='VIRTUAL'){var _0x1c20a4={};_0x1c20a4[_0x558e24[_0x08b1('0x24')]]={'$like':'%'+_0x275e42['query'][_0x08b1('0x37')]+'%'};return _0x1c20a4;}})});}_0x1e8f01=_[_0x08b1('0x39')]({},_0x1e8f01,_0x275e42[_0x08b1('0x3a')]);var _0x39098b={'where':_0x1e8f01[_0x08b1('0x36')]};return db['FreshsalesAccount'][_0x08b1('0x1d')](_0x39098b)['then'](function(_0x5df33a){_0x40f01f['count']=_0x5df33a;if(_0x275e42[_0x08b1('0x2c')]['includeAll']){_0x1e8f01['include']=[{'all':!![]}];}return db[_0x08b1('0x28')][_0x08b1('0x3b')](_0x1e8f01);})[_0x08b1('0x3c')](function(_0x5c5f2b){_0x40f01f['rows']=_0x5c5f2b;return _0x40f01f;})[_0x08b1('0x3c')](respondWithFilteredResult(_0xa8610b,_0x1e8f01))[_0x08b1('0x3d')](handleError(_0xa8610b,null));};exports[_0x08b1('0x3e')]=function(_0x359847,_0x245a52){var _0x18ca83={'raw':![],'where':{'id':_0x359847[_0x08b1('0x3f')]['id']}},_0xd0c378={};_0xd0c378['model']=_[_0x08b1('0x2b')](db[_0x08b1('0x28')][_0x08b1('0x29')]);_0xd0c378[_0x08b1('0x2c')]=_[_0x08b1('0x2b')](_0x359847[_0x08b1('0x2c')]);_0xd0c378['filters']=_[_0x08b1('0x2e')](_0xd0c378[_0x08b1('0x2f')],_0xd0c378['query']);_0x18ca83[_0x08b1('0x30')]=_['intersection'](_0xd0c378[_0x08b1('0x2f')],qs[_0x08b1('0x40')](_0x359847['query'][_0x08b1('0x40')]));_0x18ca83['attributes']=_0x18ca83['attributes'][_0x08b1('0x31')]?_0x18ca83[_0x08b1('0x30')]:_0xd0c378['model'];if(_0x359847['query'][_0x08b1('0x41')]){_0x18ca83['include']=[{'all':!![]}];}_0x18ca83=_[_0x08b1('0x39')]({},_0x18ca83,_0x359847[_0x08b1('0x3a')]);return db[_0x08b1('0x28')][_0x08b1('0x42')](_0x18ca83)[_0x08b1('0x3c')](handleEntityNotFound(_0x245a52,null))[_0x08b1('0x3c')](respondWithResult(_0x245a52,null))[_0x08b1('0x3d')](handleError(_0x245a52,null));};exports[_0x08b1('0x43')]=function(_0x1c2daa,_0x2b2318){return db[_0x08b1('0x28')][_0x08b1('0x43')](_0x1c2daa[_0x08b1('0x44')],{})['then'](respondWithResult(_0x2b2318,0xc9))['catch'](handleError(_0x2b2318,null));};exports[_0x08b1('0x22')]=function(_0x1aaaa5,_0x5f005c){if(_0x1aaaa5[_0x08b1('0x44')]['id']){delete _0x1aaaa5[_0x08b1('0x44')]['id'];}return db[_0x08b1('0x28')][_0x08b1('0x42')]({'where':{'id':_0x1aaaa5[_0x08b1('0x3f')]['id']}})[_0x08b1('0x3c')](handleEntityNotFound(_0x5f005c,null))[_0x08b1('0x3c')](saveUpdates(_0x1aaaa5[_0x08b1('0x44')],null))['then'](respondWithResult(_0x5f005c,null))['catch'](handleError(_0x5f005c,null));};exports[_0x08b1('0x45')]=function(_0x10fade,_0x22bfe8){return db[_0x08b1('0x28')]['find']({'where':{'id':_0x10fade['params']['id']}})['then'](handleEntityNotFound(_0x22bfe8,null))[_0x08b1('0x3c')](removeEntity(_0x22bfe8,null))['catch'](handleError(_0x22bfe8,null));};exports[_0x08b1('0x46')]=function(_0x539024,_0x337a63,_0x4bce04){var _0x5ade05={};var _0x348a73={};var _0x495b35;var _0x14dbf4;return db[_0x08b1('0x28')][_0x08b1('0x47')]({'where':{'id':_0x539024['params']['id']}})['then'](handleEntityNotFound(_0x337a63,null))[_0x08b1('0x3c')](function(_0x144780){if(_0x144780){_0x495b35=_0x144780;_0x348a73[_0x08b1('0x2f')]=_[_0x08b1('0x2b')](db['FreshsalesConfiguration'][_0x08b1('0x29')]);_0x348a73[_0x08b1('0x2c')]=_[_0x08b1('0x2b')](_0x539024['query']);_0x348a73['filters']=_['intersection'](_0x348a73['model'],_0x348a73[_0x08b1('0x2c')]);_0x5ade05[_0x08b1('0x30')]=_[_0x08b1('0x2e')](_0x348a73[_0x08b1('0x2f')],qs['fields'](_0x539024['query'][_0x08b1('0x40')]));_0x5ade05[_0x08b1('0x30')]=_0x5ade05[_0x08b1('0x30')][_0x08b1('0x31')]?_0x5ade05[_0x08b1('0x30')]:_0x348a73[_0x08b1('0x2f')];_0x5ade05[_0x08b1('0x34')]=qs[_0x08b1('0x35')](_0x539024[_0x08b1('0x2c')]['sort']);_0x5ade05[_0x08b1('0x36')]=qs[_0x08b1('0x2d')](_[_0x08b1('0x48')](_0x539024[_0x08b1('0x2c')],_0x348a73[_0x08b1('0x2d')]));if(_0x539024[_0x08b1('0x2c')][_0x08b1('0x37')]){_0x5ade05[_0x08b1('0x36')]=_[_0x08b1('0x39')](_0x5ade05[_0x08b1('0x36')],{'$or':_[_0x08b1('0x27')](_0x5ade05[_0x08b1('0x30')],function(_0x4ea16d){var _0x56e110={};_0x56e110[_0x4ea16d]={'$like':'%'+_0x539024[_0x08b1('0x2c')][_0x08b1('0x37')]+'%'};return _0x56e110;})});}_0x5ade05=_[_0x08b1('0x39')]({},_0x5ade05,_0x539024[_0x08b1('0x3a')]);return _0x495b35[_0x08b1('0x46')](_0x5ade05);}})[_0x08b1('0x3c')](function(_0x13b7f6){if(_0x13b7f6){_0x14dbf4=_0x13b7f6[_0x08b1('0x31')];if(!_0x539024['query'][_0x08b1('0x32')](_0x08b1('0x33'))){_0x5ade05['limit']=qs['limit'](_0x539024[_0x08b1('0x2c')][_0x08b1('0x1e')]);_0x5ade05[_0x08b1('0x1b')]=qs['offset'](_0x539024[_0x08b1('0x2c')][_0x08b1('0x1b')]);}return _0x495b35[_0x08b1('0x46')](_0x5ade05);}})[_0x08b1('0x3c')](function(_0xcf4ac1){if(_0xcf4ac1){return _0xcf4ac1?{'count':_0x14dbf4,'rows':_0xcf4ac1}:null;}})[_0x08b1('0x3c')](respondWithResult(_0x337a63,null))['catch'](handleError(_0x337a63,null));};exports[_0x08b1('0x49')]=function(_0x48c28f,_0x49c28b,_0x18a14f){if(_0x48c28f['body']['id']){delete _0x48c28f[_0x08b1('0x44')]['id'];}return db[_0x08b1('0x28')][_0x08b1('0x47')]({'where':{'id':_0x48c28f['params']['id']}})['then'](handleEntityNotFound(_0x49c28b,null))[_0x08b1('0x3c')](function(_0xe7b577){if(_0xe7b577){_0x48c28f['body'][_0x08b1('0x4a')]=_0xe7b577['id'];_0x48c28f[_0x08b1('0x44')][_0x08b1('0x4b')]=integrations['getSubjects'](_0x48c28f[_0x08b1('0x44')][_0x08b1('0x4c')],_0x48c28f['body']['type']);_0x48c28f['body'][_0x08b1('0x4d')]=integrations[_0x08b1('0x4e')](_0x48c28f[_0x08b1('0x44')]['channel'],_0x48c28f[_0x08b1('0x44')][_0x08b1('0x38')]);return db[_0x08b1('0x4f')][_0x08b1('0x43')](_0x48c28f['body'],{'include':[{'model':db[_0x08b1('0x50')],'as':_0x08b1('0x4b')},{'model':db[_0x08b1('0x50')],'as':_0x08b1('0x4d')}]});}return null;})[_0x08b1('0x3c')](respondWithResult(_0x49c28b,null))['catch'](handleError(_0x49c28b,null));};exports[_0x08b1('0x51')]=function(_0x184380,_0x1ab7c5,_0xe15d5e){var _0x5d963c='';var _0xf78a63='';return db['FreshsalesAccount']['findOne']({'where':{'id':_0x184380['params']['id']},'attributes':['id',_0x08b1('0x52'),'remoteUri',_0x08b1('0x53')]})[_0x08b1('0x3c')](handleEntityNotFound(_0x1ab7c5,null))[_0x08b1('0x3c')](function(_0xf97c81){if(_0xf97c81){_0xf78a63=_0xf97c81['username'];_0x5d963c=_0xf97c81[_0x08b1('0x54')];var _0x418796=_0xf97c81['remoteUri'][_0x08b1('0x55')](-0x1);if(_0x418796==='/'){_0x5d963c=_0x5d963c[_0x08b1('0x56')](0x0,_0x5d963c[_0x08b1('0x57')](_0x418796));}return rp({'method':_0x08b1('0x58'),'uri':util[_0x08b1('0x59')](_0x08b1('0x5a'),_0x5d963c,_0x08b1('0x5b')),'headers':{'Authorization':'Token\x20token='+_0xf97c81[_0x08b1('0x53')]},'json':!![]});}})[_0x08b1('0x3c')](function(_0x23fb82){if(_0x23fb82){var _0x5a16a9=_0x23fb82['users'];var _0x27b79e=![];var _0x4b753c=null;for(_0x4b753c=0x0;_0x4b753c<_0x5a16a9[_0x08b1('0x31')];_0x4b753c++){if(_0x5a16a9[_0x4b753c]['email']===_0xf78a63){_0x27b79e=!![];}}if(_0x27b79e){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x08b1('0x5c')});}}})[_0x08b1('0x3c')](respondWithResult(_0x1ab7c5,null))['catch'](function(_0x39e2e3){var _0x247ea5=_0x184380['query'][_0x08b1('0x5d')]?0x1f4:_0x39e2e3['statusCode']||0x1f4;logger[_0x08b1('0x5e')](_0x08b1('0x5f'),_0x08b1('0x51'),_0x247ea5,JSON['stringify'](_0x39e2e3));delete _0x39e2e3[_0x08b1('0x24')];if(_0x247ea5===0x191){_0x247ea5=0x190;}_0x1ab7c5['status'](_0x247ea5)[_0x08b1('0x25')](_0x184380['query'][_0x08b1('0x5d')]?{'message':'Wrong\x20credentials','statusCode':_0x39e2e3['statusCode']}:_0x39e2e3);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 70d4003..c599642 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(_0x5f1cdb,_0x30ab8e){var _0x3e4828=function(_0x3e7cc4){while(--_0x3e7cc4){_0x5f1cdb['push'](_0x5f1cdb['shift']());}};_0x3e4828(++_0x30ab8e);}(_0x323f,0x1ee));var _0xf323=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x323f[_0x30ae5e];return _0x1f2e93;};'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 _0x6d38=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','exports','define'];(function(_0x1808bb,_0x4dfa9f){var _0xd903a5=function(_0x7da710){while(--_0x7da710){_0x1808bb['push'](_0x1808bb['shift']());}};_0xd903a5(++_0x4dfa9f);}(_0x6d38,0x1ef));var _0x86d3=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x6d38[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var logger=require(_0x86d3('0x1'))(_0x86d3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x86d3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var attributes=require(_0x86d3('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x86d3('0x7')]=function(_0xfbbc15,_0x33d4aa){return _0xfbbc15[_0x86d3('0x8')]('FreshsalesAccount',attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 9dd0743..8e7d13f 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 _0x7a54=['http','info','FreshsalesAccount,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','FreshsalesAccount','findAll','options','raw','where','attributes','include','map','model','then','GetFreshsalesAccount','ShowFreshsalesAccount','find','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5452fc,_0x2d0a0f){var _0x211117=function(_0x54951c){while(--_0x54951c){_0x5452fc['push'](_0x5452fc['shift']());}};_0x211117(++_0x2d0a0f);}(_0x7a54,0x106));var _0x47a5=function(_0x5d6f0a,_0x40cf13){_0x5d6f0a=_0x5d6f0a-0x0;var _0x5323a7=_0x7a54[_0x5d6f0a];return _0x5323a7;};'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')]('FreshsalesAccount,\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['GetFreshsalesAccount']=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,'limit':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['limit']||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x5247fd['options'][_0x47a5('0x1b')],function(_0x385687){return{'model':db[_0x385687['model']],'as':_0x385687['as'],'attributes':_0x385687[_0x47a5('0x1a')],'include':_0x385687[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x385687[_0x47a5('0x1b')],function(_0x3abd6a){return{'model':db[_0x3abd6a['model']],'as':_0x3abd6a['as'],'attributes':_0x3abd6a['attributes'],'include':_0x3abd6a[_0x47a5('0x1b')]?_['map'](_0x3abd6a[_0x47a5('0x1b')],function(_0x5b6c4e){return{'model':db[_0x5b6c4e[_0x47a5('0x1d')]],'as':_0x5b6c4e['as'],'attributes':_0x5b6c4e[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x47a5('0x1e')](function(_0x1dac65){logger[_0x47a5('0xb')](_0x47a5('0x1f'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1f'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1dac65));_0xaf70a6(_0x1dac65);})[_0x47a5('0x14')](function(_0x1127f8){logger[_0x47a5('0xf')](_0x47a5('0x1f'),_0x1127f8['message'],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x1127f8['message']));});});};exports[_0x47a5('0x20')]=function(_0x9ac908){var _0x16901f=this;return new Promise(function(_0x4d6b57,_0x256650){return db[_0x47a5('0x15')][_0x47a5('0x21')]({'raw':_0x9ac908[_0x47a5('0x17')]?_0x9ac908['options']['raw']===undefined?!![]:![]:!![],'where':_0x9ac908[_0x47a5('0x17')]?_0x9ac908[_0x47a5('0x17')]['where']||null:null,'attributes':_0x9ac908['options']?_0x9ac908[_0x47a5('0x17')][_0x47a5('0x1a')]||null:null,'include':_0x9ac908['options']?_0x9ac908[_0x47a5('0x17')]['include']?_[_0x47a5('0x1c')](_0x9ac908[_0x47a5('0x17')]['include'],function(_0x4843c0){return{'model':db[_0x4843c0[_0x47a5('0x1d')]],'as':_0x4843c0['as'],'attributes':_0x4843c0['attributes'],'include':_0x4843c0[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x4843c0[_0x47a5('0x1b')],function(_0x52749b){return{'model':db[_0x52749b[_0x47a5('0x1d')]],'as':_0x52749b['as'],'attributes':_0x52749b['attributes'],'include':_0x52749b['include']?_[_0x47a5('0x1c')](_0x52749b['include'],function(_0x25cce0){return{'model':db[_0x25cce0['model']],'as':_0x25cce0['as'],'attributes':_0x25cce0[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x47a5('0x1e')](function(_0x38c8d4){logger[_0x47a5('0xb')](_0x47a5('0x20'),_0x9ac908);logger[_0x47a5('0xd')](_0x47a5('0x20'),_0x9ac908,JSON[_0x47a5('0xe')](_0x38c8d4));_0x4d6b57(_0x38c8d4);})[_0x47a5('0x14')](function(_0x4caed5){logger[_0x47a5('0xf')](_0x47a5('0x20'),_0x4caed5['message'],_0x9ac908);_0x256650(_0x16901f[_0x47a5('0xf')](0x1f4,_0x4caed5[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x627e=['request','info','FreshsalesAccount,\x20%s,\x20%s','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetFreshsalesAccount','findAll','raw','options','where','map','model','attributes','include','then','debug','ShowFreshsalesAccount','FreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http'];(function(_0x4f067e,_0x406536){var _0x3930d1=function(_0x326249){while(--_0x326249){_0x4f067e['push'](_0x4f067e['shift']());}};_0x3930d1(++_0x406536);}(_0x627e,0x14a));var _0xe627=function(_0x235e5a,_0x518acf){_0x235e5a=_0x235e5a-0x0;var _0x56cc01=_0x627e[_0x235e5a];return _0x56cc01;};'use strict';var _=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var moment=require(_0xe627('0x2'));var BPromise=require(_0xe627('0x3'));var rs=require(_0xe627('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe627('0x5'))['db'];var utils=require(_0xe627('0x6'));var logger=require(_0xe627('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe627('0x8')][_0xe627('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45e49a,_0x2d4f63,_0xd5016e){return new BPromise(function(_0xe065b,_0x4bae52){return client[_0xe627('0xa')](_0x45e49a,_0xd5016e)['then'](function(_0x56549e){logger[_0xe627('0xb')](_0xe627('0xc'),_0x2d4f63,'request\x20sent');logger['debug'](_0xe627('0xd'),_0x2d4f63,_0xe627('0xe'),JSON[_0xe627('0xf')](_0x56549e));if(_0x56549e[_0xe627('0x10')]){if(_0x56549e[_0xe627('0x10')][_0xe627('0x11')]===0x1f4){logger[_0xe627('0x10')](_0xe627('0xc'),_0x2d4f63,_0x56549e[_0xe627('0x10')]['message']);return _0x4bae52(_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);}logger[_0xe627('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x2d4f63,_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);return _0xe065b(_0x56549e[_0xe627('0x10')][_0xe627('0x12')]);}else{logger[_0xe627('0xb')](_0xe627('0xc'),_0x2d4f63,_0xe627('0xe'));_0xe065b(_0x56549e['result'][_0xe627('0x12')]);}})[_0xe627('0x13')](function(_0x16c2d7){logger[_0xe627('0x10')](_0xe627('0xc'),_0x2d4f63,_0x16c2d7);_0x4bae52(_0x16c2d7);});});}exports[_0xe627('0x14')]=function(_0x56559b){var _0x2fe46a=this;return new Promise(function(_0x538b22,_0x24fddd){return db['FreshsalesAccount'][_0xe627('0x15')]({'raw':_0x56559b['options']?_0x56559b['options'][_0xe627('0x16')]===undefined?!![]:![]:!![],'where':_0x56559b['options']?_0x56559b[_0xe627('0x17')][_0xe627('0x18')]||null:null,'attributes':_0x56559b['options']?_0x56559b['options']['attributes']||null:null,'limit':_0x56559b[_0xe627('0x17')]?_0x56559b[_0xe627('0x17')]['limit']||null:null,'include':_0x56559b[_0xe627('0x17')]?_0x56559b[_0xe627('0x17')]['include']?_[_0xe627('0x19')](_0x56559b[_0xe627('0x17')]['include'],function(_0x42f3d1){return{'model':db[_0x42f3d1[_0xe627('0x1a')]],'as':_0x42f3d1['as'],'attributes':_0x42f3d1[_0xe627('0x1b')],'include':_0x42f3d1['include']?_[_0xe627('0x19')](_0x42f3d1[_0xe627('0x1c')],function(_0x1a5081){return{'model':db[_0x1a5081[_0xe627('0x1a')]],'as':_0x1a5081['as'],'attributes':_0x1a5081['attributes'],'include':_0x1a5081[_0xe627('0x1c')]?_[_0xe627('0x19')](_0x1a5081[_0xe627('0x1c')],function(_0x29eb8e){return{'model':db[_0x29eb8e[_0xe627('0x1a')]],'as':_0x29eb8e['as'],'attributes':_0x29eb8e[_0xe627('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe627('0x1d')](function(_0x44c9f7){logger[_0xe627('0xb')]('GetFreshsalesAccount',_0x56559b);logger[_0xe627('0x1e')]('GetFreshsalesAccount',_0x56559b,JSON['stringify'](_0x44c9f7));_0x538b22(_0x44c9f7);})[_0xe627('0x13')](function(_0xdf63c8){logger['error'](_0xe627('0x14'),_0xdf63c8['message'],_0x56559b);_0x24fddd(_0x2fe46a[_0xe627('0x10')](0x1f4,_0xdf63c8['message']));});});};exports[_0xe627('0x1f')]=function(_0x26833a){var _0x5d8992=this;return new Promise(function(_0x33e9dd,_0x4f92c9){return db[_0xe627('0x20')][_0xe627('0x21')]({'raw':_0x26833a[_0xe627('0x17')]?_0x26833a[_0xe627('0x17')][_0xe627('0x16')]===undefined?!![]:![]:!![],'where':_0x26833a[_0xe627('0x17')]?_0x26833a[_0xe627('0x17')][_0xe627('0x18')]||null:null,'attributes':_0x26833a[_0xe627('0x17')]?_0x26833a[_0xe627('0x17')][_0xe627('0x1b')]||null:null,'include':_0x26833a['options']?_0x26833a['options'][_0xe627('0x1c')]?_['map'](_0x26833a[_0xe627('0x17')]['include'],function(_0x56d1d7){return{'model':db[_0x56d1d7[_0xe627('0x1a')]],'as':_0x56d1d7['as'],'attributes':_0x56d1d7['attributes'],'include':_0x56d1d7['include']?_[_0xe627('0x19')](_0x56d1d7[_0xe627('0x1c')],function(_0x55f001){return{'model':db[_0x55f001['model']],'as':_0x55f001['as'],'attributes':_0x55f001['attributes'],'include':_0x55f001['include']?_[_0xe627('0x19')](_0x55f001['include'],function(_0x39338c){return{'model':db[_0x39338c[_0xe627('0x1a')]],'as':_0x39338c['as'],'attributes':_0x39338c['attributes']};}):[]};}):[]};}):[]:[]})[_0xe627('0x1d')](function(_0x35a303){logger['info'](_0xe627('0x1f'),_0x26833a);logger[_0xe627('0x1e')](_0xe627('0x1f'),_0x26833a,JSON[_0xe627('0xf')](_0x35a303));_0x33e9dd(_0x35a303);})[_0xe627('0x13')](function(_0x28fd59){logger['error'](_0xe627('0x1f'),_0x28fd59['message'],_0x26833a);_0x4f92c9(_0x5d8992[_0xe627('0x10')](0x1f4,_0x28fd59['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 613e6ab..78b080a 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 _0x996f=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','getSubjects','getDescriptions','getFields','post','create','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x29244f,_0x1f6cd2){var _0x38162e=function(_0x20fffd){while(--_0x20fffd){_0x29244f['push'](_0x29244f['shift']());}};_0x38162e(++_0x1f6cd2);}(_0x996f,0x6f));var _0xf996=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x996f[_0xbb091];return _0x467a04;};'use strict';var multer=require(_0xf996('0x0'));var util=require(_0xf996('0x1'));var path=require(_0xf996('0x2'));var timeout=require(_0xf996('0x3'));var express=require('express');var router=express[_0xf996('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf996('0x5'));var interaction=require(_0xf996('0x6'));var config=require(_0xf996('0x7'));var controller=require(_0xf996('0x8'));router[_0xf996('0x9')]('/',auth[_0xf996('0xa')](),controller[_0xf996('0xb')]);router[_0xf996('0x9')](_0xf996('0xc'),auth['isAuthenticated'](),controller[_0xf996('0xd')]);router[_0xf996('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xf996('0xe')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0xf996('0xf')]);router[_0xf996('0x9')]('/:id/fields',auth[_0xf996('0xa')](),controller[_0xf996('0x10')]);router[_0xf996('0x11')]('/',auth[_0xf996('0xa')](),controller[_0xf996('0x12')]);router[_0xf996('0x13')](_0xf996('0xc'),auth[_0xf996('0xa')](),controller[_0xf996('0x14')]);router['delete']('/:id',auth[_0xf996('0xa')](),controller[_0xf996('0x15')]);module[_0xf996('0x16')]=router; \ No newline at end of file +var _0xc62a=['getSubjects','getDescriptions','/:id/fields','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/subjects'];(function(_0x283791,_0x8b7a29){var _0x21d043=function(_0x46a18c){while(--_0x46a18c){_0x283791['push'](_0x283791['shift']());}};_0x21d043(++_0x8b7a29);}(_0xc62a,0xc1));var _0xac62=function(_0x3b2e91,_0x175377){_0x3b2e91=_0x3b2e91-0x0;var _0x5dc9ac=_0xc62a[_0x3b2e91];return _0x5dc9ac;};'use strict';var multer=require(_0xac62('0x0'));var util=require(_0xac62('0x1'));var path=require(_0xac62('0x2'));var timeout=require(_0xac62('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xac62('0x4'));var auth=require(_0xac62('0x5'));var interaction=require(_0xac62('0x6'));var config=require(_0xac62('0x7'));var controller=require('./intFreshsalesConfiguration.controller');router[_0xac62('0x8')]('/',auth[_0xac62('0x9')](),controller[_0xac62('0xa')]);router[_0xac62('0x8')](_0xac62('0xb'),auth[_0xac62('0x9')](),controller[_0xac62('0xc')]);router[_0xac62('0x8')](_0xac62('0xd'),auth['isAuthenticated'](),controller[_0xac62('0xe')]);router[_0xac62('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xac62('0xf')]);router['get'](_0xac62('0x10'),auth[_0xac62('0x9')](),controller['getFields']);router['post']('/',auth[_0xac62('0x9')](),controller[_0xac62('0x11')]);router[_0xac62('0x12')](_0xac62('0xb'),auth[_0xac62('0x9')](),controller[_0xac62('0x13')]);router[_0xac62('0x14')](_0xac62('0xb'),auth[_0xac62('0x9')](),controller[_0xac62('0x15')]);module[_0xac62('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index fee9f93..269d166 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 _0x8fb6=['STRING','exports'];(function(_0x13c0c5,_0x584f94){var _0x99a941=function(_0xea527){while(--_0xea527){_0x13c0c5['push'](_0x13c0c5['shift']());}};_0x99a941(++_0x584f94);}(_0x8fb6,0x15b));var _0x68fb=function(_0x431162,_0x52de19){_0x431162=_0x431162-0x0;var _0x52b2e5=_0x8fb6[_0x431162];return _0x52b2e5;};'use strict';var Sequelize=require('sequelize');module[_0x68fb('0x0')]={'name':{'type':Sequelize[_0x68fb('0x1')]},'description':{'type':Sequelize[_0x68fb('0x1')]}}; \ No newline at end of file +var _0x404e=['sequelize','exports','STRING'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x404e,0x174));var _0xe404=function(_0x47e309,_0x1e771a){_0x47e309=_0x47e309-0x0;var _0x2e1900=_0x404e[_0x47e309];return _0x2e1900;};'use strict';var Sequelize=require(_0xe404('0x0'));module[_0xe404('0x1')]={'name':{'type':Sequelize[_0xe404('0x2')]},'description':{'type':Sequelize[_0xe404('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 55155d7..9341d43 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 _0x2d34=['mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','map','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','FreshsalesConfiguration','count','includeAll','include','findAll','rows','catch','rawAttributes','create','body','params','find','order','pick','options','getSubjects','getDescriptions','findOne','FreshsalesField','getFields','eml-format','rimraf','zip-dir','request-promise','moment','bluebird'];(function(_0x4521f1,_0x4639f4){var _0x205fcb=function(_0x2b08de){while(--_0x2b08de){_0x4521f1['push'](_0x4521f1['shift']());}};_0x205fcb(++_0x4639f4);}(_0x2d34,0x136));var _0x42d3=function(_0x105de1,_0x3d8b7c){_0x105de1=_0x105de1-0x0;var _0x458e94=_0x2d34[_0x105de1];return _0x458e94;};'use strict';var emlformat=require(_0x42d3('0x0'));var rimraf=require(_0x42d3('0x1'));var zipdir=require(_0x42d3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x42d3('0x3'));var moment=require(_0x42d3('0x4'));var BPromise=require(_0x42d3('0x5'));var Mustache=require(_0x42d3('0x6'));var util=require('util');var path=require(_0x42d3('0x7'));var sox=require(_0x42d3('0x8'));var csv=require(_0x42d3('0x9'));var ejs=require(_0x42d3('0xa'));var fs=require('fs');var fs_extra=require(_0x42d3('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x42d3('0xc'));var jsforce=require(_0x42d3('0xd'));var deskjs=require(_0x42d3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x42d3('0xf'));var Papa=require(_0x42d3('0x10'));var Redis=require(_0x42d3('0x11'));var authService=require(_0x42d3('0x12'));var qs=require(_0x42d3('0x13'));var as=require(_0x42d3('0x14'));var hardwareService=require(_0x42d3('0x15'));var logger=require('../../config/logger')(_0x42d3('0x16'));var utils=require('../../config/utils');var config=require(_0x42d3('0x17'));var licenseUtil=require(_0x42d3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ca446,_0x5d4e36){_0x5d4e36=_0x5d4e36||0xcc;return function(_0x3ba148){if(_0x3ba148){return _0x2ca446[_0x42d3('0x19')](_0x5d4e36);}return _0x2ca446[_0x42d3('0x1a')](_0x5d4e36)[_0x42d3('0x1b')]();};}function respondWithResult(_0x5b9434,_0x270587){_0x270587=_0x270587||0xc8;return function(_0x2079a5){if(_0x2079a5){return _0x5b9434[_0x42d3('0x1a')](_0x270587)[_0x42d3('0x1c')](_0x2079a5);}};}function respondWithFilteredResult(_0x136ce0,_0x1e6d28){return function(_0x169dc6){if(_0x169dc6){var _0x5c7bf9=typeof _0x1e6d28[_0x42d3('0x1d')]===_0x42d3('0x1e')&&typeof _0x1e6d28[_0x42d3('0x1f')]===_0x42d3('0x1e');var _0x1c6363=_0x169dc6['count'];var _0xa64bf2=_0x5c7bf9?0x0:_0x1e6d28[_0x42d3('0x1d')];var _0x5996b5=_0x5c7bf9?_0x169dc6['count']:_0x1e6d28['offset']+_0x1e6d28[_0x42d3('0x1f')];var _0x371bbc;if(_0x5996b5>=_0x1c6363){_0x5996b5=_0x1c6363;_0x371bbc=0xc8;}else{_0x371bbc=0xce;}_0x136ce0[_0x42d3('0x1a')](_0x371bbc);return _0x136ce0[_0x42d3('0x20')](_0x42d3('0x21'),_0xa64bf2+'-'+_0x5996b5+'/'+_0x1c6363)[_0x42d3('0x1c')](_0x169dc6);}return null;};}function patchUpdates(_0x5b360d){return function(_0x20aff7){try{jsonpatch['apply'](_0x20aff7,_0x5b360d,!![]);}catch(_0x1e572a){return BPromise[_0x42d3('0x22')](_0x1e572a);}return _0x20aff7['save']();};}function saveUpdates(_0x563dd7,_0x82302d){return function(_0x258c98){if(_0x258c98){return _0x258c98[_0x42d3('0x23')](_0x563dd7)[_0x42d3('0x24')](function(_0x3edddf){return _0x3edddf;});}return null;};}function removeEntity(_0x50a853,_0x3b6099){return function(_0x187a1a){if(_0x187a1a){return _0x187a1a[_0x42d3('0x25')]()[_0x42d3('0x24')](function(){_0x50a853[_0x42d3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x228ebc,_0x482091){return function(_0xb0d94a){if(!_0xb0d94a){_0x228ebc['sendStatus'](0x194);}return _0xb0d94a;};}function handleError(_0x8ed3f4,_0x6ccf5){_0x6ccf5=_0x6ccf5||0x1f4;return function(_0xf5bb51){logger[_0x42d3('0x26')](_0xf5bb51[_0x42d3('0x27')]);if(_0xf5bb51['name']){delete _0xf5bb51[_0x42d3('0x28')];}_0x8ed3f4['status'](_0x6ccf5)[_0x42d3('0x29')](_0xf5bb51);};}exports['index']=function(_0x2561d4,_0x2ad869){var _0x2caa8d={},_0x526da3={},_0x355a2f={'count':0x0,'rows':[]};var _0x4c697c=_[_0x42d3('0x2a')](db['FreshsalesConfiguration']['rawAttributes'],function(_0x25f5bb){return{'name':_0x25f5bb['fieldName'],'type':_0x25f5bb[_0x42d3('0x2b')]['key']};});_0x526da3[_0x42d3('0x2c')]=_[_0x42d3('0x2a')](_0x4c697c,'name');_0x526da3[_0x42d3('0x2d')]=_[_0x42d3('0x2e')](_0x2561d4[_0x42d3('0x2d')]);_0x526da3[_0x42d3('0x2f')]=_[_0x42d3('0x30')](_0x526da3[_0x42d3('0x2c')],_0x526da3[_0x42d3('0x2d')]);_0x2caa8d[_0x42d3('0x31')]=_['intersection'](_0x526da3[_0x42d3('0x2c')],qs[_0x42d3('0x32')](_0x2561d4[_0x42d3('0x2d')][_0x42d3('0x32')]));_0x2caa8d[_0x42d3('0x31')]=_0x2caa8d[_0x42d3('0x31')][_0x42d3('0x33')]?_0x2caa8d[_0x42d3('0x31')]:_0x526da3[_0x42d3('0x2c')];if(!_0x2561d4[_0x42d3('0x2d')][_0x42d3('0x34')](_0x42d3('0x35'))){_0x2caa8d[_0x42d3('0x1f')]=qs[_0x42d3('0x1f')](_0x2561d4[_0x42d3('0x2d')]['limit']);_0x2caa8d[_0x42d3('0x1d')]=qs['offset'](_0x2561d4[_0x42d3('0x2d')]['offset']);}_0x2caa8d['order']=qs[_0x42d3('0x36')](_0x2561d4[_0x42d3('0x2d')][_0x42d3('0x36')]);_0x2caa8d[_0x42d3('0x37')]=qs[_0x42d3('0x2f')](_['pick'](_0x2561d4['query'],_0x526da3['filters']),_0x4c697c);if(_0x2561d4[_0x42d3('0x2d')][_0x42d3('0x38')]){_0x2caa8d[_0x42d3('0x37')]=_[_0x42d3('0x39')](_0x2caa8d[_0x42d3('0x37')],{'$or':_[_0x42d3('0x2a')](_0x4c697c,function(_0x234974){if(_0x234974[_0x42d3('0x2b')]!==_0x42d3('0x3a')){var _0x5185a2={};_0x5185a2[_0x234974[_0x42d3('0x28')]]={'$like':'%'+_0x2561d4[_0x42d3('0x2d')][_0x42d3('0x38')]+'%'};return _0x5185a2;}})});}_0x2caa8d=_[_0x42d3('0x39')]({},_0x2caa8d,_0x2561d4['options']);var _0x5a1852={'where':_0x2caa8d[_0x42d3('0x37')]};return db[_0x42d3('0x3b')][_0x42d3('0x3c')](_0x5a1852)[_0x42d3('0x24')](function(_0x2e02e2){_0x355a2f[_0x42d3('0x3c')]=_0x2e02e2;if(_0x2561d4[_0x42d3('0x2d')][_0x42d3('0x3d')]){_0x2caa8d[_0x42d3('0x3e')]=[{'all':!![]}];}return db[_0x42d3('0x3b')][_0x42d3('0x3f')](_0x2caa8d);})[_0x42d3('0x24')](function(_0x3975a8){_0x355a2f[_0x42d3('0x40')]=_0x3975a8;return _0x355a2f;})['then'](respondWithFilteredResult(_0x2ad869,_0x2caa8d))[_0x42d3('0x41')](handleError(_0x2ad869,null));};exports['show']=function(_0x510563,_0x11c00e){var _0x2ca80f={'raw':![],'where':{'id':_0x510563['params']['id']}},_0x20024e={};_0x20024e['model']=_['keys'](db['FreshsalesConfiguration'][_0x42d3('0x42')]);_0x20024e[_0x42d3('0x2d')]=_[_0x42d3('0x2e')](_0x510563['query']);_0x20024e[_0x42d3('0x2f')]=_[_0x42d3('0x30')](_0x20024e['model'],_0x20024e['query']);_0x2ca80f[_0x42d3('0x31')]=_['intersection'](_0x20024e[_0x42d3('0x2c')],qs['fields'](_0x510563['query'][_0x42d3('0x32')]));_0x2ca80f[_0x42d3('0x31')]=_0x2ca80f[_0x42d3('0x31')][_0x42d3('0x33')]?_0x2ca80f['attributes']:_0x20024e[_0x42d3('0x2c')];if(_0x510563[_0x42d3('0x2d')][_0x42d3('0x3d')]){_0x2ca80f[_0x42d3('0x3e')]=[{'all':!![]}];}_0x2ca80f=_[_0x42d3('0x39')]({},_0x2ca80f,_0x510563['options']);return db[_0x42d3('0x3b')]['find'](_0x2ca80f)[_0x42d3('0x24')](handleEntityNotFound(_0x11c00e,null))[_0x42d3('0x24')](respondWithResult(_0x11c00e,null))[_0x42d3('0x41')](handleError(_0x11c00e,null));};exports[_0x42d3('0x43')]=function(_0x2c6c64,_0x46614d){return db[_0x42d3('0x3b')][_0x42d3('0x43')](_0x2c6c64[_0x42d3('0x44')],{})[_0x42d3('0x24')](respondWithResult(_0x46614d,0xc9))[_0x42d3('0x41')](handleError(_0x46614d,null));};exports[_0x42d3('0x23')]=function(_0x5362ce,_0x1acf03){if(_0x5362ce[_0x42d3('0x44')]['id']){delete _0x5362ce[_0x42d3('0x44')]['id'];}return db[_0x42d3('0x3b')]['find']({'where':{'id':_0x5362ce[_0x42d3('0x45')]['id']}})[_0x42d3('0x24')](handleEntityNotFound(_0x1acf03,null))[_0x42d3('0x24')](saveUpdates(_0x5362ce['body'],null))['then'](respondWithResult(_0x1acf03,null))[_0x42d3('0x41')](handleError(_0x1acf03,null));};exports[_0x42d3('0x25')]=function(_0x4b9490,_0x66054){return db['FreshsalesConfiguration'][_0x42d3('0x46')]({'where':{'id':_0x4b9490[_0x42d3('0x45')]['id']}})[_0x42d3('0x24')](handleEntityNotFound(_0x66054,null))[_0x42d3('0x24')](removeEntity(_0x66054,null))[_0x42d3('0x41')](handleError(_0x66054,null));};exports['getSubjects']=function(_0x1c3b3f,_0x6f5d4e,_0x1e346f){var _0x21a785={};var _0x3e84b2={};var _0x518535;var _0xe8bf31;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x1c3b3f['params']['id']}})[_0x42d3('0x24')](handleEntityNotFound(_0x6f5d4e,null))[_0x42d3('0x24')](function(_0xc23a65){if(_0xc23a65){_0x518535=_0xc23a65;_0x3e84b2[_0x42d3('0x2c')]=_[_0x42d3('0x2e')](db['FreshsalesField'][_0x42d3('0x42')]);_0x3e84b2[_0x42d3('0x2d')]=_[_0x42d3('0x2e')](_0x1c3b3f[_0x42d3('0x2d')]);_0x3e84b2['filters']=_['intersection'](_0x3e84b2[_0x42d3('0x2c')],_0x3e84b2[_0x42d3('0x2d')]);_0x21a785['attributes']=_['intersection'](_0x3e84b2[_0x42d3('0x2c')],qs[_0x42d3('0x32')](_0x1c3b3f[_0x42d3('0x2d')][_0x42d3('0x32')]));_0x21a785[_0x42d3('0x31')]=_0x21a785[_0x42d3('0x31')][_0x42d3('0x33')]?_0x21a785[_0x42d3('0x31')]:_0x3e84b2['model'];_0x21a785[_0x42d3('0x47')]=qs[_0x42d3('0x36')](_0x1c3b3f[_0x42d3('0x2d')][_0x42d3('0x36')]);_0x21a785['where']=qs[_0x42d3('0x2f')](_[_0x42d3('0x48')](_0x1c3b3f['query'],_0x3e84b2[_0x42d3('0x2f')]));if(_0x1c3b3f[_0x42d3('0x2d')][_0x42d3('0x38')]){_0x21a785[_0x42d3('0x37')]=_['merge'](_0x21a785['where'],{'$or':_[_0x42d3('0x2a')](_0x21a785[_0x42d3('0x31')],function(_0x26acfa){var _0x3b2f86={};_0x3b2f86[_0x26acfa]={'$like':'%'+_0x1c3b3f[_0x42d3('0x2d')][_0x42d3('0x38')]+'%'};return _0x3b2f86;})});}_0x21a785=_[_0x42d3('0x39')]({},_0x21a785,_0x1c3b3f[_0x42d3('0x49')]);return _0x518535[_0x42d3('0x4a')](_0x21a785);}})[_0x42d3('0x24')](function(_0xe324aa){if(_0xe324aa){_0xe8bf31=_0xe324aa['length'];if(!_0x1c3b3f[_0x42d3('0x2d')][_0x42d3('0x34')]('nolimit')){_0x21a785[_0x42d3('0x1f')]=qs[_0x42d3('0x1f')](_0x1c3b3f[_0x42d3('0x2d')][_0x42d3('0x1f')]);_0x21a785['offset']=qs[_0x42d3('0x1d')](_0x1c3b3f[_0x42d3('0x2d')][_0x42d3('0x1d')]);}return _0x518535['getSubjects'](_0x21a785);}})[_0x42d3('0x24')](function(_0x38c160){if(_0x38c160){return _0x38c160?{'count':_0xe8bf31,'rows':_0x38c160}:null;}})[_0x42d3('0x24')](respondWithResult(_0x6f5d4e,null))[_0x42d3('0x41')](handleError(_0x6f5d4e,null));};exports[_0x42d3('0x4b')]=function(_0x23a2be,_0x3c8142,_0x59bdca){var _0x440ce6={};var _0x963dd1={};var _0x19d222;var _0x15b41e;return db[_0x42d3('0x3b')][_0x42d3('0x4c')]({'where':{'id':_0x23a2be[_0x42d3('0x45')]['id']}})[_0x42d3('0x24')](handleEntityNotFound(_0x3c8142,null))[_0x42d3('0x24')](function(_0x1855bd){if(_0x1855bd){_0x19d222=_0x1855bd;_0x963dd1[_0x42d3('0x2c')]=_[_0x42d3('0x2e')](db[_0x42d3('0x4d')]['rawAttributes']);_0x963dd1[_0x42d3('0x2d')]=_[_0x42d3('0x2e')](_0x23a2be[_0x42d3('0x2d')]);_0x963dd1[_0x42d3('0x2f')]=_['intersection'](_0x963dd1[_0x42d3('0x2c')],_0x963dd1['query']);_0x440ce6['attributes']=_['intersection'](_0x963dd1[_0x42d3('0x2c')],qs[_0x42d3('0x32')](_0x23a2be['query'][_0x42d3('0x32')]));_0x440ce6[_0x42d3('0x31')]=_0x440ce6['attributes']['length']?_0x440ce6['attributes']:_0x963dd1[_0x42d3('0x2c')];_0x440ce6[_0x42d3('0x47')]=qs[_0x42d3('0x36')](_0x23a2be[_0x42d3('0x2d')][_0x42d3('0x36')]);_0x440ce6[_0x42d3('0x37')]=qs['filters'](_[_0x42d3('0x48')](_0x23a2be[_0x42d3('0x2d')],_0x963dd1[_0x42d3('0x2f')]));if(_0x23a2be[_0x42d3('0x2d')]['filter']){_0x440ce6[_0x42d3('0x37')]=_[_0x42d3('0x39')](_0x440ce6[_0x42d3('0x37')],{'$or':_[_0x42d3('0x2a')](_0x440ce6['attributes'],function(_0x5503a4){var _0x31d56e={};_0x31d56e[_0x5503a4]={'$like':'%'+_0x23a2be[_0x42d3('0x2d')][_0x42d3('0x38')]+'%'};return _0x31d56e;})});}_0x440ce6=_['merge']({},_0x440ce6,_0x23a2be[_0x42d3('0x49')]);return _0x19d222[_0x42d3('0x4b')](_0x440ce6);}})[_0x42d3('0x24')](function(_0x20f7bc){if(_0x20f7bc){_0x15b41e=_0x20f7bc[_0x42d3('0x33')];if(!_0x23a2be[_0x42d3('0x2d')]['hasOwnProperty'](_0x42d3('0x35'))){_0x440ce6[_0x42d3('0x1f')]=qs[_0x42d3('0x1f')](_0x23a2be['query'][_0x42d3('0x1f')]);_0x440ce6[_0x42d3('0x1d')]=qs[_0x42d3('0x1d')](_0x23a2be[_0x42d3('0x2d')][_0x42d3('0x1d')]);}return _0x19d222[_0x42d3('0x4b')](_0x440ce6);}})[_0x42d3('0x24')](function(_0x2d7b14){if(_0x2d7b14){return _0x2d7b14?{'count':_0x15b41e,'rows':_0x2d7b14}:null;}})[_0x42d3('0x24')](respondWithResult(_0x3c8142,null))[_0x42d3('0x41')](handleError(_0x3c8142,null));};exports[_0x42d3('0x4e')]=function(_0x159214,_0x5de42d,_0x32a73e){var _0x4c8014={};var _0x378ba7={};var _0x209112;var _0x3ecee9;return db[_0x42d3('0x3b')][_0x42d3('0x4c')]({'where':{'id':_0x159214[_0x42d3('0x45')]['id']}})['then'](handleEntityNotFound(_0x5de42d,null))['then'](function(_0x5178ea){if(_0x5178ea){_0x209112=_0x5178ea;_0x378ba7[_0x42d3('0x2c')]=_[_0x42d3('0x2e')](db[_0x42d3('0x4d')][_0x42d3('0x42')]);_0x378ba7['query']=_[_0x42d3('0x2e')](_0x159214[_0x42d3('0x2d')]);_0x378ba7[_0x42d3('0x2f')]=_['intersection'](_0x378ba7[_0x42d3('0x2c')],_0x378ba7[_0x42d3('0x2d')]);_0x4c8014[_0x42d3('0x31')]=_['intersection'](_0x378ba7['model'],qs[_0x42d3('0x32')](_0x159214[_0x42d3('0x2d')][_0x42d3('0x32')]));_0x4c8014[_0x42d3('0x31')]=_0x4c8014['attributes']['length']?_0x4c8014[_0x42d3('0x31')]:_0x378ba7['model'];_0x4c8014[_0x42d3('0x47')]=qs[_0x42d3('0x36')](_0x159214[_0x42d3('0x2d')][_0x42d3('0x36')]);_0x4c8014[_0x42d3('0x37')]=qs[_0x42d3('0x2f')](_[_0x42d3('0x48')](_0x159214['query'],_0x378ba7[_0x42d3('0x2f')]));if(_0x159214['query'][_0x42d3('0x38')]){_0x4c8014[_0x42d3('0x37')]=_['merge'](_0x4c8014[_0x42d3('0x37')],{'$or':_[_0x42d3('0x2a')](_0x4c8014[_0x42d3('0x31')],function(_0x4ae541){var _0x2a24ff={};_0x2a24ff[_0x4ae541]={'$like':'%'+_0x159214[_0x42d3('0x2d')][_0x42d3('0x38')]+'%'};return _0x2a24ff;})});}_0x4c8014=_['merge']({},_0x4c8014,_0x159214[_0x42d3('0x49')]);return _0x209112[_0x42d3('0x4e')](_0x4c8014);}})[_0x42d3('0x24')](function(_0x33b34a){if(_0x33b34a){_0x3ecee9=_0x33b34a['length'];if(!_0x159214['query'][_0x42d3('0x34')](_0x42d3('0x35'))){_0x4c8014[_0x42d3('0x1f')]=qs[_0x42d3('0x1f')](_0x159214[_0x42d3('0x2d')][_0x42d3('0x1f')]);_0x4c8014['offset']=qs[_0x42d3('0x1d')](_0x159214[_0x42d3('0x2d')][_0x42d3('0x1d')]);}return _0x209112['getFields'](_0x4c8014);}})[_0x42d3('0x24')](function(_0x388761){if(_0x388761){return _0x388761?{'count':_0x3ecee9,'rows':_0x388761}:null;}})['then'](respondWithResult(_0x5de42d,null))[_0x42d3('0x41')](handleError(_0x5de42d,null));}; \ No newline at end of file +var _0x2e29=['json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','map','query','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','catch','show','params','keys','fields','length','include','find','body','findOne','FreshsalesField','getSubjects','getDescriptions','getFields','eml-format','zip-dir','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end'];(function(_0xa1e6be,_0x54097d){var _0x5c4b82=function(_0x54ebc9){while(--_0x54ebc9){_0xa1e6be['push'](_0xa1e6be['shift']());}};_0x5c4b82(++_0x54097d);}(_0x2e29,0xc8));var _0x92e2=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x2e29[_0x500419];return _0x241c1a;};'use strict';var emlformat=require(_0x92e2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x92e2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x92e2('0x2'));var moment=require('moment');var BPromise=require(_0x92e2('0x3'));var Mustache=require('mustache');var util=require(_0x92e2('0x4'));var path=require(_0x92e2('0x5'));var sox=require(_0x92e2('0x6'));var csv=require(_0x92e2('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x92e2('0x8'));var _=require(_0x92e2('0x9'));var squel=require(_0x92e2('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x92e2('0xb'));var toCsv=require(_0x92e2('0x7'));var querystring=require(_0x92e2('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x92e2('0xd'));var as=require(_0x92e2('0xe'));var hardwareService=require(_0x92e2('0xf'));var logger=require(_0x92e2('0x10'))(_0x92e2('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x92e2('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cac70,_0x3d7687){_0x3d7687=_0x3d7687||0xcc;return function(_0x3d3709){if(_0x3d3709){return _0x5cac70[_0x92e2('0x13')](_0x3d7687);}return _0x5cac70[_0x92e2('0x14')](_0x3d7687)[_0x92e2('0x15')]();};}function respondWithResult(_0x46bc3c,_0x5aea25){_0x5aea25=_0x5aea25||0xc8;return function(_0x241ced){if(_0x241ced){return _0x46bc3c[_0x92e2('0x14')](_0x5aea25)[_0x92e2('0x16')](_0x241ced);}};}function respondWithFilteredResult(_0x25eeaf,_0x46ff2c){return function(_0x49cc95){if(_0x49cc95){var _0x2885e0=typeof _0x46ff2c[_0x92e2('0x17')]===_0x92e2('0x18')&&typeof _0x46ff2c[_0x92e2('0x19')]===_0x92e2('0x18');var _0x128a36=_0x49cc95[_0x92e2('0x1a')];var _0x5afe7b=_0x2885e0?0x0:_0x46ff2c['offset'];var _0x143e79=_0x2885e0?_0x49cc95['count']:_0x46ff2c[_0x92e2('0x17')]+_0x46ff2c['limit'];var _0x49d79c;if(_0x143e79>=_0x128a36){_0x143e79=_0x128a36;_0x49d79c=0xc8;}else{_0x49d79c=0xce;}_0x25eeaf['status'](_0x49d79c);return _0x25eeaf[_0x92e2('0x1b')](_0x92e2('0x1c'),_0x5afe7b+'-'+_0x143e79+'/'+_0x128a36)[_0x92e2('0x16')](_0x49cc95);}return null;};}function patchUpdates(_0x124588){return function(_0xde0be8){try{jsonpatch[_0x92e2('0x1d')](_0xde0be8,_0x124588,!![]);}catch(_0x307499){return BPromise['reject'](_0x307499);}return _0xde0be8[_0x92e2('0x1e')]();};}function saveUpdates(_0x25adce,_0x69698c){return function(_0x1618c0){if(_0x1618c0){return _0x1618c0[_0x92e2('0x1f')](_0x25adce)[_0x92e2('0x20')](function(_0x11d25f){return _0x11d25f;});}return null;};}function removeEntity(_0x2f1432,_0x1f7f81){return function(_0x54457b){if(_0x54457b){return _0x54457b[_0x92e2('0x21')]()[_0x92e2('0x20')](function(){_0x2f1432[_0x92e2('0x14')](0xcc)[_0x92e2('0x15')]();});}};}function handleEntityNotFound(_0x58d388,_0x59c0b4){return function(_0x36c688){if(!_0x36c688){_0x58d388[_0x92e2('0x13')](0x194);}return _0x36c688;};}function handleError(_0x149711,_0x5747fe){_0x5747fe=_0x5747fe||0x1f4;return function(_0x5edbda){logger[_0x92e2('0x22')](_0x5edbda['stack']);if(_0x5edbda[_0x92e2('0x23')]){delete _0x5edbda[_0x92e2('0x23')];}_0x149711[_0x92e2('0x14')](_0x5747fe)[_0x92e2('0x24')](_0x5edbda);};}exports[_0x92e2('0x25')]=function(_0x552ab6,_0x1ea964){var _0x285469={},_0x16b925={},_0x7de1b6={'count':0x0,'rows':[]};var _0x5bf804=_['map'](db[_0x92e2('0x26')][_0x92e2('0x27')],function(_0x1b8225){return{'name':_0x1b8225[_0x92e2('0x28')],'type':_0x1b8225[_0x92e2('0x29')][_0x92e2('0x2a')]};});_0x16b925[_0x92e2('0x2b')]=_[_0x92e2('0x2c')](_0x5bf804,_0x92e2('0x23'));_0x16b925[_0x92e2('0x2d')]=_['keys'](_0x552ab6['query']);_0x16b925['filters']=_['intersection'](_0x16b925[_0x92e2('0x2b')],_0x16b925[_0x92e2('0x2d')]);_0x285469[_0x92e2('0x2e')]=_[_0x92e2('0x2f')](_0x16b925['model'],qs['fields'](_0x552ab6[_0x92e2('0x2d')]['fields']));_0x285469[_0x92e2('0x2e')]=_0x285469[_0x92e2('0x2e')]['length']?_0x285469[_0x92e2('0x2e')]:_0x16b925[_0x92e2('0x2b')];if(!_0x552ab6['query'][_0x92e2('0x30')](_0x92e2('0x31'))){_0x285469[_0x92e2('0x19')]=qs[_0x92e2('0x19')](_0x552ab6[_0x92e2('0x2d')][_0x92e2('0x19')]);_0x285469[_0x92e2('0x17')]=qs[_0x92e2('0x17')](_0x552ab6[_0x92e2('0x2d')][_0x92e2('0x17')]);}_0x285469[_0x92e2('0x32')]=qs[_0x92e2('0x33')](_0x552ab6[_0x92e2('0x2d')][_0x92e2('0x33')]);_0x285469[_0x92e2('0x34')]=qs[_0x92e2('0x35')](_[_0x92e2('0x36')](_0x552ab6['query'],_0x16b925[_0x92e2('0x35')]),_0x5bf804);if(_0x552ab6[_0x92e2('0x2d')][_0x92e2('0x37')]){_0x285469[_0x92e2('0x34')]=_[_0x92e2('0x38')](_0x285469['where'],{'$or':_[_0x92e2('0x2c')](_0x5bf804,function(_0x7c9b6b){if(_0x7c9b6b['type']!==_0x92e2('0x39')){var _0x599f0f={};_0x599f0f[_0x7c9b6b[_0x92e2('0x23')]]={'$like':'%'+_0x552ab6[_0x92e2('0x2d')][_0x92e2('0x37')]+'%'};return _0x599f0f;}})});}_0x285469=_[_0x92e2('0x38')]({},_0x285469,_0x552ab6[_0x92e2('0x3a')]);var _0x5592f2={'where':_0x285469[_0x92e2('0x34')]};return db['FreshsalesConfiguration'][_0x92e2('0x1a')](_0x5592f2)['then'](function(_0x3e44b8){_0x7de1b6[_0x92e2('0x1a')]=_0x3e44b8;if(_0x552ab6['query'][_0x92e2('0x3b')]){_0x285469['include']=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x285469);})[_0x92e2('0x20')](function(_0x4b6bb8){_0x7de1b6['rows']=_0x4b6bb8;return _0x7de1b6;})[_0x92e2('0x20')](respondWithFilteredResult(_0x1ea964,_0x285469))[_0x92e2('0x3c')](handleError(_0x1ea964,null));};exports[_0x92e2('0x3d')]=function(_0x40d6b0,_0x3013de){var _0x5f379e={'raw':![],'where':{'id':_0x40d6b0[_0x92e2('0x3e')]['id']}},_0xc5775={};_0xc5775[_0x92e2('0x2b')]=_[_0x92e2('0x3f')](db[_0x92e2('0x26')]['rawAttributes']);_0xc5775[_0x92e2('0x2d')]=_[_0x92e2('0x3f')](_0x40d6b0['query']);_0xc5775[_0x92e2('0x35')]=_['intersection'](_0xc5775['model'],_0xc5775[_0x92e2('0x2d')]);_0x5f379e[_0x92e2('0x2e')]=_[_0x92e2('0x2f')](_0xc5775[_0x92e2('0x2b')],qs[_0x92e2('0x40')](_0x40d6b0['query']['fields']));_0x5f379e[_0x92e2('0x2e')]=_0x5f379e[_0x92e2('0x2e')][_0x92e2('0x41')]?_0x5f379e['attributes']:_0xc5775[_0x92e2('0x2b')];if(_0x40d6b0[_0x92e2('0x2d')][_0x92e2('0x3b')]){_0x5f379e[_0x92e2('0x42')]=[{'all':!![]}];}_0x5f379e=_['merge']({},_0x5f379e,_0x40d6b0['options']);return db[_0x92e2('0x26')][_0x92e2('0x43')](_0x5f379e)[_0x92e2('0x20')](handleEntityNotFound(_0x3013de,null))[_0x92e2('0x20')](respondWithResult(_0x3013de,null))[_0x92e2('0x3c')](handleError(_0x3013de,null));};exports['create']=function(_0x299f3a,_0x360cdd){return db[_0x92e2('0x26')]['create'](_0x299f3a['body'],{})[_0x92e2('0x20')](respondWithResult(_0x360cdd,0xc9))[_0x92e2('0x3c')](handleError(_0x360cdd,null));};exports[_0x92e2('0x1f')]=function(_0x47bc27,_0x3e523f){if(_0x47bc27[_0x92e2('0x44')]['id']){delete _0x47bc27[_0x92e2('0x44')]['id'];}return db[_0x92e2('0x26')][_0x92e2('0x43')]({'where':{'id':_0x47bc27[_0x92e2('0x3e')]['id']}})[_0x92e2('0x20')](handleEntityNotFound(_0x3e523f,null))[_0x92e2('0x20')](saveUpdates(_0x47bc27[_0x92e2('0x44')],null))['then'](respondWithResult(_0x3e523f,null))[_0x92e2('0x3c')](handleError(_0x3e523f,null));};exports[_0x92e2('0x21')]=function(_0x57a984,_0x4cd744){return db[_0x92e2('0x26')][_0x92e2('0x43')]({'where':{'id':_0x57a984[_0x92e2('0x3e')]['id']}})[_0x92e2('0x20')](handleEntityNotFound(_0x4cd744,null))[_0x92e2('0x20')](removeEntity(_0x4cd744,null))['catch'](handleError(_0x4cd744,null));};exports['getSubjects']=function(_0x2c159c,_0x23b792,_0x15cf2c){var _0x316426={};var _0x406319={};var _0x325b31;var _0x2492d3;return db['FreshsalesConfiguration'][_0x92e2('0x45')]({'where':{'id':_0x2c159c[_0x92e2('0x3e')]['id']}})[_0x92e2('0x20')](handleEntityNotFound(_0x23b792,null))[_0x92e2('0x20')](function(_0x4679eb){if(_0x4679eb){_0x325b31=_0x4679eb;_0x406319['model']=_[_0x92e2('0x3f')](db[_0x92e2('0x46')][_0x92e2('0x27')]);_0x406319['query']=_[_0x92e2('0x3f')](_0x2c159c['query']);_0x406319[_0x92e2('0x35')]=_[_0x92e2('0x2f')](_0x406319[_0x92e2('0x2b')],_0x406319[_0x92e2('0x2d')]);_0x316426[_0x92e2('0x2e')]=_['intersection'](_0x406319[_0x92e2('0x2b')],qs['fields'](_0x2c159c[_0x92e2('0x2d')]['fields']));_0x316426[_0x92e2('0x2e')]=_0x316426['attributes'][_0x92e2('0x41')]?_0x316426[_0x92e2('0x2e')]:_0x406319[_0x92e2('0x2b')];_0x316426['order']=qs[_0x92e2('0x33')](_0x2c159c['query']['sort']);_0x316426[_0x92e2('0x34')]=qs[_0x92e2('0x35')](_['pick'](_0x2c159c[_0x92e2('0x2d')],_0x406319[_0x92e2('0x35')]));if(_0x2c159c['query'][_0x92e2('0x37')]){_0x316426[_0x92e2('0x34')]=_[_0x92e2('0x38')](_0x316426['where'],{'$or':_['map'](_0x316426[_0x92e2('0x2e')],function(_0xfd010c){var _0x3f2e6e={};_0x3f2e6e[_0xfd010c]={'$like':'%'+_0x2c159c['query'][_0x92e2('0x37')]+'%'};return _0x3f2e6e;})});}_0x316426=_[_0x92e2('0x38')]({},_0x316426,_0x2c159c[_0x92e2('0x3a')]);return _0x325b31[_0x92e2('0x47')](_0x316426);}})['then'](function(_0x25f029){if(_0x25f029){_0x2492d3=_0x25f029['length'];if(!_0x2c159c[_0x92e2('0x2d')][_0x92e2('0x30')](_0x92e2('0x31'))){_0x316426[_0x92e2('0x19')]=qs[_0x92e2('0x19')](_0x2c159c[_0x92e2('0x2d')][_0x92e2('0x19')]);_0x316426[_0x92e2('0x17')]=qs[_0x92e2('0x17')](_0x2c159c['query']['offset']);}return _0x325b31['getSubjects'](_0x316426);}})[_0x92e2('0x20')](function(_0x5165ab){if(_0x5165ab){return _0x5165ab?{'count':_0x2492d3,'rows':_0x5165ab}:null;}})[_0x92e2('0x20')](respondWithResult(_0x23b792,null))[_0x92e2('0x3c')](handleError(_0x23b792,null));};exports[_0x92e2('0x48')]=function(_0xaf98f9,_0x44657e,_0x637792){var _0x5b7841={};var _0x280b40={};var _0x23886f;var _0x197944;return db['FreshsalesConfiguration'][_0x92e2('0x45')]({'where':{'id':_0xaf98f9[_0x92e2('0x3e')]['id']}})[_0x92e2('0x20')](handleEntityNotFound(_0x44657e,null))[_0x92e2('0x20')](function(_0x50beaf){if(_0x50beaf){_0x23886f=_0x50beaf;_0x280b40[_0x92e2('0x2b')]=_[_0x92e2('0x3f')](db[_0x92e2('0x46')][_0x92e2('0x27')]);_0x280b40['query']=_[_0x92e2('0x3f')](_0xaf98f9[_0x92e2('0x2d')]);_0x280b40[_0x92e2('0x35')]=_['intersection'](_0x280b40[_0x92e2('0x2b')],_0x280b40[_0x92e2('0x2d')]);_0x5b7841[_0x92e2('0x2e')]=_[_0x92e2('0x2f')](_0x280b40[_0x92e2('0x2b')],qs[_0x92e2('0x40')](_0xaf98f9[_0x92e2('0x2d')]['fields']));_0x5b7841[_0x92e2('0x2e')]=_0x5b7841[_0x92e2('0x2e')][_0x92e2('0x41')]?_0x5b7841[_0x92e2('0x2e')]:_0x280b40[_0x92e2('0x2b')];_0x5b7841[_0x92e2('0x32')]=qs[_0x92e2('0x33')](_0xaf98f9[_0x92e2('0x2d')][_0x92e2('0x33')]);_0x5b7841['where']=qs[_0x92e2('0x35')](_['pick'](_0xaf98f9[_0x92e2('0x2d')],_0x280b40['filters']));if(_0xaf98f9[_0x92e2('0x2d')][_0x92e2('0x37')]){_0x5b7841[_0x92e2('0x34')]=_[_0x92e2('0x38')](_0x5b7841[_0x92e2('0x34')],{'$or':_['map'](_0x5b7841[_0x92e2('0x2e')],function(_0x183a42){var _0x286d5c={};_0x286d5c[_0x183a42]={'$like':'%'+_0xaf98f9[_0x92e2('0x2d')][_0x92e2('0x37')]+'%'};return _0x286d5c;})});}_0x5b7841=_[_0x92e2('0x38')]({},_0x5b7841,_0xaf98f9[_0x92e2('0x3a')]);return _0x23886f[_0x92e2('0x48')](_0x5b7841);}})[_0x92e2('0x20')](function(_0x1f7341){if(_0x1f7341){_0x197944=_0x1f7341[_0x92e2('0x41')];if(!_0xaf98f9['query'][_0x92e2('0x30')](_0x92e2('0x31'))){_0x5b7841[_0x92e2('0x19')]=qs[_0x92e2('0x19')](_0xaf98f9['query'][_0x92e2('0x19')]);_0x5b7841[_0x92e2('0x17')]=qs['offset'](_0xaf98f9[_0x92e2('0x2d')][_0x92e2('0x17')]);}return _0x23886f[_0x92e2('0x48')](_0x5b7841);}})[_0x92e2('0x20')](function(_0x6fc05f){if(_0x6fc05f){return _0x6fc05f?{'count':_0x197944,'rows':_0x6fc05f}:null;}})[_0x92e2('0x20')](respondWithResult(_0x44657e,null))[_0x92e2('0x3c')](handleError(_0x44657e,null));};exports['getFields']=function(_0x425d37,_0x464476,_0x3021fa){var _0x332432={};var _0x3cff78={};var _0x1423de;var _0x51cddb;return db['FreshsalesConfiguration'][_0x92e2('0x45')]({'where':{'id':_0x425d37[_0x92e2('0x3e')]['id']}})[_0x92e2('0x20')](handleEntityNotFound(_0x464476,null))['then'](function(_0x527adc){if(_0x527adc){_0x1423de=_0x527adc;_0x3cff78[_0x92e2('0x2b')]=_[_0x92e2('0x3f')](db[_0x92e2('0x46')][_0x92e2('0x27')]);_0x3cff78[_0x92e2('0x2d')]=_[_0x92e2('0x3f')](_0x425d37['query']);_0x3cff78[_0x92e2('0x35')]=_[_0x92e2('0x2f')](_0x3cff78[_0x92e2('0x2b')],_0x3cff78[_0x92e2('0x2d')]);_0x332432[_0x92e2('0x2e')]=_[_0x92e2('0x2f')](_0x3cff78[_0x92e2('0x2b')],qs[_0x92e2('0x40')](_0x425d37['query'][_0x92e2('0x40')]));_0x332432['attributes']=_0x332432[_0x92e2('0x2e')]['length']?_0x332432['attributes']:_0x3cff78[_0x92e2('0x2b')];_0x332432['order']=qs['sort'](_0x425d37[_0x92e2('0x2d')]['sort']);_0x332432[_0x92e2('0x34')]=qs[_0x92e2('0x35')](_[_0x92e2('0x36')](_0x425d37['query'],_0x3cff78[_0x92e2('0x35')]));if(_0x425d37[_0x92e2('0x2d')][_0x92e2('0x37')]){_0x332432[_0x92e2('0x34')]=_[_0x92e2('0x38')](_0x332432['where'],{'$or':_['map'](_0x332432[_0x92e2('0x2e')],function(_0x14a07e){var _0x593805={};_0x593805[_0x14a07e]={'$like':'%'+_0x425d37[_0x92e2('0x2d')][_0x92e2('0x37')]+'%'};return _0x593805;})});}_0x332432=_[_0x92e2('0x38')]({},_0x332432,_0x425d37[_0x92e2('0x3a')]);return _0x1423de['getFields'](_0x332432);}})['then'](function(_0x4d418f){if(_0x4d418f){_0x51cddb=_0x4d418f[_0x92e2('0x41')];if(!_0x425d37['query'][_0x92e2('0x30')](_0x92e2('0x31'))){_0x332432['limit']=qs[_0x92e2('0x19')](_0x425d37[_0x92e2('0x2d')]['limit']);_0x332432[_0x92e2('0x17')]=qs[_0x92e2('0x17')](_0x425d37[_0x92e2('0x2d')][_0x92e2('0x17')]);}return _0x1423de[_0x92e2('0x49')](_0x332432);}})['then'](function(_0x2c487e){if(_0x2c487e){return _0x2c487e?{'count':_0x51cddb,'rows':_0x2c487e}:null;}})[_0x92e2('0x20')](respondWithResult(_0x464476,null))[_0x92e2('0x3c')](handleError(_0x464476,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 8ade878..bcd84ca 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 _0x428a=['request-promise','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','util','moment'];(function(_0x954631,_0x12cdb0){var _0x3468d5=function(_0x1aa417){while(--_0x1aa417){_0x954631['push'](_0x954631['shift']());}};_0x3468d5(++_0x12cdb0);}(_0x428a,0x10c));var _0xa428=function(_0x56ac14,_0x80a28c){_0x56ac14=_0x56ac14-0x0;var _0x4c40ed=_0x428a[_0x56ac14];return _0x4c40ed;};'use strict';var _=require('lodash');var util=require(_0xa428('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa428('0x1'));var BPromise=require('bluebird');var rp=require(_0xa428('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa428('0x3'));var attributes=require(_0xa428('0x4'));module[_0xa428('0x5')]=function(_0x322a42,_0x221c1a){return _0x322a42[_0xa428('0x6')](_0xa428('0x7'),attributes,{'tableName':_0xa428('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x915b=['./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x16f899,_0x1ce7d6){var _0xfbca90=function(_0x4c7edb){while(--_0x4c7edb){_0x16f899['push'](_0x16f899['shift']());}};_0xfbca90(++_0x1ce7d6);}(_0x915b,0x1a8));var _0xb915=function(_0x5bf7ba,_0x142806){_0x5bf7ba=_0x5bf7ba-0x0;var _0x5c90d5=_0x915b[_0x5bf7ba];return _0x5c90d5;};'use strict';var _=require(_0xb915('0x0'));var util=require(_0xb915('0x1'));var logger=require(_0xb915('0x2'))(_0xb915('0x3'));var moment=require(_0xb915('0x4'));var BPromise=require(_0xb915('0x5'));var rp=require(_0xb915('0x6'));var fs=require('fs');var path=require(_0xb915('0x7'));var rimraf=require(_0xb915('0x8'));var config=require(_0xb915('0x9'));var attributes=require(_0xb915('0xa'));module['exports']=function(_0x5e30f1,_0xe73b4e){return _0x5e30f1[_0xb915('0xb')](_0xb915('0xc'),attributes,{'tableName':_0xb915('0xd'),'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 2a86091..6f379c4 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 _0x3b63=['FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xae9f3f,_0x3510bd){var _0x2b4389=function(_0xbe0185){while(--_0xbe0185){_0xae9f3f['push'](_0xae9f3f['shift']());}};_0x2b4389(++_0x3510bd);}(_0x3b63,0x131));var _0x33b6=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x3b63[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x33b6('0x0'));var util=require('util');var moment=require(_0x33b6('0x1'));var BPromise=require(_0x33b6('0x2'));var rs=require(_0x33b6('0x3'));var fs=require('fs');var Redis=require(_0x33b6('0x4'));var db=require(_0x33b6('0x5'))['db'];var utils=require(_0x33b6('0x6'));var logger=require('../../config/logger')(_0x33b6('0x7'));var config=require('../../config/environment');var jayson=require(_0x33b6('0x8'));var client=jayson[_0x33b6('0x9')][_0x33b6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5624f3,_0xa3c233,_0x4bd7aa){return new BPromise(function(_0x48eaf8,_0x1b7ef2){return client[_0x33b6('0xb')](_0x5624f3,_0x4bd7aa)[_0x33b6('0xc')](function(_0xd95078){logger[_0x33b6('0xd')](_0x33b6('0xe'),_0xa3c233,_0x33b6('0xf'));logger[_0x33b6('0x10')](_0x33b6('0x11'),_0xa3c233,'request\x20sent',JSON[_0x33b6('0x12')](_0xd95078));if(_0xd95078[_0x33b6('0x13')]){if(_0xd95078[_0x33b6('0x13')][_0x33b6('0x14')]===0x1f4){logger[_0x33b6('0x13')](_0x33b6('0xe'),_0xa3c233,_0xd95078[_0x33b6('0x13')][_0x33b6('0x15')]);return _0x1b7ef2(_0xd95078[_0x33b6('0x13')][_0x33b6('0x15')]);}logger[_0x33b6('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xa3c233,_0xd95078[_0x33b6('0x13')][_0x33b6('0x15')]);return _0x48eaf8(_0xd95078[_0x33b6('0x13')][_0x33b6('0x15')]);}else{logger[_0x33b6('0xd')](_0x33b6('0xe'),_0xa3c233,'request\x20sent');_0x48eaf8(_0xd95078[_0x33b6('0x16')][_0x33b6('0x15')]);}})['catch'](function(_0x299073){logger[_0x33b6('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xa3c233,_0x299073);_0x1b7ef2(_0x299073);});});} \ No newline at end of file +var _0x0894=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x2e7027,_0x2817d6){var _0x4a6f24=function(_0x295508){while(--_0x295508){_0x2e7027['push'](_0x2e7027['shift']());}};_0x4a6f24(++_0x2817d6);}(_0x0894,0x157));var _0x4089=function(_0x2b7149,_0x428ded){_0x2b7149=_0x2b7149-0x0;var _0x2f599b=_0x0894[_0x2b7149];return _0x2f599b;};'use strict';var _=require(_0x4089('0x0'));var util=require(_0x4089('0x1'));var moment=require(_0x4089('0x2'));var BPromise=require(_0x4089('0x3'));var rs=require(_0x4089('0x4'));var fs=require('fs');var Redis=require(_0x4089('0x5'));var db=require(_0x4089('0x6'))['db'];var utils=require(_0x4089('0x7'));var logger=require(_0x4089('0x8'))(_0x4089('0x9'));var config=require('../../config/environment');var jayson=require(_0x4089('0xa'));var client=jayson[_0x4089('0xb')][_0x4089('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5745bf,_0x21b4dd,_0x3534b2){return new BPromise(function(_0x16fa58,_0x5074ec){return client[_0x4089('0xd')](_0x5745bf,_0x3534b2)['then'](function(_0x5aedbf){logger['info'](_0x4089('0xe'),_0x21b4dd,_0x4089('0xf'));logger[_0x4089('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x21b4dd,_0x4089('0xf'),JSON[_0x4089('0x11')](_0x5aedbf));if(_0x5aedbf[_0x4089('0x12')]){if(_0x5aedbf['error'][_0x4089('0x13')]===0x1f4){logger[_0x4089('0x12')](_0x4089('0xe'),_0x21b4dd,_0x5aedbf[_0x4089('0x12')][_0x4089('0x14')]);return _0x5074ec(_0x5aedbf[_0x4089('0x12')][_0x4089('0x14')]);}logger[_0x4089('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x21b4dd,_0x5aedbf['error'][_0x4089('0x14')]);return _0x16fa58(_0x5aedbf[_0x4089('0x12')]['message']);}else{logger['info'](_0x4089('0xe'),_0x21b4dd,_0x4089('0xf'));_0x16fa58(_0x5aedbf[_0x4089('0x15')]['message']);}})[_0x4089('0x16')](function(_0x5da30d){logger[_0x4089('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x21b4dd,_0x5da30d);_0x5074ec(_0x5da30d);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index bb87d7b..87a51b5 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 _0x1782=['fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x2f2b92,_0x27f79c){var _0x53b5af=function(_0xfbf274){while(--_0xfbf274){_0x2f2b92['push'](_0x2f2b92['shift']());}};_0x53b5af(++_0x27f79c);}(_0x1782,0x13e));var _0x2178=function(_0x26615a,_0x20497b){_0x26615a=_0x26615a-0x0;var _0x15ad16=_0x1782[_0x26615a];return _0x15ad16;};'use strict';var multer=require(_0x2178('0x0'));var util=require('util');var path=require(_0x2178('0x1'));var timeout=require(_0x2178('0x2'));var express=require(_0x2178('0x3'));var router=express[_0x2178('0x4')]();var fs_extra=require(_0x2178('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2178('0x6'));var config=require(_0x2178('0x7'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0x2178('0x8')](),controller[_0x2178('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x2178('0xa')]);router[_0x2178('0xb')]('/',auth[_0x2178('0x8')](),controller[_0x2178('0xc')]);router[_0x2178('0xd')](_0x2178('0xe'),auth['isAuthenticated'](),controller[_0x2178('0xf')]);router[_0x2178('0x10')](_0x2178('0xe'),auth[_0x2178('0x8')](),controller[_0x2178('0x11')]);module[_0x2178('0x12')]=router; \ No newline at end of file +var _0x136c=['show','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','index','/:id','isAuthenticated'];(function(_0x26b6f3,_0x44f01c){var _0xcbdfe0=function(_0x53f7ce){while(--_0x53f7ce){_0x26b6f3['push'](_0x26b6f3['shift']());}};_0xcbdfe0(++_0x44f01c);}(_0x136c,0x1d2));var _0xc136=function(_0x58c459,_0x2ee065){_0x58c459=_0x58c459-0x0;var _0x232780=_0x136c[_0x58c459];return _0x232780;};'use strict';var multer=require(_0xc136('0x0'));var util=require(_0xc136('0x1'));var path=require('path');var timeout=require(_0xc136('0x2'));var express=require(_0xc136('0x3'));var router=express[_0xc136('0x4')]();var fs_extra=require(_0xc136('0x5'));var auth=require(_0xc136('0x6'));var interaction=require(_0xc136('0x7'));var config=require(_0xc136('0x8'));var controller=require(_0xc136('0x9'));router[_0xc136('0xa')]('/',auth['isAuthenticated'](),controller[_0xc136('0xb')]);router['get'](_0xc136('0xc'),auth[_0xc136('0xd')](),controller[_0xc136('0xe')]);router['post']('/',auth[_0xc136('0xd')](),controller['create']);router[_0xc136('0xf')](_0xc136('0xc'),auth[_0xc136('0xd')](),controller[_0xc136('0x10')]);router[_0xc136('0x11')](_0xc136('0xc'),auth[_0xc136('0xd')](),controller[_0xc136('0x12')]);module[_0xc136('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 6ad7ab0..e3741a2 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 _0x5418=['picklist','STRING','customVariable','BOOLEAN','exports','ENUM','string','variable','keyValue'];(function(_0xa60623,_0x2d4e4f){var _0x4a6487=function(_0xba6cbe){while(--_0xba6cbe){_0xa60623['push'](_0xa60623['shift']());}};_0x4a6487(++_0x2d4e4f);}(_0x5418,0x1b4));var _0x8541=function(_0x13b137,_0xd541ae){_0x13b137=_0x13b137-0x0;var _0x2b3158=_0x5418[_0x13b137];return _0x2b3158;};'use strict';var Sequelize=require('sequelize');module[_0x8541('0x0')]={'type':{'type':Sequelize[_0x8541('0x1')](_0x8541('0x2'),_0x8541('0x3'),'customVariable',_0x8541('0x4'),_0x8541('0x5')),'defaultValue':_0x8541('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8541('0x6')]},'keyType':{'type':Sequelize[_0x8541('0x1')](_0x8541('0x2'),'variable',_0x8541('0x7'))},'keyContent':{'type':Sequelize[_0x8541('0x6')]},'idField':{'type':Sequelize[_0x8541('0x6')]},'nameField':{'type':Sequelize[_0x8541('0x6')]},'customField':{'type':Sequelize[_0x8541('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8541('0x6')]}}; \ No newline at end of file +var _0xd9cb=['string','customVariable','keyValue','picklist','STRING','variable','sequelize','exports','ENUM'];(function(_0x292f93,_0x2c6e8e){var _0x5a94b1=function(_0x25735e){while(--_0x25735e){_0x292f93['push'](_0x292f93['shift']());}};_0x5a94b1(++_0x2c6e8e);}(_0xd9cb,0x84));var _0xbd9c=function(_0x4345be,_0x1e1dd6){_0x4345be=_0x4345be-0x0;var _0xf851a1=_0xd9cb[_0x4345be];return _0xf851a1;};'use strict';var Sequelize=require(_0xbd9c('0x0'));module[_0xbd9c('0x1')]={'type':{'type':Sequelize[_0xbd9c('0x2')](_0xbd9c('0x3'),'variable',_0xbd9c('0x4'),_0xbd9c('0x5'),_0xbd9c('0x6')),'defaultValue':_0xbd9c('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xbd9c('0x7')]},'keyType':{'type':Sequelize[_0xbd9c('0x2')]('string',_0xbd9c('0x8'),_0xbd9c('0x4'))},'keyContent':{'type':Sequelize[_0xbd9c('0x7')]},'idField':{'type':Sequelize[_0xbd9c('0x7')]},'nameField':{'type':Sequelize[_0xbd9c('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbd9c('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 7e40e0e..43a1b95 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 _0x5077=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','find','create','body','update','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','offset','limit','count','set','json','save','then','destroy','sendStatus','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName'];(function(_0x4c5c71,_0x50767a){var _0x301019=function(_0x915143){while(--_0x915143){_0x4c5c71['push'](_0x4c5c71['shift']());}};_0x301019(++_0x50767a);}(_0x5077,0xf5));var _0x7507=function(_0x1ca00c,_0x26c406){_0x1ca00c=_0x1ca00c-0x0;var _0x5bf31a=_0x5077[_0x1ca00c];return _0x5bf31a;};'use strict';var emlformat=require(_0x7507('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7507('0x1'));var jsonpatch=require(_0x7507('0x2'));var rp=require(_0x7507('0x3'));var moment=require(_0x7507('0x4'));var BPromise=require(_0x7507('0x5'));var Mustache=require('mustache');var util=require(_0x7507('0x6'));var path=require(_0x7507('0x7'));var sox=require(_0x7507('0x8'));var csv=require(_0x7507('0x9'));var ejs=require(_0x7507('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('jsforce');var deskjs=require(_0x7507('0xb'));var toCsv=require(_0x7507('0x9'));var querystring=require('querystring');var Papa=require(_0x7507('0xc'));var Redis=require(_0x7507('0xd'));var authService=require(_0x7507('0xe'));var qs=require(_0x7507('0xf'));var as=require(_0x7507('0x10'));var hardwareService=require(_0x7507('0x11'));var logger=require(_0x7507('0x12'))(_0x7507('0x13'));var utils=require(_0x7507('0x14'));var config=require(_0x7507('0x15'));var licenseUtil=require(_0x7507('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d886a,_0x1c84d0){_0x1c84d0=_0x1c84d0||0xcc;return function(_0x517a47){if(_0x517a47){return _0x4d886a['sendStatus'](_0x1c84d0);}return _0x4d886a['status'](_0x1c84d0)[_0x7507('0x17')]();};}function respondWithResult(_0x348d84,_0xa61bc9){_0xa61bc9=_0xa61bc9||0xc8;return function(_0x1f08ed){if(_0x1f08ed){return _0x348d84[_0x7507('0x18')](_0xa61bc9)['json'](_0x1f08ed);}};}function respondWithFilteredResult(_0x543897,_0x4c0b6e){return function(_0x35c39b){if(_0x35c39b){var _0xfa8a6d=typeof _0x4c0b6e[_0x7507('0x19')]==='undefined'&&typeof _0x4c0b6e[_0x7507('0x1a')]==='undefined';var _0x47933b=_0x35c39b[_0x7507('0x1b')];var _0x2dd2a9=_0xfa8a6d?0x0:_0x4c0b6e[_0x7507('0x19')];var _0x73bfab=_0xfa8a6d?_0x35c39b['count']:_0x4c0b6e['offset']+_0x4c0b6e[_0x7507('0x1a')];var _0x2fc6db;if(_0x73bfab>=_0x47933b){_0x73bfab=_0x47933b;_0x2fc6db=0xc8;}else{_0x2fc6db=0xce;}_0x543897['status'](_0x2fc6db);return _0x543897[_0x7507('0x1c')]('Content-Range',_0x2dd2a9+'-'+_0x73bfab+'/'+_0x47933b)[_0x7507('0x1d')](_0x35c39b);}return null;};}function patchUpdates(_0x110e44){return function(_0x3b966b){try{jsonpatch['apply'](_0x3b966b,_0x110e44,!![]);}catch(_0x3c96cf){return BPromise['reject'](_0x3c96cf);}return _0x3b966b[_0x7507('0x1e')]();};}function saveUpdates(_0x5b65f5,_0x15dc87){return function(_0x20c924){if(_0x20c924){return _0x20c924['update'](_0x5b65f5)[_0x7507('0x1f')](function(_0x2cd266){return _0x2cd266;});}return null;};}function removeEntity(_0x475ebb,_0x416805){return function(_0x431279){if(_0x431279){return _0x431279[_0x7507('0x20')]()[_0x7507('0x1f')](function(){_0x475ebb[_0x7507('0x18')](0xcc)[_0x7507('0x17')]();});}};}function handleEntityNotFound(_0x31521e,_0x18d664){return function(_0x1a2cbb){if(!_0x1a2cbb){_0x31521e[_0x7507('0x21')](0x194);}return _0x1a2cbb;};}function handleError(_0x9fc3f2,_0x545e21){_0x545e21=_0x545e21||0x1f4;return function(_0x4bc0a6){logger[_0x7507('0x22')](_0x4bc0a6[_0x7507('0x23')]);if(_0x4bc0a6[_0x7507('0x24')]){delete _0x4bc0a6[_0x7507('0x24')];}_0x9fc3f2[_0x7507('0x18')](_0x545e21)[_0x7507('0x25')](_0x4bc0a6);};}exports[_0x7507('0x26')]=function(_0x4b3051,_0x158c7d){var _0x5b2cdb={},_0x2c625b={},_0x2d9db5={'count':0x0,'rows':[]};var _0x48051f=_[_0x7507('0x27')](db[_0x7507('0x28')][_0x7507('0x29')],function(_0x1bec7c){return{'name':_0x1bec7c[_0x7507('0x2a')],'type':_0x1bec7c['type'][_0x7507('0x2b')]};});_0x2c625b[_0x7507('0x2c')]=_['map'](_0x48051f,'name');_0x2c625b[_0x7507('0x2d')]=_[_0x7507('0x2e')](_0x4b3051['query']);_0x2c625b[_0x7507('0x2f')]=_[_0x7507('0x30')](_0x2c625b[_0x7507('0x2c')],_0x2c625b[_0x7507('0x2d')]);_0x5b2cdb[_0x7507('0x31')]=_[_0x7507('0x30')](_0x2c625b[_0x7507('0x2c')],qs['fields'](_0x4b3051[_0x7507('0x2d')][_0x7507('0x32')]));_0x5b2cdb[_0x7507('0x31')]=_0x5b2cdb[_0x7507('0x31')][_0x7507('0x33')]?_0x5b2cdb[_0x7507('0x31')]:_0x2c625b['model'];if(!_0x4b3051['query'][_0x7507('0x34')](_0x7507('0x35'))){_0x5b2cdb[_0x7507('0x1a')]=qs[_0x7507('0x1a')](_0x4b3051[_0x7507('0x2d')][_0x7507('0x1a')]);_0x5b2cdb['offset']=qs[_0x7507('0x19')](_0x4b3051[_0x7507('0x2d')][_0x7507('0x19')]);}_0x5b2cdb[_0x7507('0x36')]=qs[_0x7507('0x37')](_0x4b3051['query'][_0x7507('0x37')]);_0x5b2cdb['where']=qs[_0x7507('0x2f')](_['pick'](_0x4b3051[_0x7507('0x2d')],_0x2c625b[_0x7507('0x2f')]),_0x48051f);if(_0x4b3051[_0x7507('0x2d')][_0x7507('0x38')]){_0x5b2cdb[_0x7507('0x39')]=_['merge'](_0x5b2cdb[_0x7507('0x39')],{'$or':_[_0x7507('0x27')](_0x48051f,function(_0x46ae6b){if(_0x46ae6b[_0x7507('0x3a')]!==_0x7507('0x3b')){var _0x1e71b6={};_0x1e71b6[_0x46ae6b['name']]={'$like':'%'+_0x4b3051[_0x7507('0x2d')][_0x7507('0x38')]+'%'};return _0x1e71b6;}})});}_0x5b2cdb=_[_0x7507('0x3c')]({},_0x5b2cdb,_0x4b3051[_0x7507('0x3d')]);var _0x165104={'where':_0x5b2cdb[_0x7507('0x39')]};return db[_0x7507('0x28')][_0x7507('0x1b')](_0x165104)[_0x7507('0x1f')](function(_0x29e01e){_0x2d9db5[_0x7507('0x1b')]=_0x29e01e;if(_0x4b3051[_0x7507('0x2d')][_0x7507('0x3e')]){_0x5b2cdb[_0x7507('0x3f')]=[{'all':!![]}];}return db[_0x7507('0x28')][_0x7507('0x40')](_0x5b2cdb);})['then'](function(_0x327e3c){_0x2d9db5[_0x7507('0x41')]=_0x327e3c;return _0x2d9db5;})[_0x7507('0x1f')](respondWithFilteredResult(_0x158c7d,_0x5b2cdb))[_0x7507('0x42')](handleError(_0x158c7d,null));};exports['show']=function(_0x53847d,_0x19973a){var _0x42e3a4={'raw':!![],'where':{'id':_0x53847d['params']['id']}},_0xb6d0ff={};_0xb6d0ff[_0x7507('0x2c')]=_[_0x7507('0x2e')](db[_0x7507('0x28')][_0x7507('0x29')]);_0xb6d0ff['query']=_['keys'](_0x53847d[_0x7507('0x2d')]);_0xb6d0ff[_0x7507('0x2f')]=_[_0x7507('0x30')](_0xb6d0ff[_0x7507('0x2c')],_0xb6d0ff[_0x7507('0x2d')]);_0x42e3a4[_0x7507('0x31')]=_['intersection'](_0xb6d0ff[_0x7507('0x2c')],qs[_0x7507('0x32')](_0x53847d[_0x7507('0x2d')][_0x7507('0x32')]));_0x42e3a4[_0x7507('0x31')]=_0x42e3a4[_0x7507('0x31')][_0x7507('0x33')]?_0x42e3a4[_0x7507('0x31')]:_0xb6d0ff[_0x7507('0x2c')];if(_0x53847d[_0x7507('0x2d')][_0x7507('0x3e')]){_0x42e3a4[_0x7507('0x3f')]=[{'all':!![]}];}_0x42e3a4=_['merge']({},_0x42e3a4,_0x53847d[_0x7507('0x3d')]);return db[_0x7507('0x28')][_0x7507('0x43')](_0x42e3a4)[_0x7507('0x1f')](handleEntityNotFound(_0x19973a,null))[_0x7507('0x1f')](respondWithResult(_0x19973a,null))[_0x7507('0x42')](handleError(_0x19973a,null));};exports[_0x7507('0x44')]=function(_0xcda054,_0x3aa79e){return db['FreshsalesField'][_0x7507('0x44')](_0xcda054[_0x7507('0x45')],{})[_0x7507('0x1f')](respondWithResult(_0x3aa79e,0xc9))[_0x7507('0x42')](handleError(_0x3aa79e,null));};exports[_0x7507('0x46')]=function(_0x1f1f8c,_0x5a872c){if(_0x1f1f8c['body']['id']){delete _0x1f1f8c[_0x7507('0x45')]['id'];}return db['FreshsalesField'][_0x7507('0x43')]({'where':{'id':_0x1f1f8c[_0x7507('0x47')]['id']}})[_0x7507('0x1f')](handleEntityNotFound(_0x5a872c,null))[_0x7507('0x1f')](saveUpdates(_0x1f1f8c[_0x7507('0x45')],null))[_0x7507('0x1f')](respondWithResult(_0x5a872c,null))[_0x7507('0x42')](handleError(_0x5a872c,null));};exports[_0x7507('0x20')]=function(_0x1177c6,_0x50b329){return db['FreshsalesField'][_0x7507('0x43')]({'where':{'id':_0x1177c6[_0x7507('0x47')]['id']}})[_0x7507('0x1f')](handleEntityNotFound(_0x50b329,null))[_0x7507('0x1f')](removeEntity(_0x50b329,null))['catch'](handleError(_0x50b329,null));}; \ No newline at end of file +var _0xa26f=['zip-dir','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','sort','pick','where','merge','VIRTUAL','options','includeAll','include','rows','catch','params','create','body','update','find','eml-format','rimraf'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xa26f,0x18a));var _0xfa26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa26f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xfa26('0x0'));var rimraf=require(_0xfa26('0x1'));var zipdir=require(_0xfa26('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfa26('0x3'));var BPromise=require(_0xfa26('0x4'));var Mustache=require('mustache');var util=require(_0xfa26('0x5'));var path=require(_0xfa26('0x6'));var sox=require(_0xfa26('0x7'));var csv=require('to-csv');var ejs=require(_0xfa26('0x8'));var fs=require('fs');var fs_extra=require(_0xfa26('0x9'));var _=require(_0xfa26('0xa'));var squel=require(_0xfa26('0xb'));var crypto=require(_0xfa26('0xc'));var jsforce=require(_0xfa26('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfa26('0xe'));var querystring=require('querystring');var Papa=require(_0xfa26('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfa26('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfa26('0x11'));var utils=require(_0xfa26('0x12'));var config=require(_0xfa26('0x13'));var licenseUtil=require(_0xfa26('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18f588,_0x1bbde6){_0x1bbde6=_0x1bbde6||0xcc;return function(_0x2adb31){if(_0x2adb31){return _0x18f588[_0xfa26('0x15')](_0x1bbde6);}return _0x18f588[_0xfa26('0x16')](_0x1bbde6)[_0xfa26('0x17')]();};}function respondWithResult(_0x2a3aa0,_0x455ab5){_0x455ab5=_0x455ab5||0xc8;return function(_0x4fcfc9){if(_0x4fcfc9){return _0x2a3aa0['status'](_0x455ab5)['json'](_0x4fcfc9);}};}function respondWithFilteredResult(_0x4ed2f0,_0x3fdcc7){return function(_0x459119){if(_0x459119){var _0x3dd3b5=typeof _0x3fdcc7[_0xfa26('0x18')]===_0xfa26('0x19')&&typeof _0x3fdcc7[_0xfa26('0x1a')]===_0xfa26('0x19');var _0x1b0280=_0x459119[_0xfa26('0x1b')];var _0x2d4a35=_0x3dd3b5?0x0:_0x3fdcc7[_0xfa26('0x18')];var _0x336aef=_0x3dd3b5?_0x459119[_0xfa26('0x1b')]:_0x3fdcc7[_0xfa26('0x18')]+_0x3fdcc7[_0xfa26('0x1a')];var _0x339ed7;if(_0x336aef>=_0x1b0280){_0x336aef=_0x1b0280;_0x339ed7=0xc8;}else{_0x339ed7=0xce;}_0x4ed2f0[_0xfa26('0x16')](_0x339ed7);return _0x4ed2f0[_0xfa26('0x1c')](_0xfa26('0x1d'),_0x2d4a35+'-'+_0x336aef+'/'+_0x1b0280)['json'](_0x459119);}return null;};}function patchUpdates(_0x4982b9){return function(_0x459f9f){try{jsonpatch[_0xfa26('0x1e')](_0x459f9f,_0x4982b9,!![]);}catch(_0x5cf4d0){return BPromise['reject'](_0x5cf4d0);}return _0x459f9f['save']();};}function saveUpdates(_0x27eb1c,_0x3167dd){return function(_0x3e3f05){if(_0x3e3f05){return _0x3e3f05['update'](_0x27eb1c)[_0xfa26('0x1f')](function(_0x3c17c2){return _0x3c17c2;});}return null;};}function removeEntity(_0xfea9cd,_0x447989){return function(_0x12c675){if(_0x12c675){return _0x12c675[_0xfa26('0x20')]()[_0xfa26('0x1f')](function(){_0xfea9cd[_0xfa26('0x16')](0xcc)[_0xfa26('0x17')]();});}};}function handleEntityNotFound(_0x1ce0d5,_0x27f79e){return function(_0x29a5a4){if(!_0x29a5a4){_0x1ce0d5[_0xfa26('0x15')](0x194);}return _0x29a5a4;};}function handleError(_0x170abb,_0x3b2137){_0x3b2137=_0x3b2137||0x1f4;return function(_0xde5d1e){logger[_0xfa26('0x21')](_0xde5d1e[_0xfa26('0x22')]);if(_0xde5d1e[_0xfa26('0x23')]){delete _0xde5d1e['name'];}_0x170abb[_0xfa26('0x16')](_0x3b2137)[_0xfa26('0x24')](_0xde5d1e);};}exports[_0xfa26('0x25')]=function(_0x25f72f,_0x898ff7){var _0x3ae0f5={},_0x18de77={},_0x5a889b={'count':0x0,'rows':[]};var _0x5d3753=_[_0xfa26('0x26')](db[_0xfa26('0x27')][_0xfa26('0x28')],function(_0x4aa00e){return{'name':_0x4aa00e[_0xfa26('0x29')],'type':_0x4aa00e[_0xfa26('0x2a')]['key']};});_0x18de77[_0xfa26('0x2b')]=_[_0xfa26('0x26')](_0x5d3753,'name');_0x18de77[_0xfa26('0x2c')]=_[_0xfa26('0x2d')](_0x25f72f['query']);_0x18de77[_0xfa26('0x2e')]=_['intersection'](_0x18de77[_0xfa26('0x2b')],_0x18de77[_0xfa26('0x2c')]);_0x3ae0f5[_0xfa26('0x2f')]=_[_0xfa26('0x30')](_0x18de77[_0xfa26('0x2b')],qs[_0xfa26('0x31')](_0x25f72f[_0xfa26('0x2c')][_0xfa26('0x31')]));_0x3ae0f5[_0xfa26('0x2f')]=_0x3ae0f5[_0xfa26('0x2f')][_0xfa26('0x32')]?_0x3ae0f5['attributes']:_0x18de77[_0xfa26('0x2b')];if(!_0x25f72f[_0xfa26('0x2c')]['hasOwnProperty']('nolimit')){_0x3ae0f5['limit']=qs[_0xfa26('0x1a')](_0x25f72f[_0xfa26('0x2c')]['limit']);_0x3ae0f5[_0xfa26('0x18')]=qs['offset'](_0x25f72f[_0xfa26('0x2c')]['offset']);}_0x3ae0f5['order']=qs[_0xfa26('0x33')](_0x25f72f[_0xfa26('0x2c')][_0xfa26('0x33')]);_0x3ae0f5['where']=qs[_0xfa26('0x2e')](_[_0xfa26('0x34')](_0x25f72f[_0xfa26('0x2c')],_0x18de77['filters']),_0x5d3753);if(_0x25f72f[_0xfa26('0x2c')]['filter']){_0x3ae0f5[_0xfa26('0x35')]=_[_0xfa26('0x36')](_0x3ae0f5['where'],{'$or':_[_0xfa26('0x26')](_0x5d3753,function(_0x1f1396){if(_0x1f1396[_0xfa26('0x2a')]!==_0xfa26('0x37')){var _0x50245e={};_0x50245e[_0x1f1396[_0xfa26('0x23')]]={'$like':'%'+_0x25f72f[_0xfa26('0x2c')]['filter']+'%'};return _0x50245e;}})});}_0x3ae0f5=_[_0xfa26('0x36')]({},_0x3ae0f5,_0x25f72f[_0xfa26('0x38')]);var _0x1d7e9b={'where':_0x3ae0f5[_0xfa26('0x35')]};return db[_0xfa26('0x27')][_0xfa26('0x1b')](_0x1d7e9b)[_0xfa26('0x1f')](function(_0x4c2908){_0x5a889b[_0xfa26('0x1b')]=_0x4c2908;if(_0x25f72f[_0xfa26('0x2c')][_0xfa26('0x39')]){_0x3ae0f5[_0xfa26('0x3a')]=[{'all':!![]}];}return db[_0xfa26('0x27')]['findAll'](_0x3ae0f5);})['then'](function(_0x4f4d16){_0x5a889b[_0xfa26('0x3b')]=_0x4f4d16;return _0x5a889b;})['then'](respondWithFilteredResult(_0x898ff7,_0x3ae0f5))[_0xfa26('0x3c')](handleError(_0x898ff7,null));};exports['show']=function(_0x3620df,_0x417505){var _0x22edf4={'raw':!![],'where':{'id':_0x3620df[_0xfa26('0x3d')]['id']}},_0x2c740d={};_0x2c740d[_0xfa26('0x2b')]=_[_0xfa26('0x2d')](db[_0xfa26('0x27')][_0xfa26('0x28')]);_0x2c740d[_0xfa26('0x2c')]=_[_0xfa26('0x2d')](_0x3620df['query']);_0x2c740d[_0xfa26('0x2e')]=_[_0xfa26('0x30')](_0x2c740d[_0xfa26('0x2b')],_0x2c740d[_0xfa26('0x2c')]);_0x22edf4[_0xfa26('0x2f')]=_[_0xfa26('0x30')](_0x2c740d[_0xfa26('0x2b')],qs[_0xfa26('0x31')](_0x3620df['query'][_0xfa26('0x31')]));_0x22edf4[_0xfa26('0x2f')]=_0x22edf4[_0xfa26('0x2f')][_0xfa26('0x32')]?_0x22edf4[_0xfa26('0x2f')]:_0x2c740d['model'];if(_0x3620df[_0xfa26('0x2c')]['includeAll']){_0x22edf4[_0xfa26('0x3a')]=[{'all':!![]}];}_0x22edf4=_[_0xfa26('0x36')]({},_0x22edf4,_0x3620df[_0xfa26('0x38')]);return db[_0xfa26('0x27')]['find'](_0x22edf4)[_0xfa26('0x1f')](handleEntityNotFound(_0x417505,null))[_0xfa26('0x1f')](respondWithResult(_0x417505,null))[_0xfa26('0x3c')](handleError(_0x417505,null));};exports[_0xfa26('0x3e')]=function(_0x501f0b,_0x35d370){return db[_0xfa26('0x27')]['create'](_0x501f0b[_0xfa26('0x3f')],{})[_0xfa26('0x1f')](respondWithResult(_0x35d370,0xc9))[_0xfa26('0x3c')](handleError(_0x35d370,null));};exports[_0xfa26('0x40')]=function(_0x3e1ba2,_0x3f1f3a){if(_0x3e1ba2['body']['id']){delete _0x3e1ba2['body']['id'];}return db['FreshsalesField'][_0xfa26('0x41')]({'where':{'id':_0x3e1ba2[_0xfa26('0x3d')]['id']}})[_0xfa26('0x1f')](handleEntityNotFound(_0x3f1f3a,null))[_0xfa26('0x1f')](saveUpdates(_0x3e1ba2['body'],null))[_0xfa26('0x1f')](respondWithResult(_0x3f1f3a,null))['catch'](handleError(_0x3f1f3a,null));};exports[_0xfa26('0x20')]=function(_0x2ba98b,_0x1632e0){return db['FreshsalesField'][_0xfa26('0x41')]({'where':{'id':_0x2ba98b['params']['id']}})[_0xfa26('0x1f')](handleEntityNotFound(_0x1632e0,null))[_0xfa26('0x1f')](removeEntity(_0x1632e0,null))['catch'](handleError(_0x1632e0,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 99e4bd1..39c494d 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 _0x15b8=['moment','bluebird','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','util','../../config/logger','api'];(function(_0xdfc82c,_0x2bef7d){var _0x57994e=function(_0x489b24){while(--_0x489b24){_0xdfc82c['push'](_0xdfc82c['shift']());}};_0x57994e(++_0x2bef7d);}(_0x15b8,0xcd));var _0x815b=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x15b8[_0x1caf6a];return _0x1bf493;};'use strict';var _=require('lodash');var util=require(_0x815b('0x0'));var logger=require(_0x815b('0x1'))(_0x815b('0x2'));var moment=require(_0x815b('0x3'));var BPromise=require(_0x815b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x815b('0x5'));var rimraf=require(_0x815b('0x6'));var config=require(_0x815b('0x7'));var attributes=require(_0x815b('0x8'));module[_0x815b('0x9')]=function(_0x37a503,_0x581869){return _0x37a503[_0x815b('0xa')](_0x815b('0xb'),attributes,{'tableName':_0x815b('0xc'),'paranoid':![],'indexes':[{'name':_0x815b('0xd'),'fields':[_0x815b('0xe'),_0x815b('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5523=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','int_freshsales_fields','idField','FieldId','../../config/logger'];(function(_0x5e7514,_0x30c2e1){var _0x12f472=function(_0x33ddb6){while(--_0x33ddb6){_0x5e7514['push'](_0x5e7514['shift']());}};_0x12f472(++_0x30c2e1);}(_0x5523,0x137));var _0x3552=function(_0x19795d,_0x5f0b16){_0x19795d=_0x19795d-0x0;var _0x9a6cbb=_0x5523[_0x19795d];return _0x9a6cbb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3552('0x0'))(_0x3552('0x1'));var moment=require(_0x3552('0x2'));var BPromise=require(_0x3552('0x3'));var rp=require(_0x3552('0x4'));var fs=require('fs');var path=require(_0x3552('0x5'));var rimraf=require(_0x3552('0x6'));var config=require(_0x3552('0x7'));var attributes=require(_0x3552('0x8'));module[_0x3552('0x9')]=function(_0x3225aa,_0x58385b){return _0x3225aa['define']('FreshsalesField',attributes,{'tableName':_0x3552('0xa'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x3552('0xb'),_0x3552('0xc')],'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 c2fb280..ee6251b 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.rpc.js +++ b/server/api/intFreshsalesField/intFreshsalesField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesField,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x166310,_0x49c9f4){var _0xd24eb8=function(_0x2b1aa8){while(--_0x2b1aa8){_0x166310['push'](_0x166310['shift']());}};_0xd24eb8(++_0x49c9f4);}(_0x5fab,0x177));var _0xb5fa=function(_0x5db59c,_0x11cc79){_0x5db59c=_0x5db59c-0x0;var _0x2a1f41=_0x5fab[_0x5db59c];return _0x2a1f41;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('FreshsalesField,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file +var _0x326f=['info','FreshsalesField,\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(_0x4cd2cd,_0x5ed519){var _0x2a764f=function(_0x355421){while(--_0x355421){_0x4cd2cd['push'](_0x4cd2cd['shift']());}};_0x2a764f(++_0x5ed519);}(_0x326f,0xd1));var _0xf326=function(_0x54e4d6,_0x1ca183){_0x54e4d6=_0x54e4d6-0x0;var _0x5654a9=_0x326f[_0x54e4d6];return _0x5654a9;};'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')]('FreshsalesField,\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')]('FreshsalesField,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index b444158..9575caf 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x18f084,_0x782d8e){var _0x5943b7=function(_0x2f35bb){while(--_0x2f35bb){_0x18f084['push'](_0x18f084['shift']());}};_0x5943b7(++_0x782d8e);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +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(_0x3dad8c,_0x18dd6a){var _0x1a2757=function(_0xd162e7){while(--_0xd162e7){_0x3dad8c['push'](_0x3dad8c['shift']());}};_0x1a2757(++_0x18dd6a);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 8eaa28a..3b8ea9d 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 _0xf65d=['username','ENUM','integrationTab','newTab','STRING'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0xf65d,0x13a));var _0xdf65=function(_0x161e88,_0x49ce5e){_0x161e88=_0x161e88-0x0;var _0x40ee62=_0xf65d[_0x161e88];return _0x40ee62;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdf65('0x0')]},'username':{'type':Sequelize[_0xdf65('0x0')],'unique':_0xdf65('0x1')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xdf65('0x0')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xdf65('0x0')]},'securityToken':{'type':Sequelize[_0xdf65('0x0')]},'serverUrl':{'type':Sequelize[_0xdf65('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xdf65('0x2')](_0xdf65('0x3'),_0xdf65('0x4')),'defaultValue':_0xdf65('0x3')}}; \ No newline at end of file +var _0x3c85=['sequelize','exports','STRING','ENUM'];(function(_0x5dcaf7,_0x184cfa){var _0x1184ed=function(_0x3e6ff5){while(--_0x3e6ff5){_0x5dcaf7['push'](_0x5dcaf7['shift']());}};_0x1184ed(++_0x184cfa);}(_0x3c85,0x1a0));var _0x53c8=function(_0x20e142,_0x423b78){_0x20e142=_0x20e142-0x0;var _0x1dc27e=_0x3c85[_0x20e142];return _0x1dc27e;};'use strict';var Sequelize=require(_0x53c8('0x0'));module[_0x53c8('0x1')]={'name':{'type':Sequelize[_0x53c8('0x2')]},'description':{'type':Sequelize[_0x53c8('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'remoteUri':{'type':Sequelize[_0x53c8('0x2')]},'password':{'type':Sequelize[_0x53c8('0x2')]},'clientId':{'type':Sequelize[_0x53c8('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x53c8('0x2')]},'serverUrl':{'type':Sequelize[_0x53c8('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x53c8('0x3')]('integrationTab','newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 5063ef4..e623099 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 _0xf352=['include','find','create','body','destroy','findOne','SalesforceConfiguration','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','login','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','Subject','int','picklist','email','textarea','includes','label','custom','picklistValues','value','True','false','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params'];(function(_0x2217c9,_0x25abb1){var _0x255d8d=function(_0xf00fad){while(--_0xf00fad){_0x2217c9['push'](_0x2217c9['shift']());}};_0x255d8d(++_0x25abb1);}(_0xf352,0x1ac));var _0x2f35=function(_0x159bd7,_0x54e412){_0x159bd7=_0x159bd7-0x0;var _0x439a6a=_0xf352[_0x159bd7];return _0x439a6a;};'use strict';var emlformat=require(_0x2f35('0x0'));var rimraf=require(_0x2f35('0x1'));var zipdir=require(_0x2f35('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2f35('0x3'));var BPromise=require(_0x2f35('0x4'));var Mustache=require(_0x2f35('0x5'));var util=require(_0x2f35('0x6'));var path=require(_0x2f35('0x7'));var sox=require(_0x2f35('0x8'));var csv=require(_0x2f35('0x9'));var ejs=require(_0x2f35('0xa'));var fs=require('fs');var fs_extra=require(_0x2f35('0xb'));var _=require(_0x2f35('0xc'));var squel=require(_0x2f35('0xd'));var crypto=require(_0x2f35('0xe'));var jsforce=require(_0x2f35('0xf'));var deskjs=require(_0x2f35('0x10'));var toCsv=require(_0x2f35('0x9'));var querystring=require(_0x2f35('0x11'));var Papa=require('papaparse');var Redis=require(_0x2f35('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2f35('0x13'));var as=require(_0x2f35('0x14'));var hardwareService=require(_0x2f35('0x15'));var logger=require(_0x2f35('0x16'))('api');var utils=require(_0x2f35('0x17'));var config=require(_0x2f35('0x18'));var licenseUtil=require(_0x2f35('0x19'));var db=require(_0x2f35('0x1a'))['db'];var integrations=require(_0x2f35('0x1b'));function respondWithStatusCode(_0x28c032,_0x3ca283){_0x3ca283=_0x3ca283||0xcc;return function(_0x9744c1){if(_0x9744c1){return _0x28c032[_0x2f35('0x1c')](_0x3ca283);}return _0x28c032[_0x2f35('0x1d')](_0x3ca283)[_0x2f35('0x1e')]();};}function respondWithResult(_0x100f13,_0x3f7bcb){_0x3f7bcb=_0x3f7bcb||0xc8;return function(_0x3282ce){if(_0x3282ce){return _0x100f13[_0x2f35('0x1d')](_0x3f7bcb)[_0x2f35('0x1f')](_0x3282ce);}};}function respondWithFilteredResult(_0x55f85c,_0x31bb09){return function(_0x1313f9){if(_0x1313f9){var _0x467272=typeof _0x31bb09['offset']==='undefined'&&typeof _0x31bb09[_0x2f35('0x20')]===_0x2f35('0x21');var _0x2e6630=_0x1313f9[_0x2f35('0x22')];var _0x53ab47=_0x467272?0x0:_0x31bb09[_0x2f35('0x23')];var _0x5157cc=_0x467272?_0x1313f9[_0x2f35('0x22')]:_0x31bb09[_0x2f35('0x23')]+_0x31bb09[_0x2f35('0x20')];var _0x29803d;if(_0x5157cc>=_0x2e6630){_0x5157cc=_0x2e6630;_0x29803d=0xc8;}else{_0x29803d=0xce;}_0x55f85c[_0x2f35('0x1d')](_0x29803d);return _0x55f85c[_0x2f35('0x24')](_0x2f35('0x25'),_0x53ab47+'-'+_0x5157cc+'/'+_0x2e6630)[_0x2f35('0x1f')](_0x1313f9);}return null;};}function patchUpdates(_0x4c8f66){return function(_0x39e067){try{jsonpatch[_0x2f35('0x26')](_0x39e067,_0x4c8f66,!![]);}catch(_0xd2a1ae){return BPromise[_0x2f35('0x27')](_0xd2a1ae);}return _0x39e067[_0x2f35('0x28')]();};}function saveUpdates(_0x130f9e,_0x577e18){return function(_0x55cbf8){if(_0x55cbf8){return _0x55cbf8[_0x2f35('0x29')](_0x130f9e)[_0x2f35('0x2a')](function(_0x4e603a){return _0x4e603a;});}return null;};}function removeEntity(_0x49347c,_0x49bd2b){return function(_0x2685d0){if(_0x2685d0){return _0x2685d0['destroy']()[_0x2f35('0x2a')](function(){_0x49347c['status'](0xcc)[_0x2f35('0x1e')]();});}};}function handleEntityNotFound(_0x4d5987,_0xb392cc){return function(_0x46174f){if(!_0x46174f){_0x4d5987[_0x2f35('0x1c')](0x194);}return _0x46174f;};}function handleError(_0x44a693,_0x3198f8){_0x3198f8=_0x3198f8||0x1f4;return function(_0x29cee2){logger[_0x2f35('0x2b')](_0x29cee2[_0x2f35('0x2c')]);if(_0x29cee2[_0x2f35('0x2d')]){delete _0x29cee2[_0x2f35('0x2d')];}_0x44a693['status'](_0x3198f8)[_0x2f35('0x2e')](_0x29cee2);};}exports[_0x2f35('0x2f')]=function(_0xe2e515,_0x71001b){var _0x331c62={},_0xc95034={},_0x58ea38={'count':0x0,'rows':[]};var _0x120f30=_[_0x2f35('0x30')](db[_0x2f35('0x31')][_0x2f35('0x32')],function(_0x39f34a){return{'name':_0x39f34a[_0x2f35('0x33')],'type':_0x39f34a[_0x2f35('0x34')][_0x2f35('0x35')]};});_0xc95034[_0x2f35('0x36')]=_[_0x2f35('0x30')](_0x120f30,_0x2f35('0x2d'));_0xc95034['query']=_[_0x2f35('0x37')](_0xe2e515['query']);_0xc95034[_0x2f35('0x38')]=_['intersection'](_0xc95034['model'],_0xc95034[_0x2f35('0x39')]);_0x331c62[_0x2f35('0x3a')]=_[_0x2f35('0x3b')](_0xc95034['model'],qs[_0x2f35('0x3c')](_0xe2e515[_0x2f35('0x39')][_0x2f35('0x3c')]));_0x331c62[_0x2f35('0x3a')]=_0x331c62['attributes'][_0x2f35('0x3d')]?_0x331c62[_0x2f35('0x3a')]:_0xc95034['model'];if(!_0xe2e515[_0x2f35('0x39')]['hasOwnProperty'](_0x2f35('0x3e'))){_0x331c62['limit']=qs[_0x2f35('0x20')](_0xe2e515['query'][_0x2f35('0x20')]);_0x331c62[_0x2f35('0x23')]=qs['offset'](_0xe2e515[_0x2f35('0x39')][_0x2f35('0x23')]);}_0x331c62[_0x2f35('0x3f')]=qs[_0x2f35('0x40')](_0xe2e515[_0x2f35('0x39')][_0x2f35('0x40')]);_0x331c62[_0x2f35('0x41')]=qs['filters'](_[_0x2f35('0x42')](_0xe2e515[_0x2f35('0x39')],_0xc95034[_0x2f35('0x38')]),_0x120f30);if(_0xe2e515[_0x2f35('0x39')]['filter']){_0x331c62[_0x2f35('0x41')]=_[_0x2f35('0x43')](_0x331c62[_0x2f35('0x41')],{'$or':_['map'](_0x120f30,function(_0x3bc80a){if(_0x3bc80a[_0x2f35('0x34')]!==_0x2f35('0x44')){var _0x2dc6c1={};_0x2dc6c1[_0x3bc80a[_0x2f35('0x2d')]]={'$like':'%'+_0xe2e515['query'][_0x2f35('0x45')]+'%'};return _0x2dc6c1;}})});}_0x331c62=_[_0x2f35('0x43')]({},_0x331c62,_0xe2e515[_0x2f35('0x46')]);var _0x4746bf={'where':_0x331c62[_0x2f35('0x41')]};return db[_0x2f35('0x31')][_0x2f35('0x22')](_0x4746bf)[_0x2f35('0x2a')](function(_0x14ae84){_0x58ea38[_0x2f35('0x22')]=_0x14ae84;if(_0xe2e515[_0x2f35('0x39')][_0x2f35('0x47')]){_0x331c62['include']=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x331c62);})[_0x2f35('0x2a')](function(_0x256a17){_0x58ea38[_0x2f35('0x48')]=_0x256a17;return _0x58ea38;})[_0x2f35('0x2a')](respondWithFilteredResult(_0x71001b,_0x331c62))[_0x2f35('0x49')](handleError(_0x71001b,null));};exports[_0x2f35('0x4a')]=function(_0x428ffb,_0x1be63b){var _0xd94fb5={'raw':![],'where':{'id':_0x428ffb[_0x2f35('0x4b')]['id']}},_0x1f9362={};_0x1f9362[_0x2f35('0x36')]=_[_0x2f35('0x37')](db[_0x2f35('0x31')][_0x2f35('0x32')]);_0x1f9362[_0x2f35('0x39')]=_[_0x2f35('0x37')](_0x428ffb[_0x2f35('0x39')]);_0x1f9362[_0x2f35('0x38')]=_['intersection'](_0x1f9362[_0x2f35('0x36')],_0x1f9362[_0x2f35('0x39')]);_0xd94fb5[_0x2f35('0x3a')]=_[_0x2f35('0x3b')](_0x1f9362[_0x2f35('0x36')],qs[_0x2f35('0x3c')](_0x428ffb[_0x2f35('0x39')][_0x2f35('0x3c')]));_0xd94fb5['attributes']=_0xd94fb5[_0x2f35('0x3a')]['length']?_0xd94fb5['attributes']:_0x1f9362[_0x2f35('0x36')];if(_0x428ffb[_0x2f35('0x39')][_0x2f35('0x47')]){_0xd94fb5[_0x2f35('0x4c')]=[{'all':!![]}];}_0xd94fb5=_[_0x2f35('0x43')]({},_0xd94fb5,_0x428ffb[_0x2f35('0x46')]);return db[_0x2f35('0x31')][_0x2f35('0x4d')](_0xd94fb5)[_0x2f35('0x2a')](handleEntityNotFound(_0x1be63b,null))[_0x2f35('0x2a')](respondWithResult(_0x1be63b,null))['catch'](handleError(_0x1be63b,null));};exports[_0x2f35('0x4e')]=function(_0x1d047e,_0x417c40){return db[_0x2f35('0x31')][_0x2f35('0x4e')](_0x1d047e[_0x2f35('0x4f')],{})['then'](respondWithResult(_0x417c40,0xc9))[_0x2f35('0x49')](handleError(_0x417c40,null));};exports[_0x2f35('0x29')]=function(_0x2c5327,_0x5ca962){if(_0x2c5327[_0x2f35('0x4f')]['id']){delete _0x2c5327[_0x2f35('0x4f')]['id'];}return db[_0x2f35('0x31')][_0x2f35('0x4d')]({'where':{'id':_0x2c5327['params']['id']}})['then'](handleEntityNotFound(_0x5ca962,null))[_0x2f35('0x2a')](saveUpdates(_0x2c5327[_0x2f35('0x4f')],null))['then'](respondWithResult(_0x5ca962,null))[_0x2f35('0x49')](handleError(_0x5ca962,null));};exports[_0x2f35('0x50')]=function(_0x1e8d83,_0x747c9b){return db[_0x2f35('0x31')][_0x2f35('0x4d')]({'where':{'id':_0x1e8d83['params']['id']}})[_0x2f35('0x2a')](handleEntityNotFound(_0x747c9b,null))[_0x2f35('0x2a')](removeEntity(_0x747c9b,null))[_0x2f35('0x49')](handleError(_0x747c9b,null));};exports['getConfigurations']=function(_0x56887d,_0x4d3670,_0x1aa168){var _0x46b70d={};var _0x1ab46b={};var _0x19d396;var _0x56caf6;return db[_0x2f35('0x31')][_0x2f35('0x51')]({'where':{'id':_0x56887d['params']['id']}})[_0x2f35('0x2a')](handleEntityNotFound(_0x4d3670,null))[_0x2f35('0x2a')](function(_0x5a0d3a){if(_0x5a0d3a){_0x19d396=_0x5a0d3a;_0x1ab46b[_0x2f35('0x36')]=_[_0x2f35('0x37')](db[_0x2f35('0x52')]['rawAttributes']);_0x1ab46b[_0x2f35('0x39')]=_['keys'](_0x56887d[_0x2f35('0x39')]);_0x1ab46b['filters']=_[_0x2f35('0x3b')](_0x1ab46b[_0x2f35('0x36')],_0x1ab46b['query']);_0x46b70d[_0x2f35('0x3a')]=_['intersection'](_0x1ab46b[_0x2f35('0x36')],qs[_0x2f35('0x3c')](_0x56887d[_0x2f35('0x39')]['fields']));_0x46b70d[_0x2f35('0x3a')]=_0x46b70d[_0x2f35('0x3a')][_0x2f35('0x3d')]?_0x46b70d['attributes']:_0x1ab46b['model'];_0x46b70d[_0x2f35('0x3f')]=qs[_0x2f35('0x40')](_0x56887d['query'][_0x2f35('0x40')]);_0x46b70d['where']=qs[_0x2f35('0x38')](_[_0x2f35('0x42')](_0x56887d[_0x2f35('0x39')],_0x1ab46b[_0x2f35('0x38')]));if(_0x56887d[_0x2f35('0x39')][_0x2f35('0x45')]){_0x46b70d[_0x2f35('0x41')]=_['merge'](_0x46b70d['where'],{'$or':_[_0x2f35('0x30')](_0x46b70d[_0x2f35('0x3a')],function(_0x3a8dbd){var _0x382f88={};_0x382f88[_0x3a8dbd]={'$like':'%'+_0x56887d['query']['filter']+'%'};return _0x382f88;})});}_0x46b70d=_[_0x2f35('0x43')]({},_0x46b70d,_0x56887d[_0x2f35('0x46')]);return _0x19d396['getConfigurations'](_0x46b70d);}})[_0x2f35('0x2a')](function(_0x2e3b1f){if(_0x2e3b1f){_0x56caf6=_0x2e3b1f[_0x2f35('0x3d')];if(!_0x56887d[_0x2f35('0x39')]['hasOwnProperty']('nolimit')){_0x46b70d[_0x2f35('0x20')]=qs[_0x2f35('0x20')](_0x56887d[_0x2f35('0x39')][_0x2f35('0x20')]);_0x46b70d['offset']=qs[_0x2f35('0x23')](_0x56887d[_0x2f35('0x39')][_0x2f35('0x23')]);}return _0x19d396[_0x2f35('0x53')](_0x46b70d);}})[_0x2f35('0x2a')](function(_0x2eb146){if(_0x2eb146){return _0x2eb146?{'count':_0x56caf6,'rows':_0x2eb146}:null;}})[_0x2f35('0x2a')](respondWithResult(_0x4d3670,null))[_0x2f35('0x49')](handleError(_0x4d3670,null));};exports[_0x2f35('0x54')]=function(_0x13e8b4,_0x4f835e,_0x43ad45){if(_0x13e8b4[_0x2f35('0x4f')]['id']){delete _0x13e8b4[_0x2f35('0x4f')]['id'];}return db[_0x2f35('0x31')][_0x2f35('0x51')]({'where':{'id':_0x13e8b4[_0x2f35('0x4b')]['id']}})[_0x2f35('0x2a')](handleEntityNotFound(_0x4f835e,null))[_0x2f35('0x2a')](function(_0x1ec987){if(_0x1ec987){_0x13e8b4[_0x2f35('0x4f')][_0x2f35('0x55')]=_0x1ec987['id'];_0x13e8b4[_0x2f35('0x4f')]['Subjects']=integrations[_0x2f35('0x56')](_0x13e8b4[_0x2f35('0x4f')][_0x2f35('0x57')],_0x13e8b4[_0x2f35('0x4f')][_0x2f35('0x34')]);_0x13e8b4['body'][_0x2f35('0x58')]=integrations[_0x2f35('0x59')](_0x13e8b4[_0x2f35('0x4f')][_0x2f35('0x57')],_0x13e8b4['body'][_0x2f35('0x34')]);return db[_0x2f35('0x52')][_0x2f35('0x4e')](_0x13e8b4[_0x2f35('0x4f')],{'include':[{'model':db['SalesforceField'],'as':_0x2f35('0x5a')},{'model':db['SalesforceField'],'as':'Descriptions'}]});}return null;})[_0x2f35('0x2a')](respondWithResult(_0x4f835e,null))[_0x2f35('0x49')](handleError(_0x4f835e,null));};exports['getFields']=function(_0x46571c,_0x304efa,_0x4f1b1d){var _0x15087f;var _0x251939='';var _0x7e1ffe=_0x2f35('0x5b');return db['SalesforceAccount']['findOne']({'where':{'id':_0x46571c['params']['id']},'attributes':['id',_0x2f35('0x5c'),_0x2f35('0x5d'),_0x2f35('0x5e'),_0x2f35('0x5f'),_0x2f35('0x60'),_0x2f35('0x61')]})[_0x2f35('0x2a')](handleEntityNotFound(_0x304efa,null))[_0x2f35('0x2a')](function(_0x771e6){if(_0x771e6){_0x251939=_0x771e6['remoteUri'];var _0x1ec462=_0x251939[_0x2f35('0x62')](-0x1);if(_0x1ec462==='/'){_0x251939=_0x251939[_0x2f35('0x63')](0x0,_0x251939[_0x2f35('0x64')](_0x1ec462));}_0x15087f=new jsforce['Connection']({'oauth2':{'loginUrl':_0x251939,'clientId':_0x771e6[_0x2f35('0x5d')],'clientSecret':_0x771e6[_0x2f35('0x5e')]}});return _0x15087f[_0x2f35('0x65')](_0x771e6[_0x2f35('0x5f')],_0x771e6[_0x2f35('0x60')]['concat'](_0x771e6[_0x2f35('0x61')]));}})[_0x2f35('0x2a')](function(_0x2db587){if(_0x2db587){if(!_[_0x2f35('0x66')](_0x46571c[_0x2f35('0x39')][_0x2f35('0x67')])){_0x7e1ffe=_0x46571c[_0x2f35('0x39')]['ticketType'];}return _0x15087f['sobject'](_0x7e1ffe)[_0x2f35('0x68')]();}})[_0x2f35('0x2a')](function(_0x5b1455){var _0x4eda52=[_0x2f35('0x69'),_0x2f35('0x6a'),_0x2f35('0x6b'),'IsRecurrence',_0x2f35('0x6c'),'Description'];var _0x16d7e6=['string',_0x2f35('0x6d'),_0x2f35('0x6e'),'boolean',_0x2f35('0x6f'),_0x2f35('0x70'),'phone'];if(_0x5b1455){_['remove'](_0x5b1455[_0x2f35('0x3c')],function(_0x33c654){return _0x4eda52[_0x2f35('0x71')](_0x33c654[_0x2f35('0x2d')])||!_0x16d7e6[_0x2f35('0x71')](_0x33c654[_0x2f35('0x34')]);});return{'count':_0x5b1455[_0x2f35('0x3c')]['length'],'rows':_['map'](_0x5b1455[_0x2f35('0x3c')],function(_0x31388b){return{'id':_0x31388b[_0x2f35('0x2d')],'name':_0x31388b[_0x2f35('0x72')],'custom':_0x31388b[_0x2f35('0x73')],'options':_0x31388b[_0x2f35('0x74')][_0x2f35('0x3d')]>0x0?_[_0x2f35('0x30')](_0x31388b[_0x2f35('0x74')],function(_0x4ce032){return{'name':_0x4ce032[_0x2f35('0x72')],'value':_0x4ce032[_0x2f35('0x75')]};}):_0x31388b[_0x2f35('0x34')]=='boolean'?[{'name':_0x2f35('0x76'),'value':'true'},{'name':'False','value':_0x2f35('0x77')}]:[]};})};}})['then'](respondWithResult(_0x304efa,null))[_0x2f35('0x49')](function(_0x45bdcf){var _0x414369=_0x46571c[_0x2f35('0x39')]['test']?0x1f4:_0x45bdcf['statusCode']||0x1f4;logger['error'](_0x2f35('0x78'),_0x2f35('0x79'),_0x414369,JSON[_0x2f35('0x7a')](_0x45bdcf));delete _0x45bdcf[_0x2f35('0x2d')];if(_0x414369===0x191){_0x414369=0x190;}_0x304efa[_0x2f35('0x1d')](_0x414369)['send'](_0x46571c[_0x2f35('0x39')][_0x2f35('0x7b')]?{'message':_0x2f35('0x7c'),'statusCode':_0x45bdcf[_0x2f35('0x7d')]}:_0x45bdcf);});}; \ No newline at end of file +var _0x73a2=['False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','SalesforceAccount','rawAttributes','fieldName','key','map','query','filters','intersection','model','attributes','fields','nolimit','order','sort','pick','where','type','VIRTUAL','filter','options','includeAll','include','findAll','show','keys','length','catch','body','find','params','SalesforceConfiguration','hasOwnProperty','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','create','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','securityToken','slice','substring','lastIndexOf','login','password','concat','isNil','sobject','describe','ActivityDate','IsRecurrence','Subject','int','picklist','boolean','email','phone','remove','includes','custom','picklistValues','value','True','true'];(function(_0x53e3fa,_0x50c5f2){var _0xe8584a=function(_0x1771a5){while(--_0x1771a5){_0x53e3fa['push'](_0x53e3fa['shift']());}};_0xe8584a(++_0x50c5f2);}(_0x73a2,0x1f3));var _0x273a=function(_0x44a02b,_0x4fbeb9){_0x44a02b=_0x44a02b-0x0;var _0x255375=_0x73a2[_0x44a02b];return _0x255375;};'use strict';var emlformat=require(_0x273a('0x0'));var rimraf=require(_0x273a('0x1'));var zipdir=require(_0x273a('0x2'));var jsonpatch=require(_0x273a('0x3'));var rp=require(_0x273a('0x4'));var moment=require(_0x273a('0x5'));var BPromise=require(_0x273a('0x6'));var Mustache=require('mustache');var util=require(_0x273a('0x7'));var path=require(_0x273a('0x8'));var sox=require(_0x273a('0x9'));var csv=require(_0x273a('0xa'));var ejs=require(_0x273a('0xb'));var fs=require('fs');var fs_extra=require(_0x273a('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x273a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x273a('0xe'));var toCsv=require(_0x273a('0xa'));var querystring=require(_0x273a('0xf'));var Papa=require(_0x273a('0x10'));var Redis=require(_0x273a('0x11'));var authService=require(_0x273a('0x12'));var qs=require(_0x273a('0x13'));var as=require(_0x273a('0x14'));var hardwareService=require(_0x273a('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x273a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x273a('0x17'))['db'];var integrations=require(_0x273a('0x18'));function respondWithStatusCode(_0x2df9ba,_0x42fe2a){_0x42fe2a=_0x42fe2a||0xcc;return function(_0x1a10dc){if(_0x1a10dc){return _0x2df9ba['sendStatus'](_0x42fe2a);}return _0x2df9ba[_0x273a('0x19')](_0x42fe2a)[_0x273a('0x1a')]();};}function respondWithResult(_0x2f81f2,_0x267208){_0x267208=_0x267208||0xc8;return function(_0xeacd5e){if(_0xeacd5e){return _0x2f81f2[_0x273a('0x19')](_0x267208)[_0x273a('0x1b')](_0xeacd5e);}};}function respondWithFilteredResult(_0x51a4a8,_0x298c36){return function(_0x34ca16){if(_0x34ca16){var _0x185806=typeof _0x298c36[_0x273a('0x1c')]===_0x273a('0x1d')&&typeof _0x298c36['limit']===_0x273a('0x1d');var _0x3ee3c1=_0x34ca16[_0x273a('0x1e')];var _0x10faeb=_0x185806?0x0:_0x298c36[_0x273a('0x1c')];var _0x50e945=_0x185806?_0x34ca16['count']:_0x298c36[_0x273a('0x1c')]+_0x298c36[_0x273a('0x1f')];var _0x3ac2f2;if(_0x50e945>=_0x3ee3c1){_0x50e945=_0x3ee3c1;_0x3ac2f2=0xc8;}else{_0x3ac2f2=0xce;}_0x51a4a8[_0x273a('0x19')](_0x3ac2f2);return _0x51a4a8['set'](_0x273a('0x20'),_0x10faeb+'-'+_0x50e945+'/'+_0x3ee3c1)['json'](_0x34ca16);}return null;};}function patchUpdates(_0x304a64){return function(_0x54701b){try{jsonpatch[_0x273a('0x21')](_0x54701b,_0x304a64,!![]);}catch(_0x590bba){return BPromise[_0x273a('0x22')](_0x590bba);}return _0x54701b[_0x273a('0x23')]();};}function saveUpdates(_0x4c5e00,_0x45d06f){return function(_0x3770ec){if(_0x3770ec){return _0x3770ec['update'](_0x4c5e00)['then'](function(_0x222628){return _0x222628;});}return null;};}function removeEntity(_0x3217e9,_0x3ed61f){return function(_0x55f58f){if(_0x55f58f){return _0x55f58f[_0x273a('0x24')]()[_0x273a('0x25')](function(){_0x3217e9[_0x273a('0x19')](0xcc)[_0x273a('0x1a')]();});}};}function handleEntityNotFound(_0x4e0521,_0x59787f){return function(_0x52029a){if(!_0x52029a){_0x4e0521['sendStatus'](0x194);}return _0x52029a;};}function handleError(_0x50249a,_0x2ce6c2){_0x2ce6c2=_0x2ce6c2||0x1f4;return function(_0x16372c){logger[_0x273a('0x26')](_0x16372c[_0x273a('0x27')]);if(_0x16372c['name']){delete _0x16372c[_0x273a('0x28')];}_0x50249a['status'](_0x2ce6c2)[_0x273a('0x29')](_0x16372c);};}exports[_0x273a('0x2a')]=function(_0x37911f,_0x22acd3){var _0x5113cb={},_0x10defa={},_0x29c690={'count':0x0,'rows':[]};var _0x4f272d=_['map'](db[_0x273a('0x2b')][_0x273a('0x2c')],function(_0x3079c4){return{'name':_0x3079c4[_0x273a('0x2d')],'type':_0x3079c4['type'][_0x273a('0x2e')]};});_0x10defa['model']=_[_0x273a('0x2f')](_0x4f272d,_0x273a('0x28'));_0x10defa['query']=_['keys'](_0x37911f[_0x273a('0x30')]);_0x10defa[_0x273a('0x31')]=_[_0x273a('0x32')](_0x10defa[_0x273a('0x33')],_0x10defa[_0x273a('0x30')]);_0x5113cb[_0x273a('0x34')]=_[_0x273a('0x32')](_0x10defa[_0x273a('0x33')],qs[_0x273a('0x35')](_0x37911f[_0x273a('0x30')][_0x273a('0x35')]));_0x5113cb[_0x273a('0x34')]=_0x5113cb['attributes']['length']?_0x5113cb['attributes']:_0x10defa[_0x273a('0x33')];if(!_0x37911f[_0x273a('0x30')]['hasOwnProperty'](_0x273a('0x36'))){_0x5113cb[_0x273a('0x1f')]=qs[_0x273a('0x1f')](_0x37911f[_0x273a('0x30')][_0x273a('0x1f')]);_0x5113cb[_0x273a('0x1c')]=qs[_0x273a('0x1c')](_0x37911f['query'][_0x273a('0x1c')]);}_0x5113cb[_0x273a('0x37')]=qs['sort'](_0x37911f[_0x273a('0x30')][_0x273a('0x38')]);_0x5113cb['where']=qs[_0x273a('0x31')](_[_0x273a('0x39')](_0x37911f[_0x273a('0x30')],_0x10defa[_0x273a('0x31')]),_0x4f272d);if(_0x37911f[_0x273a('0x30')]['filter']){_0x5113cb['where']=_['merge'](_0x5113cb[_0x273a('0x3a')],{'$or':_['map'](_0x4f272d,function(_0x3f82cf){if(_0x3f82cf[_0x273a('0x3b')]!==_0x273a('0x3c')){var _0x1987b2={};_0x1987b2[_0x3f82cf[_0x273a('0x28')]]={'$like':'%'+_0x37911f[_0x273a('0x30')][_0x273a('0x3d')]+'%'};return _0x1987b2;}})});}_0x5113cb=_['merge']({},_0x5113cb,_0x37911f[_0x273a('0x3e')]);var _0x36b2ec={'where':_0x5113cb[_0x273a('0x3a')]};return db[_0x273a('0x2b')]['count'](_0x36b2ec)['then'](function(_0x464041){_0x29c690['count']=_0x464041;if(_0x37911f[_0x273a('0x30')][_0x273a('0x3f')]){_0x5113cb[_0x273a('0x40')]=[{'all':!![]}];}return db[_0x273a('0x2b')][_0x273a('0x41')](_0x5113cb);})[_0x273a('0x25')](function(_0x122621){_0x29c690['rows']=_0x122621;return _0x29c690;})[_0x273a('0x25')](respondWithFilteredResult(_0x22acd3,_0x5113cb))['catch'](handleError(_0x22acd3,null));};exports[_0x273a('0x42')]=function(_0x7e0357,_0x39f15f){var _0x843376={'raw':![],'where':{'id':_0x7e0357['params']['id']}},_0x171b25={};_0x171b25['model']=_[_0x273a('0x43')](db[_0x273a('0x2b')][_0x273a('0x2c')]);_0x171b25[_0x273a('0x30')]=_['keys'](_0x7e0357[_0x273a('0x30')]);_0x171b25[_0x273a('0x31')]=_[_0x273a('0x32')](_0x171b25[_0x273a('0x33')],_0x171b25[_0x273a('0x30')]);_0x843376['attributes']=_[_0x273a('0x32')](_0x171b25['model'],qs['fields'](_0x7e0357[_0x273a('0x30')][_0x273a('0x35')]));_0x843376['attributes']=_0x843376['attributes'][_0x273a('0x44')]?_0x843376[_0x273a('0x34')]:_0x171b25['model'];if(_0x7e0357[_0x273a('0x30')][_0x273a('0x3f')]){_0x843376[_0x273a('0x40')]=[{'all':!![]}];}_0x843376=_['merge']({},_0x843376,_0x7e0357['options']);return db[_0x273a('0x2b')]['find'](_0x843376)[_0x273a('0x25')](handleEntityNotFound(_0x39f15f,null))[_0x273a('0x25')](respondWithResult(_0x39f15f,null))[_0x273a('0x45')](handleError(_0x39f15f,null));};exports['create']=function(_0x23eb89,_0x37079c){return db[_0x273a('0x2b')]['create'](_0x23eb89[_0x273a('0x46')],{})[_0x273a('0x25')](respondWithResult(_0x37079c,0xc9))[_0x273a('0x45')](handleError(_0x37079c,null));};exports['update']=function(_0x7bd11b,_0x1f0f47){if(_0x7bd11b[_0x273a('0x46')]['id']){delete _0x7bd11b[_0x273a('0x46')]['id'];}return db[_0x273a('0x2b')][_0x273a('0x47')]({'where':{'id':_0x7bd11b[_0x273a('0x48')]['id']}})[_0x273a('0x25')](handleEntityNotFound(_0x1f0f47,null))[_0x273a('0x25')](saveUpdates(_0x7bd11b[_0x273a('0x46')],null))[_0x273a('0x25')](respondWithResult(_0x1f0f47,null))['catch'](handleError(_0x1f0f47,null));};exports[_0x273a('0x24')]=function(_0x47b4e7,_0x5f1354){return db[_0x273a('0x2b')][_0x273a('0x47')]({'where':{'id':_0x47b4e7[_0x273a('0x48')]['id']}})[_0x273a('0x25')](handleEntityNotFound(_0x5f1354,null))[_0x273a('0x25')](removeEntity(_0x5f1354,null))[_0x273a('0x45')](handleError(_0x5f1354,null));};exports['getConfigurations']=function(_0x2bd186,_0x31f287,_0x3a4366){var _0x182958={};var _0x493ece={};var _0x15f153;var _0x4dcc70;return db[_0x273a('0x2b')]['findOne']({'where':{'id':_0x2bd186['params']['id']}})[_0x273a('0x25')](handleEntityNotFound(_0x31f287,null))['then'](function(_0x22fee5){if(_0x22fee5){_0x15f153=_0x22fee5;_0x493ece[_0x273a('0x33')]=_[_0x273a('0x43')](db[_0x273a('0x49')][_0x273a('0x2c')]);_0x493ece[_0x273a('0x30')]=_[_0x273a('0x43')](_0x2bd186[_0x273a('0x30')]);_0x493ece['filters']=_[_0x273a('0x32')](_0x493ece[_0x273a('0x33')],_0x493ece[_0x273a('0x30')]);_0x182958[_0x273a('0x34')]=_[_0x273a('0x32')](_0x493ece[_0x273a('0x33')],qs[_0x273a('0x35')](_0x2bd186[_0x273a('0x30')][_0x273a('0x35')]));_0x182958[_0x273a('0x34')]=_0x182958[_0x273a('0x34')]['length']?_0x182958['attributes']:_0x493ece[_0x273a('0x33')];_0x182958[_0x273a('0x37')]=qs[_0x273a('0x38')](_0x2bd186[_0x273a('0x30')][_0x273a('0x38')]);_0x182958[_0x273a('0x3a')]=qs[_0x273a('0x31')](_[_0x273a('0x39')](_0x2bd186[_0x273a('0x30')],_0x493ece['filters']));if(_0x2bd186[_0x273a('0x30')][_0x273a('0x3d')]){_0x182958[_0x273a('0x3a')]=_['merge'](_0x182958[_0x273a('0x3a')],{'$or':_['map'](_0x182958[_0x273a('0x34')],function(_0x592070){var _0x512907={};_0x512907[_0x592070]={'$like':'%'+_0x2bd186[_0x273a('0x30')][_0x273a('0x3d')]+'%'};return _0x512907;})});}_0x182958=_['merge']({},_0x182958,_0x2bd186['options']);return _0x15f153['getConfigurations'](_0x182958);}})[_0x273a('0x25')](function(_0x6ee4ed){if(_0x6ee4ed){_0x4dcc70=_0x6ee4ed['length'];if(!_0x2bd186[_0x273a('0x30')][_0x273a('0x4a')]('nolimit')){_0x182958[_0x273a('0x1f')]=qs['limit'](_0x2bd186[_0x273a('0x30')][_0x273a('0x1f')]);_0x182958[_0x273a('0x1c')]=qs[_0x273a('0x1c')](_0x2bd186['query'][_0x273a('0x1c')]);}return _0x15f153[_0x273a('0x4b')](_0x182958);}})[_0x273a('0x25')](function(_0x20823d){if(_0x20823d){return _0x20823d?{'count':_0x4dcc70,'rows':_0x20823d}:null;}})[_0x273a('0x25')](respondWithResult(_0x31f287,null))[_0x273a('0x45')](handleError(_0x31f287,null));};exports[_0x273a('0x4c')]=function(_0x5b4b52,_0xd8ba3e,_0xdf1fa7){if(_0x5b4b52['body']['id']){delete _0x5b4b52[_0x273a('0x46')]['id'];}return db[_0x273a('0x2b')][_0x273a('0x4d')]({'where':{'id':_0x5b4b52['params']['id']}})[_0x273a('0x25')](handleEntityNotFound(_0xd8ba3e,null))['then'](function(_0x3207bd){if(_0x3207bd){_0x5b4b52[_0x273a('0x46')][_0x273a('0x4e')]=_0x3207bd['id'];_0x5b4b52['body'][_0x273a('0x4f')]=integrations[_0x273a('0x50')](_0x5b4b52['body']['channel'],_0x5b4b52['body'][_0x273a('0x3b')]);_0x5b4b52[_0x273a('0x46')][_0x273a('0x51')]=integrations[_0x273a('0x52')](_0x5b4b52['body'][_0x273a('0x53')],_0x5b4b52[_0x273a('0x46')][_0x273a('0x3b')]);return db[_0x273a('0x49')][_0x273a('0x54')](_0x5b4b52['body'],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0x273a('0x55')],'as':_0x273a('0x51')}]});}return null;})[_0x273a('0x25')](respondWithResult(_0xd8ba3e,null))['catch'](handleError(_0xd8ba3e,null));};exports[_0x273a('0x56')]=function(_0x191177,_0x45c1ee,_0x24545e){var _0x2c1ac6;var _0x3c2fea='';var _0x3f3fc3='Task';return db['SalesforceAccount'][_0x273a('0x4d')]({'where':{'id':_0x191177[_0x273a('0x48')]['id']},'attributes':['id',_0x273a('0x57'),_0x273a('0x58'),_0x273a('0x59'),_0x273a('0x5a'),'password',_0x273a('0x5b')]})['then'](handleEntityNotFound(_0x45c1ee,null))[_0x273a('0x25')](function(_0x3c2b89){if(_0x3c2b89){_0x3c2fea=_0x3c2b89['remoteUri'];var _0x21945d=_0x3c2fea[_0x273a('0x5c')](-0x1);if(_0x21945d==='/'){_0x3c2fea=_0x3c2fea[_0x273a('0x5d')](0x0,_0x3c2fea[_0x273a('0x5e')](_0x21945d));}_0x2c1ac6=new jsforce['Connection']({'oauth2':{'loginUrl':_0x3c2fea,'clientId':_0x3c2b89[_0x273a('0x58')],'clientSecret':_0x3c2b89['clientSecret']}});return _0x2c1ac6[_0x273a('0x5f')](_0x3c2b89[_0x273a('0x5a')],_0x3c2b89[_0x273a('0x60')][_0x273a('0x61')](_0x3c2b89[_0x273a('0x5b')]));}})['then'](function(_0x6e2630){if(_0x6e2630){if(!_[_0x273a('0x62')](_0x191177[_0x273a('0x30')]['ticketType'])){_0x3f3fc3=_0x191177['query']['ticketType'];}return _0x2c1ac6[_0x273a('0x63')](_0x3f3fc3)[_0x273a('0x64')]();}})[_0x273a('0x25')](function(_0x218e98){var _0x5321c4=['OwnerId',_0x273a('0x65'),'IsReminderSet',_0x273a('0x66'),_0x273a('0x67'),'Description'];var _0x23a713=['string',_0x273a('0x68'),_0x273a('0x69'),_0x273a('0x6a'),_0x273a('0x6b'),'textarea',_0x273a('0x6c')];if(_0x218e98){_[_0x273a('0x6d')](_0x218e98[_0x273a('0x35')],function(_0x25afbb){return _0x5321c4[_0x273a('0x6e')](_0x25afbb[_0x273a('0x28')])||!_0x23a713['includes'](_0x25afbb[_0x273a('0x3b')]);});return{'count':_0x218e98[_0x273a('0x35')][_0x273a('0x44')],'rows':_[_0x273a('0x2f')](_0x218e98[_0x273a('0x35')],function(_0xee7e67){return{'id':_0xee7e67[_0x273a('0x28')],'name':_0xee7e67['label'],'custom':_0xee7e67[_0x273a('0x6f')],'options':_0xee7e67[_0x273a('0x70')][_0x273a('0x44')]>0x0?_['map'](_0xee7e67[_0x273a('0x70')],function(_0x5ea7c1){return{'name':_0x5ea7c1['label'],'value':_0x5ea7c1[_0x273a('0x71')]};}):_0xee7e67[_0x273a('0x3b')]==_0x273a('0x6a')?[{'name':_0x273a('0x72'),'value':_0x273a('0x73')},{'name':_0x273a('0x74'),'value':_0x273a('0x75')}]:[]};})};}})[_0x273a('0x25')](respondWithResult(_0x45c1ee,null))[_0x273a('0x45')](function(_0x1eb67f){var _0x306f83=_0x191177[_0x273a('0x30')][_0x273a('0x76')]?0x1f4:_0x1eb67f[_0x273a('0x77')]||0x1f4;logger[_0x273a('0x26')](_0x273a('0x78'),_0x273a('0x56'),_0x306f83,JSON[_0x273a('0x79')](_0x1eb67f));delete _0x1eb67f[_0x273a('0x28')];if(_0x306f83===0x191){_0x306f83=0x190;}_0x45c1ee[_0x273a('0x19')](_0x306f83)['send'](_0x191177['query'][_0x273a('0x76')]?{'message':_0x273a('0x7a'),'statusCode':_0x1eb67f['statusCode']}:_0x1eb67f);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 5230e5d..0f42653 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 _0xc6e0=['../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','int_salesforce_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3f67e8,_0x929e0f){var _0x4a344e=function(_0x162ecb){while(--_0x162ecb){_0x3f67e8['push'](_0x3f67e8['shift']());}};_0x4a344e(++_0x929e0f);}(_0xc6e0,0x14a));var _0x0c6e=function(_0x2ce92d,_0x31aa5e){_0x2ce92d=_0x2ce92d-0x0;var _0x3feeaf=_0xc6e0[_0x2ce92d];return _0x3feeaf;};'use strict';var _=require('lodash');var util=require(_0x0c6e('0x0'));var logger=require(_0x0c6e('0x1'))(_0x0c6e('0x2'));var moment=require(_0x0c6e('0x3'));var BPromise=require(_0x0c6e('0x4'));var rp=require(_0x0c6e('0x5'));var fs=require('fs');var path=require(_0x0c6e('0x6'));var rimraf=require(_0x0c6e('0x7'));var config=require(_0x0c6e('0x8'));var attributes=require(_0x0c6e('0x9'));var integrations=require(_0x0c6e('0xa'));module['exports']=function(_0xbd6bbc,_0x17bb90){return _0xbd6bbc[_0x0c6e('0xb')]('SalesforceAccount',attributes,{'tableName':_0x0c6e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x667b=['moment','rimraf','../../config/environment','./intSalesforceAccount.attributes','exports','define','SalesforceAccount','int_salesforce_accounts','lodash'];(function(_0xe1677d,_0x286227){var _0x1efe72=function(_0x2a4ebd){while(--_0x2a4ebd){_0xe1677d['push'](_0xe1677d['shift']());}};_0x1efe72(++_0x286227);}(_0x667b,0x74));var _0xb667=function(_0x32b8a9,_0x59d62b){_0x32b8a9=_0x32b8a9-0x0;var _0x40105c=_0x667b[_0x32b8a9];return _0x40105c;};'use strict';var _=require(_0xb667('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb667('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb667('0x2'));var config=require(_0xb667('0x3'));var attributes=require(_0xb667('0x4'));var integrations=require('../../components/integrations/configuration');module[_0xb667('0x5')]=function(_0x1d7eb9,_0x4b1a24){return _0x1d7eb9[_0xb667('0x6')](_0xb667('0x7'),attributes,{'tableName':_0xb667('0x8'),'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 c9608ef..e98b002 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 _0xd997=['SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceAccount,\x20%s,\x20%s','message','result','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowSalesforceAccount','find','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0xd997,0x1a0));var _0x7d99=function(_0x1b4f18,_0x4ac8d1){_0x1b4f18=_0x1b4f18-0x0;var _0x31d9bf=_0xd997[_0x1b4f18];return _0x31d9bf;};'use strict';var _=require(_0x7d99('0x0'));var util=require(_0x7d99('0x1'));var moment=require(_0x7d99('0x2'));var BPromise=require(_0x7d99('0x3'));var rs=require(_0x7d99('0x4'));var fs=require('fs');var Redis=require(_0x7d99('0x5'));var db=require(_0x7d99('0x6'))['db'];var utils=require(_0x7d99('0x7'));var logger=require(_0x7d99('0x8'))(_0x7d99('0x9'));var config=require(_0x7d99('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x7d99('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b8f21,_0xdbe34,_0x3b3ddd){return new BPromise(function(_0x45f1fd,_0x29de1f){return client[_0x7d99('0xc')](_0x3b8f21,_0x3b3ddd)[_0x7d99('0xd')](function(_0x2adc23){logger[_0x7d99('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0xdbe34,_0x7d99('0xf'));logger['debug'](_0x7d99('0x10'),_0xdbe34,'request\x20sent',JSON[_0x7d99('0x11')](_0x2adc23));if(_0x2adc23['error']){if(_0x2adc23['error']['code']===0x1f4){logger[_0x7d99('0x12')](_0x7d99('0x13'),_0xdbe34,_0x2adc23[_0x7d99('0x12')][_0x7d99('0x14')]);return _0x29de1f(_0x2adc23[_0x7d99('0x12')][_0x7d99('0x14')]);}logger[_0x7d99('0x12')](_0x7d99('0x13'),_0xdbe34,_0x2adc23[_0x7d99('0x12')][_0x7d99('0x14')]);return _0x45f1fd(_0x2adc23[_0x7d99('0x12')][_0x7d99('0x14')]);}else{logger['info']('SalesforceAccount,\x20%s,\x20%s',_0xdbe34,'request\x20sent');_0x45f1fd(_0x2adc23[_0x7d99('0x15')][_0x7d99('0x14')]);}})['catch'](function(_0x165e2e){logger[_0x7d99('0x12')](_0x7d99('0x13'),_0xdbe34,_0x165e2e);_0x29de1f(_0x165e2e);});});}exports[_0x7d99('0x16')]=function(_0x5a23ad){var _0x50ea74=this;return new Promise(function(_0x109bb8,_0x6af345){return db[_0x7d99('0x17')][_0x7d99('0x18')]({'raw':_0x5a23ad[_0x7d99('0x19')]?_0x5a23ad[_0x7d99('0x19')][_0x7d99('0x1a')]===undefined?!![]:![]:!![],'where':_0x5a23ad[_0x7d99('0x19')]?_0x5a23ad[_0x7d99('0x19')][_0x7d99('0x1b')]||null:null,'attributes':_0x5a23ad['options']?_0x5a23ad[_0x7d99('0x19')][_0x7d99('0x1c')]||null:null,'limit':_0x5a23ad[_0x7d99('0x19')]?_0x5a23ad['options'][_0x7d99('0x1d')]||null:null,'include':_0x5a23ad[_0x7d99('0x19')]?_0x5a23ad[_0x7d99('0x19')][_0x7d99('0x1e')]?_['map'](_0x5a23ad[_0x7d99('0x19')]['include'],function(_0x42ffd9){return{'model':db[_0x42ffd9[_0x7d99('0x1f')]],'as':_0x42ffd9['as'],'attributes':_0x42ffd9['attributes'],'include':_0x42ffd9[_0x7d99('0x1e')]?_[_0x7d99('0x20')](_0x42ffd9[_0x7d99('0x1e')],function(_0x5050e3){return{'model':db[_0x5050e3[_0x7d99('0x1f')]],'as':_0x5050e3['as'],'attributes':_0x5050e3[_0x7d99('0x1c')],'include':_0x5050e3[_0x7d99('0x1e')]?_[_0x7d99('0x20')](_0x5050e3[_0x7d99('0x1e')],function(_0x4f46d4){return{'model':db[_0x4f46d4['model']],'as':_0x4f46d4['as'],'attributes':_0x4f46d4[_0x7d99('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7d99('0xd')](function(_0x2677c3){logger[_0x7d99('0xe')](_0x7d99('0x16'),_0x5a23ad);logger['debug'](_0x7d99('0x16'),_0x5a23ad,JSON[_0x7d99('0x11')](_0x2677c3));_0x109bb8(_0x2677c3);})['catch'](function(_0xfc046e){logger[_0x7d99('0x12')](_0x7d99('0x16'),_0xfc046e[_0x7d99('0x14')],_0x5a23ad);_0x6af345(_0x50ea74['error'](0x1f4,_0xfc046e['message']));});});};exports[_0x7d99('0x21')]=function(_0x57c7fd){var _0x463923=this;return new Promise(function(_0x2f6949,_0x3d5136){return db[_0x7d99('0x17')][_0x7d99('0x22')]({'raw':_0x57c7fd[_0x7d99('0x19')]?_0x57c7fd[_0x7d99('0x19')][_0x7d99('0x1a')]===undefined?!![]:![]:!![],'where':_0x57c7fd['options']?_0x57c7fd['options']['where']||null:null,'attributes':_0x57c7fd[_0x7d99('0x19')]?_0x57c7fd[_0x7d99('0x19')][_0x7d99('0x1c')]||null:null,'include':_0x57c7fd[_0x7d99('0x19')]?_0x57c7fd[_0x7d99('0x19')][_0x7d99('0x1e')]?_['map'](_0x57c7fd[_0x7d99('0x19')][_0x7d99('0x1e')],function(_0x49a701){return{'model':db[_0x49a701[_0x7d99('0x1f')]],'as':_0x49a701['as'],'attributes':_0x49a701[_0x7d99('0x1c')],'include':_0x49a701[_0x7d99('0x1e')]?_[_0x7d99('0x20')](_0x49a701['include'],function(_0x201bd0){return{'model':db[_0x201bd0['model']],'as':_0x201bd0['as'],'attributes':_0x201bd0[_0x7d99('0x1c')],'include':_0x201bd0['include']?_[_0x7d99('0x20')](_0x201bd0[_0x7d99('0x1e')],function(_0x5d01c6){return{'model':db[_0x5d01c6['model']],'as':_0x5d01c6['as'],'attributes':_0x5d01c6[_0x7d99('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7d99('0xd')](function(_0x4f3a0d){logger[_0x7d99('0xe')](_0x7d99('0x21'),_0x57c7fd);logger[_0x7d99('0x23')](_0x7d99('0x21'),_0x57c7fd,JSON['stringify'](_0x4f3a0d));_0x2f6949(_0x4f3a0d);})['catch'](function(_0x318351){logger[_0x7d99('0x12')](_0x7d99('0x21'),_0x318351[_0x7d99('0x14')],_0x57c7fd);_0x3d5136(_0x463923[_0x7d99('0x12')](0x1f4,_0x318351[_0x7d99('0x14')]));});});}; \ No newline at end of file +var _0x9d83=['stringify','error','message','result','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetSalesforceAccount','catch','find','ShowSalesforceAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s'];(function(_0xfc856b,_0x508686){var _0x42b973=function(_0xf8969){while(--_0xf8969){_0xfc856b['push'](_0xfc856b['shift']());}};_0x42b973(++_0x508686);}(_0x9d83,0x1f3));var _0x39d8=function(_0x18f137,_0x5e06b4){_0x18f137=_0x18f137-0x0;var _0x147221=_0x9d83[_0x18f137];return _0x147221;};'use strict';var _=require(_0x39d8('0x0'));var util=require(_0x39d8('0x1'));var moment=require(_0x39d8('0x2'));var BPromise=require(_0x39d8('0x3'));var rs=require(_0x39d8('0x4'));var fs=require('fs');var Redis=require(_0x39d8('0x5'));var db=require(_0x39d8('0x6'))['db'];var utils=require(_0x39d8('0x7'));var logger=require(_0x39d8('0x8'))('rpc');var config=require(_0x39d8('0x9'));var jayson=require(_0x39d8('0xa'));var client=jayson[_0x39d8('0xb')][_0x39d8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x365be4,_0x20b101,_0x2f8b90){return new BPromise(function(_0x56cb7d,_0x4997b2){return client[_0x39d8('0xd')](_0x365be4,_0x2f8b90)['then'](function(_0x36717c){logger[_0x39d8('0xe')](_0x39d8('0xf'),_0x20b101,_0x39d8('0x10'));logger[_0x39d8('0x11')](_0x39d8('0x12'),_0x20b101,_0x39d8('0x10'),JSON[_0x39d8('0x13')](_0x36717c));if(_0x36717c[_0x39d8('0x14')]){if(_0x36717c[_0x39d8('0x14')]['code']===0x1f4){logger[_0x39d8('0x14')]('SalesforceAccount,\x20%s,\x20%s',_0x20b101,_0x36717c[_0x39d8('0x14')]['message']);return _0x4997b2(_0x36717c[_0x39d8('0x14')]['message']);}logger[_0x39d8('0x14')](_0x39d8('0xf'),_0x20b101,_0x36717c[_0x39d8('0x14')][_0x39d8('0x15')]);return _0x56cb7d(_0x36717c[_0x39d8('0x14')][_0x39d8('0x15')]);}else{logger[_0x39d8('0xe')](_0x39d8('0xf'),_0x20b101,_0x39d8('0x10'));_0x56cb7d(_0x36717c[_0x39d8('0x16')]['message']);}})['catch'](function(_0x5ea468){logger[_0x39d8('0x14')]('SalesforceAccount,\x20%s,\x20%s',_0x20b101,_0x5ea468);_0x4997b2(_0x5ea468);});});}exports['GetSalesforceAccount']=function(_0x5ad97a){var _0x4fff0d=this;return new Promise(function(_0x592447,_0x286efc){return db[_0x39d8('0x17')][_0x39d8('0x18')]({'raw':_0x5ad97a[_0x39d8('0x19')]?_0x5ad97a[_0x39d8('0x19')][_0x39d8('0x1a')]===undefined?!![]:![]:!![],'where':_0x5ad97a[_0x39d8('0x19')]?_0x5ad97a['options'][_0x39d8('0x1b')]||null:null,'attributes':_0x5ad97a[_0x39d8('0x19')]?_0x5ad97a['options'][_0x39d8('0x1c')]||null:null,'limit':_0x5ad97a['options']?_0x5ad97a[_0x39d8('0x19')][_0x39d8('0x1d')]||null:null,'include':_0x5ad97a['options']?_0x5ad97a[_0x39d8('0x19')][_0x39d8('0x1e')]?_[_0x39d8('0x1f')](_0x5ad97a[_0x39d8('0x19')][_0x39d8('0x1e')],function(_0x8d863e){return{'model':db[_0x8d863e['model']],'as':_0x8d863e['as'],'attributes':_0x8d863e[_0x39d8('0x1c')],'include':_0x8d863e['include']?_[_0x39d8('0x1f')](_0x8d863e[_0x39d8('0x1e')],function(_0x55db09){return{'model':db[_0x55db09[_0x39d8('0x20')]],'as':_0x55db09['as'],'attributes':_0x55db09[_0x39d8('0x1c')],'include':_0x55db09[_0x39d8('0x1e')]?_['map'](_0x55db09[_0x39d8('0x1e')],function(_0x5b42de){return{'model':db[_0x5b42de[_0x39d8('0x20')]],'as':_0x5b42de['as'],'attributes':_0x5b42de[_0x39d8('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x16453d){logger[_0x39d8('0xe')](_0x39d8('0x21'),_0x5ad97a);logger[_0x39d8('0x11')](_0x39d8('0x21'),_0x5ad97a,JSON[_0x39d8('0x13')](_0x16453d));_0x592447(_0x16453d);})[_0x39d8('0x22')](function(_0xe08857){logger['error']('GetSalesforceAccount',_0xe08857[_0x39d8('0x15')],_0x5ad97a);_0x286efc(_0x4fff0d[_0x39d8('0x14')](0x1f4,_0xe08857['message']));});});};exports['ShowSalesforceAccount']=function(_0x3091b7){var _0x52feeb=this;return new Promise(function(_0xd4d43e,_0x38620d){return db['SalesforceAccount'][_0x39d8('0x23')]({'raw':_0x3091b7[_0x39d8('0x19')]?_0x3091b7[_0x39d8('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3091b7[_0x39d8('0x19')]?_0x3091b7['options']['where']||null:null,'attributes':_0x3091b7[_0x39d8('0x19')]?_0x3091b7[_0x39d8('0x19')]['attributes']||null:null,'include':_0x3091b7[_0x39d8('0x19')]?_0x3091b7[_0x39d8('0x19')][_0x39d8('0x1e')]?_[_0x39d8('0x1f')](_0x3091b7[_0x39d8('0x19')][_0x39d8('0x1e')],function(_0x470fcd){return{'model':db[_0x470fcd[_0x39d8('0x20')]],'as':_0x470fcd['as'],'attributes':_0x470fcd[_0x39d8('0x1c')],'include':_0x470fcd[_0x39d8('0x1e')]?_[_0x39d8('0x1f')](_0x470fcd[_0x39d8('0x1e')],function(_0x293870){return{'model':db[_0x293870[_0x39d8('0x20')]],'as':_0x293870['as'],'attributes':_0x293870[_0x39d8('0x1c')],'include':_0x293870['include']?_[_0x39d8('0x1f')](_0x293870[_0x39d8('0x1e')],function(_0x5c1e00){return{'model':db[_0x5c1e00[_0x39d8('0x20')]],'as':_0x5c1e00['as'],'attributes':_0x5c1e00[_0x39d8('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2203b2){logger[_0x39d8('0xe')](_0x39d8('0x24'),_0x3091b7);logger[_0x39d8('0x11')]('ShowSalesforceAccount',_0x3091b7,JSON[_0x39d8('0x13')](_0x2203b2));_0xd4d43e(_0x2203b2);})[_0x39d8('0x22')](function(_0x28d537){logger[_0x39d8('0x14')](_0x39d8('0x24'),_0x28d537['message'],_0x3091b7);_0x38620d(_0x52feeb['error'](0x1f4,_0x28d537['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 8d9a0e2..3e669c3 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 _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x241628,_0x240397){var _0x4ce14b=function(_0x5be9ac){while(--_0x5be9ac){_0x241628['push'](_0x241628['shift']());}};_0x4ce14b(++_0x240397);}(_0x5f2f,0x73));var _0xf5f2=function(_0xcd2b47,_0x298e3b){_0xcd2b47=_0xcd2b47-0x0;var _0x3a62dd=_0x5f2f[_0xcd2b47];return _0x3a62dd;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=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/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xdb28,0x106));var _0x8db2=function(_0x3e25ad,_0x2f625f){_0x3e25ad=_0x3e25ad-0x0;var _0x1eec87=_0xdb28[_0x3e25ad];return _0x1eec87;};'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 diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 4406223..ffe7e28 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 _0xba31=['contact_lead','contact','account_contact_lead','account','nothing','lead','STRING','exports','Task','Case','ENUM'];(function(_0x5da0d9,_0x49ee54){var _0x4b6d2f=function(_0x9832cf){while(--_0x9832cf){_0x5da0d9['push'](_0x5da0d9['shift']());}};_0x4b6d2f(++_0x49ee54);}(_0xba31,0x19e));var _0x1ba3=function(_0x307bf6,_0x55bdd5){_0x307bf6=_0x307bf6-0x0;var _0x2878fc=_0xba31[_0x307bf6];return _0x2878fc;};'use strict';var Sequelize=require('sequelize');module[_0x1ba3('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x1ba3('0x1'),_0x1ba3('0x2')),'defaultValue':_0x1ba3('0x1')},'moduleSearch':{'type':Sequelize[_0x1ba3('0x3')](_0x1ba3('0x4'),_0x1ba3('0x5'),'lead',_0x1ba3('0x6'),_0x1ba3('0x7')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x1ba3('0x3')](_0x1ba3('0x8'),_0x1ba3('0x5'),_0x1ba3('0x9'),_0x1ba3('0x7')),'defaultValue':_0x1ba3('0x9')},'leadId':{'type':Sequelize[_0x1ba3('0xa')]},'additionalSearchAccount':{'type':Sequelize[_0x1ba3('0xa')]},'additionalSearchContact':{'type':Sequelize[_0x1ba3('0xa')]},'additionalSearchLead':{'type':Sequelize[_0x1ba3('0xa')]}}; \ No newline at end of file +var _0x4a73=['Case','Task','contact','lead','account','nothing','sequelize','exports','STRING','ENUM'];(function(_0x28e65b,_0x118a3c){var _0xa399a=function(_0x7ef4d1){while(--_0x7ef4d1){_0x28e65b['push'](_0x28e65b['shift']());}};_0xa399a(++_0x118a3c);}(_0x4a73,0x1d2));var _0x34a7=function(_0x2ec1a1,_0x2e6e6e){_0x2ec1a1=_0x2ec1a1-0x0;var _0x3f1ccb=_0x4a73[_0x2ec1a1];return _0x3f1ccb;};'use strict';var Sequelize=require(_0x34a7('0x0'));module[_0x34a7('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x34a7('0x2')]},'ticketType':{'type':Sequelize[_0x34a7('0x3')]('Task',_0x34a7('0x4')),'defaultValue':_0x34a7('0x5')},'moduleSearch':{'type':Sequelize[_0x34a7('0x3')]('contact_lead',_0x34a7('0x6'),_0x34a7('0x7'),'account_contact_lead',_0x34a7('0x8')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x34a7('0x3')](_0x34a7('0x9'),'contact','lead',_0x34a7('0x8')),'defaultValue':_0x34a7('0x7')},'leadId':{'type':Sequelize[_0x34a7('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x34a7('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x34a7('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index ec6c88d..3634464 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 _0x74b0=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','filters','SalesforceConfiguration','create','body','catch','find','getFields','findOne','order','nolimit','getSubjects','SalesforceField','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x44f74d,_0x464810){var _0x2d1a15=function(_0x2416dc){while(--_0x2416dc){_0x44f74d['push'](_0x44f74d['shift']());}};_0x2d1a15(++_0x464810);}(_0x74b0,0x13b));var _0x074b=function(_0x6d0a22,_0x55d6c4){_0x6d0a22=_0x6d0a22-0x0;var _0x4c1e70=_0x74b0[_0x6d0a22];return _0x4c1e70;};'use strict';var emlformat=require(_0x074b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x074b('0x1'));var jsonpatch=require(_0x074b('0x2'));var rp=require(_0x074b('0x3'));var moment=require('moment');var BPromise=require(_0x074b('0x4'));var Mustache=require(_0x074b('0x5'));var util=require(_0x074b('0x6'));var path=require('path');var sox=require(_0x074b('0x7'));var csv=require(_0x074b('0x8'));var ejs=require(_0x074b('0x9'));var fs=require('fs');var fs_extra=require(_0x074b('0xa'));var _=require('lodash');var squel=require(_0x074b('0xb'));var crypto=require(_0x074b('0xc'));var jsforce=require(_0x074b('0xd'));var deskjs=require(_0x074b('0xe'));var toCsv=require(_0x074b('0x8'));var querystring=require(_0x074b('0xf'));var Papa=require(_0x074b('0x10'));var Redis=require('ioredis');var authService=require(_0x074b('0x11'));var qs=require(_0x074b('0x12'));var as=require(_0x074b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x074b('0x14'))(_0x074b('0x15'));var utils=require(_0x074b('0x16'));var config=require(_0x074b('0x17'));var licenseUtil=require(_0x074b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x540410,_0x529c89){_0x529c89=_0x529c89||0xcc;return function(_0x76de85){if(_0x76de85){return _0x540410[_0x074b('0x19')](_0x529c89);}return _0x540410['status'](_0x529c89)['end']();};}function respondWithResult(_0x3cfc76,_0x36e151){_0x36e151=_0x36e151||0xc8;return function(_0x41c8d2){if(_0x41c8d2){return _0x3cfc76[_0x074b('0x1a')](_0x36e151)[_0x074b('0x1b')](_0x41c8d2);}};}function respondWithFilteredResult(_0xd9693d,_0x46a417){return function(_0x10bd47){if(_0x10bd47){var _0x5bfea7=typeof _0x46a417[_0x074b('0x1c')]===_0x074b('0x1d')&&typeof _0x46a417['limit']===_0x074b('0x1d');var _0x48fcd6=_0x10bd47[_0x074b('0x1e')];var _0x338263=_0x5bfea7?0x0:_0x46a417[_0x074b('0x1c')];var _0xca014b=_0x5bfea7?_0x10bd47[_0x074b('0x1e')]:_0x46a417[_0x074b('0x1c')]+_0x46a417[_0x074b('0x1f')];var _0x25e8fb;if(_0xca014b>=_0x48fcd6){_0xca014b=_0x48fcd6;_0x25e8fb=0xc8;}else{_0x25e8fb=0xce;}_0xd9693d[_0x074b('0x1a')](_0x25e8fb);return _0xd9693d[_0x074b('0x20')](_0x074b('0x21'),_0x338263+'-'+_0xca014b+'/'+_0x48fcd6)[_0x074b('0x1b')](_0x10bd47);}return null;};}function patchUpdates(_0x1352dd){return function(_0x4abd89){try{jsonpatch[_0x074b('0x22')](_0x4abd89,_0x1352dd,!![]);}catch(_0x3dac05){return BPromise[_0x074b('0x23')](_0x3dac05);}return _0x4abd89[_0x074b('0x24')]();};}function saveUpdates(_0x506479,_0x2c7c52){return function(_0x48ea11){if(_0x48ea11){return _0x48ea11[_0x074b('0x25')](_0x506479)['then'](function(_0x5ec189){return _0x5ec189;});}return null;};}function removeEntity(_0x1cf99c,_0x5bfc4c){return function(_0x157170){if(_0x157170){return _0x157170[_0x074b('0x26')]()[_0x074b('0x27')](function(){_0x1cf99c[_0x074b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fe48c,_0x2e7a76){return function(_0x4c7a1b){if(!_0x4c7a1b){_0x1fe48c[_0x074b('0x19')](0x194);}return _0x4c7a1b;};}function handleError(_0x391d69,_0x3e2cde){_0x3e2cde=_0x3e2cde||0x1f4;return function(_0x3f99eb){logger[_0x074b('0x28')](_0x3f99eb[_0x074b('0x29')]);if(_0x3f99eb[_0x074b('0x2a')]){delete _0x3f99eb[_0x074b('0x2a')];}_0x391d69[_0x074b('0x1a')](_0x3e2cde)[_0x074b('0x2b')](_0x3f99eb);};}exports['index']=function(_0x5c4519,_0x598de7){var _0x3373b5={},_0x1bcd55={},_0x28dda5={'count':0x0,'rows':[]};var _0x54d351=_[_0x074b('0x2c')](db['SalesforceConfiguration']['rawAttributes'],function(_0x21b710){return{'name':_0x21b710[_0x074b('0x2d')],'type':_0x21b710[_0x074b('0x2e')][_0x074b('0x2f')]};});_0x1bcd55[_0x074b('0x30')]=_[_0x074b('0x2c')](_0x54d351,'name');_0x1bcd55[_0x074b('0x31')]=_['keys'](_0x5c4519[_0x074b('0x31')]);_0x1bcd55['filters']=_['intersection'](_0x1bcd55[_0x074b('0x30')],_0x1bcd55[_0x074b('0x31')]);_0x3373b5[_0x074b('0x32')]=_[_0x074b('0x33')](_0x1bcd55['model'],qs[_0x074b('0x34')](_0x5c4519[_0x074b('0x31')]['fields']));_0x3373b5[_0x074b('0x32')]=_0x3373b5[_0x074b('0x32')][_0x074b('0x35')]?_0x3373b5[_0x074b('0x32')]:_0x1bcd55[_0x074b('0x30')];if(!_0x5c4519[_0x074b('0x31')][_0x074b('0x36')]('nolimit')){_0x3373b5['limit']=qs['limit'](_0x5c4519[_0x074b('0x31')][_0x074b('0x1f')]);_0x3373b5[_0x074b('0x1c')]=qs[_0x074b('0x1c')](_0x5c4519[_0x074b('0x31')][_0x074b('0x1c')]);}_0x3373b5['order']=qs[_0x074b('0x37')](_0x5c4519[_0x074b('0x31')][_0x074b('0x37')]);_0x3373b5[_0x074b('0x38')]=qs['filters'](_[_0x074b('0x39')](_0x5c4519[_0x074b('0x31')],_0x1bcd55['filters']),_0x54d351);if(_0x5c4519[_0x074b('0x31')]['filter']){_0x3373b5[_0x074b('0x38')]=_['merge'](_0x3373b5[_0x074b('0x38')],{'$or':_[_0x074b('0x2c')](_0x54d351,function(_0x284c5a){if(_0x284c5a[_0x074b('0x2e')]!==_0x074b('0x3a')){var _0x39f060={};_0x39f060[_0x284c5a[_0x074b('0x2a')]]={'$like':'%'+_0x5c4519[_0x074b('0x31')][_0x074b('0x3b')]+'%'};return _0x39f060;}})});}_0x3373b5=_[_0x074b('0x3c')]({},_0x3373b5,_0x5c4519[_0x074b('0x3d')]);var _0x520a89={'where':_0x3373b5[_0x074b('0x38')]};return db['SalesforceConfiguration'][_0x074b('0x1e')](_0x520a89)[_0x074b('0x27')](function(_0x5e4eaa){_0x28dda5[_0x074b('0x1e')]=_0x5e4eaa;if(_0x5c4519['query'][_0x074b('0x3e')]){_0x3373b5[_0x074b('0x3f')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x074b('0x40')](_0x3373b5);})[_0x074b('0x27')](function(_0x3da06c){_0x28dda5[_0x074b('0x41')]=_0x3da06c;return _0x28dda5;})[_0x074b('0x27')](respondWithFilteredResult(_0x598de7,_0x3373b5))['catch'](handleError(_0x598de7,null));};exports[_0x074b('0x42')]=function(_0x358cc5,_0x4365d9){var _0x5985f8={'raw':![],'where':{'id':_0x358cc5[_0x074b('0x43')]['id']}},_0x3261d8={};_0x3261d8['model']=_[_0x074b('0x44')](db['SalesforceConfiguration'][_0x074b('0x45')]);_0x3261d8[_0x074b('0x31')]=_[_0x074b('0x44')](_0x358cc5[_0x074b('0x31')]);_0x3261d8[_0x074b('0x46')]=_['intersection'](_0x3261d8[_0x074b('0x30')],_0x3261d8[_0x074b('0x31')]);_0x5985f8[_0x074b('0x32')]=_['intersection'](_0x3261d8[_0x074b('0x30')],qs['fields'](_0x358cc5[_0x074b('0x31')]['fields']));_0x5985f8[_0x074b('0x32')]=_0x5985f8['attributes'][_0x074b('0x35')]?_0x5985f8[_0x074b('0x32')]:_0x3261d8[_0x074b('0x30')];if(_0x358cc5['query'][_0x074b('0x3e')]){_0x5985f8[_0x074b('0x3f')]=[{'all':!![]}];}_0x5985f8=_[_0x074b('0x3c')]({},_0x5985f8,_0x358cc5[_0x074b('0x3d')]);return db[_0x074b('0x47')]['find'](_0x5985f8)['then'](handleEntityNotFound(_0x4365d9,null))['then'](respondWithResult(_0x4365d9,null))['catch'](handleError(_0x4365d9,null));};exports['create']=function(_0x50441c,_0x534020){return db[_0x074b('0x47')][_0x074b('0x48')](_0x50441c[_0x074b('0x49')],{})[_0x074b('0x27')](respondWithResult(_0x534020,0xc9))[_0x074b('0x4a')](handleError(_0x534020,null));};exports['update']=function(_0x770a25,_0x491e89){if(_0x770a25[_0x074b('0x49')]['id']){delete _0x770a25[_0x074b('0x49')]['id'];}return db['SalesforceConfiguration'][_0x074b('0x4b')]({'where':{'id':_0x770a25[_0x074b('0x43')]['id']}})[_0x074b('0x27')](handleEntityNotFound(_0x491e89,null))[_0x074b('0x27')](saveUpdates(_0x770a25[_0x074b('0x49')],null))[_0x074b('0x27')](respondWithResult(_0x491e89,null))[_0x074b('0x4a')](handleError(_0x491e89,null));};exports[_0x074b('0x26')]=function(_0x59bf93,_0x136cc1){return db[_0x074b('0x47')][_0x074b('0x4b')]({'where':{'id':_0x59bf93[_0x074b('0x43')]['id']}})[_0x074b('0x27')](handleEntityNotFound(_0x136cc1,null))[_0x074b('0x27')](removeEntity(_0x136cc1,null))['catch'](handleError(_0x136cc1,null));};exports[_0x074b('0x4c')]=function(_0xcbf2a5,_0x45173c,_0x451486){var _0x575b5b={};var _0x570b9f={};var _0x4709bb;var _0xad2830;return db[_0x074b('0x47')][_0x074b('0x4d')]({'where':{'id':_0xcbf2a5[_0x074b('0x43')]['id']}})[_0x074b('0x27')](handleEntityNotFound(_0x45173c,null))[_0x074b('0x27')](function(_0x5eea5e){if(_0x5eea5e){_0x4709bb=_0x5eea5e;_0x570b9f['model']=_['keys'](db['SalesforceField'][_0x074b('0x45')]);_0x570b9f[_0x074b('0x31')]=_[_0x074b('0x44')](_0xcbf2a5[_0x074b('0x31')]);_0x570b9f[_0x074b('0x46')]=_[_0x074b('0x33')](_0x570b9f['model'],_0x570b9f[_0x074b('0x31')]);_0x575b5b[_0x074b('0x32')]=_['intersection'](_0x570b9f[_0x074b('0x30')],qs['fields'](_0xcbf2a5[_0x074b('0x31')][_0x074b('0x34')]));_0x575b5b[_0x074b('0x32')]=_0x575b5b[_0x074b('0x32')]['length']?_0x575b5b[_0x074b('0x32')]:_0x570b9f[_0x074b('0x30')];_0x575b5b[_0x074b('0x4e')]=qs[_0x074b('0x37')](_0xcbf2a5[_0x074b('0x31')][_0x074b('0x37')]);_0x575b5b[_0x074b('0x38')]=qs[_0x074b('0x46')](_[_0x074b('0x39')](_0xcbf2a5[_0x074b('0x31')],_0x570b9f[_0x074b('0x46')]));if(_0xcbf2a5['query'][_0x074b('0x3b')]){_0x575b5b[_0x074b('0x38')]=_[_0x074b('0x3c')](_0x575b5b[_0x074b('0x38')],{'$or':_[_0x074b('0x2c')](_0x575b5b['attributes'],function(_0x38cc72){var _0x3d0529={};_0x3d0529[_0x38cc72]={'$like':'%'+_0xcbf2a5[_0x074b('0x31')][_0x074b('0x3b')]+'%'};return _0x3d0529;})});}_0x575b5b=_['merge']({},_0x575b5b,_0xcbf2a5[_0x074b('0x3d')]);return _0x4709bb[_0x074b('0x4c')](_0x575b5b);}})['then'](function(_0x1d0d4d){if(_0x1d0d4d){_0xad2830=_0x1d0d4d[_0x074b('0x35')];if(!_0xcbf2a5[_0x074b('0x31')][_0x074b('0x36')](_0x074b('0x4f'))){_0x575b5b['limit']=qs[_0x074b('0x1f')](_0xcbf2a5[_0x074b('0x31')][_0x074b('0x1f')]);_0x575b5b[_0x074b('0x1c')]=qs['offset'](_0xcbf2a5['query']['offset']);}return _0x4709bb[_0x074b('0x4c')](_0x575b5b);}})['then'](function(_0x2450b3){if(_0x2450b3){return _0x2450b3?{'count':_0xad2830,'rows':_0x2450b3}:null;}})['then'](respondWithResult(_0x45173c,null))['catch'](handleError(_0x45173c,null));};exports[_0x074b('0x50')]=function(_0x3c5f13,_0x3176d7,_0x89a10f){var _0x45075e={};var _0x17979e={};var _0x153079;var _0x302f66;return db[_0x074b('0x47')]['findOne']({'where':{'id':_0x3c5f13['params']['id']}})['then'](handleEntityNotFound(_0x3176d7,null))[_0x074b('0x27')](function(_0x43a7da){if(_0x43a7da){_0x153079=_0x43a7da;_0x17979e[_0x074b('0x30')]=_[_0x074b('0x44')](db[_0x074b('0x51')][_0x074b('0x45')]);_0x17979e['query']=_[_0x074b('0x44')](_0x3c5f13[_0x074b('0x31')]);_0x17979e[_0x074b('0x46')]=_[_0x074b('0x33')](_0x17979e[_0x074b('0x30')],_0x17979e[_0x074b('0x31')]);_0x45075e[_0x074b('0x32')]=_[_0x074b('0x33')](_0x17979e['model'],qs[_0x074b('0x34')](_0x3c5f13[_0x074b('0x31')]['fields']));_0x45075e[_0x074b('0x32')]=_0x45075e['attributes'][_0x074b('0x35')]?_0x45075e[_0x074b('0x32')]:_0x17979e['model'];_0x45075e[_0x074b('0x4e')]=qs[_0x074b('0x37')](_0x3c5f13['query'][_0x074b('0x37')]);_0x45075e[_0x074b('0x38')]=qs[_0x074b('0x46')](_[_0x074b('0x39')](_0x3c5f13[_0x074b('0x31')],_0x17979e['filters']));if(_0x3c5f13[_0x074b('0x31')][_0x074b('0x3b')]){_0x45075e['where']=_[_0x074b('0x3c')](_0x45075e['where'],{'$or':_[_0x074b('0x2c')](_0x45075e[_0x074b('0x32')],function(_0x3dedf0){var _0x558935={};_0x558935[_0x3dedf0]={'$like':'%'+_0x3c5f13[_0x074b('0x31')][_0x074b('0x3b')]+'%'};return _0x558935;})});}_0x45075e=_[_0x074b('0x3c')]({},_0x45075e,_0x3c5f13['options']);return _0x153079['getSubjects'](_0x45075e);}})[_0x074b('0x27')](function(_0x293e4a){if(_0x293e4a){_0x302f66=_0x293e4a[_0x074b('0x35')];if(!_0x3c5f13[_0x074b('0x31')][_0x074b('0x36')](_0x074b('0x4f'))){_0x45075e[_0x074b('0x1f')]=qs['limit'](_0x3c5f13[_0x074b('0x31')]['limit']);_0x45075e[_0x074b('0x1c')]=qs[_0x074b('0x1c')](_0x3c5f13[_0x074b('0x31')][_0x074b('0x1c')]);}return _0x153079[_0x074b('0x50')](_0x45075e);}})[_0x074b('0x27')](function(_0x70d3da){if(_0x70d3da){return _0x70d3da?{'count':_0x302f66,'rows':_0x70d3da}:null;}})[_0x074b('0x27')](respondWithResult(_0x3176d7,null))['catch'](handleError(_0x3176d7,null));};exports['getDescriptions']=function(_0x4bcf6f,_0x1bc324,_0x22e298){var _0x4c13f1={};var _0x25d2ac={};var _0x2f54f5;var _0x51e144;return db['SalesforceConfiguration'][_0x074b('0x4d')]({'where':{'id':_0x4bcf6f[_0x074b('0x43')]['id']}})[_0x074b('0x27')](handleEntityNotFound(_0x1bc324,null))[_0x074b('0x27')](function(_0x518ab6){if(_0x518ab6){_0x2f54f5=_0x518ab6;_0x25d2ac[_0x074b('0x30')]=_[_0x074b('0x44')](db[_0x074b('0x51')]['rawAttributes']);_0x25d2ac[_0x074b('0x31')]=_[_0x074b('0x44')](_0x4bcf6f[_0x074b('0x31')]);_0x25d2ac[_0x074b('0x46')]=_[_0x074b('0x33')](_0x25d2ac['model'],_0x25d2ac[_0x074b('0x31')]);_0x4c13f1[_0x074b('0x32')]=_[_0x074b('0x33')](_0x25d2ac[_0x074b('0x30')],qs[_0x074b('0x34')](_0x4bcf6f[_0x074b('0x31')][_0x074b('0x34')]));_0x4c13f1[_0x074b('0x32')]=_0x4c13f1[_0x074b('0x32')]['length']?_0x4c13f1['attributes']:_0x25d2ac[_0x074b('0x30')];_0x4c13f1[_0x074b('0x4e')]=qs[_0x074b('0x37')](_0x4bcf6f[_0x074b('0x31')][_0x074b('0x37')]);_0x4c13f1[_0x074b('0x38')]=qs[_0x074b('0x46')](_['pick'](_0x4bcf6f['query'],_0x25d2ac['filters']));if(_0x4bcf6f['query']['filter']){_0x4c13f1[_0x074b('0x38')]=_['merge'](_0x4c13f1[_0x074b('0x38')],{'$or':_['map'](_0x4c13f1[_0x074b('0x32')],function(_0x4793d4){var _0x1f8032={};_0x1f8032[_0x4793d4]={'$like':'%'+_0x4bcf6f[_0x074b('0x31')][_0x074b('0x3b')]+'%'};return _0x1f8032;})});}_0x4c13f1=_['merge']({},_0x4c13f1,_0x4bcf6f[_0x074b('0x3d')]);return _0x2f54f5[_0x074b('0x52')](_0x4c13f1);}})['then'](function(_0x49b345){if(_0x49b345){_0x51e144=_0x49b345['length'];if(!_0x4bcf6f[_0x074b('0x31')][_0x074b('0x36')](_0x074b('0x4f'))){_0x4c13f1[_0x074b('0x1f')]=qs[_0x074b('0x1f')](_0x4bcf6f[_0x074b('0x31')][_0x074b('0x1f')]);_0x4c13f1['offset']=qs['offset'](_0x4bcf6f[_0x074b('0x31')][_0x074b('0x1c')]);}return _0x2f54f5[_0x074b('0x52')](_0x4c13f1);}})['then'](function(_0x31b777){if(_0x31b777){return _0x31b777?{'count':_0x51e144,'rows':_0x31b777}:null;}})[_0x074b('0x27')](respondWithResult(_0x1bc324,null))[_0x074b('0x4a')](handleError(_0x1bc324,null));}; \ No newline at end of file +var _0xd67a=['order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','length','find','create','body','params','getFields','SalesforceField','pick','options','hasOwnProperty','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','nolimit'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0xd67a,0x160));var _0xad67=function(_0x2a7022,_0x1c7d4b){_0x2a7022=_0x2a7022-0x0;var _0x8c8483=_0xd67a[_0x2a7022];return _0x8c8483;};'use strict';var emlformat=require(_0xad67('0x0'));var rimraf=require(_0xad67('0x1'));var zipdir=require(_0xad67('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xad67('0x3'));var moment=require('moment');var BPromise=require(_0xad67('0x4'));var Mustache=require(_0xad67('0x5'));var util=require(_0xad67('0x6'));var path=require(_0xad67('0x7'));var sox=require('sox');var csv=require(_0xad67('0x8'));var ejs=require(_0xad67('0x9'));var fs=require('fs');var fs_extra=require(_0xad67('0xa'));var _=require(_0xad67('0xb'));var squel=require(_0xad67('0xc'));var crypto=require(_0xad67('0xd'));var jsforce=require(_0xad67('0xe'));var deskjs=require(_0xad67('0xf'));var toCsv=require(_0xad67('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xad67('0x10'));var authService=require(_0xad67('0x11'));var qs=require(_0xad67('0x12'));var as=require(_0xad67('0x13'));var hardwareService=require(_0xad67('0x14'));var logger=require(_0xad67('0x15'))(_0xad67('0x16'));var utils=require('../../config/utils');var config=require(_0xad67('0x17'));var licenseUtil=require(_0xad67('0x18'));var db=require(_0xad67('0x19'))['db'];function respondWithStatusCode(_0x22a6ef,_0x4f76b0){_0x4f76b0=_0x4f76b0||0xcc;return function(_0x4488ac){if(_0x4488ac){return _0x22a6ef[_0xad67('0x1a')](_0x4f76b0);}return _0x22a6ef[_0xad67('0x1b')](_0x4f76b0)[_0xad67('0x1c')]();};}function respondWithResult(_0x30a94b,_0x56d306){_0x56d306=_0x56d306||0xc8;return function(_0x1289e9){if(_0x1289e9){return _0x30a94b['status'](_0x56d306)[_0xad67('0x1d')](_0x1289e9);}};}function respondWithFilteredResult(_0x5e27cf,_0x15024a){return function(_0x374053){if(_0x374053){var _0x35e592=typeof _0x15024a[_0xad67('0x1e')]===_0xad67('0x1f')&&typeof _0x15024a[_0xad67('0x20')]===_0xad67('0x1f');var _0x569eb9=_0x374053[_0xad67('0x21')];var _0x4ffc09=_0x35e592?0x0:_0x15024a[_0xad67('0x1e')];var _0x4bb55f=_0x35e592?_0x374053['count']:_0x15024a[_0xad67('0x1e')]+_0x15024a[_0xad67('0x20')];var _0x38e7ab;if(_0x4bb55f>=_0x569eb9){_0x4bb55f=_0x569eb9;_0x38e7ab=0xc8;}else{_0x38e7ab=0xce;}_0x5e27cf['status'](_0x38e7ab);return _0x5e27cf[_0xad67('0x22')](_0xad67('0x23'),_0x4ffc09+'-'+_0x4bb55f+'/'+_0x569eb9)['json'](_0x374053);}return null;};}function patchUpdates(_0x5cc937){return function(_0xd205e7){try{jsonpatch[_0xad67('0x24')](_0xd205e7,_0x5cc937,!![]);}catch(_0x5b5f07){return BPromise[_0xad67('0x25')](_0x5b5f07);}return _0xd205e7[_0xad67('0x26')]();};}function saveUpdates(_0x459f84,_0x2212be){return function(_0x326c81){if(_0x326c81){return _0x326c81['update'](_0x459f84)[_0xad67('0x27')](function(_0x1b9b20){return _0x1b9b20;});}return null;};}function removeEntity(_0x4d3fc5,_0x190f59){return function(_0x5e37d4){if(_0x5e37d4){return _0x5e37d4['destroy']()['then'](function(){_0x4d3fc5[_0xad67('0x1b')](0xcc)[_0xad67('0x1c')]();});}};}function handleEntityNotFound(_0x5e4b92,_0x54b441){return function(_0x2195ad){if(!_0x2195ad){_0x5e4b92[_0xad67('0x1a')](0x194);}return _0x2195ad;};}function handleError(_0x181130,_0x441db5){_0x441db5=_0x441db5||0x1f4;return function(_0x5ee425){logger[_0xad67('0x28')](_0x5ee425[_0xad67('0x29')]);if(_0x5ee425[_0xad67('0x2a')]){delete _0x5ee425[_0xad67('0x2a')];}_0x181130[_0xad67('0x1b')](_0x441db5)[_0xad67('0x2b')](_0x5ee425);};}exports['index']=function(_0x426279,_0x3aeab4){var _0x3355e6={},_0x9baf27={},_0x5cd5e8={'count':0x0,'rows':[]};var _0xc182dd=_[_0xad67('0x2c')](db[_0xad67('0x2d')][_0xad67('0x2e')],function(_0x5646d6){return{'name':_0x5646d6[_0xad67('0x2f')],'type':_0x5646d6[_0xad67('0x30')][_0xad67('0x31')]};});_0x9baf27['model']=_[_0xad67('0x2c')](_0xc182dd,'name');_0x9baf27[_0xad67('0x32')]=_[_0xad67('0x33')](_0x426279[_0xad67('0x32')]);_0x9baf27[_0xad67('0x34')]=_[_0xad67('0x35')](_0x9baf27['model'],_0x9baf27['query']);_0x3355e6['attributes']=_[_0xad67('0x35')](_0x9baf27[_0xad67('0x36')],qs[_0xad67('0x37')](_0x426279[_0xad67('0x32')]['fields']));_0x3355e6[_0xad67('0x38')]=_0x3355e6['attributes']['length']?_0x3355e6['attributes']:_0x9baf27[_0xad67('0x36')];if(!_0x426279[_0xad67('0x32')]['hasOwnProperty'](_0xad67('0x39'))){_0x3355e6['limit']=qs[_0xad67('0x20')](_0x426279[_0xad67('0x32')]['limit']);_0x3355e6[_0xad67('0x1e')]=qs[_0xad67('0x1e')](_0x426279['query'][_0xad67('0x1e')]);}_0x3355e6[_0xad67('0x3a')]=qs['sort'](_0x426279[_0xad67('0x32')][_0xad67('0x3b')]);_0x3355e6[_0xad67('0x3c')]=qs['filters'](_['pick'](_0x426279[_0xad67('0x32')],_0x9baf27[_0xad67('0x34')]),_0xc182dd);if(_0x426279[_0xad67('0x32')][_0xad67('0x3d')]){_0x3355e6[_0xad67('0x3c')]=_[_0xad67('0x3e')](_0x3355e6['where'],{'$or':_[_0xad67('0x2c')](_0xc182dd,function(_0x37fc16){if(_0x37fc16[_0xad67('0x30')]!==_0xad67('0x3f')){var _0x4d359a={};_0x4d359a[_0x37fc16[_0xad67('0x2a')]]={'$like':'%'+_0x426279[_0xad67('0x32')][_0xad67('0x3d')]+'%'};return _0x4d359a;}})});}_0x3355e6=_[_0xad67('0x3e')]({},_0x3355e6,_0x426279['options']);var _0x191a8d={'where':_0x3355e6['where']};return db[_0xad67('0x2d')]['count'](_0x191a8d)['then'](function(_0x481cea){_0x5cd5e8[_0xad67('0x21')]=_0x481cea;if(_0x426279[_0xad67('0x32')][_0xad67('0x40')]){_0x3355e6[_0xad67('0x41')]=[{'all':!![]}];}return db[_0xad67('0x2d')][_0xad67('0x42')](_0x3355e6);})['then'](function(_0x1622d4){_0x5cd5e8[_0xad67('0x43')]=_0x1622d4;return _0x5cd5e8;})[_0xad67('0x27')](respondWithFilteredResult(_0x3aeab4,_0x3355e6))[_0xad67('0x44')](handleError(_0x3aeab4,null));};exports['show']=function(_0x52e33a,_0x2438ab){var _0x2413a1={'raw':![],'where':{'id':_0x52e33a['params']['id']}},_0x12b60c={};_0x12b60c[_0xad67('0x36')]=_['keys'](db[_0xad67('0x2d')][_0xad67('0x2e')]);_0x12b60c[_0xad67('0x32')]=_[_0xad67('0x33')](_0x52e33a[_0xad67('0x32')]);_0x12b60c['filters']=_[_0xad67('0x35')](_0x12b60c['model'],_0x12b60c[_0xad67('0x32')]);_0x2413a1[_0xad67('0x38')]=_['intersection'](_0x12b60c[_0xad67('0x36')],qs[_0xad67('0x37')](_0x52e33a[_0xad67('0x32')][_0xad67('0x37')]));_0x2413a1[_0xad67('0x38')]=_0x2413a1[_0xad67('0x38')][_0xad67('0x45')]?_0x2413a1[_0xad67('0x38')]:_0x12b60c['model'];if(_0x52e33a['query'][_0xad67('0x40')]){_0x2413a1[_0xad67('0x41')]=[{'all':!![]}];}_0x2413a1=_[_0xad67('0x3e')]({},_0x2413a1,_0x52e33a['options']);return db[_0xad67('0x2d')][_0xad67('0x46')](_0x2413a1)['then'](handleEntityNotFound(_0x2438ab,null))[_0xad67('0x27')](respondWithResult(_0x2438ab,null))[_0xad67('0x44')](handleError(_0x2438ab,null));};exports[_0xad67('0x47')]=function(_0x5d97cb,_0x45a6b5){return db[_0xad67('0x2d')]['create'](_0x5d97cb[_0xad67('0x48')],{})[_0xad67('0x27')](respondWithResult(_0x45a6b5,0xc9))['catch'](handleError(_0x45a6b5,null));};exports['update']=function(_0x4262aa,_0x2ea04e){if(_0x4262aa[_0xad67('0x48')]['id']){delete _0x4262aa[_0xad67('0x48')]['id'];}return db[_0xad67('0x2d')][_0xad67('0x46')]({'where':{'id':_0x4262aa[_0xad67('0x49')]['id']}})[_0xad67('0x27')](handleEntityNotFound(_0x2ea04e,null))[_0xad67('0x27')](saveUpdates(_0x4262aa[_0xad67('0x48')],null))['then'](respondWithResult(_0x2ea04e,null))[_0xad67('0x44')](handleError(_0x2ea04e,null));};exports['destroy']=function(_0x361de6,_0xf4c8e9){return db[_0xad67('0x2d')][_0xad67('0x46')]({'where':{'id':_0x361de6[_0xad67('0x49')]['id']}})[_0xad67('0x27')](handleEntityNotFound(_0xf4c8e9,null))[_0xad67('0x27')](removeEntity(_0xf4c8e9,null))[_0xad67('0x44')](handleError(_0xf4c8e9,null));};exports[_0xad67('0x4a')]=function(_0x431d60,_0x1c688f,_0x2e5300){var _0x4ff62c={};var _0x207e6e={};var _0xc20f3b;var _0x54d6e5;return db[_0xad67('0x2d')]['findOne']({'where':{'id':_0x431d60[_0xad67('0x49')]['id']}})[_0xad67('0x27')](handleEntityNotFound(_0x1c688f,null))[_0xad67('0x27')](function(_0x35ec25){if(_0x35ec25){_0xc20f3b=_0x35ec25;_0x207e6e['model']=_[_0xad67('0x33')](db[_0xad67('0x4b')][_0xad67('0x2e')]);_0x207e6e['query']=_[_0xad67('0x33')](_0x431d60[_0xad67('0x32')]);_0x207e6e['filters']=_[_0xad67('0x35')](_0x207e6e[_0xad67('0x36')],_0x207e6e[_0xad67('0x32')]);_0x4ff62c[_0xad67('0x38')]=_[_0xad67('0x35')](_0x207e6e['model'],qs[_0xad67('0x37')](_0x431d60[_0xad67('0x32')]['fields']));_0x4ff62c[_0xad67('0x38')]=_0x4ff62c[_0xad67('0x38')]['length']?_0x4ff62c['attributes']:_0x207e6e[_0xad67('0x36')];_0x4ff62c['order']=qs[_0xad67('0x3b')](_0x431d60['query']['sort']);_0x4ff62c[_0xad67('0x3c')]=qs[_0xad67('0x34')](_[_0xad67('0x4c')](_0x431d60[_0xad67('0x32')],_0x207e6e[_0xad67('0x34')]));if(_0x431d60[_0xad67('0x32')][_0xad67('0x3d')]){_0x4ff62c[_0xad67('0x3c')]=_[_0xad67('0x3e')](_0x4ff62c[_0xad67('0x3c')],{'$or':_['map'](_0x4ff62c['attributes'],function(_0x362812){var _0x9bd64d={};_0x9bd64d[_0x362812]={'$like':'%'+_0x431d60[_0xad67('0x32')][_0xad67('0x3d')]+'%'};return _0x9bd64d;})});}_0x4ff62c=_[_0xad67('0x3e')]({},_0x4ff62c,_0x431d60[_0xad67('0x4d')]);return _0xc20f3b[_0xad67('0x4a')](_0x4ff62c);}})[_0xad67('0x27')](function(_0x53e03a){if(_0x53e03a){_0x54d6e5=_0x53e03a['length'];if(!_0x431d60[_0xad67('0x32')][_0xad67('0x4e')](_0xad67('0x39'))){_0x4ff62c[_0xad67('0x20')]=qs[_0xad67('0x20')](_0x431d60['query'][_0xad67('0x20')]);_0x4ff62c[_0xad67('0x1e')]=qs[_0xad67('0x1e')](_0x431d60[_0xad67('0x32')]['offset']);}return _0xc20f3b['getFields'](_0x4ff62c);}})[_0xad67('0x27')](function(_0x121de0){if(_0x121de0){return _0x121de0?{'count':_0x54d6e5,'rows':_0x121de0}:null;}})[_0xad67('0x27')](respondWithResult(_0x1c688f,null))[_0xad67('0x44')](handleError(_0x1c688f,null));};exports[_0xad67('0x4f')]=function(_0x4d4c30,_0x2c280b,_0xdec7ae){var _0x2ce183={};var _0x423a7e={};var _0x4efe73;var _0x1cc92d;return db[_0xad67('0x2d')][_0xad67('0x50')]({'where':{'id':_0x4d4c30[_0xad67('0x49')]['id']}})[_0xad67('0x27')](handleEntityNotFound(_0x2c280b,null))[_0xad67('0x27')](function(_0x563496){if(_0x563496){_0x4efe73=_0x563496;_0x423a7e[_0xad67('0x36')]=_[_0xad67('0x33')](db[_0xad67('0x4b')][_0xad67('0x2e')]);_0x423a7e['query']=_[_0xad67('0x33')](_0x4d4c30[_0xad67('0x32')]);_0x423a7e['filters']=_[_0xad67('0x35')](_0x423a7e[_0xad67('0x36')],_0x423a7e[_0xad67('0x32')]);_0x2ce183[_0xad67('0x38')]=_['intersection'](_0x423a7e['model'],qs[_0xad67('0x37')](_0x4d4c30['query']['fields']));_0x2ce183[_0xad67('0x38')]=_0x2ce183[_0xad67('0x38')]['length']?_0x2ce183[_0xad67('0x38')]:_0x423a7e[_0xad67('0x36')];_0x2ce183[_0xad67('0x3a')]=qs[_0xad67('0x3b')](_0x4d4c30[_0xad67('0x32')][_0xad67('0x3b')]);_0x2ce183[_0xad67('0x3c')]=qs[_0xad67('0x34')](_[_0xad67('0x4c')](_0x4d4c30[_0xad67('0x32')],_0x423a7e['filters']));if(_0x4d4c30[_0xad67('0x32')][_0xad67('0x3d')]){_0x2ce183['where']=_[_0xad67('0x3e')](_0x2ce183['where'],{'$or':_[_0xad67('0x2c')](_0x2ce183[_0xad67('0x38')],function(_0xaa558b){var _0x43db2e={};_0x43db2e[_0xaa558b]={'$like':'%'+_0x4d4c30[_0xad67('0x32')]['filter']+'%'};return _0x43db2e;})});}_0x2ce183=_[_0xad67('0x3e')]({},_0x2ce183,_0x4d4c30['options']);return _0x4efe73[_0xad67('0x4f')](_0x2ce183);}})[_0xad67('0x27')](function(_0x39f5e8){if(_0x39f5e8){_0x1cc92d=_0x39f5e8[_0xad67('0x45')];if(!_0x4d4c30['query'][_0xad67('0x4e')]('nolimit')){_0x2ce183['limit']=qs['limit'](_0x4d4c30[_0xad67('0x32')]['limit']);_0x2ce183[_0xad67('0x1e')]=qs['offset'](_0x4d4c30[_0xad67('0x32')]['offset']);}return _0x4efe73['getSubjects'](_0x2ce183);}})[_0xad67('0x27')](function(_0x1ed422){if(_0x1ed422){return _0x1ed422?{'count':_0x1cc92d,'rows':_0x1ed422}:null;}})['then'](respondWithResult(_0x2c280b,null))[_0xad67('0x44')](handleError(_0x2c280b,null));};exports['getDescriptions']=function(_0x13d414,_0x52e2b9,_0xddf93c){var _0x384e6f={};var _0x40b87b={};var _0x2e2bab;var _0x200994;return db[_0xad67('0x2d')][_0xad67('0x50')]({'where':{'id':_0x13d414[_0xad67('0x49')]['id']}})[_0xad67('0x27')](handleEntityNotFound(_0x52e2b9,null))[_0xad67('0x27')](function(_0x1d3501){if(_0x1d3501){_0x2e2bab=_0x1d3501;_0x40b87b[_0xad67('0x36')]=_[_0xad67('0x33')](db['SalesforceField'][_0xad67('0x2e')]);_0x40b87b[_0xad67('0x32')]=_['keys'](_0x13d414[_0xad67('0x32')]);_0x40b87b[_0xad67('0x34')]=_[_0xad67('0x35')](_0x40b87b[_0xad67('0x36')],_0x40b87b['query']);_0x384e6f[_0xad67('0x38')]=_[_0xad67('0x35')](_0x40b87b[_0xad67('0x36')],qs[_0xad67('0x37')](_0x13d414[_0xad67('0x32')][_0xad67('0x37')]));_0x384e6f[_0xad67('0x38')]=_0x384e6f[_0xad67('0x38')][_0xad67('0x45')]?_0x384e6f[_0xad67('0x38')]:_0x40b87b[_0xad67('0x36')];_0x384e6f[_0xad67('0x3a')]=qs[_0xad67('0x3b')](_0x13d414[_0xad67('0x32')][_0xad67('0x3b')]);_0x384e6f[_0xad67('0x3c')]=qs['filters'](_[_0xad67('0x4c')](_0x13d414[_0xad67('0x32')],_0x40b87b[_0xad67('0x34')]));if(_0x13d414[_0xad67('0x32')][_0xad67('0x3d')]){_0x384e6f[_0xad67('0x3c')]=_[_0xad67('0x3e')](_0x384e6f[_0xad67('0x3c')],{'$or':_[_0xad67('0x2c')](_0x384e6f['attributes'],function(_0x29c2d5){var _0x504502={};_0x504502[_0x29c2d5]={'$like':'%'+_0x13d414[_0xad67('0x32')][_0xad67('0x3d')]+'%'};return _0x504502;})});}_0x384e6f=_['merge']({},_0x384e6f,_0x13d414[_0xad67('0x4d')]);return _0x2e2bab[_0xad67('0x51')](_0x384e6f);}})['then'](function(_0x3b044a){if(_0x3b044a){_0x200994=_0x3b044a[_0xad67('0x45')];if(!_0x13d414[_0xad67('0x32')][_0xad67('0x4e')](_0xad67('0x39'))){_0x384e6f[_0xad67('0x20')]=qs[_0xad67('0x20')](_0x13d414[_0xad67('0x32')]['limit']);_0x384e6f[_0xad67('0x1e')]=qs['offset'](_0x13d414[_0xad67('0x32')][_0xad67('0x1e')]);}return _0x2e2bab[_0xad67('0x51')](_0x384e6f);}})['then'](function(_0x2522b9){if(_0x2522b9){return _0x2522b9?{'count':_0x200994,'rows':_0x2522b9}:null;}})[_0xad67('0x27')](respondWithResult(_0x52e2b9,null))[_0xad67('0x44')](handleError(_0x52e2b9,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 7ec4573..2132729 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 _0x8dcd=['api','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger'];(function(_0x222f12,_0x2fbac8){var _0x3257da=function(_0x2ce2dd){while(--_0x2ce2dd){_0x222f12['push'](_0x222f12['shift']());}};_0x3257da(++_0x2fbac8);}(_0x8dcd,0xce));var _0xd8dc=function(_0x4b4e7a,_0x22b74b){_0x4b4e7a=_0x4b4e7a-0x0;var _0x1c1725=_0x8dcd[_0x4b4e7a];return _0x1c1725;};'use strict';var _=require(_0xd8dc('0x0'));var util=require(_0xd8dc('0x1'));var logger=require(_0xd8dc('0x2'))(_0xd8dc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd8dc('0x4'));var config=require(_0xd8dc('0x5'));var attributes=require(_0xd8dc('0x6'));module[_0xd8dc('0x7')]=function(_0x5330f2,_0x581a5c){return _0x5330f2[_0xd8dc('0x8')](_0xd8dc('0x9'),attributes,{'tableName':_0xd8dc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x487a=['int_salesforce_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration'];(function(_0x44a7c4,_0x1b6f84){var _0x4f1c98=function(_0x49bcc7){while(--_0x49bcc7){_0x44a7c4['push'](_0x44a7c4['shift']());}};_0x4f1c98(++_0x1b6f84);}(_0x487a,0x9d));var _0xa487=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x487a[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0xa487('0x0'));var util=require(_0xa487('0x1'));var logger=require(_0xa487('0x2'))(_0xa487('0x3'));var moment=require(_0xa487('0x4'));var BPromise=require('bluebird');var rp=require(_0xa487('0x5'));var fs=require('fs');var path=require(_0xa487('0x6'));var rimraf=require('rimraf');var config=require(_0xa487('0x7'));var attributes=require(_0xa487('0x8'));module[_0xa487('0x9')]=function(_0xe86abf,_0x16b088){return _0xe86abf[_0xa487('0xa')](_0xa487('0xb'),attributes,{'tableName':_0xa487('0xc'),'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 8703391..f260b5d 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 _0x05ba=['result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x2abb3b,_0x454a5f){var _0x535c93=function(_0x1ef15a){while(--_0x1ef15a){_0x2abb3b['push'](_0x2abb3b['shift']());}};_0x535c93(++_0x454a5f);}(_0x05ba,0x17c));var _0xa05b=function(_0x46cf00,_0x457a43){_0x46cf00=_0x46cf00-0x0;var _0x3974dc=_0x05ba[_0x46cf00];return _0x3974dc;};'use strict';var _=require(_0xa05b('0x0'));var util=require(_0xa05b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa05b('0x2'));var fs=require('fs');var Redis=require(_0xa05b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa05b('0x4'));var logger=require(_0xa05b('0x5'))(_0xa05b('0x6'));var config=require(_0xa05b('0x7'));var jayson=require(_0xa05b('0x8'));var client=jayson['client'][_0xa05b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a6091,_0x841f6c,_0x14d14b){return new BPromise(function(_0x4161fc,_0x52c62){return client[_0xa05b('0xa')](_0x1a6091,_0x14d14b)['then'](function(_0xe370b){logger[_0xa05b('0xb')](_0xa05b('0xc'),_0x841f6c,'request\x20sent');logger['debug'](_0xa05b('0xd'),_0x841f6c,'request\x20sent',JSON[_0xa05b('0xe')](_0xe370b));if(_0xe370b[_0xa05b('0xf')]){if(_0xe370b[_0xa05b('0xf')][_0xa05b('0x10')]===0x1f4){logger[_0xa05b('0xf')](_0xa05b('0xc'),_0x841f6c,_0xe370b[_0xa05b('0xf')][_0xa05b('0x11')]);return _0x52c62(_0xe370b[_0xa05b('0xf')]['message']);}logger[_0xa05b('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x841f6c,_0xe370b['error'][_0xa05b('0x11')]);return _0x4161fc(_0xe370b[_0xa05b('0xf')][_0xa05b('0x11')]);}else{logger[_0xa05b('0xb')](_0xa05b('0xc'),_0x841f6c,_0xa05b('0x12'));_0x4161fc(_0xe370b[_0xa05b('0x13')][_0xa05b('0x11')]);}})[_0xa05b('0x14')](function(_0x3fcd54){logger[_0xa05b('0xf')](_0xa05b('0xc'),_0x841f6c,_0x3fcd54);_0x52c62(_0x3fcd54);});});} \ No newline at end of file +var _0x4cd8=['stringify','error','code','message','SalesforceConfiguration,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug'];(function(_0x2b9c7d,_0x43d27e){var _0x124b48=function(_0x1dcff9){while(--_0x1dcff9){_0x2b9c7d['push'](_0x2b9c7d['shift']());}};_0x124b48(++_0x43d27e);}(_0x4cd8,0x140));var _0x84cd=function(_0x5e5c4c,_0x21abba){_0x5e5c4c=_0x5e5c4c-0x0;var _0x176148=_0x4cd8[_0x5e5c4c];return _0x176148;};'use strict';var _=require(_0x84cd('0x0'));var util=require(_0x84cd('0x1'));var moment=require(_0x84cd('0x2'));var BPromise=require(_0x84cd('0x3'));var rs=require(_0x84cd('0x4'));var fs=require('fs');var Redis=require(_0x84cd('0x5'));var db=require(_0x84cd('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x84cd('0x7'))(_0x84cd('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x84cd('0x9')][_0x84cd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c3776,_0x87bb5f,_0x1192d9){return new BPromise(function(_0x137efc,_0x335dea){return client[_0x84cd('0xb')](_0x4c3776,_0x1192d9)[_0x84cd('0xc')](function(_0x3de60e){logger[_0x84cd('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x87bb5f,_0x84cd('0xe'));logger[_0x84cd('0xf')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x87bb5f,_0x84cd('0xe'),JSON[_0x84cd('0x10')](_0x3de60e));if(_0x3de60e['error']){if(_0x3de60e[_0x84cd('0x11')][_0x84cd('0x12')]===0x1f4){logger[_0x84cd('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x87bb5f,_0x3de60e[_0x84cd('0x11')][_0x84cd('0x13')]);return _0x335dea(_0x3de60e[_0x84cd('0x11')]['message']);}logger['error'](_0x84cd('0x14'),_0x87bb5f,_0x3de60e[_0x84cd('0x11')][_0x84cd('0x13')]);return _0x137efc(_0x3de60e[_0x84cd('0x11')]['message']);}else{logger[_0x84cd('0xd')](_0x84cd('0x14'),_0x87bb5f,_0x84cd('0xe'));_0x137efc(_0x3de60e['result'][_0x84cd('0x13')]);}})['catch'](function(_0x534680){logger[_0x84cd('0x11')](_0x84cd('0x14'),_0x87bb5f,_0x534680);_0x335dea(_0x534680);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 4ff937e..22679fa 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 _0xe5bd=['../../config/environment','./intSalesforceField.controller','get','index','/:id','show','post','isAuthenticated','put','update','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4cef60,_0x51b4e2){var _0x2f22a5=function(_0x186565){while(--_0x186565){_0x4cef60['push'](_0x4cef60['shift']());}};_0x2f22a5(++_0x51b4e2);}(_0xe5bd,0x161));var _0xde5b=function(_0x4195b8,_0x15cfe3){_0x4195b8=_0x4195b8-0x0;var _0x20ff9b=_0xe5bd[_0x4195b8];return _0x20ff9b;};'use strict';var multer=require('multer');var util=require(_0xde5b('0x0'));var path=require('path');var timeout=require(_0xde5b('0x1'));var express=require(_0xde5b('0x2'));var router=express[_0xde5b('0x3')]();var fs_extra=require(_0xde5b('0x4'));var auth=require(_0xde5b('0x5'));var interaction=require(_0xde5b('0x6'));var config=require(_0xde5b('0x7'));var controller=require(_0xde5b('0x8'));router[_0xde5b('0x9')]('/',auth['isAuthenticated'](),controller[_0xde5b('0xa')]);router[_0xde5b('0x9')](_0xde5b('0xb'),auth['isAuthenticated'](),controller[_0xde5b('0xc')]);router[_0xde5b('0xd')]('/',auth[_0xde5b('0xe')](),controller['create']);router[_0xde5b('0xf')](_0xde5b('0xb'),auth[_0xde5b('0xe')](),controller[_0xde5b('0x10')]);router['delete'](_0xde5b('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xde5b('0x11')]=router; \ No newline at end of file +var _0x3063=['../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x16e57d,_0x2cb7ba){var _0x40239c=function(_0x3cc8f0){while(--_0x3cc8f0){_0x16e57d['push'](_0x16e57d['shift']());}};_0x40239c(++_0x2cb7ba);}(_0x3063,0xf4));var _0x3306=function(_0x51b648,_0x3af80d){_0x51b648=_0x51b648-0x0;var _0x58a6e5=_0x3063[_0x51b648];return _0x58a6e5;};'use strict';var multer=require(_0x3306('0x0'));var util=require(_0x3306('0x1'));var path=require(_0x3306('0x2'));var timeout=require(_0x3306('0x3'));var express=require(_0x3306('0x4'));var router=express[_0x3306('0x5')]();var fs_extra=require(_0x3306('0x6'));var auth=require(_0x3306('0x7'));var interaction=require(_0x3306('0x8'));var config=require(_0x3306('0x9'));var controller=require(_0x3306('0xa'));router[_0x3306('0xb')]('/',auth[_0x3306('0xc')](),controller[_0x3306('0xd')]);router[_0x3306('0xb')](_0x3306('0xe'),auth[_0x3306('0xc')](),controller[_0x3306('0xf')]);router[_0x3306('0x10')]('/',auth[_0x3306('0xc')](),controller[_0x3306('0x11')]);router[_0x3306('0x12')]('/:id',auth[_0x3306('0xc')](),controller['update']);router[_0x3306('0x13')]('/:id',auth[_0x3306('0xc')](),controller[_0x3306('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 9f26d52..4c05173 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 _0x1afc=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','sequelize'];(function(_0x3fc992,_0x33512d){var _0x1944ff=function(_0x10677e){while(--_0x10677e){_0x3fc992['push'](_0x3fc992['shift']());}};_0x1944ff(++_0x33512d);}(_0x1afc,0xd7));var _0xc1af=function(_0x5dbcc5,_0x2a6363){_0x5dbcc5=_0x5dbcc5-0x0;var _0x18daae=_0x1afc[_0x5dbcc5];return _0x18daae;};'use strict';var Sequelize=require(_0xc1af('0x0'));module['exports']={'type':{'type':Sequelize[_0xc1af('0x1')](_0xc1af('0x2'),_0xc1af('0x3'),_0xc1af('0x4'),_0xc1af('0x5'),_0xc1af('0x6')),'defaultValue':_0xc1af('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xc1af('0x1')]('string',_0xc1af('0x3'),_0xc1af('0x4'))},'keyContent':{'type':Sequelize[_0xc1af('0x7')]},'idField':{'type':Sequelize[_0xc1af('0x7')]},'variableName':{'type':Sequelize[_0xc1af('0x7')]}}; \ No newline at end of file +var _0x9727=['ENUM','customVariable','sequelize','exports','string','variable','picklist','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9727,0x13a));var _0x7972=function(_0x2ddfd9,_0x5877d0){_0x2ddfd9=_0x2ddfd9-0x0;var _0x2668f0=_0x9727[_0x2ddfd9];return _0x2668f0;};'use strict';var Sequelize=require(_0x7972('0x0'));module[_0x7972('0x1')]={'type':{'type':Sequelize['ENUM'](_0x7972('0x2'),_0x7972('0x3'),'customVariable','keyValue',_0x7972('0x4')),'defaultValue':_0x7972('0x2')},'content':{'type':Sequelize[_0x7972('0x5')]},'key':{'type':Sequelize[_0x7972('0x5')]},'keyType':{'type':Sequelize[_0x7972('0x6')]('string','variable',_0x7972('0x7'))},'keyContent':{'type':Sequelize[_0x7972('0x5')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x7972('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 44bf000..0755835 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 _0x255b=['sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','stack','name','index','map','SalesforceField','fieldName','type','key','model','query','attributes','intersection','fields','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','keys','length','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x58ca7d,_0x27f5ea){var _0x152c4c=function(_0x1b9c99){while(--_0x1b9c99){_0x58ca7d['push'](_0x58ca7d['shift']());}};_0x152c4c(++_0x27f5ea);}(_0x255b,0xc4));var _0xb255=function(_0x250780,_0x4994e6){_0x250780=_0x250780-0x0;var _0x11f214=_0x255b[_0x250780];return _0x11f214;};'use strict';var emlformat=require(_0xb255('0x0'));var rimraf=require(_0xb255('0x1'));var zipdir=require(_0xb255('0x2'));var jsonpatch=require(_0xb255('0x3'));var rp=require(_0xb255('0x4'));var moment=require(_0xb255('0x5'));var BPromise=require(_0xb255('0x6'));var Mustache=require(_0xb255('0x7'));var util=require(_0xb255('0x8'));var path=require(_0xb255('0x9'));var sox=require(_0xb255('0xa'));var csv=require(_0xb255('0xb'));var ejs=require(_0xb255('0xc'));var fs=require('fs');var fs_extra=require(_0xb255('0xd'));var _=require(_0xb255('0xe'));var squel=require(_0xb255('0xf'));var crypto=require(_0xb255('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xb255('0x11'));var toCsv=require(_0xb255('0xb'));var querystring=require('querystring');var Papa=require(_0xb255('0x12'));var Redis=require('ioredis');var authService=require(_0xb255('0x13'));var qs=require(_0xb255('0x14'));var as=require(_0xb255('0x15'));var hardwareService=require(_0xb255('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xb255('0x17'));var licenseUtil=require(_0xb255('0x18'));var db=require(_0xb255('0x19'))['db'];function respondWithStatusCode(_0xd8f138,_0x3c7352){_0x3c7352=_0x3c7352||0xcc;return function(_0x1ee352){if(_0x1ee352){return _0xd8f138[_0xb255('0x1a')](_0x3c7352);}return _0xd8f138[_0xb255('0x1b')](_0x3c7352)[_0xb255('0x1c')]();};}function respondWithResult(_0x516404,_0x5b1c29){_0x5b1c29=_0x5b1c29||0xc8;return function(_0x7cbdf3){if(_0x7cbdf3){return _0x516404['status'](_0x5b1c29)[_0xb255('0x1d')](_0x7cbdf3);}};}function respondWithFilteredResult(_0x4e0dd1,_0x35478d){return function(_0x593ef4){if(_0x593ef4){var _0x24de0e=typeof _0x35478d[_0xb255('0x1e')]===_0xb255('0x1f')&&typeof _0x35478d[_0xb255('0x20')]===_0xb255('0x1f');var _0x357324=_0x593ef4[_0xb255('0x21')];var _0x2c43f2=_0x24de0e?0x0:_0x35478d[_0xb255('0x1e')];var _0x53403a=_0x24de0e?_0x593ef4[_0xb255('0x21')]:_0x35478d[_0xb255('0x1e')]+_0x35478d[_0xb255('0x20')];var _0x4460b3;if(_0x53403a>=_0x357324){_0x53403a=_0x357324;_0x4460b3=0xc8;}else{_0x4460b3=0xce;}_0x4e0dd1[_0xb255('0x1b')](_0x4460b3);return _0x4e0dd1['set'](_0xb255('0x22'),_0x2c43f2+'-'+_0x53403a+'/'+_0x357324)[_0xb255('0x1d')](_0x593ef4);}return null;};}function patchUpdates(_0x37ebb6){return function(_0x5697e8){try{jsonpatch[_0xb255('0x23')](_0x5697e8,_0x37ebb6,!![]);}catch(_0x3e2268){return BPromise['reject'](_0x3e2268);}return _0x5697e8[_0xb255('0x24')]();};}function saveUpdates(_0x4426a0,_0x41820c){return function(_0x2ac29f){if(_0x2ac29f){return _0x2ac29f[_0xb255('0x25')](_0x4426a0)['then'](function(_0x4b6c1e){return _0x4b6c1e;});}return null;};}function removeEntity(_0x528908,_0x4ec9a1){return function(_0x55d566){if(_0x55d566){return _0x55d566[_0xb255('0x26')]()[_0xb255('0x27')](function(){_0x528908[_0xb255('0x1b')](0xcc)[_0xb255('0x1c')]();});}};}function handleEntityNotFound(_0x3aa55d,_0x1286db){return function(_0x512573){if(!_0x512573){_0x3aa55d[_0xb255('0x1a')](0x194);}return _0x512573;};}function handleError(_0x43f27a,_0x33878c){_0x33878c=_0x33878c||0x1f4;return function(_0x1dbc53){logger['error'](_0x1dbc53[_0xb255('0x28')]);if(_0x1dbc53[_0xb255('0x29')]){delete _0x1dbc53[_0xb255('0x29')];}_0x43f27a[_0xb255('0x1b')](_0x33878c)['send'](_0x1dbc53);};}exports[_0xb255('0x2a')]=function(_0x4294f2,_0x427ee1){var _0x21538e={},_0x158b71={},_0x5083aa={'count':0x0,'rows':[]};var _0x5d90c2=_[_0xb255('0x2b')](db[_0xb255('0x2c')]['rawAttributes'],function(_0x9b5ada){return{'name':_0x9b5ada[_0xb255('0x2d')],'type':_0x9b5ada[_0xb255('0x2e')][_0xb255('0x2f')]};});_0x158b71[_0xb255('0x30')]=_[_0xb255('0x2b')](_0x5d90c2,_0xb255('0x29'));_0x158b71[_0xb255('0x31')]=_['keys'](_0x4294f2[_0xb255('0x31')]);_0x158b71['filters']=_['intersection'](_0x158b71[_0xb255('0x30')],_0x158b71[_0xb255('0x31')]);_0x21538e[_0xb255('0x32')]=_[_0xb255('0x33')](_0x158b71[_0xb255('0x30')],qs[_0xb255('0x34')](_0x4294f2[_0xb255('0x31')][_0xb255('0x34')]));_0x21538e[_0xb255('0x32')]=_0x21538e[_0xb255('0x32')]['length']?_0x21538e[_0xb255('0x32')]:_0x158b71[_0xb255('0x30')];if(!_0x4294f2[_0xb255('0x31')]['hasOwnProperty']('nolimit')){_0x21538e['limit']=qs[_0xb255('0x20')](_0x4294f2['query'][_0xb255('0x20')]);_0x21538e[_0xb255('0x1e')]=qs[_0xb255('0x1e')](_0x4294f2[_0xb255('0x31')]['offset']);}_0x21538e[_0xb255('0x35')]=qs[_0xb255('0x36')](_0x4294f2['query']['sort']);_0x21538e[_0xb255('0x37')]=qs[_0xb255('0x38')](_[_0xb255('0x39')](_0x4294f2['query'],_0x158b71[_0xb255('0x38')]),_0x5d90c2);if(_0x4294f2[_0xb255('0x31')]['filter']){_0x21538e[_0xb255('0x37')]=_[_0xb255('0x3a')](_0x21538e[_0xb255('0x37')],{'$or':_[_0xb255('0x2b')](_0x5d90c2,function(_0x550831){if(_0x550831[_0xb255('0x2e')]!==_0xb255('0x3b')){var _0x35d59e={};_0x35d59e[_0x550831['name']]={'$like':'%'+_0x4294f2['query'][_0xb255('0x3c')]+'%'};return _0x35d59e;}})});}_0x21538e=_['merge']({},_0x21538e,_0x4294f2['options']);var _0x193128={'where':_0x21538e[_0xb255('0x37')]};return db[_0xb255('0x2c')][_0xb255('0x21')](_0x193128)[_0xb255('0x27')](function(_0x231ea1){_0x5083aa[_0xb255('0x21')]=_0x231ea1;if(_0x4294f2[_0xb255('0x31')][_0xb255('0x3d')]){_0x21538e[_0xb255('0x3e')]=[{'all':!![]}];}return db[_0xb255('0x2c')][_0xb255('0x3f')](_0x21538e);})[_0xb255('0x27')](function(_0x4bc984){_0x5083aa[_0xb255('0x40')]=_0x4bc984;return _0x5083aa;})[_0xb255('0x27')](respondWithFilteredResult(_0x427ee1,_0x21538e))[_0xb255('0x41')](handleError(_0x427ee1,null));};exports[_0xb255('0x42')]=function(_0x46f5c4,_0x1f07bb){var _0x2dd051={'raw':!![],'where':{'id':_0x46f5c4['params']['id']}},_0x29ca75={};_0x29ca75[_0xb255('0x30')]=_['keys'](db['SalesforceField']['rawAttributes']);_0x29ca75[_0xb255('0x31')]=_[_0xb255('0x43')](_0x46f5c4[_0xb255('0x31')]);_0x29ca75['filters']=_[_0xb255('0x33')](_0x29ca75['model'],_0x29ca75[_0xb255('0x31')]);_0x2dd051[_0xb255('0x32')]=_[_0xb255('0x33')](_0x29ca75[_0xb255('0x30')],qs[_0xb255('0x34')](_0x46f5c4[_0xb255('0x31')][_0xb255('0x34')]));_0x2dd051[_0xb255('0x32')]=_0x2dd051[_0xb255('0x32')][_0xb255('0x44')]?_0x2dd051[_0xb255('0x32')]:_0x29ca75['model'];if(_0x46f5c4[_0xb255('0x31')]['includeAll']){_0x2dd051[_0xb255('0x3e')]=[{'all':!![]}];}_0x2dd051=_['merge']({},_0x2dd051,_0x46f5c4[_0xb255('0x45')]);return db[_0xb255('0x2c')][_0xb255('0x46')](_0x2dd051)['then'](handleEntityNotFound(_0x1f07bb,null))[_0xb255('0x27')](respondWithResult(_0x1f07bb,null))[_0xb255('0x41')](handleError(_0x1f07bb,null));};exports[_0xb255('0x47')]=function(_0x4ee5a2,_0x2275d6){return db[_0xb255('0x2c')][_0xb255('0x47')](_0x4ee5a2[_0xb255('0x48')],{})[_0xb255('0x27')](respondWithResult(_0x2275d6,0xc9))[_0xb255('0x41')](handleError(_0x2275d6,null));};exports[_0xb255('0x25')]=function(_0x5aaddf,_0x33bf71){if(_0x5aaddf['body']['id']){delete _0x5aaddf['body']['id'];}return db[_0xb255('0x2c')][_0xb255('0x46')]({'where':{'id':_0x5aaddf['params']['id']}})[_0xb255('0x27')](handleEntityNotFound(_0x33bf71,null))[_0xb255('0x27')](saveUpdates(_0x5aaddf['body'],null))['then'](respondWithResult(_0x33bf71,null))[_0xb255('0x41')](handleError(_0x33bf71,null));};exports[_0xb255('0x26')]=function(_0x2e18c4,_0x8a3fd2){return db[_0xb255('0x2c')][_0xb255('0x46')]({'where':{'id':_0x2e18c4[_0xb255('0x49')]['id']}})['then'](handleEntityNotFound(_0x8a3fd2,null))[_0xb255('0x27')](removeEntity(_0x8a3fd2,null))[_0xb255('0x41')](handleError(_0x8a3fd2,null));}; \ No newline at end of file +var _0x312b=['type','options','SalesforceField','include','findAll','show','params','rawAttributes','includeAll','catch','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','offset','undefined','limit','count','status','json','apply','reject','save','update','destroy','then','end','error','name','send','index','map','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x312b,0x1ab));var _0xb312=function(_0x417291,_0x1d64e6){_0x417291=_0x417291-0x0;var _0x5202b3=_0x312b[_0x417291];return _0x5202b3;};'use strict';var emlformat=require(_0xb312('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb312('0x1'));var jsonpatch=require(_0xb312('0x2'));var rp=require(_0xb312('0x3'));var moment=require(_0xb312('0x4'));var BPromise=require(_0xb312('0x5'));var Mustache=require(_0xb312('0x6'));var util=require(_0xb312('0x7'));var path=require(_0xb312('0x8'));var sox=require(_0xb312('0x9'));var csv=require(_0xb312('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb312('0xb'));var _=require(_0xb312('0xc'));var squel=require('squel');var crypto=require(_0xb312('0xd'));var jsforce=require(_0xb312('0xe'));var deskjs=require(_0xb312('0xf'));var toCsv=require(_0xb312('0xa'));var querystring=require('querystring');var Papa=require(_0xb312('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb312('0x11'));var as=require(_0xb312('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb312('0x13'))(_0xb312('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb312('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a064e,_0x2de5ad){_0x2de5ad=_0x2de5ad||0xcc;return function(_0x233e34){if(_0x233e34){return _0x2a064e[_0xb312('0x16')](_0x2de5ad);}return _0x2a064e['status'](_0x2de5ad)['end']();};}function respondWithResult(_0x2dc85a,_0x33b808){_0x33b808=_0x33b808||0xc8;return function(_0x475628){if(_0x475628){return _0x2dc85a['status'](_0x33b808)['json'](_0x475628);}};}function respondWithFilteredResult(_0x3781a3,_0x3918d1){return function(_0x212986){if(_0x212986){var _0x4f1cbd=typeof _0x3918d1[_0xb312('0x17')]===_0xb312('0x18')&&typeof _0x3918d1[_0xb312('0x19')]===_0xb312('0x18');var _0x3d5fe3=_0x212986[_0xb312('0x1a')];var _0xa3de0c=_0x4f1cbd?0x0:_0x3918d1['offset'];var _0x3ee589=_0x4f1cbd?_0x212986[_0xb312('0x1a')]:_0x3918d1[_0xb312('0x17')]+_0x3918d1[_0xb312('0x19')];var _0x151ed2;if(_0x3ee589>=_0x3d5fe3){_0x3ee589=_0x3d5fe3;_0x151ed2=0xc8;}else{_0x151ed2=0xce;}_0x3781a3[_0xb312('0x1b')](_0x151ed2);return _0x3781a3['set']('Content-Range',_0xa3de0c+'-'+_0x3ee589+'/'+_0x3d5fe3)[_0xb312('0x1c')](_0x212986);}return null;};}function patchUpdates(_0x2b678d){return function(_0x5e2c68){try{jsonpatch[_0xb312('0x1d')](_0x5e2c68,_0x2b678d,!![]);}catch(_0x415138){return BPromise[_0xb312('0x1e')](_0x415138);}return _0x5e2c68[_0xb312('0x1f')]();};}function saveUpdates(_0x483101,_0x489756){return function(_0x4af286){if(_0x4af286){return _0x4af286[_0xb312('0x20')](_0x483101)['then'](function(_0x1fa57e){return _0x1fa57e;});}return null;};}function removeEntity(_0x4c8bf5,_0x28421b){return function(_0x324497){if(_0x324497){return _0x324497[_0xb312('0x21')]()[_0xb312('0x22')](function(){_0x4c8bf5[_0xb312('0x1b')](0xcc)[_0xb312('0x23')]();});}};}function handleEntityNotFound(_0x204cf2,_0x4eb98d){return function(_0x4ec451){if(!_0x4ec451){_0x204cf2['sendStatus'](0x194);}return _0x4ec451;};}function handleError(_0x6329bd,_0x4310f4){_0x4310f4=_0x4310f4||0x1f4;return function(_0x3a0ec7){logger[_0xb312('0x24')](_0x3a0ec7['stack']);if(_0x3a0ec7[_0xb312('0x25')]){delete _0x3a0ec7[_0xb312('0x25')];}_0x6329bd[_0xb312('0x1b')](_0x4310f4)[_0xb312('0x26')](_0x3a0ec7);};}exports[_0xb312('0x27')]=function(_0x35f4d3,_0x1e73be){var _0x1c69ca={},_0x271822={},_0x10ff0d={'count':0x0,'rows':[]};var _0x365544=_[_0xb312('0x28')](db['SalesforceField']['rawAttributes'],function(_0x5eddaa){return{'name':_0x5eddaa[_0xb312('0x29')],'type':_0x5eddaa['type']['key']};});_0x271822[_0xb312('0x2a')]=_[_0xb312('0x28')](_0x365544,_0xb312('0x25'));_0x271822[_0xb312('0x2b')]=_[_0xb312('0x2c')](_0x35f4d3[_0xb312('0x2b')]);_0x271822[_0xb312('0x2d')]=_['intersection'](_0x271822[_0xb312('0x2a')],_0x271822[_0xb312('0x2b')]);_0x1c69ca[_0xb312('0x2e')]=_[_0xb312('0x2f')](_0x271822['model'],qs[_0xb312('0x30')](_0x35f4d3[_0xb312('0x2b')][_0xb312('0x30')]));_0x1c69ca[_0xb312('0x2e')]=_0x1c69ca[_0xb312('0x2e')][_0xb312('0x31')]?_0x1c69ca[_0xb312('0x2e')]:_0x271822[_0xb312('0x2a')];if(!_0x35f4d3[_0xb312('0x2b')][_0xb312('0x32')](_0xb312('0x33'))){_0x1c69ca[_0xb312('0x19')]=qs[_0xb312('0x19')](_0x35f4d3['query']['limit']);_0x1c69ca['offset']=qs[_0xb312('0x17')](_0x35f4d3[_0xb312('0x2b')][_0xb312('0x17')]);}_0x1c69ca['order']=qs['sort'](_0x35f4d3['query'][_0xb312('0x34')]);_0x1c69ca['where']=qs[_0xb312('0x2d')](_['pick'](_0x35f4d3[_0xb312('0x2b')],_0x271822[_0xb312('0x2d')]),_0x365544);if(_0x35f4d3[_0xb312('0x2b')][_0xb312('0x35')]){_0x1c69ca[_0xb312('0x36')]=_[_0xb312('0x37')](_0x1c69ca[_0xb312('0x36')],{'$or':_['map'](_0x365544,function(_0x25fe07){if(_0x25fe07[_0xb312('0x38')]!=='VIRTUAL'){var _0x25f60a={};_0x25f60a[_0x25fe07[_0xb312('0x25')]]={'$like':'%'+_0x35f4d3['query']['filter']+'%'};return _0x25f60a;}})});}_0x1c69ca=_['merge']({},_0x1c69ca,_0x35f4d3[_0xb312('0x39')]);var _0xc5e722={'where':_0x1c69ca[_0xb312('0x36')]};return db[_0xb312('0x3a')][_0xb312('0x1a')](_0xc5e722)[_0xb312('0x22')](function(_0x1091c2){_0x10ff0d['count']=_0x1091c2;if(_0x35f4d3[_0xb312('0x2b')]['includeAll']){_0x1c69ca[_0xb312('0x3b')]=[{'all':!![]}];}return db[_0xb312('0x3a')][_0xb312('0x3c')](_0x1c69ca);})[_0xb312('0x22')](function(_0x4c464f){_0x10ff0d['rows']=_0x4c464f;return _0x10ff0d;})[_0xb312('0x22')](respondWithFilteredResult(_0x1e73be,_0x1c69ca))['catch'](handleError(_0x1e73be,null));};exports[_0xb312('0x3d')]=function(_0xb80efc,_0x1998d8){var _0x286bc4={'raw':!![],'where':{'id':_0xb80efc[_0xb312('0x3e')]['id']}},_0x57c5a1={};_0x57c5a1['model']=_[_0xb312('0x2c')](db[_0xb312('0x3a')][_0xb312('0x3f')]);_0x57c5a1[_0xb312('0x2b')]=_[_0xb312('0x2c')](_0xb80efc[_0xb312('0x2b')]);_0x57c5a1[_0xb312('0x2d')]=_['intersection'](_0x57c5a1['model'],_0x57c5a1['query']);_0x286bc4['attributes']=_[_0xb312('0x2f')](_0x57c5a1[_0xb312('0x2a')],qs[_0xb312('0x30')](_0xb80efc[_0xb312('0x2b')][_0xb312('0x30')]));_0x286bc4[_0xb312('0x2e')]=_0x286bc4['attributes']['length']?_0x286bc4[_0xb312('0x2e')]:_0x57c5a1['model'];if(_0xb80efc[_0xb312('0x2b')][_0xb312('0x40')]){_0x286bc4['include']=[{'all':!![]}];}_0x286bc4=_[_0xb312('0x37')]({},_0x286bc4,_0xb80efc['options']);return db[_0xb312('0x3a')]['find'](_0x286bc4)[_0xb312('0x22')](handleEntityNotFound(_0x1998d8,null))['then'](respondWithResult(_0x1998d8,null))[_0xb312('0x41')](handleError(_0x1998d8,null));};exports[_0xb312('0x42')]=function(_0x1b25ce,_0x5861db){return db['SalesforceField'][_0xb312('0x42')](_0x1b25ce[_0xb312('0x43')],{})[_0xb312('0x22')](respondWithResult(_0x5861db,0xc9))['catch'](handleError(_0x5861db,null));};exports['update']=function(_0x19973d,_0x3faef3){if(_0x19973d['body']['id']){delete _0x19973d[_0xb312('0x43')]['id'];}return db['SalesforceField'][_0xb312('0x44')]({'where':{'id':_0x19973d[_0xb312('0x3e')]['id']}})[_0xb312('0x22')](handleEntityNotFound(_0x3faef3,null))[_0xb312('0x22')](saveUpdates(_0x19973d[_0xb312('0x43')],null))[_0xb312('0x22')](respondWithResult(_0x3faef3,null))[_0xb312('0x41')](handleError(_0x3faef3,null));};exports[_0xb312('0x21')]=function(_0x486d2e,_0x13d08a){return db[_0xb312('0x3a')][_0xb312('0x44')]({'where':{'id':_0x486d2e[_0xb312('0x3e')]['id']}})['then'](handleEntityNotFound(_0x13d08a,null))[_0xb312('0x22')](removeEntity(_0x13d08a,null))[_0xb312('0x41')](handleError(_0x13d08a,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index b61e76a..1055631 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 _0x45b7=['request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','../../config/logger','api','moment'];(function(_0x4f4031,_0x1978c5){var _0x18da27=function(_0xc85d42){while(--_0xc85d42){_0x4f4031['push'](_0x4f4031['shift']());}};_0x18da27(++_0x1978c5);}(_0x45b7,0xa1));var _0x745b=function(_0x38798c,_0x1d8792){_0x38798c=_0x38798c-0x0;var _0xe432fa=_0x45b7[_0x38798c];return _0xe432fa;};'use strict';var _=require(_0x745b('0x0'));var util=require('util');var logger=require(_0x745b('0x1'))(_0x745b('0x2'));var moment=require(_0x745b('0x3'));var BPromise=require('bluebird');var rp=require(_0x745b('0x4'));var fs=require('fs');var path=require(_0x745b('0x5'));var rimraf=require(_0x745b('0x6'));var config=require(_0x745b('0x7'));var attributes=require(_0x745b('0x8'));module['exports']=function(_0x373917,_0x1845b1){return _0x373917[_0x745b('0x9')](_0x745b('0xa'),attributes,{'tableName':_0x745b('0xb'),'paranoid':![],'indexes':[{'name':_0x745b('0xc'),'fields':[_0x745b('0xd'),_0x745b('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb510=['api','moment','bluebird','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x1564b7,_0x3ace72){var _0x3f552e=function(_0x354a96){while(--_0x354a96){_0x1564b7['push'](_0x1564b7['shift']());}};_0x3f552e(++_0x3ace72);}(_0xb510,0x131));var _0x0b51=function(_0x5bb26d,_0x430ece){_0x5bb26d=_0x5bb26d-0x0;var _0x202c8a=_0xb510[_0x5bb26d];return _0x202c8a;};'use strict';var _=require(_0x0b51('0x0'));var util=require(_0x0b51('0x1'));var logger=require(_0x0b51('0x2'))(_0x0b51('0x3'));var moment=require(_0x0b51('0x4'));var BPromise=require(_0x0b51('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0b51('0x6'));module[_0x0b51('0x7')]=function(_0x598387,_0x5df8da){return _0x598387[_0x0b51('0x8')](_0x0b51('0x9'),attributes,{'tableName':_0x0b51('0xa'),'paranoid':![],'indexes':[{'name':_0x0b51('0xb'),'fields':[_0x0b51('0xc'),_0x0b51('0xd')],'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 df11e30..ce82aae 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 _0x0935=['SalesforceField,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x0935,0x10e));var _0x5093=function(_0x15612e,_0x4b89a4){_0x15612e=_0x15612e-0x0;var _0x38cf2c=_0x0935[_0x15612e];return _0x38cf2c;};'use strict';var _=require(_0x5093('0x0'));var util=require(_0x5093('0x1'));var moment=require(_0x5093('0x2'));var BPromise=require(_0x5093('0x3'));var rs=require(_0x5093('0x4'));var fs=require('fs');var Redis=require(_0x5093('0x5'));var db=require(_0x5093('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5093('0x7'))(_0x5093('0x8'));var config=require(_0x5093('0x9'));var jayson=require(_0x5093('0xa'));var client=jayson[_0x5093('0xb')][_0x5093('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1fe357,_0x1eecd0,_0x49cbc8){return new BPromise(function(_0x303e16,_0x3aafa6){return client[_0x5093('0xd')](_0x1fe357,_0x49cbc8)[_0x5093('0xe')](function(_0x4e3485){logger[_0x5093('0xf')](_0x5093('0x10'),_0x1eecd0,_0x5093('0x11'));logger['debug']('SalesforceField,\x20%s,\x20%s,\x20%s',_0x1eecd0,'request\x20sent',JSON['stringify'](_0x4e3485));if(_0x4e3485['error']){if(_0x4e3485[_0x5093('0x12')][_0x5093('0x13')]===0x1f4){logger[_0x5093('0x12')](_0x5093('0x10'),_0x1eecd0,_0x4e3485[_0x5093('0x12')][_0x5093('0x14')]);return _0x3aafa6(_0x4e3485[_0x5093('0x12')][_0x5093('0x14')]);}logger['error'](_0x5093('0x10'),_0x1eecd0,_0x4e3485[_0x5093('0x12')]['message']);return _0x303e16(_0x4e3485[_0x5093('0x12')][_0x5093('0x14')]);}else{logger[_0x5093('0xf')](_0x5093('0x10'),_0x1eecd0,_0x5093('0x11'));_0x303e16(_0x4e3485['result'][_0x5093('0x14')]);}})[_0x5093('0x15')](function(_0x2bb219){logger[_0x5093('0x12')](_0x5093('0x10'),_0x1eecd0,_0x2bb219);_0x3aafa6(_0x2bb219);});});} \ No newline at end of file +var _0x05f6=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceField,\x20%s,\x20%s','message','info'];(function(_0x2287d2,_0x21b0e3){var _0x265ed3=function(_0x4c6d86){while(--_0x4c6d86){_0x2287d2['push'](_0x2287d2['shift']());}};_0x265ed3(++_0x21b0e3);}(_0x05f6,0xd4));var _0x605f=function(_0x5ef001,_0x3cae94){_0x5ef001=_0x5ef001-0x0;var _0x18a3b4=_0x05f6[_0x5ef001];return _0x18a3b4;};'use strict';var _=require('lodash');var util=require(_0x605f('0x0'));var moment=require(_0x605f('0x1'));var BPromise=require(_0x605f('0x2'));var rs=require(_0x605f('0x3'));var fs=require('fs');var Redis=require(_0x605f('0x4'));var db=require(_0x605f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x605f('0x6'))(_0x605f('0x7'));var config=require(_0x605f('0x8'));var jayson=require(_0x605f('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x53aa4f,_0x4341f0,_0x370e07){return new BPromise(function(_0x5864c5,_0x566820){return client[_0x605f('0xa')](_0x53aa4f,_0x370e07)[_0x605f('0xb')](function(_0x54bed8){logger['info']('SalesforceField,\x20%s,\x20%s',_0x4341f0,_0x605f('0xc'));logger['debug'](_0x605f('0xd'),_0x4341f0,_0x605f('0xc'),JSON[_0x605f('0xe')](_0x54bed8));if(_0x54bed8[_0x605f('0xf')]){if(_0x54bed8[_0x605f('0xf')]['code']===0x1f4){logger[_0x605f('0xf')]('SalesforceField,\x20%s,\x20%s',_0x4341f0,_0x54bed8[_0x605f('0xf')]['message']);return _0x566820(_0x54bed8['error']['message']);}logger['error'](_0x605f('0x10'),_0x4341f0,_0x54bed8['error'][_0x605f('0x11')]);return _0x5864c5(_0x54bed8['error']['message']);}else{logger[_0x605f('0x12')]('SalesforceField,\x20%s,\x20%s',_0x4341f0,_0x605f('0xc'));_0x5864c5(_0x54bed8[_0x605f('0x13')][_0x605f('0x11')]);}})[_0x605f('0x14')](function(_0x566d99){logger[_0x605f('0xf')]('SalesforceField,\x20%s,\x20%s',_0x4341f0,_0x566d99);_0x566820(_0x566d99);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 734348d..3642037 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 _0xb93f=['Router','fs-extra','../../components/auth/service','./intServicenowAccount.controller','get','index','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','create','post','/:id/configurations','addConfiguration','put','update','delete','multer','util'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xb93f,0x67));var _0xfb93=function(_0x1d4449,_0x495153){_0x1d4449=_0x1d4449-0x0;var _0x4dcde3=_0xb93f[_0x1d4449];return _0x4dcde3;};'use strict';var multer=require(_0xfb93('0x0'));var util=require(_0xfb93('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfb93('0x2')]();var fs_extra=require(_0xfb93('0x3'));var auth=require(_0xfb93('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfb93('0x5'));router[_0xfb93('0x6')]('/',auth['isAuthenticated'](),controller[_0xfb93('0x7')]);router['get'](_0xfb93('0x8'),auth[_0xfb93('0x9')](),controller[_0xfb93('0xa')]);router[_0xfb93('0x6')]('/:id/configurations',auth[_0xfb93('0x9')](),controller[_0xfb93('0xb')]);router['get'](_0xfb93('0xc'),auth[_0xfb93('0x9')](),controller[_0xfb93('0xd')]);router['post']('/',auth[_0xfb93('0x9')](),controller[_0xfb93('0xe')]);router[_0xfb93('0xf')](_0xfb93('0x10'),auth['isAuthenticated'](),controller[_0xfb93('0x11')]);router[_0xfb93('0x12')](_0xfb93('0x8'),auth[_0xfb93('0x9')](),controller[_0xfb93('0x13')]);router[_0xfb93('0x14')](_0xfb93('0x8'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc69e=['./intServicenowAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1347f8,_0x233feb){var _0x218368=function(_0x3f4ca3){while(--_0x3f4ca3){_0x1347f8['push'](_0x1347f8['shift']());}};_0x218368(++_0x233feb);}(_0xc69e,0xfa));var _0xec69=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc69e[_0x46698a];return _0x356db0;};'use strict';var multer=require(_0xec69('0x0'));var util=require(_0xec69('0x1'));var path=require(_0xec69('0x2'));var timeout=require(_0xec69('0x3'));var express=require(_0xec69('0x4'));var router=express[_0xec69('0x5')]();var fs_extra=require(_0xec69('0x6'));var auth=require(_0xec69('0x7'));var interaction=require(_0xec69('0x8'));var config=require(_0xec69('0x9'));var controller=require(_0xec69('0xa'));router[_0xec69('0xb')]('/',auth['isAuthenticated'](),controller[_0xec69('0xc')]);router['get'](_0xec69('0xd'),auth[_0xec69('0xe')](),controller[_0xec69('0xf')]);router[_0xec69('0xb')](_0xec69('0x10'),auth[_0xec69('0xe')](),controller[_0xec69('0x11')]);router['get'](_0xec69('0x12'),auth[_0xec69('0xe')](),controller[_0xec69('0x13')]);router[_0xec69('0x14')]('/',auth[_0xec69('0xe')](),controller[_0xec69('0x15')]);router[_0xec69('0x14')](_0xec69('0x10'),auth[_0xec69('0xe')](),controller[_0xec69('0x16')]);router[_0xec69('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xec69('0x18')]);router[_0xec69('0x19')](_0xec69('0xd'),auth['isAuthenticated'](),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 adc7cd5..8305c23 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 _0xe506=['sequelize','STRING','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe506,0xc0));var _0x6e50=function(_0xf67bbf,_0x44dda9){_0xf67bbf=_0xf67bbf-0x0;var _0x2b99c7=_0xe506[_0xf67bbf];return _0x2b99c7;};'use strict';var Sequelize=require(_0x6e50('0x0'));module['exports']={'name':{'type':Sequelize[_0x6e50('0x1')]},'description':{'type':Sequelize[_0x6e50('0x1')]},'username':{'type':Sequelize[_0x6e50('0x1')],'unique':_0x6e50('0x2')},'password':{'type':Sequelize[_0x6e50('0x1')]},'email':{'type':Sequelize[_0x6e50('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x6e50('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x380b=['remoteUri','sequelize','exports','STRING','username'];(function(_0x57b3a1,_0x1861aa){var _0x2d0df9=function(_0x5a43d8){while(--_0x5a43d8){_0x57b3a1['push'](_0x57b3a1['shift']());}};_0x2d0df9(++_0x1861aa);}(_0x380b,0x1dc));var _0xb380=function(_0xe8544,_0x5cde80){_0xe8544=_0xe8544-0x0;var _0x4aa279=_0x380b[_0xe8544];return _0x4aa279;};'use strict';var Sequelize=require(_0xb380('0x0'));module[_0xb380('0x1')]={'name':{'type':Sequelize[_0xb380('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb380('0x2')],'unique':_0xb380('0x3')},'password':{'type':Sequelize[_0xb380('0x2')]},'email':{'type':Sequelize[_0xb380('0x2')]},'remoteUri':{'type':Sequelize[_0xb380('0x2')],'unique':_0xb380('0x4')},'serverUrl':{'type':Sequelize[_0xb380('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 028245b..5fb1f5f 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 _0xbd42=['remoteUri','serverUrl','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','password','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','remove','forEach','internalType','label','all','assign','TCL:\x20_object','includes','push','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','value','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','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','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','set','reject','save','update','destroy','then','error','stack','name','send','index','map','ServicenowAccount','rawAttributes','key','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','catch','params','keys','include','find','create','body','getConfigurations','findOne','ServicenowConfiguration','order','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','type','Descriptions','getDescriptions','ServicenowField','getFields','hold_reason','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','number','resolved_by','sys_updated_by','sys_created_on','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','business_service','sys_domain_path','rfc','time_worked','expected_start','opened_at','work_end','resolved_at','caller_id','approval_set','work_notes','correlation_display','work_start','additional_assignee_list','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','problem_id','company','reassignment_count','activity_due','comments','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','email'];(function(_0x3337dd,_0x3d10f6){var _0x293a94=function(_0xd89387){while(--_0xd89387){_0x3337dd['push'](_0x3337dd['shift']());}};_0x293a94(++_0x3d10f6);}(_0xbd42,0x188));var _0x2bd4=function(_0x3f94c0,_0x21c689){_0x3f94c0=_0x3f94c0-0x0;var _0x9e5521=_0xbd42[_0x3f94c0];return _0x9e5521;};'use strict';var emlformat=require(_0x2bd4('0x0'));var rimraf=require(_0x2bd4('0x1'));var zipdir=require(_0x2bd4('0x2'));var jsonpatch=require(_0x2bd4('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2bd4('0x4'));var Mustache=require(_0x2bd4('0x5'));var util=require('util');var path=require(_0x2bd4('0x6'));var sox=require(_0x2bd4('0x7'));var csv=require(_0x2bd4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2bd4('0x9'));var _=require(_0x2bd4('0xa'));var squel=require(_0x2bd4('0xb'));var crypto=require(_0x2bd4('0xc'));var jsforce=require(_0x2bd4('0xd'));var deskjs=require(_0x2bd4('0xe'));var toCsv=require(_0x2bd4('0x8'));var querystring=require('querystring');var Papa=require(_0x2bd4('0xf'));var Redis=require(_0x2bd4('0x10'));var authService=require(_0x2bd4('0x11'));var qs=require(_0x2bd4('0x12'));var as=require(_0x2bd4('0x13'));var hardwareService=require(_0x2bd4('0x14'));var logger=require(_0x2bd4('0x15'))(_0x2bd4('0x16'));var utils=require('../../config/utils');var config=require(_0x2bd4('0x17'));var licenseUtil=require(_0x2bd4('0x18'));var db=require(_0x2bd4('0x19'))['db'];var integrations=require(_0x2bd4('0x1a'));function respondWithStatusCode(_0x5b6444,_0x41ad6c){_0x41ad6c=_0x41ad6c||0xcc;return function(_0x1b0f06){if(_0x1b0f06){return _0x5b6444[_0x2bd4('0x1b')](_0x41ad6c);}return _0x5b6444[_0x2bd4('0x1c')](_0x41ad6c)[_0x2bd4('0x1d')]();};}function respondWithResult(_0x2aa1e6,_0x135f1d){_0x135f1d=_0x135f1d||0xc8;return function(_0x25cfd9){if(_0x25cfd9){return _0x2aa1e6['status'](_0x135f1d)[_0x2bd4('0x1e')](_0x25cfd9);}};}function respondWithFilteredResult(_0x13a283,_0x371566){return function(_0x1b6bb7){if(_0x1b6bb7){var _0xdfcba3=typeof _0x371566[_0x2bd4('0x1f')]==='undefined'&&typeof _0x371566[_0x2bd4('0x20')]===_0x2bd4('0x21');var _0x309851=_0x1b6bb7['count'];var _0x16dff2=_0xdfcba3?0x0:_0x371566['offset'];var _0x363b1a=_0xdfcba3?_0x1b6bb7['count']:_0x371566[_0x2bd4('0x1f')]+_0x371566[_0x2bd4('0x20')];var _0x388e6d;if(_0x363b1a>=_0x309851){_0x363b1a=_0x309851;_0x388e6d=0xc8;}else{_0x388e6d=0xce;}_0x13a283[_0x2bd4('0x1c')](_0x388e6d);return _0x13a283[_0x2bd4('0x22')]('Content-Range',_0x16dff2+'-'+_0x363b1a+'/'+_0x309851)[_0x2bd4('0x1e')](_0x1b6bb7);}return null;};}function patchUpdates(_0x195228){return function(_0x135f4a){try{jsonpatch['apply'](_0x135f4a,_0x195228,!![]);}catch(_0x3839ca){return BPromise[_0x2bd4('0x23')](_0x3839ca);}return _0x135f4a[_0x2bd4('0x24')]();};}function saveUpdates(_0x4eb52b,_0x3590a3){return function(_0x5c5233){if(_0x5c5233){return _0x5c5233[_0x2bd4('0x25')](_0x4eb52b)['then'](function(_0x3c39e6){return _0x3c39e6;});}return null;};}function removeEntity(_0x695f70,_0x3684ad){return function(_0x7d2bd5){if(_0x7d2bd5){return _0x7d2bd5[_0x2bd4('0x26')]()[_0x2bd4('0x27')](function(){_0x695f70[_0x2bd4('0x1c')](0xcc)[_0x2bd4('0x1d')]();});}};}function handleEntityNotFound(_0x105203,_0x21da31){return function(_0x13e33f){if(!_0x13e33f){_0x105203[_0x2bd4('0x1b')](0x194);}return _0x13e33f;};}function handleError(_0x1e7246,_0x2b9cf6){_0x2b9cf6=_0x2b9cf6||0x1f4;return function(_0x40287d){logger[_0x2bd4('0x28')](_0x40287d[_0x2bd4('0x29')]);if(_0x40287d[_0x2bd4('0x2a')]){delete _0x40287d[_0x2bd4('0x2a')];}_0x1e7246[_0x2bd4('0x1c')](_0x2b9cf6)[_0x2bd4('0x2b')](_0x40287d);};}exports[_0x2bd4('0x2c')]=function(_0x85fe77,_0xfea098){var _0x8bdde3={},_0x552574={},_0x3ed82a={'count':0x0,'rows':[]};var _0x263742=_[_0x2bd4('0x2d')](db[_0x2bd4('0x2e')][_0x2bd4('0x2f')],function(_0xc0290e){return{'name':_0xc0290e['fieldName'],'type':_0xc0290e['type'][_0x2bd4('0x30')]};});_0x552574['model']=_[_0x2bd4('0x2d')](_0x263742,_0x2bd4('0x2a'));_0x552574[_0x2bd4('0x31')]=_['keys'](_0x85fe77[_0x2bd4('0x31')]);_0x552574[_0x2bd4('0x32')]=_[_0x2bd4('0x33')](_0x552574[_0x2bd4('0x34')],_0x552574[_0x2bd4('0x31')]);_0x8bdde3[_0x2bd4('0x35')]=_[_0x2bd4('0x33')](_0x552574[_0x2bd4('0x34')],qs[_0x2bd4('0x36')](_0x85fe77[_0x2bd4('0x31')][_0x2bd4('0x36')]));_0x8bdde3[_0x2bd4('0x35')]=_0x8bdde3[_0x2bd4('0x35')][_0x2bd4('0x37')]?_0x8bdde3[_0x2bd4('0x35')]:_0x552574[_0x2bd4('0x34')];if(!_0x85fe77['query']['hasOwnProperty'](_0x2bd4('0x38'))){_0x8bdde3['limit']=qs[_0x2bd4('0x20')](_0x85fe77[_0x2bd4('0x31')][_0x2bd4('0x20')]);_0x8bdde3['offset']=qs[_0x2bd4('0x1f')](_0x85fe77['query'][_0x2bd4('0x1f')]);}_0x8bdde3['order']=qs[_0x2bd4('0x39')](_0x85fe77['query']['sort']);_0x8bdde3[_0x2bd4('0x3a')]=qs[_0x2bd4('0x32')](_[_0x2bd4('0x3b')](_0x85fe77['query'],_0x552574[_0x2bd4('0x32')]),_0x263742);if(_0x85fe77[_0x2bd4('0x31')][_0x2bd4('0x3c')]){_0x8bdde3[_0x2bd4('0x3a')]=_[_0x2bd4('0x3d')](_0x8bdde3[_0x2bd4('0x3a')],{'$or':_[_0x2bd4('0x2d')](_0x263742,function(_0xddc474){if(_0xddc474['type']!==_0x2bd4('0x3e')){var _0x1295d9={};_0x1295d9[_0xddc474[_0x2bd4('0x2a')]]={'$like':'%'+_0x85fe77[_0x2bd4('0x31')][_0x2bd4('0x3c')]+'%'};return _0x1295d9;}})});}_0x8bdde3=_[_0x2bd4('0x3d')]({},_0x8bdde3,_0x85fe77[_0x2bd4('0x3f')]);var _0x12dbb7={'where':_0x8bdde3['where']};return db[_0x2bd4('0x2e')][_0x2bd4('0x40')](_0x12dbb7)[_0x2bd4('0x27')](function(_0x20bfd3){_0x3ed82a[_0x2bd4('0x40')]=_0x20bfd3;if(_0x85fe77[_0x2bd4('0x31')][_0x2bd4('0x41')]){_0x8bdde3['include']=[{'all':!![]}];}return db[_0x2bd4('0x2e')]['findAll'](_0x8bdde3);})[_0x2bd4('0x27')](function(_0x5079cc){_0x3ed82a['rows']=_0x5079cc;return _0x3ed82a;})[_0x2bd4('0x27')](respondWithFilteredResult(_0xfea098,_0x8bdde3))[_0x2bd4('0x42')](handleError(_0xfea098,null));};exports['show']=function(_0x392650,_0x180fa4){var _0x3ab637={'raw':![],'where':{'id':_0x392650[_0x2bd4('0x43')]['id']}},_0x5396c6={};_0x5396c6['model']=_[_0x2bd4('0x44')](db[_0x2bd4('0x2e')][_0x2bd4('0x2f')]);_0x5396c6['query']=_[_0x2bd4('0x44')](_0x392650[_0x2bd4('0x31')]);_0x5396c6['filters']=_[_0x2bd4('0x33')](_0x5396c6[_0x2bd4('0x34')],_0x5396c6['query']);_0x3ab637[_0x2bd4('0x35')]=_[_0x2bd4('0x33')](_0x5396c6[_0x2bd4('0x34')],qs[_0x2bd4('0x36')](_0x392650[_0x2bd4('0x31')][_0x2bd4('0x36')]));_0x3ab637[_0x2bd4('0x35')]=_0x3ab637[_0x2bd4('0x35')]['length']?_0x3ab637[_0x2bd4('0x35')]:_0x5396c6[_0x2bd4('0x34')];if(_0x392650[_0x2bd4('0x31')][_0x2bd4('0x41')]){_0x3ab637[_0x2bd4('0x45')]=[{'all':!![]}];}_0x3ab637=_[_0x2bd4('0x3d')]({},_0x3ab637,_0x392650[_0x2bd4('0x3f')]);return db[_0x2bd4('0x2e')][_0x2bd4('0x46')](_0x3ab637)[_0x2bd4('0x27')](handleEntityNotFound(_0x180fa4,null))[_0x2bd4('0x27')](respondWithResult(_0x180fa4,null))[_0x2bd4('0x42')](handleError(_0x180fa4,null));};exports[_0x2bd4('0x47')]=function(_0x18cdfe,_0x998a53){return db[_0x2bd4('0x2e')][_0x2bd4('0x47')](_0x18cdfe[_0x2bd4('0x48')],{})[_0x2bd4('0x27')](respondWithResult(_0x998a53,0xc9))[_0x2bd4('0x42')](handleError(_0x998a53,null));};exports[_0x2bd4('0x25')]=function(_0x2b3468,_0x38abfb){if(_0x2b3468['body']['id']){delete _0x2b3468['body']['id'];}return db[_0x2bd4('0x2e')][_0x2bd4('0x46')]({'where':{'id':_0x2b3468['params']['id']}})[_0x2bd4('0x27')](handleEntityNotFound(_0x38abfb,null))['then'](saveUpdates(_0x2b3468['body'],null))[_0x2bd4('0x27')](respondWithResult(_0x38abfb,null))[_0x2bd4('0x42')](handleError(_0x38abfb,null));};exports[_0x2bd4('0x26')]=function(_0x22b275,_0x2080b5){return db[_0x2bd4('0x2e')]['find']({'where':{'id':_0x22b275[_0x2bd4('0x43')]['id']}})[_0x2bd4('0x27')](handleEntityNotFound(_0x2080b5,null))['then'](removeEntity(_0x2080b5,null))[_0x2bd4('0x42')](handleError(_0x2080b5,null));};exports[_0x2bd4('0x49')]=function(_0xa9bca0,_0xb66e83,_0x4e9075){var _0xf85396={};var _0x4dc275={};var _0x31ffed;var _0x48204d;return db[_0x2bd4('0x2e')][_0x2bd4('0x4a')]({'where':{'id':_0xa9bca0[_0x2bd4('0x43')]['id']}})[_0x2bd4('0x27')](handleEntityNotFound(_0xb66e83,null))['then'](function(_0x552868){if(_0x552868){_0x31ffed=_0x552868;_0x4dc275[_0x2bd4('0x34')]=_[_0x2bd4('0x44')](db[_0x2bd4('0x4b')]['rawAttributes']);_0x4dc275[_0x2bd4('0x31')]=_[_0x2bd4('0x44')](_0xa9bca0[_0x2bd4('0x31')]);_0x4dc275[_0x2bd4('0x32')]=_['intersection'](_0x4dc275[_0x2bd4('0x34')],_0x4dc275[_0x2bd4('0x31')]);_0xf85396[_0x2bd4('0x35')]=_[_0x2bd4('0x33')](_0x4dc275[_0x2bd4('0x34')],qs[_0x2bd4('0x36')](_0xa9bca0[_0x2bd4('0x31')]['fields']));_0xf85396[_0x2bd4('0x35')]=_0xf85396[_0x2bd4('0x35')][_0x2bd4('0x37')]?_0xf85396[_0x2bd4('0x35')]:_0x4dc275[_0x2bd4('0x34')];_0xf85396[_0x2bd4('0x4c')]=qs[_0x2bd4('0x39')](_0xa9bca0['query'][_0x2bd4('0x39')]);_0xf85396['where']=qs[_0x2bd4('0x32')](_[_0x2bd4('0x3b')](_0xa9bca0[_0x2bd4('0x31')],_0x4dc275['filters']));if(_0xa9bca0[_0x2bd4('0x31')][_0x2bd4('0x3c')]){_0xf85396[_0x2bd4('0x3a')]=_[_0x2bd4('0x3d')](_0xf85396[_0x2bd4('0x3a')],{'$or':_['map'](_0xf85396[_0x2bd4('0x35')],function(_0x14ce95){var _0x5b1852={};_0x5b1852[_0x14ce95]={'$like':'%'+_0xa9bca0[_0x2bd4('0x31')][_0x2bd4('0x3c')]+'%'};return _0x5b1852;})});}_0xf85396=_['merge']({},_0xf85396,_0xa9bca0[_0x2bd4('0x3f')]);return _0x31ffed[_0x2bd4('0x49')](_0xf85396);}})[_0x2bd4('0x27')](function(_0x589cab){if(_0x589cab){_0x48204d=_0x589cab['length'];if(!_0xa9bca0[_0x2bd4('0x31')][_0x2bd4('0x4d')](_0x2bd4('0x38'))){_0xf85396['limit']=qs[_0x2bd4('0x20')](_0xa9bca0[_0x2bd4('0x31')][_0x2bd4('0x20')]);_0xf85396[_0x2bd4('0x1f')]=qs[_0x2bd4('0x1f')](_0xa9bca0[_0x2bd4('0x31')][_0x2bd4('0x1f')]);}return _0x31ffed[_0x2bd4('0x49')](_0xf85396);}})['then'](function(_0x390370){if(_0x390370){return _0x390370?{'count':_0x48204d,'rows':_0x390370}:null;}})[_0x2bd4('0x27')](respondWithResult(_0xb66e83,null))[_0x2bd4('0x42')](handleError(_0xb66e83,null));};exports[_0x2bd4('0x4e')]=function(_0x577d0d,_0x17be47,_0xc22842){if(_0x577d0d['body']['id']){delete _0x577d0d['body']['id'];}return db[_0x2bd4('0x2e')][_0x2bd4('0x4a')]({'where':{'id':_0x577d0d[_0x2bd4('0x43')]['id']}})[_0x2bd4('0x27')](handleEntityNotFound(_0x17be47,null))[_0x2bd4('0x27')](function(_0x2d73f6){if(_0x2d73f6){_0x577d0d[_0x2bd4('0x48')][_0x2bd4('0x4f')]=_0x2d73f6['id'];_0x577d0d[_0x2bd4('0x48')][_0x2bd4('0x50')]=integrations['getSubjects'](_0x577d0d[_0x2bd4('0x48')][_0x2bd4('0x51')],_0x577d0d[_0x2bd4('0x48')][_0x2bd4('0x52')]);_0x577d0d['body'][_0x2bd4('0x53')]=integrations[_0x2bd4('0x54')](_0x577d0d[_0x2bd4('0x48')][_0x2bd4('0x51')],_0x577d0d[_0x2bd4('0x48')]['type']);return db[_0x2bd4('0x4b')]['create'](_0x577d0d[_0x2bd4('0x48')],{'include':[{'model':db[_0x2bd4('0x55')],'as':_0x2bd4('0x50')},{'model':db[_0x2bd4('0x55')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x17be47,null))[_0x2bd4('0x42')](handleError(_0x17be47,null));};exports[_0x2bd4('0x56')]=function(_0x51e554,_0x580a03,_0x224657){var _0x7d06fd=['made_sla',_0x2bd4('0x57'),'knowledge',_0x2bd4('0x58'),_0x2bd4('0x59'),_0x2bd4('0x5a'),_0x2bd4('0x5b'),_0x2bd4('0x5c'),_0x2bd4('0x5d')];var _0x1be562=[_0x2bd4('0x5e'),'made_sla',_0x2bd4('0x5f'),_0x2bd4('0x60'),'upon_reject','sys_updated_on','child_incidents',_0x2bd4('0x57'),'approval_history',_0x2bd4('0x61'),_0x2bd4('0x62'),_0x2bd4('0x63'),'opened_by','user_input',_0x2bd4('0x64'),'sys_domain',_0x2bd4('0x65'),_0x2bd4('0x66'),'knowledge',_0x2bd4('0x4c'),_0x2bd4('0x67'),_0x2bd4('0x68'),_0x2bd4('0x69'),_0x2bd4('0x6a'),_0x2bd4('0x6b'),'active','work_notes_list',_0x2bd4('0x6c'),'priority',_0x2bd4('0x6d'),_0x2bd4('0x6e'),_0x2bd4('0x6f'),_0x2bd4('0x70'),_0x2bd4('0x71'),'business_duration','group_list',_0x2bd4('0x72'),'reopened_time',_0x2bd4('0x73'),_0x2bd4('0x74'),_0x2bd4('0x75'),_0x2bd4('0x58'),_0x2bd4('0x76'),'short_description',_0x2bd4('0x59'),_0x2bd4('0x77'),'delivery_task',_0x2bd4('0x78'),'assignment_group','business_stc',_0x2bd4('0x79'),'description',_0x2bd4('0x7a'),_0x2bd4('0x5a'),_0x2bd4('0x7b'),_0x2bd4('0x7c'),_0x2bd4('0x7d'),_0x2bd4('0x7e'),_0x2bd4('0x7f'),_0x2bd4('0x80'),_0x2bd4('0x81'),_0x2bd4('0x82'),_0x2bd4('0x5b'),'urgency',_0x2bd4('0x83'),_0x2bd4('0x84'),_0x2bd4('0x85'),_0x2bd4('0x86'),'assigned_to','severity',_0x2bd4('0x87'),'sla_due','approval',_0x2bd4('0x88'),'due_date',_0x2bd4('0x89'),_0x2bd4('0x8a'),_0x2bd4('0x8b'),_0x2bd4('0x8c'),_0x2bd4('0x8d'),_0x2bd4('0x8e'),_0x2bd4('0x8f'),_0x2bd4('0x5d')];var _0x5b3143='';var _0x57b2f0='';var _0x26138f=[];var _0x1e2d2e='';var _0x19200c='';var _0x134a57=[];var _0x824cbc='';var _0x1b1dde='';var _0x17b79b={};var _0x566052='';return db[_0x2bd4('0x2e')]['findOne']({'where':{'id':_0x51e554[_0x2bd4('0x43')]['id']},'attributes':['id','username','password',_0x2bd4('0x90'),_0x2bd4('0x91'),_0x2bd4('0x92')]})[_0x2bd4('0x27')](handleEntityNotFound(_0x580a03,null))[_0x2bd4('0x27')](function(_0x391cca){if(_0x391cca){_0x566052=_0x391cca[_0x2bd4('0x91')];var _0x4c7253=_0x566052['slice'](-0x1);if(_0x4c7253==='/'){_0x566052=_0x566052[_0x2bd4('0x93')](0x0,_0x566052[_0x2bd4('0x94')](_0x4c7253));}_0x1b1dde=util[_0x2bd4('0x95')](_0x2bd4('0x96'),_0x566052);_0x824cbc=util['format'](_0x2bd4('0x97'),_0x566052);_0x17b79b={'user':_0x391cca['username'],'pass':_0x391cca[_0x2bd4('0x98')]};var _0x327cfa={'method':_0x2bd4('0x99'),'uri':_0x1b1dde+_0x2bd4('0x9a'),'auth':_0x17b79b,'json':!![]};return rp(_0x327cfa);}})[_0x2bd4('0x27')](function(_0x22b8fe){if(_0x22b8fe[_0x2bd4('0x9b')][_0x2bd4('0x37')]>0x0){_0x5b3143=_0x22b8fe[_0x2bd4('0x9b')];}console[_0x2bd4('0x9c')](_0x2bd4('0x9d'),_0x5b3143);_0x134a57=[];_0x57b2f0=Object['assign']([],_0x5b3143);_[_0x2bd4('0x9e')](_0x57b2f0,function(_0x199eff){return!_0x7d06fd['includes'](_0x199eff[_0x2bd4('0x2a')]);});_0x57b2f0[_0x2bd4('0x9f')](function(_0x3117de){var _0x3834ff=createFieldObject(_0x824cbc,_0x17b79b,_0x3117de[_0x2bd4('0xa0')],_0x3117de[_0x2bd4('0x2a')],_0x3117de[_0x2bd4('0xa1')],![]);_0x134a57['push'](_0x3834ff);});return Promise[_0x2bd4('0xa2')](_0x134a57);})[_0x2bd4('0x27')](function(_0x4ec9f0){_0x26138f=_0x4ec9f0;_0x1e2d2e=Object[_0x2bd4('0xa3')]([],_0x5b3143);console[_0x2bd4('0x9c')](_0x2bd4('0xa4'),_0x5b3143);_['remove'](_0x1e2d2e,function(_0x41a1b2){return _0x1be562[_0x2bd4('0xa5')](_0x41a1b2['name']);});console[_0x2bd4('0x9c')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x1e2d2e);_0x134a57=[];_0x1e2d2e[_0x2bd4('0x9f')](function(_0x3f68bc){var _0xd0f227=createFieldObject(_0x824cbc,_0x17b79b,_0x3f68bc[_0x2bd4('0xa0')],_0x3f68bc['name'],_0x3f68bc['label'],!![]);_0x134a57[_0x2bd4('0xa6')](_0xd0f227);});return Promise[_0x2bd4('0xa2')](_0x134a57);})[_0x2bd4('0x27')](function(_0xbbea1){_0x19200c=_0xbbea1;var _0xd822ad=_0x26138f[_0x2bd4('0xa7')](_0x19200c);return{'count':_0xd822ad['length'],'rows':_0xd822ad};})[_0x2bd4('0x27')](respondWithResult(_0x580a03,null))[_0x2bd4('0x42')](function(_0x2bd3c1){console[_0x2bd4('0x9c')](_0x2bd4('0xa8')+_0x2bd3c1);var _0x1ec8fc=_0x51e554['query'][_0x2bd4('0xa9')]?0x1f4:_0x2bd3c1[_0x2bd4('0xaa')]||0x1f4;logger[_0x2bd4('0x28')](_0x2bd3c1[_0x2bd4('0x29')]);delete _0x2bd3c1[_0x2bd4('0x2a')];if(_0x1ec8fc===0x191){_0x1ec8fc=0x190;}_0x580a03[_0x2bd4('0x1c')](_0x1ec8fc)[_0x2bd4('0x2b')](_0x51e554[_0x2bd4('0x31')]['test']?{'message':_0x2bd4('0xab'),'statusCode':_0x2bd3c1[_0x2bd4('0xaa')]}:_0x2bd3c1);});};function createFieldObject(_0x1cd63a,_0x4c19ac,_0x53e6ca,_0x2ae599,_0x111f04,_0x559d46){return new Promise(function(_0x3125f9,_0x375a1e){var _0x3049ba={'id':_0x2ae599,'name':_0x111f04,'custom':_0x559d46};if(_0x53e6ca===_0x2bd4('0xac')){_0x3049ba[_0x2bd4('0x3f')]=[{'name':_0x2bd4('0xad'),'value':_0x2bd4('0xae')},{'name':_0x2bd4('0xaf'),'value':_0x2bd4('0xb0')}];_0x3125f9(_0x3049ba);}else{var _0x3fcbce={'method':_0x2bd4('0x99'),'uri':_0x1cd63a+_0x2bd4('0xb1')+_0x2ae599,'auth':_0x4c19ac,'json':!![]};return rp(_0x3fcbce)[_0x2bd4('0x27')](function(_0x65039){var _0x2d44bf=[];if(_0x65039[_0x2bd4('0x9b')][_0x2bd4('0x37')]>0x0){_0x65039[_0x2bd4('0x9b')][_0x2bd4('0x9f')](function(_0x30c639){if(_0x30c639['inactive']===_0x2bd4('0xb0')){var _0x2a1f9e={'name':_0x30c639[_0x2bd4('0xa1')],'value':_0x30c639[_0x2bd4('0xb2')]};_0x2d44bf[_0x2bd4('0xa6')](_0x2a1f9e);}});}_0x3049ba['options']=_0x2d44bf;if(_0x3049ba['options'][_0x2bd4('0x37')]>0x0){_0x3125f9(_0x3049ba);}else{if(_0x559d46==![]){_0x3125f9();}else{_0x3125f9(_0x3049ba);}}});}});} \ No newline at end of file +var _0x9b99=['false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','set','json','apply','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','ServicenowAccount','count','findAll','rows','catch','show','params','includeAll','options','find','create','body','update','getConfigurations','length','addConfiguration','findOne','Subjects','getSubjects','Descriptions','getDescriptions','channel','ServicenowField','getFields','knowledge','subcategory','close_code','notify','incident_state','category','parent','made_sla','caused_by','upon_reject','sys_updated_on','child_incidents','hold_reason','number','resolved_by','user_input','sys_domain','calendar_stc','closed_at','delivery_plan','impact','active','work_notes_list','priority','sys_domain_path','rfc','opened_at','business_duration','group_list','work_end','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','sys_class_name','closed_by','follow_up','parent_incident','sys_id','reopened_by','urgency','company','activity_due','assigned_to','comments','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','username','email','remoteUri','substring','format','%s/api/now/table/','password','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','all','TCL:\x20_object','push','ServiceNow\x20error:\x20','test','statusCode','boolean','True','true','False'];(function(_0x54551e,_0x429370){var _0x1d6913=function(_0x3c658d){while(--_0x3c658d){_0x54551e['push'](_0x54551e['shift']());}};_0x1d6913(++_0x429370);}(_0x9b99,0x15e));var _0x99b9=function(_0x468c1b,_0x3bc425){_0x468c1b=_0x468c1b-0x0;var _0x2cd0f9=_0x9b99[_0x468c1b];return _0x2cd0f9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x99b9('0x0'));var zipdir=require(_0x99b9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99b9('0x2'));var moment=require(_0x99b9('0x3'));var BPromise=require(_0x99b9('0x4'));var Mustache=require(_0x99b9('0x5'));var util=require('util');var path=require(_0x99b9('0x6'));var sox=require('sox');var csv=require(_0x99b9('0x7'));var ejs=require(_0x99b9('0x8'));var fs=require('fs');var fs_extra=require(_0x99b9('0x9'));var _=require(_0x99b9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x99b9('0xb'));var deskjs=require(_0x99b9('0xc'));var toCsv=require(_0x99b9('0x7'));var querystring=require('querystring');var Papa=require(_0x99b9('0xd'));var Redis=require(_0x99b9('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x99b9('0xf'));var as=require(_0x99b9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x99b9('0x11'));var config=require(_0x99b9('0x12'));var licenseUtil=require(_0x99b9('0x13'));var db=require(_0x99b9('0x14'))['db'];var integrations=require(_0x99b9('0x15'));function respondWithStatusCode(_0x291b28,_0x4cbef3){_0x4cbef3=_0x4cbef3||0xcc;return function(_0x3e76d6){if(_0x3e76d6){return _0x291b28[_0x99b9('0x16')](_0x4cbef3);}return _0x291b28[_0x99b9('0x17')](_0x4cbef3)[_0x99b9('0x18')]();};}function respondWithResult(_0x2172d0,_0x45af43){_0x45af43=_0x45af43||0xc8;return function(_0x11bd4d){if(_0x11bd4d){return _0x2172d0['status'](_0x45af43)['json'](_0x11bd4d);}};}function respondWithFilteredResult(_0x20f068,_0x473964){return function(_0x411c47){if(_0x411c47){var _0x1107c1=typeof _0x473964[_0x99b9('0x19')]===_0x99b9('0x1a')&&typeof _0x473964[_0x99b9('0x1b')]===_0x99b9('0x1a');var _0x499759=_0x411c47['count'];var _0x527d35=_0x1107c1?0x0:_0x473964[_0x99b9('0x19')];var _0x1e80ad=_0x1107c1?_0x411c47['count']:_0x473964[_0x99b9('0x19')]+_0x473964[_0x99b9('0x1b')];var _0xbe5180;if(_0x1e80ad>=_0x499759){_0x1e80ad=_0x499759;_0xbe5180=0xc8;}else{_0xbe5180=0xce;}_0x20f068[_0x99b9('0x17')](_0xbe5180);return _0x20f068[_0x99b9('0x1c')]('Content-Range',_0x527d35+'-'+_0x1e80ad+'/'+_0x499759)[_0x99b9('0x1d')](_0x411c47);}return null;};}function patchUpdates(_0x560714){return function(_0x224390){try{jsonpatch[_0x99b9('0x1e')](_0x224390,_0x560714,!![]);}catch(_0x5e23e9){return BPromise[_0x99b9('0x1f')](_0x5e23e9);}return _0x224390[_0x99b9('0x20')]();};}function saveUpdates(_0x30c8f7,_0x265a55){return function(_0x2b2398){if(_0x2b2398){return _0x2b2398['update'](_0x30c8f7)[_0x99b9('0x21')](function(_0x3474d5){return _0x3474d5;});}return null;};}function removeEntity(_0x31e57d,_0x3189ac){return function(_0x108ebe){if(_0x108ebe){return _0x108ebe[_0x99b9('0x22')]()[_0x99b9('0x21')](function(){_0x31e57d[_0x99b9('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a6b9b,_0x228834){return function(_0x2668f1){if(!_0x2668f1){_0x2a6b9b['sendStatus'](0x194);}return _0x2668f1;};}function handleError(_0x1e3076,_0x145fd4){_0x145fd4=_0x145fd4||0x1f4;return function(_0x186b6a){logger[_0x99b9('0x23')](_0x186b6a[_0x99b9('0x24')]);if(_0x186b6a['name']){delete _0x186b6a[_0x99b9('0x25')];}_0x1e3076['status'](_0x145fd4)[_0x99b9('0x26')](_0x186b6a);};}exports['index']=function(_0xe3482,_0x3fa10e){var _0x592906={},_0x3fefd1={},_0x584168={'count':0x0,'rows':[]};var _0x7f53a1=_[_0x99b9('0x27')](db['ServicenowAccount'][_0x99b9('0x28')],function(_0x2991c1){return{'name':_0x2991c1[_0x99b9('0x29')],'type':_0x2991c1[_0x99b9('0x2a')][_0x99b9('0x2b')]};});_0x3fefd1[_0x99b9('0x2c')]=_['map'](_0x7f53a1,_0x99b9('0x25'));_0x3fefd1[_0x99b9('0x2d')]=_[_0x99b9('0x2e')](_0xe3482['query']);_0x3fefd1[_0x99b9('0x2f')]=_[_0x99b9('0x30')](_0x3fefd1[_0x99b9('0x2c')],_0x3fefd1[_0x99b9('0x2d')]);_0x592906['attributes']=_[_0x99b9('0x30')](_0x3fefd1[_0x99b9('0x2c')],qs[_0x99b9('0x31')](_0xe3482[_0x99b9('0x2d')][_0x99b9('0x31')]));_0x592906[_0x99b9('0x32')]=_0x592906[_0x99b9('0x32')]['length']?_0x592906[_0x99b9('0x32')]:_0x3fefd1['model'];if(!_0xe3482['query'][_0x99b9('0x33')](_0x99b9('0x34'))){_0x592906[_0x99b9('0x1b')]=qs[_0x99b9('0x1b')](_0xe3482[_0x99b9('0x2d')]['limit']);_0x592906[_0x99b9('0x19')]=qs['offset'](_0xe3482[_0x99b9('0x2d')][_0x99b9('0x19')]);}_0x592906[_0x99b9('0x35')]=qs[_0x99b9('0x36')](_0xe3482[_0x99b9('0x2d')]['sort']);_0x592906[_0x99b9('0x37')]=qs['filters'](_['pick'](_0xe3482[_0x99b9('0x2d')],_0x3fefd1[_0x99b9('0x2f')]),_0x7f53a1);if(_0xe3482[_0x99b9('0x2d')]['filter']){_0x592906[_0x99b9('0x37')]=_[_0x99b9('0x38')](_0x592906[_0x99b9('0x37')],{'$or':_[_0x99b9('0x27')](_0x7f53a1,function(_0x262999){if(_0x262999['type']!==_0x99b9('0x39')){var _0x38ebd0={};_0x38ebd0[_0x262999[_0x99b9('0x25')]]={'$like':'%'+_0xe3482[_0x99b9('0x2d')][_0x99b9('0x3a')]+'%'};return _0x38ebd0;}})});}_0x592906=_[_0x99b9('0x38')]({},_0x592906,_0xe3482['options']);var _0xfaf183={'where':_0x592906[_0x99b9('0x37')]};return db[_0x99b9('0x3b')][_0x99b9('0x3c')](_0xfaf183)[_0x99b9('0x21')](function(_0x57912f){_0x584168[_0x99b9('0x3c')]=_0x57912f;if(_0xe3482['query']['includeAll']){_0x592906['include']=[{'all':!![]}];}return db[_0x99b9('0x3b')][_0x99b9('0x3d')](_0x592906);})[_0x99b9('0x21')](function(_0x489b64){_0x584168[_0x99b9('0x3e')]=_0x489b64;return _0x584168;})['then'](respondWithFilteredResult(_0x3fa10e,_0x592906))[_0x99b9('0x3f')](handleError(_0x3fa10e,null));};exports[_0x99b9('0x40')]=function(_0x44ff46,_0x3a5632){var _0x35911f={'raw':![],'where':{'id':_0x44ff46[_0x99b9('0x41')]['id']}},_0x40b079={};_0x40b079[_0x99b9('0x2c')]=_[_0x99b9('0x2e')](db[_0x99b9('0x3b')][_0x99b9('0x28')]);_0x40b079[_0x99b9('0x2d')]=_[_0x99b9('0x2e')](_0x44ff46['query']);_0x40b079[_0x99b9('0x2f')]=_[_0x99b9('0x30')](_0x40b079[_0x99b9('0x2c')],_0x40b079[_0x99b9('0x2d')]);_0x35911f[_0x99b9('0x32')]=_[_0x99b9('0x30')](_0x40b079[_0x99b9('0x2c')],qs[_0x99b9('0x31')](_0x44ff46[_0x99b9('0x2d')][_0x99b9('0x31')]));_0x35911f[_0x99b9('0x32')]=_0x35911f[_0x99b9('0x32')]['length']?_0x35911f[_0x99b9('0x32')]:_0x40b079[_0x99b9('0x2c')];if(_0x44ff46['query'][_0x99b9('0x42')]){_0x35911f['include']=[{'all':!![]}];}_0x35911f=_['merge']({},_0x35911f,_0x44ff46[_0x99b9('0x43')]);return db[_0x99b9('0x3b')][_0x99b9('0x44')](_0x35911f)[_0x99b9('0x21')](handleEntityNotFound(_0x3a5632,null))[_0x99b9('0x21')](respondWithResult(_0x3a5632,null))[_0x99b9('0x3f')](handleError(_0x3a5632,null));};exports[_0x99b9('0x45')]=function(_0x1f92dd,_0x4b3c77){return db[_0x99b9('0x3b')]['create'](_0x1f92dd[_0x99b9('0x46')],{})['then'](respondWithResult(_0x4b3c77,0xc9))[_0x99b9('0x3f')](handleError(_0x4b3c77,null));};exports[_0x99b9('0x47')]=function(_0x2daf5f,_0x26e88d){if(_0x2daf5f['body']['id']){delete _0x2daf5f['body']['id'];}return db[_0x99b9('0x3b')][_0x99b9('0x44')]({'where':{'id':_0x2daf5f[_0x99b9('0x41')]['id']}})[_0x99b9('0x21')](handleEntityNotFound(_0x26e88d,null))[_0x99b9('0x21')](saveUpdates(_0x2daf5f[_0x99b9('0x46')],null))['then'](respondWithResult(_0x26e88d,null))[_0x99b9('0x3f')](handleError(_0x26e88d,null));};exports[_0x99b9('0x22')]=function(_0x1ed855,_0x3d1b89){return db[_0x99b9('0x3b')][_0x99b9('0x44')]({'where':{'id':_0x1ed855[_0x99b9('0x41')]['id']}})['then'](handleEntityNotFound(_0x3d1b89,null))[_0x99b9('0x21')](removeEntity(_0x3d1b89,null))[_0x99b9('0x3f')](handleError(_0x3d1b89,null));};exports[_0x99b9('0x48')]=function(_0x144d56,_0x5db915,_0x482aa6){var _0x492e8e={};var _0x46e470={};var _0x3d35a9;var _0x3ef76a;return db[_0x99b9('0x3b')]['findOne']({'where':{'id':_0x144d56['params']['id']}})[_0x99b9('0x21')](handleEntityNotFound(_0x5db915,null))[_0x99b9('0x21')](function(_0x157f12){if(_0x157f12){_0x3d35a9=_0x157f12;_0x46e470[_0x99b9('0x2c')]=_['keys'](db['ServicenowConfiguration']['rawAttributes']);_0x46e470['query']=_[_0x99b9('0x2e')](_0x144d56[_0x99b9('0x2d')]);_0x46e470[_0x99b9('0x2f')]=_[_0x99b9('0x30')](_0x46e470[_0x99b9('0x2c')],_0x46e470['query']);_0x492e8e[_0x99b9('0x32')]=_[_0x99b9('0x30')](_0x46e470[_0x99b9('0x2c')],qs[_0x99b9('0x31')](_0x144d56[_0x99b9('0x2d')][_0x99b9('0x31')]));_0x492e8e['attributes']=_0x492e8e['attributes'][_0x99b9('0x49')]?_0x492e8e[_0x99b9('0x32')]:_0x46e470['model'];_0x492e8e[_0x99b9('0x35')]=qs[_0x99b9('0x36')](_0x144d56[_0x99b9('0x2d')]['sort']);_0x492e8e[_0x99b9('0x37')]=qs[_0x99b9('0x2f')](_['pick'](_0x144d56['query'],_0x46e470[_0x99b9('0x2f')]));if(_0x144d56[_0x99b9('0x2d')]['filter']){_0x492e8e[_0x99b9('0x37')]=_[_0x99b9('0x38')](_0x492e8e[_0x99b9('0x37')],{'$or':_[_0x99b9('0x27')](_0x492e8e[_0x99b9('0x32')],function(_0x33e6c6){var _0x36bf06={};_0x36bf06[_0x33e6c6]={'$like':'%'+_0x144d56[_0x99b9('0x2d')]['filter']+'%'};return _0x36bf06;})});}_0x492e8e=_['merge']({},_0x492e8e,_0x144d56[_0x99b9('0x43')]);return _0x3d35a9[_0x99b9('0x48')](_0x492e8e);}})[_0x99b9('0x21')](function(_0x557dc2){if(_0x557dc2){_0x3ef76a=_0x557dc2[_0x99b9('0x49')];if(!_0x144d56[_0x99b9('0x2d')][_0x99b9('0x33')](_0x99b9('0x34'))){_0x492e8e[_0x99b9('0x1b')]=qs[_0x99b9('0x1b')](_0x144d56['query'][_0x99b9('0x1b')]);_0x492e8e[_0x99b9('0x19')]=qs[_0x99b9('0x19')](_0x144d56[_0x99b9('0x2d')][_0x99b9('0x19')]);}return _0x3d35a9[_0x99b9('0x48')](_0x492e8e);}})[_0x99b9('0x21')](function(_0x36f88c){if(_0x36f88c){return _0x36f88c?{'count':_0x3ef76a,'rows':_0x36f88c}:null;}})['then'](respondWithResult(_0x5db915,null))[_0x99b9('0x3f')](handleError(_0x5db915,null));};exports[_0x99b9('0x4a')]=function(_0x43e6db,_0xd492de,_0x1862c1){if(_0x43e6db[_0x99b9('0x46')]['id']){delete _0x43e6db[_0x99b9('0x46')]['id'];}return db[_0x99b9('0x3b')][_0x99b9('0x4b')]({'where':{'id':_0x43e6db[_0x99b9('0x41')]['id']}})[_0x99b9('0x21')](handleEntityNotFound(_0xd492de,null))['then'](function(_0x7a925d){if(_0x7a925d){_0x43e6db[_0x99b9('0x46')]['AccountId']=_0x7a925d['id'];_0x43e6db['body'][_0x99b9('0x4c')]=integrations[_0x99b9('0x4d')](_0x43e6db[_0x99b9('0x46')]['channel'],_0x43e6db['body'][_0x99b9('0x2a')]);_0x43e6db[_0x99b9('0x46')][_0x99b9('0x4e')]=integrations[_0x99b9('0x4f')](_0x43e6db[_0x99b9('0x46')][_0x99b9('0x50')],_0x43e6db[_0x99b9('0x46')][_0x99b9('0x2a')]);return db['ServicenowConfiguration'][_0x99b9('0x45')](_0x43e6db['body'],{'include':[{'model':db['ServicenowField'],'as':_0x99b9('0x4c')},{'model':db[_0x99b9('0x51')],'as':_0x99b9('0x4e')}]});}return null;})['then'](respondWithResult(_0xd492de,null))['catch'](handleError(_0xd492de,null));};exports[_0x99b9('0x52')]=function(_0x1c562c,_0x1caf30,_0x2ad132){var _0x521720=['made_sla','hold_reason',_0x99b9('0x53'),_0x99b9('0x54'),_0x99b9('0x55'),_0x99b9('0x56'),_0x99b9('0x57'),'severity',_0x99b9('0x58')];var _0x190bc0=[_0x99b9('0x59'),_0x99b9('0x5a'),_0x99b9('0x5b'),'watch_list',_0x99b9('0x5c'),_0x99b9('0x5d'),_0x99b9('0x5e'),_0x99b9('0x5f'),'approval_history',_0x99b9('0x60'),_0x99b9('0x61'),'sys_updated_by','opened_by',_0x99b9('0x62'),'sys_created_on',_0x99b9('0x63'),'state','sys_created_by',_0x99b9('0x53'),_0x99b9('0x35'),_0x99b9('0x64'),_0x99b9('0x65'),'cmdb_ci',_0x99b9('0x66'),_0x99b9('0x67'),_0x99b9('0x68'),_0x99b9('0x69'),'business_service',_0x99b9('0x6a'),_0x99b9('0x6b'),_0x99b9('0x6c'),'time_worked','expected_start',_0x99b9('0x6d'),_0x99b9('0x6e'),_0x99b9('0x6f'),_0x99b9('0x70'),'reopened_time',_0x99b9('0x71'),_0x99b9('0x72'),_0x99b9('0x73'),_0x99b9('0x54'),_0x99b9('0x74'),_0x99b9('0x75'),'close_code',_0x99b9('0x76'),_0x99b9('0x77'),_0x99b9('0x78'),_0x99b9('0x79'),_0x99b9('0x7a'),'additional_assignee_list','description','calendar_duration',_0x99b9('0x56'),_0x99b9('0x7b'),'close_notes',_0x99b9('0x7c'),_0x99b9('0x7d'),_0x99b9('0x7e'),_0x99b9('0x7f'),'contact_type',_0x99b9('0x80'),_0x99b9('0x57'),_0x99b9('0x81'),'problem_id',_0x99b9('0x82'),'reassignment_count',_0x99b9('0x83'),_0x99b9('0x84'),'severity',_0x99b9('0x85'),'sla_due','approval',_0x99b9('0x86'),_0x99b9('0x87'),_0x99b9('0x88'),_0x99b9('0x89'),_0x99b9('0x8a'),_0x99b9('0x8b'),_0x99b9('0x8c'),_0x99b9('0x8d'),'location',_0x99b9('0x58')];var _0x86effa='';var _0x38fcd0='';var _0x1fb224=[];var _0x18972e='';var _0x326c58='';var _0x2a1c35=[];var _0x3dd515='';var _0x4bd539='';var _0x4552e2={};var _0x4daa0e='';return db[_0x99b9('0x3b')][_0x99b9('0x4b')]({'where':{'id':_0x1c562c[_0x99b9('0x41')]['id']},'attributes':['id',_0x99b9('0x8e'),'password',_0x99b9('0x8f'),_0x99b9('0x90'),'serverUrl']})[_0x99b9('0x21')](handleEntityNotFound(_0x1caf30,null))['then'](function(_0x460862){if(_0x460862){_0x4daa0e=_0x460862[_0x99b9('0x90')];var _0x5569a7=_0x4daa0e['slice'](-0x1);if(_0x5569a7==='/'){_0x4daa0e=_0x4daa0e[_0x99b9('0x91')](0x0,_0x4daa0e['lastIndexOf'](_0x5569a7));}_0x4bd539=util['format']('%s/api/now/doc/table/schema/',_0x4daa0e);_0x3dd515=util[_0x99b9('0x92')](_0x99b9('0x93'),_0x4daa0e);_0x4552e2={'user':_0x460862[_0x99b9('0x8e')],'pass':_0x460862[_0x99b9('0x94')]};var _0x279d55={'method':'GET','uri':_0x4bd539+_0x99b9('0x95'),'auth':_0x4552e2,'json':!![]};return rp(_0x279d55);}})[_0x99b9('0x21')](function(_0x462501){if(_0x462501[_0x99b9('0x96')][_0x99b9('0x49')]>0x0){_0x86effa=_0x462501['result'];}console[_0x99b9('0x97')](_0x99b9('0x98'),_0x86effa);_0x2a1c35=[];_0x38fcd0=Object[_0x99b9('0x99')]([],_0x86effa);_[_0x99b9('0x9a')](_0x38fcd0,function(_0xcadae){return!_0x521720[_0x99b9('0x9b')](_0xcadae['name']);});_0x38fcd0[_0x99b9('0x9c')](function(_0x3e2a62){var _0x406b03=createFieldObject(_0x3dd515,_0x4552e2,_0x3e2a62[_0x99b9('0x9d')],_0x3e2a62[_0x99b9('0x25')],_0x3e2a62[_0x99b9('0x9e')],![]);_0x2a1c35['push'](_0x406b03);});return Promise[_0x99b9('0x9f')](_0x2a1c35);})['then'](function(_0x3207e2){_0x1fb224=_0x3207e2;_0x18972e=Object[_0x99b9('0x99')]([],_0x86effa);console[_0x99b9('0x97')](_0x99b9('0xa0'),_0x86effa);_[_0x99b9('0x9a')](_0x18972e,function(_0x527f67){return _0x190bc0[_0x99b9('0x9b')](_0x527f67[_0x99b9('0x25')]);});console[_0x99b9('0x97')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x18972e);_0x2a1c35=[];_0x18972e[_0x99b9('0x9c')](function(_0xea8e9b){var _0x16d53d=createFieldObject(_0x3dd515,_0x4552e2,_0xea8e9b[_0x99b9('0x9d')],_0xea8e9b[_0x99b9('0x25')],_0xea8e9b[_0x99b9('0x9e')],!![]);_0x2a1c35[_0x99b9('0xa1')](_0x16d53d);});return Promise[_0x99b9('0x9f')](_0x2a1c35);})[_0x99b9('0x21')](function(_0x5e2269){_0x326c58=_0x5e2269;var _0x1b67cd=_0x1fb224['concat'](_0x326c58);return{'count':_0x1b67cd[_0x99b9('0x49')],'rows':_0x1b67cd};})['then'](respondWithResult(_0x1caf30,null))[_0x99b9('0x3f')](function(_0x247a68){console[_0x99b9('0x97')](_0x99b9('0xa2')+_0x247a68);var _0x408f4b=_0x1c562c['query'][_0x99b9('0xa3')]?0x1f4:_0x247a68['statusCode']||0x1f4;logger[_0x99b9('0x23')](_0x247a68['stack']);delete _0x247a68[_0x99b9('0x25')];if(_0x408f4b===0x191){_0x408f4b=0x190;}_0x1caf30[_0x99b9('0x17')](_0x408f4b)[_0x99b9('0x26')](_0x1c562c[_0x99b9('0x2d')][_0x99b9('0xa3')]?{'message':'Wrong\x20credentials','statusCode':_0x247a68[_0x99b9('0xa4')]}:_0x247a68);});};function createFieldObject(_0x5650e3,_0x25cfe3,_0x4206ca,_0x5c1690,_0x29e9e2,_0x5bbdd3){return new Promise(function(_0x42b032,_0x579191){var _0x52d447={'id':_0x5c1690,'name':_0x29e9e2,'custom':_0x5bbdd3};if(_0x4206ca===_0x99b9('0xa5')){_0x52d447[_0x99b9('0x43')]=[{'name':_0x99b9('0xa6'),'value':_0x99b9('0xa7')},{'name':_0x99b9('0xa8'),'value':_0x99b9('0xa9')}];_0x42b032(_0x52d447);}else{var _0x5bdd01={'method':_0x99b9('0xaa'),'uri':_0x5650e3+_0x99b9('0xab')+_0x5c1690,'auth':_0x25cfe3,'json':!![]};return rp(_0x5bdd01)['then'](function(_0x4e2652){var _0x5b029d=[];if(_0x4e2652[_0x99b9('0x96')][_0x99b9('0x49')]>0x0){_0x4e2652[_0x99b9('0x96')][_0x99b9('0x9c')](function(_0x2df8c9){if(_0x2df8c9[_0x99b9('0xac')]==='false'){var _0x88c4c4={'name':_0x2df8c9[_0x99b9('0x9e')],'value':_0x2df8c9['value']};_0x5b029d[_0x99b9('0xa1')](_0x88c4c4);}});}_0x52d447[_0x99b9('0x43')]=_0x5b029d;if(_0x52d447[_0x99b9('0x43')]['length']>0x0){_0x42b032(_0x52d447);}else{if(_0x5bbdd3==![]){_0x42b032();}else{_0x42b032(_0x52d447);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 2a19bb3..08f5d06 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 _0xbd51=['./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger','api','moment','bluebird'];(function(_0x36a4c3,_0x5201f4){var _0x303f09=function(_0x42a768){while(--_0x42a768){_0x36a4c3['push'](_0x36a4c3['shift']());}};_0x303f09(++_0x5201f4);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x527d3f,_0x579f6d){_0x527d3f=_0x527d3f-0x0;var _0x1ff256=_0xbd51[_0x527d3f];return _0x1ff256;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var logger=require(_0x1bd5('0x1'))(_0x1bd5('0x2'));var moment=require(_0x1bd5('0x3'));var BPromise=require(_0x1bd5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1bd5('0x5'));var integrations=require(_0x1bd5('0x6'));module[_0x1bd5('0x7')]=function(_0x59ddfb,_0x29abea){return _0x59ddfb[_0x1bd5('0x8')](_0x1bd5('0x9'),attributes,{'tableName':_0x1bd5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2ca=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util'];(function(_0x10df18,_0x13338c){var _0x1f9a1d=function(_0x3157f4){while(--_0x3157f4){_0x10df18['push'](_0x10df18['shift']());}};_0x1f9a1d(++_0x13338c);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x425b19,_0x2dcf14){_0x425b19=_0x425b19-0x0;var _0x15ecab=_0xf2ca[_0x425b19];return _0x15ecab;};'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 diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 5f3c84f..7557e8d 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 _0x3cf4=['catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','GetServicenowAccount','findAll','options','raw','attributes','limit','include','map','model','ShowServicenowAccount','ServicenowAccount','find','where'];(function(_0x25e6d0,_0x3691f6){var _0x1d5d71=function(_0xa35290){while(--_0xa35290){_0x25e6d0['push'](_0x25e6d0['shift']());}};_0x1d5d71(++_0x3691f6);}(_0x3cf4,0x1bb));var _0x43cf=function(_0x35abc8,_0x1264f9){_0x35abc8=_0x35abc8-0x0;var _0x3b7dea=_0x3cf4[_0x35abc8];return _0x3b7dea;};'use strict';var _=require('lodash');var util=require(_0x43cf('0x0'));var moment=require(_0x43cf('0x1'));var BPromise=require(_0x43cf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x43cf('0x3'));var db=require(_0x43cf('0x4'))['db'];var utils=require(_0x43cf('0x5'));var logger=require('../../config/logger')(_0x43cf('0x6'));var config=require('../../config/environment');var jayson=require(_0x43cf('0x7'));var client=jayson[_0x43cf('0x8')][_0x43cf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d0a22,_0x3a05e6,_0x17055a){return new BPromise(function(_0xa1a955,_0x1978ac){return client[_0x43cf('0xa')](_0x5d0a22,_0x17055a)[_0x43cf('0xb')](function(_0x555e30){logger['info'](_0x43cf('0xc'),_0x3a05e6,_0x43cf('0xd'));logger[_0x43cf('0xe')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x3a05e6,_0x43cf('0xd'),JSON[_0x43cf('0xf')](_0x555e30));if(_0x555e30[_0x43cf('0x10')]){if(_0x555e30[_0x43cf('0x10')]['code']===0x1f4){logger[_0x43cf('0x10')](_0x43cf('0xc'),_0x3a05e6,_0x555e30[_0x43cf('0x10')][_0x43cf('0x11')]);return _0x1978ac(_0x555e30[_0x43cf('0x10')][_0x43cf('0x11')]);}logger['error'](_0x43cf('0xc'),_0x3a05e6,_0x555e30[_0x43cf('0x10')][_0x43cf('0x11')]);return _0xa1a955(_0x555e30[_0x43cf('0x10')][_0x43cf('0x11')]);}else{logger[_0x43cf('0x12')](_0x43cf('0xc'),_0x3a05e6,_0x43cf('0xd'));_0xa1a955(_0x555e30[_0x43cf('0x13')][_0x43cf('0x11')]);}})['catch'](function(_0x2cefab){logger[_0x43cf('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x3a05e6,_0x2cefab);_0x1978ac(_0x2cefab);});});}exports[_0x43cf('0x14')]=function(_0x5462bf){var _0x69e0b9=this;return new Promise(function(_0x116203,_0x387a9c){return db['ServicenowAccount'][_0x43cf('0x15')]({'raw':_0x5462bf[_0x43cf('0x16')]?_0x5462bf[_0x43cf('0x16')][_0x43cf('0x17')]===undefined?!![]:![]:!![],'where':_0x5462bf[_0x43cf('0x16')]?_0x5462bf[_0x43cf('0x16')]['where']||null:null,'attributes':_0x5462bf['options']?_0x5462bf[_0x43cf('0x16')][_0x43cf('0x18')]||null:null,'limit':_0x5462bf[_0x43cf('0x16')]?_0x5462bf['options'][_0x43cf('0x19')]||null:null,'include':_0x5462bf[_0x43cf('0x16')]?_0x5462bf['options'][_0x43cf('0x1a')]?_['map'](_0x5462bf[_0x43cf('0x16')]['include'],function(_0x155087){return{'model':db[_0x155087['model']],'as':_0x155087['as'],'attributes':_0x155087[_0x43cf('0x18')],'include':_0x155087[_0x43cf('0x1a')]?_[_0x43cf('0x1b')](_0x155087[_0x43cf('0x1a')],function(_0x6562e8){return{'model':db[_0x6562e8[_0x43cf('0x1c')]],'as':_0x6562e8['as'],'attributes':_0x6562e8[_0x43cf('0x18')],'include':_0x6562e8[_0x43cf('0x1a')]?_[_0x43cf('0x1b')](_0x6562e8['include'],function(_0x784379){return{'model':db[_0x784379[_0x43cf('0x1c')]],'as':_0x784379['as'],'attributes':_0x784379['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x58bdfc){logger['info']('GetServicenowAccount',_0x5462bf);logger['debug'](_0x43cf('0x14'),_0x5462bf,JSON[_0x43cf('0xf')](_0x58bdfc));_0x116203(_0x58bdfc);})['catch'](function(_0xa4c9ac){logger[_0x43cf('0x10')]('GetServicenowAccount',_0xa4c9ac[_0x43cf('0x11')],_0x5462bf);_0x387a9c(_0x69e0b9[_0x43cf('0x10')](0x1f4,_0xa4c9ac[_0x43cf('0x11')]));});});};exports[_0x43cf('0x1d')]=function(_0x295882){var _0x33f5f7=this;return new Promise(function(_0x598efd,_0x539dd5){return db[_0x43cf('0x1e')][_0x43cf('0x1f')]({'raw':_0x295882[_0x43cf('0x16')]?_0x295882[_0x43cf('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x295882[_0x43cf('0x16')]?_0x295882[_0x43cf('0x16')][_0x43cf('0x20')]||null:null,'attributes':_0x295882[_0x43cf('0x16')]?_0x295882[_0x43cf('0x16')][_0x43cf('0x18')]||null:null,'include':_0x295882[_0x43cf('0x16')]?_0x295882[_0x43cf('0x16')]['include']?_[_0x43cf('0x1b')](_0x295882[_0x43cf('0x16')]['include'],function(_0x3a8b23){return{'model':db[_0x3a8b23[_0x43cf('0x1c')]],'as':_0x3a8b23['as'],'attributes':_0x3a8b23['attributes'],'include':_0x3a8b23[_0x43cf('0x1a')]?_['map'](_0x3a8b23['include'],function(_0x24adcb){return{'model':db[_0x24adcb['model']],'as':_0x24adcb['as'],'attributes':_0x24adcb['attributes'],'include':_0x24adcb['include']?_[_0x43cf('0x1b')](_0x24adcb['include'],function(_0x314f98){return{'model':db[_0x314f98['model']],'as':_0x314f98['as'],'attributes':_0x314f98['attributes']};}):[]};}):[]};}):[]:[]})[_0x43cf('0xb')](function(_0x211932){logger['info'](_0x43cf('0x1d'),_0x295882);logger[_0x43cf('0xe')](_0x43cf('0x1d'),_0x295882,JSON[_0x43cf('0xf')](_0x211932));_0x598efd(_0x211932);})[_0x43cf('0x21')](function(_0x56b3bc){logger[_0x43cf('0x10')](_0x43cf('0x1d'),_0x56b3bc[_0x43cf('0x11')],_0x295882);_0x539dd5(_0x33f5f7[_0x43cf('0x10')](0x1f4,_0x56b3bc[_0x43cf('0x11')]));});});}; \ No newline at end of file +var _0x1565=['attributes','map','include','model','stringify','ServicenowAccount','find','raw','ShowServicenowAccount','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','ServicenowAccount,\x20%s,\x20%s','result','catch','GetServicenowAccount','findAll','options','where'];(function(_0x5a6644,_0x45d612){var _0x3a2a5d=function(_0x54159e){while(--_0x54159e){_0x5a6644['push'](_0x5a6644['shift']());}};_0x3a2a5d(++_0x45d612);}(_0x1565,0x131));var _0x5156=function(_0x4e3879,_0x1c35aa){_0x4e3879=_0x4e3879-0x0;var _0x40a93c=_0x1565[_0x4e3879];return _0x40a93c;};'use strict';var _=require(_0x5156('0x0'));var util=require(_0x5156('0x1'));var moment=require('moment');var BPromise=require(_0x5156('0x2'));var rs=require(_0x5156('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5156('0x4'))['db'];var utils=require(_0x5156('0x5'));var logger=require(_0x5156('0x6'))(_0x5156('0x7'));var config=require(_0x5156('0x8'));var jayson=require(_0x5156('0x9'));var client=jayson[_0x5156('0xa')][_0x5156('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4afdb7,_0x5ce83a,_0x5145ec){return new BPromise(function(_0x36de5d,_0x2b85f5){return client[_0x5156('0xc')](_0x4afdb7,_0x5145ec)[_0x5156('0xd')](function(_0x567d93){logger[_0x5156('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x5ce83a,_0x5156('0xf'));logger[_0x5156('0x10')](_0x5156('0x11'),_0x5ce83a,_0x5156('0xf'),JSON['stringify'](_0x567d93));if(_0x567d93[_0x5156('0x12')]){if(_0x567d93[_0x5156('0x12')][_0x5156('0x13')]===0x1f4){logger[_0x5156('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x5ce83a,_0x567d93[_0x5156('0x12')][_0x5156('0x14')]);return _0x2b85f5(_0x567d93[_0x5156('0x12')]['message']);}logger[_0x5156('0x12')](_0x5156('0x15'),_0x5ce83a,_0x567d93['error'][_0x5156('0x14')]);return _0x36de5d(_0x567d93[_0x5156('0x12')][_0x5156('0x14')]);}else{logger['info'](_0x5156('0x15'),_0x5ce83a,_0x5156('0xf'));_0x36de5d(_0x567d93[_0x5156('0x16')][_0x5156('0x14')]);}})[_0x5156('0x17')](function(_0x56a6c2){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x5ce83a,_0x56a6c2);_0x2b85f5(_0x56a6c2);});});}exports[_0x5156('0x18')]=function(_0x3e6f7b){var _0xbf9b09=this;return new Promise(function(_0x13584e,_0x3c9955){return db['ServicenowAccount'][_0x5156('0x19')]({'raw':_0x3e6f7b['options']?_0x3e6f7b['options']['raw']===undefined?!![]:![]:!![],'where':_0x3e6f7b[_0x5156('0x1a')]?_0x3e6f7b[_0x5156('0x1a')][_0x5156('0x1b')]||null:null,'attributes':_0x3e6f7b[_0x5156('0x1a')]?_0x3e6f7b[_0x5156('0x1a')][_0x5156('0x1c')]||null:null,'limit':_0x3e6f7b[_0x5156('0x1a')]?_0x3e6f7b['options']['limit']||null:null,'include':_0x3e6f7b[_0x5156('0x1a')]?_0x3e6f7b[_0x5156('0x1a')]['include']?_['map'](_0x3e6f7b[_0x5156('0x1a')]['include'],function(_0x888c7e){return{'model':db[_0x888c7e['model']],'as':_0x888c7e['as'],'attributes':_0x888c7e[_0x5156('0x1c')],'include':_0x888c7e['include']?_[_0x5156('0x1d')](_0x888c7e[_0x5156('0x1e')],function(_0x38ccc8){return{'model':db[_0x38ccc8[_0x5156('0x1f')]],'as':_0x38ccc8['as'],'attributes':_0x38ccc8[_0x5156('0x1c')],'include':_0x38ccc8[_0x5156('0x1e')]?_[_0x5156('0x1d')](_0x38ccc8['include'],function(_0x39837b){return{'model':db[_0x39837b[_0x5156('0x1f')]],'as':_0x39837b['as'],'attributes':_0x39837b['attributes']};}):[]};}):[]};}):[]:[]})[_0x5156('0xd')](function(_0x385de7){logger['info']('GetServicenowAccount',_0x3e6f7b);logger[_0x5156('0x10')](_0x5156('0x18'),_0x3e6f7b,JSON[_0x5156('0x20')](_0x385de7));_0x13584e(_0x385de7);})[_0x5156('0x17')](function(_0x41c0d5){logger['error']('GetServicenowAccount',_0x41c0d5['message'],_0x3e6f7b);_0x3c9955(_0xbf9b09[_0x5156('0x12')](0x1f4,_0x41c0d5['message']));});});};exports['ShowServicenowAccount']=function(_0x2611c5){var _0x27c4e7=this;return new Promise(function(_0xd7ca99,_0x103e70){return db[_0x5156('0x21')][_0x5156('0x22')]({'raw':_0x2611c5[_0x5156('0x1a')]?_0x2611c5['options'][_0x5156('0x23')]===undefined?!![]:![]:!![],'where':_0x2611c5['options']?_0x2611c5['options'][_0x5156('0x1b')]||null:null,'attributes':_0x2611c5[_0x5156('0x1a')]?_0x2611c5[_0x5156('0x1a')][_0x5156('0x1c')]||null:null,'include':_0x2611c5[_0x5156('0x1a')]?_0x2611c5[_0x5156('0x1a')][_0x5156('0x1e')]?_[_0x5156('0x1d')](_0x2611c5[_0x5156('0x1a')][_0x5156('0x1e')],function(_0x21cde2){return{'model':db[_0x21cde2[_0x5156('0x1f')]],'as':_0x21cde2['as'],'attributes':_0x21cde2[_0x5156('0x1c')],'include':_0x21cde2['include']?_[_0x5156('0x1d')](_0x21cde2['include'],function(_0x57b190){return{'model':db[_0x57b190[_0x5156('0x1f')]],'as':_0x57b190['as'],'attributes':_0x57b190[_0x5156('0x1c')],'include':_0x57b190[_0x5156('0x1e')]?_[_0x5156('0x1d')](_0x57b190['include'],function(_0x4e6f8e){return{'model':db[_0x4e6f8e[_0x5156('0x1f')]],'as':_0x4e6f8e['as'],'attributes':_0x4e6f8e[_0x5156('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5156('0xd')](function(_0x58c286){logger[_0x5156('0xe')](_0x5156('0x24'),_0x2611c5);logger[_0x5156('0x10')](_0x5156('0x24'),_0x2611c5,JSON[_0x5156('0x20')](_0x58c286));_0xd7ca99(_0x58c286);})[_0x5156('0x17')](function(_0x5cf8d8){logger[_0x5156('0x12')](_0x5156('0x24'),_0x5cf8d8[_0x5156('0x14')],_0x2611c5);_0x103e70(_0x27c4e7['error'](0x1f4,_0x5cf8d8['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 2c6c4d1..71961a6 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 _0xad62=['/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','index','get','/:id','show'];(function(_0x128ea5,_0x2b5300){var _0x2ae836=function(_0x542fd2){while(--_0x542fd2){_0x128ea5['push'](_0x128ea5['shift']());}};_0x2ae836(++_0x2b5300);}(_0xad62,0x1bb));var _0x2ad6=function(_0x3b0515,_0x1fa41d){_0x3b0515=_0x3b0515-0x0;var _0x198d7a=_0xad62[_0x3b0515];return _0x198d7a;};'use strict';var multer=require(_0x2ad6('0x0'));var util=require(_0x2ad6('0x1'));var path=require(_0x2ad6('0x2'));var timeout=require(_0x2ad6('0x3'));var express=require(_0x2ad6('0x4'));var router=express[_0x2ad6('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2ad6('0x6'));var config=require(_0x2ad6('0x7'));var controller=require(_0x2ad6('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x2ad6('0x9')]);router[_0x2ad6('0xa')](_0x2ad6('0xb'),auth['isAuthenticated'](),controller[_0x2ad6('0xc')]);router['get'](_0x2ad6('0xd'),auth[_0x2ad6('0xe')](),controller[_0x2ad6('0xf')]);router[_0x2ad6('0xa')](_0x2ad6('0x10'),auth[_0x2ad6('0xe')](),controller[_0x2ad6('0x11')]);router[_0x2ad6('0xa')](_0x2ad6('0x12'),auth['isAuthenticated'](),controller[_0x2ad6('0x13')]);router[_0x2ad6('0x14')]('/',auth[_0x2ad6('0xe')](),controller['create']);router['put']('/:id',auth[_0x2ad6('0xe')](),controller[_0x2ad6('0x15')]);router['delete'](_0x2ad6('0xb'),auth[_0x2ad6('0xe')](),controller[_0x2ad6('0x16')]);module[_0x2ad6('0x17')]=router; \ No newline at end of file +var _0x1a78=['isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','get','index','/:id'];(function(_0x456080,_0x5cdc22){var _0x2bd741=function(_0x30fab4){while(--_0x30fab4){_0x456080['push'](_0x456080['shift']());}};_0x2bd741(++_0x5cdc22);}(_0x1a78,0x173));var _0x81a7=function(_0x364528,_0x1baf18){_0x364528=_0x364528-0x0;var _0x2610b6=_0x1a78[_0x364528];return _0x2610b6;};'use strict';var multer=require(_0x81a7('0x0'));var util=require(_0x81a7('0x1'));var path=require(_0x81a7('0x2'));var timeout=require(_0x81a7('0x3'));var express=require(_0x81a7('0x4'));var router=express['Router']();var fs_extra=require(_0x81a7('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intServicenowConfiguration.controller');router[_0x81a7('0x6')]('/',auth['isAuthenticated'](),controller[_0x81a7('0x7')]);router[_0x81a7('0x6')](_0x81a7('0x8'),auth[_0x81a7('0x9')](),controller[_0x81a7('0xa')]);router[_0x81a7('0x6')](_0x81a7('0xb'),auth['isAuthenticated'](),controller[_0x81a7('0xc')]);router['get'](_0x81a7('0xd'),auth[_0x81a7('0x9')](),controller[_0x81a7('0xe')]);router['get'](_0x81a7('0xf'),auth[_0x81a7('0x9')](),controller['getDescriptions']);router[_0x81a7('0x10')]('/',auth[_0x81a7('0x9')](),controller['create']);router['put'](_0x81a7('0x8'),auth[_0x81a7('0x9')](),controller['update']);router[_0x81a7('0x11')](_0x81a7('0x8'),auth[_0x81a7('0x9')](),controller[_0x81a7('0x12')]);module[_0x81a7('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 44a9129..ed1d22e 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 _0xd3dd=['STRING','sequelize'];(function(_0x55c017,_0x1fdf05){var _0x353e15=function(_0x34ddcb){while(--_0x34ddcb){_0x55c017['push'](_0x55c017['shift']());}};_0x353e15(++_0x1fdf05);}(_0xd3dd,0x1b5));var _0xdd3d=function(_0x6fc166,_0x2ebee7){_0x6fc166=_0x6fc166-0x0;var _0x164b6d=_0xd3dd[_0x6fc166];return _0x164b6d;};'use strict';var Sequelize=require(_0xdd3d('0x0'));module['exports']={'name':{'type':Sequelize[_0xdd3d('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2eb0=['STRING','sequelize','exports'];(function(_0x4a705a,_0x13c990){var _0x37e5bd=function(_0x90517f){while(--_0x90517f){_0x4a705a['push'](_0x4a705a['shift']());}};_0x37e5bd(++_0x13c990);}(_0x2eb0,0x9d));var _0x02eb=function(_0x31eaa5,_0x2c2350){_0x31eaa5=_0x31eaa5-0x0;var _0x2ca012=_0x2eb0[_0x31eaa5];return _0x2ca012;};'use strict';var Sequelize=require(_0x02eb('0x0'));module[_0x02eb('0x1')]={'name':{'type':Sequelize[_0x02eb('0x2')]},'description':{'type':Sequelize[_0x02eb('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 7ede038..63a9a2d 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 _0x377d=['then','error','stack','name','send','map','ServicenowConfiguration','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','include','rows','catch','show','params','create','body','update','find','destroy','getFields','findOne','ServicenowField','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save'];(function(_0x5e2a1e,_0x2664f6){var _0x581d02=function(_0x2a07b6){while(--_0x2a07b6){_0x5e2a1e['push'](_0x5e2a1e['shift']());}};_0x581d02(++_0x2664f6);}(_0x377d,0xcb));var _0xd377=function(_0x3e5921,_0x5b2157){_0x3e5921=_0x3e5921-0x0;var _0x511def=_0x377d[_0x3e5921];return _0x511def;};'use strict';var emlformat=require(_0xd377('0x0'));var rimraf=require(_0xd377('0x1'));var zipdir=require(_0xd377('0x2'));var jsonpatch=require(_0xd377('0x3'));var rp=require(_0xd377('0x4'));var moment=require(_0xd377('0x5'));var BPromise=require(_0xd377('0x6'));var Mustache=require(_0xd377('0x7'));var util=require(_0xd377('0x8'));var path=require('path');var sox=require(_0xd377('0x9'));var csv=require(_0xd377('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd377('0xb'));var _=require('lodash');var squel=require(_0xd377('0xc'));var crypto=require(_0xd377('0xd'));var jsforce=require(_0xd377('0xe'));var deskjs=require(_0xd377('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd377('0x10'));var Papa=require(_0xd377('0x11'));var Redis=require(_0xd377('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd377('0x13'));var hardwareService=require(_0xd377('0x14'));var logger=require(_0xd377('0x15'))(_0xd377('0x16'));var utils=require('../../config/utils');var config=require(_0xd377('0x17'));var licenseUtil=require(_0xd377('0x18'));var db=require(_0xd377('0x19'))['db'];function respondWithStatusCode(_0x577529,_0x11ad0f){_0x11ad0f=_0x11ad0f||0xcc;return function(_0x676829){if(_0x676829){return _0x577529[_0xd377('0x1a')](_0x11ad0f);}return _0x577529[_0xd377('0x1b')](_0x11ad0f)[_0xd377('0x1c')]();};}function respondWithResult(_0x1f4946,_0xd6f43){_0xd6f43=_0xd6f43||0xc8;return function(_0x11e60c){if(_0x11e60c){return _0x1f4946[_0xd377('0x1b')](_0xd6f43)[_0xd377('0x1d')](_0x11e60c);}};}function respondWithFilteredResult(_0x475938,_0x5d91cd){return function(_0xdf4e14){if(_0xdf4e14){var _0x46b038=typeof _0x5d91cd[_0xd377('0x1e')]===_0xd377('0x1f')&&typeof _0x5d91cd[_0xd377('0x20')]==='undefined';var _0x39918b=_0xdf4e14[_0xd377('0x21')];var _0x3dc210=_0x46b038?0x0:_0x5d91cd[_0xd377('0x1e')];var _0x172dbc=_0x46b038?_0xdf4e14[_0xd377('0x21')]:_0x5d91cd[_0xd377('0x1e')]+_0x5d91cd[_0xd377('0x20')];var _0x254f6c;if(_0x172dbc>=_0x39918b){_0x172dbc=_0x39918b;_0x254f6c=0xc8;}else{_0x254f6c=0xce;}_0x475938[_0xd377('0x1b')](_0x254f6c);return _0x475938['set'](_0xd377('0x22'),_0x3dc210+'-'+_0x172dbc+'/'+_0x39918b)[_0xd377('0x1d')](_0xdf4e14);}return null;};}function patchUpdates(_0x28e1b0){return function(_0x8ddb4f){try{jsonpatch['apply'](_0x8ddb4f,_0x28e1b0,!![]);}catch(_0x696715){return BPromise[_0xd377('0x23')](_0x696715);}return _0x8ddb4f[_0xd377('0x24')]();};}function saveUpdates(_0x5bf613,_0x5afed7){return function(_0x2f69fb){if(_0x2f69fb){return _0x2f69fb['update'](_0x5bf613)['then'](function(_0x3b742b){return _0x3b742b;});}return null;};}function removeEntity(_0x4dcc66,_0x1a46f8){return function(_0x432881){if(_0x432881){return _0x432881['destroy']()[_0xd377('0x25')](function(){_0x4dcc66['status'](0xcc)[_0xd377('0x1c')]();});}};}function handleEntityNotFound(_0x4dd160,_0x367828){return function(_0x39bf4c){if(!_0x39bf4c){_0x4dd160[_0xd377('0x1a')](0x194);}return _0x39bf4c;};}function handleError(_0x274561,_0x1525a1){_0x1525a1=_0x1525a1||0x1f4;return function(_0x31d964){logger[_0xd377('0x26')](_0x31d964[_0xd377('0x27')]);if(_0x31d964[_0xd377('0x28')]){delete _0x31d964[_0xd377('0x28')];}_0x274561[_0xd377('0x1b')](_0x1525a1)[_0xd377('0x29')](_0x31d964);};}exports['index']=function(_0x234ce5,_0x35a922){var _0x5b8105={},_0xcbff46={},_0x3b1f98={'count':0x0,'rows':[]};var _0x1dfd91=_[_0xd377('0x2a')](db[_0xd377('0x2b')][_0xd377('0x2c')],function(_0x3d01fc){return{'name':_0x3d01fc[_0xd377('0x2d')],'type':_0x3d01fc[_0xd377('0x2e')]['key']};});_0xcbff46[_0xd377('0x2f')]=_[_0xd377('0x2a')](_0x1dfd91,_0xd377('0x28'));_0xcbff46['query']=_[_0xd377('0x30')](_0x234ce5[_0xd377('0x31')]);_0xcbff46[_0xd377('0x32')]=_['intersection'](_0xcbff46[_0xd377('0x2f')],_0xcbff46[_0xd377('0x31')]);_0x5b8105['attributes']=_[_0xd377('0x33')](_0xcbff46[_0xd377('0x2f')],qs[_0xd377('0x34')](_0x234ce5[_0xd377('0x31')][_0xd377('0x34')]));_0x5b8105[_0xd377('0x35')]=_0x5b8105[_0xd377('0x35')][_0xd377('0x36')]?_0x5b8105[_0xd377('0x35')]:_0xcbff46[_0xd377('0x2f')];if(!_0x234ce5[_0xd377('0x31')][_0xd377('0x37')](_0xd377('0x38'))){_0x5b8105[_0xd377('0x20')]=qs['limit'](_0x234ce5[_0xd377('0x31')][_0xd377('0x20')]);_0x5b8105['offset']=qs[_0xd377('0x1e')](_0x234ce5[_0xd377('0x31')]['offset']);}_0x5b8105['order']=qs[_0xd377('0x39')](_0x234ce5[_0xd377('0x31')][_0xd377('0x39')]);_0x5b8105[_0xd377('0x3a')]=qs[_0xd377('0x32')](_[_0xd377('0x3b')](_0x234ce5['query'],_0xcbff46[_0xd377('0x32')]),_0x1dfd91);if(_0x234ce5[_0xd377('0x31')]['filter']){_0x5b8105[_0xd377('0x3a')]=_[_0xd377('0x3c')](_0x5b8105[_0xd377('0x3a')],{'$or':_[_0xd377('0x2a')](_0x1dfd91,function(_0x5c7d2c){if(_0x5c7d2c['type']!=='VIRTUAL'){var _0x13f5bc={};_0x13f5bc[_0x5c7d2c[_0xd377('0x28')]]={'$like':'%'+_0x234ce5[_0xd377('0x31')][_0xd377('0x3d')]+'%'};return _0x13f5bc;}})});}_0x5b8105=_['merge']({},_0x5b8105,_0x234ce5[_0xd377('0x3e')]);var _0x40a54c={'where':_0x5b8105['where']};return db[_0xd377('0x2b')][_0xd377('0x21')](_0x40a54c)[_0xd377('0x25')](function(_0x594209){_0x3b1f98['count']=_0x594209;if(_0x234ce5['query'][_0xd377('0x3f')]){_0x5b8105[_0xd377('0x40')]=[{'all':!![]}];}return db[_0xd377('0x2b')]['findAll'](_0x5b8105);})[_0xd377('0x25')](function(_0x26f2a9){_0x3b1f98[_0xd377('0x41')]=_0x26f2a9;return _0x3b1f98;})[_0xd377('0x25')](respondWithFilteredResult(_0x35a922,_0x5b8105))[_0xd377('0x42')](handleError(_0x35a922,null));};exports[_0xd377('0x43')]=function(_0x298079,_0x200c49){var _0x58a51f={'raw':![],'where':{'id':_0x298079[_0xd377('0x44')]['id']}},_0x413b5d={};_0x413b5d[_0xd377('0x2f')]=_[_0xd377('0x30')](db['ServicenowConfiguration'][_0xd377('0x2c')]);_0x413b5d[_0xd377('0x31')]=_['keys'](_0x298079['query']);_0x413b5d[_0xd377('0x32')]=_[_0xd377('0x33')](_0x413b5d[_0xd377('0x2f')],_0x413b5d[_0xd377('0x31')]);_0x58a51f[_0xd377('0x35')]=_[_0xd377('0x33')](_0x413b5d[_0xd377('0x2f')],qs['fields'](_0x298079['query'][_0xd377('0x34')]));_0x58a51f[_0xd377('0x35')]=_0x58a51f[_0xd377('0x35')]['length']?_0x58a51f[_0xd377('0x35')]:_0x413b5d['model'];if(_0x298079[_0xd377('0x31')][_0xd377('0x3f')]){_0x58a51f[_0xd377('0x40')]=[{'all':!![]}];}_0x58a51f=_[_0xd377('0x3c')]({},_0x58a51f,_0x298079[_0xd377('0x3e')]);return db[_0xd377('0x2b')]['find'](_0x58a51f)[_0xd377('0x25')](handleEntityNotFound(_0x200c49,null))['then'](respondWithResult(_0x200c49,null))[_0xd377('0x42')](handleError(_0x200c49,null));};exports[_0xd377('0x45')]=function(_0x45d61d,_0x3367d0){return db['ServicenowConfiguration'][_0xd377('0x45')](_0x45d61d[_0xd377('0x46')],{})[_0xd377('0x25')](respondWithResult(_0x3367d0,0xc9))['catch'](handleError(_0x3367d0,null));};exports[_0xd377('0x47')]=function(_0x3d7e23,_0x37f062){if(_0x3d7e23[_0xd377('0x46')]['id']){delete _0x3d7e23[_0xd377('0x46')]['id'];}return db[_0xd377('0x2b')][_0xd377('0x48')]({'where':{'id':_0x3d7e23[_0xd377('0x44')]['id']}})[_0xd377('0x25')](handleEntityNotFound(_0x37f062,null))[_0xd377('0x25')](saveUpdates(_0x3d7e23[_0xd377('0x46')],null))[_0xd377('0x25')](respondWithResult(_0x37f062,null))[_0xd377('0x42')](handleError(_0x37f062,null));};exports[_0xd377('0x49')]=function(_0x2b023e,_0x5ccc28){return db[_0xd377('0x2b')][_0xd377('0x48')]({'where':{'id':_0x2b023e['params']['id']}})[_0xd377('0x25')](handleEntityNotFound(_0x5ccc28,null))['then'](removeEntity(_0x5ccc28,null))[_0xd377('0x42')](handleError(_0x5ccc28,null));};exports[_0xd377('0x4a')]=function(_0x3fcee2,_0x2da415,_0x1c3096){var _0x5b0ee3={};var _0x358fd5={};var _0x16b223;var _0xba050;return db[_0xd377('0x2b')][_0xd377('0x4b')]({'where':{'id':_0x3fcee2['params']['id']}})['then'](handleEntityNotFound(_0x2da415,null))['then'](function(_0xba0791){if(_0xba0791){_0x16b223=_0xba0791;_0x358fd5['model']=_['keys'](db[_0xd377('0x4c')]['rawAttributes']);_0x358fd5[_0xd377('0x31')]=_[_0xd377('0x30')](_0x3fcee2[_0xd377('0x31')]);_0x358fd5['filters']=_['intersection'](_0x358fd5[_0xd377('0x2f')],_0x358fd5['query']);_0x5b0ee3[_0xd377('0x35')]=_[_0xd377('0x33')](_0x358fd5['model'],qs[_0xd377('0x34')](_0x3fcee2[_0xd377('0x31')][_0xd377('0x34')]));_0x5b0ee3[_0xd377('0x35')]=_0x5b0ee3[_0xd377('0x35')][_0xd377('0x36')]?_0x5b0ee3[_0xd377('0x35')]:_0x358fd5[_0xd377('0x2f')];_0x5b0ee3[_0xd377('0x4d')]=qs[_0xd377('0x39')](_0x3fcee2[_0xd377('0x31')]['sort']);_0x5b0ee3[_0xd377('0x3a')]=qs['filters'](_[_0xd377('0x3b')](_0x3fcee2[_0xd377('0x31')],_0x358fd5[_0xd377('0x32')]));if(_0x3fcee2[_0xd377('0x31')][_0xd377('0x3d')]){_0x5b0ee3[_0xd377('0x3a')]=_[_0xd377('0x3c')](_0x5b0ee3[_0xd377('0x3a')],{'$or':_[_0xd377('0x2a')](_0x5b0ee3[_0xd377('0x35')],function(_0x32b026){var _0x116aa4={};_0x116aa4[_0x32b026]={'$like':'%'+_0x3fcee2[_0xd377('0x31')][_0xd377('0x3d')]+'%'};return _0x116aa4;})});}_0x5b0ee3=_['merge']({},_0x5b0ee3,_0x3fcee2['options']);return _0x16b223[_0xd377('0x4a')](_0x5b0ee3);}})[_0xd377('0x25')](function(_0x3335db){if(_0x3335db){_0xba050=_0x3335db[_0xd377('0x36')];if(!_0x3fcee2[_0xd377('0x31')]['hasOwnProperty'](_0xd377('0x38'))){_0x5b0ee3[_0xd377('0x20')]=qs[_0xd377('0x20')](_0x3fcee2[_0xd377('0x31')]['limit']);_0x5b0ee3[_0xd377('0x1e')]=qs[_0xd377('0x1e')](_0x3fcee2[_0xd377('0x31')][_0xd377('0x1e')]);}return _0x16b223[_0xd377('0x4a')](_0x5b0ee3);}})[_0xd377('0x25')](function(_0x3c447d){if(_0x3c447d){return _0x3c447d?{'count':_0xba050,'rows':_0x3c447d}:null;}})[_0xd377('0x25')](respondWithResult(_0x2da415,null))['catch'](handleError(_0x2da415,null));};exports[_0xd377('0x4e')]=function(_0x521794,_0x579c86,_0x437200){var _0x2b8982={};var _0x15a25f={};var _0x282d7c;var _0x3734fc;return db[_0xd377('0x2b')][_0xd377('0x4b')]({'where':{'id':_0x521794['params']['id']}})[_0xd377('0x25')](handleEntityNotFound(_0x579c86,null))['then'](function(_0x2b6dd0){if(_0x2b6dd0){_0x282d7c=_0x2b6dd0;_0x15a25f[_0xd377('0x2f')]=_[_0xd377('0x30')](db[_0xd377('0x4c')][_0xd377('0x2c')]);_0x15a25f[_0xd377('0x31')]=_['keys'](_0x521794['query']);_0x15a25f['filters']=_[_0xd377('0x33')](_0x15a25f[_0xd377('0x2f')],_0x15a25f[_0xd377('0x31')]);_0x2b8982[_0xd377('0x35')]=_[_0xd377('0x33')](_0x15a25f[_0xd377('0x2f')],qs[_0xd377('0x34')](_0x521794['query'][_0xd377('0x34')]));_0x2b8982['attributes']=_0x2b8982[_0xd377('0x35')]['length']?_0x2b8982[_0xd377('0x35')]:_0x15a25f[_0xd377('0x2f')];_0x2b8982[_0xd377('0x4d')]=qs[_0xd377('0x39')](_0x521794[_0xd377('0x31')][_0xd377('0x39')]);_0x2b8982['where']=qs[_0xd377('0x32')](_[_0xd377('0x3b')](_0x521794['query'],_0x15a25f[_0xd377('0x32')]));if(_0x521794[_0xd377('0x31')]['filter']){_0x2b8982[_0xd377('0x3a')]=_[_0xd377('0x3c')](_0x2b8982['where'],{'$or':_[_0xd377('0x2a')](_0x2b8982[_0xd377('0x35')],function(_0x380344){var _0x4f8089={};_0x4f8089[_0x380344]={'$like':'%'+_0x521794[_0xd377('0x31')][_0xd377('0x3d')]+'%'};return _0x4f8089;})});}_0x2b8982=_[_0xd377('0x3c')]({},_0x2b8982,_0x521794[_0xd377('0x3e')]);return _0x282d7c['getSubjects'](_0x2b8982);}})['then'](function(_0x1f59f3){if(_0x1f59f3){_0x3734fc=_0x1f59f3[_0xd377('0x36')];if(!_0x521794[_0xd377('0x31')][_0xd377('0x37')]('nolimit')){_0x2b8982[_0xd377('0x20')]=qs[_0xd377('0x20')](_0x521794[_0xd377('0x31')][_0xd377('0x20')]);_0x2b8982[_0xd377('0x1e')]=qs[_0xd377('0x1e')](_0x521794[_0xd377('0x31')][_0xd377('0x1e')]);}return _0x282d7c[_0xd377('0x4e')](_0x2b8982);}})[_0xd377('0x25')](function(_0x57bdc9){if(_0x57bdc9){return _0x57bdc9?{'count':_0x3734fc,'rows':_0x57bdc9}:null;}})[_0xd377('0x25')](respondWithResult(_0x579c86,null))['catch'](handleError(_0x579c86,null));};exports[_0xd377('0x4f')]=function(_0x471a51,_0x47eee1,_0x4b885c){var _0x249206={};var _0x2abe85={};var _0x3711b1;var _0x55d54a;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x471a51[_0xd377('0x44')]['id']}})['then'](handleEntityNotFound(_0x47eee1,null))['then'](function(_0x3ce4fe){if(_0x3ce4fe){_0x3711b1=_0x3ce4fe;_0x2abe85[_0xd377('0x2f')]=_['keys'](db[_0xd377('0x4c')][_0xd377('0x2c')]);_0x2abe85[_0xd377('0x31')]=_[_0xd377('0x30')](_0x471a51[_0xd377('0x31')]);_0x2abe85[_0xd377('0x32')]=_['intersection'](_0x2abe85[_0xd377('0x2f')],_0x2abe85[_0xd377('0x31')]);_0x249206['attributes']=_['intersection'](_0x2abe85[_0xd377('0x2f')],qs[_0xd377('0x34')](_0x471a51[_0xd377('0x31')][_0xd377('0x34')]));_0x249206['attributes']=_0x249206[_0xd377('0x35')][_0xd377('0x36')]?_0x249206['attributes']:_0x2abe85[_0xd377('0x2f')];_0x249206[_0xd377('0x4d')]=qs[_0xd377('0x39')](_0x471a51[_0xd377('0x31')]['sort']);_0x249206[_0xd377('0x3a')]=qs[_0xd377('0x32')](_[_0xd377('0x3b')](_0x471a51[_0xd377('0x31')],_0x2abe85['filters']));if(_0x471a51[_0xd377('0x31')][_0xd377('0x3d')]){_0x249206[_0xd377('0x3a')]=_['merge'](_0x249206['where'],{'$or':_[_0xd377('0x2a')](_0x249206['attributes'],function(_0x5ebf6a){var _0x4121e1={};_0x4121e1[_0x5ebf6a]={'$like':'%'+_0x471a51[_0xd377('0x31')]['filter']+'%'};return _0x4121e1;})});}_0x249206=_['merge']({},_0x249206,_0x471a51['options']);return _0x3711b1[_0xd377('0x4f')](_0x249206);}})[_0xd377('0x25')](function(_0x333858){if(_0x333858){_0x55d54a=_0x333858[_0xd377('0x36')];if(!_0x471a51[_0xd377('0x31')][_0xd377('0x37')](_0xd377('0x38'))){_0x249206[_0xd377('0x20')]=qs['limit'](_0x471a51[_0xd377('0x31')]['limit']);_0x249206['offset']=qs[_0xd377('0x1e')](_0x471a51['query']['offset']);}return _0x3711b1[_0xd377('0x4f')](_0x249206);}})[_0xd377('0x25')](function(_0x5c5dd2){if(_0x5c5dd2){return _0x5c5dd2?{'count':_0x55d54a,'rows':_0x5c5dd2}:null;}})[_0xd377('0x25')](respondWithResult(_0x47eee1,null))[_0xd377('0x42')](handleError(_0x47eee1,null));}; \ No newline at end of file +var _0x5044=['../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','save','update','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','type','VIRTUAL','ServicenowConfiguration','includeAll','include','findAll','params','keys','options','find','create','body','catch','ServicenowField','merge','getFields','getSubjects','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x491756,_0x2bd06b){var _0x269960=function(_0x592048){while(--_0x592048){_0x491756['push'](_0x491756['shift']());}};_0x269960(++_0x2bd06b);}(_0x5044,0xd5));var _0x4504=function(_0x22cd92,_0x4adef8){_0x22cd92=_0x22cd92-0x0;var _0x400cae=_0x5044[_0x22cd92];return _0x400cae;};'use strict';var emlformat=require(_0x4504('0x0'));var rimraf=require(_0x4504('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4504('0x2'));var rp=require(_0x4504('0x3'));var moment=require(_0x4504('0x4'));var BPromise=require(_0x4504('0x5'));var Mustache=require(_0x4504('0x6'));var util=require(_0x4504('0x7'));var path=require(_0x4504('0x8'));var sox=require(_0x4504('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4504('0xa'));var _=require(_0x4504('0xb'));var squel=require(_0x4504('0xc'));var crypto=require(_0x4504('0xd'));var jsforce=require(_0x4504('0xe'));var deskjs=require(_0x4504('0xf'));var toCsv=require(_0x4504('0x10'));var querystring=require(_0x4504('0x11'));var Papa=require(_0x4504('0x12'));var Redis=require(_0x4504('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x4504('0x14'));var as=require(_0x4504('0x15'));var hardwareService=require(_0x4504('0x16'));var logger=require(_0x4504('0x17'))(_0x4504('0x18'));var utils=require('../../config/utils');var config=require(_0x4504('0x19'));var licenseUtil=require(_0x4504('0x1a'));var db=require(_0x4504('0x1b'))['db'];function respondWithStatusCode(_0x31d00b,_0x32a18e){_0x32a18e=_0x32a18e||0xcc;return function(_0x22185f){if(_0x22185f){return _0x31d00b[_0x4504('0x1c')](_0x32a18e);}return _0x31d00b[_0x4504('0x1d')](_0x32a18e)[_0x4504('0x1e')]();};}function respondWithResult(_0x22faed,_0x367704){_0x367704=_0x367704||0xc8;return function(_0x186602){if(_0x186602){return _0x22faed[_0x4504('0x1d')](_0x367704)[_0x4504('0x1f')](_0x186602);}};}function respondWithFilteredResult(_0x52e265,_0x31a694){return function(_0x26ad84){if(_0x26ad84){var _0x189538=typeof _0x31a694[_0x4504('0x20')]==='undefined'&&typeof _0x31a694[_0x4504('0x21')]==='undefined';var _0x4191d0=_0x26ad84['count'];var _0x32b87e=_0x189538?0x0:_0x31a694['offset'];var _0x26a341=_0x189538?_0x26ad84[_0x4504('0x22')]:_0x31a694['offset']+_0x31a694[_0x4504('0x21')];var _0x7ce0bf;if(_0x26a341>=_0x4191d0){_0x26a341=_0x4191d0;_0x7ce0bf=0xc8;}else{_0x7ce0bf=0xce;}_0x52e265[_0x4504('0x1d')](_0x7ce0bf);return _0x52e265[_0x4504('0x23')]('Content-Range',_0x32b87e+'-'+_0x26a341+'/'+_0x4191d0)['json'](_0x26ad84);}return null;};}function patchUpdates(_0x1953e3){return function(_0x90a9d){try{jsonpatch['apply'](_0x90a9d,_0x1953e3,!![]);}catch(_0xf74404){return BPromise['reject'](_0xf74404);}return _0x90a9d[_0x4504('0x24')]();};}function saveUpdates(_0x11dcf6,_0xea7b06){return function(_0x524be2){if(_0x524be2){return _0x524be2[_0x4504('0x25')](_0x11dcf6)['then'](function(_0x57ee7d){return _0x57ee7d;});}return null;};}function removeEntity(_0x2117f1,_0x26af7b){return function(_0x564aa7){if(_0x564aa7){return _0x564aa7[_0x4504('0x26')]()[_0x4504('0x27')](function(){_0x2117f1['status'](0xcc)[_0x4504('0x1e')]();});}};}function handleEntityNotFound(_0x41515b,_0x11c03d){return function(_0x229dd5){if(!_0x229dd5){_0x41515b[_0x4504('0x1c')](0x194);}return _0x229dd5;};}function handleError(_0x50a1e2,_0x4ee01a){_0x4ee01a=_0x4ee01a||0x1f4;return function(_0x365a67){logger[_0x4504('0x28')](_0x365a67[_0x4504('0x29')]);if(_0x365a67[_0x4504('0x2a')]){delete _0x365a67[_0x4504('0x2a')];}_0x50a1e2[_0x4504('0x1d')](_0x4ee01a)[_0x4504('0x2b')](_0x365a67);};}exports['index']=function(_0x15680f,_0xcecfff){var _0x5e4e6c={},_0x5908e9={},_0x1d9968={'count':0x0,'rows':[]};var _0x22ccd5=_[_0x4504('0x2c')](db['ServicenowConfiguration'][_0x4504('0x2d')],function(_0x394aa3){return{'name':_0x394aa3[_0x4504('0x2e')],'type':_0x394aa3['type']['key']};});_0x5908e9[_0x4504('0x2f')]=_[_0x4504('0x2c')](_0x22ccd5,_0x4504('0x2a'));_0x5908e9[_0x4504('0x30')]=_['keys'](_0x15680f[_0x4504('0x30')]);_0x5908e9['filters']=_[_0x4504('0x31')](_0x5908e9['model'],_0x5908e9['query']);_0x5e4e6c[_0x4504('0x32')]=_[_0x4504('0x31')](_0x5908e9[_0x4504('0x2f')],qs[_0x4504('0x33')](_0x15680f[_0x4504('0x30')]['fields']));_0x5e4e6c['attributes']=_0x5e4e6c[_0x4504('0x32')][_0x4504('0x34')]?_0x5e4e6c[_0x4504('0x32')]:_0x5908e9[_0x4504('0x2f')];if(!_0x15680f[_0x4504('0x30')][_0x4504('0x35')](_0x4504('0x36'))){_0x5e4e6c[_0x4504('0x21')]=qs[_0x4504('0x21')](_0x15680f['query']['limit']);_0x5e4e6c[_0x4504('0x20')]=qs['offset'](_0x15680f['query'][_0x4504('0x20')]);}_0x5e4e6c[_0x4504('0x37')]=qs[_0x4504('0x38')](_0x15680f['query']['sort']);_0x5e4e6c['where']=qs[_0x4504('0x39')](_[_0x4504('0x3a')](_0x15680f[_0x4504('0x30')],_0x5908e9[_0x4504('0x39')]),_0x22ccd5);if(_0x15680f[_0x4504('0x30')][_0x4504('0x3b')]){_0x5e4e6c[_0x4504('0x3c')]=_['merge'](_0x5e4e6c[_0x4504('0x3c')],{'$or':_[_0x4504('0x2c')](_0x22ccd5,function(_0x1cef20){if(_0x1cef20[_0x4504('0x3d')]!==_0x4504('0x3e')){var _0x1457f2={};_0x1457f2[_0x1cef20[_0x4504('0x2a')]]={'$like':'%'+_0x15680f[_0x4504('0x30')][_0x4504('0x3b')]+'%'};return _0x1457f2;}})});}_0x5e4e6c=_['merge']({},_0x5e4e6c,_0x15680f['options']);var _0xe6a9f2={'where':_0x5e4e6c['where']};return db[_0x4504('0x3f')]['count'](_0xe6a9f2)[_0x4504('0x27')](function(_0x55c003){_0x1d9968[_0x4504('0x22')]=_0x55c003;if(_0x15680f[_0x4504('0x30')][_0x4504('0x40')]){_0x5e4e6c[_0x4504('0x41')]=[{'all':!![]}];}return db[_0x4504('0x3f')][_0x4504('0x42')](_0x5e4e6c);})[_0x4504('0x27')](function(_0x159123){_0x1d9968['rows']=_0x159123;return _0x1d9968;})['then'](respondWithFilteredResult(_0xcecfff,_0x5e4e6c))['catch'](handleError(_0xcecfff,null));};exports['show']=function(_0x536112,_0x4580ff){var _0x3ceea4={'raw':![],'where':{'id':_0x536112[_0x4504('0x43')]['id']}},_0x201023={};_0x201023[_0x4504('0x2f')]=_['keys'](db[_0x4504('0x3f')]['rawAttributes']);_0x201023['query']=_[_0x4504('0x44')](_0x536112[_0x4504('0x30')]);_0x201023['filters']=_['intersection'](_0x201023[_0x4504('0x2f')],_0x201023['query']);_0x3ceea4[_0x4504('0x32')]=_[_0x4504('0x31')](_0x201023['model'],qs[_0x4504('0x33')](_0x536112['query'][_0x4504('0x33')]));_0x3ceea4['attributes']=_0x3ceea4[_0x4504('0x32')]['length']?_0x3ceea4[_0x4504('0x32')]:_0x201023['model'];if(_0x536112[_0x4504('0x30')][_0x4504('0x40')]){_0x3ceea4[_0x4504('0x41')]=[{'all':!![]}];}_0x3ceea4=_['merge']({},_0x3ceea4,_0x536112[_0x4504('0x45')]);return db[_0x4504('0x3f')][_0x4504('0x46')](_0x3ceea4)[_0x4504('0x27')](handleEntityNotFound(_0x4580ff,null))[_0x4504('0x27')](respondWithResult(_0x4580ff,null))['catch'](handleError(_0x4580ff,null));};exports[_0x4504('0x47')]=function(_0x19a205,_0x4c397b){return db['ServicenowConfiguration'][_0x4504('0x47')](_0x19a205[_0x4504('0x48')],{})[_0x4504('0x27')](respondWithResult(_0x4c397b,0xc9))[_0x4504('0x49')](handleError(_0x4c397b,null));};exports[_0x4504('0x25')]=function(_0x4543b6,_0x44bfb3){if(_0x4543b6[_0x4504('0x48')]['id']){delete _0x4543b6[_0x4504('0x48')]['id'];}return db['ServicenowConfiguration'][_0x4504('0x46')]({'where':{'id':_0x4543b6['params']['id']}})[_0x4504('0x27')](handleEntityNotFound(_0x44bfb3,null))[_0x4504('0x27')](saveUpdates(_0x4543b6[_0x4504('0x48')],null))[_0x4504('0x27')](respondWithResult(_0x44bfb3,null))[_0x4504('0x49')](handleError(_0x44bfb3,null));};exports['destroy']=function(_0x551a9c,_0x38b244){return db['ServicenowConfiguration'][_0x4504('0x46')]({'where':{'id':_0x551a9c[_0x4504('0x43')]['id']}})[_0x4504('0x27')](handleEntityNotFound(_0x38b244,null))['then'](removeEntity(_0x38b244,null))[_0x4504('0x49')](handleError(_0x38b244,null));};exports['getFields']=function(_0x4af45a,_0x5b4f4f,_0x11a024){var _0x4a5586={};var _0x40c849={};var _0x4663b3;var _0x5c3c42;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x4af45a[_0x4504('0x43')]['id']}})[_0x4504('0x27')](handleEntityNotFound(_0x5b4f4f,null))['then'](function(_0x3ea480){if(_0x3ea480){_0x4663b3=_0x3ea480;_0x40c849[_0x4504('0x2f')]=_[_0x4504('0x44')](db[_0x4504('0x4a')][_0x4504('0x2d')]);_0x40c849[_0x4504('0x30')]=_[_0x4504('0x44')](_0x4af45a[_0x4504('0x30')]);_0x40c849[_0x4504('0x39')]=_[_0x4504('0x31')](_0x40c849[_0x4504('0x2f')],_0x40c849[_0x4504('0x30')]);_0x4a5586['attributes']=_[_0x4504('0x31')](_0x40c849[_0x4504('0x2f')],qs['fields'](_0x4af45a[_0x4504('0x30')]['fields']));_0x4a5586['attributes']=_0x4a5586[_0x4504('0x32')][_0x4504('0x34')]?_0x4a5586[_0x4504('0x32')]:_0x40c849['model'];_0x4a5586['order']=qs[_0x4504('0x38')](_0x4af45a[_0x4504('0x30')]['sort']);_0x4a5586[_0x4504('0x3c')]=qs['filters'](_[_0x4504('0x3a')](_0x4af45a['query'],_0x40c849['filters']));if(_0x4af45a[_0x4504('0x30')][_0x4504('0x3b')]){_0x4a5586[_0x4504('0x3c')]=_[_0x4504('0x4b')](_0x4a5586['where'],{'$or':_[_0x4504('0x2c')](_0x4a5586[_0x4504('0x32')],function(_0x1dbe28){var _0x3eb818={};_0x3eb818[_0x1dbe28]={'$like':'%'+_0x4af45a[_0x4504('0x30')]['filter']+'%'};return _0x3eb818;})});}_0x4a5586=_[_0x4504('0x4b')]({},_0x4a5586,_0x4af45a[_0x4504('0x45')]);return _0x4663b3[_0x4504('0x4c')](_0x4a5586);}})[_0x4504('0x27')](function(_0x22c2de){if(_0x22c2de){_0x5c3c42=_0x22c2de[_0x4504('0x34')];if(!_0x4af45a[_0x4504('0x30')][_0x4504('0x35')](_0x4504('0x36'))){_0x4a5586['limit']=qs['limit'](_0x4af45a[_0x4504('0x30')]['limit']);_0x4a5586[_0x4504('0x20')]=qs['offset'](_0x4af45a['query'][_0x4504('0x20')]);}return _0x4663b3[_0x4504('0x4c')](_0x4a5586);}})[_0x4504('0x27')](function(_0x235757){if(_0x235757){return _0x235757?{'count':_0x5c3c42,'rows':_0x235757}:null;}})['then'](respondWithResult(_0x5b4f4f,null))[_0x4504('0x49')](handleError(_0x5b4f4f,null));};exports[_0x4504('0x4d')]=function(_0x3c1bef,_0x2d86c2,_0x543a11){var _0x2a2b6c={};var _0xab16b3={};var _0x447b9e;var _0x46a1c7;return db[_0x4504('0x3f')][_0x4504('0x4e')]({'where':{'id':_0x3c1bef[_0x4504('0x43')]['id']}})[_0x4504('0x27')](handleEntityNotFound(_0x2d86c2,null))[_0x4504('0x27')](function(_0x35dd51){if(_0x35dd51){_0x447b9e=_0x35dd51;_0xab16b3['model']=_[_0x4504('0x44')](db['ServicenowField']['rawAttributes']);_0xab16b3[_0x4504('0x30')]=_[_0x4504('0x44')](_0x3c1bef[_0x4504('0x30')]);_0xab16b3['filters']=_[_0x4504('0x31')](_0xab16b3[_0x4504('0x2f')],_0xab16b3[_0x4504('0x30')]);_0x2a2b6c[_0x4504('0x32')]=_[_0x4504('0x31')](_0xab16b3[_0x4504('0x2f')],qs[_0x4504('0x33')](_0x3c1bef['query'][_0x4504('0x33')]));_0x2a2b6c[_0x4504('0x32')]=_0x2a2b6c[_0x4504('0x32')][_0x4504('0x34')]?_0x2a2b6c[_0x4504('0x32')]:_0xab16b3['model'];_0x2a2b6c[_0x4504('0x37')]=qs[_0x4504('0x38')](_0x3c1bef[_0x4504('0x30')][_0x4504('0x38')]);_0x2a2b6c[_0x4504('0x3c')]=qs[_0x4504('0x39')](_['pick'](_0x3c1bef[_0x4504('0x30')],_0xab16b3[_0x4504('0x39')]));if(_0x3c1bef[_0x4504('0x30')][_0x4504('0x3b')]){_0x2a2b6c['where']=_[_0x4504('0x4b')](_0x2a2b6c[_0x4504('0x3c')],{'$or':_[_0x4504('0x2c')](_0x2a2b6c[_0x4504('0x32')],function(_0x1e5876){var _0x33d225={};_0x33d225[_0x1e5876]={'$like':'%'+_0x3c1bef['query'][_0x4504('0x3b')]+'%'};return _0x33d225;})});}_0x2a2b6c=_[_0x4504('0x4b')]({},_0x2a2b6c,_0x3c1bef[_0x4504('0x45')]);return _0x447b9e[_0x4504('0x4d')](_0x2a2b6c);}})[_0x4504('0x27')](function(_0xbd7948){if(_0xbd7948){_0x46a1c7=_0xbd7948[_0x4504('0x34')];if(!_0x3c1bef['query'][_0x4504('0x35')](_0x4504('0x36'))){_0x2a2b6c['limit']=qs[_0x4504('0x21')](_0x3c1bef[_0x4504('0x30')][_0x4504('0x21')]);_0x2a2b6c[_0x4504('0x20')]=qs[_0x4504('0x20')](_0x3c1bef[_0x4504('0x30')][_0x4504('0x20')]);}return _0x447b9e[_0x4504('0x4d')](_0x2a2b6c);}})['then'](function(_0x2e6ff0){if(_0x2e6ff0){return _0x2e6ff0?{'count':_0x46a1c7,'rows':_0x2e6ff0}:null;}})[_0x4504('0x27')](respondWithResult(_0x2d86c2,null))[_0x4504('0x49')](handleError(_0x2d86c2,null));};exports[_0x4504('0x4f')]=function(_0x1de346,_0x223e64,_0x3141a0){var _0x471818={};var _0x1a40d3={};var _0x248f45;var _0x2b00d2;return db[_0x4504('0x3f')][_0x4504('0x4e')]({'where':{'id':_0x1de346['params']['id']}})[_0x4504('0x27')](handleEntityNotFound(_0x223e64,null))[_0x4504('0x27')](function(_0x31e328){if(_0x31e328){_0x248f45=_0x31e328;_0x1a40d3[_0x4504('0x2f')]=_[_0x4504('0x44')](db[_0x4504('0x4a')][_0x4504('0x2d')]);_0x1a40d3[_0x4504('0x30')]=_[_0x4504('0x44')](_0x1de346['query']);_0x1a40d3[_0x4504('0x39')]=_[_0x4504('0x31')](_0x1a40d3[_0x4504('0x2f')],_0x1a40d3['query']);_0x471818['attributes']=_[_0x4504('0x31')](_0x1a40d3[_0x4504('0x2f')],qs[_0x4504('0x33')](_0x1de346[_0x4504('0x30')][_0x4504('0x33')]));_0x471818[_0x4504('0x32')]=_0x471818[_0x4504('0x32')][_0x4504('0x34')]?_0x471818[_0x4504('0x32')]:_0x1a40d3[_0x4504('0x2f')];_0x471818[_0x4504('0x37')]=qs[_0x4504('0x38')](_0x1de346[_0x4504('0x30')][_0x4504('0x38')]);_0x471818[_0x4504('0x3c')]=qs['filters'](_[_0x4504('0x3a')](_0x1de346[_0x4504('0x30')],_0x1a40d3[_0x4504('0x39')]));if(_0x1de346[_0x4504('0x30')]['filter']){_0x471818['where']=_[_0x4504('0x4b')](_0x471818[_0x4504('0x3c')],{'$or':_[_0x4504('0x2c')](_0x471818[_0x4504('0x32')],function(_0x4e7135){var _0x162bf2={};_0x162bf2[_0x4e7135]={'$like':'%'+_0x1de346[_0x4504('0x30')][_0x4504('0x3b')]+'%'};return _0x162bf2;})});}_0x471818=_[_0x4504('0x4b')]({},_0x471818,_0x1de346[_0x4504('0x45')]);return _0x248f45[_0x4504('0x4f')](_0x471818);}})[_0x4504('0x27')](function(_0x27720b){if(_0x27720b){_0x2b00d2=_0x27720b[_0x4504('0x34')];if(!_0x1de346[_0x4504('0x30')][_0x4504('0x35')](_0x4504('0x36'))){_0x471818['limit']=qs['limit'](_0x1de346[_0x4504('0x30')][_0x4504('0x21')]);_0x471818[_0x4504('0x20')]=qs[_0x4504('0x20')](_0x1de346[_0x4504('0x30')][_0x4504('0x20')]);}return _0x248f45[_0x4504('0x4f')](_0x471818);}})[_0x4504('0x27')](function(_0x7913e5){if(_0x7913e5){return _0x7913e5?{'count':_0x2b00d2,'rows':_0x7913e5}:null;}})[_0x4504('0x27')](respondWithResult(_0x223e64,null))[_0x4504('0x49')](handleError(_0x223e64,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 586dc85..2da8181 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 _0x6146=['exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intServicenowConfiguration.attributes'];(function(_0x58cd58,_0x13964d){var _0x5637fc=function(_0x48cfda){while(--_0x48cfda){_0x58cd58['push'](_0x58cd58['shift']());}};_0x5637fc(++_0x13964d);}(_0x6146,0xba));var _0x6614=function(_0x35fc38,_0x2bcf9c){_0x35fc38=_0x35fc38-0x0;var _0x69b91b=_0x6146[_0x35fc38];return _0x69b91b;};'use strict';var _=require(_0x6614('0x0'));var util=require('util');var logger=require(_0x6614('0x1'))(_0x6614('0x2'));var moment=require(_0x6614('0x3'));var BPromise=require(_0x6614('0x4'));var rp=require(_0x6614('0x5'));var fs=require('fs');var path=require(_0x6614('0x6'));var rimraf=require(_0x6614('0x7'));var config=require('../../config/environment');var attributes=require(_0x6614('0x8'));module[_0x6614('0x9')]=function(_0x334591,_0x43c7a7){return _0x334591[_0x6614('0xa')](_0x6614('0xb'),attributes,{'tableName':_0x6614('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd6f=['rimraf','../../config/environment','exports','define','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x348ef5,_0x3f0dff){var _0x2ced24=function(_0x39c5e9){while(--_0x39c5e9){_0x348ef5['push'](_0x348ef5['shift']());}};_0x2ced24(++_0x3f0dff);}(_0xfd6f,0x19d));var _0xffd6=function(_0xa0a89f,_0xbf638f){_0xa0a89f=_0xa0a89f-0x0;var _0xc33e10=_0xfd6f[_0xa0a89f];return _0xc33e10;};'use strict';var _=require(_0xffd6('0x0'));var util=require(_0xffd6('0x1'));var logger=require(_0xffd6('0x2'))(_0xffd6('0x3'));var moment=require(_0xffd6('0x4'));var BPromise=require('bluebird');var rp=require(_0xffd6('0x5'));var fs=require('fs');var path=require(_0xffd6('0x6'));var rimraf=require(_0xffd6('0x7'));var config=require(_0xffd6('0x8'));var attributes=require('./intServicenowConfiguration.attributes');module[_0xffd6('0x9')]=function(_0x380073,_0x3f3cd8){return _0x380073[_0xffd6('0xa')]('ServicenowConfiguration',attributes,{'tableName':_0xffd6('0xb'),'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 d4c7963..a6aec78 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 _0xf2bd=['ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf2bd,0x135));var _0xdf2b=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xf2bd[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xdf2b('0x0'));var util=require(_0xdf2b('0x1'));var moment=require(_0xdf2b('0x2'));var BPromise=require(_0xdf2b('0x3'));var rs=require(_0xdf2b('0x4'));var fs=require('fs');var Redis=require(_0xdf2b('0x5'));var db=require(_0xdf2b('0x6'))['db'];var utils=require(_0xdf2b('0x7'));var logger=require(_0xdf2b('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdf2b('0x9'));var client=jayson[_0xdf2b('0xa')][_0xdf2b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1da0ac,_0x4f1b22,_0x2d768f){return new BPromise(function(_0x34df56,_0x5055e3){return client['request'](_0x1da0ac,_0x2d768f)[_0xdf2b('0xc')](function(_0x1d8f53){logger['info'](_0xdf2b('0xd'),_0x4f1b22,_0xdf2b('0xe'));logger[_0xdf2b('0xf')](_0xdf2b('0x10'),_0x4f1b22,_0xdf2b('0xe'),JSON[_0xdf2b('0x11')](_0x1d8f53));if(_0x1d8f53[_0xdf2b('0x12')]){if(_0x1d8f53['error'][_0xdf2b('0x13')]===0x1f4){logger[_0xdf2b('0x12')](_0xdf2b('0xd'),_0x4f1b22,_0x1d8f53['error'][_0xdf2b('0x14')]);return _0x5055e3(_0x1d8f53[_0xdf2b('0x12')]['message']);}logger[_0xdf2b('0x12')](_0xdf2b('0xd'),_0x4f1b22,_0x1d8f53[_0xdf2b('0x12')][_0xdf2b('0x14')]);return _0x34df56(_0x1d8f53[_0xdf2b('0x12')][_0xdf2b('0x14')]);}else{logger[_0xdf2b('0x15')](_0xdf2b('0xd'),_0x4f1b22,_0xdf2b('0xe'));_0x34df56(_0x1d8f53['result'][_0xdf2b('0x14')]);}})[_0xdf2b('0x16')](function(_0x1e7937){logger[_0xdf2b('0x12')](_0xdf2b('0xd'),_0x4f1b22,_0x1e7937);_0x5055e3(_0x1e7937);});});} \ No newline at end of file +var _0x5d81=['ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x535963,_0x326515){var _0x3975f6=function(_0x2e624f){while(--_0x2e624f){_0x535963['push'](_0x535963['shift']());}};_0x3975f6(++_0x326515);}(_0x5d81,0x1c0));var _0x15d8=function(_0x19b84f,_0x48765e){_0x19b84f=_0x19b84f-0x0;var _0x18067b=_0x5d81[_0x19b84f];return _0x18067b;};'use strict';var _=require(_0x15d8('0x0'));var util=require(_0x15d8('0x1'));var moment=require(_0x15d8('0x2'));var BPromise=require('bluebird');var rs=require(_0x15d8('0x3'));var fs=require('fs');var Redis=require(_0x15d8('0x4'));var db=require(_0x15d8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x15d8('0x6'))('rpc');var config=require(_0x15d8('0x7'));var jayson=require(_0x15d8('0x8'));var client=jayson[_0x15d8('0x9')][_0x15d8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2df2fe,_0x24ec78,_0x1d39a9){return new BPromise(function(_0x4ffe89,_0x31f49d){return client[_0x15d8('0xb')](_0x2df2fe,_0x1d39a9)['then'](function(_0x14640b){logger['info'](_0x15d8('0xc'),_0x24ec78,_0x15d8('0xd'));logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x24ec78,_0x15d8('0xd'),JSON[_0x15d8('0xe')](_0x14640b));if(_0x14640b['error']){if(_0x14640b[_0x15d8('0xf')]['code']===0x1f4){logger['error'](_0x15d8('0xc'),_0x24ec78,_0x14640b['error'][_0x15d8('0x10')]);return _0x31f49d(_0x14640b[_0x15d8('0xf')][_0x15d8('0x10')]);}logger[_0x15d8('0xf')](_0x15d8('0xc'),_0x24ec78,_0x14640b['error'][_0x15d8('0x10')]);return _0x4ffe89(_0x14640b[_0x15d8('0xf')]['message']);}else{logger[_0x15d8('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x24ec78,_0x15d8('0xd'));_0x4ffe89(_0x14640b[_0x15d8('0x12')][_0x15d8('0x10')]);}})[_0x15d8('0x13')](function(_0x1598b5){logger[_0x15d8('0xf')](_0x15d8('0xc'),_0x24ec78,_0x1598b5);_0x31f49d(_0x1598b5);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index dec8a48..5755bfd 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 _0x54ff=['/:id','show','post','delete','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index'];(function(_0x50d1c6,_0x40051c){var _0x3cd375=function(_0x5bcfd9){while(--_0x5bcfd9){_0x50d1c6['push'](_0x50d1c6['shift']());}};_0x3cd375(++_0x40051c);}(_0x54ff,0x121));var _0xf54f=function(_0x5c0fe0,_0x51c787){_0x5c0fe0=_0x5c0fe0-0x0;var _0xb287eb=_0x54ff[_0x5c0fe0];return _0xb287eb;};'use strict';var multer=require('multer');var util=require(_0xf54f('0x0'));var path=require('path');var timeout=require(_0xf54f('0x1'));var express=require('express');var router=express[_0xf54f('0x2')]();var fs_extra=require(_0xf54f('0x3'));var auth=require(_0xf54f('0x4'));var interaction=require(_0xf54f('0x5'));var config=require(_0xf54f('0x6'));var controller=require(_0xf54f('0x7'));router[_0xf54f('0x8')]('/',auth[_0xf54f('0x9')](),controller[_0xf54f('0xa')]);router[_0xf54f('0x8')](_0xf54f('0xb'),auth[_0xf54f('0x9')](),controller[_0xf54f('0xc')]);router[_0xf54f('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xf54f('0xb'),auth[_0xf54f('0x9')](),controller['update']);router[_0xf54f('0xe')](_0xf54f('0xb'),auth[_0xf54f('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x90d2=['express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5baccc,_0x38dcfd){var _0x290d09=function(_0x5a63b5){while(--_0x5a63b5){_0x5baccc['push'](_0x5baccc['shift']());}};_0x290d09(++_0x38dcfd);}(_0x90d2,0x1e3));var _0x290d=function(_0x81b084,_0x3ec128){_0x81b084=_0x81b084-0x0;var _0x54df6c=_0x90d2[_0x81b084];return _0x54df6c;};'use strict';var multer=require(_0x290d('0x0'));var util=require(_0x290d('0x1'));var path=require(_0x290d('0x2'));var timeout=require('connect-timeout');var express=require(_0x290d('0x3'));var router=express[_0x290d('0x4')]();var fs_extra=require(_0x290d('0x5'));var auth=require(_0x290d('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router[_0x290d('0x7')]('/',auth[_0x290d('0x8')](),controller['index']);router['get'](_0x290d('0x9'),auth[_0x290d('0x8')](),controller[_0x290d('0xa')]);router[_0x290d('0xb')]('/',auth['isAuthenticated'](),controller[_0x290d('0xc')]);router[_0x290d('0xd')](_0x290d('0x9'),auth[_0x290d('0x8')](),controller[_0x290d('0xe')]);router[_0x290d('0xf')](_0x290d('0x9'),auth[_0x290d('0x8')](),controller[_0x290d('0x10')]);module[_0x290d('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 60a80fc..7fc57d9 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 _0x734b=['keyValue','STRING','sequelize','exports','ENUM','string','customVariable'];(function(_0x5de8bf,_0x24e115){var _0x2be3e3=function(_0x385e2c){while(--_0x385e2c){_0x5de8bf['push'](_0x5de8bf['shift']());}};_0x2be3e3(++_0x24e115);}(_0x734b,0x1c2));var _0xb734=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x734b[_0x2642cb];return _0xe6e41;};'use strict';var Sequelize=require(_0xb734('0x0'));module[_0xb734('0x1')]={'type':{'type':Sequelize[_0xb734('0x2')](_0xb734('0x3'),'variable',_0xb734('0x4'),_0xb734('0x5'),'picklist'),'defaultValue':_0xb734('0x3')},'content':{'type':Sequelize[_0xb734('0x6')]},'key':{'type':Sequelize[_0xb734('0x6')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0xb734('0x4'))},'keyContent':{'type':Sequelize[_0xb734('0x6')]},'idField':{'type':Sequelize[_0xb734('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3d20=['keyValue','STRING','customVariable','exports','ENUM','string','variable'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3d20,0x1e6));var _0x03d2=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x3d20[_0x3de8a4];return _0x4635cf;};'use strict';var Sequelize=require('sequelize');module[_0x03d2('0x0')]={'type':{'type':Sequelize[_0x03d2('0x1')](_0x03d2('0x2'),_0x03d2('0x3'),'customVariable',_0x03d2('0x4'),'picklist'),'defaultValue':_0x03d2('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x03d2('0x5')]},'keyType':{'type':Sequelize[_0x03d2('0x1')](_0x03d2('0x2'),_0x03d2('0x3'),_0x03d2('0x6'))},'keyContent':{'type':Sequelize[_0x03d2('0x5')]},'idField':{'type':Sequelize[_0x03d2('0x5')]},'nameField':{'type':Sequelize[_0x03d2('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x03d2('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index fbd916e..10bfc9e 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 _0xd404=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','filters','pick','filter','where','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv'];(function(_0x54f843,_0x53498c){var _0x6b24be=function(_0x2450b4){while(--_0x2450b4){_0x54f843['push'](_0x54f843['shift']());}};_0x6b24be(++_0x53498c);}(_0xd404,0xd2));var _0x4d40=function(_0xe9c089,_0x427ba5){_0xe9c089=_0xe9c089-0x0;var _0x4fcf73=_0xd404[_0xe9c089];return _0x4fcf73;};'use strict';var emlformat=require(_0x4d40('0x0'));var rimraf=require(_0x4d40('0x1'));var zipdir=require(_0x4d40('0x2'));var jsonpatch=require(_0x4d40('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4d40('0x4'));var Mustache=require(_0x4d40('0x5'));var util=require(_0x4d40('0x6'));var path=require(_0x4d40('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4d40('0x8'));var fs=require('fs');var fs_extra=require(_0x4d40('0x9'));var _=require(_0x4d40('0xa'));var squel=require(_0x4d40('0xb'));var crypto=require(_0x4d40('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4d40('0xd'));var toCsv=require(_0x4d40('0xe'));var querystring=require('querystring');var Papa=require(_0x4d40('0xf'));var Redis=require('ioredis');var authService=require(_0x4d40('0x10'));var qs=require(_0x4d40('0x11'));var as=require(_0x4d40('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4d40('0x13'));var utils=require(_0x4d40('0x14'));var config=require(_0x4d40('0x15'));var licenseUtil=require(_0x4d40('0x16'));var db=require(_0x4d40('0x17'))['db'];function respondWithStatusCode(_0xe121f,_0xdbb054){_0xdbb054=_0xdbb054||0xcc;return function(_0xbfbc67){if(_0xbfbc67){return _0xe121f[_0x4d40('0x18')](_0xdbb054);}return _0xe121f[_0x4d40('0x19')](_0xdbb054)['end']();};}function respondWithResult(_0x2a5c4f,_0x4fc16a){_0x4fc16a=_0x4fc16a||0xc8;return function(_0x33eb48){if(_0x33eb48){return _0x2a5c4f[_0x4d40('0x19')](_0x4fc16a)[_0x4d40('0x1a')](_0x33eb48);}};}function respondWithFilteredResult(_0x331f4e,_0x2d76fc){return function(_0xa8e446){if(_0xa8e446){var _0x2881ac=typeof _0x2d76fc[_0x4d40('0x1b')]===_0x4d40('0x1c')&&typeof _0x2d76fc[_0x4d40('0x1d')]===_0x4d40('0x1c');var _0x294aad=_0xa8e446[_0x4d40('0x1e')];var _0x416f00=_0x2881ac?0x0:_0x2d76fc['offset'];var _0x3e1033=_0x2881ac?_0xa8e446['count']:_0x2d76fc[_0x4d40('0x1b')]+_0x2d76fc[_0x4d40('0x1d')];var _0x49d7c5;if(_0x3e1033>=_0x294aad){_0x3e1033=_0x294aad;_0x49d7c5=0xc8;}else{_0x49d7c5=0xce;}_0x331f4e['status'](_0x49d7c5);return _0x331f4e[_0x4d40('0x1f')](_0x4d40('0x20'),_0x416f00+'-'+_0x3e1033+'/'+_0x294aad)[_0x4d40('0x1a')](_0xa8e446);}return null;};}function patchUpdates(_0x539b9b){return function(_0xb87bd9){try{jsonpatch[_0x4d40('0x21')](_0xb87bd9,_0x539b9b,!![]);}catch(_0x29fa82){return BPromise['reject'](_0x29fa82);}return _0xb87bd9[_0x4d40('0x22')]();};}function saveUpdates(_0x208649,_0x342688){return function(_0x1c2560){if(_0x1c2560){return _0x1c2560[_0x4d40('0x23')](_0x208649)[_0x4d40('0x24')](function(_0x3d2a72){return _0x3d2a72;});}return null;};}function removeEntity(_0x3e2722,_0x4dc49c){return function(_0x30e52c){if(_0x30e52c){return _0x30e52c[_0x4d40('0x25')]()[_0x4d40('0x24')](function(){_0x3e2722[_0x4d40('0x19')](0xcc)[_0x4d40('0x26')]();});}};}function handleEntityNotFound(_0x3abf9a,_0x4d19ea){return function(_0x3f471b){if(!_0x3f471b){_0x3abf9a[_0x4d40('0x18')](0x194);}return _0x3f471b;};}function handleError(_0x3192f5,_0x5d56d5){_0x5d56d5=_0x5d56d5||0x1f4;return function(_0xf8f265){logger[_0x4d40('0x27')](_0xf8f265['stack']);if(_0xf8f265[_0x4d40('0x28')]){delete _0xf8f265[_0x4d40('0x28')];}_0x3192f5[_0x4d40('0x19')](_0x5d56d5)[_0x4d40('0x29')](_0xf8f265);};}exports[_0x4d40('0x2a')]=function(_0x2da60b,_0x5da320){var _0x3e3e2c={},_0x57de61={},_0x2d7e4b={'count':0x0,'rows':[]};var _0x3d0c3a=_[_0x4d40('0x2b')](db[_0x4d40('0x2c')][_0x4d40('0x2d')],function(_0x568c43){return{'name':_0x568c43[_0x4d40('0x2e')],'type':_0x568c43[_0x4d40('0x2f')][_0x4d40('0x30')]};});_0x57de61['model']=_['map'](_0x3d0c3a,_0x4d40('0x28'));_0x57de61[_0x4d40('0x31')]=_[_0x4d40('0x32')](_0x2da60b[_0x4d40('0x31')]);_0x57de61['filters']=_[_0x4d40('0x33')](_0x57de61[_0x4d40('0x34')],_0x57de61[_0x4d40('0x31')]);_0x3e3e2c[_0x4d40('0x35')]=_[_0x4d40('0x33')](_0x57de61[_0x4d40('0x34')],qs[_0x4d40('0x36')](_0x2da60b[_0x4d40('0x31')][_0x4d40('0x36')]));_0x3e3e2c['attributes']=_0x3e3e2c['attributes'][_0x4d40('0x37')]?_0x3e3e2c[_0x4d40('0x35')]:_0x57de61[_0x4d40('0x34')];if(!_0x2da60b[_0x4d40('0x31')][_0x4d40('0x38')](_0x4d40('0x39'))){_0x3e3e2c['limit']=qs[_0x4d40('0x1d')](_0x2da60b[_0x4d40('0x31')][_0x4d40('0x1d')]);_0x3e3e2c['offset']=qs[_0x4d40('0x1b')](_0x2da60b[_0x4d40('0x31')][_0x4d40('0x1b')]);}_0x3e3e2c[_0x4d40('0x3a')]=qs['sort'](_0x2da60b[_0x4d40('0x31')]['sort']);_0x3e3e2c['where']=qs[_0x4d40('0x3b')](_[_0x4d40('0x3c')](_0x2da60b[_0x4d40('0x31')],_0x57de61[_0x4d40('0x3b')]),_0x3d0c3a);if(_0x2da60b[_0x4d40('0x31')][_0x4d40('0x3d')]){_0x3e3e2c[_0x4d40('0x3e')]=_[_0x4d40('0x3f')](_0x3e3e2c[_0x4d40('0x3e')],{'$or':_['map'](_0x3d0c3a,function(_0x536573){if(_0x536573[_0x4d40('0x2f')]!==_0x4d40('0x40')){var _0x26480d={};_0x26480d[_0x536573[_0x4d40('0x28')]]={'$like':'%'+_0x2da60b[_0x4d40('0x31')][_0x4d40('0x3d')]+'%'};return _0x26480d;}})});}_0x3e3e2c=_[_0x4d40('0x3f')]({},_0x3e3e2c,_0x2da60b[_0x4d40('0x41')]);var _0x397390={'where':_0x3e3e2c[_0x4d40('0x3e')]};return db[_0x4d40('0x2c')]['count'](_0x397390)[_0x4d40('0x24')](function(_0x12bc83){_0x2d7e4b[_0x4d40('0x1e')]=_0x12bc83;if(_0x2da60b[_0x4d40('0x31')]['includeAll']){_0x3e3e2c[_0x4d40('0x42')]=[{'all':!![]}];}return db[_0x4d40('0x2c')]['findAll'](_0x3e3e2c);})[_0x4d40('0x24')](function(_0x4ac7a4){_0x2d7e4b[_0x4d40('0x43')]=_0x4ac7a4;return _0x2d7e4b;})['then'](respondWithFilteredResult(_0x5da320,_0x3e3e2c))[_0x4d40('0x44')](handleError(_0x5da320,null));};exports[_0x4d40('0x45')]=function(_0x5e2f2d,_0x4647a5){var _0x17cd80={'raw':!![],'where':{'id':_0x5e2f2d[_0x4d40('0x46')]['id']}},_0x538ce0={};_0x538ce0[_0x4d40('0x34')]=_['keys'](db['ServicenowField'][_0x4d40('0x2d')]);_0x538ce0[_0x4d40('0x31')]=_[_0x4d40('0x32')](_0x5e2f2d[_0x4d40('0x31')]);_0x538ce0[_0x4d40('0x3b')]=_[_0x4d40('0x33')](_0x538ce0[_0x4d40('0x34')],_0x538ce0[_0x4d40('0x31')]);_0x17cd80[_0x4d40('0x35')]=_['intersection'](_0x538ce0['model'],qs[_0x4d40('0x36')](_0x5e2f2d[_0x4d40('0x31')][_0x4d40('0x36')]));_0x17cd80[_0x4d40('0x35')]=_0x17cd80[_0x4d40('0x35')][_0x4d40('0x37')]?_0x17cd80[_0x4d40('0x35')]:_0x538ce0[_0x4d40('0x34')];if(_0x5e2f2d[_0x4d40('0x31')][_0x4d40('0x47')]){_0x17cd80[_0x4d40('0x42')]=[{'all':!![]}];}_0x17cd80=_['merge']({},_0x17cd80,_0x5e2f2d[_0x4d40('0x41')]);return db[_0x4d40('0x2c')]['find'](_0x17cd80)['then'](handleEntityNotFound(_0x4647a5,null))[_0x4d40('0x24')](respondWithResult(_0x4647a5,null))[_0x4d40('0x44')](handleError(_0x4647a5,null));};exports['create']=function(_0x467d88,_0x5839a3){return db['ServicenowField'][_0x4d40('0x48')](_0x467d88[_0x4d40('0x49')],{})[_0x4d40('0x24')](respondWithResult(_0x5839a3,0xc9))[_0x4d40('0x44')](handleError(_0x5839a3,null));};exports[_0x4d40('0x23')]=function(_0x4c702d,_0x41926b){if(_0x4c702d['body']['id']){delete _0x4c702d[_0x4d40('0x49')]['id'];}return db[_0x4d40('0x2c')]['find']({'where':{'id':_0x4c702d[_0x4d40('0x46')]['id']}})[_0x4d40('0x24')](handleEntityNotFound(_0x41926b,null))[_0x4d40('0x24')](saveUpdates(_0x4c702d[_0x4d40('0x49')],null))['then'](respondWithResult(_0x41926b,null))[_0x4d40('0x44')](handleError(_0x41926b,null));};exports[_0x4d40('0x25')]=function(_0x2bf6fc,_0x2b1c96){return db[_0x4d40('0x2c')][_0x4d40('0x4a')]({'where':{'id':_0x2bf6fc['params']['id']}})['then'](handleEntityNotFound(_0x2b1c96,null))['then'](removeEntity(_0x2b1c96,null))[_0x4d40('0x44')](handleError(_0x2b1c96,null));}; \ No newline at end of file +var _0xf9b4=['apply','reject','update','then','destroy','error','stack','name','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','attributes','options','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range'];(function(_0x3fd737,_0x263d58){var _0x4b9e85=function(_0x2cde35){while(--_0x2cde35){_0x3fd737['push'](_0x3fd737['shift']());}};_0x4b9e85(++_0x263d58);}(_0xf9b4,0x15b));var _0x4f9b=function(_0xd4636c,_0x34dbf6){_0xd4636c=_0xd4636c-0x0;var _0x5ee17d=_0xf9b4[_0xd4636c];return _0x5ee17d;};'use strict';var emlformat=require(_0x4f9b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4f9b('0x1'));var jsonpatch=require(_0x4f9b('0x2'));var rp=require(_0x4f9b('0x3'));var moment=require(_0x4f9b('0x4'));var BPromise=require(_0x4f9b('0x5'));var Mustache=require(_0x4f9b('0x6'));var util=require(_0x4f9b('0x7'));var path=require('path');var sox=require(_0x4f9b('0x8'));var csv=require('to-csv');var ejs=require(_0x4f9b('0x9'));var fs=require('fs');var fs_extra=require(_0x4f9b('0xa'));var _=require(_0x4f9b('0xb'));var squel=require(_0x4f9b('0xc'));var crypto=require(_0x4f9b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4f9b('0xe'));var querystring=require(_0x4f9b('0xf'));var Papa=require(_0x4f9b('0x10'));var Redis=require(_0x4f9b('0x11'));var authService=require(_0x4f9b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4f9b('0x13'));var hardwareService=require(_0x4f9b('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x4f9b('0x15'));var licenseUtil=require(_0x4f9b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bc2bf,_0x6e94ed){_0x6e94ed=_0x6e94ed||0xcc;return function(_0x439ba8){if(_0x439ba8){return _0x4bc2bf[_0x4f9b('0x17')](_0x6e94ed);}return _0x4bc2bf[_0x4f9b('0x18')](_0x6e94ed)[_0x4f9b('0x19')]();};}function respondWithResult(_0x468cf7,_0x32820a){_0x32820a=_0x32820a||0xc8;return function(_0x29b3f7){if(_0x29b3f7){return _0x468cf7['status'](_0x32820a)[_0x4f9b('0x1a')](_0x29b3f7);}};}function respondWithFilteredResult(_0x394494,_0x4568ed){return function(_0xc819ff){if(_0xc819ff){var _0x1c20f3=typeof _0x4568ed['offset']===_0x4f9b('0x1b')&&typeof _0x4568ed[_0x4f9b('0x1c')]===_0x4f9b('0x1b');var _0x26d74d=_0xc819ff[_0x4f9b('0x1d')];var _0x1e3772=_0x1c20f3?0x0:_0x4568ed[_0x4f9b('0x1e')];var _0x3b9480=_0x1c20f3?_0xc819ff[_0x4f9b('0x1d')]:_0x4568ed[_0x4f9b('0x1e')]+_0x4568ed[_0x4f9b('0x1c')];var _0xdd26e5;if(_0x3b9480>=_0x26d74d){_0x3b9480=_0x26d74d;_0xdd26e5=0xc8;}else{_0xdd26e5=0xce;}_0x394494[_0x4f9b('0x18')](_0xdd26e5);return _0x394494[_0x4f9b('0x1f')](_0x4f9b('0x20'),_0x1e3772+'-'+_0x3b9480+'/'+_0x26d74d)[_0x4f9b('0x1a')](_0xc819ff);}return null;};}function patchUpdates(_0x303cd9){return function(_0x4c3c09){try{jsonpatch[_0x4f9b('0x21')](_0x4c3c09,_0x303cd9,!![]);}catch(_0x1ec8f1){return BPromise[_0x4f9b('0x22')](_0x1ec8f1);}return _0x4c3c09['save']();};}function saveUpdates(_0x24a8fd,_0x4f7f11){return function(_0x11dff3){if(_0x11dff3){return _0x11dff3[_0x4f9b('0x23')](_0x24a8fd)[_0x4f9b('0x24')](function(_0x4b87ff){return _0x4b87ff;});}return null;};}function removeEntity(_0x3202e8,_0x3af82c){return function(_0x578642){if(_0x578642){return _0x578642[_0x4f9b('0x25')]()[_0x4f9b('0x24')](function(){_0x3202e8[_0x4f9b('0x18')](0xcc)[_0x4f9b('0x19')]();});}};}function handleEntityNotFound(_0x2d475e,_0x526fb0){return function(_0x31ec22){if(!_0x31ec22){_0x2d475e[_0x4f9b('0x17')](0x194);}return _0x31ec22;};}function handleError(_0x19dff1,_0x32ce66){_0x32ce66=_0x32ce66||0x1f4;return function(_0x250835){logger[_0x4f9b('0x26')](_0x250835[_0x4f9b('0x27')]);if(_0x250835[_0x4f9b('0x28')]){delete _0x250835[_0x4f9b('0x28')];}_0x19dff1[_0x4f9b('0x18')](_0x32ce66)['send'](_0x250835);};}exports[_0x4f9b('0x29')]=function(_0x308363,_0x138980){var _0x7cef38={},_0x2a82d0={},_0x36a35d={'count':0x0,'rows':[]};var _0x18db96=_[_0x4f9b('0x2a')](db[_0x4f9b('0x2b')][_0x4f9b('0x2c')],function(_0x3bda8e){return{'name':_0x3bda8e[_0x4f9b('0x2d')],'type':_0x3bda8e[_0x4f9b('0x2e')][_0x4f9b('0x2f')]};});_0x2a82d0[_0x4f9b('0x30')]=_[_0x4f9b('0x2a')](_0x18db96,'name');_0x2a82d0[_0x4f9b('0x31')]=_[_0x4f9b('0x32')](_0x308363['query']);_0x2a82d0['filters']=_['intersection'](_0x2a82d0[_0x4f9b('0x30')],_0x2a82d0[_0x4f9b('0x31')]);_0x7cef38['attributes']=_[_0x4f9b('0x33')](_0x2a82d0[_0x4f9b('0x30')],qs['fields'](_0x308363[_0x4f9b('0x31')][_0x4f9b('0x34')]));_0x7cef38['attributes']=_0x7cef38['attributes'][_0x4f9b('0x35')]?_0x7cef38['attributes']:_0x2a82d0[_0x4f9b('0x30')];if(!_0x308363[_0x4f9b('0x31')][_0x4f9b('0x36')](_0x4f9b('0x37'))){_0x7cef38[_0x4f9b('0x1c')]=qs[_0x4f9b('0x1c')](_0x308363[_0x4f9b('0x31')][_0x4f9b('0x1c')]);_0x7cef38[_0x4f9b('0x1e')]=qs[_0x4f9b('0x1e')](_0x308363['query'][_0x4f9b('0x1e')]);}_0x7cef38[_0x4f9b('0x38')]=qs[_0x4f9b('0x39')](_0x308363['query']['sort']);_0x7cef38[_0x4f9b('0x3a')]=qs[_0x4f9b('0x3b')](_[_0x4f9b('0x3c')](_0x308363[_0x4f9b('0x31')],_0x2a82d0[_0x4f9b('0x3b')]),_0x18db96);if(_0x308363[_0x4f9b('0x31')][_0x4f9b('0x3d')]){_0x7cef38[_0x4f9b('0x3a')]=_['merge'](_0x7cef38['where'],{'$or':_[_0x4f9b('0x2a')](_0x18db96,function(_0x24231e){if(_0x24231e[_0x4f9b('0x2e')]!==_0x4f9b('0x3e')){var _0x5a92d5={};_0x5a92d5[_0x24231e[_0x4f9b('0x28')]]={'$like':'%'+_0x308363[_0x4f9b('0x31')]['filter']+'%'};return _0x5a92d5;}})});}_0x7cef38=_[_0x4f9b('0x3f')]({},_0x7cef38,_0x308363['options']);var _0x3d4b1b={'where':_0x7cef38[_0x4f9b('0x3a')]};return db['ServicenowField'][_0x4f9b('0x1d')](_0x3d4b1b)[_0x4f9b('0x24')](function(_0x5e1835){_0x36a35d[_0x4f9b('0x1d')]=_0x5e1835;if(_0x308363[_0x4f9b('0x31')][_0x4f9b('0x40')]){_0x7cef38[_0x4f9b('0x41')]=[{'all':!![]}];}return db[_0x4f9b('0x2b')][_0x4f9b('0x42')](_0x7cef38);})[_0x4f9b('0x24')](function(_0x499ebc){_0x36a35d[_0x4f9b('0x43')]=_0x499ebc;return _0x36a35d;})[_0x4f9b('0x24')](respondWithFilteredResult(_0x138980,_0x7cef38))[_0x4f9b('0x44')](handleError(_0x138980,null));};exports[_0x4f9b('0x45')]=function(_0x433608,_0x2edc2c){var _0x5d89a6={'raw':!![],'where':{'id':_0x433608[_0x4f9b('0x46')]['id']}},_0x440358={};_0x440358[_0x4f9b('0x30')]=_[_0x4f9b('0x32')](db[_0x4f9b('0x2b')][_0x4f9b('0x2c')]);_0x440358['query']=_[_0x4f9b('0x32')](_0x433608[_0x4f9b('0x31')]);_0x440358[_0x4f9b('0x3b')]=_[_0x4f9b('0x33')](_0x440358[_0x4f9b('0x30')],_0x440358[_0x4f9b('0x31')]);_0x5d89a6[_0x4f9b('0x47')]=_[_0x4f9b('0x33')](_0x440358[_0x4f9b('0x30')],qs[_0x4f9b('0x34')](_0x433608['query'][_0x4f9b('0x34')]));_0x5d89a6[_0x4f9b('0x47')]=_0x5d89a6[_0x4f9b('0x47')][_0x4f9b('0x35')]?_0x5d89a6['attributes']:_0x440358[_0x4f9b('0x30')];if(_0x433608[_0x4f9b('0x31')]['includeAll']){_0x5d89a6['include']=[{'all':!![]}];}_0x5d89a6=_[_0x4f9b('0x3f')]({},_0x5d89a6,_0x433608[_0x4f9b('0x48')]);return db[_0x4f9b('0x2b')][_0x4f9b('0x49')](_0x5d89a6)[_0x4f9b('0x24')](handleEntityNotFound(_0x2edc2c,null))[_0x4f9b('0x24')](respondWithResult(_0x2edc2c,null))[_0x4f9b('0x44')](handleError(_0x2edc2c,null));};exports[_0x4f9b('0x4a')]=function(_0x4af7ca,_0x3c7137){return db[_0x4f9b('0x2b')][_0x4f9b('0x4a')](_0x4af7ca[_0x4f9b('0x4b')],{})[_0x4f9b('0x24')](respondWithResult(_0x3c7137,0xc9))[_0x4f9b('0x44')](handleError(_0x3c7137,null));};exports[_0x4f9b('0x23')]=function(_0x555347,_0x3c00a0){if(_0x555347[_0x4f9b('0x4b')]['id']){delete _0x555347['body']['id'];}return db[_0x4f9b('0x2b')][_0x4f9b('0x49')]({'where':{'id':_0x555347['params']['id']}})['then'](handleEntityNotFound(_0x3c00a0,null))[_0x4f9b('0x24')](saveUpdates(_0x555347[_0x4f9b('0x4b')],null))[_0x4f9b('0x24')](respondWithResult(_0x3c00a0,null))[_0x4f9b('0x44')](handleError(_0x3c00a0,null));};exports[_0x4f9b('0x25')]=function(_0x16717e,_0x57d533){return db[_0x4f9b('0x2b')][_0x4f9b('0x49')]({'where':{'id':_0x16717e[_0x4f9b('0x46')]['id']}})[_0x4f9b('0x24')](handleEntityNotFound(_0x57d533,null))[_0x4f9b('0x24')](removeEntity(_0x57d533,null))['catch'](handleError(_0x57d533,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index cf5601e..9c4bf80 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 _0xa6f9=['rimraf','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x49c524,_0x2f91e8){var _0xf98507=function(_0x369f06){while(--_0x369f06){_0x49c524['push'](_0x49c524['shift']());}};_0xf98507(++_0x2f91e8);}(_0xa6f9,0x1e9));var _0x9a6f=function(_0x28c82d,_0x315860){_0x28c82d=_0x28c82d-0x0;var _0x4cb436=_0xa6f9[_0x28c82d];return _0x4cb436;};'use strict';var _=require(_0x9a6f('0x0'));var util=require('util');var logger=require(_0x9a6f('0x1'))(_0x9a6f('0x2'));var moment=require(_0x9a6f('0x3'));var BPromise=require(_0x9a6f('0x4'));var rp=require(_0x9a6f('0x5'));var fs=require('fs');var path=require(_0x9a6f('0x6'));var rimraf=require(_0x9a6f('0x7'));var config=require('../../config/environment');var attributes=require(_0x9a6f('0x8'));module[_0x9a6f('0x9')]=function(_0x1855c2,_0x529949){return _0x1855c2[_0x9a6f('0xa')](_0x9a6f('0xb'),attributes,{'tableName':_0x9a6f('0xc'),'paranoid':![],'indexes':[{'name':_0x9a6f('0xd'),'fields':[_0x9a6f('0xe'),_0x9a6f('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcfea=['bluebird','request-promise','./intServicenowField.attributes','exports','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x59a850,_0x5ea9f5){var _0x1a6a58=function(_0x4496a2){while(--_0x4496a2){_0x59a850['push'](_0x59a850['shift']());}};_0x1a6a58(++_0x5ea9f5);}(_0xcfea,0xa3));var _0xacfe=function(_0x15dcf3,_0x24d0c1){_0x15dcf3=_0x15dcf3-0x0;var _0x4d36a5=_0xcfea[_0x15dcf3];return _0x4d36a5;};'use strict';var _=require(_0xacfe('0x0'));var util=require(_0xacfe('0x1'));var logger=require(_0xacfe('0x2'))(_0xacfe('0x3'));var moment=require(_0xacfe('0x4'));var BPromise=require(_0xacfe('0x5'));var rp=require(_0xacfe('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xacfe('0x7'));module[_0xacfe('0x8')]=function(_0x24c79a,_0x18c8b8){return _0x24c79a['define'](_0xacfe('0x9'),attributes,{'tableName':_0xacfe('0xa'),'paranoid':![],'indexes':[{'name':_0xacfe('0xb'),'fields':[_0xacfe('0xc'),_0xacfe('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index d8417bf..7c788e6 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac4a=['ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xac4a,0x13f));var _0xaac4=function(_0x54db5e,_0x34b433){_0x54db5e=_0x54db5e-0x0;var _0x48e565=_0xac4a[_0x54db5e];return _0x48e565;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x59cb45,_0x29f0b2){var _0x2c97d3=function(_0x328a70){while(--_0x328a70){_0x59cb45['push'](_0x59cb45['shift']());}};_0x2c97d3(++_0x29f0b2);}(_0xb43b,0x1b2));var _0xbb43=function(_0x17e47d,_0x5cbb5d){_0x17e47d=_0x17e47d-0x0;var _0x1a237b=_0xb43b[_0x17e47d];return _0x1a237b;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index e110160..db9692f 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(_0x50688d,_0x47d8d5){var _0x2f0460=function(_0x35b4f6){while(--_0x35b4f6){_0x50688d['push'](_0x50688d['shift']());}};_0x2f0460(++_0x47d8d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x3d97af,_0x199077){var _0x26aaf9=function(_0x180c38){while(--_0x180c38){_0x3d97af['push'](_0x3d97af['shift']());}};_0x26aaf9(++_0x199077);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 808420a..7be133b 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(_0x3ec42e,_0x1a8a2c){var _0x1e2488=function(_0x933982){while(--_0x933982){_0x3ec42e['push'](_0x3ec42e['shift']());}};_0x1e2488(++_0x1a8a2c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0xd3160c,_0x2a4dda){var _0xc5dc46=function(_0xcaf0a5){while(--_0xcaf0a5){_0xd3160c['push'](_0xd3160c['shift']());}};_0xc5dc46(++_0x2a4dda);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 06126f2..ef32939 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 _0x9742=['ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','name','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','params','options','create','body','destroy','find','getConfigurations','findOne','SugarcrmConfiguration','order','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_minutes','parent_id','parent_type','direction','username','password','remoteUri','slice','substring','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv'];(function(_0x30f2ab,_0x22db97){var _0x3ca3a4=function(_0x2d1855){while(--_0x2d1855){_0x30f2ab['push'](_0x30f2ab['shift']());}};_0x3ca3a4(++_0x22db97);}(_0x9742,0x1e7));var _0x2974=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9742[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x2974('0x0'));var rimraf=require(_0x2974('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2974('0x2'));var rp=require(_0x2974('0x3'));var moment=require(_0x2974('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2974('0x5'));var util=require(_0x2974('0x6'));var path=require(_0x2974('0x7'));var sox=require('sox');var csv=require(_0x2974('0x8'));var ejs=require(_0x2974('0x9'));var fs=require('fs');var fs_extra=require(_0x2974('0xa'));var _=require(_0x2974('0xb'));var squel=require(_0x2974('0xc'));var crypto=require(_0x2974('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2974('0xe'));var toCsv=require(_0x2974('0x8'));var querystring=require('querystring');var Papa=require(_0x2974('0xf'));var Redis=require(_0x2974('0x10'));var authService=require(_0x2974('0x11'));var qs=require(_0x2974('0x12'));var as=require(_0x2974('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2974('0x14'))('api');var utils=require(_0x2974('0x15'));var config=require(_0x2974('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2974('0x17'))['db'];var integrations=require(_0x2974('0x18'));function respondWithStatusCode(_0x13eba2,_0xe691b9){_0xe691b9=_0xe691b9||0xcc;return function(_0x2f0a38){if(_0x2f0a38){return _0x13eba2['sendStatus'](_0xe691b9);}return _0x13eba2[_0x2974('0x19')](_0xe691b9)[_0x2974('0x1a')]();};}function respondWithResult(_0x44d53d,_0x4bfb35){_0x4bfb35=_0x4bfb35||0xc8;return function(_0x46a920){if(_0x46a920){return _0x44d53d[_0x2974('0x19')](_0x4bfb35)[_0x2974('0x1b')](_0x46a920);}};}function respondWithFilteredResult(_0x29ab02,_0x3cb0a0){return function(_0x328873){if(_0x328873){var _0x5e04c6=typeof _0x3cb0a0[_0x2974('0x1c')]===_0x2974('0x1d')&&typeof _0x3cb0a0[_0x2974('0x1e')]===_0x2974('0x1d');var _0x1fa138=_0x328873[_0x2974('0x1f')];var _0x4c8418=_0x5e04c6?0x0:_0x3cb0a0[_0x2974('0x1c')];var _0x1f579a=_0x5e04c6?_0x328873[_0x2974('0x1f')]:_0x3cb0a0['offset']+_0x3cb0a0[_0x2974('0x1e')];var _0x37a25b;if(_0x1f579a>=_0x1fa138){_0x1f579a=_0x1fa138;_0x37a25b=0xc8;}else{_0x37a25b=0xce;}_0x29ab02[_0x2974('0x19')](_0x37a25b);return _0x29ab02[_0x2974('0x20')](_0x2974('0x21'),_0x4c8418+'-'+_0x1f579a+'/'+_0x1fa138)['json'](_0x328873);}return null;};}function patchUpdates(_0x1d1e4d){return function(_0x67fefd){try{jsonpatch[_0x2974('0x22')](_0x67fefd,_0x1d1e4d,!![]);}catch(_0x227819){return BPromise[_0x2974('0x23')](_0x227819);}return _0x67fefd[_0x2974('0x24')]();};}function saveUpdates(_0x7eaec4,_0x426935){return function(_0x278950){if(_0x278950){return _0x278950[_0x2974('0x25')](_0x7eaec4)[_0x2974('0x26')](function(_0x1765c8){return _0x1765c8;});}return null;};}function removeEntity(_0x36f0ed,_0x25519a){return function(_0x1e0f52){if(_0x1e0f52){return _0x1e0f52['destroy']()['then'](function(){_0x36f0ed[_0x2974('0x19')](0xcc)[_0x2974('0x1a')]();});}};}function handleEntityNotFound(_0x2a888a,_0x28d056){return function(_0x5535b0){if(!_0x5535b0){_0x2a888a[_0x2974('0x27')](0x194);}return _0x5535b0;};}function handleError(_0x473b5f,_0x2418f2){_0x2418f2=_0x2418f2||0x1f4;return function(_0x4e78a2){logger[_0x2974('0x28')](_0x4e78a2['stack']);if(_0x4e78a2[_0x2974('0x29')]){delete _0x4e78a2['name'];}_0x473b5f[_0x2974('0x19')](_0x2418f2)['send'](_0x4e78a2);};}exports['index']=function(_0x57f21b,_0x4f035b){var _0x1cb5ef={},_0x21a22a={},_0x13d7e1={'count':0x0,'rows':[]};var _0x5aa8d0=_[_0x2974('0x2a')](db[_0x2974('0x2b')][_0x2974('0x2c')],function(_0x47715d){return{'name':_0x47715d[_0x2974('0x2d')],'type':_0x47715d[_0x2974('0x2e')][_0x2974('0x2f')]};});_0x21a22a[_0x2974('0x30')]=_[_0x2974('0x2a')](_0x5aa8d0,'name');_0x21a22a['query']=_[_0x2974('0x31')](_0x57f21b[_0x2974('0x32')]);_0x21a22a[_0x2974('0x33')]=_[_0x2974('0x34')](_0x21a22a[_0x2974('0x30')],_0x21a22a[_0x2974('0x32')]);_0x1cb5ef[_0x2974('0x35')]=_[_0x2974('0x34')](_0x21a22a['model'],qs[_0x2974('0x36')](_0x57f21b['query']['fields']));_0x1cb5ef[_0x2974('0x35')]=_0x1cb5ef[_0x2974('0x35')][_0x2974('0x37')]?_0x1cb5ef[_0x2974('0x35')]:_0x21a22a['model'];if(!_0x57f21b[_0x2974('0x32')][_0x2974('0x38')](_0x2974('0x39'))){_0x1cb5ef[_0x2974('0x1e')]=qs['limit'](_0x57f21b[_0x2974('0x32')][_0x2974('0x1e')]);_0x1cb5ef[_0x2974('0x1c')]=qs[_0x2974('0x1c')](_0x57f21b[_0x2974('0x32')]['offset']);}_0x1cb5ef['order']=qs['sort'](_0x57f21b[_0x2974('0x32')][_0x2974('0x3a')]);_0x1cb5ef[_0x2974('0x3b')]=qs['filters'](_[_0x2974('0x3c')](_0x57f21b[_0x2974('0x32')],_0x21a22a[_0x2974('0x33')]),_0x5aa8d0);if(_0x57f21b[_0x2974('0x32')][_0x2974('0x3d')]){_0x1cb5ef[_0x2974('0x3b')]=_['merge'](_0x1cb5ef[_0x2974('0x3b')],{'$or':_[_0x2974('0x2a')](_0x5aa8d0,function(_0x3811b6){if(_0x3811b6['type']!==_0x2974('0x3e')){var _0x190591={};_0x190591[_0x3811b6[_0x2974('0x29')]]={'$like':'%'+_0x57f21b['query'][_0x2974('0x3d')]+'%'};return _0x190591;}})});}_0x1cb5ef=_[_0x2974('0x3f')]({},_0x1cb5ef,_0x57f21b['options']);var _0x50021d={'where':_0x1cb5ef['where']};return db[_0x2974('0x2b')][_0x2974('0x1f')](_0x50021d)[_0x2974('0x26')](function(_0x125b0a){_0x13d7e1['count']=_0x125b0a;if(_0x57f21b[_0x2974('0x32')][_0x2974('0x40')]){_0x1cb5ef[_0x2974('0x41')]=[{'all':!![]}];}return db[_0x2974('0x2b')][_0x2974('0x42')](_0x1cb5ef);})[_0x2974('0x26')](function(_0x1d51dc){_0x13d7e1['rows']=_0x1d51dc;return _0x13d7e1;})[_0x2974('0x26')](respondWithFilteredResult(_0x4f035b,_0x1cb5ef))[_0x2974('0x43')](handleError(_0x4f035b,null));};exports[_0x2974('0x44')]=function(_0xb605c,_0x40438a){var _0x342e8b={'raw':![],'where':{'id':_0xb605c[_0x2974('0x45')]['id']}},_0x7a3292={};_0x7a3292[_0x2974('0x30')]=_[_0x2974('0x31')](db[_0x2974('0x2b')][_0x2974('0x2c')]);_0x7a3292[_0x2974('0x32')]=_['keys'](_0xb605c[_0x2974('0x32')]);_0x7a3292[_0x2974('0x33')]=_[_0x2974('0x34')](_0x7a3292['model'],_0x7a3292[_0x2974('0x32')]);_0x342e8b['attributes']=_[_0x2974('0x34')](_0x7a3292[_0x2974('0x30')],qs['fields'](_0xb605c[_0x2974('0x32')][_0x2974('0x36')]));_0x342e8b[_0x2974('0x35')]=_0x342e8b[_0x2974('0x35')][_0x2974('0x37')]?_0x342e8b['attributes']:_0x7a3292[_0x2974('0x30')];if(_0xb605c[_0x2974('0x32')]['includeAll']){_0x342e8b[_0x2974('0x41')]=[{'all':!![]}];}_0x342e8b=_[_0x2974('0x3f')]({},_0x342e8b,_0xb605c[_0x2974('0x46')]);return db[_0x2974('0x2b')]['find'](_0x342e8b)[_0x2974('0x26')](handleEntityNotFound(_0x40438a,null))[_0x2974('0x26')](respondWithResult(_0x40438a,null))[_0x2974('0x43')](handleError(_0x40438a,null));};exports[_0x2974('0x47')]=function(_0x494436,_0x58bfe1){return db[_0x2974('0x2b')][_0x2974('0x47')](_0x494436[_0x2974('0x48')],{})[_0x2974('0x26')](respondWithResult(_0x58bfe1,0xc9))[_0x2974('0x43')](handleError(_0x58bfe1,null));};exports[_0x2974('0x25')]=function(_0x2f55c1,_0x3d0b74){if(_0x2f55c1[_0x2974('0x48')]['id']){delete _0x2f55c1[_0x2974('0x48')]['id'];}return db[_0x2974('0x2b')]['find']({'where':{'id':_0x2f55c1['params']['id']}})['then'](handleEntityNotFound(_0x3d0b74,null))['then'](saveUpdates(_0x2f55c1[_0x2974('0x48')],null))[_0x2974('0x26')](respondWithResult(_0x3d0b74,null))[_0x2974('0x43')](handleError(_0x3d0b74,null));};exports[_0x2974('0x49')]=function(_0x389d98,_0x452f5e){return db['SugarcrmAccount'][_0x2974('0x4a')]({'where':{'id':_0x389d98[_0x2974('0x45')]['id']}})['then'](handleEntityNotFound(_0x452f5e,null))[_0x2974('0x26')](removeEntity(_0x452f5e,null))[_0x2974('0x43')](handleError(_0x452f5e,null));};exports[_0x2974('0x4b')]=function(_0x12979e,_0x13bd5c,_0xf8f76b){var _0x15634c={};var _0x5b98ff={};var _0x10a5ab;var _0x27cbe2;return db[_0x2974('0x2b')][_0x2974('0x4c')]({'where':{'id':_0x12979e[_0x2974('0x45')]['id']}})[_0x2974('0x26')](handleEntityNotFound(_0x13bd5c,null))['then'](function(_0x5ead9f){if(_0x5ead9f){_0x10a5ab=_0x5ead9f;_0x5b98ff[_0x2974('0x30')]=_[_0x2974('0x31')](db[_0x2974('0x4d')][_0x2974('0x2c')]);_0x5b98ff[_0x2974('0x32')]=_[_0x2974('0x31')](_0x12979e[_0x2974('0x32')]);_0x5b98ff[_0x2974('0x33')]=_[_0x2974('0x34')](_0x5b98ff['model'],_0x5b98ff['query']);_0x15634c[_0x2974('0x35')]=_[_0x2974('0x34')](_0x5b98ff[_0x2974('0x30')],qs[_0x2974('0x36')](_0x12979e[_0x2974('0x32')]['fields']));_0x15634c[_0x2974('0x35')]=_0x15634c[_0x2974('0x35')][_0x2974('0x37')]?_0x15634c[_0x2974('0x35')]:_0x5b98ff[_0x2974('0x30')];_0x15634c[_0x2974('0x4e')]=qs[_0x2974('0x3a')](_0x12979e[_0x2974('0x32')][_0x2974('0x3a')]);_0x15634c[_0x2974('0x3b')]=qs[_0x2974('0x33')](_[_0x2974('0x3c')](_0x12979e['query'],_0x5b98ff[_0x2974('0x33')]));if(_0x12979e[_0x2974('0x32')][_0x2974('0x3d')]){_0x15634c['where']=_[_0x2974('0x3f')](_0x15634c[_0x2974('0x3b')],{'$or':_['map'](_0x15634c[_0x2974('0x35')],function(_0x30bad3){var _0x478412={};_0x478412[_0x30bad3]={'$like':'%'+_0x12979e[_0x2974('0x32')][_0x2974('0x3d')]+'%'};return _0x478412;})});}_0x15634c=_[_0x2974('0x3f')]({},_0x15634c,_0x12979e[_0x2974('0x46')]);return _0x10a5ab[_0x2974('0x4b')](_0x15634c);}})[_0x2974('0x26')](function(_0xb32344){if(_0xb32344){_0x27cbe2=_0xb32344['length'];if(!_0x12979e['query'][_0x2974('0x38')](_0x2974('0x39'))){_0x15634c[_0x2974('0x1e')]=qs[_0x2974('0x1e')](_0x12979e[_0x2974('0x32')][_0x2974('0x1e')]);_0x15634c['offset']=qs[_0x2974('0x1c')](_0x12979e[_0x2974('0x32')][_0x2974('0x1c')]);}return _0x10a5ab['getConfigurations'](_0x15634c);}})['then'](function(_0x4dc0d0){if(_0x4dc0d0){return _0x4dc0d0?{'count':_0x27cbe2,'rows':_0x4dc0d0}:null;}})[_0x2974('0x26')](respondWithResult(_0x13bd5c,null))[_0x2974('0x43')](handleError(_0x13bd5c,null));};exports['addConfiguration']=function(_0x1aa437,_0xe8ade3,_0x3dcf61){if(_0x1aa437[_0x2974('0x48')]['id']){delete _0x1aa437[_0x2974('0x48')]['id'];}return db[_0x2974('0x2b')][_0x2974('0x4c')]({'where':{'id':_0x1aa437[_0x2974('0x45')]['id']}})[_0x2974('0x26')](handleEntityNotFound(_0xe8ade3,null))['then'](function(_0x2ea5fd){if(_0x2ea5fd){_0x1aa437[_0x2974('0x48')][_0x2974('0x4f')]=_0x2ea5fd['id'];_0x1aa437[_0x2974('0x48')][_0x2974('0x50')]=integrations[_0x2974('0x51')](_0x1aa437['body']['channel'],_0x1aa437[_0x2974('0x48')][_0x2974('0x2e')]);_0x1aa437[_0x2974('0x48')][_0x2974('0x52')]=integrations[_0x2974('0x53')](_0x1aa437[_0x2974('0x48')][_0x2974('0x54')],_0x1aa437[_0x2974('0x48')][_0x2974('0x2e')]);return db['SugarcrmConfiguration']['create'](_0x1aa437['body'],{'include':[{'model':db[_0x2974('0x55')],'as':_0x2974('0x50')},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})[_0x2974('0x26')](respondWithResult(_0xe8ade3,null))[_0x2974('0x43')](handleError(_0xe8ade3,null));};exports[_0x2974('0x56')]=function(_0x2a7367,_0x4539e5,_0x3e13bd){var _0x4c28f8='';var _0x5a61a5=['id',_0x2974('0x29'),_0x2974('0x57'),_0x2974('0x58'),_0x2974('0x59'),_0x2974('0x5a'),'duration_hours',_0x2974('0x5b'),_0x2974('0x5c'),_0x2974('0x5d'),'parent_name',_0x2974('0x5e')];return db['SugarcrmAccount'][_0x2974('0x4c')]({'where':{'id':_0x2a7367[_0x2974('0x45')]['id']},'attributes':['id',_0x2974('0x5f'),_0x2974('0x60'),_0x2974('0x61')]})[_0x2974('0x26')](handleEntityNotFound(_0x4539e5,null))['then'](function(_0x11a72f){if(_0x11a72f){_0x4c28f8=_0x11a72f[_0x2974('0x61')];var _0x258fb6=_0x4c28f8[_0x2974('0x62')](-0x1);if(_0x258fb6==='/'){_0x4c28f8=_0x4c28f8[_0x2974('0x63')](0x0,_0x4c28f8['lastIndexOf'](_0x258fb6));}return rp({'method':_0x2974('0x64'),'uri':util[_0x2974('0x65')](_0x2974('0x66'),_0x4c28f8,_0x2974('0x67')),'json':!![],'form':{'method':_0x2974('0x68'),'input_type':_0x2974('0x69'),'response_type':_0x2974('0x69'),'rest_data':JSON[_0x2974('0x6a')]({'user_auth':{'user_name':_0x11a72f[_0x2974('0x5f')],'password':_0x11a72f[_0x2974('0x60')],'encryption':_0x2974('0x6b')},'application':_0x2974('0x6c')})}});}})[_0x2974('0x26')](function(_0x2eaaa9){if(_0x2eaaa9&&_0x2eaaa9[_0x2974('0x29')]!==_0x2974('0x6d')&&_0x2eaaa9[_0x2974('0x29')]!==_0x2974('0x6e')){return rp({'method':_0x2974('0x64'),'uri':util[_0x2974('0x65')](_0x2974('0x66'),_0x4c28f8,_0x2974('0x67')),'json':!![],'form':{'method':_0x2974('0x6f'),'input_type':_0x2974('0x69'),'response_type':_0x2974('0x69'),'rest_data':JSON[_0x2974('0x6a')]({'session':_0x2eaaa9['id'],'module_name':_0x2974('0x70')})}})[_0x2974('0x26')](function(_0x52e0f4){if(_0x52e0f4){var _0x4db29e=_[_0x2974('0x71')](_0x52e0f4[_0x2974('0x72')]);_[_0x2974('0x73')](_0x4db29e,function(_0x2b0019){return _0x5a61a5[_0x2974('0x74')](_0x2b0019['name']);});return{'count':_0x4db29e[_0x2974('0x37')],'rows':_[_0x2974('0x2a')](_0x4db29e,function(_0x5898f5){return{'id':_0x5898f5[_0x2974('0x29')],'name':_0x5898f5[_0x2974('0x75')],'custom':_[_0x2974('0x76')](_0x5898f5[_0x2974('0x29')],'_c')?!![]:![],'options':_0x5898f5[_0x2974('0x46')]?_[_0x2974('0x2a')](_['values'](_0x5898f5[_0x2974('0x46')]),function(_0x1ad607){return{'name':_0x1ad607[_0x2974('0x77')],'value':_0x1ad607[_0x2974('0x29')]};}):[]};})};}})[_0x2974('0x26')](respondWithResult(_0x4539e5,null))[_0x2974('0x43')](function(_0x4654d8){var _0x12db9e=_0x2a7367['query'][_0x2974('0x78')]?0x1f4:_0x4654d8[_0x2974('0x79')]||0x1f4;logger[_0x2974('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0x2974('0x56'),_0x12db9e,JSON[_0x2974('0x6a')](_0x4654d8));delete _0x4654d8['name'];if(_0x12db9e===0x191){_0x12db9e=0x190;}_0x4539e5[_0x2974('0x19')](_0x12db9e)[_0x2974('0x7a')](_0x2a7367[_0x2974('0x32')][_0x2974('0x78')]?{'message':_0x2974('0x7b'),'statusCode':_0x4654d8[_0x2974('0x79')]}:_0x4654d8);});}else{var _0x172558=0x1f4;_0x4539e5['status'](_0x172558)[_0x2974('0x7a')]({'message':_0x2974('0x7b'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x7067=['status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmAccount','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','AccountId','Subjects','channel','Descriptions','SugarcrmField','getFields','created_by','description','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','Calls','module_fields','remove','includes','label','endsWith','values','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end'];(function(_0x4eabb7,_0x546626){var _0x1cedae=function(_0x4a01ab){while(--_0x4a01ab){_0x4eabb7['push'](_0x4eabb7['shift']());}};_0x1cedae(++_0x546626);}(_0x7067,0x14e));var _0x7706=function(_0x23d109,_0x31653a){_0x23d109=_0x23d109-0x0;var _0x3cf198=_0x7067[_0x23d109];return _0x3cf198;};'use strict';var emlformat=require(_0x7706('0x0'));var rimraf=require(_0x7706('0x1'));var zipdir=require(_0x7706('0x2'));var jsonpatch=require(_0x7706('0x3'));var rp=require(_0x7706('0x4'));var moment=require('moment');var BPromise=require(_0x7706('0x5'));var Mustache=require(_0x7706('0x6'));var util=require(_0x7706('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7706('0x8'));var ejs=require(_0x7706('0x9'));var fs=require('fs');var fs_extra=require(_0x7706('0xa'));var _=require(_0x7706('0xb'));var squel=require(_0x7706('0xc'));var crypto=require(_0x7706('0xd'));var jsforce=require(_0x7706('0xe'));var deskjs=require(_0x7706('0xf'));var toCsv=require(_0x7706('0x8'));var querystring=require('querystring');var Papa=require(_0x7706('0x10'));var Redis=require(_0x7706('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7706('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7706('0x13'));var logger=require(_0x7706('0x14'))(_0x7706('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7706('0x16'));var db=require(_0x7706('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5796c4,_0xf7574f){_0xf7574f=_0xf7574f||0xcc;return function(_0x3d8991){if(_0x3d8991){return _0x5796c4[_0x7706('0x18')](_0xf7574f);}return _0x5796c4['status'](_0xf7574f)[_0x7706('0x19')]();};}function respondWithResult(_0x41f162,_0x29959a){_0x29959a=_0x29959a||0xc8;return function(_0x170571){if(_0x170571){return _0x41f162[_0x7706('0x1a')](_0x29959a)[_0x7706('0x1b')](_0x170571);}};}function respondWithFilteredResult(_0x2660e5,_0x45f697){return function(_0x4d5e69){if(_0x4d5e69){var _0x4c42f9=typeof _0x45f697[_0x7706('0x1c')]===_0x7706('0x1d')&&typeof _0x45f697[_0x7706('0x1e')]===_0x7706('0x1d');var _0x45cb42=_0x4d5e69[_0x7706('0x1f')];var _0x257e97=_0x4c42f9?0x0:_0x45f697['offset'];var _0x2bb311=_0x4c42f9?_0x4d5e69['count']:_0x45f697[_0x7706('0x1c')]+_0x45f697['limit'];var _0x214ded;if(_0x2bb311>=_0x45cb42){_0x2bb311=_0x45cb42;_0x214ded=0xc8;}else{_0x214ded=0xce;}_0x2660e5[_0x7706('0x1a')](_0x214ded);return _0x2660e5['set'](_0x7706('0x20'),_0x257e97+'-'+_0x2bb311+'/'+_0x45cb42)[_0x7706('0x1b')](_0x4d5e69);}return null;};}function patchUpdates(_0x49553a){return function(_0x29fb22){try{jsonpatch[_0x7706('0x21')](_0x29fb22,_0x49553a,!![]);}catch(_0x25b9db){return BPromise['reject'](_0x25b9db);}return _0x29fb22[_0x7706('0x22')]();};}function saveUpdates(_0x16eab4,_0x3561aa){return function(_0x1f3411){if(_0x1f3411){return _0x1f3411[_0x7706('0x23')](_0x16eab4)[_0x7706('0x24')](function(_0x4648f1){return _0x4648f1;});}return null;};}function removeEntity(_0x484b51,_0x394ece){return function(_0x2d97b3){if(_0x2d97b3){return _0x2d97b3[_0x7706('0x25')]()[_0x7706('0x24')](function(){_0x484b51[_0x7706('0x1a')](0xcc)[_0x7706('0x19')]();});}};}function handleEntityNotFound(_0xf18ccb,_0x105594){return function(_0x13766b){if(!_0x13766b){_0xf18ccb[_0x7706('0x18')](0x194);}return _0x13766b;};}function handleError(_0x26bf9e,_0x2c64cb){_0x2c64cb=_0x2c64cb||0x1f4;return function(_0x51c89a){logger[_0x7706('0x26')](_0x51c89a[_0x7706('0x27')]);if(_0x51c89a[_0x7706('0x28')]){delete _0x51c89a[_0x7706('0x28')];}_0x26bf9e[_0x7706('0x1a')](_0x2c64cb)[_0x7706('0x29')](_0x51c89a);};}exports[_0x7706('0x2a')]=function(_0x5795b4,_0x300d66){var _0x2eb452={},_0x3d1c9f={},_0x2924db={'count':0x0,'rows':[]};var _0x2218b8=_[_0x7706('0x2b')](db[_0x7706('0x2c')]['rawAttributes'],function(_0x57aa12){return{'name':_0x57aa12[_0x7706('0x2d')],'type':_0x57aa12['type'][_0x7706('0x2e')]};});_0x3d1c9f[_0x7706('0x2f')]=_[_0x7706('0x2b')](_0x2218b8,_0x7706('0x28'));_0x3d1c9f[_0x7706('0x30')]=_[_0x7706('0x31')](_0x5795b4[_0x7706('0x30')]);_0x3d1c9f[_0x7706('0x32')]=_['intersection'](_0x3d1c9f[_0x7706('0x2f')],_0x3d1c9f[_0x7706('0x30')]);_0x2eb452['attributes']=_[_0x7706('0x33')](_0x3d1c9f[_0x7706('0x2f')],qs[_0x7706('0x34')](_0x5795b4[_0x7706('0x30')]['fields']));_0x2eb452[_0x7706('0x35')]=_0x2eb452[_0x7706('0x35')][_0x7706('0x36')]?_0x2eb452['attributes']:_0x3d1c9f['model'];if(!_0x5795b4[_0x7706('0x30')][_0x7706('0x37')](_0x7706('0x38'))){_0x2eb452['limit']=qs['limit'](_0x5795b4[_0x7706('0x30')]['limit']);_0x2eb452[_0x7706('0x1c')]=qs[_0x7706('0x1c')](_0x5795b4[_0x7706('0x30')][_0x7706('0x1c')]);}_0x2eb452['order']=qs[_0x7706('0x39')](_0x5795b4['query']['sort']);_0x2eb452[_0x7706('0x3a')]=qs[_0x7706('0x32')](_[_0x7706('0x3b')](_0x5795b4[_0x7706('0x30')],_0x3d1c9f['filters']),_0x2218b8);if(_0x5795b4[_0x7706('0x30')]['filter']){_0x2eb452[_0x7706('0x3a')]=_[_0x7706('0x3c')](_0x2eb452['where'],{'$or':_[_0x7706('0x2b')](_0x2218b8,function(_0x40b7d4){if(_0x40b7d4[_0x7706('0x3d')]!==_0x7706('0x3e')){var _0x5b0a01={};_0x5b0a01[_0x40b7d4[_0x7706('0x28')]]={'$like':'%'+_0x5795b4[_0x7706('0x30')]['filter']+'%'};return _0x5b0a01;}})});}_0x2eb452=_[_0x7706('0x3c')]({},_0x2eb452,_0x5795b4[_0x7706('0x3f')]);var _0x27c24f={'where':_0x2eb452[_0x7706('0x3a')]};return db[_0x7706('0x2c')][_0x7706('0x1f')](_0x27c24f)[_0x7706('0x24')](function(_0x1ddc68){_0x2924db['count']=_0x1ddc68;if(_0x5795b4['query'][_0x7706('0x40')]){_0x2eb452[_0x7706('0x41')]=[{'all':!![]}];}return db[_0x7706('0x2c')][_0x7706('0x42')](_0x2eb452);})[_0x7706('0x24')](function(_0x420389){_0x2924db['rows']=_0x420389;return _0x2924db;})[_0x7706('0x24')](respondWithFilteredResult(_0x300d66,_0x2eb452))[_0x7706('0x43')](handleError(_0x300d66,null));};exports[_0x7706('0x44')]=function(_0x13c57e,_0x3ed077){var _0x3878c4={'raw':![],'where':{'id':_0x13c57e[_0x7706('0x45')]['id']}},_0x1650bd={};_0x1650bd[_0x7706('0x2f')]=_[_0x7706('0x31')](db[_0x7706('0x2c')][_0x7706('0x46')]);_0x1650bd['query']=_[_0x7706('0x31')](_0x13c57e[_0x7706('0x30')]);_0x1650bd['filters']=_['intersection'](_0x1650bd[_0x7706('0x2f')],_0x1650bd['query']);_0x3878c4[_0x7706('0x35')]=_[_0x7706('0x33')](_0x1650bd['model'],qs[_0x7706('0x34')](_0x13c57e['query']['fields']));_0x3878c4[_0x7706('0x35')]=_0x3878c4[_0x7706('0x35')]['length']?_0x3878c4[_0x7706('0x35')]:_0x1650bd[_0x7706('0x2f')];if(_0x13c57e[_0x7706('0x30')][_0x7706('0x40')]){_0x3878c4[_0x7706('0x41')]=[{'all':!![]}];}_0x3878c4=_[_0x7706('0x3c')]({},_0x3878c4,_0x13c57e[_0x7706('0x3f')]);return db[_0x7706('0x2c')][_0x7706('0x47')](_0x3878c4)[_0x7706('0x24')](handleEntityNotFound(_0x3ed077,null))['then'](respondWithResult(_0x3ed077,null))[_0x7706('0x43')](handleError(_0x3ed077,null));};exports[_0x7706('0x48')]=function(_0x2c05a1,_0x32a74e){return db[_0x7706('0x2c')][_0x7706('0x48')](_0x2c05a1['body'],{})[_0x7706('0x24')](respondWithResult(_0x32a74e,0xc9))[_0x7706('0x43')](handleError(_0x32a74e,null));};exports[_0x7706('0x23')]=function(_0x17a46c,_0x296b93){if(_0x17a46c[_0x7706('0x49')]['id']){delete _0x17a46c[_0x7706('0x49')]['id'];}return db[_0x7706('0x2c')]['find']({'where':{'id':_0x17a46c[_0x7706('0x45')]['id']}})[_0x7706('0x24')](handleEntityNotFound(_0x296b93,null))[_0x7706('0x24')](saveUpdates(_0x17a46c[_0x7706('0x49')],null))['then'](respondWithResult(_0x296b93,null))['catch'](handleError(_0x296b93,null));};exports[_0x7706('0x25')]=function(_0x2efb60,_0x58637f){return db[_0x7706('0x2c')][_0x7706('0x47')]({'where':{'id':_0x2efb60[_0x7706('0x45')]['id']}})[_0x7706('0x24')](handleEntityNotFound(_0x58637f,null))[_0x7706('0x24')](removeEntity(_0x58637f,null))[_0x7706('0x43')](handleError(_0x58637f,null));};exports[_0x7706('0x4a')]=function(_0x1c01ce,_0x1a245a,_0x1c7827){var _0x8ac50d={};var _0x466e99={};var _0x241941;var _0xac4188;return db['SugarcrmAccount'][_0x7706('0x4b')]({'where':{'id':_0x1c01ce[_0x7706('0x45')]['id']}})[_0x7706('0x24')](handleEntityNotFound(_0x1a245a,null))[_0x7706('0x24')](function(_0x434efc){if(_0x434efc){_0x241941=_0x434efc;_0x466e99[_0x7706('0x2f')]=_[_0x7706('0x31')](db[_0x7706('0x4c')][_0x7706('0x46')]);_0x466e99[_0x7706('0x30')]=_[_0x7706('0x31')](_0x1c01ce[_0x7706('0x30')]);_0x466e99[_0x7706('0x32')]=_[_0x7706('0x33')](_0x466e99[_0x7706('0x2f')],_0x466e99['query']);_0x8ac50d['attributes']=_[_0x7706('0x33')](_0x466e99[_0x7706('0x2f')],qs[_0x7706('0x34')](_0x1c01ce['query'][_0x7706('0x34')]));_0x8ac50d['attributes']=_0x8ac50d['attributes'][_0x7706('0x36')]?_0x8ac50d[_0x7706('0x35')]:_0x466e99[_0x7706('0x2f')];_0x8ac50d['order']=qs[_0x7706('0x39')](_0x1c01ce[_0x7706('0x30')]['sort']);_0x8ac50d[_0x7706('0x3a')]=qs[_0x7706('0x32')](_[_0x7706('0x3b')](_0x1c01ce[_0x7706('0x30')],_0x466e99['filters']));if(_0x1c01ce[_0x7706('0x30')]['filter']){_0x8ac50d[_0x7706('0x3a')]=_[_0x7706('0x3c')](_0x8ac50d[_0x7706('0x3a')],{'$or':_['map'](_0x8ac50d['attributes'],function(_0x2c6434){var _0x61b531={};_0x61b531[_0x2c6434]={'$like':'%'+_0x1c01ce[_0x7706('0x30')]['filter']+'%'};return _0x61b531;})});}_0x8ac50d=_[_0x7706('0x3c')]({},_0x8ac50d,_0x1c01ce['options']);return _0x241941[_0x7706('0x4a')](_0x8ac50d);}})['then'](function(_0x9ea9c5){if(_0x9ea9c5){_0xac4188=_0x9ea9c5['length'];if(!_0x1c01ce['query'][_0x7706('0x37')]('nolimit')){_0x8ac50d[_0x7706('0x1e')]=qs[_0x7706('0x1e')](_0x1c01ce[_0x7706('0x30')]['limit']);_0x8ac50d[_0x7706('0x1c')]=qs['offset'](_0x1c01ce[_0x7706('0x30')][_0x7706('0x1c')]);}return _0x241941[_0x7706('0x4a')](_0x8ac50d);}})[_0x7706('0x24')](function(_0x15a5d1){if(_0x15a5d1){return _0x15a5d1?{'count':_0xac4188,'rows':_0x15a5d1}:null;}})[_0x7706('0x24')](respondWithResult(_0x1a245a,null))['catch'](handleError(_0x1a245a,null));};exports['addConfiguration']=function(_0x17b10b,_0x1c0357,_0x19f6f9){if(_0x17b10b['body']['id']){delete _0x17b10b[_0x7706('0x49')]['id'];}return db[_0x7706('0x2c')][_0x7706('0x4b')]({'where':{'id':_0x17b10b['params']['id']}})['then'](handleEntityNotFound(_0x1c0357,null))[_0x7706('0x24')](function(_0x2f8d92){if(_0x2f8d92){_0x17b10b[_0x7706('0x49')][_0x7706('0x4d')]=_0x2f8d92['id'];_0x17b10b[_0x7706('0x49')][_0x7706('0x4e')]=integrations['getSubjects'](_0x17b10b['body'][_0x7706('0x4f')],_0x17b10b['body']['type']);_0x17b10b[_0x7706('0x49')][_0x7706('0x50')]=integrations['getDescriptions'](_0x17b10b[_0x7706('0x49')]['channel'],_0x17b10b['body'][_0x7706('0x3d')]);return db[_0x7706('0x4c')]['create'](_0x17b10b[_0x7706('0x49')],{'include':[{'model':db[_0x7706('0x51')],'as':_0x7706('0x4e')},{'model':db[_0x7706('0x51')],'as':_0x7706('0x50')}]});}return null;})['then'](respondWithResult(_0x1c0357,null))['catch'](handleError(_0x1c0357,null));};exports[_0x7706('0x52')]=function(_0x5d2821,_0x3051c6,_0x36caae){var _0x28d426='';var _0xb2f62f=['id',_0x7706('0x28'),'assigned_user_id',_0x7706('0x53'),_0x7706('0x54'),_0x7706('0x55'),_0x7706('0x56'),_0x7706('0x57'),'parent_id',_0x7706('0x58'),_0x7706('0x59'),_0x7706('0x5a')];return db[_0x7706('0x2c')][_0x7706('0x4b')]({'where':{'id':_0x5d2821['params']['id']},'attributes':['id',_0x7706('0x5b'),_0x7706('0x5c'),_0x7706('0x5d')]})[_0x7706('0x24')](handleEntityNotFound(_0x3051c6,null))[_0x7706('0x24')](function(_0x34711f){if(_0x34711f){_0x28d426=_0x34711f[_0x7706('0x5d')];var _0x19bb6f=_0x28d426[_0x7706('0x5e')](-0x1);if(_0x19bb6f==='/'){_0x28d426=_0x28d426[_0x7706('0x5f')](0x0,_0x28d426[_0x7706('0x60')](_0x19bb6f));}return rp({'method':_0x7706('0x61'),'uri':util[_0x7706('0x62')](_0x7706('0x63'),_0x28d426,_0x7706('0x64')),'json':!![],'form':{'method':_0x7706('0x65'),'input_type':_0x7706('0x66'),'response_type':_0x7706('0x66'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x34711f[_0x7706('0x5b')],'password':_0x34711f['password'],'encryption':_0x7706('0x67')},'application':_0x7706('0x68')})}});}})[_0x7706('0x24')](function(_0x442652){if(_0x442652&&_0x442652[_0x7706('0x28')]!==_0x7706('0x69')&&_0x442652[_0x7706('0x28')]!==_0x7706('0x6a')){return rp({'method':_0x7706('0x61'),'uri':util[_0x7706('0x62')](_0x7706('0x63'),_0x28d426,_0x7706('0x64')),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x442652['id'],'module_name':_0x7706('0x6b')})}})[_0x7706('0x24')](function(_0x2fe908){if(_0x2fe908){var _0x579414=_['values'](_0x2fe908[_0x7706('0x6c')]);_[_0x7706('0x6d')](_0x579414,function(_0xa9d140){return _0xb2f62f[_0x7706('0x6e')](_0xa9d140['name']);});return{'count':_0x579414[_0x7706('0x36')],'rows':_['map'](_0x579414,function(_0x5810d5){return{'id':_0x5810d5[_0x7706('0x28')],'name':_0x5810d5[_0x7706('0x6f')],'custom':_[_0x7706('0x70')](_0x5810d5['name'],'_c')?!![]:![],'options':_0x5810d5[_0x7706('0x3f')]?_['map'](_[_0x7706('0x71')](_0x5810d5[_0x7706('0x3f')]),function(_0x2dbba5){return{'name':_0x2dbba5[_0x7706('0x72')],'value':_0x2dbba5['name']};}):[]};})};}})[_0x7706('0x24')](respondWithResult(_0x3051c6,null))[_0x7706('0x43')](function(_0x4c7e47){var _0x303ccf=_0x5d2821['query']['test']?0x1f4:_0x4c7e47[_0x7706('0x73')]||0x1f4;logger[_0x7706('0x26')](_0x7706('0x74'),_0x7706('0x52'),_0x303ccf,JSON[_0x7706('0x75')](_0x4c7e47));delete _0x4c7e47[_0x7706('0x28')];if(_0x303ccf===0x191){_0x303ccf=0x190;}_0x3051c6[_0x7706('0x1a')](_0x303ccf)[_0x7706('0x29')](_0x5d2821['query'][_0x7706('0x76')]?{'message':_0x7706('0x77'),'statusCode':_0x4c7e47[_0x7706('0x73')]}:_0x4c7e47);});}else{var _0x8c8fa2=0x1f4;_0x3051c6[_0x7706('0x1a')](_0x8c8fa2)['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 f3a65e1..4f825bb 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 _0x633b=['../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x9b5b4e,_0x22de08){var _0x61cfb8=function(_0x3a6179){while(--_0x3a6179){_0x9b5b4e['push'](_0x9b5b4e['shift']());}};_0x61cfb8(++_0x22de08);}(_0x633b,0xd8));var _0xb633=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x633b[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb633('0x0'));var util=require(_0xb633('0x1'));var logger=require(_0xb633('0x2'))(_0xb633('0x3'));var moment=require(_0xb633('0x4'));var BPromise=require('bluebird');var rp=require(_0xb633('0x5'));var fs=require('fs');var path=require(_0xb633('0x6'));var rimraf=require(_0xb633('0x7'));var config=require(_0xb633('0x8'));var attributes=require(_0xb633('0x9'));var integrations=require(_0xb633('0xa'));module[_0xb633('0xb')]=function(_0x4f75e7,_0x1c01bd){return _0x4f75e7[_0xb633('0xc')]('SugarcrmAccount',attributes,{'tableName':_0xb633('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd14=['api','request-promise','path','../../config/environment','exports','SugarcrmAccount','../../config/logger'];(function(_0x538eba,_0x45db37){var _0x73b3c2=function(_0xb0f139){while(--_0xb0f139){_0x538eba['push'](_0x538eba['shift']());}};_0x73b3c2(++_0x45db37);}(_0xfd14,0x195));var _0x4fd1=function(_0x36a859,_0x1b1ef4){_0x36a859=_0x36a859-0x0;var _0x2ebb7d=_0xfd14[_0x36a859];return _0x2ebb7d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4fd1('0x0'))(_0x4fd1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4fd1('0x2'));var fs=require('fs');var path=require(_0x4fd1('0x3'));var rimraf=require('rimraf');var config=require(_0x4fd1('0x4'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x4fd1('0x5')]=function(_0x4ab501,_0x8c53bc){return _0x4ab501['define'](_0x4fd1('0x6'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index cf08e41..1596d2b 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 _0x2468=['catch','GetSugarcrmAccount','findAll','options','attributes','limit','include','map','model','SugarcrmAccount','raw','where','ShowSugarcrmAccount','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result'];(function(_0x14be19,_0x3067bb){var _0x240fb4=function(_0x58a3b9){while(--_0x58a3b9){_0x14be19['push'](_0x14be19['shift']());}};_0x240fb4(++_0x3067bb);}(_0x2468,0x18f));var _0x8246=function(_0x8ba19a,_0x1d2b2b){_0x8ba19a=_0x8ba19a-0x0;var _0x2bd8b4=_0x2468[_0x8ba19a];return _0x2bd8b4;};'use strict';var _=require(_0x8246('0x0'));var util=require(_0x8246('0x1'));var moment=require(_0x8246('0x2'));var BPromise=require(_0x8246('0x3'));var rs=require(_0x8246('0x4'));var fs=require('fs');var Redis=require(_0x8246('0x5'));var db=require(_0x8246('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8246('0x7'));var config=require(_0x8246('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8246('0x9')][_0x8246('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55501e,_0x526254,_0x347b62){return new BPromise(function(_0x4e8b19,_0x429de9){return client[_0x8246('0xb')](_0x55501e,_0x347b62)[_0x8246('0xc')](function(_0x400c8f){logger['info'](_0x8246('0xd'),_0x526254,_0x8246('0xe'));logger['debug'](_0x8246('0xf'),_0x526254,_0x8246('0xe'),JSON[_0x8246('0x10')](_0x400c8f));if(_0x400c8f[_0x8246('0x11')]){if(_0x400c8f[_0x8246('0x11')]['code']===0x1f4){logger[_0x8246('0x11')](_0x8246('0xd'),_0x526254,_0x400c8f['error'][_0x8246('0x12')]);return _0x429de9(_0x400c8f['error']['message']);}logger[_0x8246('0x11')](_0x8246('0xd'),_0x526254,_0x400c8f['error'][_0x8246('0x12')]);return _0x4e8b19(_0x400c8f[_0x8246('0x11')]['message']);}else{logger[_0x8246('0x13')](_0x8246('0xd'),_0x526254,_0x8246('0xe'));_0x4e8b19(_0x400c8f[_0x8246('0x14')][_0x8246('0x12')]);}})[_0x8246('0x15')](function(_0x8853a4){logger[_0x8246('0x11')](_0x8246('0xd'),_0x526254,_0x8853a4);_0x429de9(_0x8853a4);});});}exports[_0x8246('0x16')]=function(_0x540227){var _0x406157=this;return new Promise(function(_0x369ef0,_0x36aeb2){return db['SugarcrmAccount'][_0x8246('0x17')]({'raw':_0x540227[_0x8246('0x18')]?_0x540227[_0x8246('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x540227['options']?_0x540227[_0x8246('0x18')]['where']||null:null,'attributes':_0x540227['options']?_0x540227[_0x8246('0x18')][_0x8246('0x19')]||null:null,'limit':_0x540227[_0x8246('0x18')]?_0x540227['options'][_0x8246('0x1a')]||null:null,'include':_0x540227['options']?_0x540227[_0x8246('0x18')][_0x8246('0x1b')]?_[_0x8246('0x1c')](_0x540227['options'][_0x8246('0x1b')],function(_0x44ea5f){return{'model':db[_0x44ea5f['model']],'as':_0x44ea5f['as'],'attributes':_0x44ea5f[_0x8246('0x19')],'include':_0x44ea5f[_0x8246('0x1b')]?_['map'](_0x44ea5f[_0x8246('0x1b')],function(_0x3a664b){return{'model':db[_0x3a664b[_0x8246('0x1d')]],'as':_0x3a664b['as'],'attributes':_0x3a664b['attributes'],'include':_0x3a664b[_0x8246('0x1b')]?_[_0x8246('0x1c')](_0x3a664b[_0x8246('0x1b')],function(_0x5f06b5){return{'model':db[_0x5f06b5[_0x8246('0x1d')]],'as':_0x5f06b5['as'],'attributes':_0x5f06b5['attributes']};}):[]};}):[]};}):[]:[]})[_0x8246('0xc')](function(_0x3cc46b){logger[_0x8246('0x13')](_0x8246('0x16'),_0x540227);logger['debug'](_0x8246('0x16'),_0x540227,JSON[_0x8246('0x10')](_0x3cc46b));_0x369ef0(_0x3cc46b);})[_0x8246('0x15')](function(_0x279ed6){logger[_0x8246('0x11')](_0x8246('0x16'),_0x279ed6[_0x8246('0x12')],_0x540227);_0x36aeb2(_0x406157[_0x8246('0x11')](0x1f4,_0x279ed6[_0x8246('0x12')]));});});};exports['ShowSugarcrmAccount']=function(_0x13339e){var _0x24ec56=this;return new Promise(function(_0xe969c2,_0x2596cf){return db[_0x8246('0x1e')]['find']({'raw':_0x13339e[_0x8246('0x18')]?_0x13339e[_0x8246('0x18')][_0x8246('0x1f')]===undefined?!![]:![]:!![],'where':_0x13339e['options']?_0x13339e[_0x8246('0x18')][_0x8246('0x20')]||null:null,'attributes':_0x13339e[_0x8246('0x18')]?_0x13339e['options']['attributes']||null:null,'include':_0x13339e['options']?_0x13339e[_0x8246('0x18')][_0x8246('0x1b')]?_['map'](_0x13339e['options'][_0x8246('0x1b')],function(_0x44ebb4){return{'model':db[_0x44ebb4[_0x8246('0x1d')]],'as':_0x44ebb4['as'],'attributes':_0x44ebb4['attributes'],'include':_0x44ebb4['include']?_['map'](_0x44ebb4[_0x8246('0x1b')],function(_0x3f43ba){return{'model':db[_0x3f43ba[_0x8246('0x1d')]],'as':_0x3f43ba['as'],'attributes':_0x3f43ba[_0x8246('0x19')],'include':_0x3f43ba[_0x8246('0x1b')]?_['map'](_0x3f43ba[_0x8246('0x1b')],function(_0x405470){return{'model':db[_0x405470[_0x8246('0x1d')]],'as':_0x405470['as'],'attributes':_0x405470[_0x8246('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8246('0xc')](function(_0x419019){logger[_0x8246('0x13')](_0x8246('0x21'),_0x13339e);logger[_0x8246('0x22')](_0x8246('0x21'),_0x13339e,JSON[_0x8246('0x10')](_0x419019));_0xe969c2(_0x419019);})[_0x8246('0x15')](function(_0x1987e6){logger[_0x8246('0x11')]('ShowSugarcrmAccount',_0x1987e6[_0x8246('0x12')],_0x13339e);_0x2596cf(_0x24ec56[_0x8246('0x11')](0x1f4,_0x1987e6[_0x8246('0x12')]));});});}; \ No newline at end of file +var _0xf7b2=['catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowSugarcrmAccount','lodash','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x570990,_0x483310){var _0x2ebad9=function(_0x8271ad){while(--_0x8271ad){_0x570990['push'](_0x570990['shift']());}};_0x2ebad9(++_0x483310);}(_0xf7b2,0x6d));var _0x2f7b=function(_0xe8402,_0xb4e922){_0xe8402=_0xe8402-0x0;var _0x3e7fe9=_0xf7b2[_0xe8402];return _0x3e7fe9;};'use strict';var _=require(_0x2f7b('0x0'));var util=require(_0x2f7b('0x1'));var moment=require(_0x2f7b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f7b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2f7b('0x4'));var logger=require(_0x2f7b('0x5'))('rpc');var config=require(_0x2f7b('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4b9056,_0x519b4b,_0x36f858){return new BPromise(function(_0x4b8565,_0x48fd53){return client[_0x2f7b('0x7')](_0x4b9056,_0x36f858)[_0x2f7b('0x8')](function(_0x490ac8){logger['info'](_0x2f7b('0x9'),_0x519b4b,_0x2f7b('0xa'));logger[_0x2f7b('0xb')](_0x2f7b('0xc'),_0x519b4b,_0x2f7b('0xa'),JSON[_0x2f7b('0xd')](_0x490ac8));if(_0x490ac8[_0x2f7b('0xe')]){if(_0x490ac8[_0x2f7b('0xe')][_0x2f7b('0xf')]===0x1f4){logger[_0x2f7b('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x519b4b,_0x490ac8['error'][_0x2f7b('0x10')]);return _0x48fd53(_0x490ac8[_0x2f7b('0xe')][_0x2f7b('0x10')]);}logger[_0x2f7b('0xe')](_0x2f7b('0x9'),_0x519b4b,_0x490ac8[_0x2f7b('0xe')][_0x2f7b('0x10')]);return _0x4b8565(_0x490ac8[_0x2f7b('0xe')][_0x2f7b('0x10')]);}else{logger[_0x2f7b('0x11')](_0x2f7b('0x9'),_0x519b4b,'request\x20sent');_0x4b8565(_0x490ac8[_0x2f7b('0x12')][_0x2f7b('0x10')]);}})[_0x2f7b('0x13')](function(_0x21a780){logger[_0x2f7b('0xe')](_0x2f7b('0x9'),_0x519b4b,_0x21a780);_0x48fd53(_0x21a780);});});}exports[_0x2f7b('0x14')]=function(_0x3d43aa){var _0x1e7772=this;return new Promise(function(_0x53d59f,_0x2c9075){return db[_0x2f7b('0x15')][_0x2f7b('0x16')]({'raw':_0x3d43aa[_0x2f7b('0x17')]?_0x3d43aa[_0x2f7b('0x17')][_0x2f7b('0x18')]===undefined?!![]:![]:!![],'where':_0x3d43aa[_0x2f7b('0x17')]?_0x3d43aa[_0x2f7b('0x17')][_0x2f7b('0x19')]||null:null,'attributes':_0x3d43aa[_0x2f7b('0x17')]?_0x3d43aa[_0x2f7b('0x17')][_0x2f7b('0x1a')]||null:null,'limit':_0x3d43aa[_0x2f7b('0x17')]?_0x3d43aa['options'][_0x2f7b('0x1b')]||null:null,'include':_0x3d43aa[_0x2f7b('0x17')]?_0x3d43aa['options']['include']?_['map'](_0x3d43aa[_0x2f7b('0x17')][_0x2f7b('0x1c')],function(_0x365d52){return{'model':db[_0x365d52[_0x2f7b('0x1d')]],'as':_0x365d52['as'],'attributes':_0x365d52[_0x2f7b('0x1a')],'include':_0x365d52['include']?_[_0x2f7b('0x1e')](_0x365d52[_0x2f7b('0x1c')],function(_0x22c820){return{'model':db[_0x22c820[_0x2f7b('0x1d')]],'as':_0x22c820['as'],'attributes':_0x22c820[_0x2f7b('0x1a')],'include':_0x22c820[_0x2f7b('0x1c')]?_[_0x2f7b('0x1e')](_0x22c820['include'],function(_0x476b9e){return{'model':db[_0x476b9e[_0x2f7b('0x1d')]],'as':_0x476b9e['as'],'attributes':_0x476b9e[_0x2f7b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2f7b('0x8')](function(_0x2b5570){logger['info'](_0x2f7b('0x14'),_0x3d43aa);logger[_0x2f7b('0xb')]('GetSugarcrmAccount',_0x3d43aa,JSON[_0x2f7b('0xd')](_0x2b5570));_0x53d59f(_0x2b5570);})[_0x2f7b('0x13')](function(_0x5bec5b){logger[_0x2f7b('0xe')](_0x2f7b('0x14'),_0x5bec5b['message'],_0x3d43aa);_0x2c9075(_0x1e7772[_0x2f7b('0xe')](0x1f4,_0x5bec5b[_0x2f7b('0x10')]));});});};exports[_0x2f7b('0x1f')]=function(_0x10004d){var _0x3563c1=this;return new Promise(function(_0x4df8ee,_0x2c03e4){return db[_0x2f7b('0x15')]['find']({'raw':_0x10004d['options']?_0x10004d[_0x2f7b('0x17')][_0x2f7b('0x18')]===undefined?!![]:![]:!![],'where':_0x10004d[_0x2f7b('0x17')]?_0x10004d[_0x2f7b('0x17')][_0x2f7b('0x19')]||null:null,'attributes':_0x10004d['options']?_0x10004d[_0x2f7b('0x17')][_0x2f7b('0x1a')]||null:null,'include':_0x10004d[_0x2f7b('0x17')]?_0x10004d[_0x2f7b('0x17')]['include']?_[_0x2f7b('0x1e')](_0x10004d[_0x2f7b('0x17')][_0x2f7b('0x1c')],function(_0x53d0c9){return{'model':db[_0x53d0c9[_0x2f7b('0x1d')]],'as':_0x53d0c9['as'],'attributes':_0x53d0c9[_0x2f7b('0x1a')],'include':_0x53d0c9[_0x2f7b('0x1c')]?_[_0x2f7b('0x1e')](_0x53d0c9['include'],function(_0x43b1bc){return{'model':db[_0x43b1bc[_0x2f7b('0x1d')]],'as':_0x43b1bc['as'],'attributes':_0x43b1bc['attributes'],'include':_0x43b1bc[_0x2f7b('0x1c')]?_[_0x2f7b('0x1e')](_0x43b1bc[_0x2f7b('0x1c')],function(_0xbae37a){return{'model':db[_0xbae37a[_0x2f7b('0x1d')]],'as':_0xbae37a['as'],'attributes':_0xbae37a['attributes']};}):[]};}):[]};}):[]:[]})[_0x2f7b('0x8')](function(_0x2390e2){logger[_0x2f7b('0x11')](_0x2f7b('0x1f'),_0x10004d);logger[_0x2f7b('0xb')](_0x2f7b('0x1f'),_0x10004d,JSON[_0x2f7b('0xd')](_0x2390e2));_0x4df8ee(_0x2390e2);})['catch'](function(_0x78493c){logger['error'](_0x2f7b('0x1f'),_0x78493c['message'],_0x10004d);_0x2c03e4(_0x3563c1[_0x2f7b('0xe')](0x1f4,_0x78493c[_0x2f7b('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index a48f80f..ab2b0af 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 _0xba29=['show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x3a7414,_0x5675a4){var _0x5e07d7=function(_0x528540){while(--_0x528540){_0x3a7414['push'](_0x3a7414['shift']());}};_0x5e07d7(++_0x5675a4);}(_0xba29,0x12a));var _0x9ba2=function(_0xbddf13,_0x5f33a8){_0xbddf13=_0xbddf13-0x0;var _0x3f704c=_0xba29[_0xbddf13];return _0x3f704c;};'use strict';var multer=require(_0x9ba2('0x0'));var util=require(_0x9ba2('0x1'));var path=require('path');var timeout=require(_0x9ba2('0x2'));var express=require(_0x9ba2('0x3'));var router=express[_0x9ba2('0x4')]();var fs_extra=require(_0x9ba2('0x5'));var auth=require(_0x9ba2('0x6'));var interaction=require(_0x9ba2('0x7'));var config=require(_0x9ba2('0x8'));var controller=require(_0x9ba2('0x9'));router[_0x9ba2('0xa')]('/',auth[_0x9ba2('0xb')](),controller[_0x9ba2('0xc')]);router['get'](_0x9ba2('0xd'),auth[_0x9ba2('0xb')](),controller[_0x9ba2('0xe')]);router['get']('/:id/fields',auth[_0x9ba2('0xb')](),controller['getFields']);router[_0x9ba2('0xa')](_0x9ba2('0xf'),auth[_0x9ba2('0xb')](),controller[_0x9ba2('0x10')]);router['get'](_0x9ba2('0x11'),auth[_0x9ba2('0xb')](),controller[_0x9ba2('0x12')]);router[_0x9ba2('0x13')]('/',auth[_0x9ba2('0xb')](),controller[_0x9ba2('0x14')]);router[_0x9ba2('0x15')](_0x9ba2('0xd'),auth[_0x9ba2('0xb')](),controller[_0x9ba2('0x16')]);router[_0x9ba2('0x17')](_0x9ba2('0xd'),auth['isAuthenticated'](),controller[_0x9ba2('0x18')]);module[_0x9ba2('0x19')]=router; \ No newline at end of file +var _0x323d=['../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x15ff7e,_0x2c28ae){var _0x1dbe8c=function(_0x36d607){while(--_0x36d607){_0x15ff7e['push'](_0x15ff7e['shift']());}};_0x1dbe8c(++_0x2c28ae);}(_0x323d,0x1f0));var _0xd323=function(_0xbf7f20,_0x3f856e){_0xbf7f20=_0xbf7f20-0x0;var _0x5dc25d=_0x323d[_0xbf7f20];return _0x5dc25d;};'use strict';var multer=require(_0xd323('0x0'));var util=require(_0xd323('0x1'));var path=require(_0xd323('0x2'));var timeout=require(_0xd323('0x3'));var express=require(_0xd323('0x4'));var router=express[_0xd323('0x5')]();var fs_extra=require(_0xd323('0x6'));var auth=require(_0xd323('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xd323('0x8'));var controller=require(_0xd323('0x9'));router[_0xd323('0xa')]('/',auth[_0xd323('0xb')](),controller[_0xd323('0xc')]);router[_0xd323('0xa')]('/:id',auth[_0xd323('0xb')](),controller['show']);router[_0xd323('0xa')](_0xd323('0xd'),auth['isAuthenticated'](),controller[_0xd323('0xe')]);router[_0xd323('0xa')](_0xd323('0xf'),auth[_0xd323('0xb')](),controller[_0xd323('0x10')]);router['get'](_0xd323('0x11'),auth['isAuthenticated'](),controller[_0xd323('0x12')]);router[_0xd323('0x13')]('/',auth[_0xd323('0xb')](),controller[_0xd323('0x14')]);router[_0xd323('0x15')](_0xd323('0x16'),auth['isAuthenticated'](),controller[_0xd323('0x17')]);router['delete'](_0xd323('0x16'),auth[_0xd323('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 0ee4585..3ed419c 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 _0x7d9f=['sequelize','exports','STRING'];(function(_0x34439b,_0x2cca2c){var _0x32a6b6=function(_0x590799){while(--_0x590799){_0x34439b['push'](_0x34439b['shift']());}};_0x32a6b6(++_0x2cca2c);}(_0x7d9f,0x1a1));var _0xf7d9=function(_0x5764d9,_0x2bb4c6){_0x5764d9=_0x5764d9-0x0;var _0x1edfcf=_0x7d9f[_0x5764d9];return _0x1edfcf;};'use strict';var Sequelize=require(_0xf7d9('0x0'));module[_0xf7d9('0x1')]={'name':{'type':Sequelize[_0xf7d9('0x2')]},'description':{'type':Sequelize[_0xf7d9('0x2')]}}; \ No newline at end of file +var _0x8592=['sequelize','exports','STRING'];(function(_0x22dcd0,_0x5bebb9){var _0x5bcced=function(_0x50fd31){while(--_0x50fd31){_0x22dcd0['push'](_0x22dcd0['shift']());}};_0x5bcced(++_0x5bebb9);}(_0x8592,0x114));var _0x2859=function(_0x85d5a8,_0x1977be){_0x85d5a8=_0x85d5a8-0x0;var _0x20479b=_0x8592[_0x85d5a8];return _0x20479b;};'use strict';var Sequelize=require(_0x2859('0x0'));module[_0x2859('0x1')]={'name':{'type':Sequelize[_0x2859('0x2')]},'description':{'type':Sequelize[_0x2859('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 9c2e8a2..1fbb9f1 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 _0x8067=['filters','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','fields','includeAll','create','body','find','getFields','SugarcrmField','rawAttributes','order','findOne','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','SugarcrmConfiguration','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','sort','where'];(function(_0xee1941,_0x105375){var _0x2ee8cb=function(_0x4ef736){while(--_0x4ef736){_0xee1941['push'](_0xee1941['shift']());}};_0x2ee8cb(++_0x105375);}(_0x8067,0x1bb));var _0x7806=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x8067[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0x7806('0x0'));var rimraf=require(_0x7806('0x1'));var zipdir=require(_0x7806('0x2'));var jsonpatch=require(_0x7806('0x3'));var rp=require('request-promise');var moment=require(_0x7806('0x4'));var BPromise=require(_0x7806('0x5'));var Mustache=require(_0x7806('0x6'));var util=require(_0x7806('0x7'));var path=require('path');var sox=require(_0x7806('0x8'));var csv=require(_0x7806('0x9'));var ejs=require(_0x7806('0xa'));var fs=require('fs');var fs_extra=require(_0x7806('0xb'));var _=require(_0x7806('0xc'));var squel=require(_0x7806('0xd'));var crypto=require(_0x7806('0xe'));var jsforce=require(_0x7806('0xf'));var deskjs=require(_0x7806('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7806('0x11'));var Redis=require(_0x7806('0x12'));var authService=require(_0x7806('0x13'));var qs=require(_0x7806('0x14'));var as=require(_0x7806('0x15'));var hardwareService=require(_0x7806('0x16'));var logger=require(_0x7806('0x17'))('api');var utils=require(_0x7806('0x18'));var config=require(_0x7806('0x19'));var licenseUtil=require(_0x7806('0x1a'));var db=require(_0x7806('0x1b'))['db'];function respondWithStatusCode(_0x9fc81c,_0x2baf69){_0x2baf69=_0x2baf69||0xcc;return function(_0x48b753){if(_0x48b753){return _0x9fc81c[_0x7806('0x1c')](_0x2baf69);}return _0x9fc81c[_0x7806('0x1d')](_0x2baf69)['end']();};}function respondWithResult(_0x4fc27f,_0x2e96b5){_0x2e96b5=_0x2e96b5||0xc8;return function(_0x32a725){if(_0x32a725){return _0x4fc27f['status'](_0x2e96b5)[_0x7806('0x1e')](_0x32a725);}};}function respondWithFilteredResult(_0x2d714f,_0x4ccb6d){return function(_0x3354d3){if(_0x3354d3){var _0x101e0a=typeof _0x4ccb6d[_0x7806('0x1f')]==='undefined'&&typeof _0x4ccb6d[_0x7806('0x20')]===_0x7806('0x21');var _0x448d61=_0x3354d3[_0x7806('0x22')];var _0x179ffb=_0x101e0a?0x0:_0x4ccb6d[_0x7806('0x1f')];var _0x15558d=_0x101e0a?_0x3354d3['count']:_0x4ccb6d[_0x7806('0x1f')]+_0x4ccb6d[_0x7806('0x20')];var _0x25d51a;if(_0x15558d>=_0x448d61){_0x15558d=_0x448d61;_0x25d51a=0xc8;}else{_0x25d51a=0xce;}_0x2d714f[_0x7806('0x1d')](_0x25d51a);return _0x2d714f['set'](_0x7806('0x23'),_0x179ffb+'-'+_0x15558d+'/'+_0x448d61)['json'](_0x3354d3);}return null;};}function patchUpdates(_0x53114f){return function(_0x3aedaa){try{jsonpatch[_0x7806('0x24')](_0x3aedaa,_0x53114f,!![]);}catch(_0x2b2bfc){return BPromise[_0x7806('0x25')](_0x2b2bfc);}return _0x3aedaa[_0x7806('0x26')]();};}function saveUpdates(_0xcddee7,_0x539914){return function(_0xc16ed8){if(_0xc16ed8){return _0xc16ed8[_0x7806('0x27')](_0xcddee7)[_0x7806('0x28')](function(_0x2aa0fa){return _0x2aa0fa;});}return null;};}function removeEntity(_0x5e1d7c,_0x536208){return function(_0x485c5a){if(_0x485c5a){return _0x485c5a[_0x7806('0x29')]()['then'](function(){_0x5e1d7c[_0x7806('0x1d')](0xcc)[_0x7806('0x2a')]();});}};}function handleEntityNotFound(_0x303a10,_0x327fa3){return function(_0xd9af54){if(!_0xd9af54){_0x303a10[_0x7806('0x1c')](0x194);}return _0xd9af54;};}function handleError(_0x435cdc,_0x56b2b0){_0x56b2b0=_0x56b2b0||0x1f4;return function(_0x48780c){logger['error'](_0x48780c[_0x7806('0x2b')]);if(_0x48780c[_0x7806('0x2c')]){delete _0x48780c[_0x7806('0x2c')];}_0x435cdc[_0x7806('0x1d')](_0x56b2b0)[_0x7806('0x2d')](_0x48780c);};}exports[_0x7806('0x2e')]=function(_0x6fa52,_0x5e141d){var _0x11a2da={},_0x2a5aa5={},_0x5a2f83={'count':0x0,'rows':[]};var _0x4945ad=_[_0x7806('0x2f')](db[_0x7806('0x30')]['rawAttributes'],function(_0x4b9271){return{'name':_0x4b9271['fieldName'],'type':_0x4b9271[_0x7806('0x31')][_0x7806('0x32')]};});_0x2a5aa5[_0x7806('0x33')]=_[_0x7806('0x2f')](_0x4945ad,'name');_0x2a5aa5[_0x7806('0x34')]=_[_0x7806('0x35')](_0x6fa52[_0x7806('0x34')]);_0x2a5aa5['filters']=_[_0x7806('0x36')](_0x2a5aa5['model'],_0x2a5aa5[_0x7806('0x34')]);_0x11a2da['attributes']=_['intersection'](_0x2a5aa5[_0x7806('0x33')],qs['fields'](_0x6fa52[_0x7806('0x34')]['fields']));_0x11a2da[_0x7806('0x37')]=_0x11a2da['attributes'][_0x7806('0x38')]?_0x11a2da[_0x7806('0x37')]:_0x2a5aa5[_0x7806('0x33')];if(!_0x6fa52[_0x7806('0x34')][_0x7806('0x39')](_0x7806('0x3a'))){_0x11a2da[_0x7806('0x20')]=qs[_0x7806('0x20')](_0x6fa52[_0x7806('0x34')][_0x7806('0x20')]);_0x11a2da['offset']=qs['offset'](_0x6fa52[_0x7806('0x34')][_0x7806('0x1f')]);}_0x11a2da['order']=qs[_0x7806('0x3b')](_0x6fa52['query'][_0x7806('0x3b')]);_0x11a2da[_0x7806('0x3c')]=qs[_0x7806('0x3d')](_[_0x7806('0x3e')](_0x6fa52[_0x7806('0x34')],_0x2a5aa5['filters']),_0x4945ad);if(_0x6fa52[_0x7806('0x34')][_0x7806('0x3f')]){_0x11a2da[_0x7806('0x3c')]=_[_0x7806('0x40')](_0x11a2da['where'],{'$or':_[_0x7806('0x2f')](_0x4945ad,function(_0x22a196){if(_0x22a196[_0x7806('0x31')]!==_0x7806('0x41')){var _0x4890ce={};_0x4890ce[_0x22a196[_0x7806('0x2c')]]={'$like':'%'+_0x6fa52[_0x7806('0x34')][_0x7806('0x3f')]+'%'};return _0x4890ce;}})});}_0x11a2da=_[_0x7806('0x40')]({},_0x11a2da,_0x6fa52[_0x7806('0x42')]);var _0xff6a9c={'where':_0x11a2da[_0x7806('0x3c')]};return db[_0x7806('0x30')][_0x7806('0x22')](_0xff6a9c)[_0x7806('0x28')](function(_0x24f97f){_0x5a2f83[_0x7806('0x22')]=_0x24f97f;if(_0x6fa52[_0x7806('0x34')]['includeAll']){_0x11a2da[_0x7806('0x43')]=[{'all':!![]}];}return db[_0x7806('0x30')][_0x7806('0x44')](_0x11a2da);})[_0x7806('0x28')](function(_0x2af36f){_0x5a2f83['rows']=_0x2af36f;return _0x5a2f83;})[_0x7806('0x28')](respondWithFilteredResult(_0x5e141d,_0x11a2da))[_0x7806('0x45')](handleError(_0x5e141d,null));};exports[_0x7806('0x46')]=function(_0x125659,_0x4e6592){var _0x3d82dc={'raw':![],'where':{'id':_0x125659[_0x7806('0x47')]['id']}},_0x44509b={};_0x44509b[_0x7806('0x33')]=_['keys'](db[_0x7806('0x30')]['rawAttributes']);_0x44509b[_0x7806('0x34')]=_[_0x7806('0x35')](_0x125659['query']);_0x44509b[_0x7806('0x3d')]=_['intersection'](_0x44509b[_0x7806('0x33')],_0x44509b[_0x7806('0x34')]);_0x3d82dc[_0x7806('0x37')]=_[_0x7806('0x36')](_0x44509b[_0x7806('0x33')],qs[_0x7806('0x48')](_0x125659['query'][_0x7806('0x48')]));_0x3d82dc[_0x7806('0x37')]=_0x3d82dc[_0x7806('0x37')][_0x7806('0x38')]?_0x3d82dc[_0x7806('0x37')]:_0x44509b[_0x7806('0x33')];if(_0x125659[_0x7806('0x34')][_0x7806('0x49')]){_0x3d82dc[_0x7806('0x43')]=[{'all':!![]}];}_0x3d82dc=_['merge']({},_0x3d82dc,_0x125659[_0x7806('0x42')]);return db[_0x7806('0x30')]['find'](_0x3d82dc)[_0x7806('0x28')](handleEntityNotFound(_0x4e6592,null))[_0x7806('0x28')](respondWithResult(_0x4e6592,null))['catch'](handleError(_0x4e6592,null));};exports['create']=function(_0x1d34f8,_0x6428d2){return db[_0x7806('0x30')][_0x7806('0x4a')](_0x1d34f8['body'],{})[_0x7806('0x28')](respondWithResult(_0x6428d2,0xc9))['catch'](handleError(_0x6428d2,null));};exports['update']=function(_0x555988,_0x44256d){if(_0x555988[_0x7806('0x4b')]['id']){delete _0x555988[_0x7806('0x4b')]['id'];}return db[_0x7806('0x30')][_0x7806('0x4c')]({'where':{'id':_0x555988[_0x7806('0x47')]['id']}})[_0x7806('0x28')](handleEntityNotFound(_0x44256d,null))['then'](saveUpdates(_0x555988[_0x7806('0x4b')],null))['then'](respondWithResult(_0x44256d,null))[_0x7806('0x45')](handleError(_0x44256d,null));};exports['destroy']=function(_0x3663d1,_0x3d9c54){return db[_0x7806('0x30')][_0x7806('0x4c')]({'where':{'id':_0x3663d1[_0x7806('0x47')]['id']}})[_0x7806('0x28')](handleEntityNotFound(_0x3d9c54,null))[_0x7806('0x28')](removeEntity(_0x3d9c54,null))[_0x7806('0x45')](handleError(_0x3d9c54,null));};exports[_0x7806('0x4d')]=function(_0x3fed13,_0x2e56f2,_0x64a1cd){var _0x995ae5={};var _0x507793={};var _0x5b2e30;var _0x4e5bef;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x3fed13[_0x7806('0x47')]['id']}})[_0x7806('0x28')](handleEntityNotFound(_0x2e56f2,null))[_0x7806('0x28')](function(_0x13d892){if(_0x13d892){_0x5b2e30=_0x13d892;_0x507793[_0x7806('0x33')]=_['keys'](db[_0x7806('0x4e')][_0x7806('0x4f')]);_0x507793[_0x7806('0x34')]=_['keys'](_0x3fed13[_0x7806('0x34')]);_0x507793[_0x7806('0x3d')]=_[_0x7806('0x36')](_0x507793['model'],_0x507793[_0x7806('0x34')]);_0x995ae5[_0x7806('0x37')]=_[_0x7806('0x36')](_0x507793[_0x7806('0x33')],qs[_0x7806('0x48')](_0x3fed13[_0x7806('0x34')][_0x7806('0x48')]));_0x995ae5['attributes']=_0x995ae5[_0x7806('0x37')][_0x7806('0x38')]?_0x995ae5['attributes']:_0x507793[_0x7806('0x33')];_0x995ae5[_0x7806('0x50')]=qs[_0x7806('0x3b')](_0x3fed13[_0x7806('0x34')][_0x7806('0x3b')]);_0x995ae5['where']=qs[_0x7806('0x3d')](_[_0x7806('0x3e')](_0x3fed13[_0x7806('0x34')],_0x507793[_0x7806('0x3d')]));if(_0x3fed13[_0x7806('0x34')]['filter']){_0x995ae5[_0x7806('0x3c')]=_[_0x7806('0x40')](_0x995ae5[_0x7806('0x3c')],{'$or':_[_0x7806('0x2f')](_0x995ae5[_0x7806('0x37')],function(_0x16c6af){var _0x2d28d8={};_0x2d28d8[_0x16c6af]={'$like':'%'+_0x3fed13[_0x7806('0x34')]['filter']+'%'};return _0x2d28d8;})});}_0x995ae5=_[_0x7806('0x40')]({},_0x995ae5,_0x3fed13[_0x7806('0x42')]);return _0x5b2e30[_0x7806('0x4d')](_0x995ae5);}})[_0x7806('0x28')](function(_0x39ea73){if(_0x39ea73){_0x4e5bef=_0x39ea73[_0x7806('0x38')];if(!_0x3fed13[_0x7806('0x34')][_0x7806('0x39')](_0x7806('0x3a'))){_0x995ae5[_0x7806('0x20')]=qs[_0x7806('0x20')](_0x3fed13[_0x7806('0x34')][_0x7806('0x20')]);_0x995ae5[_0x7806('0x1f')]=qs[_0x7806('0x1f')](_0x3fed13[_0x7806('0x34')][_0x7806('0x1f')]);}return _0x5b2e30[_0x7806('0x4d')](_0x995ae5);}})['then'](function(_0x28c204){if(_0x28c204){return _0x28c204?{'count':_0x4e5bef,'rows':_0x28c204}:null;}})[_0x7806('0x28')](respondWithResult(_0x2e56f2,null))[_0x7806('0x45')](handleError(_0x2e56f2,null));};exports['getSubjects']=function(_0x22ebd0,_0x53b19f,_0x3bd27c){var _0x456e53={};var _0x2bad8c={};var _0x347b6f;var _0x58fb13;return db['SugarcrmConfiguration'][_0x7806('0x51')]({'where':{'id':_0x22ebd0[_0x7806('0x47')]['id']}})[_0x7806('0x28')](handleEntityNotFound(_0x53b19f,null))[_0x7806('0x28')](function(_0x470966){if(_0x470966){_0x347b6f=_0x470966;_0x2bad8c[_0x7806('0x33')]=_[_0x7806('0x35')](db[_0x7806('0x4e')][_0x7806('0x4f')]);_0x2bad8c[_0x7806('0x34')]=_['keys'](_0x22ebd0[_0x7806('0x34')]);_0x2bad8c[_0x7806('0x3d')]=_['intersection'](_0x2bad8c[_0x7806('0x33')],_0x2bad8c[_0x7806('0x34')]);_0x456e53[_0x7806('0x37')]=_['intersection'](_0x2bad8c[_0x7806('0x33')],qs[_0x7806('0x48')](_0x22ebd0['query'][_0x7806('0x48')]));_0x456e53[_0x7806('0x37')]=_0x456e53[_0x7806('0x37')]['length']?_0x456e53['attributes']:_0x2bad8c[_0x7806('0x33')];_0x456e53[_0x7806('0x50')]=qs['sort'](_0x22ebd0[_0x7806('0x34')][_0x7806('0x3b')]);_0x456e53['where']=qs[_0x7806('0x3d')](_[_0x7806('0x3e')](_0x22ebd0[_0x7806('0x34')],_0x2bad8c[_0x7806('0x3d')]));if(_0x22ebd0[_0x7806('0x34')][_0x7806('0x3f')]){_0x456e53['where']=_[_0x7806('0x40')](_0x456e53[_0x7806('0x3c')],{'$or':_[_0x7806('0x2f')](_0x456e53[_0x7806('0x37')],function(_0x503a44){var _0xb96c7a={};_0xb96c7a[_0x503a44]={'$like':'%'+_0x22ebd0[_0x7806('0x34')][_0x7806('0x3f')]+'%'};return _0xb96c7a;})});}_0x456e53=_[_0x7806('0x40')]({},_0x456e53,_0x22ebd0[_0x7806('0x42')]);return _0x347b6f['getSubjects'](_0x456e53);}})[_0x7806('0x28')](function(_0x138792){if(_0x138792){_0x58fb13=_0x138792[_0x7806('0x38')];if(!_0x22ebd0[_0x7806('0x34')]['hasOwnProperty']('nolimit')){_0x456e53[_0x7806('0x20')]=qs['limit'](_0x22ebd0[_0x7806('0x34')]['limit']);_0x456e53[_0x7806('0x1f')]=qs[_0x7806('0x1f')](_0x22ebd0[_0x7806('0x34')][_0x7806('0x1f')]);}return _0x347b6f[_0x7806('0x52')](_0x456e53);}})['then'](function(_0x5a98e9){if(_0x5a98e9){return _0x5a98e9?{'count':_0x58fb13,'rows':_0x5a98e9}:null;}})[_0x7806('0x28')](respondWithResult(_0x53b19f,null))['catch'](handleError(_0x53b19f,null));};exports[_0x7806('0x53')]=function(_0x27959b,_0x22577e,_0x27bca9){var _0x42f447={};var _0x525ae3={};var _0xaf2cb5;var _0x50cb31;return db[_0x7806('0x30')][_0x7806('0x51')]({'where':{'id':_0x27959b[_0x7806('0x47')]['id']}})[_0x7806('0x28')](handleEntityNotFound(_0x22577e,null))[_0x7806('0x28')](function(_0x211dd2){if(_0x211dd2){_0xaf2cb5=_0x211dd2;_0x525ae3[_0x7806('0x33')]=_['keys'](db['SugarcrmField'][_0x7806('0x4f')]);_0x525ae3[_0x7806('0x34')]=_[_0x7806('0x35')](_0x27959b['query']);_0x525ae3['filters']=_[_0x7806('0x36')](_0x525ae3[_0x7806('0x33')],_0x525ae3[_0x7806('0x34')]);_0x42f447[_0x7806('0x37')]=_[_0x7806('0x36')](_0x525ae3[_0x7806('0x33')],qs[_0x7806('0x48')](_0x27959b[_0x7806('0x34')]['fields']));_0x42f447['attributes']=_0x42f447[_0x7806('0x37')][_0x7806('0x38')]?_0x42f447[_0x7806('0x37')]:_0x525ae3[_0x7806('0x33')];_0x42f447[_0x7806('0x50')]=qs[_0x7806('0x3b')](_0x27959b['query'][_0x7806('0x3b')]);_0x42f447[_0x7806('0x3c')]=qs[_0x7806('0x3d')](_[_0x7806('0x3e')](_0x27959b[_0x7806('0x34')],_0x525ae3[_0x7806('0x3d')]));if(_0x27959b[_0x7806('0x34')][_0x7806('0x3f')]){_0x42f447[_0x7806('0x3c')]=_['merge'](_0x42f447[_0x7806('0x3c')],{'$or':_[_0x7806('0x2f')](_0x42f447[_0x7806('0x37')],function(_0x5ed5d3){var _0x1816be={};_0x1816be[_0x5ed5d3]={'$like':'%'+_0x27959b['query'][_0x7806('0x3f')]+'%'};return _0x1816be;})});}_0x42f447=_[_0x7806('0x40')]({},_0x42f447,_0x27959b[_0x7806('0x42')]);return _0xaf2cb5[_0x7806('0x53')](_0x42f447);}})['then'](function(_0x55c5df){if(_0x55c5df){_0x50cb31=_0x55c5df[_0x7806('0x38')];if(!_0x27959b[_0x7806('0x34')][_0x7806('0x39')](_0x7806('0x3a'))){_0x42f447['limit']=qs[_0x7806('0x20')](_0x27959b['query']['limit']);_0x42f447['offset']=qs['offset'](_0x27959b[_0x7806('0x34')][_0x7806('0x1f')]);}return _0xaf2cb5[_0x7806('0x53')](_0x42f447);}})['then'](function(_0x28d765){if(_0x28d765){return _0x28d765?{'count':_0x50cb31,'rows':_0x28d765}:null;}})[_0x7806('0x28')](respondWithResult(_0x22577e,null))[_0x7806('0x45')](handleError(_0x22577e,null));}; \ No newline at end of file +var _0x3351=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','error','stack','send','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','name','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','create','body','find','getFields','findOne','hasOwnProperty','getSubjects','SugarcrmField','getDescriptions'];(function(_0x1e79db,_0x10a86a){var _0x3346d3=function(_0x5ce152){while(--_0x5ce152){_0x1e79db['push'](_0x1e79db['shift']());}};_0x3346d3(++_0x10a86a);}(_0x3351,0x186));var _0x1335=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x3351[_0x47b58b];return _0x46bebe;};'use strict';var emlformat=require(_0x1335('0x0'));var rimraf=require(_0x1335('0x1'));var zipdir=require(_0x1335('0x2'));var jsonpatch=require(_0x1335('0x3'));var rp=require('request-promise');var moment=require(_0x1335('0x4'));var BPromise=require(_0x1335('0x5'));var Mustache=require(_0x1335('0x6'));var util=require(_0x1335('0x7'));var path=require('path');var sox=require(_0x1335('0x8'));var csv=require('to-csv');var ejs=require(_0x1335('0x9'));var fs=require('fs');var fs_extra=require(_0x1335('0xa'));var _=require(_0x1335('0xb'));var squel=require(_0x1335('0xc'));var crypto=require(_0x1335('0xd'));var jsforce=require(_0x1335('0xe'));var deskjs=require(_0x1335('0xf'));var toCsv=require(_0x1335('0x10'));var querystring=require(_0x1335('0x11'));var Papa=require(_0x1335('0x12'));var Redis=require(_0x1335('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x1335('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1335('0x15'));var logger=require(_0x1335('0x16'))(_0x1335('0x17'));var utils=require(_0x1335('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c0f81,_0x444286){_0x444286=_0x444286||0xcc;return function(_0x1dce5b){if(_0x1dce5b){return _0x4c0f81['sendStatus'](_0x444286);}return _0x4c0f81[_0x1335('0x19')](_0x444286)[_0x1335('0x1a')]();};}function respondWithResult(_0x532f7e,_0x163352){_0x163352=_0x163352||0xc8;return function(_0x1a41b9){if(_0x1a41b9){return _0x532f7e[_0x1335('0x19')](_0x163352)[_0x1335('0x1b')](_0x1a41b9);}};}function respondWithFilteredResult(_0x284b98,_0x188f7a){return function(_0x27818e){if(_0x27818e){var _0x29c8d3=typeof _0x188f7a[_0x1335('0x1c')]===_0x1335('0x1d')&&typeof _0x188f7a[_0x1335('0x1e')]==='undefined';var _0x24bf70=_0x27818e[_0x1335('0x1f')];var _0x31437b=_0x29c8d3?0x0:_0x188f7a['offset'];var _0xbe1b5e=_0x29c8d3?_0x27818e[_0x1335('0x1f')]:_0x188f7a[_0x1335('0x1c')]+_0x188f7a['limit'];var _0x2b0ae2;if(_0xbe1b5e>=_0x24bf70){_0xbe1b5e=_0x24bf70;_0x2b0ae2=0xc8;}else{_0x2b0ae2=0xce;}_0x284b98['status'](_0x2b0ae2);return _0x284b98['set'](_0x1335('0x20'),_0x31437b+'-'+_0xbe1b5e+'/'+_0x24bf70)[_0x1335('0x1b')](_0x27818e);}return null;};}function patchUpdates(_0x2df91d){return function(_0x4dd685){try{jsonpatch['apply'](_0x4dd685,_0x2df91d,!![]);}catch(_0x409b7e){return BPromise['reject'](_0x409b7e);}return _0x4dd685[_0x1335('0x21')]();};}function saveUpdates(_0x2b2310,_0x24929c){return function(_0x296c97){if(_0x296c97){return _0x296c97[_0x1335('0x22')](_0x2b2310)[_0x1335('0x23')](function(_0x5dcda6){return _0x5dcda6;});}return null;};}function removeEntity(_0x8ad9dd,_0x42ad80){return function(_0x31617b){if(_0x31617b){return _0x31617b[_0x1335('0x24')]()[_0x1335('0x23')](function(){_0x8ad9dd[_0x1335('0x19')](0xcc)[_0x1335('0x1a')]();});}};}function handleEntityNotFound(_0x5e4df6,_0x43c6b6){return function(_0x24987d){if(!_0x24987d){_0x5e4df6['sendStatus'](0x194);}return _0x24987d;};}function handleError(_0x5e34b8,_0x3be2c0){_0x3be2c0=_0x3be2c0||0x1f4;return function(_0x26500b){logger[_0x1335('0x25')](_0x26500b[_0x1335('0x26')]);if(_0x26500b['name']){delete _0x26500b['name'];}_0x5e34b8[_0x1335('0x19')](_0x3be2c0)[_0x1335('0x27')](_0x26500b);};}exports['index']=function(_0x4a2fe8,_0x143aeb){var _0x24a428={},_0x1be2bf={},_0x416f6f={'count':0x0,'rows':[]};var _0x34bc25=_[_0x1335('0x28')](db[_0x1335('0x29')][_0x1335('0x2a')],function(_0x19b1e0){return{'name':_0x19b1e0[_0x1335('0x2b')],'type':_0x19b1e0[_0x1335('0x2c')][_0x1335('0x2d')]};});_0x1be2bf[_0x1335('0x2e')]=_['map'](_0x34bc25,_0x1335('0x2f'));_0x1be2bf[_0x1335('0x30')]=_['keys'](_0x4a2fe8['query']);_0x1be2bf[_0x1335('0x31')]=_['intersection'](_0x1be2bf[_0x1335('0x2e')],_0x1be2bf[_0x1335('0x30')]);_0x24a428[_0x1335('0x32')]=_[_0x1335('0x33')](_0x1be2bf[_0x1335('0x2e')],qs[_0x1335('0x34')](_0x4a2fe8[_0x1335('0x30')]['fields']));_0x24a428['attributes']=_0x24a428['attributes'][_0x1335('0x35')]?_0x24a428[_0x1335('0x32')]:_0x1be2bf[_0x1335('0x2e')];if(!_0x4a2fe8[_0x1335('0x30')]['hasOwnProperty'](_0x1335('0x36'))){_0x24a428['limit']=qs[_0x1335('0x1e')](_0x4a2fe8[_0x1335('0x30')]['limit']);_0x24a428[_0x1335('0x1c')]=qs['offset'](_0x4a2fe8['query'][_0x1335('0x1c')]);}_0x24a428[_0x1335('0x37')]=qs[_0x1335('0x38')](_0x4a2fe8[_0x1335('0x30')][_0x1335('0x38')]);_0x24a428[_0x1335('0x39')]=qs[_0x1335('0x31')](_[_0x1335('0x3a')](_0x4a2fe8['query'],_0x1be2bf[_0x1335('0x31')]),_0x34bc25);if(_0x4a2fe8['query'][_0x1335('0x3b')]){_0x24a428[_0x1335('0x39')]=_[_0x1335('0x3c')](_0x24a428[_0x1335('0x39')],{'$or':_[_0x1335('0x28')](_0x34bc25,function(_0x5273ba){if(_0x5273ba[_0x1335('0x2c')]!=='VIRTUAL'){var _0x2631f0={};_0x2631f0[_0x5273ba[_0x1335('0x2f')]]={'$like':'%'+_0x4a2fe8[_0x1335('0x30')][_0x1335('0x3b')]+'%'};return _0x2631f0;}})});}_0x24a428=_['merge']({},_0x24a428,_0x4a2fe8[_0x1335('0x3d')]);var _0x446068={'where':_0x24a428[_0x1335('0x39')]};return db['SugarcrmConfiguration'][_0x1335('0x1f')](_0x446068)[_0x1335('0x23')](function(_0x4e9d5e){_0x416f6f[_0x1335('0x1f')]=_0x4e9d5e;if(_0x4a2fe8['query'][_0x1335('0x3e')]){_0x24a428[_0x1335('0x3f')]=[{'all':!![]}];}return db[_0x1335('0x29')][_0x1335('0x40')](_0x24a428);})[_0x1335('0x23')](function(_0x426850){_0x416f6f['rows']=_0x426850;return _0x416f6f;})[_0x1335('0x23')](respondWithFilteredResult(_0x143aeb,_0x24a428))[_0x1335('0x41')](handleError(_0x143aeb,null));};exports[_0x1335('0x42')]=function(_0x36b5e5,_0x52709c){var _0x5d599f={'raw':![],'where':{'id':_0x36b5e5[_0x1335('0x43')]['id']}},_0xcee5b={};_0xcee5b[_0x1335('0x2e')]=_['keys'](db[_0x1335('0x29')][_0x1335('0x2a')]);_0xcee5b[_0x1335('0x30')]=_[_0x1335('0x44')](_0x36b5e5[_0x1335('0x30')]);_0xcee5b[_0x1335('0x31')]=_[_0x1335('0x33')](_0xcee5b['model'],_0xcee5b[_0x1335('0x30')]);_0x5d599f[_0x1335('0x32')]=_[_0x1335('0x33')](_0xcee5b[_0x1335('0x2e')],qs['fields'](_0x36b5e5[_0x1335('0x30')][_0x1335('0x34')]));_0x5d599f['attributes']=_0x5d599f[_0x1335('0x32')]['length']?_0x5d599f[_0x1335('0x32')]:_0xcee5b[_0x1335('0x2e')];if(_0x36b5e5[_0x1335('0x30')]['includeAll']){_0x5d599f['include']=[{'all':!![]}];}_0x5d599f=_['merge']({},_0x5d599f,_0x36b5e5['options']);return db['SugarcrmConfiguration']['find'](_0x5d599f)[_0x1335('0x23')](handleEntityNotFound(_0x52709c,null))[_0x1335('0x23')](respondWithResult(_0x52709c,null))[_0x1335('0x41')](handleError(_0x52709c,null));};exports[_0x1335('0x45')]=function(_0x5576c1,_0x1a0c78){return db['SugarcrmConfiguration']['create'](_0x5576c1[_0x1335('0x46')],{})[_0x1335('0x23')](respondWithResult(_0x1a0c78,0xc9))[_0x1335('0x41')](handleError(_0x1a0c78,null));};exports[_0x1335('0x22')]=function(_0x21f829,_0x14dde5){if(_0x21f829[_0x1335('0x46')]['id']){delete _0x21f829[_0x1335('0x46')]['id'];}return db[_0x1335('0x29')][_0x1335('0x47')]({'where':{'id':_0x21f829['params']['id']}})[_0x1335('0x23')](handleEntityNotFound(_0x14dde5,null))['then'](saveUpdates(_0x21f829['body'],null))[_0x1335('0x23')](respondWithResult(_0x14dde5,null))[_0x1335('0x41')](handleError(_0x14dde5,null));};exports[_0x1335('0x24')]=function(_0x5e2128,_0x338de3){return db['SugarcrmConfiguration'][_0x1335('0x47')]({'where':{'id':_0x5e2128['params']['id']}})[_0x1335('0x23')](handleEntityNotFound(_0x338de3,null))[_0x1335('0x23')](removeEntity(_0x338de3,null))[_0x1335('0x41')](handleError(_0x338de3,null));};exports[_0x1335('0x48')]=function(_0x424ee6,_0x1c3d7f,_0x2d9dee){var _0xc4bd3a={};var _0x28716b={};var _0x408c74;var _0x2442c4;return db[_0x1335('0x29')][_0x1335('0x49')]({'where':{'id':_0x424ee6[_0x1335('0x43')]['id']}})[_0x1335('0x23')](handleEntityNotFound(_0x1c3d7f,null))[_0x1335('0x23')](function(_0x16da65){if(_0x16da65){_0x408c74=_0x16da65;_0x28716b[_0x1335('0x2e')]=_[_0x1335('0x44')](db['SugarcrmField']['rawAttributes']);_0x28716b[_0x1335('0x30')]=_[_0x1335('0x44')](_0x424ee6['query']);_0x28716b[_0x1335('0x31')]=_['intersection'](_0x28716b[_0x1335('0x2e')],_0x28716b[_0x1335('0x30')]);_0xc4bd3a[_0x1335('0x32')]=_['intersection'](_0x28716b['model'],qs[_0x1335('0x34')](_0x424ee6[_0x1335('0x30')]['fields']));_0xc4bd3a['attributes']=_0xc4bd3a[_0x1335('0x32')][_0x1335('0x35')]?_0xc4bd3a['attributes']:_0x28716b[_0x1335('0x2e')];_0xc4bd3a[_0x1335('0x37')]=qs['sort'](_0x424ee6[_0x1335('0x30')][_0x1335('0x38')]);_0xc4bd3a[_0x1335('0x39')]=qs[_0x1335('0x31')](_['pick'](_0x424ee6['query'],_0x28716b['filters']));if(_0x424ee6[_0x1335('0x30')][_0x1335('0x3b')]){_0xc4bd3a[_0x1335('0x39')]=_[_0x1335('0x3c')](_0xc4bd3a[_0x1335('0x39')],{'$or':_[_0x1335('0x28')](_0xc4bd3a['attributes'],function(_0x38f2a6){var _0x4fcd7d={};_0x4fcd7d[_0x38f2a6]={'$like':'%'+_0x424ee6[_0x1335('0x30')][_0x1335('0x3b')]+'%'};return _0x4fcd7d;})});}_0xc4bd3a=_[_0x1335('0x3c')]({},_0xc4bd3a,_0x424ee6[_0x1335('0x3d')]);return _0x408c74[_0x1335('0x48')](_0xc4bd3a);}})[_0x1335('0x23')](function(_0x975fd1){if(_0x975fd1){_0x2442c4=_0x975fd1[_0x1335('0x35')];if(!_0x424ee6['query'][_0x1335('0x4a')](_0x1335('0x36'))){_0xc4bd3a[_0x1335('0x1e')]=qs[_0x1335('0x1e')](_0x424ee6[_0x1335('0x30')]['limit']);_0xc4bd3a['offset']=qs[_0x1335('0x1c')](_0x424ee6[_0x1335('0x30')][_0x1335('0x1c')]);}return _0x408c74['getFields'](_0xc4bd3a);}})[_0x1335('0x23')](function(_0x574873){if(_0x574873){return _0x574873?{'count':_0x2442c4,'rows':_0x574873}:null;}})[_0x1335('0x23')](respondWithResult(_0x1c3d7f,null))['catch'](handleError(_0x1c3d7f,null));};exports[_0x1335('0x4b')]=function(_0x31f54e,_0x35eda6,_0x3ac7f8){var _0xb012a0={};var _0xc06e={};var _0x659d5d;var _0x16754b;return db['SugarcrmConfiguration'][_0x1335('0x49')]({'where':{'id':_0x31f54e['params']['id']}})[_0x1335('0x23')](handleEntityNotFound(_0x35eda6,null))['then'](function(_0x12a2c9){if(_0x12a2c9){_0x659d5d=_0x12a2c9;_0xc06e[_0x1335('0x2e')]=_[_0x1335('0x44')](db[_0x1335('0x4c')]['rawAttributes']);_0xc06e[_0x1335('0x30')]=_[_0x1335('0x44')](_0x31f54e[_0x1335('0x30')]);_0xc06e[_0x1335('0x31')]=_[_0x1335('0x33')](_0xc06e[_0x1335('0x2e')],_0xc06e['query']);_0xb012a0[_0x1335('0x32')]=_['intersection'](_0xc06e[_0x1335('0x2e')],qs[_0x1335('0x34')](_0x31f54e[_0x1335('0x30')]['fields']));_0xb012a0[_0x1335('0x32')]=_0xb012a0[_0x1335('0x32')][_0x1335('0x35')]?_0xb012a0[_0x1335('0x32')]:_0xc06e[_0x1335('0x2e')];_0xb012a0[_0x1335('0x37')]=qs[_0x1335('0x38')](_0x31f54e[_0x1335('0x30')][_0x1335('0x38')]);_0xb012a0[_0x1335('0x39')]=qs[_0x1335('0x31')](_[_0x1335('0x3a')](_0x31f54e[_0x1335('0x30')],_0xc06e[_0x1335('0x31')]));if(_0x31f54e[_0x1335('0x30')][_0x1335('0x3b')]){_0xb012a0[_0x1335('0x39')]=_[_0x1335('0x3c')](_0xb012a0['where'],{'$or':_[_0x1335('0x28')](_0xb012a0[_0x1335('0x32')],function(_0x5dcb61){var _0x4ca815={};_0x4ca815[_0x5dcb61]={'$like':'%'+_0x31f54e[_0x1335('0x30')][_0x1335('0x3b')]+'%'};return _0x4ca815;})});}_0xb012a0=_[_0x1335('0x3c')]({},_0xb012a0,_0x31f54e[_0x1335('0x3d')]);return _0x659d5d[_0x1335('0x4b')](_0xb012a0);}})[_0x1335('0x23')](function(_0x26e321){if(_0x26e321){_0x16754b=_0x26e321[_0x1335('0x35')];if(!_0x31f54e[_0x1335('0x30')][_0x1335('0x4a')]('nolimit')){_0xb012a0[_0x1335('0x1e')]=qs['limit'](_0x31f54e['query']['limit']);_0xb012a0[_0x1335('0x1c')]=qs[_0x1335('0x1c')](_0x31f54e[_0x1335('0x30')]['offset']);}return _0x659d5d[_0x1335('0x4b')](_0xb012a0);}})[_0x1335('0x23')](function(_0x507f1d){if(_0x507f1d){return _0x507f1d?{'count':_0x16754b,'rows':_0x507f1d}:null;}})[_0x1335('0x23')](respondWithResult(_0x35eda6,null))[_0x1335('0x41')](handleError(_0x35eda6,null));};exports['getDescriptions']=function(_0x38423b,_0x3d87d2,_0xdfc2d0){var _0x54cafd={};var _0x43ab79={};var _0x398f51;var _0x28359e;return db[_0x1335('0x29')][_0x1335('0x49')]({'where':{'id':_0x38423b[_0x1335('0x43')]['id']}})[_0x1335('0x23')](handleEntityNotFound(_0x3d87d2,null))[_0x1335('0x23')](function(_0x5125ae){if(_0x5125ae){_0x398f51=_0x5125ae;_0x43ab79[_0x1335('0x2e')]=_[_0x1335('0x44')](db['SugarcrmField'][_0x1335('0x2a')]);_0x43ab79[_0x1335('0x30')]=_[_0x1335('0x44')](_0x38423b['query']);_0x43ab79[_0x1335('0x31')]=_['intersection'](_0x43ab79[_0x1335('0x2e')],_0x43ab79[_0x1335('0x30')]);_0x54cafd[_0x1335('0x32')]=_[_0x1335('0x33')](_0x43ab79[_0x1335('0x2e')],qs[_0x1335('0x34')](_0x38423b[_0x1335('0x30')][_0x1335('0x34')]));_0x54cafd[_0x1335('0x32')]=_0x54cafd['attributes']['length']?_0x54cafd['attributes']:_0x43ab79[_0x1335('0x2e')];_0x54cafd[_0x1335('0x37')]=qs[_0x1335('0x38')](_0x38423b[_0x1335('0x30')]['sort']);_0x54cafd[_0x1335('0x39')]=qs[_0x1335('0x31')](_[_0x1335('0x3a')](_0x38423b['query'],_0x43ab79[_0x1335('0x31')]));if(_0x38423b[_0x1335('0x30')]['filter']){_0x54cafd[_0x1335('0x39')]=_[_0x1335('0x3c')](_0x54cafd['where'],{'$or':_[_0x1335('0x28')](_0x54cafd[_0x1335('0x32')],function(_0x17420d){var _0x346caf={};_0x346caf[_0x17420d]={'$like':'%'+_0x38423b[_0x1335('0x30')]['filter']+'%'};return _0x346caf;})});}_0x54cafd=_[_0x1335('0x3c')]({},_0x54cafd,_0x38423b[_0x1335('0x3d')]);return _0x398f51[_0x1335('0x4d')](_0x54cafd);}})[_0x1335('0x23')](function(_0x1edd46){if(_0x1edd46){_0x28359e=_0x1edd46['length'];if(!_0x38423b[_0x1335('0x30')][_0x1335('0x4a')](_0x1335('0x36'))){_0x54cafd[_0x1335('0x1e')]=qs[_0x1335('0x1e')](_0x38423b['query']['limit']);_0x54cafd[_0x1335('0x1c')]=qs[_0x1335('0x1c')](_0x38423b[_0x1335('0x30')][_0x1335('0x1c')]);}return _0x398f51['getDescriptions'](_0x54cafd);}})[_0x1335('0x23')](function(_0x3348f4){if(_0x3348f4){return _0x3348f4?{'count':_0x28359e,'rows':_0x3348f4}:null;}})[_0x1335('0x23')](respondWithResult(_0x3d87d2,null))['catch'](handleError(_0x3d87d2,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 02b6124..40f428e 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 _0xf1fd=['api','moment','request-promise','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations','util','../../config/logger'];(function(_0x5a494d,_0x44100b){var _0x3c8a70=function(_0xb49140){while(--_0xb49140){_0x5a494d['push'](_0x5a494d['shift']());}};_0x3c8a70(++_0x44100b);}(_0xf1fd,0xd0));var _0xdf1f=function(_0x7f7af2,_0xbd08f7){_0x7f7af2=_0x7f7af2-0x0;var _0x4ea15e=_0xf1fd[_0x7f7af2];return _0x4ea15e;};'use strict';var _=require('lodash');var util=require(_0xdf1f('0x0'));var logger=require(_0xdf1f('0x1'))(_0xdf1f('0x2'));var moment=require(_0xdf1f('0x3'));var BPromise=require('bluebird');var rp=require(_0xdf1f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdf1f('0x5'));var attributes=require(_0xdf1f('0x6'));module[_0xdf1f('0x7')]=function(_0x567e41,_0x42ff0a){return _0x567e41['define'](_0xdf1f('0x8'),attributes,{'tableName':_0xdf1f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x255c=['int_sugarcrm_configurations','lodash','api','moment','bluebird','request-promise','path','rimraf','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration'];(function(_0x1db9e7,_0x2b8778){var _0x309f58=function(_0x362d2d){while(--_0x362d2d){_0x1db9e7['push'](_0x1db9e7['shift']());}};_0x309f58(++_0x2b8778);}(_0x255c,0x145));var _0xc255=function(_0x4c7727,_0x4c3e6b){_0x4c7727=_0x4c7727-0x0;var _0x39f3e5=_0x255c[_0x4c7727];return _0x39f3e5;};'use strict';var _=require(_0xc255('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc255('0x1'));var moment=require(_0xc255('0x2'));var BPromise=require(_0xc255('0x3'));var rp=require(_0xc255('0x4'));var fs=require('fs');var path=require(_0xc255('0x5'));var rimraf=require(_0xc255('0x6'));var config=require('../../config/environment');var attributes=require(_0xc255('0x7'));module[_0xc255('0x8')]=function(_0x1871fc,_0x374e23){return _0x1871fc[_0xc255('0x9')](_0xc255('0xa'),attributes,{'tableName':_0xc255('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 728c78f..021c4eb 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 _0x6289=['stringify','error','code','message','info','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x32b7f4,_0x337767){var _0x4cba1b=function(_0x1a212d){while(--_0x1a212d){_0x32b7f4['push'](_0x32b7f4['shift']());}};_0x4cba1b(++_0x337767);}(_0x6289,0x9d));var _0x9628=function(_0xf3d3d,_0x18c710){_0xf3d3d=_0xf3d3d-0x0;var _0x1e5511=_0x6289[_0xf3d3d];return _0x1e5511;};'use strict';var _=require(_0x9628('0x0'));var util=require(_0x9628('0x1'));var moment=require(_0x9628('0x2'));var BPromise=require(_0x9628('0x3'));var rs=require(_0x9628('0x4'));var fs=require('fs');var Redis=require(_0x9628('0x5'));var db=require(_0x9628('0x6'))['db'];var utils=require(_0x9628('0x7'));var logger=require('../../config/logger')(_0x9628('0x8'));var config=require(_0x9628('0x9'));var jayson=require(_0x9628('0xa'));var client=jayson[_0x9628('0xb')][_0x9628('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e68c9,_0x2fb9bf,_0x49b21b){return new BPromise(function(_0xa297a4,_0x3c97a1){return client[_0x9628('0xd')](_0x2e68c9,_0x49b21b)[_0x9628('0xe')](function(_0x576fa4){logger['info'](_0x9628('0xf'),_0x2fb9bf,'request\x20sent');logger[_0x9628('0x10')](_0x9628('0x11'),_0x2fb9bf,'request\x20sent',JSON[_0x9628('0x12')](_0x576fa4));if(_0x576fa4['error']){if(_0x576fa4[_0x9628('0x13')][_0x9628('0x14')]===0x1f4){logger[_0x9628('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2fb9bf,_0x576fa4[_0x9628('0x13')][_0x9628('0x15')]);return _0x3c97a1(_0x576fa4[_0x9628('0x13')][_0x9628('0x15')]);}logger[_0x9628('0x13')](_0x9628('0xf'),_0x2fb9bf,_0x576fa4[_0x9628('0x13')][_0x9628('0x15')]);return _0xa297a4(_0x576fa4[_0x9628('0x13')][_0x9628('0x15')]);}else{logger[_0x9628('0x16')](_0x9628('0xf'),_0x2fb9bf,_0x9628('0x17'));_0xa297a4(_0x576fa4['result'][_0x9628('0x15')]);}})[_0x9628('0x18')](function(_0x463733){logger[_0x9628('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2fb9bf,_0x463733);_0x3c97a1(_0x463733);});});} \ No newline at end of file +var _0xebe9=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xebe9,0x73));var _0x9ebe=function(_0x27b51f,_0x23841d){_0x27b51f=_0x27b51f-0x0;var _0x10d44c=_0xebe9[_0x27b51f];return _0x10d44c;};'use strict';var _=require(_0x9ebe('0x0'));var util=require('util');var moment=require(_0x9ebe('0x1'));var BPromise=require(_0x9ebe('0x2'));var rs=require(_0x9ebe('0x3'));var fs=require('fs');var Redis=require(_0x9ebe('0x4'));var db=require(_0x9ebe('0x5'))['db'];var utils=require(_0x9ebe('0x6'));var logger=require(_0x9ebe('0x7'))(_0x9ebe('0x8'));var config=require(_0x9ebe('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9ebe('0xa')][_0x9ebe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa8397e,_0x4e9713,_0x54e275){return new BPromise(function(_0x3477d5,_0x4fb99f){return client[_0x9ebe('0xc')](_0xa8397e,_0x54e275)[_0x9ebe('0xd')](function(_0xae63a3){logger[_0x9ebe('0xe')](_0x9ebe('0xf'),_0x4e9713,'request\x20sent');logger[_0x9ebe('0x10')](_0x9ebe('0x11'),_0x4e9713,_0x9ebe('0x12'),JSON['stringify'](_0xae63a3));if(_0xae63a3[_0x9ebe('0x13')]){if(_0xae63a3[_0x9ebe('0x13')][_0x9ebe('0x14')]===0x1f4){logger['error'](_0x9ebe('0xf'),_0x4e9713,_0xae63a3[_0x9ebe('0x13')][_0x9ebe('0x15')]);return _0x4fb99f(_0xae63a3['error']['message']);}logger[_0x9ebe('0x13')](_0x9ebe('0xf'),_0x4e9713,_0xae63a3[_0x9ebe('0x13')]['message']);return _0x3477d5(_0xae63a3[_0x9ebe('0x13')][_0x9ebe('0x15')]);}else{logger['info'](_0x9ebe('0xf'),_0x4e9713,_0x9ebe('0x12'));_0x3477d5(_0xae63a3[_0x9ebe('0x16')][_0x9ebe('0x15')]);}})[_0x9ebe('0x17')](function(_0x4f0c77){logger[_0x9ebe('0x13')](_0x9ebe('0xf'),_0x4e9713,_0x4f0c77);_0x4fb99f(_0x4f0c77);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index befb386..07af721 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 _0xe068=['/:id','show','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index'];(function(_0x4dcf0a,_0x1e59cb){var _0x2196d6=function(_0xcd9916){while(--_0xcd9916){_0x4dcf0a['push'](_0x4dcf0a['shift']());}};_0x2196d6(++_0x1e59cb);}(_0xe068,0x183));var _0x8e06=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe068[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8e06('0x0'));var util=require(_0x8e06('0x1'));var path=require('path');var timeout=require(_0x8e06('0x2'));var express=require(_0x8e06('0x3'));var router=express[_0x8e06('0x4')]();var fs_extra=require(_0x8e06('0x5'));var auth=require(_0x8e06('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8e06('0x7'));var controller=require(_0x8e06('0x8'));router[_0x8e06('0x9')]('/',auth[_0x8e06('0xa')](),controller[_0x8e06('0xb')]);router[_0x8e06('0x9')](_0x8e06('0xc'),auth['isAuthenticated'](),controller[_0x8e06('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8e06('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x8e06('0xf')]);router[_0x8e06('0x10')](_0x8e06('0xc'),auth[_0x8e06('0xa')](),controller[_0x8e06('0x11')]);module[_0x8e06('0x12')]=router; \ No newline at end of file +var _0xa864=['multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','create','put','destroy'];(function(_0x4c3ffe,_0x457374){var _0x28d3eb=function(_0x3ae2a3){while(--_0x3ae2a3){_0x4c3ffe['push'](_0x4c3ffe['shift']());}};_0x28d3eb(++_0x457374);}(_0xa864,0x198));var _0x4a86=function(_0x358806,_0x322b66){_0x358806=_0x358806-0x0;var _0x19fdcb=_0xa864[_0x358806];return _0x19fdcb;};'use strict';var multer=require(_0x4a86('0x0'));var util=require('util');var path=require(_0x4a86('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4a86('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x4a86('0x3'));var interaction=require(_0x4a86('0x4'));var config=require(_0x4a86('0x5'));var controller=require('./intSugarcrmField.controller');router[_0x4a86('0x6')]('/',auth[_0x4a86('0x7')](),controller['index']);router[_0x4a86('0x6')](_0x4a86('0x8'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x4a86('0x9')]);router[_0x4a86('0xa')](_0x4a86('0x8'),auth[_0x4a86('0x7')](),controller['update']);router['delete'](_0x4a86('0x8'),auth['isAuthenticated'](),controller[_0x4a86('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 5bc7d4e..c12c457 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 _0x99ac=['exports','ENUM','string','variable','customVariable','STRING','BOOLEAN','sequelize'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x99ac,0x7f));var _0xc99a=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0x99ac[_0x576170];return _0x397c70;};'use strict';var Sequelize=require(_0xc99a('0x0'));module[_0xc99a('0x1')]={'type':{'type':Sequelize[_0xc99a('0x2')](_0xc99a('0x3'),_0xc99a('0x4'),_0xc99a('0x5'),'keyValue','picklist'),'defaultValue':_0xc99a('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc99a('0x6')]},'keyType':{'type':Sequelize[_0xc99a('0x2')](_0xc99a('0x3'),_0xc99a('0x4'),_0xc99a('0x5'))},'keyContent':{'type':Sequelize[_0xc99a('0x6')]},'idField':{'type':Sequelize[_0xc99a('0x6')]},'nameField':{'type':Sequelize[_0xc99a('0x6')]},'customField':{'type':Sequelize[_0xc99a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc99a('0x6')]}}; \ No newline at end of file +var _0xa734=['string','variable','customVariable','keyValue','picklist','STRING','exports','ENUM'];(function(_0x235fbd,_0x40807a){var _0x12adc3=function(_0x57316f){while(--_0x57316f){_0x235fbd['push'](_0x235fbd['shift']());}};_0x12adc3(++_0x40807a);}(_0xa734,0x96));var _0x4a73=function(_0x570f66,_0x1adea9){_0x570f66=_0x570f66-0x0;var _0x3d5fff=_0xa734[_0x570f66];return _0x3d5fff;};'use strict';var Sequelize=require('sequelize');module[_0x4a73('0x0')]={'type':{'type':Sequelize[_0x4a73('0x1')](_0x4a73('0x2'),_0x4a73('0x3'),_0x4a73('0x4'),_0x4a73('0x5'),_0x4a73('0x6')),'defaultValue':_0x4a73('0x2')},'content':{'type':Sequelize[_0x4a73('0x7')]},'key':{'type':Sequelize[_0x4a73('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x4a73('0x2'),_0x4a73('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x4a73('0x7')]},'idField':{'type':Sequelize[_0x4a73('0x7')]},'nameField':{'type':Sequelize[_0x4a73('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4a73('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 309b07f..5c89656 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 _0x2ece=['undefined','limit','offset','count','set','apply','reject','then','destroy','error','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','params','find','catch','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x34f409,_0x4a3982){var _0x353704=function(_0x5b1164){while(--_0x5b1164){_0x34f409['push'](_0x34f409['shift']());}};_0x353704(++_0x4a3982);}(_0x2ece,0x1e3));var _0xe2ec=function(_0x17e69b,_0x512806){_0x17e69b=_0x17e69b-0x0;var _0x55eea8=_0x2ece[_0x17e69b];return _0x55eea8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe2ec('0x0'));var zipdir=require(_0xe2ec('0x1'));var jsonpatch=require(_0xe2ec('0x2'));var rp=require('request-promise');var moment=require(_0xe2ec('0x3'));var BPromise=require(_0xe2ec('0x4'));var Mustache=require(_0xe2ec('0x5'));var util=require(_0xe2ec('0x6'));var path=require('path');var sox=require(_0xe2ec('0x7'));var csv=require('to-csv');var ejs=require(_0xe2ec('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe2ec('0x9'));var squel=require(_0xe2ec('0xa'));var crypto=require('crypto');var jsforce=require(_0xe2ec('0xb'));var deskjs=require(_0xe2ec('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe2ec('0xd'));var Papa=require(_0xe2ec('0xe'));var Redis=require(_0xe2ec('0xf'));var authService=require(_0xe2ec('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe2ec('0x11'));var hardwareService=require(_0xe2ec('0x12'));var logger=require('../../config/logger')(_0xe2ec('0x13'));var utils=require(_0xe2ec('0x14'));var config=require(_0xe2ec('0x15'));var licenseUtil=require(_0xe2ec('0x16'));var db=require(_0xe2ec('0x17'))['db'];function respondWithStatusCode(_0x42f161,_0xc3719f){_0xc3719f=_0xc3719f||0xcc;return function(_0x34ca22){if(_0x34ca22){return _0x42f161[_0xe2ec('0x18')](_0xc3719f);}return _0x42f161[_0xe2ec('0x19')](_0xc3719f)[_0xe2ec('0x1a')]();};}function respondWithResult(_0x5e5668,_0x1fd989){_0x1fd989=_0x1fd989||0xc8;return function(_0x3dc018){if(_0x3dc018){return _0x5e5668['status'](_0x1fd989)[_0xe2ec('0x1b')](_0x3dc018);}};}function respondWithFilteredResult(_0x381ed1,_0x3cabd8){return function(_0x2b16c3){if(_0x2b16c3){var _0x28c9f3=typeof _0x3cabd8['offset']===_0xe2ec('0x1c')&&typeof _0x3cabd8[_0xe2ec('0x1d')]===_0xe2ec('0x1c');var _0x2e645a=_0x2b16c3['count'];var _0x2f1234=_0x28c9f3?0x0:_0x3cabd8[_0xe2ec('0x1e')];var _0x309f43=_0x28c9f3?_0x2b16c3[_0xe2ec('0x1f')]:_0x3cabd8[_0xe2ec('0x1e')]+_0x3cabd8['limit'];var _0x41e7ef;if(_0x309f43>=_0x2e645a){_0x309f43=_0x2e645a;_0x41e7ef=0xc8;}else{_0x41e7ef=0xce;}_0x381ed1[_0xe2ec('0x19')](_0x41e7ef);return _0x381ed1[_0xe2ec('0x20')]('Content-Range',_0x2f1234+'-'+_0x309f43+'/'+_0x2e645a)['json'](_0x2b16c3);}return null;};}function patchUpdates(_0x36bfe6){return function(_0x4f42c6){try{jsonpatch[_0xe2ec('0x21')](_0x4f42c6,_0x36bfe6,!![]);}catch(_0x1dec71){return BPromise[_0xe2ec('0x22')](_0x1dec71);}return _0x4f42c6['save']();};}function saveUpdates(_0x4781ed,_0x260e48){return function(_0x4542e4){if(_0x4542e4){return _0x4542e4['update'](_0x4781ed)[_0xe2ec('0x23')](function(_0x5a5a4a){return _0x5a5a4a;});}return null;};}function removeEntity(_0xee465d,_0x5eb5fa){return function(_0x35b43a){if(_0x35b43a){return _0x35b43a[_0xe2ec('0x24')]()['then'](function(){_0xee465d[_0xe2ec('0x19')](0xcc)[_0xe2ec('0x1a')]();});}};}function handleEntityNotFound(_0x23030c,_0x2c8fa2){return function(_0x28e38a){if(!_0x28e38a){_0x23030c[_0xe2ec('0x18')](0x194);}return _0x28e38a;};}function handleError(_0x49b741,_0x256917){_0x256917=_0x256917||0x1f4;return function(_0x38f751){logger[_0xe2ec('0x25')](_0x38f751['stack']);if(_0x38f751['name']){delete _0x38f751[_0xe2ec('0x26')];}_0x49b741[_0xe2ec('0x19')](_0x256917)[_0xe2ec('0x27')](_0x38f751);};}exports[_0xe2ec('0x28')]=function(_0x14ba93,_0x7a18f){var _0x35334e={},_0x484712={},_0x165e0b={'count':0x0,'rows':[]};var _0xda9819=_[_0xe2ec('0x29')](db[_0xe2ec('0x2a')][_0xe2ec('0x2b')],function(_0x4c46ae){return{'name':_0x4c46ae[_0xe2ec('0x2c')],'type':_0x4c46ae[_0xe2ec('0x2d')][_0xe2ec('0x2e')]};});_0x484712[_0xe2ec('0x2f')]=_[_0xe2ec('0x29')](_0xda9819,_0xe2ec('0x26'));_0x484712[_0xe2ec('0x30')]=_[_0xe2ec('0x31')](_0x14ba93[_0xe2ec('0x30')]);_0x484712[_0xe2ec('0x32')]=_[_0xe2ec('0x33')](_0x484712[_0xe2ec('0x2f')],_0x484712['query']);_0x35334e['attributes']=_[_0xe2ec('0x33')](_0x484712[_0xe2ec('0x2f')],qs[_0xe2ec('0x34')](_0x14ba93[_0xe2ec('0x30')][_0xe2ec('0x34')]));_0x35334e[_0xe2ec('0x35')]=_0x35334e['attributes'][_0xe2ec('0x36')]?_0x35334e[_0xe2ec('0x35')]:_0x484712[_0xe2ec('0x2f')];if(!_0x14ba93[_0xe2ec('0x30')][_0xe2ec('0x37')](_0xe2ec('0x38'))){_0x35334e[_0xe2ec('0x1d')]=qs[_0xe2ec('0x1d')](_0x14ba93[_0xe2ec('0x30')]['limit']);_0x35334e['offset']=qs[_0xe2ec('0x1e')](_0x14ba93[_0xe2ec('0x30')][_0xe2ec('0x1e')]);}_0x35334e[_0xe2ec('0x39')]=qs[_0xe2ec('0x3a')](_0x14ba93[_0xe2ec('0x30')][_0xe2ec('0x3a')]);_0x35334e['where']=qs['filters'](_[_0xe2ec('0x3b')](_0x14ba93[_0xe2ec('0x30')],_0x484712['filters']),_0xda9819);if(_0x14ba93[_0xe2ec('0x30')][_0xe2ec('0x3c')]){_0x35334e[_0xe2ec('0x3d')]=_[_0xe2ec('0x3e')](_0x35334e[_0xe2ec('0x3d')],{'$or':_[_0xe2ec('0x29')](_0xda9819,function(_0x26e5bf){if(_0x26e5bf['type']!=='VIRTUAL'){var _0x331831={};_0x331831[_0x26e5bf['name']]={'$like':'%'+_0x14ba93[_0xe2ec('0x30')][_0xe2ec('0x3c')]+'%'};return _0x331831;}})});}_0x35334e=_['merge']({},_0x35334e,_0x14ba93[_0xe2ec('0x3f')]);var _0x34ff27={'where':_0x35334e[_0xe2ec('0x3d')]};return db[_0xe2ec('0x2a')][_0xe2ec('0x1f')](_0x34ff27)[_0xe2ec('0x23')](function(_0x2ef0c1){_0x165e0b[_0xe2ec('0x1f')]=_0x2ef0c1;if(_0x14ba93[_0xe2ec('0x30')][_0xe2ec('0x40')]){_0x35334e[_0xe2ec('0x41')]=[{'all':!![]}];}return db[_0xe2ec('0x2a')][_0xe2ec('0x42')](_0x35334e);})[_0xe2ec('0x23')](function(_0x1e7bfe){_0x165e0b[_0xe2ec('0x43')]=_0x1e7bfe;return _0x165e0b;})[_0xe2ec('0x23')](respondWithFilteredResult(_0x7a18f,_0x35334e))['catch'](handleError(_0x7a18f,null));};exports['show']=function(_0x15db39,_0x181790){var _0x267337={'raw':!![],'where':{'id':_0x15db39[_0xe2ec('0x44')]['id']}},_0x27e161={};_0x27e161[_0xe2ec('0x2f')]=_[_0xe2ec('0x31')](db[_0xe2ec('0x2a')][_0xe2ec('0x2b')]);_0x27e161['query']=_[_0xe2ec('0x31')](_0x15db39[_0xe2ec('0x30')]);_0x27e161[_0xe2ec('0x32')]=_[_0xe2ec('0x33')](_0x27e161['model'],_0x27e161['query']);_0x267337[_0xe2ec('0x35')]=_[_0xe2ec('0x33')](_0x27e161['model'],qs[_0xe2ec('0x34')](_0x15db39[_0xe2ec('0x30')][_0xe2ec('0x34')]));_0x267337[_0xe2ec('0x35')]=_0x267337[_0xe2ec('0x35')]['length']?_0x267337[_0xe2ec('0x35')]:_0x27e161[_0xe2ec('0x2f')];if(_0x15db39[_0xe2ec('0x30')][_0xe2ec('0x40')]){_0x267337[_0xe2ec('0x41')]=[{'all':!![]}];}_0x267337=_['merge']({},_0x267337,_0x15db39[_0xe2ec('0x3f')]);return db[_0xe2ec('0x2a')][_0xe2ec('0x45')](_0x267337)[_0xe2ec('0x23')](handleEntityNotFound(_0x181790,null))[_0xe2ec('0x23')](respondWithResult(_0x181790,null))[_0xe2ec('0x46')](handleError(_0x181790,null));};exports[_0xe2ec('0x47')]=function(_0x5b38d3,_0x135176){return db[_0xe2ec('0x2a')]['create'](_0x5b38d3['body'],{})[_0xe2ec('0x23')](respondWithResult(_0x135176,0xc9))[_0xe2ec('0x46')](handleError(_0x135176,null));};exports['update']=function(_0x44ec0f,_0x142ce5){if(_0x44ec0f[_0xe2ec('0x48')]['id']){delete _0x44ec0f[_0xe2ec('0x48')]['id'];}return db[_0xe2ec('0x2a')][_0xe2ec('0x45')]({'where':{'id':_0x44ec0f[_0xe2ec('0x44')]['id']}})['then'](handleEntityNotFound(_0x142ce5,null))[_0xe2ec('0x23')](saveUpdates(_0x44ec0f['body'],null))[_0xe2ec('0x23')](respondWithResult(_0x142ce5,null))[_0xe2ec('0x46')](handleError(_0x142ce5,null));};exports[_0xe2ec('0x24')]=function(_0x7d3def,_0x27e397){return db[_0xe2ec('0x2a')][_0xe2ec('0x45')]({'where':{'id':_0x7d3def['params']['id']}})['then'](handleEntityNotFound(_0x27e397,null))['then'](removeEntity(_0x27e397,null))[_0xe2ec('0x46')](handleError(_0x27e397,null));}; \ No newline at end of file +var _0x354c=['intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','include','findAll','rows','catch','show','keys','fields','includeAll','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','SugarcrmField','rawAttributes','key','model','query','filters'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x354c,0x194));var _0xc354=function(_0x1a5286,_0x436e0e){_0x1a5286=_0x1a5286-0x0;var _0xf26a99=_0x354c[_0x1a5286];return _0xf26a99;};'use strict';var emlformat=require(_0xc354('0x0'));var rimraf=require(_0xc354('0x1'));var zipdir=require(_0xc354('0x2'));var jsonpatch=require(_0xc354('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc354('0x4'));var Mustache=require('mustache');var util=require(_0xc354('0x5'));var path=require('path');var sox=require(_0xc354('0x6'));var csv=require('to-csv');var ejs=require(_0xc354('0x7'));var fs=require('fs');var fs_extra=require(_0xc354('0x8'));var _=require(_0xc354('0x9'));var squel=require(_0xc354('0xa'));var crypto=require(_0xc354('0xb'));var jsforce=require(_0xc354('0xc'));var deskjs=require(_0xc354('0xd'));var toCsv=require(_0xc354('0xe'));var querystring=require(_0xc354('0xf'));var Papa=require(_0xc354('0x10'));var Redis=require(_0xc354('0x11'));var authService=require(_0xc354('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc354('0x13'));var hardwareService=require(_0xc354('0x14'));var logger=require(_0xc354('0x15'))(_0xc354('0x16'));var utils=require(_0xc354('0x17'));var config=require(_0xc354('0x18'));var licenseUtil=require(_0xc354('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4785ea,_0x4df522){_0x4df522=_0x4df522||0xcc;return function(_0x43537d){if(_0x43537d){return _0x4785ea[_0xc354('0x1a')](_0x4df522);}return _0x4785ea[_0xc354('0x1b')](_0x4df522)[_0xc354('0x1c')]();};}function respondWithResult(_0x4e8082,_0x9b2f9b){_0x9b2f9b=_0x9b2f9b||0xc8;return function(_0x2b04e7){if(_0x2b04e7){return _0x4e8082[_0xc354('0x1b')](_0x9b2f9b)['json'](_0x2b04e7);}};}function respondWithFilteredResult(_0x2ef66f,_0x3a78e8){return function(_0x2ded6c){if(_0x2ded6c){var _0x4f890a=typeof _0x3a78e8[_0xc354('0x1d')]===_0xc354('0x1e')&&typeof _0x3a78e8[_0xc354('0x1f')]==='undefined';var _0x33c7a3=_0x2ded6c[_0xc354('0x20')];var _0x52ea81=_0x4f890a?0x0:_0x3a78e8[_0xc354('0x1d')];var _0x1a0994=_0x4f890a?_0x2ded6c[_0xc354('0x20')]:_0x3a78e8[_0xc354('0x1d')]+_0x3a78e8[_0xc354('0x1f')];var _0x565687;if(_0x1a0994>=_0x33c7a3){_0x1a0994=_0x33c7a3;_0x565687=0xc8;}else{_0x565687=0xce;}_0x2ef66f[_0xc354('0x1b')](_0x565687);return _0x2ef66f['set'](_0xc354('0x21'),_0x52ea81+'-'+_0x1a0994+'/'+_0x33c7a3)[_0xc354('0x22')](_0x2ded6c);}return null;};}function patchUpdates(_0x5e60e2){return function(_0x9dfbc){try{jsonpatch[_0xc354('0x23')](_0x9dfbc,_0x5e60e2,!![]);}catch(_0xdc31ad){return BPromise[_0xc354('0x24')](_0xdc31ad);}return _0x9dfbc[_0xc354('0x25')]();};}function saveUpdates(_0x30ac34,_0xf5bcb4){return function(_0x534e18){if(_0x534e18){return _0x534e18[_0xc354('0x26')](_0x30ac34)[_0xc354('0x27')](function(_0x5cd8e3){return _0x5cd8e3;});}return null;};}function removeEntity(_0x329058,_0x5ce511){return function(_0x2741db){if(_0x2741db){return _0x2741db[_0xc354('0x28')]()[_0xc354('0x27')](function(){_0x329058[_0xc354('0x1b')](0xcc)[_0xc354('0x1c')]();});}};}function handleEntityNotFound(_0x3e2097,_0x4af941){return function(_0x556a56){if(!_0x556a56){_0x3e2097['sendStatus'](0x194);}return _0x556a56;};}function handleError(_0x22cf34,_0x560b09){_0x560b09=_0x560b09||0x1f4;return function(_0xf065e9){logger[_0xc354('0x29')](_0xf065e9[_0xc354('0x2a')]);if(_0xf065e9[_0xc354('0x2b')]){delete _0xf065e9['name'];}_0x22cf34[_0xc354('0x1b')](_0x560b09)['send'](_0xf065e9);};}exports[_0xc354('0x2c')]=function(_0x38d1e6,_0x2961fb){var _0x38cdc5={},_0x299bcd={},_0x292169={'count':0x0,'rows':[]};var _0x4d127f=_[_0xc354('0x2d')](db[_0xc354('0x2e')][_0xc354('0x2f')],function(_0x4dac23){return{'name':_0x4dac23['fieldName'],'type':_0x4dac23['type'][_0xc354('0x30')]};});_0x299bcd[_0xc354('0x31')]=_['map'](_0x4d127f,_0xc354('0x2b'));_0x299bcd[_0xc354('0x32')]=_['keys'](_0x38d1e6['query']);_0x299bcd[_0xc354('0x33')]=_[_0xc354('0x34')](_0x299bcd[_0xc354('0x31')],_0x299bcd[_0xc354('0x32')]);_0x38cdc5[_0xc354('0x35')]=_[_0xc354('0x34')](_0x299bcd[_0xc354('0x31')],qs['fields'](_0x38d1e6[_0xc354('0x32')]['fields']));_0x38cdc5[_0xc354('0x35')]=_0x38cdc5[_0xc354('0x35')][_0xc354('0x36')]?_0x38cdc5[_0xc354('0x35')]:_0x299bcd[_0xc354('0x31')];if(!_0x38d1e6['query'][_0xc354('0x37')]('nolimit')){_0x38cdc5['limit']=qs['limit'](_0x38d1e6[_0xc354('0x32')]['limit']);_0x38cdc5[_0xc354('0x1d')]=qs[_0xc354('0x1d')](_0x38d1e6['query'][_0xc354('0x1d')]);}_0x38cdc5[_0xc354('0x38')]=qs[_0xc354('0x39')](_0x38d1e6[_0xc354('0x32')]['sort']);_0x38cdc5[_0xc354('0x3a')]=qs['filters'](_[_0xc354('0x3b')](_0x38d1e6[_0xc354('0x32')],_0x299bcd[_0xc354('0x33')]),_0x4d127f);if(_0x38d1e6['query'][_0xc354('0x3c')]){_0x38cdc5[_0xc354('0x3a')]=_[_0xc354('0x3d')](_0x38cdc5[_0xc354('0x3a')],{'$or':_[_0xc354('0x2d')](_0x4d127f,function(_0x4a789e){if(_0x4a789e[_0xc354('0x3e')]!=='VIRTUAL'){var _0x2f0924={};_0x2f0924[_0x4a789e[_0xc354('0x2b')]]={'$like':'%'+_0x38d1e6[_0xc354('0x32')][_0xc354('0x3c')]+'%'};return _0x2f0924;}})});}_0x38cdc5=_[_0xc354('0x3d')]({},_0x38cdc5,_0x38d1e6['options']);var _0x1748c2={'where':_0x38cdc5[_0xc354('0x3a')]};return db[_0xc354('0x2e')][_0xc354('0x20')](_0x1748c2)[_0xc354('0x27')](function(_0x3dae9b){_0x292169['count']=_0x3dae9b;if(_0x38d1e6[_0xc354('0x32')]['includeAll']){_0x38cdc5[_0xc354('0x3f')]=[{'all':!![]}];}return db[_0xc354('0x2e')][_0xc354('0x40')](_0x38cdc5);})['then'](function(_0x3d9e27){_0x292169[_0xc354('0x41')]=_0x3d9e27;return _0x292169;})[_0xc354('0x27')](respondWithFilteredResult(_0x2961fb,_0x38cdc5))[_0xc354('0x42')](handleError(_0x2961fb,null));};exports[_0xc354('0x43')]=function(_0x678dbf,_0xd13641){var _0x221cb3={'raw':!![],'where':{'id':_0x678dbf['params']['id']}},_0x297f39={};_0x297f39[_0xc354('0x31')]=_[_0xc354('0x44')](db['SugarcrmField'][_0xc354('0x2f')]);_0x297f39[_0xc354('0x32')]=_[_0xc354('0x44')](_0x678dbf[_0xc354('0x32')]);_0x297f39[_0xc354('0x33')]=_[_0xc354('0x34')](_0x297f39[_0xc354('0x31')],_0x297f39[_0xc354('0x32')]);_0x221cb3['attributes']=_[_0xc354('0x34')](_0x297f39[_0xc354('0x31')],qs['fields'](_0x678dbf['query'][_0xc354('0x45')]));_0x221cb3[_0xc354('0x35')]=_0x221cb3[_0xc354('0x35')][_0xc354('0x36')]?_0x221cb3[_0xc354('0x35')]:_0x297f39[_0xc354('0x31')];if(_0x678dbf[_0xc354('0x32')][_0xc354('0x46')]){_0x221cb3[_0xc354('0x3f')]=[{'all':!![]}];}_0x221cb3=_[_0xc354('0x3d')]({},_0x221cb3,_0x678dbf[_0xc354('0x47')]);return db[_0xc354('0x2e')][_0xc354('0x48')](_0x221cb3)['then'](handleEntityNotFound(_0xd13641,null))['then'](respondWithResult(_0xd13641,null))[_0xc354('0x42')](handleError(_0xd13641,null));};exports[_0xc354('0x49')]=function(_0x188029,_0x3e9e6f){return db[_0xc354('0x2e')]['create'](_0x188029[_0xc354('0x4a')],{})[_0xc354('0x27')](respondWithResult(_0x3e9e6f,0xc9))['catch'](handleError(_0x3e9e6f,null));};exports[_0xc354('0x26')]=function(_0x384e35,_0x1275d2){if(_0x384e35[_0xc354('0x4a')]['id']){delete _0x384e35[_0xc354('0x4a')]['id'];}return db['SugarcrmField'][_0xc354('0x48')]({'where':{'id':_0x384e35['params']['id']}})[_0xc354('0x27')](handleEntityNotFound(_0x1275d2,null))[_0xc354('0x27')](saveUpdates(_0x384e35[_0xc354('0x4a')],null))[_0xc354('0x27')](respondWithResult(_0x1275d2,null))[_0xc354('0x42')](handleError(_0x1275d2,null));};exports['destroy']=function(_0x237c50,_0x1ff93f){return db['SugarcrmField'][_0xc354('0x48')]({'where':{'id':_0x237c50[_0xc354('0x4b')]['id']}})[_0xc354('0x27')](handleEntityNotFound(_0x1ff93f,null))[_0xc354('0x27')](removeEntity(_0x1ff93f,null))[_0xc354('0x42')](handleError(_0x1ff93f,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index b57c558..bfae0b6 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 _0xb3fe=['rimraf','../../config/environment','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x9932c0,_0x40dbe4){var _0x1d7eb3=function(_0x405bc1){while(--_0x405bc1){_0x9932c0['push'](_0x9932c0['shift']());}};_0x1d7eb3(++_0x40dbe4);}(_0xb3fe,0x180));var _0xeb3f=function(_0x11d953,_0x450fc7){_0x11d953=_0x11d953-0x0;var _0x198c45=_0xb3fe[_0x11d953];return _0x198c45;};'use strict';var _=require(_0xeb3f('0x0'));var util=require('util');var logger=require(_0xeb3f('0x1'))(_0xeb3f('0x2'));var moment=require(_0xeb3f('0x3'));var BPromise=require(_0xeb3f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb3f('0x5'));var rimraf=require(_0xeb3f('0x6'));var config=require(_0xeb3f('0x7'));var attributes=require('./intSugarcrmField.attributes');module[_0xeb3f('0x8')]=function(_0x2847c1,_0x4370b9){return _0x2847c1[_0xeb3f('0x9')](_0xeb3f('0xa'),attributes,{'tableName':_0xeb3f('0xb'),'paranoid':![],'indexes':[{'name':_0xeb3f('0xc'),'fields':[_0xeb3f('0xd'),_0xeb3f('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfbbd=['idField','FieldId','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index'];(function(_0x22cea3,_0x56d0ce){var _0x2fbfee=function(_0xceb636){while(--_0xceb636){_0x22cea3['push'](_0x22cea3['shift']());}};_0x2fbfee(++_0x56d0ce);}(_0xfbbd,0x179));var _0xdfbb=function(_0x46726e,_0x2fdbcf){_0x46726e=_0x46726e-0x0;var _0x41535e=_0xfbbd[_0x46726e];return _0x41535e;};'use strict';var _=require(_0xdfbb('0x0'));var util=require(_0xdfbb('0x1'));var logger=require(_0xdfbb('0x2'))(_0xdfbb('0x3'));var moment=require(_0xdfbb('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdfbb('0x5'));var config=require(_0xdfbb('0x6'));var attributes=require(_0xdfbb('0x7'));module[_0xdfbb('0x8')]=function(_0x57e7ea,_0x32daa7){return _0x57e7ea[_0xdfbb('0x9')](_0xdfbb('0xa'),attributes,{'tableName':_0xdfbb('0xb'),'paranoid':![],'indexes':[{'name':_0xdfbb('0xc'),'fields':[_0xdfbb('0xd'),_0xdfbb('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 66a6257..87ef12a 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 _0xcf61=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x2ba4be,_0x12fe61){var _0x239c22=function(_0x125f2){while(--_0x125f2){_0x2ba4be['push'](_0x2ba4be['shift']());}};_0x239c22(++_0x12fe61);}(_0xcf61,0xc8));var _0x1cf6=function(_0xdd4f11,_0x274420){_0xdd4f11=_0xdd4f11-0x0;var _0x50a0a1=_0xcf61[_0xdd4f11];return _0x50a0a1;};'use strict';var _=require(_0x1cf6('0x0'));var util=require(_0x1cf6('0x1'));var moment=require(_0x1cf6('0x2'));var BPromise=require(_0x1cf6('0x3'));var rs=require(_0x1cf6('0x4'));var fs=require('fs');var Redis=require(_0x1cf6('0x5'));var db=require(_0x1cf6('0x6'))['db'];var utils=require(_0x1cf6('0x7'));var logger=require('../../config/logger')(_0x1cf6('0x8'));var config=require('../../config/environment');var jayson=require(_0x1cf6('0x9'));var client=jayson[_0x1cf6('0xa')][_0x1cf6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36863e,_0x2a432c,_0x37ec3c){return new BPromise(function(_0x3d1fa8,_0x36ae2a){return client[_0x1cf6('0xc')](_0x36863e,_0x37ec3c)[_0x1cf6('0xd')](function(_0x2c301e){logger[_0x1cf6('0xe')](_0x1cf6('0xf'),_0x2a432c,_0x1cf6('0x10'));logger[_0x1cf6('0x11')](_0x1cf6('0x12'),_0x2a432c,_0x1cf6('0x10'),JSON[_0x1cf6('0x13')](_0x2c301e));if(_0x2c301e[_0x1cf6('0x14')]){if(_0x2c301e[_0x1cf6('0x14')][_0x1cf6('0x15')]===0x1f4){logger[_0x1cf6('0x14')]('SugarcrmField,\x20%s,\x20%s',_0x2a432c,_0x2c301e[_0x1cf6('0x14')]['message']);return _0x36ae2a(_0x2c301e['error']['message']);}logger[_0x1cf6('0x14')](_0x1cf6('0xf'),_0x2a432c,_0x2c301e[_0x1cf6('0x14')][_0x1cf6('0x16')]);return _0x3d1fa8(_0x2c301e[_0x1cf6('0x14')][_0x1cf6('0x16')]);}else{logger['info'](_0x1cf6('0xf'),_0x2a432c,_0x1cf6('0x10'));_0x3d1fa8(_0x2c301e[_0x1cf6('0x17')][_0x1cf6('0x16')]);}})[_0x1cf6('0x18')](function(_0x5e06fb){logger[_0x1cf6('0x14')](_0x1cf6('0xf'),_0x2a432c,_0x5e06fb);_0x36ae2a(_0x5e06fb);});});} \ No newline at end of file +var _0xff79=['../../mysqldb','../../config/environment','jayson/promise','request','then','request\x20sent','stringify','error','SugarcrmField,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x2329d7,_0x4296b6){var _0x201e8c=function(_0x3b3aac){while(--_0x3b3aac){_0x2329d7['push'](_0x2329d7['shift']());}};_0x201e8c(++_0x4296b6);}(_0xff79,0x67));var _0x9ff7=function(_0x427298,_0x248100){_0x427298=_0x427298-0x0;var _0x36d3c2=_0xff79[_0x427298];return _0x36d3c2;};'use strict';var _=require(_0x9ff7('0x0'));var util=require(_0x9ff7('0x1'));var moment=require(_0x9ff7('0x2'));var BPromise=require(_0x9ff7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ff7('0x4'));var db=require(_0x9ff7('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9ff7('0x6'));var jayson=require(_0x9ff7('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5b813a,_0x247947,_0x1db177){return new BPromise(function(_0x2c7980,_0x2d113f){return client[_0x9ff7('0x8')](_0x5b813a,_0x1db177)[_0x9ff7('0x9')](function(_0x271574){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x247947,'request\x20sent');logger['debug']('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x247947,_0x9ff7('0xa'),JSON[_0x9ff7('0xb')](_0x271574));if(_0x271574[_0x9ff7('0xc')]){if(_0x271574['error']['code']===0x1f4){logger[_0x9ff7('0xc')](_0x9ff7('0xd'),_0x247947,_0x271574[_0x9ff7('0xc')][_0x9ff7('0xe')]);return _0x2d113f(_0x271574[_0x9ff7('0xc')][_0x9ff7('0xe')]);}logger[_0x9ff7('0xc')](_0x9ff7('0xd'),_0x247947,_0x271574[_0x9ff7('0xc')][_0x9ff7('0xe')]);return _0x2c7980(_0x271574[_0x9ff7('0xc')][_0x9ff7('0xe')]);}else{logger[_0x9ff7('0xf')](_0x9ff7('0xd'),_0x247947,_0x9ff7('0xa'));_0x2c7980(_0x271574[_0x9ff7('0x10')][_0x9ff7('0xe')]);}})[_0x9ff7('0x11')](function(_0x5246d0){logger['error'](_0x9ff7('0xd'),_0x247947,_0x5246d0);_0x2d113f(_0x5246d0);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 15205db..45ce58b 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 _0x0434=['./intVtigerAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3ec741,_0x1970b4){var _0x24a6b8=function(_0x58360b){while(--_0x58360b){_0x3ec741['push'](_0x3ec741['shift']());}};_0x24a6b8(++_0x1970b4);}(_0x0434,0x1ad));var _0x4043=function(_0x58c20f,_0x4cdb1b){_0x58c20f=_0x58c20f-0x0;var _0x3b0318=_0x0434[_0x58c20f];return _0x3b0318;};'use strict';var multer=require(_0x4043('0x0'));var util=require(_0x4043('0x1'));var path=require(_0x4043('0x2'));var timeout=require(_0x4043('0x3'));var express=require(_0x4043('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4043('0x5'));var interaction=require(_0x4043('0x6'));var config=require(_0x4043('0x7'));var controller=require(_0x4043('0x8'));router[_0x4043('0x9')]('/',auth[_0x4043('0xa')](),controller['index']);router[_0x4043('0x9')](_0x4043('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x4043('0x9')](_0x4043('0xc'),auth[_0x4043('0xa')](),controller[_0x4043('0xd')]);router[_0x4043('0x9')](_0x4043('0xe'),auth[_0x4043('0xa')](),controller[_0x4043('0xf')]);router['post']('/',auth[_0x4043('0xa')](),controller[_0x4043('0x10')]);router[_0x4043('0x11')](_0x4043('0xc'),auth[_0x4043('0xa')](),controller['addConfiguration']);router[_0x4043('0x12')](_0x4043('0xb'),auth[_0x4043('0xa')](),controller[_0x4043('0x13')]);router[_0x4043('0x14')]('/:id',auth[_0x4043('0xa')](),controller[_0x4043('0x15')]);module[_0x4043('0x16')]=router; \ No newline at end of file +var _0x33a4=['../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','destroy','exports','util','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x33a4,0x88));var _0x433a=function(_0x401121,_0x181adb){_0x401121=_0x401121-0x0;var _0x3aef8f=_0x33a4[_0x401121];return _0x3aef8f;};'use strict';var multer=require('multer');var util=require(_0x433a('0x0'));var path=require('path');var timeout=require(_0x433a('0x1'));var express=require(_0x433a('0x2'));var router=express[_0x433a('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x433a('0x4'));var controller=require(_0x433a('0x5'));router[_0x433a('0x6')]('/',auth[_0x433a('0x7')](),controller[_0x433a('0x8')]);router['get'](_0x433a('0x9'),auth['isAuthenticated'](),controller[_0x433a('0xa')]);router[_0x433a('0x6')](_0x433a('0xb'),auth[_0x433a('0x7')](),controller['getConfigurations']);router['get'](_0x433a('0xc'),auth[_0x433a('0x7')](),controller[_0x433a('0xd')]);router[_0x433a('0xe')]('/',auth[_0x433a('0x7')](),controller['create']);router['post'](_0x433a('0xb'),auth[_0x433a('0x7')](),controller[_0x433a('0xf')]);router[_0x433a('0x10')]('/:id',auth[_0x433a('0x7')](),controller[_0x433a('0x11')]);router['delete'](_0x433a('0x9'),auth['isAuthenticated'](),controller[_0x433a('0x12')]);module[_0x433a('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index b6dd699..dd798dc 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 _0x488e=['STRING','HelpDesk','sequelize'];(function(_0x855e7,_0x21975d){var _0xe4a718=function(_0x3f71a8){while(--_0x3f71a8){_0x855e7['push'](_0x855e7['shift']());}};_0xe4a718(++_0x21975d);}(_0x488e,0x170));var _0xe488=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x488e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe488('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xe488('0x1')]},'username':{'type':Sequelize[_0xe488('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xe488('0x1')],'allowNull':![],'defaultValue':_0xe488('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xe488('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xe488('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xd943=['exports','STRING','sequelize'];(function(_0x187d80,_0x5b793f){var _0x498a77=function(_0x633dc9){while(--_0x633dc9){_0x187d80['push'](_0x187d80['shift']());}};_0x498a77(++_0x5b793f);}(_0xd943,0x11c));var _0x3d94=function(_0x510c44,_0x3ed5a0){_0x510c44=_0x510c44-0x0;var _0x52115a=_0xd943[_0x510c44];return _0x52115a;};'use strict';var Sequelize=require(_0x3d94('0x0'));module[_0x3d94('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3d94('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x3d94('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x3d94('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x3d94('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x3d94('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index b5f4ea9..c2fc972 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 _0x89e3=['util','path','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','map','VtigerAccount','rawAttributes','type','name','query','keys','intersection','model','attributes','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','fields','length','includeAll','find','create','body','getConfigurations','findOne','VtigerConfiguration','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','remoteUri','serverUrl','accessKey','moduleName','slice','lastIndexOf','format','%s/webservice.php','GET','success','POST','login','describe','result','sessionName','reference','remove','includes','editable','false','label','startsWith','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','request-promise','moment','bluebird','mustache'];(function(_0x1d1294,_0x3787aa){var _0x5a2d01=function(_0x54a054){while(--_0x54a054){_0x1d1294['push'](_0x1d1294['shift']());}};_0x5a2d01(++_0x3787aa);}(_0x89e3,0xe6));var _0x389e=function(_0x422e04,_0x424197){_0x422e04=_0x422e04-0x0;var _0xeaec71=_0x89e3[_0x422e04];return _0xeaec71;};'use strict';var emlformat=require(_0x389e('0x0'));var rimraf=require(_0x389e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x389e('0x2'));var moment=require(_0x389e('0x3'));var BPromise=require(_0x389e('0x4'));var Mustache=require(_0x389e('0x5'));var util=require(_0x389e('0x6'));var path=require(_0x389e('0x7'));var sox=require('sox');var csv=require(_0x389e('0x8'));var ejs=require(_0x389e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x389e('0xa'));var squel=require('squel');var crypto=require(_0x389e('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x389e('0xc'));var Papa=require(_0x389e('0xd'));var Redis=require(_0x389e('0xe'));var authService=require(_0x389e('0xf'));var qs=require(_0x389e('0x10'));var as=require(_0x389e('0x11'));var hardwareService=require(_0x389e('0x12'));var logger=require(_0x389e('0x13'))(_0x389e('0x14'));var utils=require('../../config/utils');var config=require(_0x389e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x389e('0x16'))['db'];var integrations=require(_0x389e('0x17'));function respondWithStatusCode(_0xbf6db8,_0x583a84){_0x583a84=_0x583a84||0xcc;return function(_0x3f06e6){if(_0x3f06e6){return _0xbf6db8['sendStatus'](_0x583a84);}return _0xbf6db8[_0x389e('0x18')](_0x583a84)[_0x389e('0x19')]();};}function respondWithResult(_0x139eb4,_0x10ec5a){_0x10ec5a=_0x10ec5a||0xc8;return function(_0x4c2a1c){if(_0x4c2a1c){return _0x139eb4['status'](_0x10ec5a)[_0x389e('0x1a')](_0x4c2a1c);}};}function respondWithFilteredResult(_0x3d67e3,_0x6e5d89){return function(_0x29d4ae){if(_0x29d4ae){var _0x5e6e84=typeof _0x6e5d89[_0x389e('0x1b')]===_0x389e('0x1c')&&typeof _0x6e5d89[_0x389e('0x1d')]===_0x389e('0x1c');var _0x2f8750=_0x29d4ae[_0x389e('0x1e')];var _0x2c460e=_0x5e6e84?0x0:_0x6e5d89[_0x389e('0x1b')];var _0x3e1e87=_0x5e6e84?_0x29d4ae[_0x389e('0x1e')]:_0x6e5d89['offset']+_0x6e5d89[_0x389e('0x1d')];var _0x5df513;if(_0x3e1e87>=_0x2f8750){_0x3e1e87=_0x2f8750;_0x5df513=0xc8;}else{_0x5df513=0xce;}_0x3d67e3['status'](_0x5df513);return _0x3d67e3[_0x389e('0x1f')](_0x389e('0x20'),_0x2c460e+'-'+_0x3e1e87+'/'+_0x2f8750)[_0x389e('0x1a')](_0x29d4ae);}return null;};}function patchUpdates(_0xe9d0b6){return function(_0x2ed242){try{jsonpatch[_0x389e('0x21')](_0x2ed242,_0xe9d0b6,!![]);}catch(_0x13d61c){return BPromise[_0x389e('0x22')](_0x13d61c);}return _0x2ed242['save']();};}function saveUpdates(_0x15b1e2,_0x42e7c0){return function(_0x2ef3f8){if(_0x2ef3f8){return _0x2ef3f8[_0x389e('0x23')](_0x15b1e2)[_0x389e('0x24')](function(_0x26f96c){return _0x26f96c;});}return null;};}function removeEntity(_0x297995,_0x1f473e){return function(_0x3ff2d3){if(_0x3ff2d3){return _0x3ff2d3[_0x389e('0x25')]()[_0x389e('0x24')](function(){_0x297995[_0x389e('0x18')](0xcc)[_0x389e('0x19')]();});}};}function handleEntityNotFound(_0x2aeb00,_0x25c487){return function(_0x31d118){if(!_0x31d118){_0x2aeb00[_0x389e('0x26')](0x194);}return _0x31d118;};}function handleError(_0x3e19e8,_0x5af300){_0x5af300=_0x5af300||0x1f4;return function(_0x2170d4){logger[_0x389e('0x27')](_0x2170d4[_0x389e('0x28')]);if(_0x2170d4['name']){delete _0x2170d4['name'];}_0x3e19e8[_0x389e('0x18')](_0x5af300)['send'](_0x2170d4);};}exports['index']=function(_0x542dbb,_0x2b3093){var _0x4f6bfa={},_0xb50156={},_0x22a8c2={'count':0x0,'rows':[]};var _0x1351c0=_[_0x389e('0x29')](db[_0x389e('0x2a')][_0x389e('0x2b')],function(_0x3695d3){return{'name':_0x3695d3['fieldName'],'type':_0x3695d3[_0x389e('0x2c')]['key']};});_0xb50156['model']=_[_0x389e('0x29')](_0x1351c0,_0x389e('0x2d'));_0xb50156[_0x389e('0x2e')]=_[_0x389e('0x2f')](_0x542dbb['query']);_0xb50156['filters']=_[_0x389e('0x30')](_0xb50156[_0x389e('0x31')],_0xb50156['query']);_0x4f6bfa[_0x389e('0x32')]=_[_0x389e('0x30')](_0xb50156[_0x389e('0x31')],qs['fields'](_0x542dbb[_0x389e('0x2e')]['fields']));_0x4f6bfa[_0x389e('0x32')]=_0x4f6bfa[_0x389e('0x32')]['length']?_0x4f6bfa[_0x389e('0x32')]:_0xb50156[_0x389e('0x31')];if(!_0x542dbb['query']['hasOwnProperty']('nolimit')){_0x4f6bfa[_0x389e('0x1d')]=qs[_0x389e('0x1d')](_0x542dbb[_0x389e('0x2e')]['limit']);_0x4f6bfa[_0x389e('0x1b')]=qs[_0x389e('0x1b')](_0x542dbb[_0x389e('0x2e')][_0x389e('0x1b')]);}_0x4f6bfa['order']=qs[_0x389e('0x33')](_0x542dbb['query']['sort']);_0x4f6bfa[_0x389e('0x34')]=qs[_0x389e('0x35')](_[_0x389e('0x36')](_0x542dbb[_0x389e('0x2e')],_0xb50156[_0x389e('0x35')]),_0x1351c0);if(_0x542dbb['query'][_0x389e('0x37')]){_0x4f6bfa[_0x389e('0x34')]=_[_0x389e('0x38')](_0x4f6bfa['where'],{'$or':_[_0x389e('0x29')](_0x1351c0,function(_0x138b03){if(_0x138b03['type']!==_0x389e('0x39')){var _0x2f2b2b={};_0x2f2b2b[_0x138b03['name']]={'$like':'%'+_0x542dbb[_0x389e('0x2e')][_0x389e('0x37')]+'%'};return _0x2f2b2b;}})});}_0x4f6bfa=_[_0x389e('0x38')]({},_0x4f6bfa,_0x542dbb[_0x389e('0x3a')]);var _0x4c0ebc={'where':_0x4f6bfa['where']};return db[_0x389e('0x2a')][_0x389e('0x1e')](_0x4c0ebc)[_0x389e('0x24')](function(_0x48bbcb){_0x22a8c2['count']=_0x48bbcb;if(_0x542dbb[_0x389e('0x2e')]['includeAll']){_0x4f6bfa[_0x389e('0x3b')]=[{'all':!![]}];}return db[_0x389e('0x2a')]['findAll'](_0x4f6bfa);})[_0x389e('0x24')](function(_0x203e48){_0x22a8c2[_0x389e('0x3c')]=_0x203e48;return _0x22a8c2;})[_0x389e('0x24')](respondWithFilteredResult(_0x2b3093,_0x4f6bfa))[_0x389e('0x3d')](handleError(_0x2b3093,null));};exports[_0x389e('0x3e')]=function(_0x3f0903,_0x45786b){var _0x10626f={'raw':![],'where':{'id':_0x3f0903[_0x389e('0x3f')]['id']}},_0x20afdc={};_0x20afdc[_0x389e('0x31')]=_[_0x389e('0x2f')](db[_0x389e('0x2a')][_0x389e('0x2b')]);_0x20afdc[_0x389e('0x2e')]=_[_0x389e('0x2f')](_0x3f0903[_0x389e('0x2e')]);_0x20afdc['filters']=_[_0x389e('0x30')](_0x20afdc['model'],_0x20afdc[_0x389e('0x2e')]);_0x10626f[_0x389e('0x32')]=_[_0x389e('0x30')](_0x20afdc['model'],qs[_0x389e('0x40')](_0x3f0903[_0x389e('0x2e')][_0x389e('0x40')]));_0x10626f[_0x389e('0x32')]=_0x10626f[_0x389e('0x32')][_0x389e('0x41')]?_0x10626f[_0x389e('0x32')]:_0x20afdc[_0x389e('0x31')];if(_0x3f0903[_0x389e('0x2e')][_0x389e('0x42')]){_0x10626f[_0x389e('0x3b')]=[{'all':!![]}];}_0x10626f=_['merge']({},_0x10626f,_0x3f0903['options']);return db[_0x389e('0x2a')][_0x389e('0x43')](_0x10626f)[_0x389e('0x24')](handleEntityNotFound(_0x45786b,null))[_0x389e('0x24')](respondWithResult(_0x45786b,null))[_0x389e('0x3d')](handleError(_0x45786b,null));};exports['create']=function(_0x29af92,_0x4a20c1){return db['VtigerAccount'][_0x389e('0x44')](_0x29af92['body'],{})[_0x389e('0x24')](respondWithResult(_0x4a20c1,0xc9))[_0x389e('0x3d')](handleError(_0x4a20c1,null));};exports[_0x389e('0x23')]=function(_0x53bd40,_0x6160f3){if(_0x53bd40[_0x389e('0x45')]['id']){delete _0x53bd40['body']['id'];}return db[_0x389e('0x2a')][_0x389e('0x43')]({'where':{'id':_0x53bd40[_0x389e('0x3f')]['id']}})[_0x389e('0x24')](handleEntityNotFound(_0x6160f3,null))['then'](saveUpdates(_0x53bd40[_0x389e('0x45')],null))[_0x389e('0x24')](respondWithResult(_0x6160f3,null))[_0x389e('0x3d')](handleError(_0x6160f3,null));};exports[_0x389e('0x25')]=function(_0x27447c,_0x316155){return db['VtigerAccount'][_0x389e('0x43')]({'where':{'id':_0x27447c[_0x389e('0x3f')]['id']}})['then'](handleEntityNotFound(_0x316155,null))[_0x389e('0x24')](removeEntity(_0x316155,null))[_0x389e('0x3d')](handleError(_0x316155,null));};exports[_0x389e('0x46')]=function(_0x447df5,_0x4b4f6a,_0x2bd342){var _0x53b829={};var _0x5f0f72={};var _0x5cf90f;var _0x3bd3b7;return db['VtigerAccount'][_0x389e('0x47')]({'where':{'id':_0x447df5[_0x389e('0x3f')]['id']}})[_0x389e('0x24')](handleEntityNotFound(_0x4b4f6a,null))['then'](function(_0x26c968){if(_0x26c968){_0x5cf90f=_0x26c968;_0x5f0f72[_0x389e('0x31')]=_[_0x389e('0x2f')](db[_0x389e('0x48')][_0x389e('0x2b')]);_0x5f0f72[_0x389e('0x2e')]=_[_0x389e('0x2f')](_0x447df5[_0x389e('0x2e')]);_0x5f0f72[_0x389e('0x35')]=_[_0x389e('0x30')](_0x5f0f72[_0x389e('0x31')],_0x5f0f72[_0x389e('0x2e')]);_0x53b829['attributes']=_[_0x389e('0x30')](_0x5f0f72[_0x389e('0x31')],qs['fields'](_0x447df5[_0x389e('0x2e')]['fields']));_0x53b829['attributes']=_0x53b829['attributes']['length']?_0x53b829[_0x389e('0x32')]:_0x5f0f72[_0x389e('0x31')];_0x53b829['order']=qs[_0x389e('0x33')](_0x447df5[_0x389e('0x2e')][_0x389e('0x33')]);_0x53b829['where']=qs[_0x389e('0x35')](_['pick'](_0x447df5['query'],_0x5f0f72['filters']));if(_0x447df5[_0x389e('0x2e')][_0x389e('0x37')]){_0x53b829[_0x389e('0x34')]=_[_0x389e('0x38')](_0x53b829[_0x389e('0x34')],{'$or':_[_0x389e('0x29')](_0x53b829[_0x389e('0x32')],function(_0x4cfbae){var _0x24dc75={};_0x24dc75[_0x4cfbae]={'$like':'%'+_0x447df5[_0x389e('0x2e')][_0x389e('0x37')]+'%'};return _0x24dc75;})});}_0x53b829=_[_0x389e('0x38')]({},_0x53b829,_0x447df5[_0x389e('0x3a')]);return _0x5cf90f[_0x389e('0x46')](_0x53b829);}})['then'](function(_0x10f19f){if(_0x10f19f){_0x3bd3b7=_0x10f19f[_0x389e('0x41')];if(!_0x447df5[_0x389e('0x2e')][_0x389e('0x49')](_0x389e('0x4a'))){_0x53b829[_0x389e('0x1d')]=qs[_0x389e('0x1d')](_0x447df5['query']['limit']);_0x53b829[_0x389e('0x1b')]=qs[_0x389e('0x1b')](_0x447df5[_0x389e('0x2e')][_0x389e('0x1b')]);}return _0x5cf90f[_0x389e('0x46')](_0x53b829);}})[_0x389e('0x24')](function(_0x49af8f){if(_0x49af8f){return _0x49af8f?{'count':_0x3bd3b7,'rows':_0x49af8f}:null;}})[_0x389e('0x24')](respondWithResult(_0x4b4f6a,null))['catch'](handleError(_0x4b4f6a,null));};exports[_0x389e('0x4b')]=function(_0x529c58,_0x1f91ac,_0x3af976){if(_0x529c58[_0x389e('0x45')]['id']){delete _0x529c58['body']['id'];}return db[_0x389e('0x2a')]['findOne']({'where':{'id':_0x529c58[_0x389e('0x3f')]['id']}})[_0x389e('0x24')](handleEntityNotFound(_0x1f91ac,null))['then'](function(_0x58bbd0){if(_0x58bbd0){_0x529c58[_0x389e('0x45')][_0x389e('0x4c')]=_0x58bbd0['id'];_0x529c58['body'][_0x389e('0x4d')]=integrations['getSubjects'](_0x529c58['body'][_0x389e('0x4e')],_0x529c58[_0x389e('0x45')][_0x389e('0x2c')]);_0x529c58['body'][_0x389e('0x4f')]=integrations[_0x389e('0x50')](_0x529c58['body'][_0x389e('0x4e')],_0x529c58[_0x389e('0x45')][_0x389e('0x2c')]);return db[_0x389e('0x48')]['create'](_0x529c58[_0x389e('0x45')],{'include':[{'model':db[_0x389e('0x51')],'as':_0x389e('0x4d')},{'model':db[_0x389e('0x51')],'as':'Descriptions'}]});}return null;})[_0x389e('0x24')](respondWithResult(_0x1f91ac,null))[_0x389e('0x3d')](handleError(_0x1f91ac,null));};var md5=require(_0x389e('0x52'));exports[_0x389e('0x53')]=function(_0x1d0f20,_0x43cb7b,_0x174439){var _0x18e791=null;var _0x563d49=null;var _0x11fba6=null;var _0x3495fd=null;var _0x211691='';return db[_0x389e('0x2a')][_0x389e('0x47')]({'where':{'id':_0x1d0f20['params']['id']},'attributes':['id',_0x389e('0x2d'),_0x389e('0x54'),_0x389e('0x55'),'moduleName',_0x389e('0x56'),_0x389e('0x57'),_0x389e('0x58')]})[_0x389e('0x24')](handleEntityNotFound(_0x43cb7b,null))['then'](function(_0x4246da){if(_0x4246da){_0x18e791=_0x4246da[_0x389e('0x54')];_0x563d49=_0x4246da[_0x389e('0x58')];_0x11fba6=_0x4246da[_0x389e('0x59')];_0x211691=_0x4246da[_0x389e('0x56')];var _0x534d3c=_0x211691[_0x389e('0x5a')](-0x1);if(_0x534d3c==='/'){_0x211691=_0x211691['substring'](0x0,_0x211691[_0x389e('0x5b')](_0x534d3c));}_0x3495fd=util[_0x389e('0x5c')](_0x389e('0x5d'),_0x211691);var _0x19d302={'method':_0x389e('0x5e'),'uri':_0x3495fd,'qs':{'operation':'getchallenge','username':_0x4246da[_0x389e('0x54')]},'json':!![]};return rp(_0x19d302);}})[_0x389e('0x24')](function(_0x4bf199){if(_0x4bf199[_0x389e('0x5f')]){var _0x12cc2f={'method':_0x389e('0x60'),'uri':_0x3495fd,'form':{'operation':_0x389e('0x61'),'username':_0x18e791,'accessKey':md5(_0x4bf199['result']['token']+_0x563d49)},'json':!![]};return rp(_0x12cc2f);}})[_0x389e('0x24')](function(_0x527456){if(_0x527456[_0x389e('0x5f')]){var _0x1dede9={'method':_0x389e('0x5e'),'uri':_0x3495fd,'qs':{'operation':_0x389e('0x62'),'username':_0x18e791,'sessionName':_0x527456[_0x389e('0x63')][_0x389e('0x64')],'elementType':_0x11fba6},'json':!![]};return rp(_0x1dede9);}})[_0x389e('0x24')](function(_0xa7bd84){if(_0xa7bd84['success']){var _0x37b94b=['autogenerated',_0x389e('0x65'),'owner'];_[_0x389e('0x66')](_0xa7bd84[_0x389e('0x63')][_0x389e('0x40')],function(_0x5af213){return _0x37b94b[_0x389e('0x67')](_0x5af213[_0x389e('0x2c')][_0x389e('0x2d')]);});_[_0x389e('0x66')](_0xa7bd84[_0x389e('0x63')][_0x389e('0x40')],function(_0x82a5b0){return _0x82a5b0[_0x389e('0x68')]===_0x389e('0x69');});return{'count':_0xa7bd84[_0x389e('0x63')][_0x389e('0x40')]['length'],'rows':_[_0x389e('0x29')](_0xa7bd84[_0x389e('0x63')][_0x389e('0x40')],function(_0x212deb){return{'id':_0x212deb[_0x389e('0x2d')],'name':_0x212deb[_0x389e('0x6a')],'custom':_[_0x389e('0x6b')](_0x212deb['name'],'cf_')?!![]:![],'options':_0x212deb['type'][_0x389e('0x2d')]===_0x389e('0x6c')&&_0x212deb[_0x389e('0x2c')][_0x389e('0x6d')][_0x389e('0x41')]>0x0?_[_0x389e('0x29')](_0x212deb['type'][_0x389e('0x6d')],function(_0x55f2f8){return{'name':_0x55f2f8[_0x389e('0x6a')],'value':_0x55f2f8[_0x389e('0x6e')]};}):[]};})};}})['then'](respondWithResult(_0x43cb7b,null))[_0x389e('0x3d')](function(_0xedb70a){console[_0x389e('0x6f')](_0x389e('0x70')+_0xedb70a);var _0x23b5ad=_0x1d0f20[_0x389e('0x2e')][_0x389e('0x71')]?0x1f4:_0xedb70a[_0x389e('0x72')]||0x1f4;logger[_0x389e('0x27')](_0x389e('0x73'),_0x389e('0x53'),_0x23b5ad,JSON[_0x389e('0x74')](_0xedb70a));delete _0xedb70a['name'];if(_0x23b5ad===0x191){_0x23b5ad=0x190;}_0x43cb7b[_0x389e('0x18')](_0x23b5ad)['send'](_0x1d0f20[_0x389e('0x2e')][_0x389e('0x71')]?{'message':_0x389e('0x75'),'statusCode':_0xedb70a['statusCode']}:_0xedb70a);});}; \ No newline at end of file +var _0x67f9=['nolimit','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','VtigerField','Descriptions','md5','getFields','moduleName','remoteUri','serverUrl','accessKey','slice','substring','GET','getchallenge','username','success','login','describe','result','sessionName','autogenerated','owner','remove','editable','false','label','cf_','picklist','picklistValues','value','vTiger\x20error:\x20','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','name','send','index','VtigerAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','include','options','find','create','body','catch','params','getConfigurations','findOne','VtigerConfiguration','order','sort','hasOwnProperty'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x67f9,0x117));var _0x967f=function(_0x283bd6,_0xc85a1e){_0x283bd6=_0x283bd6-0x0;var _0x34eab0=_0x67f9[_0x283bd6];return _0x34eab0;};'use strict';var emlformat=require(_0x967f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x967f('0x1'));var jsonpatch=require(_0x967f('0x2'));var rp=require(_0x967f('0x3'));var moment=require('moment');var BPromise=require(_0x967f('0x4'));var Mustache=require(_0x967f('0x5'));var util=require('util');var path=require(_0x967f('0x6'));var sox=require(_0x967f('0x7'));var csv=require(_0x967f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x967f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x967f('0xa'));var jsforce=require(_0x967f('0xb'));var deskjs=require(_0x967f('0xc'));var toCsv=require(_0x967f('0x8'));var querystring=require(_0x967f('0xd'));var Papa=require(_0x967f('0xe'));var Redis=require(_0x967f('0xf'));var authService=require(_0x967f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x967f('0x11'));var hardwareService=require(_0x967f('0x12'));var logger=require(_0x967f('0x13'))(_0x967f('0x14'));var utils=require(_0x967f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x967f('0x16'));var db=require(_0x967f('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x35e5c3,_0x3063c5){_0x3063c5=_0x3063c5||0xcc;return function(_0x5489cc){if(_0x5489cc){return _0x35e5c3[_0x967f('0x18')](_0x3063c5);}return _0x35e5c3[_0x967f('0x19')](_0x3063c5)[_0x967f('0x1a')]();};}function respondWithResult(_0x58dc02,_0x413d8a){_0x413d8a=_0x413d8a||0xc8;return function(_0x2b71ee){if(_0x2b71ee){return _0x58dc02[_0x967f('0x19')](_0x413d8a)[_0x967f('0x1b')](_0x2b71ee);}};}function respondWithFilteredResult(_0x335f46,_0x5bce63){return function(_0x4ac93d){if(_0x4ac93d){var _0x1ac80c=typeof _0x5bce63[_0x967f('0x1c')]===_0x967f('0x1d')&&typeof _0x5bce63[_0x967f('0x1e')]===_0x967f('0x1d');var _0x465120=_0x4ac93d[_0x967f('0x1f')];var _0x244978=_0x1ac80c?0x0:_0x5bce63['offset'];var _0x11e553=_0x1ac80c?_0x4ac93d[_0x967f('0x1f')]:_0x5bce63['offset']+_0x5bce63[_0x967f('0x1e')];var _0x497a6b;if(_0x11e553>=_0x465120){_0x11e553=_0x465120;_0x497a6b=0xc8;}else{_0x497a6b=0xce;}_0x335f46[_0x967f('0x19')](_0x497a6b);return _0x335f46[_0x967f('0x20')](_0x967f('0x21'),_0x244978+'-'+_0x11e553+'/'+_0x465120)[_0x967f('0x1b')](_0x4ac93d);}return null;};}function patchUpdates(_0x839015){return function(_0x340601){try{jsonpatch['apply'](_0x340601,_0x839015,!![]);}catch(_0x1e3e5d){return BPromise[_0x967f('0x22')](_0x1e3e5d);}return _0x340601[_0x967f('0x23')]();};}function saveUpdates(_0x660307,_0x1c2e9c){return function(_0x3e1af5){if(_0x3e1af5){return _0x3e1af5[_0x967f('0x24')](_0x660307)[_0x967f('0x25')](function(_0x3b3eeb){return _0x3b3eeb;});}return null;};}function removeEntity(_0x424bb8,_0x117ffa){return function(_0x261b94){if(_0x261b94){return _0x261b94[_0x967f('0x26')]()[_0x967f('0x25')](function(){_0x424bb8['status'](0xcc)[_0x967f('0x1a')]();});}};}function handleEntityNotFound(_0x3d6aab,_0x2cf8d6){return function(_0x42ef87){if(!_0x42ef87){_0x3d6aab[_0x967f('0x18')](0x194);}return _0x42ef87;};}function handleError(_0x2864ca,_0x574a8c){_0x574a8c=_0x574a8c||0x1f4;return function(_0x1c0dbc){logger['error'](_0x1c0dbc['stack']);if(_0x1c0dbc[_0x967f('0x27')]){delete _0x1c0dbc[_0x967f('0x27')];}_0x2864ca[_0x967f('0x19')](_0x574a8c)[_0x967f('0x28')](_0x1c0dbc);};}exports[_0x967f('0x29')]=function(_0x15290e,_0x259767){var _0x4affe4={},_0x10ad0c={},_0x27edd6={'count':0x0,'rows':[]};var _0x340fa2=_['map'](db[_0x967f('0x2a')][_0x967f('0x2b')],function(_0xaf3970){return{'name':_0xaf3970[_0x967f('0x2c')],'type':_0xaf3970[_0x967f('0x2d')][_0x967f('0x2e')]};});_0x10ad0c['model']=_[_0x967f('0x2f')](_0x340fa2,_0x967f('0x27'));_0x10ad0c[_0x967f('0x30')]=_[_0x967f('0x31')](_0x15290e['query']);_0x10ad0c[_0x967f('0x32')]=_[_0x967f('0x33')](_0x10ad0c[_0x967f('0x34')],_0x10ad0c[_0x967f('0x30')]);_0x4affe4[_0x967f('0x35')]=_[_0x967f('0x33')](_0x10ad0c['model'],qs[_0x967f('0x36')](_0x15290e[_0x967f('0x30')]['fields']));_0x4affe4['attributes']=_0x4affe4['attributes'][_0x967f('0x37')]?_0x4affe4[_0x967f('0x35')]:_0x10ad0c[_0x967f('0x34')];if(!_0x15290e[_0x967f('0x30')]['hasOwnProperty']('nolimit')){_0x4affe4[_0x967f('0x1e')]=qs[_0x967f('0x1e')](_0x15290e['query']['limit']);_0x4affe4[_0x967f('0x1c')]=qs['offset'](_0x15290e['query']['offset']);}_0x4affe4['order']=qs['sort'](_0x15290e[_0x967f('0x30')]['sort']);_0x4affe4[_0x967f('0x38')]=qs['filters'](_[_0x967f('0x39')](_0x15290e[_0x967f('0x30')],_0x10ad0c[_0x967f('0x32')]),_0x340fa2);if(_0x15290e[_0x967f('0x30')][_0x967f('0x3a')]){_0x4affe4[_0x967f('0x38')]=_[_0x967f('0x3b')](_0x4affe4[_0x967f('0x38')],{'$or':_['map'](_0x340fa2,function(_0x2bc6fc){if(_0x2bc6fc[_0x967f('0x2d')]!==_0x967f('0x3c')){var _0x35a5fc={};_0x35a5fc[_0x2bc6fc[_0x967f('0x27')]]={'$like':'%'+_0x15290e[_0x967f('0x30')]['filter']+'%'};return _0x35a5fc;}})});}_0x4affe4=_[_0x967f('0x3b')]({},_0x4affe4,_0x15290e['options']);var _0x13b4a2={'where':_0x4affe4[_0x967f('0x38')]};return db[_0x967f('0x2a')][_0x967f('0x1f')](_0x13b4a2)['then'](function(_0x234601){_0x27edd6['count']=_0x234601;if(_0x15290e['query'][_0x967f('0x3d')]){_0x4affe4['include']=[{'all':!![]}];}return db['VtigerAccount'][_0x967f('0x3e')](_0x4affe4);})[_0x967f('0x25')](function(_0x901456){_0x27edd6[_0x967f('0x3f')]=_0x901456;return _0x27edd6;})[_0x967f('0x25')](respondWithFilteredResult(_0x259767,_0x4affe4))['catch'](handleError(_0x259767,null));};exports[_0x967f('0x40')]=function(_0x56c402,_0x3b5431){var _0xd50ee9={'raw':![],'where':{'id':_0x56c402['params']['id']}},_0x4eb316={};_0x4eb316['model']=_[_0x967f('0x31')](db[_0x967f('0x2a')][_0x967f('0x2b')]);_0x4eb316['query']=_[_0x967f('0x31')](_0x56c402[_0x967f('0x30')]);_0x4eb316[_0x967f('0x32')]=_[_0x967f('0x33')](_0x4eb316[_0x967f('0x34')],_0x4eb316[_0x967f('0x30')]);_0xd50ee9['attributes']=_[_0x967f('0x33')](_0x4eb316[_0x967f('0x34')],qs['fields'](_0x56c402['query'][_0x967f('0x36')]));_0xd50ee9[_0x967f('0x35')]=_0xd50ee9[_0x967f('0x35')]['length']?_0xd50ee9[_0x967f('0x35')]:_0x4eb316['model'];if(_0x56c402['query'][_0x967f('0x3d')]){_0xd50ee9[_0x967f('0x41')]=[{'all':!![]}];}_0xd50ee9=_[_0x967f('0x3b')]({},_0xd50ee9,_0x56c402[_0x967f('0x42')]);return db[_0x967f('0x2a')][_0x967f('0x43')](_0xd50ee9)[_0x967f('0x25')](handleEntityNotFound(_0x3b5431,null))[_0x967f('0x25')](respondWithResult(_0x3b5431,null))['catch'](handleError(_0x3b5431,null));};exports[_0x967f('0x44')]=function(_0x19e135,_0x1c7351){return db[_0x967f('0x2a')][_0x967f('0x44')](_0x19e135[_0x967f('0x45')],{})[_0x967f('0x25')](respondWithResult(_0x1c7351,0xc9))[_0x967f('0x46')](handleError(_0x1c7351,null));};exports['update']=function(_0x403850,_0x416af7){if(_0x403850['body']['id']){delete _0x403850[_0x967f('0x45')]['id'];}return db[_0x967f('0x2a')]['find']({'where':{'id':_0x403850[_0x967f('0x47')]['id']}})['then'](handleEntityNotFound(_0x416af7,null))['then'](saveUpdates(_0x403850[_0x967f('0x45')],null))[_0x967f('0x25')](respondWithResult(_0x416af7,null))[_0x967f('0x46')](handleError(_0x416af7,null));};exports[_0x967f('0x26')]=function(_0xb875f,_0x22a938){return db[_0x967f('0x2a')]['find']({'where':{'id':_0xb875f[_0x967f('0x47')]['id']}})[_0x967f('0x25')](handleEntityNotFound(_0x22a938,null))[_0x967f('0x25')](removeEntity(_0x22a938,null))['catch'](handleError(_0x22a938,null));};exports[_0x967f('0x48')]=function(_0x5c3dff,_0x551bd9,_0x19c168){var _0x4cf624={};var _0x388934={};var _0xdbc5c;var _0x1f4325;return db['VtigerAccount'][_0x967f('0x49')]({'where':{'id':_0x5c3dff[_0x967f('0x47')]['id']}})['then'](handleEntityNotFound(_0x551bd9,null))[_0x967f('0x25')](function(_0x4bc022){if(_0x4bc022){_0xdbc5c=_0x4bc022;_0x388934[_0x967f('0x34')]=_['keys'](db[_0x967f('0x4a')]['rawAttributes']);_0x388934[_0x967f('0x30')]=_['keys'](_0x5c3dff['query']);_0x388934['filters']=_[_0x967f('0x33')](_0x388934[_0x967f('0x34')],_0x388934[_0x967f('0x30')]);_0x4cf624[_0x967f('0x35')]=_[_0x967f('0x33')](_0x388934[_0x967f('0x34')],qs[_0x967f('0x36')](_0x5c3dff[_0x967f('0x30')][_0x967f('0x36')]));_0x4cf624[_0x967f('0x35')]=_0x4cf624[_0x967f('0x35')]['length']?_0x4cf624[_0x967f('0x35')]:_0x388934[_0x967f('0x34')];_0x4cf624[_0x967f('0x4b')]=qs[_0x967f('0x4c')](_0x5c3dff[_0x967f('0x30')]['sort']);_0x4cf624[_0x967f('0x38')]=qs[_0x967f('0x32')](_[_0x967f('0x39')](_0x5c3dff[_0x967f('0x30')],_0x388934[_0x967f('0x32')]));if(_0x5c3dff['query'][_0x967f('0x3a')]){_0x4cf624['where']=_[_0x967f('0x3b')](_0x4cf624[_0x967f('0x38')],{'$or':_[_0x967f('0x2f')](_0x4cf624[_0x967f('0x35')],function(_0x3ccf93){var _0x3680b2={};_0x3680b2[_0x3ccf93]={'$like':'%'+_0x5c3dff[_0x967f('0x30')]['filter']+'%'};return _0x3680b2;})});}_0x4cf624=_[_0x967f('0x3b')]({},_0x4cf624,_0x5c3dff['options']);return _0xdbc5c[_0x967f('0x48')](_0x4cf624);}})[_0x967f('0x25')](function(_0xd7899f){if(_0xd7899f){_0x1f4325=_0xd7899f[_0x967f('0x37')];if(!_0x5c3dff[_0x967f('0x30')][_0x967f('0x4d')](_0x967f('0x4e'))){_0x4cf624['limit']=qs['limit'](_0x5c3dff[_0x967f('0x30')]['limit']);_0x4cf624[_0x967f('0x1c')]=qs[_0x967f('0x1c')](_0x5c3dff[_0x967f('0x30')][_0x967f('0x1c')]);}return _0xdbc5c[_0x967f('0x48')](_0x4cf624);}})['then'](function(_0x5acc1a){if(_0x5acc1a){return _0x5acc1a?{'count':_0x1f4325,'rows':_0x5acc1a}:null;}})[_0x967f('0x25')](respondWithResult(_0x551bd9,null))['catch'](handleError(_0x551bd9,null));};exports[_0x967f('0x4f')]=function(_0x5e870d,_0x3d1765,_0xdc1a57){if(_0x5e870d['body']['id']){delete _0x5e870d[_0x967f('0x45')]['id'];}return db[_0x967f('0x2a')][_0x967f('0x49')]({'where':{'id':_0x5e870d['params']['id']}})[_0x967f('0x25')](handleEntityNotFound(_0x3d1765,null))['then'](function(_0x552892){if(_0x552892){_0x5e870d[_0x967f('0x45')][_0x967f('0x50')]=_0x552892['id'];_0x5e870d['body'][_0x967f('0x51')]=integrations[_0x967f('0x52')](_0x5e870d[_0x967f('0x45')]['channel'],_0x5e870d[_0x967f('0x45')][_0x967f('0x2d')]);_0x5e870d[_0x967f('0x45')]['Descriptions']=integrations[_0x967f('0x53')](_0x5e870d['body'][_0x967f('0x54')],_0x5e870d[_0x967f('0x45')][_0x967f('0x2d')]);return db[_0x967f('0x4a')][_0x967f('0x44')](_0x5e870d[_0x967f('0x45')],{'include':[{'model':db[_0x967f('0x55')],'as':_0x967f('0x51')},{'model':db[_0x967f('0x55')],'as':_0x967f('0x56')}]});}return null;})[_0x967f('0x25')](respondWithResult(_0x3d1765,null))['catch'](handleError(_0x3d1765,null));};var md5=require(_0x967f('0x57'));exports[_0x967f('0x58')]=function(_0x442413,_0x212519,_0x43f979){var _0x14b643=null;var _0x192738=null;var _0x3b7518=null;var _0x99e67d=null;var _0xc6012e='';return db[_0x967f('0x2a')][_0x967f('0x49')]({'where':{'id':_0x442413['params']['id']},'attributes':['id',_0x967f('0x27'),'username','description',_0x967f('0x59'),_0x967f('0x5a'),_0x967f('0x5b'),_0x967f('0x5c')]})['then'](handleEntityNotFound(_0x212519,null))[_0x967f('0x25')](function(_0x3b7df0){if(_0x3b7df0){_0x14b643=_0x3b7df0['username'];_0x192738=_0x3b7df0[_0x967f('0x5c')];_0x3b7518=_0x3b7df0[_0x967f('0x59')];_0xc6012e=_0x3b7df0[_0x967f('0x5a')];var _0x5daf30=_0xc6012e[_0x967f('0x5d')](-0x1);if(_0x5daf30==='/'){_0xc6012e=_0xc6012e[_0x967f('0x5e')](0x0,_0xc6012e['lastIndexOf'](_0x5daf30));}_0x99e67d=util['format']('%s/webservice.php',_0xc6012e);var _0xa4782c={'method':_0x967f('0x5f'),'uri':_0x99e67d,'qs':{'operation':_0x967f('0x60'),'username':_0x3b7df0[_0x967f('0x61')]},'json':!![]};return rp(_0xa4782c);}})[_0x967f('0x25')](function(_0x283349){if(_0x283349[_0x967f('0x62')]){var _0x527c33={'method':'POST','uri':_0x99e67d,'form':{'operation':_0x967f('0x63'),'username':_0x14b643,'accessKey':md5(_0x283349['result']['token']+_0x192738)},'json':!![]};return rp(_0x527c33);}})[_0x967f('0x25')](function(_0x216f51){if(_0x216f51['success']){var _0x44db84={'method':_0x967f('0x5f'),'uri':_0x99e67d,'qs':{'operation':_0x967f('0x64'),'username':_0x14b643,'sessionName':_0x216f51[_0x967f('0x65')][_0x967f('0x66')],'elementType':_0x3b7518},'json':!![]};return rp(_0x44db84);}})['then'](function(_0xa1734e){if(_0xa1734e[_0x967f('0x62')]){var _0x29c6a5=[_0x967f('0x67'),'reference',_0x967f('0x68')];_[_0x967f('0x69')](_0xa1734e[_0x967f('0x65')]['fields'],function(_0x847f05){return _0x29c6a5['includes'](_0x847f05[_0x967f('0x2d')][_0x967f('0x27')]);});_['remove'](_0xa1734e[_0x967f('0x65')][_0x967f('0x36')],function(_0x3e6cb7){return _0x3e6cb7[_0x967f('0x6a')]===_0x967f('0x6b');});return{'count':_0xa1734e[_0x967f('0x65')]['fields']['length'],'rows':_[_0x967f('0x2f')](_0xa1734e[_0x967f('0x65')][_0x967f('0x36')],function(_0x469ae8){return{'id':_0x469ae8[_0x967f('0x27')],'name':_0x469ae8[_0x967f('0x6c')],'custom':_['startsWith'](_0x469ae8[_0x967f('0x27')],_0x967f('0x6d'))?!![]:![],'options':_0x469ae8[_0x967f('0x2d')][_0x967f('0x27')]===_0x967f('0x6e')&&_0x469ae8[_0x967f('0x2d')][_0x967f('0x6f')][_0x967f('0x37')]>0x0?_[_0x967f('0x2f')](_0x469ae8[_0x967f('0x2d')]['picklistValues'],function(_0x32babf){return{'name':_0x32babf[_0x967f('0x6c')],'value':_0x32babf[_0x967f('0x70')]};}):[]};})};}})['then'](respondWithResult(_0x212519,null))[_0x967f('0x46')](function(_0x9c026d){console['log'](_0x967f('0x71')+_0x9c026d);var _0x965dd9=_0x442413['query'][_0x967f('0x72')]?0x1f4:_0x9c026d[_0x967f('0x73')]||0x1f4;logger[_0x967f('0x74')](_0x967f('0x75'),_0x967f('0x58'),_0x965dd9,JSON['stringify'](_0x9c026d));delete _0x9c026d[_0x967f('0x27')];if(_0x965dd9===0x191){_0x965dd9=0x190;}_0x212519['status'](_0x965dd9)['send'](_0x442413[_0x967f('0x30')][_0x967f('0x72')]?{'message':_0x967f('0x76'),'statusCode':_0x9c026d[_0x967f('0x73')]}:_0x9c026d);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 2633d0f..595744c 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 _0xd0e8=['moment','bluebird','request-promise','path','../../config/environment','./intVtigerAccount.attributes','exports','VtigerAccount','int_vtiger_accounts','lodash','util','api'];(function(_0x132641,_0x153b24){var _0xc68b80=function(_0x14dd35){while(--_0x14dd35){_0x132641['push'](_0x132641['shift']());}};_0xc68b80(++_0x153b24);}(_0xd0e8,0x1e9));var _0x8d0e=function(_0x261f98,_0x264c68){_0x261f98=_0x261f98-0x0;var _0x5b62cb=_0xd0e8[_0x261f98];return _0x5b62cb;};'use strict';var _=require(_0x8d0e('0x0'));var util=require(_0x8d0e('0x1'));var logger=require('../../config/logger')(_0x8d0e('0x2'));var moment=require(_0x8d0e('0x3'));var BPromise=require(_0x8d0e('0x4'));var rp=require(_0x8d0e('0x5'));var fs=require('fs');var path=require(_0x8d0e('0x6'));var rimraf=require('rimraf');var config=require(_0x8d0e('0x7'));var attributes=require(_0x8d0e('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x8d0e('0x9')]=function(_0x4f2274,_0x128e57){return _0x4f2274['define'](_0x8d0e('0xa'),attributes,{'tableName':_0x8d0e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x60ba=['../../config/environment','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x60ba,0x17f));var _0xa60b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x60ba[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xa60b('0x0'));var util=require(_0xa60b('0x1'));var logger=require(_0xa60b('0x2'))('api');var moment=require(_0xa60b('0x3'));var BPromise=require(_0xa60b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa60b('0x5'));var rimraf=require(_0xa60b('0x6'));var config=require(_0xa60b('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xa60b('0x8'));module[_0xa60b('0x9')]=function(_0x504244,_0x460e65){return _0x504244[_0xa60b('0xa')](_0xa60b('0xb'),attributes,{'tableName':_0xa60b('0xc'),'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 93371bd..97e7a02 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 _0xa5fa=['jayson/promise','client','http','request','info','debug','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','include','map','model','then','ShowVtigerAccount','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x174686,_0x2c3555){var _0xf059d6=function(_0x25dae7){while(--_0x25dae7){_0x174686['push'](_0x174686['shift']());}};_0xf059d6(++_0x2c3555);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x2fc113,_0x45ec6e){_0x2fc113=_0x2fc113-0x0;var _0x5144ce=_0xa5fa[_0x2fc113];return _0x5144ce;};'use strict';var _=require('lodash');var util=require(_0xaa5f('0x0'));var moment=require(_0xaa5f('0x1'));var BPromise=require(_0xaa5f('0x2'));var rs=require(_0xaa5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa5f('0x4'))['db'];var utils=require(_0xaa5f('0x5'));var logger=require('../../config/logger')(_0xaa5f('0x6'));var config=require(_0xaa5f('0x7'));var jayson=require(_0xaa5f('0x8'));var client=jayson[_0xaa5f('0x9')][_0xaa5f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13b606,_0x302138,_0xc326df){return new BPromise(function(_0x74f64f,_0x3f550e){return client[_0xaa5f('0xb')](_0x13b606,_0xc326df)['then'](function(_0x1674c2){logger[_0xaa5f('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x302138,'request\x20sent');logger[_0xaa5f('0xd')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x302138,'request\x20sent',JSON[_0xaa5f('0xe')](_0x1674c2));if(_0x1674c2['error']){if(_0x1674c2[_0xaa5f('0xf')][_0xaa5f('0x10')]===0x1f4){logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1674c2[_0xaa5f('0xf')]['message']);return _0x3f550e(_0x1674c2[_0xaa5f('0xf')]['message']);}logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1674c2[_0xaa5f('0xf')][_0xaa5f('0x12')]);return _0x74f64f(_0x1674c2[_0xaa5f('0xf')]['message']);}else{logger['info'](_0xaa5f('0x11'),_0x302138,_0xaa5f('0x13'));_0x74f64f(_0x1674c2[_0xaa5f('0x14')][_0xaa5f('0x12')]);}})[_0xaa5f('0x15')](function(_0x1fa36a){logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1fa36a);_0x3f550e(_0x1fa36a);});});}exports[_0xaa5f('0x16')]=function(_0x3d874f){var _0x22175f=this;return new Promise(function(_0x1019e8,_0x4f4cd5){return db[_0xaa5f('0x17')][_0xaa5f('0x18')]({'raw':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f[_0xaa5f('0x19')][_0xaa5f('0x1a')]===undefined?!![]:![]:!![],'where':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f[_0xaa5f('0x19')][_0xaa5f('0x1b')]||null:null,'attributes':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f[_0xaa5f('0x19')][_0xaa5f('0x1c')]||null:null,'limit':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f[_0xaa5f('0x19')]['limit']||null:null,'include':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f['options'][_0xaa5f('0x1d')]?_[_0xaa5f('0x1e')](_0x3d874f['options'][_0xaa5f('0x1d')],function(_0x1032ce){return{'model':db[_0x1032ce['model']],'as':_0x1032ce['as'],'attributes':_0x1032ce[_0xaa5f('0x1c')],'include':_0x1032ce[_0xaa5f('0x1d')]?_[_0xaa5f('0x1e')](_0x1032ce[_0xaa5f('0x1d')],function(_0x1f66c0){return{'model':db[_0x1f66c0[_0xaa5f('0x1f')]],'as':_0x1f66c0['as'],'attributes':_0x1f66c0[_0xaa5f('0x1c')],'include':_0x1f66c0[_0xaa5f('0x1d')]?_['map'](_0x1f66c0[_0xaa5f('0x1d')],function(_0x3a66e8){return{'model':db[_0x3a66e8[_0xaa5f('0x1f')]],'as':_0x3a66e8['as'],'attributes':_0x3a66e8['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa5f('0x20')](function(_0x269209){logger[_0xaa5f('0xc')]('GetVtigerAccount',_0x3d874f);logger[_0xaa5f('0xd')]('GetVtigerAccount',_0x3d874f,JSON['stringify'](_0x269209));_0x1019e8(_0x269209);})[_0xaa5f('0x15')](function(_0x50998f){logger[_0xaa5f('0xf')]('GetVtigerAccount',_0x50998f['message'],_0x3d874f);_0x4f4cd5(_0x22175f['error'](0x1f4,_0x50998f[_0xaa5f('0x12')]));});});};exports['ShowVtigerAccount']=function(_0x310828){var _0xc0bb03=this;return new Promise(function(_0x555876,_0x58f608){return db[_0xaa5f('0x17')]['find']({'raw':_0x310828[_0xaa5f('0x19')]?_0x310828[_0xaa5f('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x310828[_0xaa5f('0x19')]?_0x310828[_0xaa5f('0x19')][_0xaa5f('0x1b')]||null:null,'attributes':_0x310828['options']?_0x310828[_0xaa5f('0x19')][_0xaa5f('0x1c')]||null:null,'include':_0x310828['options']?_0x310828['options']['include']?_['map'](_0x310828[_0xaa5f('0x19')][_0xaa5f('0x1d')],function(_0x2a6015){return{'model':db[_0x2a6015[_0xaa5f('0x1f')]],'as':_0x2a6015['as'],'attributes':_0x2a6015[_0xaa5f('0x1c')],'include':_0x2a6015[_0xaa5f('0x1d')]?_[_0xaa5f('0x1e')](_0x2a6015['include'],function(_0x1ab07f){return{'model':db[_0x1ab07f[_0xaa5f('0x1f')]],'as':_0x1ab07f['as'],'attributes':_0x1ab07f[_0xaa5f('0x1c')],'include':_0x1ab07f[_0xaa5f('0x1d')]?_[_0xaa5f('0x1e')](_0x1ab07f[_0xaa5f('0x1d')],function(_0x49442c){return{'model':db[_0x49442c[_0xaa5f('0x1f')]],'as':_0x49442c['as'],'attributes':_0x49442c[_0xaa5f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xaa5f('0x20')](function(_0x2ac0f8){logger[_0xaa5f('0xc')]('ShowVtigerAccount',_0x310828);logger['debug'](_0xaa5f('0x21'),_0x310828,JSON[_0xaa5f('0xe')](_0x2ac0f8));_0x555876(_0x2ac0f8);})[_0xaa5f('0x15')](function(_0x964105){logger['error'](_0xaa5f('0x21'),_0x964105[_0xaa5f('0x12')],_0x310828);_0x58f608(_0xc0bb03[_0xaa5f('0xf')](0x1f4,_0x964105[_0xaa5f('0x12')]));});});}; \ No newline at end of file +var _0xa74f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetVtigerAccount','VtigerAccount','options','raw','where','limit','attributes','include','map','model','ShowVtigerAccount','find','moment'];(function(_0x178c9d,_0x1bf7cf){var _0x363cd7=function(_0x23d80e){while(--_0x23d80e){_0x178c9d['push'](_0x178c9d['shift']());}};_0x363cd7(++_0x1bf7cf);}(_0xa74f,0x9a));var _0xfa74=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0xa74f[_0x622035];return _0x326cf2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfa74('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa74('0x1'));var db=require(_0xfa74('0x2'))['db'];var utils=require(_0xfa74('0x3'));var logger=require(_0xfa74('0x4'))('rpc');var config=require(_0xfa74('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfa74('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x9ddbd2,_0x3ac32e,_0x2d9fa9){return new BPromise(function(_0x287921,_0x344e04){return client['request'](_0x9ddbd2,_0x2d9fa9)[_0xfa74('0x7')](function(_0x37d4d8){logger[_0xfa74('0x8')](_0xfa74('0x9'),_0x3ac32e,'request\x20sent');logger[_0xfa74('0xa')](_0xfa74('0xb'),_0x3ac32e,'request\x20sent',JSON[_0xfa74('0xc')](_0x37d4d8));if(_0x37d4d8[_0xfa74('0xd')]){if(_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xe')]===0x1f4){logger['error'](_0xfa74('0x9'),_0x3ac32e,_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xf')]);return _0x344e04(_0x37d4d8[_0xfa74('0xd')]['message']);}logger[_0xfa74('0xd')](_0xfa74('0x9'),_0x3ac32e,_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xf')]);return _0x287921(_0x37d4d8[_0xfa74('0xd')]['message']);}else{logger[_0xfa74('0x8')](_0xfa74('0x9'),_0x3ac32e,_0xfa74('0x10'));_0x287921(_0x37d4d8[_0xfa74('0x11')][_0xfa74('0xf')]);}})[_0xfa74('0x12')](function(_0x3b9e32){logger['error'](_0xfa74('0x9'),_0x3ac32e,_0x3b9e32);_0x344e04(_0x3b9e32);});});}exports[_0xfa74('0x13')]=function(_0x51dda1){var _0x4928b6=this;return new Promise(function(_0x31d3c1,_0x25a36b){return db[_0xfa74('0x14')]['findAll']({'raw':_0x51dda1[_0xfa74('0x15')]?_0x51dda1[_0xfa74('0x15')][_0xfa74('0x16')]===undefined?!![]:![]:!![],'where':_0x51dda1['options']?_0x51dda1[_0xfa74('0x15')][_0xfa74('0x17')]||null:null,'attributes':_0x51dda1[_0xfa74('0x15')]?_0x51dda1['options']['attributes']||null:null,'limit':_0x51dda1[_0xfa74('0x15')]?_0x51dda1[_0xfa74('0x15')][_0xfa74('0x18')]||null:null,'include':_0x51dda1[_0xfa74('0x15')]?_0x51dda1[_0xfa74('0x15')]['include']?_['map'](_0x51dda1[_0xfa74('0x15')]['include'],function(_0x48cbd3){return{'model':db[_0x48cbd3['model']],'as':_0x48cbd3['as'],'attributes':_0x48cbd3[_0xfa74('0x19')],'include':_0x48cbd3[_0xfa74('0x1a')]?_[_0xfa74('0x1b')](_0x48cbd3['include'],function(_0x530f99){return{'model':db[_0x530f99[_0xfa74('0x1c')]],'as':_0x530f99['as'],'attributes':_0x530f99[_0xfa74('0x19')],'include':_0x530f99['include']?_[_0xfa74('0x1b')](_0x530f99['include'],function(_0x1a8cf7){return{'model':db[_0x1a8cf7[_0xfa74('0x1c')]],'as':_0x1a8cf7['as'],'attributes':_0x1a8cf7['attributes']};}):[]};}):[]};}):[]:[]})[_0xfa74('0x7')](function(_0x1130de){logger[_0xfa74('0x8')](_0xfa74('0x13'),_0x51dda1);logger['debug'](_0xfa74('0x13'),_0x51dda1,JSON[_0xfa74('0xc')](_0x1130de));_0x31d3c1(_0x1130de);})[_0xfa74('0x12')](function(_0x57d90e){logger['error'](_0xfa74('0x13'),_0x57d90e[_0xfa74('0xf')],_0x51dda1);_0x25a36b(_0x4928b6['error'](0x1f4,_0x57d90e['message']));});});};exports[_0xfa74('0x1d')]=function(_0x564060){var _0x2238d4=this;return new Promise(function(_0x4d6d0a,_0x363173){return db[_0xfa74('0x14')][_0xfa74('0x1e')]({'raw':_0x564060[_0xfa74('0x15')]?_0x564060['options'][_0xfa74('0x16')]===undefined?!![]:![]:!![],'where':_0x564060[_0xfa74('0x15')]?_0x564060[_0xfa74('0x15')][_0xfa74('0x17')]||null:null,'attributes':_0x564060[_0xfa74('0x15')]?_0x564060[_0xfa74('0x15')][_0xfa74('0x19')]||null:null,'include':_0x564060['options']?_0x564060[_0xfa74('0x15')]['include']?_[_0xfa74('0x1b')](_0x564060[_0xfa74('0x15')][_0xfa74('0x1a')],function(_0x1b5ff0){return{'model':db[_0x1b5ff0['model']],'as':_0x1b5ff0['as'],'attributes':_0x1b5ff0['attributes'],'include':_0x1b5ff0[_0xfa74('0x1a')]?_[_0xfa74('0x1b')](_0x1b5ff0[_0xfa74('0x1a')],function(_0x25863f){return{'model':db[_0x25863f['model']],'as':_0x25863f['as'],'attributes':_0x25863f[_0xfa74('0x19')],'include':_0x25863f[_0xfa74('0x1a')]?_['map'](_0x25863f['include'],function(_0x557510){return{'model':db[_0x557510['model']],'as':_0x557510['as'],'attributes':_0x557510['attributes']};}):[]};}):[]};}):[]:[]})[_0xfa74('0x7')](function(_0x1c3b44){logger[_0xfa74('0x8')](_0xfa74('0x1d'),_0x564060);logger[_0xfa74('0xa')](_0xfa74('0x1d'),_0x564060,JSON[_0xfa74('0xc')](_0x1c3b44));_0x4d6d0a(_0x1c3b44);})[_0xfa74('0x12')](function(_0x1a2d52){logger['error'](_0xfa74('0x1d'),_0x1a2d52[_0xfa74('0xf')],_0x564060);_0x363173(_0x2238d4[_0xfa74('0xd')](0x1f4,_0x1a2d52[_0xfa74('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 1f4473a..4a7b981 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 _0x1bdf=['multer','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','index','get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','/:id','update','destroy','exports'];(function(_0x182536,_0x166e25){var _0x19a3d1=function(_0x5b9755){while(--_0x5b9755){_0x182536['push'](_0x182536['shift']());}};_0x19a3d1(++_0x166e25);}(_0x1bdf,0x1cc));var _0xf1bd=function(_0x4c7706,_0x35ff34){_0x4c7706=_0x4c7706-0x0;var _0x2aa0d1=_0x1bdf[_0x4c7706];return _0x2aa0d1;};'use strict';var multer=require(_0xf1bd('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf1bd('0x1'));var router=express[_0xf1bd('0x2')]();var fs_extra=require(_0xf1bd('0x3'));var auth=require(_0xf1bd('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf1bd('0x5'));var controller=require(_0xf1bd('0x6'));router['get']('/',auth[_0xf1bd('0x7')](),controller[_0xf1bd('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xf1bd('0x9')](_0xf1bd('0xa'),auth[_0xf1bd('0x7')](),controller[_0xf1bd('0xb')]);router[_0xf1bd('0x9')](_0xf1bd('0xc'),auth[_0xf1bd('0x7')](),controller[_0xf1bd('0xd')]);router[_0xf1bd('0x9')](_0xf1bd('0xe'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xf1bd('0xf')]('/',auth[_0xf1bd('0x7')](),controller['create']);router['put'](_0xf1bd('0x10'),auth['isAuthenticated'](),controller[_0xf1bd('0x11')]);router['delete']('/:id',auth[_0xf1bd('0x7')](),controller[_0xf1bd('0x12')]);module[_0xf1bd('0x13')]=router; \ No newline at end of file +var _0x75a3=['/:id/subjects','getSubjects','/:id/descriptions','post','create','/:id','update','delete','destroy','exports','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/fields'];(function(_0x48d7aa,_0x52349c){var _0x138fc6=function(_0x273dd9){while(--_0x273dd9){_0x48d7aa['push'](_0x48d7aa['shift']());}};_0x138fc6(++_0x52349c);}(_0x75a3,0x122));var _0x375a=function(_0xf8fe12,_0x4fbaba){_0xf8fe12=_0xf8fe12-0x0;var _0x326c2b=_0x75a3[_0xf8fe12];return _0x326c2b;};'use strict';var multer=require('multer');var util=require(_0x375a('0x0'));var path=require(_0x375a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x375a('0x2')]();var fs_extra=require(_0x375a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x375a('0x4'));var config=require(_0x375a('0x5'));var controller=require('./intVtigerConfiguration.controller');router[_0x375a('0x6')]('/',auth[_0x375a('0x7')](),controller[_0x375a('0x8')]);router[_0x375a('0x6')]('/:id',auth[_0x375a('0x7')](),controller['show']);router[_0x375a('0x6')](_0x375a('0x9'),auth[_0x375a('0x7')](),controller['getFields']);router[_0x375a('0x6')](_0x375a('0xa'),auth['isAuthenticated'](),controller[_0x375a('0xb')]);router['get'](_0x375a('0xc'),auth[_0x375a('0x7')](),controller['getDescriptions']);router[_0x375a('0xd')]('/',auth[_0x375a('0x7')](),controller[_0x375a('0xe')]);router['put'](_0x375a('0xf'),auth[_0x375a('0x7')](),controller[_0x375a('0x10')]);router[_0x375a('0x11')](_0x375a('0xf'),auth[_0x375a('0x7')](),controller[_0x375a('0x12')]);module[_0x375a('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 4efbc5b..0a87cab 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 _0x9429=['STRING','sequelize','exports'];(function(_0x25436c,_0x550ccd){var _0x2e9716=function(_0x3666dc){while(--_0x3666dc){_0x25436c['push'](_0x25436c['shift']());}};_0x2e9716(++_0x550ccd);}(_0x9429,0x1c3));var _0x9942=function(_0x26c758,_0x26261e){_0x26c758=_0x26c758-0x0;var _0x3e6e5c=_0x9429[_0x26c758];return _0x3e6e5c;};'use strict';var Sequelize=require(_0x9942('0x0'));module[_0x9942('0x1')]={'name':{'type':Sequelize[_0x9942('0x2')]},'description':{'type':Sequelize[_0x9942('0x2')]}}; \ No newline at end of file +var _0x717a=['exports','STRING','sequelize'];(function(_0x1a89a1,_0x56d889){var _0x3d5b46=function(_0x56debf){while(--_0x56debf){_0x1a89a1['push'](_0x1a89a1['shift']());}};_0x3d5b46(++_0x56d889);}(_0x717a,0xa4));var _0xa717=function(_0x261522,_0x1adc1f){_0x261522=_0x261522-0x0;var _0x98a25a=_0x717a[_0x261522];return _0x98a25a;};'use strict';var Sequelize=require(_0xa717('0x0'));module[_0xa717('0x1')]={'name':{'type':Sequelize[_0xa717('0x2')]},'description':{'type':Sequelize[_0xa717('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index dfe73d4..ea181b0 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 _0x0cc3=['rows','catch','params','keys','intersection','options','find','create','body','destroy','findOne','VtigerField','getFields','getSubjects','getDescriptions','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','error','stack','name','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','includeAll','include'];(function(_0xe9bfbc,_0x488cd1){var _0x237482=function(_0x1303ef){while(--_0x1303ef){_0xe9bfbc['push'](_0xe9bfbc['shift']());}};_0x237482(++_0x488cd1);}(_0x0cc3,0x195));var _0x30cc=function(_0x5070b7,_0x216c85){_0x5070b7=_0x5070b7-0x0;var _0x43de25=_0x0cc3[_0x5070b7];return _0x43de25;};'use strict';var emlformat=require(_0x30cc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x30cc('0x1'));var rp=require('request-promise');var moment=require(_0x30cc('0x2'));var BPromise=require(_0x30cc('0x3'));var Mustache=require(_0x30cc('0x4'));var util=require(_0x30cc('0x5'));var path=require(_0x30cc('0x6'));var sox=require(_0x30cc('0x7'));var csv=require(_0x30cc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x30cc('0x9'));var _=require(_0x30cc('0xa'));var squel=require(_0x30cc('0xb'));var crypto=require(_0x30cc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x30cc('0xd'));var toCsv=require(_0x30cc('0x8'));var querystring=require(_0x30cc('0xe'));var Papa=require(_0x30cc('0xf'));var Redis=require(_0x30cc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x30cc('0x11'));var as=require(_0x30cc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x30cc('0x13'));var utils=require(_0x30cc('0x14'));var config=require(_0x30cc('0x15'));var licenseUtil=require(_0x30cc('0x16'));var db=require(_0x30cc('0x17'))['db'];function respondWithStatusCode(_0x16703d,_0x5d52ed){_0x5d52ed=_0x5d52ed||0xcc;return function(_0x560f43){if(_0x560f43){return _0x16703d[_0x30cc('0x18')](_0x5d52ed);}return _0x16703d[_0x30cc('0x19')](_0x5d52ed)[_0x30cc('0x1a')]();};}function respondWithResult(_0x26015e,_0x5317fd){_0x5317fd=_0x5317fd||0xc8;return function(_0x57a43a){if(_0x57a43a){return _0x26015e['status'](_0x5317fd)[_0x30cc('0x1b')](_0x57a43a);}};}function respondWithFilteredResult(_0x1257b8,_0x40eea4){return function(_0x59346b){if(_0x59346b){var _0x23676b=typeof _0x40eea4[_0x30cc('0x1c')]==='undefined'&&typeof _0x40eea4[_0x30cc('0x1d')]===_0x30cc('0x1e');var _0x297b7b=_0x59346b[_0x30cc('0x1f')];var _0x16010c=_0x23676b?0x0:_0x40eea4['offset'];var _0x4c351d=_0x23676b?_0x59346b[_0x30cc('0x1f')]:_0x40eea4['offset']+_0x40eea4['limit'];var _0x1c365b;if(_0x4c351d>=_0x297b7b){_0x4c351d=_0x297b7b;_0x1c365b=0xc8;}else{_0x1c365b=0xce;}_0x1257b8[_0x30cc('0x19')](_0x1c365b);return _0x1257b8[_0x30cc('0x20')]('Content-Range',_0x16010c+'-'+_0x4c351d+'/'+_0x297b7b)[_0x30cc('0x1b')](_0x59346b);}return null;};}function patchUpdates(_0x39e068){return function(_0x2c8aae){try{jsonpatch[_0x30cc('0x21')](_0x2c8aae,_0x39e068,!![]);}catch(_0x5bb31c){return BPromise[_0x30cc('0x22')](_0x5bb31c);}return _0x2c8aae[_0x30cc('0x23')]();};}function saveUpdates(_0x5c0014,_0x141c37){return function(_0x5f4c42){if(_0x5f4c42){return _0x5f4c42[_0x30cc('0x24')](_0x5c0014)[_0x30cc('0x25')](function(_0x380ecc){return _0x380ecc;});}return null;};}function removeEntity(_0x1d37c8,_0x586e7f){return function(_0x329de3){if(_0x329de3){return _0x329de3['destroy']()['then'](function(){_0x1d37c8[_0x30cc('0x19')](0xcc)[_0x30cc('0x1a')]();});}};}function handleEntityNotFound(_0x5d2de3,_0x4803bc){return function(_0x2f7e6d){if(!_0x2f7e6d){_0x5d2de3[_0x30cc('0x18')](0x194);}return _0x2f7e6d;};}function handleError(_0x5f44c1,_0x6dd582){_0x6dd582=_0x6dd582||0x1f4;return function(_0x3633c9){logger[_0x30cc('0x26')](_0x3633c9[_0x30cc('0x27')]);if(_0x3633c9[_0x30cc('0x28')]){delete _0x3633c9[_0x30cc('0x28')];}_0x5f44c1[_0x30cc('0x19')](_0x6dd582)['send'](_0x3633c9);};}exports['index']=function(_0xc4d860,_0x176670){var _0x16c006={},_0x31170e={},_0x5214ee={'count':0x0,'rows':[]};var _0x27f6f8=_[_0x30cc('0x29')](db[_0x30cc('0x2a')][_0x30cc('0x2b')],function(_0x4e407b){return{'name':_0x4e407b[_0x30cc('0x2c')],'type':_0x4e407b[_0x30cc('0x2d')][_0x30cc('0x2e')]};});_0x31170e[_0x30cc('0x2f')]=_['map'](_0x27f6f8,_0x30cc('0x28'));_0x31170e['query']=_['keys'](_0xc4d860[_0x30cc('0x30')]);_0x31170e['filters']=_['intersection'](_0x31170e[_0x30cc('0x2f')],_0x31170e['query']);_0x16c006[_0x30cc('0x31')]=_['intersection'](_0x31170e[_0x30cc('0x2f')],qs[_0x30cc('0x32')](_0xc4d860[_0x30cc('0x30')]['fields']));_0x16c006['attributes']=_0x16c006['attributes'][_0x30cc('0x33')]?_0x16c006['attributes']:_0x31170e[_0x30cc('0x2f')];if(!_0xc4d860[_0x30cc('0x30')][_0x30cc('0x34')](_0x30cc('0x35'))){_0x16c006[_0x30cc('0x1d')]=qs['limit'](_0xc4d860[_0x30cc('0x30')]['limit']);_0x16c006[_0x30cc('0x1c')]=qs[_0x30cc('0x1c')](_0xc4d860[_0x30cc('0x30')][_0x30cc('0x1c')]);}_0x16c006[_0x30cc('0x36')]=qs[_0x30cc('0x37')](_0xc4d860['query'][_0x30cc('0x37')]);_0x16c006[_0x30cc('0x38')]=qs['filters'](_[_0x30cc('0x39')](_0xc4d860['query'],_0x31170e[_0x30cc('0x3a')]),_0x27f6f8);if(_0xc4d860['query'][_0x30cc('0x3b')]){_0x16c006[_0x30cc('0x38')]=_[_0x30cc('0x3c')](_0x16c006[_0x30cc('0x38')],{'$or':_['map'](_0x27f6f8,function(_0x21a21c){if(_0x21a21c['type']!=='VIRTUAL'){var _0x57c086={};_0x57c086[_0x21a21c['name']]={'$like':'%'+_0xc4d860[_0x30cc('0x30')]['filter']+'%'};return _0x57c086;}})});}_0x16c006=_[_0x30cc('0x3c')]({},_0x16c006,_0xc4d860['options']);var _0x255c3d={'where':_0x16c006[_0x30cc('0x38')]};return db[_0x30cc('0x2a')]['count'](_0x255c3d)[_0x30cc('0x25')](function(_0x197283){_0x5214ee['count']=_0x197283;if(_0xc4d860[_0x30cc('0x30')][_0x30cc('0x3d')]){_0x16c006[_0x30cc('0x3e')]=[{'all':!![]}];}return db[_0x30cc('0x2a')]['findAll'](_0x16c006);})[_0x30cc('0x25')](function(_0x680b5b){_0x5214ee[_0x30cc('0x3f')]=_0x680b5b;return _0x5214ee;})[_0x30cc('0x25')](respondWithFilteredResult(_0x176670,_0x16c006))[_0x30cc('0x40')](handleError(_0x176670,null));};exports['show']=function(_0xdc9f5f,_0x221d44){var _0x1bbea5={'raw':![],'where':{'id':_0xdc9f5f[_0x30cc('0x41')]['id']}},_0x589c94={};_0x589c94[_0x30cc('0x2f')]=_['keys'](db[_0x30cc('0x2a')][_0x30cc('0x2b')]);_0x589c94[_0x30cc('0x30')]=_[_0x30cc('0x42')](_0xdc9f5f[_0x30cc('0x30')]);_0x589c94[_0x30cc('0x3a')]=_['intersection'](_0x589c94[_0x30cc('0x2f')],_0x589c94[_0x30cc('0x30')]);_0x1bbea5[_0x30cc('0x31')]=_[_0x30cc('0x43')](_0x589c94[_0x30cc('0x2f')],qs['fields'](_0xdc9f5f[_0x30cc('0x30')][_0x30cc('0x32')]));_0x1bbea5['attributes']=_0x1bbea5['attributes']['length']?_0x1bbea5[_0x30cc('0x31')]:_0x589c94['model'];if(_0xdc9f5f[_0x30cc('0x30')][_0x30cc('0x3d')]){_0x1bbea5[_0x30cc('0x3e')]=[{'all':!![]}];}_0x1bbea5=_['merge']({},_0x1bbea5,_0xdc9f5f[_0x30cc('0x44')]);return db[_0x30cc('0x2a')][_0x30cc('0x45')](_0x1bbea5)['then'](handleEntityNotFound(_0x221d44,null))[_0x30cc('0x25')](respondWithResult(_0x221d44,null))[_0x30cc('0x40')](handleError(_0x221d44,null));};exports['create']=function(_0xf6f891,_0x4340b7){return db[_0x30cc('0x2a')][_0x30cc('0x46')](_0xf6f891[_0x30cc('0x47')],{})[_0x30cc('0x25')](respondWithResult(_0x4340b7,0xc9))[_0x30cc('0x40')](handleError(_0x4340b7,null));};exports[_0x30cc('0x24')]=function(_0x1a378e,_0x5b3b23){if(_0x1a378e[_0x30cc('0x47')]['id']){delete _0x1a378e[_0x30cc('0x47')]['id'];}return db[_0x30cc('0x2a')][_0x30cc('0x45')]({'where':{'id':_0x1a378e[_0x30cc('0x41')]['id']}})['then'](handleEntityNotFound(_0x5b3b23,null))['then'](saveUpdates(_0x1a378e[_0x30cc('0x47')],null))[_0x30cc('0x25')](respondWithResult(_0x5b3b23,null))[_0x30cc('0x40')](handleError(_0x5b3b23,null));};exports[_0x30cc('0x48')]=function(_0x3dffd5,_0x1d0baf){return db[_0x30cc('0x2a')]['find']({'where':{'id':_0x3dffd5[_0x30cc('0x41')]['id']}})[_0x30cc('0x25')](handleEntityNotFound(_0x1d0baf,null))[_0x30cc('0x25')](removeEntity(_0x1d0baf,null))[_0x30cc('0x40')](handleError(_0x1d0baf,null));};exports['getFields']=function(_0x46eeb2,_0x33e07a,_0x565aa8){var _0x2e170f={};var _0x9ccf7f={};var _0x3a951b;var _0xb749e8;return db[_0x30cc('0x2a')][_0x30cc('0x49')]({'where':{'id':_0x46eeb2[_0x30cc('0x41')]['id']}})[_0x30cc('0x25')](handleEntityNotFound(_0x33e07a,null))[_0x30cc('0x25')](function(_0x5e0c25){if(_0x5e0c25){_0x3a951b=_0x5e0c25;_0x9ccf7f[_0x30cc('0x2f')]=_[_0x30cc('0x42')](db[_0x30cc('0x4a')][_0x30cc('0x2b')]);_0x9ccf7f[_0x30cc('0x30')]=_[_0x30cc('0x42')](_0x46eeb2[_0x30cc('0x30')]);_0x9ccf7f[_0x30cc('0x3a')]=_[_0x30cc('0x43')](_0x9ccf7f[_0x30cc('0x2f')],_0x9ccf7f[_0x30cc('0x30')]);_0x2e170f[_0x30cc('0x31')]=_[_0x30cc('0x43')](_0x9ccf7f[_0x30cc('0x2f')],qs[_0x30cc('0x32')](_0x46eeb2[_0x30cc('0x30')][_0x30cc('0x32')]));_0x2e170f['attributes']=_0x2e170f['attributes'][_0x30cc('0x33')]?_0x2e170f[_0x30cc('0x31')]:_0x9ccf7f[_0x30cc('0x2f')];_0x2e170f[_0x30cc('0x36')]=qs[_0x30cc('0x37')](_0x46eeb2[_0x30cc('0x30')][_0x30cc('0x37')]);_0x2e170f['where']=qs[_0x30cc('0x3a')](_[_0x30cc('0x39')](_0x46eeb2['query'],_0x9ccf7f[_0x30cc('0x3a')]));if(_0x46eeb2[_0x30cc('0x30')][_0x30cc('0x3b')]){_0x2e170f[_0x30cc('0x38')]=_[_0x30cc('0x3c')](_0x2e170f['where'],{'$or':_[_0x30cc('0x29')](_0x2e170f[_0x30cc('0x31')],function(_0x73c3b4){var _0x5acc22={};_0x5acc22[_0x73c3b4]={'$like':'%'+_0x46eeb2[_0x30cc('0x30')][_0x30cc('0x3b')]+'%'};return _0x5acc22;})});}_0x2e170f=_[_0x30cc('0x3c')]({},_0x2e170f,_0x46eeb2[_0x30cc('0x44')]);return _0x3a951b['getFields'](_0x2e170f);}})[_0x30cc('0x25')](function(_0x13b906){if(_0x13b906){_0xb749e8=_0x13b906['length'];if(!_0x46eeb2['query']['hasOwnProperty'](_0x30cc('0x35'))){_0x2e170f[_0x30cc('0x1d')]=qs['limit'](_0x46eeb2[_0x30cc('0x30')]['limit']);_0x2e170f['offset']=qs[_0x30cc('0x1c')](_0x46eeb2[_0x30cc('0x30')][_0x30cc('0x1c')]);}return _0x3a951b[_0x30cc('0x4b')](_0x2e170f);}})[_0x30cc('0x25')](function(_0x3d9673){if(_0x3d9673){return _0x3d9673?{'count':_0xb749e8,'rows':_0x3d9673}:null;}})[_0x30cc('0x25')](respondWithResult(_0x33e07a,null))['catch'](handleError(_0x33e07a,null));};exports['getSubjects']=function(_0x5d6c85,_0x459234,_0xd2135c){var _0x397ebb={};var _0x3fb89d={};var _0x5a1b8c;var _0x46a2fc;return db[_0x30cc('0x2a')][_0x30cc('0x49')]({'where':{'id':_0x5d6c85[_0x30cc('0x41')]['id']}})[_0x30cc('0x25')](handleEntityNotFound(_0x459234,null))[_0x30cc('0x25')](function(_0x3ac55c){if(_0x3ac55c){_0x5a1b8c=_0x3ac55c;_0x3fb89d[_0x30cc('0x2f')]=_[_0x30cc('0x42')](db['VtigerField']['rawAttributes']);_0x3fb89d['query']=_['keys'](_0x5d6c85[_0x30cc('0x30')]);_0x3fb89d[_0x30cc('0x3a')]=_['intersection'](_0x3fb89d[_0x30cc('0x2f')],_0x3fb89d[_0x30cc('0x30')]);_0x397ebb[_0x30cc('0x31')]=_[_0x30cc('0x43')](_0x3fb89d[_0x30cc('0x2f')],qs[_0x30cc('0x32')](_0x5d6c85['query'][_0x30cc('0x32')]));_0x397ebb[_0x30cc('0x31')]=_0x397ebb[_0x30cc('0x31')][_0x30cc('0x33')]?_0x397ebb[_0x30cc('0x31')]:_0x3fb89d['model'];_0x397ebb['order']=qs[_0x30cc('0x37')](_0x5d6c85[_0x30cc('0x30')][_0x30cc('0x37')]);_0x397ebb[_0x30cc('0x38')]=qs['filters'](_['pick'](_0x5d6c85[_0x30cc('0x30')],_0x3fb89d[_0x30cc('0x3a')]));if(_0x5d6c85[_0x30cc('0x30')][_0x30cc('0x3b')]){_0x397ebb['where']=_['merge'](_0x397ebb[_0x30cc('0x38')],{'$or':_[_0x30cc('0x29')](_0x397ebb[_0x30cc('0x31')],function(_0x3c870a){var _0x15a8ba={};_0x15a8ba[_0x3c870a]={'$like':'%'+_0x5d6c85[_0x30cc('0x30')]['filter']+'%'};return _0x15a8ba;})});}_0x397ebb=_[_0x30cc('0x3c')]({},_0x397ebb,_0x5d6c85[_0x30cc('0x44')]);return _0x5a1b8c[_0x30cc('0x4c')](_0x397ebb);}})[_0x30cc('0x25')](function(_0x2bbd8e){if(_0x2bbd8e){_0x46a2fc=_0x2bbd8e['length'];if(!_0x5d6c85[_0x30cc('0x30')]['hasOwnProperty']('nolimit')){_0x397ebb['limit']=qs[_0x30cc('0x1d')](_0x5d6c85[_0x30cc('0x30')][_0x30cc('0x1d')]);_0x397ebb['offset']=qs[_0x30cc('0x1c')](_0x5d6c85[_0x30cc('0x30')][_0x30cc('0x1c')]);}return _0x5a1b8c[_0x30cc('0x4c')](_0x397ebb);}})[_0x30cc('0x25')](function(_0x557ba7){if(_0x557ba7){return _0x557ba7?{'count':_0x46a2fc,'rows':_0x557ba7}:null;}})['then'](respondWithResult(_0x459234,null))[_0x30cc('0x40')](handleError(_0x459234,null));};exports[_0x30cc('0x4d')]=function(_0x2d53a3,_0x31234d,_0x4eb561){var _0x1dded8={};var _0x37fe7b={};var _0x3cbb19;var _0x24110c;return db[_0x30cc('0x2a')]['findOne']({'where':{'id':_0x2d53a3[_0x30cc('0x41')]['id']}})[_0x30cc('0x25')](handleEntityNotFound(_0x31234d,null))[_0x30cc('0x25')](function(_0x445279){if(_0x445279){_0x3cbb19=_0x445279;_0x37fe7b['model']=_['keys'](db[_0x30cc('0x4a')][_0x30cc('0x2b')]);_0x37fe7b[_0x30cc('0x30')]=_[_0x30cc('0x42')](_0x2d53a3[_0x30cc('0x30')]);_0x37fe7b[_0x30cc('0x3a')]=_[_0x30cc('0x43')](_0x37fe7b['model'],_0x37fe7b[_0x30cc('0x30')]);_0x1dded8['attributes']=_[_0x30cc('0x43')](_0x37fe7b['model'],qs[_0x30cc('0x32')](_0x2d53a3[_0x30cc('0x30')][_0x30cc('0x32')]));_0x1dded8[_0x30cc('0x31')]=_0x1dded8[_0x30cc('0x31')][_0x30cc('0x33')]?_0x1dded8[_0x30cc('0x31')]:_0x37fe7b[_0x30cc('0x2f')];_0x1dded8[_0x30cc('0x36')]=qs[_0x30cc('0x37')](_0x2d53a3['query'][_0x30cc('0x37')]);_0x1dded8[_0x30cc('0x38')]=qs[_0x30cc('0x3a')](_['pick'](_0x2d53a3['query'],_0x37fe7b[_0x30cc('0x3a')]));if(_0x2d53a3[_0x30cc('0x30')][_0x30cc('0x3b')]){_0x1dded8['where']=_[_0x30cc('0x3c')](_0x1dded8[_0x30cc('0x38')],{'$or':_[_0x30cc('0x29')](_0x1dded8[_0x30cc('0x31')],function(_0x3d57c7){var _0xea53ab={};_0xea53ab[_0x3d57c7]={'$like':'%'+_0x2d53a3['query']['filter']+'%'};return _0xea53ab;})});}_0x1dded8=_[_0x30cc('0x3c')]({},_0x1dded8,_0x2d53a3[_0x30cc('0x44')]);return _0x3cbb19[_0x30cc('0x4d')](_0x1dded8);}})[_0x30cc('0x25')](function(_0x517a6e){if(_0x517a6e){_0x24110c=_0x517a6e['length'];if(!_0x2d53a3[_0x30cc('0x30')][_0x30cc('0x34')](_0x30cc('0x35'))){_0x1dded8[_0x30cc('0x1d')]=qs[_0x30cc('0x1d')](_0x2d53a3[_0x30cc('0x30')]['limit']);_0x1dded8[_0x30cc('0x1c')]=qs['offset'](_0x2d53a3['query'][_0x30cc('0x1c')]);}return _0x3cbb19[_0x30cc('0x4d')](_0x1dded8);}})[_0x30cc('0x25')](function(_0x3641ab){if(_0x3641ab){return _0x3641ab?{'count':_0x24110c,'rows':_0x3641ab}:null;}})[_0x30cc('0x25')](respondWithResult(_0x31234d,null))['catch'](handleError(_0x31234d,null));}; \ No newline at end of file +var _0xbe5d=['undefined','limit','count','set','Content-Range','apply','save','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','VtigerConfiguration','then','include','findAll','rows','catch','show','params','find','create','body','update','getFields','findOne','VtigerField','options','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset'];(function(_0x542b79,_0x2fb13f){var _0x77358e=function(_0x587bb7){while(--_0x587bb7){_0x542b79['push'](_0x542b79['shift']());}};_0x77358e(++_0x2fb13f);}(_0xbe5d,0xd4));var _0xdbe5=function(_0x2bf8c6,_0x314fff){_0x2bf8c6=_0x2bf8c6-0x0;var _0x28bf19=_0xbe5d[_0x2bf8c6];return _0x28bf19;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdbe5('0x0'));var zipdir=require(_0xdbe5('0x1'));var jsonpatch=require(_0xdbe5('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdbe5('0x3'));var util=require(_0xdbe5('0x4'));var path=require(_0xdbe5('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdbe5('0x6'));var _=require(_0xdbe5('0x7'));var squel=require(_0xdbe5('0x8'));var crypto=require(_0xdbe5('0x9'));var jsforce=require(_0xdbe5('0xa'));var deskjs=require(_0xdbe5('0xb'));var toCsv=require(_0xdbe5('0xc'));var querystring=require(_0xdbe5('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdbe5('0xe'));var qs=require(_0xdbe5('0xf'));var as=require(_0xdbe5('0x10'));var hardwareService=require(_0xdbe5('0x11'));var logger=require('../../config/logger')(_0xdbe5('0x12'));var utils=require(_0xdbe5('0x13'));var config=require(_0xdbe5('0x14'));var licenseUtil=require(_0xdbe5('0x15'));var db=require(_0xdbe5('0x16'))['db'];function respondWithStatusCode(_0x499b38,_0x5772af){_0x5772af=_0x5772af||0xcc;return function(_0x45ef45){if(_0x45ef45){return _0x499b38[_0xdbe5('0x17')](_0x5772af);}return _0x499b38['status'](_0x5772af)[_0xdbe5('0x18')]();};}function respondWithResult(_0x2604de,_0x3d5107){_0x3d5107=_0x3d5107||0xc8;return function(_0x2802ba){if(_0x2802ba){return _0x2604de[_0xdbe5('0x19')](_0x3d5107)[_0xdbe5('0x1a')](_0x2802ba);}};}function respondWithFilteredResult(_0x3ed31f,_0x3388c6){return function(_0x5b5472){if(_0x5b5472){var _0x50c748=typeof _0x3388c6[_0xdbe5('0x1b')]===_0xdbe5('0x1c')&&typeof _0x3388c6[_0xdbe5('0x1d')]===_0xdbe5('0x1c');var _0x539115=_0x5b5472[_0xdbe5('0x1e')];var _0x2033a3=_0x50c748?0x0:_0x3388c6[_0xdbe5('0x1b')];var _0x438ef4=_0x50c748?_0x5b5472[_0xdbe5('0x1e')]:_0x3388c6[_0xdbe5('0x1b')]+_0x3388c6[_0xdbe5('0x1d')];var _0x18802f;if(_0x438ef4>=_0x539115){_0x438ef4=_0x539115;_0x18802f=0xc8;}else{_0x18802f=0xce;}_0x3ed31f[_0xdbe5('0x19')](_0x18802f);return _0x3ed31f[_0xdbe5('0x1f')](_0xdbe5('0x20'),_0x2033a3+'-'+_0x438ef4+'/'+_0x539115)[_0xdbe5('0x1a')](_0x5b5472);}return null;};}function patchUpdates(_0x2831e1){return function(_0x448296){try{jsonpatch[_0xdbe5('0x21')](_0x448296,_0x2831e1,!![]);}catch(_0x58eb2d){return BPromise['reject'](_0x58eb2d);}return _0x448296[_0xdbe5('0x22')]();};}function saveUpdates(_0x2b1344,_0x552b5c){return function(_0x1ce2da){if(_0x1ce2da){return _0x1ce2da['update'](_0x2b1344)['then'](function(_0x30bcaf){return _0x30bcaf;});}return null;};}function removeEntity(_0x3639a2,_0x37c2c4){return function(_0x1fb509){if(_0x1fb509){return _0x1fb509[_0xdbe5('0x23')]()['then'](function(){_0x3639a2[_0xdbe5('0x19')](0xcc)[_0xdbe5('0x18')]();});}};}function handleEntityNotFound(_0x230ac3,_0x30c12d){return function(_0x33e838){if(!_0x33e838){_0x230ac3['sendStatus'](0x194);}return _0x33e838;};}function handleError(_0x27ee77,_0xe4ca4){_0xe4ca4=_0xe4ca4||0x1f4;return function(_0x5a7531){logger[_0xdbe5('0x24')](_0x5a7531[_0xdbe5('0x25')]);if(_0x5a7531[_0xdbe5('0x26')]){delete _0x5a7531[_0xdbe5('0x26')];}_0x27ee77[_0xdbe5('0x19')](_0xe4ca4)[_0xdbe5('0x27')](_0x5a7531);};}exports[_0xdbe5('0x28')]=function(_0x43779c,_0x53781f){var _0x2483a7={},_0x355cd8={},_0xcab060={'count':0x0,'rows':[]};var _0x71fcac=_[_0xdbe5('0x29')](db['VtigerConfiguration'][_0xdbe5('0x2a')],function(_0x4394d2){return{'name':_0x4394d2[_0xdbe5('0x2b')],'type':_0x4394d2[_0xdbe5('0x2c')][_0xdbe5('0x2d')]};});_0x355cd8[_0xdbe5('0x2e')]=_['map'](_0x71fcac,_0xdbe5('0x26'));_0x355cd8[_0xdbe5('0x2f')]=_[_0xdbe5('0x30')](_0x43779c['query']);_0x355cd8[_0xdbe5('0x31')]=_[_0xdbe5('0x32')](_0x355cd8[_0xdbe5('0x2e')],_0x355cd8[_0xdbe5('0x2f')]);_0x2483a7[_0xdbe5('0x33')]=_['intersection'](_0x355cd8[_0xdbe5('0x2e')],qs[_0xdbe5('0x34')](_0x43779c['query'][_0xdbe5('0x34')]));_0x2483a7[_0xdbe5('0x33')]=_0x2483a7[_0xdbe5('0x33')][_0xdbe5('0x35')]?_0x2483a7[_0xdbe5('0x33')]:_0x355cd8[_0xdbe5('0x2e')];if(!_0x43779c[_0xdbe5('0x2f')][_0xdbe5('0x36')]('nolimit')){_0x2483a7['limit']=qs[_0xdbe5('0x1d')](_0x43779c[_0xdbe5('0x2f')][_0xdbe5('0x1d')]);_0x2483a7[_0xdbe5('0x1b')]=qs[_0xdbe5('0x1b')](_0x43779c[_0xdbe5('0x2f')][_0xdbe5('0x1b')]);}_0x2483a7[_0xdbe5('0x37')]=qs[_0xdbe5('0x38')](_0x43779c['query']['sort']);_0x2483a7['where']=qs['filters'](_[_0xdbe5('0x39')](_0x43779c['query'],_0x355cd8[_0xdbe5('0x31')]),_0x71fcac);if(_0x43779c[_0xdbe5('0x2f')][_0xdbe5('0x3a')]){_0x2483a7[_0xdbe5('0x3b')]=_[_0xdbe5('0x3c')](_0x2483a7[_0xdbe5('0x3b')],{'$or':_[_0xdbe5('0x29')](_0x71fcac,function(_0x37794e){if(_0x37794e['type']!==_0xdbe5('0x3d')){var _0x55bcf5={};_0x55bcf5[_0x37794e['name']]={'$like':'%'+_0x43779c[_0xdbe5('0x2f')][_0xdbe5('0x3a')]+'%'};return _0x55bcf5;}})});}_0x2483a7=_['merge']({},_0x2483a7,_0x43779c['options']);var _0x182e03={'where':_0x2483a7[_0xdbe5('0x3b')]};return db[_0xdbe5('0x3e')][_0xdbe5('0x1e')](_0x182e03)[_0xdbe5('0x3f')](function(_0x15dfd0){_0xcab060[_0xdbe5('0x1e')]=_0x15dfd0;if(_0x43779c[_0xdbe5('0x2f')]['includeAll']){_0x2483a7[_0xdbe5('0x40')]=[{'all':!![]}];}return db[_0xdbe5('0x3e')][_0xdbe5('0x41')](_0x2483a7);})[_0xdbe5('0x3f')](function(_0x14d567){_0xcab060[_0xdbe5('0x42')]=_0x14d567;return _0xcab060;})['then'](respondWithFilteredResult(_0x53781f,_0x2483a7))[_0xdbe5('0x43')](handleError(_0x53781f,null));};exports[_0xdbe5('0x44')]=function(_0x97841f,_0x2307b5){var _0x3c0f9b={'raw':![],'where':{'id':_0x97841f[_0xdbe5('0x45')]['id']}},_0x2311f4={};_0x2311f4[_0xdbe5('0x2e')]=_[_0xdbe5('0x30')](db[_0xdbe5('0x3e')][_0xdbe5('0x2a')]);_0x2311f4[_0xdbe5('0x2f')]=_['keys'](_0x97841f[_0xdbe5('0x2f')]);_0x2311f4[_0xdbe5('0x31')]=_[_0xdbe5('0x32')](_0x2311f4[_0xdbe5('0x2e')],_0x2311f4[_0xdbe5('0x2f')]);_0x3c0f9b[_0xdbe5('0x33')]=_[_0xdbe5('0x32')](_0x2311f4[_0xdbe5('0x2e')],qs['fields'](_0x97841f['query']['fields']));_0x3c0f9b[_0xdbe5('0x33')]=_0x3c0f9b[_0xdbe5('0x33')]['length']?_0x3c0f9b[_0xdbe5('0x33')]:_0x2311f4[_0xdbe5('0x2e')];if(_0x97841f['query']['includeAll']){_0x3c0f9b[_0xdbe5('0x40')]=[{'all':!![]}];}_0x3c0f9b=_[_0xdbe5('0x3c')]({},_0x3c0f9b,_0x97841f['options']);return db['VtigerConfiguration'][_0xdbe5('0x46')](_0x3c0f9b)['then'](handleEntityNotFound(_0x2307b5,null))[_0xdbe5('0x3f')](respondWithResult(_0x2307b5,null))['catch'](handleError(_0x2307b5,null));};exports['create']=function(_0x3f6976,_0x439b20){return db[_0xdbe5('0x3e')][_0xdbe5('0x47')](_0x3f6976[_0xdbe5('0x48')],{})[_0xdbe5('0x3f')](respondWithResult(_0x439b20,0xc9))[_0xdbe5('0x43')](handleError(_0x439b20,null));};exports[_0xdbe5('0x49')]=function(_0x3242c4,_0x5730e6){if(_0x3242c4['body']['id']){delete _0x3242c4[_0xdbe5('0x48')]['id'];}return db[_0xdbe5('0x3e')][_0xdbe5('0x46')]({'where':{'id':_0x3242c4[_0xdbe5('0x45')]['id']}})['then'](handleEntityNotFound(_0x5730e6,null))['then'](saveUpdates(_0x3242c4[_0xdbe5('0x48')],null))[_0xdbe5('0x3f')](respondWithResult(_0x5730e6,null))[_0xdbe5('0x43')](handleError(_0x5730e6,null));};exports['destroy']=function(_0xccc985,_0x13aca1){return db[_0xdbe5('0x3e')][_0xdbe5('0x46')]({'where':{'id':_0xccc985[_0xdbe5('0x45')]['id']}})[_0xdbe5('0x3f')](handleEntityNotFound(_0x13aca1,null))[_0xdbe5('0x3f')](removeEntity(_0x13aca1,null))['catch'](handleError(_0x13aca1,null));};exports[_0xdbe5('0x4a')]=function(_0x600382,_0x4c5dc3,_0x232e95){var _0x46bce6={};var _0x328c19={};var _0x27cc2a;var _0x26b5f0;return db[_0xdbe5('0x3e')][_0xdbe5('0x4b')]({'where':{'id':_0x600382[_0xdbe5('0x45')]['id']}})[_0xdbe5('0x3f')](handleEntityNotFound(_0x4c5dc3,null))['then'](function(_0x466f79){if(_0x466f79){_0x27cc2a=_0x466f79;_0x328c19[_0xdbe5('0x2e')]=_['keys'](db[_0xdbe5('0x4c')][_0xdbe5('0x2a')]);_0x328c19[_0xdbe5('0x2f')]=_[_0xdbe5('0x30')](_0x600382[_0xdbe5('0x2f')]);_0x328c19[_0xdbe5('0x31')]=_[_0xdbe5('0x32')](_0x328c19['model'],_0x328c19[_0xdbe5('0x2f')]);_0x46bce6[_0xdbe5('0x33')]=_[_0xdbe5('0x32')](_0x328c19[_0xdbe5('0x2e')],qs[_0xdbe5('0x34')](_0x600382[_0xdbe5('0x2f')][_0xdbe5('0x34')]));_0x46bce6[_0xdbe5('0x33')]=_0x46bce6[_0xdbe5('0x33')]['length']?_0x46bce6['attributes']:_0x328c19[_0xdbe5('0x2e')];_0x46bce6[_0xdbe5('0x37')]=qs[_0xdbe5('0x38')](_0x600382[_0xdbe5('0x2f')][_0xdbe5('0x38')]);_0x46bce6['where']=qs['filters'](_[_0xdbe5('0x39')](_0x600382[_0xdbe5('0x2f')],_0x328c19[_0xdbe5('0x31')]));if(_0x600382['query']['filter']){_0x46bce6['where']=_[_0xdbe5('0x3c')](_0x46bce6['where'],{'$or':_[_0xdbe5('0x29')](_0x46bce6[_0xdbe5('0x33')],function(_0x2b5630){var _0x113022={};_0x113022[_0x2b5630]={'$like':'%'+_0x600382['query'][_0xdbe5('0x3a')]+'%'};return _0x113022;})});}_0x46bce6=_[_0xdbe5('0x3c')]({},_0x46bce6,_0x600382[_0xdbe5('0x4d')]);return _0x27cc2a[_0xdbe5('0x4a')](_0x46bce6);}})[_0xdbe5('0x3f')](function(_0x2b42eb){if(_0x2b42eb){_0x26b5f0=_0x2b42eb[_0xdbe5('0x35')];if(!_0x600382[_0xdbe5('0x2f')][_0xdbe5('0x36')]('nolimit')){_0x46bce6[_0xdbe5('0x1d')]=qs['limit'](_0x600382['query'][_0xdbe5('0x1d')]);_0x46bce6[_0xdbe5('0x1b')]=qs[_0xdbe5('0x1b')](_0x600382[_0xdbe5('0x2f')][_0xdbe5('0x1b')]);}return _0x27cc2a[_0xdbe5('0x4a')](_0x46bce6);}})[_0xdbe5('0x3f')](function(_0x55a25b){if(_0x55a25b){return _0x55a25b?{'count':_0x26b5f0,'rows':_0x55a25b}:null;}})[_0xdbe5('0x3f')](respondWithResult(_0x4c5dc3,null))['catch'](handleError(_0x4c5dc3,null));};exports[_0xdbe5('0x4e')]=function(_0x12f968,_0xbe3fb6,_0x4bddef){var _0x29ed6d={};var _0xed8fed={};var _0x1a8d3c;var _0x822196;return db[_0xdbe5('0x3e')][_0xdbe5('0x4b')]({'where':{'id':_0x12f968[_0xdbe5('0x45')]['id']}})[_0xdbe5('0x3f')](handleEntityNotFound(_0xbe3fb6,null))[_0xdbe5('0x3f')](function(_0x1385c9){if(_0x1385c9){_0x1a8d3c=_0x1385c9;_0xed8fed[_0xdbe5('0x2e')]=_[_0xdbe5('0x30')](db[_0xdbe5('0x4c')]['rawAttributes']);_0xed8fed[_0xdbe5('0x2f')]=_[_0xdbe5('0x30')](_0x12f968['query']);_0xed8fed[_0xdbe5('0x31')]=_[_0xdbe5('0x32')](_0xed8fed[_0xdbe5('0x2e')],_0xed8fed[_0xdbe5('0x2f')]);_0x29ed6d[_0xdbe5('0x33')]=_[_0xdbe5('0x32')](_0xed8fed['model'],qs['fields'](_0x12f968[_0xdbe5('0x2f')][_0xdbe5('0x34')]));_0x29ed6d[_0xdbe5('0x33')]=_0x29ed6d[_0xdbe5('0x33')]['length']?_0x29ed6d[_0xdbe5('0x33')]:_0xed8fed['model'];_0x29ed6d[_0xdbe5('0x37')]=qs['sort'](_0x12f968[_0xdbe5('0x2f')]['sort']);_0x29ed6d[_0xdbe5('0x3b')]=qs['filters'](_[_0xdbe5('0x39')](_0x12f968[_0xdbe5('0x2f')],_0xed8fed[_0xdbe5('0x31')]));if(_0x12f968[_0xdbe5('0x2f')][_0xdbe5('0x3a')]){_0x29ed6d[_0xdbe5('0x3b')]=_['merge'](_0x29ed6d[_0xdbe5('0x3b')],{'$or':_['map'](_0x29ed6d[_0xdbe5('0x33')],function(_0xbdb624){var _0x41222d={};_0x41222d[_0xbdb624]={'$like':'%'+_0x12f968[_0xdbe5('0x2f')][_0xdbe5('0x3a')]+'%'};return _0x41222d;})});}_0x29ed6d=_[_0xdbe5('0x3c')]({},_0x29ed6d,_0x12f968['options']);return _0x1a8d3c[_0xdbe5('0x4e')](_0x29ed6d);}})['then'](function(_0x42e62b){if(_0x42e62b){_0x822196=_0x42e62b[_0xdbe5('0x35')];if(!_0x12f968[_0xdbe5('0x2f')]['hasOwnProperty']('nolimit')){_0x29ed6d[_0xdbe5('0x1d')]=qs['limit'](_0x12f968['query'][_0xdbe5('0x1d')]);_0x29ed6d['offset']=qs['offset'](_0x12f968[_0xdbe5('0x2f')][_0xdbe5('0x1b')]);}return _0x1a8d3c['getSubjects'](_0x29ed6d);}})[_0xdbe5('0x3f')](function(_0x758fa6){if(_0x758fa6){return _0x758fa6?{'count':_0x822196,'rows':_0x758fa6}:null;}})[_0xdbe5('0x3f')](respondWithResult(_0xbe3fb6,null))[_0xdbe5('0x43')](handleError(_0xbe3fb6,null));};exports[_0xdbe5('0x4f')]=function(_0x441b7a,_0x325595,_0x5908e8){var _0x19149d={};var _0x2a168a={};var _0xa4ffd3;var _0x32b13f;return db['VtigerConfiguration'][_0xdbe5('0x4b')]({'where':{'id':_0x441b7a[_0xdbe5('0x45')]['id']}})[_0xdbe5('0x3f')](handleEntityNotFound(_0x325595,null))['then'](function(_0x38208b){if(_0x38208b){_0xa4ffd3=_0x38208b;_0x2a168a[_0xdbe5('0x2e')]=_['keys'](db[_0xdbe5('0x4c')][_0xdbe5('0x2a')]);_0x2a168a[_0xdbe5('0x2f')]=_['keys'](_0x441b7a[_0xdbe5('0x2f')]);_0x2a168a['filters']=_[_0xdbe5('0x32')](_0x2a168a[_0xdbe5('0x2e')],_0x2a168a['query']);_0x19149d['attributes']=_[_0xdbe5('0x32')](_0x2a168a[_0xdbe5('0x2e')],qs[_0xdbe5('0x34')](_0x441b7a[_0xdbe5('0x2f')][_0xdbe5('0x34')]));_0x19149d[_0xdbe5('0x33')]=_0x19149d[_0xdbe5('0x33')]['length']?_0x19149d[_0xdbe5('0x33')]:_0x2a168a[_0xdbe5('0x2e')];_0x19149d[_0xdbe5('0x37')]=qs[_0xdbe5('0x38')](_0x441b7a['query'][_0xdbe5('0x38')]);_0x19149d[_0xdbe5('0x3b')]=qs['filters'](_['pick'](_0x441b7a[_0xdbe5('0x2f')],_0x2a168a[_0xdbe5('0x31')]));if(_0x441b7a[_0xdbe5('0x2f')]['filter']){_0x19149d['where']=_[_0xdbe5('0x3c')](_0x19149d[_0xdbe5('0x3b')],{'$or':_[_0xdbe5('0x29')](_0x19149d[_0xdbe5('0x33')],function(_0x3db6fd){var _0x257222={};_0x257222[_0x3db6fd]={'$like':'%'+_0x441b7a[_0xdbe5('0x2f')][_0xdbe5('0x3a')]+'%'};return _0x257222;})});}_0x19149d=_[_0xdbe5('0x3c')]({},_0x19149d,_0x441b7a['options']);return _0xa4ffd3[_0xdbe5('0x4f')](_0x19149d);}})[_0xdbe5('0x3f')](function(_0x4c7306){if(_0x4c7306){_0x32b13f=_0x4c7306[_0xdbe5('0x35')];if(!_0x441b7a['query'][_0xdbe5('0x36')]('nolimit')){_0x19149d[_0xdbe5('0x1d')]=qs[_0xdbe5('0x1d')](_0x441b7a['query'][_0xdbe5('0x1d')]);_0x19149d[_0xdbe5('0x1b')]=qs[_0xdbe5('0x1b')](_0x441b7a[_0xdbe5('0x2f')][_0xdbe5('0x1b')]);}return _0xa4ffd3['getDescriptions'](_0x19149d);}})[_0xdbe5('0x3f')](function(_0x417b68){if(_0x417b68){return _0x417b68?{'count':_0x32b13f,'rows':_0x417b68}:null;}})[_0xdbe5('0x3f')](respondWithResult(_0x325595,null))[_0xdbe5('0x43')](handleError(_0x325595,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 57e7c0e..c9bc4ec 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 _0x8344=['request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','lodash','../../config/logger','moment','bluebird'];(function(_0x1b2d0a,_0x255ade){var _0x5c1952=function(_0x4776b5){while(--_0x4776b5){_0x1b2d0a['push'](_0x1b2d0a['shift']());}};_0x5c1952(++_0x255ade);}(_0x8344,0xc2));var _0x4834=function(_0x5aee5d,_0x1837d7){_0x5aee5d=_0x5aee5d-0x0;var _0x424683=_0x8344[_0x5aee5d];return _0x424683;};'use strict';var _=require(_0x4834('0x0'));var util=require('util');var logger=require(_0x4834('0x1'))('api');var moment=require(_0x4834('0x2'));var BPromise=require(_0x4834('0x3'));var rp=require(_0x4834('0x4'));var fs=require('fs');var path=require(_0x4834('0x5'));var rimraf=require(_0x4834('0x6'));var config=require(_0x4834('0x7'));var attributes=require(_0x4834('0x8'));module[_0x4834('0x9')]=function(_0x103df0,_0x109fb8){return _0x103df0['define'](_0x4834('0xa'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c7b=['request-promise','path','rimraf','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','../../config/logger','moment','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4c7b,0x18d));var _0xb4c7=function(_0x5a6c17,_0x4d4825){_0x5a6c17=_0x5a6c17-0x0;var _0x746f28=_0x4c7b[_0x5a6c17];return _0x746f28;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb4c7('0x0'))('api');var moment=require(_0xb4c7('0x1'));var BPromise=require(_0xb4c7('0x2'));var rp=require(_0xb4c7('0x3'));var fs=require('fs');var path=require(_0xb4c7('0x4'));var rimraf=require(_0xb4c7('0x5'));var config=require('../../config/environment');var attributes=require(_0xb4c7('0x6'));module['exports']=function(_0x317f31,_0x46a4e1){return _0x317f31[_0xb4c7('0x7')](_0xb4c7('0x8'),attributes,{'tableName':_0xb4c7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 93dc81c..8690461 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 _0x0e9f=['util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x44b827,_0x1bb1aa){var _0x527342=function(_0x481338){while(--_0x481338){_0x44b827['push'](_0x44b827['shift']());}};_0x527342(++_0x1bb1aa);}(_0x0e9f,0xf7));var _0xf0e9=function(_0x3c3e8e,_0x3a9f14){_0x3c3e8e=_0x3c3e8e-0x0;var _0x224ee1=_0x0e9f[_0x3c3e8e];return _0x224ee1;};'use strict';var _=require('lodash');var util=require(_0xf0e9('0x0'));var moment=require('moment');var BPromise=require(_0xf0e9('0x1'));var rs=require(_0xf0e9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf0e9('0x3'));var logger=require(_0xf0e9('0x4'))(_0xf0e9('0x5'));var config=require(_0xf0e9('0x6'));var jayson=require(_0xf0e9('0x7'));var client=jayson['client'][_0xf0e9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3895ba,_0x29d14a,_0x4261db){return new BPromise(function(_0x2ab744,_0x26207f){return client[_0xf0e9('0x9')](_0x3895ba,_0x4261db)[_0xf0e9('0xa')](function(_0x19d1e4){logger['info'](_0xf0e9('0xb'),_0x29d14a,_0xf0e9('0xc'));logger['debug'](_0xf0e9('0xd'),_0x29d14a,_0xf0e9('0xc'),JSON[_0xf0e9('0xe')](_0x19d1e4));if(_0x19d1e4['error']){if(_0x19d1e4[_0xf0e9('0xf')]['code']===0x1f4){logger[_0xf0e9('0xf')](_0xf0e9('0xb'),_0x29d14a,_0x19d1e4[_0xf0e9('0xf')][_0xf0e9('0x10')]);return _0x26207f(_0x19d1e4[_0xf0e9('0xf')][_0xf0e9('0x10')]);}logger[_0xf0e9('0xf')](_0xf0e9('0xb'),_0x29d14a,_0x19d1e4[_0xf0e9('0xf')][_0xf0e9('0x10')]);return _0x2ab744(_0x19d1e4[_0xf0e9('0xf')][_0xf0e9('0x10')]);}else{logger['info'](_0xf0e9('0xb'),_0x29d14a,'request\x20sent');_0x2ab744(_0x19d1e4[_0xf0e9('0x11')][_0xf0e9('0x10')]);}})[_0xf0e9('0x12')](function(_0x53bdb8){logger['error'](_0xf0e9('0xb'),_0x29d14a,_0x53bdb8);_0x26207f(_0x53bdb8);});});} \ No newline at end of file +var _0xbe10=['http','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x45c0fe,_0x499297){var _0x1c4d53=function(_0x2c0aad){while(--_0x2c0aad){_0x45c0fe['push'](_0x45c0fe['shift']());}};_0x1c4d53(++_0x499297);}(_0xbe10,0x1d8));var _0x0be1=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xbe10[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x0be1('0x0'));var util=require(_0x0be1('0x1'));var moment=require(_0x0be1('0x2'));var BPromise=require(_0x0be1('0x3'));var rs=require(_0x0be1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0be1('0x5'))['db'];var utils=require(_0x0be1('0x6'));var logger=require(_0x0be1('0x7'))('rpc');var config=require(_0x0be1('0x8'));var jayson=require(_0x0be1('0x9'));var client=jayson[_0x0be1('0xa')][_0x0be1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14873c,_0x2f2a47,_0x18c4d6){return new BPromise(function(_0x4869cd,_0x1e494){return client[_0x0be1('0xc')](_0x14873c,_0x18c4d6)[_0x0be1('0xd')](function(_0x350dae){logger['info'](_0x0be1('0xe'),_0x2f2a47,_0x0be1('0xf'));logger['debug'](_0x0be1('0x10'),_0x2f2a47,_0x0be1('0xf'),JSON[_0x0be1('0x11')](_0x350dae));if(_0x350dae[_0x0be1('0x12')]){if(_0x350dae[_0x0be1('0x12')]['code']===0x1f4){logger[_0x0be1('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x2f2a47,_0x350dae['error']['message']);return _0x1e494(_0x350dae['error'][_0x0be1('0x13')]);}logger[_0x0be1('0x12')](_0x0be1('0xe'),_0x2f2a47,_0x350dae[_0x0be1('0x12')][_0x0be1('0x13')]);return _0x4869cd(_0x350dae['error']['message']);}else{logger[_0x0be1('0x14')](_0x0be1('0xe'),_0x2f2a47,_0x0be1('0xf'));_0x4869cd(_0x350dae[_0x0be1('0x15')]['message']);}})[_0x0be1('0x16')](function(_0x4c5c6f){logger[_0x0be1('0x12')](_0x0be1('0xe'),_0x2f2a47,_0x4c5c6f);_0x1e494(_0x4c5c6f);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 2fc5c40..9bb509a 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 _0xdb98=['../../config/environment','isAuthenticated','index','get','show','post','create','put','/:id','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x56836c,_0x8ad1fc){var _0x1c9340=function(_0x51d5b0){while(--_0x51d5b0){_0x56836c['push'](_0x56836c['shift']());}};_0x1c9340(++_0x8ad1fc);}(_0xdb98,0x173));var _0x8db9=function(_0x2220fd,_0x3b90c8){_0x2220fd=_0x2220fd-0x0;var _0xd43610=_0xdb98[_0x2220fd];return _0xd43610;};'use strict';var multer=require(_0x8db9('0x0'));var util=require(_0x8db9('0x1'));var path=require('path');var timeout=require(_0x8db9('0x2'));var express=require('express');var router=express[_0x8db9('0x3')]();var fs_extra=require(_0x8db9('0x4'));var auth=require(_0x8db9('0x5'));var interaction=require(_0x8db9('0x6'));var config=require(_0x8db9('0x7'));var controller=require('./intVtigerField.controller');router['get']('/',auth[_0x8db9('0x8')](),controller[_0x8db9('0x9')]);router[_0x8db9('0xa')]('/:id',auth[_0x8db9('0x8')](),controller[_0x8db9('0xb')]);router[_0x8db9('0xc')]('/',auth[_0x8db9('0x8')](),controller[_0x8db9('0xd')]);router[_0x8db9('0xe')](_0x8db9('0xf'),auth[_0x8db9('0x8')](),controller['update']);router[_0x8db9('0x10')](_0x8db9('0xf'),auth['isAuthenticated'](),controller[_0x8db9('0x11')]);module['exports']=router; \ No newline at end of file +var _0x74ba=['destroy','exports','util','express','../../components/auth/service','./intVtigerField.controller','isAuthenticated','index','/:id','show','create','put','update','delete'];(function(_0x2dc8ca,_0x34e003){var _0x36adf9=function(_0x5ba5d7){while(--_0x5ba5d7){_0x2dc8ca['push'](_0x2dc8ca['shift']());}};_0x36adf9(++_0x34e003);}(_0x74ba,0x136));var _0xa74b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x74ba[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0xa74b('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa74b('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa74b('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa74b('0x3'));router['get']('/',auth[_0xa74b('0x4')](),controller[_0xa74b('0x5')]);router['get'](_0xa74b('0x6'),auth[_0xa74b('0x4')](),controller[_0xa74b('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa74b('0x8')]);router[_0xa74b('0x9')](_0xa74b('0x6'),auth[_0xa74b('0x4')](),controller[_0xa74b('0xa')]);router[_0xa74b('0xb')]('/:id',auth[_0xa74b('0x4')](),controller[_0xa74b('0xc')]);module[_0xa74b('0xd')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 876b5ac..e80116b 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 _0x9855=['picklist','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue'];(function(_0x4e1d3c,_0x4f9988){var _0x5177b2=function(_0x26109f){while(--_0x26109f){_0x4e1d3c['push'](_0x4e1d3c['shift']());}};_0x5177b2(++_0x4f9988);}(_0x9855,0xcc));var _0x5985=function(_0x52dfb0,_0x5e04cf){_0x52dfb0=_0x52dfb0-0x0;var _0x530e49=_0x9855[_0x52dfb0];return _0x530e49;};'use strict';var Sequelize=require(_0x5985('0x0'));module[_0x5985('0x1')]={'type':{'type':Sequelize['ENUM'](_0x5985('0x2'),_0x5985('0x3'),_0x5985('0x4'),_0x5985('0x5'),_0x5985('0x6')),'defaultValue':_0x5985('0x2')},'content':{'type':Sequelize[_0x5985('0x7')]},'key':{'type':Sequelize[_0x5985('0x7')]},'keyType':{'type':Sequelize[_0x5985('0x8')](_0x5985('0x2'),_0x5985('0x3'),_0x5985('0x4'))},'keyContent':{'type':Sequelize[_0x5985('0x7')]},'idField':{'type':Sequelize[_0x5985('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5985('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5985('0x7')]}}; \ No newline at end of file +var _0x1ae4=['string','customVariable','keyValue','STRING','variable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x55ff79,_0x3d45e7){var _0x579067=function(_0x3650e4){while(--_0x3650e4){_0x55ff79['push'](_0x55ff79['shift']());}};_0x579067(++_0x3d45e7);}(_0x1ae4,0x96));var _0x41ae=function(_0x4b40c8,_0x368ec3){_0x4b40c8=_0x4b40c8-0x0;var _0x566ec3=_0x1ae4[_0x4b40c8];return _0x566ec3;};'use strict';var Sequelize=require(_0x41ae('0x0'));module[_0x41ae('0x1')]={'type':{'type':Sequelize[_0x41ae('0x2')](_0x41ae('0x3'),'variable',_0x41ae('0x4'),_0x41ae('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x41ae('0x6')]},'key':{'type':Sequelize[_0x41ae('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x41ae('0x7'),_0x41ae('0x4'))},'keyContent':{'type':Sequelize[_0x41ae('0x6')]},'idField':{'type':Sequelize[_0x41ae('0x6')]},'nameField':{'type':Sequelize[_0x41ae('0x6')]},'customField':{'type':Sequelize[_0x41ae('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 8569927..cc78598 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 _0x08eb=['util','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','json','apply','update','then','destroy','sendStatus','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','merge','where','VIRTUAL','findAll','rows','params','intersection','includeAll','include','find','catch','create','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x08eb,0x167));var _0xb08e=function(_0x3aeea7,_0x557c79){_0x3aeea7=_0x3aeea7-0x0;var _0x4e5d12=_0x08eb[_0x3aeea7];return _0x4e5d12;};'use strict';var emlformat=require(_0xb08e('0x0'));var rimraf=require(_0xb08e('0x1'));var zipdir=require(_0xb08e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb08e('0x3'));var BPromise=require(_0xb08e('0x4'));var Mustache=require(_0xb08e('0x5'));var util=require(_0xb08e('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb08e('0x7'));var fs=require('fs');var fs_extra=require(_0xb08e('0x8'));var _=require(_0xb08e('0x9'));var squel=require(_0xb08e('0xa'));var crypto=require('crypto');var jsforce=require(_0xb08e('0xb'));var deskjs=require(_0xb08e('0xc'));var toCsv=require(_0xb08e('0xd'));var querystring=require(_0xb08e('0xe'));var Papa=require(_0xb08e('0xf'));var Redis=require(_0xb08e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb08e('0x11'));var as=require(_0xb08e('0x12'));var hardwareService=require(_0xb08e('0x13'));var logger=require(_0xb08e('0x14'))(_0xb08e('0x15'));var utils=require('../../config/utils');var config=require(_0xb08e('0x16'));var licenseUtil=require(_0xb08e('0x17'));var db=require(_0xb08e('0x18'))['db'];function respondWithStatusCode(_0x86e7ea,_0x2a7453){_0x2a7453=_0x2a7453||0xcc;return function(_0xd65f02){if(_0xd65f02){return _0x86e7ea['sendStatus'](_0x2a7453);}return _0x86e7ea[_0xb08e('0x19')](_0x2a7453)[_0xb08e('0x1a')]();};}function respondWithResult(_0x34a419,_0x374aae){_0x374aae=_0x374aae||0xc8;return function(_0x193d4a){if(_0x193d4a){return _0x34a419[_0xb08e('0x19')](_0x374aae)['json'](_0x193d4a);}};}function respondWithFilteredResult(_0x27d00d,_0x2fdee5){return function(_0x5210b8){if(_0x5210b8){var _0x40aaaa=typeof _0x2fdee5[_0xb08e('0x1b')]===_0xb08e('0x1c')&&typeof _0x2fdee5[_0xb08e('0x1d')]===_0xb08e('0x1c');var _0x1af902=_0x5210b8[_0xb08e('0x1e')];var _0x5a36f1=_0x40aaaa?0x0:_0x2fdee5[_0xb08e('0x1b')];var _0x9ccc53=_0x40aaaa?_0x5210b8[_0xb08e('0x1e')]:_0x2fdee5[_0xb08e('0x1b')]+_0x2fdee5['limit'];var _0xd6ea5e;if(_0x9ccc53>=_0x1af902){_0x9ccc53=_0x1af902;_0xd6ea5e=0xc8;}else{_0xd6ea5e=0xce;}_0x27d00d[_0xb08e('0x19')](_0xd6ea5e);return _0x27d00d['set'](_0xb08e('0x1f'),_0x5a36f1+'-'+_0x9ccc53+'/'+_0x1af902)[_0xb08e('0x20')](_0x5210b8);}return null;};}function patchUpdates(_0xfb79a){return function(_0x5d59dd){try{jsonpatch[_0xb08e('0x21')](_0x5d59dd,_0xfb79a,!![]);}catch(_0x34ee2e){return BPromise['reject'](_0x34ee2e);}return _0x5d59dd['save']();};}function saveUpdates(_0x5e51e4,_0x2a22db){return function(_0x4d9510){if(_0x4d9510){return _0x4d9510[_0xb08e('0x22')](_0x5e51e4)[_0xb08e('0x23')](function(_0x412076){return _0x412076;});}return null;};}function removeEntity(_0x12bb44,_0x3ee16c){return function(_0x2dc17a){if(_0x2dc17a){return _0x2dc17a[_0xb08e('0x24')]()[_0xb08e('0x23')](function(){_0x12bb44[_0xb08e('0x19')](0xcc)[_0xb08e('0x1a')]();});}};}function handleEntityNotFound(_0x243cb6,_0xab4c1a){return function(_0x2cf958){if(!_0x2cf958){_0x243cb6[_0xb08e('0x25')](0x194);}return _0x2cf958;};}function handleError(_0x2ea450,_0xdc16aa){_0xdc16aa=_0xdc16aa||0x1f4;return function(_0x5d9a8e){logger[_0xb08e('0x26')](_0x5d9a8e[_0xb08e('0x27')]);if(_0x5d9a8e[_0xb08e('0x28')]){delete _0x5d9a8e[_0xb08e('0x28')];}_0x2ea450[_0xb08e('0x19')](_0xdc16aa)[_0xb08e('0x29')](_0x5d9a8e);};}exports[_0xb08e('0x2a')]=function(_0x1fad3a,_0x313e62){var _0xea65fb={},_0x200b39={},_0xeeb5c9={'count':0x0,'rows':[]};var _0x712cc0=_[_0xb08e('0x2b')](db[_0xb08e('0x2c')][_0xb08e('0x2d')],function(_0x4e7d91){return{'name':_0x4e7d91[_0xb08e('0x2e')],'type':_0x4e7d91[_0xb08e('0x2f')]['key']};});_0x200b39['model']=_[_0xb08e('0x2b')](_0x712cc0,_0xb08e('0x28'));_0x200b39[_0xb08e('0x30')]=_[_0xb08e('0x31')](_0x1fad3a[_0xb08e('0x30')]);_0x200b39['filters']=_['intersection'](_0x200b39[_0xb08e('0x32')],_0x200b39[_0xb08e('0x30')]);_0xea65fb[_0xb08e('0x33')]=_['intersection'](_0x200b39[_0xb08e('0x32')],qs[_0xb08e('0x34')](_0x1fad3a[_0xb08e('0x30')][_0xb08e('0x34')]));_0xea65fb[_0xb08e('0x33')]=_0xea65fb[_0xb08e('0x33')][_0xb08e('0x35')]?_0xea65fb[_0xb08e('0x33')]:_0x200b39[_0xb08e('0x32')];if(!_0x1fad3a['query'][_0xb08e('0x36')](_0xb08e('0x37'))){_0xea65fb[_0xb08e('0x1d')]=qs[_0xb08e('0x1d')](_0x1fad3a['query'][_0xb08e('0x1d')]);_0xea65fb[_0xb08e('0x1b')]=qs[_0xb08e('0x1b')](_0x1fad3a[_0xb08e('0x30')]['offset']);}_0xea65fb['order']=qs[_0xb08e('0x38')](_0x1fad3a[_0xb08e('0x30')]['sort']);_0xea65fb['where']=qs[_0xb08e('0x39')](_[_0xb08e('0x3a')](_0x1fad3a[_0xb08e('0x30')],_0x200b39[_0xb08e('0x39')]),_0x712cc0);if(_0x1fad3a['query'][_0xb08e('0x3b')]){_0xea65fb['where']=_[_0xb08e('0x3c')](_0xea65fb[_0xb08e('0x3d')],{'$or':_['map'](_0x712cc0,function(_0x47e2c3){if(_0x47e2c3[_0xb08e('0x2f')]!==_0xb08e('0x3e')){var _0x52c34c={};_0x52c34c[_0x47e2c3[_0xb08e('0x28')]]={'$like':'%'+_0x1fad3a['query'][_0xb08e('0x3b')]+'%'};return _0x52c34c;}})});}_0xea65fb=_[_0xb08e('0x3c')]({},_0xea65fb,_0x1fad3a['options']);var _0x5af88a={'where':_0xea65fb[_0xb08e('0x3d')]};return db[_0xb08e('0x2c')][_0xb08e('0x1e')](_0x5af88a)[_0xb08e('0x23')](function(_0x3850c6){_0xeeb5c9['count']=_0x3850c6;if(_0x1fad3a[_0xb08e('0x30')]['includeAll']){_0xea65fb['include']=[{'all':!![]}];}return db[_0xb08e('0x2c')][_0xb08e('0x3f')](_0xea65fb);})[_0xb08e('0x23')](function(_0x37042d){_0xeeb5c9[_0xb08e('0x40')]=_0x37042d;return _0xeeb5c9;})[_0xb08e('0x23')](respondWithFilteredResult(_0x313e62,_0xea65fb))['catch'](handleError(_0x313e62,null));};exports['show']=function(_0x5dd108,_0x37d89b){var _0x35ff3a={'raw':!![],'where':{'id':_0x5dd108[_0xb08e('0x41')]['id']}},_0x26a2e0={};_0x26a2e0[_0xb08e('0x32')]=_[_0xb08e('0x31')](db['VtigerField']['rawAttributes']);_0x26a2e0['query']=_[_0xb08e('0x31')](_0x5dd108['query']);_0x26a2e0[_0xb08e('0x39')]=_[_0xb08e('0x42')](_0x26a2e0[_0xb08e('0x32')],_0x26a2e0[_0xb08e('0x30')]);_0x35ff3a[_0xb08e('0x33')]=_[_0xb08e('0x42')](_0x26a2e0[_0xb08e('0x32')],qs[_0xb08e('0x34')](_0x5dd108[_0xb08e('0x30')][_0xb08e('0x34')]));_0x35ff3a[_0xb08e('0x33')]=_0x35ff3a['attributes']['length']?_0x35ff3a[_0xb08e('0x33')]:_0x26a2e0[_0xb08e('0x32')];if(_0x5dd108[_0xb08e('0x30')][_0xb08e('0x43')]){_0x35ff3a[_0xb08e('0x44')]=[{'all':!![]}];}_0x35ff3a=_[_0xb08e('0x3c')]({},_0x35ff3a,_0x5dd108['options']);return db[_0xb08e('0x2c')][_0xb08e('0x45')](_0x35ff3a)['then'](handleEntityNotFound(_0x37d89b,null))['then'](respondWithResult(_0x37d89b,null))[_0xb08e('0x46')](handleError(_0x37d89b,null));};exports[_0xb08e('0x47')]=function(_0x55510b,_0x1df180){return db[_0xb08e('0x2c')][_0xb08e('0x47')](_0x55510b['body'],{})['then'](respondWithResult(_0x1df180,0xc9))[_0xb08e('0x46')](handleError(_0x1df180,null));};exports[_0xb08e('0x22')]=function(_0x962627,_0x30b64c){if(_0x962627['body']['id']){delete _0x962627['body']['id'];}return db[_0xb08e('0x2c')]['find']({'where':{'id':_0x962627[_0xb08e('0x41')]['id']}})[_0xb08e('0x23')](handleEntityNotFound(_0x30b64c,null))[_0xb08e('0x23')](saveUpdates(_0x962627[_0xb08e('0x48')],null))[_0xb08e('0x23')](respondWithResult(_0x30b64c,null))[_0xb08e('0x46')](handleError(_0x30b64c,null));};exports[_0xb08e('0x24')]=function(_0x2605b0,_0x215865){return db[_0xb08e('0x2c')]['find']({'where':{'id':_0x2605b0['params']['id']}})[_0xb08e('0x23')](handleEntityNotFound(_0x215865,null))[_0xb08e('0x23')](removeEntity(_0x215865,null))[_0xb08e('0x46')](handleError(_0x215865,null));}; \ No newline at end of file +var _0x3fd7=['eml-format','rimraf','zip-dir','moment','bluebird','util','ejs','fs-extra','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','then','error','stack','name','send','index','map','VtigerField','fieldName','type','key','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','include','findAll','rows','catch','params','model','rawAttributes','length','includeAll','options','create','body','update','find'];(function(_0xe15270,_0x227d06){var _0x1e813b=function(_0x1d590d){while(--_0x1d590d){_0xe15270['push'](_0xe15270['shift']());}};_0x1e813b(++_0x227d06);}(_0x3fd7,0x1a4));var _0x73fd=function(_0x132706,_0x190447){_0x132706=_0x132706-0x0;var _0x4c37cc=_0x3fd7[_0x132706];return _0x4c37cc;};'use strict';var emlformat=require(_0x73fd('0x0'));var rimraf=require(_0x73fd('0x1'));var zipdir=require(_0x73fd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x73fd('0x3'));var BPromise=require(_0x73fd('0x4'));var Mustache=require('mustache');var util=require(_0x73fd('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x73fd('0x6'));var fs=require('fs');var fs_extra=require(_0x73fd('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x73fd('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x73fd('0x9'));var querystring=require('querystring');var Papa=require(_0x73fd('0xa'));var Redis=require(_0x73fd('0xb'));var authService=require(_0x73fd('0xc'));var qs=require(_0x73fd('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x73fd('0xe'));var logger=require(_0x73fd('0xf'))(_0x73fd('0x10'));var utils=require(_0x73fd('0x11'));var config=require(_0x73fd('0x12'));var licenseUtil=require(_0x73fd('0x13'));var db=require(_0x73fd('0x14'))['db'];function respondWithStatusCode(_0x3cca22,_0x761424){_0x761424=_0x761424||0xcc;return function(_0x74c218){if(_0x74c218){return _0x3cca22[_0x73fd('0x15')](_0x761424);}return _0x3cca22['status'](_0x761424)[_0x73fd('0x16')]();};}function respondWithResult(_0x51236c,_0x4b88da){_0x4b88da=_0x4b88da||0xc8;return function(_0x2349dd){if(_0x2349dd){return _0x51236c[_0x73fd('0x17')](_0x4b88da)[_0x73fd('0x18')](_0x2349dd);}};}function respondWithFilteredResult(_0x4d7b31,_0x2375bc){return function(_0x59cf29){if(_0x59cf29){var _0x238de7=typeof _0x2375bc[_0x73fd('0x19')]===_0x73fd('0x1a')&&typeof _0x2375bc[_0x73fd('0x1b')]==='undefined';var _0x2b5c0d=_0x59cf29[_0x73fd('0x1c')];var _0x1108a7=_0x238de7?0x0:_0x2375bc['offset'];var _0x48a164=_0x238de7?_0x59cf29[_0x73fd('0x1c')]:_0x2375bc['offset']+_0x2375bc[_0x73fd('0x1b')];var _0x1d5e4b;if(_0x48a164>=_0x2b5c0d){_0x48a164=_0x2b5c0d;_0x1d5e4b=0xc8;}else{_0x1d5e4b=0xce;}_0x4d7b31[_0x73fd('0x17')](_0x1d5e4b);return _0x4d7b31[_0x73fd('0x1d')](_0x73fd('0x1e'),_0x1108a7+'-'+_0x48a164+'/'+_0x2b5c0d)[_0x73fd('0x18')](_0x59cf29);}return null;};}function patchUpdates(_0x3f66f2){return function(_0x142c4d){try{jsonpatch['apply'](_0x142c4d,_0x3f66f2,!![]);}catch(_0x4ad95d){return BPromise['reject'](_0x4ad95d);}return _0x142c4d['save']();};}function saveUpdates(_0x21d8d0,_0x320acf){return function(_0x4ba13e){if(_0x4ba13e){return _0x4ba13e['update'](_0x21d8d0)['then'](function(_0x4b07b1){return _0x4b07b1;});}return null;};}function removeEntity(_0x2f9b3b,_0x51db9b){return function(_0x12cc02){if(_0x12cc02){return _0x12cc02['destroy']()[_0x73fd('0x1f')](function(){_0x2f9b3b[_0x73fd('0x17')](0xcc)[_0x73fd('0x16')]();});}};}function handleEntityNotFound(_0x1ad034,_0x3a99f6){return function(_0x570487){if(!_0x570487){_0x1ad034[_0x73fd('0x15')](0x194);}return _0x570487;};}function handleError(_0x1731ca,_0x2e7274){_0x2e7274=_0x2e7274||0x1f4;return function(_0x453ea6){logger[_0x73fd('0x20')](_0x453ea6[_0x73fd('0x21')]);if(_0x453ea6[_0x73fd('0x22')]){delete _0x453ea6[_0x73fd('0x22')];}_0x1731ca['status'](_0x2e7274)[_0x73fd('0x23')](_0x453ea6);};}exports[_0x73fd('0x24')]=function(_0x10897f,_0x258b53){var _0xcf82ae={},_0x2fcebf={},_0x26891d={'count':0x0,'rows':[]};var _0xee3ab7=_[_0x73fd('0x25')](db[_0x73fd('0x26')]['rawAttributes'],function(_0x57b040){return{'name':_0x57b040[_0x73fd('0x27')],'type':_0x57b040[_0x73fd('0x28')][_0x73fd('0x29')]};});_0x2fcebf['model']=_[_0x73fd('0x25')](_0xee3ab7,_0x73fd('0x22'));_0x2fcebf[_0x73fd('0x2a')]=_[_0x73fd('0x2b')](_0x10897f[_0x73fd('0x2a')]);_0x2fcebf['filters']=_[_0x73fd('0x2c')](_0x2fcebf['model'],_0x2fcebf[_0x73fd('0x2a')]);_0xcf82ae[_0x73fd('0x2d')]=_[_0x73fd('0x2c')](_0x2fcebf['model'],qs[_0x73fd('0x2e')](_0x10897f['query']['fields']));_0xcf82ae[_0x73fd('0x2d')]=_0xcf82ae['attributes']['length']?_0xcf82ae[_0x73fd('0x2d')]:_0x2fcebf['model'];if(!_0x10897f[_0x73fd('0x2a')][_0x73fd('0x2f')](_0x73fd('0x30'))){_0xcf82ae[_0x73fd('0x1b')]=qs[_0x73fd('0x1b')](_0x10897f['query']['limit']);_0xcf82ae[_0x73fd('0x19')]=qs['offset'](_0x10897f[_0x73fd('0x2a')][_0x73fd('0x19')]);}_0xcf82ae[_0x73fd('0x31')]=qs[_0x73fd('0x32')](_0x10897f['query'][_0x73fd('0x32')]);_0xcf82ae[_0x73fd('0x33')]=qs[_0x73fd('0x34')](_[_0x73fd('0x35')](_0x10897f[_0x73fd('0x2a')],_0x2fcebf['filters']),_0xee3ab7);if(_0x10897f[_0x73fd('0x2a')][_0x73fd('0x36')]){_0xcf82ae['where']=_[_0x73fd('0x37')](_0xcf82ae['where'],{'$or':_[_0x73fd('0x25')](_0xee3ab7,function(_0x5a0957){if(_0x5a0957[_0x73fd('0x28')]!=='VIRTUAL'){var _0x5efd9d={};_0x5efd9d[_0x5a0957[_0x73fd('0x22')]]={'$like':'%'+_0x10897f[_0x73fd('0x2a')][_0x73fd('0x36')]+'%'};return _0x5efd9d;}})});}_0xcf82ae=_[_0x73fd('0x37')]({},_0xcf82ae,_0x10897f['options']);var _0x399fab={'where':_0xcf82ae[_0x73fd('0x33')]};return db[_0x73fd('0x26')][_0x73fd('0x1c')](_0x399fab)[_0x73fd('0x1f')](function(_0x3155f3){_0x26891d[_0x73fd('0x1c')]=_0x3155f3;if(_0x10897f[_0x73fd('0x2a')]['includeAll']){_0xcf82ae[_0x73fd('0x38')]=[{'all':!![]}];}return db[_0x73fd('0x26')][_0x73fd('0x39')](_0xcf82ae);})[_0x73fd('0x1f')](function(_0x143a23){_0x26891d[_0x73fd('0x3a')]=_0x143a23;return _0x26891d;})['then'](respondWithFilteredResult(_0x258b53,_0xcf82ae))[_0x73fd('0x3b')](handleError(_0x258b53,null));};exports['show']=function(_0x41713a,_0x33e762){var _0x5433d3={'raw':!![],'where':{'id':_0x41713a[_0x73fd('0x3c')]['id']}},_0x1ea0a8={};_0x1ea0a8[_0x73fd('0x3d')]=_['keys'](db[_0x73fd('0x26')][_0x73fd('0x3e')]);_0x1ea0a8[_0x73fd('0x2a')]=_[_0x73fd('0x2b')](_0x41713a['query']);_0x1ea0a8['filters']=_[_0x73fd('0x2c')](_0x1ea0a8[_0x73fd('0x3d')],_0x1ea0a8['query']);_0x5433d3[_0x73fd('0x2d')]=_[_0x73fd('0x2c')](_0x1ea0a8[_0x73fd('0x3d')],qs['fields'](_0x41713a['query'][_0x73fd('0x2e')]));_0x5433d3[_0x73fd('0x2d')]=_0x5433d3[_0x73fd('0x2d')][_0x73fd('0x3f')]?_0x5433d3[_0x73fd('0x2d')]:_0x1ea0a8[_0x73fd('0x3d')];if(_0x41713a[_0x73fd('0x2a')][_0x73fd('0x40')]){_0x5433d3[_0x73fd('0x38')]=[{'all':!![]}];}_0x5433d3=_[_0x73fd('0x37')]({},_0x5433d3,_0x41713a[_0x73fd('0x41')]);return db['VtigerField']['find'](_0x5433d3)[_0x73fd('0x1f')](handleEntityNotFound(_0x33e762,null))[_0x73fd('0x1f')](respondWithResult(_0x33e762,null))['catch'](handleError(_0x33e762,null));};exports[_0x73fd('0x42')]=function(_0x5db6c5,_0x5eeb24){return db[_0x73fd('0x26')][_0x73fd('0x42')](_0x5db6c5[_0x73fd('0x43')],{})[_0x73fd('0x1f')](respondWithResult(_0x5eeb24,0xc9))[_0x73fd('0x3b')](handleError(_0x5eeb24,null));};exports[_0x73fd('0x44')]=function(_0xed245c,_0x863a8b){if(_0xed245c[_0x73fd('0x43')]['id']){delete _0xed245c[_0x73fd('0x43')]['id'];}return db[_0x73fd('0x26')]['find']({'where':{'id':_0xed245c[_0x73fd('0x3c')]['id']}})[_0x73fd('0x1f')](handleEntityNotFound(_0x863a8b,null))['then'](saveUpdates(_0xed245c[_0x73fd('0x43')],null))[_0x73fd('0x1f')](respondWithResult(_0x863a8b,null))[_0x73fd('0x3b')](handleError(_0x863a8b,null));};exports['destroy']=function(_0x16f6aa,_0x9daa53){return db[_0x73fd('0x26')][_0x73fd('0x45')]({'where':{'id':_0x16f6aa[_0x73fd('0x3c')]['id']}})[_0x73fd('0x1f')](handleEntityNotFound(_0x9daa53,null))[_0x73fd('0x1f')](removeEntity(_0x9daa53,null))[_0x73fd('0x3b')](handleError(_0x9daa53,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 20cb761..2a15627 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 _0x94f8=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','vtiger_unique_index','FieldId','util','../../config/logger'];(function(_0x5bfa44,_0x76dacc){var _0x43815f=function(_0x307fca){while(--_0x307fca){_0x5bfa44['push'](_0x5bfa44['shift']());}};_0x43815f(++_0x76dacc);}(_0x94f8,0x1ae));var _0x894f=function(_0x520c24,_0x3fb9af){_0x520c24=_0x520c24-0x0;var _0x377104=_0x94f8[_0x520c24];return _0x377104;};'use strict';var _=require('lodash');var util=require(_0x894f('0x0'));var logger=require(_0x894f('0x1'))(_0x894f('0x2'));var moment=require(_0x894f('0x3'));var BPromise=require(_0x894f('0x4'));var rp=require(_0x894f('0x5'));var fs=require('fs');var path=require(_0x894f('0x6'));var rimraf=require(_0x894f('0x7'));var config=require(_0x894f('0x8'));var attributes=require('./intVtigerField.attributes');module[_0x894f('0x9')]=function(_0x146fc8,_0x434d6d){return _0x146fc8['define']('VtigerField',attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x894f('0xa'),'fields':['idField',_0x894f('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2be2=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields'];(function(_0x1d4203,_0x170e2b){var _0x33b21b=function(_0x3c9905){while(--_0x3c9905){_0x1d4203['push'](_0x1d4203['shift']());}};_0x33b21b(++_0x170e2b);}(_0x2be2,0x82));var _0x22be=function(_0x49a199,_0x169bae){_0x49a199=_0x49a199-0x0;var _0x20aaf7=_0x2be2[_0x49a199];return _0x20aaf7;};'use strict';var _=require(_0x22be('0x0'));var util=require(_0x22be('0x1'));var logger=require(_0x22be('0x2'))(_0x22be('0x3'));var moment=require('moment');var BPromise=require(_0x22be('0x4'));var rp=require(_0x22be('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22be('0x6'));var config=require(_0x22be('0x7'));var attributes=require(_0x22be('0x8'));module[_0x22be('0x9')]=function(_0x16de65,_0x52d27b){return _0x16de65[_0x22be('0xa')](_0x22be('0xb'),attributes,{'tableName':_0x22be('0xc'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index fc28268..2b868be 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 _0x0d2a=['VtigerField,\x20%s,\x20%s','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0x10edba,_0x16051e){var _0x11d15b=function(_0x106caf){while(--_0x106caf){_0x10edba['push'](_0x10edba['shift']());}};_0x11d15b(++_0x16051e);}(_0x0d2a,0x1e6));var _0xa0d2=function(_0x3a0fa6,_0x486beb){_0x3a0fa6=_0x3a0fa6-0x0;var _0x240307=_0x0d2a[_0x3a0fa6];return _0x240307;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa0d2('0x0'));var BPromise=require(_0xa0d2('0x1'));var rs=require(_0xa0d2('0x2'));var fs=require('fs');var Redis=require(_0xa0d2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa0d2('0x4'));var logger=require(_0xa0d2('0x5'))(_0xa0d2('0x6'));var config=require(_0xa0d2('0x7'));var jayson=require(_0xa0d2('0x8'));var client=jayson[_0xa0d2('0x9')][_0xa0d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b8bc5,_0x586a64,_0x1fd15b){return new BPromise(function(_0x222209,_0x1b30a7){return client['request'](_0x1b8bc5,_0x1fd15b)[_0xa0d2('0xb')](function(_0x39e731){logger[_0xa0d2('0xc')]('VtigerField,\x20%s,\x20%s',_0x586a64,'request\x20sent');logger[_0xa0d2('0xd')](_0xa0d2('0xe'),_0x586a64,_0xa0d2('0xf'),JSON['stringify'](_0x39e731));if(_0x39e731[_0xa0d2('0x10')]){if(_0x39e731[_0xa0d2('0x10')]['code']===0x1f4){logger[_0xa0d2('0x10')]('VtigerField,\x20%s,\x20%s',_0x586a64,_0x39e731[_0xa0d2('0x10')][_0xa0d2('0x11')]);return _0x1b30a7(_0x39e731[_0xa0d2('0x10')][_0xa0d2('0x11')]);}logger[_0xa0d2('0x10')](_0xa0d2('0x12'),_0x586a64,_0x39e731[_0xa0d2('0x10')][_0xa0d2('0x11')]);return _0x222209(_0x39e731['error'][_0xa0d2('0x11')]);}else{logger[_0xa0d2('0xc')]('VtigerField,\x20%s,\x20%s',_0x586a64,_0xa0d2('0xf'));_0x222209(_0x39e731[_0xa0d2('0x13')][_0xa0d2('0x11')]);}})[_0xa0d2('0x14')](function(_0x23c2f9){logger[_0xa0d2('0x10')](_0xa0d2('0x12'),_0x586a64,_0x23c2f9);_0x1b30a7(_0x23c2f9);});});} \ No newline at end of file +var _0x9d09=['catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x12b107,_0x1df955){var _0x1026a6=function(_0x4768de){while(--_0x4768de){_0x12b107['push'](_0x12b107['shift']());}};_0x1026a6(++_0x1df955);}(_0x9d09,0x177));var _0x99d0=function(_0x3d7852,_0x4212eb){_0x3d7852=_0x3d7852-0x0;var _0x4585c5=_0x9d09[_0x3d7852];return _0x4585c5;};'use strict';var _=require('lodash');var util=require(_0x99d0('0x0'));var moment=require(_0x99d0('0x1'));var BPromise=require(_0x99d0('0x2'));var rs=require(_0x99d0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x99d0('0x4'))['db'];var utils=require(_0x99d0('0x5'));var logger=require(_0x99d0('0x6'))(_0x99d0('0x7'));var config=require('../../config/environment');var jayson=require(_0x99d0('0x8'));var client=jayson['client'][_0x99d0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5eaa8e,_0x525e4e,_0x26b03c){return new BPromise(function(_0x1f3437,_0x4e45f2){return client['request'](_0x5eaa8e,_0x26b03c)[_0x99d0('0xa')](function(_0x2ccc1b){logger[_0x99d0('0xb')](_0x99d0('0xc'),_0x525e4e,_0x99d0('0xd'));logger[_0x99d0('0xe')](_0x99d0('0xf'),_0x525e4e,_0x99d0('0xd'),JSON[_0x99d0('0x10')](_0x2ccc1b));if(_0x2ccc1b[_0x99d0('0x11')]){if(_0x2ccc1b['error'][_0x99d0('0x12')]===0x1f4){logger[_0x99d0('0x11')](_0x99d0('0xc'),_0x525e4e,_0x2ccc1b[_0x99d0('0x11')][_0x99d0('0x13')]);return _0x4e45f2(_0x2ccc1b[_0x99d0('0x11')][_0x99d0('0x13')]);}logger['error'](_0x99d0('0xc'),_0x525e4e,_0x2ccc1b[_0x99d0('0x11')][_0x99d0('0x13')]);return _0x1f3437(_0x2ccc1b[_0x99d0('0x11')][_0x99d0('0x13')]);}else{logger['info'](_0x99d0('0xc'),_0x525e4e,_0x99d0('0xd'));_0x1f3437(_0x2ccc1b[_0x99d0('0x14')][_0x99d0('0x13')]);}})[_0x99d0('0x15')](function(_0x52622b){logger[_0x99d0('0x11')](_0x99d0('0xc'),_0x525e4e,_0x52622b);_0x4e45f2(_0x52622b);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 40cb44f..6c944c5 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 _0x616f=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id'];(function(_0x2ce671,_0x58e39e){var _0x578a0b=function(_0x3ba3b0){while(--_0x3ba3b0){_0x2ce671['push'](_0x2ce671['shift']());}};_0x578a0b(++_0x58e39e);}(_0x616f,0xcb));var _0xf616=function(_0x484cac,_0x30ad3a){_0x484cac=_0x484cac-0x0;var _0x1d6e77=_0x616f[_0x484cac];return _0x1d6e77;};'use strict';var multer=require(_0xf616('0x0'));var util=require(_0xf616('0x1'));var path=require(_0xf616('0x2'));var timeout=require(_0xf616('0x3'));var express=require('express');var router=express[_0xf616('0x4')]();var fs_extra=require(_0xf616('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf616('0x6'));var config=require(_0xf616('0x7'));var controller=require(_0xf616('0x8'));router[_0xf616('0x9')]('/',auth['isAuthenticated'](),controller[_0xf616('0xa')]);router['get']('/:id',auth[_0xf616('0xb')](),controller[_0xf616('0xc')]);router['get'](_0xf616('0xd'),auth[_0xf616('0xb')](),controller[_0xf616('0xe')]);router[_0xf616('0x9')](_0xf616('0xf'),auth['isAuthenticated'](),controller[_0xf616('0x10')]);router[_0xf616('0x11')]('/',auth[_0xf616('0xb')](),controller[_0xf616('0x12')]);router[_0xf616('0x11')](_0xf616('0xd'),auth[_0xf616('0xb')](),controller[_0xf616('0x13')]);router[_0xf616('0x14')](_0xf616('0x15'),auth[_0xf616('0xb')](),controller['update']);router[_0xf616('0x16')]('/:id',auth[_0xf616('0xb')](),controller[_0xf616('0x17')]);module[_0xf616('0x18')]=router; \ No newline at end of file +var _0x0e31=['/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show'];(function(_0x24b245,_0x1b3508){var _0x56f828=function(_0x21752a){while(--_0x21752a){_0x24b245['push'](_0x24b245['shift']());}};_0x56f828(++_0x1b3508);}(_0x0e31,0xab));var _0x10e3=function(_0x3ceab8,_0x30486f){_0x3ceab8=_0x3ceab8-0x0;var _0x3e9fe3=_0x0e31[_0x3ceab8];return _0x3e9fe3;};'use strict';var multer=require(_0x10e3('0x0'));var util=require(_0x10e3('0x1'));var path=require(_0x10e3('0x2'));var timeout=require('connect-timeout');var express=require(_0x10e3('0x3'));var router=express['Router']();var fs_extra=require(_0x10e3('0x4'));var auth=require(_0x10e3('0x5'));var interaction=require(_0x10e3('0x6'));var config=require(_0x10e3('0x7'));var controller=require('./intZendeskAccount.controller');router['get']('/',auth[_0x10e3('0x8')](),controller[_0x10e3('0x9')]);router[_0x10e3('0xa')](_0x10e3('0xb'),auth['isAuthenticated'](),controller[_0x10e3('0xc')]);router[_0x10e3('0xa')](_0x10e3('0xd'),auth[_0x10e3('0x8')](),controller['getConfigurations']);router['get'](_0x10e3('0xe'),auth[_0x10e3('0x8')](),controller[_0x10e3('0xf')]);router[_0x10e3('0x10')]('/',auth['isAuthenticated'](),controller[_0x10e3('0x11')]);router['post'](_0x10e3('0xd'),auth['isAuthenticated'](),controller[_0x10e3('0x12')]);router[_0x10e3('0x13')](_0x10e3('0xb'),auth[_0x10e3('0x8')](),controller[_0x10e3('0x14')]);router[_0x10e3('0x15')](_0x10e3('0xb'),auth['isAuthenticated'](),controller[_0x10e3('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 101d22c..b49f513 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 _0x27fb=['password','integrationTab','sequelize','exports','STRING','ENUM','token'];(function(_0x354279,_0x1573a9){var _0x55db41=function(_0x159f95){while(--_0x159f95){_0x354279['push'](_0x354279['shift']());}};_0x55db41(++_0x1573a9);}(_0x27fb,0x1de));var _0xb27f=function(_0x358fd3,_0x4a9c44){_0x358fd3=_0x358fd3-0x0;var _0x1ad0f3=_0x27fb[_0x358fd3];return _0x1ad0f3;};'use strict';var Sequelize=require(_0xb27f('0x0'));module[_0xb27f('0x1')]={'name':{'type':Sequelize[_0xb27f('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb27f('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xb27f('0x2')]},'token':{'type':Sequelize[_0xb27f('0x2')]},'remoteUri':{'type':Sequelize[_0xb27f('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xb27f('0x3')]('password',_0xb27f('0x4')),'defaultValue':_0xb27f('0x5')},'serverUrl':{'type':Sequelize[_0xb27f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb27f('0x3')](_0xb27f('0x6'),'newTab'),'defaultValue':_0xb27f('0x6')}}; \ No newline at end of file +var _0x38b8=['STRING','username','remoteUri','token','password','ENUM','integrationTab','sequelize'];(function(_0x40927b,_0xf9b0a0){var _0x2635e8=function(_0x1f2b8c){while(--_0x1f2b8c){_0x40927b['push'](_0x40927b['shift']());}};_0x2635e8(++_0xf9b0a0);}(_0x38b8,0x7f));var _0x838b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x38b8[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x838b('0x0'));module['exports']={'name':{'type':Sequelize[_0x838b('0x1')]},'description':{'type':Sequelize[_0x838b('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x838b('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x838b('0x1')],'unique':_0x838b('0x3')},'authType':{'type':Sequelize['ENUM']('password',_0x838b('0x4')),'defaultValue':_0x838b('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x838b('0x6')](_0x838b('0x7'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index e769e20..6a0c222 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 _0x5423=['Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','then','error','stack','name','send','index','ZendeskAccount','rawAttributes','fieldName','model','map','query','keys','filters','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','intersection','length','find','create','body','destroy','ZendeskConfiguration','nolimit','findOne','AccountId','getSubjects','channel','type','Descriptions','ZendeskField','getFields','username','password','token','remoteUri','slice','lastIndexOf','ticket_fields','headers','Basic\x20%s','format','%s:%s','base64','%s/token:%s','toString','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5575cd,_0x73ab7a){var _0x4979a0=function(_0x1ac744){while(--_0x1ac744){_0x5575cd['push'](_0x5575cd['shift']());}};_0x4979a0(++_0x73ab7a);}(_0x5423,0xe3));var _0x3542=function(_0x19ae45,_0x3f24e5){_0x19ae45=_0x19ae45-0x0;var _0x15b84f=_0x5423[_0x19ae45];return _0x15b84f;};'use strict';var emlformat=require(_0x3542('0x0'));var rimraf=require(_0x3542('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3542('0x2'));var rp=require(_0x3542('0x3'));var moment=require('moment');var BPromise=require(_0x3542('0x4'));var Mustache=require(_0x3542('0x5'));var util=require(_0x3542('0x6'));var path=require(_0x3542('0x7'));var sox=require('sox');var csv=require(_0x3542('0x8'));var ejs=require(_0x3542('0x9'));var fs=require('fs');var fs_extra=require(_0x3542('0xa'));var _=require(_0x3542('0xb'));var squel=require(_0x3542('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3542('0xd'));var toCsv=require(_0x3542('0x8'));var querystring=require('querystring');var Papa=require(_0x3542('0xe'));var Redis=require(_0x3542('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3542('0x10'));var as=require(_0x3542('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3542('0x12'))(_0x3542('0x13'));var utils=require(_0x3542('0x14'));var config=require(_0x3542('0x15'));var licenseUtil=require(_0x3542('0x16'));var db=require(_0x3542('0x17'))['db'];var integrations=require(_0x3542('0x18'));function respondWithStatusCode(_0x43e977,_0x4ee86){_0x4ee86=_0x4ee86||0xcc;return function(_0x1a9062){if(_0x1a9062){return _0x43e977[_0x3542('0x19')](_0x4ee86);}return _0x43e977[_0x3542('0x1a')](_0x4ee86)[_0x3542('0x1b')]();};}function respondWithResult(_0x4bac5b,_0x14fe57){_0x14fe57=_0x14fe57||0xc8;return function(_0x4fb366){if(_0x4fb366){return _0x4bac5b[_0x3542('0x1a')](_0x14fe57)[_0x3542('0x1c')](_0x4fb366);}};}function respondWithFilteredResult(_0xc33d42,_0x546fbd){return function(_0x270312){if(_0x270312){var _0x177fb9=typeof _0x546fbd[_0x3542('0x1d')]==='undefined'&&typeof _0x546fbd[_0x3542('0x1e')]===_0x3542('0x1f');var _0x116859=_0x270312[_0x3542('0x20')];var _0x493d95=_0x177fb9?0x0:_0x546fbd[_0x3542('0x1d')];var _0x53d4aa=_0x177fb9?_0x270312[_0x3542('0x20')]:_0x546fbd[_0x3542('0x1d')]+_0x546fbd['limit'];var _0x1c6403;if(_0x53d4aa>=_0x116859){_0x53d4aa=_0x116859;_0x1c6403=0xc8;}else{_0x1c6403=0xce;}_0xc33d42[_0x3542('0x1a')](_0x1c6403);return _0xc33d42[_0x3542('0x21')](_0x3542('0x22'),_0x493d95+'-'+_0x53d4aa+'/'+_0x116859)[_0x3542('0x1c')](_0x270312);}return null;};}function patchUpdates(_0x4a7695){return function(_0x4a74b0){try{jsonpatch['apply'](_0x4a74b0,_0x4a7695,!![]);}catch(_0x17e3cf){return BPromise['reject'](_0x17e3cf);}return _0x4a74b0[_0x3542('0x23')]();};}function saveUpdates(_0x551645,_0x1d5f1e){return function(_0x55774d){if(_0x55774d){return _0x55774d['update'](_0x551645)[_0x3542('0x24')](function(_0xe3f983){return _0xe3f983;});}return null;};}function removeEntity(_0x5ae097,_0x5d05b2){return function(_0x3fc964){if(_0x3fc964){return _0x3fc964['destroy']()[_0x3542('0x24')](function(){_0x5ae097[_0x3542('0x1a')](0xcc)[_0x3542('0x1b')]();});}};}function handleEntityNotFound(_0x2f2e63,_0x298763){return function(_0xf1f7d0){if(!_0xf1f7d0){_0x2f2e63[_0x3542('0x19')](0x194);}return _0xf1f7d0;};}function handleError(_0x1e156e,_0x18dc6c){_0x18dc6c=_0x18dc6c||0x1f4;return function(_0x2841a1){logger[_0x3542('0x25')](_0x2841a1[_0x3542('0x26')]);if(_0x2841a1[_0x3542('0x27')]){delete _0x2841a1[_0x3542('0x27')];}_0x1e156e[_0x3542('0x1a')](_0x18dc6c)[_0x3542('0x28')](_0x2841a1);};}exports[_0x3542('0x29')]=function(_0x20eda1,_0x3bd666){var _0x5590a2={},_0x31ad47={},_0x35bbc9={'count':0x0,'rows':[]};var _0x2aec76=_['map'](db[_0x3542('0x2a')][_0x3542('0x2b')],function(_0x2e883a){return{'name':_0x2e883a[_0x3542('0x2c')],'type':_0x2e883a['type']['key']};});_0x31ad47[_0x3542('0x2d')]=_[_0x3542('0x2e')](_0x2aec76,_0x3542('0x27'));_0x31ad47[_0x3542('0x2f')]=_[_0x3542('0x30')](_0x20eda1[_0x3542('0x2f')]);_0x31ad47[_0x3542('0x31')]=_['intersection'](_0x31ad47['model'],_0x31ad47[_0x3542('0x2f')]);_0x5590a2['attributes']=_['intersection'](_0x31ad47[_0x3542('0x2d')],qs['fields'](_0x20eda1['query'][_0x3542('0x32')]));_0x5590a2[_0x3542('0x33')]=_0x5590a2[_0x3542('0x33')]['length']?_0x5590a2[_0x3542('0x33')]:_0x31ad47['model'];if(!_0x20eda1[_0x3542('0x2f')][_0x3542('0x34')]('nolimit')){_0x5590a2[_0x3542('0x1e')]=qs['limit'](_0x20eda1[_0x3542('0x2f')][_0x3542('0x1e')]);_0x5590a2[_0x3542('0x1d')]=qs['offset'](_0x20eda1[_0x3542('0x2f')]['offset']);}_0x5590a2[_0x3542('0x35')]=qs[_0x3542('0x36')](_0x20eda1[_0x3542('0x2f')][_0x3542('0x36')]);_0x5590a2[_0x3542('0x37')]=qs[_0x3542('0x31')](_[_0x3542('0x38')](_0x20eda1[_0x3542('0x2f')],_0x31ad47[_0x3542('0x31')]),_0x2aec76);if(_0x20eda1[_0x3542('0x2f')][_0x3542('0x39')]){_0x5590a2[_0x3542('0x37')]=_[_0x3542('0x3a')](_0x5590a2['where'],{'$or':_[_0x3542('0x2e')](_0x2aec76,function(_0x4a80ea){if(_0x4a80ea['type']!==_0x3542('0x3b')){var _0x3ffccc={};_0x3ffccc[_0x4a80ea[_0x3542('0x27')]]={'$like':'%'+_0x20eda1[_0x3542('0x2f')][_0x3542('0x39')]+'%'};return _0x3ffccc;}})});}_0x5590a2=_[_0x3542('0x3a')]({},_0x5590a2,_0x20eda1[_0x3542('0x3c')]);var _0x42e87a={'where':_0x5590a2['where']};return db[_0x3542('0x2a')]['count'](_0x42e87a)[_0x3542('0x24')](function(_0x2baa01){_0x35bbc9['count']=_0x2baa01;if(_0x20eda1[_0x3542('0x2f')][_0x3542('0x3d')]){_0x5590a2['include']=[{'all':!![]}];}return db[_0x3542('0x2a')][_0x3542('0x3e')](_0x5590a2);})['then'](function(_0x2682d0){_0x35bbc9[_0x3542('0x3f')]=_0x2682d0;return _0x35bbc9;})[_0x3542('0x24')](respondWithFilteredResult(_0x3bd666,_0x5590a2))[_0x3542('0x40')](handleError(_0x3bd666,null));};exports[_0x3542('0x41')]=function(_0xb12441,_0x2b54b9){var _0x4bf45a={'raw':![],'where':{'id':_0xb12441[_0x3542('0x42')]['id']}},_0x542e0c={};_0x542e0c[_0x3542('0x2d')]=_[_0x3542('0x30')](db[_0x3542('0x2a')][_0x3542('0x2b')]);_0x542e0c['query']=_[_0x3542('0x30')](_0xb12441['query']);_0x542e0c[_0x3542('0x31')]=_[_0x3542('0x43')](_0x542e0c[_0x3542('0x2d')],_0x542e0c['query']);_0x4bf45a[_0x3542('0x33')]=_[_0x3542('0x43')](_0x542e0c['model'],qs[_0x3542('0x32')](_0xb12441[_0x3542('0x2f')][_0x3542('0x32')]));_0x4bf45a[_0x3542('0x33')]=_0x4bf45a[_0x3542('0x33')][_0x3542('0x44')]?_0x4bf45a[_0x3542('0x33')]:_0x542e0c[_0x3542('0x2d')];if(_0xb12441['query']['includeAll']){_0x4bf45a['include']=[{'all':!![]}];}_0x4bf45a=_[_0x3542('0x3a')]({},_0x4bf45a,_0xb12441[_0x3542('0x3c')]);return db[_0x3542('0x2a')][_0x3542('0x45')](_0x4bf45a)[_0x3542('0x24')](handleEntityNotFound(_0x2b54b9,null))[_0x3542('0x24')](respondWithResult(_0x2b54b9,null))[_0x3542('0x40')](handleError(_0x2b54b9,null));};exports['create']=function(_0x157683,_0x14b960){return db[_0x3542('0x2a')][_0x3542('0x46')](_0x157683['body'],{})[_0x3542('0x24')](respondWithResult(_0x14b960,0xc9))[_0x3542('0x40')](handleError(_0x14b960,null));};exports['update']=function(_0x528f8c,_0x1fb253){if(_0x528f8c[_0x3542('0x47')]['id']){delete _0x528f8c[_0x3542('0x47')]['id'];}return db[_0x3542('0x2a')][_0x3542('0x45')]({'where':{'id':_0x528f8c[_0x3542('0x42')]['id']}})[_0x3542('0x24')](handleEntityNotFound(_0x1fb253,null))['then'](saveUpdates(_0x528f8c[_0x3542('0x47')],null))[_0x3542('0x24')](respondWithResult(_0x1fb253,null))[_0x3542('0x40')](handleError(_0x1fb253,null));};exports[_0x3542('0x48')]=function(_0x1ebc82,_0x28be34){return db[_0x3542('0x2a')][_0x3542('0x45')]({'where':{'id':_0x1ebc82[_0x3542('0x42')]['id']}})['then'](handleEntityNotFound(_0x28be34,null))['then'](removeEntity(_0x28be34,null))[_0x3542('0x40')](handleError(_0x28be34,null));};exports['getConfigurations']=function(_0x5a798a,_0x572e7a,_0x286222){var _0xd5c5c3={};var _0x381885={};var _0x48cfc4;var _0x2db495;return db[_0x3542('0x2a')]['findOne']({'where':{'id':_0x5a798a[_0x3542('0x42')]['id']}})[_0x3542('0x24')](handleEntityNotFound(_0x572e7a,null))[_0x3542('0x24')](function(_0x196c59){if(_0x196c59){_0x48cfc4=_0x196c59;_0x381885[_0x3542('0x2d')]=_['keys'](db[_0x3542('0x49')][_0x3542('0x2b')]);_0x381885[_0x3542('0x2f')]=_[_0x3542('0x30')](_0x5a798a[_0x3542('0x2f')]);_0x381885['filters']=_['intersection'](_0x381885[_0x3542('0x2d')],_0x381885[_0x3542('0x2f')]);_0xd5c5c3[_0x3542('0x33')]=_['intersection'](_0x381885[_0x3542('0x2d')],qs[_0x3542('0x32')](_0x5a798a[_0x3542('0x2f')][_0x3542('0x32')]));_0xd5c5c3[_0x3542('0x33')]=_0xd5c5c3['attributes']['length']?_0xd5c5c3[_0x3542('0x33')]:_0x381885['model'];_0xd5c5c3[_0x3542('0x35')]=qs[_0x3542('0x36')](_0x5a798a['query'][_0x3542('0x36')]);_0xd5c5c3[_0x3542('0x37')]=qs[_0x3542('0x31')](_[_0x3542('0x38')](_0x5a798a[_0x3542('0x2f')],_0x381885['filters']));if(_0x5a798a['query'][_0x3542('0x39')]){_0xd5c5c3['where']=_[_0x3542('0x3a')](_0xd5c5c3[_0x3542('0x37')],{'$or':_[_0x3542('0x2e')](_0xd5c5c3['attributes'],function(_0xd9c90c){var _0x1f8ddb={};_0x1f8ddb[_0xd9c90c]={'$like':'%'+_0x5a798a[_0x3542('0x2f')][_0x3542('0x39')]+'%'};return _0x1f8ddb;})});}_0xd5c5c3=_[_0x3542('0x3a')]({},_0xd5c5c3,_0x5a798a[_0x3542('0x3c')]);return _0x48cfc4['getConfigurations'](_0xd5c5c3);}})[_0x3542('0x24')](function(_0x3ee446){if(_0x3ee446){_0x2db495=_0x3ee446[_0x3542('0x44')];if(!_0x5a798a[_0x3542('0x2f')][_0x3542('0x34')](_0x3542('0x4a'))){_0xd5c5c3['limit']=qs[_0x3542('0x1e')](_0x5a798a[_0x3542('0x2f')][_0x3542('0x1e')]);_0xd5c5c3[_0x3542('0x1d')]=qs['offset'](_0x5a798a[_0x3542('0x2f')][_0x3542('0x1d')]);}return _0x48cfc4['getConfigurations'](_0xd5c5c3);}})['then'](function(_0x2908e5){if(_0x2908e5){return _0x2908e5?{'count':_0x2db495,'rows':_0x2908e5}:null;}})['then'](respondWithResult(_0x572e7a,null))[_0x3542('0x40')](handleError(_0x572e7a,null));};exports['addConfiguration']=function(_0x484204,_0x42a34a,_0x471408){if(_0x484204[_0x3542('0x47')]['id']){delete _0x484204[_0x3542('0x47')]['id'];}return db[_0x3542('0x2a')][_0x3542('0x4b')]({'where':{'id':_0x484204[_0x3542('0x42')]['id']}})['then'](handleEntityNotFound(_0x42a34a,null))[_0x3542('0x24')](function(_0xf1cf57){if(_0xf1cf57){_0x484204[_0x3542('0x47')][_0x3542('0x4c')]=_0xf1cf57['id'];_0x484204[_0x3542('0x47')]['Subjects']=integrations[_0x3542('0x4d')](_0x484204[_0x3542('0x47')][_0x3542('0x4e')],_0x484204[_0x3542('0x47')][_0x3542('0x4f')]);_0x484204[_0x3542('0x47')][_0x3542('0x50')]=integrations['getDescriptions'](_0x484204[_0x3542('0x47')]['channel'],_0x484204[_0x3542('0x47')][_0x3542('0x4f')]);return db[_0x3542('0x49')][_0x3542('0x46')](_0x484204['body'],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db[_0x3542('0x51')],'as':_0x3542('0x50')}]});}return null;})[_0x3542('0x24')](respondWithResult(_0x42a34a,null))[_0x3542('0x40')](handleError(_0x42a34a,null));};exports[_0x3542('0x52')]=function(_0x2afc71,_0x3c84fa,_0x77f0af){var _0x2b0de0='';return db['ZendeskAccount'][_0x3542('0x4b')]({'where':{'id':_0x2afc71[_0x3542('0x42')]['id']},'attributes':['id',_0x3542('0x53'),_0x3542('0x54'),_0x3542('0x55'),'authType','remoteUri']})[_0x3542('0x24')](handleEntityNotFound(_0x3c84fa,null))[_0x3542('0x24')](function(_0x52c26d){if(_0x52c26d){_0x2b0de0=_0x52c26d[_0x3542('0x56')];var _0x4b5327=_0x2b0de0[_0x3542('0x57')](-0x1);if(_0x4b5327==='/'){_0x2b0de0=_0x2b0de0['substring'](0x0,_0x2b0de0[_0x3542('0x58')](_0x4b5327));}var _0x153e1b={'method':'GET','uri':util['format']('%s/%s',_0x2b0de0,_0x3542('0x59')),'json':!![]};switch(_0x52c26d['authType']){case _0x3542('0x54'):_0x153e1b[_0x3542('0x5a')]={'Authorization':util['format'](_0x3542('0x5b'),new Buffer(util[_0x3542('0x5c')](_0x3542('0x5d'),_0x52c26d['username'],_0x52c26d[_0x3542('0x54')]))['toString'](_0x3542('0x5e')))};break;case'token':_0x153e1b[_0x3542('0x5a')]={'Authorization':util[_0x3542('0x5c')](_0x3542('0x5b'),new Buffer(util['format'](_0x3542('0x5f'),_0x52c26d[_0x3542('0x53')],_0x52c26d[_0x3542('0x55')]))[_0x3542('0x60')]('base64'))};break;default:throw new db['Sequelize'][(_0x3542('0x61'))](_0x3542('0x62'));}return rp(_0x153e1b);}})[_0x3542('0x24')](function(_0xaa97d5){if(_0xaa97d5){var _0x191fdd=[_0x3542('0x63'),_0x3542('0x64'),_0x3542('0x65'),_0x3542('0x66')];_[_0x3542('0x67')](_0xaa97d5[_0x3542('0x59')],function(_0x1c318c){return _0x191fdd[_0x3542('0x68')](_0x1c318c[_0x3542('0x4f')]);});return{'count':_0xaa97d5[_0x3542('0x59')][_0x3542('0x44')],'rows':_[_0x3542('0x2e')](_0xaa97d5[_0x3542('0x59')],function(_0x4e04b6){return{'id':_0x4e04b6['id'],'name':_0x4e04b6[_0x3542('0x69')]>0x7?_0x4e04b6[_0x3542('0x6a')]:_0x4e04b6['type'],'custom':_0x4e04b6['position']>0x7?!![]:![],'options':_0x4e04b6[_0x3542('0x6b')]?_0x4e04b6[_0x3542('0x6b')]:_0x4e04b6[_0x3542('0x6c')]?_0x4e04b6[_0x3542('0x6c')]:[]};})};}})['then'](respondWithResult(_0x3c84fa,null))[_0x3542('0x40')](function(_0x2d17ce){var _0x54e723=_0x2afc71[_0x3542('0x2f')]['test']?0x1f4:_0x2d17ce[_0x3542('0x6d')]||0x1f4;logger['error'](_0x3542('0x6e'),_0x3542('0x52'),_0x54e723,JSON[_0x3542('0x6f')](_0x2d17ce));delete _0x2d17ce[_0x3542('0x27')];if(_0x54e723===0x191){_0x54e723=0x190;}_0x3c84fa[_0x3542('0x1a')](_0x54e723)[_0x3542('0x28')](_0x2afc71[_0x3542('0x2f')]['test']?{'message':_0x3542('0x70'),'statusCode':_0x2d17ce['statusCode']}:_0x2d17ce);});}; \ No newline at end of file +var _0xf7b4=['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','../../components/integrations/configuration','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','ZendeskAccount','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','type','merge','include','findAll','catch','show','params','rawAttributes','options','find','create','body','getConfigurations','findOne','ZendeskConfiguration','pick','nolimit','addConfiguration','AccountId','channel','Descriptions','ZendeskField','Subjects','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','toString','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','includes','title','position','system_field_options','custom_field_options','test','Wrong\x20credentials','statusCode','eml-format','fast-json-patch','request-promise','mustache','util','path','sox'];(function(_0x3db20f,_0x211a2e){var _0x28c80e=function(_0x4661d0){while(--_0x4661d0){_0x3db20f['push'](_0x3db20f['shift']());}};_0x28c80e(++_0x211a2e);}(_0xf7b4,0x152));var _0x4f7b=function(_0x5f08be,_0x12420c){_0x5f08be=_0x5f08be-0x0;var _0x5ceb02=_0xf7b4[_0x5f08be];return _0x5ceb02;};'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'];var integrations=require(_0x4f7b('0x17'));function respondWithStatusCode(_0x2e8dd9,_0x3c55e1){_0x3c55e1=_0x3c55e1||0xcc;return function(_0x41a050){if(_0x41a050){return _0x2e8dd9['sendStatus'](_0x3c55e1);}return _0x2e8dd9[_0x4f7b('0x18')](_0x3c55e1)[_0x4f7b('0x19')]();};}function respondWithResult(_0x407cee,_0x43a51a){_0x43a51a=_0x43a51a||0xc8;return function(_0x339486){if(_0x339486){return _0x407cee[_0x4f7b('0x18')](_0x43a51a)[_0x4f7b('0x1a')](_0x339486);}};}function respondWithFilteredResult(_0x2437cc,_0x260667){return function(_0x29fdd5){if(_0x29fdd5){var _0x1a28b8=typeof _0x260667[_0x4f7b('0x1b')]==='undefined'&&typeof _0x260667[_0x4f7b('0x1c')]==='undefined';var _0x5b5ee3=_0x29fdd5[_0x4f7b('0x1d')];var _0x3813da=_0x1a28b8?0x0:_0x260667['offset'];var _0x2b34c9=_0x1a28b8?_0x29fdd5[_0x4f7b('0x1d')]:_0x260667[_0x4f7b('0x1b')]+_0x260667[_0x4f7b('0x1c')];var _0x5a5187;if(_0x2b34c9>=_0x5b5ee3){_0x2b34c9=_0x5b5ee3;_0x5a5187=0xc8;}else{_0x5a5187=0xce;}_0x2437cc[_0x4f7b('0x18')](_0x5a5187);return _0x2437cc['set'](_0x4f7b('0x1e'),_0x3813da+'-'+_0x2b34c9+'/'+_0x5b5ee3)[_0x4f7b('0x1a')](_0x29fdd5);}return null;};}function patchUpdates(_0xa2f54e){return function(_0xdb2df2){try{jsonpatch[_0x4f7b('0x1f')](_0xdb2df2,_0xa2f54e,!![]);}catch(_0x203a92){return BPromise[_0x4f7b('0x20')](_0x203a92);}return _0xdb2df2[_0x4f7b('0x21')]();};}function saveUpdates(_0x2a8b50,_0x5508bd){return function(_0x410176){if(_0x410176){return _0x410176[_0x4f7b('0x22')](_0x2a8b50)[_0x4f7b('0x23')](function(_0x5bd43f){return _0x5bd43f;});}return null;};}function removeEntity(_0x150f57,_0x4610a4){return function(_0x5d22f4){if(_0x5d22f4){return _0x5d22f4[_0x4f7b('0x24')]()['then'](function(){_0x150f57[_0x4f7b('0x18')](0xcc)[_0x4f7b('0x19')]();});}};}function handleEntityNotFound(_0x23c820,_0x278c41){return function(_0x17aa9d){if(!_0x17aa9d){_0x23c820[_0x4f7b('0x25')](0x194);}return _0x17aa9d;};}function handleError(_0x181e13,_0x3ad769){_0x3ad769=_0x3ad769||0x1f4;return function(_0x4ec9a3){logger[_0x4f7b('0x26')](_0x4ec9a3[_0x4f7b('0x27')]);if(_0x4ec9a3[_0x4f7b('0x28')]){delete _0x4ec9a3['name'];}_0x181e13[_0x4f7b('0x18')](_0x3ad769)[_0x4f7b('0x29')](_0x4ec9a3);};}exports[_0x4f7b('0x2a')]=function(_0x3a56ff,_0x1ccce0){var _0x4ebffa={},_0xac1f93={},_0x3331b2={'count':0x0,'rows':[]};var _0x9a675c=_['map'](db[_0x4f7b('0x2b')]['rawAttributes'],function(_0x4e4828){return{'name':_0x4e4828[_0x4f7b('0x2c')],'type':_0x4e4828['type'][_0x4f7b('0x2d')]};});_0xac1f93[_0x4f7b('0x2e')]=_[_0x4f7b('0x2f')](_0x9a675c,_0x4f7b('0x28'));_0xac1f93[_0x4f7b('0x30')]=_[_0x4f7b('0x31')](_0x3a56ff[_0x4f7b('0x30')]);_0xac1f93[_0x4f7b('0x32')]=_[_0x4f7b('0x33')](_0xac1f93[_0x4f7b('0x2e')],_0xac1f93[_0x4f7b('0x30')]);_0x4ebffa[_0x4f7b('0x34')]=_[_0x4f7b('0x33')](_0xac1f93[_0x4f7b('0x2e')],qs[_0x4f7b('0x35')](_0x3a56ff[_0x4f7b('0x30')][_0x4f7b('0x35')]));_0x4ebffa[_0x4f7b('0x34')]=_0x4ebffa[_0x4f7b('0x34')][_0x4f7b('0x36')]?_0x4ebffa[_0x4f7b('0x34')]:_0xac1f93[_0x4f7b('0x2e')];if(!_0x3a56ff['query'][_0x4f7b('0x37')]('nolimit')){_0x4ebffa[_0x4f7b('0x1c')]=qs[_0x4f7b('0x1c')](_0x3a56ff['query'][_0x4f7b('0x1c')]);_0x4ebffa[_0x4f7b('0x1b')]=qs[_0x4f7b('0x1b')](_0x3a56ff['query'][_0x4f7b('0x1b')]);}_0x4ebffa[_0x4f7b('0x38')]=qs[_0x4f7b('0x39')](_0x3a56ff[_0x4f7b('0x30')][_0x4f7b('0x39')]);_0x4ebffa[_0x4f7b('0x3a')]=qs[_0x4f7b('0x32')](_['pick'](_0x3a56ff[_0x4f7b('0x30')],_0xac1f93['filters']),_0x9a675c);if(_0x3a56ff[_0x4f7b('0x30')][_0x4f7b('0x3b')]){_0x4ebffa[_0x4f7b('0x3a')]=_['merge'](_0x4ebffa[_0x4f7b('0x3a')],{'$or':_['map'](_0x9a675c,function(_0x2471dc){if(_0x2471dc[_0x4f7b('0x3c')]!=='VIRTUAL'){var _0x48aecc={};_0x48aecc[_0x2471dc[_0x4f7b('0x28')]]={'$like':'%'+_0x3a56ff['query'][_0x4f7b('0x3b')]+'%'};return _0x48aecc;}})});}_0x4ebffa=_[_0x4f7b('0x3d')]({},_0x4ebffa,_0x3a56ff['options']);var _0x1d0746={'where':_0x4ebffa['where']};return db['ZendeskAccount']['count'](_0x1d0746)[_0x4f7b('0x23')](function(_0x2e861d){_0x3331b2[_0x4f7b('0x1d')]=_0x2e861d;if(_0x3a56ff[_0x4f7b('0x30')]['includeAll']){_0x4ebffa[_0x4f7b('0x3e')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x4f7b('0x3f')](_0x4ebffa);})['then'](function(_0x3c411f){_0x3331b2['rows']=_0x3c411f;return _0x3331b2;})[_0x4f7b('0x23')](respondWithFilteredResult(_0x1ccce0,_0x4ebffa))[_0x4f7b('0x40')](handleError(_0x1ccce0,null));};exports[_0x4f7b('0x41')]=function(_0x3ab08f,_0x2986cd){var _0x325cd6={'raw':![],'where':{'id':_0x3ab08f[_0x4f7b('0x42')]['id']}},_0x3fdde2={};_0x3fdde2[_0x4f7b('0x2e')]=_[_0x4f7b('0x31')](db[_0x4f7b('0x2b')][_0x4f7b('0x43')]);_0x3fdde2[_0x4f7b('0x30')]=_[_0x4f7b('0x31')](_0x3ab08f[_0x4f7b('0x30')]);_0x3fdde2[_0x4f7b('0x32')]=_[_0x4f7b('0x33')](_0x3fdde2[_0x4f7b('0x2e')],_0x3fdde2['query']);_0x325cd6['attributes']=_[_0x4f7b('0x33')](_0x3fdde2[_0x4f7b('0x2e')],qs[_0x4f7b('0x35')](_0x3ab08f[_0x4f7b('0x30')]['fields']));_0x325cd6['attributes']=_0x325cd6[_0x4f7b('0x34')][_0x4f7b('0x36')]?_0x325cd6[_0x4f7b('0x34')]:_0x3fdde2[_0x4f7b('0x2e')];if(_0x3ab08f['query']['includeAll']){_0x325cd6[_0x4f7b('0x3e')]=[{'all':!![]}];}_0x325cd6=_[_0x4f7b('0x3d')]({},_0x325cd6,_0x3ab08f[_0x4f7b('0x44')]);return db[_0x4f7b('0x2b')][_0x4f7b('0x45')](_0x325cd6)['then'](handleEntityNotFound(_0x2986cd,null))[_0x4f7b('0x23')](respondWithResult(_0x2986cd,null))[_0x4f7b('0x40')](handleError(_0x2986cd,null));};exports[_0x4f7b('0x46')]=function(_0x5df68e,_0x6c659c){return db[_0x4f7b('0x2b')][_0x4f7b('0x46')](_0x5df68e[_0x4f7b('0x47')],{})[_0x4f7b('0x23')](respondWithResult(_0x6c659c,0xc9))[_0x4f7b('0x40')](handleError(_0x6c659c,null));};exports[_0x4f7b('0x22')]=function(_0x2e563f,_0x2630ec){if(_0x2e563f[_0x4f7b('0x47')]['id']){delete _0x2e563f['body']['id'];}return db[_0x4f7b('0x2b')][_0x4f7b('0x45')]({'where':{'id':_0x2e563f[_0x4f7b('0x42')]['id']}})['then'](handleEntityNotFound(_0x2630ec,null))[_0x4f7b('0x23')](saveUpdates(_0x2e563f[_0x4f7b('0x47')],null))[_0x4f7b('0x23')](respondWithResult(_0x2630ec,null))[_0x4f7b('0x40')](handleError(_0x2630ec,null));};exports[_0x4f7b('0x24')]=function(_0x7e624,_0x144ba1){return db[_0x4f7b('0x2b')][_0x4f7b('0x45')]({'where':{'id':_0x7e624[_0x4f7b('0x42')]['id']}})['then'](handleEntityNotFound(_0x144ba1,null))[_0x4f7b('0x23')](removeEntity(_0x144ba1,null))[_0x4f7b('0x40')](handleError(_0x144ba1,null));};exports[_0x4f7b('0x48')]=function(_0x4d1ac9,_0x2c9cee,_0x40c183){var _0xeeb227={};var _0xb92819={};var _0x3437a8;var _0x819fb3;return db['ZendeskAccount'][_0x4f7b('0x49')]({'where':{'id':_0x4d1ac9[_0x4f7b('0x42')]['id']}})[_0x4f7b('0x23')](handleEntityNotFound(_0x2c9cee,null))['then'](function(_0x4017b5){if(_0x4017b5){_0x3437a8=_0x4017b5;_0xb92819[_0x4f7b('0x2e')]=_[_0x4f7b('0x31')](db[_0x4f7b('0x4a')][_0x4f7b('0x43')]);_0xb92819[_0x4f7b('0x30')]=_['keys'](_0x4d1ac9[_0x4f7b('0x30')]);_0xb92819['filters']=_['intersection'](_0xb92819['model'],_0xb92819[_0x4f7b('0x30')]);_0xeeb227[_0x4f7b('0x34')]=_[_0x4f7b('0x33')](_0xb92819['model'],qs['fields'](_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x35')]));_0xeeb227['attributes']=_0xeeb227[_0x4f7b('0x34')][_0x4f7b('0x36')]?_0xeeb227[_0x4f7b('0x34')]:_0xb92819[_0x4f7b('0x2e')];_0xeeb227['order']=qs[_0x4f7b('0x39')](_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x39')]);_0xeeb227[_0x4f7b('0x3a')]=qs[_0x4f7b('0x32')](_[_0x4f7b('0x4b')](_0x4d1ac9[_0x4f7b('0x30')],_0xb92819['filters']));if(_0x4d1ac9['query']['filter']){_0xeeb227[_0x4f7b('0x3a')]=_['merge'](_0xeeb227['where'],{'$or':_['map'](_0xeeb227['attributes'],function(_0x4a35d1){var _0x2715b5={};_0x2715b5[_0x4a35d1]={'$like':'%'+_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x3b')]+'%'};return _0x2715b5;})});}_0xeeb227=_[_0x4f7b('0x3d')]({},_0xeeb227,_0x4d1ac9[_0x4f7b('0x44')]);return _0x3437a8[_0x4f7b('0x48')](_0xeeb227);}})[_0x4f7b('0x23')](function(_0x1d500c){if(_0x1d500c){_0x819fb3=_0x1d500c[_0x4f7b('0x36')];if(!_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x37')](_0x4f7b('0x4c'))){_0xeeb227[_0x4f7b('0x1c')]=qs[_0x4f7b('0x1c')](_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x1c')]);_0xeeb227[_0x4f7b('0x1b')]=qs['offset'](_0x4d1ac9[_0x4f7b('0x30')][_0x4f7b('0x1b')]);}return _0x3437a8[_0x4f7b('0x48')](_0xeeb227);}})[_0x4f7b('0x23')](function(_0x321f36){if(_0x321f36){return _0x321f36?{'count':_0x819fb3,'rows':_0x321f36}:null;}})['then'](respondWithResult(_0x2c9cee,null))['catch'](handleError(_0x2c9cee,null));};exports[_0x4f7b('0x4d')]=function(_0x5a2b3d,_0x457ac5,_0x384a08){if(_0x5a2b3d[_0x4f7b('0x47')]['id']){delete _0x5a2b3d[_0x4f7b('0x47')]['id'];}return db['ZendeskAccount'][_0x4f7b('0x49')]({'where':{'id':_0x5a2b3d[_0x4f7b('0x42')]['id']}})[_0x4f7b('0x23')](handleEntityNotFound(_0x457ac5,null))['then'](function(_0x4b2089){if(_0x4b2089){_0x5a2b3d['body'][_0x4f7b('0x4e')]=_0x4b2089['id'];_0x5a2b3d['body']['Subjects']=integrations['getSubjects'](_0x5a2b3d[_0x4f7b('0x47')][_0x4f7b('0x4f')],_0x5a2b3d[_0x4f7b('0x47')]['type']);_0x5a2b3d[_0x4f7b('0x47')][_0x4f7b('0x50')]=integrations['getDescriptions'](_0x5a2b3d['body'][_0x4f7b('0x4f')],_0x5a2b3d[_0x4f7b('0x47')][_0x4f7b('0x3c')]);return db[_0x4f7b('0x4a')]['create'](_0x5a2b3d[_0x4f7b('0x47')],{'include':[{'model':db[_0x4f7b('0x51')],'as':_0x4f7b('0x52')},{'model':db[_0x4f7b('0x51')],'as':_0x4f7b('0x50')}]});}return null;})[_0x4f7b('0x23')](respondWithResult(_0x457ac5,null))['catch'](handleError(_0x457ac5,null));};exports[_0x4f7b('0x53')]=function(_0x79deaa,_0xa10c21,_0x220f21){var _0x1ca442='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x79deaa['params']['id']},'attributes':['id',_0x4f7b('0x54'),_0x4f7b('0x55'),_0x4f7b('0x56'),_0x4f7b('0x57'),_0x4f7b('0x58')]})['then'](handleEntityNotFound(_0xa10c21,null))[_0x4f7b('0x23')](function(_0x16dbe3){if(_0x16dbe3){_0x1ca442=_0x16dbe3[_0x4f7b('0x58')];var _0x2a09b6=_0x1ca442[_0x4f7b('0x59')](-0x1);if(_0x2a09b6==='/'){_0x1ca442=_0x1ca442[_0x4f7b('0x5a')](0x0,_0x1ca442[_0x4f7b('0x5b')](_0x2a09b6));}var _0x477077={'method':_0x4f7b('0x5c'),'uri':util[_0x4f7b('0x5d')](_0x4f7b('0x5e'),_0x1ca442,_0x4f7b('0x5f')),'json':!![]};switch(_0x16dbe3[_0x4f7b('0x57')]){case _0x4f7b('0x55'):_0x477077[_0x4f7b('0x60')]={'Authorization':util[_0x4f7b('0x5d')](_0x4f7b('0x61'),new Buffer(util[_0x4f7b('0x5d')]('%s:%s',_0x16dbe3['username'],_0x16dbe3[_0x4f7b('0x55')]))[_0x4f7b('0x62')](_0x4f7b('0x63')))};break;case _0x4f7b('0x56'):_0x477077['headers']={'Authorization':util[_0x4f7b('0x5d')](_0x4f7b('0x61'),new Buffer(util[_0x4f7b('0x5d')](_0x4f7b('0x64'),_0x16dbe3[_0x4f7b('0x54')],_0x16dbe3[_0x4f7b('0x56')]))[_0x4f7b('0x62')](_0x4f7b('0x63')))};break;default:throw new db[(_0x4f7b('0x65'))][(_0x4f7b('0x66'))](_0x4f7b('0x67'));}return rp(_0x477077);}})[_0x4f7b('0x23')](function(_0x26b5cb){if(_0x26b5cb){var _0x278d72=[_0x4f7b('0x68'),'description',_0x4f7b('0x69'),_0x4f7b('0x6a')];_['remove'](_0x26b5cb['ticket_fields'],function(_0x45aced){return _0x278d72[_0x4f7b('0x6b')](_0x45aced[_0x4f7b('0x3c')]);});return{'count':_0x26b5cb[_0x4f7b('0x5f')][_0x4f7b('0x36')],'rows':_[_0x4f7b('0x2f')](_0x26b5cb[_0x4f7b('0x5f')],function(_0x48d9c6){return{'id':_0x48d9c6['id'],'name':_0x48d9c6['position']>0x7?_0x48d9c6[_0x4f7b('0x6c')]:_0x48d9c6[_0x4f7b('0x3c')],'custom':_0x48d9c6[_0x4f7b('0x6d')]>0x7?!![]:![],'options':_0x48d9c6[_0x4f7b('0x6e')]?_0x48d9c6['system_field_options']:_0x48d9c6[_0x4f7b('0x6f')]?_0x48d9c6[_0x4f7b('0x6f')]:[]};})};}})['then'](respondWithResult(_0xa10c21,null))[_0x4f7b('0x40')](function(_0x247541){var _0x50aabe=_0x79deaa['query'][_0x4f7b('0x70')]?0x1f4:_0x247541['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x4f7b('0x53'),_0x50aabe,JSON['stringify'](_0x247541));delete _0x247541[_0x4f7b('0x28')];if(_0x50aabe===0x191){_0x50aabe=0x190;}_0xa10c21[_0x4f7b('0x18')](_0x50aabe)[_0x4f7b('0x29')](_0x79deaa[_0x4f7b('0x30')][_0x4f7b('0x70')]?{'message':_0x4f7b('0x71'),'statusCode':_0x247541[_0x4f7b('0x72')]}:_0x247541);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 93cb518..51cf2de 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 _0xce59=['../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','define','int_zendesk_accounts','api','moment','request-promise','path','rimraf'];(function(_0x5bdf93,_0x43b6a6){var _0xe4f7c3=function(_0x3e4412){while(--_0x3e4412){_0x5bdf93['push'](_0x5bdf93['shift']());}};_0xe4f7c3(++_0x43b6a6);}(_0xce59,0x195));var _0x9ce5=function(_0x58722c,_0x4f3eca){_0x58722c=_0x58722c-0x0;var _0x7fab8e=_0xce59[_0x58722c];return _0x7fab8e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x9ce5('0x0'));var moment=require(_0x9ce5('0x1'));var BPromise=require('bluebird');var rp=require(_0x9ce5('0x2'));var fs=require('fs');var path=require(_0x9ce5('0x3'));var rimraf=require(_0x9ce5('0x4'));var config=require(_0x9ce5('0x5'));var attributes=require(_0x9ce5('0x6'));var integrations=require(_0x9ce5('0x7'));module['exports']=function(_0x1826ff,_0x2dd67c){return _0x1826ff[_0x9ce5('0x8')]('ZendeskAccount',attributes,{'tableName':_0x9ce5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd07e=['../../config/environment','../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x138ff8,_0x4a71b2){var _0x2d4a8f=function(_0x1d766d){while(--_0x1d766d){_0x138ff8['push'](_0x138ff8['shift']());}};_0x2d4a8f(++_0x4a71b2);}(_0xd07e,0x147));var _0xed07=function(_0x2ca530,_0x26f6c1){_0x2ca530=_0x2ca530-0x0;var _0x4164e2=_0xd07e[_0x2ca530];return _0x4164e2;};'use strict';var _=require(_0xed07('0x0'));var util=require(_0xed07('0x1'));var logger=require(_0xed07('0x2'))(_0xed07('0x3'));var moment=require(_0xed07('0x4'));var BPromise=require(_0xed07('0x5'));var rp=require(_0xed07('0x6'));var fs=require('fs');var path=require(_0xed07('0x7'));var rimraf=require(_0xed07('0x8'));var config=require(_0xed07('0x9'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xed07('0xa'));module[_0xed07('0xb')]=function(_0x4949c3,_0x515d0b){return _0x4949c3['define'](_0xed07('0xc'),attributes,{'tableName':_0xed07('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index fcbcb23..7b78eb9 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 _0x9365=['ShowZendeskAccount','find','stringify','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','ZendeskAccount,\x20%s,\x20%s','message','info','result','ZendeskAccount','options','raw','where','limit','include','map','model','attributes','GetZendeskAccount'];(function(_0x2ca4d5,_0xb7b77e){var _0x44971c=function(_0x1f3812){while(--_0x1f3812){_0x2ca4d5['push'](_0x2ca4d5['shift']());}};_0x44971c(++_0xb7b77e);}(_0x9365,0x1e5));var _0x5936=function(_0x49de66,_0x5c492f){_0x49de66=_0x49de66-0x0;var _0x43f6c2=_0x9365[_0x49de66];return _0x43f6c2;};'use strict';var _=require('lodash');var util=require(_0x5936('0x0'));var moment=require(_0x5936('0x1'));var BPromise=require(_0x5936('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5936('0x3'));var db=require(_0x5936('0x4'))['db'];var utils=require(_0x5936('0x5'));var logger=require(_0x5936('0x6'))(_0x5936('0x7'));var config=require(_0x5936('0x8'));var jayson=require(_0x5936('0x9'));var client=jayson[_0x5936('0xa')][_0x5936('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e329b,_0x50c65e,_0x18a372){return new BPromise(function(_0x4d96c5,_0x39d471){return client[_0x5936('0xc')](_0x3e329b,_0x18a372)[_0x5936('0xd')](function(_0x4a22e1){logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x50c65e,_0x5936('0xe'));logger[_0x5936('0xf')](_0x5936('0x10'),_0x50c65e,'request\x20sent',JSON['stringify'](_0x4a22e1));if(_0x4a22e1['error']){if(_0x4a22e1[_0x5936('0x11')][_0x5936('0x12')]===0x1f4){logger['error'](_0x5936('0x13'),_0x50c65e,_0x4a22e1['error'][_0x5936('0x14')]);return _0x39d471(_0x4a22e1['error'][_0x5936('0x14')]);}logger[_0x5936('0x11')](_0x5936('0x13'),_0x50c65e,_0x4a22e1[_0x5936('0x11')][_0x5936('0x14')]);return _0x4d96c5(_0x4a22e1['error'][_0x5936('0x14')]);}else{logger[_0x5936('0x15')](_0x5936('0x13'),_0x50c65e,'request\x20sent');_0x4d96c5(_0x4a22e1[_0x5936('0x16')][_0x5936('0x14')]);}})['catch'](function(_0xe82081){logger[_0x5936('0x11')](_0x5936('0x13'),_0x50c65e,_0xe82081);_0x39d471(_0xe82081);});});}exports['GetZendeskAccount']=function(_0x2e6bb1){var _0x33061e=this;return new Promise(function(_0x2b9fc7,_0x3211b2){return db[_0x5936('0x17')]['findAll']({'raw':_0x2e6bb1[_0x5936('0x18')]?_0x2e6bb1[_0x5936('0x18')][_0x5936('0x19')]===undefined?!![]:![]:!![],'where':_0x2e6bb1[_0x5936('0x18')]?_0x2e6bb1[_0x5936('0x18')][_0x5936('0x1a')]||null:null,'attributes':_0x2e6bb1['options']?_0x2e6bb1['options']['attributes']||null:null,'limit':_0x2e6bb1[_0x5936('0x18')]?_0x2e6bb1[_0x5936('0x18')][_0x5936('0x1b')]||null:null,'include':_0x2e6bb1[_0x5936('0x18')]?_0x2e6bb1['options'][_0x5936('0x1c')]?_[_0x5936('0x1d')](_0x2e6bb1[_0x5936('0x18')][_0x5936('0x1c')],function(_0x103995){return{'model':db[_0x103995[_0x5936('0x1e')]],'as':_0x103995['as'],'attributes':_0x103995[_0x5936('0x1f')],'include':_0x103995[_0x5936('0x1c')]?_[_0x5936('0x1d')](_0x103995['include'],function(_0x170a24){return{'model':db[_0x170a24[_0x5936('0x1e')]],'as':_0x170a24['as'],'attributes':_0x170a24[_0x5936('0x1f')],'include':_0x170a24[_0x5936('0x1c')]?_[_0x5936('0x1d')](_0x170a24[_0x5936('0x1c')],function(_0x24d9fd){return{'model':db[_0x24d9fd[_0x5936('0x1e')]],'as':_0x24d9fd['as'],'attributes':_0x24d9fd[_0x5936('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5936('0xd')](function(_0x59bb20){logger['info'](_0x5936('0x20'),_0x2e6bb1);logger[_0x5936('0xf')](_0x5936('0x20'),_0x2e6bb1,JSON['stringify'](_0x59bb20));_0x2b9fc7(_0x59bb20);})['catch'](function(_0x20f121){logger[_0x5936('0x11')](_0x5936('0x20'),_0x20f121[_0x5936('0x14')],_0x2e6bb1);_0x3211b2(_0x33061e[_0x5936('0x11')](0x1f4,_0x20f121[_0x5936('0x14')]));});});};exports[_0x5936('0x21')]=function(_0x57b6f8){var _0x16bd49=this;return new Promise(function(_0x1244c2,_0x30d334){return db[_0x5936('0x17')][_0x5936('0x22')]({'raw':_0x57b6f8[_0x5936('0x18')]?_0x57b6f8[_0x5936('0x18')][_0x5936('0x19')]===undefined?!![]:![]:!![],'where':_0x57b6f8[_0x5936('0x18')]?_0x57b6f8[_0x5936('0x18')][_0x5936('0x1a')]||null:null,'attributes':_0x57b6f8[_0x5936('0x18')]?_0x57b6f8['options']['attributes']||null:null,'include':_0x57b6f8[_0x5936('0x18')]?_0x57b6f8[_0x5936('0x18')][_0x5936('0x1c')]?_[_0x5936('0x1d')](_0x57b6f8[_0x5936('0x18')][_0x5936('0x1c')],function(_0x265808){return{'model':db[_0x265808['model']],'as':_0x265808['as'],'attributes':_0x265808[_0x5936('0x1f')],'include':_0x265808[_0x5936('0x1c')]?_[_0x5936('0x1d')](_0x265808[_0x5936('0x1c')],function(_0x3ca00b){return{'model':db[_0x3ca00b[_0x5936('0x1e')]],'as':_0x3ca00b['as'],'attributes':_0x3ca00b[_0x5936('0x1f')],'include':_0x3ca00b[_0x5936('0x1c')]?_[_0x5936('0x1d')](_0x3ca00b[_0x5936('0x1c')],function(_0x3ca948){return{'model':db[_0x3ca948[_0x5936('0x1e')]],'as':_0x3ca948['as'],'attributes':_0x3ca948[_0x5936('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5936('0xd')](function(_0x52b7e7){logger[_0x5936('0x15')](_0x5936('0x21'),_0x57b6f8);logger[_0x5936('0xf')]('ShowZendeskAccount',_0x57b6f8,JSON[_0x5936('0x23')](_0x52b7e7));_0x1244c2(_0x52b7e7);})[_0x5936('0x24')](function(_0x15ebe3){logger['error'](_0x5936('0x21'),_0x15ebe3[_0x5936('0x14')],_0x57b6f8);_0x30d334(_0x16bd49['error'](0x1f4,_0x15ebe3['message']));});});}; \ No newline at end of file +var _0xdb2f=['../../mysqldb','../../config/utils','rpc','client','http','request','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','catch','ShowZendeskAccount','util','moment','bluebird','ioredis'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xdb2f,0x1d8));var _0xfdb2=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xdb2f[_0x376b45];return _0x2341b3;};'use strict';var _=require('lodash');var util=require(_0xfdb2('0x0'));var moment=require(_0xfdb2('0x1'));var BPromise=require(_0xfdb2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfdb2('0x3'));var db=require(_0xfdb2('0x4'))['db'];var utils=require(_0xfdb2('0x5'));var logger=require('../../config/logger')(_0xfdb2('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfdb2('0x7')][_0xfdb2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b7763,_0x2607e8,_0x469433){return new BPromise(function(_0x50718d,_0x87e9ab){return client[_0xfdb2('0x9')](_0x5b7763,_0x469433)['then'](function(_0x4c8641){logger[_0xfdb2('0xa')](_0xfdb2('0xb'),_0x2607e8,'request\x20sent');logger[_0xfdb2('0xc')](_0xfdb2('0xd'),_0x2607e8,'request\x20sent',JSON[_0xfdb2('0xe')](_0x4c8641));if(_0x4c8641[_0xfdb2('0xf')]){if(_0x4c8641['error'][_0xfdb2('0x10')]===0x1f4){logger[_0xfdb2('0xf')](_0xfdb2('0xb'),_0x2607e8,_0x4c8641['error'][_0xfdb2('0x11')]);return _0x87e9ab(_0x4c8641[_0xfdb2('0xf')][_0xfdb2('0x11')]);}logger[_0xfdb2('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x2607e8,_0x4c8641[_0xfdb2('0xf')]['message']);return _0x50718d(_0x4c8641['error'][_0xfdb2('0x11')]);}else{logger['info'](_0xfdb2('0xb'),_0x2607e8,_0xfdb2('0x12'));_0x50718d(_0x4c8641[_0xfdb2('0x13')]['message']);}})['catch'](function(_0x2c66aa){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x2607e8,_0x2c66aa);_0x87e9ab(_0x2c66aa);});});}exports[_0xfdb2('0x14')]=function(_0x3b5bab){var _0x1284a4=this;return new Promise(function(_0x56c9b8,_0x3e6f8c){return db[_0xfdb2('0x15')][_0xfdb2('0x16')]({'raw':_0x3b5bab[_0xfdb2('0x17')]?_0x3b5bab[_0xfdb2('0x17')][_0xfdb2('0x18')]===undefined?!![]:![]:!![],'where':_0x3b5bab[_0xfdb2('0x17')]?_0x3b5bab[_0xfdb2('0x17')][_0xfdb2('0x19')]||null:null,'attributes':_0x3b5bab['options']?_0x3b5bab[_0xfdb2('0x17')][_0xfdb2('0x1a')]||null:null,'limit':_0x3b5bab[_0xfdb2('0x17')]?_0x3b5bab['options'][_0xfdb2('0x1b')]||null:null,'include':_0x3b5bab[_0xfdb2('0x17')]?_0x3b5bab['options']['include']?_[_0xfdb2('0x1c')](_0x3b5bab[_0xfdb2('0x17')][_0xfdb2('0x1d')],function(_0x1809c5){return{'model':db[_0x1809c5[_0xfdb2('0x1e')]],'as':_0x1809c5['as'],'attributes':_0x1809c5[_0xfdb2('0x1a')],'include':_0x1809c5[_0xfdb2('0x1d')]?_[_0xfdb2('0x1c')](_0x1809c5[_0xfdb2('0x1d')],function(_0x552c24){return{'model':db[_0x552c24[_0xfdb2('0x1e')]],'as':_0x552c24['as'],'attributes':_0x552c24[_0xfdb2('0x1a')],'include':_0x552c24[_0xfdb2('0x1d')]?_[_0xfdb2('0x1c')](_0x552c24['include'],function(_0x4fa379){return{'model':db[_0x4fa379[_0xfdb2('0x1e')]],'as':_0x4fa379['as'],'attributes':_0x4fa379['attributes']};}):[]};}):[]};}):[]:[]})[_0xfdb2('0x1f')](function(_0x57453c){logger[_0xfdb2('0xa')]('GetZendeskAccount',_0x3b5bab);logger['debug']('GetZendeskAccount',_0x3b5bab,JSON['stringify'](_0x57453c));_0x56c9b8(_0x57453c);})[_0xfdb2('0x20')](function(_0x4a3a9b){logger[_0xfdb2('0xf')]('GetZendeskAccount',_0x4a3a9b[_0xfdb2('0x11')],_0x3b5bab);_0x3e6f8c(_0x1284a4[_0xfdb2('0xf')](0x1f4,_0x4a3a9b[_0xfdb2('0x11')]));});});};exports[_0xfdb2('0x21')]=function(_0x5a721a){var _0x1cad66=this;return new Promise(function(_0x28be18,_0xf73749){return db['ZendeskAccount']['find']({'raw':_0x5a721a[_0xfdb2('0x17')]?_0x5a721a['options'][_0xfdb2('0x18')]===undefined?!![]:![]:!![],'where':_0x5a721a[_0xfdb2('0x17')]?_0x5a721a['options'][_0xfdb2('0x19')]||null:null,'attributes':_0x5a721a[_0xfdb2('0x17')]?_0x5a721a[_0xfdb2('0x17')][_0xfdb2('0x1a')]||null:null,'include':_0x5a721a[_0xfdb2('0x17')]?_0x5a721a[_0xfdb2('0x17')][_0xfdb2('0x1d')]?_[_0xfdb2('0x1c')](_0x5a721a[_0xfdb2('0x17')][_0xfdb2('0x1d')],function(_0x4e4f41){return{'model':db[_0x4e4f41[_0xfdb2('0x1e')]],'as':_0x4e4f41['as'],'attributes':_0x4e4f41[_0xfdb2('0x1a')],'include':_0x4e4f41[_0xfdb2('0x1d')]?_['map'](_0x4e4f41[_0xfdb2('0x1d')],function(_0x14d88d){return{'model':db[_0x14d88d[_0xfdb2('0x1e')]],'as':_0x14d88d['as'],'attributes':_0x14d88d[_0xfdb2('0x1a')],'include':_0x14d88d[_0xfdb2('0x1d')]?_[_0xfdb2('0x1c')](_0x14d88d[_0xfdb2('0x1d')],function(_0x202a37){return{'model':db[_0x202a37[_0xfdb2('0x1e')]],'as':_0x202a37['as'],'attributes':_0x202a37[_0xfdb2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xfdb2('0x1f')](function(_0x4f27ce){logger[_0xfdb2('0xa')](_0xfdb2('0x21'),_0x5a721a);logger[_0xfdb2('0xc')](_0xfdb2('0x21'),_0x5a721a,JSON[_0xfdb2('0xe')](_0x4f27ce));_0x28be18(_0x4f27ce);})[_0xfdb2('0x20')](function(_0x445c1f){logger['error']('ShowZendeskAccount',_0x445c1f[_0xfdb2('0x11')],_0x5a721a);_0xf73749(_0x1cad66['error'](0x1f4,_0x445c1f['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index bc0aa4d..2911ec8 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 _0x91a7=['util','path','connect-timeout','Router','../../components/auth/service','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','put','update','destroy','exports'];(function(_0x4de9f0,_0xe6d3c2){var _0xef3da5=function(_0x3ce1c0){while(--_0x3ce1c0){_0x4de9f0['push'](_0x4de9f0['shift']());}};_0xef3da5(++_0xe6d3c2);}(_0x91a7,0xe7));var _0x791a=function(_0x43f47e,_0x54f8a1){_0x43f47e=_0x43f47e-0x0;var _0x2635be=_0x91a7[_0x43f47e];return _0x2635be;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var timeout=require(_0x791a('0x2'));var express=require('express');var router=express[_0x791a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x791a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x791a('0x5'));router[_0x791a('0x6')]('/',auth['isAuthenticated'](),controller[_0x791a('0x7')]);router['get'](_0x791a('0x8'),auth[_0x791a('0x9')](),controller['show']);router[_0x791a('0x6')](_0x791a('0xa'),auth[_0x791a('0x9')](),controller[_0x791a('0xb')]);router[_0x791a('0x6')]('/:id/subjects',auth[_0x791a('0x9')](),controller[_0x791a('0xc')]);router['get'](_0x791a('0xd'),auth[_0x791a('0x9')](),controller[_0x791a('0xe')]);router[_0x791a('0x6')](_0x791a('0xf'),auth[_0x791a('0x9')](),controller['getTags']);router['post']('/',auth[_0x791a('0x9')](),controller[_0x791a('0x10')]);router['post'](_0x791a('0xf'),auth[_0x791a('0x9')](),controller['setTags']);router[_0x791a('0x11')](_0x791a('0x8'),auth[_0x791a('0x9')](),controller[_0x791a('0x12')]);router['delete'](_0x791a('0x8'),auth['isAuthenticated'](),controller[_0x791a('0x13')]);module[_0x791a('0x14')]=router; \ No newline at end of file +var _0x750a=['getTags','post','setTags','put','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/tags'];(function(_0x278a09,_0x3af5ef){var _0x137bc0=function(_0x1f1786){while(--_0x1f1786){_0x278a09['push'](_0x278a09['shift']());}};_0x137bc0(++_0x3af5ef);}(_0x750a,0x140));var _0xa750=function(_0x54dc7e,_0x507956){_0x54dc7e=_0x54dc7e-0x0;var _0x2114d1=_0x750a[_0x54dc7e];return _0x2114d1;};'use strict';var multer=require('multer');var util=require(_0xa750('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa750('0x1'));var router=express[_0xa750('0x2')]();var fs_extra=require(_0xa750('0x3'));var auth=require(_0xa750('0x4'));var interaction=require(_0xa750('0x5'));var config=require(_0xa750('0x6'));var controller=require(_0xa750('0x7'));router[_0xa750('0x8')]('/',auth[_0xa750('0x9')](),controller[_0xa750('0xa')]);router[_0xa750('0x8')](_0xa750('0xb'),auth[_0xa750('0x9')](),controller['show']);router['get'](_0xa750('0xc'),auth['isAuthenticated'](),controller[_0xa750('0xd')]);router[_0xa750('0x8')]('/:id/subjects',auth[_0xa750('0x9')](),controller[_0xa750('0xe')]);router['get']('/:id/descriptions',auth[_0xa750('0x9')](),controller['getDescriptions']);router[_0xa750('0x8')](_0xa750('0xf'),auth['isAuthenticated'](),controller[_0xa750('0x10')]);router[_0xa750('0x11')]('/',auth[_0xa750('0x9')](),controller['create']);router[_0xa750('0x11')](_0xa750('0xf'),auth[_0xa750('0x9')](),controller[_0xa750('0x12')]);router[_0xa750('0x13')](_0xa750('0xb'),auth['isAuthenticated'](),controller[_0xa750('0x14')]);router[_0xa750('0x15')](_0xa750('0xb'),auth['isAuthenticated'](),controller[_0xa750('0x16')]);module[_0xa750('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index a3e61a6..a1b8556 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 _0x045e=['STRING','sequelize','exports'];(function(_0x4d5cfd,_0x5b5c6c){var _0x442f17=function(_0x32a375){while(--_0x32a375){_0x4d5cfd['push'](_0x4d5cfd['shift']());}};_0x442f17(++_0x5b5c6c);}(_0x045e,0x1c6));var _0xe045=function(_0x30aadd,_0x20a265){_0x30aadd=_0x30aadd-0x0;var _0x428865=_0x045e[_0x30aadd];return _0x428865;};'use strict';var Sequelize=require(_0xe045('0x0'));module[_0xe045('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe045('0x2')]}}; \ No newline at end of file +var _0x6840=['exports','STRING','sequelize'];(function(_0x4f7782,_0x175079){var _0x21e9aa=function(_0x1fba01){while(--_0x1fba01){_0x4f7782['push'](_0x4f7782['shift']());}};_0x21e9aa(++_0x175079);}(_0x6840,0x119));var _0x0684=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x6840[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x0684('0x0'));module[_0x0684('0x1')]={'name':{'type':Sequelize[_0x0684('0x2')]},'description':{'type':Sequelize[_0x0684('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 50c6779..77938ef 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 _0xdb14=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','findOne','ZendeskField','filter','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x17de89,_0x52e8eb){var _0x3e9712=function(_0x54791e){while(--_0x54791e){_0x17de89['push'](_0x17de89['shift']());}};_0x3e9712(++_0x52e8eb);}(_0xdb14,0x145));var _0x4db1=function(_0x2341ab,_0x326a6c){_0x2341ab=_0x2341ab-0x0;var _0x54533e=_0xdb14[_0x2341ab];return _0x54533e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4db1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4db1('0x1'));var rp=require(_0x4db1('0x2'));var moment=require('moment');var BPromise=require(_0x4db1('0x3'));var Mustache=require(_0x4db1('0x4'));var util=require(_0x4db1('0x5'));var path=require(_0x4db1('0x6'));var sox=require(_0x4db1('0x7'));var csv=require('to-csv');var ejs=require(_0x4db1('0x8'));var fs=require('fs');var fs_extra=require(_0x4db1('0x9'));var _=require(_0x4db1('0xa'));var squel=require(_0x4db1('0xb'));var crypto=require('crypto');var jsforce=require(_0x4db1('0xc'));var deskjs=require(_0x4db1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4db1('0xe'));var Papa=require(_0x4db1('0xf'));var Redis=require(_0x4db1('0x10'));var authService=require(_0x4db1('0x11'));var qs=require(_0x4db1('0x12'));var as=require(_0x4db1('0x13'));var hardwareService=require(_0x4db1('0x14'));var logger=require(_0x4db1('0x15'))('api');var utils=require(_0x4db1('0x16'));var config=require(_0x4db1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x4db1('0x18'))['db'];function respondWithStatusCode(_0x41e9c7,_0x3bfd65){_0x3bfd65=_0x3bfd65||0xcc;return function(_0x4c6186){if(_0x4c6186){return _0x41e9c7[_0x4db1('0x19')](_0x3bfd65);}return _0x41e9c7[_0x4db1('0x1a')](_0x3bfd65)[_0x4db1('0x1b')]();};}function respondWithResult(_0x493ea0,_0x34c35e){_0x34c35e=_0x34c35e||0xc8;return function(_0x488b26){if(_0x488b26){return _0x493ea0['status'](_0x34c35e)[_0x4db1('0x1c')](_0x488b26);}};}function respondWithFilteredResult(_0x5ceb70,_0x4e6da2){return function(_0x17c41f){if(_0x17c41f){var _0x381dbd=typeof _0x4e6da2[_0x4db1('0x1d')]===_0x4db1('0x1e')&&typeof _0x4e6da2[_0x4db1('0x1f')]===_0x4db1('0x1e');var _0x3a2c17=_0x17c41f[_0x4db1('0x20')];var _0x5efd5d=_0x381dbd?0x0:_0x4e6da2[_0x4db1('0x1d')];var _0x337d55=_0x381dbd?_0x17c41f[_0x4db1('0x20')]:_0x4e6da2['offset']+_0x4e6da2['limit'];var _0x5a282b;if(_0x337d55>=_0x3a2c17){_0x337d55=_0x3a2c17;_0x5a282b=0xc8;}else{_0x5a282b=0xce;}_0x5ceb70[_0x4db1('0x1a')](_0x5a282b);return _0x5ceb70[_0x4db1('0x21')](_0x4db1('0x22'),_0x5efd5d+'-'+_0x337d55+'/'+_0x3a2c17)[_0x4db1('0x1c')](_0x17c41f);}return null;};}function patchUpdates(_0x422ddf){return function(_0x4b152a){try{jsonpatch[_0x4db1('0x23')](_0x4b152a,_0x422ddf,!![]);}catch(_0x1bad30){return BPromise[_0x4db1('0x24')](_0x1bad30);}return _0x4b152a[_0x4db1('0x25')]();};}function saveUpdates(_0x144a37,_0x551b18){return function(_0x2031c0){if(_0x2031c0){return _0x2031c0[_0x4db1('0x26')](_0x144a37)[_0x4db1('0x27')](function(_0x12f56b){return _0x12f56b;});}return null;};}function removeEntity(_0xde4479,_0xf0ff8f){return function(_0x12e6c6){if(_0x12e6c6){return _0x12e6c6[_0x4db1('0x28')]()[_0x4db1('0x27')](function(){_0xde4479[_0x4db1('0x1a')](0xcc)[_0x4db1('0x1b')]();});}};}function handleEntityNotFound(_0x481458,_0x435e98){return function(_0x270be0){if(!_0x270be0){_0x481458['sendStatus'](0x194);}return _0x270be0;};}function handleError(_0x46f1f7,_0x13b555){_0x13b555=_0x13b555||0x1f4;return function(_0x5eb4ef){logger['error'](_0x5eb4ef[_0x4db1('0x29')]);if(_0x5eb4ef[_0x4db1('0x2a')]){delete _0x5eb4ef[_0x4db1('0x2a')];}_0x46f1f7['status'](_0x13b555)[_0x4db1('0x2b')](_0x5eb4ef);};}exports[_0x4db1('0x2c')]=function(_0x299b07,_0x29857f){var _0x229833={},_0x49ab72={},_0x29d235={'count':0x0,'rows':[]};var _0x1cfc76=_['map'](db[_0x4db1('0x2d')][_0x4db1('0x2e')],function(_0x4b3f41){return{'name':_0x4b3f41[_0x4db1('0x2f')],'type':_0x4b3f41[_0x4db1('0x30')][_0x4db1('0x31')]};});_0x49ab72[_0x4db1('0x32')]=_[_0x4db1('0x33')](_0x1cfc76,'name');_0x49ab72['query']=_[_0x4db1('0x34')](_0x299b07[_0x4db1('0x35')]);_0x49ab72[_0x4db1('0x36')]=_[_0x4db1('0x37')](_0x49ab72[_0x4db1('0x32')],_0x49ab72['query']);_0x229833['attributes']=_[_0x4db1('0x37')](_0x49ab72[_0x4db1('0x32')],qs[_0x4db1('0x38')](_0x299b07['query'][_0x4db1('0x38')]));_0x229833[_0x4db1('0x39')]=_0x229833[_0x4db1('0x39')][_0x4db1('0x3a')]?_0x229833[_0x4db1('0x39')]:_0x49ab72['model'];if(!_0x299b07[_0x4db1('0x35')][_0x4db1('0x3b')](_0x4db1('0x3c'))){_0x229833['limit']=qs[_0x4db1('0x1f')](_0x299b07[_0x4db1('0x35')]['limit']);_0x229833[_0x4db1('0x1d')]=qs[_0x4db1('0x1d')](_0x299b07['query']['offset']);}_0x229833[_0x4db1('0x3d')]=qs[_0x4db1('0x3e')](_0x299b07[_0x4db1('0x35')][_0x4db1('0x3e')]);_0x229833['where']=qs['filters'](_[_0x4db1('0x3f')](_0x299b07[_0x4db1('0x35')],_0x49ab72[_0x4db1('0x36')]),_0x1cfc76);if(_0x299b07[_0x4db1('0x35')]['filter']){_0x229833['where']=_[_0x4db1('0x40')](_0x229833[_0x4db1('0x41')],{'$or':_[_0x4db1('0x33')](_0x1cfc76,function(_0x54113f){if(_0x54113f[_0x4db1('0x30')]!==_0x4db1('0x42')){var _0x1828e5={};_0x1828e5[_0x54113f[_0x4db1('0x2a')]]={'$like':'%'+_0x299b07['query']['filter']+'%'};return _0x1828e5;}})});}_0x229833=_[_0x4db1('0x40')]({},_0x229833,_0x299b07[_0x4db1('0x43')]);var _0x546d5a={'where':_0x229833['where']};return db[_0x4db1('0x2d')][_0x4db1('0x20')](_0x546d5a)[_0x4db1('0x27')](function(_0x3bc0e3){_0x29d235[_0x4db1('0x20')]=_0x3bc0e3;if(_0x299b07[_0x4db1('0x35')][_0x4db1('0x44')]){_0x229833[_0x4db1('0x45')]=[{'all':!![]}];}return db[_0x4db1('0x2d')][_0x4db1('0x46')](_0x229833);})[_0x4db1('0x27')](function(_0x1e6ce8){_0x29d235[_0x4db1('0x47')]=_0x1e6ce8;return _0x29d235;})['then'](respondWithFilteredResult(_0x29857f,_0x229833))[_0x4db1('0x48')](handleError(_0x29857f,null));};exports[_0x4db1('0x49')]=function(_0x13c0ed,_0x478820){var _0x34cee2={'raw':![],'where':{'id':_0x13c0ed[_0x4db1('0x4a')]['id']}},_0x56bf8d={};_0x56bf8d[_0x4db1('0x32')]=_['keys'](db['ZendeskConfiguration']['rawAttributes']);_0x56bf8d[_0x4db1('0x35')]=_['keys'](_0x13c0ed[_0x4db1('0x35')]);_0x56bf8d[_0x4db1('0x36')]=_[_0x4db1('0x37')](_0x56bf8d[_0x4db1('0x32')],_0x56bf8d['query']);_0x34cee2[_0x4db1('0x39')]=_[_0x4db1('0x37')](_0x56bf8d[_0x4db1('0x32')],qs[_0x4db1('0x38')](_0x13c0ed[_0x4db1('0x35')][_0x4db1('0x38')]));_0x34cee2[_0x4db1('0x39')]=_0x34cee2[_0x4db1('0x39')][_0x4db1('0x3a')]?_0x34cee2[_0x4db1('0x39')]:_0x56bf8d[_0x4db1('0x32')];if(_0x13c0ed[_0x4db1('0x35')][_0x4db1('0x44')]){_0x34cee2['include']=[{'all':!![]}];}_0x34cee2=_[_0x4db1('0x40')]({},_0x34cee2,_0x13c0ed[_0x4db1('0x43')]);return db[_0x4db1('0x2d')]['find'](_0x34cee2)['then'](handleEntityNotFound(_0x478820,null))[_0x4db1('0x27')](respondWithResult(_0x478820,null))[_0x4db1('0x48')](handleError(_0x478820,null));};exports[_0x4db1('0x4b')]=function(_0x4f6786,_0x51c2fa){return db['ZendeskConfiguration'][_0x4db1('0x4b')](_0x4f6786[_0x4db1('0x4c')],{})[_0x4db1('0x27')](respondWithResult(_0x51c2fa,0xc9))[_0x4db1('0x48')](handleError(_0x51c2fa,null));};exports[_0x4db1('0x26')]=function(_0x4f0431,_0xd8c88b){if(_0x4f0431[_0x4db1('0x4c')]['id']){delete _0x4f0431[_0x4db1('0x4c')]['id'];}return db['ZendeskConfiguration'][_0x4db1('0x4d')]({'where':{'id':_0x4f0431['params']['id']}})[_0x4db1('0x27')](handleEntityNotFound(_0xd8c88b,null))['then'](saveUpdates(_0x4f0431[_0x4db1('0x4c')],null))[_0x4db1('0x27')](respondWithResult(_0xd8c88b,null))[_0x4db1('0x48')](handleError(_0xd8c88b,null));};exports['destroy']=function(_0xb8a625,_0x3296dc){return db[_0x4db1('0x2d')][_0x4db1('0x4d')]({'where':{'id':_0xb8a625[_0x4db1('0x4a')]['id']}})[_0x4db1('0x27')](handleEntityNotFound(_0x3296dc,null))[_0x4db1('0x27')](removeEntity(_0x3296dc,null))['catch'](handleError(_0x3296dc,null));};exports['getFields']=function(_0x4a83ba,_0x172d8d,_0x3b0fc0){var _0x5cde6d={};var _0xea203b={};var _0xef8622;var _0x3c832f;return db[_0x4db1('0x2d')][_0x4db1('0x4e')]({'where':{'id':_0x4a83ba[_0x4db1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x172d8d,null))['then'](function(_0x896e25){if(_0x896e25){_0xef8622=_0x896e25;_0xea203b[_0x4db1('0x32')]=_[_0x4db1('0x34')](db[_0x4db1('0x4f')][_0x4db1('0x2e')]);_0xea203b[_0x4db1('0x35')]=_[_0x4db1('0x34')](_0x4a83ba['query']);_0xea203b[_0x4db1('0x36')]=_['intersection'](_0xea203b[_0x4db1('0x32')],_0xea203b[_0x4db1('0x35')]);_0x5cde6d[_0x4db1('0x39')]=_[_0x4db1('0x37')](_0xea203b[_0x4db1('0x32')],qs[_0x4db1('0x38')](_0x4a83ba[_0x4db1('0x35')][_0x4db1('0x38')]));_0x5cde6d['attributes']=_0x5cde6d[_0x4db1('0x39')][_0x4db1('0x3a')]?_0x5cde6d[_0x4db1('0x39')]:_0xea203b['model'];_0x5cde6d[_0x4db1('0x3d')]=qs[_0x4db1('0x3e')](_0x4a83ba[_0x4db1('0x35')][_0x4db1('0x3e')]);_0x5cde6d[_0x4db1('0x41')]=qs[_0x4db1('0x36')](_[_0x4db1('0x3f')](_0x4a83ba[_0x4db1('0x35')],_0xea203b[_0x4db1('0x36')]));if(_0x4a83ba[_0x4db1('0x35')][_0x4db1('0x50')]){_0x5cde6d['where']=_['merge'](_0x5cde6d[_0x4db1('0x41')],{'$or':_[_0x4db1('0x33')](_0x5cde6d['attributes'],function(_0x428e16){var _0x32aebc={};_0x32aebc[_0x428e16]={'$like':'%'+_0x4a83ba[_0x4db1('0x35')][_0x4db1('0x50')]+'%'};return _0x32aebc;})});}_0x5cde6d=_[_0x4db1('0x40')]({},_0x5cde6d,_0x4a83ba['options']);return _0xef8622[_0x4db1('0x51')](_0x5cde6d);}})[_0x4db1('0x27')](function(_0x206272){if(_0x206272){_0x3c832f=_0x206272[_0x4db1('0x3a')];if(!_0x4a83ba[_0x4db1('0x35')][_0x4db1('0x3b')](_0x4db1('0x3c'))){_0x5cde6d[_0x4db1('0x1f')]=qs[_0x4db1('0x1f')](_0x4a83ba[_0x4db1('0x35')][_0x4db1('0x1f')]);_0x5cde6d['offset']=qs[_0x4db1('0x1d')](_0x4a83ba[_0x4db1('0x35')][_0x4db1('0x1d')]);}return _0xef8622[_0x4db1('0x51')](_0x5cde6d);}})[_0x4db1('0x27')](function(_0x12fbdd){if(_0x12fbdd){return _0x12fbdd?{'count':_0x3c832f,'rows':_0x12fbdd}:null;}})[_0x4db1('0x27')](respondWithResult(_0x172d8d,null))[_0x4db1('0x48')](handleError(_0x172d8d,null));};exports[_0x4db1('0x52')]=function(_0x298fd6,_0x1b3b37,_0x4e6ada){var _0x499f5c={};var _0x485389={};var _0x11b963;var _0x1bc746;return db[_0x4db1('0x2d')]['findOne']({'where':{'id':_0x298fd6[_0x4db1('0x4a')]['id']}})[_0x4db1('0x27')](handleEntityNotFound(_0x1b3b37,null))[_0x4db1('0x27')](function(_0x2fcf38){if(_0x2fcf38){_0x11b963=_0x2fcf38;_0x485389[_0x4db1('0x32')]=_['keys'](db[_0x4db1('0x4f')]['rawAttributes']);_0x485389[_0x4db1('0x35')]=_[_0x4db1('0x34')](_0x298fd6[_0x4db1('0x35')]);_0x485389[_0x4db1('0x36')]=_[_0x4db1('0x37')](_0x485389['model'],_0x485389['query']);_0x499f5c[_0x4db1('0x39')]=_[_0x4db1('0x37')](_0x485389['model'],qs[_0x4db1('0x38')](_0x298fd6[_0x4db1('0x35')][_0x4db1('0x38')]));_0x499f5c[_0x4db1('0x39')]=_0x499f5c['attributes']['length']?_0x499f5c[_0x4db1('0x39')]:_0x485389['model'];_0x499f5c['order']=qs[_0x4db1('0x3e')](_0x298fd6[_0x4db1('0x35')][_0x4db1('0x3e')]);_0x499f5c[_0x4db1('0x41')]=qs['filters'](_['pick'](_0x298fd6[_0x4db1('0x35')],_0x485389['filters']));if(_0x298fd6['query'][_0x4db1('0x50')]){_0x499f5c['where']=_[_0x4db1('0x40')](_0x499f5c['where'],{'$or':_[_0x4db1('0x33')](_0x499f5c[_0x4db1('0x39')],function(_0x4fa072){var _0x5eaacc={};_0x5eaacc[_0x4fa072]={'$like':'%'+_0x298fd6[_0x4db1('0x35')][_0x4db1('0x50')]+'%'};return _0x5eaacc;})});}_0x499f5c=_['merge']({},_0x499f5c,_0x298fd6['options']);return _0x11b963[_0x4db1('0x52')](_0x499f5c);}})[_0x4db1('0x27')](function(_0x3549ea){if(_0x3549ea){_0x1bc746=_0x3549ea[_0x4db1('0x3a')];if(!_0x298fd6[_0x4db1('0x35')][_0x4db1('0x3b')]('nolimit')){_0x499f5c['limit']=qs[_0x4db1('0x1f')](_0x298fd6['query'][_0x4db1('0x1f')]);_0x499f5c['offset']=qs[_0x4db1('0x1d')](_0x298fd6[_0x4db1('0x35')][_0x4db1('0x1d')]);}return _0x11b963[_0x4db1('0x52')](_0x499f5c);}})[_0x4db1('0x27')](function(_0x36ac69){if(_0x36ac69){return _0x36ac69?{'count':_0x1bc746,'rows':_0x36ac69}:null;}})[_0x4db1('0x27')](respondWithResult(_0x1b3b37,null))[_0x4db1('0x48')](handleError(_0x1b3b37,null));};exports[_0x4db1('0x53')]=function(_0x2502b2,_0x57c8cb,_0xbef17){var _0xb7dae5={};var _0xcb6d7c={};var _0x38e464;var _0x324e4d;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x2502b2[_0x4db1('0x4a')]['id']}})[_0x4db1('0x27')](handleEntityNotFound(_0x57c8cb,null))[_0x4db1('0x27')](function(_0x193939){if(_0x193939){_0x38e464=_0x193939;_0xcb6d7c['model']=_['keys'](db[_0x4db1('0x4f')][_0x4db1('0x2e')]);_0xcb6d7c[_0x4db1('0x35')]=_['keys'](_0x2502b2['query']);_0xcb6d7c['filters']=_['intersection'](_0xcb6d7c[_0x4db1('0x32')],_0xcb6d7c[_0x4db1('0x35')]);_0xb7dae5['attributes']=_[_0x4db1('0x37')](_0xcb6d7c[_0x4db1('0x32')],qs[_0x4db1('0x38')](_0x2502b2[_0x4db1('0x35')]['fields']));_0xb7dae5[_0x4db1('0x39')]=_0xb7dae5['attributes'][_0x4db1('0x3a')]?_0xb7dae5['attributes']:_0xcb6d7c[_0x4db1('0x32')];_0xb7dae5[_0x4db1('0x3d')]=qs['sort'](_0x2502b2[_0x4db1('0x35')][_0x4db1('0x3e')]);_0xb7dae5[_0x4db1('0x41')]=qs[_0x4db1('0x36')](_[_0x4db1('0x3f')](_0x2502b2['query'],_0xcb6d7c[_0x4db1('0x36')]));if(_0x2502b2['query'][_0x4db1('0x50')]){_0xb7dae5['where']=_['merge'](_0xb7dae5[_0x4db1('0x41')],{'$or':_[_0x4db1('0x33')](_0xb7dae5[_0x4db1('0x39')],function(_0x22ec81){var _0x380871={};_0x380871[_0x22ec81]={'$like':'%'+_0x2502b2[_0x4db1('0x35')][_0x4db1('0x50')]+'%'};return _0x380871;})});}_0xb7dae5=_[_0x4db1('0x40')]({},_0xb7dae5,_0x2502b2['options']);return _0x38e464[_0x4db1('0x53')](_0xb7dae5);}})[_0x4db1('0x27')](function(_0x2b57f5){if(_0x2b57f5){_0x324e4d=_0x2b57f5[_0x4db1('0x3a')];if(!_0x2502b2[_0x4db1('0x35')][_0x4db1('0x3b')]('nolimit')){_0xb7dae5[_0x4db1('0x1f')]=qs[_0x4db1('0x1f')](_0x2502b2['query'][_0x4db1('0x1f')]);_0xb7dae5['offset']=qs[_0x4db1('0x1d')](_0x2502b2['query'][_0x4db1('0x1d')]);}return _0x38e464['getDescriptions'](_0xb7dae5);}})['then'](function(_0xf2b630){if(_0xf2b630){return _0xf2b630?{'count':_0x324e4d,'rows':_0xf2b630}:null;}})[_0x4db1('0x27')](respondWithResult(_0x57c8cb,null))[_0x4db1('0x48')](handleError(_0x57c8cb,null));};exports[_0x4db1('0x54')]=function(_0x589014,_0x2af772,_0x3454be){var _0xcdf579={};var _0x4c8978={};var _0x3cc781;var _0x3a6cba;return db['ZendeskConfiguration'][_0x4db1('0x4e')]({'where':{'id':_0x589014[_0x4db1('0x4a')]['id']}})[_0x4db1('0x27')](handleEntityNotFound(_0x2af772,null))[_0x4db1('0x27')](function(_0x343202){if(_0x343202){_0x3cc781=_0x343202;_0x4c8978[_0x4db1('0x32')]=_[_0x4db1('0x34')](db[_0x4db1('0x55')][_0x4db1('0x2e')]);_0x4c8978['query']=_[_0x4db1('0x34')](_0x589014['query']);_0x4c8978[_0x4db1('0x36')]=_[_0x4db1('0x37')](_0x4c8978[_0x4db1('0x32')],_0x4c8978[_0x4db1('0x35')]);_0xcdf579[_0x4db1('0x39')]=_[_0x4db1('0x37')](_0x4c8978[_0x4db1('0x32')],qs[_0x4db1('0x38')](_0x589014[_0x4db1('0x35')][_0x4db1('0x38')]));_0xcdf579[_0x4db1('0x39')]=_0xcdf579[_0x4db1('0x39')][_0x4db1('0x3a')]?_0xcdf579[_0x4db1('0x39')]:_0x4c8978['model'];_0xcdf579['order']=qs[_0x4db1('0x3e')](_0x589014[_0x4db1('0x35')][_0x4db1('0x3e')]);_0xcdf579[_0x4db1('0x41')]=qs[_0x4db1('0x36')](_[_0x4db1('0x3f')](_0x589014[_0x4db1('0x35')],_0x4c8978[_0x4db1('0x36')]));if(_0x589014['query'][_0x4db1('0x50')]){_0xcdf579[_0x4db1('0x41')]=_[_0x4db1('0x40')](_0xcdf579['where'],{'$or':_['map'](_0xcdf579[_0x4db1('0x39')],function(_0x59210a){var _0x4ed81e={};_0x4ed81e[_0x59210a]={'$like':'%'+_0x589014[_0x4db1('0x35')][_0x4db1('0x50')]+'%'};return _0x4ed81e;})});}_0xcdf579=_[_0x4db1('0x40')]({},_0xcdf579,_0x589014[_0x4db1('0x43')]);return _0x3cc781[_0x4db1('0x54')](_0xcdf579);}})[_0x4db1('0x27')](function(_0x2e743b){if(_0x2e743b){_0x3a6cba=_0x2e743b[_0x4db1('0x3a')];if(!_0x589014[_0x4db1('0x35')][_0x4db1('0x3b')](_0x4db1('0x3c'))){_0xcdf579[_0x4db1('0x1f')]=qs['limit'](_0x589014[_0x4db1('0x35')][_0x4db1('0x1f')]);_0xcdf579['offset']=qs[_0x4db1('0x1d')](_0x589014[_0x4db1('0x35')][_0x4db1('0x1d')]);}return _0x3cc781[_0x4db1('0x54')](_0xcdf579);}})[_0x4db1('0x27')](function(_0x1049d3){if(_0x1049d3){return _0x1049d3?{'count':_0x3a6cba,'rows':_0x1049d3}:null;}})[_0x4db1('0x27')](respondWithResult(_0x2af772,null))[_0x4db1('0x48')](handleError(_0x2af772,null));};exports[_0x4db1('0x56')]=function(_0x5bab6e,_0x184ea3,_0x1cae8d){if(_0x5bab6e['body']['id']){delete _0x5bab6e[_0x4db1('0x4c')]['id'];}return db[_0x4db1('0x2d')][_0x4db1('0x4e')]({'where':{'id':_0x5bab6e[_0x4db1('0x4a')]['id']}})[_0x4db1('0x27')](handleEntityNotFound(_0x184ea3,null))[_0x4db1('0x27')](function(_0x2953e9){if(_0x2953e9){return _0x2953e9[_0x4db1('0x56')](_0x5bab6e[_0x4db1('0x4c')][_0x4db1('0x57')]||[]);}return null;})[_0x4db1('0x27')](respondWithResult(_0x184ea3,null))[_0x4db1('0x48')](handleError(_0x184ea3,null));}; \ No newline at end of file +var _0x6cba=['nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','findOne','ZendeskField','pick','getSubjects','hasOwnProperty','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x573722,_0x21ae1b){var _0x41dc6b=function(_0x35a035){while(--_0x35a035){_0x573722['push'](_0x573722['shift']());}};_0x41dc6b(++_0x21ae1b);}(_0x6cba,0xc4));var _0xa6cb=function(_0x2b4895,_0x20c70a){_0x2b4895=_0x2b4895-0x0;var _0x569215=_0x6cba[_0x2b4895];return _0x569215;};'use strict';var emlformat=require(_0xa6cb('0x0'));var rimraf=require(_0xa6cb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa6cb('0x2'));var rp=require(_0xa6cb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa6cb('0x4'));var util=require(_0xa6cb('0x5'));var path=require(_0xa6cb('0x6'));var sox=require(_0xa6cb('0x7'));var csv=require(_0xa6cb('0x8'));var ejs=require(_0xa6cb('0x9'));var fs=require('fs');var fs_extra=require(_0xa6cb('0xa'));var _=require('lodash');var squel=require(_0xa6cb('0xb'));var crypto=require(_0xa6cb('0xc'));var jsforce=require(_0xa6cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa6cb('0x8'));var querystring=require(_0xa6cb('0xe'));var Papa=require(_0xa6cb('0xf'));var Redis=require(_0xa6cb('0x10'));var authService=require(_0xa6cb('0x11'));var qs=require(_0xa6cb('0x12'));var as=require(_0xa6cb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa6cb('0x14'))(_0xa6cb('0x15'));var utils=require('../../config/utils');var config=require(_0xa6cb('0x16'));var licenseUtil=require(_0xa6cb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x258b03,_0x3f90d9){_0x3f90d9=_0x3f90d9||0xcc;return function(_0x164f8e){if(_0x164f8e){return _0x258b03[_0xa6cb('0x18')](_0x3f90d9);}return _0x258b03['status'](_0x3f90d9)['end']();};}function respondWithResult(_0x4d2f39,_0x505984){_0x505984=_0x505984||0xc8;return function(_0x432502){if(_0x432502){return _0x4d2f39[_0xa6cb('0x19')](_0x505984)[_0xa6cb('0x1a')](_0x432502);}};}function respondWithFilteredResult(_0x59ab8c,_0xfbc9a6){return function(_0x46ec56){if(_0x46ec56){var _0x4badc5=typeof _0xfbc9a6[_0xa6cb('0x1b')]===_0xa6cb('0x1c')&&typeof _0xfbc9a6[_0xa6cb('0x1d')]==='undefined';var _0x3b3b4c=_0x46ec56[_0xa6cb('0x1e')];var _0x2dd95c=_0x4badc5?0x0:_0xfbc9a6[_0xa6cb('0x1b')];var _0xc01230=_0x4badc5?_0x46ec56[_0xa6cb('0x1e')]:_0xfbc9a6[_0xa6cb('0x1b')]+_0xfbc9a6[_0xa6cb('0x1d')];var _0x19958e;if(_0xc01230>=_0x3b3b4c){_0xc01230=_0x3b3b4c;_0x19958e=0xc8;}else{_0x19958e=0xce;}_0x59ab8c[_0xa6cb('0x19')](_0x19958e);return _0x59ab8c[_0xa6cb('0x1f')](_0xa6cb('0x20'),_0x2dd95c+'-'+_0xc01230+'/'+_0x3b3b4c)[_0xa6cb('0x1a')](_0x46ec56);}return null;};}function patchUpdates(_0x16b7f0){return function(_0x5bbe78){try{jsonpatch[_0xa6cb('0x21')](_0x5bbe78,_0x16b7f0,!![]);}catch(_0x2e92a2){return BPromise[_0xa6cb('0x22')](_0x2e92a2);}return _0x5bbe78['save']();};}function saveUpdates(_0xcdb4af,_0x2ec474){return function(_0x1a2144){if(_0x1a2144){return _0x1a2144[_0xa6cb('0x23')](_0xcdb4af)[_0xa6cb('0x24')](function(_0x9d484d){return _0x9d484d;});}return null;};}function removeEntity(_0x3de122,_0x39e00d){return function(_0x10dc7c){if(_0x10dc7c){return _0x10dc7c[_0xa6cb('0x25')]()['then'](function(){_0x3de122[_0xa6cb('0x19')](0xcc)[_0xa6cb('0x26')]();});}};}function handleEntityNotFound(_0x3d233e,_0x2e9d2f){return function(_0x42d3c3){if(!_0x42d3c3){_0x3d233e[_0xa6cb('0x18')](0x194);}return _0x42d3c3;};}function handleError(_0x5e55b0,_0x222efc){_0x222efc=_0x222efc||0x1f4;return function(_0x2ad117){logger[_0xa6cb('0x27')](_0x2ad117['stack']);if(_0x2ad117['name']){delete _0x2ad117[_0xa6cb('0x28')];}_0x5e55b0['status'](_0x222efc)['send'](_0x2ad117);};}exports[_0xa6cb('0x29')]=function(_0x2962d7,_0x5eac0b){var _0x39a5c9={},_0x407130={},_0x4d0bef={'count':0x0,'rows':[]};var _0x4298e6=_[_0xa6cb('0x2a')](db[_0xa6cb('0x2b')][_0xa6cb('0x2c')],function(_0x189988){return{'name':_0x189988[_0xa6cb('0x2d')],'type':_0x189988[_0xa6cb('0x2e')][_0xa6cb('0x2f')]};});_0x407130[_0xa6cb('0x30')]=_[_0xa6cb('0x2a')](_0x4298e6,_0xa6cb('0x28'));_0x407130[_0xa6cb('0x31')]=_[_0xa6cb('0x32')](_0x2962d7[_0xa6cb('0x31')]);_0x407130[_0xa6cb('0x33')]=_[_0xa6cb('0x34')](_0x407130['model'],_0x407130[_0xa6cb('0x31')]);_0x39a5c9[_0xa6cb('0x35')]=_[_0xa6cb('0x34')](_0x407130[_0xa6cb('0x30')],qs[_0xa6cb('0x36')](_0x2962d7['query']['fields']));_0x39a5c9['attributes']=_0x39a5c9[_0xa6cb('0x35')][_0xa6cb('0x37')]?_0x39a5c9[_0xa6cb('0x35')]:_0x407130[_0xa6cb('0x30')];if(!_0x2962d7[_0xa6cb('0x31')]['hasOwnProperty'](_0xa6cb('0x38'))){_0x39a5c9[_0xa6cb('0x1d')]=qs['limit'](_0x2962d7[_0xa6cb('0x31')][_0xa6cb('0x1d')]);_0x39a5c9[_0xa6cb('0x1b')]=qs['offset'](_0x2962d7['query']['offset']);}_0x39a5c9[_0xa6cb('0x39')]=qs['sort'](_0x2962d7['query'][_0xa6cb('0x3a')]);_0x39a5c9[_0xa6cb('0x3b')]=qs[_0xa6cb('0x33')](_['pick'](_0x2962d7[_0xa6cb('0x31')],_0x407130['filters']),_0x4298e6);if(_0x2962d7[_0xa6cb('0x31')][_0xa6cb('0x3c')]){_0x39a5c9['where']=_[_0xa6cb('0x3d')](_0x39a5c9['where'],{'$or':_[_0xa6cb('0x2a')](_0x4298e6,function(_0x35990c){if(_0x35990c[_0xa6cb('0x2e')]!==_0xa6cb('0x3e')){var _0x4a1ee4={};_0x4a1ee4[_0x35990c[_0xa6cb('0x28')]]={'$like':'%'+_0x2962d7[_0xa6cb('0x31')]['filter']+'%'};return _0x4a1ee4;}})});}_0x39a5c9=_['merge']({},_0x39a5c9,_0x2962d7[_0xa6cb('0x3f')]);var _0x535290={'where':_0x39a5c9[_0xa6cb('0x3b')]};return db[_0xa6cb('0x2b')][_0xa6cb('0x1e')](_0x535290)['then'](function(_0x48da78){_0x4d0bef[_0xa6cb('0x1e')]=_0x48da78;if(_0x2962d7[_0xa6cb('0x31')][_0xa6cb('0x40')]){_0x39a5c9[_0xa6cb('0x41')]=[{'all':!![]}];}return db[_0xa6cb('0x2b')][_0xa6cb('0x42')](_0x39a5c9);})[_0xa6cb('0x24')](function(_0x3b9bd4){_0x4d0bef[_0xa6cb('0x43')]=_0x3b9bd4;return _0x4d0bef;})[_0xa6cb('0x24')](respondWithFilteredResult(_0x5eac0b,_0x39a5c9))[_0xa6cb('0x44')](handleError(_0x5eac0b,null));};exports[_0xa6cb('0x45')]=function(_0x41e61f,_0x2566e1){var _0xb2d6b7={'raw':![],'where':{'id':_0x41e61f['params']['id']}},_0x4bd05c={};_0x4bd05c[_0xa6cb('0x30')]=_[_0xa6cb('0x32')](db['ZendeskConfiguration'][_0xa6cb('0x2c')]);_0x4bd05c[_0xa6cb('0x31')]=_['keys'](_0x41e61f[_0xa6cb('0x31')]);_0x4bd05c[_0xa6cb('0x33')]=_['intersection'](_0x4bd05c[_0xa6cb('0x30')],_0x4bd05c['query']);_0xb2d6b7['attributes']=_[_0xa6cb('0x34')](_0x4bd05c[_0xa6cb('0x30')],qs[_0xa6cb('0x36')](_0x41e61f[_0xa6cb('0x31')][_0xa6cb('0x36')]));_0xb2d6b7[_0xa6cb('0x35')]=_0xb2d6b7['attributes'][_0xa6cb('0x37')]?_0xb2d6b7[_0xa6cb('0x35')]:_0x4bd05c[_0xa6cb('0x30')];if(_0x41e61f[_0xa6cb('0x31')]['includeAll']){_0xb2d6b7[_0xa6cb('0x41')]=[{'all':!![]}];}_0xb2d6b7=_[_0xa6cb('0x3d')]({},_0xb2d6b7,_0x41e61f[_0xa6cb('0x3f')]);return db['ZendeskConfiguration'][_0xa6cb('0x46')](_0xb2d6b7)[_0xa6cb('0x24')](handleEntityNotFound(_0x2566e1,null))[_0xa6cb('0x24')](respondWithResult(_0x2566e1,null))[_0xa6cb('0x44')](handleError(_0x2566e1,null));};exports[_0xa6cb('0x47')]=function(_0x4b8d86,_0x3c6eb9){return db['ZendeskConfiguration']['create'](_0x4b8d86[_0xa6cb('0x48')],{})[_0xa6cb('0x24')](respondWithResult(_0x3c6eb9,0xc9))[_0xa6cb('0x44')](handleError(_0x3c6eb9,null));};exports[_0xa6cb('0x23')]=function(_0x172842,_0x3006e9){if(_0x172842[_0xa6cb('0x48')]['id']){delete _0x172842[_0xa6cb('0x48')]['id'];}return db[_0xa6cb('0x2b')][_0xa6cb('0x46')]({'where':{'id':_0x172842['params']['id']}})[_0xa6cb('0x24')](handleEntityNotFound(_0x3006e9,null))['then'](saveUpdates(_0x172842[_0xa6cb('0x48')],null))[_0xa6cb('0x24')](respondWithResult(_0x3006e9,null))[_0xa6cb('0x44')](handleError(_0x3006e9,null));};exports['destroy']=function(_0x4e4066,_0x31a730){return db[_0xa6cb('0x2b')]['find']({'where':{'id':_0x4e4066[_0xa6cb('0x49')]['id']}})[_0xa6cb('0x24')](handleEntityNotFound(_0x31a730,null))[_0xa6cb('0x24')](removeEntity(_0x31a730,null))[_0xa6cb('0x44')](handleError(_0x31a730,null));};exports['getFields']=function(_0x59b9f4,_0x3de63a,_0x224e5c){var _0x47cab8={};var _0x101b76={};var _0x32f44a;var _0x3a03dc;return db[_0xa6cb('0x2b')][_0xa6cb('0x4a')]({'where':{'id':_0x59b9f4[_0xa6cb('0x49')]['id']}})[_0xa6cb('0x24')](handleEntityNotFound(_0x3de63a,null))[_0xa6cb('0x24')](function(_0x56ccf1){if(_0x56ccf1){_0x32f44a=_0x56ccf1;_0x101b76[_0xa6cb('0x30')]=_[_0xa6cb('0x32')](db[_0xa6cb('0x4b')][_0xa6cb('0x2c')]);_0x101b76['query']=_[_0xa6cb('0x32')](_0x59b9f4[_0xa6cb('0x31')]);_0x101b76[_0xa6cb('0x33')]=_['intersection'](_0x101b76[_0xa6cb('0x30')],_0x101b76[_0xa6cb('0x31')]);_0x47cab8[_0xa6cb('0x35')]=_[_0xa6cb('0x34')](_0x101b76['model'],qs[_0xa6cb('0x36')](_0x59b9f4[_0xa6cb('0x31')][_0xa6cb('0x36')]));_0x47cab8[_0xa6cb('0x35')]=_0x47cab8[_0xa6cb('0x35')]['length']?_0x47cab8[_0xa6cb('0x35')]:_0x101b76[_0xa6cb('0x30')];_0x47cab8['order']=qs[_0xa6cb('0x3a')](_0x59b9f4[_0xa6cb('0x31')][_0xa6cb('0x3a')]);_0x47cab8[_0xa6cb('0x3b')]=qs[_0xa6cb('0x33')](_[_0xa6cb('0x4c')](_0x59b9f4['query'],_0x101b76[_0xa6cb('0x33')]));if(_0x59b9f4['query'][_0xa6cb('0x3c')]){_0x47cab8[_0xa6cb('0x3b')]=_[_0xa6cb('0x3d')](_0x47cab8['where'],{'$or':_['map'](_0x47cab8[_0xa6cb('0x35')],function(_0x5dd8c1){var _0x5e2daf={};_0x5e2daf[_0x5dd8c1]={'$like':'%'+_0x59b9f4[_0xa6cb('0x31')][_0xa6cb('0x3c')]+'%'};return _0x5e2daf;})});}_0x47cab8=_[_0xa6cb('0x3d')]({},_0x47cab8,_0x59b9f4[_0xa6cb('0x3f')]);return _0x32f44a['getFields'](_0x47cab8);}})[_0xa6cb('0x24')](function(_0x5a42d2){if(_0x5a42d2){_0x3a03dc=_0x5a42d2[_0xa6cb('0x37')];if(!_0x59b9f4['query']['hasOwnProperty'](_0xa6cb('0x38'))){_0x47cab8['limit']=qs[_0xa6cb('0x1d')](_0x59b9f4[_0xa6cb('0x31')][_0xa6cb('0x1d')]);_0x47cab8[_0xa6cb('0x1b')]=qs[_0xa6cb('0x1b')](_0x59b9f4[_0xa6cb('0x31')][_0xa6cb('0x1b')]);}return _0x32f44a['getFields'](_0x47cab8);}})[_0xa6cb('0x24')](function(_0x48ad71){if(_0x48ad71){return _0x48ad71?{'count':_0x3a03dc,'rows':_0x48ad71}:null;}})[_0xa6cb('0x24')](respondWithResult(_0x3de63a,null))[_0xa6cb('0x44')](handleError(_0x3de63a,null));};exports[_0xa6cb('0x4d')]=function(_0x2536f8,_0x5a2128,_0x4aff23){var _0x34d54c={};var _0x58cb70={};var _0x24f580;var _0x371284;return db['ZendeskConfiguration'][_0xa6cb('0x4a')]({'where':{'id':_0x2536f8['params']['id']}})['then'](handleEntityNotFound(_0x5a2128,null))['then'](function(_0x49e6bc){if(_0x49e6bc){_0x24f580=_0x49e6bc;_0x58cb70[_0xa6cb('0x30')]=_[_0xa6cb('0x32')](db[_0xa6cb('0x4b')][_0xa6cb('0x2c')]);_0x58cb70[_0xa6cb('0x31')]=_[_0xa6cb('0x32')](_0x2536f8[_0xa6cb('0x31')]);_0x58cb70[_0xa6cb('0x33')]=_[_0xa6cb('0x34')](_0x58cb70['model'],_0x58cb70[_0xa6cb('0x31')]);_0x34d54c[_0xa6cb('0x35')]=_['intersection'](_0x58cb70[_0xa6cb('0x30')],qs[_0xa6cb('0x36')](_0x2536f8['query'][_0xa6cb('0x36')]));_0x34d54c[_0xa6cb('0x35')]=_0x34d54c[_0xa6cb('0x35')][_0xa6cb('0x37')]?_0x34d54c[_0xa6cb('0x35')]:_0x58cb70[_0xa6cb('0x30')];_0x34d54c[_0xa6cb('0x39')]=qs[_0xa6cb('0x3a')](_0x2536f8['query']['sort']);_0x34d54c[_0xa6cb('0x3b')]=qs[_0xa6cb('0x33')](_[_0xa6cb('0x4c')](_0x2536f8[_0xa6cb('0x31')],_0x58cb70[_0xa6cb('0x33')]));if(_0x2536f8[_0xa6cb('0x31')][_0xa6cb('0x3c')]){_0x34d54c[_0xa6cb('0x3b')]=_[_0xa6cb('0x3d')](_0x34d54c[_0xa6cb('0x3b')],{'$or':_[_0xa6cb('0x2a')](_0x34d54c['attributes'],function(_0x1ef5ef){var _0x4c8ad0={};_0x4c8ad0[_0x1ef5ef]={'$like':'%'+_0x2536f8['query']['filter']+'%'};return _0x4c8ad0;})});}_0x34d54c=_[_0xa6cb('0x3d')]({},_0x34d54c,_0x2536f8[_0xa6cb('0x3f')]);return _0x24f580[_0xa6cb('0x4d')](_0x34d54c);}})['then'](function(_0x22f5b2){if(_0x22f5b2){_0x371284=_0x22f5b2[_0xa6cb('0x37')];if(!_0x2536f8['query']['hasOwnProperty'](_0xa6cb('0x38'))){_0x34d54c['limit']=qs['limit'](_0x2536f8[_0xa6cb('0x31')][_0xa6cb('0x1d')]);_0x34d54c['offset']=qs[_0xa6cb('0x1b')](_0x2536f8[_0xa6cb('0x31')][_0xa6cb('0x1b')]);}return _0x24f580['getSubjects'](_0x34d54c);}})[_0xa6cb('0x24')](function(_0x31bb52){if(_0x31bb52){return _0x31bb52?{'count':_0x371284,'rows':_0x31bb52}:null;}})[_0xa6cb('0x24')](respondWithResult(_0x5a2128,null))[_0xa6cb('0x44')](handleError(_0x5a2128,null));};exports['getDescriptions']=function(_0x26a073,_0x127ccd,_0x19346e){var _0x36a5e0={};var _0x263013={};var _0xb49dd9;var _0x349946;return db[_0xa6cb('0x2b')][_0xa6cb('0x4a')]({'where':{'id':_0x26a073[_0xa6cb('0x49')]['id']}})[_0xa6cb('0x24')](handleEntityNotFound(_0x127ccd,null))[_0xa6cb('0x24')](function(_0x2135a4){if(_0x2135a4){_0xb49dd9=_0x2135a4;_0x263013[_0xa6cb('0x30')]=_['keys'](db[_0xa6cb('0x4b')][_0xa6cb('0x2c')]);_0x263013[_0xa6cb('0x31')]=_['keys'](_0x26a073[_0xa6cb('0x31')]);_0x263013['filters']=_[_0xa6cb('0x34')](_0x263013[_0xa6cb('0x30')],_0x263013[_0xa6cb('0x31')]);_0x36a5e0[_0xa6cb('0x35')]=_[_0xa6cb('0x34')](_0x263013['model'],qs[_0xa6cb('0x36')](_0x26a073['query'][_0xa6cb('0x36')]));_0x36a5e0['attributes']=_0x36a5e0[_0xa6cb('0x35')][_0xa6cb('0x37')]?_0x36a5e0['attributes']:_0x263013[_0xa6cb('0x30')];_0x36a5e0[_0xa6cb('0x39')]=qs[_0xa6cb('0x3a')](_0x26a073[_0xa6cb('0x31')][_0xa6cb('0x3a')]);_0x36a5e0[_0xa6cb('0x3b')]=qs[_0xa6cb('0x33')](_['pick'](_0x26a073['query'],_0x263013['filters']));if(_0x26a073[_0xa6cb('0x31')]['filter']){_0x36a5e0[_0xa6cb('0x3b')]=_[_0xa6cb('0x3d')](_0x36a5e0[_0xa6cb('0x3b')],{'$or':_[_0xa6cb('0x2a')](_0x36a5e0[_0xa6cb('0x35')],function(_0x386aaf){var _0xd8a09b={};_0xd8a09b[_0x386aaf]={'$like':'%'+_0x26a073[_0xa6cb('0x31')][_0xa6cb('0x3c')]+'%'};return _0xd8a09b;})});}_0x36a5e0=_[_0xa6cb('0x3d')]({},_0x36a5e0,_0x26a073[_0xa6cb('0x3f')]);return _0xb49dd9['getDescriptions'](_0x36a5e0);}})['then'](function(_0x4c3196){if(_0x4c3196){_0x349946=_0x4c3196['length'];if(!_0x26a073['query'][_0xa6cb('0x4e')](_0xa6cb('0x38'))){_0x36a5e0[_0xa6cb('0x1d')]=qs['limit'](_0x26a073['query'][_0xa6cb('0x1d')]);_0x36a5e0[_0xa6cb('0x1b')]=qs['offset'](_0x26a073[_0xa6cb('0x31')]['offset']);}return _0xb49dd9[_0xa6cb('0x4f')](_0x36a5e0);}})[_0xa6cb('0x24')](function(_0x22542b){if(_0x22542b){return _0x22542b?{'count':_0x349946,'rows':_0x22542b}:null;}})['then'](respondWithResult(_0x127ccd,null))[_0xa6cb('0x44')](handleError(_0x127ccd,null));};exports[_0xa6cb('0x50')]=function(_0x337143,_0x3ee02a,_0x223ce9){var _0xd0905a={};var _0x2c32e5={};var _0x4c94f1;var _0x486ea8;return db[_0xa6cb('0x2b')][_0xa6cb('0x4a')]({'where':{'id':_0x337143[_0xa6cb('0x49')]['id']}})[_0xa6cb('0x24')](handleEntityNotFound(_0x3ee02a,null))[_0xa6cb('0x24')](function(_0x4ea798){if(_0x4ea798){_0x4c94f1=_0x4ea798;_0x2c32e5['model']=_[_0xa6cb('0x32')](db[_0xa6cb('0x51')][_0xa6cb('0x2c')]);_0x2c32e5['query']=_[_0xa6cb('0x32')](_0x337143['query']);_0x2c32e5['filters']=_[_0xa6cb('0x34')](_0x2c32e5[_0xa6cb('0x30')],_0x2c32e5[_0xa6cb('0x31')]);_0xd0905a[_0xa6cb('0x35')]=_[_0xa6cb('0x34')](_0x2c32e5['model'],qs[_0xa6cb('0x36')](_0x337143[_0xa6cb('0x31')][_0xa6cb('0x36')]));_0xd0905a[_0xa6cb('0x35')]=_0xd0905a[_0xa6cb('0x35')][_0xa6cb('0x37')]?_0xd0905a['attributes']:_0x2c32e5[_0xa6cb('0x30')];_0xd0905a[_0xa6cb('0x39')]=qs[_0xa6cb('0x3a')](_0x337143[_0xa6cb('0x31')]['sort']);_0xd0905a[_0xa6cb('0x3b')]=qs['filters'](_[_0xa6cb('0x4c')](_0x337143[_0xa6cb('0x31')],_0x2c32e5['filters']));if(_0x337143[_0xa6cb('0x31')][_0xa6cb('0x3c')]){_0xd0905a[_0xa6cb('0x3b')]=_[_0xa6cb('0x3d')](_0xd0905a[_0xa6cb('0x3b')],{'$or':_[_0xa6cb('0x2a')](_0xd0905a['attributes'],function(_0x1e1b20){var _0x4cfa9a={};_0x4cfa9a[_0x1e1b20]={'$like':'%'+_0x337143[_0xa6cb('0x31')][_0xa6cb('0x3c')]+'%'};return _0x4cfa9a;})});}_0xd0905a=_['merge']({},_0xd0905a,_0x337143[_0xa6cb('0x3f')]);return _0x4c94f1[_0xa6cb('0x50')](_0xd0905a);}})[_0xa6cb('0x24')](function(_0x1d1bb3){if(_0x1d1bb3){_0x486ea8=_0x1d1bb3[_0xa6cb('0x37')];if(!_0x337143[_0xa6cb('0x31')][_0xa6cb('0x4e')](_0xa6cb('0x38'))){_0xd0905a[_0xa6cb('0x1d')]=qs[_0xa6cb('0x1d')](_0x337143[_0xa6cb('0x31')]['limit']);_0xd0905a[_0xa6cb('0x1b')]=qs['offset'](_0x337143[_0xa6cb('0x31')][_0xa6cb('0x1b')]);}return _0x4c94f1[_0xa6cb('0x50')](_0xd0905a);}})[_0xa6cb('0x24')](function(_0x1ae2f0){if(_0x1ae2f0){return _0x1ae2f0?{'count':_0x486ea8,'rows':_0x1ae2f0}:null;}})['then'](respondWithResult(_0x3ee02a,null))['catch'](handleError(_0x3ee02a,null));};exports['setTags']=function(_0x15483c,_0x2e2ec2,_0x4116c7){if(_0x15483c[_0xa6cb('0x48')]['id']){delete _0x15483c[_0xa6cb('0x48')]['id'];}return db[_0xa6cb('0x2b')][_0xa6cb('0x4a')]({'where':{'id':_0x15483c['params']['id']}})[_0xa6cb('0x24')](handleEntityNotFound(_0x2e2ec2,null))['then'](function(_0x2e70bb){if(_0x2e70bb){return _0x2e70bb[_0xa6cb('0x52')](_0x15483c['body'][_0xa6cb('0x53')]||[]);}return null;})[_0xa6cb('0x24')](respondWithResult(_0x2e2ec2,null))['catch'](handleError(_0x2e2ec2,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 0eaf48d..505dfb6 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 _0x6a95=['bluebird','request-promise','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','lodash','util','../../config/logger','api','moment'];(function(_0x5d7085,_0xf719f4){var _0x400666=function(_0x59375c){while(--_0x59375c){_0x5d7085['push'](_0x5d7085['shift']());}};_0x400666(++_0xf719f4);}(_0x6a95,0x1db));var _0x56a9=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x6a95[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x56a9('0x0'));var util=require(_0x56a9('0x1'));var logger=require(_0x56a9('0x2'))(_0x56a9('0x3'));var moment=require(_0x56a9('0x4'));var BPromise=require(_0x56a9('0x5'));var rp=require(_0x56a9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x56a9('0x7'));var attributes=require(_0x56a9('0x8'));module[_0x56a9('0x9')]=function(_0x2eb132,_0x3c15b6){return _0x2eb132[_0x56a9('0xa')](_0x56a9('0xb'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x14a0=['../../config/logger','api','moment','bluebird','request-promise','path','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','int_zendesk_configurations','util'];(function(_0x1e12ce,_0x51ebbc){var _0x194a5d=function(_0x11b10f){while(--_0x11b10f){_0x1e12ce['push'](_0x1e12ce['shift']());}};_0x194a5d(++_0x51ebbc);}(_0x14a0,0x8e));var _0x014a=function(_0xa066f8,_0x4636af){_0xa066f8=_0xa066f8-0x0;var _0x2b5cb8=_0x14a0[_0xa066f8];return _0x2b5cb8;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var logger=require(_0x014a('0x1'))(_0x014a('0x2'));var moment=require(_0x014a('0x3'));var BPromise=require(_0x014a('0x4'));var rp=require(_0x014a('0x5'));var fs=require('fs');var path=require(_0x014a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x014a('0x7'));module[_0x014a('0x8')]=function(_0x38a22c,_0x5ec84d){return _0x38a22c['define'](_0x014a('0x9'),attributes,{'tableName':_0x014a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index f3c005c..c0775fc 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 _0x3bab=['client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger'];(function(_0x470168,_0x28e135){var _0x539ada=function(_0x13c55c){while(--_0x13c55c){_0x470168['push'](_0x470168['shift']());}};_0x539ada(++_0x28e135);}(_0x3bab,0xa5));var _0xb3ba=function(_0x528d1c,_0x178396){_0x528d1c=_0x528d1c-0x0;var _0x3b0a54=_0x3bab[_0x528d1c];return _0x3b0a54;};'use strict';var _=require(_0xb3ba('0x0'));var util=require(_0xb3ba('0x1'));var moment=require(_0xb3ba('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb3ba('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb3ba('0x4'));var logger=require(_0xb3ba('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb3ba('0x6')][_0xb3ba('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x160dff,_0x545adb,_0x1980fa){return new BPromise(function(_0xf9973f,_0x42747b){return client[_0xb3ba('0x8')](_0x160dff,_0x1980fa)[_0xb3ba('0x9')](function(_0x21efce){logger[_0xb3ba('0xa')](_0xb3ba('0xb'),_0x545adb,_0xb3ba('0xc'));logger['debug'](_0xb3ba('0xd'),_0x545adb,_0xb3ba('0xc'),JSON['stringify'](_0x21efce));if(_0x21efce[_0xb3ba('0xe')]){if(_0x21efce['error'][_0xb3ba('0xf')]===0x1f4){logger['error'](_0xb3ba('0xb'),_0x545adb,_0x21efce[_0xb3ba('0xe')][_0xb3ba('0x10')]);return _0x42747b(_0x21efce[_0xb3ba('0xe')][_0xb3ba('0x10')]);}logger[_0xb3ba('0xe')](_0xb3ba('0xb'),_0x545adb,_0x21efce['error'][_0xb3ba('0x10')]);return _0xf9973f(_0x21efce[_0xb3ba('0xe')][_0xb3ba('0x10')]);}else{logger[_0xb3ba('0xa')](_0xb3ba('0xb'),_0x545adb,_0xb3ba('0xc'));_0xf9973f(_0x21efce[_0xb3ba('0x11')][_0xb3ba('0x10')]);}})[_0xb3ba('0x12')](function(_0x54e7a6){logger[_0xb3ba('0xe')](_0xb3ba('0xb'),_0x545adb,_0x54e7a6);_0x42747b(_0x54e7a6);});});} \ No newline at end of file +var _0x2a5c=['ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x4858ec,_0x5f3b82){var _0x2c06b3=function(_0x550cf7){while(--_0x550cf7){_0x4858ec['push'](_0x4858ec['shift']());}};_0x2c06b3(++_0x5f3b82);}(_0x2a5c,0x11d));var _0xc2a5=function(_0x534313,_0x1a52aa){_0x534313=_0x534313-0x0;var _0x43ffae=_0x2a5c[_0x534313];return _0x43ffae;};'use strict';var _=require(_0xc2a5('0x0'));var util=require(_0xc2a5('0x1'));var moment=require('moment');var BPromise=require(_0xc2a5('0x2'));var rs=require(_0xc2a5('0x3'));var fs=require('fs');var Redis=require(_0xc2a5('0x4'));var db=require(_0xc2a5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc2a5('0x6'))(_0xc2a5('0x7'));var config=require(_0xc2a5('0x8'));var jayson=require(_0xc2a5('0x9'));var client=jayson[_0xc2a5('0xa')][_0xc2a5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x813a45,_0x244ab3,_0x11ac44){return new BPromise(function(_0x30b10d,_0x1d26d2){return client[_0xc2a5('0xc')](_0x813a45,_0x11ac44)[_0xc2a5('0xd')](function(_0x516b60){logger['info'](_0xc2a5('0xe'),_0x244ab3,_0xc2a5('0xf'));logger[_0xc2a5('0x10')](_0xc2a5('0x11'),_0x244ab3,_0xc2a5('0xf'),JSON['stringify'](_0x516b60));if(_0x516b60[_0xc2a5('0x12')]){if(_0x516b60[_0xc2a5('0x12')][_0xc2a5('0x13')]===0x1f4){logger[_0xc2a5('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x244ab3,_0x516b60['error']['message']);return _0x1d26d2(_0x516b60[_0xc2a5('0x12')][_0xc2a5('0x14')]);}logger[_0xc2a5('0x12')](_0xc2a5('0xe'),_0x244ab3,_0x516b60[_0xc2a5('0x12')][_0xc2a5('0x14')]);return _0x30b10d(_0x516b60['error']['message']);}else{logger['info'](_0xc2a5('0xe'),_0x244ab3,_0xc2a5('0xf'));_0x30b10d(_0x516b60[_0xc2a5('0x15')][_0xc2a5('0x14')]);}})[_0xc2a5('0x16')](function(_0x45c167){logger['error'](_0xc2a5('0xe'),_0x244ab3,_0x45c167);_0x1d26d2(_0x45c167);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 10d1fa9..985b54d 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 _0xd87a=['exports','path','express','fs-extra','../../components/auth/service','./intZendeskField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete'];(function(_0x4648d4,_0x1b9ad7){var _0x3af52f=function(_0x2531bb){while(--_0x2531bb){_0x4648d4['push'](_0x4648d4['shift']());}};_0x3af52f(++_0x1b9ad7);}(_0xd87a,0x169));var _0xad87=function(_0x1b5a05,_0x2c80de){_0x1b5a05=_0x1b5a05-0x0;var _0x347931=_0xd87a[_0x1b5a05];return _0x347931;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xad87('0x0'));var timeout=require('connect-timeout');var express=require(_0xad87('0x1'));var router=express['Router']();var fs_extra=require(_0xad87('0x2'));var auth=require(_0xad87('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xad87('0x4'));router[_0xad87('0x5')]('/',auth[_0xad87('0x6')](),controller['index']);router[_0xad87('0x5')](_0xad87('0x7'),auth[_0xad87('0x6')](),controller[_0xad87('0x8')]);router[_0xad87('0x9')]('/',auth[_0xad87('0x6')](),controller[_0xad87('0xa')]);router[_0xad87('0xb')](_0xad87('0x7'),auth[_0xad87('0x6')](),controller[_0xad87('0xc')]);router[_0xad87('0xd')](_0xad87('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0xad87('0xe')]=router; \ No newline at end of file +var _0xbb94=['util','path','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','multer'];(function(_0x283d2c,_0x2dca59){var _0x29d45f=function(_0x4c695a){while(--_0x4c695a){_0x283d2c['push'](_0x283d2c['shift']());}};_0x29d45f(++_0x2dca59);}(_0xbb94,0x1bf));var _0x4bb9=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xbb94[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x4bb9('0x0'));var util=require(_0x4bb9('0x1'));var path=require(_0x4bb9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x4bb9('0x3'));var auth=require(_0x4bb9('0x4'));var interaction=require(_0x4bb9('0x5'));var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router[_0x4bb9('0x6')]('/',auth[_0x4bb9('0x7')](),controller[_0x4bb9('0x8')]);router[_0x4bb9('0x6')](_0x4bb9('0x9'),auth[_0x4bb9('0x7')](),controller[_0x4bb9('0xa')]);router[_0x4bb9('0xb')]('/',auth[_0x4bb9('0x7')](),controller['create']);router[_0x4bb9('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x4bb9('0xd')](_0x4bb9('0x9'),auth[_0x4bb9('0x7')](),controller[_0x4bb9('0xe')]);module[_0x4bb9('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 1a04d3b..3f0f91d 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 _0x63e2=['variable','customVariable','picklist','string','STRING','sequelize','exports','ENUM'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x63e2,0x8d));var _0x263e=function(_0x5ecc81,_0x177e15){_0x5ecc81=_0x5ecc81-0x0;var _0x31901b=_0x63e2[_0x5ecc81];return _0x31901b;};'use strict';var Sequelize=require(_0x263e('0x0'));module[_0x263e('0x1')]={'type':{'type':Sequelize[_0x263e('0x2')]('string',_0x263e('0x3'),_0x263e('0x4'),'keyValue',_0x263e('0x5')),'defaultValue':_0x263e('0x6')},'content':{'type':Sequelize[_0x263e('0x7')]},'key':{'type':Sequelize[_0x263e('0x7')]},'keyType':{'type':Sequelize[_0x263e('0x2')](_0x263e('0x6'),_0x263e('0x3'),_0x263e('0x4'))},'keyContent':{'type':Sequelize[_0x263e('0x7')]},'idField':{'type':Sequelize[_0x263e('0x7')]},'nameField':{'type':Sequelize[_0x263e('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x774a=['keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0x774a,0xa5));var _0xa774=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x774a[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xa774('0x0'));module[_0xa774('0x1')]={'type':{'type':Sequelize[_0xa774('0x2')](_0xa774('0x3'),_0xa774('0x4'),_0xa774('0x5'),_0xa774('0x6'),_0xa774('0x7')),'defaultValue':_0xa774('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa774('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0xa774('0x3'),_0xa774('0x4'),_0xa774('0x5'))},'keyContent':{'type':Sequelize[_0xa774('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa774('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index e1f1a6b..9cb0483 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 _0x2e89=['ZendeskField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','keys','includeAll','find','create','catch','params','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','end','error','stack','name','send','index','map'];(function(_0x374164,_0x15df1d){var _0x27873b=function(_0x29309e){while(--_0x29309e){_0x374164['push'](_0x374164['shift']());}};_0x27873b(++_0x15df1d);}(_0x2e89,0x1e9));var _0x92e8=function(_0x34db7d,_0x248cb4){_0x34db7d=_0x34db7d-0x0;var _0x26e05a=_0x2e89[_0x34db7d];return _0x26e05a;};'use strict';var emlformat=require(_0x92e8('0x0'));var rimraf=require(_0x92e8('0x1'));var zipdir=require(_0x92e8('0x2'));var jsonpatch=require(_0x92e8('0x3'));var rp=require('request-promise');var moment=require(_0x92e8('0x4'));var BPromise=require(_0x92e8('0x5'));var Mustache=require(_0x92e8('0x6'));var util=require(_0x92e8('0x7'));var path=require('path');var sox=require(_0x92e8('0x8'));var csv=require('to-csv');var ejs=require(_0x92e8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x92e8('0xa'));var squel=require(_0x92e8('0xb'));var crypto=require(_0x92e8('0xc'));var jsforce=require(_0x92e8('0xd'));var deskjs=require(_0x92e8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x92e8('0xf'));var Papa=require('papaparse');var Redis=require(_0x92e8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x92e8('0x11'));var as=require(_0x92e8('0x12'));var hardwareService=require(_0x92e8('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x92e8('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x92e8('0x15'))['db'];function respondWithStatusCode(_0x8ba8fd,_0x3277ba){_0x3277ba=_0x3277ba||0xcc;return function(_0x25670c){if(_0x25670c){return _0x8ba8fd[_0x92e8('0x16')](_0x3277ba);}return _0x8ba8fd['status'](_0x3277ba)['end']();};}function respondWithResult(_0x1626ae,_0x42982e){_0x42982e=_0x42982e||0xc8;return function(_0xe6ce8b){if(_0xe6ce8b){return _0x1626ae[_0x92e8('0x17')](_0x42982e)[_0x92e8('0x18')](_0xe6ce8b);}};}function respondWithFilteredResult(_0x2003be,_0x12a4d3){return function(_0x1a7771){if(_0x1a7771){var _0x2aae29=typeof _0x12a4d3[_0x92e8('0x19')]===_0x92e8('0x1a')&&typeof _0x12a4d3[_0x92e8('0x1b')]===_0x92e8('0x1a');var _0x969f06=_0x1a7771[_0x92e8('0x1c')];var _0x17cf89=_0x2aae29?0x0:_0x12a4d3[_0x92e8('0x19')];var _0x45517e=_0x2aae29?_0x1a7771[_0x92e8('0x1c')]:_0x12a4d3[_0x92e8('0x19')]+_0x12a4d3['limit'];var _0x175e9b;if(_0x45517e>=_0x969f06){_0x45517e=_0x969f06;_0x175e9b=0xc8;}else{_0x175e9b=0xce;}_0x2003be['status'](_0x175e9b);return _0x2003be[_0x92e8('0x1d')](_0x92e8('0x1e'),_0x17cf89+'-'+_0x45517e+'/'+_0x969f06)[_0x92e8('0x18')](_0x1a7771);}return null;};}function patchUpdates(_0x2f4272){return function(_0x33dd34){try{jsonpatch[_0x92e8('0x1f')](_0x33dd34,_0x2f4272,!![]);}catch(_0x3283af){return BPromise['reject'](_0x3283af);}return _0x33dd34[_0x92e8('0x20')]();};}function saveUpdates(_0x455ef9,_0xc795e3){return function(_0x276ba2){if(_0x276ba2){return _0x276ba2[_0x92e8('0x21')](_0x455ef9)['then'](function(_0x46e76c){return _0x46e76c;});}return null;};}function removeEntity(_0x395d9b,_0x1cf188){return function(_0x13ed1f){if(_0x13ed1f){return _0x13ed1f[_0x92e8('0x22')]()[_0x92e8('0x23')](function(){_0x395d9b[_0x92e8('0x17')](0xcc)[_0x92e8('0x24')]();});}};}function handleEntityNotFound(_0x323529,_0x4c5fe5){return function(_0x3955cd){if(!_0x3955cd){_0x323529[_0x92e8('0x16')](0x194);}return _0x3955cd;};}function handleError(_0x51a8b0,_0x297467){_0x297467=_0x297467||0x1f4;return function(_0x5c96f6){logger[_0x92e8('0x25')](_0x5c96f6[_0x92e8('0x26')]);if(_0x5c96f6[_0x92e8('0x27')]){delete _0x5c96f6['name'];}_0x51a8b0[_0x92e8('0x17')](_0x297467)[_0x92e8('0x28')](_0x5c96f6);};}exports[_0x92e8('0x29')]=function(_0x12449b,_0x4235af){var _0x40f39f={},_0x2d69af={},_0xe5990e={'count':0x0,'rows':[]};var _0x176da6=_[_0x92e8('0x2a')](db[_0x92e8('0x2b')][_0x92e8('0x2c')],function(_0x46f8b8){return{'name':_0x46f8b8[_0x92e8('0x2d')],'type':_0x46f8b8[_0x92e8('0x2e')][_0x92e8('0x2f')]};});_0x2d69af[_0x92e8('0x30')]=_[_0x92e8('0x2a')](_0x176da6,'name');_0x2d69af['query']=_['keys'](_0x12449b[_0x92e8('0x31')]);_0x2d69af[_0x92e8('0x32')]=_[_0x92e8('0x33')](_0x2d69af[_0x92e8('0x30')],_0x2d69af['query']);_0x40f39f[_0x92e8('0x34')]=_['intersection'](_0x2d69af['model'],qs[_0x92e8('0x35')](_0x12449b[_0x92e8('0x31')][_0x92e8('0x35')]));_0x40f39f[_0x92e8('0x34')]=_0x40f39f[_0x92e8('0x34')][_0x92e8('0x36')]?_0x40f39f[_0x92e8('0x34')]:_0x2d69af[_0x92e8('0x30')];if(!_0x12449b[_0x92e8('0x31')][_0x92e8('0x37')](_0x92e8('0x38'))){_0x40f39f[_0x92e8('0x1b')]=qs['limit'](_0x12449b[_0x92e8('0x31')]['limit']);_0x40f39f[_0x92e8('0x19')]=qs[_0x92e8('0x19')](_0x12449b[_0x92e8('0x31')][_0x92e8('0x19')]);}_0x40f39f[_0x92e8('0x39')]=qs[_0x92e8('0x3a')](_0x12449b[_0x92e8('0x31')][_0x92e8('0x3a')]);_0x40f39f[_0x92e8('0x3b')]=qs[_0x92e8('0x32')](_[_0x92e8('0x3c')](_0x12449b['query'],_0x2d69af[_0x92e8('0x32')]),_0x176da6);if(_0x12449b[_0x92e8('0x31')][_0x92e8('0x3d')]){_0x40f39f[_0x92e8('0x3b')]=_['merge'](_0x40f39f['where'],{'$or':_[_0x92e8('0x2a')](_0x176da6,function(_0x33ef1b){if(_0x33ef1b['type']!==_0x92e8('0x3e')){var _0x20e04b={};_0x20e04b[_0x33ef1b[_0x92e8('0x27')]]={'$like':'%'+_0x12449b[_0x92e8('0x31')][_0x92e8('0x3d')]+'%'};return _0x20e04b;}})});}_0x40f39f=_[_0x92e8('0x3f')]({},_0x40f39f,_0x12449b[_0x92e8('0x40')]);var _0x638f23={'where':_0x40f39f[_0x92e8('0x3b')]};return db[_0x92e8('0x2b')][_0x92e8('0x1c')](_0x638f23)['then'](function(_0xe44157){_0xe5990e['count']=_0xe44157;if(_0x12449b[_0x92e8('0x31')]['includeAll']){_0x40f39f[_0x92e8('0x41')]=[{'all':!![]}];}return db[_0x92e8('0x2b')][_0x92e8('0x42')](_0x40f39f);})[_0x92e8('0x23')](function(_0x40d926){_0xe5990e[_0x92e8('0x43')]=_0x40d926;return _0xe5990e;})[_0x92e8('0x23')](respondWithFilteredResult(_0x4235af,_0x40f39f))['catch'](handleError(_0x4235af,null));};exports[_0x92e8('0x44')]=function(_0x4e3fe3,_0x2392fa){var _0xafe9d5={'raw':!![],'where':{'id':_0x4e3fe3['params']['id']}},_0x2ae210={};_0x2ae210['model']=_['keys'](db['ZendeskField'][_0x92e8('0x2c')]);_0x2ae210[_0x92e8('0x31')]=_[_0x92e8('0x45')](_0x4e3fe3[_0x92e8('0x31')]);_0x2ae210[_0x92e8('0x32')]=_[_0x92e8('0x33')](_0x2ae210[_0x92e8('0x30')],_0x2ae210[_0x92e8('0x31')]);_0xafe9d5[_0x92e8('0x34')]=_[_0x92e8('0x33')](_0x2ae210[_0x92e8('0x30')],qs[_0x92e8('0x35')](_0x4e3fe3[_0x92e8('0x31')][_0x92e8('0x35')]));_0xafe9d5[_0x92e8('0x34')]=_0xafe9d5['attributes'][_0x92e8('0x36')]?_0xafe9d5[_0x92e8('0x34')]:_0x2ae210[_0x92e8('0x30')];if(_0x4e3fe3[_0x92e8('0x31')][_0x92e8('0x46')]){_0xafe9d5[_0x92e8('0x41')]=[{'all':!![]}];}_0xafe9d5=_[_0x92e8('0x3f')]({},_0xafe9d5,_0x4e3fe3['options']);return db[_0x92e8('0x2b')][_0x92e8('0x47')](_0xafe9d5)[_0x92e8('0x23')](handleEntityNotFound(_0x2392fa,null))[_0x92e8('0x23')](respondWithResult(_0x2392fa,null))['catch'](handleError(_0x2392fa,null));};exports[_0x92e8('0x48')]=function(_0x5a58d7,_0x3ead6d){return db[_0x92e8('0x2b')][_0x92e8('0x48')](_0x5a58d7['body'],{})[_0x92e8('0x23')](respondWithResult(_0x3ead6d,0xc9))[_0x92e8('0x49')](handleError(_0x3ead6d,null));};exports['update']=function(_0x3f1ab4,_0x552d33){if(_0x3f1ab4['body']['id']){delete _0x3f1ab4['body']['id'];}return db['ZendeskField']['find']({'where':{'id':_0x3f1ab4[_0x92e8('0x4a')]['id']}})[_0x92e8('0x23')](handleEntityNotFound(_0x552d33,null))[_0x92e8('0x23')](saveUpdates(_0x3f1ab4[_0x92e8('0x4b')],null))[_0x92e8('0x23')](respondWithResult(_0x552d33,null))[_0x92e8('0x49')](handleError(_0x552d33,null));};exports[_0x92e8('0x22')]=function(_0x3dfb3c,_0x312161){return db['ZendeskField'][_0x92e8('0x47')]({'where':{'id':_0x3dfb3c[_0x92e8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x312161,null))['then'](removeEntity(_0x312161,null))[_0x92e8('0x49')](handleError(_0x312161,null));}; \ No newline at end of file +var _0x111b=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','json','undefined','count','offset','limit','set','Content-Range','apply','save','then','destroy','end','sendStatus','error','stack','name','send','map','ZendeskField','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','type','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x1c0cc1,_0x44c536){var _0x230b93=function(_0x55f56d){while(--_0x55f56d){_0x1c0cc1['push'](_0x1c0cc1['shift']());}};_0x230b93(++_0x44c536);}(_0x111b,0x8c));var _0xb111=function(_0x13b4d4,_0x4478c0){_0x13b4d4=_0x13b4d4-0x0;var _0x111749=_0x111b[_0x13b4d4];return _0x111749;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb111('0x0'));var zipdir=require(_0xb111('0x1'));var jsonpatch=require(_0xb111('0x2'));var rp=require(_0xb111('0x3'));var moment=require(_0xb111('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb111('0x5'));var util=require(_0xb111('0x6'));var path=require(_0xb111('0x7'));var sox=require(_0xb111('0x8'));var csv=require(_0xb111('0x9'));var ejs=require(_0xb111('0xa'));var fs=require('fs');var fs_extra=require(_0xb111('0xb'));var _=require(_0xb111('0xc'));var squel=require(_0xb111('0xd'));var crypto=require(_0xb111('0xe'));var jsforce=require(_0xb111('0xf'));var deskjs=require(_0xb111('0x10'));var toCsv=require(_0xb111('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb111('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb111('0x12'));var as=require(_0xb111('0x13'));var hardwareService=require(_0xb111('0x14'));var logger=require(_0xb111('0x15'))('api');var utils=require(_0xb111('0x16'));var config=require(_0xb111('0x17'));var licenseUtil=require(_0xb111('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x96781a,_0x4f7fe8){_0x4f7fe8=_0x4f7fe8||0xcc;return function(_0x35432e){if(_0x35432e){return _0x96781a['sendStatus'](_0x4f7fe8);}return _0x96781a[_0xb111('0x19')](_0x4f7fe8)['end']();};}function respondWithResult(_0x14f9ee,_0x2ac136){_0x2ac136=_0x2ac136||0xc8;return function(_0x7a9d33){if(_0x7a9d33){return _0x14f9ee[_0xb111('0x19')](_0x2ac136)[_0xb111('0x1a')](_0x7a9d33);}};}function respondWithFilteredResult(_0xf2e568,_0x58fd1a){return function(_0x51753e){if(_0x51753e){var _0x1e2d2b=typeof _0x58fd1a['offset']==='undefined'&&typeof _0x58fd1a['limit']===_0xb111('0x1b');var _0x4ebf87=_0x51753e[_0xb111('0x1c')];var _0x4821d8=_0x1e2d2b?0x0:_0x58fd1a[_0xb111('0x1d')];var _0x34085c=_0x1e2d2b?_0x51753e['count']:_0x58fd1a[_0xb111('0x1d')]+_0x58fd1a[_0xb111('0x1e')];var _0x175a3e;if(_0x34085c>=_0x4ebf87){_0x34085c=_0x4ebf87;_0x175a3e=0xc8;}else{_0x175a3e=0xce;}_0xf2e568[_0xb111('0x19')](_0x175a3e);return _0xf2e568[_0xb111('0x1f')](_0xb111('0x20'),_0x4821d8+'-'+_0x34085c+'/'+_0x4ebf87)[_0xb111('0x1a')](_0x51753e);}return null;};}function patchUpdates(_0x49cea1){return function(_0x77adec){try{jsonpatch[_0xb111('0x21')](_0x77adec,_0x49cea1,!![]);}catch(_0x106312){return BPromise['reject'](_0x106312);}return _0x77adec[_0xb111('0x22')]();};}function saveUpdates(_0x190c42,_0x3a169c){return function(_0x10f341){if(_0x10f341){return _0x10f341['update'](_0x190c42)[_0xb111('0x23')](function(_0x4f177d){return _0x4f177d;});}return null;};}function removeEntity(_0x45b061,_0x1760fd){return function(_0x36e559){if(_0x36e559){return _0x36e559[_0xb111('0x24')]()[_0xb111('0x23')](function(){_0x45b061['status'](0xcc)[_0xb111('0x25')]();});}};}function handleEntityNotFound(_0x404a28,_0x4802bf){return function(_0x57a2ac){if(!_0x57a2ac){_0x404a28[_0xb111('0x26')](0x194);}return _0x57a2ac;};}function handleError(_0x48d823,_0x452a92){_0x452a92=_0x452a92||0x1f4;return function(_0x3247d6){logger[_0xb111('0x27')](_0x3247d6[_0xb111('0x28')]);if(_0x3247d6[_0xb111('0x29')]){delete _0x3247d6[_0xb111('0x29')];}_0x48d823['status'](_0x452a92)[_0xb111('0x2a')](_0x3247d6);};}exports['index']=function(_0x282093,_0x51b73f){var _0x207627={},_0x5b5f80={},_0x9c8d0={'count':0x0,'rows':[]};var _0x2a5072=_[_0xb111('0x2b')](db[_0xb111('0x2c')][_0xb111('0x2d')],function(_0x14fd40){return{'name':_0x14fd40['fieldName'],'type':_0x14fd40['type'][_0xb111('0x2e')]};});_0x5b5f80[_0xb111('0x2f')]=_[_0xb111('0x2b')](_0x2a5072,_0xb111('0x29'));_0x5b5f80[_0xb111('0x30')]=_[_0xb111('0x31')](_0x282093[_0xb111('0x30')]);_0x5b5f80[_0xb111('0x32')]=_[_0xb111('0x33')](_0x5b5f80[_0xb111('0x2f')],_0x5b5f80[_0xb111('0x30')]);_0x207627['attributes']=_[_0xb111('0x33')](_0x5b5f80[_0xb111('0x2f')],qs[_0xb111('0x34')](_0x282093[_0xb111('0x30')]['fields']));_0x207627['attributes']=_0x207627[_0xb111('0x35')][_0xb111('0x36')]?_0x207627[_0xb111('0x35')]:_0x5b5f80['model'];if(!_0x282093[_0xb111('0x30')][_0xb111('0x37')](_0xb111('0x38'))){_0x207627[_0xb111('0x1e')]=qs[_0xb111('0x1e')](_0x282093[_0xb111('0x30')][_0xb111('0x1e')]);_0x207627[_0xb111('0x1d')]=qs['offset'](_0x282093[_0xb111('0x30')][_0xb111('0x1d')]);}_0x207627['order']=qs['sort'](_0x282093[_0xb111('0x30')][_0xb111('0x39')]);_0x207627[_0xb111('0x3a')]=qs[_0xb111('0x32')](_['pick'](_0x282093[_0xb111('0x30')],_0x5b5f80['filters']),_0x2a5072);if(_0x282093[_0xb111('0x30')][_0xb111('0x3b')]){_0x207627['where']=_['merge'](_0x207627['where'],{'$or':_['map'](_0x2a5072,function(_0x12b80d){if(_0x12b80d[_0xb111('0x3c')]!=='VIRTUAL'){var _0x57e317={};_0x57e317[_0x12b80d[_0xb111('0x29')]]={'$like':'%'+_0x282093['query'][_0xb111('0x3b')]+'%'};return _0x57e317;}})});}_0x207627=_[_0xb111('0x3d')]({},_0x207627,_0x282093[_0xb111('0x3e')]);var _0x5f490a={'where':_0x207627[_0xb111('0x3a')]};return db[_0xb111('0x2c')]['count'](_0x5f490a)['then'](function(_0x61b73c){_0x9c8d0['count']=_0x61b73c;if(_0x282093[_0xb111('0x30')][_0xb111('0x3f')]){_0x207627['include']=[{'all':!![]}];}return db[_0xb111('0x2c')][_0xb111('0x40')](_0x207627);})[_0xb111('0x23')](function(_0x4b86da){_0x9c8d0[_0xb111('0x41')]=_0x4b86da;return _0x9c8d0;})[_0xb111('0x23')](respondWithFilteredResult(_0x51b73f,_0x207627))[_0xb111('0x42')](handleError(_0x51b73f,null));};exports[_0xb111('0x43')]=function(_0x31d4ff,_0x22b1c5){var _0xfd5f7={'raw':!![],'where':{'id':_0x31d4ff[_0xb111('0x44')]['id']}},_0x405f7b={};_0x405f7b[_0xb111('0x2f')]=_[_0xb111('0x31')](db[_0xb111('0x2c')][_0xb111('0x2d')]);_0x405f7b[_0xb111('0x30')]=_[_0xb111('0x31')](_0x31d4ff[_0xb111('0x30')]);_0x405f7b[_0xb111('0x32')]=_['intersection'](_0x405f7b[_0xb111('0x2f')],_0x405f7b[_0xb111('0x30')]);_0xfd5f7[_0xb111('0x35')]=_[_0xb111('0x33')](_0x405f7b[_0xb111('0x2f')],qs[_0xb111('0x34')](_0x31d4ff[_0xb111('0x30')]['fields']));_0xfd5f7[_0xb111('0x35')]=_0xfd5f7[_0xb111('0x35')]['length']?_0xfd5f7[_0xb111('0x35')]:_0x405f7b['model'];if(_0x31d4ff[_0xb111('0x30')][_0xb111('0x3f')]){_0xfd5f7[_0xb111('0x45')]=[{'all':!![]}];}_0xfd5f7=_[_0xb111('0x3d')]({},_0xfd5f7,_0x31d4ff[_0xb111('0x3e')]);return db['ZendeskField'][_0xb111('0x46')](_0xfd5f7)[_0xb111('0x23')](handleEntityNotFound(_0x22b1c5,null))[_0xb111('0x23')](respondWithResult(_0x22b1c5,null))[_0xb111('0x42')](handleError(_0x22b1c5,null));};exports['create']=function(_0x1ac632,_0x363dbe){return db[_0xb111('0x2c')][_0xb111('0x47')](_0x1ac632[_0xb111('0x48')],{})[_0xb111('0x23')](respondWithResult(_0x363dbe,0xc9))[_0xb111('0x42')](handleError(_0x363dbe,null));};exports['update']=function(_0x3d313a,_0x50c81d){if(_0x3d313a[_0xb111('0x48')]['id']){delete _0x3d313a[_0xb111('0x48')]['id'];}return db[_0xb111('0x2c')][_0xb111('0x46')]({'where':{'id':_0x3d313a[_0xb111('0x44')]['id']}})[_0xb111('0x23')](handleEntityNotFound(_0x50c81d,null))[_0xb111('0x23')](saveUpdates(_0x3d313a['body'],null))[_0xb111('0x23')](respondWithResult(_0x50c81d,null))[_0xb111('0x42')](handleError(_0x50c81d,null));};exports[_0xb111('0x24')]=function(_0x2409c7,_0xfbc61c){return db['ZendeskField']['find']({'where':{'id':_0x2409c7[_0xb111('0x44')]['id']}})[_0xb111('0x23')](handleEntityNotFound(_0xfbc61c,null))[_0xb111('0x23')](removeEntity(_0xfbc61c,null))[_0xb111('0x42')](handleError(_0xfbc61c,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index e9d2386..a576c38 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 _0x8231=['util','api','bluebird','request-promise','rimraf','./intZendeskField.attributes','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x8231,0x74));var _0x1823=function(_0x3229f7,_0x417af9){_0x3229f7=_0x3229f7-0x0;var _0x3b5a5a=_0x8231[_0x3229f7];return _0x3b5a5a;};'use strict';var _=require(_0x1823('0x0'));var util=require(_0x1823('0x1'));var logger=require('../../config/logger')(_0x1823('0x2'));var moment=require('moment');var BPromise=require(_0x1823('0x3'));var rp=require(_0x1823('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1823('0x5'));var config=require('../../config/environment');var attributes=require(_0x1823('0x6'));module['exports']=function(_0x476891,_0x2c3582){return _0x476891[_0x1823('0x7')](_0x1823('0x8'),attributes,{'tableName':_0x1823('0x9'),'paranoid':![],'indexes':[{'name':_0x1823('0xa'),'fields':[_0x1823('0xb'),_0x1823('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8ea3=['exports','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes'];(function(_0x58d6b9,_0x51c3cd){var _0x13abe4=function(_0x3a831b){while(--_0x3a831b){_0x58d6b9['push'](_0x58d6b9['shift']());}};_0x13abe4(++_0x51c3cd);}(_0x8ea3,0x19b));var _0x38ea=function(_0x6b2c5c,_0x3f6949){_0x6b2c5c=_0x6b2c5c-0x0;var _0x18e3ce=_0x8ea3[_0x6b2c5c];return _0x18e3ce;};'use strict';var _=require(_0x38ea('0x0'));var util=require('util');var logger=require(_0x38ea('0x1'))(_0x38ea('0x2'));var moment=require(_0x38ea('0x3'));var BPromise=require('bluebird');var rp=require(_0x38ea('0x4'));var fs=require('fs');var path=require(_0x38ea('0x5'));var rimraf=require(_0x38ea('0x6'));var config=require(_0x38ea('0x7'));var attributes=require(_0x38ea('0x8'));module[_0x38ea('0x9')]=function(_0x440b13,_0x290f53){return _0x440b13['define'](_0x38ea('0xa'),attributes,{'tableName':_0x38ea('0xb'),'paranoid':![],'indexes':[{'name':_0x38ea('0xc'),'fields':[_0x38ea('0xd'),_0x38ea('0xe')],'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 c401f26..9f60257 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 _0xbf9b=['../../config/utils','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','ZendeskField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4a095e,_0x381cd5){var _0x10ef73=function(_0x1f6964){while(--_0x1f6964){_0x4a095e['push'](_0x4a095e['shift']());}};_0x10ef73(++_0x381cd5);}(_0xbf9b,0x135));var _0xbbf9=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xbf9b[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0xbbf9('0x0'));var util=require(_0xbbf9('0x1'));var moment=require(_0xbbf9('0x2'));var BPromise=require(_0xbbf9('0x3'));var rs=require(_0xbbf9('0x4'));var fs=require('fs');var Redis=require(_0xbbf9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbbf9('0x6'));var logger=require('../../config/logger')(_0xbbf9('0x7'));var config=require(_0xbbf9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbbf9('0x9')][_0xbbf9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x128b00,_0x1c0156,_0x26e3d0){return new BPromise(function(_0x14ae11,_0xcad74f){return client[_0xbbf9('0xb')](_0x128b00,_0x26e3d0)[_0xbbf9('0xc')](function(_0x431c28){logger['info']('ZendeskField,\x20%s,\x20%s',_0x1c0156,_0xbbf9('0xd'));logger[_0xbbf9('0xe')](_0xbbf9('0xf'),_0x1c0156,_0xbbf9('0xd'),JSON['stringify'](_0x431c28));if(_0x431c28[_0xbbf9('0x10')]){if(_0x431c28[_0xbbf9('0x10')]['code']===0x1f4){logger['error'](_0xbbf9('0x11'),_0x1c0156,_0x431c28['error'][_0xbbf9('0x12')]);return _0xcad74f(_0x431c28[_0xbbf9('0x10')][_0xbbf9('0x12')]);}logger['error'](_0xbbf9('0x11'),_0x1c0156,_0x431c28['error'][_0xbbf9('0x12')]);return _0x14ae11(_0x431c28[_0xbbf9('0x10')][_0xbbf9('0x12')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x1c0156,_0xbbf9('0xd'));_0x14ae11(_0x431c28[_0xbbf9('0x13')][_0xbbf9('0x12')]);}})[_0xbbf9('0x14')](function(_0x305953){logger[_0xbbf9('0x10')](_0xbbf9('0x11'),_0x1c0156,_0x305953);_0xcad74f(_0x305953);});});} \ No newline at end of file +var _0x41d7=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment'];(function(_0x36dc27,_0x7b681c){var _0x465998=function(_0x2a16ce){while(--_0x2a16ce){_0x36dc27['push'](_0x36dc27['shift']());}};_0x465998(++_0x7b681c);}(_0x41d7,0x129));var _0x741d=function(_0x13c2e3,_0x22ab8b){_0x13c2e3=_0x13c2e3-0x0;var _0x1bac51=_0x41d7[_0x13c2e3];return _0x1bac51;};'use strict';var _=require(_0x741d('0x0'));var util=require(_0x741d('0x1'));var moment=require(_0x741d('0x2'));var BPromise=require(_0x741d('0x3'));var rs=require(_0x741d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x741d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x741d('0x6'))(_0x741d('0x7'));var config=require(_0x741d('0x8'));var jayson=require(_0x741d('0x9'));var client=jayson[_0x741d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35cd5e,_0x3b8613,_0x4af835){return new BPromise(function(_0x59191e,_0x549216){return client[_0x741d('0xb')](_0x35cd5e,_0x4af835)[_0x741d('0xc')](function(_0x364b5e){logger['info'](_0x741d('0xd'),_0x3b8613,_0x741d('0xe'));logger['debug'](_0x741d('0xf'),_0x3b8613,_0x741d('0xe'),JSON['stringify'](_0x364b5e));if(_0x364b5e['error']){if(_0x364b5e[_0x741d('0x10')][_0x741d('0x11')]===0x1f4){logger[_0x741d('0x10')](_0x741d('0xd'),_0x3b8613,_0x364b5e[_0x741d('0x10')]['message']);return _0x549216(_0x364b5e[_0x741d('0x10')][_0x741d('0x12')]);}logger[_0x741d('0x10')]('ZendeskField,\x20%s,\x20%s',_0x3b8613,_0x364b5e['error'][_0x741d('0x12')]);return _0x59191e(_0x364b5e['error'][_0x741d('0x12')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x3b8613,_0x741d('0xe'));_0x59191e(_0x364b5e[_0x741d('0x13')][_0x741d('0x12')]);}})['catch'](function(_0x22db80){logger[_0x741d('0x10')](_0x741d('0xd'),_0x3b8613,_0x22db80);_0x549216(_0x22db80);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 67fa95a..c8864e0 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 _0x8f05=['util','path','express','fs-extra','../../components/auth/service','../../config/environment','./intZohoAccount.controller','get','/:id','isAuthenticated','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','delete','destroy','exports','multer'];(function(_0x3f2a90,_0x50baf1){var _0xb46279=function(_0x5e47b5){while(--_0x5e47b5){_0x3f2a90['push'](_0x3f2a90['shift']());}};_0xb46279(++_0x50baf1);}(_0x8f05,0x1cb));var _0x58f0=function(_0xdec230,_0x4b3c25){_0xdec230=_0xdec230-0x0;var _0x2fe253=_0x8f05[_0xdec230];return _0x2fe253;};'use strict';var multer=require(_0x58f0('0x0'));var util=require(_0x58f0('0x1'));var path=require(_0x58f0('0x2'));var timeout=require('connect-timeout');var express=require(_0x58f0('0x3'));var router=express['Router']();var fs_extra=require(_0x58f0('0x4'));var auth=require(_0x58f0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x58f0('0x6'));var controller=require(_0x58f0('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x58f0('0x8')](_0x58f0('0x9'),auth[_0x58f0('0xa')](),controller['show']);router[_0x58f0('0x8')](_0x58f0('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x58f0('0x8')](_0x58f0('0xc'),auth[_0x58f0('0xa')](),controller[_0x58f0('0xd')]);router[_0x58f0('0xe')]('/',auth[_0x58f0('0xa')](),controller['create']);router[_0x58f0('0xe')](_0x58f0('0xb'),auth[_0x58f0('0xa')](),controller[_0x58f0('0xf')]);router[_0x58f0('0x10')]('/:id',auth[_0x58f0('0xa')](),controller['update']);router[_0x58f0('0x11')](_0x58f0('0x9'),auth[_0x58f0('0xa')](),controller[_0x58f0('0x12')]);module[_0x58f0('0x13')]=router; \ No newline at end of file +var _0x8648=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','destroy','exports','multer'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x8648,0x19d));var _0x8864=function(_0x437030,_0x5847bc){_0x437030=_0x437030-0x0;var _0x572db1=_0x8648[_0x437030];return _0x572db1;};'use strict';var multer=require(_0x8864('0x0'));var util=require(_0x8864('0x1'));var path=require('path');var timeout=require(_0x8864('0x2'));var express=require(_0x8864('0x3'));var router=express[_0x8864('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8864('0x5'));var interaction=require(_0x8864('0x6'));var config=require(_0x8864('0x7'));var controller=require('./intZohoAccount.controller');router[_0x8864('0x8')]('/',auth['isAuthenticated'](),controller[_0x8864('0x9')]);router[_0x8864('0x8')](_0x8864('0xa'),auth[_0x8864('0xb')](),controller[_0x8864('0xc')]);router[_0x8864('0x8')](_0x8864('0xd'),auth[_0x8864('0xb')](),controller[_0x8864('0xe')]);router['get'](_0x8864('0xf'),auth['isAuthenticated'](),controller[_0x8864('0x10')]);router[_0x8864('0x11')]('/',auth[_0x8864('0xb')](),controller[_0x8864('0x12')]);router[_0x8864('0x11')](_0x8864('0xd'),auth['isAuthenticated'](),controller[_0x8864('0x13')]);router['put'](_0x8864('0xa'),auth[_0x8864('0xb')](),controller[_0x8864('0x14')]);router['delete'](_0x8864('0xa'),auth['isAuthenticated'](),controller[_0x8864('0x15')]);module[_0x8864('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 9c89cd9..2158341 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 _0xd2ea=['sequelize','exports','STRING'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xd2ea,0x15f));var _0xad2e=function(_0x29b14d,_0x51b912){_0x29b14d=_0x29b14d-0x0;var _0x2756a9=_0xd2ea[_0x29b14d];return _0x2756a9;};'use strict';var Sequelize=require(_0xad2e('0x0'));module[_0xad2e('0x1')]={'name':{'type':Sequelize[_0xad2e('0x2')]},'description':{'type':Sequelize[_0xad2e('0x2')]},'host':{'type':Sequelize[_0xad2e('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xad2e('0x2')]},'clientSecret':{'type':Sequelize[_0xad2e('0x2')]},'serverUrl':{'type':Sequelize[_0xad2e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xad2e('0x2')]},'refreshToken':{'type':Sequelize[_0xad2e('0x2')]}}; \ No newline at end of file +var _0x99e9=['exports','STRING'];(function(_0x1ea533,_0x1613bc){var _0x4804e8=function(_0x292cff){while(--_0x292cff){_0x1ea533['push'](_0x1ea533['shift']());}};_0x4804e8(++_0x1613bc);}(_0x99e9,0xb4));var _0x999e=function(_0x65cd03,_0x2913ee){_0x65cd03=_0x65cd03-0x0;var _0x21c579=_0x99e9[_0x65cd03];return _0x21c579;};'use strict';var Sequelize=require('sequelize');module[_0x999e('0x0')]={'name':{'type':Sequelize[_0x999e('0x1')]},'description':{'type':Sequelize[_0x999e('0x1')]},'host':{'type':Sequelize[_0x999e('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x999e('0x1')]},'clientSecret':{'type':Sequelize[_0x999e('0x1')]},'serverUrl':{'type':Sequelize[_0x999e('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x999e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index e895be6..02902a3 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 _0xa7af=['com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','includes','system_mandatory','display_label','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','getConfigurations','keys','ZohoConfiguration','length','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','zoho.eu'];(function(_0x23e887,_0x464368){var _0x5b4fb1=function(_0x33a947){while(--_0x33a947){_0x23e887['push'](_0x23e887['shift']());}};_0x5b4fb1(++_0x464368);}(_0xa7af,0x1a7));var _0xfa7a=function(_0x1ff454,_0x12372d){_0x1ff454=_0x1ff454-0x0;var _0x5dcf92=_0xa7af[_0x1ff454];return _0x5dcf92;};'use strict';var emlformat=require(_0xfa7a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfa7a('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfa7a('0x2'));var Mustache=require(_0xfa7a('0x3'));var util=require(_0xfa7a('0x4'));var path=require(_0xfa7a('0x5'));var sox=require('sox');var csv=require(_0xfa7a('0x6'));var ejs=require(_0xfa7a('0x7'));var fs=require('fs');var fs_extra=require(_0xfa7a('0x8'));var _=require(_0xfa7a('0x9'));var squel=require(_0xfa7a('0xa'));var crypto=require('crypto');var jsforce=require(_0xfa7a('0xb'));var deskjs=require(_0xfa7a('0xc'));var toCsv=require(_0xfa7a('0x6'));var querystring=require(_0xfa7a('0xd'));var Papa=require(_0xfa7a('0xe'));var Redis=require(_0xfa7a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xfa7a('0x10'));var as=require(_0xfa7a('0x11'));var hardwareService=require(_0xfa7a('0x12'));var logger=require(_0xfa7a('0x13'))(_0xfa7a('0x14'));var utils=require(_0xfa7a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xfa7a('0x16'));var db=require(_0xfa7a('0x17'))['db'];var integrations=require(_0xfa7a('0x18'));function respondWithStatusCode(_0x2de151,_0x3f9b1c){_0x3f9b1c=_0x3f9b1c||0xcc;return function(_0x32e8df){if(_0x32e8df){return _0x2de151['sendStatus'](_0x3f9b1c);}return _0x2de151[_0xfa7a('0x19')](_0x3f9b1c)[_0xfa7a('0x1a')]();};}function respondWithResult(_0x2559cb,_0x9ef36d){_0x9ef36d=_0x9ef36d||0xc8;return function(_0x345cf1){if(_0x345cf1){return _0x2559cb[_0xfa7a('0x19')](_0x9ef36d)[_0xfa7a('0x1b')](_0x345cf1);}};}function respondWithFilteredResult(_0x15d49b,_0x1b6bbd){return function(_0x476dad){if(_0x476dad){var _0x3eba0e=typeof _0x1b6bbd[_0xfa7a('0x1c')]==='undefined'&&typeof _0x1b6bbd[_0xfa7a('0x1d')]===_0xfa7a('0x1e');var _0x11cef=_0x476dad['count'];var _0x44e650=_0x3eba0e?0x0:_0x1b6bbd[_0xfa7a('0x1c')];var _0x34320a=_0x3eba0e?_0x476dad[_0xfa7a('0x1f')]:_0x1b6bbd[_0xfa7a('0x1c')]+_0x1b6bbd['limit'];var _0xc38486;if(_0x34320a>=_0x11cef){_0x34320a=_0x11cef;_0xc38486=0xc8;}else{_0xc38486=0xce;}_0x15d49b[_0xfa7a('0x19')](_0xc38486);return _0x15d49b['set'](_0xfa7a('0x20'),_0x44e650+'-'+_0x34320a+'/'+_0x11cef)[_0xfa7a('0x1b')](_0x476dad);}return null;};}function patchUpdates(_0x47d351){return function(_0xf48a5b){try{jsonpatch[_0xfa7a('0x21')](_0xf48a5b,_0x47d351,!![]);}catch(_0x483b18){return BPromise[_0xfa7a('0x22')](_0x483b18);}return _0xf48a5b[_0xfa7a('0x23')]();};}function saveUpdates(_0x29634b,_0x9f11e3){return function(_0x253779){if(_0x253779){return _0x253779[_0xfa7a('0x24')](_0x29634b)[_0xfa7a('0x25')](function(_0x111b04){return _0x111b04;});}return null;};}function removeEntity(_0x3b26ef,_0x400d65){return function(_0x4d741f){if(_0x4d741f){return _0x4d741f[_0xfa7a('0x26')]()[_0xfa7a('0x25')](function(){_0x3b26ef[_0xfa7a('0x19')](0xcc)[_0xfa7a('0x1a')]();});}};}function handleEntityNotFound(_0x32d0ae,_0x9bfc23){return function(_0x18a740){if(!_0x18a740){_0x32d0ae[_0xfa7a('0x27')](0x194);}return _0x18a740;};}function handleError(_0x503b43,_0x4876b9){_0x4876b9=_0x4876b9||0x1f4;return function(_0x59e1ba){logger[_0xfa7a('0x28')](_0x59e1ba[_0xfa7a('0x29')]);if(_0x59e1ba[_0xfa7a('0x2a')]){delete _0x59e1ba[_0xfa7a('0x2a')];}_0x503b43[_0xfa7a('0x19')](_0x4876b9)['send'](_0x59e1ba);};}exports[_0xfa7a('0x2b')]=function(_0x4d1088,_0xf7fd00){var _0x38d111={},_0x4dc395={},_0xd808b8={'count':0x0,'rows':[]};var _0x359297=_[_0xfa7a('0x2c')](db[_0xfa7a('0x2d')][_0xfa7a('0x2e')],function(_0x4b5d02){return{'name':_0x4b5d02[_0xfa7a('0x2f')],'type':_0x4b5d02[_0xfa7a('0x30')][_0xfa7a('0x31')]};});_0x4dc395[_0xfa7a('0x32')]=_[_0xfa7a('0x2c')](_0x359297,_0xfa7a('0x2a'));_0x4dc395['query']=_['keys'](_0x4d1088['query']);_0x4dc395[_0xfa7a('0x33')]=_[_0xfa7a('0x34')](_0x4dc395[_0xfa7a('0x32')],_0x4dc395[_0xfa7a('0x35')]);_0x38d111[_0xfa7a('0x36')]=_[_0xfa7a('0x34')](_0x4dc395[_0xfa7a('0x32')],qs[_0xfa7a('0x37')](_0x4d1088[_0xfa7a('0x35')][_0xfa7a('0x37')]));_0x38d111[_0xfa7a('0x36')]=_0x38d111[_0xfa7a('0x36')]['length']?_0x38d111[_0xfa7a('0x36')]:_0x4dc395[_0xfa7a('0x32')];if(!_0x4d1088[_0xfa7a('0x35')][_0xfa7a('0x38')](_0xfa7a('0x39'))){_0x38d111[_0xfa7a('0x1d')]=qs['limit'](_0x4d1088[_0xfa7a('0x35')]['limit']);_0x38d111[_0xfa7a('0x1c')]=qs['offset'](_0x4d1088['query'][_0xfa7a('0x1c')]);}_0x38d111[_0xfa7a('0x3a')]=qs[_0xfa7a('0x3b')](_0x4d1088[_0xfa7a('0x35')][_0xfa7a('0x3b')]);_0x38d111[_0xfa7a('0x3c')]=qs['filters'](_[_0xfa7a('0x3d')](_0x4d1088[_0xfa7a('0x35')],_0x4dc395[_0xfa7a('0x33')]),_0x359297);if(_0x4d1088[_0xfa7a('0x35')]['filter']){_0x38d111['where']=_[_0xfa7a('0x3e')](_0x38d111[_0xfa7a('0x3c')],{'$or':_[_0xfa7a('0x2c')](_0x359297,function(_0xaeeea3){if(_0xaeeea3[_0xfa7a('0x30')]!==_0xfa7a('0x3f')){var _0x22e444={};_0x22e444[_0xaeeea3['name']]={'$like':'%'+_0x4d1088[_0xfa7a('0x35')][_0xfa7a('0x40')]+'%'};return _0x22e444;}})});}_0x38d111=_[_0xfa7a('0x3e')]({},_0x38d111,_0x4d1088[_0xfa7a('0x41')]);var _0x3778b6={'where':_0x38d111[_0xfa7a('0x3c')]};return db[_0xfa7a('0x2d')]['count'](_0x3778b6)[_0xfa7a('0x25')](function(_0x5dc7a7){_0xd808b8[_0xfa7a('0x1f')]=_0x5dc7a7;if(_0x4d1088[_0xfa7a('0x35')][_0xfa7a('0x42')]){_0x38d111[_0xfa7a('0x43')]=[{'all':!![]}];}return db[_0xfa7a('0x2d')][_0xfa7a('0x44')](_0x38d111);})['then'](function(_0x3b0a8b){_0xd808b8[_0xfa7a('0x45')]=_0x3b0a8b;return _0xd808b8;})[_0xfa7a('0x25')](respondWithFilteredResult(_0xf7fd00,_0x38d111))['catch'](handleError(_0xf7fd00,null));};exports[_0xfa7a('0x46')]=function(_0x40e5f2,_0x57eb54){var _0x44cae5={'raw':![],'where':{'id':_0x40e5f2[_0xfa7a('0x47')]['id']}},_0x51a96f={};_0x51a96f[_0xfa7a('0x32')]=_['keys'](db[_0xfa7a('0x2d')][_0xfa7a('0x2e')]);_0x51a96f[_0xfa7a('0x35')]=_['keys'](_0x40e5f2['query']);_0x51a96f[_0xfa7a('0x33')]=_['intersection'](_0x51a96f[_0xfa7a('0x32')],_0x51a96f['query']);_0x44cae5['attributes']=_[_0xfa7a('0x34')](_0x51a96f[_0xfa7a('0x32')],qs[_0xfa7a('0x37')](_0x40e5f2[_0xfa7a('0x35')][_0xfa7a('0x37')]));_0x44cae5[_0xfa7a('0x36')]=_0x44cae5[_0xfa7a('0x36')]['length']?_0x44cae5[_0xfa7a('0x36')]:_0x51a96f['model'];if(_0x40e5f2['query'][_0xfa7a('0x42')]){_0x44cae5[_0xfa7a('0x43')]=[{'all':!![]}];}_0x44cae5=_[_0xfa7a('0x3e')]({},_0x44cae5,_0x40e5f2['options']);return db[_0xfa7a('0x2d')][_0xfa7a('0x48')](_0x44cae5)[_0xfa7a('0x25')](handleEntityNotFound(_0x57eb54,null))['then'](respondWithResult(_0x57eb54,null))[_0xfa7a('0x49')](handleError(_0x57eb54,null));};exports[_0xfa7a('0x4a')]=function(_0x37a6a1,_0x36de9d){return db['ZohoAccount'][_0xfa7a('0x4a')](_0x37a6a1['body'],{})['then'](respondWithResult(_0x36de9d,0xc9))[_0xfa7a('0x49')](handleError(_0x36de9d,null));};exports[_0xfa7a('0x24')]=function(_0x11bfa0,_0xaf0092){if(_0x11bfa0[_0xfa7a('0x4b')]['id']){delete _0x11bfa0['body']['id'];}return db[_0xfa7a('0x2d')][_0xfa7a('0x48')]({'where':{'id':_0x11bfa0[_0xfa7a('0x47')]['id']}})[_0xfa7a('0x25')](handleEntityNotFound(_0xaf0092,null))[_0xfa7a('0x25')](saveUpdates(_0x11bfa0[_0xfa7a('0x4b')],null))[_0xfa7a('0x25')](respondWithResult(_0xaf0092,null))['catch'](handleError(_0xaf0092,null));};exports[_0xfa7a('0x26')]=function(_0x5ad65a,_0x39cede){return db[_0xfa7a('0x2d')][_0xfa7a('0x48')]({'where':{'id':_0x5ad65a['params']['id']}})[_0xfa7a('0x25')](handleEntityNotFound(_0x39cede,null))['then'](removeEntity(_0x39cede,null))[_0xfa7a('0x49')](handleError(_0x39cede,null));};exports[_0xfa7a('0x4c')]=function(_0x3814d3,_0x217c6f,_0x401bb8){var _0xd27864={};var _0x11ba7d={};var _0x314388;var _0x154a99;return db[_0xfa7a('0x2d')]['findOne']({'where':{'id':_0x3814d3['params']['id']}})[_0xfa7a('0x25')](handleEntityNotFound(_0x217c6f,null))['then'](function(_0x56d228){if(_0x56d228){_0x314388=_0x56d228;_0x11ba7d[_0xfa7a('0x32')]=_[_0xfa7a('0x4d')](db[_0xfa7a('0x4e')]['rawAttributes']);_0x11ba7d['query']=_['keys'](_0x3814d3['query']);_0x11ba7d[_0xfa7a('0x33')]=_[_0xfa7a('0x34')](_0x11ba7d[_0xfa7a('0x32')],_0x11ba7d[_0xfa7a('0x35')]);_0xd27864[_0xfa7a('0x36')]=_[_0xfa7a('0x34')](_0x11ba7d[_0xfa7a('0x32')],qs[_0xfa7a('0x37')](_0x3814d3['query'][_0xfa7a('0x37')]));_0xd27864[_0xfa7a('0x36')]=_0xd27864[_0xfa7a('0x36')][_0xfa7a('0x4f')]?_0xd27864[_0xfa7a('0x36')]:_0x11ba7d['model'];_0xd27864[_0xfa7a('0x3a')]=qs[_0xfa7a('0x3b')](_0x3814d3['query'][_0xfa7a('0x3b')]);_0xd27864[_0xfa7a('0x3c')]=qs[_0xfa7a('0x33')](_[_0xfa7a('0x3d')](_0x3814d3[_0xfa7a('0x35')],_0x11ba7d[_0xfa7a('0x33')]));if(_0x3814d3['query'][_0xfa7a('0x40')]){_0xd27864[_0xfa7a('0x3c')]=_['merge'](_0xd27864[_0xfa7a('0x3c')],{'$or':_['map'](_0xd27864[_0xfa7a('0x36')],function(_0x464159){var _0x2c53f4={};_0x2c53f4[_0x464159]={'$like':'%'+_0x3814d3[_0xfa7a('0x35')][_0xfa7a('0x40')]+'%'};return _0x2c53f4;})});}_0xd27864=_[_0xfa7a('0x3e')]({},_0xd27864,_0x3814d3[_0xfa7a('0x41')]);return _0x314388[_0xfa7a('0x4c')](_0xd27864);}})['then'](function(_0x4a8046){if(_0x4a8046){_0x154a99=_0x4a8046[_0xfa7a('0x4f')];if(!_0x3814d3[_0xfa7a('0x35')][_0xfa7a('0x38')]('nolimit')){_0xd27864['limit']=qs['limit'](_0x3814d3['query'][_0xfa7a('0x1d')]);_0xd27864['offset']=qs[_0xfa7a('0x1c')](_0x3814d3[_0xfa7a('0x35')][_0xfa7a('0x1c')]);}return _0x314388[_0xfa7a('0x4c')](_0xd27864);}})['then'](function(_0x5b0248){if(_0x5b0248){return _0x5b0248?{'count':_0x154a99,'rows':_0x5b0248}:null;}})['then'](respondWithResult(_0x217c6f,null))['catch'](handleError(_0x217c6f,null));};exports[_0xfa7a('0x50')]=function(_0x26a436,_0x2374ab,_0x27cadf){if(_0x26a436[_0xfa7a('0x4b')]['id']){delete _0x26a436['body']['id'];}return db[_0xfa7a('0x2d')][_0xfa7a('0x51')]({'where':{'id':_0x26a436[_0xfa7a('0x47')]['id']}})[_0xfa7a('0x25')](handleEntityNotFound(_0x2374ab,null))['then'](function(_0x3606da){if(_0x3606da){_0x26a436[_0xfa7a('0x4b')][_0xfa7a('0x52')]=_0x3606da['id'];_0x26a436[_0xfa7a('0x4b')][_0xfa7a('0x53')]=integrations[_0xfa7a('0x54')](_0x26a436['body'][_0xfa7a('0x55')],_0x26a436[_0xfa7a('0x4b')][_0xfa7a('0x30')]);_0x26a436['body'][_0xfa7a('0x56')]=integrations['getDescriptions'](_0x26a436['body'][_0xfa7a('0x55')],_0x26a436[_0xfa7a('0x4b')]['type']);return db[_0xfa7a('0x4e')][_0xfa7a('0x4a')](_0x26a436[_0xfa7a('0x4b')],{'include':[{'model':db[_0xfa7a('0x57')],'as':_0xfa7a('0x53')},{'model':db['ZohoField'],'as':_0xfa7a('0x56')}]});}return null;})[_0xfa7a('0x25')](respondWithResult(_0x2374ab,null))['catch'](handleError(_0x2374ab,null));};function getAccessToken(_0x520b3a){return new Promise(function(_0x37801f,_0xe112ab){var _0x575c10;switch(_0x520b3a[_0xfa7a('0x58')]){case'US':_0x575c10=_0xfa7a('0x59');break;case'AU':_0x575c10=_0xfa7a('0x5a');break;case'EU':_0x575c10=_0xfa7a('0x5b');break;case'IN':_0x575c10=_0xfa7a('0x5c');break;case'CN':_0x575c10=_0xfa7a('0x5d');break;default:_0x575c10=_0xfa7a('0x5b');break;}var _0x8beeb8={'method':_0xfa7a('0x5e'),'uri':_0x575c10+'/oauth/v2/token','qs':{'refresh_token':_0x520b3a[_0xfa7a('0x5f')],'client_id':_0x520b3a[_0xfa7a('0x60')],'client_secret':_0x520b3a['clientSecret'],'grant_type':_0xfa7a('0x61')},'json':!![]};return rp(_0x8beeb8)[_0xfa7a('0x25')](function(_0x507c52){if(_0x507c52[_0xfa7a('0x62')]){_0x37801f(_0x507c52[_0xfa7a('0x62')]);}else{_0xe112ab(_0xfa7a('0x63'));}})[_0xfa7a('0x49')](function(_0x5619fe){_0xe112ab(_0x5619fe);});});}exports[_0xfa7a('0x64')]=function(_0x106a44,_0x59182e,_0x36f3bf){var _0x19d4c3,_0x39ba24,_0x3d6fc2,_0x1a047b,_0xfbc890;return db[_0xfa7a('0x2d')]['findOne']({'where':{'id':_0x106a44[_0xfa7a('0x47')]['id']},'attributes':['id',_0xfa7a('0x65'),_0xfa7a('0x58'),'clientId','clientSecret',_0xfa7a('0x66'),_0xfa7a('0x67'),_0xfa7a('0x5f')]})[_0xfa7a('0x25')](handleEntityNotFound(_0x59182e,null))['then'](function(_0x4204cf){_0xfbc890=_0x4204cf;_0x19d4c3=_0xfbc890[_0xfa7a('0x65')];_0x39ba24=_0x19d4c3===_0xfa7a('0x68')?'eu':_0xfa7a('0x69');_0x3d6fc2=_0xfbc890[_0xfa7a('0x66')];var _0x1fbbe8=_0x3d6fc2[_0xfa7a('0x6a')](-0x1);if(_0x1fbbe8==='/'||_0x1fbbe8==='\x5c'||_0x1fbbe8===':'){_0x3d6fc2=_0x3d6fc2[_0xfa7a('0x6b')](0x0,_0x3d6fc2[_0xfa7a('0x6c')](_0x1fbbe8));}if(!_0xfbc890['refreshToken']){throw new Error(_0xfa7a('0x6d'));}return getAccessToken(_0xfbc890);})[_0xfa7a('0x25')](function(_0x139c3b){if(_0x139c3b){return rp({'method':_0xfa7a('0x6e'),'uri':util[_0xfa7a('0x6f')](_0xfa7a('0x70'),_0x39ba24),'qs':{'module':_0xfa7a('0x71')},'headers':{'Authorization':_0xfa7a('0x72')+_0x139c3b},'json':!![]});}})[_0xfa7a('0x25')](function(_0x3b5f5d){if(_0x3b5f5d){if(_0x3b5f5d['response']&&_0x3b5f5d['response'][_0xfa7a('0x28')]){throw new Error(_0x3b5f5d['response'][_0xfa7a('0x28')]['message']);}var _0x4a942d=[];var _0x5cc32c=[];var _0x52db03=['Owner',_0xfa7a('0x73'),_0xfa7a('0x74'),_0xfa7a('0x75'),_0xfa7a('0x76'),_0xfa7a('0x77'),_0xfa7a('0x78'),'Call_Type'];_0x5cc32c=_['remove'](_0x3b5f5d[_0xfa7a('0x37')],function(_0x1a9762){return _0x52db03[_0xfa7a('0x79')](_0x1a9762['api_name']);});for(var _0xdab333=0x0;_0xdab333<_0x5cc32c[_0xfa7a('0x4f')];_0xdab333++){if(_0x5cc32c[_0xdab333][_0xfa7a('0x7a')]===![]){_0x4a942d['push']({'id':_0x5cc32c[_0xdab333]['id'],'name':_0x5cc32c[_0xdab333][_0xfa7a('0x7b')],'custom':_0x5cc32c[_0xdab333]['custom_field'],'options':_0x5cc32c[_0xdab333][_0xfa7a('0x7c')]===_0xfa7a('0x7d')&&_0x5cc32c[_0xdab333][_0xfa7a('0x7e')][_0xfa7a('0x4f')]>-0x1?_[_0xfa7a('0x2c')](_0x5cc32c[_0xdab333]['pick_list_values'],function(_0x453859){return{'name':_0x453859,'value':_0x453859};}):[]});}}return{'count':_0x4a942d[_0xfa7a('0x4f')],'rows':_0x4a942d};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x59182e,null))[_0xfa7a('0x49')](function(_0x2d0e12){var _0x342390=_0x106a44[_0xfa7a('0x35')][_0xfa7a('0x7f')]?0x1f4:_0x2d0e12[_0xfa7a('0x80')]||0x1f4;logger[_0xfa7a('0x28')](_0xfa7a('0x81'),'getFields',_0x342390,JSON['stringify'](_0x2d0e12));delete _0x2d0e12[_0xfa7a('0x2a')];if(_0x342390===0x191){_0x342390=0x190;}_0x59182e[_0xfa7a('0x19')](_0x342390)[_0xfa7a('0x82')](_0x106a44[_0xfa7a('0x35')][_0xfa7a('0x7f')]?{'message':_0xfa7a('0x83'),'statusCode':_0x2d0e12[_0xfa7a('0x80')]}:_0x2d0e12);});}; \ No newline at end of file +var _0xa01b=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','update','then','destroy','error','name','send','index','ZohoAccount','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','body','getConfigurations','ZohoConfiguration','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','create','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','slice','substring','lastIndexOf','GET','format','Calls','response','message','Owner','Description','WhoId','Call_Duration','Call_Result','Call_Type','remove','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','stringify','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x43cf80,_0x669560){var _0x91e948=function(_0x1378d7){while(--_0x1378d7){_0x43cf80['push'](_0x43cf80['shift']());}};_0x91e948(++_0x669560);}(_0xa01b,0x6e));var _0xba01=function(_0x40e7fc,_0x469aba){_0x40e7fc=_0x40e7fc-0x0;var _0x2acfc2=_0xa01b[_0x40e7fc];return _0x2acfc2;};'use strict';var emlformat=require(_0xba01('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xba01('0x1'));var rp=require(_0xba01('0x2'));var moment=require(_0xba01('0x3'));var BPromise=require(_0xba01('0x4'));var Mustache=require(_0xba01('0x5'));var util=require(_0xba01('0x6'));var path=require(_0xba01('0x7'));var sox=require(_0xba01('0x8'));var csv=require(_0xba01('0x9'));var ejs=require(_0xba01('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xba01('0xb'));var squel=require(_0xba01('0xc'));var crypto=require('crypto');var jsforce=require(_0xba01('0xd'));var deskjs=require(_0xba01('0xe'));var toCsv=require(_0xba01('0x9'));var querystring=require('querystring');var Papa=require(_0xba01('0xf'));var Redis=require(_0xba01('0x10'));var authService=require(_0xba01('0x11'));var qs=require(_0xba01('0x12'));var as=require(_0xba01('0x13'));var hardwareService=require(_0xba01('0x14'));var logger=require(_0xba01('0x15'))(_0xba01('0x16'));var utils=require(_0xba01('0x17'));var config=require(_0xba01('0x18'));var licenseUtil=require(_0xba01('0x19'));var db=require(_0xba01('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x20e0b6,_0x3d5461){_0x3d5461=_0x3d5461||0xcc;return function(_0x45cd5f){if(_0x45cd5f){return _0x20e0b6[_0xba01('0x1b')](_0x3d5461);}return _0x20e0b6['status'](_0x3d5461)[_0xba01('0x1c')]();};}function respondWithResult(_0x27872e,_0x3f1929){_0x3f1929=_0x3f1929||0xc8;return function(_0x371418){if(_0x371418){return _0x27872e[_0xba01('0x1d')](_0x3f1929)[_0xba01('0x1e')](_0x371418);}};}function respondWithFilteredResult(_0x44d428,_0x5b2a6f){return function(_0x46ed63){if(_0x46ed63){var _0x5bdee4=typeof _0x5b2a6f[_0xba01('0x1f')]===_0xba01('0x20')&&typeof _0x5b2a6f[_0xba01('0x21')]==='undefined';var _0x224be6=_0x46ed63[_0xba01('0x22')];var _0x476d9d=_0x5bdee4?0x0:_0x5b2a6f[_0xba01('0x1f')];var _0x288d7a=_0x5bdee4?_0x46ed63[_0xba01('0x22')]:_0x5b2a6f[_0xba01('0x1f')]+_0x5b2a6f[_0xba01('0x21')];var _0x195168;if(_0x288d7a>=_0x224be6){_0x288d7a=_0x224be6;_0x195168=0xc8;}else{_0x195168=0xce;}_0x44d428['status'](_0x195168);return _0x44d428['set']('Content-Range',_0x476d9d+'-'+_0x288d7a+'/'+_0x224be6)[_0xba01('0x1e')](_0x46ed63);}return null;};}function patchUpdates(_0x23edc4){return function(_0x4b8970){try{jsonpatch[_0xba01('0x23')](_0x4b8970,_0x23edc4,!![]);}catch(_0x473a13){return BPromise[_0xba01('0x24')](_0x473a13);}return _0x4b8970['save']();};}function saveUpdates(_0x101625,_0x4c2f9b){return function(_0x713736){if(_0x713736){return _0x713736[_0xba01('0x25')](_0x101625)[_0xba01('0x26')](function(_0x393214){return _0x393214;});}return null;};}function removeEntity(_0x27d1b4,_0x222c13){return function(_0x5d027a){if(_0x5d027a){return _0x5d027a[_0xba01('0x27')]()[_0xba01('0x26')](function(){_0x27d1b4['status'](0xcc)[_0xba01('0x1c')]();});}};}function handleEntityNotFound(_0x2d2afa,_0x32e39d){return function(_0x5938e0){if(!_0x5938e0){_0x2d2afa[_0xba01('0x1b')](0x194);}return _0x5938e0;};}function handleError(_0xb2b7fa,_0xdc8a2d){_0xdc8a2d=_0xdc8a2d||0x1f4;return function(_0x20a55d){logger[_0xba01('0x28')](_0x20a55d['stack']);if(_0x20a55d[_0xba01('0x29')]){delete _0x20a55d[_0xba01('0x29')];}_0xb2b7fa['status'](_0xdc8a2d)[_0xba01('0x2a')](_0x20a55d);};}exports[_0xba01('0x2b')]=function(_0x59e4a2,_0x520732){var _0x42ab98={},_0x4f500e={},_0x694324={'count':0x0,'rows':[]};var _0x44955e=_['map'](db[_0xba01('0x2c')][_0xba01('0x2d')],function(_0x2294fb){return{'name':_0x2294fb[_0xba01('0x2e')],'type':_0x2294fb[_0xba01('0x2f')][_0xba01('0x30')]};});_0x4f500e['model']=_[_0xba01('0x31')](_0x44955e,_0xba01('0x29'));_0x4f500e[_0xba01('0x32')]=_[_0xba01('0x33')](_0x59e4a2[_0xba01('0x32')]);_0x4f500e['filters']=_[_0xba01('0x34')](_0x4f500e[_0xba01('0x35')],_0x4f500e[_0xba01('0x32')]);_0x42ab98[_0xba01('0x36')]=_[_0xba01('0x34')](_0x4f500e[_0xba01('0x35')],qs[_0xba01('0x37')](_0x59e4a2[_0xba01('0x32')][_0xba01('0x37')]));_0x42ab98[_0xba01('0x36')]=_0x42ab98['attributes'][_0xba01('0x38')]?_0x42ab98[_0xba01('0x36')]:_0x4f500e[_0xba01('0x35')];if(!_0x59e4a2[_0xba01('0x32')][_0xba01('0x39')]('nolimit')){_0x42ab98[_0xba01('0x21')]=qs[_0xba01('0x21')](_0x59e4a2[_0xba01('0x32')][_0xba01('0x21')]);_0x42ab98[_0xba01('0x1f')]=qs['offset'](_0x59e4a2[_0xba01('0x32')][_0xba01('0x1f')]);}_0x42ab98[_0xba01('0x3a')]=qs[_0xba01('0x3b')](_0x59e4a2[_0xba01('0x32')][_0xba01('0x3b')]);_0x42ab98[_0xba01('0x3c')]=qs['filters'](_[_0xba01('0x3d')](_0x59e4a2[_0xba01('0x32')],_0x4f500e[_0xba01('0x3e')]),_0x44955e);if(_0x59e4a2[_0xba01('0x32')][_0xba01('0x3f')]){_0x42ab98[_0xba01('0x3c')]=_[_0xba01('0x40')](_0x42ab98[_0xba01('0x3c')],{'$or':_[_0xba01('0x31')](_0x44955e,function(_0xc8fe05){if(_0xc8fe05[_0xba01('0x2f')]!==_0xba01('0x41')){var _0x549311={};_0x549311[_0xc8fe05[_0xba01('0x29')]]={'$like':'%'+_0x59e4a2['query']['filter']+'%'};return _0x549311;}})});}_0x42ab98=_['merge']({},_0x42ab98,_0x59e4a2[_0xba01('0x42')]);var _0x53366e={'where':_0x42ab98[_0xba01('0x3c')]};return db[_0xba01('0x2c')][_0xba01('0x22')](_0x53366e)[_0xba01('0x26')](function(_0xc07f18){_0x694324['count']=_0xc07f18;if(_0x59e4a2['query'][_0xba01('0x43')]){_0x42ab98['include']=[{'all':!![]}];}return db[_0xba01('0x2c')][_0xba01('0x44')](_0x42ab98);})[_0xba01('0x26')](function(_0x2627a){_0x694324[_0xba01('0x45')]=_0x2627a;return _0x694324;})[_0xba01('0x26')](respondWithFilteredResult(_0x520732,_0x42ab98))[_0xba01('0x46')](handleError(_0x520732,null));};exports[_0xba01('0x47')]=function(_0x2f7f89,_0x1608e9){var _0x120e32={'raw':![],'where':{'id':_0x2f7f89[_0xba01('0x48')]['id']}},_0x56c869={};_0x56c869['model']=_[_0xba01('0x33')](db[_0xba01('0x2c')][_0xba01('0x2d')]);_0x56c869[_0xba01('0x32')]=_[_0xba01('0x33')](_0x2f7f89[_0xba01('0x32')]);_0x56c869[_0xba01('0x3e')]=_['intersection'](_0x56c869[_0xba01('0x35')],_0x56c869[_0xba01('0x32')]);_0x120e32['attributes']=_[_0xba01('0x34')](_0x56c869[_0xba01('0x35')],qs['fields'](_0x2f7f89[_0xba01('0x32')][_0xba01('0x37')]));_0x120e32[_0xba01('0x36')]=_0x120e32[_0xba01('0x36')][_0xba01('0x38')]?_0x120e32['attributes']:_0x56c869[_0xba01('0x35')];if(_0x2f7f89[_0xba01('0x32')][_0xba01('0x43')]){_0x120e32['include']=[{'all':!![]}];}_0x120e32=_[_0xba01('0x40')]({},_0x120e32,_0x2f7f89[_0xba01('0x42')]);return db[_0xba01('0x2c')]['find'](_0x120e32)[_0xba01('0x26')](handleEntityNotFound(_0x1608e9,null))[_0xba01('0x26')](respondWithResult(_0x1608e9,null))[_0xba01('0x46')](handleError(_0x1608e9,null));};exports['create']=function(_0x3e1324,_0x5dd41e){return db[_0xba01('0x2c')]['create'](_0x3e1324[_0xba01('0x49')],{})[_0xba01('0x26')](respondWithResult(_0x5dd41e,0xc9))[_0xba01('0x46')](handleError(_0x5dd41e,null));};exports[_0xba01('0x25')]=function(_0x1adcf6,_0x5bc88a){if(_0x1adcf6['body']['id']){delete _0x1adcf6[_0xba01('0x49')]['id'];}return db[_0xba01('0x2c')]['find']({'where':{'id':_0x1adcf6['params']['id']}})['then'](handleEntityNotFound(_0x5bc88a,null))[_0xba01('0x26')](saveUpdates(_0x1adcf6[_0xba01('0x49')],null))[_0xba01('0x26')](respondWithResult(_0x5bc88a,null))[_0xba01('0x46')](handleError(_0x5bc88a,null));};exports[_0xba01('0x27')]=function(_0x5c7181,_0x14ffa2){return db[_0xba01('0x2c')]['find']({'where':{'id':_0x5c7181['params']['id']}})[_0xba01('0x26')](handleEntityNotFound(_0x14ffa2,null))[_0xba01('0x26')](removeEntity(_0x14ffa2,null))[_0xba01('0x46')](handleError(_0x14ffa2,null));};exports[_0xba01('0x4a')]=function(_0x2fd9ac,_0x3260ac,_0x3b4519){var _0x406949={};var _0x698809={};var _0x5e0f50;var _0x549427;return db[_0xba01('0x2c')]['findOne']({'where':{'id':_0x2fd9ac[_0xba01('0x48')]['id']}})['then'](handleEntityNotFound(_0x3260ac,null))[_0xba01('0x26')](function(_0x16d92a){if(_0x16d92a){_0x5e0f50=_0x16d92a;_0x698809[_0xba01('0x35')]=_[_0xba01('0x33')](db[_0xba01('0x4b')][_0xba01('0x2d')]);_0x698809[_0xba01('0x32')]=_[_0xba01('0x33')](_0x2fd9ac['query']);_0x698809[_0xba01('0x3e')]=_[_0xba01('0x34')](_0x698809[_0xba01('0x35')],_0x698809['query']);_0x406949[_0xba01('0x36')]=_[_0xba01('0x34')](_0x698809['model'],qs[_0xba01('0x37')](_0x2fd9ac[_0xba01('0x32')][_0xba01('0x37')]));_0x406949[_0xba01('0x36')]=_0x406949[_0xba01('0x36')][_0xba01('0x38')]?_0x406949['attributes']:_0x698809[_0xba01('0x35')];_0x406949[_0xba01('0x3a')]=qs['sort'](_0x2fd9ac['query'][_0xba01('0x3b')]);_0x406949[_0xba01('0x3c')]=qs[_0xba01('0x3e')](_[_0xba01('0x3d')](_0x2fd9ac[_0xba01('0x32')],_0x698809[_0xba01('0x3e')]));if(_0x2fd9ac['query'][_0xba01('0x3f')]){_0x406949[_0xba01('0x3c')]=_[_0xba01('0x40')](_0x406949[_0xba01('0x3c')],{'$or':_[_0xba01('0x31')](_0x406949['attributes'],function(_0x5c0745){var _0x371b17={};_0x371b17[_0x5c0745]={'$like':'%'+_0x2fd9ac[_0xba01('0x32')]['filter']+'%'};return _0x371b17;})});}_0x406949=_['merge']({},_0x406949,_0x2fd9ac[_0xba01('0x42')]);return _0x5e0f50[_0xba01('0x4a')](_0x406949);}})[_0xba01('0x26')](function(_0x1d6f9d){if(_0x1d6f9d){_0x549427=_0x1d6f9d['length'];if(!_0x2fd9ac[_0xba01('0x32')][_0xba01('0x39')](_0xba01('0x4c'))){_0x406949[_0xba01('0x21')]=qs[_0xba01('0x21')](_0x2fd9ac[_0xba01('0x32')]['limit']);_0x406949['offset']=qs[_0xba01('0x1f')](_0x2fd9ac[_0xba01('0x32')][_0xba01('0x1f')]);}return _0x5e0f50[_0xba01('0x4a')](_0x406949);}})['then'](function(_0x4c661a){if(_0x4c661a){return _0x4c661a?{'count':_0x549427,'rows':_0x4c661a}:null;}})[_0xba01('0x26')](respondWithResult(_0x3260ac,null))['catch'](handleError(_0x3260ac,null));};exports[_0xba01('0x4d')]=function(_0x493396,_0x48df80,_0x4cae21){if(_0x493396[_0xba01('0x49')]['id']){delete _0x493396[_0xba01('0x49')]['id'];}return db['ZohoAccount'][_0xba01('0x4e')]({'where':{'id':_0x493396[_0xba01('0x48')]['id']}})[_0xba01('0x26')](handleEntityNotFound(_0x48df80,null))[_0xba01('0x26')](function(_0x5b0a72){if(_0x5b0a72){_0x493396[_0xba01('0x49')][_0xba01('0x4f')]=_0x5b0a72['id'];_0x493396[_0xba01('0x49')][_0xba01('0x50')]=integrations[_0xba01('0x51')](_0x493396[_0xba01('0x49')][_0xba01('0x52')],_0x493396[_0xba01('0x49')][_0xba01('0x2f')]);_0x493396['body']['Descriptions']=integrations[_0xba01('0x53')](_0x493396[_0xba01('0x49')][_0xba01('0x52')],_0x493396[_0xba01('0x49')][_0xba01('0x2f')]);return db[_0xba01('0x4b')][_0xba01('0x54')](_0x493396[_0xba01('0x49')],{'include':[{'model':db[_0xba01('0x55')],'as':_0xba01('0x50')},{'model':db[_0xba01('0x55')],'as':_0xba01('0x56')}]});}return null;})[_0xba01('0x26')](respondWithResult(_0x48df80,null))[_0xba01('0x46')](handleError(_0x48df80,null));};function getAccessToken(_0x4ae8f1){return new Promise(function(_0x267fb4,_0x3dda1b){var _0x453a3e;switch(_0x4ae8f1[_0xba01('0x57')]){case'US':_0x453a3e=_0xba01('0x58');break;case'AU':_0x453a3e=_0xba01('0x59');break;case'EU':_0x453a3e='https://accounts.zoho.eu';break;case'IN':_0x453a3e=_0xba01('0x5a');break;case'CN':_0x453a3e=_0xba01('0x5b');break;default:_0x453a3e='https://accounts.zoho.eu';break;}var _0x44e520={'method':_0xba01('0x5c'),'uri':_0x453a3e+_0xba01('0x5d'),'qs':{'refresh_token':_0x4ae8f1[_0xba01('0x5e')],'client_id':_0x4ae8f1[_0xba01('0x5f')],'client_secret':_0x4ae8f1[_0xba01('0x60')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x44e520)['then'](function(_0x25a514){if(_0x25a514[_0xba01('0x61')]){_0x267fb4(_0x25a514[_0xba01('0x61')]);}else{_0x3dda1b(_0xba01('0x62'));}})[_0xba01('0x46')](function(_0x457f68){_0x3dda1b(_0x457f68);});});}exports[_0xba01('0x63')]=function(_0xb313b,_0x5811a3,_0xb93ef4){var _0xaac24e,_0x435e56,_0x348281,_0x7f9ed,_0x6ec6b8;return db[_0xba01('0x2c')]['findOne']({'where':{'id':_0xb313b[_0xba01('0x48')]['id']},'attributes':['id',_0xba01('0x64'),_0xba01('0x57'),_0xba01('0x5f'),_0xba01('0x60'),_0xba01('0x65'),'code',_0xba01('0x5e')]})['then'](handleEntityNotFound(_0x5811a3,null))['then'](function(_0x514f71){_0x6ec6b8=_0x514f71;_0xaac24e=_0x6ec6b8[_0xba01('0x64')];_0x435e56=_0xaac24e==='zoho.eu'?'eu':'com';_0x348281=_0x6ec6b8['serverUrl'];var _0xbb4625=_0x348281[_0xba01('0x66')](-0x1);if(_0xbb4625==='/'||_0xbb4625==='\x5c'||_0xbb4625===':'){_0x348281=_0x348281[_0xba01('0x67')](0x0,_0x348281[_0xba01('0x68')](_0xbb4625));}if(!_0x6ec6b8['refreshToken']){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x6ec6b8);})['then'](function(_0x3353d5){if(_0x3353d5){return rp({'method':_0xba01('0x69'),'uri':util[_0xba01('0x6a')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x435e56),'qs':{'module':_0xba01('0x6b')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3353d5},'json':!![]});}})[_0xba01('0x26')](function(_0x3b24b2){if(_0x3b24b2){if(_0x3b24b2[_0xba01('0x6c')]&&_0x3b24b2[_0xba01('0x6c')]['error']){throw new Error(_0x3b24b2[_0xba01('0x6c')][_0xba01('0x28')][_0xba01('0x6d')]);}var _0x20d8b0=[];var _0x589d2e=[];var _0x1a74fb=[_0xba01('0x6e'),'Subject',_0xba01('0x6f'),_0xba01('0x70'),_0xba01('0x71'),_0xba01('0x72'),'Call_Start_Time',_0xba01('0x73')];_0x589d2e=_[_0xba01('0x74')](_0x3b24b2['fields'],function(_0x251ff5){return _0x1a74fb['includes'](_0x251ff5['api_name']);});for(var _0x49a553=0x0;_0x49a553<_0x589d2e['length'];_0x49a553++){if(_0x589d2e[_0x49a553][_0xba01('0x75')]===![]){_0x20d8b0[_0xba01('0x76')]({'id':_0x589d2e[_0x49a553]['id'],'name':_0x589d2e[_0x49a553][_0xba01('0x77')],'custom':_0x589d2e[_0x49a553][_0xba01('0x78')],'options':_0x589d2e[_0x49a553][_0xba01('0x79')]===_0xba01('0x7a')&&_0x589d2e[_0x49a553][_0xba01('0x7b')][_0xba01('0x38')]>-0x1?_[_0xba01('0x31')](_0x589d2e[_0x49a553]['pick_list_values'],function(_0x1553e6){return{'name':_0x1553e6,'value':_0x1553e6};}):[]});}}return{'count':_0x20d8b0[_0xba01('0x38')],'rows':_0x20d8b0};}else{return{'count':0x0,'rows':[]};}})[_0xba01('0x26')](respondWithResult(_0x5811a3,null))[_0xba01('0x46')](function(_0x21782c){var _0x1062b0=_0xb313b[_0xba01('0x32')][_0xba01('0x7c')]?0x1f4:_0x21782c[_0xba01('0x7d')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xba01('0x63'),_0x1062b0,JSON[_0xba01('0x7e')](_0x21782c));delete _0x21782c[_0xba01('0x29')];if(_0x1062b0===0x191){_0x1062b0=0x190;}_0x5811a3[_0xba01('0x1d')](_0x1062b0)[_0xba01('0x2a')](_0xb313b['query']['test']?{'message':_0xba01('0x7f'),'statusCode':_0x21782c[_0xba01('0x7d')]}:_0x21782c);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 8f26769..f87023c 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 _0x7549=['int_zoho_accounts','zone','changed','serverUrl','clientId','clientSecret','host','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','code','application/x-www-form-urlencoded','then','parse','refresh_token','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','refreshToken','info','../../config/logger','api','moment','bluebird','path','../../config/environment','./intZohoAccount.attributes','ZohoAccount'];(function(_0x4f5a26,_0x310a1b){var _0x4ef286=function(_0xbe933d){while(--_0xbe933d){_0x4f5a26['push'](_0x4f5a26['shift']());}};_0x4ef286(++_0x310a1b);}(_0x7549,0xe8));var _0x9754=function(_0x1b4dad,_0x42ee2d){_0x1b4dad=_0x1b4dad-0x0;var _0x4e80ec=_0x7549[_0x1b4dad];return _0x4e80ec;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9754('0x0'))(_0x9754('0x1'));var moment=require(_0x9754('0x2'));var BPromise=require(_0x9754('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9754('0x4'));var rimraf=require('rimraf');var config=require(_0x9754('0x5'));var attributes=require(_0x9754('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x592491,_0x50cb43){return _0x592491['define'](_0x9754('0x7'),attributes,{'tableName':_0x9754('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2573ff,_0x20cd2a,_0x1eda72){if(_0x2573ff['changed'](_0x9754('0x9'))||_0x2573ff[_0x9754('0xa')](_0x9754('0xb'))||_0x2573ff['changed'](_0x9754('0xc'))||_0x2573ff[_0x9754('0xa')](_0x9754('0xd'))||_0x2573ff[_0x9754('0xa')]('code')||_0x2573ff['changed'](_0x9754('0xe'))){var _0x539e95,_0x773e0e;_0x539e95=_0x2573ff[_0x9754('0xb')];var _0x213237=_0x539e95['slice'](-0x1);if(_0x213237==='/'||_0x213237==='\x5c'||_0x213237===':'){_0x539e95=_0x539e95['substring'](0x0,_0x539e95['lastIndexOf'](_0x213237));}switch(_0x2573ff['zone']){case'US':_0x773e0e='https://accounts.zoho.com';break;case'AU':_0x773e0e='https://accounts.zoho.com.au';break;case'IN':_0x773e0e='https://accounts.zoho.in';break;case'CN':_0x773e0e='https://accounts.zoho.com.cn';break;default:_0x773e0e=_0x9754('0xf');break;}var _0x874198={'method':_0x9754('0x10'),'uri':_0x773e0e+_0x9754('0x11'),'form':{'grant_type':_0x9754('0x12'),'client_id':_0x2573ff['clientId'],'client_secret':_0x2573ff[_0x9754('0xd')],'redirect_uri':_0x2573ff['serverUrl'],'code':_0x2573ff[_0x9754('0x13')]},'headers':{'Content-Type':_0x9754('0x14')}};return rp(_0x874198)[_0x9754('0x15')](function(_0x5a76f0){var _0x4ad7e7=JSON[_0x9754('0x16')](_0x5a76f0);if(_0x4ad7e7[_0x9754('0x17')]){_0x2573ff['refreshToken']=_0x4ad7e7[_0x9754('0x17')];logger['info'](util[_0x9754('0x18')](_0x9754('0x19'),_0x2573ff[_0x9754('0x1a')],_0x2573ff['id']));}else{logger[_0x9754('0x1b')](util[_0x9754('0x18')](_0x9754('0x1c'),_0x2573ff['name'],_0x2573ff['id']),util[_0x9754('0x1d')](_0x4ad7e7,{'showHidden':![],'depth':null}));}return _0x1eda72(null,_0x20cd2a);})[_0x9754('0x1e')](function(_0x4f224e){logger[_0x9754('0x1b')](util[_0x9754('0x18')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2573ff[_0x9754('0x1a')],_0x2573ff['id']),util[_0x9754('0x1d')](parsedResult,{'showHidden':![],'depth':null}));return _0x1eda72(_0x4f224e);});}else{return _0x1eda72(null,_0x20cd2a);}},'beforeUpdate':function(_0x492a83,_0x3ff746,_0x2d0ffb){if(_0x492a83[_0x9754('0xa')]('zone')||_0x492a83[_0x9754('0xa')](_0x9754('0xb'))||_0x492a83[_0x9754('0xa')](_0x9754('0xc'))||_0x492a83['changed']('clientSecret')||_0x492a83[_0x9754('0xa')](_0x9754('0x13'))||_0x492a83['changed'](_0x9754('0xe'))){var _0x7d95cc,_0x544f03;_0x7d95cc=_0x492a83[_0x9754('0xb')];var _0x28ea20=_0x7d95cc[_0x9754('0x1f')](-0x1);if(_0x28ea20==='/'||_0x28ea20==='\x5c'||_0x28ea20===':'){_0x7d95cc=_0x7d95cc[_0x9754('0x20')](0x0,_0x7d95cc[_0x9754('0x21')](_0x28ea20));}switch(_0x492a83[_0x9754('0x9')]){case'US':_0x544f03=_0x9754('0x22');break;case'AU':_0x544f03=_0x9754('0x23');break;case'IN':_0x544f03=_0x9754('0x24');break;case'CN':_0x544f03=_0x9754('0x25');break;default:_0x544f03=_0x9754('0xf');break;}var _0x16f40c={'method':_0x9754('0x10'),'uri':_0x544f03+'/oauth/v2/token','form':{'grant_type':_0x9754('0x12'),'client_id':_0x492a83[_0x9754('0xc')],'client_secret':_0x492a83[_0x9754('0xd')],'redirect_uri':_0x492a83[_0x9754('0xb')],'code':_0x492a83['code']},'headers':{'Content-Type':_0x9754('0x14')}};return rp(_0x16f40c)[_0x9754('0x15')](function(_0x257d7a){var _0x3b3eca=JSON['parse'](_0x257d7a);if(_0x3b3eca[_0x9754('0x17')]){_0x492a83[_0x9754('0x26')]=_0x3b3eca['refresh_token'];logger[_0x9754('0x27')](util[_0x9754('0x18')](_0x9754('0x19'),_0x492a83[_0x9754('0x1a')],_0x492a83['id']));}else{logger['error'](util[_0x9754('0x18')](_0x9754('0x1c'),_0x492a83[_0x9754('0x1a')],_0x492a83['id']),util[_0x9754('0x1d')](_0x3b3eca,{'showHidden':![],'depth':null}));}return _0x2d0ffb(null,_0x3ff746);})[_0x9754('0x1e')](function(_0x3c7fcc){logger[_0x9754('0x1b')](util['format'](_0x9754('0x1c'),_0x492a83[_0x9754('0x1a')],_0x492a83['id']),util[_0x9754('0x1d')](parsedResult,{'showHidden':![],'depth':null}));return _0x2d0ffb(_0x3c7fcc);});}else{return _0x2d0ffb(null,_0x3ff746);}}}});}; \ No newline at end of file +var _0x164a=['../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','int_zoho_accounts','changed','zone','clientId','clientSecret','code','host','serverUrl','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','then','parse','refreshToken','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','slice','lastIndexOf','application/x-www-form-urlencoded','catch','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x164a,0x133));var _0xa164=function(_0x39507b,_0x3efdac){_0x39507b=_0x39507b-0x0;var _0x5e7dd4=_0x164a[_0x39507b];return _0x5e7dd4;};'use strict';var _=require('lodash');var util=require(_0xa164('0x0'));var logger=require(_0xa164('0x1'))(_0xa164('0x2'));var moment=require('moment');var BPromise=require(_0xa164('0x3'));var rp=require(_0xa164('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa164('0x5'));var attributes=require(_0xa164('0x6'));var integrations=require(_0xa164('0x7'));module['exports']=function(_0x2d3b78,_0x371844){return _0x2d3b78[_0xa164('0x8')]('ZohoAccount',attributes,{'tableName':_0xa164('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2e3a38,_0x380674,_0x4f3dab){if(_0x2e3a38[_0xa164('0xa')](_0xa164('0xb'))||_0x2e3a38[_0xa164('0xa')]('serverUrl')||_0x2e3a38[_0xa164('0xa')](_0xa164('0xc'))||_0x2e3a38[_0xa164('0xa')](_0xa164('0xd'))||_0x2e3a38['changed'](_0xa164('0xe'))||_0x2e3a38[_0xa164('0xa')](_0xa164('0xf'))){var _0x34ee60,_0x5cf865;_0x34ee60=_0x2e3a38[_0xa164('0x10')];var _0x336086=_0x34ee60['slice'](-0x1);if(_0x336086==='/'||_0x336086==='\x5c'||_0x336086===':'){_0x34ee60=_0x34ee60[_0xa164('0x11')](0x0,_0x34ee60['lastIndexOf'](_0x336086));}switch(_0x2e3a38[_0xa164('0xb')]){case'US':_0x5cf865=_0xa164('0x12');break;case'AU':_0x5cf865=_0xa164('0x13');break;case'IN':_0x5cf865=_0xa164('0x14');break;case'CN':_0x5cf865=_0xa164('0x15');break;default:_0x5cf865='https://accounts.zoho.eu';break;}var _0x358352={'method':_0xa164('0x16'),'uri':_0x5cf865+_0xa164('0x17'),'form':{'grant_type':'authorization_code','client_id':_0x2e3a38[_0xa164('0xc')],'client_secret':_0x2e3a38['clientSecret'],'redirect_uri':_0x2e3a38[_0xa164('0x10')],'code':_0x2e3a38[_0xa164('0xe')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x358352)[_0xa164('0x18')](function(_0x360eb3){var _0x15da95=JSON[_0xa164('0x19')](_0x360eb3);if(_0x15da95['refresh_token']){_0x2e3a38[_0xa164('0x1a')]=_0x15da95[_0xa164('0x1b')];logger[_0xa164('0x1c')](util[_0xa164('0x1d')](_0xa164('0x1e'),_0x2e3a38[_0xa164('0x1f')],_0x2e3a38['id']));}else{logger[_0xa164('0x20')](util['format'](_0xa164('0x21'),_0x2e3a38[_0xa164('0x1f')],_0x2e3a38['id']),util[_0xa164('0x22')](_0x15da95,{'showHidden':![],'depth':null}));}return _0x4f3dab(null,_0x380674);})['catch'](function(_0xedeee5){logger[_0xa164('0x20')](util[_0xa164('0x1d')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2e3a38[_0xa164('0x1f')],_0x2e3a38['id']),util[_0xa164('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x4f3dab(_0xedeee5);});}else{return _0x4f3dab(null,_0x380674);}},'beforeUpdate':function(_0x4e7328,_0x4a70b2,_0x1d4252){if(_0x4e7328[_0xa164('0xa')](_0xa164('0xb'))||_0x4e7328[_0xa164('0xa')](_0xa164('0x10'))||_0x4e7328['changed'](_0xa164('0xc'))||_0x4e7328[_0xa164('0xa')]('clientSecret')||_0x4e7328[_0xa164('0xa')](_0xa164('0xe'))||_0x4e7328[_0xa164('0xa')](_0xa164('0xf'))){var _0x1cf512,_0x581918;_0x1cf512=_0x4e7328[_0xa164('0x10')];var _0x2eaf50=_0x1cf512[_0xa164('0x23')](-0x1);if(_0x2eaf50==='/'||_0x2eaf50==='\x5c'||_0x2eaf50===':'){_0x1cf512=_0x1cf512[_0xa164('0x11')](0x0,_0x1cf512[_0xa164('0x24')](_0x2eaf50));}switch(_0x4e7328[_0xa164('0xb')]){case'US':_0x581918=_0xa164('0x12');break;case'AU':_0x581918=_0xa164('0x13');break;case'IN':_0x581918='https://accounts.zoho.in';break;case'CN':_0x581918=_0xa164('0x15');break;default:_0x581918='https://accounts.zoho.eu';break;}var _0x37c4b1={'method':_0xa164('0x16'),'uri':_0x581918+_0xa164('0x17'),'form':{'grant_type':'authorization_code','client_id':_0x4e7328[_0xa164('0xc')],'client_secret':_0x4e7328[_0xa164('0xd')],'redirect_uri':_0x4e7328[_0xa164('0x10')],'code':_0x4e7328[_0xa164('0xe')]},'headers':{'Content-Type':_0xa164('0x25')}};return rp(_0x37c4b1)['then'](function(_0x50005a){var _0x3946cd=JSON[_0xa164('0x19')](_0x50005a);if(_0x3946cd[_0xa164('0x1b')]){_0x4e7328['refreshToken']=_0x3946cd['refresh_token'];logger['info'](util[_0xa164('0x1d')](_0xa164('0x1e'),_0x4e7328[_0xa164('0x1f')],_0x4e7328['id']));}else{logger[_0xa164('0x20')](util[_0xa164('0x1d')](_0xa164('0x21'),_0x4e7328[_0xa164('0x1f')],_0x4e7328['id']),util[_0xa164('0x22')](_0x3946cd,{'showHidden':![],'depth':null}));}return _0x1d4252(null,_0x4a70b2);})[_0xa164('0x26')](function(_0x36753f){logger[_0xa164('0x20')](util[_0xa164('0x1d')](_0xa164('0x21'),_0x4e7328[_0xa164('0x1f')],_0x4e7328['id']),util[_0xa164('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x1d4252(_0x36753f);});}else{return _0x1d4252(null,_0x4a70b2);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 9ad5018..2cc972e 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 _0xe34f=['ShowZohoAccount','stringify','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','error','message','result','ZohoAccount','findAll','options','raw','where','attributes','include','map','model','GetZohoAccount','debug','catch'];(function(_0x3651c2,_0x17d5d7){var _0x239e9d=function(_0x4c5b94){while(--_0x4c5b94){_0x3651c2['push'](_0x3651c2['shift']());}};_0x239e9d(++_0x17d5d7);}(_0xe34f,0xbc));var _0xfe34=function(_0x1301f4,_0x5defed){_0x1301f4=_0x1301f4-0x0;var _0x3efe8a=_0xe34f[_0x1301f4];return _0x3efe8a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfe34('0x0'));var fs=require('fs');var Redis=require(_0xfe34('0x1'));var db=require(_0xfe34('0x2'))['db'];var utils=require(_0xfe34('0x3'));var logger=require(_0xfe34('0x4'))(_0xfe34('0x5'));var config=require(_0xfe34('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfe34('0x7')][_0xfe34('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x195bcd,_0x3fe816,_0x25f17a){return new BPromise(function(_0x4fa1cd,_0x5cdc7e){return client[_0xfe34('0x9')](_0x195bcd,_0x25f17a)[_0xfe34('0xa')](function(_0x252ec7){logger[_0xfe34('0xb')](_0xfe34('0xc'),_0x3fe816,_0xfe34('0xd'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x3fe816,'request\x20sent',JSON['stringify'](_0x252ec7));if(_0x252ec7[_0xfe34('0xe')]){if(_0x252ec7[_0xfe34('0xe')]['code']===0x1f4){logger[_0xfe34('0xe')](_0xfe34('0xc'),_0x3fe816,_0x252ec7[_0xfe34('0xe')][_0xfe34('0xf')]);return _0x5cdc7e(_0x252ec7[_0xfe34('0xe')][_0xfe34('0xf')]);}logger['error'](_0xfe34('0xc'),_0x3fe816,_0x252ec7[_0xfe34('0xe')][_0xfe34('0xf')]);return _0x4fa1cd(_0x252ec7[_0xfe34('0xe')][_0xfe34('0xf')]);}else{logger['info'](_0xfe34('0xc'),_0x3fe816,_0xfe34('0xd'));_0x4fa1cd(_0x252ec7[_0xfe34('0x10')][_0xfe34('0xf')]);}})['catch'](function(_0x53b469){logger['error'](_0xfe34('0xc'),_0x3fe816,_0x53b469);_0x5cdc7e(_0x53b469);});});}exports['GetZohoAccount']=function(_0x5c95f5){var _0x495b48=this;return new Promise(function(_0x3f7f60,_0x19f7e3){return db[_0xfe34('0x11')][_0xfe34('0x12')]({'raw':_0x5c95f5['options']?_0x5c95f5[_0xfe34('0x13')][_0xfe34('0x14')]===undefined?!![]:![]:!![],'where':_0x5c95f5[_0xfe34('0x13')]?_0x5c95f5[_0xfe34('0x13')][_0xfe34('0x15')]||null:null,'attributes':_0x5c95f5[_0xfe34('0x13')]?_0x5c95f5['options'][_0xfe34('0x16')]||null:null,'limit':_0x5c95f5[_0xfe34('0x13')]?_0x5c95f5[_0xfe34('0x13')]['limit']||null:null,'include':_0x5c95f5[_0xfe34('0x13')]?_0x5c95f5[_0xfe34('0x13')][_0xfe34('0x17')]?_[_0xfe34('0x18')](_0x5c95f5[_0xfe34('0x13')][_0xfe34('0x17')],function(_0x249ffc){return{'model':db[_0x249ffc[_0xfe34('0x19')]],'as':_0x249ffc['as'],'attributes':_0x249ffc[_0xfe34('0x16')],'include':_0x249ffc[_0xfe34('0x17')]?_['map'](_0x249ffc[_0xfe34('0x17')],function(_0x257c3c){return{'model':db[_0x257c3c['model']],'as':_0x257c3c['as'],'attributes':_0x257c3c[_0xfe34('0x16')],'include':_0x257c3c['include']?_['map'](_0x257c3c[_0xfe34('0x17')],function(_0x5221dc){return{'model':db[_0x5221dc['model']],'as':_0x5221dc['as'],'attributes':_0x5221dc[_0xfe34('0x16')]};}):[]};}):[]};}):[]:[]})[_0xfe34('0xa')](function(_0x48a886){logger[_0xfe34('0xb')](_0xfe34('0x1a'),_0x5c95f5);logger[_0xfe34('0x1b')](_0xfe34('0x1a'),_0x5c95f5,JSON['stringify'](_0x48a886));_0x3f7f60(_0x48a886);})[_0xfe34('0x1c')](function(_0x59e06b){logger[_0xfe34('0xe')](_0xfe34('0x1a'),_0x59e06b[_0xfe34('0xf')],_0x5c95f5);_0x19f7e3(_0x495b48[_0xfe34('0xe')](0x1f4,_0x59e06b[_0xfe34('0xf')]));});});};exports[_0xfe34('0x1d')]=function(_0x44adf0){var _0x4b9b50=this;return new Promise(function(_0x345c00,_0x1a3cec){return db[_0xfe34('0x11')]['find']({'raw':_0x44adf0[_0xfe34('0x13')]?_0x44adf0[_0xfe34('0x13')][_0xfe34('0x14')]===undefined?!![]:![]:!![],'where':_0x44adf0[_0xfe34('0x13')]?_0x44adf0['options'][_0xfe34('0x15')]||null:null,'attributes':_0x44adf0[_0xfe34('0x13')]?_0x44adf0['options'][_0xfe34('0x16')]||null:null,'include':_0x44adf0[_0xfe34('0x13')]?_0x44adf0[_0xfe34('0x13')][_0xfe34('0x17')]?_[_0xfe34('0x18')](_0x44adf0['options']['include'],function(_0xa0a65a){return{'model':db[_0xa0a65a['model']],'as':_0xa0a65a['as'],'attributes':_0xa0a65a[_0xfe34('0x16')],'include':_0xa0a65a[_0xfe34('0x17')]?_[_0xfe34('0x18')](_0xa0a65a[_0xfe34('0x17')],function(_0x1c40c9){return{'model':db[_0x1c40c9[_0xfe34('0x19')]],'as':_0x1c40c9['as'],'attributes':_0x1c40c9['attributes'],'include':_0x1c40c9[_0xfe34('0x17')]?_[_0xfe34('0x18')](_0x1c40c9[_0xfe34('0x17')],function(_0x460911){return{'model':db[_0x460911[_0xfe34('0x19')]],'as':_0x460911['as'],'attributes':_0x460911[_0xfe34('0x16')]};}):[]};}):[]};}):[]:[]})[_0xfe34('0xa')](function(_0x3510a0){logger[_0xfe34('0xb')](_0xfe34('0x1d'),_0x44adf0);logger[_0xfe34('0x1b')](_0xfe34('0x1d'),_0x44adf0,JSON[_0xfe34('0x1e')](_0x3510a0));_0x345c00(_0x3510a0);})[_0xfe34('0x1c')](function(_0x1589f9){logger[_0xfe34('0xe')](_0xfe34('0x1d'),_0x1589f9[_0xfe34('0xf')],_0x44adf0);_0x1a3cec(_0x4b9b50[_0xfe34('0xe')](0x1f4,_0x1589f9['message']));});});}; \ No newline at end of file +var _0x36fe=['result','catch','ZohoAccount','findAll','options','where','limit','map','model','attributes','include','debug','GetZohoAccount','ShowZohoAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x13a811,_0x5833e5){var _0x67c0a4=function(_0x57f867){while(--_0x57f867){_0x13a811['push'](_0x13a811['shift']());}};_0x67c0a4(++_0x5833e5);}(_0x36fe,0x127));var _0xe36f=function(_0xf64e5,_0x4a3232){_0xf64e5=_0xf64e5-0x0;var _0x5f312c=_0x36fe[_0xf64e5];return _0x5f312c;};'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')]('ZohoAccount,\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);});});}exports['GetZohoAccount']=function(_0x4d9df2){var _0x518a22=this;return new Promise(function(_0x5aed4f,_0x1c47de){return db[_0xe36f('0x16')][_0xe36f('0x17')]({'raw':_0x4d9df2[_0xe36f('0x18')]?_0x4d9df2['options']['raw']===undefined?!![]:![]:!![],'where':_0x4d9df2[_0xe36f('0x18')]?_0x4d9df2[_0xe36f('0x18')][_0xe36f('0x19')]||null:null,'attributes':_0x4d9df2[_0xe36f('0x18')]?_0x4d9df2[_0xe36f('0x18')]['attributes']||null:null,'limit':_0x4d9df2[_0xe36f('0x18')]?_0x4d9df2['options'][_0xe36f('0x1a')]||null:null,'include':_0x4d9df2[_0xe36f('0x18')]?_0x4d9df2[_0xe36f('0x18')]['include']?_[_0xe36f('0x1b')](_0x4d9df2[_0xe36f('0x18')]['include'],function(_0xfd3899){return{'model':db[_0xfd3899[_0xe36f('0x1c')]],'as':_0xfd3899['as'],'attributes':_0xfd3899[_0xe36f('0x1d')],'include':_0xfd3899['include']?_['map'](_0xfd3899[_0xe36f('0x1e')],function(_0x35ef46){return{'model':db[_0x35ef46['model']],'as':_0x35ef46['as'],'attributes':_0x35ef46[_0xe36f('0x1d')],'include':_0x35ef46['include']?_[_0xe36f('0x1b')](_0x35ef46[_0xe36f('0x1e')],function(_0x196183){return{'model':db[_0x196183[_0xe36f('0x1c')]],'as':_0x196183['as'],'attributes':_0x196183[_0xe36f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe36f('0xc')](function(_0x403c8a){logger[_0xe36f('0xd')]('GetZohoAccount',_0x4d9df2);logger[_0xe36f('0x1f')]('GetZohoAccount',_0x4d9df2,JSON[_0xe36f('0x11')](_0x403c8a));_0x5aed4f(_0x403c8a);})[_0xe36f('0x15')](function(_0x471b91){logger[_0xe36f('0x12')](_0xe36f('0x20'),_0x471b91['message'],_0x4d9df2);_0x1c47de(_0x518a22[_0xe36f('0x12')](0x1f4,_0x471b91[_0xe36f('0x13')]));});});};exports[_0xe36f('0x21')]=function(_0x198132){var _0x17be47=this;return new Promise(function(_0x29c888,_0x4914c5){return db['ZohoAccount'][_0xe36f('0x22')]({'raw':_0x198132[_0xe36f('0x18')]?_0x198132[_0xe36f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x198132[_0xe36f('0x18')]?_0x198132['options'][_0xe36f('0x19')]||null:null,'attributes':_0x198132['options']?_0x198132[_0xe36f('0x18')]['attributes']||null:null,'include':_0x198132[_0xe36f('0x18')]?_0x198132['options'][_0xe36f('0x1e')]?_['map'](_0x198132[_0xe36f('0x18')][_0xe36f('0x1e')],function(_0x5bb1e7){return{'model':db[_0x5bb1e7[_0xe36f('0x1c')]],'as':_0x5bb1e7['as'],'attributes':_0x5bb1e7[_0xe36f('0x1d')],'include':_0x5bb1e7[_0xe36f('0x1e')]?_[_0xe36f('0x1b')](_0x5bb1e7[_0xe36f('0x1e')],function(_0x566702){return{'model':db[_0x566702['model']],'as':_0x566702['as'],'attributes':_0x566702[_0xe36f('0x1d')],'include':_0x566702[_0xe36f('0x1e')]?_[_0xe36f('0x1b')](_0x566702['include'],function(_0x251890){return{'model':db[_0x251890['model']],'as':_0x251890['as'],'attributes':_0x251890[_0xe36f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe36f('0xc')](function(_0xaf0959){logger[_0xe36f('0xd')]('ShowZohoAccount',_0x198132);logger['debug'](_0xe36f('0x21'),_0x198132,JSON['stringify'](_0xaf0959));_0x29c888(_0xaf0959);})[_0xe36f('0x15')](function(_0x8e563a){logger[_0xe36f('0x12')](_0xe36f('0x21'),_0x8e563a[_0xe36f('0x13')],_0x198132);_0x4914c5(_0x17be47[_0xe36f('0x12')](0x1f4,_0x8e563a[_0xe36f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index f6c4cc0..eacee68 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 _0x44a1=['show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','/:id','update','delete','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','isAuthenticated','index','get'];(function(_0x59b7c1,_0x34d4aa){var _0xef6fa9=function(_0x5e8af4){while(--_0x5e8af4){_0x59b7c1['push'](_0x59b7c1['shift']());}};_0xef6fa9(++_0x34d4aa);}(_0x44a1,0x1da));var _0x144a=function(_0xe29c57,_0x506b77){_0xe29c57=_0xe29c57-0x0;var _0x38d12e=_0x44a1[_0xe29c57];return _0x38d12e;};'use strict';var multer=require(_0x144a('0x0'));var util=require('util');var path=require(_0x144a('0x1'));var timeout=require(_0x144a('0x2'));var express=require('express');var router=express[_0x144a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x144a('0x4'));var interaction=require(_0x144a('0x5'));var config=require('../../config/environment');var controller=require(_0x144a('0x6'));router['get']('/',auth[_0x144a('0x7')](),controller[_0x144a('0x8')]);router[_0x144a('0x9')]('/:id',auth[_0x144a('0x7')](),controller[_0x144a('0xa')]);router[_0x144a('0x9')](_0x144a('0xb'),auth[_0x144a('0x7')](),controller[_0x144a('0xc')]);router[_0x144a('0x9')](_0x144a('0xd'),auth[_0x144a('0x7')](),controller[_0x144a('0xe')]);router[_0x144a('0x9')](_0x144a('0xf'),auth[_0x144a('0x7')](),controller[_0x144a('0x10')]);router['post']('/',auth[_0x144a('0x7')](),controller[_0x144a('0x11')]);router[_0x144a('0x12')](_0x144a('0x13'),auth['isAuthenticated'](),controller[_0x144a('0x14')]);router[_0x144a('0x15')](_0x144a('0x13'),auth[_0x144a('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xeec8=['put','/:id','update','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','get','index','isAuthenticated','getFields','/:id/subjects','getSubjects','getDescriptions'];(function(_0xd93b26,_0x12bbf2){var _0x25f668=function(_0x133ff7){while(--_0x133ff7){_0xd93b26['push'](_0xd93b26['shift']());}};_0x25f668(++_0x12bbf2);}(_0xeec8,0xb7));var _0x8eec=function(_0x4ed4fe,_0x35fd46){_0x4ed4fe=_0x4ed4fe-0x0;var _0x53d41b=_0xeec8[_0x4ed4fe];return _0x53d41b;};'use strict';var multer=require(_0x8eec('0x0'));var util=require(_0x8eec('0x1'));var path=require(_0x8eec('0x2'));var timeout=require('connect-timeout');var express=require(_0x8eec('0x3'));var router=express['Router']();var fs_extra=require(_0x8eec('0x4'));var auth=require(_0x8eec('0x5'));var interaction=require(_0x8eec('0x6'));var config=require('../../config/environment');var controller=require(_0x8eec('0x7'));router[_0x8eec('0x8')]('/',auth['isAuthenticated'](),controller[_0x8eec('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['get']('/:id/fields',auth[_0x8eec('0xa')](),controller[_0x8eec('0xb')]);router[_0x8eec('0x8')](_0x8eec('0xc'),auth[_0x8eec('0xa')](),controller[_0x8eec('0xd')]);router[_0x8eec('0x8')]('/:id/descriptions',auth[_0x8eec('0xa')](),controller[_0x8eec('0xe')]);router['post']('/',auth[_0x8eec('0xa')](),controller['create']);router[_0x8eec('0xf')](_0x8eec('0x10'),auth['isAuthenticated'](),controller[_0x8eec('0x11')]);router['delete'](_0x8eec('0x10'),auth['isAuthenticated'](),controller['destroy']);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 1d3d2f0..e814f19 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 _0xd251=['exports','STRING','lead','nothing','ENUM','contact_lead','contact'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd251,0xfc));var _0x1d25=function(_0x55c4e8,_0x55b02c){_0x55c4e8=_0x55c4e8-0x0;var _0x53a803=_0xd251[_0x55c4e8];return _0x53a803;};'use strict';var Sequelize=require('sequelize');module[_0x1d25('0x0')]={'name':{'type':Sequelize[_0x1d25('0x1')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x1d25('0x2'),'contact',_0x1d25('0x3')),'defaultValue':_0x1d25('0x2')},'moduleSearch':{'type':Sequelize[_0x1d25('0x4')](_0x1d25('0x5'),_0x1d25('0x6'),_0x1d25('0x2')),'defaultValue':_0x1d25('0x5')},'description':{'type':Sequelize[_0x1d25('0x1')]}}; \ No newline at end of file +var _0x0488=['ENUM','lead','contact','nothing','contact_lead','sequelize','exports','STRING'];(function(_0x61009e,_0x4602f9){var _0x279684=function(_0x5ae13e){while(--_0x5ae13e){_0x61009e['push'](_0x61009e['shift']());}};_0x279684(++_0x4602f9);}(_0x0488,0x17d));var _0x8048=function(_0x263d4a,_0x1a568c){_0x263d4a=_0x263d4a-0x0;var _0x5bb3d6=_0x0488[_0x263d4a];return _0x5bb3d6;};'use strict';var Sequelize=require(_0x8048('0x0'));module[_0x8048('0x1')]={'name':{'type':Sequelize[_0x8048('0x2')]},'moduleCreate':{'type':Sequelize[_0x8048('0x3')](_0x8048('0x4'),_0x8048('0x5'),_0x8048('0x6')),'defaultValue':_0x8048('0x4')},'moduleSearch':{'type':Sequelize[_0x8048('0x3')](_0x8048('0x7'),_0x8048('0x5'),'lead'),'defaultValue':_0x8048('0x7')},'description':{'type':Sequelize[_0x8048('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 2db32f0..b8089c3 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 _0xac86=['options','includeAll','include','ZohoConfiguration','rows','catch','find','create','update','body','params','findOne','ZohoField','getFields','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0xac86,0xfb));var _0x6ac8=function(_0x4f4020,_0x351b27){_0x4f4020=_0x4f4020-0x0;var _0x1a1df4=_0xac86[_0x4f4020];return _0x1a1df4;};'use strict';var emlformat=require(_0x6ac8('0x0'));var rimraf=require(_0x6ac8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6ac8('0x2'));var Mustache=require(_0x6ac8('0x3'));var util=require('util');var path=require(_0x6ac8('0x4'));var sox=require('sox');var csv=require(_0x6ac8('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6ac8('0x6'));var _=require(_0x6ac8('0x7'));var squel=require(_0x6ac8('0x8'));var crypto=require(_0x6ac8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x6ac8('0xa'));var toCsv=require(_0x6ac8('0x5'));var querystring=require(_0x6ac8('0xb'));var Papa=require(_0x6ac8('0xc'));var Redis=require(_0x6ac8('0xd'));var authService=require(_0x6ac8('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x6ac8('0xf'));var hardwareService=require(_0x6ac8('0x10'));var logger=require('../../config/logger')(_0x6ac8('0x11'));var utils=require(_0x6ac8('0x12'));var config=require(_0x6ac8('0x13'));var licenseUtil=require(_0x6ac8('0x14'));var db=require(_0x6ac8('0x15'))['db'];function respondWithStatusCode(_0x47156c,_0x1bd610){_0x1bd610=_0x1bd610||0xcc;return function(_0x58e698){if(_0x58e698){return _0x47156c[_0x6ac8('0x16')](_0x1bd610);}return _0x47156c['status'](_0x1bd610)[_0x6ac8('0x17')]();};}function respondWithResult(_0x235ee4,_0x285c85){_0x285c85=_0x285c85||0xc8;return function(_0x1f5377){if(_0x1f5377){return _0x235ee4[_0x6ac8('0x18')](_0x285c85)['json'](_0x1f5377);}};}function respondWithFilteredResult(_0x5a89a1,_0x46c327){return function(_0x35dc81){if(_0x35dc81){var _0x5e3c9c=typeof _0x46c327['offset']===_0x6ac8('0x19')&&typeof _0x46c327[_0x6ac8('0x1a')]===_0x6ac8('0x19');var _0x2d7ac9=_0x35dc81[_0x6ac8('0x1b')];var _0x50806d=_0x5e3c9c?0x0:_0x46c327[_0x6ac8('0x1c')];var _0x326efe=_0x5e3c9c?_0x35dc81[_0x6ac8('0x1b')]:_0x46c327[_0x6ac8('0x1c')]+_0x46c327['limit'];var _0x5f3024;if(_0x326efe>=_0x2d7ac9){_0x326efe=_0x2d7ac9;_0x5f3024=0xc8;}else{_0x5f3024=0xce;}_0x5a89a1[_0x6ac8('0x18')](_0x5f3024);return _0x5a89a1[_0x6ac8('0x1d')](_0x6ac8('0x1e'),_0x50806d+'-'+_0x326efe+'/'+_0x2d7ac9)[_0x6ac8('0x1f')](_0x35dc81);}return null;};}function patchUpdates(_0x12dbdf){return function(_0x57479c){try{jsonpatch[_0x6ac8('0x20')](_0x57479c,_0x12dbdf,!![]);}catch(_0x24d369){return BPromise['reject'](_0x24d369);}return _0x57479c[_0x6ac8('0x21')]();};}function saveUpdates(_0x886db0,_0x2c059e){return function(_0x511e2c){if(_0x511e2c){return _0x511e2c['update'](_0x886db0)[_0x6ac8('0x22')](function(_0x376a77){return _0x376a77;});}return null;};}function removeEntity(_0x33e969,_0x4d5384){return function(_0x558bd0){if(_0x558bd0){return _0x558bd0[_0x6ac8('0x23')]()[_0x6ac8('0x22')](function(){_0x33e969[_0x6ac8('0x18')](0xcc)[_0x6ac8('0x17')]();});}};}function handleEntityNotFound(_0x27aeae,_0x570b57){return function(_0x3866af){if(!_0x3866af){_0x27aeae['sendStatus'](0x194);}return _0x3866af;};}function handleError(_0x1a3151,_0x5ab5ce){_0x5ab5ce=_0x5ab5ce||0x1f4;return function(_0x35b16e){logger[_0x6ac8('0x24')](_0x35b16e[_0x6ac8('0x25')]);if(_0x35b16e[_0x6ac8('0x26')]){delete _0x35b16e['name'];}_0x1a3151[_0x6ac8('0x18')](_0x5ab5ce)[_0x6ac8('0x27')](_0x35b16e);};}exports['index']=function(_0x19c1a6,_0x32cfea){var _0x465968={},_0x4ecbe0={},_0x1d4967={'count':0x0,'rows':[]};var _0x154806=_[_0x6ac8('0x28')](db['ZohoConfiguration'][_0x6ac8('0x29')],function(_0x47c435){return{'name':_0x47c435[_0x6ac8('0x2a')],'type':_0x47c435[_0x6ac8('0x2b')][_0x6ac8('0x2c')]};});_0x4ecbe0[_0x6ac8('0x2d')]=_[_0x6ac8('0x28')](_0x154806,'name');_0x4ecbe0[_0x6ac8('0x2e')]=_[_0x6ac8('0x2f')](_0x19c1a6[_0x6ac8('0x2e')]);_0x4ecbe0[_0x6ac8('0x30')]=_[_0x6ac8('0x31')](_0x4ecbe0[_0x6ac8('0x2d')],_0x4ecbe0[_0x6ac8('0x2e')]);_0x465968['attributes']=_[_0x6ac8('0x31')](_0x4ecbe0[_0x6ac8('0x2d')],qs[_0x6ac8('0x32')](_0x19c1a6[_0x6ac8('0x2e')][_0x6ac8('0x32')]));_0x465968[_0x6ac8('0x33')]=_0x465968[_0x6ac8('0x33')][_0x6ac8('0x34')]?_0x465968[_0x6ac8('0x33')]:_0x4ecbe0['model'];if(!_0x19c1a6[_0x6ac8('0x2e')]['hasOwnProperty'](_0x6ac8('0x35'))){_0x465968[_0x6ac8('0x1a')]=qs['limit'](_0x19c1a6['query'][_0x6ac8('0x1a')]);_0x465968['offset']=qs[_0x6ac8('0x1c')](_0x19c1a6['query'][_0x6ac8('0x1c')]);}_0x465968[_0x6ac8('0x36')]=qs[_0x6ac8('0x37')](_0x19c1a6[_0x6ac8('0x2e')][_0x6ac8('0x37')]);_0x465968['where']=qs['filters'](_[_0x6ac8('0x38')](_0x19c1a6[_0x6ac8('0x2e')],_0x4ecbe0[_0x6ac8('0x30')]),_0x154806);if(_0x19c1a6['query'][_0x6ac8('0x39')]){_0x465968[_0x6ac8('0x3a')]=_[_0x6ac8('0x3b')](_0x465968[_0x6ac8('0x3a')],{'$or':_['map'](_0x154806,function(_0x39a99f){if(_0x39a99f[_0x6ac8('0x2b')]!==_0x6ac8('0x3c')){var _0x3e0937={};_0x3e0937[_0x39a99f[_0x6ac8('0x26')]]={'$like':'%'+_0x19c1a6[_0x6ac8('0x2e')][_0x6ac8('0x39')]+'%'};return _0x3e0937;}})});}_0x465968=_[_0x6ac8('0x3b')]({},_0x465968,_0x19c1a6[_0x6ac8('0x3d')]);var _0x2baa3b={'where':_0x465968[_0x6ac8('0x3a')]};return db['ZohoConfiguration']['count'](_0x2baa3b)[_0x6ac8('0x22')](function(_0x405c53){_0x1d4967['count']=_0x405c53;if(_0x19c1a6[_0x6ac8('0x2e')][_0x6ac8('0x3e')]){_0x465968[_0x6ac8('0x3f')]=[{'all':!![]}];}return db[_0x6ac8('0x40')]['findAll'](_0x465968);})[_0x6ac8('0x22')](function(_0xb320e8){_0x1d4967[_0x6ac8('0x41')]=_0xb320e8;return _0x1d4967;})[_0x6ac8('0x22')](respondWithFilteredResult(_0x32cfea,_0x465968))[_0x6ac8('0x42')](handleError(_0x32cfea,null));};exports['show']=function(_0x54fa4d,_0x1597e6){var _0x3eb37f={'raw':![],'where':{'id':_0x54fa4d['params']['id']}},_0x307237={};_0x307237[_0x6ac8('0x2d')]=_[_0x6ac8('0x2f')](db[_0x6ac8('0x40')][_0x6ac8('0x29')]);_0x307237[_0x6ac8('0x2e')]=_[_0x6ac8('0x2f')](_0x54fa4d[_0x6ac8('0x2e')]);_0x307237[_0x6ac8('0x30')]=_[_0x6ac8('0x31')](_0x307237[_0x6ac8('0x2d')],_0x307237[_0x6ac8('0x2e')]);_0x3eb37f['attributes']=_['intersection'](_0x307237[_0x6ac8('0x2d')],qs[_0x6ac8('0x32')](_0x54fa4d[_0x6ac8('0x2e')][_0x6ac8('0x32')]));_0x3eb37f[_0x6ac8('0x33')]=_0x3eb37f[_0x6ac8('0x33')][_0x6ac8('0x34')]?_0x3eb37f[_0x6ac8('0x33')]:_0x307237[_0x6ac8('0x2d')];if(_0x54fa4d['query'][_0x6ac8('0x3e')]){_0x3eb37f[_0x6ac8('0x3f')]=[{'all':!![]}];}_0x3eb37f=_[_0x6ac8('0x3b')]({},_0x3eb37f,_0x54fa4d['options']);return db[_0x6ac8('0x40')][_0x6ac8('0x43')](_0x3eb37f)[_0x6ac8('0x22')](handleEntityNotFound(_0x1597e6,null))['then'](respondWithResult(_0x1597e6,null))['catch'](handleError(_0x1597e6,null));};exports[_0x6ac8('0x44')]=function(_0x1964e9,_0x585275){return db[_0x6ac8('0x40')]['create'](_0x1964e9['body'],{})[_0x6ac8('0x22')](respondWithResult(_0x585275,0xc9))[_0x6ac8('0x42')](handleError(_0x585275,null));};exports[_0x6ac8('0x45')]=function(_0x15273a,_0x45b0f5){if(_0x15273a[_0x6ac8('0x46')]['id']){delete _0x15273a[_0x6ac8('0x46')]['id'];}return db[_0x6ac8('0x40')][_0x6ac8('0x43')]({'where':{'id':_0x15273a['params']['id']}})[_0x6ac8('0x22')](handleEntityNotFound(_0x45b0f5,null))[_0x6ac8('0x22')](saveUpdates(_0x15273a[_0x6ac8('0x46')],null))[_0x6ac8('0x22')](respondWithResult(_0x45b0f5,null))['catch'](handleError(_0x45b0f5,null));};exports['destroy']=function(_0x52ff1d,_0x330aae){return db[_0x6ac8('0x40')][_0x6ac8('0x43')]({'where':{'id':_0x52ff1d[_0x6ac8('0x47')]['id']}})[_0x6ac8('0x22')](handleEntityNotFound(_0x330aae,null))[_0x6ac8('0x22')](removeEntity(_0x330aae,null))[_0x6ac8('0x42')](handleError(_0x330aae,null));};exports['getFields']=function(_0x534675,_0x388bd8,_0x6c38c4){var _0x199671={};var _0x3f3b19={};var _0x4454a3;var _0x3bd5ff;return db['ZohoConfiguration'][_0x6ac8('0x48')]({'where':{'id':_0x534675[_0x6ac8('0x47')]['id']}})['then'](handleEntityNotFound(_0x388bd8,null))[_0x6ac8('0x22')](function(_0x282cff){if(_0x282cff){_0x4454a3=_0x282cff;_0x3f3b19[_0x6ac8('0x2d')]=_[_0x6ac8('0x2f')](db[_0x6ac8('0x49')][_0x6ac8('0x29')]);_0x3f3b19[_0x6ac8('0x2e')]=_[_0x6ac8('0x2f')](_0x534675[_0x6ac8('0x2e')]);_0x3f3b19[_0x6ac8('0x30')]=_[_0x6ac8('0x31')](_0x3f3b19[_0x6ac8('0x2d')],_0x3f3b19['query']);_0x199671[_0x6ac8('0x33')]=_[_0x6ac8('0x31')](_0x3f3b19[_0x6ac8('0x2d')],qs['fields'](_0x534675[_0x6ac8('0x2e')]['fields']));_0x199671[_0x6ac8('0x33')]=_0x199671[_0x6ac8('0x33')][_0x6ac8('0x34')]?_0x199671[_0x6ac8('0x33')]:_0x3f3b19[_0x6ac8('0x2d')];_0x199671[_0x6ac8('0x36')]=qs[_0x6ac8('0x37')](_0x534675[_0x6ac8('0x2e')][_0x6ac8('0x37')]);_0x199671[_0x6ac8('0x3a')]=qs['filters'](_[_0x6ac8('0x38')](_0x534675['query'],_0x3f3b19[_0x6ac8('0x30')]));if(_0x534675[_0x6ac8('0x2e')][_0x6ac8('0x39')]){_0x199671[_0x6ac8('0x3a')]=_['merge'](_0x199671[_0x6ac8('0x3a')],{'$or':_[_0x6ac8('0x28')](_0x199671['attributes'],function(_0x31e821){var _0xf13d7b={};_0xf13d7b[_0x31e821]={'$like':'%'+_0x534675['query'][_0x6ac8('0x39')]+'%'};return _0xf13d7b;})});}_0x199671=_[_0x6ac8('0x3b')]({},_0x199671,_0x534675['options']);return _0x4454a3[_0x6ac8('0x4a')](_0x199671);}})[_0x6ac8('0x22')](function(_0xcbf151){if(_0xcbf151){_0x3bd5ff=_0xcbf151[_0x6ac8('0x34')];if(!_0x534675[_0x6ac8('0x2e')]['hasOwnProperty'](_0x6ac8('0x35'))){_0x199671[_0x6ac8('0x1a')]=qs[_0x6ac8('0x1a')](_0x534675[_0x6ac8('0x2e')][_0x6ac8('0x1a')]);_0x199671[_0x6ac8('0x1c')]=qs[_0x6ac8('0x1c')](_0x534675[_0x6ac8('0x2e')][_0x6ac8('0x1c')]);}return _0x4454a3[_0x6ac8('0x4a')](_0x199671);}})['then'](function(_0x2be9a5){if(_0x2be9a5){return _0x2be9a5?{'count':_0x3bd5ff,'rows':_0x2be9a5}:null;}})['then'](respondWithResult(_0x388bd8,null))['catch'](handleError(_0x388bd8,null));};exports[_0x6ac8('0x4b')]=function(_0x31c1d9,_0x20c649,_0x5c4247){var _0x42c2ff={};var _0x33ac32={};var _0xde0e60;var _0x2c1a1f;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x31c1d9[_0x6ac8('0x47')]['id']}})[_0x6ac8('0x22')](handleEntityNotFound(_0x20c649,null))[_0x6ac8('0x22')](function(_0x292e55){if(_0x292e55){_0xde0e60=_0x292e55;_0x33ac32['model']=_[_0x6ac8('0x2f')](db['ZohoField'][_0x6ac8('0x29')]);_0x33ac32[_0x6ac8('0x2e')]=_[_0x6ac8('0x2f')](_0x31c1d9[_0x6ac8('0x2e')]);_0x33ac32[_0x6ac8('0x30')]=_[_0x6ac8('0x31')](_0x33ac32[_0x6ac8('0x2d')],_0x33ac32[_0x6ac8('0x2e')]);_0x42c2ff[_0x6ac8('0x33')]=_[_0x6ac8('0x31')](_0x33ac32['model'],qs['fields'](_0x31c1d9['query']['fields']));_0x42c2ff[_0x6ac8('0x33')]=_0x42c2ff[_0x6ac8('0x33')]['length']?_0x42c2ff[_0x6ac8('0x33')]:_0x33ac32[_0x6ac8('0x2d')];_0x42c2ff['order']=qs[_0x6ac8('0x37')](_0x31c1d9[_0x6ac8('0x2e')][_0x6ac8('0x37')]);_0x42c2ff[_0x6ac8('0x3a')]=qs['filters'](_[_0x6ac8('0x38')](_0x31c1d9['query'],_0x33ac32[_0x6ac8('0x30')]));if(_0x31c1d9[_0x6ac8('0x2e')][_0x6ac8('0x39')]){_0x42c2ff['where']=_[_0x6ac8('0x3b')](_0x42c2ff['where'],{'$or':_[_0x6ac8('0x28')](_0x42c2ff[_0x6ac8('0x33')],function(_0x329ace){var _0x46c632={};_0x46c632[_0x329ace]={'$like':'%'+_0x31c1d9[_0x6ac8('0x2e')]['filter']+'%'};return _0x46c632;})});}_0x42c2ff=_['merge']({},_0x42c2ff,_0x31c1d9[_0x6ac8('0x3d')]);return _0xde0e60['getSubjects'](_0x42c2ff);}})[_0x6ac8('0x22')](function(_0x3ad7e0){if(_0x3ad7e0){_0x2c1a1f=_0x3ad7e0[_0x6ac8('0x34')];if(!_0x31c1d9[_0x6ac8('0x2e')][_0x6ac8('0x4c')]('nolimit')){_0x42c2ff[_0x6ac8('0x1a')]=qs[_0x6ac8('0x1a')](_0x31c1d9['query'][_0x6ac8('0x1a')]);_0x42c2ff[_0x6ac8('0x1c')]=qs[_0x6ac8('0x1c')](_0x31c1d9[_0x6ac8('0x2e')][_0x6ac8('0x1c')]);}return _0xde0e60['getSubjects'](_0x42c2ff);}})[_0x6ac8('0x22')](function(_0x7c654f){if(_0x7c654f){return _0x7c654f?{'count':_0x2c1a1f,'rows':_0x7c654f}:null;}})[_0x6ac8('0x22')](respondWithResult(_0x20c649,null))[_0x6ac8('0x42')](handleError(_0x20c649,null));};exports[_0x6ac8('0x4d')]=function(_0x1c746b,_0x2fbea1,_0x4d8a22){var _0x5a2f54={};var _0x20c139={};var _0x2d4510;var _0x58c091;return db['ZohoConfiguration'][_0x6ac8('0x48')]({'where':{'id':_0x1c746b[_0x6ac8('0x47')]['id']}})[_0x6ac8('0x22')](handleEntityNotFound(_0x2fbea1,null))['then'](function(_0x5cbded){if(_0x5cbded){_0x2d4510=_0x5cbded;_0x20c139[_0x6ac8('0x2d')]=_[_0x6ac8('0x2f')](db[_0x6ac8('0x49')][_0x6ac8('0x29')]);_0x20c139['query']=_[_0x6ac8('0x2f')](_0x1c746b[_0x6ac8('0x2e')]);_0x20c139[_0x6ac8('0x30')]=_[_0x6ac8('0x31')](_0x20c139[_0x6ac8('0x2d')],_0x20c139[_0x6ac8('0x2e')]);_0x5a2f54[_0x6ac8('0x33')]=_[_0x6ac8('0x31')](_0x20c139['model'],qs[_0x6ac8('0x32')](_0x1c746b[_0x6ac8('0x2e')][_0x6ac8('0x32')]));_0x5a2f54[_0x6ac8('0x33')]=_0x5a2f54[_0x6ac8('0x33')][_0x6ac8('0x34')]?_0x5a2f54[_0x6ac8('0x33')]:_0x20c139[_0x6ac8('0x2d')];_0x5a2f54[_0x6ac8('0x36')]=qs['sort'](_0x1c746b[_0x6ac8('0x2e')]['sort']);_0x5a2f54[_0x6ac8('0x3a')]=qs[_0x6ac8('0x30')](_['pick'](_0x1c746b[_0x6ac8('0x2e')],_0x20c139['filters']));if(_0x1c746b['query']['filter']){_0x5a2f54['where']=_[_0x6ac8('0x3b')](_0x5a2f54[_0x6ac8('0x3a')],{'$or':_[_0x6ac8('0x28')](_0x5a2f54[_0x6ac8('0x33')],function(_0x3906e2){var _0x19455b={};_0x19455b[_0x3906e2]={'$like':'%'+_0x1c746b[_0x6ac8('0x2e')][_0x6ac8('0x39')]+'%'};return _0x19455b;})});}_0x5a2f54=_[_0x6ac8('0x3b')]({},_0x5a2f54,_0x1c746b[_0x6ac8('0x3d')]);return _0x2d4510[_0x6ac8('0x4d')](_0x5a2f54);}})[_0x6ac8('0x22')](function(_0x3c72e3){if(_0x3c72e3){_0x58c091=_0x3c72e3[_0x6ac8('0x34')];if(!_0x1c746b['query'][_0x6ac8('0x4c')](_0x6ac8('0x35'))){_0x5a2f54[_0x6ac8('0x1a')]=qs[_0x6ac8('0x1a')](_0x1c746b[_0x6ac8('0x2e')][_0x6ac8('0x1a')]);_0x5a2f54[_0x6ac8('0x1c')]=qs[_0x6ac8('0x1c')](_0x1c746b['query']['offset']);}return _0x2d4510[_0x6ac8('0x4d')](_0x5a2f54);}})['then'](function(_0x5bdd4a){if(_0x5bdd4a){return _0x5bdd4a?{'count':_0x58c091,'rows':_0x5bdd4a}:null;}})[_0x6ac8('0x22')](respondWithResult(_0x2fbea1,null))['catch'](handleError(_0x2fbea1,null));}; \ No newline at end of file +var _0x9564=['lodash','squel','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','set','Content-Range','apply','save','update','destroy','then','error','stack','name','index','map','ZohoConfiguration','fieldName','type','model','query','keys','filters','fields','attributes','length','nolimit','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','intersection','catch','create','body','find','ZohoField','order','pick','hasOwnProperty','findOne','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra'];(function(_0x2bc1fe,_0x45da98){var _0x1a47a5=function(_0x2e5053){while(--_0x2e5053){_0x2bc1fe['push'](_0x2bc1fe['shift']());}};_0x1a47a5(++_0x45da98);}(_0x9564,0x98));var _0x4956=function(_0x1fc18b,_0x13d27d){_0x1fc18b=_0x1fc18b-0x0;var _0x16a351=_0x9564[_0x1fc18b];return _0x16a351;};'use strict';var emlformat=require(_0x4956('0x0'));var rimraf=require(_0x4956('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4956('0x2'));var rp=require('request-promise');var moment=require(_0x4956('0x3'));var BPromise=require(_0x4956('0x4'));var Mustache=require('mustache');var util=require(_0x4956('0x5'));var path=require(_0x4956('0x6'));var sox=require(_0x4956('0x7'));var csv=require('to-csv');var ejs=require(_0x4956('0x8'));var fs=require('fs');var fs_extra=require(_0x4956('0x9'));var _=require(_0x4956('0xa'));var squel=require(_0x4956('0xb'));var crypto=require('crypto');var jsforce=require(_0x4956('0xc'));var deskjs=require(_0x4956('0xd'));var toCsv=require(_0x4956('0xe'));var querystring=require(_0x4956('0xf'));var Papa=require(_0x4956('0x10'));var Redis=require(_0x4956('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4956('0x12'));var as=require(_0x4956('0x13'));var hardwareService=require(_0x4956('0x14'));var logger=require(_0x4956('0x15'))(_0x4956('0x16'));var utils=require(_0x4956('0x17'));var config=require(_0x4956('0x18'));var licenseUtil=require(_0x4956('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51a7fb,_0x340031){_0x340031=_0x340031||0xcc;return function(_0x1273c8){if(_0x1273c8){return _0x51a7fb[_0x4956('0x1a')](_0x340031);}return _0x51a7fb[_0x4956('0x1b')](_0x340031)[_0x4956('0x1c')]();};}function respondWithResult(_0x1fc7bc,_0x59f065){_0x59f065=_0x59f065||0xc8;return function(_0x5d7873){if(_0x5d7873){return _0x1fc7bc['status'](_0x59f065)[_0x4956('0x1d')](_0x5d7873);}};}function respondWithFilteredResult(_0x4813a1,_0x3c7bfe){return function(_0x593a75){if(_0x593a75){var _0x5c2ad8=typeof _0x3c7bfe[_0x4956('0x1e')]===_0x4956('0x1f')&&typeof _0x3c7bfe[_0x4956('0x20')]===_0x4956('0x1f');var _0x13fea6=_0x593a75['count'];var _0x45d536=_0x5c2ad8?0x0:_0x3c7bfe[_0x4956('0x1e')];var _0x40b129=_0x5c2ad8?_0x593a75[_0x4956('0x21')]:_0x3c7bfe['offset']+_0x3c7bfe[_0x4956('0x20')];var _0x175e2b;if(_0x40b129>=_0x13fea6){_0x40b129=_0x13fea6;_0x175e2b=0xc8;}else{_0x175e2b=0xce;}_0x4813a1['status'](_0x175e2b);return _0x4813a1[_0x4956('0x22')](_0x4956('0x23'),_0x45d536+'-'+_0x40b129+'/'+_0x13fea6)[_0x4956('0x1d')](_0x593a75);}return null;};}function patchUpdates(_0xa42b6d){return function(_0x9596f9){try{jsonpatch[_0x4956('0x24')](_0x9596f9,_0xa42b6d,!![]);}catch(_0x1b19fa){return BPromise['reject'](_0x1b19fa);}return _0x9596f9[_0x4956('0x25')]();};}function saveUpdates(_0x1f73f7,_0x55782c){return function(_0x55e2c4){if(_0x55e2c4){return _0x55e2c4[_0x4956('0x26')](_0x1f73f7)['then'](function(_0x183d25){return _0x183d25;});}return null;};}function removeEntity(_0x4f5e47,_0x4c787d){return function(_0x5c48e9){if(_0x5c48e9){return _0x5c48e9[_0x4956('0x27')]()[_0x4956('0x28')](function(){_0x4f5e47['status'](0xcc)[_0x4956('0x1c')]();});}};}function handleEntityNotFound(_0x523d1b,_0x162a32){return function(_0x225ab8){if(!_0x225ab8){_0x523d1b[_0x4956('0x1a')](0x194);}return _0x225ab8;};}function handleError(_0x597fbb,_0x4f1163){_0x4f1163=_0x4f1163||0x1f4;return function(_0x115a4a){logger[_0x4956('0x29')](_0x115a4a[_0x4956('0x2a')]);if(_0x115a4a[_0x4956('0x2b')]){delete _0x115a4a['name'];}_0x597fbb['status'](_0x4f1163)['send'](_0x115a4a);};}exports[_0x4956('0x2c')]=function(_0x4bbf4c,_0x25a2b4){var _0x1ed506={},_0x3f1217={},_0x1bbee7={'count':0x0,'rows':[]};var _0x4c21f7=_[_0x4956('0x2d')](db[_0x4956('0x2e')]['rawAttributes'],function(_0x1ed388){return{'name':_0x1ed388[_0x4956('0x2f')],'type':_0x1ed388[_0x4956('0x30')]['key']};});_0x3f1217[_0x4956('0x31')]=_[_0x4956('0x2d')](_0x4c21f7,_0x4956('0x2b'));_0x3f1217[_0x4956('0x32')]=_[_0x4956('0x33')](_0x4bbf4c[_0x4956('0x32')]);_0x3f1217[_0x4956('0x34')]=_['intersection'](_0x3f1217[_0x4956('0x31')],_0x3f1217['query']);_0x1ed506['attributes']=_['intersection'](_0x3f1217[_0x4956('0x31')],qs[_0x4956('0x35')](_0x4bbf4c[_0x4956('0x32')]['fields']));_0x1ed506['attributes']=_0x1ed506[_0x4956('0x36')][_0x4956('0x37')]?_0x1ed506[_0x4956('0x36')]:_0x3f1217[_0x4956('0x31')];if(!_0x4bbf4c['query']['hasOwnProperty'](_0x4956('0x38'))){_0x1ed506[_0x4956('0x20')]=qs[_0x4956('0x20')](_0x4bbf4c[_0x4956('0x32')][_0x4956('0x20')]);_0x1ed506[_0x4956('0x1e')]=qs[_0x4956('0x1e')](_0x4bbf4c['query'][_0x4956('0x1e')]);}_0x1ed506['order']=qs['sort'](_0x4bbf4c[_0x4956('0x32')][_0x4956('0x39')]);_0x1ed506[_0x4956('0x3a')]=qs[_0x4956('0x34')](_['pick'](_0x4bbf4c[_0x4956('0x32')],_0x3f1217['filters']),_0x4c21f7);if(_0x4bbf4c[_0x4956('0x32')][_0x4956('0x3b')]){_0x1ed506['where']=_[_0x4956('0x3c')](_0x1ed506[_0x4956('0x3a')],{'$or':_['map'](_0x4c21f7,function(_0x49dff2){if(_0x49dff2[_0x4956('0x30')]!==_0x4956('0x3d')){var _0x44a8a7={};_0x44a8a7[_0x49dff2['name']]={'$like':'%'+_0x4bbf4c['query']['filter']+'%'};return _0x44a8a7;}})});}_0x1ed506=_[_0x4956('0x3c')]({},_0x1ed506,_0x4bbf4c[_0x4956('0x3e')]);var _0x18abdf={'where':_0x1ed506[_0x4956('0x3a')]};return db['ZohoConfiguration']['count'](_0x18abdf)[_0x4956('0x28')](function(_0x3abeda){_0x1bbee7['count']=_0x3abeda;if(_0x4bbf4c['query']['includeAll']){_0x1ed506[_0x4956('0x3f')]=[{'all':!![]}];}return db[_0x4956('0x2e')][_0x4956('0x40')](_0x1ed506);})[_0x4956('0x28')](function(_0x29c743){_0x1bbee7[_0x4956('0x41')]=_0x29c743;return _0x1bbee7;})['then'](respondWithFilteredResult(_0x25a2b4,_0x1ed506))['catch'](handleError(_0x25a2b4,null));};exports[_0x4956('0x42')]=function(_0x1f1023,_0x5e06cc){var _0x3543a8={'raw':![],'where':{'id':_0x1f1023[_0x4956('0x43')]['id']}},_0x3963c8={};_0x3963c8[_0x4956('0x31')]=_['keys'](db['ZohoConfiguration'][_0x4956('0x44')]);_0x3963c8[_0x4956('0x32')]=_[_0x4956('0x33')](_0x1f1023[_0x4956('0x32')]);_0x3963c8[_0x4956('0x34')]=_[_0x4956('0x45')](_0x3963c8['model'],_0x3963c8[_0x4956('0x32')]);_0x3543a8['attributes']=_[_0x4956('0x45')](_0x3963c8[_0x4956('0x31')],qs[_0x4956('0x35')](_0x1f1023['query'][_0x4956('0x35')]));_0x3543a8['attributes']=_0x3543a8[_0x4956('0x36')][_0x4956('0x37')]?_0x3543a8[_0x4956('0x36')]:_0x3963c8[_0x4956('0x31')];if(_0x1f1023[_0x4956('0x32')]['includeAll']){_0x3543a8['include']=[{'all':!![]}];}_0x3543a8=_[_0x4956('0x3c')]({},_0x3543a8,_0x1f1023[_0x4956('0x3e')]);return db[_0x4956('0x2e')]['find'](_0x3543a8)['then'](handleEntityNotFound(_0x5e06cc,null))[_0x4956('0x28')](respondWithResult(_0x5e06cc,null))[_0x4956('0x46')](handleError(_0x5e06cc,null));};exports['create']=function(_0x28b7e9,_0x606f6c){return db[_0x4956('0x2e')][_0x4956('0x47')](_0x28b7e9[_0x4956('0x48')],{})[_0x4956('0x28')](respondWithResult(_0x606f6c,0xc9))[_0x4956('0x46')](handleError(_0x606f6c,null));};exports['update']=function(_0x40b396,_0x27f62d){if(_0x40b396[_0x4956('0x48')]['id']){delete _0x40b396['body']['id'];}return db[_0x4956('0x2e')][_0x4956('0x49')]({'where':{'id':_0x40b396[_0x4956('0x43')]['id']}})[_0x4956('0x28')](handleEntityNotFound(_0x27f62d,null))[_0x4956('0x28')](saveUpdates(_0x40b396[_0x4956('0x48')],null))[_0x4956('0x28')](respondWithResult(_0x27f62d,null))['catch'](handleError(_0x27f62d,null));};exports[_0x4956('0x27')]=function(_0x4dc719,_0x2ecb72){return db[_0x4956('0x2e')][_0x4956('0x49')]({'where':{'id':_0x4dc719[_0x4956('0x43')]['id']}})[_0x4956('0x28')](handleEntityNotFound(_0x2ecb72,null))[_0x4956('0x28')](removeEntity(_0x2ecb72,null))[_0x4956('0x46')](handleError(_0x2ecb72,null));};exports['getFields']=function(_0x1f9187,_0x1ee4bc,_0x359c21){var _0x23ddf2={};var _0xdada57={};var _0x22e6c1;var _0x218702;return db[_0x4956('0x2e')]['findOne']({'where':{'id':_0x1f9187[_0x4956('0x43')]['id']}})['then'](handleEntityNotFound(_0x1ee4bc,null))['then'](function(_0xade9e){if(_0xade9e){_0x22e6c1=_0xade9e;_0xdada57['model']=_[_0x4956('0x33')](db[_0x4956('0x4a')]['rawAttributes']);_0xdada57[_0x4956('0x32')]=_['keys'](_0x1f9187['query']);_0xdada57['filters']=_[_0x4956('0x45')](_0xdada57['model'],_0xdada57[_0x4956('0x32')]);_0x23ddf2[_0x4956('0x36')]=_[_0x4956('0x45')](_0xdada57[_0x4956('0x31')],qs[_0x4956('0x35')](_0x1f9187[_0x4956('0x32')]['fields']));_0x23ddf2[_0x4956('0x36')]=_0x23ddf2[_0x4956('0x36')]['length']?_0x23ddf2[_0x4956('0x36')]:_0xdada57[_0x4956('0x31')];_0x23ddf2[_0x4956('0x4b')]=qs[_0x4956('0x39')](_0x1f9187['query']['sort']);_0x23ddf2[_0x4956('0x3a')]=qs[_0x4956('0x34')](_[_0x4956('0x4c')](_0x1f9187[_0x4956('0x32')],_0xdada57['filters']));if(_0x1f9187[_0x4956('0x32')][_0x4956('0x3b')]){_0x23ddf2[_0x4956('0x3a')]=_['merge'](_0x23ddf2[_0x4956('0x3a')],{'$or':_[_0x4956('0x2d')](_0x23ddf2['attributes'],function(_0x4198eb){var _0x2ea9c6={};_0x2ea9c6[_0x4198eb]={'$like':'%'+_0x1f9187[_0x4956('0x32')]['filter']+'%'};return _0x2ea9c6;})});}_0x23ddf2=_[_0x4956('0x3c')]({},_0x23ddf2,_0x1f9187['options']);return _0x22e6c1['getFields'](_0x23ddf2);}})[_0x4956('0x28')](function(_0x3a3b45){if(_0x3a3b45){_0x218702=_0x3a3b45['length'];if(!_0x1f9187[_0x4956('0x32')][_0x4956('0x4d')](_0x4956('0x38'))){_0x23ddf2[_0x4956('0x20')]=qs[_0x4956('0x20')](_0x1f9187['query'][_0x4956('0x20')]);_0x23ddf2['offset']=qs['offset'](_0x1f9187['query'][_0x4956('0x1e')]);}return _0x22e6c1['getFields'](_0x23ddf2);}})[_0x4956('0x28')](function(_0x34656b){if(_0x34656b){return _0x34656b?{'count':_0x218702,'rows':_0x34656b}:null;}})[_0x4956('0x28')](respondWithResult(_0x1ee4bc,null))['catch'](handleError(_0x1ee4bc,null));};exports['getSubjects']=function(_0x301491,_0x4860e2,_0x31aa47){var _0x408322={};var _0x2bbfc9={};var _0x196891;var _0x1b4510;return db['ZohoConfiguration'][_0x4956('0x4e')]({'where':{'id':_0x301491[_0x4956('0x43')]['id']}})[_0x4956('0x28')](handleEntityNotFound(_0x4860e2,null))['then'](function(_0x104ee5){if(_0x104ee5){_0x196891=_0x104ee5;_0x2bbfc9[_0x4956('0x31')]=_[_0x4956('0x33')](db[_0x4956('0x4a')]['rawAttributes']);_0x2bbfc9[_0x4956('0x32')]=_['keys'](_0x301491[_0x4956('0x32')]);_0x2bbfc9['filters']=_[_0x4956('0x45')](_0x2bbfc9[_0x4956('0x31')],_0x2bbfc9[_0x4956('0x32')]);_0x408322[_0x4956('0x36')]=_[_0x4956('0x45')](_0x2bbfc9['model'],qs[_0x4956('0x35')](_0x301491[_0x4956('0x32')][_0x4956('0x35')]));_0x408322['attributes']=_0x408322['attributes'][_0x4956('0x37')]?_0x408322[_0x4956('0x36')]:_0x2bbfc9[_0x4956('0x31')];_0x408322[_0x4956('0x4b')]=qs[_0x4956('0x39')](_0x301491[_0x4956('0x32')]['sort']);_0x408322['where']=qs[_0x4956('0x34')](_[_0x4956('0x4c')](_0x301491[_0x4956('0x32')],_0x2bbfc9[_0x4956('0x34')]));if(_0x301491[_0x4956('0x32')]['filter']){_0x408322['where']=_[_0x4956('0x3c')](_0x408322[_0x4956('0x3a')],{'$or':_[_0x4956('0x2d')](_0x408322[_0x4956('0x36')],function(_0x4f5a75){var _0x29e5f0={};_0x29e5f0[_0x4f5a75]={'$like':'%'+_0x301491['query'][_0x4956('0x3b')]+'%'};return _0x29e5f0;})});}_0x408322=_[_0x4956('0x3c')]({},_0x408322,_0x301491[_0x4956('0x3e')]);return _0x196891['getSubjects'](_0x408322);}})['then'](function(_0x144644){if(_0x144644){_0x1b4510=_0x144644['length'];if(!_0x301491[_0x4956('0x32')][_0x4956('0x4d')](_0x4956('0x38'))){_0x408322['limit']=qs['limit'](_0x301491[_0x4956('0x32')][_0x4956('0x20')]);_0x408322[_0x4956('0x1e')]=qs['offset'](_0x301491[_0x4956('0x32')]['offset']);}return _0x196891[_0x4956('0x4f')](_0x408322);}})[_0x4956('0x28')](function(_0x4160e8){if(_0x4160e8){return _0x4160e8?{'count':_0x1b4510,'rows':_0x4160e8}:null;}})['then'](respondWithResult(_0x4860e2,null))['catch'](handleError(_0x4860e2,null));};exports[_0x4956('0x50')]=function(_0x2f4166,_0x236857,_0x2679ac){var _0x51f9d3={};var _0xbefe97={};var _0x264efc;var _0x1b5c86;return db['ZohoConfiguration'][_0x4956('0x4e')]({'where':{'id':_0x2f4166[_0x4956('0x43')]['id']}})['then'](handleEntityNotFound(_0x236857,null))[_0x4956('0x28')](function(_0x2f31fa){if(_0x2f31fa){_0x264efc=_0x2f31fa;_0xbefe97['model']=_[_0x4956('0x33')](db[_0x4956('0x4a')][_0x4956('0x44')]);_0xbefe97[_0x4956('0x32')]=_['keys'](_0x2f4166[_0x4956('0x32')]);_0xbefe97[_0x4956('0x34')]=_[_0x4956('0x45')](_0xbefe97[_0x4956('0x31')],_0xbefe97['query']);_0x51f9d3[_0x4956('0x36')]=_['intersection'](_0xbefe97[_0x4956('0x31')],qs[_0x4956('0x35')](_0x2f4166['query'][_0x4956('0x35')]));_0x51f9d3[_0x4956('0x36')]=_0x51f9d3[_0x4956('0x36')][_0x4956('0x37')]?_0x51f9d3[_0x4956('0x36')]:_0xbefe97['model'];_0x51f9d3[_0x4956('0x4b')]=qs['sort'](_0x2f4166[_0x4956('0x32')][_0x4956('0x39')]);_0x51f9d3[_0x4956('0x3a')]=qs[_0x4956('0x34')](_[_0x4956('0x4c')](_0x2f4166[_0x4956('0x32')],_0xbefe97[_0x4956('0x34')]));if(_0x2f4166[_0x4956('0x32')][_0x4956('0x3b')]){_0x51f9d3[_0x4956('0x3a')]=_[_0x4956('0x3c')](_0x51f9d3[_0x4956('0x3a')],{'$or':_[_0x4956('0x2d')](_0x51f9d3[_0x4956('0x36')],function(_0x2a92c9){var _0x2650b9={};_0x2650b9[_0x2a92c9]={'$like':'%'+_0x2f4166['query']['filter']+'%'};return _0x2650b9;})});}_0x51f9d3=_['merge']({},_0x51f9d3,_0x2f4166['options']);return _0x264efc[_0x4956('0x50')](_0x51f9d3);}})[_0x4956('0x28')](function(_0x2e7d9a){if(_0x2e7d9a){_0x1b5c86=_0x2e7d9a['length'];if(!_0x2f4166[_0x4956('0x32')][_0x4956('0x4d')](_0x4956('0x38'))){_0x51f9d3['limit']=qs[_0x4956('0x20')](_0x2f4166[_0x4956('0x32')][_0x4956('0x20')]);_0x51f9d3['offset']=qs[_0x4956('0x1e')](_0x2f4166[_0x4956('0x32')][_0x4956('0x1e')]);}return _0x264efc[_0x4956('0x50')](_0x51f9d3);}})[_0x4956('0x28')](function(_0x15e3a0){if(_0x15e3a0){return _0x15e3a0?{'count':_0x1b5c86,'rows':_0x15e3a0}:null;}})['then'](respondWithResult(_0x236857,null))[_0x4956('0x46')](handleError(_0x236857,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 4f0ab97..a7500b4 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 _0xc218=['exports','define','ZohoConfiguration','int_zoho_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoConfiguration.attributes'];(function(_0x982859,_0x14be5d){var _0x27adac=function(_0x2cda54){while(--_0x2cda54){_0x982859['push'](_0x982859['shift']());}};_0x27adac(++_0x14be5d);}(_0xc218,0x115));var _0x8c21=function(_0x261787,_0x287f59){_0x261787=_0x261787-0x0;var _0x5a6332=_0xc218[_0x261787];return _0x5a6332;};'use strict';var _=require(_0x8c21('0x0'));var util=require('util');var logger=require(_0x8c21('0x1'))(_0x8c21('0x2'));var moment=require(_0x8c21('0x3'));var BPromise=require(_0x8c21('0x4'));var rp=require(_0x8c21('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8c21('0x6'));var config=require(_0x8c21('0x7'));var attributes=require(_0x8c21('0x8'));module[_0x8c21('0x9')]=function(_0x34781f,_0x130354){return _0x34781f[_0x8c21('0xa')](_0x8c21('0xb'),attributes,{'tableName':_0x8c21('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d14=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations'];(function(_0x3e46b3,_0x29d756){var _0x5eb45f=function(_0x1337dc){while(--_0x1337dc){_0x3e46b3['push'](_0x3e46b3['shift']());}};_0x5eb45f(++_0x29d756);}(_0x9d14,0x188));var _0x49d1=function(_0x50c7b9,_0x1857aa){_0x50c7b9=_0x50c7b9-0x0;var _0x2a5324=_0x9d14[_0x50c7b9];return _0x2a5324;};'use strict';var _=require(_0x49d1('0x0'));var util=require(_0x49d1('0x1'));var logger=require(_0x49d1('0x2'))(_0x49d1('0x3'));var moment=require(_0x49d1('0x4'));var BPromise=require(_0x49d1('0x5'));var rp=require(_0x49d1('0x6'));var fs=require('fs');var path=require(_0x49d1('0x7'));var rimraf=require('rimraf');var config=require(_0x49d1('0x8'));var attributes=require(_0x49d1('0x9'));module[_0x49d1('0xa')]=function(_0x5f35e1,_0x27f313){return _0x5f35e1[_0x49d1('0xb')](_0x49d1('0xc'),attributes,{'tableName':_0x49d1('0xd'),'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 8245372..6c00501 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 _0x6c23=['stringify','error','code','message','result','catch','lodash','randomstring','ioredis','../../config/environment','jayson/promise','client','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x4bf96c,_0x4d24fd){var _0x281d09=function(_0x56538e){while(--_0x56538e){_0x4bf96c['push'](_0x4bf96c['shift']());}};_0x281d09(++_0x4d24fd);}(_0x6c23,0x176));var _0x36c2=function(_0x422b3d,_0x3a2651){_0x422b3d=_0x422b3d-0x0;var _0x24decf=_0x6c23[_0x422b3d];return _0x24decf;};'use strict';var _=require(_0x36c2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x36c2('0x1'));var fs=require('fs');var Redis=require(_0x36c2('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x36c2('0x3'));var jayson=require(_0x36c2('0x4'));var client=jayson[_0x36c2('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11c2c5,_0x2183a3,_0x386ef5){return new BPromise(function(_0x443e83,_0x1ec493){return client['request'](_0x11c2c5,_0x386ef5)[_0x36c2('0x6')](function(_0x1b48f1){logger[_0x36c2('0x7')](_0x36c2('0x8'),_0x2183a3,_0x36c2('0x9'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x2183a3,_0x36c2('0x9'),JSON[_0x36c2('0xa')](_0x1b48f1));if(_0x1b48f1[_0x36c2('0xb')]){if(_0x1b48f1[_0x36c2('0xb')][_0x36c2('0xc')]===0x1f4){logger[_0x36c2('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x2183a3,_0x1b48f1[_0x36c2('0xb')][_0x36c2('0xd')]);return _0x1ec493(_0x1b48f1[_0x36c2('0xb')][_0x36c2('0xd')]);}logger['error'](_0x36c2('0x8'),_0x2183a3,_0x1b48f1[_0x36c2('0xb')][_0x36c2('0xd')]);return _0x443e83(_0x1b48f1[_0x36c2('0xb')][_0x36c2('0xd')]);}else{logger[_0x36c2('0x7')](_0x36c2('0x8'),_0x2183a3,_0x36c2('0x9'));_0x443e83(_0x1b48f1[_0x36c2('0xe')][_0x36c2('0xd')]);}})[_0x36c2('0xf')](function(_0x267657){logger['error'](_0x36c2('0x8'),_0x2183a3,_0x267657);_0x1ec493(_0x267657);});});} \ No newline at end of file +var _0xf135=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xf135,0x192));var _0x5f13=function(_0x5ea871,_0x45350f){_0x5ea871=_0x5ea871-0x0;var _0x58e215=_0xf135[_0x5ea871];return _0x58e215;};'use strict';var _=require('lodash');var util=require(_0x5f13('0x0'));var moment=require(_0x5f13('0x1'));var BPromise=require(_0x5f13('0x2'));var rs=require(_0x5f13('0x3'));var fs=require('fs');var Redis=require(_0x5f13('0x4'));var db=require(_0x5f13('0x5'))['db'];var utils=require(_0x5f13('0x6'));var logger=require(_0x5f13('0x7'))(_0x5f13('0x8'));var config=require(_0x5f13('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5f13('0xa')][_0x5f13('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2076ac,_0x539b5d,_0x491708){return new BPromise(function(_0x1e822f,_0x4ae6ce){return client[_0x5f13('0xc')](_0x2076ac,_0x491708)[_0x5f13('0xd')](function(_0x136af9){logger['info'](_0x5f13('0xe'),_0x539b5d,'request\x20sent');logger[_0x5f13('0xf')](_0x5f13('0x10'),_0x539b5d,_0x5f13('0x11'),JSON[_0x5f13('0x12')](_0x136af9));if(_0x136af9[_0x5f13('0x13')]){if(_0x136af9[_0x5f13('0x13')][_0x5f13('0x14')]===0x1f4){logger[_0x5f13('0x13')](_0x5f13('0xe'),_0x539b5d,_0x136af9[_0x5f13('0x13')]['message']);return _0x4ae6ce(_0x136af9[_0x5f13('0x13')][_0x5f13('0x15')]);}logger[_0x5f13('0x13')](_0x5f13('0xe'),_0x539b5d,_0x136af9['error'][_0x5f13('0x15')]);return _0x1e822f(_0x136af9[_0x5f13('0x13')][_0x5f13('0x15')]);}else{logger[_0x5f13('0x16')](_0x5f13('0xe'),_0x539b5d,_0x5f13('0x11'));_0x1e822f(_0x136af9[_0x5f13('0x17')][_0x5f13('0x15')]);}})[_0x5f13('0x18')](function(_0x3ff9c8){logger[_0x5f13('0x13')](_0x5f13('0xe'),_0x539b5d,_0x3ff9c8);_0x4ae6ce(_0x3ff9c8);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 036c4d7..7d5ed67 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 _0x0143=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x5084ff,_0x542fb2){var _0x3a66b8=function(_0x182d0b){while(--_0x182d0b){_0x5084ff['push'](_0x5084ff['shift']());}};_0x3a66b8(++_0x542fb2);}(_0x0143,0xc2));var _0x3014=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x0143[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x3014('0x0'));var util=require(_0x3014('0x1'));var path=require('path');var timeout=require(_0x3014('0x2'));var express=require(_0x3014('0x3'));var router=express[_0x3014('0x4')]();var fs_extra=require(_0x3014('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3014('0x6'));var config=require(_0x3014('0x7'));var controller=require(_0x3014('0x8'));router[_0x3014('0x9')]('/',auth[_0x3014('0xa')](),controller[_0x3014('0xb')]);router['get'](_0x3014('0xc'),auth[_0x3014('0xa')](),controller[_0x3014('0xd')]);router[_0x3014('0xe')]('/',auth[_0x3014('0xa')](),controller['create']);router['put'](_0x3014('0xc'),auth[_0x3014('0xa')](),controller[_0x3014('0xf')]);router[_0x3014('0x10')]('/:id',auth[_0x3014('0xa')](),controller[_0x3014('0x11')]);module[_0x3014('0x12')]=router; \ No newline at end of file +var _0xc8ee=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x31dde9,_0x12e816){var _0x1fbf2d=function(_0x1d1bf6){while(--_0x1d1bf6){_0x31dde9['push'](_0x31dde9['shift']());}};_0x1fbf2d(++_0x12e816);}(_0xc8ee,0x160));var _0xec8e=function(_0x48f1e2,_0x21ef93){_0x48f1e2=_0x48f1e2-0x0;var _0x2724ff=_0xc8ee[_0x48f1e2];return _0x2724ff;};'use strict';var multer=require(_0xec8e('0x0'));var util=require(_0xec8e('0x1'));var path=require(_0xec8e('0x2'));var timeout=require('connect-timeout');var express=require(_0xec8e('0x3'));var router=express[_0xec8e('0x4')]();var fs_extra=require(_0xec8e('0x5'));var auth=require(_0xec8e('0x6'));var interaction=require(_0xec8e('0x7'));var config=require('../../config/environment');var controller=require('./intZohoField.controller');router[_0xec8e('0x8')]('/',auth[_0xec8e('0x9')](),controller[_0xec8e('0xa')]);router[_0xec8e('0x8')](_0xec8e('0xb'),auth[_0xec8e('0x9')](),controller[_0xec8e('0xc')]);router[_0xec8e('0xd')]('/',auth['isAuthenticated'](),controller[_0xec8e('0xe')]);router[_0xec8e('0xf')](_0xec8e('0xb'),auth['isAuthenticated'](),controller[_0xec8e('0x10')]);router[_0xec8e('0x11')](_0xec8e('0xb'),auth[_0xec8e('0x9')](),controller[_0xec8e('0x12')]);module[_0xec8e('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 9556c95..9213ffc 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 _0xd13e=['string','customVariable','picklist','STRING','ENUM','variable','sequelize','exports'];(function(_0x1e7345,_0x18bcce){var _0x33017c=function(_0x2b274f){while(--_0x2b274f){_0x1e7345['push'](_0x1e7345['shift']());}};_0x33017c(++_0x18bcce);}(_0xd13e,0x126));var _0xed13=function(_0x4e0b8c,_0x346cdb){_0x4e0b8c=_0x4e0b8c-0x0;var _0x689fda=_0xd13e[_0x4e0b8c];return _0x689fda;};'use strict';var Sequelize=require(_0xed13('0x0'));module[_0xed13('0x1')]={'type':{'type':Sequelize['ENUM'](_0xed13('0x2'),'variable',_0xed13('0x3'),'keyValue',_0xed13('0x4')),'defaultValue':_0xed13('0x2')},'content':{'type':Sequelize[_0xed13('0x5')]},'key':{'type':Sequelize[_0xed13('0x5')]},'keyType':{'type':Sequelize[_0xed13('0x6')](_0xed13('0x2'),_0xed13('0x7'),_0xed13('0x3'))},'keyContent':{'type':Sequelize[_0xed13('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xed13('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdf16=['keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable'];(function(_0x5c7aa8,_0xa36f10){var _0x5318ed=function(_0x5d8924){while(--_0x5d8924){_0x5c7aa8['push'](_0x5c7aa8['shift']());}};_0x5318ed(++_0xa36f10);}(_0xdf16,0x1d8));var _0x6df1=function(_0x19324e,_0x35cc43){_0x19324e=_0x19324e-0x0;var _0xcfde4c=_0xdf16[_0x19324e];return _0xcfde4c;};'use strict';var Sequelize=require('sequelize');module[_0x6df1('0x0')]={'type':{'type':Sequelize[_0x6df1('0x1')](_0x6df1('0x2'),_0x6df1('0x3'),_0x6df1('0x4'),_0x6df1('0x5'),_0x6df1('0x6')),'defaultValue':_0x6df1('0x2')},'content':{'type':Sequelize[_0x6df1('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6df1('0x1')]('string',_0x6df1('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6df1('0x7')]},'nameField':{'type':Sequelize[_0x6df1('0x7')]},'customField':{'type':Sequelize[_0x6df1('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6df1('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 82a210c..452d911 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 _0x465c=['ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','error','stack','name','rawAttributes','fieldName','type','key','model','map','query','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','keys','fields','include','ZohoField','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv'];(function(_0x1cb30d,_0x47a95f){var _0x5f2f0c=function(_0x26d22d){while(--_0x26d22d){_0x1cb30d['push'](_0x1cb30d['shift']());}};_0x5f2f0c(++_0x47a95f);}(_0x465c,0x8e));var _0xc465=function(_0x5851cd,_0x3215e8){_0x5851cd=_0x5851cd-0x0;var _0x4ca355=_0x465c[_0x5851cd];return _0x4ca355;};'use strict';var emlformat=require(_0xc465('0x0'));var rimraf=require(_0xc465('0x1'));var zipdir=require(_0xc465('0x2'));var jsonpatch=require(_0xc465('0x3'));var rp=require('request-promise');var moment=require(_0xc465('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc465('0x5'));var util=require(_0xc465('0x6'));var path=require(_0xc465('0x7'));var sox=require(_0xc465('0x8'));var csv=require(_0xc465('0x9'));var ejs=require(_0xc465('0xa'));var fs=require('fs');var fs_extra=require(_0xc465('0xb'));var _=require(_0xc465('0xc'));var squel=require(_0xc465('0xd'));var crypto=require('crypto');var jsforce=require(_0xc465('0xe'));var deskjs=require(_0xc465('0xf'));var toCsv=require(_0xc465('0x9'));var querystring=require(_0xc465('0x10'));var Papa=require(_0xc465('0x11'));var Redis=require('ioredis');var authService=require(_0xc465('0x12'));var qs=require(_0xc465('0x13'));var as=require(_0xc465('0x14'));var hardwareService=require(_0xc465('0x15'));var logger=require(_0xc465('0x16'))('api');var utils=require(_0xc465('0x17'));var config=require(_0xc465('0x18'));var licenseUtil=require(_0xc465('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a9d73,_0x6dcf37){_0x6dcf37=_0x6dcf37||0xcc;return function(_0x1a43b6){if(_0x1a43b6){return _0x1a9d73[_0xc465('0x1a')](_0x6dcf37);}return _0x1a9d73[_0xc465('0x1b')](_0x6dcf37)[_0xc465('0x1c')]();};}function respondWithResult(_0x511481,_0x40e283){_0x40e283=_0x40e283||0xc8;return function(_0x46048c){if(_0x46048c){return _0x511481[_0xc465('0x1b')](_0x40e283)['json'](_0x46048c);}};}function respondWithFilteredResult(_0xcdb4fe,_0x3ef765){return function(_0x5769f2){if(_0x5769f2){var _0x4297dd=typeof _0x3ef765[_0xc465('0x1d')]==='undefined'&&typeof _0x3ef765[_0xc465('0x1e')]===_0xc465('0x1f');var _0x11b083=_0x5769f2[_0xc465('0x20')];var _0x1dabc2=_0x4297dd?0x0:_0x3ef765['offset'];var _0x5857c4=_0x4297dd?_0x5769f2[_0xc465('0x20')]:_0x3ef765[_0xc465('0x1d')]+_0x3ef765[_0xc465('0x1e')];var _0x1cded1;if(_0x5857c4>=_0x11b083){_0x5857c4=_0x11b083;_0x1cded1=0xc8;}else{_0x1cded1=0xce;}_0xcdb4fe['status'](_0x1cded1);return _0xcdb4fe[_0xc465('0x21')](_0xc465('0x22'),_0x1dabc2+'-'+_0x5857c4+'/'+_0x11b083)[_0xc465('0x23')](_0x5769f2);}return null;};}function patchUpdates(_0x5c87cb){return function(_0xa81486){try{jsonpatch[_0xc465('0x24')](_0xa81486,_0x5c87cb,!![]);}catch(_0x296939){return BPromise['reject'](_0x296939);}return _0xa81486[_0xc465('0x25')]();};}function saveUpdates(_0x402549,_0x2af50d){return function(_0x2d9cf7){if(_0x2d9cf7){return _0x2d9cf7[_0xc465('0x26')](_0x402549)[_0xc465('0x27')](function(_0x599f69){return _0x599f69;});}return null;};}function removeEntity(_0x4b0872,_0x26f8ae){return function(_0x2bef4f){if(_0x2bef4f){return _0x2bef4f['destroy']()[_0xc465('0x27')](function(){_0x4b0872[_0xc465('0x1b')](0xcc)[_0xc465('0x1c')]();});}};}function handleEntityNotFound(_0x30579e,_0x1d255d){return function(_0xdbf1fb){if(!_0xdbf1fb){_0x30579e['sendStatus'](0x194);}return _0xdbf1fb;};}function handleError(_0x39fc3b,_0x23b934){_0x23b934=_0x23b934||0x1f4;return function(_0x786c0){logger[_0xc465('0x28')](_0x786c0[_0xc465('0x29')]);if(_0x786c0[_0xc465('0x2a')]){delete _0x786c0[_0xc465('0x2a')];}_0x39fc3b[_0xc465('0x1b')](_0x23b934)['send'](_0x786c0);};}exports['index']=function(_0x5ac1b4,_0x5cba9c){var _0x5a6a92={},_0x47a1ef={},_0x9fd310={'count':0x0,'rows':[]};var _0x4b4c61=_['map'](db['ZohoField'][_0xc465('0x2b')],function(_0xd13e84){return{'name':_0xd13e84[_0xc465('0x2c')],'type':_0xd13e84[_0xc465('0x2d')][_0xc465('0x2e')]};});_0x47a1ef[_0xc465('0x2f')]=_[_0xc465('0x30')](_0x4b4c61,_0xc465('0x2a'));_0x47a1ef[_0xc465('0x31')]=_['keys'](_0x5ac1b4['query']);_0x47a1ef['filters']=_['intersection'](_0x47a1ef[_0xc465('0x2f')],_0x47a1ef['query']);_0x5a6a92[_0xc465('0x32')]=_[_0xc465('0x33')](_0x47a1ef[_0xc465('0x2f')],qs['fields'](_0x5ac1b4['query']['fields']));_0x5a6a92[_0xc465('0x32')]=_0x5a6a92[_0xc465('0x32')][_0xc465('0x34')]?_0x5a6a92['attributes']:_0x47a1ef[_0xc465('0x2f')];if(!_0x5ac1b4['query'][_0xc465('0x35')](_0xc465('0x36'))){_0x5a6a92[_0xc465('0x1e')]=qs[_0xc465('0x1e')](_0x5ac1b4['query']['limit']);_0x5a6a92[_0xc465('0x1d')]=qs[_0xc465('0x1d')](_0x5ac1b4[_0xc465('0x31')][_0xc465('0x1d')]);}_0x5a6a92[_0xc465('0x37')]=qs[_0xc465('0x38')](_0x5ac1b4[_0xc465('0x31')]['sort']);_0x5a6a92[_0xc465('0x39')]=qs[_0xc465('0x3a')](_['pick'](_0x5ac1b4['query'],_0x47a1ef[_0xc465('0x3a')]),_0x4b4c61);if(_0x5ac1b4[_0xc465('0x31')][_0xc465('0x3b')]){_0x5a6a92[_0xc465('0x39')]=_[_0xc465('0x3c')](_0x5a6a92[_0xc465('0x39')],{'$or':_['map'](_0x4b4c61,function(_0x5a5ea7){if(_0x5a5ea7[_0xc465('0x2d')]!==_0xc465('0x3d')){var _0x13fd39={};_0x13fd39[_0x5a5ea7[_0xc465('0x2a')]]={'$like':'%'+_0x5ac1b4['query'][_0xc465('0x3b')]+'%'};return _0x13fd39;}})});}_0x5a6a92=_[_0xc465('0x3c')]({},_0x5a6a92,_0x5ac1b4[_0xc465('0x3e')]);var _0x4b24f1={'where':_0x5a6a92[_0xc465('0x39')]};return db['ZohoField'][_0xc465('0x20')](_0x4b24f1)[_0xc465('0x27')](function(_0x1f6d66){_0x9fd310[_0xc465('0x20')]=_0x1f6d66;if(_0x5ac1b4[_0xc465('0x31')][_0xc465('0x3f')]){_0x5a6a92['include']=[{'all':!![]}];}return db['ZohoField']['findAll'](_0x5a6a92);})[_0xc465('0x27')](function(_0x4be83b){_0x9fd310[_0xc465('0x40')]=_0x4be83b;return _0x9fd310;})[_0xc465('0x27')](respondWithFilteredResult(_0x5cba9c,_0x5a6a92))[_0xc465('0x41')](handleError(_0x5cba9c,null));};exports[_0xc465('0x42')]=function(_0x565d0f,_0x2d5796){var _0x4c20fb={'raw':!![],'where':{'id':_0x565d0f[_0xc465('0x43')]['id']}},_0x350229={};_0x350229[_0xc465('0x2f')]=_[_0xc465('0x44')](db['ZohoField']['rawAttributes']);_0x350229[_0xc465('0x31')]=_[_0xc465('0x44')](_0x565d0f['query']);_0x350229[_0xc465('0x3a')]=_['intersection'](_0x350229[_0xc465('0x2f')],_0x350229[_0xc465('0x31')]);_0x4c20fb[_0xc465('0x32')]=_[_0xc465('0x33')](_0x350229[_0xc465('0x2f')],qs[_0xc465('0x45')](_0x565d0f[_0xc465('0x31')][_0xc465('0x45')]));_0x4c20fb[_0xc465('0x32')]=_0x4c20fb[_0xc465('0x32')][_0xc465('0x34')]?_0x4c20fb[_0xc465('0x32')]:_0x350229[_0xc465('0x2f')];if(_0x565d0f[_0xc465('0x31')][_0xc465('0x3f')]){_0x4c20fb[_0xc465('0x46')]=[{'all':!![]}];}_0x4c20fb=_[_0xc465('0x3c')]({},_0x4c20fb,_0x565d0f[_0xc465('0x3e')]);return db[_0xc465('0x47')][_0xc465('0x48')](_0x4c20fb)[_0xc465('0x27')](handleEntityNotFound(_0x2d5796,null))[_0xc465('0x27')](respondWithResult(_0x2d5796,null))[_0xc465('0x41')](handleError(_0x2d5796,null));};exports['create']=function(_0x447bc7,_0x208631){return db[_0xc465('0x47')][_0xc465('0x49')](_0x447bc7[_0xc465('0x4a')],{})[_0xc465('0x27')](respondWithResult(_0x208631,0xc9))[_0xc465('0x41')](handleError(_0x208631,null));};exports[_0xc465('0x26')]=function(_0xf642e7,_0x29d67d){if(_0xf642e7[_0xc465('0x4a')]['id']){delete _0xf642e7[_0xc465('0x4a')]['id'];}return db[_0xc465('0x47')][_0xc465('0x48')]({'where':{'id':_0xf642e7[_0xc465('0x43')]['id']}})[_0xc465('0x27')](handleEntityNotFound(_0x29d67d,null))['then'](saveUpdates(_0xf642e7[_0xc465('0x4a')],null))['then'](respondWithResult(_0x29d67d,null))[_0xc465('0x41')](handleError(_0x29d67d,null));};exports[_0xc465('0x4b')]=function(_0x20e642,_0x5b7a2c){return db[_0xc465('0x47')][_0xc465('0x48')]({'where':{'id':_0x20e642[_0xc465('0x43')]['id']}})[_0xc465('0x27')](handleEntityNotFound(_0x5b7a2c,null))['then'](removeEntity(_0x5b7a2c,null))['catch'](handleError(_0x5b7a2c,null));}; \ No newline at end of file +var _0x9645=['options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','ZohoField','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter'];(function(_0x39949a,_0x3abfc8){var _0x218fa8=function(_0x392715){while(--_0x392715){_0x39949a['push'](_0x39949a['shift']());}};_0x218fa8(++_0x3abfc8);}(_0x9645,0xf2));var _0x5964=function(_0x3cb30b,_0x504b3e){_0x3cb30b=_0x3cb30b-0x0;var _0x2ca717=_0x9645[_0x3cb30b];return _0x2ca717;};'use strict';var emlformat=require(_0x5964('0x0'));var rimraf=require(_0x5964('0x1'));var zipdir=require(_0x5964('0x2'));var jsonpatch=require(_0x5964('0x3'));var rp=require(_0x5964('0x4'));var moment=require(_0x5964('0x5'));var BPromise=require(_0x5964('0x6'));var Mustache=require(_0x5964('0x7'));var util=require('util');var path=require(_0x5964('0x8'));var sox=require('sox');var csv=require(_0x5964('0x9'));var ejs=require(_0x5964('0xa'));var fs=require('fs');var fs_extra=require(_0x5964('0xb'));var _=require(_0x5964('0xc'));var squel=require(_0x5964('0xd'));var crypto=require(_0x5964('0xe'));var jsforce=require(_0x5964('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x5964('0x9'));var querystring=require(_0x5964('0x10'));var Papa=require(_0x5964('0x11'));var Redis=require('ioredis');var authService=require(_0x5964('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5964('0x13'));var hardwareService=require(_0x5964('0x14'));var logger=require(_0x5964('0x15'))(_0x5964('0x16'));var utils=require('../../config/utils');var config=require(_0x5964('0x17'));var licenseUtil=require(_0x5964('0x18'));var db=require(_0x5964('0x19'))['db'];function respondWithStatusCode(_0x2af469,_0x3a26eb){_0x3a26eb=_0x3a26eb||0xcc;return function(_0x32c34d){if(_0x32c34d){return _0x2af469['sendStatus'](_0x3a26eb);}return _0x2af469['status'](_0x3a26eb)[_0x5964('0x1a')]();};}function respondWithResult(_0x120772,_0x2200e2){_0x2200e2=_0x2200e2||0xc8;return function(_0x4fb63c){if(_0x4fb63c){return _0x120772[_0x5964('0x1b')](_0x2200e2)[_0x5964('0x1c')](_0x4fb63c);}};}function respondWithFilteredResult(_0x27c8b5,_0x21b8d5){return function(_0x4ea2e4){if(_0x4ea2e4){var _0x5236f8=typeof _0x21b8d5[_0x5964('0x1d')]===_0x5964('0x1e')&&typeof _0x21b8d5[_0x5964('0x1f')]==='undefined';var _0x16c5d1=_0x4ea2e4[_0x5964('0x20')];var _0x5e54ee=_0x5236f8?0x0:_0x21b8d5[_0x5964('0x1d')];var _0x5afa4f=_0x5236f8?_0x4ea2e4[_0x5964('0x20')]:_0x21b8d5['offset']+_0x21b8d5[_0x5964('0x1f')];var _0x16cd5c;if(_0x5afa4f>=_0x16c5d1){_0x5afa4f=_0x16c5d1;_0x16cd5c=0xc8;}else{_0x16cd5c=0xce;}_0x27c8b5[_0x5964('0x1b')](_0x16cd5c);return _0x27c8b5[_0x5964('0x21')](_0x5964('0x22'),_0x5e54ee+'-'+_0x5afa4f+'/'+_0x16c5d1)[_0x5964('0x1c')](_0x4ea2e4);}return null;};}function patchUpdates(_0x442bf3){return function(_0x22ade4){try{jsonpatch['apply'](_0x22ade4,_0x442bf3,!![]);}catch(_0xd98d93){return BPromise[_0x5964('0x23')](_0xd98d93);}return _0x22ade4[_0x5964('0x24')]();};}function saveUpdates(_0x1022c6,_0x4eed38){return function(_0x18fdb9){if(_0x18fdb9){return _0x18fdb9[_0x5964('0x25')](_0x1022c6)[_0x5964('0x26')](function(_0x3fc12f){return _0x3fc12f;});}return null;};}function removeEntity(_0x2002e1,_0x482c3d){return function(_0x2055af){if(_0x2055af){return _0x2055af[_0x5964('0x27')]()[_0x5964('0x26')](function(){_0x2002e1[_0x5964('0x1b')](0xcc)[_0x5964('0x1a')]();});}};}function handleEntityNotFound(_0x34eb82,_0x2a257e){return function(_0x46fc39){if(!_0x46fc39){_0x34eb82['sendStatus'](0x194);}return _0x46fc39;};}function handleError(_0x3c04ad,_0x43940d){_0x43940d=_0x43940d||0x1f4;return function(_0x134b9a){logger[_0x5964('0x28')](_0x134b9a[_0x5964('0x29')]);if(_0x134b9a[_0x5964('0x2a')]){delete _0x134b9a[_0x5964('0x2a')];}_0x3c04ad[_0x5964('0x1b')](_0x43940d)[_0x5964('0x2b')](_0x134b9a);};}exports[_0x5964('0x2c')]=function(_0x10bc69,_0x4c0bc6){var _0x101ed1={},_0x2f2879={},_0x10c0d4={'count':0x0,'rows':[]};var _0x40a4c3=_[_0x5964('0x2d')](db[_0x5964('0x2e')][_0x5964('0x2f')],function(_0x3c0e6d){return{'name':_0x3c0e6d['fieldName'],'type':_0x3c0e6d['type'][_0x5964('0x30')]};});_0x2f2879[_0x5964('0x31')]=_[_0x5964('0x2d')](_0x40a4c3,_0x5964('0x2a'));_0x2f2879['query']=_[_0x5964('0x32')](_0x10bc69[_0x5964('0x33')]);_0x2f2879[_0x5964('0x34')]=_[_0x5964('0x35')](_0x2f2879['model'],_0x2f2879['query']);_0x101ed1[_0x5964('0x36')]=_[_0x5964('0x35')](_0x2f2879[_0x5964('0x31')],qs['fields'](_0x10bc69[_0x5964('0x33')][_0x5964('0x37')]));_0x101ed1['attributes']=_0x101ed1[_0x5964('0x36')][_0x5964('0x38')]?_0x101ed1[_0x5964('0x36')]:_0x2f2879[_0x5964('0x31')];if(!_0x10bc69[_0x5964('0x33')]['hasOwnProperty'](_0x5964('0x39'))){_0x101ed1[_0x5964('0x1f')]=qs['limit'](_0x10bc69['query']['limit']);_0x101ed1['offset']=qs['offset'](_0x10bc69['query'][_0x5964('0x1d')]);}_0x101ed1[_0x5964('0x3a')]=qs['sort'](_0x10bc69[_0x5964('0x33')][_0x5964('0x3b')]);_0x101ed1[_0x5964('0x3c')]=qs['filters'](_[_0x5964('0x3d')](_0x10bc69[_0x5964('0x33')],_0x2f2879[_0x5964('0x34')]),_0x40a4c3);if(_0x10bc69['query']['filter']){_0x101ed1[_0x5964('0x3c')]=_[_0x5964('0x3e')](_0x101ed1[_0x5964('0x3c')],{'$or':_[_0x5964('0x2d')](_0x40a4c3,function(_0x2a58bc){if(_0x2a58bc[_0x5964('0x3f')]!==_0x5964('0x40')){var _0x1f7ad0={};_0x1f7ad0[_0x2a58bc['name']]={'$like':'%'+_0x10bc69[_0x5964('0x33')][_0x5964('0x41')]+'%'};return _0x1f7ad0;}})});}_0x101ed1=_['merge']({},_0x101ed1,_0x10bc69[_0x5964('0x42')]);var _0x5927ac={'where':_0x101ed1[_0x5964('0x3c')]};return db[_0x5964('0x2e')][_0x5964('0x20')](_0x5927ac)[_0x5964('0x26')](function(_0x148bb7){_0x10c0d4[_0x5964('0x20')]=_0x148bb7;if(_0x10bc69[_0x5964('0x33')][_0x5964('0x43')]){_0x101ed1[_0x5964('0x44')]=[{'all':!![]}];}return db[_0x5964('0x2e')][_0x5964('0x45')](_0x101ed1);})[_0x5964('0x26')](function(_0x521ebc){_0x10c0d4[_0x5964('0x46')]=_0x521ebc;return _0x10c0d4;})[_0x5964('0x26')](respondWithFilteredResult(_0x4c0bc6,_0x101ed1))[_0x5964('0x47')](handleError(_0x4c0bc6,null));};exports[_0x5964('0x48')]=function(_0x5563bb,_0x4e2a2d){var _0x37baea={'raw':!![],'where':{'id':_0x5563bb['params']['id']}},_0x56f4fc={};_0x56f4fc[_0x5964('0x31')]=_[_0x5964('0x32')](db['ZohoField'][_0x5964('0x2f')]);_0x56f4fc[_0x5964('0x33')]=_[_0x5964('0x32')](_0x5563bb['query']);_0x56f4fc[_0x5964('0x34')]=_[_0x5964('0x35')](_0x56f4fc[_0x5964('0x31')],_0x56f4fc[_0x5964('0x33')]);_0x37baea[_0x5964('0x36')]=_[_0x5964('0x35')](_0x56f4fc['model'],qs[_0x5964('0x37')](_0x5563bb['query'][_0x5964('0x37')]));_0x37baea['attributes']=_0x37baea[_0x5964('0x36')]['length']?_0x37baea['attributes']:_0x56f4fc[_0x5964('0x31')];if(_0x5563bb['query']['includeAll']){_0x37baea[_0x5964('0x44')]=[{'all':!![]}];}_0x37baea=_[_0x5964('0x3e')]({},_0x37baea,_0x5563bb['options']);return db[_0x5964('0x2e')][_0x5964('0x49')](_0x37baea)[_0x5964('0x26')](handleEntityNotFound(_0x4e2a2d,null))[_0x5964('0x26')](respondWithResult(_0x4e2a2d,null))['catch'](handleError(_0x4e2a2d,null));};exports[_0x5964('0x4a')]=function(_0x385a5b,_0x455d89){return db[_0x5964('0x2e')][_0x5964('0x4a')](_0x385a5b[_0x5964('0x4b')],{})[_0x5964('0x26')](respondWithResult(_0x455d89,0xc9))['catch'](handleError(_0x455d89,null));};exports['update']=function(_0x3b422d,_0x579148){if(_0x3b422d[_0x5964('0x4b')]['id']){delete _0x3b422d[_0x5964('0x4b')]['id'];}return db[_0x5964('0x2e')]['find']({'where':{'id':_0x3b422d['params']['id']}})[_0x5964('0x26')](handleEntityNotFound(_0x579148,null))[_0x5964('0x26')](saveUpdates(_0x3b422d['body'],null))[_0x5964('0x26')](respondWithResult(_0x579148,null))[_0x5964('0x47')](handleError(_0x579148,null));};exports['destroy']=function(_0x2b468e,_0x244307){return db[_0x5964('0x2e')][_0x5964('0x49')]({'where':{'id':_0x2b468e[_0x5964('0x4c')]['id']}})[_0x5964('0x26')](handleEntityNotFound(_0x244307,null))[_0x5964('0x26')](removeEntity(_0x244307,null))[_0x5964('0x47')](handleError(_0x244307,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 1a865ce..5eef623 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 _0x4975=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','lodash'];(function(_0x398a69,_0x23ec23){var _0x4c588c=function(_0x2c7e95){while(--_0x2c7e95){_0x398a69['push'](_0x398a69['shift']());}};_0x4c588c(++_0x23ec23);}(_0x4975,0x86));var _0x5497=function(_0x4313b6,_0x20f942){_0x4313b6=_0x4313b6-0x0;var _0x35b200=_0x4975[_0x4313b6];return _0x35b200;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['idField',_0x5497('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6d38=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','./intZohoField.attributes','define','ZohoField','idField','FieldId'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x6d38,0x1ef));var _0x86d3=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x6d38[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var logger=require(_0x86d3('0x1'))(_0x86d3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x86d3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var attributes=require(_0x86d3('0x6'));module['exports']=function(_0x2d8272,_0xfbbc15){return _0x2d8272[_0x86d3('0x7')](_0x86d3('0x8'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x86d3('0x9'),_0x86d3('0xa')],'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 ebe6cf7..aec17c1 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 _0x651f=['../../config/logger','rpc','../../config/environment','jayson/promise','http','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','../../mysqldb'];(function(_0x18ae0e,_0x490d72){var _0x214c05=function(_0x4e745a){while(--_0x4e745a){_0x18ae0e['push'](_0x18ae0e['shift']());}};_0x214c05(++_0x490d72);}(_0x651f,0x7b));var _0xf651=function(_0x4ea5cb,_0x5c82ac){_0x4ea5cb=_0x4ea5cb-0x0;var _0x34bbbd=_0x651f[_0x4ea5cb];return _0x34bbbd;};'use strict';var _=require(_0xf651('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf651('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf651('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xf651('0x3'))(_0xf651('0x4'));var config=require(_0xf651('0x5'));var jayson=require(_0xf651('0x6'));var client=jayson['client'][_0xf651('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1e4b5e,_0x5cb6e2,_0x141f1f){return new BPromise(function(_0x9d4407,_0x540c03){return client['request'](_0x1e4b5e,_0x141f1f)['then'](function(_0x423fe3){logger[_0xf651('0x8')](_0xf651('0x9'),_0x5cb6e2,_0xf651('0xa'));logger['debug'](_0xf651('0xb'),_0x5cb6e2,_0xf651('0xa'),JSON[_0xf651('0xc')](_0x423fe3));if(_0x423fe3[_0xf651('0xd')]){if(_0x423fe3[_0xf651('0xd')][_0xf651('0xe')]===0x1f4){logger[_0xf651('0xd')](_0xf651('0x9'),_0x5cb6e2,_0x423fe3['error'][_0xf651('0xf')]);return _0x540c03(_0x423fe3['error'][_0xf651('0xf')]);}logger[_0xf651('0xd')]('ZohoField,\x20%s,\x20%s',_0x5cb6e2,_0x423fe3[_0xf651('0xd')][_0xf651('0xf')]);return _0x9d4407(_0x423fe3[_0xf651('0xd')]['message']);}else{logger[_0xf651('0x8')]('ZohoField,\x20%s,\x20%s',_0x5cb6e2,_0xf651('0xa'));_0x9d4407(_0x423fe3[_0xf651('0x10')][_0xf651('0xf')]);}})[_0xf651('0x11')](function(_0x10f7a5){logger[_0xf651('0xd')]('ZohoField,\x20%s,\x20%s',_0x5cb6e2,_0x10f7a5);_0x540c03(_0x10f7a5);});});} \ No newline at end of file +var _0x8f54=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x5f4b13,_0x2d88cb){var _0x25d567=function(_0x2e019d){while(--_0x2e019d){_0x5f4b13['push'](_0x5f4b13['shift']());}};_0x25d567(++_0x2d88cb);}(_0x8f54,0xd7));var _0x48f5=function(_0x3d9e42,_0x53bdb3){_0x3d9e42=_0x3d9e42-0x0;var _0x25b703=_0x8f54[_0x3d9e42];return _0x25b703;};'use strict';var _=require(_0x48f5('0x0'));var util=require(_0x48f5('0x1'));var moment=require(_0x48f5('0x2'));var BPromise=require(_0x48f5('0x3'));var rs=require(_0x48f5('0x4'));var fs=require('fs');var Redis=require(_0x48f5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x48f5('0x6'));var logger=require(_0x48f5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x48f5('0x8'));var client=jayson[_0x48f5('0x9')][_0x48f5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28a74c,_0x20cee6,_0x44c243){return new BPromise(function(_0x259568,_0x2d3481){return client[_0x48f5('0xb')](_0x28a74c,_0x44c243)['then'](function(_0x364c64){logger['info'](_0x48f5('0xc'),_0x20cee6,_0x48f5('0xd'));logger[_0x48f5('0xe')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x20cee6,_0x48f5('0xd'),JSON[_0x48f5('0xf')](_0x364c64));if(_0x364c64[_0x48f5('0x10')]){if(_0x364c64[_0x48f5('0x10')][_0x48f5('0x11')]===0x1f4){logger[_0x48f5('0x10')](_0x48f5('0xc'),_0x20cee6,_0x364c64[_0x48f5('0x10')][_0x48f5('0x12')]);return _0x2d3481(_0x364c64[_0x48f5('0x10')][_0x48f5('0x12')]);}logger[_0x48f5('0x10')](_0x48f5('0xc'),_0x20cee6,_0x364c64['error'][_0x48f5('0x12')]);return _0x259568(_0x364c64[_0x48f5('0x10')][_0x48f5('0x12')]);}else{logger['info'](_0x48f5('0xc'),_0x20cee6,_0x48f5('0xd'));_0x259568(_0x364c64[_0x48f5('0x13')][_0x48f5('0x12')]);}})[_0x48f5('0x14')](function(_0x310f27){logger[_0x48f5('0x10')](_0x48f5('0xc'),_0x20cee6,_0x310f27);_0x2d3481(_0x310f27);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index d29ebb1..dda2ddc 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x22a52f,_0x23f297){var _0x1f5328=function(_0x1c0e0e){while(--_0x1c0e0e){_0x22a52f['push'](_0x22a52f['shift']());}};_0x1f5328(++_0x23f297);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4dbe67,_0x1ebc59){var _0x3d7eb9=function(_0x44eecb){while(--_0x44eecb){_0x4dbe67['push'](_0x4dbe67['shift']());}};_0x3d7eb9(++_0x1ebc59);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index af04e7e..d694c6c 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 _0x05c2=['INTEGER','BOOLEAN','state','sequelize','exports','unique_name_and_version','STRING','app.js'];(function(_0x108d7a,_0x3145cf){var _0xc168d0=function(_0x58331f){while(--_0x58331f){_0x108d7a['push'](_0x108d7a['shift']());}};_0xc168d0(++_0x3145cf);}(_0x05c2,0x1ab));var _0x205c=function(_0x2b6588,_0x5945de){_0x2b6588=_0x2b6588-0x0;var _0x58192c=_0x05c2[_0x2b6588];return _0x58192c;};'use strict';var Sequelize=require(_0x205c('0x0'));module[_0x205c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x205c('0x2')},'version':{'type':Sequelize[_0x205c('0x3')],'allowNull':![],'unique':_0x205c('0x2')},'main':{'type':Sequelize[_0x205c('0x3')],'defaultValue':_0x205c('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x205c('0x3')]},'size':{'type':Sequelize[_0x205c('0x5')]},'active':{'type':Sequelize[_0x205c('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x205c('0x3')]},'logo':{'type':Sequelize[_0x205c('0x3')]},'state':{'type':Sequelize['STRING'],'unique':_0x205c('0x7')},'description':{'type':Sequelize[_0x205c('0x3')]},'title':{'type':Sequelize[_0x205c('0x3')]},'remoteUri':{'type':Sequelize[_0x205c('0x3')]},'link':{'type':Sequelize[_0x205c('0x3')],'defaultValue':'#'}}; \ No newline at end of file +var _0x1315=['unique_name_and_version','STRING','app.js','INTEGER','BOOLEAN','state','sequelize'];(function(_0x44d3d7,_0x1c6356){var _0x1886c0=function(_0x30b3ab){while(--_0x30b3ab){_0x44d3d7['push'](_0x44d3d7['shift']());}};_0x1886c0(++_0x1c6356);}(_0x1315,0x84));var _0x5131=function(_0x542d80,_0x150561){_0x542d80=_0x542d80-0x0;var _0x1f4492=_0x1315[_0x542d80];return _0x1f4492;};'use strict';var Sequelize=require(_0x5131('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5131('0x1')},'version':{'type':Sequelize[_0x5131('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x5131('0x2')],'defaultValue':_0x5131('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5131('0x2')]},'size':{'type':Sequelize[_0x5131('0x4')]},'active':{'type':Sequelize[_0x5131('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x5131('0x2')]},'state':{'type':Sequelize[_0x5131('0x2')],'unique':_0x5131('0x6')},'description':{'type':Sequelize[_0x5131('0x2')]},'title':{'type':Sequelize[_0x5131('0x2')]},'remoteUri':{'type':Sequelize[_0x5131('0x2')]},'link':{'type':Sequelize[_0x5131('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 e4b796a..4ba81eb 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 _0x187d=['body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','update','destroy','error','stack','name','index','map','Integration','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','where','filter','merge','includeAll','include','findAll','then','rows','catch','show','params','fields','options','find','create'];(function(_0x208d6f,_0x576241){var _0x398bbf=function(_0x3c8084){while(--_0x3c8084){_0x208d6f['push'](_0x208d6f['shift']());}};_0x398bbf(++_0x576241);}(_0x187d,0x93));var _0xd187=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x187d[_0x2b5eae];return _0x5f3ac9;};'use strict';var emlformat=require(_0xd187('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd187('0x1'));var jsonpatch=require(_0xd187('0x2'));var rp=require(_0xd187('0x3'));var moment=require(_0xd187('0x4'));var BPromise=require(_0xd187('0x5'));var Mustache=require(_0xd187('0x6'));var util=require('util');var path=require(_0xd187('0x7'));var sox=require(_0xd187('0x8'));var csv=require('to-csv');var ejs=require(_0xd187('0x9'));var fs=require('fs');var fs_extra=require(_0xd187('0xa'));var _=require(_0xd187('0xb'));var squel=require(_0xd187('0xc'));var crypto=require(_0xd187('0xd'));var jsforce=require(_0xd187('0xe'));var deskjs=require(_0xd187('0xf'));var toCsv=require(_0xd187('0x10'));var querystring=require('querystring');var Papa=require(_0xd187('0x11'));var Redis=require(_0xd187('0x12'));var authService=require(_0xd187('0x13'));var qs=require(_0xd187('0x14'));var as=require(_0xd187('0x15'));var hardwareService=require(_0xd187('0x16'));var logger=require('../../config/logger')(_0xd187('0x17'));var utils=require(_0xd187('0x18'));var config=require(_0xd187('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd187('0x1a'))['db'];function respondWithStatusCode(_0x4545cf,_0x32ba07){_0x32ba07=_0x32ba07||0xcc;return function(_0x59ee4a){if(_0x59ee4a){return _0x4545cf[_0xd187('0x1b')](_0x32ba07);}return _0x4545cf[_0xd187('0x1c')](_0x32ba07)[_0xd187('0x1d')]();};}function respondWithResult(_0x126d1a,_0x517b25){_0x517b25=_0x517b25||0xc8;return function(_0x39a927){if(_0x39a927){return _0x126d1a[_0xd187('0x1c')](_0x517b25)[_0xd187('0x1e')](_0x39a927);}};}function respondWithFilteredResult(_0x188cfe,_0x4c8f68){return function(_0x245d3e){if(_0x245d3e){var _0x52a208=typeof _0x4c8f68['offset']===_0xd187('0x1f')&&typeof _0x4c8f68['limit']==='undefined';var _0x207b36=_0x245d3e[_0xd187('0x20')];var _0x374fe0=_0x52a208?0x0:_0x4c8f68[_0xd187('0x21')];var _0x21df74=_0x52a208?_0x245d3e[_0xd187('0x20')]:_0x4c8f68[_0xd187('0x21')]+_0x4c8f68[_0xd187('0x22')];var _0x4f2f88;if(_0x21df74>=_0x207b36){_0x21df74=_0x207b36;_0x4f2f88=0xc8;}else{_0x4f2f88=0xce;}_0x188cfe[_0xd187('0x1c')](_0x4f2f88);return _0x188cfe[_0xd187('0x23')](_0xd187('0x24'),_0x374fe0+'-'+_0x21df74+'/'+_0x207b36)[_0xd187('0x1e')](_0x245d3e);}return null;};}function patchUpdates(_0x5204ee){return function(_0x2f7fb3){try{jsonpatch[_0xd187('0x25')](_0x2f7fb3,_0x5204ee,!![]);}catch(_0xc5bba5){return BPromise['reject'](_0xc5bba5);}return _0x2f7fb3['save']();};}function saveUpdates(_0x57cf1d,_0x435d94){return function(_0x33741d){if(_0x33741d){return _0x33741d[_0xd187('0x26')](_0x57cf1d)['then'](function(_0x2c07c8){return _0x2c07c8;});}return null;};}function removeEntity(_0x57186b,_0x145771){return function(_0x5a7a23){if(_0x5a7a23){return _0x5a7a23[_0xd187('0x27')]()['then'](function(){_0x57186b['status'](0xcc)[_0xd187('0x1d')]();});}};}function handleEntityNotFound(_0x4d992b,_0x12da33){return function(_0x598aa4){if(!_0x598aa4){_0x4d992b['sendStatus'](0x194);}return _0x598aa4;};}function handleError(_0x4eac6a,_0x848ddd){_0x848ddd=_0x848ddd||0x1f4;return function(_0xeff822){logger[_0xd187('0x28')](_0xeff822[_0xd187('0x29')]);if(_0xeff822['name']){delete _0xeff822[_0xd187('0x2a')];}_0x4eac6a[_0xd187('0x1c')](_0x848ddd)['send'](_0xeff822);};}exports[_0xd187('0x2b')]=function(_0x1c87ee,_0x34febe){var _0x4c50a5={},_0x15e2e8={},_0x56e292={'count':0x0,'rows':[]};var _0x263e31=_[_0xd187('0x2c')](db[_0xd187('0x2d')][_0xd187('0x2e')],function(_0x489f2e){return{'name':_0x489f2e[_0xd187('0x2f')],'type':_0x489f2e[_0xd187('0x30')]['key']};});_0x15e2e8['model']=_[_0xd187('0x2c')](_0x263e31,_0xd187('0x2a'));_0x15e2e8[_0xd187('0x31')]=_[_0xd187('0x32')](_0x1c87ee[_0xd187('0x31')]);_0x15e2e8[_0xd187('0x33')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],_0x15e2e8['query']);_0x4c50a5[_0xd187('0x36')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],qs['fields'](_0x1c87ee[_0xd187('0x31')]['fields']));_0x4c50a5[_0xd187('0x36')]=_0x4c50a5[_0xd187('0x36')][_0xd187('0x37')]?_0x4c50a5['attributes']:_0x15e2e8['model'];if(!_0x1c87ee[_0xd187('0x31')][_0xd187('0x38')]('nolimit')){_0x4c50a5[_0xd187('0x22')]=qs[_0xd187('0x22')](_0x1c87ee[_0xd187('0x31')]['limit']);_0x4c50a5['offset']=qs[_0xd187('0x21')](_0x1c87ee[_0xd187('0x31')]['offset']);}_0x4c50a5['order']=qs['sort'](_0x1c87ee[_0xd187('0x31')]['sort']);_0x4c50a5[_0xd187('0x39')]=qs[_0xd187('0x33')](_['pick'](_0x1c87ee[_0xd187('0x31')],_0x15e2e8['filters']),_0x263e31);if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]){_0x4c50a5['where']=_[_0xd187('0x3b')](_0x4c50a5[_0xd187('0x39')],{'$or':_['map'](_0x263e31,function(_0x4399a5){if(_0x4399a5['type']!=='VIRTUAL'){var _0x26b06d={};_0x26b06d[_0x4399a5[_0xd187('0x2a')]]={'$like':'%'+_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]+'%'};return _0x26b06d;}})});}_0x4c50a5=_[_0xd187('0x3b')]({},_0x4c50a5,_0x1c87ee['options']);var _0x8860c={'where':_0x4c50a5[_0xd187('0x39')]};return db[_0xd187('0x2d')]['count'](_0x8860c)['then'](function(_0x538c05){_0x56e292['count']=_0x538c05;if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3c')]){_0x4c50a5[_0xd187('0x3d')]=[{'all':!![]}];}return db[_0xd187('0x2d')][_0xd187('0x3e')](_0x4c50a5);})[_0xd187('0x3f')](function(_0x4699e1){_0x56e292[_0xd187('0x40')]=_0x4699e1;return _0x56e292;})['then'](respondWithFilteredResult(_0x34febe,_0x4c50a5))[_0xd187('0x41')](handleError(_0x34febe,null));};exports[_0xd187('0x42')]=function(_0x31d9d2,_0x51c7fc){var _0x21cbf6={'raw':![],'where':{'id':_0x31d9d2[_0xd187('0x43')]['id']}},_0x48c100={};_0x48c100[_0xd187('0x35')]=_[_0xd187('0x32')](db[_0xd187('0x2d')][_0xd187('0x2e')]);_0x48c100['query']=_[_0xd187('0x32')](_0x31d9d2[_0xd187('0x31')]);_0x48c100[_0xd187('0x33')]=_[_0xd187('0x34')](_0x48c100['model'],_0x48c100[_0xd187('0x31')]);_0x21cbf6[_0xd187('0x36')]=_['intersection'](_0x48c100[_0xd187('0x35')],qs[_0xd187('0x44')](_0x31d9d2['query']['fields']));_0x21cbf6[_0xd187('0x36')]=_0x21cbf6[_0xd187('0x36')]['length']?_0x21cbf6['attributes']:_0x48c100['model'];if(_0x31d9d2[_0xd187('0x31')][_0xd187('0x3c')]){_0x21cbf6[_0xd187('0x3d')]=[{'all':!![]}];}_0x21cbf6=_[_0xd187('0x3b')]({},_0x21cbf6,_0x31d9d2[_0xd187('0x45')]);return db[_0xd187('0x2d')][_0xd187('0x46')](_0x21cbf6)['then'](handleEntityNotFound(_0x51c7fc,null))[_0xd187('0x3f')](respondWithResult(_0x51c7fc,null))[_0xd187('0x41')](handleError(_0x51c7fc,null));};exports[_0xd187('0x47')]=function(_0x3ce4a1,_0x3f5def){return db[_0xd187('0x2d')][_0xd187('0x47')](_0x3ce4a1[_0xd187('0x48')],{})['then'](respondWithResult(_0x3f5def,0xc9))[_0xd187('0x41')](handleError(_0x3f5def,null));};exports[_0xd187('0x26')]=function(_0x4523c8,_0x1449d7){if(_0x4523c8[_0xd187('0x48')]['id']){delete _0x4523c8['body']['id'];}return db[_0xd187('0x2d')][_0xd187('0x46')]({'where':{'id':_0x4523c8['params']['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x1449d7,null))[_0xd187('0x3f')](saveUpdates(_0x4523c8['body'],null))['then'](respondWithResult(_0x1449d7,null))['catch'](handleError(_0x1449d7,null));};exports['destroy']=function(_0x473bef,_0x22f432){return db[_0xd187('0x2d')][_0xd187('0x46')]({'where':{'id':_0x473bef[_0xd187('0x43')]['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x22f432,null))[_0xd187('0x3f')](removeEntity(_0x22f432,null))['catch'](handleError(_0x22f432,null));}; \ No newline at end of file +var _0x1a37=['stack','name','send','index','map','Integration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x1a37,0xb4));var _0x71a3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x1a37[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0x71a3('0x0'));var rimraf=require(_0x71a3('0x1'));var zipdir=require(_0x71a3('0x2'));var jsonpatch=require(_0x71a3('0x3'));var rp=require(_0x71a3('0x4'));var moment=require(_0x71a3('0x5'));var BPromise=require(_0x71a3('0x6'));var Mustache=require(_0x71a3('0x7'));var util=require(_0x71a3('0x8'));var path=require(_0x71a3('0x9'));var sox=require('sox');var csv=require(_0x71a3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71a3('0xb'));var _=require(_0x71a3('0xc'));var squel=require(_0x71a3('0xd'));var crypto=require(_0x71a3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x71a3('0xf'));var Redis=require(_0x71a3('0x10'));var authService=require(_0x71a3('0x11'));var qs=require(_0x71a3('0x12'));var as=require(_0x71a3('0x13'));var hardwareService=require(_0x71a3('0x14'));var logger=require(_0x71a3('0x15'))(_0x71a3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x71a3('0x17'))['db'];function respondWithStatusCode(_0x3830cb,_0x27e46d){_0x27e46d=_0x27e46d||0xcc;return function(_0x229134){if(_0x229134){return _0x3830cb[_0x71a3('0x18')](_0x27e46d);}return _0x3830cb[_0x71a3('0x19')](_0x27e46d)[_0x71a3('0x1a')]();};}function respondWithResult(_0x3b256c,_0x4dc4ed){_0x4dc4ed=_0x4dc4ed||0xc8;return function(_0x203ee1){if(_0x203ee1){return _0x3b256c[_0x71a3('0x19')](_0x4dc4ed)['json'](_0x203ee1);}};}function respondWithFilteredResult(_0x1743d7,_0x32591a){return function(_0x59021f){if(_0x59021f){var _0x4aa918=typeof _0x32591a[_0x71a3('0x1b')]===_0x71a3('0x1c')&&typeof _0x32591a[_0x71a3('0x1d')]===_0x71a3('0x1c');var _0x1af1bc=_0x59021f[_0x71a3('0x1e')];var _0x5d4dee=_0x4aa918?0x0:_0x32591a[_0x71a3('0x1b')];var _0x27bfb4=_0x4aa918?_0x59021f['count']:_0x32591a['offset']+_0x32591a[_0x71a3('0x1d')];var _0x250db3;if(_0x27bfb4>=_0x1af1bc){_0x27bfb4=_0x1af1bc;_0x250db3=0xc8;}else{_0x250db3=0xce;}_0x1743d7[_0x71a3('0x19')](_0x250db3);return _0x1743d7[_0x71a3('0x1f')](_0x71a3('0x20'),_0x5d4dee+'-'+_0x27bfb4+'/'+_0x1af1bc)['json'](_0x59021f);}return null;};}function patchUpdates(_0x1ab947){return function(_0x4156e1){try{jsonpatch[_0x71a3('0x21')](_0x4156e1,_0x1ab947,!![]);}catch(_0x3ea036){return BPromise[_0x71a3('0x22')](_0x3ea036);}return _0x4156e1['save']();};}function saveUpdates(_0x1af24b,_0x5bbaee){return function(_0x3bf78e){if(_0x3bf78e){return _0x3bf78e[_0x71a3('0x23')](_0x1af24b)[_0x71a3('0x24')](function(_0x21899d){return _0x21899d;});}return null;};}function removeEntity(_0x452bc4,_0x2847b4){return function(_0x5f33c5){if(_0x5f33c5){return _0x5f33c5[_0x71a3('0x25')]()[_0x71a3('0x24')](function(){_0x452bc4[_0x71a3('0x19')](0xcc)[_0x71a3('0x1a')]();});}};}function handleEntityNotFound(_0xb0f3aa,_0x4fd214){return function(_0x107fbd){if(!_0x107fbd){_0xb0f3aa[_0x71a3('0x18')](0x194);}return _0x107fbd;};}function handleError(_0x4c1a3d,_0x412746){_0x412746=_0x412746||0x1f4;return function(_0x515519){logger[_0x71a3('0x26')](_0x515519[_0x71a3('0x27')]);if(_0x515519[_0x71a3('0x28')]){delete _0x515519[_0x71a3('0x28')];}_0x4c1a3d[_0x71a3('0x19')](_0x412746)[_0x71a3('0x29')](_0x515519);};}exports[_0x71a3('0x2a')]=function(_0x242b85,_0x305eb1){var _0x3fc578={},_0x3ea7aa={},_0x228afa={'count':0x0,'rows':[]};var _0x51cde3=_[_0x71a3('0x2b')](db[_0x71a3('0x2c')][_0x71a3('0x2d')],function(_0x23ae85){return{'name':_0x23ae85['fieldName'],'type':_0x23ae85[_0x71a3('0x2e')][_0x71a3('0x2f')]};});_0x3ea7aa[_0x71a3('0x30')]=_[_0x71a3('0x2b')](_0x51cde3,_0x71a3('0x28'));_0x3ea7aa[_0x71a3('0x31')]=_[_0x71a3('0x32')](_0x242b85['query']);_0x3ea7aa[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],_0x3ea7aa[_0x71a3('0x31')]);_0x3fc578[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x36')]));_0x3fc578[_0x71a3('0x35')]=_0x3fc578[_0x71a3('0x35')][_0x71a3('0x37')]?_0x3fc578['attributes']:_0x3ea7aa['model'];if(!_0x242b85[_0x71a3('0x31')][_0x71a3('0x38')]('nolimit')){_0x3fc578[_0x71a3('0x1d')]=qs[_0x71a3('0x1d')](_0x242b85['query'][_0x71a3('0x1d')]);_0x3fc578[_0x71a3('0x1b')]=qs[_0x71a3('0x1b')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x1b')]);}_0x3fc578[_0x71a3('0x39')]=qs[_0x71a3('0x3a')](_0x242b85['query'][_0x71a3('0x3a')]);_0x3fc578[_0x71a3('0x3b')]=qs[_0x71a3('0x33')](_['pick'](_0x242b85[_0x71a3('0x31')],_0x3ea7aa[_0x71a3('0x33')]),_0x51cde3);if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]){_0x3fc578[_0x71a3('0x3b')]=_['merge'](_0x3fc578['where'],{'$or':_[_0x71a3('0x2b')](_0x51cde3,function(_0x2b3197){if(_0x2b3197[_0x71a3('0x2e')]!==_0x71a3('0x3d')){var _0x36ed2e={};_0x36ed2e[_0x2b3197['name']]={'$like':'%'+_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]+'%'};return _0x36ed2e;}})});}_0x3fc578=_[_0x71a3('0x3e')]({},_0x3fc578,_0x242b85['options']);var _0x17c467={'where':_0x3fc578['where']};return db[_0x71a3('0x2c')][_0x71a3('0x1e')](_0x17c467)[_0x71a3('0x24')](function(_0x43c6d1){_0x228afa[_0x71a3('0x1e')]=_0x43c6d1;if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x3fc578[_0x71a3('0x40')]=[{'all':!![]}];}return db[_0x71a3('0x2c')][_0x71a3('0x41')](_0x3fc578);})['then'](function(_0xa49846){_0x228afa['rows']=_0xa49846;return _0x228afa;})[_0x71a3('0x24')](respondWithFilteredResult(_0x305eb1,_0x3fc578))[_0x71a3('0x42')](handleError(_0x305eb1,null));};exports[_0x71a3('0x43')]=function(_0x18974c,_0x59c7c9){var _0x412bce={'raw':![],'where':{'id':_0x18974c['params']['id']}},_0x4b4fde={};_0x4b4fde[_0x71a3('0x30')]=_[_0x71a3('0x32')](db[_0x71a3('0x2c')][_0x71a3('0x2d')]);_0x4b4fde['query']=_[_0x71a3('0x32')](_0x18974c[_0x71a3('0x31')]);_0x4b4fde[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],_0x4b4fde[_0x71a3('0x31')]);_0x412bce[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x18974c[_0x71a3('0x31')][_0x71a3('0x36')]));_0x412bce[_0x71a3('0x35')]=_0x412bce[_0x71a3('0x35')][_0x71a3('0x37')]?_0x412bce[_0x71a3('0x35')]:_0x4b4fde['model'];if(_0x18974c[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x412bce['include']=[{'all':!![]}];}_0x412bce=_[_0x71a3('0x3e')]({},_0x412bce,_0x18974c[_0x71a3('0x44')]);return db[_0x71a3('0x2c')][_0x71a3('0x45')](_0x412bce)[_0x71a3('0x24')](handleEntityNotFound(_0x59c7c9,null))['then'](respondWithResult(_0x59c7c9,null))['catch'](handleError(_0x59c7c9,null));};exports[_0x71a3('0x46')]=function(_0x4305ee,_0x51d20d){return db[_0x71a3('0x2c')][_0x71a3('0x46')](_0x4305ee[_0x71a3('0x47')],{})[_0x71a3('0x24')](respondWithResult(_0x51d20d,0xc9))[_0x71a3('0x42')](handleError(_0x51d20d,null));};exports[_0x71a3('0x23')]=function(_0x501a62,_0x1c9ba6){if(_0x501a62['body']['id']){delete _0x501a62[_0x71a3('0x47')]['id'];}return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x501a62[_0x71a3('0x48')]['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x1c9ba6,null))['then'](saveUpdates(_0x501a62[_0x71a3('0x47')],null))[_0x71a3('0x24')](respondWithResult(_0x1c9ba6,null))[_0x71a3('0x42')](handleError(_0x1c9ba6,null));};exports['destroy']=function(_0x6c34,_0x4e6423){return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x6c34['params']['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x4e6423,null))[_0x71a3('0x24')](removeEntity(_0x4e6423,null))[_0x71a3('0x42')](handleError(_0x4e6423,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index a22110a..f5fcddd 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 _0x8be4=['request-promise','path','../../config/environment','exports','Integration','integrations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xaa86cc,_0x13814a){var _0x29f4cb=function(_0x222a94){while(--_0x222a94){_0xaa86cc['push'](_0xaa86cc['shift']());}};_0x29f4cb(++_0x13814a);}(_0x8be4,0x186));var _0x48be=function(_0x4ef826,_0x2e0ac8){_0x4ef826=_0x4ef826-0x0;var _0x154b8=_0x8be4[_0x4ef826];return _0x154b8;};'use strict';var _=require(_0x48be('0x0'));var util=require(_0x48be('0x1'));var logger=require(_0x48be('0x2'))(_0x48be('0x3'));var moment=require(_0x48be('0x4'));var BPromise=require(_0x48be('0x5'));var rp=require(_0x48be('0x6'));var fs=require('fs');var path=require(_0x48be('0x7'));var rimraf=require('rimraf');var config=require(_0x48be('0x8'));var attributes=require('./integration.attributes');module[_0x48be('0x9')]=function(_0x28c4fc,_0xbdb319){return _0x28c4fc['define'](_0x48be('0xa'),attributes,{'tableName':_0x48be('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb950=['util','../../config/logger','bluebird','request-promise','rimraf','./integration.attributes','define','Integration','integrations','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb950,0x1e9));var _0x0b95=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xb950[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x0b95('0x0'));var util=require(_0x0b95('0x1'));var logger=require(_0x0b95('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0b95('0x3'));var rp=require(_0x0b95('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0b95('0x5'));var config=require('../../config/environment');var attributes=require(_0x0b95('0x6'));module['exports']=function(_0x5991f5,_0x302608){return _0x5991f5[_0x0b95('0x7')](_0x0b95('0x8'),attributes,{'tableName':_0x0b95('0x9'),'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 d95c947..ff32dcf 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 _0xe2fe=['then','info','Integration,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x2a9f82,_0x5dd010){var _0x3d4ad1=function(_0x2283af){while(--_0x2283af){_0x2a9f82['push'](_0x2a9f82['shift']());}};_0x3d4ad1(++_0x5dd010);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file +var _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','Integration,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x1d128e,_0x2c87de){var _0x3d5236=function(_0x2374ff){while(--_0x2374ff){_0x1d128e['push'](_0x1d128e['shift']());}};_0x3d5236(++_0x2c87de);}(_0x4137,0xf8));var _0x7413=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4137[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('Integration,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 3108327..b7cac05 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 _0x57ca=['create','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x1a249c,_0x481fba){var _0x401cd3=function(_0x436523){while(--_0x436523){_0x1a249c['push'](_0x1a249c['shift']());}};_0x401cd3(++_0x481fba);}(_0x57ca,0x108));var _0xa57c=function(_0x4f85f1,_0x35339d){_0x4f85f1=_0x4f85f1-0x0;var _0x16f6ee=_0x57ca[_0x4f85f1];return _0x16f6ee;};'use strict';var multer=require('multer');var util=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa57c('0x2'));var router=express[_0xa57c('0x3')]();var fs_extra=require(_0xa57c('0x4'));var auth=require(_0xa57c('0x5'));var interaction=require(_0xa57c('0x6'));var config=require('../../config/environment');var controller=require(_0xa57c('0x7'));router[_0xa57c('0x8')]('/',auth[_0xa57c('0x9')](),controller[_0xa57c('0xa')]);router[_0xa57c('0x8')](_0xa57c('0xb'),auth[_0xa57c('0x9')](),controller[_0xa57c('0xc')]);router['get'](_0xa57c('0xd'),auth['isAuthenticated'](),controller[_0xa57c('0xe')]);router[_0xa57c('0xf')]('/',auth['isAuthenticated'](),controller[_0xa57c('0x10')]);router['put'](_0xa57c('0xd'),auth[_0xa57c('0x9')](),controller['update']);router[_0xa57c('0x11')]('/:id',auth[_0xa57c('0x9')](),controller[_0xa57c('0x12')]);module[_0xa57c('0x13')]=router; \ No newline at end of file +var _0x1261=['create','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','index','get','isAuthenticated','describe','/:id','post'];(function(_0x179920,_0x47da64){var _0x3ee39c=function(_0x4ec53f){while(--_0x4ec53f){_0x179920['push'](_0x179920['shift']());}};_0x3ee39c(++_0x47da64);}(_0x1261,0x144));var _0x1126=function(_0x33ad1f,_0xfc2fc8){_0x33ad1f=_0x33ad1f-0x0;var _0x26ef22=_0x1261[_0x33ad1f];return _0x26ef22;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/describe',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['show']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x11')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x12')]);module[_0x1126('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 366b155..f3bdc8f 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 _0x3a07=['ENUM','SENT','SENDING','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0x5da636,_0x91330d){var _0xf4adbc=function(_0x2c72e9){while(--_0x2c72e9){_0x5da636['push'](_0x5da636['shift']());}};_0xf4adbc(++_0x91330d);}(_0x3a07,0xe0));var _0x73a0=function(_0x4e18a9,_0x32ecb7){_0x4e18a9=_0x4e18a9-0x0;var _0x2e30b6=_0x3a07[_0x4e18a9];return _0x2e30b6;};'use strict';var Sequelize=require(_0x73a0('0x0'));module[_0x73a0('0x1')]={'integration':{'type':Sequelize[_0x73a0('0x2')]},'eventChannel':{'type':Sequelize[_0x73a0('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x73a0('0x2')]},'integrationId':{'type':Sequelize[_0x73a0('0x3')]},'contacts':{'type':Sequelize[_0x73a0('0x2')]},'uniqueid':{'type':Sequelize[_0x73a0('0x2')]},'calleridnum':{'type':Sequelize[_0x73a0('0x2')]},'calleridname':{'type':Sequelize[_0x73a0('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x73a0('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x73a0('0x4')]},'agentconnectAt':{'type':Sequelize[_0x73a0('0x4')]},'holdtime':{'type':Sequelize[_0x73a0('0x3')]},'agentcomplete':{'type':Sequelize[_0x73a0('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x73a0('0x4')]},'talktime':{'type':Sequelize[_0x73a0('0x3')]},'agentacw':{'type':Sequelize[_0x73a0('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x73a0('0x3')]},'reason':{'type':Sequelize[_0x73a0('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x73a0('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x73a0('0x4')]},'agentdump':{'type':Sequelize[_0x73a0('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x73a0('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x73a0('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x73a0('0x2')]},'connectedlinename':{'type':Sequelize[_0x73a0('0x2')]},'language':{'type':Sequelize[_0x73a0('0x2')]},'accountcode':{'type':Sequelize[_0x73a0('0x2')]},'context':{'type':Sequelize[_0x73a0('0x2')]},'exten':{'type':Sequelize[_0x73a0('0x2')]},'priority':{'type':Sequelize[_0x73a0('0x2')]},'destchannel':{'type':Sequelize[_0x73a0('0x2')]},'destchannelstate':{'type':Sequelize[_0x73a0('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x73a0('0x2')]},'destcalleridnum':{'type':Sequelize[_0x73a0('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x73a0('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x73a0('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x73a0('0x2')]},'destcontext':{'type':Sequelize[_0x73a0('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x73a0('0x2')]},'destuniqueid':{'type':Sequelize[_0x73a0('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x73a0('0x2')]},'subject':{'type':Sequelize[_0x73a0('0x2')]},'from':{'type':Sequelize[_0x73a0('0x2')]},'to':{'type':Sequelize[_0x73a0('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x73a0('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x73a0('0x7')](_0x73a0('0x8'),_0x73a0('0x9'),'RECEIVED',_0x73a0('0xa'))},'url':{'type':Sequelize[_0x73a0('0x2')]},'app':{'type':Sequelize[_0x73a0('0x2')]},'appdata':{'type':Sequelize[_0x73a0('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x387d=['RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','TEXT','ENUM','SENT'];(function(_0x330960,_0x537c70){var _0x24a2a3=function(_0x12a5aa){while(--_0x12a5aa){_0x330960['push'](_0x330960['shift']());}};_0x24a2a3(++_0x537c70);}(_0x387d,0xd4));var _0xd387=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x387d[_0x173441];return _0x2423a8;};'use strict';var Sequelize=require(_0xd387('0x0'));module[_0xd387('0x1')]={'integration':{'type':Sequelize[_0xd387('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0xd387('0x2')]},'integrationId':{'type':Sequelize[_0xd387('0x3')]},'contacts':{'type':Sequelize[_0xd387('0x2')]},'uniqueid':{'type':Sequelize[_0xd387('0x2')]},'calleridnum':{'type':Sequelize[_0xd387('0x2')]},'calleridname':{'type':Sequelize[_0xd387('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xd387('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xd387('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xd387('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xd387('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xd387('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xd387('0x3')]},'channelstatedesc':{'type':Sequelize[_0xd387('0x2')]},'connectedlinenum':{'type':Sequelize[_0xd387('0x2')]},'connectedlinename':{'type':Sequelize[_0xd387('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xd387('0x2')]},'context':{'type':Sequelize[_0xd387('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd387('0x2')]},'destchannel':{'type':Sequelize[_0xd387('0x2')]},'destchannelstate':{'type':Sequelize[_0xd387('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xd387('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xd387('0x2')]},'destaccountcode':{'type':Sequelize[_0xd387('0x2')]},'destcontext':{'type':Sequelize[_0xd387('0x2')]},'destexten':{'type':Sequelize[_0xd387('0x2')]},'destpriority':{'type':Sequelize[_0xd387('0x2')]},'destuniqueid':{'type':Sequelize[_0xd387('0x2')]},'messageId':{'type':Sequelize[_0xd387('0x2')]},'inReplyTo':{'type':Sequelize[_0xd387('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xd387('0x2')]},'cc':{'type':Sequelize[_0xd387('0x2')]},'attachment':{'type':Sequelize[_0xd387('0x5')]},'html':{'type':Sequelize[_0xd387('0x5')]},'text':{'type':Sequelize[_0xd387('0x5')]},'status':{'type':Sequelize[_0xd387('0x6')](_0xd387('0x7'),'SENDING',_0xd387('0x8'),_0xd387('0x9'))},'url':{'type':Sequelize[_0xd387('0x2')]},'app':{'type':Sequelize[_0xd387('0x2')]},'appdata':{'type':Sequelize[_0xd387('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index a84db58..9b6b063 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 _0xf62f=['describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','name','send','map','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','merge','options','IntegrationReport','includeAll','include','catch','show','params','keys','find','create','body'];(function(_0x494b43,_0x24403e){var _0x588856=function(_0x1e632d){while(--_0x1e632d){_0x494b43['push'](_0x494b43['shift']());}};_0x588856(++_0x24403e);}(_0xf62f,0x178));var _0xff62=function(_0x2df221,_0x20f9f9){_0x2df221=_0x2df221-0x0;var _0x2f11c6=_0xf62f[_0x2df221];return _0x2f11c6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xff62('0x0'));var zipdir=require(_0xff62('0x1'));var jsonpatch=require(_0xff62('0x2'));var rp=require('request-promise');var moment=require(_0xff62('0x3'));var BPromise=require(_0xff62('0x4'));var Mustache=require(_0xff62('0x5'));var util=require('util');var path=require(_0xff62('0x6'));var sox=require(_0xff62('0x7'));var csv=require('to-csv');var ejs=require(_0xff62('0x8'));var fs=require('fs');var fs_extra=require(_0xff62('0x9'));var _=require(_0xff62('0xa'));var squel=require(_0xff62('0xb'));var crypto=require(_0xff62('0xc'));var jsforce=require(_0xff62('0xd'));var deskjs=require(_0xff62('0xe'));var toCsv=require('to-csv');var querystring=require(_0xff62('0xf'));var Papa=require(_0xff62('0x10'));var Redis=require(_0xff62('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xff62('0x12'));var as=require(_0xff62('0x13'));var hardwareService=require(_0xff62('0x14'));var logger=require(_0xff62('0x15'))(_0xff62('0x16'));var utils=require(_0xff62('0x17'));var config=require(_0xff62('0x18'));var licenseUtil=require(_0xff62('0x19'));var db=require(_0xff62('0x1a'))['db'];function respondWithStatusCode(_0x1d1fc2,_0x35cdcf){_0x35cdcf=_0x35cdcf||0xcc;return function(_0xb39ab4){if(_0xb39ab4){return _0x1d1fc2[_0xff62('0x1b')](_0x35cdcf);}return _0x1d1fc2[_0xff62('0x1c')](_0x35cdcf)[_0xff62('0x1d')]();};}function respondWithResult(_0x34bc10,_0x325361){_0x325361=_0x325361||0xc8;return function(_0x15ff7a){if(_0x15ff7a){return _0x34bc10[_0xff62('0x1c')](_0x325361)[_0xff62('0x1e')](_0x15ff7a);}};}function respondWithFilteredResult(_0x28aa3b,_0x3df540){return function(_0x317440){if(_0x317440){var _0x28933e=typeof _0x3df540[_0xff62('0x1f')]==='undefined'&&typeof _0x3df540[_0xff62('0x20')]===_0xff62('0x21');var _0x39d839=_0x317440[_0xff62('0x22')];var _0x4d6952=_0x28933e?0x0:_0x3df540[_0xff62('0x1f')];var _0x23ee8f=_0x28933e?_0x317440[_0xff62('0x22')]:_0x3df540[_0xff62('0x1f')]+_0x3df540[_0xff62('0x20')];var _0x2864c0;if(_0x23ee8f>=_0x39d839){_0x23ee8f=_0x39d839;_0x2864c0=0xc8;}else{_0x2864c0=0xce;}_0x28aa3b[_0xff62('0x1c')](_0x2864c0);return _0x28aa3b[_0xff62('0x23')](_0xff62('0x24'),_0x4d6952+'-'+_0x23ee8f+'/'+_0x39d839)[_0xff62('0x1e')](_0x317440);}return null;};}function patchUpdates(_0x2ebe00){return function(_0x1fb689){try{jsonpatch['apply'](_0x1fb689,_0x2ebe00,!![]);}catch(_0x335f6b){return BPromise[_0xff62('0x25')](_0x335f6b);}return _0x1fb689[_0xff62('0x26')]();};}function saveUpdates(_0x159f3a,_0x54ce97){return function(_0x18315c){if(_0x18315c){return _0x18315c[_0xff62('0x27')](_0x159f3a)[_0xff62('0x28')](function(_0x33b25b){return _0x33b25b;});}return null;};}function removeEntity(_0x38865c,_0x2e99fb){return function(_0x5ea6fc){if(_0x5ea6fc){return _0x5ea6fc[_0xff62('0x29')]()['then'](function(){_0x38865c[_0xff62('0x1c')](0xcc)[_0xff62('0x1d')]();});}};}function handleEntityNotFound(_0x36429e,_0x293499){return function(_0x2bec9b){if(!_0x2bec9b){_0x36429e[_0xff62('0x1b')](0x194);}return _0x2bec9b;};}function handleError(_0x31b34b,_0x192b34){_0x192b34=_0x192b34||0x1f4;return function(_0x5c4b3b){logger[_0xff62('0x2a')](_0x5c4b3b['stack']);if(_0x5c4b3b['name']){delete _0x5c4b3b[_0xff62('0x2b')];}_0x31b34b[_0xff62('0x1c')](_0x192b34)[_0xff62('0x2c')](_0x5c4b3b);};}exports['index']=function(_0x303d0c,_0x27a9a0){var _0x400ab5={},_0x1f6a92={},_0x4c24b2={'count':0x0,'rows':[]};var _0x50f2cc=_[_0xff62('0x2d')](db['IntegrationReport'][_0xff62('0x2e')],function(_0x539f35){return{'name':_0x539f35[_0xff62('0x2f')],'type':_0x539f35[_0xff62('0x30')]['key']};});_0x1f6a92['model']=_[_0xff62('0x2d')](_0x50f2cc,'name');_0x1f6a92[_0xff62('0x31')]=_['keys'](_0x303d0c[_0xff62('0x31')]);_0x1f6a92[_0xff62('0x32')]=_[_0xff62('0x33')](_0x1f6a92[_0xff62('0x34')],_0x1f6a92[_0xff62('0x31')]);_0x400ab5[_0xff62('0x35')]=_[_0xff62('0x33')](_0x1f6a92[_0xff62('0x34')],qs['fields'](_0x303d0c[_0xff62('0x31')][_0xff62('0x36')]));_0x400ab5['attributes']=_0x400ab5[_0xff62('0x35')][_0xff62('0x37')]?_0x400ab5['attributes']:_0x1f6a92[_0xff62('0x34')];if(!_0x303d0c[_0xff62('0x31')][_0xff62('0x38')]('nolimit')){_0x400ab5['limit']=qs[_0xff62('0x20')](_0x303d0c[_0xff62('0x31')]['limit']);_0x400ab5['offset']=qs[_0xff62('0x1f')](_0x303d0c[_0xff62('0x31')]['offset']);}_0x400ab5[_0xff62('0x39')]=qs[_0xff62('0x3a')](_0x303d0c['query']['sort']);_0x400ab5[_0xff62('0x3b')]=qs[_0xff62('0x32')](_[_0xff62('0x3c')](_0x303d0c[_0xff62('0x31')],_0x1f6a92[_0xff62('0x32')]),_0x50f2cc);if(_0x303d0c[_0xff62('0x31')]['filter']){_0x400ab5[_0xff62('0x3b')]=_['merge'](_0x400ab5['where'],{'$or':_[_0xff62('0x2d')](_0x50f2cc,function(_0x554888){if(_0x554888[_0xff62('0x30')]!==_0xff62('0x3d')){var _0x302f0a={};_0x302f0a[_0x554888[_0xff62('0x2b')]]={'$like':'%'+_0x303d0c['query']['filter']+'%'};return _0x302f0a;}})});}_0x400ab5=_[_0xff62('0x3e')]({},_0x400ab5,_0x303d0c[_0xff62('0x3f')]);var _0x3ed72e={'where':_0x400ab5[_0xff62('0x3b')]};return db[_0xff62('0x40')][_0xff62('0x22')](_0x3ed72e)['then'](function(_0x733381){_0x4c24b2[_0xff62('0x22')]=_0x733381;if(_0x303d0c['query'][_0xff62('0x41')]){_0x400ab5[_0xff62('0x42')]=[{'all':!![]}];}return db[_0xff62('0x40')]['findAll'](_0x400ab5);})['then'](function(_0x5af4b2){_0x4c24b2['rows']=_0x5af4b2;return _0x4c24b2;})[_0xff62('0x28')](respondWithFilteredResult(_0x27a9a0,_0x400ab5))[_0xff62('0x43')](handleError(_0x27a9a0,null));};exports[_0xff62('0x44')]=function(_0x2ca0a7,_0x251e71){var _0x3f7e79={'raw':![],'where':{'id':_0x2ca0a7[_0xff62('0x45')]['id']}},_0x4f363e={};_0x4f363e[_0xff62('0x34')]=_[_0xff62('0x46')](db[_0xff62('0x40')]['rawAttributes']);_0x4f363e['query']=_['keys'](_0x2ca0a7[_0xff62('0x31')]);_0x4f363e['filters']=_[_0xff62('0x33')](_0x4f363e['model'],_0x4f363e['query']);_0x3f7e79['attributes']=_[_0xff62('0x33')](_0x4f363e['model'],qs[_0xff62('0x36')](_0x2ca0a7[_0xff62('0x31')][_0xff62('0x36')]));_0x3f7e79[_0xff62('0x35')]=_0x3f7e79[_0xff62('0x35')][_0xff62('0x37')]?_0x3f7e79['attributes']:_0x4f363e['model'];if(_0x2ca0a7['query'][_0xff62('0x41')]){_0x3f7e79[_0xff62('0x42')]=[{'all':!![]}];}_0x3f7e79=_[_0xff62('0x3e')]({},_0x3f7e79,_0x2ca0a7[_0xff62('0x3f')]);return db[_0xff62('0x40')][_0xff62('0x47')](_0x3f7e79)[_0xff62('0x28')](handleEntityNotFound(_0x251e71,null))[_0xff62('0x28')](respondWithResult(_0x251e71,null))['catch'](handleError(_0x251e71,null));};exports['create']=function(_0x46b75a,_0x531b6a){return db[_0xff62('0x40')][_0xff62('0x48')](_0x46b75a['body'],{})[_0xff62('0x28')](respondWithResult(_0x531b6a,0xc9))['catch'](handleError(_0x531b6a,null));};exports[_0xff62('0x27')]=function(_0x7173a3,_0x577f34){if(_0x7173a3['body']['id']){delete _0x7173a3[_0xff62('0x49')]['id'];}return db[_0xff62('0x40')][_0xff62('0x47')]({'where':{'id':_0x7173a3['params']['id']}})[_0xff62('0x28')](handleEntityNotFound(_0x577f34,null))[_0xff62('0x28')](saveUpdates(_0x7173a3[_0xff62('0x49')],null))['then'](respondWithResult(_0x577f34,null))[_0xff62('0x43')](handleError(_0x577f34,null));};exports['destroy']=function(_0x20f6d5,_0x3c244c){return db[_0xff62('0x40')][_0xff62('0x47')]({'where':{'id':_0x20f6d5[_0xff62('0x45')]['id']}})[_0xff62('0x28')](handleEntityNotFound(_0x3c244c,null))[_0xff62('0x28')](removeEntity(_0x3c244c,null))[_0xff62('0x43')](handleError(_0x3c244c,null));};exports['describe']=function(_0x5aca18,_0x4c9103){return db[_0xff62('0x40')][_0xff62('0x4a')]()[_0xff62('0x28')](respondWithResult(_0x4c9103,null))[_0xff62('0x43')](handleError(_0x4c9103,null));}; \ No newline at end of file +var _0x0b07=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','intersection','create','update','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','IntegrationReport','fieldName','type','filters','model','query'];(function(_0x413727,_0x17adb1){var _0x5f46d7=function(_0xbb668e){while(--_0xbb668e){_0x413727['push'](_0x413727['shift']());}};_0x5f46d7(++_0x17adb1);}(_0x0b07,0xb5));var _0x70b0=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x0b07[_0x616290];return _0x453879;};'use strict';var emlformat=require(_0x70b0('0x0'));var rimraf=require(_0x70b0('0x1'));var zipdir=require(_0x70b0('0x2'));var jsonpatch=require(_0x70b0('0x3'));var rp=require(_0x70b0('0x4'));var moment=require('moment');var BPromise=require(_0x70b0('0x5'));var Mustache=require('mustache');var util=require(_0x70b0('0x6'));var path=require('path');var sox=require(_0x70b0('0x7'));var csv=require(_0x70b0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x70b0('0x9'));var _=require(_0x70b0('0xa'));var squel=require(_0x70b0('0xb'));var crypto=require(_0x70b0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x70b0('0xd'));var toCsv=require(_0x70b0('0x8'));var querystring=require('querystring');var Papa=require(_0x70b0('0xe'));var Redis=require('ioredis');var authService=require(_0x70b0('0xf'));var qs=require(_0x70b0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x70b0('0x11'));var logger=require(_0x70b0('0x12'))(_0x70b0('0x13'));var utils=require(_0x70b0('0x14'));var config=require(_0x70b0('0x15'));var licenseUtil=require(_0x70b0('0x16'));var db=require(_0x70b0('0x17'))['db'];function respondWithStatusCode(_0x43fc50,_0x3ce99a){_0x3ce99a=_0x3ce99a||0xcc;return function(_0xd5d0ad){if(_0xd5d0ad){return _0x43fc50[_0x70b0('0x18')](_0x3ce99a);}return _0x43fc50['status'](_0x3ce99a)[_0x70b0('0x19')]();};}function respondWithResult(_0x57f635,_0x34f65c){_0x34f65c=_0x34f65c||0xc8;return function(_0x5a1995){if(_0x5a1995){return _0x57f635[_0x70b0('0x1a')](_0x34f65c)[_0x70b0('0x1b')](_0x5a1995);}};}function respondWithFilteredResult(_0xe5e135,_0x38eb23){return function(_0x281d77){if(_0x281d77){var _0x1df346=typeof _0x38eb23[_0x70b0('0x1c')]===_0x70b0('0x1d')&&typeof _0x38eb23[_0x70b0('0x1e')]===_0x70b0('0x1d');var _0x9cc9cf=_0x281d77[_0x70b0('0x1f')];var _0x39222c=_0x1df346?0x0:_0x38eb23[_0x70b0('0x1c')];var _0x3df646=_0x1df346?_0x281d77[_0x70b0('0x1f')]:_0x38eb23[_0x70b0('0x1c')]+_0x38eb23['limit'];var _0x4ad10e;if(_0x3df646>=_0x9cc9cf){_0x3df646=_0x9cc9cf;_0x4ad10e=0xc8;}else{_0x4ad10e=0xce;}_0xe5e135[_0x70b0('0x1a')](_0x4ad10e);return _0xe5e135[_0x70b0('0x20')](_0x70b0('0x21'),_0x39222c+'-'+_0x3df646+'/'+_0x9cc9cf)[_0x70b0('0x1b')](_0x281d77);}return null;};}function patchUpdates(_0x5cfd4b){return function(_0x222567){try{jsonpatch[_0x70b0('0x22')](_0x222567,_0x5cfd4b,!![]);}catch(_0x3e2fe1){return BPromise[_0x70b0('0x23')](_0x3e2fe1);}return _0x222567[_0x70b0('0x24')]();};}function saveUpdates(_0x288c27,_0x14f9c6){return function(_0x12694b){if(_0x12694b){return _0x12694b['update'](_0x288c27)[_0x70b0('0x25')](function(_0x214d6b){return _0x214d6b;});}return null;};}function removeEntity(_0x14f548,_0x730df5){return function(_0x3485a7){if(_0x3485a7){return _0x3485a7[_0x70b0('0x26')]()[_0x70b0('0x25')](function(){_0x14f548[_0x70b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x627774,_0xd04433){return function(_0x557e3f){if(!_0x557e3f){_0x627774[_0x70b0('0x18')](0x194);}return _0x557e3f;};}function handleError(_0x35be10,_0x6cce31){_0x6cce31=_0x6cce31||0x1f4;return function(_0x5b8d44){logger[_0x70b0('0x27')](_0x5b8d44[_0x70b0('0x28')]);if(_0x5b8d44[_0x70b0('0x29')]){delete _0x5b8d44['name'];}_0x35be10[_0x70b0('0x1a')](_0x6cce31)[_0x70b0('0x2a')](_0x5b8d44);};}exports['index']=function(_0x2e1fb0,_0x3cc81c){var _0x2f7566={},_0x3a9403={},_0x2216d3={'count':0x0,'rows':[]};var _0x4974f2=_[_0x70b0('0x2b')](db[_0x70b0('0x2c')]['rawAttributes'],function(_0x32cca1){return{'name':_0x32cca1[_0x70b0('0x2d')],'type':_0x32cca1[_0x70b0('0x2e')]['key']};});_0x3a9403['model']=_[_0x70b0('0x2b')](_0x4974f2,'name');_0x3a9403['query']=_['keys'](_0x2e1fb0['query']);_0x3a9403[_0x70b0('0x2f')]=_['intersection'](_0x3a9403[_0x70b0('0x30')],_0x3a9403[_0x70b0('0x31')]);_0x2f7566['attributes']=_['intersection'](_0x3a9403[_0x70b0('0x30')],qs[_0x70b0('0x32')](_0x2e1fb0['query'][_0x70b0('0x32')]));_0x2f7566[_0x70b0('0x33')]=_0x2f7566[_0x70b0('0x33')][_0x70b0('0x34')]?_0x2f7566[_0x70b0('0x33')]:_0x3a9403['model'];if(!_0x2e1fb0[_0x70b0('0x31')][_0x70b0('0x35')](_0x70b0('0x36'))){_0x2f7566['limit']=qs['limit'](_0x2e1fb0[_0x70b0('0x31')][_0x70b0('0x1e')]);_0x2f7566[_0x70b0('0x1c')]=qs[_0x70b0('0x1c')](_0x2e1fb0[_0x70b0('0x31')][_0x70b0('0x1c')]);}_0x2f7566[_0x70b0('0x37')]=qs[_0x70b0('0x38')](_0x2e1fb0[_0x70b0('0x31')][_0x70b0('0x38')]);_0x2f7566[_0x70b0('0x39')]=qs[_0x70b0('0x2f')](_[_0x70b0('0x3a')](_0x2e1fb0[_0x70b0('0x31')],_0x3a9403[_0x70b0('0x2f')]),_0x4974f2);if(_0x2e1fb0[_0x70b0('0x31')][_0x70b0('0x3b')]){_0x2f7566[_0x70b0('0x39')]=_[_0x70b0('0x3c')](_0x2f7566[_0x70b0('0x39')],{'$or':_['map'](_0x4974f2,function(_0x46081d){if(_0x46081d[_0x70b0('0x2e')]!=='VIRTUAL'){var _0x3b5611={};_0x3b5611[_0x46081d[_0x70b0('0x29')]]={'$like':'%'+_0x2e1fb0[_0x70b0('0x31')]['filter']+'%'};return _0x3b5611;}})});}_0x2f7566=_[_0x70b0('0x3c')]({},_0x2f7566,_0x2e1fb0[_0x70b0('0x3d')]);var _0x267084={'where':_0x2f7566[_0x70b0('0x39')]};return db[_0x70b0('0x2c')]['count'](_0x267084)[_0x70b0('0x25')](function(_0x127da9){_0x2216d3['count']=_0x127da9;if(_0x2e1fb0[_0x70b0('0x31')][_0x70b0('0x3e')]){_0x2f7566[_0x70b0('0x3f')]=[{'all':!![]}];}return db[_0x70b0('0x2c')][_0x70b0('0x40')](_0x2f7566);})[_0x70b0('0x25')](function(_0x49fdaa){_0x2216d3[_0x70b0('0x41')]=_0x49fdaa;return _0x2216d3;})[_0x70b0('0x25')](respondWithFilteredResult(_0x3cc81c,_0x2f7566))[_0x70b0('0x42')](handleError(_0x3cc81c,null));};exports[_0x70b0('0x43')]=function(_0x1c99b9,_0x529160){var _0x324733={'raw':![],'where':{'id':_0x1c99b9[_0x70b0('0x44')]['id']}},_0x210c73={};_0x210c73[_0x70b0('0x30')]=_[_0x70b0('0x45')](db['IntegrationReport'][_0x70b0('0x46')]);_0x210c73[_0x70b0('0x31')]=_[_0x70b0('0x45')](_0x1c99b9['query']);_0x210c73['filters']=_[_0x70b0('0x47')](_0x210c73[_0x70b0('0x30')],_0x210c73[_0x70b0('0x31')]);_0x324733[_0x70b0('0x33')]=_[_0x70b0('0x47')](_0x210c73['model'],qs[_0x70b0('0x32')](_0x1c99b9[_0x70b0('0x31')][_0x70b0('0x32')]));_0x324733[_0x70b0('0x33')]=_0x324733['attributes']['length']?_0x324733['attributes']:_0x210c73[_0x70b0('0x30')];if(_0x1c99b9['query'][_0x70b0('0x3e')]){_0x324733[_0x70b0('0x3f')]=[{'all':!![]}];}_0x324733=_[_0x70b0('0x3c')]({},_0x324733,_0x1c99b9['options']);return db[_0x70b0('0x2c')]['find'](_0x324733)[_0x70b0('0x25')](handleEntityNotFound(_0x529160,null))[_0x70b0('0x25')](respondWithResult(_0x529160,null))[_0x70b0('0x42')](handleError(_0x529160,null));};exports['create']=function(_0x3a3ba5,_0x390920){return db[_0x70b0('0x2c')][_0x70b0('0x48')](_0x3a3ba5['body'],{})[_0x70b0('0x25')](respondWithResult(_0x390920,0xc9))[_0x70b0('0x42')](handleError(_0x390920,null));};exports[_0x70b0('0x49')]=function(_0x5a572a,_0x1fb873){if(_0x5a572a['body']['id']){delete _0x5a572a[_0x70b0('0x4a')]['id'];}return db[_0x70b0('0x2c')][_0x70b0('0x4b')]({'where':{'id':_0x5a572a[_0x70b0('0x44')]['id']}})[_0x70b0('0x25')](handleEntityNotFound(_0x1fb873,null))[_0x70b0('0x25')](saveUpdates(_0x5a572a[_0x70b0('0x4a')],null))[_0x70b0('0x25')](respondWithResult(_0x1fb873,null))[_0x70b0('0x42')](handleError(_0x1fb873,null));};exports[_0x70b0('0x26')]=function(_0xa91d96,_0xf8e3c4){return db['IntegrationReport']['find']({'where':{'id':_0xa91d96[_0x70b0('0x44')]['id']}})[_0x70b0('0x25')](handleEntityNotFound(_0xf8e3c4,null))[_0x70b0('0x25')](removeEntity(_0xf8e3c4,null))['catch'](handleError(_0xf8e3c4,null));};exports[_0x70b0('0x4c')]=function(_0xadafcd,_0x382ab3){return db[_0x70b0('0x2c')][_0x70b0('0x4c')]()[_0x70b0('0x25')](respondWithResult(_0x382ab3,null))[_0x70b0('0x42')](handleError(_0x382ab3,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 3d27a80..6010594 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 _0xa0bb=['IntegrationReport','report_integration','util','../../config/logger','api','bluebird','../../config/environment','./integrationReport.attributes','exports','define'];(function(_0xb68772,_0x5253ac){var _0x4189bb=function(_0x1b0cf3){while(--_0x1b0cf3){_0xb68772['push'](_0xb68772['shift']());}};_0x4189bb(++_0x5253ac);}(_0xa0bb,0x1c4));var _0xba0b=function(_0x2a59b9,_0x1e0e9c){_0x2a59b9=_0x2a59b9-0x0;var _0x24cf4f=_0xa0bb[_0x2a59b9];return _0x24cf4f;};'use strict';var _=require('lodash');var util=require(_0xba0b('0x0'));var logger=require(_0xba0b('0x1'))(_0xba0b('0x2'));var moment=require('moment');var BPromise=require(_0xba0b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xba0b('0x4'));var attributes=require(_0xba0b('0x5'));module[_0xba0b('0x6')]=function(_0x164208,_0x3717a5){return _0x164208[_0xba0b('0x7')](_0xba0b('0x8'),attributes,{'tableName':_0xba0b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa837=['moment','bluebird','request-promise','rimraf','./integrationReport.attributes','IntegrationReport','report_integration','util'];(function(_0x11129b,_0x1713fd){var _0x43fe39=function(_0x4334e3){while(--_0x4334e3){_0x11129b['push'](_0x11129b['shift']());}};_0x43fe39(++_0x1713fd);}(_0xa837,0xb7));var _0x7a83=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa837[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x7a83('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x7a83('0x1'));var BPromise=require(_0x7a83('0x2'));var rp=require(_0x7a83('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7a83('0x4'));var config=require('../../config/environment');var attributes=require(_0x7a83('0x5'));module['exports']=function(_0x133a12,_0x52d572){return _0x133a12['define'](_0x7a83('0x6'),attributes,{'tableName':_0x7a83('0x7'),'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 f29b310..60dc745 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 _0xc2c7=['../../config/logger','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xc2c7,0x134));var _0x7c2c=function(_0x354f81,_0x4cb8bb){_0x354f81=_0x354f81-0x0;var _0x5d2262=_0xc2c7[_0x354f81];return _0x5d2262;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});} \ No newline at end of file +var _0xba34=['../../config/environment','jayson/promise','client','http','request','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','randomstring','../../config/logger','rpc'];(function(_0xe4c1fe,_0x349e2f){var _0x656756=function(_0x4922a7){while(--_0x4922a7){_0xe4c1fe['push'](_0xe4c1fe['shift']());}};_0x656756(++_0x349e2f);}(_0xba34,0x119));var _0x4ba3=function(_0x3aa1ae,_0x459174){_0x3aa1ae=_0x3aa1ae-0x0;var _0x5ba44a=_0xba34[_0x3aa1ae];return _0x5ba44a;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f99a,_0x585f2d,_0x6254fb){return new BPromise(function(_0x368eee,_0x2df7f3){return client[_0x4ba3('0xb')](_0xe5f99a,_0x6254fb)[_0x4ba3('0xc')](function(_0xcf1ec3){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0x585f2d,'request\x20sent',JSON[_0x4ba3('0x12')](_0xcf1ec3));if(_0xcf1ec3[_0x4ba3('0x13')]){if(_0xcf1ec3['error'][_0x4ba3('0x14')]===0x1f4){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3['error'][_0x4ba3('0x15')]);return _0x2df7f3(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}logger[_0x4ba3('0x13')](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);return _0x368eee(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}else{logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));_0x368eee(_0xcf1ec3[_0x4ba3('0x16')][_0x4ba3('0x15')]);}})[_0x4ba3('0x17')](function(_0x1b7776){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0x1b7776);_0x2df7f3(_0x1b7776);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 1e300b9..3f9bad9 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 _0x3157=['getIntervals','create','post','addInterval','/:id/sub_intervals/create_many','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/sub_intervals'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x3157,0x198));var _0x7315=function(_0x5c26f3,_0x6fa62c){_0x5c26f3=_0x5c26f3-0x0;var _0x1b02eb=_0x3157[_0x5c26f3];return _0x1b02eb;};'use strict';var multer=require(_0x7315('0x0'));var util=require(_0x7315('0x1'));var path=require(_0x7315('0x2'));var timeout=require(_0x7315('0x3'));var express=require('express');var router=express[_0x7315('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7315('0x5'));var interaction=require(_0x7315('0x6'));var config=require('../../config/environment');var controller=require('./interval.controller');router[_0x7315('0x7')]('/',auth[_0x7315('0x8')](),controller[_0x7315('0x9')]);router['get'](_0x7315('0xa'),auth[_0x7315('0x8')](),controller['show']);router[_0x7315('0x7')](_0x7315('0xb'),auth[_0x7315('0x8')](),controller[_0x7315('0xc')]);router['post']('/',auth[_0x7315('0x8')](),controller[_0x7315('0xd')]);router[_0x7315('0xe')](_0x7315('0xb'),auth['isAuthenticated'](),controller[_0x7315('0xf')]);router[_0x7315('0xe')](_0x7315('0x10'),auth[_0x7315('0x8')](),controller['addIntervals']);router[_0x7315('0x11')](_0x7315('0xa'),auth[_0x7315('0x8')](),controller[_0x7315('0x12')]);router[_0x7315('0x13')](_0x7315('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x7315('0x14')]=router; \ No newline at end of file +var _0x8917=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','isAuthenticated','index','get','/:id','show','/:id/sub_intervals','getIntervals','post','create','addInterval','addIntervals','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x3fb166,_0x4eb985){var _0x5e91be=function(_0x53f4d9){while(--_0x53f4d9){_0x3fb166['push'](_0x3fb166['shift']());}};_0x5e91be(++_0x4eb985);}(_0x8917,0x1d7));var _0x7891=function(_0x11cebb,_0x35fb57){_0x11cebb=_0x11cebb-0x0;var _0x59f302=_0x8917[_0x11cebb];return _0x59f302;};'use strict';var multer=require(_0x7891('0x0'));var util=require('util');var path=require(_0x7891('0x1'));var timeout=require(_0x7891('0x2'));var express=require(_0x7891('0x3'));var router=express[_0x7891('0x4')]();var fs_extra=require(_0x7891('0x5'));var auth=require(_0x7891('0x6'));var interaction=require(_0x7891('0x7'));var config=require(_0x7891('0x8'));var controller=require(_0x7891('0x9'));router['get']('/',auth[_0x7891('0xa')](),controller[_0x7891('0xb')]);router[_0x7891('0xc')](_0x7891('0xd'),auth[_0x7891('0xa')](),controller[_0x7891('0xe')]);router['get'](_0x7891('0xf'),auth['isAuthenticated'](),controller[_0x7891('0x10')]);router[_0x7891('0x11')]('/',auth[_0x7891('0xa')](),controller[_0x7891('0x12')]);router[_0x7891('0x11')]('/:id/sub_intervals',auth[_0x7891('0xa')](),controller[_0x7891('0x13')]);router[_0x7891('0x11')]('/:id/sub_intervals/create_many',auth[_0x7891('0xa')](),controller[_0x7891('0x14')]);router[_0x7891('0x15')](_0x7891('0xd'),auth[_0x7891('0xa')](),controller['update']);router[_0x7891('0x16')](_0x7891('0xd'),auth[_0x7891('0xa')](),controller[_0x7891('0x17')]);module[_0x7891('0x18')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 3defcaa..62af027 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 _0xc301=['exports','STRING','sequelize'];(function(_0x5de027,_0x30c2f1){var _0x371b0c=function(_0x8a33e9){while(--_0x8a33e9){_0x5de027['push'](_0x5de027['shift']());}};_0x371b0c(++_0x30c2f1);}(_0xc301,0x1d9));var _0x1c30=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xc301[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x1c30('0x0'));module[_0x1c30('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1c30('0x2')]},'interval':{'type':Sequelize[_0x1c30('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x2af1=['sequelize','STRING'];(function(_0x1dc10e,_0x54cf82){var _0x31b3d6=function(_0xb8431d){while(--_0xb8431d){_0x1dc10e['push'](_0x1dc10e['shift']());}};_0x31b3d6(++_0x54cf82);}(_0x2af1,0x6a));var _0x12af=function(_0xbc2856,_0x9ad6a1){_0xbc2856=_0xbc2856-0x0;var _0x25ff6b=_0x2af1[_0xbc2856];return _0x25ff6b;};'use strict';var Sequelize=require(_0x12af('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x12af('0x1')]},'interval':{'type':Sequelize[_0x12af('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index aa8f84c..e55b60a 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 _0x020b=['filter','where','merge','options','include','rows','catch','params','find','create','body','user','get','role','userProfileId','autoAssociation','error','update','addInterval','IntervalId','getIntervals','order','addIntervals','findOne','sequelize','bulkCreate','findAll','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','end','offset','undefined','count','limit','set','json','apply','reject','save','destroy','then','sendStatus','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick'];(function(_0x422f31,_0x516691){var _0x4fe56d=function(_0x3a5e1c){while(--_0x3a5e1c){_0x422f31['push'](_0x422f31['shift']());}};_0x4fe56d(++_0x516691);}(_0x020b,0xc5));var _0xb020=function(_0x3a1691,_0x3d7fb2){_0x3a1691=_0x3a1691-0x0;var _0x534fc5=_0x020b[_0x3a1691];return _0x534fc5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb020('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb020('0x1'));var rp=require(_0xb020('0x2'));var moment=require(_0xb020('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb020('0x4'));var path=require(_0xb020('0x5'));var sox=require(_0xb020('0x6'));var csv=require(_0xb020('0x7'));var ejs=require(_0xb020('0x8'));var fs=require('fs');var fs_extra=require(_0xb020('0x9'));var _=require('lodash');var squel=require(_0xb020('0xa'));var crypto=require('crypto');var jsforce=require(_0xb020('0xb'));var deskjs=require(_0xb020('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb020('0xd'));var Redis=require(_0xb020('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb020('0xf'));var as=require(_0xb020('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb020('0x11'))(_0xb020('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb020('0x13'));var db=require(_0xb020('0x14'))['db'];var extensions=require(_0xb020('0x15'));function respondWithStatusCode(_0x1b3670,_0x1bd072){_0x1bd072=_0x1bd072||0xcc;return function(_0x21b3c1){if(_0x21b3c1){return _0x1b3670['sendStatus'](_0x1bd072);}return _0x1b3670[_0xb020('0x16')](_0x1bd072)[_0xb020('0x17')]();};}function respondWithResult(_0x47cc4d,_0x43fe4a){_0x43fe4a=_0x43fe4a||0xc8;return function(_0x2a8e19){if(_0x2a8e19){return _0x47cc4d[_0xb020('0x16')](_0x43fe4a)['json'](_0x2a8e19);}};}function respondWithFilteredResult(_0x24d6d8,_0x32c485){return function(_0x37aab5){if(_0x37aab5){var _0xd45d35=typeof _0x32c485[_0xb020('0x18')]===_0xb020('0x19')&&typeof _0x32c485['limit']===_0xb020('0x19');var _0x29a2c2=_0x37aab5[_0xb020('0x1a')];var _0x44cdb7=_0xd45d35?0x0:_0x32c485[_0xb020('0x18')];var _0x1d884e=_0xd45d35?_0x37aab5['count']:_0x32c485['offset']+_0x32c485[_0xb020('0x1b')];var _0x44945c;if(_0x1d884e>=_0x29a2c2){_0x1d884e=_0x29a2c2;_0x44945c=0xc8;}else{_0x44945c=0xce;}_0x24d6d8[_0xb020('0x16')](_0x44945c);return _0x24d6d8[_0xb020('0x1c')]('Content-Range',_0x44cdb7+'-'+_0x1d884e+'/'+_0x29a2c2)[_0xb020('0x1d')](_0x37aab5);}return null;};}function patchUpdates(_0x21750d){return function(_0x35e82b){try{jsonpatch[_0xb020('0x1e')](_0x35e82b,_0x21750d,!![]);}catch(_0x39cdcb){return BPromise[_0xb020('0x1f')](_0x39cdcb);}return _0x35e82b[_0xb020('0x20')]();};}function saveUpdates(_0x5de9f8,_0x416e48){return function(_0x320e12){if(_0x320e12){return _0x320e12['update'](_0x5de9f8)['then'](function(_0x850c94){return _0x850c94;});}return null;};}function removeEntity(_0x30ae19,_0x46b7e9){return function(_0x497a12){if(_0x497a12){return _0x497a12[_0xb020('0x21')]()['then'](function(){var _0x58a696=_0x497a12['get']({'plain':!![]});var _0x177d15='Intervals';return db['UserProfileResource']['destroy']({'where':{'type':_0x177d15,'resourceId':_0x58a696['id']}})[_0xb020('0x22')](function(){return _0x497a12;});})[_0xb020('0x22')](function(){_0x30ae19['status'](0xcc)[_0xb020('0x17')]();});}};}function handleEntityNotFound(_0x53a40b,_0x47d193){return function(_0x21a977){if(!_0x21a977){_0x53a40b[_0xb020('0x23')](0x194);}return _0x21a977;};}function handleError(_0x5893b4,_0x400c25){_0x400c25=_0x400c25||0x1f4;return function(_0x449817){logger['error'](_0x449817[_0xb020('0x24')]);if(_0x449817[_0xb020('0x25')]){delete _0x449817[_0xb020('0x25')];}_0x5893b4[_0xb020('0x16')](_0x400c25)[_0xb020('0x26')](_0x449817);};}exports[_0xb020('0x27')]=function(_0x198aab,_0x584b83){var _0x2e781b={},_0x2546c6={},_0x176dfc={'count':0x0,'rows':[]};var _0xc62c95=_[_0xb020('0x28')](db[_0xb020('0x29')][_0xb020('0x2a')],function(_0x7bc54e){return{'name':_0x7bc54e[_0xb020('0x2b')],'type':_0x7bc54e[_0xb020('0x2c')][_0xb020('0x2d')]};});_0x2546c6[_0xb020('0x2e')]=_['map'](_0xc62c95,_0xb020('0x25'));_0x2546c6['query']=_[_0xb020('0x2f')](_0x198aab[_0xb020('0x30')]);_0x2546c6[_0xb020('0x31')]=_[_0xb020('0x32')](_0x2546c6[_0xb020('0x2e')],_0x2546c6['query']);_0x2e781b[_0xb020('0x33')]=_[_0xb020('0x32')](_0x2546c6[_0xb020('0x2e')],qs[_0xb020('0x34')](_0x198aab[_0xb020('0x30')][_0xb020('0x34')]));_0x2e781b[_0xb020('0x33')]=_0x2e781b[_0xb020('0x33')][_0xb020('0x35')]?_0x2e781b[_0xb020('0x33')]:_0x2546c6['model'];if(!_0x198aab[_0xb020('0x30')][_0xb020('0x36')](_0xb020('0x37'))){_0x2e781b[_0xb020('0x1b')]=qs[_0xb020('0x1b')](_0x198aab[_0xb020('0x30')][_0xb020('0x1b')]);_0x2e781b[_0xb020('0x18')]=qs[_0xb020('0x18')](_0x198aab[_0xb020('0x30')][_0xb020('0x18')]);}_0x2e781b['order']=qs[_0xb020('0x38')](_0x198aab[_0xb020('0x30')][_0xb020('0x38')]);_0x2e781b['where']=qs[_0xb020('0x31')](_[_0xb020('0x39')](_0x198aab['query'],_0x2546c6['filters']),_0xc62c95);if(_0x198aab[_0xb020('0x30')][_0xb020('0x3a')]){_0x2e781b[_0xb020('0x3b')]=_[_0xb020('0x3c')](_0x2e781b[_0xb020('0x3b')],{'$or':_['map'](_0xc62c95,function(_0xbd8e2e){if(_0xbd8e2e[_0xb020('0x2c')]!=='VIRTUAL'){var _0x5d0805={};_0x5d0805[_0xbd8e2e['name']]={'$like':'%'+_0x198aab['query'][_0xb020('0x3a')]+'%'};return _0x5d0805;}})});}_0x2e781b=_[_0xb020('0x3c')]({},_0x2e781b,_0x198aab[_0xb020('0x3d')]);var _0x2c6d84={'where':_0x2e781b[_0xb020('0x3b')]};return db[_0xb020('0x29')][_0xb020('0x1a')](_0x2c6d84)['then'](function(_0xd9920b){_0x176dfc[_0xb020('0x1a')]=_0xd9920b;if(_0x198aab[_0xb020('0x30')]['includeAll']){_0x2e781b[_0xb020('0x3e')]=[{'all':!![]}];}return db['Interval']['findAll'](_0x2e781b);})['then'](function(_0xe9bfa2){_0x176dfc[_0xb020('0x3f')]=_0xe9bfa2;return _0x176dfc;})[_0xb020('0x22')](respondWithFilteredResult(_0x584b83,_0x2e781b))[_0xb020('0x40')](handleError(_0x584b83,null));};exports['show']=function(_0x28007b,_0x45209d){var _0x3cf7c5={'raw':!![],'where':{'id':_0x28007b[_0xb020('0x41')]['id']}},_0x36befb={};_0x36befb[_0xb020('0x2e')]=_['keys'](db['Interval'][_0xb020('0x2a')]);_0x36befb[_0xb020('0x30')]=_[_0xb020('0x2f')](_0x28007b[_0xb020('0x30')]);_0x36befb[_0xb020('0x31')]=_['intersection'](_0x36befb['model'],_0x36befb[_0xb020('0x30')]);_0x3cf7c5['attributes']=_[_0xb020('0x32')](_0x36befb[_0xb020('0x2e')],qs[_0xb020('0x34')](_0x28007b[_0xb020('0x30')][_0xb020('0x34')]));_0x3cf7c5[_0xb020('0x33')]=_0x3cf7c5[_0xb020('0x33')][_0xb020('0x35')]?_0x3cf7c5['attributes']:_0x36befb[_0xb020('0x2e')];if(_0x28007b[_0xb020('0x30')]['includeAll']){_0x3cf7c5[_0xb020('0x3e')]=[{'all':!![]}];}_0x3cf7c5=_['merge']({},_0x3cf7c5,_0x28007b[_0xb020('0x3d')]);return db[_0xb020('0x29')][_0xb020('0x42')](_0x3cf7c5)['then'](handleEntityNotFound(_0x45209d,null))['then'](respondWithResult(_0x45209d,null))[_0xb020('0x40')](handleError(_0x45209d,null));};exports[_0xb020('0x43')]=function(_0x4b2b54,_0x85294b){return db[_0xb020('0x29')][_0xb020('0x43')](_0x4b2b54[_0xb020('0x44')],{})[_0xb020('0x22')](function(_0x5fe7bf){var _0x2d9aec=_0x4b2b54[_0xb020('0x45')][_0xb020('0x46')]({'plain':!![]});if(!_0x2d9aec)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d9aec[_0xb020('0x47')]===_0xb020('0x45')){var _0x1efd15=_0x5fe7bf['get']({'plain':!![]});var _0x35cf5a='Intervals';return db['UserProfileSection']['find']({'where':{'name':_0x35cf5a,'userProfileId':_0x2d9aec[_0xb020('0x48')]},'raw':!![]})[_0xb020('0x22')](function(_0x5abf20){if(_0x5abf20&&_0x5abf20[_0xb020('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0x1efd15['name'],'resourceId':_0x1efd15['id'],'type':_0x5abf20[_0xb020('0x25')],'sectionId':_0x5abf20['id']},{})[_0xb020('0x22')](function(){return _0x5fe7bf;});}else{return _0x5fe7bf;}})[_0xb020('0x40')](function(_0x6da39){logger[_0xb020('0x4a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x6da39);throw _0x6da39;});}return _0x5fe7bf;})['then'](respondWithResult(_0x85294b,0xc9))['catch'](handleError(_0x85294b,null));};exports[_0xb020('0x4b')]=function(_0x3b210b,_0xedbe18){if(_0x3b210b[_0xb020('0x44')]['id']){delete _0x3b210b[_0xb020('0x44')]['id'];}return db[_0xb020('0x29')][_0xb020('0x42')]({'where':{'id':_0x3b210b[_0xb020('0x41')]['id']}})[_0xb020('0x22')](handleEntityNotFound(_0xedbe18,null))[_0xb020('0x22')](saveUpdates(_0x3b210b['body'],null))[_0xb020('0x22')](respondWithResult(_0xedbe18,null))[_0xb020('0x40')](handleError(_0xedbe18,null));};exports[_0xb020('0x21')]=function(_0x41999c,_0x3d5bbf){return db[_0xb020('0x29')][_0xb020('0x42')]({'where':{'id':_0x41999c[_0xb020('0x41')]['id']}})[_0xb020('0x22')](handleEntityNotFound(_0x3d5bbf,null))[_0xb020('0x22')](removeEntity(_0x3d5bbf,null))['catch'](handleError(_0x3d5bbf,null));};exports[_0xb020('0x4c')]=function(_0x1a6ab6,_0x333bc7,_0x484f74){if(_0x1a6ab6[_0xb020('0x44')]['id']){delete _0x1a6ab6[_0xb020('0x44')]['id'];}return db[_0xb020('0x29')][_0xb020('0x42')]({'where':{'id':_0x1a6ab6[_0xb020('0x41')]['id']}})['then'](handleEntityNotFound(_0x333bc7,null))[_0xb020('0x22')](function(_0x115a72){if(_0x115a72){_0x1a6ab6[_0xb020('0x44')][_0xb020('0x4d')]=_0x115a72['id'];return db[_0xb020('0x29')][_0xb020('0x43')](_0x1a6ab6['body']);}})['then'](respondWithResult(_0x333bc7,null))[_0xb020('0x40')](handleError(_0x333bc7,null));};exports[_0xb020('0x4e')]=function(_0x5e36db,_0x59aed8,_0x3ae3cf){var _0x4a2998={};var _0x379167={};var _0x5c70ef;var _0x1393cf;return db[_0xb020('0x29')]['findOne']({'where':{'id':_0x5e36db[_0xb020('0x41')]['id']}})['then'](handleEntityNotFound(_0x59aed8,null))[_0xb020('0x22')](function(_0x1e7392){if(_0x1e7392){_0x5c70ef=_0x1e7392;_0x379167[_0xb020('0x2e')]=_['keys'](db[_0xb020('0x29')][_0xb020('0x2a')]);_0x379167[_0xb020('0x30')]=_['keys'](_0x5e36db['query']);_0x379167[_0xb020('0x31')]=_[_0xb020('0x32')](_0x379167['model'],_0x379167[_0xb020('0x30')]);_0x4a2998['attributes']=_['intersection'](_0x379167[_0xb020('0x2e')],qs[_0xb020('0x34')](_0x5e36db[_0xb020('0x30')][_0xb020('0x34')]));_0x4a2998[_0xb020('0x33')]=_0x4a2998['attributes'][_0xb020('0x35')]?_0x4a2998[_0xb020('0x33')]:_0x379167[_0xb020('0x2e')];_0x4a2998[_0xb020('0x4f')]=qs[_0xb020('0x38')](_0x5e36db[_0xb020('0x30')][_0xb020('0x38')]);_0x4a2998[_0xb020('0x3b')]=qs['filters'](_[_0xb020('0x39')](_0x5e36db['query'],_0x379167[_0xb020('0x31')]));if(_0x5e36db[_0xb020('0x30')][_0xb020('0x3a')]){_0x4a2998['where']=_['merge'](_0x4a2998[_0xb020('0x3b')],{'$or':_[_0xb020('0x28')](_0x4a2998[_0xb020('0x33')],function(_0x4ada89){var _0x43edf3={};_0x43edf3[_0x4ada89]={'$like':'%'+_0x5e36db[_0xb020('0x30')][_0xb020('0x3a')]+'%'};return _0x43edf3;})});}_0x4a2998=_[_0xb020('0x3c')]({},_0x4a2998,_0x5e36db['options']);return _0x5c70ef['getIntervals'](_0x4a2998);}})['then'](function(_0x3a092c){if(_0x3a092c){_0x1393cf=_0x3a092c[_0xb020('0x35')];if(!_0x5e36db[_0xb020('0x30')][_0xb020('0x36')](_0xb020('0x37'))){_0x4a2998[_0xb020('0x1b')]=qs[_0xb020('0x1b')](_0x5e36db['query'][_0xb020('0x1b')]);_0x4a2998[_0xb020('0x18')]=qs[_0xb020('0x18')](_0x5e36db['query'][_0xb020('0x18')]);}return _0x5c70ef[_0xb020('0x4e')](_0x4a2998);}})[_0xb020('0x22')](function(_0x2cdb91){if(_0x2cdb91){return _0x2cdb91?{'count':_0x1393cf,'rows':_0x2cdb91}:null;}})[_0xb020('0x22')](respondWithResult(_0x59aed8,null))[_0xb020('0x40')](handleError(_0x59aed8,null));};exports[_0xb020('0x50')]=function(_0x2cf8f7,_0x55ff58,_0x5a22e5){return db['Interval'][_0xb020('0x51')]({'where':{'id':_0x2cf8f7[_0xb020('0x41')]['id']}})[_0xb020('0x22')](handleEntityNotFound(_0x55ff58,null))[_0xb020('0x22')](function(_0x223a3e){if(_0x223a3e){return db[_0xb020('0x52')]['transaction'](function(_0x523891){return db['Interval'][_0xb020('0x21')]({'where':{'IntervalId':_0x2cf8f7[_0xb020('0x41')]['id']},'transaction':_0x523891})[_0xb020('0x22')](function(_0x2ad2e3){var _0x3fff34=_[_0xb020('0x28')](_0x2cf8f7[_0xb020('0x44')],function(_0x57a344){delete _0x57a344['id'];_0x57a344[_0xb020('0x4d')]=_0x2cf8f7['params']['id'];return _0x57a344;});return db[_0xb020('0x29')][_0xb020('0x53')](_0x3fff34,{'transaction':_0x523891});});})[_0xb020('0x22')](function(){return db[_0xb020('0x29')][_0xb020('0x54')]({'where':{'IntervalId':_0x2cf8f7['params']['id']}});});}})['then'](respondWithResult(_0x55ff58,null))[_0xb020('0x40')](handleError(_0x55ff58,null));}; \ No newline at end of file +var _0xe22c=['count','set','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','Interval','include','findAll','rows','catch','show','includeAll','user','UserProfileSection','find','userProfileId','autoAssociation','create','body','params','IntervalId','getIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','status','json','offset','undefined','limit'];(function(_0x5d4a4e,_0x3bad07){var _0x5d28db=function(_0x542fe5){while(--_0x542fe5){_0x5d4a4e['push'](_0x5d4a4e['shift']());}};_0x5d28db(++_0x3bad07);}(_0xe22c,0x92));var _0xce22=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe22c[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0xce22('0x0'));var rimraf=require(_0xce22('0x1'));var zipdir=require(_0xce22('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xce22('0x3'));var moment=require(_0xce22('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xce22('0x5'));var util=require(_0xce22('0x6'));var path=require(_0xce22('0x7'));var sox=require(_0xce22('0x8'));var csv=require(_0xce22('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xce22('0xa'));var _=require('lodash');var squel=require(_0xce22('0xb'));var crypto=require(_0xce22('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xce22('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xce22('0xe'));var Redis=require('ioredis');var authService=require(_0xce22('0xf'));var qs=require(_0xce22('0x10'));var as=require(_0xce22('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xce22('0x12'))(_0xce22('0x13'));var utils=require(_0xce22('0x14'));var config=require(_0xce22('0x15'));var licenseUtil=require(_0xce22('0x16'));var db=require(_0xce22('0x17'))['db'];var extensions=require(_0xce22('0x18'));function respondWithStatusCode(_0x44c610,_0x309bbc){_0x309bbc=_0x309bbc||0xcc;return function(_0x4336b1){if(_0x4336b1){return _0x44c610[_0xce22('0x19')](_0x309bbc);}return _0x44c610['status'](_0x309bbc)[_0xce22('0x1a')]();};}function respondWithResult(_0x3afce4,_0x513c10){_0x513c10=_0x513c10||0xc8;return function(_0xf08378){if(_0xf08378){return _0x3afce4[_0xce22('0x1b')](_0x513c10)[_0xce22('0x1c')](_0xf08378);}};}function respondWithFilteredResult(_0x26d07a,_0x1397b3){return function(_0x3b15ec){if(_0x3b15ec){var _0x266917=typeof _0x1397b3[_0xce22('0x1d')]===_0xce22('0x1e')&&typeof _0x1397b3[_0xce22('0x1f')]===_0xce22('0x1e');var _0x39b8a4=_0x3b15ec[_0xce22('0x20')];var _0x40d317=_0x266917?0x0:_0x1397b3[_0xce22('0x1d')];var _0x11efe9=_0x266917?_0x3b15ec['count']:_0x1397b3[_0xce22('0x1d')]+_0x1397b3[_0xce22('0x1f')];var _0x1cf5ba;if(_0x11efe9>=_0x39b8a4){_0x11efe9=_0x39b8a4;_0x1cf5ba=0xc8;}else{_0x1cf5ba=0xce;}_0x26d07a[_0xce22('0x1b')](_0x1cf5ba);return _0x26d07a[_0xce22('0x21')](_0xce22('0x22'),_0x40d317+'-'+_0x11efe9+'/'+_0x39b8a4)['json'](_0x3b15ec);}return null;};}function patchUpdates(_0x4bec77){return function(_0x586343){try{jsonpatch[_0xce22('0x23')](_0x586343,_0x4bec77,!![]);}catch(_0x8f631e){return BPromise[_0xce22('0x24')](_0x8f631e);}return _0x586343[_0xce22('0x25')]();};}function saveUpdates(_0x17af5d,_0x332a74){return function(_0x3e8994){if(_0x3e8994){return _0x3e8994[_0xce22('0x26')](_0x17af5d)[_0xce22('0x27')](function(_0x153e0f){return _0x153e0f;});}return null;};}function removeEntity(_0x129eee,_0x127e41){return function(_0x61c61d){if(_0x61c61d){return _0x61c61d[_0xce22('0x28')]()[_0xce22('0x27')](function(){var _0xe3c0b1=_0x61c61d[_0xce22('0x29')]({'plain':!![]});var _0x2de694=_0xce22('0x2a');return db[_0xce22('0x2b')][_0xce22('0x28')]({'where':{'type':_0x2de694,'resourceId':_0xe3c0b1['id']}})[_0xce22('0x27')](function(){return _0x61c61d;});})[_0xce22('0x27')](function(){_0x129eee[_0xce22('0x1b')](0xcc)[_0xce22('0x1a')]();});}};}function handleEntityNotFound(_0x1a3385,_0xdbba53){return function(_0x1c18ca){if(!_0x1c18ca){_0x1a3385[_0xce22('0x19')](0x194);}return _0x1c18ca;};}function handleError(_0x334108,_0x2b03e8){_0x2b03e8=_0x2b03e8||0x1f4;return function(_0x5aba26){logger[_0xce22('0x2c')](_0x5aba26[_0xce22('0x2d')]);if(_0x5aba26[_0xce22('0x2e')]){delete _0x5aba26[_0xce22('0x2e')];}_0x334108[_0xce22('0x1b')](_0x2b03e8)['send'](_0x5aba26);};}exports[_0xce22('0x2f')]=function(_0x487f2b,_0x1edeee){var _0x19721a={},_0x383d68={},_0x23ad24={'count':0x0,'rows':[]};var _0x30c626=_[_0xce22('0x30')](db['Interval'][_0xce22('0x31')],function(_0x4ea12e){return{'name':_0x4ea12e['fieldName'],'type':_0x4ea12e[_0xce22('0x32')][_0xce22('0x33')]};});_0x383d68[_0xce22('0x34')]=_[_0xce22('0x30')](_0x30c626,'name');_0x383d68[_0xce22('0x35')]=_[_0xce22('0x36')](_0x487f2b[_0xce22('0x35')]);_0x383d68[_0xce22('0x37')]=_[_0xce22('0x38')](_0x383d68[_0xce22('0x34')],_0x383d68[_0xce22('0x35')]);_0x19721a[_0xce22('0x39')]=_[_0xce22('0x38')](_0x383d68[_0xce22('0x34')],qs[_0xce22('0x3a')](_0x487f2b[_0xce22('0x35')]['fields']));_0x19721a[_0xce22('0x39')]=_0x19721a[_0xce22('0x39')][_0xce22('0x3b')]?_0x19721a[_0xce22('0x39')]:_0x383d68[_0xce22('0x34')];if(!_0x487f2b[_0xce22('0x35')][_0xce22('0x3c')](_0xce22('0x3d'))){_0x19721a[_0xce22('0x1f')]=qs[_0xce22('0x1f')](_0x487f2b[_0xce22('0x35')][_0xce22('0x1f')]);_0x19721a[_0xce22('0x1d')]=qs['offset'](_0x487f2b[_0xce22('0x35')]['offset']);}_0x19721a[_0xce22('0x3e')]=qs[_0xce22('0x3f')](_0x487f2b[_0xce22('0x35')]['sort']);_0x19721a['where']=qs['filters'](_[_0xce22('0x40')](_0x487f2b[_0xce22('0x35')],_0x383d68[_0xce22('0x37')]),_0x30c626);if(_0x487f2b[_0xce22('0x35')][_0xce22('0x41')]){_0x19721a['where']=_[_0xce22('0x42')](_0x19721a[_0xce22('0x43')],{'$or':_['map'](_0x30c626,function(_0x2b0a8d){if(_0x2b0a8d[_0xce22('0x32')]!=='VIRTUAL'){var _0xfaaf25={};_0xfaaf25[_0x2b0a8d[_0xce22('0x2e')]]={'$like':'%'+_0x487f2b[_0xce22('0x35')][_0xce22('0x41')]+'%'};return _0xfaaf25;}})});}_0x19721a=_['merge']({},_0x19721a,_0x487f2b[_0xce22('0x44')]);var _0x4259b6={'where':_0x19721a[_0xce22('0x43')]};return db[_0xce22('0x45')][_0xce22('0x20')](_0x4259b6)['then'](function(_0x2fa342){_0x23ad24['count']=_0x2fa342;if(_0x487f2b['query']['includeAll']){_0x19721a[_0xce22('0x46')]=[{'all':!![]}];}return db[_0xce22('0x45')][_0xce22('0x47')](_0x19721a);})['then'](function(_0x11eee9){_0x23ad24[_0xce22('0x48')]=_0x11eee9;return _0x23ad24;})[_0xce22('0x27')](respondWithFilteredResult(_0x1edeee,_0x19721a))[_0xce22('0x49')](handleError(_0x1edeee,null));};exports[_0xce22('0x4a')]=function(_0x44bbec,_0x4cf840){var _0x3a945d={'raw':!![],'where':{'id':_0x44bbec['params']['id']}},_0xcdcc69={};_0xcdcc69[_0xce22('0x34')]=_[_0xce22('0x36')](db[_0xce22('0x45')][_0xce22('0x31')]);_0xcdcc69['query']=_[_0xce22('0x36')](_0x44bbec['query']);_0xcdcc69['filters']=_['intersection'](_0xcdcc69[_0xce22('0x34')],_0xcdcc69[_0xce22('0x35')]);_0x3a945d[_0xce22('0x39')]=_[_0xce22('0x38')](_0xcdcc69[_0xce22('0x34')],qs['fields'](_0x44bbec[_0xce22('0x35')][_0xce22('0x3a')]));_0x3a945d[_0xce22('0x39')]=_0x3a945d[_0xce22('0x39')]['length']?_0x3a945d[_0xce22('0x39')]:_0xcdcc69[_0xce22('0x34')];if(_0x44bbec[_0xce22('0x35')][_0xce22('0x4b')]){_0x3a945d[_0xce22('0x46')]=[{'all':!![]}];}_0x3a945d=_[_0xce22('0x42')]({},_0x3a945d,_0x44bbec[_0xce22('0x44')]);return db[_0xce22('0x45')]['find'](_0x3a945d)[_0xce22('0x27')](handleEntityNotFound(_0x4cf840,null))[_0xce22('0x27')](respondWithResult(_0x4cf840,null))['catch'](handleError(_0x4cf840,null));};exports['create']=function(_0x4e3b90,_0x37336a){return db[_0xce22('0x45')]['create'](_0x4e3b90['body'],{})['then'](function(_0x1bedd6){var _0x5b343f=_0x4e3b90[_0xce22('0x4c')][_0xce22('0x29')]({'plain':!![]});if(!_0x5b343f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b343f['role']==='user'){var _0x2625cc=_0x1bedd6[_0xce22('0x29')]({'plain':!![]});var _0x1b3e4a=_0xce22('0x2a');return db[_0xce22('0x4d')][_0xce22('0x4e')]({'where':{'name':_0x1b3e4a,'userProfileId':_0x5b343f[_0xce22('0x4f')]},'raw':!![]})[_0xce22('0x27')](function(_0x56b11d){if(_0x56b11d&&_0x56b11d[_0xce22('0x50')]===0x0){return db[_0xce22('0x2b')][_0xce22('0x51')]({'name':_0x2625cc['name'],'resourceId':_0x2625cc['id'],'type':_0x56b11d[_0xce22('0x2e')],'sectionId':_0x56b11d['id']},{})[_0xce22('0x27')](function(){return _0x1bedd6;});}else{return _0x1bedd6;}})[_0xce22('0x49')](function(_0x33b008){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33b008);throw _0x33b008;});}return _0x1bedd6;})['then'](respondWithResult(_0x37336a,0xc9))[_0xce22('0x49')](handleError(_0x37336a,null));};exports[_0xce22('0x26')]=function(_0x16d80c,_0x2772e3){if(_0x16d80c[_0xce22('0x52')]['id']){delete _0x16d80c[_0xce22('0x52')]['id'];}return db[_0xce22('0x45')][_0xce22('0x4e')]({'where':{'id':_0x16d80c[_0xce22('0x53')]['id']}})[_0xce22('0x27')](handleEntityNotFound(_0x2772e3,null))['then'](saveUpdates(_0x16d80c['body'],null))[_0xce22('0x27')](respondWithResult(_0x2772e3,null))[_0xce22('0x49')](handleError(_0x2772e3,null));};exports['destroy']=function(_0x1daff2,_0x43f3f6){return db[_0xce22('0x45')][_0xce22('0x4e')]({'where':{'id':_0x1daff2[_0xce22('0x53')]['id']}})['then'](handleEntityNotFound(_0x43f3f6,null))[_0xce22('0x27')](removeEntity(_0x43f3f6,null))[_0xce22('0x49')](handleError(_0x43f3f6,null));};exports['addInterval']=function(_0x4f87d0,_0xb3c56a,_0x31edad){if(_0x4f87d0[_0xce22('0x52')]['id']){delete _0x4f87d0[_0xce22('0x52')]['id'];}return db[_0xce22('0x45')][_0xce22('0x4e')]({'where':{'id':_0x4f87d0[_0xce22('0x53')]['id']}})[_0xce22('0x27')](handleEntityNotFound(_0xb3c56a,null))[_0xce22('0x27')](function(_0x18c61d){if(_0x18c61d){_0x4f87d0[_0xce22('0x52')][_0xce22('0x54')]=_0x18c61d['id'];return db[_0xce22('0x45')]['create'](_0x4f87d0['body']);}})[_0xce22('0x27')](respondWithResult(_0xb3c56a,null))['catch'](handleError(_0xb3c56a,null));};exports[_0xce22('0x55')]=function(_0x6fe022,_0x1fef1d,_0x462fcc){var _0x3bfa04={};var _0x326745={};var _0x4a28cf;var _0x3bcd26;return db[_0xce22('0x45')]['findOne']({'where':{'id':_0x6fe022[_0xce22('0x53')]['id']}})[_0xce22('0x27')](handleEntityNotFound(_0x1fef1d,null))[_0xce22('0x27')](function(_0x2ed03c){if(_0x2ed03c){_0x4a28cf=_0x2ed03c;_0x326745[_0xce22('0x34')]=_[_0xce22('0x36')](db[_0xce22('0x45')]['rawAttributes']);_0x326745['query']=_[_0xce22('0x36')](_0x6fe022[_0xce22('0x35')]);_0x326745['filters']=_[_0xce22('0x38')](_0x326745[_0xce22('0x34')],_0x326745[_0xce22('0x35')]);_0x3bfa04[_0xce22('0x39')]=_[_0xce22('0x38')](_0x326745['model'],qs[_0xce22('0x3a')](_0x6fe022[_0xce22('0x35')][_0xce22('0x3a')]));_0x3bfa04[_0xce22('0x39')]=_0x3bfa04[_0xce22('0x39')][_0xce22('0x3b')]?_0x3bfa04['attributes']:_0x326745[_0xce22('0x34')];_0x3bfa04['order']=qs[_0xce22('0x3f')](_0x6fe022[_0xce22('0x35')][_0xce22('0x3f')]);_0x3bfa04[_0xce22('0x43')]=qs[_0xce22('0x37')](_[_0xce22('0x40')](_0x6fe022[_0xce22('0x35')],_0x326745[_0xce22('0x37')]));if(_0x6fe022[_0xce22('0x35')][_0xce22('0x41')]){_0x3bfa04[_0xce22('0x43')]=_[_0xce22('0x42')](_0x3bfa04[_0xce22('0x43')],{'$or':_[_0xce22('0x30')](_0x3bfa04[_0xce22('0x39')],function(_0x415ed1){var _0x948c22={};_0x948c22[_0x415ed1]={'$like':'%'+_0x6fe022['query'][_0xce22('0x41')]+'%'};return _0x948c22;})});}_0x3bfa04=_['merge']({},_0x3bfa04,_0x6fe022[_0xce22('0x44')]);return _0x4a28cf[_0xce22('0x55')](_0x3bfa04);}})[_0xce22('0x27')](function(_0x2204f2){if(_0x2204f2){_0x3bcd26=_0x2204f2['length'];if(!_0x6fe022[_0xce22('0x35')][_0xce22('0x3c')]('nolimit')){_0x3bfa04[_0xce22('0x1f')]=qs[_0xce22('0x1f')](_0x6fe022[_0xce22('0x35')][_0xce22('0x1f')]);_0x3bfa04[_0xce22('0x1d')]=qs[_0xce22('0x1d')](_0x6fe022[_0xce22('0x35')]['offset']);}return _0x4a28cf[_0xce22('0x55')](_0x3bfa04);}})[_0xce22('0x27')](function(_0x2b67ba){if(_0x2b67ba){return _0x2b67ba?{'count':_0x3bcd26,'rows':_0x2b67ba}:null;}})[_0xce22('0x27')](respondWithResult(_0x1fef1d,null))[_0xce22('0x49')](handleError(_0x1fef1d,null));};exports['addIntervals']=function(_0x1f119a,_0x3653d1,_0x4318a1){return db['Interval']['findOne']({'where':{'id':_0x1f119a['params']['id']}})[_0xce22('0x27')](handleEntityNotFound(_0x3653d1,null))[_0xce22('0x27')](function(_0x2327f1){if(_0x2327f1){return db[_0xce22('0x56')][_0xce22('0x57')](function(_0x476c45){return db[_0xce22('0x45')][_0xce22('0x28')]({'where':{'IntervalId':_0x1f119a['params']['id']},'transaction':_0x476c45})[_0xce22('0x27')](function(_0x1fa02c){var _0x1918a4=_[_0xce22('0x30')](_0x1f119a[_0xce22('0x52')],function(_0x6c3bd4){delete _0x6c3bd4['id'];_0x6c3bd4[_0xce22('0x54')]=_0x1f119a[_0xce22('0x53')]['id'];return _0x6c3bd4;});return db[_0xce22('0x45')][_0xce22('0x58')](_0x1918a4,{'transaction':_0x476c45});});})[_0xce22('0x27')](function(){return db[_0xce22('0x45')][_0xce22('0x47')]({'where':{'IntervalId':_0x1f119a[_0xce22('0x53')]['id']}});});}})[_0xce22('0x27')](respondWithResult(_0x3653d1,null))[_0xce22('0x49')](handleError(_0x3653d1,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index ad40bce..de3994e 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 _0xc4f8=['util','../../config/logger','api','request-promise','../../config/environment','exports','define','rewrite','lodash'];(function(_0x540dcb,_0x4eacb6){var _0x49353c=function(_0x449bb1){while(--_0x449bb1){_0x540dcb['push'](_0x540dcb['shift']());}};_0x49353c(++_0x4eacb6);}(_0xc4f8,0x8f));var _0x8c4f=function(_0x34b506,_0xcd4019){_0x34b506=_0x34b506-0x0;var _0xef70cc=_0xc4f8[_0x34b506];return _0xef70cc;};'use strict';var _=require(_0x8c4f('0x0'));var util=require(_0x8c4f('0x1'));var logger=require(_0x8c4f('0x2'))(_0x8c4f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8c4f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8c4f('0x5'));var attributes=require('./interval.attributes');var extensions=require('../../components/extensions/rewrite');module[_0x8c4f('0x6')]=function(_0x186eb6,_0x1afb67){return _0x186eb6[_0x8c4f('0x7')]('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1bfb9d,_0x5c3f18){extensions[_0x8c4f('0x8')](_0x186eb6,_0x1bfb9d);},'afterBulkCreate':function(_0x30a1dc,_0x367b87,_0x55b762){_0x55b762();extensions[_0x8c4f('0x8')](_0x186eb6,_0x30a1dc[0x0]);},'afterUpdate':function(_0x30a1a9,_0x159d6c){extensions[_0x8c4f('0x8')](_0x186eb6,_0x30a1a9);},'afterDestroy':function(_0x21146d,_0x4ced2d){extensions[_0x8c4f('0x8')](_0x186eb6,_0x21146d);}}});}; \ No newline at end of file +var _0x3be2=['rewrite','lodash','../../config/logger','api','bluebird','request-promise','../../config/environment','./interval.attributes','../../components/extensions/rewrite','define','Interval','tools_intervals'];(function(_0x25acd0,_0x500a45){var _0x2e6786=function(_0x385c40){while(--_0x385c40){_0x25acd0['push'](_0x25acd0['shift']());}};_0x2e6786(++_0x500a45);}(_0x3be2,0x18d));var _0x23be=function(_0x3ac193,_0x329cd1){_0x3ac193=_0x3ac193-0x0;var _0xf05937=_0x3be2[_0x3ac193];return _0xf05937;};'use strict';var _=require(_0x23be('0x0'));var util=require('util');var logger=require(_0x23be('0x1'))(_0x23be('0x2'));var moment=require('moment');var BPromise=require(_0x23be('0x3'));var rp=require(_0x23be('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x23be('0x5'));var attributes=require(_0x23be('0x6'));var extensions=require(_0x23be('0x7'));module['exports']=function(_0x6d7e2a,_0x42a8b4){return _0x6d7e2a[_0x23be('0x8')](_0x23be('0x9'),attributes,{'tableName':_0x23be('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3163de,_0x57e4d6){extensions[_0x23be('0xb')](_0x6d7e2a,_0x3163de);},'afterBulkCreate':function(_0x5cc3b0,_0x38019c,_0x1dc476){_0x1dc476();extensions['rewrite'](_0x6d7e2a,_0x5cc3b0[0x0]);},'afterUpdate':function(_0x5cc1e1,_0x322630){extensions[_0x23be('0xb')](_0x6d7e2a,_0x5cc1e1);},'afterDestroy':function(_0x3f30a5,_0xa71454){extensions[_0x23be('0xb')](_0x6d7e2a,_0x3f30a5);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index f6da5f9..482181f 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 _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x5400b,_0x55943a){var _0x36a39b=function(_0x56963c){while(--_0x56963c){_0x5400b['push'](_0x5400b['shift']());}};_0x36a39b(++_0x55943a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x19d350,_0x3c843f){var _0x3bfc8d=function(_0xd89003){while(--_0xd89003){_0x19d350['push'](_0x19d350['shift']());}};_0x3bfc8d(++_0x3c843f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 5d72c3a..da4f612 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x5c06a9,_0x5e7c35){var _0x44643f=function(_0x2075ff){while(--_0x2075ff){_0x5c06a9['push'](_0x5c06a9['shift']());}};_0x44643f(++_0x5e7c35);}(_0x2032,0xd9));var _0x2203=function(_0x457c17,_0x3b19d8){_0x457c17=_0x457c17-0x0;var _0x240e62=_0x2032[_0x457c17];return _0x240e62;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file +var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x40df5f,_0x8fd59f){_0x40df5f=_0x40df5f-0x0;var _0x1573f1=_0x0b0e[_0x40df5f];return _0x1573f1;};'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 9738013..63189f2 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 _0xa99e=['utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','body','headers','x-forwarded-for','connection','remoteAddress','socket','https','../../config/logger','api','key','MOTGUI','summary','Report','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','application/json','Basic\x20','toString','base64','request'];(function(_0xfbccab,_0x2d6979){var _0x473665=function(_0x2ed640){while(--_0x2ed640){_0xfbccab['push'](_0xfbccab['shift']());}};_0x473665(++_0x2d6979);}(_0xa99e,0xed));var _0xea99=function(_0x5c1a8d,_0x2fee45){_0x5c1a8d=_0x5c1a8d-0x0;var _0xda1a1e=_0xa99e[_0x5c1a8d];return _0xda1a1e;};'use strict';var BPromise=require('bluebird');var https=require(_0xea99('0x0'));var logger=require(_0xea99('0x1'))(_0xea99('0x2'));var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x2775a8,_0x431192){var _0x32f544={'fields':{'project':{'key':_0x2775a8[_0xea99('0x3')]||_0xea99('0x4')},'summary':(_0x2775a8[_0xea99('0x5')]||_0xea99('0x6'))+'\x20from\x20'+_0x2775a8['ip'],'description':_0x2775a8['description']||JSON[_0xea99('0x7')](_0x2775a8),'issuetype':{'name':_0x2775a8[_0xea99('0x8')]||_0xea99('0x9')}}};_0x32f544[_0xea99('0xa')][_0xea99('0xb')]=_0x2775a8[_0xea99('0xc')];_0x32f544['fields'][_0xea99('0xd')]=_0x2775a8['oldToken'];_0x32f544['fields'][_0xea99('0xe')]=_0x2775a8[_0xea99('0xf')];_0x32f544['fields'][_0xea99('0x10')]=_0x2775a8[_0xea99('0x11')];_0x32f544[_0xea99('0xa')][_0xea99('0x12')]=_0x2775a8[_0xea99('0x13')];_0x32f544[_0xea99('0xa')][_0xea99('0x14')]=_0x2775a8['ip'];var _0x3f1677={'host':_0xea99('0x15'),'port':0x1bb,'path':'/rest/api/2/issue','method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0xea99('0x16'),'Authorization':_0xea99('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0xea99('0x18')](_0xea99('0x19'))}};var _0x43b137=JSON[_0xea99('0x7')](_0x32f544);var _0x3e89fa=https[_0xea99('0x1a')](_0x3f1677,function(_0x2d23fe){_0x2d23fe['setEncoding'](_0xea99('0x1b'));var _0x1feed6='';_0x2d23fe['on'](_0xea99('0x1c'),function(_0x17d4cb){_0x1feed6+=_0x17d4cb;});_0x2d23fe['on'](_0xea99('0x1d'),function(){if(_0x431192){return _0x431192[_0xea99('0x1e')](_0x2d23fe[_0xea99('0x1f')])[_0xea99('0x20')](JSON[_0xea99('0x21')](_0x1feed6));}});});_0x3e89fa['on'](_0xea99('0x22'),function(_0x3447b5){if(_0x431192){return _0x431192[_0xea99('0x1e')](0x1f4)[_0xea99('0x20')]({'errors':[{'message':_0xea99('0x23'),'type':'api.jira'}]});}});_0x3e89fa[_0xea99('0x24')](_0x43b137);_0x3e89fa[_0xea99('0x1d')]();}exports[_0xea99('0x25')]=openIssue;exports['send']=function(_0x51f1bd,_0x2ebd86){_0x51f1bd[_0xea99('0x26')]['ip']=_0x51f1bd[_0xea99('0x27')][_0xea99('0x28')]||_0x51f1bd[_0xea99('0x29')][_0xea99('0x2a')]||_0x51f1bd[_0xea99('0x2b')][_0xea99('0x2a')]||_0x51f1bd[_0xea99('0x29')][_0xea99('0x2b')][_0xea99('0x2a')];return openIssue(_0x51f1bd[_0xea99('0x26')],_0x2ebd86);}; \ No newline at end of file +var _0xffb1=['parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','openIssue','send','body','headers','x-forwarded-for','socket','remoteAddress','connection','bluebird','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','\x20from\x20','stringify','Bug','email','fields','oldToken','newToken','customfield_11503','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','base64','request','setEncoding','utf8','data','status','statusCode','json'];(function(_0x623e7,_0x1bef7d){var _0x121131=function(_0x59b734){while(--_0x59b734){_0x623e7['push'](_0x623e7['shift']());}};_0x121131(++_0x1bef7d);}(_0xffb1,0x92));var _0x1ffb=function(_0xfb42e6,_0x5f5d4b){_0xfb42e6=_0xfb42e6-0x0;var _0x27265b=_0xffb1[_0xfb42e6];return _0x27265b;};'use strict';var BPromise=require(_0x1ffb('0x0'));var https=require('https');var logger=require(_0x1ffb('0x1'))(_0x1ffb('0x2'));var USERNAME=_0x1ffb('0x3');var PASSWORD=_0x1ffb('0x4');function openIssue(_0x3bb754,_0x5b939c){var _0x3edc2e={'fields':{'project':{'key':_0x3bb754[_0x1ffb('0x5')]||_0x1ffb('0x6')},'summary':(_0x3bb754[_0x1ffb('0x7')]||'Report')+_0x1ffb('0x8')+_0x3bb754['ip'],'description':_0x3bb754['description']||JSON[_0x1ffb('0x9')](_0x3bb754),'issuetype':{'name':_0x3bb754['issuetype']||_0x1ffb('0xa')}}};_0x3edc2e['fields']['customfield_11500']=_0x3bb754[_0x1ffb('0xb')];_0x3edc2e[_0x1ffb('0xc')]['customfield_11501']=_0x3bb754[_0x1ffb('0xd')];_0x3edc2e[_0x1ffb('0xc')]['customfield_11502']=_0x3bb754[_0x1ffb('0xe')];_0x3edc2e[_0x1ffb('0xc')][_0x1ffb('0xf')]=_0x3bb754['name'];_0x3edc2e[_0x1ffb('0xc')]['customfield_11504']=_0x3bb754[_0x1ffb('0x10')];_0x3edc2e[_0x1ffb('0xc')][_0x1ffb('0x11')]=_0x3bb754['ip'];var _0x5c9c6f={'host':_0x1ffb('0x12'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x1ffb('0x13'),'timeout':0x4e20,'headers':{'Content-Type':_0x1ffb('0x14'),'Authorization':_0x1ffb('0x15')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x1ffb('0x16'))}};var _0x4ae6fe=JSON[_0x1ffb('0x9')](_0x3edc2e);var _0x24bd47=https[_0x1ffb('0x17')](_0x5c9c6f,function(_0x1b61df){_0x1b61df[_0x1ffb('0x18')](_0x1ffb('0x19'));var _0x3f33aa='';_0x1b61df['on'](_0x1ffb('0x1a'),function(_0xf72ae4){_0x3f33aa+=_0xf72ae4;});_0x1b61df['on']('end',function(){if(_0x5b939c){return _0x5b939c[_0x1ffb('0x1b')](_0x1b61df[_0x1ffb('0x1c')])[_0x1ffb('0x1d')](JSON[_0x1ffb('0x1e')](_0x3f33aa));}});});_0x24bd47['on'](_0x1ffb('0x1f'),function(_0x371559){if(_0x5b939c){return _0x5b939c[_0x1ffb('0x1b')](0x1f4)['json']({'errors':[{'message':_0x1ffb('0x20'),'type':_0x1ffb('0x21')}]});}});_0x24bd47[_0x1ffb('0x22')](_0x4ae6fe);_0x24bd47[_0x1ffb('0x23')]();}exports[_0x1ffb('0x24')]=openIssue;exports[_0x1ffb('0x25')]=function(_0x4ec62b,_0x4f5f53){_0x4ec62b[_0x1ffb('0x26')]['ip']=_0x4ec62b[_0x1ffb('0x27')][_0x1ffb('0x28')]||_0x4ec62b['connection']['remoteAddress']||_0x4ec62b[_0x1ffb('0x29')][_0x1ffb('0x2a')]||_0x4ec62b[_0x1ffb('0x2b')][_0x1ffb('0x29')][_0x1ffb('0x2a')];return openIssue(_0x4ec62b[_0x1ffb('0x26')],_0x4f5f53);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 6251dba..add6a09 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 _0xfd28=['show','put','delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x19f8ee,_0x3e08c2){var _0x3b68f2=function(_0x1f0f13){while(--_0x1f0f13){_0x19f8ee['push'](_0x19f8ee['shift']());}};_0x3b68f2(++_0x3e08c2);}(_0xfd28,0x148));var _0x8fd2=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0xfd28[_0x9c2427];return _0x51984f;};'use strict';var multer=require('multer');var util=require(_0x8fd2('0x0'));var path=require(_0x8fd2('0x1'));var timeout=require('connect-timeout');var express=require(_0x8fd2('0x2'));var router=express['Router']();var fs_extra=require(_0x8fd2('0x3'));var auth=require(_0x8fd2('0x4'));var interaction=require(_0x8fd2('0x5'));var config=require('../../config/environment');var controller=require(_0x8fd2('0x6'));router[_0x8fd2('0x7')]('/',auth[_0x8fd2('0x8')](),controller[_0x8fd2('0x9')]);router[_0x8fd2('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x8fd2('0xa')]);router[_0x8fd2('0x7')](_0x8fd2('0xb'),auth['isAuthenticated'](),controller[_0x8fd2('0xc')]);router['post']('/',auth[_0x8fd2('0x8')](),controller['create']);router[_0x8fd2('0xd')]('/:id',auth[_0x8fd2('0x8')](),controller['update']);router[_0x8fd2('0xe')]('/:id',auth[_0x8fd2('0x8')](),controller[_0x8fd2('0xf')]);module[_0x8fd2('0x10')]=router; \ No newline at end of file +var _0x2dae=['show','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x2dae,0xc3));var _0xe2da=function(_0x2a276d,_0x482b0c){_0x2a276d=_0x2a276d-0x0;var _0x2914cd=_0x2dae[_0x2a276d];return _0x2914cd;};'use strict';var multer=require(_0xe2da('0x0'));var util=require('util');var path=require(_0xe2da('0x1'));var timeout=require(_0xe2da('0x2'));var express=require(_0xe2da('0x3'));var router=express[_0xe2da('0x4')]();var fs_extra=require(_0xe2da('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe2da('0x6'));var config=require(_0xe2da('0x7'));var controller=require(_0xe2da('0x8'));router[_0xe2da('0x9')]('/',auth['isAuthenticated'](),controller[_0xe2da('0xa')]);router[_0xe2da('0x9')](_0xe2da('0xb'),auth[_0xe2da('0xc')](),controller[_0xe2da('0xd')]);router[_0xe2da('0x9')](_0xe2da('0xe'),auth[_0xe2da('0xc')](),controller[_0xe2da('0xf')]);router['post']('/',auth[_0xe2da('0xc')](),controller[_0xe2da('0x10')]);router[_0xe2da('0x11')](_0xe2da('0xe'),auth[_0xe2da('0xc')](),controller[_0xe2da('0x12')]);router[_0xe2da('0x13')](_0xe2da('0xe'),auth['isAuthenticated'](),controller[_0xe2da('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index b91b774..4f8f480 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(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x7a54,0x106));var _0x47a5=function(_0x1dfac0,_0x36e808){_0x1dfac0=_0x1dfac0-0x0;var _0x3a54c2=_0x7a54[_0x1dfac0];return _0x3a54c2;};'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(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x7a54,0x106));var _0x47a5=function(_0xfeaa0f,_0x3f2432){_0xfeaa0f=_0xfeaa0f-0x0;var _0x3f3891=_0x7a54[_0xfeaa0f];return _0x3f3891;};'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 4b58060..c07ca99 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 _0xd2f5=['query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','body','update','describe','eml-format','zip-dir','request-promise','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/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','then','destroy','error','name','send','index','map','JscriptyAnswerReport','fieldName','type','model'];(function(_0x1f7e2a,_0x4c7d0c){var _0xb8bf77=function(_0x30b9cb){while(--_0x30b9cb){_0x1f7e2a['push'](_0x1f7e2a['shift']());}};_0xb8bf77(++_0x4c7d0c);}(_0xd2f5,0x144));var _0x5d2f=function(_0x57851e,_0x3dad36){_0x57851e=_0x57851e-0x0;var _0x337391=_0xd2f5[_0x57851e];return _0x337391;};'use strict';var emlformat=require(_0x5d2f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5d2f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5d2f('0x2'));var moment=require('moment');var BPromise=require(_0x5d2f('0x3'));var Mustache=require(_0x5d2f('0x4'));var util=require(_0x5d2f('0x5'));var path=require(_0x5d2f('0x6'));var sox=require(_0x5d2f('0x7'));var csv=require(_0x5d2f('0x8'));var ejs=require(_0x5d2f('0x9'));var fs=require('fs');var fs_extra=require(_0x5d2f('0xa'));var _=require('lodash');var squel=require(_0x5d2f('0xb'));var crypto=require(_0x5d2f('0xc'));var jsforce=require(_0x5d2f('0xd'));var deskjs=require(_0x5d2f('0xe'));var toCsv=require(_0x5d2f('0x8'));var querystring=require(_0x5d2f('0xf'));var Papa=require('papaparse');var Redis=require(_0x5d2f('0x10'));var authService=require(_0x5d2f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5d2f('0x12'));var hardwareService=require(_0x5d2f('0x13'));var logger=require(_0x5d2f('0x14'))('api');var utils=require(_0x5d2f('0x15'));var config=require(_0x5d2f('0x16'));var licenseUtil=require(_0x5d2f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x510eb5,_0x15530f){_0x15530f=_0x15530f||0xcc;return function(_0x4bc97f){if(_0x4bc97f){return _0x510eb5[_0x5d2f('0x18')](_0x15530f);}return _0x510eb5[_0x5d2f('0x19')](_0x15530f)['end']();};}function respondWithResult(_0x663b11,_0x4b0bf6){_0x4b0bf6=_0x4b0bf6||0xc8;return function(_0x6ce2d1){if(_0x6ce2d1){return _0x663b11[_0x5d2f('0x19')](_0x4b0bf6)[_0x5d2f('0x1a')](_0x6ce2d1);}};}function respondWithFilteredResult(_0x4df9b1,_0x6d7c6c){return function(_0x39a7d5){if(_0x39a7d5){var _0x1ca388=typeof _0x6d7c6c[_0x5d2f('0x1b')]===_0x5d2f('0x1c')&&typeof _0x6d7c6c['limit']===_0x5d2f('0x1c');var _0x33a931=_0x39a7d5[_0x5d2f('0x1d')];var _0x454782=_0x1ca388?0x0:_0x6d7c6c['offset'];var _0x27e16d=_0x1ca388?_0x39a7d5[_0x5d2f('0x1d')]:_0x6d7c6c[_0x5d2f('0x1b')]+_0x6d7c6c[_0x5d2f('0x1e')];var _0x172106;if(_0x27e16d>=_0x33a931){_0x27e16d=_0x33a931;_0x172106=0xc8;}else{_0x172106=0xce;}_0x4df9b1[_0x5d2f('0x19')](_0x172106);return _0x4df9b1[_0x5d2f('0x1f')]('Content-Range',_0x454782+'-'+_0x27e16d+'/'+_0x33a931)['json'](_0x39a7d5);}return null;};}function patchUpdates(_0x4d3959){return function(_0x3814b1){try{jsonpatch[_0x5d2f('0x20')](_0x3814b1,_0x4d3959,!![]);}catch(_0xffb46f){return BPromise[_0x5d2f('0x21')](_0xffb46f);}return _0x3814b1[_0x5d2f('0x22')]();};}function saveUpdates(_0x5c6dae,_0x5cc8d6){return function(_0x368693){if(_0x368693){return _0x368693['update'](_0x5c6dae)[_0x5d2f('0x23')](function(_0xea19f2){return _0xea19f2;});}return null;};}function removeEntity(_0x102304,_0x6d8859){return function(_0x6d4ad2){if(_0x6d4ad2){return _0x6d4ad2[_0x5d2f('0x24')]()[_0x5d2f('0x23')](function(){_0x102304[_0x5d2f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5ef5,_0x207d88){return function(_0x1ebfbd){if(!_0x1ebfbd){_0x3e5ef5[_0x5d2f('0x18')](0x194);}return _0x1ebfbd;};}function handleError(_0x213744,_0x25cc72){_0x25cc72=_0x25cc72||0x1f4;return function(_0x2ff7cc){logger[_0x5d2f('0x25')](_0x2ff7cc['stack']);if(_0x2ff7cc[_0x5d2f('0x26')]){delete _0x2ff7cc[_0x5d2f('0x26')];}_0x213744[_0x5d2f('0x19')](_0x25cc72)[_0x5d2f('0x27')](_0x2ff7cc);};}exports[_0x5d2f('0x28')]=function(_0x47eebe,_0xada7ef){var _0x35e94f={},_0x102977={},_0x3063f4={'count':0x0,'rows':[]};var _0x536f1d=_[_0x5d2f('0x29')](db[_0x5d2f('0x2a')]['rawAttributes'],function(_0x171759){return{'name':_0x171759[_0x5d2f('0x2b')],'type':_0x171759[_0x5d2f('0x2c')]['key']};});_0x102977[_0x5d2f('0x2d')]=_[_0x5d2f('0x29')](_0x536f1d,_0x5d2f('0x26'));_0x102977[_0x5d2f('0x2e')]=_[_0x5d2f('0x2f')](_0x47eebe[_0x5d2f('0x2e')]);_0x102977['filters']=_[_0x5d2f('0x30')](_0x102977[_0x5d2f('0x2d')],_0x102977[_0x5d2f('0x2e')]);_0x35e94f['attributes']=_['intersection'](_0x102977[_0x5d2f('0x2d')],qs[_0x5d2f('0x31')](_0x47eebe[_0x5d2f('0x2e')][_0x5d2f('0x31')]));_0x35e94f[_0x5d2f('0x32')]=_0x35e94f[_0x5d2f('0x32')][_0x5d2f('0x33')]?_0x35e94f[_0x5d2f('0x32')]:_0x102977[_0x5d2f('0x2d')];if(!_0x47eebe[_0x5d2f('0x2e')][_0x5d2f('0x34')](_0x5d2f('0x35'))){_0x35e94f[_0x5d2f('0x1e')]=qs[_0x5d2f('0x1e')](_0x47eebe[_0x5d2f('0x2e')]['limit']);_0x35e94f[_0x5d2f('0x1b')]=qs[_0x5d2f('0x1b')](_0x47eebe[_0x5d2f('0x2e')][_0x5d2f('0x1b')]);}_0x35e94f[_0x5d2f('0x36')]=qs[_0x5d2f('0x37')](_0x47eebe[_0x5d2f('0x2e')][_0x5d2f('0x37')]);_0x35e94f[_0x5d2f('0x38')]=qs['filters'](_[_0x5d2f('0x39')](_0x47eebe[_0x5d2f('0x2e')],_0x102977[_0x5d2f('0x3a')]),_0x536f1d);if(_0x47eebe[_0x5d2f('0x2e')][_0x5d2f('0x3b')]){_0x35e94f[_0x5d2f('0x38')]=_[_0x5d2f('0x3c')](_0x35e94f[_0x5d2f('0x38')],{'$or':_['map'](_0x536f1d,function(_0x4615ab){if(_0x4615ab['type']!==_0x5d2f('0x3d')){var _0xfbb0f7={};_0xfbb0f7[_0x4615ab[_0x5d2f('0x26')]]={'$like':'%'+_0x47eebe[_0x5d2f('0x2e')][_0x5d2f('0x3b')]+'%'};return _0xfbb0f7;}})});}_0x35e94f=_[_0x5d2f('0x3c')]({},_0x35e94f,_0x47eebe[_0x5d2f('0x3e')]);var _0x18120d={'where':_0x35e94f[_0x5d2f('0x38')]};return db['JscriptyAnswerReport'][_0x5d2f('0x1d')](_0x18120d)['then'](function(_0x5c33d8){_0x3063f4[_0x5d2f('0x1d')]=_0x5c33d8;if(_0x47eebe[_0x5d2f('0x2e')][_0x5d2f('0x3f')]){_0x35e94f[_0x5d2f('0x40')]=[{'all':!![]}];}return db[_0x5d2f('0x2a')][_0x5d2f('0x41')](_0x35e94f);})[_0x5d2f('0x23')](function(_0x49c3fe){_0x3063f4['rows']=_0x49c3fe;return _0x3063f4;})['then'](respondWithFilteredResult(_0xada7ef,_0x35e94f))[_0x5d2f('0x42')](handleError(_0xada7ef,null));};exports[_0x5d2f('0x43')]=function(_0x23ce9d,_0x275102){var _0x2cd120={'raw':!![],'where':{'id':_0x23ce9d[_0x5d2f('0x44')]['id']}},_0x555df4={};_0x555df4[_0x5d2f('0x2d')]=_[_0x5d2f('0x2f')](db['JscriptyAnswerReport'][_0x5d2f('0x45')]);_0x555df4[_0x5d2f('0x2e')]=_[_0x5d2f('0x2f')](_0x23ce9d[_0x5d2f('0x2e')]);_0x555df4[_0x5d2f('0x3a')]=_[_0x5d2f('0x30')](_0x555df4['model'],_0x555df4[_0x5d2f('0x2e')]);_0x2cd120['attributes']=_['intersection'](_0x555df4[_0x5d2f('0x2d')],qs[_0x5d2f('0x31')](_0x23ce9d[_0x5d2f('0x2e')]['fields']));_0x2cd120[_0x5d2f('0x32')]=_0x2cd120[_0x5d2f('0x32')][_0x5d2f('0x33')]?_0x2cd120[_0x5d2f('0x32')]:_0x555df4['model'];if(_0x23ce9d[_0x5d2f('0x2e')][_0x5d2f('0x3f')]){_0x2cd120[_0x5d2f('0x40')]=[{'all':!![]}];}_0x2cd120=_[_0x5d2f('0x3c')]({},_0x2cd120,_0x23ce9d[_0x5d2f('0x3e')]);return db[_0x5d2f('0x2a')][_0x5d2f('0x46')](_0x2cd120)[_0x5d2f('0x23')](handleEntityNotFound(_0x275102,null))[_0x5d2f('0x23')](respondWithResult(_0x275102,null))[_0x5d2f('0x42')](handleError(_0x275102,null));};exports['create']=function(_0x577e8a,_0x55a4a0){return db[_0x5d2f('0x2a')]['create'](_0x577e8a[_0x5d2f('0x47')],{})[_0x5d2f('0x23')](respondWithResult(_0x55a4a0,0xc9))[_0x5d2f('0x42')](handleError(_0x55a4a0,null));};exports[_0x5d2f('0x48')]=function(_0x31078e,_0x41bca3){if(_0x31078e['body']['id']){delete _0x31078e['body']['id'];}return db[_0x5d2f('0x2a')][_0x5d2f('0x46')]({'where':{'id':_0x31078e[_0x5d2f('0x44')]['id']}})[_0x5d2f('0x23')](handleEntityNotFound(_0x41bca3,null))[_0x5d2f('0x23')](saveUpdates(_0x31078e[_0x5d2f('0x47')],null))[_0x5d2f('0x23')](respondWithResult(_0x41bca3,null))['catch'](handleError(_0x41bca3,null));};exports[_0x5d2f('0x24')]=function(_0x42d79d,_0x5051da){return db[_0x5d2f('0x2a')][_0x5d2f('0x46')]({'where':{'id':_0x42d79d[_0x5d2f('0x44')]['id']}})[_0x5d2f('0x23')](handleEntityNotFound(_0x5051da,null))['then'](removeEntity(_0x5051da,null))[_0x5d2f('0x42')](handleError(_0x5051da,null));};exports[_0x5d2f('0x49')]=function(_0x430545,_0x194725){return db[_0x5d2f('0x2a')][_0x5d2f('0x49')]()[_0x5d2f('0x23')](respondWithResult(_0x194725,null))['catch'](handleError(_0x194725,null));}; \ No newline at end of file +var _0x6b8f=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','rows','catch','show','params','keys','find','create','body','describe','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','apply','reject','save','update','destroy','then','end','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','query','filters','intersection','model'];(function(_0xcf581b,_0x4359dd){var _0x4f454d=function(_0x182d58){while(--_0x182d58){_0xcf581b['push'](_0xcf581b['shift']());}};_0x4f454d(++_0x4359dd);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x4e644b,_0xcc9fde){_0x4e644b=_0x4e644b-0x0;var _0x551db7=_0x6b8f[_0x4e644b];return _0x551db7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf6b8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf6b8('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf6b8('0x2'));var Mustache=require(_0xf6b8('0x3'));var util=require('util');var path=require(_0xf6b8('0x4'));var sox=require(_0xf6b8('0x5'));var csv=require(_0xf6b8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf6b8('0x7'));var _=require(_0xf6b8('0x8'));var squel=require(_0xf6b8('0x9'));var crypto=require(_0xf6b8('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf6b8('0x6'));var querystring=require('querystring');var Papa=require(_0xf6b8('0xb'));var Redis=require(_0xf6b8('0xc'));var authService=require(_0xf6b8('0xd'));var qs=require(_0xf6b8('0xe'));var as=require(_0xf6b8('0xf'));var hardwareService=require(_0xf6b8('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf6b8('0x11'));var licenseUtil=require(_0xf6b8('0x12'));var db=require(_0xf6b8('0x13'))['db'];function respondWithStatusCode(_0x1d96b9,_0x5a6118){_0x5a6118=_0x5a6118||0xcc;return function(_0x4e5235){if(_0x4e5235){return _0x1d96b9[_0xf6b8('0x14')](_0x5a6118);}return _0x1d96b9[_0xf6b8('0x15')](_0x5a6118)['end']();};}function respondWithResult(_0xfcecc9,_0x2db10c){_0x2db10c=_0x2db10c||0xc8;return function(_0x454d8a){if(_0x454d8a){return _0xfcecc9['status'](_0x2db10c)[_0xf6b8('0x16')](_0x454d8a);}};}function respondWithFilteredResult(_0x53d744,_0x410345){return function(_0x1ee041){if(_0x1ee041){var _0x2e1748=typeof _0x410345[_0xf6b8('0x17')]===_0xf6b8('0x18')&&typeof _0x410345['limit']==='undefined';var _0x3bb9ae=_0x1ee041['count'];var _0x3cf63c=_0x2e1748?0x0:_0x410345[_0xf6b8('0x17')];var _0x4a93a8=_0x2e1748?_0x1ee041['count']:_0x410345[_0xf6b8('0x17')]+_0x410345[_0xf6b8('0x19')];var _0x3081db;if(_0x4a93a8>=_0x3bb9ae){_0x4a93a8=_0x3bb9ae;_0x3081db=0xc8;}else{_0x3081db=0xce;}_0x53d744[_0xf6b8('0x15')](_0x3081db);return _0x53d744['set']('Content-Range',_0x3cf63c+'-'+_0x4a93a8+'/'+_0x3bb9ae)['json'](_0x1ee041);}return null;};}function patchUpdates(_0x3298a4){return function(_0x2a8195){try{jsonpatch[_0xf6b8('0x1a')](_0x2a8195,_0x3298a4,!![]);}catch(_0x56b48a){return BPromise[_0xf6b8('0x1b')](_0x56b48a);}return _0x2a8195[_0xf6b8('0x1c')]();};}function saveUpdates(_0x3d2c57,_0x9c660c){return function(_0x5dd616){if(_0x5dd616){return _0x5dd616[_0xf6b8('0x1d')](_0x3d2c57)['then'](function(_0x22c52d){return _0x22c52d;});}return null;};}function removeEntity(_0x2b5bd3,_0x13a451){return function(_0x4127c9){if(_0x4127c9){return _0x4127c9[_0xf6b8('0x1e')]()[_0xf6b8('0x1f')](function(){_0x2b5bd3['status'](0xcc)[_0xf6b8('0x20')]();});}};}function handleEntityNotFound(_0x1ebfea,_0x4815f7){return function(_0x205d6c){if(!_0x205d6c){_0x1ebfea[_0xf6b8('0x14')](0x194);}return _0x205d6c;};}function handleError(_0x324057,_0xd5ebb5){_0xd5ebb5=_0xd5ebb5||0x1f4;return function(_0x3365b8){logger['error'](_0x3365b8['stack']);if(_0x3365b8[_0xf6b8('0x21')]){delete _0x3365b8[_0xf6b8('0x21')];}_0x324057['status'](_0xd5ebb5)[_0xf6b8('0x22')](_0x3365b8);};}exports[_0xf6b8('0x23')]=function(_0x888319,_0x5a7f55){var _0x458935={},_0xc958f4={},_0x511896={'count':0x0,'rows':[]};var _0x309f04=_[_0xf6b8('0x24')](db[_0xf6b8('0x25')][_0xf6b8('0x26')],function(_0x51ffcf){return{'name':_0x51ffcf[_0xf6b8('0x27')],'type':_0x51ffcf[_0xf6b8('0x28')][_0xf6b8('0x29')]};});_0xc958f4['model']=_[_0xf6b8('0x24')](_0x309f04,_0xf6b8('0x21'));_0xc958f4[_0xf6b8('0x2a')]=_['keys'](_0x888319[_0xf6b8('0x2a')]);_0xc958f4[_0xf6b8('0x2b')]=_[_0xf6b8('0x2c')](_0xc958f4[_0xf6b8('0x2d')],_0xc958f4['query']);_0x458935[_0xf6b8('0x2e')]=_[_0xf6b8('0x2c')](_0xc958f4[_0xf6b8('0x2d')],qs['fields'](_0x888319['query'][_0xf6b8('0x2f')]));_0x458935[_0xf6b8('0x2e')]=_0x458935[_0xf6b8('0x2e')][_0xf6b8('0x30')]?_0x458935[_0xf6b8('0x2e')]:_0xc958f4[_0xf6b8('0x2d')];if(!_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x31')](_0xf6b8('0x32'))){_0x458935[_0xf6b8('0x19')]=qs[_0xf6b8('0x19')](_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x19')]);_0x458935[_0xf6b8('0x17')]=qs[_0xf6b8('0x17')](_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x17')]);}_0x458935[_0xf6b8('0x33')]=qs['sort'](_0x888319['query'][_0xf6b8('0x34')]);_0x458935[_0xf6b8('0x35')]=qs[_0xf6b8('0x2b')](_[_0xf6b8('0x36')](_0x888319[_0xf6b8('0x2a')],_0xc958f4[_0xf6b8('0x2b')]),_0x309f04);if(_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x37')]){_0x458935[_0xf6b8('0x35')]=_[_0xf6b8('0x38')](_0x458935[_0xf6b8('0x35')],{'$or':_[_0xf6b8('0x24')](_0x309f04,function(_0x4a8c49){if(_0x4a8c49[_0xf6b8('0x28')]!==_0xf6b8('0x39')){var _0x5d26ad={};_0x5d26ad[_0x4a8c49[_0xf6b8('0x21')]]={'$like':'%'+_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x37')]+'%'};return _0x5d26ad;}})});}_0x458935=_[_0xf6b8('0x38')]({},_0x458935,_0x888319[_0xf6b8('0x3a')]);var _0x87a4ee={'where':_0x458935[_0xf6b8('0x35')]};return db[_0xf6b8('0x25')][_0xf6b8('0x3b')](_0x87a4ee)[_0xf6b8('0x1f')](function(_0x15a63b){_0x511896[_0xf6b8('0x3b')]=_0x15a63b;if(_0x888319[_0xf6b8('0x2a')][_0xf6b8('0x3c')]){_0x458935['include']=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x458935);})[_0xf6b8('0x1f')](function(_0x2c68f5){_0x511896[_0xf6b8('0x3d')]=_0x2c68f5;return _0x511896;})[_0xf6b8('0x1f')](respondWithFilteredResult(_0x5a7f55,_0x458935))[_0xf6b8('0x3e')](handleError(_0x5a7f55,null));};exports[_0xf6b8('0x3f')]=function(_0x1390dc,_0x48f4cb){var _0x1f5e72={'raw':!![],'where':{'id':_0x1390dc[_0xf6b8('0x40')]['id']}},_0x5086d9={};_0x5086d9[_0xf6b8('0x2d')]=_[_0xf6b8('0x41')](db[_0xf6b8('0x25')][_0xf6b8('0x26')]);_0x5086d9['query']=_[_0xf6b8('0x41')](_0x1390dc[_0xf6b8('0x2a')]);_0x5086d9[_0xf6b8('0x2b')]=_[_0xf6b8('0x2c')](_0x5086d9[_0xf6b8('0x2d')],_0x5086d9['query']);_0x1f5e72[_0xf6b8('0x2e')]=_[_0xf6b8('0x2c')](_0x5086d9[_0xf6b8('0x2d')],qs['fields'](_0x1390dc['query'][_0xf6b8('0x2f')]));_0x1f5e72[_0xf6b8('0x2e')]=_0x1f5e72[_0xf6b8('0x2e')][_0xf6b8('0x30')]?_0x1f5e72['attributes']:_0x5086d9['model'];if(_0x1390dc['query'][_0xf6b8('0x3c')]){_0x1f5e72['include']=[{'all':!![]}];}_0x1f5e72=_[_0xf6b8('0x38')]({},_0x1f5e72,_0x1390dc[_0xf6b8('0x3a')]);return db[_0xf6b8('0x25')][_0xf6b8('0x42')](_0x1f5e72)[_0xf6b8('0x1f')](handleEntityNotFound(_0x48f4cb,null))[_0xf6b8('0x1f')](respondWithResult(_0x48f4cb,null))[_0xf6b8('0x3e')](handleError(_0x48f4cb,null));};exports[_0xf6b8('0x43')]=function(_0x394a34,_0x597511){return db[_0xf6b8('0x25')]['create'](_0x394a34[_0xf6b8('0x44')],{})[_0xf6b8('0x1f')](respondWithResult(_0x597511,0xc9))[_0xf6b8('0x3e')](handleError(_0x597511,null));};exports[_0xf6b8('0x1d')]=function(_0x1abf17,_0x291845){if(_0x1abf17[_0xf6b8('0x44')]['id']){delete _0x1abf17['body']['id'];}return db[_0xf6b8('0x25')][_0xf6b8('0x42')]({'where':{'id':_0x1abf17[_0xf6b8('0x40')]['id']}})[_0xf6b8('0x1f')](handleEntityNotFound(_0x291845,null))['then'](saveUpdates(_0x1abf17[_0xf6b8('0x44')],null))[_0xf6b8('0x1f')](respondWithResult(_0x291845,null))['catch'](handleError(_0x291845,null));};exports[_0xf6b8('0x1e')]=function(_0x143164,_0x392582){return db[_0xf6b8('0x25')][_0xf6b8('0x42')]({'where':{'id':_0x143164['params']['id']}})[_0xf6b8('0x1f')](handleEntityNotFound(_0x392582,null))[_0xf6b8('0x1f')](removeEntity(_0x392582,null))['catch'](handleError(_0x392582,null));};exports['describe']=function(_0x55c392,_0x22c1eb){return db[_0xf6b8('0x25')][_0xf6b8('0x45')]()[_0xf6b8('0x1f')](respondWithResult(_0x22c1eb,null))['catch'](handleError(_0x22c1eb,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 7f721ae..fee1cc2 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 _0x7e2f=['JscriptyAnswerReport','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports'];(function(_0x3a57cd,_0x48d70a){var _0xbf8347=function(_0x4c1dc9){while(--_0x4c1dc9){_0x3a57cd['push'](_0x3a57cd['shift']());}};_0xbf8347(++_0x48d70a);}(_0x7e2f,0x187));var _0xf7e2=function(_0x1a547e,_0x5917d3){_0x1a547e=_0x1a547e-0x0;var _0x5ebdaf=_0x7e2f[_0x1a547e];return _0x5ebdaf;};'use strict';var _=require('lodash');var util=require(_0xf7e2('0x0'));var logger=require(_0xf7e2('0x1'))(_0xf7e2('0x2'));var moment=require('moment');var BPromise=require(_0xf7e2('0x3'));var rp=require(_0xf7e2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf7e2('0x5'));var config=require(_0xf7e2('0x6'));var attributes=require(_0xf7e2('0x7'));module[_0xf7e2('0x8')]=function(_0x5f2ed6,_0x11de4d){return _0x5f2ed6['define'](_0xf7e2('0x9'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0848=['report_jscripty_answers','lodash','../../config/logger','moment','bluebird','rimraf','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport'];(function(_0x1e5e85,_0xac6fd2){var _0x58d0c2=function(_0x55f975){while(--_0x55f975){_0x1e5e85['push'](_0x1e5e85['shift']());}};_0x58d0c2(++_0xac6fd2);}(_0x0848,0x184));var _0x8084=function(_0x5d8ef7,_0x5373aa){_0x5d8ef7=_0x5d8ef7-0x0;var _0x5c35d6=_0x0848[_0x5d8ef7];return _0x5c35d6;};'use strict';var _=require(_0x8084('0x0'));var util=require('util');var logger=require(_0x8084('0x1'))('api');var moment=require(_0x8084('0x2'));var BPromise=require(_0x8084('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8084('0x4'));var config=require('../../config/environment');var attributes=require(_0x8084('0x5'));module[_0x8084('0x6')]=function(_0x5760eb,_0x486c11){return _0x5760eb['define'](_0x8084('0x7'),attributes,{'tableName':_0x8084('0x8'),'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 6d36023..ccdf99a 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 _0xccfa=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch'];(function(_0x47b71a,_0x23c568){var _0x1a35c2=function(_0x3132a5){while(--_0x3132a5){_0x47b71a['push'](_0x47b71a['shift']());}};_0x1a35c2(++_0x23c568);}(_0xccfa,0x12b));var _0xaccf=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xccfa[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0xaccf('0x0'));var util=require(_0xaccf('0x1'));var moment=require(_0xaccf('0x2'));var BPromise=require(_0xaccf('0x3'));var rs=require(_0xaccf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaccf('0x5'))['db'];var utils=require(_0xaccf('0x6'));var logger=require(_0xaccf('0x7'))('rpc');var config=require(_0xaccf('0x8'));var jayson=require(_0xaccf('0x9'));var client=jayson[_0xaccf('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x98b85b,_0x45430b,_0x439673){return new BPromise(function(_0x3a56a7,_0x18f7d4){return client['request'](_0x98b85b,_0x439673)[_0xaccf('0xb')](function(_0x22c1f0){logger[_0xaccf('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x45430b,_0xaccf('0xd'));logger[_0xaccf('0xe')](_0xaccf('0xf'),_0x45430b,_0xaccf('0xd'),JSON[_0xaccf('0x10')](_0x22c1f0));if(_0x22c1f0[_0xaccf('0x11')]){if(_0x22c1f0['error'][_0xaccf('0x12')]===0x1f4){logger[_0xaccf('0x11')](_0xaccf('0x13'),_0x45430b,_0x22c1f0[_0xaccf('0x11')][_0xaccf('0x14')]);return _0x18f7d4(_0x22c1f0[_0xaccf('0x11')][_0xaccf('0x14')]);}logger[_0xaccf('0x11')](_0xaccf('0x13'),_0x45430b,_0x22c1f0[_0xaccf('0x11')][_0xaccf('0x14')]);return _0x3a56a7(_0x22c1f0[_0xaccf('0x11')][_0xaccf('0x14')]);}else{logger[_0xaccf('0xc')](_0xaccf('0x13'),_0x45430b,_0xaccf('0xd'));_0x3a56a7(_0x22c1f0[_0xaccf('0x15')][_0xaccf('0x14')]);}})[_0xaccf('0x16')](function(_0x4e5833){logger[_0xaccf('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x45430b,_0x4e5833);_0x18f7d4(_0x4e5833);});});} \ No newline at end of file +var _0x033e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird'];(function(_0xf66454,_0x27546a){var _0x9d1fa9=function(_0x53167a){while(--_0x53167a){_0xf66454['push'](_0xf66454['shift']());}};_0x9d1fa9(++_0x27546a);}(_0x033e,0xe3));var _0xe033=function(_0x9f030,_0x4187b7){_0x9f030=_0x9f030-0x0;var _0x34e8dc=_0x033e[_0x9f030];return _0x34e8dc;};'use strict';var _=require(_0xe033('0x0'));var util=require(_0xe033('0x1'));var moment=require('moment');var BPromise=require(_0xe033('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe033('0x3'));var db=require(_0xe033('0x4'))['db'];var utils=require(_0xe033('0x5'));var logger=require(_0xe033('0x6'))(_0xe033('0x7'));var config=require(_0xe033('0x8'));var jayson=require(_0xe033('0x9'));var client=jayson[_0xe033('0xa')][_0xe033('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x532c99,_0x4505d4,_0x39e5f4){return new BPromise(function(_0x50df18,_0x3e9d09){return client[_0xe033('0xc')](_0x532c99,_0x39e5f4)['then'](function(_0x1a85f8){logger[_0xe033('0xd')](_0xe033('0xe'),_0x4505d4,'request\x20sent');logger[_0xe033('0xf')](_0xe033('0x10'),_0x4505d4,_0xe033('0x11'),JSON[_0xe033('0x12')](_0x1a85f8));if(_0x1a85f8[_0xe033('0x13')]){if(_0x1a85f8[_0xe033('0x13')][_0xe033('0x14')]===0x1f4){logger[_0xe033('0x13')](_0xe033('0xe'),_0x4505d4,_0x1a85f8['error'][_0xe033('0x15')]);return _0x3e9d09(_0x1a85f8[_0xe033('0x13')]['message']);}logger[_0xe033('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4505d4,_0x1a85f8['error'][_0xe033('0x15')]);return _0x50df18(_0x1a85f8[_0xe033('0x13')][_0xe033('0x15')]);}else{logger['info'](_0xe033('0xe'),_0x4505d4,_0xe033('0x11'));_0x50df18(_0x1a85f8['result']['message']);}})[_0xe033('0x16')](function(_0x56752f){logger[_0xe033('0x13')](_0xe033('0xe'),_0x4505d4,_0x56752f);_0x3e9d09(_0x56752f);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index abfcf24..9efc3cc 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 _0xd586=['/:id/answers','/:id/summary','create','clone','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','index','/:id','show','get','/:id/sessions','getSessions'];(function(_0x546af3,_0x904a3f){var _0x1c156a=function(_0x3097fb){while(--_0x3097fb){_0x546af3['push'](_0x546af3['shift']());}};_0x1c156a(++_0x904a3f);}(_0xd586,0x10c));var _0x6d58=function(_0x1f19a2,_0x3795f0){_0x1f19a2=_0x1f19a2-0x0;var _0x514abb=_0xd586[_0x1f19a2];return _0x514abb;};'use strict';var multer=require(_0x6d58('0x0'));var util=require(_0x6d58('0x1'));var path=require(_0x6d58('0x2'));var timeout=require(_0x6d58('0x3'));var express=require(_0x6d58('0x4'));var router=express[_0x6d58('0x5')]();var fs_extra=require(_0x6d58('0x6'));var auth=require(_0x6d58('0x7'));var interaction=require(_0x6d58('0x8'));var config=require(_0x6d58('0x9'));var controller=require(_0x6d58('0xa'));router['get']('/',auth[_0x6d58('0xb')](),controller[_0x6d58('0xc')]);router['get'](_0x6d58('0xd'),auth[_0x6d58('0xb')](),controller[_0x6d58('0xe')]);router[_0x6d58('0xf')](_0x6d58('0x10'),auth[_0x6d58('0xb')](),controller[_0x6d58('0x11')]);router['get'](_0x6d58('0x12'),auth[_0x6d58('0xb')](),controller['getAnswers']);router[_0x6d58('0xf')](_0x6d58('0x13'),auth[_0x6d58('0xb')](),timeout('30s'),controller['getSummary']);router['post']('/',auth[_0x6d58('0xb')](),controller[_0x6d58('0x14')]);router['post']('/:id/clone',auth[_0x6d58('0xb')](),controller[_0x6d58('0x15')]);router['put'](_0x6d58('0xd'),auth[_0x6d58('0xb')](),controller[_0x6d58('0x16')]);router[_0x6d58('0x17')](_0x6d58('0xd'),auth['isAuthenticated'](),controller[_0x6d58('0x18')]);module[_0x6d58('0x19')]=router; \ No newline at end of file +var _0x6a4b=['put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','post','create','/:id/clone','clone'];(function(_0x463e45,_0x1ff35f){var _0x172e49=function(_0x35f7d0){while(--_0x35f7d0){_0x463e45['push'](_0x463e45['shift']());}};_0x172e49(++_0x1ff35f);}(_0x6a4b,0xe6));var _0xb6a4=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x6a4b[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require('multer');var util=require(_0xb6a4('0x0'));var path=require('path');var timeout=require(_0xb6a4('0x1'));var express=require(_0xb6a4('0x2'));var router=express[_0xb6a4('0x3')]();var fs_extra=require(_0xb6a4('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb6a4('0x5'));router[_0xb6a4('0x6')]('/',auth[_0xb6a4('0x7')](),controller[_0xb6a4('0x8')]);router[_0xb6a4('0x6')](_0xb6a4('0x9'),auth[_0xb6a4('0x7')](),controller[_0xb6a4('0xa')]);router[_0xb6a4('0x6')](_0xb6a4('0xb'),auth[_0xb6a4('0x7')](),controller[_0xb6a4('0xc')]);router['get'](_0xb6a4('0xd'),auth[_0xb6a4('0x7')](),controller[_0xb6a4('0xe')]);router['get'](_0xb6a4('0xf'),auth[_0xb6a4('0x7')](),timeout('30s'),controller['getSummary']);router[_0xb6a4('0x10')]('/',auth[_0xb6a4('0x7')](),controller[_0xb6a4('0x11')]);router[_0xb6a4('0x10')](_0xb6a4('0x12'),auth[_0xb6a4('0x7')](),controller[_0xb6a4('0x13')]);router[_0xb6a4('0x14')](_0xb6a4('0x9'),auth['isAuthenticated'](),controller[_0xb6a4('0x15')]);router[_0xb6a4('0x16')](_0xb6a4('0x9'),auth[_0xb6a4('0x7')](),controller[_0xb6a4('0x17')]);module[_0xb6a4('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 48a6227..3448626 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 _0x5031=['STRING','long','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','sequelize','lodash','util','name'];(function(_0x255c48,_0x2a4449){var _0xaebda3=function(_0x12a04e){while(--_0x12a04e){_0x255c48['push'](_0x255c48['shift']());}};_0xaebda3(++_0x2a4449);}(_0x5031,0xec));var _0x1503=function(_0x1fac75,_0x2f233b){_0x1fac75=_0x1fac75-0x0;var _0x13abd7=_0x5031[_0x1fac75];return _0x13abd7;};'use strict';var Sequelize=require(_0x1503('0x0'));var _=require(_0x1503('0x1'));var util=require(_0x1503('0x2'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x1503('0x3')},'description':{'type':Sequelize[_0x1503('0x4')]},'formData':{'type':Sequelize['TEXT'](_0x1503('0x5')),'set':function(_0x3605a6){if(_[_0x1503('0x6')](_0x3605a6)){this[_0x1503('0x7')](_0x1503('0x8'),JSON[_0x1503('0x9')](_0x3605a6));}else if(_[_0x1503('0xa')](_0x3605a6)){this['setDataValue']('formData',_0x3605a6);}else{this[_0x1503('0x7')](_0x1503('0x8'),util[_0x1503('0xb')](_0x1503('0xc'),this[_0x1503('0xd')](_0x1503('0x3'))||'',this[_0x1503('0xd')](_0x1503('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xd0c6=['getDataValue','BOOLEAN','sequelize','util','STRING','name','TEXT','isObjectLike','setDataValue','formData','format'];(function(_0x4c8a8f,_0x997ef){var _0x404500=function(_0x1c6072){while(--_0x1c6072){_0x4c8a8f['push'](_0x4c8a8f['shift']());}};_0x404500(++_0x997ef);}(_0xd0c6,0x1af));var _0x6d0c=function(_0x22a885,_0x3422b5){_0x22a885=_0x22a885-0x0;var _0x262f85=_0xd0c6[_0x22a885];return _0x262f85;};'use strict';var Sequelize=require(_0x6d0c('0x0'));var _=require('lodash');var util=require(_0x6d0c('0x1'));module['exports']={'name':{'type':Sequelize[_0x6d0c('0x2')],'unique':_0x6d0c('0x3')},'description':{'type':Sequelize[_0x6d0c('0x2')]},'formData':{'type':Sequelize[_0x6d0c('0x4')]('long'),'set':function(_0x1fcc5d){if(_[_0x6d0c('0x5')](_0x1fcc5d)){this[_0x6d0c('0x6')](_0x6d0c('0x7'),JSON['stringify'](_0x1fcc5d));}else if(_['isString'](_0x1fcc5d)){this['setDataValue'](_0x6d0c('0x7'),_0x1fcc5d);}else{this[_0x6d0c('0x6')]('formData',util[_0x6d0c('0x8')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue'](_0x6d0c('0x3'))||'',this[_0x6d0c('0x9')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x6d0c('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index cdee790..34edd1a 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 _0xad07=['rimraf','fast-json-patch','request-promise','mustache','util','path','to-csv','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','update','destroy','get','Projects','UserProfileResource','then','error','stack','name','map','JscriptyProject','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','type','VIRTUAL','include','findAll','catch','show','params','includeAll','options','find','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','JscriptySessionReport','nolimit','getAnswers','findOne','JscriptyAnswerReport','ProjectId','rows','number','toString','indexOf','replace','starttime','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','push','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format'];(function(_0x39be6a,_0x33902f){var _0x25788c=function(_0x44a9b5){while(--_0x44a9b5){_0x39be6a['push'](_0x39be6a['shift']());}};_0x25788c(++_0x33902f);}(_0xad07,0xe3));var _0x7ad0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad07[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7ad0('0x0'));var rimraf=require(_0x7ad0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7ad0('0x2'));var rp=require(_0x7ad0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7ad0('0x4'));var util=require(_0x7ad0('0x5'));var path=require(_0x7ad0('0x6'));var sox=require('sox');var csv=require(_0x7ad0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7ad0('0x8'));var squel=require(_0x7ad0('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7ad0('0xa'));var toCsv=require(_0x7ad0('0x7'));var querystring=require('querystring');var Papa=require(_0x7ad0('0xb'));var Redis=require(_0x7ad0('0xc'));var authService=require(_0x7ad0('0xd'));var qs=require(_0x7ad0('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7ad0('0xf'));var logger=require(_0x7ad0('0x10'))(_0x7ad0('0x11'));var utils=require(_0x7ad0('0x12'));var config=require(_0x7ad0('0x13'));var licenseUtil=require(_0x7ad0('0x14'));var db=require(_0x7ad0('0x15'))['db'];function respondWithStatusCode(_0x30d2af,_0x5e1389){_0x5e1389=_0x5e1389||0xcc;return function(_0x572905){if(_0x572905){return _0x30d2af[_0x7ad0('0x16')](_0x5e1389);}return _0x30d2af[_0x7ad0('0x17')](_0x5e1389)[_0x7ad0('0x18')]();};}function respondWithResult(_0x1478e6,_0x51fed3){_0x51fed3=_0x51fed3||0xc8;return function(_0x53cdff){if(_0x53cdff){return _0x1478e6[_0x7ad0('0x17')](_0x51fed3)[_0x7ad0('0x19')](_0x53cdff);}};}function respondWithFilteredResult(_0x456226,_0xcecbc1){return function(_0xebb4da){if(_0xebb4da){var _0x901908=typeof _0xcecbc1[_0x7ad0('0x1a')]===_0x7ad0('0x1b')&&typeof _0xcecbc1['limit']===_0x7ad0('0x1b');var _0x40fa9c=_0xebb4da['count'];var _0x4f45e4=_0x901908?0x0:_0xcecbc1[_0x7ad0('0x1a')];var _0x4f9d6b=_0x901908?_0xebb4da[_0x7ad0('0x1c')]:_0xcecbc1[_0x7ad0('0x1a')]+_0xcecbc1['limit'];var _0x126454;if(_0x4f9d6b>=_0x40fa9c){_0x4f9d6b=_0x40fa9c;_0x126454=0xc8;}else{_0x126454=0xce;}_0x456226['status'](_0x126454);return _0x456226[_0x7ad0('0x1d')]('Content-Range',_0x4f45e4+'-'+_0x4f9d6b+'/'+_0x40fa9c)[_0x7ad0('0x19')](_0xebb4da);}return null;};}function patchUpdates(_0x1795e5){return function(_0x1c5c7c){try{jsonpatch[_0x7ad0('0x1e')](_0x1c5c7c,_0x1795e5,!![]);}catch(_0x481eeb){return BPromise[_0x7ad0('0x1f')](_0x481eeb);}return _0x1c5c7c['save']();};}function saveUpdates(_0x291352,_0x304054){return function(_0x5df5c8){if(_0x5df5c8){return _0x5df5c8[_0x7ad0('0x20')](_0x291352)['then'](function(_0x5edbdf){return _0x5edbdf;});}return null;};}function removeEntity(_0x4be2a0,_0x1d9a26){return function(_0x4fbe51){if(_0x4fbe51){return _0x4fbe51[_0x7ad0('0x21')]()['then'](function(){var _0x1d975a=_0x4fbe51[_0x7ad0('0x22')]({'plain':!![]});var _0x3894a7=_0x7ad0('0x23');return db[_0x7ad0('0x24')][_0x7ad0('0x21')]({'where':{'type':_0x3894a7,'resourceId':_0x1d975a['id']}})['then'](function(){return _0x4fbe51;});})[_0x7ad0('0x25')](function(){_0x4be2a0[_0x7ad0('0x17')](0xcc)[_0x7ad0('0x18')]();});}};}function handleEntityNotFound(_0x2910a5,_0x368931){return function(_0x116e11){if(!_0x116e11){_0x2910a5[_0x7ad0('0x16')](0x194);}return _0x116e11;};}function handleError(_0x5641da,_0x50cb16){_0x50cb16=_0x50cb16||0x1f4;return function(_0x5196df){logger[_0x7ad0('0x26')](_0x5196df[_0x7ad0('0x27')]);if(_0x5196df[_0x7ad0('0x28')]){delete _0x5196df[_0x7ad0('0x28')];}_0x5641da[_0x7ad0('0x17')](_0x50cb16)['send'](_0x5196df);};}exports['index']=function(_0x71bde1,_0x1b4028){var _0x2b497b={},_0x30bf59={},_0x14b021={'count':0x0,'rows':[]};var _0x3b471a=_[_0x7ad0('0x29')](db[_0x7ad0('0x2a')][_0x7ad0('0x2b')],function(_0x2372c4){return{'name':_0x2372c4['fieldName'],'type':_0x2372c4['type'][_0x7ad0('0x2c')]};});_0x30bf59[_0x7ad0('0x2d')]=_[_0x7ad0('0x29')](_0x3b471a,_0x7ad0('0x28'));_0x30bf59[_0x7ad0('0x2e')]=_[_0x7ad0('0x2f')](_0x71bde1[_0x7ad0('0x2e')]);_0x30bf59[_0x7ad0('0x30')]=_[_0x7ad0('0x31')](_0x30bf59[_0x7ad0('0x2d')],_0x30bf59[_0x7ad0('0x2e')]);_0x2b497b[_0x7ad0('0x32')]=_[_0x7ad0('0x31')](_0x30bf59['model'],qs[_0x7ad0('0x33')](_0x71bde1[_0x7ad0('0x2e')][_0x7ad0('0x33')]));_0x2b497b[_0x7ad0('0x32')]=_0x2b497b[_0x7ad0('0x32')][_0x7ad0('0x34')]?_0x2b497b[_0x7ad0('0x32')]:_0x30bf59[_0x7ad0('0x2d')];if(!_0x71bde1[_0x7ad0('0x2e')][_0x7ad0('0x35')]('nolimit')){_0x2b497b[_0x7ad0('0x36')]=qs['limit'](_0x71bde1[_0x7ad0('0x2e')][_0x7ad0('0x36')]);_0x2b497b[_0x7ad0('0x1a')]=qs['offset'](_0x71bde1[_0x7ad0('0x2e')][_0x7ad0('0x1a')]);}_0x2b497b[_0x7ad0('0x37')]=qs[_0x7ad0('0x38')](_0x71bde1['query'][_0x7ad0('0x38')]);_0x2b497b['where']=qs['filters'](_[_0x7ad0('0x39')](_0x71bde1['query'],_0x30bf59['filters']),_0x3b471a);if(_0x71bde1[_0x7ad0('0x2e')][_0x7ad0('0x3a')]){_0x2b497b[_0x7ad0('0x3b')]=_[_0x7ad0('0x3c')](_0x2b497b[_0x7ad0('0x3b')],{'$or':_[_0x7ad0('0x29')](_0x3b471a,function(_0x5b6cba){if(_0x5b6cba[_0x7ad0('0x3d')]!==_0x7ad0('0x3e')){var _0x2efaef={};_0x2efaef[_0x5b6cba['name']]={'$like':'%'+_0x71bde1[_0x7ad0('0x2e')][_0x7ad0('0x3a')]+'%'};return _0x2efaef;}})});}_0x2b497b=_[_0x7ad0('0x3c')]({},_0x2b497b,_0x71bde1['options']);var _0x2f741f={'where':_0x2b497b[_0x7ad0('0x3b')]};return db[_0x7ad0('0x2a')]['count'](_0x2f741f)['then'](function(_0x1e73d6){_0x14b021[_0x7ad0('0x1c')]=_0x1e73d6;if(_0x71bde1['query']['includeAll']){_0x2b497b[_0x7ad0('0x3f')]=[{'all':!![]}];}return db[_0x7ad0('0x2a')][_0x7ad0('0x40')](_0x2b497b);})[_0x7ad0('0x25')](function(_0x5f5959){_0x14b021['rows']=_0x5f5959;return _0x14b021;})['then'](respondWithFilteredResult(_0x1b4028,_0x2b497b))[_0x7ad0('0x41')](handleError(_0x1b4028,null));};exports[_0x7ad0('0x42')]=function(_0x2ff261,_0xceeda9){var _0x4f81d7={'raw':![],'where':{'id':_0x2ff261[_0x7ad0('0x43')]['id']}},_0xeb3c3={};_0xeb3c3['model']=_['keys'](db[_0x7ad0('0x2a')]['rawAttributes']);_0xeb3c3['query']=_[_0x7ad0('0x2f')](_0x2ff261[_0x7ad0('0x2e')]);_0xeb3c3[_0x7ad0('0x30')]=_[_0x7ad0('0x31')](_0xeb3c3[_0x7ad0('0x2d')],_0xeb3c3[_0x7ad0('0x2e')]);_0x4f81d7[_0x7ad0('0x32')]=_['intersection'](_0xeb3c3[_0x7ad0('0x2d')],qs['fields'](_0x2ff261['query'][_0x7ad0('0x33')]));_0x4f81d7[_0x7ad0('0x32')]=_0x4f81d7[_0x7ad0('0x32')][_0x7ad0('0x34')]?_0x4f81d7[_0x7ad0('0x32')]:_0xeb3c3[_0x7ad0('0x2d')];if(_0x2ff261[_0x7ad0('0x2e')][_0x7ad0('0x44')]){_0x4f81d7['include']=[{'all':!![]}];}_0x4f81d7=_[_0x7ad0('0x3c')]({},_0x4f81d7,_0x2ff261[_0x7ad0('0x45')]);return db[_0x7ad0('0x2a')][_0x7ad0('0x46')](_0x4f81d7)[_0x7ad0('0x25')](handleEntityNotFound(_0xceeda9,null))[_0x7ad0('0x25')](respondWithResult(_0xceeda9,null))[_0x7ad0('0x41')](handleError(_0xceeda9,null));};exports[_0x7ad0('0x47')]=function(_0x2677be,_0x23b613){return db['JscriptyProject']['create'](_0x2677be[_0x7ad0('0x48')],{})[_0x7ad0('0x25')](function(_0x726008){var _0x3a99b0=_0x2677be[_0x7ad0('0x49')][_0x7ad0('0x22')]({'plain':!![]});if(!_0x3a99b0)throw new Error(_0x7ad0('0x4a'));if(_0x3a99b0[_0x7ad0('0x4b')]===_0x7ad0('0x49')){var _0x61d8ac=_0x726008['get']({'plain':!![]});var _0x20f683=_0x7ad0('0x23');return db[_0x7ad0('0x4c')]['find']({'where':{'name':_0x20f683,'userProfileId':_0x3a99b0[_0x7ad0('0x4d')]},'raw':!![]})[_0x7ad0('0x25')](function(_0x696768){if(_0x696768&&_0x696768[_0x7ad0('0x4e')]===0x0){return db[_0x7ad0('0x24')][_0x7ad0('0x47')]({'name':_0x61d8ac[_0x7ad0('0x28')],'resourceId':_0x61d8ac['id'],'type':_0x696768['name'],'sectionId':_0x696768['id']},{})[_0x7ad0('0x25')](function(){return _0x726008;});}else{return _0x726008;}})[_0x7ad0('0x41')](function(_0x4704fd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4704fd);throw _0x4704fd;});}return _0x726008;})[_0x7ad0('0x25')](respondWithResult(_0x23b613,0xc9))[_0x7ad0('0x41')](handleError(_0x23b613,null));};exports[_0x7ad0('0x4f')]=function(_0x24c2c7,_0x234708){var _0x36418a={'where':{'id':_0x24c2c7[_0x7ad0('0x43')]['id']}},_0x35dba8={};_0x35dba8[_0x7ad0('0x2d')]=_[_0x7ad0('0x2f')](db['JscriptyProject'][_0x7ad0('0x2b')]);_0x36418a[_0x7ad0('0x32')]=_[_0x7ad0('0x31')](_0x35dba8['model'],qs[_0x7ad0('0x33')](_0x24c2c7['query']['fields']));_0x36418a[_0x7ad0('0x32')]=_0x36418a['attributes']['length']?_0x36418a[_0x7ad0('0x32')]:_0x35dba8[_0x7ad0('0x2d')];if(_0x24c2c7[_0x7ad0('0x2e')][_0x7ad0('0x44')]){_0x36418a['include']=[{'all':!![]}];}_0x36418a=_[_0x7ad0('0x3c')]({},_0x36418a,_0x24c2c7[_0x7ad0('0x45')]);return db[_0x7ad0('0x2a')][_0x7ad0('0x46')](_0x36418a)[_0x7ad0('0x25')](handleEntityNotFound(_0x234708,null))[_0x7ad0('0x25')](function(_0x4676f4){if(_0x4676f4){var _0x527bb2=_0x4676f4['get']({'plain':!![]});_0x527bb2=qs[_0x7ad0('0x50')](_0x527bb2,['id',_0x7ad0('0x51'),_0x7ad0('0x52')]);_0x24c2c7['body']=_['omit'](_0x24c2c7[_0x7ad0('0x48')],['id',_0x7ad0('0x51'),_0x7ad0('0x52')]);return db['JscriptyProject']['create'](_[_0x7ad0('0x3c')](_0x527bb2,_0x24c2c7[_0x7ad0('0x48')]),{'include':_0x24c2c7[_0x7ad0('0x2e')][_0x7ad0('0x44')]?[{'all':!![]}]:undefined})[_0x7ad0('0x25')](function(_0x4d6333){var _0x14a858=_0x24c2c7[_0x7ad0('0x49')][_0x7ad0('0x22')]({'plain':!![]});if(!_0x14a858)throw new Error(_0x7ad0('0x4a'));if(_0x14a858['role']===_0x7ad0('0x49')){var _0x1b2609=_0x4d6333[_0x7ad0('0x22')]({'plain':!![]});var _0x17f26a=_0x7ad0('0x23');return db['UserProfileSection']['find']({'where':{'name':_0x17f26a,'userProfileId':_0x14a858[_0x7ad0('0x4d')]},'raw':!![]})[_0x7ad0('0x25')](function(_0x499d35){if(_0x499d35&&_0x499d35[_0x7ad0('0x4e')]===0x0){return db[_0x7ad0('0x24')][_0x7ad0('0x47')]({'name':_0x1b2609[_0x7ad0('0x28')],'resourceId':_0x1b2609['id'],'type':_0x499d35[_0x7ad0('0x28')],'sectionId':_0x499d35['id']},{})['then'](function(){return _0x4d6333;});}else{return _0x4d6333;}})[_0x7ad0('0x41')](function(_0x57b382){logger[_0x7ad0('0x26')](_0x7ad0('0x53'),_0x57b382);throw _0x57b382;});}return _0x4d6333;});}})[_0x7ad0('0x25')](respondWithResult(_0x234708,0xc9))[_0x7ad0('0x41')](handleError(_0x234708,null));};exports[_0x7ad0('0x20')]=function(_0x43eafb,_0x3df8a6){if(_0x43eafb[_0x7ad0('0x48')]['id']){delete _0x43eafb['body']['id'];}return db[_0x7ad0('0x2a')][_0x7ad0('0x46')]({'where':{'id':_0x43eafb['params']['id']}})[_0x7ad0('0x25')](handleEntityNotFound(_0x3df8a6,null))[_0x7ad0('0x25')](saveUpdates(_0x43eafb['body'],null))[_0x7ad0('0x25')](respondWithResult(_0x3df8a6,null))['catch'](handleError(_0x3df8a6,null));};exports['destroy']=function(_0x5ee268,_0x340aa5){return db[_0x7ad0('0x2a')]['find']({'where':{'id':_0x5ee268[_0x7ad0('0x43')]['id']}})[_0x7ad0('0x25')](handleEntityNotFound(_0x340aa5,null))['then'](removeEntity(_0x340aa5,null))[_0x7ad0('0x41')](handleError(_0x340aa5,null));};exports['getSessions']=function(_0xa1f8ad,_0x5cd237,_0x132080){var _0x584532={'raw':!![],'where':{}};var _0x3a7fa2={};var _0x5d1451={'count':0x0,'rows':[]};return db[_0x7ad0('0x2a')]['findOne']({'where':{'id':_0xa1f8ad[_0x7ad0('0x43')]['id']}})[_0x7ad0('0x25')](handleEntityNotFound(_0x5cd237,null))[_0x7ad0('0x25')](function(_0x16509f){if(_0x16509f){_0x3a7fa2[_0x7ad0('0x2d')]=_[_0x7ad0('0x2f')](db[_0x7ad0('0x54')][_0x7ad0('0x2b')]);_0x3a7fa2[_0x7ad0('0x2e')]=_[_0x7ad0('0x2f')](_0xa1f8ad[_0x7ad0('0x2e')]);_0x3a7fa2[_0x7ad0('0x30')]=_[_0x7ad0('0x31')](_0x3a7fa2[_0x7ad0('0x2d')],_0x3a7fa2[_0x7ad0('0x2e')]);_0x584532[_0x7ad0('0x32')]=_['intersection'](_0x3a7fa2[_0x7ad0('0x2d')],qs['fields'](_0xa1f8ad[_0x7ad0('0x2e')][_0x7ad0('0x33')]));_0x584532[_0x7ad0('0x32')]=_0x584532[_0x7ad0('0x32')][_0x7ad0('0x34')]?_0x584532[_0x7ad0('0x32')]:_0x3a7fa2['model'];if(!_0xa1f8ad['query'][_0x7ad0('0x35')](_0x7ad0('0x55'))){_0x584532[_0x7ad0('0x36')]=qs[_0x7ad0('0x36')](_0xa1f8ad[_0x7ad0('0x2e')][_0x7ad0('0x36')]);_0x584532['offset']=qs[_0x7ad0('0x1a')](_0xa1f8ad[_0x7ad0('0x2e')][_0x7ad0('0x1a')]);}_0x584532[_0x7ad0('0x37')]=qs[_0x7ad0('0x38')](_0xa1f8ad[_0x7ad0('0x2e')][_0x7ad0('0x38')]);_0x584532['where']=qs[_0x7ad0('0x30')](_[_0x7ad0('0x39')](_0xa1f8ad[_0x7ad0('0x2e')],_0x3a7fa2['filters']));_0x584532[_0x7ad0('0x3b')]['ProjectId']=_0x16509f['id'];if(_0xa1f8ad[_0x7ad0('0x2e')][_0x7ad0('0x3a')]){_0x584532['where']=_[_0x7ad0('0x3c')](_0x584532[_0x7ad0('0x3b')],{'$or':_[_0x7ad0('0x29')](_0x584532['attributes'],function(_0x466ccb){var _0x4fc386={};_0x4fc386[_0x466ccb]={'$like':'%'+_0xa1f8ad['query'][_0x7ad0('0x3a')]+'%'};return _0x4fc386;})});}_0x584532=_['merge']({},_0x584532,_0xa1f8ad[_0x7ad0('0x45')]);return db['JscriptySessionReport']['count']({'where':_0x584532[_0x7ad0('0x3b')]})[_0x7ad0('0x25')](function(_0xe32311){_0x5d1451['count']=_0xe32311;if(_0xa1f8ad['query'][_0x7ad0('0x44')]){_0x584532[_0x7ad0('0x3f')]=[{'all':!![]}];}return db[_0x7ad0('0x54')]['findAll'](_0x584532);})['then'](function(_0x4ba5cf){_0x5d1451['rows']=_0x4ba5cf;return _0x5d1451;});}})[_0x7ad0('0x25')](respondWithFilteredResult(_0x5cd237,_0x584532))['catch'](handleError(_0x5cd237,null));};exports[_0x7ad0('0x56')]=function(_0x36ebe5,_0x46ad7a,_0x680bf7){var _0x3c0907={'raw':!![],'where':{}};var _0x1da33c={};var _0x41a709={'count':0x0,'rows':[]};return db[_0x7ad0('0x2a')][_0x7ad0('0x57')]({'where':{'id':_0x36ebe5[_0x7ad0('0x43')]['id']}})['then'](handleEntityNotFound(_0x46ad7a,null))['then'](function(_0x2c7108){if(_0x2c7108){_0x1da33c[_0x7ad0('0x2d')]=_['keys'](db[_0x7ad0('0x58')][_0x7ad0('0x2b')]);_0x1da33c[_0x7ad0('0x2e')]=_[_0x7ad0('0x2f')](_0x36ebe5[_0x7ad0('0x2e')]);_0x1da33c[_0x7ad0('0x30')]=_[_0x7ad0('0x31')](_0x1da33c[_0x7ad0('0x2d')],_0x1da33c['query']);_0x3c0907[_0x7ad0('0x32')]=_[_0x7ad0('0x31')](_0x1da33c[_0x7ad0('0x2d')],qs[_0x7ad0('0x33')](_0x36ebe5[_0x7ad0('0x2e')][_0x7ad0('0x33')]));_0x3c0907[_0x7ad0('0x32')]=_0x3c0907[_0x7ad0('0x32')][_0x7ad0('0x34')]?_0x3c0907['attributes']:_0x1da33c[_0x7ad0('0x2d')];if(!_0x36ebe5[_0x7ad0('0x2e')]['hasOwnProperty'](_0x7ad0('0x55'))){_0x3c0907[_0x7ad0('0x36')]=qs[_0x7ad0('0x36')](_0x36ebe5[_0x7ad0('0x2e')][_0x7ad0('0x36')]);_0x3c0907[_0x7ad0('0x1a')]=qs[_0x7ad0('0x1a')](_0x36ebe5[_0x7ad0('0x2e')][_0x7ad0('0x1a')]);}_0x3c0907['order']=qs[_0x7ad0('0x38')](_0x36ebe5[_0x7ad0('0x2e')][_0x7ad0('0x38')]);_0x3c0907[_0x7ad0('0x3b')]=qs[_0x7ad0('0x30')](_['pick'](_0x36ebe5['query'],_0x1da33c[_0x7ad0('0x30')]));_0x3c0907[_0x7ad0('0x3b')][_0x7ad0('0x59')]=_0x2c7108['id'];if(_0x36ebe5[_0x7ad0('0x2e')][_0x7ad0('0x3a')]){_0x3c0907[_0x7ad0('0x3b')]=_[_0x7ad0('0x3c')](_0x3c0907['where'],{'$or':_[_0x7ad0('0x29')](_0x3c0907[_0x7ad0('0x32')],function(_0x236da9){var _0x42b625={};_0x42b625[_0x236da9]={'$like':'%'+_0x36ebe5[_0x7ad0('0x2e')]['filter']+'%'};return _0x42b625;})});}_0x3c0907=_[_0x7ad0('0x3c')]({},_0x3c0907,_0x36ebe5[_0x7ad0('0x45')]);return db[_0x7ad0('0x58')][_0x7ad0('0x1c')]({'where':_0x3c0907[_0x7ad0('0x3b')]})['then'](function(_0x36b5d3){_0x41a709[_0x7ad0('0x1c')]=_0x36b5d3;if(_0x36ebe5[_0x7ad0('0x2e')][_0x7ad0('0x44')]){_0x3c0907['include']=[{'all':!![]}];}return db[_0x7ad0('0x58')][_0x7ad0('0x40')](_0x3c0907);})[_0x7ad0('0x25')](function(_0x49df54){_0x41a709[_0x7ad0('0x5a')]=_0x49df54;return _0x41a709;});}})['then'](respondWithFilteredResult(_0x46ad7a,_0x3c0907))['catch'](handleError(_0x46ad7a,null));};function char(_0x50ae71){return _0x7ad0('0x5b')===typeof _0x50ae71?String['fromCharCode'][_0x7ad0('0x1e')](null,arguments):_0x50ae71;}function needsEncapsulation(_0x45fe99){return!!_0x45fe99&&(_0x45fe99[_0x7ad0('0x5c')]()[_0x7ad0('0x5d')](char(0xd))>=0x0||_0x45fe99[_0x7ad0('0x5c')]()['indexOf'](char(0xa))>=0x0||_0x45fe99[_0x7ad0('0x5c')]()[_0x7ad0('0x5d')](char(0x2c))>=0x0||_0x45fe99['toString']()[_0x7ad0('0x5d')](char(0x22))>=0x0);}function encapsulate(_0x27d10b){var _0x4ebe96=char(0x22),_0x5b14b5='\x5c'+char(0x22),_0x14226f=_0x27d10b[_0x7ad0('0x5c')]()[_0x7ad0('0x5e')](new RegExp(_0x4ebe96,'g'),_0x5b14b5);return _0x4ebe96+_0x14226f+_0x4ebe96;}exports['getSummary']=function(_0x11a5ae,_0x5423d0,_0x58ed40){var _0x31b357,_0x2dd0ef;var _0x1f060a={'where':{'ProjectId':_0x11a5ae[_0x7ad0('0x43')]['id']}};if(_0x11a5ae[_0x7ad0('0x2e')]['startTime']){_0x1f060a[_0x7ad0('0x3b')][_0x7ad0('0x5f')]=JSON['parse'](_0x11a5ae[_0x7ad0('0x2e')][_0x7ad0('0x60')]);}return db[_0x7ad0('0x54')][_0x7ad0('0x40')](_0x1f060a)[_0x7ad0('0x25')](handleEntityNotFound(_0x5423d0,null))[_0x7ad0('0x25')](function(_0x292f96){if(_0x292f96){_0x31b357=_0x292f96;return db[_0x7ad0('0x61')][_0x7ad0('0x40')]({'where':{'SessionId':{'$in':_[_0x7ad0('0x29')](_0x31b357,'id')},'ProjectId':_0x11a5ae['params']['id']},'order':_0x7ad0('0x62')});}})[_0x7ad0('0x25')](handleEntityNotFound(_0x5423d0,null))[_0x7ad0('0x25')](function(_0x417d36){if(_0x417d36){_0x2dd0ef=_0x417d36;var _0x5958a0={};for(var _0x4bb66a=0x0,_0x3f9b7b=_0x2dd0ef[_0x7ad0('0x34')];_0x4bb66a<_0x3f9b7b;_0x4bb66a++){if(!_0x5958a0['hasOwnProperty'](_0x2dd0ef[_0x4bb66a][_0x7ad0('0x63')])){_0x5958a0[_0x2dd0ef[_0x4bb66a][_0x7ad0('0x63')]]=needsEncapsulation(_0x2dd0ef[_0x4bb66a][_0x7ad0('0x64')])?encapsulate(_0x2dd0ef[_0x4bb66a][_0x7ad0('0x64')]):_0x2dd0ef[_0x4bb66a][_0x7ad0('0x64')];}}var _0x3d2779=[],_0x298c2e={};for(var _0x53bcb5=0x0,_0x1f6957=_0x31b357[_0x7ad0('0x34')];_0x53bcb5<_0x1f6957;_0x53bcb5++){_0x298c2e={'ProjectId':_0x11a5ae[_0x7ad0('0x43')]['id'],'SessionId':_0x31b357[_0x53bcb5]['id'],'StartTime':moment(_0x31b357[_0x53bcb5]['starttime'])[_0x7ad0('0x65')](_0x7ad0('0x66'))};for(var _0x385846=0x0,_0x45a47a=_0x2dd0ef[_0x7ad0('0x34')];_0x385846<_0x45a47a;_0x385846++){if(_0x2dd0ef[_0x385846]['SessionId']==_0x31b357[_0x53bcb5]['id']&&_0x5958a0[_0x7ad0('0x35')](_0x2dd0ef[_0x385846][_0x7ad0('0x63')])){_0x298c2e[_0x5958a0[_0x2dd0ef[_0x385846][_0x7ad0('0x63')]]]=_0x2dd0ef[_0x385846]['answer'];}}for(var _0x48357c in _0x5958a0){if(!_0x298c2e[_0x7ad0('0x35')](_0x5958a0[_0x48357c])){_0x298c2e[_0x5958a0[_0x48357c]]=null;}}_0x3d2779[_0x7ad0('0x67')](_0x298c2e);}return _0x3d2779;}})[_0x7ad0('0x25')](function(_0x45a88e){if(!_['isEmpty'](_0x45a88e)){var _0x2ac7d9=toCsv(_0x45a88e);var _0x11f897=Date[_0x7ad0('0x68')]();fs[_0x7ad0('0x69')](util[_0x7ad0('0x65')](_0x7ad0('0x6a'),_0x11a5ae[_0x7ad0('0x43')]['id'],_0x11f897),_0x2ac7d9);_0x5423d0[_0x7ad0('0x6b')](_0x7ad0('0x6c'),_0x7ad0('0x6d')+util[_0x7ad0('0x65')](_0x7ad0('0x6e'),_0x11a5ae[_0x7ad0('0x43')]['id'],_0x11f897));_0x5423d0[_0x7ad0('0x6b')](_0x7ad0('0x6f'),_0x7ad0('0x70'));return _0x5423d0[_0x7ad0('0x71')](util[_0x7ad0('0x65')](_0x7ad0('0x6a'),_0x11a5ae[_0x7ad0('0x43')]['id'],_0x11f897));}else{return _0x5423d0[_0x7ad0('0x16')](0xcc);}})[_0x7ad0('0x41')](handleError(_0x5423d0,null));}; \ No newline at end of file +var _0xbe58=['name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','user','role','find','autoAssociation','clone','updatedAt','omit','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','JscriptySessionReport','ProjectId','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','getSummary','startTime','starttime','parse','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','error','stack'];(function(_0x2525f1,_0x47034f){var _0x13c1b5=function(_0x2beb2e){while(--_0x2beb2e){_0x2525f1['push'](_0x2525f1['shift']());}};_0x13c1b5(++_0x47034f);}(_0xbe58,0x19f));var _0x8be5=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xbe58[_0xc4001c];return _0x49f7bc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8be5('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8be5('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x8be5('0x2'));var util=require(_0x8be5('0x3'));var path=require(_0x8be5('0x4'));var sox=require(_0x8be5('0x5'));var csv=require(_0x8be5('0x6'));var ejs=require(_0x8be5('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8be5('0x8'));var crypto=require(_0x8be5('0x9'));var jsforce=require(_0x8be5('0xa'));var deskjs=require(_0x8be5('0xb'));var toCsv=require(_0x8be5('0x6'));var querystring=require('querystring');var Papa=require(_0x8be5('0xc'));var Redis=require(_0x8be5('0xd'));var authService=require(_0x8be5('0xe'));var qs=require(_0x8be5('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8be5('0x10'))('api');var utils=require(_0x8be5('0x11'));var config=require(_0x8be5('0x12'));var licenseUtil=require(_0x8be5('0x13'));var db=require(_0x8be5('0x14'))['db'];function respondWithStatusCode(_0x30532a,_0x5a84f6){_0x5a84f6=_0x5a84f6||0xcc;return function(_0x3cfa77){if(_0x3cfa77){return _0x30532a[_0x8be5('0x15')](_0x5a84f6);}return _0x30532a['status'](_0x5a84f6)[_0x8be5('0x16')]();};}function respondWithResult(_0x10d407,_0x5be1f1){_0x5be1f1=_0x5be1f1||0xc8;return function(_0x4a4988){if(_0x4a4988){return _0x10d407['status'](_0x5be1f1)[_0x8be5('0x17')](_0x4a4988);}};}function respondWithFilteredResult(_0x46e89b,_0x31650e){return function(_0x26e6f8){if(_0x26e6f8){var _0x33a470=typeof _0x31650e[_0x8be5('0x18')]===_0x8be5('0x19')&&typeof _0x31650e[_0x8be5('0x1a')]==='undefined';var _0x2e9b1e=_0x26e6f8[_0x8be5('0x1b')];var _0x526ea7=_0x33a470?0x0:_0x31650e['offset'];var _0x1d4c79=_0x33a470?_0x26e6f8[_0x8be5('0x1b')]:_0x31650e[_0x8be5('0x18')]+_0x31650e[_0x8be5('0x1a')];var _0x5b97e4;if(_0x1d4c79>=_0x2e9b1e){_0x1d4c79=_0x2e9b1e;_0x5b97e4=0xc8;}else{_0x5b97e4=0xce;}_0x46e89b[_0x8be5('0x1c')](_0x5b97e4);return _0x46e89b[_0x8be5('0x1d')]('Content-Range',_0x526ea7+'-'+_0x1d4c79+'/'+_0x2e9b1e)[_0x8be5('0x17')](_0x26e6f8);}return null;};}function patchUpdates(_0x2af8ed){return function(_0x365474){try{jsonpatch[_0x8be5('0x1e')](_0x365474,_0x2af8ed,!![]);}catch(_0x2644ed){return BPromise[_0x8be5('0x1f')](_0x2644ed);}return _0x365474[_0x8be5('0x20')]();};}function saveUpdates(_0x28afd1,_0x3c64ad){return function(_0x20edb8){if(_0x20edb8){return _0x20edb8[_0x8be5('0x21')](_0x28afd1)[_0x8be5('0x22')](function(_0xb13938){return _0xb13938;});}return null;};}function removeEntity(_0x2dbb4d,_0x26d42c){return function(_0x895c6d){if(_0x895c6d){return _0x895c6d[_0x8be5('0x23')]()[_0x8be5('0x22')](function(){var _0x52fa88=_0x895c6d[_0x8be5('0x24')]({'plain':!![]});var _0x47401e=_0x8be5('0x25');return db[_0x8be5('0x26')][_0x8be5('0x23')]({'where':{'type':_0x47401e,'resourceId':_0x52fa88['id']}})[_0x8be5('0x22')](function(){return _0x895c6d;});})[_0x8be5('0x22')](function(){_0x2dbb4d[_0x8be5('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x191449,_0x4e6dd1){return function(_0x48c817){if(!_0x48c817){_0x191449['sendStatus'](0x194);}return _0x48c817;};}function handleError(_0x1649e7,_0x23cf60){_0x23cf60=_0x23cf60||0x1f4;return function(_0x332d35){logger[_0x8be5('0x27')](_0x332d35[_0x8be5('0x28')]);if(_0x332d35[_0x8be5('0x29')]){delete _0x332d35[_0x8be5('0x29')];}_0x1649e7[_0x8be5('0x1c')](_0x23cf60)[_0x8be5('0x2a')](_0x332d35);};}exports[_0x8be5('0x2b')]=function(_0x5a0902,_0x235279){var _0x1d10a9={},_0x37ce79={},_0x1eea12={'count':0x0,'rows':[]};var _0xcd3ebd=_[_0x8be5('0x2c')](db[_0x8be5('0x2d')][_0x8be5('0x2e')],function(_0x2c057c){return{'name':_0x2c057c[_0x8be5('0x2f')],'type':_0x2c057c[_0x8be5('0x30')][_0x8be5('0x31')]};});_0x37ce79[_0x8be5('0x32')]=_[_0x8be5('0x2c')](_0xcd3ebd,_0x8be5('0x29'));_0x37ce79[_0x8be5('0x33')]=_[_0x8be5('0x34')](_0x5a0902[_0x8be5('0x33')]);_0x37ce79[_0x8be5('0x35')]=_[_0x8be5('0x36')](_0x37ce79[_0x8be5('0x32')],_0x37ce79[_0x8be5('0x33')]);_0x1d10a9[_0x8be5('0x37')]=_[_0x8be5('0x36')](_0x37ce79[_0x8be5('0x32')],qs['fields'](_0x5a0902['query'][_0x8be5('0x38')]));_0x1d10a9[_0x8be5('0x37')]=_0x1d10a9['attributes']['length']?_0x1d10a9[_0x8be5('0x37')]:_0x37ce79[_0x8be5('0x32')];if(!_0x5a0902[_0x8be5('0x33')][_0x8be5('0x39')](_0x8be5('0x3a'))){_0x1d10a9[_0x8be5('0x1a')]=qs[_0x8be5('0x1a')](_0x5a0902[_0x8be5('0x33')][_0x8be5('0x1a')]);_0x1d10a9[_0x8be5('0x18')]=qs[_0x8be5('0x18')](_0x5a0902[_0x8be5('0x33')][_0x8be5('0x18')]);}_0x1d10a9[_0x8be5('0x3b')]=qs[_0x8be5('0x3c')](_0x5a0902['query'][_0x8be5('0x3c')]);_0x1d10a9[_0x8be5('0x3d')]=qs[_0x8be5('0x35')](_[_0x8be5('0x3e')](_0x5a0902[_0x8be5('0x33')],_0x37ce79[_0x8be5('0x35')]),_0xcd3ebd);if(_0x5a0902[_0x8be5('0x33')][_0x8be5('0x3f')]){_0x1d10a9[_0x8be5('0x3d')]=_[_0x8be5('0x40')](_0x1d10a9['where'],{'$or':_[_0x8be5('0x2c')](_0xcd3ebd,function(_0x3bb0ee){if(_0x3bb0ee[_0x8be5('0x30')]!==_0x8be5('0x41')){var _0x17c370={};_0x17c370[_0x3bb0ee[_0x8be5('0x29')]]={'$like':'%'+_0x5a0902[_0x8be5('0x33')][_0x8be5('0x3f')]+'%'};return _0x17c370;}})});}_0x1d10a9=_['merge']({},_0x1d10a9,_0x5a0902[_0x8be5('0x42')]);var _0x5178d9={'where':_0x1d10a9[_0x8be5('0x3d')]};return db[_0x8be5('0x2d')][_0x8be5('0x1b')](_0x5178d9)[_0x8be5('0x22')](function(_0x53ae19){_0x1eea12[_0x8be5('0x1b')]=_0x53ae19;if(_0x5a0902[_0x8be5('0x33')][_0x8be5('0x43')]){_0x1d10a9[_0x8be5('0x44')]=[{'all':!![]}];}return db[_0x8be5('0x2d')][_0x8be5('0x45')](_0x1d10a9);})[_0x8be5('0x22')](function(_0x33e2d3){_0x1eea12[_0x8be5('0x46')]=_0x33e2d3;return _0x1eea12;})['then'](respondWithFilteredResult(_0x235279,_0x1d10a9))[_0x8be5('0x47')](handleError(_0x235279,null));};exports[_0x8be5('0x48')]=function(_0x5c0eef,_0x13dfa2){var _0x5e1f63={'raw':![],'where':{'id':_0x5c0eef[_0x8be5('0x49')]['id']}},_0x55ca22={};_0x55ca22[_0x8be5('0x32')]=_['keys'](db[_0x8be5('0x2d')][_0x8be5('0x2e')]);_0x55ca22[_0x8be5('0x33')]=_[_0x8be5('0x34')](_0x5c0eef[_0x8be5('0x33')]);_0x55ca22[_0x8be5('0x35')]=_[_0x8be5('0x36')](_0x55ca22[_0x8be5('0x32')],_0x55ca22[_0x8be5('0x33')]);_0x5e1f63[_0x8be5('0x37')]=_[_0x8be5('0x36')](_0x55ca22[_0x8be5('0x32')],qs[_0x8be5('0x38')](_0x5c0eef['query'][_0x8be5('0x38')]));_0x5e1f63[_0x8be5('0x37')]=_0x5e1f63[_0x8be5('0x37')][_0x8be5('0x4a')]?_0x5e1f63['attributes']:_0x55ca22[_0x8be5('0x32')];if(_0x5c0eef[_0x8be5('0x33')][_0x8be5('0x43')]){_0x5e1f63[_0x8be5('0x44')]=[{'all':!![]}];}_0x5e1f63=_[_0x8be5('0x40')]({},_0x5e1f63,_0x5c0eef[_0x8be5('0x42')]);return db['JscriptyProject']['find'](_0x5e1f63)[_0x8be5('0x22')](handleEntityNotFound(_0x13dfa2,null))[_0x8be5('0x22')](respondWithResult(_0x13dfa2,null))[_0x8be5('0x47')](handleError(_0x13dfa2,null));};exports[_0x8be5('0x4b')]=function(_0x478e9e,_0x3b254f){return db[_0x8be5('0x2d')]['create'](_0x478e9e[_0x8be5('0x4c')],{})[_0x8be5('0x22')](function(_0x7bb32b){var _0x2ade2d=_0x478e9e[_0x8be5('0x4d')][_0x8be5('0x24')]({'plain':!![]});if(!_0x2ade2d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ade2d[_0x8be5('0x4e')]===_0x8be5('0x4d')){var _0xd51d19=_0x7bb32b[_0x8be5('0x24')]({'plain':!![]});var _0x40a495=_0x8be5('0x25');return db['UserProfileSection'][_0x8be5('0x4f')]({'where':{'name':_0x40a495,'userProfileId':_0x2ade2d['userProfileId']},'raw':!![]})[_0x8be5('0x22')](function(_0x500771){if(_0x500771&&_0x500771[_0x8be5('0x50')]===0x0){return db[_0x8be5('0x26')][_0x8be5('0x4b')]({'name':_0xd51d19[_0x8be5('0x29')],'resourceId':_0xd51d19['id'],'type':_0x500771[_0x8be5('0x29')],'sectionId':_0x500771['id']},{})[_0x8be5('0x22')](function(){return _0x7bb32b;});}else{return _0x7bb32b;}})[_0x8be5('0x47')](function(_0x5d1f51){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d1f51);throw _0x5d1f51;});}return _0x7bb32b;})[_0x8be5('0x22')](respondWithResult(_0x3b254f,0xc9))[_0x8be5('0x47')](handleError(_0x3b254f,null));};exports[_0x8be5('0x51')]=function(_0x94a226,_0x277bf7){var _0xc7f0a7={'where':{'id':_0x94a226['params']['id']}},_0x318f7d={};_0x318f7d[_0x8be5('0x32')]=_['keys'](db[_0x8be5('0x2d')][_0x8be5('0x2e')]);_0xc7f0a7[_0x8be5('0x37')]=_['intersection'](_0x318f7d[_0x8be5('0x32')],qs[_0x8be5('0x38')](_0x94a226[_0x8be5('0x33')]['fields']));_0xc7f0a7[_0x8be5('0x37')]=_0xc7f0a7[_0x8be5('0x37')][_0x8be5('0x4a')]?_0xc7f0a7[_0x8be5('0x37')]:_0x318f7d[_0x8be5('0x32')];if(_0x94a226[_0x8be5('0x33')]['includeAll']){_0xc7f0a7[_0x8be5('0x44')]=[{'all':!![]}];}_0xc7f0a7=_[_0x8be5('0x40')]({},_0xc7f0a7,_0x94a226[_0x8be5('0x42')]);return db['JscriptyProject'][_0x8be5('0x4f')](_0xc7f0a7)['then'](handleEntityNotFound(_0x277bf7,null))['then'](function(_0x3ec87b){if(_0x3ec87b){var _0xaa04c=_0x3ec87b[_0x8be5('0x24')]({'plain':!![]});_0xaa04c=qs['omit'](_0xaa04c,['id','createdAt',_0x8be5('0x52')]);_0x94a226[_0x8be5('0x4c')]=_[_0x8be5('0x53')](_0x94a226[_0x8be5('0x4c')],['id','createdAt','updatedAt']);return db[_0x8be5('0x2d')][_0x8be5('0x4b')](_['merge'](_0xaa04c,_0x94a226[_0x8be5('0x4c')]),{'include':_0x94a226[_0x8be5('0x33')][_0x8be5('0x43')]?[{'all':!![]}]:undefined})[_0x8be5('0x22')](function(_0x226701){var _0x28ee56=_0x94a226[_0x8be5('0x4d')][_0x8be5('0x24')]({'plain':!![]});if(!_0x28ee56)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x28ee56[_0x8be5('0x4e')]==='user'){var _0x794b70=_0x226701[_0x8be5('0x24')]({'plain':!![]});var _0x4d9e0d='Projects';return db[_0x8be5('0x54')][_0x8be5('0x4f')]({'where':{'name':_0x4d9e0d,'userProfileId':_0x28ee56[_0x8be5('0x55')]},'raw':!![]})[_0x8be5('0x22')](function(_0x31dfd8){if(_0x31dfd8&&_0x31dfd8[_0x8be5('0x50')]===0x0){return db[_0x8be5('0x26')][_0x8be5('0x4b')]({'name':_0x794b70['name'],'resourceId':_0x794b70['id'],'type':_0x31dfd8[_0x8be5('0x29')],'sectionId':_0x31dfd8['id']},{})[_0x8be5('0x22')](function(){return _0x226701;});}else{return _0x226701;}})[_0x8be5('0x47')](function(_0x339315){logger['error'](_0x8be5('0x56'),_0x339315);throw _0x339315;});}return _0x226701;});}})['then'](respondWithResult(_0x277bf7,0xc9))[_0x8be5('0x47')](handleError(_0x277bf7,null));};exports[_0x8be5('0x21')]=function(_0x351484,_0x58cf0e){if(_0x351484['body']['id']){delete _0x351484[_0x8be5('0x4c')]['id'];}return db[_0x8be5('0x2d')]['find']({'where':{'id':_0x351484[_0x8be5('0x49')]['id']}})[_0x8be5('0x22')](handleEntityNotFound(_0x58cf0e,null))[_0x8be5('0x22')](saveUpdates(_0x351484[_0x8be5('0x4c')],null))[_0x8be5('0x22')](respondWithResult(_0x58cf0e,null))['catch'](handleError(_0x58cf0e,null));};exports[_0x8be5('0x23')]=function(_0x559608,_0x3a2ca5){return db[_0x8be5('0x2d')]['find']({'where':{'id':_0x559608[_0x8be5('0x49')]['id']}})[_0x8be5('0x22')](handleEntityNotFound(_0x3a2ca5,null))['then'](removeEntity(_0x3a2ca5,null))[_0x8be5('0x47')](handleError(_0x3a2ca5,null));};exports[_0x8be5('0x57')]=function(_0x128ab7,_0x58de0d,_0x15e13b){var _0x45749a={'raw':!![],'where':{}};var _0x470eb5={};var _0x1887a4={'count':0x0,'rows':[]};return db[_0x8be5('0x2d')][_0x8be5('0x58')]({'where':{'id':_0x128ab7['params']['id']}})[_0x8be5('0x22')](handleEntityNotFound(_0x58de0d,null))[_0x8be5('0x22')](function(_0x403df8){if(_0x403df8){_0x470eb5[_0x8be5('0x32')]=_[_0x8be5('0x34')](db[_0x8be5('0x59')][_0x8be5('0x2e')]);_0x470eb5[_0x8be5('0x33')]=_[_0x8be5('0x34')](_0x128ab7[_0x8be5('0x33')]);_0x470eb5[_0x8be5('0x35')]=_[_0x8be5('0x36')](_0x470eb5[_0x8be5('0x32')],_0x470eb5[_0x8be5('0x33')]);_0x45749a[_0x8be5('0x37')]=_[_0x8be5('0x36')](_0x470eb5['model'],qs[_0x8be5('0x38')](_0x128ab7['query'][_0x8be5('0x38')]));_0x45749a[_0x8be5('0x37')]=_0x45749a['attributes'][_0x8be5('0x4a')]?_0x45749a['attributes']:_0x470eb5['model'];if(!_0x128ab7[_0x8be5('0x33')]['hasOwnProperty'](_0x8be5('0x3a'))){_0x45749a[_0x8be5('0x1a')]=qs[_0x8be5('0x1a')](_0x128ab7[_0x8be5('0x33')][_0x8be5('0x1a')]);_0x45749a[_0x8be5('0x18')]=qs[_0x8be5('0x18')](_0x128ab7[_0x8be5('0x33')][_0x8be5('0x18')]);}_0x45749a[_0x8be5('0x3b')]=qs['sort'](_0x128ab7['query']['sort']);_0x45749a[_0x8be5('0x3d')]=qs[_0x8be5('0x35')](_['pick'](_0x128ab7[_0x8be5('0x33')],_0x470eb5[_0x8be5('0x35')]));_0x45749a[_0x8be5('0x3d')][_0x8be5('0x5a')]=_0x403df8['id'];if(_0x128ab7['query']['filter']){_0x45749a[_0x8be5('0x3d')]=_[_0x8be5('0x40')](_0x45749a[_0x8be5('0x3d')],{'$or':_[_0x8be5('0x2c')](_0x45749a[_0x8be5('0x37')],function(_0x34bafc){var _0x3d72e4={};_0x3d72e4[_0x34bafc]={'$like':'%'+_0x128ab7[_0x8be5('0x33')][_0x8be5('0x3f')]+'%'};return _0x3d72e4;})});}_0x45749a=_['merge']({},_0x45749a,_0x128ab7[_0x8be5('0x42')]);return db[_0x8be5('0x59')][_0x8be5('0x1b')]({'where':_0x45749a[_0x8be5('0x3d')]})[_0x8be5('0x22')](function(_0xdeb749){_0x1887a4[_0x8be5('0x1b')]=_0xdeb749;if(_0x128ab7['query']['includeAll']){_0x45749a[_0x8be5('0x44')]=[{'all':!![]}];}return db[_0x8be5('0x59')][_0x8be5('0x45')](_0x45749a);})['then'](function(_0x39b055){_0x1887a4[_0x8be5('0x46')]=_0x39b055;return _0x1887a4;});}})[_0x8be5('0x22')](respondWithFilteredResult(_0x58de0d,_0x45749a))[_0x8be5('0x47')](handleError(_0x58de0d,null));};exports['getAnswers']=function(_0x218665,_0x5eec62,_0x7c4b3b){var _0x7d0204={'raw':!![],'where':{}};var _0x14209a={};var _0x5b71df={'count':0x0,'rows':[]};return db[_0x8be5('0x2d')]['findOne']({'where':{'id':_0x218665[_0x8be5('0x49')]['id']}})[_0x8be5('0x22')](handleEntityNotFound(_0x5eec62,null))['then'](function(_0x58e270){if(_0x58e270){_0x14209a['model']=_[_0x8be5('0x34')](db['JscriptyAnswerReport'][_0x8be5('0x2e')]);_0x14209a[_0x8be5('0x33')]=_['keys'](_0x218665['query']);_0x14209a[_0x8be5('0x35')]=_['intersection'](_0x14209a[_0x8be5('0x32')],_0x14209a['query']);_0x7d0204[_0x8be5('0x37')]=_[_0x8be5('0x36')](_0x14209a[_0x8be5('0x32')],qs[_0x8be5('0x38')](_0x218665[_0x8be5('0x33')][_0x8be5('0x38')]));_0x7d0204[_0x8be5('0x37')]=_0x7d0204[_0x8be5('0x37')]['length']?_0x7d0204[_0x8be5('0x37')]:_0x14209a[_0x8be5('0x32')];if(!_0x218665[_0x8be5('0x33')][_0x8be5('0x39')](_0x8be5('0x3a'))){_0x7d0204[_0x8be5('0x1a')]=qs[_0x8be5('0x1a')](_0x218665['query']['limit']);_0x7d0204[_0x8be5('0x18')]=qs['offset'](_0x218665[_0x8be5('0x33')][_0x8be5('0x18')]);}_0x7d0204[_0x8be5('0x3b')]=qs[_0x8be5('0x3c')](_0x218665[_0x8be5('0x33')][_0x8be5('0x3c')]);_0x7d0204[_0x8be5('0x3d')]=qs[_0x8be5('0x35')](_[_0x8be5('0x3e')](_0x218665['query'],_0x14209a[_0x8be5('0x35')]));_0x7d0204['where']['ProjectId']=_0x58e270['id'];if(_0x218665[_0x8be5('0x33')][_0x8be5('0x3f')]){_0x7d0204[_0x8be5('0x3d')]=_[_0x8be5('0x40')](_0x7d0204['where'],{'$or':_[_0x8be5('0x2c')](_0x7d0204[_0x8be5('0x37')],function(_0x4552fb){var _0x50609e={};_0x50609e[_0x4552fb]={'$like':'%'+_0x218665[_0x8be5('0x33')][_0x8be5('0x3f')]+'%'};return _0x50609e;})});}_0x7d0204=_[_0x8be5('0x40')]({},_0x7d0204,_0x218665[_0x8be5('0x42')]);return db[_0x8be5('0x5b')]['count']({'where':_0x7d0204[_0x8be5('0x3d')]})['then'](function(_0x54c9da){_0x5b71df['count']=_0x54c9da;if(_0x218665[_0x8be5('0x33')]['includeAll']){_0x7d0204[_0x8be5('0x44')]=[{'all':!![]}];}return db[_0x8be5('0x5b')][_0x8be5('0x45')](_0x7d0204);})[_0x8be5('0x22')](function(_0x160743){_0x5b71df[_0x8be5('0x46')]=_0x160743;return _0x5b71df;});}})[_0x8be5('0x22')](respondWithFilteredResult(_0x5eec62,_0x7d0204))[_0x8be5('0x47')](handleError(_0x5eec62,null));};function char(_0x2ba91d){return _0x8be5('0x5c')===typeof _0x2ba91d?String[_0x8be5('0x5d')][_0x8be5('0x1e')](null,arguments):_0x2ba91d;}function needsEncapsulation(_0x9b716b){return!!_0x9b716b&&(_0x9b716b[_0x8be5('0x5e')]()[_0x8be5('0x5f')](char(0xd))>=0x0||_0x9b716b[_0x8be5('0x5e')]()[_0x8be5('0x5f')](char(0xa))>=0x0||_0x9b716b[_0x8be5('0x5e')]()[_0x8be5('0x5f')](char(0x2c))>=0x0||_0x9b716b[_0x8be5('0x5e')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x4f81b2){var _0xab00de=char(0x22),_0x5f03bc='\x5c'+char(0x22),_0x52d48=_0x4f81b2[_0x8be5('0x5e')]()['replace'](new RegExp(_0xab00de,'g'),_0x5f03bc);return _0xab00de+_0x52d48+_0xab00de;}exports[_0x8be5('0x60')]=function(_0xa39da9,_0x5d70f1,_0x55b71d){var _0x2f470f,_0x4f6924;var _0x386e74={'where':{'ProjectId':_0xa39da9[_0x8be5('0x49')]['id']}};if(_0xa39da9[_0x8be5('0x33')][_0x8be5('0x61')]){_0x386e74['where'][_0x8be5('0x62')]=JSON[_0x8be5('0x63')](_0xa39da9[_0x8be5('0x33')]['startTime']);}return db[_0x8be5('0x59')]['findAll'](_0x386e74)[_0x8be5('0x22')](handleEntityNotFound(_0x5d70f1,null))[_0x8be5('0x22')](function(_0x45de75){if(_0x45de75){_0x2f470f=_0x45de75;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0x8be5('0x2c')](_0x2f470f,'id')},'ProjectId':_0xa39da9[_0x8be5('0x49')]['id']},'order':_0x8be5('0x64')});}})[_0x8be5('0x22')](handleEntityNotFound(_0x5d70f1,null))[_0x8be5('0x22')](function(_0xd536d9){if(_0xd536d9){_0x4f6924=_0xd536d9;var _0xc08657={};for(var _0x280d43=0x0,_0x2d8d5c=_0x4f6924['length'];_0x280d43<_0x2d8d5c;_0x280d43++){if(!_0xc08657[_0x8be5('0x39')](_0x4f6924[_0x280d43]['questionId'])){_0xc08657[_0x4f6924[_0x280d43][_0x8be5('0x65')]]=needsEncapsulation(_0x4f6924[_0x280d43][_0x8be5('0x66')])?encapsulate(_0x4f6924[_0x280d43][_0x8be5('0x66')]):_0x4f6924[_0x280d43][_0x8be5('0x66')];}}var _0xa788e4=[],_0x2706a9={};for(var _0xecf5b6=0x0,_0x427698=_0x2f470f[_0x8be5('0x4a')];_0xecf5b6<_0x427698;_0xecf5b6++){_0x2706a9={'ProjectId':_0xa39da9[_0x8be5('0x49')]['id'],'SessionId':_0x2f470f[_0xecf5b6]['id'],'StartTime':moment(_0x2f470f[_0xecf5b6][_0x8be5('0x62')])[_0x8be5('0x67')](_0x8be5('0x68'))};for(var _0x1b5e5f=0x0,_0x38cd78=_0x4f6924[_0x8be5('0x4a')];_0x1b5e5f<_0x38cd78;_0x1b5e5f++){if(_0x4f6924[_0x1b5e5f]['SessionId']==_0x2f470f[_0xecf5b6]['id']&&_0xc08657[_0x8be5('0x39')](_0x4f6924[_0x1b5e5f][_0x8be5('0x65')])){_0x2706a9[_0xc08657[_0x4f6924[_0x1b5e5f][_0x8be5('0x65')]]]=_0x4f6924[_0x1b5e5f]['answer'];}}for(var _0x3bece5 in _0xc08657){if(!_0x2706a9['hasOwnProperty'](_0xc08657[_0x3bece5])){_0x2706a9[_0xc08657[_0x3bece5]]=null;}}_0xa788e4['push'](_0x2706a9);}return _0xa788e4;}})[_0x8be5('0x22')](function(_0x39411d){if(!_[_0x8be5('0x69')](_0x39411d)){var _0x5582cf=toCsv(_0x39411d);var _0x49dbb9=Date[_0x8be5('0x6a')]();fs[_0x8be5('0x6b')](util[_0x8be5('0x67')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0xa39da9['params']['id'],_0x49dbb9),_0x5582cf);_0x5d70f1[_0x8be5('0x6c')](_0x8be5('0x6d'),_0x8be5('0x6e')+util[_0x8be5('0x67')]('Jscripty_Project_%d_Summary_%s.csv',_0xa39da9['params']['id'],_0x49dbb9));_0x5d70f1[_0x8be5('0x6c')]('Content-type',_0x8be5('0x6f'));return _0x5d70f1[_0x8be5('0x70')](util[_0x8be5('0x67')](_0x8be5('0x71'),_0xa39da9[_0x8be5('0x49')]['id'],_0x49dbb9));}else{return _0x5d70f1[_0x8be5('0x15')](0xcc);}})[_0x8be5('0x47')](handleError(_0x5d70f1,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index d29d80f..13d37a0 100644 --- a/server/api/jscriptyProject/jscriptyProject.model.js +++ b/server/api/jscriptyProject/jscriptyProject.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3bd7=['JscriptyProject','../../config/logger','api','moment','request-promise','path','rimraf','./jscriptyProject.attributes'];(function(_0x2dbbe2,_0x11424b){var _0x2e3147=function(_0x1912c0){while(--_0x1912c0){_0x2dbbe2['push'](_0x2dbbe2['shift']());}};_0x2e3147(++_0x11424b);}(_0x3bd7,0x199));var _0x73bd=function(_0x30c649,_0x2ebbac){_0x30c649=_0x30c649-0x0;var _0x3edfb9=_0x3bd7[_0x30c649];return _0x3edfb9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x73bd('0x0'))(_0x73bd('0x1'));var moment=require(_0x73bd('0x2'));var BPromise=require('bluebird');var rp=require(_0x73bd('0x3'));var fs=require('fs');var path=require(_0x73bd('0x4'));var rimraf=require(_0x73bd('0x5'));var config=require('../../config/environment');var attributes=require(_0x73bd('0x6'));module['exports']=function(_0xe20fe9,_0x1aa5e1){return _0xe20fe9['define'](_0x73bd('0x7'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf0ba=['jscripty_projects','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports','define','JscriptyProject'];(function(_0x5c58ab,_0x434a68){var _0x29622d=function(_0x29e2f8){while(--_0x29e2f8){_0x5c58ab['push'](_0x5c58ab['shift']());}};_0x29622d(++_0x434a68);}(_0xf0ba,0x1ed));var _0xaf0b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf0ba[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaf0b('0x0'));var util=require(_0xaf0b('0x1'));var logger=require(_0xaf0b('0x2'))(_0xaf0b('0x3'));var moment=require(_0xaf0b('0x4'));var BPromise=require('bluebird');var rp=require(_0xaf0b('0x5'));var fs=require('fs');var path=require(_0xaf0b('0x6'));var rimraf=require('rimraf');var config=require(_0xaf0b('0x7'));var attributes=require('./jscriptyProject.attributes');module[_0xaf0b('0x8')]=function(_0x4b3b85,_0x4d1479){return _0x4b3b85[_0xaf0b('0x9')](_0xaf0b('0xa'),attributes,{'tableName':_0xaf0b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index ea7841e..96a99ea 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 _0x0713=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4d3da9,_0x21e84f){var _0x3024ec=function(_0x345547){while(--_0x345547){_0x4d3da9['push'](_0x4d3da9['shift']());}};_0x3024ec(++_0x21e84f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0xac4a=['JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xac4a,0x13f));var _0xaac4=function(_0x8cfede,_0x3aa69b){_0x8cfede=_0x8cfede-0x0;var _0x2ecd78=_0xac4a[_0x8cfede];return _0x2ecd78;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 6f56be7..20a8107 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 _0x7877=['show','post','create','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x3003fc,_0x5ac5de){var _0x22cb43=function(_0x478661){while(--_0x478661){_0x3003fc['push'](_0x3003fc['shift']());}};_0x22cb43(++_0x5ac5de);}(_0x7877,0x1f4));var _0x7787=function(_0x6076e5,_0x358457){_0x6076e5=_0x6076e5-0x0;var _0x4123a4=_0x7877[_0x6076e5];return _0x4123a4;};'use strict';var multer=require(_0x7787('0x0'));var util=require(_0x7787('0x1'));var path=require(_0x7787('0x2'));var timeout=require(_0x7787('0x3'));var express=require(_0x7787('0x4'));var router=express[_0x7787('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7787('0x6'));var controller=require(_0x7787('0x7'));router['get']('/',auth[_0x7787('0x8')](),controller[_0x7787('0x9')]);router[_0x7787('0xa')](_0x7787('0xb'),auth[_0x7787('0x8')](),controller[_0x7787('0xc')]);router['get']('/:id',auth[_0x7787('0x8')](),controller[_0x7787('0xd')]);router[_0x7787('0xe')]('/',auth[_0x7787('0x8')](),controller[_0x7787('0xf')]);router['put'](_0x7787('0x10'),auth[_0x7787('0x8')](),controller['update']);router['delete'](_0x7787('0x10'),auth['isAuthenticated'](),controller[_0x7787('0x11')]);module[_0x7787('0x12')]=router; \ No newline at end of file +var _0x6aa8=['show','post','create','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x20609d,_0x10a6b7){var _0x450130=function(_0x32fe7f){while(--_0x32fe7f){_0x20609d['push'](_0x20609d['shift']());}};_0x450130(++_0x10a6b7);}(_0x6aa8,0x1bb));var _0x86aa=function(_0x432ccb,_0x5cc8c8){_0x432ccb=_0x432ccb-0x0;var _0x5c0480=_0x6aa8[_0x432ccb];return _0x5c0480;};'use strict';var multer=require('multer');var util=require(_0x86aa('0x0'));var path=require(_0x86aa('0x1'));var timeout=require(_0x86aa('0x2'));var express=require('express');var router=express[_0x86aa('0x3')]();var fs_extra=require(_0x86aa('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x86aa('0x5'));var controller=require(_0x86aa('0x6'));router[_0x86aa('0x7')]('/',auth[_0x86aa('0x8')](),controller[_0x86aa('0x9')]);router[_0x86aa('0x7')](_0x86aa('0xa'),auth['isAuthenticated'](),controller[_0x86aa('0xb')]);router[_0x86aa('0x7')](_0x86aa('0xc'),auth['isAuthenticated'](),controller[_0x86aa('0xd')]);router[_0x86aa('0xe')]('/',auth[_0x86aa('0x8')](),controller[_0x86aa('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x86aa('0x10')]);router['delete'](_0x86aa('0xc'),auth[_0x86aa('0x8')](),controller[_0x86aa('0x11')]);module[_0x86aa('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 72d056c..757034e 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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x7a54,0x106));var _0x47a5=function(_0x2ec6d5,_0x46ca0c){_0x2ec6d5=_0x2ec6d5-0x0;var _0x5ed3a8=_0x7a54[_0x2ec6d5];return _0x5ed3a8;};'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(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x7a54,0x106));var _0x47a5=function(_0x42880c,_0x106df9){_0x42880c=_0x42880c-0x0;var _0x8215aa=_0x7a54[_0x42880c];return _0x8215aa;};'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 a5a04c3..c5c6ad4 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 _0x21fe=['VIRTUAL','options','includeAll','include','rows','catch','show','find','create','update','body','params','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','where','filter','merge','type'];(function(_0x4f5fd0,_0x352c6a){var _0x275ddd=function(_0x573174){while(--_0x573174){_0x4f5fd0['push'](_0x4f5fd0['shift']());}};_0x275ddd(++_0x352c6a);}(_0x21fe,0x1bd));var _0xe21f=function(_0x3c11b4,_0x408f11){_0x3c11b4=_0x3c11b4-0x0;var _0x10bb33=_0x21fe[_0x3c11b4];return _0x10bb33;};'use strict';var emlformat=require(_0xe21f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe21f('0x1'));var rp=require(_0xe21f('0x2'));var moment=require('moment');var BPromise=require(_0xe21f('0x3'));var Mustache=require(_0xe21f('0x4'));var util=require(_0xe21f('0x5'));var path=require(_0xe21f('0x6'));var sox=require(_0xe21f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe21f('0x8'));var _=require('lodash');var squel=require(_0xe21f('0x9'));var crypto=require(_0xe21f('0xa'));var jsforce=require(_0xe21f('0xb'));var deskjs=require(_0xe21f('0xc'));var toCsv=require(_0xe21f('0xd'));var querystring=require(_0xe21f('0xe'));var Papa=require(_0xe21f('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe21f('0x10'));var as=require(_0xe21f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe21f('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xe21f('0x13'));var licenseUtil=require(_0xe21f('0x14'));var db=require(_0xe21f('0x15'))['db'];function respondWithStatusCode(_0x1a9cae,_0x55f0c1){_0x55f0c1=_0x55f0c1||0xcc;return function(_0x36da3b){if(_0x36da3b){return _0x1a9cae[_0xe21f('0x16')](_0x55f0c1);}return _0x1a9cae['status'](_0x55f0c1)[_0xe21f('0x17')]();};}function respondWithResult(_0x1d68f8,_0x1760a9){_0x1760a9=_0x1760a9||0xc8;return function(_0x452788){if(_0x452788){return _0x1d68f8[_0xe21f('0x18')](_0x1760a9)[_0xe21f('0x19')](_0x452788);}};}function respondWithFilteredResult(_0x614e11,_0x116247){return function(_0x517276){if(_0x517276){var _0x53513b=typeof _0x116247[_0xe21f('0x1a')]==='undefined'&&typeof _0x116247[_0xe21f('0x1b')]==='undefined';var _0x269bc2=_0x517276['count'];var _0x50e707=_0x53513b?0x0:_0x116247['offset'];var _0x5cbb3b=_0x53513b?_0x517276[_0xe21f('0x1c')]:_0x116247[_0xe21f('0x1a')]+_0x116247['limit'];var _0x219f5d;if(_0x5cbb3b>=_0x269bc2){_0x5cbb3b=_0x269bc2;_0x219f5d=0xc8;}else{_0x219f5d=0xce;}_0x614e11[_0xe21f('0x18')](_0x219f5d);return _0x614e11['set'](_0xe21f('0x1d'),_0x50e707+'-'+_0x5cbb3b+'/'+_0x269bc2)[_0xe21f('0x19')](_0x517276);}return null;};}function patchUpdates(_0x293843){return function(_0x23e47a){try{jsonpatch[_0xe21f('0x1e')](_0x23e47a,_0x293843,!![]);}catch(_0x4060fe){return BPromise[_0xe21f('0x1f')](_0x4060fe);}return _0x23e47a['save']();};}function saveUpdates(_0x2deb9e,_0x15b1a2){return function(_0x46a426){if(_0x46a426){return _0x46a426['update'](_0x2deb9e)[_0xe21f('0x20')](function(_0x1f66ef){return _0x1f66ef;});}return null;};}function removeEntity(_0x102ca9,_0x1b44a4){return function(_0x38474b){if(_0x38474b){return _0x38474b[_0xe21f('0x21')]()[_0xe21f('0x20')](function(){_0x102ca9['status'](0xcc)[_0xe21f('0x17')]();});}};}function handleEntityNotFound(_0x2b7bd5,_0xad2619){return function(_0x22f860){if(!_0x22f860){_0x2b7bd5[_0xe21f('0x16')](0x194);}return _0x22f860;};}function handleError(_0x33e34e,_0x5514d2){_0x5514d2=_0x5514d2||0x1f4;return function(_0x4426c8){logger[_0xe21f('0x22')](_0x4426c8[_0xe21f('0x23')]);if(_0x4426c8[_0xe21f('0x24')]){delete _0x4426c8[_0xe21f('0x24')];}_0x33e34e[_0xe21f('0x18')](_0x5514d2)[_0xe21f('0x25')](_0x4426c8);};}exports[_0xe21f('0x26')]=function(_0x549207,_0x2ee089){var _0x929f6={},_0x250054={},_0x2f6e7e={'count':0x0,'rows':[]};var _0x1642a2=_[_0xe21f('0x27')](db[_0xe21f('0x28')][_0xe21f('0x29')],function(_0x4efa69){return{'name':_0x4efa69[_0xe21f('0x2a')],'type':_0x4efa69['type'][_0xe21f('0x2b')]};});_0x250054[_0xe21f('0x2c')]=_[_0xe21f('0x27')](_0x1642a2,_0xe21f('0x24'));_0x250054[_0xe21f('0x2d')]=_[_0xe21f('0x2e')](_0x549207['query']);_0x250054[_0xe21f('0x2f')]=_[_0xe21f('0x30')](_0x250054[_0xe21f('0x2c')],_0x250054[_0xe21f('0x2d')]);_0x929f6['attributes']=_[_0xe21f('0x30')](_0x250054[_0xe21f('0x2c')],qs[_0xe21f('0x31')](_0x549207[_0xe21f('0x2d')][_0xe21f('0x31')]));_0x929f6['attributes']=_0x929f6['attributes'][_0xe21f('0x32')]?_0x929f6[_0xe21f('0x33')]:_0x250054[_0xe21f('0x2c')];if(!_0x549207[_0xe21f('0x2d')][_0xe21f('0x34')]('nolimit')){_0x929f6[_0xe21f('0x1b')]=qs[_0xe21f('0x1b')](_0x549207[_0xe21f('0x2d')][_0xe21f('0x1b')]);_0x929f6[_0xe21f('0x1a')]=qs[_0xe21f('0x1a')](_0x549207[_0xe21f('0x2d')][_0xe21f('0x1a')]);}_0x929f6[_0xe21f('0x35')]=qs[_0xe21f('0x36')](_0x549207[_0xe21f('0x2d')][_0xe21f('0x36')]);_0x929f6[_0xe21f('0x37')]=qs[_0xe21f('0x2f')](_['pick'](_0x549207[_0xe21f('0x2d')],_0x250054[_0xe21f('0x2f')]),_0x1642a2);if(_0x549207['query'][_0xe21f('0x38')]){_0x929f6[_0xe21f('0x37')]=_[_0xe21f('0x39')](_0x929f6[_0xe21f('0x37')],{'$or':_[_0xe21f('0x27')](_0x1642a2,function(_0x35a83c){if(_0x35a83c[_0xe21f('0x3a')]!==_0xe21f('0x3b')){var _0x2761b7={};_0x2761b7[_0x35a83c[_0xe21f('0x24')]]={'$like':'%'+_0x549207['query']['filter']+'%'};return _0x2761b7;}})});}_0x929f6=_[_0xe21f('0x39')]({},_0x929f6,_0x549207[_0xe21f('0x3c')]);var _0x4eaa7c={'where':_0x929f6[_0xe21f('0x37')]};return db['JscriptyQuestionReport'][_0xe21f('0x1c')](_0x4eaa7c)[_0xe21f('0x20')](function(_0x3534b9){_0x2f6e7e[_0xe21f('0x1c')]=_0x3534b9;if(_0x549207['query'][_0xe21f('0x3d')]){_0x929f6[_0xe21f('0x3e')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x929f6);})[_0xe21f('0x20')](function(_0x5e6a3a){_0x2f6e7e[_0xe21f('0x3f')]=_0x5e6a3a;return _0x2f6e7e;})['then'](respondWithFilteredResult(_0x2ee089,_0x929f6))[_0xe21f('0x40')](handleError(_0x2ee089,null));};exports[_0xe21f('0x41')]=function(_0xca9d60,_0x378603){var _0x214e8f={'raw':!![],'where':{'id':_0xca9d60['params']['id']}},_0xbad8bd={};_0xbad8bd['model']=_[_0xe21f('0x2e')](db[_0xe21f('0x28')][_0xe21f('0x29')]);_0xbad8bd['query']=_[_0xe21f('0x2e')](_0xca9d60['query']);_0xbad8bd[_0xe21f('0x2f')]=_['intersection'](_0xbad8bd['model'],_0xbad8bd[_0xe21f('0x2d')]);_0x214e8f[_0xe21f('0x33')]=_[_0xe21f('0x30')](_0xbad8bd[_0xe21f('0x2c')],qs[_0xe21f('0x31')](_0xca9d60[_0xe21f('0x2d')]['fields']));_0x214e8f[_0xe21f('0x33')]=_0x214e8f[_0xe21f('0x33')][_0xe21f('0x32')]?_0x214e8f[_0xe21f('0x33')]:_0xbad8bd[_0xe21f('0x2c')];if(_0xca9d60[_0xe21f('0x2d')][_0xe21f('0x3d')]){_0x214e8f['include']=[{'all':!![]}];}_0x214e8f=_[_0xe21f('0x39')]({},_0x214e8f,_0xca9d60['options']);return db[_0xe21f('0x28')][_0xe21f('0x42')](_0x214e8f)[_0xe21f('0x20')](handleEntityNotFound(_0x378603,null))['then'](respondWithResult(_0x378603,null))['catch'](handleError(_0x378603,null));};exports[_0xe21f('0x43')]=function(_0x582f73,_0x2cc1c1){return db[_0xe21f('0x28')][_0xe21f('0x43')](_0x582f73['body'],{})[_0xe21f('0x20')](respondWithResult(_0x2cc1c1,0xc9))[_0xe21f('0x40')](handleError(_0x2cc1c1,null));};exports[_0xe21f('0x44')]=function(_0x4226c0,_0x55e696){if(_0x4226c0[_0xe21f('0x45')]['id']){delete _0x4226c0['body']['id'];}return db[_0xe21f('0x28')][_0xe21f('0x42')]({'where':{'id':_0x4226c0[_0xe21f('0x46')]['id']}})[_0xe21f('0x20')](handleEntityNotFound(_0x55e696,null))[_0xe21f('0x20')](saveUpdates(_0x4226c0[_0xe21f('0x45')],null))[_0xe21f('0x20')](respondWithResult(_0x55e696,null))[_0xe21f('0x40')](handleError(_0x55e696,null));};exports['destroy']=function(_0x271619,_0x4f32e7){return db['JscriptyQuestionReport'][_0xe21f('0x42')]({'where':{'id':_0x271619[_0xe21f('0x46')]['id']}})['then'](handleEntityNotFound(_0x4f32e7,null))[_0xe21f('0x20')](removeEntity(_0x4f32e7,null))[_0xe21f('0x40')](handleError(_0x4f32e7,null));};exports[_0xe21f('0x47')]=function(_0x571d25,_0x640960){return db[_0xe21f('0x28')][_0xe21f('0x47')]()[_0xe21f('0x20')](respondWithResult(_0x640960,null))[_0xe21f('0x40')](handleError(_0x640960,null));}; \ No newline at end of file +var _0x0f3e=['stack','name','index','map','JscriptyQuestionReport','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','VIRTUAL','filter','merge','options','include','findAll','rows','catch','params','rawAttributes','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','error'];(function(_0x12ddb2,_0x5ad61e){var _0x10b6dd=function(_0x47dd27){while(--_0x47dd27){_0x12ddb2['push'](_0x12ddb2['shift']());}};_0x10b6dd(++_0x5ad61e);}(_0x0f3e,0x1d7));var _0xe0f3=function(_0x306481,_0x20527a){_0x306481=_0x306481-0x0;var _0x33d816=_0x0f3e[_0x306481];return _0x33d816;};'use strict';var emlformat=require(_0xe0f3('0x0'));var rimraf=require(_0xe0f3('0x1'));var zipdir=require(_0xe0f3('0x2'));var jsonpatch=require(_0xe0f3('0x3'));var rp=require(_0xe0f3('0x4'));var moment=require('moment');var BPromise=require(_0xe0f3('0x5'));var Mustache=require('mustache');var util=require(_0xe0f3('0x6'));var path=require(_0xe0f3('0x7'));var sox=require(_0xe0f3('0x8'));var csv=require(_0xe0f3('0x9'));var ejs=require(_0xe0f3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe0f3('0xb'));var squel=require(_0xe0f3('0xc'));var crypto=require(_0xe0f3('0xd'));var jsforce=require(_0xe0f3('0xe'));var deskjs=require(_0xe0f3('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe0f3('0x10'));var Papa=require('papaparse');var Redis=require(_0xe0f3('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe0f3('0x12'));var hardwareService=require(_0xe0f3('0x13'));var logger=require(_0xe0f3('0x14'))('api');var utils=require(_0xe0f3('0x15'));var config=require(_0xe0f3('0x16'));var licenseUtil=require(_0xe0f3('0x17'));var db=require(_0xe0f3('0x18'))['db'];function respondWithStatusCode(_0x232594,_0x3b7fd2){_0x3b7fd2=_0x3b7fd2||0xcc;return function(_0x430174){if(_0x430174){return _0x232594[_0xe0f3('0x19')](_0x3b7fd2);}return _0x232594[_0xe0f3('0x1a')](_0x3b7fd2)[_0xe0f3('0x1b')]();};}function respondWithResult(_0x53f177,_0x4b6ee9){_0x4b6ee9=_0x4b6ee9||0xc8;return function(_0x1ad7d7){if(_0x1ad7d7){return _0x53f177[_0xe0f3('0x1a')](_0x4b6ee9)['json'](_0x1ad7d7);}};}function respondWithFilteredResult(_0x11ef86,_0x3c0aad){return function(_0x2f384b){if(_0x2f384b){var _0x547c4d=typeof _0x3c0aad[_0xe0f3('0x1c')]==='undefined'&&typeof _0x3c0aad[_0xe0f3('0x1d')]===_0xe0f3('0x1e');var _0x31ea7d=_0x2f384b[_0xe0f3('0x1f')];var _0x19a505=_0x547c4d?0x0:_0x3c0aad[_0xe0f3('0x1c')];var _0x1ca9e8=_0x547c4d?_0x2f384b[_0xe0f3('0x1f')]:_0x3c0aad[_0xe0f3('0x1c')]+_0x3c0aad['limit'];var _0x21f5ac;if(_0x1ca9e8>=_0x31ea7d){_0x1ca9e8=_0x31ea7d;_0x21f5ac=0xc8;}else{_0x21f5ac=0xce;}_0x11ef86['status'](_0x21f5ac);return _0x11ef86[_0xe0f3('0x20')](_0xe0f3('0x21'),_0x19a505+'-'+_0x1ca9e8+'/'+_0x31ea7d)[_0xe0f3('0x22')](_0x2f384b);}return null;};}function patchUpdates(_0x4b11c0){return function(_0x1e44be){try{jsonpatch['apply'](_0x1e44be,_0x4b11c0,!![]);}catch(_0x1b4974){return BPromise[_0xe0f3('0x23')](_0x1b4974);}return _0x1e44be[_0xe0f3('0x24')]();};}function saveUpdates(_0x219c44,_0xb17ade){return function(_0x579311){if(_0x579311){return _0x579311[_0xe0f3('0x25')](_0x219c44)[_0xe0f3('0x26')](function(_0xc45fd){return _0xc45fd;});}return null;};}function removeEntity(_0x3e306f,_0xa11d77){return function(_0x170413){if(_0x170413){return _0x170413['destroy']()[_0xe0f3('0x26')](function(){_0x3e306f[_0xe0f3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34dc46,_0x1f965f){return function(_0x180232){if(!_0x180232){_0x34dc46[_0xe0f3('0x19')](0x194);}return _0x180232;};}function handleError(_0x1992b8,_0x449ac3){_0x449ac3=_0x449ac3||0x1f4;return function(_0x24e410){logger[_0xe0f3('0x27')](_0x24e410[_0xe0f3('0x28')]);if(_0x24e410[_0xe0f3('0x29')]){delete _0x24e410[_0xe0f3('0x29')];}_0x1992b8[_0xe0f3('0x1a')](_0x449ac3)['send'](_0x24e410);};}exports[_0xe0f3('0x2a')]=function(_0x3189f9,_0xb7c6c5){var _0x1b8f28={},_0x337079={},_0x40b9b6={'count':0x0,'rows':[]};var _0xa2f9d8=_[_0xe0f3('0x2b')](db[_0xe0f3('0x2c')]['rawAttributes'],function(_0x28aaa5){return{'name':_0x28aaa5[_0xe0f3('0x2d')],'type':_0x28aaa5[_0xe0f3('0x2e')][_0xe0f3('0x2f')]};});_0x337079['model']=_[_0xe0f3('0x2b')](_0xa2f9d8,'name');_0x337079['query']=_[_0xe0f3('0x30')](_0x3189f9[_0xe0f3('0x31')]);_0x337079[_0xe0f3('0x32')]=_[_0xe0f3('0x33')](_0x337079[_0xe0f3('0x34')],_0x337079[_0xe0f3('0x31')]);_0x1b8f28[_0xe0f3('0x35')]=_['intersection'](_0x337079[_0xe0f3('0x34')],qs['fields'](_0x3189f9[_0xe0f3('0x31')][_0xe0f3('0x36')]));_0x1b8f28['attributes']=_0x1b8f28[_0xe0f3('0x35')]['length']?_0x1b8f28[_0xe0f3('0x35')]:_0x337079[_0xe0f3('0x34')];if(!_0x3189f9['query'][_0xe0f3('0x37')]('nolimit')){_0x1b8f28[_0xe0f3('0x1d')]=qs[_0xe0f3('0x1d')](_0x3189f9[_0xe0f3('0x31')][_0xe0f3('0x1d')]);_0x1b8f28[_0xe0f3('0x1c')]=qs['offset'](_0x3189f9['query'][_0xe0f3('0x1c')]);}_0x1b8f28['order']=qs[_0xe0f3('0x38')](_0x3189f9['query']['sort']);_0x1b8f28[_0xe0f3('0x39')]=qs[_0xe0f3('0x32')](_['pick'](_0x3189f9[_0xe0f3('0x31')],_0x337079['filters']),_0xa2f9d8);if(_0x3189f9[_0xe0f3('0x31')]['filter']){_0x1b8f28['where']=_['merge'](_0x1b8f28['where'],{'$or':_[_0xe0f3('0x2b')](_0xa2f9d8,function(_0xff7d04){if(_0xff7d04['type']!==_0xe0f3('0x3a')){var _0x757cb0={};_0x757cb0[_0xff7d04[_0xe0f3('0x29')]]={'$like':'%'+_0x3189f9[_0xe0f3('0x31')][_0xe0f3('0x3b')]+'%'};return _0x757cb0;}})});}_0x1b8f28=_[_0xe0f3('0x3c')]({},_0x1b8f28,_0x3189f9[_0xe0f3('0x3d')]);var _0x3f34ca={'where':_0x1b8f28[_0xe0f3('0x39')]};return db[_0xe0f3('0x2c')]['count'](_0x3f34ca)[_0xe0f3('0x26')](function(_0x537b07){_0x40b9b6[_0xe0f3('0x1f')]=_0x537b07;if(_0x3189f9[_0xe0f3('0x31')]['includeAll']){_0x1b8f28[_0xe0f3('0x3e')]=[{'all':!![]}];}return db[_0xe0f3('0x2c')][_0xe0f3('0x3f')](_0x1b8f28);})['then'](function(_0x2c28c1){_0x40b9b6[_0xe0f3('0x40')]=_0x2c28c1;return _0x40b9b6;})[_0xe0f3('0x26')](respondWithFilteredResult(_0xb7c6c5,_0x1b8f28))[_0xe0f3('0x41')](handleError(_0xb7c6c5,null));};exports['show']=function(_0x59d0b4,_0x26f1bd){var _0xe8e17c={'raw':!![],'where':{'id':_0x59d0b4[_0xe0f3('0x42')]['id']}},_0x2df146={};_0x2df146[_0xe0f3('0x34')]=_[_0xe0f3('0x30')](db[_0xe0f3('0x2c')][_0xe0f3('0x43')]);_0x2df146[_0xe0f3('0x31')]=_[_0xe0f3('0x30')](_0x59d0b4[_0xe0f3('0x31')]);_0x2df146[_0xe0f3('0x32')]=_[_0xe0f3('0x33')](_0x2df146['model'],_0x2df146[_0xe0f3('0x31')]);_0xe8e17c[_0xe0f3('0x35')]=_[_0xe0f3('0x33')](_0x2df146['model'],qs['fields'](_0x59d0b4['query'][_0xe0f3('0x36')]));_0xe8e17c['attributes']=_0xe8e17c[_0xe0f3('0x35')][_0xe0f3('0x44')]?_0xe8e17c[_0xe0f3('0x35')]:_0x2df146[_0xe0f3('0x34')];if(_0x59d0b4[_0xe0f3('0x31')]['includeAll']){_0xe8e17c[_0xe0f3('0x3e')]=[{'all':!![]}];}_0xe8e17c=_[_0xe0f3('0x3c')]({},_0xe8e17c,_0x59d0b4[_0xe0f3('0x3d')]);return db[_0xe0f3('0x2c')][_0xe0f3('0x45')](_0xe8e17c)[_0xe0f3('0x26')](handleEntityNotFound(_0x26f1bd,null))['then'](respondWithResult(_0x26f1bd,null))[_0xe0f3('0x41')](handleError(_0x26f1bd,null));};exports[_0xe0f3('0x46')]=function(_0x926856,_0x3e6b36){return db['JscriptyQuestionReport'][_0xe0f3('0x46')](_0x926856[_0xe0f3('0x47')],{})['then'](respondWithResult(_0x3e6b36,0xc9))[_0xe0f3('0x41')](handleError(_0x3e6b36,null));};exports['update']=function(_0x764536,_0x2b598d){if(_0x764536[_0xe0f3('0x47')]['id']){delete _0x764536[_0xe0f3('0x47')]['id'];}return db[_0xe0f3('0x2c')][_0xe0f3('0x45')]({'where':{'id':_0x764536[_0xe0f3('0x42')]['id']}})[_0xe0f3('0x26')](handleEntityNotFound(_0x2b598d,null))[_0xe0f3('0x26')](saveUpdates(_0x764536[_0xe0f3('0x47')],null))['then'](respondWithResult(_0x2b598d,null))['catch'](handleError(_0x2b598d,null));};exports['destroy']=function(_0x254fd1,_0x225bce){return db[_0xe0f3('0x2c')][_0xe0f3('0x45')]({'where':{'id':_0x254fd1[_0xe0f3('0x42')]['id']}})[_0xe0f3('0x26')](handleEntityNotFound(_0x225bce,null))[_0xe0f3('0x26')](removeEntity(_0x225bce,null))['catch'](handleError(_0x225bce,null));};exports['describe']=function(_0x5c3748,_0x33c6a8){return db[_0xe0f3('0x2c')][_0xe0f3('0x48')]()[_0xe0f3('0x26')](respondWithResult(_0x33c6a8,null))[_0xe0f3('0x41')](handleError(_0x33c6a8,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index c2cca48..7627142 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 _0xabfc=['../../config/logger','bluebird','request-promise','../../config/environment','exports','JscriptyQuestionReport','lodash','util'];(function(_0x51ab68,_0x3581db){var _0x27752e=function(_0x4b7d68){while(--_0x4b7d68){_0x51ab68['push'](_0x51ab68['shift']());}};_0x27752e(++_0x3581db);}(_0xabfc,0x9e));var _0xcabf=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0xabfc[_0x1b4b23];return _0x2a325b;};'use strict';var _=require(_0xcabf('0x0'));var util=require(_0xcabf('0x1'));var logger=require(_0xcabf('0x2'))('api');var moment=require('moment');var BPromise=require(_0xcabf('0x3'));var rp=require(_0xcabf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcabf('0x5'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0xcabf('0x6')]=function(_0x4c27cc,_0x337d83){return _0x4c27cc['define'](_0xcabf('0x7'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x118f=['moment','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','../../config/logger','api'];(function(_0x45a19a,_0x406fea){var _0x1bae6a=function(_0x413f42){while(--_0x413f42){_0x45a19a['push'](_0x45a19a['shift']());}};_0x1bae6a(++_0x406fea);}(_0x118f,0x1ce));var _0xf118=function(_0xb66f92,_0x301f99){_0xb66f92=_0xb66f92-0x0;var _0x344d2d=_0x118f[_0xb66f92];return _0x344d2d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf118('0x0'))(_0xf118('0x1'));var moment=require(_0xf118('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf118('0x3'));var rimraf=require(_0xf118('0x4'));var config=require(_0xf118('0x5'));var attributes=require(_0xf118('0x6'));module['exports']=function(_0x384980,_0x468ced){return _0x384980[_0xf118('0x7')]('JscriptyQuestionReport',attributes,{'tableName':'report_jscripty_questions','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 392021c..56e092a 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 _0x36c0=['request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x53cade,_0x2a057b){var _0x4184ea=function(_0x164b08){while(--_0x164b08){_0x53cade['push'](_0x53cade['shift']());}};_0x4184ea(++_0x2a057b);}(_0x36c0,0x6c));var _0x036c=function(_0x2ec83,_0x4b7c7e){_0x2ec83=_0x2ec83-0x0;var _0xb74571=_0x36c0[_0x2ec83];return _0xb74571;};'use strict';var _=require(_0x036c('0x0'));var util=require(_0x036c('0x1'));var moment=require(_0x036c('0x2'));var BPromise=require(_0x036c('0x3'));var rs=require(_0x036c('0x4'));var fs=require('fs');var Redis=require(_0x036c('0x5'));var db=require(_0x036c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x036c('0x7'))(_0x036c('0x8'));var config=require('../../config/environment');var jayson=require(_0x036c('0x9'));var client=jayson[_0x036c('0xa')][_0x036c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4eb800,_0x426d2a,_0x1bb1b7){return new BPromise(function(_0x34aaac,_0x2a5023){return client[_0x036c('0xc')](_0x4eb800,_0x1bb1b7)[_0x036c('0xd')](function(_0x5a456c){logger[_0x036c('0xe')](_0x036c('0xf'),_0x426d2a,_0x036c('0x10'));logger[_0x036c('0x11')](_0x036c('0x12'),_0x426d2a,_0x036c('0x10'),JSON[_0x036c('0x13')](_0x5a456c));if(_0x5a456c[_0x036c('0x14')]){if(_0x5a456c[_0x036c('0x14')][_0x036c('0x15')]===0x1f4){logger[_0x036c('0x14')](_0x036c('0xf'),_0x426d2a,_0x5a456c['error'][_0x036c('0x16')]);return _0x2a5023(_0x5a456c[_0x036c('0x14')]['message']);}logger['error'](_0x036c('0xf'),_0x426d2a,_0x5a456c[_0x036c('0x14')]['message']);return _0x34aaac(_0x5a456c[_0x036c('0x14')][_0x036c('0x16')]);}else{logger[_0x036c('0xe')](_0x036c('0xf'),_0x426d2a,'request\x20sent');_0x34aaac(_0x5a456c['result'][_0x036c('0x16')]);}})[_0x036c('0x17')](function(_0x149a24){logger[_0x036c('0x14')](_0x036c('0xf'),_0x426d2a,_0x149a24);_0x2a5023(_0x149a24);});});} \ No newline at end of file +var _0xd73e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x35b809,_0x50bd5e){var _0x2b4653=function(_0x3ef5dc){while(--_0x3ef5dc){_0x35b809['push'](_0x35b809['shift']());}};_0x2b4653(++_0x50bd5e);}(_0xd73e,0xbb));var _0xed73=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd73e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xed73('0x0'));var util=require(_0xed73('0x1'));var moment=require(_0xed73('0x2'));var BPromise=require(_0xed73('0x3'));var rs=require(_0xed73('0x4'));var fs=require('fs');var Redis=require(_0xed73('0x5'));var db=require(_0xed73('0x6'))['db'];var utils=require(_0xed73('0x7'));var logger=require(_0xed73('0x8'))(_0xed73('0x9'));var config=require(_0xed73('0xa'));var jayson=require(_0xed73('0xb'));var client=jayson['client'][_0xed73('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x66c862,_0x1af698,_0x1e57e2){return new BPromise(function(_0x2990ac,_0x439c26){return client['request'](_0x66c862,_0x1e57e2)[_0xed73('0xd')](function(_0x412ad9){logger[_0xed73('0xe')](_0xed73('0xf'),_0x1af698,'request\x20sent');logger[_0xed73('0x10')](_0xed73('0x11'),_0x1af698,_0xed73('0x12'),JSON[_0xed73('0x13')](_0x412ad9));if(_0x412ad9[_0xed73('0x14')]){if(_0x412ad9[_0xed73('0x14')][_0xed73('0x15')]===0x1f4){logger[_0xed73('0x14')](_0xed73('0xf'),_0x1af698,_0x412ad9['error'][_0xed73('0x16')]);return _0x439c26(_0x412ad9[_0xed73('0x14')][_0xed73('0x16')]);}logger['error'](_0xed73('0xf'),_0x1af698,_0x412ad9[_0xed73('0x14')][_0xed73('0x16')]);return _0x2990ac(_0x412ad9[_0xed73('0x14')]['message']);}else{logger[_0xed73('0xe')](_0xed73('0xf'),_0x1af698,_0xed73('0x12'));_0x2990ac(_0x412ad9['result'][_0xed73('0x16')]);}})[_0xed73('0x17')](function(_0x5aefc1){logger[_0xed73('0x14')](_0xed73('0xf'),_0x1af698,_0x5aefc1);_0x439c26(_0x5aefc1);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 9fe89c5..0bb6f12 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 _0x2fe2=['get','/:id','show','/:id/questions','getQuestions','post','create','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','index','/describe','isAuthenticated'];(function(_0x294c1c,_0x567301){var _0x1e7943=function(_0x575323){while(--_0x575323){_0x294c1c['push'](_0x294c1c['shift']());}};_0x1e7943(++_0x567301);}(_0x2fe2,0x7d));var _0x22fe=function(_0x22468a,_0x37e420){_0x22468a=_0x22468a-0x0;var _0x2cf675=_0x2fe2[_0x22468a];return _0x2cf675;};'use strict';var multer=require(_0x22fe('0x0'));var util=require(_0x22fe('0x1'));var path=require('path');var timeout=require(_0x22fe('0x2'));var express=require(_0x22fe('0x3'));var router=express[_0x22fe('0x4')]();var fs_extra=require(_0x22fe('0x5'));var auth=require(_0x22fe('0x6'));var interaction=require(_0x22fe('0x7'));var config=require(_0x22fe('0x8'));var controller=require(_0x22fe('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x22fe('0xa')]);router['get'](_0x22fe('0xb'),auth[_0x22fe('0xc')](),controller['describe']);router[_0x22fe('0xd')](_0x22fe('0xe'),auth[_0x22fe('0xc')](),controller[_0x22fe('0xf')]);router[_0x22fe('0xd')](_0x22fe('0x10'),auth[_0x22fe('0xc')](),controller[_0x22fe('0x11')]);router[_0x22fe('0x12')]('/',auth[_0x22fe('0xc')](),controller[_0x22fe('0x13')]);router[_0x22fe('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x22fe('0xe'),auth[_0x22fe('0xc')](),controller[_0x22fe('0x15')]);module[_0x22fe('0x16')]=router; \ No newline at end of file +var _0xdfa1=['/:id','show','create','delete','exports','multer','util','path','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xdfa1,0x1e1));var _0x1dfa=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0xdfa1[_0x51c819];return _0x15c5d2;};'use strict';var multer=require(_0x1dfa('0x0'));var util=require(_0x1dfa('0x1'));var path=require(_0x1dfa('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x1dfa('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1dfa('0x4'));var config=require(_0x1dfa('0x5'));var controller=require(_0x1dfa('0x6'));router[_0x1dfa('0x7')]('/',auth[_0x1dfa('0x8')](),controller[_0x1dfa('0x9')]);router[_0x1dfa('0x7')](_0x1dfa('0xa'),auth[_0x1dfa('0x8')](),controller[_0x1dfa('0xb')]);router[_0x1dfa('0x7')](_0x1dfa('0xc'),auth[_0x1dfa('0x8')](),controller[_0x1dfa('0xd')]);router[_0x1dfa('0x7')]('/:id/questions',auth[_0x1dfa('0x8')](),controller['getQuestions']);router['post']('/',auth[_0x1dfa('0x8')](),controller[_0x1dfa('0xe')]);router['put'](_0x1dfa('0xc'),auth[_0x1dfa('0x8')](),controller['update']);router[_0x1dfa('0xf')](_0x1dfa('0xc'),auth[_0x1dfa('0x8')](),controller['destroy']);module[_0x1dfa('0x10')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index d154cf1..909cc01 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 _0x9cdc=['endtime','format','STRING','BOOLEAN','moment','sequelize','exports','DATE','starttime'];(function(_0x25a4c1,_0x271331){var _0x18df26=function(_0x4c14c6){while(--_0x4c14c6){_0x25a4c1['push'](_0x25a4c1['shift']());}};_0x18df26(++_0x271331);}(_0x9cdc,0xaf));var _0xc9cd=function(_0x242e61,_0x492a8b){_0x242e61=_0x242e61-0x0;var _0x4a581e=_0x9cdc[_0x242e61];return _0x4a581e;};'use strict';var moment=require(_0xc9cd('0x0'));var Sequelize=require(_0xc9cd('0x1'));module[_0xc9cd('0x2')]={'starttime':{'type':Sequelize[_0xc9cd('0x3')],'set':function(_0x18fcae){this['setDataValue'](_0xc9cd('0x4'),_0x18fcae);this['setDataValue'](_0xc9cd('0x5'),moment()[_0xc9cd('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0xc9cd('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xc9cd('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xc9cd('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc9cd('0x7')]},'completed':{'type':Sequelize[_0xc9cd('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x3c26=['YYYY-MM-DD\x20HH:mm:ss','STRING','sequelize','exports','DATE','setDataValue','starttime','endtime','format'];(function(_0x2d7332,_0x15e723){var _0x5212fb=function(_0x587a93){while(--_0x587a93){_0x2d7332['push'](_0x2d7332['shift']());}};_0x5212fb(++_0x15e723);}(_0x3c26,0x122));var _0x63c2=function(_0x3f923a,_0x1d3573){_0x3f923a=_0x3f923a-0x0;var _0x446df6=_0x3c26[_0x3f923a];return _0x446df6;};'use strict';var moment=require('moment');var Sequelize=require(_0x63c2('0x0'));module[_0x63c2('0x1')]={'starttime':{'type':Sequelize[_0x63c2('0x2')],'set':function(_0x56bda5){this[_0x63c2('0x3')](_0x63c2('0x4'),_0x56bda5);this[_0x63c2('0x3')](_0x63c2('0x5'),moment()[_0x63c2('0x6')](_0x63c2('0x7')));}},'endtime':{'type':Sequelize[_0x63c2('0x2')]},'membername':{'type':Sequelize[_0x63c2('0x8')]},'projectname':{'type':Sequelize[_0x63c2('0x8')]},'queue':{'type':Sequelize[_0x63c2('0x8')]},'uniqueid':{'type':Sequelize[_0x63c2('0x8')]},'calleridname':{'type':Sequelize[_0x63c2('0x8')]},'calleridnum':{'type':Sequelize[_0x63c2('0x8')]},'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 f501d67..b48c6e0 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 _0xfaec=['rows','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','count','offset','limit','apply','save','update','then','sendStatus','error','name','send','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','catch','show','params','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','nolimit','SessionId','findAll'];(function(_0x267143,_0x2ef718){var _0x21057b=function(_0xa2f4d1){while(--_0xa2f4d1){_0x267143['push'](_0x267143['shift']());}};_0x21057b(++_0x2ef718);}(_0xfaec,0x135));var _0xcfae=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xfaec[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcfae('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcfae('0x1'));var rp=require(_0xcfae('0x2'));var moment=require('moment');var BPromise=require(_0xcfae('0x3'));var Mustache=require(_0xcfae('0x4'));var util=require(_0xcfae('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xcfae('0x6'));var ejs=require(_0xcfae('0x7'));var fs=require('fs');var fs_extra=require(_0xcfae('0x8'));var _=require(_0xcfae('0x9'));var squel=require(_0xcfae('0xa'));var crypto=require(_0xcfae('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xcfae('0xc'));var toCsv=require(_0xcfae('0x6'));var querystring=require(_0xcfae('0xd'));var Papa=require(_0xcfae('0xe'));var Redis=require(_0xcfae('0xf'));var authService=require(_0xcfae('0x10'));var qs=require(_0xcfae('0x11'));var as=require(_0xcfae('0x12'));var hardwareService=require(_0xcfae('0x13'));var logger=require('../../config/logger')(_0xcfae('0x14'));var utils=require(_0xcfae('0x15'));var config=require(_0xcfae('0x16'));var licenseUtil=require(_0xcfae('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b59db,_0x24f486){_0x24f486=_0x24f486||0xcc;return function(_0x2ac8af){if(_0x2ac8af){return _0x5b59db['sendStatus'](_0x24f486);}return _0x5b59db[_0xcfae('0x18')](_0x24f486)[_0xcfae('0x19')]();};}function respondWithResult(_0x4e5dc,_0x825540){_0x825540=_0x825540||0xc8;return function(_0x1757bb){if(_0x1757bb){return _0x4e5dc[_0xcfae('0x18')](_0x825540)[_0xcfae('0x1a')](_0x1757bb);}};}function respondWithFilteredResult(_0x3060cc,_0x25e35b){return function(_0x4d4f4a){if(_0x4d4f4a){var _0x2e6f02=typeof _0x25e35b['offset']===_0xcfae('0x1b')&&typeof _0x25e35b['limit']==='undefined';var _0x160b65=_0x4d4f4a[_0xcfae('0x1c')];var _0x2b6976=_0x2e6f02?0x0:_0x25e35b[_0xcfae('0x1d')];var _0x2cfa45=_0x2e6f02?_0x4d4f4a['count']:_0x25e35b['offset']+_0x25e35b[_0xcfae('0x1e')];var _0x4886ee;if(_0x2cfa45>=_0x160b65){_0x2cfa45=_0x160b65;_0x4886ee=0xc8;}else{_0x4886ee=0xce;}_0x3060cc[_0xcfae('0x18')](_0x4886ee);return _0x3060cc['set']('Content-Range',_0x2b6976+'-'+_0x2cfa45+'/'+_0x160b65)[_0xcfae('0x1a')](_0x4d4f4a);}return null;};}function patchUpdates(_0x1882f7){return function(_0x532549){try{jsonpatch[_0xcfae('0x1f')](_0x532549,_0x1882f7,!![]);}catch(_0x562f06){return BPromise['reject'](_0x562f06);}return _0x532549[_0xcfae('0x20')]();};}function saveUpdates(_0x4614f4,_0xf4f794){return function(_0x358f84){if(_0x358f84){return _0x358f84[_0xcfae('0x21')](_0x4614f4)[_0xcfae('0x22')](function(_0x2c651d){return _0x2c651d;});}return null;};}function removeEntity(_0x7672db,_0x1c0d46){return function(_0x16fe26){if(_0x16fe26){return _0x16fe26['destroy']()[_0xcfae('0x22')](function(){_0x7672db[_0xcfae('0x18')](0xcc)[_0xcfae('0x19')]();});}};}function handleEntityNotFound(_0x1203f6,_0x19137d){return function(_0x2f2e63){if(!_0x2f2e63){_0x1203f6[_0xcfae('0x23')](0x194);}return _0x2f2e63;};}function handleError(_0x5c837c,_0x60d9e2){_0x60d9e2=_0x60d9e2||0x1f4;return function(_0x3fead3){logger[_0xcfae('0x24')](_0x3fead3['stack']);if(_0x3fead3[_0xcfae('0x25')]){delete _0x3fead3[_0xcfae('0x25')];}_0x5c837c[_0xcfae('0x18')](_0x60d9e2)[_0xcfae('0x26')](_0x3fead3);};}exports['index']=function(_0x3d6580,_0x2b7355){var _0x5701de={},_0x109dd8={},_0x47d15e={'count':0x0,'rows':[]};var _0x14d2de=_[_0xcfae('0x27')](db[_0xcfae('0x28')][_0xcfae('0x29')],function(_0x238d7d){return{'name':_0x238d7d[_0xcfae('0x2a')],'type':_0x238d7d[_0xcfae('0x2b')][_0xcfae('0x2c')]};});_0x109dd8[_0xcfae('0x2d')]=_[_0xcfae('0x27')](_0x14d2de,_0xcfae('0x25'));_0x109dd8[_0xcfae('0x2e')]=_[_0xcfae('0x2f')](_0x3d6580[_0xcfae('0x2e')]);_0x109dd8[_0xcfae('0x30')]=_[_0xcfae('0x31')](_0x109dd8['model'],_0x109dd8[_0xcfae('0x2e')]);_0x5701de['attributes']=_['intersection'](_0x109dd8['model'],qs[_0xcfae('0x32')](_0x3d6580[_0xcfae('0x2e')][_0xcfae('0x32')]));_0x5701de[_0xcfae('0x33')]=_0x5701de['attributes'][_0xcfae('0x34')]?_0x5701de[_0xcfae('0x33')]:_0x109dd8[_0xcfae('0x2d')];if(!_0x3d6580[_0xcfae('0x2e')][_0xcfae('0x35')]('nolimit')){_0x5701de[_0xcfae('0x1e')]=qs['limit'](_0x3d6580[_0xcfae('0x2e')][_0xcfae('0x1e')]);_0x5701de[_0xcfae('0x1d')]=qs['offset'](_0x3d6580[_0xcfae('0x2e')][_0xcfae('0x1d')]);}_0x5701de[_0xcfae('0x36')]=qs[_0xcfae('0x37')](_0x3d6580['query']['sort']);_0x5701de[_0xcfae('0x38')]=qs['filters'](_[_0xcfae('0x39')](_0x3d6580[_0xcfae('0x2e')],_0x109dd8[_0xcfae('0x30')]),_0x14d2de);if(_0x3d6580[_0xcfae('0x2e')][_0xcfae('0x3a')]){_0x5701de[_0xcfae('0x38')]=_[_0xcfae('0x3b')](_0x5701de[_0xcfae('0x38')],{'$or':_[_0xcfae('0x27')](_0x14d2de,function(_0xa7f93c){if(_0xa7f93c[_0xcfae('0x2b')]!=='VIRTUAL'){var _0x4c559f={};_0x4c559f[_0xa7f93c['name']]={'$like':'%'+_0x3d6580['query'][_0xcfae('0x3a')]+'%'};return _0x4c559f;}})});}_0x5701de=_[_0xcfae('0x3b')]({},_0x5701de,_0x3d6580[_0xcfae('0x3c')]);var _0x2f58cb={'where':_0x5701de[_0xcfae('0x38')]};return db[_0xcfae('0x28')][_0xcfae('0x1c')](_0x2f58cb)[_0xcfae('0x22')](function(_0x522451){_0x47d15e[_0xcfae('0x1c')]=_0x522451;if(_0x3d6580['query'][_0xcfae('0x3d')]){_0x5701de[_0xcfae('0x3e')]=[{'all':!![]}];}return db[_0xcfae('0x28')]['findAll'](_0x5701de);})[_0xcfae('0x22')](function(_0x5cc935){_0x47d15e['rows']=_0x5cc935;return _0x47d15e;})[_0xcfae('0x22')](respondWithFilteredResult(_0x2b7355,_0x5701de))[_0xcfae('0x3f')](handleError(_0x2b7355,null));};exports[_0xcfae('0x40')]=function(_0x8ae368,_0x40e292){var _0x53fa8c={'raw':!![],'where':{'id':_0x8ae368[_0xcfae('0x41')]['id']}},_0x3b0d1b={};_0x3b0d1b[_0xcfae('0x2d')]=_[_0xcfae('0x2f')](db[_0xcfae('0x28')][_0xcfae('0x29')]);_0x3b0d1b[_0xcfae('0x2e')]=_[_0xcfae('0x2f')](_0x8ae368['query']);_0x3b0d1b[_0xcfae('0x30')]=_['intersection'](_0x3b0d1b[_0xcfae('0x2d')],_0x3b0d1b[_0xcfae('0x2e')]);_0x53fa8c[_0xcfae('0x33')]=_[_0xcfae('0x31')](_0x3b0d1b[_0xcfae('0x2d')],qs[_0xcfae('0x32')](_0x8ae368[_0xcfae('0x2e')][_0xcfae('0x32')]));_0x53fa8c['attributes']=_0x53fa8c['attributes'][_0xcfae('0x34')]?_0x53fa8c['attributes']:_0x3b0d1b[_0xcfae('0x2d')];if(_0x8ae368[_0xcfae('0x2e')][_0xcfae('0x3d')]){_0x53fa8c[_0xcfae('0x3e')]=[{'all':!![]}];}_0x53fa8c=_[_0xcfae('0x3b')]({},_0x53fa8c,_0x8ae368[_0xcfae('0x3c')]);return db[_0xcfae('0x28')][_0xcfae('0x42')](_0x53fa8c)[_0xcfae('0x22')](handleEntityNotFound(_0x40e292,null))['then'](respondWithResult(_0x40e292,null))[_0xcfae('0x3f')](handleError(_0x40e292,null));};exports[_0xcfae('0x43')]=function(_0x1042af,_0x1f29c0){return db[_0xcfae('0x28')][_0xcfae('0x43')](_0x1042af[_0xcfae('0x44')],{})[_0xcfae('0x22')](respondWithResult(_0x1f29c0,0xc9))[_0xcfae('0x3f')](handleError(_0x1f29c0,null));};exports[_0xcfae('0x21')]=function(_0x12a3b2,_0x90b79d){if(_0x12a3b2['body']['id']){delete _0x12a3b2[_0xcfae('0x44')]['id'];}return db[_0xcfae('0x28')][_0xcfae('0x42')]({'where':{'id':_0x12a3b2[_0xcfae('0x41')]['id']}})['then'](handleEntityNotFound(_0x90b79d,null))[_0xcfae('0x22')](saveUpdates(_0x12a3b2[_0xcfae('0x44')],null))['then'](respondWithResult(_0x90b79d,null))[_0xcfae('0x3f')](handleError(_0x90b79d,null));};exports['destroy']=function(_0x4e82d9,_0x315000){return db[_0xcfae('0x28')][_0xcfae('0x42')]({'where':{'id':_0x4e82d9[_0xcfae('0x41')]['id']}})[_0xcfae('0x22')](handleEntityNotFound(_0x315000,null))['then'](removeEntity(_0x315000,null))[_0xcfae('0x3f')](handleError(_0x315000,null));};exports[_0xcfae('0x45')]=function(_0x1fb459,_0x414748){return db[_0xcfae('0x28')][_0xcfae('0x45')]()[_0xcfae('0x22')](respondWithResult(_0x414748,null))[_0xcfae('0x3f')](handleError(_0x414748,null));};exports[_0xcfae('0x46')]=function(_0x3ede4b,_0x256cbf,_0x17d68b){var _0x36e8c4={'raw':!![],'where':{}};var _0x372cde={};var _0x5dddce={'count':0x0,'rows':[]};return db[_0xcfae('0x28')][_0xcfae('0x47')]({'where':{'id':_0x3ede4b['params']['id']}})[_0xcfae('0x22')](handleEntityNotFound(_0x256cbf,null))[_0xcfae('0x22')](function(_0x3240a4){if(_0x3240a4){_0x372cde[_0xcfae('0x2d')]=_[_0xcfae('0x2f')](db[_0xcfae('0x48')][_0xcfae('0x29')]);_0x372cde['query']=_[_0xcfae('0x2f')](_0x3ede4b[_0xcfae('0x2e')]);_0x372cde[_0xcfae('0x30')]=_[_0xcfae('0x31')](_0x372cde['model'],_0x372cde[_0xcfae('0x2e')]);_0x36e8c4[_0xcfae('0x33')]=_[_0xcfae('0x31')](_0x372cde[_0xcfae('0x2d')],qs[_0xcfae('0x32')](_0x3ede4b[_0xcfae('0x2e')][_0xcfae('0x32')]));_0x36e8c4['attributes']=_0x36e8c4[_0xcfae('0x33')][_0xcfae('0x34')]?_0x36e8c4['attributes']:_0x372cde[_0xcfae('0x2d')];if(!_0x3ede4b['query'][_0xcfae('0x35')](_0xcfae('0x49'))){_0x36e8c4[_0xcfae('0x1e')]=qs['limit'](_0x3ede4b[_0xcfae('0x2e')][_0xcfae('0x1e')]);_0x36e8c4[_0xcfae('0x1d')]=qs[_0xcfae('0x1d')](_0x3ede4b[_0xcfae('0x2e')][_0xcfae('0x1d')]);}_0x36e8c4['order']=qs[_0xcfae('0x37')](_0x3ede4b[_0xcfae('0x2e')]['sort']);_0x36e8c4[_0xcfae('0x38')]=qs['filters'](_[_0xcfae('0x39')](_0x3ede4b['query'],_0x372cde[_0xcfae('0x30')]));_0x36e8c4['where'][_0xcfae('0x4a')]=_0x3240a4['id'];if(_0x3ede4b[_0xcfae('0x2e')]['filter']){_0x36e8c4[_0xcfae('0x38')]=_['merge'](_0x36e8c4[_0xcfae('0x38')],{'$or':_['map'](_0x36e8c4[_0xcfae('0x33')],function(_0x171dba){var _0x4f397f={};_0x4f397f[_0x171dba]={'$like':'%'+_0x3ede4b['query'][_0xcfae('0x3a')]+'%'};return _0x4f397f;})});}_0x36e8c4=_[_0xcfae('0x3b')]({},_0x36e8c4,_0x3ede4b[_0xcfae('0x3c')]);return db[_0xcfae('0x48')][_0xcfae('0x1c')]({'where':_0x36e8c4[_0xcfae('0x38')]})[_0xcfae('0x22')](function(_0x446144){_0x5dddce[_0xcfae('0x1c')]=_0x446144;if(_0x3ede4b['query'][_0xcfae('0x3d')]){_0x36e8c4[_0xcfae('0x3e')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xcfae('0x4b')](_0x36e8c4);})['then'](function(_0x239f36){_0x5dddce[_0xcfae('0x4c')]=_0x239f36;return _0x5dddce;});}})[_0xcfae('0x22')](respondWithFilteredResult(_0x256cbf,_0x36e8c4))['catch'](handleError(_0x256cbf,null));}; \ No newline at end of file +var _0x5ae8=['length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','options','includeAll','findAll','catch','show','params','include','merge','find','create','body','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','rows','eml-format','fast-json-patch','request-promise','moment','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','limit','count','reject','save','update','then','sendStatus','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields'];(function(_0x4a1104,_0x32530b){var _0x5af867=function(_0xbebe37){while(--_0xbebe37){_0x4a1104['push'](_0x4a1104['shift']());}};_0x5af867(++_0x32530b);}(_0x5ae8,0xb8));var _0x85ae=function(_0x20d4e7,_0x5f29f7){_0x20d4e7=_0x20d4e7-0x0;var _0x125131=_0x5ae8[_0x20d4e7];return _0x125131;};'use strict';var emlformat=require(_0x85ae('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x85ae('0x1'));var rp=require(_0x85ae('0x2'));var moment=require(_0x85ae('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x85ae('0x4'));var util=require('util');var path=require('path');var sox=require(_0x85ae('0x5'));var csv=require('to-csv');var ejs=require(_0x85ae('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x85ae('0x7'));var squel=require(_0x85ae('0x8'));var crypto=require(_0x85ae('0x9'));var jsforce=require(_0x85ae('0xa'));var deskjs=require(_0x85ae('0xb'));var toCsv=require(_0x85ae('0xc'));var querystring=require(_0x85ae('0xd'));var Papa=require(_0x85ae('0xe'));var Redis=require(_0x85ae('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x85ae('0x10'));var hardwareService=require(_0x85ae('0x11'));var logger=require('../../config/logger')(_0x85ae('0x12'));var utils=require(_0x85ae('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x85ae('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2eef83,_0x5ee774){_0x5ee774=_0x5ee774||0xcc;return function(_0x57ec9d){if(_0x57ec9d){return _0x2eef83['sendStatus'](_0x5ee774);}return _0x2eef83[_0x85ae('0x15')](_0x5ee774)[_0x85ae('0x16')]();};}function respondWithResult(_0xa026a2,_0x417fab){_0x417fab=_0x417fab||0xc8;return function(_0x5edd76){if(_0x5edd76){return _0xa026a2['status'](_0x417fab)[_0x85ae('0x17')](_0x5edd76);}};}function respondWithFilteredResult(_0x3b6e02,_0x1e540b){return function(_0x47c55c){if(_0x47c55c){var _0x6966f5=typeof _0x1e540b[_0x85ae('0x18')]===_0x85ae('0x19')&&typeof _0x1e540b[_0x85ae('0x1a')]==='undefined';var _0x2aef92=_0x47c55c[_0x85ae('0x1b')];var _0x128f91=_0x6966f5?0x0:_0x1e540b[_0x85ae('0x18')];var _0x28ba1a=_0x6966f5?_0x47c55c[_0x85ae('0x1b')]:_0x1e540b[_0x85ae('0x18')]+_0x1e540b['limit'];var _0x2a3717;if(_0x28ba1a>=_0x2aef92){_0x28ba1a=_0x2aef92;_0x2a3717=0xc8;}else{_0x2a3717=0xce;}_0x3b6e02['status'](_0x2a3717);return _0x3b6e02['set']('Content-Range',_0x128f91+'-'+_0x28ba1a+'/'+_0x2aef92)['json'](_0x47c55c);}return null;};}function patchUpdates(_0xc64b9){return function(_0x5039ac){try{jsonpatch['apply'](_0x5039ac,_0xc64b9,!![]);}catch(_0xec259){return BPromise[_0x85ae('0x1c')](_0xec259);}return _0x5039ac[_0x85ae('0x1d')]();};}function saveUpdates(_0x6af38d,_0x5ad120){return function(_0x38c04b){if(_0x38c04b){return _0x38c04b[_0x85ae('0x1e')](_0x6af38d)[_0x85ae('0x1f')](function(_0x95eaa9){return _0x95eaa9;});}return null;};}function removeEntity(_0x3e78e9,_0x454e7c){return function(_0x3427e5){if(_0x3427e5){return _0x3427e5['destroy']()['then'](function(){_0x3e78e9[_0x85ae('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x525c25,_0x2cccdd){return function(_0x276539){if(!_0x276539){_0x525c25[_0x85ae('0x20')](0x194);}return _0x276539;};}function handleError(_0x51fec5,_0x35db9d){_0x35db9d=_0x35db9d||0x1f4;return function(_0x40656e){logger[_0x85ae('0x21')](_0x40656e[_0x85ae('0x22')]);if(_0x40656e['name']){delete _0x40656e[_0x85ae('0x23')];}_0x51fec5[_0x85ae('0x15')](_0x35db9d)[_0x85ae('0x24')](_0x40656e);};}exports[_0x85ae('0x25')]=function(_0x2adbb3,_0x5c0b55){var _0xad1c93={},_0x508d10={},_0x46d908={'count':0x0,'rows':[]};var _0x2155f9=_[_0x85ae('0x26')](db[_0x85ae('0x27')][_0x85ae('0x28')],function(_0x2747cf){return{'name':_0x2747cf[_0x85ae('0x29')],'type':_0x2747cf[_0x85ae('0x2a')][_0x85ae('0x2b')]};});_0x508d10[_0x85ae('0x2c')]=_[_0x85ae('0x26')](_0x2155f9,_0x85ae('0x23'));_0x508d10[_0x85ae('0x2d')]=_[_0x85ae('0x2e')](_0x2adbb3[_0x85ae('0x2d')]);_0x508d10['filters']=_['intersection'](_0x508d10['model'],_0x508d10[_0x85ae('0x2d')]);_0xad1c93[_0x85ae('0x2f')]=_[_0x85ae('0x30')](_0x508d10[_0x85ae('0x2c')],qs[_0x85ae('0x31')](_0x2adbb3['query'][_0x85ae('0x31')]));_0xad1c93[_0x85ae('0x2f')]=_0xad1c93[_0x85ae('0x2f')][_0x85ae('0x32')]?_0xad1c93[_0x85ae('0x2f')]:_0x508d10['model'];if(!_0x2adbb3[_0x85ae('0x2d')][_0x85ae('0x33')](_0x85ae('0x34'))){_0xad1c93[_0x85ae('0x1a')]=qs[_0x85ae('0x1a')](_0x2adbb3['query']['limit']);_0xad1c93[_0x85ae('0x18')]=qs[_0x85ae('0x18')](_0x2adbb3[_0x85ae('0x2d')]['offset']);}_0xad1c93[_0x85ae('0x35')]=qs[_0x85ae('0x36')](_0x2adbb3[_0x85ae('0x2d')][_0x85ae('0x36')]);_0xad1c93[_0x85ae('0x37')]=qs['filters'](_[_0x85ae('0x38')](_0x2adbb3[_0x85ae('0x2d')],_0x508d10[_0x85ae('0x39')]),_0x2155f9);if(_0x2adbb3[_0x85ae('0x2d')][_0x85ae('0x3a')]){_0xad1c93['where']=_['merge'](_0xad1c93[_0x85ae('0x37')],{'$or':_[_0x85ae('0x26')](_0x2155f9,function(_0x1227d1){if(_0x1227d1[_0x85ae('0x2a')]!==_0x85ae('0x3b')){var _0x26d7c9={};_0x26d7c9[_0x1227d1[_0x85ae('0x23')]]={'$like':'%'+_0x2adbb3[_0x85ae('0x2d')]['filter']+'%'};return _0x26d7c9;}})});}_0xad1c93=_['merge']({},_0xad1c93,_0x2adbb3[_0x85ae('0x3c')]);var _0x46ff44={'where':_0xad1c93[_0x85ae('0x37')]};return db['JscriptySessionReport'][_0x85ae('0x1b')](_0x46ff44)[_0x85ae('0x1f')](function(_0x4b60d9){_0x46d908[_0x85ae('0x1b')]=_0x4b60d9;if(_0x2adbb3['query'][_0x85ae('0x3d')]){_0xad1c93['include']=[{'all':!![]}];}return db[_0x85ae('0x27')][_0x85ae('0x3e')](_0xad1c93);})[_0x85ae('0x1f')](function(_0x30aa86){_0x46d908['rows']=_0x30aa86;return _0x46d908;})[_0x85ae('0x1f')](respondWithFilteredResult(_0x5c0b55,_0xad1c93))[_0x85ae('0x3f')](handleError(_0x5c0b55,null));};exports[_0x85ae('0x40')]=function(_0x13494b,_0x1a2108){var _0x5c6832={'raw':!![],'where':{'id':_0x13494b[_0x85ae('0x41')]['id']}},_0x132ca9={};_0x132ca9[_0x85ae('0x2c')]=_[_0x85ae('0x2e')](db['JscriptySessionReport'][_0x85ae('0x28')]);_0x132ca9[_0x85ae('0x2d')]=_[_0x85ae('0x2e')](_0x13494b['query']);_0x132ca9[_0x85ae('0x39')]=_[_0x85ae('0x30')](_0x132ca9['model'],_0x132ca9['query']);_0x5c6832[_0x85ae('0x2f')]=_[_0x85ae('0x30')](_0x132ca9[_0x85ae('0x2c')],qs[_0x85ae('0x31')](_0x13494b[_0x85ae('0x2d')][_0x85ae('0x31')]));_0x5c6832[_0x85ae('0x2f')]=_0x5c6832[_0x85ae('0x2f')][_0x85ae('0x32')]?_0x5c6832[_0x85ae('0x2f')]:_0x132ca9['model'];if(_0x13494b[_0x85ae('0x2d')]['includeAll']){_0x5c6832[_0x85ae('0x42')]=[{'all':!![]}];}_0x5c6832=_[_0x85ae('0x43')]({},_0x5c6832,_0x13494b[_0x85ae('0x3c')]);return db['JscriptySessionReport'][_0x85ae('0x44')](_0x5c6832)[_0x85ae('0x1f')](handleEntityNotFound(_0x1a2108,null))['then'](respondWithResult(_0x1a2108,null))['catch'](handleError(_0x1a2108,null));};exports[_0x85ae('0x45')]=function(_0x5310c0,_0x91687c){return db['JscriptySessionReport'][_0x85ae('0x45')](_0x5310c0['body'],{})[_0x85ae('0x1f')](respondWithResult(_0x91687c,0xc9))[_0x85ae('0x3f')](handleError(_0x91687c,null));};exports[_0x85ae('0x1e')]=function(_0x5285cc,_0x5a4e93){if(_0x5285cc[_0x85ae('0x46')]['id']){delete _0x5285cc[_0x85ae('0x46')]['id'];}return db[_0x85ae('0x27')][_0x85ae('0x44')]({'where':{'id':_0x5285cc['params']['id']}})['then'](handleEntityNotFound(_0x5a4e93,null))[_0x85ae('0x1f')](saveUpdates(_0x5285cc[_0x85ae('0x46')],null))[_0x85ae('0x1f')](respondWithResult(_0x5a4e93,null))[_0x85ae('0x3f')](handleError(_0x5a4e93,null));};exports[_0x85ae('0x47')]=function(_0x16ba0d,_0x5b5c88){return db['JscriptySessionReport'][_0x85ae('0x44')]({'where':{'id':_0x16ba0d['params']['id']}})[_0x85ae('0x1f')](handleEntityNotFound(_0x5b5c88,null))[_0x85ae('0x1f')](removeEntity(_0x5b5c88,null))[_0x85ae('0x3f')](handleError(_0x5b5c88,null));};exports[_0x85ae('0x48')]=function(_0x36f861,_0x43f12e){return db[_0x85ae('0x27')][_0x85ae('0x48')]()['then'](respondWithResult(_0x43f12e,null))[_0x85ae('0x3f')](handleError(_0x43f12e,null));};exports[_0x85ae('0x49')]=function(_0x8b26e7,_0x25dacc,_0x8e67bc){var _0x3e7a8e={'raw':!![],'where':{}};var _0x3c1c3e={};var _0x1e0701={'count':0x0,'rows':[]};return db[_0x85ae('0x27')][_0x85ae('0x4a')]({'where':{'id':_0x8b26e7[_0x85ae('0x41')]['id']}})[_0x85ae('0x1f')](handleEntityNotFound(_0x25dacc,null))[_0x85ae('0x1f')](function(_0x496121){if(_0x496121){_0x3c1c3e[_0x85ae('0x2c')]=_[_0x85ae('0x2e')](db[_0x85ae('0x4b')][_0x85ae('0x28')]);_0x3c1c3e[_0x85ae('0x2d')]=_[_0x85ae('0x2e')](_0x8b26e7[_0x85ae('0x2d')]);_0x3c1c3e[_0x85ae('0x39')]=_[_0x85ae('0x30')](_0x3c1c3e[_0x85ae('0x2c')],_0x3c1c3e[_0x85ae('0x2d')]);_0x3e7a8e[_0x85ae('0x2f')]=_[_0x85ae('0x30')](_0x3c1c3e['model'],qs[_0x85ae('0x31')](_0x8b26e7[_0x85ae('0x2d')]['fields']));_0x3e7a8e[_0x85ae('0x2f')]=_0x3e7a8e[_0x85ae('0x2f')][_0x85ae('0x32')]?_0x3e7a8e[_0x85ae('0x2f')]:_0x3c1c3e['model'];if(!_0x8b26e7['query']['hasOwnProperty'](_0x85ae('0x34'))){_0x3e7a8e[_0x85ae('0x1a')]=qs[_0x85ae('0x1a')](_0x8b26e7[_0x85ae('0x2d')][_0x85ae('0x1a')]);_0x3e7a8e['offset']=qs['offset'](_0x8b26e7['query'][_0x85ae('0x18')]);}_0x3e7a8e[_0x85ae('0x35')]=qs['sort'](_0x8b26e7[_0x85ae('0x2d')][_0x85ae('0x36')]);_0x3e7a8e[_0x85ae('0x37')]=qs[_0x85ae('0x39')](_[_0x85ae('0x38')](_0x8b26e7[_0x85ae('0x2d')],_0x3c1c3e['filters']));_0x3e7a8e['where'][_0x85ae('0x4c')]=_0x496121['id'];if(_0x8b26e7['query'][_0x85ae('0x3a')]){_0x3e7a8e[_0x85ae('0x37')]=_[_0x85ae('0x43')](_0x3e7a8e[_0x85ae('0x37')],{'$or':_[_0x85ae('0x26')](_0x3e7a8e['attributes'],function(_0x153f6a){var _0x1c508f={};_0x1c508f[_0x153f6a]={'$like':'%'+_0x8b26e7[_0x85ae('0x2d')][_0x85ae('0x3a')]+'%'};return _0x1c508f;})});}_0x3e7a8e=_['merge']({},_0x3e7a8e,_0x8b26e7[_0x85ae('0x3c')]);return db[_0x85ae('0x4b')]['count']({'where':_0x3e7a8e['where']})[_0x85ae('0x1f')](function(_0x53b741){_0x1e0701[_0x85ae('0x1b')]=_0x53b741;if(_0x8b26e7[_0x85ae('0x2d')]['includeAll']){_0x3e7a8e[_0x85ae('0x42')]=[{'all':!![]}];}return db[_0x85ae('0x4b')]['findAll'](_0x3e7a8e);})[_0x85ae('0x1f')](function(_0x49e92f){_0x1e0701[_0x85ae('0x4d')]=_0x49e92f;return _0x1e0701;});}})[_0x85ae('0x1f')](respondWithFilteredResult(_0x25dacc,_0x3e7a8e))['catch'](handleError(_0x25dacc,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 2d57477..6d635ab 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 _0x1cb9=['./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x1250ab,_0x525c42){var _0x2e1e46=function(_0x3faf27){while(--_0x3faf27){_0x1250ab['push'](_0x1250ab['shift']());}};_0x2e1e46(++_0x525c42);}(_0x1cb9,0x14e));var _0x91cb=function(_0x6cc2bd,_0x3fcb8a){_0x6cc2bd=_0x6cc2bd-0x0;var _0x133b47=_0x1cb9[_0x6cc2bd];return _0x133b47;};'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':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1623=['lodash','api','moment','bluebird','request-promise','path','./jscriptySessionReport.attributes','JscriptySessionReport','report_jscripty_sessions'];(function(_0x416f0d,_0x299fb9){var _0x2f9c17=function(_0x2f0b72){while(--_0x2f0b72){_0x416f0d['push'](_0x416f0d['shift']());}};_0x2f9c17(++_0x299fb9);}(_0x1623,0xab));var _0x3162=function(_0x51a040,_0x53766b){_0x51a040=_0x51a040-0x0;var _0x5e55dd=_0x1623[_0x51a040];return _0x5e55dd;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3162('0x1'));var moment=require(_0x3162('0x2'));var BPromise=require(_0x3162('0x3'));var rp=require(_0x3162('0x4'));var fs=require('fs');var path=require(_0x3162('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3162('0x6'));module['exports']=function(_0x1b55f2,_0x428de6){return _0x1b55f2['define'](_0x3162('0x7'),attributes,{'tableName':_0x3162('0x8'),'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 9d441d8..fc9d308 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 _0xa6b0=['client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x361a09,_0x4d19b5){var _0x1f01cc=function(_0x3c11ce){while(--_0x3c11ce){_0x361a09['push'](_0x361a09['shift']());}};_0x1f01cc(++_0x4d19b5);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x2eec0a,_0x3b0f08){_0x2eec0a=_0x2eec0a-0x0;var _0x26ac35=_0xa6b0[_0x2eec0a];return _0x26ac35;};'use strict';var _=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0a6b('0x2'));var fs=require('fs');var Redis=require(_0x0a6b('0x3'));var db=require(_0x0a6b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a6b('0x5'))(_0x0a6b('0x6'));var config=require(_0x0a6b('0x7'));var jayson=require(_0x0a6b('0x8'));var client=jayson[_0x0a6b('0x9')][_0x0a6b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b5fb5,_0xa908dd,_0x26f761){return new BPromise(function(_0x340a33,_0x8e89f){return client[_0x0a6b('0xb')](_0x1b5fb5,_0x26f761)['then'](function(_0x493948){logger[_0x0a6b('0xc')](_0x0a6b('0xd'),_0xa908dd,_0x0a6b('0xe'));logger[_0x0a6b('0xf')](_0x0a6b('0x10'),_0xa908dd,_0x0a6b('0xe'),JSON[_0x0a6b('0x11')](_0x493948));if(_0x493948[_0x0a6b('0x12')]){if(_0x493948[_0x0a6b('0x12')][_0x0a6b('0x13')]===0x1f4){logger[_0x0a6b('0x12')](_0x0a6b('0xd'),_0xa908dd,_0x493948[_0x0a6b('0x12')][_0x0a6b('0x14')]);return _0x8e89f(_0x493948['error']['message']);}logger[_0x0a6b('0x12')](_0x0a6b('0xd'),_0xa908dd,_0x493948[_0x0a6b('0x12')][_0x0a6b('0x14')]);return _0x340a33(_0x493948[_0x0a6b('0x12')][_0x0a6b('0x14')]);}else{logger[_0x0a6b('0xc')](_0x0a6b('0xd'),_0xa908dd,_0x0a6b('0xe'));_0x340a33(_0x493948[_0x0a6b('0x15')]['message']);}})[_0x0a6b('0x16')](function(_0x1538f4){logger['error'](_0x0a6b('0xd'),_0xa908dd,_0x1538f4);_0x8e89f(_0x1538f4);});});} \ No newline at end of file +var _0xb145=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptySessionReport,\x20%s,\x20%s','message'];(function(_0x3a8125,_0x3924d4){var _0x17123e=function(_0x3c1e45){while(--_0x3c1e45){_0x3a8125['push'](_0x3a8125['shift']());}};_0x17123e(++_0x3924d4);}(_0xb145,0xa3));var _0x5b14=function(_0x283fc9,_0x441da6){_0x283fc9=_0x283fc9-0x0;var _0x3e0e3f=_0xb145[_0x283fc9];return _0x3e0e3f;};'use strict';var _=require('lodash');var util=require(_0x5b14('0x0'));var moment=require(_0x5b14('0x1'));var BPromise=require(_0x5b14('0x2'));var rs=require(_0x5b14('0x3'));var fs=require('fs');var Redis=require(_0x5b14('0x4'));var db=require(_0x5b14('0x5'))['db'];var utils=require(_0x5b14('0x6'));var logger=require(_0x5b14('0x7'))('rpc');var config=require(_0x5b14('0x8'));var jayson=require(_0x5b14('0x9'));var client=jayson[_0x5b14('0xa')][_0x5b14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50fd91,_0x1d12ed,_0x2a3921){return new BPromise(function(_0x34530a,_0x62cdcd){return client[_0x5b14('0xc')](_0x50fd91,_0x2a3921)['then'](function(_0x32d729){logger[_0x5b14('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x1d12ed,_0x5b14('0xe'));logger[_0x5b14('0xf')](_0x5b14('0x10'),_0x1d12ed,_0x5b14('0xe'),JSON[_0x5b14('0x11')](_0x32d729));if(_0x32d729['error']){if(_0x32d729[_0x5b14('0x12')]['code']===0x1f4){logger[_0x5b14('0x12')](_0x5b14('0x13'),_0x1d12ed,_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);return _0x62cdcd(_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);}logger['error'](_0x5b14('0x13'),_0x1d12ed,_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);return _0x34530a(_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);}else{logger[_0x5b14('0xd')](_0x5b14('0x13'),_0x1d12ed,_0x5b14('0xe'));_0x34530a(_0x32d729[_0x5b14('0x15')][_0x5b14('0x14')]);}})[_0x5b14('0x16')](function(_0x2c3efb){logger['error'](_0x5b14('0x13'),_0x1d12ed,_0x2c3efb);_0x62cdcd(_0x2c3efb);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 7573beb..290c9f8 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 _0x514e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','index','put','/:id','isAuthenticated','update','multer','util','path','connect-timeout'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x514e,0x146));var _0xe514=function(_0x11a837,_0x53a196){_0x11a837=_0x11a837-0x0;var _0x2c17ce=_0x514e[_0x11a837];return _0x2c17ce;};'use strict';var multer=require(_0xe514('0x0'));var util=require(_0xe514('0x1'));var path=require(_0xe514('0x2'));var timeout=require(_0xe514('0x3'));var express=require('express');var router=express[_0xe514('0x4')]();var fs_extra=require(_0xe514('0x5'));var auth=require(_0xe514('0x6'));var interaction=require(_0xe514('0x7'));var config=require(_0xe514('0x8'));var controller=require(_0xe514('0x9'));router['get']('/',controller[_0xe514('0xa')]);router[_0xe514('0xb')](_0xe514('0xc'),auth[_0xe514('0xd')](),controller[_0xe514('0xe')]);module['exports']=router; \ No newline at end of file +var _0x972c=['path','connect-timeout','Router','fs-extra','../../config/environment','./license.controller','get','put','isAuthenticated','update','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x972c,0xf2));var _0xc972=function(_0x19688b,_0x203425){_0x19688b=_0x19688b-0x0;var _0x29df75=_0x972c[_0x19688b];return _0x29df75;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc972('0x0'));var timeout=require(_0xc972('0x1'));var express=require('express');var router=express[_0xc972('0x2')]();var fs_extra=require(_0xc972('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc972('0x4'));var controller=require(_0xc972('0x5'));router[_0xc972('0x6')]('/',controller['index']);router[_0xc972('0x7')]('/:id',auth[_0xc972('0x8')](),controller[_0xc972('0x9')]);module[_0xc972('0xa')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index e74fd6f..cd527a2 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 _0x1c97=['INTEGER','sequelize','TEXT','STRING'];(function(_0xd1f35,_0x26e2cf){var _0x661e88=function(_0x1f38b2){while(--_0x1f38b2){_0xd1f35['push'](_0xd1f35['shift']());}};_0x661e88(++_0x26e2cf);}(_0x1c97,0xb5));var _0x71c9=function(_0x29cb6d,_0x34d5c5){_0x29cb6d=_0x29cb6d-0x0;var _0x44b4c3=_0x1c97[_0x29cb6d];return _0x44b4c3;};'use strict';var Sequelize=require(_0x71c9('0x0'));module['exports']={'license':{'type':Sequelize[_0x71c9('0x1')]},'data1':{'type':Sequelize[_0x71c9('0x2')]},'data2':{'type':Sequelize[_0x71c9('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x71c9('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x571c=['INTEGER','sequelize','TEXT','STRING'];(function(_0x3d32f7,_0x2f9329){var _0x8fdde5=function(_0x347943){while(--_0x347943){_0x3d32f7['push'](_0x3d32f7['shift']());}};_0x8fdde5(++_0x2f9329);}(_0x571c,0x131));var _0xc571=function(_0x7ad7c1,_0x4b1e53){_0x7ad7c1=_0x7ad7c1-0x0;var _0x14cee5=_0x571c[_0x7ad7c1];return _0x14cee5;};'use strict';var Sequelize=require(_0xc571('0x0'));module['exports']={'license':{'type':Sequelize[_0xc571('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xc571('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xc571('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 1a85b07..4927ba6 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 _0x2ef3=['length','options','then','catch','body','params','get','checkLicense','demo','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','index','model','keys','rawAttributes','query','filters','intersection','attributes','fields'];(function(_0xebea9,_0x9f0401){var _0x5bd599=function(_0x5e4bdc){while(--_0x5e4bdc){_0xebea9['push'](_0xebea9['shift']());}};_0x5bd599(++_0x9f0401);}(_0x2ef3,0xba));var _0x32ef=function(_0x4292e5,_0x3a3fa6){_0x4292e5=_0x4292e5-0x0;var _0x239877=_0x2ef3[_0x4292e5];return _0x239877;};'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);};}var utilLicense=require('../../config/license/util');exports[_0x32ef('0x29')]=function(_0x2f5d06,_0x5a04cd){var _0x12de1a={'raw':!![],'where':{'id':0x1}},_0x3c569d={};_0x3c569d[_0x32ef('0x2a')]=_[_0x32ef('0x2b')](db['License'][_0x32ef('0x2c')]);_0x3c569d[_0x32ef('0x2d')]=_[_0x32ef('0x2b')](_0x2f5d06[_0x32ef('0x2d')]);_0x3c569d[_0x32ef('0x2e')]=_[_0x32ef('0x2f')](_0x3c569d[_0x32ef('0x2a')],_0x3c569d['query']);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x3c569d[_0x32ef('0x2a')],qs[_0x32ef('0x31')](_0x2f5d06['query'][_0x32ef('0x31')]));_0x12de1a[_0x32ef('0x30')]=_0x12de1a[_0x32ef('0x30')][_0x32ef('0x32')]?_0x12de1a[_0x32ef('0x30')]:_0x3c569d['model'];_0x12de1a=_['merge']({},_0x12de1a,_0x2f5d06[_0x32ef('0x33')]);return utilLicense['getLicense'](_0x12de1a)[_0x32ef('0x34')](respondWithResult(_0x5a04cd,null))[_0x32ef('0x35')](handleError(_0x5a04cd,null));};exports[_0x32ef('0x24')]=function(_0x390670,_0x389583){if(_0x390670[_0x32ef('0x36')]['id']){delete _0x390670['body']['id'];}return db['License']['find']({'where':{'id':_0x390670[_0x32ef('0x37')]['id']}})[_0x32ef('0x34')](handleEntityNotFound(_0x389583,null))[_0x32ef('0x34')](function(_0x5f2443){var _0x4fb402=_0x5f2443[_0x32ef('0x38')]({'plain':!![]});return utilLicense[_0x32ef('0x39')](_0x4fb402,_0x390670[_0x32ef('0x36')]['key']);})['then'](function(_0xcbdec8){if(!_0xcbdec8[_0x32ef('0x3a')]){return saveUpdates(_0x390670[_0x32ef('0x36')],null);}return _0xcbdec8;})[_0x32ef('0x34')](respondWithResult(_0x389583,null))[_0x32ef('0x35')](handleError(_0x389583,null));}; \ No newline at end of file +var _0x2ef3=['length','options','then','catch','body','params','get','checkLicense','demo','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','index','model','keys','rawAttributes','query','filters','intersection','attributes','fields'];(function(_0x5e3d80,_0xd64712){var _0x3e7615=function(_0x49c1d2){while(--_0x49c1d2){_0x5e3d80['push'](_0x5e3d80['shift']());}};_0x3e7615(++_0xd64712);}(_0x2ef3,0xba));var _0x32ef=function(_0x3f358c,_0x2976b0){_0x3f358c=_0x3f358c-0x0;var _0x31b804=_0x2ef3[_0x3f358c];return _0x31b804;};'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);};}var utilLicense=require('../../config/license/util');exports[_0x32ef('0x29')]=function(_0x2f5d06,_0x5a04cd){var _0x12de1a={'raw':!![],'where':{'id':0x1}},_0x3c569d={};_0x3c569d[_0x32ef('0x2a')]=_[_0x32ef('0x2b')](db['License'][_0x32ef('0x2c')]);_0x3c569d[_0x32ef('0x2d')]=_[_0x32ef('0x2b')](_0x2f5d06[_0x32ef('0x2d')]);_0x3c569d[_0x32ef('0x2e')]=_[_0x32ef('0x2f')](_0x3c569d[_0x32ef('0x2a')],_0x3c569d['query']);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x3c569d[_0x32ef('0x2a')],qs[_0x32ef('0x31')](_0x2f5d06['query'][_0x32ef('0x31')]));_0x12de1a[_0x32ef('0x30')]=_0x12de1a[_0x32ef('0x30')][_0x32ef('0x32')]?_0x12de1a[_0x32ef('0x30')]:_0x3c569d['model'];_0x12de1a=_['merge']({},_0x12de1a,_0x2f5d06[_0x32ef('0x33')]);return utilLicense['getLicense'](_0x12de1a)[_0x32ef('0x34')](respondWithResult(_0x5a04cd,null))[_0x32ef('0x35')](handleError(_0x5a04cd,null));};exports[_0x32ef('0x24')]=function(_0x390670,_0x389583){if(_0x390670[_0x32ef('0x36')]['id']){delete _0x390670['body']['id'];}return db['License']['find']({'where':{'id':_0x390670[_0x32ef('0x37')]['id']}})[_0x32ef('0x34')](handleEntityNotFound(_0x389583,null))[_0x32ef('0x34')](function(_0x5f2443){var _0x4fb402=_0x5f2443[_0x32ef('0x38')]({'plain':!![]});return utilLicense[_0x32ef('0x39')](_0x4fb402,_0x390670[_0x32ef('0x36')]['key']);})['then'](function(_0xcbdec8){if(!_0xcbdec8[_0x32ef('0x3a')]){return saveUpdates(_0x390670[_0x32ef('0x36')],null);}return _0xcbdec8;})[_0x32ef('0x34')](respondWithResult(_0x389583,null))[_0x32ef('0x35')](handleError(_0x389583,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 42a852a..f66a056 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 _0xf3f6=['request-promise','path','../../config/environment','exports','define','License','util','../../config/logger','moment'];(function(_0x309f7c,_0x374cd2){var _0x3bf9ec=function(_0x8789fe){while(--_0x8789fe){_0x309f7c['push'](_0x309f7c['shift']());}};_0x3bf9ec(++_0x374cd2);}(_0xf3f6,0x7b));var _0x6f3f=function(_0x4829f6,_0x1bb4f1){_0x4829f6=_0x4829f6-0x0;var _0x11b7ac=_0xf3f6[_0x4829f6];return _0x11b7ac;};'use strict';var _=require('lodash');var util=require(_0x6f3f('0x0'));var logger=require(_0x6f3f('0x1'))('api');var moment=require(_0x6f3f('0x2'));var BPromise=require('bluebird');var rp=require(_0x6f3f('0x3'));var fs=require('fs');var path=require(_0x6f3f('0x4'));var rimraf=require('rimraf');var config=require(_0x6f3f('0x5'));var attributes=require('./license.attributes');module[_0x6f3f('0x6')]=function(_0x133ab3,_0x1ede53){return _0x133ab3[_0x6f3f('0x7')](_0x6f3f('0x8'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbcd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./license.attributes','define','lodash'];(function(_0x164059,_0xa3c4ca){var _0x816457=function(_0x5b1089){while(--_0x5b1089){_0x164059['push'](_0x164059['shift']());}};_0x816457(++_0xa3c4ca);}(_0xbcd9,0x1f3));var _0x9bcd=function(_0x291d9c,_0x35b226){_0x291d9c=_0x291d9c-0x0;var _0x1b9cbb=_0xbcd9[_0x291d9c];return _0x1b9cbb;};'use strict';var _=require(_0x9bcd('0x0'));var util=require('util');var logger=require(_0x9bcd('0x1'))(_0x9bcd('0x2'));var moment=require(_0x9bcd('0x3'));var BPromise=require(_0x9bcd('0x4'));var rp=require(_0x9bcd('0x5'));var fs=require('fs');var path=require(_0x9bcd('0x6'));var rimraf=require(_0x9bcd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9bcd('0x8'));module['exports']=function(_0xdb1c1e,_0x28d48c){return _0xdb1c1e[_0x9bcd('0x9')]('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 3ea2d35..c5a38e7 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 _0x84cf=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5787fa,_0x2073d7){var _0x424173=function(_0xb94b0e){while(--_0xb94b0e){_0x5787fa['push'](_0x5787fa['shift']());}};_0x424173(++_0x2073d7);}(_0x84cf,0x15d));var _0xf84c=function(_0x26e00c,_0x33482f){_0x26e00c=_0x26e00c-0x0;var _0x22c1e3=_0x84cf[_0x26e00c];return _0x22c1e3;};'use strict';var _=require(_0xf84c('0x0'));var util=require(_0xf84c('0x1'));var moment=require(_0xf84c('0x2'));var BPromise=require(_0xf84c('0x3'));var rs=require(_0xf84c('0x4'));var fs=require('fs');var Redis=require(_0xf84c('0x5'));var db=require(_0xf84c('0x6'))['db'];var utils=require(_0xf84c('0x7'));var logger=require(_0xf84c('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf84c('0x9')][_0xf84c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x275e86,_0x314f6e,_0x315c9f){return new BPromise(function(_0x20d159,_0x2ebc95){return client[_0xf84c('0xb')](_0x275e86,_0x315c9f)[_0xf84c('0xc')](function(_0x2ee405){logger['info'](_0xf84c('0xd'),_0x314f6e,_0xf84c('0xe'));logger['debug'](_0xf84c('0xf'),_0x314f6e,_0xf84c('0xe'),JSON[_0xf84c('0x10')](_0x2ee405));if(_0x2ee405[_0xf84c('0x11')]){if(_0x2ee405[_0xf84c('0x11')][_0xf84c('0x12')]===0x1f4){logger[_0xf84c('0x11')]('License,\x20%s,\x20%s',_0x314f6e,_0x2ee405[_0xf84c('0x11')][_0xf84c('0x13')]);return _0x2ebc95(_0x2ee405['error'][_0xf84c('0x13')]);}logger[_0xf84c('0x11')]('License,\x20%s,\x20%s',_0x314f6e,_0x2ee405[_0xf84c('0x11')][_0xf84c('0x13')]);return _0x20d159(_0x2ee405[_0xf84c('0x11')][_0xf84c('0x13')]);}else{logger[_0xf84c('0x14')](_0xf84c('0xd'),_0x314f6e,_0xf84c('0xe'));_0x20d159(_0x2ee405[_0xf84c('0x15')]['message']);}})[_0xf84c('0x16')](function(_0xa4a068){logger[_0xf84c('0x11')]('License,\x20%s,\x20%s',_0x314f6e,_0xa4a068);_0x2ebc95(_0xa4a068);});});} \ No newline at end of file +var _0x9c98=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','License,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment'];(function(_0x146ce7,_0x14b64d){var _0x56c65d=function(_0x12db3d){while(--_0x12db3d){_0x146ce7['push'](_0x146ce7['shift']());}};_0x56c65d(++_0x14b64d);}(_0x9c98,0x148));var _0x89c9=function(_0x562b3c,_0x50b4aa){_0x562b3c=_0x562b3c-0x0;var _0x3f88e6=_0x9c98[_0x562b3c];return _0x3f88e6;};'use strict';var _=require('lodash');var util=require(_0x89c9('0x0'));var moment=require(_0x89c9('0x1'));var BPromise=require(_0x89c9('0x2'));var rs=require(_0x89c9('0x3'));var fs=require('fs');var Redis=require(_0x89c9('0x4'));var db=require(_0x89c9('0x5'))['db'];var utils=require(_0x89c9('0x6'));var logger=require(_0x89c9('0x7'))(_0x89c9('0x8'));var config=require(_0x89c9('0x9'));var jayson=require(_0x89c9('0xa'));var client=jayson[_0x89c9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c3318,_0x501693,_0x415ab2){return new BPromise(function(_0x50c07a,_0x1efefe){return client[_0x89c9('0xc')](_0x1c3318,_0x415ab2)['then'](function(_0x154c2f){logger['info'](_0x89c9('0xd'),_0x501693,'request\x20sent');logger['debug']('License,\x20%s,\x20%s,\x20%s',_0x501693,_0x89c9('0xe'),JSON[_0x89c9('0xf')](_0x154c2f));if(_0x154c2f[_0x89c9('0x10')]){if(_0x154c2f[_0x89c9('0x10')][_0x89c9('0x11')]===0x1f4){logger[_0x89c9('0x10')]('License,\x20%s,\x20%s',_0x501693,_0x154c2f[_0x89c9('0x10')][_0x89c9('0x12')]);return _0x1efefe(_0x154c2f['error']['message']);}logger[_0x89c9('0x10')](_0x89c9('0xd'),_0x501693,_0x154c2f[_0x89c9('0x10')][_0x89c9('0x12')]);return _0x50c07a(_0x154c2f['error'][_0x89c9('0x12')]);}else{logger[_0x89c9('0x13')](_0x89c9('0xd'),_0x501693,'request\x20sent');_0x50c07a(_0x154c2f[_0x89c9('0x14')][_0x89c9('0x12')]);}})[_0x89c9('0x15')](function(_0x3445ab){logger[_0x89c9('0x10')](_0x89c9('0xd'),_0x501693,_0x3445ab);_0x1efefe(_0x3445ab);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 29efb4b..9018200 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 _0xe774=['getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','create','addImap','addSmtp','/:id/interactions','addApplications','/:id/send','send','put','update','delete','removeDispositions','removeAnswers','removeImap','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','describe','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers'];(function(_0x3fa165,_0x2825b4){var _0x252831=function(_0x184c3c){while(--_0x184c3c){_0x3fa165['push'](_0x3fa165['shift']());}};_0x252831(++_0x2825b4);}(_0xe774,0x1e1));var _0x4e77=function(_0x1d634c,_0x1baadf){_0x1d634c=_0x1d634c-0x0;var _0x5dcd50=_0xe774[_0x1d634c];return _0x5dcd50;};'use strict';var multer=require(_0x4e77('0x0'));var util=require(_0x4e77('0x1'));var path=require(_0x4e77('0x2'));var timeout=require(_0x4e77('0x3'));var express=require(_0x4e77('0x4'));var router=express[_0x4e77('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4e77('0x6'));var interaction=require(_0x4e77('0x7'));var config=require(_0x4e77('0x8'));var controller=require(_0x4e77('0x9'));router[_0x4e77('0xa')]('/',auth[_0x4e77('0xb')](),controller[_0x4e77('0xc')]);router[_0x4e77('0xa')]('/describe',auth[_0x4e77('0xb')](),controller[_0x4e77('0xd')]);router[_0x4e77('0xa')](_0x4e77('0xe'),auth[_0x4e77('0xb')](),controller['show']);router[_0x4e77('0xa')](_0x4e77('0xf'),auth[_0x4e77('0xb')](),controller[_0x4e77('0x10')]);router[_0x4e77('0xa')]('/:id/canned_answers',auth[_0x4e77('0xb')](),controller[_0x4e77('0x11')]);router['get'](_0x4e77('0x12'),auth[_0x4e77('0xb')](),controller[_0x4e77('0x13')]);router[_0x4e77('0xa')](_0x4e77('0x14'),auth[_0x4e77('0xb')](),controller[_0x4e77('0x15')]);router[_0x4e77('0xa')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x4e77('0x16')]);router['get'](_0x4e77('0x17'),auth[_0x4e77('0xb')](),controller['getApplications']);router['get'](_0x4e77('0x18'),auth[_0x4e77('0xb')](),controller[_0x4e77('0x19')]);router['get'](_0x4e77('0x1a'),auth[_0x4e77('0xb')](),controller[_0x4e77('0x1b')]);router[_0x4e77('0xa')](_0x4e77('0x1c'),auth[_0x4e77('0xb')](),controller[_0x4e77('0x1d')]);router[_0x4e77('0x1e')](_0x4e77('0xf'),auth[_0x4e77('0xb')](),controller[_0x4e77('0x1f')]);router[_0x4e77('0x1e')](_0x4e77('0x20'),auth[_0x4e77('0xb')](),controller[_0x4e77('0x21')]);router[_0x4e77('0x1e')]('/',auth[_0x4e77('0xb')](),controller[_0x4e77('0x22')]);router['post'](_0x4e77('0x12'),auth[_0x4e77('0xb')](),controller[_0x4e77('0x23')]);router[_0x4e77('0x1e')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x4e77('0x24')]);router[_0x4e77('0x1e')](_0x4e77('0x25'),auth[_0x4e77('0xb')](),controller['addInteraction']);router['post']('/:id/applications',auth[_0x4e77('0xb')](),controller[_0x4e77('0x26')]);router['post'](_0x4e77('0x27'),auth[_0x4e77('0xb')](),controller[_0x4e77('0x28')]);router[_0x4e77('0x1e')]('/:id/users',auth[_0x4e77('0xb')](),controller['addAgents']);router[_0x4e77('0x29')](_0x4e77('0xe'),auth['isAuthenticated'](),controller[_0x4e77('0x2a')]);router[_0x4e77('0x2b')](_0x4e77('0xf'),auth[_0x4e77('0xb')](),controller[_0x4e77('0x2c')]);router[_0x4e77('0x2b')](_0x4e77('0x20'),auth[_0x4e77('0xb')](),controller[_0x4e77('0x2d')]);router[_0x4e77('0x2b')](_0x4e77('0x12'),auth[_0x4e77('0xb')](),controller[_0x4e77('0x2e')]);router[_0x4e77('0x2b')](_0x4e77('0x14'),auth['isAuthenticated'](),controller['removeSmtp']);router[_0x4e77('0x2b')]('/:id',auth['isAuthenticated'](),controller[_0x4e77('0x2f')]);router['delete'](_0x4e77('0x1c'),auth[_0x4e77('0xb')](),controller[_0x4e77('0x30')]);module[_0x4e77('0x31')]=router; \ No newline at end of file +var _0x88a9=['isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addAnswer','create','addImap','/:id/out_servers','addSmtp','addInteraction','/:id/send','send','put','update','delete','removeDispositions','removeImap','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','index','get','/describe','describe','/:id'];(function(_0x5f0869,_0x2b643c){var _0x5c5ef2=function(_0x856497){while(--_0x856497){_0x5f0869['push'](_0x5f0869['shift']());}};_0x5c5ef2(++_0x2b643c);}(_0x88a9,0x10b));var _0x988a=function(_0x32f7e9,_0x2e763f){_0x32f7e9=_0x32f7e9-0x0;var _0xc147e6=_0x88a9[_0x32f7e9];return _0xc147e6;};'use strict';var multer=require('multer');var util=require(_0x988a('0x0'));var path=require(_0x988a('0x1'));var timeout=require(_0x988a('0x2'));var express=require(_0x988a('0x3'));var router=express[_0x988a('0x4')]();var fs_extra=require(_0x988a('0x5'));var auth=require(_0x988a('0x6'));var interaction=require(_0x988a('0x7'));var config=require(_0x988a('0x8'));var controller=require(_0x988a('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x988a('0xa')]);router[_0x988a('0xb')](_0x988a('0xc'),auth['isAuthenticated'](),controller[_0x988a('0xd')]);router[_0x988a('0xb')](_0x988a('0xe'),auth[_0x988a('0xf')](),controller[_0x988a('0x10')]);router[_0x988a('0xb')](_0x988a('0x11'),auth[_0x988a('0xf')](),controller[_0x988a('0x12')]);router['get'](_0x988a('0x13'),auth[_0x988a('0xf')](),controller[_0x988a('0x14')]);router[_0x988a('0xb')](_0x988a('0x15'),auth[_0x988a('0xf')](),controller[_0x988a('0x16')]);router[_0x988a('0xb')]('/:id/out_servers',auth[_0x988a('0xf')](),controller['getSmtp']);router[_0x988a('0xb')](_0x988a('0x17'),auth['isAuthenticated'](),controller[_0x988a('0x18')]);router[_0x988a('0xb')](_0x988a('0x19'),auth[_0x988a('0xf')](),controller[_0x988a('0x1a')]);router['get']('/:id/messages',auth[_0x988a('0xf')](),controller[_0x988a('0x1b')]);router['get'](_0x988a('0x1c'),auth[_0x988a('0xf')](),controller[_0x988a('0x1d')]);router[_0x988a('0xb')](_0x988a('0x1e'),auth[_0x988a('0xf')](),controller[_0x988a('0x1f')]);router['post'](_0x988a('0x11'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x988a('0x20')](_0x988a('0x13'),auth[_0x988a('0xf')](),controller[_0x988a('0x21')]);router[_0x988a('0x20')]('/',auth['isAuthenticated'](),controller[_0x988a('0x22')]);router['post'](_0x988a('0x15'),auth[_0x988a('0xf')](),controller[_0x988a('0x23')]);router[_0x988a('0x20')](_0x988a('0x24'),auth[_0x988a('0xf')](),controller[_0x988a('0x25')]);router[_0x988a('0x20')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x988a('0x26')]);router[_0x988a('0x20')](_0x988a('0x19'),auth[_0x988a('0xf')](),controller['addApplications']);router['post'](_0x988a('0x27'),auth['isAuthenticated'](),controller[_0x988a('0x28')]);router['post'](_0x988a('0x1e'),auth[_0x988a('0xf')](),controller['addAgents']);router[_0x988a('0x29')]('/:id',auth['isAuthenticated'](),controller[_0x988a('0x2a')]);router[_0x988a('0x2b')](_0x988a('0x11'),auth['isAuthenticated'](),controller[_0x988a('0x2c')]);router['delete'](_0x988a('0x13'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x988a('0x2b')](_0x988a('0x15'),auth['isAuthenticated'](),controller[_0x988a('0x2d')]);router['delete'](_0x988a('0x24'),auth[_0x988a('0xf')](),controller['removeSmtp']);router[_0x988a('0x2b')]('/:id',auth[_0x988a('0xf')](),controller[_0x988a('0x2e')]);router[_0x988a('0x2b')](_0x988a('0x1e'),auth[_0x988a('0xf')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index bf53539..522a3c3 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 _0xa1a5=['sequelize','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x5e1fea,_0x386dd3){var _0x445f4c=function(_0x2516c4){while(--_0x2516c4){_0x5e1fea['push'](_0x5e1fea['shift']());}};_0x445f4c(++_0x386dd3);}(_0xa1a5,0x1b8));var _0x5a1a=function(_0xb2ec1d,_0x333262){_0xb2ec1d=_0xb2ec1d-0x0;var _0x2bf524=_0xa1a5[_0xb2ec1d];return _0x2bf524;};'use strict';var Sequelize=require(_0x5a1a('0x0'));module['exports']={'description':{'type':Sequelize[_0x5a1a('0x1')]},'name':{'type':Sequelize[_0x5a1a('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x5a1a('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x5a1a('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x5a1a('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x5a1a('0x3')]},'markAsUnread':{'type':Sequelize[_0x5a1a('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x5a1a('0x1')],'allowNull':![],'defaultValue':_0x5a1a('0x4')},'fontSize':{'type':Sequelize[_0x5a1a('0x5')](0x2)[_0x5a1a('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x5a1a('0x3')],'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[_0x5a1a('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5a1a('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5a1a('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5a1a('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5a1a('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5a1a('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5a1a('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5a1a('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x5a1a('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x5a1a('0x8'),'set':function(_0x27baef){if(!_0x27baef)this[_0x5a1a('0x9')]('mandatoryDispositionPauseId',null);this[_0x5a1a('0x9')]('mandatoryDisposition',_0x27baef);}}}; \ No newline at end of file +var _0xa9b1=['mandatoryDisposition','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x488814,_0x3fec59){var _0x58138b=function(_0x575c59){while(--_0x575c59){_0x488814['push'](_0x488814['shift']());}};_0x58138b(++_0x3fec59);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x1a9b('0x0')]},'name':{'type':Sequelize[_0x1a9b('0x0')],'allowNull':![]},'service':{'type':Sequelize[_0x1a9b('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0x1a9b('0x0')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x1a9b('0x1')],'defaultValue':!![]},'key':{'type':Sequelize[_0x1a9b('0x0')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1a9b('0x2')},'fontSize':{'type':Sequelize[_0x1a9b('0x3')](0x2)[_0x1a9b('0x4')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x1a9b('0x5')],'defaultValue':function(){return _0x1a9b('0x6');}},'notificationSound':{'type':Sequelize[_0x1a9b('0x1')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1a9b('0x1')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1a9b('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1a9b('0x1')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1a9b('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1a9b('0x1')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1a9b('0x3')],'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[_0x1a9b('0x1')],'defaultValue':![],'comment':_0x1a9b('0x7'),'set':function(_0x2c2ee4){if(!_0x2c2ee4)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0x1a9b('0x8'),_0x2c2ee4);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 378f794..fc8860d 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 _0xb20b=['CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','join','root','server/files/attachments','auth','secure','List\x20not\x20found','messageId','subject','out','Interaction','verifySmtp','VerifySmtp','Sequelize','ValidationError','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','html-to-text','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./mailAccount.socket','register','client','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','MailAccounts','UserProfileResource','end','sendStatus','stack','name','send','MailServerIn','Imap','Pause','map','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','options','MailAccount','includeAll','include','findAll','rows','params','MailServerOut','Smtp','mandatoryDispositionPause','body','find','describe','MailAccountId','create','findOne','pick','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','key','email','ListId','isNil','active','description','cservice','cauthentication','user','cuser','pass','cpassword','authentication','host','port','service','password','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','true'];(function(_0x5b8262,_0x93ab76){var _0x21f734=function(_0x2e9df6){while(--_0x2e9df6){_0x5b8262['push'](_0x5b8262['shift']());}};_0x21f734(++_0x93ab76);}(_0xb20b,0x1b4));var _0xbb20=function(_0xf321e1,_0x2a1a0b){_0xf321e1=_0xf321e1-0x0;var _0x30f958=_0xb20b[_0xf321e1];return _0x30f958;};'use strict';var emlformat=require(_0xbb20('0x0'));var rimraf=require(_0xbb20('0x1'));var zipdir=require(_0xbb20('0x2'));var jsonpatch=require(_0xbb20('0x3'));var rp=require('request-promise');var moment=require(_0xbb20('0x4'));var BPromise=require(_0xbb20('0x5'));var Mustache=require(_0xbb20('0x6'));var util=require('util');var path=require(_0xbb20('0x7'));var sox=require(_0xbb20('0x8'));var csv=require(_0xbb20('0x9'));var ejs=require(_0xbb20('0xa'));var fs=require('fs');var fs_extra=require(_0xbb20('0xb'));var _=require(_0xbb20('0xc'));var squel=require(_0xbb20('0xd'));var crypto=require(_0xbb20('0xe'));var jsforce=require(_0xbb20('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbb20('0x9'));var querystring=require(_0xbb20('0x10'));var Papa=require(_0xbb20('0x11'));var htmlToText=require(_0xbb20('0x12'));var juice=require('juice');var Redis=require('ioredis');var authService=require(_0xbb20('0x13'));var qs=require(_0xbb20('0x14'));var as=require(_0xbb20('0x15'));var hardwareService=require(_0xbb20('0x16'));var logger=require(_0xbb20('0x17'))(_0xbb20('0x18'));var utils=require(_0xbb20('0x19'));var config=require(_0xbb20('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb20('0x1b'))['db'];config[_0xbb20('0x1c')]=_['defaults'](config[_0xbb20('0x1c')],{'host':_0xbb20('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbb20('0x1e'))[_0xbb20('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0xbb20('0x20')][_0xbb20('0x21')]({'port':0x232b});function respondWithRpcPromise(_0x38ffbe,_0x2b18eb,_0x58b73d,_0x334c4c){return new BPromise(function(_0x3fb302,_0x1abdaf){var _0x505101=_0x334c4c||client;return _0x505101[_0xbb20('0x22')](_0x38ffbe,_0x58b73d)['then'](function(_0x384e15){logger[_0xbb20('0x23')](_0xbb20('0x24'),_0x2b18eb,_0xbb20('0x25'));logger[_0xbb20('0x26')](_0xbb20('0x27'),_0x2b18eb,'request\x20sent',JSON[_0xbb20('0x28')](_0x384e15));if(_0x384e15[_0xbb20('0x29')]){if(_0x384e15[_0xbb20('0x29')][_0xbb20('0x2a')]===0x1f4){logger['error'](_0xbb20('0x24'),_0x2b18eb,_0x384e15['error'][_0xbb20('0x2b')]);return _0x1abdaf(_0x384e15[_0xbb20('0x29')][_0xbb20('0x2b')]);}logger[_0xbb20('0x29')](_0xbb20('0x24'),_0x2b18eb,_0x384e15['error'][_0xbb20('0x2b')]);return _0x3fb302(_0x384e15[_0xbb20('0x29')][_0xbb20('0x2b')]);}else{logger[_0xbb20('0x23')](_0xbb20('0x24'),_0x2b18eb,_0xbb20('0x25'));_0x3fb302(_0x384e15[_0xbb20('0x2c')][_0xbb20('0x2b')]);}})[_0xbb20('0x2d')](function(_0x2d8b45){logger[_0xbb20('0x29')](_0xbb20('0x24'),_0x2b18eb,_0x2d8b45);_0x1abdaf(_0x2d8b45);});});}function respondWithStatusCode(_0x3edfe8,_0x53ccc9){_0x53ccc9=_0x53ccc9||0xcc;return function(_0x486a45){if(_0x486a45){return _0x3edfe8['sendStatus'](_0x53ccc9);}return _0x3edfe8[_0xbb20('0x2e')](_0x53ccc9)['end']();};}function respondWithResult(_0x56ddb1,_0x3c1196){_0x3c1196=_0x3c1196||0xc8;return function(_0x25fee0){if(_0x25fee0){return _0x56ddb1['status'](_0x3c1196)[_0xbb20('0x2f')](_0x25fee0);}};}function respondWithFilteredResult(_0x191e24,_0x33e9b6){return function(_0x1f8ed9){if(_0x1f8ed9){var _0x1282c6=typeof _0x33e9b6[_0xbb20('0x30')]===_0xbb20('0x31')&&typeof _0x33e9b6[_0xbb20('0x32')]===_0xbb20('0x31');var _0x5384c6=_0x1f8ed9[_0xbb20('0x33')];var _0x1caedf=_0x1282c6?0x0:_0x33e9b6[_0xbb20('0x30')];var _0x35cce8=_0x1282c6?_0x1f8ed9[_0xbb20('0x33')]:_0x33e9b6[_0xbb20('0x30')]+_0x33e9b6[_0xbb20('0x32')];var _0x33df9d;if(_0x35cce8>=_0x5384c6){_0x35cce8=_0x5384c6;_0x33df9d=0xc8;}else{_0x33df9d=0xce;}_0x191e24['status'](_0x33df9d);return _0x191e24[_0xbb20('0x34')]('Content-Range',_0x1caedf+'-'+_0x35cce8+'/'+_0x5384c6)[_0xbb20('0x2f')](_0x1f8ed9);}return null;};}function patchUpdates(_0x358f86){return function(_0x3674ae){try{jsonpatch[_0xbb20('0x35')](_0x3674ae,_0x358f86,!![]);}catch(_0x5a3ed4){return BPromise[_0xbb20('0x36')](_0x5a3ed4);}return _0x3674ae[_0xbb20('0x37')]();};}function saveUpdates(_0x2a3591,_0x2589f3){return function(_0x48be73){if(_0x48be73){return _0x48be73[_0xbb20('0x38')](_0x2a3591)[_0xbb20('0x39')](function(_0x295ef0){return _0x295ef0;});}return null;};}function removeEntity(_0x5f49a1,_0x184cd0){return function(_0x32e7d3){if(_0x32e7d3){return _0x32e7d3[_0xbb20('0x3a')]()['then'](function(){var _0xc01de=_0x32e7d3[_0xbb20('0x3b')]({'plain':!![]});var _0xc6cf07=_0xbb20('0x3c');return db[_0xbb20('0x3d')][_0xbb20('0x3a')]({'where':{'type':_0xc6cf07,'resourceId':_0xc01de['id']}})[_0xbb20('0x39')](function(){return _0x32e7d3;});})['then'](function(){_0x5f49a1[_0xbb20('0x2e')](0xcc)[_0xbb20('0x3e')]();});}};}function handleEntityNotFound(_0x3a4802,_0x3f1d80){return function(_0x4dc1e2){if(!_0x4dc1e2){_0x3a4802[_0xbb20('0x3f')](0x194);}return _0x4dc1e2;};}function handleError(_0x50ab42,_0x557354){_0x557354=_0x557354||0x1f4;return function(_0x3fe51a){logger[_0xbb20('0x29')](_0x3fe51a[_0xbb20('0x40')]);if(_0x3fe51a[_0xbb20('0x41')]){delete _0x3fe51a[_0xbb20('0x41')];}_0x50ab42[_0xbb20('0x2e')](_0x557354)[_0xbb20('0x42')](_0x3fe51a);};}exports['index']=function(_0x122858,_0x1927de){var _0x3817a2={'include':[{'model':db[_0xbb20('0x43')],'as':_0xbb20('0x44')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xbb20('0x45')],'as':'mandatoryDispositionPause'}]},_0x5adf4b={},_0x877dff={'count':0x0,'rows':[]};var _0x5979e2=_[_0xbb20('0x46')](db['MailAccount'][_0xbb20('0x47')],function(_0xb7b665){return{'name':_0xb7b665['fieldName'],'type':_0xb7b665[_0xbb20('0x48')]['key']};});_0x5adf4b[_0xbb20('0x49')]=_[_0xbb20('0x46')](_0x5979e2,_0xbb20('0x41'));_0x5adf4b[_0xbb20('0x4a')]=_[_0xbb20('0x4b')](_0x122858[_0xbb20('0x4a')]);_0x5adf4b['filters']=_[_0xbb20('0x4c')](_0x5adf4b[_0xbb20('0x49')],_0x5adf4b[_0xbb20('0x4a')]);_0x3817a2[_0xbb20('0x4d')]=_[_0xbb20('0x4c')](_0x5adf4b[_0xbb20('0x49')],qs['fields'](_0x122858['query'][_0xbb20('0x4e')]));_0x3817a2[_0xbb20('0x4d')]=_0x3817a2[_0xbb20('0x4d')][_0xbb20('0x4f')]?_0x3817a2['attributes']:_0x5adf4b[_0xbb20('0x49')];if(!_0x122858[_0xbb20('0x4a')][_0xbb20('0x50')](_0xbb20('0x51'))){_0x3817a2['limit']=qs['limit'](_0x122858[_0xbb20('0x4a')][_0xbb20('0x32')]);_0x3817a2[_0xbb20('0x30')]=qs[_0xbb20('0x30')](_0x122858[_0xbb20('0x4a')][_0xbb20('0x30')]);}_0x3817a2[_0xbb20('0x52')]=qs['sort'](_0x122858['query'][_0xbb20('0x53')]);_0x3817a2[_0xbb20('0x54')]=qs[_0xbb20('0x55')](_['pick'](_0x122858[_0xbb20('0x4a')],_0x5adf4b['filters']),_0x5979e2);if(_0x122858[_0xbb20('0x4a')]['filter']){_0x3817a2['where']=_[_0xbb20('0x56')](_0x3817a2['where'],{'$or':_[_0xbb20('0x46')](_0x5979e2,function(_0x3d3810){if(_0x3d3810[_0xbb20('0x48')]!=='VIRTUAL'){var _0x54a886={};_0x54a886[_0x3d3810['name']]={'$like':'%'+_0x122858[_0xbb20('0x4a')][_0xbb20('0x57')]+'%'};return _0x54a886;}})});}_0x3817a2=_[_0xbb20('0x56')]({},_0x3817a2,_0x122858[_0xbb20('0x58')]);var _0xbe7b93={'where':_0x3817a2['where']};return db[_0xbb20('0x59')][_0xbb20('0x33')](_0xbe7b93)[_0xbb20('0x39')](function(_0x55c2ef){_0x877dff['count']=_0x55c2ef;if(_0x122858[_0xbb20('0x4a')][_0xbb20('0x5a')]){_0x3817a2[_0xbb20('0x5b')]=[{'all':!![]}];}return db[_0xbb20('0x59')][_0xbb20('0x5c')](_0x3817a2);})[_0xbb20('0x39')](function(_0x2dc0ae){_0x877dff[_0xbb20('0x5d')]=_0x2dc0ae;return _0x877dff;})[_0xbb20('0x39')](respondWithFilteredResult(_0x1927de,_0x3817a2))[_0xbb20('0x2d')](handleError(_0x1927de,null));};exports['show']=function(_0x3cb859,_0x38d93d){var _0x102e10={'raw':![],'where':{'id':_0x3cb859[_0xbb20('0x5e')]['id']},'include':[{'model':db[_0xbb20('0x43')],'as':'Imap'},{'model':db[_0xbb20('0x5f')],'as':_0xbb20('0x60')},{'model':db[_0xbb20('0x45')],'as':_0xbb20('0x61')}]},_0x34cff8={};_0x34cff8[_0xbb20('0x49')]=_['keys'](db[_0xbb20('0x59')][_0xbb20('0x47')]);_0x34cff8[_0xbb20('0x4a')]=_[_0xbb20('0x4b')](_0x3cb859[_0xbb20('0x4a')]);_0x34cff8[_0xbb20('0x55')]=_[_0xbb20('0x4c')](_0x34cff8[_0xbb20('0x49')],_0x34cff8[_0xbb20('0x4a')]);_0x102e10[_0xbb20('0x4d')]=_[_0xbb20('0x4c')](_0x34cff8['model'],qs[_0xbb20('0x4e')](_0x3cb859['query'][_0xbb20('0x4e')]));_0x102e10[_0xbb20('0x4d')]=_0x102e10[_0xbb20('0x4d')][_0xbb20('0x4f')]?_0x102e10[_0xbb20('0x4d')]:_0x34cff8[_0xbb20('0x49')];if(_0x3cb859[_0xbb20('0x4a')][_0xbb20('0x5a')]){_0x102e10[_0xbb20('0x5b')]=[{'all':!![]}];}_0x102e10=_[_0xbb20('0x56')]({},_0x102e10,_0x3cb859[_0xbb20('0x58')]);return db['MailAccount']['find'](_0x102e10)[_0xbb20('0x39')](handleEntityNotFound(_0x38d93d,null))[_0xbb20('0x39')](respondWithResult(_0x38d93d,null))[_0xbb20('0x2d')](handleError(_0x38d93d,null));};exports[_0xbb20('0x38')]=function(_0x56b93c,_0x3afd24){if(_0x56b93c[_0xbb20('0x62')]['id']){delete _0x56b93c[_0xbb20('0x62')]['id'];}return db[_0xbb20('0x59')][_0xbb20('0x63')]({'where':{'id':_0x56b93c[_0xbb20('0x5e')]['id']},'include':[{'model':db[_0xbb20('0x43')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0xbb20('0x60')},{'model':db['Pause'],'as':_0xbb20('0x61')}]})[_0xbb20('0x39')](handleEntityNotFound(_0x3afd24,null))['then'](saveUpdates(_0x56b93c[_0xbb20('0x62')],null))[_0xbb20('0x39')](function(_0x3e851f){if(_0x3e851f&&_0x56b93c['body']['Imap']){return db[_0xbb20('0x43')]['update'](_0x56b93c['body'][_0xbb20('0x44')],{'where':{'MailAccountId':_0x3e851f['id']}})[_0xbb20('0x39')](function(){return _0x3e851f;});}return _0x3e851f;})['then'](function(_0x547d3b){if(_0x547d3b&&_0x56b93c[_0xbb20('0x62')][_0xbb20('0x60')]){return db['MailServerOut'][_0xbb20('0x38')](_0x56b93c[_0xbb20('0x62')][_0xbb20('0x60')],{'where':{'MailAccountId':_0x547d3b['id']}})[_0xbb20('0x39')](function(){return _0x547d3b;});}return _0x547d3b;})[_0xbb20('0x39')](respondWithResult(_0x3afd24,null))[_0xbb20('0x2d')](handleError(_0x3afd24,null));};exports['describe']=function(_0x45a148,_0x40fe1e){return db[_0xbb20('0x59')][_0xbb20('0x64')]()[_0xbb20('0x39')](respondWithResult(_0x40fe1e,null))['catch'](handleError(_0x40fe1e,null));};exports['addDisposition']=function(_0xbe1ea7,_0x4f7730,_0x6aec77){if(_0xbe1ea7[_0xbb20('0x62')]['id']){delete _0xbe1ea7[_0xbb20('0x62')]['id'];}return db[_0xbb20('0x59')][_0xbb20('0x63')]({'where':{'id':_0xbe1ea7[_0xbb20('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4f7730,null))[_0xbb20('0x39')](function(_0x3507ba){if(_0x3507ba){_0xbe1ea7['body'][_0xbb20('0x65')]=_0x3507ba['id'];return db['Disposition'][_0xbb20('0x66')](_0xbe1ea7['body']);}})['then'](respondWithResult(_0x4f7730,null))[_0xbb20('0x2d')](handleError(_0x4f7730,null));};exports['getDispositions']=function(_0x5163f1,_0x3889cf,_0x35b7c3){var _0xa1c51f={'raw':![],'where':{}};var _0x55463f={};var _0x3ab905={'count':0x0,'rows':[]};return db[_0xbb20('0x59')][_0xbb20('0x67')]({'where':{'id':_0x5163f1[_0xbb20('0x5e')]['id']}})[_0xbb20('0x39')](handleEntityNotFound(_0x3889cf,null))['then'](function(_0x44484f){if(_0x44484f){_0x55463f[_0xbb20('0x49')]=_[_0xbb20('0x4b')](db['Disposition'][_0xbb20('0x47')]);_0x55463f['query']=_['keys'](_0x5163f1['query']);_0x55463f[_0xbb20('0x55')]=_[_0xbb20('0x4c')](_0x55463f[_0xbb20('0x49')],_0x55463f['query']);_0xa1c51f[_0xbb20('0x4d')]=_['intersection'](_0x55463f['model'],qs[_0xbb20('0x4e')](_0x5163f1['query'][_0xbb20('0x4e')]));_0xa1c51f['attributes']=_0xa1c51f[_0xbb20('0x4d')][_0xbb20('0x4f')]?_0xa1c51f[_0xbb20('0x4d')]:_0x55463f[_0xbb20('0x49')];if(!_0x5163f1[_0xbb20('0x4a')][_0xbb20('0x50')]('nolimit')){_0xa1c51f['limit']=qs[_0xbb20('0x32')](_0x5163f1[_0xbb20('0x4a')][_0xbb20('0x32')]);_0xa1c51f[_0xbb20('0x30')]=qs[_0xbb20('0x30')](_0x5163f1[_0xbb20('0x4a')][_0xbb20('0x30')]);}_0xa1c51f['order']=qs[_0xbb20('0x53')](_0x5163f1['query'][_0xbb20('0x53')]);_0xa1c51f[_0xbb20('0x54')]=qs['filters'](_[_0xbb20('0x68')](_0x5163f1[_0xbb20('0x4a')],_0x55463f[_0xbb20('0x55')]));_0xa1c51f[_0xbb20('0x54')][_0xbb20('0x65')]=_0x44484f['id'];if(_0x5163f1[_0xbb20('0x4a')][_0xbb20('0x57')]){_0xa1c51f[_0xbb20('0x54')]=_['merge'](_0xa1c51f[_0xbb20('0x54')],{'$or':_[_0xbb20('0x46')](_0xa1c51f[_0xbb20('0x4d')],function(_0x2a2d60){var _0x2dfe7e={};_0x2dfe7e[_0x2a2d60]={'$like':'%'+_0x5163f1[_0xbb20('0x4a')][_0xbb20('0x57')]+'%'};return _0x2dfe7e;})});}_0xa1c51f=_[_0xbb20('0x56')]({},_0xa1c51f,_0x5163f1[_0xbb20('0x58')]);return db[_0xbb20('0x69')]['count']({'where':_0xa1c51f[_0xbb20('0x54')]})[_0xbb20('0x39')](function(_0x1f00e9){_0x3ab905[_0xbb20('0x33')]=_0x1f00e9;if(_0x5163f1[_0xbb20('0x4a')]['includeAll']){_0xa1c51f[_0xbb20('0x5b')]=[{'all':!![]}];}return db[_0xbb20('0x69')][_0xbb20('0x5c')](_0xa1c51f);})[_0xbb20('0x39')](function(_0x2a9759){_0x3ab905[_0xbb20('0x5d')]=_0x2a9759;return _0x3ab905;});}})['then'](respondWithFilteredResult(_0x3889cf,_0xa1c51f))[_0xbb20('0x2d')](handleError(_0x3889cf,null));};exports[_0xbb20('0x6a')]=function(_0x47907b,_0x3d440a,_0x2d726b){return db[_0xbb20('0x59')][_0xbb20('0x63')]({'where':{'id':_0x47907b['params']['id']}})[_0xbb20('0x39')](handleEntityNotFound(_0x3d440a,null))['then'](function(_0xfd1f4c){if(_0xfd1f4c){return _0xfd1f4c[_0xbb20('0x6a')](_0x47907b['query'][_0xbb20('0x6b')]);}})[_0xbb20('0x39')](respondWithStatusCode(_0x3d440a,null))['catch'](handleError(_0x3d440a,null));};exports[_0xbb20('0x6c')]=function(_0x368528,_0x179cf6,_0x505039){if(_0x368528[_0xbb20('0x62')]['id']){delete _0x368528['body']['id'];}return db[_0xbb20('0x59')]['find']({'where':{'id':_0x368528[_0xbb20('0x5e')]['id']}})[_0xbb20('0x39')](handleEntityNotFound(_0x179cf6,null))[_0xbb20('0x39')](function(_0xcc34e9){if(_0xcc34e9){_0x368528[_0xbb20('0x62')][_0xbb20('0x65')]=_0xcc34e9['id'];return db[_0xbb20('0x6d')][_0xbb20('0x66')](_0x368528['body']);}})[_0xbb20('0x39')](respondWithResult(_0x179cf6,null))['catch'](handleError(_0x179cf6,null));};exports[_0xbb20('0x6e')]=function(_0x27cb62,_0xb58134,_0x3d79f0){var _0x1d8623={'raw':![],'where':{}};var _0x197bb9={};var _0x4b5504={'count':0x0,'rows':[]};return db[_0xbb20('0x59')][_0xbb20('0x67')]({'where':{'id':_0x27cb62[_0xbb20('0x5e')]['id']}})[_0xbb20('0x39')](handleEntityNotFound(_0xb58134,null))[_0xbb20('0x39')](function(_0x428f45){if(_0x428f45){_0x197bb9['model']=_[_0xbb20('0x4b')](db[_0xbb20('0x6d')][_0xbb20('0x47')]);_0x197bb9[_0xbb20('0x4a')]=_[_0xbb20('0x4b')](_0x27cb62[_0xbb20('0x4a')]);_0x197bb9[_0xbb20('0x55')]=_[_0xbb20('0x4c')](_0x197bb9[_0xbb20('0x49')],_0x197bb9['query']);_0x1d8623[_0xbb20('0x4d')]=_[_0xbb20('0x4c')](_0x197bb9[_0xbb20('0x49')],qs['fields'](_0x27cb62['query'][_0xbb20('0x4e')]));_0x1d8623[_0xbb20('0x4d')]=_0x1d8623[_0xbb20('0x4d')][_0xbb20('0x4f')]?_0x1d8623[_0xbb20('0x4d')]:_0x197bb9['model'];if(!_0x27cb62['query']['hasOwnProperty']('nolimit')){_0x1d8623['limit']=qs[_0xbb20('0x32')](_0x27cb62[_0xbb20('0x4a')][_0xbb20('0x32')]);_0x1d8623[_0xbb20('0x30')]=qs[_0xbb20('0x30')](_0x27cb62[_0xbb20('0x4a')]['offset']);}_0x1d8623[_0xbb20('0x52')]=qs[_0xbb20('0x53')](_0x27cb62[_0xbb20('0x4a')]['sort']);_0x1d8623['where']=qs['filters'](_[_0xbb20('0x68')](_0x27cb62['query'],_0x197bb9[_0xbb20('0x55')]));_0x1d8623[_0xbb20('0x54')][_0xbb20('0x65')]=_0x428f45['id'];if(_0x27cb62['query'][_0xbb20('0x57')]){_0x1d8623[_0xbb20('0x54')]=_['merge'](_0x1d8623['where'],{'$or':_['map'](_0x1d8623[_0xbb20('0x4d')],function(_0x53a028){var _0xb359b0={};_0xb359b0[_0x53a028]={'$like':'%'+_0x27cb62['query'][_0xbb20('0x57')]+'%'};return _0xb359b0;})});}_0x1d8623=_[_0xbb20('0x56')]({},_0x1d8623,_0x27cb62['options']);return db[_0xbb20('0x6d')][_0xbb20('0x33')]({'where':_0x1d8623[_0xbb20('0x54')]})[_0xbb20('0x39')](function(_0x255837){_0x4b5504[_0xbb20('0x33')]=_0x255837;if(_0x27cb62[_0xbb20('0x4a')][_0xbb20('0x5a')]){_0x1d8623[_0xbb20('0x5b')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x1d8623);})[_0xbb20('0x39')](function(_0x25f9e2){_0x4b5504[_0xbb20('0x5d')]=_0x25f9e2;return _0x4b5504;});}})['then'](respondWithFilteredResult(_0xb58134,_0x1d8623))[_0xbb20('0x2d')](handleError(_0xb58134,null));};exports[_0xbb20('0x6f')]=function(_0x2f7eb4,_0x397b40,_0x3e61e5){return db[_0xbb20('0x59')][_0xbb20('0x63')]({'where':{'id':_0x2f7eb4[_0xbb20('0x5e')]['id']}})[_0xbb20('0x39')](handleEntityNotFound(_0x397b40,null))[_0xbb20('0x39')](function(_0x355c40){if(_0x355c40){return _0x355c40[_0xbb20('0x6f')](_0x2f7eb4[_0xbb20('0x4a')]['ids']);}})['then'](respondWithStatusCode(_0x397b40,null))[_0xbb20('0x2d')](handleError(_0x397b40,null));};exports[_0xbb20('0x66')]=function(_0x1bfc95,_0x558204){var _0x5060ae={'name':_0x1bfc95[_0xbb20('0x62')][_0xbb20('0x41')],'key':_0x1bfc95['body'][_0xbb20('0x70')],'email':_0x1bfc95['body'][_0xbb20('0x71')],'ListId':_0x1bfc95[_0xbb20('0x62')][_0xbb20('0x72')],'active':!_[_0xbb20('0x73')](_0x1bfc95[_0xbb20('0x62')][_0xbb20('0x74')])?_0x1bfc95[_0xbb20('0x62')]['active']:!![],'description':_0x1bfc95[_0xbb20('0x62')][_0xbb20('0x75')]||null,'Imap':{},'Smtp':{}};if(_[_0xbb20('0x73')](_0x1bfc95['body'][_0xbb20('0x76')])){if(_0x1bfc95['body'][_0xbb20('0x77')]){_0x5060ae['Imap'][_0xbb20('0x78')]=_0x5060ae[_0xbb20('0x60')][_0xbb20('0x78')]=_0x1bfc95[_0xbb20('0x62')][_0xbb20('0x79')];_0x5060ae['Imap']['password']=_0x5060ae[_0xbb20('0x60')][_0xbb20('0x7a')]=_0x1bfc95['body'][_0xbb20('0x7b')];}else{_0x5060ae[_0xbb20('0x44')]['authentication']=_0x5060ae[_0xbb20('0x60')][_0xbb20('0x7c')]=![];}_0x5060ae['Imap'][_0xbb20('0x7d')]=_0x1bfc95[_0xbb20('0x62')]['Imap']['host'];_0x5060ae[_0xbb20('0x44')][_0xbb20('0x7e')]=_0x1bfc95[_0xbb20('0x62')][_0xbb20('0x44')]['port'];_0x5060ae[_0xbb20('0x60')]['host']=_0x1bfc95[_0xbb20('0x62')][_0xbb20('0x60')]['host'];_0x5060ae['Smtp']['port']=_0x1bfc95[_0xbb20('0x62')][_0xbb20('0x60')][_0xbb20('0x7e')];}else{_0x5060ae[_0xbb20('0x44')][_0xbb20('0x7f')]=_0x5060ae[_0xbb20('0x60')][_0xbb20('0x7f')]=_0x1bfc95[_0xbb20('0x62')][_0xbb20('0x76')];_0x5060ae[_0xbb20('0x44')][_0xbb20('0x78')]=_0x5060ae[_0xbb20('0x60')]['user']=_0x1bfc95[_0xbb20('0x62')][_0xbb20('0x79')];_0x5060ae[_0xbb20('0x44')][_0xbb20('0x80')]=_0x5060ae[_0xbb20('0x60')][_0xbb20('0x7a')]=_0x1bfc95[_0xbb20('0x62')][_0xbb20('0x7b')];}return db[_0xbb20('0x59')]['create'](_0x5060ae,{'include':[{'model':db[_0xbb20('0x5f')],'as':_0xbb20('0x60')},{'model':db[_0xbb20('0x43')],'as':'Imap'}]})['then'](function(_0x580b8e){var _0x4dc3c9=_0x1bfc95[_0xbb20('0x78')][_0xbb20('0x3b')]({'plain':!![]});if(!_0x4dc3c9)throw new Error(_0xbb20('0x81'));if(_0x4dc3c9[_0xbb20('0x82')]==='user'){var _0x48500b=_0x580b8e[_0xbb20('0x3b')]({'plain':!![]});return db[_0xbb20('0x83')][_0xbb20('0x63')]({'where':{'name':_0xbb20('0x3c'),'userProfileId':_0x4dc3c9[_0xbb20('0x84')]},'raw':!![]})[_0xbb20('0x39')](function(_0x5c00e2){if(_0x5c00e2&&_0x5c00e2[_0xbb20('0x85')]===0x0){return db[_0xbb20('0x3d')][_0xbb20('0x66')]({'name':_0x48500b[_0xbb20('0x41')],'resourceId':_0x48500b['id'],'type':_0x5c00e2['name'],'sectionId':_0x5c00e2['id']},{})[_0xbb20('0x39')](function(){return _0x580b8e;});}else{return _0x580b8e;}})[_0xbb20('0x2d')](function(_0x53e598){logger[_0xbb20('0x29')](_0xbb20('0x86'),_0x53e598);throw _0x53e598;});}return _0x580b8e;})[_0xbb20('0x39')](respondWithResult(_0x558204,0xc9))[_0xbb20('0x2d')](handleError(_0x558204,null));};exports[_0xbb20('0x87')]=function(_0x3404b0,_0x45ec3d,_0x58efb7){return db['MailAccount'][_0xbb20('0x67')]({'where':{'id':_0x3404b0['params']['id']}})[_0xbb20('0x39')](handleEntityNotFound(_0x45ec3d,null))[_0xbb20('0x39')](function(_0x3b331e){if(_0x3b331e){return _0x3b331e['getImap']();}return null;})[_0xbb20('0x39')](respondWithResult(_0x45ec3d,null))[_0xbb20('0x2d')](handleError(_0x45ec3d,null));};exports[_0xbb20('0x88')]=function(_0x1bbfa0,_0x1c39dd,_0x568081){if(_0x1bbfa0[_0xbb20('0x62')]['id']){delete _0x1bbfa0[_0xbb20('0x62')]['id'];}return db['MailAccount'][_0xbb20('0x63')]({'where':{'id':_0x1bbfa0[_0xbb20('0x5e')]['id']}})[_0xbb20('0x39')](handleEntityNotFound(_0x1c39dd,null))[_0xbb20('0x39')](function(_0x475d4c){if(_0x475d4c){_0x1bbfa0[_0xbb20('0x62')][_0xbb20('0x65')]=_0x475d4c['id'];return db[_0xbb20('0x43')]['create'](_0x1bbfa0[_0xbb20('0x62')]);}})[_0xbb20('0x39')](respondWithResult(_0x1c39dd,null))[_0xbb20('0x2d')](handleError(_0x1c39dd,null));};exports[_0xbb20('0x89')]=function(_0xe3a7ca,_0x5bcfee,_0x356c3a){return db[_0xbb20('0x59')][_0xbb20('0x67')]({'where':{'id':_0xe3a7ca[_0xbb20('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5bcfee,null))[_0xbb20('0x39')](function(_0x1ad857){if(_0x1ad857){return _0x1ad857[_0xbb20('0x8a')](null);}return null;})[_0xbb20('0x39')](respondWithStatusCode(_0x5bcfee,null))[_0xbb20('0x2d')](handleError(_0x5bcfee,null));};exports[_0xbb20('0x8b')]=function(_0x5dde27,_0x13dd63,_0x45b78d){return db['MailAccount'][_0xbb20('0x67')]({'where':{'id':_0x5dde27[_0xbb20('0x5e')]['id']}})[_0xbb20('0x39')](handleEntityNotFound(_0x13dd63,null))['then'](function(_0x542c27){if(_0x542c27){return _0x542c27[_0xbb20('0x8b')]();}return null;})[_0xbb20('0x39')](respondWithResult(_0x13dd63,null))[_0xbb20('0x2d')](handleError(_0x13dd63,null));};exports[_0xbb20('0x8c')]=function(_0x1a16f5,_0x5499f9,_0x3cb1a3){if(_0x1a16f5[_0xbb20('0x62')]['id']){delete _0x1a16f5['body']['id'];}return db['MailAccount'][_0xbb20('0x63')]({'where':{'id':_0x1a16f5[_0xbb20('0x5e')]['id']}})[_0xbb20('0x39')](handleEntityNotFound(_0x5499f9,null))[_0xbb20('0x39')](function(_0x3a16ab){if(_0x3a16ab){_0x1a16f5[_0xbb20('0x62')][_0xbb20('0x65')]=_0x3a16ab['id'];return db[_0xbb20('0x5f')][_0xbb20('0x66')](_0x1a16f5['body']);}})[_0xbb20('0x39')](respondWithResult(_0x5499f9,null))[_0xbb20('0x2d')](handleError(_0x5499f9,null));};exports[_0xbb20('0x8d')]=function(_0x11a466,_0x3972b2,_0x2892a8){return db[_0xbb20('0x59')][_0xbb20('0x67')]({'where':{'id':_0x11a466[_0xbb20('0x5e')]['id']}})[_0xbb20('0x39')](handleEntityNotFound(_0x3972b2,null))[_0xbb20('0x39')](function(_0x1f5ede){if(_0x1f5ede){return _0x1f5ede[_0xbb20('0x8e')](null);}return null;})[_0xbb20('0x39')](respondWithStatusCode(_0x3972b2,null))[_0xbb20('0x2d')](handleError(_0x3972b2,null));};exports[_0xbb20('0x8f')]=function(_0x1ec32b,_0x4840fd,_0x244d61){return db[_0xbb20('0x90')][_0xbb20('0x63')]({'where':{'id':_0x1ec32b[_0xbb20('0x5e')]['id']}})[_0xbb20('0x39')](handleEntityNotFound(_0x4840fd,null))[_0xbb20('0x39')](function(_0xc5f7e1){if(_0xc5f7e1){return _0xc5f7e1[_0xbb20('0x8f')](_0x1ec32b[_0xbb20('0x62')][_0xbb20('0x6b')],_[_0xbb20('0x91')](_0x1ec32b[_0xbb20('0x62')],[_0xbb20('0x6b'),'id'])||{});}})['then'](respondWithResult(_0x4840fd,null))[_0xbb20('0x2d')](handleError(_0x4840fd,null));};exports[_0xbb20('0x92')]=function(_0x98f008,_0xe64c19,_0x1a0270){var _0x469ef8={'raw':![],'where':{}};var _0x2d0c07={};var _0x2b7bba={'count':0x0,'rows':[]};return db['MailAccount'][_0xbb20('0x67')]({'where':{'id':_0x98f008['params']['id']}})['then'](handleEntityNotFound(_0xe64c19,null))['then'](function(_0x4cacc9){if(_0x4cacc9){_0x2d0c07['model']=_['keys'](db[_0xbb20('0x90')][_0xbb20('0x47')]);_0x2d0c07['query']=_[_0xbb20('0x4b')](_0x98f008['query']);_0x2d0c07[_0xbb20('0x55')]=_[_0xbb20('0x4c')](_0x2d0c07['model'],_0x2d0c07[_0xbb20('0x4a')]);_0x469ef8[_0xbb20('0x4d')]=_[_0xbb20('0x4c')](_0x2d0c07[_0xbb20('0x49')],qs[_0xbb20('0x4e')](_0x98f008[_0xbb20('0x4a')][_0xbb20('0x4e')]));_0x469ef8[_0xbb20('0x4d')]=_0x469ef8[_0xbb20('0x4d')][_0xbb20('0x4f')]?_0x469ef8[_0xbb20('0x4d')]:_0x2d0c07[_0xbb20('0x49')];if(!_0x98f008[_0xbb20('0x4a')]['hasOwnProperty']('nolimit')){_0x469ef8[_0xbb20('0x32')]=qs[_0xbb20('0x32')](_0x98f008[_0xbb20('0x4a')][_0xbb20('0x32')]);_0x469ef8[_0xbb20('0x30')]=qs[_0xbb20('0x30')](_0x98f008[_0xbb20('0x4a')]['offset']);}_0x469ef8[_0xbb20('0x52')]=qs[_0xbb20('0x53')](_0x98f008[_0xbb20('0x4a')][_0xbb20('0x53')]);_0x469ef8['where']=qs[_0xbb20('0x55')](_[_0xbb20('0x68')](_0x98f008[_0xbb20('0x4a')],_0x2d0c07[_0xbb20('0x55')]));_0x469ef8[_0xbb20('0x54')]['MailAccountId']=_0x4cacc9['id'];if(_0x98f008[_0xbb20('0x4a')][_0xbb20('0x57')]){_0x469ef8[_0xbb20('0x54')]=_[_0xbb20('0x56')](_0x469ef8[_0xbb20('0x54')],{'$or':_[_0xbb20('0x46')](_0x469ef8[_0xbb20('0x4d')],function(_0x26d456){var _0x4e7c3c={};_0x4e7c3c[_0x26d456]={'$like':'%'+_0x98f008[_0xbb20('0x4a')][_0xbb20('0x57')]+'%'};return _0x4e7c3c;})});}_0x469ef8=_[_0xbb20('0x56')]({},_0x469ef8,_0x98f008[_0xbb20('0x58')]);return db[_0xbb20('0x90')][_0xbb20('0x33')]({'where':_0x469ef8[_0xbb20('0x54')]})[_0xbb20('0x39')](function(_0xe83409){_0x2b7bba[_0xbb20('0x33')]=_0xe83409;if(_0x98f008[_0xbb20('0x4a')]['includeAll']){_0x469ef8[_0xbb20('0x5b')]=[{'model':db[_0xbb20('0x93')],'as':_0xbb20('0x94'),'required':![]},{'model':db[_0xbb20('0x95')],'as':_0xbb20('0x96'),'attributes':[_0xbb20('0x41'),_0xbb20('0x97'),_0xbb20('0x98')],'required':![]},{'model':db[_0xbb20('0x99')],'as':_0xbb20('0x9a'),'attributes':['id','name',_0xbb20('0x9b')],'where':_0x98f008[_0xbb20('0x4a')][_0xbb20('0x9c')]?{'id':_0x98f008[_0xbb20('0x4a')]['tag']}:undefined,'required':_0x98f008[_0xbb20('0x4a')]['tag']?!![]:![]}];}return db[_0xbb20('0x90')][_0xbb20('0x5c')](_0x469ef8);})[_0xbb20('0x39')](function(_0x3d6452){_0x2b7bba['rows']=_0x3d6452;return _0x2b7bba;});}})[_0xbb20('0x39')](respondWithFilteredResult(_0xe64c19,_0x469ef8))[_0xbb20('0x2d')](handleError(_0xe64c19,null));};exports[_0xbb20('0x9d')]=function addApplications(_0x162074,_0x3c281e){var _0x106c40=_0x162074[_0xbb20('0x5e')]['id'];var _0x4a9429=_0x162074['body'];var _0x35b1c5=0xc8;var _0x494665=null;return db[_0xbb20('0x9e')][_0xbb20('0x9f')]({'isolationLevel':db[_0xbb20('0x9e')][_0xbb20('0xa0')][_0xbb20('0xa1')][_0xbb20('0xa2')]},function(_0x3efc41){return db[_0xbb20('0x59')][_0xbb20('0x67')]({'where':{'id':_0x106c40},'transaction':_0x3efc41})[_0xbb20('0x39')](function(_0x571894){if(_0x571894){return db[_0xbb20('0xa3')]['destroy']({'where':{'MailAccountId':_0x106c40},'transaction':_0x3efc41})[_0xbb20('0x39')](function(){var _0x12243e=_[_0xbb20('0x46')](_0x4a9429,function(_0x427510){_0x427510[_0xbb20('0x65')]=_0x106c40;return _0x427510;});return db[_0xbb20('0xa3')]['bulkCreate'](_0x12243e,{'transaction':_0x3efc41});});}else{_0x35b1c5=0x194;_0x494665=[];}});})[_0xbb20('0x39')](function(){if(_0x35b1c5!==0x194){return db[_0xbb20('0xa3')][_0xbb20('0xa4')]({'where':{'MailAccountId':_0x106c40},'order':'priority'})['then'](function(_0x59628a){_0x494665=_0x59628a;});}})[_0xbb20('0x2d')](function(_0x41be64){_0x35b1c5=0x1f4;logger[_0xbb20('0x29')](_0x41be64[_0xbb20('0x40')]);if(_0x41be64[_0xbb20('0x41')]){delete _0x41be64[_0xbb20('0x41')];}_0x494665=_0x41be64;})['finally'](function(){if(_0x494665===null){_0x3c281e[_0xbb20('0x3f')](_0x35b1c5);}else{if(_0x35b1c5===0x1f4){_0x3c281e[_0xbb20('0x2e')](_0x35b1c5)[_0xbb20('0x42')](_0x494665);}else{_0x3c281e[_0xbb20('0x2e')](_0x35b1c5)[_0xbb20('0x2f')](_0x494665);}}});};exports['getApplications']=function(_0x2b706e,_0x536dbe,_0x2e7a61){var _0x4d56f1={};var _0x39982b={};var _0x3c0b3a;var _0x9a8660;return db['MailAccount']['findOne']({'where':{'id':_0x2b706e[_0xbb20('0x5e')]['id']}})['then'](handleEntityNotFound(_0x536dbe,null))['then'](function(_0x2b4bd7){if(_0x2b4bd7){_0x3c0b3a=_0x2b4bd7;_0x39982b[_0xbb20('0x49')]=_[_0xbb20('0x4b')](db[_0xbb20('0xa3')][_0xbb20('0x47')]);_0x39982b[_0xbb20('0x4a')]=_[_0xbb20('0x4b')](_0x2b706e[_0xbb20('0x4a')]);_0x39982b[_0xbb20('0x55')]=_['intersection'](_0x39982b['model'],_0x39982b['query']);_0x4d56f1[_0xbb20('0x4d')]=_['intersection'](_0x39982b['model'],qs[_0xbb20('0x4e')](_0x2b706e['query']['fields']));_0x4d56f1['attributes']=_0x4d56f1['attributes'][_0xbb20('0x4f')]?_0x4d56f1[_0xbb20('0x4d')]:_0x39982b[_0xbb20('0x49')];_0x4d56f1['order']=qs[_0xbb20('0x53')](_0x2b706e['query'][_0xbb20('0x53')]);_0x4d56f1[_0xbb20('0x54')]=qs['filters'](_[_0xbb20('0x68')](_0x2b706e[_0xbb20('0x4a')],_0x39982b[_0xbb20('0x55')]));if(_0x2b706e[_0xbb20('0x4a')][_0xbb20('0x57')]){_0x4d56f1['where']=_[_0xbb20('0x56')](_0x4d56f1[_0xbb20('0x54')],{'$or':_[_0xbb20('0x46')](_0x4d56f1[_0xbb20('0x4d')],function(_0x29afb0){var _0x3c87cd={};_0x3c87cd[_0x29afb0]={'$like':'%'+_0x2b706e[_0xbb20('0x4a')]['filter']+'%'};return _0x3c87cd;})});}_0x4d56f1=_['merge']({},_0x4d56f1,_0x2b706e[_0xbb20('0x58')]);return _0x3c0b3a[_0xbb20('0xa5')](_0x4d56f1);}})[_0xbb20('0x39')](function(_0x24a003){if(_0x24a003){_0x9a8660=_0x24a003[_0xbb20('0x4f')];if(!_0x2b706e[_0xbb20('0x4a')][_0xbb20('0x50')](_0xbb20('0x51'))){_0x4d56f1['limit']=qs[_0xbb20('0x32')](_0x2b706e['query']['limit']);_0x4d56f1[_0xbb20('0x30')]=qs[_0xbb20('0x30')](_0x2b706e['query']['offset']);}return _0x3c0b3a[_0xbb20('0xa5')](_0x4d56f1);}})['then'](function(_0x51a349){if(_0x51a349){return _0x51a349?{'count':_0x9a8660,'rows':_0x51a349}:null;}})[_0xbb20('0x39')](respondWithResult(_0x536dbe,null))[_0xbb20('0x2d')](handleError(_0x536dbe,null));};exports[_0xbb20('0xa6')]=function(_0x214bb6,_0x1c9124,_0x432405){var _0x11707f={'raw':!![],'where':{}};var _0x5b36a9={};var _0x7d1d08={'count':0x0,'rows':[]};return db[_0xbb20('0x59')][_0xbb20('0x67')]({'where':{'id':_0x214bb6[_0xbb20('0x5e')]['id']}})[_0xbb20('0x39')](handleEntityNotFound(_0x1c9124,null))[_0xbb20('0x39')](function(_0x25c154){if(_0x25c154){_0x5b36a9['model']=_['keys'](db['MailMessage']['rawAttributes']);_0x5b36a9[_0xbb20('0x4a')]=_[_0xbb20('0x4b')](_0x214bb6['query']);_0x5b36a9[_0xbb20('0x55')]=_[_0xbb20('0x4c')](_0x5b36a9[_0xbb20('0x49')],_0x5b36a9[_0xbb20('0x4a')]);_0x11707f[_0xbb20('0x4d')]=_['intersection'](_0x5b36a9['model'],qs['fields'](_0x214bb6[_0xbb20('0x4a')][_0xbb20('0x4e')]));_0x11707f[_0xbb20('0x4d')]=_0x11707f['attributes'][_0xbb20('0x4f')]?_0x11707f[_0xbb20('0x4d')]:_0x5b36a9[_0xbb20('0x49')];if(!_0x214bb6[_0xbb20('0x4a')][_0xbb20('0x50')]('nolimit')){_0x11707f['limit']=qs[_0xbb20('0x32')](_0x214bb6[_0xbb20('0x4a')][_0xbb20('0x32')]);_0x11707f[_0xbb20('0x30')]=qs[_0xbb20('0x30')](_0x214bb6['query']['offset']);}_0x11707f[_0xbb20('0x52')]=qs[_0xbb20('0x53')](_0x214bb6[_0xbb20('0x4a')][_0xbb20('0x53')]);_0x11707f['where']=qs[_0xbb20('0x55')](_[_0xbb20('0x68')](_0x214bb6[_0xbb20('0x4a')],_0x5b36a9[_0xbb20('0x55')]));_0x11707f[_0xbb20('0x54')][_0xbb20('0x65')]=_0x25c154['id'];if(_0x214bb6[_0xbb20('0x4a')][_0xbb20('0x57')]){_0x11707f[_0xbb20('0x54')]=_['merge'](_0x11707f[_0xbb20('0x54')],{'$or':_[_0xbb20('0x46')](_0x11707f[_0xbb20('0x4d')],function(_0x3d4c95){var _0x230a3b={};_0x230a3b[_0x3d4c95]={'$like':'%'+_0x214bb6[_0xbb20('0x4a')][_0xbb20('0x57')]+'%'};return _0x230a3b;})});}if(_0x214bb6[_0xbb20('0x4a')][_0xbb20('0xa7')]){var _0x4c83a3=_0x214bb6[_0xbb20('0x4a')][_0xbb20('0xa7')][_0xbb20('0xa8')](',');var _0x1320aa={};_0x1320aa[_0x4c83a3[0x0]]={'$gte':moment(_0x4c83a3[0x1])[_0xbb20('0xa9')](_0xbb20('0xaa'))};_0x11707f[_0xbb20('0x54')]=_[_0xbb20('0x56')](_0x11707f[_0xbb20('0x54')],_0x1320aa);}_0x11707f=_['merge']({},_0x11707f,_0x214bb6[_0xbb20('0x58')]);return db[_0xbb20('0xab')][_0xbb20('0x33')]({'where':_0x11707f[_0xbb20('0x54')]})[_0xbb20('0x39')](function(_0x32a5fd){_0x7d1d08[_0xbb20('0x33')]=_0x32a5fd;if(_0x214bb6['query'][_0xbb20('0x5a')]){_0x11707f[_0xbb20('0x5b')]=[{'all':!![]}];}return db['MailMessage'][_0xbb20('0x5c')](_0x11707f);})[_0xbb20('0x39')](function(_0xb057e0){if(_0x214bb6[_0xbb20('0x4a')]['inlineCss']===_0xbb20('0xac')){for(var _0x37259f=0x0;_0x37259f<_0xb057e0[_0xbb20('0x4f')];_0x37259f++){_0xb057e0[_0x37259f][_0xbb20('0x62')]=juice(_0xb057e0[_0x37259f][_0xbb20('0x62')]);}}_0x7d1d08['rows']=_0xb057e0;return _0x7d1d08;});}})[_0xbb20('0x39')](respondWithFilteredResult(_0x1c9124,_0x11707f))[_0xbb20('0x2d')](handleError(_0x1c9124,null));};exports[_0xbb20('0x42')]=function(_0x507c77,_0x57ce25,_0xc7f616){var _0x320262,_0x3b5254={},_0x2ee760;if(_0x507c77['body']['to']){_0x2ee760=_0x507c77['body']['to'][_0xbb20('0xa8')](',')[0x0];}return db['MailAccount'][_0xbb20('0x63')]({'where':{'id':_0x507c77[_0xbb20('0x5e')]['id']},'include':[{'model':db[_0xbb20('0xad')],'as':_0xbb20('0xae'),'include':[{'model':db['CmContact'],'as':_0xbb20('0xaf'),'where':{'email':_0x2ee760},'limit':0x1,'order':[[_0xbb20('0xb0'),_0xbb20('0xb1')]]}]},{'model':db['MailServerOut'],'as':_0xbb20('0x60'),'raw':!![]}]})[_0xbb20('0x39')](handleEntityNotFound(_0x57ce25,null))['then'](function(_0x248071){if(_0x248071){_0x320262=_0x248071;if(_0x248071[_0xbb20('0x60')]){if(_[_0xbb20('0x73')](_0x507c77[_0xbb20('0x62')][_0xbb20('0xb2')])){_0x507c77[_0xbb20('0x62')]['from']=util[_0xbb20('0xa9')](_0xbb20('0xb3'),_0x248071[_0xbb20('0x41')],_0x248071[_0xbb20('0x71')]||_0x248071[_0xbb20('0x60')][_0xbb20('0x78')]);}if(_0x507c77[_0xbb20('0x62')][_0xbb20('0xb4')]&&_0x507c77[_0xbb20('0x62')][_0xbb20('0xb4')]['length']){for(var _0x4bc3c4=0x0;_0x4bc3c4<_0x507c77[_0xbb20('0x62')]['attachments'][_0xbb20('0x4f')];_0x4bc3c4+=0x1){_0x507c77['body']['attachments'][_0x4bc3c4]={'filename':_0x507c77['body'][_0xbb20('0xb4')][_0x4bc3c4][_0xbb20('0x41')],'path':path[_0xbb20('0xb5')](config[_0xbb20('0xb6')],_0xbb20('0xb7'),_0x507c77[_0xbb20('0x62')][_0xbb20('0xb4')][_0x4bc3c4]['basename'])};}}var _0x2d6960={'tls':{'rejectUnauthorized':![]}};if(_[_0xbb20('0x73')](_0x248071[_0xbb20('0x60')][_0xbb20('0x7f')])){if(_0x248071[_0xbb20('0x60')][_0xbb20('0x7c')]){_0x2d6960[_0xbb20('0xb8')]={'user':_0x248071['Smtp'][_0xbb20('0x78')],'pass':_0x248071[_0xbb20('0x60')][_0xbb20('0x7a')]};}_0x2d6960[_0xbb20('0x7d')]=_0x248071[_0xbb20('0x60')][_0xbb20('0x7d')];_0x2d6960[_0xbb20('0x7e')]=_0x248071['Smtp'][_0xbb20('0x7e')];_0x2d6960[_0xbb20('0xb9')]=_0x248071[_0xbb20('0x60')][_0xbb20('0xb9')];}else{_0x2d6960['service']=_0x248071[_0xbb20('0x60')]['service'];_0x2d6960['auth']={'user':_0x248071[_0xbb20('0x60')][_0xbb20('0x78')],'pass':_0x248071[_0xbb20('0x60')][_0xbb20('0x7a')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x2d6960,'message':_0x507c77[_0xbb20('0x62')]});}else{throw new Error(_0xbb20('0xba'));}}})[_0xbb20('0x39')](function(_0x2ea397){if(_0x2ea397){_0x3b5254=_0x2ea397;if(_0x320262[_0xbb20('0xae')]){if(_0x320262[_0xbb20('0xae')][_0xbb20('0xaf')][_0xbb20('0x4f')]){return _0x320262['List'][_0xbb20('0xaf')][0x0];}else{return db['CmContact']['create'](_['defaults'](_0x507c77[_0xbb20('0x62')],{'firstName':_0x507c77[_0xbb20('0x62')]['to'],'email':_0x507c77[_0xbb20('0x62')]['to'],'phone':_0x507c77['body']['to'],'ListId':_0x320262[_0xbb20('0x72')]}));}}else{throw new Error(_0xbb20('0xba'));}}})[_0xbb20('0x39')](function(_0x3287f4){if(_0x3287f4){var _0x397ff0={'UserId':_0x507c77[_0xbb20('0x78')]['id'],'ContactId':_0x3287f4['id'],'MailAccountId':_0x320262['id'],'inReplyTo':_0x3b5254[_0xbb20('0xbb')],'to':_0x507c77['body'][_0xbb20('0xb2')],'cc':_0x507c77[_0xbb20('0x62')]['cc'],'subject':_0x507c77[_0xbb20('0x62')][_0xbb20('0xbc')],'attach':_0x507c77['body']['attach'],'firstMsgDirection':_0xbb20('0xbd'),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0xbb20('0xbd'),'Messages':[_[_0xbb20('0x56')](_0x507c77[_0xbb20('0x62')],{'messageId':_0x3b5254[_0xbb20('0xbb')],'sentAt':moment()[_0xbb20('0xa9')](_0xbb20('0xaa')),'read':!![],'MailAccountId':_0x320262['id'],'UserId':_0x507c77[_0xbb20('0x78')]['id'],'ContactId':_0x3287f4['id']})]};if(_0x507c77[_0xbb20('0x62')][_0xbb20('0xbe')]){_0x397ff0=_[_0xbb20('0x56')](_0x397ff0,_0x507c77['body'][_0xbb20('0xbe')]);}return db[_0xbb20('0x90')][_0xbb20('0x66')](_0x397ff0,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});}})['then'](respondWithResult(_0x57ce25,null))[_0xbb20('0x2d')](handleError(_0x57ce25,null));};exports[_0xbb20('0xbf')]=function(_0xbc27fb,_0x540045,_0x82bf8e){return db[_0xbb20('0x59')][_0xbb20('0x63')]({'where':{'id':_0xbc27fb[_0xbb20('0x5e')]['id']},'include':[{'model':db[_0xbb20('0x5f')],'as':'Smtp','raw':!![]}]})['then'](handleEntityNotFound(_0x540045,null))['then'](function(_0x488e06){if(_0x488e06&&_0x488e06['Smtp']){var _0x295c13={'id':_0x488e06['id'],'tls':{'rejectUnauthorized':![]}};if(_0x488e06[_0xbb20('0x60')][_0xbb20('0x7f')]){_0x295c13[_0xbb20('0x7f')]=_0x488e06[_0xbb20('0x60')][_0xbb20('0x7f')];}else{_0x295c13[_0xbb20('0x7d')]=_0x488e06[_0xbb20('0x60')]['host'];_0x295c13[_0xbb20('0x7e')]=_0x488e06[_0xbb20('0x60')][_0xbb20('0x7e')];_0x295c13['secure']=_0x488e06[_0xbb20('0x60')][_0xbb20('0xb9')];}if(_0x488e06[_0xbb20('0x60')]['authentication']){_0x295c13[_0xbb20('0xb8')]={'user':_0x488e06[_0xbb20('0x60')][_0xbb20('0x78')],'pass':_0x488e06['Smtp']['pass']};}return respondWithRpcPromise(_0xbb20('0xc0'),_0xbb20('0xbf'),{'account':_0x295c13});}})[_0xbb20('0x39')](respondWithResult(_0x540045,null))[_0xbb20('0x2d')](handleError(_0x540045,null));};exports[_0xbb20('0x3a')]=function(_0x5d4b9b,_0x57c234){return db['MailAccount']['find']({'where':{'id':_0x5d4b9b[_0xbb20('0x5e')]['id']}})[_0xbb20('0x39')](handleEntityNotFound(_0x57c234,null))[_0xbb20('0x39')](function(_0x2543f0){if(_0x2543f0&&_0x2543f0['service']){throw new db[(_0xbb20('0xc1'))][(_0xbb20('0xc2'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x2543f0;})[_0xbb20('0x39')](removeEntity(_0x57c234,null))[_0xbb20('0x2d')](handleError(_0x57c234,null));};exports[_0xbb20('0xc3')]=function(_0x4df61,_0x2ae5cf,_0x49a191){return db[_0xbb20('0x59')][_0xbb20('0x63')]({'where':{'id':_0x4df61[_0xbb20('0x5e')]['id']}})[_0xbb20('0x39')](handleEntityNotFound(_0x2ae5cf,null))[_0xbb20('0x39')](function(_0x3191bf){if(_0x3191bf){return _0x3191bf['addAgents'](_0x4df61[_0xbb20('0x62')][_0xbb20('0x6b')],_[_0xbb20('0x91')](_0x4df61['body'],['ids','id'])||{})[_0xbb20('0xc4')](function(_0x344717){for(var _0x1582ae=0x0;_0x1582ae<_0x4df61[_0xbb20('0x62')][_0xbb20('0x6b')]['length'];_0x1582ae+=0x1){socket[_0xbb20('0xc5')](_0xbb20('0xc6'),{'UserId':Number(_0x4df61[_0xbb20('0x62')]['ids'][_0x1582ae]),'MailAccountId':Number(_0x4df61[_0xbb20('0x5e')]['id'])});}return _0x344717;});}})[_0xbb20('0x39')](respondWithResult(_0x2ae5cf,null))['catch'](handleError(_0x2ae5cf,null));};exports[_0xbb20('0xc7')]=function(_0x3f89a8,_0x4c8161,_0xa389ef){return db[_0xbb20('0x59')]['find']({'where':{'id':_0x3f89a8[_0xbb20('0x5e')]['id']}})[_0xbb20('0x39')](handleEntityNotFound(_0x4c8161,null))['then'](function(_0x2636fc){if(_0x2636fc){return _0x2636fc[_0xbb20('0xc7')](_0x3f89a8[_0xbb20('0x4a')][_0xbb20('0x6b')])[_0xbb20('0x39')](function(){if(_[_0xbb20('0xc8')](_0x3f89a8[_0xbb20('0x4a')][_0xbb20('0x6b')])){for(var _0x464062=0x0;_0x464062<_0x3f89a8[_0xbb20('0x4a')][_0xbb20('0x6b')][_0xbb20('0x4f')];_0x464062+=0x1){socket[_0xbb20('0xc5')](_0xbb20('0xc9'),{'UserId':Number(_0x3f89a8[_0xbb20('0x4a')][_0xbb20('0x6b')][_0x464062]),'MailAccountId':Number(_0x3f89a8['params']['id'])});}}else{socket[_0xbb20('0xc5')](_0xbb20('0xc9'),{'UserId':Number(_0x3f89a8[_0xbb20('0x4a')][_0xbb20('0x6b')]),'MailAccountId':Number(_0x3f89a8[_0xbb20('0x5e')]['id'])});}});}})[_0xbb20('0x39')](respondWithStatusCode(_0x4c8161,null))['catch'](handleError(_0x4c8161,null));};exports[_0xbb20('0xca')]=function(_0xf29e59,_0x26d28f,_0xadf2e5){var _0x474489={};var _0x22e637={};var _0x5be481;var _0x3452dd;return db[_0xbb20('0x59')][_0xbb20('0x67')]({'where':{'id':_0xf29e59['params']['id']}})[_0xbb20('0x39')](handleEntityNotFound(_0x26d28f,null))[_0xbb20('0x39')](function(_0x5f44a7){if(_0x5f44a7){_0x5be481=_0x5f44a7;_0x22e637[_0xbb20('0x49')]=_[_0xbb20('0x4b')](db['User'][_0xbb20('0x47')]);_0x22e637[_0xbb20('0x4a')]=_[_0xbb20('0x4b')](_0xf29e59[_0xbb20('0x4a')]);_0x22e637[_0xbb20('0x55')]=_[_0xbb20('0x4c')](_0x22e637[_0xbb20('0x49')],_0x22e637[_0xbb20('0x4a')]);_0x474489['attributes']=_[_0xbb20('0x4c')](_0x22e637[_0xbb20('0x49')],qs[_0xbb20('0x4e')](_0xf29e59[_0xbb20('0x4a')]['fields']));_0x474489[_0xbb20('0x4d')]=_0x474489[_0xbb20('0x4d')]['length']?_0x474489['attributes']:_0x22e637[_0xbb20('0x49')];_0x474489[_0xbb20('0x52')]=qs[_0xbb20('0x53')](_0xf29e59[_0xbb20('0x4a')][_0xbb20('0x53')]);_0x474489[_0xbb20('0x54')]=qs[_0xbb20('0x55')](_[_0xbb20('0x68')](_0xf29e59[_0xbb20('0x4a')],_0x22e637['filters']));if(_0xf29e59[_0xbb20('0x4a')][_0xbb20('0x57')]){_0x474489[_0xbb20('0x54')]=_['merge'](_0x474489[_0xbb20('0x54')],{'$or':_['map'](_0x474489['attributes'],function(_0x3c63f8){var _0x4708ac={};_0x4708ac[_0x3c63f8]={'$like':'%'+_0xf29e59['query'][_0xbb20('0x57')]+'%'};return _0x4708ac;})});}_0x474489=_[_0xbb20('0x56')]({},_0x474489,_0xf29e59[_0xbb20('0x58')]);return _0x5be481[_0xbb20('0xca')](_0x474489);}})[_0xbb20('0x39')](function(_0x3a47b2){if(_0x3a47b2){_0x3452dd=_0x3a47b2[_0xbb20('0x4f')];if(!_0xf29e59[_0xbb20('0x4a')]['hasOwnProperty']('nolimit')){_0x474489[_0xbb20('0x32')]=qs[_0xbb20('0x32')](_0xf29e59[_0xbb20('0x4a')][_0xbb20('0x32')]);_0x474489[_0xbb20('0x30')]=qs[_0xbb20('0x30')](_0xf29e59[_0xbb20('0x4a')]['offset']);}return _0x5be481['getAgents'](_0x474489);}})[_0xbb20('0x39')](function(_0x499d23){if(_0x499d23){return _0x499d23?{'count':_0x3452dd,'rows':_0x499d23}:null;}})[_0xbb20('0x39')](respondWithResult(_0x26d28f,null))[_0xbb20('0x2d')](handleError(_0x26d28f,null));}; \ No newline at end of file +var _0x2242=['sendMail','List\x20not\x20found','List','attach','out','messageId','Interaction','Messages','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','User','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./mailAccount.socket','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','limit','count','offset','Content-Range','apply','reject','save','update','destroy','get','MailAccounts','name','send','index','MailServerIn','Imap','Smtp','mandatoryDispositionPause','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailAccount','includeAll','include','rows','show','params','MailServerOut','Pause','length','body','find','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','hasOwnProperty','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','ListId','isNil','active','cservice','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port','service','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','CmList','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','basename','secure','auth','SendMail'];(function(_0x4aa2f7,_0x4edc07){var _0x50f332=function(_0xf0b475){while(--_0xf0b475){_0x4aa2f7['push'](_0x4aa2f7['shift']());}};_0x50f332(++_0x4edc07);}(_0x2242,0x1a3));var _0x2224=function(_0x4c5413,_0x21c0b7){_0x4c5413=_0x4c5413-0x0;var _0x3a0224=_0x2242[_0x4c5413];return _0x3a0224;};'use strict';var emlformat=require(_0x2224('0x0'));var rimraf=require(_0x2224('0x1'));var zipdir=require(_0x2224('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2224('0x3'));var moment=require(_0x2224('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2224('0x5'));var util=require(_0x2224('0x6'));var path=require('path');var sox=require(_0x2224('0x7'));var csv=require(_0x2224('0x8'));var ejs=require(_0x2224('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2224('0xa'));var squel=require(_0x2224('0xb'));var crypto=require(_0x2224('0xc'));var jsforce=require(_0x2224('0xd'));var deskjs=require(_0x2224('0xe'));var toCsv=require(_0x2224('0x8'));var querystring=require(_0x2224('0xf'));var Papa=require(_0x2224('0x10'));var htmlToText=require(_0x2224('0x11'));var juice=require(_0x2224('0x12'));var Redis=require(_0x2224('0x13'));var authService=require(_0x2224('0x14'));var qs=require(_0x2224('0x15'));var as=require(_0x2224('0x16'));var hardwareService=require(_0x2224('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x2224('0x18'));var config=require(_0x2224('0x19'));var licenseUtil=require(_0x2224('0x1a'));var db=require(_0x2224('0x1b'))['db'];config['redis']=_[_0x2224('0x1c')](config[_0x2224('0x1d')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2224('0x1d')]));require(_0x2224('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x2224('0x1f')][_0x2224('0x20')]({'port':0x232b});function respondWithRpcPromise(_0x3c1ecd,_0x28956b,_0x30d846,_0xebb5c9){return new BPromise(function(_0x34d045,_0x1327dc){var _0x5ba07d=_0xebb5c9||client;return _0x5ba07d[_0x2224('0x21')](_0x3c1ecd,_0x30d846)[_0x2224('0x22')](function(_0xffed3d){logger[_0x2224('0x23')](_0x2224('0x24'),_0x28956b,_0x2224('0x25'));logger[_0x2224('0x26')](_0x2224('0x27'),_0x28956b,_0x2224('0x25'),JSON[_0x2224('0x28')](_0xffed3d));if(_0xffed3d[_0x2224('0x29')]){if(_0xffed3d[_0x2224('0x29')][_0x2224('0x2a')]===0x1f4){logger[_0x2224('0x29')](_0x2224('0x24'),_0x28956b,_0xffed3d['error']['message']);return _0x1327dc(_0xffed3d[_0x2224('0x29')][_0x2224('0x2b')]);}logger[_0x2224('0x29')](_0x2224('0x24'),_0x28956b,_0xffed3d[_0x2224('0x29')][_0x2224('0x2b')]);return _0x34d045(_0xffed3d[_0x2224('0x29')][_0x2224('0x2b')]);}else{logger[_0x2224('0x23')](_0x2224('0x24'),_0x28956b,_0x2224('0x25'));_0x34d045(_0xffed3d[_0x2224('0x2c')]['message']);}})[_0x2224('0x2d')](function(_0x4c231a){logger['error'](_0x2224('0x24'),_0x28956b,_0x4c231a);_0x1327dc(_0x4c231a);});});}function respondWithStatusCode(_0x1e8e26,_0x4c4c64){_0x4c4c64=_0x4c4c64||0xcc;return function(_0x4da4bd){if(_0x4da4bd){return _0x1e8e26[_0x2224('0x2e')](_0x4c4c64);}return _0x1e8e26[_0x2224('0x2f')](_0x4c4c64)['end']();};}function respondWithResult(_0x408521,_0x4a17ea){_0x4a17ea=_0x4a17ea||0xc8;return function(_0x43cd3d){if(_0x43cd3d){return _0x408521[_0x2224('0x2f')](_0x4a17ea)[_0x2224('0x30')](_0x43cd3d);}};}function respondWithFilteredResult(_0x1159bf,_0x32132b){return function(_0x50058d){if(_0x50058d){var _0x3b3843=typeof _0x32132b['offset']==='undefined'&&typeof _0x32132b[_0x2224('0x31')]==='undefined';var _0x21acad=_0x50058d['count'];var _0x5ea9de=_0x3b3843?0x0:_0x32132b['offset'];var _0x1b125c=_0x3b3843?_0x50058d[_0x2224('0x32')]:_0x32132b[_0x2224('0x33')]+_0x32132b[_0x2224('0x31')];var _0x48e523;if(_0x1b125c>=_0x21acad){_0x1b125c=_0x21acad;_0x48e523=0xc8;}else{_0x48e523=0xce;}_0x1159bf[_0x2224('0x2f')](_0x48e523);return _0x1159bf['set'](_0x2224('0x34'),_0x5ea9de+'-'+_0x1b125c+'/'+_0x21acad)[_0x2224('0x30')](_0x50058d);}return null;};}function patchUpdates(_0x4506f4){return function(_0x53d0a4){try{jsonpatch[_0x2224('0x35')](_0x53d0a4,_0x4506f4,!![]);}catch(_0x356949){return BPromise[_0x2224('0x36')](_0x356949);}return _0x53d0a4[_0x2224('0x37')]();};}function saveUpdates(_0x24962d,_0x101900){return function(_0x537ae1){if(_0x537ae1){return _0x537ae1[_0x2224('0x38')](_0x24962d)[_0x2224('0x22')](function(_0x5451c9){return _0x5451c9;});}return null;};}function removeEntity(_0x3ad426,_0x14540a){return function(_0x191679){if(_0x191679){return _0x191679[_0x2224('0x39')]()[_0x2224('0x22')](function(){var _0x36f06d=_0x191679[_0x2224('0x3a')]({'plain':!![]});var _0x4b1e60=_0x2224('0x3b');return db['UserProfileResource'][_0x2224('0x39')]({'where':{'type':_0x4b1e60,'resourceId':_0x36f06d['id']}})['then'](function(){return _0x191679;});})[_0x2224('0x22')](function(){_0x3ad426[_0x2224('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b0098,_0x39f819){return function(_0x52d0ea){if(!_0x52d0ea){_0x1b0098[_0x2224('0x2e')](0x194);}return _0x52d0ea;};}function handleError(_0x213899,_0x4d9007){_0x4d9007=_0x4d9007||0x1f4;return function(_0x44af45){logger[_0x2224('0x29')](_0x44af45['stack']);if(_0x44af45[_0x2224('0x3c')]){delete _0x44af45['name'];}_0x213899[_0x2224('0x2f')](_0x4d9007)[_0x2224('0x3d')](_0x44af45);};}exports[_0x2224('0x3e')]=function(_0x519631,_0x11c2a1){var _0x57c7c8={'include':[{'model':db[_0x2224('0x3f')],'as':_0x2224('0x40')},{'model':db['MailServerOut'],'as':_0x2224('0x41')},{'model':db['Pause'],'as':_0x2224('0x42')}]},_0x214b79={},_0x199100={'count':0x0,'rows':[]};var _0x20b681=_['map'](db['MailAccount'][_0x2224('0x43')],function(_0x54f8ce){return{'name':_0x54f8ce[_0x2224('0x44')],'type':_0x54f8ce[_0x2224('0x45')]['key']};});_0x214b79[_0x2224('0x46')]=_[_0x2224('0x47')](_0x20b681,_0x2224('0x3c'));_0x214b79['query']=_[_0x2224('0x48')](_0x519631[_0x2224('0x49')]);_0x214b79[_0x2224('0x4a')]=_[_0x2224('0x4b')](_0x214b79['model'],_0x214b79[_0x2224('0x49')]);_0x57c7c8[_0x2224('0x4c')]=_['intersection'](_0x214b79['model'],qs['fields'](_0x519631['query'][_0x2224('0x4d')]));_0x57c7c8['attributes']=_0x57c7c8[_0x2224('0x4c')]['length']?_0x57c7c8[_0x2224('0x4c')]:_0x214b79['model'];if(!_0x519631[_0x2224('0x49')]['hasOwnProperty'](_0x2224('0x4e'))){_0x57c7c8[_0x2224('0x31')]=qs[_0x2224('0x31')](_0x519631[_0x2224('0x49')]['limit']);_0x57c7c8[_0x2224('0x33')]=qs[_0x2224('0x33')](_0x519631['query'][_0x2224('0x33')]);}_0x57c7c8[_0x2224('0x4f')]=qs[_0x2224('0x50')](_0x519631[_0x2224('0x49')]['sort']);_0x57c7c8[_0x2224('0x51')]=qs['filters'](_[_0x2224('0x52')](_0x519631[_0x2224('0x49')],_0x214b79['filters']),_0x20b681);if(_0x519631[_0x2224('0x49')][_0x2224('0x53')]){_0x57c7c8[_0x2224('0x51')]=_[_0x2224('0x54')](_0x57c7c8['where'],{'$or':_[_0x2224('0x47')](_0x20b681,function(_0xe90eab){if(_0xe90eab[_0x2224('0x45')]!==_0x2224('0x55')){var _0x125c37={};_0x125c37[_0xe90eab[_0x2224('0x3c')]]={'$like':'%'+_0x519631['query'][_0x2224('0x53')]+'%'};return _0x125c37;}})});}_0x57c7c8=_[_0x2224('0x54')]({},_0x57c7c8,_0x519631[_0x2224('0x56')]);var _0x25b7ed={'where':_0x57c7c8[_0x2224('0x51')]};return db[_0x2224('0x57')]['count'](_0x25b7ed)[_0x2224('0x22')](function(_0x162354){_0x199100[_0x2224('0x32')]=_0x162354;if(_0x519631['query'][_0x2224('0x58')]){_0x57c7c8[_0x2224('0x59')]=[{'all':!![]}];}return db[_0x2224('0x57')]['findAll'](_0x57c7c8);})[_0x2224('0x22')](function(_0x3f1338){_0x199100[_0x2224('0x5a')]=_0x3f1338;return _0x199100;})[_0x2224('0x22')](respondWithFilteredResult(_0x11c2a1,_0x57c7c8))[_0x2224('0x2d')](handleError(_0x11c2a1,null));};exports[_0x2224('0x5b')]=function(_0x3acc39,_0x2feb21){var _0x15d074={'raw':![],'where':{'id':_0x3acc39[_0x2224('0x5c')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x2224('0x40')},{'model':db[_0x2224('0x5d')],'as':_0x2224('0x41')},{'model':db[_0x2224('0x5e')],'as':_0x2224('0x42')}]},_0x19bc1e={};_0x19bc1e[_0x2224('0x46')]=_[_0x2224('0x48')](db['MailAccount'][_0x2224('0x43')]);_0x19bc1e[_0x2224('0x49')]=_[_0x2224('0x48')](_0x3acc39[_0x2224('0x49')]);_0x19bc1e[_0x2224('0x4a')]=_[_0x2224('0x4b')](_0x19bc1e[_0x2224('0x46')],_0x19bc1e[_0x2224('0x49')]);_0x15d074[_0x2224('0x4c')]=_[_0x2224('0x4b')](_0x19bc1e['model'],qs[_0x2224('0x4d')](_0x3acc39[_0x2224('0x49')][_0x2224('0x4d')]));_0x15d074['attributes']=_0x15d074[_0x2224('0x4c')][_0x2224('0x5f')]?_0x15d074[_0x2224('0x4c')]:_0x19bc1e[_0x2224('0x46')];if(_0x3acc39[_0x2224('0x49')][_0x2224('0x58')]){_0x15d074[_0x2224('0x59')]=[{'all':!![]}];}_0x15d074=_[_0x2224('0x54')]({},_0x15d074,_0x3acc39[_0x2224('0x56')]);return db[_0x2224('0x57')]['find'](_0x15d074)['then'](handleEntityNotFound(_0x2feb21,null))[_0x2224('0x22')](respondWithResult(_0x2feb21,null))[_0x2224('0x2d')](handleError(_0x2feb21,null));};exports[_0x2224('0x38')]=function(_0xfc1e2f,_0x3680ec){if(_0xfc1e2f[_0x2224('0x60')]['id']){delete _0xfc1e2f[_0x2224('0x60')]['id'];}return db[_0x2224('0x57')][_0x2224('0x61')]({'where':{'id':_0xfc1e2f[_0x2224('0x5c')]['id']},'include':[{'model':db[_0x2224('0x3f')],'as':'Imap'},{'model':db[_0x2224('0x5d')],'as':_0x2224('0x41')},{'model':db[_0x2224('0x5e')],'as':'mandatoryDispositionPause'}]})[_0x2224('0x22')](handleEntityNotFound(_0x3680ec,null))[_0x2224('0x22')](saveUpdates(_0xfc1e2f[_0x2224('0x60')],null))[_0x2224('0x22')](function(_0x24959b){if(_0x24959b&&_0xfc1e2f[_0x2224('0x60')]['Imap']){return db[_0x2224('0x3f')][_0x2224('0x38')](_0xfc1e2f[_0x2224('0x60')]['Imap'],{'where':{'MailAccountId':_0x24959b['id']}})['then'](function(){return _0x24959b;});}return _0x24959b;})[_0x2224('0x22')](function(_0x4e5a2b){if(_0x4e5a2b&&_0xfc1e2f[_0x2224('0x60')]['Smtp']){return db[_0x2224('0x5d')][_0x2224('0x38')](_0xfc1e2f['body']['Smtp'],{'where':{'MailAccountId':_0x4e5a2b['id']}})['then'](function(){return _0x4e5a2b;});}return _0x4e5a2b;})[_0x2224('0x22')](respondWithResult(_0x3680ec,null))[_0x2224('0x2d')](handleError(_0x3680ec,null));};exports['describe']=function(_0x377121,_0x6082a6){return db[_0x2224('0x57')][_0x2224('0x62')]()[_0x2224('0x22')](respondWithResult(_0x6082a6,null))['catch'](handleError(_0x6082a6,null));};exports[_0x2224('0x63')]=function(_0x54986c,_0x1f6b29,_0x480fd3){if(_0x54986c[_0x2224('0x60')]['id']){delete _0x54986c['body']['id'];}return db[_0x2224('0x57')][_0x2224('0x61')]({'where':{'id':_0x54986c[_0x2224('0x5c')]['id']}})[_0x2224('0x22')](handleEntityNotFound(_0x1f6b29,null))[_0x2224('0x22')](function(_0x33cb3f){if(_0x33cb3f){_0x54986c[_0x2224('0x60')][_0x2224('0x64')]=_0x33cb3f['id'];return db[_0x2224('0x65')][_0x2224('0x66')](_0x54986c[_0x2224('0x60')]);}})[_0x2224('0x22')](respondWithResult(_0x1f6b29,null))['catch'](handleError(_0x1f6b29,null));};exports[_0x2224('0x67')]=function(_0x14acea,_0x335458,_0x47ff5d){var _0x4568e2={'raw':![],'where':{}};var _0x2dc41f={};var _0x226bc2={'count':0x0,'rows':[]};return db[_0x2224('0x57')][_0x2224('0x68')]({'where':{'id':_0x14acea['params']['id']}})[_0x2224('0x22')](handleEntityNotFound(_0x335458,null))[_0x2224('0x22')](function(_0x4bd438){if(_0x4bd438){_0x2dc41f[_0x2224('0x46')]=_[_0x2224('0x48')](db[_0x2224('0x65')]['rawAttributes']);_0x2dc41f[_0x2224('0x49')]=_['keys'](_0x14acea[_0x2224('0x49')]);_0x2dc41f[_0x2224('0x4a')]=_[_0x2224('0x4b')](_0x2dc41f[_0x2224('0x46')],_0x2dc41f[_0x2224('0x49')]);_0x4568e2[_0x2224('0x4c')]=_[_0x2224('0x4b')](_0x2dc41f['model'],qs[_0x2224('0x4d')](_0x14acea['query'][_0x2224('0x4d')]));_0x4568e2['attributes']=_0x4568e2[_0x2224('0x4c')][_0x2224('0x5f')]?_0x4568e2[_0x2224('0x4c')]:_0x2dc41f['model'];if(!_0x14acea['query'][_0x2224('0x69')](_0x2224('0x4e'))){_0x4568e2['limit']=qs['limit'](_0x14acea[_0x2224('0x49')][_0x2224('0x31')]);_0x4568e2['offset']=qs[_0x2224('0x33')](_0x14acea[_0x2224('0x49')][_0x2224('0x33')]);}_0x4568e2[_0x2224('0x4f')]=qs['sort'](_0x14acea[_0x2224('0x49')][_0x2224('0x50')]);_0x4568e2[_0x2224('0x51')]=qs['filters'](_['pick'](_0x14acea[_0x2224('0x49')],_0x2dc41f[_0x2224('0x4a')]));_0x4568e2['where']['MailAccountId']=_0x4bd438['id'];if(_0x14acea[_0x2224('0x49')]['filter']){_0x4568e2[_0x2224('0x51')]=_[_0x2224('0x54')](_0x4568e2['where'],{'$or':_[_0x2224('0x47')](_0x4568e2['attributes'],function(_0x295fb2){var _0x11bc6e={};_0x11bc6e[_0x295fb2]={'$like':'%'+_0x14acea[_0x2224('0x49')][_0x2224('0x53')]+'%'};return _0x11bc6e;})});}_0x4568e2=_[_0x2224('0x54')]({},_0x4568e2,_0x14acea['options']);return db['Disposition'][_0x2224('0x32')]({'where':_0x4568e2[_0x2224('0x51')]})['then'](function(_0x1d362d){_0x226bc2[_0x2224('0x32')]=_0x1d362d;if(_0x14acea['query'][_0x2224('0x58')]){_0x4568e2['include']=[{'all':!![]}];}return db[_0x2224('0x65')]['findAll'](_0x4568e2);})[_0x2224('0x22')](function(_0x55db97){_0x226bc2[_0x2224('0x5a')]=_0x55db97;return _0x226bc2;});}})[_0x2224('0x22')](respondWithFilteredResult(_0x335458,_0x4568e2))[_0x2224('0x2d')](handleError(_0x335458,null));};exports[_0x2224('0x6a')]=function(_0x453d48,_0x235bc9,_0x5467fd){return db[_0x2224('0x57')]['find']({'where':{'id':_0x453d48[_0x2224('0x5c')]['id']}})[_0x2224('0x22')](handleEntityNotFound(_0x235bc9,null))[_0x2224('0x22')](function(_0x2a3a04){if(_0x2a3a04){return _0x2a3a04['removeDispositions'](_0x453d48['query']['ids']);}})['then'](respondWithStatusCode(_0x235bc9,null))['catch'](handleError(_0x235bc9,null));};exports[_0x2224('0x6b')]=function(_0x7b2af5,_0x257bf4,_0x49e089){if(_0x7b2af5[_0x2224('0x60')]['id']){delete _0x7b2af5['body']['id'];}return db[_0x2224('0x57')][_0x2224('0x61')]({'where':{'id':_0x7b2af5[_0x2224('0x5c')]['id']}})[_0x2224('0x22')](handleEntityNotFound(_0x257bf4,null))['then'](function(_0x317713){if(_0x317713){_0x7b2af5['body'][_0x2224('0x64')]=_0x317713['id'];return db['CannedAnswer'][_0x2224('0x66')](_0x7b2af5[_0x2224('0x60')]);}})[_0x2224('0x22')](respondWithResult(_0x257bf4,null))[_0x2224('0x2d')](handleError(_0x257bf4,null));};exports['getAnswers']=function(_0x4a94c9,_0x16b36b,_0xa1df4e){var _0x14b3df={'raw':![],'where':{}};var _0x2bc317={};var _0x6cd08b={'count':0x0,'rows':[]};return db['MailAccount'][_0x2224('0x68')]({'where':{'id':_0x4a94c9['params']['id']}})['then'](handleEntityNotFound(_0x16b36b,null))[_0x2224('0x22')](function(_0x511260){if(_0x511260){_0x2bc317[_0x2224('0x46')]=_['keys'](db[_0x2224('0x6c')][_0x2224('0x43')]);_0x2bc317[_0x2224('0x49')]=_[_0x2224('0x48')](_0x4a94c9[_0x2224('0x49')]);_0x2bc317[_0x2224('0x4a')]=_[_0x2224('0x4b')](_0x2bc317['model'],_0x2bc317[_0x2224('0x49')]);_0x14b3df['attributes']=_[_0x2224('0x4b')](_0x2bc317[_0x2224('0x46')],qs[_0x2224('0x4d')](_0x4a94c9[_0x2224('0x49')]['fields']));_0x14b3df[_0x2224('0x4c')]=_0x14b3df[_0x2224('0x4c')][_0x2224('0x5f')]?_0x14b3df[_0x2224('0x4c')]:_0x2bc317[_0x2224('0x46')];if(!_0x4a94c9[_0x2224('0x49')]['hasOwnProperty'](_0x2224('0x4e'))){_0x14b3df[_0x2224('0x31')]=qs[_0x2224('0x31')](_0x4a94c9[_0x2224('0x49')]['limit']);_0x14b3df['offset']=qs['offset'](_0x4a94c9[_0x2224('0x49')][_0x2224('0x33')]);}_0x14b3df['order']=qs[_0x2224('0x50')](_0x4a94c9[_0x2224('0x49')][_0x2224('0x50')]);_0x14b3df['where']=qs[_0x2224('0x4a')](_['pick'](_0x4a94c9[_0x2224('0x49')],_0x2bc317[_0x2224('0x4a')]));_0x14b3df[_0x2224('0x51')]['MailAccountId']=_0x511260['id'];if(_0x4a94c9[_0x2224('0x49')][_0x2224('0x53')]){_0x14b3df[_0x2224('0x51')]=_[_0x2224('0x54')](_0x14b3df[_0x2224('0x51')],{'$or':_['map'](_0x14b3df[_0x2224('0x4c')],function(_0x486896){var _0x24030e={};_0x24030e[_0x486896]={'$like':'%'+_0x4a94c9[_0x2224('0x49')]['filter']+'%'};return _0x24030e;})});}_0x14b3df=_['merge']({},_0x14b3df,_0x4a94c9[_0x2224('0x56')]);return db['CannedAnswer'][_0x2224('0x32')]({'where':_0x14b3df['where']})[_0x2224('0x22')](function(_0x119a46){_0x6cd08b[_0x2224('0x32')]=_0x119a46;if(_0x4a94c9[_0x2224('0x49')]['includeAll']){_0x14b3df['include']=[{'all':!![]}];}return db[_0x2224('0x6c')]['findAll'](_0x14b3df);})[_0x2224('0x22')](function(_0x30c5b8){_0x6cd08b[_0x2224('0x5a')]=_0x30c5b8;return _0x6cd08b;});}})[_0x2224('0x22')](respondWithFilteredResult(_0x16b36b,_0x14b3df))[_0x2224('0x2d')](handleError(_0x16b36b,null));};exports['removeAnswers']=function(_0x3b050d,_0x5f1fdd,_0x2bf2b6){return db[_0x2224('0x57')][_0x2224('0x61')]({'where':{'id':_0x3b050d[_0x2224('0x5c')]['id']}})[_0x2224('0x22')](handleEntityNotFound(_0x5f1fdd,null))[_0x2224('0x22')](function(_0x5203b6){if(_0x5203b6){return _0x5203b6[_0x2224('0x6d')](_0x3b050d[_0x2224('0x49')][_0x2224('0x6e')]);}})['then'](respondWithStatusCode(_0x5f1fdd,null))[_0x2224('0x2d')](handleError(_0x5f1fdd,null));};exports[_0x2224('0x66')]=function(_0x4d7092,_0x35638f){var _0x17fc8b={'name':_0x4d7092[_0x2224('0x60')][_0x2224('0x3c')],'key':_0x4d7092[_0x2224('0x60')]['key'],'email':_0x4d7092[_0x2224('0x60')]['email'],'ListId':_0x4d7092[_0x2224('0x60')][_0x2224('0x6f')],'active':!_[_0x2224('0x70')](_0x4d7092[_0x2224('0x60')][_0x2224('0x71')])?_0x4d7092[_0x2224('0x60')][_0x2224('0x71')]:!![],'description':_0x4d7092[_0x2224('0x60')]['description']||null,'Imap':{},'Smtp':{}};if(_[_0x2224('0x70')](_0x4d7092[_0x2224('0x60')][_0x2224('0x72')])){if(_0x4d7092[_0x2224('0x60')][_0x2224('0x73')]){_0x17fc8b[_0x2224('0x40')][_0x2224('0x74')]=_0x17fc8b[_0x2224('0x41')][_0x2224('0x74')]=_0x4d7092[_0x2224('0x60')][_0x2224('0x75')];_0x17fc8b[_0x2224('0x40')][_0x2224('0x76')]=_0x17fc8b[_0x2224('0x41')][_0x2224('0x77')]=_0x4d7092[_0x2224('0x60')][_0x2224('0x78')];}else{_0x17fc8b[_0x2224('0x40')][_0x2224('0x79')]=_0x17fc8b[_0x2224('0x41')]['authentication']=![];}_0x17fc8b['Imap'][_0x2224('0x7a')]=_0x4d7092[_0x2224('0x60')]['Imap']['host'];_0x17fc8b['Imap'][_0x2224('0x7b')]=_0x4d7092[_0x2224('0x60')]['Imap'][_0x2224('0x7b')];_0x17fc8b[_0x2224('0x41')][_0x2224('0x7a')]=_0x4d7092['body']['Smtp'][_0x2224('0x7a')];_0x17fc8b['Smtp']['port']=_0x4d7092[_0x2224('0x60')][_0x2224('0x41')][_0x2224('0x7b')];}else{_0x17fc8b[_0x2224('0x40')][_0x2224('0x7c')]=_0x17fc8b[_0x2224('0x41')][_0x2224('0x7c')]=_0x4d7092[_0x2224('0x60')][_0x2224('0x72')];_0x17fc8b[_0x2224('0x40')][_0x2224('0x74')]=_0x17fc8b[_0x2224('0x41')][_0x2224('0x74')]=_0x4d7092[_0x2224('0x60')][_0x2224('0x75')];_0x17fc8b[_0x2224('0x40')][_0x2224('0x76')]=_0x17fc8b[_0x2224('0x41')][_0x2224('0x77')]=_0x4d7092[_0x2224('0x60')][_0x2224('0x78')];}return db['MailAccount'][_0x2224('0x66')](_0x17fc8b,{'include':[{'model':db[_0x2224('0x5d')],'as':_0x2224('0x41')},{'model':db[_0x2224('0x3f')],'as':_0x2224('0x40')}]})[_0x2224('0x22')](function(_0x489758){var _0x5a1cdb=_0x4d7092[_0x2224('0x74')][_0x2224('0x3a')]({'plain':!![]});if(!_0x5a1cdb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a1cdb[_0x2224('0x7d')]===_0x2224('0x74')){var _0x13d924=_0x489758[_0x2224('0x3a')]({'plain':!![]});return db['UserProfileSection'][_0x2224('0x61')]({'where':{'name':'MailAccounts','userProfileId':_0x5a1cdb[_0x2224('0x7e')]},'raw':!![]})[_0x2224('0x22')](function(_0x13179f){if(_0x13179f&&_0x13179f[_0x2224('0x7f')]===0x0){return db[_0x2224('0x80')][_0x2224('0x66')]({'name':_0x13d924['name'],'resourceId':_0x13d924['id'],'type':_0x13179f[_0x2224('0x3c')],'sectionId':_0x13179f['id']},{})[_0x2224('0x22')](function(){return _0x489758;});}else{return _0x489758;}})[_0x2224('0x2d')](function(_0x5f2c43){logger['error'](_0x2224('0x81'),_0x5f2c43);throw _0x5f2c43;});}return _0x489758;})['then'](respondWithResult(_0x35638f,0xc9))[_0x2224('0x2d')](handleError(_0x35638f,null));};exports[_0x2224('0x82')]=function(_0x23b125,_0xdefa6a,_0x24ea49){return db[_0x2224('0x57')][_0x2224('0x68')]({'where':{'id':_0x23b125['params']['id']}})[_0x2224('0x22')](handleEntityNotFound(_0xdefa6a,null))[_0x2224('0x22')](function(_0x7f9264){if(_0x7f9264){return _0x7f9264[_0x2224('0x82')]();}return null;})[_0x2224('0x22')](respondWithResult(_0xdefa6a,null))[_0x2224('0x2d')](handleError(_0xdefa6a,null));};exports[_0x2224('0x83')]=function(_0x4f6c44,_0x26257d,_0x4f59fa){if(_0x4f6c44['body']['id']){delete _0x4f6c44['body']['id'];}return db[_0x2224('0x57')]['find']({'where':{'id':_0x4f6c44['params']['id']}})[_0x2224('0x22')](handleEntityNotFound(_0x26257d,null))['then'](function(_0x4ae1a5){if(_0x4ae1a5){_0x4f6c44[_0x2224('0x60')][_0x2224('0x64')]=_0x4ae1a5['id'];return db[_0x2224('0x3f')][_0x2224('0x66')](_0x4f6c44[_0x2224('0x60')]);}})['then'](respondWithResult(_0x26257d,null))[_0x2224('0x2d')](handleError(_0x26257d,null));};exports[_0x2224('0x84')]=function(_0x1bef9e,_0x291cc0,_0x5da57c){return db[_0x2224('0x57')][_0x2224('0x68')]({'where':{'id':_0x1bef9e[_0x2224('0x5c')]['id']}})[_0x2224('0x22')](handleEntityNotFound(_0x291cc0,null))['then'](function(_0x32e373){if(_0x32e373){return _0x32e373[_0x2224('0x85')](null);}return null;})['then'](respondWithStatusCode(_0x291cc0,null))[_0x2224('0x2d')](handleError(_0x291cc0,null));};exports[_0x2224('0x86')]=function(_0x41d30c,_0x583dfd,_0x4e75ba){return db[_0x2224('0x57')][_0x2224('0x68')]({'where':{'id':_0x41d30c[_0x2224('0x5c')]['id']}})[_0x2224('0x22')](handleEntityNotFound(_0x583dfd,null))[_0x2224('0x22')](function(_0x3382a6){if(_0x3382a6){return _0x3382a6['getSmtp']();}return null;})[_0x2224('0x22')](respondWithResult(_0x583dfd,null))[_0x2224('0x2d')](handleError(_0x583dfd,null));};exports[_0x2224('0x87')]=function(_0x1b35ea,_0x131bfd,_0x463c1c){if(_0x1b35ea['body']['id']){delete _0x1b35ea[_0x2224('0x60')]['id'];}return db[_0x2224('0x57')][_0x2224('0x61')]({'where':{'id':_0x1b35ea[_0x2224('0x5c')]['id']}})[_0x2224('0x22')](handleEntityNotFound(_0x131bfd,null))['then'](function(_0x4cf83a){if(_0x4cf83a){_0x1b35ea[_0x2224('0x60')][_0x2224('0x64')]=_0x4cf83a['id'];return db[_0x2224('0x5d')]['create'](_0x1b35ea[_0x2224('0x60')]);}})[_0x2224('0x22')](respondWithResult(_0x131bfd,null))[_0x2224('0x2d')](handleError(_0x131bfd,null));};exports[_0x2224('0x88')]=function(_0x185945,_0x5e1bed,_0x580f7c){return db[_0x2224('0x57')][_0x2224('0x68')]({'where':{'id':_0x185945[_0x2224('0x5c')]['id']}})[_0x2224('0x22')](handleEntityNotFound(_0x5e1bed,null))[_0x2224('0x22')](function(_0xc38f6a){if(_0xc38f6a){return _0xc38f6a[_0x2224('0x89')](null);}return null;})[_0x2224('0x22')](respondWithStatusCode(_0x5e1bed,null))[_0x2224('0x2d')](handleError(_0x5e1bed,null));};exports[_0x2224('0x8a')]=function(_0xfeeaeb,_0x5266ba,_0x4386b3){return db[_0x2224('0x8b')]['find']({'where':{'id':_0xfeeaeb[_0x2224('0x5c')]['id']}})[_0x2224('0x22')](handleEntityNotFound(_0x5266ba,null))[_0x2224('0x22')](function(_0xc28275){if(_0xc28275){return _0xc28275[_0x2224('0x8a')](_0xfeeaeb[_0x2224('0x60')][_0x2224('0x6e')],_[_0x2224('0x8c')](_0xfeeaeb[_0x2224('0x60')],[_0x2224('0x6e'),'id'])||{});}})[_0x2224('0x22')](respondWithResult(_0x5266ba,null))[_0x2224('0x2d')](handleError(_0x5266ba,null));};exports[_0x2224('0x8d')]=function(_0x315ff9,_0x534721,_0x165e46){var _0xcb9c2c={'raw':![],'where':{}};var _0x321c8e={};var _0x29ca88={'count':0x0,'rows':[]};return db['MailAccount'][_0x2224('0x68')]({'where':{'id':_0x315ff9['params']['id']}})[_0x2224('0x22')](handleEntityNotFound(_0x534721,null))['then'](function(_0x457e47){if(_0x457e47){_0x321c8e[_0x2224('0x46')]=_[_0x2224('0x48')](db[_0x2224('0x8b')][_0x2224('0x43')]);_0x321c8e[_0x2224('0x49')]=_[_0x2224('0x48')](_0x315ff9[_0x2224('0x49')]);_0x321c8e[_0x2224('0x4a')]=_[_0x2224('0x4b')](_0x321c8e[_0x2224('0x46')],_0x321c8e[_0x2224('0x49')]);_0xcb9c2c[_0x2224('0x4c')]=_['intersection'](_0x321c8e['model'],qs['fields'](_0x315ff9[_0x2224('0x49')][_0x2224('0x4d')]));_0xcb9c2c[_0x2224('0x4c')]=_0xcb9c2c[_0x2224('0x4c')]['length']?_0xcb9c2c[_0x2224('0x4c')]:_0x321c8e[_0x2224('0x46')];if(!_0x315ff9[_0x2224('0x49')][_0x2224('0x69')](_0x2224('0x4e'))){_0xcb9c2c[_0x2224('0x31')]=qs[_0x2224('0x31')](_0x315ff9['query'][_0x2224('0x31')]);_0xcb9c2c['offset']=qs[_0x2224('0x33')](_0x315ff9[_0x2224('0x49')]['offset']);}_0xcb9c2c['order']=qs[_0x2224('0x50')](_0x315ff9[_0x2224('0x49')][_0x2224('0x50')]);_0xcb9c2c[_0x2224('0x51')]=qs[_0x2224('0x4a')](_['pick'](_0x315ff9[_0x2224('0x49')],_0x321c8e['filters']));_0xcb9c2c[_0x2224('0x51')][_0x2224('0x64')]=_0x457e47['id'];if(_0x315ff9[_0x2224('0x49')][_0x2224('0x53')]){_0xcb9c2c[_0x2224('0x51')]=_[_0x2224('0x54')](_0xcb9c2c[_0x2224('0x51')],{'$or':_[_0x2224('0x47')](_0xcb9c2c[_0x2224('0x4c')],function(_0x7889ac){var _0x1a22a5={};_0x1a22a5[_0x7889ac]={'$like':'%'+_0x315ff9['query'][_0x2224('0x53')]+'%'};return _0x1a22a5;})});}_0xcb9c2c=_[_0x2224('0x54')]({},_0xcb9c2c,_0x315ff9[_0x2224('0x56')]);return db[_0x2224('0x8b')][_0x2224('0x32')]({'where':_0xcb9c2c[_0x2224('0x51')]})['then'](function(_0x49ad23){_0x29ca88[_0x2224('0x32')]=_0x49ad23;if(_0x315ff9[_0x2224('0x49')][_0x2224('0x58')]){_0xcb9c2c['include']=[{'model':db[_0x2224('0x8e')],'as':_0x2224('0x8f'),'required':![]},{'model':db['User'],'as':'Owner','attributes':['name',_0x2224('0x90'),_0x2224('0x91')],'required':![]},{'model':db['Tag'],'as':_0x2224('0x92'),'attributes':['id',_0x2224('0x3c'),_0x2224('0x93')],'where':_0x315ff9['query'][_0x2224('0x94')]?{'id':_0x315ff9[_0x2224('0x49')][_0x2224('0x94')]}:undefined,'required':_0x315ff9[_0x2224('0x49')]['tag']?!![]:![]}];}return db[_0x2224('0x8b')]['findAll'](_0xcb9c2c);})['then'](function(_0x219a89){_0x29ca88[_0x2224('0x5a')]=_0x219a89;return _0x29ca88;});}})[_0x2224('0x22')](respondWithFilteredResult(_0x534721,_0xcb9c2c))[_0x2224('0x2d')](handleError(_0x534721,null));};exports[_0x2224('0x95')]=function addApplications(_0x458fbf,_0x8ccef4){var _0x3e550b=_0x458fbf[_0x2224('0x5c')]['id'];var _0x6a5803=_0x458fbf['body'];var _0x330297=0xc8;var _0x3cd687=null;return db[_0x2224('0x96')][_0x2224('0x97')]({'isolationLevel':db[_0x2224('0x96')][_0x2224('0x98')][_0x2224('0x99')]['READ_COMMITTED']},function(_0x5954a6){return db['MailAccount'][_0x2224('0x68')]({'where':{'id':_0x3e550b},'transaction':_0x5954a6})[_0x2224('0x22')](function(_0x2d7aa9){if(_0x2d7aa9){return db[_0x2224('0x9a')]['destroy']({'where':{'MailAccountId':_0x3e550b},'transaction':_0x5954a6})[_0x2224('0x22')](function(){var _0x50fd2e=_[_0x2224('0x47')](_0x6a5803,function(_0x9b98a2){_0x9b98a2[_0x2224('0x64')]=_0x3e550b;return _0x9b98a2;});return db['MailApplication'][_0x2224('0x9b')](_0x50fd2e,{'transaction':_0x5954a6});});}else{_0x330297=0x194;_0x3cd687=[];}});})[_0x2224('0x22')](function(){if(_0x330297!==0x194){return db[_0x2224('0x9a')][_0x2224('0x9c')]({'where':{'MailAccountId':_0x3e550b},'order':_0x2224('0x9d')})[_0x2224('0x22')](function(_0x3f7e32){_0x3cd687=_0x3f7e32;});}})[_0x2224('0x2d')](function(_0x1f86c5){_0x330297=0x1f4;logger[_0x2224('0x29')](_0x1f86c5[_0x2224('0x9e')]);if(_0x1f86c5[_0x2224('0x3c')]){delete _0x1f86c5[_0x2224('0x3c')];}_0x3cd687=_0x1f86c5;})[_0x2224('0x9f')](function(){if(_0x3cd687===null){_0x8ccef4[_0x2224('0x2e')](_0x330297);}else{if(_0x330297===0x1f4){_0x8ccef4[_0x2224('0x2f')](_0x330297)[_0x2224('0x3d')](_0x3cd687);}else{_0x8ccef4[_0x2224('0x2f')](_0x330297)[_0x2224('0x30')](_0x3cd687);}}});};exports[_0x2224('0xa0')]=function(_0x472b12,_0x4c76f2,_0x4267d3){var _0xa3aace={};var _0x59edd8={};var _0x4ddcba;var _0x516c41;return db[_0x2224('0x57')]['findOne']({'where':{'id':_0x472b12[_0x2224('0x5c')]['id']}})[_0x2224('0x22')](handleEntityNotFound(_0x4c76f2,null))[_0x2224('0x22')](function(_0x5e27c1){if(_0x5e27c1){_0x4ddcba=_0x5e27c1;_0x59edd8[_0x2224('0x46')]=_[_0x2224('0x48')](db['MailApplication'][_0x2224('0x43')]);_0x59edd8['query']=_['keys'](_0x472b12[_0x2224('0x49')]);_0x59edd8['filters']=_[_0x2224('0x4b')](_0x59edd8['model'],_0x59edd8[_0x2224('0x49')]);_0xa3aace['attributes']=_[_0x2224('0x4b')](_0x59edd8['model'],qs[_0x2224('0x4d')](_0x472b12[_0x2224('0x49')][_0x2224('0x4d')]));_0xa3aace[_0x2224('0x4c')]=_0xa3aace[_0x2224('0x4c')]['length']?_0xa3aace['attributes']:_0x59edd8[_0x2224('0x46')];_0xa3aace['order']=qs[_0x2224('0x50')](_0x472b12[_0x2224('0x49')][_0x2224('0x50')]);_0xa3aace['where']=qs[_0x2224('0x4a')](_[_0x2224('0x52')](_0x472b12['query'],_0x59edd8['filters']));if(_0x472b12[_0x2224('0x49')][_0x2224('0x53')]){_0xa3aace['where']=_[_0x2224('0x54')](_0xa3aace[_0x2224('0x51')],{'$or':_[_0x2224('0x47')](_0xa3aace[_0x2224('0x4c')],function(_0x2246e6){var _0x19caad={};_0x19caad[_0x2246e6]={'$like':'%'+_0x472b12['query'][_0x2224('0x53')]+'%'};return _0x19caad;})});}_0xa3aace=_[_0x2224('0x54')]({},_0xa3aace,_0x472b12[_0x2224('0x56')]);return _0x4ddcba[_0x2224('0xa0')](_0xa3aace);}})[_0x2224('0x22')](function(_0x3e7c23){if(_0x3e7c23){_0x516c41=_0x3e7c23[_0x2224('0x5f')];if(!_0x472b12['query'][_0x2224('0x69')](_0x2224('0x4e'))){_0xa3aace[_0x2224('0x31')]=qs['limit'](_0x472b12[_0x2224('0x49')][_0x2224('0x31')]);_0xa3aace[_0x2224('0x33')]=qs[_0x2224('0x33')](_0x472b12['query'][_0x2224('0x33')]);}return _0x4ddcba['getApplications'](_0xa3aace);}})[_0x2224('0x22')](function(_0x3ce47a){if(_0x3ce47a){return _0x3ce47a?{'count':_0x516c41,'rows':_0x3ce47a}:null;}})['then'](respondWithResult(_0x4c76f2,null))[_0x2224('0x2d')](handleError(_0x4c76f2,null));};exports[_0x2224('0xa1')]=function(_0x3e060f,_0x3351fe,_0x2b306e){var _0x2e1f38={'raw':!![],'where':{}};var _0x41b7e6={};var _0x1dfb24={'count':0x0,'rows':[]};return db[_0x2224('0x57')][_0x2224('0x68')]({'where':{'id':_0x3e060f['params']['id']}})['then'](handleEntityNotFound(_0x3351fe,null))[_0x2224('0x22')](function(_0x51a94f){if(_0x51a94f){_0x41b7e6[_0x2224('0x46')]=_[_0x2224('0x48')](db[_0x2224('0xa2')][_0x2224('0x43')]);_0x41b7e6['query']=_[_0x2224('0x48')](_0x3e060f['query']);_0x41b7e6['filters']=_[_0x2224('0x4b')](_0x41b7e6[_0x2224('0x46')],_0x41b7e6[_0x2224('0x49')]);_0x2e1f38[_0x2224('0x4c')]=_['intersection'](_0x41b7e6[_0x2224('0x46')],qs[_0x2224('0x4d')](_0x3e060f[_0x2224('0x49')][_0x2224('0x4d')]));_0x2e1f38[_0x2224('0x4c')]=_0x2e1f38[_0x2224('0x4c')][_0x2224('0x5f')]?_0x2e1f38[_0x2224('0x4c')]:_0x41b7e6[_0x2224('0x46')];if(!_0x3e060f[_0x2224('0x49')]['hasOwnProperty']('nolimit')){_0x2e1f38['limit']=qs[_0x2224('0x31')](_0x3e060f['query'][_0x2224('0x31')]);_0x2e1f38[_0x2224('0x33')]=qs['offset'](_0x3e060f['query']['offset']);}_0x2e1f38['order']=qs[_0x2224('0x50')](_0x3e060f[_0x2224('0x49')]['sort']);_0x2e1f38['where']=qs['filters'](_['pick'](_0x3e060f[_0x2224('0x49')],_0x41b7e6[_0x2224('0x4a')]));_0x2e1f38[_0x2224('0x51')][_0x2224('0x64')]=_0x51a94f['id'];if(_0x3e060f[_0x2224('0x49')]['filter']){_0x2e1f38[_0x2224('0x51')]=_['merge'](_0x2e1f38[_0x2224('0x51')],{'$or':_['map'](_0x2e1f38[_0x2224('0x4c')],function(_0x2e20c){var _0x2130cd={};_0x2130cd[_0x2e20c]={'$like':'%'+_0x3e060f[_0x2224('0x49')][_0x2224('0x53')]+'%'};return _0x2130cd;})});}if(_0x3e060f[_0x2224('0x49')][_0x2224('0xa3')]){var _0x1d8310=_0x3e060f['query'][_0x2224('0xa3')][_0x2224('0xa4')](',');var _0x286187={};_0x286187[_0x1d8310[0x0]]={'$gte':moment(_0x1d8310[0x1])[_0x2224('0xa5')](_0x2224('0xa6'))};_0x2e1f38[_0x2224('0x51')]=_[_0x2224('0x54')](_0x2e1f38['where'],_0x286187);}_0x2e1f38=_['merge']({},_0x2e1f38,_0x3e060f[_0x2224('0x56')]);return db[_0x2224('0xa2')][_0x2224('0x32')]({'where':_0x2e1f38['where']})['then'](function(_0x4b7c13){_0x1dfb24[_0x2224('0x32')]=_0x4b7c13;if(_0x3e060f['query'][_0x2224('0x58')]){_0x2e1f38[_0x2224('0x59')]=[{'all':!![]}];}return db[_0x2224('0xa2')][_0x2224('0xa7')](_0x2e1f38);})[_0x2224('0x22')](function(_0x24539c){if(_0x3e060f[_0x2224('0x49')][_0x2224('0xa8')]===_0x2224('0xa9')){for(var _0x184ca1=0x0;_0x184ca1<_0x24539c[_0x2224('0x5f')];_0x184ca1++){_0x24539c[_0x184ca1][_0x2224('0x60')]=juice(_0x24539c[_0x184ca1][_0x2224('0x60')]);}}_0x1dfb24[_0x2224('0x5a')]=_0x24539c;return _0x1dfb24;});}})[_0x2224('0x22')](respondWithFilteredResult(_0x3351fe,_0x2e1f38))['catch'](handleError(_0x3351fe,null));};exports['send']=function(_0x44ff47,_0x1acbbc,_0x4a799a){var _0x5c6c82,_0x1b73cc={},_0x11f814;if(_0x44ff47[_0x2224('0x60')]['to']){_0x11f814=_0x44ff47[_0x2224('0x60')]['to'][_0x2224('0xa4')](',')[0x0];}return db[_0x2224('0x57')][_0x2224('0x61')]({'where':{'id':_0x44ff47[_0x2224('0x5c')]['id']},'include':[{'model':db[_0x2224('0xaa')],'as':'List','include':[{'model':db[_0x2224('0x8e')],'as':_0x2224('0xab'),'where':{'email':_0x11f814},'limit':0x1,'order':[[_0x2224('0xac'),_0x2224('0xad')]]}]},{'model':db[_0x2224('0x5d')],'as':_0x2224('0x41'),'raw':!![]}]})['then'](handleEntityNotFound(_0x1acbbc,null))[_0x2224('0x22')](function(_0x1579e1){if(_0x1579e1){_0x5c6c82=_0x1579e1;if(_0x1579e1[_0x2224('0x41')]){if(_[_0x2224('0x70')](_0x44ff47[_0x2224('0x60')][_0x2224('0xae')])){_0x44ff47[_0x2224('0x60')][_0x2224('0xae')]=util[_0x2224('0xa5')](_0x2224('0xaf'),_0x1579e1[_0x2224('0x3c')],_0x1579e1['email']||_0x1579e1[_0x2224('0x41')][_0x2224('0x74')]);}if(_0x44ff47['body'][_0x2224('0xb0')]&&_0x44ff47[_0x2224('0x60')][_0x2224('0xb0')][_0x2224('0x5f')]){for(var _0x11a597=0x0;_0x11a597<_0x44ff47[_0x2224('0x60')][_0x2224('0xb0')][_0x2224('0x5f')];_0x11a597+=0x1){_0x44ff47[_0x2224('0x60')][_0x2224('0xb0')][_0x11a597]={'filename':_0x44ff47[_0x2224('0x60')][_0x2224('0xb0')][_0x11a597][_0x2224('0x3c')],'path':path['join'](config['root'],'server/files/attachments',_0x44ff47[_0x2224('0x60')][_0x2224('0xb0')][_0x11a597][_0x2224('0xb1')])};}}var _0xd5022d={'tls':{'rejectUnauthorized':![]}};if(_[_0x2224('0x70')](_0x1579e1['Smtp'][_0x2224('0x7c')])){if(_0x1579e1[_0x2224('0x41')]['authentication']){_0xd5022d['auth']={'user':_0x1579e1[_0x2224('0x41')]['user'],'pass':_0x1579e1[_0x2224('0x41')][_0x2224('0x77')]};}_0xd5022d[_0x2224('0x7a')]=_0x1579e1['Smtp']['host'];_0xd5022d[_0x2224('0x7b')]=_0x1579e1[_0x2224('0x41')][_0x2224('0x7b')];_0xd5022d[_0x2224('0xb2')]=_0x1579e1['Smtp'][_0x2224('0xb2')];}else{_0xd5022d[_0x2224('0x7c')]=_0x1579e1[_0x2224('0x41')][_0x2224('0x7c')];_0xd5022d[_0x2224('0xb3')]={'user':_0x1579e1[_0x2224('0x41')]['user'],'pass':_0x1579e1[_0x2224('0x41')]['pass']};}return respondWithRpcPromise(_0x2224('0xb4'),_0x2224('0xb5'),{'account':_0xd5022d,'message':_0x44ff47[_0x2224('0x60')]});}else{throw new Error(_0x2224('0xb6'));}}})[_0x2224('0x22')](function(_0x45a40e){if(_0x45a40e){_0x1b73cc=_0x45a40e;if(_0x5c6c82[_0x2224('0xb7')]){if(_0x5c6c82[_0x2224('0xb7')][_0x2224('0xab')][_0x2224('0x5f')]){return _0x5c6c82['List'][_0x2224('0xab')][0x0];}else{return db['CmContact']['create'](_[_0x2224('0x1c')](_0x44ff47['body'],{'firstName':_0x44ff47[_0x2224('0x60')]['to'],'email':_0x44ff47[_0x2224('0x60')]['to'],'phone':_0x44ff47[_0x2224('0x60')]['to'],'ListId':_0x5c6c82['ListId']}));}}else{throw new Error(_0x2224('0xb6'));}}})['then'](function(_0x33f45e){if(_0x33f45e){var _0x61a362={'UserId':_0x44ff47['user']['id'],'ContactId':_0x33f45e['id'],'MailAccountId':_0x5c6c82['id'],'inReplyTo':_0x1b73cc['messageId'],'to':_0x44ff47['body'][_0x2224('0xae')],'cc':_0x44ff47[_0x2224('0x60')]['cc'],'subject':_0x44ff47[_0x2224('0x60')]['subject'],'attach':_0x44ff47[_0x2224('0x60')][_0x2224('0xb8')],'firstMsgDirection':_0x2224('0xb9'),'lastMsgAt':moment()[_0x2224('0xa5')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x2224('0xb9'),'Messages':[_[_0x2224('0x54')](_0x44ff47[_0x2224('0x60')],{'messageId':_0x1b73cc[_0x2224('0xba')],'sentAt':moment()[_0x2224('0xa5')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x5c6c82['id'],'UserId':_0x44ff47[_0x2224('0x74')]['id'],'ContactId':_0x33f45e['id']})]};if(_0x44ff47[_0x2224('0x60')]['Interaction']){_0x61a362=_[_0x2224('0x54')](_0x61a362,_0x44ff47[_0x2224('0x60')][_0x2224('0xbb')]);}return db['MailInteraction'][_0x2224('0x66')](_0x61a362,{'include':[{'model':db['MailMessage'],'as':_0x2224('0xbc')}]});}})[_0x2224('0x22')](respondWithResult(_0x1acbbc,null))[_0x2224('0x2d')](handleError(_0x1acbbc,null));};exports['verifySmtp']=function(_0x2da6cc,_0x4e913f,_0xcd827e){return db[_0x2224('0x57')]['find']({'where':{'id':_0x2da6cc[_0x2224('0x5c')]['id']},'include':[{'model':db[_0x2224('0x5d')],'as':_0x2224('0x41'),'raw':!![]}]})['then'](handleEntityNotFound(_0x4e913f,null))[_0x2224('0x22')](function(_0x1426e0){if(_0x1426e0&&_0x1426e0['Smtp']){var _0x286908={'id':_0x1426e0['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1426e0[_0x2224('0x41')]['service']){_0x286908[_0x2224('0x7c')]=_0x1426e0[_0x2224('0x41')][_0x2224('0x7c')];}else{_0x286908[_0x2224('0x7a')]=_0x1426e0[_0x2224('0x41')][_0x2224('0x7a')];_0x286908[_0x2224('0x7b')]=_0x1426e0[_0x2224('0x41')][_0x2224('0x7b')];_0x286908[_0x2224('0xb2')]=_0x1426e0[_0x2224('0x41')][_0x2224('0xb2')];}if(_0x1426e0['Smtp']['authentication']){_0x286908[_0x2224('0xb3')]={'user':_0x1426e0[_0x2224('0x41')][_0x2224('0x74')],'pass':_0x1426e0[_0x2224('0x41')][_0x2224('0x77')]};}return respondWithRpcPromise('VerifySmtp',_0x2224('0xbd'),{'account':_0x286908});}})[_0x2224('0x22')](respondWithResult(_0x4e913f,null))[_0x2224('0x2d')](handleError(_0x4e913f,null));};exports['destroy']=function(_0x203ff7,_0x1f1106){return db['MailAccount'][_0x2224('0x61')]({'where':{'id':_0x203ff7[_0x2224('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1f1106,null))[_0x2224('0x22')](function(_0x5486a0){if(_0x5486a0&&_0x5486a0[_0x2224('0x7c')]){throw new db[(_0x2224('0xbe'))][(_0x2224('0xbf'))](_0x2224('0xc0'));}return _0x5486a0;})[_0x2224('0x22')](removeEntity(_0x1f1106,null))[_0x2224('0x2d')](handleError(_0x1f1106,null));};exports[_0x2224('0xc1')]=function(_0x4d9621,_0x170b39,_0x420d82){return db[_0x2224('0x57')][_0x2224('0x61')]({'where':{'id':_0x4d9621[_0x2224('0x5c')]['id']}})[_0x2224('0x22')](handleEntityNotFound(_0x170b39,null))[_0x2224('0x22')](function(_0x3db006){if(_0x3db006){return _0x3db006[_0x2224('0xc1')](_0x4d9621[_0x2224('0x60')]['ids'],_[_0x2224('0x8c')](_0x4d9621[_0x2224('0x60')],['ids','id'])||{})['spread'](function(_0x1d08b5){for(var _0xdf25bd=0x0;_0xdf25bd<_0x4d9621[_0x2224('0x60')]['ids'][_0x2224('0x5f')];_0xdf25bd+=0x1){socket[_0x2224('0xc2')](_0x2224('0xc3'),{'UserId':Number(_0x4d9621[_0x2224('0x60')][_0x2224('0x6e')][_0xdf25bd]),'MailAccountId':Number(_0x4d9621['params']['id'])});}return _0x1d08b5;});}})['then'](respondWithResult(_0x170b39,null))[_0x2224('0x2d')](handleError(_0x170b39,null));};exports[_0x2224('0xc4')]=function(_0xc2fb97,_0x136a40,_0x1efa16){return db[_0x2224('0x57')][_0x2224('0x61')]({'where':{'id':_0xc2fb97[_0x2224('0x5c')]['id']}})[_0x2224('0x22')](handleEntityNotFound(_0x136a40,null))[_0x2224('0x22')](function(_0x1b3dd4){if(_0x1b3dd4){return _0x1b3dd4['removeAgents'](_0xc2fb97[_0x2224('0x49')]['ids'])[_0x2224('0x22')](function(){if(_[_0x2224('0xc5')](_0xc2fb97[_0x2224('0x49')][_0x2224('0x6e')])){for(var _0x36b96a=0x0;_0x36b96a<_0xc2fb97[_0x2224('0x49')][_0x2224('0x6e')][_0x2224('0x5f')];_0x36b96a+=0x1){socket[_0x2224('0xc2')]('userMailAccount:remove',{'UserId':Number(_0xc2fb97['query']['ids'][_0x36b96a]),'MailAccountId':Number(_0xc2fb97[_0x2224('0x5c')]['id'])});}}else{socket[_0x2224('0xc2')](_0x2224('0xc6'),{'UserId':Number(_0xc2fb97['query'][_0x2224('0x6e')]),'MailAccountId':Number(_0xc2fb97[_0x2224('0x5c')]['id'])});}});}})[_0x2224('0x22')](respondWithStatusCode(_0x136a40,null))[_0x2224('0x2d')](handleError(_0x136a40,null));};exports['getAgents']=function(_0x15ea87,_0x83da61,_0x7be8b){var _0x1745ce={};var _0x189dd8={};var _0x737573;var _0x4f7d03;return db[_0x2224('0x57')][_0x2224('0x68')]({'where':{'id':_0x15ea87[_0x2224('0x5c')]['id']}})[_0x2224('0x22')](handleEntityNotFound(_0x83da61,null))[_0x2224('0x22')](function(_0x3ca591){if(_0x3ca591){_0x737573=_0x3ca591;_0x189dd8[_0x2224('0x46')]=_[_0x2224('0x48')](db[_0x2224('0xc7')]['rawAttributes']);_0x189dd8[_0x2224('0x49')]=_['keys'](_0x15ea87[_0x2224('0x49')]);_0x189dd8[_0x2224('0x4a')]=_[_0x2224('0x4b')](_0x189dd8[_0x2224('0x46')],_0x189dd8[_0x2224('0x49')]);_0x1745ce[_0x2224('0x4c')]=_[_0x2224('0x4b')](_0x189dd8[_0x2224('0x46')],qs[_0x2224('0x4d')](_0x15ea87[_0x2224('0x49')][_0x2224('0x4d')]));_0x1745ce[_0x2224('0x4c')]=_0x1745ce[_0x2224('0x4c')][_0x2224('0x5f')]?_0x1745ce[_0x2224('0x4c')]:_0x189dd8[_0x2224('0x46')];_0x1745ce[_0x2224('0x4f')]=qs[_0x2224('0x50')](_0x15ea87['query'][_0x2224('0x50')]);_0x1745ce[_0x2224('0x51')]=qs[_0x2224('0x4a')](_[_0x2224('0x52')](_0x15ea87['query'],_0x189dd8[_0x2224('0x4a')]));if(_0x15ea87[_0x2224('0x49')][_0x2224('0x53')]){_0x1745ce[_0x2224('0x51')]=_[_0x2224('0x54')](_0x1745ce[_0x2224('0x51')],{'$or':_['map'](_0x1745ce[_0x2224('0x4c')],function(_0x3a6f77){var _0x2d2e67={};_0x2d2e67[_0x3a6f77]={'$like':'%'+_0x15ea87[_0x2224('0x49')]['filter']+'%'};return _0x2d2e67;})});}_0x1745ce=_[_0x2224('0x54')]({},_0x1745ce,_0x15ea87['options']);return _0x737573['getAgents'](_0x1745ce);}})[_0x2224('0x22')](function(_0x4da857){if(_0x4da857){_0x4f7d03=_0x4da857[_0x2224('0x5f')];if(!_0x15ea87['query']['hasOwnProperty']('nolimit')){_0x1745ce['limit']=qs[_0x2224('0x31')](_0x15ea87['query'][_0x2224('0x31')]);_0x1745ce[_0x2224('0x33')]=qs[_0x2224('0x33')](_0x15ea87[_0x2224('0x49')][_0x2224('0x33')]);}return _0x737573['getAgents'](_0x1745ce);}})[_0x2224('0x22')](function(_0x2912f){if(_0x2912f){return _0x2912f?{'count':_0x4f7d03,'rows':_0x2912f}:null;}})['then'](respondWithResult(_0x83da61,null))[_0x2224('0x2d')](handleError(_0x83da61,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 5fb62c4..9f4e315 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 _0x9ed7=['MailAccount','save','remove','emit','hook','exports','events','../../mysqldb'];(function(_0xf016a2,_0x1fba99){var _0x254658=function(_0x3b06fc){while(--_0x3b06fc){_0xf016a2['push'](_0xf016a2['shift']());}};_0x254658(++_0x1fba99);}(_0x9ed7,0x1a6));var _0x79ed=function(_0x5cbd7b,_0x207439){_0x5cbd7b=_0x5cbd7b-0x0;var _0x3fdfb8=_0x9ed7[_0x5cbd7b];return _0x3fdfb8;};'use strict';var EventEmitter=require(_0x79ed('0x0'));var MailAccount=require(_0x79ed('0x1'))['db'][_0x79ed('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x79ed('0x3'),'afterUpdate':'update','afterDestroy':_0x79ed('0x4')};function emitEvent(_0x29443e){return function(_0xfe2c86,_0x210dee,_0x3ec875){MailAccountEvents[_0x79ed('0x5')](_0x29443e+':'+_0xfe2c86['id'],_0xfe2c86);MailAccountEvents[_0x79ed('0x5')](_0x29443e,_0xfe2c86);_0x3ec875(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x79ed('0x6')](e,emitEvent(event));}}module[_0x79ed('0x7')]=MailAccountEvents; \ No newline at end of file +var _0x3b61=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','save','update','remove'];(function(_0x15e6fe,_0x1a5c39){var _0x34894d=function(_0x32eec2){while(--_0x32eec2){_0x15e6fe['push'](_0x15e6fe['shift']());}};_0x34894d(++_0x1a5c39);}(_0x3b61,0x67));var _0x13b6=function(_0x186232,_0x56e14e){_0x186232=_0x186232-0x0;var _0x403a4d=_0x3b61[_0x186232];return _0x403a4d;};'use strict';var EventEmitter=require(_0x13b6('0x0'));var MailAccount=require(_0x13b6('0x1'))['db'][_0x13b6('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x13b6('0x3')](0x0);var events={'afterCreate':_0x13b6('0x4'),'afterUpdate':_0x13b6('0x5'),'afterDestroy':_0x13b6('0x6')};function emitEvent(_0x23fe0c){return function(_0x4c95f1,_0x107f9f,_0x3f7e49){MailAccountEvents[_0x13b6('0x7')](_0x23fe0c+':'+_0x4c95f1['id'],_0x4c95f1);MailAccountEvents['emit'](_0x23fe0c,_0x4c95f1);_0x3f7e49(null);};}for(var e in events){if(events[_0x13b6('0x8')](e)){var event=events[e];MailAccount[_0x13b6('0x9')](e,emitEvent(event));}}module[_0x13b6('0xa')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index dc554fb..f070803 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 _0x8e63=['bluebird','path','rimraf','../../config/environment','exports','define','MailAccount','lodash','util','../../config/logger','api'];(function(_0xe5b349,_0x5f06e4){var _0x26b0ad=function(_0x1a97f1){while(--_0x1a97f1){_0xe5b349['push'](_0xe5b349['shift']());}};_0x26b0ad(++_0x5f06e4);}(_0x8e63,0x80));var _0x38e6=function(_0x5aafce,_0x143bc3){_0x5aafce=_0x5aafce-0x0;var _0x3df23f=_0x8e63[_0x5aafce];return _0x3df23f;};'use strict';var _=require(_0x38e6('0x0'));var util=require(_0x38e6('0x1'));var logger=require(_0x38e6('0x2'))(_0x38e6('0x3'));var moment=require('moment');var BPromise=require(_0x38e6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x38e6('0x5'));var rimraf=require(_0x38e6('0x6'));var config=require(_0x38e6('0x7'));var attributes=require('./mailAccount.attributes');module[_0x38e6('0x8')]=function(_0x477e96,_0x31e8fb){return _0x477e96[_0x38e6('0x9')](_0x38e6('0xa'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e6e=['request-promise','path','../../config/environment','exports','define','lodash','util','../../config/logger','api','bluebird'];(function(_0x3e8b17,_0x4159ca){var _0x46e83e=function(_0x21dcf7){while(--_0x21dcf7){_0x3e8b17['push'](_0x3e8b17['shift']());}};_0x46e83e(++_0x4159ca);}(_0x6e6e,0x87));var _0xe6e6=function(_0x7eba4c,_0xa58272){_0x7eba4c=_0x7eba4c-0x0;var _0x245424=_0x6e6e[_0x7eba4c];return _0x245424;};'use strict';var _=require(_0xe6e6('0x0'));var util=require(_0xe6e6('0x1'));var logger=require(_0xe6e6('0x2'))(_0xe6e6('0x3'));var moment=require('moment');var BPromise=require(_0xe6e6('0x4'));var rp=require(_0xe6e6('0x5'));var fs=require('fs');var path=require(_0xe6e6('0x6'));var rimraf=require('rimraf');var config=require(_0xe6e6('0x7'));var attributes=require('./mailAccount.attributes');module[_0xe6e6('0x8')]=function(_0x37dded,_0x211261){return _0x37dded[_0xe6e6('0x9')]('MailAccount',attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index eac81b8..d1a8274 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 _0x2216=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','then','info','MailAccount,\x20%s,\x20%s','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','MailAccount','findAll','options','raw','attributes','limit','include','map','model','GetMailAccount','debug','ShowMailAccount','find','NotifyMailAccount','body','mail','CmContact','rawAttributes','createdAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','MailServerOut','get','omit','Applications','list','applications','priority','autoclose','push','*,*,*,*','defaults','messageId','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','MailInteraction','create','Contact\x20not\x20found','spread','update','subject','interaction','created','contact','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment'];(function(_0x4af712,_0x4de61f){var _0x36be73=function(_0x40808e){while(--_0x40808e){_0x4af712['push'](_0x4af712['shift']());}};_0x36be73(++_0x4de61f);}(_0x2216,0x1ad));var _0x6221=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x2216[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x6221('0x0'));var util=require(_0x6221('0x1'));var moment=require(_0x6221('0x2'));var BPromise=require(_0x6221('0x3'));var rs=require(_0x6221('0x4'));var fs=require('fs');var Redis=require(_0x6221('0x5'));var db=require(_0x6221('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6221('0x7'))(_0x6221('0x8'));var config=require(_0x6221('0x9'));var jayson=require(_0x6221('0xa'));var client=jayson[_0x6221('0xb')][_0x6221('0xc')]({'port':0x232c});config['redis']=_['defaults'](config[_0x6221('0xd')],{'host':_0x6221('0xe'),'port':0x18eb});var socket=require(_0x6221('0xf'))(new Redis(config[_0x6221('0xd')]));require(_0x6221('0x10'))['register'](socket);function respondWithRpcPromise(_0x26cc6c,_0x2326e3,_0x181fae){return new BPromise(function(_0x12c850,_0xdf8505){return client['request'](_0x26cc6c,_0x181fae)[_0x6221('0x11')](function(_0x47881f){logger[_0x6221('0x12')](_0x6221('0x13'),_0x2326e3,'request\x20sent');logger['debug'](_0x6221('0x14'),_0x2326e3,_0x6221('0x15'),JSON[_0x6221('0x16')](_0x47881f));if(_0x47881f[_0x6221('0x17')]){if(_0x47881f[_0x6221('0x17')][_0x6221('0x18')]===0x1f4){logger[_0x6221('0x17')]('MailAccount,\x20%s,\x20%s',_0x2326e3,_0x47881f[_0x6221('0x17')][_0x6221('0x19')]);return _0xdf8505(_0x47881f[_0x6221('0x17')][_0x6221('0x19')]);}logger['error'](_0x6221('0x13'),_0x2326e3,_0x47881f['error'][_0x6221('0x19')]);return _0x12c850(_0x47881f[_0x6221('0x17')][_0x6221('0x19')]);}else{logger[_0x6221('0x12')](_0x6221('0x13'),_0x2326e3,_0x6221('0x15'));_0x12c850(_0x47881f[_0x6221('0x1a')][_0x6221('0x19')]);}})[_0x6221('0x1b')](function(_0x4a9f16){logger[_0x6221('0x17')]('MailAccount,\x20%s,\x20%s',_0x2326e3,_0x4a9f16);_0xdf8505(_0x4a9f16);});});}exports['GetMailAccount']=function(_0x1bf1c0){var _0xf23341=this;return new Promise(function(_0x1d0243,_0x48f57e){return db[_0x6221('0x1c')][_0x6221('0x1d')]({'raw':_0x1bf1c0[_0x6221('0x1e')]?_0x1bf1c0['options'][_0x6221('0x1f')]===undefined?!![]:![]:!![],'where':_0x1bf1c0[_0x6221('0x1e')]?_0x1bf1c0[_0x6221('0x1e')]['where']||null:null,'attributes':_0x1bf1c0[_0x6221('0x1e')]?_0x1bf1c0[_0x6221('0x1e')][_0x6221('0x20')]||null:null,'limit':_0x1bf1c0['options']?_0x1bf1c0[_0x6221('0x1e')][_0x6221('0x21')]||null:null,'include':_0x1bf1c0['options']?_0x1bf1c0[_0x6221('0x1e')][_0x6221('0x22')]?_[_0x6221('0x23')](_0x1bf1c0[_0x6221('0x1e')]['include'],function(_0xb93395){return{'model':db[_0xb93395[_0x6221('0x24')]],'as':_0xb93395['as'],'attributes':_0xb93395['attributes'],'include':_0xb93395[_0x6221('0x22')]?_[_0x6221('0x23')](_0xb93395['include'],function(_0x5ef916){return{'model':db[_0x5ef916[_0x6221('0x24')]],'as':_0x5ef916['as'],'attributes':_0x5ef916[_0x6221('0x20')],'include':_0x5ef916[_0x6221('0x22')]?_[_0x6221('0x23')](_0x5ef916[_0x6221('0x22')],function(_0x185b9f){return{'model':db[_0x185b9f['model']],'as':_0x185b9f['as'],'attributes':_0x185b9f['attributes']};}):[]};}):[]};}):[]:[]})[_0x6221('0x11')](function(_0x3a61ab){logger['info'](_0x6221('0x25'),_0x1bf1c0);logger[_0x6221('0x26')]('GetMailAccount',_0x1bf1c0,JSON[_0x6221('0x16')](_0x3a61ab));_0x1d0243(_0x3a61ab);})['catch'](function(_0x388e5b){logger[_0x6221('0x17')](_0x6221('0x25'),_0x388e5b[_0x6221('0x19')],_0x1bf1c0);_0x48f57e(_0xf23341[_0x6221('0x17')](0x1f4,_0x388e5b[_0x6221('0x19')]));});});};exports[_0x6221('0x27')]=function(_0x7049e1){var _0xfa0bbd=this;return new Promise(function(_0x25e14e,_0x2d613e){return db[_0x6221('0x1c')][_0x6221('0x28')]({'raw':_0x7049e1[_0x6221('0x1e')]?_0x7049e1[_0x6221('0x1e')][_0x6221('0x1f')]===undefined?!![]:![]:!![],'where':_0x7049e1[_0x6221('0x1e')]?_0x7049e1[_0x6221('0x1e')]['where']||null:null,'attributes':_0x7049e1[_0x6221('0x1e')]?_0x7049e1[_0x6221('0x1e')]['attributes']||null:null,'include':_0x7049e1[_0x6221('0x1e')]?_0x7049e1[_0x6221('0x1e')]['include']?_[_0x6221('0x23')](_0x7049e1[_0x6221('0x1e')]['include'],function(_0x45930b){return{'model':db[_0x45930b[_0x6221('0x24')]],'as':_0x45930b['as'],'attributes':_0x45930b[_0x6221('0x20')],'include':_0x45930b[_0x6221('0x22')]?_[_0x6221('0x23')](_0x45930b[_0x6221('0x22')],function(_0x459b98){return{'model':db[_0x459b98[_0x6221('0x24')]],'as':_0x459b98['as'],'attributes':_0x459b98[_0x6221('0x20')],'include':_0x459b98[_0x6221('0x22')]?_[_0x6221('0x23')](_0x459b98[_0x6221('0x22')],function(_0x38d8d6){return{'model':db[_0x38d8d6[_0x6221('0x24')]],'as':_0x38d8d6['as'],'attributes':_0x38d8d6['attributes']};}):[]};}):[]};}):[]:[]})[_0x6221('0x11')](function(_0x3f86d3){logger[_0x6221('0x12')]('ShowMailAccount',_0x7049e1);logger['debug'](_0x6221('0x27'),_0x7049e1,JSON[_0x6221('0x16')](_0x3f86d3));_0x25e14e(_0x3f86d3);})[_0x6221('0x1b')](function(_0x102a42){logger[_0x6221('0x17')](_0x6221('0x27'),_0x102a42[_0x6221('0x19')],_0x7049e1);_0x2d613e(_0xfa0bbd[_0x6221('0x17')](0x1f4,_0x102a42[_0x6221('0x19')]));});});};exports[_0x6221('0x29')]=function(_0x5049c0){var _0x51d67b=this;return new Promise(function(_0x33eee8,_0x46ac0e){var _0x1aff31={'body':_0x5049c0[_0x6221('0x2a')],'channel':_0x6221('0x2b')};var _0x4824cd=_['difference'](_['keys'](db[_0x6221('0x2c')][_0x6221('0x2d')]),[_0x6221('0x2e'),'updatedAt',_0x6221('0x2f'),_0x6221('0x30')]);var _0x3aef48=![];if(_0x5049c0[_0x6221('0x2a')]['id']){delete _0x5049c0[_0x6221('0x2a')]['id'];}if(_['isNil'](_0x5049c0[_0x6221('0x2a')][_0x6221('0x31')])){return _0x46ac0e(_0x51d67b[_0x6221('0x17')](0x1f4,_0x6221('0x32')));}if(_[_0x6221('0x33')](_0x5049c0[_0x6221('0x2a')][_0x6221('0x2a')])||_0x5049c0[_0x6221('0x2a')][_0x6221('0x2a')]===''){return _0x46ac0e(_0x51d67b[_0x6221('0x17')](0x1f4,_0x6221('0x34')));}if(_[_0x6221('0x33')](_0x5049c0[_0x6221('0x2a')][_0x6221('0x35')])){return _0x46ac0e(_0x51d67b[_0x6221('0x17')](0x1f4,_0x6221('0x36')+_0x4824cd));}if(!_[_0x6221('0x37')](_0x4824cd,_0x5049c0[_0x6221('0x2a')][_0x6221('0x35')])){return _0x46ac0e(_0x51d67b[_0x6221('0x17')](0x1f4,_0x6221('0x38')+_0x4824cd));}var _0x51319b={};_0x51319b[_0x5049c0[_0x6221('0x2a')]['mapKey']]=_0x5049c0[_0x6221('0x2a')][_0x6221('0x31')];return db[_0x6221('0x1c')][_0x6221('0x28')]({'where':{'id':_0x5049c0[_0x6221('0x39')]['id']},'include':[{'model':db[_0x6221('0x3a')],'as':_0x6221('0x3b'),'include':[{'model':db[_0x6221('0x2c')],'as':_0x6221('0x3c'),'where':_0x51319b,'limit':0x1,'order':[['updatedAt',_0x6221('0x3d')]]}]},{'model':db[_0x6221('0x3e')],'as':'Applications'},{'model':db[_0x6221('0x3f')],'as':'Smtp'}]})['then'](function(_0x2a544b){if(_0x2a544b&&_0x2a544b['List']){var _0x4b8339=_0x2a544b[_0x6221('0x40')]({'plain':!![]});_0x1aff31[_0x6221('0x39')]=_[_0x6221('0x41')](_0x4b8339,[_0x6221('0x42'),_0x6221('0x3b')]);_0x1aff31['applications']=_0x4b8339[_0x6221('0x42')];_0x1aff31[_0x6221('0x43')]=_0x4b8339[_0x6221('0x3b')];_0x1aff31[_0x6221('0x44')]=_['orderBy'](_0x1aff31[_0x6221('0x44')],[_0x6221('0x45')],['asc']);if(_0x1aff31[_0x6221('0x39')]&&_0x1aff31[_0x6221('0x39')][_0x6221('0x46')]){_0x1aff31['applications'][_0x6221('0x47')]({'id':0x0,'priority':_0x1aff31[_0x6221('0x44')]['length']+0x1,'app':'close','appdata':_0x6221('0x46'),'interval':_0x6221('0x48')});}if(_0x1aff31['account'][_0x6221('0x42')]){delete _0x1aff31['account'][_0x6221('0x42')];}if(_0x1aff31['account'][_0x6221('0x3b')]){delete _0x1aff31[_0x6221('0x39')][_0x6221('0x3b')];}if(_0x4b8339['List'][_0x6221('0x3c')]['length']){return _0x4b8339[_0x6221('0x3b')][_0x6221('0x3c')][0x0];}var _0x25d4d4=_[_0x6221('0x49')](_0x5049c0['body'],{'firstName':_0x5049c0[_0x6221('0x2a')][_0x6221('0x31')],'ListId':_0x4b8339[_0x6221('0x30')]});_0x25d4d4[_0x5049c0[_0x6221('0x2a')][_0x6221('0x35')]]=_0x5049c0[_0x6221('0x2a')][_0x6221('0x31')];return db[_0x6221('0x2c')]['create'](_0x25d4d4);}else{throw new Error('List\x20not\x20found');}})[_0x6221('0x11')](function(_0x4ea0b3){_0x1aff31['contact']=_0x4ea0b3;if(_0x4ea0b3){if(!_0x5049c0[_0x6221('0x2a')][_0x6221('0x19')][_0x6221('0x4a')]){_0x5049c0[_0x6221('0x2a')]['message'][_0x6221('0x4a')]=rs['generate']()+'\x20'+_0x5049c0[_0x6221('0x2a')][_0x6221('0x19')][_0x6221('0x31')];}var _0x483ba9={'ContactId':_0x4ea0b3['id'],'MailAccountId':_0x5049c0['account']['id'],'inReplyTo':_0x5049c0[_0x6221('0x2a')]['message'][_0x6221('0x4a')],'to':_0x5049c0[_0x6221('0x2a')][_0x6221('0x19')]['from'],'cc':_0x5049c0['body'][_0x6221('0x19')]['cc'],'subject':_0x5049c0[_0x6221('0x2a')][_0x6221('0x19')]['subject'],'attach':_0x5049c0[_0x6221('0x2a')][_0x6221('0x19')][_0x6221('0x4b')],'lastMsgAt':moment()[_0x6221('0x4c')](_0x6221('0x4d')),'lastMsgDirection':'in'};return db['MailInteraction'][_0x6221('0x28')]({'where':{'closed':![],'MailAccountId':_0x5049c0[_0x6221('0x39')]['id']},'include':[{'model':db[_0x6221('0x4e')],'as':_0x6221('0x4f'),'attributes':['messageId'],'where':{'messageId':_0x5049c0['body'][_0x6221('0x19')][_0x6221('0x50')]}}]})[_0x6221('0x11')](function(_0x351c82){if(_0x351c82){return[_0x351c82,![]];}return db[_0x6221('0x51')][_0x6221('0x52')](_0x483ba9)[_0x6221('0x11')](function(_0x4aa138){return[_0x4aa138,!![]];});});}else{throw new Error(_0x6221('0x53'));}})[_0x6221('0x54')](function(_0x5ee9ff,_0x5cf65f){if(_0x5ee9ff){_0x3aef48=_0x5cf65f;if(!_0x5cf65f){return _0x5ee9ff[_0x6221('0x55')]({'inReplyTo':_0x5049c0[_0x6221('0x2a')]['message']['messageId'],'to':_0x5049c0[_0x6221('0x2a')]['message'][_0x6221('0x31')],'cc':_0x5049c0[_0x6221('0x2a')][_0x6221('0x19')]['cc'],'subject':_0x5049c0[_0x6221('0x2a')][_0x6221('0x19')][_0x6221('0x56')],'attach':_0x5ee9ff[_0x6221('0x4b')]?_0x5ee9ff[_0x6221('0x4b')]:_0x5049c0[_0x6221('0x2a')]['message'][_0x6221('0x4b')],'substatus':null,'substatusAt':moment()['format'](_0x6221('0x4d')),'lastMsgAt':moment()[_0x6221('0x4c')](_0x6221('0x4d')),'lastMsgDirection':'in'});}else{return _0x5ee9ff;}}})[_0x6221('0x11')](function(_0x4b4f48){_0x1aff31['interaction']=_0x4b4f48['get']({'plain':!![]});_0x1aff31[_0x6221('0x57')][_0x6221('0x58')]=_0x3aef48;return db[_0x6221('0x4e')][_0x6221('0x52')]({'body':_0x5049c0[_0x6221('0x2a')][_0x6221('0x2a')],'MailAccountId':_0x5049c0[_0x6221('0x39')]['id'],'MailInteractionId':_0x4b4f48['id'],'direction':'in','ContactId':_0x1aff31[_0x6221('0x59')]['id'],'messageId':_0x5049c0[_0x6221('0x2a')][_0x6221('0x19')][_0x6221('0x4a')],'from':_0x5049c0['body'][_0x6221('0x19')][_0x6221('0x31')],'to':_0x5049c0[_0x6221('0x2a')]['message']['to'],'cc':_0x5049c0[_0x6221('0x2a')][_0x6221('0x19')]['cc'],'subject':_0x5049c0['body'][_0x6221('0x19')][_0x6221('0x56')],'attach':_0x5049c0['body'][_0x6221('0x19')][_0x6221('0x4b')],'Attachments':_0x5049c0[_0x6221('0x2a')][_0x6221('0x19')][_0x6221('0x5a')],'originTo':_0x5049c0[_0x6221('0x2a')][_0x6221('0x19')][_0x6221('0x5b')],'originCc':_0x5049c0[_0x6221('0x2a')][_0x6221('0x19')][_0x6221('0x5c')],'bcc':_0x5049c0['body'][_0x6221('0x19')][_0x6221('0x5d')],'ChatWebsiteId':_0x5049c0[_0x6221('0x2a')][_0x6221('0x19')][_0x6221('0x5e')]||null,'originChannel':_0x5049c0['body'][_0x6221('0x19')][_0x6221('0x5f')]||_0x6221('0x60'),'ChatOfflineMessageId':_0x5049c0['body'][_0x6221('0x19')][_0x6221('0x61')]||null},{'include':[{'model':db[_0x6221('0x62')],'as':_0x6221('0x63')}]});})[_0x6221('0x11')](function(_0x50da37){_0x1aff31[_0x6221('0x19')]=_0x50da37;if(_0x1aff31[_0x6221('0x57')][_0x6221('0x64')]){return db[_0x6221('0x65')][_0x6221('0x28')]({'attributes':['id',_0x6221('0x66')],'where':{'id':_0x1aff31[_0x6221('0x57')][_0x6221('0x64')]}})[_0x6221('0x11')](function(_0x65811d){if(_0x65811d){_0x1aff31[_0x6221('0x44')][_0x6221('0x67')]({'id':0x0,'priority':0x0,'app':_0x6221('0x68'),'appdata':_0x65811d[_0x6221('0x66')]+','+(_0x1aff31[_0x6221('0x39')][_0x6221('0x69')]||0xa),'interval':_0x6221('0x48')});}return respondWithRpcPromise(_0x6221('0x6a'),_0x6221('0x6b'),_0x1aff31);});}return respondWithRpcPromise(_0x6221('0x6a'),_0x6221('0x6b'),_0x1aff31);})['then'](function(_0x39e9ac){_0x33eee8(_0x39e9ac);})[_0x6221('0x1b')](function(_0x184214){_0x46ac0e(_0x51d67b[_0x6221('0x17')](0x1f4,_0x184214['message']));});});}; \ No newline at end of file +var _0xd92e=['result','catch','GetMailAccount','MailAccount','options','raw','where','attributes','limit','include','map','model','ShowMailAccount','find','NotifyMailAccount','body','mail','difference','keys','CmContact','createdAt','updatedAt','CompanyId','ListId','isNil','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','DESC','MailApplication','Applications','Smtp','get','applications','list','orderBy','priority','asc','push','length','close','*,*,*,*','Contacts','defaults','List\x20not\x20found','contact','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','spread','update','attach','interaction','created','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachments','UserId','name','unshift','agent','waitForTheAssignedAgent','startRouting','Start','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x37851e,_0x13765c){var _0x5af6be=function(_0x2777a2){while(--_0x2777a2){_0x37851e['push'](_0x37851e['shift']());}};_0x5af6be(++_0x13765c);}(_0xd92e,0xc1));var _0xed92=function(_0x102492,_0x597176){_0x102492=_0x102492-0x0;var _0x2212cd=_0xd92e[_0x102492];return _0x2212cd;};'use strict';var _=require(_0xed92('0x0'));var util=require(_0xed92('0x1'));var moment=require(_0xed92('0x2'));var BPromise=require(_0xed92('0x3'));var rs=require(_0xed92('0x4'));var fs=require('fs');var Redis=require(_0xed92('0x5'));var db=require(_0xed92('0x6'))['db'];var utils=require(_0xed92('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xed92('0x8'));var jayson=require(_0xed92('0x9'));var client=jayson[_0xed92('0xa')][_0xed92('0xb')]({'port':0x232c});config['redis']=_['defaults'](config[_0xed92('0xc')],{'host':_0xed92('0xd'),'port':0x18eb});var socket=require(_0xed92('0xe'))(new Redis(config[_0xed92('0xc')]));require(_0xed92('0xf'))['register'](socket);function respondWithRpcPromise(_0x121870,_0x22cf33,_0x4d9922){return new BPromise(function(_0x27d8c7,_0x31d20){return client[_0xed92('0x10')](_0x121870,_0x4d9922)[_0xed92('0x11')](function(_0x3d04d1){logger[_0xed92('0x12')](_0xed92('0x13'),_0x22cf33,_0xed92('0x14'));logger[_0xed92('0x15')](_0xed92('0x16'),_0x22cf33,_0xed92('0x14'),JSON[_0xed92('0x17')](_0x3d04d1));if(_0x3d04d1['error']){if(_0x3d04d1[_0xed92('0x18')][_0xed92('0x19')]===0x1f4){logger[_0xed92('0x18')]('MailAccount,\x20%s,\x20%s',_0x22cf33,_0x3d04d1[_0xed92('0x18')]['message']);return _0x31d20(_0x3d04d1[_0xed92('0x18')][_0xed92('0x1a')]);}logger[_0xed92('0x18')](_0xed92('0x13'),_0x22cf33,_0x3d04d1[_0xed92('0x18')][_0xed92('0x1a')]);return _0x27d8c7(_0x3d04d1['error']['message']);}else{logger[_0xed92('0x12')]('MailAccount,\x20%s,\x20%s',_0x22cf33,_0xed92('0x14'));_0x27d8c7(_0x3d04d1[_0xed92('0x1b')][_0xed92('0x1a')]);}})[_0xed92('0x1c')](function(_0xbd5df7){logger[_0xed92('0x18')](_0xed92('0x13'),_0x22cf33,_0xbd5df7);_0x31d20(_0xbd5df7);});});}exports[_0xed92('0x1d')]=function(_0x336262){var _0x486876=this;return new Promise(function(_0x3e7337,_0x3663e0){return db[_0xed92('0x1e')]['findAll']({'raw':_0x336262[_0xed92('0x1f')]?_0x336262[_0xed92('0x1f')][_0xed92('0x20')]===undefined?!![]:![]:!![],'where':_0x336262[_0xed92('0x1f')]?_0x336262[_0xed92('0x1f')][_0xed92('0x21')]||null:null,'attributes':_0x336262[_0xed92('0x1f')]?_0x336262[_0xed92('0x1f')][_0xed92('0x22')]||null:null,'limit':_0x336262[_0xed92('0x1f')]?_0x336262['options'][_0xed92('0x23')]||null:null,'include':_0x336262[_0xed92('0x1f')]?_0x336262[_0xed92('0x1f')][_0xed92('0x24')]?_[_0xed92('0x25')](_0x336262[_0xed92('0x1f')][_0xed92('0x24')],function(_0x2ed5f2){return{'model':db[_0x2ed5f2[_0xed92('0x26')]],'as':_0x2ed5f2['as'],'attributes':_0x2ed5f2[_0xed92('0x22')],'include':_0x2ed5f2[_0xed92('0x24')]?_[_0xed92('0x25')](_0x2ed5f2[_0xed92('0x24')],function(_0xab4be1){return{'model':db[_0xab4be1['model']],'as':_0xab4be1['as'],'attributes':_0xab4be1['attributes'],'include':_0xab4be1[_0xed92('0x24')]?_['map'](_0xab4be1[_0xed92('0x24')],function(_0x43567b){return{'model':db[_0x43567b['model']],'as':_0x43567b['as'],'attributes':_0x43567b[_0xed92('0x22')]};}):[]};}):[]};}):[]:[]})[_0xed92('0x11')](function(_0x12f0df){logger[_0xed92('0x12')](_0xed92('0x1d'),_0x336262);logger[_0xed92('0x15')]('GetMailAccount',_0x336262,JSON[_0xed92('0x17')](_0x12f0df));_0x3e7337(_0x12f0df);})[_0xed92('0x1c')](function(_0x204bf6){logger[_0xed92('0x18')](_0xed92('0x1d'),_0x204bf6[_0xed92('0x1a')],_0x336262);_0x3663e0(_0x486876[_0xed92('0x18')](0x1f4,_0x204bf6[_0xed92('0x1a')]));});});};exports[_0xed92('0x27')]=function(_0x226a5e){var _0x5831f2=this;return new Promise(function(_0xdcdadc,_0x55582d){return db[_0xed92('0x1e')][_0xed92('0x28')]({'raw':_0x226a5e['options']?_0x226a5e[_0xed92('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x226a5e[_0xed92('0x1f')]?_0x226a5e[_0xed92('0x1f')][_0xed92('0x21')]||null:null,'attributes':_0x226a5e[_0xed92('0x1f')]?_0x226a5e[_0xed92('0x1f')][_0xed92('0x22')]||null:null,'include':_0x226a5e[_0xed92('0x1f')]?_0x226a5e[_0xed92('0x1f')][_0xed92('0x24')]?_[_0xed92('0x25')](_0x226a5e[_0xed92('0x1f')][_0xed92('0x24')],function(_0xd82cdd){return{'model':db[_0xd82cdd[_0xed92('0x26')]],'as':_0xd82cdd['as'],'attributes':_0xd82cdd[_0xed92('0x22')],'include':_0xd82cdd['include']?_[_0xed92('0x25')](_0xd82cdd['include'],function(_0x1c5cf7){return{'model':db[_0x1c5cf7[_0xed92('0x26')]],'as':_0x1c5cf7['as'],'attributes':_0x1c5cf7[_0xed92('0x22')],'include':_0x1c5cf7['include']?_[_0xed92('0x25')](_0x1c5cf7[_0xed92('0x24')],function(_0x134fb4){return{'model':db[_0x134fb4[_0xed92('0x26')]],'as':_0x134fb4['as'],'attributes':_0x134fb4[_0xed92('0x22')]};}):[]};}):[]};}):[]:[]})[_0xed92('0x11')](function(_0x246238){logger[_0xed92('0x12')]('ShowMailAccount',_0x226a5e);logger[_0xed92('0x15')](_0xed92('0x27'),_0x226a5e,JSON[_0xed92('0x17')](_0x246238));_0xdcdadc(_0x246238);})['catch'](function(_0x3acecd){logger['error'](_0xed92('0x27'),_0x3acecd['message'],_0x226a5e);_0x55582d(_0x5831f2['error'](0x1f4,_0x3acecd[_0xed92('0x1a')]));});});};exports[_0xed92('0x29')]=function(_0x4b7208){var _0x2bc702=this;return new Promise(function(_0x354017,_0x4d482c){var _0x35f5eb={'body':_0x4b7208[_0xed92('0x2a')],'channel':_0xed92('0x2b')};var _0x44400b=_[_0xed92('0x2c')](_[_0xed92('0x2d')](db[_0xed92('0x2e')]['rawAttributes']),[_0xed92('0x2f'),_0xed92('0x30'),_0xed92('0x31'),_0xed92('0x32')]);var _0x30fc4f=![];if(_0x4b7208[_0xed92('0x2a')]['id']){delete _0x4b7208[_0xed92('0x2a')]['id'];}if(_[_0xed92('0x33')](_0x4b7208[_0xed92('0x2a')][_0xed92('0x34')])){return _0x4d482c(_0x2bc702[_0xed92('0x18')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xed92('0x33')](_0x4b7208[_0xed92('0x2a')][_0xed92('0x2a')])||_0x4b7208['body']['body']===''){return _0x4d482c(_0x2bc702['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xed92('0x33')](_0x4b7208['body'][_0xed92('0x35')])){return _0x4d482c(_0x2bc702[_0xed92('0x18')](0x1f4,_0xed92('0x36')+_0x44400b));}if(!_[_0xed92('0x37')](_0x44400b,_0x4b7208[_0xed92('0x2a')][_0xed92('0x35')])){return _0x4d482c(_0x2bc702['error'](0x1f4,_0xed92('0x38')+_0x44400b));}var _0x2e8303={};_0x2e8303[_0x4b7208['body'][_0xed92('0x35')]]=_0x4b7208['body'][_0xed92('0x34')];return db[_0xed92('0x1e')][_0xed92('0x28')]({'where':{'id':_0x4b7208[_0xed92('0x39')]['id']},'include':[{'model':db[_0xed92('0x3a')],'as':_0xed92('0x3b'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x2e8303,'limit':0x1,'order':[['updatedAt',_0xed92('0x3c')]]}]},{'model':db[_0xed92('0x3d')],'as':_0xed92('0x3e')},{'model':db['MailServerOut'],'as':_0xed92('0x3f')}]})[_0xed92('0x11')](function(_0x9dcae8){if(_0x9dcae8&&_0x9dcae8[_0xed92('0x3b')]){var _0x31cc2c=_0x9dcae8[_0xed92('0x40')]({'plain':!![]});_0x35f5eb['account']=_['omit'](_0x31cc2c,[_0xed92('0x3e'),_0xed92('0x3b')]);_0x35f5eb[_0xed92('0x41')]=_0x31cc2c[_0xed92('0x3e')];_0x35f5eb[_0xed92('0x42')]=_0x31cc2c['List'];_0x35f5eb[_0xed92('0x41')]=_[_0xed92('0x43')](_0x35f5eb[_0xed92('0x41')],[_0xed92('0x44')],[_0xed92('0x45')]);if(_0x35f5eb[_0xed92('0x39')]&&_0x35f5eb[_0xed92('0x39')]['autoclose']){_0x35f5eb['applications'][_0xed92('0x46')]({'id':0x0,'priority':_0x35f5eb['applications'][_0xed92('0x47')]+0x1,'app':_0xed92('0x48'),'appdata':'autoclose','interval':_0xed92('0x49')});}if(_0x35f5eb[_0xed92('0x39')][_0xed92('0x3e')]){delete _0x35f5eb[_0xed92('0x39')][_0xed92('0x3e')];}if(_0x35f5eb[_0xed92('0x39')]['List']){delete _0x35f5eb[_0xed92('0x39')][_0xed92('0x3b')];}if(_0x31cc2c['List'][_0xed92('0x4a')][_0xed92('0x47')]){return _0x31cc2c[_0xed92('0x3b')]['Contacts'][0x0];}var _0x5950a8=_[_0xed92('0x4b')](_0x4b7208['body'],{'firstName':_0x4b7208[_0xed92('0x2a')][_0xed92('0x34')],'ListId':_0x31cc2c[_0xed92('0x32')]});_0x5950a8[_0x4b7208['body'][_0xed92('0x35')]]=_0x4b7208[_0xed92('0x2a')][_0xed92('0x34')];return db['CmContact']['create'](_0x5950a8);}else{throw new Error(_0xed92('0x4c'));}})['then'](function(_0x50db7a){_0x35f5eb[_0xed92('0x4d')]=_0x50db7a;if(_0x50db7a){if(!_0x4b7208['body'][_0xed92('0x1a')][_0xed92('0x4e')]){_0x4b7208[_0xed92('0x2a')][_0xed92('0x1a')][_0xed92('0x4e')]=rs[_0xed92('0x4f')]()+'\x20'+_0x4b7208[_0xed92('0x2a')][_0xed92('0x1a')][_0xed92('0x34')];}var _0x3ddda1={'ContactId':_0x50db7a['id'],'MailAccountId':_0x4b7208[_0xed92('0x39')]['id'],'inReplyTo':_0x4b7208[_0xed92('0x2a')][_0xed92('0x1a')][_0xed92('0x4e')],'to':_0x4b7208['body'][_0xed92('0x1a')][_0xed92('0x34')],'cc':_0x4b7208[_0xed92('0x2a')]['message']['cc'],'subject':_0x4b7208[_0xed92('0x2a')][_0xed92('0x1a')][_0xed92('0x50')],'attach':_0x4b7208['body'][_0xed92('0x1a')]['attach'],'lastMsgAt':moment()[_0xed92('0x51')](_0xed92('0x52')),'lastMsgDirection':'in'};return db[_0xed92('0x53')]['find']({'where':{'closed':![],'MailAccountId':_0x4b7208[_0xed92('0x39')]['id']},'include':[{'model':db[_0xed92('0x54')],'as':_0xed92('0x55'),'attributes':['messageId'],'where':{'messageId':_0x4b7208[_0xed92('0x2a')][_0xed92('0x1a')][_0xed92('0x56')]}}]})[_0xed92('0x11')](function(_0x1c2949){if(_0x1c2949){return[_0x1c2949,![]];}return db[_0xed92('0x53')][_0xed92('0x57')](_0x3ddda1)[_0xed92('0x11')](function(_0x2c1e9f){return[_0x2c1e9f,!![]];});});}else{throw new Error(_0xed92('0x58'));}})[_0xed92('0x59')](function(_0x177d07,_0x22218d){if(_0x177d07){_0x30fc4f=_0x22218d;if(!_0x22218d){return _0x177d07[_0xed92('0x5a')]({'inReplyTo':_0x4b7208[_0xed92('0x2a')][_0xed92('0x1a')][_0xed92('0x4e')],'to':_0x4b7208['body']['message']['from'],'cc':_0x4b7208[_0xed92('0x2a')]['message']['cc'],'subject':_0x4b7208[_0xed92('0x2a')][_0xed92('0x1a')]['subject'],'attach':_0x177d07[_0xed92('0x5b')]?_0x177d07[_0xed92('0x5b')]:_0x4b7208[_0xed92('0x2a')][_0xed92('0x1a')][_0xed92('0x5b')],'substatus':null,'substatusAt':moment()[_0xed92('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0xed92('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x177d07;}}})['then'](function(_0xb2e072){_0x35f5eb[_0xed92('0x5c')]=_0xb2e072[_0xed92('0x40')]({'plain':!![]});_0x35f5eb[_0xed92('0x5c')][_0xed92('0x5d')]=_0x30fc4f;return db[_0xed92('0x54')]['create']({'body':_0x4b7208[_0xed92('0x2a')]['body'],'MailAccountId':_0x4b7208[_0xed92('0x39')]['id'],'MailInteractionId':_0xb2e072['id'],'direction':'in','ContactId':_0x35f5eb['contact']['id'],'messageId':_0x4b7208[_0xed92('0x2a')][_0xed92('0x1a')][_0xed92('0x4e')],'from':_0x4b7208[_0xed92('0x2a')][_0xed92('0x1a')][_0xed92('0x34')],'to':_0x4b7208[_0xed92('0x2a')][_0xed92('0x1a')]['to'],'cc':_0x4b7208['body'][_0xed92('0x1a')]['cc'],'subject':_0x4b7208[_0xed92('0x2a')][_0xed92('0x1a')][_0xed92('0x50')],'attach':_0x4b7208[_0xed92('0x2a')]['message']['attach'],'Attachments':_0x4b7208[_0xed92('0x2a')][_0xed92('0x1a')][_0xed92('0x5e')],'originTo':_0x4b7208[_0xed92('0x2a')][_0xed92('0x1a')][_0xed92('0x5f')],'originCc':_0x4b7208[_0xed92('0x2a')]['message'][_0xed92('0x60')],'bcc':_0x4b7208[_0xed92('0x2a')]['message'][_0xed92('0x61')],'ChatWebsiteId':_0x4b7208[_0xed92('0x2a')][_0xed92('0x1a')][_0xed92('0x62')]||null,'originChannel':_0x4b7208['body'][_0xed92('0x1a')][_0xed92('0x63')]||_0xed92('0x64'),'ChatOfflineMessageId':_0x4b7208['body'][_0xed92('0x1a')][_0xed92('0x65')]||null},{'include':[{'model':db['Attachment'],'as':_0xed92('0x66')}]});})['then'](function(_0x42504c){_0x35f5eb[_0xed92('0x1a')]=_0x42504c;if(_0x35f5eb[_0xed92('0x5c')][_0xed92('0x67')]){return db['User'][_0xed92('0x28')]({'attributes':['id',_0xed92('0x68')],'where':{'id':_0x35f5eb[_0xed92('0x5c')][_0xed92('0x67')]}})[_0xed92('0x11')](function(_0x1c4e33){if(_0x1c4e33){_0x35f5eb[_0xed92('0x41')][_0xed92('0x69')]({'id':0x0,'priority':0x0,'app':_0xed92('0x6a'),'appdata':_0x1c4e33['name']+','+(_0x35f5eb['account'][_0xed92('0x6b')]||0xa),'interval':_0xed92('0x49')});}return respondWithRpcPromise('Start',_0xed92('0x6c'),_0x35f5eb);});}return respondWithRpcPromise(_0xed92('0x6d'),_0xed92('0x6c'),_0x35f5eb);})['then'](function(_0x556610){_0x354017(_0x556610);})[_0xed92('0x1c')](function(_0x2b3cd5){_0x4d482c(_0x2bc702[_0xed92('0x18')](0x1f4,_0x2b3cd5[_0xed92('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 618b0a7..2f490fe 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 _0x016d=['save','remove','update','removeListener','length','mailAccount:','./mailAccount.events'];(function(_0x5fddc0,_0x5e12a6){var _0x3c61bd=function(_0x15c7da){while(--_0x15c7da){_0x5fddc0['push'](_0x5fddc0['shift']());}};_0x3c61bd(++_0x5e12a6);}(_0x016d,0x102));var _0xd016=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x016d[_0x20a584];return _0x4b41a8;};'use strict';var MailAccountEvents=require(_0xd016('0x0'));var events=[_0xd016('0x1'),_0xd016('0x2'),_0xd016('0x3')];function createListener(_0x3c85a4,_0x1868a2){return function(_0x34eb8b){_0x1868a2['emit'](_0x3c85a4,_0x34eb8b);};}function removeListener(_0x349f6,_0x30421e){return function(){MailAccountEvents[_0xd016('0x4')](_0x349f6,_0x30421e);};}exports['register']=function(_0x22f403){for(var _0x311de6=0x0,_0x16d5b4=events[_0xd016('0x5')];_0x311de6<_0x16d5b4;_0x311de6++){var _0x5ed161=events[_0x311de6];var _0x44b23=createListener(_0xd016('0x6')+_0x5ed161,_0x22f403);MailAccountEvents['on'](_0x5ed161,_0x44b23);}}; \ No newline at end of file +var _0x37c8=['./mailAccount.events','save','remove','emit','removeListener','length','mailAccount:'];(function(_0x48f735,_0x509dd4){var _0x5da176=function(_0x4fa701){while(--_0x4fa701){_0x48f735['push'](_0x48f735['shift']());}};_0x5da176(++_0x509dd4);}(_0x37c8,0x69));var _0x837c=function(_0x54b062,_0x264bb5){_0x54b062=_0x54b062-0x0;var _0x255e41=_0x37c8[_0x54b062];return _0x255e41;};'use strict';var MailAccountEvents=require(_0x837c('0x0'));var events=[_0x837c('0x1'),_0x837c('0x2'),'update'];function createListener(_0x4111bc,_0x408132){return function(_0x2394b4){_0x408132[_0x837c('0x3')](_0x4111bc,_0x2394b4);};}function removeListener(_0x2a0a37,_0x496179){return function(){MailAccountEvents[_0x837c('0x4')](_0x2a0a37,_0x496179);};}exports['register']=function(_0x2a94db){for(var _0x686873=0x0,_0x6562bf=events[_0x837c('0x5')];_0x686873<_0x6562bf;_0x686873++){var _0x2571c6=events[_0x686873];var _0x17bebf=createListener(_0x837c('0x6')+_0x2571c6,_0x2a94db);MailAccountEvents['on'](_0x2571c6,_0x17bebf);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 486c88a..055acf5 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 _0x2880=['../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','/:id','isAuthenticated','show','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x28627d,_0x1cf161){var _0xc5f080=function(_0x303e6f){while(--_0x303e6f){_0x28627d['push'](_0x28627d['shift']());}};_0xc5f080(++_0x1cf161);}(_0x2880,0x12c));var _0x0288=function(_0x99c1d,_0xd84019){_0x99c1d=_0x99c1d-0x0;var _0xee54b2=_0x2880[_0x99c1d];return _0xee54b2;};'use strict';var multer=require(_0x0288('0x0'));var util=require(_0x0288('0x1'));var path=require(_0x0288('0x2'));var timeout=require(_0x0288('0x3'));var express=require(_0x0288('0x4'));var router=express['Router']();var fs_extra=require(_0x0288('0x5'));var auth=require(_0x0288('0x6'));var interaction=require(_0x0288('0x7'));var config=require('../../config/environment');var controller=require(_0x0288('0x8'));router[_0x0288('0x9')](_0x0288('0xa'),auth[_0x0288('0xb')](),controller[_0x0288('0xc')]);router['put'](_0x0288('0xa'),auth[_0x0288('0xb')](),controller[_0x0288('0xd')]);router[_0x0288('0xe')]('/:id',auth[_0x0288('0xb')](),controller[_0x0288('0xf')]);module[_0x0288('0x10')]=router; \ No newline at end of file +var _0x06dd=['./mailApplication.controller','isAuthenticated','show','put','/:id','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x50b050,_0x5ded51){var _0x150e0d=function(_0x296188){while(--_0x296188){_0x50b050['push'](_0x50b050['shift']());}};_0x150e0d(++_0x5ded51);}(_0x06dd,0x77));var _0xd06d=function(_0x4cfc0f,_0xe1ba14){_0x4cfc0f=_0x4cfc0f-0x0;var _0x1d2916=_0x06dd[_0x4cfc0f];return _0x1d2916;};'use strict';var multer=require(_0xd06d('0x0'));var util=require('util');var path=require(_0xd06d('0x1'));var timeout=require(_0xd06d('0x2'));var express=require(_0xd06d('0x3'));var router=express[_0xd06d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd06d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd06d('0x6'));var controller=require(_0xd06d('0x7'));router['get']('/:id',auth[_0xd06d('0x8')](),controller[_0xd06d('0x9')]);router[_0xd06d('0xa')](_0xd06d('0xb'),auth[_0xd06d('0x8')](),controller['update']);router[_0xd06d('0xc')]('/:id',auth[_0xd06d('0x8')](),controller[_0xd06d('0xd')]);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 707289a..3dedcd9 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 _0x77a4=['TEXT','*,*,*,*','sequelize','STRING','noop'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x77a4,0x151));var _0x477a=function(_0xa2c0a3,_0x5bbac0){_0xa2c0a3=_0xa2c0a3-0x0;var _0x52c618=_0x77a4[_0xa2c0a3];return _0x52c618;};'use strict';var Sequelize=require(_0x477a('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x477a('0x1')],'allowNull':![],'defaultValue':_0x477a('0x2')},'appdata':{'type':Sequelize[_0x477a('0x3')]()},'description':{'type':Sequelize[_0x477a('0x1')]},'interval':{'type':Sequelize[_0x477a('0x1')],'defaultValue':_0x477a('0x4')}}; \ No newline at end of file +var _0xa90e=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x361162,_0x348e7a){var _0x58f3b0=function(_0x49de6c){while(--_0x49de6c){_0x361162['push'](_0x361162['shift']());}};_0x58f3b0(++_0x348e7a);}(_0xa90e,0xc5));var _0xea90=function(_0x5c489b,_0x4871b9){_0x5c489b=_0x5c489b-0x0;var _0x53a9c9=_0xa90e[_0x5c489b];return _0x53a9c9;};'use strict';var Sequelize=require(_0xea90('0x0'));module['exports']={'priority':{'type':Sequelize[_0xea90('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xea90('0x2')],'allowNull':![],'defaultValue':_0xea90('0x3')},'appdata':{'type':Sequelize[_0xea90('0x4')]()},'description':{'type':Sequelize[_0xea90('0x2')]},'interval':{'type':Sequelize[_0xea90('0x2')],'defaultValue':_0xea90('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 9344e6a..393e38e 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf4eb=['limit','count','Content-Range','json','apply','reject','save','then','destroy','error','name','send','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','include','options','find','catch','body','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0x44c3f2,_0x3e0d4d){var _0x5206d0=function(_0x3c4828){while(--_0x3c4828){_0x44c3f2['push'](_0x44c3f2['shift']());}};_0x5206d0(++_0x3e0d4d);}(_0xf4eb,0xec));var _0xbf4e=function(_0x4f16af,_0x223338){_0x4f16af=_0x4f16af-0x0;var _0x43ff01=_0xf4eb[_0x4f16af];return _0x43ff01;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){_0x51648c[_0xbf4e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x90635e,_0x36688a){return function(_0x3d6863){if(!_0x3d6863){_0x90635e['sendStatus'](0x194);}return _0x3d6863;};}function handleError(_0x2fb490,_0x5e08b1){_0x5e08b1=_0x5e08b1||0x1f4;return function(_0x5bcf71){logger[_0xbf4e('0x21')](_0x5bcf71['stack']);if(_0x5bcf71[_0xbf4e('0x22')]){delete _0x5bcf71[_0xbf4e('0x22')];}_0x2fb490[_0xbf4e('0x14')](_0x5e08b1)[_0xbf4e('0x23')](_0x5bcf71);};}exports['show']=function(_0x2d4686,_0x8e0ab5){var _0x43879d={'raw':!![],'where':{'id':_0x2d4686[_0xbf4e('0x24')]['id']}},_0x4cd4a1={};_0x4cd4a1['model']=_[_0xbf4e('0x25')](db[_0xbf4e('0x26')][_0xbf4e('0x27')]);_0x4cd4a1['query']=_[_0xbf4e('0x25')](_0x2d4686[_0xbf4e('0x28')]);_0x4cd4a1[_0xbf4e('0x29')]=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],_0x4cd4a1[_0xbf4e('0x28')]);_0x43879d['attributes']=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],qs['fields'](_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2c')]));_0x43879d['attributes']=_0x43879d[_0xbf4e('0x2d')]['length']?_0x43879d[_0xbf4e('0x2d')]:_0x4cd4a1['model'];if(_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2e')]){_0x43879d[_0xbf4e('0x2f')]=[{'all':!![]}];}_0x43879d=_['merge']({},_0x43879d,_0x2d4686[_0xbf4e('0x30')]);return db[_0xbf4e('0x26')][_0xbf4e('0x31')](_0x43879d)[_0xbf4e('0x1f')](handleEntityNotFound(_0x8e0ab5,null))[_0xbf4e('0x1f')](respondWithResult(_0x8e0ab5,null))[_0xbf4e('0x32')](handleError(_0x8e0ab5,null));};exports['update']=function(_0x99b320,_0x3dbb2b){if(_0x99b320[_0xbf4e('0x33')]['id']){delete _0x99b320[_0xbf4e('0x33')]['id'];}return db[_0xbf4e('0x26')]['find']({'where':{'id':_0x99b320['params']['id']}})['then'](handleEntityNotFound(_0x3dbb2b,null))['then'](saveUpdates(_0x99b320[_0xbf4e('0x33')],null))[_0xbf4e('0x1f')](respondWithResult(_0x3dbb2b,null))[_0xbf4e('0x32')](handleError(_0x3dbb2b,null));};exports[_0xbf4e('0x20')]=function(_0x22ddde,_0x257b74){return db[_0xbf4e('0x26')][_0xbf4e('0x31')]({'where':{'id':_0x22ddde[_0xbf4e('0x24')]['id']}})['then'](handleEntityNotFound(_0x257b74,null))['then'](removeEntity(_0x257b74,null))[_0xbf4e('0x32')](handleError(_0x257b74,null));}; \ No newline at end of file +var _0xda3f=['includeAll','include','merge','find','catch','body','MailApplication','destroy','rimraf','zip-dir','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','end','stack','name','send','params','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0x283d2f,_0x201c63){var _0x193cd2=function(_0x158f61){while(--_0x158f61){_0x283d2f['push'](_0x283d2f['shift']());}};_0x193cd2(++_0x201c63);}(_0xda3f,0xec));var _0xfda3=function(_0x1b2e83,_0x1ccd55){_0x1b2e83=_0x1b2e83-0x0;var _0x569498=_0xda3f[_0x1b2e83];return _0x569498;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfda3('0x0'));var zipdir=require(_0xfda3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfda3('0x2'));var Mustache=require('mustache');var util=require(_0xfda3('0x3'));var path=require(_0xfda3('0x4'));var sox=require('sox');var csv=require(_0xfda3('0x5'));var ejs=require(_0xfda3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x5'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var Redis=require(_0xfda3('0xd'));var authService=require(_0xfda3('0xe'));var qs=require(_0xfda3('0xf'));var as=require(_0xfda3('0x10'));var hardwareService=require(_0xfda3('0x11'));var logger=require('../../config/logger')(_0xfda3('0x12'));var utils=require(_0xfda3('0x13'));var config=require(_0xfda3('0x14'));var licenseUtil=require(_0xfda3('0x15'));var db=require(_0xfda3('0x16'))['db'];function respondWithStatusCode(_0x4b77ea,_0x583125){_0x583125=_0x583125||0xcc;return function(_0x5d7d5b){if(_0x5d7d5b){return _0x4b77ea[_0xfda3('0x17')](_0x583125);}return _0x4b77ea[_0xfda3('0x18')](_0x583125)['end']();};}function respondWithResult(_0x501588,_0x587e9b){_0x587e9b=_0x587e9b||0xc8;return function(_0x227d72){if(_0x227d72){return _0x501588[_0xfda3('0x18')](_0x587e9b)['json'](_0x227d72);}};}function respondWithFilteredResult(_0x57a229,_0x533365){return function(_0x80ea80){if(_0x80ea80){var _0x474707=typeof _0x533365[_0xfda3('0x19')]===_0xfda3('0x1a')&&typeof _0x533365[_0xfda3('0x1b')]===_0xfda3('0x1a');var _0x2aadcb=_0x80ea80[_0xfda3('0x1c')];var _0x4680bf=_0x474707?0x0:_0x533365[_0xfda3('0x19')];var _0x54a7c6=_0x474707?_0x80ea80[_0xfda3('0x1c')]:_0x533365[_0xfda3('0x19')]+_0x533365[_0xfda3('0x1b')];var _0x32855a;if(_0x54a7c6>=_0x2aadcb){_0x54a7c6=_0x2aadcb;_0x32855a=0xc8;}else{_0x32855a=0xce;}_0x57a229['status'](_0x32855a);return _0x57a229[_0xfda3('0x1d')](_0xfda3('0x1e'),_0x4680bf+'-'+_0x54a7c6+'/'+_0x2aadcb)[_0xfda3('0x1f')](_0x80ea80);}return null;};}function patchUpdates(_0x51e731){return function(_0x5ad52a){try{jsonpatch[_0xfda3('0x20')](_0x5ad52a,_0x51e731,!![]);}catch(_0x38d428){return BPromise[_0xfda3('0x21')](_0x38d428);}return _0x5ad52a['save']();};}function saveUpdates(_0x3cf5a9,_0xef2535){return function(_0x1e15a8){if(_0x1e15a8){return _0x1e15a8[_0xfda3('0x22')](_0x3cf5a9)[_0xfda3('0x23')](function(_0x2b84b7){return _0x2b84b7;});}return null;};}function removeEntity(_0x2677f6,_0xc6fb9a){return function(_0x16eaa6){if(_0x16eaa6){return _0x16eaa6['destroy']()[_0xfda3('0x23')](function(){_0x2677f6[_0xfda3('0x18')](0xcc)[_0xfda3('0x24')]();});}};}function handleEntityNotFound(_0x4ae9b9,_0x45a977){return function(_0x39e246){if(!_0x39e246){_0x4ae9b9[_0xfda3('0x17')](0x194);}return _0x39e246;};}function handleError(_0x38946d,_0x1cb831){_0x1cb831=_0x1cb831||0x1f4;return function(_0xad9f7b){logger['error'](_0xad9f7b[_0xfda3('0x25')]);if(_0xad9f7b[_0xfda3('0x26')]){delete _0xad9f7b[_0xfda3('0x26')];}_0x38946d[_0xfda3('0x18')](_0x1cb831)[_0xfda3('0x27')](_0xad9f7b);};}exports['show']=function(_0x3c1549,_0x4101b1){var _0x301509={'raw':!![],'where':{'id':_0x3c1549[_0xfda3('0x28')]['id']}},_0x474992={};_0x474992[_0xfda3('0x29')]=_[_0xfda3('0x2a')](db['MailApplication']['rawAttributes']);_0x474992[_0xfda3('0x2b')]=_['keys'](_0x3c1549['query']);_0x474992[_0xfda3('0x2c')]=_[_0xfda3('0x2d')](_0x474992[_0xfda3('0x29')],_0x474992[_0xfda3('0x2b')]);_0x301509[_0xfda3('0x2e')]=_[_0xfda3('0x2d')](_0x474992[_0xfda3('0x29')],qs[_0xfda3('0x2f')](_0x3c1549[_0xfda3('0x2b')]['fields']));_0x301509[_0xfda3('0x2e')]=_0x301509[_0xfda3('0x2e')][_0xfda3('0x30')]?_0x301509[_0xfda3('0x2e')]:_0x474992[_0xfda3('0x29')];if(_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x31')]){_0x301509[_0xfda3('0x32')]=[{'all':!![]}];}_0x301509=_[_0xfda3('0x33')]({},_0x301509,_0x3c1549['options']);return db['MailApplication'][_0xfda3('0x34')](_0x301509)[_0xfda3('0x23')](handleEntityNotFound(_0x4101b1,null))['then'](respondWithResult(_0x4101b1,null))[_0xfda3('0x35')](handleError(_0x4101b1,null));};exports[_0xfda3('0x22')]=function(_0x28ca96,_0x52ee98){if(_0x28ca96[_0xfda3('0x36')]['id']){delete _0x28ca96[_0xfda3('0x36')]['id'];}return db[_0xfda3('0x37')][_0xfda3('0x34')]({'where':{'id':_0x28ca96[_0xfda3('0x28')]['id']}})['then'](handleEntityNotFound(_0x52ee98,null))[_0xfda3('0x23')](saveUpdates(_0x28ca96[_0xfda3('0x36')],null))[_0xfda3('0x23')](respondWithResult(_0x52ee98,null))['catch'](handleError(_0x52ee98,null));};exports[_0xfda3('0x38')]=function(_0x4854b1,_0x2d9a3f){return db[_0xfda3('0x37')][_0xfda3('0x34')]({'where':{'id':_0x4854b1[_0xfda3('0x28')]['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x2d9a3f,null))[_0xfda3('0x23')](removeEntity(_0x2d9a3f,null))[_0xfda3('0x35')](handleError(_0x2d9a3f,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 1da3431..4d1fc49 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 _0xf226=['./mailApplication.attributes','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x533b3a,_0x170ced){var _0x14d3c5=function(_0x1ceec9){while(--_0x1ceec9){_0x533b3a['push'](_0x533b3a['shift']());}};_0x14d3c5(++_0x170ced);}(_0xf226,0xad));var _0x6f22=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf226[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6f22('0x0'));var util=require(_0x6f22('0x1'));var logger=require(_0x6f22('0x2'))(_0x6f22('0x3'));var moment=require(_0x6f22('0x4'));var BPromise=require(_0x6f22('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f22('0x6'));var rimraf=require(_0x6f22('0x7'));var config=require(_0x6f22('0x8'));var attributes=require(_0x6f22('0x9'));module['exports']=function(_0x277d72,_0x3480b0){return _0x277d72['define'](_0x6f22('0xa'),attributes,{'tableName':_0x6f22('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6f22('0xc'),'collate':_0x6f22('0xd')});}; \ No newline at end of file +var _0x19e2=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailApplication.attributes','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x5e1158,_0x5d520c){var _0x437f1b=function(_0x4699d4){while(--_0x4699d4){_0x5e1158['push'](_0x5e1158['shift']());}};_0x437f1b(++_0x5d520c);}(_0x19e2,0xed));var _0x219e=function(_0x340833,_0x3a9dda){_0x340833=_0x340833-0x0;var _0x281747=_0x19e2[_0x340833];return _0x281747;};'use strict';var _=require(_0x219e('0x0'));var util=require('util');var logger=require(_0x219e('0x1'))(_0x219e('0x2'));var moment=require(_0x219e('0x3'));var BPromise=require(_0x219e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x219e('0x5'));var rimraf=require(_0x219e('0x6'));var config=require(_0x219e('0x7'));var attributes=require(_0x219e('0x8'));module['exports']=function(_0x1bb781,_0x4d8e17){return _0x1bb781[_0x219e('0x9')](_0x219e('0xa'),attributes,{'tableName':_0x219e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x219e('0xc'),'collate':_0x219e('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 243950b..3727289 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 _0x5e3e=['MailApplication','update','options','where','limit','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateMailApplication'];(function(_0x471f5a,_0x4e62fb){var _0x5d9624=function(_0x389aba){while(--_0x389aba){_0x471f5a['push'](_0x471f5a['shift']());}};_0x5d9624(++_0x4e62fb);}(_0x5e3e,0x132));var _0xe5e3=function(_0xfbb0ce,_0x1579f9){_0xfbb0ce=_0xfbb0ce-0x0;var _0xc7cf13=_0x5e3e[_0xfbb0ce];return _0xc7cf13;};'use strict';var _=require(_0xe5e3('0x0'));var util=require('util');var moment=require(_0xe5e3('0x1'));var BPromise=require(_0xe5e3('0x2'));var rs=require(_0xe5e3('0x3'));var fs=require('fs');var Redis=require(_0xe5e3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe5e3('0x5'));var logger=require('../../config/logger')(_0xe5e3('0x6'));var config=require(_0xe5e3('0x7'));var jayson=require(_0xe5e3('0x8'));var client=jayson[_0xe5e3('0x9')][_0xe5e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9a9fe6,_0x1b172f,_0x2f6b6e){return new BPromise(function(_0xb60b09,_0x58d6c0){return client[_0xe5e3('0xb')](_0x9a9fe6,_0x2f6b6e)[_0xe5e3('0xc')](function(_0x11427c){logger['info'](_0xe5e3('0xd'),_0x1b172f,_0xe5e3('0xe'));logger[_0xe5e3('0xf')](_0xe5e3('0x10'),_0x1b172f,'request\x20sent',JSON[_0xe5e3('0x11')](_0x11427c));if(_0x11427c[_0xe5e3('0x12')]){if(_0x11427c['error'][_0xe5e3('0x13')]===0x1f4){logger['error'](_0xe5e3('0xd'),_0x1b172f,_0x11427c['error'][_0xe5e3('0x14')]);return _0x58d6c0(_0x11427c[_0xe5e3('0x12')][_0xe5e3('0x14')]);}logger[_0xe5e3('0x12')](_0xe5e3('0xd'),_0x1b172f,_0x11427c[_0xe5e3('0x12')][_0xe5e3('0x14')]);return _0xb60b09(_0x11427c[_0xe5e3('0x12')][_0xe5e3('0x14')]);}else{logger[_0xe5e3('0x15')]('MailApplication,\x20%s,\x20%s',_0x1b172f,_0xe5e3('0xe'));_0xb60b09(_0x11427c[_0xe5e3('0x16')][_0xe5e3('0x14')]);}})['catch'](function(_0x531b3b){logger['error'](_0xe5e3('0xd'),_0x1b172f,_0x531b3b);_0x58d6c0(_0x531b3b);});});}exports[_0xe5e3('0x17')]=function(_0x21973f){var _0x30498=this;return new Promise(function(_0x5d1dbb,_0x34f6f9){return db[_0xe5e3('0x18')][_0xe5e3('0x19')](_0x21973f['body'],{'raw':_0x21973f[_0xe5e3('0x1a')]?_0x21973f[_0xe5e3('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21973f[_0xe5e3('0x1a')]?_0x21973f[_0xe5e3('0x1a')][_0xe5e3('0x1b')]||null:null,'attributes':_0x21973f['options']?_0x21973f['options']['attributes']||null:null,'limit':_0x21973f['options']?_0x21973f[_0xe5e3('0x1a')][_0xe5e3('0x1c')]||null:null})['then'](function(_0x48f7db){logger['info'](_0xe5e3('0x17'),_0x21973f);logger['debug'](_0xe5e3('0x17'),_0x21973f,JSON[_0xe5e3('0x11')](_0x48f7db));_0x5d1dbb(_0x48f7db);})[_0xe5e3('0x1d')](function(_0x33d1b3){logger[_0xe5e3('0x12')](_0xe5e3('0x17'),_0x33d1b3[_0xe5e3('0x14')],_0x21973f);_0x34f6f9(_0x30498[_0xe5e3('0x12')](0x1f4,_0x33d1b3[_0xe5e3('0x14')]));});});}; \ No newline at end of file +var _0x4a8a=['MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','catch','UpdateMailApplication','MailApplication','body','options','raw','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','MailApplication,\x20%s,\x20%s','debug'];(function(_0x4453e3,_0xe3cacc){var _0x3bc69e=function(_0x4ca4d8){while(--_0x4ca4d8){_0x4453e3['push'](_0x4453e3['shift']());}};_0x3bc69e(++_0xe3cacc);}(_0x4a8a,0xf6));var _0xa4a8=function(_0x2ec2bf,_0x64e983){_0x2ec2bf=_0x2ec2bf-0x0;var _0x2c279c=_0x4a8a[_0x2ec2bf];return _0x2c279c;};'use strict';var _=require(_0xa4a8('0x0'));var util=require(_0xa4a8('0x1'));var moment=require(_0xa4a8('0x2'));var BPromise=require(_0xa4a8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa4a8('0x4'));var db=require(_0xa4a8('0x5'))['db'];var utils=require(_0xa4a8('0x6'));var logger=require(_0xa4a8('0x7'))(_0xa4a8('0x8'));var config=require('../../config/environment');var jayson=require(_0xa4a8('0x9'));var client=jayson['client'][_0xa4a8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42e59f,_0x2fcb89,_0xeee7c5){return new BPromise(function(_0x33a4ee,_0xf9c771){return client[_0xa4a8('0xb')](_0x42e59f,_0xeee7c5)[_0xa4a8('0xc')](function(_0xa3e89c){logger['info'](_0xa4a8('0xd'),_0x2fcb89,'request\x20sent');logger[_0xa4a8('0xe')](_0xa4a8('0xf'),_0x2fcb89,_0xa4a8('0x10'),JSON[_0xa4a8('0x11')](_0xa3e89c));if(_0xa3e89c['error']){if(_0xa3e89c['error'][_0xa4a8('0x12')]===0x1f4){logger[_0xa4a8('0x13')](_0xa4a8('0xd'),_0x2fcb89,_0xa3e89c[_0xa4a8('0x13')]['message']);return _0xf9c771(_0xa3e89c[_0xa4a8('0x13')][_0xa4a8('0x14')]);}logger[_0xa4a8('0x13')]('MailApplication,\x20%s,\x20%s',_0x2fcb89,_0xa3e89c[_0xa4a8('0x13')][_0xa4a8('0x14')]);return _0x33a4ee(_0xa3e89c[_0xa4a8('0x13')]['message']);}else{logger[_0xa4a8('0x15')](_0xa4a8('0xd'),_0x2fcb89,'request\x20sent');_0x33a4ee(_0xa3e89c['result']['message']);}})[_0xa4a8('0x16')](function(_0x246c15){logger[_0xa4a8('0x13')](_0xa4a8('0xd'),_0x2fcb89,_0x246c15);_0xf9c771(_0x246c15);});});}exports[_0xa4a8('0x17')]=function(_0x3d3cce){var _0x37c0a4=this;return new Promise(function(_0x117953,_0x1f6991){return db[_0xa4a8('0x18')]['update'](_0x3d3cce[_0xa4a8('0x19')],{'raw':_0x3d3cce[_0xa4a8('0x1a')]?_0x3d3cce['options'][_0xa4a8('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d3cce['options']?_0x3d3cce[_0xa4a8('0x1a')]['where']||null:null,'attributes':_0x3d3cce[_0xa4a8('0x1a')]?_0x3d3cce[_0xa4a8('0x1a')]['attributes']||null:null,'limit':_0x3d3cce['options']?_0x3d3cce[_0xa4a8('0x1a')][_0xa4a8('0x1c')]||null:null})['then'](function(_0x1e5627){logger[_0xa4a8('0x15')](_0xa4a8('0x17'),_0x3d3cce);logger[_0xa4a8('0xe')](_0xa4a8('0x17'),_0x3d3cce,JSON['stringify'](_0x1e5627));_0x117953(_0x1e5627);})[_0xa4a8('0x16')](function(_0x4d2641){logger['error'](_0xa4a8('0x17'),_0x4d2641['message'],_0x3d3cce);_0x1f6991(_0x37c0a4[_0xa4a8('0x13')](0x1f4,_0x4d2641['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 21f9266..a7094bf 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 _0x385a=['./mailInteraction.controller','get','isAuthenticated','/describe','/:id','/:id/messages','getMessages','post','create','mail','mailinteraction:addtags','addTags','put','tracked','mailinteraction:update','update','delete','mailinteraction:destroy','removeTags','exports','express'];(function(_0x5e4d03,_0xa0dff7){var _0x565d48=function(_0x484892){while(--_0x484892){_0x5e4d03['push'](_0x5e4d03['shift']());}};_0x565d48(++_0xa0dff7);}(_0x385a,0x125));var _0xa385=function(_0x3a8bab,_0x19380e){_0x3a8bab=_0x3a8bab-0x0;var _0x264667=_0x385a[_0x3a8bab];return _0x264667;};'use strict';var express=require(_0xa385('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var controller=require(_0xa385('0x1'));router[_0xa385('0x2')]('/',auth[_0xa385('0x3')](),controller['index']);router['get'](_0xa385('0x4'),auth[_0xa385('0x3')](),controller['describe']);router[_0xa385('0x2')](_0xa385('0x5'),auth[_0xa385('0x3')](),controller['show']);router[_0xa385('0x2')](_0xa385('0x6'),auth[_0xa385('0x3')](),controller[_0xa385('0x7')]);router[_0xa385('0x2')]('/:id/download',auth[_0xa385('0x3')](),controller['download']);router[_0xa385('0x8')]('/',auth[_0xa385('0x3')](),controller[_0xa385('0x9')]);router['post'](_0xa385('0x6'),auth[_0xa385('0x3')](),controller['addMessage']);router[_0xa385('0x8')]('/:id/tags',auth['isAuthenticated'](),interaction['tracked'](_0xa385('0xa'),_0xa385('0xb')),controller[_0xa385('0xc')]);router[_0xa385('0xd')](_0xa385('0x5'),auth[_0xa385('0x3')](),interaction[_0xa385('0xe')]('mail',_0xa385('0xf')),controller[_0xa385('0x10')]);router[_0xa385('0x11')](_0xa385('0x5'),auth[_0xa385('0x3')](),interaction[_0xa385('0xe')](_0xa385('0xa'),_0xa385('0x12')),controller['destroy']);router[_0xa385('0x11')]('/:id/tags',auth[_0xa385('0x3')](),controller[_0xa385('0x13')]);module[_0xa385('0x14')]=router; \ No newline at end of file +var _0xbc53=['destroy','removeTags','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy'];(function(_0x595b0d,_0x426843){var _0x1cdcf6=function(_0x3b4144){while(--_0x3b4144){_0x595b0d['push'](_0x595b0d['shift']());}};_0x1cdcf6(++_0x426843);}(_0xbc53,0xb6));var _0x3bc5=function(_0x107325,_0x3d3c4f){_0x107325=_0x107325-0x0;var _0x35c7b8=_0xbc53[_0x107325];return _0x35c7b8;};'use strict';var express=require(_0x3bc5('0x0'));var router=express[_0x3bc5('0x1')]();var auth=require(_0x3bc5('0x2'));var interaction=require(_0x3bc5('0x3'));var controller=require(_0x3bc5('0x4'));router[_0x3bc5('0x5')]('/',auth[_0x3bc5('0x6')](),controller['index']);router[_0x3bc5('0x5')](_0x3bc5('0x7'),auth[_0x3bc5('0x6')](),controller[_0x3bc5('0x8')]);router[_0x3bc5('0x5')](_0x3bc5('0x9'),auth['isAuthenticated'](),controller[_0x3bc5('0xa')]);router[_0x3bc5('0x5')]('/:id/messages',auth['isAuthenticated'](),controller[_0x3bc5('0xb')]);router[_0x3bc5('0x5')](_0x3bc5('0xc'),auth[_0x3bc5('0x6')](),controller[_0x3bc5('0xd')]);router[_0x3bc5('0xe')]('/',auth[_0x3bc5('0x6')](),controller[_0x3bc5('0xf')]);router[_0x3bc5('0xe')](_0x3bc5('0x10'),auth['isAuthenticated'](),controller[_0x3bc5('0x11')]);router[_0x3bc5('0xe')](_0x3bc5('0x12'),auth['isAuthenticated'](),interaction[_0x3bc5('0x13')](_0x3bc5('0x14'),_0x3bc5('0x15')),controller[_0x3bc5('0x16')]);router[_0x3bc5('0x17')](_0x3bc5('0x9'),auth['isAuthenticated'](),interaction[_0x3bc5('0x13')]('mail',_0x3bc5('0x18')),controller[_0x3bc5('0x19')]);router[_0x3bc5('0x1a')](_0x3bc5('0x9'),auth[_0x3bc5('0x6')](),interaction['tracked']('mail',_0x3bc5('0x1b')),controller[_0x3bc5('0x1c')]);router[_0x3bc5('0x1a')](_0x3bc5('0x12'),auth[_0x3bc5('0x6')](),controller[_0x3bc5('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index d02b17e..760dcd4 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 _0x58ef=['long','out','ENUM','sequelize','exports','BOOLEAN','DATE','STRING','TEXT'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x58ef,0x1ce));var _0xf58e=function(_0x1917f7,_0x42cd9d){_0x1917f7=_0x1917f7-0x0;var _0x24e30c=_0x58ef[_0x1917f7];return _0x24e30c;};'use strict';var Sequelize=require(_0xf58e('0x0'));var iconv=require('iconv');module[_0xf58e('0x1')]={'closed':{'type':Sequelize[_0xf58e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf58e('0x3')]},'disposition':{'type':Sequelize[_0xf58e('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xf58e('0x4')]},'note':{'type':Sequelize[_0xf58e('0x4')]},'inReplyTo':{'type':Sequelize[_0xf58e('0x4')](0x1fe)},'to':{'type':Sequelize[_0xf58e('0x4')]},'cc':{'type':Sequelize[_0xf58e('0x5')](_0xf58e('0x6'))},'subject':{'type':Sequelize[_0xf58e('0x5')]()},'attach':{'type':Sequelize[_0xf58e('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xf58e('0x3')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xf58e('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xf58e('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf58e('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xf58e('0x8')]('in',_0xf58e('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x88e3=['out','iconv','exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM'];(function(_0x1c7626,_0x21a666){var _0x4fda7f=function(_0x315f44){while(--_0x315f44){_0x1c7626['push'](_0x1c7626['shift']());}};_0x4fda7f(++_0x21a666);}(_0x88e3,0xa3));var _0x388e=function(_0x476c7,_0x298ee0){_0x476c7=_0x476c7-0x0;var _0x47ae56=_0x88e3[_0x476c7];return _0x47ae56;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x388e('0x0'));module[_0x388e('0x1')]={'closed':{'type':Sequelize[_0x388e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x388e('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x388e('0x4')]},'thirdDisposition':{'type':Sequelize[_0x388e('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x388e('0x4')]},'cc':{'type':Sequelize[_0x388e('0x5')](_0x388e('0x6'))},'subject':{'type':Sequelize[_0x388e('0x5')]()},'attach':{'type':Sequelize[_0x388e('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x388e('0x3')]},'substatus':{'type':Sequelize[_0x388e('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x388e('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x388e('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x388e('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x388e('0x7')]('in',_0x388e('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x388e('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 9c7f832..c403323 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 _0x16b2=['Bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','eml-format','rimraf','zip-dir','moment','bluebird','util','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','html-entities','redis','defaults','socket.io-emitter','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','then','destroy','error','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','MailMessage','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','index','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','select','field','color','from','left_join','u.id\x20=\x20ui.UserId','mail_interactions','users','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','Tag','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','some','compact','MailAccountId','i.MailAccountId\x20IN\x20?','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','isEmpty','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','MailInteraction','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_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.createdAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','Setting','enableEmailPreview','params','include','options','create','body','update','describe','addMessage','ids','nolimit','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','inlineCss','true','rows','setTags','omit','spread','emit','removeTags','download','join','tmp','root','server','files','attachments','Messages','bcc','subject','get','headers'];(function(_0x28283f,_0x1f82ad){var _0x1c7380=function(_0x151266){while(--_0x151266){_0x28283f['push'](_0x28283f['shift']());}};_0x1c7380(++_0x1f82ad);}(_0x16b2,0xe2));var _0x216b=function(_0x308374,_0x550e85){_0x308374=_0x308374-0x0;var _0x1f71e0=_0x16b2[_0x308374];return _0x1f71e0;};'use strict';var emlformat=require(_0x216b('0x0'));var rimraf=require(_0x216b('0x1'));var zipdir=require(_0x216b('0x2'));var moment=require(_0x216b('0x3'));var BPromise=require(_0x216b('0x4'));var util=require(_0x216b('0x5'));var path=require(_0x216b('0x6'));var fs=require('fs');var _=require(_0x216b('0x7'));var squel=require(_0x216b('0x8'));var juice=require(_0x216b('0x9'));var Redis=require(_0x216b('0xa'));var qs=require(_0x216b('0xb'));var as=require(_0x216b('0xc'));var logger=require(_0x216b('0xd'))('api');var config=require(_0x216b('0xe'));var db=require(_0x216b('0xf'))['db'];var htmlEntities=require(_0x216b('0x10'));config[_0x216b('0x11')]=_[_0x216b('0x12')](config[_0x216b('0x11')],{'host':'localhost','port':0x18eb});var socket=require(_0x216b('0x13'))(new Redis(config[_0x216b('0x11')]));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0xbab0db,_0x8ef1ca){_0x8ef1ca=_0x8ef1ca||0xcc;return function(_0x36ef46){if(_0x36ef46){return _0xbab0db[_0x216b('0x14')](_0x8ef1ca);}return _0xbab0db['status'](_0x8ef1ca)[_0x216b('0x15')]();};}function respondWithResult(_0x4ee2ee,_0xfde3cf){_0xfde3cf=_0xfde3cf||0xc8;return function(_0x22f4fe){if(_0x22f4fe){return _0x4ee2ee['status'](_0xfde3cf)[_0x216b('0x16')](_0x22f4fe);}};}function respondWithFilteredResult(_0x5e2bf5,_0x100f1b){return function(_0x43ba64){if(_0x43ba64){var _0x4dc7de=typeof _0x100f1b[_0x216b('0x17')]===_0x216b('0x18')&&typeof _0x100f1b[_0x216b('0x19')]==='undefined';var _0x5a46a5=_0x43ba64[_0x216b('0x1a')];var _0x1dba95=_0x4dc7de?0x0:_0x100f1b['offset'];var _0x3a3fcf=_0x4dc7de?_0x43ba64[_0x216b('0x1a')]:_0x100f1b[_0x216b('0x17')]+_0x100f1b[_0x216b('0x19')];var _0x546795;if(_0x3a3fcf>=_0x5a46a5){_0x3a3fcf=_0x5a46a5;_0x546795=0xc8;}else{_0x546795=0xce;}_0x5e2bf5[_0x216b('0x1b')](_0x546795);return _0x5e2bf5[_0x216b('0x1c')](_0x216b('0x1d'),_0x1dba95+'-'+_0x3a3fcf+'/'+_0x5a46a5)[_0x216b('0x16')](_0x43ba64);}return null;};}function saveUpdates(_0x1e1e16){return function(_0x532fb7){if(_0x532fb7){return _0x532fb7['update'](_0x1e1e16)[_0x216b('0x1e')](function(_0x36cec){return _0x36cec;});}return null;};}function removeEntity(_0x1f6d25){return function(_0x11d2b4){if(_0x11d2b4){return _0x11d2b4[_0x216b('0x1f')]()[_0x216b('0x1e')](function(){_0x1f6d25['status'](0xcc)[_0x216b('0x15')]();});}};}function handleEntityNotFound(_0x607a9a){return function(_0x2f8b1f){if(!_0x2f8b1f){_0x607a9a[_0x216b('0x14')](0x194);}return _0x2f8b1f;};}function handleError(_0x17a3b9,_0x34d278){_0x34d278=_0x34d278||0x1f4;return function(_0x452743){logger[_0x216b('0x20')](_0x452743['stack']);if(_0x452743['name']){delete _0x452743[_0x216b('0x21')];}_0x17a3b9[_0x216b('0x1b')](_0x34d278)[_0x216b('0x22')](_0x452743);};}function getInteractionUsers(_0x3bfd8a,_0x14a70d){return new BPromise(function(_0x4064c4,_0x19004){try{if(_0x14a70d[_0x3bfd8a['id']]){_0x3bfd8a[_0x216b('0x23')]=_[_0x216b('0x24')](_0x14a70d[_0x3bfd8a['id']],function(_0x594564){return{'id':_0x594564['id'],'fullname':_0x594564[_0x216b('0x25')]};});}}catch(_0x4d8b5b){_0x19004(_0x4d8b5b);}_0x4064c4(_0x3bfd8a);});}function getInteractionTags(_0x42c689,_0x482b68){return new BPromise(function(_0x29df39,_0x2aa65f){try{if(_0x42c689[_0x216b('0x26')]){_0x42c689[_0x216b('0x27')]=[];_0x42c689['TagIds'][_0x216b('0x28')](',')[_0x216b('0x29')](function(_0x253a24){_0x42c689['Tags'][_0x216b('0x2a')](_0x482b68[_0x253a24]);});}delete _0x42c689[_0x216b('0x26')];}catch(_0x3ab2da){_0x2aa65f(_0x3ab2da);}_0x29df39(_0x42c689);});}function getLastMessageText(_0x2940fe){return new BPromise(function(_0x18faa5,_0x325609){return db[_0x216b('0x2b')][_0x216b('0x2c')]({'where':{'$and':[{'MailInteractionId':_0x2940fe['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x216b('0x2d')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x216b('0x2e')],'order':_0x216b('0x2f'),'raw':!![]})['then'](function(_0x24a78b){if(_0x24a78b&&_0x24a78b[_0x216b('0x2e')]){_0x2940fe[_0x216b('0x30')]=_[_0x216b('0x31')](_0x24a78b[_0x216b('0x2e')]);}_0x18faa5(_0x2940fe);})[_0x216b('0x32')](function(_0x1f3e33){_0x325609(_0x1f3e33);});});}function updateMailInteraction(_0x394fdf,_0x5495b6,_0x51aa21,_0x26ffe7){return new BPromise(function(_0x5337be,_0x32f31e){return getInteractionUsers(_0x394fdf,_0x51aa21)['then'](function(_0x50f00e){return getInteractionTags(_0x50f00e,_0x5495b6);})[_0x216b('0x1e')](function(_0xda85e0){if(_0x26ffe7){_0x5337be(getLastMessageText(_0xda85e0));}else{_0x5337be(_0xda85e0);}})[_0x216b('0x32')](function(_0x38141e){_0x32f31e(_0x38141e);});});}exports[_0x216b('0x33')]=function(_0x24c6c5,_0x99cdd3){var _0x7f9189={},_0x1870aa={},_0x5ee03d={'count':0x0,'rows':[]};var _0x1316c0=_[_0x216b('0x24')](db['MailInteraction'][_0x216b('0x34')],function(_0x5b86cf){return{'name':_0x5b86cf[_0x216b('0x35')],'type':_0x5b86cf[_0x216b('0x36')]['key']};});_0x1870aa[_0x216b('0x37')]=_[_0x216b('0x24')](_0x1316c0,'name');_0x1870aa[_0x216b('0x38')]=_[_0x216b('0x39')](_0x24c6c5[_0x216b('0x38')]);_0x1870aa[_0x216b('0x3a')]=_[_0x216b('0x3b')](_0x1870aa[_0x216b('0x37')],_0x1870aa[_0x216b('0x38')]);_0x7f9189['attributes']=_[_0x216b('0x3b')](_0x1870aa['model'],qs[_0x216b('0x3c')](_0x24c6c5['query'][_0x216b('0x3c')]));_0x7f9189[_0x216b('0x3d')]=_0x7f9189[_0x216b('0x3d')][_0x216b('0x3e')]?_0x7f9189[_0x216b('0x3d')]:_0x1870aa[_0x216b('0x37')];if(!_0x24c6c5['query'][_0x216b('0x3f')]('nolimit')){_0x7f9189[_0x216b('0x19')]=qs['limit'](_0x24c6c5[_0x216b('0x38')][_0x216b('0x19')]);_0x7f9189[_0x216b('0x17')]=qs[_0x216b('0x17')](_0x24c6c5[_0x216b('0x38')]['offset']);}_0x7f9189[_0x216b('0x40')]=qs['sort'](_0x24c6c5[_0x216b('0x38')][_0x216b('0x41')]);_0x7f9189[_0x216b('0x42')]=qs[_0x216b('0x3a')](_[_0x216b('0x43')](_0x24c6c5[_0x216b('0x38')],_0x1870aa[_0x216b('0x3a')]),_0x1316c0);var _0x55bb49=[];var _0xcb6035=squel[_0x216b('0x44')]()[_0x216b('0x45')]('id')[_0x216b('0x45')](_0x216b('0x21'))[_0x216b('0x45')](_0x216b('0x46'))[_0x216b('0x47')]('tools_tags');var _0x522903=squel[_0x216b('0x44')]()['field']('u.id')[_0x216b('0x45')]('u.fullname')[_0x216b('0x45')]('ui.MailInteractionId')[_0x216b('0x47')]('user_has_mail_interactions','ui')[_0x216b('0x48')]('users','u',_0x216b('0x49'));var _0x17e4cc=squel['select']()[_0x216b('0x47')](_0x216b('0x4a'),'i')['left_join']('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x216b('0x4b'),'o','o.id\x20=\x20i.UserId')[_0x216b('0x48')](_0x216b('0x4c'),'a',_0x216b('0x4d'))[_0x216b('0x48')]('mail_messages','me','me.MailInteractionId\x20=\x20i.id')[_0x216b('0x48')](_0x216b('0x4e'),'it','it.MailInteractionId\x20=\x20i.id')['left_join']('tools_tags','t',_0x216b('0x4f'));var _0x4c2231=squel[_0x216b('0x50')]();var _0x12026d=[];var _0x549dd8=squel[_0x216b('0x50')]();var _0x3692f9;if(_0x24c6c5[_0x216b('0x38')][_0x216b('0x51')]){_0x3692f9=as['parseSearch'](_0x24c6c5['query'][_0x216b('0x51')]);var _0x35fc19=_0x3692f9[_0x216b('0x52')];for(var _0x3ed20b=0x0;_0x3ed20b<_0x3692f9['conditions'][_0x216b('0x3e')];_0x3ed20b++){var _0x1c8b7b=_0x3692f9[_0x216b('0x53')][_0x3ed20b];var _0x5cdc86='i';var _0x40a981=_['find'](_0x1316c0,[_0x216b('0x21'),_0x1c8b7b[_0x216b('0x45')]]);if(!_0x40a981){switch(_0x1c8b7b['field']){case _0x216b('0x54'):if(_0x1c8b7b[_0x216b('0x55')]==0x1){_0x17e4cc[_0x216b('0x56')]('`'+_0x1c8b7b[_0x216b('0x45')]+_0x216b('0x57'));}else{_0x17e4cc[_0x216b('0x56')]('`'+_0x1c8b7b[_0x216b('0x45')]+_0x216b('0x58'));}break;case _0x216b('0x59'):if(_0x1c8b7b[_0x216b('0x5a')]==='$substring'){if(_0x1c8b7b[_0x216b('0x55')]['split']('\x20')[_0x216b('0x3e')]>0x1){_0x4c2231[_0x35fc19](_0x216b('0x5b'),qs[_0x216b('0x5c')](_0x1c8b7b['value']),null);}else{var _0x3acb78='%'+_0x1c8b7b[_0x216b('0x55')]+'%';_0x4c2231[_0x35fc19]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3acb78,_0x3acb78,_0x3acb78);}}else{_0x40a981=_['find'](_0x1316c0,[_0x216b('0x21'),_0x216b('0x5d')]);_0x1c8b7b[_0x216b('0x45')]=_0x216b('0x5d');_0x295f25=as[_0x216b('0x5e')](_0x5cdc86,_0x40a981[_0x216b('0x36')],_0x1c8b7b);_0x4c2231[_0x35fc19](_0x295f25[_0x216b('0x5f')],_0x295f25[_0x216b('0x55')][_0x216b('0x60')],_0x295f25[_0x216b('0x55')][_0x216b('0x15')]);}break;case _0x216b('0x61'):var _0x1b5bc4=_0x1c8b7b['value'][_0x216b('0x28')](',')[_0x216b('0x24')](function(_0x3be34d){return Number(_0x3be34d);});_0x1b5bc4[_0x216b('0x29')](function(_0x598632){_0x549dd8['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x598632+',%');});_0x12026d=_['union'](_0x12026d,_0x1b5bc4);break;case _0x216b('0x62'):if(_0x1c8b7b['operator']===_0x216b('0x63')){_0x4c2231[_0x35fc19](_0x216b('0x64'),'%'+_0x1c8b7b[_0x216b('0x55')]+'%',null);}else{_0x40a981=_[_0x216b('0x65')](_0x1316c0,['name',_0x216b('0x66')]);_0x1c8b7b[_0x216b('0x45')]=_0x216b('0x66');_0x295f25=as['buildExpression'](_0x5cdc86,_0x40a981[_0x216b('0x36')],_0x1c8b7b);_0x4c2231[_0x35fc19](_0x295f25[_0x216b('0x5f')],_0x295f25[_0x216b('0x55')]['start'],_0x295f25[_0x216b('0x55')][_0x216b('0x15')]);}break;case _0x216b('0x2e'):_0x295f25=as[_0x216b('0x5e')]('me',null,_0x1c8b7b);_0x4c2231[_0x35fc19](_0x295f25[_0x216b('0x5f')],_0x295f25[_0x216b('0x55')]['start'],_0x295f25['value']['end']);break;}}else{var _0x295f25=as[_0x216b('0x5e')](_0x5cdc86,_0x40a981[_0x216b('0x36')],_0x1c8b7b);_0x4c2231[_0x35fc19](_0x295f25[_0x216b('0x5f')],_0x295f25[_0x216b('0x55')][_0x216b('0x60')],_0x295f25[_0x216b('0x55')]['end']);}}}else{var _0x45549d=_(_0x24c6c5[_0x216b('0x38')])[_0x216b('0x39')]()['map'](function(_0x310f3e){return _[_0x216b('0x67')](_0x1316c0,[_0x216b('0x21'),_0x310f3e])?_0x310f3e:undefined;})[_0x216b('0x68')]()[_0x216b('0x55')]();if(!_['isEmpty'](_0x45549d)){_0x45549d[_0x216b('0x29')](function(_0x305e36){if(_0x305e36===_0x216b('0x69')){_0x17e4cc['where'](_0x216b('0x6a'),[]['concat'](_0x24c6c5[_0x216b('0x38')][_0x305e36]));}else if(_0x305e36===_0x216b('0x6b')){var _0x2feaac=JSON[_0x216b('0x6c')](_0x24c6c5[_0x216b('0x38')][_0x305e36])[_0x216b('0x6d')];var _0x27a859=JSON[_0x216b('0x6c')](_0x24c6c5[_0x216b('0x38')][_0x305e36])['$lte'];_0x17e4cc[_0x216b('0x42')](_0x216b('0x6e'),_0x2feaac,_0x27a859);}else{if(_0x24c6c5[_0x216b('0x38')][_0x305e36]===_0x216b('0x6f')){_0x17e4cc[_0x216b('0x42')]('i.'+_0x305e36+'\x20IS\x20NULL');}else{_0x17e4cc['where']('i.'+_0x305e36+_0x216b('0x70'),_0x24c6c5[_0x216b('0x38')][_0x305e36]);}}});}if(_0x24c6c5[_0x216b('0x38')][_0x216b('0x71')]){if(_0x24c6c5[_0x216b('0x38')][_0x216b('0x71')]==0x1){_0x17e4cc[_0x216b('0x56')]('`unreadMessages`\x20=\x200');}else{_0x17e4cc['having'](_0x216b('0x72'));}}if(_0x24c6c5[_0x216b('0x38')][_0x216b('0x73')]){_0x12026d=_['isArray'](_0x24c6c5['query']['tag'])?_0x24c6c5['query'][_0x216b('0x73')]:new Array(_0x24c6c5[_0x216b('0x38')][_0x216b('0x73')]);_0x12026d['forEach'](function(_0x3b7de8){_0x549dd8['or'](_0x216b('0x74'),'%,'+_0x3b7de8+',%');});}if(_0x24c6c5['query'][_0x216b('0x75')]){var _0x56df69=_0x24c6c5[_0x216b('0x38')][_0x216b('0x75')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x216b('0x76')](_0x56df69)){_0x4c2231['or'](_0x216b('0x77'),_0x56df69+'%');}else if(qs[_0x216b('0x78')](_0x56df69)){_0x4c2231['or'](_0x216b('0x79'),_0x56df69+'%');}else{_0x4c2231['or'](_0x216b('0x7a'),qs['getFullTextValue'](_0x56df69))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x216b('0x5c')](_0x56df69));}}}_0x17e4cc[_0x216b('0x42')](_0x4c2231);_0x17e4cc[_0x216b('0x7b')](_0x216b('0x7c'));var _0xdc8088={'type':db[_0x216b('0x7d')][_0x216b('0x7e')][_0x216b('0x7f')],'raw':!![]};var _0x5d8730=_0x17e4cc['clone']();_0x5d8730[_0x216b('0x45')]('i.id');_0x5d8730['field'](_0x216b('0x80'),_0x216b('0x54'));if(_0x7f9189[_0x216b('0x40')]){_0x7f9189[_0x216b('0x40')][_0x216b('0x29')](function(_0xa531b2){var _0x5b5c70=_0xa531b2[0x0]===_0x216b('0x81')?_0xa531b2[0x0]:'i.'+_0xa531b2[0x0];_0x17e4cc['order'](_0x5b5c70,_0xa531b2[0x1]===_0x216b('0x82')?![]:!![]);});}if(!_['isEmpty'](_0x12026d)){_0x17e4cc['having'](_0x549dd8);_0x5d8730[_0x216b('0x42')]('t.id\x20IN\x20?',_0x12026d);}BPromise[_0x216b('0x83')]()[_0x216b('0x1e')](function(){if(!_0x3692f9){if(_0x24c6c5['query']['MailAccountId'])return;_0x5d8730[_0x216b('0x42')](_0x216b('0x84'));_0x17e4cc[_0x216b('0x42')](_0x216b('0x84'));return;}if(_0x24c6c5[_0x216b('0x85')][_0x216b('0x86')]!==_0x216b('0x87'))return;return _0x24c6c5[_0x216b('0x85')][_0x216b('0x88')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3d79ae){if(_[_0x216b('0x89')](_0x3d79ae)){_0x5d8730['where'](_0x216b('0x8a'));_0x17e4cc['where']('i.MailAccountId\x20IS\x20NULL');}else{_0x5d8730[_0x216b('0x42')](_0x216b('0x6a'),_['map'](_0x3d79ae,'id'));_0x17e4cc['where'](_0x216b('0x6a'),_[_0x216b('0x24')](_0x3d79ae,'id'));}});})[_0x216b('0x1e')](function(){if(_0x24c6c5[_0x216b('0x85')][_0x216b('0x86')]===_0x216b('0x87')&&!_0x3692f9&&!_0x24c6c5['query']['MailAccountId'])return[];return db[_0x216b('0x8b')][_0x216b('0x38')](_0x5d8730['toString'](),_0xdc8088);})[_0x216b('0x1e')](function(_0x47d610){_0x5ee03d[_0x216b('0x1a')]=_0x47d610[_0x216b('0x3e')];if(_0x5ee03d['count']===0x0)return[];return db[_0x216b('0x8b')]['query'](_0xcb6035[_0x216b('0x8c')](),_0xdc8088)[_0x216b('0x1e')](function(_0x40b2ae){_0x55bb49=_[_0x216b('0x8d')](_0x40b2ae,'id');_0xdc8088=_[_0x216b('0x8e')](_0xdc8088,{'model':db[_0x216b('0x8f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x24c6c5[_0x216b('0x38')]['fields']){_0x7f9189[_0x216b('0x3d')][_0x216b('0x29')](function(_0x197a71){_0x17e4cc[_0x216b('0x45')]('i.'+_0x197a71);});}else{_0x17e4cc[_0x216b('0x45')](_0x216b('0x80'),_0x216b('0x54'));_0x17e4cc['field']('a.key',_0x216b('0x90'));_0x17e4cc['field'](_0x216b('0x91'),_0x216b('0x92'));_0x17e4cc['field'](_0x216b('0x93'),_0x216b('0x81'));_0x17e4cc[_0x216b('0x45')]('i.id');_0x17e4cc[_0x216b('0x45')](_0x216b('0x94'));_0x17e4cc['field']('i.updatedAt');_0x17e4cc[_0x216b('0x45')](_0x216b('0x95'));_0x17e4cc[_0x216b('0x45')](_0x216b('0x96'));_0x17e4cc[_0x216b('0x45')](_0x216b('0x97'));_0x17e4cc['field'](_0x216b('0x98'));_0x17e4cc[_0x216b('0x45')](_0x216b('0x99'));_0x17e4cc['field']('i.subject');_0x17e4cc[_0x216b('0x45')](_0x216b('0x9a'));_0x17e4cc[_0x216b('0x45')](_0x216b('0x9b'));_0x17e4cc[_0x216b('0x45')](_0x216b('0x9c'));_0x17e4cc['field'](_0x216b('0x9d'));_0x17e4cc[_0x216b('0x45')](_0x216b('0x9e'));_0x17e4cc[_0x216b('0x45')](_0x216b('0x9f'));_0x17e4cc['field'](_0x216b('0xa0'));_0x17e4cc['field'](_0x216b('0xa1'));_0x17e4cc['field'](_0x216b('0xa2'),_0x216b('0xa3'));_0x17e4cc[_0x216b('0x45')](_0x216b('0xa4'),'Contact.lastName');_0x17e4cc[_0x216b('0x45')](_0x216b('0xa5'),_0x216b('0xa6'));_0x17e4cc[_0x216b('0x45')](_0x216b('0xa7'),_0x216b('0xa8'));_0x17e4cc['field']('c.mobile','Contact.mobile');_0x17e4cc[_0x216b('0x45')](_0x216b('0xa9'),'Contact.fax');_0x17e4cc['field']('o.fullname',_0x216b('0xaa'));_0x17e4cc[_0x216b('0x45')](_0x216b('0xab'),_0x216b('0xac'));_0x17e4cc[_0x216b('0x45')](_0x216b('0xad'),_0x216b('0x26'));}if(_0x7f9189[_0x216b('0x19')])_0x17e4cc[_0x216b('0x19')](_0x7f9189[_0x216b('0x19')]);if(_0x7f9189[_0x216b('0x17')])_0x17e4cc[_0x216b('0x17')](_0x7f9189['offset']);return db['sequelize']['query'](_0x17e4cc[_0x216b('0x8c')](),_0xdc8088);})['then'](function(_0x36f70d){if(_0x36f70d[_0x216b('0x3e')]>0x0)_0x522903[_0x216b('0x42')](_0x216b('0xae'),_['map'](_0x36f70d,'id'));return db[_0x216b('0x8b')][_0x216b('0x38')](_0x522903[_0x216b('0x8c')](),_0xdc8088)[_0x216b('0x1e')](function(_0x1b62a8){var _0x43579c=_[_0x216b('0xaf')](_0x1b62a8,'MailInteractionId');var _0x483234=[];return db[_0x216b('0xb0')][_0x216b('0x2c')]({'attributes':[_0x216b('0xb1')],'raw':!![]})[_0x216b('0x1e')](function(_0x36f26f){var _0x5b6719=_0x36f26f[_0x216b('0xb1')];_0x36f70d[_0x216b('0x29')](function(_0x1dcbfe){_0x483234['push'](updateMailInteraction(_0x1dcbfe,_0x55bb49,_0x43579c,_0x5b6719));});return BPromise['all'](_0x483234);});});});})[_0x216b('0x1e')](function(_0x2a0d5c){_0x5ee03d['rows']=_0x2a0d5c;return _0x5ee03d;})[_0x216b('0x1e')](respondWithFilteredResult(_0x99cdd3,_0x7f9189))[_0x216b('0x32')](handleError(_0x99cdd3,null));};exports['show']=function(_0x1e5810,_0x309e0d){var _0x47cf6e={'raw':![],'where':{'id':_0x1e5810[_0x216b('0xb2')]['id']}},_0x1a6ae4={};_0x1a6ae4[_0x216b('0x37')]=_[_0x216b('0x39')](db['MailInteraction']['rawAttributes']);_0x1a6ae4[_0x216b('0x38')]=_[_0x216b('0x39')](_0x1e5810[_0x216b('0x38')]);_0x1a6ae4[_0x216b('0x3a')]=_[_0x216b('0x3b')](_0x1a6ae4[_0x216b('0x37')],_0x1a6ae4['query']);_0x47cf6e[_0x216b('0x3d')]=_['intersection'](_0x1a6ae4['model'],qs[_0x216b('0x3c')](_0x1e5810[_0x216b('0x38')]['fields']));_0x47cf6e[_0x216b('0x3d')]=_0x47cf6e[_0x216b('0x3d')]['length']?_0x47cf6e[_0x216b('0x3d')]:_0x1a6ae4[_0x216b('0x37')];if(_0x1e5810[_0x216b('0x38')]['includeAll']){_0x47cf6e[_0x216b('0xb3')]=[{'all':!![]}];}_0x47cf6e=_[_0x216b('0x8e')]({},_0x47cf6e,_0x1e5810[_0x216b('0xb4')]);return db['MailInteraction'][_0x216b('0x65')](_0x47cf6e)[_0x216b('0x1e')](handleEntityNotFound(_0x309e0d,null))['then'](respondWithResult(_0x309e0d,null))[_0x216b('0x32')](handleError(_0x309e0d,null));};exports[_0x216b('0xb5')]=function(_0x3f0c99,_0x386980){return db[_0x216b('0x8f')]['create'](_0x3f0c99[_0x216b('0xb6')],{})[_0x216b('0x1e')](respondWithResult(_0x386980,0xc9))[_0x216b('0x32')](handleError(_0x386980,null));};exports[_0x216b('0xb7')]=function(_0x502dde,_0x549e4e){if(_0x502dde[_0x216b('0xb6')]['id']){delete _0x502dde[_0x216b('0xb6')]['id'];}return db[_0x216b('0x8f')]['find']({'where':{'id':_0x502dde[_0x216b('0xb2')]['id']}})[_0x216b('0x1e')](handleEntityNotFound(_0x549e4e,null))[_0x216b('0x1e')](saveUpdates(_0x502dde[_0x216b('0xb6')],null))[_0x216b('0x1e')](respondWithResult(_0x549e4e,null))[_0x216b('0x32')](handleError(_0x549e4e,null));};exports['destroy']=function(_0x524dd6,_0x58f301){return db[_0x216b('0x8f')][_0x216b('0x65')]({'where':{'id':_0x524dd6[_0x216b('0xb2')]['id']}})[_0x216b('0x1e')](handleEntityNotFound(_0x58f301,null))[_0x216b('0x1e')](removeEntity(_0x58f301,null))[_0x216b('0x32')](handleError(_0x58f301,null));};exports[_0x216b('0xb8')]=function(_0x252cc8,_0x4bff36){return db['MailInteraction'][_0x216b('0xb8')]()[_0x216b('0x1e')](respondWithResult(_0x4bff36,null))[_0x216b('0x32')](handleError(_0x4bff36,null));};exports['addMessage']=function(_0x172d98,_0x4be04f){return db[_0x216b('0x2b')]['find']({'where':{'id':_0x172d98[_0x216b('0xb2')]['id']}})[_0x216b('0x1e')](handleEntityNotFound(_0x4be04f,null))[_0x216b('0x1e')](function(_0x1f2360){if(_0x1f2360){return _0x1f2360[_0x216b('0xb9')](_0x172d98[_0x216b('0xb6')][_0x216b('0xba')],_['omit'](_0x172d98['body'],['ids','id'])||{});}})[_0x216b('0x1e')](respondWithResult(_0x4be04f,null))[_0x216b('0x32')](handleError(_0x4be04f,null));};exports['getMessages']=function(_0x197108,_0x567388){var _0x49d324={'raw':![],'where':{}};var _0x3742b0={};var _0x7f0096={'count':0x0,'rows':[]};return db[_0x216b('0x8f')][_0x216b('0x2c')]({'where':{'id':_0x197108[_0x216b('0xb2')]['id']}})[_0x216b('0x1e')](handleEntityNotFound(_0x567388,null))[_0x216b('0x1e')](function(_0x8be2b7){if(_0x8be2b7){_0x3742b0[_0x216b('0x37')]=_[_0x216b('0x39')](db[_0x216b('0x2b')][_0x216b('0x34')]);_0x3742b0[_0x216b('0x38')]=_[_0x216b('0x39')](_0x197108[_0x216b('0x38')]);_0x3742b0[_0x216b('0x3a')]=_[_0x216b('0x3b')](_0x3742b0[_0x216b('0x37')],_0x3742b0['query']);_0x49d324[_0x216b('0x3d')]=_[_0x216b('0x3b')](_0x3742b0['model'],qs[_0x216b('0x3c')](_0x197108[_0x216b('0x38')][_0x216b('0x3c')]));_0x49d324['attributes']=_0x49d324['attributes']['length']?_0x49d324[_0x216b('0x3d')]:_0x3742b0[_0x216b('0x37')];if(!_0x197108[_0x216b('0x38')][_0x216b('0x3f')](_0x216b('0xbb'))){_0x49d324[_0x216b('0x19')]=qs['limit'](_0x197108[_0x216b('0x38')]['limit']);_0x49d324['offset']=qs[_0x216b('0x17')](_0x197108['query']['offset']);}_0x49d324[_0x216b('0x40')]=qs[_0x216b('0x41')](_0x197108[_0x216b('0x38')][_0x216b('0x41')]);_0x49d324[_0x216b('0x42')]=qs[_0x216b('0x3a')](_[_0x216b('0x43')](_0x197108[_0x216b('0x38')],_0x3742b0[_0x216b('0x3a')]));_0x49d324['where'][_0x216b('0xbc')]=_0x8be2b7['id'];if(_0x197108[_0x216b('0x38')][_0x216b('0x75')]){_0x49d324[_0x216b('0x42')]=_[_0x216b('0x8e')](_0x49d324[_0x216b('0x42')],{'$or':_[_0x216b('0x24')](_0x49d324[_0x216b('0x3d')],function(_0x26c3a3){var _0x41b86a={};_0x41b86a[_0x26c3a3]={'$like':'%'+_0x197108[_0x216b('0x38')][_0x216b('0x75')]+'%'};return _0x41b86a;})});}if(_0x197108['query'][_0x216b('0x6d')]){var _0x58400e=_0x197108[_0x216b('0x38')][_0x216b('0x6d')]['split'](',');var _0x19ba87={};_0x19ba87[_0x58400e[0x0]]={'$gte':moment(_0x58400e[0x1])[_0x216b('0xbd')](_0x216b('0xbe'))};_0x49d324['where']=_['merge'](_0x49d324[_0x216b('0x42')],_0x19ba87);}_0x49d324=_['merge']({},_0x49d324,_0x197108[_0x216b('0xb4')]);return db[_0x216b('0x2b')][_0x216b('0x1a')]({'where':_0x49d324[_0x216b('0x42')]})['then'](function(_0x2f2e38){_0x7f0096[_0x216b('0x1a')]=_0x2f2e38;if(_0x197108[_0x216b('0x38')][_0x216b('0xbf')]){_0x49d324[_0x216b('0xb3')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x49d324);})[_0x216b('0x1e')](function(_0x44bd6a){if(_0x197108[_0x216b('0x38')][_0x216b('0xc0')]===_0x216b('0xc1')){for(var _0x15c754=0x0;_0x15c754<_0x44bd6a[_0x216b('0x3e')];_0x15c754++){_0x44bd6a[_0x15c754]['body']=juice(_0x44bd6a[_0x15c754]['body']);}}_0x7f0096[_0x216b('0xc2')]=_0x44bd6a;return _0x7f0096;});}})[_0x216b('0x1e')](respondWithFilteredResult(_0x567388,_0x49d324))['catch'](handleError(_0x567388,null));};exports['addTags']=function(_0x5c3124,_0x4b4e51){return db[_0x216b('0x8f')][_0x216b('0x65')]({'where':{'id':_0x5c3124[_0x216b('0xb2')]['id']}})[_0x216b('0x1e')](handleEntityNotFound(_0x4b4e51,null))[_0x216b('0x1e')](function(_0x1b6fe9){if(_0x1b6fe9){return _0x1b6fe9[_0x216b('0xc3')](_0x5c3124[_0x216b('0xb6')]['ids'],_[_0x216b('0xc4')](_0x5c3124[_0x216b('0xb6')],[_0x216b('0xba'),'id'])||{})[_0x216b('0xc5')](function(){return db[_0x216b('0x61')]['findAll']({'attributes':['id',_0x216b('0x21'),'color'],'where':{'id':_0x5c3124['body'][_0x216b('0xba')]}});})['then'](function(_0xa0c1c7){socket[_0x216b('0xc6')]('mailInteractionTags:save',{'id':Number(_0x5c3124[_0x216b('0xb2')]['id']),'tags':_0xa0c1c7||[]});return{'id':Number(_0x5c3124[_0x216b('0xb2')]['id']),'tags':_0xa0c1c7||[]};});}})[_0x216b('0x1e')](respondWithResult(_0x4b4e51,null))[_0x216b('0x32')](handleError(_0x4b4e51,null));};exports[_0x216b('0xc7')]=function(_0x36957c,_0x3722da){return db[_0x216b('0x8f')][_0x216b('0x65')]({'where':{'id':_0x36957c[_0x216b('0xb2')]['id']}})[_0x216b('0x1e')](handleEntityNotFound(_0x3722da,null))[_0x216b('0x1e')](function(_0x3dacb8){if(_0x3dacb8){return _0x3dacb8[_0x216b('0xc7')](_0x36957c[_0x216b('0x38')][_0x216b('0xba')]);}})[_0x216b('0x1e')](respondWithStatusCode(_0x3722da,null))[_0x216b('0x32')](handleError(_0x3722da,null));};exports[_0x216b('0xc8')]=function(_0x434174,_0x105d3f){var _0x2f245e=moment()['unix']()[_0x216b('0x8c')]();var _0x38d3a2=path[_0x216b('0xc9')](config['root'],'server','files',_0x216b('0xca'));var _0x4742dd=path[_0x216b('0xc9')](config[_0x216b('0xcb')],_0x216b('0xcc'),_0x216b('0xcd'),_0x216b('0xce'));var _0x1055d5=path[_0x216b('0xc9')](_0x38d3a2,_0x2f245e);var _0x5a0467=util[_0x216b('0xbd')]('transcript-%d-%s.zip',_0x434174[_0x216b('0xb2')]['id'],_0x2f245e);var _0x784648=path[_0x216b('0xc9')](_0x38d3a2,_0x5a0467);var _0x19c0d6=[];if(_0x434174['query'][_0x216b('0xce')]){_0x19c0d6[_0x216b('0x2a')]({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x5564fc=[{'model':db[_0x216b('0x2b')],'as':_0x216b('0xcf'),'attributes':['id','body',_0x216b('0x47'),'to','cc',_0x216b('0xd0'),_0x216b('0xd1'),_0x216b('0x6b')],'where':{'secret':![]},'order':qs[_0x216b('0x41')]('id'),'include':_0x19c0d6}];return db[_0x216b('0x8f')][_0x216b('0x65')]({'where':{'id':_0x434174[_0x216b('0xb2')]['id']},'include':_0x5564fc})[_0x216b('0x1e')](handleEntityNotFound(_0x105d3f,null))[_0x216b('0x1e')](function(_0x4f8ebe){if(_0x4f8ebe&&_0x4f8ebe['Messages']){var _0x94d541=_0x4f8ebe[_0x216b('0xd2')]({'plain':!![]});fs['mkdirSync'](_0x1055d5);return BPromise['each'](_0x94d541[_0x216b('0xcf')],function(_0x3ea211,_0x3c1544){var _0x51a961={'from':_0x3ea211[_0x216b('0x47')],'to':_0x3ea211['to'],'subject':_0x3ea211[_0x216b('0xd1')],'html':htmlEntities['decode'](_0x3ea211[_0x216b('0xb6')]),'headers':{'Date':moment(_0x3ea211[_0x216b('0x6b')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x3ea211['cc']){_0x51a961['headers']['Cc']=_0x3ea211['cc'];}if(_0x3ea211[_0x216b('0xd0')]){_0x51a961[_0x216b('0xd3')][_0x216b('0xd4')]=_0x3ea211[_0x216b('0xd0')];}return new BPromise(function(_0x5baeb0,_0x2f33ae){if(_0x3ea211[_0x216b('0xd5')]){for(var _0x199614=0x0;_0x199614<_0x3ea211[_0x216b('0xd5')][_0x216b('0x3e')];_0x199614++){var _0x5aaaf1=_0x3ea211[_0x216b('0xd5')][_0x199614];var _0x5cc85c=path[_0x216b('0xc9')](_0x4742dd,_0x5aaaf1[_0x216b('0xd6')]);if(fs[_0x216b('0xd7')](_0x5cc85c)){_0x51a961[_0x216b('0xce')][_0x216b('0x2a')]({'name':_0x5aaaf1['name'],'contentType':_0x5aaaf1[_0x216b('0x36')],'data':fs[_0x216b('0xd8')](_0x5cc85c)});}}}emlformat[_0x216b('0xd9')](_0x51a961,function(_0x368cfa,_0x769f){if(_0x368cfa)return _0x2f33ae(_0x368cfa);fs[_0x216b('0xda')](path[_0x216b('0xc9')](_0x1055d5,util[_0x216b('0xbd')]('message%d.eml',_0x3c1544)),_0x769f);return _0x5baeb0(_0x769f);});});})[_0x216b('0x1e')](function(){return new BPromise(function(_0x327bf1,_0x47742f){zipdir(_0x1055d5,{'saveTo':_0x784648},function(_0xeff90d,_0x30ce07){if(_0xeff90d)return _0x47742f(_0xeff90d);return _0x327bf1(_0x30ce07);});})[_0x216b('0x1e')](function(){return new BPromise(function(_0x326773,_0x587e7b){rimraf(_0x1055d5,function(_0x96c5cb){if(_0x96c5cb)_0x587e7b(_0x96c5cb);return _0x326773();});});})['then'](function(){return _0x105d3f[_0x216b('0xc8')](_0x784648,_0x5a0467,function(_0x25f47c){if(!_0x25f47c)fs['unlinkSync'](_0x784648);});});});}else{return _0x105d3f['sendStatus'](0xc8);}})[_0x216b('0x32')](handleError(_0x105d3f,null));}; \ No newline at end of file +var _0x704e=['value','having','`\x20=\x200','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','text','keys','compact','isEmpty','MailAccountId','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','role','agent','user','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','sequelize','toString','keyBy','MailInteraction','fields','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_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.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','enableEmailPreview','all','rows','params','rawAttributes','intersection','includeAll','include','merge','options','create','body','describe','addMessage','ids','omit','MailInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','spread','Tag','color','emit','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','bcc','subject','get','each','Messages','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','existsSync','writeFileSync','message%d.eml','unlinkSync','zip-dir','util','path','squel','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','destroy','error','stack','name','Users','map','TagIds','Tags','split','forEach','push','MailMessage','findOne','out','plainBody','then','lastMsgText','trimStart','catch','index','type','key','model','query','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages'];(function(_0x2c09fe,_0x1ed06b){var _0xb21dca=function(_0x2e761a){while(--_0x2e761a){_0x2c09fe['push'](_0x2c09fe['shift']());}};_0xb21dca(++_0x1ed06b);}(_0x704e,0x93));var _0xe704=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x704e[_0x2b10c6];return _0x3789d2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe704('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xe704('0x1'));var path=require(_0xe704('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe704('0x3'));var juice=require(_0xe704('0x4'));var Redis=require(_0xe704('0x5'));var qs=require(_0xe704('0x6'));var as=require(_0xe704('0x7'));var logger=require(_0xe704('0x8'))('api');var config=require(_0xe704('0x9'));var db=require(_0xe704('0xa'))['db'];var htmlEntities=require(_0xe704('0xb'));config[_0xe704('0xc')]=_[_0xe704('0xd')](config[_0xe704('0xc')],{'host':_0xe704('0xe'),'port':0x18eb});var socket=require(_0xe704('0xf'))(new Redis(config[_0xe704('0xc')]));require(_0xe704('0x10'))['register'](socket);function respondWithStatusCode(_0xf750be,_0x245011){_0x245011=_0x245011||0xcc;return function(_0x57d481){if(_0x57d481){return _0xf750be[_0xe704('0x11')](_0x245011);}return _0xf750be[_0xe704('0x12')](_0x245011)[_0xe704('0x13')]();};}function respondWithResult(_0x1e3da3,_0x3ebabf){_0x3ebabf=_0x3ebabf||0xc8;return function(_0x525d02){if(_0x525d02){return _0x1e3da3[_0xe704('0x12')](_0x3ebabf)[_0xe704('0x14')](_0x525d02);}};}function respondWithFilteredResult(_0x3d134c,_0x2cc1c6){return function(_0x5537bc){if(_0x5537bc){var _0x1b3aa0=typeof _0x2cc1c6[_0xe704('0x15')]===_0xe704('0x16')&&typeof _0x2cc1c6['limit']===_0xe704('0x16');var _0x12ea50=_0x5537bc[_0xe704('0x17')];var _0x46a7bf=_0x1b3aa0?0x0:_0x2cc1c6[_0xe704('0x15')];var _0x3b6042=_0x1b3aa0?_0x5537bc[_0xe704('0x17')]:_0x2cc1c6[_0xe704('0x15')]+_0x2cc1c6[_0xe704('0x18')];var _0x14ed3b;if(_0x3b6042>=_0x12ea50){_0x3b6042=_0x12ea50;_0x14ed3b=0xc8;}else{_0x14ed3b=0xce;}_0x3d134c[_0xe704('0x12')](_0x14ed3b);return _0x3d134c[_0xe704('0x19')](_0xe704('0x1a'),_0x46a7bf+'-'+_0x3b6042+'/'+_0x12ea50)[_0xe704('0x14')](_0x5537bc);}return null;};}function saveUpdates(_0x48b231){return function(_0x118e17){if(_0x118e17){return _0x118e17[_0xe704('0x1b')](_0x48b231)['then'](function(_0x56e730){return _0x56e730;});}return null;};}function removeEntity(_0x532403){return function(_0x59293d){if(_0x59293d){return _0x59293d[_0xe704('0x1c')]()['then'](function(){_0x532403[_0xe704('0x12')](0xcc)[_0xe704('0x13')]();});}};}function handleEntityNotFound(_0x2a7c20){return function(_0x30e77e){if(!_0x30e77e){_0x2a7c20['sendStatus'](0x194);}return _0x30e77e;};}function handleError(_0x3af8a2,_0x3d377e){_0x3d377e=_0x3d377e||0x1f4;return function(_0x41e1af){logger[_0xe704('0x1d')](_0x41e1af[_0xe704('0x1e')]);if(_0x41e1af[_0xe704('0x1f')]){delete _0x41e1af[_0xe704('0x1f')];}_0x3af8a2[_0xe704('0x12')](_0x3d377e)['send'](_0x41e1af);};}function getInteractionUsers(_0x24550e,_0x3286e6){return new BPromise(function(_0x56f1d2,_0x49b7f1){try{if(_0x3286e6[_0x24550e['id']]){_0x24550e[_0xe704('0x20')]=_[_0xe704('0x21')](_0x3286e6[_0x24550e['id']],function(_0x395e35){return{'id':_0x395e35['id'],'fullname':_0x395e35['fullname']};});}}catch(_0x1f8d8d){_0x49b7f1(_0x1f8d8d);}_0x56f1d2(_0x24550e);});}function getInteractionTags(_0x1e4067,_0x471d96){return new BPromise(function(_0x14f5bc,_0x2b4bfd){try{if(_0x1e4067[_0xe704('0x22')]){_0x1e4067[_0xe704('0x23')]=[];_0x1e4067[_0xe704('0x22')][_0xe704('0x24')](',')[_0xe704('0x25')](function(_0x4ee9bc){_0x1e4067[_0xe704('0x23')][_0xe704('0x26')](_0x471d96[_0x4ee9bc]);});}delete _0x1e4067[_0xe704('0x22')];}catch(_0x16eae2){_0x2b4bfd(_0x16eae2);}_0x14f5bc(_0x1e4067);});}function getLastMessageText(_0x4696e8){return new BPromise(function(_0x275f32,_0xc2f1fc){return db[_0xe704('0x27')][_0xe704('0x28')]({'where':{'$and':[{'MailInteractionId':_0x4696e8['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xe704('0x29')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xe704('0x2a')],'order':'-id','raw':!![]})[_0xe704('0x2b')](function(_0x1ec0bf){if(_0x1ec0bf&&_0x1ec0bf[_0xe704('0x2a')]){_0x4696e8[_0xe704('0x2c')]=_[_0xe704('0x2d')](_0x1ec0bf[_0xe704('0x2a')]);}_0x275f32(_0x4696e8);})['catch'](function(_0x4d866c){_0xc2f1fc(_0x4d866c);});});}function updateMailInteraction(_0x496609,_0x1e0d37,_0x45f438,_0xbde09b){return new BPromise(function(_0x4f11d1,_0x59549d){return getInteractionUsers(_0x496609,_0x45f438)[_0xe704('0x2b')](function(_0x5db455){return getInteractionTags(_0x5db455,_0x1e0d37);})['then'](function(_0x1946da){if(_0xbde09b){_0x4f11d1(getLastMessageText(_0x1946da));}else{_0x4f11d1(_0x1946da);}})[_0xe704('0x2e')](function(_0x33768d){_0x59549d(_0x33768d);});});}exports[_0xe704('0x2f')]=function(_0x4df00f,_0x6ba7c3){var _0x1c3201={},_0xc33593={},_0x42b3c9={'count':0x0,'rows':[]};var _0x3747c8=_[_0xe704('0x21')](db['MailInteraction']['rawAttributes'],function(_0xacff06){return{'name':_0xacff06['fieldName'],'type':_0xacff06[_0xe704('0x30')][_0xe704('0x31')]};});_0xc33593[_0xe704('0x32')]=_[_0xe704('0x21')](_0x3747c8,'name');_0xc33593[_0xe704('0x33')]=_['keys'](_0x4df00f['query']);_0xc33593[_0xe704('0x34')]=_['intersection'](_0xc33593[_0xe704('0x32')],_0xc33593[_0xe704('0x33')]);_0x1c3201[_0xe704('0x35')]=_['intersection'](_0xc33593['model'],qs['fields'](_0x4df00f['query']['fields']));_0x1c3201[_0xe704('0x35')]=_0x1c3201['attributes'][_0xe704('0x36')]?_0x1c3201['attributes']:_0xc33593[_0xe704('0x32')];if(!_0x4df00f[_0xe704('0x33')][_0xe704('0x37')](_0xe704('0x38'))){_0x1c3201[_0xe704('0x18')]=qs[_0xe704('0x18')](_0x4df00f[_0xe704('0x33')]['limit']);_0x1c3201[_0xe704('0x15')]=qs[_0xe704('0x15')](_0x4df00f['query'][_0xe704('0x15')]);}_0x1c3201[_0xe704('0x39')]=qs['sort'](_0x4df00f[_0xe704('0x33')][_0xe704('0x3a')]);_0x1c3201[_0xe704('0x3b')]=qs[_0xe704('0x34')](_[_0xe704('0x3c')](_0x4df00f[_0xe704('0x33')],_0xc33593['filters']),_0x3747c8);var _0x1b6e37=[];var _0xa78582=squel[_0xe704('0x3d')]()[_0xe704('0x3e')]('id')['field'](_0xe704('0x1f'))['field']('color')[_0xe704('0x3f')](_0xe704('0x40'));var _0x5cebf0=squel[_0xe704('0x3d')]()['field'](_0xe704('0x41'))[_0xe704('0x3e')](_0xe704('0x42'))[_0xe704('0x3e')](_0xe704('0x43'))[_0xe704('0x3f')](_0xe704('0x44'),'ui')[_0xe704('0x45')](_0xe704('0x46'),'u',_0xe704('0x47'));var _0x4b3e32=squel[_0xe704('0x3d')]()[_0xe704('0x3f')]('mail_interactions','i')[_0xe704('0x45')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xe704('0x45')]('users','o','o.id\x20=\x20i.UserId')[_0xe704('0x45')](_0xe704('0x48'),'a',_0xe704('0x49'))['left_join'](_0xe704('0x4a'),'me',_0xe704('0x4b'))[_0xe704('0x45')](_0xe704('0x4c'),'it',_0xe704('0x4d'))[_0xe704('0x45')](_0xe704('0x40'),'t',_0xe704('0x4e'));var _0x364f04=squel['expr']();var _0x2b9b1f=[];var _0x2d47d2=squel[_0xe704('0x4f')]();var _0x16da13;if(_0x4df00f['query'][_0xe704('0x50')]){_0x16da13=as[_0xe704('0x51')](_0x4df00f['query']['search']);var _0x1bf501=_0x16da13[_0xe704('0x52')];for(var _0x2849c2=0x0;_0x2849c2<_0x16da13[_0xe704('0x53')]['length'];_0x2849c2++){var _0x109f13=_0x16da13['conditions'][_0x2849c2];var _0x1493df='i';var _0x5926e2=_['find'](_0x3747c8,[_0xe704('0x1f'),_0x109f13[_0xe704('0x3e')]]);if(!_0x5926e2){switch(_0x109f13[_0xe704('0x3e')]){case _0xe704('0x54'):if(_0x109f13[_0xe704('0x55')]==0x1){_0x4b3e32[_0xe704('0x56')]('`'+_0x109f13[_0xe704('0x3e')]+_0xe704('0x57'));}else{_0x4b3e32['having']('`'+_0x109f13[_0xe704('0x3e')]+_0xe704('0x58'));}break;case'Contact':if(_0x109f13[_0xe704('0x59')]===_0xe704('0x5a')){if(_0x109f13['value'][_0xe704('0x24')]('\x20')[_0xe704('0x36')]>0x1){_0x364f04[_0x1bf501](_0xe704('0x5b'),qs[_0xe704('0x5c')](_0x109f13[_0xe704('0x55')]),null);}else{var _0xbaf176='%'+_0x109f13[_0xe704('0x55')]+'%';_0x364f04[_0x1bf501](_0xe704('0x5d'),_0xbaf176,_0xbaf176,_0xbaf176);}}else{_0x5926e2=_['find'](_0x3747c8,[_0xe704('0x1f'),_0xe704('0x5e')]);_0x109f13['field']=_0xe704('0x5e');_0x58212a=as[_0xe704('0x5f')](_0x1493df,_0x5926e2[_0xe704('0x30')],_0x109f13);_0x364f04[_0x1bf501](_0x58212a['text'],_0x58212a[_0xe704('0x55')][_0xe704('0x60')],_0x58212a['value'][_0xe704('0x13')]);}break;case'Tag':var _0x424088=_0x109f13[_0xe704('0x55')][_0xe704('0x24')](',')[_0xe704('0x21')](function(_0x5d80c7){return Number(_0x5d80c7);});_0x424088[_0xe704('0x25')](function(_0x5b1823){_0x2d47d2['or'](_0xe704('0x61'),'%,'+_0x5b1823+',%');});_0x2b9b1f=_[_0xe704('0x62')](_0x2b9b1f,_0x424088);break;case _0xe704('0x63'):if(_0x109f13[_0xe704('0x59')]===_0xe704('0x5a')){_0x364f04[_0x1bf501](_0xe704('0x64'),'%'+_0x109f13[_0xe704('0x55')]+'%',null);}else{_0x5926e2=_[_0xe704('0x65')](_0x3747c8,[_0xe704('0x1f'),_0xe704('0x66')]);_0x109f13[_0xe704('0x3e')]=_0xe704('0x66');_0x58212a=as[_0xe704('0x5f')](_0x1493df,_0x5926e2[_0xe704('0x30')],_0x109f13);_0x364f04[_0x1bf501](_0x58212a['text'],_0x58212a[_0xe704('0x55')][_0xe704('0x60')],_0x58212a['value'][_0xe704('0x13')]);}break;case _0xe704('0x2a'):_0x58212a=as[_0xe704('0x5f')]('me',null,_0x109f13);_0x364f04[_0x1bf501](_0x58212a[_0xe704('0x67')],_0x58212a[_0xe704('0x55')]['start'],_0x58212a[_0xe704('0x55')][_0xe704('0x13')]);break;}}else{var _0x58212a=as[_0xe704('0x5f')](_0x1493df,_0x5926e2[_0xe704('0x30')],_0x109f13);_0x364f04[_0x1bf501](_0x58212a[_0xe704('0x67')],_0x58212a[_0xe704('0x55')][_0xe704('0x60')],_0x58212a[_0xe704('0x55')][_0xe704('0x13')]);}}}else{var _0x447099=_(_0x4df00f[_0xe704('0x33')])[_0xe704('0x68')]()[_0xe704('0x21')](function(_0x101068){return _['some'](_0x3747c8,[_0xe704('0x1f'),_0x101068])?_0x101068:undefined;})[_0xe704('0x69')]()['value']();if(!_[_0xe704('0x6a')](_0x447099)){_0x447099['forEach'](function(_0x2a4638){if(_0x2a4638===_0xe704('0x6b')){_0x4b3e32[_0xe704('0x3b')]('i.MailAccountId\x20IN\x20?',[]['concat'](_0x4df00f[_0xe704('0x33')][_0x2a4638]));}else if(_0x2a4638===_0xe704('0x6c')){var _0x94cd84=JSON[_0xe704('0x6d')](_0x4df00f['query'][_0x2a4638])['$gte'];var _0x4a7cb2=JSON[_0xe704('0x6d')](_0x4df00f[_0xe704('0x33')][_0x2a4638])['$lte'];_0x4b3e32[_0xe704('0x3b')](_0xe704('0x6e'),_0x94cd84,_0x4a7cb2);}else{if(_0x4df00f[_0xe704('0x33')][_0x2a4638]===_0xe704('0x6f')){_0x4b3e32['where']('i.'+_0x2a4638+'\x20IS\x20NULL');}else{_0x4b3e32[_0xe704('0x3b')]('i.'+_0x2a4638+'\x20=\x20?',_0x4df00f[_0xe704('0x33')][_0x2a4638]);}}});}if(_0x4df00f[_0xe704('0x33')][_0xe704('0x70')]){if(_0x4df00f[_0xe704('0x33')]['read']==0x1){_0x4b3e32[_0xe704('0x56')](_0xe704('0x71'));}else{_0x4b3e32[_0xe704('0x56')](_0xe704('0x72'));}}if(_0x4df00f['query'][_0xe704('0x73')]){_0x2b9b1f=_[_0xe704('0x74')](_0x4df00f['query'][_0xe704('0x73')])?_0x4df00f['query']['tag']:new Array(_0x4df00f[_0xe704('0x33')]['tag']);_0x2b9b1f[_0xe704('0x25')](function(_0x18c622){_0x2d47d2['or'](_0xe704('0x61'),'%,'+_0x18c622+',%');});}if(_0x4df00f['query'][_0xe704('0x75')]){var _0x191422=_0x4df00f['query']['filter'][_0xe704('0x76')]('\x5c','\x5c\x5c')[_0xe704('0x76')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x191422)){_0x364f04['or'](_0xe704('0x77'),_0x191422+'%');}else if(qs[_0xe704('0x78')](_0x191422)){_0x364f04['or'](_0xe704('0x79'),_0x191422+'%');}else{_0x364f04['or'](_0xe704('0x7a'),qs[_0xe704('0x5c')](_0x191422))['or'](_0xe704('0x7b'),qs[_0xe704('0x5c')](_0x191422));}}}_0x4b3e32[_0xe704('0x3b')](_0x364f04);_0x4b3e32[_0xe704('0x7c')](_0xe704('0x7d'));var _0x46ea9c={'type':db[_0xe704('0x7e')][_0xe704('0x7f')][_0xe704('0x80')],'raw':!![]};var _0x4bc253=_0x4b3e32[_0xe704('0x81')]();_0x4bc253[_0xe704('0x3e')](_0xe704('0x7d'));_0x4bc253[_0xe704('0x3e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xe704('0x54'));if(_0x1c3201[_0xe704('0x39')]){_0x1c3201[_0xe704('0x39')][_0xe704('0x25')](function(_0xdc258c){var _0x3d9b0e=_0xdc258c[0x0]===_0xe704('0x82')?_0xdc258c[0x0]:'i.'+_0xdc258c[0x0];_0x4b3e32[_0xe704('0x39')](_0x3d9b0e,_0xdc258c[0x1]===_0xe704('0x83')?![]:!![]);});}if(!_['isEmpty'](_0x2b9b1f)){_0x4b3e32[_0xe704('0x56')](_0x2d47d2);_0x4bc253['where'](_0xe704('0x84'),_0x2b9b1f);}BPromise[_0xe704('0x85')]()['then'](function(){if(!_0x16da13){if(_0x4df00f[_0xe704('0x33')][_0xe704('0x6b')])return;_0x4bc253['where'](_0xe704('0x86'));_0x4b3e32[_0xe704('0x3b')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x4df00f['user'][_0xe704('0x87')]!==_0xe704('0x88'))return;return _0x4df00f[_0xe704('0x89')]['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0xe704('0x2b')](function(_0x667a1b){if(_[_0xe704('0x6a')](_0x667a1b)){_0x4bc253[_0xe704('0x3b')](_0xe704('0x8a'));_0x4b3e32[_0xe704('0x3b')]('i.MailAccountId\x20IS\x20NULL');}else{_0x4bc253[_0xe704('0x3b')]('i.MailAccountId\x20IN\x20?',_[_0xe704('0x21')](_0x667a1b,'id'));_0x4b3e32[_0xe704('0x3b')](_0xe704('0x8b'),_[_0xe704('0x21')](_0x667a1b,'id'));}});})['then'](function(){if(_0x4df00f[_0xe704('0x89')][_0xe704('0x87')]==='agent'&&!_0x16da13&&!_0x4df00f[_0xe704('0x33')][_0xe704('0x6b')])return[];return db['sequelize']['query'](_0x4bc253['toString'](),_0x46ea9c);})[_0xe704('0x2b')](function(_0x68225f){_0x42b3c9[_0xe704('0x17')]=_0x68225f['length'];if(_0x42b3c9['count']===0x0)return[];return db[_0xe704('0x8c')][_0xe704('0x33')](_0xa78582[_0xe704('0x8d')](),_0x46ea9c)[_0xe704('0x2b')](function(_0x538ff4){_0x1b6e37=_[_0xe704('0x8e')](_0x538ff4,'id');_0x46ea9c=_['merge'](_0x46ea9c,{'model':db[_0xe704('0x8f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4df00f[_0xe704('0x33')][_0xe704('0x90')]){_0x1c3201[_0xe704('0x35')][_0xe704('0x25')](function(_0x132766){_0x4b3e32[_0xe704('0x3e')]('i.'+_0x132766);});}else{_0x4b3e32['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x4b3e32[_0xe704('0x3e')](_0xe704('0x91'),'Account.key');_0x4b3e32[_0xe704('0x3e')](_0xe704('0x92'),_0xe704('0x93'));_0x4b3e32[_0xe704('0x3e')](_0xe704('0x94'),'contactName');_0x4b3e32['field'](_0xe704('0x7d'));_0x4b3e32[_0xe704('0x3e')]('i.createdAt');_0x4b3e32[_0xe704('0x3e')](_0xe704('0x95'));_0x4b3e32[_0xe704('0x3e')](_0xe704('0x96'));_0x4b3e32[_0xe704('0x3e')](_0xe704('0x97'));_0x4b3e32[_0xe704('0x3e')](_0xe704('0x98'));_0x4b3e32[_0xe704('0x3e')](_0xe704('0x99'));_0x4b3e32[_0xe704('0x3e')](_0xe704('0x9a'));_0x4b3e32[_0xe704('0x3e')](_0xe704('0x9b'));_0x4b3e32['field'](_0xe704('0x9c'));_0x4b3e32[_0xe704('0x3e')]('i.secondDisposition');_0x4b3e32[_0xe704('0x3e')](_0xe704('0x9d'));_0x4b3e32['field'](_0xe704('0x9e'));_0x4b3e32['field'](_0xe704('0x9f'));_0x4b3e32[_0xe704('0x3e')](_0xe704('0xa0'));_0x4b3e32[_0xe704('0x3e')](_0xe704('0xa1'));_0x4b3e32['field']('i.UserId');_0x4b3e32[_0xe704('0x3e')](_0xe704('0xa2'),_0xe704('0xa3'));_0x4b3e32[_0xe704('0x3e')](_0xe704('0xa4'),_0xe704('0xa5'));_0x4b3e32['field']('c.email',_0xe704('0xa6'));_0x4b3e32[_0xe704('0x3e')](_0xe704('0xa7'),_0xe704('0xa8'));_0x4b3e32[_0xe704('0x3e')](_0xe704('0xa9'),'Contact.mobile');_0x4b3e32['field'](_0xe704('0xaa'),_0xe704('0xab'));_0x4b3e32[_0xe704('0x3e')](_0xe704('0xac'),_0xe704('0xad'));_0x4b3e32['field'](_0xe704('0xae'),_0xe704('0xaf'));_0x4b3e32['field'](_0xe704('0xb0'),_0xe704('0x22'));}if(_0x1c3201['limit'])_0x4b3e32['limit'](_0x1c3201[_0xe704('0x18')]);if(_0x1c3201[_0xe704('0x15')])_0x4b3e32[_0xe704('0x15')](_0x1c3201[_0xe704('0x15')]);return db['sequelize'][_0xe704('0x33')](_0x4b3e32[_0xe704('0x8d')](),_0x46ea9c);})[_0xe704('0x2b')](function(_0xe1762f){if(_0xe1762f['length']>0x0)_0x5cebf0['where'](_0xe704('0xb1'),_['map'](_0xe1762f,'id'));return db['sequelize']['query'](_0x5cebf0[_0xe704('0x8d')](),_0x46ea9c)[_0xe704('0x2b')](function(_0x2cf359){var _0x33cedc=_[_0xe704('0xb2')](_0x2cf359,'MailInteractionId');var _0x1e85c1=[];return db['Setting'][_0xe704('0x28')]({'attributes':[_0xe704('0xb3')],'raw':!![]})[_0xe704('0x2b')](function(_0x9b9213){var _0x5a99e3=_0x9b9213['enableEmailPreview'];_0xe1762f[_0xe704('0x25')](function(_0x1447c7){_0x1e85c1[_0xe704('0x26')](updateMailInteraction(_0x1447c7,_0x1b6e37,_0x33cedc,_0x5a99e3));});return BPromise[_0xe704('0xb4')](_0x1e85c1);});});});})[_0xe704('0x2b')](function(_0x57a640){_0x42b3c9[_0xe704('0xb5')]=_0x57a640;return _0x42b3c9;})[_0xe704('0x2b')](respondWithFilteredResult(_0x6ba7c3,_0x1c3201))[_0xe704('0x2e')](handleError(_0x6ba7c3,null));};exports['show']=function(_0x5df187,_0xadb1a1){var _0x4e4019={'raw':![],'where':{'id':_0x5df187[_0xe704('0xb6')]['id']}},_0xa88a8d={};_0xa88a8d['model']=_[_0xe704('0x68')](db[_0xe704('0x8f')][_0xe704('0xb7')]);_0xa88a8d[_0xe704('0x33')]=_[_0xe704('0x68')](_0x5df187[_0xe704('0x33')]);_0xa88a8d[_0xe704('0x34')]=_[_0xe704('0xb8')](_0xa88a8d[_0xe704('0x32')],_0xa88a8d[_0xe704('0x33')]);_0x4e4019[_0xe704('0x35')]=_[_0xe704('0xb8')](_0xa88a8d[_0xe704('0x32')],qs[_0xe704('0x90')](_0x5df187['query'][_0xe704('0x90')]));_0x4e4019[_0xe704('0x35')]=_0x4e4019[_0xe704('0x35')][_0xe704('0x36')]?_0x4e4019[_0xe704('0x35')]:_0xa88a8d[_0xe704('0x32')];if(_0x5df187['query'][_0xe704('0xb9')]){_0x4e4019[_0xe704('0xba')]=[{'all':!![]}];}_0x4e4019=_[_0xe704('0xbb')]({},_0x4e4019,_0x5df187[_0xe704('0xbc')]);return db[_0xe704('0x8f')][_0xe704('0x65')](_0x4e4019)[_0xe704('0x2b')](handleEntityNotFound(_0xadb1a1,null))[_0xe704('0x2b')](respondWithResult(_0xadb1a1,null))['catch'](handleError(_0xadb1a1,null));};exports[_0xe704('0xbd')]=function(_0x132bda,_0x30e4b1){return db[_0xe704('0x8f')][_0xe704('0xbd')](_0x132bda[_0xe704('0xbe')],{})[_0xe704('0x2b')](respondWithResult(_0x30e4b1,0xc9))[_0xe704('0x2e')](handleError(_0x30e4b1,null));};exports[_0xe704('0x1b')]=function(_0x4c90ac,_0x592665){if(_0x4c90ac[_0xe704('0xbe')]['id']){delete _0x4c90ac[_0xe704('0xbe')]['id'];}return db[_0xe704('0x8f')][_0xe704('0x65')]({'where':{'id':_0x4c90ac['params']['id']}})['then'](handleEntityNotFound(_0x592665,null))[_0xe704('0x2b')](saveUpdates(_0x4c90ac[_0xe704('0xbe')],null))[_0xe704('0x2b')](respondWithResult(_0x592665,null))[_0xe704('0x2e')](handleError(_0x592665,null));};exports[_0xe704('0x1c')]=function(_0x4267ed,_0x75bc6e){return db[_0xe704('0x8f')][_0xe704('0x65')]({'where':{'id':_0x4267ed[_0xe704('0xb6')]['id']}})[_0xe704('0x2b')](handleEntityNotFound(_0x75bc6e,null))[_0xe704('0x2b')](removeEntity(_0x75bc6e,null))[_0xe704('0x2e')](handleError(_0x75bc6e,null));};exports[_0xe704('0xbf')]=function(_0x90f1e3,_0x50bf9e){return db[_0xe704('0x8f')]['describe']()[_0xe704('0x2b')](respondWithResult(_0x50bf9e,null))[_0xe704('0x2e')](handleError(_0x50bf9e,null));};exports[_0xe704('0xc0')]=function(_0x2eae86,_0x48b5f4){return db['MailMessage'][_0xe704('0x65')]({'where':{'id':_0x2eae86['params']['id']}})[_0xe704('0x2b')](handleEntityNotFound(_0x48b5f4,null))['then'](function(_0x10850c){if(_0x10850c){return _0x10850c['addMessage'](_0x2eae86[_0xe704('0xbe')][_0xe704('0xc1')],_[_0xe704('0xc2')](_0x2eae86[_0xe704('0xbe')],[_0xe704('0xc1'),'id'])||{});}})[_0xe704('0x2b')](respondWithResult(_0x48b5f4,null))['catch'](handleError(_0x48b5f4,null));};exports['getMessages']=function(_0x5c8d9b,_0xa1c29){var _0x5e11ba={'raw':![],'where':{}};var _0x57e41c={};var _0x20a93f={'count':0x0,'rows':[]};return db['MailInteraction'][_0xe704('0x28')]({'where':{'id':_0x5c8d9b['params']['id']}})[_0xe704('0x2b')](handleEntityNotFound(_0xa1c29,null))[_0xe704('0x2b')](function(_0x21457a){if(_0x21457a){_0x57e41c[_0xe704('0x32')]=_[_0xe704('0x68')](db['MailMessage'][_0xe704('0xb7')]);_0x57e41c[_0xe704('0x33')]=_[_0xe704('0x68')](_0x5c8d9b[_0xe704('0x33')]);_0x57e41c[_0xe704('0x34')]=_['intersection'](_0x57e41c[_0xe704('0x32')],_0x57e41c[_0xe704('0x33')]);_0x5e11ba[_0xe704('0x35')]=_['intersection'](_0x57e41c[_0xe704('0x32')],qs[_0xe704('0x90')](_0x5c8d9b[_0xe704('0x33')][_0xe704('0x90')]));_0x5e11ba[_0xe704('0x35')]=_0x5e11ba[_0xe704('0x35')][_0xe704('0x36')]?_0x5e11ba[_0xe704('0x35')]:_0x57e41c[_0xe704('0x32')];if(!_0x5c8d9b['query'][_0xe704('0x37')](_0xe704('0x38'))){_0x5e11ba[_0xe704('0x18')]=qs[_0xe704('0x18')](_0x5c8d9b[_0xe704('0x33')][_0xe704('0x18')]);_0x5e11ba['offset']=qs['offset'](_0x5c8d9b[_0xe704('0x33')][_0xe704('0x15')]);}_0x5e11ba[_0xe704('0x39')]=qs['sort'](_0x5c8d9b[_0xe704('0x33')][_0xe704('0x3a')]);_0x5e11ba['where']=qs[_0xe704('0x34')](_[_0xe704('0x3c')](_0x5c8d9b[_0xe704('0x33')],_0x57e41c[_0xe704('0x34')]));_0x5e11ba[_0xe704('0x3b')][_0xe704('0xc3')]=_0x21457a['id'];if(_0x5c8d9b[_0xe704('0x33')][_0xe704('0x75')]){_0x5e11ba[_0xe704('0x3b')]=_['merge'](_0x5e11ba['where'],{'$or':_[_0xe704('0x21')](_0x5e11ba[_0xe704('0x35')],function(_0x1f4fad){var _0xd30098={};_0xd30098[_0x1f4fad]={'$like':'%'+_0x5c8d9b[_0xe704('0x33')]['filter']+'%'};return _0xd30098;})});}if(_0x5c8d9b['query'][_0xe704('0xc4')]){var _0x3196ff=_0x5c8d9b[_0xe704('0x33')]['$gte'][_0xe704('0x24')](',');var _0x229112={};_0x229112[_0x3196ff[0x0]]={'$gte':moment(_0x3196ff[0x1])[_0xe704('0xc5')](_0xe704('0xc6'))};_0x5e11ba[_0xe704('0x3b')]=_[_0xe704('0xbb')](_0x5e11ba['where'],_0x229112);}_0x5e11ba=_[_0xe704('0xbb')]({},_0x5e11ba,_0x5c8d9b[_0xe704('0xbc')]);return db[_0xe704('0x27')][_0xe704('0x17')]({'where':_0x5e11ba[_0xe704('0x3b')]})['then'](function(_0x3cdc8c){_0x20a93f['count']=_0x3cdc8c;if(_0x5c8d9b['query'][_0xe704('0xb9')]){_0x5e11ba[_0xe704('0xba')]=[{'all':!![]}];}return db[_0xe704('0x27')][_0xe704('0xc7')](_0x5e11ba);})[_0xe704('0x2b')](function(_0x57a88c){if(_0x5c8d9b[_0xe704('0x33')][_0xe704('0xc8')]===_0xe704('0xc9')){for(var _0x22efbb=0x0;_0x22efbb<_0x57a88c[_0xe704('0x36')];_0x22efbb++){_0x57a88c[_0x22efbb]['body']=juice(_0x57a88c[_0x22efbb]['body']);}}_0x20a93f[_0xe704('0xb5')]=_0x57a88c;return _0x20a93f;});}})[_0xe704('0x2b')](respondWithFilteredResult(_0xa1c29,_0x5e11ba))[_0xe704('0x2e')](handleError(_0xa1c29,null));};exports[_0xe704('0xca')]=function(_0x3e4ebf,_0x4dd687){return db[_0xe704('0x8f')]['find']({'where':{'id':_0x3e4ebf[_0xe704('0xb6')]['id']}})[_0xe704('0x2b')](handleEntityNotFound(_0x4dd687,null))[_0xe704('0x2b')](function(_0x27b87d){if(_0x27b87d){return _0x27b87d[_0xe704('0xcb')](_0x3e4ebf[_0xe704('0xbe')][_0xe704('0xc1')],_[_0xe704('0xc2')](_0x3e4ebf[_0xe704('0xbe')],['ids','id'])||{})[_0xe704('0xcc')](function(){return db[_0xe704('0xcd')][_0xe704('0xc7')]({'attributes':['id','name',_0xe704('0xce')],'where':{'id':_0x3e4ebf[_0xe704('0xbe')][_0xe704('0xc1')]}});})[_0xe704('0x2b')](function(_0x3fedd0){socket[_0xe704('0xcf')]('mailInteractionTags:save',{'id':Number(_0x3e4ebf[_0xe704('0xb6')]['id']),'tags':_0x3fedd0||[]});return{'id':Number(_0x3e4ebf[_0xe704('0xb6')]['id']),'tags':_0x3fedd0||[]};});}})['then'](respondWithResult(_0x4dd687,null))['catch'](handleError(_0x4dd687,null));};exports['removeTags']=function(_0x2e9227,_0x5637e7){return db[_0xe704('0x8f')][_0xe704('0x65')]({'where':{'id':_0x2e9227[_0xe704('0xb6')]['id']}})[_0xe704('0x2b')](handleEntityNotFound(_0x5637e7,null))['then'](function(_0x5094c3){if(_0x5094c3){return _0x5094c3[_0xe704('0xd0')](_0x2e9227[_0xe704('0x33')][_0xe704('0xc1')]);}})[_0xe704('0x2b')](respondWithStatusCode(_0x5637e7,null))[_0xe704('0x2e')](handleError(_0x5637e7,null));};exports[_0xe704('0xd1')]=function(_0x3eeea2,_0x3278bd){var _0x3a9ec8=moment()[_0xe704('0xd2')]()[_0xe704('0x8d')]();var _0x44f1a7=path[_0xe704('0xd3')](config[_0xe704('0xd4')],'server','files','tmp');var _0x38bfcd=path[_0xe704('0xd3')](config[_0xe704('0xd4')],_0xe704('0xd5'),_0xe704('0xd6'),_0xe704('0xd7'));var _0x5e2de9=path['join'](_0x44f1a7,_0x3a9ec8);var _0x44da1b=util['format'](_0xe704('0xd8'),_0x3eeea2['params']['id'],_0x3a9ec8);var _0x4a983e=path['join'](_0x44f1a7,_0x44da1b);var _0x5d89b7=[];if(_0x3eeea2[_0xe704('0x33')][_0xe704('0xd7')]){_0x5d89b7[_0xe704('0x26')]({'model':db[_0xe704('0xd9')],'as':'Attachments','raw':!![]});}var _0x4141a6=[{'model':db[_0xe704('0x27')],'as':'Messages','attributes':['id','body',_0xe704('0x3f'),'to','cc',_0xe704('0xda'),_0xe704('0xdb'),_0xe704('0x6c')],'where':{'secret':![]},'order':qs[_0xe704('0x3a')]('id'),'include':_0x5d89b7}];return db[_0xe704('0x8f')]['find']({'where':{'id':_0x3eeea2['params']['id']},'include':_0x4141a6})[_0xe704('0x2b')](handleEntityNotFound(_0x3278bd,null))[_0xe704('0x2b')](function(_0x436b10){if(_0x436b10&&_0x436b10['Messages']){var _0x5ec589=_0x436b10[_0xe704('0xdc')]({'plain':!![]});fs['mkdirSync'](_0x5e2de9);return BPromise[_0xe704('0xdd')](_0x5ec589[_0xe704('0xde')],function(_0x577ea3,_0x333dad){var _0x27cd63={'from':_0x577ea3['from'],'to':_0x577ea3['to'],'subject':_0x577ea3[_0xe704('0xdb')],'html':htmlEntities['decode'](_0x577ea3[_0xe704('0xbe')]),'headers':{'Date':moment(_0x577ea3[_0xe704('0x6c')])[_0xe704('0xc5')](_0xe704('0xdf'))},'attachments':[]};if(_0x577ea3['cc']){_0x27cd63[_0xe704('0xe0')]['Cc']=_0x577ea3['cc'];}if(_0x577ea3[_0xe704('0xda')]){_0x27cd63[_0xe704('0xe0')][_0xe704('0xe1')]=_0x577ea3['bcc'];}return new BPromise(function(_0x5d0e1b,_0x416ae7){if(_0x577ea3['Attachments']){for(var _0x5525c9=0x0;_0x5525c9<_0x577ea3['Attachments'][_0xe704('0x36')];_0x5525c9++){var _0x3d6483=_0x577ea3[_0xe704('0xe2')][_0x5525c9];var _0x1e0aa3=path[_0xe704('0xd3')](_0x38bfcd,_0x3d6483[_0xe704('0xe3')]);if(fs[_0xe704('0xe4')](_0x1e0aa3)){_0x27cd63[_0xe704('0xd7')][_0xe704('0x26')]({'name':_0x3d6483[_0xe704('0x1f')],'contentType':_0x3d6483[_0xe704('0x30')],'data':fs['readFileSync'](_0x1e0aa3)});}}}emlformat['build'](_0x27cd63,function(_0x3cfd87,_0x22cb3e){if(_0x3cfd87)return _0x416ae7(_0x3cfd87);fs[_0xe704('0xe5')](path['join'](_0x5e2de9,util['format'](_0xe704('0xe6'),_0x333dad)),_0x22cb3e);return _0x5d0e1b(_0x22cb3e);});});})[_0xe704('0x2b')](function(){return new BPromise(function(_0x508986,_0x1e854a){zipdir(_0x5e2de9,{'saveTo':_0x4a983e},function(_0x3b2a26,_0x274359){if(_0x3b2a26)return _0x1e854a(_0x3b2a26);return _0x508986(_0x274359);});})[_0xe704('0x2b')](function(){return new BPromise(function(_0x53ad37,_0x13381c){rimraf(_0x5e2de9,function(_0x19f5d6){if(_0x19f5d6)_0x13381c(_0x19f5d6);return _0x53ad37();});});})[_0xe704('0x2b')](function(){return _0x3278bd[_0xe704('0xd1')](_0x4a983e,_0x44da1b,function(_0x54e158){if(!_0x54e158)fs[_0xe704('0xe7')](_0x4a983e);});});});}else{return _0x3278bd[_0xe704('0x11')](0xc8);}})[_0xe704('0x2e')](handleError(_0x3278bd,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index b216f83..78d28d9 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 _0x62b7=['emit','catch','hasOwnProperty','events','../../mysqldb','MailMessage','setMaxListeners','update','remove','then','setDataValue','Users','map','findAll','length'];(function(_0x1b8c71,_0x41d8ab){var _0x539905=function(_0x395edd){while(--_0x395edd){_0x1b8c71['push'](_0x1b8c71['shift']());}};_0x539905(++_0x41d8ab);}(_0x62b7,0xf3));var _0x762b=function(_0x310215,_0x541b20){_0x310215=_0x310215-0x0;var _0x1e9d59=_0x62b7[_0x310215];return _0x1e9d59;};'use strict';var EventEmitter=require(_0x762b('0x0'));var MailInteraction=require(_0x762b('0x1'))['db']['MailInteraction'];var MailMessage=require('../../mysqldb')['db'][_0x762b('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x762b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x762b('0x4'),'afterDestroy':_0x762b('0x5')};function emitEvent(_0x3b8c51){return function(_0x3e92f0,_0x9c7979,_0x1a2d52){_0x3e92f0['getUsers']({'attributes':['id'],'raw':!![]})[_0x762b('0x6')](function(_0x1dc774){_0x3e92f0[_0x762b('0x7')](_0x762b('0x8'),_0x1dc774[_0x762b('0x9')](function(_0x34e607){return{'id':_0x34e607['id']};}));return MailMessage[_0x762b('0xa')]({'where':{'MailInteractionId':_0x3e92f0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x762b('0x6')](function(_0x306134){_0x3e92f0[_0x762b('0x7')]('unreadMessages',_0x306134[_0x762b('0xb')]);MailInteractionEvents[_0x762b('0xc')](_0x3b8c51+':'+_0x3e92f0['id'],_0x3e92f0);MailInteractionEvents['emit'](_0x3b8c51,_0x3e92f0);_0x1a2d52(null);})[_0x762b('0xd')](_0x1a2d52(null));};}for(var e in events){if(events[_0x762b('0xe')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x881e=['emit','catch','hook','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','unreadMessages','length'];(function(_0x5abda7,_0x27e97a){var _0x48d568=function(_0xa7a425){while(--_0xa7a425){_0x5abda7['push'](_0x5abda7['shift']());}};_0x48d568(++_0x27e97a);}(_0x881e,0xa3));var _0xe881=function(_0x387db3,_0xf44bf1){_0x387db3=_0x387db3-0x0;var _0x51b263=_0x881e[_0x387db3];return _0x51b263;};'use strict';var EventEmitter=require(_0xe881('0x0'));var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0xe881('0x1'))['db'][_0xe881('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xe881('0x3')](0x0);var events={'afterCreate':_0xe881('0x4'),'afterUpdate':_0xe881('0x5'),'afterDestroy':_0xe881('0x6')};function emitEvent(_0x5c946c){return function(_0x5c0b87,_0x2eb860,_0x4dce2c){_0x5c0b87[_0xe881('0x7')]({'attributes':['id'],'raw':!![]})[_0xe881('0x8')](function(_0x12f51e){_0x5c0b87[_0xe881('0x9')]('Users',_0x12f51e[_0xe881('0xa')](function(_0x3d7e6c){return{'id':_0x3d7e6c['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x5c0b87['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe881('0x8')](function(_0x56acac){_0x5c0b87[_0xe881('0x9')](_0xe881('0xb'),_0x56acac[_0xe881('0xc')]);MailInteractionEvents[_0xe881('0xd')](_0x5c946c+':'+_0x5c0b87['id'],_0x5c0b87);MailInteractionEvents[_0xe881('0xd')](_0x5c946c,_0x5c0b87);_0x4dce2c(null);})[_0xe881('0xe')](_0x4dce2c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xe881('0xf')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 217bdb3..860bb32 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 _0x4201=['mail_interactions','subject','FULLTEXT','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatusAt','models','get','MailMessage','update','then','utf8mb4','utf8mb4_unicode_ci','lodash','moment','request-promise','path','rimraf','../../config/environment','define','MailInteraction'];(function(_0x7fb981,_0x491033){var _0x12ea5c=function(_0x67b30e){while(--_0x67b30e){_0x7fb981['push'](_0x7fb981['shift']());}};_0x12ea5c(++_0x491033);}(_0x4201,0xc0));var _0x1420=function(_0x1a3243,_0x201872){_0x1a3243=_0x1a3243-0x0;var _0x33f2ca=_0x4201[_0x1a3243];return _0x33f2ca;};'use strict';var _=require(_0x1420('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x1420('0x1'));var BPromise=require('bluebird');var rp=require(_0x1420('0x2'));var fs=require('fs');var path=require(_0x1420('0x3'));var rimraf=require(_0x1420('0x4'));var config=require(_0x1420('0x5'));var attributes=require('./mailInteraction.attributes');module['exports']=function(_0x66b5e6,_0x5c0e07){return _0x66b5e6[_0x1420('0x6')](_0x1420('0x7'),attributes,{'tableName':_0x1420('0x8'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x1420('0x9'),'to'],'type':_0x1420('0xa')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x53a86a,_0x2d2464,_0x3dc7d5){if(_0x53a86a[_0x1420('0xb')]){_0x53a86a['substatusAt']=moment()[_0x1420('0xc')](_0x1420('0xd'));}if(_0x53a86a[_0x1420('0xe')]){_0x53a86a[_0x1420('0xf')]=moment()[_0x1420('0xc')](_0x1420('0xd'));}_0x3dc7d5(null,_0x2d2464);},'beforeUpdate':function(_0x308b27,_0x386451,_0x135317){if(_0x308b27[_0x1420('0x10')](_0x1420('0xb'))){_0x308b27['substatusAt']=_0x308b27[_0x1420('0xb')]?moment()['format'](_0x1420('0xd')):null;}if(_0x308b27['changed'](_0x1420('0xe'))){_0x308b27['closedAt']=moment()[_0x1420('0xc')]('YYYY-MM-DD\x20HH:mm:ss');_0x308b27[_0x1420('0xb')]=null;_0x308b27[_0x1420('0x11')]=null;}_0x135317(null,_0x308b27);},'afterUpdate':function(_0x5eec00,_0x582a2f,_0x3a6064){var _0x2a7d79=_0x66b5e6[_0x1420('0x12')];var _0x52ce85=_0x5eec00[_0x1420('0x13')]({'plain':!![]});if(_0x52ce85[_0x1420('0xe')]){return _0x2a7d79[_0x1420('0x14')][_0x1420('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x52ce85['id']}})[_0x1420('0x16')](function(){_0x3a6064();})['catch'](function(_0x26c0ec){_0x3a6064(_0x26c0ec);});}else{_0x3a6064();}}},'charset':_0x1420('0x17'),'collate':_0x1420('0x18')});}; \ No newline at end of file +var _0x81f2=['YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','get','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','moment','bluebird','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x81f2,0x169));var _0x281f=function(_0x56bcff,_0x158e5f){_0x56bcff=_0x56bcff-0x0;var _0x340351=_0x81f2[_0x56bcff];return _0x340351;};'use strict';var _=require(_0x281f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x281f('0x1'));var BPromise=require(_0x281f('0x2'));var rp=require(_0x281f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x281f('0x4'));var config=require(_0x281f('0x5'));var attributes=require(_0x281f('0x6'));module[_0x281f('0x7')]=function(_0x4f076e,_0x49dc37){return _0x4f076e[_0x281f('0x8')](_0x281f('0x9'),attributes,{'tableName':_0x281f('0xa'),'paranoid':![],'indexes':[{'name':_0x281f('0xb'),'fields':[_0x281f('0xc'),'to'],'type':_0x281f('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2f4497,_0xc7000c,_0x3cf8f7){if(_0x2f4497[_0x281f('0xe')]){_0x2f4497[_0x281f('0xf')]=moment()[_0x281f('0x10')](_0x281f('0x11'));}if(_0x2f4497[_0x281f('0x12')]){_0x2f4497[_0x281f('0x13')]=moment()[_0x281f('0x10')](_0x281f('0x11'));}_0x3cf8f7(null,_0xc7000c);},'beforeUpdate':function(_0x5cc278,_0xb88973,_0x7ab972){if(_0x5cc278['changed'](_0x281f('0xe'))){_0x5cc278[_0x281f('0xf')]=_0x5cc278[_0x281f('0xe')]?moment()[_0x281f('0x10')](_0x281f('0x11')):null;}if(_0x5cc278[_0x281f('0x14')](_0x281f('0x12'))){_0x5cc278[_0x281f('0x13')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5cc278[_0x281f('0xe')]=null;_0x5cc278[_0x281f('0xf')]=null;}_0x7ab972(null,_0x5cc278);},'afterUpdate':function(_0x153b6a,_0x17e9f0,_0x5c417d){var _0x52e8f9=_0x4f076e['models'];var _0x44272a=_0x153b6a[_0x281f('0x15')]({'plain':!![]});if(_0x44272a[_0x281f('0x12')]){return _0x52e8f9['MailMessage'][_0x281f('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x44272a['id']}})[_0x281f('0x17')](function(){_0x5c417d();})[_0x281f('0x18')](function(_0x23566e){_0x5c417d(_0x23566e);});}else{_0x5c417d();}}},'charset':_0x281f('0x19'),'collate':_0x281f('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index cef8fb3..fda49d1 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 _0x33dc=['bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailInteraction.socket','info','MailInteraction,\x20%s,\x20%s','debug','error','message','request\x20sent','result','catch','UpdateMailInteraction','MailInteraction','body','options','where','then','stringify','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags','util','moment'];(function(_0x6ca7f4,_0x51a5df){var _0x494fa6=function(_0x359532){while(--_0x359532){_0x6ca7f4['push'](_0x6ca7f4['shift']());}};_0x494fa6(++_0x51a5df);}(_0x33dc,0x126));var _0xc33d=function(_0x374ada,_0x27b3a5){_0x374ada=_0x374ada-0x0;var _0x449ed8=_0x33dc[_0x374ada];return _0x449ed8;};'use strict';var _=require('lodash');var util=require(_0xc33d('0x0'));var moment=require(_0xc33d('0x1'));var BPromise=require(_0xc33d('0x2'));var rs=require(_0xc33d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc33d('0x4'));var logger=require(_0xc33d('0x5'))(_0xc33d('0x6'));var config=require(_0xc33d('0x7'));var jayson=require(_0xc33d('0x8'));var client=jayson[_0xc33d('0x9')][_0xc33d('0xa')]({'port':0x232a});config[_0xc33d('0xb')]=_[_0xc33d('0xc')](config[_0xc33d('0xb')],{'host':_0xc33d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc33d('0xb')]));require(_0xc33d('0xe'))['register'](socket);function respondWithRpcPromise(_0x7a4d7e,_0xaa1add,_0x35b98c){return new BPromise(function(_0x3e8a1e,_0xb97e09){return client['request'](_0x7a4d7e,_0x35b98c)['then'](function(_0x54f4b0){logger[_0xc33d('0xf')](_0xc33d('0x10'),_0xaa1add,'request\x20sent');logger[_0xc33d('0x11')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0xaa1add,'request\x20sent',JSON['stringify'](_0x54f4b0));if(_0x54f4b0[_0xc33d('0x12')]){if(_0x54f4b0[_0xc33d('0x12')]['code']===0x1f4){logger['error']('MailInteraction,\x20%s,\x20%s',_0xaa1add,_0x54f4b0[_0xc33d('0x12')][_0xc33d('0x13')]);return _0xb97e09(_0x54f4b0[_0xc33d('0x12')][_0xc33d('0x13')]);}logger['error'](_0xc33d('0x10'),_0xaa1add,_0x54f4b0['error'][_0xc33d('0x13')]);return _0x3e8a1e(_0x54f4b0[_0xc33d('0x12')][_0xc33d('0x13')]);}else{logger[_0xc33d('0xf')](_0xc33d('0x10'),_0xaa1add,_0xc33d('0x14'));_0x3e8a1e(_0x54f4b0[_0xc33d('0x15')][_0xc33d('0x13')]);}})[_0xc33d('0x16')](function(_0x5cf8a2){logger[_0xc33d('0x12')](_0xc33d('0x10'),_0xaa1add,_0x5cf8a2);_0xb97e09(_0x5cf8a2);});});}exports[_0xc33d('0x17')]=function(_0x2ec471){var _0x2c7a06=this;return new Promise(function(_0x162bed,_0x4b0ab7){return db[_0xc33d('0x18')]['update'](_0x2ec471[_0xc33d('0x19')],{'raw':_0x2ec471[_0xc33d('0x1a')]?_0x2ec471[_0xc33d('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ec471[_0xc33d('0x1a')]?_0x2ec471[_0xc33d('0x1a')][_0xc33d('0x1b')]||null:null,'attributes':_0x2ec471['options']?_0x2ec471[_0xc33d('0x1a')]['attributes']||null:null,'limit':_0x2ec471['options']?_0x2ec471[_0xc33d('0x1a')]['limit']||null:null})[_0xc33d('0x1c')](function(_0x54bc0a){logger['info']('UpdateMailInteraction',_0x2ec471);logger[_0xc33d('0x11')]('UpdateMailInteraction',_0x2ec471,JSON[_0xc33d('0x1d')](_0x54bc0a));_0x162bed(_0x54bc0a);})[_0xc33d('0x16')](function(_0x5f24b9){logger[_0xc33d('0x12')](_0xc33d('0x17'),_0x5f24b9[_0xc33d('0x13')],_0x2ec471);_0x4b0ab7(_0x2c7a06['error'](0x1f4,_0x5f24b9['message']));});});};exports[_0xc33d('0x1e')]=function(_0x60d4ca){return new Promise(function(_0x1d1cd5,_0xee4956){return db[_0xc33d('0x18')][_0xc33d('0x1f')]({'where':_0x60d4ca[_0xc33d('0x1a')]?_0x60d4ca['options'][_0xc33d('0x1b')]||null:null})[_0xc33d('0x1c')](function(_0x332366){if(_0x332366){return _0x332366[_0xc33d('0x20')](_0x60d4ca[_0xc33d('0x19')][_0xc33d('0x21')],_[_0xc33d('0x22')](_0x60d4ca[_0xc33d('0x19')],[_0xc33d('0x21'),'id'])||{});}})[_0xc33d('0x23')](function(_0x57c3bb){logger[_0xc33d('0xf')]('AddTags',_0x60d4ca);logger[_0xc33d('0x11')](_0xc33d('0x24'),_0x60d4ca,JSON[_0xc33d('0x1d')](_0x57c3bb));_0x1d1cd5(_0x57c3bb);})['catch'](function(_0x384dae){logger[_0xc33d('0x12')](_0xc33d('0x24'),_0x384dae[_0xc33d('0x13')],_0x60d4ca);_0xee4956(_this[_0xc33d('0x12')](0x1f4,_0x384dae[_0xc33d('0x13')]));});});}; \ No newline at end of file +var _0x507b=['omit','ids','spread','AddTags','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToMailInteraction','addTags'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x507b,0x187));var _0xb507=function(_0x163ab5,_0x6a7dbe){_0x163ab5=_0x163ab5-0x0;var _0x17e579=_0x507b[_0x163ab5];return _0x17e579;};'use strict';var _=require('lodash');var util=require(_0xb507('0x0'));var moment=require('moment');var BPromise=require(_0xb507('0x1'));var rs=require(_0xb507('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb507('0x3'))['db'];var utils=require(_0xb507('0x4'));var logger=require(_0xb507('0x5'))(_0xb507('0x6'));var config=require(_0xb507('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb507('0x8')][_0xb507('0x9')]({'port':0x232a});config[_0xb507('0xa')]=_[_0xb507('0xb')](config[_0xb507('0xa')],{'host':_0xb507('0xc'),'port':0x18eb});var socket=require(_0xb507('0xd'))(new Redis(config[_0xb507('0xa')]));require(_0xb507('0xe'))[_0xb507('0xf')](socket);function respondWithRpcPromise(_0x24e1e2,_0x2169b1,_0xdfd8a4){return new BPromise(function(_0x17acae,_0x10470){return client[_0xb507('0x10')](_0x24e1e2,_0xdfd8a4)[_0xb507('0x11')](function(_0x4a111a){logger[_0xb507('0x12')](_0xb507('0x13'),_0x2169b1,_0xb507('0x14'));logger[_0xb507('0x15')](_0xb507('0x16'),_0x2169b1,_0xb507('0x14'),JSON['stringify'](_0x4a111a));if(_0x4a111a[_0xb507('0x17')]){if(_0x4a111a['error']['code']===0x1f4){logger['error'](_0xb507('0x13'),_0x2169b1,_0x4a111a[_0xb507('0x17')]['message']);return _0x10470(_0x4a111a[_0xb507('0x17')][_0xb507('0x18')]);}logger['error'](_0xb507('0x13'),_0x2169b1,_0x4a111a[_0xb507('0x17')][_0xb507('0x18')]);return _0x17acae(_0x4a111a[_0xb507('0x17')][_0xb507('0x18')]);}else{logger[_0xb507('0x12')](_0xb507('0x13'),_0x2169b1,_0xb507('0x14'));_0x17acae(_0x4a111a[_0xb507('0x19')][_0xb507('0x18')]);}})[_0xb507('0x1a')](function(_0x255b93){logger[_0xb507('0x17')](_0xb507('0x13'),_0x2169b1,_0x255b93);_0x10470(_0x255b93);});});}exports[_0xb507('0x1b')]=function(_0xcfe04c){var _0x5d8570=this;return new Promise(function(_0x70c8b5,_0x5a2570){return db[_0xb507('0x1c')][_0xb507('0x1d')](_0xcfe04c[_0xb507('0x1e')],{'raw':_0xcfe04c[_0xb507('0x1f')]?_0xcfe04c[_0xb507('0x1f')][_0xb507('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcfe04c[_0xb507('0x1f')]?_0xcfe04c[_0xb507('0x1f')][_0xb507('0x21')]||null:null,'attributes':_0xcfe04c[_0xb507('0x1f')]?_0xcfe04c[_0xb507('0x1f')][_0xb507('0x22')]||null:null,'limit':_0xcfe04c['options']?_0xcfe04c[_0xb507('0x1f')][_0xb507('0x23')]||null:null})[_0xb507('0x11')](function(_0x46ff83){logger[_0xb507('0x12')](_0xb507('0x1b'),_0xcfe04c);logger['debug']('UpdateMailInteraction',_0xcfe04c,JSON[_0xb507('0x24')](_0x46ff83));_0x70c8b5(_0x46ff83);})[_0xb507('0x1a')](function(_0x5f12fa){logger['error'](_0xb507('0x1b'),_0x5f12fa['message'],_0xcfe04c);_0x5a2570(_0x5d8570[_0xb507('0x17')](0x1f4,_0x5f12fa['message']));});});};exports[_0xb507('0x25')]=function(_0x3f1f72){return new Promise(function(_0x7ffa9e,_0xa018bf){return db['MailInteraction']['find']({'where':_0x3f1f72['options']?_0x3f1f72[_0xb507('0x1f')][_0xb507('0x21')]||null:null})[_0xb507('0x11')](function(_0x5ab220){if(_0x5ab220){return _0x5ab220[_0xb507('0x26')](_0x3f1f72['body']['ids'],_[_0xb507('0x27')](_0x3f1f72[_0xb507('0x1e')],[_0xb507('0x28'),'id'])||{});}})[_0xb507('0x29')](function(_0x523cb5){logger['info'](_0xb507('0x2a'),_0x3f1f72);logger['debug'](_0xb507('0x2a'),_0x3f1f72,JSON[_0xb507('0x24')](_0x523cb5));_0x7ffa9e(_0x523cb5);})[_0xb507('0x1a')](function(_0x5be766){logger[_0xb507('0x17')](_0xb507('0x2a'),_0x5be766[_0xb507('0x18')],_0x3f1f72);_0xa018bf(_this[_0xb507('0x17')](0x1f4,_0x5be766[_0xb507('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 4a0d5ea..0ad0092 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 _0xcb9a=['removeListener','length','mailInteraction:','./mailInteraction.events','save','remove','update','emit'];(function(_0x10c16d,_0x2b3e14){var _0x5896f4=function(_0x4306b9){while(--_0x4306b9){_0x10c16d['push'](_0x10c16d['shift']());}};_0x5896f4(++_0x2b3e14);}(_0xcb9a,0x1a3));var _0xacb9=function(_0x58efa6,_0x2c00bd){_0x58efa6=_0x58efa6-0x0;var _0x5d643c=_0xcb9a[_0x58efa6];return _0x5d643c;};'use strict';var MailInteractionEvents=require(_0xacb9('0x0'));var events=[_0xacb9('0x1'),_0xacb9('0x2'),_0xacb9('0x3')];function createListener(_0xe3e78d,_0x3b21d9){return function(_0x246777){_0x3b21d9[_0xacb9('0x4')](_0xe3e78d,_0x246777);};}function removeListener(_0x326a54,_0x2a5a19){return function(){MailInteractionEvents[_0xacb9('0x5')](_0x326a54,_0x2a5a19);};}exports['register']=function(_0x209d29){for(var _0x31c5a4=0x0,_0x1d8f44=events[_0xacb9('0x6')];_0x31c5a4<_0x1d8f44;_0x31c5a4++){var _0x442e1d=events[_0x31c5a4];var _0x3bb707=createListener(_0xacb9('0x7')+_0x442e1d,_0x209d29);MailInteractionEvents['on'](_0x442e1d,_0x3bb707);}}; \ No newline at end of file +var _0xf58b=['mailInteraction:','./mailInteraction.events','save','update','removeListener','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf58b,0x9b));var _0xbf58=function(_0x4ada50,_0x54757b){_0x4ada50=_0x4ada50-0x0;var _0x3d85d5=_0xf58b[_0x4ada50];return _0x3d85d5;};'use strict';var MailInteractionEvents=require(_0xbf58('0x0'));var events=[_0xbf58('0x1'),'remove',_0xbf58('0x2')];function createListener(_0x9325e1,_0x58d4fe){return function(_0x4d1a5a){_0x58d4fe['emit'](_0x9325e1,_0x4d1a5a);};}function removeListener(_0x1cfd6a,_0x2f7437){return function(){MailInteractionEvents[_0xbf58('0x3')](_0x1cfd6a,_0x2f7437);};}exports[_0xbf58('0x4')]=function(_0x746b68){for(var _0x252b7a=0x0,_0x35f2a5=events[_0xbf58('0x5')];_0x252b7a<_0x35f2a5;_0x252b7a++){var _0x14a20d=events[_0x252b7a];var _0x14b6a7=createListener(_0xbf58('0x6')+_0x14a20d,_0x746b68);MailInteractionEvents['on'](_0x14a20d,_0x14b6a7);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index a08900d..7944ca1 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 _0x609a=['../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','/:id','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x44b711,_0x1edfb5){var _0x2f345b=function(_0x5eb01a){while(--_0x5eb01a){_0x44b711['push'](_0x44b711['shift']());}};_0x2f345b(++_0x1edfb5);}(_0x609a,0x11c));var _0xa609=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x609a[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0xa609('0x0'));var util=require(_0xa609('0x1'));var path=require('path');var timeout=require(_0xa609('0x2'));var express=require(_0xa609('0x3'));var router=express['Router']();var fs_extra=require(_0xa609('0x4'));var auth=require(_0xa609('0x5'));var interaction=require(_0xa609('0x6'));var config=require('../../config/environment');var controller=require('./mailMessage.controller');router[_0xa609('0x7')]('/',auth[_0xa609('0x8')](),controller[_0xa609('0x9')]);router[_0xa609('0x7')](_0xa609('0xa'),auth[_0xa609('0x8')](),controller[_0xa609('0xb')]);router[_0xa609('0x7')]('/:id',auth[_0xa609('0x8')](),controller[_0xa609('0xc')]);router[_0xa609('0x7')](_0xa609('0xd'),auth[_0xa609('0x8')](),controller[_0xa609('0xe')]);router[_0xa609('0xf')]('/',auth[_0xa609('0x8')](),interaction[_0xa609('0x10')](_0xa609('0x11'),_0xa609('0x12')),controller[_0xa609('0x13')]);router[_0xa609('0x14')](_0xa609('0x15'),auth[_0xa609('0x8')](),controller[_0xa609('0x16')]);router[_0xa609('0x14')](_0xa609('0x17'),auth['isAuthenticated'](),controller[_0xa609('0x18')]);router[_0xa609('0x14')](_0xa609('0x19'),auth[_0xa609('0x8')](),controller['reject']);router[_0xa609('0x1a')](_0xa609('0x15'),auth[_0xa609('0x8')](),controller[_0xa609('0x1b')]);module[_0xa609('0x1c')]=router; \ No newline at end of file +var _0x18a9=['/:id/accept','accept','/:id/reject','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id/download','download','post','tracked','mail','mailmessage:create','create','/:id','update'];(function(_0x5d1db0,_0x49c393){var _0x1f0d24=function(_0x48215d){while(--_0x48215d){_0x5d1db0['push'](_0x5d1db0['shift']());}};_0x1f0d24(++_0x49c393);}(_0x18a9,0x17e));var _0x918a=function(_0x6b594e,_0x271521){_0x6b594e=_0x6b594e-0x0;var _0x5d19a6=_0x18a9[_0x6b594e];return _0x5d19a6;};'use strict';var multer=require(_0x918a('0x0'));var util=require('util');var path=require(_0x918a('0x1'));var timeout=require('connect-timeout');var express=require(_0x918a('0x2'));var router=express[_0x918a('0x3')]();var fs_extra=require(_0x918a('0x4'));var auth=require(_0x918a('0x5'));var interaction=require(_0x918a('0x6'));var config=require(_0x918a('0x7'));var controller=require(_0x918a('0x8'));router[_0x918a('0x9')]('/',auth[_0x918a('0xa')](),controller[_0x918a('0xb')]);router['get'](_0x918a('0xc'),auth['isAuthenticated'](),controller[_0x918a('0xd')]);router[_0x918a('0x9')]('/:id',auth[_0x918a('0xa')](),controller['show']);router[_0x918a('0x9')](_0x918a('0xe'),auth[_0x918a('0xa')](),controller[_0x918a('0xf')]);router[_0x918a('0x10')]('/',auth['isAuthenticated'](),interaction[_0x918a('0x11')](_0x918a('0x12'),_0x918a('0x13')),controller[_0x918a('0x14')]);router['put'](_0x918a('0x15'),auth[_0x918a('0xa')](),controller[_0x918a('0x16')]);router['put'](_0x918a('0x17'),auth[_0x918a('0xa')](),controller[_0x918a('0x18')]);router['put'](_0x918a('0x19'),auth[_0x918a('0xa')](),controller['reject']);router['delete'](_0x918a('0x15'),auth[_0x918a('0xa')](),controller[_0x918a('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 74040e3..16c9494 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 _0xc022=['Chat','sequelize','lodash','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Email'];(function(_0x2a5d9e,_0x54e3cf){var _0x22cae9=function(_0x3d5f22){while(--_0x3d5f22){_0x2a5d9e['push'](_0x2a5d9e['shift']());}};_0x22cae9(++_0x54e3cf);}(_0xc022,0xd1));var _0x2c02=function(_0x53ed0b,_0x25e205){_0x53ed0b=_0x53ed0b-0x0;var _0x453628=_0xc022[_0x53ed0b];return _0x453628;};'use strict';var Sequelize=require(_0x2c02('0x0'));var _=require(_0x2c02('0x1'));module['exports']={'body':{'type':Sequelize[_0x2c02('0x2')](_0x2c02('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x2c02('0x2')](_0x2c02('0x4'))},'read':{'type':Sequelize[_0x2c02('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2c02('0x6')]('in',_0x2c02('0x7')),'defaultValue':_0x2c02('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x2c02('0x8')]},'to':{'type':Sequelize[_0x2c02('0x2')](_0x2c02('0x3'))},'cc':{'type':Sequelize['TEXT'](_0x2c02('0x3'))},'bcc':{'type':Sequelize['TEXT'](_0x2c02('0x3'))},'subject':{'type':Sequelize[_0x2c02('0x2')]},'sentAt':{'type':Sequelize[_0x2c02('0x9')]},'attach':{'type':Sequelize[_0x2c02('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x2c02('0x9')]},'originTo':{'type':Sequelize['TEXT'](_0x2c02('0x3'))},'originCc':{'type':Sequelize[_0x2c02('0x2')]('long')},'originChannel':{'type':Sequelize[_0x2c02('0x6')](_0x2c02('0xb'),_0x2c02('0xc')),'defaultValue':_0x2c02('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x2337=['long','medium','out','STRING','DATE','INTEGER','BOOLEAN','ENUM','Email','Chat','lodash','exports','TEXT'];(function(_0x5b2a5e,_0x5858d1){var _0x340630=function(_0x3cfe19){while(--_0x3cfe19){_0x5b2a5e['push'](_0x5b2a5e['shift']());}};_0x340630(++_0x5858d1);}(_0x2337,0x8c));var _0x7233=function(_0x1323e7,_0x3eebfe){_0x1323e7=_0x1323e7-0x0;var _0x1486dd=_0x2337[_0x1323e7];return _0x1486dd;};'use strict';var Sequelize=require('sequelize');var _=require(_0x7233('0x0'));module[_0x7233('0x1')]={'body':{'type':Sequelize[_0x7233('0x2')](_0x7233('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x7233('0x2')](_0x7233('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x7233('0x5')),'defaultValue':_0x7233('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x7233('0x6')]},'to':{'type':Sequelize[_0x7233('0x2')](_0x7233('0x3'))},'cc':{'type':Sequelize[_0x7233('0x2')](_0x7233('0x3'))},'bcc':{'type':Sequelize[_0x7233('0x2')](_0x7233('0x3'))},'subject':{'type':Sequelize[_0x7233('0x2')]},'sentAt':{'type':Sequelize[_0x7233('0x7')]},'attach':{'type':Sequelize[_0x7233('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x7233('0x9')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x7233('0x7')]},'originTo':{'type':Sequelize[_0x7233('0x2')](_0x7233('0x3'))},'originCc':{'type':Sequelize[_0x7233('0x2')](_0x7233('0x3'))},'originChannel':{'type':Sequelize[_0x7233('0xa')](_0x7233('0xb'),_0x7233('0xc')),'defaultValue':_0x7233('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 4bc1648..ca7e09b 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 _0x78d9=['error','code','message','status','offset','undefined','count','limit','set','Content-Range','json','update','destroy','end','sendStatus','stack','name','map','MailMessage','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','body','describe','out','secret','split','MailAccount','MailAccountId','CmList','CmContact','Contacts','DESC','MailServerOut','Smtp','isNil','service','host','port','authentication','auth','pass','secure','attachments','join','List','create','ListId','List\x20not\x20found','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','agent','MailInteraction','MailInteractionId','UserId','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','motionChannel','channel','event','EventManager','acceptmessage','reject','get','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','interface','unix','toString','root','server','tmp','files','message-%s.eml','bcc','subject','createdAt','Attachment','Attachments','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','push','readFileSync','build','writeFileSync','download','unlinkSync','eml-format','moment','bluebird','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','mail-interactions','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x78d9,0x8c));var _0x978d=function(_0x40e42a,_0x52e2ca){_0x40e42a=_0x40e42a-0x0;var _0x1107ad=_0x78d9[_0x40e42a];return _0x1107ad;};'use strict';var emlformat=require(_0x978d('0x0'));var moment=require(_0x978d('0x1'));var BPromise=require(_0x978d('0x2'));var util=require('util');var path=require(_0x978d('0x3'));var fs=require('fs');var _=require(_0x978d('0x4'));var Redis=require(_0x978d('0x5'));var htmlToText=require(_0x978d('0x6'));var qs=require(_0x978d('0x7'));var logger=require(_0x978d('0x8'))('api');var interaction_log=require(_0x978d('0x8'))(_0x978d('0x9'));var config=require('../../config/environment');var db=require(_0x978d('0xa'))['db'];config[_0x978d('0xb')]=_[_0x978d('0xc')](config['redis'],{'host':_0x978d('0xd'),'port':0x18eb});var socket=require(_0x978d('0xe'))(new Redis(config[_0x978d('0xb')]));var htmlEntities=require('html-entities');require(_0x978d('0xf'))[_0x978d('0x10')](socket);var jayson=require(_0x978d('0x11'));var client=jayson[_0x978d('0x12')][_0x978d('0x13')]({'port':0x232c});var client9003=jayson[_0x978d('0x12')]['http']({'port':0x232b});var client9002=jayson[_0x978d('0x12')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53e1ef,_0x191dff,_0x152e9f,_0x11ab2e){return new BPromise(function(_0x28ed6d,_0x367a75){var _0x4b1133=_0x11ab2e||client;return _0x4b1133[_0x978d('0x14')](_0x53e1ef,_0x152e9f)[_0x978d('0x15')](function(_0x1fdadb){logger[_0x978d('0x16')](_0x978d('0x17'),_0x191dff,'request\x20sent');logger['debug'](_0x978d('0x18'),_0x191dff,_0x978d('0x19'),JSON['stringify'](_0x1fdadb));if(_0x1fdadb[_0x978d('0x1a')]){if(_0x1fdadb[_0x978d('0x1a')][_0x978d('0x1b')]===0x1f4){logger[_0x978d('0x1a')](_0x978d('0x17'),_0x191dff,_0x1fdadb[_0x978d('0x1a')]['message']);return _0x367a75(_0x1fdadb[_0x978d('0x1a')][_0x978d('0x1c')]);}logger[_0x978d('0x1a')](_0x978d('0x17'),_0x191dff,_0x1fdadb[_0x978d('0x1a')][_0x978d('0x1c')]);return _0x28ed6d(_0x1fdadb[_0x978d('0x1a')][_0x978d('0x1c')]);}else{logger[_0x978d('0x16')](_0x978d('0x17'),_0x191dff,_0x978d('0x19'));_0x28ed6d(_0x1fdadb['result'][_0x978d('0x1c')]);}})['catch'](function(_0xdf278e){logger[_0x978d('0x1a')](_0x978d('0x17'),_0x191dff,_0xdf278e);_0x367a75(_0xdf278e);});});}function respondWithResult(_0x146966,_0x2aa073){_0x2aa073=_0x2aa073||0xc8;return function(_0x35f81d){if(_0x35f81d){return _0x146966[_0x978d('0x1d')](_0x2aa073)['json'](_0x35f81d);}};}function respondWithFilteredResult(_0x5c5575,_0x1d3994){return function(_0x36b6d1){if(_0x36b6d1){var _0xaa0b3e=typeof _0x1d3994[_0x978d('0x1e')]===_0x978d('0x1f')&&typeof _0x1d3994['limit']===_0x978d('0x1f');var _0x22aa40=_0x36b6d1['count'];var _0x8eaf62=_0xaa0b3e?0x0:_0x1d3994['offset'];var _0x1021d0=_0xaa0b3e?_0x36b6d1[_0x978d('0x20')]:_0x1d3994['offset']+_0x1d3994[_0x978d('0x21')];var _0x39c1db;if(_0x1021d0>=_0x22aa40){_0x1021d0=_0x22aa40;_0x39c1db=0xc8;}else{_0x39c1db=0xce;}_0x5c5575[_0x978d('0x1d')](_0x39c1db);return _0x5c5575[_0x978d('0x22')](_0x978d('0x23'),_0x8eaf62+'-'+_0x1021d0+'/'+_0x22aa40)[_0x978d('0x24')](_0x36b6d1);}return null;};}function saveUpdates(_0xce13b7){return function(_0x5319d9){if(_0x5319d9){return _0x5319d9[_0x978d('0x25')](_0xce13b7)[_0x978d('0x15')](function(_0x3336f8){return _0x3336f8;});}return null;};}function removeEntity(_0x4ec073){return function(_0x1ba0a3){if(_0x1ba0a3){return _0x1ba0a3[_0x978d('0x26')]()[_0x978d('0x15')](function(){_0x4ec073['status'](0xcc)[_0x978d('0x27')]();});}};}function handleEntityNotFound(_0x228606){return function(_0x737780){if(!_0x737780){_0x228606[_0x978d('0x28')](0x194);}return _0x737780;};}function handleError(_0x43418f,_0x57a71c){_0x57a71c=_0x57a71c||0x1f4;return function(_0x4c17b4){logger['error'](_0x4c17b4[_0x978d('0x29')]);if(_0x4c17b4[_0x978d('0x2a')]){delete _0x4c17b4[_0x978d('0x2a')];}_0x43418f['status'](_0x57a71c)['send'](_0x4c17b4);};}exports['index']=function(_0x2af912,_0x3d0d37){var _0x300640={},_0x37d055={},_0x44b658={'count':0x0,'rows':[]};var _0x467620=_[_0x978d('0x2b')](db[_0x978d('0x2c')][_0x978d('0x2d')],function(_0x11764d){return{'name':_0x11764d[_0x978d('0x2e')],'type':_0x11764d[_0x978d('0x2f')]['key']};});_0x37d055[_0x978d('0x30')]=_[_0x978d('0x2b')](_0x467620,_0x978d('0x2a'));_0x37d055['query']=_[_0x978d('0x31')](_0x2af912[_0x978d('0x32')]);_0x37d055[_0x978d('0x33')]=_['intersection'](_0x37d055[_0x978d('0x30')],_0x37d055[_0x978d('0x32')]);_0x300640[_0x978d('0x34')]=_[_0x978d('0x35')](_0x37d055[_0x978d('0x30')],qs['fields'](_0x2af912[_0x978d('0x32')][_0x978d('0x36')]));_0x300640[_0x978d('0x34')]=_0x300640[_0x978d('0x34')][_0x978d('0x37')]?_0x300640[_0x978d('0x34')]:_0x37d055[_0x978d('0x30')];if(!_0x2af912[_0x978d('0x32')][_0x978d('0x38')]('nolimit')){_0x300640['limit']=qs[_0x978d('0x21')](_0x2af912['query'][_0x978d('0x21')]);_0x300640[_0x978d('0x1e')]=qs['offset'](_0x2af912[_0x978d('0x32')][_0x978d('0x1e')]);}_0x300640[_0x978d('0x39')]=qs['sort'](_0x2af912['query'][_0x978d('0x3a')]);_0x300640[_0x978d('0x3b')]=qs[_0x978d('0x33')](_[_0x978d('0x3c')](_0x2af912[_0x978d('0x32')],_0x37d055['filters']),_0x467620);if(_0x2af912[_0x978d('0x32')][_0x978d('0x3d')]){_0x300640[_0x978d('0x3b')]=_[_0x978d('0x3e')](_0x300640[_0x978d('0x3b')],{'$or':_['map'](_0x467620,function(_0x1b33ab){if(_0x1b33ab['type']!==_0x978d('0x3f')){var _0x5aca0d={};_0x5aca0d[_0x1b33ab[_0x978d('0x2a')]]={'$like':'%'+_0x2af912[_0x978d('0x32')][_0x978d('0x3d')]+'%'};return _0x5aca0d;}})});}_0x300640=_['merge']({},_0x300640,_0x2af912[_0x978d('0x40')]);var _0x373c93={'where':_0x300640[_0x978d('0x3b')]};return db[_0x978d('0x2c')][_0x978d('0x20')](_0x373c93)[_0x978d('0x15')](function(_0x48f0cf){_0x44b658[_0x978d('0x20')]=_0x48f0cf;if(_0x2af912[_0x978d('0x32')][_0x978d('0x41')]){_0x300640['include']=[{'all':!![]}];}return db[_0x978d('0x2c')][_0x978d('0x42')](_0x300640);})['then'](function(_0x5c183e){_0x44b658[_0x978d('0x43')]=_0x5c183e;return _0x44b658;})[_0x978d('0x15')](respondWithFilteredResult(_0x3d0d37,_0x300640))[_0x978d('0x44')](handleError(_0x3d0d37,null));};exports[_0x978d('0x45')]=function(_0x2ba534,_0x3df640){var _0x2fa6bc={'raw':!![],'where':{'id':_0x2ba534[_0x978d('0x46')]['id']}},_0x1fd3a0={};_0x1fd3a0[_0x978d('0x30')]=_[_0x978d('0x31')](db[_0x978d('0x2c')][_0x978d('0x2d')]);_0x1fd3a0['query']=_['keys'](_0x2ba534[_0x978d('0x32')]);_0x1fd3a0[_0x978d('0x33')]=_[_0x978d('0x35')](_0x1fd3a0['model'],_0x1fd3a0[_0x978d('0x32')]);_0x2fa6bc[_0x978d('0x34')]=_['intersection'](_0x1fd3a0[_0x978d('0x30')],qs[_0x978d('0x36')](_0x2ba534[_0x978d('0x32')][_0x978d('0x36')]));_0x2fa6bc[_0x978d('0x34')]=_0x2fa6bc['attributes'][_0x978d('0x37')]?_0x2fa6bc[_0x978d('0x34')]:_0x1fd3a0[_0x978d('0x30')];if(_0x2ba534[_0x978d('0x32')][_0x978d('0x41')]){_0x2fa6bc[_0x978d('0x47')]=[{'all':!![]}];}_0x2fa6bc=_[_0x978d('0x3e')]({},_0x2fa6bc,_0x2ba534[_0x978d('0x40')]);return db[_0x978d('0x2c')][_0x978d('0x48')](_0x2fa6bc)[_0x978d('0x15')](handleEntityNotFound(_0x3df640,null))[_0x978d('0x15')](respondWithResult(_0x3df640,null))[_0x978d('0x44')](handleError(_0x3df640,null));};exports[_0x978d('0x25')]=function(_0x1bdabd,_0x266a16){if(_0x1bdabd['body']['id']){delete _0x1bdabd[_0x978d('0x49')]['id'];}return db[_0x978d('0x2c')]['find']({'where':{'id':_0x1bdabd['params']['id']}})[_0x978d('0x15')](handleEntityNotFound(_0x266a16,null))[_0x978d('0x15')](saveUpdates(_0x1bdabd[_0x978d('0x49')],null))[_0x978d('0x15')](respondWithResult(_0x266a16,null))[_0x978d('0x44')](handleError(_0x266a16,null));};exports[_0x978d('0x26')]=function(_0x5bd737,_0x3b6853){return db['MailMessage'][_0x978d('0x48')]({'where':{'id':_0x5bd737[_0x978d('0x46')]['id']}})[_0x978d('0x15')](handleEntityNotFound(_0x3b6853,null))[_0x978d('0x15')](removeEntity(_0x3b6853,null))[_0x978d('0x44')](handleError(_0x3b6853,null));};exports[_0x978d('0x4a')]=function(_0x5bed1c,_0x1fc588){return db[_0x978d('0x2c')][_0x978d('0x4a')]()[_0x978d('0x15')](respondWithResult(_0x1fc588,null))[_0x978d('0x44')](handleError(_0x1fc588,null));};exports['create']=function(_0xa895e5,_0x3f2fb0){return db['MailMessage']['create'](_0xa895e5[_0x978d('0x49')])[_0x978d('0x15')](function(_0x490ebc){if(_0x490ebc){if(_0x490ebc['direction']===_0x978d('0x4b')&&!_0x490ebc[_0x978d('0x4c')]){var _0x5f466a,_0x347703,_0x1e1716;if(_0xa895e5[_0x978d('0x49')]['to']){_0x347703=_0xa895e5[_0x978d('0x49')]['to'][_0x978d('0x4d')](',')[0x0];}return db[_0x978d('0x4e')]['findOne']({'where':{'id':_0x490ebc[_0x978d('0x4f')]},'include':[{'model':db[_0x978d('0x50')],'as':'List','include':[{'model':db[_0x978d('0x51')],'as':_0x978d('0x52'),'where':{'email':_0x347703},'limit':0x1,'order':[['updatedAt',_0x978d('0x53')]]}]},{'model':db[_0x978d('0x54')],'as':_0x978d('0x55'),'raw':!![]}]})[_0x978d('0x15')](function(_0x17dedf){_0x5f466a=_0x17dedf;if(_0x5f466a&&_0x5f466a[_0x978d('0x55')]){var _0x578f46={'tls':{'rejectUnauthorized':![]}};if(_[_0x978d('0x56')](_0x5f466a['Smtp'][_0x978d('0x57')])){_0x578f46[_0x978d('0x58')]=_0x5f466a[_0x978d('0x55')][_0x978d('0x58')];_0x578f46[_0x978d('0x59')]=_0x5f466a[_0x978d('0x55')][_0x978d('0x59')];_0x578f46['secure']=_0x5f466a['Smtp']['secure'];if(_0x5f466a[_0x978d('0x55')][_0x978d('0x5a')]){_0x578f46[_0x978d('0x5b')]={'user':_0x5f466a['Smtp']['user'],'pass':_0x5f466a[_0x978d('0x55')][_0x978d('0x5c')]};}}else{_0x578f46[_0x978d('0x57')]=_0x5f466a[_0x978d('0x55')][_0x978d('0x57')];_0x578f46[_0x978d('0x5b')]={'user':_0x5f466a[_0x978d('0x55')]['user'],'pass':_0x5f466a[_0x978d('0x55')][_0x978d('0x5c')]};_0x578f46[_0x978d('0x5d')]=_0x5f466a[_0x978d('0x55')]['secure'];}if(_0xa895e5['body']['attachments']&&_0xa895e5[_0x978d('0x49')][_0x978d('0x5e')]['length']){for(var _0x2e461f=0x0;_0x2e461f<_0xa895e5[_0x978d('0x49')][_0x978d('0x5e')][_0x978d('0x37')];_0x2e461f+=0x1){_0xa895e5['body']['attachments'][_0x2e461f]={'filename':_0xa895e5[_0x978d('0x49')][_0x978d('0x5e')][_0x2e461f][_0x978d('0x2a')],'path':path[_0x978d('0x5f')](config['root'],'server/files/attachments',_0xa895e5[_0x978d('0x49')]['attachments'][_0x2e461f]['basename'])};}}_0x1e1716={'account':_0x578f46,'message':_0xa895e5['body']};return;}})[_0x978d('0x15')](function(){if(_0x5f466a[_0x978d('0x60')]){if(_0x5f466a[_0x978d('0x60')]['Contacts'][_0x978d('0x37')]){return _0x5f466a['List'][_0x978d('0x52')][0x0];}else{return db[_0x978d('0x51')][_0x978d('0x61')](_[_0x978d('0xc')](_0xa895e5[_0x978d('0x49')],{'firstName':_0xa895e5['body']['to'],'email':_0xa895e5[_0x978d('0x49')]['to'],'phone':_0xa895e5[_0x978d('0x49')]['to'],'ListId':_0x5f466a[_0x978d('0x62')]}));}}else{throw new Error(_0x978d('0x63'));}})[_0x978d('0x15')](function(){if(_0x1e1716){return respondWithRpcPromise(_0x978d('0x64'),'sendMail',_0x1e1716,client9003)['then'](function(_0x1899e5){return _0x490ebc['update']({'read':!![],'messageId':_0x1899e5[_0x978d('0x65')],'sentAt':moment()[_0x978d('0x66')](_0x978d('0x67'))});})[_0x978d('0x44')](function(_0x55c3c9){logger[_0x978d('0x1a')]('%s',JSON[_0x978d('0x68')](_0x55c3c9));return _0x490ebc;});}return _0x490ebc;});}return _0x490ebc;}})[_0x978d('0x15')](respondWithResult(_0x3f2fb0,0xc9))['catch'](handleError(_0x3f2fb0,null));};exports[_0x978d('0x69')]=function(_0x235d6f,_0x171409){var _0x178d01={'agent':{},'channel':_0x978d('0x6a')};if(_0x235d6f[_0x978d('0x49')]['id']){delete _0x235d6f[_0x978d('0x49')]['id'];}_0x235d6f[_0x978d('0x49')]['read']=!![];_0x235d6f[_0x978d('0x49')]['readAt']=moment()[_0x978d('0x66')](_0x978d('0x67'));_0x235d6f[_0x978d('0x49')]['UserId']=_0x235d6f['body']['UserId']||_0x235d6f['user']['id'];_0x178d01[_0x978d('0x6b')]['id']=_0x235d6f[_0x978d('0x49')]['UserId'];return db[_0x978d('0x2c')][_0x978d('0x48')]({'where':{'id':_0x235d6f['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x171409,null))['then'](saveUpdates(_0x235d6f[_0x978d('0x49')],null))['then'](function(_0x1e8842){if(_0x1e8842){_0x178d01['message']=_0x1e8842['get']({'plain':!![]});return db[_0x978d('0x6c')][_0x978d('0x48')]({'where':{'id':_0x1e8842[_0x978d('0x6d')]}});}return null;})[_0x978d('0x15')](handleEntityNotFound(_0x171409,null))[_0x978d('0x15')](function(_0x5932e2){if(_0x5932e2){return _0x5932e2['update']({'UserId':_0x235d6f['body'][_0x978d('0x6e')],'read1stAt':_[_0x978d('0x56')](_0x5932e2['read1stAt'])?moment()[_0x978d('0x66')](_0x978d('0x67')):undefined});}return null;})[_0x978d('0x15')](function(_0x39ce26){if(_0x39ce26){_0x178d01['interaction']=_0x39ce26['get']({'plain':!![]});interaction_log[_0x978d('0x16')](_0x978d('0x6f'),_0x235d6f[_0x978d('0x70')]['id'],_0x235d6f['user']['name'],_0x235d6f[_0x978d('0x70')][_0x978d('0x71')],_0x178d01[_0x978d('0x72')]['id'],_0x235d6f[_0x978d('0x49')]?JSON['stringify'](_0x235d6f['body']):_0x978d('0x73'));return respondWithRpcPromise(_0x978d('0x74'),_0x978d('0x75'),_0x178d01);}return null;})[_0x978d('0x15')](function(_0x27016f){var _0x371dfc=_0x978d('0x76')+_0x27016f[_0x978d('0x1c')][_0x978d('0x77')];return db[_0x978d('0x78')][_0x978d('0x32')](_0x371dfc,{'type':db['Sequelize'][_0x978d('0x79')][_0x978d('0x7a')],'raw':!![]})[_0x978d('0x15')](function(_0x5ed9e5){return _0x5ed9e5;});})['then'](function(_0x3511ff){if(_0x3511ff){_0x178d01['message'][_0x978d('0x7b')]=_0x3511ff[0x0];if(!_0x235d6f[_0x978d('0x49')][_0x978d('0x6e')])return;return db[_0x978d('0x7c')][_0x978d('0x48')]({'where':{'id':_0x235d6f[_0x978d('0x49')][_0x978d('0x6e')],'role':_0x978d('0x6b')},'attributes':['id',_0x978d('0x2a'),_0x978d('0x7d'),_0x978d('0x7e'),_0x978d('0x7f')],'raw':!![]});}return null;})[_0x978d('0x15')](function(_0x2396fc){if(!_0x2396fc)return null;_0x178d01[_0x978d('0x1c')][_0x978d('0x6b')]=_0x2396fc;return _0x178d01;})[_0x978d('0x15')](function(_0x299943){if(_0x299943){if(_0x235d6f[_0x978d('0x49')][_0x978d('0x80')]){_0x178d01[_0x978d('0x1c')]['interface']=util[_0x978d('0x66')](_0x978d('0x81'),_0x235d6f[_0x978d('0x70')][_0x978d('0x2a')]);_0x178d01[_0x978d('0x1c')]['channel']=_0x178d01['channel'];_0x178d01['message'][_0x978d('0x82')]=_0x178d01[_0x978d('0x83')];_0x178d01[_0x978d('0x1c')][_0x978d('0x84')]='accept';_0x178d01[_0x978d('0x1c')]['body']=htmlToText['fromString'](_0x178d01['message']['body']);return respondWithRpcPromise(_0x978d('0x85'),_0x978d('0x85'),{'event':_0x978d('0x86'),'message':_0x178d01[_0x978d('0x1c')]},client9002)[_0x978d('0x15')](function(){return _0x178d01;});}return _0x178d01;}return null;})['then'](respondWithResult(_0x171409,null))[_0x978d('0x44')](handleError(_0x171409,null));};exports[_0x978d('0x87')]=function(_0x5d7ee6,_0x51a607){var _0x27e22b={'agent':{},'channel':_0x978d('0x6a')};if(_0x5d7ee6[_0x978d('0x49')]['id']){delete _0x5d7ee6[_0x978d('0x49')]['id'];}_0x5d7ee6[_0x978d('0x49')][_0x978d('0x6e')]=_0x5d7ee6['body'][_0x978d('0x6e')]||_0x5d7ee6[_0x978d('0x70')]['id'];_0x27e22b[_0x978d('0x6b')]['id']=_0x5d7ee6[_0x978d('0x49')][_0x978d('0x6e')];return db[_0x978d('0x2c')][_0x978d('0x48')]({'where':{'id':_0x5d7ee6[_0x978d('0x46')]['id'],'UserId':null}})[_0x978d('0x15')](handleEntityNotFound(_0x51a607,null))[_0x978d('0x15')](function(_0x755cec){if(_0x755cec){_0x27e22b['message']=_0x755cec['get']({'plain':!![]});return db[_0x978d('0x6c')][_0x978d('0x48')]({'where':{'id':_0x755cec['MailInteractionId']}});}return null;})[_0x978d('0x15')](handleEntityNotFound(_0x51a607,null))[_0x978d('0x15')](function(_0x32ef3c){if(_0x32ef3c){_0x27e22b[_0x978d('0x72')]=_0x32ef3c[_0x978d('0x88')]({'plain':!![]});interaction_log[_0x978d('0x16')](_0x978d('0x89'),_0x5d7ee6[_0x978d('0x70')]['id'],_0x5d7ee6[_0x978d('0x70')]['name'],_0x5d7ee6[_0x978d('0x70')]['role'],_0x27e22b[_0x978d('0x72')]['id'],_0x5d7ee6[_0x978d('0x49')]?JSON[_0x978d('0x68')](_0x5d7ee6['body']):_0x978d('0x73'));return respondWithRpcPromise(_0x978d('0x8a'),_0x978d('0x8b'),_0x27e22b);}return null;})[_0x978d('0x15')](function(_0x82f42a){var _0x6a60f0=_0x978d('0x76')+_0x82f42a[_0x978d('0x1c')][_0x978d('0x77')];return db[_0x978d('0x78')][_0x978d('0x32')](_0x6a60f0,{'type':db[_0x978d('0x8c')][_0x978d('0x79')]['SELECT'],'raw':!![]})[_0x978d('0x15')](function(_0xb59e2a){return _0xb59e2a;});})['then'](function(_0xc02b26){if(_0xc02b26){_0x27e22b[_0x978d('0x1c')][_0x978d('0x7b')]=_0xc02b26[0x0];if(!_0x5d7ee6[_0x978d('0x49')]['UserId'])return;return db[_0x978d('0x7c')][_0x978d('0x48')]({'where':{'id':_0x5d7ee6[_0x978d('0x49')][_0x978d('0x6e')],'role':_0x978d('0x6b')},'attributes':['id',_0x978d('0x2a'),'fullname','email',_0x978d('0x7f')],'raw':!![]});}return null;})[_0x978d('0x15')](function(_0x1da563){if(!_0x1da563)return null;_0x27e22b[_0x978d('0x1c')][_0x978d('0x6b')]=_0x1da563;return _0x27e22b;})[_0x978d('0x15')](function(_0x16d8b5){if(_0x16d8b5){_0x16d8b5['message'][_0x978d('0x8d')]=util['format'](_0x978d('0x81'),_0x5d7ee6[_0x978d('0x70')][_0x978d('0x2a')]);_0x16d8b5[_0x978d('0x1c')]['channel']=_0x27e22b[_0x978d('0x83')];_0x16d8b5[_0x978d('0x1c')]['motionChannel']=_0x27e22b['channel'];_0x16d8b5[_0x978d('0x1c')]['event']='reject';_0x16d8b5[_0x978d('0x1c')][_0x978d('0x49')]=htmlToText['fromString'](_0x27e22b[_0x978d('0x1c')][_0x978d('0x49')]);respondWithRpcPromise(_0x978d('0x85'),_0x978d('0x85'),{'event':'rejectmessage','message':_0x16d8b5['message']},client9002);return _0x27e22b;}return null;})[_0x978d('0x15')](respondWithResult(_0x51a607,null))['catch'](handleError(_0x51a607,null));};exports['download']=function(_0x4d405a,_0x134f60){var _0x437dff=moment()[_0x978d('0x8e')]()[_0x978d('0x8f')]();var _0x334f08=path[_0x978d('0x5f')](config[_0x978d('0x90')],_0x978d('0x91'),'files',_0x978d('0x92'));var _0x237f3a=path[_0x978d('0x5f')](config[_0x978d('0x90')],_0x978d('0x91'),_0x978d('0x93'),_0x978d('0x5e'));var _0x5e0c9a=util[_0x978d('0x66')](_0x978d('0x94'),_0x437dff);return db['MailMessage'][_0x978d('0x48')]({'where':{'id':_0x4d405a[_0x978d('0x46')]['id']},'attributes':['id',_0x978d('0x49'),'from','to','cc',_0x978d('0x95'),_0x978d('0x96'),_0x978d('0x97')],'include':_0x4d405a[_0x978d('0x32')]['attachments']?[{'model':db[_0x978d('0x98')],'as':_0x978d('0x99')}]:undefined})[_0x978d('0x15')](handleEntityNotFound(_0x134f60,null))[_0x978d('0x15')](function(_0x48bbda){if(_0x48bbda){var _0xe664ec=_0x48bbda;var _0xecd26d={'from':_0xe664ec[_0x978d('0x9a')],'to':_0xe664ec['to'],'subject':_0xe664ec[_0x978d('0x96')],'html':htmlEntities['decode'](_0xe664ec['body']),'headers':{'Date':moment(_0xe664ec[_0x978d('0x97')])['format'](_0x978d('0x9b'))},'attachments':[]};if(_0x48bbda['cc']){_0xecd26d[_0x978d('0x9c')]['Cc']=_0x48bbda['cc'];}if(_0x48bbda[_0x978d('0x95')]){_0xecd26d[_0x978d('0x9c')][_0x978d('0x9d')]=_0x48bbda[_0x978d('0x95')];}return new BPromise(function(_0x2d545d,_0x28f569){if(_0x48bbda[_0x978d('0x99')]){for(var _0x40cf19=0x0;_0x40cf19<_0x48bbda[_0x978d('0x99')][_0x978d('0x37')];_0x40cf19++){var _0x4f8b82=_0x48bbda['Attachments'][_0x40cf19];var _0xa0f0a7=path[_0x978d('0x5f')](_0x237f3a,_0x4f8b82[_0x978d('0x9e')]);if(fs[_0x978d('0x9f')](_0xa0f0a7)){_0xecd26d['attachments'][_0x978d('0xa0')]({'name':_0x4f8b82['name'],'contentType':_0x4f8b82[_0x978d('0x2f')],'data':fs[_0x978d('0xa1')](_0xa0f0a7)});}}}emlformat[_0x978d('0xa2')](_0xecd26d,function(_0x58a43a,_0x26a950){if(_0x58a43a)return _0x28f569(_0x58a43a);fs[_0x978d('0xa3')](path[_0x978d('0x5f')](_0x334f08,_0x5e0c9a),_0x26a950);return _0x2d545d(_0x26a950);});});}})[_0x978d('0x15')](function(_0x9ddb19){if(_0x9ddb19){return _0x134f60[_0x978d('0xa4')](path['join'](_0x334f08,_0x5e0c9a),_0x5e0c9a,function(_0x397b4d){if(!_0x397b4d)fs[_0x978d('0xa5')](path['join'](_0x334f08,_0x5e0c9a));});}})[_0x978d('0x44')](handleError(_0x134f60,null));}; \ No newline at end of file +var _0x3ca6=['attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','length','body','find','describe','create','direction','out','split','MailAccount','findOne','List','Contacts','updatedAt','DESC','MailServerOut','Smtp','host','port','secure','authentication','auth','user','pass','service','attachments','join','root','server/files/attachments','CmContact','defaults','ListId','List\x20not\x20found','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','read','readAt','UserId','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE: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','QueryTypes','SELECT','contact','User','fullname','email','internal','SIP/%s','channel','motionChannel','event','fromString','EventManager','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','sequelize','interface','rejectmessage','download','unix','tmp','server','files','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','push','writeFileSync','eml-format','moment','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','json','undefined','count','offset','limit','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','fieldName','type','model','keys','query','intersection'];(function(_0x27c399,_0x55e6ea){var _0x2860eb=function(_0x31480e){while(--_0x31480e){_0x27c399['push'](_0x27c399['shift']());}};_0x2860eb(++_0x55e6ea);}(_0x3ca6,0x1c0));var _0x63ca=function(_0x32d02d,_0x2c0158){_0x32d02d=_0x32d02d-0x0;var _0x36a9c8=_0x3ca6[_0x32d02d];return _0x36a9c8;};'use strict';var emlformat=require(_0x63ca('0x0'));var moment=require(_0x63ca('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x63ca('0x2'));var fs=require('fs');var _=require(_0x63ca('0x3'));var Redis=require(_0x63ca('0x4'));var htmlToText=require('html-to-text');var qs=require(_0x63ca('0x5'));var logger=require(_0x63ca('0x6'))('api');var interaction_log=require(_0x63ca('0x6'))(_0x63ca('0x7'));var config=require(_0x63ca('0x8'));var db=require(_0x63ca('0x9'))['db'];config['redis']=_['defaults'](config[_0x63ca('0xa')],{'host':_0x63ca('0xb'),'port':0x18eb});var socket=require(_0x63ca('0xc'))(new Redis(config[_0x63ca('0xa')]));var htmlEntities=require(_0x63ca('0xd'));require(_0x63ca('0xe'))['register'](socket);var jayson=require(_0x63ca('0xf'));var client=jayson[_0x63ca('0x10')][_0x63ca('0x11')]({'port':0x232c});var client9003=jayson['client']['http']({'port':0x232b});var client9002=jayson[_0x63ca('0x10')][_0x63ca('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x4253c5,_0x162731,_0x1c551d,_0x560810){return new BPromise(function(_0x1599d4,_0x3e5360){var _0x2193f1=_0x560810||client;return _0x2193f1[_0x63ca('0x12')](_0x4253c5,_0x1c551d)[_0x63ca('0x13')](function(_0x2fc441){logger[_0x63ca('0x14')](_0x63ca('0x15'),_0x162731,_0x63ca('0x16'));logger['debug'](_0x63ca('0x17'),_0x162731,_0x63ca('0x16'),JSON['stringify'](_0x2fc441));if(_0x2fc441[_0x63ca('0x18')]){if(_0x2fc441['error'][_0x63ca('0x19')]===0x1f4){logger[_0x63ca('0x18')](_0x63ca('0x15'),_0x162731,_0x2fc441[_0x63ca('0x18')][_0x63ca('0x1a')]);return _0x3e5360(_0x2fc441[_0x63ca('0x18')][_0x63ca('0x1a')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x162731,_0x2fc441[_0x63ca('0x18')][_0x63ca('0x1a')]);return _0x1599d4(_0x2fc441[_0x63ca('0x18')]['message']);}else{logger[_0x63ca('0x14')](_0x63ca('0x15'),_0x162731,_0x63ca('0x16'));_0x1599d4(_0x2fc441[_0x63ca('0x1b')][_0x63ca('0x1a')]);}})[_0x63ca('0x1c')](function(_0x473d59){logger[_0x63ca('0x18')](_0x63ca('0x15'),_0x162731,_0x473d59);_0x3e5360(_0x473d59);});});}function respondWithResult(_0x19b34a,_0x26f1c0){_0x26f1c0=_0x26f1c0||0xc8;return function(_0x4a2c29){if(_0x4a2c29){return _0x19b34a[_0x63ca('0x1d')](_0x26f1c0)[_0x63ca('0x1e')](_0x4a2c29);}};}function respondWithFilteredResult(_0x349acf,_0x1f7198){return function(_0x100f02){if(_0x100f02){var _0x247178=typeof _0x1f7198['offset']===_0x63ca('0x1f')&&typeof _0x1f7198['limit']==='undefined';var _0x23f43d=_0x100f02[_0x63ca('0x20')];var _0x5e65be=_0x247178?0x0:_0x1f7198['offset'];var _0x5ca896=_0x247178?_0x100f02[_0x63ca('0x20')]:_0x1f7198[_0x63ca('0x21')]+_0x1f7198[_0x63ca('0x22')];var _0x5d9ea5;if(_0x5ca896>=_0x23f43d){_0x5ca896=_0x23f43d;_0x5d9ea5=0xc8;}else{_0x5d9ea5=0xce;}_0x349acf[_0x63ca('0x1d')](_0x5d9ea5);return _0x349acf[_0x63ca('0x23')](_0x63ca('0x24'),_0x5e65be+'-'+_0x5ca896+'/'+_0x23f43d)[_0x63ca('0x1e')](_0x100f02);}return null;};}function saveUpdates(_0x1a8041){return function(_0x9809f0){if(_0x9809f0){return _0x9809f0[_0x63ca('0x25')](_0x1a8041)[_0x63ca('0x13')](function(_0x1e64e8){return _0x1e64e8;});}return null;};}function removeEntity(_0xf5b388){return function(_0x5bd1d2){if(_0x5bd1d2){return _0x5bd1d2[_0x63ca('0x26')]()[_0x63ca('0x13')](function(){_0xf5b388['status'](0xcc)[_0x63ca('0x27')]();});}};}function handleEntityNotFound(_0x2cf92c){return function(_0x5eb83c){if(!_0x5eb83c){_0x2cf92c[_0x63ca('0x28')](0x194);}return _0x5eb83c;};}function handleError(_0x5697cd,_0x75fd50){_0x75fd50=_0x75fd50||0x1f4;return function(_0x3c1476){logger[_0x63ca('0x18')](_0x3c1476[_0x63ca('0x29')]);if(_0x3c1476[_0x63ca('0x2a')]){delete _0x3c1476[_0x63ca('0x2a')];}_0x5697cd[_0x63ca('0x1d')](_0x75fd50)[_0x63ca('0x2b')](_0x3c1476);};}exports[_0x63ca('0x2c')]=function(_0x1562d0,_0x32a5ca){var _0x5c55c4={},_0x13a776={},_0x1f4601={'count':0x0,'rows':[]};var _0x1dc350=_[_0x63ca('0x2d')](db[_0x63ca('0x2e')]['rawAttributes'],function(_0x12f8b2){return{'name':_0x12f8b2[_0x63ca('0x2f')],'type':_0x12f8b2[_0x63ca('0x30')]['key']};});_0x13a776[_0x63ca('0x31')]=_[_0x63ca('0x2d')](_0x1dc350,_0x63ca('0x2a'));_0x13a776['query']=_[_0x63ca('0x32')](_0x1562d0[_0x63ca('0x33')]);_0x13a776['filters']=_[_0x63ca('0x34')](_0x13a776[_0x63ca('0x31')],_0x13a776[_0x63ca('0x33')]);_0x5c55c4[_0x63ca('0x35')]=_[_0x63ca('0x34')](_0x13a776[_0x63ca('0x31')],qs[_0x63ca('0x36')](_0x1562d0[_0x63ca('0x33')][_0x63ca('0x36')]));_0x5c55c4[_0x63ca('0x35')]=_0x5c55c4[_0x63ca('0x35')]['length']?_0x5c55c4[_0x63ca('0x35')]:_0x13a776['model'];if(!_0x1562d0[_0x63ca('0x33')][_0x63ca('0x37')](_0x63ca('0x38'))){_0x5c55c4[_0x63ca('0x22')]=qs[_0x63ca('0x22')](_0x1562d0[_0x63ca('0x33')][_0x63ca('0x22')]);_0x5c55c4[_0x63ca('0x21')]=qs['offset'](_0x1562d0[_0x63ca('0x33')][_0x63ca('0x21')]);}_0x5c55c4[_0x63ca('0x39')]=qs[_0x63ca('0x3a')](_0x1562d0['query'][_0x63ca('0x3a')]);_0x5c55c4[_0x63ca('0x3b')]=qs[_0x63ca('0x3c')](_[_0x63ca('0x3d')](_0x1562d0[_0x63ca('0x33')],_0x13a776[_0x63ca('0x3c')]),_0x1dc350);if(_0x1562d0['query'][_0x63ca('0x3e')]){_0x5c55c4[_0x63ca('0x3b')]=_[_0x63ca('0x3f')](_0x5c55c4[_0x63ca('0x3b')],{'$or':_[_0x63ca('0x2d')](_0x1dc350,function(_0x3c0309){if(_0x3c0309[_0x63ca('0x30')]!==_0x63ca('0x40')){var _0x329d6e={};_0x329d6e[_0x3c0309[_0x63ca('0x2a')]]={'$like':'%'+_0x1562d0['query'][_0x63ca('0x3e')]+'%'};return _0x329d6e;}})});}_0x5c55c4=_[_0x63ca('0x3f')]({},_0x5c55c4,_0x1562d0[_0x63ca('0x41')]);var _0x4cc35f={'where':_0x5c55c4[_0x63ca('0x3b')]};return db[_0x63ca('0x2e')][_0x63ca('0x20')](_0x4cc35f)[_0x63ca('0x13')](function(_0x2b1464){_0x1f4601[_0x63ca('0x20')]=_0x2b1464;if(_0x1562d0[_0x63ca('0x33')][_0x63ca('0x42')]){_0x5c55c4['include']=[{'all':!![]}];}return db[_0x63ca('0x2e')][_0x63ca('0x43')](_0x5c55c4);})[_0x63ca('0x13')](function(_0x529429){_0x1f4601[_0x63ca('0x44')]=_0x529429;return _0x1f4601;})['then'](respondWithFilteredResult(_0x32a5ca,_0x5c55c4))[_0x63ca('0x1c')](handleError(_0x32a5ca,null));};exports[_0x63ca('0x45')]=function(_0x21bea8,_0x869771){var _0x2d0927={'raw':!![],'where':{'id':_0x21bea8[_0x63ca('0x46')]['id']}},_0xa6a481={};_0xa6a481[_0x63ca('0x31')]=_[_0x63ca('0x32')](db['MailMessage'][_0x63ca('0x47')]);_0xa6a481[_0x63ca('0x33')]=_[_0x63ca('0x32')](_0x21bea8[_0x63ca('0x33')]);_0xa6a481[_0x63ca('0x3c')]=_[_0x63ca('0x34')](_0xa6a481['model'],_0xa6a481['query']);_0x2d0927['attributes']=_[_0x63ca('0x34')](_0xa6a481['model'],qs[_0x63ca('0x36')](_0x21bea8[_0x63ca('0x33')]['fields']));_0x2d0927[_0x63ca('0x35')]=_0x2d0927[_0x63ca('0x35')][_0x63ca('0x48')]?_0x2d0927[_0x63ca('0x35')]:_0xa6a481[_0x63ca('0x31')];if(_0x21bea8[_0x63ca('0x33')][_0x63ca('0x42')]){_0x2d0927['include']=[{'all':!![]}];}_0x2d0927=_[_0x63ca('0x3f')]({},_0x2d0927,_0x21bea8[_0x63ca('0x41')]);return db['MailMessage']['find'](_0x2d0927)[_0x63ca('0x13')](handleEntityNotFound(_0x869771,null))[_0x63ca('0x13')](respondWithResult(_0x869771,null))[_0x63ca('0x1c')](handleError(_0x869771,null));};exports[_0x63ca('0x25')]=function(_0x212a5a,_0x267b42){if(_0x212a5a[_0x63ca('0x49')]['id']){delete _0x212a5a['body']['id'];}return db[_0x63ca('0x2e')][_0x63ca('0x4a')]({'where':{'id':_0x212a5a[_0x63ca('0x46')]['id']}})[_0x63ca('0x13')](handleEntityNotFound(_0x267b42,null))[_0x63ca('0x13')](saveUpdates(_0x212a5a[_0x63ca('0x49')],null))['then'](respondWithResult(_0x267b42,null))[_0x63ca('0x1c')](handleError(_0x267b42,null));};exports['destroy']=function(_0x5b5a72,_0x546297){return db[_0x63ca('0x2e')][_0x63ca('0x4a')]({'where':{'id':_0x5b5a72[_0x63ca('0x46')]['id']}})[_0x63ca('0x13')](handleEntityNotFound(_0x546297,null))[_0x63ca('0x13')](removeEntity(_0x546297,null))['catch'](handleError(_0x546297,null));};exports[_0x63ca('0x4b')]=function(_0x1cf788,_0x1c1791){return db[_0x63ca('0x2e')][_0x63ca('0x4b')]()['then'](respondWithResult(_0x1c1791,null))[_0x63ca('0x1c')](handleError(_0x1c1791,null));};exports[_0x63ca('0x4c')]=function(_0x2d63ca,_0x486343){return db[_0x63ca('0x2e')][_0x63ca('0x4c')](_0x2d63ca['body'])[_0x63ca('0x13')](function(_0x5ed8ab){if(_0x5ed8ab){if(_0x5ed8ab[_0x63ca('0x4d')]===_0x63ca('0x4e')&&!_0x5ed8ab['secret']){var _0xbb74f1,_0x5ee622,_0x466704;if(_0x2d63ca[_0x63ca('0x49')]['to']){_0x5ee622=_0x2d63ca[_0x63ca('0x49')]['to'][_0x63ca('0x4f')](',')[0x0];}return db[_0x63ca('0x50')][_0x63ca('0x51')]({'where':{'id':_0x5ed8ab['MailAccountId']},'include':[{'model':db['CmList'],'as':_0x63ca('0x52'),'include':[{'model':db['CmContact'],'as':_0x63ca('0x53'),'where':{'email':_0x5ee622},'limit':0x1,'order':[[_0x63ca('0x54'),_0x63ca('0x55')]]}]},{'model':db[_0x63ca('0x56')],'as':_0x63ca('0x57'),'raw':!![]}]})[_0x63ca('0x13')](function(_0x23f2ff){_0xbb74f1=_0x23f2ff;if(_0xbb74f1&&_0xbb74f1[_0x63ca('0x57')]){var _0x91fa1d={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0xbb74f1[_0x63ca('0x57')]['service'])){_0x91fa1d['host']=_0xbb74f1[_0x63ca('0x57')][_0x63ca('0x58')];_0x91fa1d[_0x63ca('0x59')]=_0xbb74f1[_0x63ca('0x57')][_0x63ca('0x59')];_0x91fa1d[_0x63ca('0x5a')]=_0xbb74f1['Smtp']['secure'];if(_0xbb74f1[_0x63ca('0x57')][_0x63ca('0x5b')]){_0x91fa1d[_0x63ca('0x5c')]={'user':_0xbb74f1[_0x63ca('0x57')][_0x63ca('0x5d')],'pass':_0xbb74f1[_0x63ca('0x57')][_0x63ca('0x5e')]};}}else{_0x91fa1d[_0x63ca('0x5f')]=_0xbb74f1['Smtp'][_0x63ca('0x5f')];_0x91fa1d[_0x63ca('0x5c')]={'user':_0xbb74f1['Smtp'][_0x63ca('0x5d')],'pass':_0xbb74f1[_0x63ca('0x57')]['pass']};_0x91fa1d[_0x63ca('0x5a')]=_0xbb74f1[_0x63ca('0x57')]['secure'];}if(_0x2d63ca[_0x63ca('0x49')][_0x63ca('0x60')]&&_0x2d63ca[_0x63ca('0x49')][_0x63ca('0x60')][_0x63ca('0x48')]){for(var _0x5757bd=0x0;_0x5757bd<_0x2d63ca[_0x63ca('0x49')][_0x63ca('0x60')]['length'];_0x5757bd+=0x1){_0x2d63ca[_0x63ca('0x49')][_0x63ca('0x60')][_0x5757bd]={'filename':_0x2d63ca[_0x63ca('0x49')][_0x63ca('0x60')][_0x5757bd][_0x63ca('0x2a')],'path':path[_0x63ca('0x61')](config[_0x63ca('0x62')],_0x63ca('0x63'),_0x2d63ca[_0x63ca('0x49')]['attachments'][_0x5757bd]['basename'])};}}_0x466704={'account':_0x91fa1d,'message':_0x2d63ca[_0x63ca('0x49')]};return;}})[_0x63ca('0x13')](function(){if(_0xbb74f1[_0x63ca('0x52')]){if(_0xbb74f1['List'][_0x63ca('0x53')][_0x63ca('0x48')]){return _0xbb74f1[_0x63ca('0x52')][_0x63ca('0x53')][0x0];}else{return db[_0x63ca('0x64')]['create'](_[_0x63ca('0x65')](_0x2d63ca[_0x63ca('0x49')],{'firstName':_0x2d63ca[_0x63ca('0x49')]['to'],'email':_0x2d63ca[_0x63ca('0x49')]['to'],'phone':_0x2d63ca[_0x63ca('0x49')]['to'],'ListId':_0xbb74f1[_0x63ca('0x66')]}));}}else{throw new Error(_0x63ca('0x67'));}})[_0x63ca('0x13')](function(){if(_0x466704){return respondWithRpcPromise('SendMail',_0x63ca('0x68'),_0x466704,client9003)[_0x63ca('0x13')](function(_0x391c22){return _0x5ed8ab[_0x63ca('0x25')]({'read':!![],'messageId':_0x391c22['messageId'],'sentAt':moment()[_0x63ca('0x69')](_0x63ca('0x6a'))});})['catch'](function(_0x517050){logger[_0x63ca('0x18')]('%s',JSON[_0x63ca('0x6b')](_0x517050));return _0x5ed8ab;});}return _0x5ed8ab;});}return _0x5ed8ab;}})[_0x63ca('0x13')](respondWithResult(_0x486343,0xc9))[_0x63ca('0x1c')](handleError(_0x486343,null));};exports[_0x63ca('0x6c')]=function(_0x26e159,_0x46153d){var _0x3c5154={'agent':{},'channel':_0x63ca('0x6d')};if(_0x26e159[_0x63ca('0x49')]['id']){delete _0x26e159[_0x63ca('0x49')]['id'];}_0x26e159['body'][_0x63ca('0x6e')]=!![];_0x26e159['body'][_0x63ca('0x6f')]=moment()[_0x63ca('0x69')](_0x63ca('0x6a'));_0x26e159[_0x63ca('0x49')]['UserId']=_0x26e159[_0x63ca('0x49')][_0x63ca('0x70')]||_0x26e159[_0x63ca('0x5d')]['id'];_0x3c5154[_0x63ca('0x71')]['id']=_0x26e159[_0x63ca('0x49')][_0x63ca('0x70')];return db['MailMessage'][_0x63ca('0x4a')]({'where':{'id':_0x26e159[_0x63ca('0x46')]['id'],'UserId':null}})[_0x63ca('0x13')](handleEntityNotFound(_0x46153d,null))[_0x63ca('0x13')](saveUpdates(_0x26e159['body'],null))[_0x63ca('0x13')](function(_0xa407ca){if(_0xa407ca){_0x3c5154[_0x63ca('0x1a')]=_0xa407ca[_0x63ca('0x72')]({'plain':!![]});return db[_0x63ca('0x73')][_0x63ca('0x4a')]({'where':{'id':_0xa407ca[_0x63ca('0x74')]}});}return null;})['then'](handleEntityNotFound(_0x46153d,null))[_0x63ca('0x13')](function(_0x39594b){if(_0x39594b){return _0x39594b['update']({'UserId':_0x26e159[_0x63ca('0x49')][_0x63ca('0x70')],'read1stAt':_[_0x63ca('0x75')](_0x39594b[_0x63ca('0x76')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x63ca('0x13')](function(_0x5787a2){if(_0x5787a2){_0x3c5154[_0x63ca('0x77')]=_0x5787a2['get']({'plain':!![]});interaction_log['info'](_0x63ca('0x78'),_0x26e159[_0x63ca('0x5d')]['id'],_0x26e159[_0x63ca('0x5d')]['name'],_0x26e159[_0x63ca('0x5d')][_0x63ca('0x79')],_0x3c5154['interaction']['id'],_0x26e159['body']?JSON[_0x63ca('0x6b')](_0x26e159[_0x63ca('0x49')]):_0x63ca('0x7a'));return respondWithRpcPromise(_0x63ca('0x7b'),_0x63ca('0x7c'),_0x3c5154);}return null;})[_0x63ca('0x13')](function(_0x528957){var _0x59152f=_0x63ca('0x7d')+_0x528957[_0x63ca('0x1a')][_0x63ca('0x7e')];return db['sequelize']['query'](_0x59152f,{'type':db[_0x63ca('0x7f')][_0x63ca('0x80')][_0x63ca('0x81')],'raw':!![]})[_0x63ca('0x13')](function(_0x48afaf){return _0x48afaf;});})[_0x63ca('0x13')](function(_0x5bfe3a){if(_0x5bfe3a){_0x3c5154[_0x63ca('0x1a')][_0x63ca('0x82')]=_0x5bfe3a[0x0];if(!_0x26e159[_0x63ca('0x49')][_0x63ca('0x70')])return;return db[_0x63ca('0x83')][_0x63ca('0x4a')]({'where':{'id':_0x26e159[_0x63ca('0x49')][_0x63ca('0x70')],'role':'agent'},'attributes':['id',_0x63ca('0x2a'),_0x63ca('0x84'),_0x63ca('0x85'),_0x63ca('0x86')],'raw':!![]});}return null;})[_0x63ca('0x13')](function(_0x29cad3){if(!_0x29cad3)return null;_0x3c5154[_0x63ca('0x1a')][_0x63ca('0x71')]=_0x29cad3;return _0x3c5154;})[_0x63ca('0x13')](function(_0x43c220){if(_0x43c220){if(_0x26e159['body']['manual']){_0x3c5154[_0x63ca('0x1a')]['interface']=util[_0x63ca('0x69')](_0x63ca('0x87'),_0x26e159[_0x63ca('0x5d')][_0x63ca('0x2a')]);_0x3c5154[_0x63ca('0x1a')][_0x63ca('0x88')]=_0x3c5154['channel'];_0x3c5154[_0x63ca('0x1a')][_0x63ca('0x89')]=_0x3c5154[_0x63ca('0x88')];_0x3c5154[_0x63ca('0x1a')][_0x63ca('0x8a')]=_0x63ca('0x6c');_0x3c5154[_0x63ca('0x1a')][_0x63ca('0x49')]=htmlToText[_0x63ca('0x8b')](_0x3c5154[_0x63ca('0x1a')][_0x63ca('0x49')]);return respondWithRpcPromise('EventManager',_0x63ca('0x8c'),{'event':'acceptmessage','message':_0x3c5154['message']},client9002)[_0x63ca('0x13')](function(){return _0x3c5154;});}return _0x3c5154;}return null;})[_0x63ca('0x13')](respondWithResult(_0x46153d,null))[_0x63ca('0x1c')](handleError(_0x46153d,null));};exports[_0x63ca('0x8d')]=function(_0x353156,_0x16a567){var _0x5cbd4f={'agent':{},'channel':'mail'};if(_0x353156['body']['id']){delete _0x353156[_0x63ca('0x49')]['id'];}_0x353156[_0x63ca('0x49')]['UserId']=_0x353156[_0x63ca('0x49')][_0x63ca('0x70')]||_0x353156[_0x63ca('0x5d')]['id'];_0x5cbd4f['agent']['id']=_0x353156[_0x63ca('0x49')][_0x63ca('0x70')];return db[_0x63ca('0x2e')]['find']({'where':{'id':_0x353156[_0x63ca('0x46')]['id'],'UserId':null}})[_0x63ca('0x13')](handleEntityNotFound(_0x16a567,null))['then'](function(_0x11d6ed){if(_0x11d6ed){_0x5cbd4f[_0x63ca('0x1a')]=_0x11d6ed[_0x63ca('0x72')]({'plain':!![]});return db['MailInteraction'][_0x63ca('0x4a')]({'where':{'id':_0x11d6ed[_0x63ca('0x74')]}});}return null;})['then'](handleEntityNotFound(_0x16a567,null))['then'](function(_0x21ffc5){if(_0x21ffc5){_0x5cbd4f[_0x63ca('0x77')]=_0x21ffc5[_0x63ca('0x72')]({'plain':!![]});interaction_log['info'](_0x63ca('0x8e'),_0x353156[_0x63ca('0x5d')]['id'],_0x353156[_0x63ca('0x5d')][_0x63ca('0x2a')],_0x353156[_0x63ca('0x5d')]['role'],_0x5cbd4f[_0x63ca('0x77')]['id'],_0x353156[_0x63ca('0x49')]?JSON[_0x63ca('0x6b')](_0x353156[_0x63ca('0x49')]):_0x63ca('0x7a'));return respondWithRpcPromise('RejectMessage',_0x63ca('0x8f'),_0x5cbd4f);}return null;})[_0x63ca('0x13')](function(_0xa3a72f){var _0x1211e1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xa3a72f[_0x63ca('0x1a')][_0x63ca('0x7e')];return db[_0x63ca('0x90')][_0x63ca('0x33')](_0x1211e1,{'type':db['Sequelize'][_0x63ca('0x80')][_0x63ca('0x81')],'raw':!![]})[_0x63ca('0x13')](function(_0x12ab84){return _0x12ab84;});})[_0x63ca('0x13')](function(_0x2ac293){if(_0x2ac293){_0x5cbd4f[_0x63ca('0x1a')][_0x63ca('0x82')]=_0x2ac293[0x0];if(!_0x353156['body'][_0x63ca('0x70')])return;return db[_0x63ca('0x83')][_0x63ca('0x4a')]({'where':{'id':_0x353156[_0x63ca('0x49')]['UserId'],'role':'agent'},'attributes':['id',_0x63ca('0x2a'),_0x63ca('0x84'),'email',_0x63ca('0x86')],'raw':!![]});}return null;})[_0x63ca('0x13')](function(_0x20035a){if(!_0x20035a)return null;_0x5cbd4f['message'][_0x63ca('0x71')]=_0x20035a;return _0x5cbd4f;})['then'](function(_0x1f8efe){if(_0x1f8efe){_0x1f8efe[_0x63ca('0x1a')][_0x63ca('0x91')]=util[_0x63ca('0x69')]('SIP/%s',_0x353156[_0x63ca('0x5d')][_0x63ca('0x2a')]);_0x1f8efe[_0x63ca('0x1a')][_0x63ca('0x88')]=_0x5cbd4f[_0x63ca('0x88')];_0x1f8efe['message'][_0x63ca('0x89')]=_0x5cbd4f[_0x63ca('0x88')];_0x1f8efe[_0x63ca('0x1a')][_0x63ca('0x8a')]=_0x63ca('0x8d');_0x1f8efe[_0x63ca('0x1a')][_0x63ca('0x49')]=htmlToText['fromString'](_0x5cbd4f[_0x63ca('0x1a')]['body']);respondWithRpcPromise(_0x63ca('0x8c'),_0x63ca('0x8c'),{'event':_0x63ca('0x92'),'message':_0x1f8efe['message']},client9002);return _0x5cbd4f;}return null;})[_0x63ca('0x13')](respondWithResult(_0x16a567,null))[_0x63ca('0x1c')](handleError(_0x16a567,null));};exports[_0x63ca('0x93')]=function(_0x26843d,_0x56a0bc){var _0x5980e0=moment()[_0x63ca('0x94')]()['toString']();var _0x5840d2=path[_0x63ca('0x61')](config['root'],'server','files',_0x63ca('0x95'));var _0xbccce2=path[_0x63ca('0x61')](config['root'],_0x63ca('0x96'),_0x63ca('0x97'),_0x63ca('0x60'));var _0x1abb89=util[_0x63ca('0x69')](_0x63ca('0x98'),_0x5980e0);return db['MailMessage'][_0x63ca('0x4a')]({'where':{'id':_0x26843d['params']['id']},'attributes':['id',_0x63ca('0x49'),_0x63ca('0x99'),'to','cc',_0x63ca('0x9a'),_0x63ca('0x9b'),_0x63ca('0x9c')],'include':_0x26843d[_0x63ca('0x33')][_0x63ca('0x60')]?[{'model':db[_0x63ca('0x9d')],'as':_0x63ca('0x9e')}]:undefined})[_0x63ca('0x13')](handleEntityNotFound(_0x56a0bc,null))[_0x63ca('0x13')](function(_0x1b611f){if(_0x1b611f){var _0x5bd6ef=_0x1b611f;var _0xe577c9={'from':_0x5bd6ef['from'],'to':_0x5bd6ef['to'],'subject':_0x5bd6ef['subject'],'html':htmlEntities[_0x63ca('0x9f')](_0x5bd6ef[_0x63ca('0x49')]),'headers':{'Date':moment(_0x5bd6ef['createdAt'])[_0x63ca('0x69')](_0x63ca('0xa0'))},'attachments':[]};if(_0x1b611f['cc']){_0xe577c9[_0x63ca('0xa1')]['Cc']=_0x1b611f['cc'];}if(_0x1b611f[_0x63ca('0x9a')]){_0xe577c9[_0x63ca('0xa1')][_0x63ca('0xa2')]=_0x1b611f[_0x63ca('0x9a')];}return new BPromise(function(_0x1f0ba0,_0x47b34e){if(_0x1b611f[_0x63ca('0x9e')]){for(var _0x3050aa=0x0;_0x3050aa<_0x1b611f[_0x63ca('0x9e')][_0x63ca('0x48')];_0x3050aa++){var _0x45a2d6=_0x1b611f['Attachments'][_0x3050aa];var _0x54ba67=path['join'](_0xbccce2,_0x45a2d6[_0x63ca('0xa3')]);if(fs[_0x63ca('0xa4')](_0x54ba67)){_0xe577c9[_0x63ca('0x60')][_0x63ca('0xa5')]({'name':_0x45a2d6['name'],'contentType':_0x45a2d6[_0x63ca('0x30')],'data':fs['readFileSync'](_0x54ba67)});}}}emlformat['build'](_0xe577c9,function(_0x3225f4,_0x1306cf){if(_0x3225f4)return _0x47b34e(_0x3225f4);fs[_0x63ca('0xa6')](path[_0x63ca('0x61')](_0x5840d2,_0x1abb89),_0x1306cf);return _0x1f0ba0(_0x1306cf);});});}})[_0x63ca('0x13')](function(_0x42f565){if(_0x42f565){return _0x56a0bc[_0x63ca('0x93')](path[_0x63ca('0x61')](_0x5840d2,_0x1abb89),_0x1abb89,function(_0x50296b){if(!_0x50296b)fs['unlinkSync'](path[_0x63ca('0x61')](_0x5840d2,_0x1abb89));});}})[_0x63ca('0x1c')](handleError(_0x56a0bc,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index a4e06c7..3817eee 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 _0xc0b8=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x3b8b9d,_0x329e59){var _0x40128e=function(_0x5422b0){while(--_0x5422b0){_0x3b8b9d['push'](_0x3b8b9d['shift']());}};_0x40128e(++_0x329e59);}(_0xc0b8,0x1b4));var _0x8c0b=function(_0x4f4350,_0x18f861){_0x4f4350=_0x4f4350-0x0;var _0x3a18a3=_0xc0b8[_0x4f4350];return _0x3a18a3;};'use strict';var EventEmitter=require(_0x8c0b('0x0'));var MailMessage=require(_0x8c0b('0x1'))['db'][_0x8c0b('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x8c0b('0x3')](0x0);var events={'afterCreate':_0x8c0b('0x4'),'afterUpdate':'update','afterDestroy':_0x8c0b('0x5')};function emitEvent(_0x49f83e){return function(_0x4939ac,_0x3a014c,_0x333f80){MailMessageEvents[_0x8c0b('0x6')](_0x49f83e+':'+_0x4939ac['id'],_0x4939ac);MailMessageEvents['emit'](_0x49f83e,_0x4939ac);_0x333f80(null);};}for(var e in events){if(events[_0x8c0b('0x7')](e)){var event=events[e];MailMessage[_0x8c0b('0x8')](e,emitEvent(event));}}module[_0x8c0b('0x9')]=MailMessageEvents; \ No newline at end of file +var _0x28f3=['exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x511c1f,_0x4cf980){var _0x28a239=function(_0x4c2a03){while(--_0x4c2a03){_0x511c1f['push'](_0x511c1f['shift']());}};_0x28a239(++_0x4cf980);}(_0x28f3,0x1ae));var _0x328f=function(_0x4eec2f,_0x55a635){_0x4eec2f=_0x4eec2f-0x0;var _0x4d8b0d=_0x28f3[_0x4eec2f];return _0x4d8b0d;};'use strict';var EventEmitter=require(_0x328f('0x0'));var MailMessage=require(_0x328f('0x1'))['db'][_0x328f('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x328f('0x3')](0x0);var events={'afterCreate':_0x328f('0x4'),'afterUpdate':_0x328f('0x5'),'afterDestroy':_0x328f('0x6')};function emitEvent(_0x56cfd0){return function(_0x59a89b,_0x1d2dca,_0x463abf){MailMessageEvents['emit'](_0x56cfd0+':'+_0x59a89b['id'],_0x59a89b);MailMessageEvents[_0x328f('0x7')](_0x56cfd0,_0x59a89b);_0x463abf(null);};}for(var e in events){if(events[_0x328f('0x8')](e)){var event=events[e];MailMessage[_0x328f('0x9')](e,emitEvent(event));}}module[_0x328f('0xa')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index a98e38e..cd62a9d 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 _0x18ac=['rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','messageId','plainBody','subject','FULLTEXT','body','fromString','get','direction','isNil','UserId','findOne','then','update','createdAt','toLowerCase','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','html-to-text'];(function(_0x3b6c57,_0x244122){var _0x11ee26=function(_0x44eb31){while(--_0x44eb31){_0x3b6c57['push'](_0x3b6c57['shift']());}};_0x11ee26(++_0x244122);}(_0x18ac,0x8f));var _0xc18a=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x18ac[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xc18a('0x0'));var util=require(_0xc18a('0x1'));var logger=require(_0xc18a('0x2'))(_0xc18a('0x3'));var moment=require(_0xc18a('0x4'));var BPromise=require(_0xc18a('0x5'));var rp=require('request-promise');var htmlToText=require(_0xc18a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc18a('0x7'));var config=require(_0xc18a('0x8'));var attributes=require(_0xc18a('0x9'));module[_0xc18a('0xa')]=function(_0x4c9c1f,_0x50b70b){return _0x4c9c1f[_0xc18a('0xb')](_0xc18a('0xc'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xc18a('0xd'),'fields':[_0xc18a('0xd')]},{'name':'fti_mail_messages','fields':[_0xc18a('0xe'),_0xc18a('0xf')],'type':_0xc18a('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2b76ec,_0x5e80dd,_0xe49ab5){if(_0x2b76ec[_0xc18a('0x11')]){_0x2b76ec[_0xc18a('0xe')]=htmlToText[_0xc18a('0x12')](_0x2b76ec[_0xc18a('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xe49ab5(null,_0x5e80dd);},'afterCreate':function(_0xf440e6,_0x2b8972,_0x19e59e){var _0x100bdc=_0x4c9c1f['models'];var _0x432a54=_0xf440e6[_0xc18a('0x13')]({'plain':!![]});if(_0x432a54['direction']['toLowerCase']()==='in'||_0x432a54[_0xc18a('0x14')]['toLowerCase']()==='out'&&!_0x432a54['secret']&&!_[_0xc18a('0x15')](_0x432a54[_0xc18a('0x16')])){_0x100bdc['MailInteraction'][_0xc18a('0x17')]({'where':{'id':_0x432a54['MailInteractionId']}})[_0xc18a('0x18')](function(_0x3a95d9){if(_0x3a95d9){_0x3a95d9[_0xc18a('0x19')]({'lastMsgAt':_0x432a54[_0xc18a('0x1a')],'lastMsgDirection':_0x432a54['direction'][_0xc18a('0x1b')]()});}})['catch'](function(_0x2c362d){console['error'](_0x2c362d);});}_0x19e59e();}},'charset':_0xc18a('0x1c'),'collate':_0xc18a('0x1d')});}; \ No newline at end of file +var _0x276b=['messageId','fti_mail_messages','plainBody','FULLTEXT','body','fromString','get','toLowerCase','direction','secret','isNil','UserId','MailInteraction','findOne','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','rimraf','../../config/environment','define','mail_messages'];(function(_0x48feae,_0x26d287){var _0x2649c1=function(_0x2ef4b8){while(--_0x2ef4b8){_0x48feae['push'](_0x48feae['shift']());}};_0x2649c1(++_0x26d287);}(_0x276b,0x89));var _0xb276=function(_0x1dfe7d,_0x155925){_0x1dfe7d=_0x1dfe7d-0x0;var _0x424d7d=_0x276b[_0x1dfe7d];return _0x424d7d;};'use strict';var _=require('lodash');var util=require(_0xb276('0x0'));var logger=require(_0xb276('0x1'))(_0xb276('0x2'));var moment=require(_0xb276('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require(_0xb276('0x4'));var config=require(_0xb276('0x5'));var attributes=require('./mailMessage.attributes');module['exports']=function(_0x51afc3,_0x20fda7){return _0x51afc3[_0xb276('0x6')]('MailMessage',attributes,{'tableName':_0xb276('0x7'),'paranoid':![],'indexes':[{'name':_0xb276('0x8'),'fields':[_0xb276('0x8')]},{'name':_0xb276('0x9'),'fields':[_0xb276('0xa'),'subject'],'type':_0xb276('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2885cf,_0x2eb7cb,_0x485118){if(_0x2885cf[_0xb276('0xc')]){_0x2885cf[_0xb276('0xa')]=htmlToText[_0xb276('0xd')](_0x2885cf[_0xb276('0xc')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x485118(null,_0x2eb7cb);},'afterCreate':function(_0xcfc841,_0x4611cb,_0x2f3104){var _0x31bef8=_0x51afc3['models'];var _0x348007=_0xcfc841[_0xb276('0xe')]({'plain':!![]});if(_0x348007['direction'][_0xb276('0xf')]()==='in'||_0x348007[_0xb276('0x10')][_0xb276('0xf')]()==='out'&&!_0x348007[_0xb276('0x11')]&&!_[_0xb276('0x12')](_0x348007[_0xb276('0x13')])){_0x31bef8[_0xb276('0x14')][_0xb276('0x15')]({'where':{'id':_0x348007['MailInteractionId']}})[_0xb276('0x16')](function(_0xb60e63){if(_0xb60e63){_0xb60e63[_0xb276('0x17')]({'lastMsgAt':_0x348007[_0xb276('0x18')],'lastMsgDirection':_0x348007[_0xb276('0x10')][_0xb276('0xf')]()});}})[_0xb276('0x19')](function(_0x33def1){console[_0xb276('0x1a')](_0x33def1);});}_0x2f3104();}},'charset':_0xb276('0x1b'),'collate':_0xb276('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index c1024f7..51ab8f6 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 _0xd943=['CreateMailMessage','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','localhost','./mailMessage.socket','register','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','MailMessage','options','raw'];(function(_0x4b92e7,_0x3dfb77){var _0x109271=function(_0x26c1af){while(--_0x26c1af){_0x4b92e7['push'](_0x4b92e7['shift']());}};_0x109271(++_0x3dfb77);}(_0xd943,0x15d));var _0x3d94=function(_0x418a8e,_0xcafaf6){_0x418a8e=_0x418a8e-0x0;var _0x5a6d35=_0xd943[_0x418a8e];return _0x5a6d35;};'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});config['redis']=_['defaults'](config[_0x3d94('0xa')],{'host':_0x3d94('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3d94('0xc'))[_0x3d94('0xd')](socket);function respondWithRpcPromise(_0x1cc58c,_0x5908a7,_0x182066){return new BPromise(function(_0x4ac968,_0x39e2fa){return client[_0x3d94('0xe')](_0x1cc58c,_0x182066)['then'](function(_0x1897de){logger[_0x3d94('0xf')](_0x3d94('0x10'),_0x5908a7,_0x3d94('0x11'));logger[_0x3d94('0x12')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x5908a7,_0x3d94('0x11'),JSON[_0x3d94('0x13')](_0x1897de));if(_0x1897de[_0x3d94('0x14')]){if(_0x1897de['error'][_0x3d94('0x15')]===0x1f4){logger[_0x3d94('0x14')](_0x3d94('0x10'),_0x5908a7,_0x1897de['error'][_0x3d94('0x16')]);return _0x39e2fa(_0x1897de[_0x3d94('0x14')][_0x3d94('0x16')]);}logger[_0x3d94('0x14')](_0x3d94('0x10'),_0x5908a7,_0x1897de[_0x3d94('0x14')][_0x3d94('0x16')]);return _0x4ac968(_0x1897de[_0x3d94('0x14')]['message']);}else{logger[_0x3d94('0xf')](_0x3d94('0x10'),_0x5908a7,_0x3d94('0x11'));_0x4ac968(_0x1897de[_0x3d94('0x17')][_0x3d94('0x16')]);}})[_0x3d94('0x18')](function(_0xef8b3){logger['error'](_0x3d94('0x10'),_0x5908a7,_0xef8b3);_0x39e2fa(_0xef8b3);});});}exports['CreateMailMessage']=function(_0x28bead){var _0x193934=this;return new Promise(function(_0x16a6d0,_0x1e9ec2){return db[_0x3d94('0x19')]['create'](_0x28bead['body'],{'raw':_0x28bead[_0x3d94('0x1a')]?_0x28bead[_0x3d94('0x1a')][_0x3d94('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x30af25){logger[_0x3d94('0xf')](_0x3d94('0x1c'),_0x28bead);logger[_0x3d94('0x12')](_0x3d94('0x1c'),_0x28bead,JSON[_0x3d94('0x13')](_0x30af25));_0x16a6d0(_0x30af25);})[_0x3d94('0x18')](function(_0x27f978){logger[_0x3d94('0x14')](_0x3d94('0x1c'),_0x27f978[_0x3d94('0x16')],_0x28bead);_0x1e9ec2(_0x193934[_0x3d94('0x14')](0x1f4,_0x27f978[_0x3d94('0x16')]));});});}; \ No newline at end of file +var _0x6343=['jayson/promise','client','redis','defaults','socket.io-emitter','./mailMessage.socket','register','request','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','options','raw','moment','bluebird','../../config/logger','rpc'];(function(_0xe003bd,_0x3fbb70){var _0xd0eda3=function(_0x54e04f){while(--_0x54e04f){_0xe003bd['push'](_0xe003bd['shift']());}};_0xd0eda3(++_0x3fbb70);}(_0x6343,0x168));var _0x3634=function(_0x4ba929,_0x38c4f3){_0x4ba929=_0x4ba929-0x0;var _0x55c64a=_0x6343[_0x4ba929];return _0x55c64a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3634('0x0'));var BPromise=require(_0x3634('0x1'));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(_0x3634('0x2'))(_0x3634('0x3'));var config=require('../../config/environment');var jayson=require(_0x3634('0x4'));var client=jayson[_0x3634('0x5')]['http']({'port':0x232a});config[_0x3634('0x6')]=_[_0x3634('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3634('0x8'))(new Redis(config[_0x3634('0x6')]));require(_0x3634('0x9'))[_0x3634('0xa')](socket);function respondWithRpcPromise(_0x2e8e8b,_0x43f681,_0x5e907a){return new BPromise(function(_0x4b965a,_0x31bcfc){return client[_0x3634('0xb')](_0x2e8e8b,_0x5e907a)['then'](function(_0x2bb4db){logger[_0x3634('0xc')](_0x3634('0xd'),_0x43f681,_0x3634('0xe'));logger[_0x3634('0xf')](_0x3634('0x10'),_0x43f681,_0x3634('0xe'),JSON[_0x3634('0x11')](_0x2bb4db));if(_0x2bb4db[_0x3634('0x12')]){if(_0x2bb4db[_0x3634('0x12')][_0x3634('0x13')]===0x1f4){logger[_0x3634('0x12')](_0x3634('0xd'),_0x43f681,_0x2bb4db[_0x3634('0x12')]['message']);return _0x31bcfc(_0x2bb4db[_0x3634('0x12')]['message']);}logger[_0x3634('0x12')](_0x3634('0xd'),_0x43f681,_0x2bb4db[_0x3634('0x12')][_0x3634('0x14')]);return _0x4b965a(_0x2bb4db[_0x3634('0x12')]['message']);}else{logger[_0x3634('0xc')]('MailMessage,\x20%s,\x20%s',_0x43f681,'request\x20sent');_0x4b965a(_0x2bb4db[_0x3634('0x15')]['message']);}})[_0x3634('0x16')](function(_0x32e3c6){logger[_0x3634('0x12')]('MailMessage,\x20%s,\x20%s',_0x43f681,_0x32e3c6);_0x31bcfc(_0x32e3c6);});});}exports[_0x3634('0x17')]=function(_0x4366bc){var _0x577a6c=this;return new Promise(function(_0xeb9231,_0x506281){return db[_0x3634('0x18')][_0x3634('0x19')](_0x4366bc['body'],{'raw':_0x4366bc[_0x3634('0x1a')]?_0x4366bc[_0x3634('0x1a')][_0x3634('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x22b7ef){logger[_0x3634('0xc')]('CreateMailMessage',_0x4366bc);logger[_0x3634('0xf')]('CreateMailMessage',_0x4366bc,JSON['stringify'](_0x22b7ef));_0xeb9231(_0x22b7ef);})[_0x3634('0x16')](function(_0x862ab5){logger['error'](_0x3634('0x17'),_0x862ab5[_0x3634('0x14')],_0x4366bc);_0x506281(_0x577a6c[_0x3634('0x12')](0x1f4,_0x862ab5[_0x3634('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 0fc6d63..c79a57b 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 _0xb205=['emit','removeListener','register','mailMessage:','./mailMessage.events','save','remove','update'];(function(_0x18fbcc,_0x1ec91a){var _0x50c414=function(_0x2b44e4){while(--_0x2b44e4){_0x18fbcc['push'](_0x18fbcc['shift']());}};_0x50c414(++_0x1ec91a);}(_0xb205,0xcc));var _0x5b20=function(_0x5bf448,_0x2dd101){_0x5bf448=_0x5bf448-0x0;var _0x916ebd=_0xb205[_0x5bf448];return _0x916ebd;};'use strict';var MailMessageEvents=require(_0x5b20('0x0'));var events=[_0x5b20('0x1'),_0x5b20('0x2'),_0x5b20('0x3')];function createListener(_0x2922b0,_0x5090b5){return function(_0x349b4d){_0x5090b5[_0x5b20('0x4')](_0x2922b0,_0x349b4d);};}function removeListener(_0x29b476,_0x38ff86){return function(){MailMessageEvents[_0x5b20('0x5')](_0x29b476,_0x38ff86);};}exports[_0x5b20('0x6')]=function(_0x287ac7){for(var _0x51dc6e=0x0,_0x4c5ada=events['length'];_0x51dc6e<_0x4c5ada;_0x51dc6e++){var _0x3a7552=events[_0x51dc6e];var _0xd84d52=createListener(_0x5b20('0x7')+_0x3a7552,_0x287ac7);MailMessageEvents['on'](_0x3a7552,_0xd84d52);}}; \ No newline at end of file +var _0xf73a=['emit','removeListener','register','length','mailMessage:','./mailMessage.events','save','update'];(function(_0x49f9fd,_0x3fe108){var _0xc4b947=function(_0x433523){while(--_0x433523){_0x49f9fd['push'](_0x49f9fd['shift']());}};_0xc4b947(++_0x3fe108);}(_0xf73a,0x115));var _0xaf73=function(_0x417280,_0x1255d0){_0x417280=_0x417280-0x0;var _0x247726=_0xf73a[_0x417280];return _0x247726;};'use strict';var MailMessageEvents=require(_0xaf73('0x0'));var events=[_0xaf73('0x1'),'remove',_0xaf73('0x2')];function createListener(_0x55fe8b,_0x3f6108){return function(_0x127ab6){_0x3f6108[_0xaf73('0x3')](_0x55fe8b,_0x127ab6);};}function removeListener(_0x3df2e0,_0x61a05a){return function(){MailMessageEvents[_0xaf73('0x4')](_0x3df2e0,_0x61a05a);};}exports[_0xaf73('0x5')]=function(_0x9aac6f){for(var _0x8b99c3=0x0,_0x409123=events[_0xaf73('0x6')];_0x8b99c3<_0x409123;_0x8b99c3++){var _0x558f06=events[_0x8b99c3];var _0x23e367=createListener(_0xaf73('0x7')+_0x558f06,_0x9aac6f);MailMessageEvents['on'](_0x558f06,_0x23e367);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 0746e3b..6dc01df 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 _0xec75=['../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','update','delete','destroy','/:id/teams','removeAgents','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x719e1e,_0x59f681){var _0x580f0b=function(_0x451583){while(--_0x451583){_0x719e1e['push'](_0x719e1e['shift']());}};_0x580f0b(++_0x59f681);}(_0xec75,0x123));var _0x5ec7=function(_0x856135,_0x365f38){_0x856135=_0x856135-0x0;var _0x52691a=_0xec75[_0x856135];return _0x52691a;};'use strict';var multer=require('multer');var util=require(_0x5ec7('0x0'));var path=require(_0x5ec7('0x1'));var timeout=require(_0x5ec7('0x2'));var express=require(_0x5ec7('0x3'));var router=express['Router']();var fs_extra=require(_0x5ec7('0x4'));var auth=require(_0x5ec7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5ec7('0x6'));var controller=require('./mailQueue.controller');router[_0x5ec7('0x7')]('/',auth[_0x5ec7('0x8')](),controller['index']);router[_0x5ec7('0x7')](_0x5ec7('0x9'),auth[_0x5ec7('0x8')](),controller[_0x5ec7('0xa')]);router['get'](_0x5ec7('0xb'),auth[_0x5ec7('0x8')](),controller[_0x5ec7('0xc')]);router[_0x5ec7('0x7')](_0x5ec7('0xd'),auth[_0x5ec7('0x8')](),controller[_0x5ec7('0xe')]);router[_0x5ec7('0x7')]('/:id/teams',auth['isAuthenticated'](),controller[_0x5ec7('0xf')]);router[_0x5ec7('0x7')](_0x5ec7('0x10'),auth[_0x5ec7('0x8')](),controller[_0x5ec7('0x11')]);router[_0x5ec7('0x12')]('/',auth['isAuthenticated'](),controller[_0x5ec7('0x13')]);router[_0x5ec7('0x12')]('/:id/teams',auth['isAuthenticated'](),controller[_0x5ec7('0x14')]);router[_0x5ec7('0x12')](_0x5ec7('0x10'),auth[_0x5ec7('0x8')](),controller['addAgents']);router['put'](_0x5ec7('0xb'),auth[_0x5ec7('0x8')](),controller[_0x5ec7('0x15')]);router[_0x5ec7('0x16')](_0x5ec7('0xb'),auth[_0x5ec7('0x8')](),controller[_0x5ec7('0x17')]);router['delete'](_0x5ec7('0x18'),auth[_0x5ec7('0x8')](),controller['removeTeams']);router['delete'](_0x5ec7('0x10'),auth[_0x5ec7('0x8')](),controller[_0x5ec7('0x19')]);module[_0x5ec7('0x1a')]=router; \ No newline at end of file +var _0xfaa0=['multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','create','post','addTeams','/:id/users','addAgents','update','delete','destroy','removeTeams','removeAgents','exports'];(function(_0x3ae5c2,_0x313e3c){var _0x5a245e=function(_0x3260e7){while(--_0x3260e7){_0x3ae5c2['push'](_0x3ae5c2['shift']());}};_0x5a245e(++_0x313e3c);}(_0xfaa0,0x1e0));var _0x0faa=function(_0x3a2609,_0x75af81){_0x3a2609=_0x3a2609-0x0;var _0x6f4e5f=_0xfaa0[_0x3a2609];return _0x6f4e5f;};'use strict';var multer=require(_0x0faa('0x0'));var util=require(_0x0faa('0x1'));var path=require(_0x0faa('0x2'));var timeout=require(_0x0faa('0x3'));var express=require(_0x0faa('0x4'));var router=express['Router']();var fs_extra=require(_0x0faa('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0faa('0x6'));var config=require(_0x0faa('0x7'));var controller=require(_0x0faa('0x8'));router[_0x0faa('0x9')]('/',auth[_0x0faa('0xa')](),controller[_0x0faa('0xb')]);router[_0x0faa('0x9')]('/describe',auth[_0x0faa('0xa')](),controller['describe']);router['get'](_0x0faa('0xc'),auth[_0x0faa('0xa')](),controller[_0x0faa('0xd')]);router[_0x0faa('0x9')](_0x0faa('0xe'),auth[_0x0faa('0xa')](),controller[_0x0faa('0xf')]);router[_0x0faa('0x9')](_0x0faa('0x10'),auth[_0x0faa('0xa')](),controller[_0x0faa('0x11')]);router['get']('/:id/users',auth[_0x0faa('0xa')](),controller[_0x0faa('0x12')]);router['post']('/',auth[_0x0faa('0xa')](),controller[_0x0faa('0x13')]);router[_0x0faa('0x14')]('/:id/teams',auth[_0x0faa('0xa')](),controller[_0x0faa('0x15')]);router['post'](_0x0faa('0x16'),auth[_0x0faa('0xa')](),controller[_0x0faa('0x17')]);router['put'](_0x0faa('0xc'),auth[_0x0faa('0xa')](),controller[_0x0faa('0x18')]);router[_0x0faa('0x19')](_0x0faa('0xc'),auth[_0x0faa('0xa')](),controller[_0x0faa('0x1a')]);router[_0x0faa('0x19')](_0x0faa('0x10'),auth['isAuthenticated'](),controller[_0x0faa('0x1b')]);router['delete'](_0x0faa('0x16'),auth[_0x0faa('0xa')](),controller[_0x0faa('0x1c')]);module[_0x0faa('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 3b53551..967f8dc 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 _0x1fd8=['ENUM','beepall','sequelize','exports','STRING'];(function(_0x4d3436,_0x15701b){var _0x41dca5=function(_0x5667e7){while(--_0x5667e7){_0x4d3436['push'](_0x4d3436['shift']());}};_0x41dca5(++_0x15701b);}(_0x1fd8,0x6b));var _0x81fd=function(_0x565c5d,_0x3c9303){_0x565c5d=_0x565c5d-0x0;var _0xcd3195=_0x1fd8[_0x565c5d];return _0xcd3195;};'use strict';var Sequelize=require(_0x81fd('0x0'));module[_0x81fd('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x81fd('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x81fd('0x3')]('rrmemory',_0x81fd('0x4'),'roundrobin')}}; \ No newline at end of file +var _0x9909=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0xdae76a,_0x25eaee){var _0x4ee449=function(_0xd98610){while(--_0xd98610){_0xdae76a['push'](_0xdae76a['shift']());}};_0x4ee449(++_0x25eaee);}(_0x9909,0x1cd));var _0x9990=function(_0x268c2f,_0x16bb95){_0x268c2f=_0x268c2f-0x0;var _0x59afce=_0x9909[_0x268c2f];return _0x59afce;};'use strict';var Sequelize=require(_0x9990('0x0'));module[_0x9990('0x1')]={'name':{'type':Sequelize[_0x9990('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9990('0x2')]},'timeout':{'type':Sequelize[_0x9990('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9990('0x4')](_0x9990('0x5'),_0x9990('0x6'),_0x9990('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index ff5c2bb..11c4af3 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 _0x04cc=['TeamId','includes','compact','value','transaction','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','save','update','then','get','MailQueues','error','stack','name','send','index','map','rawAttributes','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','MailQueue','rows','show','params','merge','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','destroy','describe','getMembers','UserMailQueue','length','nolimit','MailQueueId','findAll','User','findAndCountAll','UserId','agent','updatedAt','createdAt','%s/%s','mailPause','findOne','Team','getTeams','addTeams','ids','Agents','online','voicePause','flatMap','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every'];(function(_0x4efb4a,_0x43bd7a){var _0x265085=function(_0x268a2a){while(--_0x268a2a){_0x4efb4a['push'](_0x4efb4a['shift']());}};_0x265085(++_0x43bd7a);}(_0x04cc,0x1bf));var _0xc04c=function(_0x187279,_0x26d152){_0x187279=_0x187279-0x0;var _0x3da59d=_0x04cc[_0x187279];return _0x3da59d;};'use strict';var emlformat=require(_0xc04c('0x0'));var rimraf=require(_0xc04c('0x1'));var zipdir=require(_0xc04c('0x2'));var jsonpatch=require(_0xc04c('0x3'));var rp=require(_0xc04c('0x4'));var moment=require('moment');var BPromise=require(_0xc04c('0x5'));var Mustache=require(_0xc04c('0x6'));var util=require(_0xc04c('0x7'));var path=require(_0xc04c('0x8'));var sox=require(_0xc04c('0x9'));var csv=require(_0xc04c('0xa'));var ejs=require(_0xc04c('0xb'));var fs=require('fs');var fs_extra=require(_0xc04c('0xc'));var _=require(_0xc04c('0xd'));var squel=require(_0xc04c('0xe'));var crypto=require(_0xc04c('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xc04c('0x10'));var toCsv=require(_0xc04c('0xa'));var querystring=require(_0xc04c('0x11'));var Papa=require(_0xc04c('0x12'));var Redis=require(_0xc04c('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xc04c('0x14'));var as=require(_0xc04c('0x15'));var hardwareService=require(_0xc04c('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xc04c('0x17'));var config=require(_0xc04c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc04c('0x19'))['db'];config[_0xc04c('0x1a')]=_[_0xc04c('0x1b')](config[_0xc04c('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xc04c('0x1c'))(new Redis(config[_0xc04c('0x1a')]));require(_0xc04c('0x1d'))[_0xc04c('0x1e')](socket);function respondWithStatusCode(_0x1f4195,_0xd2f010){_0xd2f010=_0xd2f010||0xcc;return function(_0x44cdbb){if(_0x44cdbb){return _0x1f4195[_0xc04c('0x1f')](_0xd2f010);}return _0x1f4195[_0xc04c('0x20')](_0xd2f010)[_0xc04c('0x21')]();};}function respondWithResult(_0x44cd8d,_0x569c7b){_0x569c7b=_0x569c7b||0xc8;return function(_0x190b8e){if(_0x190b8e){return _0x44cd8d['status'](_0x569c7b)['json'](_0x190b8e);}};}function respondWithFilteredResult(_0x44e064,_0x144896){return function(_0x187ca7){if(_0x187ca7){var _0x259586=typeof _0x144896[_0xc04c('0x22')]==='undefined'&&typeof _0x144896[_0xc04c('0x23')]===_0xc04c('0x24');var _0x30a41d=_0x187ca7[_0xc04c('0x25')];var _0x3558e7=_0x259586?0x0:_0x144896[_0xc04c('0x22')];var _0x2e092f=_0x259586?_0x187ca7[_0xc04c('0x25')]:_0x144896[_0xc04c('0x22')]+_0x144896[_0xc04c('0x23')];var _0x8cee5f;if(_0x2e092f>=_0x30a41d){_0x2e092f=_0x30a41d;_0x8cee5f=0xc8;}else{_0x8cee5f=0xce;}_0x44e064[_0xc04c('0x20')](_0x8cee5f);return _0x44e064[_0xc04c('0x26')](_0xc04c('0x27'),_0x3558e7+'-'+_0x2e092f+'/'+_0x30a41d)[_0xc04c('0x28')](_0x187ca7);}return null;};}function patchUpdates(_0x2dd6ad){return function(_0x32bde0){try{jsonpatch['apply'](_0x32bde0,_0x2dd6ad,!![]);}catch(_0x334958){return BPromise['reject'](_0x334958);}return _0x32bde0[_0xc04c('0x29')]();};}function saveUpdates(_0x1173b2,_0xd93fad){return function(_0x504df8){if(_0x504df8){return _0x504df8[_0xc04c('0x2a')](_0x1173b2)[_0xc04c('0x2b')](function(_0x35dad4){return _0x35dad4;});}return null;};}function removeEntity(_0x481d82,_0x38755a){return function(_0x419118){if(_0x419118){return _0x419118['destroy']()[_0xc04c('0x2b')](function(){var _0x37ab6d=_0x419118[_0xc04c('0x2c')]({'plain':!![]});var _0x180837=_0xc04c('0x2d');return db['UserProfileResource']['destroy']({'where':{'type':_0x180837,'resourceId':_0x37ab6d['id']}})['then'](function(){return _0x419118;});})['then'](function(){_0x481d82[_0xc04c('0x20')](0xcc)[_0xc04c('0x21')]();});}};}function handleEntityNotFound(_0x1f3ea7,_0x4675d8){return function(_0xad4db2){if(!_0xad4db2){_0x1f3ea7[_0xc04c('0x1f')](0x194);}return _0xad4db2;};}function handleError(_0x4f7f47,_0x527ab1){_0x527ab1=_0x527ab1||0x1f4;return function(_0x436f35){logger[_0xc04c('0x2e')](_0x436f35[_0xc04c('0x2f')]);if(_0x436f35[_0xc04c('0x30')]){delete _0x436f35[_0xc04c('0x30')];}_0x4f7f47[_0xc04c('0x20')](_0x527ab1)[_0xc04c('0x31')](_0x436f35);};}exports[_0xc04c('0x32')]=function(_0x99e4e4,_0x4b6ddb){var _0x44a043={},_0x1709ae={},_0x50d5dc={'count':0x0,'rows':[]};var _0x9be2f5=_[_0xc04c('0x33')](db['MailQueue'][_0xc04c('0x34')],function(_0x437691){return{'name':_0x437691['fieldName'],'type':_0x437691['type'][_0xc04c('0x35')]};});_0x1709ae[_0xc04c('0x36')]=_[_0xc04c('0x33')](_0x9be2f5,_0xc04c('0x30'));_0x1709ae['query']=_[_0xc04c('0x37')](_0x99e4e4['query']);_0x1709ae[_0xc04c('0x38')]=_[_0xc04c('0x39')](_0x1709ae['model'],_0x1709ae[_0xc04c('0x3a')]);_0x44a043[_0xc04c('0x3b')]=_[_0xc04c('0x39')](_0x1709ae[_0xc04c('0x36')],qs['fields'](_0x99e4e4[_0xc04c('0x3a')][_0xc04c('0x3c')]));_0x44a043[_0xc04c('0x3b')]=_0x44a043[_0xc04c('0x3b')]['length']?_0x44a043[_0xc04c('0x3b')]:_0x1709ae[_0xc04c('0x36')];if(!_0x99e4e4['query'][_0xc04c('0x3d')]('nolimit')){_0x44a043['limit']=qs[_0xc04c('0x23')](_0x99e4e4[_0xc04c('0x3a')][_0xc04c('0x23')]);_0x44a043['offset']=qs['offset'](_0x99e4e4['query'][_0xc04c('0x22')]);}_0x44a043[_0xc04c('0x3e')]=qs[_0xc04c('0x3f')](_0x99e4e4[_0xc04c('0x3a')]['sort']);_0x44a043[_0xc04c('0x40')]=qs[_0xc04c('0x38')](_[_0xc04c('0x41')](_0x99e4e4['query'],_0x1709ae[_0xc04c('0x38')]),_0x9be2f5);if(_0x99e4e4[_0xc04c('0x3a')][_0xc04c('0x42')]){_0x44a043[_0xc04c('0x40')]=_['merge'](_0x44a043[_0xc04c('0x40')],{'$or':_['map'](_0x9be2f5,function(_0x4acc49){if(_0x4acc49[_0xc04c('0x43')]!==_0xc04c('0x44')){var _0x251b50={};_0x251b50[_0x4acc49[_0xc04c('0x30')]]={'$like':'%'+_0x99e4e4[_0xc04c('0x3a')]['filter']+'%'};return _0x251b50;}})});}_0x44a043=_['merge']({},_0x44a043,_0x99e4e4[_0xc04c('0x45')]);var _0x465257={'where':_0x44a043[_0xc04c('0x40')]};return db['MailQueue'][_0xc04c('0x25')](_0x465257)[_0xc04c('0x2b')](function(_0x4f9229){_0x50d5dc[_0xc04c('0x25')]=_0x4f9229;if(_0x99e4e4['query'][_0xc04c('0x46')]){_0x44a043[_0xc04c('0x47')]=[{'all':!![]}];}return db[_0xc04c('0x48')]['findAll'](_0x44a043);})[_0xc04c('0x2b')](function(_0x121b7b){_0x50d5dc[_0xc04c('0x49')]=_0x121b7b;return _0x50d5dc;})[_0xc04c('0x2b')](respondWithFilteredResult(_0x4b6ddb,_0x44a043))['catch'](handleError(_0x4b6ddb,null));};exports[_0xc04c('0x4a')]=function(_0x2a58db,_0x3526ee){var _0x454a6c={'raw':!![],'where':{'id':_0x2a58db[_0xc04c('0x4b')]['id']}},_0x5e09dd={};_0x5e09dd['model']=_[_0xc04c('0x37')](db[_0xc04c('0x48')][_0xc04c('0x34')]);_0x5e09dd[_0xc04c('0x3a')]=_['keys'](_0x2a58db[_0xc04c('0x3a')]);_0x5e09dd[_0xc04c('0x38')]=_[_0xc04c('0x39')](_0x5e09dd['model'],_0x5e09dd[_0xc04c('0x3a')]);_0x454a6c[_0xc04c('0x3b')]=_['intersection'](_0x5e09dd[_0xc04c('0x36')],qs[_0xc04c('0x3c')](_0x2a58db[_0xc04c('0x3a')][_0xc04c('0x3c')]));_0x454a6c[_0xc04c('0x3b')]=_0x454a6c[_0xc04c('0x3b')]['length']?_0x454a6c[_0xc04c('0x3b')]:_0x5e09dd[_0xc04c('0x36')];if(_0x2a58db[_0xc04c('0x3a')][_0xc04c('0x46')]){_0x454a6c[_0xc04c('0x47')]=[{'all':!![]}];}_0x454a6c=_[_0xc04c('0x4c')]({},_0x454a6c,_0x2a58db[_0xc04c('0x45')]);return db['MailQueue'][_0xc04c('0x4d')](_0x454a6c)[_0xc04c('0x2b')](handleEntityNotFound(_0x3526ee,null))[_0xc04c('0x2b')](respondWithResult(_0x3526ee,null))[_0xc04c('0x4e')](handleError(_0x3526ee,null));};exports[_0xc04c('0x4f')]=function(_0x552c1a,_0x1d0bcf){return db['MailQueue'][_0xc04c('0x4f')](_0x552c1a[_0xc04c('0x50')],{})['then'](function(_0x597b60){var _0x534f5c=_0x552c1a['user']['get']({'plain':!![]});if(!_0x534f5c)throw new Error(_0xc04c('0x51'));if(_0x534f5c[_0xc04c('0x52')]===_0xc04c('0x53')){var _0x181684=_0x597b60[_0xc04c('0x2c')]({'plain':!![]});var _0x5b0dd8=_0xc04c('0x2d');return db[_0xc04c('0x54')][_0xc04c('0x4d')]({'where':{'name':_0x5b0dd8,'userProfileId':_0x534f5c[_0xc04c('0x55')]},'raw':!![]})[_0xc04c('0x2b')](function(_0x5a7841){if(_0x5a7841&&_0x5a7841['autoAssociation']===0x0){return db[_0xc04c('0x56')][_0xc04c('0x4f')]({'name':_0x181684[_0xc04c('0x30')],'resourceId':_0x181684['id'],'type':_0x5a7841[_0xc04c('0x30')],'sectionId':_0x5a7841['id']},{})[_0xc04c('0x2b')](function(){return _0x597b60;});}else{return _0x597b60;}})[_0xc04c('0x4e')](function(_0x3c3583){logger[_0xc04c('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c3583);throw _0x3c3583;});}return _0x597b60;})[_0xc04c('0x2b')](respondWithResult(_0x1d0bcf,0xc9))[_0xc04c('0x4e')](handleError(_0x1d0bcf,null));};exports[_0xc04c('0x2a')]=function(_0x2b72e4,_0x39e0b9){if(_0x2b72e4[_0xc04c('0x50')]['id']){delete _0x2b72e4['body']['id'];}return db[_0xc04c('0x48')]['find']({'where':{'id':_0x2b72e4['params']['id']}})[_0xc04c('0x2b')](handleEntityNotFound(_0x39e0b9,null))[_0xc04c('0x2b')](saveUpdates(_0x2b72e4[_0xc04c('0x50')],null))[_0xc04c('0x2b')](respondWithResult(_0x39e0b9,null))[_0xc04c('0x4e')](handleError(_0x39e0b9,null));};exports[_0xc04c('0x57')]=function(_0x5eb80e,_0x150f5c){return db['MailQueue']['find']({'where':{'id':_0x5eb80e['params']['id']}})[_0xc04c('0x2b')](handleEntityNotFound(_0x150f5c,null))['then'](removeEntity(_0x150f5c,null))['catch'](handleError(_0x150f5c,null));};exports[_0xc04c('0x58')]=function(_0x2d538d,_0x464830){return db['MailQueue'][_0xc04c('0x58')]()[_0xc04c('0x2b')](respondWithResult(_0x464830,null))[_0xc04c('0x4e')](handleError(_0x464830,null));};exports[_0xc04c('0x59')]=function(_0x4b9a23,_0x43a07c,_0x3df156){var _0x5915b6={'raw':!![],'where':{}},_0x504980={},_0x2d1dd0;return db[_0xc04c('0x48')]['findOne']({'where':{'id':_0x4b9a23[_0xc04c('0x4b')]['id']}})[_0xc04c('0x2b')](handleEntityNotFound(_0x43a07c,null))[_0xc04c('0x2b')](function(_0x2f1b06){if(_0x2f1b06){_0x2d1dd0=_0x2f1b06[_0xc04c('0x2c')]({'plain':!![]});_0x504980['model']=_['keys'](db[_0xc04c('0x5a')][_0xc04c('0x34')]);_0x504980[_0xc04c('0x3a')]=_['keys'](_0x4b9a23[_0xc04c('0x3a')]);_0x504980[_0xc04c('0x38')]=_['intersection'](_0x504980[_0xc04c('0x36')],_0x504980[_0xc04c('0x3a')]);_0x5915b6[_0xc04c('0x3b')]=_['intersection'](_0x504980[_0xc04c('0x36')],qs[_0xc04c('0x3c')](_0x4b9a23[_0xc04c('0x3a')][_0xc04c('0x3c')]));_0x5915b6['attributes']=_0x5915b6[_0xc04c('0x3b')][_0xc04c('0x5b')]?_0x5915b6['attributes']:_0x504980['model'];if(!_0x4b9a23[_0xc04c('0x3a')]['hasOwnProperty'](_0xc04c('0x5c'))){_0x5915b6[_0xc04c('0x23')]=qs[_0xc04c('0x23')](_0x4b9a23[_0xc04c('0x3a')][_0xc04c('0x23')]);_0x5915b6['offset']=qs[_0xc04c('0x22')](_0x4b9a23[_0xc04c('0x3a')][_0xc04c('0x22')]);}_0x5915b6[_0xc04c('0x3e')]=qs[_0xc04c('0x3f')](_0x4b9a23[_0xc04c('0x3a')]['sort']);_0x5915b6[_0xc04c('0x40')]=qs[_0xc04c('0x38')](_[_0xc04c('0x41')](_0x4b9a23[_0xc04c('0x3a')],_0x504980[_0xc04c('0x38')]));_0x5915b6[_0xc04c('0x40')][_0xc04c('0x5d')]=_0x2f1b06['id'];if(_0x4b9a23['query'][_0xc04c('0x42')]){_0x5915b6[_0xc04c('0x40')]=_['merge'](_0x5915b6['where'],{'$or':_['map'](_0x5915b6[_0xc04c('0x3b')],function(_0x36789c){var _0x597fbc={};_0x597fbc[_0x36789c]={'$like':'%'+_0x4b9a23[_0xc04c('0x3a')][_0xc04c('0x42')]+'%'};return _0x597fbc;})});}_0x5915b6=_[_0xc04c('0x4c')]({},_0x5915b6,_0x4b9a23[_0xc04c('0x45')]);return db['UserMailQueue'][_0xc04c('0x5e')](_0x5915b6);}})['then'](function(_0x37aae6){if(_0x37aae6){return db[_0xc04c('0x5f')][_0xc04c('0x60')]({'where':{'id':_[_0xc04c('0x33')](_0x37aae6,_0xc04c('0x61')),'role':_0xc04c('0x62')},'attributes':['id',_0xc04c('0x30'),'mailPause',_0xc04c('0x63'),_0xc04c('0x64')]});}})['then'](function(_0x3f5601){if(_0x3f5601){return{'count':_0x3f5601[_0xc04c('0x25')],'rows':_[_0xc04c('0x33')](_0x3f5601['rows'],function(_0x478407){return{'membername':_0x478407[_0xc04c('0x30')],'UserId':_0x478407['id'],'queue_name':_0x2d1dd0[_0xc04c('0x30')],'MailQueueId':_0x2d1dd0['id'],'interface':util['format'](_0xc04c('0x65'),'SIP',_0x478407[_0xc04c('0x30')]),'penalty':0x0,'paused':_0x478407[_0xc04c('0x66')],'createdAt':_0x478407[_0xc04c('0x64')],'updatedAt':_0x478407[_0xc04c('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc04c('0x2b')](respondWithFilteredResult(_0x43a07c,_0x5915b6))[_0xc04c('0x4e')](handleError(_0x43a07c,null));};exports['getTeams']=function(_0x317484,_0x42af57,_0x49828a){var _0x148bd7={};var _0x2de84f={};var _0xf3f571;var _0x15d445;return db[_0xc04c('0x48')][_0xc04c('0x67')]({'where':{'id':_0x317484[_0xc04c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x42af57,null))[_0xc04c('0x2b')](function(_0x13f1ed){if(_0x13f1ed){_0xf3f571=_0x13f1ed;_0x2de84f[_0xc04c('0x36')]=_['keys'](db[_0xc04c('0x68')][_0xc04c('0x34')]);_0x2de84f['query']=_[_0xc04c('0x37')](_0x317484[_0xc04c('0x3a')]);_0x2de84f['filters']=_[_0xc04c('0x39')](_0x2de84f['model'],_0x2de84f[_0xc04c('0x3a')]);_0x148bd7['attributes']=_['intersection'](_0x2de84f['model'],qs['fields'](_0x317484[_0xc04c('0x3a')][_0xc04c('0x3c')]));_0x148bd7[_0xc04c('0x3b')]=_0x148bd7[_0xc04c('0x3b')][_0xc04c('0x5b')]?_0x148bd7['attributes']:_0x2de84f[_0xc04c('0x36')];_0x148bd7[_0xc04c('0x3e')]=qs['sort'](_0x317484[_0xc04c('0x3a')]['sort']);_0x148bd7['where']=qs[_0xc04c('0x38')](_[_0xc04c('0x41')](_0x317484[_0xc04c('0x3a')],_0x2de84f[_0xc04c('0x38')]));if(_0x317484[_0xc04c('0x3a')][_0xc04c('0x42')]){_0x148bd7[_0xc04c('0x40')]=_[_0xc04c('0x4c')](_0x148bd7[_0xc04c('0x40')],{'$or':_[_0xc04c('0x33')](_0x148bd7['attributes'],function(_0x41f179){var _0x12cca0={};_0x12cca0[_0x41f179]={'$like':'%'+_0x317484[_0xc04c('0x3a')][_0xc04c('0x42')]+'%'};return _0x12cca0;})});}_0x148bd7=_['merge']({},_0x148bd7,_0x317484[_0xc04c('0x45')]);return _0xf3f571[_0xc04c('0x69')](_0x148bd7);}})[_0xc04c('0x2b')](function(_0x21bd42){if(_0x21bd42){_0x15d445=_0x21bd42['length'];if(!_0x317484[_0xc04c('0x3a')][_0xc04c('0x3d')](_0xc04c('0x5c'))){_0x148bd7[_0xc04c('0x23')]=qs[_0xc04c('0x23')](_0x317484[_0xc04c('0x3a')]['limit']);_0x148bd7[_0xc04c('0x22')]=qs[_0xc04c('0x22')](_0x317484['query']['offset']);}return _0xf3f571['getTeams'](_0x148bd7);}})[_0xc04c('0x2b')](function(_0x28ea4f){if(_0x28ea4f){return _0x28ea4f?{'count':_0x15d445,'rows':_0x28ea4f}:null;}})['then'](respondWithResult(_0x42af57,null))[_0xc04c('0x4e')](handleError(_0x42af57,null));};exports[_0xc04c('0x6a')]=function(_0x381310,_0x46cc00,_0x558a81){var _0xc30ea6=_0x381310['body'][_0xc04c('0x6b')];return db[_0xc04c('0x68')]['findAll']({'where':{'id':_0xc30ea6},'attributes':['id'],'include':[{'model':db[_0xc04c('0x5f')],'as':_0xc04c('0x6c'),'attributes':['id','name',_0xc04c('0x6d'),_0xc04c('0x6e'),'interface'],'raw':!![]}]})[_0xc04c('0x2b')](function(_0x2c0083){if(_0x2c0083){var _0x4658fb=_[_0xc04c('0x6f')](_0x2c0083,function(_0x2d6e05){var _0x5b047d=_0x2d6e05[_0xc04c('0x2c')]({'plain':!![]});return _0x5b047d[_0xc04c('0x6c')];});return db[_0xc04c('0x48')]['find']({'where':{'id':_0x381310[_0xc04c('0x4b')]['id']}})[_0xc04c('0x2b')](function(_0x14a1e4){return db['sequelize']['transaction'](function(_0x3488af){return _0x14a1e4[_0xc04c('0x6a')](_0xc30ea6,{'transaction':_0x3488af})[_0xc04c('0x2b')](function(){return BPromise[_0xc04c('0x70')](_0x4658fb,function(_0x54c0ce){return db[_0xc04c('0x5a')][_0xc04c('0x71')]({'where':{'UserId':_0x54c0ce['id'],'MailQueueId':_0x381310[_0xc04c('0x4b')]['id']},'transaction':_0x3488af});});})[_0xc04c('0x2b')](function(){_0x4658fb[_0xc04c('0x72')](function(_0x23cf75){socket[_0xc04c('0x73')](_0xc04c('0x74'),{'UserId':_0x23cf75['id'],'MailQueueId':_0x14a1e4['id']});});});});});}})[_0xc04c('0x2b')](respondWithStatusCode(_0x46cc00,null))[_0xc04c('0x4e')](handleError(_0x46cc00,null));};exports[_0xc04c('0x75')]=function(_0x3ceec0,_0x94b6a5,_0x5bcf1b){return db[_0xc04c('0x68')][_0xc04c('0x5e')]({'where':{'id':_0x3ceec0[_0xc04c('0x3a')][_0xc04c('0x6b')]},'attributes':['id'],'include':[{'model':db[_0xc04c('0x5f')],'as':_0xc04c('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xc04c('0x2b')](handleEntityNotFound(_0x94b6a5,null))[_0xc04c('0x2b')](function(_0x56e97d){var _0xcb62f6=_[_0xc04c('0x33')](_0x56e97d,'id');var _0x28cc9f=[];var _0x157a8=[];var _0x46fc82=squel[_0xc04c('0x76')]();_0x46fc82[_0xc04c('0x77')]('tq.TeamId')[_0xc04c('0x78')]('team_has_mail_queues','tq')[_0xc04c('0x79')](_0xc04c('0x7a'),'ut',_0xc04c('0x7b'))[_0xc04c('0x40')](_0xc04c('0x7c'),_0x3ceec0[_0xc04c('0x4b')]['id']);for(var _0x2f5cd5=0x0;_0x2f5cd5<_0x56e97d[_0xc04c('0x5b')];_0x2f5cd5+=0x1){let _0x2719e8=_0x56e97d[_0x2f5cd5];for(var _0x8cadf0=0x0;_0x8cadf0<_0x2719e8[_0xc04c('0x6c')]['length'];_0x8cadf0+=0x1){let _0x20c03a=_0x2719e8[_0xc04c('0x6c')][_0x8cadf0];var _0x28a380=_0x46fc82[_0xc04c('0x7d')]();_0x28a380[_0xc04c('0x40')](_0xc04c('0x7e'),_0x20c03a['id']);_0x157a8[_0xc04c('0x7f')](db[_0xc04c('0x80')][_0xc04c('0x3a')](_0x28a380[_0xc04c('0x81')](),{'type':db[_0xc04c('0x80')][_0xc04c('0x82')][_0xc04c('0x83')]})[_0xc04c('0x2b')](function(_0x2fbc17){if(_0x2fbc17[_0xc04c('0x5b')]===0x1){return _0x20c03a['id'];}else{var _0x132fe0=_[_0xc04c('0x84')](_[_0xc04c('0x33')](_0x2fbc17,_0xc04c('0x85')),function(_0x113a77){return _[_0xc04c('0x86')](_0xcb62f6,_0x113a77);});if(_0x132fe0){return _0x20c03a['id'];}}}));}}return BPromise['all'](_0x157a8)['then'](function(_0x190df6){_0x28cc9f=_(_0x28cc9f)['union'](_0x190df6)[_0xc04c('0x87')]()[_0xc04c('0x88')]();return db['MailQueue']['find']({'where':{'id':_0x3ceec0[_0xc04c('0x4b')]['id']}})['then'](function(_0x370160){return db[_0xc04c('0x80')][_0xc04c('0x89')](function(_0x3f81c9){return _0x370160[_0xc04c('0x75')](_0x3ceec0['query'][_0xc04c('0x6b')],{'transaction':_0x3f81c9})[_0xc04c('0x2b')](function(){if(!_['isEmpty'](_0x28cc9f)){return _0x370160[_0xc04c('0x8a')](_0x28cc9f,{'transaction':_0x3f81c9});}})[_0xc04c('0x2b')](function(){_0x28cc9f[_0xc04c('0x72')](function(_0x3aea35){socket[_0xc04c('0x73')](_0xc04c('0x8b'),{'UserId':_0x3aea35,'MailQueueId':_0x370160['id']});});});});});});})[_0xc04c('0x2b')](respondWithStatusCode(_0x94b6a5,null))['catch'](handleError(_0x94b6a5,null));};exports[_0xc04c('0x8c')]=function(_0x1c29ac,_0x27600c,_0x579547){return db[_0xc04c('0x48')]['find']({'where':{'id':_0x1c29ac[_0xc04c('0x4b')]['id']}})[_0xc04c('0x2b')](handleEntityNotFound(_0x27600c,null))[_0xc04c('0x2b')](function(_0x2d23e3){if(_0x2d23e3){return _0x2d23e3['addAgents'](_0x1c29ac[_0xc04c('0x50')][_0xc04c('0x6b')],_[_0xc04c('0x8d')](_0x1c29ac[_0xc04c('0x50')],[_0xc04c('0x6b'),'id'])||{})[_0xc04c('0x8e')](function(_0xb2fdc4){for(var _0x3fa24d=0x0;_0x3fa24d<_0x1c29ac['body'][_0xc04c('0x6b')][_0xc04c('0x5b')];_0x3fa24d+=0x1){socket[_0xc04c('0x73')](_0xc04c('0x74'),{'UserId':Number(_0x1c29ac[_0xc04c('0x50')][_0xc04c('0x6b')][_0x3fa24d]),'MailQueueId':Number(_0x1c29ac[_0xc04c('0x4b')]['id'])});}return _0xb2fdc4;});}})[_0xc04c('0x2b')](respondWithResult(_0x27600c,null))[_0xc04c('0x4e')](handleError(_0x27600c,null));};exports[_0xc04c('0x8a')]=function(_0x2be86f,_0x32974b,_0x1336ba){return db[_0xc04c('0x48')][_0xc04c('0x4d')]({'where':{'id':_0x2be86f[_0xc04c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x32974b,null))[_0xc04c('0x2b')](function(_0x47fbd0){if(_0x47fbd0){return _0x47fbd0['removeAgents'](_0x2be86f[_0xc04c('0x3a')][_0xc04c('0x6b')])['then'](function(){if(_[_0xc04c('0x8f')](_0x2be86f[_0xc04c('0x3a')][_0xc04c('0x6b')])){for(var _0x5713c2=0x0;_0x5713c2<_0x2be86f[_0xc04c('0x3a')][_0xc04c('0x6b')][_0xc04c('0x5b')];_0x5713c2+=0x1){socket['emit'](_0xc04c('0x8b'),{'UserId':Number(_0x2be86f[_0xc04c('0x3a')][_0xc04c('0x6b')][_0x5713c2]),'MailQueueId':Number(_0x2be86f['params']['id'])});}}else{socket[_0xc04c('0x73')](_0xc04c('0x8b'),{'UserId':Number(_0x2be86f[_0xc04c('0x3a')]['ids']),'MailQueueId':Number(_0x2be86f['params']['id'])});}});}})[_0xc04c('0x2b')](respondWithStatusCode(_0x32974b,null))[_0xc04c('0x4e')](handleError(_0x32974b,null));};exports[_0xc04c('0x90')]=function(_0x31fe53,_0x39ec0d,_0x501235){var _0x2febbc={};var _0x52e201={};var _0x24d18b;var _0xdd1c2d;return db[_0xc04c('0x48')]['findOne']({'where':{'id':_0x31fe53['params']['id']}})[_0xc04c('0x2b')](handleEntityNotFound(_0x39ec0d,null))['then'](function(_0x23724b){if(_0x23724b){_0x24d18b=_0x23724b;_0x52e201[_0xc04c('0x36')]=_[_0xc04c('0x37')](db[_0xc04c('0x5f')]['rawAttributes']);_0x52e201[_0xc04c('0x3a')]=_[_0xc04c('0x37')](_0x31fe53[_0xc04c('0x3a')]);_0x52e201[_0xc04c('0x38')]=_[_0xc04c('0x39')](_0x52e201['model'],_0x52e201['query']);_0x2febbc[_0xc04c('0x3b')]=_[_0xc04c('0x39')](_0x52e201[_0xc04c('0x36')],qs[_0xc04c('0x3c')](_0x31fe53[_0xc04c('0x3a')][_0xc04c('0x3c')]));_0x2febbc['attributes']=_0x2febbc['attributes'][_0xc04c('0x5b')]?_0x2febbc[_0xc04c('0x3b')]:_0x52e201['model'];_0x2febbc['order']=qs[_0xc04c('0x3f')](_0x31fe53[_0xc04c('0x3a')]['sort']);_0x2febbc[_0xc04c('0x40')]=qs[_0xc04c('0x38')](_['pick'](_0x31fe53[_0xc04c('0x3a')],_0x52e201[_0xc04c('0x38')]));if(_0x31fe53[_0xc04c('0x3a')][_0xc04c('0x42')]){_0x2febbc[_0xc04c('0x40')]=_[_0xc04c('0x4c')](_0x2febbc['where'],{'$or':_[_0xc04c('0x33')](_0x2febbc[_0xc04c('0x3b')],function(_0x3667b0){var _0x47f1d0={};_0x47f1d0[_0x3667b0]={'$like':'%'+_0x31fe53[_0xc04c('0x3a')][_0xc04c('0x42')]+'%'};return _0x47f1d0;})});}_0x2febbc=_['merge']({},_0x2febbc,_0x31fe53[_0xc04c('0x45')]);return _0x24d18b['getAgents'](_0x2febbc);}})['then'](function(_0x3d3cee){if(_0x3d3cee){_0xdd1c2d=_0x3d3cee['length'];if(!_0x31fe53[_0xc04c('0x3a')][_0xc04c('0x3d')](_0xc04c('0x5c'))){_0x2febbc['limit']=qs[_0xc04c('0x23')](_0x31fe53[_0xc04c('0x3a')]['limit']);_0x2febbc['offset']=qs[_0xc04c('0x22')](_0x31fe53[_0xc04c('0x3a')][_0xc04c('0x22')]);}return _0x24d18b['getAgents'](_0x2febbc);}})[_0xc04c('0x2b')](function(_0x43f0a6){if(_0x43f0a6){return _0x43f0a6?{'count':_0xdd1c2d,'rows':_0x43f0a6}:null;}})[_0xc04c('0x2b')](respondWithResult(_0x39ec0d,null))[_0xc04c('0x4e')](handleError(_0x39ec0d,null));}; \ No newline at end of file +var _0x9e0d=['union','compact','value','transaction','removeAgents','userMailQueue:remove','addAgents','spread','getAgents','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','MailQueue','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','MailQueues','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','nolimit','MailQueueId','filter','User','findAndCountAll','format','%s/%s','SIP','mailPause','createdAt','updatedAt','getTeams','addTeams','ids','Team','Agents','voicePause','interface','flatMap','sequelize','each','forEach','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','push','SELECT','every','TeamId'];(function(_0xcd3806,_0x3182ad){var _0x5e3594=function(_0x12874d){while(--_0x12874d){_0xcd3806['push'](_0xcd3806['shift']());}};_0x5e3594(++_0x3182ad);}(_0x9e0d,0x9b));var _0xd9e0=function(_0x13f77f,_0x42e2b9){_0x13f77f=_0x13f77f-0x0;var _0x23c9d0=_0x9e0d[_0x13f77f];return _0x23c9d0;};'use strict';var emlformat=require(_0xd9e0('0x0'));var rimraf=require(_0xd9e0('0x1'));var zipdir=require(_0xd9e0('0x2'));var jsonpatch=require(_0xd9e0('0x3'));var rp=require(_0xd9e0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd9e0('0x5'));var util=require(_0xd9e0('0x6'));var path=require(_0xd9e0('0x7'));var sox=require(_0xd9e0('0x8'));var csv=require('to-csv');var ejs=require(_0xd9e0('0x9'));var fs=require('fs');var fs_extra=require(_0xd9e0('0xa'));var _=require(_0xd9e0('0xb'));var squel=require(_0xd9e0('0xc'));var crypto=require(_0xd9e0('0xd'));var jsforce=require(_0xd9e0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd9e0('0xf'));var querystring=require(_0xd9e0('0x10'));var Papa=require(_0xd9e0('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd9e0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd9e0('0x13'));var logger=require(_0xd9e0('0x14'))(_0xd9e0('0x15'));var utils=require(_0xd9e0('0x16'));var config=require(_0xd9e0('0x17'));var licenseUtil=require(_0xd9e0('0x18'));var db=require(_0xd9e0('0x19'))['db'];config['redis']=_[_0xd9e0('0x1a')](config[_0xd9e0('0x1b')],{'host':_0xd9e0('0x1c'),'port':0x18eb});var socket=require(_0xd9e0('0x1d'))(new Redis(config['redis']));require(_0xd9e0('0x1e'))[_0xd9e0('0x1f')](socket);function respondWithStatusCode(_0x39b339,_0x5cbd8c){_0x5cbd8c=_0x5cbd8c||0xcc;return function(_0x2eafee){if(_0x2eafee){return _0x39b339[_0xd9e0('0x20')](_0x5cbd8c);}return _0x39b339[_0xd9e0('0x21')](_0x5cbd8c)[_0xd9e0('0x22')]();};}function respondWithResult(_0x419f18,_0x4d9137){_0x4d9137=_0x4d9137||0xc8;return function(_0x269619){if(_0x269619){return _0x419f18[_0xd9e0('0x21')](_0x4d9137)[_0xd9e0('0x23')](_0x269619);}};}function respondWithFilteredResult(_0x53131e,_0x167bc0){return function(_0x4403e4){if(_0x4403e4){var _0x245393=typeof _0x167bc0['offset']===_0xd9e0('0x24')&&typeof _0x167bc0[_0xd9e0('0x25')]===_0xd9e0('0x24');var _0x510d7c=_0x4403e4[_0xd9e0('0x26')];var _0x25bd77=_0x245393?0x0:_0x167bc0[_0xd9e0('0x27')];var _0x53ff39=_0x245393?_0x4403e4[_0xd9e0('0x26')]:_0x167bc0['offset']+_0x167bc0[_0xd9e0('0x25')];var _0x31686d;if(_0x53ff39>=_0x510d7c){_0x53ff39=_0x510d7c;_0x31686d=0xc8;}else{_0x31686d=0xce;}_0x53131e[_0xd9e0('0x21')](_0x31686d);return _0x53131e[_0xd9e0('0x28')](_0xd9e0('0x29'),_0x25bd77+'-'+_0x53ff39+'/'+_0x510d7c)['json'](_0x4403e4);}return null;};}function patchUpdates(_0x903986){return function(_0x415270){try{jsonpatch[_0xd9e0('0x2a')](_0x415270,_0x903986,!![]);}catch(_0x1fa129){return BPromise[_0xd9e0('0x2b')](_0x1fa129);}return _0x415270[_0xd9e0('0x2c')]();};}function saveUpdates(_0x424eaa,_0x282363){return function(_0x12b06e){if(_0x12b06e){return _0x12b06e[_0xd9e0('0x2d')](_0x424eaa)[_0xd9e0('0x2e')](function(_0x340b30){return _0x340b30;});}return null;};}function removeEntity(_0x20d4a8,_0x142f2b){return function(_0x326f28){if(_0x326f28){return _0x326f28[_0xd9e0('0x2f')]()[_0xd9e0('0x2e')](function(){var _0x43314f=_0x326f28['get']({'plain':!![]});var _0x2930e9='MailQueues';return db[_0xd9e0('0x30')][_0xd9e0('0x2f')]({'where':{'type':_0x2930e9,'resourceId':_0x43314f['id']}})[_0xd9e0('0x2e')](function(){return _0x326f28;});})[_0xd9e0('0x2e')](function(){_0x20d4a8['status'](0xcc)[_0xd9e0('0x22')]();});}};}function handleEntityNotFound(_0x5b69b7,_0x27bbd1){return function(_0x2152de){if(!_0x2152de){_0x5b69b7[_0xd9e0('0x20')](0x194);}return _0x2152de;};}function handleError(_0x46dfca,_0xeeab8b){_0xeeab8b=_0xeeab8b||0x1f4;return function(_0x42935e){logger[_0xd9e0('0x31')](_0x42935e[_0xd9e0('0x32')]);if(_0x42935e[_0xd9e0('0x33')]){delete _0x42935e[_0xd9e0('0x33')];}_0x46dfca['status'](_0xeeab8b)[_0xd9e0('0x34')](_0x42935e);};}exports['index']=function(_0x1ecc36,_0x3cafe4){var _0x302ea2={},_0x2dd01e={},_0x532ee5={'count':0x0,'rows':[]};var _0x5291af=_['map'](db[_0xd9e0('0x35')]['rawAttributes'],function(_0x47b775){return{'name':_0x47b775[_0xd9e0('0x36')],'type':_0x47b775[_0xd9e0('0x37')][_0xd9e0('0x38')]};});_0x2dd01e['model']=_[_0xd9e0('0x39')](_0x5291af,_0xd9e0('0x33'));_0x2dd01e[_0xd9e0('0x3a')]=_[_0xd9e0('0x3b')](_0x1ecc36[_0xd9e0('0x3a')]);_0x2dd01e[_0xd9e0('0x3c')]=_[_0xd9e0('0x3d')](_0x2dd01e[_0xd9e0('0x3e')],_0x2dd01e[_0xd9e0('0x3a')]);_0x302ea2[_0xd9e0('0x3f')]=_[_0xd9e0('0x3d')](_0x2dd01e[_0xd9e0('0x3e')],qs['fields'](_0x1ecc36[_0xd9e0('0x3a')][_0xd9e0('0x40')]));_0x302ea2['attributes']=_0x302ea2['attributes'][_0xd9e0('0x41')]?_0x302ea2['attributes']:_0x2dd01e[_0xd9e0('0x3e')];if(!_0x1ecc36[_0xd9e0('0x3a')][_0xd9e0('0x42')]('nolimit')){_0x302ea2[_0xd9e0('0x25')]=qs['limit'](_0x1ecc36[_0xd9e0('0x3a')]['limit']);_0x302ea2[_0xd9e0('0x27')]=qs[_0xd9e0('0x27')](_0x1ecc36[_0xd9e0('0x3a')][_0xd9e0('0x27')]);}_0x302ea2[_0xd9e0('0x43')]=qs[_0xd9e0('0x44')](_0x1ecc36[_0xd9e0('0x3a')][_0xd9e0('0x44')]);_0x302ea2['where']=qs[_0xd9e0('0x3c')](_['pick'](_0x1ecc36['query'],_0x2dd01e[_0xd9e0('0x3c')]),_0x5291af);if(_0x1ecc36[_0xd9e0('0x3a')]['filter']){_0x302ea2[_0xd9e0('0x45')]=_[_0xd9e0('0x46')](_0x302ea2['where'],{'$or':_[_0xd9e0('0x39')](_0x5291af,function(_0x316000){if(_0x316000[_0xd9e0('0x37')]!==_0xd9e0('0x47')){var _0x13b43c={};_0x13b43c[_0x316000['name']]={'$like':'%'+_0x1ecc36['query']['filter']+'%'};return _0x13b43c;}})});}_0x302ea2=_[_0xd9e0('0x46')]({},_0x302ea2,_0x1ecc36[_0xd9e0('0x48')]);var _0x9070ed={'where':_0x302ea2[_0xd9e0('0x45')]};return db[_0xd9e0('0x35')][_0xd9e0('0x26')](_0x9070ed)['then'](function(_0x460e82){_0x532ee5[_0xd9e0('0x26')]=_0x460e82;if(_0x1ecc36['query'][_0xd9e0('0x49')]){_0x302ea2['include']=[{'all':!![]}];}return db['MailQueue'][_0xd9e0('0x4a')](_0x302ea2);})[_0xd9e0('0x2e')](function(_0x1219dc){_0x532ee5[_0xd9e0('0x4b')]=_0x1219dc;return _0x532ee5;})[_0xd9e0('0x2e')](respondWithFilteredResult(_0x3cafe4,_0x302ea2))[_0xd9e0('0x4c')](handleError(_0x3cafe4,null));};exports[_0xd9e0('0x4d')]=function(_0x13df4b,_0xf71c3b){var _0x1c2082={'raw':!![],'where':{'id':_0x13df4b[_0xd9e0('0x4e')]['id']}},_0x1cf219={};_0x1cf219[_0xd9e0('0x3e')]=_[_0xd9e0('0x3b')](db[_0xd9e0('0x35')][_0xd9e0('0x4f')]);_0x1cf219[_0xd9e0('0x3a')]=_[_0xd9e0('0x3b')](_0x13df4b[_0xd9e0('0x3a')]);_0x1cf219[_0xd9e0('0x3c')]=_['intersection'](_0x1cf219[_0xd9e0('0x3e')],_0x1cf219[_0xd9e0('0x3a')]);_0x1c2082[_0xd9e0('0x3f')]=_[_0xd9e0('0x3d')](_0x1cf219[_0xd9e0('0x3e')],qs[_0xd9e0('0x40')](_0x13df4b['query']['fields']));_0x1c2082[_0xd9e0('0x3f')]=_0x1c2082[_0xd9e0('0x3f')][_0xd9e0('0x41')]?_0x1c2082['attributes']:_0x1cf219[_0xd9e0('0x3e')];if(_0x13df4b[_0xd9e0('0x3a')]['includeAll']){_0x1c2082[_0xd9e0('0x50')]=[{'all':!![]}];}_0x1c2082=_[_0xd9e0('0x46')]({},_0x1c2082,_0x13df4b[_0xd9e0('0x48')]);return db[_0xd9e0('0x35')][_0xd9e0('0x51')](_0x1c2082)[_0xd9e0('0x2e')](handleEntityNotFound(_0xf71c3b,null))[_0xd9e0('0x2e')](respondWithResult(_0xf71c3b,null))['catch'](handleError(_0xf71c3b,null));};exports['create']=function(_0x4f0653,_0x3867ce){return db[_0xd9e0('0x35')]['create'](_0x4f0653[_0xd9e0('0x52')],{})[_0xd9e0('0x2e')](function(_0x59441e){var _0x4abb6c=_0x4f0653['user'][_0xd9e0('0x53')]({'plain':!![]});if(!_0x4abb6c)throw new Error(_0xd9e0('0x54'));if(_0x4abb6c['role']===_0xd9e0('0x55')){var _0x2da8a5=_0x59441e[_0xd9e0('0x53')]({'plain':!![]});var _0x454fe8=_0xd9e0('0x56');return db[_0xd9e0('0x57')][_0xd9e0('0x51')]({'where':{'name':_0x454fe8,'userProfileId':_0x4abb6c[_0xd9e0('0x58')]},'raw':!![]})[_0xd9e0('0x2e')](function(_0x36212d){if(_0x36212d&&_0x36212d[_0xd9e0('0x59')]===0x0){return db[_0xd9e0('0x30')][_0xd9e0('0x5a')]({'name':_0x2da8a5[_0xd9e0('0x33')],'resourceId':_0x2da8a5['id'],'type':_0x36212d['name'],'sectionId':_0x36212d['id']},{})['then'](function(){return _0x59441e;});}else{return _0x59441e;}})[_0xd9e0('0x4c')](function(_0x1a4331){logger['error'](_0xd9e0('0x5b'),_0x1a4331);throw _0x1a4331;});}return _0x59441e;})[_0xd9e0('0x2e')](respondWithResult(_0x3867ce,0xc9))[_0xd9e0('0x4c')](handleError(_0x3867ce,null));};exports[_0xd9e0('0x2d')]=function(_0x45ec6a,_0x37e394){if(_0x45ec6a['body']['id']){delete _0x45ec6a[_0xd9e0('0x52')]['id'];}return db[_0xd9e0('0x35')]['find']({'where':{'id':_0x45ec6a[_0xd9e0('0x4e')]['id']}})['then'](handleEntityNotFound(_0x37e394,null))[_0xd9e0('0x2e')](saveUpdates(_0x45ec6a['body'],null))[_0xd9e0('0x2e')](respondWithResult(_0x37e394,null))[_0xd9e0('0x4c')](handleError(_0x37e394,null));};exports['destroy']=function(_0x59f25a,_0x28d9ee){return db[_0xd9e0('0x35')][_0xd9e0('0x51')]({'where':{'id':_0x59f25a['params']['id']}})[_0xd9e0('0x2e')](handleEntityNotFound(_0x28d9ee,null))['then'](removeEntity(_0x28d9ee,null))['catch'](handleError(_0x28d9ee,null));};exports[_0xd9e0('0x5c')]=function(_0x1f7c40,_0x88c165){return db[_0xd9e0('0x35')][_0xd9e0('0x5c')]()[_0xd9e0('0x2e')](respondWithResult(_0x88c165,null))[_0xd9e0('0x4c')](handleError(_0x88c165,null));};exports[_0xd9e0('0x5d')]=function(_0x30a8a4,_0x29b819,_0x584dad){var _0xf3576c={'raw':!![],'where':{}},_0x226abb={},_0x26b3ac;return db['MailQueue'][_0xd9e0('0x5e')]({'where':{'id':_0x30a8a4['params']['id']}})['then'](handleEntityNotFound(_0x29b819,null))[_0xd9e0('0x2e')](function(_0x201045){if(_0x201045){_0x26b3ac=_0x201045[_0xd9e0('0x53')]({'plain':!![]});_0x226abb[_0xd9e0('0x3e')]=_[_0xd9e0('0x3b')](db[_0xd9e0('0x5f')][_0xd9e0('0x4f')]);_0x226abb['query']=_[_0xd9e0('0x3b')](_0x30a8a4[_0xd9e0('0x3a')]);_0x226abb['filters']=_[_0xd9e0('0x3d')](_0x226abb[_0xd9e0('0x3e')],_0x226abb['query']);_0xf3576c[_0xd9e0('0x3f')]=_[_0xd9e0('0x3d')](_0x226abb[_0xd9e0('0x3e')],qs[_0xd9e0('0x40')](_0x30a8a4[_0xd9e0('0x3a')]['fields']));_0xf3576c[_0xd9e0('0x3f')]=_0xf3576c['attributes']['length']?_0xf3576c[_0xd9e0('0x3f')]:_0x226abb[_0xd9e0('0x3e')];if(!_0x30a8a4[_0xd9e0('0x3a')][_0xd9e0('0x42')](_0xd9e0('0x60'))){_0xf3576c[_0xd9e0('0x25')]=qs['limit'](_0x30a8a4[_0xd9e0('0x3a')]['limit']);_0xf3576c[_0xd9e0('0x27')]=qs[_0xd9e0('0x27')](_0x30a8a4[_0xd9e0('0x3a')][_0xd9e0('0x27')]);}_0xf3576c['order']=qs[_0xd9e0('0x44')](_0x30a8a4[_0xd9e0('0x3a')][_0xd9e0('0x44')]);_0xf3576c[_0xd9e0('0x45')]=qs[_0xd9e0('0x3c')](_['pick'](_0x30a8a4[_0xd9e0('0x3a')],_0x226abb[_0xd9e0('0x3c')]));_0xf3576c[_0xd9e0('0x45')][_0xd9e0('0x61')]=_0x201045['id'];if(_0x30a8a4[_0xd9e0('0x3a')][_0xd9e0('0x62')]){_0xf3576c[_0xd9e0('0x45')]=_[_0xd9e0('0x46')](_0xf3576c[_0xd9e0('0x45')],{'$or':_[_0xd9e0('0x39')](_0xf3576c[_0xd9e0('0x3f')],function(_0x385249){var _0x308564={};_0x308564[_0x385249]={'$like':'%'+_0x30a8a4[_0xd9e0('0x3a')][_0xd9e0('0x62')]+'%'};return _0x308564;})});}_0xf3576c=_[_0xd9e0('0x46')]({},_0xf3576c,_0x30a8a4['options']);return db[_0xd9e0('0x5f')][_0xd9e0('0x4a')](_0xf3576c);}})['then'](function(_0x3fbbba){if(_0x3fbbba){return db[_0xd9e0('0x63')][_0xd9e0('0x64')]({'where':{'id':_['map'](_0x3fbbba,'UserId'),'role':'agent'},'attributes':['id',_0xd9e0('0x33'),'mailPause','updatedAt','createdAt']});}})[_0xd9e0('0x2e')](function(_0x1de8f2){if(_0x1de8f2){return{'count':_0x1de8f2[_0xd9e0('0x26')],'rows':_[_0xd9e0('0x39')](_0x1de8f2[_0xd9e0('0x4b')],function(_0x4250aa){return{'membername':_0x4250aa['name'],'UserId':_0x4250aa['id'],'queue_name':_0x26b3ac[_0xd9e0('0x33')],'MailQueueId':_0x26b3ac['id'],'interface':util[_0xd9e0('0x65')](_0xd9e0('0x66'),_0xd9e0('0x67'),_0x4250aa['name']),'penalty':0x0,'paused':_0x4250aa[_0xd9e0('0x68')],'createdAt':_0x4250aa[_0xd9e0('0x69')],'updatedAt':_0x4250aa[_0xd9e0('0x6a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd9e0('0x2e')](respondWithFilteredResult(_0x29b819,_0xf3576c))[_0xd9e0('0x4c')](handleError(_0x29b819,null));};exports[_0xd9e0('0x6b')]=function(_0x4ee5a9,_0x3e09ce,_0x208266){var _0x1a04bc={};var _0x5592f1={};var _0x5e853f;var _0x4d7ce9;return db[_0xd9e0('0x35')]['findOne']({'where':{'id':_0x4ee5a9[_0xd9e0('0x4e')]['id']}})[_0xd9e0('0x2e')](handleEntityNotFound(_0x3e09ce,null))['then'](function(_0x190872){if(_0x190872){_0x5e853f=_0x190872;_0x5592f1[_0xd9e0('0x3e')]=_['keys'](db['Team'][_0xd9e0('0x4f')]);_0x5592f1[_0xd9e0('0x3a')]=_[_0xd9e0('0x3b')](_0x4ee5a9[_0xd9e0('0x3a')]);_0x5592f1[_0xd9e0('0x3c')]=_[_0xd9e0('0x3d')](_0x5592f1['model'],_0x5592f1[_0xd9e0('0x3a')]);_0x1a04bc[_0xd9e0('0x3f')]=_['intersection'](_0x5592f1[_0xd9e0('0x3e')],qs[_0xd9e0('0x40')](_0x4ee5a9[_0xd9e0('0x3a')]['fields']));_0x1a04bc['attributes']=_0x1a04bc[_0xd9e0('0x3f')][_0xd9e0('0x41')]?_0x1a04bc[_0xd9e0('0x3f')]:_0x5592f1['model'];_0x1a04bc[_0xd9e0('0x43')]=qs['sort'](_0x4ee5a9[_0xd9e0('0x3a')][_0xd9e0('0x44')]);_0x1a04bc[_0xd9e0('0x45')]=qs['filters'](_['pick'](_0x4ee5a9[_0xd9e0('0x3a')],_0x5592f1['filters']));if(_0x4ee5a9[_0xd9e0('0x3a')]['filter']){_0x1a04bc[_0xd9e0('0x45')]=_[_0xd9e0('0x46')](_0x1a04bc[_0xd9e0('0x45')],{'$or':_[_0xd9e0('0x39')](_0x1a04bc[_0xd9e0('0x3f')],function(_0x48e702){var _0xf6c083={};_0xf6c083[_0x48e702]={'$like':'%'+_0x4ee5a9['query']['filter']+'%'};return _0xf6c083;})});}_0x1a04bc=_[_0xd9e0('0x46')]({},_0x1a04bc,_0x4ee5a9[_0xd9e0('0x48')]);return _0x5e853f[_0xd9e0('0x6b')](_0x1a04bc);}})['then'](function(_0x18a782){if(_0x18a782){_0x4d7ce9=_0x18a782[_0xd9e0('0x41')];if(!_0x4ee5a9['query'][_0xd9e0('0x42')](_0xd9e0('0x60'))){_0x1a04bc[_0xd9e0('0x25')]=qs[_0xd9e0('0x25')](_0x4ee5a9['query'][_0xd9e0('0x25')]);_0x1a04bc['offset']=qs[_0xd9e0('0x27')](_0x4ee5a9['query'][_0xd9e0('0x27')]);}return _0x5e853f['getTeams'](_0x1a04bc);}})[_0xd9e0('0x2e')](function(_0x301eaa){if(_0x301eaa){return _0x301eaa?{'count':_0x4d7ce9,'rows':_0x301eaa}:null;}})[_0xd9e0('0x2e')](respondWithResult(_0x3e09ce,null))[_0xd9e0('0x4c')](handleError(_0x3e09ce,null));};exports[_0xd9e0('0x6c')]=function(_0x4dd18e,_0x3ec396,_0x1579ea){var _0x21a2c5=_0x4dd18e[_0xd9e0('0x52')][_0xd9e0('0x6d')];return db[_0xd9e0('0x6e')][_0xd9e0('0x4a')]({'where':{'id':_0x21a2c5},'attributes':['id'],'include':[{'model':db[_0xd9e0('0x63')],'as':_0xd9e0('0x6f'),'attributes':['id','name','online',_0xd9e0('0x70'),_0xd9e0('0x71')],'raw':!![]}]})[_0xd9e0('0x2e')](function(_0x4319e1){if(_0x4319e1){var _0x784cc7=_[_0xd9e0('0x72')](_0x4319e1,function(_0x11c828){var _0x5dc94f=_0x11c828['get']({'plain':!![]});return _0x5dc94f['Agents'];});return db[_0xd9e0('0x35')]['find']({'where':{'id':_0x4dd18e[_0xd9e0('0x4e')]['id']}})[_0xd9e0('0x2e')](function(_0x12ed8b){return db[_0xd9e0('0x73')]['transaction'](function(_0x35a797){return _0x12ed8b[_0xd9e0('0x6c')](_0x21a2c5,{'transaction':_0x35a797})['then'](function(){return BPromise[_0xd9e0('0x74')](_0x784cc7,function(_0x163b95){return db[_0xd9e0('0x5f')]['findOrCreate']({'where':{'UserId':_0x163b95['id'],'MailQueueId':_0x4dd18e[_0xd9e0('0x4e')]['id']},'transaction':_0x35a797});});})[_0xd9e0('0x2e')](function(){_0x784cc7[_0xd9e0('0x75')](function(_0x362e03){socket[_0xd9e0('0x76')](_0xd9e0('0x77'),{'UserId':_0x362e03['id'],'MailQueueId':_0x12ed8b['id']});});});});});}})['then'](respondWithStatusCode(_0x3ec396,null))['catch'](handleError(_0x3ec396,null));};exports[_0xd9e0('0x78')]=function(_0x180f40,_0x4d58ed,_0x46ac88){return db['Team']['findAll']({'where':{'id':_0x180f40[_0xd9e0('0x3a')][_0xd9e0('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xd9e0('0x63')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xd9e0('0x2e')](handleEntityNotFound(_0x4d58ed,null))[_0xd9e0('0x2e')](function(_0x1a2a57){var _0x52485a=_[_0xd9e0('0x39')](_0x1a2a57,'id');var _0x36b1a7=[];var _0x286fe5=[];var _0x153d65=squel[_0xd9e0('0x79')]();_0x153d65[_0xd9e0('0x7a')](_0xd9e0('0x7b'))[_0xd9e0('0x7c')](_0xd9e0('0x7d'),'tq')[_0xd9e0('0x7e')](_0xd9e0('0x7f'),'ut',_0xd9e0('0x80'))[_0xd9e0('0x45')](_0xd9e0('0x81'),_0x180f40[_0xd9e0('0x4e')]['id']);for(var _0x121155=0x0;_0x121155<_0x1a2a57['length'];_0x121155+=0x1){let _0xfca463=_0x1a2a57[_0x121155];for(var _0x4a8986=0x0;_0x4a8986<_0xfca463[_0xd9e0('0x6f')][_0xd9e0('0x41')];_0x4a8986+=0x1){let _0x5dcf79=_0xfca463['Agents'][_0x4a8986];var _0x3b6b75=_0x153d65[_0xd9e0('0x82')]();_0x3b6b75[_0xd9e0('0x45')]('ut.UserId\x20=\x20?',_0x5dcf79['id']);_0x286fe5[_0xd9e0('0x83')](db[_0xd9e0('0x73')]['query'](_0x3b6b75['toString'](),{'type':db[_0xd9e0('0x73')]['QueryTypes'][_0xd9e0('0x84')]})[_0xd9e0('0x2e')](function(_0x20fa07){if(_0x20fa07['length']===0x1){return _0x5dcf79['id'];}else{var _0x5708e9=_[_0xd9e0('0x85')](_[_0xd9e0('0x39')](_0x20fa07,_0xd9e0('0x86')),function(_0xb221d5){return _['includes'](_0x52485a,_0xb221d5);});if(_0x5708e9){return _0x5dcf79['id'];}}}));}}return BPromise['all'](_0x286fe5)[_0xd9e0('0x2e')](function(_0x1e1ff9){_0x36b1a7=_(_0x36b1a7)[_0xd9e0('0x87')](_0x1e1ff9)[_0xd9e0('0x88')]()[_0xd9e0('0x89')]();return db[_0xd9e0('0x35')]['find']({'where':{'id':_0x180f40['params']['id']}})[_0xd9e0('0x2e')](function(_0xf43993){return db['sequelize'][_0xd9e0('0x8a')](function(_0x5a9be8){return _0xf43993[_0xd9e0('0x78')](_0x180f40[_0xd9e0('0x3a')][_0xd9e0('0x6d')],{'transaction':_0x5a9be8})['then'](function(){if(!_['isEmpty'](_0x36b1a7)){return _0xf43993[_0xd9e0('0x8b')](_0x36b1a7,{'transaction':_0x5a9be8});}})[_0xd9e0('0x2e')](function(){_0x36b1a7[_0xd9e0('0x75')](function(_0x54864c){socket[_0xd9e0('0x76')](_0xd9e0('0x8c'),{'UserId':_0x54864c,'MailQueueId':_0xf43993['id']});});});});});});})['then'](respondWithStatusCode(_0x4d58ed,null))[_0xd9e0('0x4c')](handleError(_0x4d58ed,null));};exports[_0xd9e0('0x8d')]=function(_0x393bc7,_0x134d91,_0x82e2db){return db['MailQueue'][_0xd9e0('0x51')]({'where':{'id':_0x393bc7['params']['id']}})[_0xd9e0('0x2e')](handleEntityNotFound(_0x134d91,null))[_0xd9e0('0x2e')](function(_0x571ed4){if(_0x571ed4){return _0x571ed4[_0xd9e0('0x8d')](_0x393bc7[_0xd9e0('0x52')][_0xd9e0('0x6d')],_['omit'](_0x393bc7['body'],['ids','id'])||{})[_0xd9e0('0x8e')](function(_0x4deeaf){for(var _0x1e4e6a=0x0;_0x1e4e6a<_0x393bc7['body'][_0xd9e0('0x6d')]['length'];_0x1e4e6a+=0x1){socket['emit'](_0xd9e0('0x77'),{'UserId':Number(_0x393bc7[_0xd9e0('0x52')][_0xd9e0('0x6d')][_0x1e4e6a]),'MailQueueId':Number(_0x393bc7[_0xd9e0('0x4e')]['id'])});}return _0x4deeaf;});}})[_0xd9e0('0x2e')](respondWithResult(_0x134d91,null))[_0xd9e0('0x4c')](handleError(_0x134d91,null));};exports[_0xd9e0('0x8b')]=function(_0x57667c,_0x384dec,_0x15a4a0){return db[_0xd9e0('0x35')][_0xd9e0('0x51')]({'where':{'id':_0x57667c['params']['id']}})[_0xd9e0('0x2e')](handleEntityNotFound(_0x384dec,null))[_0xd9e0('0x2e')](function(_0x30645b){if(_0x30645b){return _0x30645b[_0xd9e0('0x8b')](_0x57667c[_0xd9e0('0x3a')][_0xd9e0('0x6d')])[_0xd9e0('0x2e')](function(){if(_['isArray'](_0x57667c[_0xd9e0('0x3a')][_0xd9e0('0x6d')])){for(var _0x1bf339=0x0;_0x1bf339<_0x57667c[_0xd9e0('0x3a')]['ids'][_0xd9e0('0x41')];_0x1bf339+=0x1){socket[_0xd9e0('0x76')](_0xd9e0('0x8c'),{'UserId':Number(_0x57667c['query'][_0xd9e0('0x6d')][_0x1bf339]),'MailQueueId':Number(_0x57667c[_0xd9e0('0x4e')]['id'])});}}else{socket[_0xd9e0('0x76')](_0xd9e0('0x8c'),{'UserId':Number(_0x57667c[_0xd9e0('0x3a')][_0xd9e0('0x6d')]),'MailQueueId':Number(_0x57667c[_0xd9e0('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x384dec,null))[_0xd9e0('0x4c')](handleError(_0x384dec,null));};exports[_0xd9e0('0x8f')]=function(_0x2aff0a,_0x44c140,_0x415e02){var _0x4a6f74={};var _0x2113bf={};var _0x44df9c;var _0x457350;return db['MailQueue']['findOne']({'where':{'id':_0x2aff0a['params']['id']}})[_0xd9e0('0x2e')](handleEntityNotFound(_0x44c140,null))['then'](function(_0x14aad4){if(_0x14aad4){_0x44df9c=_0x14aad4;_0x2113bf['model']=_[_0xd9e0('0x3b')](db[_0xd9e0('0x63')]['rawAttributes']);_0x2113bf[_0xd9e0('0x3a')]=_[_0xd9e0('0x3b')](_0x2aff0a[_0xd9e0('0x3a')]);_0x2113bf[_0xd9e0('0x3c')]=_[_0xd9e0('0x3d')](_0x2113bf[_0xd9e0('0x3e')],_0x2113bf['query']);_0x4a6f74[_0xd9e0('0x3f')]=_['intersection'](_0x2113bf[_0xd9e0('0x3e')],qs[_0xd9e0('0x40')](_0x2aff0a['query'][_0xd9e0('0x40')]));_0x4a6f74[_0xd9e0('0x3f')]=_0x4a6f74[_0xd9e0('0x3f')][_0xd9e0('0x41')]?_0x4a6f74['attributes']:_0x2113bf[_0xd9e0('0x3e')];_0x4a6f74['order']=qs[_0xd9e0('0x44')](_0x2aff0a['query']['sort']);_0x4a6f74[_0xd9e0('0x45')]=qs[_0xd9e0('0x3c')](_[_0xd9e0('0x90')](_0x2aff0a[_0xd9e0('0x3a')],_0x2113bf[_0xd9e0('0x3c')]));if(_0x2aff0a[_0xd9e0('0x3a')][_0xd9e0('0x62')]){_0x4a6f74[_0xd9e0('0x45')]=_[_0xd9e0('0x46')](_0x4a6f74[_0xd9e0('0x45')],{'$or':_[_0xd9e0('0x39')](_0x4a6f74[_0xd9e0('0x3f')],function(_0x3b61e1){var _0x4cd0da={};_0x4cd0da[_0x3b61e1]={'$like':'%'+_0x2aff0a[_0xd9e0('0x3a')]['filter']+'%'};return _0x4cd0da;})});}_0x4a6f74=_['merge']({},_0x4a6f74,_0x2aff0a[_0xd9e0('0x48')]);return _0x44df9c[_0xd9e0('0x8f')](_0x4a6f74);}})[_0xd9e0('0x2e')](function(_0x31036a){if(_0x31036a){_0x457350=_0x31036a[_0xd9e0('0x41')];if(!_0x2aff0a[_0xd9e0('0x3a')][_0xd9e0('0x42')](_0xd9e0('0x60'))){_0x4a6f74[_0xd9e0('0x25')]=qs[_0xd9e0('0x25')](_0x2aff0a['query'][_0xd9e0('0x25')]);_0x4a6f74[_0xd9e0('0x27')]=qs['offset'](_0x2aff0a[_0xd9e0('0x3a')][_0xd9e0('0x27')]);}return _0x44df9c['getAgents'](_0x4a6f74);}})[_0xd9e0('0x2e')](function(_0x3f9b0b){if(_0x3f9b0b){return _0x3f9b0b?{'count':_0x457350,'rows':_0x3f9b0b}:null;}})['then'](respondWithResult(_0x44c140,null))[_0xd9e0('0x4c')](handleError(_0x44c140,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 2c858b9..a5c6b74 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 _0xa6bb=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','remove'];(function(_0x1cfe2e,_0x1ebbcd){var _0x39233f=function(_0x48831a){while(--_0x48831a){_0x1cfe2e['push'](_0x1cfe2e['shift']());}};_0x39233f(++_0x1ebbcd);}(_0xa6bb,0x68));var _0xba6b=function(_0x5d15c0,_0x2044c6){_0x5d15c0=_0x5d15c0-0x0;var _0x554334=_0xa6bb[_0x5d15c0];return _0x554334;};'use strict';var EventEmitter=require(_0xba6b('0x0'));var MailQueue=require(_0xba6b('0x1'))['db'][_0xba6b('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xba6b('0x3')](0x0);var events={'afterCreate':_0xba6b('0x4'),'afterUpdate':'update','afterDestroy':_0xba6b('0x5')};function emitEvent(_0x9d9e9a){return function(_0x43ab62,_0x4a18b0,_0x3b361a){MailQueueEvents[_0xba6b('0x6')](_0x9d9e9a+':'+_0x43ab62['id'],_0x43ab62);MailQueueEvents[_0xba6b('0x6')](_0x9d9e9a,_0x43ab62);_0x3b361a(null);};}for(var e in events){if(events[_0xba6b('0x7')](e)){var event=events[e];MailQueue[_0xba6b('0x8')](e,emitEvent(event));}}module[_0xba6b('0x9')]=MailQueueEvents; \ No newline at end of file +var _0x751b=['hook','exports','events','MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x46a12b,_0xd4c43f){var _0x4f2fa1=function(_0xfa4a83){while(--_0xfa4a83){_0x46a12b['push'](_0x46a12b['shift']());}};_0x4f2fa1(++_0xd4c43f);}(_0x751b,0x66));var _0xb751=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x751b[_0x2d7f0e];return _0x110b07;};'use strict';var EventEmitter=require(_0xb751('0x0'));var MailQueue=require('../../mysqldb')['db'][_0xb751('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xb751('0x2')](0x0);var events={'afterCreate':_0xb751('0x3'),'afterUpdate':_0xb751('0x4'),'afterDestroy':_0xb751('0x5')};function emitEvent(_0x45c149){return function(_0x13ad2e,_0x238bb4,_0x23511d){MailQueueEvents[_0xb751('0x6')](_0x45c149+':'+_0x13ad2e['id'],_0x13ad2e);MailQueueEvents['emit'](_0x45c149,_0x13ad2e);_0x23511d(null);};}for(var e in events){if(events[_0xb751('0x7')](e)){var event=events[e];MailQueue[_0xb751('0x8')](e,emitEvent(event));}}module[_0xb751('0x9')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 35b72dc..933ae18 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 _0xaaaa=['request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','define','MailQueue','mail_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1a0769,_0x5c875f){var _0x398a0e=function(_0x1f5ad3){while(--_0x1f5ad3){_0x1a0769['push'](_0x1a0769['shift']());}};_0x398a0e(++_0x5c875f);}(_0xaaaa,0x1d6));var _0xaaaa=function(_0x5b5ff4,_0x254c22){_0x5b5ff4=_0x5b5ff4-0x0;var _0x55bec8=_0xaaaa[_0x5b5ff4];return _0x55bec8;};'use strict';var _=require(_0xaaaa('0x0'));var util=require(_0xaaaa('0x1'));var logger=require(_0xaaaa('0x2'))(_0xaaaa('0x3'));var moment=require(_0xaaaa('0x4'));var BPromise=require(_0xaaaa('0x5'));var rp=require(_0xaaaa('0x6'));var fs=require('fs');var path=require(_0xaaaa('0x7'));var rimraf=require(_0xaaaa('0x8'));var config=require(_0xaaaa('0x9'));var attributes=require(_0xaaaa('0xa'));module['exports']=function(_0x4423e8,_0x38e06c){return _0x4423e8[_0xaaaa('0xb')](_0xaaaa('0xc'),attributes,{'tableName':_0xaaaa('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc56a=['exports','define','MailQueue','mail_queues','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailQueue.attributes'];(function(_0x32f78b,_0x178f58){var _0x51d847=function(_0xc010c3){while(--_0xc010c3){_0x32f78b['push'](_0x32f78b['shift']());}};_0x51d847(++_0x178f58);}(_0xc56a,0x1be));var _0xac56=function(_0x31eaca,_0x577011){_0x31eaca=_0x31eaca-0x0;var _0x3648de=_0xc56a[_0x31eaca];return _0x3648de;};'use strict';var _=require(_0xac56('0x0'));var util=require('util');var logger=require(_0xac56('0x1'))(_0xac56('0x2'));var moment=require(_0xac56('0x3'));var BPromise=require(_0xac56('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xac56('0x5'));var rimraf=require(_0xac56('0x6'));var config=require(_0xac56('0x7'));var attributes=require(_0xac56('0x8'));module[_0xac56('0x9')]=function(_0x436146,_0x5455db){return _0x436146[_0xac56('0xa')](_0xac56('0xb'),attributes,{'tableName':_0xac56('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 5a0a259..edfd667 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 _0x883f=['then','MailQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','GetMailQueue','findAll','options','raw','where','attributes','limit','include','model','map','stringify','ShowMailQueue','MailQueue','find','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request'];(function(_0x2e079b,_0x2f2159){var _0xb6d183=function(_0x2501e6){while(--_0x2501e6){_0x2e079b['push'](_0x2e079b['shift']());}};_0xb6d183(++_0x2f2159);}(_0x883f,0x147));var _0xf883=function(_0x40c5e0,_0x3b77ad){_0x40c5e0=_0x40c5e0-0x0;var _0x47ee12=_0x883f[_0x40c5e0];return _0x47ee12;};'use strict';var _=require('lodash');var util=require(_0xf883('0x0'));var moment=require('moment');var BPromise=require(_0xf883('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf883('0x2'));var db=require(_0xf883('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf883('0x4'))(_0xf883('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf883('0x6')][_0xf883('0x7')]({'port':0x232a});config[_0xf883('0x8')]=_[_0xf883('0x9')](config[_0xf883('0x8')],{'host':_0xf883('0xa'),'port':0x18eb});var socket=require(_0xf883('0xb'))(new Redis(config['redis']));require(_0xf883('0xc'))[_0xf883('0xd')](socket);function respondWithRpcPromise(_0x55b4a8,_0x42fffd,_0x119595){return new BPromise(function(_0x51dc30,_0x3672){return client[_0xf883('0xe')](_0x55b4a8,_0x119595)[_0xf883('0xf')](function(_0x375612){logger['info'](_0xf883('0x10'),_0x42fffd,_0xf883('0x11'));logger[_0xf883('0x12')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x42fffd,_0xf883('0x11'),JSON['stringify'](_0x375612));if(_0x375612[_0xf883('0x13')]){if(_0x375612[_0xf883('0x13')][_0xf883('0x14')]===0x1f4){logger[_0xf883('0x13')](_0xf883('0x10'),_0x42fffd,_0x375612[_0xf883('0x13')][_0xf883('0x15')]);return _0x3672(_0x375612[_0xf883('0x13')]['message']);}logger[_0xf883('0x13')](_0xf883('0x10'),_0x42fffd,_0x375612[_0xf883('0x13')][_0xf883('0x15')]);return _0x51dc30(_0x375612[_0xf883('0x13')][_0xf883('0x15')]);}else{logger[_0xf883('0x16')](_0xf883('0x10'),_0x42fffd,'request\x20sent');_0x51dc30(_0x375612['result'][_0xf883('0x15')]);}})[_0xf883('0x17')](function(_0x5043f9){logger[_0xf883('0x13')]('MailQueue,\x20%s,\x20%s',_0x42fffd,_0x5043f9);_0x3672(_0x5043f9);});});}exports[_0xf883('0x18')]=function(_0x41412b){var _0x306dd5=this;return new Promise(function(_0x4b3e16,_0x2c7bd6){return db['MailQueue'][_0xf883('0x19')]({'raw':_0x41412b[_0xf883('0x1a')]?_0x41412b[_0xf883('0x1a')][_0xf883('0x1b')]===undefined?!![]:![]:!![],'where':_0x41412b[_0xf883('0x1a')]?_0x41412b['options'][_0xf883('0x1c')]||null:null,'attributes':_0x41412b[_0xf883('0x1a')]?_0x41412b[_0xf883('0x1a')][_0xf883('0x1d')]||null:null,'limit':_0x41412b[_0xf883('0x1a')]?_0x41412b[_0xf883('0x1a')][_0xf883('0x1e')]||null:null,'include':_0x41412b[_0xf883('0x1a')]?_0x41412b[_0xf883('0x1a')][_0xf883('0x1f')]?_['map'](_0x41412b[_0xf883('0x1a')][_0xf883('0x1f')],function(_0x5dbb80){return{'model':db[_0x5dbb80[_0xf883('0x20')]],'as':_0x5dbb80['as'],'attributes':_0x5dbb80[_0xf883('0x1d')],'include':_0x5dbb80[_0xf883('0x1f')]?_['map'](_0x5dbb80[_0xf883('0x1f')],function(_0x13d509){return{'model':db[_0x13d509[_0xf883('0x20')]],'as':_0x13d509['as'],'attributes':_0x13d509['attributes'],'include':_0x13d509[_0xf883('0x1f')]?_[_0xf883('0x21')](_0x13d509['include'],function(_0x188a17){return{'model':db[_0x188a17['model']],'as':_0x188a17['as'],'attributes':_0x188a17[_0xf883('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf883('0xf')](function(_0x52989f){logger[_0xf883('0x16')](_0xf883('0x18'),_0x41412b);logger[_0xf883('0x12')](_0xf883('0x18'),_0x41412b,JSON[_0xf883('0x22')](_0x52989f));_0x4b3e16(_0x52989f);})[_0xf883('0x17')](function(_0x3366fd){logger[_0xf883('0x13')]('GetMailQueue',_0x3366fd[_0xf883('0x15')],_0x41412b);_0x2c7bd6(_0x306dd5[_0xf883('0x13')](0x1f4,_0x3366fd['message']));});});};exports[_0xf883('0x23')]=function(_0x13308a){var _0x7b9fa5=this;return new Promise(function(_0xd1e0c8,_0x125d09){return db[_0xf883('0x24')][_0xf883('0x25')]({'raw':_0x13308a['options']?_0x13308a['options'][_0xf883('0x1b')]===undefined?!![]:![]:!![],'where':_0x13308a[_0xf883('0x1a')]?_0x13308a[_0xf883('0x1a')][_0xf883('0x1c')]||null:null,'attributes':_0x13308a[_0xf883('0x1a')]?_0x13308a['options'][_0xf883('0x1d')]||null:null,'include':_0x13308a[_0xf883('0x1a')]?_0x13308a[_0xf883('0x1a')][_0xf883('0x1f')]?_[_0xf883('0x21')](_0x13308a[_0xf883('0x1a')]['include'],function(_0x549c60){return{'model':db[_0x549c60[_0xf883('0x20')]],'as':_0x549c60['as'],'attributes':_0x549c60[_0xf883('0x1d')],'include':_0x549c60[_0xf883('0x1f')]?_[_0xf883('0x21')](_0x549c60[_0xf883('0x1f')],function(_0x3a0341){return{'model':db[_0x3a0341[_0xf883('0x20')]],'as':_0x3a0341['as'],'attributes':_0x3a0341[_0xf883('0x1d')],'include':_0x3a0341[_0xf883('0x1f')]?_[_0xf883('0x21')](_0x3a0341[_0xf883('0x1f')],function(_0x3a1778){return{'model':db[_0x3a1778[_0xf883('0x20')]],'as':_0x3a1778['as'],'attributes':_0x3a1778[_0xf883('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf883('0xf')](function(_0x21dfcd){logger[_0xf883('0x16')](_0xf883('0x23'),_0x13308a);logger[_0xf883('0x12')](_0xf883('0x23'),_0x13308a,JSON[_0xf883('0x22')](_0x21dfcd));_0xd1e0c8(_0x21dfcd);})[_0xf883('0x17')](function(_0x56b67e){logger[_0xf883('0x13')](_0xf883('0x23'),_0x56b67e[_0xf883('0x15')],_0x13308a);_0x125d09(_0x7b9fa5[_0xf883('0x13')](0x1f4,_0x56b67e[_0xf883('0x15')]));});});}; \ No newline at end of file +var _0xbe85=['ShowMailQueue','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailQueue.socket','register','request','then','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message','info','catch','GetMailQueue','MailQueue','findAll','options','raw','limit','map','include','attributes','model'];(function(_0x400820,_0x2a1c63){var _0x3764c1=function(_0x208cf5){while(--_0x208cf5){_0x400820['push'](_0x400820['shift']());}};_0x3764c1(++_0x2a1c63);}(_0xbe85,0x19c));var _0x5be8=function(_0x16d58f,_0x56a17b){_0x16d58f=_0x16d58f-0x0;var _0x351591=_0xbe85[_0x16d58f];return _0x351591;};'use strict';var _=require(_0x5be8('0x0'));var util=require(_0x5be8('0x1'));var moment=require(_0x5be8('0x2'));var BPromise=require('bluebird');var rs=require(_0x5be8('0x3'));var fs=require('fs');var Redis=require(_0x5be8('0x4'));var db=require(_0x5be8('0x5'))['db'];var utils=require(_0x5be8('0x6'));var logger=require(_0x5be8('0x7'))(_0x5be8('0x8'));var config=require(_0x5be8('0x9'));var jayson=require(_0x5be8('0xa'));var client=jayson[_0x5be8('0xb')][_0x5be8('0xc')]({'port':0x232a});config[_0x5be8('0xd')]=_[_0x5be8('0xe')](config[_0x5be8('0xd')],{'host':_0x5be8('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5be8('0x10'))[_0x5be8('0x11')](socket);function respondWithRpcPromise(_0x1bd278,_0x40cf01,_0x182c0f){return new BPromise(function(_0x41e55d,_0x54c052){return client[_0x5be8('0x12')](_0x1bd278,_0x182c0f)[_0x5be8('0x13')](function(_0x50a107){logger['info']('MailQueue,\x20%s,\x20%s',_0x40cf01,_0x5be8('0x14'));logger['debug'](_0x5be8('0x15'),_0x40cf01,_0x5be8('0x14'),JSON[_0x5be8('0x16')](_0x50a107));if(_0x50a107[_0x5be8('0x17')]){if(_0x50a107[_0x5be8('0x17')][_0x5be8('0x18')]===0x1f4){logger[_0x5be8('0x17')](_0x5be8('0x19'),_0x40cf01,_0x50a107[_0x5be8('0x17')][_0x5be8('0x1a')]);return _0x54c052(_0x50a107[_0x5be8('0x17')][_0x5be8('0x1a')]);}logger['error']('MailQueue,\x20%s,\x20%s',_0x40cf01,_0x50a107[_0x5be8('0x17')][_0x5be8('0x1a')]);return _0x41e55d(_0x50a107['error'][_0x5be8('0x1a')]);}else{logger[_0x5be8('0x1b')](_0x5be8('0x19'),_0x40cf01,'request\x20sent');_0x41e55d(_0x50a107['result'][_0x5be8('0x1a')]);}})[_0x5be8('0x1c')](function(_0x29515f){logger[_0x5be8('0x17')](_0x5be8('0x19'),_0x40cf01,_0x29515f);_0x54c052(_0x29515f);});});}exports[_0x5be8('0x1d')]=function(_0x342cb9){var _0x36b4a0=this;return new Promise(function(_0x58b54a,_0x55f63b){return db[_0x5be8('0x1e')][_0x5be8('0x1f')]({'raw':_0x342cb9['options']?_0x342cb9[_0x5be8('0x20')][_0x5be8('0x21')]===undefined?!![]:![]:!![],'where':_0x342cb9[_0x5be8('0x20')]?_0x342cb9[_0x5be8('0x20')]['where']||null:null,'attributes':_0x342cb9['options']?_0x342cb9[_0x5be8('0x20')]['attributes']||null:null,'limit':_0x342cb9['options']?_0x342cb9['options'][_0x5be8('0x22')]||null:null,'include':_0x342cb9[_0x5be8('0x20')]?_0x342cb9[_0x5be8('0x20')]['include']?_[_0x5be8('0x23')](_0x342cb9[_0x5be8('0x20')][_0x5be8('0x24')],function(_0xf4fb53){return{'model':db[_0xf4fb53['model']],'as':_0xf4fb53['as'],'attributes':_0xf4fb53[_0x5be8('0x25')],'include':_0xf4fb53[_0x5be8('0x24')]?_[_0x5be8('0x23')](_0xf4fb53[_0x5be8('0x24')],function(_0x54a113){return{'model':db[_0x54a113[_0x5be8('0x26')]],'as':_0x54a113['as'],'attributes':_0x54a113['attributes'],'include':_0x54a113[_0x5be8('0x24')]?_[_0x5be8('0x23')](_0x54a113[_0x5be8('0x24')],function(_0xc23cfd){return{'model':db[_0xc23cfd[_0x5be8('0x26')]],'as':_0xc23cfd['as'],'attributes':_0xc23cfd['attributes']};}):[]};}):[]};}):[]:[]})[_0x5be8('0x13')](function(_0x58206e){logger['info']('GetMailQueue',_0x342cb9);logger['debug'](_0x5be8('0x1d'),_0x342cb9,JSON[_0x5be8('0x16')](_0x58206e));_0x58b54a(_0x58206e);})[_0x5be8('0x1c')](function(_0x179698){logger[_0x5be8('0x17')](_0x5be8('0x1d'),_0x179698[_0x5be8('0x1a')],_0x342cb9);_0x55f63b(_0x36b4a0[_0x5be8('0x17')](0x1f4,_0x179698['message']));});});};exports['ShowMailQueue']=function(_0x14f6de){var _0x40b699=this;return new Promise(function(_0x5dc0db,_0x6d0b00){return db[_0x5be8('0x1e')]['find']({'raw':_0x14f6de[_0x5be8('0x20')]?_0x14f6de['options'][_0x5be8('0x21')]===undefined?!![]:![]:!![],'where':_0x14f6de[_0x5be8('0x20')]?_0x14f6de[_0x5be8('0x20')]['where']||null:null,'attributes':_0x14f6de[_0x5be8('0x20')]?_0x14f6de[_0x5be8('0x20')]['attributes']||null:null,'include':_0x14f6de[_0x5be8('0x20')]?_0x14f6de[_0x5be8('0x20')][_0x5be8('0x24')]?_[_0x5be8('0x23')](_0x14f6de['options']['include'],function(_0x31526d){return{'model':db[_0x31526d[_0x5be8('0x26')]],'as':_0x31526d['as'],'attributes':_0x31526d[_0x5be8('0x25')],'include':_0x31526d[_0x5be8('0x24')]?_[_0x5be8('0x23')](_0x31526d['include'],function(_0x5cc9cb){return{'model':db[_0x5cc9cb[_0x5be8('0x26')]],'as':_0x5cc9cb['as'],'attributes':_0x5cc9cb[_0x5be8('0x25')],'include':_0x5cc9cb[_0x5be8('0x24')]?_['map'](_0x5cc9cb[_0x5be8('0x24')],function(_0x8319a1){return{'model':db[_0x8319a1[_0x5be8('0x26')]],'as':_0x8319a1['as'],'attributes':_0x8319a1[_0x5be8('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c430d){logger[_0x5be8('0x1b')](_0x5be8('0x27'),_0x14f6de);logger[_0x5be8('0x28')](_0x5be8('0x27'),_0x14f6de,JSON[_0x5be8('0x16')](_0x1c430d));_0x5dc0db(_0x1c430d);})['catch'](function(_0x3dc0c0){logger['error'](_0x5be8('0x27'),_0x3dc0c0[_0x5be8('0x1a')],_0x14f6de);_0x6d0b00(_0x40b699[_0x5be8('0x17')](0x1f4,_0x3dc0c0[_0x5be8('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 8ab8997..8e16837 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 _0xe74a=['mailQueue:','./mailQueue.events','save','update','emit','register','length'];(function(_0x461fa0,_0x20ecde){var _0x8df1d9=function(_0x3e6138){while(--_0x3e6138){_0x461fa0['push'](_0x461fa0['shift']());}};_0x8df1d9(++_0x20ecde);}(_0xe74a,0x127));var _0xae74=function(_0x319a03,_0x4456d4){_0x319a03=_0x319a03-0x0;var _0x3b6704=_0xe74a[_0x319a03];return _0x3b6704;};'use strict';var MailQueueEvents=require(_0xae74('0x0'));var events=[_0xae74('0x1'),'remove',_0xae74('0x2')];function createListener(_0x45c360,_0x3f038){return function(_0xed6ab1){_0x3f038[_0xae74('0x3')](_0x45c360,_0xed6ab1);};}function removeListener(_0x57ad80,_0x1e964a){return function(){MailQueueEvents['removeListener'](_0x57ad80,_0x1e964a);};}exports[_0xae74('0x4')]=function(_0x6195d3){for(var _0x63d46e=0x0,_0x1e19e6=events[_0xae74('0x5')];_0x63d46e<_0x1e19e6;_0x63d46e++){var _0x122b87=events[_0x63d46e];var _0x13cc22=createListener(_0xae74('0x6')+_0x122b87,_0x6195d3);MailQueueEvents['on'](_0x122b87,_0x13cc22);}}; \ No newline at end of file +var _0x8453=['emit','removeListener','register','mailQueue:','./mailQueue.events','save','remove','update'];(function(_0x81af35,_0x3ace90){var _0x413bd2=function(_0x1c73e2){while(--_0x1c73e2){_0x81af35['push'](_0x81af35['shift']());}};_0x413bd2(++_0x3ace90);}(_0x8453,0x174));var _0x3845=function(_0x486f07,_0x39bb72){_0x486f07=_0x486f07-0x0;var _0x142200=_0x8453[_0x486f07];return _0x142200;};'use strict';var MailQueueEvents=require(_0x3845('0x0'));var events=[_0x3845('0x1'),_0x3845('0x2'),_0x3845('0x3')];function createListener(_0x557311,_0x77cf41){return function(_0x56d179){_0x77cf41[_0x3845('0x4')](_0x557311,_0x56d179);};}function removeListener(_0x227c77,_0x52b3f2){return function(){MailQueueEvents[_0x3845('0x5')](_0x227c77,_0x52b3f2);};}exports[_0x3845('0x6')]=function(_0x20ded1){for(var _0x4c3790=0x0,_0xfbfb5e=events['length'];_0x4c3790<_0xfbfb5e;_0x4c3790++){var _0x463f61=events[_0x4c3790];var _0x3de627=createListener(_0x3845('0x7')+_0x463f61,_0x20ded1);MailQueueEvents['on'](_0x463f61,_0x3de627);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 0073e4e..c7b7233 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 _0x3774=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','create','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router'];(function(_0x7155,_0x5533ae){var _0x424f40=function(_0x1d3c8b){while(--_0x1d3c8b){_0x7155['push'](_0x7155['shift']());}};_0x424f40(++_0x5533ae);}(_0x3774,0x15b));var _0x4377=function(_0x68d84d,_0x154588){_0x68d84d=_0x68d84d-0x0;var _0x191eb6=_0x3774[_0x68d84d];return _0x191eb6;};'use strict';var multer=require(_0x4377('0x0'));var util=require(_0x4377('0x1'));var path=require('path');var timeout=require(_0x4377('0x2'));var express=require(_0x4377('0x3'));var router=express[_0x4377('0x4')]();var fs_extra=require(_0x4377('0x5'));var auth=require(_0x4377('0x6'));var interaction=require(_0x4377('0x7'));var config=require(_0x4377('0x8'));var controller=require(_0x4377('0x9'));router[_0x4377('0xa')]('/',auth[_0x4377('0xb')](),controller[_0x4377('0xc')]);router[_0x4377('0xa')](_0x4377('0xd'),auth[_0x4377('0xb')](),controller[_0x4377('0xe')]);router[_0x4377('0xa')]('/:id',auth[_0x4377('0xb')](),controller[_0x4377('0xf')]);router['post']('/',auth[_0x4377('0xb')](),controller[_0x4377('0x10')]);router[_0x4377('0x11')](_0x4377('0x12'),auth['isAuthenticated'](),controller[_0x4377('0x13')]);router[_0x4377('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x4377('0x15')]=router; \ No newline at end of file +var _0x24f2=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','update','delete'];(function(_0x48885b,_0x5b5dca){var _0x11f617=function(_0x18d8f3){while(--_0x18d8f3){_0x48885b['push'](_0x48885b['shift']());}};_0x11f617(++_0x5b5dca);}(_0x24f2,0x1cf));var _0x224f=function(_0x3f88bc,_0xe38cf5){_0x3f88bc=_0x3f88bc-0x0;var _0x4df1c4=_0x24f2[_0x3f88bc];return _0x4df1c4;};'use strict';var multer=require('multer');var util=require(_0x224f('0x0'));var path=require(_0x224f('0x1'));var timeout=require(_0x224f('0x2'));var express=require(_0x224f('0x3'));var router=express[_0x224f('0x4')]();var fs_extra=require(_0x224f('0x5'));var auth=require(_0x224f('0x6'));var interaction=require(_0x224f('0x7'));var config=require(_0x224f('0x8'));var controller=require(_0x224f('0x9'));router[_0x224f('0xa')]('/',auth[_0x224f('0xb')](),controller[_0x224f('0xc')]);router[_0x224f('0xa')](_0x224f('0xd'),auth[_0x224f('0xb')](),controller[_0x224f('0xe')]);router['get'](_0x224f('0xf'),auth[_0x224f('0xb')](),controller['show']);router[_0x224f('0x10')]('/',auth[_0x224f('0xb')](),controller[_0x224f('0x11')]);router['put'](_0x224f('0xf'),auth[_0x224f('0xb')](),controller[_0x224f('0x12')]);router[_0x224f('0x13')](_0x224f('0xf'),auth[_0x224f('0xb')](),controller['destroy']);module[_0x224f('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 10ab17a..ccafb67 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 _0x4c54=['STRING','DATE','sequelize','exports'];(function(_0x2e1c86,_0x281ecc){var _0x584f13=function(_0x30d6f9){while(--_0x30d6f9){_0x2e1c86['push'](_0x2e1c86['shift']());}};_0x584f13(++_0x281ecc);}(_0x4c54,0xaa));var _0x44c5=function(_0x30c84f,_0x32587d){_0x30c84f=_0x30c84f-0x0;var _0x437755=_0x4c54[_0x30c84f];return _0x437755;};'use strict';var moment=require('moment');var Sequelize=require(_0x44c5('0x0'));module[_0x44c5('0x1')]={'uniqueid':{'type':Sequelize[_0x44c5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x44c5('0x3')]},'leaveAt':{'type':Sequelize[_0x44c5('0x3')]},'acceptAt':{'type':Sequelize[_0x44c5('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x44c5('0x2')]}}; \ No newline at end of file +var _0x977d=['sequelize','STRING','DATE','moment'];(function(_0x472e5d,_0x2d5ab0){var _0x25f675=function(_0x582401){while(--_0x582401){_0x472e5d['push'](_0x472e5d['shift']());}};_0x25f675(++_0x2d5ab0);}(_0x977d,0xc7));var _0xd977=function(_0x5c1d3f,_0x4f2033){_0x5c1d3f=_0x5c1d3f-0x0;var _0xd2199=_0x977d[_0x5c1d3f];return _0xd2199;};'use strict';var moment=require(_0xd977('0x0'));var Sequelize=require(_0xd977('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xd977('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd977('0x3')]},'acceptAt':{'type':Sequelize[_0xd977('0x3')]},'exitAt':{'type':Sequelize[_0xd977('0x3')]},'reason':{'type':Sequelize[_0xd977('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index ef786c4..7d1f133 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 _0xc2c7=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','destroy','then','error','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where'];(function(_0x6ef2dd,_0x4c79f8){var _0xf3bec8=function(_0x2fe136){while(--_0x2fe136){_0x6ef2dd['push'](_0x6ef2dd['shift']());}};_0xf3bec8(++_0x4c79f8);}(_0xc2c7,0x134));var _0x7c2c=function(_0x5f6169,_0x353af0){_0x5f6169=_0x5f6169-0x0;var _0x29762e=_0xc2c7[_0x5f6169];return _0x29762e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c2c('0x0'));var zipdir=require(_0x7c2c('0x1'));var jsonpatch=require(_0x7c2c('0x2'));var rp=require(_0x7c2c('0x3'));var moment=require(_0x7c2c('0x4'));var BPromise=require(_0x7c2c('0x5'));var Mustache=require(_0x7c2c('0x6'));var util=require(_0x7c2c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7c2c('0x8'));var ejs=require(_0x7c2c('0x9'));var fs=require('fs');var fs_extra=require(_0x7c2c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7c2c('0xb'));var deskjs=require(_0x7c2c('0xc'));var toCsv=require(_0x7c2c('0x8'));var querystring=require(_0x7c2c('0xd'));var Papa=require(_0x7c2c('0xe'));var Redis=require('ioredis');var authService=require(_0x7c2c('0xf'));var qs=require(_0x7c2c('0x10'));var as=require(_0x7c2c('0x11'));var hardwareService=require(_0x7c2c('0x12'));var logger=require(_0x7c2c('0x13'))(_0x7c2c('0x14'));var utils=require(_0x7c2c('0x15'));var config=require(_0x7c2c('0x16'));var licenseUtil=require(_0x7c2c('0x17'));var db=require(_0x7c2c('0x18'))['db'];function respondWithStatusCode(_0xae8441,_0x45847d){_0x45847d=_0x45847d||0xcc;return function(_0x68398a){if(_0x68398a){return _0xae8441[_0x7c2c('0x19')](_0x45847d);}return _0xae8441[_0x7c2c('0x1a')](_0x45847d)[_0x7c2c('0x1b')]();};}function respondWithResult(_0x4c4aaf,_0x5b5729){_0x5b5729=_0x5b5729||0xc8;return function(_0x102778){if(_0x102778){return _0x4c4aaf[_0x7c2c('0x1a')](_0x5b5729)[_0x7c2c('0x1c')](_0x102778);}};}function respondWithFilteredResult(_0x5ae94f,_0x11424c){return function(_0x206ecd){if(_0x206ecd){var _0x5e55e0=typeof _0x11424c[_0x7c2c('0x1d')]==='undefined'&&typeof _0x11424c[_0x7c2c('0x1e')]==='undefined';var _0x342ea2=_0x206ecd[_0x7c2c('0x1f')];var _0x14453f=_0x5e55e0?0x0:_0x11424c[_0x7c2c('0x1d')];var _0x17df4a=_0x5e55e0?_0x206ecd[_0x7c2c('0x1f')]:_0x11424c[_0x7c2c('0x1d')]+_0x11424c[_0x7c2c('0x1e')];var _0x2d356e;if(_0x17df4a>=_0x342ea2){_0x17df4a=_0x342ea2;_0x2d356e=0xc8;}else{_0x2d356e=0xce;}_0x5ae94f[_0x7c2c('0x1a')](_0x2d356e);return _0x5ae94f[_0x7c2c('0x20')](_0x7c2c('0x21'),_0x14453f+'-'+_0x17df4a+'/'+_0x342ea2)['json'](_0x206ecd);}return null;};}function patchUpdates(_0x1c5491){return function(_0x4adb62){try{jsonpatch['apply'](_0x4adb62,_0x1c5491,!![]);}catch(_0x15ae33){return BPromise[_0x7c2c('0x22')](_0x15ae33);}return _0x4adb62[_0x7c2c('0x23')]();};}function saveUpdates(_0x38ae30,_0x41552f){return function(_0x1883b5){if(_0x1883b5){return _0x1883b5[_0x7c2c('0x24')](_0x38ae30)['then'](function(_0x10c356){return _0x10c356;});}return null;};}function removeEntity(_0x4dedd8,_0x302c93){return function(_0x57f510){if(_0x57f510){return _0x57f510[_0x7c2c('0x25')]()[_0x7c2c('0x26')](function(){_0x4dedd8[_0x7c2c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d6ec7,_0x31a50c){return function(_0x30c53e){if(!_0x30c53e){_0x4d6ec7[_0x7c2c('0x19')](0x194);}return _0x30c53e;};}function handleError(_0x150690,_0x31d8f3){_0x31d8f3=_0x31d8f3||0x1f4;return function(_0xa8e145){logger[_0x7c2c('0x27')](_0xa8e145['stack']);if(_0xa8e145[_0x7c2c('0x28')]){delete _0xa8e145[_0x7c2c('0x28')];}_0x150690[_0x7c2c('0x1a')](_0x31d8f3)[_0x7c2c('0x29')](_0xa8e145);};}exports[_0x7c2c('0x2a')]=function(_0x1f8846,_0xf2bfd1){var _0x26f472={},_0xa040ff={},_0x5769ec={'count':0x0,'rows':[]};var _0x465ad6=_[_0x7c2c('0x2b')](db[_0x7c2c('0x2c')][_0x7c2c('0x2d')],function(_0x53ad23){return{'name':_0x53ad23[_0x7c2c('0x2e')],'type':_0x53ad23[_0x7c2c('0x2f')][_0x7c2c('0x30')]};});_0xa040ff[_0x7c2c('0x31')]=_[_0x7c2c('0x2b')](_0x465ad6,_0x7c2c('0x28'));_0xa040ff[_0x7c2c('0x32')]=_['keys'](_0x1f8846[_0x7c2c('0x32')]);_0xa040ff[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0xa040ff[_0x7c2c('0x31')],_0xa040ff[_0x7c2c('0x32')]);_0x26f472['attributes']=_['intersection'](_0xa040ff[_0x7c2c('0x31')],qs['fields'](_0x1f8846['query'][_0x7c2c('0x35')]));_0x26f472[_0x7c2c('0x36')]=_0x26f472[_0x7c2c('0x36')][_0x7c2c('0x37')]?_0x26f472['attributes']:_0xa040ff[_0x7c2c('0x31')];if(!_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x38')](_0x7c2c('0x39'))){_0x26f472[_0x7c2c('0x1e')]=qs[_0x7c2c('0x1e')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1e')]);_0x26f472[_0x7c2c('0x1d')]=qs[_0x7c2c('0x1d')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1d')]);}_0x26f472[_0x7c2c('0x3a')]=qs['sort'](_0x1f8846['query'][_0x7c2c('0x3b')]);_0x26f472['where']=qs['filters'](_['pick'](_0x1f8846[_0x7c2c('0x32')],_0xa040ff[_0x7c2c('0x33')]),_0x465ad6);if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]){_0x26f472[_0x7c2c('0x3d')]=_[_0x7c2c('0x3e')](_0x26f472[_0x7c2c('0x3d')],{'$or':_[_0x7c2c('0x2b')](_0x465ad6,function(_0x2b6520){if(_0x2b6520[_0x7c2c('0x2f')]!==_0x7c2c('0x3f')){var _0x58696a={};_0x58696a[_0x2b6520['name']]={'$like':'%'+_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]+'%'};return _0x58696a;}})});}_0x26f472=_[_0x7c2c('0x3e')]({},_0x26f472,_0x1f8846[_0x7c2c('0x40')]);var _0x5e8c96={'where':_0x26f472[_0x7c2c('0x3d')]};return db[_0x7c2c('0x2c')][_0x7c2c('0x1f')](_0x5e8c96)[_0x7c2c('0x26')](function(_0x18e288){_0x5769ec[_0x7c2c('0x1f')]=_0x18e288;if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x26f472[_0x7c2c('0x42')]=[{'all':!![]}];}return db['MailQueueReport'][_0x7c2c('0x43')](_0x26f472);})['then'](function(_0x2c3f40){_0x5769ec[_0x7c2c('0x44')]=_0x2c3f40;return _0x5769ec;})['then'](respondWithFilteredResult(_0xf2bfd1,_0x26f472))[_0x7c2c('0x45')](handleError(_0xf2bfd1,null));};exports['show']=function(_0x3014fb,_0x33b2be){var _0x9b9813={'raw':!![],'where':{'id':_0x3014fb['params']['id']}},_0x26351e={};_0x26351e[_0x7c2c('0x31')]=_['keys'](db['MailQueueReport'][_0x7c2c('0x2d')]);_0x26351e[_0x7c2c('0x32')]=_[_0x7c2c('0x46')](_0x3014fb['query']);_0x26351e[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0x26351e['model'],_0x26351e[_0x7c2c('0x32')]);_0x9b9813['attributes']=_[_0x7c2c('0x34')](_0x26351e[_0x7c2c('0x31')],qs['fields'](_0x3014fb['query'][_0x7c2c('0x35')]));_0x9b9813[_0x7c2c('0x36')]=_0x9b9813['attributes'][_0x7c2c('0x37')]?_0x9b9813['attributes']:_0x26351e['model'];if(_0x3014fb[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x9b9813[_0x7c2c('0x42')]=[{'all':!![]}];}_0x9b9813=_[_0x7c2c('0x3e')]({},_0x9b9813,_0x3014fb[_0x7c2c('0x40')]);return db[_0x7c2c('0x2c')][_0x7c2c('0x47')](_0x9b9813)[_0x7c2c('0x26')](handleEntityNotFound(_0x33b2be,null))[_0x7c2c('0x26')](respondWithResult(_0x33b2be,null))['catch'](handleError(_0x33b2be,null));};exports['create']=function(_0xeb067b,_0x3091bd){return db[_0x7c2c('0x2c')]['create'](_0xeb067b['body'],{})[_0x7c2c('0x26')](respondWithResult(_0x3091bd,0xc9))[_0x7c2c('0x45')](handleError(_0x3091bd,null));};exports[_0x7c2c('0x24')]=function(_0x2b79d5,_0x5f3de8){if(_0x2b79d5['body']['id']){delete _0x2b79d5['body']['id'];}return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'id':_0x2b79d5[_0x7c2c('0x48')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x5f3de8,null))[_0x7c2c('0x26')](saveUpdates(_0x2b79d5['body'],null))[_0x7c2c('0x26')](respondWithResult(_0x5f3de8,null))[_0x7c2c('0x45')](handleError(_0x5f3de8,null));};exports['destroy']=function(_0x19621a,_0x56e09d){return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'id':_0x19621a[_0x7c2c('0x48')]['id']}})['then'](handleEntityNotFound(_0x56e09d,null))['then'](removeEntity(_0x56e09d,null))[_0x7c2c('0x45')](handleError(_0x56e09d,null));};exports['describe']=function(_0x13e0bf,_0x11d337){return db['MailQueueReport'][_0x7c2c('0x49')]()[_0x7c2c('0x26')](respondWithResult(_0x11d337,null))['catch'](handleError(_0x11d337,null));}; \ No newline at end of file +var _0x8f4c=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','filter','merge','options','MailQueueReport','includeAll','include','findAll','catch','show','params','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x3831ed,_0x5e88ce){var _0x5521ce=function(_0x15fef7){while(--_0x15fef7){_0x3831ed['push'](_0x3831ed['shift']());}};_0x5521ce(++_0x5e88ce);}(_0x8f4c,0x113));var _0xc8f4=function(_0x513d80,_0x1649db){_0x513d80=_0x513d80-0x0;var _0x174463=_0x8f4c[_0x513d80];return _0x174463;};'use strict';var emlformat=require(_0xc8f4('0x0'));var rimraf=require(_0xc8f4('0x1'));var zipdir=require(_0xc8f4('0x2'));var jsonpatch=require(_0xc8f4('0x3'));var rp=require(_0xc8f4('0x4'));var moment=require(_0xc8f4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc8f4('0x6'));var util=require(_0xc8f4('0x7'));var path=require(_0xc8f4('0x8'));var sox=require('sox');var csv=require(_0xc8f4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc8f4('0xa'));var crypto=require('crypto');var jsforce=require(_0xc8f4('0xb'));var deskjs=require(_0xc8f4('0xc'));var toCsv=require(_0xc8f4('0x9'));var querystring=require(_0xc8f4('0xd'));var Papa=require(_0xc8f4('0xe'));var Redis=require('ioredis');var authService=require(_0xc8f4('0xf'));var qs=require(_0xc8f4('0x10'));var as=require(_0xc8f4('0x11'));var hardwareService=require(_0xc8f4('0x12'));var logger=require('../../config/logger')(_0xc8f4('0x13'));var utils=require('../../config/utils');var config=require(_0xc8f4('0x14'));var licenseUtil=require(_0xc8f4('0x15'));var db=require(_0xc8f4('0x16'))['db'];function respondWithStatusCode(_0x729f8f,_0x39b785){_0x39b785=_0x39b785||0xcc;return function(_0x4e31cf){if(_0x4e31cf){return _0x729f8f[_0xc8f4('0x17')](_0x39b785);}return _0x729f8f[_0xc8f4('0x18')](_0x39b785)[_0xc8f4('0x19')]();};}function respondWithResult(_0x14bc11,_0x1dcee5){_0x1dcee5=_0x1dcee5||0xc8;return function(_0x411c5c){if(_0x411c5c){return _0x14bc11['status'](_0x1dcee5)[_0xc8f4('0x1a')](_0x411c5c);}};}function respondWithFilteredResult(_0x2c7bc1,_0x1518a6){return function(_0x46ac15){if(_0x46ac15){var _0x22c08a=typeof _0x1518a6['offset']===_0xc8f4('0x1b')&&typeof _0x1518a6['limit']==='undefined';var _0x14bc02=_0x46ac15[_0xc8f4('0x1c')];var _0x108076=_0x22c08a?0x0:_0x1518a6[_0xc8f4('0x1d')];var _0x4763c1=_0x22c08a?_0x46ac15[_0xc8f4('0x1c')]:_0x1518a6[_0xc8f4('0x1d')]+_0x1518a6[_0xc8f4('0x1e')];var _0x1982bb;if(_0x4763c1>=_0x14bc02){_0x4763c1=_0x14bc02;_0x1982bb=0xc8;}else{_0x1982bb=0xce;}_0x2c7bc1[_0xc8f4('0x18')](_0x1982bb);return _0x2c7bc1[_0xc8f4('0x1f')](_0xc8f4('0x20'),_0x108076+'-'+_0x4763c1+'/'+_0x14bc02)[_0xc8f4('0x1a')](_0x46ac15);}return null;};}function patchUpdates(_0x5f3264){return function(_0x378f56){try{jsonpatch[_0xc8f4('0x21')](_0x378f56,_0x5f3264,!![]);}catch(_0x29e52d){return BPromise[_0xc8f4('0x22')](_0x29e52d);}return _0x378f56[_0xc8f4('0x23')]();};}function saveUpdates(_0x3b42ee,_0xaeee7d){return function(_0x43eb57){if(_0x43eb57){return _0x43eb57['update'](_0x3b42ee)[_0xc8f4('0x24')](function(_0x205c41){return _0x205c41;});}return null;};}function removeEntity(_0x3195ff,_0x1d159e){return function(_0x5d54a9){if(_0x5d54a9){return _0x5d54a9[_0xc8f4('0x25')]()['then'](function(){_0x3195ff[_0xc8f4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x177a44,_0x3dd717){return function(_0x5c94c6){if(!_0x5c94c6){_0x177a44[_0xc8f4('0x17')](0x194);}return _0x5c94c6;};}function handleError(_0x21062f,_0x11f766){_0x11f766=_0x11f766||0x1f4;return function(_0x2fa052){logger['error'](_0x2fa052[_0xc8f4('0x26')]);if(_0x2fa052[_0xc8f4('0x27')]){delete _0x2fa052['name'];}_0x21062f[_0xc8f4('0x18')](_0x11f766)[_0xc8f4('0x28')](_0x2fa052);};}exports[_0xc8f4('0x29')]=function(_0x1b70bc,_0x24bef0){var _0x385e41={},_0x4a25da={},_0x45f972={'count':0x0,'rows':[]};var _0x24bb78=_[_0xc8f4('0x2a')](db['MailQueueReport'][_0xc8f4('0x2b')],function(_0x3a4b1b){return{'name':_0x3a4b1b['fieldName'],'type':_0x3a4b1b['type']['key']};});_0x4a25da[_0xc8f4('0x2c')]=_[_0xc8f4('0x2a')](_0x24bb78,_0xc8f4('0x27'));_0x4a25da[_0xc8f4('0x2d')]=_[_0xc8f4('0x2e')](_0x1b70bc[_0xc8f4('0x2d')]);_0x4a25da[_0xc8f4('0x2f')]=_[_0xc8f4('0x30')](_0x4a25da['model'],_0x4a25da[_0xc8f4('0x2d')]);_0x385e41[_0xc8f4('0x31')]=_[_0xc8f4('0x30')](_0x4a25da['model'],qs[_0xc8f4('0x32')](_0x1b70bc[_0xc8f4('0x2d')]['fields']));_0x385e41[_0xc8f4('0x31')]=_0x385e41[_0xc8f4('0x31')][_0xc8f4('0x33')]?_0x385e41['attributes']:_0x4a25da[_0xc8f4('0x2c')];if(!_0x1b70bc[_0xc8f4('0x2d')][_0xc8f4('0x34')]('nolimit')){_0x385e41[_0xc8f4('0x1e')]=qs[_0xc8f4('0x1e')](_0x1b70bc[_0xc8f4('0x2d')][_0xc8f4('0x1e')]);_0x385e41[_0xc8f4('0x1d')]=qs[_0xc8f4('0x1d')](_0x1b70bc[_0xc8f4('0x2d')][_0xc8f4('0x1d')]);}_0x385e41[_0xc8f4('0x35')]=qs[_0xc8f4('0x36')](_0x1b70bc[_0xc8f4('0x2d')][_0xc8f4('0x36')]);_0x385e41[_0xc8f4('0x37')]=qs[_0xc8f4('0x2f')](_[_0xc8f4('0x38')](_0x1b70bc[_0xc8f4('0x2d')],_0x4a25da['filters']),_0x24bb78);if(_0x1b70bc[_0xc8f4('0x2d')]['filter']){_0x385e41[_0xc8f4('0x37')]=_['merge'](_0x385e41[_0xc8f4('0x37')],{'$or':_[_0xc8f4('0x2a')](_0x24bb78,function(_0x7ef69a){if(_0x7ef69a[_0xc8f4('0x39')]!==_0xc8f4('0x3a')){var _0x724060={};_0x724060[_0x7ef69a[_0xc8f4('0x27')]]={'$like':'%'+_0x1b70bc['query'][_0xc8f4('0x3b')]+'%'};return _0x724060;}})});}_0x385e41=_[_0xc8f4('0x3c')]({},_0x385e41,_0x1b70bc[_0xc8f4('0x3d')]);var _0x14ce2e={'where':_0x385e41['where']};return db[_0xc8f4('0x3e')][_0xc8f4('0x1c')](_0x14ce2e)[_0xc8f4('0x24')](function(_0x1d0b2d){_0x45f972[_0xc8f4('0x1c')]=_0x1d0b2d;if(_0x1b70bc[_0xc8f4('0x2d')][_0xc8f4('0x3f')]){_0x385e41[_0xc8f4('0x40')]=[{'all':!![]}];}return db[_0xc8f4('0x3e')][_0xc8f4('0x41')](_0x385e41);})[_0xc8f4('0x24')](function(_0xd56415){_0x45f972['rows']=_0xd56415;return _0x45f972;})[_0xc8f4('0x24')](respondWithFilteredResult(_0x24bef0,_0x385e41))[_0xc8f4('0x42')](handleError(_0x24bef0,null));};exports[_0xc8f4('0x43')]=function(_0x275f4a,_0x588ff9){var _0x49da16={'raw':!![],'where':{'id':_0x275f4a[_0xc8f4('0x44')]['id']}},_0x413a55={};_0x413a55['model']=_[_0xc8f4('0x2e')](db[_0xc8f4('0x3e')]['rawAttributes']);_0x413a55['query']=_[_0xc8f4('0x2e')](_0x275f4a[_0xc8f4('0x2d')]);_0x413a55[_0xc8f4('0x2f')]=_[_0xc8f4('0x30')](_0x413a55[_0xc8f4('0x2c')],_0x413a55[_0xc8f4('0x2d')]);_0x49da16['attributes']=_['intersection'](_0x413a55[_0xc8f4('0x2c')],qs[_0xc8f4('0x32')](_0x275f4a[_0xc8f4('0x2d')]['fields']));_0x49da16['attributes']=_0x49da16['attributes']['length']?_0x49da16['attributes']:_0x413a55[_0xc8f4('0x2c')];if(_0x275f4a[_0xc8f4('0x2d')][_0xc8f4('0x3f')]){_0x49da16[_0xc8f4('0x40')]=[{'all':!![]}];}_0x49da16=_[_0xc8f4('0x3c')]({},_0x49da16,_0x275f4a[_0xc8f4('0x3d')]);return db['MailQueueReport'][_0xc8f4('0x45')](_0x49da16)[_0xc8f4('0x24')](handleEntityNotFound(_0x588ff9,null))['then'](respondWithResult(_0x588ff9,null))['catch'](handleError(_0x588ff9,null));};exports[_0xc8f4('0x46')]=function(_0x82a5e,_0x3ca0d6){return db[_0xc8f4('0x3e')]['create'](_0x82a5e['body'],{})[_0xc8f4('0x24')](respondWithResult(_0x3ca0d6,0xc9))[_0xc8f4('0x42')](handleError(_0x3ca0d6,null));};exports[_0xc8f4('0x47')]=function(_0x2bc4db,_0x141f81){if(_0x2bc4db[_0xc8f4('0x48')]['id']){delete _0x2bc4db['body']['id'];}return db['MailQueueReport'][_0xc8f4('0x45')]({'where':{'id':_0x2bc4db[_0xc8f4('0x44')]['id']}})[_0xc8f4('0x24')](handleEntityNotFound(_0x141f81,null))[_0xc8f4('0x24')](saveUpdates(_0x2bc4db[_0xc8f4('0x48')],null))[_0xc8f4('0x24')](respondWithResult(_0x141f81,null))[_0xc8f4('0x42')](handleError(_0x141f81,null));};exports[_0xc8f4('0x25')]=function(_0x3d9d67,_0x5b4035){return db['MailQueueReport'][_0xc8f4('0x45')]({'where':{'id':_0x3d9d67[_0xc8f4('0x44')]['id']}})[_0xc8f4('0x24')](handleEntityNotFound(_0x5b4035,null))[_0xc8f4('0x24')](removeEntity(_0x5b4035,null))[_0xc8f4('0x42')](handleError(_0x5b4035,null));};exports[_0xc8f4('0x49')]=function(_0x4715f3,_0x36c304){return db[_0xc8f4('0x3e')][_0xc8f4('0x49')]()[_0xc8f4('0x24')](respondWithResult(_0x36c304,null))[_0xc8f4('0x42')](handleError(_0x36c304,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index b48806e..8702c08 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 _0x0058=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue'];(function(_0x5dc6e8,_0x1ed7cc){var _0x2cb306=function(_0xae157e){while(--_0xae157e){_0x5dc6e8['push'](_0x5dc6e8['shift']());}};_0x2cb306(++_0x1ed7cc);}(_0x0058,0x1d1));var _0x8005=function(_0x1f9ae0,_0xf01283){_0x1f9ae0=_0x1f9ae0-0x0;var _0x265bbd=_0x0058[_0x1f9ae0];return _0x265bbd;};'use strict';var _=require(_0x8005('0x0'));var util=require(_0x8005('0x1'));var logger=require(_0x8005('0x2'))(_0x8005('0x3'));var moment=require(_0x8005('0x4'));var BPromise=require(_0x8005('0x5'));var rp=require(_0x8005('0x6'));var fs=require('fs');var path=require(_0x8005('0x7'));var rimraf=require(_0x8005('0x8'));var config=require(_0x8005('0x9'));var attributes=require(_0x8005('0xa'));module[_0x8005('0xb')]=function(_0x4e5dd5,_0x465aab){return _0x4e5dd5[_0x8005('0xc')](_0x8005('0xd'),attributes,{'tableName':_0x8005('0xe'),'paranoid':![],'indexes':[{'name':_0x8005('0xf'),'fields':[_0x8005('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x25c7=['util','../../config/logger','api','bluebird','path','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid'];(function(_0x10c408,_0x5164f){var _0x46b4ea=function(_0x4e594e){while(--_0x4e594e){_0x10c408['push'](_0x10c408['shift']());}};_0x46b4ea(++_0x5164f);}(_0x25c7,0x9c));var _0x725c=function(_0x2ade50,_0x116bb9){_0x2ade50=_0x2ade50-0x0;var _0xa50fdb=_0x25c7[_0x2ade50];return _0xa50fdb;};'use strict';var _=require('lodash');var util=require(_0x725c('0x0'));var logger=require(_0x725c('0x1'))(_0x725c('0x2'));var moment=require('moment');var BPromise=require(_0x725c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x725c('0x4'));var rimraf=require('rimraf');var config=require(_0x725c('0x5'));var attributes=require(_0x725c('0x6'));module[_0x725c('0x7')]=function(_0x3148dc,_0x4a10fc){return _0x3148dc[_0x725c('0x8')](_0x725c('0x9'),attributes,{'tableName':_0x725c('0xa'),'paranoid':![],'indexes':[{'name':_0x725c('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 7f651bf..4eb2ae7 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x449b16,_0x2472cb){var _0x1807d6=function(_0x55654c){while(--_0x55654c){_0x449b16['push'](_0x449b16['shift']());}};_0x1807d6(++_0x2472cb);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xc4aa[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file +var _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x3514cb,_0x40f934){var _0x4e083d=function(_0x5df3bc){while(--_0x5df3bc){_0x3514cb['push'](_0x3514cb['shift']());}};_0x4e083d(++_0x40f934);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xc4aa[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 1e506b5..815c714 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x10c9d1,_0x43d60f){var _0x2bcd1c=function(_0x48f8ce){while(--_0x48f8ce){_0x10c9d1['push'](_0x10c9d1['shift']());}};_0x2bcd1c(++_0x43d60f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0xb09248,_0x2dd6e8){var _0x489068=function(_0x42fe3b){while(--_0x42fe3b){_0xb09248['push'](_0xb09248['shift']());}};_0x489068(++_0x2dd6e8);}(_0xedd9,0xfc));var _0x9edd=function(_0x4ac1f5,_0xda103c){_0x4ac1f5=_0x4ac1f5-0x0;var _0x189673=_0xedd9[_0x4ac1f5];return _0x189673;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index bf5d439..95f3403 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 _0x7072=['INBOX','INTEGER','exports','STRING','BOOLEAN'];(function(_0x5da34d,_0x4aec55){var _0x29a05a=function(_0x54bf28){while(--_0x54bf28){_0x5da34d['push'](_0x5da34d['shift']());}};_0x29a05a(++_0x4aec55);}(_0x7072,0x138));var _0x2707=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x7072[_0x255d5b];return _0x3e141a;};'use strict';var Sequelize=require('sequelize');module[_0x2707('0x0')]={'description':{'type':Sequelize[_0x2707('0x1')]},'host':{'type':Sequelize[_0x2707('0x1')]},'authentication':{'type':Sequelize[_0x2707('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x2707('0x1')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x2707('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x2707('0x3')},'connTimeout':{'type':Sequelize[_0x2707('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x2707('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x2707('0x1')]}}; \ No newline at end of file +var _0xe130=['INBOX','sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x2b5513,_0x3fe5cd){var _0x578fd2=function(_0x7a9106){while(--_0x7a9106){_0x2b5513['push'](_0x2b5513['shift']());}};_0x578fd2(++_0x3fe5cd);}(_0xe130,0x127));var _0x0e13=function(_0x2950e8,_0x28c19b){_0x2950e8=_0x2950e8-0x0;var _0x1de7b1=_0xe130[_0x2950e8];return _0x1de7b1;};'use strict';var Sequelize=require(_0x0e13('0x0'));module[_0x0e13('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x0e13('0x2')]},'authentication':{'type':Sequelize[_0x0e13('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x0e13('0x2')]},'password':{'type':Sequelize[_0x0e13('0x2')]},'port':{'type':Sequelize[_0x0e13('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x0e13('0x2')],'defaultValue':_0x0e13('0x5')},'connTimeout':{'type':Sequelize[_0x0e13('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x0e13('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 1e5e8b3..8043246 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 _0x67fb=['request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','define','MailServerIn','lodash','util','../../config/logger','api','moment'];(function(_0x1b497f,_0x2fe01e){var _0x476d99=function(_0x57b682){while(--_0x57b682){_0x1b497f['push'](_0x1b497f['shift']());}};_0x476d99(++_0x2fe01e);}(_0x67fb,0x1b7));var _0xb67f=function(_0x555647,_0x426f1e){_0x555647=_0x555647-0x0;var _0x2e2e0d=_0x67fb[_0x555647];return _0x2e2e0d;};'use strict';var _=require(_0xb67f('0x0'));var util=require(_0xb67f('0x1'));var logger=require(_0xb67f('0x2'))(_0xb67f('0x3'));var moment=require(_0xb67f('0x4'));var BPromise=require('bluebird');var rp=require(_0xb67f('0x5'));var fs=require('fs');var path=require(_0xb67f('0x6'));var rimraf=require(_0xb67f('0x7'));var config=require(_0xb67f('0x8'));var attributes=require(_0xb67f('0x9'));module['exports']=function(_0x5245c1,_0x16b385){return _0x5245c1[_0xb67f('0xa')](_0xb67f('0xb'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1477=['api','moment','request-promise','path','exports','define','MailServerIn','mail_servers_in','util','../../config/logger'];(function(_0xabbd2f,_0x44d05a){var _0x34a040=function(_0x3736d9){while(--_0x3736d9){_0xabbd2f['push'](_0xabbd2f['shift']());}};_0x34a040(++_0x44d05a);}(_0x1477,0x148));var _0x7147=function(_0x4d4e9c,_0x5c8437){_0x4d4e9c=_0x4d4e9c-0x0;var _0x2a6bbc=_0x1477[_0x4d4e9c];return _0x2a6bbc;};'use strict';var _=require('lodash');var util=require(_0x7147('0x0'));var logger=require(_0x7147('0x1'))(_0x7147('0x2'));var moment=require(_0x7147('0x3'));var BPromise=require('bluebird');var rp=require(_0x7147('0x4'));var fs=require('fs');var path=require(_0x7147('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailServerIn.attributes');module[_0x7147('0x6')]=function(_0x252284,_0x390ab2){return _0x252284[_0x7147('0x7')](_0x7147('0x8'),attributes,{'tableName':_0x7147('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 2543ea0..8e885cc 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 _0xad13=['MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetMailServerIn','findAll','options','raw','where','limit','include','map','model','attributes','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4cf2e8,_0x2685bf){var _0x24afcb=function(_0x1eab5e){while(--_0x1eab5e){_0x4cf2e8['push'](_0x4cf2e8['shift']());}};_0x24afcb(++_0x2685bf);}(_0xad13,0x79));var _0x3ad1=function(_0x1df3ad,_0x31cf7d){_0x1df3ad=_0x1df3ad-0x0;var _0xcd207c=_0xad13[_0x1df3ad];return _0xcd207c;};'use strict';var _=require(_0x3ad1('0x0'));var util=require('util');var moment=require(_0x3ad1('0x1'));var BPromise=require(_0x3ad1('0x2'));var rs=require(_0x3ad1('0x3'));var fs=require('fs');var Redis=require(_0x3ad1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3ad1('0x5'));var logger=require(_0x3ad1('0x6'))(_0x3ad1('0x7'));var config=require(_0x3ad1('0x8'));var jayson=require(_0x3ad1('0x9'));var client=jayson[_0x3ad1('0xa')][_0x3ad1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23ed63,_0x44fd50,_0x313ad9){return new BPromise(function(_0x4d27b0,_0x2429f4){return client[_0x3ad1('0xc')](_0x23ed63,_0x313ad9)[_0x3ad1('0xd')](function(_0x4e93df){logger[_0x3ad1('0xe')](_0x3ad1('0xf'),_0x44fd50,'request\x20sent');logger[_0x3ad1('0x10')](_0x3ad1('0x11'),_0x44fd50,_0x3ad1('0x12'),JSON[_0x3ad1('0x13')](_0x4e93df));if(_0x4e93df[_0x3ad1('0x14')]){if(_0x4e93df[_0x3ad1('0x14')]['code']===0x1f4){logger['error'](_0x3ad1('0xf'),_0x44fd50,_0x4e93df[_0x3ad1('0x14')][_0x3ad1('0x15')]);return _0x2429f4(_0x4e93df[_0x3ad1('0x14')]['message']);}logger[_0x3ad1('0x14')]('MailServerIn,\x20%s,\x20%s',_0x44fd50,_0x4e93df[_0x3ad1('0x14')][_0x3ad1('0x15')]);return _0x4d27b0(_0x4e93df[_0x3ad1('0x14')][_0x3ad1('0x15')]);}else{logger[_0x3ad1('0xe')](_0x3ad1('0xf'),_0x44fd50,_0x3ad1('0x12'));_0x4d27b0(_0x4e93df[_0x3ad1('0x16')][_0x3ad1('0x15')]);}})[_0x3ad1('0x17')](function(_0x1d924e){logger[_0x3ad1('0x14')]('MailServerIn,\x20%s,\x20%s',_0x44fd50,_0x1d924e);_0x2429f4(_0x1d924e);});});}exports[_0x3ad1('0x18')]=function(_0x30e53f){var _0x79b791=this;return new Promise(function(_0xd43203,_0x11e3ed){return db['MailServerIn'][_0x3ad1('0x19')]({'raw':_0x30e53f[_0x3ad1('0x1a')]?_0x30e53f['options'][_0x3ad1('0x1b')]===undefined?!![]:![]:!![],'where':_0x30e53f[_0x3ad1('0x1a')]?_0x30e53f[_0x3ad1('0x1a')][_0x3ad1('0x1c')]||null:null,'attributes':_0x30e53f[_0x3ad1('0x1a')]?_0x30e53f[_0x3ad1('0x1a')]['attributes']||null:null,'limit':_0x30e53f[_0x3ad1('0x1a')]?_0x30e53f['options'][_0x3ad1('0x1d')]||null:null,'include':_0x30e53f['options']?_0x30e53f[_0x3ad1('0x1a')][_0x3ad1('0x1e')]?_[_0x3ad1('0x1f')](_0x30e53f[_0x3ad1('0x1a')][_0x3ad1('0x1e')],function(_0x3a0166){return{'model':db[_0x3a0166[_0x3ad1('0x20')]],'as':_0x3a0166['as'],'attributes':_0x3a0166['attributes'],'include':_0x3a0166[_0x3ad1('0x1e')]?_[_0x3ad1('0x1f')](_0x3a0166[_0x3ad1('0x1e')],function(_0x2ee2e8){return{'model':db[_0x2ee2e8[_0x3ad1('0x20')]],'as':_0x2ee2e8['as'],'attributes':_0x2ee2e8[_0x3ad1('0x21')],'include':_0x2ee2e8['include']?_['map'](_0x2ee2e8[_0x3ad1('0x1e')],function(_0x5e1c03){return{'model':db[_0x5e1c03['model']],'as':_0x5e1c03['as'],'attributes':_0x5e1c03[_0x3ad1('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3ad1('0xd')](function(_0xf5d14c){logger[_0x3ad1('0xe')]('GetMailServerIn',_0x30e53f);logger[_0x3ad1('0x10')](_0x3ad1('0x18'),_0x30e53f,JSON[_0x3ad1('0x13')](_0xf5d14c));_0xd43203(_0xf5d14c);})[_0x3ad1('0x17')](function(_0x345cb9){logger['error']('GetMailServerIn',_0x345cb9[_0x3ad1('0x15')],_0x30e53f);_0x11e3ed(_0x79b791['error'](0x1f4,_0x345cb9[_0x3ad1('0x15')]));});});}; \ No newline at end of file +var _0xf008=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','MailServerIn,\x20%s,\x20%s','message','result','catch','MailServerIn','findAll','options','attributes','limit','map','include','model','then','GetMailServerIn','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x976ccd,_0x5511d1){var _0x5e32fc=function(_0x56ff7d){while(--_0x56ff7d){_0x976ccd['push'](_0x976ccd['shift']());}};_0x5e32fc(++_0x5511d1);}(_0xf008,0x1c8));var _0x8f00=function(_0x1b171f,_0x7f8b3d){_0x1b171f=_0x1b171f-0x0;var _0x1f8b29=_0xf008[_0x1b171f];return _0x1f8b29;};'use strict';var _=require(_0x8f00('0x0'));var util=require(_0x8f00('0x1'));var moment=require(_0x8f00('0x2'));var BPromise=require('bluebird');var rs=require(_0x8f00('0x3'));var fs=require('fs');var Redis=require(_0x8f00('0x4'));var db=require(_0x8f00('0x5'))['db'];var utils=require(_0x8f00('0x6'));var logger=require(_0x8f00('0x7'))(_0x8f00('0x8'));var config=require(_0x8f00('0x9'));var jayson=require(_0x8f00('0xa'));var client=jayson['client'][_0x8f00('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ac0b1,_0x35f900,_0xa4b452){return new BPromise(function(_0x4f2182,_0x39d6ad){return client[_0x8f00('0xc')](_0x5ac0b1,_0xa4b452)['then'](function(_0x1c53d9){logger[_0x8f00('0xd')]('MailServerIn,\x20%s,\x20%s',_0x35f900,_0x8f00('0xe'));logger[_0x8f00('0xf')](_0x8f00('0x10'),_0x35f900,'request\x20sent',JSON[_0x8f00('0x11')](_0x1c53d9));if(_0x1c53d9[_0x8f00('0x12')]){if(_0x1c53d9[_0x8f00('0x12')]['code']===0x1f4){logger[_0x8f00('0x12')](_0x8f00('0x13'),_0x35f900,_0x1c53d9[_0x8f00('0x12')][_0x8f00('0x14')]);return _0x39d6ad(_0x1c53d9['error'][_0x8f00('0x14')]);}logger[_0x8f00('0x12')](_0x8f00('0x13'),_0x35f900,_0x1c53d9[_0x8f00('0x12')]['message']);return _0x4f2182(_0x1c53d9[_0x8f00('0x12')][_0x8f00('0x14')]);}else{logger['info'](_0x8f00('0x13'),_0x35f900,_0x8f00('0xe'));_0x4f2182(_0x1c53d9[_0x8f00('0x15')][_0x8f00('0x14')]);}})[_0x8f00('0x16')](function(_0x13b411){logger[_0x8f00('0x12')]('MailServerIn,\x20%s,\x20%s',_0x35f900,_0x13b411);_0x39d6ad(_0x13b411);});});}exports['GetMailServerIn']=function(_0x521da4){var _0x15d6c9=this;return new Promise(function(_0x202ce3,_0x1e780d){return db[_0x8f00('0x17')][_0x8f00('0x18')]({'raw':_0x521da4['options']?_0x521da4[_0x8f00('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x521da4[_0x8f00('0x19')]?_0x521da4[_0x8f00('0x19')]['where']||null:null,'attributes':_0x521da4[_0x8f00('0x19')]?_0x521da4[_0x8f00('0x19')][_0x8f00('0x1a')]||null:null,'limit':_0x521da4[_0x8f00('0x19')]?_0x521da4['options'][_0x8f00('0x1b')]||null:null,'include':_0x521da4[_0x8f00('0x19')]?_0x521da4[_0x8f00('0x19')]['include']?_[_0x8f00('0x1c')](_0x521da4[_0x8f00('0x19')][_0x8f00('0x1d')],function(_0x34fdfd){return{'model':db[_0x34fdfd[_0x8f00('0x1e')]],'as':_0x34fdfd['as'],'attributes':_0x34fdfd[_0x8f00('0x1a')],'include':_0x34fdfd['include']?_['map'](_0x34fdfd[_0x8f00('0x1d')],function(_0x210ddf){return{'model':db[_0x210ddf[_0x8f00('0x1e')]],'as':_0x210ddf['as'],'attributes':_0x210ddf['attributes'],'include':_0x210ddf[_0x8f00('0x1d')]?_[_0x8f00('0x1c')](_0x210ddf[_0x8f00('0x1d')],function(_0x1a7da3){return{'model':db[_0x1a7da3['model']],'as':_0x1a7da3['as'],'attributes':_0x1a7da3['attributes']};}):[]};}):[]};}):[]:[]})[_0x8f00('0x1f')](function(_0x109e07){logger['info'](_0x8f00('0x20'),_0x521da4);logger[_0x8f00('0xf')](_0x8f00('0x20'),_0x521da4,JSON[_0x8f00('0x11')](_0x109e07));_0x202ce3(_0x109e07);})['catch'](function(_0x303433){logger[_0x8f00('0x12')](_0x8f00('0x20'),_0x303433[_0x8f00('0x14')],_0x521da4);_0x1e780d(_0x15d6c9[_0x8f00('0x12')](0x1f4,_0x303433[_0x8f00('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 0483f8e..a9af69b 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(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x7a54,0x106));var _0x47a5=function(_0x17d64c,_0xe0ba9b){_0x17d64c=_0x17d64c-0x0;var _0x16933b=_0x7a54[_0x17d64c];return _0x16933b;};'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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_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/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index f396d36..cbf3b89 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 _0x8591=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x26e20e,_0x45dc74){var _0x1bb973=function(_0x40c77c){while(--_0x40c77c){_0x26e20e['push'](_0x26e20e['shift']());}};_0x1bb973(++_0x45dc74);}(_0x8591,0x1ec));var _0x1859=function(_0x52c3a2,_0x1cd002){_0x52c3a2=_0x52c3a2-0x0;var _0x37cc48=_0x8591[_0x52c3a2];return _0x37cc48;};'use strict';var Sequelize=require(_0x1859('0x0'));module[_0x1859('0x1')]={'description':{'type':Sequelize[_0x1859('0x2')]},'host':{'type':Sequelize[_0x1859('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x1859('0x2')]},'port':{'type':Sequelize[_0x1859('0x3')]},'secure':{'type':Sequelize[_0x1859('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x1859('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x1e11=['STRING','BOOLEAN'];(function(_0xe566c2,_0x531a3c){var _0x3c42cd=function(_0x4b80c6){while(--_0x4b80c6){_0xe566c2['push'](_0xe566c2['shift']());}};_0x3c42cd(++_0x531a3c);}(_0x1e11,0xe4));var _0x11e1=function(_0x1c5271,_0x3e1c2a){_0x1c5271=_0x1c5271-0x0;var _0x5a71e4=_0x1e11[_0x1c5271];return _0x5a71e4;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x11e1('0x0')]},'host':{'type':Sequelize[_0x11e1('0x0')]},'user':{'type':Sequelize[_0x11e1('0x0')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x11e1('0x1')],'defaultValue':![]},'service':{'type':Sequelize[_0x11e1('0x0')]},'authentication':{'type':Sequelize[_0x11e1('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 89caa59..b3bb4cf 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 _0xd452=['desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','error','name','send','index','map','MailServerOut','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce'];(function(_0x3e3d66,_0x4962a8){var _0x993db6=function(_0x28526c){while(--_0x28526c){_0x3e3d66['push'](_0x3e3d66['shift']());}};_0x993db6(++_0x4962a8);}(_0xd452,0xd3));var _0x2d45=function(_0x4f11cb,_0x14e174){_0x4f11cb=_0x4f11cb-0x0;var _0x491488=_0xd452[_0x4f11cb];return _0x491488;};'use strict';var emlformat=require(_0x2d45('0x0'));var rimraf=require(_0x2d45('0x1'));var zipdir=require(_0x2d45('0x2'));var jsonpatch=require(_0x2d45('0x3'));var rp=require(_0x2d45('0x4'));var moment=require('moment');var BPromise=require(_0x2d45('0x5'));var Mustache=require('mustache');var util=require(_0x2d45('0x6'));var path=require(_0x2d45('0x7'));var sox=require(_0x2d45('0x8'));var csv=require('to-csv');var ejs=require(_0x2d45('0x9'));var fs=require('fs');var fs_extra=require(_0x2d45('0xa'));var _=require(_0x2d45('0xb'));var squel=require(_0x2d45('0xc'));var crypto=require('crypto');var jsforce=require(_0x2d45('0xd'));var deskjs=require(_0x2d45('0xe'));var toCsv=require(_0x2d45('0xf'));var querystring=require('querystring');var Papa=require(_0x2d45('0x10'));var Redis=require(_0x2d45('0x11'));var authService=require(_0x2d45('0x12'));var qs=require(_0x2d45('0x13'));var as=require(_0x2d45('0x14'));var hardwareService=require(_0x2d45('0x15'));var logger=require(_0x2d45('0x16'))(_0x2d45('0x17'));var utils=require(_0x2d45('0x18'));var config=require(_0x2d45('0x19'));var licenseUtil=require(_0x2d45('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c02a1,_0x453cb3){_0x453cb3=_0x453cb3||0xcc;return function(_0x1b62cb){if(_0x1b62cb){return _0x2c02a1[_0x2d45('0x1b')](_0x453cb3);}return _0x2c02a1[_0x2d45('0x1c')](_0x453cb3)[_0x2d45('0x1d')]();};}function respondWithResult(_0x984477,_0x11d0bf){_0x11d0bf=_0x11d0bf||0xc8;return function(_0x3a15ad){if(_0x3a15ad){return _0x984477[_0x2d45('0x1c')](_0x11d0bf)[_0x2d45('0x1e')](_0x3a15ad);}};}function respondWithFilteredResult(_0x4169af,_0x22c3ee){return function(_0x4a4a14){if(_0x4a4a14){var _0x20f786=typeof _0x22c3ee[_0x2d45('0x1f')]==='undefined'&&typeof _0x22c3ee[_0x2d45('0x20')]===_0x2d45('0x21');var _0x2f5c78=_0x4a4a14[_0x2d45('0x22')];var _0x348b81=_0x20f786?0x0:_0x22c3ee[_0x2d45('0x1f')];var _0x24c445=_0x20f786?_0x4a4a14[_0x2d45('0x22')]:_0x22c3ee['offset']+_0x22c3ee['limit'];var _0x1dfcd5;if(_0x24c445>=_0x2f5c78){_0x24c445=_0x2f5c78;_0x1dfcd5=0xc8;}else{_0x1dfcd5=0xce;}_0x4169af[_0x2d45('0x1c')](_0x1dfcd5);return _0x4169af[_0x2d45('0x23')]('Content-Range',_0x348b81+'-'+_0x24c445+'/'+_0x2f5c78)[_0x2d45('0x1e')](_0x4a4a14);}return null;};}function patchUpdates(_0x55335a){return function(_0x5bebb8){try{jsonpatch[_0x2d45('0x24')](_0x5bebb8,_0x55335a,!![]);}catch(_0x3cbfe7){return BPromise['reject'](_0x3cbfe7);}return _0x5bebb8[_0x2d45('0x25')]();};}function saveUpdates(_0x34d095,_0x95f0ff){return function(_0x4b0d79){if(_0x4b0d79){return _0x4b0d79[_0x2d45('0x26')](_0x34d095)[_0x2d45('0x27')](function(_0x42161d){return _0x42161d;});}return null;};}function removeEntity(_0x47cf98,_0x49b732){return function(_0x5755d1){if(_0x5755d1){return _0x5755d1['destroy']()['then'](function(){_0x47cf98['status'](0xcc)[_0x2d45('0x1d')]();});}};}function handleEntityNotFound(_0x15fb8a,_0xc0a506){return function(_0x213f31){if(!_0x213f31){_0x15fb8a[_0x2d45('0x1b')](0x194);}return _0x213f31;};}function handleError(_0x4a998c,_0x2d81bb){_0x2d81bb=_0x2d81bb||0x1f4;return function(_0x5b1212){logger[_0x2d45('0x28')](_0x5b1212['stack']);if(_0x5b1212[_0x2d45('0x29')]){delete _0x5b1212['name'];}_0x4a998c[_0x2d45('0x1c')](_0x2d81bb)[_0x2d45('0x2a')](_0x5b1212);};}exports[_0x2d45('0x2b')]=function(_0x1d580c,_0x3d358e){var _0x19b4bb={},_0x42d822={},_0x43d162={'count':0x0,'rows':[]};var _0x206957=_[_0x2d45('0x2c')](db[_0x2d45('0x2d')][_0x2d45('0x2e')],function(_0x4c2485){return{'name':_0x4c2485['fieldName'],'type':_0x4c2485[_0x2d45('0x2f')]['key']};});_0x42d822[_0x2d45('0x30')]=_[_0x2d45('0x2c')](_0x206957,_0x2d45('0x29'));_0x42d822[_0x2d45('0x31')]=_[_0x2d45('0x32')](_0x1d580c[_0x2d45('0x31')]);_0x42d822[_0x2d45('0x33')]=_[_0x2d45('0x34')](_0x42d822['model'],_0x42d822[_0x2d45('0x31')]);_0x19b4bb[_0x2d45('0x35')]=_[_0x2d45('0x34')](_0x42d822['model'],qs[_0x2d45('0x36')](_0x1d580c['query'][_0x2d45('0x36')]));_0x19b4bb[_0x2d45('0x35')]=_0x19b4bb[_0x2d45('0x35')][_0x2d45('0x37')]?_0x19b4bb[_0x2d45('0x35')]:_0x42d822[_0x2d45('0x30')];if(!_0x1d580c[_0x2d45('0x31')][_0x2d45('0x38')](_0x2d45('0x39'))){_0x19b4bb['limit']=qs['limit'](_0x1d580c[_0x2d45('0x31')][_0x2d45('0x20')]);_0x19b4bb[_0x2d45('0x1f')]=qs['offset'](_0x1d580c['query'][_0x2d45('0x1f')]);}_0x19b4bb[_0x2d45('0x3a')]=qs['sort'](_0x1d580c[_0x2d45('0x31')][_0x2d45('0x3b')]);_0x19b4bb[_0x2d45('0x3c')]=qs[_0x2d45('0x33')](_[_0x2d45('0x3d')](_0x1d580c[_0x2d45('0x31')],_0x42d822[_0x2d45('0x33')]),_0x206957);if(_0x1d580c[_0x2d45('0x31')][_0x2d45('0x3e')]){_0x19b4bb[_0x2d45('0x3c')]=_['merge'](_0x19b4bb['where'],{'$or':_['map'](_0x206957,function(_0x24e1ba){if(_0x24e1ba['type']!=='VIRTUAL'){var _0x5ef401={};_0x5ef401[_0x24e1ba[_0x2d45('0x29')]]={'$like':'%'+_0x1d580c['query']['filter']+'%'};return _0x5ef401;}})});}_0x19b4bb=_[_0x2d45('0x3f')]({},_0x19b4bb,_0x1d580c[_0x2d45('0x40')]);var _0x39b7e3={'where':_0x19b4bb[_0x2d45('0x3c')]};return db[_0x2d45('0x2d')][_0x2d45('0x22')](_0x39b7e3)['then'](function(_0x519eb1){_0x43d162[_0x2d45('0x22')]=_0x519eb1;if(_0x1d580c[_0x2d45('0x31')][_0x2d45('0x41')]){_0x19b4bb[_0x2d45('0x42')]=[{'all':!![]}];}return db['MailServerOut'][_0x2d45('0x43')](_0x19b4bb);})['then'](function(_0x30b370){_0x43d162[_0x2d45('0x44')]=_0x30b370;return _0x43d162;})[_0x2d45('0x27')](respondWithFilteredResult(_0x3d358e,_0x19b4bb))[_0x2d45('0x45')](handleError(_0x3d358e,null));};exports[_0x2d45('0x46')]=function(_0x269fc7,_0x13c173){var _0x390b0f={'raw':!![],'where':{'id':_0x269fc7[_0x2d45('0x47')]['id']}},_0xb5db29={};_0xb5db29['model']=_[_0x2d45('0x32')](db[_0x2d45('0x2d')][_0x2d45('0x2e')]);_0xb5db29['query']=_[_0x2d45('0x32')](_0x269fc7[_0x2d45('0x31')]);_0xb5db29[_0x2d45('0x33')]=_[_0x2d45('0x34')](_0xb5db29['model'],_0xb5db29['query']);_0x390b0f[_0x2d45('0x35')]=_[_0x2d45('0x34')](_0xb5db29[_0x2d45('0x30')],qs['fields'](_0x269fc7[_0x2d45('0x31')]['fields']));_0x390b0f[_0x2d45('0x35')]=_0x390b0f[_0x2d45('0x35')][_0x2d45('0x37')]?_0x390b0f[_0x2d45('0x35')]:_0xb5db29[_0x2d45('0x30')];if(_0x269fc7[_0x2d45('0x31')][_0x2d45('0x41')]){_0x390b0f[_0x2d45('0x42')]=[{'all':!![]}];}_0x390b0f=_[_0x2d45('0x3f')]({},_0x390b0f,_0x269fc7[_0x2d45('0x40')]);return db['MailServerOut'][_0x2d45('0x48')](_0x390b0f)[_0x2d45('0x27')](handleEntityNotFound(_0x13c173,null))[_0x2d45('0x27')](respondWithResult(_0x13c173,null))[_0x2d45('0x45')](handleError(_0x13c173,null));};exports[_0x2d45('0x49')]=function(_0x3ebe29,_0x280a52){return db['MailServerOut'][_0x2d45('0x49')](_0x3ebe29[_0x2d45('0x4a')],{})['then'](respondWithResult(_0x280a52,0xc9))[_0x2d45('0x45')](handleError(_0x280a52,null));};exports[_0x2d45('0x26')]=function(_0x1359b4,_0x1aff89){if(_0x1359b4[_0x2d45('0x4a')]['id']){delete _0x1359b4['body']['id'];}return db['MailServerOut'][_0x2d45('0x48')]({'where':{'id':_0x1359b4['params']['id']}})[_0x2d45('0x27')](handleEntityNotFound(_0x1aff89,null))[_0x2d45('0x27')](saveUpdates(_0x1359b4[_0x2d45('0x4a')],null))['then'](respondWithResult(_0x1aff89,null))[_0x2d45('0x45')](handleError(_0x1aff89,null));};exports['destroy']=function(_0x3ada3b,_0xd47a07){return db['MailServerOut'][_0x2d45('0x48')]({'where':{'id':_0x3ada3b[_0x2d45('0x47')]['id']}})[_0x2d45('0x27')](handleEntityNotFound(_0xd47a07,null))[_0x2d45('0x27')](removeEntity(_0xd47a07,null))[_0x2d45('0x45')](handleError(_0xd47a07,null));}; \ No newline at end of file +var _0x3b65=['attributes','fields','length','nolimit','order','sort','where','filters','filter','VIRTUAL','include','findAll','rows','show','params','keys','includeAll','merge','options','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','name','send','index','map','MailServerOut','rawAttributes','type','key','model','query','intersection'];(function(_0xbe96a7,_0x1adac0){var _0x4769e2=function(_0x4b2f1f){while(--_0x4b2f1f){_0xbe96a7['push'](_0xbe96a7['shift']());}};_0x4769e2(++_0x1adac0);}(_0x3b65,0xef));var _0x53b6=function(_0x4667c2,_0x19811f){_0x4667c2=_0x4667c2-0x0;var _0x1cc2f6=_0x3b65[_0x4667c2];return _0x1cc2f6;};'use strict';var emlformat=require(_0x53b6('0x0'));var rimraf=require(_0x53b6('0x1'));var zipdir=require(_0x53b6('0x2'));var jsonpatch=require(_0x53b6('0x3'));var rp=require(_0x53b6('0x4'));var moment=require(_0x53b6('0x5'));var BPromise=require(_0x53b6('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x53b6('0x7'));var sox=require(_0x53b6('0x8'));var csv=require(_0x53b6('0x9'));var ejs=require(_0x53b6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x53b6('0xb'));var squel=require(_0x53b6('0xc'));var crypto=require(_0x53b6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x53b6('0xe'));var toCsv=require(_0x53b6('0x9'));var querystring=require(_0x53b6('0xf'));var Papa=require(_0x53b6('0x10'));var Redis=require('ioredis');var authService=require(_0x53b6('0x11'));var qs=require(_0x53b6('0x12'));var as=require(_0x53b6('0x13'));var hardwareService=require(_0x53b6('0x14'));var logger=require(_0x53b6('0x15'))(_0x53b6('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x53b6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x406bdc,_0x1d3fc8){_0x1d3fc8=_0x1d3fc8||0xcc;return function(_0xe1318f){if(_0xe1318f){return _0x406bdc[_0x53b6('0x18')](_0x1d3fc8);}return _0x406bdc[_0x53b6('0x19')](_0x1d3fc8)[_0x53b6('0x1a')]();};}function respondWithResult(_0x4251b2,_0x228319){_0x228319=_0x228319||0xc8;return function(_0x24d5d4){if(_0x24d5d4){return _0x4251b2[_0x53b6('0x19')](_0x228319)[_0x53b6('0x1b')](_0x24d5d4);}};}function respondWithFilteredResult(_0x2cb022,_0x96f85e){return function(_0x5915db){if(_0x5915db){var _0x3def1e=typeof _0x96f85e[_0x53b6('0x1c')]===_0x53b6('0x1d')&&typeof _0x96f85e[_0x53b6('0x1e')]===_0x53b6('0x1d');var _0x5870ef=_0x5915db[_0x53b6('0x1f')];var _0x5e5341=_0x3def1e?0x0:_0x96f85e[_0x53b6('0x1c')];var _0x5ac8ad=_0x3def1e?_0x5915db[_0x53b6('0x1f')]:_0x96f85e[_0x53b6('0x1c')]+_0x96f85e['limit'];var _0xfdd56f;if(_0x5ac8ad>=_0x5870ef){_0x5ac8ad=_0x5870ef;_0xfdd56f=0xc8;}else{_0xfdd56f=0xce;}_0x2cb022[_0x53b6('0x19')](_0xfdd56f);return _0x2cb022[_0x53b6('0x20')](_0x53b6('0x21'),_0x5e5341+'-'+_0x5ac8ad+'/'+_0x5870ef)[_0x53b6('0x1b')](_0x5915db);}return null;};}function patchUpdates(_0x483d00){return function(_0x3eaf5b){try{jsonpatch['apply'](_0x3eaf5b,_0x483d00,!![]);}catch(_0x515fac){return BPromise['reject'](_0x515fac);}return _0x3eaf5b['save']();};}function saveUpdates(_0x1d58b3,_0x4a5d4f){return function(_0x4d012e){if(_0x4d012e){return _0x4d012e[_0x53b6('0x22')](_0x1d58b3)[_0x53b6('0x23')](function(_0x221415){return _0x221415;});}return null;};}function removeEntity(_0x47dbbd,_0x7f7ec3){return function(_0x2939b5){if(_0x2939b5){return _0x2939b5[_0x53b6('0x24')]()[_0x53b6('0x23')](function(){_0x47dbbd[_0x53b6('0x19')](0xcc)[_0x53b6('0x1a')]();});}};}function handleEntityNotFound(_0x5bd0e9,_0x19b013){return function(_0x31dfd6){if(!_0x31dfd6){_0x5bd0e9[_0x53b6('0x18')](0x194);}return _0x31dfd6;};}function handleError(_0x4abe3e,_0x507364){_0x507364=_0x507364||0x1f4;return function(_0x21f854){logger[_0x53b6('0x25')](_0x21f854['stack']);if(_0x21f854[_0x53b6('0x26')]){delete _0x21f854[_0x53b6('0x26')];}_0x4abe3e[_0x53b6('0x19')](_0x507364)[_0x53b6('0x27')](_0x21f854);};}exports[_0x53b6('0x28')]=function(_0x3f9839,_0x40324b){var _0x159f68={},_0x4bbf07={},_0x53edff={'count':0x0,'rows':[]};var _0x403974=_[_0x53b6('0x29')](db[_0x53b6('0x2a')][_0x53b6('0x2b')],function(_0x57e47e){return{'name':_0x57e47e['fieldName'],'type':_0x57e47e[_0x53b6('0x2c')][_0x53b6('0x2d')]};});_0x4bbf07[_0x53b6('0x2e')]=_[_0x53b6('0x29')](_0x403974,_0x53b6('0x26'));_0x4bbf07[_0x53b6('0x2f')]=_['keys'](_0x3f9839[_0x53b6('0x2f')]);_0x4bbf07['filters']=_[_0x53b6('0x30')](_0x4bbf07[_0x53b6('0x2e')],_0x4bbf07[_0x53b6('0x2f')]);_0x159f68[_0x53b6('0x31')]=_['intersection'](_0x4bbf07[_0x53b6('0x2e')],qs[_0x53b6('0x32')](_0x3f9839[_0x53b6('0x2f')][_0x53b6('0x32')]));_0x159f68[_0x53b6('0x31')]=_0x159f68[_0x53b6('0x31')][_0x53b6('0x33')]?_0x159f68[_0x53b6('0x31')]:_0x4bbf07[_0x53b6('0x2e')];if(!_0x3f9839['query']['hasOwnProperty'](_0x53b6('0x34'))){_0x159f68[_0x53b6('0x1e')]=qs['limit'](_0x3f9839[_0x53b6('0x2f')][_0x53b6('0x1e')]);_0x159f68[_0x53b6('0x1c')]=qs[_0x53b6('0x1c')](_0x3f9839[_0x53b6('0x2f')][_0x53b6('0x1c')]);}_0x159f68[_0x53b6('0x35')]=qs[_0x53b6('0x36')](_0x3f9839[_0x53b6('0x2f')][_0x53b6('0x36')]);_0x159f68[_0x53b6('0x37')]=qs[_0x53b6('0x38')](_['pick'](_0x3f9839[_0x53b6('0x2f')],_0x4bbf07[_0x53b6('0x38')]),_0x403974);if(_0x3f9839[_0x53b6('0x2f')][_0x53b6('0x39')]){_0x159f68[_0x53b6('0x37')]=_['merge'](_0x159f68[_0x53b6('0x37')],{'$or':_[_0x53b6('0x29')](_0x403974,function(_0x5725cc){if(_0x5725cc['type']!==_0x53b6('0x3a')){var _0x31aec8={};_0x31aec8[_0x5725cc[_0x53b6('0x26')]]={'$like':'%'+_0x3f9839['query']['filter']+'%'};return _0x31aec8;}})});}_0x159f68=_['merge']({},_0x159f68,_0x3f9839['options']);var _0x8ef961={'where':_0x159f68[_0x53b6('0x37')]};return db[_0x53b6('0x2a')][_0x53b6('0x1f')](_0x8ef961)[_0x53b6('0x23')](function(_0xf16a87){_0x53edff[_0x53b6('0x1f')]=_0xf16a87;if(_0x3f9839['query']['includeAll']){_0x159f68[_0x53b6('0x3b')]=[{'all':!![]}];}return db[_0x53b6('0x2a')][_0x53b6('0x3c')](_0x159f68);})[_0x53b6('0x23')](function(_0xd20f65){_0x53edff[_0x53b6('0x3d')]=_0xd20f65;return _0x53edff;})[_0x53b6('0x23')](respondWithFilteredResult(_0x40324b,_0x159f68))['catch'](handleError(_0x40324b,null));};exports[_0x53b6('0x3e')]=function(_0x420b3b,_0xfb4a1b){var _0x4b5b62={'raw':!![],'where':{'id':_0x420b3b[_0x53b6('0x3f')]['id']}},_0x5d4a72={};_0x5d4a72[_0x53b6('0x2e')]=_[_0x53b6('0x40')](db[_0x53b6('0x2a')][_0x53b6('0x2b')]);_0x5d4a72[_0x53b6('0x2f')]=_[_0x53b6('0x40')](_0x420b3b[_0x53b6('0x2f')]);_0x5d4a72[_0x53b6('0x38')]=_[_0x53b6('0x30')](_0x5d4a72[_0x53b6('0x2e')],_0x5d4a72[_0x53b6('0x2f')]);_0x4b5b62[_0x53b6('0x31')]=_[_0x53b6('0x30')](_0x5d4a72[_0x53b6('0x2e')],qs[_0x53b6('0x32')](_0x420b3b[_0x53b6('0x2f')][_0x53b6('0x32')]));_0x4b5b62[_0x53b6('0x31')]=_0x4b5b62[_0x53b6('0x31')][_0x53b6('0x33')]?_0x4b5b62[_0x53b6('0x31')]:_0x5d4a72['model'];if(_0x420b3b[_0x53b6('0x2f')][_0x53b6('0x41')]){_0x4b5b62['include']=[{'all':!![]}];}_0x4b5b62=_[_0x53b6('0x42')]({},_0x4b5b62,_0x420b3b[_0x53b6('0x43')]);return db[_0x53b6('0x2a')]['find'](_0x4b5b62)[_0x53b6('0x23')](handleEntityNotFound(_0xfb4a1b,null))[_0x53b6('0x23')](respondWithResult(_0xfb4a1b,null))[_0x53b6('0x44')](handleError(_0xfb4a1b,null));};exports['create']=function(_0x4e441d,_0x1bb0a5){return db[_0x53b6('0x2a')][_0x53b6('0x45')](_0x4e441d[_0x53b6('0x46')],{})[_0x53b6('0x23')](respondWithResult(_0x1bb0a5,0xc9))[_0x53b6('0x44')](handleError(_0x1bb0a5,null));};exports['update']=function(_0x1b50b7,_0x582a58){if(_0x1b50b7[_0x53b6('0x46')]['id']){delete _0x1b50b7[_0x53b6('0x46')]['id'];}return db['MailServerOut'][_0x53b6('0x47')]({'where':{'id':_0x1b50b7[_0x53b6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x582a58,null))[_0x53b6('0x23')](saveUpdates(_0x1b50b7['body'],null))[_0x53b6('0x23')](respondWithResult(_0x582a58,null))[_0x53b6('0x44')](handleError(_0x582a58,null));};exports[_0x53b6('0x24')]=function(_0xa3645e,_0x49092f){return db['MailServerOut'][_0x53b6('0x47')]({'where':{'id':_0xa3645e[_0x53b6('0x3f')]['id']}})[_0x53b6('0x23')](handleEntityNotFound(_0x49092f,null))['then'](removeEntity(_0x49092f,null))['catch'](handleError(_0x49092f,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index e8bc93c..311bcfc 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 _0x1f8a=['./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x1f8a,0x130));var _0xa1f8=function(_0x431169,_0x20d7e9){_0x431169=_0x431169-0x0;var _0x3f0c53=_0x1f8a[_0x431169];return _0x3f0c53;};'use strict';var _=require(_0xa1f8('0x0'));var util=require(_0xa1f8('0x1'));var logger=require(_0xa1f8('0x2'))(_0xa1f8('0x3'));var moment=require(_0xa1f8('0x4'));var BPromise=require('bluebird');var rp=require(_0xa1f8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa1f8('0x6'));var config=require(_0xa1f8('0x7'));var attributes=require(_0xa1f8('0x8'));module[_0xa1f8('0x9')]=function(_0x4e1213,_0x6be88f){return _0x4e1213[_0xa1f8('0xa')](_0xa1f8('0xb'),attributes,{'tableName':_0xa1f8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8eb6=['request-promise','rimraf','../../config/environment','exports','define','mail_servers_out','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8eb6,0x187));var _0x68eb=function(_0x38fc40,_0x59df40){_0x38fc40=_0x38fc40-0x0;var _0x3d49b9=_0x8eb6[_0x38fc40];return _0x3d49b9;};'use strict';var _=require(_0x68eb('0x0'));var util=require(_0x68eb('0x1'));var logger=require(_0x68eb('0x2'))('api');var moment=require(_0x68eb('0x3'));var BPromise=require(_0x68eb('0x4'));var rp=require(_0x68eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68eb('0x6'));var config=require(_0x68eb('0x7'));var attributes=require('./mailServerOut.attributes');module[_0x68eb('0x8')]=function(_0x2f5dbf,_0xaa0931){return _0x2f5dbf[_0x68eb('0x9')]('MailServerOut',attributes,{'tableName':_0x68eb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 00065d5..ee426f6 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x1365b9,_0x53faf2){var _0x47186b=function(_0x3e1e14){while(--_0x3e1e14){_0x1365b9['push'](_0x1365b9['shift']());}};_0x47186b(++_0x53faf2);}(_0xdb28,0x106));var _0x8db2=function(_0x4fcc21,_0x3c0d5f){_0x4fcc21=_0x4fcc21-0x0;var _0x227224=_0xdb28[_0x4fcc21];return _0x227224;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x13ea30,_0x3c1416){var _0x1d7712=function(_0x43d0b4){while(--_0x43d0b4){_0x13ea30['push'](_0x13ea30['shift']());}};_0x1d7712(++_0x3c1416);}(_0xdb28,0x106));var _0x8db2=function(_0x5487b7,_0x19ac52){_0x5487b7=_0x5487b7-0x0;var _0x3b7125=_0xdb28[_0x5487b7];return _0x3b7125;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 10c7d44..c90d5e2 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 _0x4eca=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','get','describe','/:id','show','post','put','update','destroy','exports'];(function(_0x3bd3e1,_0x41649c){var _0x1855a2=function(_0x4cd9db){while(--_0x4cd9db){_0x3bd3e1['push'](_0x3bd3e1['shift']());}};_0x1855a2(++_0x41649c);}(_0x4eca,0x18f));var _0xa4ec=function(_0x1c3079,_0x4db9ba){_0x1c3079=_0x1c3079-0x0;var _0xc869a0=_0x4eca[_0x1c3079];return _0xc869a0;};'use strict';var multer=require(_0xa4ec('0x0'));var util=require(_0xa4ec('0x1'));var path=require(_0xa4ec('0x2'));var timeout=require(_0xa4ec('0x3'));var express=require(_0xa4ec('0x4'));var router=express['Router']();var fs_extra=require(_0xa4ec('0x5'));var auth=require(_0xa4ec('0x6'));var interaction=require(_0xa4ec('0x7'));var config=require(_0xa4ec('0x8'));var controller=require(_0xa4ec('0x9'));router['get']('/',auth[_0xa4ec('0xa')](),controller[_0xa4ec('0xb')]);router[_0xa4ec('0xc')]('/describe',auth[_0xa4ec('0xa')](),controller[_0xa4ec('0xd')]);router[_0xa4ec('0xc')](_0xa4ec('0xe'),auth[_0xa4ec('0xa')](),controller[_0xa4ec('0xf')]);router[_0xa4ec('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa4ec('0x11')]('/:id',auth[_0xa4ec('0xa')](),controller[_0xa4ec('0x12')]);router['delete']('/:id',auth[_0xa4ec('0xa')](),controller[_0xa4ec('0x13')]);module[_0xa4ec('0x14')]=router; \ No newline at end of file +var _0x530a=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','show','create','put','/:id','update'];(function(_0x1c100b,_0x5e17a0){var _0x2417fe=function(_0x4f5756){while(--_0x4f5756){_0x1c100b['push'](_0x1c100b['shift']());}};_0x2417fe(++_0x5e17a0);}(_0x530a,0x1ba));var _0xa530=function(_0xaa99e0,_0x961890){_0xaa99e0=_0xaa99e0-0x0;var _0x41a55c=_0x530a[_0xaa99e0];return _0x41a55c;};'use strict';var multer=require('multer');var util=require(_0xa530('0x0'));var path=require(_0xa530('0x1'));var timeout=require(_0xa530('0x2'));var express=require(_0xa530('0x3'));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(_0xa530('0x9'));router[_0xa530('0xa')]('/',auth[_0xa530('0xb')](),controller[_0xa530('0xc')]);router[_0xa530('0xa')](_0xa530('0xd'),auth[_0xa530('0xb')](),controller[_0xa530('0xe')]);router[_0xa530('0xa')]('/:id',auth[_0xa530('0xb')](),controller[_0xa530('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa530('0x10')]);router[_0xa530('0x11')](_0xa530('0x12'),auth[_0xa530('0xb')](),controller[_0xa530('0x13')]);router['delete']('/:id',auth[_0xa530('0xb')](),controller[_0xa530('0x14')]);module[_0xa530('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 05f76de..902174c 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 _0x82c4=['STRING','name','sequelize','exports'];(function(_0x432455,_0x3ab14e){var _0x5750cd=function(_0x572e23){while(--_0x572e23){_0x432455['push'](_0x432455['shift']());}};_0x5750cd(++_0x3ab14e);}(_0x82c4,0x1ca));var _0x482c=function(_0x3104f0,_0x4239da){_0x3104f0=_0x3104f0-0x0;var _0x4d4c80=_0x82c4[_0x3104f0];return _0x4d4c80;};'use strict';var Sequelize=require(_0x482c('0x0'));module[_0x482c('0x1')]={'name':{'type':Sequelize[_0x482c('0x2')],'unique':_0x482c('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x482c('0x2')]}}; \ No newline at end of file +var _0x4074=['sequelize','exports','STRING'];(function(_0x507016,_0x4ee4c5){var _0x13b1cc=function(_0x1c2379){while(--_0x1c2379){_0x507016['push'](_0x507016['shift']());}};_0x13b1cc(++_0x4ee4c5);}(_0x4074,0xf0));var _0x4407=function(_0x4e6b46,_0x21220a){_0x4e6b46=_0x4e6b46-0x0;var _0x43195c=_0x4074[_0x4e6b46];return _0x43195c;};'use strict';var Sequelize=require(_0x4407('0x0'));module[_0x4407('0x1')]={'name':{'type':Sequelize[_0x4407('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4407('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 3da10a5..d19f46b 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 _0xfe4e=['end','json','offset','undefined','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','limit','sort','pick','filter','where','VIRTUAL','merge','options','MailSubstatus','includeAll','findAll','rows','params','keys','rawAttributes','include','catch','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x24b432,_0x5cfb05){var _0x6eb324=function(_0x1cea79){while(--_0x1cea79){_0x24b432['push'](_0x24b432['shift']());}};_0x6eb324(++_0x5cfb05);}(_0xfe4e,0x10d));var _0xefe4=function(_0x4cc123,_0x34b10c){_0x4cc123=_0x4cc123-0x0;var _0x982e94=_0xfe4e[_0x4cc123];return _0x982e94;};'use strict';var emlformat=require(_0xefe4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xefe4('0x1'));var jsonpatch=require(_0xefe4('0x2'));var rp=require(_0xefe4('0x3'));var moment=require(_0xefe4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xefe4('0x5'));var util=require(_0xefe4('0x6'));var path=require(_0xefe4('0x7'));var sox=require('sox');var csv=require(_0xefe4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xefe4('0x9'));var _=require(_0xefe4('0xa'));var squel=require('squel');var crypto=require(_0xefe4('0xb'));var jsforce=require(_0xefe4('0xc'));var deskjs=require(_0xefe4('0xd'));var toCsv=require(_0xefe4('0x8'));var querystring=require('querystring');var Papa=require(_0xefe4('0xe'));var Redis=require('ioredis');var authService=require(_0xefe4('0xf'));var qs=require(_0xefe4('0x10'));var as=require(_0xefe4('0x11'));var hardwareService=require(_0xefe4('0x12'));var logger=require(_0xefe4('0x13'))(_0xefe4('0x14'));var utils=require(_0xefe4('0x15'));var config=require(_0xefe4('0x16'));var licenseUtil=require(_0xefe4('0x17'));var db=require(_0xefe4('0x18'))['db'];function respondWithStatusCode(_0x25c369,_0x2d795a){_0x2d795a=_0x2d795a||0xcc;return function(_0x38b1d9){if(_0x38b1d9){return _0x25c369[_0xefe4('0x19')](_0x2d795a);}return _0x25c369[_0xefe4('0x1a')](_0x2d795a)[_0xefe4('0x1b')]();};}function respondWithResult(_0x339ebe,_0x3db661){_0x3db661=_0x3db661||0xc8;return function(_0x1290a4){if(_0x1290a4){return _0x339ebe[_0xefe4('0x1a')](_0x3db661)[_0xefe4('0x1c')](_0x1290a4);}};}function respondWithFilteredResult(_0x182db7,_0x27958d){return function(_0xc0db94){if(_0xc0db94){var _0x1d6e42=typeof _0x27958d[_0xefe4('0x1d')]===_0xefe4('0x1e')&&typeof _0x27958d['limit']===_0xefe4('0x1e');var _0x45f108=_0xc0db94[_0xefe4('0x1f')];var _0x1490f1=_0x1d6e42?0x0:_0x27958d[_0xefe4('0x1d')];var _0x254c92=_0x1d6e42?_0xc0db94[_0xefe4('0x1f')]:_0x27958d[_0xefe4('0x1d')]+_0x27958d['limit'];var _0x558be9;if(_0x254c92>=_0x45f108){_0x254c92=_0x45f108;_0x558be9=0xc8;}else{_0x558be9=0xce;}_0x182db7[_0xefe4('0x1a')](_0x558be9);return _0x182db7['set'](_0xefe4('0x20'),_0x1490f1+'-'+_0x254c92+'/'+_0x45f108)[_0xefe4('0x1c')](_0xc0db94);}return null;};}function patchUpdates(_0x3fc241){return function(_0x3c178a){try{jsonpatch['apply'](_0x3c178a,_0x3fc241,!![]);}catch(_0x3d962c){return BPromise[_0xefe4('0x21')](_0x3d962c);}return _0x3c178a[_0xefe4('0x22')]();};}function saveUpdates(_0x23a418,_0x4e16b6){return function(_0x238540){if(_0x238540){return _0x238540[_0xefe4('0x23')](_0x23a418)[_0xefe4('0x24')](function(_0x49b380){return _0x49b380;});}return null;};}function removeEntity(_0x513dd7,_0x451095){return function(_0x5ba059){if(_0x5ba059){return _0x5ba059[_0xefe4('0x25')]()[_0xefe4('0x24')](function(){_0x513dd7[_0xefe4('0x1a')](0xcc)[_0xefe4('0x1b')]();});}};}function handleEntityNotFound(_0x357d36,_0x3729ff){return function(_0x445a33){if(!_0x445a33){_0x357d36[_0xefe4('0x19')](0x194);}return _0x445a33;};}function handleError(_0x20d42b,_0x5b304b){_0x5b304b=_0x5b304b||0x1f4;return function(_0x3a4092){logger[_0xefe4('0x26')](_0x3a4092[_0xefe4('0x27')]);if(_0x3a4092[_0xefe4('0x28')]){delete _0x3a4092['name'];}_0x20d42b[_0xefe4('0x1a')](_0x5b304b)[_0xefe4('0x29')](_0x3a4092);};}exports['index']=function(_0x62291f,_0x2c08f6){var _0x184f71={},_0xc938bc={},_0x4ef2ba={'count':0x0,'rows':[]};var _0x3bfb8b=_[_0xefe4('0x2a')](db['MailSubstatus']['rawAttributes'],function(_0x307c47){return{'name':_0x307c47[_0xefe4('0x2b')],'type':_0x307c47[_0xefe4('0x2c')][_0xefe4('0x2d')]};});_0xc938bc['model']=_[_0xefe4('0x2a')](_0x3bfb8b,_0xefe4('0x28'));_0xc938bc[_0xefe4('0x2e')]=_['keys'](_0x62291f[_0xefe4('0x2e')]);_0xc938bc[_0xefe4('0x2f')]=_[_0xefe4('0x30')](_0xc938bc[_0xefe4('0x31')],_0xc938bc[_0xefe4('0x2e')]);_0x184f71['attributes']=_[_0xefe4('0x30')](_0xc938bc[_0xefe4('0x31')],qs[_0xefe4('0x32')](_0x62291f[_0xefe4('0x2e')][_0xefe4('0x32')]));_0x184f71[_0xefe4('0x33')]=_0x184f71[_0xefe4('0x33')][_0xefe4('0x34')]?_0x184f71[_0xefe4('0x33')]:_0xc938bc[_0xefe4('0x31')];if(!_0x62291f[_0xefe4('0x2e')]['hasOwnProperty']('nolimit')){_0x184f71['limit']=qs[_0xefe4('0x35')](_0x62291f[_0xefe4('0x2e')][_0xefe4('0x35')]);_0x184f71[_0xefe4('0x1d')]=qs['offset'](_0x62291f[_0xefe4('0x2e')][_0xefe4('0x1d')]);}_0x184f71['order']=qs[_0xefe4('0x36')](_0x62291f[_0xefe4('0x2e')][_0xefe4('0x36')]);_0x184f71['where']=qs[_0xefe4('0x2f')](_[_0xefe4('0x37')](_0x62291f[_0xefe4('0x2e')],_0xc938bc[_0xefe4('0x2f')]),_0x3bfb8b);if(_0x62291f[_0xefe4('0x2e')][_0xefe4('0x38')]){_0x184f71['where']=_['merge'](_0x184f71[_0xefe4('0x39')],{'$or':_['map'](_0x3bfb8b,function(_0x309ad7){if(_0x309ad7[_0xefe4('0x2c')]!==_0xefe4('0x3a')){var _0xbe5b31={};_0xbe5b31[_0x309ad7['name']]={'$like':'%'+_0x62291f[_0xefe4('0x2e')][_0xefe4('0x38')]+'%'};return _0xbe5b31;}})});}_0x184f71=_[_0xefe4('0x3b')]({},_0x184f71,_0x62291f[_0xefe4('0x3c')]);var _0xe4d577={'where':_0x184f71[_0xefe4('0x39')]};return db[_0xefe4('0x3d')]['count'](_0xe4d577)[_0xefe4('0x24')](function(_0x1cbee4){_0x4ef2ba['count']=_0x1cbee4;if(_0x62291f[_0xefe4('0x2e')][_0xefe4('0x3e')]){_0x184f71['include']=[{'all':!![]}];}return db['MailSubstatus'][_0xefe4('0x3f')](_0x184f71);})[_0xefe4('0x24')](function(_0x14c31c){_0x4ef2ba[_0xefe4('0x40')]=_0x14c31c;return _0x4ef2ba;})[_0xefe4('0x24')](respondWithFilteredResult(_0x2c08f6,_0x184f71))['catch'](handleError(_0x2c08f6,null));};exports['show']=function(_0x56d235,_0x15728b){var _0x71bdea={'raw':!![],'where':{'id':_0x56d235[_0xefe4('0x41')]['id']}},_0x287fdb={};_0x287fdb[_0xefe4('0x31')]=_[_0xefe4('0x42')](db['MailSubstatus'][_0xefe4('0x43')]);_0x287fdb[_0xefe4('0x2e')]=_[_0xefe4('0x42')](_0x56d235['query']);_0x287fdb['filters']=_[_0xefe4('0x30')](_0x287fdb[_0xefe4('0x31')],_0x287fdb['query']);_0x71bdea[_0xefe4('0x33')]=_[_0xefe4('0x30')](_0x287fdb[_0xefe4('0x31')],qs[_0xefe4('0x32')](_0x56d235[_0xefe4('0x2e')]['fields']));_0x71bdea[_0xefe4('0x33')]=_0x71bdea[_0xefe4('0x33')][_0xefe4('0x34')]?_0x71bdea[_0xefe4('0x33')]:_0x287fdb['model'];if(_0x56d235[_0xefe4('0x2e')][_0xefe4('0x3e')]){_0x71bdea[_0xefe4('0x44')]=[{'all':!![]}];}_0x71bdea=_[_0xefe4('0x3b')]({},_0x71bdea,_0x56d235[_0xefe4('0x3c')]);return db[_0xefe4('0x3d')]['find'](_0x71bdea)[_0xefe4('0x24')](handleEntityNotFound(_0x15728b,null))['then'](respondWithResult(_0x15728b,null))[_0xefe4('0x45')](handleError(_0x15728b,null));};exports[_0xefe4('0x46')]=function(_0x41d825,_0x2e7c39){return db['MailSubstatus']['create'](_0x41d825[_0xefe4('0x47')],{})[_0xefe4('0x24')](respondWithResult(_0x2e7c39,0xc9))[_0xefe4('0x45')](handleError(_0x2e7c39,null));};exports[_0xefe4('0x23')]=function(_0x3b5501,_0x485b8a){if(_0x3b5501['body']['id']){delete _0x3b5501['body']['id'];}return db[_0xefe4('0x3d')][_0xefe4('0x48')]({'where':{'id':_0x3b5501['params']['id']}})[_0xefe4('0x24')](handleEntityNotFound(_0x485b8a,null))['then'](saveUpdates(_0x3b5501['body'],null))[_0xefe4('0x24')](respondWithResult(_0x485b8a,null))[_0xefe4('0x45')](handleError(_0x485b8a,null));};exports[_0xefe4('0x25')]=function(_0x41c976,_0x23011f){return db[_0xefe4('0x3d')][_0xefe4('0x48')]({'where':{'id':_0x41c976[_0xefe4('0x41')]['id']}})[_0xefe4('0x24')](handleEntityNotFound(_0x23011f,null))[_0xefe4('0x24')](removeEntity(_0x23011f,null))['catch'](handleError(_0x23011f,null));};exports['describe']=function(_0x2e3b0b,_0x2d4466){return db[_0xefe4('0x3d')][_0xefe4('0x49')]()[_0xefe4('0x24')](respondWithResult(_0x2d4466,null))['catch'](handleError(_0x2d4466,null));}; \ No newline at end of file +var _0xe9bc=['options','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','then','destroy','name','send','index','map','MailSubstatus','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','rows'];(function(_0xe4bb3d,_0x21e87e){var _0xd9e51=function(_0x1f732b){while(--_0x1f732b){_0xe4bb3d['push'](_0xe4bb3d['shift']());}};_0xd9e51(++_0x21e87e);}(_0xe9bc,0x16f));var _0xce9b=function(_0x4dcd79,_0x4b9727){_0x4dcd79=_0x4dcd79-0x0;var _0x433659=_0xe9bc[_0x4dcd79];return _0x433659;};'use strict';var emlformat=require(_0xce9b('0x0'));var rimraf=require(_0xce9b('0x1'));var zipdir=require(_0xce9b('0x2'));var jsonpatch=require(_0xce9b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xce9b('0x4'));var Mustache=require(_0xce9b('0x5'));var util=require(_0xce9b('0x6'));var path=require(_0xce9b('0x7'));var sox=require(_0xce9b('0x8'));var csv=require(_0xce9b('0x9'));var ejs=require(_0xce9b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce9b('0xb'));var squel=require('squel');var crypto=require(_0xce9b('0xc'));var jsforce=require(_0xce9b('0xd'));var deskjs=require(_0xce9b('0xe'));var toCsv=require('to-csv');var querystring=require(_0xce9b('0xf'));var Papa=require('papaparse');var Redis=require(_0xce9b('0x10'));var authService=require(_0xce9b('0x11'));var qs=require(_0xce9b('0x12'));var as=require(_0xce9b('0x13'));var hardwareService=require(_0xce9b('0x14'));var logger=require(_0xce9b('0x15'))(_0xce9b('0x16'));var utils=require(_0xce9b('0x17'));var config=require(_0xce9b('0x18'));var licenseUtil=require(_0xce9b('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x285bda,_0x1062f1){_0x1062f1=_0x1062f1||0xcc;return function(_0x3c3feb){if(_0x3c3feb){return _0x285bda[_0xce9b('0x1a')](_0x1062f1);}return _0x285bda[_0xce9b('0x1b')](_0x1062f1)[_0xce9b('0x1c')]();};}function respondWithResult(_0x172fd7,_0x5517e6){_0x5517e6=_0x5517e6||0xc8;return function(_0x44ece1){if(_0x44ece1){return _0x172fd7['status'](_0x5517e6)[_0xce9b('0x1d')](_0x44ece1);}};}function respondWithFilteredResult(_0x46e995,_0x3362ed){return function(_0x122488){if(_0x122488){var _0x352e56=typeof _0x3362ed[_0xce9b('0x1e')]===_0xce9b('0x1f')&&typeof _0x3362ed[_0xce9b('0x20')]===_0xce9b('0x1f');var _0x538d5c=_0x122488[_0xce9b('0x21')];var _0x280f4e=_0x352e56?0x0:_0x3362ed[_0xce9b('0x1e')];var _0x41f43c=_0x352e56?_0x122488[_0xce9b('0x21')]:_0x3362ed[_0xce9b('0x1e')]+_0x3362ed[_0xce9b('0x20')];var _0x5c1dc0;if(_0x41f43c>=_0x538d5c){_0x41f43c=_0x538d5c;_0x5c1dc0=0xc8;}else{_0x5c1dc0=0xce;}_0x46e995[_0xce9b('0x1b')](_0x5c1dc0);return _0x46e995['set']('Content-Range',_0x280f4e+'-'+_0x41f43c+'/'+_0x538d5c)[_0xce9b('0x1d')](_0x122488);}return null;};}function patchUpdates(_0x32d81a){return function(_0x2a4a82){try{jsonpatch[_0xce9b('0x22')](_0x2a4a82,_0x32d81a,!![]);}catch(_0x2ed0aa){return BPromise[_0xce9b('0x23')](_0x2ed0aa);}return _0x2a4a82['save']();};}function saveUpdates(_0x8824f0,_0x46a3cb){return function(_0x1020a5){if(_0x1020a5){return _0x1020a5[_0xce9b('0x24')](_0x8824f0)[_0xce9b('0x25')](function(_0x3f3b35){return _0x3f3b35;});}return null;};}function removeEntity(_0x3da075,_0x40398e){return function(_0xdacf4e){if(_0xdacf4e){return _0xdacf4e[_0xce9b('0x26')]()[_0xce9b('0x25')](function(){_0x3da075[_0xce9b('0x1b')](0xcc)[_0xce9b('0x1c')]();});}};}function handleEntityNotFound(_0x5df51b,_0x2a5fb3){return function(_0x34e49f){if(!_0x34e49f){_0x5df51b[_0xce9b('0x1a')](0x194);}return _0x34e49f;};}function handleError(_0x5d5d36,_0x330de6){_0x330de6=_0x330de6||0x1f4;return function(_0x565781){logger['error'](_0x565781['stack']);if(_0x565781[_0xce9b('0x27')]){delete _0x565781[_0xce9b('0x27')];}_0x5d5d36[_0xce9b('0x1b')](_0x330de6)[_0xce9b('0x28')](_0x565781);};}exports[_0xce9b('0x29')]=function(_0x2686ab,_0x59f7b8){var _0x40df37={},_0x1e03d3={},_0x231835={'count':0x0,'rows':[]};var _0x21bb2b=_[_0xce9b('0x2a')](db[_0xce9b('0x2b')]['rawAttributes'],function(_0x20d619){return{'name':_0x20d619[_0xce9b('0x2c')],'type':_0x20d619[_0xce9b('0x2d')][_0xce9b('0x2e')]};});_0x1e03d3['model']=_[_0xce9b('0x2a')](_0x21bb2b,_0xce9b('0x27'));_0x1e03d3['query']=_[_0xce9b('0x2f')](_0x2686ab[_0xce9b('0x30')]);_0x1e03d3[_0xce9b('0x31')]=_[_0xce9b('0x32')](_0x1e03d3[_0xce9b('0x33')],_0x1e03d3[_0xce9b('0x30')]);_0x40df37[_0xce9b('0x34')]=_[_0xce9b('0x32')](_0x1e03d3[_0xce9b('0x33')],qs[_0xce9b('0x35')](_0x2686ab[_0xce9b('0x30')][_0xce9b('0x35')]));_0x40df37[_0xce9b('0x34')]=_0x40df37[_0xce9b('0x34')][_0xce9b('0x36')]?_0x40df37[_0xce9b('0x34')]:_0x1e03d3['model'];if(!_0x2686ab[_0xce9b('0x30')][_0xce9b('0x37')](_0xce9b('0x38'))){_0x40df37[_0xce9b('0x20')]=qs[_0xce9b('0x20')](_0x2686ab['query'][_0xce9b('0x20')]);_0x40df37[_0xce9b('0x1e')]=qs[_0xce9b('0x1e')](_0x2686ab[_0xce9b('0x30')][_0xce9b('0x1e')]);}_0x40df37[_0xce9b('0x39')]=qs[_0xce9b('0x3a')](_0x2686ab[_0xce9b('0x30')][_0xce9b('0x3a')]);_0x40df37[_0xce9b('0x3b')]=qs[_0xce9b('0x31')](_['pick'](_0x2686ab[_0xce9b('0x30')],_0x1e03d3[_0xce9b('0x31')]),_0x21bb2b);if(_0x2686ab[_0xce9b('0x30')][_0xce9b('0x3c')]){_0x40df37[_0xce9b('0x3b')]=_[_0xce9b('0x3d')](_0x40df37['where'],{'$or':_[_0xce9b('0x2a')](_0x21bb2b,function(_0x2a368d){if(_0x2a368d[_0xce9b('0x2d')]!=='VIRTUAL'){var _0x12f1f3={};_0x12f1f3[_0x2a368d['name']]={'$like':'%'+_0x2686ab[_0xce9b('0x30')]['filter']+'%'};return _0x12f1f3;}})});}_0x40df37=_['merge']({},_0x40df37,_0x2686ab['options']);var _0x3366b6={'where':_0x40df37['where']};return db[_0xce9b('0x2b')][_0xce9b('0x21')](_0x3366b6)[_0xce9b('0x25')](function(_0xc82238){_0x231835[_0xce9b('0x21')]=_0xc82238;if(_0x2686ab['query'][_0xce9b('0x3e')]){_0x40df37[_0xce9b('0x3f')]=[{'all':!![]}];}return db[_0xce9b('0x2b')]['findAll'](_0x40df37);})[_0xce9b('0x25')](function(_0xa46d64){_0x231835[_0xce9b('0x40')]=_0xa46d64;return _0x231835;})['then'](respondWithFilteredResult(_0x59f7b8,_0x40df37))['catch'](handleError(_0x59f7b8,null));};exports['show']=function(_0x5a334d,_0x48760e){var _0xe79137={'raw':!![],'where':{'id':_0x5a334d['params']['id']}},_0x4628fd={};_0x4628fd[_0xce9b('0x33')]=_[_0xce9b('0x2f')](db[_0xce9b('0x2b')]['rawAttributes']);_0x4628fd[_0xce9b('0x30')]=_[_0xce9b('0x2f')](_0x5a334d['query']);_0x4628fd[_0xce9b('0x31')]=_['intersection'](_0x4628fd[_0xce9b('0x33')],_0x4628fd['query']);_0xe79137[_0xce9b('0x34')]=_[_0xce9b('0x32')](_0x4628fd[_0xce9b('0x33')],qs['fields'](_0x5a334d['query'][_0xce9b('0x35')]));_0xe79137[_0xce9b('0x34')]=_0xe79137[_0xce9b('0x34')][_0xce9b('0x36')]?_0xe79137[_0xce9b('0x34')]:_0x4628fd[_0xce9b('0x33')];if(_0x5a334d[_0xce9b('0x30')]['includeAll']){_0xe79137[_0xce9b('0x3f')]=[{'all':!![]}];}_0xe79137=_[_0xce9b('0x3d')]({},_0xe79137,_0x5a334d[_0xce9b('0x41')]);return db[_0xce9b('0x2b')][_0xce9b('0x42')](_0xe79137)[_0xce9b('0x25')](handleEntityNotFound(_0x48760e,null))[_0xce9b('0x25')](respondWithResult(_0x48760e,null))[_0xce9b('0x43')](handleError(_0x48760e,null));};exports[_0xce9b('0x44')]=function(_0x552de1,_0x11d4f1){return db['MailSubstatus'][_0xce9b('0x44')](_0x552de1['body'],{})[_0xce9b('0x25')](respondWithResult(_0x11d4f1,0xc9))['catch'](handleError(_0x11d4f1,null));};exports[_0xce9b('0x24')]=function(_0x226f28,_0x364bef){if(_0x226f28[_0xce9b('0x45')]['id']){delete _0x226f28[_0xce9b('0x45')]['id'];}return db[_0xce9b('0x2b')]['find']({'where':{'id':_0x226f28[_0xce9b('0x46')]['id']}})[_0xce9b('0x25')](handleEntityNotFound(_0x364bef,null))['then'](saveUpdates(_0x226f28[_0xce9b('0x45')],null))[_0xce9b('0x25')](respondWithResult(_0x364bef,null))[_0xce9b('0x43')](handleError(_0x364bef,null));};exports[_0xce9b('0x26')]=function(_0x43bb12,_0x707bc3){return db[_0xce9b('0x2b')][_0xce9b('0x42')]({'where':{'id':_0x43bb12['params']['id']}})[_0xce9b('0x25')](handleEntityNotFound(_0x707bc3,null))[_0xce9b('0x25')](removeEntity(_0x707bc3,null))['catch'](handleError(_0x707bc3,null));};exports[_0xce9b('0x47')]=function(_0x4336ac,_0x2a618d){return db[_0xce9b('0x2b')]['describe']()[_0xce9b('0x25')](respondWithResult(_0x2a618d,null))[_0xce9b('0x43')](handleError(_0x2a618d,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 0177433..4549920 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 _0x2aab=['../../mysqldb','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x5147ab,_0x491d93){var _0x207a2f=function(_0x4e0fbd){while(--_0x4e0fbd){_0x5147ab['push'](_0x5147ab['shift']());}};_0x207a2f(++_0x491d93);}(_0x2aab,0x99));var _0xb2aa=function(_0x53aadd,_0x29e1f0){_0x53aadd=_0x53aadd-0x0;var _0x202a67=_0x2aab[_0x53aadd];return _0x202a67;};'use strict';var EventEmitter=require(_0xb2aa('0x0'));var MailSubstatus=require(_0xb2aa('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0xb2aa('0x2')};function emitEvent(_0x264340){return function(_0xce695d,_0x521e66,_0x5e3c3f){MailSubstatusEvents[_0xb2aa('0x3')](_0x264340+':'+_0xce695d['id'],_0xce695d);MailSubstatusEvents[_0xb2aa('0x3')](_0x264340,_0xce695d);_0x5e3c3f(null);};}for(var e in events){if(events[_0xb2aa('0x4')](e)){var event=events[e];MailSubstatus[_0xb2aa('0x5')](e,emitEvent(event));}}module[_0xb2aa('0x6')]=MailSubstatusEvents; \ No newline at end of file +var _0x9c73=['setMaxListeners','update','emit','hasOwnProperty','hook','events','../../mysqldb','MailSubstatus'];(function(_0x205922,_0x3c6396){var _0x474f91=function(_0x5e5244){while(--_0x5e5244){_0x205922['push'](_0x205922['shift']());}};_0x474f91(++_0x3c6396);}(_0x9c73,0x7d));var _0x39c7=function(_0x40b0e7,_0x1ef317){_0x40b0e7=_0x40b0e7-0x0;var _0x396d23=_0x9c73[_0x40b0e7];return _0x396d23;};'use strict';var EventEmitter=require(_0x39c7('0x0'));var MailSubstatus=require(_0x39c7('0x1'))['db'][_0x39c7('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x39c7('0x3')](0x0);var events={'afterUpdate':_0x39c7('0x4')};function emitEvent(_0x50b6bb){return function(_0x2e650c,_0x672e62,_0x5b42d8){MailSubstatusEvents[_0x39c7('0x5')](_0x50b6bb+':'+_0x2e650c['id'],_0x2e650c);MailSubstatusEvents['emit'](_0x50b6bb,_0x2e650c);_0x5b42d8(null);};}for(var e in events){if(events[_0x39c7('0x6')](e)){var event=events[e];MailSubstatus[_0x39c7('0x7')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 2418586..f93d31b 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 _0xaefe=['name','then','catch','./mailSubstatus.attributes','exports','mail_substatuses','Condition','update','mailSubstatus'];(function(_0x420516,_0x5ce5ca){var _0x16484e=function(_0x18775b){while(--_0x18775b){_0x420516['push'](_0x420516['shift']());}};_0x16484e(++_0x5ce5ca);}(_0xaefe,0x174));var _0xeaef=function(_0x4f4c2a,_0x5f5a28){_0x4f4c2a=_0x4f4c2a-0x0;var _0xd15be6=_0xaefe[_0x4f4c2a];return _0xd15be6;};'use strict';var attributes=require(_0xeaef('0x0'));module[_0xeaef('0x1')]=function(_0x15d4ef){var _0x2b8211=_0x15d4ef['models'];return _0x15d4ef['define']('MailSubstatus',attributes,{'tableName':_0xeaef('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x55486b,_0x54968d,_0x3179cb){return _0x2b8211[_0xeaef('0x3')][_0xeaef('0x4')]({'value':_0x55486b['name']},{'where':{'field':_0xeaef('0x5'),'value':_0x55486b['_previousDataValues'][_0xeaef('0x6')]}})[_0xeaef('0x7')](function(){_0x3179cb();})[_0xeaef('0x8')](function(_0x2d2a6e){_0x3179cb(_0x2d2a6e);});}}});}; \ No newline at end of file +var _0x562f=['then','catch','./mailSubstatus.attributes','exports','models','update','name','mailSubstatus','_previousDataValues'];(function(_0x11db28,_0x4a6d36){var _0x4700fc=function(_0xdbcc66){while(--_0xdbcc66){_0x11db28['push'](_0x11db28['shift']());}};_0x4700fc(++_0x4a6d36);}(_0x562f,0x80));var _0xf562=function(_0x2a74f5,_0x542b0b){_0x2a74f5=_0x2a74f5-0x0;var _0x358258=_0x562f[_0x2a74f5];return _0x358258;};'use strict';var attributes=require(_0xf562('0x0'));module[_0xf562('0x1')]=function(_0x846de2){var _0x21c7b4=_0x846de2[_0xf562('0x2')];return _0x846de2['define']('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x2b375b,_0x51b24b,_0x294e12){return _0x21c7b4['Condition'][_0xf562('0x3')]({'value':_0x2b375b[_0xf562('0x4')]},{'where':{'field':_0xf562('0x5'),'value':_0x2b375b[_0xf562('0x6')][_0xf562('0x4')]}})[_0xf562('0x7')](function(){_0x294e12();})[_0xf562('0x8')](function(_0x527a7c){_0x294e12(_0x527a7c);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 98bee59..dc9be99 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 _0x0571=['../../config/logger','rpc','../../config/environment','client','http','debug','error','code','MailSubstatus,\x20%s,\x20%s','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x506792,_0x27b4c5){var _0x54af78=function(_0x19de74){while(--_0x19de74){_0x506792['push'](_0x506792['shift']());}};_0x54af78(++_0x27b4c5);}(_0x0571,0xa4));var _0x1057=function(_0x414f67,_0x861aed){_0x414f67=_0x414f67-0x0;var _0x338537=_0x0571[_0x414f67];return _0x338537;};'use strict';var _=require(_0x1057('0x0'));var util=require(_0x1057('0x1'));var moment=require('moment');var BPromise=require(_0x1057('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1057('0x3'));var db=require(_0x1057('0x4'))['db'];var utils=require(_0x1057('0x5'));var logger=require(_0x1057('0x6'))(_0x1057('0x7'));var config=require(_0x1057('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1057('0x9')][_0x1057('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48f1a0,_0x56744a,_0xa4ffa9){return new BPromise(function(_0x5aa801,_0x424c22){return client['request'](_0x48f1a0,_0xa4ffa9)['then'](function(_0x1d0e1a){logger['info']('MailSubstatus,\x20%s,\x20%s',_0x56744a,'request\x20sent');logger[_0x1057('0xb')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x56744a,'request\x20sent',JSON['stringify'](_0x1d0e1a));if(_0x1d0e1a[_0x1057('0xc')]){if(_0x1d0e1a['error'][_0x1057('0xd')]===0x1f4){logger[_0x1057('0xc')](_0x1057('0xe'),_0x56744a,_0x1d0e1a[_0x1057('0xc')][_0x1057('0xf')]);return _0x424c22(_0x1d0e1a[_0x1057('0xc')][_0x1057('0xf')]);}logger[_0x1057('0xc')](_0x1057('0xe'),_0x56744a,_0x1d0e1a['error'][_0x1057('0xf')]);return _0x5aa801(_0x1d0e1a[_0x1057('0xc')]['message']);}else{logger['info'](_0x1057('0xe'),_0x56744a,'request\x20sent');_0x5aa801(_0x1d0e1a['result'][_0x1057('0xf')]);}})[_0x1057('0x10')](function(_0x4dc517){logger[_0x1057('0xc')](_0x1057('0xe'),_0x56744a,_0x4dc517);_0x424c22(_0x4dc517);});});} \ No newline at end of file +var _0x004c=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x16b216,_0x5f0aa3){var _0xdbc9b9=function(_0x1f1ed8){while(--_0x1f1ed8){_0x16b216['push'](_0x16b216['shift']());}};_0xdbc9b9(++_0x5f0aa3);}(_0x004c,0x85));var _0xc004=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x004c[_0x2d34d6];return _0x1d3d12;};'use strict';var _=require(_0xc004('0x0'));var util=require(_0xc004('0x1'));var moment=require(_0xc004('0x2'));var BPromise=require(_0xc004('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc004('0x4'));var db=require(_0xc004('0x5'))['db'];var utils=require(_0xc004('0x6'));var logger=require(_0xc004('0x7'))('rpc');var config=require(_0xc004('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc004('0x9')][_0xc004('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ef023,_0x4c12db,_0x1b5007){return new BPromise(function(_0x46dcf9,_0x40ad0c){return client[_0xc004('0xb')](_0x5ef023,_0x1b5007)['then'](function(_0x13f5c7){logger[_0xc004('0xc')](_0xc004('0xd'),_0x4c12db,_0xc004('0xe'));logger[_0xc004('0xf')](_0xc004('0x10'),_0x4c12db,_0xc004('0xe'),JSON[_0xc004('0x11')](_0x13f5c7));if(_0x13f5c7[_0xc004('0x12')]){if(_0x13f5c7[_0xc004('0x12')]['code']===0x1f4){logger[_0xc004('0x12')](_0xc004('0xd'),_0x4c12db,_0x13f5c7[_0xc004('0x12')][_0xc004('0x13')]);return _0x40ad0c(_0x13f5c7[_0xc004('0x12')][_0xc004('0x13')]);}logger[_0xc004('0x12')](_0xc004('0xd'),_0x4c12db,_0x13f5c7[_0xc004('0x12')][_0xc004('0x13')]);return _0x46dcf9(_0x13f5c7[_0xc004('0x12')][_0xc004('0x13')]);}else{logger[_0xc004('0xc')](_0xc004('0xd'),_0x4c12db,'request\x20sent');_0x46dcf9(_0x13f5c7[_0xc004('0x14')][_0xc004('0x13')]);}})[_0xc004('0x15')](function(_0x2795bb){logger[_0xc004('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x4c12db,_0x2795bb);_0x40ad0c(_0x2795bb);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index d890b38..dc07596 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 _0x8d0c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x975f94,_0x273cc8){var _0x1a678d=function(_0x5ec9d3){while(--_0x5ec9d3){_0x975f94['push'](_0x975f94['shift']());}};_0x1a678d(++_0x273cc8);}(_0x8d0c,0x143));var _0xc8d0=function(_0x5dce58,_0x11480f){_0x5dce58=_0x5dce58-0x0;var _0x17f55e=_0x8d0c[_0x5dce58];return _0x17f55e;};'use strict';var multer=require(_0xc8d0('0x0'));var util=require(_0xc8d0('0x1'));var path=require(_0xc8d0('0x2'));var timeout=require(_0xc8d0('0x3'));var express=require(_0xc8d0('0x4'));var router=express[_0xc8d0('0x5')]();var fs_extra=require(_0xc8d0('0x6'));var auth=require(_0xc8d0('0x7'));var interaction=require(_0xc8d0('0x8'));var config=require(_0xc8d0('0x9'));var controller=require(_0xc8d0('0xa'));router[_0xc8d0('0xb')]('/',auth[_0xc8d0('0xc')](),controller[_0xc8d0('0xd')]);router[_0xc8d0('0xb')](_0xc8d0('0xe'),auth['isAuthenticated'](),controller[_0xc8d0('0xf')]);router['get'](_0xc8d0('0x10'),auth['isAuthenticated'](),controller['show']);router[_0xc8d0('0x11')]('/',auth[_0xc8d0('0xc')](),controller[_0xc8d0('0x12')]);router[_0xc8d0('0x13')](_0xc8d0('0x10'),auth[_0xc8d0('0xc')](),controller[_0xc8d0('0x14')]);router[_0xc8d0('0x15')](_0xc8d0('0x10'),auth[_0xc8d0('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd40f=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','index','get','/describe','/:id','post','isAuthenticated','create','put','destroy','multer','util','express'];(function(_0x22c72a,_0x21b8ef){var _0x1c7fcf=function(_0x3a067e){while(--_0x3a067e){_0x22c72a['push'](_0x22c72a['shift']());}};_0x1c7fcf(++_0x21b8ef);}(_0xd40f,0x96));var _0xfd40=function(_0x34fbee,_0xc24eaa){_0x34fbee=_0x34fbee-0x0;var _0x289c90=_0xd40f[_0x34fbee];return _0x289c90;};'use strict';var multer=require(_0xfd40('0x0'));var util=require(_0xfd40('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfd40('0x2'));var router=express[_0xfd40('0x3')]();var fs_extra=require(_0xfd40('0x4'));var auth=require(_0xfd40('0x5'));var interaction=require(_0xfd40('0x6'));var config=require('../../config/environment');var controller=require(_0xfd40('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xfd40('0x8')]);router[_0xfd40('0x9')](_0xfd40('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xfd40('0x9')](_0xfd40('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xfd40('0xc')]('/',auth[_0xfd40('0xd')](),controller[_0xfd40('0xe')]);router[_0xfd40('0xf')](_0xfd40('0xb'),auth[_0xfd40('0xd')](),controller['update']);router['delete'](_0xfd40('0xb'),auth[_0xfd40('0xd')](),controller[_0xfd40('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 7d1eab9..7a5d7bd 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x3da647,_0xa1a501){var _0x2e91a2=function(_0x34a811){while(--_0x34a811){_0x3da647['push'](_0x3da647['shift']());}};_0x2e91a2(++_0xa1a501);}(_0x34e8,0x12c));var _0x834e=function(_0x44a7d7,_0x24ea5a){_0x44a7d7=_0x44a7d7-0x0;var _0x1adb4a=_0x34e8[_0x44a7d7];return _0x1adb4a;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x5ecc00,_0xc3a378){var _0x29ac1e=function(_0x375756){while(--_0x375756){_0x5ecc00['push'](_0x5ecc00['shift']());}};_0x29ac1e(++_0xc3a378);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x22c684,_0x753309){_0x22c684=_0x22c684-0x0;var _0x39fcbb=_0xcb91[_0x22c684];return _0x39fcbb;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 85bf067..1bc3f6f 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 _0xc1f6=['update','then','destroy','error','stack','name','index','MailTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','catch','params','fields','includeAll','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','reject','save'];(function(_0x470a15,_0x44fdf3){var _0x448575=function(_0x1550f8){while(--_0x1550f8){_0x470a15['push'](_0x470a15['shift']());}};_0x448575(++_0x44fdf3);}(_0xc1f6,0xae));var _0x6c1f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc1f6[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x6c1f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6c1f('0x1'));var jsonpatch=require(_0x6c1f('0x2'));var rp=require(_0x6c1f('0x3'));var moment=require(_0x6c1f('0x4'));var BPromise=require(_0x6c1f('0x5'));var Mustache=require(_0x6c1f('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6c1f('0x7'));var csv=require(_0x6c1f('0x8'));var ejs=require(_0x6c1f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6c1f('0xa'));var crypto=require(_0x6c1f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6c1f('0xc'));var toCsv=require(_0x6c1f('0x8'));var querystring=require('querystring');var Papa=require(_0x6c1f('0xd'));var Redis=require(_0x6c1f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6c1f('0xf'));var as=require(_0x6c1f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x6c1f('0x11'));var licenseUtil=require(_0x6c1f('0x12'));var db=require(_0x6c1f('0x13'))['db'];function respondWithStatusCode(_0x38df03,_0x43e2b2){_0x43e2b2=_0x43e2b2||0xcc;return function(_0x357f7a){if(_0x357f7a){return _0x38df03[_0x6c1f('0x14')](_0x43e2b2);}return _0x38df03[_0x6c1f('0x15')](_0x43e2b2)[_0x6c1f('0x16')]();};}function respondWithResult(_0x1fd51e,_0xf9e39c){_0xf9e39c=_0xf9e39c||0xc8;return function(_0x1556fb){if(_0x1556fb){return _0x1fd51e[_0x6c1f('0x15')](_0xf9e39c)['json'](_0x1556fb);}};}function respondWithFilteredResult(_0x1c2c42,_0x4d8cfc){return function(_0x373a2c){if(_0x373a2c){var _0x97c352=typeof _0x4d8cfc['offset']==='undefined'&&typeof _0x4d8cfc['limit']==='undefined';var _0x18101b=_0x373a2c[_0x6c1f('0x17')];var _0x570913=_0x97c352?0x0:_0x4d8cfc[_0x6c1f('0x18')];var _0x84bce5=_0x97c352?_0x373a2c[_0x6c1f('0x17')]:_0x4d8cfc[_0x6c1f('0x18')]+_0x4d8cfc[_0x6c1f('0x19')];var _0x19c4df;if(_0x84bce5>=_0x18101b){_0x84bce5=_0x18101b;_0x19c4df=0xc8;}else{_0x19c4df=0xce;}_0x1c2c42[_0x6c1f('0x15')](_0x19c4df);return _0x1c2c42[_0x6c1f('0x1a')]('Content-Range',_0x570913+'-'+_0x84bce5+'/'+_0x18101b)[_0x6c1f('0x1b')](_0x373a2c);}return null;};}function patchUpdates(_0x2a8af6){return function(_0x3cb7e9){try{jsonpatch['apply'](_0x3cb7e9,_0x2a8af6,!![]);}catch(_0x4efd5a){return BPromise[_0x6c1f('0x1c')](_0x4efd5a);}return _0x3cb7e9[_0x6c1f('0x1d')]();};}function saveUpdates(_0x41480a,_0x28ba00){return function(_0xbca77e){if(_0xbca77e){return _0xbca77e[_0x6c1f('0x1e')](_0x41480a)[_0x6c1f('0x1f')](function(_0x2231a7){return _0x2231a7;});}return null;};}function removeEntity(_0x51b350,_0x9c293e){return function(_0x477cef){if(_0x477cef){return _0x477cef[_0x6c1f('0x20')]()[_0x6c1f('0x1f')](function(){_0x51b350[_0x6c1f('0x15')](0xcc)[_0x6c1f('0x16')]();});}};}function handleEntityNotFound(_0xe6967d,_0x426a4c){return function(_0x2168ad){if(!_0x2168ad){_0xe6967d[_0x6c1f('0x14')](0x194);}return _0x2168ad;};}function handleError(_0x560074,_0x416080){_0x416080=_0x416080||0x1f4;return function(_0x449117){logger[_0x6c1f('0x21')](_0x449117[_0x6c1f('0x22')]);if(_0x449117['name']){delete _0x449117[_0x6c1f('0x23')];}_0x560074[_0x6c1f('0x15')](_0x416080)['send'](_0x449117);};}exports[_0x6c1f('0x24')]=function(_0x347ef7,_0x54aa7c){var _0x4395a4={},_0x34bfe1={},_0x417653={'count':0x0,'rows':[]};var _0x4982af=_['map'](db[_0x6c1f('0x25')][_0x6c1f('0x26')],function(_0x4da0c6){return{'name':_0x4da0c6[_0x6c1f('0x27')],'type':_0x4da0c6[_0x6c1f('0x28')][_0x6c1f('0x29')]};});_0x34bfe1[_0x6c1f('0x2a')]=_[_0x6c1f('0x2b')](_0x4982af,'name');_0x34bfe1[_0x6c1f('0x2c')]=_[_0x6c1f('0x2d')](_0x347ef7[_0x6c1f('0x2c')]);_0x34bfe1[_0x6c1f('0x2e')]=_[_0x6c1f('0x2f')](_0x34bfe1[_0x6c1f('0x2a')],_0x34bfe1[_0x6c1f('0x2c')]);_0x4395a4['attributes']=_['intersection'](_0x34bfe1['model'],qs['fields'](_0x347ef7[_0x6c1f('0x2c')]['fields']));_0x4395a4['attributes']=_0x4395a4[_0x6c1f('0x30')][_0x6c1f('0x31')]?_0x4395a4[_0x6c1f('0x30')]:_0x34bfe1[_0x6c1f('0x2a')];if(!_0x347ef7[_0x6c1f('0x2c')]['hasOwnProperty'](_0x6c1f('0x32'))){_0x4395a4[_0x6c1f('0x19')]=qs[_0x6c1f('0x19')](_0x347ef7['query'][_0x6c1f('0x19')]);_0x4395a4[_0x6c1f('0x18')]=qs[_0x6c1f('0x18')](_0x347ef7['query'][_0x6c1f('0x18')]);}_0x4395a4['order']=qs[_0x6c1f('0x33')](_0x347ef7['query'][_0x6c1f('0x33')]);_0x4395a4[_0x6c1f('0x34')]=qs['filters'](_[_0x6c1f('0x35')](_0x347ef7[_0x6c1f('0x2c')],_0x34bfe1[_0x6c1f('0x2e')]),_0x4982af);if(_0x347ef7[_0x6c1f('0x2c')][_0x6c1f('0x36')]){_0x4395a4[_0x6c1f('0x34')]=_[_0x6c1f('0x37')](_0x4395a4[_0x6c1f('0x34')],{'$or':_[_0x6c1f('0x2b')](_0x4982af,function(_0xbf7bed){if(_0xbf7bed[_0x6c1f('0x28')]!=='VIRTUAL'){var _0x24a753={};_0x24a753[_0xbf7bed[_0x6c1f('0x23')]]={'$like':'%'+_0x347ef7[_0x6c1f('0x2c')][_0x6c1f('0x36')]+'%'};return _0x24a753;}})});}_0x4395a4=_[_0x6c1f('0x37')]({},_0x4395a4,_0x347ef7[_0x6c1f('0x38')]);var _0x3bd597={'where':_0x4395a4[_0x6c1f('0x34')]};return db['MailTransferReport']['count'](_0x3bd597)[_0x6c1f('0x1f')](function(_0x56da50){_0x417653[_0x6c1f('0x17')]=_0x56da50;if(_0x347ef7['query']['includeAll']){_0x4395a4[_0x6c1f('0x39')]=[{'all':!![]}];}return db[_0x6c1f('0x25')][_0x6c1f('0x3a')](_0x4395a4);})[_0x6c1f('0x1f')](function(_0x1a8484){_0x417653[_0x6c1f('0x3b')]=_0x1a8484;return _0x417653;})['then'](respondWithFilteredResult(_0x54aa7c,_0x4395a4))[_0x6c1f('0x3c')](handleError(_0x54aa7c,null));};exports['show']=function(_0x19e522,_0x18eb75){var _0x52e0ff={'raw':!![],'where':{'id':_0x19e522[_0x6c1f('0x3d')]['id']}},_0x228101={};_0x228101[_0x6c1f('0x2a')]=_[_0x6c1f('0x2d')](db[_0x6c1f('0x25')][_0x6c1f('0x26')]);_0x228101['query']=_[_0x6c1f('0x2d')](_0x19e522[_0x6c1f('0x2c')]);_0x228101[_0x6c1f('0x2e')]=_[_0x6c1f('0x2f')](_0x228101[_0x6c1f('0x2a')],_0x228101[_0x6c1f('0x2c')]);_0x52e0ff[_0x6c1f('0x30')]=_['intersection'](_0x228101[_0x6c1f('0x2a')],qs[_0x6c1f('0x3e')](_0x19e522[_0x6c1f('0x2c')][_0x6c1f('0x3e')]));_0x52e0ff['attributes']=_0x52e0ff[_0x6c1f('0x30')][_0x6c1f('0x31')]?_0x52e0ff[_0x6c1f('0x30')]:_0x228101[_0x6c1f('0x2a')];if(_0x19e522[_0x6c1f('0x2c')][_0x6c1f('0x3f')]){_0x52e0ff[_0x6c1f('0x39')]=[{'all':!![]}];}_0x52e0ff=_[_0x6c1f('0x37')]({},_0x52e0ff,_0x19e522['options']);return db['MailTransferReport']['find'](_0x52e0ff)[_0x6c1f('0x1f')](handleEntityNotFound(_0x18eb75,null))[_0x6c1f('0x1f')](respondWithResult(_0x18eb75,null))[_0x6c1f('0x3c')](handleError(_0x18eb75,null));};exports[_0x6c1f('0x40')]=function(_0x2f284f,_0x282c2f){return db[_0x6c1f('0x25')][_0x6c1f('0x40')](_0x2f284f[_0x6c1f('0x41')],{})[_0x6c1f('0x1f')](respondWithResult(_0x282c2f,0xc9))[_0x6c1f('0x3c')](handleError(_0x282c2f,null));};exports[_0x6c1f('0x1e')]=function(_0x100da8,_0x2557a1){if(_0x100da8['body']['id']){delete _0x100da8[_0x6c1f('0x41')]['id'];}return db['MailTransferReport'][_0x6c1f('0x42')]({'where':{'id':_0x100da8[_0x6c1f('0x3d')]['id']}})[_0x6c1f('0x1f')](handleEntityNotFound(_0x2557a1,null))[_0x6c1f('0x1f')](saveUpdates(_0x100da8[_0x6c1f('0x41')],null))['then'](respondWithResult(_0x2557a1,null))[_0x6c1f('0x3c')](handleError(_0x2557a1,null));};exports['destroy']=function(_0x5296de,_0x419905){return db[_0x6c1f('0x25')][_0x6c1f('0x42')]({'where':{'id':_0x5296de[_0x6c1f('0x3d')]['id']}})[_0x6c1f('0x1f')](handleEntityNotFound(_0x419905,null))[_0x6c1f('0x1f')](removeEntity(_0x419905,null))[_0x6c1f('0x3c')](handleError(_0x419905,null));};exports[_0x6c1f('0x43')]=function(_0x380bd8,_0x13cc19){return db['MailTransferReport'][_0x6c1f('0x43')]()['then'](respondWithResult(_0x13cc19,null))[_0x6c1f('0x3c')](handleError(_0x13cc19,null));}; \ No newline at end of file +var _0x87ae=['json','offset','undefined','count','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','index','map','MailTransferReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','include','rows','rawAttributes','includeAll','options','find','create','body','params','catch','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end'];(function(_0x2fc7bb,_0x399dc1){var _0x45fa5b=function(_0x58c681){while(--_0x58c681){_0x2fc7bb['push'](_0x2fc7bb['shift']());}};_0x45fa5b(++_0x399dc1);}(_0x87ae,0x15d));var _0xe87a=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x87ae[_0x5608a3];return _0x1ed50a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe87a('0x0'));var zipdir=require(_0xe87a('0x1'));var jsonpatch=require(_0xe87a('0x2'));var rp=require(_0xe87a('0x3'));var moment=require(_0xe87a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe87a('0x5'));var path=require(_0xe87a('0x6'));var sox=require(_0xe87a('0x7'));var csv=require('to-csv');var ejs=require(_0xe87a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe87a('0x9'));var squel=require(_0xe87a('0xa'));var crypto=require(_0xe87a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe87a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe87a('0xd'));var Papa=require(_0xe87a('0xe'));var Redis=require(_0xe87a('0xf'));var authService=require(_0xe87a('0x10'));var qs=require(_0xe87a('0x11'));var as=require(_0xe87a('0x12'));var hardwareService=require(_0xe87a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xe87a('0x14'));var config=require(_0xe87a('0x15'));var licenseUtil=require(_0xe87a('0x16'));var db=require(_0xe87a('0x17'))['db'];function respondWithStatusCode(_0x5d76cd,_0x5cd0cd){_0x5cd0cd=_0x5cd0cd||0xcc;return function(_0x38e059){if(_0x38e059){return _0x5d76cd['sendStatus'](_0x5cd0cd);}return _0x5d76cd[_0xe87a('0x18')](_0x5cd0cd)[_0xe87a('0x19')]();};}function respondWithResult(_0x3bdc76,_0x1347b4){_0x1347b4=_0x1347b4||0xc8;return function(_0x19f14a){if(_0x19f14a){return _0x3bdc76[_0xe87a('0x18')](_0x1347b4)[_0xe87a('0x1a')](_0x19f14a);}};}function respondWithFilteredResult(_0x540d8c,_0xe3055c){return function(_0x31240f){if(_0x31240f){var _0x3d2d0e=typeof _0xe3055c[_0xe87a('0x1b')]===_0xe87a('0x1c')&&typeof _0xe3055c['limit']===_0xe87a('0x1c');var _0x36af63=_0x31240f[_0xe87a('0x1d')];var _0x50873b=_0x3d2d0e?0x0:_0xe3055c[_0xe87a('0x1b')];var _0x443869=_0x3d2d0e?_0x31240f[_0xe87a('0x1d')]:_0xe3055c['offset']+_0xe3055c['limit'];var _0x23318d;if(_0x443869>=_0x36af63){_0x443869=_0x36af63;_0x23318d=0xc8;}else{_0x23318d=0xce;}_0x540d8c['status'](_0x23318d);return _0x540d8c[_0xe87a('0x1e')](_0xe87a('0x1f'),_0x50873b+'-'+_0x443869+'/'+_0x36af63)[_0xe87a('0x1a')](_0x31240f);}return null;};}function patchUpdates(_0x5e89d1){return function(_0x489fc0){try{jsonpatch[_0xe87a('0x20')](_0x489fc0,_0x5e89d1,!![]);}catch(_0x657bed){return BPromise[_0xe87a('0x21')](_0x657bed);}return _0x489fc0['save']();};}function saveUpdates(_0x5f1056,_0x3b0ea2){return function(_0x445c46){if(_0x445c46){return _0x445c46[_0xe87a('0x22')](_0x5f1056)['then'](function(_0x2db219){return _0x2db219;});}return null;};}function removeEntity(_0x44005b,_0x145512){return function(_0x553537){if(_0x553537){return _0x553537[_0xe87a('0x23')]()[_0xe87a('0x24')](function(){_0x44005b[_0xe87a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40f2f2,_0x262488){return function(_0x4804b9){if(!_0x4804b9){_0x40f2f2['sendStatus'](0x194);}return _0x4804b9;};}function handleError(_0x480acb,_0xea653d){_0xea653d=_0xea653d||0x1f4;return function(_0x5baa50){logger['error'](_0x5baa50[_0xe87a('0x25')]);if(_0x5baa50[_0xe87a('0x26')]){delete _0x5baa50['name'];}_0x480acb[_0xe87a('0x18')](_0xea653d)[_0xe87a('0x27')](_0x5baa50);};}exports[_0xe87a('0x28')]=function(_0xb549d2,_0x74a171){var _0x2b2365={},_0x5de635={},_0x35c38c={'count':0x0,'rows':[]};var _0x53abf7=_[_0xe87a('0x29')](db[_0xe87a('0x2a')]['rawAttributes'],function(_0x1f16f7){return{'name':_0x1f16f7[_0xe87a('0x2b')],'type':_0x1f16f7[_0xe87a('0x2c')][_0xe87a('0x2d')]};});_0x5de635[_0xe87a('0x2e')]=_[_0xe87a('0x29')](_0x53abf7,_0xe87a('0x26'));_0x5de635[_0xe87a('0x2f')]=_[_0xe87a('0x30')](_0xb549d2['query']);_0x5de635['filters']=_[_0xe87a('0x31')](_0x5de635['model'],_0x5de635[_0xe87a('0x2f')]);_0x2b2365[_0xe87a('0x32')]=_[_0xe87a('0x31')](_0x5de635[_0xe87a('0x2e')],qs[_0xe87a('0x33')](_0xb549d2[_0xe87a('0x2f')]['fields']));_0x2b2365[_0xe87a('0x32')]=_0x2b2365[_0xe87a('0x32')][_0xe87a('0x34')]?_0x2b2365[_0xe87a('0x32')]:_0x5de635['model'];if(!_0xb549d2[_0xe87a('0x2f')][_0xe87a('0x35')](_0xe87a('0x36'))){_0x2b2365['limit']=qs[_0xe87a('0x37')](_0xb549d2['query'][_0xe87a('0x37')]);_0x2b2365[_0xe87a('0x1b')]=qs[_0xe87a('0x1b')](_0xb549d2[_0xe87a('0x2f')][_0xe87a('0x1b')]);}_0x2b2365[_0xe87a('0x38')]=qs[_0xe87a('0x39')](_0xb549d2[_0xe87a('0x2f')][_0xe87a('0x39')]);_0x2b2365['where']=qs[_0xe87a('0x3a')](_[_0xe87a('0x3b')](_0xb549d2[_0xe87a('0x2f')],_0x5de635['filters']),_0x53abf7);if(_0xb549d2[_0xe87a('0x2f')][_0xe87a('0x3c')]){_0x2b2365[_0xe87a('0x3d')]=_[_0xe87a('0x3e')](_0x2b2365[_0xe87a('0x3d')],{'$or':_[_0xe87a('0x29')](_0x53abf7,function(_0x2b146a){if(_0x2b146a['type']!==_0xe87a('0x3f')){var _0x588971={};_0x588971[_0x2b146a['name']]={'$like':'%'+_0xb549d2['query'][_0xe87a('0x3c')]+'%'};return _0x588971;}})});}_0x2b2365=_[_0xe87a('0x3e')]({},_0x2b2365,_0xb549d2['options']);var _0x45044e={'where':_0x2b2365[_0xe87a('0x3d')]};return db['MailTransferReport']['count'](_0x45044e)[_0xe87a('0x24')](function(_0x345875){_0x35c38c[_0xe87a('0x1d')]=_0x345875;if(_0xb549d2['query']['includeAll']){_0x2b2365[_0xe87a('0x40')]=[{'all':!![]}];}return db['MailTransferReport']['findAll'](_0x2b2365);})[_0xe87a('0x24')](function(_0x3cf07c){_0x35c38c[_0xe87a('0x41')]=_0x3cf07c;return _0x35c38c;})[_0xe87a('0x24')](respondWithFilteredResult(_0x74a171,_0x2b2365))['catch'](handleError(_0x74a171,null));};exports['show']=function(_0x511cd9,_0x5a4a9b){var _0x3f48b3={'raw':!![],'where':{'id':_0x511cd9['params']['id']}},_0x324463={};_0x324463['model']=_['keys'](db['MailTransferReport'][_0xe87a('0x42')]);_0x324463['query']=_[_0xe87a('0x30')](_0x511cd9[_0xe87a('0x2f')]);_0x324463['filters']=_['intersection'](_0x324463[_0xe87a('0x2e')],_0x324463[_0xe87a('0x2f')]);_0x3f48b3['attributes']=_[_0xe87a('0x31')](_0x324463['model'],qs[_0xe87a('0x33')](_0x511cd9[_0xe87a('0x2f')][_0xe87a('0x33')]));_0x3f48b3[_0xe87a('0x32')]=_0x3f48b3['attributes'][_0xe87a('0x34')]?_0x3f48b3[_0xe87a('0x32')]:_0x324463['model'];if(_0x511cd9[_0xe87a('0x2f')][_0xe87a('0x43')]){_0x3f48b3[_0xe87a('0x40')]=[{'all':!![]}];}_0x3f48b3=_[_0xe87a('0x3e')]({},_0x3f48b3,_0x511cd9[_0xe87a('0x44')]);return db[_0xe87a('0x2a')][_0xe87a('0x45')](_0x3f48b3)[_0xe87a('0x24')](handleEntityNotFound(_0x5a4a9b,null))['then'](respondWithResult(_0x5a4a9b,null))['catch'](handleError(_0x5a4a9b,null));};exports[_0xe87a('0x46')]=function(_0x4c7e06,_0x53cc2b){return db[_0xe87a('0x2a')][_0xe87a('0x46')](_0x4c7e06[_0xe87a('0x47')],{})[_0xe87a('0x24')](respondWithResult(_0x53cc2b,0xc9))['catch'](handleError(_0x53cc2b,null));};exports['update']=function(_0x5b2807,_0x448d27){if(_0x5b2807[_0xe87a('0x47')]['id']){delete _0x5b2807['body']['id'];}return db[_0xe87a('0x2a')][_0xe87a('0x45')]({'where':{'id':_0x5b2807[_0xe87a('0x48')]['id']}})[_0xe87a('0x24')](handleEntityNotFound(_0x448d27,null))[_0xe87a('0x24')](saveUpdates(_0x5b2807[_0xe87a('0x47')],null))[_0xe87a('0x24')](respondWithResult(_0x448d27,null))[_0xe87a('0x49')](handleError(_0x448d27,null));};exports['destroy']=function(_0x1aeec5,_0x320e24){return db[_0xe87a('0x2a')][_0xe87a('0x45')]({'where':{'id':_0x1aeec5[_0xe87a('0x48')]['id']}})[_0xe87a('0x24')](handleEntityNotFound(_0x320e24,null))['then'](removeEntity(_0x320e24,null))[_0xe87a('0x49')](handleError(_0x320e24,null));};exports[_0xe87a('0x4a')]=function(_0x34de1e,_0x42095b){return db[_0xe87a('0x2a')][_0xe87a('0x4a')]()[_0xe87a('0x24')](respondWithResult(_0x42095b,null))[_0xe87a('0x49')](handleError(_0x42095b,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index c9a1c13..9f86781 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 _0xfbdb=['lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid'];(function(_0x2fff1d,_0x1e5ab2){var _0x3decdb=function(_0x519897){while(--_0x519897){_0x2fff1d['push'](_0x2fff1d['shift']());}};_0x3decdb(++_0x1e5ab2);}(_0xfbdb,0x1ba));var _0xbfbd=function(_0x40ce1a,_0x59acca){_0x40ce1a=_0x40ce1a-0x0;var _0x3ba631=_0xfbdb[_0x40ce1a];return _0x3ba631;};'use strict';var _=require(_0xbfbd('0x0'));var util=require('util');var logger=require(_0xbfbd('0x1'))('api');var moment=require(_0xbfbd('0x2'));var BPromise=require(_0xbfbd('0x3'));var rp=require(_0xbfbd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbfbd('0x5'));var config=require(_0xbfbd('0x6'));var attributes=require(_0xbfbd('0x7'));module[_0xbfbd('0x8')]=function(_0x400458,_0x17c125){return _0x400458[_0xbfbd('0x9')](_0xbfbd('0xa'),attributes,{'tableName':_0xbfbd('0xb'),'paranoid':![],'indexes':[{'name':_0xbfbd('0xc'),'fields':[_0xbfbd('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9491=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','report_mail_transfer','uniqueid'];(function(_0x3da3a5,_0x43af27){var _0x1afebb=function(_0x56a176){while(--_0x56a176){_0x3da3a5['push'](_0x3da3a5['shift']());}};_0x1afebb(++_0x43af27);}(_0x9491,0xb6));var _0x1949=function(_0x2d775f,_0xe2e5d4){_0x2d775f=_0x2d775f-0x0;var _0x313c7d=_0x9491[_0x2d775f];return _0x313c7d;};'use strict';var _=require(_0x1949('0x0'));var util=require(_0x1949('0x1'));var logger=require(_0x1949('0x2'))(_0x1949('0x3'));var moment=require(_0x1949('0x4'));var BPromise=require(_0x1949('0x5'));var rp=require(_0x1949('0x6'));var fs=require('fs');var path=require(_0x1949('0x7'));var rimraf=require(_0x1949('0x8'));var config=require(_0x1949('0x9'));var attributes=require('./mailTransferReport.attributes');module[_0x1949('0xa')]=function(_0x5b01b9,_0x14c30e){return _0x5b01b9[_0x1949('0xb')]('MailTransferReport',attributes,{'tableName':_0x1949('0xc'),'paranoid':![],'indexes':[{'name':_0x1949('0xd'),'fields':[_0x1949('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 206ce57..fb1c8b4 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 _0x706d=['util','moment','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash'];(function(_0x53bb06,_0x8be6df){var _0x55ce5f=function(_0x309309){while(--_0x309309){_0x53bb06['push'](_0x53bb06['shift']());}};_0x55ce5f(++_0x8be6df);}(_0x706d,0x1b7));var _0xd706=function(_0x198e18,_0x10a33e){_0x198e18=_0x198e18-0x0;var _0x4276d4=_0x706d[_0x198e18];return _0x4276d4;};'use strict';var _=require(_0xd706('0x0'));var util=require(_0xd706('0x1'));var moment=require(_0xd706('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd706('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd706('0x4'));var logger=require('../../config/logger')(_0xd706('0x5'));var config=require(_0xd706('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd706('0x7')][_0xd706('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4380ec,_0x33a114,_0x3175df){return new BPromise(function(_0x21f0af,_0x4a58c1){return client[_0xd706('0x9')](_0x4380ec,_0x3175df)[_0xd706('0xa')](function(_0x12db98){logger['info'](_0xd706('0xb'),_0x33a114,'request\x20sent');logger[_0xd706('0xc')](_0xd706('0xd'),_0x33a114,_0xd706('0xe'),JSON['stringify'](_0x12db98));if(_0x12db98[_0xd706('0xf')]){if(_0x12db98[_0xd706('0xf')][_0xd706('0x10')]===0x1f4){logger[_0xd706('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x33a114,_0x12db98[_0xd706('0xf')][_0xd706('0x11')]);return _0x4a58c1(_0x12db98[_0xd706('0xf')][_0xd706('0x11')]);}logger[_0xd706('0xf')](_0xd706('0xb'),_0x33a114,_0x12db98[_0xd706('0xf')][_0xd706('0x11')]);return _0x21f0af(_0x12db98[_0xd706('0xf')]['message']);}else{logger['info'](_0xd706('0xb'),_0x33a114,_0xd706('0xe'));_0x21f0af(_0x12db98[_0xd706('0x12')][_0xd706('0x11')]);}})[_0xd706('0x13')](function(_0x271489){logger[_0xd706('0xf')](_0xd706('0xb'),_0x33a114,_0x271489);_0x4a58c1(_0x271489);});});} \ No newline at end of file +var _0x7836=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','request','then','info','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MailTransferReport,\x20%s,\x20%s','message','result','catch'];(function(_0x199a7a,_0x54449f){var _0x584ead=function(_0x36093c){while(--_0x36093c){_0x199a7a['push'](_0x199a7a['shift']());}};_0x584ead(++_0x54449f);}(_0x7836,0xfc));var _0x6783=function(_0x42a584,_0x2d9ee3){_0x42a584=_0x42a584-0x0;var _0x56be59=_0x7836[_0x42a584];return _0x56be59;};'use strict';var _=require(_0x6783('0x0'));var util=require(_0x6783('0x1'));var moment=require(_0x6783('0x2'));var BPromise=require(_0x6783('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6783('0x4'));var db=require(_0x6783('0x5'))['db'];var utils=require(_0x6783('0x6'));var logger=require(_0x6783('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6783('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c88f9,_0x4aaf4d,_0x30fc80){return new BPromise(function(_0x28ce5f,_0x12b7ab){return client[_0x6783('0x9')](_0x2c88f9,_0x30fc80)[_0x6783('0xa')](function(_0x1ba71e){logger[_0x6783('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x4aaf4d,_0x6783('0xc'));logger['debug'](_0x6783('0xd'),_0x4aaf4d,_0x6783('0xc'),JSON[_0x6783('0xe')](_0x1ba71e));if(_0x1ba71e[_0x6783('0xf')]){if(_0x1ba71e[_0x6783('0xf')][_0x6783('0x10')]===0x1f4){logger[_0x6783('0xf')](_0x6783('0x11'),_0x4aaf4d,_0x1ba71e[_0x6783('0xf')][_0x6783('0x12')]);return _0x12b7ab(_0x1ba71e[_0x6783('0xf')][_0x6783('0x12')]);}logger[_0x6783('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x4aaf4d,_0x1ba71e[_0x6783('0xf')][_0x6783('0x12')]);return _0x28ce5f(_0x1ba71e[_0x6783('0xf')][_0x6783('0x12')]);}else{logger[_0x6783('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x4aaf4d,'request\x20sent');_0x28ce5f(_0x1ba71e[_0x6783('0x13')]['message']);}})[_0x6783('0x14')](function(_0x4df4db){logger[_0x6783('0xf')](_0x6783('0x11'),_0x4aaf4d,_0x4df4db);_0x12b7ab(_0x4df4db);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 7dfc0f2..64430ae 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 _0x0147=['describe','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./memberReport.controller','index','get','/describe'];(function(_0x65489f,_0x9e9842){var _0x55557c=function(_0x464467){while(--_0x464467){_0x65489f['push'](_0x65489f['shift']());}};_0x55557c(++_0x9e9842);}(_0x0147,0xd1));var _0x7014=function(_0x493db2,_0x45a3e1){_0x493db2=_0x493db2-0x0;var _0x584074=_0x0147[_0x493db2];return _0x584074;};'use strict';var multer=require('multer');var util=require(_0x7014('0x0'));var path=require(_0x7014('0x1'));var timeout=require(_0x7014('0x2'));var express=require('express');var router=express[_0x7014('0x3')]();var fs_extra=require(_0x7014('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7014('0x5'));var config=require(_0x7014('0x6'));var controller=require(_0x7014('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x7014('0x8')]);router[_0x7014('0x9')](_0x7014('0xa'),auth['isAuthenticated'](),controller[_0x7014('0xb')]);router[_0x7014('0x9')](_0x7014('0xc'),auth['isAuthenticated'](),controller[_0x7014('0xd')]);router[_0x7014('0xe')]('/',auth[_0x7014('0xf')](),controller[_0x7014('0x10')]);router[_0x7014('0x11')](_0x7014('0xc'),auth[_0x7014('0xf')](),controller[_0x7014('0x12')]);router[_0x7014('0x13')]('/:id',auth[_0x7014('0xf')](),controller[_0x7014('0x14')]);module[_0x7014('0x15')]=router; \ No newline at end of file +var _0x8c52=['show','create','put','update','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id'];(function(_0x47d6dc,_0xc036cc){var _0x1a1c93=function(_0x18ec96){while(--_0x18ec96){_0x47d6dc['push'](_0x47d6dc['shift']());}};_0x1a1c93(++_0xc036cc);}(_0x8c52,0x1e2));var _0x28c5=function(_0x329905,_0x13c144){_0x329905=_0x329905-0x0;var _0x3aa42=_0x8c52[_0x329905];return _0x3aa42;};'use strict';var multer=require('multer');var util=require(_0x28c5('0x0'));var path=require(_0x28c5('0x1'));var timeout=require(_0x28c5('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x28c5('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x28c5('0x4'));var config=require(_0x28c5('0x5'));var controller=require('./memberReport.controller');router['get']('/',auth[_0x28c5('0x6')](),controller[_0x28c5('0x7')]);router['get'](_0x28c5('0x8'),auth[_0x28c5('0x6')](),controller[_0x28c5('0x9')]);router[_0x28c5('0xa')](_0x28c5('0xb'),auth[_0x28c5('0x6')](),controller[_0x28c5('0xc')]);router['post']('/',auth[_0x28c5('0x6')](),controller[_0x28c5('0xd')]);router[_0x28c5('0xe')](_0x28c5('0xb'),auth[_0x28c5('0x6')](),controller[_0x28c5('0xf')]);router[_0x28c5('0x10')]('/:id',auth[_0x28c5('0x6')](),controller[_0x28c5('0x11')]);module[_0x28c5('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index ea614bf..16f2888 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 _0xd86a=['talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[dial\x20string]','talk:[queue]','sequelize','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','seconds','setDataValue','duration'];(function(_0x4ded16,_0x23fcbf){var _0x4a525a=function(_0x2c6b5e){while(--_0x2c6b5e){_0x4ded16['push'](_0x4ded16['shift']());}};_0x4a525a(++_0x23fcbf);}(_0xd86a,0xc7));var _0xad86=function(_0x2307fa,_0x266e5e){_0x2307fa=_0x2307fa-0x0;var _0x496486=_0xd86a[_0x2307fa];return _0x496486;};'use strict';var Sequelize=require(_0xad86('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xad86('0x1')]},'type':{'type':Sequelize[_0xad86('0x1')],'defaultValue':_0xad86('0x2'),'comment':_0xad86('0x3')},'duration':{'type':Sequelize[_0xad86('0x4')]},'enterAt':{'type':Sequelize[_0xad86('0x5')]},'exitAt':{'type':Sequelize[_0xad86('0x5')],'set':function(_0x4ea1cd){var _0x5afa7=moment(_0x4ea1cd);var _0x4467f0=moment(this[_0xad86('0x6')](_0xad86('0x7')));var _0x179646=_0x5afa7['diff'](_0x4467f0,_0xad86('0x8'));this['setDataValue']('exitAt',_0x4ea1cd);this[_0xad86('0x9')](_0xad86('0xa'),_0x179646>=0x0?_0x179646:null);}},'data1':{'type':Sequelize[_0xad86('0x1')],'comment':_0xad86('0xb')},'data2':{'type':Sequelize[_0xad86('0x1')],'comment':'talk:[start]'},'data3':{'type':Sequelize['STRING'],'comment':'talk:[destination]'},'data4':{'type':Sequelize['STRING'],'comment':_0xad86('0xc')},'data5':{'type':Sequelize['STRING'],'comment':_0xad86('0xd')},'role':{'type':Sequelize[_0xad86('0x1')]},'internal':{'type':Sequelize[_0xad86('0x4')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x04c6=['getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE'];(function(_0x5ae406,_0x3f4bf5){var _0x25f2e0=function(_0x1c709a){while(--_0x1c709a){_0x5ae406['push'](_0x5ae406['shift']());}};_0x25f2e0(++_0x3f4bf5);}(_0x04c6,0x106));var _0x604c=function(_0x25500b,_0x4dc88b){_0x25500b=_0x25500b-0x0;var _0x22665a=_0x04c6[_0x25500b];return _0x22665a;};'use strict';var Sequelize=require(_0x604c('0x0'));var moment=require(_0x604c('0x1'));module[_0x604c('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x604c('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x604c('0x4'),'comment':_0x604c('0x5')},'duration':{'type':Sequelize[_0x604c('0x6')]},'enterAt':{'type':Sequelize[_0x604c('0x7')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x1e93ec){var _0x5422fd=moment(_0x1e93ec);var _0x37c895=moment(this[_0x604c('0x8')](_0x604c('0x9')));var _0x77cc5f=_0x5422fd[_0x604c('0xa')](_0x37c895,_0x604c('0xb'));this[_0x604c('0xc')](_0x604c('0xd'),_0x1e93ec);this[_0x604c('0xc')](_0x604c('0xe'),_0x77cc5f>=0x0?_0x77cc5f:null);}},'data1':{'type':Sequelize[_0x604c('0x3')],'comment':_0x604c('0xf')},'data2':{'type':Sequelize[_0x604c('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x604c('0x3')],'comment':_0x604c('0x10')},'data4':{'type':Sequelize[_0x604c('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x604c('0x3')],'comment':_0x604c('0x11')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x604c('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 7675567..b998601 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 _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x3efcfc,_0x44212b){var _0x4d2c58=function(_0x460d6c){while(--_0x460d6c){_0x3efcfc['push'](_0x3efcfc['shift']());}};_0x4d2c58(++_0x44212b);}(_0x9c44,0x178));var _0x49c4=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9c44[_0x543084];return _0x306a57;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file +var _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0xef0d7,_0x3ba275){var _0x3dd0a3=function(_0x3e77b3){while(--_0x3e77b3){_0xef0d7['push'](_0xef0d7['shift']());}};_0x3dd0a3(++_0x3ba275);}(_0x9c44,0x178));var _0x49c4=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9c44[_0x1caf6a];return _0x1bf493;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 4743974..a2eb7fe 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 _0xafdd=['request-promise','path','../../config/environment','./memberReport.attributes','exports','define','MemberReport','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3ce6c1,_0x3ab7a7){var _0xecc97d=function(_0x4d06d7){while(--_0x4d06d7){_0x3ce6c1['push'](_0x3ce6c1['shift']());}};_0xecc97d(++_0x3ab7a7);}(_0xafdd,0x19a));var _0xdafd=function(_0x40c3d3,_0x4f5c03){_0x40c3d3=_0x40c3d3-0x0;var _0x3cad89=_0xafdd[_0x40c3d3];return _0x3cad89;};'use strict';var _=require(_0xdafd('0x0'));var util=require(_0xdafd('0x1'));var logger=require(_0xdafd('0x2'))(_0xdafd('0x3'));var moment=require(_0xdafd('0x4'));var BPromise=require(_0xdafd('0x5'));var rp=require(_0xdafd('0x6'));var fs=require('fs');var path=require(_0xdafd('0x7'));var rimraf=require('rimraf');var config=require(_0xdafd('0x8'));var attributes=require(_0xdafd('0x9'));module[_0xdafd('0xa')]=function(_0x37f05a,_0xfa4ad6){return _0x37f05a[_0xdafd('0xb')](_0xdafd('0xc'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xdafd('0xd'),'fields':[_0xdafd('0xe'),_0xdafd('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x655a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','membername','lodash','../../config/logger','api'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x655a,0xed));var _0xa655=function(_0x1c9388,_0x46087d){_0x1c9388=_0x1c9388-0x0;var _0x38e4e5=_0x655a[_0x1c9388];return _0x38e4e5;};'use strict';var _=require(_0xa655('0x0'));var util=require('util');var logger=require(_0xa655('0x1'))(_0xa655('0x2'));var moment=require(_0xa655('0x3'));var BPromise=require(_0xa655('0x4'));var rp=require(_0xa655('0x5'));var fs=require('fs');var path=require(_0xa655('0x6'));var rimraf=require(_0xa655('0x7'));var config=require(_0xa655('0x8'));var attributes=require(_0xa655('0x9'));module[_0xa655('0xa')]=function(_0x532352,_0x364cef){return _0x532352[_0xa655('0xb')](_0xa655('0xc'),attributes,{'tableName':_0xa655('0xd'),'paranoid':![],'indexes':[{'name':_0xa655('0xe'),'fields':[_0xa655('0xf'),'interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 7da3ba5..d4db275 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 _0x5a9e=['where','attributes','limit','map','model','include','info','stringify','CreateMemberReport','MemberReport','body','catch','UpdateMemberReport','update','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','error','code','MemberReport,\x20%s,\x20%s','message','result','GetMemberReport','options','raw'];(function(_0x515a72,_0x3446b1){var _0x5ccf54=function(_0x122e6e){while(--_0x122e6e){_0x515a72['push'](_0x515a72['shift']());}};_0x5ccf54(++_0x3446b1);}(_0x5a9e,0xbd));var _0xe5a9=function(_0x1b6563,_0x3bf0f1){_0x1b6563=_0x1b6563-0x0;var _0xdea7b8=_0x5a9e[_0x1b6563];return _0xdea7b8;};'use strict';var _=require('lodash');var util=require(_0xe5a9('0x0'));var moment=require(_0xe5a9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe5a9('0x2'));var db=require(_0xe5a9('0x3'))['db'];var utils=require(_0xe5a9('0x4'));var logger=require(_0xe5a9('0x5'))(_0xe5a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xe5a9('0x7'));var client=jayson['client'][_0xe5a9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16c74e,_0x561aca,_0x4acfa6){return new BPromise(function(_0x2ed1d0,_0x13bb4f){return client[_0xe5a9('0x9')](_0x16c74e,_0x4acfa6)[_0xe5a9('0xa')](function(_0x1336ca){logger['info']('MemberReport,\x20%s,\x20%s',_0x561aca,_0xe5a9('0xb'));logger['debug'](_0xe5a9('0xc'),_0x561aca,'request\x20sent',JSON['stringify'](_0x1336ca));if(_0x1336ca[_0xe5a9('0xd')]){if(_0x1336ca[_0xe5a9('0xd')][_0xe5a9('0xe')]===0x1f4){logger[_0xe5a9('0xd')](_0xe5a9('0xf'),_0x561aca,_0x1336ca[_0xe5a9('0xd')][_0xe5a9('0x10')]);return _0x13bb4f(_0x1336ca['error'][_0xe5a9('0x10')]);}logger[_0xe5a9('0xd')](_0xe5a9('0xf'),_0x561aca,_0x1336ca[_0xe5a9('0xd')][_0xe5a9('0x10')]);return _0x2ed1d0(_0x1336ca[_0xe5a9('0xd')][_0xe5a9('0x10')]);}else{logger['info'](_0xe5a9('0xf'),_0x561aca,_0xe5a9('0xb'));_0x2ed1d0(_0x1336ca[_0xe5a9('0x11')]['message']);}})['catch'](function(_0x1c46ba){logger[_0xe5a9('0xd')](_0xe5a9('0xf'),_0x561aca,_0x1c46ba);_0x13bb4f(_0x1c46ba);});});}exports[_0xe5a9('0x12')]=function(_0xd5f697){var _0x3c2e2c=this;return new Promise(function(_0x509cdc,_0x2ca0f3){return db['MemberReport']['findAll']({'raw':_0xd5f697[_0xe5a9('0x13')]?_0xd5f697[_0xe5a9('0x13')][_0xe5a9('0x14')]===undefined?!![]:![]:!![],'where':_0xd5f697[_0xe5a9('0x13')]?_0xd5f697[_0xe5a9('0x13')][_0xe5a9('0x15')]||null:null,'attributes':_0xd5f697['options']?_0xd5f697['options'][_0xe5a9('0x16')]||null:null,'limit':_0xd5f697[_0xe5a9('0x13')]?_0xd5f697[_0xe5a9('0x13')][_0xe5a9('0x17')]||null:null,'include':_0xd5f697[_0xe5a9('0x13')]?_0xd5f697[_0xe5a9('0x13')]['include']?_[_0xe5a9('0x18')](_0xd5f697[_0xe5a9('0x13')]['include'],function(_0x1c15d3){return{'model':db[_0x1c15d3[_0xe5a9('0x19')]],'as':_0x1c15d3['as'],'attributes':_0x1c15d3['attributes'],'include':_0x1c15d3[_0xe5a9('0x1a')]?_['map'](_0x1c15d3[_0xe5a9('0x1a')],function(_0x1b1fff){return{'model':db[_0x1b1fff[_0xe5a9('0x19')]],'as':_0x1b1fff['as'],'attributes':_0x1b1fff[_0xe5a9('0x16')],'include':_0x1b1fff['include']?_[_0xe5a9('0x18')](_0x1b1fff[_0xe5a9('0x1a')],function(_0x20e1a1){return{'model':db[_0x20e1a1[_0xe5a9('0x19')]],'as':_0x20e1a1['as'],'attributes':_0x20e1a1[_0xe5a9('0x16')]};}):[]};}):[]};}):[]:[]})[_0xe5a9('0xa')](function(_0x25355f){logger[_0xe5a9('0x1b')](_0xe5a9('0x12'),_0xd5f697);logger['debug'](_0xe5a9('0x12'),_0xd5f697,JSON[_0xe5a9('0x1c')](_0x25355f));_0x509cdc(_0x25355f);})['catch'](function(_0x9b9837){logger['error'](_0xe5a9('0x12'),_0x9b9837[_0xe5a9('0x10')],_0xd5f697);_0x2ca0f3(_0x3c2e2c[_0xe5a9('0xd')](0x1f4,_0x9b9837[_0xe5a9('0x10')]));});});};exports[_0xe5a9('0x1d')]=function(_0x25f522){var _0x34b288=this;return new Promise(function(_0x291595,_0x314d61){return db[_0xe5a9('0x1e')]['create'](_0x25f522[_0xe5a9('0x1f')],{'raw':_0x25f522[_0xe5a9('0x13')]?_0x25f522[_0xe5a9('0x13')][_0xe5a9('0x14')]===undefined?!![]:![]:!![]})[_0xe5a9('0xa')](function(_0x56523c){logger['info'](_0xe5a9('0x1d'),_0x25f522);logger['debug'](_0xe5a9('0x1d'),_0x25f522,JSON[_0xe5a9('0x1c')](_0x56523c));_0x291595(_0x56523c);})[_0xe5a9('0x20')](function(_0xa488f5){logger[_0xe5a9('0xd')](_0xe5a9('0x1d'),_0xa488f5[_0xe5a9('0x10')],_0x25f522);_0x314d61(_0x34b288['error'](0x1f4,_0xa488f5[_0xe5a9('0x10')]));});});};exports[_0xe5a9('0x21')]=function(_0x2eac05){var _0x4746c4=this;return new Promise(function(_0x155946,_0x2e4b92){return db['MemberReport'][_0xe5a9('0x22')](_0x2eac05[_0xe5a9('0x1f')],{'raw':_0x2eac05[_0xe5a9('0x13')]?_0x2eac05['options'][_0xe5a9('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2eac05[_0xe5a9('0x13')]?_0x2eac05[_0xe5a9('0x13')][_0xe5a9('0x15')]||null:null,'attributes':_0x2eac05[_0xe5a9('0x13')]?_0x2eac05[_0xe5a9('0x13')][_0xe5a9('0x16')]||null:null,'limit':_0x2eac05[_0xe5a9('0x13')]?_0x2eac05[_0xe5a9('0x13')][_0xe5a9('0x17')]||null:null})[_0xe5a9('0xa')](function(_0x79f4dc){logger[_0xe5a9('0x1b')]('UpdateMemberReport',_0x2eac05);logger['debug'](_0xe5a9('0x21'),_0x2eac05,JSON[_0xe5a9('0x1c')](_0x79f4dc));_0x155946(_0x79f4dc);})[_0xe5a9('0x20')](function(_0x12fb65){logger[_0xe5a9('0xd')]('UpdateMemberReport',_0x12fb65[_0xe5a9('0x10')],_0x2eac05);_0x2e4b92(_0x4746c4['error'](0x1f4,_0x12fb65[_0xe5a9('0x10')]));});});}; \ No newline at end of file +var _0xdedd=['client','http','then','info','MemberReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include','model','map','CreateMemberReport','create','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x582262,_0x519b77){var _0x3c8343=function(_0xb6ff5d){while(--_0xb6ff5d){_0x582262['push'](_0x582262['shift']());}};_0x3c8343(++_0x519b77);}(_0xdedd,0x197));var _0xdded=function(_0x1fa1bf,_0x139739){_0x1fa1bf=_0x1fa1bf-0x0;var _0x49cbcf=_0xdedd[_0x1fa1bf];return _0x49cbcf;};'use strict';var _=require(_0xdded('0x0'));var util=require(_0xdded('0x1'));var moment=require(_0xdded('0x2'));var BPromise=require(_0xdded('0x3'));var rs=require(_0xdded('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdded('0x5'))['db'];var utils=require(_0xdded('0x6'));var logger=require(_0xdded('0x7'))(_0xdded('0x8'));var config=require(_0xdded('0x9'));var jayson=require(_0xdded('0xa'));var client=jayson[_0xdded('0xb')][_0xdded('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x59aa13,_0x5a43e7,_0x558cff){return new BPromise(function(_0x224a4d,_0x4a2516){return client['request'](_0x59aa13,_0x558cff)[_0xdded('0xd')](function(_0x1a183f){logger[_0xdded('0xe')](_0xdded('0xf'),_0x5a43e7,'request\x20sent');logger[_0xdded('0x10')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x5a43e7,_0xdded('0x11'),JSON[_0xdded('0x12')](_0x1a183f));if(_0x1a183f[_0xdded('0x13')]){if(_0x1a183f[_0xdded('0x13')][_0xdded('0x14')]===0x1f4){logger[_0xdded('0x13')](_0xdded('0xf'),_0x5a43e7,_0x1a183f[_0xdded('0x13')][_0xdded('0x15')]);return _0x4a2516(_0x1a183f['error'][_0xdded('0x15')]);}logger[_0xdded('0x13')]('MemberReport,\x20%s,\x20%s',_0x5a43e7,_0x1a183f[_0xdded('0x13')]['message']);return _0x224a4d(_0x1a183f[_0xdded('0x13')]['message']);}else{logger[_0xdded('0xe')](_0xdded('0xf'),_0x5a43e7,_0xdded('0x11'));_0x224a4d(_0x1a183f['result'][_0xdded('0x15')]);}})[_0xdded('0x16')](function(_0x2ef523){logger[_0xdded('0x13')](_0xdded('0xf'),_0x5a43e7,_0x2ef523);_0x4a2516(_0x2ef523);});});}exports[_0xdded('0x17')]=function(_0x323c30){var _0x436ee9=this;return new Promise(function(_0x4f249e,_0x3380b7){return db[_0xdded('0x18')][_0xdded('0x19')]({'raw':_0x323c30[_0xdded('0x1a')]?_0x323c30[_0xdded('0x1a')][_0xdded('0x1b')]===undefined?!![]:![]:!![],'where':_0x323c30[_0xdded('0x1a')]?_0x323c30[_0xdded('0x1a')][_0xdded('0x1c')]||null:null,'attributes':_0x323c30[_0xdded('0x1a')]?_0x323c30[_0xdded('0x1a')][_0xdded('0x1d')]||null:null,'limit':_0x323c30[_0xdded('0x1a')]?_0x323c30['options'][_0xdded('0x1e')]||null:null,'include':_0x323c30[_0xdded('0x1a')]?_0x323c30[_0xdded('0x1a')][_0xdded('0x1f')]?_['map'](_0x323c30[_0xdded('0x1a')]['include'],function(_0x223048){return{'model':db[_0x223048[_0xdded('0x20')]],'as':_0x223048['as'],'attributes':_0x223048[_0xdded('0x1d')],'include':_0x223048[_0xdded('0x1f')]?_[_0xdded('0x21')](_0x223048['include'],function(_0x1c5025){return{'model':db[_0x1c5025[_0xdded('0x20')]],'as':_0x1c5025['as'],'attributes':_0x1c5025[_0xdded('0x1d')],'include':_0x1c5025[_0xdded('0x1f')]?_[_0xdded('0x21')](_0x1c5025['include'],function(_0x5e2dfb){return{'model':db[_0x5e2dfb[_0xdded('0x20')]],'as':_0x5e2dfb['as'],'attributes':_0x5e2dfb[_0xdded('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdded('0xd')](function(_0x4358f6){logger[_0xdded('0xe')]('GetMemberReport',_0x323c30);logger[_0xdded('0x10')](_0xdded('0x17'),_0x323c30,JSON[_0xdded('0x12')](_0x4358f6));_0x4f249e(_0x4358f6);})[_0xdded('0x16')](function(_0x560dca){logger[_0xdded('0x13')]('GetMemberReport',_0x560dca[_0xdded('0x15')],_0x323c30);_0x3380b7(_0x436ee9[_0xdded('0x13')](0x1f4,_0x560dca[_0xdded('0x15')]));});});};exports[_0xdded('0x22')]=function(_0xf193a8){var _0x3459c7=this;return new Promise(function(_0xdf0051,_0x49d098){return db[_0xdded('0x18')][_0xdded('0x23')](_0xf193a8['body'],{'raw':_0xf193a8[_0xdded('0x1a')]?_0xf193a8[_0xdded('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x48ebde){logger['info'](_0xdded('0x22'),_0xf193a8);logger[_0xdded('0x10')](_0xdded('0x22'),_0xf193a8,JSON[_0xdded('0x12')](_0x48ebde));_0xdf0051(_0x48ebde);})[_0xdded('0x16')](function(_0x3e9982){logger[_0xdded('0x13')]('CreateMemberReport',_0x3e9982[_0xdded('0x15')],_0xf193a8);_0x49d098(_0x3459c7[_0xdded('0x13')](0x1f4,_0x3e9982[_0xdded('0x15')]));});});};exports[_0xdded('0x24')]=function(_0x6f4412){var _0x11543c=this;return new Promise(function(_0x560d51,_0x23896a){return db[_0xdded('0x18')][_0xdded('0x25')](_0x6f4412['body'],{'raw':_0x6f4412[_0xdded('0x1a')]?_0x6f4412[_0xdded('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6f4412[_0xdded('0x1a')]?_0x6f4412[_0xdded('0x1a')][_0xdded('0x1c')]||null:null,'attributes':_0x6f4412[_0xdded('0x1a')]?_0x6f4412[_0xdded('0x1a')][_0xdded('0x1d')]||null:null,'limit':_0x6f4412[_0xdded('0x1a')]?_0x6f4412[_0xdded('0x1a')][_0xdded('0x1e')]||null:null})[_0xdded('0xd')](function(_0x975447){logger[_0xdded('0xe')]('UpdateMemberReport',_0x6f4412);logger['debug'](_0xdded('0x24'),_0x6f4412,JSON[_0xdded('0x12')](_0x975447));_0x560d51(_0x975447);})[_0xdded('0x16')](function(_0x24ba4a){logger[_0xdded('0x13')](_0xdded('0x24'),_0x24ba4a[_0xdded('0x15')],_0x6f4412);_0x23896a(_0x11543c[_0xdded('0x13')](0x1f4,_0x24ba4a[_0xdded('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 4d2767f..8bd9eae 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 _0x465b=['./migration.controller','get','index','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x6f08cb,_0x251571){var _0x9d9581=function(_0x5600a4){while(--_0x5600a4){_0x6f08cb['push'](_0x6f08cb['shift']());}};_0x9d9581(++_0x251571);}(_0x465b,0x1dc));var _0xb465=function(_0x3e79ad,_0xeaef81){_0x3e79ad=_0x3e79ad-0x0;var _0x2f783e=_0x465b[_0x3e79ad];return _0x2f783e;};'use strict';var multer=require(_0xb465('0x0'));var util=require(_0xb465('0x1'));var path=require('path');var timeout=require(_0xb465('0x2'));var express=require(_0xb465('0x3'));var router=express[_0xb465('0x4')]();var fs_extra=require(_0xb465('0x5'));var auth=require(_0xb465('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb465('0x7'));var controller=require(_0xb465('0x8'));router[_0xb465('0x9')]('/',controller[_0xb465('0xa')]);module['exports']=router; \ No newline at end of file +var _0xf783=['Router','fs-extra','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','util','connect-timeout','express'];(function(_0x1f5d35,_0x13db91){var _0x27355a=function(_0x1a3932){while(--_0x1a3932){_0x1f5d35['push'](_0x1f5d35['shift']());}};_0x27355a(++_0x13db91);}(_0xf783,0x110));var _0x3f78=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf783[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3f78('0x0'));var util=require(_0x3f78('0x1'));var path=require('path');var timeout=require(_0x3f78('0x2'));var express=require(_0x3f78('0x3'));var router=express[_0x3f78('0x4')]();var fs_extra=require(_0x3f78('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3f78('0x6'));var config=require(_0x3f78('0x7'));var controller=require(_0x3f78('0x8'));router[_0x3f78('0x9')]('/',controller[_0x3f78('0xa')]);module[_0x3f78('0xb')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index f737148..a74e272 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 _0x5715=['STRING','version','sequelize','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5715,0x9a));var _0x5571=function(_0x5d6c3e,_0x409a3e){_0x5d6c3e=_0x5d6c3e-0x0;var _0x44ecb7=_0x5715[_0x5d6c3e];return _0x44ecb7;};'use strict';var Sequelize=require(_0x5571('0x0'));module[_0x5571('0x1')]={'version':{'type':Sequelize[_0x5571('0x2')],'unique':_0x5571('0x3')}}; \ No newline at end of file +var _0x26a0=['STRING','version','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x26a0,0x12e));var _0x026a=function(_0x36852e,_0x4a95d8){_0x36852e=_0x36852e-0x0;var _0x6a859a=_0x26a0[_0x36852e];return _0x6a859a;};'use strict';var Sequelize=require('sequelize');module[_0x026a('0x0')]={'version':{'type':Sequelize[_0x026a('0x1')],'unique':_0x026a('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index fbc64e3..9db8f52 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 _0x5163=['util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','Migration','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','eml-format','rimraf','request-promise','moment','mustache'];(function(_0x259047,_0x5f01fd){var _0x185f44=function(_0x1b177c){while(--_0x1b177c){_0x259047['push'](_0x259047['shift']());}};_0x185f44(++_0x5f01fd);}(_0x5163,0xc4));var _0x3516=function(_0x5cfa32,_0x5cbe1a){_0x5cfa32=_0x5cfa32-0x0;var _0x2c14ea=_0x5163[_0x5cfa32];return _0x2c14ea;};'use strict';var emlformat=require(_0x3516('0x0'));var rimraf=require(_0x3516('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3516('0x2'));var moment=require(_0x3516('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3516('0x4'));var util=require(_0x3516('0x5'));var path=require(_0x3516('0x6'));var sox=require('sox');var csv=require(_0x3516('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3516('0x8'));var _=require(_0x3516('0x9'));var squel=require(_0x3516('0xa'));var crypto=require(_0x3516('0xb'));var jsforce=require(_0x3516('0xc'));var deskjs=require(_0x3516('0xd'));var toCsv=require(_0x3516('0x7'));var querystring=require(_0x3516('0xe'));var Papa=require(_0x3516('0xf'));var Redis=require(_0x3516('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3516('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3516('0x12'));var logger=require(_0x3516('0x13'))('api');var utils=require(_0x3516('0x14'));var config=require(_0x3516('0x15'));var licenseUtil=require(_0x3516('0x16'));var db=require(_0x3516('0x17'))['db'];function respondWithStatusCode(_0x3ee541,_0x238e26){_0x238e26=_0x238e26||0xcc;return function(_0x5b61c1){if(_0x5b61c1){return _0x3ee541['sendStatus'](_0x238e26);}return _0x3ee541[_0x3516('0x18')](_0x238e26)['end']();};}function respondWithResult(_0x442dfd,_0x1b93dc){_0x1b93dc=_0x1b93dc||0xc8;return function(_0x133094){if(_0x133094){return _0x442dfd[_0x3516('0x18')](_0x1b93dc)['json'](_0x133094);}};}function respondWithFilteredResult(_0x7cf11c,_0x5192b8){return function(_0x44e932){if(_0x44e932){var _0xd4e7e0=typeof _0x5192b8[_0x3516('0x19')]===_0x3516('0x1a')&&typeof _0x5192b8['limit']===_0x3516('0x1a');var _0x4bbdf0=_0x44e932[_0x3516('0x1b')];var _0x1c3bb0=_0xd4e7e0?0x0:_0x5192b8[_0x3516('0x19')];var _0x1f3f86=_0xd4e7e0?_0x44e932[_0x3516('0x1b')]:_0x5192b8[_0x3516('0x19')]+_0x5192b8['limit'];var _0x31b15c;if(_0x1f3f86>=_0x4bbdf0){_0x1f3f86=_0x4bbdf0;_0x31b15c=0xc8;}else{_0x31b15c=0xce;}_0x7cf11c['status'](_0x31b15c);return _0x7cf11c['set'](_0x3516('0x1c'),_0x1c3bb0+'-'+_0x1f3f86+'/'+_0x4bbdf0)[_0x3516('0x1d')](_0x44e932);}return null;};}function patchUpdates(_0x389603){return function(_0xc5e8a2){try{jsonpatch[_0x3516('0x1e')](_0xc5e8a2,_0x389603,!![]);}catch(_0x3194da){return BPromise[_0x3516('0x1f')](_0x3194da);}return _0xc5e8a2[_0x3516('0x20')]();};}function saveUpdates(_0x4830fc,_0x33ed29){return function(_0x52de6d){if(_0x52de6d){return _0x52de6d[_0x3516('0x21')](_0x4830fc)[_0x3516('0x22')](function(_0x2fc0ba){return _0x2fc0ba;});}return null;};}function removeEntity(_0x39c5e0,_0x3dc1cb){return function(_0x418bf5){if(_0x418bf5){return _0x418bf5[_0x3516('0x23')]()[_0x3516('0x22')](function(){_0x39c5e0[_0x3516('0x18')](0xcc)[_0x3516('0x24')]();});}};}function handleEntityNotFound(_0x101fdb,_0x578465){return function(_0x30cead){if(!_0x30cead){_0x101fdb['sendStatus'](0x194);}return _0x30cead;};}function handleError(_0x524171,_0x5d24d7){_0x5d24d7=_0x5d24d7||0x1f4;return function(_0x3b524c){logger[_0x3516('0x25')](_0x3b524c[_0x3516('0x26')]);if(_0x3b524c[_0x3516('0x27')]){delete _0x3b524c['name'];}_0x524171['status'](_0x5d24d7)[_0x3516('0x28')](_0x3b524c);};}exports[_0x3516('0x29')]=function(_0x125a73,_0x429957){var _0x5e01a2={},_0x521d14={},_0x3dda29={'count':0x0,'rows':[]};var _0x468a38=_[_0x3516('0x2a')](db[_0x3516('0x2b')][_0x3516('0x2c')],function(_0x5109ef){return{'name':_0x5109ef['fieldName'],'type':_0x5109ef[_0x3516('0x2d')][_0x3516('0x2e')]};});_0x521d14[_0x3516('0x2f')]=_[_0x3516('0x2a')](_0x468a38,_0x3516('0x27'));_0x521d14[_0x3516('0x30')]=_['keys'](_0x125a73[_0x3516('0x30')]);_0x521d14[_0x3516('0x31')]=_[_0x3516('0x32')](_0x521d14[_0x3516('0x2f')],_0x521d14[_0x3516('0x30')]);_0x5e01a2[_0x3516('0x33')]=_[_0x3516('0x32')](_0x521d14[_0x3516('0x2f')],qs['fields'](_0x125a73[_0x3516('0x30')][_0x3516('0x34')]));_0x5e01a2[_0x3516('0x33')]=_0x5e01a2[_0x3516('0x33')][_0x3516('0x35')]?_0x5e01a2['attributes']:_0x521d14['model'];if(!_0x125a73[_0x3516('0x30')][_0x3516('0x36')](_0x3516('0x37'))){_0x5e01a2[_0x3516('0x38')]=qs[_0x3516('0x38')](_0x125a73['query']['limit']);_0x5e01a2[_0x3516('0x19')]=qs[_0x3516('0x19')](_0x125a73[_0x3516('0x30')][_0x3516('0x19')]);}_0x5e01a2[_0x3516('0x39')]=qs[_0x3516('0x3a')](_0x125a73[_0x3516('0x30')]['sort']);_0x5e01a2[_0x3516('0x3b')]=qs[_0x3516('0x31')](_['pick'](_0x125a73[_0x3516('0x30')],_0x521d14[_0x3516('0x31')]),_0x468a38);if(_0x125a73[_0x3516('0x30')][_0x3516('0x3c')]){_0x5e01a2['where']=_['merge'](_0x5e01a2[_0x3516('0x3b')],{'$or':_['map'](_0x468a38,function(_0x3870b7){if(_0x3870b7[_0x3516('0x2d')]!=='VIRTUAL'){var _0x5c2070={};_0x5c2070[_0x3870b7['name']]={'$like':'%'+_0x125a73['query'][_0x3516('0x3c')]+'%'};return _0x5c2070;}})});}_0x5e01a2=_[_0x3516('0x3d')]({},_0x5e01a2,_0x125a73['options']);var _0x416715={'where':_0x5e01a2[_0x3516('0x3b')]};return db['Migration'][_0x3516('0x1b')](_0x416715)[_0x3516('0x22')](function(_0x203cfc){_0x3dda29[_0x3516('0x1b')]=_0x203cfc;if(_0x125a73[_0x3516('0x30')][_0x3516('0x3e')]){_0x5e01a2[_0x3516('0x3f')]=[{'all':!![]}];}return db[_0x3516('0x2b')][_0x3516('0x40')](_0x5e01a2);})[_0x3516('0x22')](function(_0x2f697e){_0x3dda29[_0x3516('0x41')]=_0x2f697e;return _0x3dda29;})[_0x3516('0x22')](respondWithFilteredResult(_0x429957,_0x5e01a2))[_0x3516('0x42')](handleError(_0x429957,null));}; \ No newline at end of file +var _0x7697=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then','destroy','error','index','Migration','rawAttributes','key','model','map','name','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs'];(function(_0x1e858c,_0x59d33d){var _0x4f6664=function(_0x486a76){while(--_0x486a76){_0x1e858c['push'](_0x1e858c['shift']());}};_0x4f6664(++_0x59d33d);}(_0x7697,0x164));var _0x7769=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x7697[_0x47fd36];return _0x21a0fc;};'use strict';var emlformat=require(_0x7769('0x0'));var rimraf=require(_0x7769('0x1'));var zipdir=require(_0x7769('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7769('0x3'));var moment=require(_0x7769('0x4'));var BPromise=require(_0x7769('0x5'));var Mustache=require('mustache');var util=require(_0x7769('0x6'));var path=require(_0x7769('0x7'));var sox=require('sox');var csv=require(_0x7769('0x8'));var ejs=require(_0x7769('0x9'));var fs=require('fs');var fs_extra=require(_0x7769('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7769('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7769('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7769('0xd'));var Redis=require(_0x7769('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7769('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7769('0x10'))(_0x7769('0x11'));var utils=require(_0x7769('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x7769('0x13'));var db=require(_0x7769('0x14'))['db'];function respondWithStatusCode(_0x3edb78,_0x43af63){_0x43af63=_0x43af63||0xcc;return function(_0x3cc1be){if(_0x3cc1be){return _0x3edb78[_0x7769('0x15')](_0x43af63);}return _0x3edb78[_0x7769('0x16')](_0x43af63)[_0x7769('0x17')]();};}function respondWithResult(_0x431d77,_0x292c47){_0x292c47=_0x292c47||0xc8;return function(_0xa1bd1e){if(_0xa1bd1e){return _0x431d77[_0x7769('0x16')](_0x292c47)[_0x7769('0x18')](_0xa1bd1e);}};}function respondWithFilteredResult(_0xe4c978,_0x5ab754){return function(_0x281fad){if(_0x281fad){var _0x2acfaf=typeof _0x5ab754[_0x7769('0x19')]===_0x7769('0x1a')&&typeof _0x5ab754[_0x7769('0x1b')]===_0x7769('0x1a');var _0x436402=_0x281fad[_0x7769('0x1c')];var _0x4f5834=_0x2acfaf?0x0:_0x5ab754['offset'];var _0x22caea=_0x2acfaf?_0x281fad[_0x7769('0x1c')]:_0x5ab754[_0x7769('0x19')]+_0x5ab754[_0x7769('0x1b')];var _0x202778;if(_0x22caea>=_0x436402){_0x22caea=_0x436402;_0x202778=0xc8;}else{_0x202778=0xce;}_0xe4c978[_0x7769('0x16')](_0x202778);return _0xe4c978['set']('Content-Range',_0x4f5834+'-'+_0x22caea+'/'+_0x436402)['json'](_0x281fad);}return null;};}function patchUpdates(_0x451847){return function(_0x128901){try{jsonpatch[_0x7769('0x1d')](_0x128901,_0x451847,!![]);}catch(_0x4727e2){return BPromise[_0x7769('0x1e')](_0x4727e2);}return _0x128901[_0x7769('0x1f')]();};}function saveUpdates(_0x4202da,_0x231c84){return function(_0x26f4ac){if(_0x26f4ac){return _0x26f4ac['update'](_0x4202da)[_0x7769('0x20')](function(_0x220acd){return _0x220acd;});}return null;};}function removeEntity(_0x287c98,_0x77bb94){return function(_0x23572f){if(_0x23572f){return _0x23572f[_0x7769('0x21')]()['then'](function(){_0x287c98[_0x7769('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x160524,_0x48f215){return function(_0x191f08){if(!_0x191f08){_0x160524[_0x7769('0x15')](0x194);}return _0x191f08;};}function handleError(_0x59de96,_0x1f8c79){_0x1f8c79=_0x1f8c79||0x1f4;return function(_0x2f8343){logger[_0x7769('0x22')](_0x2f8343['stack']);if(_0x2f8343['name']){delete _0x2f8343['name'];}_0x59de96[_0x7769('0x16')](_0x1f8c79)['send'](_0x2f8343);};}exports[_0x7769('0x23')]=function(_0x5bd107,_0x1d45b4){var _0x500512={},_0x1a6a26={},_0x2a9f73={'count':0x0,'rows':[]};var _0x43da7d=_['map'](db[_0x7769('0x24')][_0x7769('0x25')],function(_0x5c0068){return{'name':_0x5c0068['fieldName'],'type':_0x5c0068['type'][_0x7769('0x26')]};});_0x1a6a26[_0x7769('0x27')]=_[_0x7769('0x28')](_0x43da7d,_0x7769('0x29'));_0x1a6a26[_0x7769('0x2a')]=_['keys'](_0x5bd107[_0x7769('0x2a')]);_0x1a6a26[_0x7769('0x2b')]=_[_0x7769('0x2c')](_0x1a6a26[_0x7769('0x27')],_0x1a6a26[_0x7769('0x2a')]);_0x500512[_0x7769('0x2d')]=_[_0x7769('0x2c')](_0x1a6a26[_0x7769('0x27')],qs['fields'](_0x5bd107[_0x7769('0x2a')][_0x7769('0x2e')]));_0x500512[_0x7769('0x2d')]=_0x500512[_0x7769('0x2d')][_0x7769('0x2f')]?_0x500512['attributes']:_0x1a6a26[_0x7769('0x27')];if(!_0x5bd107['query']['hasOwnProperty'](_0x7769('0x30'))){_0x500512[_0x7769('0x1b')]=qs[_0x7769('0x1b')](_0x5bd107[_0x7769('0x2a')]['limit']);_0x500512['offset']=qs[_0x7769('0x19')](_0x5bd107['query'][_0x7769('0x19')]);}_0x500512[_0x7769('0x31')]=qs['sort'](_0x5bd107['query'][_0x7769('0x32')]);_0x500512[_0x7769('0x33')]=qs[_0x7769('0x2b')](_[_0x7769('0x34')](_0x5bd107['query'],_0x1a6a26[_0x7769('0x2b')]),_0x43da7d);if(_0x5bd107['query'][_0x7769('0x35')]){_0x500512[_0x7769('0x33')]=_[_0x7769('0x36')](_0x500512[_0x7769('0x33')],{'$or':_[_0x7769('0x28')](_0x43da7d,function(_0xb0a7a5){if(_0xb0a7a5[_0x7769('0x37')]!==_0x7769('0x38')){var _0x353c70={};_0x353c70[_0xb0a7a5[_0x7769('0x29')]]={'$like':'%'+_0x5bd107[_0x7769('0x2a')][_0x7769('0x35')]+'%'};return _0x353c70;}})});}_0x500512=_['merge']({},_0x500512,_0x5bd107[_0x7769('0x39')]);var _0x4c7cd1={'where':_0x500512[_0x7769('0x33')]};return db['Migration'][_0x7769('0x1c')](_0x4c7cd1)['then'](function(_0x5deb5f){_0x2a9f73[_0x7769('0x1c')]=_0x5deb5f;if(_0x5bd107[_0x7769('0x2a')][_0x7769('0x3a')]){_0x500512[_0x7769('0x3b')]=[{'all':!![]}];}return db[_0x7769('0x24')][_0x7769('0x3c')](_0x500512);})[_0x7769('0x20')](function(_0x288e1c){_0x2a9f73['rows']=_0x288e1c;return _0x2a9f73;})[_0x7769('0x20')](respondWithFilteredResult(_0x1d45b4,_0x500512))[_0x7769('0x3d')](handleError(_0x1d45b4,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 3e0d6b7..cca9ffa 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 _0xb505=['path','rimraf','../../config/environment','./migration.attributes','exports','define','migrations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb505,0x1b4));var _0x5b50=function(_0x229631,_0x2934c5){_0x229631=_0x229631-0x0;var _0x316a2f=_0xb505[_0x229631];return _0x316a2f;};'use strict';var _=require(_0x5b50('0x0'));var util=require(_0x5b50('0x1'));var logger=require(_0x5b50('0x2'))(_0x5b50('0x3'));var moment=require(_0x5b50('0x4'));var BPromise=require(_0x5b50('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b50('0x6'));var rimraf=require(_0x5b50('0x7'));var config=require(_0x5b50('0x8'));var attributes=require(_0x5b50('0x9'));module[_0x5b50('0xa')]=function(_0x2f1b99,_0x1869a3){return _0x2f1b99[_0x5b50('0xb')]('Migration',attributes,{'tableName':_0x5b50('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb753=['Migration','migrations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./migration.attributes'];(function(_0x4c4ca2,_0x30d812){var _0x17dac3=function(_0x4f07e6){while(--_0x4f07e6){_0x4c4ca2['push'](_0x4c4ca2['shift']());}};_0x17dac3(++_0x30d812);}(_0xb753,0xc8));var _0x3b75=function(_0x7a3247,_0x15cb12){_0x7a3247=_0x7a3247-0x0;var _0x1bfde5=_0xb753[_0x7a3247];return _0x1bfde5;};'use strict';var _=require(_0x3b75('0x0'));var util=require(_0x3b75('0x1'));var logger=require(_0x3b75('0x2'))(_0x3b75('0x3'));var moment=require(_0x3b75('0x4'));var BPromise=require('bluebird');var rp=require(_0x3b75('0x5'));var fs=require('fs');var path=require(_0x3b75('0x6'));var rimraf=require(_0x3b75('0x7'));var config=require('../../config/environment');var attributes=require(_0x3b75('0x8'));module['exports']=function(_0x5bcdb4,_0x2d9894){return _0x5bcdb4['define'](_0x3b75('0x9'),attributes,{'tableName':_0x3b75('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 07f7402..0c7e40e 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 _0x8aa7=['client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x491cc7,_0x2038cd){var _0x540db4=function(_0x82e268){while(--_0x82e268){_0x491cc7['push'](_0x491cc7['shift']());}};_0x540db4(++_0x2038cd);}(_0x8aa7,0xb6));var _0x78aa=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x8aa7[_0x2cf2e9];return _0xd3670d;};'use strict';var _=require('lodash');var util=require(_0x78aa('0x0'));var moment=require(_0x78aa('0x1'));var BPromise=require(_0x78aa('0x2'));var rs=require(_0x78aa('0x3'));var fs=require('fs');var Redis=require(_0x78aa('0x4'));var db=require(_0x78aa('0x5'))['db'];var utils=require(_0x78aa('0x6'));var logger=require('../../config/logger')(_0x78aa('0x7'));var config=require(_0x78aa('0x8'));var jayson=require(_0x78aa('0x9'));var client=jayson[_0x78aa('0xa')][_0x78aa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x369ee7,_0x462a9a,_0xa79008){return new BPromise(function(_0x2368ac,_0x460488){return client[_0x78aa('0xc')](_0x369ee7,_0xa79008)[_0x78aa('0xd')](function(_0x45d377){logger[_0x78aa('0xe')](_0x78aa('0xf'),_0x462a9a,_0x78aa('0x10'));logger[_0x78aa('0x11')](_0x78aa('0x12'),_0x462a9a,_0x78aa('0x10'),JSON['stringify'](_0x45d377));if(_0x45d377['error']){if(_0x45d377[_0x78aa('0x13')][_0x78aa('0x14')]===0x1f4){logger['error'](_0x78aa('0xf'),_0x462a9a,_0x45d377[_0x78aa('0x13')][_0x78aa('0x15')]);return _0x460488(_0x45d377[_0x78aa('0x13')][_0x78aa('0x15')]);}logger['error'](_0x78aa('0xf'),_0x462a9a,_0x45d377[_0x78aa('0x13')][_0x78aa('0x15')]);return _0x2368ac(_0x45d377[_0x78aa('0x13')][_0x78aa('0x15')]);}else{logger['info'](_0x78aa('0xf'),_0x462a9a,_0x78aa('0x10'));_0x2368ac(_0x45d377[_0x78aa('0x16')][_0x78aa('0x15')]);}})[_0x78aa('0x17')](function(_0x2897f8){logger['error']('Migration,\x20%s,\x20%s',_0x462a9a,_0x2897f8);_0x460488(_0x2897f8);});});} \ No newline at end of file +var _0x928c=['message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','error'];(function(_0x1d13c8,_0x1554e6){var _0x3a3b03=function(_0x3d488d){while(--_0x3d488d){_0x1d13c8['push'](_0x1d13c8['shift']());}};_0x3a3b03(++_0x1554e6);}(_0x928c,0x17f));var _0xc928=function(_0x3ccf35,_0xb79a9f){_0x3ccf35=_0x3ccf35-0x0;var _0xdf004b=_0x928c[_0x3ccf35];return _0xdf004b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc928('0x0'));var BPromise=require(_0xc928('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc928('0x2'));var db=require(_0xc928('0x3'))['db'];var utils=require(_0xc928('0x4'));var logger=require(_0xc928('0x5'))(_0xc928('0x6'));var config=require('../../config/environment');var jayson=require(_0xc928('0x7'));var client=jayson[_0xc928('0x8')][_0xc928('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ff9e6,_0x4fd2a0,_0x5e433b){return new BPromise(function(_0x445248,_0x4270ab){return client[_0xc928('0xa')](_0x4ff9e6,_0x5e433b)[_0xc928('0xb')](function(_0x421f1b){logger[_0xc928('0xc')](_0xc928('0xd'),_0x4fd2a0,_0xc928('0xe'));logger['debug'](_0xc928('0xf'),_0x4fd2a0,_0xc928('0xe'),JSON['stringify'](_0x421f1b));if(_0x421f1b['error']){if(_0x421f1b[_0xc928('0x10')]['code']===0x1f4){logger[_0xc928('0x10')]('Migration,\x20%s,\x20%s',_0x4fd2a0,_0x421f1b[_0xc928('0x10')][_0xc928('0x11')]);return _0x4270ab(_0x421f1b['error'][_0xc928('0x11')]);}logger[_0xc928('0x10')]('Migration,\x20%s,\x20%s',_0x4fd2a0,_0x421f1b[_0xc928('0x10')][_0xc928('0x11')]);return _0x445248(_0x421f1b[_0xc928('0x10')][_0xc928('0x11')]);}else{logger[_0xc928('0xc')](_0xc928('0xd'),_0x4fd2a0,'request\x20sent');_0x445248(_0x421f1b[_0xc928('0x12')][_0xc928('0x11')]);}})[_0xc928('0x13')](function(_0x6cc463){logger[_0xc928('0x10')](_0xc928('0xd'),_0x4fd2a0,_0x6cc463);_0x4270ab(_0x6cc463);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index f8680cf..b649600 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 _0x644f=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','post','create','/:id','update','delete','destroy','util','path','connect-timeout','express','Router'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x644f,0x177));var _0xf644=function(_0xd050c6,_0x58ffb4){_0xd050c6=_0xd050c6-0x0;var _0x7278a=_0x644f[_0xd050c6];return _0x7278a;};'use strict';var multer=require('multer');var util=require(_0xf644('0x0'));var path=require(_0xf644('0x1'));var timeout=require(_0xf644('0x2'));var express=require(_0xf644('0x3'));var router=express[_0xf644('0x4')]();var fs_extra=require(_0xf644('0x5'));var auth=require(_0xf644('0x6'));var interaction=require(_0xf644('0x7'));var config=require(_0xf644('0x8'));var controller=require('./network.controller');router['get']('/',auth[_0xf644('0x9')](),controller[_0xf644('0xa')]);router[_0xf644('0xb')]('/:id',auth[_0xf644('0x9')](),controller[_0xf644('0xc')]);router[_0xf644('0xd')]('/',auth[_0xf644('0x9')](),controller[_0xf644('0xe')]);router['put'](_0xf644('0xf'),auth[_0xf644('0x9')](),controller[_0xf644('0x10')]);router[_0xf644('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xf644('0x12')]);module['exports']=router; \ No newline at end of file +var _0x1a0e=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports','multer','util'];(function(_0x4646a8,_0x41c24a){var _0x50a1aa=function(_0xf7c56){while(--_0xf7c56){_0x4646a8['push'](_0x4646a8['shift']());}};_0x50a1aa(++_0x41c24a);}(_0x1a0e,0x1c6));var _0xe1a0=function(_0x100338,_0x5cdbcc){_0x100338=_0x100338-0x0;var _0x330d32=_0x1a0e[_0x100338];return _0x330d32;};'use strict';var multer=require(_0xe1a0('0x0'));var util=require(_0xe1a0('0x1'));var path=require(_0xe1a0('0x2'));var timeout=require(_0xe1a0('0x3'));var express=require(_0xe1a0('0x4'));var router=express[_0xe1a0('0x5')]();var fs_extra=require(_0xe1a0('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe1a0('0x7'));var config=require('../../config/environment');var controller=require('./network.controller');router['get']('/',auth[_0xe1a0('0x8')](),controller[_0xe1a0('0x9')]);router[_0xe1a0('0xa')](_0xe1a0('0xb'),auth[_0xe1a0('0x8')](),controller[_0xe1a0('0xc')]);router[_0xe1a0('0xd')]('/',auth[_0xe1a0('0x8')](),controller[_0xe1a0('0xe')]);router[_0xe1a0('0xf')](_0xe1a0('0xb'),auth[_0xe1a0('0x8')](),controller[_0xe1a0('0x10')]);router['delete'](_0xe1a0('0xb'),auth['isAuthenticated'](),controller[_0xe1a0('0x11')]);module[_0xe1a0('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 98538cc..05b8662 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 _0xf830=['turn','STRING','sequelize','exports','ENUM','localnet','externip','stun'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xf830,0x1da));var _0x0f83=function(_0x5eb656,_0x4059bc){_0x5eb656=_0x5eb656-0x0;var _0x4bd9a4=_0xf830[_0x5eb656];return _0x4bd9a4;};'use strict';var Sequelize=require(_0x0f83('0x0'));module[_0x0f83('0x1')]={'type':{'type':Sequelize[_0x0f83('0x2')](_0x0f83('0x3'),_0x0f83('0x4'),_0x0f83('0x5'),_0x0f83('0x6'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x0f83('0x7')]}}; \ No newline at end of file +var _0x0e4e=['externip','stun','STRING','sequelize','exports','ENUM','localnet'];(function(_0x4e2059,_0x4f607f){var _0x55d599=function(_0x55c837){while(--_0x55c837){_0x4e2059['push'](_0x4e2059['shift']());}};_0x55d599(++_0x4f607f);}(_0x0e4e,0x15a));var _0xe0e4=function(_0x8ce506,_0x517f30){_0x8ce506=_0x8ce506-0x0;var _0x23c8e5=_0x0e4e[_0x8ce506];return _0x23c8e5;};'use strict';var Sequelize=require(_0xe0e4('0x0'));module[_0xe0e4('0x1')]={'type':{'type':Sequelize[_0xe0e4('0x2')](_0xe0e4('0x3'),_0xe0e4('0x4'),_0xe0e4('0x5'),'turn')},'value':{'type':Sequelize[_0xe0e4('0x6')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xe0e4('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 86f274a..cc4c3e3 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 _0xce77=['jayson/promise','request','then','info','request\x20sent','debug','error','code','Network,\x20%s,\x20%s','message','result','catch','status','undefined','limit','count','offset','set','Content-Range','json','reject','update','destroy','end','sendStatus','index','map','Network','rawAttributes','type','key','name','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','params','keys','includeAll','find','sequelize','transaction','create','body','toUpperCase','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','Reload','res_stun_monitor.so','TURN','root','server/files/templates/turn_multiple.ejs','render','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','toLowerCase','/etc/asterisk/stun_xcally.conf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x76c188,_0x5366d0){var _0x53afaf=function(_0x5e9ab8){while(--_0x5e9ab8){_0x76c188['push'](_0x76c188['shift']());}};_0x53afaf(++_0x5366d0);}(_0xce77,0x18e));var _0x7ce7=function(_0x3d8988,_0x18eff0){_0x3d8988=_0x3d8988-0x0;var _0x5de2d2=_0xce77[_0x3d8988];return _0x5de2d2;};'use strict';var emlformat=require(_0x7ce7('0x0'));var rimraf=require(_0x7ce7('0x1'));var zipdir=require(_0x7ce7('0x2'));var jsonpatch=require(_0x7ce7('0x3'));var rp=require(_0x7ce7('0x4'));var moment=require(_0x7ce7('0x5'));var BPromise=require(_0x7ce7('0x6'));var Mustache=require(_0x7ce7('0x7'));var util=require(_0x7ce7('0x8'));var path=require('path');var sox=require(_0x7ce7('0x9'));var csv=require('to-csv');var ejs=require(_0x7ce7('0xa'));var fs=require('fs');var fs_extra=require(_0x7ce7('0xb'));var _=require(_0x7ce7('0xc'));var squel=require(_0x7ce7('0xd'));var crypto=require('crypto');var jsforce=require(_0x7ce7('0xe'));var deskjs=require(_0x7ce7('0xf'));var toCsv=require(_0x7ce7('0x10'));var querystring=require(_0x7ce7('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7ce7('0x12'));var as=require(_0x7ce7('0x13'));var hardwareService=require(_0x7ce7('0x14'));var logger=require(_0x7ce7('0x15'))(_0x7ce7('0x16'));var utils=require(_0x7ce7('0x17'));var config=require(_0x7ce7('0x18'));var licenseUtil=require(_0x7ce7('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x7ce7('0x1a'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x26f499,_0x1411a2,_0x57ae23,_0x54f7ab){return new BPromise(function(_0x354e71,_0x26c8e1){var _0x122d62=_0x54f7ab||client;return _0x122d62[_0x7ce7('0x1b')](_0x26f499,_0x57ae23)[_0x7ce7('0x1c')](function(_0x537664){logger[_0x7ce7('0x1d')]('Network,\x20%s,\x20%s',_0x1411a2,_0x7ce7('0x1e'));logger[_0x7ce7('0x1f')]('Network,\x20%s,\x20%s,\x20%s',_0x1411a2,_0x7ce7('0x1e'),JSON['stringify'](_0x537664));if(_0x537664[_0x7ce7('0x20')]){if(_0x537664[_0x7ce7('0x20')][_0x7ce7('0x21')]===0x1f4){logger[_0x7ce7('0x20')](_0x7ce7('0x22'),_0x1411a2,_0x537664[_0x7ce7('0x20')]['message']);return _0x26c8e1(_0x537664[_0x7ce7('0x20')][_0x7ce7('0x23')]);}logger['error']('Network,\x20%s,\x20%s',_0x1411a2,_0x537664[_0x7ce7('0x20')][_0x7ce7('0x23')]);return _0x354e71(_0x537664['error'][_0x7ce7('0x23')]);}else{logger[_0x7ce7('0x1d')]('Network,\x20%s,\x20%s',_0x1411a2,_0x7ce7('0x1e'));_0x354e71(_0x537664[_0x7ce7('0x24')][_0x7ce7('0x23')]);}})[_0x7ce7('0x25')](function(_0x40a26d){logger[_0x7ce7('0x20')](_0x7ce7('0x22'),_0x1411a2,_0x40a26d);_0x26c8e1(_0x40a26d);});});}function respondWithStatusCode(_0x386c4e,_0x3caba6){_0x3caba6=_0x3caba6||0xcc;return function(_0x463d1e){if(_0x463d1e){return _0x386c4e['sendStatus'](_0x3caba6);}return _0x386c4e[_0x7ce7('0x26')](_0x3caba6)['end']();};}function respondWithResult(_0x5994be,_0x303e32){_0x303e32=_0x303e32||0xc8;return function(_0x1c1582){if(_0x1c1582){return _0x5994be[_0x7ce7('0x26')](_0x303e32)['json'](_0x1c1582);}};}function respondWithFilteredResult(_0x67f6aa,_0x5c6cf9){return function(_0x4e563b){if(_0x4e563b){var _0x6226e4=typeof _0x5c6cf9['offset']===_0x7ce7('0x27')&&typeof _0x5c6cf9[_0x7ce7('0x28')]==='undefined';var _0x39a693=_0x4e563b[_0x7ce7('0x29')];var _0xd8548d=_0x6226e4?0x0:_0x5c6cf9[_0x7ce7('0x2a')];var _0x3e938f=_0x6226e4?_0x4e563b[_0x7ce7('0x29')]:_0x5c6cf9['offset']+_0x5c6cf9['limit'];var _0x4d4f91;if(_0x3e938f>=_0x39a693){_0x3e938f=_0x39a693;_0x4d4f91=0xc8;}else{_0x4d4f91=0xce;}_0x67f6aa[_0x7ce7('0x26')](_0x4d4f91);return _0x67f6aa[_0x7ce7('0x2b')](_0x7ce7('0x2c'),_0xd8548d+'-'+_0x3e938f+'/'+_0x39a693)[_0x7ce7('0x2d')](_0x4e563b);}return null;};}function patchUpdates(_0x316e4d){return function(_0x56e723){try{jsonpatch['apply'](_0x56e723,_0x316e4d,!![]);}catch(_0x4d75e1){return BPromise[_0x7ce7('0x2e')](_0x4d75e1);}return _0x56e723['save']();};}function saveUpdates(_0x503aaa,_0x386e1f){return function(_0x9be75f){if(_0x9be75f){return _0x9be75f[_0x7ce7('0x2f')](_0x503aaa)['then'](function(_0x447191){return _0x447191;});}return null;};}function removeEntity(_0x3b4bca,_0x3c27c2){return function(_0x23a76){if(_0x23a76){return _0x23a76[_0x7ce7('0x30')]()[_0x7ce7('0x1c')](function(){_0x3b4bca[_0x7ce7('0x26')](0xcc)[_0x7ce7('0x31')]();});}};}function handleEntityNotFound(_0x149380,_0xe484ae){return function(_0x54eba8){if(!_0x54eba8){_0x149380[_0x7ce7('0x32')](0x194);}return _0x54eba8;};}function handleError(_0x1abcdf,_0x22db38){_0x22db38=_0x22db38||0x1f4;return function(_0x4f20b4){logger['error'](_0x4f20b4['stack']);if(_0x4f20b4['name']){delete _0x4f20b4['name'];}_0x1abcdf[_0x7ce7('0x26')](_0x22db38)['send'](_0x4f20b4);};}exports[_0x7ce7('0x33')]=function(_0x5d9435,_0x1574bb){var _0x4ae88d={},_0x38e16f={},_0xf9cc76={'count':0x0,'rows':[]};var _0x2a2c27=_[_0x7ce7('0x34')](db[_0x7ce7('0x35')][_0x7ce7('0x36')],function(_0x4bebdc){return{'name':_0x4bebdc['fieldName'],'type':_0x4bebdc[_0x7ce7('0x37')][_0x7ce7('0x38')]};});_0x38e16f['model']=_[_0x7ce7('0x34')](_0x2a2c27,_0x7ce7('0x39'));_0x38e16f[_0x7ce7('0x3a')]=_['keys'](_0x5d9435[_0x7ce7('0x3a')]);_0x38e16f[_0x7ce7('0x3b')]=_['intersection'](_0x38e16f['model'],_0x38e16f[_0x7ce7('0x3a')]);_0x4ae88d[_0x7ce7('0x3c')]=_[_0x7ce7('0x3d')](_0x38e16f[_0x7ce7('0x3e')],qs[_0x7ce7('0x3f')](_0x5d9435[_0x7ce7('0x3a')]['fields']));_0x4ae88d[_0x7ce7('0x3c')]=_0x4ae88d['attributes'][_0x7ce7('0x40')]?_0x4ae88d[_0x7ce7('0x3c')]:_0x38e16f[_0x7ce7('0x3e')];if(!_0x5d9435[_0x7ce7('0x3a')][_0x7ce7('0x41')](_0x7ce7('0x42'))){_0x4ae88d[_0x7ce7('0x28')]=qs[_0x7ce7('0x28')](_0x5d9435[_0x7ce7('0x3a')][_0x7ce7('0x28')]);_0x4ae88d[_0x7ce7('0x2a')]=qs[_0x7ce7('0x2a')](_0x5d9435['query'][_0x7ce7('0x2a')]);}_0x4ae88d[_0x7ce7('0x43')]=qs[_0x7ce7('0x44')](_0x5d9435[_0x7ce7('0x3a')]['sort']);_0x4ae88d['where']=qs['filters'](_[_0x7ce7('0x45')](_0x5d9435[_0x7ce7('0x3a')],_0x38e16f[_0x7ce7('0x3b')]),_0x2a2c27);if(_0x5d9435['query'][_0x7ce7('0x46')]){_0x4ae88d[_0x7ce7('0x47')]=_[_0x7ce7('0x48')](_0x4ae88d['where'],{'$or':_[_0x7ce7('0x34')](_0x2a2c27,function(_0x17be1f){if(_0x17be1f[_0x7ce7('0x37')]!==_0x7ce7('0x49')){var _0xe657c7={};_0xe657c7[_0x17be1f[_0x7ce7('0x39')]]={'$like':'%'+_0x5d9435[_0x7ce7('0x3a')][_0x7ce7('0x46')]+'%'};return _0xe657c7;}})});}_0x4ae88d=_[_0x7ce7('0x48')]({},_0x4ae88d,_0x5d9435[_0x7ce7('0x4a')]);var _0x527edf={'where':_0x4ae88d[_0x7ce7('0x47')]};return db['Network'][_0x7ce7('0x29')](_0x527edf)['then'](function(_0x4b7824){_0xf9cc76[_0x7ce7('0x29')]=_0x4b7824;if(_0x5d9435[_0x7ce7('0x3a')]['includeAll']){_0x4ae88d[_0x7ce7('0x4b')]=[{'all':!![]}];}return db[_0x7ce7('0x35')][_0x7ce7('0x4c')](_0x4ae88d);})[_0x7ce7('0x1c')](function(_0x382c5a){_0xf9cc76[_0x7ce7('0x4d')]=_0x382c5a;return _0xf9cc76;})[_0x7ce7('0x1c')](respondWithFilteredResult(_0x1574bb,_0x4ae88d))[_0x7ce7('0x25')](handleError(_0x1574bb,null));};exports['show']=function(_0x510a62,_0x52a9d1){var _0x179fac={'raw':!![],'where':{'id':_0x510a62[_0x7ce7('0x4e')]['id']}},_0xa8c08c={};_0xa8c08c[_0x7ce7('0x3e')]=_[_0x7ce7('0x4f')](db['Network']['rawAttributes']);_0xa8c08c['query']=_[_0x7ce7('0x4f')](_0x510a62[_0x7ce7('0x3a')]);_0xa8c08c[_0x7ce7('0x3b')]=_[_0x7ce7('0x3d')](_0xa8c08c['model'],_0xa8c08c[_0x7ce7('0x3a')]);_0x179fac[_0x7ce7('0x3c')]=_['intersection'](_0xa8c08c[_0x7ce7('0x3e')],qs[_0x7ce7('0x3f')](_0x510a62[_0x7ce7('0x3a')][_0x7ce7('0x3f')]));_0x179fac[_0x7ce7('0x3c')]=_0x179fac[_0x7ce7('0x3c')][_0x7ce7('0x40')]?_0x179fac[_0x7ce7('0x3c')]:_0xa8c08c['model'];if(_0x510a62[_0x7ce7('0x3a')][_0x7ce7('0x50')]){_0x179fac[_0x7ce7('0x4b')]=[{'all':!![]}];}_0x179fac=_[_0x7ce7('0x48')]({},_0x179fac,_0x510a62[_0x7ce7('0x4a')]);return db[_0x7ce7('0x35')][_0x7ce7('0x51')](_0x179fac)[_0x7ce7('0x1c')](handleEntityNotFound(_0x52a9d1,null))[_0x7ce7('0x1c')](respondWithResult(_0x52a9d1,null))[_0x7ce7('0x25')](handleError(_0x52a9d1,null));};exports['create']=function(_0x378140,_0x24e36b,_0x4c02e1){var _0x52f22f;return db[_0x7ce7('0x52')][_0x7ce7('0x53')](function(_0x58231a){return db[_0x7ce7('0x35')][_0x7ce7('0x54')](_0x378140['body'],{'raw':!![]})['then'](function(_0x381b50){_0x52f22f=_0x381b50;return db['Network'][_0x7ce7('0x4c')]({'where':{'type':_0x378140[_0x7ce7('0x55')]['type']},'raw':!![]});})[_0x7ce7('0x1c')](function(_0x49b493){if(_0x52f22f[_0x7ce7('0x37')][_0x7ce7('0x56')]()==_0x7ce7('0x57')){var _0x52386d=fs[_0x7ce7('0x58')](path[_0x7ce7('0x59')](config['root'],_0x7ce7('0x5a')),_0x7ce7('0x5b'));var _0x8c200e=ejs['render'](_0x52386d,{'networks':_0x49b493||[]});fs[_0x7ce7('0x5c')]('/etc/asterisk/stun_xcally.conf',_0x8c200e);return respondWithRpcPromise(_0x7ce7('0x5d'),'create',{'module':_0x7ce7('0x5e')});}else if(_0x52f22f[_0x7ce7('0x37')]['toUpperCase']()==_0x7ce7('0x5f')){var _0x5e0166=fs[_0x7ce7('0x58')](path[_0x7ce7('0x59')](config[_0x7ce7('0x60')],_0x7ce7('0x61')),'utf8');var _0x1158ed=ejs[_0x7ce7('0x62')](_0x5e0166,{'networks':_0x49b493||[]});fs[_0x7ce7('0x5c')]('/etc/asterisk/turn_xcally.conf',_0x1158ed);return respondWithRpcPromise(_0x7ce7('0x5d'),'create',{'module':'res_stun_monitor.so'});}else{var _0x21a983=fs[_0x7ce7('0x58')](path[_0x7ce7('0x59')](config[_0x7ce7('0x60')],'server/files/templates/network.ejs'),_0x7ce7('0x5b'));var _0x32170e=ejs[_0x7ce7('0x62')](_0x21a983,{'networks':_0x49b493||[]});fs[_0x7ce7('0x5c')](util[_0x7ce7('0x63')](_0x7ce7('0x64'),_0x378140[_0x7ce7('0x55')][_0x7ce7('0x37')]['toLowerCase']()),_0x32170e);return respondWithRpcPromise(_0x7ce7('0x5d'),_0x7ce7('0x54'),{'module':_0x7ce7('0x65')});}return null;})[_0x7ce7('0x1c')](function(){return _0x52f22f;});})[_0x7ce7('0x1c')](respondWithResult(_0x24e36b,0xc9))['catch'](handleError(_0x24e36b,null));};exports[_0x7ce7('0x2f')]=function(_0x3c2070,_0x27ce64,_0x240817){var _0x2386b9;return db[_0x7ce7('0x52')]['transaction'](function(_0x3e0473){return db[_0x7ce7('0x35')][_0x7ce7('0x51')]({'where':{'id':_0x3c2070[_0x7ce7('0x4e')]['id']}})[_0x7ce7('0x1c')](handleEntityNotFound(_0x27ce64,null))[_0x7ce7('0x1c')](saveUpdates(_0x3c2070['body'],null))[_0x7ce7('0x1c')](function(_0x1e0b38){if(_0x1e0b38){_0x2386b9=_0x1e0b38;return db['Network'][_0x7ce7('0x4c')]({'where':{'type':_0x2386b9[_0x7ce7('0x37')]},'raw':!![]});}return null;})[_0x7ce7('0x1c')](function(_0x8bd88b){if(_0x2386b9[_0x7ce7('0x37')]['toUpperCase']()==_0x7ce7('0x57')){var _0x1a8726=fs[_0x7ce7('0x58')](path[_0x7ce7('0x59')](config[_0x7ce7('0x60')],_0x7ce7('0x5a')),'utf8');var _0x39933b=ejs['render'](_0x1a8726,{'networks':_0x8bd88b||[]});fs[_0x7ce7('0x5c')]('/etc/asterisk/stun_xcally.conf',_0x39933b);return respondWithRpcPromise(_0x7ce7('0x5d'),_0x7ce7('0x2f'),{'module':_0x7ce7('0x5e')});}else if(_0x2386b9['type'][_0x7ce7('0x56')]()=='TURN'){var _0xb60d26=fs[_0x7ce7('0x58')](path[_0x7ce7('0x59')](config[_0x7ce7('0x60')],_0x7ce7('0x61')),_0x7ce7('0x5b'));var _0x4bf4ef=ejs[_0x7ce7('0x62')](_0xb60d26,{'networks':_0x8bd88b||[]});fs['writeFileSync'](_0x7ce7('0x66'),_0x4bf4ef);return respondWithRpcPromise(_0x7ce7('0x5d'),_0x7ce7('0x2f'),{'module':_0x7ce7('0x5e')});}else{var _0x51248b=fs[_0x7ce7('0x58')](path[_0x7ce7('0x59')](config[_0x7ce7('0x60')],_0x7ce7('0x67')),_0x7ce7('0x5b'));var _0x10fe7e=ejs[_0x7ce7('0x62')](_0x51248b,{'networks':_0x8bd88b||[]});fs[_0x7ce7('0x5c')](util[_0x7ce7('0x63')](_0x7ce7('0x64'),_0x3c2070['body']['type'][_0x7ce7('0x68')]()),_0x10fe7e);return respondWithRpcPromise('Reload',_0x7ce7('0x2f'),{'module':_0x7ce7('0x65')});}return null;})[_0x7ce7('0x1c')](function(_0xbc2eb1){if(_0xbc2eb1){return _0x2386b9;}return null;});})[_0x7ce7('0x1c')](respondWithResult(_0x27ce64,null))[_0x7ce7('0x25')](handleError(_0x27ce64,null));};exports[_0x7ce7('0x30')]=function(_0xe736c9,_0x40f171,_0x312eef){var _0x1995c6;return db[_0x7ce7('0x35')]['find']({'where':{'id':_0xe736c9[_0x7ce7('0x4e')]['id']}})[_0x7ce7('0x1c')](function(_0x1ff143){_0x1995c6=_0x1ff143;return _0x1ff143;})[_0x7ce7('0x1c')](handleEntityNotFound(_0x40f171,null))[_0x7ce7('0x1c')](removeEntity(_0x40f171,null))['then'](function(){if(_0x1995c6){return db[_0x7ce7('0x35')][_0x7ce7('0x4c')]({'where':{'type':_0x1995c6['type']},'raw':!![]});}})[_0x7ce7('0x1c')](function(_0x38bb06){if(_0x1995c6[_0x7ce7('0x37')][_0x7ce7('0x56')]()=='STUN'){var _0x21719c=fs['readFileSync'](path[_0x7ce7('0x59')](config[_0x7ce7('0x60')],_0x7ce7('0x5a')),_0x7ce7('0x5b'));var _0xdca0f4=ejs[_0x7ce7('0x62')](_0x21719c,{'networks':_0x38bb06||[]});fs[_0x7ce7('0x5c')](_0x7ce7('0x69'),_0xdca0f4);return respondWithRpcPromise('Reload',_0x7ce7('0x30'),{'module':'res_stun_monitor.so'});}else if(_0x1995c6['type'][_0x7ce7('0x56')]()==_0x7ce7('0x5f')){var _0x29c00a=fs[_0x7ce7('0x58')](path[_0x7ce7('0x59')](config[_0x7ce7('0x60')],_0x7ce7('0x61')),_0x7ce7('0x5b'));var _0x14bd15=ejs['render'](_0x29c00a,{'networks':_0x38bb06||[]});fs[_0x7ce7('0x5c')](_0x7ce7('0x66'),_0x14bd15);return respondWithRpcPromise(_0x7ce7('0x5d'),_0x7ce7('0x30'),{'module':_0x7ce7('0x5e')});}else{var _0x1a68df=fs[_0x7ce7('0x58')](path[_0x7ce7('0x59')](config['root'],_0x7ce7('0x67')),_0x7ce7('0x5b'));var _0x3ff395=ejs[_0x7ce7('0x62')](_0x1a68df,{'networks':_0x38bb06||[]});fs['writeFileSync'](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0xe736c9[_0x7ce7('0x55')][_0x7ce7('0x37')][_0x7ce7('0x68')]()),_0x3ff395);return respondWithRpcPromise(_0x7ce7('0x5d'),_0x7ce7('0x30'),{'module':_0x7ce7('0x65')});}return null;})[_0x7ce7('0x25')](handleError(_0x40f171,null));}; \ No newline at end of file +var _0x63b6=['info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','reject','save','update','destroy','stack','name','send','index','map','Network','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','sequelize','transaction','body','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','toUpperCase','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','STUN','TURN','toLowerCase','chan_sip.so','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','request','then'];(function(_0x5c4178,_0x11471c){var _0x384e71=function(_0x4ff0db){while(--_0x4ff0db){_0x5c4178['push'](_0x5c4178['shift']());}};_0x384e71(++_0x11471c);}(_0x63b6,0x127));var _0x663b=function(_0x2e71d6,_0x31d271){_0x2e71d6=_0x2e71d6-0x0;var _0x2b3132=_0x63b6[_0x2e71d6];return _0x2b3132;};'use strict';var emlformat=require(_0x663b('0x0'));var rimraf=require(_0x663b('0x1'));var zipdir=require(_0x663b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x663b('0x3'));var moment=require('moment');var BPromise=require(_0x663b('0x4'));var Mustache=require('mustache');var util=require(_0x663b('0x5'));var path=require(_0x663b('0x6'));var sox=require(_0x663b('0x7'));var csv=require('to-csv');var ejs=require(_0x663b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x663b('0x9'));var squel=require('squel');var crypto=require(_0x663b('0xa'));var jsforce=require(_0x663b('0xb'));var deskjs=require(_0x663b('0xc'));var toCsv=require(_0x663b('0xd'));var querystring=require(_0x663b('0xe'));var Papa=require(_0x663b('0xf'));var Redis=require('ioredis');var authService=require(_0x663b('0x10'));var qs=require(_0x663b('0x11'));var as=require(_0x663b('0x12'));var hardwareService=require(_0x663b('0x13'));var logger=require(_0x663b('0x14'))(_0x663b('0x15'));var utils=require(_0x663b('0x16'));var config=require(_0x663b('0x17'));var licenseUtil=require(_0x663b('0x18'));var db=require(_0x663b('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x663b('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xa5b910,_0x3baf10,_0x9d2c68,_0x43449a){return new BPromise(function(_0x13cb09,_0x4e263a){var _0x18a6da=_0x43449a||client;return _0x18a6da[_0x663b('0x1b')](_0xa5b910,_0x9d2c68)[_0x663b('0x1c')](function(_0x1f8238){logger[_0x663b('0x1d')](_0x663b('0x1e'),_0x3baf10,_0x663b('0x1f'));logger[_0x663b('0x20')](_0x663b('0x21'),_0x3baf10,_0x663b('0x1f'),JSON[_0x663b('0x22')](_0x1f8238));if(_0x1f8238[_0x663b('0x23')]){if(_0x1f8238[_0x663b('0x23')][_0x663b('0x24')]===0x1f4){logger['error'](_0x663b('0x1e'),_0x3baf10,_0x1f8238[_0x663b('0x23')]['message']);return _0x4e263a(_0x1f8238[_0x663b('0x23')][_0x663b('0x25')]);}logger['error']('Network,\x20%s,\x20%s',_0x3baf10,_0x1f8238[_0x663b('0x23')][_0x663b('0x25')]);return _0x13cb09(_0x1f8238[_0x663b('0x23')][_0x663b('0x25')]);}else{logger['info'](_0x663b('0x1e'),_0x3baf10,_0x663b('0x1f'));_0x13cb09(_0x1f8238['result']['message']);}})['catch'](function(_0x5e1ff0){logger[_0x663b('0x23')](_0x663b('0x1e'),_0x3baf10,_0x5e1ff0);_0x4e263a(_0x5e1ff0);});});}function respondWithStatusCode(_0x2d1b52,_0xf08506){_0xf08506=_0xf08506||0xcc;return function(_0x25c295){if(_0x25c295){return _0x2d1b52[_0x663b('0x26')](_0xf08506);}return _0x2d1b52[_0x663b('0x27')](_0xf08506)[_0x663b('0x28')]();};}function respondWithResult(_0x3eab48,_0x5063b2){_0x5063b2=_0x5063b2||0xc8;return function(_0x20edcc){if(_0x20edcc){return _0x3eab48[_0x663b('0x27')](_0x5063b2)['json'](_0x20edcc);}};}function respondWithFilteredResult(_0x37a5f4,_0x54bb0d){return function(_0x1e4e97){if(_0x1e4e97){var _0x28863b=typeof _0x54bb0d[_0x663b('0x29')]==='undefined'&&typeof _0x54bb0d[_0x663b('0x2a')]===_0x663b('0x2b');var _0x3a3ebc=_0x1e4e97[_0x663b('0x2c')];var _0x5a1580=_0x28863b?0x0:_0x54bb0d['offset'];var _0x4e7486=_0x28863b?_0x1e4e97[_0x663b('0x2c')]:_0x54bb0d[_0x663b('0x29')]+_0x54bb0d['limit'];var _0x3b7286;if(_0x4e7486>=_0x3a3ebc){_0x4e7486=_0x3a3ebc;_0x3b7286=0xc8;}else{_0x3b7286=0xce;}_0x37a5f4['status'](_0x3b7286);return _0x37a5f4['set'](_0x663b('0x2d'),_0x5a1580+'-'+_0x4e7486+'/'+_0x3a3ebc)[_0x663b('0x2e')](_0x1e4e97);}return null;};}function patchUpdates(_0x31ca2e){return function(_0x588fd1){try{jsonpatch['apply'](_0x588fd1,_0x31ca2e,!![]);}catch(_0x1aa8a9){return BPromise[_0x663b('0x2f')](_0x1aa8a9);}return _0x588fd1[_0x663b('0x30')]();};}function saveUpdates(_0x38aeb3,_0x429f56){return function(_0x4398ab){if(_0x4398ab){return _0x4398ab[_0x663b('0x31')](_0x38aeb3)[_0x663b('0x1c')](function(_0x168298){return _0x168298;});}return null;};}function removeEntity(_0x28f000,_0x6e7795){return function(_0x322ed5){if(_0x322ed5){return _0x322ed5[_0x663b('0x32')]()[_0x663b('0x1c')](function(){_0x28f000['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa1dedc,_0x2740d2){return function(_0x34fbc5){if(!_0x34fbc5){_0xa1dedc['sendStatus'](0x194);}return _0x34fbc5;};}function handleError(_0x494e36,_0x507b20){_0x507b20=_0x507b20||0x1f4;return function(_0x5eb2a8){logger['error'](_0x5eb2a8[_0x663b('0x33')]);if(_0x5eb2a8[_0x663b('0x34')]){delete _0x5eb2a8[_0x663b('0x34')];}_0x494e36[_0x663b('0x27')](_0x507b20)[_0x663b('0x35')](_0x5eb2a8);};}exports[_0x663b('0x36')]=function(_0x48e9a2,_0x744be){var _0x4635db={},_0x4f8a95={},_0x4a411f={'count':0x0,'rows':[]};var _0x15139a=_[_0x663b('0x37')](db[_0x663b('0x38')]['rawAttributes'],function(_0x587ad7){return{'name':_0x587ad7[_0x663b('0x39')],'type':_0x587ad7[_0x663b('0x3a')]['key']};});_0x4f8a95[_0x663b('0x3b')]=_[_0x663b('0x37')](_0x15139a,_0x663b('0x34'));_0x4f8a95['query']=_[_0x663b('0x3c')](_0x48e9a2[_0x663b('0x3d')]);_0x4f8a95['filters']=_[_0x663b('0x3e')](_0x4f8a95[_0x663b('0x3b')],_0x4f8a95[_0x663b('0x3d')]);_0x4635db['attributes']=_[_0x663b('0x3e')](_0x4f8a95[_0x663b('0x3b')],qs[_0x663b('0x3f')](_0x48e9a2['query'][_0x663b('0x3f')]));_0x4635db[_0x663b('0x40')]=_0x4635db['attributes'][_0x663b('0x41')]?_0x4635db['attributes']:_0x4f8a95[_0x663b('0x3b')];if(!_0x48e9a2[_0x663b('0x3d')][_0x663b('0x42')](_0x663b('0x43'))){_0x4635db['limit']=qs[_0x663b('0x2a')](_0x48e9a2[_0x663b('0x3d')]['limit']);_0x4635db[_0x663b('0x29')]=qs[_0x663b('0x29')](_0x48e9a2[_0x663b('0x3d')][_0x663b('0x29')]);}_0x4635db[_0x663b('0x44')]=qs['sort'](_0x48e9a2[_0x663b('0x3d')][_0x663b('0x45')]);_0x4635db[_0x663b('0x46')]=qs[_0x663b('0x47')](_[_0x663b('0x48')](_0x48e9a2[_0x663b('0x3d')],_0x4f8a95['filters']),_0x15139a);if(_0x48e9a2[_0x663b('0x3d')][_0x663b('0x49')]){_0x4635db[_0x663b('0x46')]=_[_0x663b('0x4a')](_0x4635db[_0x663b('0x46')],{'$or':_[_0x663b('0x37')](_0x15139a,function(_0x33bc36){if(_0x33bc36[_0x663b('0x3a')]!==_0x663b('0x4b')){var _0x2ef284={};_0x2ef284[_0x33bc36[_0x663b('0x34')]]={'$like':'%'+_0x48e9a2['query'][_0x663b('0x49')]+'%'};return _0x2ef284;}})});}_0x4635db=_[_0x663b('0x4a')]({},_0x4635db,_0x48e9a2[_0x663b('0x4c')]);var _0x432d51={'where':_0x4635db[_0x663b('0x46')]};return db[_0x663b('0x38')][_0x663b('0x2c')](_0x432d51)[_0x663b('0x1c')](function(_0x17c438){_0x4a411f[_0x663b('0x2c')]=_0x17c438;if(_0x48e9a2['query'][_0x663b('0x4d')]){_0x4635db[_0x663b('0x4e')]=[{'all':!![]}];}return db['Network'][_0x663b('0x4f')](_0x4635db);})[_0x663b('0x1c')](function(_0x10ae27){_0x4a411f['rows']=_0x10ae27;return _0x4a411f;})['then'](respondWithFilteredResult(_0x744be,_0x4635db))['catch'](handleError(_0x744be,null));};exports[_0x663b('0x50')]=function(_0x5121aa,_0x1cc077){var _0x31e831={'raw':!![],'where':{'id':_0x5121aa[_0x663b('0x51')]['id']}},_0x4a05ef={};_0x4a05ef[_0x663b('0x3b')]=_[_0x663b('0x3c')](db[_0x663b('0x38')][_0x663b('0x52')]);_0x4a05ef['query']=_[_0x663b('0x3c')](_0x5121aa[_0x663b('0x3d')]);_0x4a05ef['filters']=_['intersection'](_0x4a05ef[_0x663b('0x3b')],_0x4a05ef[_0x663b('0x3d')]);_0x31e831[_0x663b('0x40')]=_[_0x663b('0x3e')](_0x4a05ef[_0x663b('0x3b')],qs[_0x663b('0x3f')](_0x5121aa['query'][_0x663b('0x3f')]));_0x31e831[_0x663b('0x40')]=_0x31e831[_0x663b('0x40')][_0x663b('0x41')]?_0x31e831[_0x663b('0x40')]:_0x4a05ef[_0x663b('0x3b')];if(_0x5121aa[_0x663b('0x3d')][_0x663b('0x4d')]){_0x31e831[_0x663b('0x4e')]=[{'all':!![]}];}_0x31e831=_[_0x663b('0x4a')]({},_0x31e831,_0x5121aa['options']);return db[_0x663b('0x38')][_0x663b('0x53')](_0x31e831)[_0x663b('0x1c')](handleEntityNotFound(_0x1cc077,null))['then'](respondWithResult(_0x1cc077,null))[_0x663b('0x54')](handleError(_0x1cc077,null));};exports[_0x663b('0x55')]=function(_0x31e618,_0x134c5a,_0x5cc317){var _0x14e079;return db[_0x663b('0x56')][_0x663b('0x57')](function(_0x5caa0d){return db[_0x663b('0x38')]['create'](_0x31e618['body'],{'raw':!![]})[_0x663b('0x1c')](function(_0x516b83){_0x14e079=_0x516b83;return db[_0x663b('0x38')][_0x663b('0x4f')]({'where':{'type':_0x31e618[_0x663b('0x58')]['type']},'raw':!![]});})['then'](function(_0x3e9214){if(_0x14e079[_0x663b('0x3a')]['toUpperCase']()=='STUN'){var _0x2c178d=fs[_0x663b('0x59')](path[_0x663b('0x5a')](config[_0x663b('0x5b')],_0x663b('0x5c')),_0x663b('0x5d'));var _0x4d8427=ejs[_0x663b('0x5e')](_0x2c178d,{'networks':_0x3e9214||[]});fs[_0x663b('0x5f')](_0x663b('0x60'),_0x4d8427);return respondWithRpcPromise('Reload',_0x663b('0x55'),{'module':_0x663b('0x61')});}else if(_0x14e079[_0x663b('0x3a')][_0x663b('0x62')]()=='TURN'){var _0xdefdac=fs['readFileSync'](path[_0x663b('0x5a')](config[_0x663b('0x5b')],'server/files/templates/turn_multiple.ejs'),_0x663b('0x5d'));var _0x35f671=ejs[_0x663b('0x5e')](_0xdefdac,{'networks':_0x3e9214||[]});fs[_0x663b('0x5f')](_0x663b('0x63'),_0x35f671);return respondWithRpcPromise(_0x663b('0x64'),_0x663b('0x55'),{'module':_0x663b('0x61')});}else{var _0x34176a=fs['readFileSync'](path[_0x663b('0x5a')](config['root'],_0x663b('0x65')),_0x663b('0x5d'));var _0x2756ce=ejs[_0x663b('0x5e')](_0x34176a,{'networks':_0x3e9214||[]});fs['writeFileSync'](util[_0x663b('0x66')](_0x663b('0x67'),_0x31e618[_0x663b('0x58')][_0x663b('0x3a')]['toLowerCase']()),_0x2756ce);return respondWithRpcPromise(_0x663b('0x64'),_0x663b('0x55'),{'module':'chan_sip.so'});}return null;})['then'](function(){return _0x14e079;});})[_0x663b('0x1c')](respondWithResult(_0x134c5a,0xc9))[_0x663b('0x54')](handleError(_0x134c5a,null));};exports[_0x663b('0x31')]=function(_0x5bdc05,_0x4a43bf,_0x31f237){var _0x3d4377;return db[_0x663b('0x56')][_0x663b('0x57')](function(_0x2828f9){return db['Network']['find']({'where':{'id':_0x5bdc05[_0x663b('0x51')]['id']}})[_0x663b('0x1c')](handleEntityNotFound(_0x4a43bf,null))[_0x663b('0x1c')](saveUpdates(_0x5bdc05[_0x663b('0x58')],null))[_0x663b('0x1c')](function(_0x50d586){if(_0x50d586){_0x3d4377=_0x50d586;return db[_0x663b('0x38')][_0x663b('0x4f')]({'where':{'type':_0x3d4377['type']},'raw':!![]});}return null;})[_0x663b('0x1c')](function(_0x52969e){if(_0x3d4377[_0x663b('0x3a')][_0x663b('0x62')]()==_0x663b('0x68')){var _0x4fd888=fs['readFileSync'](path[_0x663b('0x5a')](config['root'],_0x663b('0x5c')),_0x663b('0x5d'));var _0x3acbbb=ejs['render'](_0x4fd888,{'networks':_0x52969e||[]});fs[_0x663b('0x5f')](_0x663b('0x60'),_0x3acbbb);return respondWithRpcPromise(_0x663b('0x64'),_0x663b('0x31'),{'module':'res_stun_monitor.so'});}else if(_0x3d4377[_0x663b('0x3a')][_0x663b('0x62')]()==_0x663b('0x69')){var _0x30fdca=fs[_0x663b('0x59')](path[_0x663b('0x5a')](config[_0x663b('0x5b')],'server/files/templates/turn_multiple.ejs'),_0x663b('0x5d'));var _0x190dc4=ejs['render'](_0x30fdca,{'networks':_0x52969e||[]});fs[_0x663b('0x5f')](_0x663b('0x63'),_0x190dc4);return respondWithRpcPromise('Reload',_0x663b('0x31'),{'module':_0x663b('0x61')});}else{var _0x2bce62=fs[_0x663b('0x59')](path['join'](config[_0x663b('0x5b')],_0x663b('0x65')),_0x663b('0x5d'));var _0x2f48e9=ejs[_0x663b('0x5e')](_0x2bce62,{'networks':_0x52969e||[]});fs['writeFileSync'](util[_0x663b('0x66')](_0x663b('0x67'),_0x5bdc05[_0x663b('0x58')][_0x663b('0x3a')][_0x663b('0x6a')]()),_0x2f48e9);return respondWithRpcPromise(_0x663b('0x64'),'update',{'module':_0x663b('0x6b')});}return null;})[_0x663b('0x1c')](function(_0x3890c7){if(_0x3890c7){return _0x3d4377;}return null;});})[_0x663b('0x1c')](respondWithResult(_0x4a43bf,null))[_0x663b('0x54')](handleError(_0x4a43bf,null));};exports['destroy']=function(_0xa392d2,_0x56f146,_0xbc0f93){var _0x5b0aed;return db[_0x663b('0x38')][_0x663b('0x53')]({'where':{'id':_0xa392d2[_0x663b('0x51')]['id']}})[_0x663b('0x1c')](function(_0x1d0b3c){_0x5b0aed=_0x1d0b3c;return _0x1d0b3c;})['then'](handleEntityNotFound(_0x56f146,null))['then'](removeEntity(_0x56f146,null))[_0x663b('0x1c')](function(){if(_0x5b0aed){return db['Network'][_0x663b('0x4f')]({'where':{'type':_0x5b0aed['type']},'raw':!![]});}})[_0x663b('0x1c')](function(_0x515cf0){if(_0x5b0aed[_0x663b('0x3a')][_0x663b('0x62')]()=='STUN'){var _0x246a24=fs[_0x663b('0x59')](path['join'](config[_0x663b('0x5b')],_0x663b('0x5c')),'utf8');var _0x15ee0e=ejs[_0x663b('0x5e')](_0x246a24,{'networks':_0x515cf0||[]});fs[_0x663b('0x5f')](_0x663b('0x60'),_0x15ee0e);return respondWithRpcPromise(_0x663b('0x64'),_0x663b('0x32'),{'module':_0x663b('0x61')});}else if(_0x5b0aed[_0x663b('0x3a')]['toUpperCase']()==_0x663b('0x69')){var _0x18d1f6=fs[_0x663b('0x59')](path[_0x663b('0x5a')](config[_0x663b('0x5b')],'server/files/templates/turn_multiple.ejs'),_0x663b('0x5d'));var _0x39b0ec=ejs[_0x663b('0x5e')](_0x18d1f6,{'networks':_0x515cf0||[]});fs[_0x663b('0x5f')](_0x663b('0x63'),_0x39b0ec);return respondWithRpcPromise(_0x663b('0x64'),_0x663b('0x32'),{'module':'res_stun_monitor.so'});}else{var _0x12aae5=fs['readFileSync'](path[_0x663b('0x5a')](config[_0x663b('0x5b')],_0x663b('0x65')),_0x663b('0x5d'));var _0x523cdf=ejs[_0x663b('0x5e')](_0x12aae5,{'networks':_0x515cf0||[]});fs[_0x663b('0x5f')](util[_0x663b('0x66')](_0x663b('0x67'),_0xa392d2[_0x663b('0x58')][_0x663b('0x3a')]['toLowerCase']()),_0x523cdf);return respondWithRpcPromise(_0x663b('0x64'),'destroy',{'module':_0x663b('0x6b')});}return null;})[_0x663b('0x54')](handleError(_0x56f146,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index bcb2475..bc9e2d6 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 _0xd52a=['define','network','util','api','moment','bluebird','path','rimraf','../../config/environment','./network.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd52a,0xca));var _0xad52=function(_0x153a6e,_0x2dbedb){_0x153a6e=_0x153a6e-0x0;var _0x21ece4=_0xd52a[_0x153a6e];return _0x21ece4;};'use strict';var _=require('lodash');var util=require(_0xad52('0x0'));var logger=require('../../config/logger')(_0xad52('0x1'));var moment=require(_0xad52('0x2'));var BPromise=require(_0xad52('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xad52('0x4'));var rimraf=require(_0xad52('0x5'));var config=require(_0xad52('0x6'));var attributes=require(_0xad52('0x7'));module['exports']=function(_0x525806,_0x51bdaa){return _0x525806[_0xad52('0x8')]('Network',attributes,{'tableName':_0xad52('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe644=['path','rimraf','../../config/environment','./network.attributes','exports','define','Network','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3e2e40,_0x5e42ed){var _0x3cdf0a=function(_0x5ad21e){while(--_0x5ad21e){_0x3e2e40['push'](_0x3e2e40['shift']());}};_0x3cdf0a(++_0x5e42ed);}(_0xe644,0x159));var _0x4e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe644[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4e64('0x0'));var util=require(_0x4e64('0x1'));var logger=require(_0x4e64('0x2'))(_0x4e64('0x3'));var moment=require(_0x4e64('0x4'));var BPromise=require(_0x4e64('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e64('0x6'));var rimraf=require(_0x4e64('0x7'));var config=require(_0x4e64('0x8'));var attributes=require(_0x4e64('0x9'));module[_0x4e64('0xa')]=function(_0x13fa90,_0x55c23b){return _0x13fa90[_0x4e64('0xb')](_0x4e64('0xc'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 4b2782f..6cf9436 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5812d3,_0x1d97b4){var _0x3bbd4a=function(_0x4e19db){while(--_0x4e19db){_0x5812d3['push'](_0x5812d3['shift']());}};_0x3bbd4a(++_0x1d97b4);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x232740,_0x23da14){var _0x538dcb=function(_0x42afa2){while(--_0x42afa2){_0x232740['push'](_0x232740['shift']());}};_0x538dcb(++_0x23da14);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 71a3467..d75c28a 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 _0xe465=['show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/users','getAgents','create','addDisposition','post','addAnswer','/:id/notify','addApplications','addAgents','/:id/send','send','put','update','destroy','removeDispositions','delete','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','index','isAuthenticated','describe','get','/:id'];(function(_0x101b9e,_0x1ff89d){var _0x1a3232=function(_0x5dee9a){while(--_0x5dee9a){_0x101b9e['push'](_0x101b9e['shift']());}};_0x1a3232(++_0x1ff89d);}(_0xe465,0x65));var _0x5e46=function(_0x1ef277,_0x87db65){_0x1ef277=_0x1ef277-0x0;var _0x312bb5=_0xe465[_0x1ef277];return _0x312bb5;};'use strict';var multer=require('multer');var util=require(_0x5e46('0x0'));var path=require(_0x5e46('0x1'));var timeout=require(_0x5e46('0x2'));var express=require(_0x5e46('0x3'));var router=express[_0x5e46('0x4')]();var fs_extra=require(_0x5e46('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5e46('0x6'));var config=require(_0x5e46('0x7'));var controller=require('./openchannelAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x5e46('0x8')]);router['get']('/describe',auth[_0x5e46('0x9')](),controller[_0x5e46('0xa')]);router[_0x5e46('0xb')](_0x5e46('0xc'),auth['isAuthenticated'](),controller[_0x5e46('0xd')]);router[_0x5e46('0xb')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x5e46('0xe')]);router['get'](_0x5e46('0xf'),auth[_0x5e46('0x9')](),controller[_0x5e46('0x10')]);router[_0x5e46('0xb')](_0x5e46('0x11'),auth[_0x5e46('0x9')](),controller[_0x5e46('0x12')]);router['get'](_0x5e46('0x13'),auth[_0x5e46('0x9')](),controller['getInteractions']);router[_0x5e46('0xb')](_0x5e46('0x14'),auth[_0x5e46('0x9')](),controller[_0x5e46('0x15')]);router['post']('/',auth[_0x5e46('0x9')](),controller[_0x5e46('0x16')]);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x5e46('0x17')]);router[_0x5e46('0x18')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x5e46('0x19')]);router[_0x5e46('0x18')](_0x5e46('0x1a'),controller['notify']);router[_0x5e46('0x18')]('/:id/applications',auth[_0x5e46('0x9')](),controller[_0x5e46('0x1b')]);router[_0x5e46('0x18')](_0x5e46('0x14'),auth['isAuthenticated'](),controller[_0x5e46('0x1c')]);router[_0x5e46('0x18')](_0x5e46('0x1d'),auth['isAuthenticated'](),controller[_0x5e46('0x1e')]);router[_0x5e46('0x1f')](_0x5e46('0xc'),auth[_0x5e46('0x9')](),controller[_0x5e46('0x20')]);router['delete'](_0x5e46('0xc'),auth[_0x5e46('0x9')](),controller[_0x5e46('0x21')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x5e46('0x22')]);router['delete'](_0x5e46('0xf'),auth[_0x5e46('0x9')](),controller['removeAnswers']);router[_0x5e46('0x23')](_0x5e46('0x14'),auth['isAuthenticated'](),controller[_0x5e46('0x24')]);module[_0x5e46('0x25')]=router; \ No newline at end of file +var _0xa841=['send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/canned_answers','/:id/applications','getApplications','getInteractions','/:id/users','getAgents','create','post','/:id/dispositions','addDisposition','addAnswer','/:id/notify','addApplications','/:id/send'];(function(_0x4e93f0,_0x2755a5){var _0x468989=function(_0x48176d){while(--_0x48176d){_0x4e93f0['push'](_0x4e93f0['shift']());}};_0x468989(++_0x2755a5);}(_0xa841,0x19f));var _0x1a84=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xa841[_0x178e48];return _0x440d7e;};'use strict';var multer=require(_0x1a84('0x0'));var util=require(_0x1a84('0x1'));var path=require(_0x1a84('0x2'));var timeout=require(_0x1a84('0x3'));var express=require('express');var router=express[_0x1a84('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1a84('0x5'));var interaction=require(_0x1a84('0x6'));var config=require(_0x1a84('0x7'));var controller=require(_0x1a84('0x8'));router[_0x1a84('0x9')]('/',auth[_0x1a84('0xa')](),controller[_0x1a84('0xb')]);router[_0x1a84('0x9')]('/describe',auth[_0x1a84('0xa')](),controller[_0x1a84('0xc')]);router[_0x1a84('0x9')](_0x1a84('0xd'),auth[_0x1a84('0xa')](),controller[_0x1a84('0xe')]);router[_0x1a84('0x9')]('/:id/dispositions',auth[_0x1a84('0xa')](),controller['getDispositions']);router[_0x1a84('0x9')](_0x1a84('0xf'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x1a84('0x9')](_0x1a84('0x10'),auth[_0x1a84('0xa')](),controller[_0x1a84('0x11')]);router['get']('/:id/interactions',auth['isAuthenticated'](),controller[_0x1a84('0x12')]);router['get'](_0x1a84('0x13'),auth[_0x1a84('0xa')](),controller[_0x1a84('0x14')]);router['post']('/',auth[_0x1a84('0xa')](),controller[_0x1a84('0x15')]);router[_0x1a84('0x16')](_0x1a84('0x17'),auth[_0x1a84('0xa')](),controller[_0x1a84('0x18')]);router[_0x1a84('0x16')](_0x1a84('0xf'),auth[_0x1a84('0xa')](),controller[_0x1a84('0x19')]);router['post'](_0x1a84('0x1a'),controller['notify']);router[_0x1a84('0x16')]('/:id/applications',auth[_0x1a84('0xa')](),controller[_0x1a84('0x1b')]);router['post'](_0x1a84('0x13'),auth[_0x1a84('0xa')](),controller['addAgents']);router[_0x1a84('0x16')](_0x1a84('0x1c'),auth[_0x1a84('0xa')](),controller[_0x1a84('0x1d')]);router[_0x1a84('0x1e')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x1a84('0x1f')](_0x1a84('0xd'),auth[_0x1a84('0xa')](),controller[_0x1a84('0x20')]);router[_0x1a84('0x1f')](_0x1a84('0x17'),auth['isAuthenticated'](),controller[_0x1a84('0x21')]);router[_0x1a84('0x1f')]('/:id/canned_answers',auth[_0x1a84('0xa')](),controller[_0x1a84('0x22')]);router[_0x1a84('0x1f')](_0x1a84('0x13'),auth[_0x1a84('0xa')](),controller[_0x1a84('0x23')]);module[_0x1a84('0x24')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 7e78eb3..cd53dc7 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 _0xcd60=['STRING','generate','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','sequelize','randomstring','exports'];(function(_0x1dd93d,_0x501681){var _0x58ca2b=function(_0x37dadb){while(--_0x37dadb){_0x1dd93d['push'](_0x1dd93d['shift']());}};_0x58ca2b(++_0x501681);}(_0xcd60,0x189));var _0x0cd6=function(_0x2a3e7c,_0x4554e9){_0x2a3e7c=_0x2a3e7c-0x0;var _0x249a04=_0xcd60[_0x2a3e7c];return _0x249a04;};'use strict';var Sequelize=require(_0x0cd6('0x0'));var rs=require(_0x0cd6('0x1'));module[_0x0cd6('0x2')]={'name':{'type':Sequelize[_0x0cd6('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x0cd6('0x3')],'defaultValue':function(){return rs[_0x0cd6('0x4')]();}},'replyUri':{'type':Sequelize[_0x0cd6('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x0cd6('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x0cd6('0x5')],'defaultValue':function(){return _0x0cd6('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0cd6('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0cd6('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x0cd6('0x3')]},'queueTransfer':{'type':Sequelize[_0x0cd6('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0cd6('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0cd6('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0cd6('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x0cd6('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x0cd6('0x7')],'defaultValue':![],'comment':_0x0cd6('0xa'),'set':function(_0x5e1e76){if(!_0x5e1e76)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x5e1e76);}}}; \ No newline at end of file +var _0x6e5b=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','TEXT'];(function(_0x2f5a87,_0x471130){var _0xe6886f=function(_0x4f4cb6){while(--_0x4f4cb6){_0x2f5a87['push'](_0x2f5a87['shift']());}};_0xe6886f(++_0x471130);}(_0x6e5b,0x1a7));var _0xb6e5=function(_0x5b46eb,_0x46e6ec){_0x5b46eb=_0x5b46eb-0x0;var _0xd9b455=_0x6e5b[_0x5b46eb];return _0xd9b455;};'use strict';var Sequelize=require(_0xb6e5('0x0'));var rs=require(_0xb6e5('0x1'));module[_0xb6e5('0x2')]={'name':{'type':Sequelize[_0xb6e5('0x3')],'unique':_0xb6e5('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xb6e5('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0xb6e5('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xb6e5('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb6e5('0x5')],'defaultValue':function(){return _0xb6e5('0x6');}},'notificationSound':{'type':Sequelize[_0xb6e5('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb6e5('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb6e5('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xb6e5('0x3')]},'queueTransfer':{'type':Sequelize[_0xb6e5('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb6e5('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb6e5('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb6e5('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xb6e5('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xb6e5('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2b0530){if(!_0x2b0530)this[_0xb6e5('0xa')](_0xb6e5('0xb'),null);this[_0xb6e5('0xa')](_0xb6e5('0xc'),_0x2b0530);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 999c5e2..9b30717 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 _0x26ce=['CannedAnswer','rows','removeAnswers','openchannel','Sequelize','difference','createdAt','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmContact','DESC','OpenchannelApplication','Applications','List','account','applications','list','orderBy','priority','asc','Contacts','ListId','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','messageId','interaction','created','close','*,*,*,*','OpenchannelMessage','AttachmentId','User','UserId','Start','startRouting','EventManager','notify','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','sendStatus','send','getApplications','getInteractions','Owner','Tag','color','tag','addAgents','ids','omit','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','out','Messages','dataValues','push','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','end','json','offset','undefined','count','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','index','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','show','params','Pause','keys','include','find','create','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','addAnswer','getAnswers'];(function(_0x55b33e,_0x52138e){var _0x291460=function(_0x3d50a7){while(--_0x3d50a7){_0x55b33e['push'](_0x55b33e['shift']());}};_0x291460(++_0x52138e);}(_0x26ce,0x114));var _0xe26c=function(_0x5585ca,_0x4c6c65){_0x5585ca=_0x5585ca-0x0;var _0x415be9=_0x26ce[_0x5585ca];return _0x415be9;};'use strict';var emlformat=require(_0xe26c('0x0'));var rimraf=require(_0xe26c('0x1'));var zipdir=require(_0xe26c('0x2'));var jsonpatch=require(_0xe26c('0x3'));var rp=require(_0xe26c('0x4'));var moment=require(_0xe26c('0x5'));var BPromise=require(_0xe26c('0x6'));var Mustache=require(_0xe26c('0x7'));var util=require(_0xe26c('0x8'));var path=require(_0xe26c('0x9'));var sox=require(_0xe26c('0xa'));var csv=require(_0xe26c('0xb'));var ejs=require(_0xe26c('0xc'));var fs=require('fs');var fs_extra=require(_0xe26c('0xd'));var _=require(_0xe26c('0xe'));var squel=require(_0xe26c('0xf'));var crypto=require(_0xe26c('0x10'));var jsforce=require(_0xe26c('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xe26c('0xb'));var querystring=require(_0xe26c('0x12'));var Papa=require(_0xe26c('0x13'));var Redis=require('ioredis');var authService=require(_0xe26c('0x14'));var qs=require(_0xe26c('0x15'));var as=require(_0xe26c('0x16'));var hardwareService=require(_0xe26c('0x17'));var logger=require(_0xe26c('0x18'))(_0xe26c('0x19'));var utils=require(_0xe26c('0x1a'));var config=require(_0xe26c('0x1b'));var licenseUtil=require(_0xe26c('0x1c'));var db=require('../../mysqldb')['db'];config[_0xe26c('0x1d')]=_[_0xe26c('0x1e')](config[_0xe26c('0x1d')],{'host':_0xe26c('0x1f'),'port':0x18eb});var socket=require(_0xe26c('0x20'))(new Redis(config['redis']));require(_0xe26c('0x21'))[_0xe26c('0x22')](socket);var jayson=require(_0xe26c('0x23'));var client=jayson[_0xe26c('0x24')][_0xe26c('0x25')]({'port':0x232c});var client9002=jayson[_0xe26c('0x24')][_0xe26c('0x25')]({'port':0x232a});function respondWithRpcPromise(_0x4da56c,_0x42c28f,_0x1ce6a0,_0x9e804e){return new BPromise(function(_0x1444a6,_0x44e020){var _0xc3a1fc=_0x9e804e||client;return _0xc3a1fc[_0xe26c('0x26')](_0x4da56c,_0x1ce6a0)[_0xe26c('0x27')](function(_0x8e5972){logger[_0xe26c('0x28')](_0xe26c('0x29'),_0x42c28f,'request\x20sent');logger[_0xe26c('0x2a')](_0xe26c('0x2b'),_0x42c28f,_0xe26c('0x2c'),JSON['stringify'](_0x8e5972));if(_0x8e5972[_0xe26c('0x2d')]){if(_0x8e5972[_0xe26c('0x2d')][_0xe26c('0x2e')]===0x1f4){logger['error'](_0xe26c('0x29'),_0x42c28f,_0x8e5972[_0xe26c('0x2d')][_0xe26c('0x2f')]);return _0x44e020(_0x8e5972['error'][_0xe26c('0x2f')]);}logger['error'](_0xe26c('0x29'),_0x42c28f,_0x8e5972['error'][_0xe26c('0x2f')]);return _0x1444a6(_0x8e5972[_0xe26c('0x2d')][_0xe26c('0x2f')]);}else{logger['info'](_0xe26c('0x29'),_0x42c28f,_0xe26c('0x2c'));_0x1444a6(_0x8e5972[_0xe26c('0x30')][_0xe26c('0x2f')]);}})[_0xe26c('0x31')](function(_0x5b25f1){logger[_0xe26c('0x2d')](_0xe26c('0x29'),_0x42c28f,_0x5b25f1);_0x44e020(_0x5b25f1);});});}function respondWithStatusCode(_0x529af2,_0x4de39d){_0x4de39d=_0x4de39d||0xcc;return function(_0x47c184){if(_0x47c184){return _0x529af2['sendStatus'](_0x4de39d);}return _0x529af2[_0xe26c('0x32')](_0x4de39d)[_0xe26c('0x33')]();};}function respondWithResult(_0x584cf0,_0x2af9c5){_0x2af9c5=_0x2af9c5||0xc8;return function(_0xb99885){if(_0xb99885){return _0x584cf0[_0xe26c('0x32')](_0x2af9c5)[_0xe26c('0x34')](_0xb99885);}};}function respondWithFilteredResult(_0x49d8e7,_0x1c7f31){return function(_0x323cbf){if(_0x323cbf){var _0x5d16b3=typeof _0x1c7f31[_0xe26c('0x35')]===_0xe26c('0x36')&&typeof _0x1c7f31['limit']===_0xe26c('0x36');var _0x1cbdb8=_0x323cbf[_0xe26c('0x37')];var _0x97511e=_0x5d16b3?0x0:_0x1c7f31[_0xe26c('0x35')];var _0x148ab9=_0x5d16b3?_0x323cbf[_0xe26c('0x37')]:_0x1c7f31[_0xe26c('0x35')]+_0x1c7f31['limit'];var _0xbb54f1;if(_0x148ab9>=_0x1cbdb8){_0x148ab9=_0x1cbdb8;_0xbb54f1=0xc8;}else{_0xbb54f1=0xce;}_0x49d8e7['status'](_0xbb54f1);return _0x49d8e7['set']('Content-Range',_0x97511e+'-'+_0x148ab9+'/'+_0x1cbdb8)[_0xe26c('0x34')](_0x323cbf);}return null;};}function patchUpdates(_0x44d1a1){return function(_0x314800){try{jsonpatch[_0xe26c('0x38')](_0x314800,_0x44d1a1,!![]);}catch(_0x418eb1){return BPromise[_0xe26c('0x39')](_0x418eb1);}return _0x314800[_0xe26c('0x3a')]();};}function saveUpdates(_0x4559e4,_0x36b60e){return function(_0x8be0c9){if(_0x8be0c9){return _0x8be0c9[_0xe26c('0x3b')](_0x4559e4)[_0xe26c('0x27')](function(_0x44675f){return _0x44675f;});}return null;};}function removeEntity(_0x48a7b6,_0xf23895){return function(_0x579c87){if(_0x579c87){return _0x579c87[_0xe26c('0x3c')]()[_0xe26c('0x27')](function(){var _0x2ed212=_0x579c87[_0xe26c('0x3d')]({'plain':!![]});var _0x1ed3b8=_0xe26c('0x3e');return db[_0xe26c('0x3f')]['destroy']({'where':{'type':_0x1ed3b8,'resourceId':_0x2ed212['id']}})['then'](function(){return _0x579c87;});})[_0xe26c('0x27')](function(){_0x48a7b6[_0xe26c('0x32')](0xcc)[_0xe26c('0x33')]();});}};}function handleEntityNotFound(_0x43c082,_0x5d5934){return function(_0x2fd931){if(!_0x2fd931){_0x43c082['sendStatus'](0x194);}return _0x2fd931;};}function handleError(_0xf38166,_0x354a6e){_0x354a6e=_0x354a6e||0x1f4;return function(_0x4e9580){logger[_0xe26c('0x2d')](_0x4e9580[_0xe26c('0x40')]);if(_0x4e9580[_0xe26c('0x41')]){delete _0x4e9580[_0xe26c('0x41')];}_0xf38166[_0xe26c('0x32')](_0x354a6e)['send'](_0x4e9580);};}exports[_0xe26c('0x42')]=function(_0x2060d1,_0x361463){var _0x3c8330={'include':[{'model':db['Pause'],'as':_0xe26c('0x43')}]},_0x528e49={},_0x3b1517={'count':0x0,'rows':[]};var _0x1df338=_[_0xe26c('0x44')](db[_0xe26c('0x45')][_0xe26c('0x46')],function(_0x30d615){return{'name':_0x30d615[_0xe26c('0x47')],'type':_0x30d615['type']['key']};});_0x528e49[_0xe26c('0x48')]=_['map'](_0x1df338,_0xe26c('0x41'));_0x528e49[_0xe26c('0x49')]=_['keys'](_0x2060d1['query']);_0x528e49[_0xe26c('0x4a')]=_[_0xe26c('0x4b')](_0x528e49['model'],_0x528e49['query']);_0x3c8330[_0xe26c('0x4c')]=_[_0xe26c('0x4b')](_0x528e49['model'],qs['fields'](_0x2060d1[_0xe26c('0x49')][_0xe26c('0x4d')]));_0x3c8330[_0xe26c('0x4c')]=_0x3c8330[_0xe26c('0x4c')][_0xe26c('0x4e')]?_0x3c8330[_0xe26c('0x4c')]:_0x528e49[_0xe26c('0x48')];if(!_0x2060d1[_0xe26c('0x49')][_0xe26c('0x4f')]('nolimit')){_0x3c8330[_0xe26c('0x50')]=qs[_0xe26c('0x50')](_0x2060d1['query'][_0xe26c('0x50')]);_0x3c8330[_0xe26c('0x35')]=qs[_0xe26c('0x35')](_0x2060d1[_0xe26c('0x49')][_0xe26c('0x35')]);}_0x3c8330[_0xe26c('0x51')]=qs['sort'](_0x2060d1[_0xe26c('0x49')][_0xe26c('0x52')]);_0x3c8330[_0xe26c('0x53')]=qs[_0xe26c('0x4a')](_[_0xe26c('0x54')](_0x2060d1[_0xe26c('0x49')],_0x528e49[_0xe26c('0x4a')]),_0x1df338);if(_0x2060d1['query'][_0xe26c('0x55')]){_0x3c8330[_0xe26c('0x53')]=_[_0xe26c('0x56')](_0x3c8330[_0xe26c('0x53')],{'$or':_['map'](_0x1df338,function(_0x5009fb){if(_0x5009fb[_0xe26c('0x57')]!==_0xe26c('0x58')){var _0x5b9410={};_0x5b9410[_0x5009fb['name']]={'$like':'%'+_0x2060d1[_0xe26c('0x49')][_0xe26c('0x55')]+'%'};return _0x5b9410;}})});}_0x3c8330=_['merge']({},_0x3c8330,_0x2060d1[_0xe26c('0x59')]);var _0x544248={'where':_0x3c8330[_0xe26c('0x53')]};return db[_0xe26c('0x45')][_0xe26c('0x37')](_0x544248)[_0xe26c('0x27')](function(_0x57474c){_0x3b1517[_0xe26c('0x37')]=_0x57474c;if(_0x2060d1[_0xe26c('0x49')][_0xe26c('0x5a')]){_0x3c8330['include']=[{'all':!![]}];}return db[_0xe26c('0x45')][_0xe26c('0x5b')](_0x3c8330);})[_0xe26c('0x27')](function(_0x2b3344){_0x3b1517['rows']=_0x2b3344;return _0x3b1517;})['then'](respondWithFilteredResult(_0x361463,_0x3c8330))[_0xe26c('0x31')](handleError(_0x361463,null));};exports[_0xe26c('0x5c')]=function(_0xdb81f7,_0x1415c0){var _0x36840c={'raw':![],'where':{'id':_0xdb81f7[_0xe26c('0x5d')]['id']},'include':[{'model':db[_0xe26c('0x5e')],'as':_0xe26c('0x43')}]},_0x41115f={};_0x41115f[_0xe26c('0x48')]=_[_0xe26c('0x5f')](db['OpenchannelAccount'][_0xe26c('0x46')]);_0x41115f[_0xe26c('0x49')]=_['keys'](_0xdb81f7[_0xe26c('0x49')]);_0x41115f['filters']=_['intersection'](_0x41115f['model'],_0x41115f['query']);_0x36840c['attributes']=_[_0xe26c('0x4b')](_0x41115f[_0xe26c('0x48')],qs[_0xe26c('0x4d')](_0xdb81f7[_0xe26c('0x49')][_0xe26c('0x4d')]));_0x36840c[_0xe26c('0x4c')]=_0x36840c[_0xe26c('0x4c')][_0xe26c('0x4e')]?_0x36840c[_0xe26c('0x4c')]:_0x41115f[_0xe26c('0x48')];if(_0xdb81f7[_0xe26c('0x49')][_0xe26c('0x5a')]){_0x36840c[_0xe26c('0x60')]=[{'all':!![]}];}_0x36840c=_[_0xe26c('0x56')]({},_0x36840c,_0xdb81f7[_0xe26c('0x59')]);return db[_0xe26c('0x45')][_0xe26c('0x61')](_0x36840c)['then'](handleEntityNotFound(_0x1415c0,null))[_0xe26c('0x27')](respondWithResult(_0x1415c0,null))['catch'](handleError(_0x1415c0,null));};exports[_0xe26c('0x62')]=function(_0x454553,_0x4a65b2){return db[_0xe26c('0x45')][_0xe26c('0x62')](_0x454553['body'],{})['then'](function(_0x2142bc){var _0x58c41d=_0x454553[_0xe26c('0x63')][_0xe26c('0x3d')]({'plain':!![]});if(!_0x58c41d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58c41d[_0xe26c('0x64')]==='user'){var _0x175136=_0x2142bc['get']({'plain':!![]});var _0x16e27a=_0xe26c('0x3e');return db['UserProfileSection']['find']({'where':{'name':_0x16e27a,'userProfileId':_0x58c41d[_0xe26c('0x65')]},'raw':!![]})[_0xe26c('0x27')](function(_0x36539f){if(_0x36539f&&_0x36539f[_0xe26c('0x66')]===0x0){return db[_0xe26c('0x3f')]['create']({'name':_0x175136['name'],'resourceId':_0x175136['id'],'type':_0x36539f[_0xe26c('0x41')],'sectionId':_0x36539f['id']},{})[_0xe26c('0x27')](function(){return _0x2142bc;});}else{return _0x2142bc;}})[_0xe26c('0x31')](function(_0x211136){logger[_0xe26c('0x2d')](_0xe26c('0x67'),_0x211136);throw _0x211136;});}return _0x2142bc;})[_0xe26c('0x27')](respondWithResult(_0x4a65b2,0xc9))[_0xe26c('0x31')](handleError(_0x4a65b2,null));};exports[_0xe26c('0x3b')]=function(_0x1f8474,_0x3cf2c4){if(_0x1f8474[_0xe26c('0x68')]['id']){delete _0x1f8474['body']['id'];}return db[_0xe26c('0x45')]['find']({'where':{'id':_0x1f8474[_0xe26c('0x5d')]['id']},'include':[{'model':db[_0xe26c('0x5e')],'as':_0xe26c('0x43')}]})[_0xe26c('0x27')](handleEntityNotFound(_0x3cf2c4,null))['then'](saveUpdates(_0x1f8474[_0xe26c('0x68')],null))[_0xe26c('0x27')](respondWithResult(_0x3cf2c4,null))[_0xe26c('0x31')](handleError(_0x3cf2c4,null));};exports['destroy']=function(_0x1cd21d,_0x280f0a){return db[_0xe26c('0x45')][_0xe26c('0x61')]({'where':{'id':_0x1cd21d[_0xe26c('0x5d')]['id']}})[_0xe26c('0x27')](handleEntityNotFound(_0x280f0a,null))[_0xe26c('0x27')](removeEntity(_0x280f0a,null))[_0xe26c('0x31')](handleError(_0x280f0a,null));};exports['describe']=function(_0x4bcb72,_0x28c09f){return db['OpenchannelAccount'][_0xe26c('0x69')]()[_0xe26c('0x27')](respondWithResult(_0x28c09f,null))['catch'](handleError(_0x28c09f,null));};exports['addDisposition']=function(_0x4d73e4,_0x4974d0,_0x378268){if(_0x4d73e4['body']['id']){delete _0x4d73e4[_0xe26c('0x68')]['id'];}return db['OpenchannelAccount'][_0xe26c('0x61')]({'where':{'id':_0x4d73e4[_0xe26c('0x5d')]['id']}})[_0xe26c('0x27')](handleEntityNotFound(_0x4974d0,null))[_0xe26c('0x27')](function(_0xce074a){if(_0xce074a){_0x4d73e4[_0xe26c('0x68')][_0xe26c('0x6a')]=_0xce074a['id'];return db[_0xe26c('0x6b')]['create'](_0x4d73e4[_0xe26c('0x68')]);}})[_0xe26c('0x27')](respondWithResult(_0x4974d0,null))[_0xe26c('0x31')](handleError(_0x4974d0,null));};exports[_0xe26c('0x6c')]=function(_0x1c8313,_0x5dfb5a,_0x5e81d8){var _0x379ead={'raw':![],'where':{}};var _0x229b6e={};var _0x2e6832={'count':0x0,'rows':[]};return db[_0xe26c('0x45')][_0xe26c('0x6d')]({'where':{'id':_0x1c8313[_0xe26c('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5dfb5a,null))[_0xe26c('0x27')](function(_0x4c82fe){if(_0x4c82fe){_0x229b6e[_0xe26c('0x48')]=_[_0xe26c('0x5f')](db[_0xe26c('0x6b')][_0xe26c('0x46')]);_0x229b6e[_0xe26c('0x49')]=_[_0xe26c('0x5f')](_0x1c8313[_0xe26c('0x49')]);_0x229b6e[_0xe26c('0x4a')]=_[_0xe26c('0x4b')](_0x229b6e['model'],_0x229b6e['query']);_0x379ead[_0xe26c('0x4c')]=_[_0xe26c('0x4b')](_0x229b6e[_0xe26c('0x48')],qs[_0xe26c('0x4d')](_0x1c8313[_0xe26c('0x49')][_0xe26c('0x4d')]));_0x379ead[_0xe26c('0x4c')]=_0x379ead[_0xe26c('0x4c')][_0xe26c('0x4e')]?_0x379ead['attributes']:_0x229b6e['model'];if(!_0x1c8313[_0xe26c('0x49')][_0xe26c('0x4f')](_0xe26c('0x6e'))){_0x379ead['limit']=qs[_0xe26c('0x50')](_0x1c8313[_0xe26c('0x49')][_0xe26c('0x50')]);_0x379ead[_0xe26c('0x35')]=qs[_0xe26c('0x35')](_0x1c8313[_0xe26c('0x49')][_0xe26c('0x35')]);}_0x379ead[_0xe26c('0x51')]=qs[_0xe26c('0x52')](_0x1c8313[_0xe26c('0x49')][_0xe26c('0x52')]);_0x379ead[_0xe26c('0x53')]=qs[_0xe26c('0x4a')](_[_0xe26c('0x54')](_0x1c8313[_0xe26c('0x49')],_0x229b6e['filters']));_0x379ead[_0xe26c('0x53')][_0xe26c('0x6a')]=_0x4c82fe['id'];if(_0x1c8313['query'][_0xe26c('0x55')]){_0x379ead['where']=_[_0xe26c('0x56')](_0x379ead[_0xe26c('0x53')],{'$or':_[_0xe26c('0x44')](_0x379ead[_0xe26c('0x4c')],function(_0x422fd7){var _0x2155cd={};_0x2155cd[_0x422fd7]={'$like':'%'+_0x1c8313[_0xe26c('0x49')][_0xe26c('0x55')]+'%'};return _0x2155cd;})});}_0x379ead=_[_0xe26c('0x56')]({},_0x379ead,_0x1c8313[_0xe26c('0x59')]);return db[_0xe26c('0x6b')]['count']({'where':_0x379ead[_0xe26c('0x53')]})['then'](function(_0x1ec8f4){_0x2e6832[_0xe26c('0x37')]=_0x1ec8f4;if(_0x1c8313[_0xe26c('0x49')][_0xe26c('0x5a')]){_0x379ead['include']=[{'all':!![]}];}return db['Disposition'][_0xe26c('0x5b')](_0x379ead);})[_0xe26c('0x27')](function(_0x420d09){_0x2e6832['rows']=_0x420d09;return _0x2e6832;});}})[_0xe26c('0x27')](respondWithFilteredResult(_0x5dfb5a,_0x379ead))[_0xe26c('0x31')](handleError(_0x5dfb5a,null));};exports[_0xe26c('0x6f')]=function(_0x415f0e,_0x316e88,_0x5c855c){return db[_0xe26c('0x45')]['find']({'where':{'id':_0x415f0e[_0xe26c('0x5d')]['id']}})[_0xe26c('0x27')](handleEntityNotFound(_0x316e88,null))[_0xe26c('0x27')](function(_0x4f8dbb){if(_0x4f8dbb){return _0x4f8dbb['removeDispositions'](_0x415f0e[_0xe26c('0x49')]['ids']);}})[_0xe26c('0x27')](respondWithStatusCode(_0x316e88,null))[_0xe26c('0x31')](handleError(_0x316e88,null));};exports[_0xe26c('0x70')]=function(_0x510d65,_0x5c158e,_0x5406a7){if(_0x510d65['body']['id']){delete _0x510d65[_0xe26c('0x68')]['id'];}return db[_0xe26c('0x45')][_0xe26c('0x61')]({'where':{'id':_0x510d65[_0xe26c('0x5d')]['id']}})[_0xe26c('0x27')](handleEntityNotFound(_0x5c158e,null))[_0xe26c('0x27')](function(_0x59aabb){if(_0x59aabb){_0x510d65[_0xe26c('0x68')][_0xe26c('0x6a')]=_0x59aabb['id'];return db['CannedAnswer'][_0xe26c('0x62')](_0x510d65['body']);}})[_0xe26c('0x27')](respondWithResult(_0x5c158e,null))['catch'](handleError(_0x5c158e,null));};exports[_0xe26c('0x71')]=function(_0x4d437b,_0x27f8d5,_0x54829a){var _0x4ecae2={'raw':![],'where':{}};var _0x44f9d2={};var _0x4877d4={'count':0x0,'rows':[]};return db[_0xe26c('0x45')][_0xe26c('0x6d')]({'where':{'id':_0x4d437b[_0xe26c('0x5d')]['id']}})['then'](handleEntityNotFound(_0x27f8d5,null))['then'](function(_0x570af1){if(_0x570af1){_0x44f9d2[_0xe26c('0x48')]=_[_0xe26c('0x5f')](db[_0xe26c('0x72')]['rawAttributes']);_0x44f9d2[_0xe26c('0x49')]=_[_0xe26c('0x5f')](_0x4d437b[_0xe26c('0x49')]);_0x44f9d2[_0xe26c('0x4a')]=_[_0xe26c('0x4b')](_0x44f9d2[_0xe26c('0x48')],_0x44f9d2[_0xe26c('0x49')]);_0x4ecae2[_0xe26c('0x4c')]=_[_0xe26c('0x4b')](_0x44f9d2[_0xe26c('0x48')],qs[_0xe26c('0x4d')](_0x4d437b[_0xe26c('0x49')][_0xe26c('0x4d')]));_0x4ecae2[_0xe26c('0x4c')]=_0x4ecae2[_0xe26c('0x4c')][_0xe26c('0x4e')]?_0x4ecae2[_0xe26c('0x4c')]:_0x44f9d2['model'];if(!_0x4d437b['query']['hasOwnProperty']('nolimit')){_0x4ecae2['limit']=qs[_0xe26c('0x50')](_0x4d437b[_0xe26c('0x49')][_0xe26c('0x50')]);_0x4ecae2['offset']=qs['offset'](_0x4d437b[_0xe26c('0x49')][_0xe26c('0x35')]);}_0x4ecae2[_0xe26c('0x51')]=qs[_0xe26c('0x52')](_0x4d437b[_0xe26c('0x49')][_0xe26c('0x52')]);_0x4ecae2[_0xe26c('0x53')]=qs['filters'](_[_0xe26c('0x54')](_0x4d437b[_0xe26c('0x49')],_0x44f9d2['filters']));_0x4ecae2[_0xe26c('0x53')][_0xe26c('0x6a')]=_0x570af1['id'];if(_0x4d437b[_0xe26c('0x49')][_0xe26c('0x55')]){_0x4ecae2[_0xe26c('0x53')]=_['merge'](_0x4ecae2[_0xe26c('0x53')],{'$or':_[_0xe26c('0x44')](_0x4ecae2[_0xe26c('0x4c')],function(_0x4c5482){var _0x2016f2={};_0x2016f2[_0x4c5482]={'$like':'%'+_0x4d437b[_0xe26c('0x49')][_0xe26c('0x55')]+'%'};return _0x2016f2;})});}_0x4ecae2=_[_0xe26c('0x56')]({},_0x4ecae2,_0x4d437b[_0xe26c('0x59')]);return db[_0xe26c('0x72')][_0xe26c('0x37')]({'where':_0x4ecae2[_0xe26c('0x53')]})[_0xe26c('0x27')](function(_0x324ddd){_0x4877d4['count']=_0x324ddd;if(_0x4d437b[_0xe26c('0x49')][_0xe26c('0x5a')]){_0x4ecae2[_0xe26c('0x60')]=[{'all':!![]}];}return db[_0xe26c('0x72')]['findAll'](_0x4ecae2);})[_0xe26c('0x27')](function(_0x40f646){_0x4877d4[_0xe26c('0x73')]=_0x40f646;return _0x4877d4;});}})[_0xe26c('0x27')](respondWithFilteredResult(_0x27f8d5,_0x4ecae2))[_0xe26c('0x31')](handleError(_0x27f8d5,null));};exports['removeAnswers']=function(_0x16be74,_0x1e58bd,_0x58abac){return db[_0xe26c('0x45')][_0xe26c('0x61')]({'where':{'id':_0x16be74['params']['id']}})[_0xe26c('0x27')](handleEntityNotFound(_0x1e58bd,null))[_0xe26c('0x27')](function(_0xdbb301){if(_0xdbb301){return _0xdbb301[_0xe26c('0x74')](_0x16be74[_0xe26c('0x49')]['ids']);}})['then'](respondWithStatusCode(_0x1e58bd,null))['catch'](handleError(_0x1e58bd,null));};exports['notify']=function(_0x57e7d9,_0x5680c5,_0x1ee731){var _0x160860={'body':_0x57e7d9[_0xe26c('0x68')],'channel':_0xe26c('0x75')};var _0x39555f=[];var _0x3018fb=[];var _0x563522={};var _0x19038f=![];return db['CmContact'][_0xe26c('0x69')]()[_0xe26c('0x27')](function(_0x5a4580){if(!_0x5a4580){throw new db[(_0xe26c('0x76'))]['ValidationError']('no\x20available\x20attributes');}_0x39555f=_[_0xe26c('0x77')](_['keys'](_0x5a4580),[_0xe26c('0x78'),_0xe26c('0x79')]);_0x3018fb=_[_0xe26c('0x77')](_[_0xe26c('0x5f')](_0x5a4580),['createdAt',_0xe26c('0x79'),_0xe26c('0x7a'),'ListId']);if(_0x57e7d9[_0xe26c('0x68')]['id']){delete _0x57e7d9[_0xe26c('0x68')]['id'];}if(_[_0xe26c('0x7b')](_0x57e7d9['body'][_0xe26c('0x7c')])){throw new db[(_0xe26c('0x76'))]['ValidationError'](_0xe26c('0x7d'));}if(_[_0xe26c('0x7b')](_0x57e7d9[_0xe26c('0x68')][_0xe26c('0x68')])||_0x57e7d9['body'][_0xe26c('0x68')]===''){throw new db[(_0xe26c('0x76'))][(_0xe26c('0x7e'))](_0xe26c('0x7f'));}if(_[_0xe26c('0x7b')](_0x57e7d9['body'][_0xe26c('0x80')])){throw new db[(_0xe26c('0x76'))]['ValidationError'](_0xe26c('0x81')+_0x3018fb);}if(!_[_0xe26c('0x82')](_0x3018fb,_0x57e7d9[_0xe26c('0x68')][_0xe26c('0x80')])){throw new db[(_0xe26c('0x76'))]['ValidationError'](_0xe26c('0x83')+_0x3018fb);}_0x563522[_0x57e7d9['body'][_0xe26c('0x80')]]=_0x57e7d9['body']['from'];})[_0xe26c('0x27')](function(){return db[_0xe26c('0x45')][_0xe26c('0x61')]({'where':{'id':_0x57e7d9[_0xe26c('0x5d')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xe26c('0x84')],'as':'Contacts','where':_0x563522,'limit':0x1,'order':[[_0xe26c('0x79'),_0xe26c('0x85')]]}]},{'model':db[_0xe26c('0x86')],'as':_0xe26c('0x87')}]});})['then'](handleEntityNotFound(_0x5680c5,null))[_0xe26c('0x27')](function(_0x349f34){if(_0x349f34&&_0x349f34[_0xe26c('0x88')]){_0x160860[_0xe26c('0x89')]=_0x349f34;_0x160860[_0xe26c('0x8a')]=_0x349f34['Applications'];_0x160860[_0xe26c('0x8b')]=_0x349f34[_0xe26c('0x88')];_0x160860[_0xe26c('0x8a')]=_[_0xe26c('0x8c')](_0x160860[_0xe26c('0x8a')],[_0xe26c('0x8d')],[_0xe26c('0x8e')]);if(_0x160860['account'][_0xe26c('0x87')]){delete _0x160860[_0xe26c('0x89')][_0xe26c('0x87')];}if(_0x160860[_0xe26c('0x89')][_0xe26c('0x88')]&&_0x160860['account'][_0xe26c('0x88')][_0xe26c('0x8f')]['length']){return _0x160860[_0xe26c('0x89')][_0xe26c('0x88')][_0xe26c('0x8f')][0x0];}var _0x197cb3=_[_0xe26c('0x1e')](_0x57e7d9[_0xe26c('0x68')],{'firstName':_0x57e7d9[_0xe26c('0x68')]['from'],'ListId':_0x349f34[_0xe26c('0x90')]});_0x197cb3[_0x57e7d9['body'][_0xe26c('0x80')]]=_0x57e7d9[_0xe26c('0x68')]['from'];return db['CmContact'][_0xe26c('0x62')](_0x197cb3,{'fields':_0x39555f,'raw':!![]});}})[_0xe26c('0x27')](handleEntityNotFound(_0x5680c5,null))[_0xe26c('0x27')](function(_0x101fcf){_0x160860[_0xe26c('0x91')]=_0x101fcf;if(_0x101fcf){var _0x155517={'ContactId':_0x101fcf['id'],'OpenchannelAccountId':_0x57e7d9[_0xe26c('0x5d')]['id'],'from':(_0x101fcf[_0xe26c('0x92')]||'')+'\x20'+(_0x101fcf[_0xe26c('0x93')]||'')};var _0x89344={'OpenchannelAccountId':_0x57e7d9[_0xe26c('0x5d')]['id'],'closed':![]};if(_0x57e7d9['body']['threadId']){_0x89344[_0xe26c('0x94')]=_0x57e7d9['body'][_0xe26c('0x94')];return db[_0xe26c('0x95')][_0xe26c('0x61')]({'where':_0x89344})['then'](function(_0x142376){if(_0x142376){return[_0x142376,![]];}_0x155517[_0xe26c('0x94')]=_0x57e7d9[_0xe26c('0x68')][_0xe26c('0x94')];_0x155517[_0xe26c('0x96')]=_0x57e7d9[_0xe26c('0x68')][_0xe26c('0x96')];return db[_0xe26c('0x95')][_0xe26c('0x62')](_0x155517)['then'](function(_0xe02ffa){return[_0xe02ffa,!![]];});});}else{_0x89344[_0xe26c('0x94')]=null;}_0x89344['ContactId']=_0x101fcf['id'];return db[_0xe26c('0x95')][_0xe26c('0x61')]({'where':_0x89344})[_0xe26c('0x27')](function(_0x3b6918){if(_0x3b6918){return[_0x3b6918,![]];}return db[_0xe26c('0x95')][_0xe26c('0x62')](_0x155517)['then'](function(_0x3995ff){return[_0x3995ff,!![]];});});}})['spread'](function(_0x59007c,_0x9ec1fa){if(_0x59007c){_0x19038f=_0x9ec1fa;if(!_0x9ec1fa){var _0x5e8ce3={'from':(_0x160860[_0xe26c('0x91')][_0xe26c('0x92')]||'')+'\x20'+(_0x160860[_0xe26c('0x91')][_0xe26c('0x93')]||'')};if(_0x57e7d9['body'][_0xe26c('0x94')]&&_0x57e7d9[_0xe26c('0x68')][_0xe26c('0x97')]&&_0x57e7d9[_0xe26c('0x68')][_0xe26c('0x94')]!=_0x57e7d9[_0xe26c('0x68')][_0xe26c('0x97')]){_0x5e8ce3[_0xe26c('0x94')]=_0x57e7d9[_0xe26c('0x68')]['messageId'];}return _0x59007c['update'](_0x5e8ce3);}else{return _0x59007c;}}})['then'](function(_0x5c6aec){_0x160860['interaction']=_0x5c6aec['get']({'plain':!![]});_0x160860[_0xe26c('0x98')][_0xe26c('0x99')]=_0x19038f;if(_0x160860[_0xe26c('0x98')]['created']){if(_0x160860[_0xe26c('0x89')]['autoclose']){_0x160860['applications']['push']({'id':0x0,'priority':_0x160860[_0xe26c('0x8a')][_0xe26c('0x4e')]+0x1,'app':_0xe26c('0x9a'),'appdata':'unmanaged','interval':_0xe26c('0x9b')});}}return db[_0xe26c('0x9c')][_0xe26c('0x62')]({'body':_0x57e7d9['body']['body'],'OpenchannelAccountId':_0x57e7d9[_0xe26c('0x5d')]['id'],'OpenchannelInteractionId':_0x5c6aec['id'],'direction':'in','ContactId':_0x160860[_0xe26c('0x91')]['id'],'AttachmentId':_0x57e7d9['body'][_0xe26c('0x9d')]});})[_0xe26c('0x27')](function(_0x4bf312){_0x160860['message']=_0x4bf312;if(_0x160860[_0xe26c('0x98')]['UserId']){return db[_0xe26c('0x9e')]['find']({'attributes':['id',_0xe26c('0x41')],'where':{'id':_0x160860['interaction'][_0xe26c('0x9f')]}})[_0xe26c('0x27')](function(_0x5456e6){if(_0x5456e6){_0x160860[_0xe26c('0x8a')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5456e6[_0xe26c('0x41')]+','+(_0x160860[_0xe26c('0x89')]['waitForTheAssignedAgent']||0xa),'interval':_0xe26c('0x9b')});_0x160860['forcedOwnership']=![];}return respondWithRpcPromise(_0xe26c('0xa0'),'startRouting',_0x160860);});}return respondWithRpcPromise(_0xe26c('0xa0'),_0xe26c('0xa1'),_0x160860);})['then'](function(_0x4e1e4a){respondWithRpcPromise(_0xe26c('0xa2'),_0xe26c('0xa2'),{'event':_0xe26c('0xa3'),'message':_0x4e1e4a},client9002);return _0x4e1e4a;})['then'](respondWithResult(_0x5680c5,null))[_0xe26c('0x31')](handleError(_0x5680c5,null));};exports[_0xe26c('0xa4')]=function(_0x17154d,_0x37c9b){var _0x3c40b0=_0x17154d['params']['id'];var _0x5d4494=_0x17154d['body'];var _0x22a946=0xc8;var _0x29fbb9=null;return db[_0xe26c('0xa5')][_0xe26c('0xa6')]({'isolationLevel':db['sequelize']['Transaction'][_0xe26c('0xa7')][_0xe26c('0xa8')]},function(_0x4d4d46){return db[_0xe26c('0x45')]['findOne']({'where':{'id':_0x3c40b0},'transaction':_0x4d4d46})[_0xe26c('0x27')](function(_0x4a95dd){if(_0x4a95dd){return db['OpenchannelApplication'][_0xe26c('0x3c')]({'where':{'OpenchannelAccountId':_0x3c40b0},'transaction':_0x4d4d46})[_0xe26c('0x27')](function(){var _0x48cff5=_[_0xe26c('0x44')](_0x5d4494,function(_0x23684c){_0x23684c['OpenchannelAccountId']=_0x3c40b0;return _0x23684c;});return db[_0xe26c('0x86')][_0xe26c('0xa9')](_0x48cff5,{'transaction':_0x4d4d46});});}else{_0x22a946=0x194;_0x29fbb9=[];}});})[_0xe26c('0x27')](function(){if(_0x22a946!==0x194){return db[_0xe26c('0x86')][_0xe26c('0xaa')]({'where':{'OpenchannelAccountId':_0x3c40b0},'order':_0xe26c('0x8d')})['then'](function(_0x4eb9a9){_0x29fbb9=_0x4eb9a9;});}})['catch'](function(_0x57473f){_0x22a946=0x1f4;logger[_0xe26c('0x2d')](_0x57473f['stack']);if(_0x57473f[_0xe26c('0x41')]){delete _0x57473f[_0xe26c('0x41')];}_0x29fbb9=_0x57473f;})[_0xe26c('0xab')](function(){if(_0x29fbb9===null){_0x37c9b[_0xe26c('0xac')](_0x22a946);}else{if(_0x22a946===0x1f4){_0x37c9b[_0xe26c('0x32')](_0x22a946)[_0xe26c('0xad')](_0x29fbb9);}else{_0x37c9b[_0xe26c('0x32')](_0x22a946)[_0xe26c('0x34')](_0x29fbb9);}}});};exports['getApplications']=function(_0x54a917,_0x21c483,_0x481b9d){var _0x303f81={};var _0x5cf439={};var _0x3de38e;var _0x2c5f64;return db[_0xe26c('0x45')][_0xe26c('0x6d')]({'where':{'id':_0x54a917[_0xe26c('0x5d')]['id']}})[_0xe26c('0x27')](handleEntityNotFound(_0x21c483,null))['then'](function(_0x50a433){if(_0x50a433){_0x3de38e=_0x50a433;_0x5cf439[_0xe26c('0x48')]=_['keys'](db['OpenchannelApplication']['rawAttributes']);_0x5cf439[_0xe26c('0x49')]=_[_0xe26c('0x5f')](_0x54a917[_0xe26c('0x49')]);_0x5cf439[_0xe26c('0x4a')]=_[_0xe26c('0x4b')](_0x5cf439['model'],_0x5cf439[_0xe26c('0x49')]);_0x303f81[_0xe26c('0x4c')]=_[_0xe26c('0x4b')](_0x5cf439[_0xe26c('0x48')],qs[_0xe26c('0x4d')](_0x54a917[_0xe26c('0x49')][_0xe26c('0x4d')]));_0x303f81[_0xe26c('0x4c')]=_0x303f81[_0xe26c('0x4c')][_0xe26c('0x4e')]?_0x303f81[_0xe26c('0x4c')]:_0x5cf439[_0xe26c('0x48')];_0x303f81['order']=qs[_0xe26c('0x52')](_0x54a917['query'][_0xe26c('0x52')]);_0x303f81[_0xe26c('0x53')]=qs[_0xe26c('0x4a')](_[_0xe26c('0x54')](_0x54a917[_0xe26c('0x49')],_0x5cf439['filters']));if(_0x54a917[_0xe26c('0x49')][_0xe26c('0x55')]){_0x303f81[_0xe26c('0x53')]=_['merge'](_0x303f81[_0xe26c('0x53')],{'$or':_['map'](_0x303f81[_0xe26c('0x4c')],function(_0x232322){var _0x137bb3={};_0x137bb3[_0x232322]={'$like':'%'+_0x54a917[_0xe26c('0x49')][_0xe26c('0x55')]+'%'};return _0x137bb3;})});}_0x303f81=_[_0xe26c('0x56')]({},_0x303f81,_0x54a917[_0xe26c('0x59')]);return _0x3de38e[_0xe26c('0xae')](_0x303f81);}})[_0xe26c('0x27')](function(_0x230259){if(_0x230259){_0x2c5f64=_0x230259[_0xe26c('0x4e')];if(!_0x54a917['query']['hasOwnProperty'](_0xe26c('0x6e'))){_0x303f81[_0xe26c('0x50')]=qs[_0xe26c('0x50')](_0x54a917[_0xe26c('0x49')][_0xe26c('0x50')]);_0x303f81[_0xe26c('0x35')]=qs['offset'](_0x54a917[_0xe26c('0x49')]['offset']);}return _0x3de38e[_0xe26c('0xae')](_0x303f81);}})['then'](function(_0x34993e){if(_0x34993e){return _0x34993e?{'count':_0x2c5f64,'rows':_0x34993e}:null;}})[_0xe26c('0x27')](respondWithResult(_0x21c483,null))[_0xe26c('0x31')](handleError(_0x21c483,null));};exports[_0xe26c('0xaf')]=function(_0xd5dca0,_0x134c2f,_0x40fbab){var _0x415e6b={'raw':![],'where':{}};var _0x271d57={};var _0x5099b6={'count':0x0,'rows':[]};return db[_0xe26c('0x45')][_0xe26c('0x6d')]({'where':{'id':_0xd5dca0[_0xe26c('0x5d')]['id']}})[_0xe26c('0x27')](handleEntityNotFound(_0x134c2f,null))[_0xe26c('0x27')](function(_0x3d7535){if(_0x3d7535){_0x271d57['model']=_['keys'](db[_0xe26c('0x95')][_0xe26c('0x46')]);_0x271d57[_0xe26c('0x49')]=_[_0xe26c('0x5f')](_0xd5dca0['query']);_0x271d57[_0xe26c('0x4a')]=_[_0xe26c('0x4b')](_0x271d57[_0xe26c('0x48')],_0x271d57[_0xe26c('0x49')]);_0x415e6b[_0xe26c('0x4c')]=_[_0xe26c('0x4b')](_0x271d57[_0xe26c('0x48')],qs[_0xe26c('0x4d')](_0xd5dca0['query'][_0xe26c('0x4d')]));_0x415e6b[_0xe26c('0x4c')]=_0x415e6b['attributes']['length']?_0x415e6b[_0xe26c('0x4c')]:_0x271d57[_0xe26c('0x48')];if(!_0xd5dca0['query']['hasOwnProperty'](_0xe26c('0x6e'))){_0x415e6b['limit']=qs[_0xe26c('0x50')](_0xd5dca0[_0xe26c('0x49')][_0xe26c('0x50')]);_0x415e6b[_0xe26c('0x35')]=qs['offset'](_0xd5dca0['query'][_0xe26c('0x35')]);}_0x415e6b['order']=qs[_0xe26c('0x52')](_0xd5dca0['query'][_0xe26c('0x52')]);_0x415e6b[_0xe26c('0x53')]=qs[_0xe26c('0x4a')](_[_0xe26c('0x54')](_0xd5dca0[_0xe26c('0x49')],_0x271d57['filters']));_0x415e6b[_0xe26c('0x53')]['OpenchannelAccountId']=_0x3d7535['id'];if(_0xd5dca0[_0xe26c('0x49')]['filter']){_0x415e6b['where']=_['merge'](_0x415e6b[_0xe26c('0x53')],{'$or':_[_0xe26c('0x44')](_0x415e6b[_0xe26c('0x4c')],function(_0x24d34a){var _0x164eb7={};_0x164eb7[_0x24d34a]={'$like':'%'+_0xd5dca0[_0xe26c('0x49')]['filter']+'%'};return _0x164eb7;})});}_0x415e6b=_[_0xe26c('0x56')]({},_0x415e6b,_0xd5dca0[_0xe26c('0x59')]);return db[_0xe26c('0x95')][_0xe26c('0x37')]({'where':_0x415e6b['where']})[_0xe26c('0x27')](function(_0xf3318a){_0x5099b6[_0xe26c('0x37')]=_0xf3318a;if(_0xd5dca0[_0xe26c('0x49')][_0xe26c('0x5a')]){_0x415e6b['include']=[{'model':db[_0xe26c('0x84')],'as':'Contact','required':![]},{'model':db[_0xe26c('0x9e')],'as':_0xe26c('0xb0'),'attributes':['name','fullname','internal'],'required':![]},{'model':db[_0xe26c('0xb1')],'as':'Tags','attributes':['id','name',_0xe26c('0xb2')],'where':_0xd5dca0[_0xe26c('0x49')][_0xe26c('0xb3')]?{'id':_0xd5dca0['query'][_0xe26c('0xb3')]}:undefined,'required':_0xd5dca0[_0xe26c('0x49')][_0xe26c('0xb3')]?!![]:![]}];}return db[_0xe26c('0x95')][_0xe26c('0x5b')](_0x415e6b);})['then'](function(_0x313998){_0x5099b6[_0xe26c('0x73')]=_0x313998;return _0x5099b6;});}})[_0xe26c('0x27')](respondWithFilteredResult(_0x134c2f,_0x415e6b))['catch'](handleError(_0x134c2f,null));};exports['addAgents']=function(_0x3bec67,_0x1366b4,_0x1b22f4){return db[_0xe26c('0x45')][_0xe26c('0x61')]({'where':{'id':_0x3bec67[_0xe26c('0x5d')]['id']}})[_0xe26c('0x27')](handleEntityNotFound(_0x1366b4,null))[_0xe26c('0x27')](function(_0x522278){if(_0x522278){return _0x522278[_0xe26c('0xb4')](_0x3bec67[_0xe26c('0x68')][_0xe26c('0xb5')],_[_0xe26c('0xb6')](_0x3bec67['body'],[_0xe26c('0xb5'),'id'])||{})[_0xe26c('0xb7')](function(_0x58327b){for(var _0xb751e9=0x0;_0xb751e9<_0x3bec67['body'][_0xe26c('0xb5')]['length'];_0xb751e9+=0x1){socket[_0xe26c('0xb8')](_0xe26c('0xb9'),{'UserId':Number(_0x3bec67['body'][_0xe26c('0xb5')][_0xb751e9]),'OpenchannelAccountId':Number(_0x3bec67[_0xe26c('0x5d')]['id'])});}return _0x58327b;});}})[_0xe26c('0x27')](respondWithResult(_0x1366b4,null))[_0xe26c('0x31')](handleError(_0x1366b4,null));};exports[_0xe26c('0xba')]=function(_0x825231,_0x217038,_0x31bd92){return db[_0xe26c('0x45')][_0xe26c('0x61')]({'where':{'id':_0x825231[_0xe26c('0x5d')]['id']}})[_0xe26c('0x27')](handleEntityNotFound(_0x217038,null))[_0xe26c('0x27')](function(_0x1a1ad1){if(_0x1a1ad1){return _0x1a1ad1['removeAgents'](_0x825231[_0xe26c('0x49')][_0xe26c('0xb5')])['then'](function(){if(_[_0xe26c('0xbb')](_0x825231['query'][_0xe26c('0xb5')])){for(var _0x2753ad=0x0;_0x2753ad<_0x825231['query'][_0xe26c('0xb5')][_0xe26c('0x4e')];_0x2753ad+=0x1){socket[_0xe26c('0xb8')](_0xe26c('0xbc'),{'UserId':Number(_0x825231[_0xe26c('0x49')][_0xe26c('0xb5')][_0x2753ad]),'OpenchannelAccountId':Number(_0x825231[_0xe26c('0x5d')]['id'])});}}else{socket['emit'](_0xe26c('0xbc'),{'UserId':Number(_0x825231[_0xe26c('0x49')][_0xe26c('0xb5')]),'OpenchannelAccountId':Number(_0x825231[_0xe26c('0x5d')]['id'])});}});}})[_0xe26c('0x27')](respondWithStatusCode(_0x217038,null))['catch'](handleError(_0x217038,null));};exports['getAgents']=function(_0x4bff76,_0x36170d,_0x27855f){var _0x203f19={};var _0x37291c={};var _0x2d7215;var _0xa82cb0;return db[_0xe26c('0x45')]['findOne']({'where':{'id':_0x4bff76[_0xe26c('0x5d')]['id']}})[_0xe26c('0x27')](handleEntityNotFound(_0x36170d,null))[_0xe26c('0x27')](function(_0x2ee067){if(_0x2ee067){_0x2d7215=_0x2ee067;_0x37291c[_0xe26c('0x48')]=_['keys'](db[_0xe26c('0x9e')]['rawAttributes']);_0x37291c[_0xe26c('0x49')]=_[_0xe26c('0x5f')](_0x4bff76[_0xe26c('0x49')]);_0x37291c[_0xe26c('0x4a')]=_[_0xe26c('0x4b')](_0x37291c['model'],_0x37291c[_0xe26c('0x49')]);_0x203f19[_0xe26c('0x4c')]=_[_0xe26c('0x4b')](_0x37291c[_0xe26c('0x48')],qs['fields'](_0x4bff76['query'][_0xe26c('0x4d')]));_0x203f19['attributes']=_0x203f19['attributes'][_0xe26c('0x4e')]?_0x203f19['attributes']:_0x37291c[_0xe26c('0x48')];_0x203f19['order']=qs[_0xe26c('0x52')](_0x4bff76[_0xe26c('0x49')]['sort']);_0x203f19['where']=qs['filters'](_[_0xe26c('0x54')](_0x4bff76['query'],_0x37291c['filters']));if(_0x4bff76[_0xe26c('0x49')]['filter']){_0x203f19[_0xe26c('0x53')]=_[_0xe26c('0x56')](_0x203f19[_0xe26c('0x53')],{'$or':_[_0xe26c('0x44')](_0x203f19['attributes'],function(_0x238a59){var _0x5c4ec8={};_0x5c4ec8[_0x238a59]={'$like':'%'+_0x4bff76[_0xe26c('0x49')][_0xe26c('0x55')]+'%'};return _0x5c4ec8;})});}_0x203f19=_[_0xe26c('0x56')]({},_0x203f19,_0x4bff76[_0xe26c('0x59')]);return _0x2d7215[_0xe26c('0xbd')](_0x203f19);}})[_0xe26c('0x27')](function(_0x4b68db){if(_0x4b68db){_0xa82cb0=_0x4b68db['length'];if(!_0x4bff76['query']['hasOwnProperty'](_0xe26c('0x6e'))){_0x203f19['limit']=qs[_0xe26c('0x50')](_0x4bff76[_0xe26c('0x49')][_0xe26c('0x50')]);_0x203f19['offset']=qs[_0xe26c('0x35')](_0x4bff76[_0xe26c('0x49')][_0xe26c('0x35')]);}return _0x2d7215[_0xe26c('0xbd')](_0x203f19);}})[_0xe26c('0x27')](function(_0x1605a6){if(_0x1605a6){return _0x1605a6?{'count':_0xa82cb0,'rows':_0x1605a6}:null;}})[_0xe26c('0x27')](respondWithResult(_0x36170d,null))[_0xe26c('0x31')](handleError(_0x36170d,null));};exports[_0xe26c('0xad')]=function(_0x51387b,_0x1a5074,_0x4f0640){var _0x5dccc4,_0x339a51,_0x1d1bcb;if(_[_0xe26c('0x7b')](_0x51387b['body'][_0xe26c('0x68')])||_0x51387b[_0xe26c('0x68')]['body']===''){throw new db[(_0xe26c('0x76'))][(_0xe26c('0x7e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xe26c('0x7b')](_0x51387b[_0xe26c('0x68')]['to'])){}_0x5dccc4=_0x51387b[_0xe26c('0x68')]['to'];return db[_0xe26c('0x45')]['findOne']({'where':{'id':_0x51387b['params']['id']}})[_0xe26c('0x27')](handleEntityNotFound(_0x1a5074,null))['then'](function(_0x3cd376){if(_0x3cd376){return db[_0xe26c('0x45')][_0xe26c('0x61')]({'where':{'id':_0x3cd376['id']},'include':[{'model':db[_0xe26c('0xbe')],'as':_0xe26c('0x88'),'include':[{'model':db[_0xe26c('0x84')],'as':_0xe26c('0x8f'),'where':{[_0x3cd376[_0xe26c('0x80')]]:_0x5dccc4},'limit':0x1,'order':[[_0xe26c('0x79'),_0xe26c('0x85')]]}]}]})['then'](handleEntityNotFound(_0x1a5074,null))[_0xe26c('0x27')](function(_0x3f8f5b){if(_0x3f8f5b&&_0x3f8f5b[_0xe26c('0x88')]){_0x339a51=_0x3f8f5b['get']({'plain':!![]});if(_0x339a51[_0xe26c('0x88')]&&_0x339a51[_0xe26c('0x88')][_0xe26c('0x8f')][_0xe26c('0x4e')]){return _0x339a51[_0xe26c('0x88')][_0xe26c('0x8f')][0x0];}return db['CmContact']['create'](_['defaults'](_0x51387b[_0xe26c('0x68')],{'firstName':_0x5dccc4,[_0x3f8f5b[_0xe26c('0x80')]]:_0x5dccc4,'phone':_0x5dccc4,'ListId':_0x339a51[_0xe26c('0x90')]}));}})[_0xe26c('0x27')](handleEntityNotFound(_0x1a5074,null))[_0xe26c('0x27')](function(_0x2004b5){if(_0x2004b5){_0x1d1bcb=_0x2004b5;return db[_0xe26c('0x95')][_0xe26c('0x61')]({'where':{'ContactId':_0x1d1bcb['id'],'closed':![],'OpenchannelAccountId':_0x339a51['id']}})[_0xe26c('0x27')](function(_0x3db772){if(_0x3db772){return[_0x3db772,![]];}return db[_0xe26c('0x95')][_0xe26c('0x62')]({'UserId':_0x51387b[_0xe26c('0x63')]['id'],'ContactId':_0x1d1bcb['id'],'OpenchannelAccountId':_0x339a51['id'],'lastMsgDirection':_0xe26c('0xbf'),'Messages':[_[_0xe26c('0x56')](_0x51387b[_0xe26c('0x68')],{'read':![],'body':_0x51387b[_0xe26c('0x68')][_0xe26c('0x68')],'OpenchannelAccountId':_0x339a51['id'],'UserId':_0x51387b[_0xe26c('0x63')]['id'],'ContactId':_0x1d1bcb['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xe26c('0xc0')}]})[_0xe26c('0x27')](function(_0x2af665){return[_0x2af665,!![]];});});}})['spread'](function(_0x3b5022,_0x2e7f11){if(_0x2e7f11){return _0x3b5022;}return db[_0xe26c('0x9c')]['create'](_[_0xe26c('0x56')](_0x51387b[_0xe26c('0x68')],{'read':![],'body':_0x51387b[_0xe26c('0x68')][_0xe26c('0x68')],'OpenchannelAccountId':_0x339a51['id'],'OpenchannelInteractionId':_0x3b5022['id'],'UserId':_0x51387b[_0xe26c('0x63')]['id'],'ContactId':_0x1d1bcb['id']}))[_0xe26c('0x27')](function(_0x83df47){_0x3b5022[_0xe26c('0xc1')][_0xe26c('0xc0')]=[];_0x3b5022[_0xe26c('0xc1')][_0xe26c('0xc0')][_0xe26c('0xc2')](_0x83df47['dataValues']);return _0x3b5022;});});}})[_0xe26c('0x27')](respondWithResult(_0x1a5074,null))['catch'](handleError(_0x1a5074,null));}; \ No newline at end of file +var _0xc809=['type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','OpenchannelAccount','includeAll','include','findAll','show','params','Pause','keys','length','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','getDispositions','findOne','Disposition','OpenchannelAccountId','rows','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','notify','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','OpenchannelApplication','account','list','applications','orderBy','priority','asc','Applications','defaults','ListId','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','sequelize','transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','User','Owner','internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','DESC','out','OpenchannelMessage','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','localhost','./openchannelAccount.socket','client','request','then','info','request\x20sent','debug','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','rawAttributes','fieldName'];(function(_0xcab3a0,_0x2a50d0){var _0x809b33=function(_0x559397){while(--_0x559397){_0xcab3a0['push'](_0xcab3a0['shift']());}};_0x809b33(++_0x2a50d0);}(_0xc809,0x13c));var _0x9c80=function(_0xddcfd0,_0x1a75aa){_0xddcfd0=_0xddcfd0-0x0;var _0x43207a=_0xc809[_0xddcfd0];return _0x43207a;};'use strict';var emlformat=require(_0x9c80('0x0'));var rimraf=require(_0x9c80('0x1'));var zipdir=require(_0x9c80('0x2'));var jsonpatch=require(_0x9c80('0x3'));var rp=require(_0x9c80('0x4'));var moment=require(_0x9c80('0x5'));var BPromise=require(_0x9c80('0x6'));var Mustache=require(_0x9c80('0x7'));var util=require(_0x9c80('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x9c80('0x9'));var ejs=require(_0x9c80('0xa'));var fs=require('fs');var fs_extra=require(_0x9c80('0xb'));var _=require(_0x9c80('0xc'));var squel=require(_0x9c80('0xd'));var crypto=require(_0x9c80('0xe'));var jsforce=require(_0x9c80('0xf'));var deskjs=require(_0x9c80('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9c80('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9c80('0x12'));var hardwareService=require(_0x9c80('0x13'));var logger=require('../../config/logger')(_0x9c80('0x14'));var utils=require(_0x9c80('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9c80('0x16'))['db'];config[_0x9c80('0x17')]=_['defaults'](config[_0x9c80('0x17')],{'host':_0x9c80('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9c80('0x19'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x9c80('0x1a')]['http']({'port':0x232c});var client9002=jayson[_0x9c80('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d436c,_0x20d745,_0xa9f9f8,_0x54486c){return new BPromise(function(_0x3f2a29,_0x414273){var _0x56e903=_0x54486c||client;return _0x56e903[_0x9c80('0x1b')](_0x2d436c,_0xa9f9f8)[_0x9c80('0x1c')](function(_0x60429b){logger[_0x9c80('0x1d')]('OpenchannelAccount,\x20%s,\x20%s',_0x20d745,_0x9c80('0x1e'));logger[_0x9c80('0x1f')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x20d745,_0x9c80('0x1e'),JSON[_0x9c80('0x20')](_0x60429b));if(_0x60429b[_0x9c80('0x21')]){if(_0x60429b[_0x9c80('0x21')][_0x9c80('0x22')]===0x1f4){logger[_0x9c80('0x21')](_0x9c80('0x23'),_0x20d745,_0x60429b[_0x9c80('0x21')][_0x9c80('0x24')]);return _0x414273(_0x60429b['error'][_0x9c80('0x24')]);}logger['error'](_0x9c80('0x23'),_0x20d745,_0x60429b[_0x9c80('0x21')]['message']);return _0x3f2a29(_0x60429b[_0x9c80('0x21')]['message']);}else{logger[_0x9c80('0x1d')]('OpenchannelAccount,\x20%s,\x20%s',_0x20d745,_0x9c80('0x1e'));_0x3f2a29(_0x60429b['result'][_0x9c80('0x24')]);}})[_0x9c80('0x25')](function(_0x47c4f4){logger[_0x9c80('0x21')](_0x9c80('0x23'),_0x20d745,_0x47c4f4);_0x414273(_0x47c4f4);});});}function respondWithStatusCode(_0x3c015e,_0x3fa317){_0x3fa317=_0x3fa317||0xcc;return function(_0x397706){if(_0x397706){return _0x3c015e[_0x9c80('0x26')](_0x3fa317);}return _0x3c015e[_0x9c80('0x27')](_0x3fa317)[_0x9c80('0x28')]();};}function respondWithResult(_0x5b2406,_0x25706c){_0x25706c=_0x25706c||0xc8;return function(_0x52e8d2){if(_0x52e8d2){return _0x5b2406[_0x9c80('0x27')](_0x25706c)['json'](_0x52e8d2);}};}function respondWithFilteredResult(_0x100738,_0x56e647){return function(_0x1fe72a){if(_0x1fe72a){var _0x36fa58=typeof _0x56e647[_0x9c80('0x29')]===_0x9c80('0x2a')&&typeof _0x56e647[_0x9c80('0x2b')]===_0x9c80('0x2a');var _0x3d219a=_0x1fe72a[_0x9c80('0x2c')];var _0xf3ce5c=_0x36fa58?0x0:_0x56e647[_0x9c80('0x29')];var _0xebc9f7=_0x36fa58?_0x1fe72a['count']:_0x56e647['offset']+_0x56e647['limit'];var _0x5123ba;if(_0xebc9f7>=_0x3d219a){_0xebc9f7=_0x3d219a;_0x5123ba=0xc8;}else{_0x5123ba=0xce;}_0x100738['status'](_0x5123ba);return _0x100738['set'](_0x9c80('0x2d'),_0xf3ce5c+'-'+_0xebc9f7+'/'+_0x3d219a)['json'](_0x1fe72a);}return null;};}function patchUpdates(_0x41a4ae){return function(_0x4c9ac5){try{jsonpatch[_0x9c80('0x2e')](_0x4c9ac5,_0x41a4ae,!![]);}catch(_0x1ec0e5){return BPromise[_0x9c80('0x2f')](_0x1ec0e5);}return _0x4c9ac5[_0x9c80('0x30')]();};}function saveUpdates(_0x3968d9,_0x191a9b){return function(_0x71e76c){if(_0x71e76c){return _0x71e76c[_0x9c80('0x31')](_0x3968d9)['then'](function(_0x3cc1d9){return _0x3cc1d9;});}return null;};}function removeEntity(_0x56b4a5,_0x38476a){return function(_0x5229f0){if(_0x5229f0){return _0x5229f0[_0x9c80('0x32')]()['then'](function(){var _0x1e926b=_0x5229f0[_0x9c80('0x33')]({'plain':!![]});var _0x5c3448=_0x9c80('0x34');return db[_0x9c80('0x35')][_0x9c80('0x32')]({'where':{'type':_0x5c3448,'resourceId':_0x1e926b['id']}})['then'](function(){return _0x5229f0;});})[_0x9c80('0x1c')](function(){_0x56b4a5[_0x9c80('0x27')](0xcc)[_0x9c80('0x28')]();});}};}function handleEntityNotFound(_0x5e4423,_0x4136f6){return function(_0x48b4de){if(!_0x48b4de){_0x5e4423[_0x9c80('0x26')](0x194);}return _0x48b4de;};}function handleError(_0x53dde8,_0x4090dd){_0x4090dd=_0x4090dd||0x1f4;return function(_0xad2be4){logger[_0x9c80('0x21')](_0xad2be4[_0x9c80('0x36')]);if(_0xad2be4[_0x9c80('0x37')]){delete _0xad2be4['name'];}_0x53dde8[_0x9c80('0x27')](_0x4090dd)[_0x9c80('0x38')](_0xad2be4);};}exports[_0x9c80('0x39')]=function(_0x4a6314,_0x35b042){var _0x3b72d3={'include':[{'model':db['Pause'],'as':_0x9c80('0x3a')}]},_0xc4357={},_0x2b81c7={'count':0x0,'rows':[]};var _0x2a7474=_[_0x9c80('0x3b')](db['OpenchannelAccount'][_0x9c80('0x3c')],function(_0x406f27){return{'name':_0x406f27[_0x9c80('0x3d')],'type':_0x406f27[_0x9c80('0x3e')][_0x9c80('0x3f')]};});_0xc4357['model']=_[_0x9c80('0x3b')](_0x2a7474,_0x9c80('0x37'));_0xc4357[_0x9c80('0x40')]=_['keys'](_0x4a6314['query']);_0xc4357[_0x9c80('0x41')]=_['intersection'](_0xc4357['model'],_0xc4357[_0x9c80('0x40')]);_0x3b72d3['attributes']=_[_0x9c80('0x42')](_0xc4357[_0x9c80('0x43')],qs[_0x9c80('0x44')](_0x4a6314[_0x9c80('0x40')][_0x9c80('0x44')]));_0x3b72d3[_0x9c80('0x45')]=_0x3b72d3[_0x9c80('0x45')]['length']?_0x3b72d3[_0x9c80('0x45')]:_0xc4357[_0x9c80('0x43')];if(!_0x4a6314['query'][_0x9c80('0x46')](_0x9c80('0x47'))){_0x3b72d3[_0x9c80('0x2b')]=qs[_0x9c80('0x2b')](_0x4a6314[_0x9c80('0x40')][_0x9c80('0x2b')]);_0x3b72d3[_0x9c80('0x29')]=qs[_0x9c80('0x29')](_0x4a6314[_0x9c80('0x40')][_0x9c80('0x29')]);}_0x3b72d3[_0x9c80('0x48')]=qs[_0x9c80('0x49')](_0x4a6314[_0x9c80('0x40')]['sort']);_0x3b72d3[_0x9c80('0x4a')]=qs['filters'](_[_0x9c80('0x4b')](_0x4a6314[_0x9c80('0x40')],_0xc4357[_0x9c80('0x41')]),_0x2a7474);if(_0x4a6314[_0x9c80('0x40')][_0x9c80('0x4c')]){_0x3b72d3['where']=_[_0x9c80('0x4d')](_0x3b72d3[_0x9c80('0x4a')],{'$or':_['map'](_0x2a7474,function(_0x5c9524){if(_0x5c9524['type']!=='VIRTUAL'){var _0x2570f3={};_0x2570f3[_0x5c9524[_0x9c80('0x37')]]={'$like':'%'+_0x4a6314[_0x9c80('0x40')]['filter']+'%'};return _0x2570f3;}})});}_0x3b72d3=_[_0x9c80('0x4d')]({},_0x3b72d3,_0x4a6314['options']);var _0x41d13b={'where':_0x3b72d3[_0x9c80('0x4a')]};return db[_0x9c80('0x4e')][_0x9c80('0x2c')](_0x41d13b)[_0x9c80('0x1c')](function(_0x232e04){_0x2b81c7[_0x9c80('0x2c')]=_0x232e04;if(_0x4a6314['query'][_0x9c80('0x4f')]){_0x3b72d3[_0x9c80('0x50')]=[{'all':!![]}];}return db[_0x9c80('0x4e')][_0x9c80('0x51')](_0x3b72d3);})[_0x9c80('0x1c')](function(_0x788ff1){_0x2b81c7['rows']=_0x788ff1;return _0x2b81c7;})[_0x9c80('0x1c')](respondWithFilteredResult(_0x35b042,_0x3b72d3))[_0x9c80('0x25')](handleError(_0x35b042,null));};exports[_0x9c80('0x52')]=function(_0x559da1,_0x303eff){var _0x2862ac={'raw':![],'where':{'id':_0x559da1[_0x9c80('0x53')]['id']},'include':[{'model':db[_0x9c80('0x54')],'as':_0x9c80('0x3a')}]},_0x2bc898={};_0x2bc898['model']=_[_0x9c80('0x55')](db[_0x9c80('0x4e')][_0x9c80('0x3c')]);_0x2bc898[_0x9c80('0x40')]=_[_0x9c80('0x55')](_0x559da1['query']);_0x2bc898['filters']=_[_0x9c80('0x42')](_0x2bc898[_0x9c80('0x43')],_0x2bc898[_0x9c80('0x40')]);_0x2862ac[_0x9c80('0x45')]=_[_0x9c80('0x42')](_0x2bc898[_0x9c80('0x43')],qs[_0x9c80('0x44')](_0x559da1['query']['fields']));_0x2862ac[_0x9c80('0x45')]=_0x2862ac['attributes'][_0x9c80('0x56')]?_0x2862ac['attributes']:_0x2bc898[_0x9c80('0x43')];if(_0x559da1[_0x9c80('0x40')][_0x9c80('0x4f')]){_0x2862ac['include']=[{'all':!![]}];}_0x2862ac=_['merge']({},_0x2862ac,_0x559da1[_0x9c80('0x57')]);return db[_0x9c80('0x4e')]['find'](_0x2862ac)[_0x9c80('0x1c')](handleEntityNotFound(_0x303eff,null))['then'](respondWithResult(_0x303eff,null))[_0x9c80('0x25')](handleError(_0x303eff,null));};exports[_0x9c80('0x58')]=function(_0x32b192,_0x395ff4){return db[_0x9c80('0x4e')]['create'](_0x32b192[_0x9c80('0x59')],{})[_0x9c80('0x1c')](function(_0x1c0450){var _0x30f18a=_0x32b192[_0x9c80('0x5a')]['get']({'plain':!![]});if(!_0x30f18a)throw new Error(_0x9c80('0x5b'));if(_0x30f18a[_0x9c80('0x5c')]===_0x9c80('0x5a')){var _0x320b51=_0x1c0450['get']({'plain':!![]});var _0x23bb0f='OpenchannelAccounts';return db['UserProfileSection'][_0x9c80('0x5d')]({'where':{'name':_0x23bb0f,'userProfileId':_0x30f18a[_0x9c80('0x5e')]},'raw':!![]})['then'](function(_0x10dd36){if(_0x10dd36&&_0x10dd36[_0x9c80('0x5f')]===0x0){return db[_0x9c80('0x35')]['create']({'name':_0x320b51[_0x9c80('0x37')],'resourceId':_0x320b51['id'],'type':_0x10dd36[_0x9c80('0x37')],'sectionId':_0x10dd36['id']},{})['then'](function(){return _0x1c0450;});}else{return _0x1c0450;}})['catch'](function(_0x36ddce){logger[_0x9c80('0x21')](_0x9c80('0x60'),_0x36ddce);throw _0x36ddce;});}return _0x1c0450;})[_0x9c80('0x1c')](respondWithResult(_0x395ff4,0xc9))[_0x9c80('0x25')](handleError(_0x395ff4,null));};exports[_0x9c80('0x31')]=function(_0x2dbd8d,_0x3117ed){if(_0x2dbd8d[_0x9c80('0x59')]['id']){delete _0x2dbd8d[_0x9c80('0x59')]['id'];}return db[_0x9c80('0x4e')]['find']({'where':{'id':_0x2dbd8d['params']['id']},'include':[{'model':db[_0x9c80('0x54')],'as':'mandatoryDispositionPause'}]})[_0x9c80('0x1c')](handleEntityNotFound(_0x3117ed,null))[_0x9c80('0x1c')](saveUpdates(_0x2dbd8d[_0x9c80('0x59')],null))['then'](respondWithResult(_0x3117ed,null))['catch'](handleError(_0x3117ed,null));};exports[_0x9c80('0x32')]=function(_0x19ae44,_0x257132){return db[_0x9c80('0x4e')][_0x9c80('0x5d')]({'where':{'id':_0x19ae44[_0x9c80('0x53')]['id']}})['then'](handleEntityNotFound(_0x257132,null))['then'](removeEntity(_0x257132,null))[_0x9c80('0x25')](handleError(_0x257132,null));};exports[_0x9c80('0x61')]=function(_0x4c9b85,_0x49af9d){return db[_0x9c80('0x4e')]['describe']()[_0x9c80('0x1c')](respondWithResult(_0x49af9d,null))[_0x9c80('0x25')](handleError(_0x49af9d,null));};exports[_0x9c80('0x62')]=function(_0x1b80a7,_0x5caa94,_0x2b2e9f){if(_0x1b80a7[_0x9c80('0x59')]['id']){delete _0x1b80a7[_0x9c80('0x59')]['id'];}return db[_0x9c80('0x4e')]['find']({'where':{'id':_0x1b80a7['params']['id']}})['then'](handleEntityNotFound(_0x5caa94,null))['then'](function(_0x4e4f00){if(_0x4e4f00){_0x1b80a7[_0x9c80('0x59')]['OpenchannelAccountId']=_0x4e4f00['id'];return db['Disposition'][_0x9c80('0x58')](_0x1b80a7[_0x9c80('0x59')]);}})[_0x9c80('0x1c')](respondWithResult(_0x5caa94,null))[_0x9c80('0x25')](handleError(_0x5caa94,null));};exports[_0x9c80('0x63')]=function(_0xfe1a1f,_0xcc4cf3,_0x752169){var _0xfcacc0={'raw':![],'where':{}};var _0x19c696={};var _0x2a3d4d={'count':0x0,'rows':[]};return db[_0x9c80('0x4e')][_0x9c80('0x64')]({'where':{'id':_0xfe1a1f[_0x9c80('0x53')]['id']}})[_0x9c80('0x1c')](handleEntityNotFound(_0xcc4cf3,null))[_0x9c80('0x1c')](function(_0x4b90a7){if(_0x4b90a7){_0x19c696[_0x9c80('0x43')]=_[_0x9c80('0x55')](db[_0x9c80('0x65')][_0x9c80('0x3c')]);_0x19c696[_0x9c80('0x40')]=_[_0x9c80('0x55')](_0xfe1a1f['query']);_0x19c696[_0x9c80('0x41')]=_[_0x9c80('0x42')](_0x19c696[_0x9c80('0x43')],_0x19c696[_0x9c80('0x40')]);_0xfcacc0[_0x9c80('0x45')]=_[_0x9c80('0x42')](_0x19c696[_0x9c80('0x43')],qs[_0x9c80('0x44')](_0xfe1a1f[_0x9c80('0x40')][_0x9c80('0x44')]));_0xfcacc0[_0x9c80('0x45')]=_0xfcacc0['attributes'][_0x9c80('0x56')]?_0xfcacc0['attributes']:_0x19c696[_0x9c80('0x43')];if(!_0xfe1a1f['query']['hasOwnProperty'](_0x9c80('0x47'))){_0xfcacc0['limit']=qs[_0x9c80('0x2b')](_0xfe1a1f[_0x9c80('0x40')][_0x9c80('0x2b')]);_0xfcacc0[_0x9c80('0x29')]=qs[_0x9c80('0x29')](_0xfe1a1f[_0x9c80('0x40')][_0x9c80('0x29')]);}_0xfcacc0['order']=qs[_0x9c80('0x49')](_0xfe1a1f[_0x9c80('0x40')][_0x9c80('0x49')]);_0xfcacc0[_0x9c80('0x4a')]=qs[_0x9c80('0x41')](_[_0x9c80('0x4b')](_0xfe1a1f[_0x9c80('0x40')],_0x19c696[_0x9c80('0x41')]));_0xfcacc0[_0x9c80('0x4a')][_0x9c80('0x66')]=_0x4b90a7['id'];if(_0xfe1a1f[_0x9c80('0x40')][_0x9c80('0x4c')]){_0xfcacc0[_0x9c80('0x4a')]=_[_0x9c80('0x4d')](_0xfcacc0['where'],{'$or':_['map'](_0xfcacc0[_0x9c80('0x45')],function(_0x4c0b0e){var _0x337956={};_0x337956[_0x4c0b0e]={'$like':'%'+_0xfe1a1f[_0x9c80('0x40')]['filter']+'%'};return _0x337956;})});}_0xfcacc0=_[_0x9c80('0x4d')]({},_0xfcacc0,_0xfe1a1f[_0x9c80('0x57')]);return db[_0x9c80('0x65')]['count']({'where':_0xfcacc0['where']})['then'](function(_0x4a7863){_0x2a3d4d[_0x9c80('0x2c')]=_0x4a7863;if(_0xfe1a1f['query']['includeAll']){_0xfcacc0[_0x9c80('0x50')]=[{'all':!![]}];}return db[_0x9c80('0x65')][_0x9c80('0x51')](_0xfcacc0);})[_0x9c80('0x1c')](function(_0x13f45c){_0x2a3d4d[_0x9c80('0x67')]=_0x13f45c;return _0x2a3d4d;});}})[_0x9c80('0x1c')](respondWithFilteredResult(_0xcc4cf3,_0xfcacc0))['catch'](handleError(_0xcc4cf3,null));};exports[_0x9c80('0x68')]=function(_0x5acb51,_0x1b0af2,_0x53f79f){return db['OpenchannelAccount'][_0x9c80('0x5d')]({'where':{'id':_0x5acb51[_0x9c80('0x53')]['id']}})[_0x9c80('0x1c')](handleEntityNotFound(_0x1b0af2,null))[_0x9c80('0x1c')](function(_0x3f0c64){if(_0x3f0c64){return _0x3f0c64['removeDispositions'](_0x5acb51['query']['ids']);}})[_0x9c80('0x1c')](respondWithStatusCode(_0x1b0af2,null))[_0x9c80('0x25')](handleError(_0x1b0af2,null));};exports[_0x9c80('0x69')]=function(_0x20fea2,_0x15d67c,_0x3deb29){if(_0x20fea2[_0x9c80('0x59')]['id']){delete _0x20fea2[_0x9c80('0x59')]['id'];}return db[_0x9c80('0x4e')][_0x9c80('0x5d')]({'where':{'id':_0x20fea2[_0x9c80('0x53')]['id']}})[_0x9c80('0x1c')](handleEntityNotFound(_0x15d67c,null))[_0x9c80('0x1c')](function(_0x4e51fc){if(_0x4e51fc){_0x20fea2[_0x9c80('0x59')][_0x9c80('0x66')]=_0x4e51fc['id'];return db[_0x9c80('0x6a')][_0x9c80('0x58')](_0x20fea2[_0x9c80('0x59')]);}})['then'](respondWithResult(_0x15d67c,null))[_0x9c80('0x25')](handleError(_0x15d67c,null));};exports['getAnswers']=function(_0x300d55,_0x248380,_0x475940){var _0x4f8e3b={'raw':![],'where':{}};var _0xf68b98={};var _0x3970c4={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x9c80('0x64')]({'where':{'id':_0x300d55[_0x9c80('0x53')]['id']}})[_0x9c80('0x1c')](handleEntityNotFound(_0x248380,null))[_0x9c80('0x1c')](function(_0x4f89a2){if(_0x4f89a2){_0xf68b98[_0x9c80('0x43')]=_[_0x9c80('0x55')](db[_0x9c80('0x6a')]['rawAttributes']);_0xf68b98['query']=_[_0x9c80('0x55')](_0x300d55[_0x9c80('0x40')]);_0xf68b98['filters']=_[_0x9c80('0x42')](_0xf68b98[_0x9c80('0x43')],_0xf68b98[_0x9c80('0x40')]);_0x4f8e3b[_0x9c80('0x45')]=_['intersection'](_0xf68b98[_0x9c80('0x43')],qs['fields'](_0x300d55[_0x9c80('0x40')]['fields']));_0x4f8e3b['attributes']=_0x4f8e3b['attributes'][_0x9c80('0x56')]?_0x4f8e3b['attributes']:_0xf68b98['model'];if(!_0x300d55[_0x9c80('0x40')][_0x9c80('0x46')](_0x9c80('0x47'))){_0x4f8e3b[_0x9c80('0x2b')]=qs[_0x9c80('0x2b')](_0x300d55[_0x9c80('0x40')]['limit']);_0x4f8e3b[_0x9c80('0x29')]=qs[_0x9c80('0x29')](_0x300d55[_0x9c80('0x40')][_0x9c80('0x29')]);}_0x4f8e3b['order']=qs[_0x9c80('0x49')](_0x300d55[_0x9c80('0x40')][_0x9c80('0x49')]);_0x4f8e3b[_0x9c80('0x4a')]=qs[_0x9c80('0x41')](_[_0x9c80('0x4b')](_0x300d55['query'],_0xf68b98[_0x9c80('0x41')]));_0x4f8e3b['where'][_0x9c80('0x66')]=_0x4f89a2['id'];if(_0x300d55[_0x9c80('0x40')][_0x9c80('0x4c')]){_0x4f8e3b[_0x9c80('0x4a')]=_[_0x9c80('0x4d')](_0x4f8e3b[_0x9c80('0x4a')],{'$or':_[_0x9c80('0x3b')](_0x4f8e3b[_0x9c80('0x45')],function(_0x2c7f9c){var _0x51dffe={};_0x51dffe[_0x2c7f9c]={'$like':'%'+_0x300d55['query'][_0x9c80('0x4c')]+'%'};return _0x51dffe;})});}_0x4f8e3b=_['merge']({},_0x4f8e3b,_0x300d55[_0x9c80('0x57')]);return db[_0x9c80('0x6a')][_0x9c80('0x2c')]({'where':_0x4f8e3b[_0x9c80('0x4a')]})[_0x9c80('0x1c')](function(_0x10f5b7){_0x3970c4[_0x9c80('0x2c')]=_0x10f5b7;if(_0x300d55[_0x9c80('0x40')][_0x9c80('0x4f')]){_0x4f8e3b[_0x9c80('0x50')]=[{'all':!![]}];}return db['CannedAnswer'][_0x9c80('0x51')](_0x4f8e3b);})['then'](function(_0x20f977){_0x3970c4[_0x9c80('0x67')]=_0x20f977;return _0x3970c4;});}})[_0x9c80('0x1c')](respondWithFilteredResult(_0x248380,_0x4f8e3b))[_0x9c80('0x25')](handleError(_0x248380,null));};exports[_0x9c80('0x6b')]=function(_0x9542b5,_0x384737,_0x5ae35e){return db[_0x9c80('0x4e')]['find']({'where':{'id':_0x9542b5[_0x9c80('0x53')]['id']}})[_0x9c80('0x1c')](handleEntityNotFound(_0x384737,null))[_0x9c80('0x1c')](function(_0x4114e3){if(_0x4114e3){return _0x4114e3[_0x9c80('0x6b')](_0x9542b5[_0x9c80('0x40')][_0x9c80('0x6c')]);}})['then'](respondWithStatusCode(_0x384737,null))[_0x9c80('0x25')](handleError(_0x384737,null));};exports[_0x9c80('0x6d')]=function(_0x1659eb,_0x4f5787,_0x592913){var _0x268469={'body':_0x1659eb['body'],'channel':'openchannel'};var _0x36cebd=[];var _0x49e75a=[];var _0x3e3e5f={};var _0x1f44bb=![];return db[_0x9c80('0x6e')][_0x9c80('0x61')]()[_0x9c80('0x1c')](function(_0x1e1e58){if(!_0x1e1e58){throw new db[(_0x9c80('0x6f'))][(_0x9c80('0x70'))]('no\x20available\x20attributes');}_0x36cebd=_[_0x9c80('0x71')](_['keys'](_0x1e1e58),[_0x9c80('0x72'),_0x9c80('0x73')]);_0x49e75a=_['difference'](_[_0x9c80('0x55')](_0x1e1e58),[_0x9c80('0x72'),_0x9c80('0x73'),_0x9c80('0x74'),'ListId']);if(_0x1659eb[_0x9c80('0x59')]['id']){delete _0x1659eb[_0x9c80('0x59')]['id'];}if(_[_0x9c80('0x75')](_0x1659eb[_0x9c80('0x59')][_0x9c80('0x76')])){throw new db[(_0x9c80('0x6f'))][(_0x9c80('0x70'))](_0x9c80('0x77'));}if(_['isNil'](_0x1659eb[_0x9c80('0x59')]['body'])||_0x1659eb[_0x9c80('0x59')]['body']===''){throw new db[(_0x9c80('0x6f'))][(_0x9c80('0x70'))](_0x9c80('0x78'));}if(_['isNil'](_0x1659eb[_0x9c80('0x59')][_0x9c80('0x79')])){throw new db[(_0x9c80('0x6f'))][(_0x9c80('0x70'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x49e75a);}if(!_['includes'](_0x49e75a,_0x1659eb[_0x9c80('0x59')][_0x9c80('0x79')])){throw new db['Sequelize'][(_0x9c80('0x70'))](_0x9c80('0x7a')+_0x49e75a);}_0x3e3e5f[_0x1659eb[_0x9c80('0x59')][_0x9c80('0x79')]]=_0x1659eb[_0x9c80('0x59')]['from'];})[_0x9c80('0x1c')](function(){return db['OpenchannelAccount'][_0x9c80('0x5d')]({'where':{'id':_0x1659eb[_0x9c80('0x53')]['id']},'include':[{'model':db['CmList'],'as':_0x9c80('0x7b'),'include':[{'model':db[_0x9c80('0x6e')],'as':_0x9c80('0x7c'),'where':_0x3e3e5f,'limit':0x1,'order':[[_0x9c80('0x73'),'DESC']]}]},{'model':db[_0x9c80('0x7d')],'as':'Applications'}]});})[_0x9c80('0x1c')](handleEntityNotFound(_0x4f5787,null))['then'](function(_0x1263e2){if(_0x1263e2&&_0x1263e2['List']){_0x268469[_0x9c80('0x7e')]=_0x1263e2;_0x268469['applications']=_0x1263e2['Applications'];_0x268469[_0x9c80('0x7f')]=_0x1263e2[_0x9c80('0x7b')];_0x268469[_0x9c80('0x80')]=_[_0x9c80('0x81')](_0x268469['applications'],[_0x9c80('0x82')],[_0x9c80('0x83')]);if(_0x268469[_0x9c80('0x7e')][_0x9c80('0x84')]){delete _0x268469['account'][_0x9c80('0x84')];}if(_0x268469[_0x9c80('0x7e')]['List']&&_0x268469[_0x9c80('0x7e')]['List'][_0x9c80('0x7c')][_0x9c80('0x56')]){return _0x268469[_0x9c80('0x7e')][_0x9c80('0x7b')]['Contacts'][0x0];}var _0x58261b=_[_0x9c80('0x85')](_0x1659eb[_0x9c80('0x59')],{'firstName':_0x1659eb[_0x9c80('0x59')][_0x9c80('0x76')],'ListId':_0x1263e2[_0x9c80('0x86')]});_0x58261b[_0x1659eb[_0x9c80('0x59')][_0x9c80('0x79')]]=_0x1659eb[_0x9c80('0x59')][_0x9c80('0x76')];return db[_0x9c80('0x6e')][_0x9c80('0x58')](_0x58261b,{'fields':_0x36cebd,'raw':!![]});}})[_0x9c80('0x1c')](handleEntityNotFound(_0x4f5787,null))['then'](function(_0x135e01){_0x268469[_0x9c80('0x87')]=_0x135e01;if(_0x135e01){var _0x5057df={'ContactId':_0x135e01['id'],'OpenchannelAccountId':_0x1659eb['params']['id'],'from':(_0x135e01[_0x9c80('0x88')]||'')+'\x20'+(_0x135e01[_0x9c80('0x89')]||'')};var _0x3fa747={'OpenchannelAccountId':_0x1659eb['params']['id'],'closed':![]};if(_0x1659eb['body']['threadId']){_0x3fa747['threadId']=_0x1659eb[_0x9c80('0x59')]['threadId'];return db['OpenchannelInteraction']['find']({'where':_0x3fa747})[_0x9c80('0x1c')](function(_0x39f5d2){if(_0x39f5d2){return[_0x39f5d2,![]];}_0x5057df[_0x9c80('0x8a')]=_0x1659eb['body'][_0x9c80('0x8a')];_0x5057df[_0x9c80('0x8b')]=_0x1659eb[_0x9c80('0x59')][_0x9c80('0x8b')];return db[_0x9c80('0x8c')][_0x9c80('0x58')](_0x5057df)[_0x9c80('0x1c')](function(_0x3c7a01){return[_0x3c7a01,!![]];});});}else{_0x3fa747[_0x9c80('0x8a')]=null;}_0x3fa747[_0x9c80('0x8d')]=_0x135e01['id'];return db['OpenchannelInteraction'][_0x9c80('0x5d')]({'where':_0x3fa747})['then'](function(_0x5535b7){if(_0x5535b7){return[_0x5535b7,![]];}return db[_0x9c80('0x8c')]['create'](_0x5057df)[_0x9c80('0x1c')](function(_0x236516){return[_0x236516,!![]];});});}})[_0x9c80('0x8e')](function(_0x413e86,_0x25e9cd){if(_0x413e86){_0x1f44bb=_0x25e9cd;if(!_0x25e9cd){var _0x19a6fa={'from':(_0x268469['contact']['firstName']||'')+'\x20'+(_0x268469[_0x9c80('0x87')][_0x9c80('0x89')]||'')};if(_0x1659eb[_0x9c80('0x59')][_0x9c80('0x8a')]&&_0x1659eb[_0x9c80('0x59')][_0x9c80('0x8f')]&&_0x1659eb[_0x9c80('0x59')][_0x9c80('0x8a')]!=_0x1659eb[_0x9c80('0x59')][_0x9c80('0x8f')]){_0x19a6fa['threadId']=_0x1659eb[_0x9c80('0x59')]['messageId'];}return _0x413e86[_0x9c80('0x31')](_0x19a6fa);}else{return _0x413e86;}}})[_0x9c80('0x1c')](function(_0x19672e){_0x268469[_0x9c80('0x90')]=_0x19672e[_0x9c80('0x33')]({'plain':!![]});_0x268469['interaction'][_0x9c80('0x91')]=_0x1f44bb;if(_0x268469[_0x9c80('0x90')][_0x9c80('0x91')]){if(_0x268469[_0x9c80('0x7e')][_0x9c80('0x92')]){_0x268469[_0x9c80('0x80')][_0x9c80('0x93')]({'id':0x0,'priority':_0x268469[_0x9c80('0x80')][_0x9c80('0x56')]+0x1,'app':_0x9c80('0x94'),'appdata':_0x9c80('0x95'),'interval':'*,*,*,*'});}}return db['OpenchannelMessage'][_0x9c80('0x58')]({'body':_0x1659eb[_0x9c80('0x59')]['body'],'OpenchannelAccountId':_0x1659eb[_0x9c80('0x53')]['id'],'OpenchannelInteractionId':_0x19672e['id'],'direction':'in','ContactId':_0x268469['contact']['id'],'AttachmentId':_0x1659eb['body'][_0x9c80('0x96')]});})[_0x9c80('0x1c')](function(_0x479659){_0x268469[_0x9c80('0x24')]=_0x479659;if(_0x268469['interaction']['UserId']){return db['User'][_0x9c80('0x5d')]({'attributes':['id',_0x9c80('0x37')],'where':{'id':_0x268469[_0x9c80('0x90')][_0x9c80('0x97')]}})[_0x9c80('0x1c')](function(_0x221203){if(_0x221203){_0x268469[_0x9c80('0x80')][_0x9c80('0x98')]({'id':0x0,'priority':0x0,'app':_0x9c80('0x99'),'appdata':_0x221203[_0x9c80('0x37')]+','+(_0x268469[_0x9c80('0x7e')][_0x9c80('0x9a')]||0xa),'interval':_0x9c80('0x9b')});_0x268469[_0x9c80('0x9c')]=![];}return respondWithRpcPromise(_0x9c80('0x9d'),'startRouting',_0x268469);});}return respondWithRpcPromise('Start',_0x9c80('0x9e'),_0x268469);})[_0x9c80('0x1c')](function(_0x5eb99f){respondWithRpcPromise(_0x9c80('0x9f'),_0x9c80('0x9f'),{'event':_0x9c80('0x6d'),'message':_0x5eb99f},client9002);return _0x5eb99f;})[_0x9c80('0x1c')](respondWithResult(_0x4f5787,null))[_0x9c80('0x25')](handleError(_0x4f5787,null));};exports['addApplications']=function(_0xc6fe98,_0x2f6ee4){var _0xb279bb=_0xc6fe98[_0x9c80('0x53')]['id'];var _0x3b1203=_0xc6fe98['body'];var _0x3441e2=0xc8;var _0x2301dd=null;return db[_0x9c80('0xa0')][_0x9c80('0xa1')]({'isolationLevel':db[_0x9c80('0xa0')]['Transaction'][_0x9c80('0xa2')]['READ_COMMITTED']},function(_0x26c6c0){return db[_0x9c80('0x4e')]['findOne']({'where':{'id':_0xb279bb},'transaction':_0x26c6c0})[_0x9c80('0x1c')](function(_0x40d295){if(_0x40d295){return db['OpenchannelApplication'][_0x9c80('0x32')]({'where':{'OpenchannelAccountId':_0xb279bb},'transaction':_0x26c6c0})[_0x9c80('0x1c')](function(){var _0x1fd0f5=_[_0x9c80('0x3b')](_0x3b1203,function(_0x242606){_0x242606[_0x9c80('0x66')]=_0xb279bb;return _0x242606;});return db[_0x9c80('0x7d')][_0x9c80('0xa3')](_0x1fd0f5,{'transaction':_0x26c6c0});});}else{_0x3441e2=0x194;_0x2301dd=[];}});})[_0x9c80('0x1c')](function(){if(_0x3441e2!==0x194){return db[_0x9c80('0x7d')][_0x9c80('0xa4')]({'where':{'OpenchannelAccountId':_0xb279bb},'order':_0x9c80('0x82')})[_0x9c80('0x1c')](function(_0x1b549c){_0x2301dd=_0x1b549c;});}})[_0x9c80('0x25')](function(_0x1b15ca){_0x3441e2=0x1f4;logger[_0x9c80('0x21')](_0x1b15ca[_0x9c80('0x36')]);if(_0x1b15ca[_0x9c80('0x37')]){delete _0x1b15ca[_0x9c80('0x37')];}_0x2301dd=_0x1b15ca;})[_0x9c80('0xa5')](function(){if(_0x2301dd===null){_0x2f6ee4[_0x9c80('0x26')](_0x3441e2);}else{if(_0x3441e2===0x1f4){_0x2f6ee4['status'](_0x3441e2)['send'](_0x2301dd);}else{_0x2f6ee4[_0x9c80('0x27')](_0x3441e2)['json'](_0x2301dd);}}});};exports[_0x9c80('0xa6')]=function(_0xc4e97f,_0x189e6d,_0x478564){var _0x48efe2={};var _0x5eb96b={};var _0x234eed;var _0x37a2d9;return db[_0x9c80('0x4e')][_0x9c80('0x64')]({'where':{'id':_0xc4e97f['params']['id']}})['then'](handleEntityNotFound(_0x189e6d,null))['then'](function(_0x2f1776){if(_0x2f1776){_0x234eed=_0x2f1776;_0x5eb96b['model']=_[_0x9c80('0x55')](db[_0x9c80('0x7d')]['rawAttributes']);_0x5eb96b[_0x9c80('0x40')]=_[_0x9c80('0x55')](_0xc4e97f[_0x9c80('0x40')]);_0x5eb96b[_0x9c80('0x41')]=_[_0x9c80('0x42')](_0x5eb96b[_0x9c80('0x43')],_0x5eb96b['query']);_0x48efe2[_0x9c80('0x45')]=_[_0x9c80('0x42')](_0x5eb96b['model'],qs[_0x9c80('0x44')](_0xc4e97f[_0x9c80('0x40')][_0x9c80('0x44')]));_0x48efe2[_0x9c80('0x45')]=_0x48efe2[_0x9c80('0x45')][_0x9c80('0x56')]?_0x48efe2[_0x9c80('0x45')]:_0x5eb96b['model'];_0x48efe2[_0x9c80('0x48')]=qs[_0x9c80('0x49')](_0xc4e97f[_0x9c80('0x40')][_0x9c80('0x49')]);_0x48efe2[_0x9c80('0x4a')]=qs[_0x9c80('0x41')](_[_0x9c80('0x4b')](_0xc4e97f['query'],_0x5eb96b[_0x9c80('0x41')]));if(_0xc4e97f[_0x9c80('0x40')]['filter']){_0x48efe2[_0x9c80('0x4a')]=_[_0x9c80('0x4d')](_0x48efe2[_0x9c80('0x4a')],{'$or':_[_0x9c80('0x3b')](_0x48efe2[_0x9c80('0x45')],function(_0x11088f){var _0xe94f22={};_0xe94f22[_0x11088f]={'$like':'%'+_0xc4e97f[_0x9c80('0x40')][_0x9c80('0x4c')]+'%'};return _0xe94f22;})});}_0x48efe2=_[_0x9c80('0x4d')]({},_0x48efe2,_0xc4e97f[_0x9c80('0x57')]);return _0x234eed[_0x9c80('0xa6')](_0x48efe2);}})[_0x9c80('0x1c')](function(_0x3453dd){if(_0x3453dd){_0x37a2d9=_0x3453dd['length'];if(!_0xc4e97f[_0x9c80('0x40')][_0x9c80('0x46')]('nolimit')){_0x48efe2[_0x9c80('0x2b')]=qs['limit'](_0xc4e97f[_0x9c80('0x40')][_0x9c80('0x2b')]);_0x48efe2[_0x9c80('0x29')]=qs[_0x9c80('0x29')](_0xc4e97f[_0x9c80('0x40')][_0x9c80('0x29')]);}return _0x234eed[_0x9c80('0xa6')](_0x48efe2);}})[_0x9c80('0x1c')](function(_0x4852cc){if(_0x4852cc){return _0x4852cc?{'count':_0x37a2d9,'rows':_0x4852cc}:null;}})[_0x9c80('0x1c')](respondWithResult(_0x189e6d,null))['catch'](handleError(_0x189e6d,null));};exports[_0x9c80('0xa7')]=function(_0xc67a43,_0x545275,_0x4b29ca){var _0x2b3862={'raw':![],'where':{}};var _0x38d500={};var _0x4efc27={'count':0x0,'rows':[]};return db[_0x9c80('0x4e')][_0x9c80('0x64')]({'where':{'id':_0xc67a43[_0x9c80('0x53')]['id']}})[_0x9c80('0x1c')](handleEntityNotFound(_0x545275,null))[_0x9c80('0x1c')](function(_0x3e989c){if(_0x3e989c){_0x38d500['model']=_[_0x9c80('0x55')](db['OpenchannelInteraction'][_0x9c80('0x3c')]);_0x38d500[_0x9c80('0x40')]=_[_0x9c80('0x55')](_0xc67a43['query']);_0x38d500[_0x9c80('0x41')]=_['intersection'](_0x38d500[_0x9c80('0x43')],_0x38d500['query']);_0x2b3862[_0x9c80('0x45')]=_['intersection'](_0x38d500[_0x9c80('0x43')],qs[_0x9c80('0x44')](_0xc67a43[_0x9c80('0x40')][_0x9c80('0x44')]));_0x2b3862['attributes']=_0x2b3862[_0x9c80('0x45')][_0x9c80('0x56')]?_0x2b3862[_0x9c80('0x45')]:_0x38d500[_0x9c80('0x43')];if(!_0xc67a43[_0x9c80('0x40')]['hasOwnProperty'](_0x9c80('0x47'))){_0x2b3862[_0x9c80('0x2b')]=qs[_0x9c80('0x2b')](_0xc67a43[_0x9c80('0x40')]['limit']);_0x2b3862[_0x9c80('0x29')]=qs[_0x9c80('0x29')](_0xc67a43[_0x9c80('0x40')][_0x9c80('0x29')]);}_0x2b3862[_0x9c80('0x48')]=qs[_0x9c80('0x49')](_0xc67a43['query']['sort']);_0x2b3862[_0x9c80('0x4a')]=qs['filters'](_['pick'](_0xc67a43[_0x9c80('0x40')],_0x38d500[_0x9c80('0x41')]));_0x2b3862[_0x9c80('0x4a')][_0x9c80('0x66')]=_0x3e989c['id'];if(_0xc67a43['query']['filter']){_0x2b3862[_0x9c80('0x4a')]=_['merge'](_0x2b3862[_0x9c80('0x4a')],{'$or':_['map'](_0x2b3862[_0x9c80('0x45')],function(_0x5c6253){var _0x59c4e5={};_0x59c4e5[_0x5c6253]={'$like':'%'+_0xc67a43[_0x9c80('0x40')][_0x9c80('0x4c')]+'%'};return _0x59c4e5;})});}_0x2b3862=_[_0x9c80('0x4d')]({},_0x2b3862,_0xc67a43[_0x9c80('0x57')]);return db[_0x9c80('0x8c')][_0x9c80('0x2c')]({'where':_0x2b3862[_0x9c80('0x4a')]})[_0x9c80('0x1c')](function(_0x46b1ba){_0x4efc27[_0x9c80('0x2c')]=_0x46b1ba;if(_0xc67a43[_0x9c80('0x40')][_0x9c80('0x4f')]){_0x2b3862[_0x9c80('0x50')]=[{'model':db[_0x9c80('0x6e')],'as':_0x9c80('0xa8'),'required':![]},{'model':db[_0x9c80('0xa9')],'as':_0x9c80('0xaa'),'attributes':[_0x9c80('0x37'),'fullname',_0x9c80('0xab')],'required':![]},{'model':db[_0x9c80('0xac')],'as':_0x9c80('0xad'),'attributes':['id',_0x9c80('0x37'),_0x9c80('0xae')],'where':_0xc67a43[_0x9c80('0x40')][_0x9c80('0xaf')]?{'id':_0xc67a43[_0x9c80('0x40')][_0x9c80('0xaf')]}:undefined,'required':_0xc67a43['query']['tag']?!![]:![]}];}return db[_0x9c80('0x8c')][_0x9c80('0x51')](_0x2b3862);})['then'](function(_0x1b0e0c){_0x4efc27[_0x9c80('0x67')]=_0x1b0e0c;return _0x4efc27;});}})[_0x9c80('0x1c')](respondWithFilteredResult(_0x545275,_0x2b3862))[_0x9c80('0x25')](handleError(_0x545275,null));};exports['addAgents']=function(_0x271740,_0x5043c7,_0x8d231c){return db[_0x9c80('0x4e')]['find']({'where':{'id':_0x271740[_0x9c80('0x53')]['id']}})[_0x9c80('0x1c')](handleEntityNotFound(_0x5043c7,null))[_0x9c80('0x1c')](function(_0x4509d7){if(_0x4509d7){return _0x4509d7[_0x9c80('0xb0')](_0x271740[_0x9c80('0x59')][_0x9c80('0x6c')],_[_0x9c80('0xb1')](_0x271740[_0x9c80('0x59')],[_0x9c80('0x6c'),'id'])||{})[_0x9c80('0x8e')](function(_0x179102){for(var _0x21ea8d=0x0;_0x21ea8d<_0x271740[_0x9c80('0x59')][_0x9c80('0x6c')][_0x9c80('0x56')];_0x21ea8d+=0x1){socket[_0x9c80('0xb2')](_0x9c80('0xb3'),{'UserId':Number(_0x271740[_0x9c80('0x59')]['ids'][_0x21ea8d]),'OpenchannelAccountId':Number(_0x271740[_0x9c80('0x53')]['id'])});}return _0x179102;});}})[_0x9c80('0x1c')](respondWithResult(_0x5043c7,null))['catch'](handleError(_0x5043c7,null));};exports[_0x9c80('0xb4')]=function(_0x136992,_0x3d7841,_0xf5d2c3){return db[_0x9c80('0x4e')][_0x9c80('0x5d')]({'where':{'id':_0x136992[_0x9c80('0x53')]['id']}})[_0x9c80('0x1c')](handleEntityNotFound(_0x3d7841,null))[_0x9c80('0x1c')](function(_0x328c54){if(_0x328c54){return _0x328c54[_0x9c80('0xb4')](_0x136992[_0x9c80('0x40')][_0x9c80('0x6c')])[_0x9c80('0x1c')](function(){if(_[_0x9c80('0xb5')](_0x136992[_0x9c80('0x40')][_0x9c80('0x6c')])){for(var _0x16c52a=0x0;_0x16c52a<_0x136992[_0x9c80('0x40')]['ids'][_0x9c80('0x56')];_0x16c52a+=0x1){socket[_0x9c80('0xb2')](_0x9c80('0xb6'),{'UserId':Number(_0x136992[_0x9c80('0x40')]['ids'][_0x16c52a]),'OpenchannelAccountId':Number(_0x136992[_0x9c80('0x53')]['id'])});}}else{socket[_0x9c80('0xb2')](_0x9c80('0xb6'),{'UserId':Number(_0x136992[_0x9c80('0x40')]['ids']),'OpenchannelAccountId':Number(_0x136992[_0x9c80('0x53')]['id'])});}});}})[_0x9c80('0x1c')](respondWithStatusCode(_0x3d7841,null))[_0x9c80('0x25')](handleError(_0x3d7841,null));};exports[_0x9c80('0xb7')]=function(_0x3a2665,_0x4bbcf4,_0x1d1a10){var _0x5a1cf4={};var _0x46bc55={};var _0x24dab9;var _0x530981;return db[_0x9c80('0x4e')]['findOne']({'where':{'id':_0x3a2665['params']['id']}})['then'](handleEntityNotFound(_0x4bbcf4,null))['then'](function(_0x38fdb8){if(_0x38fdb8){_0x24dab9=_0x38fdb8;_0x46bc55[_0x9c80('0x43')]=_[_0x9c80('0x55')](db[_0x9c80('0xa9')]['rawAttributes']);_0x46bc55[_0x9c80('0x40')]=_[_0x9c80('0x55')](_0x3a2665[_0x9c80('0x40')]);_0x46bc55['filters']=_[_0x9c80('0x42')](_0x46bc55[_0x9c80('0x43')],_0x46bc55[_0x9c80('0x40')]);_0x5a1cf4['attributes']=_[_0x9c80('0x42')](_0x46bc55[_0x9c80('0x43')],qs[_0x9c80('0x44')](_0x3a2665[_0x9c80('0x40')][_0x9c80('0x44')]));_0x5a1cf4['attributes']=_0x5a1cf4[_0x9c80('0x45')][_0x9c80('0x56')]?_0x5a1cf4[_0x9c80('0x45')]:_0x46bc55['model'];_0x5a1cf4['order']=qs['sort'](_0x3a2665[_0x9c80('0x40')][_0x9c80('0x49')]);_0x5a1cf4[_0x9c80('0x4a')]=qs[_0x9c80('0x41')](_['pick'](_0x3a2665[_0x9c80('0x40')],_0x46bc55[_0x9c80('0x41')]));if(_0x3a2665[_0x9c80('0x40')][_0x9c80('0x4c')]){_0x5a1cf4['where']=_[_0x9c80('0x4d')](_0x5a1cf4[_0x9c80('0x4a')],{'$or':_[_0x9c80('0x3b')](_0x5a1cf4[_0x9c80('0x45')],function(_0x65fe1b){var _0x1ca590={};_0x1ca590[_0x65fe1b]={'$like':'%'+_0x3a2665[_0x9c80('0x40')][_0x9c80('0x4c')]+'%'};return _0x1ca590;})});}_0x5a1cf4=_[_0x9c80('0x4d')]({},_0x5a1cf4,_0x3a2665[_0x9c80('0x57')]);return _0x24dab9['getAgents'](_0x5a1cf4);}})['then'](function(_0x2a1e03){if(_0x2a1e03){_0x530981=_0x2a1e03[_0x9c80('0x56')];if(!_0x3a2665[_0x9c80('0x40')][_0x9c80('0x46')](_0x9c80('0x47'))){_0x5a1cf4[_0x9c80('0x2b')]=qs[_0x9c80('0x2b')](_0x3a2665[_0x9c80('0x40')][_0x9c80('0x2b')]);_0x5a1cf4['offset']=qs[_0x9c80('0x29')](_0x3a2665['query']['offset']);}return _0x24dab9[_0x9c80('0xb7')](_0x5a1cf4);}})[_0x9c80('0x1c')](function(_0x2e53f0){if(_0x2e53f0){return _0x2e53f0?{'count':_0x530981,'rows':_0x2e53f0}:null;}})[_0x9c80('0x1c')](respondWithResult(_0x4bbcf4,null))[_0x9c80('0x25')](handleError(_0x4bbcf4,null));};exports[_0x9c80('0x38')]=function(_0x16f2ca,_0x482c8b,_0x4980b9){var _0x385b7c,_0x3230c4,_0x13ab19;if(_[_0x9c80('0x75')](_0x16f2ca[_0x9c80('0x59')]['body'])||_0x16f2ca['body'][_0x9c80('0x59')]===''){throw new db[(_0x9c80('0x6f'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x9c80('0x75')](_0x16f2ca[_0x9c80('0x59')]['to'])){}_0x385b7c=_0x16f2ca[_0x9c80('0x59')]['to'];return db[_0x9c80('0x4e')][_0x9c80('0x64')]({'where':{'id':_0x16f2ca[_0x9c80('0x53')]['id']}})[_0x9c80('0x1c')](handleEntityNotFound(_0x482c8b,null))[_0x9c80('0x1c')](function(_0x468ffb){if(_0x468ffb){return db['OpenchannelAccount'][_0x9c80('0x5d')]({'where':{'id':_0x468ffb['id']},'include':[{'model':db['CmList'],'as':_0x9c80('0x7b'),'include':[{'model':db[_0x9c80('0x6e')],'as':_0x9c80('0x7c'),'where':{[_0x468ffb[_0x9c80('0x79')]]:_0x385b7c},'limit':0x1,'order':[[_0x9c80('0x73'),_0x9c80('0xb8')]]}]}]})['then'](handleEntityNotFound(_0x482c8b,null))['then'](function(_0x2c3f74){if(_0x2c3f74&&_0x2c3f74[_0x9c80('0x7b')]){_0x3230c4=_0x2c3f74[_0x9c80('0x33')]({'plain':!![]});if(_0x3230c4[_0x9c80('0x7b')]&&_0x3230c4[_0x9c80('0x7b')][_0x9c80('0x7c')]['length']){return _0x3230c4[_0x9c80('0x7b')][_0x9c80('0x7c')][0x0];}return db['CmContact'][_0x9c80('0x58')](_[_0x9c80('0x85')](_0x16f2ca[_0x9c80('0x59')],{'firstName':_0x385b7c,[_0x2c3f74['mapKey']]:_0x385b7c,'phone':_0x385b7c,'ListId':_0x3230c4[_0x9c80('0x86')]}));}})[_0x9c80('0x1c')](handleEntityNotFound(_0x482c8b,null))[_0x9c80('0x1c')](function(_0x30d1c8){if(_0x30d1c8){_0x13ab19=_0x30d1c8;return db[_0x9c80('0x8c')][_0x9c80('0x5d')]({'where':{'ContactId':_0x13ab19['id'],'closed':![],'OpenchannelAccountId':_0x3230c4['id']}})[_0x9c80('0x1c')](function(_0x253aff){if(_0x253aff){return[_0x253aff,![]];}return db[_0x9c80('0x8c')][_0x9c80('0x58')]({'UserId':_0x16f2ca[_0x9c80('0x5a')]['id'],'ContactId':_0x13ab19['id'],'OpenchannelAccountId':_0x3230c4['id'],'lastMsgDirection':_0x9c80('0xb9'),'Messages':[_[_0x9c80('0x4d')](_0x16f2ca[_0x9c80('0x59')],{'read':![],'body':_0x16f2ca[_0x9c80('0x59')][_0x9c80('0x59')],'OpenchannelAccountId':_0x3230c4['id'],'UserId':_0x16f2ca['user']['id'],'ContactId':_0x13ab19['id']})]},{'include':[{'model':db[_0x9c80('0xba')],'as':_0x9c80('0xbb')}]})[_0x9c80('0x1c')](function(_0x387535){return[_0x387535,!![]];});});}})[_0x9c80('0x8e')](function(_0x5545b5,_0x507f33){if(_0x507f33){return _0x5545b5;}return db['OpenchannelMessage']['create'](_['merge'](_0x16f2ca['body'],{'read':![],'body':_0x16f2ca[_0x9c80('0x59')][_0x9c80('0x59')],'OpenchannelAccountId':_0x3230c4['id'],'OpenchannelInteractionId':_0x5545b5['id'],'UserId':_0x16f2ca['user']['id'],'ContactId':_0x13ab19['id']}))['then'](function(_0x534181){_0x5545b5[_0x9c80('0xbc')][_0x9c80('0xbb')]=[];_0x5545b5[_0x9c80('0xbc')][_0x9c80('0xbb')][_0x9c80('0x93')](_0x534181[_0x9c80('0xbc')]);return _0x5545b5;});});}})[_0x9c80('0x1c')](respondWithResult(_0x482c8b,null))[_0x9c80('0x25')](handleError(_0x482c8b,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 6f0c974..b479264 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 _0xb4e6=['update','remove','emit','hook','events','OpenchannelAccount','setMaxListeners','save'];(function(_0x267dcb,_0x3c0dfe){var _0x3d1396=function(_0x4d757e){while(--_0x4d757e){_0x267dcb['push'](_0x267dcb['shift']());}};_0x3d1396(++_0x3c0dfe);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x211bc3,_0x5860c8){_0x211bc3=_0x211bc3-0x0;var _0x34c9a2=_0xb4e6[_0x211bc3];return _0x34c9a2;};'use strict';var EventEmitter=require(_0x6b4e('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0x6b4e('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x6b4e('0x2')](0x0);var events={'afterCreate':_0x6b4e('0x3'),'afterUpdate':_0x6b4e('0x4'),'afterDestroy':_0x6b4e('0x5')};function emitEvent(_0x31e8ad){return function(_0x1929b8,_0x52313b,_0x40da90){OpenchannelAccountEvents[_0x6b4e('0x6')](_0x31e8ad+':'+_0x1929b8['id'],_0x1929b8);OpenchannelAccountEvents[_0x6b4e('0x6')](_0x31e8ad,_0x1929b8);_0x40da90(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x6b4e('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0xe706=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','save','update','remove','emit'];(function(_0x164066,_0x1f1d40){var _0xa816f0=function(_0x17b29e){while(--_0x17b29e){_0x164066['push'](_0x164066['shift']());}};_0xa816f0(++_0x1f1d40);}(_0xe706,0xa3));var _0x6e70=function(_0x4d03d6,_0x438a06){_0x4d03d6=_0x4d03d6-0x0;var _0x22752e=_0xe706[_0x4d03d6];return _0x22752e;};'use strict';var EventEmitter=require(_0x6e70('0x0'));var OpenchannelAccount=require(_0x6e70('0x1'))['db'][_0x6e70('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6e70('0x3'),'afterUpdate':_0x6e70('0x4'),'afterDestroy':_0x6e70('0x5')};function emitEvent(_0x7dfbc3){return function(_0x142c27,_0x2164a4,_0x376a8d){OpenchannelAccountEvents[_0x6e70('0x6')](_0x7dfbc3+':'+_0x142c27['id'],_0x142c27);OpenchannelAccountEvents[_0x6e70('0x6')](_0x7dfbc3,_0x142c27);_0x376a8d(null);};}for(var e in events){if(events[_0x6e70('0x7')](e)){var event=events[e];OpenchannelAccount[_0x6e70('0x8')](e,emitEvent(event));}}module[_0x6e70('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 3e98fef..fd5488a 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(_0x5325ca,_0x15b31c){var _0x288e45=function(_0x5bbfef){while(--_0x5bbfef){_0x5325ca['push'](_0x5325ca['shift']());}};_0x288e45(++_0x15b31c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x4103a5,_0x3286fe){var _0x5e3688=function(_0x1e447d){while(--_0x1e447d){_0x4103a5['push'](_0x4103a5['shift']());}};_0x5e3688(++_0x3286fe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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 30fb8f9..3d749e2 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 _0x693f=['info','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./openchannelAccount.socket','register','request','then'];(function(_0x201004,_0x3aa6ae){var _0x3d0cc0=function(_0x3dd15a){while(--_0x3dd15a){_0x201004['push'](_0x201004['shift']());}};_0x3d0cc0(++_0x3aa6ae);}(_0x693f,0x9d));var _0xf693=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x693f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf693('0x0'));var util=require(_0xf693('0x1'));var moment=require(_0xf693('0x2'));var BPromise=require(_0xf693('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf693('0x4'));var db=require(_0xf693('0x5'))['db'];var utils=require(_0xf693('0x6'));var logger=require(_0xf693('0x7'))(_0xf693('0x8'));var config=require(_0xf693('0x9'));var jayson=require(_0xf693('0xa'));var client=jayson['client'][_0xf693('0xb')]({'port':0x232a});config[_0xf693('0xc')]=_['defaults'](config[_0xf693('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xf693('0xd'))(new Redis(config['redis']));require(_0xf693('0xe'))[_0xf693('0xf')](socket);function respondWithRpcPromise(_0x48984a,_0x4b09d6,_0x5d9159){return new BPromise(function(_0x38b847,_0x527cd9){return client[_0xf693('0x10')](_0x48984a,_0x5d9159)[_0xf693('0x11')](function(_0x2202f1){logger[_0xf693('0x12')](_0xf693('0x13'),_0x4b09d6,'request\x20sent');logger['debug'](_0xf693('0x14'),_0x4b09d6,_0xf693('0x15'),JSON['stringify'](_0x2202f1));if(_0x2202f1[_0xf693('0x16')]){if(_0x2202f1[_0xf693('0x16')]['code']===0x1f4){logger['error'](_0xf693('0x13'),_0x4b09d6,_0x2202f1[_0xf693('0x16')][_0xf693('0x17')]);return _0x527cd9(_0x2202f1[_0xf693('0x16')][_0xf693('0x17')]);}logger['error'](_0xf693('0x13'),_0x4b09d6,_0x2202f1[_0xf693('0x16')][_0xf693('0x17')]);return _0x38b847(_0x2202f1[_0xf693('0x16')][_0xf693('0x17')]);}else{logger[_0xf693('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x4b09d6,'request\x20sent');_0x38b847(_0x2202f1['result'][_0xf693('0x17')]);}})[_0xf693('0x18')](function(_0x3f4d4d){logger[_0xf693('0x16')](_0xf693('0x13'),_0x4b09d6,_0x3f4d4d);_0x527cd9(_0x3f4d4d);});});} \ No newline at end of file +var _0xc29b=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x55fdcc,_0x2d2dcc){var _0x352765=function(_0x25c491){while(--_0x25c491){_0x55fdcc['push'](_0x55fdcc['shift']());}};_0x352765(++_0x2d2dcc);}(_0xc29b,0x12d));var _0xbc29=function(_0x23840b,_0x79368e){_0x23840b=_0x23840b-0x0;var _0x9b6804=_0xc29b[_0x23840b];return _0x9b6804;};'use strict';var _=require(_0xbc29('0x0'));var util=require(_0xbc29('0x1'));var moment=require(_0xbc29('0x2'));var BPromise=require('bluebird');var rs=require(_0xbc29('0x3'));var fs=require('fs');var Redis=require(_0xbc29('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbc29('0x5'));var logger=require(_0xbc29('0x6'))(_0xbc29('0x7'));var config=require(_0xbc29('0x8'));var jayson=require(_0xbc29('0x9'));var client=jayson[_0xbc29('0xa')][_0xbc29('0xb')]({'port':0x232a});config[_0xbc29('0xc')]=_[_0xbc29('0xd')](config[_0xbc29('0xc')],{'host':_0xbc29('0xe'),'port':0x18eb});var socket=require(_0xbc29('0xf'))(new Redis(config[_0xbc29('0xc')]));require(_0xbc29('0x10'))[_0xbc29('0x11')](socket);function respondWithRpcPromise(_0x36d1e3,_0x13a581,_0x2f591c){return new BPromise(function(_0x35ece9,_0x2710ad){return client['request'](_0x36d1e3,_0x2f591c)[_0xbc29('0x12')](function(_0x888953){logger[_0xbc29('0x13')](_0xbc29('0x14'),_0x13a581,_0xbc29('0x15'));logger[_0xbc29('0x16')](_0xbc29('0x17'),_0x13a581,'request\x20sent',JSON[_0xbc29('0x18')](_0x888953));if(_0x888953[_0xbc29('0x19')]){if(_0x888953[_0xbc29('0x19')]['code']===0x1f4){logger['error'](_0xbc29('0x14'),_0x13a581,_0x888953['error'][_0xbc29('0x1a')]);return _0x2710ad(_0x888953[_0xbc29('0x19')][_0xbc29('0x1a')]);}logger['error'](_0xbc29('0x14'),_0x13a581,_0x888953['error'][_0xbc29('0x1a')]);return _0x35ece9(_0x888953[_0xbc29('0x19')][_0xbc29('0x1a')]);}else{logger[_0xbc29('0x13')](_0xbc29('0x14'),_0x13a581,_0xbc29('0x15'));_0x35ece9(_0x888953['result'][_0xbc29('0x1a')]);}})[_0xbc29('0x1b')](function(_0x4eadbe){logger['error'](_0xbc29('0x14'),_0x13a581,_0x4eadbe);_0x2710ad(_0x4eadbe);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 5243a77..b939bb2 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 _0xbe45=['./openchannelAccount.events','save','update','emit','removeListener','register','length','openchannelAccount:'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xbe45,0xf0));var _0x5be4=function(_0x41ba59,_0x1e59bf){_0x41ba59=_0x41ba59-0x0;var _0x27ffdf=_0xbe45[_0x41ba59];return _0x27ffdf;};'use strict';var OpenchannelAccountEvents=require(_0x5be4('0x0'));var events=[_0x5be4('0x1'),'remove',_0x5be4('0x2')];function createListener(_0x45fd7a,_0x3e60c5){return function(_0x1bf021){_0x3e60c5[_0x5be4('0x3')](_0x45fd7a,_0x1bf021);};}function removeListener(_0x106b95,_0x513570){return function(){OpenchannelAccountEvents[_0x5be4('0x4')](_0x106b95,_0x513570);};}exports[_0x5be4('0x5')]=function(_0x2681c7){for(var _0x2b3c60=0x0,_0xa883b2=events[_0x5be4('0x6')];_0x2b3c60<_0xa883b2;_0x2b3c60++){var _0x2a2e93=events[_0x2b3c60];var _0x2301ae=createListener(_0x5be4('0x7')+_0x2a2e93,_0x2681c7);OpenchannelAccountEvents['on'](_0x2a2e93,_0x2301ae);}}; \ No newline at end of file +var _0xe706=['register','length','openchannelAccount:','./openchannelAccount.events','save','remove','emit','removeListener'];(function(_0x3510c2,_0x396bf6){var _0x191fb0=function(_0x1e3f44){while(--_0x1e3f44){_0x3510c2['push'](_0x3510c2['shift']());}};_0x191fb0(++_0x396bf6);}(_0xe706,0xa3));var _0x6e70=function(_0x52456c,_0x2bea26){_0x52456c=_0x52456c-0x0;var _0x3040d9=_0xe706[_0x52456c];return _0x3040d9;};'use strict';var OpenchannelAccountEvents=require(_0x6e70('0x0'));var events=[_0x6e70('0x1'),_0x6e70('0x2'),'update'];function createListener(_0x2cae77,_0x315629){return function(_0x2ca810){_0x315629[_0x6e70('0x3')](_0x2cae77,_0x2ca810);};}function removeListener(_0x142c27,_0x2164a4){return function(){OpenchannelAccountEvents[_0x6e70('0x4')](_0x142c27,_0x2164a4);};}exports[_0x6e70('0x5')]=function(_0x1b0389){for(var _0x4381d1=0x0,_0x36357b=events[_0x6e70('0x6')];_0x4381d1<_0x36357b;_0x4381d1++){var _0x45a2d4=events[_0x4381d1];var _0x188ed3=createListener(_0x6e70('0x7')+_0x45a2d4,_0x1b0389);OpenchannelAccountEvents['on'](_0x45a2d4,_0x188ed3);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 2f630a0..294ecc7 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 _0x9ef2=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','/:id','isAuthenticated','show','put','delete'];(function(_0x4176d5,_0x287381){var _0x30412b=function(_0x423a7e){while(--_0x423a7e){_0x4176d5['push'](_0x4176d5['shift']());}};_0x30412b(++_0x287381);}(_0x9ef2,0x1b2));var _0x29ef=function(_0x4118db,_0x5ed44e){_0x4118db=_0x4118db-0x0;var _0x2e432a=_0x9ef2[_0x4118db];return _0x2e432a;};'use strict';var multer=require(_0x29ef('0x0'));var util=require(_0x29ef('0x1'));var path=require(_0x29ef('0x2'));var timeout=require(_0x29ef('0x3'));var express=require(_0x29ef('0x4'));var router=express[_0x29ef('0x5')]();var fs_extra=require(_0x29ef('0x6'));var auth=require(_0x29ef('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x29ef('0x8'));var controller=require(_0x29ef('0x9'));router[_0x29ef('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x29ef('0xa')](_0x29ef('0xb'),auth[_0x29ef('0xc')](),controller[_0x29ef('0xd')]);router['post']('/',auth[_0x29ef('0xc')](),controller['create']);router[_0x29ef('0xe')](_0x29ef('0xb'),auth[_0x29ef('0xc')](),controller['update']);router[_0x29ef('0xf')](_0x29ef('0xb'),auth[_0x29ef('0xc')](),controller[_0x29ef('0x10')]);module[_0x29ef('0x11')]=router; \ No newline at end of file +var _0xf65b=['index','/:id','show','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated'];(function(_0x4d5f68,_0x5a5a95){var _0x4fc254=function(_0x3a8955){while(--_0x3a8955){_0x4d5f68['push'](_0x4d5f68['shift']());}};_0x4fc254(++_0x5a5a95);}(_0xf65b,0x125));var _0xbf65=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf65b[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbf65('0x0'));var timeout=require(_0xbf65('0x1'));var express=require(_0xbf65('0x2'));var router=express[_0xbf65('0x3')]();var fs_extra=require(_0xbf65('0x4'));var auth=require(_0xbf65('0x5'));var interaction=require(_0xbf65('0x6'));var config=require(_0xbf65('0x7'));var controller=require(_0xbf65('0x8'));router[_0xbf65('0x9')]('/',auth[_0xbf65('0xa')](),controller[_0xbf65('0xb')]);router[_0xbf65('0x9')](_0xbf65('0xc'),auth['isAuthenticated'](),controller[_0xbf65('0xd')]);router['post']('/',auth[_0xbf65('0xa')](),controller['create']);router[_0xbf65('0xe')](_0xbf65('0xc'),auth[_0xbf65('0xa')](),controller[_0xbf65('0xf')]);router[_0xbf65('0x10')](_0xbf65('0xc'),auth[_0xbf65('0xa')](),controller[_0xbf65('0x11')]);module[_0xbf65('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index b286c99..3062e9b 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 _0x0873=['sequelize','exports','STRING','TEXT','*,*,*,*'];(function(_0x13c0f3,_0x33d4bf){var _0x1c2c33=function(_0x14df32){while(--_0x14df32){_0x13c0f3['push'](_0x13c0f3['shift']());}};_0x1c2c33(++_0x33d4bf);}(_0x0873,0x177));var _0x3087=function(_0x4c0a1b,_0x5f41d2){_0x4c0a1b=_0x4c0a1b-0x0;var _0x201314=_0x0873[_0x4c0a1b];return _0x201314;};'use strict';var Sequelize=require(_0x3087('0x0'));module[_0x3087('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x3087('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x3087('0x3')]()},'description':{'type':Sequelize[_0x3087('0x2')]},'interval':{'type':Sequelize[_0x3087('0x2')],'defaultValue':_0x3087('0x4')}}; \ No newline at end of file +var _0x7329=['noop','TEXT','*,*,*,*','exports','STRING'];(function(_0x2f546d,_0x2f6477){var _0x254ea6=function(_0x321f8a){while(--_0x321f8a){_0x2f546d['push'](_0x2f546d['shift']());}};_0x254ea6(++_0x2f6477);}(_0x7329,0x157));var _0x9732=function(_0x1ff575,_0xdba21f){_0x1ff575=_0x1ff575-0x0;var _0x48fc9e=_0x7329[_0x1ff575];return _0x48fc9e;};'use strict';var Sequelize=require('sequelize');module[_0x9732('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x9732('0x1')],'allowNull':![],'defaultValue':_0x9732('0x2')},'appdata':{'type':Sequelize[_0x9732('0x3')]()},'description':{'type':Sequelize[_0x9732('0x1')]},'interval':{'type':Sequelize[_0x9732('0x1')],'defaultValue':_0x9732('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 5de36a8..18b3d6c 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 _0xbc03=['model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','then','count','includeAll','include','rows','show','params','rawAttributes','length','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','Content-Range','apply','reject','save','update','name','send','index','map','OpenchannelApplication','fieldName','key'];(function(_0x3a87d1,_0x584e71){var _0x3aa6d8=function(_0x1e1417){while(--_0x1e1417){_0x3a87d1['push'](_0x3a87d1['shift']());}};_0x3aa6d8(++_0x584e71);}(_0xbc03,0x1da));var _0x3bc0=function(_0x4d085f,_0x3c7393){_0x4d085f=_0x4d085f-0x0;var _0x1ae582=_0xbc03[_0x4d085f];return _0x1ae582;};'use strict';var emlformat=require(_0x3bc0('0x0'));var rimraf=require(_0x3bc0('0x1'));var zipdir=require(_0x3bc0('0x2'));var jsonpatch=require(_0x3bc0('0x3'));var rp=require(_0x3bc0('0x4'));var moment=require(_0x3bc0('0x5'));var BPromise=require(_0x3bc0('0x6'));var Mustache=require(_0x3bc0('0x7'));var util=require(_0x3bc0('0x8'));var path=require('path');var sox=require(_0x3bc0('0x9'));var csv=require(_0x3bc0('0xa'));var ejs=require(_0x3bc0('0xb'));var fs=require('fs');var fs_extra=require(_0x3bc0('0xc'));var _=require(_0x3bc0('0xd'));var squel=require(_0x3bc0('0xe'));var crypto=require(_0x3bc0('0xf'));var jsforce=require(_0x3bc0('0x10'));var deskjs=require(_0x3bc0('0x11'));var toCsv=require(_0x3bc0('0xa'));var querystring=require(_0x3bc0('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3bc0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3bc0('0x14'))(_0x3bc0('0x15'));var utils=require(_0x3bc0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3bc0('0x17'));var db=require(_0x3bc0('0x18'))['db'];function respondWithStatusCode(_0x15a6b3,_0x5cd0f2){_0x5cd0f2=_0x5cd0f2||0xcc;return function(_0x2dd85a){if(_0x2dd85a){return _0x15a6b3[_0x3bc0('0x19')](_0x5cd0f2);}return _0x15a6b3['status'](_0x5cd0f2)[_0x3bc0('0x1a')]();};}function respondWithResult(_0x430755,_0x5ce0ff){_0x5ce0ff=_0x5ce0ff||0xc8;return function(_0x3ae24f){if(_0x3ae24f){return _0x430755[_0x3bc0('0x1b')](_0x5ce0ff)[_0x3bc0('0x1c')](_0x3ae24f);}};}function respondWithFilteredResult(_0xa5a0b9,_0x45b6d5){return function(_0x263ed2){if(_0x263ed2){var _0x5afeb6=typeof _0x45b6d5[_0x3bc0('0x1d')]===_0x3bc0('0x1e')&&typeof _0x45b6d5[_0x3bc0('0x1f')]===_0x3bc0('0x1e');var _0xfae798=_0x263ed2['count'];var _0x27a686=_0x5afeb6?0x0:_0x45b6d5['offset'];var _0x55d8f3=_0x5afeb6?_0x263ed2['count']:_0x45b6d5[_0x3bc0('0x1d')]+_0x45b6d5[_0x3bc0('0x1f')];var _0x183f08;if(_0x55d8f3>=_0xfae798){_0x55d8f3=_0xfae798;_0x183f08=0xc8;}else{_0x183f08=0xce;}_0xa5a0b9[_0x3bc0('0x1b')](_0x183f08);return _0xa5a0b9['set'](_0x3bc0('0x20'),_0x27a686+'-'+_0x55d8f3+'/'+_0xfae798)['json'](_0x263ed2);}return null;};}function patchUpdates(_0x345ee7){return function(_0x12080c){try{jsonpatch[_0x3bc0('0x21')](_0x12080c,_0x345ee7,!![]);}catch(_0x3dac83){return BPromise[_0x3bc0('0x22')](_0x3dac83);}return _0x12080c[_0x3bc0('0x23')]();};}function saveUpdates(_0x459574,_0x5864fd){return function(_0x4d3f9b){if(_0x4d3f9b){return _0x4d3f9b[_0x3bc0('0x24')](_0x459574)['then'](function(_0x5660f3){return _0x5660f3;});}return null;};}function removeEntity(_0x3bdd15,_0x5eb792){return function(_0x3bfbc1){if(_0x3bfbc1){return _0x3bfbc1['destroy']()['then'](function(){_0x3bdd15[_0x3bc0('0x1b')](0xcc)[_0x3bc0('0x1a')]();});}};}function handleEntityNotFound(_0x571b05,_0x32ee7b){return function(_0x1485d0){if(!_0x1485d0){_0x571b05[_0x3bc0('0x19')](0x194);}return _0x1485d0;};}function handleError(_0x29f6ea,_0x4ac848){_0x4ac848=_0x4ac848||0x1f4;return function(_0x16fa5a){logger['error'](_0x16fa5a['stack']);if(_0x16fa5a[_0x3bc0('0x25')]){delete _0x16fa5a[_0x3bc0('0x25')];}_0x29f6ea[_0x3bc0('0x1b')](_0x4ac848)[_0x3bc0('0x26')](_0x16fa5a);};}exports[_0x3bc0('0x27')]=function(_0x13a0f8,_0x262667){var _0x1f043a={},_0x3379e8={},_0x125685={'count':0x0,'rows':[]};var _0x226a0a=_[_0x3bc0('0x28')](db[_0x3bc0('0x29')]['rawAttributes'],function(_0xc46f77){return{'name':_0xc46f77[_0x3bc0('0x2a')],'type':_0xc46f77['type'][_0x3bc0('0x2b')]};});_0x3379e8[_0x3bc0('0x2c')]=_[_0x3bc0('0x28')](_0x226a0a,'name');_0x3379e8[_0x3bc0('0x2d')]=_[_0x3bc0('0x2e')](_0x13a0f8[_0x3bc0('0x2d')]);_0x3379e8[_0x3bc0('0x2f')]=_[_0x3bc0('0x30')](_0x3379e8[_0x3bc0('0x2c')],_0x3379e8['query']);_0x1f043a['attributes']=_[_0x3bc0('0x30')](_0x3379e8[_0x3bc0('0x2c')],qs[_0x3bc0('0x31')](_0x13a0f8[_0x3bc0('0x2d')][_0x3bc0('0x31')]));_0x1f043a[_0x3bc0('0x32')]=_0x1f043a[_0x3bc0('0x32')]['length']?_0x1f043a[_0x3bc0('0x32')]:_0x3379e8[_0x3bc0('0x2c')];if(!_0x13a0f8[_0x3bc0('0x2d')][_0x3bc0('0x33')]('nolimit')){_0x1f043a['limit']=qs['limit'](_0x13a0f8[_0x3bc0('0x2d')]['limit']);_0x1f043a[_0x3bc0('0x1d')]=qs[_0x3bc0('0x1d')](_0x13a0f8['query'][_0x3bc0('0x1d')]);}_0x1f043a[_0x3bc0('0x34')]=qs[_0x3bc0('0x35')](_0x13a0f8[_0x3bc0('0x2d')]['sort']);_0x1f043a[_0x3bc0('0x36')]=qs[_0x3bc0('0x2f')](_[_0x3bc0('0x37')](_0x13a0f8[_0x3bc0('0x2d')],_0x3379e8[_0x3bc0('0x2f')]),_0x226a0a);if(_0x13a0f8[_0x3bc0('0x2d')][_0x3bc0('0x38')]){_0x1f043a['where']=_[_0x3bc0('0x39')](_0x1f043a[_0x3bc0('0x36')],{'$or':_[_0x3bc0('0x28')](_0x226a0a,function(_0x452689){if(_0x452689['type']!==_0x3bc0('0x3a')){var _0x20dc07={};_0x20dc07[_0x452689['name']]={'$like':'%'+_0x13a0f8[_0x3bc0('0x2d')][_0x3bc0('0x38')]+'%'};return _0x20dc07;}})});}_0x1f043a=_['merge']({},_0x1f043a,_0x13a0f8[_0x3bc0('0x3b')]);var _0x402221={'where':_0x1f043a[_0x3bc0('0x36')]};return db['OpenchannelApplication']['count'](_0x402221)[_0x3bc0('0x3c')](function(_0x2de8d8){_0x125685[_0x3bc0('0x3d')]=_0x2de8d8;if(_0x13a0f8['query'][_0x3bc0('0x3e')]){_0x1f043a[_0x3bc0('0x3f')]=[{'all':!![]}];}return db[_0x3bc0('0x29')]['findAll'](_0x1f043a);})[_0x3bc0('0x3c')](function(_0xa42860){_0x125685[_0x3bc0('0x40')]=_0xa42860;return _0x125685;})[_0x3bc0('0x3c')](respondWithFilteredResult(_0x262667,_0x1f043a))['catch'](handleError(_0x262667,null));};exports[_0x3bc0('0x41')]=function(_0x42717f,_0x124866){var _0x3c3572={'raw':!![],'where':{'id':_0x42717f[_0x3bc0('0x42')]['id']}},_0xe810b6={};_0xe810b6[_0x3bc0('0x2c')]=_['keys'](db[_0x3bc0('0x29')][_0x3bc0('0x43')]);_0xe810b6[_0x3bc0('0x2d')]=_[_0x3bc0('0x2e')](_0x42717f['query']);_0xe810b6['filters']=_[_0x3bc0('0x30')](_0xe810b6['model'],_0xe810b6[_0x3bc0('0x2d')]);_0x3c3572[_0x3bc0('0x32')]=_['intersection'](_0xe810b6['model'],qs[_0x3bc0('0x31')](_0x42717f[_0x3bc0('0x2d')][_0x3bc0('0x31')]));_0x3c3572['attributes']=_0x3c3572[_0x3bc0('0x32')][_0x3bc0('0x44')]?_0x3c3572[_0x3bc0('0x32')]:_0xe810b6['model'];if(_0x42717f[_0x3bc0('0x2d')][_0x3bc0('0x3e')]){_0x3c3572['include']=[{'all':!![]}];}_0x3c3572=_[_0x3bc0('0x39')]({},_0x3c3572,_0x42717f[_0x3bc0('0x3b')]);return db[_0x3bc0('0x29')][_0x3bc0('0x45')](_0x3c3572)[_0x3bc0('0x3c')](handleEntityNotFound(_0x124866,null))[_0x3bc0('0x3c')](respondWithResult(_0x124866,null))[_0x3bc0('0x46')](handleError(_0x124866,null));};exports[_0x3bc0('0x47')]=function(_0x4f0d30,_0x393d3c){return db[_0x3bc0('0x29')][_0x3bc0('0x47')](_0x4f0d30[_0x3bc0('0x48')],{})[_0x3bc0('0x3c')](respondWithResult(_0x393d3c,0xc9))[_0x3bc0('0x46')](handleError(_0x393d3c,null));};exports[_0x3bc0('0x24')]=function(_0x5d44bb,_0x31ef9e){if(_0x5d44bb[_0x3bc0('0x48')]['id']){delete _0x5d44bb[_0x3bc0('0x48')]['id'];}return db[_0x3bc0('0x29')]['find']({'where':{'id':_0x5d44bb[_0x3bc0('0x42')]['id']}})[_0x3bc0('0x3c')](handleEntityNotFound(_0x31ef9e,null))[_0x3bc0('0x3c')](saveUpdates(_0x5d44bb[_0x3bc0('0x48')],null))[_0x3bc0('0x3c')](respondWithResult(_0x31ef9e,null))['catch'](handleError(_0x31ef9e,null));};exports[_0x3bc0('0x49')]=function(_0x58131d,_0x3bcba4){return db[_0x3bc0('0x29')]['find']({'where':{'id':_0x58131d[_0x3bc0('0x42')]['id']}})[_0x3bc0('0x3c')](handleEntityNotFound(_0x3bcba4,null))[_0x3bc0('0x3c')](removeEntity(_0x3bcba4,null))[_0x3bc0('0x46')](handleError(_0x3bcba4,null));}; \ No newline at end of file +var _0x9d10=['length','options','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','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','../../mysqldb','sendStatus','status','end','json','undefined','count','reject','save','update','then','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','params','filters'];(function(_0x288241,_0x18063e){var _0xc3de1a=function(_0x548f30){while(--_0x548f30){_0x288241['push'](_0x288241['shift']());}};_0xc3de1a(++_0x18063e);}(_0x9d10,0x1c2));var _0x09d1=function(_0x4279e6,_0x5c118c){_0x4279e6=_0x4279e6-0x0;var _0x1dfc25=_0x9d10[_0x4279e6];return _0x1dfc25;};'use strict';var emlformat=require(_0x09d1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x09d1('0x1'));var jsonpatch=require(_0x09d1('0x2'));var rp=require('request-promise');var moment=require(_0x09d1('0x3'));var BPromise=require(_0x09d1('0x4'));var Mustache=require(_0x09d1('0x5'));var util=require(_0x09d1('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x09d1('0x7'));var ejs=require(_0x09d1('0x8'));var fs=require('fs');var fs_extra=require(_0x09d1('0x9'));var _=require(_0x09d1('0xa'));var squel=require(_0x09d1('0xb'));var crypto=require(_0x09d1('0xc'));var jsforce=require(_0x09d1('0xd'));var deskjs=require(_0x09d1('0xe'));var toCsv=require(_0x09d1('0x7'));var querystring=require(_0x09d1('0xf'));var Papa=require(_0x09d1('0x10'));var Redis=require('ioredis');var authService=require(_0x09d1('0x11'));var qs=require(_0x09d1('0x12'));var as=require(_0x09d1('0x13'));var hardwareService=require(_0x09d1('0x14'));var logger=require(_0x09d1('0x15'))(_0x09d1('0x16'));var utils=require(_0x09d1('0x17'));var config=require(_0x09d1('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x09d1('0x19'))['db'];function respondWithStatusCode(_0x27f578,_0x37b55f){_0x37b55f=_0x37b55f||0xcc;return function(_0x1ee6e2){if(_0x1ee6e2){return _0x27f578[_0x09d1('0x1a')](_0x37b55f);}return _0x27f578[_0x09d1('0x1b')](_0x37b55f)[_0x09d1('0x1c')]();};}function respondWithResult(_0x48733b,_0x382e0b){_0x382e0b=_0x382e0b||0xc8;return function(_0x59cc83){if(_0x59cc83){return _0x48733b['status'](_0x382e0b)[_0x09d1('0x1d')](_0x59cc83);}};}function respondWithFilteredResult(_0x138a0d,_0x45831c){return function(_0x19e122){if(_0x19e122){var _0x25a94e=typeof _0x45831c['offset']===_0x09d1('0x1e')&&typeof _0x45831c['limit']===_0x09d1('0x1e');var _0x3df4f3=_0x19e122[_0x09d1('0x1f')];var _0x196e90=_0x25a94e?0x0:_0x45831c['offset'];var _0xae4ea1=_0x25a94e?_0x19e122[_0x09d1('0x1f')]:_0x45831c['offset']+_0x45831c['limit'];var _0x586964;if(_0xae4ea1>=_0x3df4f3){_0xae4ea1=_0x3df4f3;_0x586964=0xc8;}else{_0x586964=0xce;}_0x138a0d[_0x09d1('0x1b')](_0x586964);return _0x138a0d['set']('Content-Range',_0x196e90+'-'+_0xae4ea1+'/'+_0x3df4f3)['json'](_0x19e122);}return null;};}function patchUpdates(_0x122b65){return function(_0x3f88cf){try{jsonpatch['apply'](_0x3f88cf,_0x122b65,!![]);}catch(_0x51a97a){return BPromise[_0x09d1('0x20')](_0x51a97a);}return _0x3f88cf[_0x09d1('0x21')]();};}function saveUpdates(_0x3aa267,_0x1ad0df){return function(_0x5944b7){if(_0x5944b7){return _0x5944b7[_0x09d1('0x22')](_0x3aa267)['then'](function(_0x5afae2){return _0x5afae2;});}return null;};}function removeEntity(_0x1a6c62,_0x4ba3b5){return function(_0xb30c92){if(_0xb30c92){return _0xb30c92['destroy']()[_0x09d1('0x23')](function(){_0x1a6c62['status'](0xcc)[_0x09d1('0x1c')]();});}};}function handleEntityNotFound(_0x4ebf97,_0x3553a2){return function(_0x4cd2eb){if(!_0x4cd2eb){_0x4ebf97['sendStatus'](0x194);}return _0x4cd2eb;};}function handleError(_0x186620,_0x3daca9){_0x3daca9=_0x3daca9||0x1f4;return function(_0x2cc971){logger['error'](_0x2cc971[_0x09d1('0x24')]);if(_0x2cc971[_0x09d1('0x25')]){delete _0x2cc971['name'];}_0x186620[_0x09d1('0x1b')](_0x3daca9)[_0x09d1('0x26')](_0x2cc971);};}exports[_0x09d1('0x27')]=function(_0x49203b,_0x34204c){var _0x7cabab={},_0x574352={},_0x21d8eb={'count':0x0,'rows':[]};var _0x1efe1e=_[_0x09d1('0x28')](db[_0x09d1('0x29')][_0x09d1('0x2a')],function(_0x54e3da){return{'name':_0x54e3da[_0x09d1('0x2b')],'type':_0x54e3da['type']['key']};});_0x574352[_0x09d1('0x2c')]=_[_0x09d1('0x28')](_0x1efe1e,'name');_0x574352[_0x09d1('0x2d')]=_[_0x09d1('0x2e')](_0x49203b['query']);_0x574352['filters']=_[_0x09d1('0x2f')](_0x574352[_0x09d1('0x2c')],_0x574352[_0x09d1('0x2d')]);_0x7cabab[_0x09d1('0x30')]=_['intersection'](_0x574352[_0x09d1('0x2c')],qs[_0x09d1('0x31')](_0x49203b[_0x09d1('0x2d')][_0x09d1('0x31')]));_0x7cabab[_0x09d1('0x30')]=_0x7cabab[_0x09d1('0x30')]['length']?_0x7cabab[_0x09d1('0x30')]:_0x574352[_0x09d1('0x2c')];if(!_0x49203b[_0x09d1('0x2d')][_0x09d1('0x32')](_0x09d1('0x33'))){_0x7cabab[_0x09d1('0x34')]=qs[_0x09d1('0x34')](_0x49203b['query']['limit']);_0x7cabab[_0x09d1('0x35')]=qs['offset'](_0x49203b[_0x09d1('0x2d')][_0x09d1('0x35')]);}_0x7cabab[_0x09d1('0x36')]=qs[_0x09d1('0x37')](_0x49203b[_0x09d1('0x2d')][_0x09d1('0x37')]);_0x7cabab[_0x09d1('0x38')]=qs['filters'](_[_0x09d1('0x39')](_0x49203b['query'],_0x574352['filters']),_0x1efe1e);if(_0x49203b[_0x09d1('0x2d')][_0x09d1('0x3a')]){_0x7cabab['where']=_['merge'](_0x7cabab[_0x09d1('0x38')],{'$or':_[_0x09d1('0x28')](_0x1efe1e,function(_0x5d9386){if(_0x5d9386['type']!==_0x09d1('0x3b')){var _0xf6761b={};_0xf6761b[_0x5d9386['name']]={'$like':'%'+_0x49203b[_0x09d1('0x2d')][_0x09d1('0x3a')]+'%'};return _0xf6761b;}})});}_0x7cabab=_[_0x09d1('0x3c')]({},_0x7cabab,_0x49203b['options']);var _0x56d003={'where':_0x7cabab[_0x09d1('0x38')]};return db[_0x09d1('0x29')][_0x09d1('0x1f')](_0x56d003)[_0x09d1('0x23')](function(_0x49673a){_0x21d8eb[_0x09d1('0x1f')]=_0x49673a;if(_0x49203b[_0x09d1('0x2d')][_0x09d1('0x3d')]){_0x7cabab[_0x09d1('0x3e')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x09d1('0x3f')](_0x7cabab);})['then'](function(_0x4c8574){_0x21d8eb['rows']=_0x4c8574;return _0x21d8eb;})[_0x09d1('0x23')](respondWithFilteredResult(_0x34204c,_0x7cabab))[_0x09d1('0x40')](handleError(_0x34204c,null));};exports[_0x09d1('0x41')]=function(_0x1c5aeb,_0x1a966d){var _0x4f45eb={'raw':!![],'where':{'id':_0x1c5aeb[_0x09d1('0x42')]['id']}},_0x53ca21={};_0x53ca21[_0x09d1('0x2c')]=_[_0x09d1('0x2e')](db[_0x09d1('0x29')][_0x09d1('0x2a')]);_0x53ca21[_0x09d1('0x2d')]=_[_0x09d1('0x2e')](_0x1c5aeb['query']);_0x53ca21[_0x09d1('0x43')]=_[_0x09d1('0x2f')](_0x53ca21['model'],_0x53ca21[_0x09d1('0x2d')]);_0x4f45eb['attributes']=_['intersection'](_0x53ca21[_0x09d1('0x2c')],qs[_0x09d1('0x31')](_0x1c5aeb[_0x09d1('0x2d')]['fields']));_0x4f45eb[_0x09d1('0x30')]=_0x4f45eb['attributes'][_0x09d1('0x44')]?_0x4f45eb[_0x09d1('0x30')]:_0x53ca21[_0x09d1('0x2c')];if(_0x1c5aeb[_0x09d1('0x2d')][_0x09d1('0x3d')]){_0x4f45eb[_0x09d1('0x3e')]=[{'all':!![]}];}_0x4f45eb=_[_0x09d1('0x3c')]({},_0x4f45eb,_0x1c5aeb[_0x09d1('0x45')]);return db[_0x09d1('0x29')][_0x09d1('0x46')](_0x4f45eb)['then'](handleEntityNotFound(_0x1a966d,null))[_0x09d1('0x23')](respondWithResult(_0x1a966d,null))['catch'](handleError(_0x1a966d,null));};exports['create']=function(_0x5b425b,_0x38a5c2){return db[_0x09d1('0x29')][_0x09d1('0x47')](_0x5b425b['body'],{})['then'](respondWithResult(_0x38a5c2,0xc9))[_0x09d1('0x40')](handleError(_0x38a5c2,null));};exports[_0x09d1('0x22')]=function(_0x1676fc,_0x5c5166){if(_0x1676fc[_0x09d1('0x48')]['id']){delete _0x1676fc[_0x09d1('0x48')]['id'];}return db['OpenchannelApplication'][_0x09d1('0x46')]({'where':{'id':_0x1676fc[_0x09d1('0x42')]['id']}})[_0x09d1('0x23')](handleEntityNotFound(_0x5c5166,null))['then'](saveUpdates(_0x1676fc['body'],null))[_0x09d1('0x23')](respondWithResult(_0x5c5166,null))[_0x09d1('0x40')](handleError(_0x5c5166,null));};exports[_0x09d1('0x49')]=function(_0xb11b1d,_0x40b297){return db[_0x09d1('0x29')][_0x09d1('0x46')]({'where':{'id':_0xb11b1d[_0x09d1('0x42')]['id']}})[_0x09d1('0x23')](handleEntityNotFound(_0x40b297,null))[_0x09d1('0x23')](removeEntity(_0x40b297,null))[_0x09d1('0x40')](handleError(_0x40b297,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 87cd72d..402ed3c 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 _0x384a=['../../config/environment','./openchannelApplication.attributes','exports','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','path','rimraf'];(function(_0x39d1a1,_0x2c1360){var _0x28d1b4=function(_0x40928e){while(--_0x40928e){_0x39d1a1['push'](_0x39d1a1['shift']());}};_0x28d1b4(++_0x2c1360);}(_0x384a,0x159));var _0xa384=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x384a[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0xa384('0x0'));var util=require(_0xa384('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa384('0x2'));var rp=require(_0xa384('0x3'));var fs=require('fs');var path=require(_0xa384('0x4'));var rimraf=require(_0xa384('0x5'));var config=require(_0xa384('0x6'));var attributes=require(_0xa384('0x7'));module[_0xa384('0x8')]=function(_0x38caca,_0x298ce4){return _0x38caca['define'](_0xa384('0x9'),attributes,{'tableName':_0xa384('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa384('0xb'),'collate':_0xa384('0xc')});}; \ No newline at end of file +var _0x1e0f=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0xd75eec,_0xf6aa2c){var _0x548dc3=function(_0x50a994){while(--_0x50a994){_0xd75eec['push'](_0xd75eec['shift']());}};_0x548dc3(++_0xf6aa2c);}(_0x1e0f,0x107));var _0xf1e0=function(_0x4b509b,_0x4913a8){_0x4b509b=_0x4b509b-0x0;var _0x496ba4=_0x1e0f[_0x4b509b];return _0x496ba4;};'use strict';var _=require(_0xf1e0('0x0'));var util=require('util');var logger=require(_0xf1e0('0x1'))(_0xf1e0('0x2'));var moment=require('moment');var BPromise=require(_0xf1e0('0x3'));var rp=require(_0xf1e0('0x4'));var fs=require('fs');var path=require(_0xf1e0('0x5'));var rimraf=require(_0xf1e0('0x6'));var config=require(_0xf1e0('0x7'));var attributes=require(_0xf1e0('0x8'));module[_0xf1e0('0x9')]=function(_0x2c51ca,_0x2348a7){return _0x2c51ca[_0xf1e0('0xa')](_0xf1e0('0xb'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf1e0('0xc'),'collate':_0xf1e0('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 992613d..66617be 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 _0x7732=['jayson/promise','client','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelApplication,\x20%s,\x20%s','message','info','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','where','attributes','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x3bbc07,_0x596706){var _0x1eca5a=function(_0x3ecdd3){while(--_0x3ecdd3){_0x3bbc07['push'](_0x3bbc07['shift']());}};_0x1eca5a(++_0x596706);}(_0x7732,0x180));var _0x2773=function(_0xf4666e,_0x571140){_0xf4666e=_0xf4666e-0x0;var _0x1853f1=_0x7732[_0xf4666e];return _0x1853f1;};'use strict';var _=require(_0x2773('0x0'));var util=require(_0x2773('0x1'));var moment=require(_0x2773('0x2'));var BPromise=require(_0x2773('0x3'));var rs=require(_0x2773('0x4'));var fs=require('fs');var Redis=require(_0x2773('0x5'));var db=require(_0x2773('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2773('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2773('0x8'));var client=jayson[_0x2773('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x124658,_0x41153d,_0xf8c813){return new BPromise(function(_0x439562,_0x5894c7){return client['request'](_0x124658,_0xf8c813)['then'](function(_0x51b144){logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x41153d,_0x2773('0xa'));logger['debug'](_0x2773('0xb'),_0x41153d,'request\x20sent',JSON[_0x2773('0xc')](_0x51b144));if(_0x51b144[_0x2773('0xd')]){if(_0x51b144[_0x2773('0xd')][_0x2773('0xe')]===0x1f4){logger[_0x2773('0xd')](_0x2773('0xf'),_0x41153d,_0x51b144['error']['message']);return _0x5894c7(_0x51b144[_0x2773('0xd')]['message']);}logger['error'](_0x2773('0xf'),_0x41153d,_0x51b144['error'][_0x2773('0x10')]);return _0x439562(_0x51b144['error'][_0x2773('0x10')]);}else{logger[_0x2773('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x41153d,_0x2773('0xa'));_0x439562(_0x51b144['result']['message']);}})[_0x2773('0x12')](function(_0x2a1e73){logger[_0x2773('0xd')](_0x2773('0xf'),_0x41153d,_0x2a1e73);_0x5894c7(_0x2a1e73);});});}exports[_0x2773('0x13')]=function(_0x12c0cf){var _0x2856c3=this;return new Promise(function(_0x425e11,_0x129612){return db[_0x2773('0x14')][_0x2773('0x15')](_0x12c0cf[_0x2773('0x16')],{'raw':_0x12c0cf[_0x2773('0x17')]?_0x12c0cf[_0x2773('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12c0cf['options']?_0x12c0cf[_0x2773('0x17')][_0x2773('0x18')]||null:null,'attributes':_0x12c0cf['options']?_0x12c0cf['options'][_0x2773('0x19')]||null:null,'limit':_0x12c0cf[_0x2773('0x17')]?_0x12c0cf[_0x2773('0x17')]['limit']||null:null})[_0x2773('0x1a')](function(_0x5b27cd){logger['info'](_0x2773('0x13'),_0x12c0cf);logger[_0x2773('0x1b')](_0x2773('0x13'),_0x12c0cf,JSON[_0x2773('0xc')](_0x5b27cd));_0x425e11(_0x5b27cd);})[_0x2773('0x12')](function(_0x50578f){logger[_0x2773('0xd')](_0x2773('0x13'),_0x50578f['message'],_0x12c0cf);_0x129612(_0x2856c3[_0x2773('0xd')](0x1f4,_0x50578f[_0x2773('0x10')]));});});}; \ No newline at end of file +var _0x9b6d=['request','then','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','catch','UpdateOpenchannelApplication','update','body','options','raw','where','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x3e3731,_0x29a0e7){var _0x3642e9=function(_0x3083bf){while(--_0x3083bf){_0x3e3731['push'](_0x3e3731['shift']());}};_0x3642e9(++_0x29a0e7);}(_0x9b6d,0x134));var _0xd9b6=function(_0x389af0,_0x55b0dd){_0x389af0=_0x389af0-0x0;var _0x42ac09=_0x9b6d[_0x389af0];return _0x42ac09;};'use strict';var _=require(_0xd9b6('0x0'));var util=require(_0xd9b6('0x1'));var moment=require(_0xd9b6('0x2'));var BPromise=require(_0xd9b6('0x3'));var rs=require(_0xd9b6('0x4'));var fs=require('fs');var Redis=require(_0xd9b6('0x5'));var db=require(_0xd9b6('0x6'))['db'];var utils=require(_0xd9b6('0x7'));var logger=require(_0xd9b6('0x8'))(_0xd9b6('0x9'));var config=require(_0xd9b6('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xd9b6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbe10b6,_0x52c291,_0x32786e){return new BPromise(function(_0x2c380e,_0xaae923){return client[_0xd9b6('0xc')](_0xbe10b6,_0x32786e)[_0xd9b6('0xd')](function(_0x389476){logger['info'](_0xd9b6('0xe'),_0x52c291,'request\x20sent');logger[_0xd9b6('0xf')](_0xd9b6('0x10'),_0x52c291,'request\x20sent',JSON['stringify'](_0x389476));if(_0x389476[_0xd9b6('0x11')]){if(_0x389476['error'][_0xd9b6('0x12')]===0x1f4){logger[_0xd9b6('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x52c291,_0x389476['error'][_0xd9b6('0x13')]);return _0xaae923(_0x389476[_0xd9b6('0x11')][_0xd9b6('0x13')]);}logger[_0xd9b6('0x11')](_0xd9b6('0xe'),_0x52c291,_0x389476[_0xd9b6('0x11')][_0xd9b6('0x13')]);return _0x2c380e(_0x389476[_0xd9b6('0x11')][_0xd9b6('0x13')]);}else{logger[_0xd9b6('0x14')](_0xd9b6('0xe'),_0x52c291,_0xd9b6('0x15'));_0x2c380e(_0x389476['result'][_0xd9b6('0x13')]);}})[_0xd9b6('0x16')](function(_0x5722bf){logger[_0xd9b6('0x11')](_0xd9b6('0xe'),_0x52c291,_0x5722bf);_0xaae923(_0x5722bf);});});}exports[_0xd9b6('0x17')]=function(_0xc5e544){var _0x4729c5=this;return new Promise(function(_0x4f9839,_0x41d402){return db['OpenchannelApplication'][_0xd9b6('0x18')](_0xc5e544[_0xd9b6('0x19')],{'raw':_0xc5e544['options']?_0xc5e544[_0xd9b6('0x1a')][_0xd9b6('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc5e544[_0xd9b6('0x1a')]?_0xc5e544[_0xd9b6('0x1a')][_0xd9b6('0x1c')]||null:null,'attributes':_0xc5e544['options']?_0xc5e544[_0xd9b6('0x1a')][_0xd9b6('0x1d')]||null:null,'limit':_0xc5e544[_0xd9b6('0x1a')]?_0xc5e544[_0xd9b6('0x1a')][_0xd9b6('0x1e')]||null:null})[_0xd9b6('0xd')](function(_0x5e4c02){logger[_0xd9b6('0x14')]('UpdateOpenchannelApplication',_0xc5e544);logger['debug'](_0xd9b6('0x17'),_0xc5e544,JSON[_0xd9b6('0x1f')](_0x5e4c02));_0x4f9839(_0x5e4c02);})[_0xd9b6('0x16')](function(_0x33dd93){logger[_0xd9b6('0x11')]('UpdateOpenchannelApplication',_0x33dd93[_0xd9b6('0x13')],_0xc5e544);_0x41d402(_0x4729c5[_0xd9b6('0x11')](0x1f4,_0x33dd93[_0xd9b6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 2fc301a..7dcd278 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 _0xe82c=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','download','post','create','/:id/tags','openchannel','openchannelinteraction:addtags','openchannelinteraction:update','delete','tracked','openchannelinteraction:destroy','destroy','exports','multer','util'];(function(_0x1cc410,_0x1b3d93){var _0x78dbca=function(_0x33b435){while(--_0x33b435){_0x1cc410['push'](_0x1cc410['shift']());}};_0x78dbca(++_0x1b3d93);}(_0xe82c,0x1b8));var _0xce82=function(_0x18009c,_0x1509b6){_0x18009c=_0x18009c-0x0;var _0x362a2a=_0xe82c[_0x18009c];return _0x362a2a;};'use strict';var multer=require(_0xce82('0x0'));var util=require(_0xce82('0x1'));var path=require('path');var timeout=require(_0xce82('0x2'));var express=require(_0xce82('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xce82('0x4'));var interaction=require(_0xce82('0x5'));var config=require(_0xce82('0x6'));var controller=require('./openchannelInteraction.controller');router[_0xce82('0x7')]('/',auth[_0xce82('0x8')](),controller[_0xce82('0x9')]);router[_0xce82('0x7')]('/describe',auth[_0xce82('0x8')](),controller[_0xce82('0xa')]);router[_0xce82('0x7')](_0xce82('0xb'),auth[_0xce82('0x8')](),controller['show']);router[_0xce82('0x7')](_0xce82('0xc'),auth[_0xce82('0x8')](),controller[_0xce82('0xd')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xce82('0xe')]);router[_0xce82('0xf')]('/',auth[_0xce82('0x8')](),controller[_0xce82('0x10')]);router[_0xce82('0xf')]('/:id/messages',auth[_0xce82('0x8')](),controller['addMessage']);router[_0xce82('0xf')](_0xce82('0x11'),auth['isAuthenticated'](),interaction['tracked'](_0xce82('0x12'),_0xce82('0x13')),controller['addTags']);router['put'](_0xce82('0xb'),auth[_0xce82('0x8')](),interaction['tracked'](_0xce82('0x12'),_0xce82('0x14')),controller['update']);router[_0xce82('0x15')](_0xce82('0xb'),auth['isAuthenticated'](),interaction[_0xce82('0x16')]('openchannel',_0xce82('0x17')),controller[_0xce82('0x18')]);router[_0xce82('0x15')](_0xce82('0x11'),auth[_0xce82('0x8')](),controller['removeTags']);module[_0xce82('0x19')]=router; \ No newline at end of file +var _0x2955=['post','/:id/messages','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','removeTags','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','/:id','getMessages','/:id/download','download','create'];(function(_0x1ed514,_0x215241){var _0x1eec63=function(_0x48a69f){while(--_0x48a69f){_0x1ed514['push'](_0x1ed514['shift']());}};_0x1eec63(++_0x215241);}(_0x2955,0x94));var _0x5295=function(_0x55d97d,_0x240d36){_0x55d97d=_0x55d97d-0x0;var _0x2f43f6=_0x2955[_0x55d97d];return _0x2f43f6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5295('0x0'));var timeout=require('connect-timeout');var express=require(_0x5295('0x1'));var router=express[_0x5295('0x2')]();var fs_extra=require(_0x5295('0x3'));var auth=require(_0x5295('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5295('0x5'));var controller=require('./openchannelInteraction.controller');router[_0x5295('0x6')]('/',auth[_0x5295('0x7')](),controller['index']);router[_0x5295('0x6')](_0x5295('0x8'),auth[_0x5295('0x7')](),controller['describe']);router[_0x5295('0x6')](_0x5295('0x9'),auth[_0x5295('0x7')](),controller['show']);router['get']('/:id/messages',auth[_0x5295('0x7')](),controller[_0x5295('0xa')]);router[_0x5295('0x6')](_0x5295('0xb'),auth[_0x5295('0x7')](),controller[_0x5295('0xc')]);router['post']('/',auth[_0x5295('0x7')](),controller[_0x5295('0xd')]);router[_0x5295('0xe')](_0x5295('0xf'),auth[_0x5295('0x7')](),controller[_0x5295('0x10')]);router[_0x5295('0xe')](_0x5295('0x11'),auth[_0x5295('0x7')](),interaction[_0x5295('0x12')](_0x5295('0x13'),_0x5295('0x14')),controller[_0x5295('0x15')]);router[_0x5295('0x16')](_0x5295('0x9'),auth[_0x5295('0x7')](),interaction[_0x5295('0x12')](_0x5295('0x13'),_0x5295('0x17')),controller[_0x5295('0x18')]);router[_0x5295('0x19')](_0x5295('0x9'),auth[_0x5295('0x7')](),interaction['tracked'](_0x5295('0x13'),'openchannelinteraction:destroy'),controller['destroy']);router[_0x5295('0x19')]('/:id/tags',auth['isAuthenticated'](),controller[_0x5295('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 4d8c137..fb3908b 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 _0x2f42=['STRING','DATE','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x40be86,_0x68fe5d){var _0xda3c3b=function(_0x39deab){while(--_0x39deab){_0x40be86['push'](_0x40be86['shift']());}};_0xda3c3b(++_0x68fe5d);}(_0x2f42,0x90));var _0x22f4=function(_0x479c5c,_0x15bbef){_0x479c5c=_0x479c5c-0x0;var _0x3ae6cb=_0x2f42[_0x479c5c];return _0x3ae6cb;};'use strict';var Sequelize=require(_0x22f4('0x0'));module[_0x22f4('0x1')]={'closed':{'type':Sequelize[_0x22f4('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x22f4('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x22f4('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x22f4('0x3')]},'externalUrl':{'type':Sequelize[_0x22f4('0x3')]},'lastMsgAt':{'type':Sequelize[_0x22f4('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x22f4('0x5')]('in',_0x22f4('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x22f4('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x22f4('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xd0e7=['STRING','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x2cd976,_0x302575){var _0x1f37cb=function(_0xa8f067){while(--_0xa8f067){_0x2cd976['push'](_0x2cd976['shift']());}};_0x1f37cb(++_0x302575);}(_0xd0e7,0x10d));var _0x7d0e=function(_0x5b8b97,_0x6b4dfa){_0x5b8b97=_0x5b8b97-0x0;var _0x1fdf84=_0xd0e7[_0x5b8b97];return _0x1fdf84;};'use strict';var Sequelize=require(_0x7d0e('0x0'));module[_0x7d0e('0x1')]={'closed':{'type':Sequelize[_0x7d0e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7d0e('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x7d0e('0x4')]},'thirdDisposition':{'type':Sequelize[_0x7d0e('0x4')]},'note':{'type':Sequelize[_0x7d0e('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x7d0e('0x4')]},'lastMsgAt':{'type':Sequelize[_0x7d0e('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x7d0e('0x5')]('in',_0x7d0e('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x7d0e('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x7d0e('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 717d4f3..07db7ad 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 _0x1f6e=['c.lastName','c.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','groupBy','OpenchannelInteractionId','all','show','params','include','options','create','describe','addMessage','OpenchannelMessage','ids','getMessages','findOne','nolimit','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','rows','addTags','spread','emit','removeTags','download','unix','join','root','files','tmp','attachments','firstName','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','N.A.','closed','disposition','threadId','Public','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','renderFile','server','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','Users','fullname','TagIds','Tags','split','push','catch','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','select','field','from','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','ContactId','buildExpression','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','type','text','start','body','some','compact','isEmpty','OpenchannelAccountId','where','i.OpenchannelAccountId\x20IN\x20?','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','merge','OpenchannelInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName'];(function(_0x2e5157,_0xf491b0){var _0x18636e=function(_0x261f6e){while(--_0x261f6e){_0x2e5157['push'](_0x2e5157['shift']());}};_0x18636e(++_0xf491b0);}(_0x1f6e,0x134));var _0xe1f6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1f6e[_0x2641f9];return _0x585741;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe1f6('0x0'));var zipdir=require(_0xe1f6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe1f6('0x2'));var moment=require(_0xe1f6('0x3'));var BPromise=require(_0xe1f6('0x4'));var Mustache=require(_0xe1f6('0x5'));var util=require('util');var path=require('path');var sox=require(_0xe1f6('0x6'));var csv=require(_0xe1f6('0x7'));var ejs=require(_0xe1f6('0x8'));var fs=require('fs');var fs_extra=require(_0xe1f6('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe1f6('0xa'));var jsforce=require(_0xe1f6('0xb'));var deskjs=require(_0xe1f6('0xc'));var toCsv=require(_0xe1f6('0x7'));var querystring=require('querystring');var Papa=require(_0xe1f6('0xd'));var Redis=require('ioredis');var authService=require(_0xe1f6('0xe'));var qs=require(_0xe1f6('0xf'));var as=require(_0xe1f6('0x10'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0xe1f6('0x11'));var logger=require(_0xe1f6('0x12'))(_0xe1f6('0x13'));var utils=require(_0xe1f6('0x14'));var config=require(_0xe1f6('0x15'));var licenseUtil=require(_0xe1f6('0x16'));var db=require(_0xe1f6('0x17'))['db'];config[_0xe1f6('0x18')]=_[_0xe1f6('0x19')](config[_0xe1f6('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe1f6('0x1a'))[_0xe1f6('0x1b')](socket);function respondWithStatusCode(_0x56f262,_0x102220){_0x102220=_0x102220||0xcc;return function(_0x520583){if(_0x520583){return _0x56f262[_0xe1f6('0x1c')](_0x102220);}return _0x56f262[_0xe1f6('0x1d')](_0x102220)[_0xe1f6('0x1e')]();};}function respondWithResult(_0x252acb,_0x5b8973){_0x5b8973=_0x5b8973||0xc8;return function(_0x1cf2cb){if(_0x1cf2cb){return _0x252acb['status'](_0x5b8973)[_0xe1f6('0x1f')](_0x1cf2cb);}};}function respondWithFilteredResult(_0x4888fc,_0x485195){return function(_0x1c36cb){if(_0x1c36cb){var _0x530ee6=typeof _0x485195[_0xe1f6('0x20')]===_0xe1f6('0x21')&&typeof _0x485195['limit']==='undefined';var _0x7f92d=_0x1c36cb[_0xe1f6('0x22')];var _0xf52333=_0x530ee6?0x0:_0x485195[_0xe1f6('0x20')];var _0x3efb14=_0x530ee6?_0x1c36cb[_0xe1f6('0x22')]:_0x485195[_0xe1f6('0x20')]+_0x485195[_0xe1f6('0x23')];var _0x25ae50;if(_0x3efb14>=_0x7f92d){_0x3efb14=_0x7f92d;_0x25ae50=0xc8;}else{_0x25ae50=0xce;}_0x4888fc[_0xe1f6('0x1d')](_0x25ae50);return _0x4888fc[_0xe1f6('0x24')](_0xe1f6('0x25'),_0xf52333+'-'+_0x3efb14+'/'+_0x7f92d)[_0xe1f6('0x1f')](_0x1c36cb);}return null;};}function patchUpdates(_0x435a67){return function(_0x47f46c){try{jsonpatch['apply'](_0x47f46c,_0x435a67,!![]);}catch(_0xda4913){return BPromise[_0xe1f6('0x26')](_0xda4913);}return _0x47f46c[_0xe1f6('0x27')]();};}function saveUpdates(_0x2e4af1,_0x298422){return function(_0x3e7acb){if(_0x3e7acb){return _0x3e7acb['update'](_0x2e4af1)[_0xe1f6('0x28')](function(_0x426444){return _0x426444;});}return null;};}function removeEntity(_0xaaabbb,_0x337e7e){return function(_0x2f3a43){if(_0x2f3a43){return _0x2f3a43[_0xe1f6('0x29')]()[_0xe1f6('0x28')](function(){_0xaaabbb[_0xe1f6('0x1d')](0xcc)[_0xe1f6('0x1e')]();});}};}function handleEntityNotFound(_0x37308b,_0x4657b4){return function(_0x4caee5){if(!_0x4caee5){_0x37308b[_0xe1f6('0x1c')](0x194);}return _0x4caee5;};}function handleError(_0x120d0f,_0x131481){_0x131481=_0x131481||0x1f4;return function(_0x2d9003){logger[_0xe1f6('0x2a')](_0x2d9003[_0xe1f6('0x2b')]);if(_0x2d9003[_0xe1f6('0x2c')]){delete _0x2d9003[_0xe1f6('0x2c')];}_0x120d0f[_0xe1f6('0x1d')](_0x131481)[_0xe1f6('0x2d')](_0x2d9003);};}function getInteractionUsers(_0x5de5f6,_0x458ed4){return new BPromise(function(_0x1904a5,_0x570561){try{if(_0x458ed4[_0x5de5f6['id']]){_0x5de5f6[_0xe1f6('0x2e')]=_['map'](_0x458ed4[_0x5de5f6['id']],function(_0x3df85e){return{'id':_0x3df85e['id'],'fullname':_0x3df85e[_0xe1f6('0x2f')]};});}}catch(_0x372af8){_0x570561(_0x372af8);}_0x1904a5(_0x5de5f6);});}function getInteractionTags(_0x266461,_0x2e8485){return new BPromise(function(_0xbca057,_0x173c42){try{if(_0x266461[_0xe1f6('0x30')]){_0x266461[_0xe1f6('0x31')]=[];_0x266461[_0xe1f6('0x30')][_0xe1f6('0x32')](',')['forEach'](function(_0x5f4688){_0x266461[_0xe1f6('0x31')][_0xe1f6('0x33')](_0x2e8485[_0x5f4688]);});}delete _0x266461[_0xe1f6('0x30')];}catch(_0x4363ae){_0x173c42(_0x4363ae);}_0xbca057(_0x266461);});}function updateOpenchannelInteraction(_0x32236d,_0x48f9ee,_0x4da64c){return new BPromise(function(_0x590e45,_0xa7de89){return getInteractionUsers(_0x32236d,_0x4da64c)[_0xe1f6('0x28')](function(_0x56d010){return getInteractionTags(_0x56d010,_0x48f9ee);})[_0xe1f6('0x28')](function(_0x33387c){_0x590e45(_0x33387c);})[_0xe1f6('0x34')](function(_0x3e71e7){_0xa7de89(_0x3e71e7);});});}exports['index']=function(_0xef97c9,_0x34573f){var _0x138d1d={},_0x1a2dd6={},_0x4da5b6={'count':0x0,'rows':[]};var _0x47d06c=_[_0xe1f6('0x35')](db['OpenchannelInteraction'][_0xe1f6('0x36')],function(_0x4d6ff0){return{'name':_0x4d6ff0[_0xe1f6('0x37')],'type':_0x4d6ff0['type'][_0xe1f6('0x38')]};});_0x1a2dd6[_0xe1f6('0x39')]=_[_0xe1f6('0x35')](_0x47d06c,_0xe1f6('0x2c'));_0x1a2dd6[_0xe1f6('0x3a')]=_[_0xe1f6('0x3b')](_0xef97c9[_0xe1f6('0x3a')]);_0x1a2dd6[_0xe1f6('0x3c')]=_[_0xe1f6('0x3d')](_0x1a2dd6[_0xe1f6('0x39')],_0x1a2dd6[_0xe1f6('0x3a')]);_0x138d1d[_0xe1f6('0x3e')]=_['intersection'](_0x1a2dd6[_0xe1f6('0x39')],qs['fields'](_0xef97c9[_0xe1f6('0x3a')][_0xe1f6('0x3f')]));_0x138d1d[_0xe1f6('0x3e')]=_0x138d1d[_0xe1f6('0x3e')][_0xe1f6('0x40')]?_0x138d1d[_0xe1f6('0x3e')]:_0x1a2dd6[_0xe1f6('0x39')];if(!_0xef97c9[_0xe1f6('0x3a')][_0xe1f6('0x41')]('nolimit')){_0x138d1d[_0xe1f6('0x23')]=qs[_0xe1f6('0x23')](_0xef97c9[_0xe1f6('0x3a')][_0xe1f6('0x23')]);_0x138d1d[_0xe1f6('0x20')]=qs[_0xe1f6('0x20')](_0xef97c9[_0xe1f6('0x3a')][_0xe1f6('0x20')]);}_0x138d1d[_0xe1f6('0x42')]=qs[_0xe1f6('0x43')](_0xef97c9['query'][_0xe1f6('0x43')]);_0x138d1d['where']=qs['filters'](_[_0xe1f6('0x44')](_0xef97c9[_0xe1f6('0x3a')],_0x1a2dd6[_0xe1f6('0x3c')]),_0x47d06c);var _0x19bfcb=[];var _0x57a3a0=squel[_0xe1f6('0x45')]()[_0xe1f6('0x46')]('id')['field']('name')[_0xe1f6('0x46')]('color')[_0xe1f6('0x47')]('tools_tags');var _0x1bc063=squel['select']()[_0xe1f6('0x46')]('u.id')[_0xe1f6('0x46')](_0xe1f6('0x48'))['field'](_0xe1f6('0x49'))[_0xe1f6('0x47')](_0xe1f6('0x4a'),'ui')[_0xe1f6('0x4b')](_0xe1f6('0x4c'),'u',_0xe1f6('0x4d'));var _0x392817=squel[_0xe1f6('0x45')]()['from'](_0xe1f6('0x4e'),'i')['left_join'](_0xe1f6('0x4f'),'c',_0xe1f6('0x50'))[_0xe1f6('0x4b')](_0xe1f6('0x4c'),'o',_0xe1f6('0x51'))[_0xe1f6('0x4b')](_0xe1f6('0x52'),'a',_0xe1f6('0x53'))['left_join'](_0xe1f6('0x54'),'me','me.OpenchannelInteractionId\x20=\x20i.id')[_0xe1f6('0x4b')]('openchannel_interaction_has_tags','it',_0xe1f6('0x55'))['left_join'](_0xe1f6('0x56'),'t','t.id\x20=\x20it.TagId');var _0x1fd91c=squel[_0xe1f6('0x57')]();var _0x8e6c06=[];var _0x32e084=squel[_0xe1f6('0x57')]();var _0x13f19f;if(_0xef97c9[_0xe1f6('0x3a')][_0xe1f6('0x58')]){_0x13f19f=as[_0xe1f6('0x59')](_0xef97c9['query']['search']);var _0x1a2e33=_0x13f19f[_0xe1f6('0x5a')];for(var _0x9de4d6=0x0;_0x9de4d6<_0x13f19f[_0xe1f6('0x5b')]['length'];_0x9de4d6++){var _0x41846c=_0x13f19f[_0xe1f6('0x5b')][_0x9de4d6];var _0x1c5834='i';var _0x295628=_[_0xe1f6('0x5c')](_0x47d06c,[_0xe1f6('0x2c'),_0x41846c[_0xe1f6('0x46')]]);if(!_0x295628){switch(_0x41846c[_0xe1f6('0x46')]){case _0xe1f6('0x5d'):if(_0x41846c['value']==0x1){_0x392817[_0xe1f6('0x5e')]('`'+_0x41846c[_0xe1f6('0x46')]+_0xe1f6('0x5f'));}else{_0x392817[_0xe1f6('0x5e')]('`'+_0x41846c[_0xe1f6('0x46')]+'`\x20>\x200');}break;case _0xe1f6('0x60'):if(_0x41846c[_0xe1f6('0x61')]===_0xe1f6('0x62')){if(_0x41846c['value'][_0xe1f6('0x32')]('\x20')[_0xe1f6('0x40')]>0x1){_0x1fd91c[_0x1a2e33](_0xe1f6('0x63'),qs[_0xe1f6('0x64')](_0x41846c[_0xe1f6('0x65')]),null);}else{var _0x2d55e6='%'+_0x41846c['value']+'%';_0x1fd91c[_0x1a2e33]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2d55e6,_0x2d55e6,_0x2d55e6);}}else{_0x295628=_[_0xe1f6('0x5c')](_0x47d06c,[_0xe1f6('0x2c'),_0xe1f6('0x66')]);_0x41846c[_0xe1f6('0x46')]='ContactId';_0x2c82ce=as[_0xe1f6('0x67')](_0x1c5834,_0x295628['type'],_0x41846c);_0x1fd91c[_0x1a2e33](_0x2c82ce['text'],_0x2c82ce['value']['start'],_0x2c82ce[_0xe1f6('0x65')][_0xe1f6('0x1e')]);}break;case _0xe1f6('0x68'):var _0x533a28=_0x41846c[_0xe1f6('0x65')][_0xe1f6('0x32')](',')['map'](function(_0x383b0a){return Number(_0x383b0a);});_0x533a28[_0xe1f6('0x69')](function(_0x21deff){_0x32e084['or'](_0xe1f6('0x6a'),'%,'+_0x21deff+',%');});_0x8e6c06=_[_0xe1f6('0x6b')](_0x8e6c06,_0x533a28);break;case _0xe1f6('0x6c'):if(_0x41846c[_0xe1f6('0x61')]===_0xe1f6('0x62')){_0x1fd91c[_0x1a2e33]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x41846c[_0xe1f6('0x65')]+'%',null);}else{_0x295628=_['find'](_0x47d06c,[_0xe1f6('0x2c'),_0xe1f6('0x6d')]);_0x41846c[_0xe1f6('0x46')]=_0xe1f6('0x6d');_0x2c82ce=as[_0xe1f6('0x67')](_0x1c5834,_0x295628[_0xe1f6('0x6e')],_0x41846c);_0x1fd91c[_0x1a2e33](_0x2c82ce[_0xe1f6('0x6f')],_0x2c82ce[_0xe1f6('0x65')][_0xe1f6('0x70')],_0x2c82ce[_0xe1f6('0x65')][_0xe1f6('0x1e')]);}break;case _0xe1f6('0x71'):_0x2c82ce=as[_0xe1f6('0x67')]('me',null,_0x41846c);_0x1fd91c[_0x1a2e33](_0x2c82ce[_0xe1f6('0x6f')],_0x2c82ce[_0xe1f6('0x65')]['start'],_0x2c82ce[_0xe1f6('0x65')][_0xe1f6('0x1e')]);break;}}else{var _0x2c82ce=as['buildExpression'](_0x1c5834,_0x295628[_0xe1f6('0x6e')],_0x41846c);_0x1fd91c[_0x1a2e33](_0x2c82ce[_0xe1f6('0x6f')],_0x2c82ce[_0xe1f6('0x65')][_0xe1f6('0x70')],_0x2c82ce[_0xe1f6('0x65')][_0xe1f6('0x1e')]);}}}else{var _0x391ffb=_(_0xef97c9[_0xe1f6('0x3a')])[_0xe1f6('0x3b')]()[_0xe1f6('0x35')](function(_0xa7fb15){return _[_0xe1f6('0x72')](_0x47d06c,['name',_0xa7fb15])?_0xa7fb15:undefined;})[_0xe1f6('0x73')]()['value']();if(!_[_0xe1f6('0x74')](_0x391ffb)){_0x391ffb['forEach'](function(_0x5c2cca){if(_0x5c2cca===_0xe1f6('0x75')){_0x392817[_0xe1f6('0x76')](_0xe1f6('0x77'),[]['concat'](_0xef97c9[_0xe1f6('0x3a')][_0x5c2cca]));}else if(_0x5c2cca===_0xe1f6('0x78')){var _0x141499=JSON[_0xe1f6('0x79')](_0xef97c9[_0xe1f6('0x3a')][_0x5c2cca])['$gte'];var _0x1f8b11=JSON['parse'](_0xef97c9[_0xe1f6('0x3a')][_0x5c2cca])[_0xe1f6('0x7a')];_0x392817['where'](_0xe1f6('0x7b'),_0x141499,_0x1f8b11);}else{if(_0xef97c9['query'][_0x5c2cca]===_0xe1f6('0x7c')){_0x392817[_0xe1f6('0x76')]('i.'+_0x5c2cca+'\x20IS\x20NULL');}else{_0x392817[_0xe1f6('0x76')]('i.'+_0x5c2cca+'\x20=\x20?',_0xef97c9[_0xe1f6('0x3a')][_0x5c2cca]);}}});}if(_0xef97c9[_0xe1f6('0x3a')][_0xe1f6('0x7d')]){if(_0xef97c9[_0xe1f6('0x3a')][_0xe1f6('0x7d')]==0x1){_0x392817[_0xe1f6('0x5e')](_0xe1f6('0x7e'));}else{_0x392817[_0xe1f6('0x5e')](_0xe1f6('0x7f'));}}if(_0xef97c9[_0xe1f6('0x3a')]['tag']){_0x8e6c06=_[_0xe1f6('0x80')](_0xef97c9[_0xe1f6('0x3a')][_0xe1f6('0x81')])?_0xef97c9['query'][_0xe1f6('0x81')]:new Array(_0xef97c9['query'][_0xe1f6('0x81')]);_0x8e6c06[_0xe1f6('0x69')](function(_0x1e7040){_0x32e084['or'](_0xe1f6('0x6a'),'%,'+_0x1e7040+',%');});}if(_0xef97c9['query'][_0xe1f6('0x82')]){var _0x59773a=_0xef97c9[_0xe1f6('0x3a')][_0xe1f6('0x82')][_0xe1f6('0x83')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xe1f6('0x84')](_0x59773a)){_0x1fd91c['or'](_0xe1f6('0x85'),_0x59773a+'%');}else{_0x1fd91c['or'](_0xe1f6('0x86'),qs[_0xe1f6('0x64')](_0x59773a))['or']('i.from\x20LIKE\x20?',_0x59773a+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x59773a+'%');}}}_0x392817[_0xe1f6('0x76')](_0x1fd91c);_0x392817[_0xe1f6('0x87')](_0xe1f6('0x88'));var _0x4d4acb={'type':db[_0xe1f6('0x89')][_0xe1f6('0x8a')][_0xe1f6('0x8b')],'raw':!![]};var _0x677553=_0x392817[_0xe1f6('0x8c')]();_0x677553['field'](_0xe1f6('0x88'));_0x677553[_0xe1f6('0x46')](_0xe1f6('0x8d'),_0xe1f6('0x5d'));if(_0x138d1d[_0xe1f6('0x42')]){_0x138d1d[_0xe1f6('0x42')][_0xe1f6('0x69')](function(_0x321c8c){var _0x666684=_0x321c8c[0x0]==='contactName'?_0x321c8c[0x0]:'i.'+_0x321c8c[0x0];_0x392817['order'](_0x666684,_0x321c8c[0x1]==='DESC'?![]:!![]);});}if(!_[_0xe1f6('0x74')](_0x8e6c06)){_0x392817['having'](_0x32e084);_0x677553[_0xe1f6('0x76')](_0xe1f6('0x8e'),_0x8e6c06);}BPromise['resolve']()[_0xe1f6('0x28')](function(){if(!_0x13f19f){if(_0xef97c9[_0xe1f6('0x3a')][_0xe1f6('0x75')])return;_0x677553['where'](_0xe1f6('0x8f'));_0x392817['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0xef97c9[_0xe1f6('0x90')][_0xe1f6('0x91')]!=='agent')return;return _0xef97c9[_0xe1f6('0x90')][_0xe1f6('0x92')]({'attributes':['id'],'raw':!![]})[_0xe1f6('0x28')](function(_0x2cb926){if(_[_0xe1f6('0x74')](_0x2cb926)){_0x677553['where'](_0xe1f6('0x93'));_0x392817['where'](_0xe1f6('0x93'));}else{_0x677553[_0xe1f6('0x76')](_0xe1f6('0x77'),_[_0xe1f6('0x35')](_0x2cb926,'id'));_0x392817['where'](_0xe1f6('0x77'),_[_0xe1f6('0x35')](_0x2cb926,'id'));}});})[_0xe1f6('0x28')](function(){if(_0xef97c9[_0xe1f6('0x90')][_0xe1f6('0x91')]==='agent'&&!_0x13f19f&&!_0xef97c9[_0xe1f6('0x3a')][_0xe1f6('0x75')])return[];return db[_0xe1f6('0x94')][_0xe1f6('0x3a')](_0x677553[_0xe1f6('0x95')](),_0x4d4acb);})[_0xe1f6('0x28')](function(_0x292172){_0x4da5b6[_0xe1f6('0x22')]=_0x292172[_0xe1f6('0x40')];if(_0x4da5b6[_0xe1f6('0x22')]===0x0)return[];return db[_0xe1f6('0x94')][_0xe1f6('0x3a')](_0x57a3a0['toString'](),_0x4d4acb)[_0xe1f6('0x28')](function(_0x49b5eb){_0x19bfcb=_['keyBy'](_0x49b5eb,'id');_0x4d4acb=_[_0xe1f6('0x96')](_0x4d4acb,{'model':db[_0xe1f6('0x97')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xef97c9[_0xe1f6('0x3a')][_0xe1f6('0x3f')]){_0x138d1d['attributes'][_0xe1f6('0x69')](function(_0xba5a4){_0x392817[_0xe1f6('0x46')]('i.'+_0xba5a4);});}else{_0x392817[_0xe1f6('0x46')](_0xe1f6('0x8d'),_0xe1f6('0x5d'));_0x392817[_0xe1f6('0x46')](_0xe1f6('0x98'),_0xe1f6('0x99'));_0x392817[_0xe1f6('0x46')](_0xe1f6('0x9a'),_0xe1f6('0x9b'));_0x392817['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','contactName');_0x392817[_0xe1f6('0x46')](_0xe1f6('0x9c'));_0x392817[_0xe1f6('0x46')]('c.firstName',_0xe1f6('0x9d'));_0x392817['field'](_0xe1f6('0x9e'),'Contact.lastName');_0x392817[_0xe1f6('0x46')](_0xe1f6('0x9f'),'Contact.email');_0x392817[_0xe1f6('0x46')]('c.phone',_0xe1f6('0xa0'));_0x392817[_0xe1f6('0x46')](_0xe1f6('0xa1'),_0xe1f6('0xa2'));_0x392817[_0xe1f6('0x46')]('c.fax',_0xe1f6('0xa3'));_0x392817[_0xe1f6('0x46')](_0xe1f6('0xa4'),_0xe1f6('0xa5'));_0x392817[_0xe1f6('0x46')](_0xe1f6('0xa6'),_0xe1f6('0xa7'));_0x392817[_0xe1f6('0x46')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xe1f6('0x30'));}if(_0x138d1d['limit'])_0x392817[_0xe1f6('0x23')](_0x138d1d[_0xe1f6('0x23')]);if(_0x138d1d[_0xe1f6('0x20')])_0x392817[_0xe1f6('0x20')](_0x138d1d[_0xe1f6('0x20')]);return db['sequelize']['query'](_0x392817[_0xe1f6('0x95')](),_0x4d4acb);})[_0xe1f6('0x28')](function(_0x806907){if(_0x806907[_0xe1f6('0x40')]>0x0)_0x1bc063['where']('ui.OpenchannelInteractionId\x20IN\x20?',_[_0xe1f6('0x35')](_0x806907,'id'));return db['sequelize'][_0xe1f6('0x3a')](_0x1bc063[_0xe1f6('0x95')](),_0x4d4acb)['then'](function(_0x562de3){var _0x1ca7ec=_[_0xe1f6('0xa8')](_0x562de3,_0xe1f6('0xa9'));var _0x558354=[];_0x806907[_0xe1f6('0x69')](function(_0xed0a4c){_0x558354[_0xe1f6('0x33')](updateOpenchannelInteraction(_0xed0a4c,_0x19bfcb,_0x1ca7ec));});return BPromise[_0xe1f6('0xaa')](_0x558354);});});})[_0xe1f6('0x28')](function(_0x28faee){_0x4da5b6['rows']=_0x28faee;return _0x4da5b6;})[_0xe1f6('0x28')](respondWithFilteredResult(_0x34573f,_0x138d1d))[_0xe1f6('0x34')](handleError(_0x34573f,null));};exports[_0xe1f6('0xab')]=function(_0x59f46f,_0x2549ce){var _0x2b3534={};if(_0x59f46f[_0xe1f6('0x3a')][_0xe1f6('0x6e')]&&_0x59f46f['query']['type']===_0xe1f6('0x47')){_0x2b3534[_0xe1f6('0x47')]=_0x59f46f[_0xe1f6('0xac')]['id'];}else{_0x2b3534['id']=_0x59f46f[_0xe1f6('0xac')]['id'];}var _0xd2d19d={'raw':![],'where':_0x2b3534},_0x6adadf={};_0x6adadf[_0xe1f6('0x39')]=_[_0xe1f6('0x3b')](db[_0xe1f6('0x97')][_0xe1f6('0x36')]);_0x6adadf[_0xe1f6('0x3a')]=_[_0xe1f6('0x3b')](_0x59f46f[_0xe1f6('0x3a')]);_0x6adadf[_0xe1f6('0x3c')]=_[_0xe1f6('0x3d')](_0x6adadf[_0xe1f6('0x39')],_0x6adadf[_0xe1f6('0x3a')]);_0xd2d19d['attributes']=_[_0xe1f6('0x3d')](_0x6adadf['model'],qs['fields'](_0x59f46f[_0xe1f6('0x3a')][_0xe1f6('0x3f')]));_0xd2d19d['attributes']=_0xd2d19d[_0xe1f6('0x3e')]['length']?_0xd2d19d[_0xe1f6('0x3e')]:_0x6adadf[_0xe1f6('0x39')];if(_0x59f46f[_0xe1f6('0x3a')]['includeAll']){_0xd2d19d[_0xe1f6('0xad')]=[{'all':!![]}];}_0xd2d19d=_[_0xe1f6('0x96')]({},_0xd2d19d,_0x59f46f[_0xe1f6('0xae')]);return db[_0xe1f6('0x97')][_0xe1f6('0x5c')](_0xd2d19d)[_0xe1f6('0x28')](handleEntityNotFound(_0x2549ce,null))[_0xe1f6('0x28')](respondWithResult(_0x2549ce,null))[_0xe1f6('0x34')](handleError(_0x2549ce,null));};exports[_0xe1f6('0xaf')]=function(_0x451dd3,_0x6a6529){return db[_0xe1f6('0x97')]['create'](_0x451dd3[_0xe1f6('0x71')],{})[_0xe1f6('0x28')](respondWithResult(_0x6a6529,0xc9))[_0xe1f6('0x34')](handleError(_0x6a6529,null));};exports['update']=function(_0x4967d1,_0x266308){if(_0x4967d1[_0xe1f6('0x71')]['id']){delete _0x4967d1[_0xe1f6('0x71')]['id'];}return db[_0xe1f6('0x97')][_0xe1f6('0x5c')]({'where':{'id':_0x4967d1[_0xe1f6('0xac')]['id']}})[_0xe1f6('0x28')](handleEntityNotFound(_0x266308,null))['then'](saveUpdates(_0x4967d1[_0xe1f6('0x71')],null))[_0xe1f6('0x28')](respondWithResult(_0x266308,null))[_0xe1f6('0x34')](handleError(_0x266308,null));};exports[_0xe1f6('0x29')]=function(_0x2d2ff9,_0x1cd4ff){return db[_0xe1f6('0x97')]['find']({'where':{'id':_0x2d2ff9[_0xe1f6('0xac')]['id']}})[_0xe1f6('0x28')](handleEntityNotFound(_0x1cd4ff,null))[_0xe1f6('0x28')](removeEntity(_0x1cd4ff,null))[_0xe1f6('0x34')](handleError(_0x1cd4ff,null));};exports[_0xe1f6('0xb0')]=function(_0x18d841,_0x3260d0){return db[_0xe1f6('0x97')][_0xe1f6('0xb0')]()[_0xe1f6('0x28')](respondWithResult(_0x3260d0,null))[_0xe1f6('0x34')](handleError(_0x3260d0,null));};exports[_0xe1f6('0xb1')]=function(_0x2bc574,_0x1ec23a,_0x104a6a){return db[_0xe1f6('0xb2')][_0xe1f6('0x5c')]({'where':{'id':_0x2bc574[_0xe1f6('0xac')]['id']}})[_0xe1f6('0x28')](handleEntityNotFound(_0x1ec23a,null))[_0xe1f6('0x28')](function(_0x44a95c){if(_0x44a95c){return _0x44a95c[_0xe1f6('0xb1')](_0x2bc574[_0xe1f6('0x71')]['ids'],_['omit'](_0x2bc574[_0xe1f6('0x71')],[_0xe1f6('0xb3'),'id'])||{});}})[_0xe1f6('0x28')](respondWithResult(_0x1ec23a,null))['catch'](handleError(_0x1ec23a,null));};exports[_0xe1f6('0xb4')]=function(_0x287523,_0x5ece37,_0x1544ad){var _0x929049={'raw':![],'where':{}};var _0x1f8c07={};var _0x4d17d0={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xe1f6('0xb5')]({'where':{'id':_0x287523['params']['id']}})[_0xe1f6('0x28')](handleEntityNotFound(_0x5ece37,null))[_0xe1f6('0x28')](function(_0x23851a){if(_0x23851a){_0x1f8c07[_0xe1f6('0x39')]=_[_0xe1f6('0x3b')](db['OpenchannelMessage'][_0xe1f6('0x36')]);_0x1f8c07[_0xe1f6('0x3a')]=_[_0xe1f6('0x3b')](_0x287523[_0xe1f6('0x3a')]);_0x1f8c07[_0xe1f6('0x3c')]=_['intersection'](_0x1f8c07['model'],_0x1f8c07[_0xe1f6('0x3a')]);_0x929049[_0xe1f6('0x3e')]=_[_0xe1f6('0x3d')](_0x1f8c07[_0xe1f6('0x39')],qs[_0xe1f6('0x3f')](_0x287523['query'][_0xe1f6('0x3f')]));_0x929049['attributes']=_0x929049[_0xe1f6('0x3e')][_0xe1f6('0x40')]?_0x929049[_0xe1f6('0x3e')]:_0x1f8c07[_0xe1f6('0x39')];if(!_0x287523[_0xe1f6('0x3a')][_0xe1f6('0x41')](_0xe1f6('0xb6'))){_0x929049[_0xe1f6('0x23')]=qs[_0xe1f6('0x23')](_0x287523[_0xe1f6('0x3a')]['limit']);_0x929049[_0xe1f6('0x20')]=qs[_0xe1f6('0x20')](_0x287523[_0xe1f6('0x3a')][_0xe1f6('0x20')]);}_0x929049[_0xe1f6('0x42')]=qs[_0xe1f6('0x43')](_0x287523[_0xe1f6('0x3a')]['sort']);_0x929049['where']=qs[_0xe1f6('0x3c')](_[_0xe1f6('0x44')](_0x287523[_0xe1f6('0x3a')],_0x1f8c07[_0xe1f6('0x3c')]));_0x929049[_0xe1f6('0x76')][_0xe1f6('0xa9')]=_0x23851a['id'];if(_0x287523[_0xe1f6('0x3a')][_0xe1f6('0x82')]){_0x929049[_0xe1f6('0x76')]=_[_0xe1f6('0x96')](_0x929049[_0xe1f6('0x76')],{'$or':_[_0xe1f6('0x35')](_0x929049[_0xe1f6('0x3e')],function(_0x2584cc){var _0x25b9f2={};_0x25b9f2[_0x2584cc]={'$like':'%'+_0x287523[_0xe1f6('0x3a')][_0xe1f6('0x82')]+'%'};return _0x25b9f2;})});}if(_0x287523[_0xe1f6('0x3a')][_0xe1f6('0xb7')]){var _0x2757b9=_0x287523['query'][_0xe1f6('0xb7')][_0xe1f6('0x32')](',');var _0x171367={};_0x171367[_0x2757b9[0x0]]={'$gte':moment(_0x2757b9[0x1])[_0xe1f6('0xb8')](_0xe1f6('0xb9'))};_0x929049[_0xe1f6('0x76')]=_[_0xe1f6('0x96')](_0x929049['where'],_0x171367);}_0x929049=_[_0xe1f6('0x96')]({},_0x929049,_0x287523['options']);return db[_0xe1f6('0xb2')]['count']({'where':_0x929049[_0xe1f6('0x76')]})[_0xe1f6('0x28')](function(_0x1d5a80){_0x4d17d0['count']=_0x1d5a80;if(_0x287523[_0xe1f6('0x3a')][_0xe1f6('0xba')]){_0x929049[_0xe1f6('0xad')]=[{'all':!![]}];}return db[_0xe1f6('0xb2')][_0xe1f6('0xbb')](_0x929049);})[_0xe1f6('0x28')](function(_0x3cbbbe){_0x4d17d0[_0xe1f6('0xbc')]=_0x3cbbbe;return _0x4d17d0;});}})[_0xe1f6('0x28')](respondWithFilteredResult(_0x5ece37,_0x929049))[_0xe1f6('0x34')](handleError(_0x5ece37,null));};exports[_0xe1f6('0xbd')]=function(_0x571bb7,_0x447465,_0x2d20fd){return db[_0xe1f6('0x97')][_0xe1f6('0x5c')]({'where':{'id':_0x571bb7[_0xe1f6('0xac')]['id']}})[_0xe1f6('0x28')](handleEntityNotFound(_0x447465,null))[_0xe1f6('0x28')](function(_0x5cd27a){if(_0x5cd27a){return _0x5cd27a['setTags'](_0x571bb7[_0xe1f6('0x71')][_0xe1f6('0xb3')],_['omit'](_0x571bb7[_0xe1f6('0x71')],[_0xe1f6('0xb3'),'id'])||{})[_0xe1f6('0xbe')](function(){return db[_0xe1f6('0x68')][_0xe1f6('0xbb')]({'attributes':['id',_0xe1f6('0x2c'),'color'],'where':{'id':_0x571bb7[_0xe1f6('0x71')][_0xe1f6('0xb3')]}});})[_0xe1f6('0x28')](function(_0x1dfc7e){socket[_0xe1f6('0xbf')]('openchannelInteractionTags:save',{'id':Number(_0x571bb7[_0xe1f6('0xac')]['id']),'tags':_0x1dfc7e||[]});return{'id':Number(_0x571bb7[_0xe1f6('0xac')]['id']),'tags':_0x1dfc7e||[]};});}})[_0xe1f6('0x28')](respondWithResult(_0x447465,null))[_0xe1f6('0x34')](handleError(_0x447465,null));};exports[_0xe1f6('0xc0')]=function(_0x4dcebb,_0x5aef9d,_0x329a3e){return db['OpenchannelInteraction'][_0xe1f6('0x5c')]({'where':{'id':_0x4dcebb[_0xe1f6('0xac')]['id']}})['then'](handleEntityNotFound(_0x5aef9d,null))[_0xe1f6('0x28')](function(_0x13c0df){if(_0x13c0df){return _0x13c0df['removeTags'](_0x4dcebb['query'][_0xe1f6('0xb3')]);}})[_0xe1f6('0x28')](respondWithStatusCode(_0x5aef9d,null))[_0xe1f6('0x34')](handleError(_0x5aef9d,null));};exports[_0xe1f6('0xc1')]=function(_0x46813c,_0x5b0528){var _0x573585=moment()[_0xe1f6('0xc2')]()[_0xe1f6('0x95')]();var _0x4af95f=path[_0xe1f6('0xc3')](config[_0xe1f6('0xc4')],'server',_0xe1f6('0xc5'),_0xe1f6('0xc6'));var _0x2dc188=path[_0xe1f6('0xc3')](config[_0xe1f6('0xc4')],'server',_0xe1f6('0xc5'),_0xe1f6('0xc7'));var _0x2f23e9=path[_0xe1f6('0xc3')](_0x4af95f,_0x573585);var _0x22e8ee=util[_0xe1f6('0xb8')]('transcript-%d-%s.zip',_0x46813c['params']['id'],_0x573585);var _0x598446=path[_0xe1f6('0xc3')](_0x4af95f,_0x22e8ee);var _0x2448b7=[];_0x2448b7[_0xe1f6('0x33')]({'model':db['User'],'as':_0xe1f6('0x6c'),'attributes':['id',_0xe1f6('0x2f')],'raw':!![]});_0x2448b7[_0xe1f6('0x33')]({'model':db['CmContact'],'as':_0xe1f6('0x60'),'attributes':['id',_0xe1f6('0xc8'),_0xe1f6('0xc9')],'raw':!![]});if(_0x46813c[_0xe1f6('0x3a')][_0xe1f6('0xc7')]){_0x2448b7[_0xe1f6('0x33')]({'model':db[_0xe1f6('0xca')],'as':_0xe1f6('0xca'),'raw':!![]});}var _0x59ca8f=[{'model':db[_0xe1f6('0xb2')],'as':_0xe1f6('0xcb'),'attributes':['id',_0xe1f6('0x71'),'createdAt',_0xe1f6('0xcc'),_0xe1f6('0xcd'),_0xe1f6('0x7d')],'include':_0x2448b7}];_0x59ca8f[_0xe1f6('0x33')]({'model':db[_0xe1f6('0xce')],'as':_0xe1f6('0xcf'),'attributes':['id','name']});_0x59ca8f[_0xe1f6('0x33')]({'model':db['User'],'as':_0xe1f6('0xd0'),'attributes':['id',_0xe1f6('0x2f')]});return db[_0xe1f6('0x97')][_0xe1f6('0x5c')]({'where':{'id':_0x46813c[_0xe1f6('0xac')]['id']},'include':_0x59ca8f})[_0xe1f6('0x28')](handleEntityNotFound(_0x5b0528,null))[_0xe1f6('0x28')](function(_0x83caca){if(_0x83caca){var _0x570ddf=_0x83caca[_0xe1f6('0xd1')]({'plain':!![]});fs[_0xe1f6('0xd2')](_0x2f23e9);var _0x1de128={'channel':'Openchannel','account':_0x570ddf[_0xe1f6('0xcf')][_0xe1f6('0x2c')],'agent':_0x570ddf[_0xe1f6('0xd0')]?_0x570ddf[_0xe1f6('0xd0')][_0xe1f6('0x2f')]:_0xe1f6('0xd3'),'createdAt':moment(_0x570ddf[_0xe1f6('0x78')])[_0xe1f6('0xb8')](_0xe1f6('0xb9'))[_0xe1f6('0x95')](),'closedAt':_0x570ddf[_0xe1f6('0xd4')]?moment(_0x570ddf['closedAt'])[_0xe1f6('0xb8')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x570ddf[_0xe1f6('0xd5')],'visibility':_0x570ddf[_0xe1f6('0xd6')]?_0xe1f6('0xd7'):'Private','messages':_(_0x570ddf[_0xe1f6('0xcb')])[_0xe1f6('0x82')]({'secret':![]})[_0xe1f6('0x35')](function(_0x4052e4){if(_0x4052e4[_0xe1f6('0xca')]){var _0x33bb04=path[_0xe1f6('0xc3')](_0x2dc188,_0x4052e4[_0xe1f6('0xca')][_0xe1f6('0xd8')]);if(fs[_0xe1f6('0xd9')](_0x33bb04)){fs[_0xe1f6('0xda')](_0x33bb04)[_0xe1f6('0xdb')](fs[_0xe1f6('0xdc')](path[_0xe1f6('0xc3')](_0x2f23e9,_0x4052e4['Attachment'][_0xe1f6('0xd8')])));}}return{'date':moment(_0x4052e4[_0xe1f6('0x78')])[_0xe1f6('0xb8')](_0xe1f6('0xb9'))[_0xe1f6('0x95')](),'sender':_0x4052e4['direction']===_0xe1f6('0xdd')?_0x4052e4[_0xe1f6('0x6c')]?_0x4052e4['User'][_0xe1f6('0x2f')]:_0xe1f6('0xde'):_0x4052e4[_0xe1f6('0x60')]['firstName']+(_0x4052e4[_0xe1f6('0x60')][_0xe1f6('0xc9')]?'\x20'+_0x4052e4[_0xe1f6('0x60')][_0xe1f6('0xc9')]:''),'body':_0x4052e4[_0xe1f6('0xca')]?_0x4052e4['Attachment'][_0xe1f6('0xd8')]:_0x4052e4[_0xe1f6('0x71')],'direction':_0x4052e4[_0xe1f6('0xcc')]===_0xe1f6('0xdd')?'A':'C','secret':_0x4052e4[_0xe1f6('0xcd')],'read':_0x4052e4[_0xe1f6('0x7d')],'attachment':_0x4052e4[_0xe1f6('0xca')]};})[_0xe1f6('0x65')]()};return ejs[_0xe1f6('0xdf')](path['join'](config[_0xe1f6('0xc4')],_0xe1f6('0xe0'),_0xe1f6('0xe1'),_0xe1f6('0xe2')),{'interaction':_0x1de128})[_0xe1f6('0x28')](function(_0x47175d){var _0x375d4c=path[_0xe1f6('0xc3')](_0x2f23e9,_0xe1f6('0xe3')+_0x570ddf['id']+'-'+_0x573585+_0xe1f6('0xe4'));var _0x11fed4={'path':_0x375d4c,'channel':'Openchannel','interactionId':_0x570ddf['id']};return pdf[_0xe1f6('0xe5')](_0x47175d,_0x11fed4);})[_0xe1f6('0x28')](function(){return new BPromise(function(_0x3f3a64,_0x1021fd){zipdir(_0x2f23e9,{'saveTo':_0x598446},function(_0x413d75,_0x40dacf){if(_0x413d75)return _0x1021fd(_0x413d75);return _0x3f3a64(_0x40dacf);});})[_0xe1f6('0x28')](function(){return new BPromise(function(_0xb9cbb8,_0x4ba52f){rimraf(_0x2f23e9,function(_0x4158e5){if(_0x4158e5)_0x4ba52f(_0x4158e5);return _0xb9cbb8();});});})[_0xe1f6('0x28')](function(){return _0x5b0528[_0xe1f6('0xc1')](_0x598446,_0x22e8ee,function(_0x2eb1d9){if(_0x2eb1d9){console[_0xe1f6('0xe6')](_0xe1f6('0xe7'),_0x2eb1d9);}else{fs[_0xe1f6('0xe8')](_0x598446);}});});});}else{return _0x5b0528[_0xe1f6('0x1c')](0xc8);}})[_0xe1f6('0x34')](handleError(_0x5b0528,null));}; \ No newline at end of file +var _0x5f15=['SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','role','agent','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','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','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','catch','show','includeAll','options','create','body','update','params','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','include','setTags','findAll','emit','openchannelInteractionTags:save','removeTags','download','unix','root','server','files','join','format','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','get','mkdirSync','Openchannel','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','threadId','Private','basename','existsSync','createReadStream','createWriteStream','out','renderFile','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','then','destroy','error','name','send','Users','map','fullname','Tags','TagIds','forEach','push','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','tools_tags','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','openchannel_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','length','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','buildExpression','keys','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','createdAt','parse','$gte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes'];(function(_0x3ae685,_0x55dea6){var _0x57359b=function(_0x4bc7f9){while(--_0x4bc7f9){_0x3ae685['push'](_0x3ae685['shift']());}};_0x57359b(++_0x55dea6);}(_0x5f15,0x148));var _0x55f1=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x5f15[_0x199572];return _0x13cfa3;};'use strict';var emlformat=require(_0x55f1('0x0'));var rimraf=require(_0x55f1('0x1'));var zipdir=require(_0x55f1('0x2'));var jsonpatch=require(_0x55f1('0x3'));var rp=require(_0x55f1('0x4'));var moment=require('moment');var BPromise=require(_0x55f1('0x5'));var Mustache=require(_0x55f1('0x6'));var util=require(_0x55f1('0x7'));var path=require(_0x55f1('0x8'));var sox=require('sox');var csv=require(_0x55f1('0x9'));var ejs=require(_0x55f1('0xa'));var fs=require('fs');var fs_extra=require(_0x55f1('0xb'));var _=require(_0x55f1('0xc'));var squel=require(_0x55f1('0xd'));var crypto=require(_0x55f1('0xe'));var jsforce=require(_0x55f1('0xf'));var deskjs=require(_0x55f1('0x10'));var toCsv=require('to-csv');var querystring=require(_0x55f1('0x11'));var Papa=require(_0x55f1('0x12'));var Redis=require(_0x55f1('0x13'));var authService=require(_0x55f1('0x14'));var qs=require(_0x55f1('0x15'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x55f1('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x55f1('0x17'))('api');var utils=require(_0x55f1('0x18'));var config=require(_0x55f1('0x19'));var licenseUtil=require(_0x55f1('0x1a'));var db=require(_0x55f1('0x1b'))['db'];config['redis']=_[_0x55f1('0x1c')](config[_0x55f1('0x1d')],{'host':_0x55f1('0x1e'),'port':0x18eb});var socket=require(_0x55f1('0x1f'))(new Redis(config[_0x55f1('0x1d')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0x1b52b4,_0x969f4){_0x969f4=_0x969f4||0xcc;return function(_0x39880b){if(_0x39880b){return _0x1b52b4[_0x55f1('0x20')](_0x969f4);}return _0x1b52b4[_0x55f1('0x21')](_0x969f4)[_0x55f1('0x22')]();};}function respondWithResult(_0x4d6c28,_0x3e6da1){_0x3e6da1=_0x3e6da1||0xc8;return function(_0x1f19c4){if(_0x1f19c4){return _0x4d6c28[_0x55f1('0x21')](_0x3e6da1)[_0x55f1('0x23')](_0x1f19c4);}};}function respondWithFilteredResult(_0x3e7b48,_0x44fa09){return function(_0x3fa3ad){if(_0x3fa3ad){var _0x2291d4=typeof _0x44fa09[_0x55f1('0x24')]==='undefined'&&typeof _0x44fa09[_0x55f1('0x25')]==='undefined';var _0x2617c9=_0x3fa3ad[_0x55f1('0x26')];var _0x46ea3f=_0x2291d4?0x0:_0x44fa09['offset'];var _0x5ad5da=_0x2291d4?_0x3fa3ad['count']:_0x44fa09[_0x55f1('0x24')]+_0x44fa09['limit'];var _0x15f539;if(_0x5ad5da>=_0x2617c9){_0x5ad5da=_0x2617c9;_0x15f539=0xc8;}else{_0x15f539=0xce;}_0x3e7b48[_0x55f1('0x21')](_0x15f539);return _0x3e7b48['set'](_0x55f1('0x27'),_0x46ea3f+'-'+_0x5ad5da+'/'+_0x2617c9)[_0x55f1('0x23')](_0x3fa3ad);}return null;};}function patchUpdates(_0x528f63){return function(_0x1e42b1){try{jsonpatch[_0x55f1('0x28')](_0x1e42b1,_0x528f63,!![]);}catch(_0x3fd91e){return BPromise[_0x55f1('0x29')](_0x3fd91e);}return _0x1e42b1[_0x55f1('0x2a')]();};}function saveUpdates(_0x464a4a,_0x4b8667){return function(_0x1bd3be){if(_0x1bd3be){return _0x1bd3be['update'](_0x464a4a)[_0x55f1('0x2b')](function(_0x3e50c3){return _0x3e50c3;});}return null;};}function removeEntity(_0x271130,_0x1215fb){return function(_0x5609cf){if(_0x5609cf){return _0x5609cf[_0x55f1('0x2c')]()[_0x55f1('0x2b')](function(){_0x271130['status'](0xcc)[_0x55f1('0x22')]();});}};}function handleEntityNotFound(_0x5183e6,_0x2e47ed){return function(_0x367da9){if(!_0x367da9){_0x5183e6[_0x55f1('0x20')](0x194);}return _0x367da9;};}function handleError(_0x5a2123,_0x9d996e){_0x9d996e=_0x9d996e||0x1f4;return function(_0x42cb94){logger[_0x55f1('0x2d')](_0x42cb94['stack']);if(_0x42cb94[_0x55f1('0x2e')]){delete _0x42cb94['name'];}_0x5a2123[_0x55f1('0x21')](_0x9d996e)[_0x55f1('0x2f')](_0x42cb94);};}function getInteractionUsers(_0x4a5b89,_0x5efe9c){return new BPromise(function(_0xc79d30,_0x561179){try{if(_0x5efe9c[_0x4a5b89['id']]){_0x4a5b89[_0x55f1('0x30')]=_[_0x55f1('0x31')](_0x5efe9c[_0x4a5b89['id']],function(_0xcb271f){return{'id':_0xcb271f['id'],'fullname':_0xcb271f[_0x55f1('0x32')]};});}}catch(_0x23c46c){_0x561179(_0x23c46c);}_0xc79d30(_0x4a5b89);});}function getInteractionTags(_0x3f44ad,_0x565ee8){return new BPromise(function(_0x33b6c3,_0x4fd0ef){try{if(_0x3f44ad['TagIds']){_0x3f44ad[_0x55f1('0x33')]=[];_0x3f44ad[_0x55f1('0x34')]['split'](',')[_0x55f1('0x35')](function(_0x3d66f2){_0x3f44ad[_0x55f1('0x33')][_0x55f1('0x36')](_0x565ee8[_0x3d66f2]);});}delete _0x3f44ad[_0x55f1('0x34')];}catch(_0x2a1f33){_0x4fd0ef(_0x2a1f33);}_0x33b6c3(_0x3f44ad);});}function updateOpenchannelInteraction(_0x139516,_0x2c8f33,_0x1dfa75){return new BPromise(function(_0x2058ea,_0x48ec61){return getInteractionUsers(_0x139516,_0x1dfa75)[_0x55f1('0x2b')](function(_0xfc0b5b){return getInteractionTags(_0xfc0b5b,_0x2c8f33);})[_0x55f1('0x2b')](function(_0x30865d){_0x2058ea(_0x30865d);})['catch'](function(_0x55989b){_0x48ec61(_0x55989b);});});}exports[_0x55f1('0x37')]=function(_0x49328a,_0x1db0e0){var _0x3813f7={},_0x28aee4={},_0x1cfb87={'count':0x0,'rows':[]};var _0x3eebdf=_[_0x55f1('0x31')](db[_0x55f1('0x38')][_0x55f1('0x39')],function(_0xeed462){return{'name':_0xeed462[_0x55f1('0x3a')],'type':_0xeed462[_0x55f1('0x3b')][_0x55f1('0x3c')]};});_0x28aee4[_0x55f1('0x3d')]=_[_0x55f1('0x31')](_0x3eebdf,_0x55f1('0x2e'));_0x28aee4[_0x55f1('0x3e')]=_['keys'](_0x49328a[_0x55f1('0x3e')]);_0x28aee4[_0x55f1('0x3f')]=_[_0x55f1('0x40')](_0x28aee4['model'],_0x28aee4[_0x55f1('0x3e')]);_0x3813f7[_0x55f1('0x41')]=_[_0x55f1('0x40')](_0x28aee4[_0x55f1('0x3d')],qs[_0x55f1('0x42')](_0x49328a[_0x55f1('0x3e')][_0x55f1('0x42')]));_0x3813f7[_0x55f1('0x41')]=_0x3813f7['attributes']['length']?_0x3813f7[_0x55f1('0x41')]:_0x28aee4[_0x55f1('0x3d')];if(!_0x49328a['query'][_0x55f1('0x43')](_0x55f1('0x44'))){_0x3813f7[_0x55f1('0x25')]=qs[_0x55f1('0x25')](_0x49328a['query'][_0x55f1('0x25')]);_0x3813f7['offset']=qs[_0x55f1('0x24')](_0x49328a[_0x55f1('0x3e')][_0x55f1('0x24')]);}_0x3813f7[_0x55f1('0x45')]=qs[_0x55f1('0x46')](_0x49328a['query'][_0x55f1('0x46')]);_0x3813f7['where']=qs[_0x55f1('0x3f')](_[_0x55f1('0x47')](_0x49328a[_0x55f1('0x3e')],_0x28aee4[_0x55f1('0x3f')]),_0x3eebdf);var _0x48b7c7=[];var _0x3b8344=squel[_0x55f1('0x48')]()['field']('id')[_0x55f1('0x49')]('name')[_0x55f1('0x49')](_0x55f1('0x4a'))[_0x55f1('0x4b')](_0x55f1('0x4c'));var _0x3f677a=squel[_0x55f1('0x48')]()[_0x55f1('0x49')]('u.id')[_0x55f1('0x49')](_0x55f1('0x4d'))[_0x55f1('0x49')](_0x55f1('0x4e'))[_0x55f1('0x4b')](_0x55f1('0x4f'),'ui')['left_join'](_0x55f1('0x50'),'u',_0x55f1('0x51'));var _0x3da7fe=squel[_0x55f1('0x48')]()[_0x55f1('0x4b')](_0x55f1('0x52'),'i')[_0x55f1('0x53')](_0x55f1('0x54'),'c',_0x55f1('0x55'))[_0x55f1('0x53')](_0x55f1('0x50'),'o',_0x55f1('0x56'))[_0x55f1('0x53')](_0x55f1('0x57'),'a','a.id\x20=\x20i.OpenchannelAccountId')['left_join']('openchannel_messages','me','me.OpenchannelInteractionId\x20=\x20i.id')[_0x55f1('0x53')](_0x55f1('0x58'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0x55f1('0x53')](_0x55f1('0x4c'),'t',_0x55f1('0x59'));var _0x34c516=squel['expr']();var _0x3038e8=[];var _0x1fac64=squel[_0x55f1('0x5a')]();var _0x14c9cc;if(_0x49328a[_0x55f1('0x3e')][_0x55f1('0x5b')]){_0x14c9cc=as['parseSearch'](_0x49328a['query'][_0x55f1('0x5b')]);var _0xc2fb31=_0x14c9cc[_0x55f1('0x5c')];for(var _0x513427=0x0;_0x513427<_0x14c9cc['conditions'][_0x55f1('0x5d')];_0x513427++){var _0xd6cb69=_0x14c9cc[_0x55f1('0x5e')][_0x513427];var _0x2e41ed='i';var _0x49d241=_[_0x55f1('0x5f')](_0x3eebdf,['name',_0xd6cb69['field']]);if(!_0x49d241){switch(_0xd6cb69[_0x55f1('0x49')]){case _0x55f1('0x60'):if(_0xd6cb69[_0x55f1('0x61')]==0x1){_0x3da7fe[_0x55f1('0x62')]('`'+_0xd6cb69['field']+_0x55f1('0x63'));}else{_0x3da7fe[_0x55f1('0x62')]('`'+_0xd6cb69['field']+_0x55f1('0x64'));}break;case _0x55f1('0x65'):if(_0xd6cb69[_0x55f1('0x66')]===_0x55f1('0x67')){if(_0xd6cb69['value']['split']('\x20')[_0x55f1('0x5d')]>0x1){_0x34c516[_0xc2fb31](_0x55f1('0x68'),qs['getFullTextValue'](_0xd6cb69[_0x55f1('0x61')]),null);}else{var _0x16bd86='%'+_0xd6cb69[_0x55f1('0x61')]+'%';_0x34c516[_0xc2fb31]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x16bd86,_0x16bd86,_0x16bd86);}}else{_0x49d241=_[_0x55f1('0x5f')](_0x3eebdf,[_0x55f1('0x2e'),_0x55f1('0x69')]);_0xd6cb69['field']=_0x55f1('0x69');_0x191e88=as['buildExpression'](_0x2e41ed,_0x49d241[_0x55f1('0x3b')],_0xd6cb69);_0x34c516[_0xc2fb31](_0x191e88[_0x55f1('0x6a')],_0x191e88[_0x55f1('0x61')][_0x55f1('0x6b')],_0x191e88[_0x55f1('0x61')]['end']);}break;case _0x55f1('0x6c'):var _0x1fbb80=_0xd6cb69['value']['split'](',')[_0x55f1('0x31')](function(_0x162aff){return Number(_0x162aff);});_0x1fbb80['forEach'](function(_0x17cdec){_0x1fac64['or'](_0x55f1('0x6d'),'%,'+_0x17cdec+',%');});_0x3038e8=_[_0x55f1('0x6e')](_0x3038e8,_0x1fbb80);break;case _0x55f1('0x6f'):if(_0xd6cb69[_0x55f1('0x66')]===_0x55f1('0x67')){_0x34c516[_0xc2fb31]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0xd6cb69['value']+'%',null);}else{_0x49d241=_[_0x55f1('0x5f')](_0x3eebdf,['name','UserId']);_0xd6cb69[_0x55f1('0x49')]=_0x55f1('0x70');_0x191e88=as[_0x55f1('0x71')](_0x2e41ed,_0x49d241[_0x55f1('0x3b')],_0xd6cb69);_0x34c516[_0xc2fb31](_0x191e88['text'],_0x191e88['value'][_0x55f1('0x6b')],_0x191e88['value'][_0x55f1('0x22')]);}break;case'body':_0x191e88=as[_0x55f1('0x71')]('me',null,_0xd6cb69);_0x34c516[_0xc2fb31](_0x191e88[_0x55f1('0x6a')],_0x191e88[_0x55f1('0x61')][_0x55f1('0x6b')],_0x191e88[_0x55f1('0x61')][_0x55f1('0x22')]);break;}}else{var _0x191e88=as[_0x55f1('0x71')](_0x2e41ed,_0x49d241['type'],_0xd6cb69);_0x34c516[_0xc2fb31](_0x191e88['text'],_0x191e88[_0x55f1('0x61')]['start'],_0x191e88[_0x55f1('0x61')]['end']);}}}else{var _0x95dbe2=_(_0x49328a[_0x55f1('0x3e')])[_0x55f1('0x72')]()[_0x55f1('0x31')](function(_0x5ed330){return _[_0x55f1('0x73')](_0x3eebdf,[_0x55f1('0x2e'),_0x5ed330])?_0x5ed330:undefined;})[_0x55f1('0x74')]()['value']();if(!_[_0x55f1('0x75')](_0x95dbe2)){_0x95dbe2[_0x55f1('0x35')](function(_0x2e8f5e){if(_0x2e8f5e===_0x55f1('0x76')){_0x3da7fe['where'](_0x55f1('0x77'),[]['concat'](_0x49328a[_0x55f1('0x3e')][_0x2e8f5e]));}else if(_0x2e8f5e===_0x55f1('0x78')){var _0x11cd14=JSON[_0x55f1('0x79')](_0x49328a['query'][_0x2e8f5e])[_0x55f1('0x7a')];var _0x19c8b1=JSON['parse'](_0x49328a[_0x55f1('0x3e')][_0x2e8f5e])['$lte'];_0x3da7fe[_0x55f1('0x7b')](_0x55f1('0x7c'),_0x11cd14,_0x19c8b1);}else{if(_0x49328a[_0x55f1('0x3e')][_0x2e8f5e]===_0x55f1('0x7d')){_0x3da7fe[_0x55f1('0x7b')]('i.'+_0x2e8f5e+'\x20IS\x20NULL');}else{_0x3da7fe[_0x55f1('0x7b')]('i.'+_0x2e8f5e+_0x55f1('0x7e'),_0x49328a[_0x55f1('0x3e')][_0x2e8f5e]);}}});}if(_0x49328a[_0x55f1('0x3e')][_0x55f1('0x7f')]){if(_0x49328a[_0x55f1('0x3e')][_0x55f1('0x7f')]==0x1){_0x3da7fe[_0x55f1('0x62')](_0x55f1('0x80'));}else{_0x3da7fe['having'](_0x55f1('0x81'));}}if(_0x49328a[_0x55f1('0x3e')][_0x55f1('0x82')]){_0x3038e8=_[_0x55f1('0x83')](_0x49328a[_0x55f1('0x3e')][_0x55f1('0x82')])?_0x49328a['query'][_0x55f1('0x82')]:new Array(_0x49328a['query'][_0x55f1('0x82')]);_0x3038e8[_0x55f1('0x35')](function(_0x493a48){_0x1fac64['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x493a48+',%');});}if(_0x49328a[_0x55f1('0x3e')][_0x55f1('0x84')]){var _0x583dd0=_0x49328a[_0x55f1('0x3e')][_0x55f1('0x84')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x55f1('0x85')](_0x583dd0)){_0x34c516['or'](_0x55f1('0x86'),_0x583dd0+'%');}else{_0x34c516['or'](_0x55f1('0x87'),qs['getFullTextValue'](_0x583dd0))['or'](_0x55f1('0x88'),_0x583dd0+'%')['or'](_0x55f1('0x89'),_0x583dd0+'%');}}}_0x3da7fe[_0x55f1('0x7b')](_0x34c516);_0x3da7fe[_0x55f1('0x8a')](_0x55f1('0x8b'));var _0x5a75e6={'type':db[_0x55f1('0x8c')][_0x55f1('0x8d')]['SELECT'],'raw':!![]};var _0x491300=_0x3da7fe['clone']();_0x491300[_0x55f1('0x49')]('i.id');_0x491300[_0x55f1('0x49')](_0x55f1('0x8e'),_0x55f1('0x60'));if(_0x3813f7['order']){_0x3813f7['order'][_0x55f1('0x35')](function(_0x7b040a){var _0xca9dff=_0x7b040a[0x0]===_0x55f1('0x8f')?_0x7b040a[0x0]:'i.'+_0x7b040a[0x0];_0x3da7fe['order'](_0xca9dff,_0x7b040a[0x1]===_0x55f1('0x90')?![]:!![]);});}if(!_[_0x55f1('0x75')](_0x3038e8)){_0x3da7fe[_0x55f1('0x62')](_0x1fac64);_0x491300[_0x55f1('0x7b')](_0x55f1('0x91'),_0x3038e8);}BPromise[_0x55f1('0x92')]()[_0x55f1('0x2b')](function(){if(!_0x14c9cc){if(_0x49328a[_0x55f1('0x3e')][_0x55f1('0x76')])return;_0x491300['where'](_0x55f1('0x93'));_0x3da7fe[_0x55f1('0x7b')](_0x55f1('0x93'));return;}if(_0x49328a['user']['role']!=='agent')return;return _0x49328a[_0x55f1('0x94')][_0x55f1('0x95')]({'attributes':['id'],'raw':!![]})[_0x55f1('0x2b')](function(_0x15a628){if(_['isEmpty'](_0x15a628)){_0x491300[_0x55f1('0x7b')](_0x55f1('0x96'));_0x3da7fe['where'](_0x55f1('0x96'));}else{_0x491300['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0x55f1('0x31')](_0x15a628,'id'));_0x3da7fe[_0x55f1('0x7b')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x15a628,'id'));}});})[_0x55f1('0x2b')](function(){if(_0x49328a[_0x55f1('0x94')][_0x55f1('0x97')]===_0x55f1('0x98')&&!_0x14c9cc&&!_0x49328a['query'][_0x55f1('0x76')])return[];return db[_0x55f1('0x99')][_0x55f1('0x3e')](_0x491300[_0x55f1('0x9a')](),_0x5a75e6);})['then'](function(_0x49938a){_0x1cfb87[_0x55f1('0x26')]=_0x49938a['length'];if(_0x1cfb87[_0x55f1('0x26')]===0x0)return[];return db[_0x55f1('0x99')][_0x55f1('0x3e')](_0x3b8344[_0x55f1('0x9a')](),_0x5a75e6)[_0x55f1('0x2b')](function(_0x3f22de){_0x48b7c7=_[_0x55f1('0x9b')](_0x3f22de,'id');_0x5a75e6=_[_0x55f1('0x9c')](_0x5a75e6,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x49328a[_0x55f1('0x3e')][_0x55f1('0x42')]){_0x3813f7[_0x55f1('0x41')]['forEach'](function(_0x39a3a1){_0x3da7fe['field']('i.'+_0x39a3a1);});}else{_0x3da7fe['field'](_0x55f1('0x8e'),'unreadMessages');_0x3da7fe[_0x55f1('0x49')]('a.key',_0x55f1('0x9d'));_0x3da7fe[_0x55f1('0x49')](_0x55f1('0x9e'),_0x55f1('0x9f'));_0x3da7fe['field'](_0x55f1('0xa0'),'contactName');_0x3da7fe[_0x55f1('0x49')]('i.*');_0x3da7fe[_0x55f1('0x49')](_0x55f1('0xa1'),'Contact.firstName');_0x3da7fe['field'](_0x55f1('0xa2'),_0x55f1('0xa3'));_0x3da7fe[_0x55f1('0x49')](_0x55f1('0xa4'),_0x55f1('0xa5'));_0x3da7fe['field']('c.phone','Contact.phone');_0x3da7fe[_0x55f1('0x49')](_0x55f1('0xa6'),_0x55f1('0xa7'));_0x3da7fe['field'](_0x55f1('0xa8'),'Contact.fax');_0x3da7fe[_0x55f1('0x49')](_0x55f1('0xa9'),'Owner.fullname');_0x3da7fe[_0x55f1('0x49')](_0x55f1('0xaa'),_0x55f1('0xab'));_0x3da7fe[_0x55f1('0x49')](_0x55f1('0xac'),_0x55f1('0x34'));}if(_0x3813f7[_0x55f1('0x25')])_0x3da7fe[_0x55f1('0x25')](_0x3813f7[_0x55f1('0x25')]);if(_0x3813f7[_0x55f1('0x24')])_0x3da7fe['offset'](_0x3813f7[_0x55f1('0x24')]);return db['sequelize'][_0x55f1('0x3e')](_0x3da7fe['toString'](),_0x5a75e6);})['then'](function(_0x596c4f){if(_0x596c4f['length']>0x0)_0x3f677a[_0x55f1('0x7b')](_0x55f1('0xad'),_['map'](_0x596c4f,'id'));return db['sequelize'][_0x55f1('0x3e')](_0x3f677a[_0x55f1('0x9a')](),_0x5a75e6)[_0x55f1('0x2b')](function(_0x2929f2){var _0xfac6be=_[_0x55f1('0xae')](_0x2929f2,_0x55f1('0xaf'));var _0x21f2af=[];_0x596c4f[_0x55f1('0x35')](function(_0x227e6b){_0x21f2af[_0x55f1('0x36')](updateOpenchannelInteraction(_0x227e6b,_0x48b7c7,_0xfac6be));});return BPromise['all'](_0x21f2af);});});})[_0x55f1('0x2b')](function(_0x4e381c){_0x1cfb87['rows']=_0x4e381c;return _0x1cfb87;})['then'](respondWithFilteredResult(_0x1db0e0,_0x3813f7))[_0x55f1('0xb0')](handleError(_0x1db0e0,null));};exports[_0x55f1('0xb1')]=function(_0xaf307a,_0x3b9d52){var _0x51a9f0={};if(_0xaf307a[_0x55f1('0x3e')][_0x55f1('0x3b')]&&_0xaf307a['query']['type']===_0x55f1('0x4b')){_0x51a9f0['from']=_0xaf307a['params']['id'];}else{_0x51a9f0['id']=_0xaf307a['params']['id'];}var _0x19a11b={'raw':![],'where':_0x51a9f0},_0x13e887={};_0x13e887[_0x55f1('0x3d')]=_[_0x55f1('0x72')](db[_0x55f1('0x38')][_0x55f1('0x39')]);_0x13e887[_0x55f1('0x3e')]=_[_0x55f1('0x72')](_0xaf307a[_0x55f1('0x3e')]);_0x13e887[_0x55f1('0x3f')]=_['intersection'](_0x13e887[_0x55f1('0x3d')],_0x13e887['query']);_0x19a11b[_0x55f1('0x41')]=_[_0x55f1('0x40')](_0x13e887['model'],qs[_0x55f1('0x42')](_0xaf307a[_0x55f1('0x3e')]['fields']));_0x19a11b[_0x55f1('0x41')]=_0x19a11b[_0x55f1('0x41')][_0x55f1('0x5d')]?_0x19a11b[_0x55f1('0x41')]:_0x13e887[_0x55f1('0x3d')];if(_0xaf307a[_0x55f1('0x3e')][_0x55f1('0xb2')]){_0x19a11b['include']=[{'all':!![]}];}_0x19a11b=_[_0x55f1('0x9c')]({},_0x19a11b,_0xaf307a[_0x55f1('0xb3')]);return db[_0x55f1('0x38')][_0x55f1('0x5f')](_0x19a11b)[_0x55f1('0x2b')](handleEntityNotFound(_0x3b9d52,null))['then'](respondWithResult(_0x3b9d52,null))[_0x55f1('0xb0')](handleError(_0x3b9d52,null));};exports[_0x55f1('0xb4')]=function(_0x22d9bf,_0x387bf5){return db[_0x55f1('0x38')][_0x55f1('0xb4')](_0x22d9bf[_0x55f1('0xb5')],{})[_0x55f1('0x2b')](respondWithResult(_0x387bf5,0xc9))[_0x55f1('0xb0')](handleError(_0x387bf5,null));};exports[_0x55f1('0xb6')]=function(_0x5eff8e,_0x177c0d){if(_0x5eff8e['body']['id']){delete _0x5eff8e[_0x55f1('0xb5')]['id'];}return db[_0x55f1('0x38')][_0x55f1('0x5f')]({'where':{'id':_0x5eff8e['params']['id']}})[_0x55f1('0x2b')](handleEntityNotFound(_0x177c0d,null))['then'](saveUpdates(_0x5eff8e[_0x55f1('0xb5')],null))['then'](respondWithResult(_0x177c0d,null))[_0x55f1('0xb0')](handleError(_0x177c0d,null));};exports[_0x55f1('0x2c')]=function(_0xb2201c,_0x591a51){return db[_0x55f1('0x38')]['find']({'where':{'id':_0xb2201c[_0x55f1('0xb7')]['id']}})['then'](handleEntityNotFound(_0x591a51,null))[_0x55f1('0x2b')](removeEntity(_0x591a51,null))[_0x55f1('0xb0')](handleError(_0x591a51,null));};exports['describe']=function(_0xa93b94,_0x428a4d){return db[_0x55f1('0x38')][_0x55f1('0xb8')]()[_0x55f1('0x2b')](respondWithResult(_0x428a4d,null))['catch'](handleError(_0x428a4d,null));};exports[_0x55f1('0xb9')]=function(_0x5ee46b,_0x24f829,_0x4b9750){return db[_0x55f1('0xba')][_0x55f1('0x5f')]({'where':{'id':_0x5ee46b[_0x55f1('0xb7')]['id']}})['then'](handleEntityNotFound(_0x24f829,null))['then'](function(_0xabf844){if(_0xabf844){return _0xabf844[_0x55f1('0xb9')](_0x5ee46b[_0x55f1('0xb5')][_0x55f1('0xbb')],_[_0x55f1('0xbc')](_0x5ee46b['body'],['ids','id'])||{});}})[_0x55f1('0x2b')](respondWithResult(_0x24f829,null))['catch'](handleError(_0x24f829,null));};exports[_0x55f1('0xbd')]=function(_0x9b646,_0x2a5e3a,_0x543b3c){var _0x2f490d={'raw':![],'where':{}};var _0x17125b={};var _0xc76cd6={'count':0x0,'rows':[]};return db[_0x55f1('0x38')][_0x55f1('0xbe')]({'where':{'id':_0x9b646['params']['id']}})['then'](handleEntityNotFound(_0x2a5e3a,null))[_0x55f1('0x2b')](function(_0x2ad340){if(_0x2ad340){_0x17125b[_0x55f1('0x3d')]=_[_0x55f1('0x72')](db[_0x55f1('0xba')][_0x55f1('0x39')]);_0x17125b[_0x55f1('0x3e')]=_[_0x55f1('0x72')](_0x9b646[_0x55f1('0x3e')]);_0x17125b[_0x55f1('0x3f')]=_[_0x55f1('0x40')](_0x17125b[_0x55f1('0x3d')],_0x17125b[_0x55f1('0x3e')]);_0x2f490d[_0x55f1('0x41')]=_['intersection'](_0x17125b['model'],qs['fields'](_0x9b646[_0x55f1('0x3e')][_0x55f1('0x42')]));_0x2f490d[_0x55f1('0x41')]=_0x2f490d[_0x55f1('0x41')]['length']?_0x2f490d[_0x55f1('0x41')]:_0x17125b['model'];if(!_0x9b646[_0x55f1('0x3e')][_0x55f1('0x43')](_0x55f1('0x44'))){_0x2f490d[_0x55f1('0x25')]=qs[_0x55f1('0x25')](_0x9b646['query']['limit']);_0x2f490d['offset']=qs[_0x55f1('0x24')](_0x9b646[_0x55f1('0x3e')][_0x55f1('0x24')]);}_0x2f490d[_0x55f1('0x45')]=qs[_0x55f1('0x46')](_0x9b646[_0x55f1('0x3e')]['sort']);_0x2f490d[_0x55f1('0x7b')]=qs[_0x55f1('0x3f')](_['pick'](_0x9b646[_0x55f1('0x3e')],_0x17125b[_0x55f1('0x3f')]));_0x2f490d[_0x55f1('0x7b')][_0x55f1('0xaf')]=_0x2ad340['id'];if(_0x9b646['query'][_0x55f1('0x84')]){_0x2f490d[_0x55f1('0x7b')]=_[_0x55f1('0x9c')](_0x2f490d[_0x55f1('0x7b')],{'$or':_[_0x55f1('0x31')](_0x2f490d[_0x55f1('0x41')],function(_0x11aed4){var _0x538944={};_0x538944[_0x11aed4]={'$like':'%'+_0x9b646[_0x55f1('0x3e')][_0x55f1('0x84')]+'%'};return _0x538944;})});}if(_0x9b646[_0x55f1('0x3e')][_0x55f1('0x7a')]){var _0x11cc63=_0x9b646[_0x55f1('0x3e')][_0x55f1('0x7a')]['split'](',');var _0x210b9d={};_0x210b9d[_0x11cc63[0x0]]={'$gte':moment(_0x11cc63[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x2f490d['where']=_[_0x55f1('0x9c')](_0x2f490d[_0x55f1('0x7b')],_0x210b9d);}_0x2f490d=_[_0x55f1('0x9c')]({},_0x2f490d,_0x9b646[_0x55f1('0xb3')]);return db[_0x55f1('0xba')]['count']({'where':_0x2f490d[_0x55f1('0x7b')]})[_0x55f1('0x2b')](function(_0x18df35){_0xc76cd6[_0x55f1('0x26')]=_0x18df35;if(_0x9b646[_0x55f1('0x3e')][_0x55f1('0xb2')]){_0x2f490d[_0x55f1('0xbf')]=[{'all':!![]}];}return db[_0x55f1('0xba')]['findAll'](_0x2f490d);})[_0x55f1('0x2b')](function(_0x48e8f4){_0xc76cd6['rows']=_0x48e8f4;return _0xc76cd6;});}})['then'](respondWithFilteredResult(_0x2a5e3a,_0x2f490d))[_0x55f1('0xb0')](handleError(_0x2a5e3a,null));};exports['addTags']=function(_0x1359b4,_0x34e3cf,_0x438df3){return db['OpenchannelInteraction']['find']({'where':{'id':_0x1359b4[_0x55f1('0xb7')]['id']}})['then'](handleEntityNotFound(_0x34e3cf,null))['then'](function(_0x25db3d){if(_0x25db3d){return _0x25db3d[_0x55f1('0xc0')](_0x1359b4['body'][_0x55f1('0xbb')],_[_0x55f1('0xbc')](_0x1359b4[_0x55f1('0xb5')],[_0x55f1('0xbb'),'id'])||{})['spread'](function(){return db['Tag'][_0x55f1('0xc1')]({'attributes':['id',_0x55f1('0x2e'),'color'],'where':{'id':_0x1359b4[_0x55f1('0xb5')][_0x55f1('0xbb')]}});})[_0x55f1('0x2b')](function(_0x1d062f){socket[_0x55f1('0xc2')](_0x55f1('0xc3'),{'id':Number(_0x1359b4[_0x55f1('0xb7')]['id']),'tags':_0x1d062f||[]});return{'id':Number(_0x1359b4[_0x55f1('0xb7')]['id']),'tags':_0x1d062f||[]};});}})[_0x55f1('0x2b')](respondWithResult(_0x34e3cf,null))[_0x55f1('0xb0')](handleError(_0x34e3cf,null));};exports[_0x55f1('0xc4')]=function(_0x234872,_0x251764,_0xcc288c){return db[_0x55f1('0x38')][_0x55f1('0x5f')]({'where':{'id':_0x234872[_0x55f1('0xb7')]['id']}})[_0x55f1('0x2b')](handleEntityNotFound(_0x251764,null))['then'](function(_0x176b4b){if(_0x176b4b){return _0x176b4b[_0x55f1('0xc4')](_0x234872[_0x55f1('0x3e')][_0x55f1('0xbb')]);}})[_0x55f1('0x2b')](respondWithStatusCode(_0x251764,null))[_0x55f1('0xb0')](handleError(_0x251764,null));};exports[_0x55f1('0xc5')]=function(_0x4ea521,_0x3c90f3){var _0x12b056=moment()[_0x55f1('0xc6')]()[_0x55f1('0x9a')]();var _0x7447da=path['join'](config[_0x55f1('0xc7')],_0x55f1('0xc8'),_0x55f1('0xc9'),'tmp');var _0x57eb1b=path['join'](config[_0x55f1('0xc7')],'server',_0x55f1('0xc9'),'attachments');var _0x5ef895=path[_0x55f1('0xca')](_0x7447da,_0x12b056);var _0x2baa51=util[_0x55f1('0xcb')](_0x55f1('0xcc'),_0x4ea521[_0x55f1('0xb7')]['id'],_0x12b056);var _0x2c73c4=path['join'](_0x7447da,_0x2baa51);var _0x3173b3=[];_0x3173b3[_0x55f1('0x36')]({'model':db[_0x55f1('0x6f')],'as':_0x55f1('0x6f'),'attributes':['id','fullname'],'raw':!![]});_0x3173b3[_0x55f1('0x36')]({'model':db[_0x55f1('0xcd')],'as':_0x55f1('0x65'),'attributes':['id',_0x55f1('0xce'),_0x55f1('0xcf')],'raw':!![]});if(_0x4ea521[_0x55f1('0x3e')]['attachments']){_0x3173b3[_0x55f1('0x36')]({'model':db['Attachment'],'as':_0x55f1('0xd0'),'raw':!![]});}var _0xddb795=[{'model':db['OpenchannelMessage'],'as':_0x55f1('0xd1'),'attributes':['id',_0x55f1('0xb5'),'createdAt',_0x55f1('0xd2'),_0x55f1('0xd3'),_0x55f1('0x7f')],'include':_0x3173b3}];_0xddb795[_0x55f1('0x36')]({'model':db[_0x55f1('0xd4')],'as':_0x55f1('0xd5'),'attributes':['id',_0x55f1('0x2e')]});_0xddb795[_0x55f1('0x36')]({'model':db['User'],'as':'Owner','attributes':['id',_0x55f1('0x32')]});return db['OpenchannelInteraction'][_0x55f1('0x5f')]({'where':{'id':_0x4ea521[_0x55f1('0xb7')]['id']},'include':_0xddb795})[_0x55f1('0x2b')](handleEntityNotFound(_0x3c90f3,null))['then'](function(_0x25fd4e){if(_0x25fd4e){var _0x3b1a3f=_0x25fd4e[_0x55f1('0xd6')]({'plain':!![]});fs[_0x55f1('0xd7')](_0x5ef895);var _0x5994b6={'channel':_0x55f1('0xd8'),'account':_0x3b1a3f['Account']['name'],'agent':_0x3b1a3f[_0x55f1('0xd9')]?_0x3b1a3f[_0x55f1('0xd9')][_0x55f1('0x32')]:_0x55f1('0xda'),'createdAt':moment(_0x3b1a3f[_0x55f1('0x78')])['format'](_0x55f1('0xdb'))[_0x55f1('0x9a')](),'closedAt':_0x3b1a3f['closed']?moment(_0x3b1a3f[_0x55f1('0xdc')])[_0x55f1('0xcb')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x3b1a3f['disposition'],'visibility':_0x3b1a3f[_0x55f1('0xdd')]?'Public':_0x55f1('0xde'),'messages':_(_0x3b1a3f[_0x55f1('0xd1')])[_0x55f1('0x84')]({'secret':![]})[_0x55f1('0x31')](function(_0x4fa42){if(_0x4fa42[_0x55f1('0xd0')]){var _0xb17b09=path['join'](_0x57eb1b,_0x4fa42['Attachment'][_0x55f1('0xdf')]);if(fs[_0x55f1('0xe0')](_0xb17b09)){fs[_0x55f1('0xe1')](_0xb17b09)['pipe'](fs[_0x55f1('0xe2')](path['join'](_0x5ef895,_0x4fa42[_0x55f1('0xd0')][_0x55f1('0xdf')])));}}return{'date':moment(_0x4fa42[_0x55f1('0x78')])[_0x55f1('0xcb')](_0x55f1('0xdb'))[_0x55f1('0x9a')](),'sender':_0x4fa42['direction']===_0x55f1('0xe3')?_0x4fa42[_0x55f1('0x6f')]?_0x4fa42[_0x55f1('0x6f')][_0x55f1('0x32')]:'System':_0x4fa42[_0x55f1('0x65')][_0x55f1('0xce')]+(_0x4fa42['Contact'][_0x55f1('0xcf')]?'\x20'+_0x4fa42[_0x55f1('0x65')][_0x55f1('0xcf')]:''),'body':_0x4fa42[_0x55f1('0xd0')]?_0x4fa42[_0x55f1('0xd0')][_0x55f1('0xdf')]:_0x4fa42[_0x55f1('0xb5')],'direction':_0x4fa42['direction']===_0x55f1('0xe3')?'A':'C','secret':_0x4fa42[_0x55f1('0xd3')],'read':_0x4fa42['read'],'attachment':_0x4fa42[_0x55f1('0xd0')]};})[_0x55f1('0x61')]()};return ejs[_0x55f1('0xe4')](path[_0x55f1('0xca')](config['root'],_0x55f1('0xc8'),'views','downloadInteraction.ejs'),{'interaction':_0x5994b6})[_0x55f1('0x2b')](function(_0x2701eb){var _0x463ea2=path[_0x55f1('0xca')](_0x5ef895,_0x55f1('0xe5')+_0x3b1a3f['id']+'-'+_0x12b056+_0x55f1('0xe6'));var _0x31191c={'path':_0x463ea2,'channel':_0x55f1('0xd8'),'interactionId':_0x3b1a3f['id']};return pdf[_0x55f1('0xe7')](_0x2701eb,_0x31191c);})['then'](function(){return new BPromise(function(_0x713620,_0x47dc55){zipdir(_0x5ef895,{'saveTo':_0x2c73c4},function(_0x4daa6d,_0x3e9de0){if(_0x4daa6d)return _0x47dc55(_0x4daa6d);return _0x713620(_0x3e9de0);});})['then'](function(){return new BPromise(function(_0x1361af,_0x44bcbc){rimraf(_0x5ef895,function(_0x314133){if(_0x314133)_0x44bcbc(_0x314133);return _0x1361af();});});})['then'](function(){return _0x3c90f3[_0x55f1('0xc5')](_0x2c73c4,_0x2baa51,function(_0x428dae){if(_0x428dae){console[_0x55f1('0xe8')](_0x55f1('0xe9'),_0x428dae);}else{fs[_0x55f1('0xea')](_0x2c73c4);}});});});}else{return _0x3c90f3['sendStatus'](0xc8);}})[_0x55f1('0xb0')](handleError(_0x3c90f3,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 276b345..52665ba 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 _0x33b4=['catch','hasOwnProperty','exports','../../mysqldb','OpenchannelInteraction','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','length','emit'];(function(_0x1b7c89,_0x5e5aa3){var _0x1bb9c8=function(_0x4f73da){while(--_0x4f73da){_0x1b7c89['push'](_0x1b7c89['shift']());}};_0x1bb9c8(++_0x5e5aa3);}(_0x33b4,0x1a7));var _0x433b=function(_0x161a04,_0x27a585){_0x161a04=_0x161a04-0x0;var _0x565921=_0x33b4[_0x161a04];return _0x565921;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x433b('0x0'))['db'][_0x433b('0x1')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x433b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x433b('0x3'),'afterDestroy':_0x433b('0x4')};function emitEvent(_0x140c0b){return function(_0x30c2cc,_0x28953e,_0x11de19){_0x30c2cc[_0x433b('0x5')]({'attributes':['id'],'raw':!![]})[_0x433b('0x6')](function(_0x3ea041){_0x30c2cc[_0x433b('0x7')](_0x433b('0x8'),_0x3ea041[_0x433b('0x9')](function(_0x3914ac){return{'id':_0x3914ac['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x30c2cc['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x32dbaa){_0x30c2cc[_0x433b('0x7')]('unreadMessages',_0x32dbaa[_0x433b('0xa')]);OpenchannelInteractionEvents[_0x433b('0xb')](_0x140c0b+':'+_0x30c2cc['id'],_0x30c2cc);OpenchannelInteractionEvents[_0x433b('0xb')](_0x140c0b,_0x30c2cc);_0x11de19(null);})[_0x433b('0xc')](_0x11de19(null));};}for(var e in events){if(events[_0x433b('0xd')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x433b('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x25b2=['findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','update','remove','getUsers','setDataValue','Users','map'];(function(_0x540fd5,_0x331d3a){var _0xdc2b57=function(_0x2bc3aa){while(--_0x2bc3aa){_0x540fd5['push'](_0x540fd5['shift']());}};_0xdc2b57(++_0x331d3a);}(_0x25b2,0x181));var _0x225b=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x25b2[_0x110c3d];return _0x226d67;};'use strict';var EventEmitter=require(_0x225b('0x0'));var OpenchannelInteraction=require(_0x225b('0x1'))['db'][_0x225b('0x2')];var OpenchannelMessage=require(_0x225b('0x1'))['db'][_0x225b('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x225b('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x225b('0x5'),'afterDestroy':_0x225b('0x6')};function emitEvent(_0x2f2669){return function(_0x487108,_0x4744d4,_0x53731e){_0x487108[_0x225b('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3c694c){_0x487108[_0x225b('0x8')](_0x225b('0x9'),_0x3c694c[_0x225b('0xa')](function(_0x23babb){return{'id':_0x23babb['id']};}));return OpenchannelMessage[_0x225b('0xb')]({'where':{'OpenchannelInteractionId':_0x487108['id'],'direction':'in','read':![]},'raw':!![]});})[_0x225b('0xc')](function(_0x14405f){_0x487108[_0x225b('0x8')](_0x225b('0xd'),_0x14405f[_0x225b('0xe')]);OpenchannelInteractionEvents[_0x225b('0xf')](_0x2f2669+':'+_0x487108['id'],_0x487108);OpenchannelInteractionEvents[_0x225b('0xf')](_0x2f2669,_0x487108);_0x53731e(null);})[_0x225b('0x10')](_0x53731e(null));};}for(var e in events){if(events[_0x225b('0x11')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index ab59d9c..7f15142 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 _0x4c61=['./openchannelInteraction.attributes','exports','OpenchannelInteraction','utf8mb4','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x414229,_0x2f9653){var _0x2c4188=function(_0x19781d){while(--_0x19781d){_0x414229['push'](_0x414229['shift']());}};_0x2c4188(++_0x2f9653);}(_0x4c61,0x17e));var _0x14c6=function(_0x4a668e,_0x52edb9){_0x4a668e=_0x4a668e-0x0;var _0x3bc813=_0x4c61[_0x4a668e];return _0x3bc813;};'use strict';var _=require('lodash');var util=require(_0x14c6('0x0'));var logger=require(_0x14c6('0x1'))(_0x14c6('0x2'));var moment=require(_0x14c6('0x3'));var BPromise=require(_0x14c6('0x4'));var rp=require(_0x14c6('0x5'));var fs=require('fs');var path=require(_0x14c6('0x6'));var rimraf=require(_0x14c6('0x7'));var config=require(_0x14c6('0x8'));var attributes=require(_0x14c6('0x9'));module[_0x14c6('0xa')]=function(_0x2b2670,_0x2bf75c){return _0x2b2670['define'](_0x14c6('0xb'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x14c6('0xc'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x5c4774,_0x518549,_0xed2486){if(_0x5c4774[_0x14c6('0xd')](_0x14c6('0xe'))){_0x5c4774[_0x14c6('0xf')]=moment()['format'](_0x14c6('0x10'));}_0xed2486(null,_0x5c4774);}}});}; \ No newline at end of file +var _0xb8cd=['api','moment','request-promise','path','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x138385,_0x53edfd){var _0x12d1cb=function(_0x4fa61f){while(--_0x4fa61f){_0x138385['push'](_0x138385['shift']());}};_0x12d1cb(++_0x53edfd);}(_0xb8cd,0x1d9));var _0xdb8c=function(_0x45c19c,_0x5e8b36){_0x45c19c=_0x45c19c-0x0;var _0x5b1142=_0xb8cd[_0x45c19c];return _0x5b1142;};'use strict';var _=require(_0xdb8c('0x0'));var util=require(_0xdb8c('0x1'));var logger=require(_0xdb8c('0x2'))(_0xdb8c('0x3'));var moment=require(_0xdb8c('0x4'));var BPromise=require('bluebird');var rp=require(_0xdb8c('0x5'));var fs=require('fs');var path=require(_0xdb8c('0x6'));var rimraf=require('rimraf');var config=require(_0xdb8c('0x7'));var attributes=require(_0xdb8c('0x8'));module[_0xdb8c('0x9')]=function(_0x5372d1,_0x20841c){return _0x5372d1[_0xdb8c('0xa')](_0xdb8c('0xb'),attributes,{'tableName':_0xdb8c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xdb8c('0xd'),'hooks':{'beforeUpdate':function(_0x5eed31,_0x6bb852,_0x2413e5){if(_0x5eed31[_0xdb8c('0xe')]('closed')){_0x5eed31[_0xdb8c('0xf')]=moment()['format'](_0xdb8c('0x10'));}_0x2413e5(null,_0x5eed31);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index eef3ef5..3d96b80 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 _0x77ea=['omit','body','AddTags','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./openchannelInteraction.socket','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','attributes','limit','AddTagsToOpenchannelInteraction','find','where','addTags','ids'];(function(_0x5720dd,_0x37478a){var _0x5e59e5=function(_0x1b6f11){while(--_0x1b6f11){_0x5720dd['push'](_0x5720dd['shift']());}};_0x5e59e5(++_0x37478a);}(_0x77ea,0x129));var _0xa77e=function(_0x1d5b2f,_0x887262){_0x1d5b2f=_0x1d5b2f-0x0;var _0x2e4489=_0x77ea[_0x1d5b2f];return _0x2e4489;};'use strict';var _=require(_0xa77e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa77e('0x1'));var rs=require(_0xa77e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa77e('0x3'));var logger=require(_0xa77e('0x4'))(_0xa77e('0x5'));var config=require(_0xa77e('0x6'));var jayson=require(_0xa77e('0x7'));var client=jayson[_0xa77e('0x8')][_0xa77e('0x9')]({'port':0x232a});config['redis']=_[_0xa77e('0xa')](config[_0xa77e('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xa77e('0xc'))(new Redis(config[_0xa77e('0xb')]));require(_0xa77e('0xd'))['register'](socket);function respondWithRpcPromise(_0x4e0ede,_0x7737e5,_0x320416){return new BPromise(function(_0x5969c5,_0x3e73d4){return client[_0xa77e('0xe')](_0x4e0ede,_0x320416)[_0xa77e('0xf')](function(_0x4e22de){logger[_0xa77e('0x10')](_0xa77e('0x11'),_0x7737e5,'request\x20sent');logger[_0xa77e('0x12')](_0xa77e('0x13'),_0x7737e5,_0xa77e('0x14'),JSON[_0xa77e('0x15')](_0x4e22de));if(_0x4e22de[_0xa77e('0x16')]){if(_0x4e22de[_0xa77e('0x16')][_0xa77e('0x17')]===0x1f4){logger['error'](_0xa77e('0x11'),_0x7737e5,_0x4e22de['error'][_0xa77e('0x18')]);return _0x3e73d4(_0x4e22de[_0xa77e('0x16')][_0xa77e('0x18')]);}logger[_0xa77e('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x7737e5,_0x4e22de[_0xa77e('0x16')]['message']);return _0x5969c5(_0x4e22de[_0xa77e('0x16')]['message']);}else{logger[_0xa77e('0x10')](_0xa77e('0x11'),_0x7737e5,_0xa77e('0x14'));_0x5969c5(_0x4e22de[_0xa77e('0x19')]['message']);}})[_0xa77e('0x1a')](function(_0x25cca7){logger[_0xa77e('0x16')](_0xa77e('0x11'),_0x7737e5,_0x25cca7);_0x3e73d4(_0x25cca7);});});}exports[_0xa77e('0x1b')]=function(_0x3ba499){var _0x5cb476=this;return new Promise(function(_0x54f630,_0x491bd7){return db[_0xa77e('0x1c')][_0xa77e('0x1d')](_0x3ba499['body'],{'raw':_0x3ba499[_0xa77e('0x1e')]?_0x3ba499[_0xa77e('0x1e')][_0xa77e('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ba499['options']?_0x3ba499[_0xa77e('0x1e')]['where']||null:null,'attributes':_0x3ba499[_0xa77e('0x1e')]?_0x3ba499[_0xa77e('0x1e')][_0xa77e('0x20')]||null:null,'limit':_0x3ba499[_0xa77e('0x1e')]?_0x3ba499[_0xa77e('0x1e')][_0xa77e('0x21')]||null:null})['then'](function(_0x344b31){logger[_0xa77e('0x10')](_0xa77e('0x1b'),_0x3ba499);logger['debug'](_0xa77e('0x1b'),_0x3ba499,JSON['stringify'](_0x344b31));_0x54f630(_0x344b31);})[_0xa77e('0x1a')](function(_0x1eee8c){logger[_0xa77e('0x16')](_0xa77e('0x1b'),_0x1eee8c['message'],_0x3ba499);_0x491bd7(_0x5cb476['error'](0x1f4,_0x1eee8c[_0xa77e('0x18')]));});});};exports[_0xa77e('0x22')]=function(_0x401ff1){return new Promise(function(_0x3f98cf,_0x434eb7){return db[_0xa77e('0x1c')][_0xa77e('0x23')]({'where':_0x401ff1[_0xa77e('0x1e')]?_0x401ff1[_0xa77e('0x1e')][_0xa77e('0x24')]||null:null})[_0xa77e('0xf')](function(_0x533fb6){if(_0x533fb6){return _0x533fb6[_0xa77e('0x25')](_0x401ff1['body'][_0xa77e('0x26')],_[_0xa77e('0x27')](_0x401ff1[_0xa77e('0x28')],['ids','id'])||{});}})['spread'](function(_0x59009b){logger[_0xa77e('0x10')](_0xa77e('0x29'),_0x401ff1);logger[_0xa77e('0x12')](_0xa77e('0x29'),_0x401ff1,JSON[_0xa77e('0x15')](_0x59009b));_0x3f98cf(_0x59009b);})[_0xa77e('0x1a')](function(_0xd17180){logger[_0xa77e('0x16')]('AddTags',_0xd17180[_0xa77e('0x18')],_0x401ff1);_0x434eb7(_this[_0xa77e('0x16')](0x1f4,_0xd17180[_0xa77e('0x18')]));});});}; \ No newline at end of file +var _0x4c72=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateOpenchannelInteraction','update','body','options','raw','limit','then','debug','OpenchannelInteraction','find','where','addTags','ids','omit','spread','AddTags'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4c72,0x1d9));var _0x24c7=function(_0x4639f9,_0x1097bd){_0x4639f9=_0x4639f9-0x0;var _0x210add=_0x4c72[_0x4639f9];return _0x210add;};'use strict';var _=require(_0x24c7('0x0'));var util=require(_0x24c7('0x1'));var moment=require(_0x24c7('0x2'));var BPromise=require(_0x24c7('0x3'));var rs=require(_0x24c7('0x4'));var fs=require('fs');var Redis=require(_0x24c7('0x5'));var db=require(_0x24c7('0x6'))['db'];var utils=require(_0x24c7('0x7'));var logger=require(_0x24c7('0x8'))(_0x24c7('0x9'));var config=require(_0x24c7('0xa'));var jayson=require(_0x24c7('0xb'));var client=jayson[_0x24c7('0xc')]['http']({'port':0x232a});config[_0x24c7('0xd')]=_[_0x24c7('0xe')](config[_0x24c7('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x24c7('0xf'))(new Redis(config['redis']));require(_0x24c7('0x10'))['register'](socket);function respondWithRpcPromise(_0x2ae237,_0x3cfc3c,_0x41c45b){return new BPromise(function(_0xac9fe7,_0x39c6a7){return client[_0x24c7('0x11')](_0x2ae237,_0x41c45b)['then'](function(_0x522a70){logger[_0x24c7('0x12')](_0x24c7('0x13'),_0x3cfc3c,_0x24c7('0x14'));logger['debug'](_0x24c7('0x15'),_0x3cfc3c,_0x24c7('0x14'),JSON[_0x24c7('0x16')](_0x522a70));if(_0x522a70['error']){if(_0x522a70[_0x24c7('0x17')][_0x24c7('0x18')]===0x1f4){logger[_0x24c7('0x17')](_0x24c7('0x13'),_0x3cfc3c,_0x522a70[_0x24c7('0x17')]['message']);return _0x39c6a7(_0x522a70[_0x24c7('0x17')][_0x24c7('0x19')]);}logger['error'](_0x24c7('0x13'),_0x3cfc3c,_0x522a70[_0x24c7('0x17')][_0x24c7('0x19')]);return _0xac9fe7(_0x522a70[_0x24c7('0x17')][_0x24c7('0x19')]);}else{logger[_0x24c7('0x12')](_0x24c7('0x13'),_0x3cfc3c,_0x24c7('0x14'));_0xac9fe7(_0x522a70['result']['message']);}})[_0x24c7('0x1a')](function(_0x3492d7){logger[_0x24c7('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3cfc3c,_0x3492d7);_0x39c6a7(_0x3492d7);});});}exports[_0x24c7('0x1b')]=function(_0x40a7d3){var _0x1137a7=this;return new Promise(function(_0x3307f7,_0x5161ee){return db['OpenchannelInteraction'][_0x24c7('0x1c')](_0x40a7d3[_0x24c7('0x1d')],{'raw':_0x40a7d3[_0x24c7('0x1e')]?_0x40a7d3[_0x24c7('0x1e')][_0x24c7('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40a7d3[_0x24c7('0x1e')]?_0x40a7d3[_0x24c7('0x1e')]['where']||null:null,'attributes':_0x40a7d3['options']?_0x40a7d3['options']['attributes']||null:null,'limit':_0x40a7d3[_0x24c7('0x1e')]?_0x40a7d3[_0x24c7('0x1e')][_0x24c7('0x20')]||null:null})[_0x24c7('0x21')](function(_0x5c14d7){logger[_0x24c7('0x12')](_0x24c7('0x1b'),_0x40a7d3);logger[_0x24c7('0x22')](_0x24c7('0x1b'),_0x40a7d3,JSON['stringify'](_0x5c14d7));_0x3307f7(_0x5c14d7);})['catch'](function(_0x294540){logger[_0x24c7('0x17')](_0x24c7('0x1b'),_0x294540[_0x24c7('0x19')],_0x40a7d3);_0x5161ee(_0x1137a7[_0x24c7('0x17')](0x1f4,_0x294540[_0x24c7('0x19')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x1e3de1){return new Promise(function(_0x5db8d3,_0x4e1dae){return db[_0x24c7('0x23')][_0x24c7('0x24')]({'where':_0x1e3de1['options']?_0x1e3de1[_0x24c7('0x1e')][_0x24c7('0x25')]||null:null})[_0x24c7('0x21')](function(_0x359a66){if(_0x359a66){return _0x359a66[_0x24c7('0x26')](_0x1e3de1[_0x24c7('0x1d')][_0x24c7('0x27')],_[_0x24c7('0x28')](_0x1e3de1[_0x24c7('0x1d')],[_0x24c7('0x27'),'id'])||{});}})[_0x24c7('0x29')](function(_0x366a8b){logger[_0x24c7('0x12')](_0x24c7('0x2a'),_0x1e3de1);logger[_0x24c7('0x22')]('AddTags',_0x1e3de1,JSON['stringify'](_0x366a8b));_0x5db8d3(_0x366a8b);})[_0x24c7('0x1a')](function(_0x17816e){logger[_0x24c7('0x17')]('AddTags',_0x17816e['message'],_0x1e3de1);_0x4e1dae(_this['error'](0x1f4,_0x17816e[_0x24c7('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 19253af..a30acbb 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 _0x37c4=['remove','update','emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x37c4,0xef));var _0x437c=function(_0x5cf6dc,_0x59f751){_0x5cf6dc=_0x5cf6dc-0x0;var _0x5099b7=_0x37c4[_0x5cf6dc];return _0x5099b7;};'use strict';var OpenchannelInteractionEvents=require(_0x437c('0x0'));var events=['save',_0x437c('0x1'),_0x437c('0x2')];function createListener(_0x4b7a07,_0x4946bc){return function(_0x29006f){_0x4946bc[_0x437c('0x3')](_0x4b7a07,_0x29006f);};}function removeListener(_0x5a47ef,_0x1881cb){return function(){OpenchannelInteractionEvents[_0x437c('0x4')](_0x5a47ef,_0x1881cb);};}exports[_0x437c('0x5')]=function(_0x500f5a){for(var _0x1103bb=0x0,_0x2dbee9=events[_0x437c('0x6')];_0x1103bb<_0x2dbee9;_0x1103bb++){var _0x1e54c0=events[_0x1103bb];var _0x19c058=createListener(_0x437c('0x7')+_0x1e54c0,_0x500f5a);OpenchannelInteractionEvents['on'](_0x1e54c0,_0x19c058);}}; \ No newline at end of file +var _0x7bb4=['save','remove','update','emit','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x4225eb,_0x2ea5ac){var _0x2ca938=function(_0x8a82a5){while(--_0x8a82a5){_0x4225eb['push'](_0x4225eb['shift']());}};_0x2ca938(++_0x2ea5ac);}(_0x7bb4,0x109));var _0x47bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7bb4[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelInteractionEvents=require(_0x47bb('0x0'));var events=[_0x47bb('0x1'),_0x47bb('0x2'),_0x47bb('0x3')];function createListener(_0xc850ab,_0x41c51a){return function(_0x1bc0a4){_0x41c51a[_0x47bb('0x4')](_0xc850ab,_0x1bc0a4);};}function removeListener(_0xe9b847,_0x104339){return function(){OpenchannelInteractionEvents['removeListener'](_0xe9b847,_0x104339);};}exports['register']=function(_0x543a3e){for(var _0x1d60c7=0x0,_0x4325da=events[_0x47bb('0x5')];_0x1d60c7<_0x4325da;_0x1d60c7++){var _0x4df80c=events[_0x1d60c7];var _0x3f7464=createListener(_0x47bb('0x6')+_0x4df80c,_0x543a3e);OpenchannelInteractionEvents['on'](_0x4df80c,_0x3f7464);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index f17cb2d..c910672 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 _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x34361b,_0x9642d4){var _0x1de9c5=function(_0x41bc3f){while(--_0x41bc3f){_0x34361b['push'](_0x34361b['shift']());}};_0x1de9c5(++_0x9642d4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x26b5ff,_0x92009a){_0x26b5ff=_0x26b5ff-0x0;var _0x58603e=_0xcb91[_0x26b5ff];return _0x58603e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file +var _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x1f0ded,_0x404ba6){var _0xc14076=function(_0x45d4e2){while(--_0x45d4e2){_0x1f0ded['push'](_0x1f0ded['shift']());}};_0xc14076(++_0x404ba6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2b9cf5,_0x2a7804){_0x2b9cf5=_0x2b9cf5-0x0;var _0xd0cf15=_0xcb91[_0x2b9cf5];return _0xd0cf15;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 14153d9..a24d1ca 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 _0x2fe3=['ENUM','DATE','STRING','sequelize','exports','BOOLEAN'];(function(_0x44f509,_0x4534d5){var _0x29f29c=function(_0x583b57){while(--_0x583b57){_0x44f509['push'](_0x44f509['shift']());}};_0x29f29c(++_0x4534d5);}(_0x2fe3,0x87));var _0x32fe=function(_0x1ef416,_0x2939e2){_0x1ef416=_0x1ef416-0x0;var _0x9173f2=_0x2fe3[_0x1ef416];return _0x9173f2;};'use strict';var Sequelize=require(_0x32fe('0x0'));module[_0x32fe('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x32fe('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x32fe('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x32fe('0x4')]},'providerName':{'type':Sequelize[_0x32fe('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x4c4d=['out','DATE','STRING','TEXT','sequelize','BOOLEAN'];(function(_0x855b1c,_0x131bc8){var _0x5b4c9e=function(_0x44a9a8){while(--_0x44a9a8){_0x855b1c['push'](_0x855b1c['shift']());}};_0x5b4c9e(++_0x131bc8);}(_0x4c4d,0x1a2));var _0xd4c4=function(_0x3fc476,_0x7deee8){_0x3fc476=_0x3fc476-0x0;var _0x2d73df=_0x4c4d[_0x3fc476];return _0x2d73df;};'use strict';var Sequelize=require(_0xd4c4('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xd4c4('0x1')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xd4c4('0x2')),'defaultValue':_0xd4c4('0x2'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd4c4('0x3')]},'providerName':{'type':Sequelize[_0xd4c4('0x4')]},'providerResponse':{'type':Sequelize[_0xd4c4('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 1a639da..f217d60 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 _0xe2ce=['querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','client','http','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','OpenchannelMessage,\x20%s,\x20%s','message','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','update','destroy','stack','name','send','map','OpenchannelMessage','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','filters','find','create','body','params','describe','../../config/logger','openchannel-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','contact','User','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','fullname','internal','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x5d8f12,_0xa4f309){var _0x14e045=function(_0x3b43d5){while(--_0x3b43d5){_0x5d8f12['push'](_0x5d8f12['shift']());}};_0x14e045(++_0xa4f309);}(_0xe2ce,0x173));var _0xee2c=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0xe2ce[_0x5317b5];return _0x3b7ce2;};'use strict';var emlformat=require(_0xee2c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xee2c('0x1'));var jsonpatch=require(_0xee2c('0x2'));var rp=require(_0xee2c('0x3'));var moment=require(_0xee2c('0x4'));var BPromise=require(_0xee2c('0x5'));var Mustache=require(_0xee2c('0x6'));var util=require('util');var path=require('path');var sox=require(_0xee2c('0x7'));var csv=require(_0xee2c('0x8'));var ejs=require(_0xee2c('0x9'));var fs=require('fs');var fs_extra=require(_0xee2c('0xa'));var _=require(_0xee2c('0xb'));var squel=require(_0xee2c('0xc'));var crypto=require(_0xee2c('0xd'));var jsforce=require(_0xee2c('0xe'));var deskjs=require(_0xee2c('0xf'));var toCsv=require('to-csv');var querystring=require(_0xee2c('0x10'));var Papa=require('papaparse');var Redis=require(_0xee2c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xee2c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee2c('0x13'));var logger=require('../../config/logger')(_0xee2c('0x14'));var utils=require('../../config/utils');var config=require(_0xee2c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xee2c('0x16'))['db'];config['redis']=_[_0xee2c('0x17')](config[_0xee2c('0x18')],{'host':_0xee2c('0x19'),'port':0x18eb});var socket=require(_0xee2c('0x1a'))(new Redis(config[_0xee2c('0x18')]));require(_0xee2c('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xee2c('0x1c')][_0xee2c('0x1d')]({'port':0x232c});var client9002=jayson[_0xee2c('0x1c')][_0xee2c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x29c46e,_0x282c87,_0x5abf04,_0x44f45a){return new BPromise(function(_0x2b635b,_0x371cae){var _0x1d14da=_0x44f45a||client;return _0x1d14da[_0xee2c('0x1e')](_0x29c46e,_0x5abf04)[_0xee2c('0x1f')](function(_0x141374){logger[_0xee2c('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x282c87,_0xee2c('0x21'));logger[_0xee2c('0x22')](_0xee2c('0x23'),_0x282c87,_0xee2c('0x21'),JSON['stringify'](_0x141374));if(_0x141374[_0xee2c('0x24')]){if(_0x141374[_0xee2c('0x24')][_0xee2c('0x25')]===0x1f4){logger[_0xee2c('0x24')](_0xee2c('0x26'),_0x282c87,_0x141374[_0xee2c('0x24')][_0xee2c('0x27')]);return _0x371cae(_0x141374[_0xee2c('0x24')][_0xee2c('0x27')]);}logger[_0xee2c('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x282c87,_0x141374[_0xee2c('0x24')]['message']);return _0x2b635b(_0x141374[_0xee2c('0x24')][_0xee2c('0x27')]);}else{logger[_0xee2c('0x20')](_0xee2c('0x26'),_0x282c87,'request\x20sent');_0x2b635b(_0x141374['result'][_0xee2c('0x27')]);}})['catch'](function(_0x2c5197){logger['error'](_0xee2c('0x26'),_0x282c87,_0x2c5197);_0x371cae(_0x2c5197);});});}function respondWithStatusCode(_0x215fc6,_0x4be7ff){_0x4be7ff=_0x4be7ff||0xcc;return function(_0x4a116e){if(_0x4a116e){return _0x215fc6[_0xee2c('0x28')](_0x4be7ff);}return _0x215fc6['status'](_0x4be7ff)[_0xee2c('0x29')]();};}function respondWithResult(_0x18f8e5,_0x3814d6){_0x3814d6=_0x3814d6||0xc8;return function(_0x3eb8bb){if(_0x3eb8bb){return _0x18f8e5['status'](_0x3814d6)[_0xee2c('0x2a')](_0x3eb8bb);}};}function respondWithFilteredResult(_0x5d8624,_0x54f303){return function(_0x4f56fa){if(_0x4f56fa){var _0x413331=typeof _0x54f303[_0xee2c('0x2b')]===_0xee2c('0x2c')&&typeof _0x54f303[_0xee2c('0x2d')]===_0xee2c('0x2c');var _0x51663e=_0x4f56fa[_0xee2c('0x2e')];var _0x51a294=_0x413331?0x0:_0x54f303[_0xee2c('0x2b')];var _0x25fe3e=_0x413331?_0x4f56fa[_0xee2c('0x2e')]:_0x54f303[_0xee2c('0x2b')]+_0x54f303[_0xee2c('0x2d')];var _0x25bc1d;if(_0x25fe3e>=_0x51663e){_0x25fe3e=_0x51663e;_0x25bc1d=0xc8;}else{_0x25bc1d=0xce;}_0x5d8624[_0xee2c('0x2f')](_0x25bc1d);return _0x5d8624[_0xee2c('0x30')](_0xee2c('0x31'),_0x51a294+'-'+_0x25fe3e+'/'+_0x51663e)[_0xee2c('0x2a')](_0x4f56fa);}return null;};}function patchUpdates(_0x2d63e7){return function(_0x98b680){try{jsonpatch['apply'](_0x98b680,_0x2d63e7,!![]);}catch(_0x417b92){return BPromise[_0xee2c('0x32')](_0x417b92);}return _0x98b680['save']();};}function saveUpdates(_0x28fb97,_0x3f9aa5){return function(_0x28ea22){if(_0x28ea22){return _0x28ea22[_0xee2c('0x33')](_0x28fb97)[_0xee2c('0x1f')](function(_0x362c00){return _0x362c00;});}return null;};}function removeEntity(_0x5a67d7,_0x1d6520){return function(_0x31cea1){if(_0x31cea1){return _0x31cea1[_0xee2c('0x34')]()[_0xee2c('0x1f')](function(){_0x5a67d7[_0xee2c('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x450296,_0x2558c6){return function(_0xa751a8){if(!_0xa751a8){_0x450296[_0xee2c('0x28')](0x194);}return _0xa751a8;};}function handleError(_0x19ce28,_0x2894b1){_0x2894b1=_0x2894b1||0x1f4;return function(_0x266b26){logger[_0xee2c('0x24')](_0x266b26[_0xee2c('0x35')]);if(_0x266b26[_0xee2c('0x36')]){delete _0x266b26[_0xee2c('0x36')];}_0x19ce28[_0xee2c('0x2f')](_0x2894b1)[_0xee2c('0x37')](_0x266b26);};}exports['index']=function(_0x38f0c4,_0x328988){var _0x49d8e3={},_0x29ddc1={},_0x348e8d={'count':0x0,'rows':[]};var _0x240298=_[_0xee2c('0x38')](db[_0xee2c('0x39')][_0xee2c('0x3a')],function(_0x44ec8e){return{'name':_0x44ec8e['fieldName'],'type':_0x44ec8e[_0xee2c('0x3b')]['key']};});_0x29ddc1[_0xee2c('0x3c')]=_[_0xee2c('0x38')](_0x240298,_0xee2c('0x36'));_0x29ddc1[_0xee2c('0x3d')]=_[_0xee2c('0x3e')](_0x38f0c4[_0xee2c('0x3d')]);_0x29ddc1['filters']=_[_0xee2c('0x3f')](_0x29ddc1[_0xee2c('0x3c')],_0x29ddc1[_0xee2c('0x3d')]);_0x49d8e3[_0xee2c('0x40')]=_['intersection'](_0x29ddc1[_0xee2c('0x3c')],qs[_0xee2c('0x41')](_0x38f0c4[_0xee2c('0x3d')][_0xee2c('0x41')]));_0x49d8e3[_0xee2c('0x40')]=_0x49d8e3[_0xee2c('0x40')][_0xee2c('0x42')]?_0x49d8e3[_0xee2c('0x40')]:_0x29ddc1['model'];if(!_0x38f0c4['query']['hasOwnProperty'](_0xee2c('0x43'))){_0x49d8e3[_0xee2c('0x2d')]=qs['limit'](_0x38f0c4['query'][_0xee2c('0x2d')]);_0x49d8e3[_0xee2c('0x2b')]=qs['offset'](_0x38f0c4[_0xee2c('0x3d')]['offset']);}_0x49d8e3['order']=qs[_0xee2c('0x44')](_0x38f0c4[_0xee2c('0x3d')]['sort']);_0x49d8e3[_0xee2c('0x45')]=qs['filters'](_[_0xee2c('0x46')](_0x38f0c4['query'],_0x29ddc1['filters']),_0x240298);if(_0x38f0c4[_0xee2c('0x3d')][_0xee2c('0x47')]){_0x49d8e3['where']=_['merge'](_0x49d8e3[_0xee2c('0x45')],{'$or':_[_0xee2c('0x38')](_0x240298,function(_0x3fe711){if(_0x3fe711[_0xee2c('0x3b')]!==_0xee2c('0x48')){var _0x40faf6={};_0x40faf6[_0x3fe711['name']]={'$like':'%'+_0x38f0c4[_0xee2c('0x3d')][_0xee2c('0x47')]+'%'};return _0x40faf6;}})});}_0x49d8e3=_[_0xee2c('0x49')]({},_0x49d8e3,_0x38f0c4[_0xee2c('0x4a')]);var _0x3cf5aa={'where':_0x49d8e3[_0xee2c('0x45')]};return db[_0xee2c('0x39')][_0xee2c('0x2e')](_0x3cf5aa)[_0xee2c('0x1f')](function(_0x46423b){_0x348e8d[_0xee2c('0x2e')]=_0x46423b;if(_0x38f0c4[_0xee2c('0x3d')][_0xee2c('0x4b')]){_0x49d8e3[_0xee2c('0x4c')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xee2c('0x4d')](_0x49d8e3);})['then'](function(_0x210f33){_0x348e8d[_0xee2c('0x4e')]=_0x210f33;return _0x348e8d;})[_0xee2c('0x1f')](respondWithFilteredResult(_0x328988,_0x49d8e3))[_0xee2c('0x4f')](handleError(_0x328988,null));};exports[_0xee2c('0x50')]=function(_0x4bc490,_0x5fccf7){var _0x43a7b7={'raw':!![],'where':{'id':_0x4bc490['params']['id']}},_0x1382db={};_0x1382db[_0xee2c('0x3c')]=_[_0xee2c('0x3e')](db['OpenchannelMessage'][_0xee2c('0x3a')]);_0x1382db[_0xee2c('0x3d')]=_[_0xee2c('0x3e')](_0x4bc490[_0xee2c('0x3d')]);_0x1382db[_0xee2c('0x51')]=_['intersection'](_0x1382db[_0xee2c('0x3c')],_0x1382db[_0xee2c('0x3d')]);_0x43a7b7[_0xee2c('0x40')]=_[_0xee2c('0x3f')](_0x1382db[_0xee2c('0x3c')],qs['fields'](_0x4bc490['query'][_0xee2c('0x41')]));_0x43a7b7[_0xee2c('0x40')]=_0x43a7b7[_0xee2c('0x40')]['length']?_0x43a7b7['attributes']:_0x1382db[_0xee2c('0x3c')];if(_0x4bc490['query'][_0xee2c('0x4b')]){_0x43a7b7['include']=[{'all':!![]}];}_0x43a7b7=_[_0xee2c('0x49')]({},_0x43a7b7,_0x4bc490[_0xee2c('0x4a')]);return db['OpenchannelMessage'][_0xee2c('0x52')](_0x43a7b7)['then'](handleEntityNotFound(_0x5fccf7,null))[_0xee2c('0x1f')](respondWithResult(_0x5fccf7,null))[_0xee2c('0x4f')](handleError(_0x5fccf7,null));};exports[_0xee2c('0x53')]=function(_0x204cae,_0x2cb605){return db[_0xee2c('0x39')][_0xee2c('0x53')](_0x204cae[_0xee2c('0x54')],{})['then'](respondWithResult(_0x2cb605,0xc9))['catch'](handleError(_0x2cb605,null));};exports['update']=function(_0x1f7c3f,_0x4252b6){if(_0x1f7c3f['body']['id']){delete _0x1f7c3f['body']['id'];}return db['OpenchannelMessage'][_0xee2c('0x52')]({'where':{'id':_0x1f7c3f[_0xee2c('0x55')]['id']}})[_0xee2c('0x1f')](handleEntityNotFound(_0x4252b6,null))['then'](saveUpdates(_0x1f7c3f[_0xee2c('0x54')],null))[_0xee2c('0x1f')](respondWithResult(_0x4252b6,null))[_0xee2c('0x4f')](handleError(_0x4252b6,null));};exports['destroy']=function(_0x4e0734,_0x5b3da2){return db['OpenchannelMessage'][_0xee2c('0x52')]({'where':{'id':_0x4e0734['params']['id']}})[_0xee2c('0x1f')](handleEntityNotFound(_0x5b3da2,null))[_0xee2c('0x1f')](removeEntity(_0x5b3da2,null))[_0xee2c('0x4f')](handleError(_0x5b3da2,null));};exports[_0xee2c('0x56')]=function(_0x113cd6,_0x3b94ed){return db[_0xee2c('0x39')][_0xee2c('0x56')]()[_0xee2c('0x1f')](respondWithResult(_0x3b94ed,null))[_0xee2c('0x4f')](handleError(_0x3b94ed,null));};var interaction_log=require(_0xee2c('0x57'))(_0xee2c('0x58'));exports[_0xee2c('0x59')]=function(_0x58623e,_0x632693,_0x11c0fd){var _0x29d066={'agent':{},'channel':'openchannel'};if(_0x58623e[_0xee2c('0x54')]['id']){delete _0x58623e[_0xee2c('0x54')]['id'];}_0x58623e[_0xee2c('0x54')]['read']=!![];_0x58623e['body'][_0xee2c('0x5a')]=moment()[_0xee2c('0x5b')](_0xee2c('0x5c'));_0x58623e[_0xee2c('0x54')][_0xee2c('0x5d')]=_0x58623e['body'][_0xee2c('0x5d')]||_0x58623e['user']['id'];_0x29d066[_0xee2c('0x5e')]['id']=_0x58623e[_0xee2c('0x54')][_0xee2c('0x5d')];return db[_0xee2c('0x39')][_0xee2c('0x52')]({'where':{'id':_0x58623e['params']['id'],'UserId':null}})[_0xee2c('0x1f')](handleEntityNotFound(_0x632693,null))['then'](saveUpdates(_0x58623e[_0xee2c('0x54')],null))[_0xee2c('0x1f')](function(_0x50c93e){if(_0x50c93e){_0x29d066['message']=_0x50c93e[_0xee2c('0x5f')]({'plain':!![]});return db[_0xee2c('0x60')][_0xee2c('0x52')]({'where':{'id':_0x50c93e[_0xee2c('0x61')]}});}return null;})[_0xee2c('0x1f')](handleEntityNotFound(_0x632693,null))[_0xee2c('0x1f')](function(_0x2d0b3a){if(_0x2d0b3a){return _0x2d0b3a[_0xee2c('0x33')]({'UserId':_0x58623e[_0xee2c('0x54')]['UserId'],'read1stAt':_[_0xee2c('0x62')](_0x2d0b3a[_0xee2c('0x63')])?moment()[_0xee2c('0x5b')](_0xee2c('0x5c')):undefined});}return null;})['then'](function(_0xaea74f){if(_0xaea74f){_0x29d066['interaction']=_0xaea74f[_0xee2c('0x5f')]({'plain':!![]});interaction_log['info'](_0xee2c('0x64'),_0x58623e[_0xee2c('0x65')]['id'],_0x58623e[_0xee2c('0x65')][_0xee2c('0x36')],_0x58623e[_0xee2c('0x65')][_0xee2c('0x66')],_0x29d066[_0xee2c('0x67')]['id'],_0x58623e['body']?JSON['stringify'](_0x58623e[_0xee2c('0x54')]):_0xee2c('0x68'));return respondWithRpcPromise(_0xee2c('0x69'),_0xee2c('0x6a'),_0x29d066);}return null;})[_0xee2c('0x1f')](function(_0x4c26f7){var _0x4a7063='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4c26f7['message'][_0xee2c('0x6b')];return db[_0xee2c('0x6c')][_0xee2c('0x3d')](_0x4a7063,{'type':db[_0xee2c('0x6d')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x7f53cc){return _0x7f53cc;});})[_0xee2c('0x1f')](function(_0x20b215){if(_0x20b215){_0x29d066[_0xee2c('0x27')][_0xee2c('0x6e')]=_0x20b215[0x0];if(!_0x58623e['body'][_0xee2c('0x5d')])return;return db[_0xee2c('0x6f')][_0xee2c('0x52')]({'where':{'id':_0x58623e[_0xee2c('0x54')][_0xee2c('0x5d')],'role':_0xee2c('0x5e')},'attributes':['id',_0xee2c('0x36'),'fullname',_0xee2c('0x70'),'internal'],'raw':!![]});}return null;})[_0xee2c('0x1f')](function(_0x23c657){if(!_0x23c657)return null;_0x29d066[_0xee2c('0x27')][_0xee2c('0x5e')]=_0x23c657;return _0x29d066;})[_0xee2c('0x1f')](function(_0x32428d){if(_0x32428d){if(_0x58623e['body'][_0xee2c('0x71')]){_0x29d066[_0xee2c('0x27')][_0xee2c('0x72')]=util[_0xee2c('0x5b')](_0xee2c('0x73'),_0x58623e[_0xee2c('0x65')][_0xee2c('0x36')]);_0x29d066[_0xee2c('0x27')][_0xee2c('0x74')]=_0x29d066[_0xee2c('0x74')];_0x29d066[_0xee2c('0x27')][_0xee2c('0x75')]=_0x29d066[_0xee2c('0x74')];_0x29d066[_0xee2c('0x27')][_0xee2c('0x76')]=_0xee2c('0x59');return respondWithRpcPromise(_0xee2c('0x77'),'EventManager',{'event':_0xee2c('0x78'),'message':_0x29d066[_0xee2c('0x27')]},client9002)[_0xee2c('0x1f')](function(){return _0x29d066;});}return _0x29d066;}return null;})[_0xee2c('0x1f')](respondWithResult(_0x632693,null))['catch'](handleError(_0x632693,null));};var interaction_log=require(_0xee2c('0x57'))('openchannel-interactions');exports[_0xee2c('0x32')]=function(_0x3187e0,_0x31be4c,_0x54c9f7){var _0x4a20c2={'agent':{},'channel':_0xee2c('0x79')};if(_0x3187e0[_0xee2c('0x54')]['id']){delete _0x3187e0[_0xee2c('0x54')]['id'];}_0x3187e0[_0xee2c('0x54')][_0xee2c('0x5d')]=_0x3187e0[_0xee2c('0x54')][_0xee2c('0x5d')]||_0x3187e0[_0xee2c('0x65')]['id'];_0x4a20c2['agent']['id']=_0x3187e0[_0xee2c('0x54')][_0xee2c('0x5d')];return db[_0xee2c('0x39')][_0xee2c('0x52')]({'where':{'id':_0x3187e0[_0xee2c('0x55')]['id'],'UserId':null}})[_0xee2c('0x1f')](handleEntityNotFound(_0x31be4c,null))[_0xee2c('0x1f')](function(_0x5665b2){if(_0x5665b2){_0x4a20c2[_0xee2c('0x27')]=_0x5665b2[_0xee2c('0x5f')]({'plain':!![]});return db[_0xee2c('0x60')][_0xee2c('0x52')]({'where':{'id':_0x5665b2['OpenchannelInteractionId']}});}return null;})[_0xee2c('0x1f')](handleEntityNotFound(_0x31be4c,null))['then'](function(_0x315db0){if(_0x315db0){_0x4a20c2[_0xee2c('0x67')]=_0x315db0[_0xee2c('0x5f')]({'plain':!![]});interaction_log[_0xee2c('0x20')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3187e0[_0xee2c('0x65')]['id'],_0x3187e0[_0xee2c('0x65')]['name'],_0x3187e0['user'][_0xee2c('0x66')],_0x4a20c2['interaction']['id'],_0x3187e0[_0xee2c('0x54')]?JSON['stringify'](_0x3187e0['body']):'null');return respondWithRpcPromise(_0xee2c('0x7a'),_0xee2c('0x7b'),_0x4a20c2);}return null;})['then'](function(_0x5499a0){var _0x3f0b72=_0xee2c('0x7c')+_0x5499a0[_0xee2c('0x27')][_0xee2c('0x6b')];return db[_0xee2c('0x6c')][_0xee2c('0x3d')](_0x3f0b72,{'type':db[_0xee2c('0x6d')][_0xee2c('0x7d')]['SELECT'],'raw':!![]})[_0xee2c('0x1f')](function(_0x1fedd9){return _0x1fedd9;});})[_0xee2c('0x1f')](function(_0x5f1cf2){if(_0x5f1cf2){_0x4a20c2[_0xee2c('0x27')][_0xee2c('0x6e')]=_0x5f1cf2[0x0];if(!_0x3187e0[_0xee2c('0x54')][_0xee2c('0x5d')])return;return db['User'][_0xee2c('0x52')]({'where':{'id':_0x3187e0[_0xee2c('0x54')][_0xee2c('0x5d')],'role':_0xee2c('0x5e')},'attributes':['id',_0xee2c('0x36'),_0xee2c('0x7e'),_0xee2c('0x70'),_0xee2c('0x7f')],'raw':!![]});}return null;})['then'](function(_0x16ca8d){if(!_0x16ca8d)return null;_0x4a20c2[_0xee2c('0x27')][_0xee2c('0x5e')]=_0x16ca8d;return _0x4a20c2;})[_0xee2c('0x1f')](function(_0x15c16d){if(_0x15c16d){_0x15c16d[_0xee2c('0x27')][_0xee2c('0x72')]=util['format'](_0xee2c('0x73'),_0x3187e0['user'][_0xee2c('0x36')]);_0x15c16d[_0xee2c('0x27')][_0xee2c('0x74')]=_0x4a20c2[_0xee2c('0x74')];_0x15c16d[_0xee2c('0x27')][_0xee2c('0x75')]=_0x4a20c2[_0xee2c('0x74')];_0x15c16d[_0xee2c('0x27')][_0xee2c('0x76')]=_0xee2c('0x32');respondWithRpcPromise(_0xee2c('0x77'),_0xee2c('0x77'),{'event':_0xee2c('0x80'),'message':_0x15c16d[_0xee2c('0x27')]},client9002);return _0x4a20c2;}return null;})[_0xee2c('0x1f')](respondWithResult(_0x31be4c,null))[_0xee2c('0x4f')](handleError(_0x31be4c,null));}; \ No newline at end of file +var _0x0967=['path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','update','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','accept','openchannel','read','readAt','format','UserId','user','agent','get','OpenchannelInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','info','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','openchannel-interactions','OpenchannelInteractionId','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','event','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x1fbde3,_0x59da39){var _0x2b092f=function(_0x18bd24){while(--_0x18bd24){_0x1fbde3['push'](_0x1fbde3['shift']());}};_0x2b092f(++_0x59da39);}(_0x0967,0x100));var _0x7096=function(_0x399dbd,_0x2dd625){_0x399dbd=_0x399dbd-0x0;var _0x346082=_0x0967[_0x399dbd];return _0x346082;};'use strict';var emlformat=require(_0x7096('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7096('0x1'));var jsonpatch=require(_0x7096('0x2'));var rp=require(_0x7096('0x3'));var moment=require(_0x7096('0x4'));var BPromise=require(_0x7096('0x5'));var Mustache=require(_0x7096('0x6'));var util=require(_0x7096('0x7'));var path=require(_0x7096('0x8'));var sox=require('sox');var csv=require(_0x7096('0x9'));var ejs=require(_0x7096('0xa'));var fs=require('fs');var fs_extra=require(_0x7096('0xb'));var _=require(_0x7096('0xc'));var squel=require(_0x7096('0xd'));var crypto=require(_0x7096('0xe'));var jsforce=require(_0x7096('0xf'));var deskjs=require(_0x7096('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7096('0x11'));var Redis=require(_0x7096('0x12'));var authService=require(_0x7096('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7096('0x14'));var logger=require(_0x7096('0x15'))(_0x7096('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7096('0x17'));var db=require(_0x7096('0x18'))['db'];config['redis']=_[_0x7096('0x19')](config['redis'],{'host':_0x7096('0x1a'),'port':0x18eb});var socket=require(_0x7096('0x1b'))(new Redis(config['redis']));require(_0x7096('0x1c'))[_0x7096('0x1d')](socket);var jayson=require(_0x7096('0x1e'));var client=jayson[_0x7096('0x1f')][_0x7096('0x20')]({'port':0x232c});var client9002=jayson[_0x7096('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x240010,_0x2c02ce,_0x138d7d,_0x41cf08){return new BPromise(function(_0x1e8514,_0x57130f){var _0x41bc1b=_0x41cf08||client;return _0x41bc1b[_0x7096('0x21')](_0x240010,_0x138d7d)[_0x7096('0x22')](function(_0x516b97){logger['info'](_0x7096('0x23'),_0x2c02ce,'request\x20sent');logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x2c02ce,_0x7096('0x24'),JSON[_0x7096('0x25')](_0x516b97));if(_0x516b97[_0x7096('0x26')]){if(_0x516b97[_0x7096('0x26')][_0x7096('0x27')]===0x1f4){logger[_0x7096('0x26')](_0x7096('0x23'),_0x2c02ce,_0x516b97[_0x7096('0x26')]['message']);return _0x57130f(_0x516b97[_0x7096('0x26')][_0x7096('0x28')]);}logger[_0x7096('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x2c02ce,_0x516b97[_0x7096('0x26')]['message']);return _0x1e8514(_0x516b97['error'][_0x7096('0x28')]);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x2c02ce,_0x7096('0x24'));_0x1e8514(_0x516b97['result'][_0x7096('0x28')]);}})['catch'](function(_0x4f14f9){logger[_0x7096('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x2c02ce,_0x4f14f9);_0x57130f(_0x4f14f9);});});}function respondWithStatusCode(_0x232550,_0x4e0f0a){_0x4e0f0a=_0x4e0f0a||0xcc;return function(_0x4152d1){if(_0x4152d1){return _0x232550[_0x7096('0x29')](_0x4e0f0a);}return _0x232550['status'](_0x4e0f0a)[_0x7096('0x2a')]();};}function respondWithResult(_0x110a4f,_0x4f6d90){_0x4f6d90=_0x4f6d90||0xc8;return function(_0x53e11e){if(_0x53e11e){return _0x110a4f['status'](_0x4f6d90)[_0x7096('0x2b')](_0x53e11e);}};}function respondWithFilteredResult(_0x2a6126,_0x404697){return function(_0xc4153a){if(_0xc4153a){var _0x5b4531=typeof _0x404697[_0x7096('0x2c')]===_0x7096('0x2d')&&typeof _0x404697[_0x7096('0x2e')]===_0x7096('0x2d');var _0x3e7cd8=_0xc4153a[_0x7096('0x2f')];var _0x36ab98=_0x5b4531?0x0:_0x404697[_0x7096('0x2c')];var _0x1323ac=_0x5b4531?_0xc4153a[_0x7096('0x2f')]:_0x404697['offset']+_0x404697['limit'];var _0x582d85;if(_0x1323ac>=_0x3e7cd8){_0x1323ac=_0x3e7cd8;_0x582d85=0xc8;}else{_0x582d85=0xce;}_0x2a6126[_0x7096('0x30')](_0x582d85);return _0x2a6126[_0x7096('0x31')]('Content-Range',_0x36ab98+'-'+_0x1323ac+'/'+_0x3e7cd8)[_0x7096('0x2b')](_0xc4153a);}return null;};}function patchUpdates(_0x30f516){return function(_0x400ef8){try{jsonpatch[_0x7096('0x32')](_0x400ef8,_0x30f516,!![]);}catch(_0x52f725){return BPromise[_0x7096('0x33')](_0x52f725);}return _0x400ef8['save']();};}function saveUpdates(_0x4f0bec,_0x11a2e2){return function(_0x395517){if(_0x395517){return _0x395517[_0x7096('0x34')](_0x4f0bec)[_0x7096('0x22')](function(_0x11e49d){return _0x11e49d;});}return null;};}function removeEntity(_0x4964fb,_0xb6efd9){return function(_0x5741df){if(_0x5741df){return _0x5741df[_0x7096('0x35')]()['then'](function(){_0x4964fb[_0x7096('0x30')](0xcc)[_0x7096('0x2a')]();});}};}function handleEntityNotFound(_0x29de57,_0x423c30){return function(_0x4e09bf){if(!_0x4e09bf){_0x29de57[_0x7096('0x29')](0x194);}return _0x4e09bf;};}function handleError(_0x3f4da4,_0x42a0e4){_0x42a0e4=_0x42a0e4||0x1f4;return function(_0x693571){logger[_0x7096('0x26')](_0x693571[_0x7096('0x36')]);if(_0x693571['name']){delete _0x693571[_0x7096('0x37')];}_0x3f4da4[_0x7096('0x30')](_0x42a0e4)[_0x7096('0x38')](_0x693571);};}exports[_0x7096('0x39')]=function(_0x6dd5cf,_0x49dcab){var _0x4c4509={},_0x13cc43={},_0x3c344c={'count':0x0,'rows':[]};var _0x5185e3=_[_0x7096('0x3a')](db[_0x7096('0x3b')][_0x7096('0x3c')],function(_0x534386){return{'name':_0x534386[_0x7096('0x3d')],'type':_0x534386[_0x7096('0x3e')][_0x7096('0x3f')]};});_0x13cc43[_0x7096('0x40')]=_[_0x7096('0x3a')](_0x5185e3,_0x7096('0x37'));_0x13cc43['query']=_[_0x7096('0x41')](_0x6dd5cf['query']);_0x13cc43[_0x7096('0x42')]=_[_0x7096('0x43')](_0x13cc43[_0x7096('0x40')],_0x13cc43[_0x7096('0x44')]);_0x4c4509[_0x7096('0x45')]=_[_0x7096('0x43')](_0x13cc43[_0x7096('0x40')],qs[_0x7096('0x46')](_0x6dd5cf[_0x7096('0x44')][_0x7096('0x46')]));_0x4c4509[_0x7096('0x45')]=_0x4c4509[_0x7096('0x45')]['length']?_0x4c4509['attributes']:_0x13cc43['model'];if(!_0x6dd5cf['query'][_0x7096('0x47')](_0x7096('0x48'))){_0x4c4509['limit']=qs[_0x7096('0x2e')](_0x6dd5cf[_0x7096('0x44')][_0x7096('0x2e')]);_0x4c4509[_0x7096('0x2c')]=qs[_0x7096('0x2c')](_0x6dd5cf['query'][_0x7096('0x2c')]);}_0x4c4509['order']=qs[_0x7096('0x49')](_0x6dd5cf[_0x7096('0x44')][_0x7096('0x49')]);_0x4c4509[_0x7096('0x4a')]=qs['filters'](_['pick'](_0x6dd5cf['query'],_0x13cc43[_0x7096('0x42')]),_0x5185e3);if(_0x6dd5cf[_0x7096('0x44')]['filter']){_0x4c4509[_0x7096('0x4a')]=_[_0x7096('0x4b')](_0x4c4509[_0x7096('0x4a')],{'$or':_[_0x7096('0x3a')](_0x5185e3,function(_0x5d340b){if(_0x5d340b[_0x7096('0x3e')]!==_0x7096('0x4c')){var _0x503509={};_0x503509[_0x5d340b[_0x7096('0x37')]]={'$like':'%'+_0x6dd5cf['query'][_0x7096('0x4d')]+'%'};return _0x503509;}})});}_0x4c4509=_['merge']({},_0x4c4509,_0x6dd5cf[_0x7096('0x4e')]);var _0x2ec3f8={'where':_0x4c4509[_0x7096('0x4a')]};return db[_0x7096('0x3b')][_0x7096('0x2f')](_0x2ec3f8)[_0x7096('0x22')](function(_0x27fa1d){_0x3c344c[_0x7096('0x2f')]=_0x27fa1d;if(_0x6dd5cf['query'][_0x7096('0x4f')]){_0x4c4509[_0x7096('0x50')]=[{'all':!![]}];}return db[_0x7096('0x3b')][_0x7096('0x51')](_0x4c4509);})['then'](function(_0x5d97dc){_0x3c344c[_0x7096('0x52')]=_0x5d97dc;return _0x3c344c;})[_0x7096('0x22')](respondWithFilteredResult(_0x49dcab,_0x4c4509))[_0x7096('0x53')](handleError(_0x49dcab,null));};exports[_0x7096('0x54')]=function(_0x416cc6,_0x473a82){var _0xa92bfc={'raw':!![],'where':{'id':_0x416cc6[_0x7096('0x55')]['id']}},_0x381460={};_0x381460[_0x7096('0x40')]=_[_0x7096('0x41')](db[_0x7096('0x3b')][_0x7096('0x3c')]);_0x381460[_0x7096('0x44')]=_['keys'](_0x416cc6[_0x7096('0x44')]);_0x381460[_0x7096('0x42')]=_[_0x7096('0x43')](_0x381460['model'],_0x381460[_0x7096('0x44')]);_0xa92bfc[_0x7096('0x45')]=_[_0x7096('0x43')](_0x381460[_0x7096('0x40')],qs['fields'](_0x416cc6[_0x7096('0x44')][_0x7096('0x46')]));_0xa92bfc[_0x7096('0x45')]=_0xa92bfc[_0x7096('0x45')][_0x7096('0x56')]?_0xa92bfc[_0x7096('0x45')]:_0x381460['model'];if(_0x416cc6['query'][_0x7096('0x4f')]){_0xa92bfc['include']=[{'all':!![]}];}_0xa92bfc=_['merge']({},_0xa92bfc,_0x416cc6['options']);return db[_0x7096('0x3b')][_0x7096('0x57')](_0xa92bfc)[_0x7096('0x22')](handleEntityNotFound(_0x473a82,null))[_0x7096('0x22')](respondWithResult(_0x473a82,null))[_0x7096('0x53')](handleError(_0x473a82,null));};exports[_0x7096('0x58')]=function(_0x43427b,_0x49dc75){return db[_0x7096('0x3b')]['create'](_0x43427b[_0x7096('0x59')],{})['then'](respondWithResult(_0x49dc75,0xc9))['catch'](handleError(_0x49dc75,null));};exports['update']=function(_0x5b7cbf,_0x696271){if(_0x5b7cbf[_0x7096('0x59')]['id']){delete _0x5b7cbf[_0x7096('0x59')]['id'];}return db[_0x7096('0x3b')]['find']({'where':{'id':_0x5b7cbf[_0x7096('0x55')]['id']}})['then'](handleEntityNotFound(_0x696271,null))[_0x7096('0x22')](saveUpdates(_0x5b7cbf[_0x7096('0x59')],null))[_0x7096('0x22')](respondWithResult(_0x696271,null))[_0x7096('0x53')](handleError(_0x696271,null));};exports['destroy']=function(_0x334391,_0x5cccf9){return db[_0x7096('0x3b')][_0x7096('0x57')]({'where':{'id':_0x334391[_0x7096('0x55')]['id']}})[_0x7096('0x22')](handleEntityNotFound(_0x5cccf9,null))['then'](removeEntity(_0x5cccf9,null))['catch'](handleError(_0x5cccf9,null));};exports[_0x7096('0x5a')]=function(_0x3c5832,_0x2cc444){return db[_0x7096('0x3b')]['describe']()['then'](respondWithResult(_0x2cc444,null))[_0x7096('0x53')](handleError(_0x2cc444,null));};var interaction_log=require(_0x7096('0x15'))('openchannel-interactions');exports[_0x7096('0x5b')]=function(_0x58a3fa,_0x29826b,_0x36d4f9){var _0x52ecae={'agent':{},'channel':_0x7096('0x5c')};if(_0x58a3fa[_0x7096('0x59')]['id']){delete _0x58a3fa[_0x7096('0x59')]['id'];}_0x58a3fa[_0x7096('0x59')][_0x7096('0x5d')]=!![];_0x58a3fa[_0x7096('0x59')][_0x7096('0x5e')]=moment()[_0x7096('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x58a3fa[_0x7096('0x59')][_0x7096('0x60')]=_0x58a3fa['body'][_0x7096('0x60')]||_0x58a3fa[_0x7096('0x61')]['id'];_0x52ecae[_0x7096('0x62')]['id']=_0x58a3fa['body'][_0x7096('0x60')];return db[_0x7096('0x3b')][_0x7096('0x57')]({'where':{'id':_0x58a3fa['params']['id'],'UserId':null}})[_0x7096('0x22')](handleEntityNotFound(_0x29826b,null))[_0x7096('0x22')](saveUpdates(_0x58a3fa[_0x7096('0x59')],null))[_0x7096('0x22')](function(_0x10a9a4){if(_0x10a9a4){_0x52ecae[_0x7096('0x28')]=_0x10a9a4[_0x7096('0x63')]({'plain':!![]});return db[_0x7096('0x64')][_0x7096('0x57')]({'where':{'id':_0x10a9a4['OpenchannelInteractionId']}});}return null;})[_0x7096('0x22')](handleEntityNotFound(_0x29826b,null))['then'](function(_0x50e94f){if(_0x50e94f){return _0x50e94f[_0x7096('0x34')]({'UserId':_0x58a3fa[_0x7096('0x59')][_0x7096('0x60')],'read1stAt':_[_0x7096('0x65')](_0x50e94f[_0x7096('0x66')])?moment()[_0x7096('0x5f')](_0x7096('0x67')):undefined});}return null;})[_0x7096('0x22')](function(_0x451a9b){if(_0x451a9b){_0x52ecae['interaction']=_0x451a9b['get']({'plain':!![]});interaction_log[_0x7096('0x68')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x58a3fa[_0x7096('0x61')]['id'],_0x58a3fa[_0x7096('0x61')][_0x7096('0x37')],_0x58a3fa[_0x7096('0x61')][_0x7096('0x69')],_0x52ecae['interaction']['id'],_0x58a3fa[_0x7096('0x59')]?JSON[_0x7096('0x25')](_0x58a3fa[_0x7096('0x59')]):_0x7096('0x6a'));return respondWithRpcPromise(_0x7096('0x6b'),_0x7096('0x6c'),_0x52ecae);}return null;})[_0x7096('0x22')](function(_0x330bc0){var _0x47331f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x330bc0[_0x7096('0x28')][_0x7096('0x6d')];return db[_0x7096('0x6e')]['query'](_0x47331f,{'type':db[_0x7096('0x6f')][_0x7096('0x70')][_0x7096('0x71')],'raw':!![]})[_0x7096('0x22')](function(_0x28ec9b){return _0x28ec9b;});})[_0x7096('0x22')](function(_0x2424d9){if(_0x2424d9){_0x52ecae[_0x7096('0x28')]['contact']=_0x2424d9[0x0];if(!_0x58a3fa[_0x7096('0x59')][_0x7096('0x60')])return;return db[_0x7096('0x72')]['find']({'where':{'id':_0x58a3fa['body'][_0x7096('0x60')],'role':_0x7096('0x62')},'attributes':['id',_0x7096('0x37'),_0x7096('0x73'),'email',_0x7096('0x74')],'raw':!![]});}return null;})[_0x7096('0x22')](function(_0x5513f9){if(!_0x5513f9)return null;_0x52ecae[_0x7096('0x28')][_0x7096('0x62')]=_0x5513f9;return _0x52ecae;})['then'](function(_0xe9c835){if(_0xe9c835){if(_0x58a3fa[_0x7096('0x59')][_0x7096('0x75')]){_0x52ecae[_0x7096('0x28')][_0x7096('0x76')]=util[_0x7096('0x5f')](_0x7096('0x77'),_0x58a3fa[_0x7096('0x61')][_0x7096('0x37')]);_0x52ecae[_0x7096('0x28')][_0x7096('0x78')]=_0x52ecae[_0x7096('0x78')];_0x52ecae[_0x7096('0x28')][_0x7096('0x79')]=_0x52ecae[_0x7096('0x78')];_0x52ecae['message']['event']='accept';return respondWithRpcPromise(_0x7096('0x7a'),_0x7096('0x7a'),{'event':_0x7096('0x7b'),'message':_0x52ecae[_0x7096('0x28')]},client9002)[_0x7096('0x22')](function(){return _0x52ecae;});}return _0x52ecae;}return null;})[_0x7096('0x22')](respondWithResult(_0x29826b,null))['catch'](handleError(_0x29826b,null));};var interaction_log=require('../../config/logger')(_0x7096('0x7c'));exports['reject']=function(_0x1a5e4f,_0x80efc8,_0x32addb){var _0x4c4020={'agent':{},'channel':'openchannel'};if(_0x1a5e4f['body']['id']){delete _0x1a5e4f['body']['id'];}_0x1a5e4f[_0x7096('0x59')]['UserId']=_0x1a5e4f[_0x7096('0x59')][_0x7096('0x60')]||_0x1a5e4f[_0x7096('0x61')]['id'];_0x4c4020[_0x7096('0x62')]['id']=_0x1a5e4f['body']['UserId'];return db[_0x7096('0x3b')]['find']({'where':{'id':_0x1a5e4f['params']['id'],'UserId':null}})[_0x7096('0x22')](handleEntityNotFound(_0x80efc8,null))[_0x7096('0x22')](function(_0x33feef){if(_0x33feef){_0x4c4020[_0x7096('0x28')]=_0x33feef['get']({'plain':!![]});return db[_0x7096('0x64')][_0x7096('0x57')]({'where':{'id':_0x33feef[_0x7096('0x7d')]}});}return null;})[_0x7096('0x22')](handleEntityNotFound(_0x80efc8,null))['then'](function(_0x52ce0a){if(_0x52ce0a){_0x4c4020[_0x7096('0x7e')]=_0x52ce0a[_0x7096('0x63')]({'plain':!![]});interaction_log[_0x7096('0x68')](_0x7096('0x7f'),_0x1a5e4f[_0x7096('0x61')]['id'],_0x1a5e4f[_0x7096('0x61')][_0x7096('0x37')],_0x1a5e4f[_0x7096('0x61')][_0x7096('0x69')],_0x4c4020[_0x7096('0x7e')]['id'],_0x1a5e4f[_0x7096('0x59')]?JSON[_0x7096('0x25')](_0x1a5e4f['body']):_0x7096('0x6a'));return respondWithRpcPromise(_0x7096('0x80'),_0x7096('0x81'),_0x4c4020);}return null;})[_0x7096('0x22')](function(_0x15b6f8){var _0x3c1bc5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x15b6f8['message'][_0x7096('0x6d')];return db[_0x7096('0x6e')]['query'](_0x3c1bc5,{'type':db[_0x7096('0x6f')][_0x7096('0x70')]['SELECT'],'raw':!![]})['then'](function(_0xa7d712){return _0xa7d712;});})[_0x7096('0x22')](function(_0x183b7e){if(_0x183b7e){_0x4c4020[_0x7096('0x28')][_0x7096('0x82')]=_0x183b7e[0x0];if(!_0x1a5e4f[_0x7096('0x59')][_0x7096('0x60')])return;return db[_0x7096('0x72')][_0x7096('0x57')]({'where':{'id':_0x1a5e4f[_0x7096('0x59')]['UserId'],'role':_0x7096('0x62')},'attributes':['id','name',_0x7096('0x73'),'email',_0x7096('0x74')],'raw':!![]});}return null;})[_0x7096('0x22')](function(_0x3cbfd3){if(!_0x3cbfd3)return null;_0x4c4020[_0x7096('0x28')]['agent']=_0x3cbfd3;return _0x4c4020;})[_0x7096('0x22')](function(_0x1b0e71){if(_0x1b0e71){_0x1b0e71[_0x7096('0x28')]['interface']=util[_0x7096('0x5f')](_0x7096('0x77'),_0x1a5e4f[_0x7096('0x61')][_0x7096('0x37')]);_0x1b0e71[_0x7096('0x28')][_0x7096('0x78')]=_0x4c4020['channel'];_0x1b0e71[_0x7096('0x28')][_0x7096('0x79')]=_0x4c4020[_0x7096('0x78')];_0x1b0e71[_0x7096('0x28')][_0x7096('0x83')]='reject';respondWithRpcPromise('EventManager',_0x7096('0x7a'),{'event':'rejectmessage','message':_0x1b0e71[_0x7096('0x28')]},client9002);return _0x4c4020;}return null;})[_0x7096('0x22')](respondWithResult(_0x80efc8,null))['catch'](handleError(_0x80efc8,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index b25e68f..641d24d 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 _0xafd2=['../../mysqldb','OpenchannelMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3b5ed9,_0xc465b0){var _0x2890d0=function(_0x161acd){while(--_0x161acd){_0x3b5ed9['push'](_0x3b5ed9['shift']());}};_0x2890d0(++_0xc465b0);}(_0xafd2,0x167));var _0x2afd=function(_0x4f8463,_0x1c323d){_0x4f8463=_0x4f8463-0x0;var _0x362445=_0xafd2[_0x4f8463];return _0x362445;};'use strict';var EventEmitter=require(_0x2afd('0x0'));var OpenchannelMessage=require(_0x2afd('0x1'))['db'][_0x2afd('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x2afd('0x3')](0x0);var events={'afterCreate':_0x2afd('0x4'),'afterUpdate':'update','afterDestroy':_0x2afd('0x5')};function emitEvent(_0x1450ce){return function(_0x4dd18f,_0x33c44b,_0x4c68b1){OpenchannelMessageEvents[_0x2afd('0x6')](_0x1450ce+':'+_0x4dd18f['id'],_0x4dd18f);OpenchannelMessageEvents[_0x2afd('0x6')](_0x1450ce,_0x4dd18f);_0x4c68b1(null);};}for(var e in events){if(events[_0x2afd('0x7')](e)){var event=events[e];OpenchannelMessage[_0x2afd('0x8')](e,emitEvent(event));}}module[_0x2afd('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x7339=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage'];(function(_0x59af24,_0x201f0e){var _0x5d79d4=function(_0x4cc3a4){while(--_0x4cc3a4){_0x59af24['push'](_0x59af24['shift']());}};_0x5d79d4(++_0x201f0e);}(_0x7339,0xbb));var _0x9733=function(_0x5a2951,_0x10fe17){_0x5a2951=_0x5a2951-0x0;var _0x4a9ded=_0x7339[_0x5a2951];return _0x4a9ded;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x9733('0x0'))['db'][_0x9733('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x9733('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9733('0x3'),'afterDestroy':_0x9733('0x4')};function emitEvent(_0x1f69b7){return function(_0x34a98a,_0x11c2e0,_0x538463){OpenchannelMessageEvents[_0x9733('0x5')](_0x1f69b7+':'+_0x34a98a['id'],_0x34a98a);OpenchannelMessageEvents[_0x9733('0x5')](_0x1f69b7,_0x34a98a);_0x538463(null);};}for(var e in events){if(events[_0x9733('0x6')](e)){var event=events[e];OpenchannelMessage[_0x9733('0x7')](e,emitEvent(event));}}module[_0x9733('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 af03456..2b82ba6 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 _0x93e9=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','out','CmContact','OpenchannelAccount','find','OpenchannelAccountId','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','omit','POST','GET','info','afterCreate','threadId','finally','utf8mb4','utf8mb4_unicode_ci'];(function(_0x5ad220,_0x27407e){var _0xdec77d=function(_0x58d736){while(--_0x58d736){_0x5ad220['push'](_0x5ad220['shift']());}};_0xdec77d(++_0x27407e);}(_0x93e9,0xcc));var _0x993e=function(_0x56734f,_0x28c3cf){_0x56734f=_0x56734f-0x0;var _0x34b752=_0x93e9[_0x56734f];return _0x34b752;};'use strict';var _=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var logger=require(_0x993e('0x2'))(_0x993e('0x3'));var moment=require(_0x993e('0x4'));var BPromise=require(_0x993e('0x5'));var rp=require(_0x993e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x993e('0x7'));var attributes=require(_0x993e('0x8'));module[_0x993e('0x9')]=function(_0x45f52e,_0x1da414){return _0x45f52e[_0x993e('0xa')](_0x993e('0xb'),attributes,{'tableName':_0x993e('0xc'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x993e('0xd')],'type':_0x993e('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x15d774,_0x280291,_0x2cd389){var _0x27a28f=_0x45f52e[_0x993e('0xf')];var _0x48291a=_0x15d774[_0x993e('0x10')]({'plain':!![]});if(_0x48291a[_0x993e('0x11')]['toLowerCase']()==='in'||_0x48291a['direction'][_0x993e('0x12')]()==='out'&&!_0x48291a[_0x993e('0x13')]&&!_['isNil'](_0x48291a['UserId'])){_0x27a28f[_0x993e('0x14')][_0x993e('0x15')]({'where':{'id':_0x48291a[_0x993e('0x16')]}})[_0x993e('0x17')](function(_0x3e082b){if(_0x3e082b){_0x3e082b[_0x993e('0x18')]({'lastMsgAt':_0x48291a[_0x993e('0x19')],'lastMsgDirection':_0x48291a[_0x993e('0x11')][_0x993e('0x12')]()});}})[_0x993e('0x1a')](function(_0x1a7726){console[_0x993e('0x1b')](_0x1a7726);});}if(_0x48291a[_0x993e('0x11')]===_0x993e('0x1c')&&!_0x48291a[_0x993e('0x13')]){var _0x454475;_0x27a28f[_0x993e('0x1d')]['describe']()[_0x993e('0x17')](function(_0x1acd21){return _0x27a28f[_0x993e('0x1e')][_0x993e('0x1f')]({'where':{'id':_0x48291a[_0x993e('0x20')]},'include':[{'model':_0x27a28f[_0x993e('0x14')],'as':'Interactions','where':{'id':_0x48291a[_0x993e('0x16')]},'limit':0x1,'include':[{'model':_0x27a28f[_0x993e('0x1d')],'as':_0x993e('0x21'),'attributes':_[_0x993e('0x22')](_0x1acd21)}]}]});})[_0x993e('0x17')](function(_0x425ab4){_0x454475=_0x425ab4[_0x993e('0x10')]({'plain':!![]});if(_0x454475&&_0x454475[_0x993e('0x23')]){logger['info'](_0x993e('0x24'),'afterCreate',util[_0x993e('0x25')](_0x993e('0x26'),_0x48291a['id'],_0x454475[_0x993e('0x23')]));if(_0x454475['Interactions']&&_0x454475[_0x993e('0x27')][_0x993e('0x28')]){_0x48291a[_0x993e('0x29')]=_[_0x993e('0x2a')](_0x454475[_0x993e('0x27')][0x0],_0x993e('0x21'));_0x48291a[_0x993e('0x21')]=_0x454475[_0x993e('0x27')][0x0][_0x993e('0x21')];}var _0x280291={'method':_0x993e('0x2b'),'uri':encodeURI(_0x454475[_0x993e('0x23')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x280291['method']){case _0x993e('0x2c'):_0x280291['qs']=_0x48291a;break;case _0x993e('0x2b'):_0x280291['body']=_0x48291a;break;}return rp(_0x280291)[_0x993e('0x17')](function(_0x4f5cc1){logger[_0x993e('0x2d')](_0x993e('0x24'),_0x993e('0x2e'),util[_0x993e('0x25')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x48291a['id'],_0x454475['replyUri']));if(_0x4f5cc1[_0x993e('0xd')][_0x993e('0x2f')]&&_0x4f5cc1['body'][_0x993e('0x2f')]!=_0x48291a[_0x993e('0x29')][_0x993e('0x2f')]){return _0x27a28f['OpenchannelInteraction'][_0x993e('0x18')]({'threadId':_0x4f5cc1[_0x993e('0xd')][_0x993e('0x2f')]},{'logging':!![],'where':{'id':_0x48291a[_0x993e('0x29')]['id']}});}else{return;}})[_0x993e('0x17')](function(){return _0x15d774['update']({'read':!![]});})[_0x993e('0x1a')](function(_0x4d1379){logger[_0x993e('0x1b')]('OpenchannelMessage,\x20%s,\x20%s',_0x993e('0x2e'),util['inspect'](_0x4d1379,{'showHidden':![],'depth':null}));_0x2cd389();});}else{_0x2cd389();}})[_0x993e('0x30')](function(){_0x2cd389();});}else{_0x2cd389();}}},'charset':_0x993e('0x31'),'collate':_0x993e('0x32')});}; \ No newline at end of file +var _0x5c00=['afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','omit','POST','GET','info','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','OpenchannelInteraction','catch','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','openchannel_messages','fti_openchannel_messages','body','models','toLowerCase','out','secret','UserId','findOne','OpenchannelInteractionId','then','update','createdAt','direction','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','get'];(function(_0x4265c5,_0x1a9a6){var _0x11c741=function(_0x4e3745){while(--_0x4e3745){_0x4265c5['push'](_0x4265c5['shift']());}};_0x11c741(++_0x1a9a6);}(_0x5c00,0x17e));var _0x05c0=function(_0x4c2f17,_0x5c6821){_0x4c2f17=_0x4c2f17-0x0;var _0x20919e=_0x5c00[_0x4c2f17];return _0x20919e;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var logger=require(_0x05c0('0x2'))('api');var moment=require(_0x05c0('0x3'));var BPromise=require('bluebird');var rp=require(_0x05c0('0x4'));var fs=require('fs');var path=require(_0x05c0('0x5'));var rimraf=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var attributes=require('./openchannelMessage.attributes');module[_0x05c0('0x8')]=function(_0x3521fe,_0x261624){return _0x3521fe[_0x05c0('0x9')]('OpenchannelMessage',attributes,{'tableName':_0x05c0('0xa'),'paranoid':![],'indexes':[{'name':_0x05c0('0xb'),'fields':[_0x05c0('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x32a795,_0x32cdfa,_0x996d6b){var _0x321c09=_0x3521fe[_0x05c0('0xd')];var _0x1edbb=_0x32a795['get']({'plain':!![]});if(_0x1edbb['direction'][_0x05c0('0xe')]()==='in'||_0x1edbb['direction'][_0x05c0('0xe')]()===_0x05c0('0xf')&&!_0x1edbb[_0x05c0('0x10')]&&!_['isNil'](_0x1edbb[_0x05c0('0x11')])){_0x321c09['OpenchannelInteraction'][_0x05c0('0x12')]({'where':{'id':_0x1edbb[_0x05c0('0x13')]}})[_0x05c0('0x14')](function(_0x12deeb){if(_0x12deeb){_0x12deeb[_0x05c0('0x15')]({'lastMsgAt':_0x1edbb[_0x05c0('0x16')],'lastMsgDirection':_0x1edbb[_0x05c0('0x17')][_0x05c0('0xe')]()});}})['catch'](function(_0x238e25){console[_0x05c0('0x18')](_0x238e25);});}if(_0x1edbb[_0x05c0('0x17')]===_0x05c0('0xf')&&!_0x1edbb[_0x05c0('0x10')]){var _0x40153e;_0x321c09[_0x05c0('0x19')][_0x05c0('0x1a')]()[_0x05c0('0x14')](function(_0x521cbd){return _0x321c09[_0x05c0('0x1b')][_0x05c0('0x1c')]({'where':{'id':_0x1edbb[_0x05c0('0x1d')]},'include':[{'model':_0x321c09['OpenchannelInteraction'],'as':_0x05c0('0x1e'),'where':{'id':_0x1edbb[_0x05c0('0x13')]},'limit':0x1,'include':[{'model':_0x321c09[_0x05c0('0x19')],'as':_0x05c0('0x1f'),'attributes':_[_0x05c0('0x20')](_0x521cbd)}]}]});})['then'](function(_0x407c1f){_0x40153e=_0x407c1f[_0x05c0('0x21')]({'plain':!![]});if(_0x40153e&&_0x40153e['replyUri']){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x05c0('0x22'),util[_0x05c0('0x23')](_0x05c0('0x24'),_0x1edbb['id'],_0x40153e[_0x05c0('0x25')]));if(_0x40153e[_0x05c0('0x1e')]&&_0x40153e[_0x05c0('0x1e')][_0x05c0('0x26')]){_0x1edbb['Interaction']=_[_0x05c0('0x27')](_0x40153e[_0x05c0('0x1e')][0x0],'Contact');_0x1edbb['Contact']=_0x40153e['Interactions'][0x0]['Contact'];}var _0x32cdfa={'method':_0x05c0('0x28'),'uri':encodeURI(_0x40153e[_0x05c0('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x32cdfa['method']){case _0x05c0('0x29'):_0x32cdfa['qs']=_0x1edbb;break;case _0x05c0('0x28'):_0x32cdfa[_0x05c0('0xc')]=_0x1edbb;break;}return rp(_0x32cdfa)[_0x05c0('0x14')](function(_0x58769a){logger[_0x05c0('0x2a')](_0x05c0('0x2b'),_0x05c0('0x22'),util[_0x05c0('0x23')](_0x05c0('0x2c'),_0x1edbb['id'],_0x40153e[_0x05c0('0x25')]));if(_0x58769a['body']['threadId']&&_0x58769a[_0x05c0('0xc')][_0x05c0('0x2d')]!=_0x1edbb[_0x05c0('0x2e')][_0x05c0('0x2d')]){return _0x321c09[_0x05c0('0x2f')][_0x05c0('0x15')]({'threadId':_0x58769a[_0x05c0('0xc')][_0x05c0('0x2d')]},{'logging':!![],'where':{'id':_0x1edbb[_0x05c0('0x2e')]['id']}});}else{return;}})[_0x05c0('0x14')](function(){return _0x32a795[_0x05c0('0x15')]({'read':!![]});})[_0x05c0('0x30')](function(_0x50f03d){logger['error'](_0x05c0('0x2b'),_0x05c0('0x22'),util[_0x05c0('0x31')](_0x50f03d,{'showHidden':![],'depth':null}));_0x996d6b();});}else{_0x996d6b();}})['finally'](function(){_0x996d6b();});}else{_0x996d6b();}}},'charset':_0x05c0('0x32'),'collate':_0x05c0('0x33')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 2a1b705..9923406 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['message','result','OpenchannelMessage','create','body','options','CreateOpenchannelMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x1da8ff,_0xc159d8){var _0x412e7a=function(_0xb369ea){while(--_0xb369ea){_0x1da8ff['push'](_0x1da8ff['shift']());}};_0x412e7a(++_0xc159d8);}(_0x0b0e,0x187));var _0xe0b0=function(_0x16e0c8,_0x4861eb){_0x16e0c8=_0x16e0c8-0x0;var _0xe4b5af=_0x0b0e[_0x16e0c8];return _0xe4b5af;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});config[_0xe0b0('0xc')]=_['defaults'](config['redis'],{'host':_0xe0b0('0xd'),'port':0x18eb});var socket=require(_0xe0b0('0xe'))(new Redis(config[_0xe0b0('0xc')]));require(_0xe0b0('0xf'))['register'](socket);function respondWithRpcPromise(_0x338e7c,_0x1dd3b8,_0x553d4f){return new BPromise(function(_0x1fef28,_0x2f32b6){return client['request'](_0x338e7c,_0x553d4f)[_0xe0b0('0x10')](function(_0x2cdad2){logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0xe0b0('0x12'));logger[_0xe0b0('0x13')](_0xe0b0('0x14'),_0x1dd3b8,_0xe0b0('0x12'),JSON[_0xe0b0('0x15')](_0x2cdad2));if(_0x2cdad2['error']){if(_0x2cdad2[_0xe0b0('0x16')][_0xe0b0('0x17')]===0x1f4){logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2[_0xe0b0('0x16')]['message']);return _0x2f32b6(_0x2cdad2[_0xe0b0('0x16')]['message']);}logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2['error'][_0xe0b0('0x19')]);return _0x1fef28(_0x2cdad2['error'][_0xe0b0('0x19')]);}else{logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,'request\x20sent');_0x1fef28(_0x2cdad2[_0xe0b0('0x1a')]['message']);}})['catch'](function(_0x4bce65){logger[_0xe0b0('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0x4bce65);_0x2f32b6(_0x4bce65);});});}exports['CreateOpenchannelMessage']=function(_0x10cde1){var _0x59dff5=this;return new Promise(function(_0x472286,_0x5dba2f){return db[_0xe0b0('0x1b')][_0xe0b0('0x1c')](_0x10cde1[_0xe0b0('0x1d')],{'raw':_0x10cde1[_0xe0b0('0x1e')]?_0x10cde1[_0xe0b0('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2fa820){logger['info'](_0xe0b0('0x1f'),_0x10cde1);logger[_0xe0b0('0x13')]('CreateOpenchannelMessage',_0x10cde1,JSON[_0xe0b0('0x15')](_0x2fa820));_0x472286(_0x2fa820);})['catch'](function(_0x2208d0){logger['error'](_0xe0b0('0x1f'),_0x2208d0['message'],_0x10cde1);_0x5dba2f(_0x59dff5[_0xe0b0('0x16')](0x1f4,_0x2208d0['message']));});});}; \ No newline at end of file +var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x576d9c,_0x4b8f93){var _0x30154d=function(_0x4c187f){while(--_0x4c187f){_0x576d9c['push'](_0x576d9c['shift']());}};_0x30154d(++_0x4b8f93);}(_0x5f2f,0x73));var _0xf5f2=function(_0x322f60,_0xd6710b){_0x322f60=_0x322f60-0x0;var _0x3066ae=_0x5f2f[_0x322f60];return _0x3066ae;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 9e1b8d8..726b6c5 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 _0xac39=['emit','removeListener','register','openchannelMessage:','./openchannelMessage.events','save','remove','update'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xac39,0x11c));var _0x9ac3=function(_0x4074cf,_0x1f2a9a){_0x4074cf=_0x4074cf-0x0;var _0x22cc67=_0xac39[_0x4074cf];return _0x22cc67;};'use strict';var OpenchannelMessageEvents=require(_0x9ac3('0x0'));var events=[_0x9ac3('0x1'),_0x9ac3('0x2'),_0x9ac3('0x3')];function createListener(_0x4770d1,_0x195763){return function(_0x11cdee){_0x195763[_0x9ac3('0x4')](_0x4770d1,_0x11cdee);};}function removeListener(_0x1a0610,_0x4711ea){return function(){OpenchannelMessageEvents[_0x9ac3('0x5')](_0x1a0610,_0x4711ea);};}exports[_0x9ac3('0x6')]=function(_0x39b115){for(var _0x4285f6=0x0,_0x32f7c8=events['length'];_0x4285f6<_0x32f7c8;_0x4285f6++){var _0x28ac77=events[_0x4285f6];var _0x1b1440=createListener(_0x9ac3('0x7')+_0x28ac77,_0x39b115);OpenchannelMessageEvents['on'](_0x28ac77,_0x1b1440);}}; \ No newline at end of file +var _0x8289=['emit','removeListener','register','length','openchannelMessage:','./openchannelMessage.events','save','remove','update'];(function(_0x310e44,_0x4a336d){var _0x1c82de=function(_0x200995){while(--_0x200995){_0x310e44['push'](_0x310e44['shift']());}};_0x1c82de(++_0x4a336d);}(_0x8289,0xf8));var _0x9828=function(_0x22aae8,_0x5922f4){_0x22aae8=_0x22aae8-0x0;var _0x13111d=_0x8289[_0x22aae8];return _0x13111d;};'use strict';var OpenchannelMessageEvents=require(_0x9828('0x0'));var events=[_0x9828('0x1'),_0x9828('0x2'),_0x9828('0x3')];function createListener(_0x28d6ee,_0x2e4fa1){return function(_0x10c220){_0x2e4fa1[_0x9828('0x4')](_0x28d6ee,_0x10c220);};}function removeListener(_0x5b5139,_0x3e5a97){return function(){OpenchannelMessageEvents[_0x9828('0x5')](_0x5b5139,_0x3e5a97);};}exports[_0x9828('0x6')]=function(_0x200696){for(var _0x182e6f=0x0,_0x1d4ea5=events[_0x9828('0x7')];_0x182e6f<_0x1d4ea5;_0x182e6f++){var _0x2eae3a=events[_0x182e6f];var _0x399a88=createListener(_0x9828('0x8')+_0x2eae3a,_0x200696);OpenchannelMessageEvents['on'](_0x2eae3a,_0x399a88);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 9616518..d6f241c 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 _0xcb5f=['index','/describe','isAuthenticated','describe','show','/:id/members','getMembers','getTeams','getAgents','post','create','/:id/teams','addTeams','/:id/users','addAgents','delete','/:id','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x2a6f78,_0x57aee6){var _0x37f15e=function(_0x154ef8){while(--_0x154ef8){_0x2a6f78['push'](_0x2a6f78['shift']());}};_0x37f15e(++_0x57aee6);}(_0xcb5f,0xdf));var _0xfcb5=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xcb5f[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xfcb5('0x0'));var util=require(_0xfcb5('0x1'));var path=require(_0xfcb5('0x2'));var timeout=require(_0xfcb5('0x3'));var express=require(_0xfcb5('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfcb5('0x5'));var interaction=require(_0xfcb5('0x6'));var config=require(_0xfcb5('0x7'));var controller=require('./openchannelQueue.controller');router[_0xfcb5('0x8')]('/',auth['isAuthenticated'](),controller[_0xfcb5('0x9')]);router[_0xfcb5('0x8')](_0xfcb5('0xa'),auth[_0xfcb5('0xb')](),controller[_0xfcb5('0xc')]);router[_0xfcb5('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xfcb5('0xd')]);router[_0xfcb5('0x8')](_0xfcb5('0xe'),auth['isAuthenticated'](),controller[_0xfcb5('0xf')]);router[_0xfcb5('0x8')]('/:id/teams',auth[_0xfcb5('0xb')](),controller[_0xfcb5('0x10')]);router['get']('/:id/users',auth[_0xfcb5('0xb')](),controller[_0xfcb5('0x11')]);router[_0xfcb5('0x12')]('/',auth['isAuthenticated'](),controller[_0xfcb5('0x13')]);router['post'](_0xfcb5('0x14'),auth['isAuthenticated'](),controller[_0xfcb5('0x15')]);router['post'](_0xfcb5('0x16'),auth[_0xfcb5('0xb')](),controller[_0xfcb5('0x17')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xfcb5('0x18')](_0xfcb5('0x19'),auth[_0xfcb5('0xb')](),controller[_0xfcb5('0x1a')]);router['delete'](_0xfcb5('0x14'),auth[_0xfcb5('0xb')](),controller['removeTeams']);router[_0xfcb5('0x18')](_0xfcb5('0x16'),auth['isAuthenticated'](),controller[_0xfcb5('0x1b')]);module[_0xfcb5('0x1c')]=router; \ No newline at end of file +var _0xc50b=['express','../../components/auth/service','./openchannelQueue.controller','isAuthenticated','index','/describe','describe','get','show','/:id/members','getMembers','getTeams','post','create','/:id/teams','addTeams','/:id/users','/:id','update','delete','destroy','removeAgents','exports','util','path','connect-timeout'];(function(_0x8fc78,_0x39fc6b){var _0x1a1a60=function(_0xbe55dd){while(--_0xbe55dd){_0x8fc78['push'](_0x8fc78['shift']());}};_0x1a1a60(++_0x39fc6b);}(_0xc50b,0x65));var _0xbc50=function(_0x3be7ff,_0x12e714){_0x3be7ff=_0x3be7ff-0x0;var _0x186721=_0xc50b[_0x3be7ff];return _0x186721;};'use strict';var multer=require('multer');var util=require(_0xbc50('0x0'));var path=require(_0xbc50('0x1'));var timeout=require(_0xbc50('0x2'));var express=require(_0xbc50('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbc50('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbc50('0x5'));router['get']('/',auth[_0xbc50('0x6')](),controller[_0xbc50('0x7')]);router['get'](_0xbc50('0x8'),auth[_0xbc50('0x6')](),controller[_0xbc50('0x9')]);router[_0xbc50('0xa')]('/:id',auth[_0xbc50('0x6')](),controller[_0xbc50('0xb')]);router[_0xbc50('0xa')](_0xbc50('0xc'),auth['isAuthenticated'](),controller[_0xbc50('0xd')]);router[_0xbc50('0xa')]('/:id/teams',auth['isAuthenticated'](),controller[_0xbc50('0xe')]);router[_0xbc50('0xa')]('/:id/users',auth[_0xbc50('0x6')](),controller['getAgents']);router[_0xbc50('0xf')]('/',auth[_0xbc50('0x6')](),controller[_0xbc50('0x10')]);router[_0xbc50('0xf')](_0xbc50('0x11'),auth[_0xbc50('0x6')](),controller[_0xbc50('0x12')]);router[_0xbc50('0xf')](_0xbc50('0x13'),auth[_0xbc50('0x6')](),controller['addAgents']);router['put'](_0xbc50('0x14'),auth[_0xbc50('0x6')](),controller[_0xbc50('0x15')]);router[_0xbc50('0x16')](_0xbc50('0x14'),auth[_0xbc50('0x6')](),controller[_0xbc50('0x17')]);router[_0xbc50('0x16')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0xbc50('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0xbc50('0x18')]);module[_0xbc50('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 52f591e..7de7420 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 _0x069d=['sequelize','exports','name','STRING','INTEGER','beepall','roundrobin'];(function(_0x2726c4,_0x42481e){var _0x49a869=function(_0x32892e){while(--_0x32892e){_0x2726c4['push'](_0x2726c4['shift']());}};_0x49a869(++_0x42481e);}(_0x069d,0x16c));var _0xd069=function(_0x5df738,_0x3d47b8){_0x5df738=_0x5df738-0x0;var _0x5e6f49=_0x069d[_0x5df738];return _0x5e6f49;};'use strict';var Sequelize=require(_0xd069('0x0'));module[_0xd069('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd069('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd069('0x3')]},'timeout':{'type':Sequelize[_0xd069('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xd069('0x5'),_0xd069('0x6'))}}; \ No newline at end of file +var _0x7a02=['beepall','roundrobin','sequelize','name','STRING','INTEGER','rrmemory'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x7a02,0xdb));var _0x27a0=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7a02[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x27a0('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x27a0('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x27a0('0x2')]},'timeout':{'type':Sequelize[_0x27a0('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x27a0('0x4'),_0x27a0('0x5'),_0x27a0('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 539afed..027c15b 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 _0xfaba=['TeamId','includes','all','value','removeAgents','forEach','addAgents','spread','emit','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','socket.io-emitter','./openchannelQueue.socket','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','get','OpenchannelQueues','UserProfileResource','destroy','error','stack','name','index','map','OpenchannelQueue','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','findAndCountAll','UserId','openchannelPause','updatedAt','createdAt','SIP','getTeams','Team','addTeams','ids','voicePause','interface','flatMap','Agents','sequelize','findOrCreate','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes'];(function(_0x2707c5,_0x475c01){var _0x401907=function(_0x13ca8c){while(--_0x13ca8c){_0x2707c5['push'](_0x2707c5['shift']());}};_0x401907(++_0x475c01);}(_0xfaba,0x1a0));var _0xafab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfaba[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xafab('0x0'));var zipdir=require(_0xafab('0x1'));var jsonpatch=require(_0xafab('0x2'));var rp=require(_0xafab('0x3'));var moment=require(_0xafab('0x4'));var BPromise=require(_0xafab('0x5'));var Mustache=require(_0xafab('0x6'));var util=require(_0xafab('0x7'));var path=require(_0xafab('0x8'));var sox=require(_0xafab('0x9'));var csv=require(_0xafab('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xafab('0xb'));var _=require('lodash');var squel=require(_0xafab('0xc'));var crypto=require('crypto');var jsforce=require(_0xafab('0xd'));var deskjs=require(_0xafab('0xe'));var toCsv=require(_0xafab('0xa'));var querystring=require(_0xafab('0xf'));var Papa=require(_0xafab('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xafab('0x11'));var as=require(_0xafab('0x12'));var hardwareService=require(_0xafab('0x13'));var logger=require(_0xafab('0x14'))(_0xafab('0x15'));var utils=require('../../config/utils');var config=require(_0xafab('0x16'));var licenseUtil=require(_0xafab('0x17'));var db=require('../../mysqldb')['db'];config[_0xafab('0x18')]=_['defaults'](config[_0xafab('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xafab('0x19'))(new Redis(config[_0xafab('0x18')]));require(_0xafab('0x1a'))['register'](socket);function respondWithStatusCode(_0x443900,_0x27b626){_0x27b626=_0x27b626||0xcc;return function(_0x1dc33c){if(_0x1dc33c){return _0x443900[_0xafab('0x1b')](_0x27b626);}return _0x443900['status'](_0x27b626)[_0xafab('0x1c')]();};}function respondWithResult(_0xa2f745,_0x405358){_0x405358=_0x405358||0xc8;return function(_0x4233f5){if(_0x4233f5){return _0xa2f745['status'](_0x405358)[_0xafab('0x1d')](_0x4233f5);}};}function respondWithFilteredResult(_0x28ebed,_0x21f35a){return function(_0x3a6bef){if(_0x3a6bef){var _0x23b705=typeof _0x21f35a[_0xafab('0x1e')]===_0xafab('0x1f')&&typeof _0x21f35a[_0xafab('0x20')]===_0xafab('0x1f');var _0x18efa5=_0x3a6bef[_0xafab('0x21')];var _0x27d632=_0x23b705?0x0:_0x21f35a['offset'];var _0x4075de=_0x23b705?_0x3a6bef[_0xafab('0x21')]:_0x21f35a['offset']+_0x21f35a['limit'];var _0x5e1785;if(_0x4075de>=_0x18efa5){_0x4075de=_0x18efa5;_0x5e1785=0xc8;}else{_0x5e1785=0xce;}_0x28ebed[_0xafab('0x22')](_0x5e1785);return _0x28ebed[_0xafab('0x23')]('Content-Range',_0x27d632+'-'+_0x4075de+'/'+_0x18efa5)[_0xafab('0x1d')](_0x3a6bef);}return null;};}function patchUpdates(_0x484999){return function(_0x1e721c){try{jsonpatch[_0xafab('0x24')](_0x1e721c,_0x484999,!![]);}catch(_0x24adc7){return BPromise[_0xafab('0x25')](_0x24adc7);}return _0x1e721c[_0xafab('0x26')]();};}function saveUpdates(_0x32bace,_0x4e284b){return function(_0x3a665c){if(_0x3a665c){return _0x3a665c[_0xafab('0x27')](_0x32bace)[_0xafab('0x28')](function(_0x184f0d){return _0x184f0d;});}return null;};}function removeEntity(_0x2bbd9c,_0x5246e7){return function(_0x470d66){if(_0x470d66){return _0x470d66['destroy']()[_0xafab('0x28')](function(){var _0x3cea3f=_0x470d66[_0xafab('0x29')]({'plain':!![]});var _0x347857=_0xafab('0x2a');return db[_0xafab('0x2b')][_0xafab('0x2c')]({'where':{'type':_0x347857,'resourceId':_0x3cea3f['id']}})[_0xafab('0x28')](function(){return _0x470d66;});})[_0xafab('0x28')](function(){_0x2bbd9c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e41c2,_0x137d58){return function(_0x1dafce){if(!_0x1dafce){_0x3e41c2[_0xafab('0x1b')](0x194);}return _0x1dafce;};}function handleError(_0x5e554e,_0x30c74d){_0x30c74d=_0x30c74d||0x1f4;return function(_0x210cfe){logger[_0xafab('0x2d')](_0x210cfe[_0xafab('0x2e')]);if(_0x210cfe[_0xafab('0x2f')]){delete _0x210cfe['name'];}_0x5e554e[_0xafab('0x22')](_0x30c74d)['send'](_0x210cfe);};}exports[_0xafab('0x30')]=function(_0x12ccea,_0x16b851){var _0x28c1b2={},_0x247d4b={},_0x136abe={'count':0x0,'rows':[]};var _0x2b732d=_[_0xafab('0x31')](db[_0xafab('0x32')][_0xafab('0x33')],function(_0x255fde){return{'name':_0x255fde[_0xafab('0x34')],'type':_0x255fde['type']['key']};});_0x247d4b[_0xafab('0x35')]=_[_0xafab('0x31')](_0x2b732d,'name');_0x247d4b[_0xafab('0x36')]=_[_0xafab('0x37')](_0x12ccea['query']);_0x247d4b[_0xafab('0x38')]=_[_0xafab('0x39')](_0x247d4b[_0xafab('0x35')],_0x247d4b[_0xafab('0x36')]);_0x28c1b2[_0xafab('0x3a')]=_['intersection'](_0x247d4b[_0xafab('0x35')],qs[_0xafab('0x3b')](_0x12ccea[_0xafab('0x36')][_0xafab('0x3b')]));_0x28c1b2['attributes']=_0x28c1b2[_0xafab('0x3a')][_0xafab('0x3c')]?_0x28c1b2['attributes']:_0x247d4b['model'];if(!_0x12ccea[_0xafab('0x36')][_0xafab('0x3d')](_0xafab('0x3e'))){_0x28c1b2[_0xafab('0x20')]=qs[_0xafab('0x20')](_0x12ccea[_0xafab('0x36')][_0xafab('0x20')]);_0x28c1b2['offset']=qs['offset'](_0x12ccea['query'][_0xafab('0x1e')]);}_0x28c1b2[_0xafab('0x3f')]=qs['sort'](_0x12ccea[_0xafab('0x36')][_0xafab('0x40')]);_0x28c1b2['where']=qs[_0xafab('0x38')](_[_0xafab('0x41')](_0x12ccea[_0xafab('0x36')],_0x247d4b[_0xafab('0x38')]),_0x2b732d);if(_0x12ccea[_0xafab('0x36')][_0xafab('0x42')]){_0x28c1b2[_0xafab('0x43')]=_[_0xafab('0x44')](_0x28c1b2['where'],{'$or':_[_0xafab('0x31')](_0x2b732d,function(_0x46893c){if(_0x46893c[_0xafab('0x45')]!==_0xafab('0x46')){var _0x509c8e={};_0x509c8e[_0x46893c[_0xafab('0x2f')]]={'$like':'%'+_0x12ccea['query'][_0xafab('0x42')]+'%'};return _0x509c8e;}})});}_0x28c1b2=_[_0xafab('0x44')]({},_0x28c1b2,_0x12ccea['options']);var _0x2cba4b={'where':_0x28c1b2[_0xafab('0x43')]};return db[_0xafab('0x32')][_0xafab('0x21')](_0x2cba4b)[_0xafab('0x28')](function(_0x2b77a6){_0x136abe[_0xafab('0x21')]=_0x2b77a6;if(_0x12ccea['query'][_0xafab('0x47')]){_0x28c1b2[_0xafab('0x48')]=[{'all':!![]}];}return db[_0xafab('0x32')][_0xafab('0x49')](_0x28c1b2);})[_0xafab('0x28')](function(_0x171b22){_0x136abe[_0xafab('0x4a')]=_0x171b22;return _0x136abe;})[_0xafab('0x28')](respondWithFilteredResult(_0x16b851,_0x28c1b2))[_0xafab('0x4b')](handleError(_0x16b851,null));};exports[_0xafab('0x4c')]=function(_0xce9c3,_0x55e810){var _0x317827={'raw':!![],'where':{'id':_0xce9c3[_0xafab('0x4d')]['id']}},_0x32f9e3={};_0x32f9e3[_0xafab('0x35')]=_[_0xafab('0x37')](db[_0xafab('0x32')][_0xafab('0x33')]);_0x32f9e3[_0xafab('0x36')]=_[_0xafab('0x37')](_0xce9c3[_0xafab('0x36')]);_0x32f9e3[_0xafab('0x38')]=_[_0xafab('0x39')](_0x32f9e3[_0xafab('0x35')],_0x32f9e3[_0xafab('0x36')]);_0x317827[_0xafab('0x3a')]=_[_0xafab('0x39')](_0x32f9e3[_0xafab('0x35')],qs[_0xafab('0x3b')](_0xce9c3[_0xafab('0x36')][_0xafab('0x3b')]));_0x317827[_0xafab('0x3a')]=_0x317827['attributes'][_0xafab('0x3c')]?_0x317827[_0xafab('0x3a')]:_0x32f9e3[_0xafab('0x35')];if(_0xce9c3['query'][_0xafab('0x47')]){_0x317827[_0xafab('0x48')]=[{'all':!![]}];}_0x317827=_['merge']({},_0x317827,_0xce9c3[_0xafab('0x4e')]);return db['OpenchannelQueue'][_0xafab('0x4f')](_0x317827)[_0xafab('0x28')](handleEntityNotFound(_0x55e810,null))[_0xafab('0x28')](respondWithResult(_0x55e810,null))[_0xafab('0x4b')](handleError(_0x55e810,null));};exports['create']=function(_0x168622,_0x5da3ad){return db[_0xafab('0x32')][_0xafab('0x50')](_0x168622[_0xafab('0x51')],{})[_0xafab('0x28')](function(_0xe27847){var _0x372357=_0x168622[_0xafab('0x52')]['get']({'plain':!![]});if(!_0x372357)throw new Error(_0xafab('0x53'));if(_0x372357[_0xafab('0x54')]===_0xafab('0x52')){var _0x39c296=_0xe27847[_0xafab('0x29')]({'plain':!![]});var _0x184ed6=_0xafab('0x2a');return db[_0xafab('0x55')][_0xafab('0x4f')]({'where':{'name':_0x184ed6,'userProfileId':_0x372357['userProfileId']},'raw':!![]})[_0xafab('0x28')](function(_0x3c69a3){if(_0x3c69a3&&_0x3c69a3['autoAssociation']===0x0){return db['UserProfileResource'][_0xafab('0x50')]({'name':_0x39c296['name'],'resourceId':_0x39c296['id'],'type':_0x3c69a3[_0xafab('0x2f')],'sectionId':_0x3c69a3['id']},{})[_0xafab('0x28')](function(){return _0xe27847;});}else{return _0xe27847;}})[_0xafab('0x4b')](function(_0xb33fb){logger[_0xafab('0x2d')](_0xafab('0x56'),_0xb33fb);throw _0xb33fb;});}return _0xe27847;})[_0xafab('0x28')](respondWithResult(_0x5da3ad,0xc9))[_0xafab('0x4b')](handleError(_0x5da3ad,null));};exports[_0xafab('0x27')]=function(_0x4b000d,_0x1cf293){if(_0x4b000d['body']['id']){delete _0x4b000d['body']['id'];}return db[_0xafab('0x32')][_0xafab('0x4f')]({'where':{'id':_0x4b000d[_0xafab('0x4d')]['id']}})[_0xafab('0x28')](handleEntityNotFound(_0x1cf293,null))[_0xafab('0x28')](saveUpdates(_0x4b000d[_0xafab('0x51')],null))[_0xafab('0x28')](respondWithResult(_0x1cf293,null))[_0xafab('0x4b')](handleError(_0x1cf293,null));};exports[_0xafab('0x2c')]=function(_0x2d15ed,_0x1135b8){return db[_0xafab('0x32')][_0xafab('0x4f')]({'where':{'id':_0x2d15ed[_0xafab('0x4d')]['id']}})[_0xafab('0x28')](handleEntityNotFound(_0x1135b8,null))[_0xafab('0x28')](removeEntity(_0x1135b8,null))[_0xafab('0x4b')](handleError(_0x1135b8,null));};exports[_0xafab('0x57')]=function(_0x1c6764,_0x4208c8){return db[_0xafab('0x32')][_0xafab('0x57')]()[_0xafab('0x28')](respondWithResult(_0x4208c8,null))['catch'](handleError(_0x4208c8,null));};exports[_0xafab('0x58')]=function(_0x4e7f3b,_0x2d9c2a,_0x122944){var _0x2483d4={'raw':!![],'where':{}},_0x98d46b={},_0x34efb2;return db[_0xafab('0x32')][_0xafab('0x59')]({'where':{'id':_0x4e7f3b[_0xafab('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2d9c2a,null))[_0xafab('0x28')](function(_0x4d0d04){if(_0x4d0d04){_0x34efb2=_0x4d0d04[_0xafab('0x29')]({'plain':!![]});_0x98d46b[_0xafab('0x35')]=_[_0xafab('0x37')](db[_0xafab('0x5a')][_0xafab('0x33')]);_0x98d46b[_0xafab('0x36')]=_[_0xafab('0x37')](_0x4e7f3b[_0xafab('0x36')]);_0x98d46b[_0xafab('0x38')]=_[_0xafab('0x39')](_0x98d46b[_0xafab('0x35')],_0x98d46b[_0xafab('0x36')]);_0x2483d4[_0xafab('0x3a')]=_[_0xafab('0x39')](_0x98d46b[_0xafab('0x35')],qs[_0xafab('0x3b')](_0x4e7f3b['query'][_0xafab('0x3b')]));_0x2483d4['attributes']=_0x2483d4[_0xafab('0x3a')][_0xafab('0x3c')]?_0x2483d4['attributes']:_0x98d46b[_0xafab('0x35')];if(!_0x4e7f3b[_0xafab('0x36')]['hasOwnProperty'](_0xafab('0x3e'))){_0x2483d4[_0xafab('0x20')]=qs['limit'](_0x4e7f3b['query'][_0xafab('0x20')]);_0x2483d4[_0xafab('0x1e')]=qs[_0xafab('0x1e')](_0x4e7f3b[_0xafab('0x36')][_0xafab('0x1e')]);}_0x2483d4[_0xafab('0x3f')]=qs[_0xafab('0x40')](_0x4e7f3b[_0xafab('0x36')][_0xafab('0x40')]);_0x2483d4['where']=qs[_0xafab('0x38')](_['pick'](_0x4e7f3b[_0xafab('0x36')],_0x98d46b['filters']));_0x2483d4['where'][_0xafab('0x5b')]=_0x4d0d04['id'];if(_0x4e7f3b['query']['filter']){_0x2483d4[_0xafab('0x43')]=_[_0xafab('0x44')](_0x2483d4[_0xafab('0x43')],{'$or':_[_0xafab('0x31')](_0x2483d4[_0xafab('0x3a')],function(_0x5bbd01){var _0x1ec8f5={};_0x1ec8f5[_0x5bbd01]={'$like':'%'+_0x4e7f3b[_0xafab('0x36')][_0xafab('0x42')]+'%'};return _0x1ec8f5;})});}_0x2483d4=_['merge']({},_0x2483d4,_0x4e7f3b[_0xafab('0x4e')]);return db[_0xafab('0x5a')]['findAll'](_0x2483d4);}})[_0xafab('0x28')](function(_0x378989){if(_0x378989){return db[_0xafab('0x5c')][_0xafab('0x5d')]({'where':{'id':_[_0xafab('0x31')](_0x378989,_0xafab('0x5e')),'role':'agent'},'attributes':['id',_0xafab('0x2f'),_0xafab('0x5f'),_0xafab('0x60'),_0xafab('0x61')]});}})[_0xafab('0x28')](function(_0x49cdd5){if(_0x49cdd5){return{'count':_0x49cdd5[_0xafab('0x21')],'rows':_[_0xafab('0x31')](_0x49cdd5[_0xafab('0x4a')],function(_0xf21531){return{'membername':_0xf21531[_0xafab('0x2f')],'UserId':_0xf21531['id'],'queue_name':_0x34efb2[_0xafab('0x2f')],'OpenchannelQueueId':_0x34efb2['id'],'interface':util['format']('%s/%s',_0xafab('0x62'),_0xf21531[_0xafab('0x2f')]),'penalty':0x0,'paused':_0xf21531[_0xafab('0x5f')],'createdAt':_0xf21531['createdAt'],'updatedAt':_0xf21531[_0xafab('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xafab('0x28')](respondWithFilteredResult(_0x2d9c2a,_0x2483d4))[_0xafab('0x4b')](handleError(_0x2d9c2a,null));};exports[_0xafab('0x63')]=function(_0x217cd3,_0x9bd4d8,_0x3d7e59){var _0x5345c3={};var _0x3f9184={};var _0xc1bfce;var _0x202fc3;return db[_0xafab('0x32')][_0xafab('0x59')]({'where':{'id':_0x217cd3[_0xafab('0x4d')]['id']}})[_0xafab('0x28')](handleEntityNotFound(_0x9bd4d8,null))[_0xafab('0x28')](function(_0x4a6ebe){if(_0x4a6ebe){_0xc1bfce=_0x4a6ebe;_0x3f9184[_0xafab('0x35')]=_[_0xafab('0x37')](db[_0xafab('0x64')][_0xafab('0x33')]);_0x3f9184[_0xafab('0x36')]=_[_0xafab('0x37')](_0x217cd3[_0xafab('0x36')]);_0x3f9184['filters']=_[_0xafab('0x39')](_0x3f9184[_0xafab('0x35')],_0x3f9184['query']);_0x5345c3['attributes']=_[_0xafab('0x39')](_0x3f9184['model'],qs[_0xafab('0x3b')](_0x217cd3[_0xafab('0x36')][_0xafab('0x3b')]));_0x5345c3[_0xafab('0x3a')]=_0x5345c3[_0xafab('0x3a')]['length']?_0x5345c3[_0xafab('0x3a')]:_0x3f9184[_0xafab('0x35')];_0x5345c3['order']=qs[_0xafab('0x40')](_0x217cd3[_0xafab('0x36')]['sort']);_0x5345c3[_0xafab('0x43')]=qs[_0xafab('0x38')](_['pick'](_0x217cd3['query'],_0x3f9184[_0xafab('0x38')]));if(_0x217cd3[_0xafab('0x36')][_0xafab('0x42')]){_0x5345c3[_0xafab('0x43')]=_['merge'](_0x5345c3[_0xafab('0x43')],{'$or':_[_0xafab('0x31')](_0x5345c3[_0xafab('0x3a')],function(_0x3f2fdb){var _0x267bee={};_0x267bee[_0x3f2fdb]={'$like':'%'+_0x217cd3[_0xafab('0x36')][_0xafab('0x42')]+'%'};return _0x267bee;})});}_0x5345c3=_[_0xafab('0x44')]({},_0x5345c3,_0x217cd3[_0xafab('0x4e')]);return _0xc1bfce[_0xafab('0x63')](_0x5345c3);}})[_0xafab('0x28')](function(_0x166811){if(_0x166811){_0x202fc3=_0x166811['length'];if(!_0x217cd3[_0xafab('0x36')][_0xafab('0x3d')]('nolimit')){_0x5345c3[_0xafab('0x20')]=qs[_0xafab('0x20')](_0x217cd3[_0xafab('0x36')]['limit']);_0x5345c3[_0xafab('0x1e')]=qs['offset'](_0x217cd3['query'][_0xafab('0x1e')]);}return _0xc1bfce[_0xafab('0x63')](_0x5345c3);}})[_0xafab('0x28')](function(_0x10ef9b){if(_0x10ef9b){return _0x10ef9b?{'count':_0x202fc3,'rows':_0x10ef9b}:null;}})['then'](respondWithResult(_0x9bd4d8,null))[_0xafab('0x4b')](handleError(_0x9bd4d8,null));};exports[_0xafab('0x65')]=function(_0x592334,_0xec50ce,_0x3db697){var _0x4d2bc2=_0x592334[_0xafab('0x51')][_0xafab('0x66')];return db[_0xafab('0x64')][_0xafab('0x49')]({'where':{'id':_0x4d2bc2},'attributes':['id'],'include':[{'model':db[_0xafab('0x5c')],'as':'Agents','attributes':['id',_0xafab('0x2f'),'online',_0xafab('0x67'),_0xafab('0x68')],'raw':!![]}]})[_0xafab('0x28')](function(_0x534ec4){if(_0x534ec4){var _0x105198=_[_0xafab('0x69')](_0x534ec4,function(_0x1b8240){var _0x1e1b3b=_0x1b8240[_0xafab('0x29')]({'plain':!![]});return _0x1e1b3b[_0xafab('0x6a')];});return db[_0xafab('0x32')][_0xafab('0x4f')]({'where':{'id':_0x592334[_0xafab('0x4d')]['id']}})[_0xafab('0x28')](function(_0x425b13){return db[_0xafab('0x6b')]['transaction'](function(_0x50d324){return _0x425b13[_0xafab('0x65')](_0x4d2bc2,{'transaction':_0x50d324})[_0xafab('0x28')](function(){return BPromise['each'](_0x105198,function(_0x14987b){return db['UserOpenchannelQueue'][_0xafab('0x6c')]({'where':{'UserId':_0x14987b['id'],'OpenchannelQueueId':_0x592334['params']['id']},'transaction':_0x50d324});});})['then'](function(){_0x105198['forEach'](function(_0x47117c){socket['emit'](_0xafab('0x6d'),{'UserId':_0x47117c['id'],'OpenchannelQueueId':_0x425b13['id']});});});});});}})[_0xafab('0x28')](respondWithStatusCode(_0xec50ce,null))[_0xafab('0x4b')](handleError(_0xec50ce,null));};exports[_0xafab('0x6e')]=function(_0x5c8cbc,_0x4154ed,_0x387d17){return db['Team'][_0xafab('0x49')]({'where':{'id':_0x5c8cbc[_0xafab('0x36')][_0xafab('0x66')]},'attributes':['id'],'include':[{'model':db[_0xafab('0x5c')],'as':_0xafab('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4154ed,null))[_0xafab('0x28')](function(_0x36be93){var _0x320770=_[_0xafab('0x31')](_0x36be93,'id');var _0x2f150e=[];var _0x1229c4=[];var _0x171703=squel[_0xafab('0x6f')]();_0x171703[_0xafab('0x70')](_0xafab('0x71'))['from'](_0xafab('0x72'),'tq')[_0xafab('0x73')](_0xafab('0x74'),'ut',_0xafab('0x75'))[_0xafab('0x43')](_0xafab('0x76'),_0x5c8cbc[_0xafab('0x4d')]['id']);for(var _0xc8ee0a=0x0;_0xc8ee0a<_0x36be93[_0xafab('0x3c')];_0xc8ee0a+=0x1){let _0xca1d85=_0x36be93[_0xc8ee0a];for(var _0x5c8bf9=0x0;_0x5c8bf9<_0xca1d85[_0xafab('0x6a')]['length'];_0x5c8bf9+=0x1){let _0x2c59af=_0xca1d85[_0xafab('0x6a')][_0x5c8bf9];var _0x303dae=_0x171703[_0xafab('0x77')]();_0x303dae[_0xafab('0x43')](_0xafab('0x78'),_0x2c59af['id']);_0x1229c4[_0xafab('0x79')](db['sequelize'][_0xafab('0x36')](_0x303dae[_0xafab('0x7a')](),{'type':db[_0xafab('0x6b')][_0xafab('0x7b')]['SELECT']})[_0xafab('0x28')](function(_0x136368){if(_0x136368[_0xafab('0x3c')]===0x1){return _0x2c59af['id'];}else{var _0x3a28ae=_['every'](_['map'](_0x136368,_0xafab('0x7c')),function(_0x2df082){return _[_0xafab('0x7d')](_0x320770,_0x2df082);});if(_0x3a28ae){return _0x2c59af['id'];}}}));}}return BPromise[_0xafab('0x7e')](_0x1229c4)[_0xafab('0x28')](function(_0x43671b){_0x2f150e=_(_0x2f150e)['union'](_0x43671b)['compact']()[_0xafab('0x7f')]();return db[_0xafab('0x32')][_0xafab('0x4f')]({'where':{'id':_0x5c8cbc[_0xafab('0x4d')]['id']}})[_0xafab('0x28')](function(_0x4ec4ca){return db[_0xafab('0x6b')]['transaction'](function(_0x5b6f2e){return _0x4ec4ca[_0xafab('0x6e')](_0x5c8cbc[_0xafab('0x36')][_0xafab('0x66')],{'transaction':_0x5b6f2e})['then'](function(){if(!_['isEmpty'](_0x2f150e)){return _0x4ec4ca[_0xafab('0x80')](_0x2f150e,{'transaction':_0x5b6f2e});}})[_0xafab('0x28')](function(){_0x2f150e[_0xafab('0x81')](function(_0x14e5a1){socket['emit']('userOpenchannelQueue:remove',{'UserId':_0x14e5a1,'OpenchannelQueueId':_0x4ec4ca['id']});});});});});});})[_0xafab('0x28')](respondWithStatusCode(_0x4154ed,null))['catch'](handleError(_0x4154ed,null));};exports['addAgents']=function(_0x123216,_0x28bc03,_0x2d07c4){return db[_0xafab('0x32')][_0xafab('0x4f')]({'where':{'id':_0x123216[_0xafab('0x4d')]['id']}})['then'](handleEntityNotFound(_0x28bc03,null))[_0xafab('0x28')](function(_0x534c68){if(_0x534c68){return _0x534c68[_0xafab('0x82')](_0x123216[_0xafab('0x51')][_0xafab('0x66')],_['omit'](_0x123216['body'],[_0xafab('0x66'),'id'])||{})[_0xafab('0x83')](function(_0x43cef3){for(var _0x1da641=0x0;_0x1da641<_0x123216[_0xafab('0x51')][_0xafab('0x66')][_0xafab('0x3c')];_0x1da641+=0x1){socket[_0xafab('0x84')]('userOpenchannelQueue:save',{'UserId':Number(_0x123216['body']['ids'][_0x1da641]),'OpenchannelQueueId':Number(_0x123216[_0xafab('0x4d')]['id'])});}return _0x43cef3;});}})[_0xafab('0x28')](respondWithResult(_0x28bc03,null))[_0xafab('0x4b')](handleError(_0x28bc03,null));};exports[_0xafab('0x80')]=function(_0x50d282,_0x3321c0,_0x1fc5bb){return db[_0xafab('0x32')][_0xafab('0x4f')]({'where':{'id':_0x50d282[_0xafab('0x4d')]['id']}})[_0xafab('0x28')](handleEntityNotFound(_0x3321c0,null))[_0xafab('0x28')](function(_0x4946bf){if(_0x4946bf){return _0x4946bf[_0xafab('0x80')](_0x50d282[_0xafab('0x36')][_0xafab('0x66')])['then'](function(){if(_[_0xafab('0x85')](_0x50d282[_0xafab('0x36')][_0xafab('0x66')])){for(var _0x5bf4d4=0x0;_0x5bf4d4<_0x50d282[_0xafab('0x36')][_0xafab('0x66')][_0xafab('0x3c')];_0x5bf4d4+=0x1){socket[_0xafab('0x84')]('userOpenchannelQueue:remove',{'UserId':Number(_0x50d282[_0xafab('0x36')][_0xafab('0x66')][_0x5bf4d4]),'OpenchannelQueueId':Number(_0x50d282[_0xafab('0x4d')]['id'])});}}else{socket[_0xafab('0x84')]('userOpenchannelQueue:remove',{'UserId':Number(_0x50d282[_0xafab('0x36')]['ids']),'OpenchannelQueueId':Number(_0x50d282[_0xafab('0x4d')]['id'])});}});}})[_0xafab('0x28')](respondWithStatusCode(_0x3321c0,null))[_0xafab('0x4b')](handleError(_0x3321c0,null));};exports[_0xafab('0x86')]=function(_0x9a8b94,_0xeec8fa,_0x5440e7){var _0x312407={};var _0x268ac4={};var _0x391008;var _0x392850;return db[_0xafab('0x32')][_0xafab('0x59')]({'where':{'id':_0x9a8b94[_0xafab('0x4d')]['id']}})[_0xafab('0x28')](handleEntityNotFound(_0xeec8fa,null))[_0xafab('0x28')](function(_0x3ef211){if(_0x3ef211){_0x391008=_0x3ef211;_0x268ac4['model']=_[_0xafab('0x37')](db[_0xafab('0x5c')]['rawAttributes']);_0x268ac4['query']=_['keys'](_0x9a8b94[_0xafab('0x36')]);_0x268ac4[_0xafab('0x38')]=_[_0xafab('0x39')](_0x268ac4[_0xafab('0x35')],_0x268ac4[_0xafab('0x36')]);_0x312407[_0xafab('0x3a')]=_['intersection'](_0x268ac4[_0xafab('0x35')],qs[_0xafab('0x3b')](_0x9a8b94[_0xafab('0x36')][_0xafab('0x3b')]));_0x312407[_0xafab('0x3a')]=_0x312407[_0xafab('0x3a')][_0xafab('0x3c')]?_0x312407['attributes']:_0x268ac4[_0xafab('0x35')];_0x312407[_0xafab('0x3f')]=qs[_0xafab('0x40')](_0x9a8b94[_0xafab('0x36')][_0xafab('0x40')]);_0x312407[_0xafab('0x43')]=qs['filters'](_[_0xafab('0x41')](_0x9a8b94[_0xafab('0x36')],_0x268ac4[_0xafab('0x38')]));if(_0x9a8b94[_0xafab('0x36')][_0xafab('0x42')]){_0x312407[_0xafab('0x43')]=_[_0xafab('0x44')](_0x312407[_0xafab('0x43')],{'$or':_[_0xafab('0x31')](_0x312407[_0xafab('0x3a')],function(_0x310cc1){var _0x11c0c9={};_0x11c0c9[_0x310cc1]={'$like':'%'+_0x9a8b94[_0xafab('0x36')][_0xafab('0x42')]+'%'};return _0x11c0c9;})});}_0x312407=_['merge']({},_0x312407,_0x9a8b94[_0xafab('0x4e')]);return _0x391008[_0xafab('0x86')](_0x312407);}})[_0xafab('0x28')](function(_0x4f8378){if(_0x4f8378){_0x392850=_0x4f8378[_0xafab('0x3c')];if(!_0x9a8b94[_0xafab('0x36')][_0xafab('0x3d')](_0xafab('0x3e'))){_0x312407[_0xafab('0x20')]=qs['limit'](_0x9a8b94[_0xafab('0x36')][_0xafab('0x20')]);_0x312407[_0xafab('0x1e')]=qs[_0xafab('0x1e')](_0x9a8b94['query']['offset']);}return _0x391008[_0xafab('0x86')](_0x312407);}})['then'](function(_0x60b2b){if(_0x60b2b){return _0x60b2b?{'count':_0x392850,'rows':_0x60b2b}:null;}})['then'](respondWithResult(_0xeec8fa,null))[_0xafab('0x4b')](handleError(_0xeec8fa,null));}; \ No newline at end of file +var _0xa8ec=['clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','removeTeams','forEach','addAgents','omit','spread','removeAgents','userOpenchannelQueue:remove','getAgents','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','OpenchannelQueue','rawAttributes','fieldName','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','include','findAll','rows','show','params','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','OpenchannelQueues','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','nolimit','OpenchannelQueueId','UserOpenchannelQueue','User','findAndCountAll','openchannelPause','updatedAt','format','createdAt','getTeams','Team','options','addTeams','Agents','online','voicePause','interface','transaction','each','emit','ids','select','field','from','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?'];(function(_0x373202,_0x1a1fd4){var _0x5e90ab=function(_0x20da9b){while(--_0x20da9b){_0x373202['push'](_0x373202['shift']());}};_0x5e90ab(++_0x1a1fd4);}(_0xa8ec,0x12d));var _0xca8e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa8ec[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xca8e('0x0'));var rimraf=require(_0xca8e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xca8e('0x2'));var rp=require(_0xca8e('0x3'));var moment=require(_0xca8e('0x4'));var BPromise=require(_0xca8e('0x5'));var Mustache=require(_0xca8e('0x6'));var util=require('util');var path=require(_0xca8e('0x7'));var sox=require(_0xca8e('0x8'));var csv=require(_0xca8e('0x9'));var ejs=require(_0xca8e('0xa'));var fs=require('fs');var fs_extra=require(_0xca8e('0xb'));var _=require(_0xca8e('0xc'));var squel=require(_0xca8e('0xd'));var crypto=require(_0xca8e('0xe'));var jsforce=require(_0xca8e('0xf'));var deskjs=require(_0xca8e('0x10'));var toCsv=require(_0xca8e('0x9'));var querystring=require(_0xca8e('0x11'));var Papa=require(_0xca8e('0x12'));var Redis=require(_0xca8e('0x13'));var authService=require(_0xca8e('0x14'));var qs=require(_0xca8e('0x15'));var as=require(_0xca8e('0x16'));var hardwareService=require(_0xca8e('0x17'));var logger=require(_0xca8e('0x18'))('api');var utils=require(_0xca8e('0x19'));var config=require(_0xca8e('0x1a'));var licenseUtil=require(_0xca8e('0x1b'));var db=require(_0xca8e('0x1c'))['db'];config['redis']=_[_0xca8e('0x1d')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xca8e('0x1e'))(new Redis(config[_0xca8e('0x1f')]));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x1ee738,_0x10a886){_0x10a886=_0x10a886||0xcc;return function(_0xfd1313){if(_0xfd1313){return _0x1ee738['sendStatus'](_0x10a886);}return _0x1ee738[_0xca8e('0x20')](_0x10a886)[_0xca8e('0x21')]();};}function respondWithResult(_0x23bb0f,_0x5d6342){_0x5d6342=_0x5d6342||0xc8;return function(_0x5d62e4){if(_0x5d62e4){return _0x23bb0f['status'](_0x5d6342)[_0xca8e('0x22')](_0x5d62e4);}};}function respondWithFilteredResult(_0x305a58,_0x4525e6){return function(_0xd8f7b7){if(_0xd8f7b7){var _0x3f6c12=typeof _0x4525e6[_0xca8e('0x23')]===_0xca8e('0x24')&&typeof _0x4525e6[_0xca8e('0x25')]===_0xca8e('0x24');var _0x133ce7=_0xd8f7b7[_0xca8e('0x26')];var _0xa3bcfd=_0x3f6c12?0x0:_0x4525e6['offset'];var _0x4fe646=_0x3f6c12?_0xd8f7b7[_0xca8e('0x26')]:_0x4525e6['offset']+_0x4525e6[_0xca8e('0x25')];var _0x16ddf8;if(_0x4fe646>=_0x133ce7){_0x4fe646=_0x133ce7;_0x16ddf8=0xc8;}else{_0x16ddf8=0xce;}_0x305a58[_0xca8e('0x20')](_0x16ddf8);return _0x305a58[_0xca8e('0x27')](_0xca8e('0x28'),_0xa3bcfd+'-'+_0x4fe646+'/'+_0x133ce7)[_0xca8e('0x22')](_0xd8f7b7);}return null;};}function patchUpdates(_0x1c8be7){return function(_0x10cb56){try{jsonpatch[_0xca8e('0x29')](_0x10cb56,_0x1c8be7,!![]);}catch(_0x2a8569){return BPromise[_0xca8e('0x2a')](_0x2a8569);}return _0x10cb56[_0xca8e('0x2b')]();};}function saveUpdates(_0x465bf8,_0x73209a){return function(_0x33a380){if(_0x33a380){return _0x33a380[_0xca8e('0x2c')](_0x465bf8)[_0xca8e('0x2d')](function(_0x5aabed){return _0x5aabed;});}return null;};}function removeEntity(_0x53dcdc,_0x2af502){return function(_0x56c64d){if(_0x56c64d){return _0x56c64d[_0xca8e('0x2e')]()['then'](function(){var _0x2256ae=_0x56c64d['get']({'plain':!![]});var _0xfbee90='OpenchannelQueues';return db['UserProfileResource'][_0xca8e('0x2e')]({'where':{'type':_0xfbee90,'resourceId':_0x2256ae['id']}})[_0xca8e('0x2d')](function(){return _0x56c64d;});})[_0xca8e('0x2d')](function(){_0x53dcdc[_0xca8e('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x466b10,_0x5d8e80){return function(_0x3b5dc6){if(!_0x3b5dc6){_0x466b10[_0xca8e('0x2f')](0x194);}return _0x3b5dc6;};}function handleError(_0x1be1c9,_0x5c860b){_0x5c860b=_0x5c860b||0x1f4;return function(_0x15f1c7){logger[_0xca8e('0x30')](_0x15f1c7[_0xca8e('0x31')]);if(_0x15f1c7[_0xca8e('0x32')]){delete _0x15f1c7[_0xca8e('0x32')];}_0x1be1c9[_0xca8e('0x20')](_0x5c860b)[_0xca8e('0x33')](_0x15f1c7);};}exports[_0xca8e('0x34')]=function(_0x291456,_0x58de01){var _0x3a5dac={},_0x1918f4={},_0x348f50={'count':0x0,'rows':[]};var _0x45d8f3=_['map'](db[_0xca8e('0x35')][_0xca8e('0x36')],function(_0x4060b7){return{'name':_0x4060b7[_0xca8e('0x37')],'type':_0x4060b7['type'][_0xca8e('0x38')]};});_0x1918f4[_0xca8e('0x39')]=_['map'](_0x45d8f3,_0xca8e('0x32'));_0x1918f4['query']=_[_0xca8e('0x3a')](_0x291456['query']);_0x1918f4[_0xca8e('0x3b')]=_[_0xca8e('0x3c')](_0x1918f4['model'],_0x1918f4[_0xca8e('0x3d')]);_0x3a5dac['attributes']=_[_0xca8e('0x3c')](_0x1918f4[_0xca8e('0x39')],qs[_0xca8e('0x3e')](_0x291456[_0xca8e('0x3d')]['fields']));_0x3a5dac[_0xca8e('0x3f')]=_0x3a5dac[_0xca8e('0x3f')][_0xca8e('0x40')]?_0x3a5dac['attributes']:_0x1918f4[_0xca8e('0x39')];if(!_0x291456[_0xca8e('0x3d')][_0xca8e('0x41')]('nolimit')){_0x3a5dac[_0xca8e('0x25')]=qs[_0xca8e('0x25')](_0x291456[_0xca8e('0x3d')]['limit']);_0x3a5dac['offset']=qs[_0xca8e('0x23')](_0x291456['query'][_0xca8e('0x23')]);}_0x3a5dac[_0xca8e('0x42')]=qs[_0xca8e('0x43')](_0x291456['query'][_0xca8e('0x43')]);_0x3a5dac[_0xca8e('0x44')]=qs[_0xca8e('0x3b')](_[_0xca8e('0x45')](_0x291456[_0xca8e('0x3d')],_0x1918f4[_0xca8e('0x3b')]),_0x45d8f3);if(_0x291456['query'][_0xca8e('0x46')]){_0x3a5dac[_0xca8e('0x44')]=_[_0xca8e('0x47')](_0x3a5dac[_0xca8e('0x44')],{'$or':_[_0xca8e('0x48')](_0x45d8f3,function(_0x2a6301){if(_0x2a6301['type']!==_0xca8e('0x49')){var _0x2c66dd={};_0x2c66dd[_0x2a6301[_0xca8e('0x32')]]={'$like':'%'+_0x291456[_0xca8e('0x3d')][_0xca8e('0x46')]+'%'};return _0x2c66dd;}})});}_0x3a5dac=_['merge']({},_0x3a5dac,_0x291456['options']);var _0x270001={'where':_0x3a5dac['where']};return db[_0xca8e('0x35')]['count'](_0x270001)[_0xca8e('0x2d')](function(_0x1cf697){_0x348f50[_0xca8e('0x26')]=_0x1cf697;if(_0x291456[_0xca8e('0x3d')]['includeAll']){_0x3a5dac[_0xca8e('0x4a')]=[{'all':!![]}];}return db[_0xca8e('0x35')][_0xca8e('0x4b')](_0x3a5dac);})[_0xca8e('0x2d')](function(_0x13697d){_0x348f50[_0xca8e('0x4c')]=_0x13697d;return _0x348f50;})[_0xca8e('0x2d')](respondWithFilteredResult(_0x58de01,_0x3a5dac))['catch'](handleError(_0x58de01,null));};exports[_0xca8e('0x4d')]=function(_0x2eb4e6,_0x2323c0){var _0x397b18={'raw':!![],'where':{'id':_0x2eb4e6[_0xca8e('0x4e')]['id']}},_0x4d2282={};_0x4d2282['model']=_[_0xca8e('0x3a')](db[_0xca8e('0x35')][_0xca8e('0x36')]);_0x4d2282[_0xca8e('0x3d')]=_['keys'](_0x2eb4e6[_0xca8e('0x3d')]);_0x4d2282[_0xca8e('0x3b')]=_[_0xca8e('0x3c')](_0x4d2282['model'],_0x4d2282[_0xca8e('0x3d')]);_0x397b18[_0xca8e('0x3f')]=_[_0xca8e('0x3c')](_0x4d2282['model'],qs['fields'](_0x2eb4e6[_0xca8e('0x3d')][_0xca8e('0x3e')]));_0x397b18[_0xca8e('0x3f')]=_0x397b18[_0xca8e('0x3f')][_0xca8e('0x40')]?_0x397b18[_0xca8e('0x3f')]:_0x4d2282[_0xca8e('0x39')];if(_0x2eb4e6[_0xca8e('0x3d')]['includeAll']){_0x397b18[_0xca8e('0x4a')]=[{'all':!![]}];}_0x397b18=_['merge']({},_0x397b18,_0x2eb4e6['options']);return db[_0xca8e('0x35')]['find'](_0x397b18)['then'](handleEntityNotFound(_0x2323c0,null))[_0xca8e('0x2d')](respondWithResult(_0x2323c0,null))[_0xca8e('0x4f')](handleError(_0x2323c0,null));};exports[_0xca8e('0x50')]=function(_0x521522,_0x4d62a){return db[_0xca8e('0x35')][_0xca8e('0x50')](_0x521522[_0xca8e('0x51')],{})['then'](function(_0x3992ed){var _0x21ad23=_0x521522[_0xca8e('0x52')][_0xca8e('0x53')]({'plain':!![]});if(!_0x21ad23)throw new Error(_0xca8e('0x54'));if(_0x21ad23['role']===_0xca8e('0x52')){var _0x2123bc=_0x3992ed[_0xca8e('0x53')]({'plain':!![]});var _0x3d8902=_0xca8e('0x55');return db['UserProfileSection'][_0xca8e('0x56')]({'where':{'name':_0x3d8902,'userProfileId':_0x21ad23[_0xca8e('0x57')]},'raw':!![]})['then'](function(_0x3c119c){if(_0x3c119c&&_0x3c119c[_0xca8e('0x58')]===0x0){return db['UserProfileResource'][_0xca8e('0x50')]({'name':_0x2123bc['name'],'resourceId':_0x2123bc['id'],'type':_0x3c119c[_0xca8e('0x32')],'sectionId':_0x3c119c['id']},{})[_0xca8e('0x2d')](function(){return _0x3992ed;});}else{return _0x3992ed;}})[_0xca8e('0x4f')](function(_0x1658ba){logger[_0xca8e('0x30')](_0xca8e('0x59'),_0x1658ba);throw _0x1658ba;});}return _0x3992ed;})['then'](respondWithResult(_0x4d62a,0xc9))[_0xca8e('0x4f')](handleError(_0x4d62a,null));};exports[_0xca8e('0x2c')]=function(_0x50acb5,_0x2a76c9){if(_0x50acb5['body']['id']){delete _0x50acb5[_0xca8e('0x51')]['id'];}return db[_0xca8e('0x35')]['find']({'where':{'id':_0x50acb5[_0xca8e('0x4e')]['id']}})[_0xca8e('0x2d')](handleEntityNotFound(_0x2a76c9,null))[_0xca8e('0x2d')](saveUpdates(_0x50acb5['body'],null))[_0xca8e('0x2d')](respondWithResult(_0x2a76c9,null))['catch'](handleError(_0x2a76c9,null));};exports['destroy']=function(_0x1f5b27,_0xa08910){return db[_0xca8e('0x35')][_0xca8e('0x56')]({'where':{'id':_0x1f5b27['params']['id']}})[_0xca8e('0x2d')](handleEntityNotFound(_0xa08910,null))[_0xca8e('0x2d')](removeEntity(_0xa08910,null))[_0xca8e('0x4f')](handleError(_0xa08910,null));};exports[_0xca8e('0x5a')]=function(_0x22f655,_0x12027c){return db['OpenchannelQueue'][_0xca8e('0x5a')]()[_0xca8e('0x2d')](respondWithResult(_0x12027c,null))[_0xca8e('0x4f')](handleError(_0x12027c,null));};exports[_0xca8e('0x5b')]=function(_0x21a8d3,_0x3b3f47,_0x530c6b){var _0x33f7a1={'raw':!![],'where':{}},_0x927be1={},_0x366610;return db[_0xca8e('0x35')][_0xca8e('0x5c')]({'where':{'id':_0x21a8d3[_0xca8e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3b3f47,null))[_0xca8e('0x2d')](function(_0x57b017){if(_0x57b017){_0x366610=_0x57b017[_0xca8e('0x53')]({'plain':!![]});_0x927be1[_0xca8e('0x39')]=_[_0xca8e('0x3a')](db['UserOpenchannelQueue'][_0xca8e('0x36')]);_0x927be1['query']=_[_0xca8e('0x3a')](_0x21a8d3[_0xca8e('0x3d')]);_0x927be1[_0xca8e('0x3b')]=_[_0xca8e('0x3c')](_0x927be1[_0xca8e('0x39')],_0x927be1[_0xca8e('0x3d')]);_0x33f7a1[_0xca8e('0x3f')]=_['intersection'](_0x927be1[_0xca8e('0x39')],qs[_0xca8e('0x3e')](_0x21a8d3[_0xca8e('0x3d')][_0xca8e('0x3e')]));_0x33f7a1[_0xca8e('0x3f')]=_0x33f7a1[_0xca8e('0x3f')][_0xca8e('0x40')]?_0x33f7a1['attributes']:_0x927be1[_0xca8e('0x39')];if(!_0x21a8d3[_0xca8e('0x3d')]['hasOwnProperty'](_0xca8e('0x5d'))){_0x33f7a1[_0xca8e('0x25')]=qs[_0xca8e('0x25')](_0x21a8d3[_0xca8e('0x3d')][_0xca8e('0x25')]);_0x33f7a1[_0xca8e('0x23')]=qs[_0xca8e('0x23')](_0x21a8d3[_0xca8e('0x3d')]['offset']);}_0x33f7a1[_0xca8e('0x42')]=qs[_0xca8e('0x43')](_0x21a8d3[_0xca8e('0x3d')]['sort']);_0x33f7a1[_0xca8e('0x44')]=qs['filters'](_['pick'](_0x21a8d3[_0xca8e('0x3d')],_0x927be1[_0xca8e('0x3b')]));_0x33f7a1['where'][_0xca8e('0x5e')]=_0x57b017['id'];if(_0x21a8d3[_0xca8e('0x3d')][_0xca8e('0x46')]){_0x33f7a1[_0xca8e('0x44')]=_[_0xca8e('0x47')](_0x33f7a1['where'],{'$or':_[_0xca8e('0x48')](_0x33f7a1[_0xca8e('0x3f')],function(_0x4bea92){var _0x5559f2={};_0x5559f2[_0x4bea92]={'$like':'%'+_0x21a8d3[_0xca8e('0x3d')]['filter']+'%'};return _0x5559f2;})});}_0x33f7a1=_['merge']({},_0x33f7a1,_0x21a8d3['options']);return db[_0xca8e('0x5f')][_0xca8e('0x4b')](_0x33f7a1);}})[_0xca8e('0x2d')](function(_0x1ff5e6){if(_0x1ff5e6){return db[_0xca8e('0x60')][_0xca8e('0x61')]({'where':{'id':_['map'](_0x1ff5e6,'UserId'),'role':'agent'},'attributes':['id',_0xca8e('0x32'),_0xca8e('0x62'),_0xca8e('0x63'),'createdAt']});}})['then'](function(_0x48ca89){if(_0x48ca89){return{'count':_0x48ca89[_0xca8e('0x26')],'rows':_[_0xca8e('0x48')](_0x48ca89[_0xca8e('0x4c')],function(_0x39d7d1){return{'membername':_0x39d7d1[_0xca8e('0x32')],'UserId':_0x39d7d1['id'],'queue_name':_0x366610[_0xca8e('0x32')],'OpenchannelQueueId':_0x366610['id'],'interface':util[_0xca8e('0x64')]('%s/%s','SIP',_0x39d7d1[_0xca8e('0x32')]),'penalty':0x0,'paused':_0x39d7d1[_0xca8e('0x62')],'createdAt':_0x39d7d1[_0xca8e('0x65')],'updatedAt':_0x39d7d1[_0xca8e('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xca8e('0x2d')](respondWithFilteredResult(_0x3b3f47,_0x33f7a1))[_0xca8e('0x4f')](handleError(_0x3b3f47,null));};exports[_0xca8e('0x66')]=function(_0x463356,_0xe028b4,_0x6dab85){var _0x17b97d={};var _0x451bf9={};var _0x57f594;var _0x11c864;return db['OpenchannelQueue'][_0xca8e('0x5c')]({'where':{'id':_0x463356[_0xca8e('0x4e')]['id']}})[_0xca8e('0x2d')](handleEntityNotFound(_0xe028b4,null))['then'](function(_0x37a8a3){if(_0x37a8a3){_0x57f594=_0x37a8a3;_0x451bf9['model']=_['keys'](db[_0xca8e('0x67')][_0xca8e('0x36')]);_0x451bf9[_0xca8e('0x3d')]=_[_0xca8e('0x3a')](_0x463356['query']);_0x451bf9['filters']=_[_0xca8e('0x3c')](_0x451bf9[_0xca8e('0x39')],_0x451bf9[_0xca8e('0x3d')]);_0x17b97d['attributes']=_['intersection'](_0x451bf9[_0xca8e('0x39')],qs[_0xca8e('0x3e')](_0x463356[_0xca8e('0x3d')][_0xca8e('0x3e')]));_0x17b97d['attributes']=_0x17b97d[_0xca8e('0x3f')][_0xca8e('0x40')]?_0x17b97d[_0xca8e('0x3f')]:_0x451bf9[_0xca8e('0x39')];_0x17b97d[_0xca8e('0x42')]=qs['sort'](_0x463356[_0xca8e('0x3d')][_0xca8e('0x43')]);_0x17b97d['where']=qs[_0xca8e('0x3b')](_[_0xca8e('0x45')](_0x463356[_0xca8e('0x3d')],_0x451bf9[_0xca8e('0x3b')]));if(_0x463356['query']['filter']){_0x17b97d[_0xca8e('0x44')]=_[_0xca8e('0x47')](_0x17b97d[_0xca8e('0x44')],{'$or':_[_0xca8e('0x48')](_0x17b97d[_0xca8e('0x3f')],function(_0x5c43d4){var _0x953f00={};_0x953f00[_0x5c43d4]={'$like':'%'+_0x463356[_0xca8e('0x3d')][_0xca8e('0x46')]+'%'};return _0x953f00;})});}_0x17b97d=_[_0xca8e('0x47')]({},_0x17b97d,_0x463356[_0xca8e('0x68')]);return _0x57f594[_0xca8e('0x66')](_0x17b97d);}})[_0xca8e('0x2d')](function(_0x7604c2){if(_0x7604c2){_0x11c864=_0x7604c2[_0xca8e('0x40')];if(!_0x463356[_0xca8e('0x3d')][_0xca8e('0x41')]('nolimit')){_0x17b97d[_0xca8e('0x25')]=qs[_0xca8e('0x25')](_0x463356[_0xca8e('0x3d')][_0xca8e('0x25')]);_0x17b97d['offset']=qs[_0xca8e('0x23')](_0x463356[_0xca8e('0x3d')]['offset']);}return _0x57f594['getTeams'](_0x17b97d);}})[_0xca8e('0x2d')](function(_0x12e3cf){if(_0x12e3cf){return _0x12e3cf?{'count':_0x11c864,'rows':_0x12e3cf}:null;}})['then'](respondWithResult(_0xe028b4,null))[_0xca8e('0x4f')](handleError(_0xe028b4,null));};exports[_0xca8e('0x69')]=function(_0x45bb23,_0x26d27e,_0x54d4bf){var _0x13cd4b=_0x45bb23[_0xca8e('0x51')]['ids'];return db[_0xca8e('0x67')]['findAll']({'where':{'id':_0x13cd4b},'attributes':['id'],'include':[{'model':db[_0xca8e('0x60')],'as':_0xca8e('0x6a'),'attributes':['id',_0xca8e('0x32'),_0xca8e('0x6b'),_0xca8e('0x6c'),_0xca8e('0x6d')],'raw':!![]}]})[_0xca8e('0x2d')](function(_0x53ce4e){if(_0x53ce4e){var _0x5d4942=_['flatMap'](_0x53ce4e,function(_0x57ec02){var _0x3b2c73=_0x57ec02[_0xca8e('0x53')]({'plain':!![]});return _0x3b2c73[_0xca8e('0x6a')];});return db[_0xca8e('0x35')][_0xca8e('0x56')]({'where':{'id':_0x45bb23['params']['id']}})[_0xca8e('0x2d')](function(_0x53630b){return db['sequelize'][_0xca8e('0x6e')](function(_0x494f33){return _0x53630b[_0xca8e('0x69')](_0x13cd4b,{'transaction':_0x494f33})[_0xca8e('0x2d')](function(){return BPromise[_0xca8e('0x6f')](_0x5d4942,function(_0x4df11c){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x4df11c['id'],'OpenchannelQueueId':_0x45bb23[_0xca8e('0x4e')]['id']},'transaction':_0x494f33});});})[_0xca8e('0x2d')](function(){_0x5d4942['forEach'](function(_0x19d755){socket[_0xca8e('0x70')]('userOpenchannelQueue:save',{'UserId':_0x19d755['id'],'OpenchannelQueueId':_0x53630b['id']});});});});});}})[_0xca8e('0x2d')](respondWithStatusCode(_0x26d27e,null))['catch'](handleError(_0x26d27e,null));};exports['removeTeams']=function(_0xcd055c,_0x10aecb,_0x22dcf9){return db[_0xca8e('0x67')][_0xca8e('0x4b')]({'where':{'id':_0xcd055c[_0xca8e('0x3d')][_0xca8e('0x71')]},'attributes':['id'],'include':[{'model':db[_0xca8e('0x60')],'as':_0xca8e('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x10aecb,null))[_0xca8e('0x2d')](function(_0x3597b){var _0x484175=_[_0xca8e('0x48')](_0x3597b,'id');var _0x3078a8=[];var _0x3d66d1=[];var _0x2654d9=squel[_0xca8e('0x72')]();_0x2654d9[_0xca8e('0x73')]('tq.TeamId')[_0xca8e('0x74')]('team_has_openchannel_queues','tq')['join']('user_has_teams','ut',_0xca8e('0x75'))[_0xca8e('0x44')](_0xca8e('0x76'),_0xcd055c[_0xca8e('0x4e')]['id']);for(var _0x334081=0x0;_0x334081<_0x3597b[_0xca8e('0x40')];_0x334081+=0x1){let _0x3e1dc4=_0x3597b[_0x334081];for(var _0x5d87c5=0x0;_0x5d87c5<_0x3e1dc4[_0xca8e('0x6a')][_0xca8e('0x40')];_0x5d87c5+=0x1){let _0x43c17b=_0x3e1dc4[_0xca8e('0x6a')][_0x5d87c5];var _0x16d940=_0x2654d9[_0xca8e('0x77')]();_0x16d940['where'](_0xca8e('0x78'),_0x43c17b['id']);_0x3d66d1[_0xca8e('0x79')](db[_0xca8e('0x7a')][_0xca8e('0x3d')](_0x16d940[_0xca8e('0x7b')](),{'type':db[_0xca8e('0x7a')][_0xca8e('0x7c')][_0xca8e('0x7d')]})[_0xca8e('0x2d')](function(_0x1b94f9){if(_0x1b94f9[_0xca8e('0x40')]===0x1){return _0x43c17b['id'];}else{var _0x34068b=_[_0xca8e('0x7e')](_[_0xca8e('0x48')](_0x1b94f9,_0xca8e('0x7f')),function(_0x1a1e04){return _[_0xca8e('0x80')](_0x484175,_0x1a1e04);});if(_0x34068b){return _0x43c17b['id'];}}}));}}return BPromise[_0xca8e('0x81')](_0x3d66d1)['then'](function(_0x5da710){_0x3078a8=_(_0x3078a8)['union'](_0x5da710)[_0xca8e('0x82')]()[_0xca8e('0x83')]();return db[_0xca8e('0x35')][_0xca8e('0x56')]({'where':{'id':_0xcd055c[_0xca8e('0x4e')]['id']}})[_0xca8e('0x2d')](function(_0x255733){return db[_0xca8e('0x7a')][_0xca8e('0x6e')](function(_0x59870a){return _0x255733[_0xca8e('0x84')](_0xcd055c[_0xca8e('0x3d')][_0xca8e('0x71')],{'transaction':_0x59870a})['then'](function(){if(!_['isEmpty'](_0x3078a8)){return _0x255733['removeAgents'](_0x3078a8,{'transaction':_0x59870a});}})[_0xca8e('0x2d')](function(){_0x3078a8[_0xca8e('0x85')](function(_0x3e2509){socket[_0xca8e('0x70')]('userOpenchannelQueue:remove',{'UserId':_0x3e2509,'OpenchannelQueueId':_0x255733['id']});});});});});});})[_0xca8e('0x2d')](respondWithStatusCode(_0x10aecb,null))[_0xca8e('0x4f')](handleError(_0x10aecb,null));};exports[_0xca8e('0x86')]=function(_0x212748,_0xcc50e8,_0x10fe49){return db[_0xca8e('0x35')][_0xca8e('0x56')]({'where':{'id':_0x212748[_0xca8e('0x4e')]['id']}})[_0xca8e('0x2d')](handleEntityNotFound(_0xcc50e8,null))['then'](function(_0x5be4f6){if(_0x5be4f6){return _0x5be4f6[_0xca8e('0x86')](_0x212748[_0xca8e('0x51')][_0xca8e('0x71')],_[_0xca8e('0x87')](_0x212748['body'],[_0xca8e('0x71'),'id'])||{})[_0xca8e('0x88')](function(_0x22ed4f){for(var _0x3a0b29=0x0;_0x3a0b29<_0x212748['body'][_0xca8e('0x71')][_0xca8e('0x40')];_0x3a0b29+=0x1){socket[_0xca8e('0x70')]('userOpenchannelQueue:save',{'UserId':Number(_0x212748[_0xca8e('0x51')]['ids'][_0x3a0b29]),'OpenchannelQueueId':Number(_0x212748[_0xca8e('0x4e')]['id'])});}return _0x22ed4f;});}})[_0xca8e('0x2d')](respondWithResult(_0xcc50e8,null))[_0xca8e('0x4f')](handleError(_0xcc50e8,null));};exports[_0xca8e('0x89')]=function(_0x2f048a,_0x1baa16,_0x4aab79){return db[_0xca8e('0x35')][_0xca8e('0x56')]({'where':{'id':_0x2f048a[_0xca8e('0x4e')]['id']}})[_0xca8e('0x2d')](handleEntityNotFound(_0x1baa16,null))[_0xca8e('0x2d')](function(_0x2b409f){if(_0x2b409f){return _0x2b409f['removeAgents'](_0x2f048a[_0xca8e('0x3d')]['ids'])[_0xca8e('0x2d')](function(){if(_['isArray'](_0x2f048a['query'][_0xca8e('0x71')])){for(var _0x31bebf=0x0;_0x31bebf<_0x2f048a['query']['ids']['length'];_0x31bebf+=0x1){socket[_0xca8e('0x70')](_0xca8e('0x8a'),{'UserId':Number(_0x2f048a[_0xca8e('0x3d')]['ids'][_0x31bebf]),'OpenchannelQueueId':Number(_0x2f048a[_0xca8e('0x4e')]['id'])});}}else{socket[_0xca8e('0x70')](_0xca8e('0x8a'),{'UserId':Number(_0x2f048a[_0xca8e('0x3d')][_0xca8e('0x71')]),'OpenchannelQueueId':Number(_0x2f048a[_0xca8e('0x4e')]['id'])});}});}})[_0xca8e('0x2d')](respondWithStatusCode(_0x1baa16,null))[_0xca8e('0x4f')](handleError(_0x1baa16,null));};exports[_0xca8e('0x8b')]=function(_0x42bbbf,_0x59432e,_0x213317){var _0x83da6={};var _0x5c895d={};var _0x2ab66c;var _0x370512;return db[_0xca8e('0x35')][_0xca8e('0x5c')]({'where':{'id':_0x42bbbf[_0xca8e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x59432e,null))[_0xca8e('0x2d')](function(_0x466df5){if(_0x466df5){_0x2ab66c=_0x466df5;_0x5c895d[_0xca8e('0x39')]=_[_0xca8e('0x3a')](db[_0xca8e('0x60')][_0xca8e('0x36')]);_0x5c895d[_0xca8e('0x3d')]=_[_0xca8e('0x3a')](_0x42bbbf[_0xca8e('0x3d')]);_0x5c895d[_0xca8e('0x3b')]=_[_0xca8e('0x3c')](_0x5c895d[_0xca8e('0x39')],_0x5c895d['query']);_0x83da6[_0xca8e('0x3f')]=_[_0xca8e('0x3c')](_0x5c895d['model'],qs['fields'](_0x42bbbf[_0xca8e('0x3d')]['fields']));_0x83da6[_0xca8e('0x3f')]=_0x83da6[_0xca8e('0x3f')]['length']?_0x83da6[_0xca8e('0x3f')]:_0x5c895d[_0xca8e('0x39')];_0x83da6['order']=qs[_0xca8e('0x43')](_0x42bbbf[_0xca8e('0x3d')][_0xca8e('0x43')]);_0x83da6['where']=qs[_0xca8e('0x3b')](_[_0xca8e('0x45')](_0x42bbbf['query'],_0x5c895d['filters']));if(_0x42bbbf[_0xca8e('0x3d')][_0xca8e('0x46')]){_0x83da6['where']=_['merge'](_0x83da6[_0xca8e('0x44')],{'$or':_[_0xca8e('0x48')](_0x83da6[_0xca8e('0x3f')],function(_0xaa9726){var _0x2915cf={};_0x2915cf[_0xaa9726]={'$like':'%'+_0x42bbbf[_0xca8e('0x3d')][_0xca8e('0x46')]+'%'};return _0x2915cf;})});}_0x83da6=_[_0xca8e('0x47')]({},_0x83da6,_0x42bbbf[_0xca8e('0x68')]);return _0x2ab66c[_0xca8e('0x8b')](_0x83da6);}})[_0xca8e('0x2d')](function(_0x252426){if(_0x252426){_0x370512=_0x252426[_0xca8e('0x40')];if(!_0x42bbbf[_0xca8e('0x3d')][_0xca8e('0x41')](_0xca8e('0x5d'))){_0x83da6[_0xca8e('0x25')]=qs[_0xca8e('0x25')](_0x42bbbf[_0xca8e('0x3d')][_0xca8e('0x25')]);_0x83da6[_0xca8e('0x23')]=qs[_0xca8e('0x23')](_0x42bbbf[_0xca8e('0x3d')][_0xca8e('0x23')]);}return _0x2ab66c[_0xca8e('0x8b')](_0x83da6);}})[_0xca8e('0x2d')](function(_0x208a22){if(_0x208a22){return _0x208a22?{'count':_0x370512,'rows':_0x208a22}:null;}})[_0xca8e('0x2d')](respondWithResult(_0x59432e,null))[_0xca8e('0x4f')](handleError(_0x59432e,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 439eead..388bab6 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 _0x76a3=['remove','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','update'];(function(_0x3733a3,_0x3acd23){var _0x3f7098=function(_0x42337c){while(--_0x42337c){_0x3733a3['push'](_0x3733a3['shift']());}};_0x3f7098(++_0x3acd23);}(_0x76a3,0x1ee));var _0x376a=function(_0x4704dc,_0x575a5f){_0x4704dc=_0x4704dc-0x0;var _0x254d81=_0x76a3[_0x4704dc];return _0x254d81;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x376a('0x0'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x376a('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x376a('0x2'),'afterDestroy':_0x376a('0x3')};function emitEvent(_0x439c51){return function(_0x1eec9d,_0x58b01f,_0x31b3a8){OpenchannelQueueEvents[_0x376a('0x4')](_0x439c51+':'+_0x1eec9d['id'],_0x1eec9d);OpenchannelQueueEvents[_0x376a('0x4')](_0x439c51,_0x1eec9d);_0x31b3a8(null);};}for(var e in events){if(events[_0x376a('0x5')](e)){var event=events[e];OpenchannelQueue[_0x376a('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x8068=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','emit'];(function(_0x157473,_0x461b43){var _0x46c842=function(_0x2087bc){while(--_0x2087bc){_0x157473['push'](_0x157473['shift']());}};_0x46c842(++_0x461b43);}(_0x8068,0x10b));var _0x8806=function(_0x4081a5,_0x27e9e2){_0x4081a5=_0x4081a5-0x0;var _0x59f5d9=_0x8068[_0x4081a5];return _0x59f5d9;};'use strict';var EventEmitter=require(_0x8806('0x0'));var OpenchannelQueue=require(_0x8806('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x8806('0x2')](0x0);var events={'afterCreate':_0x8806('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2184fb){return function(_0x227a1b,_0x1e3054,_0x5dfe88){OpenchannelQueueEvents['emit'](_0x2184fb+':'+_0x227a1b['id'],_0x227a1b);OpenchannelQueueEvents[_0x8806('0x4')](_0x2184fb,_0x227a1b);_0x5dfe88(null);};}for(var e in events){if(events[_0x8806('0x5')](e)){var event=events[e];OpenchannelQueue[_0x8806('0x6')](e,emitEvent(event));}}module[_0x8806('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index dd7b222..806df4b 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 _0x0d04=['exports','define','openchannel_queues','util','api','bluebird','request-promise','../../config/environment'];(function(_0x204f14,_0x578c11){var _0x29c79d=function(_0xed48a2){while(--_0xed48a2){_0x204f14['push'](_0x204f14['shift']());}};_0x29c79d(++_0x578c11);}(_0x0d04,0xa3));var _0x40d0=function(_0x1a023c,_0x39ada1){_0x1a023c=_0x1a023c-0x0;var _0x27e79d=_0x0d04[_0x1a023c];return _0x27e79d;};'use strict';var _=require('lodash');var util=require(_0x40d0('0x0'));var logger=require('../../config/logger')(_0x40d0('0x1'));var moment=require('moment');var BPromise=require(_0x40d0('0x2'));var rp=require(_0x40d0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x40d0('0x4'));var attributes=require('./openchannelQueue.attributes');module[_0x40d0('0x5')]=function(_0x334a6e,_0x82f0dd){return _0x334a6e[_0x40d0('0x6')]('OpenchannelQueue',attributes,{'tableName':_0x40d0('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x48a6=['util','api','moment','request-promise','path','./openchannelQueue.attributes','exports','define','openchannel_queues'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x48a6,0x17a));var _0x648a=function(_0x642029,_0xb900a){_0x642029=_0x642029-0x0;var _0x22596f=_0x48a6[_0x642029];return _0x22596f;};'use strict';var _=require('lodash');var util=require(_0x648a('0x0'));var logger=require('../../config/logger')(_0x648a('0x1'));var moment=require(_0x648a('0x2'));var BPromise=require('bluebird');var rp=require(_0x648a('0x3'));var fs=require('fs');var path=require(_0x648a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x648a('0x5'));module[_0x648a('0x6')]=function(_0x4a8f63,_0x1becdd){return _0x4a8f63[_0x648a('0x7')]('OpenchannelQueue',attributes,{'tableName':_0x648a('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 863f2d4..77b4e21 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 _0x49fb=['error','code','message','catch','OpenchannelQueue','findAll','options','raw','attributes','limit','include','map','model','GetOpenchannelQueue','stringify','ShowOpenchannelQueue','find','where','lodash','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0x257d80,_0x5559f2){var _0x1b28d9=function(_0x23069c){while(--_0x23069c){_0x257d80['push'](_0x257d80['shift']());}};_0x1b28d9(++_0x5559f2);}(_0x49fb,0x156));var _0xb49f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x49fb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb49f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb49f('0x1'));var fs=require('fs');var Redis=require(_0xb49f('0x2'));var db=require(_0xb49f('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb49f('0x4'));var config=require(_0xb49f('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb49f('0x6')]({'port':0x232a});config[_0xb49f('0x7')]=_[_0xb49f('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb49f('0x9'))(new Redis(config[_0xb49f('0x7')]));require('./openchannelQueue.socket')[_0xb49f('0xa')](socket);function respondWithRpcPromise(_0x5bd6a2,_0x1e7906,_0x38a29d){return new BPromise(function(_0x31627b,_0x546f4c){return client[_0xb49f('0xb')](_0x5bd6a2,_0x38a29d)[_0xb49f('0xc')](function(_0x339f27){logger[_0xb49f('0xd')](_0xb49f('0xe'),_0x1e7906,_0xb49f('0xf'));logger[_0xb49f('0x10')](_0xb49f('0x11'),_0x1e7906,_0xb49f('0xf'),JSON['stringify'](_0x339f27));if(_0x339f27[_0xb49f('0x12')]){if(_0x339f27[_0xb49f('0x12')][_0xb49f('0x13')]===0x1f4){logger[_0xb49f('0x12')](_0xb49f('0xe'),_0x1e7906,_0x339f27['error']['message']);return _0x546f4c(_0x339f27[_0xb49f('0x12')][_0xb49f('0x14')]);}logger[_0xb49f('0x12')](_0xb49f('0xe'),_0x1e7906,_0x339f27[_0xb49f('0x12')][_0xb49f('0x14')]);return _0x31627b(_0x339f27[_0xb49f('0x12')][_0xb49f('0x14')]);}else{logger[_0xb49f('0xd')]('OpenchannelQueue,\x20%s,\x20%s',_0x1e7906,'request\x20sent');_0x31627b(_0x339f27['result'][_0xb49f('0x14')]);}})[_0xb49f('0x15')](function(_0x462d46){logger[_0xb49f('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x1e7906,_0x462d46);_0x546f4c(_0x462d46);});});}exports['GetOpenchannelQueue']=function(_0x45e7cd){var _0x400e0f=this;return new Promise(function(_0x2b28b0,_0xbbc78f){return db[_0xb49f('0x16')][_0xb49f('0x17')]({'raw':_0x45e7cd[_0xb49f('0x18')]?_0x45e7cd[_0xb49f('0x18')][_0xb49f('0x19')]===undefined?!![]:![]:!![],'where':_0x45e7cd[_0xb49f('0x18')]?_0x45e7cd['options']['where']||null:null,'attributes':_0x45e7cd['options']?_0x45e7cd['options'][_0xb49f('0x1a')]||null:null,'limit':_0x45e7cd[_0xb49f('0x18')]?_0x45e7cd[_0xb49f('0x18')][_0xb49f('0x1b')]||null:null,'include':_0x45e7cd[_0xb49f('0x18')]?_0x45e7cd[_0xb49f('0x18')][_0xb49f('0x1c')]?_[_0xb49f('0x1d')](_0x45e7cd[_0xb49f('0x18')][_0xb49f('0x1c')],function(_0x10c91f){return{'model':db[_0x10c91f[_0xb49f('0x1e')]],'as':_0x10c91f['as'],'attributes':_0x10c91f[_0xb49f('0x1a')],'include':_0x10c91f[_0xb49f('0x1c')]?_[_0xb49f('0x1d')](_0x10c91f['include'],function(_0x4508b3){return{'model':db[_0x4508b3[_0xb49f('0x1e')]],'as':_0x4508b3['as'],'attributes':_0x4508b3[_0xb49f('0x1a')],'include':_0x4508b3[_0xb49f('0x1c')]?_[_0xb49f('0x1d')](_0x4508b3[_0xb49f('0x1c')],function(_0x2a96d9){return{'model':db[_0x2a96d9[_0xb49f('0x1e')]],'as':_0x2a96d9['as'],'attributes':_0x2a96d9['attributes']};}):[]};}):[]};}):[]:[]})[_0xb49f('0xc')](function(_0x476147){logger[_0xb49f('0xd')](_0xb49f('0x1f'),_0x45e7cd);logger[_0xb49f('0x10')](_0xb49f('0x1f'),_0x45e7cd,JSON[_0xb49f('0x20')](_0x476147));_0x2b28b0(_0x476147);})['catch'](function(_0x3f15fb){logger['error'](_0xb49f('0x1f'),_0x3f15fb[_0xb49f('0x14')],_0x45e7cd);_0xbbc78f(_0x400e0f[_0xb49f('0x12')](0x1f4,_0x3f15fb[_0xb49f('0x14')]));});});};exports[_0xb49f('0x21')]=function(_0x17a658){var _0x5009c7=this;return new Promise(function(_0x5865e8,_0x3aba5f){return db[_0xb49f('0x16')][_0xb49f('0x22')]({'raw':_0x17a658[_0xb49f('0x18')]?_0x17a658['options'][_0xb49f('0x19')]===undefined?!![]:![]:!![],'where':_0x17a658[_0xb49f('0x18')]?_0x17a658[_0xb49f('0x18')][_0xb49f('0x23')]||null:null,'attributes':_0x17a658[_0xb49f('0x18')]?_0x17a658[_0xb49f('0x18')][_0xb49f('0x1a')]||null:null,'include':_0x17a658[_0xb49f('0x18')]?_0x17a658['options'][_0xb49f('0x1c')]?_['map'](_0x17a658['options'][_0xb49f('0x1c')],function(_0x481687){return{'model':db[_0x481687[_0xb49f('0x1e')]],'as':_0x481687['as'],'attributes':_0x481687[_0xb49f('0x1a')],'include':_0x481687[_0xb49f('0x1c')]?_['map'](_0x481687[_0xb49f('0x1c')],function(_0x735fb6){return{'model':db[_0x735fb6[_0xb49f('0x1e')]],'as':_0x735fb6['as'],'attributes':_0x735fb6['attributes'],'include':_0x735fb6[_0xb49f('0x1c')]?_[_0xb49f('0x1d')](_0x735fb6['include'],function(_0x235d31){return{'model':db[_0x235d31[_0xb49f('0x1e')]],'as':_0x235d31['as'],'attributes':_0x235d31[_0xb49f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb49f('0xc')](function(_0xd7ab67){logger[_0xb49f('0xd')](_0xb49f('0x21'),_0x17a658);logger[_0xb49f('0x10')](_0xb49f('0x21'),_0x17a658,JSON[_0xb49f('0x20')](_0xd7ab67));_0x5865e8(_0xd7ab67);})['catch'](function(_0x42ea02){logger[_0xb49f('0x12')](_0xb49f('0x21'),_0x42ea02[_0xb49f('0x14')],_0x17a658);_0x3aba5f(_0x5009c7[_0xb49f('0x12')](0x1f4,_0x42ea02[_0xb49f('0x14')]));});});}; \ No newline at end of file +var _0x5454=['include','map','model','GetOpenchannelQueue','ShowOpenchannelQueue','find','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','./openchannelQueue.socket','register','request','then','info','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','OpenchannelQueue','findAll','options','raw','where','attributes','limit'];(function(_0x5b5ffe,_0xa8bf6e){var _0x4c2fb0=function(_0x48ca31){while(--_0x48ca31){_0x5b5ffe['push'](_0x5b5ffe['shift']());}};_0x4c2fb0(++_0xa8bf6e);}(_0x5454,0xaf));var _0x4545=function(_0x263a16,_0x1ec6e4){_0x263a16=_0x263a16-0x0;var _0x488e63=_0x5454[_0x263a16];return _0x488e63;};'use strict';var _=require(_0x4545('0x0'));var util=require(_0x4545('0x1'));var moment=require(_0x4545('0x2'));var BPromise=require(_0x4545('0x3'));var rs=require(_0x4545('0x4'));var fs=require('fs');var Redis=require(_0x4545('0x5'));var db=require(_0x4545('0x6'))['db'];var utils=require(_0x4545('0x7'));var logger=require(_0x4545('0x8'))('rpc');var config=require(_0x4545('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4545('0xa')]({'port':0x232a});config[_0x4545('0xb')]=_[_0x4545('0xc')](config[_0x4545('0xb')],{'host':_0x4545('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4545('0xb')]));require(_0x4545('0xe'))[_0x4545('0xf')](socket);function respondWithRpcPromise(_0x111eec,_0x1948dd,_0x11b286){return new BPromise(function(_0x4b3edc,_0x207966){return client[_0x4545('0x10')](_0x111eec,_0x11b286)[_0x4545('0x11')](function(_0x397e5e){logger[_0x4545('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x1948dd,_0x4545('0x13'));logger['debug'](_0x4545('0x14'),_0x1948dd,_0x4545('0x13'),JSON[_0x4545('0x15')](_0x397e5e));if(_0x397e5e['error']){if(_0x397e5e[_0x4545('0x16')][_0x4545('0x17')]===0x1f4){logger[_0x4545('0x16')](_0x4545('0x18'),_0x1948dd,_0x397e5e[_0x4545('0x16')][_0x4545('0x19')]);return _0x207966(_0x397e5e[_0x4545('0x16')][_0x4545('0x19')]);}logger[_0x4545('0x16')](_0x4545('0x18'),_0x1948dd,_0x397e5e[_0x4545('0x16')][_0x4545('0x19')]);return _0x4b3edc(_0x397e5e[_0x4545('0x16')]['message']);}else{logger[_0x4545('0x12')](_0x4545('0x18'),_0x1948dd,'request\x20sent');_0x4b3edc(_0x397e5e[_0x4545('0x1a')][_0x4545('0x19')]);}})[_0x4545('0x1b')](function(_0x1e1a06){logger['error'](_0x4545('0x18'),_0x1948dd,_0x1e1a06);_0x207966(_0x1e1a06);});});}exports['GetOpenchannelQueue']=function(_0x5d87d3){var _0xe64551=this;return new Promise(function(_0x560378,_0x91c36a){return db[_0x4545('0x1c')][_0x4545('0x1d')]({'raw':_0x5d87d3[_0x4545('0x1e')]?_0x5d87d3[_0x4545('0x1e')][_0x4545('0x1f')]===undefined?!![]:![]:!![],'where':_0x5d87d3[_0x4545('0x1e')]?_0x5d87d3[_0x4545('0x1e')][_0x4545('0x20')]||null:null,'attributes':_0x5d87d3[_0x4545('0x1e')]?_0x5d87d3[_0x4545('0x1e')][_0x4545('0x21')]||null:null,'limit':_0x5d87d3[_0x4545('0x1e')]?_0x5d87d3[_0x4545('0x1e')][_0x4545('0x22')]||null:null,'include':_0x5d87d3['options']?_0x5d87d3['options'][_0x4545('0x23')]?_['map'](_0x5d87d3[_0x4545('0x1e')]['include'],function(_0x28693e){return{'model':db[_0x28693e['model']],'as':_0x28693e['as'],'attributes':_0x28693e[_0x4545('0x21')],'include':_0x28693e[_0x4545('0x23')]?_[_0x4545('0x24')](_0x28693e[_0x4545('0x23')],function(_0x323b26){return{'model':db[_0x323b26[_0x4545('0x25')]],'as':_0x323b26['as'],'attributes':_0x323b26[_0x4545('0x21')],'include':_0x323b26[_0x4545('0x23')]?_[_0x4545('0x24')](_0x323b26['include'],function(_0x5d3769){return{'model':db[_0x5d3769[_0x4545('0x25')]],'as':_0x5d3769['as'],'attributes':_0x5d3769['attributes']};}):[]};}):[]};}):[]:[]})[_0x4545('0x11')](function(_0x2cedd2){logger[_0x4545('0x12')](_0x4545('0x26'),_0x5d87d3);logger['debug']('GetOpenchannelQueue',_0x5d87d3,JSON[_0x4545('0x15')](_0x2cedd2));_0x560378(_0x2cedd2);})['catch'](function(_0x1e22bb){logger[_0x4545('0x16')](_0x4545('0x26'),_0x1e22bb[_0x4545('0x19')],_0x5d87d3);_0x91c36a(_0xe64551[_0x4545('0x16')](0x1f4,_0x1e22bb[_0x4545('0x19')]));});});};exports[_0x4545('0x27')]=function(_0x4b362b){var _0x243516=this;return new Promise(function(_0x3b0e8a,_0x43d13f){return db[_0x4545('0x1c')][_0x4545('0x28')]({'raw':_0x4b362b['options']?_0x4b362b[_0x4545('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x4b362b[_0x4545('0x1e')]?_0x4b362b[_0x4545('0x1e')]['where']||null:null,'attributes':_0x4b362b[_0x4545('0x1e')]?_0x4b362b[_0x4545('0x1e')][_0x4545('0x21')]||null:null,'include':_0x4b362b[_0x4545('0x1e')]?_0x4b362b[_0x4545('0x1e')][_0x4545('0x23')]?_[_0x4545('0x24')](_0x4b362b[_0x4545('0x1e')][_0x4545('0x23')],function(_0x40d1ac){return{'model':db[_0x40d1ac[_0x4545('0x25')]],'as':_0x40d1ac['as'],'attributes':_0x40d1ac[_0x4545('0x21')],'include':_0x40d1ac[_0x4545('0x23')]?_[_0x4545('0x24')](_0x40d1ac[_0x4545('0x23')],function(_0x479ec8){return{'model':db[_0x479ec8[_0x4545('0x25')]],'as':_0x479ec8['as'],'attributes':_0x479ec8[_0x4545('0x21')],'include':_0x479ec8[_0x4545('0x23')]?_['map'](_0x479ec8['include'],function(_0xb335e5){return{'model':db[_0xb335e5['model']],'as':_0xb335e5['as'],'attributes':_0xb335e5[_0x4545('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2287b4){logger[_0x4545('0x12')]('ShowOpenchannelQueue',_0x4b362b);logger[_0x4545('0x29')](_0x4545('0x27'),_0x4b362b,JSON[_0x4545('0x15')](_0x2287b4));_0x3b0e8a(_0x2287b4);})['catch'](function(_0x39d461){logger['error'](_0x4545('0x27'),_0x39d461[_0x4545('0x19')],_0x4b362b);_0x43d13f(_0x243516[_0x4545('0x16')](0x1f4,_0x39d461[_0x4545('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 08a8dd0..fd7af36 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 _0x2e0e=['register','length','openchannelQueue:','./openchannelQueue.events','save','remove','update','emit','removeListener'];(function(_0x4dbfee,_0x307c01){var _0x23cf7d=function(_0x22d4e0){while(--_0x22d4e0){_0x4dbfee['push'](_0x4dbfee['shift']());}};_0x23cf7d(++_0x307c01);}(_0x2e0e,0xae));var _0xe2e0=function(_0x482e00,_0x18a1fd){_0x482e00=_0x482e00-0x0;var _0x5cbd91=_0x2e0e[_0x482e00];return _0x5cbd91;};'use strict';var OpenchannelQueueEvents=require(_0xe2e0('0x0'));var events=[_0xe2e0('0x1'),_0xe2e0('0x2'),_0xe2e0('0x3')];function createListener(_0xcefae,_0x2ac146){return function(_0x35be31){_0x2ac146[_0xe2e0('0x4')](_0xcefae,_0x35be31);};}function removeListener(_0x12aefe,_0x1058ee){return function(){OpenchannelQueueEvents[_0xe2e0('0x5')](_0x12aefe,_0x1058ee);};}exports[_0xe2e0('0x6')]=function(_0x5b46e8){for(var _0x1cee2c=0x0,_0xa51cd2=events[_0xe2e0('0x7')];_0x1cee2c<_0xa51cd2;_0x1cee2c++){var _0x42e8bd=events[_0x1cee2c];var _0x2f07fe=createListener(_0xe2e0('0x8')+_0x42e8bd,_0x5b46e8);OpenchannelQueueEvents['on'](_0x42e8bd,_0x2f07fe);}}; \ No newline at end of file +var _0x044a=['update','emit','removeListener','length','openchannelQueue:'];(function(_0x14ba97,_0x432fc9){var _0x375355=function(_0x520fc2){while(--_0x520fc2){_0x14ba97['push'](_0x14ba97['shift']());}};_0x375355(++_0x432fc9);}(_0x044a,0x1cc));var _0xa044=function(_0x4eb2a3,_0x5b8e7e){_0x4eb2a3=_0x4eb2a3-0x0;var _0x55c104=_0x044a[_0x4eb2a3];return _0x55c104;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save','remove',_0xa044('0x0')];function createListener(_0x1d2e0b,_0x15d8c4){return function(_0xc9a81f){_0x15d8c4[_0xa044('0x1')](_0x1d2e0b,_0xc9a81f);};}function removeListener(_0x371b10,_0x2abebd){return function(){OpenchannelQueueEvents[_0xa044('0x2')](_0x371b10,_0x2abebd);};}exports['register']=function(_0x2527fe){for(var _0x7893b4=0x0,_0x307a64=events[_0xa044('0x3')];_0x7893b4<_0x307a64;_0x7893b4++){var _0x3360cb=events[_0x7893b4];var _0x4f6e36=createListener(_0xa044('0x4')+_0x3360cb,_0x2527fe);OpenchannelQueueEvents['on'](_0x3360cb,_0x4f6e36);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 9f95a77..f05458c 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 _0xc3a2=['path','connect-timeout','express','Router','../../components/interaction/service','index','get','/describe','isAuthenticated','/:id','show','post','create','update','destroy','exports'];(function(_0x56edf6,_0x308401){var _0x73073f=function(_0x563680){while(--_0x563680){_0x56edf6['push'](_0x56edf6['shift']());}};_0x73073f(++_0x308401);}(_0xc3a2,0x170));var _0x2c3a=function(_0x2d69ea,_0x291645){_0x2d69ea=_0x2d69ea-0x0;var _0x41685c=_0xc3a2[_0x2d69ea];return _0x41685c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2c3a('0x0'));var timeout=require(_0x2c3a('0x1'));var express=require(_0x2c3a('0x2'));var router=express[_0x2c3a('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2c3a('0x4'));var config=require('../../config/environment');var controller=require('./openchannelQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x2c3a('0x5')]);router[_0x2c3a('0x6')](_0x2c3a('0x7'),auth[_0x2c3a('0x8')](),controller['describe']);router['get'](_0x2c3a('0x9'),auth[_0x2c3a('0x8')](),controller[_0x2c3a('0xa')]);router[_0x2c3a('0xb')]('/',auth[_0x2c3a('0x8')](),controller[_0x2c3a('0xc')]);router['put']('/:id',auth[_0x2c3a('0x8')](),controller[_0x2c3a('0xd')]);router['delete']('/:id',auth[_0x2c3a('0x8')](),controller[_0x2c3a('0xe')]);module[_0x2c3a('0xf')]=router; \ No newline at end of file +var _0x1e0d=['multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','post','create','/:id','update','destroy'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x1e0d,0x186));var _0xd1e0=function(_0x21e849,_0x1c6e03){_0x21e849=_0x21e849-0x0;var _0x28585d=_0x1e0d[_0x21e849];return _0x28585d;};'use strict';var multer=require(_0xd1e0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd1e0('0x1'));var express=require(_0xd1e0('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd1e0('0x3'));var interaction=require(_0xd1e0('0x4'));var config=require(_0xd1e0('0x5'));var controller=require('./openchannelQueueReport.controller');router[_0xd1e0('0x6')]('/',auth[_0xd1e0('0x7')](),controller['index']);router['get']('/describe',auth[_0xd1e0('0x7')](),controller['describe']);router['get']('/:id',auth[_0xd1e0('0x7')](),controller['show']);router[_0xd1e0('0x8')]('/',auth[_0xd1e0('0x7')](),controller[_0xd1e0('0x9')]);router['put'](_0xd1e0('0xa'),auth[_0xd1e0('0x7')](),controller[_0xd1e0('0xb')]);router['delete']('/:id',auth[_0xd1e0('0x7')](),controller[_0xd1e0('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 1fd9dae..6ee8130 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 _0x9fd8=['exports','STRING','DATE','sequelize'];(function(_0x279bfb,_0x46595b){var _0x4c74cd=function(_0x4f2b4f){while(--_0x4f2b4f){_0x279bfb['push'](_0x279bfb['shift']());}};_0x4c74cd(++_0x46595b);}(_0x9fd8,0x18b));var _0x89fd=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x9fd8[_0x432682];return _0x463d05;};'use strict';var moment=require('moment');var Sequelize=require(_0x89fd('0x0'));module[_0x89fd('0x1')]={'uniqueid':{'type':Sequelize[_0x89fd('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x89fd('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x89fd('0x3')]},'reason':{'type':Sequelize[_0x89fd('0x2')]}}; \ No newline at end of file +var _0x5075=['moment','sequelize','exports','STRING','DATE'];(function(_0x45c9c2,_0x94a90e){var _0x40cdc2=function(_0x272de2){while(--_0x272de2){_0x45c9c2['push'](_0x45c9c2['shift']());}};_0x40cdc2(++_0x94a90e);}(_0x5075,0x73));var _0x5507=function(_0x2b4448,_0x5bcc69){_0x2b4448=_0x2b4448-0x0;var _0xb4b465=_0x5075[_0x2b4448];return _0xb4b465;};'use strict';var moment=require(_0x5507('0x0'));var Sequelize=require(_0x5507('0x1'));module[_0x5507('0x2')]={'uniqueid':{'type':Sequelize[_0x5507('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x5507('0x3')]},'joinAt':{'type':Sequelize[_0x5507('0x4')]},'leaveAt':{'type':Sequelize[_0x5507('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x5507('0x4')]},'reason':{'type':Sequelize[_0x5507('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 4d6953e..127c43b 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 _0xd755=['ejs','fs-extra','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','offset','limit','Content-Range','reject','update','then','end','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','destroy','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x403db0,_0xfbf17e){var _0x361c2d=function(_0x350002){while(--_0x350002){_0x403db0['push'](_0x403db0['shift']());}};_0x361c2d(++_0xfbf17e);}(_0xd755,0x168));var _0x5d75=function(_0x24e8db,_0x89fc47){_0x24e8db=_0x24e8db-0x0;var _0x576cc1=_0xd755[_0x24e8db];return _0x576cc1;};'use strict';var emlformat=require(_0x5d75('0x0'));var rimraf=require(_0x5d75('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5d75('0x2'));var rp=require('request-promise');var moment=require(_0x5d75('0x3'));var BPromise=require(_0x5d75('0x4'));var Mustache=require(_0x5d75('0x5'));var util=require(_0x5d75('0x6'));var path=require(_0x5d75('0x7'));var sox=require(_0x5d75('0x8'));var csv=require(_0x5d75('0x9'));var ejs=require(_0x5d75('0xa'));var fs=require('fs');var fs_extra=require(_0x5d75('0xb'));var _=require('lodash');var squel=require(_0x5d75('0xc'));var crypto=require(_0x5d75('0xd'));var jsforce=require(_0x5d75('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5d75('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5d75('0x10'));var as=require(_0x5d75('0x11'));var hardwareService=require(_0x5d75('0x12'));var logger=require(_0x5d75('0x13'))(_0x5d75('0x14'));var utils=require(_0x5d75('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5d75('0x16'));var db=require(_0x5d75('0x17'))['db'];function respondWithStatusCode(_0x1d1d33,_0x637e25){_0x637e25=_0x637e25||0xcc;return function(_0x501e98){if(_0x501e98){return _0x1d1d33['sendStatus'](_0x637e25);}return _0x1d1d33[_0x5d75('0x18')](_0x637e25)['end']();};}function respondWithResult(_0x11321,_0x2e76dc){_0x2e76dc=_0x2e76dc||0xc8;return function(_0x3c89f5){if(_0x3c89f5){return _0x11321[_0x5d75('0x18')](_0x2e76dc)[_0x5d75('0x19')](_0x3c89f5);}};}function respondWithFilteredResult(_0xca3360,_0xc00008){return function(_0x528dcc){if(_0x528dcc){var _0x186697=typeof _0xc00008['offset']===_0x5d75('0x1a')&&typeof _0xc00008['limit']==='undefined';var _0x53d565=_0x528dcc['count'];var _0x36a85e=_0x186697?0x0:_0xc00008[_0x5d75('0x1b')];var _0xe0c18b=_0x186697?_0x528dcc['count']:_0xc00008[_0x5d75('0x1b')]+_0xc00008[_0x5d75('0x1c')];var _0x43b60e;if(_0xe0c18b>=_0x53d565){_0xe0c18b=_0x53d565;_0x43b60e=0xc8;}else{_0x43b60e=0xce;}_0xca3360[_0x5d75('0x18')](_0x43b60e);return _0xca3360['set'](_0x5d75('0x1d'),_0x36a85e+'-'+_0xe0c18b+'/'+_0x53d565)[_0x5d75('0x19')](_0x528dcc);}return null;};}function patchUpdates(_0x2843e4){return function(_0x30e3d9){try{jsonpatch['apply'](_0x30e3d9,_0x2843e4,!![]);}catch(_0x41870e){return BPromise[_0x5d75('0x1e')](_0x41870e);}return _0x30e3d9['save']();};}function saveUpdates(_0x2ff0ca,_0x18a9cb){return function(_0x226e16){if(_0x226e16){return _0x226e16[_0x5d75('0x1f')](_0x2ff0ca)[_0x5d75('0x20')](function(_0x12631c){return _0x12631c;});}return null;};}function removeEntity(_0x4b089b,_0x5441ba){return function(_0xe3f2db){if(_0xe3f2db){return _0xe3f2db['destroy']()[_0x5d75('0x20')](function(){_0x4b089b['status'](0xcc)[_0x5d75('0x21')]();});}};}function handleEntityNotFound(_0x5a6cdc,_0x54874f){return function(_0x1f6103){if(!_0x1f6103){_0x5a6cdc['sendStatus'](0x194);}return _0x1f6103;};}function handleError(_0x93faf9,_0x20d126){_0x20d126=_0x20d126||0x1f4;return function(_0x43fea3){logger[_0x5d75('0x22')](_0x43fea3[_0x5d75('0x23')]);if(_0x43fea3[_0x5d75('0x24')]){delete _0x43fea3[_0x5d75('0x24')];}_0x93faf9[_0x5d75('0x18')](_0x20d126)[_0x5d75('0x25')](_0x43fea3);};}exports[_0x5d75('0x26')]=function(_0x5c6b28,_0x168940){var _0xde29c={},_0x2771c5={},_0x1ddaaf={'count':0x0,'rows':[]};var _0xc1579=_[_0x5d75('0x27')](db[_0x5d75('0x28')][_0x5d75('0x29')],function(_0x171c0c){return{'name':_0x171c0c[_0x5d75('0x2a')],'type':_0x171c0c[_0x5d75('0x2b')][_0x5d75('0x2c')]};});_0x2771c5[_0x5d75('0x2d')]=_[_0x5d75('0x27')](_0xc1579,'name');_0x2771c5['query']=_['keys'](_0x5c6b28[_0x5d75('0x2e')]);_0x2771c5[_0x5d75('0x2f')]=_['intersection'](_0x2771c5['model'],_0x2771c5[_0x5d75('0x2e')]);_0xde29c['attributes']=_[_0x5d75('0x30')](_0x2771c5[_0x5d75('0x2d')],qs[_0x5d75('0x31')](_0x5c6b28[_0x5d75('0x2e')][_0x5d75('0x31')]));_0xde29c[_0x5d75('0x32')]=_0xde29c[_0x5d75('0x32')][_0x5d75('0x33')]?_0xde29c[_0x5d75('0x32')]:_0x2771c5[_0x5d75('0x2d')];if(!_0x5c6b28['query'][_0x5d75('0x34')](_0x5d75('0x35'))){_0xde29c[_0x5d75('0x1c')]=qs[_0x5d75('0x1c')](_0x5c6b28['query'][_0x5d75('0x1c')]);_0xde29c['offset']=qs[_0x5d75('0x1b')](_0x5c6b28[_0x5d75('0x2e')][_0x5d75('0x1b')]);}_0xde29c['order']=qs['sort'](_0x5c6b28[_0x5d75('0x2e')][_0x5d75('0x36')]);_0xde29c['where']=qs['filters'](_[_0x5d75('0x37')](_0x5c6b28[_0x5d75('0x2e')],_0x2771c5[_0x5d75('0x2f')]),_0xc1579);if(_0x5c6b28[_0x5d75('0x2e')]['filter']){_0xde29c[_0x5d75('0x38')]=_[_0x5d75('0x39')](_0xde29c['where'],{'$or':_[_0x5d75('0x27')](_0xc1579,function(_0x102471){if(_0x102471[_0x5d75('0x2b')]!==_0x5d75('0x3a')){var _0x561a89={};_0x561a89[_0x102471[_0x5d75('0x24')]]={'$like':'%'+_0x5c6b28[_0x5d75('0x2e')][_0x5d75('0x3b')]+'%'};return _0x561a89;}})});}_0xde29c=_[_0x5d75('0x39')]({},_0xde29c,_0x5c6b28[_0x5d75('0x3c')]);var _0x1a1b2e={'where':_0xde29c['where']};return db['OpenchannelQueueReport'][_0x5d75('0x3d')](_0x1a1b2e)[_0x5d75('0x20')](function(_0x3f1f03){_0x1ddaaf[_0x5d75('0x3d')]=_0x3f1f03;if(_0x5c6b28[_0x5d75('0x2e')][_0x5d75('0x3e')]){_0xde29c[_0x5d75('0x3f')]=[{'all':!![]}];}return db[_0x5d75('0x28')][_0x5d75('0x40')](_0xde29c);})[_0x5d75('0x20')](function(_0x4642e2){_0x1ddaaf[_0x5d75('0x41')]=_0x4642e2;return _0x1ddaaf;})['then'](respondWithFilteredResult(_0x168940,_0xde29c))[_0x5d75('0x42')](handleError(_0x168940,null));};exports[_0x5d75('0x43')]=function(_0x589cc8,_0x36e499){var _0x251f2e={'raw':!![],'where':{'id':_0x589cc8[_0x5d75('0x44')]['id']}},_0x54bf00={};_0x54bf00[_0x5d75('0x2d')]=_[_0x5d75('0x45')](db['OpenchannelQueueReport'][_0x5d75('0x29')]);_0x54bf00[_0x5d75('0x2e')]=_[_0x5d75('0x45')](_0x589cc8[_0x5d75('0x2e')]);_0x54bf00[_0x5d75('0x2f')]=_[_0x5d75('0x30')](_0x54bf00[_0x5d75('0x2d')],_0x54bf00[_0x5d75('0x2e')]);_0x251f2e['attributes']=_[_0x5d75('0x30')](_0x54bf00[_0x5d75('0x2d')],qs[_0x5d75('0x31')](_0x589cc8[_0x5d75('0x2e')]['fields']));_0x251f2e['attributes']=_0x251f2e[_0x5d75('0x32')]['length']?_0x251f2e[_0x5d75('0x32')]:_0x54bf00[_0x5d75('0x2d')];if(_0x589cc8['query'][_0x5d75('0x3e')]){_0x251f2e[_0x5d75('0x3f')]=[{'all':!![]}];}_0x251f2e=_[_0x5d75('0x39')]({},_0x251f2e,_0x589cc8[_0x5d75('0x3c')]);return db['OpenchannelQueueReport'][_0x5d75('0x46')](_0x251f2e)[_0x5d75('0x20')](handleEntityNotFound(_0x36e499,null))[_0x5d75('0x20')](respondWithResult(_0x36e499,null))[_0x5d75('0x42')](handleError(_0x36e499,null));};exports['create']=function(_0xc9dea6,_0x2a41a5){return db[_0x5d75('0x28')][_0x5d75('0x47')](_0xc9dea6['body'],{})[_0x5d75('0x20')](respondWithResult(_0x2a41a5,0xc9))[_0x5d75('0x42')](handleError(_0x2a41a5,null));};exports['update']=function(_0x176354,_0x525fb8){if(_0x176354[_0x5d75('0x48')]['id']){delete _0x176354[_0x5d75('0x48')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x176354[_0x5d75('0x44')]['id']}})[_0x5d75('0x20')](handleEntityNotFound(_0x525fb8,null))['then'](saveUpdates(_0x176354['body'],null))[_0x5d75('0x20')](respondWithResult(_0x525fb8,null))['catch'](handleError(_0x525fb8,null));};exports[_0x5d75('0x49')]=function(_0x196960,_0xbd6e88){return db[_0x5d75('0x28')][_0x5d75('0x46')]({'where':{'id':_0x196960[_0x5d75('0x44')]['id']}})[_0x5d75('0x20')](handleEntityNotFound(_0xbd6e88,null))[_0x5d75('0x20')](removeEntity(_0xbd6e88,null))[_0x5d75('0x42')](handleError(_0xbd6e88,null));};exports['describe']=function(_0x30542a,_0x5a67a8){return db['OpenchannelQueueReport']['describe']()[_0x5d75('0x20')](respondWithResult(_0x5a67a8,null))[_0x5d75('0x42')](handleError(_0x5a67a8,null));}; \ No newline at end of file +var _0x95c0=['../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','error','stack','name','send','index','OpenchannelQueueReport','type','key','model','map','query','keys','filters','intersection','attributes','fields','order','sort','where','filter','merge','VIRTUAL','options','findAll','catch','show','rawAttributes','length','includeAll','create','body','params','describe','eml-format','rimraf','zip-dir','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x1d465b,_0x32e3c6){var _0x333804=function(_0x441bce){while(--_0x441bce){_0x1d465b['push'](_0x1d465b['shift']());}};_0x333804(++_0x32e3c6);}(_0x95c0,0x73));var _0x095c=function(_0x28c090,_0x8f39d0){_0x28c090=_0x28c090-0x0;var _0x2fbfa3=_0x95c0[_0x28c090];return _0x2fbfa3;};'use strict';var emlformat=require(_0x095c('0x0'));var rimraf=require(_0x095c('0x1'));var zipdir=require(_0x095c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x095c('0x3'));var Mustache=require(_0x095c('0x4'));var util=require('util');var path=require(_0x095c('0x5'));var sox=require('sox');var csv=require(_0x095c('0x6'));var ejs=require(_0x095c('0x7'));var fs=require('fs');var fs_extra=require(_0x095c('0x8'));var _=require(_0x095c('0x9'));var squel=require(_0x095c('0xa'));var crypto=require(_0x095c('0xb'));var jsforce=require(_0x095c('0xc'));var deskjs=require(_0x095c('0xd'));var toCsv=require(_0x095c('0x6'));var querystring=require('querystring');var Papa=require(_0x095c('0xe'));var Redis=require(_0x095c('0xf'));var authService=require(_0x095c('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x095c('0x11'));var logger=require(_0x095c('0x12'))(_0x095c('0x13'));var utils=require(_0x095c('0x14'));var config=require(_0x095c('0x15'));var licenseUtil=require(_0x095c('0x16'));var db=require(_0x095c('0x17'))['db'];function respondWithStatusCode(_0x272906,_0x58fd85){_0x58fd85=_0x58fd85||0xcc;return function(_0x275614){if(_0x275614){return _0x272906[_0x095c('0x18')](_0x58fd85);}return _0x272906['status'](_0x58fd85)['end']();};}function respondWithResult(_0x595538,_0x5bba93){_0x5bba93=_0x5bba93||0xc8;return function(_0xc0db6a){if(_0xc0db6a){return _0x595538[_0x095c('0x19')](_0x5bba93)[_0x095c('0x1a')](_0xc0db6a);}};}function respondWithFilteredResult(_0x291059,_0x4a2076){return function(_0x188075){if(_0x188075){var _0x40f51c=typeof _0x4a2076[_0x095c('0x1b')]===_0x095c('0x1c')&&typeof _0x4a2076[_0x095c('0x1d')]==='undefined';var _0x4c11ba=_0x188075['count'];var _0x4a1d09=_0x40f51c?0x0:_0x4a2076[_0x095c('0x1b')];var _0x1a5b37=_0x40f51c?_0x188075[_0x095c('0x1e')]:_0x4a2076['offset']+_0x4a2076[_0x095c('0x1d')];var _0x52ee9a;if(_0x1a5b37>=_0x4c11ba){_0x1a5b37=_0x4c11ba;_0x52ee9a=0xc8;}else{_0x52ee9a=0xce;}_0x291059['status'](_0x52ee9a);return _0x291059[_0x095c('0x1f')](_0x095c('0x20'),_0x4a1d09+'-'+_0x1a5b37+'/'+_0x4c11ba)[_0x095c('0x1a')](_0x188075);}return null;};}function patchUpdates(_0x8396f){return function(_0x78a167){try{jsonpatch['apply'](_0x78a167,_0x8396f,!![]);}catch(_0x55ec4d){return BPromise['reject'](_0x55ec4d);}return _0x78a167[_0x095c('0x21')]();};}function saveUpdates(_0x46a087,_0x3f57a1){return function(_0x4eafb2){if(_0x4eafb2){return _0x4eafb2[_0x095c('0x22')](_0x46a087)[_0x095c('0x23')](function(_0x4525f8){return _0x4525f8;});}return null;};}function removeEntity(_0xc8d975,_0x36c701){return function(_0x4d9da9){if(_0x4d9da9){return _0x4d9da9['destroy']()[_0x095c('0x23')](function(){_0xc8d975[_0x095c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfef920,_0x53a12e){return function(_0x392a25){if(!_0x392a25){_0xfef920[_0x095c('0x18')](0x194);}return _0x392a25;};}function handleError(_0x5bcc7a,_0x586257){_0x586257=_0x586257||0x1f4;return function(_0x5cdd9c){logger[_0x095c('0x24')](_0x5cdd9c[_0x095c('0x25')]);if(_0x5cdd9c[_0x095c('0x26')]){delete _0x5cdd9c[_0x095c('0x26')];}_0x5bcc7a[_0x095c('0x19')](_0x586257)[_0x095c('0x27')](_0x5cdd9c);};}exports[_0x095c('0x28')]=function(_0x138352,_0x4b9ab4){var _0x3aff43={},_0x29634e={},_0x394ec2={'count':0x0,'rows':[]};var _0x581052=_['map'](db[_0x095c('0x29')]['rawAttributes'],function(_0x5813bf){return{'name':_0x5813bf['fieldName'],'type':_0x5813bf[_0x095c('0x2a')][_0x095c('0x2b')]};});_0x29634e[_0x095c('0x2c')]=_[_0x095c('0x2d')](_0x581052,_0x095c('0x26'));_0x29634e[_0x095c('0x2e')]=_[_0x095c('0x2f')](_0x138352['query']);_0x29634e[_0x095c('0x30')]=_[_0x095c('0x31')](_0x29634e['model'],_0x29634e[_0x095c('0x2e')]);_0x3aff43[_0x095c('0x32')]=_['intersection'](_0x29634e[_0x095c('0x2c')],qs[_0x095c('0x33')](_0x138352[_0x095c('0x2e')][_0x095c('0x33')]));_0x3aff43[_0x095c('0x32')]=_0x3aff43['attributes']['length']?_0x3aff43['attributes']:_0x29634e[_0x095c('0x2c')];if(!_0x138352[_0x095c('0x2e')]['hasOwnProperty']('nolimit')){_0x3aff43[_0x095c('0x1d')]=qs[_0x095c('0x1d')](_0x138352[_0x095c('0x2e')][_0x095c('0x1d')]);_0x3aff43[_0x095c('0x1b')]=qs['offset'](_0x138352['query']['offset']);}_0x3aff43[_0x095c('0x34')]=qs['sort'](_0x138352[_0x095c('0x2e')][_0x095c('0x35')]);_0x3aff43[_0x095c('0x36')]=qs[_0x095c('0x30')](_['pick'](_0x138352['query'],_0x29634e[_0x095c('0x30')]),_0x581052);if(_0x138352[_0x095c('0x2e')][_0x095c('0x37')]){_0x3aff43[_0x095c('0x36')]=_[_0x095c('0x38')](_0x3aff43[_0x095c('0x36')],{'$or':_[_0x095c('0x2d')](_0x581052,function(_0xc4723c){if(_0xc4723c[_0x095c('0x2a')]!==_0x095c('0x39')){var _0x5c7697={};_0x5c7697[_0xc4723c[_0x095c('0x26')]]={'$like':'%'+_0x138352[_0x095c('0x2e')][_0x095c('0x37')]+'%'};return _0x5c7697;}})});}_0x3aff43=_[_0x095c('0x38')]({},_0x3aff43,_0x138352[_0x095c('0x3a')]);var _0xdc72e7={'where':_0x3aff43['where']};return db[_0x095c('0x29')]['count'](_0xdc72e7)[_0x095c('0x23')](function(_0x3622f2){_0x394ec2[_0x095c('0x1e')]=_0x3622f2;if(_0x138352[_0x095c('0x2e')]['includeAll']){_0x3aff43['include']=[{'all':!![]}];}return db[_0x095c('0x29')][_0x095c('0x3b')](_0x3aff43);})['then'](function(_0x512689){_0x394ec2['rows']=_0x512689;return _0x394ec2;})[_0x095c('0x23')](respondWithFilteredResult(_0x4b9ab4,_0x3aff43))[_0x095c('0x3c')](handleError(_0x4b9ab4,null));};exports[_0x095c('0x3d')]=function(_0x1d961e,_0x2514f9){var _0x233ea9={'raw':!![],'where':{'id':_0x1d961e['params']['id']}},_0x17eabd={};_0x17eabd[_0x095c('0x2c')]=_['keys'](db['OpenchannelQueueReport'][_0x095c('0x3e')]);_0x17eabd[_0x095c('0x2e')]=_[_0x095c('0x2f')](_0x1d961e[_0x095c('0x2e')]);_0x17eabd[_0x095c('0x30')]=_[_0x095c('0x31')](_0x17eabd[_0x095c('0x2c')],_0x17eabd['query']);_0x233ea9[_0x095c('0x32')]=_[_0x095c('0x31')](_0x17eabd[_0x095c('0x2c')],qs[_0x095c('0x33')](_0x1d961e[_0x095c('0x2e')]['fields']));_0x233ea9['attributes']=_0x233ea9[_0x095c('0x32')][_0x095c('0x3f')]?_0x233ea9[_0x095c('0x32')]:_0x17eabd[_0x095c('0x2c')];if(_0x1d961e[_0x095c('0x2e')][_0x095c('0x40')]){_0x233ea9['include']=[{'all':!![]}];}_0x233ea9=_['merge']({},_0x233ea9,_0x1d961e[_0x095c('0x3a')]);return db[_0x095c('0x29')]['find'](_0x233ea9)[_0x095c('0x23')](handleEntityNotFound(_0x2514f9,null))[_0x095c('0x23')](respondWithResult(_0x2514f9,null))[_0x095c('0x3c')](handleError(_0x2514f9,null));};exports['create']=function(_0x3c1d05,_0xf80349){return db[_0x095c('0x29')][_0x095c('0x41')](_0x3c1d05['body'],{})[_0x095c('0x23')](respondWithResult(_0xf80349,0xc9))[_0x095c('0x3c')](handleError(_0xf80349,null));};exports[_0x095c('0x22')]=function(_0x3dc04a,_0x2ae2d9){if(_0x3dc04a['body']['id']){delete _0x3dc04a[_0x095c('0x42')]['id'];}return db[_0x095c('0x29')]['find']({'where':{'id':_0x3dc04a[_0x095c('0x43')]['id']}})[_0x095c('0x23')](handleEntityNotFound(_0x2ae2d9,null))[_0x095c('0x23')](saveUpdates(_0x3dc04a[_0x095c('0x42')],null))[_0x095c('0x23')](respondWithResult(_0x2ae2d9,null))[_0x095c('0x3c')](handleError(_0x2ae2d9,null));};exports['destroy']=function(_0x54013e,_0x4a7f1b){return db['OpenchannelQueueReport']['find']({'where':{'id':_0x54013e[_0x095c('0x43')]['id']}})[_0x095c('0x23')](handleEntityNotFound(_0x4a7f1b,null))['then'](removeEntity(_0x4a7f1b,null))[_0x095c('0x3c')](handleError(_0x4a7f1b,null));};exports[_0x095c('0x44')]=function(_0x249c1c,_0x17350e){return db[_0x095c('0x29')]['describe']()[_0x095c('0x23')](respondWithResult(_0x17350e,null))[_0x095c('0x3c')](handleError(_0x17350e,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 3dd4ab0..c4d83ae 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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x2350eb,_0x246e02){var _0x5ce0f3=function(_0x5f5b1a){while(--_0x5f5b1a){_0x2350eb['push'](_0x2350eb['shift']());}};_0x5ce0f3(++_0x246e02);}(_0x326f,0xd1));var _0xf326=function(_0x10dc1c,_0x308b4a){_0x10dc1c=_0x10dc1c-0x0;var _0x4a1a77=_0x326f[_0x10dc1c];return _0x4a1a77;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x574497,_0x278cdc){var _0xcdfb15=function(_0x395b4d){while(--_0x395b4d){_0x574497['push'](_0x574497['shift']());}};_0xcdfb15(++_0x278cdc);}(_0x326f,0xd1));var _0xf326=function(_0x4c0170,_0xd0738c){_0x4c0170=_0x4c0170-0x0;var _0x19b013=_0x326f[_0x4c0170];return _0x19b013;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 965cfc9..ab4c573 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 _0x937d=['info','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelQueueReport,\x20%s,\x20%s','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','debug','UpdateOpenchannelQueueReport','attributes','limit','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x2eeb08,_0x1ad382){var _0x5316c6=function(_0x1d245d){while(--_0x1d245d){_0x2eeb08['push'](_0x2eeb08['shift']());}};_0x5316c6(++_0x1ad382);}(_0x937d,0x1f4));var _0xd937=function(_0x6ff543,_0x5a615b){_0x6ff543=_0x6ff543-0x0;var _0x109c07=_0x937d[_0x6ff543];return _0x109c07;};'use strict';var _=require(_0xd937('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd937('0x1'));var fs=require('fs');var Redis=require(_0xd937('0x2'));var db=require(_0xd937('0x3'))['db'];var utils=require(_0xd937('0x4'));var logger=require(_0xd937('0x5'))(_0xd937('0x6'));var config=require('../../config/environment');var jayson=require(_0xd937('0x7'));var client=jayson[_0xd937('0x8')][_0xd937('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f6cd9,_0x2454f9,_0x4dc790){return new BPromise(function(_0x490b1d,_0x372dff){return client[_0xd937('0xa')](_0x4f6cd9,_0x4dc790)[_0xd937('0xb')](function(_0xa97338){logger[_0xd937('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2454f9,_0xd937('0xd'));logger['debug'](_0xd937('0xe'),_0x2454f9,'request\x20sent',JSON[_0xd937('0xf')](_0xa97338));if(_0xa97338[_0xd937('0x10')]){if(_0xa97338[_0xd937('0x10')][_0xd937('0x11')]===0x1f4){logger[_0xd937('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2454f9,_0xa97338[_0xd937('0x10')][_0xd937('0x12')]);return _0x372dff(_0xa97338[_0xd937('0x10')][_0xd937('0x12')]);}logger[_0xd937('0x10')](_0xd937('0x13'),_0x2454f9,_0xa97338[_0xd937('0x10')][_0xd937('0x12')]);return _0x490b1d(_0xa97338[_0xd937('0x10')][_0xd937('0x12')]);}else{logger['info'](_0xd937('0x13'),_0x2454f9,_0xd937('0xd'));_0x490b1d(_0xa97338[_0xd937('0x14')]['message']);}})[_0xd937('0x15')](function(_0x16d2ba){logger[_0xd937('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2454f9,_0x16d2ba);_0x372dff(_0x16d2ba);});});}exports[_0xd937('0x16')]=function(_0x3d6b1c){var _0x1d1b8b=this;return new Promise(function(_0x1bd7ee,_0x26d5ca){return db[_0xd937('0x17')][_0xd937('0x18')](_0x3d6b1c[_0xd937('0x19')],{'raw':_0x3d6b1c[_0xd937('0x1a')]?_0x3d6b1c[_0xd937('0x1a')][_0xd937('0x1b')]===undefined?!![]:![]:!![]})[_0xd937('0xb')](function(_0x2c18ea){logger[_0xd937('0xc')](_0xd937('0x16'),_0x3d6b1c);logger[_0xd937('0x1c')](_0xd937('0x16'),_0x3d6b1c,JSON['stringify'](_0x2c18ea));_0x1bd7ee(_0x2c18ea);})[_0xd937('0x15')](function(_0x168f3e){logger[_0xd937('0x10')](_0xd937('0x16'),_0x168f3e[_0xd937('0x12')],_0x3d6b1c);_0x26d5ca(_0x1d1b8b[_0xd937('0x10')](0x1f4,_0x168f3e[_0xd937('0x12')]));});});};exports[_0xd937('0x1d')]=function(_0x194fe5){var _0x14b350=this;return new Promise(function(_0x2bbbd4,_0x5b14d0){return db['OpenchannelQueueReport']['update'](_0x194fe5[_0xd937('0x19')],{'raw':_0x194fe5[_0xd937('0x1a')]?_0x194fe5['options'][_0xd937('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x194fe5[_0xd937('0x1a')]?_0x194fe5[_0xd937('0x1a')]['where']||null:null,'attributes':_0x194fe5['options']?_0x194fe5[_0xd937('0x1a')][_0xd937('0x1e')]||null:null,'limit':_0x194fe5[_0xd937('0x1a')]?_0x194fe5[_0xd937('0x1a')][_0xd937('0x1f')]||null:null})[_0xd937('0xb')](function(_0x291fb7){logger[_0xd937('0xc')](_0xd937('0x1d'),_0x194fe5);logger[_0xd937('0x1c')](_0xd937('0x1d'),_0x194fe5,JSON['stringify'](_0x291fb7));_0x2bbbd4(_0x291fb7);})[_0xd937('0x15')](function(_0x23b4ef){logger[_0xd937('0x10')](_0xd937('0x1d'),_0x23b4ef['message'],_0x194fe5);_0x5b14d0(_0x14b350[_0xd937('0x10')](0x1f4,_0x23b4ef[_0xd937('0x12')]));});});}; \ No newline at end of file +var _0x49f8=['client','http','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','then','stringify','update','raw','where','limit','UpdateOpenchannelQueueReport','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x374afe,_0x310384){var _0xdbe14c=function(_0x5b0e3e){while(--_0x5b0e3e){_0x374afe['push'](_0x374afe['shift']());}};_0xdbe14c(++_0x310384);}(_0x49f8,0xff));var _0x849f=function(_0x417538,_0x5a1ad6){_0x417538=_0x417538-0x0;var _0x3b15b1=_0x49f8[_0x417538];return _0x3b15b1;};'use strict';var _=require(_0x849f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x849f('0x1'));var rs=require(_0x849f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x849f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x849f('0x4'))('rpc');var config=require(_0x849f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x849f('0x6')][_0x849f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x21f577,_0xb4c798,_0x33b630){return new BPromise(function(_0xc6443e,_0x565438){return client['request'](_0x21f577,_0x33b630)['then'](function(_0x306c11){logger[_0x849f('0x8')](_0x849f('0x9'),_0xb4c798,_0x849f('0xa'));logger[_0x849f('0xb')](_0x849f('0xc'),_0xb4c798,_0x849f('0xa'),JSON['stringify'](_0x306c11));if(_0x306c11[_0x849f('0xd')]){if(_0x306c11['error'][_0x849f('0xe')]===0x1f4){logger[_0x849f('0xd')](_0x849f('0x9'),_0xb4c798,_0x306c11[_0x849f('0xd')]['message']);return _0x565438(_0x306c11[_0x849f('0xd')][_0x849f('0xf')]);}logger[_0x849f('0xd')](_0x849f('0x9'),_0xb4c798,_0x306c11[_0x849f('0xd')]['message']);return _0xc6443e(_0x306c11['error'][_0x849f('0xf')]);}else{logger['info'](_0x849f('0x9'),_0xb4c798,_0x849f('0xa'));_0xc6443e(_0x306c11[_0x849f('0x10')][_0x849f('0xf')]);}})[_0x849f('0x11')](function(_0x19ba28){logger[_0x849f('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xb4c798,_0x19ba28);_0x565438(_0x19ba28);});});}exports[_0x849f('0x12')]=function(_0x20bea7){var _0x189529=this;return new Promise(function(_0x541cd6,_0x1e4017){return db[_0x849f('0x13')]['create'](_0x20bea7[_0x849f('0x14')],{'raw':_0x20bea7[_0x849f('0x15')]?_0x20bea7['options']['raw']===undefined?!![]:![]:!![]})[_0x849f('0x16')](function(_0x11d183){logger[_0x849f('0x8')](_0x849f('0x12'),_0x20bea7);logger[_0x849f('0xb')](_0x849f('0x12'),_0x20bea7,JSON[_0x849f('0x17')](_0x11d183));_0x541cd6(_0x11d183);})[_0x849f('0x11')](function(_0x4b29f1){logger[_0x849f('0xd')](_0x849f('0x12'),_0x4b29f1[_0x849f('0xf')],_0x20bea7);_0x1e4017(_0x189529[_0x849f('0xd')](0x1f4,_0x4b29f1[_0x849f('0xf')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x3a5724){var _0x32be69=this;return new Promise(function(_0x15a41c,_0xe404c6){return db[_0x849f('0x13')][_0x849f('0x18')](_0x3a5724[_0x849f('0x14')],{'raw':_0x3a5724[_0x849f('0x15')]?_0x3a5724[_0x849f('0x15')][_0x849f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a5724[_0x849f('0x15')]?_0x3a5724[_0x849f('0x15')][_0x849f('0x1a')]||null:null,'attributes':_0x3a5724['options']?_0x3a5724[_0x849f('0x15')]['attributes']||null:null,'limit':_0x3a5724[_0x849f('0x15')]?_0x3a5724[_0x849f('0x15')][_0x849f('0x1b')]||null:null})[_0x849f('0x16')](function(_0xf0e21f){logger[_0x849f('0x8')]('UpdateOpenchannelQueueReport',_0x3a5724);logger[_0x849f('0xb')](_0x849f('0x1c'),_0x3a5724,JSON[_0x849f('0x17')](_0xf0e21f));_0x15a41c(_0xf0e21f);})['catch'](function(_0x347c93){logger['error'](_0x849f('0x1c'),_0x347c93[_0x849f('0xf')],_0x3a5724);_0xe404c6(_0x32be69[_0x849f('0xd')](0x1f4,_0x347c93[_0x849f('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 0a73256..50776ff 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 _0x8714=['put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','create'];(function(_0x16bfc8,_0x1bb083){var _0x7687b7=function(_0x4fbbde){while(--_0x4fbbde){_0x16bfc8['push'](_0x16bfc8['shift']());}};_0x7687b7(++_0x1bb083);}(_0x8714,0x17e));var _0x4871=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x8714[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0x4871('0x0'));var util=require('util');var path=require(_0x4871('0x1'));var timeout=require(_0x4871('0x2'));var express=require(_0x4871('0x3'));var router=express[_0x4871('0x4')]();var fs_extra=require(_0x4871('0x5'));var auth=require(_0x4871('0x6'));var interaction=require(_0x4871('0x7'));var config=require(_0x4871('0x8'));var controller=require(_0x4871('0x9'));router[_0x4871('0xa')]('/',auth[_0x4871('0xb')](),controller[_0x4871('0xc')]);router['get'](_0x4871('0xd'),auth[_0x4871('0xb')](),controller[_0x4871('0xe')]);router[_0x4871('0xa')](_0x4871('0xf'),auth[_0x4871('0xb')](),controller['show']);router['post']('/',auth[_0x4871('0xb')](),controller[_0x4871('0x10')]);router[_0x4871('0x11')](_0x4871('0xf'),auth[_0x4871('0xb')](),controller['update']);router[_0x4871('0x12')](_0x4871('0xf'),auth['isAuthenticated'](),controller[_0x4871('0x13')]);module[_0x4871('0x14')]=router; \ No newline at end of file +var _0xbd08=['multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update'];(function(_0x423549,_0x242e63){var _0xdcb104=function(_0x6bff59){while(--_0x6bff59){_0x423549['push'](_0x423549['shift']());}};_0xdcb104(++_0x242e63);}(_0xbd08,0xea));var _0x8bd0=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0xbd08[_0x2080a3];return _0x8d7d17;};'use strict';var multer=require(_0x8bd0('0x0'));var util=require(_0x8bd0('0x1'));var path=require('path');var timeout=require(_0x8bd0('0x2'));var express=require(_0x8bd0('0x3'));var router=express[_0x8bd0('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8bd0('0x5'));var config=require(_0x8bd0('0x6'));var controller=require(_0x8bd0('0x7'));router[_0x8bd0('0x8')]('/',auth[_0x8bd0('0x9')](),controller[_0x8bd0('0xa')]);router[_0x8bd0('0x8')](_0x8bd0('0xb'),auth[_0x8bd0('0x9')](),controller[_0x8bd0('0xc')]);router[_0x8bd0('0x8')](_0x8bd0('0xd'),auth[_0x8bd0('0x9')](),controller[_0x8bd0('0xe')]);router['post']('/',auth[_0x8bd0('0x9')](),controller[_0x8bd0('0xf')]);router[_0x8bd0('0x10')](_0x8bd0('0xd'),auth[_0x8bd0('0x9')](),controller[_0x8bd0('0x11')]);router['delete'](_0x8bd0('0xd'),auth[_0x8bd0('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 17e314e..5e8f463 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x455555,_0x2147fd){var _0x3cb183=function(_0x516a72){while(--_0x516a72){_0x455555['push'](_0x455555['shift']());}};_0x3cb183(++_0x2147fd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x15c5b8,_0x3b670f){var _0xd45fe6=function(_0x15a775){while(--_0x15a775){_0x15c5b8['push'](_0x15c5b8['shift']());}};_0xd45fe6(++_0x3b670f);}(_0x54ef,0x112));var _0xf54e=function(_0x3ac5f5,_0x49b99f){_0x3ac5f5=_0x3ac5f5-0x0;var _0x192782=_0x54ef[_0x3ac5f5];return _0x192782;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 8bf2985..581f365 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 _0x9591=['reject','save','update','then','name','send','index','map','rawAttributes','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','OpenchannelTransferReport','catch','params','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x1c935c,_0x6cdccc){var _0x292507=function(_0x200cae){while(--_0x200cae){_0x1c935c['push'](_0x1c935c['shift']());}};_0x292507(++_0x6cdccc);}(_0x9591,0x1ce));var _0x1959=function(_0x30a303,_0x2f5933){_0x30a303=_0x30a303-0x0;var _0x2576d1=_0x9591[_0x30a303];return _0x2576d1;};'use strict';var emlformat=require(_0x1959('0x0'));var rimraf=require(_0x1959('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1959('0x2'));var rp=require(_0x1959('0x3'));var moment=require('moment');var BPromise=require(_0x1959('0x4'));var Mustache=require(_0x1959('0x5'));var util=require(_0x1959('0x6'));var path=require(_0x1959('0x7'));var sox=require(_0x1959('0x8'));var csv=require(_0x1959('0x9'));var ejs=require(_0x1959('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1959('0xb'));var squel=require(_0x1959('0xc'));var crypto=require(_0x1959('0xd'));var jsforce=require(_0x1959('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1959('0xf'));var Redis=require(_0x1959('0x10'));var authService=require(_0x1959('0x11'));var qs=require(_0x1959('0x12'));var as=require(_0x1959('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1959('0x14'))(_0x1959('0x15'));var utils=require(_0x1959('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1959('0x17'))['db'];function respondWithStatusCode(_0xac89cd,_0x957e74){_0x957e74=_0x957e74||0xcc;return function(_0x44b5ca){if(_0x44b5ca){return _0xac89cd[_0x1959('0x18')](_0x957e74);}return _0xac89cd[_0x1959('0x19')](_0x957e74)[_0x1959('0x1a')]();};}function respondWithResult(_0x197b8c,_0x3b78de){_0x3b78de=_0x3b78de||0xc8;return function(_0x56f2cc){if(_0x56f2cc){return _0x197b8c[_0x1959('0x19')](_0x3b78de)[_0x1959('0x1b')](_0x56f2cc);}};}function respondWithFilteredResult(_0x5c7b1f,_0x4558b5){return function(_0x179201){if(_0x179201){var _0x19a909=typeof _0x4558b5[_0x1959('0x1c')]===_0x1959('0x1d')&&typeof _0x4558b5[_0x1959('0x1e')]===_0x1959('0x1d');var _0x52d7c7=_0x179201[_0x1959('0x1f')];var _0x427675=_0x19a909?0x0:_0x4558b5[_0x1959('0x1c')];var _0x152a17=_0x19a909?_0x179201[_0x1959('0x1f')]:_0x4558b5['offset']+_0x4558b5[_0x1959('0x1e')];var _0xdbd1e3;if(_0x152a17>=_0x52d7c7){_0x152a17=_0x52d7c7;_0xdbd1e3=0xc8;}else{_0xdbd1e3=0xce;}_0x5c7b1f[_0x1959('0x19')](_0xdbd1e3);return _0x5c7b1f[_0x1959('0x20')](_0x1959('0x21'),_0x427675+'-'+_0x152a17+'/'+_0x52d7c7)[_0x1959('0x1b')](_0x179201);}return null;};}function patchUpdates(_0xa6d0ba){return function(_0x3caa7b){try{jsonpatch[_0x1959('0x22')](_0x3caa7b,_0xa6d0ba,!![]);}catch(_0x5640ea){return BPromise[_0x1959('0x23')](_0x5640ea);}return _0x3caa7b[_0x1959('0x24')]();};}function saveUpdates(_0x35e57a,_0x46b05b){return function(_0x3f933c){if(_0x3f933c){return _0x3f933c[_0x1959('0x25')](_0x35e57a)[_0x1959('0x26')](function(_0x461b62){return _0x461b62;});}return null;};}function removeEntity(_0x4ab2f9,_0x4e66b9){return function(_0x5dfcef){if(_0x5dfcef){return _0x5dfcef['destroy']()[_0x1959('0x26')](function(){_0x4ab2f9[_0x1959('0x19')](0xcc)[_0x1959('0x1a')]();});}};}function handleEntityNotFound(_0x512a3c,_0x461d30){return function(_0x285270){if(!_0x285270){_0x512a3c[_0x1959('0x18')](0x194);}return _0x285270;};}function handleError(_0x4391e4,_0x42ab27){_0x42ab27=_0x42ab27||0x1f4;return function(_0x58daf3){logger['error'](_0x58daf3['stack']);if(_0x58daf3['name']){delete _0x58daf3[_0x1959('0x27')];}_0x4391e4[_0x1959('0x19')](_0x42ab27)[_0x1959('0x28')](_0x58daf3);};}exports[_0x1959('0x29')]=function(_0x26a18c,_0x3b309b){var _0x5d4c8d={},_0x17373c={},_0x15cd8b={'count':0x0,'rows':[]};var _0x580e0a=_[_0x1959('0x2a')](db['OpenchannelTransferReport'][_0x1959('0x2b')],function(_0x53be8d){return{'name':_0x53be8d['fieldName'],'type':_0x53be8d[_0x1959('0x2c')][_0x1959('0x2d')]};});_0x17373c[_0x1959('0x2e')]=_[_0x1959('0x2a')](_0x580e0a,_0x1959('0x27'));_0x17373c['query']=_[_0x1959('0x2f')](_0x26a18c['query']);_0x17373c['filters']=_[_0x1959('0x30')](_0x17373c[_0x1959('0x2e')],_0x17373c[_0x1959('0x31')]);_0x5d4c8d[_0x1959('0x32')]=_[_0x1959('0x30')](_0x17373c['model'],qs[_0x1959('0x33')](_0x26a18c['query'][_0x1959('0x33')]));_0x5d4c8d[_0x1959('0x32')]=_0x5d4c8d[_0x1959('0x32')][_0x1959('0x34')]?_0x5d4c8d[_0x1959('0x32')]:_0x17373c[_0x1959('0x2e')];if(!_0x26a18c[_0x1959('0x31')][_0x1959('0x35')](_0x1959('0x36'))){_0x5d4c8d['limit']=qs[_0x1959('0x1e')](_0x26a18c['query'][_0x1959('0x1e')]);_0x5d4c8d['offset']=qs['offset'](_0x26a18c[_0x1959('0x31')][_0x1959('0x1c')]);}_0x5d4c8d['order']=qs['sort'](_0x26a18c[_0x1959('0x31')][_0x1959('0x37')]);_0x5d4c8d[_0x1959('0x38')]=qs[_0x1959('0x39')](_[_0x1959('0x3a')](_0x26a18c[_0x1959('0x31')],_0x17373c[_0x1959('0x39')]),_0x580e0a);if(_0x26a18c[_0x1959('0x31')][_0x1959('0x3b')]){_0x5d4c8d['where']=_['merge'](_0x5d4c8d[_0x1959('0x38')],{'$or':_['map'](_0x580e0a,function(_0x449968){if(_0x449968[_0x1959('0x2c')]!==_0x1959('0x3c')){var _0x1b7b85={};_0x1b7b85[_0x449968[_0x1959('0x27')]]={'$like':'%'+_0x26a18c[_0x1959('0x31')]['filter']+'%'};return _0x1b7b85;}})});}_0x5d4c8d=_[_0x1959('0x3d')]({},_0x5d4c8d,_0x26a18c[_0x1959('0x3e')]);var _0x41cebc={'where':_0x5d4c8d[_0x1959('0x38')]};return db['OpenchannelTransferReport'][_0x1959('0x1f')](_0x41cebc)[_0x1959('0x26')](function(_0x1d41ea){_0x15cd8b[_0x1959('0x1f')]=_0x1d41ea;if(_0x26a18c[_0x1959('0x31')][_0x1959('0x3f')]){_0x5d4c8d[_0x1959('0x40')]=[{'all':!![]}];}return db[_0x1959('0x41')]['findAll'](_0x5d4c8d);})[_0x1959('0x26')](function(_0x482df2){_0x15cd8b['rows']=_0x482df2;return _0x15cd8b;})[_0x1959('0x26')](respondWithFilteredResult(_0x3b309b,_0x5d4c8d))[_0x1959('0x42')](handleError(_0x3b309b,null));};exports['show']=function(_0x517252,_0x409345){var _0xbbb3a1={'raw':!![],'where':{'id':_0x517252[_0x1959('0x43')]['id']}},_0x41eec6={};_0x41eec6[_0x1959('0x2e')]=_[_0x1959('0x2f')](db['OpenchannelTransferReport']['rawAttributes']);_0x41eec6[_0x1959('0x31')]=_[_0x1959('0x2f')](_0x517252['query']);_0x41eec6[_0x1959('0x39')]=_[_0x1959('0x30')](_0x41eec6['model'],_0x41eec6[_0x1959('0x31')]);_0xbbb3a1[_0x1959('0x32')]=_[_0x1959('0x30')](_0x41eec6[_0x1959('0x2e')],qs[_0x1959('0x33')](_0x517252[_0x1959('0x31')][_0x1959('0x33')]));_0xbbb3a1[_0x1959('0x32')]=_0xbbb3a1['attributes'][_0x1959('0x34')]?_0xbbb3a1[_0x1959('0x32')]:_0x41eec6[_0x1959('0x2e')];if(_0x517252[_0x1959('0x31')][_0x1959('0x3f')]){_0xbbb3a1['include']=[{'all':!![]}];}_0xbbb3a1=_[_0x1959('0x3d')]({},_0xbbb3a1,_0x517252[_0x1959('0x3e')]);return db[_0x1959('0x41')]['find'](_0xbbb3a1)[_0x1959('0x26')](handleEntityNotFound(_0x409345,null))[_0x1959('0x26')](respondWithResult(_0x409345,null))[_0x1959('0x42')](handleError(_0x409345,null));};exports[_0x1959('0x44')]=function(_0x58b970,_0x4247fd){return db['OpenchannelTransferReport'][_0x1959('0x44')](_0x58b970[_0x1959('0x45')],{})[_0x1959('0x26')](respondWithResult(_0x4247fd,0xc9))[_0x1959('0x42')](handleError(_0x4247fd,null));};exports[_0x1959('0x25')]=function(_0x1b606d,_0x94ab74){if(_0x1b606d['body']['id']){delete _0x1b606d[_0x1959('0x45')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x1b606d['params']['id']}})['then'](handleEntityNotFound(_0x94ab74,null))[_0x1959('0x26')](saveUpdates(_0x1b606d['body'],null))[_0x1959('0x26')](respondWithResult(_0x94ab74,null))[_0x1959('0x42')](handleError(_0x94ab74,null));};exports['destroy']=function(_0x13f97a,_0x1de111){return db[_0x1959('0x41')]['find']({'where':{'id':_0x13f97a[_0x1959('0x43')]['id']}})[_0x1959('0x26')](handleEntityNotFound(_0x1de111,null))[_0x1959('0x26')](removeEntity(_0x1de111,null))[_0x1959('0x42')](handleError(_0x1de111,null));};exports[_0x1959('0x46')]=function(_0x2997ea,_0x25ed17){return db[_0x1959('0x41')]['describe']()[_0x1959('0x26')](respondWithResult(_0x25ed17,null))[_0x1959('0x42')](handleError(_0x25ed17,null));}; \ No newline at end of file +var _0x9856=['Content-Range','apply','reject','then','destroy','end','sendStatus','error','stack','name','send','index','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','OpenchannelTransferReport','findAll','params','include','options','find','catch','create','update','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set'];(function(_0x14febd,_0x40a5ec){var _0x1dc82e=function(_0x11c524){while(--_0x11c524){_0x14febd['push'](_0x14febd['shift']());}};_0x1dc82e(++_0x40a5ec);}(_0x9856,0xc7));var _0x6985=function(_0x1c1d63,_0x1d82b7){_0x1c1d63=_0x1c1d63-0x0;var _0x1e9eb4=_0x9856[_0x1c1d63];return _0x1e9eb4;};'use strict';var emlformat=require(_0x6985('0x0'));var rimraf=require(_0x6985('0x1'));var zipdir=require(_0x6985('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6985('0x3'));var moment=require(_0x6985('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6985('0x5'));var util=require(_0x6985('0x6'));var path=require(_0x6985('0x7'));var sox=require(_0x6985('0x8'));var csv=require(_0x6985('0x9'));var ejs=require(_0x6985('0xa'));var fs=require('fs');var fs_extra=require(_0x6985('0xb'));var _=require(_0x6985('0xc'));var squel=require(_0x6985('0xd'));var crypto=require('crypto');var jsforce=require(_0x6985('0xe'));var deskjs=require(_0x6985('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6985('0x10'));var Redis=require(_0x6985('0x11'));var authService=require(_0x6985('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6985('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6985('0x14'))(_0x6985('0x15'));var utils=require(_0x6985('0x16'));var config=require(_0x6985('0x17'));var licenseUtil=require(_0x6985('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9e6881,_0x462d78){_0x462d78=_0x462d78||0xcc;return function(_0x23e624){if(_0x23e624){return _0x9e6881['sendStatus'](_0x462d78);}return _0x9e6881[_0x6985('0x19')](_0x462d78)['end']();};}function respondWithResult(_0x110ac9,_0x466b82){_0x466b82=_0x466b82||0xc8;return function(_0x158d92){if(_0x158d92){return _0x110ac9[_0x6985('0x19')](_0x466b82)[_0x6985('0x1a')](_0x158d92);}};}function respondWithFilteredResult(_0x16d72a,_0x1682d9){return function(_0x591008){if(_0x591008){var _0x4697bc=typeof _0x1682d9[_0x6985('0x1b')]===_0x6985('0x1c')&&typeof _0x1682d9[_0x6985('0x1d')]===_0x6985('0x1c');var _0x1fc34c=_0x591008[_0x6985('0x1e')];var _0x538752=_0x4697bc?0x0:_0x1682d9[_0x6985('0x1b')];var _0x1604e5=_0x4697bc?_0x591008[_0x6985('0x1e')]:_0x1682d9[_0x6985('0x1b')]+_0x1682d9[_0x6985('0x1d')];var _0x30e2b4;if(_0x1604e5>=_0x1fc34c){_0x1604e5=_0x1fc34c;_0x30e2b4=0xc8;}else{_0x30e2b4=0xce;}_0x16d72a[_0x6985('0x19')](_0x30e2b4);return _0x16d72a[_0x6985('0x1f')](_0x6985('0x20'),_0x538752+'-'+_0x1604e5+'/'+_0x1fc34c)[_0x6985('0x1a')](_0x591008);}return null;};}function patchUpdates(_0x422fc8){return function(_0x3c80e2){try{jsonpatch[_0x6985('0x21')](_0x3c80e2,_0x422fc8,!![]);}catch(_0x145625){return BPromise[_0x6985('0x22')](_0x145625);}return _0x3c80e2['save']();};}function saveUpdates(_0x290d24,_0x1c2f5f){return function(_0x46b8e6){if(_0x46b8e6){return _0x46b8e6['update'](_0x290d24)[_0x6985('0x23')](function(_0x1804d5){return _0x1804d5;});}return null;};}function removeEntity(_0x5594e7,_0x489a0f){return function(_0x38c247){if(_0x38c247){return _0x38c247[_0x6985('0x24')]()[_0x6985('0x23')](function(){_0x5594e7[_0x6985('0x19')](0xcc)[_0x6985('0x25')]();});}};}function handleEntityNotFound(_0x1edeb8,_0x211b3f){return function(_0x36c8cd){if(!_0x36c8cd){_0x1edeb8[_0x6985('0x26')](0x194);}return _0x36c8cd;};}function handleError(_0x960e66,_0x553ab3){_0x553ab3=_0x553ab3||0x1f4;return function(_0x215892){logger[_0x6985('0x27')](_0x215892[_0x6985('0x28')]);if(_0x215892[_0x6985('0x29')]){delete _0x215892[_0x6985('0x29')];}_0x960e66[_0x6985('0x19')](_0x553ab3)[_0x6985('0x2a')](_0x215892);};}exports[_0x6985('0x2b')]=function(_0x2f8bf1,_0x1a2c50){var _0x45e895={},_0xd4195={},_0x329a76={'count':0x0,'rows':[]};var _0x536a46=_['map'](db['OpenchannelTransferReport'][_0x6985('0x2c')],function(_0x5a73b3){return{'name':_0x5a73b3['fieldName'],'type':_0x5a73b3['type'][_0x6985('0x2d')]};});_0xd4195[_0x6985('0x2e')]=_[_0x6985('0x2f')](_0x536a46,_0x6985('0x29'));_0xd4195[_0x6985('0x30')]=_[_0x6985('0x31')](_0x2f8bf1['query']);_0xd4195[_0x6985('0x32')]=_[_0x6985('0x33')](_0xd4195['model'],_0xd4195['query']);_0x45e895[_0x6985('0x34')]=_[_0x6985('0x33')](_0xd4195['model'],qs[_0x6985('0x35')](_0x2f8bf1['query'][_0x6985('0x35')]));_0x45e895[_0x6985('0x34')]=_0x45e895[_0x6985('0x34')][_0x6985('0x36')]?_0x45e895[_0x6985('0x34')]:_0xd4195['model'];if(!_0x2f8bf1[_0x6985('0x30')][_0x6985('0x37')](_0x6985('0x38'))){_0x45e895[_0x6985('0x1d')]=qs[_0x6985('0x1d')](_0x2f8bf1['query'][_0x6985('0x1d')]);_0x45e895[_0x6985('0x1b')]=qs[_0x6985('0x1b')](_0x2f8bf1[_0x6985('0x30')][_0x6985('0x1b')]);}_0x45e895[_0x6985('0x39')]=qs[_0x6985('0x3a')](_0x2f8bf1[_0x6985('0x30')][_0x6985('0x3a')]);_0x45e895[_0x6985('0x3b')]=qs['filters'](_[_0x6985('0x3c')](_0x2f8bf1[_0x6985('0x30')],_0xd4195[_0x6985('0x32')]),_0x536a46);if(_0x2f8bf1[_0x6985('0x30')][_0x6985('0x3d')]){_0x45e895[_0x6985('0x3b')]=_[_0x6985('0x3e')](_0x45e895[_0x6985('0x3b')],{'$or':_['map'](_0x536a46,function(_0x388312){if(_0x388312[_0x6985('0x3f')]!==_0x6985('0x40')){var _0xf54f8e={};_0xf54f8e[_0x388312[_0x6985('0x29')]]={'$like':'%'+_0x2f8bf1['query']['filter']+'%'};return _0xf54f8e;}})});}_0x45e895=_['merge']({},_0x45e895,_0x2f8bf1['options']);var _0xe8d56d={'where':_0x45e895[_0x6985('0x3b')]};return db['OpenchannelTransferReport']['count'](_0xe8d56d)[_0x6985('0x23')](function(_0x31f46c){_0x329a76[_0x6985('0x1e')]=_0x31f46c;if(_0x2f8bf1['query'][_0x6985('0x41')]){_0x45e895['include']=[{'all':!![]}];}return db[_0x6985('0x42')][_0x6985('0x43')](_0x45e895);})['then'](function(_0x115058){_0x329a76['rows']=_0x115058;return _0x329a76;})[_0x6985('0x23')](respondWithFilteredResult(_0x1a2c50,_0x45e895))['catch'](handleError(_0x1a2c50,null));};exports['show']=function(_0x441a6f,_0x43d660){var _0xaca0b2={'raw':!![],'where':{'id':_0x441a6f[_0x6985('0x44')]['id']}},_0x222f3f={};_0x222f3f[_0x6985('0x2e')]=_[_0x6985('0x31')](db['OpenchannelTransferReport'][_0x6985('0x2c')]);_0x222f3f[_0x6985('0x30')]=_[_0x6985('0x31')](_0x441a6f[_0x6985('0x30')]);_0x222f3f['filters']=_['intersection'](_0x222f3f[_0x6985('0x2e')],_0x222f3f[_0x6985('0x30')]);_0xaca0b2[_0x6985('0x34')]=_[_0x6985('0x33')](_0x222f3f[_0x6985('0x2e')],qs[_0x6985('0x35')](_0x441a6f[_0x6985('0x30')][_0x6985('0x35')]));_0xaca0b2[_0x6985('0x34')]=_0xaca0b2[_0x6985('0x34')]['length']?_0xaca0b2[_0x6985('0x34')]:_0x222f3f[_0x6985('0x2e')];if(_0x441a6f[_0x6985('0x30')][_0x6985('0x41')]){_0xaca0b2[_0x6985('0x45')]=[{'all':!![]}];}_0xaca0b2=_[_0x6985('0x3e')]({},_0xaca0b2,_0x441a6f[_0x6985('0x46')]);return db[_0x6985('0x42')][_0x6985('0x47')](_0xaca0b2)[_0x6985('0x23')](handleEntityNotFound(_0x43d660,null))['then'](respondWithResult(_0x43d660,null))[_0x6985('0x48')](handleError(_0x43d660,null));};exports['create']=function(_0x4e1582,_0x184314){return db[_0x6985('0x42')][_0x6985('0x49')](_0x4e1582['body'],{})[_0x6985('0x23')](respondWithResult(_0x184314,0xc9))[_0x6985('0x48')](handleError(_0x184314,null));};exports[_0x6985('0x4a')]=function(_0x173fff,_0x26ea30){if(_0x173fff[_0x6985('0x4b')]['id']){delete _0x173fff[_0x6985('0x4b')]['id'];}return db[_0x6985('0x42')][_0x6985('0x47')]({'where':{'id':_0x173fff[_0x6985('0x44')]['id']}})[_0x6985('0x23')](handleEntityNotFound(_0x26ea30,null))[_0x6985('0x23')](saveUpdates(_0x173fff['body'],null))[_0x6985('0x23')](respondWithResult(_0x26ea30,null))['catch'](handleError(_0x26ea30,null));};exports[_0x6985('0x24')]=function(_0x4583b0,_0x39eb65){return db[_0x6985('0x42')][_0x6985('0x47')]({'where':{'id':_0x4583b0[_0x6985('0x44')]['id']}})[_0x6985('0x23')](handleEntityNotFound(_0x39eb65,null))[_0x6985('0x23')](removeEntity(_0x39eb65,null))[_0x6985('0x48')](handleError(_0x39eb65,null));};exports[_0x6985('0x4c')]=function(_0x12b1fe,_0x361e21){return db[_0x6985('0x42')][_0x6985('0x4c')]()[_0x6985('0x23')](respondWithResult(_0x361e21,null))['catch'](handleError(_0x361e21,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 2dfb373..603a9c6 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 _0x0b1a=['exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./openchannelTransferReport.attributes'];(function(_0x154192,_0x2d360f){var _0x3c2792=function(_0x2e257b){while(--_0x2e257b){_0x154192['push'](_0x154192['shift']());}};_0x3c2792(++_0x2d360f);}(_0x0b1a,0x14a));var _0xa0b1=function(_0x5c81f9,_0x37498f){_0x5c81f9=_0x5c81f9-0x0;var _0x3dee7e=_0x0b1a[_0x5c81f9];return _0x3dee7e;};'use strict';var _=require(_0xa0b1('0x0'));var util=require(_0xa0b1('0x1'));var logger=require('../../config/logger')(_0xa0b1('0x2'));var moment=require('moment');var BPromise=require(_0xa0b1('0x3'));var rp=require(_0xa0b1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa0b1('0x5'));var config=require(_0xa0b1('0x6'));var attributes=require(_0xa0b1('0x7'));module[_0xa0b1('0x8')]=function(_0x359077,_0x4fdffd){return _0x359077[_0xa0b1('0x9')](_0xa0b1('0xa'),attributes,{'tableName':_0xa0b1('0xb'),'paranoid':![],'indexes':[{'name':_0xa0b1('0xc'),'fields':[_0xa0b1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5be9=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x189b20,_0x4ef2e7){var _0x491140=function(_0x57ee5a){while(--_0x57ee5a){_0x189b20['push'](_0x189b20['shift']());}};_0x491140(++_0x4ef2e7);}(_0x5be9,0x13e));var _0x95be=function(_0x37e863,_0xf62299){_0x37e863=_0x37e863-0x0;var _0x8393f5=_0x5be9[_0x37e863];return _0x8393f5;};'use strict';var _=require(_0x95be('0x0'));var util=require(_0x95be('0x1'));var logger=require(_0x95be('0x2'))(_0x95be('0x3'));var moment=require('moment');var BPromise=require(_0x95be('0x4'));var rp=require(_0x95be('0x5'));var fs=require('fs');var path=require(_0x95be('0x6'));var rimraf=require(_0x95be('0x7'));var config=require(_0x95be('0x8'));var attributes=require('./openchannelTransferReport.attributes');module[_0x95be('0x9')]=function(_0x41ab2e,_0x3168eb){return _0x41ab2e[_0x95be('0xa')](_0x95be('0xb'),attributes,{'tableName':_0x95be('0xc'),'paranoid':![],'indexes':[{'name':_0x95be('0xd'),'fields':[_0x95be('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 00f9288..e76e98a 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 _0x291c=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','code'];(function(_0x378ef1,_0x25fdba){var _0x44c558=function(_0x450de2){while(--_0x450de2){_0x378ef1['push'](_0x378ef1['shift']());}};_0x44c558(++_0x25fdba);}(_0x291c,0x137));var _0xc291=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x291c[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0xc291('0x0'));var util=require(_0xc291('0x1'));var moment=require(_0xc291('0x2'));var BPromise=require(_0xc291('0x3'));var rs=require(_0xc291('0x4'));var fs=require('fs');var Redis=require(_0xc291('0x5'));var db=require(_0xc291('0x6'))['db'];var utils=require(_0xc291('0x7'));var logger=require(_0xc291('0x8'))(_0xc291('0x9'));var config=require(_0xc291('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc291('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a7459,_0x40dc89,_0x2d3526){return new BPromise(function(_0x42a6ac,_0x26e775){return client['request'](_0x5a7459,_0x2d3526)[_0xc291('0xc')](function(_0x2beb3b){logger[_0xc291('0xd')](_0xc291('0xe'),_0x40dc89,_0xc291('0xf'));logger[_0xc291('0x10')](_0xc291('0x11'),_0x40dc89,_0xc291('0xf'),JSON['stringify'](_0x2beb3b));if(_0x2beb3b['error']){if(_0x2beb3b['error'][_0xc291('0x12')]===0x1f4){logger[_0xc291('0x13')](_0xc291('0xe'),_0x40dc89,_0x2beb3b['error'][_0xc291('0x14')]);return _0x26e775(_0x2beb3b['error'][_0xc291('0x14')]);}logger[_0xc291('0x13')](_0xc291('0xe'),_0x40dc89,_0x2beb3b[_0xc291('0x13')][_0xc291('0x14')]);return _0x42a6ac(_0x2beb3b[_0xc291('0x13')][_0xc291('0x14')]);}else{logger[_0xc291('0xd')](_0xc291('0xe'),_0x40dc89,_0xc291('0xf'));_0x42a6ac(_0x2beb3b['result'][_0xc291('0x14')]);}})[_0xc291('0x15')](function(_0x5888de){logger[_0xc291('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x40dc89,_0x5888de);_0x26e775(_0x5888de);});});} \ No newline at end of file +var _0x291c=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','code'];(function(_0x2b0126,_0x542c8d){var _0x5bd6ad=function(_0xe82a77){while(--_0xe82a77){_0x2b0126['push'](_0x2b0126['shift']());}};_0x5bd6ad(++_0x542c8d);}(_0x291c,0x137));var _0xc291=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x291c[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0xc291('0x0'));var util=require(_0xc291('0x1'));var moment=require(_0xc291('0x2'));var BPromise=require(_0xc291('0x3'));var rs=require(_0xc291('0x4'));var fs=require('fs');var Redis=require(_0xc291('0x5'));var db=require(_0xc291('0x6'))['db'];var utils=require(_0xc291('0x7'));var logger=require(_0xc291('0x8'))(_0xc291('0x9'));var config=require(_0xc291('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc291('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a7459,_0x40dc89,_0x2d3526){return new BPromise(function(_0x42a6ac,_0x26e775){return client['request'](_0x5a7459,_0x2d3526)[_0xc291('0xc')](function(_0x2beb3b){logger[_0xc291('0xd')](_0xc291('0xe'),_0x40dc89,_0xc291('0xf'));logger[_0xc291('0x10')](_0xc291('0x11'),_0x40dc89,_0xc291('0xf'),JSON['stringify'](_0x2beb3b));if(_0x2beb3b['error']){if(_0x2beb3b['error'][_0xc291('0x12')]===0x1f4){logger[_0xc291('0x13')](_0xc291('0xe'),_0x40dc89,_0x2beb3b['error'][_0xc291('0x14')]);return _0x26e775(_0x2beb3b['error'][_0xc291('0x14')]);}logger[_0xc291('0x13')](_0xc291('0xe'),_0x40dc89,_0x2beb3b[_0xc291('0x13')][_0xc291('0x14')]);return _0x42a6ac(_0x2beb3b[_0xc291('0x13')][_0xc291('0x14')]);}else{logger[_0xc291('0xd')](_0xc291('0xe'),_0x40dc89,_0xc291('0xf'));_0x42a6ac(_0x2beb3b['result'][_0xc291('0x14')]);}})[_0xc291('0x15')](function(_0x5888de){logger[_0xc291('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x40dc89,_0x5888de);_0x26e775(_0x5888de);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 3ba8c8b..45ec937 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 _0x0fc5=['delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./pause.controller','get','isAuthenticated','/:id','show','post','create','put','update'];(function(_0x429144,_0x1638d4){var _0x4c1e76=function(_0x299f6f){while(--_0x299f6f){_0x429144['push'](_0x429144['shift']());}};_0x4c1e76(++_0x1638d4);}(_0x0fc5,0x1ce));var _0x50fc=function(_0x36a786,_0x1bda30){_0x36a786=_0x36a786-0x0;var _0x4dd809=_0x0fc5[_0x36a786];return _0x4dd809;};'use strict';var multer=require(_0x50fc('0x0'));var util=require(_0x50fc('0x1'));var path=require(_0x50fc('0x2'));var timeout=require(_0x50fc('0x3'));var express=require(_0x50fc('0x4'));var router=express[_0x50fc('0x5')]();var fs_extra=require(_0x50fc('0x6'));var auth=require(_0x50fc('0x7'));var interaction=require(_0x50fc('0x8'));var config=require('../../config/environment');var controller=require(_0x50fc('0x9'));router[_0x50fc('0xa')]('/',auth[_0x50fc('0xb')](),controller['index']);router[_0x50fc('0xa')](_0x50fc('0xc'),auth[_0x50fc('0xb')](),controller[_0x50fc('0xd')]);router[_0x50fc('0xe')]('/',auth['isAuthenticated'](),controller[_0x50fc('0xf')]);router[_0x50fc('0x10')](_0x50fc('0xc'),auth['isAuthenticated'](),controller[_0x50fc('0x11')]);router[_0x50fc('0x12')](_0x50fc('0xc'),auth[_0x50fc('0xb')](),controller[_0x50fc('0x13')]);module['exports']=router; \ No newline at end of file +var _0x5e0e=['../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','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);}(_0x5e0e,0x19c));var _0xe5e0=function(_0x456919,_0x4c175d){_0x456919=_0x456919-0x0;var _0x41a512=_0x5e0e[_0x456919];return _0x41a512;};'use strict';var multer=require('multer');var util=require(_0xe5e0('0x0'));var path=require(_0xe5e0('0x1'));var timeout=require(_0xe5e0('0x2'));var express=require(_0xe5e0('0x3'));var router=express[_0xe5e0('0x4')]();var fs_extra=require(_0xe5e0('0x5'));var auth=require(_0xe5e0('0x6'));var interaction=require(_0xe5e0('0x7'));var config=require(_0xe5e0('0x8'));var controller=require(_0xe5e0('0x9'));router[_0xe5e0('0xa')]('/',auth[_0xe5e0('0xb')](),controller[_0xe5e0('0xc')]);router[_0xe5e0('0xa')](_0xe5e0('0xd'),auth[_0xe5e0('0xb')](),controller[_0xe5e0('0xe')]);router[_0xe5e0('0xf')]('/',auth[_0xe5e0('0xb')](),controller[_0xe5e0('0x10')]);router[_0xe5e0('0x11')](_0xe5e0('0xd'),auth[_0xe5e0('0xb')](),controller[_0xe5e0('0x12')]);router[_0xe5e0('0x13')]('/:id',auth[_0xe5e0('0xb')](),controller[_0xe5e0('0x14')]);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 c848a2c..afcd7f4 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 _0xc91b=['name','exports','STRING'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc91b,0xa9));var _0xbc91=function(_0x56b1b3,_0x4290f7){_0x56b1b3=_0x56b1b3-0x0;var _0x4b8f73=_0xc91b[_0x56b1b3];return _0x4b8f73;};'use strict';var Sequelize=require('sequelize');module[_0xbc91('0x0')]={'name':{'type':Sequelize[_0xbc91('0x1')],'unique':_0xbc91('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xbc91('0x1')]}}; \ No newline at end of file +var _0x19ab=['sequelize','name'];(function(_0x246115,_0x398123){var _0x385878=function(_0x534a9c){while(--_0x534a9c){_0x246115['push'](_0x246115['shift']());}};_0x385878(++_0x398123);}(_0x19ab,0x112));var _0xb19a=function(_0x5626bc,_0x20a82f){_0x5626bc=_0x5626bc-0x0;var _0x28d037=_0x19ab[_0x5626bc];return _0x28d037;};'use strict';var Sequelize=require(_0xb19a('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb19a('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 21f733e..b8b0ae0 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 _0x317f=['rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','error','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Pauses','UserProfileResource','stack','name','send','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','where','pick','filter','merge','type','VIRTUAL','options','Pause','includeAll','include','findAll'];(function(_0x25a19a,_0x536079){var _0x9d8a38=function(_0x55a45c){while(--_0x55a45c){_0x25a19a['push'](_0x25a19a['shift']());}};_0x9d8a38(++_0x536079);}(_0x317f,0x1f2));var _0xf317=function(_0x3984c6,_0x28823b){_0x3984c6=_0x3984c6-0x0;var _0x3bcc32=_0x317f[_0x3984c6];return _0x3bcc32;};'use strict';var emlformat=require(_0xf317('0x0'));var rimraf=require(_0xf317('0x1'));var zipdir=require(_0xf317('0x2'));var jsonpatch=require(_0xf317('0x3'));var rp=require(_0xf317('0x4'));var moment=require('moment');var BPromise=require(_0xf317('0x5'));var Mustache=require(_0xf317('0x6'));var util=require('util');var path=require(_0xf317('0x7'));var sox=require(_0xf317('0x8'));var csv=require(_0xf317('0x9'));var ejs=require(_0xf317('0xa'));var fs=require('fs');var fs_extra=require(_0xf317('0xb'));var _=require(_0xf317('0xc'));var squel=require(_0xf317('0xd'));var crypto=require('crypto');var jsforce=require(_0xf317('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf317('0xf'));var Papa=require(_0xf317('0x10'));var Redis=require(_0xf317('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf317('0x12'));var as=require(_0xf317('0x13'));var hardwareService=require(_0xf317('0x14'));var logger=require(_0xf317('0x15'))(_0xf317('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf317('0x17'))['db'];function respondWithStatusCode(_0x385475,_0x1f1f72){_0x1f1f72=_0x1f1f72||0xcc;return function(_0x291670){if(_0x291670){return _0x385475[_0xf317('0x18')](_0x1f1f72);}return _0x385475[_0xf317('0x19')](_0x1f1f72)[_0xf317('0x1a')]();};}function respondWithResult(_0x429ae5,_0x10b3d1){_0x10b3d1=_0x10b3d1||0xc8;return function(_0x2ec6ce){if(_0x2ec6ce){return _0x429ae5[_0xf317('0x19')](_0x10b3d1)[_0xf317('0x1b')](_0x2ec6ce);}};}function respondWithFilteredResult(_0x18d4e8,_0xa78e48){return function(_0x101245){if(_0x101245){var _0x57a882=typeof _0xa78e48[_0xf317('0x1c')]===_0xf317('0x1d')&&typeof _0xa78e48[_0xf317('0x1e')]===_0xf317('0x1d');var _0x1ba20b=_0x101245[_0xf317('0x1f')];var _0x17a876=_0x57a882?0x0:_0xa78e48[_0xf317('0x1c')];var _0x426656=_0x57a882?_0x101245[_0xf317('0x1f')]:_0xa78e48[_0xf317('0x1c')]+_0xa78e48[_0xf317('0x1e')];var _0x3dbb35;if(_0x426656>=_0x1ba20b){_0x426656=_0x1ba20b;_0x3dbb35=0xc8;}else{_0x3dbb35=0xce;}_0x18d4e8[_0xf317('0x19')](_0x3dbb35);return _0x18d4e8[_0xf317('0x20')](_0xf317('0x21'),_0x17a876+'-'+_0x426656+'/'+_0x1ba20b)[_0xf317('0x1b')](_0x101245);}return null;};}function patchUpdates(_0x144f92){return function(_0x46b6d1){try{jsonpatch[_0xf317('0x22')](_0x46b6d1,_0x144f92,!![]);}catch(_0x2dc59c){return BPromise[_0xf317('0x23')](_0x2dc59c);}return _0x46b6d1[_0xf317('0x24')]();};}function saveUpdates(_0x1c5b5b,_0x39a8cd){return function(_0x27917c){if(_0x27917c){return _0x27917c[_0xf317('0x25')](_0x1c5b5b)[_0xf317('0x26')](function(_0x3813dd){return _0x3813dd;});}return null;};}function removeEntity(_0x2aa749,_0x3a827d){return function(_0xe748a1){if(_0xe748a1){return _0xe748a1[_0xf317('0x27')]()[_0xf317('0x26')](function(){var _0x37d578=_0xe748a1[_0xf317('0x28')]({'plain':!![]});var _0x18fb37=_0xf317('0x29');return db[_0xf317('0x2a')]['destroy']({'where':{'type':_0x18fb37,'resourceId':_0x37d578['id']}})[_0xf317('0x26')](function(){return _0xe748a1;});})[_0xf317('0x26')](function(){_0x2aa749['status'](0xcc)[_0xf317('0x1a')]();});}};}function handleEntityNotFound(_0x40f988,_0x588e66){return function(_0x15c5f6){if(!_0x15c5f6){_0x40f988[_0xf317('0x18')](0x194);}return _0x15c5f6;};}function handleError(_0x213a8d,_0x121289){_0x121289=_0x121289||0x1f4;return function(_0x5ef2e6){logger['error'](_0x5ef2e6[_0xf317('0x2b')]);if(_0x5ef2e6[_0xf317('0x2c')]){delete _0x5ef2e6[_0xf317('0x2c')];}_0x213a8d[_0xf317('0x19')](_0x121289)[_0xf317('0x2d')](_0x5ef2e6);};}exports['index']=function(_0x4460fa,_0x50bdef){var _0x186720={},_0x37203c={},_0x11a819={'count':0x0,'rows':[]};var _0x2816a3=_[_0xf317('0x2e')](db['Pause'][_0xf317('0x2f')],function(_0xb08ba){return{'name':_0xb08ba['fieldName'],'type':_0xb08ba['type'][_0xf317('0x30')]};});_0x37203c[_0xf317('0x31')]=_[_0xf317('0x2e')](_0x2816a3,_0xf317('0x2c'));_0x37203c[_0xf317('0x32')]=_[_0xf317('0x33')](_0x4460fa[_0xf317('0x32')]);_0x37203c[_0xf317('0x34')]=_[_0xf317('0x35')](_0x37203c['model'],_0x37203c[_0xf317('0x32')]);_0x186720['attributes']=_['intersection'](_0x37203c[_0xf317('0x31')],qs['fields'](_0x4460fa[_0xf317('0x32')][_0xf317('0x36')]));_0x186720[_0xf317('0x37')]=_0x186720['attributes'][_0xf317('0x38')]?_0x186720[_0xf317('0x37')]:_0x37203c[_0xf317('0x31')];if(!_0x4460fa[_0xf317('0x32')][_0xf317('0x39')]('nolimit')){_0x186720[_0xf317('0x1e')]=qs[_0xf317('0x1e')](_0x4460fa[_0xf317('0x32')][_0xf317('0x1e')]);_0x186720[_0xf317('0x1c')]=qs['offset'](_0x4460fa['query'][_0xf317('0x1c')]);}_0x186720['order']=qs['sort'](_0x4460fa[_0xf317('0x32')]['sort']);_0x186720[_0xf317('0x3a')]=qs[_0xf317('0x34')](_[_0xf317('0x3b')](_0x4460fa[_0xf317('0x32')],_0x37203c[_0xf317('0x34')]),_0x2816a3);if(_0x4460fa[_0xf317('0x32')][_0xf317('0x3c')]){_0x186720[_0xf317('0x3a')]=_[_0xf317('0x3d')](_0x186720[_0xf317('0x3a')],{'$or':_['map'](_0x2816a3,function(_0x576693){if(_0x576693[_0xf317('0x3e')]!==_0xf317('0x3f')){var _0x57f213={};_0x57f213[_0x576693['name']]={'$like':'%'+_0x4460fa[_0xf317('0x32')][_0xf317('0x3c')]+'%'};return _0x57f213;}})});}_0x186720=_[_0xf317('0x3d')]({},_0x186720,_0x4460fa[_0xf317('0x40')]);var _0x31f556={'where':_0x186720[_0xf317('0x3a')]};return db[_0xf317('0x41')]['count'](_0x31f556)[_0xf317('0x26')](function(_0x2b3ef0){_0x11a819['count']=_0x2b3ef0;if(_0x4460fa[_0xf317('0x32')][_0xf317('0x42')]){_0x186720[_0xf317('0x43')]=[{'all':!![]}];}return db[_0xf317('0x41')][_0xf317('0x44')](_0x186720);})['then'](function(_0x1e1bfc){_0x11a819[_0xf317('0x45')]=_0x1e1bfc;return _0x11a819;})[_0xf317('0x26')](respondWithFilteredResult(_0x50bdef,_0x186720))[_0xf317('0x46')](handleError(_0x50bdef,null));};exports[_0xf317('0x47')]=function(_0x5e85b7,_0x11944c){var _0x163abb={'raw':!![],'where':{'id':_0x5e85b7[_0xf317('0x48')]['id']}},_0x430f89={};_0x430f89[_0xf317('0x31')]=_[_0xf317('0x33')](db[_0xf317('0x41')]['rawAttributes']);_0x430f89[_0xf317('0x32')]=_[_0xf317('0x33')](_0x5e85b7[_0xf317('0x32')]);_0x430f89[_0xf317('0x34')]=_['intersection'](_0x430f89[_0xf317('0x31')],_0x430f89[_0xf317('0x32')]);_0x163abb[_0xf317('0x37')]=_[_0xf317('0x35')](_0x430f89[_0xf317('0x31')],qs[_0xf317('0x36')](_0x5e85b7['query']['fields']));_0x163abb[_0xf317('0x37')]=_0x163abb[_0xf317('0x37')][_0xf317('0x38')]?_0x163abb[_0xf317('0x37')]:_0x430f89[_0xf317('0x31')];if(_0x5e85b7[_0xf317('0x32')][_0xf317('0x42')]){_0x163abb['include']=[{'all':!![]}];}_0x163abb=_[_0xf317('0x3d')]({},_0x163abb,_0x5e85b7['options']);return db[_0xf317('0x41')]['find'](_0x163abb)[_0xf317('0x26')](handleEntityNotFound(_0x11944c,null))[_0xf317('0x26')](respondWithResult(_0x11944c,null))[_0xf317('0x46')](handleError(_0x11944c,null));};exports[_0xf317('0x49')]=function(_0x417381,_0x1d7582){return db[_0xf317('0x41')][_0xf317('0x49')](_0x417381[_0xf317('0x4a')],{})[_0xf317('0x26')](function(_0x58903c){var _0x2086ad=_0x417381[_0xf317('0x4b')]['get']({'plain':!![]});if(!_0x2086ad)throw new Error(_0xf317('0x4c'));if(_0x2086ad[_0xf317('0x4d')]==='user'){var _0x79fad1=_0x58903c[_0xf317('0x28')]({'plain':!![]});var _0xbc107=_0xf317('0x29');return db['UserProfileSection'][_0xf317('0x4e')]({'where':{'name':_0xbc107,'userProfileId':_0x2086ad[_0xf317('0x4f')]},'raw':!![]})[_0xf317('0x26')](function(_0x90076c){if(_0x90076c&&_0x90076c['autoAssociation']===0x0){return db['UserProfileResource'][_0xf317('0x49')]({'name':_0x79fad1[_0xf317('0x2c')],'resourceId':_0x79fad1['id'],'type':_0x90076c[_0xf317('0x2c')],'sectionId':_0x90076c['id']},{})[_0xf317('0x26')](function(){return _0x58903c;});}else{return _0x58903c;}})['catch'](function(_0x3eaa8c){logger[_0xf317('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3eaa8c);throw _0x3eaa8c;});}return _0x58903c;})[_0xf317('0x26')](respondWithResult(_0x1d7582,0xc9))[_0xf317('0x46')](handleError(_0x1d7582,null));};exports[_0xf317('0x25')]=function(_0x3e7fd9,_0x319936){if(_0x3e7fd9['body']['id']){delete _0x3e7fd9['body']['id'];}return db[_0xf317('0x41')][_0xf317('0x4e')]({'where':{'id':_0x3e7fd9[_0xf317('0x48')]['id']}})['then'](handleEntityNotFound(_0x319936,null))[_0xf317('0x26')](saveUpdates(_0x3e7fd9[_0xf317('0x4a')],null))[_0xf317('0x26')](respondWithResult(_0x319936,null))['catch'](handleError(_0x319936,null));};exports['destroy']=function(_0x583b6f,_0x4b60ff){return db[_0xf317('0x41')][_0xf317('0x4e')]({'where':{'id':_0x583b6f[_0xf317('0x48')]['id']}})[_0xf317('0x26')](handleEntityNotFound(_0x4b60ff,null))[_0xf317('0x26')](removeEntity(_0x4b60ff,null))[_0xf317('0x46')](handleError(_0x4b60ff,null));}; \ No newline at end of file +var _0x80a0=['fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','Pauses','UserProfileResource','error','name','send','index','map','Pause','rawAttributes'];(function(_0x3a595a,_0x2f2d64){var _0x4721e2=function(_0x1aff1e){while(--_0x1aff1e){_0x3a595a['push'](_0x3a595a['shift']());}};_0x4721e2(++_0x2f2d64);}(_0x80a0,0x77));var _0x080a=function(_0x3da733,_0x22aac9){_0x3da733=_0x3da733-0x0;var _0x136d5b=_0x80a0[_0x3da733];return _0x136d5b;};'use strict';var emlformat=require(_0x080a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x080a('0x1'));var jsonpatch=require(_0x080a('0x2'));var rp=require('request-promise');var moment=require(_0x080a('0x3'));var BPromise=require(_0x080a('0x4'));var Mustache=require(_0x080a('0x5'));var util=require(_0x080a('0x6'));var path=require(_0x080a('0x7'));var sox=require('sox');var csv=require(_0x080a('0x8'));var ejs=require(_0x080a('0x9'));var fs=require('fs');var fs_extra=require(_0x080a('0xa'));var _=require(_0x080a('0xb'));var squel=require(_0x080a('0xc'));var crypto=require(_0x080a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x080a('0x8'));var querystring=require(_0x080a('0xe'));var Papa=require(_0x080a('0xf'));var Redis=require(_0x080a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x080a('0x11'));var as=require(_0x080a('0x12'));var hardwareService=require(_0x080a('0x13'));var logger=require(_0x080a('0x14'))(_0x080a('0x15'));var utils=require(_0x080a('0x16'));var config=require(_0x080a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x080a('0x18'))['db'];function respondWithStatusCode(_0x26496e,_0x329cfe){_0x329cfe=_0x329cfe||0xcc;return function(_0x5cd47e){if(_0x5cd47e){return _0x26496e[_0x080a('0x19')](_0x329cfe);}return _0x26496e[_0x080a('0x1a')](_0x329cfe)[_0x080a('0x1b')]();};}function respondWithResult(_0x32a77f,_0x29d711){_0x29d711=_0x29d711||0xc8;return function(_0x2bf9e8){if(_0x2bf9e8){return _0x32a77f[_0x080a('0x1a')](_0x29d711)[_0x080a('0x1c')](_0x2bf9e8);}};}function respondWithFilteredResult(_0x4ecfdf,_0x20cc98){return function(_0x273c53){if(_0x273c53){var _0x2c89d7=typeof _0x20cc98['offset']===_0x080a('0x1d')&&typeof _0x20cc98['limit']==='undefined';var _0x19ebfd=_0x273c53[_0x080a('0x1e')];var _0x11f085=_0x2c89d7?0x0:_0x20cc98['offset'];var _0x39d787=_0x2c89d7?_0x273c53[_0x080a('0x1e')]:_0x20cc98[_0x080a('0x1f')]+_0x20cc98[_0x080a('0x20')];var _0x3cef5a;if(_0x39d787>=_0x19ebfd){_0x39d787=_0x19ebfd;_0x3cef5a=0xc8;}else{_0x3cef5a=0xce;}_0x4ecfdf[_0x080a('0x1a')](_0x3cef5a);return _0x4ecfdf[_0x080a('0x21')](_0x080a('0x22'),_0x11f085+'-'+_0x39d787+'/'+_0x19ebfd)[_0x080a('0x1c')](_0x273c53);}return null;};}function patchUpdates(_0x57d9b8){return function(_0x3328fd){try{jsonpatch['apply'](_0x3328fd,_0x57d9b8,!![]);}catch(_0x8022b4){return BPromise[_0x080a('0x23')](_0x8022b4);}return _0x3328fd[_0x080a('0x24')]();};}function saveUpdates(_0x58659a,_0x5f327){return function(_0x4dd797){if(_0x4dd797){return _0x4dd797['update'](_0x58659a)[_0x080a('0x25')](function(_0x18235c){return _0x18235c;});}return null;};}function removeEntity(_0x3061a1,_0x345386){return function(_0x40281b){if(_0x40281b){return _0x40281b[_0x080a('0x26')]()[_0x080a('0x25')](function(){var _0x4655dd=_0x40281b[_0x080a('0x27')]({'plain':!![]});var _0x4bc4dc=_0x080a('0x28');return db[_0x080a('0x29')][_0x080a('0x26')]({'where':{'type':_0x4bc4dc,'resourceId':_0x4655dd['id']}})[_0x080a('0x25')](function(){return _0x40281b;});})[_0x080a('0x25')](function(){_0x3061a1[_0x080a('0x1a')](0xcc)[_0x080a('0x1b')]();});}};}function handleEntityNotFound(_0xbe178f,_0xf72d74){return function(_0xc5fad7){if(!_0xc5fad7){_0xbe178f[_0x080a('0x19')](0x194);}return _0xc5fad7;};}function handleError(_0x19746c,_0x5da6f5){_0x5da6f5=_0x5da6f5||0x1f4;return function(_0xdb8b18){logger[_0x080a('0x2a')](_0xdb8b18['stack']);if(_0xdb8b18[_0x080a('0x2b')]){delete _0xdb8b18[_0x080a('0x2b')];}_0x19746c[_0x080a('0x1a')](_0x5da6f5)[_0x080a('0x2c')](_0xdb8b18);};}exports[_0x080a('0x2d')]=function(_0x2f76ab,_0x5dd6fb){var _0x23af59={},_0x11c818={},_0x2c84b7={'count':0x0,'rows':[]};var _0x244761=_[_0x080a('0x2e')](db[_0x080a('0x2f')][_0x080a('0x30')],function(_0x59859b){return{'name':_0x59859b[_0x080a('0x31')],'type':_0x59859b[_0x080a('0x32')][_0x080a('0x33')]};});_0x11c818[_0x080a('0x34')]=_['map'](_0x244761,'name');_0x11c818[_0x080a('0x35')]=_[_0x080a('0x36')](_0x2f76ab[_0x080a('0x35')]);_0x11c818['filters']=_['intersection'](_0x11c818['model'],_0x11c818[_0x080a('0x35')]);_0x23af59[_0x080a('0x37')]=_[_0x080a('0x38')](_0x11c818[_0x080a('0x34')],qs[_0x080a('0x39')](_0x2f76ab[_0x080a('0x35')]['fields']));_0x23af59[_0x080a('0x37')]=_0x23af59[_0x080a('0x37')][_0x080a('0x3a')]?_0x23af59[_0x080a('0x37')]:_0x11c818[_0x080a('0x34')];if(!_0x2f76ab['query'][_0x080a('0x3b')](_0x080a('0x3c'))){_0x23af59[_0x080a('0x20')]=qs[_0x080a('0x20')](_0x2f76ab['query'][_0x080a('0x20')]);_0x23af59[_0x080a('0x1f')]=qs['offset'](_0x2f76ab[_0x080a('0x35')][_0x080a('0x1f')]);}_0x23af59[_0x080a('0x3d')]=qs[_0x080a('0x3e')](_0x2f76ab[_0x080a('0x35')]['sort']);_0x23af59[_0x080a('0x3f')]=qs[_0x080a('0x40')](_[_0x080a('0x41')](_0x2f76ab[_0x080a('0x35')],_0x11c818[_0x080a('0x40')]),_0x244761);if(_0x2f76ab[_0x080a('0x35')][_0x080a('0x42')]){_0x23af59[_0x080a('0x3f')]=_[_0x080a('0x43')](_0x23af59['where'],{'$or':_[_0x080a('0x2e')](_0x244761,function(_0x416c85){if(_0x416c85[_0x080a('0x32')]!==_0x080a('0x44')){var _0x59d2ca={};_0x59d2ca[_0x416c85[_0x080a('0x2b')]]={'$like':'%'+_0x2f76ab[_0x080a('0x35')][_0x080a('0x42')]+'%'};return _0x59d2ca;}})});}_0x23af59=_[_0x080a('0x43')]({},_0x23af59,_0x2f76ab[_0x080a('0x45')]);var _0x2dc77={'where':_0x23af59[_0x080a('0x3f')]};return db[_0x080a('0x2f')][_0x080a('0x1e')](_0x2dc77)[_0x080a('0x25')](function(_0x471331){_0x2c84b7[_0x080a('0x1e')]=_0x471331;if(_0x2f76ab[_0x080a('0x35')][_0x080a('0x46')]){_0x23af59[_0x080a('0x47')]=[{'all':!![]}];}return db[_0x080a('0x2f')][_0x080a('0x48')](_0x23af59);})['then'](function(_0x3dda38){_0x2c84b7[_0x080a('0x49')]=_0x3dda38;return _0x2c84b7;})[_0x080a('0x25')](respondWithFilteredResult(_0x5dd6fb,_0x23af59))['catch'](handleError(_0x5dd6fb,null));};exports['show']=function(_0x411afa,_0x520346){var _0x417a39={'raw':!![],'where':{'id':_0x411afa['params']['id']}},_0x208c70={};_0x208c70[_0x080a('0x34')]=_[_0x080a('0x36')](db[_0x080a('0x2f')][_0x080a('0x30')]);_0x208c70[_0x080a('0x35')]=_[_0x080a('0x36')](_0x411afa[_0x080a('0x35')]);_0x208c70[_0x080a('0x40')]=_[_0x080a('0x38')](_0x208c70[_0x080a('0x34')],_0x208c70['query']);_0x417a39[_0x080a('0x37')]=_[_0x080a('0x38')](_0x208c70[_0x080a('0x34')],qs[_0x080a('0x39')](_0x411afa['query'][_0x080a('0x39')]));_0x417a39['attributes']=_0x417a39[_0x080a('0x37')]['length']?_0x417a39[_0x080a('0x37')]:_0x208c70['model'];if(_0x411afa[_0x080a('0x35')][_0x080a('0x46')]){_0x417a39[_0x080a('0x47')]=[{'all':!![]}];}_0x417a39=_[_0x080a('0x43')]({},_0x417a39,_0x411afa[_0x080a('0x45')]);return db[_0x080a('0x2f')][_0x080a('0x4a')](_0x417a39)[_0x080a('0x25')](handleEntityNotFound(_0x520346,null))[_0x080a('0x25')](respondWithResult(_0x520346,null))['catch'](handleError(_0x520346,null));};exports[_0x080a('0x4b')]=function(_0x4f8be0,_0x1f6636){return db[_0x080a('0x2f')][_0x080a('0x4b')](_0x4f8be0[_0x080a('0x4c')],{})['then'](function(_0x3b488a){var _0x26c20b=_0x4f8be0[_0x080a('0x4d')]['get']({'plain':!![]});if(!_0x26c20b)throw new Error(_0x080a('0x4e'));if(_0x26c20b['role']==='user'){var _0x12d35f=_0x3b488a[_0x080a('0x27')]({'plain':!![]});var _0x3b44a3='Pauses';return db['UserProfileSection'][_0x080a('0x4a')]({'where':{'name':_0x3b44a3,'userProfileId':_0x26c20b[_0x080a('0x4f')]},'raw':!![]})[_0x080a('0x25')](function(_0x2f7f06){if(_0x2f7f06&&_0x2f7f06[_0x080a('0x50')]===0x0){return db[_0x080a('0x29')][_0x080a('0x4b')]({'name':_0x12d35f[_0x080a('0x2b')],'resourceId':_0x12d35f['id'],'type':_0x2f7f06['name'],'sectionId':_0x2f7f06['id']},{})[_0x080a('0x25')](function(){return _0x3b488a;});}else{return _0x3b488a;}})[_0x080a('0x51')](function(_0x3a95f7){logger['error'](_0x080a('0x52'),_0x3a95f7);throw _0x3a95f7;});}return _0x3b488a;})[_0x080a('0x25')](respondWithResult(_0x1f6636,0xc9))[_0x080a('0x51')](handleError(_0x1f6636,null));};exports['update']=function(_0x533eb8,_0x1aa553){if(_0x533eb8[_0x080a('0x4c')]['id']){delete _0x533eb8[_0x080a('0x4c')]['id'];}return db['Pause'][_0x080a('0x4a')]({'where':{'id':_0x533eb8['params']['id']}})[_0x080a('0x25')](handleEntityNotFound(_0x1aa553,null))[_0x080a('0x25')](saveUpdates(_0x533eb8[_0x080a('0x4c')],null))['then'](respondWithResult(_0x1aa553,null))['catch'](handleError(_0x1aa553,null));};exports[_0x080a('0x26')]=function(_0x40e52c,_0x35f7c7){return db['Pause'][_0x080a('0x4a')]({'where':{'id':_0x40e52c[_0x080a('0x53')]['id']}})[_0x080a('0x25')](handleEntityNotFound(_0x35f7c7,null))['then'](removeEntity(_0x35f7c7,null))[_0x080a('0x51')](handleError(_0x35f7c7,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 61625c7..283b1a5 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 _0x1cb9=['./pause.attributes','exports','define','Pause','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x240c3f,_0x463686){var _0x5bbb4a=function(_0x574eee){while(--_0x574eee){_0x240c3f['push'](_0x240c3f['shift']());}};_0x5bbb4a(++_0x463686);}(_0x1cb9,0x14e));var _0x91cb=function(_0xefbb79,_0x187f89){_0xefbb79=_0xefbb79-0x0;var _0x5dd6d6=_0x1cb9[_0xefbb79];return _0x5dd6d6;};'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 +var _0xe14b=['bluebird','path','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','moment'];(function(_0x3c2a53,_0x36697f){var _0x23517f=function(_0x573d64){while(--_0x573d64){_0x3c2a53['push'](_0x3c2a53['shift']());}};_0x23517f(++_0x36697f);}(_0xe14b,0x93));var _0xbe14=function(_0x201945,_0x4b617c){_0x201945=_0x201945-0x0;var _0x4c41e2=_0xe14b[_0x201945];return _0x4c41e2;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 5244838..5b9ba69 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x422fac,_0x479cc3){var _0x8c786a=function(_0x5db7bf){while(--_0x5db7bf){_0x422fac['push'](_0x422fac['shift']());}};_0x8c786a(++_0x479cc3);}(_0x7a54,0x106));var _0x47a5=function(_0x4fc285,_0x22aa1c){_0x4fc285=_0x4fc285-0x0;var _0x2fbe2b=_0x7a54[_0x4fc285];return _0x2fbe2b;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x189810,_0x231d78){var _0xda9c35=function(_0x3163f5){while(--_0x3163f5){_0x189810['push'](_0x189810['shift']());}};_0xda9c35(++_0x231d78);}(_0xb10b,0x12a));var _0xbb10=function(_0x3710f1,_0x4d55cf){_0x3710f1=_0x3710f1-0x0;var _0x1ef269=_0xb10b[_0x3710f1];return _0x1ef269;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 1a20714..fe47505 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 _0x524a=['show','/:id/download','diskStorage','join','root','server/files/plugins','originalname','format','basename','now','extname','post','single','file','/webhook','webhookPost','put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./plugin.controller','get','isAuthenticated','webhookGet'];(function(_0x570867,_0x4de585){var _0x301761=function(_0x34b07e){while(--_0x34b07e){_0x570867['push'](_0x570867['shift']());}};_0x301761(++_0x4de585);}(_0x524a,0xf5));var _0xa524=function(_0x4f2db7,_0x6dcb73){_0x4f2db7=_0x4f2db7-0x0;var _0xa36db5=_0x524a[_0x4f2db7];return _0xa36db5;};'use strict';var multer=require(_0xa524('0x0'));var util=require(_0xa524('0x1'));var path=require(_0xa524('0x2'));var timeout=require(_0xa524('0x3'));var express=require('express');var router=express[_0xa524('0x4')]();var fs_extra=require(_0xa524('0x5'));var auth=require(_0xa524('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa524('0x7'));router[_0xa524('0x8')]('/',auth[_0xa524('0x9')](),controller['index']);router[_0xa524('0x8')]('/webhook',controller[_0xa524('0xa')]);router[_0xa524('0x8')]('/:id',auth[_0xa524('0x9')](),controller[_0xa524('0xb')]);router[_0xa524('0x8')](_0xa524('0xc'),auth[_0xa524('0x9')](),controller['download']);var upload=multer({'storage':multer[_0xa524('0xd')]({'destination':function(_0x2ebea2,_0x59660a,_0x565fab){_0x565fab(null,path[_0xa524('0xe')](config[_0xa524('0xf')],_0xa524('0x10')));},'filename':function(_0x4936fa,_0x55117f,_0x14a0d6){_0x55117f['originalname']=_0x55117f[_0xa524('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x14a0d6(null,util[_0xa524('0x12')]('%s-%s%s',path[_0xa524('0x13')](_0x55117f[_0xa524('0x11')],path['extname'](_0x55117f[_0xa524('0x11')])),Date[_0xa524('0x14')](),path[_0xa524('0x15')](_0x55117f[_0xa524('0x11')])));}})});router[_0xa524('0x16')]('/',upload[_0xa524('0x17')](_0xa524('0x18')),controller['upload']);router[_0xa524('0x16')](_0xa524('0x19'),controller[_0xa524('0x1a')]);router[_0xa524('0x1b')](_0xa524('0x1c'),auth[_0xa524('0x9')](),controller[_0xa524('0x1d')]);router[_0xa524('0x1e')]('/:id',auth[_0xa524('0x9')](),controller[_0xa524('0x1e')]);module[_0xa524('0x1f')]=router; \ No newline at end of file +var _0x2d17=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','index','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','file','/webhook','put','isAuthenticated','delete','exports','multer','util'];(function(_0x2323c6,_0x566714){var _0x4a0680=function(_0x4daded){while(--_0x4daded){_0x2323c6['push'](_0x2323c6['shift']());}};_0x4a0680(++_0x566714);}(_0x2d17,0x17e));var _0x72d1=function(_0x594c61,_0x5a1800){_0x594c61=_0x594c61-0x0;var _0x2089dd=_0x2d17[_0x594c61];return _0x2089dd;};'use strict';var multer=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var path=require('path');var timeout=require(_0x72d1('0x2'));var express=require(_0x72d1('0x3'));var router=express['Router']();var fs_extra=require(_0x72d1('0x4'));var auth=require(_0x72d1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x72d1('0x6'));var controller=require('./plugin.controller');router[_0x72d1('0x7')]('/',auth['isAuthenticated'](),controller[_0x72d1('0x8')]);router[_0x72d1('0x7')]('/webhook',controller[_0x72d1('0x9')]);router[_0x72d1('0x7')](_0x72d1('0xa'),auth['isAuthenticated'](),controller[_0x72d1('0xb')]);router[_0x72d1('0x7')](_0x72d1('0xc'),auth['isAuthenticated'](),controller[_0x72d1('0xd')]);var upload=multer({'storage':multer[_0x72d1('0xe')]({'destination':function(_0x45eb4a,_0x14a41e,_0x3cb9c2){_0x3cb9c2(null,path[_0x72d1('0xf')](config[_0x72d1('0x10')],_0x72d1('0x11')));},'filename':function(_0x273ccf,_0x2f5a78,_0x5ad4df){_0x2f5a78[_0x72d1('0x12')]=_0x2f5a78[_0x72d1('0x12')][_0x72d1('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5ad4df(null,util[_0x72d1('0x14')](_0x72d1('0x15'),path[_0x72d1('0x16')](_0x2f5a78[_0x72d1('0x12')],path[_0x72d1('0x17')](_0x2f5a78[_0x72d1('0x12')])),Date[_0x72d1('0x18')](),path[_0x72d1('0x17')](_0x2f5a78[_0x72d1('0x12')])));}})});router[_0x72d1('0x19')]('/',upload['single'](_0x72d1('0x1a')),controller['upload']);router[_0x72d1('0x19')](_0x72d1('0x1b'),controller['webhookPost']);router[_0x72d1('0x1c')](_0x72d1('0xa'),auth[_0x72d1('0x1d')](),controller['update']);router['delete'](_0x72d1('0xa'),auth[_0x72d1('0x1d')](),controller[_0x72d1('0x1e')]);module[_0x72d1('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 74e3fbb..3f2f13f 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 _0xac04=['ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','sequelize'];(function(_0x7d3ce3,_0x5d22cb){var _0x344b49=function(_0x4c825f){while(--_0x4c825f){_0x7d3ce3['push'](_0x7d3ce3['shift']());}};_0x344b49(++_0x5d22cb);}(_0xac04,0x133));var _0x4ac0=function(_0x46f107,_0x29d2d4){_0x46f107=_0x46f107-0x0;var _0x44f6f9=_0xac04[_0x46f107];return _0x44f6f9;};'use strict';var Sequelize=require(_0x4ac0('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4ac0('0x1')](_0x4ac0('0x2'),_0x4ac0('0x3'))},'description':{'type':Sequelize[_0x4ac0('0x4')]},'version':{'type':Sequelize[_0x4ac0('0x4')]},'path':{'type':Sequelize['STRING'],'comment':_0x4ac0('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x4ac0('0x1')]('adminOnly',_0x4ac0('0x6'),_0x4ac0('0x7'),_0x4ac0('0x8')),'defaultValue':_0x4ac0('0x7'),'comment':_0x4ac0('0x9')},'icon':{'type':Sequelize[_0x4ac0('0xa')]},'adminUrl':{'type':Sequelize[_0x4ac0('0xa')]},'agentUrl':{'type':Sequelize[_0x4ac0('0xa')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4d97=['BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','html','script','TEXT'];(function(_0xa482b6,_0x446cef){var _0x254829=function(_0x1de4f4){while(--_0x1de4f4){_0xa482b6['push'](_0xa482b6['shift']());}};_0x254829(++_0x446cef);}(_0x4d97,0xaf));var _0x74d9=function(_0x16b4b5,_0x10f834){_0x16b4b5=_0x16b4b5-0x0;var _0x2a9bbb=_0x4d97[_0x16b4b5];return _0x2a9bbb;};'use strict';var Sequelize=require('sequelize');module[_0x74d9('0x0')]={'name':{'type':Sequelize[_0x74d9('0x1')]},'type':{'type':Sequelize['ENUM'](_0x74d9('0x2'),_0x74d9('0x3'))},'description':{'type':Sequelize[_0x74d9('0x4')]},'version':{'type':Sequelize[_0x74d9('0x4')]},'path':{'type':Sequelize[_0x74d9('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x74d9('0x5')],'defaultValue':0x0,'comment':_0x74d9('0x6')},'sidebar':{'type':Sequelize['ENUM'](_0x74d9('0x7'),_0x74d9('0x8'),_0x74d9('0x9'),_0x74d9('0xa')),'defaultValue':'always','comment':_0x74d9('0xb')},'icon':{'type':Sequelize[_0x74d9('0x1')]},'adminUrl':{'type':Sequelize[_0x74d9('0x1')]},'agentUrl':{'type':Sequelize[_0x74d9('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 8adae7e..1bf41ca 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 _0xc6ef=['Zip\x20archive\x20removed','delete','dirname','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','sendStatus','webhookPost','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./plugin.socket','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Plugins','error','stack','index','map','rawAttributes','fieldName','type','key','name','query','filters','intersection','model','fields','attributes','hasOwnProperty','sort','pick','filter','where','VIRTUAL','merge','options','Plugin','includeAll','rows','catch','show','keys','include','find','download','params','path','join','root','server/files/plugins','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','attachments/**/*','finalize','close','existsSync','Sequelize','Plugin\x20not\x20found','format','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','length','some','manifest.json','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','admin','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','UserProfileResource','create','send'];(function(_0x474d97,_0x5909ce){var _0x1edf25=function(_0x2831df){while(--_0x2831df){_0x474d97['push'](_0x474d97['shift']());}};_0x1edf25(++_0x5909ce);}(_0xc6ef,0x172));var _0xfc6e=function(_0x26d93e,_0x479b6c){_0x26d93e=_0x26d93e-0x0;var _0x255c05=_0xc6ef[_0x26d93e];return _0x255c05;};'use strict';var emlformat=require(_0xfc6e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfc6e('0x1'));var jsonpatch=require(_0xfc6e('0x2'));var rp=require(_0xfc6e('0x3'));var moment=require('moment');var BPromise=require(_0xfc6e('0x4'));var Mustache=require('mustache');var util=require(_0xfc6e('0x5'));var path=require('path');var sox=require(_0xfc6e('0x6'));var csv=require(_0xfc6e('0x7'));var ejs=require(_0xfc6e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xfc6e('0x9'));var jsforce=require(_0xfc6e('0xa'));var deskjs=require(_0xfc6e('0xb'));var toCsv=require('to-csv');var querystring=require(_0xfc6e('0xc'));var Papa=require(_0xfc6e('0xd'));var extract=require(_0xfc6e('0xe'));var rimraf=require(_0xfc6e('0xf'));var archiver=require(_0xfc6e('0x10'));var Redis=require(_0xfc6e('0x11'));var authService=require(_0xfc6e('0x12'));var qs=require(_0xfc6e('0x13'));var as=require(_0xfc6e('0x14'));var hardwareService=require(_0xfc6e('0x15'));var logger=require(_0xfc6e('0x16'))(_0xfc6e('0x17'));var utils=require('../../config/utils');var config=require(_0xfc6e('0x18'));var licenseUtil=require(_0xfc6e('0x19'));var db=require(_0xfc6e('0x1a'))['db'];config[_0xfc6e('0x1b')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfc6e('0x1c'))(new Redis(config['redis']));require(_0xfc6e('0x1d'))['register'](socket);function respondWithStatusCode(_0x2a4950,_0x1bf9c6){_0x1bf9c6=_0x1bf9c6||0xcc;return function(_0x4d67bd){if(_0x4d67bd){return _0x2a4950['sendStatus'](_0x1bf9c6);}return _0x2a4950[_0xfc6e('0x1e')](_0x1bf9c6)[_0xfc6e('0x1f')]();};}function respondWithResult(_0x4675c8,_0x15f6e4){_0x15f6e4=_0x15f6e4||0xc8;return function(_0x3db7cd){if(_0x3db7cd){return _0x4675c8[_0xfc6e('0x1e')](_0x15f6e4)['json'](_0x3db7cd);}};}function respondWithFilteredResult(_0x10a30e,_0x2db836){return function(_0x473a45){if(_0x473a45){var _0x36f53e=typeof _0x2db836[_0xfc6e('0x20')]===_0xfc6e('0x21')&&typeof _0x2db836[_0xfc6e('0x22')]===_0xfc6e('0x21');var _0x156413=_0x473a45[_0xfc6e('0x23')];var _0x52dfe2=_0x36f53e?0x0:_0x2db836['offset'];var _0x26d7cf=_0x36f53e?_0x473a45['count']:_0x2db836[_0xfc6e('0x20')]+_0x2db836[_0xfc6e('0x22')];var _0x363903;if(_0x26d7cf>=_0x156413){_0x26d7cf=_0x156413;_0x363903=0xc8;}else{_0x363903=0xce;}_0x10a30e['status'](_0x363903);return _0x10a30e[_0xfc6e('0x24')](_0xfc6e('0x25'),_0x52dfe2+'-'+_0x26d7cf+'/'+_0x156413)[_0xfc6e('0x26')](_0x473a45);}return null;};}function patchUpdates(_0x940f65){return function(_0x28ff50){try{jsonpatch[_0xfc6e('0x27')](_0x28ff50,_0x940f65,!![]);}catch(_0x1ab918){return BPromise[_0xfc6e('0x28')](_0x1ab918);}return _0x28ff50[_0xfc6e('0x29')]();};}function saveUpdates(_0xce5a99,_0x5d1956){return function(_0x40a5aa){if(_0x40a5aa){return _0x40a5aa[_0xfc6e('0x2a')](_0xce5a99)[_0xfc6e('0x2b')](function(_0x4a74f5){return _0x4a74f5;});}return null;};}function removeEntity(_0x158192,_0x2530f9){return function(_0x460ded){if(_0x460ded){return _0x460ded[_0xfc6e('0x2c')]()['then'](function(){var _0x5d2d19=_0x460ded[_0xfc6e('0x2d')]({'plain':!![]});var _0x16b3fa=_0xfc6e('0x2e');return db['UserProfileResource'][_0xfc6e('0x2c')]({'where':{'type':_0x16b3fa,'resourceId':_0x5d2d19['id']}})[_0xfc6e('0x2b')](function(){return _0x460ded;});})['then'](function(){_0x158192[_0xfc6e('0x1e')](0xcc)[_0xfc6e('0x1f')]();});}};}function handleEntityNotFound(_0x2a800b,_0x519dd3){return function(_0x2477a2){if(!_0x2477a2){_0x2a800b['sendStatus'](0x194);}return _0x2477a2;};}function handleError(_0x779374,_0x56c75e){_0x56c75e=_0x56c75e||0x1f4;return function(_0x5a7ada){logger[_0xfc6e('0x2f')](_0x5a7ada[_0xfc6e('0x30')]);if(_0x5a7ada['name']){delete _0x5a7ada['name'];}_0x779374[_0xfc6e('0x1e')](_0x56c75e)['send'](_0x5a7ada);};}exports[_0xfc6e('0x31')]=function(_0x578224,_0x5c7a0a){var _0x594356={},_0x59fd78={},_0x45a0fd={'count':0x0,'rows':[]};var _0xbda379=_[_0xfc6e('0x32')](db['Plugin'][_0xfc6e('0x33')],function(_0x186c13){return{'name':_0x186c13[_0xfc6e('0x34')],'type':_0x186c13[_0xfc6e('0x35')][_0xfc6e('0x36')]};});_0x59fd78['model']=_[_0xfc6e('0x32')](_0xbda379,_0xfc6e('0x37'));_0x59fd78[_0xfc6e('0x38')]=_['keys'](_0x578224[_0xfc6e('0x38')]);_0x59fd78[_0xfc6e('0x39')]=_[_0xfc6e('0x3a')](_0x59fd78[_0xfc6e('0x3b')],_0x59fd78[_0xfc6e('0x38')]);_0x594356['attributes']=_['intersection'](_0x59fd78[_0xfc6e('0x3b')],qs[_0xfc6e('0x3c')](_0x578224[_0xfc6e('0x38')]['fields']));_0x594356[_0xfc6e('0x3d')]=_0x594356[_0xfc6e('0x3d')]['length']?_0x594356[_0xfc6e('0x3d')]:_0x59fd78['model'];if(!_0x578224[_0xfc6e('0x38')][_0xfc6e('0x3e')]('nolimit')){_0x594356[_0xfc6e('0x22')]=qs['limit'](_0x578224[_0xfc6e('0x38')][_0xfc6e('0x22')]);_0x594356[_0xfc6e('0x20')]=qs['offset'](_0x578224[_0xfc6e('0x38')][_0xfc6e('0x20')]);}_0x594356['order']=qs[_0xfc6e('0x3f')](_0x578224[_0xfc6e('0x38')]['sort']);_0x594356['where']=qs[_0xfc6e('0x39')](_[_0xfc6e('0x40')](_0x578224[_0xfc6e('0x38')],_0x59fd78[_0xfc6e('0x39')]),_0xbda379);if(_0x578224[_0xfc6e('0x38')][_0xfc6e('0x41')]){_0x594356['where']=_['merge'](_0x594356[_0xfc6e('0x42')],{'$or':_[_0xfc6e('0x32')](_0xbda379,function(_0x384d29){if(_0x384d29['type']!==_0xfc6e('0x43')){var _0x587a6d={};_0x587a6d[_0x384d29[_0xfc6e('0x37')]]={'$like':'%'+_0x578224['query'][_0xfc6e('0x41')]+'%'};return _0x587a6d;}})});}_0x594356=_[_0xfc6e('0x44')]({},_0x594356,_0x578224[_0xfc6e('0x45')]);var _0x3cb6b3={'where':_0x594356[_0xfc6e('0x42')]};return db[_0xfc6e('0x46')][_0xfc6e('0x23')](_0x3cb6b3)['then'](function(_0x5544b0){_0x45a0fd[_0xfc6e('0x23')]=_0x5544b0;if(_0x578224[_0xfc6e('0x38')][_0xfc6e('0x47')]){_0x594356['include']=[{'all':!![]}];}return db['Plugin']['findAll'](_0x594356);})[_0xfc6e('0x2b')](function(_0x4ce131){_0x45a0fd[_0xfc6e('0x48')]=_0x4ce131;return _0x45a0fd;})['then'](respondWithFilteredResult(_0x5c7a0a,_0x594356))[_0xfc6e('0x49')](handleError(_0x5c7a0a,null));};exports[_0xfc6e('0x4a')]=function(_0x2bc999,_0x54f832){var _0x2fa2b6={'raw':!![],'where':{'id':_0x2bc999['params']['id']}},_0x234db8={};_0x234db8[_0xfc6e('0x3b')]=_[_0xfc6e('0x4b')](db[_0xfc6e('0x46')][_0xfc6e('0x33')]);_0x234db8['query']=_[_0xfc6e('0x4b')](_0x2bc999[_0xfc6e('0x38')]);_0x234db8[_0xfc6e('0x39')]=_[_0xfc6e('0x3a')](_0x234db8[_0xfc6e('0x3b')],_0x234db8[_0xfc6e('0x38')]);_0x2fa2b6['attributes']=_[_0xfc6e('0x3a')](_0x234db8['model'],qs['fields'](_0x2bc999[_0xfc6e('0x38')]['fields']));_0x2fa2b6[_0xfc6e('0x3d')]=_0x2fa2b6[_0xfc6e('0x3d')]['length']?_0x2fa2b6['attributes']:_0x234db8['model'];if(_0x2bc999[_0xfc6e('0x38')][_0xfc6e('0x47')]){_0x2fa2b6[_0xfc6e('0x4c')]=[{'all':!![]}];}_0x2fa2b6=_[_0xfc6e('0x44')]({},_0x2fa2b6,_0x2bc999[_0xfc6e('0x45')]);return db[_0xfc6e('0x46')][_0xfc6e('0x4d')](_0x2fa2b6)[_0xfc6e('0x2b')](handleEntityNotFound(_0x54f832,null))[_0xfc6e('0x2b')](respondWithResult(_0x54f832,null))[_0xfc6e('0x49')](handleError(_0x54f832,null));};exports[_0xfc6e('0x4e')]=function(_0x4daa2c,_0x413b28,_0x20dbc3){return db[_0xfc6e('0x46')]['find']({'where':{'id':_0x4daa2c[_0xfc6e('0x4f')]['id']},'attributes':[_0xfc6e('0x37'),_0xfc6e('0x50')],'raw':!![]})[_0xfc6e('0x2b')](handleEntityNotFound(_0x413b28,null))[_0xfc6e('0x2b')](function(_0x238dd7){if(_0x238dd7){var _0x11d8d2=path[_0xfc6e('0x51')](config[_0xfc6e('0x52')],_0xfc6e('0x53'),util['format'](_0xfc6e('0x54'),path[_0xfc6e('0x55')](_0x238dd7[_0xfc6e('0x50')])));var _0x23c681=fs[_0xfc6e('0x56')](_0x11d8d2);var _0x237a41=archiver(_0xfc6e('0x57'),{'zlib':{'level':0x9}});_0x237a41['on'](_0xfc6e('0x58'),function(_0x3a579d){if(_0x3a579d[_0xfc6e('0x59')]===_0xfc6e('0x5a')){logger['error'](_0x3a579d);}else{throw new db['Sequelize'][(_0xfc6e('0x5b'))](_0xfc6e('0x5c'));}});_0x237a41['on'](_0xfc6e('0x2f'),function(_0x1a4743){throw new db['Sequelize'][(_0xfc6e('0x5b'))](_0xfc6e('0x5c'));});_0x237a41[_0xfc6e('0x5d')](_0x23c681);_0x237a41[_0xfc6e('0x5e')](_0xfc6e('0x5f'),{'cwd':path['join'](config[_0xfc6e('0x52')],_0xfc6e('0x53'),path['dirname'](_0x238dd7[_0xfc6e('0x50')])),'ignore':[path[_0xfc6e('0x51')](path['basename'](_0x238dd7['path']),'node_modules/**/*'),path['join'](path[_0xfc6e('0x55')](_0x238dd7[_0xfc6e('0x50')]),_0xfc6e('0x60'))],'nodir':!![]})[_0xfc6e('0x61')]();_0x23c681['on'](_0xfc6e('0x62'),function(){if(!fs[_0xfc6e('0x63')](_0x11d8d2)){throw new db[(_0xfc6e('0x64'))][(_0xfc6e('0x5b'))](_0xfc6e('0x65'));}return _0x413b28[_0xfc6e('0x4e')](_0x11d8d2,util[_0xfc6e('0x66')]('%s.zip',path['basename'](_0x238dd7[_0xfc6e('0x50')])),function(_0x3829d2){if(_0x3829d2){throw new db[(_0xfc6e('0x64'))][(_0xfc6e('0x5b'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xfc6e('0x67')](_0x11d8d2);logger[_0xfc6e('0x68')](_0xfc6e('0x69'));logger[_0xfc6e('0x68')](_0xfc6e('0x6a'));});});}return null;})['catch'](handleError(_0x413b28,null));};exports[_0xfc6e('0x6b')]=function(_0x4a5efa,_0x3a3c3e,_0x5f2b52){var _0x1bee92=path[_0xfc6e('0x55')](_0x4a5efa['file'][_0xfc6e('0x6c')],path[_0xfc6e('0x6d')](_0x4a5efa[_0xfc6e('0x6e')][_0xfc6e('0x6c')]));var _0xda57cc=path[_0xfc6e('0x51')](config['root'],'server/files/plugins',_0x4a5efa[_0xfc6e('0x6e')][_0xfc6e('0x6c')]);var _0x338bde=path[_0xfc6e('0x51')](config[_0xfc6e('0x52')],_0xfc6e('0x53'),_0x1bee92);logger[_0xfc6e('0x68')](_0xfc6e('0x6f'),_0xda57cc);logger[_0xfc6e('0x68')](_0xfc6e('0x70'),_0x338bde);try{fs['chmodSync'](_0xda57cc,parseInt(_0xfc6e('0x71'),0x8));extract(_0xda57cc,{'dir':_0x338bde},function(_0xd77132){if(_0xd77132){logger[_0xfc6e('0x2f')](_0xd77132);handleError(_0xd77132,!![]);};var _0x1f824e=fs['readdirSync'](_0x338bde);if(_0x1f824e['length']>0x1){removeReferences(_0xda57cc,_0x338bde);logger[_0xfc6e('0x2f')](_0xfc6e('0x72'));return _0x5f2b52(new Error(_0xfc6e('0x72')));}var _0xfd9452=fs[_0xfc6e('0x73')](path[_0xfc6e('0x51')](_0x338bde,_0x1f824e[0x0]));if(_0xfd9452[_0xfc6e('0x74')]()){removeReferences(_0xda57cc,_0x338bde);logger[_0xfc6e('0x2f')]('Invalid\x20plugin\x20structure');return _0x5f2b52(new Error(_0xfc6e('0x72')));}if(_0xfd9452[_0xfc6e('0x75')]()){var _0x4ed397=fs[_0xfc6e('0x76')](path[_0xfc6e('0x51')](_0x338bde,_0x1f824e[0x0]));if(_0x4ed397[_0xfc6e('0x77')]===0x0){removeReferences(_0xda57cc,_0x338bde);logger['error'](_0xfc6e('0x72'));return _0x5f2b52(new Error('Invalid\x20plugin\x20structure'));}var _0x12c73d=_0x4ed397[_0xfc6e('0x78')](function(_0xa02c0d){return _0xa02c0d===_0xfc6e('0x79');});if(!_0x12c73d){return _0x5f2b52(new Error('Plugin\x20manifest\x20missing'));}var _0x3c8fe6=fs[_0xfc6e('0x7a')](path[_0xfc6e('0x51')](_0x338bde,_0x1f824e[0x0],_0xfc6e('0x79')));var _0x36e58b=JSON[_0xfc6e('0x7b')](_0x3c8fe6);if(_0xfc6e('0x21')==typeof _0x36e58b[_0xfc6e('0x37')]){return _0x5f2b52(new Error(_0xfc6e('0x7c')));}if('undefined'==typeof _0x36e58b[_0xfc6e('0x35')]){return _0x5f2b52(new Error('Invalid\x20manifest:\x20type\x20missing'));}if('undefined'==typeof _0x36e58b['version']){return _0x5f2b52(new Error(_0xfc6e('0x7d')));}if('undefined'==typeof _0x36e58b['parameters']){return _0x5f2b52(new Error(_0xfc6e('0x7e')));}if(_0x36e58b[_0xfc6e('0x35')]===_0xfc6e('0x7f')){if(_0xfc6e('0x21')==typeof _0x36e58b[_0xfc6e('0x80')]['views']){return _0x5f2b52(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0xfc6e('0x21')==typeof _0x36e58b[_0xfc6e('0x80')]['views']['admin']&&_0xfc6e('0x21')==typeof _0x36e58b[_0xfc6e('0x80')][_0xfc6e('0x81')][_0xfc6e('0x82')]){return _0x5f2b52(new Error(_0xfc6e('0x83')));}}else if(_0x36e58b[_0xfc6e('0x35')]===_0xfc6e('0x84')){if('undefined'==typeof _0x36e58b[_0xfc6e('0x80')]['scriptName']){return _0x5f2b52(new Error(_0xfc6e('0x85')));}if(_0xfc6e('0x21')==typeof _0x36e58b[_0xfc6e('0x80')][_0xfc6e('0x86')]){return _0x5f2b52(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x5f2b52(new Error(_0xfc6e('0x87')));}var _0x45c0ff=_0x36e58b[_0xfc6e('0x37')];var _0x19318e=_0x36e58b[_0xfc6e('0x88')];var _0x7b95f2=_0x36e58b[_0xfc6e('0x35')];var _0xbe903=_0x36e58b[_0xfc6e('0x89')]?_0x36e58b[_0xfc6e('0x89')]:_0xfc6e('0x8a');var _0x275be7=_0x36e58b[_0xfc6e('0x8b')]?_0x36e58b[_0xfc6e('0x8b')]:_0xfc6e('0x8c');var _0xcd9b3b='';var _0x569ee6='';var _0x2f755e='';var _0x53e9af='';var _0x3c13a6=_0x36e58b['version'];if(_0x7b95f2==='html'){if('undefined'!=typeof _0x36e58b[_0xfc6e('0x80')]['views'][_0xfc6e('0x8d')]){var _0x58f15b=_0x36e58b[_0xfc6e('0x80')][_0xfc6e('0x81')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xfc6e('0x8e')](_0x58f15b)){_0xcd9b3b=path[_0xfc6e('0x51')]('plugins',_0x1bee92,_0x1f824e[0x0],_0x58f15b);}else{_0xcd9b3b=_0x58f15b;}}else{logger[_0xfc6e('0x68')](_0xfc6e('0x8f'));}if(_0xfc6e('0x21')!=typeof _0x36e58b[_0xfc6e('0x80')]['views'][_0xfc6e('0x82')]){var _0x5b7058=_0x36e58b[_0xfc6e('0x80')][_0xfc6e('0x81')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x5b7058)){_0x569ee6=path[_0xfc6e('0x51')](_0xfc6e('0x90'),_0x1bee92,_0x1f824e[0x0],_0x5b7058);}else{_0x569ee6=_0x5b7058;}}else{logger[_0xfc6e('0x68')](_0xfc6e('0x91'));}}else if(_0x7b95f2===_0xfc6e('0x84')){_0x2f755e=_0x36e58b['parameters']['scriptName'];_0x53e9af=_0x36e58b[_0xfc6e('0x80')][_0xfc6e('0x86')];if(_0xfc6e('0x21')!=typeof _0x36e58b[_0xfc6e('0x80')][_0xfc6e('0x81')]){if(_0xfc6e('0x21')!=typeof _0x36e58b[_0xfc6e('0x80')][_0xfc6e('0x81')]['admin']){var _0x58f15b=_0x36e58b[_0xfc6e('0x80')][_0xfc6e('0x81')][_0xfc6e('0x8d')];if(!/^(f|ht)tps?:\/\//i['test'](_0x58f15b)){_0xcd9b3b=path['join'](_0xfc6e('0x90'),_0x1bee92,_0x1f824e[0x0],_0x58f15b);}else{_0xcd9b3b=_0x58f15b;}}if(_0xfc6e('0x21')!=typeof _0x36e58b[_0xfc6e('0x80')]['views']['agent']){var _0x5b7058=_0x36e58b['parameters']['views'][_0xfc6e('0x82')];if(!/^(f|ht)tps?:\/\//i[_0xfc6e('0x8e')](_0x5b7058)){_0x569ee6=path[_0xfc6e('0x51')](_0xfc6e('0x90'),_0x1bee92,_0x1f824e[0x0],_0x5b7058);}else{_0x569ee6=_0x5b7058;}}}}var _0x2737ae={'name':_0x45c0ff,'description':_0x19318e,'path':path[_0xfc6e('0x51')](_0x1bee92,_0x1f824e[0x0]),'type':_0x7b95f2,'sidebar':_0xbe903,'icon':_0x275be7,'adminUrl':_0xcd9b3b,'agentUrl':_0x569ee6,'scriptName':_0x2f755e,'scriptPath':_0x53e9af,'version':_0x3c13a6};removeReferences(_0xda57cc,null);return db[_0xfc6e('0x46')]['create'](_0x2737ae)['then'](function(_0x1fa2df){var _0x274807={'role':_0x4a5efa[_0xfc6e('0x92')][_0xfc6e('0x93')],'userProfileId':_0x4a5efa['body'][_0xfc6e('0x94')]};if(!_0x274807)throw new Error(_0xfc6e('0x95'));if(_0x274807[_0xfc6e('0x93')]===_0xfc6e('0x96')){var _0x1d32a5=_0x1fa2df[_0xfc6e('0x2d')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'Plugins','userProfileId':_0x274807[_0xfc6e('0x94')]},'raw':!![]})[_0xfc6e('0x2b')](function(_0x87b0db){if(_0x87b0db&&_0x87b0db[_0xfc6e('0x97')]===0x0){return db[_0xfc6e('0x98')][_0xfc6e('0x99')]({'name':_0x1d32a5[_0xfc6e('0x37')],'resourceId':_0x1d32a5['id'],'type':_0x87b0db[_0xfc6e('0x37')],'sectionId':_0x87b0db['id']},{})['then'](function(){return _0x1fa2df;});}else{return _0x1fa2df;}})['catch'](function(_0x31c94a){logger[_0xfc6e('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31c94a);throw _0x31c94a;});}return _0x1fa2df;})['then'](respondWithResult(_0x3a3c3e,null))[_0xfc6e('0x49')](handleError(_0x3a3c3e,null));}});}catch(_0x416165){_0x3a3c3e['status'](0x1f4)[_0xfc6e('0x9a')](_0x416165);}};function removeReferences(_0x15b18b,_0x36bfff){try{if(_0x15b18b){fs[_0xfc6e('0x67')](_0x15b18b);logger[_0xfc6e('0x68')](_0xfc6e('0x9b'));}if(_0x36bfff){rimraf(_0x36bfff,function(){});logger[_0xfc6e('0x68')]('Extracted\x20folder\x20removed');}}catch(_0x8ad377){logger[_0xfc6e('0x2f')](_0x8ad377);}}exports[_0xfc6e('0x2a')]=function(_0x9895b4,_0x490227,_0x36be68){return db[_0xfc6e('0x46')][_0xfc6e('0x4d')]({'where':{'id':_0x9895b4[_0xfc6e('0x4f')]['id']}})[_0xfc6e('0x2b')](handleEntityNotFound(_0x490227,null))['then'](saveUpdates(_0x9895b4[_0xfc6e('0x92')],null))[_0xfc6e('0x2b')](respondWithResult(_0x490227,null))[_0xfc6e('0x49')](handleError(_0x490227,null));};exports[_0xfc6e('0x9c')]=function(_0x20ebca,_0x5ee45f,_0x28c81c){return db[_0xfc6e('0x46')]['find']({'where':{'id':_0x20ebca['params']['id']}})[_0xfc6e('0x2b')](function(_0x24059f){if(_0x24059f){return _0x24059f[_0xfc6e('0x2c')]();}})['then'](function(_0x5aac91){rimraf(path['join'](config['root'],_0xfc6e('0x53'),path[_0xfc6e('0x9d')](_0x5aac91['path'])),function(){});return _0x5aac91;})[_0xfc6e('0x2b')](handleEntityNotFound(_0x5ee45f,null))[_0xfc6e('0x2b')](respondWithStatusCode(_0x5ee45f,null))[_0xfc6e('0x49')](handleError(_0x5ee45f,null));};exports[_0xfc6e('0x9e')]=function(_0x3a5fb2,_0x3f358e,_0x174034){return BPromise[_0xfc6e('0x9f')]()[_0xfc6e('0x2b')](function(){if(!_0x3a5fb2[_0xfc6e('0x38')][_0xfc6e('0x50')]){throw new Error(_0xfc6e('0xa0'));}if(!_0x3a5fb2[_0xfc6e('0x38')][_0xfc6e('0xa1')]){throw new Error(_0xfc6e('0xa2'));}var _0x23bdce=_0x3a5fb2[_0xfc6e('0x38')][_0xfc6e('0xa3')]?_0x3a5fb2[_0xfc6e('0x38')][_0xfc6e('0xa3')]+':'+_0x3a5fb2[_0xfc6e('0x38')][_0xfc6e('0xa1')]:_0xfc6e('0xa4')+_0x3a5fb2['query'][_0xfc6e('0xa1')];var _0xda1d2a=_0x3a5fb2[_0xfc6e('0x38')][_0xfc6e('0x26')]?_0x3a5fb2[_0xfc6e('0x38')][_0xfc6e('0x26')]:!![];var _0x51d09d=_0x3a5fb2[_0xfc6e('0x38')][_0xfc6e('0xa5')]?_0x3a5fb2[_0xfc6e('0x38')][_0xfc6e('0xa5')]:null;var _0x1a9aca={'method':_0x3a5fb2[_0xfc6e('0xa6')],'uri':util[_0xfc6e('0x66')](_0xfc6e('0xa7'),_0x23bdce,_0x3a5fb2[_0xfc6e('0x38')]['path']),'json':_0xda1d2a,'resolveWithFullResponse':!![],'encoding':_0x51d09d,'qs':_0x3a5fb2[_0xfc6e('0x38')]};if(_0x3a5fb2[_0xfc6e('0xa8')]){_0x1a9aca[_0xfc6e('0xa8')]=_0x3a5fb2['headers'];if(_0x1a9aca[_0xfc6e('0xa8')][_0xfc6e('0xa9')]){delete _0x1a9aca[_0xfc6e('0xa8')]['content-length'];}}if(_0x1a9aca[_0xfc6e('0xa8')][_0xfc6e('0xaa')]){delete _0x1a9aca[_0xfc6e('0xa8')][_0xfc6e('0xaa')];}return rp(_0x1a9aca);})[_0xfc6e('0x2b')](function(_0x192947){if(_0x192947){_0x3f358e[_0xfc6e('0x24')](_0x192947[_0xfc6e('0xa8')]);logger[_0xfc6e('0x68')](_0x192947[_0xfc6e('0x92')]);if(_[_0xfc6e('0xab')](_0x3a5fb2[_0xfc6e('0x38')]['path'],_0xfc6e('0x4e'))&&_0x192947['statusCode']==0x1f4){return _0x3f358e['sendStatus'](_0x192947[_0xfc6e('0xac')]);}else{return _0x3f358e[_0xfc6e('0x1e')](_0x192947[_0xfc6e('0xac')])[_0xfc6e('0x9a')](_0x192947[_0xfc6e('0x92')]);}}else{return _0x3f358e[_0xfc6e('0xad')](0xc8);}})[_0xfc6e('0x49')](handleError(_0x3f358e,null));};exports[_0xfc6e('0xae')]=function(_0x27b9f6,_0x55fdbf,_0x13efdb){return BPromise[_0xfc6e('0x9f')]()['then'](function(){if(!_0x27b9f6[_0xfc6e('0x38')][_0xfc6e('0x50')]){throw new Error(_0xfc6e('0xa0'));}if(!_0x27b9f6[_0xfc6e('0x38')]['port']){throw new Error(_0xfc6e('0xa2'));}var _0x3ee9bd=_0x27b9f6['query'][_0xfc6e('0xa3')]?_0x27b9f6[_0xfc6e('0x38')][_0xfc6e('0xa3')]+':'+_0x27b9f6['query'][_0xfc6e('0xa1')]:_0xfc6e('0xa4')+_0x27b9f6[_0xfc6e('0x38')][_0xfc6e('0xa1')];var _0x12929e=_0x27b9f6[_0xfc6e('0x38')][_0xfc6e('0x26')]?_0x27b9f6[_0xfc6e('0x38')][_0xfc6e('0x26')]:!![];var _0x5ab253=_0x27b9f6[_0xfc6e('0x38')]['encoding']?_0x27b9f6['query']['encoding']:null;var _0x205eb3={'method':_0x27b9f6[_0xfc6e('0xa6')],'uri':util[_0xfc6e('0x66')](_0xfc6e('0xa7'),_0x3ee9bd,_0x27b9f6['query'][_0xfc6e('0x50')]),'json':_0x12929e,'resolveWithFullResponse':!![],'encoding':_0x5ab253,'body':_0x27b9f6[_0xfc6e('0x92')]};if(_0x27b9f6['headers']){_0x205eb3[_0xfc6e('0xa8')]=_0x27b9f6['headers'];if(_0x205eb3['headers'][_0xfc6e('0xa9')]){delete _0x205eb3[_0xfc6e('0xa8')][_0xfc6e('0xa9')];}}if(_0x205eb3['headers']['content-type']){delete _0x205eb3[_0xfc6e('0xa8')]['content-type'];}return rp(_0x205eb3);})[_0xfc6e('0x2b')](function(_0x30a25e){if(_0x30a25e){_0x55fdbf[_0xfc6e('0x24')](_0x30a25e[_0xfc6e('0xa8')]);logger[_0xfc6e('0x68')](_0x30a25e['body']);return _0x55fdbf[_0xfc6e('0x1e')](_0x30a25e[_0xfc6e('0xac')])['send'](_0x30a25e[_0xfc6e('0x92')]);}else{return _0x55fdbf['sendStatus'](0xc8);}})[_0xfc6e('0x49')](handleError(_0x55fdbf,null));}; \ No newline at end of file +var _0x5ec0=['util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','error','stack','name','send','index','Plugin','rawAttributes','fieldName','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','catch','show','params','length','options','find','download','join','root','server/files/plugins','format','%s.zip','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','pipe','glob','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','basename','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','upload','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','chmodSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','manifest.json','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','Invalid\x20manifest:\x20views\x20missing','admin','views','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','version','html','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','UserProfileResource','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','dirname','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','encoding','headers','content-length','content-type','endsWith','statusCode','webhookPost','http://localhost:','method','%s%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0x5ec0,0xa2));var _0x05ec=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x5ec0[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require(_0x05ec('0x0'));var rimraf=require(_0x05ec('0x1'));var zipdir=require(_0x05ec('0x2'));var jsonpatch=require(_0x05ec('0x3'));var rp=require(_0x05ec('0x4'));var moment=require('moment');var BPromise=require(_0x05ec('0x5'));var Mustache=require(_0x05ec('0x6'));var util=require(_0x05ec('0x7'));var path=require(_0x05ec('0x8'));var sox=require(_0x05ec('0x9'));var csv=require(_0x05ec('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x05ec('0xb'));var squel=require(_0x05ec('0xc'));var crypto=require(_0x05ec('0xd'));var jsforce=require(_0x05ec('0xe'));var deskjs=require(_0x05ec('0xf'));var toCsv=require(_0x05ec('0xa'));var querystring=require(_0x05ec('0x10'));var Papa=require(_0x05ec('0x11'));var extract=require(_0x05ec('0x12'));var rimraf=require('rimraf');var archiver=require(_0x05ec('0x13'));var Redis=require(_0x05ec('0x14'));var authService=require(_0x05ec('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x05ec('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x05ec('0x17'));var licenseUtil=require(_0x05ec('0x18'));var db=require(_0x05ec('0x19'))['db'];config[_0x05ec('0x1a')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x05ec('0x1b'))(new Redis(config['redis']));require(_0x05ec('0x1c'))[_0x05ec('0x1d')](socket);function respondWithStatusCode(_0x2473df,_0x36099d){_0x36099d=_0x36099d||0xcc;return function(_0x4fa4ca){if(_0x4fa4ca){return _0x2473df[_0x05ec('0x1e')](_0x36099d);}return _0x2473df[_0x05ec('0x1f')](_0x36099d)[_0x05ec('0x20')]();};}function respondWithResult(_0x2f28db,_0x53d307){_0x53d307=_0x53d307||0xc8;return function(_0xd0c203){if(_0xd0c203){return _0x2f28db[_0x05ec('0x1f')](_0x53d307)[_0x05ec('0x21')](_0xd0c203);}};}function respondWithFilteredResult(_0x467cac,_0x14c784){return function(_0x3ce3f8){if(_0x3ce3f8){var _0x2e9e9b=typeof _0x14c784[_0x05ec('0x22')]===_0x05ec('0x23')&&typeof _0x14c784[_0x05ec('0x24')]==='undefined';var _0x3294a0=_0x3ce3f8[_0x05ec('0x25')];var _0x543df0=_0x2e9e9b?0x0:_0x14c784['offset'];var _0x35ac2d=_0x2e9e9b?_0x3ce3f8[_0x05ec('0x25')]:_0x14c784[_0x05ec('0x22')]+_0x14c784[_0x05ec('0x24')];var _0x48e249;if(_0x35ac2d>=_0x3294a0){_0x35ac2d=_0x3294a0;_0x48e249=0xc8;}else{_0x48e249=0xce;}_0x467cac[_0x05ec('0x1f')](_0x48e249);return _0x467cac[_0x05ec('0x26')](_0x05ec('0x27'),_0x543df0+'-'+_0x35ac2d+'/'+_0x3294a0)[_0x05ec('0x21')](_0x3ce3f8);}return null;};}function patchUpdates(_0x1a2fcf){return function(_0x4f960f){try{jsonpatch[_0x05ec('0x28')](_0x4f960f,_0x1a2fcf,!![]);}catch(_0x447995){return BPromise[_0x05ec('0x29')](_0x447995);}return _0x4f960f[_0x05ec('0x2a')]();};}function saveUpdates(_0x702cb8,_0x50bb20){return function(_0x26481a){if(_0x26481a){return _0x26481a['update'](_0x702cb8)[_0x05ec('0x2b')](function(_0x566f48){return _0x566f48;});}return null;};}function removeEntity(_0x2a879f,_0x4a2576){return function(_0x469201){if(_0x469201){return _0x469201[_0x05ec('0x2c')]()[_0x05ec('0x2b')](function(){var _0x15c46c=_0x469201[_0x05ec('0x2d')]({'plain':!![]});var _0x45ed72='Plugins';return db['UserProfileResource'][_0x05ec('0x2c')]({'where':{'type':_0x45ed72,'resourceId':_0x15c46c['id']}})['then'](function(){return _0x469201;});})['then'](function(){_0x2a879f['status'](0xcc)[_0x05ec('0x20')]();});}};}function handleEntityNotFound(_0x48bc29,_0x3e79e3){return function(_0x3b1992){if(!_0x3b1992){_0x48bc29[_0x05ec('0x1e')](0x194);}return _0x3b1992;};}function handleError(_0xb4363b,_0x4b892f){_0x4b892f=_0x4b892f||0x1f4;return function(_0x2746ac){logger[_0x05ec('0x2e')](_0x2746ac[_0x05ec('0x2f')]);if(_0x2746ac[_0x05ec('0x30')]){delete _0x2746ac[_0x05ec('0x30')];}_0xb4363b[_0x05ec('0x1f')](_0x4b892f)[_0x05ec('0x31')](_0x2746ac);};}exports[_0x05ec('0x32')]=function(_0x17967a,_0x1a8f63){var _0x4a8ab6={},_0x2c946c={},_0x40c3a0={'count':0x0,'rows':[]};var _0x4375e7=_['map'](db[_0x05ec('0x33')][_0x05ec('0x34')],function(_0x429744){return{'name':_0x429744[_0x05ec('0x35')],'type':_0x429744['type']['key']};});_0x2c946c[_0x05ec('0x36')]=_[_0x05ec('0x37')](_0x4375e7,_0x05ec('0x30'));_0x2c946c[_0x05ec('0x38')]=_[_0x05ec('0x39')](_0x17967a['query']);_0x2c946c[_0x05ec('0x3a')]=_['intersection'](_0x2c946c[_0x05ec('0x36')],_0x2c946c['query']);_0x4a8ab6['attributes']=_[_0x05ec('0x3b')](_0x2c946c['model'],qs[_0x05ec('0x3c')](_0x17967a[_0x05ec('0x38')][_0x05ec('0x3c')]));_0x4a8ab6[_0x05ec('0x3d')]=_0x4a8ab6['attributes']['length']?_0x4a8ab6[_0x05ec('0x3d')]:_0x2c946c['model'];if(!_0x17967a['query'][_0x05ec('0x3e')]('nolimit')){_0x4a8ab6[_0x05ec('0x24')]=qs[_0x05ec('0x24')](_0x17967a[_0x05ec('0x38')]['limit']);_0x4a8ab6[_0x05ec('0x22')]=qs[_0x05ec('0x22')](_0x17967a[_0x05ec('0x38')][_0x05ec('0x22')]);}_0x4a8ab6['order']=qs['sort'](_0x17967a[_0x05ec('0x38')][_0x05ec('0x3f')]);_0x4a8ab6[_0x05ec('0x40')]=qs['filters'](_[_0x05ec('0x41')](_0x17967a[_0x05ec('0x38')],_0x2c946c[_0x05ec('0x3a')]),_0x4375e7);if(_0x17967a[_0x05ec('0x38')][_0x05ec('0x42')]){_0x4a8ab6[_0x05ec('0x40')]=_[_0x05ec('0x43')](_0x4a8ab6[_0x05ec('0x40')],{'$or':_['map'](_0x4375e7,function(_0x3150e8){if(_0x3150e8[_0x05ec('0x44')]!==_0x05ec('0x45')){var _0x2490b6={};_0x2490b6[_0x3150e8[_0x05ec('0x30')]]={'$like':'%'+_0x17967a[_0x05ec('0x38')][_0x05ec('0x42')]+'%'};return _0x2490b6;}})});}_0x4a8ab6=_[_0x05ec('0x43')]({},_0x4a8ab6,_0x17967a['options']);var _0x1e13b1={'where':_0x4a8ab6[_0x05ec('0x40')]};return db[_0x05ec('0x33')][_0x05ec('0x25')](_0x1e13b1)[_0x05ec('0x2b')](function(_0x2f8794){_0x40c3a0[_0x05ec('0x25')]=_0x2f8794;if(_0x17967a[_0x05ec('0x38')][_0x05ec('0x46')]){_0x4a8ab6[_0x05ec('0x47')]=[{'all':!![]}];}return db[_0x05ec('0x33')]['findAll'](_0x4a8ab6);})[_0x05ec('0x2b')](function(_0x3f63a5){_0x40c3a0['rows']=_0x3f63a5;return _0x40c3a0;})[_0x05ec('0x2b')](respondWithFilteredResult(_0x1a8f63,_0x4a8ab6))[_0x05ec('0x48')](handleError(_0x1a8f63,null));};exports[_0x05ec('0x49')]=function(_0x52e083,_0x4f1c31){var _0x11a52a={'raw':!![],'where':{'id':_0x52e083[_0x05ec('0x4a')]['id']}},_0x3ad28d={};_0x3ad28d[_0x05ec('0x36')]=_[_0x05ec('0x39')](db[_0x05ec('0x33')]['rawAttributes']);_0x3ad28d[_0x05ec('0x38')]=_[_0x05ec('0x39')](_0x52e083[_0x05ec('0x38')]);_0x3ad28d['filters']=_['intersection'](_0x3ad28d[_0x05ec('0x36')],_0x3ad28d['query']);_0x11a52a[_0x05ec('0x3d')]=_[_0x05ec('0x3b')](_0x3ad28d[_0x05ec('0x36')],qs[_0x05ec('0x3c')](_0x52e083[_0x05ec('0x38')][_0x05ec('0x3c')]));_0x11a52a[_0x05ec('0x3d')]=_0x11a52a['attributes'][_0x05ec('0x4b')]?_0x11a52a[_0x05ec('0x3d')]:_0x3ad28d[_0x05ec('0x36')];if(_0x52e083[_0x05ec('0x38')][_0x05ec('0x46')]){_0x11a52a[_0x05ec('0x47')]=[{'all':!![]}];}_0x11a52a=_[_0x05ec('0x43')]({},_0x11a52a,_0x52e083[_0x05ec('0x4c')]);return db[_0x05ec('0x33')][_0x05ec('0x4d')](_0x11a52a)[_0x05ec('0x2b')](handleEntityNotFound(_0x4f1c31,null))['then'](respondWithResult(_0x4f1c31,null))['catch'](handleError(_0x4f1c31,null));};exports[_0x05ec('0x4e')]=function(_0x4a8840,_0x2c4eab,_0x5f352f){return db[_0x05ec('0x33')][_0x05ec('0x4d')]({'where':{'id':_0x4a8840[_0x05ec('0x4a')]['id']},'attributes':[_0x05ec('0x30'),_0x05ec('0x8')],'raw':!![]})['then'](handleEntityNotFound(_0x2c4eab,null))['then'](function(_0x484ecc){if(_0x484ecc){var _0x338c8e=path[_0x05ec('0x4f')](config[_0x05ec('0x50')],_0x05ec('0x51'),util[_0x05ec('0x52')](_0x05ec('0x53'),path['basename'](_0x484ecc[_0x05ec('0x8')])));var _0x56ce51=fs[_0x05ec('0x54')](_0x338c8e);var _0x44f73a=archiver(_0x05ec('0x55'),{'zlib':{'level':0x9}});_0x44f73a['on'](_0x05ec('0x56'),function(_0x4066c5){if(_0x4066c5[_0x05ec('0x57')]===_0x05ec('0x58')){logger[_0x05ec('0x2e')](_0x4066c5);}else{throw new db[(_0x05ec('0x59'))][(_0x05ec('0x5a'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x44f73a['on'](_0x05ec('0x2e'),function(_0x1c0a7b){throw new db['Sequelize'][(_0x05ec('0x5a'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x44f73a[_0x05ec('0x5b')](_0x56ce51);_0x44f73a[_0x05ec('0x5c')]('**/*',{'cwd':path[_0x05ec('0x4f')](config['root'],_0x05ec('0x51'),path['dirname'](_0x484ecc['path'])),'ignore':[path[_0x05ec('0x4f')](path['basename'](_0x484ecc[_0x05ec('0x8')]),_0x05ec('0x5d')),path[_0x05ec('0x4f')](path['basename'](_0x484ecc['path']),_0x05ec('0x5e'))],'nodir':!![]})[_0x05ec('0x5f')]();_0x56ce51['on'](_0x05ec('0x60'),function(){if(!fs[_0x05ec('0x61')](_0x338c8e)){throw new db[(_0x05ec('0x59'))]['Error'](_0x05ec('0x62'));}return _0x2c4eab[_0x05ec('0x4e')](_0x338c8e,util[_0x05ec('0x52')](_0x05ec('0x53'),path[_0x05ec('0x63')](_0x484ecc[_0x05ec('0x8')])),function(_0x5451d7){if(_0x5451d7){throw new db[(_0x05ec('0x59'))][(_0x05ec('0x5a'))](_0x05ec('0x64'));}fs['unlinkSync'](_0x338c8e);logger[_0x05ec('0x65')](_0x05ec('0x66'));logger['info']('Temporary\x20file\x20removed');});});}return null;})[_0x05ec('0x48')](handleError(_0x2c4eab,null));};exports[_0x05ec('0x67')]=function(_0x5daa21,_0x100e64,_0x5cc102){var _0x3a463a=path[_0x05ec('0x63')](_0x5daa21['file'][_0x05ec('0x68')],path[_0x05ec('0x69')](_0x5daa21[_0x05ec('0x6a')][_0x05ec('0x68')]));var _0x3dd453=path[_0x05ec('0x4f')](config[_0x05ec('0x50')],_0x05ec('0x51'),_0x5daa21['file'][_0x05ec('0x68')]);var _0x32fe1f=path['join'](config['root'],_0x05ec('0x51'),_0x3a463a);logger[_0x05ec('0x65')](_0x05ec('0x6b'),_0x3dd453);logger[_0x05ec('0x65')]('Plugin\x20upload\x20destination:\x20%s',_0x32fe1f);try{fs[_0x05ec('0x6c')](_0x3dd453,parseInt('0777',0x8));extract(_0x3dd453,{'dir':_0x32fe1f},function(_0x10e44b){if(_0x10e44b){logger[_0x05ec('0x2e')](_0x10e44b);handleError(_0x10e44b,!![]);};var _0x2ee6ee=fs['readdirSync'](_0x32fe1f);if(_0x2ee6ee[_0x05ec('0x4b')]>0x1){removeReferences(_0x3dd453,_0x32fe1f);logger[_0x05ec('0x2e')](_0x05ec('0x6d'));return _0x5cc102(new Error(_0x05ec('0x6d')));}var _0x2fff10=fs[_0x05ec('0x6e')](path[_0x05ec('0x4f')](_0x32fe1f,_0x2ee6ee[0x0]));if(_0x2fff10[_0x05ec('0x6f')]()){removeReferences(_0x3dd453,_0x32fe1f);logger['error'](_0x05ec('0x6d'));return _0x5cc102(new Error(_0x05ec('0x6d')));}if(_0x2fff10[_0x05ec('0x70')]()){var _0x38da13=fs[_0x05ec('0x71')](path['join'](_0x32fe1f,_0x2ee6ee[0x0]));if(_0x38da13[_0x05ec('0x4b')]===0x0){removeReferences(_0x3dd453,_0x32fe1f);logger[_0x05ec('0x2e')](_0x05ec('0x6d'));return _0x5cc102(new Error(_0x05ec('0x6d')));}var _0x3f7790=_0x38da13['some'](function(_0xf33db){return _0xf33db===_0x05ec('0x72');});if(!_0x3f7790){return _0x5cc102(new Error('Plugin\x20manifest\x20missing'));}var _0x4b7d51=fs[_0x05ec('0x73')](path[_0x05ec('0x4f')](_0x32fe1f,_0x2ee6ee[0x0],_0x05ec('0x72')));var _0x376346=JSON[_0x05ec('0x74')](_0x4b7d51);if(_0x05ec('0x23')==typeof _0x376346[_0x05ec('0x30')]){return _0x5cc102(new Error(_0x05ec('0x75')));}if('undefined'==typeof _0x376346[_0x05ec('0x44')]){return _0x5cc102(new Error(_0x05ec('0x76')));}if(_0x05ec('0x23')==typeof _0x376346['version']){return _0x5cc102(new Error(_0x05ec('0x77')));}if(_0x05ec('0x23')==typeof _0x376346[_0x05ec('0x78')]){return _0x5cc102(new Error(_0x05ec('0x79')));}if(_0x376346[_0x05ec('0x44')]==='html'){if('undefined'==typeof _0x376346[_0x05ec('0x78')]['views']){return _0x5cc102(new Error(_0x05ec('0x7a')));}if(_0x05ec('0x23')==typeof _0x376346['parameters']['views'][_0x05ec('0x7b')]&&'undefined'==typeof _0x376346[_0x05ec('0x78')][_0x05ec('0x7c')][_0x05ec('0x7d')]){return _0x5cc102(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x376346[_0x05ec('0x44')]===_0x05ec('0x7e')){if(_0x05ec('0x23')==typeof _0x376346[_0x05ec('0x78')][_0x05ec('0x7f')]){return _0x5cc102(new Error(_0x05ec('0x80')));}if(_0x05ec('0x23')==typeof _0x376346[_0x05ec('0x78')][_0x05ec('0x81')]){return _0x5cc102(new Error(_0x05ec('0x82')));}}else{return _0x5cc102(new Error(_0x05ec('0x83')));}var _0x55155f=_0x376346[_0x05ec('0x30')];var _0x5c710c=_0x376346['description'];var _0x35041b=_0x376346[_0x05ec('0x44')];var _0x3912a0=_0x376346[_0x05ec('0x84')]?_0x376346[_0x05ec('0x84')]:_0x05ec('0x85');var _0x436aa0=_0x376346[_0x05ec('0x86')]?_0x376346[_0x05ec('0x86')]:_0x05ec('0x87');var _0x5881aa='';var _0x159723='';var _0x415c63='';var _0x2389cc='';var _0x11c5f0=_0x376346[_0x05ec('0x88')];if(_0x35041b===_0x05ec('0x89')){if(_0x05ec('0x23')!=typeof _0x376346[_0x05ec('0x78')][_0x05ec('0x7c')]['admin']){var _0x460a11=_0x376346[_0x05ec('0x78')][_0x05ec('0x7c')][_0x05ec('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0x05ec('0x8a')](_0x460a11)){_0x5881aa=path[_0x05ec('0x4f')](_0x05ec('0x8b'),_0x3a463a,_0x2ee6ee[0x0],_0x460a11);}else{_0x5881aa=_0x460a11;}}else{logger[_0x05ec('0x65')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x05ec('0x23')!=typeof _0x376346['parameters'][_0x05ec('0x7c')][_0x05ec('0x7d')]){var _0xbbd5af=_0x376346[_0x05ec('0x78')][_0x05ec('0x7c')][_0x05ec('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x05ec('0x8a')](_0xbbd5af)){_0x159723=path[_0x05ec('0x4f')]('plugins',_0x3a463a,_0x2ee6ee[0x0],_0xbbd5af);}else{_0x159723=_0xbbd5af;}}else{logger[_0x05ec('0x65')](_0x05ec('0x8c'));}}else if(_0x35041b===_0x05ec('0x7e')){_0x415c63=_0x376346['parameters'][_0x05ec('0x7f')];_0x2389cc=_0x376346[_0x05ec('0x78')][_0x05ec('0x81')];if(_0x05ec('0x23')!=typeof _0x376346['parameters']['views']){if(_0x05ec('0x23')!=typeof _0x376346[_0x05ec('0x78')][_0x05ec('0x7c')][_0x05ec('0x7b')]){var _0x460a11=_0x376346['parameters']['views'][_0x05ec('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0x05ec('0x8a')](_0x460a11)){_0x5881aa=path[_0x05ec('0x4f')](_0x05ec('0x8b'),_0x3a463a,_0x2ee6ee[0x0],_0x460a11);}else{_0x5881aa=_0x460a11;}}if(_0x05ec('0x23')!=typeof _0x376346['parameters']['views']['agent']){var _0xbbd5af=_0x376346[_0x05ec('0x78')][_0x05ec('0x7c')][_0x05ec('0x7d')];if(!/^(f|ht)tps?:\/\//i['test'](_0xbbd5af)){_0x159723=path[_0x05ec('0x4f')](_0x05ec('0x8b'),_0x3a463a,_0x2ee6ee[0x0],_0xbbd5af);}else{_0x159723=_0xbbd5af;}}}}var _0x394c22={'name':_0x55155f,'description':_0x5c710c,'path':path[_0x05ec('0x4f')](_0x3a463a,_0x2ee6ee[0x0]),'type':_0x35041b,'sidebar':_0x3912a0,'icon':_0x436aa0,'adminUrl':_0x5881aa,'agentUrl':_0x159723,'scriptName':_0x415c63,'scriptPath':_0x2389cc,'version':_0x11c5f0};removeReferences(_0x3dd453,null);return db['Plugin'][_0x05ec('0x8d')](_0x394c22)[_0x05ec('0x2b')](function(_0x293115){var _0x2be2ca={'role':_0x5daa21[_0x05ec('0x8e')][_0x05ec('0x8f')],'userProfileId':_0x5daa21[_0x05ec('0x8e')][_0x05ec('0x90')]};if(!_0x2be2ca)throw new Error(_0x05ec('0x91'));if(_0x2be2ca['role']===_0x05ec('0x92')){var _0x28ce76=_0x293115[_0x05ec('0x2d')]({'plain':!![]});return db['UserProfileSection'][_0x05ec('0x4d')]({'where':{'name':'Plugins','userProfileId':_0x2be2ca['userProfileId']},'raw':!![]})[_0x05ec('0x2b')](function(_0x1821dc){if(_0x1821dc&&_0x1821dc[_0x05ec('0x93')]===0x0){return db[_0x05ec('0x94')]['create']({'name':_0x28ce76[_0x05ec('0x30')],'resourceId':_0x28ce76['id'],'type':_0x1821dc[_0x05ec('0x30')],'sectionId':_0x1821dc['id']},{})['then'](function(){return _0x293115;});}else{return _0x293115;}})[_0x05ec('0x48')](function(_0x7d51ed){logger[_0x05ec('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x7d51ed);throw _0x7d51ed;});}return _0x293115;})[_0x05ec('0x2b')](respondWithResult(_0x100e64,null))['catch'](handleError(_0x100e64,null));}});}catch(_0x3c192a){_0x100e64[_0x05ec('0x1f')](0x1f4)[_0x05ec('0x31')](_0x3c192a);}};function removeReferences(_0x16a3df,_0x2079f4){try{if(_0x16a3df){fs[_0x05ec('0x95')](_0x16a3df);logger[_0x05ec('0x65')](_0x05ec('0x96'));}if(_0x2079f4){rimraf(_0x2079f4,function(){});logger[_0x05ec('0x65')](_0x05ec('0x97'));}}catch(_0x41c35f){logger[_0x05ec('0x2e')](_0x41c35f);}}exports[_0x05ec('0x98')]=function(_0x52dfd6,_0x267edb,_0x503e76){return db[_0x05ec('0x33')][_0x05ec('0x4d')]({'where':{'id':_0x52dfd6['params']['id']}})[_0x05ec('0x2b')](handleEntityNotFound(_0x267edb,null))[_0x05ec('0x2b')](saveUpdates(_0x52dfd6['body'],null))[_0x05ec('0x2b')](respondWithResult(_0x267edb,null))[_0x05ec('0x48')](handleError(_0x267edb,null));};exports[_0x05ec('0x99')]=function(_0x1851c2,_0x3525ed,_0x51c43c){return db[_0x05ec('0x33')][_0x05ec('0x4d')]({'where':{'id':_0x1851c2['params']['id']}})[_0x05ec('0x2b')](function(_0x55d136){if(_0x55d136){return _0x55d136[_0x05ec('0x2c')]();}})[_0x05ec('0x2b')](function(_0x2875dc){rimraf(path[_0x05ec('0x4f')](config[_0x05ec('0x50')],_0x05ec('0x51'),path[_0x05ec('0x9a')](_0x2875dc[_0x05ec('0x8')])),function(){});return _0x2875dc;})[_0x05ec('0x2b')](handleEntityNotFound(_0x3525ed,null))[_0x05ec('0x2b')](respondWithStatusCode(_0x3525ed,null))[_0x05ec('0x48')](handleError(_0x3525ed,null));};exports[_0x05ec('0x9b')]=function(_0x4cb8a7,_0x37d24f,_0x4c8af6){return BPromise['resolve']()[_0x05ec('0x2b')](function(){if(!_0x4cb8a7[_0x05ec('0x38')]['path']){throw new Error(_0x05ec('0x9c'));}if(!_0x4cb8a7[_0x05ec('0x38')][_0x05ec('0x9d')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0xb71852=_0x4cb8a7[_0x05ec('0x38')][_0x05ec('0x9e')]?_0x4cb8a7['query']['hostname']+':'+_0x4cb8a7[_0x05ec('0x38')]['port']:'http://localhost:'+_0x4cb8a7[_0x05ec('0x38')][_0x05ec('0x9d')];var _0xa212e2=_0x4cb8a7[_0x05ec('0x38')][_0x05ec('0x21')]?_0x4cb8a7[_0x05ec('0x38')][_0x05ec('0x21')]:!![];var _0x5a569e=_0x4cb8a7[_0x05ec('0x38')][_0x05ec('0x9f')]?_0x4cb8a7[_0x05ec('0x38')][_0x05ec('0x9f')]:null;var _0x30dc63={'method':_0x4cb8a7['method'],'uri':util['format']('%s%s',_0xb71852,_0x4cb8a7[_0x05ec('0x38')]['path']),'json':_0xa212e2,'resolveWithFullResponse':!![],'encoding':_0x5a569e,'qs':_0x4cb8a7[_0x05ec('0x38')]};if(_0x4cb8a7['headers']){_0x30dc63[_0x05ec('0xa0')]=_0x4cb8a7[_0x05ec('0xa0')];if(_0x30dc63[_0x05ec('0xa0')][_0x05ec('0xa1')]){delete _0x30dc63[_0x05ec('0xa0')][_0x05ec('0xa1')];}}if(_0x30dc63[_0x05ec('0xa0')][_0x05ec('0xa2')]){delete _0x30dc63['headers'][_0x05ec('0xa2')];}return rp(_0x30dc63);})[_0x05ec('0x2b')](function(_0x351fad){if(_0x351fad){_0x37d24f['set'](_0x351fad[_0x05ec('0xa0')]);logger['info'](_0x351fad[_0x05ec('0x8e')]);if(_[_0x05ec('0xa3')](_0x4cb8a7['query'][_0x05ec('0x8')],_0x05ec('0x4e'))&&_0x351fad[_0x05ec('0xa4')]==0x1f4){return _0x37d24f[_0x05ec('0x1e')](_0x351fad['statusCode']);}else{return _0x37d24f['status'](_0x351fad['statusCode'])[_0x05ec('0x31')](_0x351fad['body']);}}else{return _0x37d24f['sendStatus'](0xc8);}})['catch'](handleError(_0x37d24f,null));};exports[_0x05ec('0xa5')]=function(_0x5c37f0,_0x41cca8,_0x2f9447){return BPromise['resolve']()[_0x05ec('0x2b')](function(){if(!_0x5c37f0['query'][_0x05ec('0x8')]){throw new Error(_0x05ec('0x9c'));}if(!_0x5c37f0[_0x05ec('0x38')][_0x05ec('0x9d')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x10d71d=_0x5c37f0['query'][_0x05ec('0x9e')]?_0x5c37f0[_0x05ec('0x38')][_0x05ec('0x9e')]+':'+_0x5c37f0['query'][_0x05ec('0x9d')]:_0x05ec('0xa6')+_0x5c37f0[_0x05ec('0x38')][_0x05ec('0x9d')];var _0x3982d2=_0x5c37f0[_0x05ec('0x38')][_0x05ec('0x21')]?_0x5c37f0['query'][_0x05ec('0x21')]:!![];var _0x5e7202=_0x5c37f0['query']['encoding']?_0x5c37f0['query'][_0x05ec('0x9f')]:null;var _0xf13272={'method':_0x5c37f0[_0x05ec('0xa7')],'uri':util[_0x05ec('0x52')](_0x05ec('0xa8'),_0x10d71d,_0x5c37f0[_0x05ec('0x38')][_0x05ec('0x8')]),'json':_0x3982d2,'resolveWithFullResponse':!![],'encoding':_0x5e7202,'body':_0x5c37f0['body']};if(_0x5c37f0[_0x05ec('0xa0')]){_0xf13272[_0x05ec('0xa0')]=_0x5c37f0[_0x05ec('0xa0')];if(_0xf13272[_0x05ec('0xa0')][_0x05ec('0xa1')]){delete _0xf13272[_0x05ec('0xa0')][_0x05ec('0xa1')];}}if(_0xf13272['headers'][_0x05ec('0xa2')]){delete _0xf13272['headers'][_0x05ec('0xa2')];}return rp(_0xf13272);})[_0x05ec('0x2b')](function(_0x50d7e1){if(_0x50d7e1){_0x41cca8[_0x05ec('0x26')](_0x50d7e1[_0x05ec('0xa0')]);logger[_0x05ec('0x65')](_0x50d7e1['body']);return _0x41cca8[_0x05ec('0x1f')](_0x50d7e1[_0x05ec('0xa4')])[_0x05ec('0x31')](_0x50d7e1[_0x05ec('0x8e')]);}else{return _0x41cca8['sendStatus'](0xc8);}})[_0x05ec('0x48')](handleError(_0x41cca8,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 8605132..cac328a 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 _0x7fbe=['update','remove','emit','hasOwnProperty','hook','exports','Plugin','setMaxListeners','save'];(function(_0x48d02c,_0x320704){var _0x369a5d=function(_0x3066c3){while(--_0x3066c3){_0x48d02c['push'](_0x48d02c['shift']());}};_0x369a5d(++_0x320704);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x469850,_0x3357a1){_0x469850=_0x469850-0x0;var _0x326907=_0x7fbe[_0x469850];return _0x326907;};'use strict';var EventEmitter=require('events');var Plugin=require('../../mysqldb')['db'][_0xe7fb('0x0')];var PluginEvents=new EventEmitter();PluginEvents[_0xe7fb('0x1')](0x0);var events={'afterCreate':_0xe7fb('0x2'),'afterUpdate':_0xe7fb('0x3'),'afterDestroy':_0xe7fb('0x4')};function emitEvent(_0x47625b){return function(_0x11d2c4,_0x4524ff,_0x36ab90){PluginEvents[_0xe7fb('0x5')](_0x47625b+':'+_0x11d2c4['id'],_0x11d2c4);PluginEvents[_0xe7fb('0x5')](_0x47625b,_0x11d2c4);_0x36ab90(null);};}for(var e in events){if(events[_0xe7fb('0x6')](e)){var event=events[e];Plugin[_0xe7fb('0x7')](e,emitEvent(event));}}module[_0xe7fb('0x8')]=PluginEvents; \ No newline at end of file +var _0x4074=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','Plugin'];(function(_0x3b4113,_0x57170d){var _0x1f61f1=function(_0x115d45){while(--_0x115d45){_0x3b4113['push'](_0x3b4113['shift']());}};_0x1f61f1(++_0x57170d);}(_0x4074,0xf0));var _0x4407=function(_0x2ca0d7,_0x52ca78){_0x2ca0d7=_0x2ca0d7-0x0;var _0x178489=_0x4074[_0x2ca0d7];return _0x178489;};'use strict';var EventEmitter=require(_0x4407('0x0'));var Plugin=require(_0x4407('0x1'))['db'][_0x4407('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4407('0x3'),'afterUpdate':_0x4407('0x4'),'afterDestroy':_0x4407('0x5')};function emitEvent(_0x35ad38){return function(_0x188494,_0x3c9f5c,_0x445548){PluginEvents[_0x4407('0x6')](_0x35ad38+':'+_0x188494['id'],_0x188494);PluginEvents[_0x4407('0x6')](_0x35ad38,_0x188494);_0x445548(null);};}for(var e in events){if(events[_0x4407('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x4407('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index f465467..056feef 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 _0x0806=['define','Plugin','plugins','lodash','util','moment','bluebird','request-promise','path','rimraf','./plugin.attributes','exports'];(function(_0x26bb52,_0x14900d){var _0x174ba7=function(_0x4f55f9){while(--_0x4f55f9){_0x26bb52['push'](_0x26bb52['shift']());}};_0x174ba7(++_0x14900d);}(_0x0806,0x1ef));var _0x6080=function(_0x4671fc,_0x410b12){_0x4671fc=_0x4671fc-0x0;var _0x1a99ab=_0x0806[_0x4671fc];return _0x1a99ab;};'use strict';var _=require(_0x6080('0x0'));var util=require(_0x6080('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6080('0x2'));var BPromise=require(_0x6080('0x3'));var rp=require(_0x6080('0x4'));var fs=require('fs');var path=require(_0x6080('0x5'));var rimraf=require(_0x6080('0x6'));var config=require('../../config/environment');var attributes=require(_0x6080('0x7'));module[_0x6080('0x8')]=function(_0x5f80db,_0x507b79){return _0x5f80db[_0x6080('0x9')](_0x6080('0xa'),attributes,{'tableName':_0x6080('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1fd9=['exports','define','Plugin','plugins','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x6e3ab7,_0x4e4c80){var _0x25f2b4=function(_0x5e045a){while(--_0x5e045a){_0x6e3ab7['push'](_0x6e3ab7['shift']());}};_0x25f2b4(++_0x4e4c80);}(_0x1fd9,0x19b));var _0x91fd=function(_0x33f605,_0x3d7bbf){_0x33f605=_0x33f605-0x0;var _0x42fe6a=_0x1fd9[_0x33f605];return _0x42fe6a;};'use strict';var _=require(_0x91fd('0x0'));var util=require(_0x91fd('0x1'));var logger=require(_0x91fd('0x2'))(_0x91fd('0x3'));var moment=require(_0x91fd('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x91fd('0x5'));var rimraf=require(_0x91fd('0x6'));var config=require('../../config/environment');var attributes=require('./plugin.attributes');module[_0x91fd('0x7')]=function(_0x350d75,_0x1eaa48){return _0x350d75[_0x91fd('0x8')](_0x91fd('0x9'),attributes,{'tableName':_0x91fd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index dc2e918..8506fe5 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 _0xd8e6=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreatePlugin','Plugin','create','body','options','raw','info','catch','lodash','util'];(function(_0x156e9a,_0x12e50e){var _0x5f372c=function(_0x45ba2a){while(--_0x45ba2a){_0x156e9a['push'](_0x156e9a['shift']());}};_0x5f372c(++_0x12e50e);}(_0xd8e6,0xb7));var _0x6d8e=function(_0x52334a,_0x570811){_0x52334a=_0x52334a-0x0;var _0x10d7d2=_0xd8e6[_0x52334a];return _0x10d7d2;};'use strict';var _=require(_0x6d8e('0x0'));var util=require(_0x6d8e('0x1'));var moment=require(_0x6d8e('0x2'));var BPromise=require(_0x6d8e('0x3'));var rs=require(_0x6d8e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d8e('0x5'))['db'];var utils=require(_0x6d8e('0x6'));var logger=require('../../config/logger')(_0x6d8e('0x7'));var config=require(_0x6d8e('0x8'));var jayson=require(_0x6d8e('0x9'));var client=jayson[_0x6d8e('0xa')][_0x6d8e('0xb')]({'port':0x232a});config[_0x6d8e('0xc')]=_[_0x6d8e('0xd')](config[_0x6d8e('0xc')],{'host':_0x6d8e('0xe'),'port':0x18eb});var socket=require(_0x6d8e('0xf'))(new Redis(config[_0x6d8e('0xc')]));require(_0x6d8e('0x10'))[_0x6d8e('0x11')](socket);function respondWithRpcPromise(_0x4089be,_0x364a9d,_0x3f4634){return new BPromise(function(_0x26f313,_0x18c3fd){return client[_0x6d8e('0x12')](_0x4089be,_0x3f4634)[_0x6d8e('0x13')](function(_0x54546d){logger['info'](_0x6d8e('0x14'),_0x364a9d,_0x6d8e('0x15'));logger[_0x6d8e('0x16')](_0x6d8e('0x17'),_0x364a9d,'request\x20sent',JSON[_0x6d8e('0x18')](_0x54546d));if(_0x54546d[_0x6d8e('0x19')]){if(_0x54546d[_0x6d8e('0x19')][_0x6d8e('0x1a')]===0x1f4){logger[_0x6d8e('0x19')](_0x6d8e('0x14'),_0x364a9d,_0x54546d[_0x6d8e('0x19')][_0x6d8e('0x1b')]);return _0x18c3fd(_0x54546d[_0x6d8e('0x19')][_0x6d8e('0x1b')]);}logger[_0x6d8e('0x19')](_0x6d8e('0x14'),_0x364a9d,_0x54546d[_0x6d8e('0x19')][_0x6d8e('0x1b')]);return _0x26f313(_0x54546d[_0x6d8e('0x19')][_0x6d8e('0x1b')]);}else{logger['info'](_0x6d8e('0x14'),_0x364a9d,'request\x20sent');_0x26f313(_0x54546d[_0x6d8e('0x1c')][_0x6d8e('0x1b')]);}})['catch'](function(_0x3c12d0){logger[_0x6d8e('0x19')]('Plugin,\x20%s,\x20%s',_0x364a9d,_0x3c12d0);_0x18c3fd(_0x3c12d0);});});}exports[_0x6d8e('0x1d')]=function(_0x173e06){var _0x330121=this;return new Promise(function(_0x9b1cc9,_0x201355){return db[_0x6d8e('0x1e')][_0x6d8e('0x1f')](_0x173e06[_0x6d8e('0x20')],{'raw':_0x173e06['options']?_0x173e06[_0x6d8e('0x21')][_0x6d8e('0x22')]===undefined?!![]:![]:!![]})[_0x6d8e('0x13')](function(_0x23a604){logger[_0x6d8e('0x23')](_0x6d8e('0x1d'),_0x173e06);logger[_0x6d8e('0x16')]('CreatePlugin',_0x173e06,JSON[_0x6d8e('0x18')](_0x23a604));_0x9b1cc9(_0x23a604);})[_0x6d8e('0x24')](function(_0x1aaff7){logger['error'](_0x6d8e('0x1d'),_0x1aaff7[_0x6d8e('0x1b')],_0x173e06);_0x201355(_0x330121[_0x6d8e('0x19')](0x1f4,_0x1aaff7[_0x6d8e('0x1b')]));});});}; \ No newline at end of file +var _0x07f5=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./plugin.socket','register','request','request\x20sent','debug','stringify','code','error','Plugin,\x20%s,\x20%s','message','info','result','catch','CreatePlugin','Plugin','create','options','then','lodash','util','moment','bluebird','randomstring'];(function(_0x32eecd,_0x1774f4){var _0xac7061=function(_0x3c4c07){while(--_0x3c4c07){_0x32eecd['push'](_0x32eecd['shift']());}};_0xac7061(++_0x1774f4);}(_0x07f5,0xc1));var _0x507f=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x07f5[_0x4e1d03];return _0x362d4b;};'use strict';var _=require(_0x507f('0x0'));var util=require(_0x507f('0x1'));var moment=require(_0x507f('0x2'));var BPromise=require(_0x507f('0x3'));var rs=require(_0x507f('0x4'));var fs=require('fs');var Redis=require(_0x507f('0x5'));var db=require(_0x507f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x507f('0x7'))(_0x507f('0x8'));var config=require(_0x507f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x507f('0xa')][_0x507f('0xb')]({'port':0x232a});config[_0x507f('0xc')]=_[_0x507f('0xd')](config[_0x507f('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x507f('0xe'))(new Redis(config[_0x507f('0xc')]));require(_0x507f('0xf'))[_0x507f('0x10')](socket);function respondWithRpcPromise(_0x4fd84c,_0x6633f0,_0x48d3f3){return new BPromise(function(_0x738740,_0x54c9db){return client[_0x507f('0x11')](_0x4fd84c,_0x48d3f3)['then'](function(_0x343c93){logger['info']('Plugin,\x20%s,\x20%s',_0x6633f0,_0x507f('0x12'));logger[_0x507f('0x13')]('Plugin,\x20%s,\x20%s,\x20%s',_0x6633f0,_0x507f('0x12'),JSON[_0x507f('0x14')](_0x343c93));if(_0x343c93['error']){if(_0x343c93['error'][_0x507f('0x15')]===0x1f4){logger[_0x507f('0x16')](_0x507f('0x17'),_0x6633f0,_0x343c93[_0x507f('0x16')][_0x507f('0x18')]);return _0x54c9db(_0x343c93[_0x507f('0x16')][_0x507f('0x18')]);}logger[_0x507f('0x16')]('Plugin,\x20%s,\x20%s',_0x6633f0,_0x343c93[_0x507f('0x16')][_0x507f('0x18')]);return _0x738740(_0x343c93[_0x507f('0x16')][_0x507f('0x18')]);}else{logger[_0x507f('0x19')](_0x507f('0x17'),_0x6633f0,_0x507f('0x12'));_0x738740(_0x343c93[_0x507f('0x1a')][_0x507f('0x18')]);}})[_0x507f('0x1b')](function(_0x329dbd){logger[_0x507f('0x16')](_0x507f('0x17'),_0x6633f0,_0x329dbd);_0x54c9db(_0x329dbd);});});}exports[_0x507f('0x1c')]=function(_0x521884){var _0xf4190a=this;return new Promise(function(_0x167d0c,_0x59d1fe){return db[_0x507f('0x1d')][_0x507f('0x1e')](_0x521884['body'],{'raw':_0x521884[_0x507f('0x1f')]?_0x521884[_0x507f('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x507f('0x20')](function(_0x44cd8a){logger[_0x507f('0x19')]('CreatePlugin',_0x521884);logger[_0x507f('0x13')](_0x507f('0x1c'),_0x521884,JSON[_0x507f('0x14')](_0x44cd8a));_0x167d0c(_0x44cd8a);})['catch'](function(_0x5a55e6){logger[_0x507f('0x16')](_0x507f('0x1c'),_0x5a55e6['message'],_0x521884);_0x59d1fe(_0xf4190a[_0x507f('0x16')](0x1f4,_0x5a55e6[_0x507f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index dafae9f..ef36bbc 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 _0x7d79=['save','remove','update','removeListener'];(function(_0x37a79c,_0x2b19f0){var _0x561d89=function(_0x19bee3){while(--_0x19bee3){_0x37a79c['push'](_0x37a79c['shift']());}};_0x561d89(++_0x2b19f0);}(_0x7d79,0x12c));var _0x97d7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7d79[_0x321bb2];return _0x9c12ed;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x97d7('0x0'),_0x97d7('0x1'),_0x97d7('0x2')];function createListener(_0x3a1530,_0x13f89c){return function(_0x12f932){_0x13f89c['emit'](_0x3a1530,_0x12f932);};}function removeListener(_0x339053,_0x533632){return function(){PluginEvents[_0x97d7('0x3')](_0x339053,_0x533632);};}exports['register']=function(_0x729f63){for(var _0x5837bd=0x0,_0x90b31d=events['length'];_0x5837bd<_0x90b31d;_0x5837bd++){var _0x2a0724=events[_0x5837bd];var _0x356b1b=createListener('plugin:'+_0x2a0724,_0x729f63);PluginEvents['on'](_0x2a0724,_0x356b1b);}}; \ No newline at end of file +var _0x9734=['save','emit','removeListener','register','length','./plugin.events'];(function(_0x3773a2,_0x4c0564){var _0x5aeddb=function(_0x36596e){while(--_0x36596e){_0x3773a2['push'](_0x3773a2['shift']());}};_0x5aeddb(++_0x4c0564);}(_0x9734,0x12b));var _0x4973=function(_0x259cad,_0x3dae11){_0x259cad=_0x259cad-0x0;var _0x4e6a68=_0x9734[_0x259cad];return _0x4e6a68;};'use strict';var PluginEvents=require(_0x4973('0x0'));var events=[_0x4973('0x1'),'remove','update'];function createListener(_0x4dfcb0,_0x2c53f8){return function(_0x34f774){_0x2c53f8[_0x4973('0x2')](_0x4dfcb0,_0x34f774);};}function removeListener(_0x466923,_0x10cb1e){return function(){PluginEvents[_0x4973('0x3')](_0x466923,_0x10cb1e);};}exports[_0x4973('0x4')]=function(_0x5edb0a){for(var _0x174628=0x0,_0x590672=events[_0x4973('0x5')];_0x174628<_0x590672;_0x174628++){var _0x2fe015=events[_0x174628];var _0x58d259=createListener('plugin:'+_0x2fe015,_0x5edb0a);PluginEvents['on'](_0x2fe015,_0x58d259);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index ea0a8ee..f3d195b 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(_0xfc1218,_0x5132f6){var _0x418075=function(_0x45155c){while(--_0x45155c){_0xfc1218['push'](_0xfc1218['shift']());}};_0x418075(++_0x5132f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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(_0x480c74,_0x2d29b8){var _0x4a1214=function(_0x2cb75f){while(--_0x2cb75f){_0x480c74['push'](_0x480c74['shift']());}};_0x4a1214(++_0x2d29b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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 8c97025..4965c1e 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 _0xda55=['Unknown\x20id','lodash','../../config/pm2','path','child_process','exec','bluebird','status','json','error','stack','name','send','npm\x20install','info','index','list','then','express','motion2','length','show','describe','params','catch','create','body','script','../../files/plugins','cwd','chdir','start','dump','Missing\x20name\x20and/or\x20path','restart','hasOwnProperty'];(function(_0x286290,_0x3306c5){var _0x2f21bf=function(_0x574afb){while(--_0x574afb){_0x286290['push'](_0x286290['shift']());}};_0x2f21bf(++_0x3306c5);}(_0xda55,0x6d));var _0x5da5=function(_0x2a36e9,_0x473667){_0x2a36e9=_0x2a36e9-0x0;var _0x39b108=_0xda55[_0x2a36e9];return _0x39b108;};'use strict';var _=require(_0x5da5('0x0'));var pm2=require(_0x5da5('0x1'));var logger=require('../../config/logger')('api');var path=require(_0x5da5('0x2'));var exec=require(_0x5da5('0x3'))[_0x5da5('0x4')];var BPromise=require(_0x5da5('0x5'));function handleEntityNotFound(_0x1c3afd,_0x5da254){return function(_0x3400e9){if(!_0x3400e9){_0x1c3afd['sendStatus'](0x194);;}return _0x3400e9;};}function respondWithResult(_0x356a37,_0x58e7b3){_0x58e7b3=_0x58e7b3||0xc8;return function(_0x2fd877){if(_0x2fd877){return _0x356a37[_0x5da5('0x6')](_0x58e7b3)[_0x5da5('0x7')](_0x2fd877);}return null;};}function handleError(_0x46290d,_0x3debdf){_0x3debdf=_0x3debdf||0x1f4;return function(_0x25c873){logger[_0x5da5('0x8')](_0x25c873[_0x5da5('0x9')]);if(_0x25c873['name']){delete _0x25c873[_0x5da5('0xa')];}_0x46290d[_0x5da5('0x6')](_0x3debdf)[_0x5da5('0xb')](_0x25c873);};}function execChildProcess(){return new BPromise(function(_0x26fbe3,_0x1a047e){exec(_0x5da5('0xc'),function(_0x33313e,_0x589c14,_0x2f4e4b){logger[_0x5da5('0xd')](_0x589c14);logger['info'](_0x2f4e4b);if(_0x33313e){logger[_0x5da5('0x8')](_0x33313e);return _0x1a047e(_0x33313e);}return _0x26fbe3(_0x589c14);});});}exports[_0x5da5('0xe')]=function(_0x3ced00,_0x43d526){return pm2[_0x5da5('0xf')]()[_0x5da5('0x10')](function(_0x481562){if(_0x481562){var _0x489b60=_['reject'](_0x481562,function(_0x4267cd){return _0x4267cd[_0x5da5('0xa')]===_0x5da5('0x11')||_0x4267cd[_0x5da5('0xa')]===_0x5da5('0x12');});return{'rows':_0x489b60,'count':_0x489b60[_0x5da5('0x13')]};}return null;})[_0x5da5('0x10')](respondWithResult(_0x43d526,null))['catch'](handleError(_0x43d526,null));};exports[_0x5da5('0x14')]=function(_0x290136,_0x1a4849){return pm2[_0x5da5('0x15')](_0x290136[_0x5da5('0x16')]['id'])[_0x5da5('0x10')](respondWithResult(_0x1a4849,null))['then'](handleEntityNotFound(_0x1a4849,null))[_0x5da5('0x17')](handleError(_0x1a4849,null));};exports[_0x5da5('0x18')]=function(_0x3d3d26,_0x30cde5){if(_0x3d3d26[_0x5da5('0x19')]['name']&&_0x3d3d26[_0x5da5('0x19')][_0x5da5('0x1a')]){var _0x42a3cb=path['join'](__dirname,_0x5da5('0x1b'),_0x3d3d26[_0x5da5('0x19')][_0x5da5('0x1a')]);var _0x2e68d5=process[_0x5da5('0x1c')]();process[_0x5da5('0x1d')](path['dirname'](_0x42a3cb));return execChildProcess()[_0x5da5('0x10')](function(_0x568ddf){process[_0x5da5('0x1d')](_0x2e68d5);return pm2[_0x5da5('0x1e')]({'name':_0x3d3d26[_0x5da5('0x19')]['name'],'script':_0x42a3cb});})[_0x5da5('0x10')](function(_0x236bf3){pm2[_0x5da5('0x1f')]();return _0x236bf3[0x0];})[_0x5da5('0x10')](respondWithResult(_0x30cde5,0xc9))['catch'](handleError(_0x30cde5,null));}else{return _0x30cde5['status'](0x1f4)['send']({'message':_0x5da5('0x20')});}};exports['update']=function(_0x4e8890,_0x1f75f3){if(_0x4e8890[_0x5da5('0x19')]['id']){delete _0x4e8890['body']['id'];}var _0x1798ae={'online':_0x5da5('0x21'),'stopped':'stop'};if(_0x1798ae[_0x5da5('0x22')](_0x4e8890[_0x5da5('0x19')][_0x5da5('0x6')])){return pm2[_0x1798ae[_0x4e8890[_0x5da5('0x19')][_0x5da5('0x6')]]](_0x4e8890['params']['id'])[_0x5da5('0x10')](respondWithResult(_0x1f75f3,0xc8))[_0x5da5('0x17')](handleError(_0x1f75f3,null));}else{return _0x1f75f3[_0x5da5('0x6')](0x1f4)[_0x5da5('0xb')]({'message':'Unknown\x20status'});}};exports['destroy']=function(_0x4cb022,_0x245273){if(_0x4cb022[_0x5da5('0x19')]['id']){delete _0x4cb022[_0x5da5('0x19')]['id'];}if(_0x4cb022[_0x5da5('0x16')]['id']){return pm2['delete'](_0x4cb022['params']['id'])[_0x5da5('0x10')](function(_0x4afb58){pm2['dump']();return _0x4afb58[0x0];})[_0x5da5('0x10')](respondWithResult(_0x245273,null))['catch'](handleError(_0x245273,null));}else{return _0x245273[_0x5da5('0x6')](0x1f4)[_0x5da5('0xb')]({'message':_0x5da5('0x23')});}}; \ No newline at end of file +var _0xd2ea=['update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','lodash','../../config/pm2','../../config/logger','api','path','exec','bluebird','sendStatus','status','json','stack','name','send','npm\x20install','info','index','reject','express','motion2','length','then','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path'];(function(_0x40f621,_0x176a06){var _0x316052=function(_0x350b86){while(--_0x350b86){_0x40f621['push'](_0x40f621['shift']());}};_0x316052(++_0x176a06);}(_0xd2ea,0x15f));var _0xad2e=function(_0x39db98,_0x28c7d9){_0x39db98=_0x39db98-0x0;var _0x5939cf=_0xd2ea[_0x39db98];return _0x5939cf;};'use strict';var _=require(_0xad2e('0x0'));var pm2=require(_0xad2e('0x1'));var logger=require(_0xad2e('0x2'))(_0xad2e('0x3'));var path=require(_0xad2e('0x4'));var exec=require('child_process')[_0xad2e('0x5')];var BPromise=require(_0xad2e('0x6'));function handleEntityNotFound(_0xcba7cb,_0x3e0741){return function(_0x2afdc4){if(!_0x2afdc4){_0xcba7cb[_0xad2e('0x7')](0x194);;}return _0x2afdc4;};}function respondWithResult(_0x29e97f,_0x592e8b){_0x592e8b=_0x592e8b||0xc8;return function(_0x3b5170){if(_0x3b5170){return _0x29e97f[_0xad2e('0x8')](_0x592e8b)[_0xad2e('0x9')](_0x3b5170);}return null;};}function handleError(_0x5710ac,_0x1e0e9e){_0x1e0e9e=_0x1e0e9e||0x1f4;return function(_0x19bb0d){logger['error'](_0x19bb0d[_0xad2e('0xa')]);if(_0x19bb0d['name']){delete _0x19bb0d[_0xad2e('0xb')];}_0x5710ac[_0xad2e('0x8')](_0x1e0e9e)[_0xad2e('0xc')](_0x19bb0d);};}function execChildProcess(){return new BPromise(function(_0x24c5da,_0x489f25){exec(_0xad2e('0xd'),function(_0x5707a5,_0x42d2ac,_0x347559){logger[_0xad2e('0xe')](_0x42d2ac);logger[_0xad2e('0xe')](_0x347559);if(_0x5707a5){logger['error'](_0x5707a5);return _0x489f25(_0x5707a5);}return _0x24c5da(_0x42d2ac);});});}exports[_0xad2e('0xf')]=function(_0x59201f,_0x1a91ce){return pm2['list']()['then'](function(_0x4a812b){if(_0x4a812b){var _0x5c96a7=_[_0xad2e('0x10')](_0x4a812b,function(_0x282780){return _0x282780[_0xad2e('0xb')]===_0xad2e('0x11')||_0x282780[_0xad2e('0xb')]===_0xad2e('0x12');});return{'rows':_0x5c96a7,'count':_0x5c96a7[_0xad2e('0x13')]};}return null;})[_0xad2e('0x14')](respondWithResult(_0x1a91ce,null))[_0xad2e('0x15')](handleError(_0x1a91ce,null));};exports[_0xad2e('0x16')]=function(_0x2af208,_0x39c5e4){return pm2[_0xad2e('0x17')](_0x2af208[_0xad2e('0x18')]['id'])[_0xad2e('0x14')](respondWithResult(_0x39c5e4,null))['then'](handleEntityNotFound(_0x39c5e4,null))[_0xad2e('0x15')](handleError(_0x39c5e4,null));};exports[_0xad2e('0x19')]=function(_0x489585,_0x50eb1a){if(_0x489585['body']['name']&&_0x489585[_0xad2e('0x1a')][_0xad2e('0x1b')]){var _0x5549db=path[_0xad2e('0x1c')](__dirname,_0xad2e('0x1d'),_0x489585[_0xad2e('0x1a')][_0xad2e('0x1b')]);var _0x23c0b6=process[_0xad2e('0x1e')]();process[_0xad2e('0x1f')](path[_0xad2e('0x20')](_0x5549db));return execChildProcess()[_0xad2e('0x14')](function(_0xd907a9){process[_0xad2e('0x1f')](_0x23c0b6);return pm2[_0xad2e('0x21')]({'name':_0x489585[_0xad2e('0x1a')]['name'],'script':_0x5549db});})[_0xad2e('0x14')](function(_0x2e8887){pm2[_0xad2e('0x22')]();return _0x2e8887[0x0];})[_0xad2e('0x14')](respondWithResult(_0x50eb1a,0xc9))[_0xad2e('0x15')](handleError(_0x50eb1a,null));}else{return _0x50eb1a[_0xad2e('0x8')](0x1f4)[_0xad2e('0xc')]({'message':_0xad2e('0x23')});}};exports[_0xad2e('0x24')]=function(_0x50d446,_0x356a19){if(_0x50d446['body']['id']){delete _0x50d446[_0xad2e('0x1a')]['id'];}var _0x28ef72={'online':_0xad2e('0x25'),'stopped':_0xad2e('0x26')};if(_0x28ef72[_0xad2e('0x27')](_0x50d446[_0xad2e('0x1a')][_0xad2e('0x8')])){return pm2[_0x28ef72[_0x50d446[_0xad2e('0x1a')][_0xad2e('0x8')]]](_0x50d446[_0xad2e('0x18')]['id'])['then'](respondWithResult(_0x356a19,0xc8))[_0xad2e('0x15')](handleError(_0x356a19,null));}else{return _0x356a19[_0xad2e('0x8')](0x1f4)[_0xad2e('0xc')]({'message':_0xad2e('0x28')});}};exports[_0xad2e('0x29')]=function(_0x9b4a23,_0x409f58){if(_0x9b4a23[_0xad2e('0x1a')]['id']){delete _0x9b4a23[_0xad2e('0x1a')]['id'];}if(_0x9b4a23[_0xad2e('0x18')]['id']){return pm2[_0xad2e('0x2a')](_0x9b4a23['params']['id'])[_0xad2e('0x14')](function(_0x55e1dc){pm2[_0xad2e('0x22')]();return _0x55e1dc[0x0];})[_0xad2e('0x14')](respondWithResult(_0x409f58,null))[_0xad2e('0x15')](handleError(_0x409f58,null));}else{return _0x409f58[_0xad2e('0x8')](0x1f4)[_0xad2e('0xc')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 3a0006a..e5b7714 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 _0x8cb5=['getAgents','/queues','isAuthenticated','exports','express','Router','./realtime.controller','get','/agents'];(function(_0x175866,_0x1e48a6){var _0x4a561b=function(_0x1ca6fe){while(--_0x1ca6fe){_0x175866['push'](_0x175866['shift']());}};_0x4a561b(++_0x1e48a6);}(_0x8cb5,0x82));var _0x58cb=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x8cb5[_0x17d9e3];return _0x14192d;};'use strict';var express=require(_0x58cb('0x0'));var router=express[_0x58cb('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x58cb('0x2'));router[_0x58cb('0x3')](_0x58cb('0x4'),auth['isAuthenticated'](),controller[_0x58cb('0x5')]);router['get'](_0x58cb('0x6'),auth[_0x58cb('0x7')](),controller['getQueues']);module[_0x58cb('0x8')]=router; \ No newline at end of file +var _0x51d6=['getAgents','isAuthenticated','express','Router','../../components/auth/service','./realtime.controller','get','/agents'];(function(_0xc2eab2,_0x1fab89){var _0x5d75ef=function(_0x173761){while(--_0x173761){_0xc2eab2['push'](_0xc2eab2['shift']());}};_0x5d75ef(++_0x1fab89);}(_0x51d6,0x19a));var _0x651d=function(_0x55682b,_0x41209e){_0x55682b=_0x55682b-0x0;var _0x35aa84=_0x51d6[_0x55682b];return _0x35aa84;};'use strict';var express=require(_0x651d('0x0'));var router=express[_0x651d('0x1')]();var auth=require(_0x651d('0x2'));var controller=require(_0x651d('0x3'));router[_0x651d('0x4')](_0x651d('0x5'),auth['isAuthenticated'](),controller[_0x651d('0x6')]);router[_0x651d('0x4')]('/queues',auth[_0x651d('0x7')](),controller['getQueues']);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index dd5f35d..7efb16b 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 _0xb95e=['sms','openchannel','fax','whatsapp','channel','toLowerCase','QueueCampaigns','all','util','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../mysqldb','http','client','offset','limit','undefined','count','set','Content-Range','json','error','stack','name','request','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','catch','voice','Queues','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','loggedIn','available','talking','paused','outbound','pTalking','originated','dialActive','Trunk','startPredictive','erlangCalls','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','waiting','busy','merge','pick','filter','length','connectedlinenum','toString','find','UserId','accountcode','online','voiceStatus','User','startCase','Pause','QueueId','loggedInDb','agents','push','idle','ringing','isNil','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','mailStatus','openchannelStatus','smsStatus','whatsappStatus','unknown','pause','*pause','getAgents','lastLoginAt','lastPauseAt','pauseType','internal','address','chatPause','chatCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','openchannelCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','faxStatus','mailStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','resolve','rawAttributes','fieldName','type','key','query','role','agent','user','userProfileId','sort','UserProfile','getResources','findAndCountAll','rows','omit','globalStatus','globalStatusFilter','pauseTypeFilter','getQueues','mail'];(function(_0x495e9f,_0x1b1d80){var _0xb249d2=function(_0x3db4e4){while(--_0x3db4e4){_0x495e9f['push'](_0x495e9f['shift']());}};_0xb249d2(++_0x1b1d80);}(_0xb95e,0x128));var _0xeb95=function(_0x240619,_0x2cdf48){_0x240619=_0x240619-0x0;var _0x48a955=_0xb95e[_0x240619];return _0x48a955;};'use strict';var util=require(_0xeb95('0x0'));var _=require('lodash');var jayson=require(_0xeb95('0x1'));var qs=require(_0xeb95('0x2'));var logger=require(_0xeb95('0x3'))(_0xeb95('0x4'));var db=require(_0xeb95('0x5'))['db'];var amiClient=jayson['client'][_0xeb95('0x6')]({'port':0x232a});var routingClient=jayson[_0xeb95('0x7')][_0xeb95('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x3bb236,_0x5c16c3){return function(_0x2db59f){if(_0x2db59f){var _0x121b7e=typeof _0x5c16c3[_0xeb95('0x8')]==='undefined'&&typeof _0x5c16c3[_0xeb95('0x9')]===_0xeb95('0xa');var _0x3a4cc0=_0x2db59f[_0xeb95('0xb')];var _0x353382=_0x121b7e?0x0:_0x5c16c3['offset'];var _0xf9e219=_0x121b7e?_0x2db59f[_0xeb95('0xb')]:_0x5c16c3[_0xeb95('0x8')]+_0x5c16c3['limit'];var _0x5d3227;if(_0xf9e219>=_0x3a4cc0){_0xf9e219=_0x3a4cc0;_0x5d3227=0xc8;}else{_0x5d3227=0xce;}_0x3bb236['status'](_0x5d3227);return _0x3bb236[_0xeb95('0xc')](_0xeb95('0xd'),_0x353382+'-'+_0xf9e219+'/'+_0x3a4cc0)[_0xeb95('0xe')](_0x2db59f);}return null;};}function handleError(_0x400fda,_0x38f00e){_0x38f00e=_0x38f00e||0x1f4;return function(_0x7b5f67){logger[_0xeb95('0xf')](_0x7b5f67[_0xeb95('0x10')]);if(_0x7b5f67[_0xeb95('0x11')]){delete _0x7b5f67[_0xeb95('0x11')];}_0x400fda['status'](_0x38f00e)['send'](_0x7b5f67);};}function getRealtimeAgents(){return new Promise(function(_0x2a3030,_0x356193){return amiClient[_0xeb95('0x12')](_0xeb95('0x13'),{})['then'](function(_0x316115){if(_0x316115['error'])throw new Error(_0xeb95('0x14'));var _0x42358e=_0x316115['result'];return routingClient[_0xeb95('0x12')](_0xeb95('0x13'),{})[_0xeb95('0x15')](function(_0x28ec03){if(_0x28ec03['error'])throw new Error(_0xeb95('0x16'));var _0x5db2c7=_0x28ec03[_0xeb95('0x17')];return _0x2a3030(_['merge']({},_0x42358e,_0x5db2c7));});})[_0xeb95('0x18')](function(_0x496f02){_0x356193(_0x496f02);});});}function getRealtimeQueues(_0x1a874c,_0x3ae8e9){return new Promise(function(_0x449238,_0x21e0e6){var _0xc7557f=_0x3ae8e9===_0xeb95('0x19')?amiClient:routingClient;return _0xc7557f[_0xeb95('0x12')](_['startCase'](_0x3ae8e9)+_0xeb95('0x1a'),_0x1a874c)[_0xeb95('0x15')](function(_0x8423dc){if(_0x8423dc[_0xeb95('0xf')])throw new Error(util['format'](_0xeb95('0x1b'),_0x3ae8e9));return _0x449238(_0x8423dc[_0xeb95('0x17')]);})[_0xeb95('0x18')](function(_0x4b98d8){_0x21e0e6(_0x4b98d8);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x2245ac,_0xa50a8d){return amiClient[_0xeb95('0x12')](_0xeb95('0x1c'),{})[_0xeb95('0x15')](function(_0x3b2cbc){if(_0x3b2cbc[_0xeb95('0xf')])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x2245ac(_0x3b2cbc[_0xeb95('0x17')]);})[_0xeb95('0x18')](function(_0x11fafc){_0xa50a8d(_0x11fafc);});});}function initializeQueues(_0x2230b0,_0x48a7b6,_0x25f077,_0x229f12){var _0x31e232=[_0xeb95('0x1d'),_0xeb95('0x1e'),'waiting',_0xeb95('0x1f'),_0xeb95('0x20')];if(_0x25f077===_0xeb95('0x19')&&_0x229f12===_0xeb95('0x21')){_0x31e232['push'](_0xeb95('0x22'),_0xeb95('0x23'),'message',_0xeb95('0x24'),'dialMethod',_0xeb95('0x25'),_0xeb95('0x26'),'startProgressive',_0xeb95('0x27'),'erlangCallToSecond',_0xeb95('0x28'),'erlangBusyFactor',_0xeb95('0x29'),_0xeb95('0x2a'),_0xeb95('0x2b'),_0xeb95('0x2c'),_0xeb95('0x2d'),'predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout',_0xeb95('0x2e'),_0xeb95('0x2f'),_0xeb95('0x30'));}return _0x2230b0[_0xeb95('0x31')](function(_0x44a1f0){var _0xedd9c=_0x44a1f0[_0xeb95('0x32')]({'plain':!![]});_0xedd9c['agents']=[];_0xedd9c[_0xeb95('0x20')]=0x0;_0xedd9c['loggedInDb']=0x0;_0xedd9c[_0xeb95('0x1d')]=0x0;_0xedd9c[_0xeb95('0x1e')]=0x0;_0xedd9c[_0xeb95('0x33')]=0x0;if(_0x25f077===_0xeb95('0x19')){_0xedd9c[_0xeb95('0x1f')]=0x0;_0xedd9c[_0xeb95('0x34')]=0x0;if(_0x229f12===_0xeb95('0x21')){_0xedd9c[_0xeb95('0x22')]=0x0;_0xedd9c[_0xeb95('0x23')]=0x0;}}var _0x1d9a42=_['find'](_0x48a7b6,['id',_0xedd9c['id']]);if(_0x1d9a42)_[_0xeb95('0x35')](_0xedd9c,_[_0xeb95('0x36')](_0x1d9a42,_0x31e232));return _0xedd9c;});}function updateAgentVoiceStatus(_0x554aba,_0x7b08b1,_0x45425a){var _0x362f7d=_[_0xeb95('0x37')](_0x45425a,['queue',_0x7b08b1[_0xeb95('0x11')]]);if(_0x362f7d[_0xeb95('0x38')]===0x0)return _0x554aba['busy']=!![];if(_['some'](_0x362f7d,[_0xeb95('0x39'),_0x554aba['internal'][_0xeb95('0x3a')]()]))return _0x554aba[_0xeb95('0x1f')]=!![];if(!_0x554aba[_0xeb95('0x1f')])return _0x554aba['busy']=!![];}function getVoiceQueueAgents(_0x44a512,_0xa4420,_0x1222cf,_0x3cd193){var _0x54b88d=_[_0xeb95('0x3b')](_0xa4420,['id',_0x44a512['id']]);if(!_0x54b88d)return _0x44a512;return _0x54b88d['getMembers']({'raw':!![]})[_0xeb95('0x15')](function(_0x33121e){for(var _0x3abba2=0x0;_0x3abba2<_0x33121e[_0xeb95('0x38')];_0x3abba2++){var _0x3aa4af=_[_0xeb95('0x3b')](_0x1222cf,['id',_0x33121e[_0x3abba2]['UserId']]);if(!_0x3aa4af){_0x3aa4af={'id':_0x33121e[_0x3abba2]['UserId'],'name':_0x33121e[_0x3abba2][_0xeb95('0x3c')],'accountcode':'','online':![]};}var _0x31bea3={'id':_0x3aa4af['id'],'name':_0x3aa4af[_0xeb95('0x11')],'internal':_0x3aa4af[_0xeb95('0x3d')],'online':Boolean(_0x3aa4af[_0xeb95('0x3e')]),'paused':Boolean(_0x33121e[_0x3abba2][_0xeb95('0x20')])};if(_0x3aa4af[_0xeb95('0x3f')]===_0xeb95('0x1f'))updateAgentVoiceStatus(_0x31bea3,_0x44a512,_0x3cd193);if(_0x31bea3[_0xeb95('0x3e')])_0x44a512['loggedInDb']++;if(_0x31bea3['busy'])_0x44a512['busy']++;if(_0x31bea3['paused']&&!_0x31bea3[_0xeb95('0x34')]&&!_0x31bea3['talking'])_0x44a512[_0xeb95('0x20')]++;_0x44a512['agents']['push'](_0x31bea3);}return _0x44a512;});}function getQueueAgents(_0x5cca73,_0x1ff38d,_0xdbe341){var _0x4254f4=_0xeb95('0x40')+_[_0xeb95('0x41')](_0xdbe341)+'Queue';var _0x318964=_0xdbe341+_0xeb95('0x42');return db[_0x4254f4]['findAll']({'where':{[_[_0xeb95('0x41')](_0xdbe341)+_0xeb95('0x43')]:_0x5cca73['id']},'raw':!![]})[_0xeb95('0x15')](function(_0x53757f){for(var _0x81136f=0x0;_0x81136f<_0x53757f['length'];_0x81136f++){var _0x571380=_[_0xeb95('0x3b')](_0x1ff38d,['id',_0x53757f[_0x81136f][_0xeb95('0x3c')]]);if(!_0x571380){_0x571380={'id':_0x53757f[_0x81136f]['UserId'],'name':_0x53757f[_0x81136f][_0xeb95('0x3c')],'online':![],['pauseField']:![]};}var _0x5ae606={'id':_0x571380['id'],'name':_0x571380[_0xeb95('0x11')],'online':Boolean(_0x571380['online']),'paused':Boolean(_0x571380[_0x318964])};if(_0x5ae606[_0xeb95('0x3e')])_0x5cca73[_0xeb95('0x44')]++;_0x5cca73[_0xeb95('0x45')][_0xeb95('0x46')](_0x5ae606);}return _0x5cca73;});}function isIdle(_0x4ef232){return _0x4ef232===_0xeb95('0x47')||_0x4ef232==='unknown'||_0x4ef232==='unavailable'||_0x4ef232===_0xeb95('0x48')||_[_0xeb95('0x49')](_0x4ef232);}function isAgentPaused(_0x3b9049,_0x55a9d1){var _0x10eadd=[_0x3b9049['chatPause'],_0x3b9049[_0xeb95('0x4a')],_0x3b9049[_0xeb95('0x4b')],_0x3b9049[_0xeb95('0x4c')],_0x3b9049[_0xeb95('0x4d')],_0x3b9049[_0xeb95('0x4e')],_0x3b9049[_0xeb95('0x4f')]];if(!_0x55a9d1)return _[_0xeb95('0x50')](_0x10eadd);var _0x234dd4=_[_0xeb95('0x37')](_0x10eadd);return _0x234dd4['length']>0x0&&_0x234dd4[_0xeb95('0x38')]<_0x10eadd[_0xeb95('0x38')]?!![]:![];}function isAgentIdle(_0x23a3ef){if(_0x23a3ef[_0xeb95('0x3f')]!==_0xeb95('0x47')&&_0x23a3ef['voicePause']){_0x23a3ef[_0xeb95('0x3f')]='pause';return![];}return _[_0xeb95('0x50')]([_0x23a3ef['chatStatus'],_0x23a3ef['faxStatus'],_0x23a3ef[_0xeb95('0x51')],_0x23a3ef[_0xeb95('0x52')],_0x23a3ef[_0xeb95('0x53')],_0x23a3ef[_0xeb95('0x3f')],_0x23a3ef[_0xeb95('0x54')]],isIdle);}function getAgentStatus(_0x56fc21){var _0x15a39a=_0xeb95('0x55');if(isAgentPaused(_0x56fc21))_0x15a39a=_0xeb95('0x56');else if(isAgentPaused(_0x56fc21,!![]))_0x15a39a=_0xeb95('0x57');else if(isAgentIdle(_0x56fc21))_0x15a39a=_0xeb95('0x47');else _0x15a39a=_0xeb95('0x34');return _0x15a39a;}exports[_0xeb95('0x58')]=function(_0x502b41,_0x298a){var _0x462228={'count':0x0,'rows':[]},_0x3cfdab={},_0x2c6689,_0x55e20f,_0x790eb=['userpic',_0xeb95('0x3e'),_0xeb95('0x59'),_0xeb95('0x5a'),_0xeb95('0x5b'),_0xeb95('0x5a'),_0xeb95('0x5c'),_0xeb95('0x5d'),_0xeb95('0x5e'),'openchannelPause',_0xeb95('0x4b'),_0xeb95('0x4d'),_0xeb95('0x4f'),_0xeb95('0x4a'),_0xeb95('0x4e'),_0xeb95('0x5f'),'openchannelCapacity',_0xeb95('0x60'),_0xeb95('0x61'),_0xeb95('0x62'),_0xeb95('0x63'),'chatCurrentCapacity',_0xeb95('0x64'),'mailCurrentCapacity',_0xeb95('0x65'),_0xeb95('0x66'),_0xeb95('0x67'),'chatStatus',_0xeb95('0x52'),_0xeb95('0x51'),_0xeb95('0x53'),_0xeb95('0x54'),_0xeb95('0x68'),_0xeb95('0x3f'),'chatStatusTime','openchannelStatusTime',_0xeb95('0x69'),_0xeb95('0x6a'),_0xeb95('0x6b'),'faxStatusTime',_0xeb95('0x6c'),_0xeb95('0x6d'),_0xeb95('0x6e'),_0xeb95('0x6f'),_0xeb95('0x70'),_0xeb95('0x71'),_0xeb95('0x72')],_0x1c9b55=[_0xeb95('0x5e'),'openchannelPause',_0xeb95('0x4b'),_0xeb95('0x4d'),_0xeb95('0x4f'),_0xeb95('0x4a'),_0xeb95('0x4e'),_0xeb95('0x3e')];Promise[_0xeb95('0x73')]()[_0xeb95('0x15')](function(){var _0x283692=_[_0xeb95('0x31')](db[_0xeb95('0x40')][_0xeb95('0x74')],function(_0x189565){return{'name':_0x189565[_0xeb95('0x75')],'type':_0x189565[_0xeb95('0x76')][_0xeb95('0x77')]};});_0x502b41[_0xeb95('0x78')][_0xeb95('0x79')]=_0xeb95('0x7a');_0x502b41['query'][_0xeb95('0x3e')]=!![];_0x3cfdab=qs['getOptions'](_0x283692,_0x502b41);_0x3cfdab['raw']=!![];if(_0x502b41[_0xeb95('0x7b')]['role']===_0xeb95('0x7b')){var _0x1881a2={'params':{'id':_0x502b41[_0xeb95('0x7b')][_0xeb95('0x7c')]},'query':{'section':_0xeb95('0x13'),'role':'agent','online':!![],'nolimit':_0x502b41['query']['nolimit'],'sort':_0x502b41[_0xeb95('0x78')][_0xeb95('0x7d')],'filter':_0x502b41['query'][_0xeb95('0x37')]},'raw':!![]};return db[_0xeb95('0x7e')][_0xeb95('0x7f')](_0x1881a2);}return db[_0xeb95('0x40')][_0xeb95('0x80')](_0x3cfdab);})[_0xeb95('0x15')](function(_0x28a230){_0x462228[_0xeb95('0xb')]=_0x28a230[_0xeb95('0xb')];_0x2c6689=_0x28a230[_0xeb95('0x81')];return getRealtimeAgents();})[_0xeb95('0x15')](function(_0x507614){_0x55e20f=_0x507614[_0xeb95('0x81')];return _0x2c6689[_0xeb95('0x31')](function(_0x5bc3ec){var _0xf90d72=_[_0xeb95('0x3b')](_0x55e20f,['id',_0x5bc3ec['id']]);if(_0xf90d72)_[_0xeb95('0x35')](_0x5bc3ec,_[_0xeb95('0x36')](_[_0xeb95('0x82')](_0xf90d72,_0x1c9b55),_0x790eb));_0x5bc3ec[_0xeb95('0x83')]=getAgentStatus(_0x5bc3ec);return _0x5bc3ec;});})[_0xeb95('0x15')](function(_0x141a38){if(_0x502b41['query'][_0xeb95('0x84')]){var _0x47ba80=_[_0xeb95('0x37')](_0x141a38,[_0xeb95('0x83'),_0x502b41[_0xeb95('0x78')]['globalStatusFilter']]);if(_0x502b41[_0xeb95('0x78')]['pauseTypeFilter']){_0x47ba80=_[_0xeb95('0x37')](_0x47ba80,[_0xeb95('0x5b'),_0x502b41[_0xeb95('0x78')][_0xeb95('0x85')]]);}}_0x462228[_0xeb95('0x81')]=_0x47ba80||_0x141a38;return _0x462228;})['then'](respondWithFilteredResult(_0x298a,_0x3cfdab))[_0xeb95('0x18')](handleError(_0x298a,null));};exports[_0xeb95('0x86')]=function(_0x336aad,_0x4a16c8){var _0xe3294a=[_0xeb95('0x87'),'chat',_0xeb95('0x88'),_0xeb95('0x89'),_0xeb95('0x8a'),_0xeb95('0x8b'),_0xeb95('0x19')];var _0x2d7b09={'count':0x0,'rows':[]},_0x2b72cc={},_0x453ad3,_0x1f7ac7,_0x5b3a59,_0x5e0083,_0x405b24;Promise[_0xeb95('0x73')]()[_0xeb95('0x15')](function(){if(_0x336aad[_0xeb95('0x78')][_0xeb95('0x8c')]){if(!_['includes'](_0xe3294a,_0x336aad[_0xeb95('0x78')][_0xeb95('0x8c')]['toLowerCase']()))throw new Error('Invalid\x20channel');_0x453ad3=_0x336aad[_0xeb95('0x78')][_0xeb95('0x8c')][_0xeb95('0x8d')]();}var _0x370e95=_[_0xeb95('0x41')](_0x453ad3)+'Queue';var _0x49182b=_['map'](db[_0x370e95][_0xeb95('0x74')],function(_0x19d52c){return{'name':_0x19d52c[_0xeb95('0x75')],'type':_0x19d52c[_0xeb95('0x76')][_0xeb95('0x77')]};});_0x2b72cc=qs['getOptions'](_0x49182b,_0x336aad);if(_0x336aad['user'][_0xeb95('0x79')]===_0xeb95('0x7b')){var _0x1a6a3d={'params':{'id':_0x336aad['user']['userProfileId']},'query':{'section':_0x453ad3==='voice'&&_0x336aad[_0xeb95('0x78')][_0xeb95('0x76')]===_0xeb95('0x21')?_0xeb95('0x8e'):_[_0xeb95('0x41')](_0x453ad3)+_0xeb95('0x1a'),'type':_0x336aad[_0xeb95('0x78')][_0xeb95('0x76')],'nolimit':!![],'sort':_0xeb95('0x11'),'filter':_0x336aad[_0xeb95('0x78')][_0xeb95('0x37')]}};return db[_0xeb95('0x7e')][_0xeb95('0x7f')](_0x1a6a3d);}return db[_0x370e95][_0xeb95('0x80')](_0x2b72cc);})[_0xeb95('0x15')](function(_0x5a6bff){_0x2d7b09['count']=_0x5a6bff['count'];_0x1f7ac7=_0x5a6bff['rows'];return getRealtimeQueues(_0x336aad,_0x453ad3);})[_0xeb95('0x15')](function(_0x7bb87d){_0x5e0083=_0x7bb87d['rows'];return getRealtimeAgents();})['then'](function(_0x1ca34d){_0x5b3a59=_0x1ca34d['rows'];if(_0x453ad3!=_0xeb95('0x19'))return;return getRealtimeVoiceQueueChannels();})[_0xeb95('0x15')](function(_0x1fc81e){_0x405b24=_0x1fc81e?_0x1fc81e[_0xeb95('0x81')]:[];return initializeQueues(_0x1f7ac7,_0x5e0083,_0x453ad3,_0x336aad['query']['type']);})['then'](function(_0x30f304){var _0xc07d44=_0x30f304[_0xeb95('0x31')](function(_0x4ca778){if(_0x453ad3===_0xeb95('0x19'))return getVoiceQueueAgents(_0x4ca778,_0x1f7ac7,_0x5b3a59,_0x405b24);else return getQueueAgents(_0x4ca778,_0x5b3a59,_0x453ad3);});return Promise[_0xeb95('0x8f')](_0xc07d44);})[_0xeb95('0x15')](function(_0xaeb90e){_0x2d7b09[_0xeb95('0x81')]=_0xaeb90e;return _0x2d7b09;})['then'](respondWithFilteredResult(_0x4a16c8,_0x2b72cc))[_0xeb95('0x18')](handleError(_0x4a16c8,null));}; \ No newline at end of file +var _0xd8b2=['faxStatus','mailStatus','smsStatus','pause','*pause','getAgents','userpic','lastPauseAt','smsPause','whatsappPause','faxPause','chatCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','resolve','rawAttributes','fieldName','type','key','query','role','agent','raw','user','userProfileId','UserProfile','getResources','findAndCountAll','rows','map','omit','globalStatus','globalStatusFilter','pauseTypeFilter','pauseType','getQueues','mail','chat','sms','openchannel','fax','whatsapp','channel','includes','toLowerCase','Queue','getOptions','QueueCampaigns','all','util','lodash','../../config/logger','../../mysqldb','client','http','offset','undefined','limit','count','set','Content-Range','json','stack','name','status','send','request','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','startCase','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','catch','loggedIn','waiting','talking','voice','outbound','push','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','get','agents','paused','loggedInDb','available','busy','find','pick','filter','queue','connectedlinenum','internal','UserId','accountcode','online','voiceStatus','User','Pause','length','idle','unknown','unavailable','ringing','chatPause','mailPause','openchannelPause','every','voicePause','chatStatus'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xd8b2,0xdb));var _0x2d8b=function(_0x4e2a70,_0xb4ab40){_0x4e2a70=_0x4e2a70-0x0;var _0x15d026=_0xd8b2[_0x4e2a70];return _0x15d026;};'use strict';var util=require(_0x2d8b('0x0'));var _=require(_0x2d8b('0x1'));var jayson=require('jayson/promise');var qs=require('../../components/parsers/qs');var logger=require(_0x2d8b('0x2'))('api');var db=require(_0x2d8b('0x3'))['db'];var amiClient=jayson[_0x2d8b('0x4')][_0x2d8b('0x5')]({'port':0x232a});var routingClient=jayson['client'][_0x2d8b('0x5')]({'port':0x232c});function respondWithFilteredResult(_0x2ebb58,_0x2d4793){return function(_0x3c36be){if(_0x3c36be){var _0x3a1f54=typeof _0x2d4793[_0x2d8b('0x6')]===_0x2d8b('0x7')&&typeof _0x2d4793[_0x2d8b('0x8')]==='undefined';var _0x135a6b=_0x3c36be['count'];var _0x3e4374=_0x3a1f54?0x0:_0x2d4793[_0x2d8b('0x6')];var _0x58a3af=_0x3a1f54?_0x3c36be[_0x2d8b('0x9')]:_0x2d4793[_0x2d8b('0x6')]+_0x2d4793[_0x2d8b('0x8')];var _0x352d54;if(_0x58a3af>=_0x135a6b){_0x58a3af=_0x135a6b;_0x352d54=0xc8;}else{_0x352d54=0xce;}_0x2ebb58['status'](_0x352d54);return _0x2ebb58[_0x2d8b('0xa')](_0x2d8b('0xb'),_0x3e4374+'-'+_0x58a3af+'/'+_0x135a6b)[_0x2d8b('0xc')](_0x3c36be);}return null;};}function handleError(_0x127c5e,_0x514799){_0x514799=_0x514799||0x1f4;return function(_0x54084b){logger['error'](_0x54084b[_0x2d8b('0xd')]);if(_0x54084b[_0x2d8b('0xe')]){delete _0x54084b[_0x2d8b('0xe')];}_0x127c5e[_0x2d8b('0xf')](_0x514799)[_0x2d8b('0x10')](_0x54084b);};}function getRealtimeAgents(){return new Promise(function(_0x2bf7c3,_0x245a9d){return amiClient[_0x2d8b('0x11')]('Agents',{})[_0x2d8b('0x12')](function(_0x388fbd){if(_0x388fbd[_0x2d8b('0x13')])throw new Error(_0x2d8b('0x14'));var _0x158c4f=_0x388fbd[_0x2d8b('0x15')];return routingClient[_0x2d8b('0x11')](_0x2d8b('0x16'),{})[_0x2d8b('0x12')](function(_0x40e2be){if(_0x40e2be['error'])throw new Error(_0x2d8b('0x17'));var _0x126854=_0x40e2be[_0x2d8b('0x15')];return _0x2bf7c3(_[_0x2d8b('0x18')]({},_0x158c4f,_0x126854));});})['catch'](function(_0xbc96cb){_0x245a9d(_0xbc96cb);});});}function getRealtimeQueues(_0x35b841,_0x3b590f){return new Promise(function(_0x505c1a,_0x4e0473){var _0x26652e=_0x3b590f==='voice'?amiClient:routingClient;return _0x26652e['request'](_[_0x2d8b('0x19')](_0x3b590f)+_0x2d8b('0x1a'),_0x35b841)['then'](function(_0x20e10e){if(_0x20e10e[_0x2d8b('0x13')])throw new Error(util[_0x2d8b('0x1b')](_0x2d8b('0x1c'),_0x3b590f));return _0x505c1a(_0x20e10e[_0x2d8b('0x15')]);})['catch'](function(_0x1b5b90){_0x4e0473(_0x1b5b90);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x31f77a,_0x3827fb){return amiClient['request'](_0x2d8b('0x1d'),{})[_0x2d8b('0x12')](function(_0x307010){if(_0x307010[_0x2d8b('0x13')])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x31f77a(_0x307010['result']);})[_0x2d8b('0x1e')](function(_0x1093ab){_0x3827fb(_0x1093ab);});});}function initializeQueues(_0x128bb8,_0x226cf4,_0x2d38be,_0x191732){var _0x510144=[_0x2d8b('0x1f'),'available',_0x2d8b('0x20'),_0x2d8b('0x21'),'paused'];if(_0x2d38be===_0x2d8b('0x22')&&_0x191732===_0x2d8b('0x23')){_0x510144[_0x2d8b('0x24')](_0x2d8b('0x25'),_0x2d8b('0x26'),_0x2d8b('0x27'),_0x2d8b('0x28'),_0x2d8b('0x29'),_0x2d8b('0x2a'),_0x2d8b('0x2b'),'startProgressive',_0x2d8b('0x2c'),_0x2d8b('0x2d'),_0x2d8b('0x2e'),_0x2d8b('0x2f'),_0x2d8b('0x30'),_0x2d8b('0x31'),_0x2d8b('0x32'),_0x2d8b('0x33'),_0x2d8b('0x34'),'predictiveIntervalAnsweredCalls',_0x2d8b('0x35'),_0x2d8b('0x36'),'predictiveIntervalAvgHoldtime',_0x2d8b('0x37'));}return _0x128bb8['map'](function(_0x424c53){var _0x40c862=_0x424c53[_0x2d8b('0x38')]({'plain':!![]});_0x40c862[_0x2d8b('0x39')]=[];_0x40c862[_0x2d8b('0x3a')]=0x0;_0x40c862[_0x2d8b('0x3b')]=0x0;_0x40c862[_0x2d8b('0x1f')]=0x0;_0x40c862[_0x2d8b('0x3c')]=0x0;_0x40c862[_0x2d8b('0x20')]=0x0;if(_0x2d38be==='voice'){_0x40c862['talking']=0x0;_0x40c862[_0x2d8b('0x3d')]=0x0;if(_0x191732===_0x2d8b('0x23')){_0x40c862[_0x2d8b('0x25')]=0x0;_0x40c862[_0x2d8b('0x26')]=0x0;}}var _0x563ba8=_[_0x2d8b('0x3e')](_0x226cf4,['id',_0x40c862['id']]);if(_0x563ba8)_[_0x2d8b('0x18')](_0x40c862,_[_0x2d8b('0x3f')](_0x563ba8,_0x510144));return _0x40c862;});}function updateAgentVoiceStatus(_0x4754cb,_0x222b8c,_0x49a617){var _0x4865e1=_[_0x2d8b('0x40')](_0x49a617,[_0x2d8b('0x41'),_0x222b8c[_0x2d8b('0xe')]]);if(_0x4865e1['length']===0x0)return _0x4754cb[_0x2d8b('0x3d')]=!![];if(_['some'](_0x4865e1,[_0x2d8b('0x42'),_0x4754cb[_0x2d8b('0x43')]['toString']()]))return _0x4754cb['talking']=!![];if(!_0x4754cb['talking'])return _0x4754cb[_0x2d8b('0x3d')]=!![];}function getVoiceQueueAgents(_0x38bdcf,_0x124914,_0x587502,_0x4ec929){var _0x13d099=_[_0x2d8b('0x3e')](_0x124914,['id',_0x38bdcf['id']]);if(!_0x13d099)return _0x38bdcf;return _0x13d099['getMembers']({'raw':!![]})[_0x2d8b('0x12')](function(_0x3546ae){for(var _0x408a53=0x0;_0x408a53<_0x3546ae['length'];_0x408a53++){var _0x496e37=_[_0x2d8b('0x3e')](_0x587502,['id',_0x3546ae[_0x408a53][_0x2d8b('0x44')]]);if(!_0x496e37){_0x496e37={'id':_0x3546ae[_0x408a53][_0x2d8b('0x44')],'name':_0x3546ae[_0x408a53][_0x2d8b('0x44')],'accountcode':'','online':![]};}var _0x2207d3={'id':_0x496e37['id'],'name':_0x496e37[_0x2d8b('0xe')],'internal':_0x496e37[_0x2d8b('0x45')],'online':Boolean(_0x496e37[_0x2d8b('0x46')]),'paused':Boolean(_0x3546ae[_0x408a53][_0x2d8b('0x3a')])};if(_0x496e37[_0x2d8b('0x47')]===_0x2d8b('0x21'))updateAgentVoiceStatus(_0x2207d3,_0x38bdcf,_0x4ec929);if(_0x2207d3[_0x2d8b('0x46')])_0x38bdcf[_0x2d8b('0x3b')]++;if(_0x2207d3['busy'])_0x38bdcf['busy']++;if(_0x2207d3[_0x2d8b('0x3a')]&&!_0x2207d3[_0x2d8b('0x3d')]&&!_0x2207d3['talking'])_0x38bdcf[_0x2d8b('0x3a')]++;_0x38bdcf[_0x2d8b('0x39')]['push'](_0x2207d3);}return _0x38bdcf;});}function getQueueAgents(_0xdb4a53,_0x36c664,_0x24ad6c){var _0x27a0e3=_0x2d8b('0x48')+_[_0x2d8b('0x19')](_0x24ad6c)+'Queue';var _0x2b9dd3=_0x24ad6c+_0x2d8b('0x49');return db[_0x27a0e3]['findAll']({'where':{[_[_0x2d8b('0x19')](_0x24ad6c)+'QueueId']:_0xdb4a53['id']},'raw':!![]})[_0x2d8b('0x12')](function(_0x4a096e){for(var _0x3ff0a2=0x0;_0x3ff0a2<_0x4a096e[_0x2d8b('0x4a')];_0x3ff0a2++){var _0x27589d=_[_0x2d8b('0x3e')](_0x36c664,['id',_0x4a096e[_0x3ff0a2][_0x2d8b('0x44')]]);if(!_0x27589d){_0x27589d={'id':_0x4a096e[_0x3ff0a2][_0x2d8b('0x44')],'name':_0x4a096e[_0x3ff0a2][_0x2d8b('0x44')],'online':![],['pauseField']:![]};}var _0x23f282={'id':_0x27589d['id'],'name':_0x27589d[_0x2d8b('0xe')],'online':Boolean(_0x27589d[_0x2d8b('0x46')]),'paused':Boolean(_0x27589d[_0x2b9dd3])};if(_0x23f282[_0x2d8b('0x46')])_0xdb4a53[_0x2d8b('0x3b')]++;_0xdb4a53[_0x2d8b('0x39')][_0x2d8b('0x24')](_0x23f282);}return _0xdb4a53;});}function isIdle(_0x288f6b){return _0x288f6b===_0x2d8b('0x4b')||_0x288f6b===_0x2d8b('0x4c')||_0x288f6b===_0x2d8b('0x4d')||_0x288f6b===_0x2d8b('0x4e')||_['isNil'](_0x288f6b);}function isAgentPaused(_0x246345,_0x82cdde){var _0x16d6cd=[_0x246345[_0x2d8b('0x4f')],_0x246345['faxPause'],_0x246345[_0x2d8b('0x50')],_0x246345[_0x2d8b('0x51')],_0x246345['smsPause'],_0x246345['voicePause'],_0x246345['whatsappPause']];if(!_0x82cdde)return _[_0x2d8b('0x52')](_0x16d6cd);var _0x1cf21b=_[_0x2d8b('0x40')](_0x16d6cd);return _0x1cf21b[_0x2d8b('0x4a')]>0x0&&_0x1cf21b[_0x2d8b('0x4a')]<_0x16d6cd[_0x2d8b('0x4a')]?!![]:![];}function isAgentIdle(_0x148d61){if(_0x148d61[_0x2d8b('0x47')]!=='idle'&&_0x148d61[_0x2d8b('0x53')]){_0x148d61[_0x2d8b('0x47')]='pause';return![];}return _['every']([_0x148d61[_0x2d8b('0x54')],_0x148d61[_0x2d8b('0x55')],_0x148d61[_0x2d8b('0x56')],_0x148d61['openchannelStatus'],_0x148d61[_0x2d8b('0x57')],_0x148d61[_0x2d8b('0x47')],_0x148d61['whatsappStatus']],isIdle);}function getAgentStatus(_0x4976f2){var _0x194ddb=_0x2d8b('0x4c');if(isAgentPaused(_0x4976f2))_0x194ddb=_0x2d8b('0x58');else if(isAgentPaused(_0x4976f2,!![]))_0x194ddb=_0x2d8b('0x59');else if(isAgentIdle(_0x4976f2))_0x194ddb=_0x2d8b('0x4b');else _0x194ddb=_0x2d8b('0x3d');return _0x194ddb;}exports[_0x2d8b('0x5a')]=function(_0x2828e6,_0x397fa7){var _0x10ada3={'count':0x0,'rows':[]},_0x595607={},_0x1f3455,_0xb9b7a,_0x3b2f2a=[_0x2d8b('0x5b'),_0x2d8b('0x46'),'lastLoginAt',_0x2d8b('0x5c'),'pauseType',_0x2d8b('0x5c'),_0x2d8b('0x43'),'address',_0x2d8b('0x4f'),_0x2d8b('0x51'),_0x2d8b('0x50'),_0x2d8b('0x5d'),_0x2d8b('0x5e'),_0x2d8b('0x5f'),_0x2d8b('0x53'),_0x2d8b('0x60'),'openchannelCapacity',_0x2d8b('0x61'),_0x2d8b('0x62'),_0x2d8b('0x63'),_0x2d8b('0x64'),_0x2d8b('0x65'),_0x2d8b('0x66'),_0x2d8b('0x67'),_0x2d8b('0x68'),_0x2d8b('0x69'),_0x2d8b('0x6a'),_0x2d8b('0x54'),'openchannelStatus','mailStatus',_0x2d8b('0x57'),'whatsappStatus','faxStatus',_0x2d8b('0x47'),_0x2d8b('0x6b'),_0x2d8b('0x6c'),_0x2d8b('0x6d'),_0x2d8b('0x6e'),_0x2d8b('0x6f'),_0x2d8b('0x70'),'voiceStatusTime',_0x2d8b('0x41'),_0x2d8b('0x71'),'screenrecording',_0x2d8b('0x72'),_0x2d8b('0x73'),_0x2d8b('0x74')],_0x1db506=['chatPause','openchannelPause',_0x2d8b('0x50'),_0x2d8b('0x5d'),_0x2d8b('0x5e'),_0x2d8b('0x5f'),'voicePause','online'];Promise[_0x2d8b('0x75')]()['then'](function(){var _0x3c910e=_['map'](db[_0x2d8b('0x48')][_0x2d8b('0x76')],function(_0x8c8a75){return{'name':_0x8c8a75[_0x2d8b('0x77')],'type':_0x8c8a75[_0x2d8b('0x78')][_0x2d8b('0x79')]};});_0x2828e6[_0x2d8b('0x7a')][_0x2d8b('0x7b')]=_0x2d8b('0x7c');_0x2828e6['query'][_0x2d8b('0x46')]=!![];_0x595607=qs['getOptions'](_0x3c910e,_0x2828e6);_0x595607[_0x2d8b('0x7d')]=!![];if(_0x2828e6['user'][_0x2d8b('0x7b')]===_0x2d8b('0x7e')){var _0x4d7654={'params':{'id':_0x2828e6['user'][_0x2d8b('0x7f')]},'query':{'section':_0x2d8b('0x16'),'role':'agent','online':!![],'nolimit':_0x2828e6[_0x2d8b('0x7a')]['nolimit'],'sort':_0x2828e6['query']['sort'],'filter':_0x2828e6[_0x2d8b('0x7a')][_0x2d8b('0x40')]},'raw':!![]};return db[_0x2d8b('0x80')][_0x2d8b('0x81')](_0x4d7654);}return db['User'][_0x2d8b('0x82')](_0x595607);})['then'](function(_0x36db73){_0x10ada3[_0x2d8b('0x9')]=_0x36db73[_0x2d8b('0x9')];_0x1f3455=_0x36db73[_0x2d8b('0x83')];return getRealtimeAgents();})[_0x2d8b('0x12')](function(_0x45bb0c){_0xb9b7a=_0x45bb0c[_0x2d8b('0x83')];return _0x1f3455[_0x2d8b('0x84')](function(_0x269038){var _0x9b792a=_[_0x2d8b('0x3e')](_0xb9b7a,['id',_0x269038['id']]);if(_0x9b792a)_[_0x2d8b('0x18')](_0x269038,_[_0x2d8b('0x3f')](_[_0x2d8b('0x85')](_0x9b792a,_0x1db506),_0x3b2f2a));_0x269038[_0x2d8b('0x86')]=getAgentStatus(_0x269038);return _0x269038;});})[_0x2d8b('0x12')](function(_0x1d9ac8){if(_0x2828e6[_0x2d8b('0x7a')][_0x2d8b('0x87')]){var _0x3ef3ec=_[_0x2d8b('0x40')](_0x1d9ac8,[_0x2d8b('0x86'),_0x2828e6[_0x2d8b('0x7a')][_0x2d8b('0x87')]]);if(_0x2828e6[_0x2d8b('0x7a')][_0x2d8b('0x88')]){_0x3ef3ec=_['filter'](_0x3ef3ec,[_0x2d8b('0x89'),_0x2828e6['query']['pauseTypeFilter']]);}}_0x10ada3[_0x2d8b('0x83')]=_0x3ef3ec||_0x1d9ac8;return _0x10ada3;})[_0x2d8b('0x12')](respondWithFilteredResult(_0x397fa7,_0x595607))[_0x2d8b('0x1e')](handleError(_0x397fa7,null));};exports[_0x2d8b('0x8a')]=function(_0x3d1940,_0x2920c2){var _0x44acf2=[_0x2d8b('0x8b'),_0x2d8b('0x8c'),_0x2d8b('0x8d'),_0x2d8b('0x8e'),_0x2d8b('0x8f'),_0x2d8b('0x90'),_0x2d8b('0x22')];var _0x2790c8={'count':0x0,'rows':[]},_0x11e85a={},_0x1581ce,_0x22bd5d,_0xb704c9,_0x56ab26,_0x164526;Promise[_0x2d8b('0x75')]()[_0x2d8b('0x12')](function(){if(_0x3d1940[_0x2d8b('0x7a')][_0x2d8b('0x91')]){if(!_[_0x2d8b('0x92')](_0x44acf2,_0x3d1940[_0x2d8b('0x7a')][_0x2d8b('0x91')]['toLowerCase']()))throw new Error('Invalid\x20channel');_0x1581ce=_0x3d1940[_0x2d8b('0x7a')]['channel'][_0x2d8b('0x93')]();}var _0x442d1b=_[_0x2d8b('0x19')](_0x1581ce)+_0x2d8b('0x94');var _0x2e7ab5=_['map'](db[_0x442d1b][_0x2d8b('0x76')],function(_0x1e338c){return{'name':_0x1e338c[_0x2d8b('0x77')],'type':_0x1e338c[_0x2d8b('0x78')]['key']};});_0x11e85a=qs[_0x2d8b('0x95')](_0x2e7ab5,_0x3d1940);if(_0x3d1940[_0x2d8b('0x7e')][_0x2d8b('0x7b')]===_0x2d8b('0x7e')){var _0x129fca={'params':{'id':_0x3d1940[_0x2d8b('0x7e')][_0x2d8b('0x7f')]},'query':{'section':_0x1581ce===_0x2d8b('0x22')&&_0x3d1940[_0x2d8b('0x7a')]['type']===_0x2d8b('0x23')?_0x2d8b('0x96'):_[_0x2d8b('0x19')](_0x1581ce)+'Queues','type':_0x3d1940[_0x2d8b('0x7a')][_0x2d8b('0x78')],'nolimit':!![],'sort':_0x2d8b('0xe'),'filter':_0x3d1940['query'][_0x2d8b('0x40')]}};return db[_0x2d8b('0x80')][_0x2d8b('0x81')](_0x129fca);}return db[_0x442d1b]['findAndCountAll'](_0x11e85a);})[_0x2d8b('0x12')](function(_0x3f7090){_0x2790c8[_0x2d8b('0x9')]=_0x3f7090[_0x2d8b('0x9')];_0x22bd5d=_0x3f7090[_0x2d8b('0x83')];return getRealtimeQueues(_0x3d1940,_0x1581ce);})['then'](function(_0x5eed81){_0x56ab26=_0x5eed81[_0x2d8b('0x83')];return getRealtimeAgents();})[_0x2d8b('0x12')](function(_0x3a70df){_0xb704c9=_0x3a70df[_0x2d8b('0x83')];if(_0x1581ce!=_0x2d8b('0x22'))return;return getRealtimeVoiceQueueChannels();})[_0x2d8b('0x12')](function(_0x263043){_0x164526=_0x263043?_0x263043[_0x2d8b('0x83')]:[];return initializeQueues(_0x22bd5d,_0x56ab26,_0x1581ce,_0x3d1940['query']['type']);})['then'](function(_0x47acea){var _0x1bd410=_0x47acea['map'](function(_0x3626bd){if(_0x1581ce==='voice')return getVoiceQueueAgents(_0x3626bd,_0x22bd5d,_0xb704c9,_0x164526);else return getQueueAgents(_0x3626bd,_0xb704c9,_0x1581ce);});return Promise[_0x2d8b('0x97')](_0x1bd410);})[_0x2d8b('0x12')](function(_0x5fb80f){_0x2790c8[_0x2d8b('0x83')]=_0x5fb80f;return _0x2790c8;})['then'](respondWithFilteredResult(_0x2920c2,_0x11e85a))[_0x2d8b('0x1e')](handleError(_0x2920c2,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 12aab04..d90d101 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x80544e,_0x37a3f3){var _0x4f9b90=function(_0x4f95d6){while(--_0x4f95d6){_0x80544e['push'](_0x80544e['shift']());}};_0x4f9b90(++_0x37a3f3);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xa519a3,_0x2efde9){var _0x5a44e0=function(_0xd6cd16){while(--_0xd6cd16){_0xa519a3['push'](_0xa519a3['shift']());}};_0x5a44e0(++_0x2efde9);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 69459d9..daae435 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 _0x7c1f=['exports','INTEGER','STRING','DATE','sequelize'];(function(_0x37de00,_0x52c7f2){var _0x2ef05e=function(_0x489ec5){while(--_0x489ec5){_0x37de00['push'](_0x37de00['shift']());}};_0x2ef05e(++_0x52c7f2);}(_0x7c1f,0x194));var _0xf7c1=function(_0x567051,_0x2722ed){_0x567051=_0x567051-0x0;var _0x4f89e8=_0x7c1f[_0x567051];return _0x4f89e8;};'use strict';var Sequelize=require(_0xf7c1('0x0'));module[_0xf7c1('0x1')]={'state':{'type':Sequelize[_0xf7c1('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xf7c1('0x3')]},'scheduledat':{'type':Sequelize[_0xf7c1('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xf7c1('0x4')]},'responsetime':{'type':Sequelize[_0xf7c1('0x4')]},'ringtime':{'type':Sequelize[_0xf7c1('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xf7c1('0x3')]},'membername':{'type':Sequelize[_0xf7c1('0x3')]}}; \ No newline at end of file +var _0xd1f9=['DATE','INTEGER','STRING'];(function(_0x2ff739,_0x1c8e0f){var _0x12dc13=function(_0x26fc97){while(--_0x26fc97){_0x2ff739['push'](_0x2ff739['shift']());}};_0x12dc13(++_0x1c8e0f);}(_0xd1f9,0x88));var _0x9d1f=function(_0x4ec3ab,_0x50a5de){_0x4ec3ab=_0x4ec3ab-0x0;var _0x229613=_0xd1f9[_0x4ec3ab];return _0x229613;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x9d1f('0x0')](0x2)},'statedesc':{'type':Sequelize[_0x9d1f('0x1')]},'scheduledat':{'type':Sequelize[_0x9d1f('0x2')]},'uniqueid':{'type':Sequelize[_0x9d1f('0x1')]},'starttime':{'type':Sequelize[_0x9d1f('0x2')]},'responsetime':{'type':Sequelize[_0x9d1f('0x2')]},'ringtime':{'type':Sequelize[_0x9d1f('0x0')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x9d1f('0x1')]},'campaigntype':{'type':Sequelize[_0x9d1f('0x1')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index f27f64a..83662e9 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 _0x2667=['./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview','util','../../config/logger','moment','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2667,0x15c));var _0x7266=function(_0x351c84,_0x7162a5){_0x351c84=_0x351c84-0x0;var _0x3b6ae7=_0x2667[_0x351c84];return _0x3b6ae7;};'use strict';var _=require('lodash');var util=require(_0x7266('0x0'));var logger=require(_0x7266('0x1'))('api');var moment=require(_0x7266('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7266('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7266('0x4'));module['exports']=function(_0x525569,_0x27ef05){return _0x525569[_0x7266('0x5')](_0x7266('0x6'),attributes,{'tableName':_0x7266('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1fcb=['../../config/environment','./reportAgentPreview.attributes','exports','ReportAgentPreview','report_agent_preview','util','../../config/logger','api','moment','path','rimraf'];(function(_0x1f4545,_0x4a3fdd){var _0x12b642=function(_0x28b1be){while(--_0x28b1be){_0x1f4545['push'](_0x1f4545['shift']());}};_0x12b642(++_0x4a3fdd);}(_0x1fcb,0x118));var _0xb1fc=function(_0x1d76af,_0x48451a){_0x1d76af=_0x1d76af-0x0;var _0xc79683=_0x1fcb[_0x1d76af];return _0xc79683;};'use strict';var _=require('lodash');var util=require(_0xb1fc('0x0'));var logger=require(_0xb1fc('0x1'))(_0xb1fc('0x2'));var moment=require(_0xb1fc('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb1fc('0x4'));var rimraf=require(_0xb1fc('0x5'));var config=require(_0xb1fc('0x6'));var attributes=require(_0xb1fc('0x7'));module[_0xb1fc('0x8')]=function(_0x44edf3,_0x5e5b99){return _0x44edf3['define'](_0xb1fc('0x9'),attributes,{'tableName':_0xb1fc('0xa'),'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 a35b96e..aa2448f 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 _0x6d89=['../../mysqldb','../../config/utils','jayson/promise','client','http','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash','util','moment','bluebird','randomstring'];(function(_0x46b406,_0xcef2b7){var _0x1be045=function(_0x5b4c98){while(--_0x5b4c98){_0x46b406['push'](_0x46b406['shift']());}};_0x1be045(++_0xcef2b7);}(_0x6d89,0x14d));var _0x96d8=function(_0x15876a,_0x15383d){_0x15876a=_0x15876a-0x0;var _0xbd900f=_0x6d89[_0x15876a];return _0xbd900f;};'use strict';var _=require(_0x96d8('0x0'));var util=require(_0x96d8('0x1'));var moment=require(_0x96d8('0x2'));var BPromise=require(_0x96d8('0x3'));var rs=require(_0x96d8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x96d8('0x5'))['db'];var utils=require(_0x96d8('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x96d8('0x7'));var client=jayson[_0x96d8('0x8')][_0x96d8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a0fe2,_0x17f7a4,_0x58a59f){return new BPromise(function(_0x3c7230,_0x16e729){return client['request'](_0x4a0fe2,_0x58a59f)[_0x96d8('0xa')](function(_0x3d0db2){logger[_0x96d8('0xb')](_0x96d8('0xc'),_0x17f7a4,_0x96d8('0xd'));logger[_0x96d8('0xe')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x17f7a4,_0x96d8('0xd'),JSON[_0x96d8('0xf')](_0x3d0db2));if(_0x3d0db2[_0x96d8('0x10')]){if(_0x3d0db2[_0x96d8('0x10')][_0x96d8('0x11')]===0x1f4){logger['error'](_0x96d8('0xc'),_0x17f7a4,_0x3d0db2[_0x96d8('0x10')][_0x96d8('0x12')]);return _0x16e729(_0x3d0db2['error'][_0x96d8('0x12')]);}logger[_0x96d8('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x17f7a4,_0x3d0db2['error'][_0x96d8('0x12')]);return _0x3c7230(_0x3d0db2[_0x96d8('0x10')]['message']);}else{logger[_0x96d8('0xb')](_0x96d8('0xc'),_0x17f7a4,_0x96d8('0xd'));_0x3c7230(_0x3d0db2['result'][_0x96d8('0x12')]);}})[_0x96d8('0x13')](function(_0x2855f2){logger['error'](_0x96d8('0xc'),_0x17f7a4,_0x2855f2);_0x16e729(_0x2855f2);});});}exports[_0x96d8('0x14')]=function(_0xac61ee){var _0x11ff25=this;return new Promise(function(_0x1ba123,_0x14b3ab){return db[_0x96d8('0x15')][_0x96d8('0x16')](_0xac61ee[_0x96d8('0x17')],{'raw':_0xac61ee[_0x96d8('0x18')]?_0xac61ee[_0x96d8('0x18')][_0x96d8('0x19')]===undefined?!![]:![]:!![]})[_0x96d8('0xa')](function(_0x477c1d){logger[_0x96d8('0xb')](_0x96d8('0x14'),_0xac61ee);logger[_0x96d8('0xe')](_0x96d8('0x14'),_0xac61ee,JSON[_0x96d8('0xf')](_0x477c1d));_0x1ba123(_0x477c1d);})[_0x96d8('0x13')](function(_0x584e70){logger[_0x96d8('0x10')]('CreateReportAgentPreview',_0x584e70[_0x96d8('0x12')],_0xac61ee);_0x14b3ab(_0x11ff25[_0x96d8('0x10')](0x1f4,_0x584e70['message']));});});}; \ No newline at end of file +var _0xe068=['error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s'];(function(_0x509273,_0x13fc9f){var _0x38ef40=function(_0xf8d4c9){while(--_0xf8d4c9){_0x509273['push'](_0x509273['shift']());}};_0x38ef40(++_0x13fc9f);}(_0xe068,0xeb));var _0x8e06=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe068[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x8e06('0x0'));var moment=require(_0x8e06('0x1'));var BPromise=require(_0x8e06('0x2'));var rs=require(_0x8e06('0x3'));var fs=require('fs');var Redis=require(_0x8e06('0x4'));var db=require(_0x8e06('0x5'))['db'];var utils=require(_0x8e06('0x6'));var logger=require(_0x8e06('0x7'))(_0x8e06('0x8'));var config=require(_0x8e06('0x9'));var jayson=require(_0x8e06('0xa'));var client=jayson['client'][_0x8e06('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35b63a,_0x496e50,_0x541deb){return new BPromise(function(_0x194009,_0x2cc4af){return client['request'](_0x35b63a,_0x541deb)['then'](function(_0x35b96f){logger[_0x8e06('0xc')](_0x8e06('0xd'),_0x496e50,_0x8e06('0xe'));logger[_0x8e06('0xf')](_0x8e06('0x10'),_0x496e50,'request\x20sent',JSON['stringify'](_0x35b96f));if(_0x35b96f[_0x8e06('0x11')]){if(_0x35b96f[_0x8e06('0x11')][_0x8e06('0x12')]===0x1f4){logger[_0x8e06('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x496e50,_0x35b96f[_0x8e06('0x11')][_0x8e06('0x13')]);return _0x2cc4af(_0x35b96f[_0x8e06('0x11')]['message']);}logger[_0x8e06('0x11')](_0x8e06('0xd'),_0x496e50,_0x35b96f[_0x8e06('0x11')]['message']);return _0x194009(_0x35b96f[_0x8e06('0x11')][_0x8e06('0x13')]);}else{logger['info'](_0x8e06('0xd'),_0x496e50,_0x8e06('0xe'));_0x194009(_0x35b96f[_0x8e06('0x14')]['message']);}})[_0x8e06('0x15')](function(_0x3ea8bb){logger[_0x8e06('0x11')](_0x8e06('0xd'),_0x496e50,_0x3ea8bb);_0x2cc4af(_0x3ea8bb);});});}exports[_0x8e06('0x16')]=function(_0x5b7662){var _0x4feb1f=this;return new Promise(function(_0x249fd1,_0xaaf8af){return db[_0x8e06('0x17')][_0x8e06('0x18')](_0x5b7662[_0x8e06('0x19')],{'raw':_0x5b7662[_0x8e06('0x1a')]?_0x5b7662[_0x8e06('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2e1f40){logger[_0x8e06('0xc')]('CreateReportAgentPreview',_0x5b7662);logger[_0x8e06('0xf')]('CreateReportAgentPreview',_0x5b7662,JSON[_0x8e06('0x1b')](_0x2e1f40));_0x249fd1(_0x2e1f40);})[_0x8e06('0x15')](function(_0x2c1c19){logger[_0x8e06('0x11')]('CreateReportAgentPreview',_0x2c1c19['message'],_0x5b7662);_0xaaf8af(_0x4feb1f[_0x8e06('0x11')](0x1f4,_0x2c1c19['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 1ac923c..98ef93d 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 _0x1b18=['/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','fax','showFaxQueues','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','agentNotify','exports','multer','path','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','mailAccounts','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/agents','agentCapacity','/telephones','telephones','/trunks','trunks','campaigns'];(function(_0x2e6ec3,_0x192e17){var _0xa4558b=function(_0x246ff4){while(--_0x246ff4){_0x2e6ec3['push'](_0x2e6ec3['shift']());}};_0xa4558b(++_0x192e17);}(_0x1b18,0x197));var _0x81b1=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x1b18[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x81b1('0x0'));var util=require('util');var path=require(_0x81b1('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x81b1('0x2'));router[_0x81b1('0x3')](_0x81b1('0x4'),auth[_0x81b1('0x5')](),controller[_0x81b1('0x6')]);router[_0x81b1('0x3')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x81b1('0x5')](),controller[_0x81b1('0x7')]);router[_0x81b1('0x3')](_0x81b1('0x8'),auth[_0x81b1('0x5')](),controller[_0x81b1('0x9')]);router[_0x81b1('0x3')](_0x81b1('0xa'),auth['isAuthenticated'](),controller[_0x81b1('0xb')]);router[_0x81b1('0x3')]('/chat/queues',auth['isAuthenticated'](),controller[_0x81b1('0xc')]);router[_0x81b1('0x3')](_0x81b1('0xd'),auth[_0x81b1('0x5')](),controller[_0x81b1('0xe')]);router[_0x81b1('0x3')]('/mail/accounts',auth[_0x81b1('0x5')](),controller[_0x81b1('0xf')]);router['get']('/openchannel/queues',auth[_0x81b1('0x5')](),controller[_0x81b1('0x10')]);router['get'](_0x81b1('0x11'),auth[_0x81b1('0x5')](),controller[_0x81b1('0x12')]);router[_0x81b1('0x3')](_0x81b1('0x13'),auth[_0x81b1('0x5')](),controller[_0x81b1('0x14')]);router['get']('/fax/queues',auth[_0x81b1('0x5')](),controller[_0x81b1('0x15')]);router[_0x81b1('0x3')](_0x81b1('0x16'),auth['isAuthenticated'](),controller['voiceQueuesPreview']);router['get'](_0x81b1('0x17'),auth['isAuthenticated'](),controller['voiceQueuesChannels']);router[_0x81b1('0x3')](_0x81b1('0x18'),auth[_0x81b1('0x5')](),controller[_0x81b1('0x19')]);router['get'](_0x81b1('0x1a'),auth[_0x81b1('0x5')](),controller[_0x81b1('0x1b')]);router[_0x81b1('0x3')](_0x81b1('0x1c'),auth[_0x81b1('0x5')](),controller[_0x81b1('0x1d')]);router['get']('/voice/queues/:id',auth[_0x81b1('0x5')](),controller[_0x81b1('0x1e')]);router[_0x81b1('0x1f')](_0x81b1('0x20'),auth[_0x81b1('0x5')](),controller[_0x81b1('0x21')]);router['get'](_0x81b1('0x22'),auth[_0x81b1('0x5')](),controller[_0x81b1('0x23')]);router[_0x81b1('0x3')]('/outbound/channels',auth[_0x81b1('0x5')](),controller['outboundChannels']);router[_0x81b1('0x3')](_0x81b1('0x24'),auth[_0x81b1('0x5')](),controller['agents']);router['put']('/agents/:id/capacity',auth['isAuthenticated'](),controller[_0x81b1('0x25')]);router['get'](_0x81b1('0x26'),auth[_0x81b1('0x5')](),controller[_0x81b1('0x27')]);router[_0x81b1('0x3')](_0x81b1('0x28'),auth[_0x81b1('0x5')](),controller[_0x81b1('0x29')]);router['get']('/campaigns',auth[_0x81b1('0x5')](),controller[_0x81b1('0x2a')]);router[_0x81b1('0x3')](_0x81b1('0x2b'),auth['isAuthenticated'](),controller['faxAccounts']);router[_0x81b1('0x3')](_0x81b1('0x2c'),auth['isAuthenticated'](),controller[_0x81b1('0x2d')]);router[_0x81b1('0x3')](_0x81b1('0x2e'),auth['isAuthenticated'](),controller[_0x81b1('0x2f')]);router[_0x81b1('0x3')](_0x81b1('0x30'),auth[_0x81b1('0x5')](),controller[_0x81b1('0x31')]);router['get'](_0x81b1('0x32'),auth[_0x81b1('0x5')](),controller[_0x81b1('0x33')]);router[_0x81b1('0x3')](_0x81b1('0x34'),auth[_0x81b1('0x5')](),controller['smsQueuesWaitingInteractions']);router[_0x81b1('0x3')](_0x81b1('0x35'),auth[_0x81b1('0x5')](),controller[_0x81b1('0x36')]);router['get']('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller['faxQueuesWaitingInteractions']);router[_0x81b1('0x37')](_0x81b1('0x38'),auth[_0x81b1('0x5')](),controller[_0x81b1('0x39')](_0x81b1('0x3a')));router[_0x81b1('0x3')]('/mail/queues/:id',auth['isAuthenticated'](),controller['showMailQueues']);router[_0x81b1('0x37')](_0x81b1('0x3b'),auth['isAuthenticated'](),controller['queueNotify'](_0x81b1('0x3c')));router[_0x81b1('0x3')](_0x81b1('0x3d'),auth[_0x81b1('0x5')](),controller[_0x81b1('0x3e')]);router[_0x81b1('0x37')]('/fax/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0x81b1('0x3f')));router['get']('/fax/queues/:id',auth[_0x81b1('0x5')](),controller[_0x81b1('0x40')]);router[_0x81b1('0x37')]('/openchannel/queues/:id/notify',auth[_0x81b1('0x5')](),controller[_0x81b1('0x39')]('openchannel'));router[_0x81b1('0x3')](_0x81b1('0x41'),auth[_0x81b1('0x5')](),controller[_0x81b1('0x42')]);router[_0x81b1('0x37')](_0x81b1('0x43'),auth[_0x81b1('0x5')](),controller[_0x81b1('0x39')](_0x81b1('0x44')));router[_0x81b1('0x37')]('/whatsapp/queues/:id/notify',auth['isAuthenticated'](),controller[_0x81b1('0x39')](_0x81b1('0x45')));router[_0x81b1('0x3')](_0x81b1('0x46'),auth[_0x81b1('0x5')](),controller[_0x81b1('0x47')]);router[_0x81b1('0x3')]('/whatsapp/queues/:id',auth['isAuthenticated'](),controller[_0x81b1('0x48')]);router[_0x81b1('0x37')]('/agents/:id/notify',auth['isAuthenticated'](),controller[_0x81b1('0x49')]);module[_0x81b1('0x4a')]=router; \ No newline at end of file +var _0x119e=['/voice/channels','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','/mail/accounts','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','outbound','/outbound/channels','outboundChannels','/agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','whatsapp','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','multer','util','express','Router','../../components/auth/service','./rpc.controller'];(function(_0x3dfbcb,_0x431019){var _0x30ae19=function(_0x482027){while(--_0x482027){_0x3dfbcb['push'](_0x3dfbcb['shift']());}};_0x30ae19(++_0x431019);}(_0x119e,0xf9));var _0xe119=function(_0x101bea,_0xf68894){_0x101bea=_0x101bea-0x0;var _0x1db6ba=_0x119e[_0x101bea];return _0x1db6ba;};'use strict';var multer=require(_0xe119('0x0'));var util=require(_0xe119('0x1'));var path=require('path');var express=require(_0xe119('0x2'));var router=express[_0xe119('0x3')]();var auth=require(_0xe119('0x4'));var controller=require(_0xe119('0x5'));router['get'](_0xe119('0x6'),auth[_0xe119('0x7')](),controller[_0xe119('0x8')]);router[_0xe119('0x9')](_0xe119('0xa'),auth[_0xe119('0x7')](),controller[_0xe119('0xb')]);router[_0xe119('0x9')](_0xe119('0xc'),auth['isAuthenticated'](),controller[_0xe119('0xd')]);router['get'](_0xe119('0xe'),auth[_0xe119('0x7')](),controller[_0xe119('0xf')]);router['get'](_0xe119('0x10'),auth['isAuthenticated'](),controller[_0xe119('0x11')]);router[_0xe119('0x9')]('/mail/queues',auth[_0xe119('0x7')](),controller[_0xe119('0x12')]);router['get'](_0xe119('0x13'),auth['isAuthenticated'](),controller['mailAccounts']);router[_0xe119('0x9')]('/openchannel/queues',auth[_0xe119('0x7')](),controller[_0xe119('0x14')]);router['get']('/sms/queues',auth[_0xe119('0x7')](),controller[_0xe119('0x15')]);router[_0xe119('0x9')](_0xe119('0x16'),auth[_0xe119('0x7')](),controller[_0xe119('0x17')]);router['get']('/fax/queues',auth[_0xe119('0x7')](),controller[_0xe119('0x18')]);router[_0xe119('0x9')]('/voice/queues/preview/:id',auth[_0xe119('0x7')](),controller[_0xe119('0x19')]);router[_0xe119('0x9')](_0xe119('0x1a'),auth[_0xe119('0x7')](),controller[_0xe119('0x1b')]);router['get'](_0xe119('0x1c'),auth[_0xe119('0x7')](),controller[_0xe119('0x1d')]);router['get'](_0xe119('0x1e'),auth['isAuthenticated'](),controller[_0xe119('0x1f')]);router['get']('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xe119('0x7')](),controller[_0xe119('0x20')]);router['get'](_0xe119('0x21'),auth[_0xe119('0x7')](),controller[_0xe119('0x22')]);router[_0xe119('0x23')](_0xe119('0x21'),auth[_0xe119('0x7')](),controller[_0xe119('0x24')]);router[_0xe119('0x9')]('/outbound',auth[_0xe119('0x7')](),controller[_0xe119('0x25')]);router[_0xe119('0x9')](_0xe119('0x26'),auth['isAuthenticated'](),controller[_0xe119('0x27')]);router['get'](_0xe119('0x28'),auth[_0xe119('0x7')](),controller['agents']);router[_0xe119('0x23')](_0xe119('0x29'),auth['isAuthenticated'](),controller[_0xe119('0x2a')]);router[_0xe119('0x9')](_0xe119('0x2b'),auth['isAuthenticated'](),controller[_0xe119('0x2c')]);router[_0xe119('0x9')](_0xe119('0x2d'),auth[_0xe119('0x7')](),controller[_0xe119('0x2e')]);router['get'](_0xe119('0x2f'),auth[_0xe119('0x7')](),controller[_0xe119('0x30')]);router[_0xe119('0x9')](_0xe119('0x31'),auth[_0xe119('0x7')](),controller[_0xe119('0x32')]);router['get'](_0xe119('0x33'),auth[_0xe119('0x7')](),controller['chatQueuesWaitingInteractions']);router['get'](_0xe119('0x34'),auth[_0xe119('0x7')](),controller['mailQueuesWaitingInteractions']);router[_0xe119('0x9')]('/openchannel/queues/waitinginteractions',auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0xe119('0x9')](_0xe119('0x35'),auth[_0xe119('0x7')](),controller[_0xe119('0x36')]);router[_0xe119('0x9')](_0xe119('0x37'),auth[_0xe119('0x7')](),controller[_0xe119('0x38')]);router[_0xe119('0x9')](_0xe119('0x39'),auth[_0xe119('0x7')](),controller[_0xe119('0x3a')]);router['get'](_0xe119('0x3b'),auth[_0xe119('0x7')](),controller[_0xe119('0x3c')]);router[_0xe119('0x3d')](_0xe119('0x3e'),auth[_0xe119('0x7')](),controller[_0xe119('0x3f')](_0xe119('0x40')));router[_0xe119('0x9')](_0xe119('0x41'),auth[_0xe119('0x7')](),controller[_0xe119('0x42')]);router[_0xe119('0x3d')](_0xe119('0x43'),auth['isAuthenticated'](),controller[_0xe119('0x3f')](_0xe119('0x44')));router[_0xe119('0x9')](_0xe119('0x45'),auth[_0xe119('0x7')](),controller[_0xe119('0x46')]);router[_0xe119('0x3d')](_0xe119('0x47'),auth[_0xe119('0x7')](),controller['queueNotify'](_0xe119('0x48')));router['get'](_0xe119('0x49'),auth[_0xe119('0x7')](),controller[_0xe119('0x4a')]);router[_0xe119('0x3d')](_0xe119('0x4b'),auth[_0xe119('0x7')](),controller[_0xe119('0x3f')](_0xe119('0x4c')));router[_0xe119('0x9')](_0xe119('0x4d'),auth[_0xe119('0x7')](),controller[_0xe119('0x4e')]);router[_0xe119('0x3d')]('/sms/queues/:id/notify',auth[_0xe119('0x7')](),controller['queueNotify'](_0xe119('0x4f')));router[_0xe119('0x3d')](_0xe119('0x50'),auth[_0xe119('0x7')](),controller[_0xe119('0x3f')](_0xe119('0x51')));router[_0xe119('0x9')]('/sms/queues/:id',auth[_0xe119('0x7')](),controller['showSmsQueues']);router[_0xe119('0x9')](_0xe119('0x52'),auth[_0xe119('0x7')](),controller['showWhatsappQueues']);router['post'](_0xe119('0x53'),auth['isAuthenticated'](),controller[_0xe119('0x54')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index b75c640..3eaf39f 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 _0x2bd8=['SmsQueues','showSmsQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','map','queue_id','uniq','filter','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','chat','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','Interaction','Account','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','User','Agent\x20not\x20found','\x20Message\x20not\x20found','update','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','error','message','result','status','json','sendStatus','name','send','isNil','rows','find','voiceChannels','then','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','Outbound','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','MemberReport','findAll','INTERACTION','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','interface','SIP/%s','format','agent','internal','telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues'];(function(_0x451ad7,_0x4d26e2){var _0x21665b=function(_0x3fd581){while(--_0x3fd581){_0x451ad7['push'](_0x451ad7['shift']());}};_0x21665b(++_0x4d26e2);}(_0x2bd8,0x130));var _0x82bd=function(_0x34d72c,_0x330719){_0x34d72c=_0x34d72c-0x0;var _0x1af445=_0x2bd8[_0x34d72c];return _0x1af445;};'use strict';var BPromise=require(_0x82bd('0x0'));var moment=require('moment');var _=require(_0x82bd('0x1'));var util=require(_0x82bd('0x2'));var db=require(_0x82bd('0x3'))['db'];var logger=require(_0x82bd('0x4'))(_0x82bd('0x5'));var jayson=require(_0x82bd('0x6'));var amiClient=jayson[_0x82bd('0x7')]['http']({'port':0x232a});var mailClient=jayson[_0x82bd('0x7')][_0x82bd('0x8')]({'port':0x232b});var routingClient=jayson[_0x82bd('0x7')]['http']({'port':0x232c});function respondWithRpcPromise(_0x19dbb1,_0x77d7a9,_0x226f60){return new BPromise(function(_0x1f7463,_0x4dc3a6){var _0x1666cf=_0x226f60?_0x226f60:amiClient;return _0x1666cf['request'](_0x19dbb1,_0x77d7a9)['then'](function(_0x51c6ea){if(_0x51c6ea[_0x82bd('0x9')]){if(_0x51c6ea['error']['code']===0x1f4){return _0x4dc3a6(_0x51c6ea[_0x82bd('0x9')]['message']);}return _0x1f7463(_0x51c6ea['error'][_0x82bd('0xa')]);}else{_0x1f7463(_0x51c6ea[_0x82bd('0xb')]);}})['catch'](function(_0x140ad6){_0x4dc3a6(_0x140ad6);});});}function respondWithResult(_0x5f1ab9,_0xfaccf7){_0xfaccf7=_0xfaccf7||0xc8;return function(_0x51e17e){if(_0x51e17e){return _0x5f1ab9[_0x82bd('0xc')](_0xfaccf7)[_0x82bd('0xd')](_0x51e17e);}return _0x5f1ab9[_0x82bd('0xe')](0x194);};}function handleError(_0x2ca530,_0x58d82b){_0x58d82b=_0x58d82b||0x1f4;return function(_0x446ffc){logger[_0x82bd('0x9')](_0x446ffc['stack']);if(_0x446ffc[_0x82bd('0xf')]){delete _0x446ffc['name'];}_0x2ca530[_0x82bd('0xc')](_0x58d82b)[_0x82bd('0x10')](_0x446ffc);};}function findById(_0x2c5155){return function(_0x300982){if(!_[_0x82bd('0x11')](_0x2c5155)&&!_[_0x82bd('0x11')](_0x300982)&&!_[_0x82bd('0x11')](_0x300982[_0x82bd('0x12')])){return _[_0x82bd('0x13')](_0x300982[_0x82bd('0x12')],function(_0x390107){return _0x390107['id']==_0x2c5155;});}return null;};}exports[_0x82bd('0x14')]=function(_0x1c3779,_0x253741){return respondWithRpcPromise('VoiceChannels',_0x1c3779['query'])[_0x82bd('0x15')](respondWithResult(_0x253741,null))[_0x82bd('0x16')](handleError(_0x253741,null));};exports[_0x82bd('0x17')]=function(_0xc9fcdf,_0x34899b){return respondWithRpcPromise(_0x82bd('0x18'),_[_0x82bd('0x19')](_0xc9fcdf[_0x82bd('0x1a')],_0xc9fcdf[_0x82bd('0x1b')]))[_0x82bd('0x15')](respondWithResult(_0x34899b,null))[_0x82bd('0x16')](handleError(_0x34899b,null));};exports[_0x82bd('0x1c')]=function(_0x1ca91f,_0x3260c4){return respondWithRpcPromise(_0x82bd('0x1d'),_[_0x82bd('0x19')](_0x1ca91f[_0x82bd('0x1a')],_0x1ca91f[_0x82bd('0x1b')]))[_0x82bd('0x15')](respondWithResult(_0x3260c4,null))['catch'](handleError(_0x3260c4,null));};exports['voiceQueues']=function(_0x4248be,_0x436ecd){return respondWithRpcPromise(_0x82bd('0x1e'),_0x4248be[_0x82bd('0x1a')])[_0x82bd('0x15')](respondWithResult(_0x436ecd,null))[_0x82bd('0x16')](handleError(_0x436ecd,null));};exports[_0x82bd('0x1f')]=function(_0xbef23b,_0x2f0bb6){return respondWithRpcPromise(_0x82bd('0x1e'),_0xbef23b['query'])['then'](findById(_0xbef23b['params']['id']))['then'](respondWithResult(_0x2f0bb6,null))[_0x82bd('0x16')](handleError(_0x2f0bb6,null));};exports[_0x82bd('0x20')]=function(_0x351d3d,_0x190bca){return respondWithRpcPromise(_0x82bd('0x21'),_['merge'](_0x351d3d['body'],_0x351d3d['params']))[_0x82bd('0x15')](respondWithResult(_0x190bca,null))[_0x82bd('0x16')](handleError(_0x190bca,null));};exports[_0x82bd('0x22')]=function(_0x580ba8,_0x166c46){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x82bd('0x19')](_0x580ba8[_0x82bd('0x1a')],_0x580ba8[_0x82bd('0x1b')]))[_0x82bd('0x15')](respondWithResult(_0x166c46,null))[_0x82bd('0x16')](handleError(_0x166c46,null));};exports[_0x82bd('0x23')]=function(_0x5ca7fc,_0x591b38){return respondWithRpcPromise(_0x82bd('0x24'),_0x5ca7fc[_0x82bd('0x1a')])['then'](respondWithResult(_0x591b38,null))[_0x82bd('0x16')](handleError(_0x591b38,null));};exports['voiceQueuesChannel']=function(_0x578e6e,_0x3b8015){return respondWithRpcPromise(_0x82bd('0x25'),_[_0x82bd('0x19')](_0x578e6e[_0x82bd('0x1a')],_0x578e6e[_0x82bd('0x1b')]))[_0x82bd('0x15')](respondWithResult(_0x3b8015,null))[_0x82bd('0x16')](handleError(_0x3b8015,null));};exports[_0x82bd('0x26')]=function(_0x42dc7f,_0xefc6e4){return respondWithRpcPromise(_0x82bd('0x27'),_[_0x82bd('0x19')](_0x42dc7f[_0x82bd('0x1a')],_0x42dc7f[_0x82bd('0x1b')]))[_0x82bd('0x15')](respondWithResult(_0xefc6e4,null))[_0x82bd('0x16')](handleError(_0xefc6e4,null));};exports[_0x82bd('0x28')]=function(_0x4bdcae,_0x59b7ca){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x82bd('0x19')](_0x4bdcae[_0x82bd('0x1a')],_0x4bdcae['params']))[_0x82bd('0x15')](respondWithResult(_0x59b7ca,null))['catch'](handleError(_0x59b7ca,null));};exports['outbound']=function(_0x4c5f8d,_0x2b7675){return respondWithRpcPromise(_0x82bd('0x29'),_0x4c5f8d[_0x82bd('0x1a')])[_0x82bd('0x15')](respondWithResult(_0x2b7675,null))[_0x82bd('0x16')](handleError(_0x2b7675,null));};exports['outboundChannels']=function(_0x54e33f,_0x575c14){return respondWithRpcPromise(_0x82bd('0x2a'),_0x54e33f['query'])['then'](respondWithResult(_0x575c14,null))[_0x82bd('0x16')](handleError(_0x575c14,null));};exports[_0x82bd('0x2b')]=function(_0x3192e2,_0x2c5e7d){var _0x3ff054;return respondWithRpcPromise(_0x82bd('0x2c'),_0x3192e2[_0x82bd('0x1a')])[_0x82bd('0x15')](function(_0x18752a){_0x3ff054=_0x18752a;return respondWithRpcPromise('Agents',_0x3192e2['query'],routingClient);})[_0x82bd('0x15')](function(_0x689b3c){return _['merge']({},_0x689b3c,_0x3ff054);})['then'](respondWithResult(_0x2c5e7d,null))[_0x82bd('0x16')](handleError(_0x2c5e7d,null));};exports[_0x82bd('0x2d')]=function(_0x4d310b,_0x121f1f){if(_0x4d310b[_0x82bd('0x2e')]&&_0x4d310b[_0x82bd('0x2e')][_0x82bd('0x2f')]&&_0x4d310b[_0x82bd('0x30')]&&_0x4d310b[_0x82bd('0x30')][_0x82bd('0xf')]){for(var _0x2c429d in _0x4d310b[_0x82bd('0x2e')][_0x82bd('0x2f')]){if(_0x4d310b[_0x82bd('0x2e')][_0x82bd('0x2f')]['hasOwnProperty'](_0x2c429d)){db[_0x82bd('0x31')][_0x82bd('0x32')]({'where':{'channel':_0x2c429d,'membername':_0x4d310b['user']['name'],'type':_0x82bd('0x33'),'exitAt':null,'uniqueid':_0x4d310b[_0x82bd('0x2e')][_0x82bd('0x2f')][_0x2c429d]&&_0x4d310b[_0x82bd('0x2e')][_0x82bd('0x2f')][_0x2c429d]['length']?{'$notIn':_0x4d310b['body'][_0x82bd('0x2f')][_0x2c429d]}:{'$ne':null}}})[_0x82bd('0x15')](function(_0x4b2fb8){var _0x158957=moment()['format'](_0x82bd('0x34'));for(var _0x6d65c6=0x0,_0x587aec=_0x4b2fb8[_0x82bd('0x35')];_0x6d65c6<_0x587aec;_0x6d65c6+=0x1){_0x4b2fb8[_0x6d65c6][_0x82bd('0x36')]({'exitAt':_0x158957});}});for(var _0x54d12e=0x0;_0x54d12e<_0x4d310b['body'][_0x82bd('0x2f')][_0x2c429d]['length'];_0x54d12e+=0x1){db[_0x82bd('0x31')][_0x82bd('0x37')]({'where':{'channel':_0x2c429d,'membername':_0x4d310b[_0x82bd('0x30')][_0x82bd('0xf')],'type':'INTERACTION','uniqueid':_0x4d310b['body'][_0x82bd('0x2f')][_0x2c429d][_0x54d12e],'exitAt':null},'defaults':{'channel':_0x2c429d,'membername':_0x4d310b[_0x82bd('0x30')]['name'],'interface':_[_0x82bd('0x11')](_0x4d310b[_0x82bd('0x30')][_0x82bd('0x38')])?util['format'](_0x82bd('0x39'),_0x4d310b[_0x82bd('0x30')][_0x82bd('0xf')]):_0x4d310b[_0x82bd('0x30')][_0x82bd('0x38')],'type':_0x82bd('0x33'),'enterAt':moment()[_0x82bd('0x3a')](_0x82bd('0x34')),'role':_0x82bd('0x3b'),'internal':_0x4d310b[_0x82bd('0x30')][_0x82bd('0x3c')],'uniqueid':_0x4d310b[_0x82bd('0x2e')][_0x82bd('0x2f')][_0x2c429d][_0x54d12e]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x4d310b[_0x82bd('0x1b')]['id'],'capacity':_0x4d310b[_0x82bd('0x2e')]['capacity']},routingClient)[_0x82bd('0x15')](respondWithResult(_0x121f1f,null))[_0x82bd('0x16')](handleError(_0x121f1f,null));};exports[_0x82bd('0x3d')]=function(_0x4237ef,_0x55a2e6){return respondWithRpcPromise('Telephones',_0x4237ef[_0x82bd('0x1a')])['then'](respondWithResult(_0x55a2e6,null))['catch'](handleError(_0x55a2e6,null));};exports[_0x82bd('0x3e')]=function(_0x4c35dd,_0x523cbe){return respondWithRpcPromise(_0x82bd('0x3f'),_0x4c35dd[_0x82bd('0x1a')])[_0x82bd('0x15')](respondWithResult(_0x523cbe,null))[_0x82bd('0x16')](handleError(_0x523cbe,null));};exports[_0x82bd('0x40')]=function(_0x1a7402,_0x417c29){return respondWithRpcPromise(_0x82bd('0x41'),_0x1a7402[_0x82bd('0x1a')])[_0x82bd('0x15')](respondWithResult(_0x417c29,null))[_0x82bd('0x16')](handleError(_0x417c29,null));};exports[_0x82bd('0x42')]=function(_0x153fad,_0x1a1cdc){return respondWithRpcPromise(_0x82bd('0x43'),_0x153fad['query'],routingClient)[_0x82bd('0x15')](respondWithResult(_0x1a1cdc,null))[_0x82bd('0x16')](handleError(_0x1a1cdc,null));};exports[_0x82bd('0x44')]=function(_0x354581,_0x9bf8fa){return respondWithRpcPromise('ChatQueues',_0x354581['query'],routingClient)['then'](findById(_0x354581['params']['id']))[_0x82bd('0x15')](respondWithResult(_0x9bf8fa,null))[_0x82bd('0x16')](handleError(_0x9bf8fa,null));};exports[_0x82bd('0x45')]=function(_0x127f8f,_0x568fc3){return respondWithRpcPromise('MailQueues',_0x127f8f[_0x82bd('0x1a')],routingClient)[_0x82bd('0x15')](respondWithResult(_0x568fc3,null))[_0x82bd('0x16')](handleError(_0x568fc3,null));};exports['showMailQueues']=function(_0x2657bc,_0x2252ef){return respondWithRpcPromise(_0x82bd('0x46'),_0x2657bc[_0x82bd('0x1a')],routingClient)[_0x82bd('0x15')](findById(_0x2657bc[_0x82bd('0x1b')]['id']))[_0x82bd('0x15')](respondWithResult(_0x2252ef,null))[_0x82bd('0x16')](handleError(_0x2252ef,null));};exports[_0x82bd('0x47')]=function(_0x20b636,_0x3ae44e){return respondWithRpcPromise(_0x82bd('0x48'),_0x20b636[_0x82bd('0x1a')],mailClient)[_0x82bd('0x15')](respondWithResult(_0x3ae44e,null))[_0x82bd('0x16')](handleError(_0x3ae44e,null));};exports[_0x82bd('0x49')]=function(_0x124ca4,_0x1fa71d){return respondWithRpcPromise('OpenchannelQueues',_0x124ca4[_0x82bd('0x1a')],routingClient)['then'](respondWithResult(_0x1fa71d,null))['catch'](handleError(_0x1fa71d,null));};exports[_0x82bd('0x4a')]=function(_0x4d2305,_0x306247){return respondWithRpcPromise(_0x82bd('0x4b'),_0x4d2305[_0x82bd('0x1a')],routingClient)[_0x82bd('0x15')](findById(_0x4d2305[_0x82bd('0x1b')]['id']))[_0x82bd('0x15')](respondWithResult(_0x306247,null))[_0x82bd('0x16')](handleError(_0x306247,null));};exports[_0x82bd('0x4c')]=function(_0x40d6cf,_0x37ede1){return respondWithRpcPromise(_0x82bd('0x4d'),_0x40d6cf['query'],routingClient)['then'](respondWithResult(_0x37ede1,null))[_0x82bd('0x16')](handleError(_0x37ede1,null));};exports[_0x82bd('0x4e')]=function(_0x513e1d,_0x47d136){return respondWithRpcPromise(_0x82bd('0x4d'),_0x513e1d[_0x82bd('0x1a')],routingClient)[_0x82bd('0x15')](findById(_0x513e1d[_0x82bd('0x1b')]['id']))['then'](respondWithResult(_0x47d136,null))[_0x82bd('0x16')](handleError(_0x47d136,null));};exports['whatsappQueues']=function(_0x1a16c1,_0x6ff77c){return respondWithRpcPromise('WhatsappQueues',_0x1a16c1[_0x82bd('0x1a')],routingClient)[_0x82bd('0x15')](respondWithResult(_0x6ff77c,null))[_0x82bd('0x16')](handleError(_0x6ff77c,null));};exports[_0x82bd('0x4f')]=function(_0x5a5d66,_0x1b5b39){return respondWithRpcPromise(_0x82bd('0x50'),_0x5a5d66[_0x82bd('0x1a')],routingClient)[_0x82bd('0x15')](findById(_0x5a5d66[_0x82bd('0x1b')]['id']))[_0x82bd('0x15')](respondWithResult(_0x1b5b39,null))[_0x82bd('0x16')](handleError(_0x1b5b39,null));};exports[_0x82bd('0x51')]=function(_0x1384b0,_0x544f10){return respondWithRpcPromise(_0x82bd('0x52'),_0x1384b0['query'],routingClient)['then'](respondWithResult(_0x544f10,null))[_0x82bd('0x16')](handleError(_0x544f10,null));};exports[_0x82bd('0x53')]=function(_0x529cb2,_0x2d2a7e){return respondWithRpcPromise('FaxQueues',_0x529cb2[_0x82bd('0x1a')],routingClient)[_0x82bd('0x15')](findById(_0x529cb2['params']['id']))[_0x82bd('0x15')](respondWithResult(_0x2d2a7e,null))[_0x82bd('0x16')](handleError(_0x2d2a7e,null));};exports['faxAccounts']=function(_0x505032,_0x5bd3ae){return respondWithRpcPromise(_0x82bd('0x54'),_0x505032[_0x82bd('0x1a')])['then'](respondWithResult(_0x5bd3ae,null))[_0x82bd('0x16')](handleError(_0x5bd3ae,null));};exports[_0x82bd('0x55')]=function(_0x52b73f,_0x5591af){return respondWithRpcPromise(_0x82bd('0x56'),_0x52b73f['query'],routingClient)['then'](respondWithResult(_0x5591af,null))[_0x82bd('0x16')](handleError(_0x5591af,null));};exports[_0x82bd('0x57')]=function(_0x988094,_0x3d1f0d){return respondWithRpcPromise(_0x82bd('0x58'),_0x988094['query'],routingClient)[_0x82bd('0x15')](respondWithResult(_0x3d1f0d,null))['catch'](handleError(_0x3d1f0d,null));};exports[_0x82bd('0x59')]=function(_0x5e25c3,_0x2fbf08){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x5e25c3['query'],routingClient)[_0x82bd('0x15')](respondWithResult(_0x2fbf08,null))[_0x82bd('0x16')](handleError(_0x2fbf08,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x282263,_0x15a849){return respondWithRpcPromise(_0x82bd('0x5a'),_0x282263['query'],routingClient)['then'](function(_0x197368){if(_0x282263[_0x82bd('0x1a')]['type']!==undefined){var _0x222f9d=_(_0x197368[_0x82bd('0x12')])['filter']([_0x282263[_0x82bd('0x1a')][_0x82bd('0x5b')],_0x282263[_0x82bd('0x1b')]['id']])[_0x82bd('0x5c')](_0x82bd('0x5d'))[_0x82bd('0x5e')]()['value']();return _0x197368[_0x82bd('0x12')][_0x82bd('0x5f')](function(_0x12bc87){return _0x222f9d['indexOf'](_0x12bc87[_0x82bd('0x5d')])>-0x1;});}else{return _0x197368['rows'][_0x82bd('0x5f')](function(_0x2d9bc0){return _0x2d9bc0[_0x82bd('0x5d')]===parseInt(_0x282263[_0x82bd('0x1b')]['id']);});}})[_0x82bd('0x15')](respondWithResult(_0x15a849,null))['catch'](handleError(_0x15a849,null));};exports[_0x82bd('0x60')]=function(_0x39b9d5,_0x54e547){return respondWithRpcPromise(_0x82bd('0x61'),_0x39b9d5[_0x82bd('0x1a')],routingClient)['then'](respondWithResult(_0x54e547,null))[_0x82bd('0x16')](handleError(_0x54e547,null));};exports[_0x82bd('0x62')]=function(_0x42d4c9,_0x55fe38){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x42d4c9[_0x82bd('0x1a')],routingClient)[_0x82bd('0x15')](respondWithResult(_0x55fe38,null))[_0x82bd('0x16')](handleError(_0x55fe38,null));};exports['faxQueuesWaitingInteractions']=function(_0x465979,_0x4721c3){return respondWithRpcPromise(_0x82bd('0x63'),_0x465979['query'],routingClient)['then'](respondWithResult(_0x4721c3,null))['catch'](handleError(_0x4721c3,null));};exports['queueNotify']=function(_0x437463){return function(_0x45bbf7,_0x4b5bf4){var _0x35d111,_0x546106;var _0x1da93f=_['capitalize'](_0x437463);var _0x43d8a2=_0x437463===_0x82bd('0x64')?_0x82bd('0x65'):'Account';return db[_0x1da93f+_0x82bd('0x66')][_0x82bd('0x67')]({'raw':!![],'where':{'id':_0x45bbf7[_0x82bd('0x1b')]['id']}})[_0x82bd('0x15')](function(_0xbe937d){if(_['isNil'](_0xbe937d)){throw new Error(_0x1da93f+_0x82bd('0x68'));}_0x35d111=_0xbe937d;return db[_0x1da93f+_0x82bd('0x69')][_0x82bd('0x67')]({'where':{'id':_0x45bbf7['body']['messageId']},'include':[{'model':db[_0x1da93f+'Interaction'],'as':_0x82bd('0x6a')},{'model':db[_0x1da93f+_0x43d8a2],'as':_0x82bd('0x6b')}]});})[_0x82bd('0x15')](function(_0x1a7f98){if(_[_0x82bd('0x11')](_0x1a7f98)){throw new Error(_0x1da93f+'\x20Message\x20not\x20found');}_0x546106=_0x1a7f98;return _0x1a7f98['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5a8e7f={'uniqueid':_0x437463+'.'+_0x546106['id']+'.'+_0x546106[_0x82bd('0x6a')]['id'],'FromUserId':_0x45bbf7[_0x82bd('0x30')]['id'],'type':_0x82bd('0x6c')};_0x5a8e7f[_0x1da93f+_0x82bd('0x6d')]=_0x546106['id'];_0x5a8e7f[_0x1da93f+_0x82bd('0x6e')]=_0x546106[_0x82bd('0x6a')]['id'];_0x5a8e7f[_0x82bd('0x6f')+_0x1da93f+_0x43d8a2+'Id']=_0x546106['Account']['id'];_0x5a8e7f['To'+_0x1da93f+_0x82bd('0x70')]=_0x35d111['id'];return db[_0x1da93f+_0x82bd('0x71')][_0x82bd('0x72')](_0x5a8e7f);})[_0x82bd('0x15')](function(){return respondWithRpcPromise(_0x82bd('0x73'),{'channel':_0x437463,'interaction':_0x546106[_0x82bd('0x6a')],'message':_0x546106,'account':_0x546106[_0x82bd('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':_0x82bd('0x6c'),'appdata':_0x35d111[_0x82bd('0xf')]+','+(_0x546106[_0x82bd('0x6b')][_0x82bd('0x74')]||0x12c),'interval':_0x82bd('0x75')}]},routingClient);})[_0x82bd('0x15')](respondWithResult(_0x4b5bf4,null))['catch'](handleError(_0x4b5bf4,null));};};exports[_0x82bd('0x76')]=function(_0x3d14c7,_0x57c71c){var _0x588d7f,_0x5ca4b5;if(_['isNil'](_0x3d14c7[_0x82bd('0x2e')][_0x82bd('0x77')])){throw new Error(_0x82bd('0x78'));}var _0x2eda47=_0x3d14c7[_0x82bd('0x2e')][_0x82bd('0x77')];var _0x17f2aa=_[_0x82bd('0x79')](_0x2eda47);var _0x534fee=_0x2eda47===_0x82bd('0x64')?'Website':_0x82bd('0x6b');return db[_0x82bd('0x7a')][_0x82bd('0x67')]({'raw':!![],'where':{'id':_0x3d14c7[_0x82bd('0x1b')]['id'],'role':'agent'}})[_0x82bd('0x15')](function(_0x2c92d8){if(_[_0x82bd('0x11')](_0x2c92d8)){throw new Error(_0x82bd('0x7b'));}_0x588d7f=_0x2c92d8;return db[_0x17f2aa+'Message'][_0x82bd('0x67')]({'where':{'id':_0x3d14c7[_0x82bd('0x2e')]['messageId']},'include':[{'model':db[_0x17f2aa+'Interaction'],'as':'Interaction'},{'model':db[_0x17f2aa+_0x534fee],'as':_0x82bd('0x6b')}]});})[_0x82bd('0x15')](function(_0x291587){if(_[_0x82bd('0x11')](_0x291587)){throw new Error(_0x17f2aa+_0x82bd('0x7c'));}_0x5ca4b5=_0x291587;return _0x291587[_0x82bd('0x7d')]({'read':0x0,'readAt':null,'UserId':null});})[_0x82bd('0x15')](function(){var _0x8f45e2={'uniqueid':_0x2eda47+'.'+_0x5ca4b5['id']+'.'+_0x5ca4b5[_0x82bd('0x6a')]['id'],'FromUserId':_0x3d14c7[_0x82bd('0x30')]['id'],'type':_0x82bd('0x6c'),'ToUserId':_0x588d7f['id']};_0x8f45e2[_0x17f2aa+_0x82bd('0x6d')]=_0x5ca4b5['id'];_0x8f45e2[_0x17f2aa+_0x82bd('0x6e')]=_0x5ca4b5[_0x82bd('0x6a')]['id'];_0x8f45e2[_0x82bd('0x6f')+_0x17f2aa+_0x534fee+'Id']=_0x5ca4b5[_0x82bd('0x6b')]['id'];return db[_0x17f2aa+_0x82bd('0x71')][_0x82bd('0x72')](_0x8f45e2);})[_0x82bd('0x15')](function(){return respondWithRpcPromise(_0x82bd('0x73'),{'channel':_0x2eda47,'interaction':_0x5ca4b5[_0x82bd('0x6a')],'message':_0x5ca4b5,'account':_0x5ca4b5['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x588d7f[_0x82bd('0xf')]+','+(_0x5ca4b5[_0x82bd('0x6b')][_0x82bd('0x7e')]||0x12c),'interval':_0x82bd('0x75')}]},routingClient);})['then'](respondWithResult(_0x57c71c,null))['catch'](handleError(_0x57c71c,null));}; \ No newline at end of file +var _0xac31=['MemberReport','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','agent','internal','AgentCapacity','capacity','telephones','Telephones','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','value','indexOf','queue_id','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','TransferReport','create','Start','queueTransferTimeout','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','agentTransferTimeout','*,*,*,*','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','catch','status','json','sendStatus','name','isNil','find','rows','voiceChannels','VoiceChannels','query','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user'];(function(_0x45619d,_0x208c32){var _0xd36de5=function(_0xa47de5){while(--_0xa47de5){_0x45619d['push'](_0x45619d['shift']());}};_0xd36de5(++_0x208c32);}(_0xac31,0xca));var _0x1ac3=function(_0x2a27d1,_0x1cc84d){_0x2a27d1=_0x2a27d1-0x0;var _0x422d56=_0xac31[_0x2a27d1];return _0x422d56;};'use strict';var BPromise=require(_0x1ac3('0x0'));var moment=require(_0x1ac3('0x1'));var _=require(_0x1ac3('0x2'));var util=require(_0x1ac3('0x3'));var db=require(_0x1ac3('0x4'))['db'];var logger=require(_0x1ac3('0x5'))(_0x1ac3('0x6'));var jayson=require('jayson/promise');var amiClient=jayson[_0x1ac3('0x7')][_0x1ac3('0x8')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x1ac3('0x7')][_0x1ac3('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x2bf9b1,_0x1be223,_0x157604){return new BPromise(function(_0x57893c,_0x2d17de){var _0x4d7695=_0x157604?_0x157604:amiClient;return _0x4d7695[_0x1ac3('0x9')](_0x2bf9b1,_0x1be223)[_0x1ac3('0xa')](function(_0x344674){if(_0x344674['error']){if(_0x344674[_0x1ac3('0xb')][_0x1ac3('0xc')]===0x1f4){return _0x2d17de(_0x344674[_0x1ac3('0xb')][_0x1ac3('0xd')]);}return _0x57893c(_0x344674[_0x1ac3('0xb')][_0x1ac3('0xd')]);}else{_0x57893c(_0x344674['result']);}})[_0x1ac3('0xe')](function(_0x376814){_0x2d17de(_0x376814);});});}function respondWithResult(_0x2eeabf,_0x2338b9){_0x2338b9=_0x2338b9||0xc8;return function(_0x50d3b6){if(_0x50d3b6){return _0x2eeabf[_0x1ac3('0xf')](_0x2338b9)[_0x1ac3('0x10')](_0x50d3b6);}return _0x2eeabf[_0x1ac3('0x11')](0x194);};}function handleError(_0x2def9f,_0x53cc35){_0x53cc35=_0x53cc35||0x1f4;return function(_0x24bb5e){logger[_0x1ac3('0xb')](_0x24bb5e['stack']);if(_0x24bb5e[_0x1ac3('0x12')]){delete _0x24bb5e[_0x1ac3('0x12')];}_0x2def9f[_0x1ac3('0xf')](_0x53cc35)['send'](_0x24bb5e);};}function findById(_0x2f14ca){return function(_0x8590ce){if(!_[_0x1ac3('0x13')](_0x2f14ca)&&!_['isNil'](_0x8590ce)&&!_[_0x1ac3('0x13')](_0x8590ce['rows'])){return _[_0x1ac3('0x14')](_0x8590ce[_0x1ac3('0x15')],function(_0x20091d){return _0x20091d['id']==_0x2f14ca;});}return null;};}exports[_0x1ac3('0x16')]=function(_0x18b985,_0x557076){return respondWithRpcPromise(_0x1ac3('0x17'),_0x18b985[_0x1ac3('0x18')])[_0x1ac3('0xa')](respondWithResult(_0x557076,null))[_0x1ac3('0xe')](handleError(_0x557076,null));};exports['voiceChannelMixMonitor']=function(_0x48d18a,_0x2879d8){return respondWithRpcPromise(_0x1ac3('0x19'),_[_0x1ac3('0x1a')](_0x48d18a[_0x1ac3('0x18')],_0x48d18a[_0x1ac3('0x1b')]))[_0x1ac3('0xa')](respondWithResult(_0x2879d8,null))[_0x1ac3('0xe')](handleError(_0x2879d8,null));};exports[_0x1ac3('0x1c')]=function(_0x3d30b8,_0x565141){return respondWithRpcPromise(_0x1ac3('0x1d'),_[_0x1ac3('0x1a')](_0x3d30b8['query'],_0x3d30b8[_0x1ac3('0x1b')]))[_0x1ac3('0xa')](respondWithResult(_0x565141,null))['catch'](handleError(_0x565141,null));};exports[_0x1ac3('0x1e')]=function(_0x2f65e8,_0x145486){return respondWithRpcPromise(_0x1ac3('0x1f'),_0x2f65e8[_0x1ac3('0x18')])['then'](respondWithResult(_0x145486,null))['catch'](handleError(_0x145486,null));};exports['showVoiceQueues']=function(_0x528807,_0x52a1a5){return respondWithRpcPromise(_0x1ac3('0x1f'),_0x528807['query'])[_0x1ac3('0xa')](findById(_0x528807[_0x1ac3('0x1b')]['id']))[_0x1ac3('0xa')](respondWithResult(_0x52a1a5,null))[_0x1ac3('0xe')](handleError(_0x52a1a5,null));};exports['updateVoiceQueue']=function(_0x61441d,_0x541da0){return respondWithRpcPromise(_0x1ac3('0x20'),_[_0x1ac3('0x1a')](_0x61441d[_0x1ac3('0x21')],_0x61441d[_0x1ac3('0x1b')]))[_0x1ac3('0xa')](respondWithResult(_0x541da0,null))[_0x1ac3('0xe')](handleError(_0x541da0,null));};exports[_0x1ac3('0x22')]=function(_0x5351b2,_0x2248b6){return respondWithRpcPromise(_0x1ac3('0x23'),_[_0x1ac3('0x1a')](_0x5351b2[_0x1ac3('0x18')],_0x5351b2['params']))[_0x1ac3('0xa')](respondWithResult(_0x2248b6,null))[_0x1ac3('0xe')](handleError(_0x2248b6,null));};exports[_0x1ac3('0x24')]=function(_0x294513,_0x204d78){return respondWithRpcPromise('VoiceQueuesChannels',_0x294513[_0x1ac3('0x18')])[_0x1ac3('0xa')](respondWithResult(_0x204d78,null))[_0x1ac3('0xe')](handleError(_0x204d78,null));};exports[_0x1ac3('0x25')]=function(_0x1a47d4,_0x43362a){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x1ac3('0x1a')](_0x1a47d4[_0x1ac3('0x18')],_0x1a47d4[_0x1ac3('0x1b')]))[_0x1ac3('0xa')](respondWithResult(_0x43362a,null))['catch'](handleError(_0x43362a,null));};exports[_0x1ac3('0x26')]=function(_0x22404f,_0x2259f5){return respondWithRpcPromise(_0x1ac3('0x27'),_[_0x1ac3('0x1a')](_0x22404f[_0x1ac3('0x18')],_0x22404f[_0x1ac3('0x1b')]))[_0x1ac3('0xa')](respondWithResult(_0x2259f5,null))[_0x1ac3('0xe')](handleError(_0x2259f5,null));};exports['voiceQueuesChannelRedirect']=function(_0xe6f9c0,_0x27b017){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x1ac3('0x1a')](_0xe6f9c0[_0x1ac3('0x18')],_0xe6f9c0[_0x1ac3('0x1b')]))[_0x1ac3('0xa')](respondWithResult(_0x27b017,null))[_0x1ac3('0xe')](handleError(_0x27b017,null));};exports[_0x1ac3('0x28')]=function(_0x1c8bf5,_0xa15199){return respondWithRpcPromise('Outbound',_0x1c8bf5[_0x1ac3('0x18')])['then'](respondWithResult(_0xa15199,null))[_0x1ac3('0xe')](handleError(_0xa15199,null));};exports[_0x1ac3('0x29')]=function(_0x2d449e,_0x1e2f5e){return respondWithRpcPromise(_0x1ac3('0x2a'),_0x2d449e[_0x1ac3('0x18')])['then'](respondWithResult(_0x1e2f5e,null))[_0x1ac3('0xe')](handleError(_0x1e2f5e,null));};exports[_0x1ac3('0x2b')]=function(_0x43d15,_0x4e2442){var _0x34380d;return respondWithRpcPromise(_0x1ac3('0x2c'),_0x43d15['query'])[_0x1ac3('0xa')](function(_0x43a2ee){_0x34380d=_0x43a2ee;return respondWithRpcPromise(_0x1ac3('0x2c'),_0x43d15[_0x1ac3('0x18')],routingClient);})[_0x1ac3('0xa')](function(_0x21d8d6){return _[_0x1ac3('0x1a')]({},_0x21d8d6,_0x34380d);})[_0x1ac3('0xa')](respondWithResult(_0x4e2442,null))['catch'](handleError(_0x4e2442,null));};exports[_0x1ac3('0x2d')]=function(_0x3e606f,_0x40ea2c){if(_0x3e606f[_0x1ac3('0x21')]&&_0x3e606f[_0x1ac3('0x21')][_0x1ac3('0x2e')]&&_0x3e606f[_0x1ac3('0x2f')]&&_0x3e606f['user']['name']){for(var _0x2c2099 in _0x3e606f[_0x1ac3('0x21')]['interaction']){if(_0x3e606f[_0x1ac3('0x21')][_0x1ac3('0x2e')]['hasOwnProperty'](_0x2c2099)){db[_0x1ac3('0x30')]['findAll']({'where':{'channel':_0x2c2099,'membername':_0x3e606f[_0x1ac3('0x2f')][_0x1ac3('0x12')],'type':_0x1ac3('0x31'),'exitAt':null,'uniqueid':_0x3e606f[_0x1ac3('0x21')]['interaction'][_0x2c2099]&&_0x3e606f[_0x1ac3('0x21')][_0x1ac3('0x2e')][_0x2c2099][_0x1ac3('0x32')]?{'$notIn':_0x3e606f[_0x1ac3('0x21')][_0x1ac3('0x2e')][_0x2c2099]}:{'$ne':null}}})['then'](function(_0x26b5b1){var _0x842f83=moment()[_0x1ac3('0x33')](_0x1ac3('0x34'));for(var _0x589434=0x0,_0x16d56a=_0x26b5b1[_0x1ac3('0x32')];_0x589434<_0x16d56a;_0x589434+=0x1){_0x26b5b1[_0x589434][_0x1ac3('0x35')]({'exitAt':_0x842f83});}});for(var _0x4019c6=0x0;_0x4019c6<_0x3e606f['body'][_0x1ac3('0x2e')][_0x2c2099][_0x1ac3('0x32')];_0x4019c6+=0x1){db[_0x1ac3('0x30')][_0x1ac3('0x36')]({'where':{'channel':_0x2c2099,'membername':_0x3e606f['user'][_0x1ac3('0x12')],'type':'INTERACTION','uniqueid':_0x3e606f[_0x1ac3('0x21')][_0x1ac3('0x2e')][_0x2c2099][_0x4019c6],'exitAt':null},'defaults':{'channel':_0x2c2099,'membername':_0x3e606f[_0x1ac3('0x2f')][_0x1ac3('0x12')],'interface':_[_0x1ac3('0x13')](_0x3e606f[_0x1ac3('0x2f')][_0x1ac3('0x37')])?util['format']('SIP/%s',_0x3e606f[_0x1ac3('0x2f')][_0x1ac3('0x12')]):_0x3e606f[_0x1ac3('0x2f')]['interface'],'type':'INTERACTION','enterAt':moment()['format'](_0x1ac3('0x34')),'role':_0x1ac3('0x38'),'internal':_0x3e606f['user'][_0x1ac3('0x39')],'uniqueid':_0x3e606f[_0x1ac3('0x21')][_0x1ac3('0x2e')][_0x2c2099][_0x4019c6]}});}}}}return respondWithRpcPromise(_0x1ac3('0x3a'),{'id':_0x3e606f['params']['id'],'capacity':_0x3e606f['body'][_0x1ac3('0x3b')]},routingClient)[_0x1ac3('0xa')](respondWithResult(_0x40ea2c,null))['catch'](handleError(_0x40ea2c,null));};exports[_0x1ac3('0x3c')]=function(_0x5231f7,_0x4e4945){return respondWithRpcPromise(_0x1ac3('0x3d'),_0x5231f7[_0x1ac3('0x18')])['then'](respondWithResult(_0x4e4945,null))[_0x1ac3('0xe')](handleError(_0x4e4945,null));};exports['trunks']=function(_0x267541,_0x4762d3){return respondWithRpcPromise(_0x1ac3('0x3e'),_0x267541[_0x1ac3('0x18')])[_0x1ac3('0xa')](respondWithResult(_0x4762d3,null))[_0x1ac3('0xe')](handleError(_0x4762d3,null));};exports[_0x1ac3('0x3f')]=function(_0x331374,_0xeb7e49){return respondWithRpcPromise(_0x1ac3('0x40'),_0x331374[_0x1ac3('0x18')])['then'](respondWithResult(_0xeb7e49,null))['catch'](handleError(_0xeb7e49,null));};exports[_0x1ac3('0x41')]=function(_0x310eb7,_0x3bf701){return respondWithRpcPromise(_0x1ac3('0x42'),_0x310eb7[_0x1ac3('0x18')],routingClient)[_0x1ac3('0xa')](respondWithResult(_0x3bf701,null))[_0x1ac3('0xe')](handleError(_0x3bf701,null));};exports[_0x1ac3('0x43')]=function(_0xcf3bba,_0x3149f6){return respondWithRpcPromise('ChatQueues',_0xcf3bba[_0x1ac3('0x18')],routingClient)[_0x1ac3('0xa')](findById(_0xcf3bba[_0x1ac3('0x1b')]['id']))[_0x1ac3('0xa')](respondWithResult(_0x3149f6,null))[_0x1ac3('0xe')](handleError(_0x3149f6,null));};exports['mailQueues']=function(_0xb74cdf,_0x35895d){return respondWithRpcPromise('MailQueues',_0xb74cdf['query'],routingClient)['then'](respondWithResult(_0x35895d,null))[_0x1ac3('0xe')](handleError(_0x35895d,null));};exports[_0x1ac3('0x44')]=function(_0x2a1f66,_0x5ad546){return respondWithRpcPromise(_0x1ac3('0x45'),_0x2a1f66['query'],routingClient)['then'](findById(_0x2a1f66['params']['id']))['then'](respondWithResult(_0x5ad546,null))[_0x1ac3('0xe')](handleError(_0x5ad546,null));};exports[_0x1ac3('0x46')]=function(_0x42218b,_0x13294a){return respondWithRpcPromise(_0x1ac3('0x47'),_0x42218b['query'],mailClient)[_0x1ac3('0xa')](respondWithResult(_0x13294a,null))[_0x1ac3('0xe')](handleError(_0x13294a,null));};exports['openchannelQueues']=function(_0x2bcb4b,_0x1ffbb1){return respondWithRpcPromise(_0x1ac3('0x48'),_0x2bcb4b[_0x1ac3('0x18')],routingClient)[_0x1ac3('0xa')](respondWithResult(_0x1ffbb1,null))['catch'](handleError(_0x1ffbb1,null));};exports[_0x1ac3('0x49')]=function(_0x40907d,_0x1f4294){return respondWithRpcPromise(_0x1ac3('0x48'),_0x40907d['query'],routingClient)[_0x1ac3('0xa')](findById(_0x40907d[_0x1ac3('0x1b')]['id']))[_0x1ac3('0xa')](respondWithResult(_0x1f4294,null))[_0x1ac3('0xe')](handleError(_0x1f4294,null));};exports[_0x1ac3('0x4a')]=function(_0x1ac283,_0x5541c3){return respondWithRpcPromise('SmsQueues',_0x1ac283['query'],routingClient)['then'](respondWithResult(_0x5541c3,null))[_0x1ac3('0xe')](handleError(_0x5541c3,null));};exports['showSmsQueues']=function(_0x2a5413,_0x19359f){return respondWithRpcPromise(_0x1ac3('0x4b'),_0x2a5413[_0x1ac3('0x18')],routingClient)[_0x1ac3('0xa')](findById(_0x2a5413[_0x1ac3('0x1b')]['id']))['then'](respondWithResult(_0x19359f,null))[_0x1ac3('0xe')](handleError(_0x19359f,null));};exports[_0x1ac3('0x4c')]=function(_0x3597cb,_0x422b15){return respondWithRpcPromise('WhatsappQueues',_0x3597cb[_0x1ac3('0x18')],routingClient)[_0x1ac3('0xa')](respondWithResult(_0x422b15,null))[_0x1ac3('0xe')](handleError(_0x422b15,null));};exports[_0x1ac3('0x4d')]=function(_0x380ed8,_0x49ced4){return respondWithRpcPromise(_0x1ac3('0x4e'),_0x380ed8['query'],routingClient)['then'](findById(_0x380ed8[_0x1ac3('0x1b')]['id']))[_0x1ac3('0xa')](respondWithResult(_0x49ced4,null))[_0x1ac3('0xe')](handleError(_0x49ced4,null));};exports[_0x1ac3('0x4f')]=function(_0x355429,_0x3959bb){return respondWithRpcPromise(_0x1ac3('0x50'),_0x355429[_0x1ac3('0x18')],routingClient)[_0x1ac3('0xa')](respondWithResult(_0x3959bb,null))['catch'](handleError(_0x3959bb,null));};exports[_0x1ac3('0x51')]=function(_0xd36c71,_0x303d58){return respondWithRpcPromise('FaxQueues',_0xd36c71[_0x1ac3('0x18')],routingClient)[_0x1ac3('0xa')](findById(_0xd36c71[_0x1ac3('0x1b')]['id']))[_0x1ac3('0xa')](respondWithResult(_0x303d58,null))[_0x1ac3('0xe')](handleError(_0x303d58,null));};exports[_0x1ac3('0x52')]=function(_0x8740b4,_0x215966){return respondWithRpcPromise(_0x1ac3('0x53'),_0x8740b4[_0x1ac3('0x18')])['then'](respondWithResult(_0x215966,null))[_0x1ac3('0xe')](handleError(_0x215966,null));};exports[_0x1ac3('0x54')]=function(_0x41ffd0,_0x566ddc){return respondWithRpcPromise(_0x1ac3('0x55'),_0x41ffd0[_0x1ac3('0x18')],routingClient)[_0x1ac3('0xa')](respondWithResult(_0x566ddc,null))[_0x1ac3('0xe')](handleError(_0x566ddc,null));};exports[_0x1ac3('0x56')]=function(_0x519b80,_0x4d9d77){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x519b80[_0x1ac3('0x18')],routingClient)['then'](respondWithResult(_0x4d9d77,null))[_0x1ac3('0xe')](handleError(_0x4d9d77,null));};exports[_0x1ac3('0x57')]=function(_0x433dd0,_0x5cf974){return respondWithRpcPromise(_0x1ac3('0x58'),_0x433dd0[_0x1ac3('0x18')],routingClient)[_0x1ac3('0xa')](respondWithResult(_0x5cf974,null))[_0x1ac3('0xe')](handleError(_0x5cf974,null));};exports[_0x1ac3('0x59')]=function(_0x59def5,_0x5ec89d){return respondWithRpcPromise(_0x1ac3('0x58'),_0x59def5[_0x1ac3('0x18')],routingClient)['then'](function(_0x29b026){if(_0x59def5[_0x1ac3('0x18')][_0x1ac3('0x5a')]!==undefined){var _0x5cc2e0=_(_0x29b026[_0x1ac3('0x15')])[_0x1ac3('0x5b')]([_0x59def5['query'][_0x1ac3('0x5a')],_0x59def5['params']['id']])[_0x1ac3('0x5c')]('queue_id')['uniq']()[_0x1ac3('0x5d')]();return _0x29b026[_0x1ac3('0x15')][_0x1ac3('0x5b')](function(_0x3f5c44){return _0x5cc2e0[_0x1ac3('0x5e')](_0x3f5c44[_0x1ac3('0x5f')])>-0x1;});}else{return _0x29b026[_0x1ac3('0x15')][_0x1ac3('0x5b')](function(_0x408e3c){return _0x408e3c[_0x1ac3('0x5f')]===parseInt(_0x59def5[_0x1ac3('0x1b')]['id']);});}})[_0x1ac3('0xa')](respondWithResult(_0x5ec89d,null))['catch'](handleError(_0x5ec89d,null));};exports['smsQueuesWaitingInteractions']=function(_0x588726,_0x2ef69a){return respondWithRpcPromise(_0x1ac3('0x60'),_0x588726['query'],routingClient)[_0x1ac3('0xa')](respondWithResult(_0x2ef69a,null))[_0x1ac3('0xe')](handleError(_0x2ef69a,null));};exports[_0x1ac3('0x61')]=function(_0x364748,_0xbadca5){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x364748[_0x1ac3('0x18')],routingClient)['then'](respondWithResult(_0xbadca5,null))[_0x1ac3('0xe')](handleError(_0xbadca5,null));};exports['faxQueuesWaitingInteractions']=function(_0x218712,_0x50278a){return respondWithRpcPromise(_0x1ac3('0x62'),_0x218712[_0x1ac3('0x18')],routingClient)[_0x1ac3('0xa')](respondWithResult(_0x50278a,null))[_0x1ac3('0xe')](handleError(_0x50278a,null));};exports[_0x1ac3('0x63')]=function(_0x5bf7f1){return function(_0x4f9822,_0x4887a5){var _0x369ed0,_0x22e88d;var _0xbadd54=_[_0x1ac3('0x64')](_0x5bf7f1);var _0x5b4e54=_0x5bf7f1===_0x1ac3('0x65')?_0x1ac3('0x66'):'Account';return db[_0xbadd54+_0x1ac3('0x67')]['findOne']({'raw':!![],'where':{'id':_0x4f9822[_0x1ac3('0x1b')]['id']}})['then'](function(_0x5524a4){if(_['isNil'](_0x5524a4)){throw new Error(_0xbadd54+_0x1ac3('0x68'));}_0x369ed0=_0x5524a4;return db[_0xbadd54+_0x1ac3('0x69')][_0x1ac3('0x6a')]({'where':{'id':_0x4f9822[_0x1ac3('0x21')][_0x1ac3('0x6b')]},'include':[{'model':db[_0xbadd54+'Interaction'],'as':_0x1ac3('0x6c')},{'model':db[_0xbadd54+_0x5b4e54],'as':_0x1ac3('0x6d')}]});})[_0x1ac3('0xa')](function(_0x34377b){if(_['isNil'](_0x34377b)){throw new Error(_0xbadd54+_0x1ac3('0x6e'));}_0x22e88d=_0x34377b;return _0x34377b[_0x1ac3('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x55d53c={'uniqueid':_0x5bf7f1+'.'+_0x22e88d['id']+'.'+_0x22e88d['Interaction']['id'],'FromUserId':_0x4f9822[_0x1ac3('0x2f')]['id'],'type':_0x1ac3('0x70')};_0x55d53c[_0xbadd54+_0x1ac3('0x71')]=_0x22e88d['id'];_0x55d53c[_0xbadd54+_0x1ac3('0x72')]=_0x22e88d['Interaction']['id'];_0x55d53c[_0x1ac3('0x73')+_0xbadd54+_0x5b4e54+'Id']=_0x22e88d[_0x1ac3('0x6d')]['id'];_0x55d53c['To'+_0xbadd54+'QueueId']=_0x369ed0['id'];return db[_0xbadd54+_0x1ac3('0x74')][_0x1ac3('0x75')](_0x55d53c);})[_0x1ac3('0xa')](function(){return respondWithRpcPromise(_0x1ac3('0x76'),{'channel':_0x5bf7f1,'interaction':_0x22e88d['Interaction'],'message':_0x22e88d,'account':_0x22e88d[_0x1ac3('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x1ac3('0x70'),'appdata':_0x369ed0[_0x1ac3('0x12')]+','+(_0x22e88d[_0x1ac3('0x6d')][_0x1ac3('0x77')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x1ac3('0xa')](respondWithResult(_0x4887a5,null))[_0x1ac3('0xe')](handleError(_0x4887a5,null));};};exports['agentNotify']=function(_0x48335c,_0xfc252a){var _0x1c5f68,_0x554c7b;if(_['isNil'](_0x48335c[_0x1ac3('0x21')]['channel'])){throw new Error(_0x1ac3('0x78'));}var _0x20928f=_0x48335c['body']['channel'];var _0x3389be=_['capitalize'](_0x20928f);var _0x45faf6=_0x20928f===_0x1ac3('0x65')?_0x1ac3('0x66'):_0x1ac3('0x6d');return db[_0x1ac3('0x79')][_0x1ac3('0x6a')]({'raw':!![],'where':{'id':_0x48335c[_0x1ac3('0x1b')]['id'],'role':_0x1ac3('0x38')}})[_0x1ac3('0xa')](function(_0x588b98){if(_[_0x1ac3('0x13')](_0x588b98)){throw new Error(_0x1ac3('0x7a'));}_0x1c5f68=_0x588b98;return db[_0x3389be+'Message'][_0x1ac3('0x6a')]({'where':{'id':_0x48335c[_0x1ac3('0x21')]['messageId']},'include':[{'model':db[_0x3389be+_0x1ac3('0x6c')],'as':'Interaction'},{'model':db[_0x3389be+_0x45faf6],'as':'Account'}]});})[_0x1ac3('0xa')](function(_0x19a898){if(_[_0x1ac3('0x13')](_0x19a898)){throw new Error(_0x3389be+'\x20Message\x20not\x20found');}_0x554c7b=_0x19a898;return _0x19a898['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x1ac3('0xa')](function(){var _0x12b987={'uniqueid':_0x20928f+'.'+_0x554c7b['id']+'.'+_0x554c7b[_0x1ac3('0x6c')]['id'],'FromUserId':_0x48335c[_0x1ac3('0x2f')]['id'],'type':_0x1ac3('0x70'),'ToUserId':_0x1c5f68['id']};_0x12b987[_0x3389be+_0x1ac3('0x71')]=_0x554c7b['id'];_0x12b987[_0x3389be+_0x1ac3('0x72')]=_0x554c7b[_0x1ac3('0x6c')]['id'];_0x12b987[_0x1ac3('0x73')+_0x3389be+_0x45faf6+'Id']=_0x554c7b[_0x1ac3('0x6d')]['id'];return db[_0x3389be+_0x1ac3('0x74')][_0x1ac3('0x75')](_0x12b987);})[_0x1ac3('0xa')](function(){return respondWithRpcPromise(_0x1ac3('0x76'),{'channel':_0x20928f,'interaction':_0x554c7b[_0x1ac3('0x6c')],'message':_0x554c7b,'account':_0x554c7b[_0x1ac3('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x1ac3('0x38'),'appdata':_0x1c5f68[_0x1ac3('0x12')]+','+(_0x554c7b[_0x1ac3('0x6d')][_0x1ac3('0x7b')]||0x12c),'interval':_0x1ac3('0x7c')}]},routingClient);})[_0x1ac3('0xa')](respondWithResult(_0xfc252a,null))['catch'](handleError(_0xfc252a,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 5695c21..930ebcb 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 _0xd2de=['isAuthenticated','get','show','/:id/run','run','create','put','/:id','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller'];(function(_0x507d03,_0x5a6228){var _0x3cec6e=function(_0x11e6ee){while(--_0x11e6ee){_0x507d03['push'](_0x507d03['shift']());}};_0x3cec6e(++_0x5a6228);}(_0xd2de,0x14b));var _0xed2d=function(_0x35131b,_0x1bcab4){_0x35131b=_0x35131b-0x0;var _0x459256=_0xd2de[_0x35131b];return _0x459256;};'use strict';var multer=require(_0xed2d('0x0'));var util=require('util');var path=require(_0xed2d('0x1'));var timeout=require(_0xed2d('0x2'));var express=require(_0xed2d('0x3'));var router=express['Router']();var fs_extra=require(_0xed2d('0x4'));var auth=require(_0xed2d('0x5'));var interaction=require(_0xed2d('0x6'));var config=require(_0xed2d('0x7'));var controller=require(_0xed2d('0x8'));router['get']('/',auth[_0xed2d('0x9')](),controller['index']);router[_0xed2d('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xed2d('0xb')]);router[_0xed2d('0xa')](_0xed2d('0xc'),auth['isAuthenticated'](),controller[_0xed2d('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xed2d('0xe')]);router[_0xed2d('0xf')](_0xed2d('0x10'),auth[_0xed2d('0x9')](),controller[_0xed2d('0x11')]);router[_0xed2d('0x12')](_0xed2d('0x10'),auth[_0xed2d('0x9')](),controller['destroy']);module[_0xed2d('0x13')]=router; \ No newline at end of file +var _0x1600=['/:id/run','run','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x3f0b15,_0xb88473){var _0x38f95f=function(_0x3ee319){while(--_0x3ee319){_0x3f0b15['push'](_0x3f0b15['shift']());}};_0x38f95f(++_0xb88473);}(_0x1600,0x1ac));var _0x0160=function(_0x1c73b2,_0x3c1459){_0x1c73b2=_0x1c73b2-0x0;var _0x5dd717=_0x1600[_0x1c73b2];return _0x5dd717;};'use strict';var multer=require(_0x0160('0x0'));var util=require(_0x0160('0x1'));var path=require(_0x0160('0x2'));var timeout=require(_0x0160('0x3'));var express=require(_0x0160('0x4'));var router=express['Router']();var fs_extra=require(_0x0160('0x5'));var auth=require(_0x0160('0x6'));var interaction=require(_0x0160('0x7'));var config=require(_0x0160('0x8'));var controller=require('./schedule.controller');router[_0x0160('0x9')]('/',auth[_0x0160('0xa')](),controller[_0x0160('0xb')]);router[_0x0160('0x9')]('/:id',auth[_0x0160('0xa')](),controller['show']);router[_0x0160('0x9')](_0x0160('0xc'),auth['isAuthenticated'](),controller[_0x0160('0xd')]);router['post']('/',auth[_0x0160('0xa')](),controller['create']);router[_0x0160('0xe')](_0x0160('0xf'),auth[_0x0160('0xa')](),controller[_0x0160('0x10')]);router[_0x0160('0x11')](_0x0160('0xf'),auth[_0x0160('0xa')](),controller[_0x0160('0x12')]);module[_0x0160('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 8e0dfa1..0c4233f 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 _0xa79d=['days','ENUM','csv','pdf','xlsx','default','TEXT','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','years','quarters','months','weeks','hours'];(function(_0x30f030,_0xd03b7a){var _0xf7614f=function(_0x261cac){while(--_0x261cac){_0x30f030['push'](_0x30f030['shift']());}};_0xf7614f(++_0xd03b7a);}(_0xa79d,0xa7));var _0xda79=function(_0x4b58d7,_0x1f576b){_0x4b58d7=_0x4b58d7-0x0;var _0x18b938=_0xa79d[_0x4b58d7];return _0x18b938;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xda79('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xda79('0x0')]},'active':{'type':Sequelize[_0xda79('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xda79('0x0')],'allowNull':![],'defaultValue':_0xda79('0x2')},'startAt':{'type':Sequelize[_0xda79('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0xda79('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xda79('0x4'),_0xda79('0x5'),_0xda79('0x6'),_0xda79('0x7'),'days',_0xda79('0x8'),'minutes'),'allowNull':![],'defaultValue':_0xda79('0x9')},'output':{'type':Sequelize[_0xda79('0xa')](_0xda79('0xb'),_0xda79('0xc'),_0xda79('0xd')),'allowNull':![],'defaultValue':_0xda79('0xb')},'type':{'type':Sequelize[_0xda79('0xa')]('custom',_0xda79('0xe')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xda79('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0xda79('0x0')]},'cc':{'type':Sequelize[_0xda79('0xf')]},'bcc':{'type':Sequelize[_0xda79('0xf')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x5a8b=['TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','quarters','months','days','csv','pdf','custom','default'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x5a8b,0x121));var _0xb5a8=function(_0x5079f6,_0x2e0e35){_0x5079f6=_0x5079f6-0x0;var _0x3c41c7=_0x5a8b[_0x5079f6];return _0x3c41c7;};'use strict';var Sequelize=require(_0xb5a8('0x0'));module[_0xb5a8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb5a8('0x2')]},'active':{'type':Sequelize[_0xb5a8('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xb5a8('0x2')],'allowNull':![],'defaultValue':_0xb5a8('0x4')},'startAt':{'type':Sequelize[_0xb5a8('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xb5a8('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xb5a8('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xb5a8('0x7')]('years',_0xb5a8('0x8'),_0xb5a8('0x9'),'weeks',_0xb5a8('0xa'),'hours','minutes'),'allowNull':![],'defaultValue':_0xb5a8('0xa')},'output':{'type':Sequelize[_0xb5a8('0x7')](_0xb5a8('0xb'),_0xb5a8('0xc'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xb5a8('0x7')](_0xb5a8('0xd'),_0xb5a8('0xe')),'allowNull':![],'defaultValue':_0xb5a8('0xd')},'sendMail':{'type':Sequelize[_0xb5a8('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xb5a8('0x2')]},'cc':{'type':Sequelize[_0xb5a8('0xf')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0xb5a8('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 2144ed9..de6054c 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 _0x2d1f=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','get','Scheduler','UserProfileResource','destroy','stack','name','index','map','Schedule','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','run','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x214a25,_0x15071d){var _0x405988=function(_0x5c6fc1){while(--_0x5c6fc1){_0x214a25['push'](_0x214a25['shift']());}};_0x405988(++_0x15071d);}(_0x2d1f,0x134));var _0xf2d1=function(_0x4966ab,_0x4004ff){_0x4966ab=_0x4966ab-0x0;var _0x53a6a6=_0x2d1f[_0x4966ab];return _0x53a6a6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf2d1('0x0'));var jsonpatch=require(_0xf2d1('0x1'));var rp=require(_0xf2d1('0x2'));var moment=require(_0xf2d1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf2d1('0x4'));var util=require(_0xf2d1('0x5'));var path=require(_0xf2d1('0x6'));var sox=require(_0xf2d1('0x7'));var csv=require(_0xf2d1('0x8'));var ejs=require(_0xf2d1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf2d1('0xa'));var squel=require('squel');var crypto=require(_0xf2d1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf2d1('0xc'));var toCsv=require(_0xf2d1('0x8'));var querystring=require(_0xf2d1('0xd'));var Papa=require(_0xf2d1('0xe'));var Redis=require('ioredis');var authService=require(_0xf2d1('0xf'));var qs=require(_0xf2d1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf2d1('0x11'));var logger=require(_0xf2d1('0x12'))(_0xf2d1('0x13'));var utils=require(_0xf2d1('0x14'));var config=require(_0xf2d1('0x15'));var licenseUtil=require(_0xf2d1('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23b01c,_0x576b1a){_0x576b1a=_0x576b1a||0xcc;return function(_0x4ea525){if(_0x4ea525){return _0x23b01c[_0xf2d1('0x17')](_0x576b1a);}return _0x23b01c[_0xf2d1('0x18')](_0x576b1a)[_0xf2d1('0x19')]();};}function respondWithResult(_0x32ae95,_0x1f6478){_0x1f6478=_0x1f6478||0xc8;return function(_0x252eac){if(_0x252eac){return _0x32ae95[_0xf2d1('0x18')](_0x1f6478)[_0xf2d1('0x1a')](_0x252eac);}};}function respondWithFilteredResult(_0x3f3405,_0x46461e){return function(_0x53e789){if(_0x53e789){var _0x11d92b=typeof _0x46461e['offset']===_0xf2d1('0x1b')&&typeof _0x46461e[_0xf2d1('0x1c')]===_0xf2d1('0x1b');var _0x574c66=_0x53e789[_0xf2d1('0x1d')];var _0x320502=_0x11d92b?0x0:_0x46461e[_0xf2d1('0x1e')];var _0x558684=_0x11d92b?_0x53e789[_0xf2d1('0x1d')]:_0x46461e['offset']+_0x46461e['limit'];var _0x1fc786;if(_0x558684>=_0x574c66){_0x558684=_0x574c66;_0x1fc786=0xc8;}else{_0x1fc786=0xce;}_0x3f3405[_0xf2d1('0x18')](_0x1fc786);return _0x3f3405[_0xf2d1('0x1f')]('Content-Range',_0x320502+'-'+_0x558684+'/'+_0x574c66)['json'](_0x53e789);}return null;};}function patchUpdates(_0xbd7ec5){return function(_0x49a990){try{jsonpatch[_0xf2d1('0x20')](_0x49a990,_0xbd7ec5,!![]);}catch(_0x3ccef8){return BPromise['reject'](_0x3ccef8);}return _0x49a990[_0xf2d1('0x21')]();};}function saveUpdates(_0x3de70d,_0x907643){return function(_0x5517ca){if(_0x5517ca){return _0x5517ca[_0xf2d1('0x22')](_0x3de70d)['then'](function(_0x37b140){return _0x37b140;});}return null;};}function removeEntity(_0x520a94,_0x355b26){return function(_0x15b40f){if(_0x15b40f){return _0x15b40f['destroy']()[_0xf2d1('0x23')](function(){var _0x12714=_0x15b40f[_0xf2d1('0x24')]({'plain':!![]});var _0x3a25ad=_0xf2d1('0x25');return db[_0xf2d1('0x26')][_0xf2d1('0x27')]({'where':{'type':_0x3a25ad,'resourceId':_0x12714['id']}})['then'](function(){return _0x15b40f;});})[_0xf2d1('0x23')](function(){_0x520a94[_0xf2d1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45fba2,_0x1d2ec0){return function(_0x4f5058){if(!_0x4f5058){_0x45fba2[_0xf2d1('0x17')](0x194);}return _0x4f5058;};}function handleError(_0xf5fa8e,_0x40c70e){_0x40c70e=_0x40c70e||0x1f4;return function(_0x3ab4e3){logger['error'](_0x3ab4e3[_0xf2d1('0x28')]);if(_0x3ab4e3[_0xf2d1('0x29')]){delete _0x3ab4e3['name'];}_0xf5fa8e[_0xf2d1('0x18')](_0x40c70e)['send'](_0x3ab4e3);};}exports[_0xf2d1('0x2a')]=function(_0x389b00,_0x3993a3){var _0x573daf={},_0x5a4314={},_0xea800d={'count':0x0,'rows':[]};var _0x472f51=_[_0xf2d1('0x2b')](db[_0xf2d1('0x2c')]['rawAttributes'],function(_0x5365fb){return{'name':_0x5365fb[_0xf2d1('0x2d')],'type':_0x5365fb[_0xf2d1('0x2e')][_0xf2d1('0x2f')]};});_0x5a4314[_0xf2d1('0x30')]=_[_0xf2d1('0x2b')](_0x472f51,_0xf2d1('0x29'));_0x5a4314[_0xf2d1('0x31')]=_[_0xf2d1('0x32')](_0x389b00['query']);_0x5a4314['filters']=_['intersection'](_0x5a4314[_0xf2d1('0x30')],_0x5a4314[_0xf2d1('0x31')]);_0x573daf[_0xf2d1('0x33')]=_[_0xf2d1('0x34')](_0x5a4314[_0xf2d1('0x30')],qs[_0xf2d1('0x35')](_0x389b00['query'][_0xf2d1('0x35')]));_0x573daf[_0xf2d1('0x33')]=_0x573daf[_0xf2d1('0x33')][_0xf2d1('0x36')]?_0x573daf['attributes']:_0x5a4314['model'];if(!_0x389b00[_0xf2d1('0x31')][_0xf2d1('0x37')]('nolimit')){_0x573daf[_0xf2d1('0x1c')]=qs['limit'](_0x389b00[_0xf2d1('0x31')][_0xf2d1('0x1c')]);_0x573daf['offset']=qs[_0xf2d1('0x1e')](_0x389b00[_0xf2d1('0x31')][_0xf2d1('0x1e')]);}_0x573daf[_0xf2d1('0x38')]=qs[_0xf2d1('0x39')](_0x389b00[_0xf2d1('0x31')]['sort']);_0x573daf[_0xf2d1('0x3a')]=qs['filters'](_[_0xf2d1('0x3b')](_0x389b00[_0xf2d1('0x31')],_0x5a4314[_0xf2d1('0x3c')]),_0x472f51);if(_0x389b00[_0xf2d1('0x31')][_0xf2d1('0x3d')]){_0x573daf[_0xf2d1('0x3a')]=_[_0xf2d1('0x3e')](_0x573daf[_0xf2d1('0x3a')],{'$or':_[_0xf2d1('0x2b')](_0x472f51,function(_0x33024a){if(_0x33024a[_0xf2d1('0x2e')]!==_0xf2d1('0x3f')){var _0x167603={};_0x167603[_0x33024a[_0xf2d1('0x29')]]={'$like':'%'+_0x389b00[_0xf2d1('0x31')]['filter']+'%'};return _0x167603;}})});}_0x573daf=_[_0xf2d1('0x3e')]({},_0x573daf,_0x389b00[_0xf2d1('0x40')]);var _0x88bd4f={'where':_0x573daf[_0xf2d1('0x3a')]};return db['Schedule'][_0xf2d1('0x1d')](_0x88bd4f)[_0xf2d1('0x23')](function(_0x30e7c3){_0xea800d[_0xf2d1('0x1d')]=_0x30e7c3;if(_0x389b00[_0xf2d1('0x31')][_0xf2d1('0x41')]){_0x573daf[_0xf2d1('0x42')]=[{'all':!![]}];}return db[_0xf2d1('0x2c')][_0xf2d1('0x43')](_0x573daf);})[_0xf2d1('0x23')](function(_0x25aa47){_0xea800d[_0xf2d1('0x44')]=_0x25aa47;return _0xea800d;})[_0xf2d1('0x23')](respondWithFilteredResult(_0x3993a3,_0x573daf))[_0xf2d1('0x45')](handleError(_0x3993a3,null));};exports[_0xf2d1('0x46')]=function(_0x4dc072,_0x1653ac){var _0x36ed87={'raw':![],'where':{'id':_0x4dc072['params']['id']}},_0x33d6e0={};_0x33d6e0[_0xf2d1('0x30')]=_[_0xf2d1('0x32')](db['Schedule'][_0xf2d1('0x47')]);_0x33d6e0[_0xf2d1('0x31')]=_[_0xf2d1('0x32')](_0x4dc072['query']);_0x33d6e0[_0xf2d1('0x3c')]=_[_0xf2d1('0x34')](_0x33d6e0[_0xf2d1('0x30')],_0x33d6e0['query']);_0x36ed87[_0xf2d1('0x33')]=_[_0xf2d1('0x34')](_0x33d6e0[_0xf2d1('0x30')],qs[_0xf2d1('0x35')](_0x4dc072[_0xf2d1('0x31')][_0xf2d1('0x35')]));_0x36ed87['attributes']=_0x36ed87[_0xf2d1('0x33')]['length']?_0x36ed87[_0xf2d1('0x33')]:_0x33d6e0[_0xf2d1('0x30')];if(_0x4dc072[_0xf2d1('0x31')][_0xf2d1('0x41')]){_0x36ed87[_0xf2d1('0x42')]=[{'all':!![]}];}_0x36ed87=_[_0xf2d1('0x3e')]({},_0x36ed87,_0x4dc072[_0xf2d1('0x40')]);return db[_0xf2d1('0x2c')][_0xf2d1('0x48')](_0x36ed87)[_0xf2d1('0x23')](handleEntityNotFound(_0x1653ac,null))['then'](respondWithResult(_0x1653ac,null))[_0xf2d1('0x45')](handleError(_0x1653ac,null));};exports[_0xf2d1('0x49')]=function(_0x488cc8,_0x1a6930){return db[_0xf2d1('0x2c')][_0xf2d1('0x49')](_0x488cc8['body'],{})[_0xf2d1('0x23')](function(_0x8cd829){var _0x5087cf=_0x488cc8[_0xf2d1('0x4a')][_0xf2d1('0x24')]({'plain':!![]});if(!_0x5087cf)throw new Error(_0xf2d1('0x4b'));if(_0x5087cf[_0xf2d1('0x4c')]===_0xf2d1('0x4a')){var _0x489f36=_0x8cd829[_0xf2d1('0x24')]({'plain':!![]});var _0x4306a1=_0xf2d1('0x25');return db['UserProfileSection'][_0xf2d1('0x48')]({'where':{'name':_0x4306a1,'userProfileId':_0x5087cf['userProfileId']},'raw':!![]})[_0xf2d1('0x23')](function(_0x217326){if(_0x217326&&_0x217326[_0xf2d1('0x4d')]===0x0){return db[_0xf2d1('0x26')]['create']({'name':_0x489f36[_0xf2d1('0x29')],'resourceId':_0x489f36['id'],'type':_0x217326['name'],'sectionId':_0x217326['id']},{})['then'](function(){return _0x8cd829;});}else{return _0x8cd829;}})['catch'](function(_0x21792f){logger['error'](_0xf2d1('0x4e'),_0x21792f);throw _0x21792f;});}return _0x8cd829;})[_0xf2d1('0x23')](respondWithResult(_0x1a6930,0xc9))[_0xf2d1('0x45')](handleError(_0x1a6930,null));};exports[_0xf2d1('0x22')]=function(_0x577a13,_0x5c8763){if(_0x577a13[_0xf2d1('0x4f')]['id']){delete _0x577a13['body']['id'];}return db[_0xf2d1('0x2c')][_0xf2d1('0x48')]({'where':{'id':_0x577a13[_0xf2d1('0x50')]['id']}})['then'](handleEntityNotFound(_0x5c8763,null))[_0xf2d1('0x23')](saveUpdates(_0x577a13[_0xf2d1('0x4f')],null))[_0xf2d1('0x23')](respondWithResult(_0x5c8763,null))[_0xf2d1('0x45')](handleError(_0x5c8763,null));};exports[_0xf2d1('0x27')]=function(_0x11f722,_0x5ae8fc){return db[_0xf2d1('0x2c')][_0xf2d1('0x48')]({'where':{'id':_0x11f722[_0xf2d1('0x50')]['id']}})[_0xf2d1('0x23')](handleEntityNotFound(_0x5ae8fc,null))[_0xf2d1('0x23')](removeEntity(_0x5ae8fc,null))['catch'](handleError(_0x5ae8fc,null));};exports[_0xf2d1('0x51')]=function(_0x8dd017,_0x3fb699,_0x46e741){var _0x393644=require('../../config/schedule');return db['Schedule'][_0xf2d1('0x48')]({'where':{'id':_0x8dd017[_0xf2d1('0x50')]['id']},'raw':!![]})[_0xf2d1('0x23')](handleEntityNotFound(_0x3fb699,null))[_0xf2d1('0x23')](function(){_0x393644[_0xf2d1('0x51')](_0x8dd017[_0xf2d1('0x50')]['id']);})['then'](respondWithStatusCode(_0x3fb699,null))[_0xf2d1('0x45')](handleError(_0x3fb699,null));}; \ No newline at end of file +var _0x0760=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','UserProfileResource','stack','name','send','map','Schedule','rawAttributes','type','key','query','keys','filters','attributes','model','fields','nolimit','sort','pick','filter','where','merge','options','include','findAll','rows','catch','params','intersection','length','includeAll','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','error','../../config/schedule','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring'];(function(_0xefdbdd,_0x257b38){var _0x579773=function(_0x4d0ad2){while(--_0x4d0ad2){_0xefdbdd['push'](_0xefdbdd['shift']());}};_0x579773(++_0x257b38);}(_0x0760,0x172));var _0x0076=function(_0x5c5c71,_0x3c2c8f){_0x5c5c71=_0x5c5c71-0x0;var _0x313bc4=_0x0760[_0x5c5c71];return _0x313bc4;};'use strict';var emlformat=require(_0x0076('0x0'));var rimraf=require(_0x0076('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0076('0x2'));var rp=require(_0x0076('0x3'));var moment=require(_0x0076('0x4'));var BPromise=require(_0x0076('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x0076('0x6'));var csv=require('to-csv');var ejs=require(_0x0076('0x7'));var fs=require('fs');var fs_extra=require(_0x0076('0x8'));var _=require(_0x0076('0x9'));var squel=require(_0x0076('0xa'));var crypto=require('crypto');var jsforce=require(_0x0076('0xb'));var deskjs=require(_0x0076('0xc'));var toCsv=require(_0x0076('0xd'));var querystring=require(_0x0076('0xe'));var Papa=require('papaparse');var Redis=require(_0x0076('0xf'));var authService=require(_0x0076('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0076('0x11'));var hardwareService=require(_0x0076('0x12'));var logger=require(_0x0076('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x0076('0x14'));var licenseUtil=require(_0x0076('0x15'));var db=require(_0x0076('0x16'))['db'];function respondWithStatusCode(_0x345341,_0x275c31){_0x275c31=_0x275c31||0xcc;return function(_0xb0827e){if(_0xb0827e){return _0x345341[_0x0076('0x17')](_0x275c31);}return _0x345341[_0x0076('0x18')](_0x275c31)[_0x0076('0x19')]();};}function respondWithResult(_0x38764b,_0x3fc373){_0x3fc373=_0x3fc373||0xc8;return function(_0x607b36){if(_0x607b36){return _0x38764b[_0x0076('0x18')](_0x3fc373)[_0x0076('0x1a')](_0x607b36);}};}function respondWithFilteredResult(_0x2a367e,_0x55d37a){return function(_0x272973){if(_0x272973){var _0x25cf70=typeof _0x55d37a[_0x0076('0x1b')]===_0x0076('0x1c')&&typeof _0x55d37a[_0x0076('0x1d')]===_0x0076('0x1c');var _0x1d5a97=_0x272973[_0x0076('0x1e')];var _0x1c330a=_0x25cf70?0x0:_0x55d37a['offset'];var _0x2ea8a2=_0x25cf70?_0x272973[_0x0076('0x1e')]:_0x55d37a[_0x0076('0x1b')]+_0x55d37a['limit'];var _0x17db86;if(_0x2ea8a2>=_0x1d5a97){_0x2ea8a2=_0x1d5a97;_0x17db86=0xc8;}else{_0x17db86=0xce;}_0x2a367e[_0x0076('0x18')](_0x17db86);return _0x2a367e[_0x0076('0x1f')](_0x0076('0x20'),_0x1c330a+'-'+_0x2ea8a2+'/'+_0x1d5a97)[_0x0076('0x1a')](_0x272973);}return null;};}function patchUpdates(_0x2e74a3){return function(_0x58bd4e){try{jsonpatch[_0x0076('0x21')](_0x58bd4e,_0x2e74a3,!![]);}catch(_0x34106d){return BPromise['reject'](_0x34106d);}return _0x58bd4e[_0x0076('0x22')]();};}function saveUpdates(_0x513ac9,_0x3b8c43){return function(_0x2ab9b5){if(_0x2ab9b5){return _0x2ab9b5[_0x0076('0x23')](_0x513ac9)['then'](function(_0x588aec){return _0x588aec;});}return null;};}function removeEntity(_0x15f2fa,_0x405ffe){return function(_0x4027cf){if(_0x4027cf){return _0x4027cf[_0x0076('0x24')]()[_0x0076('0x25')](function(){var _0x406e67=_0x4027cf['get']({'plain':!![]});var _0x3bb723='Scheduler';return db[_0x0076('0x26')][_0x0076('0x24')]({'where':{'type':_0x3bb723,'resourceId':_0x406e67['id']}})['then'](function(){return _0x4027cf;});})[_0x0076('0x25')](function(){_0x15f2fa['status'](0xcc)[_0x0076('0x19')]();});}};}function handleEntityNotFound(_0x2e68e1,_0x227bd3){return function(_0x158c4b){if(!_0x158c4b){_0x2e68e1[_0x0076('0x17')](0x194);}return _0x158c4b;};}function handleError(_0x38de79,_0x186949){_0x186949=_0x186949||0x1f4;return function(_0x4c286f){logger['error'](_0x4c286f[_0x0076('0x27')]);if(_0x4c286f[_0x0076('0x28')]){delete _0x4c286f[_0x0076('0x28')];}_0x38de79[_0x0076('0x18')](_0x186949)[_0x0076('0x29')](_0x4c286f);};}exports['index']=function(_0x42b1e5,_0x2c276c){var _0x9b732b={},_0x55a4e9={},_0x116f4f={'count':0x0,'rows':[]};var _0x11eb52=_[_0x0076('0x2a')](db[_0x0076('0x2b')][_0x0076('0x2c')],function(_0x3a7108){return{'name':_0x3a7108['fieldName'],'type':_0x3a7108[_0x0076('0x2d')][_0x0076('0x2e')]};});_0x55a4e9['model']=_['map'](_0x11eb52,_0x0076('0x28'));_0x55a4e9[_0x0076('0x2f')]=_[_0x0076('0x30')](_0x42b1e5[_0x0076('0x2f')]);_0x55a4e9[_0x0076('0x31')]=_['intersection'](_0x55a4e9['model'],_0x55a4e9[_0x0076('0x2f')]);_0x9b732b[_0x0076('0x32')]=_['intersection'](_0x55a4e9[_0x0076('0x33')],qs['fields'](_0x42b1e5['query'][_0x0076('0x34')]));_0x9b732b[_0x0076('0x32')]=_0x9b732b[_0x0076('0x32')]['length']?_0x9b732b[_0x0076('0x32')]:_0x55a4e9[_0x0076('0x33')];if(!_0x42b1e5[_0x0076('0x2f')]['hasOwnProperty'](_0x0076('0x35'))){_0x9b732b[_0x0076('0x1d')]=qs[_0x0076('0x1d')](_0x42b1e5[_0x0076('0x2f')][_0x0076('0x1d')]);_0x9b732b['offset']=qs[_0x0076('0x1b')](_0x42b1e5[_0x0076('0x2f')][_0x0076('0x1b')]);}_0x9b732b['order']=qs[_0x0076('0x36')](_0x42b1e5[_0x0076('0x2f')]['sort']);_0x9b732b['where']=qs[_0x0076('0x31')](_[_0x0076('0x37')](_0x42b1e5[_0x0076('0x2f')],_0x55a4e9[_0x0076('0x31')]),_0x11eb52);if(_0x42b1e5[_0x0076('0x2f')][_0x0076('0x38')]){_0x9b732b[_0x0076('0x39')]=_[_0x0076('0x3a')](_0x9b732b[_0x0076('0x39')],{'$or':_[_0x0076('0x2a')](_0x11eb52,function(_0x344461){if(_0x344461[_0x0076('0x2d')]!=='VIRTUAL'){var _0x363fbe={};_0x363fbe[_0x344461[_0x0076('0x28')]]={'$like':'%'+_0x42b1e5['query']['filter']+'%'};return _0x363fbe;}})});}_0x9b732b=_[_0x0076('0x3a')]({},_0x9b732b,_0x42b1e5[_0x0076('0x3b')]);var _0x1a9a13={'where':_0x9b732b[_0x0076('0x39')]};return db[_0x0076('0x2b')][_0x0076('0x1e')](_0x1a9a13)[_0x0076('0x25')](function(_0xbde489){_0x116f4f[_0x0076('0x1e')]=_0xbde489;if(_0x42b1e5[_0x0076('0x2f')]['includeAll']){_0x9b732b[_0x0076('0x3c')]=[{'all':!![]}];}return db[_0x0076('0x2b')][_0x0076('0x3d')](_0x9b732b);})['then'](function(_0x5ef3f3){_0x116f4f[_0x0076('0x3e')]=_0x5ef3f3;return _0x116f4f;})[_0x0076('0x25')](respondWithFilteredResult(_0x2c276c,_0x9b732b))[_0x0076('0x3f')](handleError(_0x2c276c,null));};exports['show']=function(_0x12cb33,_0x39456c){var _0x9c8019={'raw':![],'where':{'id':_0x12cb33[_0x0076('0x40')]['id']}},_0x315a32={};_0x315a32[_0x0076('0x33')]=_[_0x0076('0x30')](db[_0x0076('0x2b')][_0x0076('0x2c')]);_0x315a32[_0x0076('0x2f')]=_['keys'](_0x12cb33['query']);_0x315a32[_0x0076('0x31')]=_[_0x0076('0x41')](_0x315a32[_0x0076('0x33')],_0x315a32[_0x0076('0x2f')]);_0x9c8019[_0x0076('0x32')]=_[_0x0076('0x41')](_0x315a32[_0x0076('0x33')],qs['fields'](_0x12cb33[_0x0076('0x2f')]['fields']));_0x9c8019[_0x0076('0x32')]=_0x9c8019['attributes'][_0x0076('0x42')]?_0x9c8019[_0x0076('0x32')]:_0x315a32[_0x0076('0x33')];if(_0x12cb33[_0x0076('0x2f')][_0x0076('0x43')]){_0x9c8019[_0x0076('0x3c')]=[{'all':!![]}];}_0x9c8019=_['merge']({},_0x9c8019,_0x12cb33[_0x0076('0x3b')]);return db[_0x0076('0x2b')][_0x0076('0x44')](_0x9c8019)[_0x0076('0x25')](handleEntityNotFound(_0x39456c,null))[_0x0076('0x25')](respondWithResult(_0x39456c,null))['catch'](handleError(_0x39456c,null));};exports[_0x0076('0x45')]=function(_0x3bb425,_0x2c3afa){return db[_0x0076('0x2b')][_0x0076('0x45')](_0x3bb425[_0x0076('0x46')],{})['then'](function(_0x3959cf){var _0x4651f7=_0x3bb425['user'][_0x0076('0x47')]({'plain':!![]});if(!_0x4651f7)throw new Error(_0x0076('0x48'));if(_0x4651f7[_0x0076('0x49')]==='user'){var _0x2854b0=_0x3959cf['get']({'plain':!![]});var _0x123ed8=_0x0076('0x4a');return db['UserProfileSection'][_0x0076('0x44')]({'where':{'name':_0x123ed8,'userProfileId':_0x4651f7['userProfileId']},'raw':!![]})[_0x0076('0x25')](function(_0x12605e){if(_0x12605e&&_0x12605e['autoAssociation']===0x0){return db[_0x0076('0x26')]['create']({'name':_0x2854b0[_0x0076('0x28')],'resourceId':_0x2854b0['id'],'type':_0x12605e['name'],'sectionId':_0x12605e['id']},{})[_0x0076('0x25')](function(){return _0x3959cf;});}else{return _0x3959cf;}})[_0x0076('0x3f')](function(_0x333d53){logger[_0x0076('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x333d53);throw _0x333d53;});}return _0x3959cf;})[_0x0076('0x25')](respondWithResult(_0x2c3afa,0xc9))[_0x0076('0x3f')](handleError(_0x2c3afa,null));};exports['update']=function(_0x5d417e,_0x555939){if(_0x5d417e['body']['id']){delete _0x5d417e['body']['id'];}return db[_0x0076('0x2b')][_0x0076('0x44')]({'where':{'id':_0x5d417e['params']['id']}})[_0x0076('0x25')](handleEntityNotFound(_0x555939,null))[_0x0076('0x25')](saveUpdates(_0x5d417e['body'],null))[_0x0076('0x25')](respondWithResult(_0x555939,null))[_0x0076('0x3f')](handleError(_0x555939,null));};exports[_0x0076('0x24')]=function(_0x520ad3,_0xcf46f9){return db[_0x0076('0x2b')][_0x0076('0x44')]({'where':{'id':_0x520ad3[_0x0076('0x40')]['id']}})[_0x0076('0x25')](handleEntityNotFound(_0xcf46f9,null))[_0x0076('0x25')](removeEntity(_0xcf46f9,null))[_0x0076('0x3f')](handleError(_0xcf46f9,null));};exports['run']=function(_0x31c55f,_0xe57ce5,_0x5336aa){var _0x3f05e0=require(_0x0076('0x4c'));return db[_0x0076('0x2b')]['find']({'where':{'id':_0x31c55f[_0x0076('0x40')]['id']},'raw':!![]})[_0x0076('0x25')](handleEntityNotFound(_0xe57ce5,null))['then'](function(){_0x3f05e0['run'](_0x31c55f[_0x0076('0x40')]['id']);})[_0x0076('0x25')](respondWithStatusCode(_0xe57ce5,null))[_0x0076('0x3f')](handleError(_0xe57ce5,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 9a22f21..ddd6496 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 _0x96da=['path','rimraf','../../config/environment','./schedule.attributes','exports','define','tools_schedules','api','moment','bluebird','request-promise'];(function(_0x28d03f,_0x4f9596){var _0x2b7569=function(_0x373e81){while(--_0x373e81){_0x28d03f['push'](_0x28d03f['shift']());}};_0x2b7569(++_0x4f9596);}(_0x96da,0x1a9));var _0xa96d=function(_0x58f02c,_0x3af551){_0x58f02c=_0x58f02c-0x0;var _0x748f94=_0x96da[_0x58f02c];return _0x748f94;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xa96d('0x0'));var moment=require(_0xa96d('0x1'));var BPromise=require(_0xa96d('0x2'));var rp=require(_0xa96d('0x3'));var fs=require('fs');var path=require(_0xa96d('0x4'));var rimraf=require(_0xa96d('0x5'));var config=require(_0xa96d('0x6'));var attributes=require(_0xa96d('0x7'));module[_0xa96d('0x8')]=function(_0x70f87b,_0x952791){return _0x70f87b[_0xa96d('0x9')]('Schedule',attributes,{'tableName':_0xa96d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x126b=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules'];(function(_0x1d051e,_0xd6eb3d){var _0x46b8f2=function(_0x276912){while(--_0x276912){_0x1d051e['push'](_0x1d051e['shift']());}};_0x46b8f2(++_0xd6eb3d);}(_0x126b,0x1e1));var _0xb126=function(_0x16f77c,_0x5256b1){_0x16f77c=_0x16f77c-0x0;var _0x78986e=_0x126b[_0x16f77c];return _0x78986e;};'use strict';var _=require(_0xb126('0x0'));var util=require('util');var logger=require(_0xb126('0x1'))('api');var moment=require(_0xb126('0x2'));var BPromise=require(_0xb126('0x3'));var rp=require(_0xb126('0x4'));var fs=require('fs');var path=require(_0xb126('0x5'));var rimraf=require(_0xb126('0x6'));var config=require(_0xb126('0x7'));var attributes=require(_0xb126('0x8'));module[_0xb126('0x9')]=function(_0x17a26c,_0x228053){return _0x17a26c[_0xb126('0xa')](_0xb126('0xb'),attributes,{'tableName':_0xb126('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 58aa63f..a626132 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 _0x88c5=['../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','Schedule,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x88c5,0x8e));var _0x588c=function(_0x46c1d5,_0x5ca335){_0x46c1d5=_0x46c1d5-0x0;var _0x40fe7b=_0x88c5[_0x46c1d5];return _0x40fe7b;};'use strict';var _=require(_0x588c('0x0'));var util=require(_0x588c('0x1'));var moment=require('moment');var BPromise=require(_0x588c('0x2'));var rs=require(_0x588c('0x3'));var fs=require('fs');var Redis=require(_0x588c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x588c('0x5'));var logger=require('../../config/logger')(_0x588c('0x6'));var config=require(_0x588c('0x7'));var jayson=require(_0x588c('0x8'));var client=jayson['client'][_0x588c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2089f2,_0x2bbcb2,_0xa9dc41){return new BPromise(function(_0x5a1b3c,_0x499fdc){return client['request'](_0x2089f2,_0xa9dc41)[_0x588c('0xa')](function(_0x4b0b07){logger[_0x588c('0xb')]('Schedule,\x20%s,\x20%s',_0x2bbcb2,_0x588c('0xc'));logger[_0x588c('0xd')](_0x588c('0xe'),_0x2bbcb2,_0x588c('0xc'),JSON[_0x588c('0xf')](_0x4b0b07));if(_0x4b0b07[_0x588c('0x10')]){if(_0x4b0b07[_0x588c('0x10')]['code']===0x1f4){logger[_0x588c('0x10')](_0x588c('0x11'),_0x2bbcb2,_0x4b0b07[_0x588c('0x10')][_0x588c('0x12')]);return _0x499fdc(_0x4b0b07[_0x588c('0x10')][_0x588c('0x12')]);}logger[_0x588c('0x10')](_0x588c('0x11'),_0x2bbcb2,_0x4b0b07['error'][_0x588c('0x12')]);return _0x5a1b3c(_0x4b0b07['error'][_0x588c('0x12')]);}else{logger[_0x588c('0xb')](_0x588c('0x11'),_0x2bbcb2,'request\x20sent');_0x5a1b3c(_0x4b0b07[_0x588c('0x13')]['message']);}})[_0x588c('0x14')](function(_0x4b2c8f){logger[_0x588c('0x10')](_0x588c('0x11'),_0x2bbcb2,_0x4b2c8f);_0x499fdc(_0x4b2c8f);});});} \ No newline at end of file +var _0x6ec6=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6ec6,0x187));var _0x66ec=function(_0xf44d98,_0x12a472){_0xf44d98=_0xf44d98-0x0;var _0x5ebb04=_0x6ec6[_0xf44d98];return _0x5ebb04;};'use strict';var _=require(_0x66ec('0x0'));var util=require(_0x66ec('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x66ec('0x2'));var fs=require('fs');var Redis=require(_0x66ec('0x3'));var db=require(_0x66ec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x66ec('0x5'))(_0x66ec('0x6'));var config=require(_0x66ec('0x7'));var jayson=require(_0x66ec('0x8'));var client=jayson[_0x66ec('0x9')][_0x66ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x361aa4,_0x3305af,_0x3bde56){return new BPromise(function(_0x2b35c2,_0x58af24){return client[_0x66ec('0xb')](_0x361aa4,_0x3bde56)[_0x66ec('0xc')](function(_0x106204){logger[_0x66ec('0xd')](_0x66ec('0xe'),_0x3305af,'request\x20sent');logger[_0x66ec('0xf')](_0x66ec('0x10'),_0x3305af,_0x66ec('0x11'),JSON['stringify'](_0x106204));if(_0x106204[_0x66ec('0x12')]){if(_0x106204['error'][_0x66ec('0x13')]===0x1f4){logger['error'](_0x66ec('0xe'),_0x3305af,_0x106204['error'][_0x66ec('0x14')]);return _0x58af24(_0x106204[_0x66ec('0x12')][_0x66ec('0x14')]);}logger[_0x66ec('0x12')](_0x66ec('0xe'),_0x3305af,_0x106204[_0x66ec('0x12')][_0x66ec('0x14')]);return _0x2b35c2(_0x106204[_0x66ec('0x12')][_0x66ec('0x14')]);}else{logger[_0x66ec('0xd')](_0x66ec('0xe'),_0x3305af,_0x66ec('0x11'));_0x2b35c2(_0x106204['result'][_0x66ec('0x14')]);}})[_0x66ec('0x15')](function(_0x395488){logger[_0x66ec('0x12')](_0x66ec('0xe'),_0x3305af,_0x395488);_0x58af24(_0x395488);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index c855ac5..f6854f4 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 _0x4afa=['Router','fs-extra','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','download','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x42390a,_0x53066d){var _0x49188d=function(_0x3593ae){while(--_0x3593ae){_0x42390a['push'](_0x42390a['shift']());}};_0x49188d(++_0x53066d);}(_0x4afa,0xba));var _0xa4af=function(_0x138435,_0x22bc44){_0x138435=_0x138435-0x0;var _0x1132a3=_0x4afa[_0x138435];return _0x1132a3;};'use strict';var multer=require(_0xa4af('0x0'));var util=require(_0xa4af('0x1'));var path=require(_0xa4af('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa4af('0x3')]();var fs_extra=require(_0xa4af('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa4af('0x5'));var controller=require(_0xa4af('0x6'));router[_0xa4af('0x7')]('/',auth[_0xa4af('0x8')](),controller[_0xa4af('0x9')]);router[_0xa4af('0x7')](_0xa4af('0xa'),auth['isAuthenticated'](),controller[_0xa4af('0xb')]);router['get'](_0xa4af('0xc'),auth[_0xa4af('0x8')](),controller[_0xa4af('0xd')]);router[_0xa4af('0x7')]('/:id/download',auth[_0xa4af('0x8')](),controller[_0xa4af('0xe')]);router['post']('/',auth[_0xa4af('0x8')](),controller[_0xa4af('0xf')]);router[_0xa4af('0x10')](_0xa4af('0xc'),auth[_0xa4af('0x8')](),controller[_0xa4af('0x11')]);router[_0xa4af('0x12')]('/:id',auth[_0xa4af('0x8')](),controller[_0xa4af('0x13')]);module[_0xa4af('0x14')]=router; \ No newline at end of file +var _0x707d=['./screenRecording.controller','get','index','isAuthenticated','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1f84e8,_0x3e1cc8){var _0x13837a=function(_0x619e6d){while(--_0x619e6d){_0x1f84e8['push'](_0x1f84e8['shift']());}};_0x13837a(++_0x3e1cc8);}(_0x707d,0x1dc));var _0xd707=function(_0xf76e36,_0xb2bdc4){_0xf76e36=_0xf76e36-0x0;var _0x50f783=_0x707d[_0xf76e36];return _0x50f783;};'use strict';var multer=require(_0xd707('0x0'));var util=require(_0xd707('0x1'));var path=require(_0xd707('0x2'));var timeout=require(_0xd707('0x3'));var express=require('express');var router=express[_0xd707('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd707('0x5'));var interaction=require(_0xd707('0x6'));var config=require(_0xd707('0x7'));var controller=require(_0xd707('0x8'));router[_0xd707('0x9')]('/',auth['isAuthenticated'](),controller[_0xd707('0xa')]);router[_0xd707('0x9')]('/describe',auth[_0xd707('0xb')](),controller['describe']);router[_0xd707('0x9')](_0xd707('0xc'),auth[_0xd707('0xb')](),controller[_0xd707('0xd')]);router[_0xd707('0x9')](_0xd707('0xe'),auth[_0xd707('0xb')](),controller[_0xd707('0xf')]);router[_0xd707('0x10')]('/',auth['isAuthenticated'](),controller[_0xd707('0x11')]);router[_0xd707('0x12')](_0xd707('0xc'),auth[_0xd707('0xb')](),controller[_0xd707('0x13')]);router[_0xd707('0x14')](_0xd707('0xc'),auth[_0xd707('0xb')](),controller[_0xd707('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index ccee0ca..5db0499 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 _0xdf92=['subtract','closedAt','duration','MM-DD-YYYY\x20HH:mm','toString','format','createdAt','updatedAt','sequelize','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt'];(function(_0x25634e,_0x5c5f6c){var _0x5a38c0=function(_0x4b54dd){while(--_0x4b54dd){_0x25634e['push'](_0x25634e['shift']());}};_0x5a38c0(++_0x5c5f6c);}(_0xdf92,0x10c));var _0x2df9=function(_0x509ec3,_0x24bf6e){_0x509ec3=_0x509ec3-0x0;var _0x1dfb86=_0xdf92[_0x509ec3];return _0x1dfb86;};'use strict';var Sequelize=require(_0x2df9('0x0'));var moment=require('moment');var path=require('path');var config=require(_0x2df9('0x1'));module[_0x2df9('0x2')]={'format':{'type':Sequelize[_0x2df9('0x3')],'get':function(){return this[_0x2df9('0x4')](_0x2df9('0x5'))?path[_0x2df9('0x6')](this[_0x2df9('0x4')](_0x2df9('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x2df9('0x7')]},'channel':{'type':Sequelize[_0x2df9('0x7')]},'value':{'type':Sequelize['STRING'],'set':function(_0x353f73){var _0x1ce438=_0x353f73[_0x2df9('0x8')](/\\/g,'/');this[_0x2df9('0x9')](_0x2df9('0x5'),_0x1ce438);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x2df9('0xa')],'set':function(_0x40ff87){this[_0x2df9('0x9')](_0x2df9('0xb'),moment()[_0x2df9('0xc')](_0x40ff87,'ms'));this[_0x2df9('0x9')](_0x2df9('0xd'),moment());this[_0x2df9('0x9')](_0x2df9('0xe'),_0x40ff87);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x2df9('0xb')))['format'](_0x2df9('0xf'))[_0x2df9('0x10')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x2df9('0xd')))[_0x2df9('0x11')](_0x2df9('0xf'))[_0x2df9('0x10')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x2df9('0x4')](_0x2df9('0x12')))[_0x2df9('0x11')](_0x2df9('0xf'))[_0x2df9('0x10')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x2df9('0x4')](_0x2df9('0x13')))['format'](_0x2df9('0xf'))[_0x2df9('0x10')]();}}}; \ No newline at end of file +var _0xc274=['extname','STRING','INTEGER','setDataValue','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','moment','exports','VIRTUAL','getDataValue','value'];(function(_0x3d0a74,_0x4dcf25){var _0x1371f5=function(_0x55fd56){while(--_0x55fd56){_0x3d0a74['push'](_0x3d0a74['shift']());}};_0x1371f5(++_0x4dcf25);}(_0xc274,0x151));var _0x4c27=function(_0x5a16c8,_0x470f39){_0x5a16c8=_0x5a16c8-0x0;var _0x1feb8d=_0xc274[_0x5a16c8];return _0x1feb8d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4c27('0x0'));var path=require('path');var config=require('../../config/environment');module[_0x4c27('0x1')]={'format':{'type':Sequelize[_0x4c27('0x2')],'get':function(){return this[_0x4c27('0x3')](_0x4c27('0x4'))?path[_0x4c27('0x5')](this[_0x4c27('0x3')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x4c27('0x6')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x4c27('0x6')],'set':function(_0x18fd2c){var _0x38de2d=_0x18fd2c['replace'](/\\/g,'/');this['setDataValue'](_0x4c27('0x4'),_0x38de2d);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x4c27('0x7')],'set':function(_0x2a0c76){this[_0x4c27('0x8')](_0x4c27('0x9'),moment()[_0x4c27('0xa')](_0x2a0c76,'ms'));this['setDataValue'](_0x4c27('0xb'),moment());this[_0x4c27('0x8')](_0x4c27('0xc'),_0x2a0c76);}},'startedAt':{'type':Sequelize[_0x4c27('0xd')],'get':function(){return moment(this['getDataValue']('startedAt'))[_0x4c27('0xe')](_0x4c27('0xf'))['toString']();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x4c27('0x3')](_0x4c27('0xb')))[_0x4c27('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x4c27('0x10')]();}},'createdAt':{'type':Sequelize[_0x4c27('0xd')],'get':function(){return moment(this[_0x4c27('0x3')]('createdAt'))[_0x4c27('0xe')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize[_0x4c27('0xd')],'get':function(){return moment(this[_0x4c27('0x3')](_0x4c27('0x11')))[_0x4c27('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x4c27('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 2e16716..3d43d26 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 _0xac31=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','ScreenRecording','rawAttributes','type','key','model','differenceBy','format','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','options','then','includeAll','findAll','rows','catch','params','find','create','body','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher'];(function(_0x54da5b,_0x12fd71){var _0x285d3b=function(_0x4dea38){while(--_0x4dea38){_0x54da5b['push'](_0x54da5b['shift']());}};_0x285d3b(++_0x12fd71);}(_0xac31,0xca));var _0x1ac3=function(_0x86e9e3,_0x1753d2){_0x86e9e3=_0x86e9e3-0x0;var _0x5edce8=_0xac31[_0x86e9e3];return _0x5edce8;};'use strict';var emlformat=require(_0x1ac3('0x0'));var rimraf=require(_0x1ac3('0x1'));var zipdir=require(_0x1ac3('0x2'));var jsonpatch=require(_0x1ac3('0x3'));var rp=require(_0x1ac3('0x4'));var moment=require(_0x1ac3('0x5'));var BPromise=require(_0x1ac3('0x6'));var Mustache=require('mustache');var util=require(_0x1ac3('0x7'));var path=require(_0x1ac3('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1ac3('0x9'));var fs=require('fs');var fs_extra=require(_0x1ac3('0xa'));var _=require(_0x1ac3('0xb'));var squel=require(_0x1ac3('0xc'));var crypto=require(_0x1ac3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1ac3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1ac3('0xf'));var Papa=require(_0x1ac3('0x10'));var Redis=require(_0x1ac3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1ac3('0x12'));var as=require(_0x1ac3('0x13'));var hardwareService=require(_0x1ac3('0x14'));var logger=require(_0x1ac3('0x15'))(_0x1ac3('0x16'));var utils=require(_0x1ac3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1ac3('0x18'));var db=require(_0x1ac3('0x19'))['db'];function respondWithStatusCode(_0x2eeabf,_0x2338b9){_0x2338b9=_0x2338b9||0xcc;return function(_0x50d3b6){if(_0x50d3b6){return _0x2eeabf[_0x1ac3('0x1a')](_0x2338b9);}return _0x2eeabf[_0x1ac3('0x1b')](_0x2338b9)[_0x1ac3('0x1c')]();};}function respondWithResult(_0x2def9f,_0x53cc35){_0x53cc35=_0x53cc35||0xc8;return function(_0x24bb5e){if(_0x24bb5e){return _0x2def9f[_0x1ac3('0x1b')](_0x53cc35)['json'](_0x24bb5e);}};}function respondWithFilteredResult(_0x29a7b3,_0x1f9641){return function(_0x38b52a){if(_0x38b52a){var _0x51f1e4=typeof _0x1f9641[_0x1ac3('0x1d')]===_0x1ac3('0x1e')&&typeof _0x1f9641[_0x1ac3('0x1f')]==='undefined';var _0x195683=_0x38b52a['count'];var _0x291616=_0x51f1e4?0x0:_0x1f9641[_0x1ac3('0x1d')];var _0x20091d=_0x51f1e4?_0x38b52a[_0x1ac3('0x20')]:_0x1f9641[_0x1ac3('0x1d')]+_0x1f9641['limit'];var _0x136e73;if(_0x20091d>=_0x195683){_0x20091d=_0x195683;_0x136e73=0xc8;}else{_0x136e73=0xce;}_0x29a7b3[_0x1ac3('0x1b')](_0x136e73);return _0x29a7b3[_0x1ac3('0x21')](_0x1ac3('0x22'),_0x291616+'-'+_0x20091d+'/'+_0x195683)['json'](_0x38b52a);}return null;};}function patchUpdates(_0x48d18a){return function(_0x2879d8){try{jsonpatch[_0x1ac3('0x23')](_0x2879d8,_0x48d18a,!![]);}catch(_0x14070b){return BPromise[_0x1ac3('0x24')](_0x14070b);}return _0x2879d8[_0x1ac3('0x25')]();};}function saveUpdates(_0x319988,_0x23b767){return function(_0x10912a){if(_0x10912a){return _0x10912a[_0x1ac3('0x26')](_0x319988)['then'](function(_0x1e277f){return _0x1e277f;});}return null;};}function removeEntity(_0x231b7f,_0x4b19f2){return function(_0x2b5182){if(_0x2b5182){return _0x2b5182[_0x1ac3('0x27')]()['then'](function(){_0x231b7f[_0x1ac3('0x1b')](0xcc)[_0x1ac3('0x1c')]();});}};}function handleEntityNotFound(_0x145486,_0x2dfdb7){return function(_0x10db3d){if(!_0x10db3d){_0x145486['sendStatus'](0x194);}return _0x10db3d;};}function handleError(_0x5a2ab2,_0x503a64){_0x503a64=_0x503a64||0x1f4;return function(_0x528807){logger['error'](_0x528807[_0x1ac3('0x28')]);if(_0x528807['name']){delete _0x528807[_0x1ac3('0x29')];}_0x5a2ab2[_0x1ac3('0x1b')](_0x503a64)[_0x1ac3('0x2a')](_0x528807);};}exports[_0x1ac3('0x2b')]=function(_0x4b3d3c,_0x61441d){var _0x541da0={},_0x2ddd73={},_0x4000b0={'count':0x0,'rows':[]};var _0x440aed=_[_0x1ac3('0x2c')](db[_0x1ac3('0x2d')][_0x1ac3('0x2e')],function(_0x9c17c2){return{'name':_0x9c17c2['fieldName'],'type':_0x9c17c2[_0x1ac3('0x2f')][_0x1ac3('0x30')]};});_0x2ddd73[_0x1ac3('0x31')]=_[_0x1ac3('0x32')](_['map'](_0x440aed,_0x1ac3('0x29')),[_0x1ac3('0x33')]);_0x2ddd73[_0x1ac3('0x34')]=_[_0x1ac3('0x35')](_0x4b3d3c[_0x1ac3('0x34')]);_0x2ddd73['filters']=_[_0x1ac3('0x36')](_0x2ddd73[_0x1ac3('0x31')],_0x2ddd73[_0x1ac3('0x34')]);_0x541da0[_0x1ac3('0x37')]=_[_0x1ac3('0x36')](_0x2ddd73[_0x1ac3('0x31')],qs['fields'](_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x38')]));_0x541da0[_0x1ac3('0x37')]=_0x541da0[_0x1ac3('0x37')]['length']?_0x541da0[_0x1ac3('0x37')]:_0x2ddd73[_0x1ac3('0x31')];if(!_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x39')](_0x1ac3('0x3a'))){_0x541da0[_0x1ac3('0x1f')]=qs[_0x1ac3('0x1f')](_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x1f')]);_0x541da0['offset']=qs[_0x1ac3('0x1d')](_0x4b3d3c[_0x1ac3('0x34')]['offset']);}_0x541da0[_0x1ac3('0x3b')]=qs[_0x1ac3('0x3c')](_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x3c')]);_0x541da0[_0x1ac3('0x3d')]=qs[_0x1ac3('0x3e')](_[_0x1ac3('0x3f')](_0x4b3d3c[_0x1ac3('0x34')],_0x2ddd73['filters']),_0x440aed);if(_0x4b3d3c[_0x1ac3('0x34')]['filter']){_0x541da0[_0x1ac3('0x3d')]=_[_0x1ac3('0x40')](_0x541da0[_0x1ac3('0x3d')],{'$or':_[_0x1ac3('0x2c')](_0x440aed,function(_0x3141ae){if(_0x3141ae[_0x1ac3('0x2f')]!=='VIRTUAL'){var _0x3b5c1c={};_0x3b5c1c[_0x3141ae[_0x1ac3('0x29')]]={'$like':'%'+_0x4b3d3c[_0x1ac3('0x34')]['filter']+'%'};return _0x3b5c1c;}})});}_0x541da0=_[_0x1ac3('0x40')]({},_0x541da0,_0x4b3d3c[_0x1ac3('0x41')]);var _0x5cec6b={'where':_0x541da0[_0x1ac3('0x3d')]};return db[_0x1ac3('0x2d')][_0x1ac3('0x20')](_0x5cec6b)[_0x1ac3('0x42')](function(_0x466a45){_0x4000b0[_0x1ac3('0x20')]=_0x466a45;if(_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x43')]){_0x541da0['include']=[{'all':!![]}];}return db[_0x1ac3('0x2d')][_0x1ac3('0x44')](_0x541da0);})[_0x1ac3('0x42')](function(_0x254a77){_0x4000b0[_0x1ac3('0x45')]=_0x254a77;return _0x4000b0;})[_0x1ac3('0x42')](respondWithFilteredResult(_0x61441d,_0x541da0))[_0x1ac3('0x46')](handleError(_0x61441d,null));};exports['show']=function(_0x4edc4d,_0x2c2099){var _0x3f60ca={'raw':![],'where':{'id':_0x4edc4d[_0x1ac3('0x47')]['id']}},_0x4972d1={};_0x4972d1[_0x1ac3('0x31')]=_['keys'](db[_0x1ac3('0x2d')]['rawAttributes']);_0x4972d1[_0x1ac3('0x34')]=_[_0x1ac3('0x35')](_0x4edc4d[_0x1ac3('0x34')]);_0x4972d1[_0x1ac3('0x3e')]=_['intersection'](_0x4972d1[_0x1ac3('0x31')],_0x4972d1[_0x1ac3('0x34')]);_0x3f60ca[_0x1ac3('0x37')]=_[_0x1ac3('0x36')](_0x4972d1[_0x1ac3('0x31')],qs['fields'](_0x4edc4d[_0x1ac3('0x34')][_0x1ac3('0x38')]));_0x3f60ca[_0x1ac3('0x37')]=_0x3f60ca[_0x1ac3('0x37')]['length']?_0x3f60ca[_0x1ac3('0x37')]:_0x4972d1[_0x1ac3('0x31')];if(_0x4edc4d[_0x1ac3('0x34')][_0x1ac3('0x43')]){_0x3f60ca['include']=[{'all':!![]}];}_0x3f60ca=_[_0x1ac3('0x40')]({},_0x3f60ca,_0x4edc4d[_0x1ac3('0x41')]);return db[_0x1ac3('0x2d')][_0x1ac3('0x48')](_0x3f60ca)['then'](handleEntityNotFound(_0x2c2099,null))[_0x1ac3('0x42')](respondWithResult(_0x2c2099,null))['catch'](handleError(_0x2c2099,null));};exports[_0x1ac3('0x49')]=function(_0x10bcaf,_0x2e3347){return db[_0x1ac3('0x2d')][_0x1ac3('0x49')](_0x10bcaf[_0x1ac3('0x4a')],{})[_0x1ac3('0x42')](respondWithResult(_0x2e3347,0xc9))['catch'](handleError(_0x2e3347,null));};exports['update']=function(_0xe8f33c,_0x249c2d){if(_0xe8f33c[_0x1ac3('0x4a')]['id']){delete _0xe8f33c['body']['id'];}delete _0xe8f33c['body']['duration'];delete _0xe8f33c[_0x1ac3('0x4a')][_0x1ac3('0x4b')];delete _0xe8f33c['body'][_0x1ac3('0x4c')];delete _0xe8f33c[_0x1ac3('0x4a')][_0x1ac3('0x4d')];return db[_0x1ac3('0x2d')]['find']({'where':{'id':_0xe8f33c['params']['id']}})[_0x1ac3('0x42')](handleEntityNotFound(_0x249c2d,null))[_0x1ac3('0x42')](saveUpdates(_0xe8f33c['body'],null))[_0x1ac3('0x42')](respondWithResult(_0x249c2d,null))['catch'](handleError(_0x249c2d,null));};exports['describe']=function(_0x2d628d,_0x220dd0){return db['ScreenRecording'][_0x1ac3('0x4e')]()['then'](respondWithResult(_0x220dd0,null))[_0x1ac3('0x46')](handleError(_0x220dd0,null));};exports[_0x1ac3('0x4f')]=function(_0x3586b9,_0x3a0320,_0x34ad43){var _0x40e9c7=require(_0x1ac3('0x50'));var _0x331374=![];var _0xeb7e49={};if(_0x3586b9[_0x1ac3('0x34')][_0x1ac3('0x2f')]&&_0x3586b9['query']['type']===_0x1ac3('0x51')){_0xeb7e49[_0x1ac3('0x51')]=_0x3586b9[_0x1ac3('0x47')]['id'];}else{_0xeb7e49['id']=_0x3586b9[_0x1ac3('0x47')]['id'];}return db[_0x1ac3('0x2d')][_0x1ac3('0x48')]({'where':_0xeb7e49,'attributes':['id',_0x1ac3('0x4d')],'raw':!![]})[_0x1ac3('0x42')](handleEntityNotFound(_0x3a0320,null))[_0x1ac3('0x42')](function(_0x3149f6){if(_0x3149f6){var _0x541bba=path[_0x1ac3('0x52')](config[_0x1ac3('0x53')],_0x1ac3('0x54'),_0x3149f6[_0x1ac3('0x4d')]);var _0x20c195=util['format'](_0x1ac3('0x55'),_0x541bba);if(fs[_0x1ac3('0x56')](_0x20c195)){_0x331374=!![];return _0x40e9c7['decryptFile'](_0x20c195,_0x541bba,config['secrets']['recording'])[_0x1ac3('0x42')](function(){return _0x3149f6;});}return _0x3149f6;}})[_0x1ac3('0x42')](function(_0x2a1f66){if(_0x2a1f66){var _0x5ad546=path[_0x1ac3('0x52')](config['root'],'server/files/screen_recordings',_0x2a1f66['value']);if(!fs['existsSync'](_0x5ad546)){throw new db[(_0x1ac3('0x57'))][(_0x1ac3('0x58'))](_0x1ac3('0x59'));}if(_0x2a1f66[_0x1ac3('0x5a')]){return _0x3a0320[_0x1ac3('0x4f')](_0x5ad546,_0x2a1f66['filename']+path[_0x1ac3('0x5b')](_0x5ad546),function(){if(_0x331374){fs[_0x1ac3('0x5c')](_0x5ad546);}});}else{return _0x3a0320['download'](_0x5ad546,function(_0x2bcb4b){if(_0x331374){fs[_0x1ac3('0x5c')](_0x5ad546);}});}}})[_0x1ac3('0x46')](function(_0x2e79b2){if(_0x2e79b2[_0x1ac3('0x5d')]==='ScreenRecording\x20not\x20found'){_0x3a0320[_0x1ac3('0x1b')](0x194)[_0x1ac3('0x2a')](_0x1ac3('0x5e'));}else{return handleError(_0x3a0320,null);}});};exports[_0x1ac3('0x27')]=function(_0x4cfa04,_0x19407a){return db[_0x1ac3('0x2d')][_0x1ac3('0x48')]({'where':{'id':_0x4cfa04[_0x1ac3('0x47')]['id']}})[_0x1ac3('0x42')](function(_0x1ac283){if(_['isNil'](_0x1ac283)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1ac283;})['then'](function(_0x582fe2){var _0x3b930b=path['join'](config[_0x1ac3('0x53')],_0x1ac3('0x54'),_0x582fe2[_0x1ac3('0x4d')]);logger[_0x1ac3('0x5f')](_0x1ac3('0x60'),_0x3b930b);if(!_[_0x1ac3('0x61')](_0x582fe2['value'])&&fs[_0x1ac3('0x56')](_0x3b930b)){logger[_0x1ac3('0x5f')](_0x1ac3('0x62')+_0x3b930b+_0x1ac3('0x63'));fs['unlinkSync'](_0x3b930b);}_0x3b930b=_0x3b930b+_0x1ac3('0x64');if(!_[_0x1ac3('0x61')](_0x582fe2[_0x1ac3('0x4d')])&&fs[_0x1ac3('0x56')](_0x3b930b)){logger[_0x1ac3('0x5f')]('File:\x20\x22'+_0x3b930b+_0x1ac3('0x63'));fs['unlinkSync'](_0x3b930b);}return _0x582fe2;})['then'](function(_0x402507){if(!_0x402507)throw new InternalError();return _0x402507[_0x1ac3('0x27')]();})[_0x1ac3('0x42')](function(){_0x19407a[_0x1ac3('0x1b')](0xcc)[_0x1ac3('0x1c')]();})[_0x1ac3('0x46')](handleError(_0x19407a,null));}; \ No newline at end of file +var _0x00bb=['json','undefined','limit','offset','apply','reject','update','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ScreenRecording','count','then','includeAll','include','rows','catch','show','params','length','options','find','body','createdAt','closedAt','value','describe','download','uniqueid','join','root','format','%s.cypher','existsSync','decryptFile','secrets','recording','server/files/screen_recordings','Sequelize','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status'];(function(_0x5c81ae,_0x5a1391){var _0x5325a9=function(_0xd522a2){while(--_0xd522a2){_0x5c81ae['push'](_0x5c81ae['shift']());}};_0x5325a9(++_0x5a1391);}(_0x00bb,0x1d8));var _0xb00b=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x00bb[_0xae7c2f];return _0x5d7001;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];function respondWithStatusCode(_0x2d8ddf,_0x1be8aa){_0x1be8aa=_0x1be8aa||0xcc;return function(_0x466b9b){if(_0x466b9b){return _0x2d8ddf[_0xb00b('0x15')](_0x1be8aa);}return _0x2d8ddf[_0xb00b('0x16')](_0x1be8aa)['end']();};}function respondWithResult(_0x218de2,_0xb0d42e){_0xb0d42e=_0xb0d42e||0xc8;return function(_0x482fe6){if(_0x482fe6){return _0x218de2[_0xb00b('0x16')](_0xb0d42e)[_0xb00b('0x17')](_0x482fe6);}};}function respondWithFilteredResult(_0x540b79,_0x5da36b){return function(_0x9b471e){if(_0x9b471e){var _0x4dcd45=typeof _0x5da36b['offset']===_0xb00b('0x18')&&typeof _0x5da36b[_0xb00b('0x19')]===_0xb00b('0x18');var _0xbb72fc=_0x9b471e['count'];var _0x2a7231=_0x4dcd45?0x0:_0x5da36b['offset'];var _0x415f91=_0x4dcd45?_0x9b471e['count']:_0x5da36b[_0xb00b('0x1a')]+_0x5da36b['limit'];var _0xb26ebb;if(_0x415f91>=_0xbb72fc){_0x415f91=_0xbb72fc;_0xb26ebb=0xc8;}else{_0xb26ebb=0xce;}_0x540b79[_0xb00b('0x16')](_0xb26ebb);return _0x540b79['set']('Content-Range',_0x2a7231+'-'+_0x415f91+'/'+_0xbb72fc)[_0xb00b('0x17')](_0x9b471e);}return null;};}function patchUpdates(_0x4a334b){return function(_0x1344c4){try{jsonpatch[_0xb00b('0x1b')](_0x1344c4,_0x4a334b,!![]);}catch(_0x2fe48d){return BPromise[_0xb00b('0x1c')](_0x2fe48d);}return _0x1344c4['save']();};}function saveUpdates(_0x362ee0,_0x4df284){return function(_0x25a973){if(_0x25a973){return _0x25a973[_0xb00b('0x1d')](_0x362ee0)['then'](function(_0x231293){return _0x231293;});}return null;};}function removeEntity(_0x2896d1,_0x520444){return function(_0x3ab3cc){if(_0x3ab3cc){return _0x3ab3cc[_0xb00b('0x1e')]()['then'](function(){_0x2896d1[_0xb00b('0x16')](0xcc)[_0xb00b('0x1f')]();});}};}function handleEntityNotFound(_0x3c9500,_0x8caadf){return function(_0x520e55){if(!_0x520e55){_0x3c9500['sendStatus'](0x194);}return _0x520e55;};}function handleError(_0x3785e9,_0x490380){_0x490380=_0x490380||0x1f4;return function(_0x550587){logger['error'](_0x550587[_0xb00b('0x20')]);if(_0x550587[_0xb00b('0x21')]){delete _0x550587[_0xb00b('0x21')];}_0x3785e9[_0xb00b('0x16')](_0x490380)[_0xb00b('0x22')](_0x550587);};}exports[_0xb00b('0x23')]=function(_0x15d3b9,_0x4a8d2b){var _0x22c22d={},_0x503c9c={},_0x450129={'count':0x0,'rows':[]};var _0x348165=_[_0xb00b('0x24')](db['ScreenRecording'][_0xb00b('0x25')],function(_0x280ed3){return{'name':_0x280ed3[_0xb00b('0x26')],'type':_0x280ed3[_0xb00b('0x27')][_0xb00b('0x28')]};});_0x503c9c[_0xb00b('0x29')]=_[_0xb00b('0x2a')](_[_0xb00b('0x24')](_0x348165,_0xb00b('0x21')),['format']);_0x503c9c[_0xb00b('0x2b')]=_[_0xb00b('0x2c')](_0x15d3b9['query']);_0x503c9c[_0xb00b('0x2d')]=_[_0xb00b('0x2e')](_0x503c9c['model'],_0x503c9c[_0xb00b('0x2b')]);_0x22c22d['attributes']=_[_0xb00b('0x2e')](_0x503c9c[_0xb00b('0x29')],qs[_0xb00b('0x2f')](_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x2f')]));_0x22c22d[_0xb00b('0x30')]=_0x22c22d[_0xb00b('0x30')]['length']?_0x22c22d['attributes']:_0x503c9c['model'];if(!_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x31')](_0xb00b('0x32'))){_0x22c22d[_0xb00b('0x19')]=qs['limit'](_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x19')]);_0x22c22d[_0xb00b('0x1a')]=qs[_0xb00b('0x1a')](_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x1a')]);}_0x22c22d[_0xb00b('0x33')]=qs[_0xb00b('0x34')](_0x15d3b9['query']['sort']);_0x22c22d[_0xb00b('0x35')]=qs['filters'](_[_0xb00b('0x36')](_0x15d3b9[_0xb00b('0x2b')],_0x503c9c[_0xb00b('0x2d')]),_0x348165);if(_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x37')]){_0x22c22d[_0xb00b('0x35')]=_[_0xb00b('0x38')](_0x22c22d['where'],{'$or':_[_0xb00b('0x24')](_0x348165,function(_0x25578e){if(_0x25578e[_0xb00b('0x27')]!==_0xb00b('0x39')){var _0x2496e2={};_0x2496e2[_0x25578e[_0xb00b('0x21')]]={'$like':'%'+_0x15d3b9['query'][_0xb00b('0x37')]+'%'};return _0x2496e2;}})});}_0x22c22d=_[_0xb00b('0x38')]({},_0x22c22d,_0x15d3b9['options']);var _0x17ff34={'where':_0x22c22d[_0xb00b('0x35')]};return db[_0xb00b('0x3a')][_0xb00b('0x3b')](_0x17ff34)[_0xb00b('0x3c')](function(_0x5636b1){_0x450129[_0xb00b('0x3b')]=_0x5636b1;if(_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x3d')]){_0x22c22d[_0xb00b('0x3e')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x22c22d);})[_0xb00b('0x3c')](function(_0xf6ae0c){_0x450129[_0xb00b('0x3f')]=_0xf6ae0c;return _0x450129;})[_0xb00b('0x3c')](respondWithFilteredResult(_0x4a8d2b,_0x22c22d))[_0xb00b('0x40')](handleError(_0x4a8d2b,null));};exports[_0xb00b('0x41')]=function(_0x275664,_0x493841){var _0x36200d={'raw':![],'where':{'id':_0x275664[_0xb00b('0x42')]['id']}},_0x3b72c4={};_0x3b72c4[_0xb00b('0x29')]=_[_0xb00b('0x2c')](db[_0xb00b('0x3a')][_0xb00b('0x25')]);_0x3b72c4[_0xb00b('0x2b')]=_[_0xb00b('0x2c')](_0x275664[_0xb00b('0x2b')]);_0x3b72c4[_0xb00b('0x2d')]=_[_0xb00b('0x2e')](_0x3b72c4['model'],_0x3b72c4[_0xb00b('0x2b')]);_0x36200d[_0xb00b('0x30')]=_[_0xb00b('0x2e')](_0x3b72c4[_0xb00b('0x29')],qs[_0xb00b('0x2f')](_0x275664[_0xb00b('0x2b')][_0xb00b('0x2f')]));_0x36200d[_0xb00b('0x30')]=_0x36200d[_0xb00b('0x30')][_0xb00b('0x43')]?_0x36200d[_0xb00b('0x30')]:_0x3b72c4[_0xb00b('0x29')];if(_0x275664['query']['includeAll']){_0x36200d['include']=[{'all':!![]}];}_0x36200d=_[_0xb00b('0x38')]({},_0x36200d,_0x275664[_0xb00b('0x44')]);return db['ScreenRecording'][_0xb00b('0x45')](_0x36200d)[_0xb00b('0x3c')](handleEntityNotFound(_0x493841,null))[_0xb00b('0x3c')](respondWithResult(_0x493841,null))[_0xb00b('0x40')](handleError(_0x493841,null));};exports['create']=function(_0x58e9cb,_0x172729){return db[_0xb00b('0x3a')]['create'](_0x58e9cb['body'],{})[_0xb00b('0x3c')](respondWithResult(_0x172729,0xc9))[_0xb00b('0x40')](handleError(_0x172729,null));};exports['update']=function(_0x2228e9,_0x47a814){if(_0x2228e9['body']['id']){delete _0x2228e9['body']['id'];}delete _0x2228e9[_0xb00b('0x46')]['duration'];delete _0x2228e9[_0xb00b('0x46')][_0xb00b('0x47')];delete _0x2228e9[_0xb00b('0x46')][_0xb00b('0x48')];delete _0x2228e9[_0xb00b('0x46')][_0xb00b('0x49')];return db['ScreenRecording']['find']({'where':{'id':_0x2228e9[_0xb00b('0x42')]['id']}})[_0xb00b('0x3c')](handleEntityNotFound(_0x47a814,null))['then'](saveUpdates(_0x2228e9[_0xb00b('0x46')],null))[_0xb00b('0x3c')](respondWithResult(_0x47a814,null))['catch'](handleError(_0x47a814,null));};exports[_0xb00b('0x4a')]=function(_0x10e066,_0x3b5d82){return db['ScreenRecording']['describe']()[_0xb00b('0x3c')](respondWithResult(_0x3b5d82,null))[_0xb00b('0x40')](handleError(_0x3b5d82,null));};exports[_0xb00b('0x4b')]=function(_0xde3cc1,_0x489b49,_0x380acb){var _0x3f31e5=require('../../components/encryptor');var _0x4cd9fd=![];var _0x160965={};if(_0xde3cc1['query'][_0xb00b('0x27')]&&_0xde3cc1[_0xb00b('0x2b')][_0xb00b('0x27')]===_0xb00b('0x4c')){_0x160965[_0xb00b('0x4c')]=_0xde3cc1[_0xb00b('0x42')]['id'];}else{_0x160965['id']=_0xde3cc1['params']['id'];}return db[_0xb00b('0x3a')]['find']({'where':_0x160965,'attributes':['id',_0xb00b('0x49')],'raw':!![]})[_0xb00b('0x3c')](handleEntityNotFound(_0x489b49,null))[_0xb00b('0x3c')](function(_0x5ac79e){if(_0x5ac79e){var _0x248335=path[_0xb00b('0x4d')](config[_0xb00b('0x4e')],'server/files/screen_recordings',_0x5ac79e[_0xb00b('0x49')]);var _0x309ae6=util[_0xb00b('0x4f')](_0xb00b('0x50'),_0x248335);if(fs[_0xb00b('0x51')](_0x309ae6)){_0x4cd9fd=!![];return _0x3f31e5[_0xb00b('0x52')](_0x309ae6,_0x248335,config[_0xb00b('0x53')][_0xb00b('0x54')])['then'](function(){return _0x5ac79e;});}return _0x5ac79e;}})[_0xb00b('0x3c')](function(_0x2cbe80){if(_0x2cbe80){var _0x1b4860=path['join'](config[_0xb00b('0x4e')],_0xb00b('0x55'),_0x2cbe80[_0xb00b('0x49')]);if(!fs[_0xb00b('0x51')](_0x1b4860)){throw new db[(_0xb00b('0x56'))]['ValidationError'](_0xb00b('0x57'));}if(_0x2cbe80[_0xb00b('0x58')]){return _0x489b49[_0xb00b('0x4b')](_0x1b4860,_0x2cbe80[_0xb00b('0x58')]+path['extname'](_0x1b4860),function(){if(_0x4cd9fd){fs[_0xb00b('0x59')](_0x1b4860);}});}else{return _0x489b49[_0xb00b('0x4b')](_0x1b4860,function(_0x2c93db){if(_0x4cd9fd){fs[_0xb00b('0x59')](_0x1b4860);}});}}})[_0xb00b('0x40')](function(_0x1e5ed8){if(_0x1e5ed8[_0xb00b('0x5a')]==='ScreenRecording\x20not\x20found'){_0x489b49[_0xb00b('0x16')](0x194)['send'](_0xb00b('0x5b'));}else{return handleError(_0x489b49,null);}});};exports['destroy']=function(_0x3b3272,_0x530d4a){return db[_0xb00b('0x3a')]['find']({'where':{'id':_0x3b3272[_0xb00b('0x42')]['id']}})[_0xb00b('0x3c')](function(_0x3bae02){if(_['isNil'](_0x3bae02)){throw new ReferenceError('Entity\x20not\x20found');}return _0x3bae02;})['then'](function(_0x21a53d){var _0x3126be=path[_0xb00b('0x4d')](config['root'],_0xb00b('0x55'),_0x21a53d[_0xb00b('0x49')]);logger[_0xb00b('0x5c')](_0xb00b('0x5d'),_0x3126be);if(!_[_0xb00b('0x5e')](_0x21a53d['value'])&&fs[_0xb00b('0x51')](_0x3126be)){logger[_0xb00b('0x5c')]('File:\x20\x22'+_0x3126be+_0xb00b('0x5f'));fs[_0xb00b('0x60')](_0x3126be);}_0x3126be=_0x3126be+_0xb00b('0x61');if(!_['isNil'](_0x21a53d['value'])&&fs[_0xb00b('0x51')](_0x3126be)){logger[_0xb00b('0x5c')](_0xb00b('0x62')+_0x3126be+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x3126be);}return _0x21a53d;})['then'](function(_0x5e9677){if(!_0x5e9677)throw new InternalError();return _0x5e9677[_0xb00b('0x1e')]();})['then'](function(){_0x530d4a[_0xb00b('0x16')](0xcc)[_0xb00b('0x1f')]();})['catch'](handleError(_0x530d4a,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 5a3b52c..5726c63 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 _0xb011=['request-promise','path','rimraf','../../config/environment','define','ScreenRecording','screen_recordings','util','../../config/logger','api','moment','bluebird'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0xb011,0x1b7));var _0x1b01=function(_0x9c9d68,_0x52da36){_0x9c9d68=_0x9c9d68-0x0;var _0x330d9e=_0xb011[_0x9c9d68];return _0x330d9e;};'use strict';var _=require('lodash');var util=require(_0x1b01('0x0'));var logger=require(_0x1b01('0x1'))(_0x1b01('0x2'));var moment=require(_0x1b01('0x3'));var BPromise=require(_0x1b01('0x4'));var rp=require(_0x1b01('0x5'));var fs=require('fs');var path=require(_0x1b01('0x6'));var rimraf=require(_0x1b01('0x7'));var config=require(_0x1b01('0x8'));var attributes=require('./screenRecording.attributes');module['exports']=function(_0x46726f,_0x141732){return _0x46726f[_0x1b01('0x9')](_0x1b01('0xa'),attributes,{'tableName':_0x1b01('0xb'),'paranoid':![],'indexes':[{'name':'interactionid','fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf206=['lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./screenRecording.attributes','ScreenRecording','screen_recordings','interactionid'];(function(_0x478ac7,_0x512396){var _0x5a5cb8=function(_0x188e58){while(--_0x188e58){_0x478ac7['push'](_0x478ac7['shift']());}};_0x5a5cb8(++_0x512396);}(_0xf206,0x79));var _0x6f20=function(_0x431086,_0x243ab9){_0x431086=_0x431086-0x0;var _0x2457fb=_0xf206[_0x431086];return _0x2457fb;};'use strict';var _=require(_0x6f20('0x0'));var util=require('util');var logger=require(_0x6f20('0x1'))('api');var moment=require(_0x6f20('0x2'));var BPromise=require(_0x6f20('0x3'));var rp=require(_0x6f20('0x4'));var fs=require('fs');var path=require(_0x6f20('0x5'));var rimraf=require('rimraf');var config=require(_0x6f20('0x6'));var attributes=require(_0x6f20('0x7'));module['exports']=function(_0x5980a9,_0x49391e){return _0x5980a9['define'](_0x6f20('0x8'),attributes,{'tableName':_0x6f20('0x9'),'paranoid':![],'indexes':[{'name':_0x6f20('0xa'),'fields':[_0x6f20('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index f062403..d20294f 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 _0x7dc8=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ScreenRecording,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x7dc8,0xca));var _0x87dc=function(_0x4599f9,_0x3ffc9c){_0x4599f9=_0x4599f9-0x0;var _0x319124=_0x7dc8[_0x4599f9];return _0x319124;};'use strict';var _=require(_0x87dc('0x0'));var util=require('util');var moment=require(_0x87dc('0x1'));var BPromise=require(_0x87dc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x87dc('0x3'));var db=require(_0x87dc('0x4'))['db'];var utils=require(_0x87dc('0x5'));var logger=require(_0x87dc('0x6'))(_0x87dc('0x7'));var config=require(_0x87dc('0x8'));var jayson=require(_0x87dc('0x9'));var client=jayson['client'][_0x87dc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xdc0048,_0x25af49,_0x4fbabb){return new BPromise(function(_0x35bda2,_0x2a6af0){return client[_0x87dc('0xb')](_0xdc0048,_0x4fbabb)[_0x87dc('0xc')](function(_0x2864da){logger[_0x87dc('0xd')](_0x87dc('0xe'),_0x25af49,'request\x20sent');logger[_0x87dc('0xf')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x25af49,_0x87dc('0x10'),JSON[_0x87dc('0x11')](_0x2864da));if(_0x2864da['error']){if(_0x2864da[_0x87dc('0x12')][_0x87dc('0x13')]===0x1f4){logger[_0x87dc('0x12')](_0x87dc('0xe'),_0x25af49,_0x2864da[_0x87dc('0x12')][_0x87dc('0x14')]);return _0x2a6af0(_0x2864da['error'][_0x87dc('0x14')]);}logger[_0x87dc('0x12')](_0x87dc('0xe'),_0x25af49,_0x2864da['error'][_0x87dc('0x14')]);return _0x35bda2(_0x2864da[_0x87dc('0x12')]['message']);}else{logger[_0x87dc('0xd')](_0x87dc('0xe'),_0x25af49,_0x87dc('0x10'));_0x35bda2(_0x2864da[_0x87dc('0x15')][_0x87dc('0x14')]);}})[_0x87dc('0x16')](function(_0x2bf651){logger[_0x87dc('0x12')](_0x87dc('0xe'),_0x25af49,_0x2bf651);_0x2a6af0(_0x2bf651);});});} \ No newline at end of file +var _0x4997=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','ScreenRecording,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x35b18a,_0x6b2fbe){var _0x4db1bd=function(_0x389e62){while(--_0x389e62){_0x35b18a['push'](_0x35b18a['shift']());}};_0x4db1bd(++_0x6b2fbe);}(_0x4997,0x106));var _0x7499=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4997[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7499('0x0'));var util=require(_0x7499('0x1'));var moment=require(_0x7499('0x2'));var BPromise=require('bluebird');var rs=require(_0x7499('0x3'));var fs=require('fs');var Redis=require(_0x7499('0x4'));var db=require(_0x7499('0x5'))['db'];var utils=require(_0x7499('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x7499('0x7'));var jayson=require(_0x7499('0x8'));var client=jayson[_0x7499('0x9')][_0x7499('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5119f7,_0x40d84e,_0x42a2c7){return new BPromise(function(_0x4caed1,_0x50933b){return client[_0x7499('0xb')](_0x5119f7,_0x42a2c7)['then'](function(_0x4828a0){logger[_0x7499('0xc')]('ScreenRecording,\x20%s,\x20%s',_0x40d84e,_0x7499('0xd'));logger[_0x7499('0xe')](_0x7499('0xf'),_0x40d84e,_0x7499('0xd'),JSON[_0x7499('0x10')](_0x4828a0));if(_0x4828a0[_0x7499('0x11')]){if(_0x4828a0[_0x7499('0x11')]['code']===0x1f4){logger['error'](_0x7499('0x12'),_0x40d84e,_0x4828a0['error'][_0x7499('0x13')]);return _0x50933b(_0x4828a0[_0x7499('0x11')][_0x7499('0x13')]);}logger['error'](_0x7499('0x12'),_0x40d84e,_0x4828a0[_0x7499('0x11')][_0x7499('0x13')]);return _0x4caed1(_0x4828a0[_0x7499('0x11')][_0x7499('0x13')]);}else{logger['info']('ScreenRecording,\x20%s,\x20%s',_0x40d84e,_0x7499('0xd'));_0x4caed1(_0x4828a0[_0x7499('0x14')][_0x7499('0x13')]);}})[_0x7499('0x15')](function(_0x94e889){logger['error'](_0x7499('0x12'),_0x40d84e,_0x94e889);_0x50933b(_0x94e889);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index b9dceb4..0886e96 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 _0x43de=['addFavicon','put','update','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','file','logologin','addLogoLogin','preferred','favicon','/:id/favicon'];(function(_0x18f56a,_0x268f49){var _0x13bb7b=function(_0x25c402){while(--_0x25c402){_0x18f56a['push'](_0x18f56a['shift']());}};_0x13bb7b(++_0x268f49);}(_0x43de,0x1f2));var _0xe43d=function(_0x375972,_0x5602e5){_0x375972=_0x375972-0x0;var _0x4adc1b=_0x43de[_0x375972];return _0x4adc1b;};'use strict';var multer=require(_0xe43d('0x0'));var util=require('util');var path=require(_0xe43d('0x1'));var timeout=require(_0xe43d('0x2'));var express=require(_0xe43d('0x3'));var router=express[_0xe43d('0x4')]();var fs_extra=require(_0xe43d('0x5'));var auth=require(_0xe43d('0x6'));var interaction=require(_0xe43d('0x7'));var config=require(_0xe43d('0x8'));var controller=require(_0xe43d('0x9'));router[_0xe43d('0xa')]('/',auth[_0xe43d('0xb')](),controller[_0xe43d('0xc')]);router[_0xe43d('0xa')](_0xe43d('0xd'),controller[_0xe43d('0xe')]);router[_0xe43d('0xa')](_0xe43d('0xf'),controller[_0xe43d('0x10')]);router[_0xe43d('0xa')](_0xe43d('0x11'),controller[_0xe43d('0x12')]);router[_0xe43d('0xa')](_0xe43d('0x13'),controller[_0xe43d('0x14')]);router[_0xe43d('0xa')](_0xe43d('0x15'),controller[_0xe43d('0x16')]);router['get'](_0xe43d('0x17'),controller['getPreferred']);router['get']('/:id/favicon',controller[_0xe43d('0x18')]);var upload=multer({'storage':multer[_0xe43d('0x19')]({'destination':function(_0xadf30c,_0x15a0fa,_0x8f866){_0x8f866(null,path[_0xe43d('0x1a')](config[_0xe43d('0x1b')],_0xe43d('0x1c')));},'filename':function(_0x101558,_0x24d6fc,_0x5d8e88){_0x5d8e88(null,util[_0xe43d('0x1d')](_0xe43d('0x1e'),_0xe43d('0x1f'),path[_0xe43d('0x20')](_0x24d6fc[_0xe43d('0x21')])));}})});router[_0xe43d('0x22')]('/:id/logo',upload[_0xe43d('0x23')](_0xe43d('0x24')),controller['addLogo']);var upload=multer({'storage':multer[_0xe43d('0x19')]({'destination':function(_0x48cf11,_0x25df87,_0x32e2fd){_0x32e2fd(null,path[_0xe43d('0x1a')](config[_0xe43d('0x1b')],'server/files/images/logos/'));},'filename':function(_0x5b256a,_0x5cc080,_0x1a8a7f){_0x1a8a7f(null,util[_0xe43d('0x1d')](_0xe43d('0x1e'),_0xe43d('0x25'),path[_0xe43d('0x20')](_0x5cc080[_0xe43d('0x21')])));}})});router[_0xe43d('0x22')](_0xe43d('0x13'),upload[_0xe43d('0x23')](_0xe43d('0x24')),controller[_0xe43d('0x26')]);var upload=multer({'storage':multer[_0xe43d('0x19')]({'destination':function(_0x4521af,_0x88f582,_0x1588de){_0x1588de(null,path[_0xe43d('0x1a')](config[_0xe43d('0x1b')],_0xe43d('0x1c')));},'filename':function(_0x5e839a,_0x16cd1a,_0x46e395){_0x46e395(null,util[_0xe43d('0x1d')]('%s%s',_0xe43d('0x27'),path[_0xe43d('0x20')](_0x16cd1a[_0xe43d('0x21')])));}})});router[_0xe43d('0x22')](_0xe43d('0x17'),upload['single'](_0xe43d('0x24')),controller['addPreferred']);var upload=multer({'storage':multer[_0xe43d('0x19')]({'destination':function(_0x3e5e9f,_0x7552fe,_0x2a0c15){_0x2a0c15(null,path[_0xe43d('0x1a')](config['root'],'server/files/images/logos/'));},'filename':function(_0x3db880,_0x49c8e9,_0xf8c78e){_0xf8c78e(null,util[_0xe43d('0x1d')]('%s%s',_0xe43d('0x28'),path[_0xe43d('0x20')](_0x49c8e9[_0xe43d('0x21')])));}})});router['post'](_0xe43d('0x29'),upload[_0xe43d('0x23')]('file'),controller[_0xe43d('0x2a')]);router[_0xe43d('0x2b')]('/:id',auth[_0xe43d('0xb')](),controller[_0xe43d('0x2c')]);module['exports']=router; \ No newline at end of file +var _0x0560=['addLogoLogin','server/files/images/logos/','preferred','favicon','/:id/favicon','put','isAuthenticated','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./setting.controller','get','/now','/:id','show','/:id/logo','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','join','root','format','%s%s','logo','originalname','file','logologin','extname','post','/:id/logo_login','single'];(function(_0xc3769a,_0x6b59a9){var _0x2cea9a=function(_0x5557e0){while(--_0x5557e0){_0xc3769a['push'](_0xc3769a['shift']());}};_0x2cea9a(++_0x6b59a9);}(_0x0560,0xa3));var _0x0056=function(_0x61c0ad,_0xe79770){_0x61c0ad=_0x61c0ad-0x0;var _0x15a50e=_0x0560[_0x61c0ad];return _0x15a50e;};'use strict';var multer=require(_0x0056('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0056('0x1'));var express=require(_0x0056('0x2'));var router=express[_0x0056('0x3')]();var fs_extra=require(_0x0056('0x4'));var auth=require(_0x0056('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0056('0x6'));var controller=require(_0x0056('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x0056('0x8')](_0x0056('0x9'),controller['getDate']);router[_0x0056('0x8')](_0x0056('0xa'),controller[_0x0056('0xb')]);router[_0x0056('0x8')](_0x0056('0xc'),controller['getLogo']);router[_0x0056('0x8')]('/:id/logo_login',controller[_0x0056('0xd')]);router['get'](_0x0056('0xe'),controller[_0x0056('0xf')]);router[_0x0056('0x8')](_0x0056('0x10'),controller[_0x0056('0x11')]);router[_0x0056('0x8')]('/:id/favicon',controller[_0x0056('0x12')]);var upload=multer({'storage':multer[_0x0056('0x13')]({'destination':function(_0x1fc841,_0x3a4d3f,_0x7ec60b){_0x7ec60b(null,path[_0x0056('0x14')](config[_0x0056('0x15')],'server/files/images/logos/'));},'filename':function(_0x429d19,_0x366198,_0x832c98){_0x832c98(null,util[_0x0056('0x16')](_0x0056('0x17'),_0x0056('0x18'),path['extname'](_0x366198[_0x0056('0x19')])));}})});router['post']('/:id/logo',upload['single'](_0x0056('0x1a')),controller['addLogo']);var upload=multer({'storage':multer[_0x0056('0x13')]({'destination':function(_0x5a46d8,_0x21fdb7,_0x47ecdb){_0x47ecdb(null,path['join'](config[_0x0056('0x15')],'server/files/images/logos/'));},'filename':function(_0x17408b,_0x5ac76a,_0x4b75b6){_0x4b75b6(null,util['format'](_0x0056('0x17'),_0x0056('0x1b'),path[_0x0056('0x1c')](_0x5ac76a[_0x0056('0x19')])));}})});router[_0x0056('0x1d')](_0x0056('0x1e'),upload[_0x0056('0x1f')]('file'),controller[_0x0056('0x20')]);var upload=multer({'storage':multer[_0x0056('0x13')]({'destination':function(_0x236d71,_0x32aade,_0x5895ff){_0x5895ff(null,path[_0x0056('0x14')](config[_0x0056('0x15')],_0x0056('0x21')));},'filename':function(_0x19afe4,_0xdbb9aa,_0x416d48){_0x416d48(null,util[_0x0056('0x16')]('%s%s',_0x0056('0x22'),path[_0x0056('0x1c')](_0xdbb9aa[_0x0056('0x19')])));}})});router[_0x0056('0x1d')](_0x0056('0x10'),upload[_0x0056('0x1f')](_0x0056('0x1a')),controller['addPreferred']);var upload=multer({'storage':multer[_0x0056('0x13')]({'destination':function(_0x318900,_0x33ce79,_0x41be06){_0x41be06(null,path[_0x0056('0x14')](config[_0x0056('0x15')],_0x0056('0x21')));},'filename':function(_0x2a60d5,_0x23e3d4,_0x27ed6a){_0x27ed6a(null,util[_0x0056('0x16')](_0x0056('0x17'),_0x0056('0x23'),path[_0x0056('0x1c')](_0x23e3d4[_0x0056('0x19')])));}})});router[_0x0056('0x1d')](_0x0056('0x24'),upload[_0x0056('0x1f')]('file'),controller['addFavicon']);router[_0x0056('0x25')](_0x0056('0xa'),auth[_0x0056('0x26')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index cc9c8fe..1ce361a 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 _0x24f9=['sequelize','INTEGER','min_internal','min_mailbox','STRING','BOOLEAN','alternate','UNSIGNED'];(function(_0x4240c2,_0x43de18){var _0xbabf87=function(_0x77dcc7){while(--_0x77dcc7){_0x4240c2['push'](_0x4240c2['shift']());}};_0xbabf87(++_0x43de18);}(_0x24f9,0x180));var _0x924f=function(_0x12ada5,_0x2b1236){_0x12ada5=_0x12ada5-0x0;var _0x417bf6=_0x24f9[_0x12ada5];return _0x417bf6;};'use strict';var Sequelize=require(_0x924f('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0x924f('0x1')](0xb),'unique':_0x924f('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x924f('0x1')](0xb),'unique':_0x924f('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x924f('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x924f('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x924f('0x4')]},'defaultLogo':{'type':Sequelize[_0x924f('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x924f('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x924f('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x924f('0x4')]},'turnaddr':{'type':Sequelize[_0x924f('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x924f('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x924f('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x924f('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x924f('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x924f('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x924f('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x924f('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x924f('0x6')},'chatTimeout':{'type':Sequelize[_0x924f('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x924f('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x924f('0x4')]},'defaultPreferred':{'type':Sequelize[_0x924f('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x924f('0x4')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x924f('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x924f('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x924f('0x1')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x924f('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x924f('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x924f('0x1')]},'sentimentRegion':{'type':Sequelize[_0x924f('0x4')]},'language':{'type':Sequelize[_0x924f('0x4')]},'bucket':{'type':Sequelize[_0x924f('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x924f('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x924f('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x924f('0x1')](0x2)[_0x924f('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0x924f('0x7')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x924f('0x1')](0x2)[_0x924f('0x7')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x924f('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x924f('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x924f('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x924f('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x924f('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x924f('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x924f('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x924f('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x924f('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x924f('0x1')],'defaultValue':0x5}}; \ No newline at end of file +var _0xcf17=['INTEGER','min_internal','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','UNSIGNED','sequelize'];(function(_0xfca425,_0x2950d6){var _0x44ea89=function(_0x5c0db6){while(--_0x5c0db6){_0xfca425['push'](_0xfca425['shift']());}};_0x44ea89(++_0x2950d6);}(_0xcf17,0xaf));var _0x7cf1=function(_0x16a0ec,_0x18dbf4){_0x16a0ec=_0x16a0ec-0x0;var _0x52b1c5=_0xcf17[_0x16a0ec];return _0x52b1c5;};'use strict';var Sequelize=require(_0x7cf1('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0x7cf1('0x1')](0xb),'unique':_0x7cf1('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x7cf1('0x1')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x7cf1('0x3')],'defaultValue':_0x7cf1('0x4')},'logo':{'type':Sequelize[_0x7cf1('0x3')]},'defaultLogo':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x7cf1('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x7cf1('0x3')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x7cf1('0x3')]},'turnpassword':{'type':Sequelize[_0x7cf1('0x3')]},'pageTitle':{'type':Sequelize[_0x7cf1('0x3')]},'defaultPageTitle':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x7cf1('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x7cf1('0x3')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x7cf1('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x7cf1('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x7cf1('0x3')],'defaultValue':_0x7cf1('0x6')},'chatTimeout':{'type':Sequelize[_0x7cf1('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x7cf1('0x3')]},'defaultPreferred':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x7cf1('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0x7cf1('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x7cf1('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x7cf1('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x7cf1('0x1')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7cf1('0x3')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x7cf1('0x1')](0x2)[_0x7cf1('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x7cf1('0x1')](0x2)[_0x7cf1('0x7')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x7cf1('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x7cf1('0x1')](0x2)[_0x7cf1('0x7')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x7cf1('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x7cf1('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x7cf1('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x7cf1('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x7cf1('0x1')],'defaultValue':0x5}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 82fee7f..f3bd7ba 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 _0xb91a=['gdpr','addPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','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','jayson/promise','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','save','name','send','index','Setting','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','show','params','length','find','update','body','addLogo','file','logo','filename','addLogoLogin','server/files/images/logos','getLicense','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','custom','Sequelize','ValidationError','upperFirst','loginLogo','favicon','default_loginLogo.svg','default','\x20not\x20found','download'];(function(_0x1c58c1,_0x540ba8){var _0xd1c042=function(_0x53f77a){while(--_0x53f77a){_0x1c58c1['push'](_0x1c58c1['shift']());}};_0xd1c042(++_0x540ba8);}(_0xb91a,0xf4));var _0xab91=function(_0x14bc95,_0x5c7dd4){_0x14bc95=_0x14bc95-0x0;var _0x42af84=_0xb91a[_0x14bc95];return _0x42af84;};'use strict';var emlformat=require(_0xab91('0x0'));var rimraf=require(_0xab91('0x1'));var zipdir=require(_0xab91('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xab91('0x3'));var BPromise=require(_0xab91('0x4'));var Mustache=require(_0xab91('0x5'));var util=require(_0xab91('0x6'));var path=require(_0xab91('0x7'));var sox=require(_0xab91('0x8'));var csv=require(_0xab91('0x9'));var ejs=require(_0xab91('0xa'));var fs=require('fs');var fs_extra=require(_0xab91('0xb'));var _=require(_0xab91('0xc'));var squel=require('squel');var crypto=require(_0xab91('0xd'));var jsforce=require(_0xab91('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xab91('0xf'));var Redis=require(_0xab91('0x10'));var authService=require(_0xab91('0x11'));var qs=require(_0xab91('0x12'));var as=require(_0xab91('0x13'));var hardwareService=require(_0xab91('0x14'));var logger=require(_0xab91('0x15'))(_0xab91('0x16'));var utils=require(_0xab91('0x17'));var config=require(_0xab91('0x18'));var licenseUtil=require(_0xab91('0x19'));var db=require(_0xab91('0x1a'))['db'];var jayson=require(_0xab91('0x1b'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x40c32d,_0x3e77bc,_0x86902e,_0x14bded){return new BPromise(function(_0x14b304,_0xaa6e77){var _0x54cdf0=_0x14bded||client;return _0x54cdf0['request'](_0x40c32d,_0x86902e)[_0xab91('0x1c')](function(_0x3565c0){logger[_0xab91('0x1d')](_0xab91('0x1e'),_0x3e77bc,_0xab91('0x1f'));logger[_0xab91('0x20')](_0xab91('0x21'),_0x3e77bc,_0xab91('0x1f'),JSON['stringify'](_0x3565c0));if(_0x3565c0['error']){if(_0x3565c0[_0xab91('0x22')]['code']===0x1f4){logger[_0xab91('0x22')](_0xab91('0x1e'),_0x3e77bc,_0x3565c0[_0xab91('0x22')]['message']);return _0xaa6e77(_0x3565c0[_0xab91('0x22')]['message']);}logger[_0xab91('0x22')]('Setting,\x20%s,\x20%s',_0x3e77bc,_0x3565c0['error'][_0xab91('0x23')]);return _0x14b304(_0x3565c0['error'][_0xab91('0x23')]);}else{logger[_0xab91('0x1d')](_0xab91('0x1e'),_0x3e77bc,'request\x20sent');_0x14b304(_0x3565c0[_0xab91('0x24')][_0xab91('0x23')]);}})[_0xab91('0x25')](function(_0x403d6b){logger[_0xab91('0x22')](_0xab91('0x1e'),_0x3e77bc,_0x403d6b);_0xaa6e77(_0x403d6b);});});}function respondWithStatusCode(_0xf8db06,_0x57a7e9){_0x57a7e9=_0x57a7e9||0xcc;return function(_0x5eca53){if(_0x5eca53){return _0xf8db06[_0xab91('0x26')](_0x57a7e9);}return _0xf8db06['status'](_0x57a7e9)['end']();};}function respondWithResult(_0x3167ae,_0x1a0bc2){_0x1a0bc2=_0x1a0bc2||0xc8;return function(_0x5586cd){if(_0x5586cd){return _0x3167ae[_0xab91('0x27')](_0x1a0bc2)['json'](_0x5586cd);}};}function respondWithFilteredResult(_0x3fe2fc,_0x400134){return function(_0x5a3c05){if(_0x5a3c05){var _0x4138eb=typeof _0x400134[_0xab91('0x28')]===_0xab91('0x29')&&typeof _0x400134[_0xab91('0x2a')]===_0xab91('0x29');var _0x42a28b=_0x5a3c05['count'];var _0x281ede=_0x4138eb?0x0:_0x400134[_0xab91('0x28')];var _0x152c51=_0x4138eb?_0x5a3c05[_0xab91('0x2b')]:_0x400134[_0xab91('0x28')]+_0x400134[_0xab91('0x2a')];var _0x2217a7;if(_0x152c51>=_0x42a28b){_0x152c51=_0x42a28b;_0x2217a7=0xc8;}else{_0x2217a7=0xce;}_0x3fe2fc[_0xab91('0x27')](_0x2217a7);return _0x3fe2fc['set'](_0xab91('0x2c'),_0x281ede+'-'+_0x152c51+'/'+_0x42a28b)[_0xab91('0x2d')](_0x5a3c05);}return null;};}function patchUpdates(_0x26bbac){return function(_0x108d31){try{jsonpatch[_0xab91('0x2e')](_0x108d31,_0x26bbac,!![]);}catch(_0x1de1b0){return BPromise['reject'](_0x1de1b0);}return _0x108d31[_0xab91('0x2f')]();};}function saveUpdates(_0x2744e8,_0xaf40a5){return function(_0x245841){if(_0x245841){return _0x245841['update'](_0x2744e8)[_0xab91('0x1c')](function(_0x184d68){return _0x184d68;});}return null;};}function removeEntity(_0x2d6495,_0x50253b){return function(_0x60a532){if(_0x60a532){return _0x60a532['destroy']()[_0xab91('0x1c')](function(){_0x2d6495[_0xab91('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x357fca,_0x145dcc){return function(_0x40f841){if(!_0x40f841){_0x357fca[_0xab91('0x26')](0x194);}return _0x40f841;};}function handleError(_0x178943,_0x3e1625){_0x3e1625=_0x3e1625||0x1f4;return function(_0x15d2dd){logger['error'](_0x15d2dd['stack']);if(_0x15d2dd[_0xab91('0x30')]){delete _0x15d2dd[_0xab91('0x30')];}_0x178943[_0xab91('0x27')](_0x3e1625)[_0xab91('0x31')](_0x15d2dd);};}exports[_0xab91('0x32')]=function(_0xca2753,_0xa783c){var _0x6ad869={},_0x4787f0={},_0x286c6d={'count':0x0,'rows':[]};var _0x18f17b=_['map'](db[_0xab91('0x33')]['rawAttributes'],function(_0x20ceee){return{'name':_0x20ceee[_0xab91('0x34')],'type':_0x20ceee[_0xab91('0x35')][_0xab91('0x36')]};});_0x4787f0['model']=_['map'](_0x18f17b,'name');_0x4787f0[_0xab91('0x37')]=_[_0xab91('0x38')](_0xca2753['query']);_0x4787f0[_0xab91('0x39')]=_[_0xab91('0x3a')](_0x4787f0[_0xab91('0x3b')],_0x4787f0[_0xab91('0x37')]);_0x6ad869[_0xab91('0x3c')]=_[_0xab91('0x3a')](_0x4787f0[_0xab91('0x3b')],qs[_0xab91('0x3d')](_0xca2753[_0xab91('0x37')][_0xab91('0x3d')]));_0x6ad869[_0xab91('0x3c')]=_0x6ad869[_0xab91('0x3c')]['length']?_0x6ad869[_0xab91('0x3c')]:_0x4787f0[_0xab91('0x3b')];if(!_0xca2753[_0xab91('0x37')][_0xab91('0x3e')](_0xab91('0x3f'))){_0x6ad869[_0xab91('0x2a')]=qs['limit'](_0xca2753[_0xab91('0x37')]['limit']);_0x6ad869[_0xab91('0x28')]=qs[_0xab91('0x28')](_0xca2753[_0xab91('0x37')][_0xab91('0x28')]);}_0x6ad869[_0xab91('0x40')]=qs[_0xab91('0x41')](_0xca2753[_0xab91('0x37')][_0xab91('0x41')]);_0x6ad869[_0xab91('0x42')]=qs[_0xab91('0x39')](_[_0xab91('0x43')](_0xca2753[_0xab91('0x37')],_0x4787f0[_0xab91('0x39')]),_0x18f17b);if(_0xca2753[_0xab91('0x37')][_0xab91('0x44')]){_0x6ad869[_0xab91('0x42')]=_[_0xab91('0x45')](_0x6ad869['where'],{'$or':_[_0xab91('0x46')](_0x18f17b,function(_0x317a47){if(_0x317a47[_0xab91('0x35')]!=='VIRTUAL'){var _0x218c72={};_0x218c72[_0x317a47[_0xab91('0x30')]]={'$like':'%'+_0xca2753['query'][_0xab91('0x44')]+'%'};return _0x218c72;}})});}_0x6ad869=_[_0xab91('0x45')]({},_0x6ad869,_0xca2753[_0xab91('0x47')]);var _0x342c23={'where':_0x6ad869['where']};return db[_0xab91('0x33')]['count'](_0x342c23)[_0xab91('0x1c')](function(_0x4cec74){_0x286c6d[_0xab91('0x2b')]=_0x4cec74;if(_0xca2753[_0xab91('0x37')][_0xab91('0x48')]){_0x6ad869[_0xab91('0x49')]=[{'all':!![]}];}return db['Setting']['findAll'](_0x6ad869);})[_0xab91('0x1c')](function(_0x5910ff){_0x286c6d['rows']=_0x5910ff;return _0x286c6d;})[_0xab91('0x1c')](respondWithFilteredResult(_0xa783c,_0x6ad869))[_0xab91('0x25')](handleError(_0xa783c,null));};exports[_0xab91('0x4a')]=function(_0x59c9d9,_0x11bb27){var _0x4f0764={'raw':![],'where':{'id':_0x59c9d9[_0xab91('0x4b')]['id']}},_0x5bf385={};_0x5bf385[_0xab91('0x3b')]=_['keys'](db[_0xab91('0x33')]['rawAttributes']);_0x5bf385[_0xab91('0x37')]=_[_0xab91('0x38')](_0x59c9d9[_0xab91('0x37')]);_0x5bf385['filters']=_[_0xab91('0x3a')](_0x5bf385[_0xab91('0x3b')],_0x5bf385[_0xab91('0x37')]);_0x4f0764[_0xab91('0x3c')]=_[_0xab91('0x3a')](_0x5bf385[_0xab91('0x3b')],qs[_0xab91('0x3d')](_0x59c9d9[_0xab91('0x37')][_0xab91('0x3d')]));_0x4f0764[_0xab91('0x3c')]=_0x4f0764[_0xab91('0x3c')][_0xab91('0x4c')]?_0x4f0764['attributes']:_0x5bf385['model'];if(_0x59c9d9[_0xab91('0x37')]['includeAll']){_0x4f0764[_0xab91('0x49')]=[{'all':!![]}];}_0x4f0764=_[_0xab91('0x45')]({},_0x4f0764,_0x59c9d9['options']);return db[_0xab91('0x33')][_0xab91('0x4d')](_0x4f0764)[_0xab91('0x1c')](handleEntityNotFound(_0x11bb27,null))[_0xab91('0x1c')](respondWithResult(_0x11bb27,null))[_0xab91('0x25')](handleError(_0x11bb27,null));};exports[_0xab91('0x4e')]=function(_0x421a0e,_0x34ca51){if(_0x421a0e[_0xab91('0x4f')]['id']){delete _0x421a0e[_0xab91('0x4f')]['id'];}return db[_0xab91('0x33')][_0xab91('0x4d')]({'where':{'id':_0x421a0e[_0xab91('0x4b')]['id']}})[_0xab91('0x1c')](handleEntityNotFound(_0x34ca51,null))[_0xab91('0x1c')](saveUpdates(_0x421a0e[_0xab91('0x4f')],null))['then'](respondWithResult(_0x34ca51,null))[_0xab91('0x25')](handleError(_0x34ca51,null));};exports[_0xab91('0x50')]=function(_0x43d139,_0x42e2dc,_0x9f2eae){if(_0x43d139[_0xab91('0x51')]&&_0x43d139[_0xab91('0x51')]['filename']){_0x43d139[_0xab91('0x4f')][_0xab91('0x52')]=_0x43d139[_0xab91('0x51')][_0xab91('0x53')];}return db[_0xab91('0x33')][_0xab91('0x4d')]({'where':{'id':_0x43d139[_0xab91('0x4b')]['id']}})[_0xab91('0x1c')](handleEntityNotFound(_0x42e2dc,null))[_0xab91('0x1c')](saveUpdates(_0x43d139[_0xab91('0x4f')],null))[_0xab91('0x1c')](respondWithResult(_0x42e2dc,null))[_0xab91('0x25')](handleError(_0x42e2dc,null));};exports[_0xab91('0x54')]=function(_0x4e6f6c,_0x2175e0,_0x96000a){if(_0x4e6f6c['file']&&_0x4e6f6c[_0xab91('0x51')][_0xab91('0x53')]){_0x4e6f6c[_0xab91('0x4f')]['loginLogo']=_0x4e6f6c[_0xab91('0x51')]['filename'];}return db['Setting'][_0xab91('0x4d')]({'where':{'id':_0x4e6f6c[_0xab91('0x4b')]['id']}})[_0xab91('0x1c')](handleEntityNotFound(_0x2175e0,null))[_0xab91('0x1c')](saveUpdates(_0x4e6f6c[_0xab91('0x4f')],null))['then'](respondWithResult(_0x2175e0,null))[_0xab91('0x25')](handleError(_0x2175e0,null));};var utilLicense=require(_0xab91('0x19'));exports['getLogo']=function(_0x3ada8d,_0x197c5f,_0x24390c){var _0x312ce5=_0xab91('0x55');var _0x37b484={'custom':![]};return utilLicense[_0xab91('0x56')]()[_0xab91('0x1c')](function(_0x221484){if(_0x221484){_0x37b484=_0x221484;}return db[_0xab91('0x33')][_0xab91('0x4d')]({'where':{'id':_0x3ada8d[_0xab91('0x4b')]['id']},'attributes':['logo','loginLogo',_0xab91('0x57'),'favicon',_0xab91('0x58'),_0xab91('0x59'),_0xab91('0x5a'),_0xab91('0x5b')],'raw':!![]});})['then'](handleEntityNotFound(_0x197c5f,null))[_0xab91('0x1c')](function(_0x250c86){if(_0x250c86){var _0x744959=_0x250c86[_0xab91('0x52')]&&fs[_0xab91('0x5c')](path[_0xab91('0x5d')](config[_0xab91('0x5e')],_0x312ce5,_['toLower'](_0x250c86[_0xab91('0x52')])))?path[_0xab91('0x5d')](config[_0xab91('0x5e')],_0x312ce5,_[_0xab91('0x5f')](_0x250c86[_0xab91('0x52')])):path['join'](config[_0xab91('0x5e')],_0x312ce5,_['toLower'](_0xab91('0x60')));var _0x1518aa='default'+_['upperFirst']('logo');if(_0x250c86[_0x1518aa]||!_0x37b484[_0xab91('0x61')]){_0x744959=path[_0xab91('0x5d')](config[_0xab91('0x5e')],_0x312ce5,_['toLower'](_0xab91('0x60')));}if(!fs[_0xab91('0x5c')](_0x744959)){throw new db[(_0xab91('0x62'))][(_0xab91('0x63'))](_[_0xab91('0x64')](_0xab91('0x52'))+'\x20not\x20found');}return _0x197c5f['download'](_0x744959);}})[_0xab91('0x25')](handleError(_0x197c5f,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0xe155d6,_0x5ab0d9,_0xc02c22){var _0x181fc9=_0xab91('0x55');var _0x58c1b1={'custom':![]};return utilLicense[_0xab91('0x56')]()[_0xab91('0x1c')](function(_0x38f73f){if(_0x38f73f){_0x58c1b1=_0x38f73f;}return db[_0xab91('0x33')][_0xab91('0x4d')]({'where':{'id':_0xe155d6['params']['id']},'attributes':[_0xab91('0x52'),_0xab91('0x65'),_0xab91('0x57'),_0xab91('0x66'),_0xab91('0x58'),_0xab91('0x59'),_0xab91('0x5a'),_0xab91('0x5b')],'raw':!![]});})['then'](handleEntityNotFound(_0x5ab0d9,null))[_0xab91('0x1c')](function(_0x280748){if(_0x280748){var _0x3853c4=_0x280748[_0xab91('0x65')]&&fs[_0xab91('0x5c')](path[_0xab91('0x5d')](config[_0xab91('0x5e')],_0x181fc9,_[_0xab91('0x5f')](_0x280748[_0xab91('0x65')])))?path['join'](config[_0xab91('0x5e')],_0x181fc9,_[_0xab91('0x5f')](_0x280748['loginLogo'])):path['join'](config[_0xab91('0x5e')],_0x181fc9,_[_0xab91('0x5f')](_0xab91('0x67')));var _0x1668d3=_0xab91('0x68')+_[_0xab91('0x64')](_0xab91('0x65'));if(_0x280748[_0x1668d3]||!_0x58c1b1[_0xab91('0x61')]){_0x3853c4=path[_0xab91('0x5d')](config[_0xab91('0x5e')],_0x181fc9,_[_0xab91('0x5f')](_0xab91('0x67')));}if(!fs[_0xab91('0x5c')](_0x3853c4)){throw new db[(_0xab91('0x62'))]['ValidationError'](_[_0xab91('0x64')](_0xab91('0x65'))+_0xab91('0x69'));}return _0x5ab0d9[_0xab91('0x6a')](_0x3853c4);}})['catch'](handleError(_0x5ab0d9,null));};exports[_0xab91('0x6b')]=function(_0xb4522,_0x3d74e3){return db[_0xab91('0x33')][_0xab91('0x4d')]({'where':{'id':_0xb4522['params']['id']},'attributes':['securePassword']})[_0xab91('0x1c')](respondWithResult(_0x3d74e3,null))[_0xab91('0x25')](handleError(_0x3d74e3,null));};exports[_0xab91('0x6c')]=function(_0x59752b,_0x2b174c,_0x37251c){if(_0x59752b[_0xab91('0x51')]&&_0x59752b[_0xab91('0x51')]['filename']){_0x59752b[_0xab91('0x4f')][_0xab91('0x57')]=_0x59752b[_0xab91('0x51')][_0xab91('0x53')];}return db[_0xab91('0x33')][_0xab91('0x4d')]({'where':{'id':_0x59752b[_0xab91('0x4b')]['id']}})[_0xab91('0x1c')](handleEntityNotFound(_0x2b174c,null))[_0xab91('0x1c')](saveUpdates(_0x59752b[_0xab91('0x4f')],null))[_0xab91('0x1c')](respondWithResult(_0x2b174c,null))['catch'](handleError(_0x2b174c,null));};var utilLicense=require(_0xab91('0x19'));exports['getPreferred']=function(_0x1443fc,_0x64e7a6,_0x1162a2){var _0x1cb4be=_0xab91('0x55');var _0x556994={'custom':![]};return utilLicense['getLicense']()[_0xab91('0x1c')](function(_0x437a8e){if(_0x437a8e){_0x556994=_0x437a8e;}return db[_0xab91('0x33')]['find']({'where':{'id':_0x1443fc[_0xab91('0x4b')]['id']},'attributes':['logo',_0xab91('0x65'),_0xab91('0x57'),'favicon','defaultLogo',_0xab91('0x59'),_0xab91('0x5a'),_0xab91('0x5b')],'raw':!![]});})[_0xab91('0x1c')](handleEntityNotFound(_0x64e7a6,null))['then'](function(_0x50e137){if(_0x50e137){var _0x1f3b60=_0x50e137[_0xab91('0x57')]&&fs[_0xab91('0x5c')](path[_0xab91('0x5d')](config[_0xab91('0x5e')],_0x1cb4be,_[_0xab91('0x5f')](_0x50e137[_0xab91('0x57')])))?path[_0xab91('0x5d')](config[_0xab91('0x5e')],_0x1cb4be,_['toLower'](_0x50e137[_0xab91('0x57')])):path[_0xab91('0x5d')](config[_0xab91('0x5e')],_0x1cb4be,_[_0xab91('0x5f')](_0xab91('0x6d')));var _0x22cb33='default'+_[_0xab91('0x64')](_0xab91('0x57'));if(_0x50e137[_0x22cb33]||!_0x556994[_0xab91('0x61')]||!_0x556994['preferred']){_0x1f3b60=path[_0xab91('0x5d')](config[_0xab91('0x5e')],_0x1cb4be,_['toLower'](_0xab91('0x6d')));}if(!fs[_0xab91('0x5c')](_0x1f3b60)){throw new db['Sequelize'][(_0xab91('0x63'))](_[_0xab91('0x64')](_0xab91('0x57'))+_0xab91('0x69'));}return _0x64e7a6[_0xab91('0x6a')](_0x1f3b60);}})[_0xab91('0x25')](handleError(_0x64e7a6,null));};exports[_0xab91('0x6e')]=function(_0x43a4be,_0x816efa,_0x490068){if(_0x43a4be[_0xab91('0x51')]&&_0x43a4be[_0xab91('0x51')][_0xab91('0x53')]){_0x43a4be['body'][_0xab91('0x66')]=_0x43a4be[_0xab91('0x51')][_0xab91('0x53')];}return db['Setting'][_0xab91('0x4d')]({'where':{'id':_0x43a4be[_0xab91('0x4b')]['id']}})[_0xab91('0x1c')](handleEntityNotFound(_0x816efa,null))[_0xab91('0x1c')](saveUpdates(_0x43a4be['body'],null))[_0xab91('0x1c')](respondWithResult(_0x816efa,null))[_0xab91('0x25')](handleError(_0x816efa,null));};var utilLicense=require('../../config/license/util');exports[_0xab91('0x6f')]=function(_0x32c061,_0x6eeb22,_0x1b9b4a){var _0x4d94d4='server/files/images/logos';var _0x43d664={'custom':![]};return utilLicense[_0xab91('0x56')]()[_0xab91('0x1c')](function(_0x4e5771){if(_0x4e5771){_0x43d664=_0x4e5771;}return db['Setting'][_0xab91('0x4d')]({'where':{'id':_0x32c061[_0xab91('0x4b')]['id']},'attributes':[_0xab91('0x52'),_0xab91('0x65'),'preferred',_0xab91('0x66'),_0xab91('0x58'),_0xab91('0x59'),_0xab91('0x5a'),_0xab91('0x5b')],'raw':!![]});})[_0xab91('0x1c')](handleEntityNotFound(_0x6eeb22,null))[_0xab91('0x1c')](function(_0x1c1ee5){if(_0x1c1ee5){var _0x42997e=_0x1c1ee5[_0xab91('0x66')]&&fs[_0xab91('0x5c')](path[_0xab91('0x5d')](config[_0xab91('0x5e')],_0x4d94d4,_['toLower'](_0x1c1ee5['favicon'])))?path[_0xab91('0x5d')](config[_0xab91('0x5e')],_0x4d94d4,_[_0xab91('0x5f')](_0x1c1ee5[_0xab91('0x66')])):path[_0xab91('0x5d')](config[_0xab91('0x5e')],_0x4d94d4,_[_0xab91('0x5f')](_0xab91('0x70')));var _0x25a83a=_0xab91('0x68')+_[_0xab91('0x64')](_0xab91('0x66'));if(_0x1c1ee5[_0x25a83a]||!_0x43d664[_0xab91('0x61')]){_0x42997e=path[_0xab91('0x5d')](config[_0xab91('0x5e')],_0x4d94d4,_[_0xab91('0x5f')](_0xab91('0x70')));}if(!fs[_0xab91('0x5c')](_0x42997e)){throw new db[(_0xab91('0x62'))][(_0xab91('0x63'))](_[_0xab91('0x64')]('favicon')+_0xab91('0x69'));}return _0x6eeb22[_0xab91('0x6a')](_0x42997e);}})[_0xab91('0x25')](handleError(_0x6eeb22,null));};exports[_0xab91('0x71')]=function(_0xce55c2,_0xd5b3ba){var _0x5baace={'offset':moment()[_0xab91('0x72')]()};_0x5baace[_0xab91('0x73')]=moment()[_0xab91('0x72')](_0x5baace[_0xab91('0x28')])[_0xab91('0x74')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0xd5b3ba[_0xab91('0x27')](0xc8)['send'](_0x5baace);}; \ No newline at end of file +var _0xdef6=['defaultFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','limit','count','offset','apply','reject','save','update','destroy','stack','name','send','index','map','Setting','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','show','params','rawAttributes','find','body','addLogo','file','filename','addLogoLogin','getLogo','logo','loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','\x20not\x20found','download','getLogoLogin','server/files/images/logos','getLicense','default_loginLogo.svg','ValidationError','gdpr','securePassword','addPreferred','default_preferred.png','getFavicon'];(function(_0x5a76ff,_0x35b0b4){var _0x59a6e0=function(_0xd772e4){while(--_0xd772e4){_0x5a76ff['push'](_0x5a76ff['shift']());}};_0x59a6e0(++_0x35b0b4);}(_0xdef6,0x172));var _0x6def=function(_0x287a0c,_0xa5cbc5){_0x287a0c=_0x287a0c-0x0;var _0x1233eb=_0xdef6[_0x287a0c];return _0x1233eb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6def('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6def('0x1'));var rp=require(_0x6def('0x2'));var moment=require(_0x6def('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6def('0x4'));var util=require('util');var path=require(_0x6def('0x5'));var sox=require(_0x6def('0x6'));var csv=require(_0x6def('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6def('0x8'));var _=require(_0x6def('0x9'));var squel=require('squel');var crypto=require(_0x6def('0xa'));var jsforce=require(_0x6def('0xb'));var deskjs=require(_0x6def('0xc'));var toCsv=require(_0x6def('0x7'));var querystring=require(_0x6def('0xd'));var Papa=require(_0x6def('0xe'));var Redis=require(_0x6def('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6def('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6def('0x11'));var logger=require('../../config/logger')(_0x6def('0x12'));var utils=require(_0x6def('0x13'));var config=require(_0x6def('0x14'));var licenseUtil=require(_0x6def('0x15'));var db=require(_0x6def('0x16'))['db'];var jayson=require(_0x6def('0x17'));var client=jayson[_0x6def('0x18')][_0x6def('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x5e90fc,_0x5d8ce8,_0x27929b,_0x546bb6){return new BPromise(function(_0x2592b9,_0x475889){var _0x13765d=_0x546bb6||client;return _0x13765d['request'](_0x5e90fc,_0x27929b)[_0x6def('0x1a')](function(_0x50cffe){logger[_0x6def('0x1b')](_0x6def('0x1c'),_0x5d8ce8,_0x6def('0x1d'));logger[_0x6def('0x1e')](_0x6def('0x1f'),_0x5d8ce8,_0x6def('0x1d'),JSON[_0x6def('0x20')](_0x50cffe));if(_0x50cffe[_0x6def('0x21')]){if(_0x50cffe['error'][_0x6def('0x22')]===0x1f4){logger['error'](_0x6def('0x1c'),_0x5d8ce8,_0x50cffe[_0x6def('0x21')][_0x6def('0x23')]);return _0x475889(_0x50cffe['error'][_0x6def('0x23')]);}logger[_0x6def('0x21')](_0x6def('0x1c'),_0x5d8ce8,_0x50cffe['error'][_0x6def('0x23')]);return _0x2592b9(_0x50cffe[_0x6def('0x21')]['message']);}else{logger['info'](_0x6def('0x1c'),_0x5d8ce8,'request\x20sent');_0x2592b9(_0x50cffe[_0x6def('0x24')][_0x6def('0x23')]);}})[_0x6def('0x25')](function(_0x432794){logger['error']('Setting,\x20%s,\x20%s',_0x5d8ce8,_0x432794);_0x475889(_0x432794);});});}function respondWithStatusCode(_0x5034fb,_0x5e5fe7){_0x5e5fe7=_0x5e5fe7||0xcc;return function(_0x23b204){if(_0x23b204){return _0x5034fb[_0x6def('0x26')](_0x5e5fe7);}return _0x5034fb[_0x6def('0x27')](_0x5e5fe7)[_0x6def('0x28')]();};}function respondWithResult(_0x37f974,_0x50f16c){_0x50f16c=_0x50f16c||0xc8;return function(_0x1ed119){if(_0x1ed119){return _0x37f974[_0x6def('0x27')](_0x50f16c)['json'](_0x1ed119);}};}function respondWithFilteredResult(_0x2a1c02,_0xbdfd05){return function(_0x384afc){if(_0x384afc){var _0x5a9983=typeof _0xbdfd05['offset']==='undefined'&&typeof _0xbdfd05[_0x6def('0x29')]==='undefined';var _0x5d6856=_0x384afc[_0x6def('0x2a')];var _0x37d2d9=_0x5a9983?0x0:_0xbdfd05[_0x6def('0x2b')];var _0xcf9c9e=_0x5a9983?_0x384afc[_0x6def('0x2a')]:_0xbdfd05['offset']+_0xbdfd05['limit'];var _0x258222;if(_0xcf9c9e>=_0x5d6856){_0xcf9c9e=_0x5d6856;_0x258222=0xc8;}else{_0x258222=0xce;}_0x2a1c02[_0x6def('0x27')](_0x258222);return _0x2a1c02['set']('Content-Range',_0x37d2d9+'-'+_0xcf9c9e+'/'+_0x5d6856)['json'](_0x384afc);}return null;};}function patchUpdates(_0x4d2ed5){return function(_0x186c00){try{jsonpatch[_0x6def('0x2c')](_0x186c00,_0x4d2ed5,!![]);}catch(_0x126c69){return BPromise[_0x6def('0x2d')](_0x126c69);}return _0x186c00[_0x6def('0x2e')]();};}function saveUpdates(_0x263340,_0xfcff0e){return function(_0x35135a){if(_0x35135a){return _0x35135a[_0x6def('0x2f')](_0x263340)[_0x6def('0x1a')](function(_0x2bf56b){return _0x2bf56b;});}return null;};}function removeEntity(_0x3c5b10,_0x137dc2){return function(_0x29de9a){if(_0x29de9a){return _0x29de9a[_0x6def('0x30')]()[_0x6def('0x1a')](function(){_0x3c5b10['status'](0xcc)[_0x6def('0x28')]();});}};}function handleEntityNotFound(_0x308f88,_0x2c0741){return function(_0x42a286){if(!_0x42a286){_0x308f88['sendStatus'](0x194);}return _0x42a286;};}function handleError(_0x3b06f9,_0x2728b6){_0x2728b6=_0x2728b6||0x1f4;return function(_0x39c113){logger[_0x6def('0x21')](_0x39c113[_0x6def('0x31')]);if(_0x39c113['name']){delete _0x39c113[_0x6def('0x32')];}_0x3b06f9[_0x6def('0x27')](_0x2728b6)[_0x6def('0x33')](_0x39c113);};}exports[_0x6def('0x34')]=function(_0xd61967,_0x2339e8){var _0x3d77b2={},_0x852000={},_0x4b05c6={'count':0x0,'rows':[]};var _0x4cbe72=_[_0x6def('0x35')](db[_0x6def('0x36')]['rawAttributes'],function(_0x21b0ac){return{'name':_0x21b0ac[_0x6def('0x37')],'type':_0x21b0ac[_0x6def('0x38')][_0x6def('0x39')]};});_0x852000[_0x6def('0x3a')]=_['map'](_0x4cbe72,_0x6def('0x32'));_0x852000[_0x6def('0x3b')]=_[_0x6def('0x3c')](_0xd61967[_0x6def('0x3b')]);_0x852000['filters']=_[_0x6def('0x3d')](_0x852000[_0x6def('0x3a')],_0x852000[_0x6def('0x3b')]);_0x3d77b2[_0x6def('0x3e')]=_[_0x6def('0x3d')](_0x852000[_0x6def('0x3a')],qs[_0x6def('0x3f')](_0xd61967['query'][_0x6def('0x3f')]));_0x3d77b2[_0x6def('0x3e')]=_0x3d77b2['attributes'][_0x6def('0x40')]?_0x3d77b2[_0x6def('0x3e')]:_0x852000[_0x6def('0x3a')];if(!_0xd61967[_0x6def('0x3b')]['hasOwnProperty'](_0x6def('0x41'))){_0x3d77b2['limit']=qs['limit'](_0xd61967[_0x6def('0x3b')][_0x6def('0x29')]);_0x3d77b2[_0x6def('0x2b')]=qs[_0x6def('0x2b')](_0xd61967['query'][_0x6def('0x2b')]);}_0x3d77b2[_0x6def('0x42')]=qs[_0x6def('0x43')](_0xd61967[_0x6def('0x3b')][_0x6def('0x43')]);_0x3d77b2[_0x6def('0x44')]=qs[_0x6def('0x45')](_['pick'](_0xd61967['query'],_0x852000[_0x6def('0x45')]),_0x4cbe72);if(_0xd61967[_0x6def('0x3b')][_0x6def('0x46')]){_0x3d77b2[_0x6def('0x44')]=_['merge'](_0x3d77b2['where'],{'$or':_[_0x6def('0x35')](_0x4cbe72,function(_0x7b028d){if(_0x7b028d[_0x6def('0x38')]!==_0x6def('0x47')){var _0x4617b7={};_0x4617b7[_0x7b028d[_0x6def('0x32')]]={'$like':'%'+_0xd61967[_0x6def('0x3b')]['filter']+'%'};return _0x4617b7;}})});}_0x3d77b2=_[_0x6def('0x48')]({},_0x3d77b2,_0xd61967[_0x6def('0x49')]);var _0x34714c={'where':_0x3d77b2[_0x6def('0x44')]};return db[_0x6def('0x36')][_0x6def('0x2a')](_0x34714c)['then'](function(_0x54b66a){_0x4b05c6[_0x6def('0x2a')]=_0x54b66a;if(_0xd61967[_0x6def('0x3b')][_0x6def('0x4a')]){_0x3d77b2[_0x6def('0x4b')]=[{'all':!![]}];}return db[_0x6def('0x36')]['findAll'](_0x3d77b2);})[_0x6def('0x1a')](function(_0x5542b7){_0x4b05c6['rows']=_0x5542b7;return _0x4b05c6;})[_0x6def('0x1a')](respondWithFilteredResult(_0x2339e8,_0x3d77b2))['catch'](handleError(_0x2339e8,null));};exports[_0x6def('0x4c')]=function(_0x4b6c9c,_0x17e802){var _0x5deb33={'raw':![],'where':{'id':_0x4b6c9c[_0x6def('0x4d')]['id']}},_0x3b15b0={};_0x3b15b0[_0x6def('0x3a')]=_['keys'](db[_0x6def('0x36')][_0x6def('0x4e')]);_0x3b15b0[_0x6def('0x3b')]=_['keys'](_0x4b6c9c['query']);_0x3b15b0[_0x6def('0x45')]=_[_0x6def('0x3d')](_0x3b15b0['model'],_0x3b15b0[_0x6def('0x3b')]);_0x5deb33[_0x6def('0x3e')]=_[_0x6def('0x3d')](_0x3b15b0[_0x6def('0x3a')],qs[_0x6def('0x3f')](_0x4b6c9c[_0x6def('0x3b')]['fields']));_0x5deb33['attributes']=_0x5deb33['attributes'][_0x6def('0x40')]?_0x5deb33['attributes']:_0x3b15b0[_0x6def('0x3a')];if(_0x4b6c9c[_0x6def('0x3b')][_0x6def('0x4a')]){_0x5deb33['include']=[{'all':!![]}];}_0x5deb33=_[_0x6def('0x48')]({},_0x5deb33,_0x4b6c9c[_0x6def('0x49')]);return db['Setting'][_0x6def('0x4f')](_0x5deb33)[_0x6def('0x1a')](handleEntityNotFound(_0x17e802,null))[_0x6def('0x1a')](respondWithResult(_0x17e802,null))[_0x6def('0x25')](handleError(_0x17e802,null));};exports[_0x6def('0x2f')]=function(_0x3899a9,_0x5320fe){if(_0x3899a9[_0x6def('0x50')]['id']){delete _0x3899a9[_0x6def('0x50')]['id'];}return db[_0x6def('0x36')][_0x6def('0x4f')]({'where':{'id':_0x3899a9['params']['id']}})[_0x6def('0x1a')](handleEntityNotFound(_0x5320fe,null))[_0x6def('0x1a')](saveUpdates(_0x3899a9[_0x6def('0x50')],null))[_0x6def('0x1a')](respondWithResult(_0x5320fe,null))[_0x6def('0x25')](handleError(_0x5320fe,null));};exports[_0x6def('0x51')]=function(_0x136424,_0x53a78b,_0x576925){if(_0x136424[_0x6def('0x52')]&&_0x136424[_0x6def('0x52')][_0x6def('0x53')]){_0x136424[_0x6def('0x50')]['logo']=_0x136424[_0x6def('0x52')]['filename'];}return db['Setting'][_0x6def('0x4f')]({'where':{'id':_0x136424['params']['id']}})[_0x6def('0x1a')](handleEntityNotFound(_0x53a78b,null))['then'](saveUpdates(_0x136424[_0x6def('0x50')],null))[_0x6def('0x1a')](respondWithResult(_0x53a78b,null))['catch'](handleError(_0x53a78b,null));};exports[_0x6def('0x54')]=function(_0x3b1389,_0x6a5fd,_0x550730){if(_0x3b1389[_0x6def('0x52')]&&_0x3b1389[_0x6def('0x52')][_0x6def('0x53')]){_0x3b1389[_0x6def('0x50')]['loginLogo']=_0x3b1389[_0x6def('0x52')][_0x6def('0x53')];}return db['Setting']['find']({'where':{'id':_0x3b1389[_0x6def('0x4d')]['id']}})['then'](handleEntityNotFound(_0x6a5fd,null))['then'](saveUpdates(_0x3b1389[_0x6def('0x50')],null))[_0x6def('0x1a')](respondWithResult(_0x6a5fd,null))['catch'](handleError(_0x6a5fd,null));};var utilLicense=require(_0x6def('0x15'));exports[_0x6def('0x55')]=function(_0x19774d,_0x276861,_0x430357){var _0x2ff06f='server/files/images/logos';var _0x23319c={'custom':![]};return utilLicense['getLicense']()[_0x6def('0x1a')](function(_0x151be2){if(_0x151be2){_0x23319c=_0x151be2;}return db[_0x6def('0x36')][_0x6def('0x4f')]({'where':{'id':_0x19774d[_0x6def('0x4d')]['id']},'attributes':[_0x6def('0x56'),_0x6def('0x57'),_0x6def('0x58'),_0x6def('0x59'),_0x6def('0x5a'),_0x6def('0x5b'),_0x6def('0x5c'),'defaultFavicon'],'raw':!![]});})[_0x6def('0x1a')](handleEntityNotFound(_0x276861,null))['then'](function(_0x47895e){if(_0x47895e){var _0x40ebf8=_0x47895e[_0x6def('0x56')]&&fs[_0x6def('0x5d')](path[_0x6def('0x5e')](config[_0x6def('0x5f')],_0x2ff06f,_[_0x6def('0x60')](_0x47895e['logo'])))?path[_0x6def('0x5e')](config[_0x6def('0x5f')],_0x2ff06f,_[_0x6def('0x60')](_0x47895e[_0x6def('0x56')])):path[_0x6def('0x5e')](config['root'],_0x2ff06f,_['toLower'](_0x6def('0x61')));var _0x5204b7=_0x6def('0x62')+_[_0x6def('0x63')](_0x6def('0x56'));if(_0x47895e[_0x5204b7]||!_0x23319c[_0x6def('0x64')]){_0x40ebf8=path[_0x6def('0x5e')](config['root'],_0x2ff06f,_[_0x6def('0x60')](_0x6def('0x61')));}if(!fs['existsSync'](_0x40ebf8)){throw new db[(_0x6def('0x65'))]['ValidationError'](_[_0x6def('0x63')]('logo')+_0x6def('0x66'));}return _0x276861[_0x6def('0x67')](_0x40ebf8);}})[_0x6def('0x25')](handleError(_0x276861,null));};var utilLicense=require(_0x6def('0x15'));exports[_0x6def('0x68')]=function(_0x397224,_0x3388a5,_0x1a793f){var _0x220050=_0x6def('0x69');var _0x4701d9={'custom':![]};return utilLicense[_0x6def('0x6a')]()['then'](function(_0x4bc640){if(_0x4bc640){_0x4701d9=_0x4bc640;}return db[_0x6def('0x36')][_0x6def('0x4f')]({'where':{'id':_0x397224[_0x6def('0x4d')]['id']},'attributes':[_0x6def('0x56'),'loginLogo',_0x6def('0x58'),'favicon',_0x6def('0x5a'),_0x6def('0x5b'),_0x6def('0x5c'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x3388a5,null))[_0x6def('0x1a')](function(_0x3ea54a){if(_0x3ea54a){var _0x23cba7=_0x3ea54a['loginLogo']&&fs[_0x6def('0x5d')](path['join'](config[_0x6def('0x5f')],_0x220050,_[_0x6def('0x60')](_0x3ea54a[_0x6def('0x57')])))?path['join'](config['root'],_0x220050,_[_0x6def('0x60')](_0x3ea54a['loginLogo'])):path['join'](config['root'],_0x220050,_[_0x6def('0x60')](_0x6def('0x6b')));var _0x36d92='default'+_[_0x6def('0x63')](_0x6def('0x57'));if(_0x3ea54a[_0x36d92]||!_0x4701d9[_0x6def('0x64')]){_0x23cba7=path['join'](config[_0x6def('0x5f')],_0x220050,_[_0x6def('0x60')](_0x6def('0x6b')));}if(!fs[_0x6def('0x5d')](_0x23cba7)){throw new db[(_0x6def('0x65'))][(_0x6def('0x6c'))](_['upperFirst'](_0x6def('0x57'))+'\x20not\x20found');}return _0x3388a5[_0x6def('0x67')](_0x23cba7);}})[_0x6def('0x25')](handleError(_0x3388a5,null));};exports[_0x6def('0x6d')]=function(_0x1a99c4,_0x4f7004){return db[_0x6def('0x36')][_0x6def('0x4f')]({'where':{'id':_0x1a99c4[_0x6def('0x4d')]['id']},'attributes':[_0x6def('0x6e')]})[_0x6def('0x1a')](respondWithResult(_0x4f7004,null))[_0x6def('0x25')](handleError(_0x4f7004,null));};exports[_0x6def('0x6f')]=function(_0x5a61f5,_0x31db07,_0x4ecd65){if(_0x5a61f5['file']&&_0x5a61f5[_0x6def('0x52')][_0x6def('0x53')]){_0x5a61f5[_0x6def('0x50')]['preferred']=_0x5a61f5['file'][_0x6def('0x53')];}return db['Setting'][_0x6def('0x4f')]({'where':{'id':_0x5a61f5[_0x6def('0x4d')]['id']}})[_0x6def('0x1a')](handleEntityNotFound(_0x31db07,null))[_0x6def('0x1a')](saveUpdates(_0x5a61f5[_0x6def('0x50')],null))[_0x6def('0x1a')](respondWithResult(_0x31db07,null))[_0x6def('0x25')](handleError(_0x31db07,null));};var utilLicense=require(_0x6def('0x15'));exports['getPreferred']=function(_0x5d6b5a,_0xb44017,_0x1bb34c){var _0x4800f9=_0x6def('0x69');var _0x29818c={'custom':![]};return utilLicense[_0x6def('0x6a')]()['then'](function(_0x39803f){if(_0x39803f){_0x29818c=_0x39803f;}return db[_0x6def('0x36')][_0x6def('0x4f')]({'where':{'id':_0x5d6b5a['params']['id']},'attributes':[_0x6def('0x56'),_0x6def('0x57'),_0x6def('0x58'),_0x6def('0x59'),_0x6def('0x5a'),_0x6def('0x5b'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x6def('0x1a')](handleEntityNotFound(_0xb44017,null))[_0x6def('0x1a')](function(_0x52669a){if(_0x52669a){var _0x1e911b=_0x52669a[_0x6def('0x58')]&&fs[_0x6def('0x5d')](path['join'](config[_0x6def('0x5f')],_0x4800f9,_[_0x6def('0x60')](_0x52669a[_0x6def('0x58')])))?path[_0x6def('0x5e')](config[_0x6def('0x5f')],_0x4800f9,_[_0x6def('0x60')](_0x52669a[_0x6def('0x58')])):path['join'](config[_0x6def('0x5f')],_0x4800f9,_['toLower'](_0x6def('0x70')));var _0x50e80f=_0x6def('0x62')+_['upperFirst'](_0x6def('0x58'));if(_0x52669a[_0x50e80f]||!_0x29818c[_0x6def('0x64')]||!_0x29818c[_0x6def('0x58')]){_0x1e911b=path[_0x6def('0x5e')](config['root'],_0x4800f9,_[_0x6def('0x60')]('default_preferred.png'));}if(!fs[_0x6def('0x5d')](_0x1e911b)){throw new db[(_0x6def('0x65'))][(_0x6def('0x6c'))](_['upperFirst'](_0x6def('0x58'))+'\x20not\x20found');}return _0xb44017['download'](_0x1e911b);}})[_0x6def('0x25')](handleError(_0xb44017,null));};exports['addFavicon']=function(_0x29d45b,_0x1d67b9,_0x2e2fd8){if(_0x29d45b[_0x6def('0x52')]&&_0x29d45b[_0x6def('0x52')]['filename']){_0x29d45b[_0x6def('0x50')]['favicon']=_0x29d45b[_0x6def('0x52')]['filename'];}return db[_0x6def('0x36')]['find']({'where':{'id':_0x29d45b[_0x6def('0x4d')]['id']}})[_0x6def('0x1a')](handleEntityNotFound(_0x1d67b9,null))['then'](saveUpdates(_0x29d45b[_0x6def('0x50')],null))['then'](respondWithResult(_0x1d67b9,null))[_0x6def('0x25')](handleError(_0x1d67b9,null));};var utilLicense=require(_0x6def('0x15'));exports[_0x6def('0x71')]=function(_0x1bf1bf,_0x59cc59,_0x43d142){var _0x21178d=_0x6def('0x69');var _0x4faa6f={'custom':![]};return utilLicense[_0x6def('0x6a')]()['then'](function(_0x5e4b53){if(_0x5e4b53){_0x4faa6f=_0x5e4b53;}return db[_0x6def('0x36')][_0x6def('0x4f')]({'where':{'id':_0x1bf1bf['params']['id']},'attributes':[_0x6def('0x56'),'loginLogo',_0x6def('0x58'),'favicon',_0x6def('0x5a'),_0x6def('0x5b'),_0x6def('0x5c'),_0x6def('0x72')],'raw':!![]});})['then'](handleEntityNotFound(_0x59cc59,null))[_0x6def('0x1a')](function(_0x392253){if(_0x392253){var _0x2ca6b4=_0x392253['favicon']&&fs[_0x6def('0x5d')](path[_0x6def('0x5e')](config[_0x6def('0x5f')],_0x21178d,_[_0x6def('0x60')](_0x392253[_0x6def('0x59')])))?path[_0x6def('0x5e')](config[_0x6def('0x5f')],_0x21178d,_['toLower'](_0x392253[_0x6def('0x59')])):path['join'](config[_0x6def('0x5f')],_0x21178d,_[_0x6def('0x60')]('default_favicon.ico'));var _0x2e6582=_0x6def('0x62')+_[_0x6def('0x63')](_0x6def('0x59'));if(_0x392253[_0x2e6582]||!_0x4faa6f[_0x6def('0x64')]){_0x2ca6b4=path[_0x6def('0x5e')](config['root'],_0x21178d,_[_0x6def('0x60')](_0x6def('0x73')));}if(!fs[_0x6def('0x5d')](_0x2ca6b4)){throw new db['Sequelize'][(_0x6def('0x6c'))](_[_0x6def('0x63')]('favicon')+_0x6def('0x66'));}return _0x59cc59[_0x6def('0x67')](_0x2ca6b4);}})[_0x6def('0x25')](handleError(_0x59cc59,null));};exports[_0x6def('0x74')]=function(_0x3f9f05,_0x41dd6f){var _0x5f6d51={'offset':moment()[_0x6def('0x75')]()};_0x5f6d51[_0x6def('0x76')]=moment()[_0x6def('0x75')](_0x5f6d51['offset'])[_0x6def('0x77')](_0x6def('0x78'));return _0x41dd6f[_0x6def('0x27')](0xc8)[_0x6def('0x33')](_0x5f6d51);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 5254cbc..68822fd 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(_0x3d9557,_0x5d09d2){var _0x359ff8=function(_0x784fa){while(--_0x784fa){_0x3d9557['push'](_0x3d9557['shift']());}};_0x359ff8(++_0x5d09d2);}(_0x3e74,0x175));var _0x43e7=function(_0x4df18b,_0x59328e){_0x4df18b=_0x4df18b-0x0;var _0x1999df=_0x3e74[_0x4df18b];return _0x1999df;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x7c9511,_0x2b4684){var _0x3d1a50=function(_0x9153fe){while(--_0x9153fe){_0x7c9511['push'](_0x7c9511['shift']());}};_0x3d1a50(++_0x2b4684);}(_0xedd9,0xfc));var _0x9edd=function(_0xb2b0eb,_0x57575c){_0xb2b0eb=_0xb2b0eb-0x0;var _0x31f77e=_0xedd9[_0xb2b0eb];return _0x31f77e;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 3a0c094..a22fa79 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 _0x5997=['http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSetting','Setting','find','options','raw','attributes','map','include','model','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x5997,0xd1));var _0x7599=function(_0xe18fa2,_0xf60741){_0xe18fa2=_0xe18fa2-0x0;var _0x41f8c9=_0x5997[_0xe18fa2];return _0x41f8c9;};'use strict';var _=require(_0x7599('0x0'));var util=require(_0x7599('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7599('0x2'));var db=require(_0x7599('0x3'))['db'];var utils=require(_0x7599('0x4'));var logger=require(_0x7599('0x5'))('rpc');var config=require(_0x7599('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7599('0x7')][_0x7599('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5cc150,_0x563aac,_0x1e5e6f){return new BPromise(function(_0x5c452f,_0x1792cb){return client[_0x7599('0x9')](_0x5cc150,_0x1e5e6f)[_0x7599('0xa')](function(_0x360c71){logger[_0x7599('0xb')](_0x7599('0xc'),_0x563aac,_0x7599('0xd'));logger[_0x7599('0xe')](_0x7599('0xf'),_0x563aac,_0x7599('0xd'),JSON[_0x7599('0x10')](_0x360c71));if(_0x360c71[_0x7599('0x11')]){if(_0x360c71[_0x7599('0x11')][_0x7599('0x12')]===0x1f4){logger[_0x7599('0x11')](_0x7599('0xc'),_0x563aac,_0x360c71[_0x7599('0x11')][_0x7599('0x13')]);return _0x1792cb(_0x360c71['error']['message']);}logger[_0x7599('0x11')](_0x7599('0xc'),_0x563aac,_0x360c71[_0x7599('0x11')][_0x7599('0x13')]);return _0x5c452f(_0x360c71[_0x7599('0x11')][_0x7599('0x13')]);}else{logger[_0x7599('0xb')](_0x7599('0xc'),_0x563aac,_0x7599('0xd'));_0x5c452f(_0x360c71[_0x7599('0x14')][_0x7599('0x13')]);}})[_0x7599('0x15')](function(_0x594905){logger[_0x7599('0x11')](_0x7599('0xc'),_0x563aac,_0x594905);_0x1792cb(_0x594905);});});}exports[_0x7599('0x16')]=function(_0x2a0c0a){var _0x4ef596=this;return new Promise(function(_0x18bd90,_0xd4657){return db[_0x7599('0x17')][_0x7599('0x18')]({'raw':_0x2a0c0a[_0x7599('0x19')]?_0x2a0c0a[_0x7599('0x19')][_0x7599('0x1a')]===undefined?!![]:![]:!![],'where':_0x2a0c0a['options']?_0x2a0c0a[_0x7599('0x19')]['where']||null:null,'attributes':_0x2a0c0a['options']?_0x2a0c0a[_0x7599('0x19')][_0x7599('0x1b')]||null:null,'include':_0x2a0c0a['options']?_0x2a0c0a[_0x7599('0x19')]['include']?_[_0x7599('0x1c')](_0x2a0c0a[_0x7599('0x19')][_0x7599('0x1d')],function(_0x29f1a6){return{'model':db[_0x29f1a6[_0x7599('0x1e')]],'as':_0x29f1a6['as'],'attributes':_0x29f1a6[_0x7599('0x1b')],'include':_0x29f1a6[_0x7599('0x1d')]?_['map'](_0x29f1a6[_0x7599('0x1d')],function(_0x48a1c2){return{'model':db[_0x48a1c2['model']],'as':_0x48a1c2['as'],'attributes':_0x48a1c2[_0x7599('0x1b')],'include':_0x48a1c2[_0x7599('0x1d')]?_[_0x7599('0x1c')](_0x48a1c2['include'],function(_0x168b42){return{'model':db[_0x168b42['model']],'as':_0x168b42['as'],'attributes':_0x168b42[_0x7599('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb6c391){logger[_0x7599('0xb')](_0x7599('0x16'),_0x2a0c0a);logger[_0x7599('0xe')](_0x7599('0x16'),_0x2a0c0a,JSON[_0x7599('0x10')](_0xb6c391));_0x18bd90(_0xb6c391);})[_0x7599('0x15')](function(_0x513601){logger[_0x7599('0x11')](_0x7599('0x16'),_0x513601['message'],_0x2a0c0a);_0xd4657(_0x4ef596[_0x7599('0x11')](0x1f4,_0x513601['message']));});});}; \ No newline at end of file +var _0xa94c=['ShowSetting','Setting','find','options','raw','attributes','map','include','model','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','http','request','info','Setting,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch'];(function(_0x3d92bf,_0xbf4cdf){var _0x460466=function(_0x466a10){while(--_0x466a10){_0x3d92bf['push'](_0x3d92bf['shift']());}};_0x460466(++_0xbf4cdf);}(_0xa94c,0x10f));var _0xca94=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xa94c[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0xca94('0x0'));var util=require(_0xca94('0x1'));var moment=require(_0xca94('0x2'));var BPromise=require(_0xca94('0x3'));var rs=require(_0xca94('0x4'));var fs=require('fs');var Redis=require(_0xca94('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xca94('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xca94('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xca94('0x8')][_0xca94('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3df4a0,_0x252549,_0x3dddec){return new BPromise(function(_0x1a089a,_0x32501e){return client[_0xca94('0xa')](_0x3df4a0,_0x3dddec)['then'](function(_0x39e025){logger[_0xca94('0xb')](_0xca94('0xc'),_0x252549,'request\x20sent');logger[_0xca94('0xd')]('Setting,\x20%s,\x20%s,\x20%s',_0x252549,_0xca94('0xe'),JSON['stringify'](_0x39e025));if(_0x39e025[_0xca94('0xf')]){if(_0x39e025[_0xca94('0xf')]['code']===0x1f4){logger[_0xca94('0xf')]('Setting,\x20%s,\x20%s',_0x252549,_0x39e025[_0xca94('0xf')][_0xca94('0x10')]);return _0x32501e(_0x39e025[_0xca94('0xf')][_0xca94('0x10')]);}logger['error']('Setting,\x20%s,\x20%s',_0x252549,_0x39e025[_0xca94('0xf')]['message']);return _0x1a089a(_0x39e025[_0xca94('0xf')][_0xca94('0x10')]);}else{logger[_0xca94('0xb')](_0xca94('0xc'),_0x252549,'request\x20sent');_0x1a089a(_0x39e025[_0xca94('0x11')]['message']);}})[_0xca94('0x12')](function(_0x40afa1){logger['error'](_0xca94('0xc'),_0x252549,_0x40afa1);_0x32501e(_0x40afa1);});});}exports[_0xca94('0x13')]=function(_0x6fef8d){var _0x414430=this;return new Promise(function(_0x394c60,_0x36ce56){return db[_0xca94('0x14')][_0xca94('0x15')]({'raw':_0x6fef8d['options']?_0x6fef8d[_0xca94('0x16')][_0xca94('0x17')]===undefined?!![]:![]:!![],'where':_0x6fef8d[_0xca94('0x16')]?_0x6fef8d[_0xca94('0x16')]['where']||null:null,'attributes':_0x6fef8d[_0xca94('0x16')]?_0x6fef8d[_0xca94('0x16')][_0xca94('0x18')]||null:null,'include':_0x6fef8d[_0xca94('0x16')]?_0x6fef8d[_0xca94('0x16')]['include']?_[_0xca94('0x19')](_0x6fef8d['options'][_0xca94('0x1a')],function(_0x488cca){return{'model':db[_0x488cca[_0xca94('0x1b')]],'as':_0x488cca['as'],'attributes':_0x488cca[_0xca94('0x18')],'include':_0x488cca['include']?_[_0xca94('0x19')](_0x488cca['include'],function(_0x2c25c6){return{'model':db[_0x2c25c6['model']],'as':_0x2c25c6['as'],'attributes':_0x2c25c6[_0xca94('0x18')],'include':_0x2c25c6[_0xca94('0x1a')]?_[_0xca94('0x19')](_0x2c25c6['include'],function(_0x5ad9be){return{'model':db[_0x5ad9be['model']],'as':_0x5ad9be['as'],'attributes':_0x5ad9be[_0xca94('0x18')]};}):[]};}):[]};}):[]:[]})[_0xca94('0x1c')](function(_0x20c28c){logger[_0xca94('0xb')]('ShowSetting',_0x6fef8d);logger['debug']('ShowSetting',_0x6fef8d,JSON['stringify'](_0x20c28c));_0x394c60(_0x20c28c);})[_0xca94('0x12')](function(_0x13ef21){logger[_0xca94('0xf')](_0xca94('0x13'),_0x13ef21[_0xca94('0x10')],_0x6fef8d);_0x36ce56(_0x414430[_0xca94('0xf')](0x1f4,_0x13ef21[_0xca94('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index aded525..21708b3 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 _0x5fc3=['/:id','show','getDispositions','/:id/canned_answers','/:id/applications','getInteractions','/:id/status','statusGet','post','create','/:id/dispositions','addAnswer','/:id/notify','/:id/send','send','status','/:id/users','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','describe'];(function(_0x7eaa6b,_0x29c3c7){var _0x5bcd23=function(_0x379d14){while(--_0x379d14){_0x7eaa6b['push'](_0x7eaa6b['shift']());}};_0x5bcd23(++_0x29c3c7);}(_0x5fc3,0xa8));var _0x35fc=function(_0x257a28,_0x2cd00d){_0x257a28=_0x257a28-0x0;var _0x13bccc=_0x5fc3[_0x257a28];return _0x13bccc;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/dispositions',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getAnswers']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getApplications']);router[_0x35fc('0x9')]('/:id/interactions',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router[_0x35fc('0x9')](_0x35fc('0x12'),controller[_0x35fc('0x13')]);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x14')]('/',auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x14')](_0x35fc('0x16'),auth[_0x35fc('0xa')](),controller['addDisposition']);router[_0x35fc('0x14')](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x14')](_0x35fc('0x18'),controller['notify']);router[_0x35fc('0x14')](_0x35fc('0x10'),auth[_0x35fc('0xa')](),controller['addApplications']);router[_0x35fc('0x14')](_0x35fc('0x19'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x1a')]);router[_0x35fc('0x14')](_0x35fc('0x12'),controller[_0x35fc('0x1b')]);router[_0x35fc('0x14')](_0x35fc('0x1c'),auth[_0x35fc('0xa')](),controller['addAgents']);router[_0x35fc('0x1d')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x1e')]);router[_0x35fc('0x1f')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x20')]);router['delete'](_0x35fc('0x16'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x21')]);router['delete'](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x22')]);router[_0x35fc('0x1f')]('/:id/users',auth['isAuthenticated'](),controller[_0x35fc('0x23')]);module['exports']=router; \ No newline at end of file +var _0x8ef6=['addApplications','/:id/send','send','status','update','delete','destroy','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/status','statusGet','/:id/users','getAgents','create','post','addDisposition','addAnswer','notify'];(function(_0x56e628,_0x539cdb){var _0x225aec=function(_0x1b1406){while(--_0x1b1406){_0x56e628['push'](_0x56e628['shift']());}};_0x225aec(++_0x539cdb);}(_0x8ef6,0xf2));var _0x68ef=function(_0x5935a2,_0x36cf27){_0x5935a2=_0x5935a2-0x0;var _0x1a39a8=_0x8ef6[_0x5935a2];return _0x1a39a8;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var fs_extra=require(_0x68ef('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var controller=require(_0x68ef('0x9'));router[_0x68ef('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x68ef('0xa')](_0x68ef('0xb'),auth[_0x68ef('0xc')](),controller['describe']);router[_0x68ef('0xa')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0xe')]);router[_0x68ef('0xa')](_0x68ef('0xf'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x10')]);router[_0x68ef('0xa')](_0x68ef('0x11'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x12')]);router['get'](_0x68ef('0x13'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x14')]);router[_0x68ef('0xa')](_0x68ef('0x15'),auth[_0x68ef('0xc')](),controller['getInteractions']);router[_0x68ef('0xa')](_0x68ef('0x16'),controller[_0x68ef('0x17')]);router['get'](_0x68ef('0x18'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x19')]);router['post']('/',auth[_0x68ef('0xc')](),controller[_0x68ef('0x1a')]);router[_0x68ef('0x1b')](_0x68ef('0xf'),auth['isAuthenticated'](),controller[_0x68ef('0x1c')]);router['post']('/:id/canned_answers',auth[_0x68ef('0xc')](),controller[_0x68ef('0x1d')]);router['post']('/:id/notify',controller[_0x68ef('0x1e')]);router[_0x68ef('0x1b')](_0x68ef('0x13'),auth['isAuthenticated'](),controller[_0x68ef('0x1f')]);router[_0x68ef('0x1b')](_0x68ef('0x20'),auth['isAuthenticated'](),controller[_0x68ef('0x21')]);router[_0x68ef('0x1b')]('/:id/status',controller[_0x68ef('0x22')]);router[_0x68ef('0x1b')](_0x68ef('0x18'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x23')]);router[_0x68ef('0x24')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x25')]);router[_0x68ef('0x24')](_0x68ef('0xf'),auth[_0x68ef('0xc')](),controller['removeDispositions']);router[_0x68ef('0x24')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0x68ef('0x24')](_0x68ef('0x18'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x26')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 08385e0..14d9180 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 _0xa089=['intelepeer','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','ENUM','twilio','skebby','connectel','clicksend','clickatell','bandwidth','csc','infobip'];(function(_0x1c3df1,_0x248f7d){var _0x4650b0=function(_0x123ba1){while(--_0x123ba1){_0x1c3df1['push'](_0x1c3df1['shift']());}};_0x4650b0(++_0x248f7d);}(_0xa089,0xc1));var _0x9a08=function(_0x519680,_0x3c8407){_0x519680=_0x519680-0x0;var _0x28c5f5=_0xa089[_0x519680];return _0x28c5f5;};'use strict';var Sequelize=require(_0x9a08('0x0'));var rs=require(_0x9a08('0x1'));module[_0x9a08('0x2')]={'name':{'type':Sequelize[_0x9a08('0x3')],'unique':_0x9a08('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x9a08('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x9a08('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x9a08('0x3')]},'type':{'type':Sequelize[_0x9a08('0x5')](_0x9a08('0x6'),_0x9a08('0x7'),_0x9a08('0x8'),_0x9a08('0x9'),'plivo',_0x9a08('0xa'),_0x9a08('0xb'),_0x9a08('0xc'),_0x9a08('0xd'),_0x9a08('0xe'))},'accountSid':{'type':Sequelize[_0x9a08('0x3')]},'authId':{'type':Sequelize[_0x9a08('0x3')]},'authToken':{'type':Sequelize[_0x9a08('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x9a08('0x3')]},'apiKey':{'type':Sequelize[_0x9a08('0x3')]},'applicationId':{'type':Sequelize[_0x9a08('0x3')]},'accountId':{'type':Sequelize[_0x9a08('0x3')]},'senderString':{'type':Sequelize[_0x9a08('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x9a08('0xf')],'defaultValue':function(){return _0x9a08('0x10');}},'notificationSound':{'type':Sequelize[_0x9a08('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9a08('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9a08('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9a08('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x9a08('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9a08('0x12')],'comment':_0x9a08('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x9a08('0x11')],'defaultValue':![],'comment':_0x9a08('0x14'),'set':function(_0x357306){if(!_0x357306)this[_0x9a08('0x15')]('mandatoryDispositionPauseId',null);this[_0x9a08('0x15')](_0x9a08('0x16'),_0x357306);}}}; \ No newline at end of file +var _0xf0c8=['connectel','clicksend','plivo','clickatell','bandwidth','infobip','intelepeer','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','skebby'];(function(_0x19c44d,_0x3d9d02){var _0x20a79e=function(_0x22fb08){while(--_0x22fb08){_0x19c44d['push'](_0x19c44d['shift']());}};_0x20a79e(++_0x3d9d02);}(_0xf0c8,0x1dc));var _0x8f0c=function(_0x20f96d,_0x23e67f){_0x20f96d=_0x20f96d-0x0;var _0x9a7524=_0xf0c8[_0x20f96d];return _0x9a7524;};'use strict';var Sequelize=require(_0x8f0c('0x0'));var rs=require(_0x8f0c('0x1'));module[_0x8f0c('0x2')]={'name':{'type':Sequelize[_0x8f0c('0x3')],'unique':_0x8f0c('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x8f0c('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x8f0c('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x8f0c('0x5')]();}},'phone':{'type':Sequelize[_0x8f0c('0x3')]},'type':{'type':Sequelize[_0x8f0c('0x6')]('twilio',_0x8f0c('0x7'),_0x8f0c('0x8'),_0x8f0c('0x9'),_0x8f0c('0xa'),_0x8f0c('0xb'),_0x8f0c('0xc'),'csc',_0x8f0c('0xd'),_0x8f0c('0xe'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x8f0c('0x3')]},'authToken':{'type':Sequelize[_0x8f0c('0x3')]},'smsMethod':{'type':Sequelize[_0x8f0c('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x8f0c('0x3')]},'password':{'type':Sequelize[_0x8f0c('0x3')]},'apiKey':{'type':Sequelize[_0x8f0c('0x3')]},'applicationId':{'type':Sequelize[_0x8f0c('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x8f0c('0x3')]},'deliveryReport':{'type':Sequelize[_0x8f0c('0xf')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x8f0c('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8f0c('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8f0c('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8f0c('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8f0c('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8f0c('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x8f0c('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x8f0c('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x8f0c('0xf')],'defaultValue':![],'comment':_0x8f0c('0x13'),'set':function(_0x5159f3){if(!_0x5159f3)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x8f0c('0x14')](_0x8f0c('0x15'),_0x5159f3);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index f1db5f6..4d262d3 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 _0xe07a=['User','unshift','waitForTheAssignedAgent','Start','startRouting','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','send','\x0a','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','bulkCreate','findAndCountAll','finally','getApplications','nolimit','Contact','Owner','fullname','Tags','color','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','skebby_dispatch_id','SmsMessage','statusInt','requestid','status_code','groupName','redif','DELIVERED','inspect','error_code','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','message-id','state','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','client','http','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','get','UserProfileResource','destroy','name','index','map','SmsAccount','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','Pause','mandatoryDispositionPause','rawAttributes','find','create','body','role','user','SmsAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','notify','sms','Applications','applications','orderBy','priority','asc','account','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','from','From','Body','messageId','MessageSid','skebby','text','connectel','clicksend','message_id','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','isNil','from\x20is\x20mandatory','Sequelize','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','DESC','omit','Contacts','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId'];(function(_0x144e4d,_0x4e1ba5){var _0x11ee95=function(_0x92036e){while(--_0x92036e){_0x144e4d['push'](_0x144e4d['shift']());}};_0x11ee95(++_0x4e1ba5);}(_0xe07a,0x11c));var _0xae07=function(_0x6dab19,_0x359648){_0x6dab19=_0x6dab19-0x0;var _0x197e02=_0xe07a[_0x6dab19];return _0x197e02;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xae07('0x0'));var zipdir=require(_0xae07('0x1'));var jsonpatch=require(_0xae07('0x2'));var rp=require('request-promise');var moment=require(_0xae07('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xae07('0x4'));var util=require(_0xae07('0x5'));var path=require(_0xae07('0x6'));var sox=require(_0xae07('0x7'));var csv=require(_0xae07('0x8'));var ejs=require(_0xae07('0x9'));var fs=require('fs');var fs_extra=require(_0xae07('0xa'));var _=require(_0xae07('0xb'));var squel=require('squel');var crypto=require(_0xae07('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xae07('0xd'));var toCsv=require(_0xae07('0x8'));var querystring=require(_0xae07('0xe'));var Papa=require(_0xae07('0xf'));var Redis=require(_0xae07('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xae07('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae07('0x12'));var logger=require(_0xae07('0x13'))('api');var utils=require(_0xae07('0x14'));var config=require(_0xae07('0x15'));var licenseUtil=require(_0xae07('0x16'));var db=require('../../mysqldb')['db'];config[_0xae07('0x17')]=_[_0xae07('0x18')](config['redis'],{'host':_0xae07('0x19'),'port':0x18eb});var socket=require(_0xae07('0x1a'))(new Redis(config[_0xae07('0x17')]));require(_0xae07('0x1b'))[_0xae07('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0xae07('0x1d')][_0xae07('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x3af72b,_0x4b7828,_0x332117,_0x244009){return new BPromise(function(_0x1b4edc,_0x489ea1){var _0x44e37f=_0x244009||client;return _0x44e37f[_0xae07('0x1f')](_0x3af72b,_0x332117)[_0xae07('0x20')](function(_0xabcb79){logger['info'](_0xae07('0x21'),_0x4b7828,_0xae07('0x22'));logger[_0xae07('0x23')](_0xae07('0x24'),_0x4b7828,_0xae07('0x22'),JSON[_0xae07('0x25')](_0xabcb79));if(_0xabcb79[_0xae07('0x26')]){if(_0xabcb79['error']['code']===0x1f4){logger[_0xae07('0x26')](_0xae07('0x21'),_0x4b7828,_0xabcb79['error']['message']);return _0x489ea1(_0xabcb79['error'][_0xae07('0x27')]);}logger[_0xae07('0x26')](_0xae07('0x21'),_0x4b7828,_0xabcb79[_0xae07('0x26')][_0xae07('0x27')]);return _0x1b4edc(_0xabcb79[_0xae07('0x26')]['message']);}else{logger[_0xae07('0x28')](_0xae07('0x21'),_0x4b7828,_0xae07('0x22'));_0x1b4edc(_0xabcb79[_0xae07('0x29')][_0xae07('0x27')]);}})[_0xae07('0x2a')](function(_0x2b3d2f){logger[_0xae07('0x26')](_0xae07('0x21'),_0x4b7828,_0x2b3d2f);_0x489ea1(_0x2b3d2f);});});}function respondWithStatusCode(_0x36d6f8,_0x2ddeaf){_0x2ddeaf=_0x2ddeaf||0xcc;return function(_0x366b8d){if(_0x366b8d){return _0x36d6f8[_0xae07('0x2b')](_0x2ddeaf);}return _0x36d6f8[_0xae07('0x2c')](_0x2ddeaf)[_0xae07('0x2d')]();};}function respondWithResult(_0x2315cb,_0x3f8264){_0x3f8264=_0x3f8264||0xc8;return function(_0x46e829){if(_0x46e829){return _0x2315cb[_0xae07('0x2c')](_0x3f8264)['json'](_0x46e829);}};}function respondWithFilteredResult(_0x10390c,_0x45ed78){return function(_0x324be3){if(_0x324be3){var _0x3aa149=typeof _0x45ed78[_0xae07('0x2e')]===_0xae07('0x2f')&&typeof _0x45ed78[_0xae07('0x30')]===_0xae07('0x2f');var _0x379aaf=_0x324be3['count'];var _0x1c4d01=_0x3aa149?0x0:_0x45ed78[_0xae07('0x2e')];var _0x4d1916=_0x3aa149?_0x324be3[_0xae07('0x31')]:_0x45ed78[_0xae07('0x2e')]+_0x45ed78[_0xae07('0x30')];var _0x8d5fcd;if(_0x4d1916>=_0x379aaf){_0x4d1916=_0x379aaf;_0x8d5fcd=0xc8;}else{_0x8d5fcd=0xce;}_0x10390c[_0xae07('0x2c')](_0x8d5fcd);return _0x10390c[_0xae07('0x32')](_0xae07('0x33'),_0x1c4d01+'-'+_0x4d1916+'/'+_0x379aaf)[_0xae07('0x34')](_0x324be3);}return null;};}function patchUpdates(_0x4ea9b7){return function(_0x2393f9){try{jsonpatch[_0xae07('0x35')](_0x2393f9,_0x4ea9b7,!![]);}catch(_0x5e6605){return BPromise[_0xae07('0x36')](_0x5e6605);}return _0x2393f9[_0xae07('0x37')]();};}function saveUpdates(_0x2d00c6,_0x4a473f){return function(_0x12b9fc){if(_0x12b9fc){return _0x12b9fc['update'](_0x2d00c6)[_0xae07('0x20')](function(_0x3688a8){return _0x3688a8;});}return null;};}function removeEntity(_0x38c919,_0x245f29){return function(_0x450a1d){if(_0x450a1d){return _0x450a1d['destroy']()[_0xae07('0x20')](function(){var _0x1c2db9=_0x450a1d[_0xae07('0x38')]({'plain':!![]});var _0x4a4a75='SmsAccounts';return db[_0xae07('0x39')][_0xae07('0x3a')]({'where':{'type':_0x4a4a75,'resourceId':_0x1c2db9['id']}})[_0xae07('0x20')](function(){return _0x450a1d;});})[_0xae07('0x20')](function(){_0x38c919[_0xae07('0x2c')](0xcc)[_0xae07('0x2d')]();});}};}function handleEntityNotFound(_0x5b3eeb,_0x5c4f2e){return function(_0x4e1ee3){if(!_0x4e1ee3){_0x5b3eeb[_0xae07('0x2b')](0x194);}return _0x4e1ee3;};}function handleError(_0x1d4df1,_0x2782f0){_0x2782f0=_0x2782f0||0x1f4;return function(_0xd6efb2){logger['error'](_0xd6efb2['stack']);if(_0xd6efb2[_0xae07('0x3b')]){delete _0xd6efb2[_0xae07('0x3b')];}_0x1d4df1[_0xae07('0x2c')](_0x2782f0)['send'](_0xd6efb2);};}exports[_0xae07('0x3c')]=function(_0x1fe546,_0x4df31b){var _0x48e02a={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x22b9d3={},_0x245733={'count':0x0,'rows':[]};var _0x667842=_[_0xae07('0x3d')](db[_0xae07('0x3e')]['rawAttributes'],function(_0x33b540){return{'name':_0x33b540[_0xae07('0x3f')],'type':_0x33b540[_0xae07('0x40')][_0xae07('0x41')]};});_0x22b9d3[_0xae07('0x42')]=_[_0xae07('0x3d')](_0x667842,_0xae07('0x3b'));_0x22b9d3[_0xae07('0x43')]=_[_0xae07('0x44')](_0x1fe546[_0xae07('0x43')]);_0x22b9d3[_0xae07('0x45')]=_[_0xae07('0x46')](_0x22b9d3[_0xae07('0x42')],_0x22b9d3[_0xae07('0x43')]);_0x48e02a['attributes']=_[_0xae07('0x46')](_0x22b9d3['model'],qs['fields'](_0x1fe546[_0xae07('0x43')][_0xae07('0x47')]));_0x48e02a[_0xae07('0x48')]=_0x48e02a[_0xae07('0x48')][_0xae07('0x49')]?_0x48e02a[_0xae07('0x48')]:_0x22b9d3[_0xae07('0x42')];if(!_0x1fe546[_0xae07('0x43')][_0xae07('0x4a')]('nolimit')){_0x48e02a[_0xae07('0x30')]=qs[_0xae07('0x30')](_0x1fe546[_0xae07('0x43')][_0xae07('0x30')]);_0x48e02a['offset']=qs['offset'](_0x1fe546[_0xae07('0x43')][_0xae07('0x2e')]);}_0x48e02a[_0xae07('0x4b')]=qs[_0xae07('0x4c')](_0x1fe546[_0xae07('0x43')][_0xae07('0x4c')]);_0x48e02a['where']=qs[_0xae07('0x45')](_[_0xae07('0x4d')](_0x1fe546[_0xae07('0x43')],_0x22b9d3[_0xae07('0x45')]),_0x667842);if(_0x1fe546['query'][_0xae07('0x4e')]){_0x48e02a[_0xae07('0x4f')]=_[_0xae07('0x50')](_0x48e02a['where'],{'$or':_[_0xae07('0x3d')](_0x667842,function(_0x1ed7c7){if(_0x1ed7c7['type']!==_0xae07('0x51')){var _0x11b83e={};_0x11b83e[_0x1ed7c7['name']]={'$like':'%'+_0x1fe546[_0xae07('0x43')][_0xae07('0x4e')]+'%'};return _0x11b83e;}})});}_0x48e02a=_[_0xae07('0x50')]({},_0x48e02a,_0x1fe546[_0xae07('0x52')]);var _0xaa72c6={'where':_0x48e02a[_0xae07('0x4f')]};return db[_0xae07('0x3e')]['count'](_0xaa72c6)[_0xae07('0x20')](function(_0x428f57){_0x245733['count']=_0x428f57;if(_0x1fe546[_0xae07('0x43')][_0xae07('0x53')]){_0x48e02a[_0xae07('0x54')]=[{'all':!![]}];}return db[_0xae07('0x3e')][_0xae07('0x55')](_0x48e02a);})['then'](function(_0x3c0f49){_0x245733[_0xae07('0x56')]=_0x3c0f49;return _0x245733;})[_0xae07('0x20')](respondWithFilteredResult(_0x4df31b,_0x48e02a))[_0xae07('0x2a')](handleError(_0x4df31b,null));};exports[_0xae07('0x57')]=function(_0x2186b9,_0x19a3e5){var _0x37113f={'raw':![],'where':{'id':_0x2186b9['params']['id']},'include':[{'model':db[_0xae07('0x58')],'as':_0xae07('0x59')}]},_0x2f3dbe={};_0x2f3dbe[_0xae07('0x42')]=_['keys'](db[_0xae07('0x3e')][_0xae07('0x5a')]);_0x2f3dbe[_0xae07('0x43')]=_[_0xae07('0x44')](_0x2186b9['query']);_0x2f3dbe[_0xae07('0x45')]=_['intersection'](_0x2f3dbe['model'],_0x2f3dbe[_0xae07('0x43')]);_0x37113f[_0xae07('0x48')]=_[_0xae07('0x46')](_0x2f3dbe[_0xae07('0x42')],qs[_0xae07('0x47')](_0x2186b9[_0xae07('0x43')][_0xae07('0x47')]));_0x37113f[_0xae07('0x48')]=_0x37113f['attributes'][_0xae07('0x49')]?_0x37113f[_0xae07('0x48')]:_0x2f3dbe['model'];if(_0x2186b9[_0xae07('0x43')][_0xae07('0x53')]){_0x37113f[_0xae07('0x54')]=[{'all':!![]}];}_0x37113f=_[_0xae07('0x50')]({},_0x37113f,_0x2186b9[_0xae07('0x52')]);return db[_0xae07('0x3e')][_0xae07('0x5b')](_0x37113f)[_0xae07('0x20')](handleEntityNotFound(_0x19a3e5,null))[_0xae07('0x20')](respondWithResult(_0x19a3e5,null))[_0xae07('0x2a')](handleError(_0x19a3e5,null));};exports[_0xae07('0x5c')]=function(_0xdc6a19,_0x55e2d7){return db[_0xae07('0x3e')][_0xae07('0x5c')](_0xdc6a19[_0xae07('0x5d')],{})[_0xae07('0x20')](function(_0x49e3ee){var _0x5e7906=_0xdc6a19['user'][_0xae07('0x38')]({'plain':!![]});if(!_0x5e7906)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e7906[_0xae07('0x5e')]===_0xae07('0x5f')){var _0x527166=_0x49e3ee[_0xae07('0x38')]({'plain':!![]});var _0x229f72=_0xae07('0x60');return db[_0xae07('0x61')][_0xae07('0x5b')]({'where':{'name':_0x229f72,'userProfileId':_0x5e7906[_0xae07('0x62')]},'raw':!![]})['then'](function(_0x3d181){if(_0x3d181&&_0x3d181[_0xae07('0x63')]===0x0){return db[_0xae07('0x39')][_0xae07('0x5c')]({'name':_0x527166['name'],'resourceId':_0x527166['id'],'type':_0x3d181[_0xae07('0x3b')],'sectionId':_0x3d181['id']},{})[_0xae07('0x20')](function(){return _0x49e3ee;});}else{return _0x49e3ee;}})[_0xae07('0x2a')](function(_0x4f35a5){logger[_0xae07('0x26')](_0xae07('0x64'),_0x4f35a5);throw _0x4f35a5;});}return _0x49e3ee;})[_0xae07('0x20')](respondWithResult(_0x55e2d7,0xc9))[_0xae07('0x2a')](handleError(_0x55e2d7,null));};exports[_0xae07('0x65')]=function(_0x3fc763,_0x40e873){if(_0x3fc763['body']['id']){delete _0x3fc763['body']['id'];}return db[_0xae07('0x3e')][_0xae07('0x5b')]({'where':{'id':_0x3fc763[_0xae07('0x66')]['id']},'include':[{'model':db[_0xae07('0x58')],'as':'mandatoryDispositionPause'}]})[_0xae07('0x20')](handleEntityNotFound(_0x40e873,null))[_0xae07('0x20')](saveUpdates(_0x3fc763[_0xae07('0x5d')],null))[_0xae07('0x20')](respondWithResult(_0x40e873,null))['catch'](handleError(_0x40e873,null));};exports[_0xae07('0x3a')]=function(_0x138c1b,_0x384841){return db[_0xae07('0x3e')][_0xae07('0x5b')]({'where':{'id':_0x138c1b[_0xae07('0x66')]['id']}})[_0xae07('0x20')](handleEntityNotFound(_0x384841,null))[_0xae07('0x20')](removeEntity(_0x384841,null))[_0xae07('0x2a')](handleError(_0x384841,null));};exports['describe']=function(_0x288950,_0x314632){return db['SmsAccount'][_0xae07('0x67')]()['then'](respondWithResult(_0x314632,null))['catch'](handleError(_0x314632,null));};exports[_0xae07('0x68')]=function(_0x2570b6,_0x38c17d,_0x1f381a){if(_0x2570b6[_0xae07('0x5d')]['id']){delete _0x2570b6['body']['id'];}return db['SmsAccount'][_0xae07('0x5b')]({'where':{'id':_0x2570b6['params']['id']}})[_0xae07('0x20')](handleEntityNotFound(_0x38c17d,null))['then'](function(_0x57794d){if(_0x57794d){_0x2570b6[_0xae07('0x5d')][_0xae07('0x69')]=_0x57794d['id'];return db[_0xae07('0x6a')][_0xae07('0x5c')](_0x2570b6[_0xae07('0x5d')]);}})[_0xae07('0x20')](respondWithResult(_0x38c17d,null))[_0xae07('0x2a')](handleError(_0x38c17d,null));};exports[_0xae07('0x6b')]=function(_0x30ec30,_0x5a0b57,_0x219552){var _0x496dea={'raw':![],'where':{}};var _0x229d11={};var _0xddb2bd={'count':0x0,'rows':[]};return db['SmsAccount'][_0xae07('0x6c')]({'where':{'id':_0x30ec30[_0xae07('0x66')]['id']}})['then'](handleEntityNotFound(_0x5a0b57,null))[_0xae07('0x20')](function(_0x4ea9ae){if(_0x4ea9ae){_0x229d11[_0xae07('0x42')]=_[_0xae07('0x44')](db[_0xae07('0x6a')][_0xae07('0x5a')]);_0x229d11[_0xae07('0x43')]=_['keys'](_0x30ec30['query']);_0x229d11[_0xae07('0x45')]=_[_0xae07('0x46')](_0x229d11[_0xae07('0x42')],_0x229d11[_0xae07('0x43')]);_0x496dea['attributes']=_[_0xae07('0x46')](_0x229d11[_0xae07('0x42')],qs['fields'](_0x30ec30[_0xae07('0x43')][_0xae07('0x47')]));_0x496dea[_0xae07('0x48')]=_0x496dea[_0xae07('0x48')][_0xae07('0x49')]?_0x496dea[_0xae07('0x48')]:_0x229d11['model'];if(!_0x30ec30[_0xae07('0x43')][_0xae07('0x4a')]('nolimit')){_0x496dea[_0xae07('0x30')]=qs[_0xae07('0x30')](_0x30ec30[_0xae07('0x43')][_0xae07('0x30')]);_0x496dea['offset']=qs[_0xae07('0x2e')](_0x30ec30[_0xae07('0x43')][_0xae07('0x2e')]);}_0x496dea[_0xae07('0x4b')]=qs[_0xae07('0x4c')](_0x30ec30['query'][_0xae07('0x4c')]);_0x496dea[_0xae07('0x4f')]=qs[_0xae07('0x45')](_['pick'](_0x30ec30[_0xae07('0x43')],_0x229d11['filters']));_0x496dea[_0xae07('0x4f')][_0xae07('0x69')]=_0x4ea9ae['id'];if(_0x30ec30[_0xae07('0x43')][_0xae07('0x4e')]){_0x496dea[_0xae07('0x4f')]=_[_0xae07('0x50')](_0x496dea['where'],{'$or':_[_0xae07('0x3d')](_0x496dea[_0xae07('0x48')],function(_0x3b1e18){var _0x22a76f={};_0x22a76f[_0x3b1e18]={'$like':'%'+_0x30ec30[_0xae07('0x43')][_0xae07('0x4e')]+'%'};return _0x22a76f;})});}_0x496dea=_[_0xae07('0x50')]({},_0x496dea,_0x30ec30[_0xae07('0x52')]);return db[_0xae07('0x6a')][_0xae07('0x31')]({'where':_0x496dea[_0xae07('0x4f')]})[_0xae07('0x20')](function(_0xb7aa02){_0xddb2bd[_0xae07('0x31')]=_0xb7aa02;if(_0x30ec30[_0xae07('0x43')]['includeAll']){_0x496dea[_0xae07('0x54')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x496dea);})[_0xae07('0x20')](function(_0x282a01){_0xddb2bd[_0xae07('0x56')]=_0x282a01;return _0xddb2bd;});}})[_0xae07('0x20')](respondWithFilteredResult(_0x5a0b57,_0x496dea))[_0xae07('0x2a')](handleError(_0x5a0b57,null));};exports[_0xae07('0x6d')]=function(_0x3ab545,_0x22f757,_0x2b4e3a){return db[_0xae07('0x3e')][_0xae07('0x5b')]({'where':{'id':_0x3ab545[_0xae07('0x66')]['id']}})[_0xae07('0x20')](handleEntityNotFound(_0x22f757,null))['then'](function(_0x5803a4){if(_0x5803a4){return _0x5803a4['removeDispositions'](_0x3ab545[_0xae07('0x43')]['ids']);}})[_0xae07('0x20')](respondWithStatusCode(_0x22f757,null))[_0xae07('0x2a')](handleError(_0x22f757,null));};exports[_0xae07('0x6e')]=function(_0x3c9e58,_0x335a39,_0x1813ea){if(_0x3c9e58['body']['id']){delete _0x3c9e58[_0xae07('0x5d')]['id'];}return db[_0xae07('0x3e')][_0xae07('0x5b')]({'where':{'id':_0x3c9e58[_0xae07('0x66')]['id']}})[_0xae07('0x20')](handleEntityNotFound(_0x335a39,null))[_0xae07('0x20')](function(_0x52f6c0){if(_0x52f6c0){_0x3c9e58['body'][_0xae07('0x69')]=_0x52f6c0['id'];return db[_0xae07('0x6f')][_0xae07('0x5c')](_0x3c9e58[_0xae07('0x5d')]);}})[_0xae07('0x20')](respondWithResult(_0x335a39,null))[_0xae07('0x2a')](handleError(_0x335a39,null));};exports[_0xae07('0x70')]=function(_0x2f87e8,_0x1cb4c6,_0x51cf97){var _0x4adaf5={'raw':![],'where':{}};var _0x2e77a1={};var _0x4a8699={'count':0x0,'rows':[]};return db[_0xae07('0x3e')]['findOne']({'where':{'id':_0x2f87e8[_0xae07('0x66')]['id']}})[_0xae07('0x20')](handleEntityNotFound(_0x1cb4c6,null))[_0xae07('0x20')](function(_0x55bc7e){if(_0x55bc7e){_0x2e77a1[_0xae07('0x42')]=_[_0xae07('0x44')](db[_0xae07('0x6f')][_0xae07('0x5a')]);_0x2e77a1['query']=_[_0xae07('0x44')](_0x2f87e8[_0xae07('0x43')]);_0x2e77a1[_0xae07('0x45')]=_['intersection'](_0x2e77a1[_0xae07('0x42')],_0x2e77a1[_0xae07('0x43')]);_0x4adaf5['attributes']=_['intersection'](_0x2e77a1[_0xae07('0x42')],qs[_0xae07('0x47')](_0x2f87e8[_0xae07('0x43')][_0xae07('0x47')]));_0x4adaf5[_0xae07('0x48')]=_0x4adaf5[_0xae07('0x48')][_0xae07('0x49')]?_0x4adaf5[_0xae07('0x48')]:_0x2e77a1[_0xae07('0x42')];if(!_0x2f87e8[_0xae07('0x43')][_0xae07('0x4a')]('nolimit')){_0x4adaf5[_0xae07('0x30')]=qs[_0xae07('0x30')](_0x2f87e8['query'][_0xae07('0x30')]);_0x4adaf5[_0xae07('0x2e')]=qs[_0xae07('0x2e')](_0x2f87e8[_0xae07('0x43')][_0xae07('0x2e')]);}_0x4adaf5['order']=qs[_0xae07('0x4c')](_0x2f87e8[_0xae07('0x43')][_0xae07('0x4c')]);_0x4adaf5[_0xae07('0x4f')]=qs[_0xae07('0x45')](_[_0xae07('0x4d')](_0x2f87e8['query'],_0x2e77a1[_0xae07('0x45')]));_0x4adaf5[_0xae07('0x4f')][_0xae07('0x69')]=_0x55bc7e['id'];if(_0x2f87e8[_0xae07('0x43')]['filter']){_0x4adaf5['where']=_[_0xae07('0x50')](_0x4adaf5['where'],{'$or':_[_0xae07('0x3d')](_0x4adaf5['attributes'],function(_0x39879a){var _0xa33349={};_0xa33349[_0x39879a]={'$like':'%'+_0x2f87e8['query']['filter']+'%'};return _0xa33349;})});}_0x4adaf5=_['merge']({},_0x4adaf5,_0x2f87e8[_0xae07('0x52')]);return db[_0xae07('0x6f')][_0xae07('0x31')]({'where':_0x4adaf5[_0xae07('0x4f')]})[_0xae07('0x20')](function(_0x2f32eb){_0x4a8699['count']=_0x2f32eb;if(_0x2f87e8[_0xae07('0x43')][_0xae07('0x53')]){_0x4adaf5['include']=[{'all':!![]}];}return db[_0xae07('0x6f')][_0xae07('0x55')](_0x4adaf5);})[_0xae07('0x20')](function(_0x2c1c75){_0x4a8699[_0xae07('0x56')]=_0x2c1c75;return _0x4a8699;});}})['then'](respondWithFilteredResult(_0x1cb4c6,_0x4adaf5))['catch'](handleError(_0x1cb4c6,null));};exports[_0xae07('0x71')]=function(_0x1befea,_0x1b81a3,_0x4b1268){return db[_0xae07('0x3e')][_0xae07('0x5b')]({'where':{'id':_0x1befea[_0xae07('0x66')]['id']}})[_0xae07('0x20')](handleEntityNotFound(_0x1b81a3,null))[_0xae07('0x20')](function(_0x2d4998){if(_0x2d4998){return _0x2d4998[_0xae07('0x71')](_0x1befea[_0xae07('0x43')][_0xae07('0x72')]);}})['then'](respondWithStatusCode(_0x1b81a3,null))[_0xae07('0x2a')](handleError(_0x1b81a3,null));};exports[_0xae07('0x73')]=function(_0x48d3fc,_0xbc00ca,_0x3bc1b3){var _0x58d0ef={'channel':_0xae07('0x74')};var _0x157a84=[];var _0x1a2c8f=[];var _0x35cc87={};return db[_0xae07('0x3e')][_0xae07('0x5b')]({'where':{'id':_0x48d3fc[_0xae07('0x66')]['id']},'include':[{'model':db['SmsApplication'],'as':_0xae07('0x75')}]})[_0xae07('0x20')](handleEntityNotFound(_0xbc00ca,null))[_0xae07('0x20')](function(_0x2425d6){_0x58d0ef['account']=_0x2425d6;_0x58d0ef[_0xae07('0x76')]=_[_0xae07('0x77')](_0x2425d6[_0xae07('0x75')],[_0xae07('0x78')],[_0xae07('0x79')]);if(_0x58d0ef[_0xae07('0x7a')][_0xae07('0x75')]){delete _0x58d0ef['account'][_0xae07('0x75')];}return db[_0xae07('0x7b')][_0xae07('0x67')]();})[_0xae07('0x20')](function(_0x1b22a1){if(!_0x1b22a1){throw new db['Sequelize'][(_0xae07('0x7c'))](_0xae07('0x7d'));}_0x157a84=_[_0xae07('0x7e')](_[_0xae07('0x44')](_0x1b22a1),[_0xae07('0x7f'),_0xae07('0x80')]);_0x1a2c8f=_['difference'](_[_0xae07('0x44')](_0x1b22a1),[_0xae07('0x7f'),'updatedAt',_0xae07('0x81'),'ListId']);_0x58d0ef[_0xae07('0x5d')]={'mapKey':_0xae07('0x82')};if(_0x58d0ef[_0xae07('0x7a')][_0xae07('0x40')]){switch(_0x58d0ef[_0xae07('0x7a')][_0xae07('0x40')]){case'twilio':_0x58d0ef[_0xae07('0x5d')][_0xae07('0x83')]=_0x48d3fc[_0xae07('0x5d')][_0xae07('0x84')];_0x58d0ef[_0xae07('0x5d')]['body']=_0x48d3fc['body'][_0xae07('0x85')];_0x58d0ef[_0xae07('0x5d')][_0xae07('0x86')]=_0x48d3fc[_0xae07('0x5d')][_0xae07('0x87')];break;case _0xae07('0x88'):_0x58d0ef['body'][_0xae07('0x83')]='+'+_0x48d3fc[_0xae07('0x5d')]['sender'];_0x58d0ef[_0xae07('0x5d')][_0xae07('0x5d')]=_0x48d3fc[_0xae07('0x5d')][_0xae07('0x89')];break;case _0xae07('0x8a'):_0x58d0ef['body'][_0xae07('0x83')]=_0x48d3fc['body'][_0xae07('0x83')];_0x58d0ef[_0xae07('0x5d')][_0xae07('0x5d')]=_0x48d3fc[_0xae07('0x5d')][_0xae07('0x27')];break;case _0xae07('0x8b'):_0x58d0ef[_0xae07('0x5d')][_0xae07('0x83')]=_0x48d3fc['body']['from'];_0x58d0ef[_0xae07('0x5d')][_0xae07('0x5d')]=_0x48d3fc[_0xae07('0x5d')]['body'];_0x58d0ef[_0xae07('0x5d')]['messageId']=_0x48d3fc[_0xae07('0x5d')][_0xae07('0x8c')];break;case'plivo':_0x58d0ef['body'][_0xae07('0x83')]=_0x48d3fc[_0xae07('0x5d')]['From'];_0x58d0ef[_0xae07('0x5d')][_0xae07('0x5d')]=_0x48d3fc[_0xae07('0x5d')]['Text'];_0x58d0ef[_0xae07('0x5d')][_0xae07('0x86')]=_0x48d3fc['body'][_0xae07('0x8d')];break;case _0xae07('0x8e'):_0x58d0ef[_0xae07('0x5d')][_0xae07('0x83')]='+'+_0x48d3fc[_0xae07('0x5d')][_0xae07('0x8f')][0x0][_0xae07('0x83')];_0x58d0ef[_0xae07('0x5d')][_0xae07('0x5d')]=_0x48d3fc[_0xae07('0x5d')][_0xae07('0x8f')][0x0][_0xae07('0x89')];_0x58d0ef[_0xae07('0x5d')][_0xae07('0x86')]=_0x48d3fc['body'][_0xae07('0x8f')][0x0]['messageId'];break;case _0xae07('0x90'):_0x58d0ef[_0xae07('0x5d')][_0xae07('0x83')]=_0x48d3fc['body'][_0xae07('0x91')];_0x58d0ef[_0xae07('0x5d')][_0xae07('0x5d')]=_0x48d3fc[_0xae07('0x5d')][_0xae07('0x92')][_0xae07('0x27')];break;case _0xae07('0x93'):_0x58d0ef[_0xae07('0x5d')]['from']=_0x48d3fc[_0xae07('0x5d')][_0xae07('0x94')];_0x58d0ef[_0xae07('0x5d')]['body']=_0x48d3fc[_0xae07('0x5d')]['text'];_0x58d0ef[_0xae07('0x5d')][_0xae07('0x86')]=_0x48d3fc[_0xae07('0x5d')][_0xae07('0x95')];break;case _0xae07('0x96'):_0x58d0ef[_0xae07('0x5d')][_0xae07('0x86')]=_0x48d3fc[_0xae07('0x5d')][0x0]['message']['id'];_0x58d0ef[_0xae07('0x5d')]['from']=_0x48d3fc[_0xae07('0x5d')][0x0][_0xae07('0x27')][_0xae07('0x83')];_0x58d0ef['body']['body']=_0x48d3fc['body'][0x0][_0xae07('0x27')][_0xae07('0x89')];break;case _0xae07('0x97'):_0x58d0ef[_0xae07('0x5d')][_0xae07('0x83')]=_0x48d3fc[_0xae07('0x5d')][_0xae07('0x83')];_0x58d0ef[_0xae07('0x5d')][_0xae07('0x5d')]=_0x48d3fc[_0xae07('0x5d')][_0xae07('0x27')];_0x58d0ef[_0xae07('0x5d')][_0xae07('0x86')]=_0x48d3fc[_0xae07('0x5d')]['refid'];break;}}if(_0x58d0ef[_0xae07('0x5d')]['id']){delete _0x58d0ef['body']['id'];}if(_[_0xae07('0x98')](_0x58d0ef[_0xae07('0x5d')][_0xae07('0x83')])){throw new db['Sequelize']['ValidationError'](_0xae07('0x99'));}if(_[_0xae07('0x98')](_0x58d0ef['body']['body'])||_0x58d0ef[_0xae07('0x5d')][_0xae07('0x5d')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x58d0ef['body']['mapKey'])){throw new db[(_0xae07('0x9a'))][(_0xae07('0x7c'))](_0xae07('0x9b')+_0x1a2c8f);}if(!_['includes'](_0x1a2c8f,_0x58d0ef[_0xae07('0x5d')][_0xae07('0x9c')])){throw new db['Sequelize'][(_0xae07('0x7c'))](_0xae07('0x9d')+_0x1a2c8f);}_0x35cc87[_0x58d0ef[_0xae07('0x5d')][_0xae07('0x9c')]]=_0x58d0ef[_0xae07('0x5d')][_0xae07('0x83')];return db[_0xae07('0x9e')][_0xae07('0x5b')]({'where':{'id':_0x58d0ef[_0xae07('0x7a')][_0xae07('0x9f')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x35cc87,'limit':0x1,'order':[[_0xae07('0x80'),_0xae07('0xa0')]]}]});})[_0xae07('0x20')](handleEntityNotFound(_0xbc00ca,null))[_0xae07('0x20')](function(_0x386771){if(_0x386771){_0x58d0ef['list']=_[_0xae07('0xa1')](_0x386771,[_0xae07('0xa2')]);if(_0x386771[_0xae07('0xa2')][_0xae07('0x49')]){return _0x386771[_0xae07('0xa2')][0x0];}var _0x479821=_[_0xae07('0x18')](_0x58d0ef[_0xae07('0x5d')],{'firstName':_0x58d0ef['body'][_0xae07('0x83')],'ListId':_0x386771['id']});_0x479821[_0x58d0ef[_0xae07('0x5d')][_0xae07('0x9c')]]=_0x58d0ef[_0xae07('0x5d')][_0xae07('0x83')];return db[_0xae07('0x7b')][_0xae07('0x5c')](_0x479821,{'fields':_0x157a84,'raw':!![]});}})[_0xae07('0x20')](handleEntityNotFound(_0xbc00ca,null))[_0xae07('0x20')](function(_0x47760d){if(_0x47760d){_0x58d0ef[_0xae07('0xa3')]=_0x47760d;var _0x146da9={'ContactId':_0x47760d['id'],'phone':_0x58d0ef[_0xae07('0x5d')]['from'],'SmsAccountId':_0x48d3fc[_0xae07('0x66')]['id']};var _0x77683f={'ContactId':_0x47760d['id'],'SmsAccountId':_0x48d3fc['params']['id'],'closed':![]};return db[_0xae07('0xa4')]['find']({'where':_0x77683f})['then'](function(_0x26e291){if(_0x26e291){return[_0x26e291,![]];}return db['SmsInteraction'][_0xae07('0x5c')](_0x146da9)['then'](function(_0x5a35f3){return[_0x5a35f3,!![]];});});}})[_0xae07('0xa5')](function(_0x18d564,_0x391dcf){_0x58d0ef[_0xae07('0xa6')]=_0x18d564['get']({'plain':!![]});_0x58d0ef['interaction'][_0xae07('0xa7')]=![];if(_0x391dcf){if(_0x58d0ef['account'][_0xae07('0xa8')]){_0x58d0ef[_0xae07('0x76')][_0xae07('0xa9')]({'id':0x0,'priority':_0x58d0ef[_0xae07('0x76')]['length']+0x1,'app':_0xae07('0xaa'),'appdata':_0xae07('0xab'),'interval':_0xae07('0xac')});}_0x58d0ef['interaction'][_0xae07('0xa7')]=!![];}return db['SmsMessage'][_0xae07('0x5c')]({'phone':_0x58d0ef[_0xae07('0x5d')][_0xae07('0x83')],'messageId':_0x58d0ef[_0xae07('0x5d')]['messageId'],'body':_0x58d0ef[_0xae07('0x5d')][_0xae07('0x5d')],'SmsAccountId':_0x48d3fc[_0xae07('0x66')]['id'],'SmsInteractionId':_0x18d564['id'],'direction':'in','ContactId':_0x18d564[_0xae07('0xad')],'AttachmentId':_0x58d0ef[_0xae07('0x5d')][_0xae07('0xae')]});})[_0xae07('0x20')](function(_0x2356a7){_0x58d0ef[_0xae07('0x27')]=_0x2356a7;if(_0x58d0ef[_0xae07('0xa6')][_0xae07('0xaf')]){return db[_0xae07('0xb0')][_0xae07('0x5b')]({'attributes':['id',_0xae07('0x3b')],'where':{'id':_0x58d0ef[_0xae07('0xa6')][_0xae07('0xaf')]}})[_0xae07('0x20')](function(_0x5dd494){if(_0x5dd494){_0x58d0ef[_0xae07('0x76')][_0xae07('0xb1')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5dd494[_0xae07('0x3b')]+','+(_0x58d0ef[_0xae07('0x7a')][_0xae07('0xb2')]||0xa),'interval':_0xae07('0xac')});}return respondWithRpcPromise(_0xae07('0xb3'),_0xae07('0xb4'),_0x58d0ef);});}return respondWithRpcPromise('Start',_0xae07('0xb4'),_0x58d0ef);})[_0xae07('0x20')](function(_0x10f218){if(_0x10f218){var _0x4ac0bf=0xc8;var _0x256c54='receiveMessage';logger[_0xae07('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x256c54,_0x4ac0bf,_0xae07('0xb5'));logger[_0xae07('0x23')](_0xae07('0xb6'),_0x256c54,_0x4ac0bf,_0xae07('0xb5'),JSON[_0xae07('0x25')](_0x10f218));if(_0x58d0ef[_0xae07('0x7a')][_0xae07('0x40')]===_0xae07('0xb7')){return _0xbc00ca[_0xae07('0x2c')](_0x4ac0bf)[_0xae07('0x32')](_0xae07('0xb8'),_0xae07('0xb9'))[_0xae07('0xba')](_0xae07('0xbb'));}else{return _0xbc00ca['status'](_0x4ac0bf)[_0xae07('0x34')](_0x10f218);}}})[_0xae07('0x2a')](handleError(_0xbc00ca,null));};exports[_0xae07('0xbc')]=function(_0x29cc31,_0x449ba0){var _0x1c5f25=_0x29cc31[_0xae07('0x66')]['id'];var _0x12b0d1=_0x29cc31['body'];var _0x3ae3be=0xc8;var _0x3c111c=null;return db[_0xae07('0xbd')]['transaction']({'isolationLevel':db['sequelize']['Transaction'][_0xae07('0xbe')][_0xae07('0xbf')]},function(_0xabe640){return db[_0xae07('0x3e')][_0xae07('0x6c')]({'where':{'id':_0x1c5f25},'transaction':_0xabe640})[_0xae07('0x20')](function(_0x582eb3){if(_0x582eb3){return db['SmsApplication']['destroy']({'where':{'SmsAccountId':_0x1c5f25},'transaction':_0xabe640})[_0xae07('0x20')](function(){var _0x466f51=_[_0xae07('0x3d')](_0x12b0d1,function(_0x4782ed){_0x4782ed[_0xae07('0x69')]=_0x1c5f25;return _0x4782ed;});return db[_0xae07('0xc0')][_0xae07('0xc1')](_0x466f51,{'transaction':_0xabe640});});}else{_0x3ae3be=0x194;_0x3c111c=[];}});})[_0xae07('0x20')](function(){if(_0x3ae3be!==0x194){return db[_0xae07('0xc0')][_0xae07('0xc2')]({'where':{'SmsAccountId':_0x1c5f25},'order':_0xae07('0x78')})[_0xae07('0x20')](function(_0x170606){_0x3c111c=_0x170606;});}})[_0xae07('0x2a')](function(_0x383969){_0x3ae3be=0x1f4;logger[_0xae07('0x26')](_0x383969['stack']);if(_0x383969[_0xae07('0x3b')]){delete _0x383969[_0xae07('0x3b')];}_0x3c111c=_0x383969;})[_0xae07('0xc3')](function(){if(_0x3c111c===null){_0x449ba0[_0xae07('0x2b')](_0x3ae3be);}else{if(_0x3ae3be===0x1f4){_0x449ba0[_0xae07('0x2c')](_0x3ae3be)[_0xae07('0xba')](_0x3c111c);}else{_0x449ba0['status'](_0x3ae3be)[_0xae07('0x34')](_0x3c111c);}}});};exports[_0xae07('0xc4')]=function(_0xcbbfe8,_0x4f305a,_0x39d7ef){var _0x37b525={};var _0x18670a={};var _0x1646f9;var _0x276299;return db[_0xae07('0x3e')]['findOne']({'where':{'id':_0xcbbfe8[_0xae07('0x66')]['id']}})[_0xae07('0x20')](handleEntityNotFound(_0x4f305a,null))[_0xae07('0x20')](function(_0x36971d){if(_0x36971d){_0x1646f9=_0x36971d;_0x18670a[_0xae07('0x42')]=_['keys'](db[_0xae07('0xc0')][_0xae07('0x5a')]);_0x18670a[_0xae07('0x43')]=_['keys'](_0xcbbfe8['query']);_0x18670a[_0xae07('0x45')]=_[_0xae07('0x46')](_0x18670a[_0xae07('0x42')],_0x18670a['query']);_0x37b525[_0xae07('0x48')]=_[_0xae07('0x46')](_0x18670a[_0xae07('0x42')],qs['fields'](_0xcbbfe8[_0xae07('0x43')][_0xae07('0x47')]));_0x37b525[_0xae07('0x48')]=_0x37b525[_0xae07('0x48')][_0xae07('0x49')]?_0x37b525[_0xae07('0x48')]:_0x18670a[_0xae07('0x42')];_0x37b525[_0xae07('0x4b')]=qs[_0xae07('0x4c')](_0xcbbfe8[_0xae07('0x43')]['sort']);_0x37b525[_0xae07('0x4f')]=qs[_0xae07('0x45')](_['pick'](_0xcbbfe8['query'],_0x18670a[_0xae07('0x45')]));if(_0xcbbfe8[_0xae07('0x43')]['filter']){_0x37b525[_0xae07('0x4f')]=_['merge'](_0x37b525[_0xae07('0x4f')],{'$or':_[_0xae07('0x3d')](_0x37b525['attributes'],function(_0x4fb3e4){var _0x34e7c5={};_0x34e7c5[_0x4fb3e4]={'$like':'%'+_0xcbbfe8[_0xae07('0x43')][_0xae07('0x4e')]+'%'};return _0x34e7c5;})});}_0x37b525=_[_0xae07('0x50')]({},_0x37b525,_0xcbbfe8[_0xae07('0x52')]);return _0x1646f9[_0xae07('0xc4')](_0x37b525);}})['then'](function(_0x2003dc){if(_0x2003dc){_0x276299=_0x2003dc['length'];if(!_0xcbbfe8['query']['hasOwnProperty'](_0xae07('0xc5'))){_0x37b525[_0xae07('0x30')]=qs[_0xae07('0x30')](_0xcbbfe8[_0xae07('0x43')]['limit']);_0x37b525[_0xae07('0x2e')]=qs[_0xae07('0x2e')](_0xcbbfe8[_0xae07('0x43')]['offset']);}return _0x1646f9[_0xae07('0xc4')](_0x37b525);}})[_0xae07('0x20')](function(_0x496979){if(_0x496979){return _0x496979?{'count':_0x276299,'rows':_0x496979}:null;}})[_0xae07('0x20')](respondWithResult(_0x4f305a,null))[_0xae07('0x2a')](handleError(_0x4f305a,null));};exports['getInteractions']=function(_0x46f3b5,_0x5af9fe,_0x525d79){var _0x259e1a={'raw':![],'where':{}};var _0x2e78ed={};var _0x1125de={'count':0x0,'rows':[]};return db[_0xae07('0x3e')][_0xae07('0x6c')]({'where':{'id':_0x46f3b5['params']['id']}})[_0xae07('0x20')](handleEntityNotFound(_0x5af9fe,null))['then'](function(_0x28878d){if(_0x28878d){_0x2e78ed[_0xae07('0x42')]=_['keys'](db[_0xae07('0xa4')][_0xae07('0x5a')]);_0x2e78ed[_0xae07('0x43')]=_[_0xae07('0x44')](_0x46f3b5[_0xae07('0x43')]);_0x2e78ed[_0xae07('0x45')]=_['intersection'](_0x2e78ed['model'],_0x2e78ed[_0xae07('0x43')]);_0x259e1a[_0xae07('0x48')]=_[_0xae07('0x46')](_0x2e78ed[_0xae07('0x42')],qs[_0xae07('0x47')](_0x46f3b5[_0xae07('0x43')][_0xae07('0x47')]));_0x259e1a[_0xae07('0x48')]=_0x259e1a[_0xae07('0x48')]['length']?_0x259e1a['attributes']:_0x2e78ed['model'];if(!_0x46f3b5['query'][_0xae07('0x4a')](_0xae07('0xc5'))){_0x259e1a['limit']=qs[_0xae07('0x30')](_0x46f3b5['query'][_0xae07('0x30')]);_0x259e1a[_0xae07('0x2e')]=qs[_0xae07('0x2e')](_0x46f3b5[_0xae07('0x43')][_0xae07('0x2e')]);}_0x259e1a[_0xae07('0x4b')]=qs[_0xae07('0x4c')](_0x46f3b5[_0xae07('0x43')]['sort']);_0x259e1a[_0xae07('0x4f')]=qs[_0xae07('0x45')](_['pick'](_0x46f3b5[_0xae07('0x43')],_0x2e78ed[_0xae07('0x45')]));_0x259e1a[_0xae07('0x4f')][_0xae07('0x69')]=_0x28878d['id'];if(_0x46f3b5['query'][_0xae07('0x4e')]){_0x259e1a['where']=_[_0xae07('0x50')](_0x259e1a[_0xae07('0x4f')],{'$or':_[_0xae07('0x3d')](_0x259e1a[_0xae07('0x48')],function(_0x511d8c){var _0x2928b3={};_0x2928b3[_0x511d8c]={'$like':'%'+_0x46f3b5[_0xae07('0x43')][_0xae07('0x4e')]+'%'};return _0x2928b3;})});}_0x259e1a=_['merge']({},_0x259e1a,_0x46f3b5[_0xae07('0x52')]);return db[_0xae07('0xa4')][_0xae07('0x31')]({'where':_0x259e1a['where']})[_0xae07('0x20')](function(_0x2d6220){_0x1125de[_0xae07('0x31')]=_0x2d6220;if(_0x46f3b5[_0xae07('0x43')][_0xae07('0x53')]){_0x259e1a[_0xae07('0x54')]=[{'model':db[_0xae07('0x7b')],'as':_0xae07('0xc6'),'required':![]},{'model':db[_0xae07('0xb0')],'as':_0xae07('0xc7'),'attributes':['name',_0xae07('0xc8'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xae07('0xc9'),'attributes':['id','name',_0xae07('0xca')],'where':_0x46f3b5[_0xae07('0x43')]['tag']?{'id':_0x46f3b5[_0xae07('0x43')][_0xae07('0xcb')]}:undefined,'required':_0x46f3b5[_0xae07('0x43')][_0xae07('0xcb')]?!![]:![]}];}return db[_0xae07('0xa4')][_0xae07('0x55')](_0x259e1a);})['then'](function(_0x21411f){_0x1125de[_0xae07('0x56')]=_0x21411f;return _0x1125de;});}})[_0xae07('0x20')](respondWithFilteredResult(_0x5af9fe,_0x259e1a))[_0xae07('0x2a')](handleError(_0x5af9fe,null));};exports['send']=function(_0x1682ae,_0x218e62,_0x5dd21c){var _0x41a773,_0x3a594b,_0x105f3f;if(_[_0xae07('0x98')](_0x1682ae['body'][_0xae07('0x5d')])||_0x1682ae[_0xae07('0x5d')]['body']===''){throw new db[(_0xae07('0x9a'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xae07('0x98')](_0x1682ae[_0xae07('0x5d')]['to'])){throw new db[(_0xae07('0x9a'))][(_0xae07('0x7c'))](_0xae07('0xcc'));}_0x41a773=_0x1682ae[_0xae07('0x5d')]['to'];return db[_0xae07('0x3e')][_0xae07('0x5b')]({'where':{'id':_0x1682ae[_0xae07('0x66')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0xae07('0xa2'),'where':{'mobile':_0x41a773},'limit':0x1,'order':[[_0xae07('0x80'),_0xae07('0xa0')]]}]}]})[_0xae07('0x20')](handleEntityNotFound(_0x218e62,null))[_0xae07('0x20')](function(_0x395f0a){if(_0x395f0a&&_0x395f0a[_0xae07('0xcd')]){_0x3a594b=_0x395f0a[_0xae07('0x38')]({'plain':!![]});if(_0x3a594b[_0xae07('0xcd')]&&_0x3a594b[_0xae07('0xcd')][_0xae07('0xa2')][_0xae07('0x49')]){return _0x3a594b['List'][_0xae07('0xa2')][0x0];}return db[_0xae07('0x7b')][_0xae07('0x5c')](_[_0xae07('0x18')](_0x1682ae['body'],{'firstName':_0x41a773,'mobile':_0x41a773,'phone':_0x41a773,'ListId':_0x3a594b['ListId']}));}})[_0xae07('0x20')](handleEntityNotFound(_0x218e62,null))['then'](function(_0x361c02){if(_0x361c02){_0x105f3f=_0x361c02;return db['SmsInteraction'][_0xae07('0x5b')]({'where':{'ContactId':_0x105f3f['id'],'closed':![],'SmsAccountId':_0x3a594b['id']}})['then'](function(_0x4ae916){if(_0x4ae916){return[_0x4ae916,![]];}return db[_0xae07('0xa4')][_0xae07('0x5c')]({'UserId':_0x1682ae['user']['id'],'ContactId':_0x105f3f['id'],'SmsAccountId':_0x3a594b['id'],'phone':_0x41a773,'firstMsgDirection':_0xae07('0xce'),'Messages':[_[_0xae07('0x50')](_0x1682ae[_0xae07('0x5d')],{'read':![],'body':_0x1682ae[_0xae07('0x5d')]['body'],'phone':_0x41a773,'SmsAccountId':_0x3a594b['id'],'UserId':_0x1682ae[_0xae07('0x5f')]['id'],'ContactId':_0x105f3f['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xae07('0xcf')}]})['then'](function(_0xd57df7){return[_0xd57df7,!![]];});});}})[_0xae07('0xa5')](function(_0x50de0e,_0xf46b52){if(_0xf46b52){return _0x50de0e;}return db['SmsMessage'][_0xae07('0x5c')](_[_0xae07('0x50')](_0x1682ae[_0xae07('0x5d')],{'read':![],'body':_0x1682ae[_0xae07('0x5d')][_0xae07('0x5d')],'phone':_0x41a773,'SmsAccountId':_0x3a594b['id'],'SmsInteractionId':_0x50de0e['id'],'UserId':_0x1682ae[_0xae07('0x5f')]['id'],'ContactId':_0x105f3f['id']}))['then'](function(_0x4cb8be){_0x50de0e[_0xae07('0xd0')]['Messages']=[];_0x50de0e['dataValues'][_0xae07('0xcf')]['push'](_0x4cb8be[_0xae07('0xd0')]);return _0x50de0e;});})[_0xae07('0x20')](respondWithResult(_0x218e62,null))[_0xae07('0x2a')](handleError(_0x218e62,null));};exports['status']=function(_0x3659ab,_0x29499c,_0x3e3c27){if(_0x3659ab['body']['id']){delete _0x3659ab[_0xae07('0x5d')]['id'];}var _0x8a3a07,_0x32f0ee,_0x38293d;return db[_0xae07('0x3e')][_0xae07('0x5b')]({'where':{'id':_0x3659ab[_0xae07('0x66')]['id']}})[_0xae07('0x20')](handleEntityNotFound(_0x29499c,null))['then'](function(_0x1ba411){if(_0x1ba411){_0x38293d=_0x1ba411;logger[_0xae07('0x23')](_0xae07('0x24'),_0xae07('0x2c'),'received\x20delivery\x20report\x20from',_0x1ba411['type'],util['inspect'](_0x3659ab[_0xae07('0x5d')],{'showHidden':![],'depth':null}));switch(_0x1ba411[_0xae07('0x40')]){case _0xae07('0x88'):if(_0x3659ab['body'][_0xae07('0xd1')]&&_0x3659ab['body'][_0xae07('0x2c')]){_0x32f0ee=_0x3659ab[_0xae07('0x5d')][_0xae07('0x2c')];return db[_0xae07('0xd2')][_0xae07('0x5b')]({'where':{'messageId':_0x3659ab[_0xae07('0x5d')]['skebby_dispatch_id']}});}break;case _0xae07('0x8a'):if(_0x3659ab['body']['requestid']&&_0x3659ab['body'][_0xae07('0xd3')]){_0x32f0ee=_0x3659ab[_0xae07('0x5d')]['statusInt'];return db[_0xae07('0xd2')][_0xae07('0x5b')]({'where':{'messageId':_0x3659ab[_0xae07('0x5d')][_0xae07('0xd4')]}});}break;case'clicksend':if(_0x3659ab[_0xae07('0x5d')][_0xae07('0x8c')]&&_0x3659ab['body'][_0xae07('0xd5')]){_0x32f0ee=_0x3659ab[_0xae07('0x5d')]['status_code'];return db[_0xae07('0xd2')][_0xae07('0x5b')]({'where':{'messageId':_0x3659ab[_0xae07('0x5d')][_0xae07('0x8c')]}});}break;case _0xae07('0x8e'):var _0x5221da=_0x3659ab[_0xae07('0x5d')][_0xae07('0x8f')][0x0];if(_0x5221da[_0xae07('0x86')]&&_0x5221da[_0xae07('0x2c')][_0xae07('0xd6')]==='DELIVERED'){_0x32f0ee=_0x5221da[_0xae07('0x2c')]['groupName'];return db[_0xae07('0xd2')]['find']({'where':{'messageId':_0x5221da[_0xae07('0x86')]}});}break;case _0xae07('0x93'):if(_0x3659ab['body'][_0xae07('0x86')]&&_0x3659ab[_0xae07('0x5d')]['status']){_0x32f0ee=_0x3659ab['body'][_0xae07('0x2c')];return db[_0xae07('0xd2')][_0xae07('0x5b')]({'where':{'messageId':_0x3659ab[_0xae07('0x5d')][_0xae07('0x86')]}});}break;case _0xae07('0x96'):if(_0x3659ab[_0xae07('0x5d')][0x0]['message']['id']){_0x32f0ee=_0x3659ab[_0xae07('0x5d')][0x0][_0xae07('0x40')];return db[_0xae07('0xd2')][_0xae07('0x5b')]({'where':{'messageId':_0x3659ab[_0xae07('0x5d')][0x0][_0xae07('0x27')]['id']}});}break;case _0xae07('0x97'):if(_0x3659ab[_0xae07('0x5d')][_0xae07('0xd7')]&&_0x3659ab[_0xae07('0x5d')][_0xae07('0x2c')]){_0x32f0ee=_0x3659ab[_0xae07('0x5d')][_0xae07('0x2c')];return db['SmsMessage']['find']({'where':{'messageId':_0x3659ab[_0xae07('0x5d')][_0xae07('0xd7')]}});}break;}}})[_0xae07('0x20')](handleEntityNotFound(_0x29499c,null))[_0xae07('0x20')](function(_0x4182ce){if(_0x4182ce){_0x8a3a07=_0x4182ce;switch(_0x38293d[_0xae07('0x40')]){case _0xae07('0x88'):if(_0x32f0ee===_0xae07('0xd8')){return _0x8a3a07['update']({'read':!![]});}else{logger[_0xae07('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xae07('0x88'),util[_0xae07('0xd9')](_0x3659ab[_0xae07('0x5d')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x32f0ee==='1'){return _0x8a3a07[_0xae07('0x65')]({'read':!![]});}else{logger['error'](_0xae07('0x24'),_0xae07('0x2c'),_0xae07('0x88'),util[_0xae07('0xd9')](_0x3659ab[_0xae07('0x5d')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x3659ab[_0xae07('0x5d')][_0xae07('0xda')]&&_0x32f0ee>=0xc8&&_0x32f0ee<=0xce){return _0x8a3a07[_0xae07('0x65')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xae07('0x2c'),_0xae07('0x8b'),util[_0xae07('0xd9')](_0x3659ab[_0xae07('0x5d')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x3cb25a=_0x3659ab[_0xae07('0x5d')][_0xae07('0x8f')][0x0];if(_0x3cb25a[_0xae07('0x2c')][_0xae07('0xd6')]===_0xae07('0xd8')){return _0x8a3a07[_0xae07('0x65')]({'read':!![]});}else{logger[_0xae07('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xae07('0x2c'),_0xae07('0x8e'),util[_0xae07('0xd9')](_0x3659ab[_0xae07('0x5d')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x32f0ee==_0xae07('0xdb')||_0x32f0ee=='RECEIVED_BY_RECIPIENT'){return _0x8a3a07['update']({'read':!![]});}else{logger[_0xae07('0x26')](_0xae07('0x24'),_0xae07('0x2c'),_0xae07('0x93'),util[_0xae07('0xd9')](_0x3659ab['body'],{'showHidden':![],'depth':null}));}break;case _0xae07('0x96'):if(_0x32f0ee==_0xae07('0xdc')){return _0x8a3a07['update']({'read':!![]});}else{logger[_0xae07('0x26')](_0xae07('0x24'),_0xae07('0x2c'),_0xae07('0x96'),util['inspect'](_0x3659ab[_0xae07('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xae07('0x97'):if(_0x32f0ee===_0xae07('0xdd')||_0x32f0ee===_0xae07('0xde')){return _0x8a3a07[_0xae07('0x65')]({'read':!![]});}else{logger[_0xae07('0x26')](_0xae07('0x24'),'status',_0xae07('0x97'),util['inspect'](_0x3659ab[_0xae07('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x8a3a07;}})[_0xae07('0x20')](respondWithResult(_0x29499c,null))[_0xae07('0x2a')](handleError(_0x29499c,null));};exports['statusGet']=function(_0x53b293,_0x39616e,_0x82b5d1){var _0x1bb255,_0x5b1da3,_0x5caebf;return db[_0xae07('0x3e')]['find']({'where':{'id':_0x53b293['params']['id']}})[_0xae07('0x20')](handleEntityNotFound(_0x39616e,null))[_0xae07('0x20')](function(_0x37b5b9){if(_0x37b5b9){_0x5caebf=_0x37b5b9;logger[_0xae07('0x23')](_0xae07('0x24'),_0xae07('0x2c'),'received\x20delivery\x20report\x20from',_0x37b5b9[_0xae07('0x40')],util[_0xae07('0xd9')](_0x53b293[_0xae07('0x43')],{'showHidden':![],'depth':null}));switch(_0x37b5b9[_0xae07('0x40')]){case _0xae07('0x90'):if(_0x53b293[_0xae07('0x43')][_0xae07('0xdf')]&&_0x53b293[_0xae07('0x43')][_0xae07('0xe0')]){_0x5b1da3=_0x53b293['query']['state'];return db[_0xae07('0xd2')][_0xae07('0x5b')]({'where':{'messageId':_0x53b293['query'][_0xae07('0xdf')]}});}break;}}})['then'](handleEntityNotFound(_0x39616e,null))[_0xae07('0x20')](function(_0x2cd8d4){if(_0x2cd8d4){_0x1bb255=_0x2cd8d4;switch(_0x5caebf[_0xae07('0x40')]){case _0xae07('0x90'):if(_0x5b1da3==='2'||_0x5b1da3==='6'){return _0x1bb255['update']({'read':!![]});}else{logger['error'](_0xae07('0x24'),_0xae07('0x2c'),'csc',util[_0xae07('0xd9')](_0x53b293['query'],{'showHidden':![],'depth':null}));};break;}return _0x1bb255;}})[_0xae07('0x20')](respondWithResult(_0x39616e,null))['catch'](handleError(_0x39616e,null));};exports['addAgents']=function(_0x313f84,_0x1d7f89,_0x4624b4){return db['SmsAccount'][_0xae07('0x5b')]({'where':{'id':_0x313f84[_0xae07('0x66')]['id']}})[_0xae07('0x20')](handleEntityNotFound(_0x1d7f89,null))[_0xae07('0x20')](function(_0xe52f63){if(_0xe52f63){return _0xe52f63['addAgents'](_0x313f84[_0xae07('0x5d')][_0xae07('0x72')],_['omit'](_0x313f84['body'],['ids','id'])||{})[_0xae07('0xa5')](function(_0xbbc3c2){for(var _0x4ae598=0x0;_0x4ae598<_0x313f84['body']['ids'][_0xae07('0x49')];_0x4ae598+=0x1){socket[_0xae07('0xe1')]('userSmsAccount:save',{'UserId':Number(_0x313f84[_0xae07('0x5d')][_0xae07('0x72')][_0x4ae598]),'SmsAccountId':Number(_0x313f84[_0xae07('0x66')]['id'])});}return _0xbbc3c2;});}})[_0xae07('0x20')](respondWithResult(_0x1d7f89,null))[_0xae07('0x2a')](handleError(_0x1d7f89,null));};exports[_0xae07('0xe2')]=function(_0xce21cf,_0x5da4a2,_0x9e8597){return db[_0xae07('0x3e')][_0xae07('0x5b')]({'where':{'id':_0xce21cf[_0xae07('0x66')]['id']}})[_0xae07('0x20')](handleEntityNotFound(_0x5da4a2,null))[_0xae07('0x20')](function(_0x1567af){if(_0x1567af){return _0x1567af[_0xae07('0xe2')](_0xce21cf['query'][_0xae07('0x72')])[_0xae07('0x20')](function(){if(_[_0xae07('0xe3')](_0xce21cf[_0xae07('0x43')]['ids'])){for(var _0x453ac2=0x0;_0x453ac2<_0xce21cf['query'][_0xae07('0x72')]['length'];_0x453ac2+=0x1){socket[_0xae07('0xe1')](_0xae07('0xe4'),{'UserId':Number(_0xce21cf[_0xae07('0x43')][_0xae07('0x72')][_0x453ac2]),'SmsAccountId':Number(_0xce21cf[_0xae07('0x66')]['id'])});}}else{socket[_0xae07('0xe1')](_0xae07('0xe4'),{'UserId':Number(_0xce21cf[_0xae07('0x43')][_0xae07('0x72')]),'SmsAccountId':Number(_0xce21cf[_0xae07('0x66')]['id'])});}});}})[_0xae07('0x20')](respondWithStatusCode(_0x5da4a2,null))[_0xae07('0x2a')](handleError(_0x5da4a2,null));};exports[_0xae07('0xe5')]=function(_0x46d50d,_0x1076fd,_0x3bb6bc){var _0x3dbecf={};var _0x292265={};var _0xc059ed;var _0x2375c2;return db['SmsAccount'][_0xae07('0x6c')]({'where':{'id':_0x46d50d[_0xae07('0x66')]['id']}})[_0xae07('0x20')](handleEntityNotFound(_0x1076fd,null))[_0xae07('0x20')](function(_0x44c0fc){if(_0x44c0fc){_0xc059ed=_0x44c0fc;_0x292265['model']=_[_0xae07('0x44')](db['User'][_0xae07('0x5a')]);_0x292265[_0xae07('0x43')]=_[_0xae07('0x44')](_0x46d50d[_0xae07('0x43')]);_0x292265['filters']=_[_0xae07('0x46')](_0x292265[_0xae07('0x42')],_0x292265[_0xae07('0x43')]);_0x3dbecf[_0xae07('0x48')]=_[_0xae07('0x46')](_0x292265['model'],qs['fields'](_0x46d50d[_0xae07('0x43')][_0xae07('0x47')]));_0x3dbecf[_0xae07('0x48')]=_0x3dbecf[_0xae07('0x48')][_0xae07('0x49')]?_0x3dbecf[_0xae07('0x48')]:_0x292265[_0xae07('0x42')];_0x3dbecf[_0xae07('0x4b')]=qs[_0xae07('0x4c')](_0x46d50d[_0xae07('0x43')][_0xae07('0x4c')]);_0x3dbecf[_0xae07('0x4f')]=qs[_0xae07('0x45')](_[_0xae07('0x4d')](_0x46d50d[_0xae07('0x43')],_0x292265[_0xae07('0x45')]));if(_0x46d50d['query'][_0xae07('0x4e')]){_0x3dbecf[_0xae07('0x4f')]=_[_0xae07('0x50')](_0x3dbecf[_0xae07('0x4f')],{'$or':_[_0xae07('0x3d')](_0x3dbecf['attributes'],function(_0x552773){var _0x361eeb={};_0x361eeb[_0x552773]={'$like':'%'+_0x46d50d[_0xae07('0x43')][_0xae07('0x4e')]+'%'};return _0x361eeb;})});}_0x3dbecf=_[_0xae07('0x50')]({},_0x3dbecf,_0x46d50d['options']);return _0xc059ed['getAgents'](_0x3dbecf);}})['then'](function(_0x4dc370){if(_0x4dc370){_0x2375c2=_0x4dc370[_0xae07('0x49')];if(!_0x46d50d[_0xae07('0x43')][_0xae07('0x4a')](_0xae07('0xc5'))){_0x3dbecf['limit']=qs[_0xae07('0x30')](_0x46d50d[_0xae07('0x43')]['limit']);_0x3dbecf[_0xae07('0x2e')]=qs['offset'](_0x46d50d[_0xae07('0x43')]['offset']);}return _0xc059ed[_0xae07('0xe5')](_0x3dbecf);}})['then'](function(_0x281d4e){if(_0x281d4e){return _0x281d4e?{'count':_0x2375c2,'rows':_0x281d4e}:null;}})[_0xae07('0x20')](respondWithResult(_0x1076fd,null))['catch'](handleError(_0x1076fd,null));}; \ No newline at end of file +var _0xd8a0=['undefined','count','set','Content-Range','reject','save','destroy','get','SmsAccounts','name','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','pick','filter','where','type','VIRTUAL','merge','includeAll','include','rows','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','order','removeAnswers','ids','SmsApplication','Applications','applications','orderBy','priority','asc','account','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','twilio','from','From','Body','MessageSid','skebby','sender','clicksend','message_id','Text','MessageUUID','infobip','results','messageId','originatingAddress','segmentedMessage','fromNumber','text','replyMessageId','bandwidth','intelepeer','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','CmContact','Contacts','DESC','list','omit','defaults','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','ContactId','AttachmentId','UserId','unshift','agent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','send','\x0a','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','getApplications','User','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','SmsMessage','Messages','dataValues','debug','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','status_code','DELIVERED','redif','error_code','groupName','clickatell','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','message-id','state','csc','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','jayson/promise','client','then','info','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','catch','sendStatus','status','end','json','offset'];(function(_0x1d2bc8,_0x2860bc){var _0x1857e1=function(_0x3a3073){while(--_0x3a3073){_0x1d2bc8['push'](_0x1d2bc8['shift']());}};_0x1857e1(++_0x2860bc);}(_0xd8a0,0xb6));var _0x0d8a=function(_0x4ff5a5,_0x4e76f0){_0x4ff5a5=_0x4ff5a5-0x0;var _0x340ce7=_0xd8a0[_0x4ff5a5];return _0x340ce7;};'use strict';var emlformat=require(_0x0d8a('0x0'));var rimraf=require(_0x0d8a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8a('0x2'));var moment=require(_0x0d8a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0d8a('0x4'));var util=require(_0x0d8a('0x5'));var path=require(_0x0d8a('0x6'));var sox=require(_0x0d8a('0x7'));var csv=require(_0x0d8a('0x8'));var ejs=require(_0x0d8a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0d8a('0xa'));var squel=require(_0x0d8a('0xb'));var crypto=require(_0x0d8a('0xc'));var jsforce=require(_0x0d8a('0xd'));var deskjs=require(_0x0d8a('0xe'));var toCsv=require(_0x0d8a('0x8'));var querystring=require(_0x0d8a('0xf'));var Papa=require('papaparse');var Redis=require(_0x0d8a('0x10'));var authService=require(_0x0d8a('0x11'));var qs=require(_0x0d8a('0x12'));var as=require(_0x0d8a('0x13'));var hardwareService=require(_0x0d8a('0x14'));var logger=require(_0x0d8a('0x15'))('api');var utils=require(_0x0d8a('0x16'));var config=require(_0x0d8a('0x17'));var licenseUtil=require(_0x0d8a('0x18'));var db=require(_0x0d8a('0x19'))['db'];config[_0x0d8a('0x1a')]=_['defaults'](config['redis'],{'host':_0x0d8a('0x1b'),'port':0x18eb});var socket=require(_0x0d8a('0x1c'))(new Redis(config[_0x0d8a('0x1a')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x0d8a('0x1d'));var client=jayson[_0x0d8a('0x1e')]['http']({'port':0x232c});function respondWithRpcPromise(_0x1a90b8,_0x3768d6,_0x2b1f59,_0x487eb2){return new BPromise(function(_0x72ff2a,_0x4b7aa8){var _0xa7bcbd=_0x487eb2||client;return _0xa7bcbd['request'](_0x1a90b8,_0x2b1f59)[_0x0d8a('0x1f')](function(_0x4caf84){logger[_0x0d8a('0x20')](_0x0d8a('0x21'),_0x3768d6,'request\x20sent');logger['debug'](_0x0d8a('0x22'),_0x3768d6,'request\x20sent',JSON['stringify'](_0x4caf84));if(_0x4caf84[_0x0d8a('0x23')]){if(_0x4caf84[_0x0d8a('0x23')]['code']===0x1f4){logger[_0x0d8a('0x23')](_0x0d8a('0x21'),_0x3768d6,_0x4caf84['error'][_0x0d8a('0x24')]);return _0x4b7aa8(_0x4caf84['error']['message']);}logger[_0x0d8a('0x23')]('SmsAccount,\x20%s,\x20%s',_0x3768d6,_0x4caf84[_0x0d8a('0x23')][_0x0d8a('0x24')]);return _0x72ff2a(_0x4caf84[_0x0d8a('0x23')][_0x0d8a('0x24')]);}else{logger[_0x0d8a('0x20')]('SmsAccount,\x20%s,\x20%s',_0x3768d6,_0x0d8a('0x25'));_0x72ff2a(_0x4caf84['result'][_0x0d8a('0x24')]);}})[_0x0d8a('0x26')](function(_0x3ad9b9){logger[_0x0d8a('0x23')](_0x0d8a('0x21'),_0x3768d6,_0x3ad9b9);_0x4b7aa8(_0x3ad9b9);});});}function respondWithStatusCode(_0x597edd,_0x15a4c8){_0x15a4c8=_0x15a4c8||0xcc;return function(_0xfdcd9b){if(_0xfdcd9b){return _0x597edd[_0x0d8a('0x27')](_0x15a4c8);}return _0x597edd[_0x0d8a('0x28')](_0x15a4c8)[_0x0d8a('0x29')]();};}function respondWithResult(_0x59852f,_0x25e797){_0x25e797=_0x25e797||0xc8;return function(_0x341c3e){if(_0x341c3e){return _0x59852f[_0x0d8a('0x28')](_0x25e797)[_0x0d8a('0x2a')](_0x341c3e);}};}function respondWithFilteredResult(_0x255573,_0x3154bd){return function(_0x282ceb){if(_0x282ceb){var _0x23c2c2=typeof _0x3154bd[_0x0d8a('0x2b')]===_0x0d8a('0x2c')&&typeof _0x3154bd['limit']===_0x0d8a('0x2c');var _0x16f3c5=_0x282ceb[_0x0d8a('0x2d')];var _0x2f7367=_0x23c2c2?0x0:_0x3154bd[_0x0d8a('0x2b')];var _0x3e439d=_0x23c2c2?_0x282ceb[_0x0d8a('0x2d')]:_0x3154bd[_0x0d8a('0x2b')]+_0x3154bd['limit'];var _0x38f48c;if(_0x3e439d>=_0x16f3c5){_0x3e439d=_0x16f3c5;_0x38f48c=0xc8;}else{_0x38f48c=0xce;}_0x255573['status'](_0x38f48c);return _0x255573[_0x0d8a('0x2e')](_0x0d8a('0x2f'),_0x2f7367+'-'+_0x3e439d+'/'+_0x16f3c5)[_0x0d8a('0x2a')](_0x282ceb);}return null;};}function patchUpdates(_0x40870e){return function(_0x370a2f){try{jsonpatch['apply'](_0x370a2f,_0x40870e,!![]);}catch(_0x1a6177){return BPromise[_0x0d8a('0x30')](_0x1a6177);}return _0x370a2f[_0x0d8a('0x31')]();};}function saveUpdates(_0x475643,_0x46a229){return function(_0x441971){if(_0x441971){return _0x441971['update'](_0x475643)['then'](function(_0x46c04e){return _0x46c04e;});}return null;};}function removeEntity(_0x4dbd85,_0x516aef){return function(_0x50fd73){if(_0x50fd73){return _0x50fd73[_0x0d8a('0x32')]()['then'](function(){var _0x1b78ac=_0x50fd73[_0x0d8a('0x33')]({'plain':!![]});var _0x1a0ab8=_0x0d8a('0x34');return db['UserProfileResource'][_0x0d8a('0x32')]({'where':{'type':_0x1a0ab8,'resourceId':_0x1b78ac['id']}})['then'](function(){return _0x50fd73;});})[_0x0d8a('0x1f')](function(){_0x4dbd85[_0x0d8a('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f4b8c,_0x29cadf){return function(_0x46a41e){if(!_0x46a41e){_0x5f4b8c[_0x0d8a('0x27')](0x194);}return _0x46a41e;};}function handleError(_0x54fc2e,_0x2fde7c){_0x2fde7c=_0x2fde7c||0x1f4;return function(_0x4ff51f){logger[_0x0d8a('0x23')](_0x4ff51f['stack']);if(_0x4ff51f[_0x0d8a('0x35')]){delete _0x4ff51f[_0x0d8a('0x35')];}_0x54fc2e[_0x0d8a('0x28')](_0x2fde7c)['send'](_0x4ff51f);};}exports[_0x0d8a('0x36')]=function(_0x320281,_0x1ff72b){var _0x3a82dd={'include':[{'model':db[_0x0d8a('0x37')],'as':_0x0d8a('0x38')}]},_0x117887={},_0x1f9207={'count':0x0,'rows':[]};var _0x4d2bda=_[_0x0d8a('0x39')](db[_0x0d8a('0x3a')][_0x0d8a('0x3b')],function(_0x4c5960){return{'name':_0x4c5960['fieldName'],'type':_0x4c5960['type'][_0x0d8a('0x3c')]};});_0x117887[_0x0d8a('0x3d')]=_['map'](_0x4d2bda,_0x0d8a('0x35'));_0x117887[_0x0d8a('0x3e')]=_[_0x0d8a('0x3f')](_0x320281[_0x0d8a('0x3e')]);_0x117887[_0x0d8a('0x40')]=_[_0x0d8a('0x41')](_0x117887[_0x0d8a('0x3d')],_0x117887[_0x0d8a('0x3e')]);_0x3a82dd['attributes']=_[_0x0d8a('0x41')](_0x117887[_0x0d8a('0x3d')],qs[_0x0d8a('0x42')](_0x320281['query']['fields']));_0x3a82dd[_0x0d8a('0x43')]=_0x3a82dd['attributes'][_0x0d8a('0x44')]?_0x3a82dd[_0x0d8a('0x43')]:_0x117887[_0x0d8a('0x3d')];if(!_0x320281[_0x0d8a('0x3e')][_0x0d8a('0x45')]('nolimit')){_0x3a82dd['limit']=qs[_0x0d8a('0x46')](_0x320281[_0x0d8a('0x3e')]['limit']);_0x3a82dd[_0x0d8a('0x2b')]=qs[_0x0d8a('0x2b')](_0x320281[_0x0d8a('0x3e')]['offset']);}_0x3a82dd['order']=qs[_0x0d8a('0x47')](_0x320281[_0x0d8a('0x3e')][_0x0d8a('0x47')]);_0x3a82dd['where']=qs[_0x0d8a('0x40')](_[_0x0d8a('0x48')](_0x320281[_0x0d8a('0x3e')],_0x117887['filters']),_0x4d2bda);if(_0x320281['query'][_0x0d8a('0x49')]){_0x3a82dd[_0x0d8a('0x4a')]=_['merge'](_0x3a82dd[_0x0d8a('0x4a')],{'$or':_['map'](_0x4d2bda,function(_0xe72d67){if(_0xe72d67[_0x0d8a('0x4b')]!==_0x0d8a('0x4c')){var _0x5d6522={};_0x5d6522[_0xe72d67[_0x0d8a('0x35')]]={'$like':'%'+_0x320281['query'][_0x0d8a('0x49')]+'%'};return _0x5d6522;}})});}_0x3a82dd=_[_0x0d8a('0x4d')]({},_0x3a82dd,_0x320281['options']);var _0x4a593e={'where':_0x3a82dd[_0x0d8a('0x4a')]};return db[_0x0d8a('0x3a')]['count'](_0x4a593e)[_0x0d8a('0x1f')](function(_0x5ba41c){_0x1f9207[_0x0d8a('0x2d')]=_0x5ba41c;if(_0x320281['query'][_0x0d8a('0x4e')]){_0x3a82dd[_0x0d8a('0x4f')]=[{'all':!![]}];}return db[_0x0d8a('0x3a')]['findAll'](_0x3a82dd);})[_0x0d8a('0x1f')](function(_0x403dc7){_0x1f9207[_0x0d8a('0x50')]=_0x403dc7;return _0x1f9207;})['then'](respondWithFilteredResult(_0x1ff72b,_0x3a82dd))[_0x0d8a('0x26')](handleError(_0x1ff72b,null));};exports[_0x0d8a('0x51')]=function(_0x54df0a,_0xcf57ef){var _0x3b85f6={'raw':![],'where':{'id':_0x54df0a[_0x0d8a('0x52')]['id']},'include':[{'model':db[_0x0d8a('0x37')],'as':_0x0d8a('0x38')}]},_0xf96be0={};_0xf96be0[_0x0d8a('0x3d')]=_[_0x0d8a('0x3f')](db['SmsAccount']['rawAttributes']);_0xf96be0[_0x0d8a('0x3e')]=_['keys'](_0x54df0a[_0x0d8a('0x3e')]);_0xf96be0['filters']=_[_0x0d8a('0x41')](_0xf96be0[_0x0d8a('0x3d')],_0xf96be0[_0x0d8a('0x3e')]);_0x3b85f6[_0x0d8a('0x43')]=_[_0x0d8a('0x41')](_0xf96be0[_0x0d8a('0x3d')],qs[_0x0d8a('0x42')](_0x54df0a['query'][_0x0d8a('0x42')]));_0x3b85f6[_0x0d8a('0x43')]=_0x3b85f6[_0x0d8a('0x43')]['length']?_0x3b85f6[_0x0d8a('0x43')]:_0xf96be0[_0x0d8a('0x3d')];if(_0x54df0a['query'][_0x0d8a('0x4e')]){_0x3b85f6[_0x0d8a('0x4f')]=[{'all':!![]}];}_0x3b85f6=_['merge']({},_0x3b85f6,_0x54df0a[_0x0d8a('0x53')]);return db['SmsAccount'][_0x0d8a('0x54')](_0x3b85f6)[_0x0d8a('0x1f')](handleEntityNotFound(_0xcf57ef,null))[_0x0d8a('0x1f')](respondWithResult(_0xcf57ef,null))['catch'](handleError(_0xcf57ef,null));};exports[_0x0d8a('0x55')]=function(_0x37032a,_0x2dc8e9){return db['SmsAccount'][_0x0d8a('0x55')](_0x37032a['body'],{})['then'](function(_0x2cef66){var _0xa8897c=_0x37032a[_0x0d8a('0x56')]['get']({'plain':!![]});if(!_0xa8897c)throw new Error(_0x0d8a('0x57'));if(_0xa8897c[_0x0d8a('0x58')]===_0x0d8a('0x56')){var _0x39f041=_0x2cef66[_0x0d8a('0x33')]({'plain':!![]});var _0x59bdca=_0x0d8a('0x34');return db[_0x0d8a('0x59')][_0x0d8a('0x54')]({'where':{'name':_0x59bdca,'userProfileId':_0xa8897c[_0x0d8a('0x5a')]},'raw':!![]})[_0x0d8a('0x1f')](function(_0x146f34){if(_0x146f34&&_0x146f34[_0x0d8a('0x5b')]===0x0){return db[_0x0d8a('0x5c')][_0x0d8a('0x55')]({'name':_0x39f041[_0x0d8a('0x35')],'resourceId':_0x39f041['id'],'type':_0x146f34[_0x0d8a('0x35')],'sectionId':_0x146f34['id']},{})['then'](function(){return _0x2cef66;});}else{return _0x2cef66;}})[_0x0d8a('0x26')](function(_0x1f1039){logger[_0x0d8a('0x23')](_0x0d8a('0x5d'),_0x1f1039);throw _0x1f1039;});}return _0x2cef66;})[_0x0d8a('0x1f')](respondWithResult(_0x2dc8e9,0xc9))[_0x0d8a('0x26')](handleError(_0x2dc8e9,null));};exports[_0x0d8a('0x5e')]=function(_0x5a27fc,_0x47cc20){if(_0x5a27fc[_0x0d8a('0x5f')]['id']){delete _0x5a27fc[_0x0d8a('0x5f')]['id'];}return db[_0x0d8a('0x3a')][_0x0d8a('0x54')]({'where':{'id':_0x5a27fc[_0x0d8a('0x52')]['id']},'include':[{'model':db[_0x0d8a('0x37')],'as':_0x0d8a('0x38')}]})[_0x0d8a('0x1f')](handleEntityNotFound(_0x47cc20,null))[_0x0d8a('0x1f')](saveUpdates(_0x5a27fc[_0x0d8a('0x5f')],null))['then'](respondWithResult(_0x47cc20,null))[_0x0d8a('0x26')](handleError(_0x47cc20,null));};exports[_0x0d8a('0x32')]=function(_0x47b47d,_0x59d2df){return db[_0x0d8a('0x3a')][_0x0d8a('0x54')]({'where':{'id':_0x47b47d[_0x0d8a('0x52')]['id']}})[_0x0d8a('0x1f')](handleEntityNotFound(_0x59d2df,null))[_0x0d8a('0x1f')](removeEntity(_0x59d2df,null))[_0x0d8a('0x26')](handleError(_0x59d2df,null));};exports[_0x0d8a('0x60')]=function(_0x366bc1,_0x41a5c7){return db[_0x0d8a('0x3a')][_0x0d8a('0x60')]()['then'](respondWithResult(_0x41a5c7,null))[_0x0d8a('0x26')](handleError(_0x41a5c7,null));};exports[_0x0d8a('0x61')]=function(_0x2d0e3b,_0x3a3d88,_0x53cb37){if(_0x2d0e3b['body']['id']){delete _0x2d0e3b[_0x0d8a('0x5f')]['id'];}return db[_0x0d8a('0x3a')][_0x0d8a('0x54')]({'where':{'id':_0x2d0e3b[_0x0d8a('0x52')]['id']}})[_0x0d8a('0x1f')](handleEntityNotFound(_0x3a3d88,null))[_0x0d8a('0x1f')](function(_0x5dbee6){if(_0x5dbee6){_0x2d0e3b[_0x0d8a('0x5f')][_0x0d8a('0x62')]=_0x5dbee6['id'];return db[_0x0d8a('0x63')][_0x0d8a('0x55')](_0x2d0e3b['body']);}})['then'](respondWithResult(_0x3a3d88,null))['catch'](handleError(_0x3a3d88,null));};exports[_0x0d8a('0x64')]=function(_0x1fb4e3,_0x503b6e,_0x5d03ce){var _0x1fcaa1={'raw':![],'where':{}};var _0x189bed={};var _0x3a10d8={'count':0x0,'rows':[]};return db[_0x0d8a('0x3a')][_0x0d8a('0x65')]({'where':{'id':_0x1fb4e3[_0x0d8a('0x52')]['id']}})['then'](handleEntityNotFound(_0x503b6e,null))[_0x0d8a('0x1f')](function(_0x5441de){if(_0x5441de){_0x189bed[_0x0d8a('0x3d')]=_['keys'](db[_0x0d8a('0x63')]['rawAttributes']);_0x189bed[_0x0d8a('0x3e')]=_['keys'](_0x1fb4e3[_0x0d8a('0x3e')]);_0x189bed['filters']=_[_0x0d8a('0x41')](_0x189bed[_0x0d8a('0x3d')],_0x189bed['query']);_0x1fcaa1[_0x0d8a('0x43')]=_[_0x0d8a('0x41')](_0x189bed[_0x0d8a('0x3d')],qs[_0x0d8a('0x42')](_0x1fb4e3['query'][_0x0d8a('0x42')]));_0x1fcaa1[_0x0d8a('0x43')]=_0x1fcaa1['attributes'][_0x0d8a('0x44')]?_0x1fcaa1[_0x0d8a('0x43')]:_0x189bed[_0x0d8a('0x3d')];if(!_0x1fb4e3['query'][_0x0d8a('0x45')](_0x0d8a('0x66'))){_0x1fcaa1[_0x0d8a('0x46')]=qs['limit'](_0x1fb4e3[_0x0d8a('0x3e')][_0x0d8a('0x46')]);_0x1fcaa1[_0x0d8a('0x2b')]=qs[_0x0d8a('0x2b')](_0x1fb4e3['query']['offset']);}_0x1fcaa1['order']=qs[_0x0d8a('0x47')](_0x1fb4e3[_0x0d8a('0x3e')]['sort']);_0x1fcaa1[_0x0d8a('0x4a')]=qs[_0x0d8a('0x40')](_[_0x0d8a('0x48')](_0x1fb4e3['query'],_0x189bed[_0x0d8a('0x40')]));_0x1fcaa1['where'][_0x0d8a('0x62')]=_0x5441de['id'];if(_0x1fb4e3[_0x0d8a('0x3e')]['filter']){_0x1fcaa1[_0x0d8a('0x4a')]=_['merge'](_0x1fcaa1[_0x0d8a('0x4a')],{'$or':_[_0x0d8a('0x39')](_0x1fcaa1[_0x0d8a('0x43')],function(_0x118f6d){var _0x204568={};_0x204568[_0x118f6d]={'$like':'%'+_0x1fb4e3[_0x0d8a('0x3e')][_0x0d8a('0x49')]+'%'};return _0x204568;})});}_0x1fcaa1=_[_0x0d8a('0x4d')]({},_0x1fcaa1,_0x1fb4e3[_0x0d8a('0x53')]);return db[_0x0d8a('0x63')][_0x0d8a('0x2d')]({'where':_0x1fcaa1[_0x0d8a('0x4a')]})[_0x0d8a('0x1f')](function(_0x198fb8){_0x3a10d8['count']=_0x198fb8;if(_0x1fb4e3[_0x0d8a('0x3e')][_0x0d8a('0x4e')]){_0x1fcaa1['include']=[{'all':!![]}];}return db[_0x0d8a('0x63')][_0x0d8a('0x67')](_0x1fcaa1);})[_0x0d8a('0x1f')](function(_0x190779){_0x3a10d8['rows']=_0x190779;return _0x3a10d8;});}})[_0x0d8a('0x1f')](respondWithFilteredResult(_0x503b6e,_0x1fcaa1))[_0x0d8a('0x26')](handleError(_0x503b6e,null));};exports[_0x0d8a('0x68')]=function(_0x7f9b3b,_0x5e657a,_0x5b7962){return db[_0x0d8a('0x3a')]['find']({'where':{'id':_0x7f9b3b[_0x0d8a('0x52')]['id']}})[_0x0d8a('0x1f')](handleEntityNotFound(_0x5e657a,null))[_0x0d8a('0x1f')](function(_0x3b7318){if(_0x3b7318){return _0x3b7318['removeDispositions'](_0x7f9b3b[_0x0d8a('0x3e')]['ids']);}})[_0x0d8a('0x1f')](respondWithStatusCode(_0x5e657a,null))[_0x0d8a('0x26')](handleError(_0x5e657a,null));};exports[_0x0d8a('0x69')]=function(_0x3c3edc,_0x4b79e8,_0x13f360){if(_0x3c3edc[_0x0d8a('0x5f')]['id']){delete _0x3c3edc[_0x0d8a('0x5f')]['id'];}return db[_0x0d8a('0x3a')][_0x0d8a('0x54')]({'where':{'id':_0x3c3edc[_0x0d8a('0x52')]['id']}})['then'](handleEntityNotFound(_0x4b79e8,null))[_0x0d8a('0x1f')](function(_0x93c7a0){if(_0x93c7a0){_0x3c3edc[_0x0d8a('0x5f')][_0x0d8a('0x62')]=_0x93c7a0['id'];return db[_0x0d8a('0x6a')]['create'](_0x3c3edc[_0x0d8a('0x5f')]);}})['then'](respondWithResult(_0x4b79e8,null))[_0x0d8a('0x26')](handleError(_0x4b79e8,null));};exports[_0x0d8a('0x6b')]=function(_0x4febc8,_0x4704ed,_0x23b0bf){var _0x368c9f={'raw':![],'where':{}};var _0x1b3bc8={};var _0x1e9c7a={'count':0x0,'rows':[]};return db[_0x0d8a('0x3a')][_0x0d8a('0x65')]({'where':{'id':_0x4febc8[_0x0d8a('0x52')]['id']}})[_0x0d8a('0x1f')](handleEntityNotFound(_0x4704ed,null))[_0x0d8a('0x1f')](function(_0x4bc885){if(_0x4bc885){_0x1b3bc8[_0x0d8a('0x3d')]=_[_0x0d8a('0x3f')](db[_0x0d8a('0x6a')][_0x0d8a('0x3b')]);_0x1b3bc8[_0x0d8a('0x3e')]=_[_0x0d8a('0x3f')](_0x4febc8[_0x0d8a('0x3e')]);_0x1b3bc8[_0x0d8a('0x40')]=_[_0x0d8a('0x41')](_0x1b3bc8['model'],_0x1b3bc8[_0x0d8a('0x3e')]);_0x368c9f[_0x0d8a('0x43')]=_['intersection'](_0x1b3bc8['model'],qs['fields'](_0x4febc8[_0x0d8a('0x3e')]['fields']));_0x368c9f['attributes']=_0x368c9f[_0x0d8a('0x43')][_0x0d8a('0x44')]?_0x368c9f[_0x0d8a('0x43')]:_0x1b3bc8['model'];if(!_0x4febc8[_0x0d8a('0x3e')][_0x0d8a('0x45')](_0x0d8a('0x66'))){_0x368c9f[_0x0d8a('0x46')]=qs[_0x0d8a('0x46')](_0x4febc8[_0x0d8a('0x3e')][_0x0d8a('0x46')]);_0x368c9f[_0x0d8a('0x2b')]=qs[_0x0d8a('0x2b')](_0x4febc8[_0x0d8a('0x3e')]['offset']);}_0x368c9f[_0x0d8a('0x6c')]=qs[_0x0d8a('0x47')](_0x4febc8[_0x0d8a('0x3e')]['sort']);_0x368c9f[_0x0d8a('0x4a')]=qs[_0x0d8a('0x40')](_[_0x0d8a('0x48')](_0x4febc8[_0x0d8a('0x3e')],_0x1b3bc8['filters']));_0x368c9f[_0x0d8a('0x4a')][_0x0d8a('0x62')]=_0x4bc885['id'];if(_0x4febc8[_0x0d8a('0x3e')][_0x0d8a('0x49')]){_0x368c9f['where']=_[_0x0d8a('0x4d')](_0x368c9f[_0x0d8a('0x4a')],{'$or':_['map'](_0x368c9f[_0x0d8a('0x43')],function(_0x10c55f){var _0x345ca6={};_0x345ca6[_0x10c55f]={'$like':'%'+_0x4febc8[_0x0d8a('0x3e')][_0x0d8a('0x49')]+'%'};return _0x345ca6;})});}_0x368c9f=_[_0x0d8a('0x4d')]({},_0x368c9f,_0x4febc8[_0x0d8a('0x53')]);return db[_0x0d8a('0x6a')][_0x0d8a('0x2d')]({'where':_0x368c9f[_0x0d8a('0x4a')]})[_0x0d8a('0x1f')](function(_0x247a71){_0x1e9c7a[_0x0d8a('0x2d')]=_0x247a71;if(_0x4febc8['query']['includeAll']){_0x368c9f[_0x0d8a('0x4f')]=[{'all':!![]}];}return db[_0x0d8a('0x6a')][_0x0d8a('0x67')](_0x368c9f);})[_0x0d8a('0x1f')](function(_0x51d4f4){_0x1e9c7a[_0x0d8a('0x50')]=_0x51d4f4;return _0x1e9c7a;});}})[_0x0d8a('0x1f')](respondWithFilteredResult(_0x4704ed,_0x368c9f))[_0x0d8a('0x26')](handleError(_0x4704ed,null));};exports['removeAnswers']=function(_0x1f472a,_0x3e9b25,_0x3b5f82){return db[_0x0d8a('0x3a')][_0x0d8a('0x54')]({'where':{'id':_0x1f472a[_0x0d8a('0x52')]['id']}})[_0x0d8a('0x1f')](handleEntityNotFound(_0x3e9b25,null))[_0x0d8a('0x1f')](function(_0x1165c3){if(_0x1165c3){return _0x1165c3[_0x0d8a('0x6d')](_0x1f472a[_0x0d8a('0x3e')][_0x0d8a('0x6e')]);}})[_0x0d8a('0x1f')](respondWithStatusCode(_0x3e9b25,null))[_0x0d8a('0x26')](handleError(_0x3e9b25,null));};exports['notify']=function(_0x186981,_0x45b827,_0x2e335a){var _0xc0e3d5={'channel':'sms'};var _0x370ac6=[];var _0x514e6d=[];var _0x603287={};return db[_0x0d8a('0x3a')][_0x0d8a('0x54')]({'where':{'id':_0x186981['params']['id']},'include':[{'model':db[_0x0d8a('0x6f')],'as':_0x0d8a('0x70')}]})[_0x0d8a('0x1f')](handleEntityNotFound(_0x45b827,null))['then'](function(_0x3602c3){_0xc0e3d5['account']=_0x3602c3;_0xc0e3d5[_0x0d8a('0x71')]=_[_0x0d8a('0x72')](_0x3602c3[_0x0d8a('0x70')],[_0x0d8a('0x73')],[_0x0d8a('0x74')]);if(_0xc0e3d5['account'][_0x0d8a('0x70')]){delete _0xc0e3d5[_0x0d8a('0x75')][_0x0d8a('0x70')];}return db['CmContact'][_0x0d8a('0x60')]();})[_0x0d8a('0x1f')](function(_0x3c5383){if(!_0x3c5383){throw new db[(_0x0d8a('0x76'))][(_0x0d8a('0x77'))](_0x0d8a('0x78'));}_0x370ac6=_['difference'](_['keys'](_0x3c5383),[_0x0d8a('0x79'),'updatedAt']);_0x514e6d=_[_0x0d8a('0x7a')](_['keys'](_0x3c5383),[_0x0d8a('0x79'),_0x0d8a('0x7b'),'CompanyId','ListId']);_0xc0e3d5[_0x0d8a('0x5f')]={'mapKey':'mobile'};if(_0xc0e3d5[_0x0d8a('0x75')]['type']){switch(_0xc0e3d5['account'][_0x0d8a('0x4b')]){case _0x0d8a('0x7c'):_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x7d')]=_0x186981[_0x0d8a('0x5f')][_0x0d8a('0x7e')];_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x5f')]=_0x186981[_0x0d8a('0x5f')][_0x0d8a('0x7f')];_0xc0e3d5['body']['messageId']=_0x186981[_0x0d8a('0x5f')][_0x0d8a('0x80')];break;case _0x0d8a('0x81'):_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x7d')]='+'+_0x186981[_0x0d8a('0x5f')][_0x0d8a('0x82')];_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x5f')]=_0x186981[_0x0d8a('0x5f')]['text'];break;case'connectel':_0xc0e3d5[_0x0d8a('0x5f')]['from']=_0x186981[_0x0d8a('0x5f')]['from'];_0xc0e3d5[_0x0d8a('0x5f')]['body']=_0x186981['body'][_0x0d8a('0x24')];break;case _0x0d8a('0x83'):_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x7d')]=_0x186981[_0x0d8a('0x5f')]['from'];_0xc0e3d5['body'][_0x0d8a('0x5f')]=_0x186981[_0x0d8a('0x5f')][_0x0d8a('0x5f')];_0xc0e3d5['body']['messageId']=_0x186981[_0x0d8a('0x5f')][_0x0d8a('0x84')];break;case'plivo':_0xc0e3d5['body'][_0x0d8a('0x7d')]=_0x186981[_0x0d8a('0x5f')][_0x0d8a('0x7e')];_0xc0e3d5['body'][_0x0d8a('0x5f')]=_0x186981['body'][_0x0d8a('0x85')];_0xc0e3d5[_0x0d8a('0x5f')]['messageId']=_0x186981[_0x0d8a('0x5f')][_0x0d8a('0x86')];break;case _0x0d8a('0x87'):_0xc0e3d5[_0x0d8a('0x5f')]['from']='+'+_0x186981['body'][_0x0d8a('0x88')][0x0][_0x0d8a('0x7d')];_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x5f')]=_0x186981[_0x0d8a('0x5f')][_0x0d8a('0x88')][0x0]['text'];_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x89')]=_0x186981[_0x0d8a('0x5f')][_0x0d8a('0x88')][0x0][_0x0d8a('0x89')];break;case'csc':_0xc0e3d5['body'][_0x0d8a('0x7d')]=_0x186981['body'][_0x0d8a('0x8a')];_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x5f')]=_0x186981[_0x0d8a('0x5f')][_0x0d8a('0x8b')][_0x0d8a('0x24')];break;case'clickatell':_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x7d')]=_0x186981[_0x0d8a('0x5f')][_0x0d8a('0x8c')];_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x5f')]=_0x186981['body'][_0x0d8a('0x8d')];_0xc0e3d5['body']['messageId']=_0x186981[_0x0d8a('0x5f')][_0x0d8a('0x8e')];break;case _0x0d8a('0x8f'):_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x89')]=_0x186981[_0x0d8a('0x5f')][0x0][_0x0d8a('0x24')]['id'];_0xc0e3d5[_0x0d8a('0x5f')]['from']=_0x186981[_0x0d8a('0x5f')][0x0][_0x0d8a('0x24')]['from'];_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x5f')]=_0x186981[_0x0d8a('0x5f')][0x0][_0x0d8a('0x24')]['text'];break;case _0x0d8a('0x90'):_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x7d')]=_0x186981[_0x0d8a('0x5f')][_0x0d8a('0x7d')];_0xc0e3d5['body']['body']=_0x186981[_0x0d8a('0x5f')][_0x0d8a('0x24')];_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x89')]=_0x186981['body']['refid'];break;}}if(_0xc0e3d5[_0x0d8a('0x5f')]['id']){delete _0xc0e3d5[_0x0d8a('0x5f')]['id'];}if(_['isNil'](_0xc0e3d5['body'][_0x0d8a('0x7d')])){throw new db[(_0x0d8a('0x76'))][(_0x0d8a('0x77'))](_0x0d8a('0x91'));}if(_['isNil'](_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x5f')])||_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x5f')]===''){throw new db[(_0x0d8a('0x76'))][(_0x0d8a('0x77'))](_0x0d8a('0x92'));}if(_[_0x0d8a('0x93')](_0xc0e3d5['body'][_0x0d8a('0x94')])){throw new db['Sequelize']['ValidationError'](_0x0d8a('0x95')+_0x514e6d);}if(!_[_0x0d8a('0x96')](_0x514e6d,_0xc0e3d5[_0x0d8a('0x5f')]['mapKey'])){throw new db[(_0x0d8a('0x76'))][(_0x0d8a('0x77'))](_0x0d8a('0x97')+_0x514e6d);}_0x603287[_0xc0e3d5['body'][_0x0d8a('0x94')]]=_0xc0e3d5['body']['from'];return db['CmList'][_0x0d8a('0x54')]({'where':{'id':_0xc0e3d5[_0x0d8a('0x75')][_0x0d8a('0x98')]},'include':[{'model':db[_0x0d8a('0x99')],'as':_0x0d8a('0x9a'),'where':_0x603287,'limit':0x1,'order':[['updatedAt',_0x0d8a('0x9b')]]}]});})[_0x0d8a('0x1f')](handleEntityNotFound(_0x45b827,null))[_0x0d8a('0x1f')](function(_0x529ba2){if(_0x529ba2){_0xc0e3d5[_0x0d8a('0x9c')]=_[_0x0d8a('0x9d')](_0x529ba2,[_0x0d8a('0x9a')]);if(_0x529ba2[_0x0d8a('0x9a')][_0x0d8a('0x44')]){return _0x529ba2[_0x0d8a('0x9a')][0x0];}var _0x3bfac1=_[_0x0d8a('0x9e')](_0xc0e3d5[_0x0d8a('0x5f')],{'firstName':_0xc0e3d5['body'][_0x0d8a('0x7d')],'ListId':_0x529ba2['id']});_0x3bfac1[_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x94')]]=_0xc0e3d5[_0x0d8a('0x5f')]['from'];return db[_0x0d8a('0x99')][_0x0d8a('0x55')](_0x3bfac1,{'fields':_0x370ac6,'raw':!![]});}})[_0x0d8a('0x1f')](handleEntityNotFound(_0x45b827,null))[_0x0d8a('0x1f')](function(_0x40348f){if(_0x40348f){_0xc0e3d5['contact']=_0x40348f;var _0x47b9d1={'ContactId':_0x40348f['id'],'phone':_0xc0e3d5[_0x0d8a('0x5f')]['from'],'SmsAccountId':_0x186981[_0x0d8a('0x52')]['id']};var _0x1bc5a2={'ContactId':_0x40348f['id'],'SmsAccountId':_0x186981[_0x0d8a('0x52')]['id'],'closed':![]};return db[_0x0d8a('0x9f')][_0x0d8a('0x54')]({'where':_0x1bc5a2})[_0x0d8a('0x1f')](function(_0x1d2f7c){if(_0x1d2f7c){return[_0x1d2f7c,![]];}return db[_0x0d8a('0x9f')]['create'](_0x47b9d1)[_0x0d8a('0x1f')](function(_0x5b0fd0){return[_0x5b0fd0,!![]];});});}})[_0x0d8a('0xa0')](function(_0x4905f7,_0x511f00){_0xc0e3d5[_0x0d8a('0xa1')]=_0x4905f7['get']({'plain':!![]});_0xc0e3d5[_0x0d8a('0xa1')][_0x0d8a('0xa2')]=![];if(_0x511f00){if(_0xc0e3d5['account'][_0x0d8a('0xa3')]){_0xc0e3d5[_0x0d8a('0x71')][_0x0d8a('0xa4')]({'id':0x0,'priority':_0xc0e3d5['applications'][_0x0d8a('0x44')]+0x1,'app':_0x0d8a('0xa5'),'appdata':_0x0d8a('0xa6'),'interval':'*,*,*,*'});}_0xc0e3d5[_0x0d8a('0xa1')][_0x0d8a('0xa2')]=!![];}return db['SmsMessage'][_0x0d8a('0x55')]({'phone':_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x7d')],'messageId':_0xc0e3d5[_0x0d8a('0x5f')]['messageId'],'body':_0xc0e3d5[_0x0d8a('0x5f')][_0x0d8a('0x5f')],'SmsAccountId':_0x186981['params']['id'],'SmsInteractionId':_0x4905f7['id'],'direction':'in','ContactId':_0x4905f7[_0x0d8a('0xa7')],'AttachmentId':_0xc0e3d5['body'][_0x0d8a('0xa8')]});})['then'](function(_0x577d48){_0xc0e3d5[_0x0d8a('0x24')]=_0x577d48;if(_0xc0e3d5['interaction']['UserId']){return db['User'][_0x0d8a('0x54')]({'attributes':['id',_0x0d8a('0x35')],'where':{'id':_0xc0e3d5[_0x0d8a('0xa1')][_0x0d8a('0xa9')]}})[_0x0d8a('0x1f')](function(_0x27b251){if(_0x27b251){_0xc0e3d5[_0x0d8a('0x71')][_0x0d8a('0xaa')]({'id':0x0,'priority':0x0,'app':_0x0d8a('0xab'),'appdata':_0x27b251[_0x0d8a('0x35')]+','+(_0xc0e3d5[_0x0d8a('0x75')]['waitForTheAssignedAgent']||0xa),'interval':_0x0d8a('0xac')});}return respondWithRpcPromise(_0x0d8a('0xad'),_0x0d8a('0xae'),_0xc0e3d5);});}return respondWithRpcPromise(_0x0d8a('0xad'),_0x0d8a('0xae'),_0xc0e3d5);})[_0x0d8a('0x1f')](function(_0x515fcb){if(_0x515fcb){var _0x3bde17=0xc8;var _0x39cc98=_0x0d8a('0xaf');logger[_0x0d8a('0x20')](_0x0d8a('0x22'),_0x39cc98,_0x3bde17,_0x0d8a('0xb0'));logger['debug'](_0x0d8a('0xb1'),_0x39cc98,_0x3bde17,'entity\x20found',JSON[_0x0d8a('0xb2')](_0x515fcb));if(_0xc0e3d5[_0x0d8a('0x75')][_0x0d8a('0x4b')]===_0x0d8a('0x7c')){return _0x45b827[_0x0d8a('0x28')](_0x3bde17)[_0x0d8a('0x2e')]('Content-Type','text/xml')[_0x0d8a('0xb3')](_0x0d8a('0xb4'));}else{return _0x45b827[_0x0d8a('0x28')](_0x3bde17)[_0x0d8a('0x2a')](_0x515fcb);}}})[_0x0d8a('0x26')](handleError(_0x45b827,null));};exports['addApplications']=function(_0x1ea347,_0x467eca){var _0x10e38a=_0x1ea347[_0x0d8a('0x52')]['id'];var _0x1ad1e2=_0x1ea347[_0x0d8a('0x5f')];var _0x5ef1a5=0xc8;var _0x370c5a=null;return db['sequelize'][_0x0d8a('0xb5')]({'isolationLevel':db['sequelize'][_0x0d8a('0xb6')][_0x0d8a('0xb7')][_0x0d8a('0xb8')]},function(_0x516167){return db['SmsAccount'][_0x0d8a('0x65')]({'where':{'id':_0x10e38a},'transaction':_0x516167})[_0x0d8a('0x1f')](function(_0x3373a5){if(_0x3373a5){return db['SmsApplication']['destroy']({'where':{'SmsAccountId':_0x10e38a},'transaction':_0x516167})[_0x0d8a('0x1f')](function(){var _0x481074=_['map'](_0x1ad1e2,function(_0x201573){_0x201573[_0x0d8a('0x62')]=_0x10e38a;return _0x201573;});return db[_0x0d8a('0x6f')][_0x0d8a('0xb9')](_0x481074,{'transaction':_0x516167});});}else{_0x5ef1a5=0x194;_0x370c5a=[];}});})[_0x0d8a('0x1f')](function(){if(_0x5ef1a5!==0x194){return db[_0x0d8a('0x6f')]['findAndCountAll']({'where':{'SmsAccountId':_0x10e38a},'order':'priority'})[_0x0d8a('0x1f')](function(_0x345000){_0x370c5a=_0x345000;});}})[_0x0d8a('0x26')](function(_0x255da5){_0x5ef1a5=0x1f4;logger[_0x0d8a('0x23')](_0x255da5['stack']);if(_0x255da5[_0x0d8a('0x35')]){delete _0x255da5['name'];}_0x370c5a=_0x255da5;})['finally'](function(){if(_0x370c5a===null){_0x467eca[_0x0d8a('0x27')](_0x5ef1a5);}else{if(_0x5ef1a5===0x1f4){_0x467eca[_0x0d8a('0x28')](_0x5ef1a5)[_0x0d8a('0xb3')](_0x370c5a);}else{_0x467eca[_0x0d8a('0x28')](_0x5ef1a5)[_0x0d8a('0x2a')](_0x370c5a);}}});};exports[_0x0d8a('0xba')]=function(_0x123610,_0x2cc86b,_0x40c1fa){var _0x37a070={};var _0x996b5d={};var _0x5ea85a;var _0xf109d6;return db[_0x0d8a('0x3a')][_0x0d8a('0x65')]({'where':{'id':_0x123610['params']['id']}})[_0x0d8a('0x1f')](handleEntityNotFound(_0x2cc86b,null))['then'](function(_0x139eb5){if(_0x139eb5){_0x5ea85a=_0x139eb5;_0x996b5d['model']=_['keys'](db[_0x0d8a('0x6f')][_0x0d8a('0x3b')]);_0x996b5d[_0x0d8a('0x3e')]=_['keys'](_0x123610['query']);_0x996b5d['filters']=_[_0x0d8a('0x41')](_0x996b5d[_0x0d8a('0x3d')],_0x996b5d[_0x0d8a('0x3e')]);_0x37a070[_0x0d8a('0x43')]=_[_0x0d8a('0x41')](_0x996b5d[_0x0d8a('0x3d')],qs[_0x0d8a('0x42')](_0x123610[_0x0d8a('0x3e')]['fields']));_0x37a070[_0x0d8a('0x43')]=_0x37a070[_0x0d8a('0x43')][_0x0d8a('0x44')]?_0x37a070[_0x0d8a('0x43')]:_0x996b5d['model'];_0x37a070[_0x0d8a('0x6c')]=qs[_0x0d8a('0x47')](_0x123610[_0x0d8a('0x3e')][_0x0d8a('0x47')]);_0x37a070[_0x0d8a('0x4a')]=qs['filters'](_['pick'](_0x123610[_0x0d8a('0x3e')],_0x996b5d['filters']));if(_0x123610[_0x0d8a('0x3e')][_0x0d8a('0x49')]){_0x37a070['where']=_[_0x0d8a('0x4d')](_0x37a070[_0x0d8a('0x4a')],{'$or':_[_0x0d8a('0x39')](_0x37a070['attributes'],function(_0x3553d7){var _0xcbb19c={};_0xcbb19c[_0x3553d7]={'$like':'%'+_0x123610[_0x0d8a('0x3e')]['filter']+'%'};return _0xcbb19c;})});}_0x37a070=_[_0x0d8a('0x4d')]({},_0x37a070,_0x123610[_0x0d8a('0x53')]);return _0x5ea85a[_0x0d8a('0xba')](_0x37a070);}})[_0x0d8a('0x1f')](function(_0x5a988b){if(_0x5a988b){_0xf109d6=_0x5a988b[_0x0d8a('0x44')];if(!_0x123610['query'][_0x0d8a('0x45')](_0x0d8a('0x66'))){_0x37a070['limit']=qs[_0x0d8a('0x46')](_0x123610['query'][_0x0d8a('0x46')]);_0x37a070['offset']=qs['offset'](_0x123610[_0x0d8a('0x3e')][_0x0d8a('0x2b')]);}return _0x5ea85a[_0x0d8a('0xba')](_0x37a070);}})[_0x0d8a('0x1f')](function(_0x2df094){if(_0x2df094){return _0x2df094?{'count':_0xf109d6,'rows':_0x2df094}:null;}})[_0x0d8a('0x1f')](respondWithResult(_0x2cc86b,null))['catch'](handleError(_0x2cc86b,null));};exports['getInteractions']=function(_0x3bb950,_0x26595c,_0x42f33d){var _0x3efcbc={'raw':![],'where':{}};var _0x22a5ce={};var _0x529068={'count':0x0,'rows':[]};return db[_0x0d8a('0x3a')][_0x0d8a('0x65')]({'where':{'id':_0x3bb950[_0x0d8a('0x52')]['id']}})[_0x0d8a('0x1f')](handleEntityNotFound(_0x26595c,null))[_0x0d8a('0x1f')](function(_0x6c5ea3){if(_0x6c5ea3){_0x22a5ce[_0x0d8a('0x3d')]=_[_0x0d8a('0x3f')](db[_0x0d8a('0x9f')][_0x0d8a('0x3b')]);_0x22a5ce['query']=_[_0x0d8a('0x3f')](_0x3bb950[_0x0d8a('0x3e')]);_0x22a5ce[_0x0d8a('0x40')]=_[_0x0d8a('0x41')](_0x22a5ce[_0x0d8a('0x3d')],_0x22a5ce[_0x0d8a('0x3e')]);_0x3efcbc[_0x0d8a('0x43')]=_[_0x0d8a('0x41')](_0x22a5ce[_0x0d8a('0x3d')],qs[_0x0d8a('0x42')](_0x3bb950[_0x0d8a('0x3e')][_0x0d8a('0x42')]));_0x3efcbc[_0x0d8a('0x43')]=_0x3efcbc[_0x0d8a('0x43')]['length']?_0x3efcbc[_0x0d8a('0x43')]:_0x22a5ce['model'];if(!_0x3bb950[_0x0d8a('0x3e')][_0x0d8a('0x45')]('nolimit')){_0x3efcbc['limit']=qs[_0x0d8a('0x46')](_0x3bb950['query'][_0x0d8a('0x46')]);_0x3efcbc[_0x0d8a('0x2b')]=qs[_0x0d8a('0x2b')](_0x3bb950['query'][_0x0d8a('0x2b')]);}_0x3efcbc['order']=qs['sort'](_0x3bb950[_0x0d8a('0x3e')][_0x0d8a('0x47')]);_0x3efcbc[_0x0d8a('0x4a')]=qs['filters'](_[_0x0d8a('0x48')](_0x3bb950[_0x0d8a('0x3e')],_0x22a5ce[_0x0d8a('0x40')]));_0x3efcbc[_0x0d8a('0x4a')][_0x0d8a('0x62')]=_0x6c5ea3['id'];if(_0x3bb950[_0x0d8a('0x3e')][_0x0d8a('0x49')]){_0x3efcbc[_0x0d8a('0x4a')]=_['merge'](_0x3efcbc[_0x0d8a('0x4a')],{'$or':_[_0x0d8a('0x39')](_0x3efcbc[_0x0d8a('0x43')],function(_0x18ebd2){var _0xee884f={};_0xee884f[_0x18ebd2]={'$like':'%'+_0x3bb950[_0x0d8a('0x3e')]['filter']+'%'};return _0xee884f;})});}_0x3efcbc=_[_0x0d8a('0x4d')]({},_0x3efcbc,_0x3bb950[_0x0d8a('0x53')]);return db[_0x0d8a('0x9f')]['count']({'where':_0x3efcbc['where']})['then'](function(_0x408b41){_0x529068[_0x0d8a('0x2d')]=_0x408b41;if(_0x3bb950[_0x0d8a('0x3e')][_0x0d8a('0x4e')]){_0x3efcbc['include']=[{'model':db[_0x0d8a('0x99')],'as':'Contact','required':![]},{'model':db[_0x0d8a('0xbb')],'as':'Owner','attributes':[_0x0d8a('0x35'),_0x0d8a('0xbc'),_0x0d8a('0xbd')],'required':![]},{'model':db[_0x0d8a('0xbe')],'as':_0x0d8a('0xbf'),'attributes':['id',_0x0d8a('0x35'),_0x0d8a('0xc0')],'where':_0x3bb950[_0x0d8a('0x3e')][_0x0d8a('0xc1')]?{'id':_0x3bb950['query']['tag']}:undefined,'required':_0x3bb950[_0x0d8a('0x3e')][_0x0d8a('0xc1')]?!![]:![]}];}return db[_0x0d8a('0x9f')]['findAll'](_0x3efcbc);})[_0x0d8a('0x1f')](function(_0xce9479){_0x529068['rows']=_0xce9479;return _0x529068;});}})['then'](respondWithFilteredResult(_0x26595c,_0x3efcbc))['catch'](handleError(_0x26595c,null));};exports[_0x0d8a('0xb3')]=function(_0x27593a,_0xd59828,_0x2f91e1){var _0x159d7a,_0x43742f,_0x4762fe;if(_[_0x0d8a('0x93')](_0x27593a[_0x0d8a('0x5f')][_0x0d8a('0x5f')])||_0x27593a[_0x0d8a('0x5f')]['body']===''){throw new db[(_0x0d8a('0x76'))][(_0x0d8a('0x77'))](_0x0d8a('0x92'));}if(_['isNil'](_0x27593a[_0x0d8a('0x5f')]['to'])){throw new db[(_0x0d8a('0x76'))][(_0x0d8a('0x77'))](_0x0d8a('0xc2'));}_0x159d7a=_0x27593a[_0x0d8a('0x5f')]['to'];return db['SmsAccount'][_0x0d8a('0x54')]({'where':{'id':_0x27593a['params']['id']},'include':[{'model':db['CmList'],'as':_0x0d8a('0xc3'),'include':[{'model':db[_0x0d8a('0x99')],'as':_0x0d8a('0x9a'),'where':{'mobile':_0x159d7a},'limit':0x1,'order':[['updatedAt',_0x0d8a('0x9b')]]}]}]})['then'](handleEntityNotFound(_0xd59828,null))[_0x0d8a('0x1f')](function(_0x1aea2f){if(_0x1aea2f&&_0x1aea2f['List']){_0x43742f=_0x1aea2f[_0x0d8a('0x33')]({'plain':!![]});if(_0x43742f[_0x0d8a('0xc3')]&&_0x43742f[_0x0d8a('0xc3')]['Contacts']['length']){return _0x43742f[_0x0d8a('0xc3')][_0x0d8a('0x9a')][0x0];}return db[_0x0d8a('0x99')][_0x0d8a('0x55')](_['defaults'](_0x27593a[_0x0d8a('0x5f')],{'firstName':_0x159d7a,'mobile':_0x159d7a,'phone':_0x159d7a,'ListId':_0x43742f['ListId']}));}})[_0x0d8a('0x1f')](handleEntityNotFound(_0xd59828,null))[_0x0d8a('0x1f')](function(_0x56fad4){if(_0x56fad4){_0x4762fe=_0x56fad4;return db[_0x0d8a('0x9f')][_0x0d8a('0x54')]({'where':{'ContactId':_0x4762fe['id'],'closed':![],'SmsAccountId':_0x43742f['id']}})['then'](function(_0x20e54d){if(_0x20e54d){return[_0x20e54d,![]];}return db['SmsInteraction'][_0x0d8a('0x55')]({'UserId':_0x27593a[_0x0d8a('0x56')]['id'],'ContactId':_0x4762fe['id'],'SmsAccountId':_0x43742f['id'],'phone':_0x159d7a,'firstMsgDirection':_0x0d8a('0xc4'),'Messages':[_[_0x0d8a('0x4d')](_0x27593a[_0x0d8a('0x5f')],{'read':![],'body':_0x27593a['body']['body'],'phone':_0x159d7a,'SmsAccountId':_0x43742f['id'],'UserId':_0x27593a['user']['id'],'ContactId':_0x4762fe['id']})]},{'include':[{'model':db[_0x0d8a('0xc5')],'as':_0x0d8a('0xc6')}]})[_0x0d8a('0x1f')](function(_0x105ad4){return[_0x105ad4,!![]];});});}})[_0x0d8a('0xa0')](function(_0x30decb,_0x4af313){if(_0x4af313){return _0x30decb;}return db[_0x0d8a('0xc5')]['create'](_[_0x0d8a('0x4d')](_0x27593a[_0x0d8a('0x5f')],{'read':![],'body':_0x27593a[_0x0d8a('0x5f')]['body'],'phone':_0x159d7a,'SmsAccountId':_0x43742f['id'],'SmsInteractionId':_0x30decb['id'],'UserId':_0x27593a[_0x0d8a('0x56')]['id'],'ContactId':_0x4762fe['id']}))['then'](function(_0x131348){_0x30decb[_0x0d8a('0xc7')]['Messages']=[];_0x30decb['dataValues'][_0x0d8a('0xc6')][_0x0d8a('0xa4')](_0x131348[_0x0d8a('0xc7')]);return _0x30decb;});})[_0x0d8a('0x1f')](respondWithResult(_0xd59828,null))['catch'](handleError(_0xd59828,null));};exports['status']=function(_0x5ec690,_0x37e5de,_0x301712){if(_0x5ec690['body']['id']){delete _0x5ec690[_0x0d8a('0x5f')]['id'];}var _0x131937,_0x3a9902,_0x2f7964;return db[_0x0d8a('0x3a')][_0x0d8a('0x54')]({'where':{'id':_0x5ec690[_0x0d8a('0x52')]['id']}})[_0x0d8a('0x1f')](handleEntityNotFound(_0x37e5de,null))['then'](function(_0x35692a){if(_0x35692a){_0x2f7964=_0x35692a;logger[_0x0d8a('0xc8')](_0x0d8a('0x22'),'status',_0x0d8a('0xc9'),_0x35692a[_0x0d8a('0x4b')],util[_0x0d8a('0xca')](_0x5ec690[_0x0d8a('0x5f')],{'showHidden':![],'depth':null}));switch(_0x35692a['type']){case _0x0d8a('0x81'):if(_0x5ec690[_0x0d8a('0x5f')][_0x0d8a('0xcb')]&&_0x5ec690['body'][_0x0d8a('0x28')]){_0x3a9902=_0x5ec690['body'][_0x0d8a('0x28')];return db[_0x0d8a('0xc5')][_0x0d8a('0x54')]({'where':{'messageId':_0x5ec690['body'][_0x0d8a('0xcb')]}});}break;case _0x0d8a('0xcc'):if(_0x5ec690['body'][_0x0d8a('0xcd')]&&_0x5ec690['body'][_0x0d8a('0xce')]){_0x3a9902=_0x5ec690[_0x0d8a('0x5f')]['statusInt'];return db['SmsMessage']['find']({'where':{'messageId':_0x5ec690['body'][_0x0d8a('0xcd')]}});}break;case _0x0d8a('0x83'):if(_0x5ec690[_0x0d8a('0x5f')][_0x0d8a('0x84')]&&_0x5ec690[_0x0d8a('0x5f')][_0x0d8a('0xcf')]){_0x3a9902=_0x5ec690[_0x0d8a('0x5f')]['status_code'];return db[_0x0d8a('0xc5')]['find']({'where':{'messageId':_0x5ec690[_0x0d8a('0x5f')]['message_id']}});}break;case _0x0d8a('0x87'):var _0x209e73=_0x5ec690[_0x0d8a('0x5f')][_0x0d8a('0x88')][0x0];if(_0x209e73[_0x0d8a('0x89')]&&_0x209e73[_0x0d8a('0x28')]['groupName']===_0x0d8a('0xd0')){_0x3a9902=_0x209e73['status']['groupName'];return db[_0x0d8a('0xc5')][_0x0d8a('0x54')]({'where':{'messageId':_0x209e73[_0x0d8a('0x89')]}});}break;case'clickatell':if(_0x5ec690[_0x0d8a('0x5f')][_0x0d8a('0x89')]&&_0x5ec690[_0x0d8a('0x5f')][_0x0d8a('0x28')]){_0x3a9902=_0x5ec690[_0x0d8a('0x5f')][_0x0d8a('0x28')];return db['SmsMessage'][_0x0d8a('0x54')]({'where':{'messageId':_0x5ec690['body']['messageId']}});}break;case'bandwidth':if(_0x5ec690[_0x0d8a('0x5f')][0x0]['message']['id']){_0x3a9902=_0x5ec690[_0x0d8a('0x5f')][0x0][_0x0d8a('0x4b')];return db['SmsMessage'][_0x0d8a('0x54')]({'where':{'messageId':_0x5ec690[_0x0d8a('0x5f')][0x0][_0x0d8a('0x24')]['id']}});}break;case'intelepeer':if(_0x5ec690[_0x0d8a('0x5f')]['redif']&&_0x5ec690[_0x0d8a('0x5f')]['status']){_0x3a9902=_0x5ec690[_0x0d8a('0x5f')][_0x0d8a('0x28')];return db[_0x0d8a('0xc5')][_0x0d8a('0x54')]({'where':{'messageId':_0x5ec690[_0x0d8a('0x5f')][_0x0d8a('0xd1')]}});}break;}}})[_0x0d8a('0x1f')](handleEntityNotFound(_0x37e5de,null))['then'](function(_0x1900b0){if(_0x1900b0){_0x131937=_0x1900b0;switch(_0x2f7964['type']){case _0x0d8a('0x81'):if(_0x3a9902===_0x0d8a('0xd0')){return _0x131937['update']({'read':!![]});}else{logger[_0x0d8a('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0d8a('0x28'),_0x0d8a('0x81'),util[_0x0d8a('0xca')](_0x5ec690['body'],{'showHidden':![],'depth':null}));}break;case _0x0d8a('0xcc'):if(_0x3a9902==='1'){return _0x131937[_0x0d8a('0x5e')]({'read':!![]});}else{logger[_0x0d8a('0x23')](_0x0d8a('0x22'),_0x0d8a('0x28'),'skebby',util[_0x0d8a('0xca')](_0x5ec690[_0x0d8a('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x0d8a('0x83'):if(!_0x5ec690['body'][_0x0d8a('0xd2')]&&_0x3a9902>=0xc8&&_0x3a9902<=0xce){return _0x131937[_0x0d8a('0x5e')]({'read':!![]});}else{logger['error'](_0x0d8a('0x22'),'status','clicksend',util[_0x0d8a('0xca')](_0x5ec690[_0x0d8a('0x5f')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x418a69=_0x5ec690[_0x0d8a('0x5f')][_0x0d8a('0x88')][0x0];if(_0x418a69[_0x0d8a('0x28')][_0x0d8a('0xd3')]===_0x0d8a('0xd0')){return _0x131937[_0x0d8a('0x5e')]({'read':!![]});}else{logger['error'](_0x0d8a('0x22'),'status',_0x0d8a('0x87'),util[_0x0d8a('0xca')](_0x5ec690[_0x0d8a('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x0d8a('0xd4'):if(_0x3a9902==_0x0d8a('0xd5')||_0x3a9902==_0x0d8a('0xd6')){return _0x131937['update']({'read':!![]});}else{logger[_0x0d8a('0x23')](_0x0d8a('0x22'),_0x0d8a('0x28'),_0x0d8a('0xd4'),util[_0x0d8a('0xca')](_0x5ec690[_0x0d8a('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x0d8a('0x8f'):if(_0x3a9902==_0x0d8a('0xd7')){return _0x131937[_0x0d8a('0x5e')]({'read':!![]});}else{logger[_0x0d8a('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x0d8a('0x8f'),util['inspect'](_0x5ec690[_0x0d8a('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x0d8a('0x90'):if(_0x3a9902===_0x0d8a('0xd8')||_0x3a9902==='ACCEPTD'){return _0x131937[_0x0d8a('0x5e')]({'read':!![]});}else{logger['error'](_0x0d8a('0x22'),'status','intelepeer',util[_0x0d8a('0xca')](_0x5ec690['body'],{'showHidden':![],'depth':null}));}break;}return _0x131937;}})['then'](respondWithResult(_0x37e5de,null))[_0x0d8a('0x26')](handleError(_0x37e5de,null));};exports['statusGet']=function(_0x2922e4,_0x503f32,_0x3a4d7d){var _0x21ffa6,_0x5a59d5,_0x4388ba;return db[_0x0d8a('0x3a')]['find']({'where':{'id':_0x2922e4[_0x0d8a('0x52')]['id']}})[_0x0d8a('0x1f')](handleEntityNotFound(_0x503f32,null))[_0x0d8a('0x1f')](function(_0x5ee23e){if(_0x5ee23e){_0x4388ba=_0x5ee23e;logger[_0x0d8a('0xc8')](_0x0d8a('0x22'),_0x0d8a('0x28'),_0x0d8a('0xc9'),_0x5ee23e[_0x0d8a('0x4b')],util[_0x0d8a('0xca')](_0x2922e4[_0x0d8a('0x3e')],{'showHidden':![],'depth':null}));switch(_0x5ee23e[_0x0d8a('0x4b')]){case'csc':if(_0x2922e4[_0x0d8a('0x3e')][_0x0d8a('0xd9')]&&_0x2922e4['query'][_0x0d8a('0xda')]){_0x5a59d5=_0x2922e4[_0x0d8a('0x3e')][_0x0d8a('0xda')];return db[_0x0d8a('0xc5')][_0x0d8a('0x54')]({'where':{'messageId':_0x2922e4[_0x0d8a('0x3e')][_0x0d8a('0xd9')]}});}break;}}})[_0x0d8a('0x1f')](handleEntityNotFound(_0x503f32,null))[_0x0d8a('0x1f')](function(_0x12077c){if(_0x12077c){_0x21ffa6=_0x12077c;switch(_0x4388ba['type']){case _0x0d8a('0xdb'):if(_0x5a59d5==='2'||_0x5a59d5==='6'){return _0x21ffa6[_0x0d8a('0x5e')]({'read':!![]});}else{logger[_0x0d8a('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0d8a('0x28'),_0x0d8a('0xdb'),util[_0x0d8a('0xca')](_0x2922e4[_0x0d8a('0x3e')],{'showHidden':![],'depth':null}));};break;}return _0x21ffa6;}})[_0x0d8a('0x1f')](respondWithResult(_0x503f32,null))['catch'](handleError(_0x503f32,null));};exports['addAgents']=function(_0x2b8d38,_0x309c3a,_0x49e68d){return db['SmsAccount'][_0x0d8a('0x54')]({'where':{'id':_0x2b8d38['params']['id']}})[_0x0d8a('0x1f')](handleEntityNotFound(_0x309c3a,null))[_0x0d8a('0x1f')](function(_0x5478fb){if(_0x5478fb){return _0x5478fb['addAgents'](_0x2b8d38[_0x0d8a('0x5f')][_0x0d8a('0x6e')],_[_0x0d8a('0x9d')](_0x2b8d38[_0x0d8a('0x5f')],['ids','id'])||{})['spread'](function(_0x17ba8b){for(var _0x4f5b9d=0x0;_0x4f5b9d<_0x2b8d38['body'][_0x0d8a('0x6e')][_0x0d8a('0x44')];_0x4f5b9d+=0x1){socket[_0x0d8a('0xdc')](_0x0d8a('0xdd'),{'UserId':Number(_0x2b8d38[_0x0d8a('0x5f')][_0x0d8a('0x6e')][_0x4f5b9d]),'SmsAccountId':Number(_0x2b8d38[_0x0d8a('0x52')]['id'])});}return _0x17ba8b;});}})['then'](respondWithResult(_0x309c3a,null))[_0x0d8a('0x26')](handleError(_0x309c3a,null));};exports[_0x0d8a('0xde')]=function(_0x3bf85f,_0x10635b,_0x54f7b0){return db['SmsAccount']['find']({'where':{'id':_0x3bf85f[_0x0d8a('0x52')]['id']}})[_0x0d8a('0x1f')](handleEntityNotFound(_0x10635b,null))[_0x0d8a('0x1f')](function(_0x41c946){if(_0x41c946){return _0x41c946[_0x0d8a('0xde')](_0x3bf85f[_0x0d8a('0x3e')][_0x0d8a('0x6e')])['then'](function(){if(_[_0x0d8a('0xdf')](_0x3bf85f[_0x0d8a('0x3e')][_0x0d8a('0x6e')])){for(var _0x485237=0x0;_0x485237<_0x3bf85f[_0x0d8a('0x3e')][_0x0d8a('0x6e')][_0x0d8a('0x44')];_0x485237+=0x1){socket[_0x0d8a('0xdc')]('userSmsAccount:remove',{'UserId':Number(_0x3bf85f['query'][_0x0d8a('0x6e')][_0x485237]),'SmsAccountId':Number(_0x3bf85f[_0x0d8a('0x52')]['id'])});}}else{socket['emit'](_0x0d8a('0xe0'),{'UserId':Number(_0x3bf85f[_0x0d8a('0x3e')][_0x0d8a('0x6e')]),'SmsAccountId':Number(_0x3bf85f['params']['id'])});}});}})[_0x0d8a('0x1f')](respondWithStatusCode(_0x10635b,null))['catch'](handleError(_0x10635b,null));};exports[_0x0d8a('0xe1')]=function(_0x49e682,_0x20567f,_0x15abf0){var _0x34291b={};var _0x55402a={};var _0x58c812;var _0x1c8f62;return db[_0x0d8a('0x3a')][_0x0d8a('0x65')]({'where':{'id':_0x49e682[_0x0d8a('0x52')]['id']}})['then'](handleEntityNotFound(_0x20567f,null))[_0x0d8a('0x1f')](function(_0xe3670f){if(_0xe3670f){_0x58c812=_0xe3670f;_0x55402a[_0x0d8a('0x3d')]=_[_0x0d8a('0x3f')](db[_0x0d8a('0xbb')]['rawAttributes']);_0x55402a[_0x0d8a('0x3e')]=_[_0x0d8a('0x3f')](_0x49e682['query']);_0x55402a['filters']=_['intersection'](_0x55402a['model'],_0x55402a['query']);_0x34291b[_0x0d8a('0x43')]=_[_0x0d8a('0x41')](_0x55402a[_0x0d8a('0x3d')],qs[_0x0d8a('0x42')](_0x49e682['query'][_0x0d8a('0x42')]));_0x34291b[_0x0d8a('0x43')]=_0x34291b[_0x0d8a('0x43')][_0x0d8a('0x44')]?_0x34291b['attributes']:_0x55402a[_0x0d8a('0x3d')];_0x34291b[_0x0d8a('0x6c')]=qs['sort'](_0x49e682[_0x0d8a('0x3e')][_0x0d8a('0x47')]);_0x34291b[_0x0d8a('0x4a')]=qs[_0x0d8a('0x40')](_[_0x0d8a('0x48')](_0x49e682[_0x0d8a('0x3e')],_0x55402a[_0x0d8a('0x40')]));if(_0x49e682['query']['filter']){_0x34291b[_0x0d8a('0x4a')]=_[_0x0d8a('0x4d')](_0x34291b[_0x0d8a('0x4a')],{'$or':_[_0x0d8a('0x39')](_0x34291b['attributes'],function(_0x4964dd){var _0x10aeff={};_0x10aeff[_0x4964dd]={'$like':'%'+_0x49e682['query']['filter']+'%'};return _0x10aeff;})});}_0x34291b=_[_0x0d8a('0x4d')]({},_0x34291b,_0x49e682['options']);return _0x58c812[_0x0d8a('0xe1')](_0x34291b);}})[_0x0d8a('0x1f')](function(_0x243712){if(_0x243712){_0x1c8f62=_0x243712['length'];if(!_0x49e682[_0x0d8a('0x3e')][_0x0d8a('0x45')](_0x0d8a('0x66'))){_0x34291b[_0x0d8a('0x46')]=qs[_0x0d8a('0x46')](_0x49e682[_0x0d8a('0x3e')][_0x0d8a('0x46')]);_0x34291b[_0x0d8a('0x2b')]=qs[_0x0d8a('0x2b')](_0x49e682[_0x0d8a('0x3e')][_0x0d8a('0x2b')]);}return _0x58c812['getAgents'](_0x34291b);}})['then'](function(_0x3967a0){if(_0x3967a0){return _0x3967a0?{'count':_0x1c8f62,'rows':_0x3967a0}:null;}})[_0x0d8a('0x1f')](respondWithResult(_0x20567f,null))[_0x0d8a('0x26')](handleError(_0x20567f,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index d44ebc1..3ad1675 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 _0x3c7b=['update','remove','hasOwnProperty','../../mysqldb','SmsAccount','setMaxListeners'];(function(_0xccf120,_0x9012b6){var _0x4cca8e=function(_0x191310){while(--_0x191310){_0xccf120['push'](_0xccf120['shift']());}};_0x4cca8e(++_0x9012b6);}(_0x3c7b,0x1b9));var _0xb3c7=function(_0x17c0b,_0x9f80b4){_0x17c0b=_0x17c0b-0x0;var _0x59ae42=_0x3c7b[_0x17c0b];return _0x59ae42;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xb3c7('0x0'))['db'][_0xb3c7('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xb3c7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb3c7('0x3'),'afterDestroy':_0xb3c7('0x4')};function emitEvent(_0x15e807){return function(_0x260f00,_0x33f873,_0x3e3cb3){SmsAccountEvents['emit'](_0x15e807+':'+_0x260f00['id'],_0x260f00);SmsAccountEvents['emit'](_0x15e807,_0x260f00);_0x3e3cb3(null);};}for(var e in events){if(events[_0xb3c7('0x5')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0xdcb5=['events','../../mysqldb','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports'];(function(_0x1e2165,_0x481c36){var _0x4b08d3=function(_0x3baeaf){while(--_0x3baeaf){_0x1e2165['push'](_0x1e2165['shift']());}};_0x4b08d3(++_0x481c36);}(_0xdcb5,0x1dd));var _0x5dcb=function(_0xb518e0,_0x241866){_0xb518e0=_0xb518e0-0x0;var _0xf96fb8=_0xdcb5[_0xb518e0];return _0xf96fb8;};'use strict';var EventEmitter=require(_0x5dcb('0x0'));var SmsAccount=require(_0x5dcb('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x5dcb('0x2')](0x0);var events={'afterCreate':_0x5dcb('0x3'),'afterUpdate':_0x5dcb('0x4'),'afterDestroy':_0x5dcb('0x5')};function emitEvent(_0x9066a6){return function(_0x5cc54a,_0x295c9d,_0x4b8c4f){SmsAccountEvents['emit'](_0x9066a6+':'+_0x5cc54a['id'],_0x5cc54a);SmsAccountEvents['emit'](_0x9066a6,_0x5cc54a);_0x4b8c4f(null);};}for(var e in events){if(events[_0x5dcb('0x6')](e)){var event=events[e];SmsAccount[_0x5dcb('0x7')](e,emitEvent(event));}}module[_0x5dcb('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 777d996..782eda4 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 _0x17ac=['request-promise','rimraf','../../config/environment','exports','define','SmsAccount','lodash','util','../../config/logger','api','bluebird'];(function(_0x521316,_0x45d823){var _0x15d8ce=function(_0x312f25){while(--_0x312f25){_0x521316['push'](_0x521316['shift']());}};_0x15d8ce(++_0x45d823);}(_0x17ac,0xcc));var _0xc17a=function(_0x41abba,_0x14ef1a){_0x41abba=_0x41abba-0x0;var _0x571010=_0x17ac[_0x41abba];return _0x571010;};'use strict';var _=require(_0xc17a('0x0'));var util=require(_0xc17a('0x1'));var logger=require(_0xc17a('0x2'))(_0xc17a('0x3'));var moment=require('moment');var BPromise=require(_0xc17a('0x4'));var rp=require(_0xc17a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc17a('0x6'));var config=require(_0xc17a('0x7'));var attributes=require('./smsAccount.attributes');module[_0xc17a('0x8')]=function(_0x3780fd,_0x5a7dd6){return _0x3780fd[_0xc17a('0x9')](_0xc17a('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5fd=['rimraf','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x179c97,_0x2b3b86){var _0x405e78=function(_0x494f5c){while(--_0x494f5c){_0x179c97['push'](_0x179c97['shift']());}};_0x405e78(++_0x2b3b86);}(_0xa5fd,0x186));var _0xda5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5fd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xda5f('0x0'));var util=require('util');var logger=require(_0xda5f('0x1'))(_0xda5f('0x2'));var moment=require(_0xda5f('0x3'));var BPromise=require(_0xda5f('0x4'));var rp=require(_0xda5f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xda5f('0x6'));var config=require('../../config/environment');var attributes=require(_0xda5f('0x7'));module[_0xda5f('0x8')]=function(_0x5316a0,_0x4954fc){return _0x5316a0[_0xda5f('0x9')](_0xda5f('0xa'),attributes,{'tableName':_0xda5f('0xb'),'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 51a9130..e81c73a 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 _0xac8b=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSmsAccount','SmsAccount','find','options','raw','include','map','model','attributes','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0xcdb3fa,_0x2b59e7){var _0x106dc0=function(_0x3c5f59){while(--_0x3c5f59){_0xcdb3fa['push'](_0xcdb3fa['shift']());}};_0x106dc0(++_0x2b59e7);}(_0xac8b,0x72));var _0xbac8=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0xac8b[_0x42f009];return _0x22a1e0;};'use strict';var _=require(_0xbac8('0x0'));var util=require(_0xbac8('0x1'));var moment=require(_0xbac8('0x2'));var BPromise=require(_0xbac8('0x3'));var rs=require(_0xbac8('0x4'));var fs=require('fs');var Redis=require(_0xbac8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbac8('0x6'));var logger=require(_0xbac8('0x7'))(_0xbac8('0x8'));var config=require(_0xbac8('0x9'));var jayson=require(_0xbac8('0xa'));var client=jayson[_0xbac8('0xb')][_0xbac8('0xc')]({'port':0x232a});config[_0xbac8('0xd')]=_[_0xbac8('0xe')](config[_0xbac8('0xd')],{'host':_0xbac8('0xf'),'port':0x18eb});var socket=require(_0xbac8('0x10'))(new Redis(config[_0xbac8('0xd')]));require(_0xbac8('0x11'))[_0xbac8('0x12')](socket);function respondWithRpcPromise(_0x2d7e9f,_0x307c05,_0x8db79e){return new BPromise(function(_0x1cd5a0,_0x345b9b){return client[_0xbac8('0x13')](_0x2d7e9f,_0x8db79e)[_0xbac8('0x14')](function(_0x17f62c){logger[_0xbac8('0x15')](_0xbac8('0x16'),_0x307c05,_0xbac8('0x17'));logger[_0xbac8('0x18')](_0xbac8('0x19'),_0x307c05,_0xbac8('0x17'),JSON[_0xbac8('0x1a')](_0x17f62c));if(_0x17f62c[_0xbac8('0x1b')]){if(_0x17f62c[_0xbac8('0x1b')][_0xbac8('0x1c')]===0x1f4){logger[_0xbac8('0x1b')](_0xbac8('0x16'),_0x307c05,_0x17f62c[_0xbac8('0x1b')][_0xbac8('0x1d')]);return _0x345b9b(_0x17f62c[_0xbac8('0x1b')][_0xbac8('0x1d')]);}logger['error'](_0xbac8('0x16'),_0x307c05,_0x17f62c[_0xbac8('0x1b')][_0xbac8('0x1d')]);return _0x1cd5a0(_0x17f62c[_0xbac8('0x1b')]['message']);}else{logger[_0xbac8('0x15')](_0xbac8('0x16'),_0x307c05,'request\x20sent');_0x1cd5a0(_0x17f62c['result']['message']);}})[_0xbac8('0x1e')](function(_0x385729){logger[_0xbac8('0x1b')]('SmsAccount,\x20%s,\x20%s',_0x307c05,_0x385729);_0x345b9b(_0x385729);});});}exports[_0xbac8('0x1f')]=function(_0x1beead){var _0x4197e1=this;return new Promise(function(_0x92ea7c,_0x4da90b){return db[_0xbac8('0x20')][_0xbac8('0x21')]({'raw':_0x1beead['options']?_0x1beead[_0xbac8('0x22')][_0xbac8('0x23')]===undefined?!![]:![]:!![],'where':_0x1beead[_0xbac8('0x22')]?_0x1beead[_0xbac8('0x22')]['where']||null:null,'attributes':_0x1beead[_0xbac8('0x22')]?_0x1beead[_0xbac8('0x22')]['attributes']||null:null,'include':_0x1beead[_0xbac8('0x22')]?_0x1beead[_0xbac8('0x22')][_0xbac8('0x24')]?_[_0xbac8('0x25')](_0x1beead[_0xbac8('0x22')][_0xbac8('0x24')],function(_0x557beb){return{'model':db[_0x557beb[_0xbac8('0x26')]],'as':_0x557beb['as'],'attributes':_0x557beb['attributes'],'include':_0x557beb['include']?_[_0xbac8('0x25')](_0x557beb[_0xbac8('0x24')],function(_0x731ccb){return{'model':db[_0x731ccb['model']],'as':_0x731ccb['as'],'attributes':_0x731ccb[_0xbac8('0x27')],'include':_0x731ccb[_0xbac8('0x24')]?_['map'](_0x731ccb['include'],function(_0x30fbc1){return{'model':db[_0x30fbc1[_0xbac8('0x26')]],'as':_0x30fbc1['as'],'attributes':_0x30fbc1[_0xbac8('0x27')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e2f8e){logger[_0xbac8('0x15')](_0xbac8('0x1f'),_0x1beead);logger[_0xbac8('0x18')]('ShowSmsAccount',_0x1beead,JSON[_0xbac8('0x1a')](_0x2e2f8e));_0x92ea7c(_0x2e2f8e);})[_0xbac8('0x1e')](function(_0x4395d4){logger[_0xbac8('0x1b')]('ShowSmsAccount',_0x4395d4[_0xbac8('0x1d')],_0x1beead);_0x4da90b(_0x4197e1[_0xbac8('0x1b')](0x1f4,_0x4395d4[_0xbac8('0x1d')]));});});}; \ No newline at end of file +var _0xe8d3=['find','options','raw','where','include','map','attributes','debug','stringify','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','error','code','message','ShowSmsAccount','SmsAccount'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe8d3,0x92));var _0x3e8d=function(_0x25606c,_0x46c895){_0x25606c=_0x25606c-0x0;var _0x14b9b8=_0xe8d3[_0x25606c];return _0x14b9b8;};'use strict';var _=require(_0x3e8d('0x0'));var util=require('util');var moment=require(_0x3e8d('0x1'));var BPromise=require(_0x3e8d('0x2'));var rs=require(_0x3e8d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e8d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e8d('0x5'))(_0x3e8d('0x6'));var config=require(_0x3e8d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3e8d('0x8')][_0x3e8d('0x9')]({'port':0x232a});config[_0x3e8d('0xa')]=_[_0x3e8d('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3e8d('0xc'))(new Redis(config['redis']));require(_0x3e8d('0xd'))[_0x3e8d('0xe')](socket);function respondWithRpcPromise(_0x1797b1,_0xca26b1,_0x564cb1){return new BPromise(function(_0x1bc71b,_0x56124a){return client['request'](_0x1797b1,_0x564cb1)[_0x3e8d('0xf')](function(_0x5e6c30){logger[_0x3e8d('0x10')](_0x3e8d('0x11'),_0xca26b1,'request\x20sent');logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xca26b1,_0x3e8d('0x12'),JSON['stringify'](_0x5e6c30));if(_0x5e6c30['error']){if(_0x5e6c30[_0x3e8d('0x13')][_0x3e8d('0x14')]===0x1f4){logger['error'](_0x3e8d('0x11'),_0xca26b1,_0x5e6c30[_0x3e8d('0x13')]['message']);return _0x56124a(_0x5e6c30[_0x3e8d('0x13')][_0x3e8d('0x15')]);}logger['error'](_0x3e8d('0x11'),_0xca26b1,_0x5e6c30['error'][_0x3e8d('0x15')]);return _0x1bc71b(_0x5e6c30[_0x3e8d('0x13')][_0x3e8d('0x15')]);}else{logger[_0x3e8d('0x10')](_0x3e8d('0x11'),_0xca26b1,_0x3e8d('0x12'));_0x1bc71b(_0x5e6c30['result'][_0x3e8d('0x15')]);}})['catch'](function(_0x48ad9e){logger[_0x3e8d('0x13')]('SmsAccount,\x20%s,\x20%s',_0xca26b1,_0x48ad9e);_0x56124a(_0x48ad9e);});});}exports[_0x3e8d('0x16')]=function(_0x10d10f){var _0x1533a1=this;return new Promise(function(_0x30d00e,_0x247958){return db[_0x3e8d('0x17')][_0x3e8d('0x18')]({'raw':_0x10d10f[_0x3e8d('0x19')]?_0x10d10f[_0x3e8d('0x19')][_0x3e8d('0x1a')]===undefined?!![]:![]:!![],'where':_0x10d10f[_0x3e8d('0x19')]?_0x10d10f[_0x3e8d('0x19')][_0x3e8d('0x1b')]||null:null,'attributes':_0x10d10f[_0x3e8d('0x19')]?_0x10d10f[_0x3e8d('0x19')]['attributes']||null:null,'include':_0x10d10f['options']?_0x10d10f['options'][_0x3e8d('0x1c')]?_[_0x3e8d('0x1d')](_0x10d10f[_0x3e8d('0x19')][_0x3e8d('0x1c')],function(_0x2eeaae){return{'model':db[_0x2eeaae['model']],'as':_0x2eeaae['as'],'attributes':_0x2eeaae[_0x3e8d('0x1e')],'include':_0x2eeaae[_0x3e8d('0x1c')]?_[_0x3e8d('0x1d')](_0x2eeaae[_0x3e8d('0x1c')],function(_0x2db1f1){return{'model':db[_0x2db1f1['model']],'as':_0x2db1f1['as'],'attributes':_0x2db1f1['attributes'],'include':_0x2db1f1[_0x3e8d('0x1c')]?_[_0x3e8d('0x1d')](_0x2db1f1[_0x3e8d('0x1c')],function(_0x4191df){return{'model':db[_0x4191df['model']],'as':_0x4191df['as'],'attributes':_0x4191df[_0x3e8d('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d1d26){logger['info']('ShowSmsAccount',_0x10d10f);logger[_0x3e8d('0x1f')]('ShowSmsAccount',_0x10d10f,JSON[_0x3e8d('0x20')](_0x4d1d26));_0x30d00e(_0x4d1d26);})[_0x3e8d('0x21')](function(_0x4743e2){logger[_0x3e8d('0x13')](_0x3e8d('0x16'),_0x4743e2[_0x3e8d('0x15')],_0x10d10f);_0x247958(_0x1533a1[_0x3e8d('0x13')](0x1f4,_0x4743e2[_0x3e8d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 3476e40..0f0044f 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 5581747..6ed7495 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(_0x47afe8,_0x42e85b){var _0x5af84e=function(_0x26a312){while(--_0x26a312){_0x47afe8['push'](_0x47afe8['shift']());}};_0x5af84e(++_0x42e85b);}(_0x7217,0x19e));var _0x7721=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x7217[_0x411add];return _0x238242;};'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 _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x572bea,_0x22f551){var _0x1bff8d=function(_0x16d3f3){while(--_0x16d3f3){_0x572bea['push'](_0x572bea['shift']());}};_0x1bff8d(++_0x22f551);}(_0x55ca,0x126));var _0xa55c=function(_0x13a102,_0x7f6c67){_0x13a102=_0x13a102-0x0;var _0x3a37d2=_0x55ca[_0x13a102];return _0x3a37d2;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 63eadfd..edec792 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 _0x668a=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x32bd8c,_0x3131b0){var _0x427caa=function(_0x44f09e){while(--_0x44f09e){_0x32bd8c['push'](_0x32bd8c['shift']());}};_0x427caa(++_0x3131b0);}(_0x668a,0x17f));var _0xa668=function(_0x1f552e,_0xb523ed){_0x1f552e=_0x1f552e-0x0;var _0x1e83b3=_0x668a[_0x1f552e];return _0x1e83b3;};'use strict';var Sequelize=require(_0xa668('0x0'));module[_0xa668('0x1')]={'priority':{'type':Sequelize[_0xa668('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa668('0x3')],'allowNull':![],'defaultValue':_0xa668('0x4')},'appdata':{'type':Sequelize[_0xa668('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xa668('0x3')],'defaultValue':_0xa668('0x6')}}; \ No newline at end of file +var _0x064a=['STRING','noop','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x3f7a0d,_0x29e65b){var _0x2f9129=function(_0x291172){while(--_0x291172){_0x3f7a0d['push'](_0x3f7a0d['shift']());}};_0x2f9129(++_0x29e65b);}(_0x064a,0xff));var _0xa064=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x064a[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xa064('0x0'));module[_0xa064('0x1')]={'priority':{'type':Sequelize[_0xa064('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa064('0x3')],'allowNull':![],'defaultValue':_0xa064('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xa064('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xa064('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 132837f..a10f786 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 _0xa6cc=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','index','map','SmsApplication','fieldName','type','key','query','keys','intersection','attributes','model','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','rawAttributes','fields','update','body','params','find','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3307c3,_0x27e0da){var _0x345e75=function(_0x12c5e9){while(--_0x12c5e9){_0x3307c3['push'](_0x3307c3['shift']());}};_0x345e75(++_0x27e0da);}(_0xa6cc,0x1a4));var _0xca6c=function(_0x45fe79,_0x23a48b){_0x45fe79=_0x45fe79-0x0;var _0x23720c=_0xa6cc[_0x45fe79];return _0x23720c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xca6c('0x0'));var jsonpatch=require(_0xca6c('0x1'));var rp=require(_0xca6c('0x2'));var moment=require(_0xca6c('0x3'));var BPromise=require(_0xca6c('0x4'));var Mustache=require('mustache');var util=require(_0xca6c('0x5'));var path=require('path');var sox=require(_0xca6c('0x6'));var csv=require(_0xca6c('0x7'));var ejs=require(_0xca6c('0x8'));var fs=require('fs');var fs_extra=require(_0xca6c('0x9'));var _=require('lodash');var squel=require(_0xca6c('0xa'));var crypto=require(_0xca6c('0xb'));var jsforce=require(_0xca6c('0xc'));var deskjs=require(_0xca6c('0xd'));var toCsv=require(_0xca6c('0x7'));var querystring=require(_0xca6c('0xe'));var Papa=require(_0xca6c('0xf'));var Redis=require(_0xca6c('0x10'));var authService=require(_0xca6c('0x11'));var qs=require(_0xca6c('0x12'));var as=require(_0xca6c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xca6c('0x14'))(_0xca6c('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xca6c('0x16'));var db=require(_0xca6c('0x17'))['db'];function respondWithStatusCode(_0x5aac96,_0xcf3ce6){_0xcf3ce6=_0xcf3ce6||0xcc;return function(_0x2ae8d1){if(_0x2ae8d1){return _0x5aac96[_0xca6c('0x18')](_0xcf3ce6);}return _0x5aac96[_0xca6c('0x19')](_0xcf3ce6)[_0xca6c('0x1a')]();};}function respondWithResult(_0x459c9e,_0x5b7678){_0x5b7678=_0x5b7678||0xc8;return function(_0x3579f8){if(_0x3579f8){return _0x459c9e[_0xca6c('0x19')](_0x5b7678)[_0xca6c('0x1b')](_0x3579f8);}};}function respondWithFilteredResult(_0x507b8d,_0x19665c){return function(_0x441b04){if(_0x441b04){var _0x3c65e3=typeof _0x19665c[_0xca6c('0x1c')]===_0xca6c('0x1d')&&typeof _0x19665c[_0xca6c('0x1e')]===_0xca6c('0x1d');var _0x499696=_0x441b04[_0xca6c('0x1f')];var _0x3fdace=_0x3c65e3?0x0:_0x19665c[_0xca6c('0x1c')];var _0x4809c2=_0x3c65e3?_0x441b04[_0xca6c('0x1f')]:_0x19665c[_0xca6c('0x1c')]+_0x19665c['limit'];var _0x2bc312;if(_0x4809c2>=_0x499696){_0x4809c2=_0x499696;_0x2bc312=0xc8;}else{_0x2bc312=0xce;}_0x507b8d[_0xca6c('0x19')](_0x2bc312);return _0x507b8d[_0xca6c('0x20')](_0xca6c('0x21'),_0x3fdace+'-'+_0x4809c2+'/'+_0x499696)[_0xca6c('0x1b')](_0x441b04);}return null;};}function patchUpdates(_0x25e509){return function(_0x1f6cfa){try{jsonpatch[_0xca6c('0x22')](_0x1f6cfa,_0x25e509,!![]);}catch(_0x528c13){return BPromise[_0xca6c('0x23')](_0x528c13);}return _0x1f6cfa[_0xca6c('0x24')]();};}function saveUpdates(_0x4014a2,_0x285aa0){return function(_0x5ca0b7){if(_0x5ca0b7){return _0x5ca0b7['update'](_0x4014a2)[_0xca6c('0x25')](function(_0x4e0249){return _0x4e0249;});}return null;};}function removeEntity(_0x5beca6,_0x56a633){return function(_0x97edd4){if(_0x97edd4){return _0x97edd4[_0xca6c('0x26')]()[_0xca6c('0x25')](function(){_0x5beca6[_0xca6c('0x19')](0xcc)[_0xca6c('0x1a')]();});}};}function handleEntityNotFound(_0x3da781,_0x5a7014){return function(_0x12ee8b){if(!_0x12ee8b){_0x3da781['sendStatus'](0x194);}return _0x12ee8b;};}function handleError(_0x256d75,_0x4dab7c){_0x4dab7c=_0x4dab7c||0x1f4;return function(_0xf1f673){logger['error'](_0xf1f673[_0xca6c('0x27')]);if(_0xf1f673[_0xca6c('0x28')]){delete _0xf1f673['name'];}_0x256d75[_0xca6c('0x19')](_0x4dab7c)['send'](_0xf1f673);};}exports[_0xca6c('0x29')]=function(_0x20e010,_0x333fd0){var _0x3a7270={},_0x14808d={},_0x3598e7={'count':0x0,'rows':[]};var _0x18dab4=_[_0xca6c('0x2a')](db[_0xca6c('0x2b')]['rawAttributes'],function(_0x16b20b){return{'name':_0x16b20b[_0xca6c('0x2c')],'type':_0x16b20b[_0xca6c('0x2d')][_0xca6c('0x2e')]};});_0x14808d['model']=_[_0xca6c('0x2a')](_0x18dab4,'name');_0x14808d[_0xca6c('0x2f')]=_[_0xca6c('0x30')](_0x20e010['query']);_0x14808d['filters']=_[_0xca6c('0x31')](_0x14808d['model'],_0x14808d[_0xca6c('0x2f')]);_0x3a7270[_0xca6c('0x32')]=_['intersection'](_0x14808d[_0xca6c('0x33')],qs['fields'](_0x20e010[_0xca6c('0x2f')]['fields']));_0x3a7270['attributes']=_0x3a7270[_0xca6c('0x32')][_0xca6c('0x34')]?_0x3a7270[_0xca6c('0x32')]:_0x14808d[_0xca6c('0x33')];if(!_0x20e010[_0xca6c('0x2f')][_0xca6c('0x35')](_0xca6c('0x36'))){_0x3a7270['limit']=qs['limit'](_0x20e010[_0xca6c('0x2f')]['limit']);_0x3a7270[_0xca6c('0x1c')]=qs['offset'](_0x20e010[_0xca6c('0x2f')][_0xca6c('0x1c')]);}_0x3a7270['order']=qs[_0xca6c('0x37')](_0x20e010[_0xca6c('0x2f')][_0xca6c('0x37')]);_0x3a7270[_0xca6c('0x38')]=qs[_0xca6c('0x39')](_[_0xca6c('0x3a')](_0x20e010[_0xca6c('0x2f')],_0x14808d[_0xca6c('0x39')]),_0x18dab4);if(_0x20e010[_0xca6c('0x2f')][_0xca6c('0x3b')]){_0x3a7270['where']=_[_0xca6c('0x3c')](_0x3a7270[_0xca6c('0x38')],{'$or':_['map'](_0x18dab4,function(_0x593a69){if(_0x593a69['type']!==_0xca6c('0x3d')){var _0x3f978f={};_0x3f978f[_0x593a69[_0xca6c('0x28')]]={'$like':'%'+_0x20e010['query'][_0xca6c('0x3b')]+'%'};return _0x3f978f;}})});}_0x3a7270=_['merge']({},_0x3a7270,_0x20e010[_0xca6c('0x3e')]);var _0x17b805={'where':_0x3a7270[_0xca6c('0x38')]};return db['SmsApplication'][_0xca6c('0x1f')](_0x17b805)[_0xca6c('0x25')](function(_0x1ffd45){_0x3598e7[_0xca6c('0x1f')]=_0x1ffd45;if(_0x20e010['query']['includeAll']){_0x3a7270[_0xca6c('0x3f')]=[{'all':!![]}];}return db[_0xca6c('0x2b')][_0xca6c('0x40')](_0x3a7270);})[_0xca6c('0x25')](function(_0x3f1b76){_0x3598e7[_0xca6c('0x41')]=_0x3f1b76;return _0x3598e7;})[_0xca6c('0x25')](respondWithFilteredResult(_0x333fd0,_0x3a7270))[_0xca6c('0x42')](handleError(_0x333fd0,null));};exports['show']=function(_0x1d5f6a,_0x41a633){var _0x2af6f1={'raw':!![],'where':{'id':_0x1d5f6a['params']['id']}},_0x3b0c1d={};_0x3b0c1d[_0xca6c('0x33')]=_[_0xca6c('0x30')](db[_0xca6c('0x2b')][_0xca6c('0x43')]);_0x3b0c1d['query']=_[_0xca6c('0x30')](_0x1d5f6a[_0xca6c('0x2f')]);_0x3b0c1d[_0xca6c('0x39')]=_[_0xca6c('0x31')](_0x3b0c1d[_0xca6c('0x33')],_0x3b0c1d['query']);_0x2af6f1['attributes']=_[_0xca6c('0x31')](_0x3b0c1d[_0xca6c('0x33')],qs['fields'](_0x1d5f6a[_0xca6c('0x2f')][_0xca6c('0x44')]));_0x2af6f1['attributes']=_0x2af6f1['attributes'][_0xca6c('0x34')]?_0x2af6f1[_0xca6c('0x32')]:_0x3b0c1d[_0xca6c('0x33')];if(_0x1d5f6a[_0xca6c('0x2f')]['includeAll']){_0x2af6f1['include']=[{'all':!![]}];}_0x2af6f1=_[_0xca6c('0x3c')]({},_0x2af6f1,_0x1d5f6a[_0xca6c('0x3e')]);return db[_0xca6c('0x2b')]['find'](_0x2af6f1)[_0xca6c('0x25')](handleEntityNotFound(_0x41a633,null))[_0xca6c('0x25')](respondWithResult(_0x41a633,null))[_0xca6c('0x42')](handleError(_0x41a633,null));};exports['create']=function(_0x5086b2,_0x14ff0c){return db['SmsApplication']['create'](_0x5086b2['body'],{})[_0xca6c('0x25')](respondWithResult(_0x14ff0c,0xc9))['catch'](handleError(_0x14ff0c,null));};exports[_0xca6c('0x45')]=function(_0x575a16,_0x669912){if(_0x575a16[_0xca6c('0x46')]['id']){delete _0x575a16[_0xca6c('0x46')]['id'];}return db[_0xca6c('0x2b')]['find']({'where':{'id':_0x575a16[_0xca6c('0x47')]['id']}})[_0xca6c('0x25')](handleEntityNotFound(_0x669912,null))['then'](saveUpdates(_0x575a16['body'],null))[_0xca6c('0x25')](respondWithResult(_0x669912,null))[_0xca6c('0x42')](handleError(_0x669912,null));};exports[_0xca6c('0x26')]=function(_0x2b309b,_0xdc2049){return db[_0xca6c('0x2b')][_0xca6c('0x48')]({'where':{'id':_0x2b309b['params']['id']}})[_0xca6c('0x25')](handleEntityNotFound(_0xdc2049,null))[_0xca6c('0x25')](removeEntity(_0xdc2049,null))[_0xca6c('0x42')](handleError(_0xdc2049,null));}; \ No newline at end of file +var _0x5599=['sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','count','limit','set','json','apply','reject','save','destroy','then','error','stack','name','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','update','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x5599,0x1c0));var _0x9559=function(_0xaf7e20,_0x45ca1c){_0xaf7e20=_0xaf7e20-0x0;var _0x507439=_0x5599[_0xaf7e20];return _0x507439;};'use strict';var emlformat=require(_0x9559('0x0'));var rimraf=require(_0x9559('0x1'));var zipdir=require(_0x9559('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9559('0x3'));var BPromise=require(_0x9559('0x4'));var Mustache=require(_0x9559('0x5'));var util=require(_0x9559('0x6'));var path=require(_0x9559('0x7'));var sox=require(_0x9559('0x8'));var csv=require('to-csv');var ejs=require(_0x9559('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9559('0xa'));var squel=require(_0x9559('0xb'));var crypto=require(_0x9559('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9559('0xd'));var toCsv=require(_0x9559('0xe'));var querystring=require(_0x9559('0xf'));var Papa=require(_0x9559('0x10'));var Redis=require(_0x9559('0x11'));var authService=require(_0x9559('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9559('0x13'))(_0x9559('0x14'));var utils=require(_0x9559('0x15'));var config=require(_0x9559('0x16'));var licenseUtil=require(_0x9559('0x17'));var db=require(_0x9559('0x18'))['db'];function respondWithStatusCode(_0x1fd7d9,_0x181576){_0x181576=_0x181576||0xcc;return function(_0x1d5a6a){if(_0x1d5a6a){return _0x1fd7d9[_0x9559('0x19')](_0x181576);}return _0x1fd7d9[_0x9559('0x1a')](_0x181576)[_0x9559('0x1b')]();};}function respondWithResult(_0x11d58f,_0x14bfb2){_0x14bfb2=_0x14bfb2||0xc8;return function(_0x51b5df){if(_0x51b5df){return _0x11d58f[_0x9559('0x1a')](_0x14bfb2)['json'](_0x51b5df);}};}function respondWithFilteredResult(_0x5d4d6e,_0x323510){return function(_0x1d4eb9){if(_0x1d4eb9){var _0x32911f=typeof _0x323510[_0x9559('0x1c')]==='undefined'&&typeof _0x323510['limit']==='undefined';var _0x5e711a=_0x1d4eb9[_0x9559('0x1d')];var _0x45c333=_0x32911f?0x0:_0x323510[_0x9559('0x1c')];var _0x5256ec=_0x32911f?_0x1d4eb9['count']:_0x323510[_0x9559('0x1c')]+_0x323510[_0x9559('0x1e')];var _0x5974c1;if(_0x5256ec>=_0x5e711a){_0x5256ec=_0x5e711a;_0x5974c1=0xc8;}else{_0x5974c1=0xce;}_0x5d4d6e[_0x9559('0x1a')](_0x5974c1);return _0x5d4d6e[_0x9559('0x1f')]('Content-Range',_0x45c333+'-'+_0x5256ec+'/'+_0x5e711a)[_0x9559('0x20')](_0x1d4eb9);}return null;};}function patchUpdates(_0x1a7dcf){return function(_0x2486bb){try{jsonpatch[_0x9559('0x21')](_0x2486bb,_0x1a7dcf,!![]);}catch(_0x1cf54d){return BPromise[_0x9559('0x22')](_0x1cf54d);}return _0x2486bb[_0x9559('0x23')]();};}function saveUpdates(_0xc45084,_0x5c3e05){return function(_0x5b0ccb){if(_0x5b0ccb){return _0x5b0ccb['update'](_0xc45084)['then'](function(_0x186217){return _0x186217;});}return null;};}function removeEntity(_0x26d233,_0xb8b188){return function(_0x4b4020){if(_0x4b4020){return _0x4b4020[_0x9559('0x24')]()[_0x9559('0x25')](function(){_0x26d233['status'](0xcc)[_0x9559('0x1b')]();});}};}function handleEntityNotFound(_0x3ecb3e,_0x12845b){return function(_0x21d49c){if(!_0x21d49c){_0x3ecb3e[_0x9559('0x19')](0x194);}return _0x21d49c;};}function handleError(_0x1d8dcc,_0x39a65a){_0x39a65a=_0x39a65a||0x1f4;return function(_0x45201b){logger[_0x9559('0x26')](_0x45201b[_0x9559('0x27')]);if(_0x45201b[_0x9559('0x28')]){delete _0x45201b[_0x9559('0x28')];}_0x1d8dcc[_0x9559('0x1a')](_0x39a65a)['send'](_0x45201b);};}exports[_0x9559('0x29')]=function(_0x1ace12,_0x1f1ff0){var _0x1eab04={},_0x1a068d={},_0xe4e0b7={'count':0x0,'rows':[]};var _0x3629a7=_[_0x9559('0x2a')](db[_0x9559('0x2b')][_0x9559('0x2c')],function(_0x57ab8c){return{'name':_0x57ab8c[_0x9559('0x2d')],'type':_0x57ab8c[_0x9559('0x2e')][_0x9559('0x2f')]};});_0x1a068d[_0x9559('0x30')]=_['map'](_0x3629a7,_0x9559('0x28'));_0x1a068d[_0x9559('0x31')]=_[_0x9559('0x32')](_0x1ace12[_0x9559('0x31')]);_0x1a068d[_0x9559('0x33')]=_['intersection'](_0x1a068d['model'],_0x1a068d[_0x9559('0x31')]);_0x1eab04['attributes']=_[_0x9559('0x34')](_0x1a068d['model'],qs[_0x9559('0x35')](_0x1ace12[_0x9559('0x31')][_0x9559('0x35')]));_0x1eab04['attributes']=_0x1eab04[_0x9559('0x36')][_0x9559('0x37')]?_0x1eab04[_0x9559('0x36')]:_0x1a068d[_0x9559('0x30')];if(!_0x1ace12[_0x9559('0x31')][_0x9559('0x38')]('nolimit')){_0x1eab04[_0x9559('0x1e')]=qs[_0x9559('0x1e')](_0x1ace12['query'][_0x9559('0x1e')]);_0x1eab04[_0x9559('0x1c')]=qs[_0x9559('0x1c')](_0x1ace12['query'][_0x9559('0x1c')]);}_0x1eab04[_0x9559('0x39')]=qs[_0x9559('0x3a')](_0x1ace12[_0x9559('0x31')]['sort']);_0x1eab04[_0x9559('0x3b')]=qs['filters'](_[_0x9559('0x3c')](_0x1ace12['query'],_0x1a068d[_0x9559('0x33')]),_0x3629a7);if(_0x1ace12[_0x9559('0x31')]['filter']){_0x1eab04['where']=_[_0x9559('0x3d')](_0x1eab04[_0x9559('0x3b')],{'$or':_['map'](_0x3629a7,function(_0x180129){if(_0x180129[_0x9559('0x2e')]!==_0x9559('0x3e')){var _0xad7fac={};_0xad7fac[_0x180129[_0x9559('0x28')]]={'$like':'%'+_0x1ace12['query'][_0x9559('0x3f')]+'%'};return _0xad7fac;}})});}_0x1eab04=_[_0x9559('0x3d')]({},_0x1eab04,_0x1ace12[_0x9559('0x40')]);var _0x36cf2c={'where':_0x1eab04[_0x9559('0x3b')]};return db['SmsApplication'][_0x9559('0x1d')](_0x36cf2c)[_0x9559('0x25')](function(_0x174b4e){_0xe4e0b7[_0x9559('0x1d')]=_0x174b4e;if(_0x1ace12[_0x9559('0x31')]['includeAll']){_0x1eab04[_0x9559('0x41')]=[{'all':!![]}];}return db[_0x9559('0x2b')][_0x9559('0x42')](_0x1eab04);})[_0x9559('0x25')](function(_0x5a1aac){_0xe4e0b7[_0x9559('0x43')]=_0x5a1aac;return _0xe4e0b7;})[_0x9559('0x25')](respondWithFilteredResult(_0x1f1ff0,_0x1eab04))[_0x9559('0x44')](handleError(_0x1f1ff0,null));};exports[_0x9559('0x45')]=function(_0x381962,_0x4cccf1){var _0x3987a9={'raw':!![],'where':{'id':_0x381962[_0x9559('0x46')]['id']}},_0x18fad9={};_0x18fad9[_0x9559('0x30')]=_[_0x9559('0x32')](db[_0x9559('0x2b')][_0x9559('0x2c')]);_0x18fad9[_0x9559('0x31')]=_[_0x9559('0x32')](_0x381962['query']);_0x18fad9[_0x9559('0x33')]=_[_0x9559('0x34')](_0x18fad9[_0x9559('0x30')],_0x18fad9[_0x9559('0x31')]);_0x3987a9[_0x9559('0x36')]=_[_0x9559('0x34')](_0x18fad9['model'],qs[_0x9559('0x35')](_0x381962[_0x9559('0x31')][_0x9559('0x35')]));_0x3987a9[_0x9559('0x36')]=_0x3987a9[_0x9559('0x36')][_0x9559('0x37')]?_0x3987a9[_0x9559('0x36')]:_0x18fad9[_0x9559('0x30')];if(_0x381962[_0x9559('0x31')][_0x9559('0x47')]){_0x3987a9[_0x9559('0x41')]=[{'all':!![]}];}_0x3987a9=_[_0x9559('0x3d')]({},_0x3987a9,_0x381962[_0x9559('0x40')]);return db['SmsApplication'][_0x9559('0x48')](_0x3987a9)[_0x9559('0x25')](handleEntityNotFound(_0x4cccf1,null))[_0x9559('0x25')](respondWithResult(_0x4cccf1,null))['catch'](handleError(_0x4cccf1,null));};exports['create']=function(_0x123d77,_0x50db6c){return db[_0x9559('0x2b')][_0x9559('0x49')](_0x123d77['body'],{})[_0x9559('0x25')](respondWithResult(_0x50db6c,0xc9))[_0x9559('0x44')](handleError(_0x50db6c,null));};exports[_0x9559('0x4a')]=function(_0x518d97,_0x551c5e){if(_0x518d97[_0x9559('0x4b')]['id']){delete _0x518d97[_0x9559('0x4b')]['id'];}return db[_0x9559('0x2b')]['find']({'where':{'id':_0x518d97[_0x9559('0x46')]['id']}})[_0x9559('0x25')](handleEntityNotFound(_0x551c5e,null))[_0x9559('0x25')](saveUpdates(_0x518d97[_0x9559('0x4b')],null))['then'](respondWithResult(_0x551c5e,null))[_0x9559('0x44')](handleError(_0x551c5e,null));};exports[_0x9559('0x24')]=function(_0x2c4f0a,_0x254875){return db['SmsApplication']['find']({'where':{'id':_0x2c4f0a[_0x9559('0x46')]['id']}})[_0x9559('0x25')](handleEntityNotFound(_0x254875,null))['then'](removeEntity(_0x254875,null))[_0x9559('0x44')](handleError(_0x254875,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 026e5c3..0a6124b 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 _0x37ba=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications'];(function(_0x53a137,_0x28efc2){var _0x423e8b=function(_0x182f30){while(--_0x182f30){_0x53a137['push'](_0x53a137['shift']());}};_0x423e8b(++_0x28efc2);}(_0x37ba,0x113));var _0xa37b=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x37ba[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xa37b('0x0'));var util=require('util');var logger=require(_0xa37b('0x1'))('api');var moment=require(_0xa37b('0x2'));var BPromise=require('bluebird');var rp=require(_0xa37b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa37b('0x4'));var config=require(_0xa37b('0x5'));var attributes=require(_0xa37b('0x6'));module[_0xa37b('0x7')]=function(_0x4e070c,_0x33fd7d){return _0x4e070c[_0xa37b('0x8')](_0xa37b('0x9'),attributes,{'tableName':_0xa37b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa37b('0xb'),'collate':_0xa37b('0xc')});}; \ No newline at end of file +var _0x1bba=['SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./smsApplication.attributes','exports','define'];(function(_0x254dd6,_0x6040da){var _0x5a7eca=function(_0x2266ae){while(--_0x2266ae){_0x254dd6['push'](_0x254dd6['shift']());}};_0x5a7eca(++_0x6040da);}(_0x1bba,0xe4));var _0xa1bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1bba[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xa1bb('0x0'));var logger=require(_0xa1bb('0x1'))('api');var moment=require(_0xa1bb('0x2'));var BPromise=require(_0xa1bb('0x3'));var rp=require(_0xa1bb('0x4'));var fs=require('fs');var path=require(_0xa1bb('0x5'));var rimraf=require('rimraf');var config=require(_0xa1bb('0x6'));var attributes=require(_0xa1bb('0x7'));module[_0xa1bb('0x8')]=function(_0x27c2b3,_0xe2f624){return _0x27c2b3[_0xa1bb('0x9')](_0xa1bb('0xa'),attributes,{'tableName':_0xa1bb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa1bb('0xc'),'collate':_0xa1bb('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 52bb10e..f19c6b9 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 _0xcdd2=['../../config/logger','../../config/environment','jayson/promise','http','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x2c381b,_0x2bb0de){var _0x8b3c03=function(_0x25dca1){while(--_0x25dca1){_0x2c381b['push'](_0x2c381b['shift']());}};_0x8b3c03(++_0x2bb0de);}(_0xcdd2,0x83));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2cdd('0x0'));var util=require(_0x2cdd('0x1'));var moment=require(_0x2cdd('0x2'));var BPromise=require(_0x2cdd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2cdd('0x4'));var db=require(_0x2cdd('0x5'))['db'];var utils=require(_0x2cdd('0x6'));var logger=require(_0x2cdd('0x7'))('rpc');var config=require(_0x2cdd('0x8'));var jayson=require(_0x2cdd('0x9'));var client=jayson['client'][_0x2cdd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36f9ad,_0x2647e6,_0x2ff8e0){return new BPromise(function(_0x506b09,_0x569943){return client['request'](_0x36f9ad,_0x2ff8e0)[_0x2cdd('0xb')](function(_0x4cd731){logger[_0x2cdd('0xc')](_0x2cdd('0xd'),_0x2647e6,_0x2cdd('0xe'));logger[_0x2cdd('0xf')](_0x2cdd('0x10'),_0x2647e6,_0x2cdd('0xe'),JSON[_0x2cdd('0x11')](_0x4cd731));if(_0x4cd731[_0x2cdd('0x12')]){if(_0x4cd731[_0x2cdd('0x12')][_0x2cdd('0x13')]===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x2647e6,_0x4cd731[_0x2cdd('0x12')][_0x2cdd('0x14')]);return _0x569943(_0x4cd731['error'][_0x2cdd('0x14')]);}logger[_0x2cdd('0x12')](_0x2cdd('0xd'),_0x2647e6,_0x4cd731[_0x2cdd('0x12')][_0x2cdd('0x14')]);return _0x506b09(_0x4cd731['error'][_0x2cdd('0x14')]);}else{logger[_0x2cdd('0xc')]('SmsApplication,\x20%s,\x20%s',_0x2647e6,_0x2cdd('0xe'));_0x506b09(_0x4cd731[_0x2cdd('0x15')][_0x2cdd('0x14')]);}})[_0x2cdd('0x16')](function(_0x3af7c8){logger[_0x2cdd('0x12')]('SmsApplication,\x20%s,\x20%s',_0x2647e6,_0x3af7c8);_0x569943(_0x3af7c8);});});} \ No newline at end of file +var _0xa5dd=['request','then','request\x20sent','stringify','error','code','message','SmsApplication,\x20%s,\x20%s','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x32e167,_0x2159bf){var _0x1b5c16=function(_0x1bd7f2){while(--_0x1bd7f2){_0x32e167['push'](_0x32e167['shift']());}};_0x1b5c16(++_0x2159bf);}(_0xa5dd,0x101));var _0xda5d=function(_0x45246b,_0x8b0e7b){_0x45246b=_0x45246b-0x0;var _0x38d1d5=_0xa5dd[_0x45246b];return _0x38d1d5;};'use strict';var _=require(_0xda5d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xda5d('0x1'));var rs=require(_0xda5d('0x2'));var fs=require('fs');var Redis=require(_0xda5d('0x3'));var db=require(_0xda5d('0x4'))['db'];var utils=require(_0xda5d('0x5'));var logger=require('../../config/logger')(_0xda5d('0x6'));var config=require(_0xda5d('0x7'));var jayson=require(_0xda5d('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x461283,_0x91cf4e,_0x432097){return new BPromise(function(_0x402aa8,_0x1c1e2d){return client[_0xda5d('0x9')](_0x461283,_0x432097)[_0xda5d('0xa')](function(_0x3d5c69){logger['info']('SmsApplication,\x20%s,\x20%s',_0x91cf4e,_0xda5d('0xb'));logger['debug']('SmsApplication,\x20%s,\x20%s,\x20%s',_0x91cf4e,_0xda5d('0xb'),JSON[_0xda5d('0xc')](_0x3d5c69));if(_0x3d5c69['error']){if(_0x3d5c69[_0xda5d('0xd')][_0xda5d('0xe')]===0x1f4){logger[_0xda5d('0xd')]('SmsApplication,\x20%s,\x20%s',_0x91cf4e,_0x3d5c69['error'][_0xda5d('0xf')]);return _0x1c1e2d(_0x3d5c69[_0xda5d('0xd')][_0xda5d('0xf')]);}logger[_0xda5d('0xd')](_0xda5d('0x10'),_0x91cf4e,_0x3d5c69[_0xda5d('0xd')][_0xda5d('0xf')]);return _0x402aa8(_0x3d5c69['error']['message']);}else{logger['info']('SmsApplication,\x20%s,\x20%s',_0x91cf4e,'request\x20sent');_0x402aa8(_0x3d5c69[_0xda5d('0x11')][_0xda5d('0xf')]);}})[_0xda5d('0x12')](function(_0x388f40){logger[_0xda5d('0xd')](_0xda5d('0x10'),_0x91cf4e,_0x388f40);_0x1c1e2d(_0x388f40);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index b9c9e47..953f311 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 _0xf4f4=['/:id/tags','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','post','create','tracked','sms','smsinteraction:addtags','put','smsinteraction:update','update','delete','/:id','smsinteraction:destroy','destroy'];(function(_0x373512,_0x51b72e){var _0x3e1287=function(_0x2b2128){while(--_0x2b2128){_0x373512['push'](_0x373512['shift']());}};_0x3e1287(++_0x51b72e);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x360ce5,_0x1adc8a){_0x360ce5=_0x360ce5-0x0;var _0x3acc91=_0xf4f4[_0x360ce5];return _0x3acc91;};'use strict';var multer=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var path=require('path');var timeout=require(_0x4f4f('0x2'));var express=require(_0x4f4f('0x3'));var router=express[_0x4f4f('0x4')]();var fs_extra=require(_0x4f4f('0x5'));var auth=require(_0x4f4f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4f4f('0x7'));var controller=require('./smsInteraction.controller');router[_0x4f4f('0x8')]('/',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xa')]);router[_0x4f4f('0x8')](_0x4f4f('0xb'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xc')]);router[_0x4f4f('0x8')]('/:id',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xd')]);router[_0x4f4f('0x8')](_0x4f4f('0xe'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xf')]);router[_0x4f4f('0x8')](_0x4f4f('0x10'),auth['isAuthenticated'](),controller['download']);router[_0x4f4f('0x11')]('/',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x12')]);router[_0x4f4f('0x11')](_0x4f4f('0xe'),auth[_0x4f4f('0x9')](),controller['addMessage']);router[_0x4f4f('0x11')]('/:id/tags',auth[_0x4f4f('0x9')](),interaction[_0x4f4f('0x13')](_0x4f4f('0x14'),_0x4f4f('0x15')),controller['addTags']);router[_0x4f4f('0x16')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x4f4f('0x14'),_0x4f4f('0x17')),controller[_0x4f4f('0x18')]);router[_0x4f4f('0x19')](_0x4f4f('0x1a'),auth[_0x4f4f('0x9')](),interaction[_0x4f4f('0x13')](_0x4f4f('0x14'),_0x4f4f('0x1b')),controller[_0x4f4f('0x1c')]);router[_0x4f4f('0x19')](_0x4f4f('0x1d'),auth['isAuthenticated'](),controller[_0x4f4f('0x1e')]);module[_0x4f4f('0x1f')]=router; \ No newline at end of file +var _0x8603=['sms','addTags','put','/:id','smsinteraction:update','update','delete','destroy','removeTags','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','isAuthenticated','index','get','/describe','show','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked'];(function(_0x2a7812,_0x1ce83a){var _0x3e1342=function(_0x3ff9fb){while(--_0x3ff9fb){_0x2a7812['push'](_0x2a7812['shift']());}};_0x3e1342(++_0x1ce83a);}(_0x8603,0x190));var _0x3860=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x8603[_0x39d544];return _0x5a5ff2;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['describe']);router['get']('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xb')]);router['get'](_0x3860('0xc'),auth[_0x3860('0x7')](),controller['getMessages']);router[_0x3860('0x9')](_0x3860('0xd'),auth['isAuthenticated'](),controller[_0x3860('0xe')]);router[_0x3860('0xf')]('/',auth['isAuthenticated'](),controller[_0x3860('0x10')]);router[_0x3860('0xf')](_0x3860('0xc'),auth[_0x3860('0x7')](),controller[_0x3860('0x11')]);router[_0x3860('0xf')](_0x3860('0x12'),auth[_0x3860('0x7')](),interaction[_0x3860('0x13')](_0x3860('0x14'),'smsinteraction:addtags'),controller[_0x3860('0x15')]);router[_0x3860('0x16')](_0x3860('0x17'),auth[_0x3860('0x7')](),interaction[_0x3860('0x13')](_0x3860('0x14'),_0x3860('0x18')),controller[_0x3860('0x19')]);router[_0x3860('0x1a')](_0x3860('0x17'),auth[_0x3860('0x7')](),interaction[_0x3860('0x13')]('sms','smsinteraction:destroy'),controller[_0x3860('0x1b')]);router[_0x3860('0x1a')](_0x3860('0x12'),auth['isAuthenticated'](),controller[_0x3860('0x1c')]);module[_0x3860('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 175e0ca..f5ad64e 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 _0x1561=['out','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x520b9f,_0x2be5aa){var _0xe5e7df=function(_0x2dacd0){while(--_0x2dacd0){_0x520b9f['push'](_0x520b9f['shift']());}};_0xe5e7df(++_0x2be5aa);}(_0x1561,0x1bd));var _0x1156=function(_0x140999,_0x542fab){_0x140999=_0x140999-0x0;var _0x4bdff1=_0x1561[_0x140999];return _0x4bdff1;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x1156('0x0')]={'closed':{'type':Sequelize[_0x1156('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1156('0x2')]},'disposition':{'type':Sequelize[_0x1156('0x3')]},'secondDisposition':{'type':Sequelize[_0x1156('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x1156('0x3')]},'phone':{'type':Sequelize[_0x1156('0x3')]},'read1stAt':{'type':Sequelize[_0x1156('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x1156('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1156('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x1156('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1156('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x737d=['moment','STRING','DATE','ENUM','out','BOOLEAN','sequelize'];(function(_0x5cb366,_0x5d8049){var _0x20e854=function(_0x3386d7){while(--_0x3386d7){_0x5cb366['push'](_0x5cb366['shift']());}};_0x20e854(++_0x5d8049);}(_0x737d,0xbc));var _0xd737=function(_0x1ba727,_0x496181){_0x1ba727=_0x1ba727-0x0;var _0x289816=_0x737d[_0x1ba727];return _0x289816;};'use strict';var Sequelize=require(_0xd737('0x0'));var moment=require(_0xd737('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xd737('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xd737('0x2')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xd737('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xd737('0x4')]('in',_0xd737('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd737('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xd737('0x4')]('in',_0xd737('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xd737('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 7fc7c0f..c67e6a2 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 _0x48ae=['to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./smsInteraction.socket','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','end','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','index','SmsInteraction','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','field','color','select','u.id','u.fullname','from','users','sms_interactions','left_join','o.id\x20=\x20i.UserId','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','forEach','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','keys','compact','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','isEmpty','t.id\x20IN\x20?','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','role','sequelize','toString','a.key','Account.key','Account.mandatoryDisposition','contactName','c.firstName','c.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','show','params','includeAll','include','merge','options','create','describe','addMessage','SmsMessage','ids','omit','getMessages','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','smsInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','attachments','format','transcript-%d-%s.zip','CmContact','firstName','lastName','Messages','direction','secret','Account','Sms','Owner','N.A.','closed','closedAt','disposition','out','System','downloadInteraction.ejs','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path'];(function(_0xa96932,_0x2a63a2){var _0x3a3f08=function(_0x568fa8){while(--_0x568fa8){_0xa96932['push'](_0xa96932['shift']());}};_0x3a3f08(++_0x2a63a2);}(_0x48ae,0xd2));var _0xe48a=function(_0x4c81d7,_0x18b6a3){_0x4c81d7=_0x4c81d7-0x0;var _0x362d88=_0x48ae[_0x4c81d7];return _0x362d88;};'use strict';var emlformat=require(_0xe48a('0x0'));var rimraf=require(_0xe48a('0x1'));var zipdir=require(_0xe48a('0x2'));var jsonpatch=require(_0xe48a('0x3'));var rp=require(_0xe48a('0x4'));var moment=require(_0xe48a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe48a('0x6'));var util=require(_0xe48a('0x7'));var path=require(_0xe48a('0x8'));var sox=require('sox');var csv=require(_0xe48a('0x9'));var ejs=require(_0xe48a('0xa'));var fs=require('fs');var fs_extra=require(_0xe48a('0xb'));var _=require(_0xe48a('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe48a('0xd'));var deskjs=require(_0xe48a('0xe'));var toCsv=require(_0xe48a('0x9'));var querystring=require('querystring');var Papa=require(_0xe48a('0xf'));var Redis=require(_0xe48a('0x10'));var authService=require(_0xe48a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe48a('0x12'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0xe48a('0x13'));var logger=require(_0xe48a('0x14'))('api');var utils=require(_0xe48a('0x15'));var config=require(_0xe48a('0x16'));var licenseUtil=require(_0xe48a('0x17'));var db=require(_0xe48a('0x18'))['db'];config[_0xe48a('0x19')]=_['defaults'](config[_0xe48a('0x19')],{'host':_0xe48a('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe48a('0x19')]));require(_0xe48a('0x1b'))['register'](socket);function respondWithStatusCode(_0xc12bb0,_0x124ee9){_0x124ee9=_0x124ee9||0xcc;return function(_0x87672d){if(_0x87672d){return _0xc12bb0[_0xe48a('0x1c')](_0x124ee9);}return _0xc12bb0[_0xe48a('0x1d')](_0x124ee9)['end']();};}function respondWithResult(_0x2de8db,_0x36e278){_0x36e278=_0x36e278||0xc8;return function(_0x37d8d7){if(_0x37d8d7){return _0x2de8db[_0xe48a('0x1d')](_0x36e278)[_0xe48a('0x1e')](_0x37d8d7);}};}function respondWithFilteredResult(_0x48aadf,_0x149cf7){return function(_0x26b430){if(_0x26b430){var _0xe08bf5=typeof _0x149cf7[_0xe48a('0x1f')]===_0xe48a('0x20')&&typeof _0x149cf7[_0xe48a('0x21')]===_0xe48a('0x20');var _0x1bd814=_0x26b430[_0xe48a('0x22')];var _0x37231a=_0xe08bf5?0x0:_0x149cf7[_0xe48a('0x1f')];var _0x32a020=_0xe08bf5?_0x26b430[_0xe48a('0x22')]:_0x149cf7[_0xe48a('0x1f')]+_0x149cf7[_0xe48a('0x21')];var _0x14eea6;if(_0x32a020>=_0x1bd814){_0x32a020=_0x1bd814;_0x14eea6=0xc8;}else{_0x14eea6=0xce;}_0x48aadf['status'](_0x14eea6);return _0x48aadf[_0xe48a('0x23')]('Content-Range',_0x37231a+'-'+_0x32a020+'/'+_0x1bd814)[_0xe48a('0x1e')](_0x26b430);}return null;};}function patchUpdates(_0x4a13c8){return function(_0x5a96a8){try{jsonpatch['apply'](_0x5a96a8,_0x4a13c8,!![]);}catch(_0x3422ae){return BPromise[_0xe48a('0x24')](_0x3422ae);}return _0x5a96a8[_0xe48a('0x25')]();};}function saveUpdates(_0x21adfc,_0x28d6ef){return function(_0x15edb0){if(_0x15edb0){return _0x15edb0[_0xe48a('0x26')](_0x21adfc)[_0xe48a('0x27')](function(_0x44018a){return _0x44018a;});}return null;};}function removeEntity(_0x4a51c5,_0x339ec6){return function(_0x56bebd){if(_0x56bebd){return _0x56bebd[_0xe48a('0x28')]()[_0xe48a('0x27')](function(){_0x4a51c5[_0xe48a('0x1d')](0xcc)[_0xe48a('0x29')]();});}};}function handleEntityNotFound(_0x1780a9,_0x3faf0b){return function(_0x322010){if(!_0x322010){_0x1780a9[_0xe48a('0x1c')](0x194);}return _0x322010;};}function handleError(_0x44b872,_0x4e9b0d){_0x4e9b0d=_0x4e9b0d||0x1f4;return function(_0x501622){logger['error'](_0x501622[_0xe48a('0x2a')]);if(_0x501622[_0xe48a('0x2b')]){delete _0x501622[_0xe48a('0x2b')];}_0x44b872[_0xe48a('0x1d')](_0x4e9b0d)[_0xe48a('0x2c')](_0x501622);};}function getInteractionUsers(_0x5875ef,_0x12e67e){return new BPromise(function(_0x376716,_0x56c6c0){try{if(_0x12e67e[_0x5875ef['id']]){_0x5875ef[_0xe48a('0x2d')]=_[_0xe48a('0x2e')](_0x12e67e[_0x5875ef['id']],function(_0xe19bb5){return{'id':_0xe19bb5['id'],'fullname':_0xe19bb5[_0xe48a('0x2f')]};});}}catch(_0x57b2f8){_0x56c6c0(_0x57b2f8);}_0x376716(_0x5875ef);});}function getInteractionTags(_0x151032,_0x123753){return new BPromise(function(_0x4a8a29,_0x5024ab){try{if(_0x151032[_0xe48a('0x30')]){_0x151032[_0xe48a('0x31')]=[];_0x151032[_0xe48a('0x30')][_0xe48a('0x32')](',')['forEach'](function(_0x6a0394){_0x151032['Tags'][_0xe48a('0x33')](_0x123753[_0x6a0394]);});}delete _0x151032['TagIds'];}catch(_0x37f9b8){_0x5024ab(_0x37f9b8);}_0x4a8a29(_0x151032);});}function updateSmsInteraction(_0x23e205,_0x5e0670,_0x105a2c){return new BPromise(function(_0x333bf4,_0x2505ba){return getInteractionUsers(_0x23e205,_0x105a2c)[_0xe48a('0x27')](function(_0xf3a939){return getInteractionTags(_0xf3a939,_0x5e0670);})[_0xe48a('0x27')](function(_0x4e1f23){_0x333bf4(_0x4e1f23);})[_0xe48a('0x34')](function(_0x4f3bf8){_0x2505ba(_0x4f3bf8);});});}exports[_0xe48a('0x35')]=function(_0xe5492f,_0x4bf92b){var _0x309305={},_0x31a727={},_0x12aafc={'count':0x0,'rows':[]};var _0x354a5b=_['map'](db[_0xe48a('0x36')][_0xe48a('0x37')],function(_0x4ca9d2){return{'name':_0x4ca9d2[_0xe48a('0x38')],'type':_0x4ca9d2[_0xe48a('0x39')]['key']};});_0x31a727[_0xe48a('0x3a')]=_['map'](_0x354a5b,_0xe48a('0x2b'));_0x31a727['query']=_['keys'](_0xe5492f[_0xe48a('0x3b')]);_0x31a727[_0xe48a('0x3c')]=_[_0xe48a('0x3d')](_0x31a727['model'],_0x31a727['query']);_0x309305[_0xe48a('0x3e')]=_[_0xe48a('0x3d')](_0x31a727[_0xe48a('0x3a')],qs[_0xe48a('0x3f')](_0xe5492f['query'][_0xe48a('0x3f')]));_0x309305[_0xe48a('0x3e')]=_0x309305['attributes'][_0xe48a('0x40')]?_0x309305[_0xe48a('0x3e')]:_0x31a727[_0xe48a('0x3a')];if(!_0xe5492f[_0xe48a('0x3b')][_0xe48a('0x41')](_0xe48a('0x42'))){_0x309305[_0xe48a('0x21')]=qs[_0xe48a('0x21')](_0xe5492f[_0xe48a('0x3b')][_0xe48a('0x21')]);_0x309305[_0xe48a('0x1f')]=qs[_0xe48a('0x1f')](_0xe5492f['query']['offset']);}_0x309305[_0xe48a('0x43')]=qs[_0xe48a('0x44')](_0xe5492f[_0xe48a('0x3b')]['sort']);_0x309305[_0xe48a('0x45')]=qs['filters'](_[_0xe48a('0x46')](_0xe5492f['query'],_0x31a727[_0xe48a('0x3c')]),_0x354a5b);var _0x376a00=[];var _0x55d1d2=squel['select']()[_0xe48a('0x47')]('id')[_0xe48a('0x47')](_0xe48a('0x2b'))[_0xe48a('0x47')](_0xe48a('0x48'))['from']('tools_tags');var _0x5bef6e=squel[_0xe48a('0x49')]()['field'](_0xe48a('0x4a'))[_0xe48a('0x47')](_0xe48a('0x4b'))[_0xe48a('0x47')]('ui.SmsInteractionId')[_0xe48a('0x4c')]('user_has_sms_interactions','ui')['left_join'](_0xe48a('0x4d'),'u','u.id\x20=\x20ui.UserId');var _0x2e0598=squel['select']()[_0xe48a('0x4c')](_0xe48a('0x4e'),'i')['left_join']('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xe48a('0x4f')](_0xe48a('0x4d'),'o',_0xe48a('0x50'))[_0xe48a('0x4f')]('sms_accounts','a',_0xe48a('0x51'))[_0xe48a('0x4f')]('sms_messages','me',_0xe48a('0x52'))['left_join']('sms_interaction_has_tags','it','it.SmsInteractionId\x20=\x20i.id')[_0xe48a('0x4f')](_0xe48a('0x53'),'t',_0xe48a('0x54'));var _0x3ddcd6=squel[_0xe48a('0x55')]();var _0x4256e5=[];var _0x48edfe=squel['expr']();var _0x2d8e53;if(_0xe5492f[_0xe48a('0x3b')][_0xe48a('0x56')]){_0x2d8e53=as[_0xe48a('0x57')](_0xe5492f[_0xe48a('0x3b')][_0xe48a('0x56')]);var _0x31eba5=_0x2d8e53['sqlOperator'];for(var _0x348423=0x0;_0x348423<_0x2d8e53['conditions'][_0xe48a('0x40')];_0x348423++){var _0x231cd9=_0x2d8e53[_0xe48a('0x58')][_0x348423];var _0x452afc='i';var _0xcccccc=_[_0xe48a('0x59')](_0x354a5b,['name',_0x231cd9[_0xe48a('0x47')]]);if(!_0xcccccc){switch(_0x231cd9[_0xe48a('0x47')]){case'unreadMessages':if(_0x231cd9[_0xe48a('0x5a')]==0x1){_0x2e0598[_0xe48a('0x5b')]('`'+_0x231cd9[_0xe48a('0x47')]+_0xe48a('0x5c'));}else{_0x2e0598[_0xe48a('0x5b')]('`'+_0x231cd9[_0xe48a('0x47')]+_0xe48a('0x5d'));}break;case _0xe48a('0x5e'):if(_0x231cd9[_0xe48a('0x5f')]==='$substring'){if(_0x231cd9[_0xe48a('0x5a')][_0xe48a('0x32')]('\x20')['length']>0x1){_0x3ddcd6[_0x31eba5](_0xe48a('0x60'),qs[_0xe48a('0x61')](_0x231cd9[_0xe48a('0x5a')]),null);}else{var _0x3f9636='%'+_0x231cd9[_0xe48a('0x5a')]+'%';_0x3ddcd6[_0x31eba5](_0xe48a('0x62'),_0x3f9636,_0x3f9636,_0x3f9636);}}else{_0xcccccc=_[_0xe48a('0x59')](_0x354a5b,[_0xe48a('0x2b'),_0xe48a('0x63')]);_0x231cd9['field']=_0xe48a('0x63');_0x57d07d=as[_0xe48a('0x64')](_0x452afc,_0xcccccc[_0xe48a('0x39')],_0x231cd9);_0x3ddcd6[_0x31eba5](_0x57d07d['text'],_0x57d07d[_0xe48a('0x5a')][_0xe48a('0x65')],_0x57d07d[_0xe48a('0x5a')][_0xe48a('0x29')]);}break;case'Tag':var _0x4c1227=_0x231cd9[_0xe48a('0x5a')][_0xe48a('0x32')](',')['map'](function(_0x277ea8){return Number(_0x277ea8);});_0x4c1227[_0xe48a('0x66')](function(_0x2c8d27){_0x48edfe['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2c8d27+',%');});_0x4256e5=_[_0xe48a('0x67')](_0x4256e5,_0x4c1227);break;case _0xe48a('0x68'):if(_0x231cd9[_0xe48a('0x5f')]==='$substring'){_0x3ddcd6[_0x31eba5](_0xe48a('0x69'),'%'+_0x231cd9[_0xe48a('0x5a')]+'%',null);}else{_0xcccccc=_[_0xe48a('0x59')](_0x354a5b,[_0xe48a('0x2b'),_0xe48a('0x6a')]);_0x231cd9[_0xe48a('0x47')]='UserId';_0x57d07d=as[_0xe48a('0x64')](_0x452afc,_0xcccccc[_0xe48a('0x39')],_0x231cd9);_0x3ddcd6[_0x31eba5](_0x57d07d[_0xe48a('0x6b')],_0x57d07d[_0xe48a('0x5a')][_0xe48a('0x65')],_0x57d07d[_0xe48a('0x5a')][_0xe48a('0x29')]);}break;case _0xe48a('0x6c'):_0x57d07d=as[_0xe48a('0x64')]('me',null,_0x231cd9);_0x3ddcd6[_0x31eba5](_0x57d07d[_0xe48a('0x6b')],_0x57d07d[_0xe48a('0x5a')][_0xe48a('0x65')],_0x57d07d[_0xe48a('0x5a')][_0xe48a('0x29')]);break;}}else{var _0x57d07d=as[_0xe48a('0x64')](_0x452afc,_0xcccccc[_0xe48a('0x39')],_0x231cd9);_0x3ddcd6[_0x31eba5](_0x57d07d['text'],_0x57d07d['value'][_0xe48a('0x65')],_0x57d07d[_0xe48a('0x5a')][_0xe48a('0x29')]);}}}else{var _0x2db3f6=_(_0xe5492f[_0xe48a('0x3b')])[_0xe48a('0x6d')]()['map'](function(_0x5c76c){return _['some'](_0x354a5b,[_0xe48a('0x2b'),_0x5c76c])?_0x5c76c:undefined;})[_0xe48a('0x6e')]()['value']();if(!_['isEmpty'](_0x2db3f6)){_0x2db3f6[_0xe48a('0x66')](function(_0x164d12){if(_0x164d12===_0xe48a('0x6f')){_0x2e0598['where'](_0xe48a('0x70'),[][_0xe48a('0x71')](_0xe5492f['query'][_0x164d12]));}else if(_0x164d12===_0xe48a('0x72')){var _0x390848=JSON['parse'](_0xe5492f[_0xe48a('0x3b')][_0x164d12])[_0xe48a('0x73')];var _0x17d4aa=JSON[_0xe48a('0x74')](_0xe5492f[_0xe48a('0x3b')][_0x164d12])[_0xe48a('0x75')];_0x2e0598[_0xe48a('0x45')](_0xe48a('0x76'),_0x390848,_0x17d4aa);}else{if(_0xe5492f[_0xe48a('0x3b')][_0x164d12]===_0xe48a('0x77')){_0x2e0598[_0xe48a('0x45')]('i.'+_0x164d12+_0xe48a('0x78'));}else{_0x2e0598[_0xe48a('0x45')]('i.'+_0x164d12+'\x20=\x20?',_0xe5492f[_0xe48a('0x3b')][_0x164d12]);}}});}if(_0xe5492f[_0xe48a('0x3b')][_0xe48a('0x79')]){if(_0xe5492f[_0xe48a('0x3b')][_0xe48a('0x79')]==0x1){_0x2e0598['having'](_0xe48a('0x7a'));}else{_0x2e0598['having']('`unreadMessages`\x20>\x200');}}if(_0xe5492f[_0xe48a('0x3b')]['tag']){_0x4256e5=_['isArray'](_0xe5492f[_0xe48a('0x3b')][_0xe48a('0x7b')])?_0xe5492f[_0xe48a('0x3b')][_0xe48a('0x7b')]:new Array(_0xe5492f[_0xe48a('0x3b')][_0xe48a('0x7b')]);_0x4256e5[_0xe48a('0x66')](function(_0x1f7ab9){_0x48edfe['or'](_0xe48a('0x7c'),'%,'+_0x1f7ab9+',%');});}if(_0xe5492f[_0xe48a('0x3b')][_0xe48a('0x7d')]){var _0x399693=_0xe5492f['query']['filter'][_0xe48a('0x7e')]('\x5c','\x5c\x5c')[_0xe48a('0x7e')](/'/g,'\x27\x27');if(qs[_0xe48a('0x7f')](_0x399693)){_0x3ddcd6['or'](_0xe48a('0x80'),_0x399693+'%')['or'](_0xe48a('0x81'),_0x399693+'%');}else{_0x3ddcd6['or'](_0xe48a('0x82'),qs['getFullTextValue'](_0x399693))['or'](_0xe48a('0x83'),_0x399693+'%');}}}_0x2e0598[_0xe48a('0x45')](_0x3ddcd6);_0x2e0598[_0xe48a('0x84')]('i.id');var _0x1fa12c={'type':db[_0xe48a('0x85')][_0xe48a('0x86')][_0xe48a('0x87')],'raw':!![]};var _0x86ade8=_0x2e0598[_0xe48a('0x88')]();_0x86ade8[_0xe48a('0x47')](_0xe48a('0x89'));_0x86ade8[_0xe48a('0x47')](_0xe48a('0x8a'),_0xe48a('0x8b'));if(_0x309305[_0xe48a('0x43')]){_0x309305['order'][_0xe48a('0x66')](function(_0x296ba2){var _0x555409=_0x296ba2[0x0]==='contactName'?_0x296ba2[0x0]:'i.'+_0x296ba2[0x0];_0x2e0598[_0xe48a('0x43')](_0x555409,_0x296ba2[0x1]==='DESC'?![]:!![]);});}if(!_[_0xe48a('0x8c')](_0x4256e5)){_0x2e0598[_0xe48a('0x5b')](_0x48edfe);_0x86ade8['where'](_0xe48a('0x8d'),_0x4256e5);}BPromise['resolve']()['then'](function(){if(!_0x2d8e53){if(_0xe5492f[_0xe48a('0x3b')]['SmsAccountId'])return;_0x86ade8['where'](_0xe48a('0x8e'));_0x2e0598['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0xe5492f[_0xe48a('0x8f')]['role']!=='agent')return;return _0xe5492f[_0xe48a('0x8f')][_0xe48a('0x90')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3934a6){if(_[_0xe48a('0x8c')](_0x3934a6)){_0x86ade8[_0xe48a('0x45')](_0xe48a('0x91'));_0x2e0598[_0xe48a('0x45')](_0xe48a('0x91'));}else{_0x86ade8['where']('i.SmsAccountId\x20IN\x20?',_[_0xe48a('0x2e')](_0x3934a6,'id'));_0x2e0598[_0xe48a('0x45')](_0xe48a('0x70'),_[_0xe48a('0x2e')](_0x3934a6,'id'));}});})[_0xe48a('0x27')](function(){if(_0xe5492f[_0xe48a('0x8f')][_0xe48a('0x92')]==='agent'&&!_0x2d8e53&&!_0xe5492f[_0xe48a('0x3b')][_0xe48a('0x6f')])return[];return db[_0xe48a('0x93')]['query'](_0x86ade8[_0xe48a('0x94')](),_0x1fa12c);})['then'](function(_0x108f0f){_0x12aafc[_0xe48a('0x22')]=_0x108f0f['length'];if(_0x12aafc[_0xe48a('0x22')]===0x0)return[];return db[_0xe48a('0x93')][_0xe48a('0x3b')](_0x55d1d2[_0xe48a('0x94')](),_0x1fa12c)['then'](function(_0x2dcace){_0x376a00=_['keyBy'](_0x2dcace,'id');_0x1fa12c=_['merge'](_0x1fa12c,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xe5492f[_0xe48a('0x3b')]['fields']){_0x309305[_0xe48a('0x3e')]['forEach'](function(_0x5973a6){_0x2e0598['field']('i.'+_0x5973a6);});}else{_0x2e0598[_0xe48a('0x47')](_0xe48a('0x8a'),_0xe48a('0x8b'));_0x2e0598[_0xe48a('0x47')](_0xe48a('0x95'),_0xe48a('0x96'));_0x2e0598[_0xe48a('0x47')]('a.mandatoryDisposition',_0xe48a('0x97'));_0x2e0598[_0xe48a('0x47')]('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',_0xe48a('0x98'));_0x2e0598[_0xe48a('0x47')]('i.*');_0x2e0598['field'](_0xe48a('0x99'),'Contact.firstName');_0x2e0598['field'](_0xe48a('0x9a'),'Contact.lastName');_0x2e0598['field'](_0xe48a('0x9b'),_0xe48a('0x9c'));_0x2e0598[_0xe48a('0x47')]('c.phone',_0xe48a('0x9d'));_0x2e0598[_0xe48a('0x47')](_0xe48a('0x9e'),_0xe48a('0x9f'));_0x2e0598[_0xe48a('0x47')](_0xe48a('0xa0'),'Contact.fax');_0x2e0598[_0xe48a('0x47')]('o.fullname',_0xe48a('0xa1'));_0x2e0598[_0xe48a('0x47')](_0xe48a('0xa2'),_0xe48a('0xa3'));_0x2e0598[_0xe48a('0x47')](_0xe48a('0xa4'),_0xe48a('0x30'));}if(_0x309305[_0xe48a('0x21')])_0x2e0598[_0xe48a('0x21')](_0x309305[_0xe48a('0x21')]);if(_0x309305[_0xe48a('0x1f')])_0x2e0598[_0xe48a('0x1f')](_0x309305['offset']);return db[_0xe48a('0x93')]['query'](_0x2e0598[_0xe48a('0x94')](),_0x1fa12c);})[_0xe48a('0x27')](function(_0xd289ea){if(_0xd289ea['length']>0x0)_0x5bef6e[_0xe48a('0x45')](_0xe48a('0xa5'),_[_0xe48a('0x2e')](_0xd289ea,'id'));return db[_0xe48a('0x93')][_0xe48a('0x3b')](_0x5bef6e[_0xe48a('0x94')](),_0x1fa12c)[_0xe48a('0x27')](function(_0x2ecbe6){var _0x2e63a8=_[_0xe48a('0xa6')](_0x2ecbe6,_0xe48a('0xa7'));var _0x1a49c1=[];_0xd289ea[_0xe48a('0x66')](function(_0x438640){_0x1a49c1[_0xe48a('0x33')](updateSmsInteraction(_0x438640,_0x376a00,_0x2e63a8));});return BPromise[_0xe48a('0xa8')](_0x1a49c1);});});})[_0xe48a('0x27')](function(_0x1fe17f){_0x12aafc[_0xe48a('0xa9')]=_0x1fe17f;return _0x12aafc;})[_0xe48a('0x27')](respondWithFilteredResult(_0x4bf92b,_0x309305))[_0xe48a('0x34')](handleError(_0x4bf92b,null));};exports[_0xe48a('0xaa')]=function(_0x15cae7,_0xddbfef){var _0x4c44bf={'raw':![],'where':{'id':_0x15cae7[_0xe48a('0xab')]['id']}},_0x471f27={};_0x471f27[_0xe48a('0x3a')]=_['keys'](db[_0xe48a('0x36')]['rawAttributes']);_0x471f27['query']=_[_0xe48a('0x6d')](_0x15cae7[_0xe48a('0x3b')]);_0x471f27[_0xe48a('0x3c')]=_[_0xe48a('0x3d')](_0x471f27[_0xe48a('0x3a')],_0x471f27[_0xe48a('0x3b')]);_0x4c44bf[_0xe48a('0x3e')]=_[_0xe48a('0x3d')](_0x471f27[_0xe48a('0x3a')],qs[_0xe48a('0x3f')](_0x15cae7[_0xe48a('0x3b')][_0xe48a('0x3f')]));_0x4c44bf[_0xe48a('0x3e')]=_0x4c44bf['attributes'][_0xe48a('0x40')]?_0x4c44bf[_0xe48a('0x3e')]:_0x471f27[_0xe48a('0x3a')];if(_0x15cae7['query'][_0xe48a('0xac')]){_0x4c44bf[_0xe48a('0xad')]=[{'all':!![]}];}_0x4c44bf=_[_0xe48a('0xae')]({},_0x4c44bf,_0x15cae7[_0xe48a('0xaf')]);return db['SmsInteraction'][_0xe48a('0x59')](_0x4c44bf)[_0xe48a('0x27')](handleEntityNotFound(_0xddbfef,null))[_0xe48a('0x27')](respondWithResult(_0xddbfef,null))[_0xe48a('0x34')](handleError(_0xddbfef,null));};exports['create']=function(_0x57bc6f,_0xd482ad){return db[_0xe48a('0x36')][_0xe48a('0xb0')](_0x57bc6f[_0xe48a('0x6c')],{})[_0xe48a('0x27')](respondWithResult(_0xd482ad,0xc9))[_0xe48a('0x34')](handleError(_0xd482ad,null));};exports[_0xe48a('0x26')]=function(_0x253313,_0x5f08a5){if(_0x253313[_0xe48a('0x6c')]['id']){delete _0x253313[_0xe48a('0x6c')]['id'];}return db[_0xe48a('0x36')]['find']({'where':{'id':_0x253313['params']['id']}})[_0xe48a('0x27')](handleEntityNotFound(_0x5f08a5,null))[_0xe48a('0x27')](saveUpdates(_0x253313['body'],null))['then'](respondWithResult(_0x5f08a5,null))[_0xe48a('0x34')](handleError(_0x5f08a5,null));};exports['destroy']=function(_0x386661,_0x3d3c77){return db[_0xe48a('0x36')][_0xe48a('0x59')]({'where':{'id':_0x386661['params']['id']}})[_0xe48a('0x27')](handleEntityNotFound(_0x3d3c77,null))[_0xe48a('0x27')](removeEntity(_0x3d3c77,null))['catch'](handleError(_0x3d3c77,null));};exports['describe']=function(_0x12d2d9,_0xf90397){return db['SmsInteraction'][_0xe48a('0xb1')]()[_0xe48a('0x27')](respondWithResult(_0xf90397,null))[_0xe48a('0x34')](handleError(_0xf90397,null));};exports[_0xe48a('0xb2')]=function(_0x894853,_0x7befcf,_0x25fa83){return db[_0xe48a('0xb3')][_0xe48a('0x59')]({'where':{'id':_0x894853[_0xe48a('0xab')]['id']}})['then'](handleEntityNotFound(_0x7befcf,null))['then'](function(_0x31b784){if(_0x31b784){return _0x31b784['addMessage'](_0x894853['body'][_0xe48a('0xb4')],_[_0xe48a('0xb5')](_0x894853[_0xe48a('0x6c')],['ids','id'])||{});}})[_0xe48a('0x27')](respondWithResult(_0x7befcf,null))[_0xe48a('0x34')](handleError(_0x7befcf,null));};exports[_0xe48a('0xb6')]=function(_0x4c435b,_0x2d401d,_0x3f41c1){var _0x5e56a7={'raw':![],'where':{}};var _0x1222c5={};var _0x46d957={'count':0x0,'rows':[]};return db[_0xe48a('0x36')]['findOne']({'where':{'id':_0x4c435b[_0xe48a('0xab')]['id']}})[_0xe48a('0x27')](handleEntityNotFound(_0x2d401d,null))[_0xe48a('0x27')](function(_0x2aed70){if(_0x2aed70){_0x1222c5[_0xe48a('0x3a')]=_[_0xe48a('0x6d')](db[_0xe48a('0xb3')][_0xe48a('0x37')]);_0x1222c5[_0xe48a('0x3b')]=_[_0xe48a('0x6d')](_0x4c435b[_0xe48a('0x3b')]);_0x1222c5[_0xe48a('0x3c')]=_[_0xe48a('0x3d')](_0x1222c5[_0xe48a('0x3a')],_0x1222c5['query']);_0x5e56a7[_0xe48a('0x3e')]=_['intersection'](_0x1222c5[_0xe48a('0x3a')],qs[_0xe48a('0x3f')](_0x4c435b[_0xe48a('0x3b')]['fields']));_0x5e56a7[_0xe48a('0x3e')]=_0x5e56a7['attributes'][_0xe48a('0x40')]?_0x5e56a7[_0xe48a('0x3e')]:_0x1222c5[_0xe48a('0x3a')];if(!_0x4c435b['query'][_0xe48a('0x41')](_0xe48a('0x42'))){_0x5e56a7[_0xe48a('0x21')]=qs[_0xe48a('0x21')](_0x4c435b[_0xe48a('0x3b')][_0xe48a('0x21')]);_0x5e56a7[_0xe48a('0x1f')]=qs[_0xe48a('0x1f')](_0x4c435b[_0xe48a('0x3b')][_0xe48a('0x1f')]);}_0x5e56a7[_0xe48a('0x43')]=qs[_0xe48a('0x44')](_0x4c435b[_0xe48a('0x3b')]['sort']);_0x5e56a7[_0xe48a('0x45')]=qs[_0xe48a('0x3c')](_[_0xe48a('0x46')](_0x4c435b[_0xe48a('0x3b')],_0x1222c5[_0xe48a('0x3c')]));_0x5e56a7[_0xe48a('0x45')][_0xe48a('0xa7')]=_0x2aed70['id'];if(_0x4c435b[_0xe48a('0x3b')]['filter']){_0x5e56a7[_0xe48a('0x45')]=_[_0xe48a('0xae')](_0x5e56a7[_0xe48a('0x45')],{'$or':_[_0xe48a('0x2e')](_0x5e56a7[_0xe48a('0x3e')],function(_0x50ef23){var _0x4df7cb={};_0x4df7cb[_0x50ef23]={'$like':'%'+_0x4c435b[_0xe48a('0x3b')][_0xe48a('0x7d')]+'%'};return _0x4df7cb;})});}if(_0x4c435b['query']['$gte']){var _0x57db10=_0x4c435b[_0xe48a('0x3b')][_0xe48a('0x73')][_0xe48a('0x32')](',');var _0x5c17a7={};_0x5c17a7[_0x57db10[0x0]]={'$gte':moment(_0x57db10[0x1])['format'](_0xe48a('0xb7'))};_0x5e56a7[_0xe48a('0x45')]=_[_0xe48a('0xae')](_0x5e56a7[_0xe48a('0x45')],_0x5c17a7);}_0x5e56a7=_[_0xe48a('0xae')]({},_0x5e56a7,_0x4c435b[_0xe48a('0xaf')]);return db[_0xe48a('0xb3')][_0xe48a('0x22')]({'where':_0x5e56a7['where']})[_0xe48a('0x27')](function(_0x42b7ed){_0x46d957[_0xe48a('0x22')]=_0x42b7ed;if(_0x4c435b['query']['includeAll']){_0x5e56a7[_0xe48a('0xad')]=[{'all':!![]}];}return db['SmsMessage'][_0xe48a('0xb8')](_0x5e56a7);})['then'](function(_0x5e0cd5){_0x46d957['rows']=_0x5e0cd5;return _0x46d957;});}})[_0xe48a('0x27')](respondWithFilteredResult(_0x2d401d,_0x5e56a7))[_0xe48a('0x34')](handleError(_0x2d401d,null));};exports[_0xe48a('0xb9')]=function(_0x35660b,_0x56add3,_0x53e015){return db[_0xe48a('0x36')][_0xe48a('0x59')]({'where':{'id':_0x35660b[_0xe48a('0xab')]['id']}})['then'](handleEntityNotFound(_0x56add3,null))[_0xe48a('0x27')](function(_0x4bf9cd){if(_0x4bf9cd){return _0x4bf9cd[_0xe48a('0xba')](_0x35660b[_0xe48a('0x6c')][_0xe48a('0xb4')],_[_0xe48a('0xb5')](_0x35660b[_0xe48a('0x6c')],[_0xe48a('0xb4'),'id'])||{})['spread'](function(){return db['Tag'][_0xe48a('0xb8')]({'attributes':['id',_0xe48a('0x2b'),_0xe48a('0x48')],'where':{'id':_0x35660b['body'][_0xe48a('0xb4')]}});})[_0xe48a('0x27')](function(_0x56302c){socket['emit'](_0xe48a('0xbb'),{'id':Number(_0x35660b[_0xe48a('0xab')]['id']),'tags':_0x56302c||[]});return{'id':Number(_0x35660b[_0xe48a('0xab')]['id']),'tags':_0x56302c||[]};});}})['then'](respondWithResult(_0x56add3,null))['catch'](handleError(_0x56add3,null));};exports[_0xe48a('0xbc')]=function(_0xd3f4b3,_0x568c23,_0x27ff54){return db[_0xe48a('0x36')][_0xe48a('0x59')]({'where':{'id':_0xd3f4b3[_0xe48a('0xab')]['id']}})[_0xe48a('0x27')](handleEntityNotFound(_0x568c23,null))[_0xe48a('0x27')](function(_0x3b43e3){if(_0x3b43e3){return _0x3b43e3['removeTags'](_0xd3f4b3['query'][_0xe48a('0xb4')]);}})['then'](respondWithStatusCode(_0x568c23,null))[_0xe48a('0x34')](handleError(_0x568c23,null));};exports[_0xe48a('0xbd')]=function(_0x22e249,_0x1eb233){var _0x5a0ee2=moment()[_0xe48a('0xbe')]()[_0xe48a('0x94')]();var _0x331293=path['join'](config[_0xe48a('0xbf')],_0xe48a('0xc0'),_0xe48a('0xc1'),_0xe48a('0xc2'));var _0x2d411f=path[_0xe48a('0xc3')](config[_0xe48a('0xbf')],'server','files',_0xe48a('0xc4'));var _0xf4d047=path[_0xe48a('0xc3')](_0x331293,_0x5a0ee2);var _0x42d8e5=util[_0xe48a('0xc5')](_0xe48a('0xc6'),_0x22e249['params']['id'],_0x5a0ee2);var _0xe19074=path[_0xe48a('0xc3')](_0x331293,_0x42d8e5);var _0x3cc456=[];_0x3cc456['push']({'model':db[_0xe48a('0x68')],'as':_0xe48a('0x68'),'attributes':['id',_0xe48a('0x2f')],'raw':!![]});_0x3cc456[_0xe48a('0x33')]({'model':db[_0xe48a('0xc7')],'as':_0xe48a('0x5e'),'attributes':['id',_0xe48a('0xc8'),_0xe48a('0xc9')],'raw':!![]});var _0x5b4299=[{'model':db[_0xe48a('0xb3')],'as':_0xe48a('0xca'),'attributes':['id',_0xe48a('0x6c'),_0xe48a('0x72'),_0xe48a('0xcb'),_0xe48a('0xcc'),_0xe48a('0x79')],'include':_0x3cc456}];_0x5b4299['push']({'model':db['SmsAccount'],'as':_0xe48a('0xcd'),'attributes':['id',_0xe48a('0x2b')]});_0x5b4299['push']({'model':db[_0xe48a('0x68')],'as':'Owner','attributes':['id',_0xe48a('0x2f')]});return db[_0xe48a('0x36')][_0xe48a('0x59')]({'where':{'id':_0x22e249['params']['id']},'include':_0x5b4299})[_0xe48a('0x27')](handleEntityNotFound(_0x1eb233,null))['then'](function(_0x1c7ac1){if(_0x1c7ac1){var _0x4b3001=_0x1c7ac1['get']({'plain':!![]});fs['mkdirSync'](_0xf4d047);var _0xa45880={'channel':_0xe48a('0xce'),'account':_0x4b3001['Account'][_0xe48a('0x2b')],'agent':_0x4b3001[_0xe48a('0xcf')]?_0x4b3001[_0xe48a('0xcf')][_0xe48a('0x2f')]:_0xe48a('0xd0'),'createdAt':moment(_0x4b3001['createdAt'])['format'](_0xe48a('0xb7'))[_0xe48a('0x94')](),'closedAt':_0x4b3001[_0xe48a('0xd1')]?moment(_0x4b3001[_0xe48a('0xd2')])[_0xe48a('0xc5')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe48a('0x94')]():'','disposition':_0x4b3001[_0xe48a('0xd3')],'messages':_(_0x4b3001[_0xe48a('0xca')])[_0xe48a('0x7d')]({'secret':![]})[_0xe48a('0x2e')](function(_0xa281a7){return{'date':moment(_0xa281a7[_0xe48a('0x72')])[_0xe48a('0xc5')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe48a('0x94')](),'sender':_0xa281a7['direction']===_0xe48a('0xd4')?_0xa281a7[_0xe48a('0x68')]?_0xa281a7[_0xe48a('0x68')][_0xe48a('0x2f')]:_0xe48a('0xd5'):_0xa281a7['Contact']['firstName']+(_0xa281a7[_0xe48a('0x5e')]['lastName']?'\x20'+_0xa281a7[_0xe48a('0x5e')][_0xe48a('0xc9')]:''),'body':_0xa281a7[_0xe48a('0x6c')],'direction':_0xa281a7[_0xe48a('0xcb')]===_0xe48a('0xd4')?'A':'C','secret':_0xa281a7[_0xe48a('0xcc')],'read':_0xa281a7[_0xe48a('0x79')]};})['value']()};return ejs['renderFile'](path[_0xe48a('0xc3')](config[_0xe48a('0xbf')],_0xe48a('0xc0'),'views',_0xe48a('0xd6')),{'interaction':_0xa45880})[_0xe48a('0x27')](function(_0x572484){var _0xd6d5e5=path[_0xe48a('0xc3')](_0xf4d047,'transcript-'+_0x4b3001['id']+'-'+_0x5a0ee2+'.pdf');var _0x169f58={'path':_0xd6d5e5,'channel':'Sms','interactionId':_0x4b3001['id']};return pdf[_0xe48a('0xd7')](_0x572484,_0x169f58);})['then'](function(){return new BPromise(function(_0x5088ff,_0x21a7d8){zipdir(_0xf4d047,{'saveTo':_0xe19074},function(_0x5eba0c,_0x757d60){if(_0x5eba0c)return _0x21a7d8(_0x5eba0c);return _0x5088ff(_0x757d60);});})[_0xe48a('0x27')](function(){return new BPromise(function(_0x3d1457,_0x151993){rimraf(_0xf4d047,function(_0x18b8c5){if(_0x18b8c5)_0x151993(_0x18b8c5);return _0x3d1457();});});})[_0xe48a('0x27')](function(){return _0x1eb233[_0xe48a('0xbd')](_0xe19074,_0x42d8e5,function(_0x566926){if(_0x566926){console[_0xe48a('0xd8')](_0xe48a('0xd9'),_0x566926);}else{fs[_0xe48a('0xda')](_0xe19074);}});});});}else{return _0x1eb233['sendStatus'](0xc8);}})[_0xe48a('0x34')](handleError(_0x1eb233,null));}; \ No newline at end of file +var _0x4aa8=['contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','i.*','Contact.lastName','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','params','include','options','create','destroy','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','$gte','format','merge','findAll','rows','addTags','setTags','color','emit','smsInteractionTags:save','removeTags','download','join','files','tmp','server','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Messages','createdAt','direction','secret','SmsAccount','Account','Owner','get','Sms','N.A.','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','out','System','renderFile','root','views','.pdf','createPdfFromHTML','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','offset','undefined','limit','count','set','apply','reject','save','update','then','end','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','index','SmsInteraction','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','field','from','tools_tags','select','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','text','body','some','isEmpty','SmsAccountId','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x4aa8,0x13d));var _0x84aa=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x4aa8[_0xefd519];return _0x4bb882;};'use strict';var emlformat=require(_0x84aa('0x0'));var rimraf=require(_0x84aa('0x1'));var zipdir=require(_0x84aa('0x2'));var jsonpatch=require(_0x84aa('0x3'));var rp=require(_0x84aa('0x4'));var moment=require('moment');var BPromise=require(_0x84aa('0x5'));var Mustache=require('mustache');var util=require(_0x84aa('0x6'));var path=require('path');var sox=require(_0x84aa('0x7'));var csv=require(_0x84aa('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x84aa('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x84aa('0xa'));var jsforce=require(_0x84aa('0xb'));var deskjs=require(_0x84aa('0xc'));var toCsv=require(_0x84aa('0x8'));var querystring=require(_0x84aa('0xd'));var Papa=require(_0x84aa('0xe'));var Redis=require('ioredis');var authService=require(_0x84aa('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x84aa('0x10'));var pdf=require(_0x84aa('0x11'));var hardwareService=require(_0x84aa('0x12'));var logger=require(_0x84aa('0x13'))(_0x84aa('0x14'));var utils=require(_0x84aa('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x84aa('0x16'))['db'];config[_0x84aa('0x17')]=_[_0x84aa('0x18')](config[_0x84aa('0x17')],{'host':_0x84aa('0x19'),'port':0x18eb});var socket=require(_0x84aa('0x1a'))(new Redis(config[_0x84aa('0x17')]));require('./smsInteraction.socket')[_0x84aa('0x1b')](socket);function respondWithStatusCode(_0x36dfae,_0x5c808e){_0x5c808e=_0x5c808e||0xcc;return function(_0x1dfd47){if(_0x1dfd47){return _0x36dfae[_0x84aa('0x1c')](_0x5c808e);}return _0x36dfae[_0x84aa('0x1d')](_0x5c808e)['end']();};}function respondWithResult(_0x2fb30f,_0x6908af){_0x6908af=_0x6908af||0xc8;return function(_0x44dde8){if(_0x44dde8){return _0x2fb30f[_0x84aa('0x1d')](_0x6908af)['json'](_0x44dde8);}};}function respondWithFilteredResult(_0x595087,_0xdb9754){return function(_0x434f74){if(_0x434f74){var _0x5ca283=typeof _0xdb9754[_0x84aa('0x1e')]===_0x84aa('0x1f')&&typeof _0xdb9754[_0x84aa('0x20')]===_0x84aa('0x1f');var _0x5ecdbc=_0x434f74[_0x84aa('0x21')];var _0x2832e5=_0x5ca283?0x0:_0xdb9754['offset'];var _0x5320ae=_0x5ca283?_0x434f74[_0x84aa('0x21')]:_0xdb9754[_0x84aa('0x1e')]+_0xdb9754[_0x84aa('0x20')];var _0x21d9cf;if(_0x5320ae>=_0x5ecdbc){_0x5320ae=_0x5ecdbc;_0x21d9cf=0xc8;}else{_0x21d9cf=0xce;}_0x595087[_0x84aa('0x1d')](_0x21d9cf);return _0x595087[_0x84aa('0x22')]('Content-Range',_0x2832e5+'-'+_0x5320ae+'/'+_0x5ecdbc)['json'](_0x434f74);}return null;};}function patchUpdates(_0x3fb177){return function(_0x31488e){try{jsonpatch[_0x84aa('0x23')](_0x31488e,_0x3fb177,!![]);}catch(_0x491301){return BPromise[_0x84aa('0x24')](_0x491301);}return _0x31488e[_0x84aa('0x25')]();};}function saveUpdates(_0x371d8e,_0x3de8d2){return function(_0x31e815){if(_0x31e815){return _0x31e815[_0x84aa('0x26')](_0x371d8e)[_0x84aa('0x27')](function(_0x140c40){return _0x140c40;});}return null;};}function removeEntity(_0x17bda6,_0x3944a5){return function(_0x284175){if(_0x284175){return _0x284175['destroy']()[_0x84aa('0x27')](function(){_0x17bda6[_0x84aa('0x1d')](0xcc)[_0x84aa('0x28')]();});}};}function handleEntityNotFound(_0x1d842d,_0x540bb0){return function(_0x5d20e9){if(!_0x5d20e9){_0x1d842d[_0x84aa('0x1c')](0x194);}return _0x5d20e9;};}function handleError(_0x3f4f37,_0xfecffc){_0xfecffc=_0xfecffc||0x1f4;return function(_0x2e7a47){logger[_0x84aa('0x29')](_0x2e7a47[_0x84aa('0x2a')]);if(_0x2e7a47[_0x84aa('0x2b')]){delete _0x2e7a47['name'];}_0x3f4f37['status'](_0xfecffc)[_0x84aa('0x2c')](_0x2e7a47);};}function getInteractionUsers(_0x34e3e8,_0x2f288e){return new BPromise(function(_0x5e79cd,_0x311cf9){try{if(_0x2f288e[_0x34e3e8['id']]){_0x34e3e8[_0x84aa('0x2d')]=_[_0x84aa('0x2e')](_0x2f288e[_0x34e3e8['id']],function(_0x68d1bb){return{'id':_0x68d1bb['id'],'fullname':_0x68d1bb[_0x84aa('0x2f')]};});}}catch(_0x3e7ce8){_0x311cf9(_0x3e7ce8);}_0x5e79cd(_0x34e3e8);});}function getInteractionTags(_0x1a1222,_0x12891a){return new BPromise(function(_0x45cce4,_0x120c09){try{if(_0x1a1222[_0x84aa('0x30')]){_0x1a1222[_0x84aa('0x31')]=[];_0x1a1222[_0x84aa('0x30')][_0x84aa('0x32')](',')['forEach'](function(_0x24da62){_0x1a1222['Tags'][_0x84aa('0x33')](_0x12891a[_0x24da62]);});}delete _0x1a1222[_0x84aa('0x30')];}catch(_0x2e0d90){_0x120c09(_0x2e0d90);}_0x45cce4(_0x1a1222);});}function updateSmsInteraction(_0x30d9bd,_0x3cbc73,_0x1df1a9){return new BPromise(function(_0x4dd6e5,_0x1683d7){return getInteractionUsers(_0x30d9bd,_0x1df1a9)['then'](function(_0x4e8eec){return getInteractionTags(_0x4e8eec,_0x3cbc73);})[_0x84aa('0x27')](function(_0x1e4f77){_0x4dd6e5(_0x1e4f77);})[_0x84aa('0x34')](function(_0x1f63eb){_0x1683d7(_0x1f63eb);});});}exports[_0x84aa('0x35')]=function(_0x1fabcf,_0x53e186){var _0x3e42b9={},_0x31ce3b={},_0x5b45fe={'count':0x0,'rows':[]};var _0xc2ba5b=_[_0x84aa('0x2e')](db[_0x84aa('0x36')][_0x84aa('0x37')],function(_0x43a37e){return{'name':_0x43a37e['fieldName'],'type':_0x43a37e[_0x84aa('0x38')][_0x84aa('0x39')]};});_0x31ce3b[_0x84aa('0x3a')]=_[_0x84aa('0x2e')](_0xc2ba5b,_0x84aa('0x2b'));_0x31ce3b[_0x84aa('0x3b')]=_[_0x84aa('0x3c')](_0x1fabcf[_0x84aa('0x3b')]);_0x31ce3b['filters']=_[_0x84aa('0x3d')](_0x31ce3b[_0x84aa('0x3a')],_0x31ce3b['query']);_0x3e42b9[_0x84aa('0x3e')]=_[_0x84aa('0x3d')](_0x31ce3b[_0x84aa('0x3a')],qs[_0x84aa('0x3f')](_0x1fabcf[_0x84aa('0x3b')][_0x84aa('0x3f')]));_0x3e42b9[_0x84aa('0x3e')]=_0x3e42b9[_0x84aa('0x3e')][_0x84aa('0x40')]?_0x3e42b9[_0x84aa('0x3e')]:_0x31ce3b[_0x84aa('0x3a')];if(!_0x1fabcf[_0x84aa('0x3b')][_0x84aa('0x41')]('nolimit')){_0x3e42b9['limit']=qs[_0x84aa('0x20')](_0x1fabcf[_0x84aa('0x3b')][_0x84aa('0x20')]);_0x3e42b9['offset']=qs[_0x84aa('0x1e')](_0x1fabcf['query'][_0x84aa('0x1e')]);}_0x3e42b9[_0x84aa('0x42')]=qs[_0x84aa('0x43')](_0x1fabcf[_0x84aa('0x3b')][_0x84aa('0x43')]);_0x3e42b9[_0x84aa('0x44')]=qs[_0x84aa('0x45')](_[_0x84aa('0x46')](_0x1fabcf[_0x84aa('0x3b')],_0x31ce3b[_0x84aa('0x45')]),_0xc2ba5b);var _0x1c77c0=[];var _0x40f6f5=squel['select']()['field']('id')['field'](_0x84aa('0x2b'))[_0x84aa('0x47')]('color')[_0x84aa('0x48')](_0x84aa('0x49'));var _0x51c8a5=squel[_0x84aa('0x4a')]()[_0x84aa('0x47')](_0x84aa('0x4b'))[_0x84aa('0x47')](_0x84aa('0x4c'))[_0x84aa('0x47')](_0x84aa('0x4d'))['from'](_0x84aa('0x4e'),'ui')[_0x84aa('0x4f')](_0x84aa('0x50'),'u',_0x84aa('0x51'));var _0x3f4078=squel['select']()['from'](_0x84aa('0x52'),'i')[_0x84aa('0x4f')](_0x84aa('0x53'),'c',_0x84aa('0x54'))[_0x84aa('0x4f')](_0x84aa('0x50'),'o','o.id\x20=\x20i.UserId')[_0x84aa('0x4f')](_0x84aa('0x55'),'a',_0x84aa('0x56'))[_0x84aa('0x4f')]('sms_messages','me',_0x84aa('0x57'))[_0x84aa('0x4f')](_0x84aa('0x58'),'it',_0x84aa('0x59'))['left_join'](_0x84aa('0x49'),'t',_0x84aa('0x5a'));var _0x3441a7=squel[_0x84aa('0x5b')]();var _0xcc6b4a=[];var _0x1433bd=squel[_0x84aa('0x5b')]();var _0x1d9da3;if(_0x1fabcf[_0x84aa('0x3b')][_0x84aa('0x5c')]){_0x1d9da3=as[_0x84aa('0x5d')](_0x1fabcf[_0x84aa('0x3b')][_0x84aa('0x5c')]);var _0x2148bb=_0x1d9da3[_0x84aa('0x5e')];for(var _0x39c361=0x0;_0x39c361<_0x1d9da3['conditions'][_0x84aa('0x40')];_0x39c361++){var _0x35527b=_0x1d9da3[_0x84aa('0x5f')][_0x39c361];var _0x490059='i';var _0x1a0825=_[_0x84aa('0x60')](_0xc2ba5b,[_0x84aa('0x2b'),_0x35527b['field']]);if(!_0x1a0825){switch(_0x35527b[_0x84aa('0x47')]){case _0x84aa('0x61'):if(_0x35527b[_0x84aa('0x62')]==0x1){_0x3f4078['having']('`'+_0x35527b[_0x84aa('0x47')]+_0x84aa('0x63'));}else{_0x3f4078[_0x84aa('0x64')]('`'+_0x35527b[_0x84aa('0x47')]+_0x84aa('0x65'));}break;case _0x84aa('0x66'):if(_0x35527b[_0x84aa('0x67')]===_0x84aa('0x68')){if(_0x35527b[_0x84aa('0x62')]['split']('\x20')[_0x84aa('0x40')]>0x1){_0x3441a7[_0x2148bb](_0x84aa('0x69'),qs['getFullTextValue'](_0x35527b[_0x84aa('0x62')]),null);}else{var _0x2cdec2='%'+_0x35527b['value']+'%';_0x3441a7[_0x2148bb](_0x84aa('0x6a'),_0x2cdec2,_0x2cdec2,_0x2cdec2);}}else{_0x1a0825=_['find'](_0xc2ba5b,['name',_0x84aa('0x6b')]);_0x35527b['field']=_0x84aa('0x6b');_0x53b496=as[_0x84aa('0x6c')](_0x490059,_0x1a0825[_0x84aa('0x38')],_0x35527b);_0x3441a7[_0x2148bb](_0x53b496['text'],_0x53b496['value'][_0x84aa('0x6d')],_0x53b496[_0x84aa('0x62')][_0x84aa('0x28')]);}break;case _0x84aa('0x6e'):var _0x1741de=_0x35527b['value'][_0x84aa('0x32')](',')[_0x84aa('0x2e')](function(_0x3d8d32){return Number(_0x3d8d32);});_0x1741de[_0x84aa('0x6f')](function(_0x10786b){_0x1433bd['or'](_0x84aa('0x70'),'%,'+_0x10786b+',%');});_0xcc6b4a=_[_0x84aa('0x71')](_0xcc6b4a,_0x1741de);break;case _0x84aa('0x72'):if(_0x35527b['operator']===_0x84aa('0x68')){_0x3441a7[_0x2148bb]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x35527b[_0x84aa('0x62')]+'%',null);}else{_0x1a0825=_[_0x84aa('0x60')](_0xc2ba5b,['name','UserId']);_0x35527b[_0x84aa('0x47')]=_0x84aa('0x73');_0x53b496=as[_0x84aa('0x6c')](_0x490059,_0x1a0825[_0x84aa('0x38')],_0x35527b);_0x3441a7[_0x2148bb](_0x53b496[_0x84aa('0x74')],_0x53b496[_0x84aa('0x62')][_0x84aa('0x6d')],_0x53b496['value'][_0x84aa('0x28')]);}break;case _0x84aa('0x75'):_0x53b496=as[_0x84aa('0x6c')]('me',null,_0x35527b);_0x3441a7[_0x2148bb](_0x53b496[_0x84aa('0x74')],_0x53b496['value'][_0x84aa('0x6d')],_0x53b496['value'][_0x84aa('0x28')]);break;}}else{var _0x53b496=as[_0x84aa('0x6c')](_0x490059,_0x1a0825[_0x84aa('0x38')],_0x35527b);_0x3441a7[_0x2148bb](_0x53b496[_0x84aa('0x74')],_0x53b496[_0x84aa('0x62')][_0x84aa('0x6d')],_0x53b496[_0x84aa('0x62')][_0x84aa('0x28')]);}}}else{var _0x3ef8b7=_(_0x1fabcf['query'])[_0x84aa('0x3c')]()[_0x84aa('0x2e')](function(_0x41b312){return _[_0x84aa('0x76')](_0xc2ba5b,['name',_0x41b312])?_0x41b312:undefined;})['compact']()[_0x84aa('0x62')]();if(!_[_0x84aa('0x77')](_0x3ef8b7)){_0x3ef8b7[_0x84aa('0x6f')](function(_0x11411){if(_0x11411===_0x84aa('0x78')){_0x3f4078['where']('i.SmsAccountId\x20IN\x20?',[]['concat'](_0x1fabcf[_0x84aa('0x3b')][_0x11411]));}else if(_0x11411==='createdAt'){var _0x231a9e=JSON[_0x84aa('0x79')](_0x1fabcf[_0x84aa('0x3b')][_0x11411])['$gte'];var _0x1e72eb=JSON[_0x84aa('0x79')](_0x1fabcf[_0x84aa('0x3b')][_0x11411])[_0x84aa('0x7a')];_0x3f4078[_0x84aa('0x44')](_0x84aa('0x7b'),_0x231a9e,_0x1e72eb);}else{if(_0x1fabcf['query'][_0x11411]===_0x84aa('0x7c')){_0x3f4078[_0x84aa('0x44')]('i.'+_0x11411+_0x84aa('0x7d'));}else{_0x3f4078['where']('i.'+_0x11411+'\x20=\x20?',_0x1fabcf['query'][_0x11411]);}}});}if(_0x1fabcf[_0x84aa('0x3b')][_0x84aa('0x7e')]){if(_0x1fabcf['query'][_0x84aa('0x7e')]==0x1){_0x3f4078[_0x84aa('0x64')](_0x84aa('0x7f'));}else{_0x3f4078[_0x84aa('0x64')]('`unreadMessages`\x20>\x200');}}if(_0x1fabcf['query'][_0x84aa('0x80')]){_0xcc6b4a=_[_0x84aa('0x81')](_0x1fabcf[_0x84aa('0x3b')][_0x84aa('0x80')])?_0x1fabcf[_0x84aa('0x3b')][_0x84aa('0x80')]:new Array(_0x1fabcf[_0x84aa('0x3b')][_0x84aa('0x80')]);_0xcc6b4a[_0x84aa('0x6f')](function(_0x436131){_0x1433bd['or'](_0x84aa('0x70'),'%,'+_0x436131+',%');});}if(_0x1fabcf[_0x84aa('0x3b')][_0x84aa('0x82')]){var _0x3a1d9f=_0x1fabcf[_0x84aa('0x3b')][_0x84aa('0x82')]['replace']('\x5c','\x5c\x5c')[_0x84aa('0x83')](/'/g,'\x27\x27');if(qs[_0x84aa('0x84')](_0x3a1d9f)){_0x3441a7['or'](_0x84aa('0x85'),_0x3a1d9f+'%')['or'](_0x84aa('0x86'),_0x3a1d9f+'%');}else{_0x3441a7['or'](_0x84aa('0x87'),qs[_0x84aa('0x88')](_0x3a1d9f))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3a1d9f+'%');}}}_0x3f4078[_0x84aa('0x44')](_0x3441a7);_0x3f4078[_0x84aa('0x89')](_0x84aa('0x8a'));var _0x452410={'type':db[_0x84aa('0x8b')][_0x84aa('0x8c')]['SELECT'],'raw':!![]};var _0x27c0ab=_0x3f4078[_0x84aa('0x8d')]();_0x27c0ab[_0x84aa('0x47')](_0x84aa('0x8a'));_0x27c0ab[_0x84aa('0x47')](_0x84aa('0x8e'),_0x84aa('0x61'));if(_0x3e42b9[_0x84aa('0x42')]){_0x3e42b9['order'][_0x84aa('0x6f')](function(_0x3dccd2){var _0x413a41=_0x3dccd2[0x0]===_0x84aa('0x8f')?_0x3dccd2[0x0]:'i.'+_0x3dccd2[0x0];_0x3f4078[_0x84aa('0x42')](_0x413a41,_0x3dccd2[0x1]===_0x84aa('0x90')?![]:!![]);});}if(!_[_0x84aa('0x77')](_0xcc6b4a)){_0x3f4078[_0x84aa('0x64')](_0x1433bd);_0x27c0ab['where'](_0x84aa('0x91'),_0xcc6b4a);}BPromise[_0x84aa('0x92')]()[_0x84aa('0x27')](function(){if(!_0x1d9da3){if(_0x1fabcf[_0x84aa('0x3b')][_0x84aa('0x78')])return;_0x27c0ab[_0x84aa('0x44')](_0x84aa('0x93'));_0x3f4078['where'](_0x84aa('0x93'));return;}if(_0x1fabcf['user'][_0x84aa('0x94')]!==_0x84aa('0x95'))return;return _0x1fabcf[_0x84aa('0x96')][_0x84aa('0x97')]({'attributes':['id'],'raw':!![]})['then'](function(_0x59afe1){if(_[_0x84aa('0x77')](_0x59afe1)){_0x27c0ab[_0x84aa('0x44')](_0x84aa('0x98'));_0x3f4078['where'](_0x84aa('0x98'));}else{_0x27c0ab[_0x84aa('0x44')](_0x84aa('0x99'),_[_0x84aa('0x2e')](_0x59afe1,'id'));_0x3f4078['where'](_0x84aa('0x99'),_[_0x84aa('0x2e')](_0x59afe1,'id'));}});})[_0x84aa('0x27')](function(){if(_0x1fabcf['user'][_0x84aa('0x94')]==='agent'&&!_0x1d9da3&&!_0x1fabcf[_0x84aa('0x3b')][_0x84aa('0x78')])return[];return db[_0x84aa('0x9a')][_0x84aa('0x3b')](_0x27c0ab[_0x84aa('0x9b')](),_0x452410);})[_0x84aa('0x27')](function(_0x2514c3){_0x5b45fe[_0x84aa('0x21')]=_0x2514c3['length'];if(_0x5b45fe[_0x84aa('0x21')]===0x0)return[];return db['sequelize'][_0x84aa('0x3b')](_0x40f6f5[_0x84aa('0x9b')](),_0x452410)['then'](function(_0x617ac6){_0x1c77c0=_[_0x84aa('0x9c')](_0x617ac6,'id');_0x452410=_['merge'](_0x452410,{'model':db[_0x84aa('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1fabcf[_0x84aa('0x3b')][_0x84aa('0x3f')]){_0x3e42b9[_0x84aa('0x3e')]['forEach'](function(_0x4aece6){_0x3f4078[_0x84aa('0x47')]('i.'+_0x4aece6);});}else{_0x3f4078[_0x84aa('0x47')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x84aa('0x61'));_0x3f4078[_0x84aa('0x47')](_0x84aa('0x9d'),_0x84aa('0x9e'));_0x3f4078[_0x84aa('0x47')](_0x84aa('0x9f'),'Account.mandatoryDisposition');_0x3f4078[_0x84aa('0x47')]('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',_0x84aa('0x8f'));_0x3f4078[_0x84aa('0x47')](_0x84aa('0xa0'));_0x3f4078[_0x84aa('0x47')]('c.firstName','Contact.firstName');_0x3f4078['field']('c.lastName',_0x84aa('0xa1'));_0x3f4078[_0x84aa('0x47')]('c.email','Contact.email');_0x3f4078['field']('c.phone',_0x84aa('0xa2'));_0x3f4078['field'](_0x84aa('0xa3'),_0x84aa('0xa4'));_0x3f4078[_0x84aa('0x47')](_0x84aa('0xa5'),_0x84aa('0xa6'));_0x3f4078[_0x84aa('0x47')](_0x84aa('0xa7'),'Owner.fullname');_0x3f4078[_0x84aa('0x47')](_0x84aa('0xa8'),_0x84aa('0xa9'));_0x3f4078[_0x84aa('0x47')](_0x84aa('0xaa'),_0x84aa('0x30'));}if(_0x3e42b9[_0x84aa('0x20')])_0x3f4078[_0x84aa('0x20')](_0x3e42b9[_0x84aa('0x20')]);if(_0x3e42b9['offset'])_0x3f4078[_0x84aa('0x1e')](_0x3e42b9[_0x84aa('0x1e')]);return db[_0x84aa('0x9a')]['query'](_0x3f4078[_0x84aa('0x9b')](),_0x452410);})['then'](function(_0xefc6b1){if(_0xefc6b1[_0x84aa('0x40')]>0x0)_0x51c8a5['where'](_0x84aa('0xab'),_['map'](_0xefc6b1,'id'));return db[_0x84aa('0x9a')]['query'](_0x51c8a5[_0x84aa('0x9b')](),_0x452410)[_0x84aa('0x27')](function(_0x220ca6){var _0x2405e8=_[_0x84aa('0xac')](_0x220ca6,_0x84aa('0xad'));var _0x19342f=[];_0xefc6b1['forEach'](function(_0x42918c){_0x19342f[_0x84aa('0x33')](updateSmsInteraction(_0x42918c,_0x1c77c0,_0x2405e8));});return BPromise[_0x84aa('0xae')](_0x19342f);});});})[_0x84aa('0x27')](function(_0x4e9cee){_0x5b45fe['rows']=_0x4e9cee;return _0x5b45fe;})[_0x84aa('0x27')](respondWithFilteredResult(_0x53e186,_0x3e42b9))[_0x84aa('0x34')](handleError(_0x53e186,null));};exports['show']=function(_0x40bdfb,_0x54f0ab){var _0x4a8c69={'raw':![],'where':{'id':_0x40bdfb[_0x84aa('0xaf')]['id']}},_0x4539ce={};_0x4539ce['model']=_[_0x84aa('0x3c')](db[_0x84aa('0x36')][_0x84aa('0x37')]);_0x4539ce['query']=_[_0x84aa('0x3c')](_0x40bdfb['query']);_0x4539ce['filters']=_['intersection'](_0x4539ce[_0x84aa('0x3a')],_0x4539ce[_0x84aa('0x3b')]);_0x4a8c69[_0x84aa('0x3e')]=_[_0x84aa('0x3d')](_0x4539ce['model'],qs[_0x84aa('0x3f')](_0x40bdfb['query'][_0x84aa('0x3f')]));_0x4a8c69[_0x84aa('0x3e')]=_0x4a8c69[_0x84aa('0x3e')][_0x84aa('0x40')]?_0x4a8c69[_0x84aa('0x3e')]:_0x4539ce[_0x84aa('0x3a')];if(_0x40bdfb['query']['includeAll']){_0x4a8c69[_0x84aa('0xb0')]=[{'all':!![]}];}_0x4a8c69=_['merge']({},_0x4a8c69,_0x40bdfb[_0x84aa('0xb1')]);return db[_0x84aa('0x36')][_0x84aa('0x60')](_0x4a8c69)['then'](handleEntityNotFound(_0x54f0ab,null))['then'](respondWithResult(_0x54f0ab,null))[_0x84aa('0x34')](handleError(_0x54f0ab,null));};exports[_0x84aa('0xb2')]=function(_0x39faf8,_0x30de35){return db[_0x84aa('0x36')]['create'](_0x39faf8[_0x84aa('0x75')],{})[_0x84aa('0x27')](respondWithResult(_0x30de35,0xc9))[_0x84aa('0x34')](handleError(_0x30de35,null));};exports[_0x84aa('0x26')]=function(_0x1c2a15,_0x2c03dd){if(_0x1c2a15[_0x84aa('0x75')]['id']){delete _0x1c2a15[_0x84aa('0x75')]['id'];}return db[_0x84aa('0x36')]['find']({'where':{'id':_0x1c2a15[_0x84aa('0xaf')]['id']}})['then'](handleEntityNotFound(_0x2c03dd,null))[_0x84aa('0x27')](saveUpdates(_0x1c2a15['body'],null))['then'](respondWithResult(_0x2c03dd,null))['catch'](handleError(_0x2c03dd,null));};exports[_0x84aa('0xb3')]=function(_0x3094d1,_0x16e365){return db[_0x84aa('0x36')][_0x84aa('0x60')]({'where':{'id':_0x3094d1[_0x84aa('0xaf')]['id']}})[_0x84aa('0x27')](handleEntityNotFound(_0x16e365,null))[_0x84aa('0x27')](removeEntity(_0x16e365,null))['catch'](handleError(_0x16e365,null));};exports[_0x84aa('0xb4')]=function(_0x10cdb3,_0x561417){return db[_0x84aa('0x36')][_0x84aa('0xb4')]()[_0x84aa('0x27')](respondWithResult(_0x561417,null))[_0x84aa('0x34')](handleError(_0x561417,null));};exports[_0x84aa('0xb5')]=function(_0x4723d8,_0x347625,_0x3e1bad){return db[_0x84aa('0xb6')][_0x84aa('0x60')]({'where':{'id':_0x4723d8[_0x84aa('0xaf')]['id']}})[_0x84aa('0x27')](handleEntityNotFound(_0x347625,null))[_0x84aa('0x27')](function(_0x29a4a3){if(_0x29a4a3){return _0x29a4a3[_0x84aa('0xb5')](_0x4723d8[_0x84aa('0x75')][_0x84aa('0xb7')],_[_0x84aa('0xb8')](_0x4723d8[_0x84aa('0x75')],[_0x84aa('0xb7'),'id'])||{});}})[_0x84aa('0x27')](respondWithResult(_0x347625,null))[_0x84aa('0x34')](handleError(_0x347625,null));};exports[_0x84aa('0xb9')]=function(_0xf96f8e,_0x9b45e2,_0x34c89e){var _0x30dc78={'raw':![],'where':{}};var _0xe721a7={};var _0x591166={'count':0x0,'rows':[]};return db[_0x84aa('0x36')][_0x84aa('0xba')]({'where':{'id':_0xf96f8e[_0x84aa('0xaf')]['id']}})[_0x84aa('0x27')](handleEntityNotFound(_0x9b45e2,null))[_0x84aa('0x27')](function(_0x3e9aa5){if(_0x3e9aa5){_0xe721a7[_0x84aa('0x3a')]=_[_0x84aa('0x3c')](db[_0x84aa('0xb6')][_0x84aa('0x37')]);_0xe721a7['query']=_['keys'](_0xf96f8e[_0x84aa('0x3b')]);_0xe721a7[_0x84aa('0x45')]=_[_0x84aa('0x3d')](_0xe721a7['model'],_0xe721a7['query']);_0x30dc78[_0x84aa('0x3e')]=_[_0x84aa('0x3d')](_0xe721a7['model'],qs[_0x84aa('0x3f')](_0xf96f8e['query'][_0x84aa('0x3f')]));_0x30dc78[_0x84aa('0x3e')]=_0x30dc78[_0x84aa('0x3e')][_0x84aa('0x40')]?_0x30dc78[_0x84aa('0x3e')]:_0xe721a7[_0x84aa('0x3a')];if(!_0xf96f8e['query'][_0x84aa('0x41')]('nolimit')){_0x30dc78[_0x84aa('0x20')]=qs[_0x84aa('0x20')](_0xf96f8e[_0x84aa('0x3b')][_0x84aa('0x20')]);_0x30dc78[_0x84aa('0x1e')]=qs[_0x84aa('0x1e')](_0xf96f8e[_0x84aa('0x3b')][_0x84aa('0x1e')]);}_0x30dc78['order']=qs[_0x84aa('0x43')](_0xf96f8e[_0x84aa('0x3b')][_0x84aa('0x43')]);_0x30dc78['where']=qs[_0x84aa('0x45')](_['pick'](_0xf96f8e[_0x84aa('0x3b')],_0xe721a7[_0x84aa('0x45')]));_0x30dc78[_0x84aa('0x44')][_0x84aa('0xad')]=_0x3e9aa5['id'];if(_0xf96f8e[_0x84aa('0x3b')]['filter']){_0x30dc78[_0x84aa('0x44')]=_['merge'](_0x30dc78[_0x84aa('0x44')],{'$or':_[_0x84aa('0x2e')](_0x30dc78[_0x84aa('0x3e')],function(_0x3f3bcb){var _0x1ea394={};_0x1ea394[_0x3f3bcb]={'$like':'%'+_0xf96f8e[_0x84aa('0x3b')]['filter']+'%'};return _0x1ea394;})});}if(_0xf96f8e[_0x84aa('0x3b')][_0x84aa('0xbb')]){var _0x1953df=_0xf96f8e[_0x84aa('0x3b')][_0x84aa('0xbb')]['split'](',');var _0x185e34={};_0x185e34[_0x1953df[0x0]]={'$gte':moment(_0x1953df[0x1])[_0x84aa('0xbc')]('YYYY-MM-DD\x20HH:mm:ss')};_0x30dc78[_0x84aa('0x44')]=_['merge'](_0x30dc78[_0x84aa('0x44')],_0x185e34);}_0x30dc78=_[_0x84aa('0xbd')]({},_0x30dc78,_0xf96f8e['options']);return db[_0x84aa('0xb6')][_0x84aa('0x21')]({'where':_0x30dc78[_0x84aa('0x44')]})[_0x84aa('0x27')](function(_0x3380f2){_0x591166['count']=_0x3380f2;if(_0xf96f8e[_0x84aa('0x3b')]['includeAll']){_0x30dc78[_0x84aa('0xb0')]=[{'all':!![]}];}return db[_0x84aa('0xb6')][_0x84aa('0xbe')](_0x30dc78);})[_0x84aa('0x27')](function(_0x4ee4b4){_0x591166[_0x84aa('0xbf')]=_0x4ee4b4;return _0x591166;});}})[_0x84aa('0x27')](respondWithFilteredResult(_0x9b45e2,_0x30dc78))[_0x84aa('0x34')](handleError(_0x9b45e2,null));};exports[_0x84aa('0xc0')]=function(_0x5572b4,_0x58e8ea,_0x3966c9){return db[_0x84aa('0x36')][_0x84aa('0x60')]({'where':{'id':_0x5572b4[_0x84aa('0xaf')]['id']}})['then'](handleEntityNotFound(_0x58e8ea,null))[_0x84aa('0x27')](function(_0x43572f){if(_0x43572f){return _0x43572f[_0x84aa('0xc1')](_0x5572b4[_0x84aa('0x75')][_0x84aa('0xb7')],_[_0x84aa('0xb8')](_0x5572b4['body'],[_0x84aa('0xb7'),'id'])||{})['spread'](function(){return db['Tag'][_0x84aa('0xbe')]({'attributes':['id',_0x84aa('0x2b'),_0x84aa('0xc2')],'where':{'id':_0x5572b4[_0x84aa('0x75')][_0x84aa('0xb7')]}});})[_0x84aa('0x27')](function(_0x57406f){socket[_0x84aa('0xc3')](_0x84aa('0xc4'),{'id':Number(_0x5572b4['params']['id']),'tags':_0x57406f||[]});return{'id':Number(_0x5572b4[_0x84aa('0xaf')]['id']),'tags':_0x57406f||[]};});}})[_0x84aa('0x27')](respondWithResult(_0x58e8ea,null))[_0x84aa('0x34')](handleError(_0x58e8ea,null));};exports[_0x84aa('0xc5')]=function(_0x4f3b66,_0x50e336,_0x31b5af){return db['SmsInteraction'][_0x84aa('0x60')]({'where':{'id':_0x4f3b66[_0x84aa('0xaf')]['id']}})[_0x84aa('0x27')](handleEntityNotFound(_0x50e336,null))[_0x84aa('0x27')](function(_0x1e198a){if(_0x1e198a){return _0x1e198a[_0x84aa('0xc5')](_0x4f3b66[_0x84aa('0x3b')]['ids']);}})[_0x84aa('0x27')](respondWithStatusCode(_0x50e336,null))[_0x84aa('0x34')](handleError(_0x50e336,null));};exports[_0x84aa('0xc6')]=function(_0x3a93d,_0x22a300){var _0x8450e1=moment()['unix']()[_0x84aa('0x9b')]();var _0x2ec211=path[_0x84aa('0xc7')](config['root'],'server',_0x84aa('0xc8'),_0x84aa('0xc9'));var _0x3c9949=path['join'](config['root'],_0x84aa('0xca'),_0x84aa('0xc8'),_0x84aa('0xcb'));var _0x4197b2=path[_0x84aa('0xc7')](_0x2ec211,_0x8450e1);var _0x241e02=util[_0x84aa('0xbc')](_0x84aa('0xcc'),_0x3a93d[_0x84aa('0xaf')]['id'],_0x8450e1);var _0x49a29e=path[_0x84aa('0xc7')](_0x2ec211,_0x241e02);var _0x5b00ba=[];_0x5b00ba[_0x84aa('0x33')]({'model':db[_0x84aa('0x72')],'as':'User','attributes':['id',_0x84aa('0x2f')],'raw':!![]});_0x5b00ba[_0x84aa('0x33')]({'model':db[_0x84aa('0xcd')],'as':_0x84aa('0x66'),'attributes':['id',_0x84aa('0xce'),_0x84aa('0xcf')],'raw':!![]});var _0x331237=[{'model':db[_0x84aa('0xb6')],'as':_0x84aa('0xd0'),'attributes':['id',_0x84aa('0x75'),_0x84aa('0xd1'),_0x84aa('0xd2'),_0x84aa('0xd3'),_0x84aa('0x7e')],'include':_0x5b00ba}];_0x331237['push']({'model':db[_0x84aa('0xd4')],'as':_0x84aa('0xd5'),'attributes':['id','name']});_0x331237[_0x84aa('0x33')]({'model':db[_0x84aa('0x72')],'as':_0x84aa('0xd6'),'attributes':['id',_0x84aa('0x2f')]});return db[_0x84aa('0x36')][_0x84aa('0x60')]({'where':{'id':_0x3a93d[_0x84aa('0xaf')]['id']},'include':_0x331237})[_0x84aa('0x27')](handleEntityNotFound(_0x22a300,null))[_0x84aa('0x27')](function(_0x2fbe05){if(_0x2fbe05){var _0x81a396=_0x2fbe05[_0x84aa('0xd7')]({'plain':!![]});fs['mkdirSync'](_0x4197b2);var _0x5d199e={'channel':_0x84aa('0xd8'),'account':_0x81a396[_0x84aa('0xd5')]['name'],'agent':_0x81a396[_0x84aa('0xd6')]?_0x81a396[_0x84aa('0xd6')][_0x84aa('0x2f')]:_0x84aa('0xd9'),'createdAt':moment(_0x81a396[_0x84aa('0xd1')])[_0x84aa('0xbc')]('YYYY-MM-DD\x20HH:mm:ss')[_0x84aa('0x9b')](),'closedAt':_0x81a396[_0x84aa('0xda')]?moment(_0x81a396[_0x84aa('0xdb')])[_0x84aa('0xbc')](_0x84aa('0xdc'))[_0x84aa('0x9b')]():'','disposition':_0x81a396['disposition'],'messages':_(_0x81a396[_0x84aa('0xd0')])[_0x84aa('0x82')]({'secret':![]})[_0x84aa('0x2e')](function(_0x3c197d){return{'date':moment(_0x3c197d[_0x84aa('0xd1')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x84aa('0x9b')](),'sender':_0x3c197d[_0x84aa('0xd2')]===_0x84aa('0xdd')?_0x3c197d[_0x84aa('0x72')]?_0x3c197d['User'][_0x84aa('0x2f')]:_0x84aa('0xde'):_0x3c197d[_0x84aa('0x66')][_0x84aa('0xce')]+(_0x3c197d[_0x84aa('0x66')]['lastName']?'\x20'+_0x3c197d['Contact'][_0x84aa('0xcf')]:''),'body':_0x3c197d[_0x84aa('0x75')],'direction':_0x3c197d[_0x84aa('0xd2')]==='out'?'A':'C','secret':_0x3c197d[_0x84aa('0xd3')],'read':_0x3c197d[_0x84aa('0x7e')]};})[_0x84aa('0x62')]()};return ejs[_0x84aa('0xdf')](path['join'](config[_0x84aa('0xe0')],'server',_0x84aa('0xe1'),'downloadInteraction.ejs'),{'interaction':_0x5d199e})[_0x84aa('0x27')](function(_0x341304){var _0x32c9d1=path[_0x84aa('0xc7')](_0x4197b2,'transcript-'+_0x81a396['id']+'-'+_0x8450e1+_0x84aa('0xe2'));var _0x4bae01={'path':_0x32c9d1,'channel':_0x84aa('0xd8'),'interactionId':_0x81a396['id']};return pdf[_0x84aa('0xe3')](_0x341304,_0x4bae01);})[_0x84aa('0x27')](function(){return new BPromise(function(_0x442776,_0x20428c){zipdir(_0x4197b2,{'saveTo':_0x49a29e},function(_0x2bba5b,_0x17bdb5){if(_0x2bba5b)return _0x20428c(_0x2bba5b);return _0x442776(_0x17bdb5);});})[_0x84aa('0x27')](function(){return new BPromise(function(_0x2172cf,_0x298c04){rimraf(_0x4197b2,function(_0x39b94d){if(_0x39b94d)_0x298c04(_0x39b94d);return _0x2172cf();});});})[_0x84aa('0x27')](function(){return _0x22a300['download'](_0x49a29e,_0x241e02,function(_0xf1fcf4){if(_0xf1fcf4){console['log'](_0x84aa('0xe4'),_0xf1fcf4);}else{fs[_0x84aa('0xe5')](_0x49a29e);}});});});}else{return _0x22a300[_0x84aa('0x1c')](0xc8);}})['catch'](handleError(_0x22a300,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 7abb58e..0a4db9f 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 _0x1eba=['remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','events','../../mysqldb','SmsInteraction','SmsMessage','update'];(function(_0x437701,_0x434f5c){var _0x1820f2=function(_0x31000d){while(--_0x31000d){_0x437701['push'](_0x437701['shift']());}};_0x1820f2(++_0x434f5c);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x34a8c8,_0x31e259){_0x34a8c8=_0x34a8c8-0x0;var _0x1fe6e5=_0x1eba[_0x34a8c8];return _0x1fe6e5;};'use strict';var EventEmitter=require(_0xa1eb('0x0'));var SmsInteraction=require(_0xa1eb('0x1'))['db'][_0xa1eb('0x2')];var SmsMessage=require(_0xa1eb('0x1'))['db'][_0xa1eb('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa1eb('0x4'),'afterDestroy':_0xa1eb('0x5')};function emitEvent(_0x16a13a){return function(_0xf9d704,_0x138789,_0x2933d0){_0xf9d704[_0xa1eb('0x6')]({'attributes':['id'],'raw':!![]})[_0xa1eb('0x7')](function(_0x39a5a3){_0xf9d704[_0xa1eb('0x8')](_0xa1eb('0x9'),_0x39a5a3[_0xa1eb('0xa')](function(_0x54d235){return{'id':_0x54d235['id']};}));return SmsMessage[_0xa1eb('0xb')]({'where':{'SmsInteractionId':_0xf9d704['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x219802){_0xf9d704['setDataValue'](_0xa1eb('0xc'),_0x219802['length']);SmsInteractionEvents[_0xa1eb('0xd')](_0x16a13a+':'+_0xf9d704['id'],_0xf9d704);SmsInteractionEvents['emit'](_0x16a13a,_0xf9d704);_0x2933d0(null);})[_0xa1eb('0xe')](_0x2933d0(null));};}for(var e in events){if(events[_0xa1eb('0xf')](e)){var event=events[e];SmsInteraction[_0xa1eb('0x10')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x4cf8=['unreadMessages','length','emit','catch','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','findAll'];(function(_0xd12371,_0x59e049){var _0x217ba0=function(_0x3d3fb2){while(--_0x3d3fb2){_0xd12371['push'](_0xd12371['shift']());}};_0x217ba0(++_0x59e049);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x55257d,_0x3998ec){_0x55257d=_0x55257d-0x0;var _0x4d296d=_0x4cf8[_0x55257d];return _0x4d296d;};'use strict';var EventEmitter=require(_0x84cf('0x0'));var SmsInteraction=require(_0x84cf('0x1'))['db'][_0x84cf('0x2')];var SmsMessage=require(_0x84cf('0x1'))['db'][_0x84cf('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x84cf('0x4')](0x0);var events={'afterCreate':_0x84cf('0x5'),'afterUpdate':_0x84cf('0x6'),'afterDestroy':_0x84cf('0x7')};function emitEvent(_0x2d38c0){return function(_0x5844d7,_0x2c613d,_0x50ade2){_0x5844d7['getUsers']({'attributes':['id'],'raw':!![]})[_0x84cf('0x8')](function(_0x56c5cc){_0x5844d7[_0x84cf('0x9')](_0x84cf('0xa'),_0x56c5cc['map'](function(_0x2e0b79){return{'id':_0x2e0b79['id']};}));return SmsMessage[_0x84cf('0xb')]({'where':{'SmsInteractionId':_0x5844d7['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xfb5398){_0x5844d7[_0x84cf('0x9')](_0x84cf('0xc'),_0xfb5398[_0x84cf('0xd')]);SmsInteractionEvents['emit'](_0x2d38c0+':'+_0x5844d7['id'],_0x5844d7);SmsInteractionEvents[_0x84cf('0xe')](_0x2d38c0,_0x5844d7);_0x50ade2(null);})[_0x84cf('0xf')](_0x50ade2(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x84cf('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index e441992..06343c1 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 _0xfc29=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','lodash'];(function(_0xee66a9,_0x1969e5){var _0x307b4e=function(_0xb156c8){while(--_0xb156c8){_0xee66a9['push'](_0xee66a9['shift']());}};_0x307b4e(++_0x1969e5);}(_0xfc29,0x179));var _0x9fc2=function(_0x2d86a2,_0x342454){_0x2d86a2=_0x2d86a2-0x0;var _0x362eb0=_0xfc29[_0x2d86a2];return _0x362eb0;};'use strict';var _=require(_0x9fc2('0x0'));var util=require('util');var logger=require(_0x9fc2('0x1'))(_0x9fc2('0x2'));var moment=require('moment');var BPromise=require(_0x9fc2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9fc2('0x4'));var rimraf=require(_0x9fc2('0x5'));var config=require(_0x9fc2('0x6'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x429766,_0x273bf6){return _0x429766[_0x9fc2('0x7')](_0x9fc2('0x8'),attributes,{'tableName':_0x9fc2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x459023,_0x42c53e,_0x2e5d65){if(_0x459023[_0x9fc2('0xa')](_0x9fc2('0xb'))){_0x459023[_0x9fc2('0xc')]=moment()[_0x9fc2('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2e5d65(null,_0x459023);}}});}; \ No newline at end of file +var _0xdda6=['YYYY-MM-DD\x20HH:mm:ss','util','moment','bluebird','request-promise','path','../../config/environment','./smsInteraction.attributes','exports','define','changed','closed'];(function(_0x5ea22f,_0x128142){var _0x4d878c=function(_0x334e3c){while(--_0x334e3c){_0x5ea22f['push'](_0x5ea22f['shift']());}};_0x4d878c(++_0x128142);}(_0xdda6,0x199));var _0x6dda=function(_0x3def1b,_0x56f748){_0x3def1b=_0x3def1b-0x0;var _0x57340e=_0xdda6[_0x3def1b];return _0x57340e;};'use strict';var _=require('lodash');var util=require(_0x6dda('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x6dda('0x1'));var BPromise=require(_0x6dda('0x2'));var rp=require(_0x6dda('0x3'));var fs=require('fs');var path=require(_0x6dda('0x4'));var rimraf=require('rimraf');var config=require(_0x6dda('0x5'));var attributes=require(_0x6dda('0x6'));module[_0x6dda('0x7')]=function(_0x1332e8,_0x472013){return _0x1332e8[_0x6dda('0x8')]('SmsInteraction',attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5a5a3c,_0x1a7a9f,_0x16a4ed){if(_0x5a5a3c[_0x6dda('0x9')](_0x6dda('0xa'))){_0x5a5a3c['closedAt']=moment()['format'](_0x6dda('0xb'));}_0x16a4ed(null,_0x5a5a3c);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 76b22a1..dff229e 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 _0x0cf2=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./smsInteraction.socket','request','then','info','request\x20sent','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','debug','AddTagsToSmsInteraction','find','ids','omit','AddTags','util'];(function(_0x52fd33,_0x43242e){var _0x1fa5f3=function(_0x159d96){while(--_0x159d96){_0x52fd33['push'](_0x52fd33['shift']());}};_0x1fa5f3(++_0x43242e);}(_0x0cf2,0x18f));var _0x20cf=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x0cf2[_0x55abd9];return _0x3e5669;};'use strict';var _=require('lodash');var util=require(_0x20cf('0x0'));var moment=require(_0x20cf('0x1'));var BPromise=require(_0x20cf('0x2'));var rs=require(_0x20cf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x20cf('0x4'))['db'];var utils=require(_0x20cf('0x5'));var logger=require(_0x20cf('0x6'))(_0x20cf('0x7'));var config=require(_0x20cf('0x8'));var jayson=require(_0x20cf('0x9'));var client=jayson['client'][_0x20cf('0xa')]({'port':0x232a});config[_0x20cf('0xb')]=_[_0x20cf('0xc')](config[_0x20cf('0xb')],{'host':_0x20cf('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x20cf('0xb')]));require(_0x20cf('0xe'))['register'](socket);function respondWithRpcPromise(_0x22e140,_0x178838,_0x3e977a){return new BPromise(function(_0x18dce5,_0x5458ef){return client[_0x20cf('0xf')](_0x22e140,_0x3e977a)[_0x20cf('0x10')](function(_0x3232f4){logger[_0x20cf('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x178838,_0x20cf('0x12'));logger['debug']('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x178838,'request\x20sent',JSON[_0x20cf('0x13')](_0x3232f4));if(_0x3232f4['error']){if(_0x3232f4[_0x20cf('0x14')][_0x20cf('0x15')]===0x1f4){logger['error'](_0x20cf('0x16'),_0x178838,_0x3232f4[_0x20cf('0x14')][_0x20cf('0x17')]);return _0x5458ef(_0x3232f4[_0x20cf('0x14')][_0x20cf('0x17')]);}logger['error'](_0x20cf('0x16'),_0x178838,_0x3232f4[_0x20cf('0x14')]['message']);return _0x18dce5(_0x3232f4[_0x20cf('0x14')][_0x20cf('0x17')]);}else{logger[_0x20cf('0x11')](_0x20cf('0x16'),_0x178838,_0x20cf('0x12'));_0x18dce5(_0x3232f4['result']['message']);}})[_0x20cf('0x18')](function(_0x3e407d){logger[_0x20cf('0x14')](_0x20cf('0x16'),_0x178838,_0x3e407d);_0x5458ef(_0x3e407d);});});}exports[_0x20cf('0x19')]=function(_0x53f2a7){var _0x2daf8f=this;return new Promise(function(_0x45342e,_0x21608e){return db[_0x20cf('0x1a')][_0x20cf('0x1b')](_0x53f2a7[_0x20cf('0x1c')],{'raw':_0x53f2a7[_0x20cf('0x1d')]?_0x53f2a7[_0x20cf('0x1d')][_0x20cf('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53f2a7['options']?_0x53f2a7[_0x20cf('0x1d')][_0x20cf('0x1f')]||null:null,'attributes':_0x53f2a7[_0x20cf('0x1d')]?_0x53f2a7['options'][_0x20cf('0x20')]||null:null,'limit':_0x53f2a7[_0x20cf('0x1d')]?_0x53f2a7[_0x20cf('0x1d')][_0x20cf('0x21')]||null:null})[_0x20cf('0x10')](function(_0x8d8e0f){logger[_0x20cf('0x11')]('UpdateSmsInteraction',_0x53f2a7);logger[_0x20cf('0x22')]('UpdateSmsInteraction',_0x53f2a7,JSON[_0x20cf('0x13')](_0x8d8e0f));_0x45342e(_0x8d8e0f);})[_0x20cf('0x18')](function(_0x462ec6){logger['error']('UpdateSmsInteraction',_0x462ec6[_0x20cf('0x17')],_0x53f2a7);_0x21608e(_0x2daf8f[_0x20cf('0x14')](0x1f4,_0x462ec6['message']));});});};exports[_0x20cf('0x23')]=function(_0x399e4a){return new Promise(function(_0x5def08,_0x551b7c){return db[_0x20cf('0x1a')][_0x20cf('0x24')]({'where':_0x399e4a[_0x20cf('0x1d')]?_0x399e4a[_0x20cf('0x1d')]['where']||null:null})[_0x20cf('0x10')](function(_0xe12e95){if(_0xe12e95){return _0xe12e95['addTags'](_0x399e4a[_0x20cf('0x1c')][_0x20cf('0x25')],_[_0x20cf('0x26')](_0x399e4a[_0x20cf('0x1c')],[_0x20cf('0x25'),'id'])||{});}})['spread'](function(_0x46342a){logger[_0x20cf('0x11')]('AddTags',_0x399e4a);logger[_0x20cf('0x22')](_0x20cf('0x27'),_0x399e4a,JSON['stringify'](_0x46342a));_0x5def08(_0x46342a);})[_0x20cf('0x18')](function(_0x488eb7){logger['error'](_0x20cf('0x27'),_0x488eb7['message'],_0x399e4a);_0x551b7c(_this['error'](0x1f4,_0x488eb7['message']));});});}; \ No newline at end of file +var _0xbe50=['result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','where','limit','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SmsInteraction,\x20%s,\x20%s','message'];(function(_0x5ad778,_0x410a27){var _0x15f4f4=function(_0x18e295){while(--_0x18e295){_0x5ad778['push'](_0x5ad778['shift']());}};_0x15f4f4(++_0x410a27);}(_0xbe50,0x144));var _0x0be5=function(_0x4364bf,_0x266759){_0x4364bf=_0x4364bf-0x0;var _0x13b177=_0xbe50[_0x4364bf];return _0x13b177;};'use strict';var _=require(_0x0be5('0x0'));var util=require(_0x0be5('0x1'));var moment=require(_0x0be5('0x2'));var BPromise=require(_0x0be5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0be5('0x4'));var db=require(_0x0be5('0x5'))['db'];var utils=require(_0x0be5('0x6'));var logger=require(_0x0be5('0x7'))(_0x0be5('0x8'));var config=require(_0x0be5('0x9'));var jayson=require(_0x0be5('0xa'));var client=jayson[_0x0be5('0xb')][_0x0be5('0xc')]({'port':0x232a});config[_0x0be5('0xd')]=_[_0x0be5('0xe')](config[_0x0be5('0xd')],{'host':_0x0be5('0xf'),'port':0x18eb});var socket=require(_0x0be5('0x10'))(new Redis(config[_0x0be5('0xd')]));require('./smsInteraction.socket')[_0x0be5('0x11')](socket);function respondWithRpcPromise(_0x2ceb9e,_0x380050,_0x501bba){return new BPromise(function(_0x488d17,_0x48e5ca){return client[_0x0be5('0x12')](_0x2ceb9e,_0x501bba)[_0x0be5('0x13')](function(_0x26c8ff){logger[_0x0be5('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x380050,'request\x20sent');logger[_0x0be5('0x15')](_0x0be5('0x16'),_0x380050,_0x0be5('0x17'),JSON[_0x0be5('0x18')](_0x26c8ff));if(_0x26c8ff['error']){if(_0x26c8ff[_0x0be5('0x19')]['code']===0x1f4){logger[_0x0be5('0x19')](_0x0be5('0x1a'),_0x380050,_0x26c8ff[_0x0be5('0x19')]['message']);return _0x48e5ca(_0x26c8ff[_0x0be5('0x19')]['message']);}logger['error'](_0x0be5('0x1a'),_0x380050,_0x26c8ff[_0x0be5('0x19')][_0x0be5('0x1b')]);return _0x488d17(_0x26c8ff[_0x0be5('0x19')]['message']);}else{logger[_0x0be5('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x380050,_0x0be5('0x17'));_0x488d17(_0x26c8ff[_0x0be5('0x1c')][_0x0be5('0x1b')]);}})[_0x0be5('0x1d')](function(_0x4e9597){logger[_0x0be5('0x19')](_0x0be5('0x1a'),_0x380050,_0x4e9597);_0x48e5ca(_0x4e9597);});});}exports[_0x0be5('0x1e')]=function(_0x481507){var _0x42ac19=this;return new Promise(function(_0x522376,_0x46e238){return db[_0x0be5('0x1f')][_0x0be5('0x20')](_0x481507[_0x0be5('0x21')],{'raw':_0x481507[_0x0be5('0x22')]?_0x481507[_0x0be5('0x22')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x481507[_0x0be5('0x22')]?_0x481507[_0x0be5('0x22')][_0x0be5('0x23')]||null:null,'attributes':_0x481507['options']?_0x481507[_0x0be5('0x22')]['attributes']||null:null,'limit':_0x481507['options']?_0x481507[_0x0be5('0x22')][_0x0be5('0x24')]||null:null})['then'](function(_0x3ed88d){logger[_0x0be5('0x14')](_0x0be5('0x1e'),_0x481507);logger[_0x0be5('0x15')](_0x0be5('0x1e'),_0x481507,JSON[_0x0be5('0x18')](_0x3ed88d));_0x522376(_0x3ed88d);})[_0x0be5('0x1d')](function(_0x4d5494){logger[_0x0be5('0x19')](_0x0be5('0x1e'),_0x4d5494[_0x0be5('0x1b')],_0x481507);_0x46e238(_0x42ac19['error'](0x1f4,_0x4d5494[_0x0be5('0x1b')]));});});};exports[_0x0be5('0x25')]=function(_0x4ff07f){return new Promise(function(_0x1080f9,_0x715715){return db[_0x0be5('0x1f')][_0x0be5('0x26')]({'where':_0x4ff07f[_0x0be5('0x22')]?_0x4ff07f['options'][_0x0be5('0x23')]||null:null})[_0x0be5('0x13')](function(_0x4aeed1){if(_0x4aeed1){return _0x4aeed1[_0x0be5('0x27')](_0x4ff07f['body'][_0x0be5('0x28')],_[_0x0be5('0x29')](_0x4ff07f[_0x0be5('0x21')],[_0x0be5('0x28'),'id'])||{});}})[_0x0be5('0x2a')](function(_0x35232c){logger['info'](_0x0be5('0x2b'),_0x4ff07f);logger[_0x0be5('0x15')](_0x0be5('0x2b'),_0x4ff07f,JSON['stringify'](_0x35232c));_0x1080f9(_0x35232c);})[_0x0be5('0x1d')](function(_0x5e9d33){logger[_0x0be5('0x19')]('AddTags',_0x5e9d33[_0x0be5('0x1b')],_0x4ff07f);_0x715715(_this[_0x0be5('0x19')](0x1f4,_0x5e9d33[_0x0be5('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index c0ee0af..349de5c 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 _0xf50e=['remove','update','emit','removeListener','register','length','smsInteraction:','save'];(function(_0x18076c,_0x23c5b8){var _0x201d10=function(_0x2d89fe){while(--_0x2d89fe){_0x18076c['push'](_0x18076c['shift']());}};_0x201d10(++_0x23c5b8);}(_0xf50e,0xa7));var _0xef50=function(_0x1a89a1,_0x56d889){_0x1a89a1=_0x1a89a1-0x0;var _0x3d5b46=_0xf50e[_0x1a89a1];return _0x3d5b46;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xef50('0x0'),_0xef50('0x1'),_0xef50('0x2')];function createListener(_0x4848ef,_0x54b105){return function(_0x1732e3){_0x54b105[_0xef50('0x3')](_0x4848ef,_0x1732e3);};}function removeListener(_0xa50874,_0x3823f7){return function(){SmsInteractionEvents[_0xef50('0x4')](_0xa50874,_0x3823f7);};}exports[_0xef50('0x5')]=function(_0x23f999){for(var _0x3b2fb4=0x0,_0x7ed142=events[_0xef50('0x6')];_0x3b2fb4<_0x7ed142;_0x3b2fb4++){var _0x500fbb=events[_0x3b2fb4];var _0x361455=createListener(_0xef50('0x7')+_0x500fbb,_0x23f999);SmsInteractionEvents['on'](_0x500fbb,_0x361455);}}; \ No newline at end of file +var _0xc754=['length','./smsInteraction.events','save','remove','update','removeListener','register'];(function(_0x186710,_0x2605b2){var _0x5d50bc=function(_0x51a6b5){while(--_0x51a6b5){_0x186710['push'](_0x186710['shift']());}};_0x5d50bc(++_0x2605b2);}(_0xc754,0x174));var _0x4c75=function(_0x5d1b2c,_0x198dd2){_0x5d1b2c=_0x5d1b2c-0x0;var _0x409067=_0xc754[_0x5d1b2c];return _0x409067;};'use strict';var SmsInteractionEvents=require(_0x4c75('0x0'));var events=[_0x4c75('0x1'),_0x4c75('0x2'),_0x4c75('0x3')];function createListener(_0x1f616f,_0x1e59cf){return function(_0x857e8c){_0x1e59cf['emit'](_0x1f616f,_0x857e8c);};}function removeListener(_0x1cbaba,_0x58eb83){return function(){SmsInteractionEvents[_0x4c75('0x4')](_0x1cbaba,_0x58eb83);};}exports[_0x4c75('0x5')]=function(_0x53f4d9){for(var _0x187385=0x0,_0x6bb444=events[_0x4c75('0x6')];_0x187385<_0x6bb444;_0x187385++){var _0x14872a=events[_0x187385];var _0x3d0d49=createListener('smsInteraction:'+_0x14872a,_0x53f4d9);SmsInteractionEvents['on'](_0x14872a,_0x3d0d49);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 5072fd8..c635963 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 _0xf3b7=['smsmessage:create','create','/:id/status','status','put','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','tracked','sms'];(function(_0x111e94,_0x31c837){var _0x3de107=function(_0x65bd1e){while(--_0x65bd1e){_0x111e94['push'](_0x111e94['shift']());}};_0x3de107(++_0x31c837);}(_0xf3b7,0x119));var _0x7f3b=function(_0x3920ef,_0x26525e){_0x3920ef=_0x3920ef-0x0;var _0x426242=_0xf3b7[_0x3920ef];return _0x426242;};'use strict';var multer=require(_0x7f3b('0x0'));var util=require(_0x7f3b('0x1'));var path=require('path');var timeout=require(_0x7f3b('0x2'));var express=require(_0x7f3b('0x3'));var router=express[_0x7f3b('0x4')]();var fs_extra=require(_0x7f3b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7f3b('0x6'));var config=require(_0x7f3b('0x7'));var controller=require(_0x7f3b('0x8'));router['get']('/',auth[_0x7f3b('0x9')](),controller[_0x7f3b('0xa')]);router[_0x7f3b('0xb')](_0x7f3b('0xc'),auth[_0x7f3b('0x9')](),controller[_0x7f3b('0xd')]);router[_0x7f3b('0xb')](_0x7f3b('0xe'),auth[_0x7f3b('0x9')](),controller[_0x7f3b('0xf')]);router[_0x7f3b('0x10')]('/',auth[_0x7f3b('0x9')](),interaction[_0x7f3b('0x11')](_0x7f3b('0x12'),_0x7f3b('0x13')),controller[_0x7f3b('0x14')]);router[_0x7f3b('0x10')](_0x7f3b('0x15'),controller[_0x7f3b('0x16')]);router['put']('/:id',auth[_0x7f3b('0x9')](),controller['update']);router[_0x7f3b('0x17')]('/:id/accept',auth[_0x7f3b('0x9')](),controller[_0x7f3b('0x18')]);router[_0x7f3b('0x17')](_0x7f3b('0x19'),auth[_0x7f3b('0x9')](),controller[_0x7f3b('0x1a')]);router[_0x7f3b('0x1b')]('/:id',auth[_0x7f3b('0x9')](),controller[_0x7f3b('0x1c')]);module[_0x7f3b('0x1d')]=router; \ No newline at end of file +var _0x9036=['/:id','post','tracked','smsmessage:create','create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','./smsMessage.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x5c8760,_0x1a9110){var _0x23eba4=function(_0x36ce47){while(--_0x36ce47){_0x5c8760['push'](_0x5c8760['shift']());}};_0x23eba4(++_0x1a9110);}(_0x9036,0x151));var _0x6903=function(_0x4959fd,_0x186515){_0x4959fd=_0x4959fd-0x0;var _0x97de01=_0x9036[_0x4959fd];return _0x97de01;};'use strict';var multer=require(_0x6903('0x0'));var util=require(_0x6903('0x1'));var path=require(_0x6903('0x2'));var timeout=require('connect-timeout');var express=require(_0x6903('0x3'));var router=express[_0x6903('0x4')]();var fs_extra=require(_0x6903('0x5'));var auth=require(_0x6903('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6903('0x7'));router[_0x6903('0x8')]('/',auth[_0x6903('0x9')](),controller[_0x6903('0xa')]);router['get'](_0x6903('0xb'),auth[_0x6903('0x9')](),controller[_0x6903('0xc')]);router[_0x6903('0x8')](_0x6903('0xd'),auth[_0x6903('0x9')](),controller['show']);router[_0x6903('0xe')]('/',auth[_0x6903('0x9')](),interaction[_0x6903('0xf')]('sms',_0x6903('0x10')),controller[_0x6903('0x11')]);router['post']('/:id/status',controller['status']);router[_0x6903('0x12')](_0x6903('0xd'),auth[_0x6903('0x9')](),controller[_0x6903('0x13')]);router[_0x6903('0x12')](_0x6903('0x14'),auth[_0x6903('0x9')](),controller[_0x6903('0x15')]);router[_0x6903('0x12')](_0x6903('0x16'),auth['isAuthenticated'](),controller['reject']);router[_0x6903('0x17')]('/:id',auth[_0x6903('0x9')](),controller[_0x6903('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index e46c619..2010d79 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 _0xa084=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports','TEXT','medium'];(function(_0x4622ce,_0x5c80f6){var _0x24d85e=function(_0x59a48d){while(--_0x59a48d){_0x4622ce['push'](_0x4622ce['shift']());}};_0x24d85e(++_0x5c80f6);}(_0xa084,0x7a));var _0x4a08=function(_0x1e9d01,_0x373a83){_0x1e9d01=_0x1e9d01-0x0;var _0x392903=_0xa084[_0x1e9d01];return _0x392903;};'use strict';var Sequelize=require(_0x4a08('0x0'));module[_0x4a08('0x1')]={'body':{'type':Sequelize[_0x4a08('0x2')](_0x4a08('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x4a08('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4a08('0x5')]('in',_0x4a08('0x6')),'defaultValue':_0x4a08('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x4a08('0x7')]},'readAt':{'type':Sequelize[_0x4a08('0x8')]},'secret':{'type':Sequelize[_0x4a08('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x4a08('0x7')]},'providerResponse':{'type':Sequelize[_0x4a08('0x2')]}}; \ No newline at end of file +var _0xc213=['ENUM','out','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc213,0x19b));var _0x3c21=function(_0x352af9,_0x16f858){_0x352af9=_0x352af9-0x0;var _0x4d05c8=_0xc213[_0x352af9];return _0x4d05c8;};'use strict';var Sequelize=require(_0x3c21('0x0'));module[_0x3c21('0x1')]={'body':{'type':Sequelize[_0x3c21('0x2')](_0x3c21('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x3c21('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3c21('0x5')]('in',_0x3c21('0x6')),'defaultValue':_0x3c21('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3c21('0x7')](0xbe)},'phone':{'type':Sequelize[_0x3c21('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x3c21('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x3c21('0x7')]},'providerResponse':{'type':Sequelize[_0x3c21('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 960402a..710e51b 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 _0x7382=['defaults','localhost','socket.io-emitter','./smsMessage.socket','register','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','SmsMessage','rows','params','keys','find','create','body','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','SmsInteractionId','isNil','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','SELECT','event','rejectmessage','SmsAccount','SmsAccountId','inspect','MessageSid','messageId','twilio','plivo','MessageUUID','indexOf','sent','delivered','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','DELIVERED','rimraf','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis'];(function(_0x31eb67,_0x9bc8c0){var _0x2a8cb8=function(_0xac1c5d){while(--_0xac1c5d){_0x31eb67['push'](_0x31eb67['shift']());}};_0x2a8cb8(++_0x9bc8c0);}(_0x7382,0x111));var _0x2738=function(_0x2cbffc,_0x25a9c6){_0x2cbffc=_0x2cbffc-0x0;var _0xfcb06d=_0x7382[_0x2cbffc];return _0xfcb06d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2738('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2738('0x1'));var util=require(_0x2738('0x2'));var path=require(_0x2738('0x3'));var sox=require(_0x2738('0x4'));var csv=require(_0x2738('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2738('0x6'));var _=require(_0x2738('0x7'));var squel=require(_0x2738('0x8'));var crypto=require('crypto');var jsforce=require(_0x2738('0x9'));var deskjs=require(_0x2738('0xa'));var toCsv=require(_0x2738('0x5'));var querystring=require('querystring');var Papa=require(_0x2738('0xb'));var Redis=require(_0x2738('0xc'));var authService=require(_0x2738('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x2738('0xe'));var hardwareService=require(_0x2738('0xf'));var logger=require(_0x2738('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x2738('0x11'));var licenseUtil=require(_0x2738('0x12'));var db=require(_0x2738('0x13'))['db'];config[_0x2738('0x14')]=_[_0x2738('0x15')](config[_0x2738('0x14')],{'host':_0x2738('0x16'),'port':0x18eb});var socket=require(_0x2738('0x17'))(new Redis(config[_0x2738('0x14')]));require(_0x2738('0x18'))[_0x2738('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2738('0x1a')][_0x2738('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0x2738('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4f3c03,_0xba2b73,_0x488209,_0x4d318d){return new BPromise(function(_0x568065,_0x348746){var _0x6c3d05=_0x4d318d||client;return _0x6c3d05[_0x2738('0x1c')](_0x4f3c03,_0x488209)[_0x2738('0x1d')](function(_0x1d0aca){logger[_0x2738('0x1e')](_0x2738('0x1f'),_0xba2b73,_0x2738('0x20'));logger['debug'](_0x2738('0x21'),_0xba2b73,'request\x20sent',JSON[_0x2738('0x22')](_0x1d0aca));if(_0x1d0aca[_0x2738('0x23')]){if(_0x1d0aca['error']['code']===0x1f4){logger[_0x2738('0x23')](_0x2738('0x1f'),_0xba2b73,_0x1d0aca[_0x2738('0x23')][_0x2738('0x24')]);return _0x348746(_0x1d0aca[_0x2738('0x23')][_0x2738('0x24')]);}logger[_0x2738('0x23')](_0x2738('0x1f'),_0xba2b73,_0x1d0aca[_0x2738('0x23')][_0x2738('0x24')]);return _0x568065(_0x1d0aca[_0x2738('0x23')]['message']);}else{logger[_0x2738('0x1e')]('SmsMessage,\x20%s,\x20%s',_0xba2b73,'request\x20sent');_0x568065(_0x1d0aca[_0x2738('0x25')][_0x2738('0x24')]);}})[_0x2738('0x26')](function(_0x25c6e0){logger[_0x2738('0x23')](_0x2738('0x1f'),_0xba2b73,_0x25c6e0);_0x348746(_0x25c6e0);});});}function respondWithStatusCode(_0x19d6c6,_0x20b347){_0x20b347=_0x20b347||0xcc;return function(_0x4ec0e1){if(_0x4ec0e1){return _0x19d6c6[_0x2738('0x27')](_0x20b347);}return _0x19d6c6['status'](_0x20b347)[_0x2738('0x28')]();};}function respondWithResult(_0x26fcd4,_0x513fb5){_0x513fb5=_0x513fb5||0xc8;return function(_0x2d76d4){if(_0x2d76d4){return _0x26fcd4[_0x2738('0x29')](_0x513fb5)['json'](_0x2d76d4);}};}function respondWithFilteredResult(_0x5e7be4,_0x4fad4c){return function(_0x59b860){if(_0x59b860){var _0x926abd=typeof _0x4fad4c[_0x2738('0x2a')]===_0x2738('0x2b')&&typeof _0x4fad4c[_0x2738('0x2c')]===_0x2738('0x2b');var _0x2b317c=_0x59b860['count'];var _0x351f46=_0x926abd?0x0:_0x4fad4c[_0x2738('0x2a')];var _0x1a7395=_0x926abd?_0x59b860[_0x2738('0x2d')]:_0x4fad4c[_0x2738('0x2a')]+_0x4fad4c['limit'];var _0xe549ec;if(_0x1a7395>=_0x2b317c){_0x1a7395=_0x2b317c;_0xe549ec=0xc8;}else{_0xe549ec=0xce;}_0x5e7be4[_0x2738('0x29')](_0xe549ec);return _0x5e7be4[_0x2738('0x2e')](_0x2738('0x2f'),_0x351f46+'-'+_0x1a7395+'/'+_0x2b317c)[_0x2738('0x30')](_0x59b860);}return null;};}function patchUpdates(_0x5ec788){return function(_0x8bc885){try{jsonpatch['apply'](_0x8bc885,_0x5ec788,!![]);}catch(_0x5539c2){return BPromise[_0x2738('0x31')](_0x5539c2);}return _0x8bc885[_0x2738('0x32')]();};}function saveUpdates(_0x2845af,_0x3b5ae0){return function(_0x4d3211){if(_0x4d3211){return _0x4d3211[_0x2738('0x33')](_0x2845af)[_0x2738('0x1d')](function(_0x3ac3c4){return _0x3ac3c4;});}return null;};}function removeEntity(_0x6e1bd0,_0x1dc246){return function(_0x546d88){if(_0x546d88){return _0x546d88['destroy']()[_0x2738('0x1d')](function(){_0x6e1bd0['status'](0xcc)[_0x2738('0x28')]();});}};}function handleEntityNotFound(_0x3b2926,_0x152455){return function(_0xf930c2){if(!_0xf930c2){_0x3b2926[_0x2738('0x27')](0x194);}return _0xf930c2;};}function handleError(_0xdfcffa,_0x7ae2e5){_0x7ae2e5=_0x7ae2e5||0x1f4;return function(_0x240d0e){logger[_0x2738('0x23')](_0x240d0e[_0x2738('0x34')]);if(_0x240d0e[_0x2738('0x35')]){delete _0x240d0e[_0x2738('0x35')];}_0xdfcffa[_0x2738('0x29')](_0x7ae2e5)[_0x2738('0x36')](_0x240d0e);};}exports[_0x2738('0x37')]=function(_0x4956b6,_0x782137){var _0x1870d5={},_0x2d6d9c={},_0x187045={'count':0x0,'rows':[]};var _0x3c3e3a=_[_0x2738('0x38')](db['SmsMessage'][_0x2738('0x39')],function(_0x48bba){return{'name':_0x48bba[_0x2738('0x3a')],'type':_0x48bba['type'][_0x2738('0x3b')]};});_0x2d6d9c[_0x2738('0x3c')]=_['map'](_0x3c3e3a,'name');_0x2d6d9c[_0x2738('0x3d')]=_['keys'](_0x4956b6[_0x2738('0x3d')]);_0x2d6d9c[_0x2738('0x3e')]=_[_0x2738('0x3f')](_0x2d6d9c[_0x2738('0x3c')],_0x2d6d9c[_0x2738('0x3d')]);_0x1870d5[_0x2738('0x40')]=_[_0x2738('0x3f')](_0x2d6d9c[_0x2738('0x3c')],qs['fields'](_0x4956b6[_0x2738('0x3d')][_0x2738('0x41')]));_0x1870d5[_0x2738('0x40')]=_0x1870d5[_0x2738('0x40')][_0x2738('0x42')]?_0x1870d5[_0x2738('0x40')]:_0x2d6d9c[_0x2738('0x3c')];if(!_0x4956b6[_0x2738('0x3d')][_0x2738('0x43')](_0x2738('0x44'))){_0x1870d5[_0x2738('0x2c')]=qs[_0x2738('0x2c')](_0x4956b6[_0x2738('0x3d')][_0x2738('0x2c')]);_0x1870d5[_0x2738('0x2a')]=qs[_0x2738('0x2a')](_0x4956b6[_0x2738('0x3d')]['offset']);}_0x1870d5[_0x2738('0x45')]=qs['sort'](_0x4956b6['query'][_0x2738('0x46')]);_0x1870d5[_0x2738('0x47')]=qs['filters'](_[_0x2738('0x48')](_0x4956b6[_0x2738('0x3d')],_0x2d6d9c[_0x2738('0x3e')]),_0x3c3e3a);if(_0x4956b6[_0x2738('0x3d')][_0x2738('0x49')]){_0x1870d5['where']=_[_0x2738('0x4a')](_0x1870d5[_0x2738('0x47')],{'$or':_[_0x2738('0x38')](_0x3c3e3a,function(_0x36d6ed){if(_0x36d6ed[_0x2738('0x4b')]!==_0x2738('0x4c')){var _0x18e7b0={};_0x18e7b0[_0x36d6ed[_0x2738('0x35')]]={'$like':'%'+_0x4956b6[_0x2738('0x3d')][_0x2738('0x49')]+'%'};return _0x18e7b0;}})});}_0x1870d5=_[_0x2738('0x4a')]({},_0x1870d5,_0x4956b6[_0x2738('0x4d')]);var _0x4aaae8={'where':_0x1870d5['where']};return db['SmsMessage'][_0x2738('0x2d')](_0x4aaae8)[_0x2738('0x1d')](function(_0x150a52){_0x187045[_0x2738('0x2d')]=_0x150a52;if(_0x4956b6[_0x2738('0x3d')][_0x2738('0x4e')]){_0x1870d5[_0x2738('0x4f')]=[{'all':!![]}];}return db[_0x2738('0x50')]['findAll'](_0x1870d5);})[_0x2738('0x1d')](function(_0x287c25){_0x187045[_0x2738('0x51')]=_0x287c25;return _0x187045;})[_0x2738('0x1d')](respondWithFilteredResult(_0x782137,_0x1870d5))['catch'](handleError(_0x782137,null));};exports['show']=function(_0x1e7e38,_0x192ade){var _0x4f9d61={'raw':!![],'where':{'id':_0x1e7e38[_0x2738('0x52')]['id']}},_0x3eb09f={};_0x3eb09f[_0x2738('0x3c')]=_[_0x2738('0x53')](db[_0x2738('0x50')][_0x2738('0x39')]);_0x3eb09f[_0x2738('0x3d')]=_['keys'](_0x1e7e38[_0x2738('0x3d')]);_0x3eb09f[_0x2738('0x3e')]=_[_0x2738('0x3f')](_0x3eb09f[_0x2738('0x3c')],_0x3eb09f[_0x2738('0x3d')]);_0x4f9d61['attributes']=_[_0x2738('0x3f')](_0x3eb09f[_0x2738('0x3c')],qs[_0x2738('0x41')](_0x1e7e38[_0x2738('0x3d')][_0x2738('0x41')]));_0x4f9d61[_0x2738('0x40')]=_0x4f9d61[_0x2738('0x40')][_0x2738('0x42')]?_0x4f9d61[_0x2738('0x40')]:_0x3eb09f[_0x2738('0x3c')];if(_0x1e7e38[_0x2738('0x3d')][_0x2738('0x4e')]){_0x4f9d61[_0x2738('0x4f')]=[{'all':!![]}];}_0x4f9d61=_['merge']({},_0x4f9d61,_0x1e7e38[_0x2738('0x4d')]);return db['SmsMessage'][_0x2738('0x54')](_0x4f9d61)[_0x2738('0x1d')](handleEntityNotFound(_0x192ade,null))['then'](respondWithResult(_0x192ade,null))[_0x2738('0x26')](handleError(_0x192ade,null));};exports[_0x2738('0x55')]=function(_0x31b88c,_0x520d48){return db[_0x2738('0x50')][_0x2738('0x55')](_0x31b88c['body'],{})[_0x2738('0x1d')](respondWithResult(_0x520d48,0xc9))[_0x2738('0x26')](handleError(_0x520d48,null));};exports[_0x2738('0x33')]=function(_0x24c330,_0x35ed6f){if(_0x24c330[_0x2738('0x56')]['id']){delete _0x24c330['body']['id'];}return db[_0x2738('0x50')]['find']({'where':{'id':_0x24c330[_0x2738('0x52')]['id']}})[_0x2738('0x1d')](handleEntityNotFound(_0x35ed6f,null))[_0x2738('0x1d')](saveUpdates(_0x24c330[_0x2738('0x56')],null))[_0x2738('0x1d')](respondWithResult(_0x35ed6f,null))[_0x2738('0x26')](handleError(_0x35ed6f,null));};exports['destroy']=function(_0xd6e643,_0x4f00ee){return db['SmsMessage'][_0x2738('0x54')]({'where':{'id':_0xd6e643[_0x2738('0x52')]['id']}})[_0x2738('0x1d')](handleEntityNotFound(_0x4f00ee,null))[_0x2738('0x1d')](removeEntity(_0x4f00ee,null))[_0x2738('0x26')](handleError(_0x4f00ee,null));};exports[_0x2738('0x57')]=function(_0x292087,_0x3e9431){return db['SmsMessage'][_0x2738('0x57')]()[_0x2738('0x1d')](respondWithResult(_0x3e9431,null))[_0x2738('0x26')](handleError(_0x3e9431,null));};var interaction_log=require('../../config/logger')(_0x2738('0x58'));exports[_0x2738('0x59')]=function(_0x6d78e3,_0x489fa4,_0x45f9e5){var _0x580a80={'agent':{},'channel':_0x2738('0x5a')};if(_0x6d78e3['body']['id']){delete _0x6d78e3['body']['id'];}_0x6d78e3[_0x2738('0x56')][_0x2738('0x5b')]=!![];_0x6d78e3[_0x2738('0x56')][_0x2738('0x5c')]=moment()[_0x2738('0x5d')](_0x2738('0x5e'));_0x6d78e3[_0x2738('0x56')][_0x2738('0x5f')]=_0x6d78e3[_0x2738('0x56')]['UserId']||_0x6d78e3[_0x2738('0x60')]['id'];_0x580a80['agent']['id']=_0x6d78e3[_0x2738('0x56')]['UserId'];return db[_0x2738('0x50')][_0x2738('0x54')]({'where':{'id':_0x6d78e3['params']['id'],'UserId':null}})[_0x2738('0x1d')](handleEntityNotFound(_0x489fa4,null))[_0x2738('0x1d')](saveUpdates(_0x6d78e3['body'],null))[_0x2738('0x1d')](function(_0x272733){if(_0x272733){_0x580a80[_0x2738('0x24')]=_0x272733[_0x2738('0x61')]({'plain':!![]});return db['SmsInteraction'][_0x2738('0x54')]({'where':{'id':_0x272733[_0x2738('0x62')]}});}return null;})[_0x2738('0x1d')](handleEntityNotFound(_0x489fa4,null))['then'](function(_0x4e1150){if(_0x4e1150){return _0x4e1150[_0x2738('0x33')]({'UserId':_0x6d78e3[_0x2738('0x56')]['UserId'],'read1stAt':_[_0x2738('0x63')](_0x4e1150['read1stAt'])?moment()[_0x2738('0x5d')](_0x2738('0x5e')):undefined});}return null;})[_0x2738('0x1d')](function(_0x530639){if(_0x530639){_0x580a80['interaction']=_0x530639[_0x2738('0x61')]({'plain':!![]});interaction_log[_0x2738('0x1e')](_0x2738('0x64'),_0x6d78e3[_0x2738('0x60')]['id'],_0x6d78e3[_0x2738('0x60')][_0x2738('0x35')],_0x6d78e3['user'][_0x2738('0x65')],_0x580a80[_0x2738('0x66')]['id'],_0x6d78e3[_0x2738('0x56')]?JSON[_0x2738('0x22')](_0x6d78e3[_0x2738('0x56')]):_0x2738('0x67'));return respondWithRpcPromise(_0x2738('0x68'),'acceptMessage',_0x580a80);}return null;})[_0x2738('0x1d')](function(_0x6e6a31){var _0x19fe0f=_0x2738('0x69')+_0x6e6a31['message']['ContactId'];return db[_0x2738('0x6a')][_0x2738('0x3d')](_0x19fe0f,{'type':db[_0x2738('0x6b')][_0x2738('0x6c')]['SELECT'],'raw':!![]})[_0x2738('0x1d')](function(_0x36bc62){return _0x36bc62;});})[_0x2738('0x1d')](function(_0x4c56b4){if(_0x4c56b4){_0x580a80[_0x2738('0x24')][_0x2738('0x6d')]=_0x4c56b4[0x0];if(!_0x6d78e3[_0x2738('0x56')][_0x2738('0x5f')])return;return db[_0x2738('0x6e')][_0x2738('0x54')]({'where':{'id':_0x6d78e3[_0x2738('0x56')][_0x2738('0x5f')],'role':_0x2738('0x6f')},'attributes':['id',_0x2738('0x35'),_0x2738('0x70'),_0x2738('0x71'),_0x2738('0x72')],'raw':!![]});}return null;})['then'](function(_0x4d9f50){if(!_0x4d9f50)return null;_0x580a80['message']['agent']=_0x4d9f50;return _0x580a80;})[_0x2738('0x1d')](function(_0xf55fd9){if(_0xf55fd9){if(_0x6d78e3['body'][_0x2738('0x73')]){_0x580a80[_0x2738('0x24')][_0x2738('0x74')]=util['format'](_0x2738('0x75'),_0x6d78e3[_0x2738('0x60')][_0x2738('0x35')]);_0x580a80[_0x2738('0x24')]['channel']=_0x580a80[_0x2738('0x76')];_0x580a80['message'][_0x2738('0x77')]=_0x580a80[_0x2738('0x76')];_0x580a80[_0x2738('0x24')]['event']=_0x2738('0x59');return respondWithRpcPromise(_0x2738('0x78'),_0x2738('0x78'),{'event':_0x2738('0x79'),'message':_0x580a80['message']},client9002)[_0x2738('0x1d')](function(){return _0x580a80;});}return _0x580a80;}return null;})[_0x2738('0x1d')](respondWithResult(_0x489fa4,null))[_0x2738('0x26')](handleError(_0x489fa4,null));};var interaction_log=require('../../config/logger')(_0x2738('0x58'));exports['reject']=function(_0x11e9d7,_0x5b9b99,_0x102d9d){var _0x543059={'agent':{},'channel':_0x2738('0x5a')};if(_0x11e9d7[_0x2738('0x56')]['id']){delete _0x11e9d7[_0x2738('0x56')]['id'];}_0x11e9d7[_0x2738('0x56')][_0x2738('0x5f')]=_0x11e9d7[_0x2738('0x56')][_0x2738('0x5f')]||_0x11e9d7['user']['id'];_0x543059[_0x2738('0x6f')]['id']=_0x11e9d7[_0x2738('0x56')]['UserId'];return db['SmsMessage'][_0x2738('0x54')]({'where':{'id':_0x11e9d7[_0x2738('0x52')]['id'],'UserId':null}})[_0x2738('0x1d')](handleEntityNotFound(_0x5b9b99,null))[_0x2738('0x1d')](function(_0x2f94f){if(_0x2f94f){_0x543059['message']=_0x2f94f[_0x2738('0x61')]({'plain':!![]});return db[_0x2738('0x7a')]['find']({'where':{'id':_0x2f94f['SmsInteractionId']}});}return null;})[_0x2738('0x1d')](handleEntityNotFound(_0x5b9b99,null))[_0x2738('0x1d')](function(_0x2e8351){if(_0x2e8351){_0x543059[_0x2738('0x66')]=_0x2e8351[_0x2738('0x61')]({'plain':!![]});interaction_log[_0x2738('0x1e')](_0x2738('0x7b'),_0x11e9d7['user']['id'],_0x11e9d7[_0x2738('0x60')][_0x2738('0x35')],_0x11e9d7[_0x2738('0x60')][_0x2738('0x65')],_0x543059[_0x2738('0x66')]['id'],_0x11e9d7[_0x2738('0x56')]?JSON[_0x2738('0x22')](_0x11e9d7[_0x2738('0x56')]):_0x2738('0x67'));return respondWithRpcPromise(_0x2738('0x7c'),_0x2738('0x7d'),_0x543059);}return null;})[_0x2738('0x1d')](function(_0x57dc9c){var _0x2bbdd2=_0x2738('0x69')+_0x57dc9c[_0x2738('0x24')][_0x2738('0x7e')];return db[_0x2738('0x6a')]['query'](_0x2bbdd2,{'type':db[_0x2738('0x6b')][_0x2738('0x6c')][_0x2738('0x7f')],'raw':!![]})[_0x2738('0x1d')](function(_0x4ce16b){return _0x4ce16b;});})[_0x2738('0x1d')](function(_0xb2e686){if(_0xb2e686){_0x543059[_0x2738('0x24')]['contact']=_0xb2e686[0x0];if(!_0x11e9d7[_0x2738('0x56')][_0x2738('0x5f')])return;return db[_0x2738('0x6e')]['find']({'where':{'id':_0x11e9d7[_0x2738('0x56')][_0x2738('0x5f')],'role':'agent'},'attributes':['id',_0x2738('0x35'),_0x2738('0x70'),_0x2738('0x71'),_0x2738('0x72')],'raw':!![]});}return null;})[_0x2738('0x1d')](function(_0x5d032e){if(!_0x5d032e)return null;_0x543059[_0x2738('0x24')][_0x2738('0x6f')]=_0x5d032e;return _0x543059;})['then'](function(_0x3a5c5e){if(_0x3a5c5e){_0x3a5c5e[_0x2738('0x24')]['interface']=util[_0x2738('0x5d')](_0x2738('0x75'),_0x11e9d7[_0x2738('0x60')]['name']);_0x3a5c5e[_0x2738('0x24')][_0x2738('0x76')]=_0x543059[_0x2738('0x76')];_0x3a5c5e[_0x2738('0x24')][_0x2738('0x77')]=_0x543059[_0x2738('0x76')];_0x3a5c5e[_0x2738('0x24')][_0x2738('0x80')]='reject';respondWithRpcPromise(_0x2738('0x78'),'EventManager',{'event':_0x2738('0x81'),'message':_0x3a5c5e[_0x2738('0x24')]},client9002);return _0x543059;}return null;})[_0x2738('0x1d')](respondWithResult(_0x5b9b99,null))[_0x2738('0x26')](handleError(_0x5b9b99,null));};exports['status']=function(_0x2b2ff9,_0xc1d9da,_0x412d36){if(_0x2b2ff9[_0x2738('0x56')]['id']){delete _0x2b2ff9[_0x2738('0x56')]['id'];}var _0x264f78;return db[_0x2738('0x50')][_0x2738('0x54')]({'where':{'id':_0x2b2ff9[_0x2738('0x52')]['id']}})[_0x2738('0x1d')](handleEntityNotFound(_0xc1d9da,null))[_0x2738('0x1d')](function(_0x549f7a){if(_0x549f7a){_0x264f78=_0x549f7a;return db[_0x2738('0x82')]['find']({'where':{'id':_0x549f7a[_0x2738('0x83')]}});}})[_0x2738('0x1d')](handleEntityNotFound(_0xc1d9da,null))['then'](function(_0x3b2355){if(_0x3b2355){logger['debug'](_0x2738('0x21'),_0x2738('0x29'),'received\x20delivery\x20report\x20from',_0x3b2355['type'],util[_0x2738('0x84')](_0x2b2ff9[_0x2738('0x56')],{'showHidden':![],'depth':null}));switch(_0x3b2355[_0x2738('0x4b')]){case'twilio':if(_0x2b2ff9[_0x2738('0x56')][_0x2738('0x85')]&&_0x2b2ff9['body'][_0x2738('0x85')]===_0x264f78[_0x2738('0x86')]){return _0x264f78[_0x2738('0x33')]({'read':!![]});}else{logger[_0x2738('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2738('0x29'),_0x2738('0x87'),util[_0x2738('0x84')](_0x2b2ff9['body'],{'showHidden':![],'depth':null}));}break;case _0x2738('0x88'):if(_0x2b2ff9[_0x2738('0x56')]['MessageUUID']&&_0x2b2ff9[_0x2738('0x56')][_0x2738('0x89')]===_0x264f78[_0x2738('0x86')]&&_[_0x2738('0x8a')]([_0x2738('0x8b'),_0x2738('0x8c')],_0x2b2ff9[_0x2738('0x56')]['Status'])>=0x0){return _0x264f78['update']({'read':!![]});}else{logger[_0x2738('0x23')](_0x2738('0x8d'),'status',_0x2738('0x8e'),util['inspect'](_0x2b2ff9['body'],{'showHidden':![],'depth':null}));}break;case _0x2738('0x8f'):var _0x11fcfc=_0x2b2ff9[_0x2738('0x56')][_0x2738('0x90')][0x0];if(_0x11fcfc[_0x2738('0x29')][_0x2738('0x91')]===_0x2738('0x92')){return _0x264f78[_0x2738('0x33')]({'read':!![]});}else{logger[_0x2738('0x23')](_0x2738('0x8d'),_0x2738('0x29'),_0x2738('0x8f'),util['inspect'](_0x2b2ff9[_0x2738('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x264f78;}})['then'](respondWithResult(_0xc1d9da,null))[_0x2738('0x26')](handleError(_0xc1d9da,null));}; \ No newline at end of file +var _0x26bd=['messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','plivio','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','stack','name','send','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','update','describe','sms-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','email','internal','manual','interface','channel','motionChannel','event','acceptmessage','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','QueryTypes','fullname','SIP/%s','EventManager','rejectmessage','SmsAccount','SmsAccountId','debug','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid'];(function(_0x5cb97e,_0x132a39){var _0x1714b4=function(_0x384210){while(--_0x384210){_0x5cb97e['push'](_0x5cb97e['shift']());}};_0x1714b4(++_0x132a39);}(_0x26bd,0xaa));var _0xd26b=function(_0x4ec873,_0x53db6d){_0x4ec873=_0x4ec873-0x0;var _0xbfde4c=_0x26bd[_0x4ec873];return _0xbfde4c;};'use strict';var emlformat=require(_0xd26b('0x0'));var rimraf=require(_0xd26b('0x1'));var zipdir=require(_0xd26b('0x2'));var jsonpatch=require(_0xd26b('0x3'));var rp=require(_0xd26b('0x4'));var moment=require(_0xd26b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd26b('0x6'));var util=require(_0xd26b('0x7'));var path=require(_0xd26b('0x8'));var sox=require(_0xd26b('0x9'));var csv=require('to-csv');var ejs=require(_0xd26b('0xa'));var fs=require('fs');var fs_extra=require(_0xd26b('0xb'));var _=require(_0xd26b('0xc'));var squel=require(_0xd26b('0xd'));var crypto=require('crypto');var jsforce=require(_0xd26b('0xe'));var deskjs=require(_0xd26b('0xf'));var toCsv=require(_0xd26b('0x10'));var querystring=require(_0xd26b('0x11'));var Papa=require(_0xd26b('0x12'));var Redis=require(_0xd26b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xd26b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd26b('0x15'));var logger=require(_0xd26b('0x16'))(_0xd26b('0x17'));var utils=require(_0xd26b('0x18'));var config=require(_0xd26b('0x19'));var licenseUtil=require(_0xd26b('0x1a'));var db=require(_0xd26b('0x1b'))['db'];config[_0xd26b('0x1c')]=_[_0xd26b('0x1d')](config['redis'],{'host':_0xd26b('0x1e'),'port':0x18eb});var socket=require(_0xd26b('0x1f'))(new Redis(config['redis']));require('./smsMessage.socket')[_0xd26b('0x20')](socket);var jayson=require(_0xd26b('0x21'));var client=jayson[_0xd26b('0x22')][_0xd26b('0x23')]({'port':0x232c});var client9002=jayson[_0xd26b('0x22')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c658a,_0x4b55d3,_0xdbdf12,_0x252bed){return new BPromise(function(_0x81ccdc,_0x18ac83){var _0x4ee711=_0x252bed||client;return _0x4ee711[_0xd26b('0x24')](_0x1c658a,_0xdbdf12)[_0xd26b('0x25')](function(_0x360b8c){logger[_0xd26b('0x26')](_0xd26b('0x27'),_0x4b55d3,_0xd26b('0x28'));logger['debug'](_0xd26b('0x29'),_0x4b55d3,_0xd26b('0x28'),JSON[_0xd26b('0x2a')](_0x360b8c));if(_0x360b8c[_0xd26b('0x2b')]){if(_0x360b8c[_0xd26b('0x2b')][_0xd26b('0x2c')]===0x1f4){logger[_0xd26b('0x2b')](_0xd26b('0x27'),_0x4b55d3,_0x360b8c['error'][_0xd26b('0x2d')]);return _0x18ac83(_0x360b8c['error'][_0xd26b('0x2d')]);}logger[_0xd26b('0x2b')](_0xd26b('0x27'),_0x4b55d3,_0x360b8c[_0xd26b('0x2b')][_0xd26b('0x2d')]);return _0x81ccdc(_0x360b8c['error']['message']);}else{logger[_0xd26b('0x26')](_0xd26b('0x27'),_0x4b55d3,_0xd26b('0x28'));_0x81ccdc(_0x360b8c[_0xd26b('0x2e')][_0xd26b('0x2d')]);}})[_0xd26b('0x2f')](function(_0xd91bca){logger[_0xd26b('0x2b')](_0xd26b('0x27'),_0x4b55d3,_0xd91bca);_0x18ac83(_0xd91bca);});});}function respondWithStatusCode(_0x3ae1f0,_0x23a64e){_0x23a64e=_0x23a64e||0xcc;return function(_0x42a2c0){if(_0x42a2c0){return _0x3ae1f0[_0xd26b('0x30')](_0x23a64e);}return _0x3ae1f0['status'](_0x23a64e)[_0xd26b('0x31')]();};}function respondWithResult(_0x14609a,_0x1c38c8){_0x1c38c8=_0x1c38c8||0xc8;return function(_0x5611d6){if(_0x5611d6){return _0x14609a[_0xd26b('0x32')](_0x1c38c8)[_0xd26b('0x33')](_0x5611d6);}};}function respondWithFilteredResult(_0x5ed45f,_0x20530f){return function(_0x51d842){if(_0x51d842){var _0x395bc8=typeof _0x20530f[_0xd26b('0x34')]===_0xd26b('0x35')&&typeof _0x20530f['limit']===_0xd26b('0x35');var _0x19e48c=_0x51d842[_0xd26b('0x36')];var _0x1aab0f=_0x395bc8?0x0:_0x20530f[_0xd26b('0x34')];var _0x374220=_0x395bc8?_0x51d842[_0xd26b('0x36')]:_0x20530f[_0xd26b('0x34')]+_0x20530f[_0xd26b('0x37')];var _0x3a86f7;if(_0x374220>=_0x19e48c){_0x374220=_0x19e48c;_0x3a86f7=0xc8;}else{_0x3a86f7=0xce;}_0x5ed45f[_0xd26b('0x32')](_0x3a86f7);return _0x5ed45f[_0xd26b('0x38')](_0xd26b('0x39'),_0x1aab0f+'-'+_0x374220+'/'+_0x19e48c)[_0xd26b('0x33')](_0x51d842);}return null;};}function patchUpdates(_0x58cd89){return function(_0x3851f3){try{jsonpatch[_0xd26b('0x3a')](_0x3851f3,_0x58cd89,!![]);}catch(_0x51924c){return BPromise[_0xd26b('0x3b')](_0x51924c);}return _0x3851f3[_0xd26b('0x3c')]();};}function saveUpdates(_0x4460b1,_0x35cbad){return function(_0x46d486){if(_0x46d486){return _0x46d486['update'](_0x4460b1)[_0xd26b('0x25')](function(_0x48bb5f){return _0x48bb5f;});}return null;};}function removeEntity(_0xe2af03,_0x279829){return function(_0x58996){if(_0x58996){return _0x58996[_0xd26b('0x3d')]()[_0xd26b('0x25')](function(){_0xe2af03[_0xd26b('0x32')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b7b6c,_0x10e2d6){return function(_0x3a41f6){if(!_0x3a41f6){_0x3b7b6c[_0xd26b('0x30')](0x194);}return _0x3a41f6;};}function handleError(_0x2eada3,_0x79f33c){_0x79f33c=_0x79f33c||0x1f4;return function(_0x55315c){logger[_0xd26b('0x2b')](_0x55315c[_0xd26b('0x3e')]);if(_0x55315c[_0xd26b('0x3f')]){delete _0x55315c[_0xd26b('0x3f')];}_0x2eada3[_0xd26b('0x32')](_0x79f33c)[_0xd26b('0x40')](_0x55315c);};}exports['index']=function(_0x30773a,_0x583f36){var _0x18f518={},_0x12f585={},_0x48bdbb={'count':0x0,'rows':[]};var _0x382d57=_['map'](db[_0xd26b('0x41')][_0xd26b('0x42')],function(_0x325f05){return{'name':_0x325f05[_0xd26b('0x43')],'type':_0x325f05[_0xd26b('0x44')][_0xd26b('0x45')]};});_0x12f585[_0xd26b('0x46')]=_['map'](_0x382d57,_0xd26b('0x3f'));_0x12f585[_0xd26b('0x47')]=_[_0xd26b('0x48')](_0x30773a[_0xd26b('0x47')]);_0x12f585[_0xd26b('0x49')]=_[_0xd26b('0x4a')](_0x12f585['model'],_0x12f585[_0xd26b('0x47')]);_0x18f518[_0xd26b('0x4b')]=_['intersection'](_0x12f585[_0xd26b('0x46')],qs[_0xd26b('0x4c')](_0x30773a[_0xd26b('0x47')][_0xd26b('0x4c')]));_0x18f518[_0xd26b('0x4b')]=_0x18f518['attributes']['length']?_0x18f518[_0xd26b('0x4b')]:_0x12f585[_0xd26b('0x46')];if(!_0x30773a['query'][_0xd26b('0x4d')](_0xd26b('0x4e'))){_0x18f518[_0xd26b('0x37')]=qs['limit'](_0x30773a['query'][_0xd26b('0x37')]);_0x18f518[_0xd26b('0x34')]=qs[_0xd26b('0x34')](_0x30773a[_0xd26b('0x47')]['offset']);}_0x18f518[_0xd26b('0x4f')]=qs['sort'](_0x30773a[_0xd26b('0x47')][_0xd26b('0x50')]);_0x18f518[_0xd26b('0x51')]=qs[_0xd26b('0x49')](_[_0xd26b('0x52')](_0x30773a['query'],_0x12f585[_0xd26b('0x49')]),_0x382d57);if(_0x30773a[_0xd26b('0x47')][_0xd26b('0x53')]){_0x18f518[_0xd26b('0x51')]=_[_0xd26b('0x54')](_0x18f518[_0xd26b('0x51')],{'$or':_['map'](_0x382d57,function(_0xa73764){if(_0xa73764[_0xd26b('0x44')]!==_0xd26b('0x55')){var _0x108fbc={};_0x108fbc[_0xa73764['name']]={'$like':'%'+_0x30773a['query'][_0xd26b('0x53')]+'%'};return _0x108fbc;}})});}_0x18f518=_[_0xd26b('0x54')]({},_0x18f518,_0x30773a[_0xd26b('0x56')]);var _0x20fb85={'where':_0x18f518[_0xd26b('0x51')]};return db[_0xd26b('0x41')]['count'](_0x20fb85)[_0xd26b('0x25')](function(_0x46f270){_0x48bdbb[_0xd26b('0x36')]=_0x46f270;if(_0x30773a[_0xd26b('0x47')][_0xd26b('0x57')]){_0x18f518[_0xd26b('0x58')]=[{'all':!![]}];}return db['SmsMessage'][_0xd26b('0x59')](_0x18f518);})[_0xd26b('0x25')](function(_0x42ff5e){_0x48bdbb[_0xd26b('0x5a')]=_0x42ff5e;return _0x48bdbb;})[_0xd26b('0x25')](respondWithFilteredResult(_0x583f36,_0x18f518))[_0xd26b('0x2f')](handleError(_0x583f36,null));};exports[_0xd26b('0x5b')]=function(_0x81ffc0,_0x4e4e69){var _0x5ca800={'raw':!![],'where':{'id':_0x81ffc0[_0xd26b('0x5c')]['id']}},_0x525dd2={};_0x525dd2['model']=_[_0xd26b('0x48')](db[_0xd26b('0x41')]['rawAttributes']);_0x525dd2[_0xd26b('0x47')]=_[_0xd26b('0x48')](_0x81ffc0[_0xd26b('0x47')]);_0x525dd2[_0xd26b('0x49')]=_[_0xd26b('0x4a')](_0x525dd2[_0xd26b('0x46')],_0x525dd2['query']);_0x5ca800['attributes']=_[_0xd26b('0x4a')](_0x525dd2[_0xd26b('0x46')],qs[_0xd26b('0x4c')](_0x81ffc0[_0xd26b('0x47')]['fields']));_0x5ca800[_0xd26b('0x4b')]=_0x5ca800['attributes']['length']?_0x5ca800['attributes']:_0x525dd2[_0xd26b('0x46')];if(_0x81ffc0['query'][_0xd26b('0x57')]){_0x5ca800[_0xd26b('0x58')]=[{'all':!![]}];}_0x5ca800=_[_0xd26b('0x54')]({},_0x5ca800,_0x81ffc0[_0xd26b('0x56')]);return db['SmsMessage'][_0xd26b('0x5d')](_0x5ca800)[_0xd26b('0x25')](handleEntityNotFound(_0x4e4e69,null))['then'](respondWithResult(_0x4e4e69,null))[_0xd26b('0x2f')](handleError(_0x4e4e69,null));};exports[_0xd26b('0x5e')]=function(_0x29dcbd,_0x55ded0){return db[_0xd26b('0x41')][_0xd26b('0x5e')](_0x29dcbd[_0xd26b('0x5f')],{})[_0xd26b('0x25')](respondWithResult(_0x55ded0,0xc9))[_0xd26b('0x2f')](handleError(_0x55ded0,null));};exports[_0xd26b('0x60')]=function(_0xdfe8f9,_0x165262){if(_0xdfe8f9[_0xd26b('0x5f')]['id']){delete _0xdfe8f9[_0xd26b('0x5f')]['id'];}return db[_0xd26b('0x41')][_0xd26b('0x5d')]({'where':{'id':_0xdfe8f9['params']['id']}})[_0xd26b('0x25')](handleEntityNotFound(_0x165262,null))[_0xd26b('0x25')](saveUpdates(_0xdfe8f9[_0xd26b('0x5f')],null))[_0xd26b('0x25')](respondWithResult(_0x165262,null))[_0xd26b('0x2f')](handleError(_0x165262,null));};exports['destroy']=function(_0x285e16,_0x4ec0bc){return db[_0xd26b('0x41')]['find']({'where':{'id':_0x285e16[_0xd26b('0x5c')]['id']}})[_0xd26b('0x25')](handleEntityNotFound(_0x4ec0bc,null))[_0xd26b('0x25')](removeEntity(_0x4ec0bc,null))[_0xd26b('0x2f')](handleError(_0x4ec0bc,null));};exports[_0xd26b('0x61')]=function(_0x17ecbb,_0xcdd8b2){return db[_0xd26b('0x41')]['describe']()[_0xd26b('0x25')](respondWithResult(_0xcdd8b2,null))[_0xd26b('0x2f')](handleError(_0xcdd8b2,null));};var interaction_log=require('../../config/logger')(_0xd26b('0x62'));exports[_0xd26b('0x63')]=function(_0x2a9e85,_0x1f19a0,_0x41ec1c){var _0x498061={'agent':{},'channel':'sms'};if(_0x2a9e85[_0xd26b('0x5f')]['id']){delete _0x2a9e85[_0xd26b('0x5f')]['id'];}_0x2a9e85[_0xd26b('0x5f')][_0xd26b('0x64')]=!![];_0x2a9e85[_0xd26b('0x5f')][_0xd26b('0x65')]=moment()[_0xd26b('0x66')](_0xd26b('0x67'));_0x2a9e85[_0xd26b('0x5f')]['UserId']=_0x2a9e85[_0xd26b('0x5f')][_0xd26b('0x68')]||_0x2a9e85[_0xd26b('0x69')]['id'];_0x498061[_0xd26b('0x6a')]['id']=_0x2a9e85[_0xd26b('0x5f')][_0xd26b('0x68')];return db[_0xd26b('0x41')]['find']({'where':{'id':_0x2a9e85[_0xd26b('0x5c')]['id'],'UserId':null}})[_0xd26b('0x25')](handleEntityNotFound(_0x1f19a0,null))[_0xd26b('0x25')](saveUpdates(_0x2a9e85[_0xd26b('0x5f')],null))[_0xd26b('0x25')](function(_0xc3124d){if(_0xc3124d){_0x498061[_0xd26b('0x2d')]=_0xc3124d[_0xd26b('0x6b')]({'plain':!![]});return db[_0xd26b('0x6c')]['find']({'where':{'id':_0xc3124d[_0xd26b('0x6d')]}});}return null;})[_0xd26b('0x25')](handleEntityNotFound(_0x1f19a0,null))['then'](function(_0x5be066){if(_0x5be066){return _0x5be066[_0xd26b('0x60')]({'UserId':_0x2a9e85[_0xd26b('0x5f')][_0xd26b('0x68')],'read1stAt':_[_0xd26b('0x6e')](_0x5be066[_0xd26b('0x6f')])?moment()[_0xd26b('0x66')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xd26b('0x25')](function(_0x260714){if(_0x260714){_0x498061[_0xd26b('0x70')]=_0x260714['get']({'plain':!![]});interaction_log[_0xd26b('0x26')](_0xd26b('0x71'),_0x2a9e85['user']['id'],_0x2a9e85[_0xd26b('0x69')][_0xd26b('0x3f')],_0x2a9e85['user'][_0xd26b('0x72')],_0x498061[_0xd26b('0x70')]['id'],_0x2a9e85[_0xd26b('0x5f')]?JSON[_0xd26b('0x2a')](_0x2a9e85['body']):_0xd26b('0x73'));return respondWithRpcPromise(_0xd26b('0x74'),'acceptMessage',_0x498061);}return null;})[_0xd26b('0x25')](function(_0x2d36d1){var _0x1e9955=_0xd26b('0x75')+_0x2d36d1[_0xd26b('0x2d')][_0xd26b('0x76')];return db[_0xd26b('0x77')][_0xd26b('0x47')](_0x1e9955,{'type':db[_0xd26b('0x78')]['QueryTypes'][_0xd26b('0x79')],'raw':!![]})['then'](function(_0x5cdea4){return _0x5cdea4;});})['then'](function(_0x45aaa3){if(_0x45aaa3){_0x498061[_0xd26b('0x2d')][_0xd26b('0x7a')]=_0x45aaa3[0x0];if(!_0x2a9e85[_0xd26b('0x5f')][_0xd26b('0x68')])return;return db[_0xd26b('0x7b')]['find']({'where':{'id':_0x2a9e85['body'][_0xd26b('0x68')],'role':_0xd26b('0x6a')},'attributes':['id','name','fullname',_0xd26b('0x7c'),_0xd26b('0x7d')],'raw':!![]});}return null;})[_0xd26b('0x25')](function(_0x1167c6){if(!_0x1167c6)return null;_0x498061[_0xd26b('0x2d')][_0xd26b('0x6a')]=_0x1167c6;return _0x498061;})['then'](function(_0x76d62b){if(_0x76d62b){if(_0x2a9e85[_0xd26b('0x5f')][_0xd26b('0x7e')]){_0x498061[_0xd26b('0x2d')][_0xd26b('0x7f')]=util['format']('SIP/%s',_0x2a9e85[_0xd26b('0x69')]['name']);_0x498061[_0xd26b('0x2d')][_0xd26b('0x80')]=_0x498061[_0xd26b('0x80')];_0x498061['message'][_0xd26b('0x81')]=_0x498061[_0xd26b('0x80')];_0x498061[_0xd26b('0x2d')][_0xd26b('0x82')]=_0xd26b('0x63');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xd26b('0x83'),'message':_0x498061[_0xd26b('0x2d')]},client9002)[_0xd26b('0x25')](function(){return _0x498061;});}return _0x498061;}return null;})['then'](respondWithResult(_0x1f19a0,null))['catch'](handleError(_0x1f19a0,null));};var interaction_log=require('../../config/logger')(_0xd26b('0x62'));exports[_0xd26b('0x3b')]=function(_0x566e53,_0x3b089a,_0x7ff5c8){var _0x21ec3a={'agent':{},'channel':_0xd26b('0x84')};if(_0x566e53[_0xd26b('0x5f')]['id']){delete _0x566e53['body']['id'];}_0x566e53[_0xd26b('0x5f')][_0xd26b('0x68')]=_0x566e53['body']['UserId']||_0x566e53[_0xd26b('0x69')]['id'];_0x21ec3a['agent']['id']=_0x566e53['body'][_0xd26b('0x68')];return db[_0xd26b('0x41')][_0xd26b('0x5d')]({'where':{'id':_0x566e53[_0xd26b('0x5c')]['id'],'UserId':null}})[_0xd26b('0x25')](handleEntityNotFound(_0x3b089a,null))[_0xd26b('0x25')](function(_0x52d244){if(_0x52d244){_0x21ec3a[_0xd26b('0x2d')]=_0x52d244[_0xd26b('0x6b')]({'plain':!![]});return db[_0xd26b('0x6c')][_0xd26b('0x5d')]({'where':{'id':_0x52d244['SmsInteractionId']}});}return null;})[_0xd26b('0x25')](handleEntityNotFound(_0x3b089a,null))[_0xd26b('0x25')](function(_0x178069){if(_0x178069){_0x21ec3a['interaction']=_0x178069[_0xd26b('0x6b')]({'plain':!![]});interaction_log['info'](_0xd26b('0x85'),_0x566e53[_0xd26b('0x69')]['id'],_0x566e53[_0xd26b('0x69')][_0xd26b('0x3f')],_0x566e53[_0xd26b('0x69')]['role'],_0x21ec3a[_0xd26b('0x70')]['id'],_0x566e53['body']?JSON[_0xd26b('0x2a')](_0x566e53[_0xd26b('0x5f')]):_0xd26b('0x73'));return respondWithRpcPromise(_0xd26b('0x86'),_0xd26b('0x87'),_0x21ec3a);}return null;})['then'](function(_0x1ea4df){var _0x4c28e3='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1ea4df['message'][_0xd26b('0x76')];return db[_0xd26b('0x77')][_0xd26b('0x47')](_0x4c28e3,{'type':db['Sequelize'][_0xd26b('0x88')]['SELECT'],'raw':!![]})[_0xd26b('0x25')](function(_0x3d6617){return _0x3d6617;});})[_0xd26b('0x25')](function(_0x691427){if(_0x691427){_0x21ec3a['message'][_0xd26b('0x7a')]=_0x691427[0x0];if(!_0x566e53[_0xd26b('0x5f')][_0xd26b('0x68')])return;return db[_0xd26b('0x7b')][_0xd26b('0x5d')]({'where':{'id':_0x566e53['body'][_0xd26b('0x68')],'role':_0xd26b('0x6a')},'attributes':['id','name',_0xd26b('0x89'),'email',_0xd26b('0x7d')],'raw':!![]});}return null;})[_0xd26b('0x25')](function(_0x376fc9){if(!_0x376fc9)return null;_0x21ec3a[_0xd26b('0x2d')]['agent']=_0x376fc9;return _0x21ec3a;})[_0xd26b('0x25')](function(_0x2b7db4){if(_0x2b7db4){_0x2b7db4[_0xd26b('0x2d')][_0xd26b('0x7f')]=util['format'](_0xd26b('0x8a'),_0x566e53[_0xd26b('0x69')][_0xd26b('0x3f')]);_0x2b7db4[_0xd26b('0x2d')]['channel']=_0x21ec3a[_0xd26b('0x80')];_0x2b7db4[_0xd26b('0x2d')][_0xd26b('0x81')]=_0x21ec3a['channel'];_0x2b7db4['message'][_0xd26b('0x82')]=_0xd26b('0x3b');respondWithRpcPromise(_0xd26b('0x8b'),_0xd26b('0x8b'),{'event':_0xd26b('0x8c'),'message':_0x2b7db4['message']},client9002);return _0x21ec3a;}return null;})['then'](respondWithResult(_0x3b089a,null))[_0xd26b('0x2f')](handleError(_0x3b089a,null));};exports['status']=function(_0x48cdac,_0x51c1d2,_0x1327cc){if(_0x48cdac[_0xd26b('0x5f')]['id']){delete _0x48cdac[_0xd26b('0x5f')]['id'];}var _0x4bf39c;return db[_0xd26b('0x41')]['find']({'where':{'id':_0x48cdac['params']['id']}})['then'](handleEntityNotFound(_0x51c1d2,null))[_0xd26b('0x25')](function(_0x414c44){if(_0x414c44){_0x4bf39c=_0x414c44;return db[_0xd26b('0x8d')]['find']({'where':{'id':_0x414c44[_0xd26b('0x8e')]}});}})['then'](handleEntityNotFound(_0x51c1d2,null))[_0xd26b('0x25')](function(_0x11bfe7){if(_0x11bfe7){logger[_0xd26b('0x8f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd26b('0x32'),_0xd26b('0x90'),_0x11bfe7['type'],util[_0xd26b('0x91')](_0x48cdac[_0xd26b('0x5f')],{'showHidden':![],'depth':null}));switch(_0x11bfe7[_0xd26b('0x44')]){case _0xd26b('0x92'):if(_0x48cdac[_0xd26b('0x5f')]['MessageSid']&&_0x48cdac[_0xd26b('0x5f')][_0xd26b('0x93')]===_0x4bf39c[_0xd26b('0x94')]){return _0x4bf39c[_0xd26b('0x60')]({'read':!![]});}else{logger[_0xd26b('0x2b')](_0xd26b('0x95'),_0xd26b('0x32'),_0xd26b('0x92'),util[_0xd26b('0x91')](_0x48cdac['body'],{'showHidden':![],'depth':null}));}break;case _0xd26b('0x96'):if(_0x48cdac['body'][_0xd26b('0x97')]&&_0x48cdac[_0xd26b('0x5f')][_0xd26b('0x97')]===_0x4bf39c[_0xd26b('0x94')]&&_[_0xd26b('0x98')]([_0xd26b('0x99'),_0xd26b('0x9a')],_0x48cdac[_0xd26b('0x5f')]['Status'])>=0x0){return _0x4bf39c[_0xd26b('0x60')]({'read':!![]});}else{logger['error'](_0xd26b('0x95'),'status',_0xd26b('0x9b'),util[_0xd26b('0x91')](_0x48cdac[_0xd26b('0x5f')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x60bc97=_0x48cdac[_0xd26b('0x5f')][_0xd26b('0x9c')][0x0];if(_0x60bc97['status'][_0xd26b('0x9d')]===_0xd26b('0x9e')){return _0x4bf39c[_0xd26b('0x60')]({'read':!![]});}else{logger[_0xd26b('0x2b')](_0xd26b('0x95'),_0xd26b('0x32'),'infobip',util[_0xd26b('0x91')](_0x48cdac[_0xd26b('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x4bf39c;}})[_0xd26b('0x25')](respondWithResult(_0x51c1d2,null))['catch'](handleError(_0x51c1d2,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 71b48cf..0ad6467 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 _0xb011=['remove','emit','hasOwnProperty','hook','../../mysqldb','save','update'];(function(_0xc510c3,_0x229dc6){var _0x1c0c09=function(_0x47f12a){while(--_0x47f12a){_0xc510c3['push'](_0xc510c3['shift']());}};_0x1c0c09(++_0x229dc6);}(_0xb011,0x19a));var _0x1b01=function(_0x5613f3,_0x327929){_0x5613f3=_0x5613f3-0x0;var _0x8108c8=_0xb011[_0x5613f3];return _0x8108c8;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x1b01('0x0'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1b01('0x1'),'afterUpdate':_0x1b01('0x2'),'afterDestroy':_0x1b01('0x3')};function emitEvent(_0x37dc33){return function(_0x5c5b79,_0x5770c4,_0x110960){SmsMessageEvents[_0x1b01('0x4')](_0x37dc33+':'+_0x5c5b79['id'],_0x5c5b79);SmsMessageEvents[_0x1b01('0x4')](_0x37dc33,_0x5c5b79);_0x110960(null);};}for(var e in events){if(events[_0x1b01('0x5')](e)){var event=events[e];SmsMessage[_0x1b01('0x6')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x567b=['hasOwnProperty','hook','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','emit'];(function(_0x28f6e6,_0x31f4dc){var _0x4b3933=function(_0x5d00f1){while(--_0x5d00f1){_0x28f6e6['push'](_0x28f6e6['shift']());}};_0x4b3933(++_0x31f4dc);}(_0x567b,0x9b));var _0xb567=function(_0x2d8ad9,_0x50ec51){_0x2d8ad9=_0x2d8ad9-0x0;var _0x1bd0fe=_0x567b[_0x2d8ad9];return _0x1bd0fe;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0xb567('0x0'))['db'][_0xb567('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xb567('0x2')](0x0);var events={'afterCreate':_0xb567('0x3'),'afterUpdate':_0xb567('0x4'),'afterDestroy':_0xb567('0x5')};function emitEvent(_0x2d4cfb){return function(_0x15df04,_0x3e430b,_0x15e93b){SmsMessageEvents['emit'](_0x2d4cfb+':'+_0x15df04['id'],_0x15df04);SmsMessageEvents[_0xb567('0x6')](_0x2d4cfb,_0x15df04);_0x15e93b(null);};}for(var e in events){if(events[_0xb567('0x7')](e)){var event=events[e];SmsMessage[_0xb567('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index a83dbb8..ec39ca5 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 _0x70c6=['internal_order_id','read','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','senderString','format','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','data','message_id','clickSend','plivo','remote','https://api.plivo.com/v1/Account/%s/Message/','authId','Basic\x20%s','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','sender','text','timestamp','keys','sort','length','md5','digest','hex','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','UTF-8','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','status','refid','finally','utf8mb4_unicode_ci','util','api','moment','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','secret','SmsAccount','type','twilio','authToken','phone','accountSid','messages','create','/api/sms/messages/','/status?token=','token','sid','catch','error','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','&password=','GET','split','sms','POST','user_key','total_sent'];(function(_0x28f7e1,_0x3d6924){var _0x495bb4=function(_0x590cff){while(--_0x590cff){_0x28f7e1['push'](_0x28f7e1['shift']());}};_0x495bb4(++_0x3d6924);}(_0x70c6,0x1b6));var _0x670c=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x70c6[_0x178e48];return _0x440d7e;};'use strict';var _=require('lodash');var util=require(_0x670c('0x0'));var logger=require('../../config/logger')(_0x670c('0x1'));var moment=require(_0x670c('0x2'));var BPromise=require(_0x670c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x670c('0x4'));var rimraf=require(_0x670c('0x5'));var config=require(_0x670c('0x6'));var attributes=require(_0x670c('0x7'));module[_0x670c('0x8')]=function(_0x294f86,_0x5f1f7a){return _0x294f86[_0x670c('0x9')](_0x670c('0xa'),attributes,{'tableName':_0x670c('0xb'),'paranoid':![],'indexes':[{'name':_0x670c('0xc'),'fields':[_0x670c('0xc')]},{'name':_0x670c('0xd'),'fields':[_0x670c('0xe')],'type':_0x670c('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x16cf63,_0xa47f60,_0x388277){var _0x14f9bc=_0x294f86[_0x670c('0x10')];var _0x2dfdc2=_0x16cf63[_0x670c('0x11')]({'plain':!![]});if(_0x2dfdc2['direction'][_0x670c('0x12')]()==='in'||_0x2dfdc2[_0x670c('0x13')][_0x670c('0x12')]()===_0x670c('0x14')&&!_0x2dfdc2['secret']&&!_[_0x670c('0x15')](_0x2dfdc2[_0x670c('0x16')])&&!_[_0x670c('0x15')](_0x2dfdc2['SmsInteractionId'])){_0x14f9bc[_0x670c('0x17')][_0x670c('0x18')]({'where':{'id':_0x2dfdc2[_0x670c('0x19')]}})[_0x670c('0x1a')](function(_0x120d07){if(_0x120d07){_0x120d07[_0x670c('0x1b')]({'lastMsgAt':_0x2dfdc2['createdAt'],'lastMsgDirection':_0x2dfdc2[_0x670c('0x13')][_0x670c('0x12')]()});}})['catch'](function(_0x19ac8b){console['error'](_0x19ac8b);});}if(_0x2dfdc2[_0x670c('0x13')]==='out'&&!_0x2dfdc2[_0x670c('0x1c')]){var _0x34f78f;_0x14f9bc[_0x670c('0x1d')]['find']({'where':{'id':_0x2dfdc2['SmsAccountId']},'raw':!![]})[_0x670c('0x1a')](function(_0x25999f){_0x34f78f=_0x25999f;if(_0x34f78f&&_0x34f78f[_0x670c('0x1e')]){switch(_0x34f78f['type']){case _0x670c('0x1f'):var _0x42a2dd=require(_0x670c('0x1f'));if(_0x34f78f['accountSid']&&_0x34f78f[_0x670c('0x20')]&&_0x34f78f[_0x670c('0x21')]){var _0x56d417=new _0x42a2dd(_0x34f78f[_0x670c('0x22')],_0x34f78f['authToken']);_0x56d417[_0x670c('0x23')][_0x670c('0x24')]({'body':_0x2dfdc2[_0x670c('0xe')],'to':_0x2dfdc2[_0x670c('0x21')],'from':_0x34f78f[_0x670c('0x21')],'statusCallback':_0x34f78f['remote']+_0x670c('0x25')+_0x2dfdc2['id']+_0x670c('0x26')+_0x34f78f[_0x670c('0x27')]})[_0x670c('0x1a')](function(_0x1450be){if(_0x1450be[_0x670c('0x28')]){return _0x16cf63[_0x670c('0x1b')]({'messageId':_0x1450be[_0x670c('0x28')]});}})[_0x670c('0x29')](function(_0x19e111){logger[_0x670c('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x670c('0x2b'),'twilio',util[_0x670c('0x2c')](_0x19e111,{'showHidden':![],'depth':null}));});}else{logger[_0x670c('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio',_0x670c('0x2d'));}break;case _0x670c('0x2e'):var _0x16acd1=_0x670c('0x2f');if(_0x34f78f[_0x670c('0x30')]&&_0x34f78f[_0x670c('0x31')]){var _0x5e6914={'recipient':[_0x2dfdc2[_0x670c('0x21')]],'message':_0x2dfdc2[_0x670c('0xe')],'message_type':_0x34f78f[_0x670c('0x32')]};if(_0x34f78f[_0x670c('0x32')]&&_0x34f78f[_0x670c('0x32')]!=='SI'){_0x5e6914['sender']=_0x34f78f[_0x670c('0x21')];}var _0x3b134f={'url':_0x16acd1+'login?username='+_0x34f78f[_0x670c('0x30')]+_0x670c('0x33')+_0x34f78f['password'],'method':_0x670c('0x34')};rp(_0x3b134f)['then'](function(_0x202e18){var _0x48e0da=_0x202e18[_0x670c('0x35')](';');var _0x220e72={'user_key':_0x48e0da[0x0],'session_key':_0x48e0da[0x1]};_0x3b134f={'url':_0x16acd1+_0x670c('0x36'),'method':_0x670c('0x37'),'headers':{'user_key':_0x220e72[_0x670c('0x38')],'Session_key':_0x220e72['session_key']},'json':!![],'body':_0x5e6914};return rp(_0x3b134f);})[_0x670c('0x1a')](function(_0x3a99ad){if(_0x3a99ad[_0x670c('0x39')]>=0x1){var _0x3724fb={'messageId':_0x3a99ad[_0x670c('0x3a')]};if(_0x34f78f[_0x670c('0x32')]!=='GP'||!_0x34f78f['deliveryReport']){_0x3724fb[_0x670c('0x3b')]=!![];}return _0x16cf63['update'](_0x3724fb);}else{return logger[_0x670c('0x2a')](_0x670c('0x3c'),_0x670c('0x2b'),_0x670c('0x2e'),util[_0x670c('0x2c')](_0x3a99ad,{'showHidden':![],'depth':null}));}})[_0x670c('0x29')](function(_0xf42e29){return logger[_0x670c('0x2a')](_0x670c('0x3c'),_0x670c('0x2b'),_0x670c('0x2e'),util[_0x670c('0x2c')](_0xf42e29,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x670c('0x3c'),_0x670c('0x2b'),_0x670c('0x2e'),_0x670c('0x3d'));}break;case _0x670c('0x3e'):if(_0x34f78f[_0x670c('0x20')]){var _0x41cb30={'recipient':_0x2dfdc2[_0x670c('0x21')],'message':_0x2dfdc2[_0x670c('0xe')],'sender':_0x34f78f['senderString']||_0x34f78f[_0x670c('0x21')],'authorization':_0x34f78f[_0x670c('0x20')]};var _0xa47f60={'method':_0x670c('0x37'),'uri':_0x670c('0x3f'),'body':_0x41cb30,'json':!![]};rp(_0xa47f60)[_0x670c('0x1a')](function(_0x1ddd33){var _0x276ee6={'messageId':_0x1ddd33[_0x670c('0x40')]};if(!_0x34f78f[_0x670c('0x41')]){_0x276ee6[_0x670c('0x3b')]=!![];}return _0x16cf63[_0x670c('0x1b')](_0x276ee6);})[_0x670c('0x29')](function(_0x17d627){logger[_0x670c('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x670c('0x2b'),_0x670c('0x3e'),util[_0x670c('0x2c')](_0x17d627,{'showHidden':![],'depth':null}));});}else{logger[_0x670c('0x2a')](_0x670c('0x3c'),_0x670c('0x2b'),_0x670c('0x3e'),_0x670c('0x42'));}break;case _0x670c('0x43'):if(_0x34f78f['username']&&_0x34f78f[_0x670c('0x31')]){var _0x41cb30={'messages':[{'source':_0x670c('0x44'),'to':_0x2dfdc2[_0x670c('0x21')],'body':_0x2dfdc2[_0x670c('0xe')],'from':_0x34f78f[_0x670c('0x45')]||_0x34f78f[_0x670c('0x21')]}]};var _0x16e72d=util[_0x670c('0x46')](_0x670c('0x47'),_0x34f78f[_0x670c('0x30')],_0x34f78f['password']);var _0xa47f60={'method':'POST','uri':_0x670c('0x48'),'body':_0x41cb30,'headers':{'Authorization':util[_0x670c('0x46')]('Basic\x20%s',new Buffer(_0x16e72d)[_0x670c('0x49')](_0x670c('0x4a')))},'json':!![]};rp(_0xa47f60)[_0x670c('0x1a')](function(_0x46a8b3){if(_0x46a8b3[_0x670c('0x4b')]>=0xc8&&_0x46a8b3['http_code']<=0xce){if(_0x46a8b3['data']&&_0x46a8b3[_0x670c('0x4c')]['queued_count']>0x0){var _0x33e13b=_['head'](_0x46a8b3[_0x670c('0x4c')][_0x670c('0x23')]);var _0x4f1438={'messageId':_0x33e13b[_0x670c('0x4d')]};if(!_0x34f78f[_0x670c('0x41')]){_0x4f1438[_0x670c('0x3b')]=!![];}return _0x16cf63[_0x670c('0x1b')](_0x4f1438);}else{logger['error'](_0x670c('0x3c'),'afterCreate',_0x670c('0x4e'),util[_0x670c('0x2c')](_0x46a8b3,{'showHidden':![],'depth':null}));}}else{logger[_0x670c('0x2a')](_0x670c('0x3c'),_0x670c('0x2b'),_0x670c('0x4e'),util[_0x670c('0x2c')](_0x46a8b3,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4add59){logger[_0x670c('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x670c('0x2b'),_0x670c('0x4e'),util[_0x670c('0x2c')](_0x4add59,{'showHidden':![],'depth':null}));});}else{logger[_0x670c('0x2a')](_0x670c('0x3c'),_0x670c('0x2b'),_0x670c('0x4e'),_0x670c('0x3d'));}break;case _0x670c('0x4f'):if(_0x34f78f['authId']&&_0x34f78f[_0x670c('0x20')]){var _0x41cb30={'dst':_0x2dfdc2[_0x670c('0x21')],'text':_0x2dfdc2[_0x670c('0xe')],'src':_0x34f78f[_0x670c('0x45')]||_0x34f78f['phone'],'url':_0x34f78f[_0x670c('0x50')]+_0x670c('0x25')+_0x2dfdc2['id']+_0x670c('0x26')+_0x34f78f['token']};var _0x16e72d=util[_0x670c('0x46')](_0x670c('0x47'),_0x34f78f['authId'],_0x34f78f['authToken']);var _0xa47f60={'method':_0x670c('0x37'),'uri':util[_0x670c('0x46')](_0x670c('0x51'),_0x34f78f[_0x670c('0x52')]),'body':_0x41cb30,'headers':{'Authorization':util[_0x670c('0x46')](_0x670c('0x53'),new Buffer(_0x16e72d)[_0x670c('0x49')]('base64'))},'json':!![]};rp(_0xa47f60)['then'](function(_0x2e84ae){var _0x31fee6={'messageId':_0x2e84ae[_0x670c('0x54')][0x0]};return _0x16cf63['update'](_0x31fee6);})['catch'](function(_0x177b59){logger[_0x670c('0x2a')](_0x670c('0x3c'),_0x670c('0x2b'),_0x670c('0x4f'),util['inspect'](_0x177b59,{'showHidden':![],'depth':null}));});}else{logger[_0x670c('0x2a')](_0x670c('0x3c'),'afterCreate',_0x670c('0x4f'),_0x670c('0x55'));}break;case _0x670c('0x56'):if(_0x34f78f[_0x670c('0x30')]&&_0x34f78f[_0x670c('0x31')]){if(_0x34f78f[_0x670c('0x57')]){var _0x5c642b={'method':_0x670c('0x37'),'uri':_0x34f78f['baseUrl']+_0x670c('0x58'),'body':{'username':_0x34f78f[_0x670c('0x30')],'password':_0x34f78f[_0x670c('0x31')]},'json':!![]};return rp(_0x5c642b)[_0x670c('0x1a')](function(_0x56cc20){var _0x165412={'method':_0x670c('0x37'),'uri':_0x34f78f[_0x670c('0x57')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x34f78f[_0x670c('0x21')],'destinations':[{'to':_0x2dfdc2[_0x670c('0x21')]}],'text':_0x2dfdc2[_0x670c('0xe')],'notifyUrl':_0x34f78f[_0x670c('0x50')]+_0x670c('0x25')+_0x2dfdc2['id']+_0x670c('0x26')+_0x34f78f[_0x670c('0x27')],'notifyContentType':_0x670c('0x59'),'callbackData':_0x34f78f[_0x670c('0x21')]+';'+_0x2dfdc2['body']}]},'headers':{'Authorization':_0x670c('0x5a')+_0x56cc20['token']},'json':!![]};return rp(_0x165412)[_0x670c('0x1a')](function(_0x4749f8){if(_0x4749f8['messages']){var _0xe67d58={'messageId':_0x4749f8[_0x670c('0x23')][0x0]['messageId']};if(!_0x34f78f['deliveryReport']){_0xe67d58[_0x670c('0x3b')]=!![];}return _0x16cf63[_0x670c('0x1b')](_0xe67d58);}else{return logger[_0x670c('0x2a')](_0x670c('0x3c'),_0x670c('0x2b'),_0x670c('0x56'),util[_0x670c('0x2c')](_0x4749f8,{'showHidden':![],'depth':null}));}});})[_0x670c('0x29')](function(_0x4aaef5){return logger[_0x670c('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x670c('0x56'),util['inspect'](_0x4aaef5,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x670c('0x3c'),_0x670c('0x2b'),'infobip',_0x670c('0x5b'));}}else{logger[_0x670c('0x2a')](_0x670c('0x3c'),_0x670c('0x2b'),_0x670c('0x56'),_0x670c('0x3d'));}break;case _0x670c('0x5c'):var _0x1e7cfb=require(_0x670c('0x5d'));if(_0x34f78f[_0x670c('0x5e')]){var _0xf6abb1={};_0xf6abb1[_0x670c('0x5f')]=_0x34f78f[_0x670c('0x30')];_0xf6abb1['phone']=_0x2dfdc2[_0x670c('0x21')];_0xf6abb1[_0x670c('0x60')]=_0x34f78f[_0x670c('0x21')];_0xf6abb1[_0x670c('0x61')]=_0x2dfdc2[_0x670c('0xe')];_0xf6abb1[_0x670c('0x62')]=+new Date();var _0x435d6d='';var _0x3a358d='';var _0x1d1558=Object[_0x670c('0x63')](_0xf6abb1);_0x1d1558[_0x670c('0x64')]();for(var _0x52e409=0x0;_0x52e409<_0x1d1558[_0x670c('0x65')];_0x52e409++){if(_0x435d6d!=''){_0x435d6d+='&';}_0x435d6d+=_0x1d1558[_0x52e409]+'='+encodeURIComponent(_0xf6abb1[_0x1d1558[_0x52e409]]);_0x3a358d+=_0xf6abb1[_0x1d1558[_0x52e409]];}_0x3a358d+=_0x34f78f[_0x670c('0x5e')];_0x3a358d=_0x1e7cfb['createHash'](_0x670c('0x66'))[_0x670c('0x1b')](_0x3a358d)[_0x670c('0x67')](_0x670c('0x68'));if(_0x435d6d!==''){_0x435d6d+='&';}_0x435d6d+='signature='+_0x3a358d;var _0x3b134f={'method':_0x670c('0x34'),'uri':_0x34f78f[_0x670c('0x57')]+_0x670c('0x69')+_0x435d6d,'json':!![]};return rp(_0x3b134f)[_0x670c('0x1a')](function(_0x412a26){var _0x3cf01c=Object['keys'](_0x412a26);if(_0x412a26[_0x3cf01c[0x0]][_0x670c('0x2a')]&&parseInt(_0x412a26[_0x3cf01c[0x0]][_0x670c('0x2a')])===0x0){var _0x2c68f0={'messageId':_0x412a26[_0x3cf01c[0x0]][_0x670c('0x6a')]};if(!_0x34f78f[_0x670c('0x41')]){_0x2c68f0[_0x670c('0x3b')]=!![];}return _0x16cf63['update'](_0x2c68f0);}else{return logger[_0x670c('0x2a')](_0x670c('0x3c'),_0x670c('0x2b'),_0x670c('0x5c'),util['inspect'](_0x412a26['error'],{'showHidden':![],'depth':null}));}})[_0x670c('0x29')](function(_0x405184){return logger[_0x670c('0x2a')](_0x670c('0x3c'),_0x670c('0x2b'),_0x670c('0x5c'),util[_0x670c('0x2c')](_0x405184,{'showHidden':![],'depth':null}));});}else{logger[_0x670c('0x2a')](_0x670c('0x3c'),_0x670c('0x2b'),_0x670c('0x5c'),_0x670c('0x6b'));}break;case _0x670c('0x6c'):if(_0x34f78f[_0x670c('0x5e')]){var _0x4c5978={'method':_0x670c('0x37'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x34f78f[_0x670c('0x5e')]},'body':{'content':_0x2dfdc2['body'],'to':[_0x2dfdc2[_0x670c('0x21')]],'from':_0x34f78f[_0x670c('0x21')],'binary':![],'clientMessageId':'uuid','charset':_0x670c('0x6d')},'json':!![]};rp(_0x4c5978)[_0x670c('0x1a')](function(_0x285caa){if(!_0x285caa[_0x670c('0x2a')]){var _0x1ed7e0={'messageId':_0x285caa[_0x670c('0x23')][0x0]['apiMessageId']};if(!_0x34f78f[_0x670c('0x41')]){_0x1ed7e0[_0x670c('0x3b')]=!![];}return _0x16cf63[_0x670c('0x1b')](_0x1ed7e0);}else{return logger['error'](_0x670c('0x3c'),'afterCreate',_0x670c('0x6c'),util['inspect'](_0x285caa[_0x670c('0x2a')],{'showHidden':![],'depth':null}));}})[_0x670c('0x29')](function(_0x9624a1){return logger[_0x670c('0x2a')](_0x670c('0x3c'),_0x670c('0x2b'),_0x670c('0x6c'),util[_0x670c('0x2c')](_0x9624a1,{'showHidden':![],'depth':null}));});}else{logger[_0x670c('0x2a')](_0x670c('0x3c'),_0x670c('0x2b'),_0x670c('0x6c'),'Missing\x20parameters:\x20apiKey');}break;case _0x670c('0x6e'):if(_0x34f78f[_0x670c('0x30')]&&_0x34f78f[_0x670c('0x31')]){var _0x16e72d=util['format'](_0x670c('0x47'),_0x34f78f[_0x670c('0x30')],_0x34f78f[_0x670c('0x31')]);var _0xa47f60={'method':_0x670c('0x37'),'uri':_0x670c('0x6f')+_0x34f78f[_0x670c('0x70')]+'/messages','body':{'to':[_0x2dfdc2[_0x670c('0x21')]],'text':_0x2dfdc2[_0x670c('0xe')],'from':_0x34f78f[_0x670c('0x21')],'applicationId':_0x34f78f[_0x670c('0x71')]},'headers':{'Authorization':util[_0x670c('0x46')](_0x670c('0x53'),new Buffer(_0x16e72d)[_0x670c('0x49')](_0x670c('0x4a')))},'json':!![]};rp(_0xa47f60)[_0x670c('0x1a')](function(_0x6a5f99){if(_0x6a5f99['id']){var _0xa5f9d6={'messageId':_0x6a5f99['id']};return _0x16cf63[_0x670c('0x1b')](_0xa5f9d6);}else{logger[_0x670c('0x2a')](_0x670c('0x3c'),_0x670c('0x2b'),_0x670c('0x6e'),util['inspect'](_0x6a5f99,{'showHidden':![],'depth':null}));}})[_0x670c('0x29')](function(_0x1e2a4d){logger[_0x670c('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x670c('0x6e'),util[_0x670c('0x2c')](_0x1e2a4d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x670c('0x3c'),'afterCreate','bandwidth',_0x670c('0x3d'));}break;case _0x670c('0x72'):if(_0x34f78f['apiKey']){var _0x103148={};var _0x3b134f={'method':_0x670c('0x37'),'uri':_0x670c('0x73'),'headers':{'Authorization':_0x670c('0x74')+_0x34f78f[_0x670c('0x5e')],'Content-Type':'application/json'},'body':{'from':_0x34f78f[_0x670c('0x21')],'to':_0x2dfdc2[_0x670c('0x21')],'text':_0x2dfdc2[_0x670c('0xe')]},'json':!![]};return rp(_0x3b134f)['then'](function(_0x527a74){if(_0x527a74[_0x670c('0x75')]==0xca){_0x103148['message']=_0x527a74;var _0x3e144e={'method':'POST','uri':_0x670c('0x76'),'headers':{'Authorization':_0x670c('0x74')+_0x34f78f[_0x670c('0x5e')],'Content-Type':'application/json'},'body':{'refid':_0x103148[_0x670c('0x77')]['refid']},'json':!![]};return rp(_0x3e144e)[_0x670c('0x1a')](function(_0x463d31){_0x103148[_0x670c('0x78')]=_0x463d31;var _0x2bf7a1={'messageId':_0x103148['message'][_0x670c('0x79')],'read':!![]};return _0x16cf63[_0x670c('0x1b')](_0x2bf7a1);});}else{return logger[_0x670c('0x2a')](_0x670c('0x3c'),'afterCreate',_0x670c('0x72'),util['inspect'](_0x527a74,{'showHidden':![],'depth':null}));}})[_0x670c('0x29')](function(_0x159122){return logger[_0x670c('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','intelepeer',util['inspect'](_0x159122,{'showHidden':![],'depth':null}));});}else{return logger[_0x670c('0x2a')](_0x670c('0x3c'),_0x670c('0x2b'),'intelepeer','Token\x20not\x20received');}break;}}})[_0x670c('0x7a')](function(){_0x388277();});}else{_0x388277();}}},'charset':'utf8mb4','collate':_0x670c('0x7b')});}; \ No newline at end of file +var _0xce9a=['findOne','then','createdAt','catch','error','secret','find','SmsAccountId','type','twilio','accountSid','authToken','create','phone','/api/sms/messages/','/status?token=','token','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','smsMethod','sender','login?username=','username','&password=','GET','split','sms','user_key','total_sent','internal_order_id','deliveryReport','read','afterCreate','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','password','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','data','queued_count','head','message_id','clickSend','plivo','authId','remote','format','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','messages','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys','sort','length','createHash','md5','digest','signature=','/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','accountId','/messages','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','sms_messages','messageId','body','FULLTEXT','direction','toLowerCase','out','isNil','UserId','SmsInteractionId','SmsInteraction'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0xce9a,0x66));var _0xace9=function(_0x59c797,_0x2d62b7){_0x59c797=_0x59c797-0x0;var _0x44c474=_0xce9a[_0x59c797];return _0x44c474;};'use strict';var _=require(_0xace9('0x0'));var util=require(_0xace9('0x1'));var logger=require(_0xace9('0x2'))(_0xace9('0x3'));var moment=require(_0xace9('0x4'));var BPromise=require('bluebird');var rp=require(_0xace9('0x5'));var fs=require('fs');var path=require(_0xace9('0x6'));var rimraf=require(_0xace9('0x7'));var config=require(_0xace9('0x8'));var attributes=require('./smsMessage.attributes');module['exports']=function(_0x31d6fc,_0x374134){return _0x31d6fc[_0xace9('0x9')]('SmsMessage',attributes,{'tableName':_0xace9('0xa'),'paranoid':![],'indexes':[{'name':_0xace9('0xb'),'fields':[_0xace9('0xb')]},{'name':'fti_sms_messages','fields':[_0xace9('0xc')],'type':_0xace9('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x251a8a,_0x55c089,_0x538512){var _0x4accc6=_0x31d6fc['models'];var _0x1a9e58=_0x251a8a['get']({'plain':!![]});if(_0x1a9e58[_0xace9('0xe')][_0xace9('0xf')]()==='in'||_0x1a9e58['direction'][_0xace9('0xf')]()===_0xace9('0x10')&&!_0x1a9e58['secret']&&!_[_0xace9('0x11')](_0x1a9e58[_0xace9('0x12')])&&!_[_0xace9('0x11')](_0x1a9e58[_0xace9('0x13')])){_0x4accc6[_0xace9('0x14')][_0xace9('0x15')]({'where':{'id':_0x1a9e58['SmsInteractionId']}})[_0xace9('0x16')](function(_0x234cd1){if(_0x234cd1){_0x234cd1['update']({'lastMsgAt':_0x1a9e58[_0xace9('0x17')],'lastMsgDirection':_0x1a9e58[_0xace9('0xe')][_0xace9('0xf')]()});}})[_0xace9('0x18')](function(_0x25e5fc){console[_0xace9('0x19')](_0x25e5fc);});}if(_0x1a9e58[_0xace9('0xe')]===_0xace9('0x10')&&!_0x1a9e58[_0xace9('0x1a')]){var _0x49b8a3;_0x4accc6['SmsAccount'][_0xace9('0x1b')]({'where':{'id':_0x1a9e58[_0xace9('0x1c')]},'raw':!![]})[_0xace9('0x16')](function(_0x5f37c2){_0x49b8a3=_0x5f37c2;if(_0x49b8a3&&_0x49b8a3[_0xace9('0x1d')]){switch(_0x49b8a3[_0xace9('0x1d')]){case'twilio':var _0x2f9429=require(_0xace9('0x1e'));if(_0x49b8a3[_0xace9('0x1f')]&&_0x49b8a3[_0xace9('0x20')]&&_0x49b8a3['phone']){var _0x3b17b3=new _0x2f9429(_0x49b8a3[_0xace9('0x1f')],_0x49b8a3[_0xace9('0x20')]);_0x3b17b3['messages'][_0xace9('0x21')]({'body':_0x1a9e58[_0xace9('0xc')],'to':_0x1a9e58[_0xace9('0x22')],'from':_0x49b8a3['phone'],'statusCallback':_0x49b8a3['remote']+_0xace9('0x23')+_0x1a9e58['id']+_0xace9('0x24')+_0x49b8a3[_0xace9('0x25')]})[_0xace9('0x16')](function(_0x6d8581){if(_0x6d8581[_0xace9('0x26')]){return _0x251a8a[_0xace9('0x27')]({'messageId':_0x6d8581[_0xace9('0x26')]});}})['catch'](function(_0x358fb1){logger[_0xace9('0x19')](_0xace9('0x28'),'afterCreate',_0xace9('0x1e'),util[_0xace9('0x29')](_0x358fb1,{'showHidden':![],'depth':null}));});}else{logger[_0xace9('0x19')](_0xace9('0x28'),'afterCreate',_0xace9('0x1e'),_0xace9('0x2a'));}break;case _0xace9('0x2b'):var _0xf458f9='https://api.skebby.it/API/v1.0/REST/';if(_0x49b8a3['username']&&_0x49b8a3['password']){var _0x576c58={'recipient':[_0x1a9e58[_0xace9('0x22')]],'message':_0x1a9e58['body'],'message_type':_0x49b8a3[_0xace9('0x2c')]};if(_0x49b8a3[_0xace9('0x2c')]&&_0x49b8a3[_0xace9('0x2c')]!=='SI'){_0x576c58[_0xace9('0x2d')]=_0x49b8a3[_0xace9('0x22')];}var _0x271ff1={'url':_0xf458f9+_0xace9('0x2e')+_0x49b8a3[_0xace9('0x2f')]+_0xace9('0x30')+_0x49b8a3['password'],'method':_0xace9('0x31')};rp(_0x271ff1)[_0xace9('0x16')](function(_0x590511){var _0x5a7bd2=_0x590511[_0xace9('0x32')](';');var _0x50354a={'user_key':_0x5a7bd2[0x0],'session_key':_0x5a7bd2[0x1]};_0x271ff1={'url':_0xf458f9+_0xace9('0x33'),'method':'POST','headers':{'user_key':_0x50354a[_0xace9('0x34')],'Session_key':_0x50354a['session_key']},'json':!![],'body':_0x576c58};return rp(_0x271ff1);})[_0xace9('0x16')](function(_0x121b68){if(_0x121b68[_0xace9('0x35')]>=0x1){var _0x1a0b9e={'messageId':_0x121b68[_0xace9('0x36')]};if(_0x49b8a3[_0xace9('0x2c')]!=='GP'||!_0x49b8a3[_0xace9('0x37')]){_0x1a0b9e[_0xace9('0x38')]=!![];}return _0x251a8a[_0xace9('0x27')](_0x1a0b9e);}else{return logger['error'](_0xace9('0x28'),'afterCreate',_0xace9('0x2b'),util['inspect'](_0x121b68,{'showHidden':![],'depth':null}));}})['catch'](function(_0x64d384){return logger[_0xace9('0x19')](_0xace9('0x28'),_0xace9('0x39'),_0xace9('0x2b'),util[_0xace9('0x29')](_0x64d384,{'showHidden':![],'depth':null}));});}else{logger[_0xace9('0x19')](_0xace9('0x28'),_0xace9('0x39'),_0xace9('0x2b'),_0xace9('0x3a'));}break;case _0xace9('0x3b'):if(_0x49b8a3[_0xace9('0x20')]){var _0x2a84fe={'recipient':_0x1a9e58[_0xace9('0x22')],'message':_0x1a9e58[_0xace9('0xc')],'sender':_0x49b8a3[_0xace9('0x3c')]||_0x49b8a3[_0xace9('0x22')],'authorization':_0x49b8a3[_0xace9('0x20')]};var _0x55c089={'method':_0xace9('0x3d'),'uri':_0xace9('0x3e'),'body':_0x2a84fe,'json':!![]};rp(_0x55c089)['then'](function(_0x43aec5){var _0x5eff4c={'messageId':_0x43aec5[_0xace9('0x3f')]};if(!_0x49b8a3[_0xace9('0x37')]){_0x5eff4c[_0xace9('0x38')]=!![];}return _0x251a8a['update'](_0x5eff4c);})[_0xace9('0x18')](function(_0x59aecf){logger[_0xace9('0x19')](_0xace9('0x28'),_0xace9('0x39'),_0xace9('0x3b'),util[_0xace9('0x29')](_0x59aecf,{'showHidden':![],'depth':null}));});}else{logger[_0xace9('0x19')](_0xace9('0x28'),'afterCreate',_0xace9('0x3b'),_0xace9('0x40'));}break;case'clicksend':if(_0x49b8a3[_0xace9('0x2f')]&&_0x49b8a3[_0xace9('0x41')]){var _0x2a84fe={'messages':[{'source':_0xace9('0x42'),'to':_0x1a9e58[_0xace9('0x22')],'body':_0x1a9e58['body'],'from':_0x49b8a3[_0xace9('0x3c')]||_0x49b8a3[_0xace9('0x22')]}]};var _0x3444b6=util['format'](_0xace9('0x43'),_0x49b8a3['username'],_0x49b8a3[_0xace9('0x41')]);var _0x55c089={'method':_0xace9('0x3d'),'uri':_0xace9('0x44'),'body':_0x2a84fe,'headers':{'Authorization':util['format'](_0xace9('0x45'),new Buffer(_0x3444b6)[_0xace9('0x46')](_0xace9('0x47')))},'json':!![]};rp(_0x55c089)[_0xace9('0x16')](function(_0x2e141f){if(_0x2e141f['http_code']>=0xc8&&_0x2e141f['http_code']<=0xce){if(_0x2e141f[_0xace9('0x48')]&&_0x2e141f[_0xace9('0x48')][_0xace9('0x49')]>0x0){var _0x574b43=_[_0xace9('0x4a')](_0x2e141f[_0xace9('0x48')]['messages']);var _0x4bb183={'messageId':_0x574b43[_0xace9('0x4b')]};if(!_0x49b8a3['deliveryReport']){_0x4bb183[_0xace9('0x38')]=!![];}return _0x251a8a[_0xace9('0x27')](_0x4bb183);}else{logger[_0xace9('0x19')](_0xace9('0x28'),_0xace9('0x39'),_0xace9('0x4c'),util[_0xace9('0x29')](_0x2e141f,{'showHidden':![],'depth':null}));}}else{logger[_0xace9('0x19')](_0xace9('0x28'),_0xace9('0x39'),_0xace9('0x4c'),util[_0xace9('0x29')](_0x2e141f,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2df681){logger[_0xace9('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xace9('0x4c'),util[_0xace9('0x29')](_0x2df681,{'showHidden':![],'depth':null}));});}else{logger[_0xace9('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xace9('0x4c'),_0xace9('0x3a'));}break;case _0xace9('0x4d'):if(_0x49b8a3[_0xace9('0x4e')]&&_0x49b8a3[_0xace9('0x20')]){var _0x2a84fe={'dst':_0x1a9e58[_0xace9('0x22')],'text':_0x1a9e58[_0xace9('0xc')],'src':_0x49b8a3[_0xace9('0x3c')]||_0x49b8a3[_0xace9('0x22')],'url':_0x49b8a3[_0xace9('0x4f')]+'/api/sms/messages/'+_0x1a9e58['id']+_0xace9('0x24')+_0x49b8a3[_0xace9('0x25')]};var _0x3444b6=util[_0xace9('0x50')](_0xace9('0x43'),_0x49b8a3[_0xace9('0x4e')],_0x49b8a3[_0xace9('0x20')]);var _0x55c089={'method':_0xace9('0x3d'),'uri':util[_0xace9('0x50')]('https://api.plivo.com/v1/Account/%s/Message/',_0x49b8a3['authId']),'body':_0x2a84fe,'headers':{'Authorization':util[_0xace9('0x50')](_0xace9('0x45'),new Buffer(_0x3444b6)[_0xace9('0x46')](_0xace9('0x47')))},'json':!![]};rp(_0x55c089)[_0xace9('0x16')](function(_0x3ae8d1){var _0x3aa7cb={'messageId':_0x3ae8d1[_0xace9('0x51')][0x0]};return _0x251a8a[_0xace9('0x27')](_0x3aa7cb);})['catch'](function(_0x667c71){logger[_0xace9('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xace9('0x39'),_0xace9('0x4d'),util[_0xace9('0x29')](_0x667c71,{'showHidden':![],'depth':null}));});}else{logger[_0xace9('0x19')](_0xace9('0x28'),_0xace9('0x39'),_0xace9('0x4d'),_0xace9('0x52'));}break;case _0xace9('0x53'):if(_0x49b8a3[_0xace9('0x2f')]&&_0x49b8a3[_0xace9('0x41')]){if(_0x49b8a3[_0xace9('0x54')]){var _0x30daad={'method':_0xace9('0x3d'),'uri':_0x49b8a3[_0xace9('0x54')]+'/auth/1/session','body':{'username':_0x49b8a3[_0xace9('0x2f')],'password':_0x49b8a3[_0xace9('0x41')]},'json':!![]};return rp(_0x30daad)[_0xace9('0x16')](function(_0x384772){var _0x38e964={'method':_0xace9('0x3d'),'uri':_0x49b8a3['baseUrl']+_0xace9('0x55'),'body':{'messages':[{'from':_0x49b8a3['phone'],'destinations':[{'to':_0x1a9e58['phone']}],'text':_0x1a9e58[_0xace9('0xc')],'notifyUrl':_0x49b8a3['remote']+'/api/sms/messages/'+_0x1a9e58['id']+'/status?token='+_0x49b8a3['token'],'notifyContentType':_0xace9('0x56'),'callbackData':_0x49b8a3[_0xace9('0x22')]+';'+_0x1a9e58['body']}]},'headers':{'Authorization':_0xace9('0x57')+_0x384772['token']},'json':!![]};return rp(_0x38e964)[_0xace9('0x16')](function(_0x5a7636){if(_0x5a7636[_0xace9('0x58')]){var _0x5671ff={'messageId':_0x5a7636[_0xace9('0x58')][0x0][_0xace9('0xb')]};if(!_0x49b8a3[_0xace9('0x37')]){_0x5671ff[_0xace9('0x38')]=!![];}return _0x251a8a[_0xace9('0x27')](_0x5671ff);}else{return logger[_0xace9('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xace9('0x39'),_0xace9('0x53'),util[_0xace9('0x29')](_0x5a7636,{'showHidden':![],'depth':null}));}});})[_0xace9('0x18')](function(_0x44af30){return logger[_0xace9('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xace9('0x53'),util[_0xace9('0x29')](_0x44af30,{'showHidden':![],'depth':null}));});}else{logger[_0xace9('0x19')](_0xace9('0x28'),_0xace9('0x39'),_0xace9('0x53'),_0xace9('0x59'));}}else{logger[_0xace9('0x19')](_0xace9('0x28'),_0xace9('0x39'),_0xace9('0x53'),_0xace9('0x3a'));}break;case _0xace9('0x5a'):var _0x1a442d=require(_0xace9('0x5b'));if(_0x49b8a3[_0xace9('0x5c')]){var _0x38ff54={};_0x38ff54[_0xace9('0x5d')]=_0x49b8a3[_0xace9('0x2f')];_0x38ff54[_0xace9('0x22')]=_0x1a9e58[_0xace9('0x22')];_0x38ff54[_0xace9('0x2d')]=_0x49b8a3[_0xace9('0x22')];_0x38ff54[_0xace9('0x5e')]=_0x1a9e58[_0xace9('0xc')];_0x38ff54[_0xace9('0x5f')]=+new Date();var _0x19452e='';var _0x32b6e4='';var _0xcda2fc=Object[_0xace9('0x60')](_0x38ff54);_0xcda2fc[_0xace9('0x61')]();for(var _0x48e180=0x0;_0x48e180<_0xcda2fc[_0xace9('0x62')];_0x48e180++){if(_0x19452e!=''){_0x19452e+='&';}_0x19452e+=_0xcda2fc[_0x48e180]+'='+encodeURIComponent(_0x38ff54[_0xcda2fc[_0x48e180]]);_0x32b6e4+=_0x38ff54[_0xcda2fc[_0x48e180]];}_0x32b6e4+=_0x49b8a3[_0xace9('0x5c')];_0x32b6e4=_0x1a442d[_0xace9('0x63')](_0xace9('0x64'))['update'](_0x32b6e4)[_0xace9('0x65')]('hex');if(_0x19452e!==''){_0x19452e+='&';}_0x19452e+=_0xace9('0x66')+_0x32b6e4;var _0x271ff1={'method':_0xace9('0x31'),'uri':_0x49b8a3[_0xace9('0x54')]+_0xace9('0x67')+_0x19452e,'json':!![]};return rp(_0x271ff1)[_0xace9('0x16')](function(_0x1f0249){var _0x824d64=Object[_0xace9('0x60')](_0x1f0249);if(_0x1f0249[_0x824d64[0x0]][_0xace9('0x19')]&&parseInt(_0x1f0249[_0x824d64[0x0]][_0xace9('0x19')])===0x0){var _0x26d8d5={'messageId':_0x1f0249[_0x824d64[0x0]]['id_sms']};if(!_0x49b8a3[_0xace9('0x37')]){_0x26d8d5['read']=!![];}return _0x251a8a['update'](_0x26d8d5);}else{return logger[_0xace9('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xace9('0x5a'),util[_0xace9('0x29')](_0x1f0249[_0xace9('0x19')],{'showHidden':![],'depth':null}));}})[_0xace9('0x18')](function(_0x4c2b0e){return logger[_0xace9('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xace9('0x39'),_0xace9('0x5a'),util[_0xace9('0x29')](_0x4c2b0e,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xace9('0x39'),_0xace9('0x5a'),_0xace9('0x68'));}break;case _0xace9('0x69'):if(_0x49b8a3[_0xace9('0x5c')]){var _0x2c3b33={'method':_0xace9('0x3d'),'uri':_0xace9('0x6a'),'headers':{'Authorization':_0x49b8a3['apiKey']},'body':{'content':_0x1a9e58[_0xace9('0xc')],'to':[_0x1a9e58['phone']],'from':_0x49b8a3[_0xace9('0x22')],'binary':![],'clientMessageId':_0xace9('0x6b'),'charset':'UTF-8'},'json':!![]};rp(_0x2c3b33)[_0xace9('0x16')](function(_0x458129){if(!_0x458129[_0xace9('0x19')]){var _0x49517d={'messageId':_0x458129[_0xace9('0x58')][0x0][_0xace9('0x6c')]};if(!_0x49b8a3[_0xace9('0x37')]){_0x49517d['read']=!![];}return _0x251a8a[_0xace9('0x27')](_0x49517d);}else{return logger[_0xace9('0x19')](_0xace9('0x28'),_0xace9('0x39'),_0xace9('0x69'),util[_0xace9('0x29')](_0x458129[_0xace9('0x19')],{'showHidden':![],'depth':null}));}})[_0xace9('0x18')](function(_0x32123c){return logger[_0xace9('0x19')](_0xace9('0x28'),'afterCreate',_0xace9('0x69'),util[_0xace9('0x29')](_0x32123c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xace9('0x28'),_0xace9('0x39'),_0xace9('0x69'),_0xace9('0x68'));}break;case'bandwidth':if(_0x49b8a3[_0xace9('0x2f')]&&_0x49b8a3[_0xace9('0x41')]){var _0x3444b6=util[_0xace9('0x50')](_0xace9('0x43'),_0x49b8a3['username'],_0x49b8a3[_0xace9('0x41')]);var _0x55c089={'method':_0xace9('0x3d'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x49b8a3[_0xace9('0x6d')]+_0xace9('0x6e'),'body':{'to':[_0x1a9e58[_0xace9('0x22')]],'text':_0x1a9e58['body'],'from':_0x49b8a3[_0xace9('0x22')],'applicationId':_0x49b8a3[_0xace9('0x6f')]},'headers':{'Authorization':util[_0xace9('0x50')](_0xace9('0x45'),new Buffer(_0x3444b6)[_0xace9('0x46')](_0xace9('0x47')))},'json':!![]};rp(_0x55c089)[_0xace9('0x16')](function(_0x1b7366){if(_0x1b7366['id']){var _0xfdc1a6={'messageId':_0x1b7366['id']};return _0x251a8a[_0xace9('0x27')](_0xfdc1a6);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xace9('0x39'),_0xace9('0x70'),util['inspect'](_0x1b7366,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5e730b){logger[_0xace9('0x19')](_0xace9('0x28'),_0xace9('0x39'),_0xace9('0x70'),util['inspect'](_0x5e730b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xace9('0x28'),'afterCreate','bandwidth',_0xace9('0x3a'));}break;case _0xace9('0x71'):if(_0x49b8a3['apiKey']){var _0x4b4e21={};var _0x271ff1={'method':'POST','uri':_0xace9('0x72'),'headers':{'Authorization':_0xace9('0x73')+_0x49b8a3[_0xace9('0x5c')],'Content-Type':'application/json'},'body':{'from':_0x49b8a3[_0xace9('0x22')],'to':_0x1a9e58['phone'],'text':_0x1a9e58[_0xace9('0xc')]},'json':!![]};return rp(_0x271ff1)[_0xace9('0x16')](function(_0xf1d646){if(_0xf1d646['code']==0xca){_0x4b4e21[_0xace9('0x74')]=_0xf1d646;var _0x363396={'method':'POST','uri':_0xace9('0x75'),'headers':{'Authorization':_0xace9('0x73')+_0x49b8a3[_0xace9('0x5c')],'Content-Type':_0xace9('0x56')},'body':{'refid':_0x4b4e21['message'][_0xace9('0x76')]},'json':!![]};return rp(_0x363396)[_0xace9('0x16')](function(_0x525171){_0x4b4e21[_0xace9('0x77')]=_0x525171;var _0x37d07b={'messageId':_0x4b4e21[_0xace9('0x74')][_0xace9('0x76')],'read':!![]};return _0x251a8a[_0xace9('0x27')](_0x37d07b);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xace9('0x39'),_0xace9('0x71'),util[_0xace9('0x29')](_0xf1d646,{'showHidden':![],'depth':null}));}})[_0xace9('0x18')](function(_0x4f6487){return logger[_0xace9('0x19')](_0xace9('0x28'),_0xace9('0x39'),_0xace9('0x71'),util[_0xace9('0x29')](_0x4f6487,{'showHidden':![],'depth':null}));});}else{return logger[_0xace9('0x19')](_0xace9('0x28'),_0xace9('0x39'),_0xace9('0x71'),_0xace9('0x78'));}break;}}})[_0xace9('0x79')](function(){_0x538512();});}else{_0x538512();}}},'charset':_0xace9('0x7a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 4c1e4a8..e5fb264 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 _0x00a2=['randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','SmsMessage','create','body','options','CreateSmsMessage','moment','bluebird'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x00a2,0x1be));var _0x200a=function(_0x591100,_0x103b1a){_0x591100=_0x591100-0x0;var _0x64a2f5=_0x00a2[_0x591100];return _0x64a2f5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x200a('0x0'));var BPromise=require(_0x200a('0x1'));var rs=require(_0x200a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x200a('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x200a('0x4'));var jayson=require(_0x200a('0x5'));var client=jayson[_0x200a('0x6')][_0x200a('0x7')]({'port':0x232a});config[_0x200a('0x8')]=_[_0x200a('0x9')](config[_0x200a('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x200a('0x8')]));require(_0x200a('0xa'))[_0x200a('0xb')](socket);function respondWithRpcPromise(_0x31d030,_0x560e36,_0x2debc7){return new BPromise(function(_0x53a032,_0x49ad46){return client[_0x200a('0xc')](_0x31d030,_0x2debc7)[_0x200a('0xd')](function(_0x2281ea){logger[_0x200a('0xe')](_0x200a('0xf'),_0x560e36,_0x200a('0x10'));logger[_0x200a('0x11')](_0x200a('0x12'),_0x560e36,_0x200a('0x10'),JSON[_0x200a('0x13')](_0x2281ea));if(_0x2281ea[_0x200a('0x14')]){if(_0x2281ea['error']['code']===0x1f4){logger[_0x200a('0x14')](_0x200a('0xf'),_0x560e36,_0x2281ea[_0x200a('0x14')][_0x200a('0x15')]);return _0x49ad46(_0x2281ea['error']['message']);}logger[_0x200a('0x14')](_0x200a('0xf'),_0x560e36,_0x2281ea['error']['message']);return _0x53a032(_0x2281ea[_0x200a('0x14')]['message']);}else{logger[_0x200a('0xe')](_0x200a('0xf'),_0x560e36,_0x200a('0x10'));_0x53a032(_0x2281ea[_0x200a('0x16')][_0x200a('0x15')]);}})['catch'](function(_0x233f52){logger[_0x200a('0x14')](_0x200a('0xf'),_0x560e36,_0x233f52);_0x49ad46(_0x233f52);});});}exports['CreateSmsMessage']=function(_0x3a06b0){var _0x4f2173=this;return new Promise(function(_0x264193,_0x571c7e){return db[_0x200a('0x17')][_0x200a('0x18')](_0x3a06b0[_0x200a('0x19')],{'raw':_0x3a06b0[_0x200a('0x1a')]?_0x3a06b0[_0x200a('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x200a('0xd')](function(_0xcf8d58){logger[_0x200a('0xe')](_0x200a('0x1b'),_0x3a06b0);logger[_0x200a('0x11')]('CreateSmsMessage',_0x3a06b0,JSON[_0x200a('0x13')](_0xcf8d58));_0x264193(_0xcf8d58);})['catch'](function(_0x2dcf73){logger[_0x200a('0x14')](_0x200a('0x1b'),_0x2dcf73[_0x200a('0x15')],_0x3a06b0);_0x571c7e(_0x4f2173[_0x200a('0x14')](0x1f4,_0x2dcf73[_0x200a('0x15')]));});});}; \ No newline at end of file +var _0xcbd7=['catch','lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','register','then','request\x20sent','debug','error','code','SmsMessage,\x20%s,\x20%s','message','CreateSmsMessage','create','body','options','raw','info','stringify'];(function(_0x5a1d58,_0x42ab8d){var _0x5911a9=function(_0x3769a4){while(--_0x3769a4){_0x5a1d58['push'](_0x5a1d58['shift']());}};_0x5911a9(++_0x42ab8d);}(_0xcbd7,0x10f));var _0x7cbd=function(_0x1be47b,_0x3a0916){_0x1be47b=_0x1be47b-0x0;var _0x58eb35=_0xcbd7[_0x1be47b];return _0x58eb35;};'use strict';var _=require(_0x7cbd('0x0'));var util=require(_0x7cbd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7cbd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7cbd('0x3'))['db'];var utils=require(_0x7cbd('0x4'));var logger=require('../../config/logger')(_0x7cbd('0x5'));var config=require('../../config/environment');var jayson=require(_0x7cbd('0x6'));var client=jayson[_0x7cbd('0x7')][_0x7cbd('0x8')]({'port':0x232a});config[_0x7cbd('0x9')]=_['defaults'](config[_0x7cbd('0x9')],{'host':_0x7cbd('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsMessage.socket')[_0x7cbd('0xb')](socket);function respondWithRpcPromise(_0x18d300,_0x170a2d,_0x5e7eb3){return new BPromise(function(_0x3e9252,_0x100dd7){return client['request'](_0x18d300,_0x5e7eb3)[_0x7cbd('0xc')](function(_0x55dabf){logger['info']('SmsMessage,\x20%s,\x20%s',_0x170a2d,_0x7cbd('0xd'));logger[_0x7cbd('0xe')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x170a2d,'request\x20sent',JSON['stringify'](_0x55dabf));if(_0x55dabf[_0x7cbd('0xf')]){if(_0x55dabf[_0x7cbd('0xf')][_0x7cbd('0x10')]===0x1f4){logger['error'](_0x7cbd('0x11'),_0x170a2d,_0x55dabf[_0x7cbd('0xf')][_0x7cbd('0x12')]);return _0x100dd7(_0x55dabf[_0x7cbd('0xf')]['message']);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x170a2d,_0x55dabf[_0x7cbd('0xf')][_0x7cbd('0x12')]);return _0x3e9252(_0x55dabf['error'][_0x7cbd('0x12')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x170a2d,'request\x20sent');_0x3e9252(_0x55dabf['result'][_0x7cbd('0x12')]);}})['catch'](function(_0x4d64db){logger[_0x7cbd('0xf')](_0x7cbd('0x11'),_0x170a2d,_0x4d64db);_0x100dd7(_0x4d64db);});});}exports[_0x7cbd('0x13')]=function(_0x5df136){var _0x32d1c4=this;return new Promise(function(_0x3126cb,_0x5f37a7){return db['SmsMessage'][_0x7cbd('0x14')](_0x5df136[_0x7cbd('0x15')],{'raw':_0x5df136[_0x7cbd('0x16')]?_0x5df136[_0x7cbd('0x16')][_0x7cbd('0x17')]===undefined?!![]:![]:!![]})[_0x7cbd('0xc')](function(_0x4c6182){logger[_0x7cbd('0x18')](_0x7cbd('0x13'),_0x5df136);logger['debug'](_0x7cbd('0x13'),_0x5df136,JSON[_0x7cbd('0x19')](_0x4c6182));_0x3126cb(_0x4c6182);})[_0x7cbd('0x1a')](function(_0x562c8d){logger[_0x7cbd('0xf')](_0x7cbd('0x13'),_0x562c8d[_0x7cbd('0x12')],_0x5df136);_0x5f37a7(_0x32d1c4[_0x7cbd('0xf')](0x1f4,_0x562c8d[_0x7cbd('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index f2c8db0..4f345fe 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 _0x2e5d=['update','emit','removeListener','register','smsMessage:','./smsMessage.events'];(function(_0x1f0f7c,_0x34e9ba){var _0x588858=function(_0x2c4e0a){while(--_0x2c4e0a){_0x1f0f7c['push'](_0x1f0f7c['shift']());}};_0x588858(++_0x34e9ba);}(_0x2e5d,0x1eb));var _0xd2e5=function(_0x430f44,_0x4ae21b){_0x430f44=_0x430f44-0x0;var _0x1f6b0f=_0x2e5d[_0x430f44];return _0x1f6b0f;};'use strict';var SmsMessageEvents=require(_0xd2e5('0x0'));var events=['save','remove',_0xd2e5('0x1')];function createListener(_0xfafcb2,_0x2e91ca){return function(_0x569a60){_0x2e91ca[_0xd2e5('0x2')](_0xfafcb2,_0x569a60);};}function removeListener(_0x410821,_0x5d34ba){return function(){SmsMessageEvents[_0xd2e5('0x3')](_0x410821,_0x5d34ba);};}exports[_0xd2e5('0x4')]=function(_0x334b82){for(var _0x39f622=0x0,_0x7e0ff5=events['length'];_0x39f622<_0x7e0ff5;_0x39f622++){var _0x104c95=events[_0x39f622];var _0x1c8a3a=createListener(_0xd2e5('0x5')+_0x104c95,_0x334b82);SmsMessageEvents['on'](_0x104c95,_0x1c8a3a);}}; \ No newline at end of file +var _0xab69=['emit','removeListener','length','smsMessage:','./smsMessage.events','remove','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xab69,0x123));var _0x9ab6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xab69[_0xa464c9];return _0x3d73c4;};'use strict';var SmsMessageEvents=require(_0x9ab6('0x0'));var events=['save',_0x9ab6('0x1'),_0x9ab6('0x2')];function createListener(_0x4ad34d,_0x598313){return function(_0x2064fd){_0x598313[_0x9ab6('0x3')](_0x4ad34d,_0x2064fd);};}function removeListener(_0x5e7a7c,_0x4c0671){return function(){SmsMessageEvents[_0x9ab6('0x4')](_0x5e7a7c,_0x4c0671);};}exports['register']=function(_0x1cff78){for(var _0x4636a3=0x0,_0x461ca6=events[_0x9ab6('0x5')];_0x4636a3<_0x461ca6;_0x4636a3++){var _0x151b1c=events[_0x4636a3];var _0x280bf3=createListener(_0x9ab6('0x6')+_0x151b1c,_0x1cff78);SmsMessageEvents['on'](_0x151b1c,_0x280bf3);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 3c7f4db..c4a720c 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 _0xbca7=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','describe','/:id','isAuthenticated','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','put','delete','destroy','removeTeams','removeAgents','exports','util'];(function(_0x3f49fd,_0x3763fc){var _0xe6248b=function(_0x5d8fbf){while(--_0x5d8fbf){_0x3f49fd['push'](_0x3f49fd['shift']());}};_0xe6248b(++_0x3763fc);}(_0xbca7,0x86));var _0x7bca=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xbca7[_0x4e9628];return _0x27bc8c;};'use strict';var multer=require('multer');var util=require(_0x7bca('0x0'));var path=require(_0x7bca('0x1'));var timeout=require(_0x7bca('0x2'));var express=require('express');var router=express[_0x7bca('0x3')]();var fs_extra=require(_0x7bca('0x4'));var auth=require(_0x7bca('0x5'));var interaction=require(_0x7bca('0x6'));var config=require(_0x7bca('0x7'));var controller=require(_0x7bca('0x8'));router[_0x7bca('0x9')]('/',auth['isAuthenticated'](),controller[_0x7bca('0xa')]);router[_0x7bca('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x7bca('0xb')]);router['get'](_0x7bca('0xc'),auth[_0x7bca('0xd')](),controller[_0x7bca('0xe')]);router['get']('/:id/members',auth[_0x7bca('0xd')](),controller['getMembers']);router[_0x7bca('0x9')](_0x7bca('0xf'),auth['isAuthenticated'](),controller[_0x7bca('0x10')]);router[_0x7bca('0x9')](_0x7bca('0x11'),auth['isAuthenticated'](),controller[_0x7bca('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x7bca('0x13')](_0x7bca('0xf'),auth[_0x7bca('0xd')](),controller[_0x7bca('0x14')]);router[_0x7bca('0x13')](_0x7bca('0x11'),auth['isAuthenticated'](),controller['addAgents']);router[_0x7bca('0x15')](_0x7bca('0xc'),auth[_0x7bca('0xd')](),controller['update']);router[_0x7bca('0x16')](_0x7bca('0xc'),auth['isAuthenticated'](),controller[_0x7bca('0x17')]);router['delete'](_0x7bca('0xf'),auth[_0x7bca('0xd')](),controller[_0x7bca('0x18')]);router[_0x7bca('0x16')]('/:id/users',auth[_0x7bca('0xd')](),controller[_0x7bca('0x19')]);module[_0x7bca('0x1a')]=router; \ No newline at end of file +var _0x4d80=['fs-extra','../../config/environment','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','get','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','path','express','Router'];(function(_0x1bc013,_0x7771c6){var _0x55df36=function(_0x1c02e0){while(--_0x1c02e0){_0x1bc013['push'](_0x1bc013['shift']());}};_0x55df36(++_0x7771c6);}(_0x4d80,0x100));var _0x04d8=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x4d80[_0x199572];return _0x13cfa3;};'use strict';var multer=require(_0x04d8('0x0'));var util=require(_0x04d8('0x1'));var path=require(_0x04d8('0x2'));var timeout=require('connect-timeout');var express=require(_0x04d8('0x3'));var router=express[_0x04d8('0x4')]();var fs_extra=require(_0x04d8('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x04d8('0x6'));var controller=require('./smsQueue.controller');router['get']('/',auth[_0x04d8('0x7')](),controller[_0x04d8('0x8')]);router['get'](_0x04d8('0x9'),auth['isAuthenticated'](),controller[_0x04d8('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x04d8('0xb')]);router['get'](_0x04d8('0xc'),auth[_0x04d8('0x7')](),controller[_0x04d8('0xd')]);router[_0x04d8('0xe')](_0x04d8('0xf'),auth['isAuthenticated'](),controller[_0x04d8('0x10')]);router['get'](_0x04d8('0x11'),auth[_0x04d8('0x7')](),controller[_0x04d8('0x12')]);router[_0x04d8('0x13')]('/',auth['isAuthenticated'](),controller[_0x04d8('0x14')]);router['post'](_0x04d8('0xf'),auth[_0x04d8('0x7')](),controller[_0x04d8('0x15')]);router[_0x04d8('0x13')](_0x04d8('0x11'),auth[_0x04d8('0x7')](),controller[_0x04d8('0x16')]);router[_0x04d8('0x17')](_0x04d8('0x18'),auth['isAuthenticated'](),controller['update']);router[_0x04d8('0x19')](_0x04d8('0x18'),auth[_0x04d8('0x7')](),controller[_0x04d8('0x1a')]);router[_0x04d8('0x19')]('/:id/teams',auth[_0x04d8('0x7')](),controller['removeTeams']);router[_0x04d8('0x19')]('/:id/users',auth[_0x04d8('0x7')](),controller[_0x04d8('0x1b')]);module[_0x04d8('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index f0a1a9f..72bc5ea 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 _0xf9b6=['roundrobin','sequelize','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x111b26,_0xf76620){var _0x3a0a1e=function(_0x2829cc){while(--_0x2829cc){_0x111b26['push'](_0x111b26['shift']());}};_0x3a0a1e(++_0xf76620);}(_0xf9b6,0x1eb));var _0x6f9b=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xf9b6[_0x2160a9];return _0xa88cf7;};'use strict';var Sequelize=require(_0x6f9b('0x0'));module['exports']={'name':{'type':Sequelize[_0x6f9b('0x1')],'unique':_0x6f9b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6f9b('0x1')]},'timeout':{'type':Sequelize[_0x6f9b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6f9b('0x4')](_0x6f9b('0x5'),'beepall',_0x6f9b('0x6'))}}; \ No newline at end of file +var _0xa8f4=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x3a4095,_0x5abe9c){var _0xabb176=function(_0x3301c5){while(--_0x3301c5){_0x3a4095['push'](_0x3a4095['shift']());}};_0xabb176(++_0x5abe9c);}(_0xa8f4,0x18d));var _0x4a8f=function(_0x164d6f,_0x22f05e){_0x164d6f=_0x164d6f-0x0;var _0x5a17e6=_0xa8f4[_0x164d6f];return _0x5a17e6;};'use strict';var Sequelize=require(_0x4a8f('0x0'));module[_0x4a8f('0x1')]={'name':{'type':Sequelize[_0x4a8f('0x2')],'unique':_0x4a8f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4a8f('0x2')]},'timeout':{'type':Sequelize[_0x4a8f('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4a8f('0x5')](_0x4a8f('0x6'),_0x4a8f('0x7'),_0x4a8f('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 48dcd58..0e4ac0f 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 _0xe09a=['getTeams','Team','ids','online','voicePause','flatMap','Agents','sequelize','transaction','addTeams','each','forEach','select','field','tq.TeamId','from','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','push','toString','SELECT','every','TeamId','all','compact','removeTeams','removeAgents','userSmsQueue:remove','addAgents','spread','emit','userSmsQueue:save','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','./smsQueue.socket','sendStatus','status','end','offset','undefined','limit','set','apply','reject','update','destroy','then','get','SmsQueues','UserProfileResource','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','intersection','find','body','role','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','SmsQueueId','UserSmsQueue','User','findAndCountAll','UserId','agent','updatedAt','createdAt','%s/%s','SIP','smsPause'];(function(_0x123318,_0x4b96ca){var _0x239daa=function(_0x480c1c){while(--_0x480c1c){_0x123318['push'](_0x123318['shift']());}};_0x239daa(++_0x4b96ca);}(_0xe09a,0xaa));var _0xae09=function(_0x43d16c,_0x2b5447){_0x43d16c=_0x43d16c-0x0;var _0x208cce=_0xe09a[_0x43d16c];return _0x208cce;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xae09('0x0'));var jsonpatch=require(_0xae09('0x1'));var rp=require(_0xae09('0x2'));var moment=require(_0xae09('0x3'));var BPromise=require(_0xae09('0x4'));var Mustache=require(_0xae09('0x5'));var util=require(_0xae09('0x6'));var path=require(_0xae09('0x7'));var sox=require('sox');var csv=require(_0xae09('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae09('0x9'));var squel=require('squel');var crypto=require(_0xae09('0xa'));var jsforce=require(_0xae09('0xb'));var deskjs=require(_0xae09('0xc'));var toCsv=require(_0xae09('0x8'));var querystring=require(_0xae09('0xd'));var Papa=require(_0xae09('0xe'));var Redis=require(_0xae09('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xae09('0x10'));var as=require(_0xae09('0x11'));var hardwareService=require(_0xae09('0x12'));var logger=require(_0xae09('0x13'))(_0xae09('0x14'));var utils=require(_0xae09('0x15'));var config=require(_0xae09('0x16'));var licenseUtil=require(_0xae09('0x17'));var db=require(_0xae09('0x18'))['db'];config['redis']=_[_0xae09('0x19')](config['redis'],{'host':_0xae09('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xae09('0x1b'))['register'](socket);function respondWithStatusCode(_0x1fbe86,_0x21cb1e){_0x21cb1e=_0x21cb1e||0xcc;return function(_0x402b11){if(_0x402b11){return _0x1fbe86[_0xae09('0x1c')](_0x21cb1e);}return _0x1fbe86[_0xae09('0x1d')](_0x21cb1e)[_0xae09('0x1e')]();};}function respondWithResult(_0x2c5b17,_0x44c68f){_0x44c68f=_0x44c68f||0xc8;return function(_0x4301c8){if(_0x4301c8){return _0x2c5b17[_0xae09('0x1d')](_0x44c68f)['json'](_0x4301c8);}};}function respondWithFilteredResult(_0x5dc143,_0x1da2ec){return function(_0x334b93){if(_0x334b93){var _0x35b2d0=typeof _0x1da2ec[_0xae09('0x1f')]===_0xae09('0x20')&&typeof _0x1da2ec[_0xae09('0x21')]===_0xae09('0x20');var _0xe5067f=_0x334b93['count'];var _0x5da125=_0x35b2d0?0x0:_0x1da2ec[_0xae09('0x1f')];var _0x1f0fc8=_0x35b2d0?_0x334b93['count']:_0x1da2ec['offset']+_0x1da2ec[_0xae09('0x21')];var _0x5b8a86;if(_0x1f0fc8>=_0xe5067f){_0x1f0fc8=_0xe5067f;_0x5b8a86=0xc8;}else{_0x5b8a86=0xce;}_0x5dc143[_0xae09('0x1d')](_0x5b8a86);return _0x5dc143[_0xae09('0x22')]('Content-Range',_0x5da125+'-'+_0x1f0fc8+'/'+_0xe5067f)['json'](_0x334b93);}return null;};}function patchUpdates(_0x267dbc){return function(_0x1ae59b){try{jsonpatch[_0xae09('0x23')](_0x1ae59b,_0x267dbc,!![]);}catch(_0x2ff18b){return BPromise[_0xae09('0x24')](_0x2ff18b);}return _0x1ae59b['save']();};}function saveUpdates(_0x583e9c,_0x332db9){return function(_0x11033e){if(_0x11033e){return _0x11033e[_0xae09('0x25')](_0x583e9c)['then'](function(_0x2b8221){return _0x2b8221;});}return null;};}function removeEntity(_0x4fbbfc,_0x280549){return function(_0x8e2b4){if(_0x8e2b4){return _0x8e2b4[_0xae09('0x26')]()[_0xae09('0x27')](function(){var _0x404533=_0x8e2b4[_0xae09('0x28')]({'plain':!![]});var _0x12db9d=_0xae09('0x29');return db[_0xae09('0x2a')][_0xae09('0x26')]({'where':{'type':_0x12db9d,'resourceId':_0x404533['id']}})[_0xae09('0x27')](function(){return _0x8e2b4;});})[_0xae09('0x27')](function(){_0x4fbbfc['status'](0xcc)[_0xae09('0x1e')]();});}};}function handleEntityNotFound(_0x23dfeb,_0x391094){return function(_0x3e6d91){if(!_0x3e6d91){_0x23dfeb[_0xae09('0x1c')](0x194);}return _0x3e6d91;};}function handleError(_0xfdb90b,_0x4d55f3){_0x4d55f3=_0x4d55f3||0x1f4;return function(_0x411130){logger['error'](_0x411130['stack']);if(_0x411130[_0xae09('0x2b')]){delete _0x411130[_0xae09('0x2b')];}_0xfdb90b[_0xae09('0x1d')](_0x4d55f3)[_0xae09('0x2c')](_0x411130);};}exports[_0xae09('0x2d')]=function(_0x55cd4e,_0x5d2dc0){var _0x5cafad={},_0x272c62={},_0x2180ae={'count':0x0,'rows':[]};var _0x1f87d5=_[_0xae09('0x2e')](db[_0xae09('0x2f')][_0xae09('0x30')],function(_0x4f70c5){return{'name':_0x4f70c5[_0xae09('0x31')],'type':_0x4f70c5[_0xae09('0x32')]['key']};});_0x272c62[_0xae09('0x33')]=_[_0xae09('0x2e')](_0x1f87d5,_0xae09('0x2b'));_0x272c62[_0xae09('0x34')]=_[_0xae09('0x35')](_0x55cd4e['query']);_0x272c62[_0xae09('0x36')]=_['intersection'](_0x272c62['model'],_0x272c62['query']);_0x5cafad[_0xae09('0x37')]=_['intersection'](_0x272c62[_0xae09('0x33')],qs[_0xae09('0x38')](_0x55cd4e[_0xae09('0x34')][_0xae09('0x38')]));_0x5cafad['attributes']=_0x5cafad[_0xae09('0x37')][_0xae09('0x39')]?_0x5cafad[_0xae09('0x37')]:_0x272c62[_0xae09('0x33')];if(!_0x55cd4e[_0xae09('0x34')][_0xae09('0x3a')](_0xae09('0x3b'))){_0x5cafad[_0xae09('0x21')]=qs['limit'](_0x55cd4e[_0xae09('0x34')][_0xae09('0x21')]);_0x5cafad[_0xae09('0x1f')]=qs[_0xae09('0x1f')](_0x55cd4e[_0xae09('0x34')][_0xae09('0x1f')]);}_0x5cafad[_0xae09('0x3c')]=qs[_0xae09('0x3d')](_0x55cd4e['query'][_0xae09('0x3d')]);_0x5cafad[_0xae09('0x3e')]=qs[_0xae09('0x36')](_[_0xae09('0x3f')](_0x55cd4e[_0xae09('0x34')],_0x272c62['filters']),_0x1f87d5);if(_0x55cd4e[_0xae09('0x34')][_0xae09('0x40')]){_0x5cafad['where']=_[_0xae09('0x41')](_0x5cafad['where'],{'$or':_[_0xae09('0x2e')](_0x1f87d5,function(_0x1aac3a){if(_0x1aac3a['type']!==_0xae09('0x42')){var _0x40caca={};_0x40caca[_0x1aac3a[_0xae09('0x2b')]]={'$like':'%'+_0x55cd4e['query'][_0xae09('0x40')]+'%'};return _0x40caca;}})});}_0x5cafad=_[_0xae09('0x41')]({},_0x5cafad,_0x55cd4e[_0xae09('0x43')]);var _0x1d27cf={'where':_0x5cafad[_0xae09('0x3e')]};return db['SmsQueue'][_0xae09('0x44')](_0x1d27cf)[_0xae09('0x27')](function(_0x227ced){_0x2180ae[_0xae09('0x44')]=_0x227ced;if(_0x55cd4e[_0xae09('0x34')][_0xae09('0x45')]){_0x5cafad[_0xae09('0x46')]=[{'all':!![]}];}return db[_0xae09('0x2f')][_0xae09('0x47')](_0x5cafad);})[_0xae09('0x27')](function(_0x3b248c){_0x2180ae[_0xae09('0x48')]=_0x3b248c;return _0x2180ae;})[_0xae09('0x27')](respondWithFilteredResult(_0x5d2dc0,_0x5cafad))[_0xae09('0x49')](handleError(_0x5d2dc0,null));};exports['show']=function(_0x32769a,_0x56b0f5){var _0x55f364={'raw':!![],'where':{'id':_0x32769a[_0xae09('0x4a')]['id']}},_0x55cea2={};_0x55cea2['model']=_[_0xae09('0x35')](db['SmsQueue'][_0xae09('0x30')]);_0x55cea2[_0xae09('0x34')]=_[_0xae09('0x35')](_0x32769a[_0xae09('0x34')]);_0x55cea2[_0xae09('0x36')]=_[_0xae09('0x4b')](_0x55cea2['model'],_0x55cea2['query']);_0x55f364['attributes']=_[_0xae09('0x4b')](_0x55cea2[_0xae09('0x33')],qs['fields'](_0x32769a[_0xae09('0x34')]['fields']));_0x55f364[_0xae09('0x37')]=_0x55f364[_0xae09('0x37')][_0xae09('0x39')]?_0x55f364[_0xae09('0x37')]:_0x55cea2[_0xae09('0x33')];if(_0x32769a[_0xae09('0x34')]['includeAll']){_0x55f364[_0xae09('0x46')]=[{'all':!![]}];}_0x55f364=_[_0xae09('0x41')]({},_0x55f364,_0x32769a[_0xae09('0x43')]);return db[_0xae09('0x2f')][_0xae09('0x4c')](_0x55f364)[_0xae09('0x27')](handleEntityNotFound(_0x56b0f5,null))[_0xae09('0x27')](respondWithResult(_0x56b0f5,null))['catch'](handleError(_0x56b0f5,null));};exports['create']=function(_0x2cee7a,_0x5bad23){return db['SmsQueue']['create'](_0x2cee7a[_0xae09('0x4d')],{})['then'](function(_0x4924cd){var _0x471803=_0x2cee7a['user']['get']({'plain':!![]});if(!_0x471803)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x471803[_0xae09('0x4e')]===_0xae09('0x4f')){var _0x582fe6=_0x4924cd[_0xae09('0x28')]({'plain':!![]});var _0x1948e5='SmsQueues';return db['UserProfileSection'][_0xae09('0x4c')]({'where':{'name':_0x1948e5,'userProfileId':_0x471803[_0xae09('0x50')]},'raw':!![]})[_0xae09('0x27')](function(_0x5308dd){if(_0x5308dd&&_0x5308dd[_0xae09('0x51')]===0x0){return db[_0xae09('0x2a')]['create']({'name':_0x582fe6['name'],'resourceId':_0x582fe6['id'],'type':_0x5308dd[_0xae09('0x2b')],'sectionId':_0x5308dd['id']},{})['then'](function(){return _0x4924cd;});}else{return _0x4924cd;}})['catch'](function(_0x3471c0){logger[_0xae09('0x52')](_0xae09('0x53'),_0x3471c0);throw _0x3471c0;});}return _0x4924cd;})['then'](respondWithResult(_0x5bad23,0xc9))[_0xae09('0x49')](handleError(_0x5bad23,null));};exports[_0xae09('0x25')]=function(_0x5266ce,_0x1e3a3b){if(_0x5266ce[_0xae09('0x4d')]['id']){delete _0x5266ce[_0xae09('0x4d')]['id'];}return db[_0xae09('0x2f')][_0xae09('0x4c')]({'where':{'id':_0x5266ce['params']['id']}})[_0xae09('0x27')](handleEntityNotFound(_0x1e3a3b,null))[_0xae09('0x27')](saveUpdates(_0x5266ce['body'],null))['then'](respondWithResult(_0x1e3a3b,null))[_0xae09('0x49')](handleError(_0x1e3a3b,null));};exports['destroy']=function(_0xc6416e,_0x2d72c1){return db[_0xae09('0x2f')][_0xae09('0x4c')]({'where':{'id':_0xc6416e['params']['id']}})[_0xae09('0x27')](handleEntityNotFound(_0x2d72c1,null))[_0xae09('0x27')](removeEntity(_0x2d72c1,null))[_0xae09('0x49')](handleError(_0x2d72c1,null));};exports[_0xae09('0x54')]=function(_0x5b91f6,_0x2d13f0){return db[_0xae09('0x2f')][_0xae09('0x54')]()[_0xae09('0x27')](respondWithResult(_0x2d13f0,null))[_0xae09('0x49')](handleError(_0x2d13f0,null));};exports[_0xae09('0x55')]=function(_0x5ae1c7,_0x469e36,_0x10f134){var _0x3676ea={'raw':!![],'where':{}},_0x8d10a0={},_0x1569aa;return db[_0xae09('0x2f')][_0xae09('0x56')]({'where':{'id':_0x5ae1c7['params']['id']}})[_0xae09('0x27')](handleEntityNotFound(_0x469e36,null))[_0xae09('0x27')](function(_0x468f5d){if(_0x468f5d){_0x1569aa=_0x468f5d[_0xae09('0x28')]({'plain':!![]});_0x8d10a0[_0xae09('0x33')]=_[_0xae09('0x35')](db['UserSmsQueue'][_0xae09('0x30')]);_0x8d10a0[_0xae09('0x34')]=_[_0xae09('0x35')](_0x5ae1c7[_0xae09('0x34')]);_0x8d10a0['filters']=_[_0xae09('0x4b')](_0x8d10a0['model'],_0x8d10a0['query']);_0x3676ea[_0xae09('0x37')]=_['intersection'](_0x8d10a0[_0xae09('0x33')],qs[_0xae09('0x38')](_0x5ae1c7[_0xae09('0x34')][_0xae09('0x38')]));_0x3676ea[_0xae09('0x37')]=_0x3676ea[_0xae09('0x37')][_0xae09('0x39')]?_0x3676ea[_0xae09('0x37')]:_0x8d10a0['model'];if(!_0x5ae1c7[_0xae09('0x34')][_0xae09('0x3a')](_0xae09('0x3b'))){_0x3676ea[_0xae09('0x21')]=qs['limit'](_0x5ae1c7[_0xae09('0x34')]['limit']);_0x3676ea[_0xae09('0x1f')]=qs['offset'](_0x5ae1c7['query']['offset']);}_0x3676ea[_0xae09('0x3c')]=qs[_0xae09('0x3d')](_0x5ae1c7[_0xae09('0x34')]['sort']);_0x3676ea[_0xae09('0x3e')]=qs[_0xae09('0x36')](_[_0xae09('0x3f')](_0x5ae1c7[_0xae09('0x34')],_0x8d10a0[_0xae09('0x36')]));_0x3676ea[_0xae09('0x3e')][_0xae09('0x57')]=_0x468f5d['id'];if(_0x5ae1c7[_0xae09('0x34')][_0xae09('0x40')]){_0x3676ea[_0xae09('0x3e')]=_['merge'](_0x3676ea['where'],{'$or':_['map'](_0x3676ea[_0xae09('0x37')],function(_0x1c766b){var _0x59295c={};_0x59295c[_0x1c766b]={'$like':'%'+_0x5ae1c7['query'][_0xae09('0x40')]+'%'};return _0x59295c;})});}_0x3676ea=_[_0xae09('0x41')]({},_0x3676ea,_0x5ae1c7[_0xae09('0x43')]);return db[_0xae09('0x58')][_0xae09('0x47')](_0x3676ea);}})['then'](function(_0x235f58){if(_0x235f58){return db[_0xae09('0x59')][_0xae09('0x5a')]({'where':{'id':_['map'](_0x235f58,_0xae09('0x5b')),'role':_0xae09('0x5c')},'attributes':['id',_0xae09('0x2b'),'smsPause',_0xae09('0x5d'),_0xae09('0x5e')]});}})['then'](function(_0x1b6083){if(_0x1b6083){return{'count':_0x1b6083[_0xae09('0x44')],'rows':_[_0xae09('0x2e')](_0x1b6083[_0xae09('0x48')],function(_0x5b2efd){return{'membername':_0x5b2efd[_0xae09('0x2b')],'UserId':_0x5b2efd['id'],'queue_name':_0x1569aa['name'],'SmsQueueId':_0x1569aa['id'],'interface':util['format'](_0xae09('0x5f'),_0xae09('0x60'),_0x5b2efd[_0xae09('0x2b')]),'penalty':0x0,'paused':_0x5b2efd[_0xae09('0x61')],'createdAt':_0x5b2efd[_0xae09('0x5e')],'updatedAt':_0x5b2efd[_0xae09('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xae09('0x27')](respondWithFilteredResult(_0x469e36,_0x3676ea))[_0xae09('0x49')](handleError(_0x469e36,null));};exports[_0xae09('0x62')]=function(_0x3d5f7a,_0xb9049a,_0x25cd72){var _0x506c1b={};var _0x42c4ad={};var _0x918c07;var _0x55b4c3;return db['SmsQueue'][_0xae09('0x56')]({'where':{'id':_0x3d5f7a[_0xae09('0x4a')]['id']}})['then'](handleEntityNotFound(_0xb9049a,null))[_0xae09('0x27')](function(_0x3865f4){if(_0x3865f4){_0x918c07=_0x3865f4;_0x42c4ad['model']=_[_0xae09('0x35')](db[_0xae09('0x63')][_0xae09('0x30')]);_0x42c4ad[_0xae09('0x34')]=_[_0xae09('0x35')](_0x3d5f7a[_0xae09('0x34')]);_0x42c4ad[_0xae09('0x36')]=_[_0xae09('0x4b')](_0x42c4ad[_0xae09('0x33')],_0x42c4ad[_0xae09('0x34')]);_0x506c1b[_0xae09('0x37')]=_[_0xae09('0x4b')](_0x42c4ad['model'],qs['fields'](_0x3d5f7a[_0xae09('0x34')][_0xae09('0x38')]));_0x506c1b[_0xae09('0x37')]=_0x506c1b[_0xae09('0x37')][_0xae09('0x39')]?_0x506c1b[_0xae09('0x37')]:_0x42c4ad['model'];_0x506c1b['order']=qs[_0xae09('0x3d')](_0x3d5f7a['query'][_0xae09('0x3d')]);_0x506c1b['where']=qs[_0xae09('0x36')](_['pick'](_0x3d5f7a[_0xae09('0x34')],_0x42c4ad[_0xae09('0x36')]));if(_0x3d5f7a['query'][_0xae09('0x40')]){_0x506c1b[_0xae09('0x3e')]=_[_0xae09('0x41')](_0x506c1b[_0xae09('0x3e')],{'$or':_[_0xae09('0x2e')](_0x506c1b['attributes'],function(_0x16c75a){var _0x1265c4={};_0x1265c4[_0x16c75a]={'$like':'%'+_0x3d5f7a['query'][_0xae09('0x40')]+'%'};return _0x1265c4;})});}_0x506c1b=_['merge']({},_0x506c1b,_0x3d5f7a[_0xae09('0x43')]);return _0x918c07[_0xae09('0x62')](_0x506c1b);}})[_0xae09('0x27')](function(_0x16aab0){if(_0x16aab0){_0x55b4c3=_0x16aab0[_0xae09('0x39')];if(!_0x3d5f7a[_0xae09('0x34')][_0xae09('0x3a')](_0xae09('0x3b'))){_0x506c1b[_0xae09('0x21')]=qs[_0xae09('0x21')](_0x3d5f7a[_0xae09('0x34')][_0xae09('0x21')]);_0x506c1b[_0xae09('0x1f')]=qs['offset'](_0x3d5f7a[_0xae09('0x34')]['offset']);}return _0x918c07['getTeams'](_0x506c1b);}})['then'](function(_0x3eac2e){if(_0x3eac2e){return _0x3eac2e?{'count':_0x55b4c3,'rows':_0x3eac2e}:null;}})[_0xae09('0x27')](respondWithResult(_0xb9049a,null))[_0xae09('0x49')](handleError(_0xb9049a,null));};exports['addTeams']=function(_0x499486,_0x382d35,_0x2c3c35){var _0xbe19=_0x499486[_0xae09('0x4d')][_0xae09('0x64')];return db[_0xae09('0x63')]['findAll']({'where':{'id':_0xbe19},'attributes':['id'],'include':[{'model':db[_0xae09('0x59')],'as':'Agents','attributes':['id',_0xae09('0x2b'),_0xae09('0x65'),_0xae09('0x66'),'interface'],'raw':!![]}]})[_0xae09('0x27')](function(_0x37a2f2){if(_0x37a2f2){var _0x193381=_[_0xae09('0x67')](_0x37a2f2,function(_0x159049){var _0x565ddd=_0x159049['get']({'plain':!![]});return _0x565ddd[_0xae09('0x68')];});return db[_0xae09('0x2f')][_0xae09('0x4c')]({'where':{'id':_0x499486['params']['id']}})[_0xae09('0x27')](function(_0x60f72){return db[_0xae09('0x69')][_0xae09('0x6a')](function(_0x2537db){return _0x60f72[_0xae09('0x6b')](_0xbe19,{'transaction':_0x2537db})[_0xae09('0x27')](function(){return BPromise[_0xae09('0x6c')](_0x193381,function(_0x464e88){return db[_0xae09('0x58')]['findOrCreate']({'where':{'UserId':_0x464e88['id'],'SmsQueueId':_0x499486['params']['id']},'transaction':_0x2537db});});})[_0xae09('0x27')](function(){_0x193381[_0xae09('0x6d')](function(_0x27172b){socket['emit']('userSmsQueue:save',{'UserId':_0x27172b['id'],'SmsQueueId':_0x60f72['id']});});});});});}})[_0xae09('0x27')](respondWithStatusCode(_0x382d35,null))[_0xae09('0x49')](handleError(_0x382d35,null));};exports['removeTeams']=function(_0x9716e8,_0x522868,_0x1ab845){return db['Team'][_0xae09('0x47')]({'where':{'id':_0x9716e8['query'][_0xae09('0x64')]},'attributes':['id'],'include':[{'model':db[_0xae09('0x59')],'as':_0xae09('0x68'),'attributes':['id'],'raw':!![]}]})[_0xae09('0x27')](handleEntityNotFound(_0x522868,null))['then'](function(_0x565055){var _0x452892=_[_0xae09('0x2e')](_0x565055,'id');var _0x5d5f50=[];var _0x3f0aad=[];var _0x59ba47=squel[_0xae09('0x6e')]();_0x59ba47[_0xae09('0x6f')](_0xae09('0x70'))[_0xae09('0x71')](_0xae09('0x72'),'tq')['join'](_0xae09('0x73'),'ut',_0xae09('0x74'))['where'](_0xae09('0x75'),_0x9716e8[_0xae09('0x4a')]['id']);for(var _0x4bd1a2=0x0;_0x4bd1a2<_0x565055['length'];_0x4bd1a2+=0x1){let _0x196395=_0x565055[_0x4bd1a2];for(var _0x33fab1=0x0;_0x33fab1<_0x196395[_0xae09('0x68')]['length'];_0x33fab1+=0x1){let _0x5b8e45=_0x196395[_0xae09('0x68')][_0x33fab1];var _0x4f7584=_0x59ba47[_0xae09('0x76')]();_0x4f7584[_0xae09('0x3e')]('ut.UserId\x20=\x20?',_0x5b8e45['id']);_0x3f0aad[_0xae09('0x77')](db[_0xae09('0x69')][_0xae09('0x34')](_0x4f7584[_0xae09('0x78')](),{'type':db['sequelize']['QueryTypes'][_0xae09('0x79')]})['then'](function(_0x4c876d){if(_0x4c876d[_0xae09('0x39')]===0x1){return _0x5b8e45['id'];}else{var _0x3fce27=_[_0xae09('0x7a')](_['map'](_0x4c876d,_0xae09('0x7b')),function(_0x262839){return _['includes'](_0x452892,_0x262839);});if(_0x3fce27){return _0x5b8e45['id'];}}}));}}return BPromise[_0xae09('0x7c')](_0x3f0aad)[_0xae09('0x27')](function(_0x3666b1){_0x5d5f50=_(_0x5d5f50)['union'](_0x3666b1)[_0xae09('0x7d')]()['value']();return db[_0xae09('0x2f')]['find']({'where':{'id':_0x9716e8['params']['id']}})[_0xae09('0x27')](function(_0x225ca3){return db[_0xae09('0x69')]['transaction'](function(_0x4e8fb4){return _0x225ca3[_0xae09('0x7e')](_0x9716e8['query'][_0xae09('0x64')],{'transaction':_0x4e8fb4})[_0xae09('0x27')](function(){if(!_['isEmpty'](_0x5d5f50)){return _0x225ca3[_0xae09('0x7f')](_0x5d5f50,{'transaction':_0x4e8fb4});}})[_0xae09('0x27')](function(){_0x5d5f50[_0xae09('0x6d')](function(_0x28abad){socket['emit'](_0xae09('0x80'),{'UserId':_0x28abad,'SmsQueueId':_0x225ca3['id']});});});});});});})[_0xae09('0x27')](respondWithStatusCode(_0x522868,null))[_0xae09('0x49')](handleError(_0x522868,null));};exports[_0xae09('0x81')]=function(_0x48c16e,_0x35d72d,_0x280fef){return db[_0xae09('0x2f')][_0xae09('0x4c')]({'where':{'id':_0x48c16e[_0xae09('0x4a')]['id']}})['then'](handleEntityNotFound(_0x35d72d,null))[_0xae09('0x27')](function(_0x578e59){if(_0x578e59){return _0x578e59['addAgents'](_0x48c16e['body'][_0xae09('0x64')],_['omit'](_0x48c16e['body'],[_0xae09('0x64'),'id'])||{})[_0xae09('0x82')](function(_0x306cf5){for(var _0x1435e7=0x0;_0x1435e7<_0x48c16e[_0xae09('0x4d')][_0xae09('0x64')][_0xae09('0x39')];_0x1435e7+=0x1){socket[_0xae09('0x83')](_0xae09('0x84'),{'UserId':Number(_0x48c16e[_0xae09('0x4d')][_0xae09('0x64')][_0x1435e7]),'SmsQueueId':Number(_0x48c16e[_0xae09('0x4a')]['id'])});}return _0x306cf5;});}})[_0xae09('0x27')](respondWithResult(_0x35d72d,null))[_0xae09('0x49')](handleError(_0x35d72d,null));};exports[_0xae09('0x7f')]=function(_0x1cae31,_0x3fb76d,_0xe93f48){return db['SmsQueue']['find']({'where':{'id':_0x1cae31[_0xae09('0x4a')]['id']}})[_0xae09('0x27')](handleEntityNotFound(_0x3fb76d,null))[_0xae09('0x27')](function(_0x300a5c){if(_0x300a5c){return _0x300a5c[_0xae09('0x7f')](_0x1cae31[_0xae09('0x34')][_0xae09('0x64')])['then'](function(){if(_['isArray'](_0x1cae31[_0xae09('0x34')][_0xae09('0x64')])){for(var _0x19e3ea=0x0;_0x19e3ea<_0x1cae31[_0xae09('0x34')][_0xae09('0x64')]['length'];_0x19e3ea+=0x1){socket[_0xae09('0x83')](_0xae09('0x80'),{'UserId':Number(_0x1cae31[_0xae09('0x34')][_0xae09('0x64')][_0x19e3ea]),'SmsQueueId':Number(_0x1cae31[_0xae09('0x4a')]['id'])});}}else{socket[_0xae09('0x83')](_0xae09('0x80'),{'UserId':Number(_0x1cae31['query'][_0xae09('0x64')]),'SmsQueueId':Number(_0x1cae31[_0xae09('0x4a')]['id'])});}});}})[_0xae09('0x27')](respondWithStatusCode(_0x3fb76d,null))[_0xae09('0x49')](handleError(_0x3fb76d,null));};exports[_0xae09('0x85')]=function(_0x47b1f9,_0x23e46e,_0x44e526){var _0x16bf05={};var _0x283d1a={};var _0x339d29;var _0x146277;return db[_0xae09('0x2f')][_0xae09('0x56')]({'where':{'id':_0x47b1f9[_0xae09('0x4a')]['id']}})[_0xae09('0x27')](handleEntityNotFound(_0x23e46e,null))[_0xae09('0x27')](function(_0x309835){if(_0x309835){_0x339d29=_0x309835;_0x283d1a['model']=_[_0xae09('0x35')](db['User'][_0xae09('0x30')]);_0x283d1a[_0xae09('0x34')]=_['keys'](_0x47b1f9[_0xae09('0x34')]);_0x283d1a[_0xae09('0x36')]=_[_0xae09('0x4b')](_0x283d1a[_0xae09('0x33')],_0x283d1a[_0xae09('0x34')]);_0x16bf05[_0xae09('0x37')]=_['intersection'](_0x283d1a['model'],qs[_0xae09('0x38')](_0x47b1f9['query']['fields']));_0x16bf05['attributes']=_0x16bf05[_0xae09('0x37')][_0xae09('0x39')]?_0x16bf05['attributes']:_0x283d1a['model'];_0x16bf05[_0xae09('0x3c')]=qs[_0xae09('0x3d')](_0x47b1f9[_0xae09('0x34')]['sort']);_0x16bf05[_0xae09('0x3e')]=qs[_0xae09('0x36')](_['pick'](_0x47b1f9[_0xae09('0x34')],_0x283d1a['filters']));if(_0x47b1f9[_0xae09('0x34')]['filter']){_0x16bf05[_0xae09('0x3e')]=_[_0xae09('0x41')](_0x16bf05['where'],{'$or':_[_0xae09('0x2e')](_0x16bf05[_0xae09('0x37')],function(_0x44ec5c){var _0x4011ec={};_0x4011ec[_0x44ec5c]={'$like':'%'+_0x47b1f9[_0xae09('0x34')]['filter']+'%'};return _0x4011ec;})});}_0x16bf05=_[_0xae09('0x41')]({},_0x16bf05,_0x47b1f9[_0xae09('0x43')]);return _0x339d29['getAgents'](_0x16bf05);}})[_0xae09('0x27')](function(_0x4a88e6){if(_0x4a88e6){_0x146277=_0x4a88e6[_0xae09('0x39')];if(!_0x47b1f9[_0xae09('0x34')]['hasOwnProperty'](_0xae09('0x3b'))){_0x16bf05[_0xae09('0x21')]=qs[_0xae09('0x21')](_0x47b1f9[_0xae09('0x34')][_0xae09('0x21')]);_0x16bf05[_0xae09('0x1f')]=qs['offset'](_0x47b1f9['query']['offset']);}return _0x339d29['getAgents'](_0x16bf05);}})[_0xae09('0x27')](function(_0x4fa968){if(_0x4fa968){return _0x4fa968?{'count':_0x146277,'rows':_0x4fa968}:null;}})[_0xae09('0x27')](respondWithResult(_0x23e46e,null))[_0xae09('0x49')](handleError(_0x23e46e,null));}; \ No newline at end of file +var _0xa671=['get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','describe','getMembers','UserSmsQueue','length','SmsQueueId','User','UserId','smsPause','updatedAt','createdAt','SIP','getTeams','findOne','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','emit','userSmsQueue:save','removeTeams','Team','select','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','all','union','value','transaction','isEmpty','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./smsQueue.socket','register','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','SmsQueues','UserProfileResource','end','sendStatus','error','name','send','index','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','SmsQueue','findAll','rows','catch','show','params','create','body'];(function(_0x47b8bd,_0x43d93a){var _0x5022da=function(_0x362b45){while(--_0x362b45){_0x47b8bd['push'](_0x47b8bd['shift']());}};_0x5022da(++_0x43d93a);}(_0xa671,0x153));var _0x1a67=function(_0x1d524d,_0x3cdf11){_0x1d524d=_0x1d524d-0x0;var _0x552dfb=_0xa671[_0x1d524d];return _0x552dfb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1a67('0x0'));var zipdir=require(_0x1a67('0x1'));var jsonpatch=require(_0x1a67('0x2'));var rp=require(_0x1a67('0x3'));var moment=require(_0x1a67('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1a67('0x5'));var util=require(_0x1a67('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x1a67('0x7'));var ejs=require(_0x1a67('0x8'));var fs=require('fs');var fs_extra=require(_0x1a67('0x9'));var _=require(_0x1a67('0xa'));var squel=require(_0x1a67('0xb'));var crypto=require(_0x1a67('0xc'));var jsforce=require(_0x1a67('0xd'));var deskjs=require(_0x1a67('0xe'));var toCsv=require(_0x1a67('0x7'));var querystring=require('querystring');var Papa=require(_0x1a67('0xf'));var Redis=require(_0x1a67('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1a67('0x11'));var as=require(_0x1a67('0x12'));var hardwareService=require(_0x1a67('0x13'));var logger=require(_0x1a67('0x14'))('api');var utils=require(_0x1a67('0x15'));var config=require(_0x1a67('0x16'));var licenseUtil=require(_0x1a67('0x17'));var db=require('../../mysqldb')['db'];config[_0x1a67('0x18')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1a67('0x19'))(new Redis(config[_0x1a67('0x18')]));require(_0x1a67('0x1a'))[_0x1a67('0x1b')](socket);function respondWithStatusCode(_0x1d4294,_0x1e69f6){_0x1e69f6=_0x1e69f6||0xcc;return function(_0x220a46){if(_0x220a46){return _0x1d4294['sendStatus'](_0x1e69f6);}return _0x1d4294[_0x1a67('0x1c')](_0x1e69f6)['end']();};}function respondWithResult(_0x23f20e,_0x5b1957){_0x5b1957=_0x5b1957||0xc8;return function(_0x411d1b){if(_0x411d1b){return _0x23f20e['status'](_0x5b1957)[_0x1a67('0x1d')](_0x411d1b);}};}function respondWithFilteredResult(_0x1fb246,_0x2f12e7){return function(_0x32019a){if(_0x32019a){var _0x2f0e4d=typeof _0x2f12e7[_0x1a67('0x1e')]==='undefined'&&typeof _0x2f12e7[_0x1a67('0x1f')]===_0x1a67('0x20');var _0x347e40=_0x32019a['count'];var _0x258146=_0x2f0e4d?0x0:_0x2f12e7[_0x1a67('0x1e')];var _0x1baf8f=_0x2f0e4d?_0x32019a[_0x1a67('0x21')]:_0x2f12e7['offset']+_0x2f12e7[_0x1a67('0x1f')];var _0x5290d1;if(_0x1baf8f>=_0x347e40){_0x1baf8f=_0x347e40;_0x5290d1=0xc8;}else{_0x5290d1=0xce;}_0x1fb246['status'](_0x5290d1);return _0x1fb246['set'](_0x1a67('0x22'),_0x258146+'-'+_0x1baf8f+'/'+_0x347e40)[_0x1a67('0x1d')](_0x32019a);}return null;};}function patchUpdates(_0x4e119a){return function(_0x3b2047){try{jsonpatch[_0x1a67('0x23')](_0x3b2047,_0x4e119a,!![]);}catch(_0x39d2a0){return BPromise[_0x1a67('0x24')](_0x39d2a0);}return _0x3b2047[_0x1a67('0x25')]();};}function saveUpdates(_0x3d07aa,_0x4e0164){return function(_0x3eb054){if(_0x3eb054){return _0x3eb054[_0x1a67('0x26')](_0x3d07aa)[_0x1a67('0x27')](function(_0x113beb){return _0x113beb;});}return null;};}function removeEntity(_0x5b4239,_0x19e145){return function(_0x213825){if(_0x213825){return _0x213825[_0x1a67('0x28')]()[_0x1a67('0x27')](function(){var _0xdd4929=_0x213825['get']({'plain':!![]});var _0x3b7a16=_0x1a67('0x29');return db[_0x1a67('0x2a')][_0x1a67('0x28')]({'where':{'type':_0x3b7a16,'resourceId':_0xdd4929['id']}})[_0x1a67('0x27')](function(){return _0x213825;});})[_0x1a67('0x27')](function(){_0x5b4239[_0x1a67('0x1c')](0xcc)[_0x1a67('0x2b')]();});}};}function handleEntityNotFound(_0x62e27,_0x2d9ea9){return function(_0x474e07){if(!_0x474e07){_0x62e27[_0x1a67('0x2c')](0x194);}return _0x474e07;};}function handleError(_0xe5b0da,_0x79bbbc){_0x79bbbc=_0x79bbbc||0x1f4;return function(_0x230adc){logger[_0x1a67('0x2d')](_0x230adc['stack']);if(_0x230adc[_0x1a67('0x2e')]){delete _0x230adc['name'];}_0xe5b0da[_0x1a67('0x1c')](_0x79bbbc)[_0x1a67('0x2f')](_0x230adc);};}exports[_0x1a67('0x30')]=function(_0x5b6eb9,_0x5a1475){var _0x26b0d2={},_0x51aafd={},_0x3fd7b0={'count':0x0,'rows':[]};var _0x19292d=_['map'](db['SmsQueue'][_0x1a67('0x31')],function(_0x302027){return{'name':_0x302027['fieldName'],'type':_0x302027[_0x1a67('0x32')][_0x1a67('0x33')]};});_0x51aafd[_0x1a67('0x34')]=_['map'](_0x19292d,_0x1a67('0x2e'));_0x51aafd[_0x1a67('0x35')]=_[_0x1a67('0x36')](_0x5b6eb9[_0x1a67('0x35')]);_0x51aafd['filters']=_[_0x1a67('0x37')](_0x51aafd['model'],_0x51aafd[_0x1a67('0x35')]);_0x26b0d2['attributes']=_[_0x1a67('0x37')](_0x51aafd[_0x1a67('0x34')],qs[_0x1a67('0x38')](_0x5b6eb9[_0x1a67('0x35')][_0x1a67('0x38')]));_0x26b0d2['attributes']=_0x26b0d2[_0x1a67('0x39')]['length']?_0x26b0d2['attributes']:_0x51aafd['model'];if(!_0x5b6eb9[_0x1a67('0x35')][_0x1a67('0x3a')](_0x1a67('0x3b'))){_0x26b0d2[_0x1a67('0x1f')]=qs['limit'](_0x5b6eb9[_0x1a67('0x35')]['limit']);_0x26b0d2[_0x1a67('0x1e')]=qs[_0x1a67('0x1e')](_0x5b6eb9[_0x1a67('0x35')]['offset']);}_0x26b0d2[_0x1a67('0x3c')]=qs[_0x1a67('0x3d')](_0x5b6eb9[_0x1a67('0x35')][_0x1a67('0x3d')]);_0x26b0d2[_0x1a67('0x3e')]=qs[_0x1a67('0x3f')](_[_0x1a67('0x40')](_0x5b6eb9['query'],_0x51aafd['filters']),_0x19292d);if(_0x5b6eb9[_0x1a67('0x35')][_0x1a67('0x41')]){_0x26b0d2[_0x1a67('0x3e')]=_[_0x1a67('0x42')](_0x26b0d2['where'],{'$or':_[_0x1a67('0x43')](_0x19292d,function(_0x334e60){if(_0x334e60[_0x1a67('0x32')]!==_0x1a67('0x44')){var _0x38cb1e={};_0x38cb1e[_0x334e60['name']]={'$like':'%'+_0x5b6eb9[_0x1a67('0x35')][_0x1a67('0x41')]+'%'};return _0x38cb1e;}})});}_0x26b0d2=_['merge']({},_0x26b0d2,_0x5b6eb9[_0x1a67('0x45')]);var _0x335d2d={'where':_0x26b0d2[_0x1a67('0x3e')]};return db[_0x1a67('0x46')][_0x1a67('0x21')](_0x335d2d)['then'](function(_0x360bb1){_0x3fd7b0[_0x1a67('0x21')]=_0x360bb1;if(_0x5b6eb9[_0x1a67('0x35')]['includeAll']){_0x26b0d2['include']=[{'all':!![]}];}return db['SmsQueue'][_0x1a67('0x47')](_0x26b0d2);})[_0x1a67('0x27')](function(_0x117489){_0x3fd7b0[_0x1a67('0x48')]=_0x117489;return _0x3fd7b0;})[_0x1a67('0x27')](respondWithFilteredResult(_0x5a1475,_0x26b0d2))[_0x1a67('0x49')](handleError(_0x5a1475,null));};exports[_0x1a67('0x4a')]=function(_0x52c87e,_0x3e2304){var _0x9d5d60={'raw':!![],'where':{'id':_0x52c87e[_0x1a67('0x4b')]['id']}},_0x4984f5={};_0x4984f5[_0x1a67('0x34')]=_[_0x1a67('0x36')](db[_0x1a67('0x46')][_0x1a67('0x31')]);_0x4984f5['query']=_['keys'](_0x52c87e[_0x1a67('0x35')]);_0x4984f5[_0x1a67('0x3f')]=_[_0x1a67('0x37')](_0x4984f5[_0x1a67('0x34')],_0x4984f5['query']);_0x9d5d60[_0x1a67('0x39')]=_[_0x1a67('0x37')](_0x4984f5[_0x1a67('0x34')],qs[_0x1a67('0x38')](_0x52c87e[_0x1a67('0x35')][_0x1a67('0x38')]));_0x9d5d60[_0x1a67('0x39')]=_0x9d5d60[_0x1a67('0x39')]['length']?_0x9d5d60[_0x1a67('0x39')]:_0x4984f5[_0x1a67('0x34')];if(_0x52c87e[_0x1a67('0x35')]['includeAll']){_0x9d5d60['include']=[{'all':!![]}];}_0x9d5d60=_[_0x1a67('0x42')]({},_0x9d5d60,_0x52c87e[_0x1a67('0x45')]);return db[_0x1a67('0x46')]['find'](_0x9d5d60)[_0x1a67('0x27')](handleEntityNotFound(_0x3e2304,null))[_0x1a67('0x27')](respondWithResult(_0x3e2304,null))[_0x1a67('0x49')](handleError(_0x3e2304,null));};exports[_0x1a67('0x4c')]=function(_0x2aceff,_0x93cba4){return db['SmsQueue'][_0x1a67('0x4c')](_0x2aceff[_0x1a67('0x4d')],{})[_0x1a67('0x27')](function(_0x4edaa){var _0x5c8712=_0x2aceff['user'][_0x1a67('0x4e')]({'plain':!![]});if(!_0x5c8712)throw new Error(_0x1a67('0x4f'));if(_0x5c8712[_0x1a67('0x50')]===_0x1a67('0x51')){var _0x13f9c2=_0x4edaa[_0x1a67('0x4e')]({'plain':!![]});var _0xf55168=_0x1a67('0x29');return db[_0x1a67('0x52')][_0x1a67('0x53')]({'where':{'name':_0xf55168,'userProfileId':_0x5c8712['userProfileId']},'raw':!![]})[_0x1a67('0x27')](function(_0x16377d){if(_0x16377d&&_0x16377d[_0x1a67('0x54')]===0x0){return db[_0x1a67('0x2a')]['create']({'name':_0x13f9c2['name'],'resourceId':_0x13f9c2['id'],'type':_0x16377d[_0x1a67('0x2e')],'sectionId':_0x16377d['id']},{})[_0x1a67('0x27')](function(){return _0x4edaa;});}else{return _0x4edaa;}})[_0x1a67('0x49')](function(_0x96146f){logger[_0x1a67('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x96146f);throw _0x96146f;});}return _0x4edaa;})[_0x1a67('0x27')](respondWithResult(_0x93cba4,0xc9))['catch'](handleError(_0x93cba4,null));};exports[_0x1a67('0x26')]=function(_0x2f9821,_0x33da94){if(_0x2f9821[_0x1a67('0x4d')]['id']){delete _0x2f9821['body']['id'];}return db['SmsQueue']['find']({'where':{'id':_0x2f9821['params']['id']}})[_0x1a67('0x27')](handleEntityNotFound(_0x33da94,null))[_0x1a67('0x27')](saveUpdates(_0x2f9821[_0x1a67('0x4d')],null))[_0x1a67('0x27')](respondWithResult(_0x33da94,null))[_0x1a67('0x49')](handleError(_0x33da94,null));};exports[_0x1a67('0x28')]=function(_0x46de77,_0x43b4f1){return db[_0x1a67('0x46')]['find']({'where':{'id':_0x46de77['params']['id']}})['then'](handleEntityNotFound(_0x43b4f1,null))[_0x1a67('0x27')](removeEntity(_0x43b4f1,null))[_0x1a67('0x49')](handleError(_0x43b4f1,null));};exports[_0x1a67('0x55')]=function(_0x340c0d,_0x1a092b){return db[_0x1a67('0x46')]['describe']()[_0x1a67('0x27')](respondWithResult(_0x1a092b,null))['catch'](handleError(_0x1a092b,null));};exports[_0x1a67('0x56')]=function(_0x9cf5a2,_0x4c3f85,_0x58105b){var _0xd07e8a={'raw':!![],'where':{}},_0x12a6e4={},_0x333dcc;return db['SmsQueue']['findOne']({'where':{'id':_0x9cf5a2[_0x1a67('0x4b')]['id']}})[_0x1a67('0x27')](handleEntityNotFound(_0x4c3f85,null))[_0x1a67('0x27')](function(_0x4aa98c){if(_0x4aa98c){_0x333dcc=_0x4aa98c[_0x1a67('0x4e')]({'plain':!![]});_0x12a6e4[_0x1a67('0x34')]=_['keys'](db[_0x1a67('0x57')][_0x1a67('0x31')]);_0x12a6e4[_0x1a67('0x35')]=_[_0x1a67('0x36')](_0x9cf5a2[_0x1a67('0x35')]);_0x12a6e4[_0x1a67('0x3f')]=_[_0x1a67('0x37')](_0x12a6e4[_0x1a67('0x34')],_0x12a6e4[_0x1a67('0x35')]);_0xd07e8a[_0x1a67('0x39')]=_[_0x1a67('0x37')](_0x12a6e4[_0x1a67('0x34')],qs[_0x1a67('0x38')](_0x9cf5a2[_0x1a67('0x35')][_0x1a67('0x38')]));_0xd07e8a[_0x1a67('0x39')]=_0xd07e8a['attributes'][_0x1a67('0x58')]?_0xd07e8a[_0x1a67('0x39')]:_0x12a6e4[_0x1a67('0x34')];if(!_0x9cf5a2[_0x1a67('0x35')][_0x1a67('0x3a')]('nolimit')){_0xd07e8a[_0x1a67('0x1f')]=qs[_0x1a67('0x1f')](_0x9cf5a2[_0x1a67('0x35')]['limit']);_0xd07e8a[_0x1a67('0x1e')]=qs[_0x1a67('0x1e')](_0x9cf5a2[_0x1a67('0x35')]['offset']);}_0xd07e8a[_0x1a67('0x3c')]=qs[_0x1a67('0x3d')](_0x9cf5a2[_0x1a67('0x35')][_0x1a67('0x3d')]);_0xd07e8a[_0x1a67('0x3e')]=qs['filters'](_[_0x1a67('0x40')](_0x9cf5a2[_0x1a67('0x35')],_0x12a6e4[_0x1a67('0x3f')]));_0xd07e8a[_0x1a67('0x3e')][_0x1a67('0x59')]=_0x4aa98c['id'];if(_0x9cf5a2[_0x1a67('0x35')][_0x1a67('0x41')]){_0xd07e8a['where']=_[_0x1a67('0x42')](_0xd07e8a['where'],{'$or':_['map'](_0xd07e8a['attributes'],function(_0x447e29){var _0x381065={};_0x381065[_0x447e29]={'$like':'%'+_0x9cf5a2['query'][_0x1a67('0x41')]+'%'};return _0x381065;})});}_0xd07e8a=_[_0x1a67('0x42')]({},_0xd07e8a,_0x9cf5a2[_0x1a67('0x45')]);return db[_0x1a67('0x57')][_0x1a67('0x47')](_0xd07e8a);}})[_0x1a67('0x27')](function(_0x484109){if(_0x484109){return db[_0x1a67('0x5a')]['findAndCountAll']({'where':{'id':_[_0x1a67('0x43')](_0x484109,_0x1a67('0x5b')),'role':'agent'},'attributes':['id',_0x1a67('0x2e'),_0x1a67('0x5c'),_0x1a67('0x5d'),_0x1a67('0x5e')]});}})[_0x1a67('0x27')](function(_0x10f0cf){if(_0x10f0cf){return{'count':_0x10f0cf['count'],'rows':_[_0x1a67('0x43')](_0x10f0cf[_0x1a67('0x48')],function(_0x47a842){return{'membername':_0x47a842['name'],'UserId':_0x47a842['id'],'queue_name':_0x333dcc[_0x1a67('0x2e')],'SmsQueueId':_0x333dcc['id'],'interface':util['format']('%s/%s',_0x1a67('0x5f'),_0x47a842[_0x1a67('0x2e')]),'penalty':0x0,'paused':_0x47a842['smsPause'],'createdAt':_0x47a842['createdAt'],'updatedAt':_0x47a842[_0x1a67('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1a67('0x27')](respondWithFilteredResult(_0x4c3f85,_0xd07e8a))[_0x1a67('0x49')](handleError(_0x4c3f85,null));};exports[_0x1a67('0x60')]=function(_0x33b5de,_0x2c3670,_0xadb5f){var _0x33bc35={};var _0x2f791d={};var _0x53b6f7;var _0x5a2a15;return db[_0x1a67('0x46')][_0x1a67('0x61')]({'where':{'id':_0x33b5de['params']['id']}})[_0x1a67('0x27')](handleEntityNotFound(_0x2c3670,null))[_0x1a67('0x27')](function(_0x2c6edc){if(_0x2c6edc){_0x53b6f7=_0x2c6edc;_0x2f791d[_0x1a67('0x34')]=_['keys'](db['Team'][_0x1a67('0x31')]);_0x2f791d[_0x1a67('0x35')]=_['keys'](_0x33b5de['query']);_0x2f791d[_0x1a67('0x3f')]=_[_0x1a67('0x37')](_0x2f791d[_0x1a67('0x34')],_0x2f791d['query']);_0x33bc35[_0x1a67('0x39')]=_[_0x1a67('0x37')](_0x2f791d[_0x1a67('0x34')],qs['fields'](_0x33b5de[_0x1a67('0x35')][_0x1a67('0x38')]));_0x33bc35[_0x1a67('0x39')]=_0x33bc35['attributes'][_0x1a67('0x58')]?_0x33bc35[_0x1a67('0x39')]:_0x2f791d[_0x1a67('0x34')];_0x33bc35['order']=qs['sort'](_0x33b5de[_0x1a67('0x35')][_0x1a67('0x3d')]);_0x33bc35[_0x1a67('0x3e')]=qs[_0x1a67('0x3f')](_[_0x1a67('0x40')](_0x33b5de[_0x1a67('0x35')],_0x2f791d[_0x1a67('0x3f')]));if(_0x33b5de['query'][_0x1a67('0x41')]){_0x33bc35[_0x1a67('0x3e')]=_['merge'](_0x33bc35[_0x1a67('0x3e')],{'$or':_[_0x1a67('0x43')](_0x33bc35[_0x1a67('0x39')],function(_0x3e742d){var _0x406da9={};_0x406da9[_0x3e742d]={'$like':'%'+_0x33b5de[_0x1a67('0x35')][_0x1a67('0x41')]+'%'};return _0x406da9;})});}_0x33bc35=_[_0x1a67('0x42')]({},_0x33bc35,_0x33b5de[_0x1a67('0x45')]);return _0x53b6f7['getTeams'](_0x33bc35);}})['then'](function(_0x2ae026){if(_0x2ae026){_0x5a2a15=_0x2ae026[_0x1a67('0x58')];if(!_0x33b5de['query'][_0x1a67('0x3a')]('nolimit')){_0x33bc35[_0x1a67('0x1f')]=qs[_0x1a67('0x1f')](_0x33b5de[_0x1a67('0x35')][_0x1a67('0x1f')]);_0x33bc35[_0x1a67('0x1e')]=qs['offset'](_0x33b5de[_0x1a67('0x35')][_0x1a67('0x1e')]);}return _0x53b6f7[_0x1a67('0x60')](_0x33bc35);}})['then'](function(_0x21e20a){if(_0x21e20a){return _0x21e20a?{'count':_0x5a2a15,'rows':_0x21e20a}:null;}})['then'](respondWithResult(_0x2c3670,null))['catch'](handleError(_0x2c3670,null));};exports[_0x1a67('0x62')]=function(_0xaee5b2,_0x37fe11,_0x5e0183){var _0x326466=_0xaee5b2[_0x1a67('0x4d')][_0x1a67('0x63')];return db['Team']['findAll']({'where':{'id':_0x326466},'attributes':['id'],'include':[{'model':db[_0x1a67('0x5a')],'as':_0x1a67('0x64'),'attributes':['id',_0x1a67('0x2e'),_0x1a67('0x65'),_0x1a67('0x66'),_0x1a67('0x67')],'raw':!![]}]})[_0x1a67('0x27')](function(_0xa2ead9){if(_0xa2ead9){var _0x3d3454=_[_0x1a67('0x68')](_0xa2ead9,function(_0x484a56){var _0x5dd3d2=_0x484a56[_0x1a67('0x4e')]({'plain':!![]});return _0x5dd3d2[_0x1a67('0x64')];});return db[_0x1a67('0x46')][_0x1a67('0x53')]({'where':{'id':_0xaee5b2[_0x1a67('0x4b')]['id']}})[_0x1a67('0x27')](function(_0x3667a0){return db[_0x1a67('0x69')]['transaction'](function(_0x1f8aee){return _0x3667a0[_0x1a67('0x62')](_0x326466,{'transaction':_0x1f8aee})[_0x1a67('0x27')](function(){return BPromise[_0x1a67('0x6a')](_0x3d3454,function(_0x46facc){return db['UserSmsQueue'][_0x1a67('0x6b')]({'where':{'UserId':_0x46facc['id'],'SmsQueueId':_0xaee5b2[_0x1a67('0x4b')]['id']},'transaction':_0x1f8aee});});})['then'](function(){_0x3d3454['forEach'](function(_0x1db76c){socket[_0x1a67('0x6c')](_0x1a67('0x6d'),{'UserId':_0x1db76c['id'],'SmsQueueId':_0x3667a0['id']});});});});});}})[_0x1a67('0x27')](respondWithStatusCode(_0x37fe11,null))[_0x1a67('0x49')](handleError(_0x37fe11,null));};exports[_0x1a67('0x6e')]=function(_0x13cf17,_0x12bf18,_0x564d66){return db[_0x1a67('0x6f')]['findAll']({'where':{'id':_0x13cf17[_0x1a67('0x35')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1a67('0x64'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x12bf18,null))[_0x1a67('0x27')](function(_0x3e447b){var _0x4410a9=_[_0x1a67('0x43')](_0x3e447b,'id');var _0x41ff70=[];var _0x451372=[];var _0x48a907=squel[_0x1a67('0x70')]();_0x48a907[_0x1a67('0x71')](_0x1a67('0x72'))['from']('team_has_sms_queues','tq')[_0x1a67('0x73')](_0x1a67('0x74'),'ut',_0x1a67('0x75'))[_0x1a67('0x3e')](_0x1a67('0x76'),_0x13cf17[_0x1a67('0x4b')]['id']);for(var _0x4b6804=0x0;_0x4b6804<_0x3e447b[_0x1a67('0x58')];_0x4b6804+=0x1){let _0x1bab3a=_0x3e447b[_0x4b6804];for(var _0x3b9ecc=0x0;_0x3b9ecc<_0x1bab3a['Agents'][_0x1a67('0x58')];_0x3b9ecc+=0x1){let _0x16c6b2=_0x1bab3a[_0x1a67('0x64')][_0x3b9ecc];var _0x37b477=_0x48a907[_0x1a67('0x77')]();_0x37b477[_0x1a67('0x3e')](_0x1a67('0x78'),_0x16c6b2['id']);_0x451372[_0x1a67('0x79')](db[_0x1a67('0x69')][_0x1a67('0x35')](_0x37b477[_0x1a67('0x7a')](),{'type':db[_0x1a67('0x69')]['QueryTypes'][_0x1a67('0x7b')]})[_0x1a67('0x27')](function(_0x2991ba){if(_0x2991ba[_0x1a67('0x58')]===0x1){return _0x16c6b2['id'];}else{var _0x5e0407=_[_0x1a67('0x7c')](_[_0x1a67('0x43')](_0x2991ba,_0x1a67('0x7d')),function(_0x1477aa){return _['includes'](_0x4410a9,_0x1477aa);});if(_0x5e0407){return _0x16c6b2['id'];}}}));}}return BPromise[_0x1a67('0x7e')](_0x451372)[_0x1a67('0x27')](function(_0x4a9a36){_0x41ff70=_(_0x41ff70)[_0x1a67('0x7f')](_0x4a9a36)['compact']()[_0x1a67('0x80')]();return db['SmsQueue'][_0x1a67('0x53')]({'where':{'id':_0x13cf17[_0x1a67('0x4b')]['id']}})['then'](function(_0x5693fe){return db['sequelize'][_0x1a67('0x81')](function(_0x565394){return _0x5693fe[_0x1a67('0x6e')](_0x13cf17[_0x1a67('0x35')][_0x1a67('0x63')],{'transaction':_0x565394})[_0x1a67('0x27')](function(){if(!_[_0x1a67('0x82')](_0x41ff70)){return _0x5693fe[_0x1a67('0x83')](_0x41ff70,{'transaction':_0x565394});}})[_0x1a67('0x27')](function(){_0x41ff70[_0x1a67('0x84')](function(_0x3ba0f7){socket[_0x1a67('0x6c')](_0x1a67('0x85'),{'UserId':_0x3ba0f7,'SmsQueueId':_0x5693fe['id']});});});});});});})[_0x1a67('0x27')](respondWithStatusCode(_0x12bf18,null))['catch'](handleError(_0x12bf18,null));};exports['addAgents']=function(_0x3552b1,_0x9de296,_0x148b36){return db['SmsQueue'][_0x1a67('0x53')]({'where':{'id':_0x3552b1[_0x1a67('0x4b')]['id']}})[_0x1a67('0x27')](handleEntityNotFound(_0x9de296,null))[_0x1a67('0x27')](function(_0x1c8714){if(_0x1c8714){return _0x1c8714[_0x1a67('0x86')](_0x3552b1[_0x1a67('0x4d')]['ids'],_[_0x1a67('0x87')](_0x3552b1[_0x1a67('0x4d')],['ids','id'])||{})[_0x1a67('0x88')](function(_0x43defa){for(var _0x336945=0x0;_0x336945<_0x3552b1[_0x1a67('0x4d')][_0x1a67('0x63')][_0x1a67('0x58')];_0x336945+=0x1){socket[_0x1a67('0x6c')](_0x1a67('0x6d'),{'UserId':Number(_0x3552b1['body']['ids'][_0x336945]),'SmsQueueId':Number(_0x3552b1[_0x1a67('0x4b')]['id'])});}return _0x43defa;});}})[_0x1a67('0x27')](respondWithResult(_0x9de296,null))[_0x1a67('0x49')](handleError(_0x9de296,null));};exports['removeAgents']=function(_0xe81592,_0x156930,_0x3855cb){return db['SmsQueue'][_0x1a67('0x53')]({'where':{'id':_0xe81592['params']['id']}})[_0x1a67('0x27')](handleEntityNotFound(_0x156930,null))[_0x1a67('0x27')](function(_0x4aabdb){if(_0x4aabdb){return _0x4aabdb[_0x1a67('0x83')](_0xe81592[_0x1a67('0x35')][_0x1a67('0x63')])[_0x1a67('0x27')](function(){if(_[_0x1a67('0x89')](_0xe81592[_0x1a67('0x35')][_0x1a67('0x63')])){for(var _0x2c974d=0x0;_0x2c974d<_0xe81592[_0x1a67('0x35')]['ids'][_0x1a67('0x58')];_0x2c974d+=0x1){socket['emit'](_0x1a67('0x85'),{'UserId':Number(_0xe81592[_0x1a67('0x35')][_0x1a67('0x63')][_0x2c974d]),'SmsQueueId':Number(_0xe81592['params']['id'])});}}else{socket[_0x1a67('0x6c')](_0x1a67('0x85'),{'UserId':Number(_0xe81592['query'][_0x1a67('0x63')]),'SmsQueueId':Number(_0xe81592[_0x1a67('0x4b')]['id'])});}});}})[_0x1a67('0x27')](respondWithStatusCode(_0x156930,null))[_0x1a67('0x49')](handleError(_0x156930,null));};exports[_0x1a67('0x8a')]=function(_0x4708cb,_0x206d1e,_0x5ee39d){var _0x4011da={};var _0x343a48={};var _0x32b4e5;var _0x588e32;return db[_0x1a67('0x46')][_0x1a67('0x61')]({'where':{'id':_0x4708cb[_0x1a67('0x4b')]['id']}})['then'](handleEntityNotFound(_0x206d1e,null))[_0x1a67('0x27')](function(_0xab9514){if(_0xab9514){_0x32b4e5=_0xab9514;_0x343a48['model']=_[_0x1a67('0x36')](db['User'][_0x1a67('0x31')]);_0x343a48[_0x1a67('0x35')]=_[_0x1a67('0x36')](_0x4708cb['query']);_0x343a48[_0x1a67('0x3f')]=_[_0x1a67('0x37')](_0x343a48[_0x1a67('0x34')],_0x343a48['query']);_0x4011da[_0x1a67('0x39')]=_[_0x1a67('0x37')](_0x343a48[_0x1a67('0x34')],qs[_0x1a67('0x38')](_0x4708cb[_0x1a67('0x35')][_0x1a67('0x38')]));_0x4011da[_0x1a67('0x39')]=_0x4011da[_0x1a67('0x39')][_0x1a67('0x58')]?_0x4011da['attributes']:_0x343a48[_0x1a67('0x34')];_0x4011da['order']=qs['sort'](_0x4708cb[_0x1a67('0x35')][_0x1a67('0x3d')]);_0x4011da[_0x1a67('0x3e')]=qs['filters'](_[_0x1a67('0x40')](_0x4708cb[_0x1a67('0x35')],_0x343a48[_0x1a67('0x3f')]));if(_0x4708cb[_0x1a67('0x35')]['filter']){_0x4011da[_0x1a67('0x3e')]=_[_0x1a67('0x42')](_0x4011da['where'],{'$or':_[_0x1a67('0x43')](_0x4011da[_0x1a67('0x39')],function(_0xd135c9){var _0x21a5c1={};_0x21a5c1[_0xd135c9]={'$like':'%'+_0x4708cb[_0x1a67('0x35')][_0x1a67('0x41')]+'%'};return _0x21a5c1;})});}_0x4011da=_[_0x1a67('0x42')]({},_0x4011da,_0x4708cb[_0x1a67('0x45')]);return _0x32b4e5['getAgents'](_0x4011da);}})[_0x1a67('0x27')](function(_0x13eaf0){if(_0x13eaf0){_0x588e32=_0x13eaf0[_0x1a67('0x58')];if(!_0x4708cb['query'][_0x1a67('0x3a')](_0x1a67('0x3b'))){_0x4011da[_0x1a67('0x1f')]=qs['limit'](_0x4708cb[_0x1a67('0x35')][_0x1a67('0x1f')]);_0x4011da[_0x1a67('0x1e')]=qs[_0x1a67('0x1e')](_0x4708cb[_0x1a67('0x35')][_0x1a67('0x1e')]);}return _0x32b4e5[_0x1a67('0x8a')](_0x4011da);}})['then'](function(_0x12b1e5){if(_0x12b1e5){return _0x12b1e5?{'count':_0x588e32,'rows':_0x12b1e5}:null;}})[_0x1a67('0x27')](respondWithResult(_0x206d1e,null))[_0x1a67('0x49')](handleError(_0x206d1e,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 25a1257..e75c5e4 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 _0xea33=['events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove','emit','exports'];(function(_0x49792e,_0x12a227){var _0x52425a=function(_0x1904f0){while(--_0x1904f0){_0x49792e['push'](_0x49792e['shift']());}};_0x52425a(++_0x12a227);}(_0xea33,0x13b));var _0x3ea3=function(_0x2605dc,_0x50cf7e){_0x2605dc=_0x2605dc-0x0;var _0x4568c9=_0xea33[_0x2605dc];return _0x4568c9;};'use strict';var EventEmitter=require(_0x3ea3('0x0'));var SmsQueue=require(_0x3ea3('0x1'))['db'][_0x3ea3('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x3ea3('0x3')](0x0);var events={'afterCreate':_0x3ea3('0x4'),'afterUpdate':_0x3ea3('0x5'),'afterDestroy':_0x3ea3('0x6')};function emitEvent(_0x2a07de){return function(_0x10d3fe,_0x155e57,_0x399f48){SmsQueueEvents[_0x3ea3('0x7')](_0x2a07de+':'+_0x10d3fe['id'],_0x10d3fe);SmsQueueEvents[_0x3ea3('0x7')](_0x2a07de,_0x10d3fe);_0x399f48(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x3ea3('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0x5e75=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','remove','emit'];(function(_0xb31f13,_0x5beeb0){var _0x1b601c=function(_0x5f4041){while(--_0x5f4041){_0xb31f13['push'](_0xb31f13['shift']());}};_0x1b601c(++_0x5beeb0);}(_0x5e75,0xcb));var _0x55e7=function(_0x4d56e1,_0x32816e){_0x4d56e1=_0x4d56e1-0x0;var _0x281c2b=_0x5e75[_0x4d56e1];return _0x281c2b;};'use strict';var EventEmitter=require(_0x55e7('0x0'));var SmsQueue=require(_0x55e7('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x55e7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x55e7('0x3')};function emitEvent(_0x15709a){return function(_0x2a94c7,_0x3d0fb0,_0x85a16){SmsQueueEvents['emit'](_0x15709a+':'+_0x2a94c7['id'],_0x2a94c7);SmsQueueEvents[_0x55e7('0x4')](_0x15709a,_0x2a94c7);_0x85a16(null);};}for(var e in events){if(events[_0x55e7('0x5')](e)){var event=events[e];SmsQueue[_0x55e7('0x6')](e,emitEvent(event));}}module[_0x55e7('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 8029348..1da9388 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 _0x061e=['../../config/environment','./smsQueue.attributes','exports','define','sms_queues','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x1c0930,_0x5495ad){var _0x7ce376=function(_0x2a26f0){while(--_0x2a26f0){_0x1c0930['push'](_0x1c0930['shift']());}};_0x7ce376(++_0x5495ad);}(_0x061e,0x1b5));var _0xe061=function(_0xd090d7,_0x547b36){_0xd090d7=_0xd090d7-0x0;var _0x3fd9e8=_0x061e[_0xd090d7];return _0x3fd9e8;};'use strict';var _=require(_0xe061('0x0'));var util=require(_0xe061('0x1'));var logger=require(_0xe061('0x2'))(_0xe061('0x3'));var moment=require(_0xe061('0x4'));var BPromise=require(_0xe061('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe061('0x6'));var config=require(_0xe061('0x7'));var attributes=require(_0xe061('0x8'));module[_0xe061('0x9')]=function(_0xdba14d,_0x163e91){return _0xdba14d[_0xe061('0xa')]('SmsQueue',attributes,{'tableName':_0xe061('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8bb3=['util','../../config/logger','api','moment','bluebird','path','rimraf','./smsQueue.attributes','exports','define','lodash'];(function(_0x412405,_0x77dd05){var _0x889e80=function(_0x328a35){while(--_0x328a35){_0x412405['push'](_0x412405['shift']());}};_0x889e80(++_0x77dd05);}(_0x8bb3,0xf1));var _0x38bb=function(_0x2c9520,_0x3200db){_0x2c9520=_0x2c9520-0x0;var _0x19c800=_0x8bb3[_0x2c9520];return _0x19c800;};'use strict';var _=require(_0x38bb('0x0'));var util=require(_0x38bb('0x1'));var logger=require(_0x38bb('0x2'))(_0x38bb('0x3'));var moment=require(_0x38bb('0x4'));var BPromise=require(_0x38bb('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x38bb('0x6'));var rimraf=require(_0x38bb('0x7'));var config=require('../../config/environment');var attributes=require(_0x38bb('0x8'));module[_0x38bb('0x9')]=function(_0x5d6955,_0x49a4ea){return _0x5d6955[_0x38bb('0xa')]('SmsQueue',attributes,{'tableName':'sms_queues','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 a90d8fe..e0b1a19 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 _0xfd84=['debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','GetSmsQueue','findAll','options','raw','where','limit','include','map','model','attributes','ShowSmsQueue','SmsQueue','find','stringify','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','defaults','redis','./smsQueue.socket','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x25844c,_0x2682a2){var _0x49e34b=function(_0x13c1e6){while(--_0x13c1e6){_0x25844c['push'](_0x25844c['shift']());}};_0x49e34b(++_0x2682a2);}(_0xfd84,0x1b7));var _0x4fd8=function(_0x43837c,_0x2b4d79){_0x43837c=_0x43837c-0x0;var _0x51eb0e=_0xfd84[_0x43837c];return _0x51eb0e;};'use strict';var _=require(_0x4fd8('0x0'));var util=require(_0x4fd8('0x1'));var moment=require(_0x4fd8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4fd8('0x3'));var db=require(_0x4fd8('0x4'))['db'];var utils=require(_0x4fd8('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4fd8('0x6'));var jayson=require(_0x4fd8('0x7'));var client=jayson['client'][_0x4fd8('0x8')]({'port':0x232a});config['redis']=_[_0x4fd8('0x9')](config[_0x4fd8('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4fd8('0xa')]));require(_0x4fd8('0xb'))['register'](socket);function respondWithRpcPromise(_0x54bf2c,_0x3ba2e0,_0x103594){return new BPromise(function(_0x368b93,_0x599073){return client[_0x4fd8('0xc')](_0x54bf2c,_0x103594)[_0x4fd8('0xd')](function(_0xb82627){logger[_0x4fd8('0xe')](_0x4fd8('0xf'),_0x3ba2e0,_0x4fd8('0x10'));logger[_0x4fd8('0x11')](_0x4fd8('0x12'),_0x3ba2e0,_0x4fd8('0x10'),JSON['stringify'](_0xb82627));if(_0xb82627[_0x4fd8('0x13')]){if(_0xb82627[_0x4fd8('0x13')][_0x4fd8('0x14')]===0x1f4){logger[_0x4fd8('0x13')](_0x4fd8('0xf'),_0x3ba2e0,_0xb82627['error']['message']);return _0x599073(_0xb82627[_0x4fd8('0x13')][_0x4fd8('0x15')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x3ba2e0,_0xb82627[_0x4fd8('0x13')]['message']);return _0x368b93(_0xb82627[_0x4fd8('0x13')][_0x4fd8('0x15')]);}else{logger[_0x4fd8('0xe')](_0x4fd8('0xf'),_0x3ba2e0,_0x4fd8('0x10'));_0x368b93(_0xb82627[_0x4fd8('0x16')][_0x4fd8('0x15')]);}})['catch'](function(_0x2918f3){logger[_0x4fd8('0x13')]('SmsQueue,\x20%s,\x20%s',_0x3ba2e0,_0x2918f3);_0x599073(_0x2918f3);});});}exports[_0x4fd8('0x17')]=function(_0x3f5fe4){var _0x139e94=this;return new Promise(function(_0x3f497f,_0x130390){return db['SmsQueue'][_0x4fd8('0x18')]({'raw':_0x3f5fe4[_0x4fd8('0x19')]?_0x3f5fe4[_0x4fd8('0x19')][_0x4fd8('0x1a')]===undefined?!![]:![]:!![],'where':_0x3f5fe4[_0x4fd8('0x19')]?_0x3f5fe4[_0x4fd8('0x19')][_0x4fd8('0x1b')]||null:null,'attributes':_0x3f5fe4[_0x4fd8('0x19')]?_0x3f5fe4[_0x4fd8('0x19')]['attributes']||null:null,'limit':_0x3f5fe4[_0x4fd8('0x19')]?_0x3f5fe4[_0x4fd8('0x19')][_0x4fd8('0x1c')]||null:null,'include':_0x3f5fe4[_0x4fd8('0x19')]?_0x3f5fe4['options'][_0x4fd8('0x1d')]?_[_0x4fd8('0x1e')](_0x3f5fe4[_0x4fd8('0x19')][_0x4fd8('0x1d')],function(_0x5578c9){return{'model':db[_0x5578c9[_0x4fd8('0x1f')]],'as':_0x5578c9['as'],'attributes':_0x5578c9[_0x4fd8('0x20')],'include':_0x5578c9[_0x4fd8('0x1d')]?_['map'](_0x5578c9['include'],function(_0x59059c){return{'model':db[_0x59059c[_0x4fd8('0x1f')]],'as':_0x59059c['as'],'attributes':_0x59059c[_0x4fd8('0x20')],'include':_0x59059c[_0x4fd8('0x1d')]?_[_0x4fd8('0x1e')](_0x59059c['include'],function(_0xa41bcd){return{'model':db[_0xa41bcd[_0x4fd8('0x1f')]],'as':_0xa41bcd['as'],'attributes':_0xa41bcd[_0x4fd8('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4fd8('0xd')](function(_0x354ecc){logger[_0x4fd8('0xe')](_0x4fd8('0x17'),_0x3f5fe4);logger[_0x4fd8('0x11')]('GetSmsQueue',_0x3f5fe4,JSON['stringify'](_0x354ecc));_0x3f497f(_0x354ecc);})['catch'](function(_0xf655c5){logger[_0x4fd8('0x13')](_0x4fd8('0x17'),_0xf655c5[_0x4fd8('0x15')],_0x3f5fe4);_0x130390(_0x139e94[_0x4fd8('0x13')](0x1f4,_0xf655c5[_0x4fd8('0x15')]));});});};exports[_0x4fd8('0x21')]=function(_0x4db9f3){var _0x1f1ff5=this;return new Promise(function(_0x47e8fb,_0x1003a3){return db[_0x4fd8('0x22')][_0x4fd8('0x23')]({'raw':_0x4db9f3['options']?_0x4db9f3[_0x4fd8('0x19')][_0x4fd8('0x1a')]===undefined?!![]:![]:!![],'where':_0x4db9f3['options']?_0x4db9f3[_0x4fd8('0x19')][_0x4fd8('0x1b')]||null:null,'attributes':_0x4db9f3[_0x4fd8('0x19')]?_0x4db9f3['options'][_0x4fd8('0x20')]||null:null,'include':_0x4db9f3['options']?_0x4db9f3[_0x4fd8('0x19')]['include']?_[_0x4fd8('0x1e')](_0x4db9f3[_0x4fd8('0x19')]['include'],function(_0x589f1e){return{'model':db[_0x589f1e[_0x4fd8('0x1f')]],'as':_0x589f1e['as'],'attributes':_0x589f1e[_0x4fd8('0x20')],'include':_0x589f1e['include']?_[_0x4fd8('0x1e')](_0x589f1e[_0x4fd8('0x1d')],function(_0xfa8286){return{'model':db[_0xfa8286[_0x4fd8('0x1f')]],'as':_0xfa8286['as'],'attributes':_0xfa8286['attributes'],'include':_0xfa8286[_0x4fd8('0x1d')]?_[_0x4fd8('0x1e')](_0xfa8286['include'],function(_0x3be875){return{'model':db[_0x3be875[_0x4fd8('0x1f')]],'as':_0x3be875['as'],'attributes':_0x3be875[_0x4fd8('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x474a72){logger[_0x4fd8('0xe')](_0x4fd8('0x21'),_0x4db9f3);logger[_0x4fd8('0x11')]('ShowSmsQueue',_0x4db9f3,JSON[_0x4fd8('0x24')](_0x474a72));_0x47e8fb(_0x474a72);})[_0x4fd8('0x25')](function(_0x2fd04d){logger[_0x4fd8('0x13')]('ShowSmsQueue',_0x2fd04d[_0x4fd8('0x15')],_0x4db9f3);_0x1003a3(_0x1f1ff5[_0x4fd8('0x13')](0x1f4,_0x2fd04d[_0x4fd8('0x15')]));});});}; \ No newline at end of file +var _0x7066=['ShowSmsQueue','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','attributes','limit','map','include','model','stringify','find','where'];(function(_0x495e9f,_0x1b1d80){var _0xb249d2=function(_0x3db4e4){while(--_0x3db4e4){_0x495e9f['push'](_0x495e9f['shift']());}};_0xb249d2(++_0x1b1d80);}(_0x7066,0xa1));var _0x6706=function(_0x374a29,_0x1a972f){_0x374a29=_0x374a29-0x0;var _0x59c59a=_0x7066[_0x374a29];return _0x59c59a;};'use strict';var _=require(_0x6706('0x0'));var util=require(_0x6706('0x1'));var moment=require(_0x6706('0x2'));var BPromise=require(_0x6706('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6706('0x4'))['db'];var utils=require(_0x6706('0x5'));var logger=require(_0x6706('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6706('0x7'));var client=jayson[_0x6706('0x8')][_0x6706('0x9')]({'port':0x232a});config[_0x6706('0xa')]=_[_0x6706('0xb')](config[_0x6706('0xa')],{'host':_0x6706('0xc'),'port':0x18eb});var socket=require(_0x6706('0xd'))(new Redis(config[_0x6706('0xa')]));require('./smsQueue.socket')[_0x6706('0xe')](socket);function respondWithRpcPromise(_0x321409,_0x67646b,_0x39f0ac){return new BPromise(function(_0x2a1e95,_0x350b44){return client[_0x6706('0xf')](_0x321409,_0x39f0ac)[_0x6706('0x10')](function(_0x46dbc2){logger[_0x6706('0x11')](_0x6706('0x12'),_0x67646b,'request\x20sent');logger[_0x6706('0x13')](_0x6706('0x14'),_0x67646b,_0x6706('0x15'),JSON['stringify'](_0x46dbc2));if(_0x46dbc2[_0x6706('0x16')]){if(_0x46dbc2[_0x6706('0x16')][_0x6706('0x17')]===0x1f4){logger[_0x6706('0x16')]('SmsQueue,\x20%s,\x20%s',_0x67646b,_0x46dbc2[_0x6706('0x16')][_0x6706('0x18')]);return _0x350b44(_0x46dbc2[_0x6706('0x16')][_0x6706('0x18')]);}logger[_0x6706('0x16')](_0x6706('0x12'),_0x67646b,_0x46dbc2['error']['message']);return _0x2a1e95(_0x46dbc2[_0x6706('0x16')][_0x6706('0x18')]);}else{logger[_0x6706('0x11')](_0x6706('0x12'),_0x67646b,_0x6706('0x15'));_0x2a1e95(_0x46dbc2[_0x6706('0x19')][_0x6706('0x18')]);}})[_0x6706('0x1a')](function(_0x3291fe){logger[_0x6706('0x16')](_0x6706('0x12'),_0x67646b,_0x3291fe);_0x350b44(_0x3291fe);});});}exports[_0x6706('0x1b')]=function(_0x40fc14){var _0x4919d3=this;return new Promise(function(_0x1573d6,_0x280978){return db[_0x6706('0x1c')][_0x6706('0x1d')]({'raw':_0x40fc14[_0x6706('0x1e')]?_0x40fc14['options']['raw']===undefined?!![]:![]:!![],'where':_0x40fc14['options']?_0x40fc14['options']['where']||null:null,'attributes':_0x40fc14[_0x6706('0x1e')]?_0x40fc14[_0x6706('0x1e')][_0x6706('0x1f')]||null:null,'limit':_0x40fc14[_0x6706('0x1e')]?_0x40fc14[_0x6706('0x1e')][_0x6706('0x20')]||null:null,'include':_0x40fc14[_0x6706('0x1e')]?_0x40fc14[_0x6706('0x1e')]['include']?_[_0x6706('0x21')](_0x40fc14[_0x6706('0x1e')][_0x6706('0x22')],function(_0x25b453){return{'model':db[_0x25b453[_0x6706('0x23')]],'as':_0x25b453['as'],'attributes':_0x25b453[_0x6706('0x1f')],'include':_0x25b453[_0x6706('0x22')]?_[_0x6706('0x21')](_0x25b453['include'],function(_0x867332){return{'model':db[_0x867332[_0x6706('0x23')]],'as':_0x867332['as'],'attributes':_0x867332[_0x6706('0x1f')],'include':_0x867332[_0x6706('0x22')]?_[_0x6706('0x21')](_0x867332[_0x6706('0x22')],function(_0x303f99){return{'model':db[_0x303f99[_0x6706('0x23')]],'as':_0x303f99['as'],'attributes':_0x303f99[_0x6706('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6706('0x10')](function(_0x50f295){logger[_0x6706('0x11')](_0x6706('0x1b'),_0x40fc14);logger[_0x6706('0x13')](_0x6706('0x1b'),_0x40fc14,JSON[_0x6706('0x24')](_0x50f295));_0x1573d6(_0x50f295);})['catch'](function(_0x169fd1){logger[_0x6706('0x16')](_0x6706('0x1b'),_0x169fd1[_0x6706('0x18')],_0x40fc14);_0x280978(_0x4919d3['error'](0x1f4,_0x169fd1[_0x6706('0x18')]));});});};exports['ShowSmsQueue']=function(_0x4e6918){var _0xa5514=this;return new Promise(function(_0x32f0e6,_0x22e6b9){return db[_0x6706('0x1c')][_0x6706('0x25')]({'raw':_0x4e6918[_0x6706('0x1e')]?_0x4e6918[_0x6706('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x4e6918[_0x6706('0x1e')]?_0x4e6918[_0x6706('0x1e')][_0x6706('0x26')]||null:null,'attributes':_0x4e6918[_0x6706('0x1e')]?_0x4e6918[_0x6706('0x1e')][_0x6706('0x1f')]||null:null,'include':_0x4e6918[_0x6706('0x1e')]?_0x4e6918[_0x6706('0x1e')][_0x6706('0x22')]?_[_0x6706('0x21')](_0x4e6918['options'][_0x6706('0x22')],function(_0x4cf5c9){return{'model':db[_0x4cf5c9['model']],'as':_0x4cf5c9['as'],'attributes':_0x4cf5c9['attributes'],'include':_0x4cf5c9[_0x6706('0x22')]?_[_0x6706('0x21')](_0x4cf5c9['include'],function(_0x2c8037){return{'model':db[_0x2c8037['model']],'as':_0x2c8037['as'],'attributes':_0x2c8037[_0x6706('0x1f')],'include':_0x2c8037['include']?_['map'](_0x2c8037[_0x6706('0x22')],function(_0x570728){return{'model':db[_0x570728[_0x6706('0x23')]],'as':_0x570728['as'],'attributes':_0x570728[_0x6706('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6706('0x10')](function(_0x3d9efa){logger[_0x6706('0x11')](_0x6706('0x27'),_0x4e6918);logger[_0x6706('0x13')](_0x6706('0x27'),_0x4e6918,JSON[_0x6706('0x24')](_0x3d9efa));_0x32f0e6(_0x3d9efa);})[_0x6706('0x1a')](function(_0x4caa59){logger[_0x6706('0x16')](_0x6706('0x27'),_0x4caa59[_0x6706('0x18')],_0x4e6918);_0x22e6b9(_0xa5514[_0x6706('0x16')](0x1f4,_0x4caa59[_0x6706('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 448a3fb..d80bf6c 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 _0xb1dd=['remove','update','emit','register','length','smsQueue:','./smsQueue.events','save'];(function(_0x25e9eb,_0x368738){var _0x44c6c4=function(_0x1d68e7){while(--_0x1d68e7){_0x25e9eb['push'](_0x25e9eb['shift']());}};_0x44c6c4(++_0x368738);}(_0xb1dd,0x19e));var _0xdb1d=function(_0x464630,_0x2589e7){_0x464630=_0x464630-0x0;var _0x1149da=_0xb1dd[_0x464630];return _0x1149da;};'use strict';var SmsQueueEvents=require(_0xdb1d('0x0'));var events=[_0xdb1d('0x1'),_0xdb1d('0x2'),_0xdb1d('0x3')];function createListener(_0x35b907,_0x18019c){return function(_0x4a8e1c){_0x18019c[_0xdb1d('0x4')](_0x35b907,_0x4a8e1c);};}function removeListener(_0x265acf,_0x323221){return function(){SmsQueueEvents['removeListener'](_0x265acf,_0x323221);};}exports[_0xdb1d('0x5')]=function(_0x1a40a3){for(var _0x2ea734=0x0,_0x52e096=events[_0xdb1d('0x6')];_0x2ea734<_0x52e096;_0x2ea734++){var _0x2691f8=events[_0x2ea734];var _0x58f295=createListener(_0xdb1d('0x7')+_0x2691f8,_0x1a40a3);SmsQueueEvents['on'](_0x2691f8,_0x58f295);}}; \ No newline at end of file +var _0x0689=['update','register','smsQueue:'];(function(_0x1fdee4,_0x3d15e8){var _0x1e4a62=function(_0x2d1cdb){while(--_0x2d1cdb){_0x1fdee4['push'](_0x1fdee4['shift']());}};_0x1e4a62(++_0x3d15e8);}(_0x0689,0x17a));var _0x9068=function(_0x3a8b9b,_0x4b1728){_0x3a8b9b=_0x3a8b9b-0x0;var _0x1a3bba=_0x0689[_0x3a8b9b];return _0x1a3bba;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save','remove',_0x9068('0x0')];function createListener(_0x16bf63,_0x298db2){return function(_0x575eca){_0x298db2['emit'](_0x16bf63,_0x575eca);};}function removeListener(_0x3cb631,_0x1024fd){return function(){SmsQueueEvents['removeListener'](_0x3cb631,_0x1024fd);};}exports[_0x9068('0x1')]=function(_0x2e15e3){for(var _0xe7a44c=0x0,_0xea8fd6=events['length'];_0xe7a44c<_0xea8fd6;_0xe7a44c++){var _0x1f29f7=events[_0xe7a44c];var _0xe17d59=createListener(_0x9068('0x2')+_0x1f29f7,_0x2e15e3);SmsQueueEvents['on'](_0x1f29f7,_0xe17d59);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index f05b4db..d915d57 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 _0x53b5=['../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x2f8530,_0x5cbd67){var _0x5e814e=function(_0x490b29){while(--_0x490b29){_0x2f8530['push'](_0x2f8530['shift']());}};_0x5e814e(++_0x5cbd67);}(_0x53b5,0x161));var _0x553b=function(_0x715939,_0x3ad44e){_0x715939=_0x715939-0x0;var _0x3c843d=_0x53b5[_0x715939];return _0x3c843d;};'use strict';var multer=require(_0x553b('0x0'));var util=require(_0x553b('0x1'));var path=require(_0x553b('0x2'));var timeout=require(_0x553b('0x3'));var express=require('express');var router=express[_0x553b('0x4')]();var fs_extra=require(_0x553b('0x5'));var auth=require(_0x553b('0x6'));var interaction=require(_0x553b('0x7'));var config=require(_0x553b('0x8'));var controller=require(_0x553b('0x9'));router[_0x553b('0xa')]('/',auth[_0x553b('0xb')](),controller[_0x553b('0xc')]);router['get'](_0x553b('0xd'),auth[_0x553b('0xb')](),controller[_0x553b('0xe')]);router[_0x553b('0xa')](_0x553b('0xf'),auth[_0x553b('0xb')](),controller[_0x553b('0x10')]);router[_0x553b('0x11')]('/',auth[_0x553b('0xb')](),controller['create']);router['put'](_0x553b('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x553b('0x12')](_0x553b('0xf'),auth[_0x553b('0xb')](),controller['destroy']);module[_0x553b('0x13')]=router; \ No newline at end of file +var _0x89a1=['../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x89a1,0x1db));var _0x189a=function(_0x5cfb8d,_0x656a13){_0x5cfb8d=_0x5cfb8d-0x0;var _0x530819=_0x89a1[_0x5cfb8d];return _0x530819;};'use strict';var multer=require(_0x189a('0x0'));var util=require(_0x189a('0x1'));var path=require(_0x189a('0x2'));var timeout=require(_0x189a('0x3'));var express=require(_0x189a('0x4'));var router=express[_0x189a('0x5')]();var fs_extra=require(_0x189a('0x6'));var auth=require(_0x189a('0x7'));var interaction=require(_0x189a('0x8'));var config=require(_0x189a('0x9'));var controller=require(_0x189a('0xa'));router[_0x189a('0xb')]('/',auth[_0x189a('0xc')](),controller[_0x189a('0xd')]);router[_0x189a('0xb')](_0x189a('0xe'),auth[_0x189a('0xc')](),controller[_0x189a('0xf')]);router[_0x189a('0xb')](_0x189a('0x10'),auth['isAuthenticated'](),controller[_0x189a('0x11')]);router[_0x189a('0x12')]('/',auth[_0x189a('0xc')](),controller[_0x189a('0x13')]);router['put'](_0x189a('0x10'),auth[_0x189a('0xc')](),controller[_0x189a('0x14')]);router[_0x189a('0x15')](_0x189a('0x10'),auth[_0x189a('0xc')](),controller[_0x189a('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 8d747b4..3fa8ec3 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 _0xd645=['sequelize','STRING','DATE','moment'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xd645,0x13b));var _0x5d64=function(_0x4770eb,_0x3a72fa){_0x4770eb=_0x4770eb-0x0;var _0x3c6aee=_0xd645[_0x4770eb];return _0x3c6aee;};'use strict';var moment=require(_0x5d64('0x0'));var Sequelize=require(_0x5d64('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x5d64('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x5d64('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x5d64('0x3')]},'exitAt':{'type':Sequelize[_0x5d64('0x3')]},'reason':{'type':Sequelize[_0x5d64('0x2')]}}; \ No newline at end of file +var _0x714a=['sequelize','STRING','DATE'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x714a,0xd8));var _0xa714=function(_0x4ec95d,_0x3bdedc){_0x4ec95d=_0x4ec95d-0x0;var _0x7ff9b0=_0x714a[_0x4ec95d];return _0x7ff9b0;};'use strict';var moment=require('moment');var Sequelize=require(_0xa714('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xa714('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xa714('0x1')]},'joinAt':{'type':Sequelize[_0xa714('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa714('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa714('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 9f85e31..2d4dcd0 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 _0x6347=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','then','error','stack','name','index','map','SmsQueueReport','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','intersection','include','options','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','../../components/parsers/advancedSearch'];(function(_0xa6d468,_0x22f8be){var _0xec1e40=function(_0x1b2d39){while(--_0x1b2d39){_0xa6d468['push'](_0xa6d468['shift']());}};_0xec1e40(++_0x22f8be);}(_0x6347,0x157));var _0x7634=function(_0x4390af,_0x231feb){_0x4390af=_0x4390af-0x0;var _0x336151=_0x6347[_0x4390af];return _0x336151;};'use strict';var emlformat=require(_0x7634('0x0'));var rimraf=require(_0x7634('0x1'));var zipdir=require(_0x7634('0x2'));var jsonpatch=require(_0x7634('0x3'));var rp=require(_0x7634('0x4'));var moment=require(_0x7634('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7634('0x6'));var util=require(_0x7634('0x7'));var path=require(_0x7634('0x8'));var sox=require('sox');var csv=require(_0x7634('0x9'));var ejs=require(_0x7634('0xa'));var fs=require('fs');var fs_extra=require(_0x7634('0xb'));var _=require('lodash');var squel=require(_0x7634('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7634('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7634('0xe'));var Papa=require(_0x7634('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7634('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7634('0x11'));var utils=require(_0x7634('0x12'));var config=require(_0x7634('0x13'));var licenseUtil=require(_0x7634('0x14'));var db=require(_0x7634('0x15'))['db'];function respondWithStatusCode(_0x516ca7,_0x19bbdd){_0x19bbdd=_0x19bbdd||0xcc;return function(_0x3bdeae){if(_0x3bdeae){return _0x516ca7[_0x7634('0x16')](_0x19bbdd);}return _0x516ca7[_0x7634('0x17')](_0x19bbdd)[_0x7634('0x18')]();};}function respondWithResult(_0x1d440c,_0x2aad3f){_0x2aad3f=_0x2aad3f||0xc8;return function(_0x3c9a9d){if(_0x3c9a9d){return _0x1d440c[_0x7634('0x17')](_0x2aad3f)[_0x7634('0x19')](_0x3c9a9d);}};}function respondWithFilteredResult(_0x3a7e14,_0x355b02){return function(_0x5c5938){if(_0x5c5938){var _0x2165ab=typeof _0x355b02[_0x7634('0x1a')]===_0x7634('0x1b')&&typeof _0x355b02['limit']===_0x7634('0x1b');var _0x15c4df=_0x5c5938[_0x7634('0x1c')];var _0x5b17b4=_0x2165ab?0x0:_0x355b02[_0x7634('0x1a')];var _0xc94c61=_0x2165ab?_0x5c5938[_0x7634('0x1c')]:_0x355b02[_0x7634('0x1a')]+_0x355b02[_0x7634('0x1d')];var _0x497bae;if(_0xc94c61>=_0x15c4df){_0xc94c61=_0x15c4df;_0x497bae=0xc8;}else{_0x497bae=0xce;}_0x3a7e14[_0x7634('0x17')](_0x497bae);return _0x3a7e14['set'](_0x7634('0x1e'),_0x5b17b4+'-'+_0xc94c61+'/'+_0x15c4df)['json'](_0x5c5938);}return null;};}function patchUpdates(_0x13be8e){return function(_0x233e0c){try{jsonpatch[_0x7634('0x1f')](_0x233e0c,_0x13be8e,!![]);}catch(_0x158896){return BPromise[_0x7634('0x20')](_0x158896);}return _0x233e0c['save']();};}function saveUpdates(_0x288496,_0x4ce33c){return function(_0x3c5a86){if(_0x3c5a86){return _0x3c5a86['update'](_0x288496)[_0x7634('0x21')](function(_0x578ff5){return _0x578ff5;});}return null;};}function removeEntity(_0x4c174f,_0x18f3ce){return function(_0x319568){if(_0x319568){return _0x319568['destroy']()[_0x7634('0x21')](function(){_0x4c174f['status'](0xcc)[_0x7634('0x18')]();});}};}function handleEntityNotFound(_0x3d38ff,_0x38bc91){return function(_0x4cfb9d){if(!_0x4cfb9d){_0x3d38ff['sendStatus'](0x194);}return _0x4cfb9d;};}function handleError(_0x4e6e41,_0x3c812f){_0x3c812f=_0x3c812f||0x1f4;return function(_0x478a19){logger[_0x7634('0x22')](_0x478a19[_0x7634('0x23')]);if(_0x478a19[_0x7634('0x24')]){delete _0x478a19['name'];}_0x4e6e41[_0x7634('0x17')](_0x3c812f)['send'](_0x478a19);};}exports[_0x7634('0x25')]=function(_0x489326,_0x1ddc6c){var _0x34f781={},_0x2da207={},_0x46117f={'count':0x0,'rows':[]};var _0x2e77a1=_[_0x7634('0x26')](db[_0x7634('0x27')][_0x7634('0x28')],function(_0x17b8e0){return{'name':_0x17b8e0[_0x7634('0x29')],'type':_0x17b8e0['type']['key']};});_0x2da207[_0x7634('0x2a')]=_['map'](_0x2e77a1,_0x7634('0x24'));_0x2da207[_0x7634('0x2b')]=_[_0x7634('0x2c')](_0x489326[_0x7634('0x2b')]);_0x2da207[_0x7634('0x2d')]=_['intersection'](_0x2da207[_0x7634('0x2a')],_0x2da207[_0x7634('0x2b')]);_0x34f781[_0x7634('0x2e')]=_['intersection'](_0x2da207[_0x7634('0x2a')],qs['fields'](_0x489326[_0x7634('0x2b')][_0x7634('0x2f')]));_0x34f781[_0x7634('0x2e')]=_0x34f781[_0x7634('0x2e')][_0x7634('0x30')]?_0x34f781[_0x7634('0x2e')]:_0x2da207[_0x7634('0x2a')];if(!_0x489326[_0x7634('0x2b')][_0x7634('0x31')](_0x7634('0x32'))){_0x34f781[_0x7634('0x1d')]=qs[_0x7634('0x1d')](_0x489326[_0x7634('0x2b')][_0x7634('0x1d')]);_0x34f781[_0x7634('0x1a')]=qs[_0x7634('0x1a')](_0x489326[_0x7634('0x2b')][_0x7634('0x1a')]);}_0x34f781['order']=qs[_0x7634('0x33')](_0x489326[_0x7634('0x2b')][_0x7634('0x33')]);_0x34f781['where']=qs[_0x7634('0x2d')](_[_0x7634('0x34')](_0x489326[_0x7634('0x2b')],_0x2da207[_0x7634('0x2d')]),_0x2e77a1);if(_0x489326[_0x7634('0x2b')][_0x7634('0x35')]){_0x34f781[_0x7634('0x36')]=_[_0x7634('0x37')](_0x34f781[_0x7634('0x36')],{'$or':_['map'](_0x2e77a1,function(_0x1375a3){if(_0x1375a3['type']!==_0x7634('0x38')){var _0xd2193c={};_0xd2193c[_0x1375a3[_0x7634('0x24')]]={'$like':'%'+_0x489326[_0x7634('0x2b')][_0x7634('0x35')]+'%'};return _0xd2193c;}})});}_0x34f781=_[_0x7634('0x37')]({},_0x34f781,_0x489326['options']);var _0x5d36ba={'where':_0x34f781[_0x7634('0x36')]};return db[_0x7634('0x27')][_0x7634('0x1c')](_0x5d36ba)['then'](function(_0x1d7954){_0x46117f[_0x7634('0x1c')]=_0x1d7954;if(_0x489326[_0x7634('0x2b')][_0x7634('0x39')]){_0x34f781['include']=[{'all':!![]}];}return db[_0x7634('0x27')][_0x7634('0x3a')](_0x34f781);})[_0x7634('0x21')](function(_0x589884){_0x46117f[_0x7634('0x3b')]=_0x589884;return _0x46117f;})[_0x7634('0x21')](respondWithFilteredResult(_0x1ddc6c,_0x34f781))[_0x7634('0x3c')](handleError(_0x1ddc6c,null));};exports[_0x7634('0x3d')]=function(_0x56ac82,_0x4953ab){var _0x2dcc2a={'raw':!![],'where':{'id':_0x56ac82[_0x7634('0x3e')]['id']}},_0x14c467={};_0x14c467[_0x7634('0x2a')]=_[_0x7634('0x2c')](db[_0x7634('0x27')][_0x7634('0x28')]);_0x14c467[_0x7634('0x2b')]=_[_0x7634('0x2c')](_0x56ac82['query']);_0x14c467['filters']=_[_0x7634('0x3f')](_0x14c467['model'],_0x14c467[_0x7634('0x2b')]);_0x2dcc2a[_0x7634('0x2e')]=_[_0x7634('0x3f')](_0x14c467['model'],qs[_0x7634('0x2f')](_0x56ac82[_0x7634('0x2b')][_0x7634('0x2f')]));_0x2dcc2a[_0x7634('0x2e')]=_0x2dcc2a['attributes']['length']?_0x2dcc2a[_0x7634('0x2e')]:_0x14c467[_0x7634('0x2a')];if(_0x56ac82[_0x7634('0x2b')][_0x7634('0x39')]){_0x2dcc2a[_0x7634('0x40')]=[{'all':!![]}];}_0x2dcc2a=_[_0x7634('0x37')]({},_0x2dcc2a,_0x56ac82[_0x7634('0x41')]);return db[_0x7634('0x27')][_0x7634('0x42')](_0x2dcc2a)[_0x7634('0x21')](handleEntityNotFound(_0x4953ab,null))[_0x7634('0x21')](respondWithResult(_0x4953ab,null))[_0x7634('0x3c')](handleError(_0x4953ab,null));};exports[_0x7634('0x43')]=function(_0x2ab2db,_0x5664b6){return db['SmsQueueReport'][_0x7634('0x43')](_0x2ab2db[_0x7634('0x44')],{})[_0x7634('0x21')](respondWithResult(_0x5664b6,0xc9))[_0x7634('0x3c')](handleError(_0x5664b6,null));};exports[_0x7634('0x45')]=function(_0x3660c6,_0x200350){if(_0x3660c6[_0x7634('0x44')]['id']){delete _0x3660c6['body']['id'];}return db['SmsQueueReport'][_0x7634('0x42')]({'where':{'id':_0x3660c6[_0x7634('0x3e')]['id']}})['then'](handleEntityNotFound(_0x200350,null))[_0x7634('0x21')](saveUpdates(_0x3660c6[_0x7634('0x44')],null))[_0x7634('0x21')](respondWithResult(_0x200350,null))[_0x7634('0x3c')](handleError(_0x200350,null));};exports[_0x7634('0x46')]=function(_0x40f4d1,_0x470bb8){return db[_0x7634('0x27')]['find']({'where':{'id':_0x40f4d1[_0x7634('0x3e')]['id']}})['then'](handleEntityNotFound(_0x470bb8,null))[_0x7634('0x21')](removeEntity(_0x470bb8,null))[_0x7634('0x3c')](handleError(_0x470bb8,null));};exports[_0x7634('0x47')]=function(_0x8a30ef,_0x441810){return db[_0x7634('0x27')]['describe']()[_0x7634('0x21')](respondWithResult(_0x441810,null))[_0x7634('0x3c')](handleError(_0x441810,null));}; \ No newline at end of file +var _0xf880=['update','then','destroy','error','stack','name','send','index','map','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','SmsQueueReport','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','options','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save'];(function(_0x5e8595,_0x102fa6){var _0x4a8de7=function(_0x137309){while(--_0x137309){_0x5e8595['push'](_0x5e8595['shift']());}};_0x4a8de7(++_0x102fa6);}(_0xf880,0x117));var _0x0f88=function(_0x5c883f,_0x38f092){_0x5c883f=_0x5c883f-0x0;var _0x4210cc=_0xf880[_0x5c883f];return _0x4210cc;};'use strict';var emlformat=require(_0x0f88('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0f88('0x1'));var rp=require(_0x0f88('0x2'));var moment=require(_0x0f88('0x3'));var BPromise=require(_0x0f88('0x4'));var Mustache=require(_0x0f88('0x5'));var util=require(_0x0f88('0x6'));var path=require('path');var sox=require(_0x0f88('0x7'));var csv=require('to-csv');var ejs=require(_0x0f88('0x8'));var fs=require('fs');var fs_extra=require(_0x0f88('0x9'));var _=require(_0x0f88('0xa'));var squel=require(_0x0f88('0xb'));var crypto=require(_0x0f88('0xc'));var jsforce=require(_0x0f88('0xd'));var deskjs=require(_0x0f88('0xe'));var toCsv=require(_0x0f88('0xf'));var querystring=require(_0x0f88('0x10'));var Papa=require('papaparse');var Redis=require(_0x0f88('0x11'));var authService=require(_0x0f88('0x12'));var qs=require(_0x0f88('0x13'));var as=require(_0x0f88('0x14'));var hardwareService=require(_0x0f88('0x15'));var logger=require('../../config/logger')(_0x0f88('0x16'));var utils=require(_0x0f88('0x17'));var config=require(_0x0f88('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50f1c8,_0x52af7a){_0x52af7a=_0x52af7a||0xcc;return function(_0x39fdac){if(_0x39fdac){return _0x50f1c8[_0x0f88('0x19')](_0x52af7a);}return _0x50f1c8[_0x0f88('0x1a')](_0x52af7a)[_0x0f88('0x1b')]();};}function respondWithResult(_0x293976,_0x2842b5){_0x2842b5=_0x2842b5||0xc8;return function(_0x13e7bd){if(_0x13e7bd){return _0x293976[_0x0f88('0x1a')](_0x2842b5)[_0x0f88('0x1c')](_0x13e7bd);}};}function respondWithFilteredResult(_0x17b83a,_0x1b08cb){return function(_0x67dc68){if(_0x67dc68){var _0x3d3711=typeof _0x1b08cb[_0x0f88('0x1d')]===_0x0f88('0x1e')&&typeof _0x1b08cb[_0x0f88('0x1f')]===_0x0f88('0x1e');var _0x4e8561=_0x67dc68[_0x0f88('0x20')];var _0xdf30c7=_0x3d3711?0x0:_0x1b08cb[_0x0f88('0x1d')];var _0x6cfcb6=_0x3d3711?_0x67dc68[_0x0f88('0x20')]:_0x1b08cb[_0x0f88('0x1d')]+_0x1b08cb[_0x0f88('0x1f')];var _0x56b5f1;if(_0x6cfcb6>=_0x4e8561){_0x6cfcb6=_0x4e8561;_0x56b5f1=0xc8;}else{_0x56b5f1=0xce;}_0x17b83a[_0x0f88('0x1a')](_0x56b5f1);return _0x17b83a[_0x0f88('0x21')]('Content-Range',_0xdf30c7+'-'+_0x6cfcb6+'/'+_0x4e8561)[_0x0f88('0x1c')](_0x67dc68);}return null;};}function patchUpdates(_0x432f18){return function(_0x27fd2f){try{jsonpatch[_0x0f88('0x22')](_0x27fd2f,_0x432f18,!![]);}catch(_0x449987){return BPromise[_0x0f88('0x23')](_0x449987);}return _0x27fd2f[_0x0f88('0x24')]();};}function saveUpdates(_0x9182f9,_0x558404){return function(_0x2f8d79){if(_0x2f8d79){return _0x2f8d79[_0x0f88('0x25')](_0x9182f9)[_0x0f88('0x26')](function(_0x2e035b){return _0x2e035b;});}return null;};}function removeEntity(_0x31af85,_0x3a0e6c){return function(_0x5840e7){if(_0x5840e7){return _0x5840e7[_0x0f88('0x27')]()['then'](function(){_0x31af85[_0x0f88('0x1a')](0xcc)[_0x0f88('0x1b')]();});}};}function handleEntityNotFound(_0x1bd655,_0x3da0d2){return function(_0x147472){if(!_0x147472){_0x1bd655['sendStatus'](0x194);}return _0x147472;};}function handleError(_0x3c824f,_0x5a1525){_0x5a1525=_0x5a1525||0x1f4;return function(_0x1961b3){logger[_0x0f88('0x28')](_0x1961b3[_0x0f88('0x29')]);if(_0x1961b3['name']){delete _0x1961b3[_0x0f88('0x2a')];}_0x3c824f['status'](_0x5a1525)[_0x0f88('0x2b')](_0x1961b3);};}exports[_0x0f88('0x2c')]=function(_0x24c8d8,_0x418c68){var _0x35dd61={},_0x46ab72={},_0x22c4c4={'count':0x0,'rows':[]};var _0x2d4541=_[_0x0f88('0x2d')](db['SmsQueueReport']['rawAttributes'],function(_0x125c5a){return{'name':_0x125c5a['fieldName'],'type':_0x125c5a[_0x0f88('0x2e')][_0x0f88('0x2f')]};});_0x46ab72[_0x0f88('0x30')]=_[_0x0f88('0x2d')](_0x2d4541,_0x0f88('0x2a'));_0x46ab72[_0x0f88('0x31')]=_['keys'](_0x24c8d8[_0x0f88('0x31')]);_0x46ab72[_0x0f88('0x32')]=_[_0x0f88('0x33')](_0x46ab72[_0x0f88('0x30')],_0x46ab72[_0x0f88('0x31')]);_0x35dd61['attributes']=_[_0x0f88('0x33')](_0x46ab72[_0x0f88('0x30')],qs[_0x0f88('0x34')](_0x24c8d8[_0x0f88('0x31')][_0x0f88('0x34')]));_0x35dd61[_0x0f88('0x35')]=_0x35dd61['attributes'][_0x0f88('0x36')]?_0x35dd61[_0x0f88('0x35')]:_0x46ab72[_0x0f88('0x30')];if(!_0x24c8d8['query'][_0x0f88('0x37')](_0x0f88('0x38'))){_0x35dd61[_0x0f88('0x1f')]=qs['limit'](_0x24c8d8[_0x0f88('0x31')][_0x0f88('0x1f')]);_0x35dd61[_0x0f88('0x1d')]=qs[_0x0f88('0x1d')](_0x24c8d8[_0x0f88('0x31')][_0x0f88('0x1d')]);}_0x35dd61[_0x0f88('0x39')]=qs[_0x0f88('0x3a')](_0x24c8d8['query']['sort']);_0x35dd61[_0x0f88('0x3b')]=qs[_0x0f88('0x32')](_[_0x0f88('0x3c')](_0x24c8d8[_0x0f88('0x31')],_0x46ab72['filters']),_0x2d4541);if(_0x24c8d8[_0x0f88('0x31')][_0x0f88('0x3d')]){_0x35dd61[_0x0f88('0x3b')]=_[_0x0f88('0x3e')](_0x35dd61[_0x0f88('0x3b')],{'$or':_['map'](_0x2d4541,function(_0x332938){if(_0x332938['type']!==_0x0f88('0x3f')){var _0x13897f={};_0x13897f[_0x332938[_0x0f88('0x2a')]]={'$like':'%'+_0x24c8d8[_0x0f88('0x31')][_0x0f88('0x3d')]+'%'};return _0x13897f;}})});}_0x35dd61=_[_0x0f88('0x3e')]({},_0x35dd61,_0x24c8d8['options']);var _0x3e325b={'where':_0x35dd61[_0x0f88('0x3b')]};return db[_0x0f88('0x40')]['count'](_0x3e325b)[_0x0f88('0x26')](function(_0x5b88f9){_0x22c4c4[_0x0f88('0x20')]=_0x5b88f9;if(_0x24c8d8['query'][_0x0f88('0x41')]){_0x35dd61[_0x0f88('0x42')]=[{'all':!![]}];}return db[_0x0f88('0x40')][_0x0f88('0x43')](_0x35dd61);})[_0x0f88('0x26')](function(_0x3427f9){_0x22c4c4[_0x0f88('0x44')]=_0x3427f9;return _0x22c4c4;})[_0x0f88('0x26')](respondWithFilteredResult(_0x418c68,_0x35dd61))[_0x0f88('0x45')](handleError(_0x418c68,null));};exports[_0x0f88('0x46')]=function(_0x2c10e4,_0x577674){var _0x48ac3c={'raw':!![],'where':{'id':_0x2c10e4[_0x0f88('0x47')]['id']}},_0x395bb9={};_0x395bb9[_0x0f88('0x30')]=_[_0x0f88('0x48')](db[_0x0f88('0x40')][_0x0f88('0x49')]);_0x395bb9[_0x0f88('0x31')]=_[_0x0f88('0x48')](_0x2c10e4[_0x0f88('0x31')]);_0x395bb9['filters']=_['intersection'](_0x395bb9[_0x0f88('0x30')],_0x395bb9[_0x0f88('0x31')]);_0x48ac3c[_0x0f88('0x35')]=_[_0x0f88('0x33')](_0x395bb9[_0x0f88('0x30')],qs[_0x0f88('0x34')](_0x2c10e4[_0x0f88('0x31')]['fields']));_0x48ac3c['attributes']=_0x48ac3c[_0x0f88('0x35')][_0x0f88('0x36')]?_0x48ac3c[_0x0f88('0x35')]:_0x395bb9[_0x0f88('0x30')];if(_0x2c10e4[_0x0f88('0x31')][_0x0f88('0x41')]){_0x48ac3c['include']=[{'all':!![]}];}_0x48ac3c=_[_0x0f88('0x3e')]({},_0x48ac3c,_0x2c10e4[_0x0f88('0x4a')]);return db[_0x0f88('0x40')][_0x0f88('0x4b')](_0x48ac3c)[_0x0f88('0x26')](handleEntityNotFound(_0x577674,null))[_0x0f88('0x26')](respondWithResult(_0x577674,null))[_0x0f88('0x45')](handleError(_0x577674,null));};exports[_0x0f88('0x4c')]=function(_0x211de0,_0xf3c95e){return db['SmsQueueReport'][_0x0f88('0x4c')](_0x211de0[_0x0f88('0x4d')],{})[_0x0f88('0x26')](respondWithResult(_0xf3c95e,0xc9))['catch'](handleError(_0xf3c95e,null));};exports['update']=function(_0x38ae5d,_0x1ff624){if(_0x38ae5d['body']['id']){delete _0x38ae5d[_0x0f88('0x4d')]['id'];}return db[_0x0f88('0x40')][_0x0f88('0x4b')]({'where':{'id':_0x38ae5d[_0x0f88('0x47')]['id']}})[_0x0f88('0x26')](handleEntityNotFound(_0x1ff624,null))['then'](saveUpdates(_0x38ae5d['body'],null))['then'](respondWithResult(_0x1ff624,null))[_0x0f88('0x45')](handleError(_0x1ff624,null));};exports[_0x0f88('0x27')]=function(_0x18e74b,_0x4429ba){return db[_0x0f88('0x40')][_0x0f88('0x4b')]({'where':{'id':_0x18e74b[_0x0f88('0x47')]['id']}})[_0x0f88('0x26')](handleEntityNotFound(_0x4429ba,null))['then'](removeEntity(_0x4429ba,null))['catch'](handleError(_0x4429ba,null));};exports[_0x0f88('0x4e')]=function(_0x36cf04,_0x63aaf8){return db['SmsQueueReport']['describe']()[_0x0f88('0x26')](respondWithResult(_0x63aaf8,null))[_0x0f88('0x45')](handleError(_0x63aaf8,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index c43f9be..f37c72b 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['util','../../config/logger','bluebird','request-promise','path','rimraf','./smsQueueReport.attributes','report_sms_queue','uniqueid','lodash'];(function(_0x35f34c,_0x389557){var _0x2afcda=function(_0x5cbcc6){while(--_0x5cbcc6){_0x35f34c['push'](_0x35f34c['shift']());}};_0x2afcda(++_0x389557);}(_0x70e0,0x17b));var _0x070e=function(_0x13a34b,_0xd3d425){_0x13a34b=_0x13a34b-0x0;var _0x275144=_0x70e0[_0x13a34b];return _0x275144;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('SmsQueueReport',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'name':_0x070e('0x9'),'fields':[_0x070e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x39c4ba,_0x192f1f){var _0x1c9c76=function(_0x415c51){while(--_0x415c51){_0x39c4ba['push'](_0x39c4ba['shift']());}};_0x1c9c76(++_0x192f1f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index afa7b16..b6d4beb 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 _0x78d4=['CreateSmsQueueReport','UpdateSmsQueueReport','update','where','attributes','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','catch','SmsQueueReport','create','body','options','raw','info','debug'];(function(_0x349c8f,_0x391e93){var _0x1e1788=function(_0x855395){while(--_0x855395){_0x349c8f['push'](_0x349c8f['shift']());}};_0x1e1788(++_0x391e93);}(_0x78d4,0x115));var _0x478d=function(_0x3fdf9c,_0x41291c){_0x3fdf9c=_0x3fdf9c-0x0;var _0x1158c1=_0x78d4[_0x3fdf9c];return _0x1158c1;};'use strict';var _=require('lodash');var util=require(_0x478d('0x0'));var moment=require(_0x478d('0x1'));var BPromise=require(_0x478d('0x2'));var rs=require(_0x478d('0x3'));var fs=require('fs');var Redis=require(_0x478d('0x4'));var db=require(_0x478d('0x5'))['db'];var utils=require(_0x478d('0x6'));var logger=require(_0x478d('0x7'))(_0x478d('0x8'));var config=require(_0x478d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x478d('0xa')][_0x478d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf6a43c,_0x5d2750,_0x40addd){return new BPromise(function(_0x4da503,_0x56f369){return client[_0x478d('0xc')](_0xf6a43c,_0x40addd)[_0x478d('0xd')](function(_0x2b7758){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x5d2750,_0x478d('0xe'));logger['debug'](_0x478d('0xf'),_0x5d2750,'request\x20sent',JSON[_0x478d('0x10')](_0x2b7758));if(_0x2b7758[_0x478d('0x11')]){if(_0x2b7758[_0x478d('0x11')][_0x478d('0x12')]===0x1f4){logger[_0x478d('0x11')](_0x478d('0x13'),_0x5d2750,_0x2b7758[_0x478d('0x11')][_0x478d('0x14')]);return _0x56f369(_0x2b7758['error'][_0x478d('0x14')]);}logger[_0x478d('0x11')](_0x478d('0x13'),_0x5d2750,_0x2b7758[_0x478d('0x11')]['message']);return _0x4da503(_0x2b7758['error']['message']);}else{logger['info'](_0x478d('0x13'),_0x5d2750,_0x478d('0xe'));_0x4da503(_0x2b7758['result']['message']);}})[_0x478d('0x15')](function(_0x4602cd){logger[_0x478d('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x5d2750,_0x4602cd);_0x56f369(_0x4602cd);});});}exports['CreateSmsQueueReport']=function(_0xdcb5cc){var _0x3d6d31=this;return new Promise(function(_0x3d132e,_0x2f4d89){return db[_0x478d('0x16')][_0x478d('0x17')](_0xdcb5cc[_0x478d('0x18')],{'raw':_0xdcb5cc['options']?_0xdcb5cc[_0x478d('0x19')][_0x478d('0x1a')]===undefined?!![]:![]:!![]})[_0x478d('0xd')](function(_0x561351){logger[_0x478d('0x1b')]('CreateSmsQueueReport',_0xdcb5cc);logger[_0x478d('0x1c')]('CreateSmsQueueReport',_0xdcb5cc,JSON['stringify'](_0x561351));_0x3d132e(_0x561351);})[_0x478d('0x15')](function(_0x89ec67){logger[_0x478d('0x11')](_0x478d('0x1d'),_0x89ec67['message'],_0xdcb5cc);_0x2f4d89(_0x3d6d31[_0x478d('0x11')](0x1f4,_0x89ec67[_0x478d('0x14')]));});});};exports[_0x478d('0x1e')]=function(_0x100352){var _0x1a6a44=this;return new Promise(function(_0x508c36,_0x4f4bab){return db['SmsQueueReport'][_0x478d('0x1f')](_0x100352[_0x478d('0x18')],{'raw':_0x100352['options']?_0x100352[_0x478d('0x19')][_0x478d('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x100352[_0x478d('0x19')]?_0x100352[_0x478d('0x19')][_0x478d('0x20')]||null:null,'attributes':_0x100352[_0x478d('0x19')]?_0x100352[_0x478d('0x19')][_0x478d('0x21')]||null:null,'limit':_0x100352[_0x478d('0x19')]?_0x100352[_0x478d('0x19')]['limit']||null:null})['then'](function(_0x36d8d4){logger[_0x478d('0x1b')](_0x478d('0x1e'),_0x100352);logger[_0x478d('0x1c')]('UpdateSmsQueueReport',_0x100352,JSON[_0x478d('0x10')](_0x36d8d4));_0x508c36(_0x36d8d4);})[_0x478d('0x15')](function(_0x317ca3){logger[_0x478d('0x11')](_0x478d('0x1e'),_0x317ca3[_0x478d('0x14')],_0x100352);_0x4f4bab(_0x1a6a44['error'](0x1f4,_0x317ca3['message']));});});}; \ No newline at end of file +var _0x18e8=['../../config/utils','rpc','jayson/promise','client','http','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','create','options','raw','then','CreateSmsQueueReport','UpdateSmsQueueReport','SmsQueueReport','attributes','limit','stringify','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x31d7b3,_0x382ac4){var _0x5cbc20=function(_0x521d0a){while(--_0x521d0a){_0x31d7b3['push'](_0x31d7b3['shift']());}};_0x5cbc20(++_0x382ac4);}(_0x18e8,0x77));var _0x818e=function(_0x1bfe7f,_0x569199){_0x1bfe7f=_0x1bfe7f-0x0;var _0x2d569f=_0x18e8[_0x1bfe7f];return _0x2d569f;};'use strict';var _=require(_0x818e('0x0'));var util=require(_0x818e('0x1'));var moment=require('moment');var BPromise=require(_0x818e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x818e('0x3'));var db=require(_0x818e('0x4'))['db'];var utils=require(_0x818e('0x5'));var logger=require('../../config/logger')(_0x818e('0x6'));var config=require('../../config/environment');var jayson=require(_0x818e('0x7'));var client=jayson[_0x818e('0x8')][_0x818e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf02c5,_0x4583f2,_0x4d6923){return new BPromise(function(_0x5d3a85,_0x1e2fe8){return client[_0x818e('0xa')](_0xf02c5,_0x4d6923)['then'](function(_0x30d981){logger[_0x818e('0xb')](_0x818e('0xc'),_0x4583f2,_0x818e('0xd'));logger[_0x818e('0xe')](_0x818e('0xf'),_0x4583f2,_0x818e('0xd'),JSON['stringify'](_0x30d981));if(_0x30d981['error']){if(_0x30d981[_0x818e('0x10')][_0x818e('0x11')]===0x1f4){logger[_0x818e('0x10')](_0x818e('0xc'),_0x4583f2,_0x30d981[_0x818e('0x10')][_0x818e('0x12')]);return _0x1e2fe8(_0x30d981[_0x818e('0x10')]['message']);}logger[_0x818e('0x10')](_0x818e('0xc'),_0x4583f2,_0x30d981[_0x818e('0x10')][_0x818e('0x12')]);return _0x5d3a85(_0x30d981['error'][_0x818e('0x12')]);}else{logger['info'](_0x818e('0xc'),_0x4583f2,_0x818e('0xd'));_0x5d3a85(_0x30d981[_0x818e('0x13')][_0x818e('0x12')]);}})[_0x818e('0x14')](function(_0x40e6e5){logger[_0x818e('0x10')](_0x818e('0xc'),_0x4583f2,_0x40e6e5);_0x1e2fe8(_0x40e6e5);});});}exports['CreateSmsQueueReport']=function(_0x1f0007){var _0x1b9fc4=this;return new Promise(function(_0x2eef40,_0x1ede55){return db['SmsQueueReport'][_0x818e('0x15')](_0x1f0007['body'],{'raw':_0x1f0007[_0x818e('0x16')]?_0x1f0007['options'][_0x818e('0x17')]===undefined?!![]:![]:!![]})[_0x818e('0x18')](function(_0x117a6e){logger[_0x818e('0xb')](_0x818e('0x19'),_0x1f0007);logger[_0x818e('0xe')]('CreateSmsQueueReport',_0x1f0007,JSON['stringify'](_0x117a6e));_0x2eef40(_0x117a6e);})[_0x818e('0x14')](function(_0x17862e){logger[_0x818e('0x10')](_0x818e('0x19'),_0x17862e[_0x818e('0x12')],_0x1f0007);_0x1ede55(_0x1b9fc4[_0x818e('0x10')](0x1f4,_0x17862e[_0x818e('0x12')]));});});};exports[_0x818e('0x1a')]=function(_0x1a1290){var _0x243980=this;return new Promise(function(_0x13d6d6,_0xe318bb){return db[_0x818e('0x1b')]['update'](_0x1a1290['body'],{'raw':_0x1a1290[_0x818e('0x16')]?_0x1a1290[_0x818e('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a1290[_0x818e('0x16')]?_0x1a1290['options']['where']||null:null,'attributes':_0x1a1290['options']?_0x1a1290['options'][_0x818e('0x1c')]||null:null,'limit':_0x1a1290[_0x818e('0x16')]?_0x1a1290[_0x818e('0x16')][_0x818e('0x1d')]||null:null})[_0x818e('0x18')](function(_0x4e4589){logger[_0x818e('0xb')](_0x818e('0x1a'),_0x1a1290);logger['debug'](_0x818e('0x1a'),_0x1a1290,JSON[_0x818e('0x1e')](_0x4e4589));_0x13d6d6(_0x4e4589);})[_0x818e('0x14')](function(_0x3d4d5e){logger['error'](_0x818e('0x1a'),_0x3d4d5e[_0x818e('0x12')],_0x1a1290);_0xe318bb(_0x243980['error'](0x1f4,_0x3d4d5e['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 056e25b..d9aac80 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 _0x31f0=['./smsTransferReport.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x346a67,_0x2b229a){var _0x53fc6e=function(_0x34c512){while(--_0x34c512){_0x346a67['push'](_0x346a67['shift']());}};_0x53fc6e(++_0x2b229a);}(_0x31f0,0xb7));var _0x031f=function(_0x4b423c,_0x456bb9){_0x4b423c=_0x4b423c-0x0;var _0x3588de=_0x31f0[_0x4b423c];return _0x3588de;};'use strict';var multer=require(_0x031f('0x0'));var util=require('util');var path=require(_0x031f('0x1'));var timeout=require('connect-timeout');var express=require(_0x031f('0x2'));var router=express[_0x031f('0x3')]();var fs_extra=require(_0x031f('0x4'));var auth=require(_0x031f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x031f('0x6'));var controller=require(_0x031f('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x031f('0x8')]('/describe',auth[_0x031f('0x9')](),controller[_0x031f('0xa')]);router[_0x031f('0x8')](_0x031f('0xb'),auth['isAuthenticated'](),controller[_0x031f('0xc')]);router[_0x031f('0xd')]('/',auth[_0x031f('0x9')](),controller[_0x031f('0xe')]);router[_0x031f('0xf')](_0x031f('0xb'),auth[_0x031f('0x9')](),controller[_0x031f('0x10')]);router['delete'](_0x031f('0xb'),auth[_0x031f('0x9')](),controller[_0x031f('0x11')]);module[_0x031f('0x12')]=router; \ No newline at end of file +var _0x9957=['show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x26826e,_0x4926fb){var _0x410b33=function(_0x542106){while(--_0x542106){_0x26826e['push'](_0x26826e['shift']());}};_0x410b33(++_0x4926fb);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0xf')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')](_0x7995('0x12'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);module[_0x7995('0x16')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 65c9485..7dd8186 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x5f0216,_0x3bb187){var _0x95289a=function(_0x29e39d){while(--_0x29e39d){_0x5f0216['push'](_0x5f0216['shift']());}};_0x95289a(++_0x3bb187);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1f27df,_0x4f1a64){_0x1f27df=_0x1f27df-0x0;var _0x286ee2=_0xcb91[_0x1f27df];return _0x286ee2;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x2c0c8d,_0x4a86c7){var _0x114e7a=function(_0x5ef296){while(--_0x5ef296){_0x2c0c8d['push'](_0x2c0c8d['shift']());}};_0x114e7a(++_0x4a86c7);}(_0x9c44,0x178));var _0x49c4=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9c44[_0x543084];return _0x306a57;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index a234632..089fdfa 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 _0x43c4=['model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','error','stack','name','send','index','map','SmsTransferReport','type','key','query','keys','filters'];(function(_0x299ce4,_0x4e4d4){var _0x378ed3=function(_0x5e2d7f){while(--_0x5e2d7f){_0x299ce4['push'](_0x299ce4['shift']());}};_0x378ed3(++_0x4e4d4);}(_0x43c4,0xf7));var _0x443c=function(_0x7c007d,_0x1b34af){_0x7c007d=_0x7c007d-0x0;var _0x148054=_0x43c4[_0x7c007d];return _0x148054;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x443c('0x0'));var zipdir=require(_0x443c('0x1'));var jsonpatch=require(_0x443c('0x2'));var rp=require(_0x443c('0x3'));var moment=require(_0x443c('0x4'));var BPromise=require(_0x443c('0x5'));var Mustache=require(_0x443c('0x6'));var util=require(_0x443c('0x7'));var path=require(_0x443c('0x8'));var sox=require('sox');var csv=require(_0x443c('0x9'));var ejs=require(_0x443c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x443c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x443c('0xc'));var deskjs=require(_0x443c('0xd'));var toCsv=require(_0x443c('0x9'));var querystring=require(_0x443c('0xe'));var Papa=require('papaparse');var Redis=require(_0x443c('0xf'));var authService=require(_0x443c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x443c('0x11'));var hardwareService=require(_0x443c('0x12'));var logger=require(_0x443c('0x13'))(_0x443c('0x14'));var utils=require(_0x443c('0x15'));var config=require(_0x443c('0x16'));var licenseUtil=require(_0x443c('0x17'));var db=require(_0x443c('0x18'))['db'];function respondWithStatusCode(_0x4a6524,_0x313d5a){_0x313d5a=_0x313d5a||0xcc;return function(_0x5175a1){if(_0x5175a1){return _0x4a6524[_0x443c('0x19')](_0x313d5a);}return _0x4a6524[_0x443c('0x1a')](_0x313d5a)[_0x443c('0x1b')]();};}function respondWithResult(_0x117012,_0x2868ce){_0x2868ce=_0x2868ce||0xc8;return function(_0x170552){if(_0x170552){return _0x117012['status'](_0x2868ce)[_0x443c('0x1c')](_0x170552);}};}function respondWithFilteredResult(_0x397105,_0x1c654e){return function(_0xd4a257){if(_0xd4a257){var _0x271a35=typeof _0x1c654e[_0x443c('0x1d')]===_0x443c('0x1e')&&typeof _0x1c654e[_0x443c('0x1f')]===_0x443c('0x1e');var _0x3338fe=_0xd4a257[_0x443c('0x20')];var _0x4e2662=_0x271a35?0x0:_0x1c654e['offset'];var _0x244de7=_0x271a35?_0xd4a257['count']:_0x1c654e[_0x443c('0x1d')]+_0x1c654e[_0x443c('0x1f')];var _0x12fb18;if(_0x244de7>=_0x3338fe){_0x244de7=_0x3338fe;_0x12fb18=0xc8;}else{_0x12fb18=0xce;}_0x397105[_0x443c('0x1a')](_0x12fb18);return _0x397105[_0x443c('0x21')](_0x443c('0x22'),_0x4e2662+'-'+_0x244de7+'/'+_0x3338fe)[_0x443c('0x1c')](_0xd4a257);}return null;};}function patchUpdates(_0x106eda){return function(_0x24041b){try{jsonpatch['apply'](_0x24041b,_0x106eda,!![]);}catch(_0x565528){return BPromise['reject'](_0x565528);}return _0x24041b['save']();};}function saveUpdates(_0x3c55bd,_0x2ed9a5){return function(_0x10a860){if(_0x10a860){return _0x10a860['update'](_0x3c55bd)[_0x443c('0x23')](function(_0x5bf90d){return _0x5bf90d;});}return null;};}function removeEntity(_0x314e99,_0x114b97){return function(_0x1c8f01){if(_0x1c8f01){return _0x1c8f01[_0x443c('0x24')]()[_0x443c('0x23')](function(){_0x314e99[_0x443c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x102ccb,_0x4a74a9){return function(_0xce2868){if(!_0xce2868){_0x102ccb[_0x443c('0x19')](0x194);}return _0xce2868;};}function handleError(_0x3031b3,_0x16bf56){_0x16bf56=_0x16bf56||0x1f4;return function(_0x285c74){logger[_0x443c('0x25')](_0x285c74[_0x443c('0x26')]);if(_0x285c74[_0x443c('0x27')]){delete _0x285c74[_0x443c('0x27')];}_0x3031b3['status'](_0x16bf56)[_0x443c('0x28')](_0x285c74);};}exports[_0x443c('0x29')]=function(_0x3c4a8f,_0x12f2f3){var _0x1a209d={},_0x1a3547={},_0x1c863c={'count':0x0,'rows':[]};var _0x42c4b2=_[_0x443c('0x2a')](db[_0x443c('0x2b')]['rawAttributes'],function(_0x25a9d9){return{'name':_0x25a9d9['fieldName'],'type':_0x25a9d9[_0x443c('0x2c')][_0x443c('0x2d')]};});_0x1a3547['model']=_[_0x443c('0x2a')](_0x42c4b2,_0x443c('0x27'));_0x1a3547[_0x443c('0x2e')]=_[_0x443c('0x2f')](_0x3c4a8f[_0x443c('0x2e')]);_0x1a3547[_0x443c('0x30')]=_['intersection'](_0x1a3547[_0x443c('0x31')],_0x1a3547['query']);_0x1a209d[_0x443c('0x32')]=_[_0x443c('0x33')](_0x1a3547[_0x443c('0x31')],qs[_0x443c('0x34')](_0x3c4a8f[_0x443c('0x2e')][_0x443c('0x34')]));_0x1a209d[_0x443c('0x32')]=_0x1a209d[_0x443c('0x32')]['length']?_0x1a209d[_0x443c('0x32')]:_0x1a3547[_0x443c('0x31')];if(!_0x3c4a8f[_0x443c('0x2e')][_0x443c('0x35')](_0x443c('0x36'))){_0x1a209d[_0x443c('0x1f')]=qs[_0x443c('0x1f')](_0x3c4a8f[_0x443c('0x2e')][_0x443c('0x1f')]);_0x1a209d[_0x443c('0x1d')]=qs[_0x443c('0x1d')](_0x3c4a8f[_0x443c('0x2e')]['offset']);}_0x1a209d[_0x443c('0x37')]=qs[_0x443c('0x38')](_0x3c4a8f['query'][_0x443c('0x38')]);_0x1a209d['where']=qs[_0x443c('0x30')](_[_0x443c('0x39')](_0x3c4a8f['query'],_0x1a3547[_0x443c('0x30')]),_0x42c4b2);if(_0x3c4a8f[_0x443c('0x2e')]['filter']){_0x1a209d[_0x443c('0x3a')]=_[_0x443c('0x3b')](_0x1a209d[_0x443c('0x3a')],{'$or':_[_0x443c('0x2a')](_0x42c4b2,function(_0x961bfd){if(_0x961bfd[_0x443c('0x2c')]!==_0x443c('0x3c')){var _0x68bffc={};_0x68bffc[_0x961bfd[_0x443c('0x27')]]={'$like':'%'+_0x3c4a8f[_0x443c('0x2e')]['filter']+'%'};return _0x68bffc;}})});}_0x1a209d=_[_0x443c('0x3b')]({},_0x1a209d,_0x3c4a8f[_0x443c('0x3d')]);var _0x5d18e6={'where':_0x1a209d[_0x443c('0x3a')]};return db['SmsTransferReport']['count'](_0x5d18e6)[_0x443c('0x23')](function(_0x31c608){_0x1c863c['count']=_0x31c608;if(_0x3c4a8f['query'][_0x443c('0x3e')]){_0x1a209d[_0x443c('0x3f')]=[{'all':!![]}];}return db[_0x443c('0x2b')][_0x443c('0x40')](_0x1a209d);})['then'](function(_0x38dda7){_0x1c863c[_0x443c('0x41')]=_0x38dda7;return _0x1c863c;})['then'](respondWithFilteredResult(_0x12f2f3,_0x1a209d))[_0x443c('0x42')](handleError(_0x12f2f3,null));};exports[_0x443c('0x43')]=function(_0xbc998b,_0x4220c2){var _0x11ad8b={'raw':!![],'where':{'id':_0xbc998b[_0x443c('0x44')]['id']}},_0x2c778b={};_0x2c778b[_0x443c('0x31')]=_[_0x443c('0x2f')](db['SmsTransferReport'][_0x443c('0x45')]);_0x2c778b[_0x443c('0x2e')]=_[_0x443c('0x2f')](_0xbc998b[_0x443c('0x2e')]);_0x2c778b['filters']=_['intersection'](_0x2c778b['model'],_0x2c778b['query']);_0x11ad8b[_0x443c('0x32')]=_[_0x443c('0x33')](_0x2c778b[_0x443c('0x31')],qs[_0x443c('0x34')](_0xbc998b[_0x443c('0x2e')][_0x443c('0x34')]));_0x11ad8b[_0x443c('0x32')]=_0x11ad8b[_0x443c('0x32')]['length']?_0x11ad8b['attributes']:_0x2c778b[_0x443c('0x31')];if(_0xbc998b[_0x443c('0x2e')][_0x443c('0x3e')]){_0x11ad8b['include']=[{'all':!![]}];}_0x11ad8b=_[_0x443c('0x3b')]({},_0x11ad8b,_0xbc998b[_0x443c('0x3d')]);return db[_0x443c('0x2b')][_0x443c('0x46')](_0x11ad8b)[_0x443c('0x23')](handleEntityNotFound(_0x4220c2,null))[_0x443c('0x23')](respondWithResult(_0x4220c2,null))['catch'](handleError(_0x4220c2,null));};exports[_0x443c('0x47')]=function(_0x23b19c,_0x310baf){return db[_0x443c('0x2b')]['create'](_0x23b19c['body'],{})[_0x443c('0x23')](respondWithResult(_0x310baf,0xc9))[_0x443c('0x42')](handleError(_0x310baf,null));};exports['update']=function(_0x4bd43b,_0x1796aa){if(_0x4bd43b[_0x443c('0x48')]['id']){delete _0x4bd43b[_0x443c('0x48')]['id'];}return db[_0x443c('0x2b')][_0x443c('0x46')]({'where':{'id':_0x4bd43b[_0x443c('0x44')]['id']}})['then'](handleEntityNotFound(_0x1796aa,null))[_0x443c('0x23')](saveUpdates(_0x4bd43b[_0x443c('0x48')],null))[_0x443c('0x23')](respondWithResult(_0x1796aa,null))[_0x443c('0x42')](handleError(_0x1796aa,null));};exports[_0x443c('0x24')]=function(_0x2a49f4,_0x277b0b){return db['SmsTransferReport'][_0x443c('0x46')]({'where':{'id':_0x2a49f4[_0x443c('0x44')]['id']}})[_0x443c('0x23')](handleEntityNotFound(_0x277b0b,null))[_0x443c('0x23')](removeEntity(_0x277b0b,null))[_0x443c('0x42')](handleError(_0x277b0b,null));};exports[_0x443c('0x49')]=function(_0x43b6cc,_0x121db1){return db[_0x443c('0x2b')][_0x443c('0x49')]()[_0x443c('0x23')](respondWithResult(_0x121db1,null))[_0x443c('0x42')](handleError(_0x121db1,null));}; \ No newline at end of file +var _0x03e9=['fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','include','findAll','catch','params','includeAll','options','find','body','destroy','describe','eml-format','zip-dir','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','set','json','reject','save','update','then','status','stack','name','send','index','SmsTransferReport','rawAttributes','fieldName','key','map','keys','filters','intersection','model','query','attributes'];(function(_0x223c0d,_0x3ec04d){var _0x207827=function(_0x39d240){while(--_0x39d240){_0x223c0d['push'](_0x223c0d['shift']());}};_0x207827(++_0x3ec04d);}(_0x03e9,0x1cb));var _0x903e=function(_0x5add15,_0x2e6e1d){_0x5add15=_0x5add15-0x0;var _0xd863b8=_0x03e9[_0x5add15];return _0xd863b8;};'use strict';var emlformat=require(_0x903e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x903e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x903e('0x2'));var BPromise=require(_0x903e('0x3'));var Mustache=require(_0x903e('0x4'));var util=require(_0x903e('0x5'));var path=require(_0x903e('0x6'));var sox=require('sox');var csv=require(_0x903e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x903e('0x8'));var _=require(_0x903e('0x9'));var squel=require(_0x903e('0xa'));var crypto=require(_0x903e('0xb'));var jsforce=require(_0x903e('0xc'));var deskjs=require(_0x903e('0xd'));var toCsv=require(_0x903e('0x7'));var querystring=require('querystring');var Papa=require(_0x903e('0xe'));var Redis=require(_0x903e('0xf'));var authService=require(_0x903e('0x10'));var qs=require(_0x903e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x903e('0x12'))(_0x903e('0x13'));var utils=require(_0x903e('0x14'));var config=require(_0x903e('0x15'));var licenseUtil=require(_0x903e('0x16'));var db=require(_0x903e('0x17'))['db'];function respondWithStatusCode(_0x1d71c9,_0xd89f9c){_0xd89f9c=_0xd89f9c||0xcc;return function(_0x376fcf){if(_0x376fcf){return _0x1d71c9[_0x903e('0x18')](_0xd89f9c);}return _0x1d71c9['status'](_0xd89f9c)[_0x903e('0x19')]();};}function respondWithResult(_0x2155df,_0x11db3a){_0x11db3a=_0x11db3a||0xc8;return function(_0x29da43){if(_0x29da43){return _0x2155df['status'](_0x11db3a)['json'](_0x29da43);}};}function respondWithFilteredResult(_0x4aea75,_0x14a3b0){return function(_0x3aa31d){if(_0x3aa31d){var _0x3935ac=typeof _0x14a3b0[_0x903e('0x1a')]===_0x903e('0x1b')&&typeof _0x14a3b0[_0x903e('0x1c')]===_0x903e('0x1b');var _0x4f90f5=_0x3aa31d['count'];var _0x3d9234=_0x3935ac?0x0:_0x14a3b0['offset'];var _0x2a651c=_0x3935ac?_0x3aa31d[_0x903e('0x1d')]:_0x14a3b0[_0x903e('0x1a')]+_0x14a3b0[_0x903e('0x1c')];var _0x755e03;if(_0x2a651c>=_0x4f90f5){_0x2a651c=_0x4f90f5;_0x755e03=0xc8;}else{_0x755e03=0xce;}_0x4aea75['status'](_0x755e03);return _0x4aea75[_0x903e('0x1e')]('Content-Range',_0x3d9234+'-'+_0x2a651c+'/'+_0x4f90f5)[_0x903e('0x1f')](_0x3aa31d);}return null;};}function patchUpdates(_0x4ef771){return function(_0x23746b){try{jsonpatch['apply'](_0x23746b,_0x4ef771,!![]);}catch(_0x1bf285){return BPromise[_0x903e('0x20')](_0x1bf285);}return _0x23746b[_0x903e('0x21')]();};}function saveUpdates(_0x46d913,_0x563960){return function(_0xa84100){if(_0xa84100){return _0xa84100[_0x903e('0x22')](_0x46d913)[_0x903e('0x23')](function(_0x5da45d){return _0x5da45d;});}return null;};}function removeEntity(_0xca12d4,_0x512269){return function(_0xcb386d){if(_0xcb386d){return _0xcb386d['destroy']()[_0x903e('0x23')](function(){_0xca12d4[_0x903e('0x24')](0xcc)[_0x903e('0x19')]();});}};}function handleEntityNotFound(_0x443cf0,_0x552787){return function(_0x3ceccb){if(!_0x3ceccb){_0x443cf0[_0x903e('0x18')](0x194);}return _0x3ceccb;};}function handleError(_0x530bb4,_0x30702b){_0x30702b=_0x30702b||0x1f4;return function(_0x2e7b73){logger['error'](_0x2e7b73[_0x903e('0x25')]);if(_0x2e7b73[_0x903e('0x26')]){delete _0x2e7b73[_0x903e('0x26')];}_0x530bb4[_0x903e('0x24')](_0x30702b)[_0x903e('0x27')](_0x2e7b73);};}exports[_0x903e('0x28')]=function(_0x54b74e,_0x514e3d){var _0x541894={},_0x2a5e80={},_0x525b53={'count':0x0,'rows':[]};var _0x4bda4c=_['map'](db[_0x903e('0x29')][_0x903e('0x2a')],function(_0x880344){return{'name':_0x880344[_0x903e('0x2b')],'type':_0x880344['type'][_0x903e('0x2c')]};});_0x2a5e80['model']=_[_0x903e('0x2d')](_0x4bda4c,_0x903e('0x26'));_0x2a5e80['query']=_[_0x903e('0x2e')](_0x54b74e['query']);_0x2a5e80[_0x903e('0x2f')]=_[_0x903e('0x30')](_0x2a5e80[_0x903e('0x31')],_0x2a5e80[_0x903e('0x32')]);_0x541894[_0x903e('0x33')]=_['intersection'](_0x2a5e80[_0x903e('0x31')],qs[_0x903e('0x34')](_0x54b74e['query'][_0x903e('0x34')]));_0x541894[_0x903e('0x33')]=_0x541894[_0x903e('0x33')][_0x903e('0x35')]?_0x541894[_0x903e('0x33')]:_0x2a5e80['model'];if(!_0x54b74e[_0x903e('0x32')][_0x903e('0x36')](_0x903e('0x37'))){_0x541894[_0x903e('0x1c')]=qs[_0x903e('0x1c')](_0x54b74e[_0x903e('0x32')][_0x903e('0x1c')]);_0x541894[_0x903e('0x1a')]=qs[_0x903e('0x1a')](_0x54b74e[_0x903e('0x32')][_0x903e('0x1a')]);}_0x541894[_0x903e('0x38')]=qs[_0x903e('0x39')](_0x54b74e['query'][_0x903e('0x39')]);_0x541894[_0x903e('0x3a')]=qs['filters'](_['pick'](_0x54b74e['query'],_0x2a5e80[_0x903e('0x2f')]),_0x4bda4c);if(_0x54b74e[_0x903e('0x32')]['filter']){_0x541894[_0x903e('0x3a')]=_[_0x903e('0x3b')](_0x541894[_0x903e('0x3a')],{'$or':_[_0x903e('0x2d')](_0x4bda4c,function(_0x628424){if(_0x628424[_0x903e('0x3c')]!==_0x903e('0x3d')){var _0x579da7={};_0x579da7[_0x628424['name']]={'$like':'%'+_0x54b74e['query'][_0x903e('0x3e')]+'%'};return _0x579da7;}})});}_0x541894=_[_0x903e('0x3b')]({},_0x541894,_0x54b74e['options']);var _0x44e9b0={'where':_0x541894['where']};return db[_0x903e('0x29')][_0x903e('0x1d')](_0x44e9b0)[_0x903e('0x23')](function(_0xf6bb94){_0x525b53[_0x903e('0x1d')]=_0xf6bb94;if(_0x54b74e[_0x903e('0x32')]['includeAll']){_0x541894[_0x903e('0x3f')]=[{'all':!![]}];}return db[_0x903e('0x29')][_0x903e('0x40')](_0x541894);})[_0x903e('0x23')](function(_0x4682ab){_0x525b53['rows']=_0x4682ab;return _0x525b53;})[_0x903e('0x23')](respondWithFilteredResult(_0x514e3d,_0x541894))[_0x903e('0x41')](handleError(_0x514e3d,null));};exports['show']=function(_0x168971,_0x5e8997){var _0x3c366a={'raw':!![],'where':{'id':_0x168971[_0x903e('0x42')]['id']}},_0x21b54={};_0x21b54[_0x903e('0x31')]=_[_0x903e('0x2e')](db[_0x903e('0x29')][_0x903e('0x2a')]);_0x21b54['query']=_['keys'](_0x168971['query']);_0x21b54['filters']=_[_0x903e('0x30')](_0x21b54['model'],_0x21b54[_0x903e('0x32')]);_0x3c366a['attributes']=_['intersection'](_0x21b54[_0x903e('0x31')],qs[_0x903e('0x34')](_0x168971[_0x903e('0x32')]['fields']));_0x3c366a[_0x903e('0x33')]=_0x3c366a[_0x903e('0x33')][_0x903e('0x35')]?_0x3c366a[_0x903e('0x33')]:_0x21b54[_0x903e('0x31')];if(_0x168971['query'][_0x903e('0x43')]){_0x3c366a['include']=[{'all':!![]}];}_0x3c366a=_[_0x903e('0x3b')]({},_0x3c366a,_0x168971[_0x903e('0x44')]);return db[_0x903e('0x29')][_0x903e('0x45')](_0x3c366a)[_0x903e('0x23')](handleEntityNotFound(_0x5e8997,null))[_0x903e('0x23')](respondWithResult(_0x5e8997,null))[_0x903e('0x41')](handleError(_0x5e8997,null));};exports['create']=function(_0x2b4119,_0x7416f5){return db['SmsTransferReport']['create'](_0x2b4119[_0x903e('0x46')],{})[_0x903e('0x23')](respondWithResult(_0x7416f5,0xc9))[_0x903e('0x41')](handleError(_0x7416f5,null));};exports[_0x903e('0x22')]=function(_0x40b349,_0x1ca5ae){if(_0x40b349[_0x903e('0x46')]['id']){delete _0x40b349[_0x903e('0x46')]['id'];}return db[_0x903e('0x29')][_0x903e('0x45')]({'where':{'id':_0x40b349[_0x903e('0x42')]['id']}})[_0x903e('0x23')](handleEntityNotFound(_0x1ca5ae,null))[_0x903e('0x23')](saveUpdates(_0x40b349[_0x903e('0x46')],null))[_0x903e('0x23')](respondWithResult(_0x1ca5ae,null))[_0x903e('0x41')](handleError(_0x1ca5ae,null));};exports[_0x903e('0x47')]=function(_0x334b22,_0x51cef3){return db[_0x903e('0x29')][_0x903e('0x45')]({'where':{'id':_0x334b22[_0x903e('0x42')]['id']}})[_0x903e('0x23')](handleEntityNotFound(_0x51cef3,null))[_0x903e('0x23')](removeEntity(_0x51cef3,null))['catch'](handleError(_0x51cef3,null));};exports[_0x903e('0x48')]=function(_0xa72874,_0x28d1e4){return db[_0x903e('0x29')]['describe']()[_0x903e('0x23')](respondWithResult(_0x28d1e4,null))[_0x903e('0x41')](handleError(_0x28d1e4,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index d5becdf..cff2edb 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 _0x4aa3=['lodash','util','api','moment','request-promise','path','../../config/environment','./smsTransferReport.attributes','exports','define','report_sms_transfer','uniqueid'];(function(_0x5ac0f0,_0xee4d98){var _0x4aceec=function(_0x3a9044){while(--_0x3a9044){_0x5ac0f0['push'](_0x5ac0f0['shift']());}};_0x4aceec(++_0xee4d98);}(_0x4aa3,0x174));var _0x34aa=function(_0x54ab57,_0x52b51c){_0x54ab57=_0x54ab57-0x0;var _0x404da6=_0x4aa3[_0x54ab57];return _0x404da6;};'use strict';var _=require(_0x34aa('0x0'));var util=require(_0x34aa('0x1'));var logger=require('../../config/logger')(_0x34aa('0x2'));var moment=require(_0x34aa('0x3'));var BPromise=require('bluebird');var rp=require(_0x34aa('0x4'));var fs=require('fs');var path=require(_0x34aa('0x5'));var rimraf=require('rimraf');var config=require(_0x34aa('0x6'));var attributes=require(_0x34aa('0x7'));module[_0x34aa('0x8')]=function(_0x5a717c,_0x201f69){return _0x5a717c[_0x34aa('0x9')]('SmsTransferReport',attributes,{'tableName':_0x34aa('0xa'),'paranoid':![],'indexes':[{'name':_0x34aa('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb26e=['path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','moment','bluebird'];(function(_0x56620d,_0x5dbf9a){var _0x566009=function(_0x52c799){while(--_0x52c799){_0x56620d['push'](_0x56620d['shift']());}};_0x566009(++_0x5dbf9a);}(_0xb26e,0x11d));var _0xeb26=function(_0x3e55f9,_0x1bd3b0){_0x3e55f9=_0x3e55f9-0x0;var _0x11bf89=_0xb26e[_0x3e55f9];return _0x11bf89;};'use strict';var _=require(_0xeb26('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xeb26('0x1'));var BPromise=require(_0xeb26('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb26('0x3'));var rimraf=require(_0xeb26('0x4'));var config=require(_0xeb26('0x5'));var attributes=require(_0xeb26('0x6'));module[_0xeb26('0x7')]=function(_0x17f489,_0x2351f9){return _0x17f489[_0xeb26('0x8')](_0xeb26('0x9'),attributes,{'tableName':_0xeb26('0xa'),'paranoid':![],'indexes':[{'name':_0xeb26('0xb'),'fields':[_0xeb26('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 0e864d2..746eea8 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 _0xa9b1=['http','request','then','info','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','SmsTransferReport,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client'];(function(_0xc12ef4,_0x4f69c2){var _0x32cf98=function(_0x17cbb6){while(--_0x17cbb6){_0xc12ef4['push'](_0xc12ef4['shift']());}};_0x32cf98(++_0x4f69c2);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1a9b('0x0'));var BPromise=require(_0x1a9b('0x1'));var rs=require(_0x1a9b('0x2'));var fs=require('fs');var Redis=require(_0x1a9b('0x3'));var db=require(_0x1a9b('0x4'))['db'];var utils=require(_0x1a9b('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x1a9b('0x6'));var client=jayson[_0x1a9b('0x7')][_0x1a9b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc55657,_0x32cff5,_0x16c344){return new BPromise(function(_0x263b84,_0x16e01a){return client[_0x1a9b('0x9')](_0xc55657,_0x16c344)[_0x1a9b('0xa')](function(_0x162d6a){logger[_0x1a9b('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x32cff5,'request\x20sent');logger[_0x1a9b('0xc')](_0x1a9b('0xd'),_0x32cff5,_0x1a9b('0xe'),JSON['stringify'](_0x162d6a));if(_0x162d6a['error']){if(_0x162d6a['error'][_0x1a9b('0xf')]===0x1f4){logger[_0x1a9b('0x10')](_0x1a9b('0x11'),_0x32cff5,_0x162d6a[_0x1a9b('0x10')][_0x1a9b('0x12')]);return _0x16e01a(_0x162d6a[_0x1a9b('0x10')]['message']);}logger[_0x1a9b('0x10')](_0x1a9b('0x11'),_0x32cff5,_0x162d6a[_0x1a9b('0x10')]['message']);return _0x263b84(_0x162d6a[_0x1a9b('0x10')][_0x1a9b('0x12')]);}else{logger['info'](_0x1a9b('0x11'),_0x32cff5,'request\x20sent');_0x263b84(_0x162d6a[_0x1a9b('0x13')][_0x1a9b('0x12')]);}})[_0x1a9b('0x14')](function(_0x3903b7){logger[_0x1a9b('0x10')](_0x1a9b('0x11'),_0x32cff5,_0x3903b7);_0x16e01a(_0x3903b7);});});} \ No newline at end of file +var _0xc23a=['jayson/promise','client','request','then','info','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsTransferReport,\x20%s,\x20%s','message','catch','util','moment','bluebird','ioredis','../../config/logger','../../config/environment'];(function(_0x134b0d,_0x25f638){var _0x49f6b7=function(_0x476374){while(--_0x476374){_0x134b0d['push'](_0x134b0d['shift']());}};_0x49f6b7(++_0x25f638);}(_0xc23a,0xd2));var _0xac23=function(_0x421263,_0x18187d){_0x421263=_0x421263-0x0;var _0x34e4b5=_0xc23a[_0x421263];return _0x34e4b5;};'use strict';var _=require('lodash');var util=require(_0xac23('0x0'));var moment=require(_0xac23('0x1'));var BPromise=require(_0xac23('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac23('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xac23('0x4'))('rpc');var config=require(_0xac23('0x5'));var jayson=require(_0xac23('0x6'));var client=jayson[_0xac23('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47b021,_0x44b7d2,_0x3b6647){return new BPromise(function(_0x20342c,_0x5b2705){return client[_0xac23('0x8')](_0x47b021,_0x3b6647)[_0xac23('0x9')](function(_0x3f5fa6){logger[_0xac23('0xa')]('SmsTransferReport,\x20%s,\x20%s',_0x44b7d2,'request\x20sent');logger['debug'](_0xac23('0xb'),_0x44b7d2,_0xac23('0xc'),JSON['stringify'](_0x3f5fa6));if(_0x3f5fa6[_0xac23('0xd')]){if(_0x3f5fa6[_0xac23('0xd')][_0xac23('0xe')]===0x1f4){logger[_0xac23('0xd')](_0xac23('0xf'),_0x44b7d2,_0x3f5fa6[_0xac23('0xd')][_0xac23('0x10')]);return _0x5b2705(_0x3f5fa6[_0xac23('0xd')][_0xac23('0x10')]);}logger[_0xac23('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x44b7d2,_0x3f5fa6[_0xac23('0xd')][_0xac23('0x10')]);return _0x20342c(_0x3f5fa6['error']['message']);}else{logger[_0xac23('0xa')](_0xac23('0xf'),_0x44b7d2,_0xac23('0xc'));_0x20342c(_0x3f5fa6['result'][_0xac23('0x10')]);}})[_0xac23('0x11')](function(_0xaf49de){logger[_0xac23('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x44b7d2,_0xaf49de);_0x5b2705(_0xaf49de);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 0dd33f8..b871862 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 _0x9bbe=['../../components/interaction/service','./sound.controller','get','index','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname','now','file','create','put','/:id','isAuthenticated','update','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1e9df3,_0x3ec5ea){var _0x4ae252=function(_0x2ac97e){while(--_0x2ac97e){_0x1e9df3['push'](_0x1e9df3['shift']());}};_0x4ae252(++_0x3ec5ea);}(_0x9bbe,0x95));var _0xe9bb=function(_0x47d2ea,_0x45870b){_0x47d2ea=_0x47d2ea-0x0;var _0x2578bf=_0x9bbe[_0x47d2ea];return _0x2578bf;};'use strict';var multer=require(_0xe9bb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe9bb('0x1'));var express=require(_0xe9bb('0x2'));var router=express[_0xe9bb('0x3')]();var fs_extra=require(_0xe9bb('0x4'));var auth=require(_0xe9bb('0x5'));var interaction=require(_0xe9bb('0x6'));var config=require('../../config/environment');var controller=require(_0xe9bb('0x7'));router[_0xe9bb('0x8')]('/',auth['isAuthenticated'](),controller[_0xe9bb('0x9')]);router[_0xe9bb('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xe9bb('0xa')]);router['get'](_0xe9bb('0xb'),auth['isAuthenticated'](),controller[_0xe9bb('0xc')]);var upload=multer({'storage':multer[_0xe9bb('0xd')]({'destination':function(_0x40ec73,_0x349b67,_0x40e2bd){_0x40e2bd(null,path[_0xe9bb('0xe')](config[_0xe9bb('0xf')],_0xe9bb('0x10')));},'filename':function(_0x470a31,_0x2ad8f2,_0x1c06ce){_0x2ad8f2[_0xe9bb('0x11')]=_0x2ad8f2[_0xe9bb('0x11')][_0xe9bb('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1c06ce(null,util[_0xe9bb('0x13')](_0xe9bb('0x14'),path['basename'](_0x2ad8f2[_0xe9bb('0x11')],path[_0xe9bb('0x15')](_0x2ad8f2['originalname'])),Date[_0xe9bb('0x16')](),path[_0xe9bb('0x15')](_0x2ad8f2[_0xe9bb('0x11')])));}})});router['post']('/',upload['single'](_0xe9bb('0x17')),controller[_0xe9bb('0x18')]);router[_0xe9bb('0x19')](_0xe9bb('0x1a'),auth[_0xe9bb('0x1b')](),controller[_0xe9bb('0x1c')]);router['delete'](_0xe9bb('0x1a'),auth[_0xe9bb('0x1b')](),controller[_0xe9bb('0x1d')]);module[_0xe9bb('0x1e')]=router; \ No newline at end of file +var _0xf6e7=['/:id','show','download','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname','now','single','file','create','put','update','delete','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','get'];(function(_0x3bd2c1,_0x5d722f){var _0x1ca520=function(_0x1e7b99){while(--_0x1e7b99){_0x3bd2c1['push'](_0x3bd2c1['shift']());}};_0x1ca520(++_0x5d722f);}(_0xf6e7,0x18c));var _0x7f6e=function(_0x4f00ba,_0x5439a5){_0x4f00ba=_0x4f00ba-0x0;var _0x5447a7=_0xf6e7[_0x4f00ba];return _0x5447a7;};'use strict';var multer=require('multer');var util=require(_0x7f6e('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7f6e('0x1'));var router=express[_0x7f6e('0x2')]();var fs_extra=require(_0x7f6e('0x3'));var auth=require(_0x7f6e('0x4'));var interaction=require(_0x7f6e('0x5'));var config=require(_0x7f6e('0x6'));var controller=require(_0x7f6e('0x7'));router['get']('/',auth[_0x7f6e('0x8')](),controller['index']);router[_0x7f6e('0x9')](_0x7f6e('0xa'),auth[_0x7f6e('0x8')](),controller[_0x7f6e('0xb')]);router[_0x7f6e('0x9')]('/:id/download',auth[_0x7f6e('0x8')](),controller[_0x7f6e('0xc')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x411600,_0x20938e,_0x5d3d6d){_0x5d3d6d(null,path[_0x7f6e('0xd')](config[_0x7f6e('0xe')],_0x7f6e('0xf')));},'filename':function(_0x234fe6,_0x422267,_0x2a6496){_0x422267[_0x7f6e('0x10')]=_0x422267['originalname'][_0x7f6e('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2a6496(null,util[_0x7f6e('0x12')](_0x7f6e('0x13'),path['basename'](_0x422267[_0x7f6e('0x10')],path[_0x7f6e('0x14')](_0x422267['originalname'])),Date[_0x7f6e('0x15')](),path['extname'](_0x422267[_0x7f6e('0x10')])));}})});router['post']('/',upload[_0x7f6e('0x16')](_0x7f6e('0x17')),controller[_0x7f6e('0x18')]);router[_0x7f6e('0x19')](_0x7f6e('0xa'),auth[_0x7f6e('0x8')](),controller[_0x7f6e('0x1a')]);router[_0x7f6e('0x1b')](_0x7f6e('0xa'),auth[_0x7f6e('0x8')](),controller[_0x7f6e('0x1b')]);module[_0x7f6e('0x1c')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 3a4bf77..7d2999e 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 _0x5861=['exports','STRING','name','INTEGER','FLOAT','BIGINT'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x5861,0x114));var _0x1586=function(_0xa7f6b0,_0x34a14d){_0xa7f6b0=_0xa7f6b0-0x0;var _0x1548bb=_0x5861[_0xa7f6b0];return _0x1548bb;};'use strict';var Sequelize=require('sequelize');module[_0x1586('0x0')]={'name':{'type':Sequelize[_0x1586('0x1')],'unique':_0x1586('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x1586('0x1')]},'display_name':{'type':Sequelize[_0x1586('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x1586('0x1')]},'original_format':{'type':Sequelize[_0x1586('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x1586('0x3')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x1586('0x3')]},'converted_format':{'type':Sequelize[_0x1586('0x1')]},'converted_duration':{'type':Sequelize[_0x1586('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x1586('0x5')]},'converted_channelCount':{'type':Sequelize[_0x1586('0x3')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xac68=['sequelize','exports','STRING','name','FLOAT','BIGINT','INTEGER'];(function(_0x5b423a,_0x49b29b){var _0x538f8b=function(_0x2cc39a){while(--_0x2cc39a){_0x5b423a['push'](_0x5b423a['shift']());}};_0x538f8b(++_0x49b29b);}(_0xac68,0xaf));var _0x8ac6=function(_0x2e41e2,_0x4e7250){_0x2e41e2=_0x2e41e2-0x0;var _0x2844d6=_0xac68[_0x2e41e2];return _0x2844d6;};'use strict';var Sequelize=require(_0x8ac6('0x0'));module[_0x8ac6('0x1')]={'name':{'type':Sequelize[_0x8ac6('0x2')],'unique':_0x8ac6('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x8ac6('0x2')]},'display_name':{'type':Sequelize[_0x8ac6('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x8ac6('0x4')]},'original_sampleCount':{'type':Sequelize[_0x8ac6('0x5')]},'original_channelCount':{'type':Sequelize[_0x8ac6('0x6')]},'original_bitRate':{'type':Sequelize[_0x8ac6('0x5')]},'original_sampleRate':{'type':Sequelize[_0x8ac6('0x6')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x8ac6('0x5')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x8ac6('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index b92ed23..45f9fdd 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 _0x7556=['end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','get','destroy','error','stack','name','send','map','Sound','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','pick','where','merge','VIRTUAL','filter','options','rows','catch','show','rawAttributes','includeAll','include','find','download','save_name','converted_format','existsSync','join','root','Sequelize','server/files/sounds/converted','format','%s.%s','create','basename','file','originalname','extname','filename','wav','info','Sound\x20upload\x20filepath:\x20%s','0777','transcode','unlinkSync','src','duration','original_sampleCount','sampleCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_channelCount','converted_sampleRate','chmodSync','role','body','userProfileId','user','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','params','description','server/files/sounds/original','original_format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status'];(function(_0x59a57f,_0x2f66c8){var _0x474869=function(_0x1c59ae){while(--_0x1c59ae){_0x59a57f['push'](_0x59a57f['shift']());}};_0x474869(++_0x2f66c8);}(_0x7556,0x14b));var _0x6755=function(_0x1e1308,_0x55df08){_0x1e1308=_0x1e1308-0x0;var _0x58d7cb=_0x7556[_0x1e1308];return _0x58d7cb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6755('0x0'));var zipdir=require(_0x6755('0x1'));var jsonpatch=require(_0x6755('0x2'));var rp=require(_0x6755('0x3'));var moment=require(_0x6755('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6755('0x5'));var util=require(_0x6755('0x6'));var path=require(_0x6755('0x7'));var sox=require(_0x6755('0x8'));var csv=require(_0x6755('0x9'));var ejs=require(_0x6755('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6755('0xb'));var crypto=require(_0x6755('0xc'));var jsforce=require(_0x6755('0xd'));var deskjs=require(_0x6755('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6755('0xf'));var Papa=require(_0x6755('0x10'));var Redis=require(_0x6755('0x11'));var authService=require(_0x6755('0x12'));var qs=require(_0x6755('0x13'));var as=require(_0x6755('0x14'));var hardwareService=require(_0x6755('0x15'));var logger=require(_0x6755('0x16'))('api');var utils=require(_0x6755('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x200c33,_0x3f936d){_0x3f936d=_0x3f936d||0xcc;return function(_0x431a63){if(_0x431a63){return _0x200c33[_0x6755('0x18')](_0x3f936d);}return _0x200c33[_0x6755('0x19')](_0x3f936d)[_0x6755('0x1a')]();};}function respondWithResult(_0x14ecf2,_0x40e816){_0x40e816=_0x40e816||0xc8;return function(_0x51b484){if(_0x51b484){return _0x14ecf2[_0x6755('0x19')](_0x40e816)[_0x6755('0x1b')](_0x51b484);}};}function respondWithFilteredResult(_0x57d15a,_0xe56ffe){return function(_0x1fd499){if(_0x1fd499){var _0x122381=typeof _0xe56ffe[_0x6755('0x1c')]===_0x6755('0x1d')&&typeof _0xe56ffe['limit']===_0x6755('0x1d');var _0xaf5c77=_0x1fd499[_0x6755('0x1e')];var _0x29269a=_0x122381?0x0:_0xe56ffe['offset'];var _0x400954=_0x122381?_0x1fd499['count']:_0xe56ffe[_0x6755('0x1c')]+_0xe56ffe['limit'];var _0x1bf4dc;if(_0x400954>=_0xaf5c77){_0x400954=_0xaf5c77;_0x1bf4dc=0xc8;}else{_0x1bf4dc=0xce;}_0x57d15a[_0x6755('0x19')](_0x1bf4dc);return _0x57d15a[_0x6755('0x1f')](_0x6755('0x20'),_0x29269a+'-'+_0x400954+'/'+_0xaf5c77)[_0x6755('0x1b')](_0x1fd499);}return null;};}function patchUpdates(_0x2dc584){return function(_0xc5d5ef){try{jsonpatch[_0x6755('0x21')](_0xc5d5ef,_0x2dc584,!![]);}catch(_0x1ab601){return BPromise['reject'](_0x1ab601);}return _0xc5d5ef[_0x6755('0x22')]();};}function saveUpdates(_0x416890,_0x5067cc){return function(_0x440910){if(_0x440910){return _0x440910[_0x6755('0x23')](_0x416890)[_0x6755('0x24')](function(_0x3414c9){return _0x3414c9;});}return null;};}function removeEntity(_0x15cde3,_0x390734){return function(_0x5c0a14){if(_0x5c0a14){return _0x5c0a14['destroy']()[_0x6755('0x24')](function(){var _0x170d40=_0x5c0a14[_0x6755('0x25')]({'plain':!![]});var _0x4d0233='Sounds';return db['UserProfileResource'][_0x6755('0x26')]({'where':{'type':_0x4d0233,'resourceId':_0x170d40['id']}})[_0x6755('0x24')](function(){return _0x5c0a14;});})[_0x6755('0x24')](function(){_0x15cde3[_0x6755('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x267214,_0x83e1c){return function(_0x368a54){if(!_0x368a54){_0x267214[_0x6755('0x18')](0x194);}return _0x368a54;};}function handleError(_0x363635,_0x115a21){_0x115a21=_0x115a21||0x1f4;return function(_0x50cf6f){logger[_0x6755('0x27')](_0x50cf6f[_0x6755('0x28')]);if(_0x50cf6f['name']){delete _0x50cf6f[_0x6755('0x29')];}_0x363635[_0x6755('0x19')](_0x115a21)[_0x6755('0x2a')](_0x50cf6f);};}exports['index']=function(_0x186392,_0x3f275a){var _0x1a2db2={},_0x135109={},_0x3dd933={'count':0x0,'rows':[]};var _0x212a2c=_[_0x6755('0x2b')](db[_0x6755('0x2c')]['rawAttributes'],function(_0x1767a6){return{'name':_0x1767a6[_0x6755('0x2d')],'type':_0x1767a6[_0x6755('0x2e')]['key']};});_0x135109['model']=_['map'](_0x212a2c,'name');_0x135109[_0x6755('0x2f')]=_[_0x6755('0x30')](_0x186392['query']);_0x135109[_0x6755('0x31')]=_[_0x6755('0x32')](_0x135109[_0x6755('0x33')],_0x135109[_0x6755('0x2f')]);_0x1a2db2[_0x6755('0x34')]=_[_0x6755('0x32')](_0x135109[_0x6755('0x33')],qs[_0x6755('0x35')](_0x186392['query']['fields']));_0x1a2db2['attributes']=_0x1a2db2[_0x6755('0x34')][_0x6755('0x36')]?_0x1a2db2[_0x6755('0x34')]:_0x135109[_0x6755('0x33')];if(!_0x186392[_0x6755('0x2f')][_0x6755('0x37')](_0x6755('0x38'))){_0x1a2db2[_0x6755('0x39')]=qs[_0x6755('0x39')](_0x186392['query'][_0x6755('0x39')]);_0x1a2db2[_0x6755('0x1c')]=qs[_0x6755('0x1c')](_0x186392[_0x6755('0x2f')][_0x6755('0x1c')]);}_0x1a2db2[_0x6755('0x3a')]=qs['sort'](_0x186392[_0x6755('0x2f')]['sort']);_0x1a2db2['where']=qs[_0x6755('0x31')](_[_0x6755('0x3b')](_0x186392[_0x6755('0x2f')],_0x135109[_0x6755('0x31')]),_0x212a2c);if(_0x186392[_0x6755('0x2f')]['filter']){_0x1a2db2[_0x6755('0x3c')]=_[_0x6755('0x3d')](_0x1a2db2[_0x6755('0x3c')],{'$or':_[_0x6755('0x2b')](_0x212a2c,function(_0xe6b76a){if(_0xe6b76a[_0x6755('0x2e')]!==_0x6755('0x3e')){var _0x3f06a8={};_0x3f06a8[_0xe6b76a['name']]={'$like':'%'+_0x186392[_0x6755('0x2f')][_0x6755('0x3f')]+'%'};return _0x3f06a8;}})});}_0x1a2db2=_[_0x6755('0x3d')]({},_0x1a2db2,_0x186392[_0x6755('0x40')]);var _0x3fb0bd={'where':_0x1a2db2[_0x6755('0x3c')]};return db[_0x6755('0x2c')]['count'](_0x3fb0bd)[_0x6755('0x24')](function(_0x4e468b){_0x3dd933[_0x6755('0x1e')]=_0x4e468b;if(_0x186392[_0x6755('0x2f')]['includeAll']){_0x1a2db2['include']=[{'all':!![]}];}return db[_0x6755('0x2c')]['findAll'](_0x1a2db2);})['then'](function(_0x3b475d){_0x3dd933[_0x6755('0x41')]=_0x3b475d;return _0x3dd933;})[_0x6755('0x24')](respondWithFilteredResult(_0x3f275a,_0x1a2db2))[_0x6755('0x42')](handleError(_0x3f275a,null));};exports[_0x6755('0x43')]=function(_0x270831,_0x263913){var _0x1f6963={'raw':!![],'where':{'id':_0x270831['params']['id']}},_0x2afdb5={};_0x2afdb5[_0x6755('0x33')]=_['keys'](db[_0x6755('0x2c')][_0x6755('0x44')]);_0x2afdb5['query']=_[_0x6755('0x30')](_0x270831['query']);_0x2afdb5[_0x6755('0x31')]=_['intersection'](_0x2afdb5[_0x6755('0x33')],_0x2afdb5[_0x6755('0x2f')]);_0x1f6963[_0x6755('0x34')]=_['intersection'](_0x2afdb5[_0x6755('0x33')],qs[_0x6755('0x35')](_0x270831[_0x6755('0x2f')][_0x6755('0x35')]));_0x1f6963[_0x6755('0x34')]=_0x1f6963['attributes'][_0x6755('0x36')]?_0x1f6963[_0x6755('0x34')]:_0x2afdb5[_0x6755('0x33')];if(_0x270831[_0x6755('0x2f')][_0x6755('0x45')]){_0x1f6963[_0x6755('0x46')]=[{'all':!![]}];}_0x1f6963=_['merge']({},_0x1f6963,_0x270831['options']);return db[_0x6755('0x2c')][_0x6755('0x47')](_0x1f6963)[_0x6755('0x24')](handleEntityNotFound(_0x263913,null))[_0x6755('0x24')](respondWithResult(_0x263913,null))[_0x6755('0x42')](handleError(_0x263913,null));};exports[_0x6755('0x48')]=function(_0x1ef5d5,_0x500a3c,_0x8a0bca){return db[_0x6755('0x2c')][_0x6755('0x47')]({'where':{'id':_0x1ef5d5['params']['id']},'attributes':[_0x6755('0x29'),_0x6755('0x49'),_0x6755('0x4a')],'raw':!![]})['then'](handleEntityNotFound(_0x500a3c,null))[_0x6755('0x24')](function(_0x2aab63){if(_0x2aab63){if(!fs[_0x6755('0x4b')](path[_0x6755('0x4c')](config[_0x6755('0x4d')],'server/files/sounds/converted',_0x2aab63[_0x6755('0x49')]+'.'+_0x2aab63[_0x6755('0x4a')]))){throw new db[(_0x6755('0x4e'))]['ValidationError']('Sound\x20not\x20found');}return _0x500a3c['download'](path[_0x6755('0x4c')](config['root'],_0x6755('0x4f'),util[_0x6755('0x50')](_0x6755('0x51'),_0x2aab63['save_name'],_0x2aab63[_0x6755('0x4a')])),util[_0x6755('0x50')]('%s.%s',_0x2aab63['name'],_0x2aab63[_0x6755('0x4a')]));}return null;})[_0x6755('0x42')](handleError(_0x500a3c,null));};exports[_0x6755('0x52')]=function(_0x331d4c,_0x4e849a,_0x2e1f33){var _0x2bf864={'name':path[_0x6755('0x53')](_0x331d4c[_0x6755('0x54')][_0x6755('0x55')],path[_0x6755('0x56')](_0x331d4c['file'][_0x6755('0x55')])),'save_name':path[_0x6755('0x53')](_0x331d4c['file']['filename'],path[_0x6755('0x56')](_0x331d4c['file'][_0x6755('0x57')])),'original_format':path['extname'](_0x331d4c[_0x6755('0x54')][_0x6755('0x55')])['substring'](0x1),'converted_format':_0x6755('0x58')};var _0x484d42=path[_0x6755('0x4c')](config[_0x6755('0x4d')],'server/files/sounds/original',_0x331d4c[_0x6755('0x54')][_0x6755('0x57')]);var _0x1f0635=path[_0x6755('0x4c')](config[_0x6755('0x4d')],_0x6755('0x4f'),util[_0x6755('0x50')](_0x6755('0x51'),path[_0x6755('0x53')](_0x331d4c['file'][_0x6755('0x57')],path[_0x6755('0x56')](_0x331d4c['file'][_0x6755('0x57')])),_0x2bf864[_0x6755('0x4a')]));logger[_0x6755('0x59')](_0x6755('0x5a'),_0x484d42);logger[_0x6755('0x59')]('Sound\x20upload\x20destination:\x20%s',_0x1f0635);try{fs['chmodSync'](_0x484d42,parseInt(_0x6755('0x5b'),0x8));var _0x1149db=sox[_0x6755('0x5c')](_0x484d42,_0x1f0635,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1149db['on'](_0x6755('0x27'),function(_0x260aac){fs[_0x6755('0x5d')](_0x484d42);_0x4e849a[_0x6755('0x19')](0x1f4)[_0x6755('0x2a')](_0x260aac);});_0x1149db['on'](_0x6755('0x5e'),function(_0x521e02){_0x2bf864['original_duration']=isNaN(_0x521e02[_0x6755('0x5f')])?null:_0x521e02[_0x6755('0x5f')]*0x3e8;_0x2bf864[_0x6755('0x60')]=isNaN(_0x521e02[_0x6755('0x61')])?null:_0x521e02[_0x6755('0x61')];_0x2bf864['original_channelCount']=isNaN(_0x521e02[_0x6755('0x62')])?null:_0x521e02[_0x6755('0x62')];_0x2bf864['original_bitRate']=isNaN(_0x521e02[_0x6755('0x63')])?null:_0x521e02[_0x6755('0x63')];_0x2bf864[_0x6755('0x64')]=isNaN(_0x521e02[_0x6755('0x65')])?null:_0x521e02[_0x6755('0x65')];});_0x1149db['on'](_0x6755('0x66'),function(_0xae9232){_0x2bf864['converted_duration']=isNaN(_0xae9232[_0x6755('0x5f')])?null:_0xae9232[_0x6755('0x5f')]*0x3e8;_0x2bf864['converted_sampleCount']=isNaN(_0xae9232[_0x6755('0x61')])?null:_0xae9232['sampleCount'];_0x2bf864[_0x6755('0x67')]=isNaN(_0xae9232[_0x6755('0x62')])?null:_0xae9232[_0x6755('0x62')];_0x2bf864['converted_bitRate']=isNaN(_0xae9232['bitRate'])?null:_0xae9232[_0x6755('0x63')];_0x2bf864[_0x6755('0x68')]=isNaN(_0xae9232[_0x6755('0x65')])?null:_0xae9232[_0x6755('0x65')];});_0x1149db['on'](_0x6755('0x1a'),function(){fs[_0x6755('0x69')](_0x1f0635,parseInt(_0x6755('0x5b'),0x8));return db[_0x6755('0x2c')]['create'](_0x2bf864)['then'](function(_0x3cd8e1){var _0x5dcdd8={'role':_0x331d4c['body'][_0x6755('0x6a')],'userProfileId':_0x331d4c[_0x6755('0x6b')][_0x6755('0x6c')]};if(!_0x5dcdd8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5dcdd8[_0x6755('0x6a')]===_0x6755('0x6d')){var _0x4a12d3=_0x3cd8e1['get']({'plain':!![]});return db[_0x6755('0x6e')][_0x6755('0x47')]({'where':{'name':_0x6755('0x6f'),'userProfileId':_0x5dcdd8[_0x6755('0x6c')]},'raw':!![]})[_0x6755('0x24')](function(_0x35d08d){if(_0x35d08d&&_0x35d08d[_0x6755('0x70')]===0x0){return db['UserProfileResource'][_0x6755('0x52')]({'name':_0x4a12d3[_0x6755('0x29')],'resourceId':_0x4a12d3['id'],'type':_0x35d08d[_0x6755('0x29')],'sectionId':_0x35d08d['id']},{})['then'](function(){return _0x3cd8e1;});}else{return _0x3cd8e1;}})[_0x6755('0x42')](function(_0x25de57){logger[_0x6755('0x27')](_0x6755('0x71'),_0x25de57);throw _0x25de57;});}return _0x3cd8e1;})[_0x6755('0x24')](respondWithResult(_0x4e849a,null))[_0x6755('0x42')](handleError(_0x4e849a,null));});_0x1149db[_0x6755('0x72')]();}catch(_0x566ade){_0x4e849a[_0x6755('0x19')](0x1f4)[_0x6755('0x2a')](_0x566ade);}};exports[_0x6755('0x23')]=function(_0xf36770,_0x44902a,_0x399ce9){return db['Sound']['find']({'where':{'id':_0xf36770[_0x6755('0x73')]['id']}})[_0x6755('0x24')](handleEntityNotFound(_0x44902a,null))[_0x6755('0x24')](saveUpdates(_[_0x6755('0x3b')](_0xf36770[_0x6755('0x6b')],[_0x6755('0x29'),_0x6755('0x74')]),null))['then'](respondWithResult(_0x44902a,null))[_0x6755('0x42')](handleError(_0x44902a,null));};exports['delete']=function(_0x134934,_0x296a38,_0x1fbdf4){return db['Sound'][_0x6755('0x47')]({'where':{'id':_0x134934[_0x6755('0x73')]['id']}})[_0x6755('0x24')](function(_0x2cd944){if(_0x2cd944){return _0x2cd944[_0x6755('0x26')]();}})[_0x6755('0x24')](function(_0x12c02e){var _0x1baaaa=path[_0x6755('0x4c')](config[_0x6755('0x4d')],_0x6755('0x75'),util['format'](_0x6755('0x51'),_0x12c02e['save_name'],_0x12c02e[_0x6755('0x76')]));var _0x3d5650=path[_0x6755('0x4c')](config[_0x6755('0x4d')],_0x6755('0x4f'),util[_0x6755('0x50')](_0x6755('0x51'),_0x12c02e['save_name'],_0x12c02e['converted_format']));fs[_0x6755('0x5d')](_0x1baaaa);fs['unlinkSync'](_0x3d5650);return _0x12c02e;})[_0x6755('0x24')](function(_0x4cbd12){if(_0x4cbd12){return _0x296a38['status'](0xcc)[_0x6755('0x1a')]();}})[_0x6755('0x24')](handleEntityNotFound(_0x296a38,null))['catch'](handleError(_0x296a38,null));}; \ No newline at end of file +var _0x606a=['path','sox','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','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','update','then','destroy','Sounds','UserProfileResource','error','stack','name','send','index','Sound','fieldName','type','key','query','keys','attributes','intersection','model','fields','length','nolimit','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','includeAll','include','rows','catch','show','params','download','find','save_name','converted_format','existsSync','join','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','root','format','%s.%s','create','basename','file','originalname','filename','extname','substring','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','0777','transcode','wav','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_bitRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','start','delete','server/files/sounds/original','original_format','rimraf','zip-dir','fast-json-patch','bluebird','util'];(function(_0x5a1b6b,_0x347820){var _0x5e6e87=function(_0x20ebc5){while(--_0x20ebc5){_0x5a1b6b['push'](_0x5a1b6b['shift']());}};_0x5e6e87(++_0x347820);}(_0x606a,0x77));var _0xa606=function(_0x4807bd,_0x4c02aa){_0x4807bd=_0x4807bd-0x0;var _0x2a013e=_0x606a[_0x4807bd];return _0x2a013e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa606('0x0'));var zipdir=require(_0xa606('0x1'));var jsonpatch=require(_0xa606('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa606('0x3'));var Mustache=require('mustache');var util=require(_0xa606('0x4'));var path=require(_0xa606('0x5'));var sox=require(_0xa606('0x6'));var csv=require(_0xa606('0x7'));var ejs=require(_0xa606('0x8'));var fs=require('fs');var fs_extra=require(_0xa606('0x9'));var _=require('lodash');var squel=require(_0xa606('0xa'));var crypto=require(_0xa606('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa606('0xc'));var toCsv=require(_0xa606('0x7'));var querystring=require(_0xa606('0xd'));var Papa=require(_0xa606('0xe'));var Redis=require(_0xa606('0xf'));var authService=require(_0xa606('0x10'));var qs=require(_0xa606('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa606('0x12'));var logger=require('../../config/logger')(_0xa606('0x13'));var utils=require(_0xa606('0x14'));var config=require(_0xa606('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d714e,_0x2d0096){_0x2d0096=_0x2d0096||0xcc;return function(_0x16ab2a){if(_0x16ab2a){return _0x5d714e[_0xa606('0x16')](_0x2d0096);}return _0x5d714e[_0xa606('0x17')](_0x2d0096)[_0xa606('0x18')]();};}function respondWithResult(_0x36c670,_0x3f0b39){_0x3f0b39=_0x3f0b39||0xc8;return function(_0x2766de){if(_0x2766de){return _0x36c670['status'](_0x3f0b39)[_0xa606('0x19')](_0x2766de);}};}function respondWithFilteredResult(_0x22040b,_0xc4f726){return function(_0x2fd17f){if(_0x2fd17f){var _0x870d74=typeof _0xc4f726[_0xa606('0x1a')]==='undefined'&&typeof _0xc4f726[_0xa606('0x1b')]===_0xa606('0x1c');var _0x4caa67=_0x2fd17f[_0xa606('0x1d')];var _0x42039e=_0x870d74?0x0:_0xc4f726['offset'];var _0x38d2cf=_0x870d74?_0x2fd17f[_0xa606('0x1d')]:_0xc4f726[_0xa606('0x1a')]+_0xc4f726['limit'];var _0x57c038;if(_0x38d2cf>=_0x4caa67){_0x38d2cf=_0x4caa67;_0x57c038=0xc8;}else{_0x57c038=0xce;}_0x22040b['status'](_0x57c038);return _0x22040b[_0xa606('0x1e')](_0xa606('0x1f'),_0x42039e+'-'+_0x38d2cf+'/'+_0x4caa67)[_0xa606('0x19')](_0x2fd17f);}return null;};}function patchUpdates(_0x40f76b){return function(_0x13dc16){try{jsonpatch['apply'](_0x13dc16,_0x40f76b,!![]);}catch(_0x235531){return BPromise['reject'](_0x235531);}return _0x13dc16[_0xa606('0x20')]();};}function saveUpdates(_0x332409,_0x3e5a87){return function(_0x4dedcd){if(_0x4dedcd){return _0x4dedcd[_0xa606('0x21')](_0x332409)[_0xa606('0x22')](function(_0x1f8013){return _0x1f8013;});}return null;};}function removeEntity(_0x300d90,_0x4769e2){return function(_0x3c58f0){if(_0x3c58f0){return _0x3c58f0[_0xa606('0x23')]()[_0xa606('0x22')](function(){var _0x502d4b=_0x3c58f0['get']({'plain':!![]});var _0x3ef01c=_0xa606('0x24');return db[_0xa606('0x25')]['destroy']({'where':{'type':_0x3ef01c,'resourceId':_0x502d4b['id']}})['then'](function(){return _0x3c58f0;});})['then'](function(){_0x300d90[_0xa606('0x17')](0xcc)[_0xa606('0x18')]();});}};}function handleEntityNotFound(_0x541d5d,_0xfb4b4d){return function(_0x5064fc){if(!_0x5064fc){_0x541d5d[_0xa606('0x16')](0x194);}return _0x5064fc;};}function handleError(_0x4cbdbd,_0xbf8551){_0xbf8551=_0xbf8551||0x1f4;return function(_0x202839){logger[_0xa606('0x26')](_0x202839[_0xa606('0x27')]);if(_0x202839[_0xa606('0x28')]){delete _0x202839[_0xa606('0x28')];}_0x4cbdbd[_0xa606('0x17')](_0xbf8551)[_0xa606('0x29')](_0x202839);};}exports[_0xa606('0x2a')]=function(_0x4865a6,_0x4438eb){var _0x105b7a={},_0x33e631={},_0x59fe1e={'count':0x0,'rows':[]};var _0x2c010f=_['map'](db[_0xa606('0x2b')]['rawAttributes'],function(_0x2872d9){return{'name':_0x2872d9[_0xa606('0x2c')],'type':_0x2872d9[_0xa606('0x2d')][_0xa606('0x2e')]};});_0x33e631['model']=_['map'](_0x2c010f,_0xa606('0x28'));_0x33e631[_0xa606('0x2f')]=_[_0xa606('0x30')](_0x4865a6[_0xa606('0x2f')]);_0x33e631['filters']=_['intersection'](_0x33e631['model'],_0x33e631['query']);_0x105b7a[_0xa606('0x31')]=_[_0xa606('0x32')](_0x33e631[_0xa606('0x33')],qs[_0xa606('0x34')](_0x4865a6[_0xa606('0x2f')][_0xa606('0x34')]));_0x105b7a['attributes']=_0x105b7a['attributes'][_0xa606('0x35')]?_0x105b7a[_0xa606('0x31')]:_0x33e631['model'];if(!_0x4865a6[_0xa606('0x2f')]['hasOwnProperty'](_0xa606('0x36'))){_0x105b7a['limit']=qs['limit'](_0x4865a6[_0xa606('0x2f')][_0xa606('0x1b')]);_0x105b7a[_0xa606('0x1a')]=qs[_0xa606('0x1a')](_0x4865a6['query'][_0xa606('0x1a')]);}_0x105b7a['order']=qs['sort'](_0x4865a6[_0xa606('0x2f')][_0xa606('0x37')]);_0x105b7a[_0xa606('0x38')]=qs[_0xa606('0x39')](_[_0xa606('0x3a')](_0x4865a6[_0xa606('0x2f')],_0x33e631[_0xa606('0x39')]),_0x2c010f);if(_0x4865a6[_0xa606('0x2f')][_0xa606('0x3b')]){_0x105b7a[_0xa606('0x38')]=_[_0xa606('0x3c')](_0x105b7a[_0xa606('0x38')],{'$or':_[_0xa606('0x3d')](_0x2c010f,function(_0x1ea635){if(_0x1ea635[_0xa606('0x2d')]!==_0xa606('0x3e')){var _0x321d9a={};_0x321d9a[_0x1ea635[_0xa606('0x28')]]={'$like':'%'+_0x4865a6[_0xa606('0x2f')]['filter']+'%'};return _0x321d9a;}})});}_0x105b7a=_[_0xa606('0x3c')]({},_0x105b7a,_0x4865a6[_0xa606('0x3f')]);var _0x39c289={'where':_0x105b7a['where']};return db[_0xa606('0x2b')]['count'](_0x39c289)[_0xa606('0x22')](function(_0x10c404){_0x59fe1e['count']=_0x10c404;if(_0x4865a6['query'][_0xa606('0x40')]){_0x105b7a[_0xa606('0x41')]=[{'all':!![]}];}return db[_0xa606('0x2b')]['findAll'](_0x105b7a);})[_0xa606('0x22')](function(_0x5c94f6){_0x59fe1e[_0xa606('0x42')]=_0x5c94f6;return _0x59fe1e;})['then'](respondWithFilteredResult(_0x4438eb,_0x105b7a))[_0xa606('0x43')](handleError(_0x4438eb,null));};exports[_0xa606('0x44')]=function(_0x479a71,_0x54054a){var _0x3de038={'raw':!![],'where':{'id':_0x479a71[_0xa606('0x45')]['id']}},_0x1eda5e={};_0x1eda5e[_0xa606('0x33')]=_['keys'](db[_0xa606('0x2b')]['rawAttributes']);_0x1eda5e['query']=_[_0xa606('0x30')](_0x479a71[_0xa606('0x2f')]);_0x1eda5e[_0xa606('0x39')]=_[_0xa606('0x32')](_0x1eda5e[_0xa606('0x33')],_0x1eda5e[_0xa606('0x2f')]);_0x3de038[_0xa606('0x31')]=_[_0xa606('0x32')](_0x1eda5e[_0xa606('0x33')],qs[_0xa606('0x34')](_0x479a71[_0xa606('0x2f')]['fields']));_0x3de038['attributes']=_0x3de038[_0xa606('0x31')][_0xa606('0x35')]?_0x3de038['attributes']:_0x1eda5e[_0xa606('0x33')];if(_0x479a71[_0xa606('0x2f')][_0xa606('0x40')]){_0x3de038['include']=[{'all':!![]}];}_0x3de038=_[_0xa606('0x3c')]({},_0x3de038,_0x479a71[_0xa606('0x3f')]);return db[_0xa606('0x2b')]['find'](_0x3de038)['then'](handleEntityNotFound(_0x54054a,null))['then'](respondWithResult(_0x54054a,null))[_0xa606('0x43')](handleError(_0x54054a,null));};exports[_0xa606('0x46')]=function(_0x4b6c6a,_0x2fcc8b,_0x17b7c0){return db['Sound'][_0xa606('0x47')]({'where':{'id':_0x4b6c6a[_0xa606('0x45')]['id']},'attributes':[_0xa606('0x28'),_0xa606('0x48'),_0xa606('0x49')],'raw':!![]})[_0xa606('0x22')](handleEntityNotFound(_0x2fcc8b,null))['then'](function(_0x2ee0c6){if(_0x2ee0c6){if(!fs[_0xa606('0x4a')](path[_0xa606('0x4b')](config['root'],_0xa606('0x4c'),_0x2ee0c6[_0xa606('0x48')]+'.'+_0x2ee0c6[_0xa606('0x49')]))){throw new db[(_0xa606('0x4d'))][(_0xa606('0x4e'))](_0xa606('0x4f'));}return _0x2fcc8b[_0xa606('0x46')](path[_0xa606('0x4b')](config[_0xa606('0x50')],'server/files/sounds/converted',util[_0xa606('0x51')](_0xa606('0x52'),_0x2ee0c6[_0xa606('0x48')],_0x2ee0c6[_0xa606('0x49')])),util['format'](_0xa606('0x52'),_0x2ee0c6[_0xa606('0x28')],_0x2ee0c6[_0xa606('0x49')]));}return null;})[_0xa606('0x43')](handleError(_0x2fcc8b,null));};exports[_0xa606('0x53')]=function(_0x1255c6,_0x498161,_0x5023ea){var _0x5c4c00={'name':path[_0xa606('0x54')](_0x1255c6[_0xa606('0x55')][_0xa606('0x56')],path['extname'](_0x1255c6[_0xa606('0x55')][_0xa606('0x56')])),'save_name':path[_0xa606('0x54')](_0x1255c6[_0xa606('0x55')][_0xa606('0x57')],path[_0xa606('0x58')](_0x1255c6['file'][_0xa606('0x57')])),'original_format':path[_0xa606('0x58')](_0x1255c6['file']['originalname'])[_0xa606('0x59')](0x1),'converted_format':'wav'};var _0x2c0190=path[_0xa606('0x4b')](config['root'],'server/files/sounds/original',_0x1255c6['file'][_0xa606('0x57')]);var _0x566da2=path[_0xa606('0x4b')](config['root'],_0xa606('0x4c'),util['format'](_0xa606('0x52'),path['basename'](_0x1255c6[_0xa606('0x55')][_0xa606('0x57')],path[_0xa606('0x58')](_0x1255c6[_0xa606('0x55')][_0xa606('0x57')])),_0x5c4c00[_0xa606('0x49')]));logger[_0xa606('0x5a')](_0xa606('0x5b'),_0x2c0190);logger[_0xa606('0x5a')](_0xa606('0x5c'),_0x566da2);try{fs['chmodSync'](_0x2c0190,parseInt(_0xa606('0x5d'),0x8));var _0x232fdd=sox[_0xa606('0x5e')](_0x2c0190,_0x566da2,{'sampleRate':0x1f40,'format':_0xa606('0x5f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x232fdd['on']('error',function(_0x287f40){fs[_0xa606('0x60')](_0x2c0190);_0x498161['status'](0x1f4)['send'](_0x287f40);});_0x232fdd['on'](_0xa606('0x61'),function(_0x1a2ed9){_0x5c4c00[_0xa606('0x62')]=isNaN(_0x1a2ed9[_0xa606('0x63')])?null:_0x1a2ed9[_0xa606('0x63')]*0x3e8;_0x5c4c00[_0xa606('0x64')]=isNaN(_0x1a2ed9['sampleCount'])?null:_0x1a2ed9[_0xa606('0x65')];_0x5c4c00[_0xa606('0x66')]=isNaN(_0x1a2ed9[_0xa606('0x67')])?null:_0x1a2ed9[_0xa606('0x67')];_0x5c4c00[_0xa606('0x68')]=isNaN(_0x1a2ed9[_0xa606('0x69')])?null:_0x1a2ed9[_0xa606('0x69')];_0x5c4c00[_0xa606('0x6a')]=isNaN(_0x1a2ed9[_0xa606('0x6b')])?null:_0x1a2ed9[_0xa606('0x6b')];});_0x232fdd['on'](_0xa606('0x6c'),function(_0x95b9db){_0x5c4c00['converted_duration']=isNaN(_0x95b9db[_0xa606('0x63')])?null:_0x95b9db['duration']*0x3e8;_0x5c4c00[_0xa606('0x6d')]=isNaN(_0x95b9db[_0xa606('0x65')])?null:_0x95b9db[_0xa606('0x65')];_0x5c4c00[_0xa606('0x6e')]=isNaN(_0x95b9db['channelCount'])?null:_0x95b9db[_0xa606('0x67')];_0x5c4c00[_0xa606('0x6f')]=isNaN(_0x95b9db[_0xa606('0x69')])?null:_0x95b9db[_0xa606('0x69')];_0x5c4c00['converted_sampleRate']=isNaN(_0x95b9db[_0xa606('0x6b')])?null:_0x95b9db[_0xa606('0x6b')];});_0x232fdd['on'](_0xa606('0x18'),function(){fs['chmodSync'](_0x566da2,parseInt(_0xa606('0x5d'),0x8));return db[_0xa606('0x2b')][_0xa606('0x53')](_0x5c4c00)['then'](function(_0x536ce7){var _0x62f781={'role':_0x1255c6[_0xa606('0x70')][_0xa606('0x71')],'userProfileId':_0x1255c6['body'][_0xa606('0x72')]};if(!_0x62f781)throw new Error(_0xa606('0x73'));if(_0x62f781['role']===_0xa606('0x74')){var _0x193b7d=_0x536ce7[_0xa606('0x75')]({'plain':!![]});return db[_0xa606('0x76')][_0xa606('0x47')]({'where':{'name':_0xa606('0x24'),'userProfileId':_0x62f781[_0xa606('0x72')]},'raw':!![]})[_0xa606('0x22')](function(_0x360801){if(_0x360801&&_0x360801[_0xa606('0x77')]===0x0){return db['UserProfileResource'][_0xa606('0x53')]({'name':_0x193b7d['name'],'resourceId':_0x193b7d['id'],'type':_0x360801[_0xa606('0x28')],'sectionId':_0x360801['id']},{})['then'](function(){return _0x536ce7;});}else{return _0x536ce7;}})[_0xa606('0x43')](function(_0x7eabd6){logger[_0xa606('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x7eabd6);throw _0x7eabd6;});}return _0x536ce7;})['then'](respondWithResult(_0x498161,null))['catch'](handleError(_0x498161,null));});_0x232fdd[_0xa606('0x78')]();}catch(_0x1c5e30){_0x498161[_0xa606('0x17')](0x1f4)['send'](_0x1c5e30);}};exports[_0xa606('0x21')]=function(_0xf58ad9,_0x9c0b17,_0x3cd09d){return db[_0xa606('0x2b')][_0xa606('0x47')]({'where':{'id':_0xf58ad9[_0xa606('0x45')]['id']}})[_0xa606('0x22')](handleEntityNotFound(_0x9c0b17,null))[_0xa606('0x22')](saveUpdates(_[_0xa606('0x3a')](_0xf58ad9[_0xa606('0x70')],[_0xa606('0x28'),'description']),null))[_0xa606('0x22')](respondWithResult(_0x9c0b17,null))[_0xa606('0x43')](handleError(_0x9c0b17,null));};exports[_0xa606('0x79')]=function(_0x327eb5,_0x759d4d,_0x34889d){return db[_0xa606('0x2b')][_0xa606('0x47')]({'where':{'id':_0x327eb5[_0xa606('0x45')]['id']}})['then'](function(_0x288cca){if(_0x288cca){return _0x288cca[_0xa606('0x23')]();}})[_0xa606('0x22')](function(_0x5069e1){var _0x344fc2=path['join'](config['root'],_0xa606('0x7a'),util[_0xa606('0x51')](_0xa606('0x52'),_0x5069e1[_0xa606('0x48')],_0x5069e1[_0xa606('0x7b')]));var _0x12ec08=path['join'](config[_0xa606('0x50')],_0xa606('0x4c'),util[_0xa606('0x51')](_0xa606('0x52'),_0x5069e1[_0xa606('0x48')],_0x5069e1[_0xa606('0x49')]));fs['unlinkSync'](_0x344fc2);fs[_0xa606('0x60')](_0x12ec08);return _0x5069e1;})[_0xa606('0x22')](function(_0x56daf1){if(_0x56daf1){return _0x759d4d['status'](0xcc)['end']();}})[_0xa606('0x22')](handleEntityNotFound(_0x759d4d,null))[_0xa606('0x43')](handleError(_0x759d4d,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 32a6df0..5dbcb98 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 _0xafff=['../../config/environment','./sound.attributes','exports','Sound','lodash','util','../../config/logger','bluebird','path'];(function(_0x256ea2,_0x5e35b5){var _0x535043=function(_0xffd201){while(--_0xffd201){_0x256ea2['push'](_0x256ea2['shift']());}};_0x535043(++_0x5e35b5);}(_0xafff,0x1cf));var _0xfaff=function(_0x33b699,_0x578b36){_0x33b699=_0x33b699-0x0;var _0x371ecc=_0xafff[_0x33b699];return _0x371ecc;};'use strict';var _=require(_0xfaff('0x0'));var util=require(_0xfaff('0x1'));var logger=require(_0xfaff('0x2'))('api');var moment=require('moment');var BPromise=require(_0xfaff('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfaff('0x4'));var rimraf=require('rimraf');var config=require(_0xfaff('0x5'));var attributes=require(_0xfaff('0x6'));module[_0xfaff('0x7')]=function(_0x739dbd,_0x27c891){return _0x739dbd['define'](_0xfaff('0x8'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc9ac=['Sound','tools_sounds','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','define'];(function(_0x126acb,_0x55ddec){var _0x58853a=function(_0x2c8fe1){while(--_0x2c8fe1){_0x126acb['push'](_0x126acb['shift']());}};_0x58853a(++_0x55ddec);}(_0xc9ac,0x1db));var _0xcc9a=function(_0xb03acb,_0x2e9075){_0xb03acb=_0xb03acb-0x0;var _0x2e3fff=_0xc9ac[_0xb03acb];return _0x2e3fff;};'use strict';var _=require(_0xcc9a('0x0'));var util=require(_0xcc9a('0x1'));var logger=require(_0xcc9a('0x2'))('api');var moment=require(_0xcc9a('0x3'));var BPromise=require(_0xcc9a('0x4'));var rp=require(_0xcc9a('0x5'));var fs=require('fs');var path=require(_0xcc9a('0x6'));var rimraf=require('rimraf');var config=require(_0xcc9a('0x7'));var attributes=require('./sound.attributes');module['exports']=function(_0x43e212,_0x202df4){return _0x43e212[_0xcc9a('0x8')](_0xcc9a('0x9'),attributes,{'tableName':_0xcc9a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index fdd6378..431e99c 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 _0x1e67=['Sound','find','options','raw','where','attributes','include','model','map','debug','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','Sound,\x20%s,\x20%s','message','result','catch','ShowSound'];(function(_0x55e3d5,_0x2656cc){var _0xdad6e4=function(_0x1d15f8){while(--_0x1d15f8){_0x55e3d5['push'](_0x55e3d5['shift']());}};_0xdad6e4(++_0x2656cc);}(_0x1e67,0x1d8));var _0x71e6=function(_0x525574,_0x35d137){_0x525574=_0x525574-0x0;var _0xfd9825=_0x1e67[_0x525574];return _0xfd9825;};'use strict';var _=require(_0x71e6('0x0'));var util=require(_0x71e6('0x1'));var moment=require(_0x71e6('0x2'));var BPromise=require('bluebird');var rs=require(_0x71e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x71e6('0x4'))['db'];var utils=require(_0x71e6('0x5'));var logger=require(_0x71e6('0x6'))(_0x71e6('0x7'));var config=require(_0x71e6('0x8'));var jayson=require(_0x71e6('0x9'));var client=jayson[_0x71e6('0xa')][_0x71e6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x425462,_0x2dc27a,_0x4d8513){return new BPromise(function(_0x53c5f6,_0xa53b61){return client[_0x71e6('0xc')](_0x425462,_0x4d8513)[_0x71e6('0xd')](function(_0x173362){logger[_0x71e6('0xe')]('Sound,\x20%s,\x20%s',_0x2dc27a,'request\x20sent');logger['debug']('Sound,\x20%s,\x20%s,\x20%s',_0x2dc27a,_0x71e6('0xf'),JSON[_0x71e6('0x10')](_0x173362));if(_0x173362[_0x71e6('0x11')]){if(_0x173362[_0x71e6('0x11')]['code']===0x1f4){logger[_0x71e6('0x11')](_0x71e6('0x12'),_0x2dc27a,_0x173362[_0x71e6('0x11')]['message']);return _0xa53b61(_0x173362[_0x71e6('0x11')]['message']);}logger[_0x71e6('0x11')](_0x71e6('0x12'),_0x2dc27a,_0x173362['error'][_0x71e6('0x13')]);return _0x53c5f6(_0x173362[_0x71e6('0x11')][_0x71e6('0x13')]);}else{logger['info'](_0x71e6('0x12'),_0x2dc27a,_0x71e6('0xf'));_0x53c5f6(_0x173362[_0x71e6('0x14')][_0x71e6('0x13')]);}})[_0x71e6('0x15')](function(_0x3b6426){logger[_0x71e6('0x11')](_0x71e6('0x12'),_0x2dc27a,_0x3b6426);_0xa53b61(_0x3b6426);});});}exports[_0x71e6('0x16')]=function(_0xb14731){var _0x2c365c=this;return new Promise(function(_0x338258,_0xdf969){return db[_0x71e6('0x17')][_0x71e6('0x18')]({'raw':_0xb14731[_0x71e6('0x19')]?_0xb14731[_0x71e6('0x19')][_0x71e6('0x1a')]===undefined?!![]:![]:!![],'where':_0xb14731[_0x71e6('0x19')]?_0xb14731[_0x71e6('0x19')][_0x71e6('0x1b')]||null:null,'attributes':_0xb14731['options']?_0xb14731[_0x71e6('0x19')][_0x71e6('0x1c')]||null:null,'include':_0xb14731[_0x71e6('0x19')]?_0xb14731[_0x71e6('0x19')][_0x71e6('0x1d')]?_['map'](_0xb14731[_0x71e6('0x19')][_0x71e6('0x1d')],function(_0x173214){return{'model':db[_0x173214[_0x71e6('0x1e')]],'as':_0x173214['as'],'attributes':_0x173214[_0x71e6('0x1c')],'include':_0x173214[_0x71e6('0x1d')]?_[_0x71e6('0x1f')](_0x173214[_0x71e6('0x1d')],function(_0x1ad10f){return{'model':db[_0x1ad10f['model']],'as':_0x1ad10f['as'],'attributes':_0x1ad10f[_0x71e6('0x1c')],'include':_0x1ad10f[_0x71e6('0x1d')]?_[_0x71e6('0x1f')](_0x1ad10f['include'],function(_0x4fc46d){return{'model':db[_0x4fc46d[_0x71e6('0x1e')]],'as':_0x4fc46d['as'],'attributes':_0x4fc46d[_0x71e6('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x7409ea){logger['info'](_0x71e6('0x16'),_0xb14731);logger[_0x71e6('0x20')](_0x71e6('0x16'),_0xb14731,JSON[_0x71e6('0x10')](_0x7409ea));_0x338258(_0x7409ea);})[_0x71e6('0x15')](function(_0x6f0a6b){logger[_0x71e6('0x11')](_0x71e6('0x16'),_0x6f0a6b[_0x71e6('0x13')],_0xb14731);_0xdf969(_0x2c365c['error'](0x1f4,_0x6f0a6b['message']));});});}; \ No newline at end of file +var _0x83a6=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','info','Sound,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowSound','options','raw','where','attributes','include','map','model','then','stringify','lodash','util'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x83a6,0x153));var _0x683a=function(_0x4a8e35,_0x1613b5){_0x4a8e35=_0x4a8e35-0x0;var _0x2c38d9=_0x83a6[_0x4a8e35];return _0x2c38d9;};'use strict';var _=require(_0x683a('0x0'));var util=require(_0x683a('0x1'));var moment=require(_0x683a('0x2'));var BPromise=require(_0x683a('0x3'));var rs=require(_0x683a('0x4'));var fs=require('fs');var Redis=require(_0x683a('0x5'));var db=require(_0x683a('0x6'))['db'];var utils=require(_0x683a('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x683a('0x8'));var jayson=require(_0x683a('0x9'));var client=jayson['client'][_0x683a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x264217,_0x3d0c36,_0x2437d8){return new BPromise(function(_0x128bbc,_0x1ce389){return client[_0x683a('0xb')](_0x264217,_0x2437d8)['then'](function(_0x8b84f4){logger[_0x683a('0xc')](_0x683a('0xd'),_0x3d0c36,_0x683a('0xe'));logger[_0x683a('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0x3d0c36,_0x683a('0xe'),JSON['stringify'](_0x8b84f4));if(_0x8b84f4['error']){if(_0x8b84f4[_0x683a('0x10')][_0x683a('0x11')]===0x1f4){logger[_0x683a('0x10')](_0x683a('0xd'),_0x3d0c36,_0x8b84f4[_0x683a('0x10')]['message']);return _0x1ce389(_0x8b84f4['error'][_0x683a('0x12')]);}logger[_0x683a('0x10')](_0x683a('0xd'),_0x3d0c36,_0x8b84f4[_0x683a('0x10')]['message']);return _0x128bbc(_0x8b84f4['error'][_0x683a('0x12')]);}else{logger['info'](_0x683a('0xd'),_0x3d0c36,_0x683a('0xe'));_0x128bbc(_0x8b84f4[_0x683a('0x13')][_0x683a('0x12')]);}})[_0x683a('0x14')](function(_0x3fde53){logger[_0x683a('0x10')]('Sound,\x20%s,\x20%s',_0x3d0c36,_0x3fde53);_0x1ce389(_0x3fde53);});});}exports[_0x683a('0x15')]=function(_0x379425){var _0x41b97a=this;return new Promise(function(_0xd2173e,_0x3bafaa){return db['Sound']['find']({'raw':_0x379425[_0x683a('0x16')]?_0x379425[_0x683a('0x16')][_0x683a('0x17')]===undefined?!![]:![]:!![],'where':_0x379425['options']?_0x379425['options'][_0x683a('0x18')]||null:null,'attributes':_0x379425[_0x683a('0x16')]?_0x379425[_0x683a('0x16')][_0x683a('0x19')]||null:null,'include':_0x379425[_0x683a('0x16')]?_0x379425[_0x683a('0x16')][_0x683a('0x1a')]?_[_0x683a('0x1b')](_0x379425['options'][_0x683a('0x1a')],function(_0x3f1d04){return{'model':db[_0x3f1d04[_0x683a('0x1c')]],'as':_0x3f1d04['as'],'attributes':_0x3f1d04['attributes'],'include':_0x3f1d04[_0x683a('0x1a')]?_[_0x683a('0x1b')](_0x3f1d04[_0x683a('0x1a')],function(_0x434d0a){return{'model':db[_0x434d0a[_0x683a('0x1c')]],'as':_0x434d0a['as'],'attributes':_0x434d0a[_0x683a('0x19')],'include':_0x434d0a['include']?_[_0x683a('0x1b')](_0x434d0a[_0x683a('0x1a')],function(_0x17f4eb){return{'model':db[_0x17f4eb[_0x683a('0x1c')]],'as':_0x17f4eb['as'],'attributes':_0x17f4eb[_0x683a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x683a('0x1d')](function(_0x4e0069){logger[_0x683a('0xc')](_0x683a('0x15'),_0x379425);logger[_0x683a('0xf')](_0x683a('0x15'),_0x379425,JSON[_0x683a('0x1e')](_0x4e0069));_0xd2173e(_0x4e0069);})[_0x683a('0x14')](function(_0x11bd89){logger['error'](_0x683a('0x15'),_0x11bd89[_0x683a('0x12')],_0x379425);_0x3bafaa(_0x41b97a['error'](0x1f4,_0x11bd89[_0x683a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 5906c56..e90a1ad 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 _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x2a690c,_0x5a5150){var _0x2bfb5a=function(_0x27504e){while(--_0x27504e){_0x2a690c['push'](_0x2a690c['shift']());}};_0x2bfb5a(++_0x5a5150);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('0x13')]=router; \ No newline at end of file +var _0x8603=['../../components/interaction/service','./squareMessage.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x2abaae,_0x29fd8b){var _0x5b5745=function(_0x2f6218){while(--_0x2f6218){_0x2abaae['push'](_0x2abaae['shift']());}};_0x5b5745(++_0x29fd8b);}(_0x8603,0x190));var _0x3860=function(_0x1237b4,_0x32f157){_0x1237b4=_0x1237b4-0x0;var _0x44ccc7=_0x8603[_0x1237b4];return _0x44ccc7;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xd')]);router['delete'](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['destroy']);module[_0x3860('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index bf05d6c..f886b65 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 _0xe2f2=['STRING','TEXT','medium','out','exports'];(function(_0x4c5c97,_0x4f85bf){var _0xd5d2cb=function(_0x1e6100){while(--_0x1e6100){_0x4c5c97['push'](_0x4c5c97['shift']());}};_0xd5d2cb(++_0x4f85bf);}(_0xe2f2,0x9f));var _0x2e2f=function(_0x2231d5,_0x5aad67){_0x2231d5=_0x2231d5-0x0;var _0x4d68cd=_0xe2f2[_0x2231d5];return _0x4d68cd;};'use strict';var Sequelize=require('sequelize');module[_0x2e2f('0x0')]={'uniqueid':{'type':Sequelize[_0x2e2f('0x1')]},'body':{'type':Sequelize[_0x2e2f('0x2')](_0x2e2f('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x2e2f('0x4')),'defaultValue':_0x2e2f('0x4'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x2e2f('0x2')]}}; \ No newline at end of file +var _0xe692=['medium','ENUM','out','exports','STRING','TEXT'];(function(_0x37e9a5,_0x3c7758){var _0x2e8999=function(_0x338a01){while(--_0x338a01){_0x37e9a5['push'](_0x37e9a5['shift']());}};_0x2e8999(++_0x3c7758);}(_0xe692,0x18f));var _0x2e69=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xe692[_0x2235bf];return _0x4c3a64;};'use strict';var Sequelize=require('sequelize');module[_0x2e69('0x0')]={'uniqueid':{'type':Sequelize[_0x2e69('0x1')]},'body':{'type':Sequelize[_0x2e69('0x2')](_0x2e69('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x2e69('0x4')]('in','out'),'defaultValue':_0x2e69('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x2e69('0x1')]},'providerResponse':{'type':Sequelize[_0x2e69('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index e9b103e..093717c 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 _0xc401=['squel','crypto','desk.js','papaparse','ioredis','../../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','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','find','catch','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs'];(function(_0x6ca064,_0x322008){var _0x130cef=function(_0x2ec966){while(--_0x2ec966){_0x6ca064['push'](_0x6ca064['shift']());}};_0x130cef(++_0x322008);}(_0xc401,0x15d));var _0x1c40=function(_0x53395e,_0x4a434c){_0x53395e=_0x53395e-0x0;var _0x3cf74d=_0xc401[_0x53395e];return _0x3cf74d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1c40('0x0'));var zipdir=require(_0x1c40('0x1'));var jsonpatch=require(_0x1c40('0x2'));var rp=require(_0x1c40('0x3'));var moment=require(_0x1c40('0x4'));var BPromise=require(_0x1c40('0x5'));var Mustache=require(_0x1c40('0x6'));var util=require(_0x1c40('0x7'));var path=require(_0x1c40('0x8'));var sox=require('sox');var csv=require(_0x1c40('0x9'));var ejs=require(_0x1c40('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1c40('0xb'));var crypto=require(_0x1c40('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1c40('0xd'));var toCsv=require(_0x1c40('0x9'));var querystring=require('querystring');var Papa=require(_0x1c40('0xe'));var Redis=require(_0x1c40('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1c40('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1c40('0x11'));var logger=require(_0x1c40('0x12'))(_0x1c40('0x13'));var utils=require(_0x1c40('0x14'));var config=require(_0x1c40('0x15'));var licenseUtil=require(_0x1c40('0x16'));var db=require(_0x1c40('0x17'))['db'];function respondWithStatusCode(_0x392ad6,_0x4bff06){_0x4bff06=_0x4bff06||0xcc;return function(_0x292570){if(_0x292570){return _0x392ad6[_0x1c40('0x18')](_0x4bff06);}return _0x392ad6[_0x1c40('0x19')](_0x4bff06)[_0x1c40('0x1a')]();};}function respondWithResult(_0x4b3d53,_0x347aed){_0x347aed=_0x347aed||0xc8;return function(_0x5a2ac7){if(_0x5a2ac7){return _0x4b3d53['status'](_0x347aed)[_0x1c40('0x1b')](_0x5a2ac7);}};}function respondWithFilteredResult(_0x419290,_0x4a3efa){return function(_0x3b5209){if(_0x3b5209){var _0x41ad77=typeof _0x4a3efa[_0x1c40('0x1c')]===_0x1c40('0x1d')&&typeof _0x4a3efa[_0x1c40('0x1e')]==='undefined';var _0x30eb14=_0x3b5209[_0x1c40('0x1f')];var _0x225f83=_0x41ad77?0x0:_0x4a3efa[_0x1c40('0x1c')];var _0x2b6962=_0x41ad77?_0x3b5209['count']:_0x4a3efa[_0x1c40('0x1c')]+_0x4a3efa['limit'];var _0x4cd09f;if(_0x2b6962>=_0x30eb14){_0x2b6962=_0x30eb14;_0x4cd09f=0xc8;}else{_0x4cd09f=0xce;}_0x419290[_0x1c40('0x19')](_0x4cd09f);return _0x419290['set'](_0x1c40('0x20'),_0x225f83+'-'+_0x2b6962+'/'+_0x30eb14)[_0x1c40('0x1b')](_0x3b5209);}return null;};}function patchUpdates(_0xfba64a){return function(_0x363a3e){try{jsonpatch['apply'](_0x363a3e,_0xfba64a,!![]);}catch(_0x105e9c){return BPromise[_0x1c40('0x21')](_0x105e9c);}return _0x363a3e[_0x1c40('0x22')]();};}function saveUpdates(_0x19889a,_0x12422a){return function(_0x384f25){if(_0x384f25){return _0x384f25[_0x1c40('0x23')](_0x19889a)[_0x1c40('0x24')](function(_0x41d29f){return _0x41d29f;});}return null;};}function removeEntity(_0x154859,_0x5058f5){return function(_0x4e57d8){if(_0x4e57d8){return _0x4e57d8[_0x1c40('0x25')]()[_0x1c40('0x24')](function(){_0x154859['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x14f709,_0x6c941b){return function(_0x117bc3){if(!_0x117bc3){_0x14f709[_0x1c40('0x18')](0x194);}return _0x117bc3;};}function handleError(_0xb5f108,_0x9764a1){_0x9764a1=_0x9764a1||0x1f4;return function(_0x3abd65){logger[_0x1c40('0x26')](_0x3abd65[_0x1c40('0x27')]);if(_0x3abd65[_0x1c40('0x28')]){delete _0x3abd65['name'];}_0xb5f108[_0x1c40('0x19')](_0x9764a1)[_0x1c40('0x29')](_0x3abd65);};}exports[_0x1c40('0x2a')]=function(_0x18dffc,_0x10c04d){var _0x3a11dc={},_0x40facf={},_0x239232={'count':0x0,'rows':[]};var _0x5af64d=_[_0x1c40('0x2b')](db[_0x1c40('0x2c')][_0x1c40('0x2d')],function(_0x433bdf){return{'name':_0x433bdf[_0x1c40('0x2e')],'type':_0x433bdf[_0x1c40('0x2f')]['key']};});_0x40facf['model']=_[_0x1c40('0x2b')](_0x5af64d,'name');_0x40facf[_0x1c40('0x30')]=_[_0x1c40('0x31')](_0x18dffc['query']);_0x40facf[_0x1c40('0x32')]=_[_0x1c40('0x33')](_0x40facf[_0x1c40('0x34')],_0x40facf[_0x1c40('0x30')]);_0x3a11dc[_0x1c40('0x35')]=_[_0x1c40('0x33')](_0x40facf[_0x1c40('0x34')],qs[_0x1c40('0x36')](_0x18dffc[_0x1c40('0x30')]['fields']));_0x3a11dc[_0x1c40('0x35')]=_0x3a11dc[_0x1c40('0x35')]['length']?_0x3a11dc[_0x1c40('0x35')]:_0x40facf[_0x1c40('0x34')];if(!_0x18dffc['query']['hasOwnProperty'](_0x1c40('0x37'))){_0x3a11dc[_0x1c40('0x1e')]=qs[_0x1c40('0x1e')](_0x18dffc[_0x1c40('0x30')]['limit']);_0x3a11dc[_0x1c40('0x1c')]=qs[_0x1c40('0x1c')](_0x18dffc[_0x1c40('0x30')][_0x1c40('0x1c')]);}_0x3a11dc[_0x1c40('0x38')]=qs['sort'](_0x18dffc[_0x1c40('0x30')][_0x1c40('0x39')]);_0x3a11dc[_0x1c40('0x3a')]=qs[_0x1c40('0x32')](_[_0x1c40('0x3b')](_0x18dffc['query'],_0x40facf[_0x1c40('0x32')]),_0x5af64d);if(_0x18dffc[_0x1c40('0x30')][_0x1c40('0x3c')]){_0x3a11dc[_0x1c40('0x3a')]=_[_0x1c40('0x3d')](_0x3a11dc[_0x1c40('0x3a')],{'$or':_[_0x1c40('0x2b')](_0x5af64d,function(_0x16bbcf){if(_0x16bbcf[_0x1c40('0x2f')]!==_0x1c40('0x3e')){var _0x1ccbf8={};_0x1ccbf8[_0x16bbcf[_0x1c40('0x28')]]={'$like':'%'+_0x18dffc[_0x1c40('0x30')][_0x1c40('0x3c')]+'%'};return _0x1ccbf8;}})});}_0x3a11dc=_[_0x1c40('0x3d')]({},_0x3a11dc,_0x18dffc[_0x1c40('0x3f')]);var _0x4611d7={'where':_0x3a11dc[_0x1c40('0x3a')]};return db['SquareMessage'][_0x1c40('0x1f')](_0x4611d7)[_0x1c40('0x24')](function(_0x3f891b){_0x239232['count']=_0x3f891b;if(_0x18dffc['query'][_0x1c40('0x40')]){_0x3a11dc[_0x1c40('0x41')]=[{'all':!![]}];}return db['SquareMessage']['findAll'](_0x3a11dc);})[_0x1c40('0x24')](function(_0x352475){_0x239232[_0x1c40('0x42')]=_0x352475;return _0x239232;})[_0x1c40('0x24')](respondWithFilteredResult(_0x10c04d,_0x3a11dc))['catch'](handleError(_0x10c04d,null));};exports['show']=function(_0x42c239,_0x46ac02){var _0x48f6f3={'raw':!![],'where':{'id':_0x42c239['params']['id']}},_0x4552f0={};_0x4552f0[_0x1c40('0x34')]=_[_0x1c40('0x31')](db[_0x1c40('0x2c')][_0x1c40('0x2d')]);_0x4552f0[_0x1c40('0x30')]=_['keys'](_0x42c239[_0x1c40('0x30')]);_0x4552f0[_0x1c40('0x32')]=_[_0x1c40('0x33')](_0x4552f0['model'],_0x4552f0['query']);_0x48f6f3[_0x1c40('0x35')]=_[_0x1c40('0x33')](_0x4552f0[_0x1c40('0x34')],qs[_0x1c40('0x36')](_0x42c239[_0x1c40('0x30')][_0x1c40('0x36')]));_0x48f6f3[_0x1c40('0x35')]=_0x48f6f3[_0x1c40('0x35')]['length']?_0x48f6f3[_0x1c40('0x35')]:_0x4552f0[_0x1c40('0x34')];if(_0x42c239[_0x1c40('0x30')]['includeAll']){_0x48f6f3[_0x1c40('0x41')]=[{'all':!![]}];}_0x48f6f3=_['merge']({},_0x48f6f3,_0x42c239[_0x1c40('0x3f')]);return db[_0x1c40('0x2c')][_0x1c40('0x43')](_0x48f6f3)['then'](handleEntityNotFound(_0x46ac02,null))[_0x1c40('0x24')](respondWithResult(_0x46ac02,null))[_0x1c40('0x44')](handleError(_0x46ac02,null));};exports[_0x1c40('0x45')]=function(_0x1074ee,_0x433d26){return db[_0x1c40('0x2c')][_0x1c40('0x45')](_0x1074ee[_0x1c40('0x46')],{})[_0x1c40('0x24')](respondWithResult(_0x433d26,0xc9))[_0x1c40('0x44')](handleError(_0x433d26,null));};exports[_0x1c40('0x23')]=function(_0x4207a0,_0x597546){if(_0x4207a0['body']['id']){delete _0x4207a0['body']['id'];}return db['SquareMessage'][_0x1c40('0x43')]({'where':{'id':_0x4207a0[_0x1c40('0x47')]['id']}})['then'](handleEntityNotFound(_0x597546,null))[_0x1c40('0x24')](saveUpdates(_0x4207a0[_0x1c40('0x46')],null))[_0x1c40('0x24')](respondWithResult(_0x597546,null))[_0x1c40('0x44')](handleError(_0x597546,null));};exports[_0x1c40('0x25')]=function(_0x5a4eea,_0x32b875){return db[_0x1c40('0x2c')][_0x1c40('0x43')]({'where':{'id':_0x5a4eea[_0x1c40('0x47')]['id']}})['then'](handleEntityNotFound(_0x32b875,null))[_0x1c40('0x24')](removeEntity(_0x32b875,null))['catch'](handleError(_0x32b875,null));}; \ No newline at end of file +var _0x4742=['key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','fields','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','SquareMessage','rawAttributes','fieldName','type'];(function(_0x3093dd,_0x163caa){var _0x9448a3=function(_0x78bfde){while(--_0x78bfde){_0x3093dd['push'](_0x3093dd['shift']());}};_0x9448a3(++_0x163caa);}(_0x4742,0x64));var _0x2474=function(_0x3f1637,_0x5916c2){_0x3f1637=_0x3f1637-0x0;var _0x4db4=_0x4742[_0x3f1637];return _0x4db4;};'use strict';var emlformat=require(_0x2474('0x0'));var rimraf=require(_0x2474('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2474('0x2'));var rp=require(_0x2474('0x3'));var moment=require(_0x2474('0x4'));var BPromise=require(_0x2474('0x5'));var Mustache=require(_0x2474('0x6'));var util=require('util');var path=require(_0x2474('0x7'));var sox=require(_0x2474('0x8'));var csv=require('to-csv');var ejs=require(_0x2474('0x9'));var fs=require('fs');var fs_extra=require(_0x2474('0xa'));var _=require('lodash');var squel=require(_0x2474('0xb'));var crypto=require('crypto');var jsforce=require(_0x2474('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2474('0xd'));var querystring=require(_0x2474('0xe'));var Papa=require('papaparse');var Redis=require(_0x2474('0xf'));var authService=require(_0x2474('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2474('0x11'));var hardwareService=require(_0x2474('0x12'));var logger=require(_0x2474('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x2474('0x14'));var licenseUtil=require(_0x2474('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33e5f9,_0x2eeceb){_0x2eeceb=_0x2eeceb||0xcc;return function(_0x1e23fd){if(_0x1e23fd){return _0x33e5f9[_0x2474('0x16')](_0x2eeceb);}return _0x33e5f9[_0x2474('0x17')](_0x2eeceb)['end']();};}function respondWithResult(_0x17763e,_0x3905b2){_0x3905b2=_0x3905b2||0xc8;return function(_0x329a89){if(_0x329a89){return _0x17763e[_0x2474('0x17')](_0x3905b2)[_0x2474('0x18')](_0x329a89);}};}function respondWithFilteredResult(_0x5cee25,_0x1c41d7){return function(_0x1a48a0){if(_0x1a48a0){var _0x2d605a=typeof _0x1c41d7[_0x2474('0x19')]===_0x2474('0x1a')&&typeof _0x1c41d7['limit']===_0x2474('0x1a');var _0x4886b8=_0x1a48a0[_0x2474('0x1b')];var _0x110522=_0x2d605a?0x0:_0x1c41d7['offset'];var _0x16e3d6=_0x2d605a?_0x1a48a0[_0x2474('0x1b')]:_0x1c41d7['offset']+_0x1c41d7[_0x2474('0x1c')];var _0x4388ad;if(_0x16e3d6>=_0x4886b8){_0x16e3d6=_0x4886b8;_0x4388ad=0xc8;}else{_0x4388ad=0xce;}_0x5cee25[_0x2474('0x17')](_0x4388ad);return _0x5cee25[_0x2474('0x1d')](_0x2474('0x1e'),_0x110522+'-'+_0x16e3d6+'/'+_0x4886b8)[_0x2474('0x18')](_0x1a48a0);}return null;};}function patchUpdates(_0x4d1adc){return function(_0x3aa449){try{jsonpatch[_0x2474('0x1f')](_0x3aa449,_0x4d1adc,!![]);}catch(_0x424a1c){return BPromise[_0x2474('0x20')](_0x424a1c);}return _0x3aa449[_0x2474('0x21')]();};}function saveUpdates(_0xd00d45,_0x1b55ab){return function(_0x368f27){if(_0x368f27){return _0x368f27['update'](_0xd00d45)[_0x2474('0x22')](function(_0x17dd44){return _0x17dd44;});}return null;};}function removeEntity(_0xb97dfb,_0xbaf175){return function(_0x203632){if(_0x203632){return _0x203632[_0x2474('0x23')]()[_0x2474('0x22')](function(){_0xb97dfb[_0x2474('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16d677,_0x7a7d02){return function(_0x222d64){if(!_0x222d64){_0x16d677[_0x2474('0x16')](0x194);}return _0x222d64;};}function handleError(_0x47f860,_0x3f821b){_0x3f821b=_0x3f821b||0x1f4;return function(_0x6524d){logger[_0x2474('0x24')](_0x6524d['stack']);if(_0x6524d['name']){delete _0x6524d[_0x2474('0x25')];}_0x47f860['status'](_0x3f821b)[_0x2474('0x26')](_0x6524d);};}exports[_0x2474('0x27')]=function(_0x6420d3,_0x3ac946){var _0x21cc0b={},_0x1fec79={},_0x30a54d={'count':0x0,'rows':[]};var _0x43d81f=_['map'](db[_0x2474('0x28')][_0x2474('0x29')],function(_0x4ef11d){return{'name':_0x4ef11d[_0x2474('0x2a')],'type':_0x4ef11d[_0x2474('0x2b')][_0x2474('0x2c')]};});_0x1fec79[_0x2474('0x2d')]=_['map'](_0x43d81f,_0x2474('0x25'));_0x1fec79[_0x2474('0x2e')]=_[_0x2474('0x2f')](_0x6420d3[_0x2474('0x2e')]);_0x1fec79[_0x2474('0x30')]=_[_0x2474('0x31')](_0x1fec79['model'],_0x1fec79[_0x2474('0x2e')]);_0x21cc0b[_0x2474('0x32')]=_[_0x2474('0x31')](_0x1fec79[_0x2474('0x2d')],qs['fields'](_0x6420d3['query']['fields']));_0x21cc0b['attributes']=_0x21cc0b[_0x2474('0x32')][_0x2474('0x33')]?_0x21cc0b['attributes']:_0x1fec79[_0x2474('0x2d')];if(!_0x6420d3[_0x2474('0x2e')][_0x2474('0x34')](_0x2474('0x35'))){_0x21cc0b[_0x2474('0x1c')]=qs['limit'](_0x6420d3[_0x2474('0x2e')][_0x2474('0x1c')]);_0x21cc0b[_0x2474('0x19')]=qs[_0x2474('0x19')](_0x6420d3[_0x2474('0x2e')]['offset']);}_0x21cc0b[_0x2474('0x36')]=qs[_0x2474('0x37')](_0x6420d3[_0x2474('0x2e')][_0x2474('0x37')]);_0x21cc0b['where']=qs[_0x2474('0x30')](_[_0x2474('0x38')](_0x6420d3[_0x2474('0x2e')],_0x1fec79[_0x2474('0x30')]),_0x43d81f);if(_0x6420d3['query'][_0x2474('0x39')]){_0x21cc0b[_0x2474('0x3a')]=_['merge'](_0x21cc0b[_0x2474('0x3a')],{'$or':_['map'](_0x43d81f,function(_0x11790c){if(_0x11790c['type']!==_0x2474('0x3b')){var _0x4ac3e2={};_0x4ac3e2[_0x11790c[_0x2474('0x25')]]={'$like':'%'+_0x6420d3[_0x2474('0x2e')][_0x2474('0x39')]+'%'};return _0x4ac3e2;}})});}_0x21cc0b=_[_0x2474('0x3c')]({},_0x21cc0b,_0x6420d3[_0x2474('0x3d')]);var _0x341ce0={'where':_0x21cc0b[_0x2474('0x3a')]};return db[_0x2474('0x28')][_0x2474('0x1b')](_0x341ce0)[_0x2474('0x22')](function(_0x377bc1){_0x30a54d[_0x2474('0x1b')]=_0x377bc1;if(_0x6420d3[_0x2474('0x2e')][_0x2474('0x3e')]){_0x21cc0b[_0x2474('0x3f')]=[{'all':!![]}];}return db['SquareMessage'][_0x2474('0x40')](_0x21cc0b);})[_0x2474('0x22')](function(_0x5e3866){_0x30a54d[_0x2474('0x41')]=_0x5e3866;return _0x30a54d;})['then'](respondWithFilteredResult(_0x3ac946,_0x21cc0b))[_0x2474('0x42')](handleError(_0x3ac946,null));};exports['show']=function(_0x3278c6,_0x478ccf){var _0x1092b6={'raw':!![],'where':{'id':_0x3278c6[_0x2474('0x43')]['id']}},_0x4f3b45={};_0x4f3b45['model']=_[_0x2474('0x2f')](db['SquareMessage'][_0x2474('0x29')]);_0x4f3b45[_0x2474('0x2e')]=_[_0x2474('0x2f')](_0x3278c6[_0x2474('0x2e')]);_0x4f3b45[_0x2474('0x30')]=_[_0x2474('0x31')](_0x4f3b45[_0x2474('0x2d')],_0x4f3b45[_0x2474('0x2e')]);_0x1092b6[_0x2474('0x32')]=_[_0x2474('0x31')](_0x4f3b45[_0x2474('0x2d')],qs[_0x2474('0x44')](_0x3278c6[_0x2474('0x2e')][_0x2474('0x44')]));_0x1092b6[_0x2474('0x32')]=_0x1092b6['attributes'][_0x2474('0x33')]?_0x1092b6[_0x2474('0x32')]:_0x4f3b45[_0x2474('0x2d')];if(_0x3278c6[_0x2474('0x2e')][_0x2474('0x3e')]){_0x1092b6['include']=[{'all':!![]}];}_0x1092b6=_[_0x2474('0x3c')]({},_0x1092b6,_0x3278c6[_0x2474('0x3d')]);return db[_0x2474('0x28')]['find'](_0x1092b6)[_0x2474('0x22')](handleEntityNotFound(_0x478ccf,null))[_0x2474('0x22')](respondWithResult(_0x478ccf,null))[_0x2474('0x42')](handleError(_0x478ccf,null));};exports[_0x2474('0x45')]=function(_0xac677,_0x490d05){return db[_0x2474('0x28')][_0x2474('0x45')](_0xac677[_0x2474('0x46')],{})['then'](respondWithResult(_0x490d05,0xc9))['catch'](handleError(_0x490d05,null));};exports['update']=function(_0x24d2e6,_0x5e6d0c){if(_0x24d2e6['body']['id']){delete _0x24d2e6[_0x2474('0x46')]['id'];}return db['SquareMessage'][_0x2474('0x47')]({'where':{'id':_0x24d2e6['params']['id']}})[_0x2474('0x22')](handleEntityNotFound(_0x5e6d0c,null))['then'](saveUpdates(_0x24d2e6['body'],null))[_0x2474('0x22')](respondWithResult(_0x5e6d0c,null))[_0x2474('0x42')](handleError(_0x5e6d0c,null));};exports[_0x2474('0x23')]=function(_0x5c4965,_0x51c93d){return db[_0x2474('0x28')][_0x2474('0x47')]({'where':{'id':_0x5c4965[_0x2474('0x43')]['id']}})[_0x2474('0x22')](handleEntityNotFound(_0x51c93d,null))[_0x2474('0x22')](removeEntity(_0x51c93d,null))[_0x2474('0x42')](handleError(_0x51c93d,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 03c9a11..909f8e8 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 _0x04cf=['api','moment','bluebird','request-promise','../../config/environment','exports','define','square_messages','lodash','util','../../config/logger'];(function(_0x2aa62b,_0xf6bb51){var _0x100ee0=function(_0x2f1a83){while(--_0x2f1a83){_0x2aa62b['push'](_0x2aa62b['shift']());}};_0x100ee0(++_0xf6bb51);}(_0x04cf,0x1e1));var _0xf04c=function(_0x32b485,_0x4e8d08){_0x32b485=_0x32b485-0x0;var _0x380e29=_0x04cf[_0x32b485];return _0x380e29;};'use strict';var _=require(_0xf04c('0x0'));var util=require(_0xf04c('0x1'));var logger=require(_0xf04c('0x2'))(_0xf04c('0x3'));var moment=require(_0xf04c('0x4'));var BPromise=require(_0xf04c('0x5'));var rp=require(_0xf04c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf04c('0x7'));var attributes=require('./squareMessage.attributes');module[_0xf04c('0x8')]=function(_0x5bc5eb,_0x54c236){return _0x5bc5eb[_0xf04c('0x9')]('SquareMessage',attributes,{'tableName':_0xf04c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe130=['SquareMessage','square_messages','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x54a761,_0x431fd4){var _0x37d1da=function(_0x5ca617){while(--_0x5ca617){_0x54a761['push'](_0x54a761['shift']());}};_0x37d1da(++_0x431fd4);}(_0xe130,0x12b));var _0x0e13=function(_0x4d633b,_0x10b08d){_0x4d633b=_0x4d633b-0x0;var _0x5bafa5=_0xe130[_0x4d633b];return _0x5bafa5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0e13('0x0'))(_0x0e13('0x1'));var moment=require('moment');var BPromise=require(_0x0e13('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e13('0x3'));var rimraf=require(_0x0e13('0x4'));var config=require(_0x0e13('0x5'));var attributes=require('./squareMessage.attributes');module[_0x0e13('0x6')]=function(_0x91a6ea,_0x101d30){return _0x91a6ea['define'](_0x0e13('0x7'),attributes,{'tableName':_0x0e13('0x8'),'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 30eac46..31abb8c 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 _0x68d5=['info','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareMessage','create','body','options','raw'];(function(_0x562d0a,_0x4a7130){var _0x3c5674=function(_0x35eb5d){while(--_0x35eb5d){_0x562d0a['push'](_0x562d0a['shift']());}};_0x3c5674(++_0x4a7130);}(_0x68d5,0x146));var _0x568d=function(_0x45a9d5,_0xdf7683){_0x45a9d5=_0x45a9d5-0x0;var _0x517aba=_0x68d5[_0x45a9d5];return _0x517aba;};'use strict';var _=require(_0x568d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x568d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x568d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x568d('0x3'));var logger=require(_0x568d('0x4'))(_0x568d('0x5'));var config=require('../../config/environment');var jayson=require(_0x568d('0x6'));var client=jayson[_0x568d('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0b60,_0x4a421a,_0x465f6d){return new BPromise(function(_0xf21a0,_0x31a45f){return client[_0x568d('0x8')](_0x3b0b60,_0x465f6d)[_0x568d('0x9')](function(_0x562607){logger['info'](_0x568d('0xa'),_0x4a421a,_0x568d('0xb'));logger[_0x568d('0xc')](_0x568d('0xd'),_0x4a421a,_0x568d('0xb'),JSON[_0x568d('0xe')](_0x562607));if(_0x562607[_0x568d('0xf')]){if(_0x562607['error'][_0x568d('0x10')]===0x1f4){logger[_0x568d('0xf')](_0x568d('0xa'),_0x4a421a,_0x562607[_0x568d('0xf')]['message']);return _0x31a45f(_0x562607[_0x568d('0xf')][_0x568d('0x11')]);}logger[_0x568d('0xf')](_0x568d('0xa'),_0x4a421a,_0x562607['error'][_0x568d('0x11')]);return _0xf21a0(_0x562607[_0x568d('0xf')]['message']);}else{logger['info'](_0x568d('0xa'),_0x4a421a,_0x568d('0xb'));_0xf21a0(_0x562607[_0x568d('0x12')][_0x568d('0x11')]);}})['catch'](function(_0x3da007){logger[_0x568d('0xf')](_0x568d('0xa'),_0x4a421a,_0x3da007);_0x31a45f(_0x3da007);});});}exports[_0x568d('0x13')]=function(_0x597ded){var _0xf3595d=this;return new Promise(function(_0x4c7038,_0x4703ea){return db['SquareMessage'][_0x568d('0x14')](_0x597ded[_0x568d('0x15')],{'raw':_0x597ded[_0x568d('0x16')]?_0x597ded[_0x568d('0x16')][_0x568d('0x17')]===undefined?!![]:![]:!![]})[_0x568d('0x9')](function(_0x379b9c){logger[_0x568d('0x18')]('CreateSquareMessage',_0x597ded);logger['debug'](_0x568d('0x13'),_0x597ded,JSON['stringify'](_0x379b9c));_0x4c7038(_0x379b9c);})['catch'](function(_0x30904e){logger[_0x568d('0xf')](_0x568d('0x13'),_0x30904e[_0x568d('0x11')],_0x597ded);_0x4703ea(_0xf3595d[_0x568d('0xf')](0x1f4,_0x30904e[_0x568d('0x11')]));});});}; \ No newline at end of file +var _0x2a66=['result','catch','CreateSquareMessage','SquareMessage','create','body','options','lodash','util','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','message','SquareMessage,\x20%s,\x20%s','info'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2a66,0xbd));var _0x62a6=function(_0x5ee71e,_0x28e6bf){_0x5ee71e=_0x5ee71e-0x0;var _0x1675b1=_0x2a66[_0x5ee71e];return _0x1675b1;};'use strict';var _=require(_0x62a6('0x0'));var util=require(_0x62a6('0x1'));var moment=require('moment');var BPromise=require(_0x62a6('0x2'));var rs=require(_0x62a6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x62a6('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x62a6('0x5'));var jayson=require(_0x62a6('0x6'));var client=jayson[_0x62a6('0x7')][_0x62a6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bbae2,_0x2c87eb,_0x506a4d){return new BPromise(function(_0x3d9cfb,_0x25d552){return client[_0x62a6('0x9')](_0x1bbae2,_0x506a4d)[_0x62a6('0xa')](function(_0x55ed00){logger['info']('SquareMessage,\x20%s,\x20%s',_0x2c87eb,_0x62a6('0xb'));logger[_0x62a6('0xc')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x2c87eb,_0x62a6('0xb'),JSON[_0x62a6('0xd')](_0x55ed00));if(_0x55ed00[_0x62a6('0xe')]){if(_0x55ed00[_0x62a6('0xe')][_0x62a6('0xf')]===0x1f4){logger[_0x62a6('0xe')]('SquareMessage,\x20%s,\x20%s',_0x2c87eb,_0x55ed00[_0x62a6('0xe')][_0x62a6('0x10')]);return _0x25d552(_0x55ed00[_0x62a6('0xe')][_0x62a6('0x10')]);}logger[_0x62a6('0xe')](_0x62a6('0x11'),_0x2c87eb,_0x55ed00[_0x62a6('0xe')][_0x62a6('0x10')]);return _0x3d9cfb(_0x55ed00[_0x62a6('0xe')]['message']);}else{logger[_0x62a6('0x12')](_0x62a6('0x11'),_0x2c87eb,'request\x20sent');_0x3d9cfb(_0x55ed00[_0x62a6('0x13')][_0x62a6('0x10')]);}})[_0x62a6('0x14')](function(_0x4de54d){logger[_0x62a6('0xe')](_0x62a6('0x11'),_0x2c87eb,_0x4de54d);_0x25d552(_0x4de54d);});});}exports[_0x62a6('0x15')]=function(_0x27c32a){var _0x35026b=this;return new Promise(function(_0x2ea155,_0x1e30ff){return db[_0x62a6('0x16')][_0x62a6('0x17')](_0x27c32a[_0x62a6('0x18')],{'raw':_0x27c32a[_0x62a6('0x19')]?_0x27c32a[_0x62a6('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x54a6ac){logger[_0x62a6('0x12')](_0x62a6('0x15'),_0x27c32a);logger[_0x62a6('0xc')](_0x62a6('0x15'),_0x27c32a,JSON[_0x62a6('0xd')](_0x54a6ac));_0x2ea155(_0x54a6ac);})[_0x62a6('0x14')](function(_0xe19046){logger[_0x62a6('0xe')](_0x62a6('0x15'),_0xe19046[_0x62a6('0x10')],_0x27c32a);_0x1e30ff(_0x35026b[_0x62a6('0xe')](0x1f4,_0xe19046[_0x62a6('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 0e79fc5..6ad40ff 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 _0x8514=['show','/:id/test','15s','post','create','put','isAuthenticated','update','delete','exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','index','/:id'];(function(_0x9967,_0x51ab43){var _0x3baf1f=function(_0x5a4f12){while(--_0x5a4f12){_0x9967['push'](_0x9967['shift']());}};_0x3baf1f(++_0x51ab43);}(_0x8514,0xe6));var _0x4851=function(_0x5d7ba6,_0x53ddf2){_0x5d7ba6=_0x5d7ba6-0x0;var _0x51b49c=_0x8514[_0x5d7ba6];return _0x51b49c;};'use strict';var multer=require('multer');var util=require(_0x4851('0x0'));var path=require('path');var timeout=require(_0x4851('0x1'));var express=require(_0x4851('0x2'));var router=express['Router']();var fs_extra=require(_0x4851('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4851('0x4'));var config=require(_0x4851('0x5'));var controller=require(_0x4851('0x6'));router[_0x4851('0x7')]('/',auth['isAuthenticated'](),controller[_0x4851('0x8')]);router[_0x4851('0x7')](_0x4851('0x9'),auth['isAuthenticated'](),controller[_0x4851('0xa')]);router[_0x4851('0x7')](_0x4851('0xb'),auth['isAuthenticated'](),timeout(_0x4851('0xc')),controller['test']);router[_0x4851('0xd')]('/',auth['isAuthenticated'](),controller[_0x4851('0xe')]);router[_0x4851('0xf')](_0x4851('0x9'),auth[_0x4851('0x10')](),controller[_0x4851('0x11')]);router[_0x4851('0x12')](_0x4851('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x4851('0x13')]=router; \ No newline at end of file +var _0xee23=['isAuthenticated','show','15s','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get'];(function(_0x45f04e,_0x535592){var _0xe3ac6=function(_0x5f4d8f){while(--_0x5f4d8f){_0x45f04e['push'](_0x45f04e['shift']());}};_0xe3ac6(++_0x535592);}(_0xee23,0x129));var _0x3ee2=function(_0x2d0ef2,_0x194a92){_0x2d0ef2=_0x2d0ef2-0x0;var _0xf8937d=_0xee23[_0x2d0ef2];return _0xf8937d;};'use strict';var multer=require('multer');var util=require(_0x3ee2('0x0'));var path=require(_0x3ee2('0x1'));var timeout=require(_0x3ee2('0x2'));var express=require(_0x3ee2('0x3'));var router=express[_0x3ee2('0x4')]();var fs_extra=require(_0x3ee2('0x5'));var auth=require(_0x3ee2('0x6'));var interaction=require(_0x3ee2('0x7'));var config=require(_0x3ee2('0x8'));var controller=require(_0x3ee2('0x9'));router[_0x3ee2('0xa')]('/',auth[_0x3ee2('0xb')](),controller['index']);router['get']('/:id',auth[_0x3ee2('0xb')](),controller[_0x3ee2('0xc')]);router[_0x3ee2('0xa')]('/:id/test',auth[_0x3ee2('0xb')](),timeout(_0x3ee2('0xd')),controller['test']);router[_0x3ee2('0xe')]('/',auth[_0x3ee2('0xb')](),controller[_0x3ee2('0xf')]);router[_0x3ee2('0x10')](_0x3ee2('0x11'),auth[_0x3ee2('0xb')](),controller[_0x3ee2('0x12')]);router[_0x3ee2('0x13')](_0x3ee2('0x11'),auth[_0x3ee2('0xb')](),controller[_0x3ee2('0x14')]);module[_0x3ee2('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 67871cd..9ce1c31 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 _0x7394=['STRING','sequelize','name'];(function(_0x12a941,_0x5496b8){var _0x9680c5=function(_0x279ae7){while(--_0x279ae7){_0x12a941['push'](_0x12a941['shift']());}};_0x9680c5(++_0x5496b8);}(_0x7394,0x175));var _0x4739=function(_0x4d0dae,_0x2ed9de){_0x4d0dae=_0x4d0dae-0x0;var _0xdd017f=_0x7394[_0x4d0dae];return _0xdd017f;};'use strict';var Sequelize=require(_0x4739('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x4739('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0x4739('0x2')]},'description':{'type':Sequelize[_0x4739('0x2')]}}; \ No newline at end of file +var _0xa0a9=['STRING','name','sequelize'];(function(_0x4c6840,_0x97fe36){var _0x23e354=function(_0x5de5d7){while(--_0x5de5d7){_0x4c6840['push'](_0x4c6840['shift']());}};_0x23e354(++_0x97fe36);}(_0xa0a9,0x131));var _0x9a0a=function(_0x546e07,_0x383502){_0x546e07=_0x546e07-0x0;var _0x2463e2=_0xa0a9[_0x546e07];return _0x2463e2;};'use strict';var Sequelize=require(_0x9a0a('0x0'));module['exports']={'name':{'type':Sequelize[_0x9a0a('0x1')],'unique':_0x9a0a('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 36988c9..c631ce5 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 _0xf9f9=['moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','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','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','get','ODBC','UserProfileResource','then','error','stack','name','index','map','SquareOdbc','fieldName','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','test','openSync','dsn','closeSync','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x64a51,_0x1c61b7){var _0x1eba45=function(_0x230cf8){while(--_0x230cf8){_0x64a51['push'](_0x64a51['shift']());}};_0x1eba45(++_0x1c61b7);}(_0xf9f9,0xaa));var _0x9f9f=function(_0x4a243e,_0x58fd4f){_0x4a243e=_0x4a243e-0x0;var _0x3655c3=_0xf9f9[_0x4a243e];return _0x3655c3;};'use strict';var emlformat=require(_0x9f9f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9f9f('0x1'));var jsonpatch=require(_0x9f9f('0x2'));var rp=require(_0x9f9f('0x3'));var moment=require(_0x9f9f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9f9f('0x5'));var path=require(_0x9f9f('0x6'));var sox=require(_0x9f9f('0x7'));var csv=require('to-csv');var ejs=require(_0x9f9f('0x8'));var fs=require('fs');var fs_extra=require(_0x9f9f('0x9'));var _=require(_0x9f9f('0xa'));var squel=require(_0x9f9f('0xb'));var crypto=require(_0x9f9f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9f9f('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9f9f('0xe'));var authService=require(_0x9f9f('0xf'));var qs=require(_0x9f9f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9f9f('0x11'));var logger=require(_0x9f9f('0x12'))(_0x9f9f('0x13'));var utils=require(_0x9f9f('0x14'));var config=require(_0x9f9f('0x15'));var licenseUtil=require(_0x9f9f('0x16'));var db=require(_0x9f9f('0x17'))['db'];function respondWithStatusCode(_0x4077d5,_0x2528b5){_0x2528b5=_0x2528b5||0xcc;return function(_0x22cbfb){if(_0x22cbfb){return _0x4077d5[_0x9f9f('0x18')](_0x2528b5);}return _0x4077d5[_0x9f9f('0x19')](_0x2528b5)[_0x9f9f('0x1a')]();};}function respondWithResult(_0x1b6297,_0x32ae1c){_0x32ae1c=_0x32ae1c||0xc8;return function(_0x1d65c9){if(_0x1d65c9){return _0x1b6297[_0x9f9f('0x19')](_0x32ae1c)[_0x9f9f('0x1b')](_0x1d65c9);}};}function respondWithFilteredResult(_0x265098,_0x270d61){return function(_0x234fbb){if(_0x234fbb){var _0x8d906f=typeof _0x270d61[_0x9f9f('0x1c')]==='undefined'&&typeof _0x270d61[_0x9f9f('0x1d')]===_0x9f9f('0x1e');var _0x554d46=_0x234fbb[_0x9f9f('0x1f')];var _0x24283f=_0x8d906f?0x0:_0x270d61[_0x9f9f('0x1c')];var _0x125456=_0x8d906f?_0x234fbb[_0x9f9f('0x1f')]:_0x270d61[_0x9f9f('0x1c')]+_0x270d61[_0x9f9f('0x1d')];var _0x4d1a78;if(_0x125456>=_0x554d46){_0x125456=_0x554d46;_0x4d1a78=0xc8;}else{_0x4d1a78=0xce;}_0x265098[_0x9f9f('0x19')](_0x4d1a78);return _0x265098[_0x9f9f('0x20')](_0x9f9f('0x21'),_0x24283f+'-'+_0x125456+'/'+_0x554d46)['json'](_0x234fbb);}return null;};}function patchUpdates(_0x4e884c){return function(_0x41e395){try{jsonpatch[_0x9f9f('0x22')](_0x41e395,_0x4e884c,!![]);}catch(_0x614cf0){return BPromise[_0x9f9f('0x23')](_0x614cf0);}return _0x41e395['save']();};}function saveUpdates(_0x1f4997,_0x850f91){return function(_0x25cb10){if(_0x25cb10){return _0x25cb10[_0x9f9f('0x24')](_0x1f4997)['then'](function(_0x53e89a){return _0x53e89a;});}return null;};}function removeEntity(_0x30eccf,_0x3add88){return function(_0x1537a2){if(_0x1537a2){return _0x1537a2[_0x9f9f('0x25')]()['then'](function(){var _0x541298=_0x1537a2[_0x9f9f('0x26')]({'plain':!![]});var _0x4a1915=_0x9f9f('0x27');return db[_0x9f9f('0x28')][_0x9f9f('0x25')]({'where':{'type':_0x4a1915,'resourceId':_0x541298['id']}})['then'](function(){return _0x1537a2;});})[_0x9f9f('0x29')](function(){_0x30eccf[_0x9f9f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb566bc,_0x773ae4){return function(_0x20c7d0){if(!_0x20c7d0){_0xb566bc[_0x9f9f('0x18')](0x194);}return _0x20c7d0;};}function handleError(_0x41313a,_0x25fe3f){_0x25fe3f=_0x25fe3f||0x1f4;return function(_0x275230){logger[_0x9f9f('0x2a')](_0x275230[_0x9f9f('0x2b')]);if(_0x275230['name']){delete _0x275230[_0x9f9f('0x2c')];}_0x41313a['status'](_0x25fe3f)['send'](_0x275230);};}exports[_0x9f9f('0x2d')]=function(_0x13c9cc,_0x3fbb06){var _0x139103={},_0x5c5046={},_0x6e5ca6={'count':0x0,'rows':[]};var _0x16e690=_[_0x9f9f('0x2e')](db[_0x9f9f('0x2f')]['rawAttributes'],function(_0x27c4c6){return{'name':_0x27c4c6[_0x9f9f('0x30')],'type':_0x27c4c6['type'][_0x9f9f('0x31')]};});_0x5c5046[_0x9f9f('0x32')]=_[_0x9f9f('0x2e')](_0x16e690,_0x9f9f('0x2c'));_0x5c5046['query']=_[_0x9f9f('0x33')](_0x13c9cc['query']);_0x5c5046[_0x9f9f('0x34')]=_['intersection'](_0x5c5046[_0x9f9f('0x32')],_0x5c5046[_0x9f9f('0x35')]);_0x139103[_0x9f9f('0x36')]=_[_0x9f9f('0x37')](_0x5c5046[_0x9f9f('0x32')],qs['fields'](_0x13c9cc['query'][_0x9f9f('0x38')]));_0x139103[_0x9f9f('0x36')]=_0x139103[_0x9f9f('0x36')][_0x9f9f('0x39')]?_0x139103[_0x9f9f('0x36')]:_0x5c5046[_0x9f9f('0x32')];if(!_0x13c9cc[_0x9f9f('0x35')][_0x9f9f('0x3a')](_0x9f9f('0x3b'))){_0x139103[_0x9f9f('0x1d')]=qs['limit'](_0x13c9cc[_0x9f9f('0x35')][_0x9f9f('0x1d')]);_0x139103['offset']=qs['offset'](_0x13c9cc[_0x9f9f('0x35')]['offset']);}_0x139103['order']=qs[_0x9f9f('0x3c')](_0x13c9cc['query'][_0x9f9f('0x3c')]);_0x139103[_0x9f9f('0x3d')]=qs[_0x9f9f('0x34')](_[_0x9f9f('0x3e')](_0x13c9cc[_0x9f9f('0x35')],_0x5c5046[_0x9f9f('0x34')]),_0x16e690);if(_0x13c9cc['query']['filter']){_0x139103[_0x9f9f('0x3d')]=_[_0x9f9f('0x3f')](_0x139103['where'],{'$or':_[_0x9f9f('0x2e')](_0x16e690,function(_0x463aa4){if(_0x463aa4[_0x9f9f('0x40')]!==_0x9f9f('0x41')){var _0x5f2dd3={};_0x5f2dd3[_0x463aa4['name']]={'$like':'%'+_0x13c9cc['query'][_0x9f9f('0x42')]+'%'};return _0x5f2dd3;}})});}_0x139103=_[_0x9f9f('0x3f')]({},_0x139103,_0x13c9cc[_0x9f9f('0x43')]);var _0x34fe96={'where':_0x139103[_0x9f9f('0x3d')]};return db[_0x9f9f('0x2f')][_0x9f9f('0x1f')](_0x34fe96)['then'](function(_0x8549f9){_0x6e5ca6[_0x9f9f('0x1f')]=_0x8549f9;if(_0x13c9cc[_0x9f9f('0x35')][_0x9f9f('0x44')]){_0x139103[_0x9f9f('0x45')]=[{'all':!![]}];}return db[_0x9f9f('0x2f')][_0x9f9f('0x46')](_0x139103);})[_0x9f9f('0x29')](function(_0x1b1232){_0x6e5ca6[_0x9f9f('0x47')]=_0x1b1232;return _0x6e5ca6;})['then'](respondWithFilteredResult(_0x3fbb06,_0x139103))[_0x9f9f('0x48')](handleError(_0x3fbb06,null));};exports[_0x9f9f('0x49')]=function(_0x2654d9,_0x3ca3cc){var _0x3afcc0={'raw':!![],'where':{'id':_0x2654d9[_0x9f9f('0x4a')]['id']}},_0x40b510={};_0x40b510['model']=_[_0x9f9f('0x33')](db[_0x9f9f('0x2f')][_0x9f9f('0x4b')]);_0x40b510[_0x9f9f('0x35')]=_['keys'](_0x2654d9[_0x9f9f('0x35')]);_0x40b510[_0x9f9f('0x34')]=_[_0x9f9f('0x37')](_0x40b510[_0x9f9f('0x32')],_0x40b510[_0x9f9f('0x35')]);_0x3afcc0[_0x9f9f('0x36')]=_['intersection'](_0x40b510[_0x9f9f('0x32')],qs[_0x9f9f('0x38')](_0x2654d9[_0x9f9f('0x35')]['fields']));_0x3afcc0[_0x9f9f('0x36')]=_0x3afcc0[_0x9f9f('0x36')]['length']?_0x3afcc0['attributes']:_0x40b510['model'];if(_0x2654d9['query'][_0x9f9f('0x44')]){_0x3afcc0['include']=[{'all':!![]}];}_0x3afcc0=_['merge']({},_0x3afcc0,_0x2654d9[_0x9f9f('0x43')]);return db['SquareOdbc'][_0x9f9f('0x4c')](_0x3afcc0)[_0x9f9f('0x29')](handleEntityNotFound(_0x3ca3cc,null))[_0x9f9f('0x29')](respondWithResult(_0x3ca3cc,null))[_0x9f9f('0x48')](handleError(_0x3ca3cc,null));};exports[_0x9f9f('0x4d')]=function(_0x48ba1c,_0x47482a){return db[_0x9f9f('0x2f')][_0x9f9f('0x4d')](_0x48ba1c[_0x9f9f('0x4e')],{})[_0x9f9f('0x29')](function(_0x33210a){var _0x32cda1=_0x48ba1c['user'][_0x9f9f('0x26')]({'plain':!![]});if(!_0x32cda1)throw new Error(_0x9f9f('0x4f'));if(_0x32cda1[_0x9f9f('0x50')]==='user'){var _0x4a3ce3=_0x33210a[_0x9f9f('0x26')]({'plain':!![]});var _0x460a8a=_0x9f9f('0x27');return db['UserProfileSection'][_0x9f9f('0x4c')]({'where':{'name':_0x460a8a,'userProfileId':_0x32cda1[_0x9f9f('0x51')]},'raw':!![]})[_0x9f9f('0x29')](function(_0x44bcd2){if(_0x44bcd2&&_0x44bcd2[_0x9f9f('0x52')]===0x0){return db[_0x9f9f('0x28')]['create']({'name':_0x4a3ce3['name'],'resourceId':_0x4a3ce3['id'],'type':_0x44bcd2['name'],'sectionId':_0x44bcd2['id']},{})[_0x9f9f('0x29')](function(){return _0x33210a;});}else{return _0x33210a;}})[_0x9f9f('0x48')](function(_0x16fac0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x16fac0);throw _0x16fac0;});}return _0x33210a;})[_0x9f9f('0x29')](respondWithResult(_0x47482a,0xc9))['catch'](handleError(_0x47482a,null));};exports[_0x9f9f('0x24')]=function(_0x4b7ed3,_0x36aa02){if(_0x4b7ed3[_0x9f9f('0x4e')]['id']){delete _0x4b7ed3['body']['id'];}return db[_0x9f9f('0x2f')]['find']({'where':{'id':_0x4b7ed3['params']['id']}})[_0x9f9f('0x29')](handleEntityNotFound(_0x36aa02,null))['then'](saveUpdates(_0x4b7ed3['body'],null))[_0x9f9f('0x29')](respondWithResult(_0x36aa02,null))[_0x9f9f('0x48')](handleError(_0x36aa02,null));};exports['destroy']=function(_0x5bb41e,_0x44cc98){return db[_0x9f9f('0x2f')][_0x9f9f('0x4c')]({'where':{'id':_0x5bb41e[_0x9f9f('0x4a')]['id']}})[_0x9f9f('0x29')](handleEntityNotFound(_0x44cc98,null))[_0x9f9f('0x29')](removeEntity(_0x44cc98,null))[_0x9f9f('0x48')](handleError(_0x44cc98,null));};exports[_0x9f9f('0x53')]=function(_0x35fd89,_0x61ae8e,_0x317b96){var _0x114ebe;return db[_0x9f9f('0x2f')][_0x9f9f('0x4c')]({'where':{'id':_0x35fd89['params']['id']},'attributes':['id','dsn']})[_0x9f9f('0x29')](handleEntityNotFound(_0x61ae8e,null))[_0x9f9f('0x29')](function(_0x23c76e){if(_0x23c76e){var _0x1d52e9=require('odbc')();_0x1d52e9[_0x9f9f('0x54')](_0x23c76e[_0x9f9f('0x55')]);_0x1d52e9[_0x9f9f('0x56')]();return _0x23c76e;}})[_0x9f9f('0x29')](respondWithResult(_0x61ae8e,null))[_0x9f9f('0x48')](handleError(_0x61ae8e,null));}; \ No newline at end of file +var _0x02df=['find','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','openSync','closeSync','eml-format','rimraf','fast-json-patch','request-promise','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','UserProfileResource','destroy','error','name','send','index','map','SquareOdbc','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','rawAttributes','create','user','role','ODBC'];(function(_0x4d3258,_0x3ccb47){var _0x27b67d=function(_0x5471e3){while(--_0x5471e3){_0x4d3258['push'](_0x4d3258['shift']());}};_0x27b67d(++_0x3ccb47);}(_0x02df,0x102));var _0xf02d=function(_0x55ddcd,_0x55a94a){_0x55ddcd=_0x55ddcd-0x0;var _0x2ab88e=_0x02df[_0x55ddcd];return _0x2ab88e;};'use strict';var emlformat=require(_0xf02d('0x0'));var rimraf=require(_0xf02d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf02d('0x2'));var rp=require(_0xf02d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf02d('0x4'));var path=require('path');var sox=require(_0xf02d('0x5'));var csv=require(_0xf02d('0x6'));var ejs=require(_0xf02d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf02d('0x8'));var crypto=require('crypto');var jsforce=require(_0xf02d('0x9'));var deskjs=require(_0xf02d('0xa'));var toCsv=require(_0xf02d('0x6'));var querystring=require(_0xf02d('0xb'));var Papa=require(_0xf02d('0xc'));var Redis=require('ioredis');var authService=require(_0xf02d('0xd'));var qs=require(_0xf02d('0xe'));var as=require(_0xf02d('0xf'));var hardwareService=require(_0xf02d('0x10'));var logger=require(_0xf02d('0x11'))(_0xf02d('0x12'));var utils=require(_0xf02d('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xf02d('0x14'));var db=require(_0xf02d('0x15'))['db'];function respondWithStatusCode(_0x58c69c,_0x94a08){_0x94a08=_0x94a08||0xcc;return function(_0x502604){if(_0x502604){return _0x58c69c[_0xf02d('0x16')](_0x94a08);}return _0x58c69c['status'](_0x94a08)[_0xf02d('0x17')]();};}function respondWithResult(_0x3c2c4e,_0x4e159f){_0x4e159f=_0x4e159f||0xc8;return function(_0x1c264d){if(_0x1c264d){return _0x3c2c4e[_0xf02d('0x18')](_0x4e159f)[_0xf02d('0x19')](_0x1c264d);}};}function respondWithFilteredResult(_0x57bb38,_0xa26cd){return function(_0x34c81d){if(_0x34c81d){var _0x938630=typeof _0xa26cd[_0xf02d('0x1a')]===_0xf02d('0x1b')&&typeof _0xa26cd[_0xf02d('0x1c')]===_0xf02d('0x1b');var _0x227ac3=_0x34c81d[_0xf02d('0x1d')];var _0xaa7707=_0x938630?0x0:_0xa26cd[_0xf02d('0x1a')];var _0x4b775e=_0x938630?_0x34c81d[_0xf02d('0x1d')]:_0xa26cd[_0xf02d('0x1a')]+_0xa26cd['limit'];var _0x1179e2;if(_0x4b775e>=_0x227ac3){_0x4b775e=_0x227ac3;_0x1179e2=0xc8;}else{_0x1179e2=0xce;}_0x57bb38['status'](_0x1179e2);return _0x57bb38[_0xf02d('0x1e')](_0xf02d('0x1f'),_0xaa7707+'-'+_0x4b775e+'/'+_0x227ac3)[_0xf02d('0x19')](_0x34c81d);}return null;};}function patchUpdates(_0x4b3ba8){return function(_0x495e64){try{jsonpatch[_0xf02d('0x20')](_0x495e64,_0x4b3ba8,!![]);}catch(_0x4fd6ed){return BPromise[_0xf02d('0x21')](_0x4fd6ed);}return _0x495e64[_0xf02d('0x22')]();};}function saveUpdates(_0x5c58e2,_0x4ede35){return function(_0x1fb845){if(_0x1fb845){return _0x1fb845[_0xf02d('0x23')](_0x5c58e2)[_0xf02d('0x24')](function(_0x5e8de7){return _0x5e8de7;});}return null;};}function removeEntity(_0x4fefe2,_0x16f6a5){return function(_0x1f3b06){if(_0x1f3b06){return _0x1f3b06['destroy']()['then'](function(){var _0x421fdc=_0x1f3b06['get']({'plain':!![]});var _0x2e0f47='ODBC';return db[_0xf02d('0x25')][_0xf02d('0x26')]({'where':{'type':_0x2e0f47,'resourceId':_0x421fdc['id']}})['then'](function(){return _0x1f3b06;});})[_0xf02d('0x24')](function(){_0x4fefe2[_0xf02d('0x18')](0xcc)[_0xf02d('0x17')]();});}};}function handleEntityNotFound(_0xf60c43,_0x33195f){return function(_0x17bc46){if(!_0x17bc46){_0xf60c43[_0xf02d('0x16')](0x194);}return _0x17bc46;};}function handleError(_0x38b567,_0x59f5d4){_0x59f5d4=_0x59f5d4||0x1f4;return function(_0x1c7970){logger[_0xf02d('0x27')](_0x1c7970['stack']);if(_0x1c7970[_0xf02d('0x28')]){delete _0x1c7970[_0xf02d('0x28')];}_0x38b567[_0xf02d('0x18')](_0x59f5d4)[_0xf02d('0x29')](_0x1c7970);};}exports[_0xf02d('0x2a')]=function(_0x1cd888,_0xd48c02){var _0x59a1cb={},_0x158699={},_0x9da443={'count':0x0,'rows':[]};var _0x498672=_[_0xf02d('0x2b')](db[_0xf02d('0x2c')]['rawAttributes'],function(_0x44acde){return{'name':_0x44acde[_0xf02d('0x2d')],'type':_0x44acde[_0xf02d('0x2e')][_0xf02d('0x2f')]};});_0x158699[_0xf02d('0x30')]=_[_0xf02d('0x2b')](_0x498672,'name');_0x158699['query']=_[_0xf02d('0x31')](_0x1cd888[_0xf02d('0x32')]);_0x158699[_0xf02d('0x33')]=_[_0xf02d('0x34')](_0x158699[_0xf02d('0x30')],_0x158699[_0xf02d('0x32')]);_0x59a1cb[_0xf02d('0x35')]=_[_0xf02d('0x34')](_0x158699[_0xf02d('0x30')],qs[_0xf02d('0x36')](_0x1cd888['query'][_0xf02d('0x36')]));_0x59a1cb['attributes']=_0x59a1cb['attributes'][_0xf02d('0x37')]?_0x59a1cb[_0xf02d('0x35')]:_0x158699[_0xf02d('0x30')];if(!_0x1cd888['query']['hasOwnProperty'](_0xf02d('0x38'))){_0x59a1cb[_0xf02d('0x1c')]=qs[_0xf02d('0x1c')](_0x1cd888[_0xf02d('0x32')][_0xf02d('0x1c')]);_0x59a1cb[_0xf02d('0x1a')]=qs[_0xf02d('0x1a')](_0x1cd888[_0xf02d('0x32')][_0xf02d('0x1a')]);}_0x59a1cb[_0xf02d('0x39')]=qs[_0xf02d('0x3a')](_0x1cd888[_0xf02d('0x32')]['sort']);_0x59a1cb[_0xf02d('0x3b')]=qs[_0xf02d('0x33')](_[_0xf02d('0x3c')](_0x1cd888[_0xf02d('0x32')],_0x158699[_0xf02d('0x33')]),_0x498672);if(_0x1cd888[_0xf02d('0x32')][_0xf02d('0x3d')]){_0x59a1cb[_0xf02d('0x3b')]=_[_0xf02d('0x3e')](_0x59a1cb[_0xf02d('0x3b')],{'$or':_[_0xf02d('0x2b')](_0x498672,function(_0x42c195){if(_0x42c195[_0xf02d('0x2e')]!=='VIRTUAL'){var _0x489797={};_0x489797[_0x42c195[_0xf02d('0x28')]]={'$like':'%'+_0x1cd888[_0xf02d('0x32')][_0xf02d('0x3d')]+'%'};return _0x489797;}})});}_0x59a1cb=_['merge']({},_0x59a1cb,_0x1cd888[_0xf02d('0x3f')]);var _0x427ff2={'where':_0x59a1cb[_0xf02d('0x3b')]};return db['SquareOdbc'][_0xf02d('0x1d')](_0x427ff2)[_0xf02d('0x24')](function(_0x13c0cc){_0x9da443['count']=_0x13c0cc;if(_0x1cd888[_0xf02d('0x32')][_0xf02d('0x40')]){_0x59a1cb[_0xf02d('0x41')]=[{'all':!![]}];}return db[_0xf02d('0x2c')][_0xf02d('0x42')](_0x59a1cb);})[_0xf02d('0x24')](function(_0x28cd79){_0x9da443['rows']=_0x28cd79;return _0x9da443;})[_0xf02d('0x24')](respondWithFilteredResult(_0xd48c02,_0x59a1cb))['catch'](handleError(_0xd48c02,null));};exports[_0xf02d('0x43')]=function(_0x5a0cd2,_0x53b243){var _0x108572={'raw':!![],'where':{'id':_0x5a0cd2[_0xf02d('0x44')]['id']}},_0xd0a3e4={};_0xd0a3e4[_0xf02d('0x30')]=_[_0xf02d('0x31')](db['SquareOdbc'][_0xf02d('0x45')]);_0xd0a3e4[_0xf02d('0x32')]=_[_0xf02d('0x31')](_0x5a0cd2['query']);_0xd0a3e4['filters']=_[_0xf02d('0x34')](_0xd0a3e4[_0xf02d('0x30')],_0xd0a3e4[_0xf02d('0x32')]);_0x108572[_0xf02d('0x35')]=_[_0xf02d('0x34')](_0xd0a3e4[_0xf02d('0x30')],qs[_0xf02d('0x36')](_0x5a0cd2[_0xf02d('0x32')][_0xf02d('0x36')]));_0x108572[_0xf02d('0x35')]=_0x108572['attributes'][_0xf02d('0x37')]?_0x108572['attributes']:_0xd0a3e4['model'];if(_0x5a0cd2['query'][_0xf02d('0x40')]){_0x108572[_0xf02d('0x41')]=[{'all':!![]}];}_0x108572=_[_0xf02d('0x3e')]({},_0x108572,_0x5a0cd2['options']);return db[_0xf02d('0x2c')]['find'](_0x108572)[_0xf02d('0x24')](handleEntityNotFound(_0x53b243,null))['then'](respondWithResult(_0x53b243,null))['catch'](handleError(_0x53b243,null));};exports[_0xf02d('0x46')]=function(_0x300232,_0x24a7a9){return db[_0xf02d('0x2c')][_0xf02d('0x46')](_0x300232['body'],{})[_0xf02d('0x24')](function(_0x48a306){var _0x5ba894=_0x300232[_0xf02d('0x47')]['get']({'plain':!![]});if(!_0x5ba894)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ba894[_0xf02d('0x48')]==='user'){var _0x35c4a4=_0x48a306['get']({'plain':!![]});var _0x15ac54=_0xf02d('0x49');return db['UserProfileSection'][_0xf02d('0x4a')]({'where':{'name':_0x15ac54,'userProfileId':_0x5ba894['userProfileId']},'raw':!![]})[_0xf02d('0x24')](function(_0x1e6d19){if(_0x1e6d19&&_0x1e6d19[_0xf02d('0x4b')]===0x0){return db[_0xf02d('0x25')]['create']({'name':_0x35c4a4[_0xf02d('0x28')],'resourceId':_0x35c4a4['id'],'type':_0x1e6d19['name'],'sectionId':_0x1e6d19['id']},{})[_0xf02d('0x24')](function(){return _0x48a306;});}else{return _0x48a306;}})[_0xf02d('0x4c')](function(_0x3597be){logger[_0xf02d('0x27')](_0xf02d('0x4d'),_0x3597be);throw _0x3597be;});}return _0x48a306;})['then'](respondWithResult(_0x24a7a9,0xc9))[_0xf02d('0x4c')](handleError(_0x24a7a9,null));};exports['update']=function(_0x4ce3ac,_0x1b8a2e){if(_0x4ce3ac[_0xf02d('0x4e')]['id']){delete _0x4ce3ac['body']['id'];}return db['SquareOdbc'][_0xf02d('0x4a')]({'where':{'id':_0x4ce3ac[_0xf02d('0x44')]['id']}})['then'](handleEntityNotFound(_0x1b8a2e,null))['then'](saveUpdates(_0x4ce3ac['body'],null))[_0xf02d('0x24')](respondWithResult(_0x1b8a2e,null))[_0xf02d('0x4c')](handleError(_0x1b8a2e,null));};exports['destroy']=function(_0x232bba,_0x322d7b){return db[_0xf02d('0x2c')]['find']({'where':{'id':_0x232bba[_0xf02d('0x44')]['id']}})[_0xf02d('0x24')](handleEntityNotFound(_0x322d7b,null))['then'](removeEntity(_0x322d7b,null))[_0xf02d('0x4c')](handleError(_0x322d7b,null));};exports[_0xf02d('0x4f')]=function(_0x2b5883,_0x84abd6,_0xc8f1df){var _0x33ac31;return db['SquareOdbc'][_0xf02d('0x4a')]({'where':{'id':_0x2b5883[_0xf02d('0x44')]['id']},'attributes':['id',_0xf02d('0x50')]})[_0xf02d('0x24')](handleEntityNotFound(_0x84abd6,null))['then'](function(_0x34770a){if(_0x34770a){var _0x3cf106=require('odbc')();_0x3cf106[_0xf02d('0x51')](_0x34770a[_0xf02d('0x50')]);_0x3cf106[_0xf02d('0x52')]();return _0x34770a;}})[_0xf02d('0x24')](respondWithResult(_0x84abd6,null))[_0xf02d('0x4c')](handleError(_0x84abd6,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 706e979..ea43024 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 _0x1cc0=['../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x4506b0,_0xa81e7b){var _0x285727=function(_0x49a265){while(--_0x49a265){_0x4506b0['push'](_0x4506b0['shift']());}};_0x285727(++_0xa81e7b);}(_0x1cc0,0x14b));var _0x01cc=function(_0x139d4f,_0x1fd551){_0x139d4f=_0x139d4f-0x0;var _0x545a26=_0x1cc0[_0x139d4f];return _0x545a26;};'use strict';var _=require(_0x01cc('0x0'));var util=require(_0x01cc('0x1'));var logger=require(_0x01cc('0x2'))('api');var moment=require(_0x01cc('0x3'));var BPromise=require(_0x01cc('0x4'));var rp=require(_0x01cc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x01cc('0x6'));var config=require(_0x01cc('0x7'));var attributes=require(_0x01cc('0x8'));module[_0x01cc('0x9')]=function(_0xfab31a,_0x4f7aa0){return _0xfab31a[_0x01cc('0xa')](_0x01cc('0xb'),attributes,{'tableName':_0x01cc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd72b=['../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x247941,_0x7c4677){var _0x47ee6c=function(_0x133c6d){while(--_0x133c6d){_0x247941['push'](_0x247941['shift']());}};_0x47ee6c(++_0x7c4677);}(_0xd72b,0xc6));var _0xbd72=function(_0x3bd528,_0x5cdaeb){_0x3bd528=_0x3bd528-0x0;var _0x963c7c=_0xd72b[_0x3bd528];return _0x963c7c;};'use strict';var _=require(_0xbd72('0x0'));var util=require(_0xbd72('0x1'));var logger=require(_0xbd72('0x2'))(_0xbd72('0x3'));var moment=require(_0xbd72('0x4'));var BPromise=require(_0xbd72('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbd72('0x6'));var attributes=require(_0xbd72('0x7'));module[_0xbd72('0x8')]=function(_0x597af6,_0x3c105a){return _0x597af6[_0xbd72('0x9')](_0xbd72('0xa'),attributes,{'tableName':_0xbd72('0xb'),'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 962e4e1..1625acd 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 _0xf372=['request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowSquareOdbc','find','options','raw','attributes','include','model','map','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s'];(function(_0x4bc4f3,_0xb93bd2){var _0x478fab=function(_0x2404ea){while(--_0x2404ea){_0x4bc4f3['push'](_0x4bc4f3['shift']());}};_0x478fab(++_0xb93bd2);}(_0xf372,0x144));var _0x2f37=function(_0x50f01f,_0x22abab){_0x50f01f=_0x50f01f-0x0;var _0x5e529b=_0xf372[_0x50f01f];return _0x5e529b;};'use strict';var _=require(_0x2f37('0x0'));var util=require(_0x2f37('0x1'));var moment=require(_0x2f37('0x2'));var BPromise=require(_0x2f37('0x3'));var rs=require(_0x2f37('0x4'));var fs=require('fs');var Redis=require(_0x2f37('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2f37('0x6'));var logger=require(_0x2f37('0x7'))(_0x2f37('0x8'));var config=require(_0x2f37('0x9'));var jayson=require(_0x2f37('0xa'));var client=jayson[_0x2f37('0xb')][_0x2f37('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x309416,_0x4785a0,_0x2cdca2){return new BPromise(function(_0x55d285,_0x88b178){return client[_0x2f37('0xd')](_0x309416,_0x2cdca2)[_0x2f37('0xe')](function(_0x18a61a){logger[_0x2f37('0xf')](_0x2f37('0x10'),_0x4785a0,_0x2f37('0x11'));logger['debug'](_0x2f37('0x12'),_0x4785a0,_0x2f37('0x11'),JSON['stringify'](_0x18a61a));if(_0x18a61a['error']){if(_0x18a61a[_0x2f37('0x13')]['code']===0x1f4){logger[_0x2f37('0x13')](_0x2f37('0x10'),_0x4785a0,_0x18a61a['error'][_0x2f37('0x14')]);return _0x88b178(_0x18a61a[_0x2f37('0x13')][_0x2f37('0x14')]);}logger['error'](_0x2f37('0x10'),_0x4785a0,_0x18a61a[_0x2f37('0x13')][_0x2f37('0x14')]);return _0x55d285(_0x18a61a[_0x2f37('0x13')][_0x2f37('0x14')]);}else{logger[_0x2f37('0xf')](_0x2f37('0x10'),_0x4785a0,_0x2f37('0x11'));_0x55d285(_0x18a61a[_0x2f37('0x15')][_0x2f37('0x14')]);}})[_0x2f37('0x16')](function(_0x40a487){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x4785a0,_0x40a487);_0x88b178(_0x40a487);});});}exports[_0x2f37('0x17')]=function(_0x2e0728){var _0x280cca=this;return new Promise(function(_0x5d1bad,_0x54f2aa){return db['SquareOdbc'][_0x2f37('0x18')]({'raw':_0x2e0728[_0x2f37('0x19')]?_0x2e0728[_0x2f37('0x19')][_0x2f37('0x1a')]===undefined?!![]:![]:!![],'where':_0x2e0728[_0x2f37('0x19')]?_0x2e0728['options']['where']||null:null,'attributes':_0x2e0728[_0x2f37('0x19')]?_0x2e0728['options'][_0x2f37('0x1b')]||null:null,'include':_0x2e0728[_0x2f37('0x19')]?_0x2e0728[_0x2f37('0x19')][_0x2f37('0x1c')]?_['map'](_0x2e0728['options'][_0x2f37('0x1c')],function(_0x48842d){return{'model':db[_0x48842d[_0x2f37('0x1d')]],'as':_0x48842d['as'],'attributes':_0x48842d['attributes'],'include':_0x48842d[_0x2f37('0x1c')]?_[_0x2f37('0x1e')](_0x48842d[_0x2f37('0x1c')],function(_0x34c85e){return{'model':db[_0x34c85e['model']],'as':_0x34c85e['as'],'attributes':_0x34c85e[_0x2f37('0x1b')],'include':_0x34c85e[_0x2f37('0x1c')]?_[_0x2f37('0x1e')](_0x34c85e[_0x2f37('0x1c')],function(_0x33d8de){return{'model':db[_0x33d8de[_0x2f37('0x1d')]],'as':_0x33d8de['as'],'attributes':_0x33d8de['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x551a23){logger[_0x2f37('0xf')](_0x2f37('0x17'),_0x2e0728);logger['debug'](_0x2f37('0x17'),_0x2e0728,JSON['stringify'](_0x551a23));_0x5d1bad(_0x551a23);})[_0x2f37('0x16')](function(_0x2d898d){logger[_0x2f37('0x13')](_0x2f37('0x17'),_0x2d898d[_0x2f37('0x14')],_0x2e0728);_0x54f2aa(_0x280cca[_0x2f37('0x13')](0x1f4,_0x2d898d[_0x2f37('0x14')]));});});}; \ No newline at end of file +var _0x8a82=['include','model','debug','lodash','util','moment','ioredis','../../config/logger','rpc','jayson/promise','http','then','info','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareOdbc,\x20%s,\x20%s','catch','ShowSquareOdbc','SquareOdbc','options','raw','attributes','map'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x8a82,0x1ce));var _0x28a8=function(_0x5dd0f3,_0x2292b5){_0x5dd0f3=_0x5dd0f3-0x0;var _0x54358a=_0x8a82[_0x5dd0f3];return _0x54358a;};'use strict';var _=require(_0x28a8('0x0'));var util=require(_0x28a8('0x1'));var moment=require(_0x28a8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x28a8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x28a8('0x4'))(_0x28a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x28a8('0x6'));var client=jayson['client'][_0x28a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x383862,_0x1677f8,_0xd2ddda){return new BPromise(function(_0x4bcf1a,_0xff0fce){return client['request'](_0x383862,_0xd2ddda)[_0x28a8('0x8')](function(_0x52ba40){logger[_0x28a8('0x9')]('SquareOdbc,\x20%s,\x20%s',_0x1677f8,_0x28a8('0xa'));logger['debug'](_0x28a8('0xb'),_0x1677f8,_0x28a8('0xa'),JSON[_0x28a8('0xc')](_0x52ba40));if(_0x52ba40[_0x28a8('0xd')]){if(_0x52ba40[_0x28a8('0xd')][_0x28a8('0xe')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x1677f8,_0x52ba40[_0x28a8('0xd')][_0x28a8('0xf')]);return _0xff0fce(_0x52ba40[_0x28a8('0xd')][_0x28a8('0xf')]);}logger['error'](_0x28a8('0x10'),_0x1677f8,_0x52ba40[_0x28a8('0xd')][_0x28a8('0xf')]);return _0x4bcf1a(_0x52ba40[_0x28a8('0xd')][_0x28a8('0xf')]);}else{logger[_0x28a8('0x9')](_0x28a8('0x10'),_0x1677f8,_0x28a8('0xa'));_0x4bcf1a(_0x52ba40['result'][_0x28a8('0xf')]);}})[_0x28a8('0x11')](function(_0x2fdc8d){logger[_0x28a8('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x1677f8,_0x2fdc8d);_0xff0fce(_0x2fdc8d);});});}exports[_0x28a8('0x12')]=function(_0x4203eb){var _0x5546e1=this;return new Promise(function(_0x4345cb,_0x55a9f8){return db[_0x28a8('0x13')]['find']({'raw':_0x4203eb[_0x28a8('0x14')]?_0x4203eb[_0x28a8('0x14')][_0x28a8('0x15')]===undefined?!![]:![]:!![],'where':_0x4203eb['options']?_0x4203eb[_0x28a8('0x14')]['where']||null:null,'attributes':_0x4203eb[_0x28a8('0x14')]?_0x4203eb[_0x28a8('0x14')][_0x28a8('0x16')]||null:null,'include':_0x4203eb[_0x28a8('0x14')]?_0x4203eb[_0x28a8('0x14')]['include']?_[_0x28a8('0x17')](_0x4203eb[_0x28a8('0x14')][_0x28a8('0x18')],function(_0xf933fc){return{'model':db[_0xf933fc[_0x28a8('0x19')]],'as':_0xf933fc['as'],'attributes':_0xf933fc[_0x28a8('0x16')],'include':_0xf933fc['include']?_[_0x28a8('0x17')](_0xf933fc[_0x28a8('0x18')],function(_0xee7823){return{'model':db[_0xee7823[_0x28a8('0x19')]],'as':_0xee7823['as'],'attributes':_0xee7823['attributes'],'include':_0xee7823['include']?_[_0x28a8('0x17')](_0xee7823['include'],function(_0x1e3a3b){return{'model':db[_0x1e3a3b['model']],'as':_0x1e3a3b['as'],'attributes':_0x1e3a3b[_0x28a8('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x167717){logger[_0x28a8('0x9')](_0x28a8('0x12'),_0x4203eb);logger[_0x28a8('0x1a')](_0x28a8('0x12'),_0x4203eb,JSON['stringify'](_0x167717));_0x4345cb(_0x167717);})[_0x28a8('0x11')](function(_0x1680cc){logger[_0x28a8('0xd')](_0x28a8('0x12'),_0x1680cc[_0x28a8('0xf')],_0x4203eb);_0x55a9f8(_0x5546e1[_0x28a8('0xd')](0x1f4,_0x1680cc['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index ffb9b07..6c40a9a 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 _0xc771=['../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/users','getUsers','post','create','put','update','delete','destroy','removeUsers','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x5b898b,_0x216620){var _0x353892=function(_0x446914){while(--_0x446914){_0x5b898b['push'](_0x5b898b['shift']());}};_0x353892(++_0x216620);}(_0xc771,0x1d9));var _0x1c77=function(_0x175563,_0x23ff70){_0x175563=_0x175563-0x0;var _0xc6365d=_0xc771[_0x175563];return _0xc6365d;};'use strict';var multer=require(_0x1c77('0x0'));var util=require(_0x1c77('0x1'));var path=require(_0x1c77('0x2'));var timeout=require(_0x1c77('0x3'));var express=require('express');var router=express[_0x1c77('0x4')]();var fs_extra=require(_0x1c77('0x5'));var auth=require(_0x1c77('0x6'));var interaction=require(_0x1c77('0x7'));var config=require(_0x1c77('0x8'));var controller=require('./squareProject.controller');router[_0x1c77('0x9')]('/',auth['isAuthenticated'](),controller[_0x1c77('0xa')]);router['get'](_0x1c77('0xb'),auth[_0x1c77('0xc')](),controller[_0x1c77('0xd')]);router[_0x1c77('0x9')](_0x1c77('0xe'),auth[_0x1c77('0xc')](),controller[_0x1c77('0xf')]);router[_0x1c77('0x10')]('/',auth[_0x1c77('0xc')](),controller[_0x1c77('0x11')]);router['post'](_0x1c77('0xe'),auth['isAuthenticated'](),controller['addUsers']);router[_0x1c77('0x12')](_0x1c77('0xb'),auth[_0x1c77('0xc')](),controller[_0x1c77('0x13')]);router[_0x1c77('0x14')](_0x1c77('0xb'),auth[_0x1c77('0xc')](),controller[_0x1c77('0x15')]);router[_0x1c77('0x14')](_0x1c77('0xe'),auth[_0x1c77('0xc')](),controller[_0x1c77('0x16')]);module[_0x1c77('0x17')]=router; \ No newline at end of file +var _0xc900=['delete','removeUsers','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','show','/:id/users','getUsers','post','create','addUsers','/:id','update','destroy'];(function(_0x5dc155,_0x4dc627){var _0x291762=function(_0x11c584){while(--_0x11c584){_0x5dc155['push'](_0x5dc155['shift']());}};_0x291762(++_0x4dc627);}(_0xc900,0xb3));var _0x0c90=function(_0x5c2f75,_0xefea71){_0x5c2f75=_0x5c2f75-0x0;var _0x4f46ac=_0xc900[_0x5c2f75];return _0x4f46ac;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0c90('0x0'));var timeout=require(_0x0c90('0x1'));var express=require(_0x0c90('0x2'));var router=express['Router']();var fs_extra=require(_0x0c90('0x3'));var auth=require(_0x0c90('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0c90('0x5'));var controller=require(_0x0c90('0x6'));router[_0x0c90('0x7')]('/',auth[_0x0c90('0x8')](),controller[_0x0c90('0x9')]);router[_0x0c90('0x7')]('/:id',auth[_0x0c90('0x8')](),controller[_0x0c90('0xa')]);router[_0x0c90('0x7')](_0x0c90('0xb'),auth[_0x0c90('0x8')](),controller[_0x0c90('0xc')]);router[_0x0c90('0xd')]('/',auth[_0x0c90('0x8')](),controller[_0x0c90('0xe')]);router[_0x0c90('0xd')](_0x0c90('0xb'),auth[_0x0c90('0x8')](),controller[_0x0c90('0xf')]);router['put'](_0x0c90('0x10'),auth['isAuthenticated'](),controller[_0x0c90('0x11')]);router['delete'](_0x0c90('0x10'),auth[_0x0c90('0x8')](),controller[_0x0c90('0x12')]);router[_0x0c90('0x13')](_0x0c90('0xb'),auth['isAuthenticated'](),controller[_0x0c90('0x14')]);module[_0x0c90('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index e4f8d31..e54bd49 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 _0x3f76=['sequelize','exports','STRING','TEXT','BLOB','long','getDataValue','preproduction','utf8','production','toString','DATE'];(function(_0x4dcc0d,_0x145fe3){var _0x3aa152=function(_0x1e9560){while(--_0x1e9560){_0x4dcc0d['push'](_0x4dcc0d['shift']());}};_0x3aa152(++_0x145fe3);}(_0x3f76,0x1a4));var _0x63f7=function(_0x58074a,_0x1a2958){_0x58074a=_0x58074a-0x0;var _0x4af31f=_0x3f76[_0x58074a];return _0x4af31f;};'use strict';var Sequelize=require(_0x63f7('0x0'));module[_0x63f7('0x1')]={'name':{'type':Sequelize[_0x63f7('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x63f7('0x2')]},'notes':{'type':Sequelize[_0x63f7('0x3')]},'preproduction':{'type':Sequelize[_0x63f7('0x4')](_0x63f7('0x5')),'get':function(){if(this[_0x63f7('0x6')](_0x63f7('0x7'))){return this['getDataValue'](_0x63f7('0x7'))['toString'](_0x63f7('0x8'));}}},'production':{'type':Sequelize[_0x63f7('0x4')](_0x63f7('0x5')),'get':function(){if(this[_0x63f7('0x6')](_0x63f7('0x9'))){return this[_0x63f7('0x6')](_0x63f7('0x9'))[_0x63f7('0xa')](_0x63f7('0x8'));}}},'savedAt':{'type':Sequelize[_0x63f7('0xb')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x4a03=['preproduction','getDataValue','toString','utf8','production','DATE','exports','STRING','name','TEXT','BLOB','long'];(function(_0x567097,_0x345516){var _0x5e84f8=function(_0x290ebc){while(--_0x290ebc){_0x567097['push'](_0x567097['shift']());}};_0x5e84f8(++_0x345516);}(_0x4a03,0x16e));var _0x34a0=function(_0xf7d89b,_0x362b7c){_0xf7d89b=_0xf7d89b-0x0;var _0x2485cb=_0x4a03[_0xf7d89b];return _0x2485cb;};'use strict';var Sequelize=require('sequelize');module[_0x34a0('0x0')]={'name':{'type':Sequelize[_0x34a0('0x1')],'unique':_0x34a0('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x34a0('0x3')]},'preproduction':{'type':Sequelize[_0x34a0('0x4')](_0x34a0('0x5')),'get':function(){if(this['getDataValue'](_0x34a0('0x6'))){return this[_0x34a0('0x7')]('preproduction')[_0x34a0('0x8')](_0x34a0('0x9'));}}},'production':{'type':Sequelize['BLOB'](_0x34a0('0x5')),'get':function(){if(this[_0x34a0('0x7')]('production')){return this[_0x34a0('0x7')](_0x34a0('0xa'))[_0x34a0('0x8')](_0x34a0('0x9'));}}},'savedAt':{'type':Sequelize[_0x34a0('0xb')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 5424415..35739be 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 _0xdf7f=['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','../../mysqldb','defaults','redis','localhost','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','SquareProject','rawAttributes','type','key','query','filters','intersection','attributes','model','fields','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','catch','show','params','keys','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','omit','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','hasOwnProperty','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x430cc6,_0x278b59){var _0x36470e=function(_0x3a71d4){while(--_0x3a71d4){_0x430cc6['push'](_0x430cc6['shift']());}};_0x36470e(++_0x278b59);}(_0xdf7f,0xc0));var _0xfdf7=function(_0x24fb1a,_0x9acc63){_0x24fb1a=_0x24fb1a-0x0;var _0x432410=_0xdf7f[_0x24fb1a];return _0x432410;};'use strict';var emlformat=require(_0xfdf7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfdf7('0x1'));var moment=require(_0xfdf7('0x2'));var BPromise=require(_0xfdf7('0x3'));var Mustache=require(_0xfdf7('0x4'));var util=require(_0xfdf7('0x5'));var path=require(_0xfdf7('0x6'));var sox=require(_0xfdf7('0x7'));var csv=require(_0xfdf7('0x8'));var ejs=require(_0xfdf7('0x9'));var fs=require('fs');var fs_extra=require(_0xfdf7('0xa'));var _=require(_0xfdf7('0xb'));var squel=require(_0xfdf7('0xc'));var crypto=require(_0xfdf7('0xd'));var jsforce=require(_0xfdf7('0xe'));var deskjs=require(_0xfdf7('0xf'));var toCsv=require('to-csv');var querystring=require(_0xfdf7('0x10'));var Papa=require(_0xfdf7('0x11'));var Redis=require(_0xfdf7('0x12'));var authService=require(_0xfdf7('0x13'));var qs=require(_0xfdf7('0x14'));var as=require(_0xfdf7('0x15'));var hardwareService=require(_0xfdf7('0x16'));var logger=require(_0xfdf7('0x17'))(_0xfdf7('0x18'));var utils=require(_0xfdf7('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfdf7('0x1a'))['db'];config['redis']=_[_0xfdf7('0x1b')](config[_0xfdf7('0x1c')],{'host':_0xfdf7('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfdf7('0x1c')]));require('./squareProject.socket')[_0xfdf7('0x1e')](socket);function respondWithStatusCode(_0x42679b,_0x31bca7){_0x31bca7=_0x31bca7||0xcc;return function(_0x541f54){if(_0x541f54){return _0x42679b[_0xfdf7('0x1f')](_0x31bca7);}return _0x42679b[_0xfdf7('0x20')](_0x31bca7)[_0xfdf7('0x21')]();};}function respondWithResult(_0x40393f,_0x27cd8a){_0x27cd8a=_0x27cd8a||0xc8;return function(_0x57f886){if(_0x57f886){return _0x40393f[_0xfdf7('0x20')](_0x27cd8a)[_0xfdf7('0x22')](_0x57f886);}};}function respondWithFilteredResult(_0x40827c,_0x21f4d5){return function(_0x2ee19e){if(_0x2ee19e){var _0x41acf2=typeof _0x21f4d5[_0xfdf7('0x23')]===_0xfdf7('0x24')&&typeof _0x21f4d5[_0xfdf7('0x25')]===_0xfdf7('0x24');var _0x389f23=_0x2ee19e[_0xfdf7('0x26')];var _0xec86d1=_0x41acf2?0x0:_0x21f4d5[_0xfdf7('0x23')];var _0x44d609=_0x41acf2?_0x2ee19e[_0xfdf7('0x26')]:_0x21f4d5['offset']+_0x21f4d5['limit'];var _0x1a8167;if(_0x44d609>=_0x389f23){_0x44d609=_0x389f23;_0x1a8167=0xc8;}else{_0x1a8167=0xce;}_0x40827c[_0xfdf7('0x20')](_0x1a8167);return _0x40827c[_0xfdf7('0x27')](_0xfdf7('0x28'),_0xec86d1+'-'+_0x44d609+'/'+_0x389f23)[_0xfdf7('0x22')](_0x2ee19e);}return null;};}function patchUpdates(_0x404fff){return function(_0x1119a9){try{jsonpatch[_0xfdf7('0x29')](_0x1119a9,_0x404fff,!![]);}catch(_0x48e34f){return BPromise[_0xfdf7('0x2a')](_0x48e34f);}return _0x1119a9[_0xfdf7('0x2b')]();};}function saveUpdates(_0xc95d55,_0x103d72){return function(_0x2e9495){if(_0x2e9495){return _0x2e9495[_0xfdf7('0x2c')](_0xc95d55)[_0xfdf7('0x2d')](function(_0x210371){return _0x210371;});}return null;};}function removeEntity(_0x5edb86,_0x124498){return function(_0x32e075){if(_0x32e075){return _0x32e075[_0xfdf7('0x2e')]()[_0xfdf7('0x2d')](function(){var _0x42c964=_0x32e075[_0xfdf7('0x2f')]({'plain':!![]});var _0x65cc19='SquareProjects';return db[_0xfdf7('0x30')][_0xfdf7('0x2e')]({'where':{'type':_0x65cc19,'resourceId':_0x42c964['id']}})[_0xfdf7('0x2d')](function(){return _0x32e075;});})[_0xfdf7('0x2d')](function(){_0x5edb86[_0xfdf7('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x750026,_0x55975d){return function(_0x229a93){if(!_0x229a93){_0x750026[_0xfdf7('0x1f')](0x194);}return _0x229a93;};}function handleError(_0x3bbefe,_0x4c359c){_0x4c359c=_0x4c359c||0x1f4;return function(_0x4e8c4c){logger[_0xfdf7('0x31')](_0x4e8c4c[_0xfdf7('0x32')]);if(_0x4e8c4c[_0xfdf7('0x33')]){delete _0x4e8c4c[_0xfdf7('0x33')];}_0x3bbefe[_0xfdf7('0x20')](_0x4c359c)[_0xfdf7('0x34')](_0x4e8c4c);};}exports['index']=function(_0x451e89,_0x530b4d){var _0x50aa4f={},_0x23c9f2={},_0x38c669={'count':0x0,'rows':[]};var _0x1175f9=_[_0xfdf7('0x35')](db[_0xfdf7('0x36')][_0xfdf7('0x37')],function(_0x2f3066){return{'name':_0x2f3066['fieldName'],'type':_0x2f3066[_0xfdf7('0x38')][_0xfdf7('0x39')]};});_0x23c9f2['model']=_[_0xfdf7('0x35')](_0x1175f9,_0xfdf7('0x33'));_0x23c9f2[_0xfdf7('0x3a')]=_['keys'](_0x451e89[_0xfdf7('0x3a')]);_0x23c9f2[_0xfdf7('0x3b')]=_[_0xfdf7('0x3c')](_0x23c9f2['model'],_0x23c9f2[_0xfdf7('0x3a')]);_0x50aa4f[_0xfdf7('0x3d')]=_['intersection'](_0x23c9f2[_0xfdf7('0x3e')],qs[_0xfdf7('0x3f')](_0x451e89['query']['fields']));_0x50aa4f[_0xfdf7('0x3d')]=_0x50aa4f['attributes']['length']?_0x50aa4f['attributes']:_0x23c9f2['model'];if(!_0x451e89[_0xfdf7('0x3a')]['hasOwnProperty'](_0xfdf7('0x40'))){_0x50aa4f['limit']=qs['limit'](_0x451e89[_0xfdf7('0x3a')][_0xfdf7('0x25')]);_0x50aa4f[_0xfdf7('0x23')]=qs[_0xfdf7('0x23')](_0x451e89[_0xfdf7('0x3a')]['offset']);}_0x50aa4f[_0xfdf7('0x41')]=qs[_0xfdf7('0x42')](_0x451e89[_0xfdf7('0x3a')][_0xfdf7('0x42')]);_0x50aa4f[_0xfdf7('0x43')]=qs[_0xfdf7('0x3b')](_['pick'](_0x451e89[_0xfdf7('0x3a')],_0x23c9f2[_0xfdf7('0x3b')]),_0x1175f9);if(_0x451e89[_0xfdf7('0x3a')][_0xfdf7('0x44')]){_0x50aa4f['where']=_[_0xfdf7('0x45')](_0x50aa4f[_0xfdf7('0x43')],{'$or':_['map'](_0x1175f9,function(_0x210ec7){if(_0x210ec7[_0xfdf7('0x38')]!=='VIRTUAL'){var _0x2c2ad2={};_0x2c2ad2[_0x210ec7[_0xfdf7('0x33')]]={'$like':'%'+_0x451e89[_0xfdf7('0x3a')][_0xfdf7('0x44')]+'%'};return _0x2c2ad2;}})});}_0x50aa4f=_[_0xfdf7('0x45')]({},_0x50aa4f,_0x451e89[_0xfdf7('0x46')]);var _0x3e40cb={'where':_0x50aa4f['where']};return db[_0xfdf7('0x36')][_0xfdf7('0x26')](_0x3e40cb)['then'](function(_0x3a3294){_0x38c669[_0xfdf7('0x26')]=_0x3a3294;if(_0x451e89[_0xfdf7('0x3a')]['includeAll']){_0x50aa4f[_0xfdf7('0x47')]=[{'all':!![]}];}return db[_0xfdf7('0x36')][_0xfdf7('0x48')](_0x50aa4f);})[_0xfdf7('0x2d')](function(_0x43d0bc){_0x38c669[_0xfdf7('0x49')]=_0x43d0bc;return _0x38c669;})[_0xfdf7('0x2d')](respondWithFilteredResult(_0x530b4d,_0x50aa4f))[_0xfdf7('0x4a')](handleError(_0x530b4d,null));};exports[_0xfdf7('0x4b')]=function(_0x4f659f,_0x5e64b1){var _0x568519={'raw':![],'where':{'id':_0x4f659f[_0xfdf7('0x4c')]['id']}},_0x4ef3e6={};_0x4ef3e6['model']=_[_0xfdf7('0x4d')](db[_0xfdf7('0x36')][_0xfdf7('0x37')]);_0x4ef3e6[_0xfdf7('0x3a')]=_[_0xfdf7('0x4d')](_0x4f659f[_0xfdf7('0x3a')]);_0x4ef3e6[_0xfdf7('0x3b')]=_['intersection'](_0x4ef3e6[_0xfdf7('0x3e')],_0x4ef3e6[_0xfdf7('0x3a')]);_0x568519['attributes']=_[_0xfdf7('0x3c')](_0x4ef3e6[_0xfdf7('0x3e')],qs[_0xfdf7('0x3f')](_0x4f659f['query'][_0xfdf7('0x3f')]));_0x568519[_0xfdf7('0x3d')]=_0x568519['attributes'][_0xfdf7('0x4e')]?_0x568519[_0xfdf7('0x3d')]:_0x4ef3e6[_0xfdf7('0x3e')];if(_0x4f659f[_0xfdf7('0x3a')][_0xfdf7('0x4f')]){_0x568519[_0xfdf7('0x47')]=[{'all':!![]}];}_0x568519=_[_0xfdf7('0x45')]({},_0x568519,_0x4f659f[_0xfdf7('0x46')]);return db[_0xfdf7('0x36')][_0xfdf7('0x50')](_0x568519)['then'](handleEntityNotFound(_0x5e64b1,null))[_0xfdf7('0x2d')](respondWithResult(_0x5e64b1,null))['catch'](handleError(_0x5e64b1,null));};exports[_0xfdf7('0x51')]=function(_0x349c0c,_0x2eeb99){return db[_0xfdf7('0x36')]['create'](_0x349c0c[_0xfdf7('0x52')],{})['then'](function(_0x4cf876){var _0x3c6ef1=_0x349c0c[_0xfdf7('0x53')][_0xfdf7('0x2f')]({'plain':!![]});if(!_0x3c6ef1)throw new Error(_0xfdf7('0x54'));if(_0x3c6ef1[_0xfdf7('0x55')]===_0xfdf7('0x53')){var _0x4df22e=_0x4cf876[_0xfdf7('0x2f')]({'plain':!![]});var _0x45e5e3=_0xfdf7('0x56');return db[_0xfdf7('0x57')][_0xfdf7('0x50')]({'where':{'name':_0x45e5e3,'userProfileId':_0x3c6ef1[_0xfdf7('0x58')]},'raw':!![]})['then'](function(_0x582145){if(_0x582145&&_0x582145[_0xfdf7('0x59')]===0x0){return db['UserProfileResource'][_0xfdf7('0x51')]({'name':_0x4df22e['name'],'resourceId':_0x4df22e['id'],'type':_0x582145[_0xfdf7('0x33')],'sectionId':_0x582145['id']},{})[_0xfdf7('0x2d')](function(){return _0x4cf876;});}else{return _0x4cf876;}})[_0xfdf7('0x4a')](function(_0x1d5688){logger[_0xfdf7('0x31')](_0xfdf7('0x5a'),_0x1d5688);throw _0x1d5688;});}return _0x4cf876;})['then'](respondWithResult(_0x2eeb99,0xc9))['catch'](handleError(_0x2eeb99,null));};exports[_0xfdf7('0x2c')]=function(_0x514eed,_0x541727){if(_0x514eed[_0xfdf7('0x52')]['id']){delete _0x514eed[_0xfdf7('0x52')]['id'];}return db['SquareProject'][_0xfdf7('0x50')]({'where':{'id':_0x514eed[_0xfdf7('0x4c')]['id']}})[_0xfdf7('0x2d')](handleEntityNotFound(_0x541727,null))[_0xfdf7('0x2d')](saveUpdates(_0x514eed['body'],null))[_0xfdf7('0x2d')](respondWithResult(_0x541727,null))[_0xfdf7('0x4a')](handleError(_0x541727,null));};exports[_0xfdf7('0x2e')]=function(_0x59f00d,_0x3f839c){return db[_0xfdf7('0x36')][_0xfdf7('0x50')]({'where':{'id':_0x59f00d[_0xfdf7('0x4c')]['id']}})[_0xfdf7('0x2d')](handleEntityNotFound(_0x3f839c,null))[_0xfdf7('0x2d')](removeEntity(_0x3f839c,null))[_0xfdf7('0x4a')](handleError(_0x3f839c,null));};exports[_0xfdf7('0x5b')]=function(_0x527f8a,_0xe809ff,_0x33f075){return db[_0xfdf7('0x36')][_0xfdf7('0x50')]({'where':{'id':_0x527f8a['params']['id']}})[_0xfdf7('0x2d')](handleEntityNotFound(_0xe809ff,null))[_0xfdf7('0x2d')](function(_0x22bd97){if(_0x22bd97){return _0x22bd97['addUsers'](_0x527f8a[_0xfdf7('0x52')]['ids'],_[_0xfdf7('0x5c')](_0x527f8a[_0xfdf7('0x52')],[_0xfdf7('0x5d'),'id'])||{});}})['then'](respondWithResult(_0xe809ff,null))[_0xfdf7('0x4a')](handleError(_0xe809ff,null));};exports[_0xfdf7('0x5e')]=function(_0x1aca36,_0x5bcb49,_0xe0f92e){return db['SquareProject']['find']({'where':{'id':_0x1aca36[_0xfdf7('0x4c')]['id']}})[_0xfdf7('0x2d')](handleEntityNotFound(_0x5bcb49,null))[_0xfdf7('0x2d')](function(_0x252f21){if(_0x252f21){return _0x252f21[_0xfdf7('0x5e')](_0x1aca36[_0xfdf7('0x3a')]['ids'])['then'](function(){if(_[_0xfdf7('0x5f')](_0x1aca36[_0xfdf7('0x3a')][_0xfdf7('0x5d')])){for(var _0x501580=0x0;_0x501580<_0x1aca36[_0xfdf7('0x3a')]['ids'][_0xfdf7('0x4e')];_0x501580+=0x1){socket[_0xfdf7('0x60')](_0xfdf7('0x61'),{'UserId':Number(_0x1aca36[_0xfdf7('0x3a')][_0xfdf7('0x5d')][_0x501580]),'SquareProjectId':Number(_0x1aca36[_0xfdf7('0x4c')]['id'])});}}else{socket[_0xfdf7('0x60')](_0xfdf7('0x61'),{'UserId':Number(_0x1aca36[_0xfdf7('0x3a')][_0xfdf7('0x5d')]),'SquareProjectId':Number(_0x1aca36[_0xfdf7('0x4c')]['id'])});}});}})[_0xfdf7('0x2d')](respondWithStatusCode(_0x5bcb49,null))[_0xfdf7('0x4a')](handleError(_0x5bcb49,null));};exports[_0xfdf7('0x62')]=function(_0x440d13,_0x9fb8ba,_0x2ae765){var _0x20b366={};var _0x515826={};var _0x12aa76;var _0x86861;return db[_0xfdf7('0x36')][_0xfdf7('0x63')]({'where':{'id':_0x440d13[_0xfdf7('0x4c')]['id']}})[_0xfdf7('0x2d')](handleEntityNotFound(_0x9fb8ba,null))[_0xfdf7('0x2d')](function(_0x31b8ed){if(_0x31b8ed){_0x12aa76=_0x31b8ed;_0x515826[_0xfdf7('0x3e')]=_[_0xfdf7('0x4d')](db[_0xfdf7('0x64')][_0xfdf7('0x37')]);_0x515826[_0xfdf7('0x3a')]=_[_0xfdf7('0x4d')](_0x440d13[_0xfdf7('0x3a')]);_0x515826['filters']=_[_0xfdf7('0x3c')](_0x515826[_0xfdf7('0x3e')],_0x515826[_0xfdf7('0x3a')]);_0x20b366[_0xfdf7('0x3d')]=_['intersection'](_0x515826[_0xfdf7('0x3e')],qs['fields'](_0x440d13[_0xfdf7('0x3a')][_0xfdf7('0x3f')]));_0x20b366[_0xfdf7('0x3d')]=_0x20b366[_0xfdf7('0x3d')][_0xfdf7('0x4e')]?_0x20b366[_0xfdf7('0x3d')]:_0x515826[_0xfdf7('0x3e')];_0x20b366[_0xfdf7('0x41')]=qs[_0xfdf7('0x42')](_0x440d13[_0xfdf7('0x3a')][_0xfdf7('0x42')]);_0x20b366[_0xfdf7('0x43')]=qs[_0xfdf7('0x3b')](_['pick'](_0x440d13[_0xfdf7('0x3a')],_0x515826[_0xfdf7('0x3b')]));if(_0x440d13[_0xfdf7('0x3a')][_0xfdf7('0x44')]){_0x20b366[_0xfdf7('0x43')]=_[_0xfdf7('0x45')](_0x20b366['where'],{'$or':_[_0xfdf7('0x35')](_0x20b366[_0xfdf7('0x3d')],function(_0xf2de57){var _0x34a280={};_0x34a280[_0xf2de57]={'$like':'%'+_0x440d13[_0xfdf7('0x3a')][_0xfdf7('0x44')]+'%'};return _0x34a280;})});}_0x20b366=_[_0xfdf7('0x45')]({},_0x20b366,_0x440d13['options']);return _0x12aa76['getUsers'](_0x20b366);}})[_0xfdf7('0x2d')](function(_0x41483a){if(_0x41483a){_0x86861=_0x41483a['length'];if(!_0x440d13['query'][_0xfdf7('0x65')](_0xfdf7('0x40'))){_0x20b366[_0xfdf7('0x25')]=qs[_0xfdf7('0x25')](_0x440d13[_0xfdf7('0x3a')][_0xfdf7('0x25')]);_0x20b366[_0xfdf7('0x23')]=qs['offset'](_0x440d13[_0xfdf7('0x3a')][_0xfdf7('0x23')]);}return _0x12aa76[_0xfdf7('0x62')](_0x20b366);}})[_0xfdf7('0x2d')](function(_0x1de31c){if(_0x1de31c){return _0x1de31c?{'count':_0x86861,'rows':_0x1de31c}:null;}})[_0xfdf7('0x2d')](respondWithResult(_0x9fb8ba,null))[_0xfdf7('0x4a')](handleError(_0x9fb8ba,null));}; \ No newline at end of file +var _0x80a4=['jsforce','desk.js','querystring','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./squareProject.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','SquareProject','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','length','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','User','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x80a4,0x118));var _0x480a=function(_0xfedc72,_0x292f02){_0xfedc72=_0xfedc72-0x0;var _0x2c7c78=_0x80a4[_0xfedc72];return _0x2c7c78;};'use strict';var emlformat=require(_0x480a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x480a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x480a('0x2'));var moment=require(_0x480a('0x3'));var BPromise=require(_0x480a('0x4'));var Mustache=require(_0x480a('0x5'));var util=require(_0x480a('0x6'));var path=require(_0x480a('0x7'));var sox=require(_0x480a('0x8'));var csv=require(_0x480a('0x9'));var ejs=require(_0x480a('0xa'));var fs=require('fs');var fs_extra=require(_0x480a('0xb'));var _=require(_0x480a('0xc'));var squel=require('squel');var crypto=require(_0x480a('0xd'));var jsforce=require(_0x480a('0xe'));var deskjs=require(_0x480a('0xf'));var toCsv=require(_0x480a('0x9'));var querystring=require(_0x480a('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x480a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x480a('0x12'))(_0x480a('0x13'));var utils=require(_0x480a('0x14'));var config=require(_0x480a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x480a('0x16'))['db'];config[_0x480a('0x17')]=_[_0x480a('0x18')](config[_0x480a('0x17')],{'host':_0x480a('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x480a('0x17')]));require(_0x480a('0x1a'))[_0x480a('0x1b')](socket);function respondWithStatusCode(_0xef322,_0x54400d){_0x54400d=_0x54400d||0xcc;return function(_0x4a605a){if(_0x4a605a){return _0xef322['sendStatus'](_0x54400d);}return _0xef322[_0x480a('0x1c')](_0x54400d)[_0x480a('0x1d')]();};}function respondWithResult(_0x2e7d35,_0x156f31){_0x156f31=_0x156f31||0xc8;return function(_0x841c17){if(_0x841c17){return _0x2e7d35[_0x480a('0x1c')](_0x156f31)[_0x480a('0x1e')](_0x841c17);}};}function respondWithFilteredResult(_0x287a6b,_0x430ac4){return function(_0xff5f39){if(_0xff5f39){var _0x2db834=typeof _0x430ac4[_0x480a('0x1f')]===_0x480a('0x20')&&typeof _0x430ac4[_0x480a('0x21')]===_0x480a('0x20');var _0xfa62c5=_0xff5f39[_0x480a('0x22')];var _0x33a877=_0x2db834?0x0:_0x430ac4[_0x480a('0x1f')];var _0x212480=_0x2db834?_0xff5f39[_0x480a('0x22')]:_0x430ac4[_0x480a('0x1f')]+_0x430ac4['limit'];var _0x52b36c;if(_0x212480>=_0xfa62c5){_0x212480=_0xfa62c5;_0x52b36c=0xc8;}else{_0x52b36c=0xce;}_0x287a6b['status'](_0x52b36c);return _0x287a6b[_0x480a('0x23')](_0x480a('0x24'),_0x33a877+'-'+_0x212480+'/'+_0xfa62c5)[_0x480a('0x1e')](_0xff5f39);}return null;};}function patchUpdates(_0x3d6802){return function(_0x58f80d){try{jsonpatch[_0x480a('0x25')](_0x58f80d,_0x3d6802,!![]);}catch(_0x12a2f0){return BPromise[_0x480a('0x26')](_0x12a2f0);}return _0x58f80d[_0x480a('0x27')]();};}function saveUpdates(_0x3e5c54,_0x2b8638){return function(_0x46430a){if(_0x46430a){return _0x46430a['update'](_0x3e5c54)[_0x480a('0x28')](function(_0x44aa71){return _0x44aa71;});}return null;};}function removeEntity(_0x466da5,_0x13a8c0){return function(_0x5b8483){if(_0x5b8483){return _0x5b8483['destroy']()[_0x480a('0x28')](function(){var _0x4330c3=_0x5b8483['get']({'plain':!![]});var _0x585dc9='SquareProjects';return db['UserProfileResource'][_0x480a('0x29')]({'where':{'type':_0x585dc9,'resourceId':_0x4330c3['id']}})[_0x480a('0x28')](function(){return _0x5b8483;});})[_0x480a('0x28')](function(){_0x466da5['status'](0xcc)[_0x480a('0x1d')]();});}};}function handleEntityNotFound(_0x541241,_0x4e0416){return function(_0x1f085b){if(!_0x1f085b){_0x541241['sendStatus'](0x194);}return _0x1f085b;};}function handleError(_0x34308d,_0x55cdf3){_0x55cdf3=_0x55cdf3||0x1f4;return function(_0x24da2c){logger[_0x480a('0x2a')](_0x24da2c[_0x480a('0x2b')]);if(_0x24da2c[_0x480a('0x2c')]){delete _0x24da2c[_0x480a('0x2c')];}_0x34308d['status'](_0x55cdf3)[_0x480a('0x2d')](_0x24da2c);};}exports[_0x480a('0x2e')]=function(_0x3a2f2c,_0x52b742){var _0x105f85={},_0x3b0c42={},_0x1448bf={'count':0x0,'rows':[]};var _0x5a7166=_['map'](db[_0x480a('0x2f')]['rawAttributes'],function(_0x598ec7){return{'name':_0x598ec7[_0x480a('0x30')],'type':_0x598ec7[_0x480a('0x31')][_0x480a('0x32')]};});_0x3b0c42[_0x480a('0x33')]=_['map'](_0x5a7166,_0x480a('0x2c'));_0x3b0c42['query']=_[_0x480a('0x34')](_0x3a2f2c['query']);_0x3b0c42[_0x480a('0x35')]=_['intersection'](_0x3b0c42[_0x480a('0x33')],_0x3b0c42[_0x480a('0x36')]);_0x105f85[_0x480a('0x37')]=_[_0x480a('0x38')](_0x3b0c42['model'],qs['fields'](_0x3a2f2c[_0x480a('0x36')][_0x480a('0x39')]));_0x105f85[_0x480a('0x37')]=_0x105f85[_0x480a('0x37')]['length']?_0x105f85[_0x480a('0x37')]:_0x3b0c42[_0x480a('0x33')];if(!_0x3a2f2c[_0x480a('0x36')][_0x480a('0x3a')](_0x480a('0x3b'))){_0x105f85[_0x480a('0x21')]=qs['limit'](_0x3a2f2c[_0x480a('0x36')][_0x480a('0x21')]);_0x105f85[_0x480a('0x1f')]=qs[_0x480a('0x1f')](_0x3a2f2c[_0x480a('0x36')][_0x480a('0x1f')]);}_0x105f85[_0x480a('0x3c')]=qs[_0x480a('0x3d')](_0x3a2f2c[_0x480a('0x36')][_0x480a('0x3d')]);_0x105f85[_0x480a('0x3e')]=qs[_0x480a('0x35')](_[_0x480a('0x3f')](_0x3a2f2c[_0x480a('0x36')],_0x3b0c42[_0x480a('0x35')]),_0x5a7166);if(_0x3a2f2c[_0x480a('0x36')][_0x480a('0x40')]){_0x105f85[_0x480a('0x3e')]=_[_0x480a('0x41')](_0x105f85[_0x480a('0x3e')],{'$or':_[_0x480a('0x42')](_0x5a7166,function(_0x469db1){if(_0x469db1['type']!==_0x480a('0x43')){var _0x56bd5a={};_0x56bd5a[_0x469db1['name']]={'$like':'%'+_0x3a2f2c[_0x480a('0x36')][_0x480a('0x40')]+'%'};return _0x56bd5a;}})});}_0x105f85=_[_0x480a('0x41')]({},_0x105f85,_0x3a2f2c[_0x480a('0x44')]);var _0x10dfbb={'where':_0x105f85[_0x480a('0x3e')]};return db[_0x480a('0x2f')][_0x480a('0x22')](_0x10dfbb)[_0x480a('0x28')](function(_0x257f8c){_0x1448bf[_0x480a('0x22')]=_0x257f8c;if(_0x3a2f2c[_0x480a('0x36')][_0x480a('0x45')]){_0x105f85[_0x480a('0x46')]=[{'all':!![]}];}return db[_0x480a('0x2f')]['findAll'](_0x105f85);})[_0x480a('0x28')](function(_0x49d2d2){_0x1448bf[_0x480a('0x47')]=_0x49d2d2;return _0x1448bf;})['then'](respondWithFilteredResult(_0x52b742,_0x105f85))['catch'](handleError(_0x52b742,null));};exports[_0x480a('0x48')]=function(_0x202eff,_0x16218d){var _0x33712f={'raw':![],'where':{'id':_0x202eff[_0x480a('0x49')]['id']}},_0x87114d={};_0x87114d[_0x480a('0x33')]=_['keys'](db[_0x480a('0x2f')][_0x480a('0x4a')]);_0x87114d[_0x480a('0x36')]=_[_0x480a('0x34')](_0x202eff[_0x480a('0x36')]);_0x87114d[_0x480a('0x35')]=_[_0x480a('0x38')](_0x87114d[_0x480a('0x33')],_0x87114d[_0x480a('0x36')]);_0x33712f[_0x480a('0x37')]=_['intersection'](_0x87114d[_0x480a('0x33')],qs[_0x480a('0x39')](_0x202eff[_0x480a('0x36')][_0x480a('0x39')]));_0x33712f[_0x480a('0x37')]=_0x33712f[_0x480a('0x37')][_0x480a('0x4b')]?_0x33712f[_0x480a('0x37')]:_0x87114d[_0x480a('0x33')];if(_0x202eff['query']['includeAll']){_0x33712f[_0x480a('0x46')]=[{'all':!![]}];}_0x33712f=_['merge']({},_0x33712f,_0x202eff[_0x480a('0x44')]);return db[_0x480a('0x2f')][_0x480a('0x4c')](_0x33712f)[_0x480a('0x28')](handleEntityNotFound(_0x16218d,null))[_0x480a('0x28')](respondWithResult(_0x16218d,null))[_0x480a('0x4d')](handleError(_0x16218d,null));};exports[_0x480a('0x4e')]=function(_0x13edb7,_0x2333ff){return db[_0x480a('0x2f')]['create'](_0x13edb7['body'],{})[_0x480a('0x28')](function(_0x3b4d83){var _0x235080=_0x13edb7[_0x480a('0x4f')][_0x480a('0x50')]({'plain':!![]});if(!_0x235080)throw new Error(_0x480a('0x51'));if(_0x235080[_0x480a('0x52')]===_0x480a('0x4f')){var _0x412cfd=_0x3b4d83['get']({'plain':!![]});var _0xd9f0b1=_0x480a('0x53');return db[_0x480a('0x54')][_0x480a('0x4c')]({'where':{'name':_0xd9f0b1,'userProfileId':_0x235080[_0x480a('0x55')]},'raw':!![]})[_0x480a('0x28')](function(_0x5572f6){if(_0x5572f6&&_0x5572f6['autoAssociation']===0x0){return db[_0x480a('0x56')]['create']({'name':_0x412cfd[_0x480a('0x2c')],'resourceId':_0x412cfd['id'],'type':_0x5572f6[_0x480a('0x2c')],'sectionId':_0x5572f6['id']},{})['then'](function(){return _0x3b4d83;});}else{return _0x3b4d83;}})[_0x480a('0x4d')](function(_0x11670f){logger[_0x480a('0x2a')](_0x480a('0x57'),_0x11670f);throw _0x11670f;});}return _0x3b4d83;})[_0x480a('0x28')](respondWithResult(_0x2333ff,0xc9))['catch'](handleError(_0x2333ff,null));};exports[_0x480a('0x58')]=function(_0x22407f,_0x56ed26){if(_0x22407f[_0x480a('0x59')]['id']){delete _0x22407f[_0x480a('0x59')]['id'];}return db[_0x480a('0x2f')]['find']({'where':{'id':_0x22407f[_0x480a('0x49')]['id']}})[_0x480a('0x28')](handleEntityNotFound(_0x56ed26,null))[_0x480a('0x28')](saveUpdates(_0x22407f[_0x480a('0x59')],null))['then'](respondWithResult(_0x56ed26,null))['catch'](handleError(_0x56ed26,null));};exports[_0x480a('0x29')]=function(_0x5b278e,_0x5a7dc1){return db[_0x480a('0x2f')][_0x480a('0x4c')]({'where':{'id':_0x5b278e[_0x480a('0x49')]['id']}})[_0x480a('0x28')](handleEntityNotFound(_0x5a7dc1,null))['then'](removeEntity(_0x5a7dc1,null))[_0x480a('0x4d')](handleError(_0x5a7dc1,null));};exports[_0x480a('0x5a')]=function(_0x4a389c,_0x1478a8,_0x4ae435){return db[_0x480a('0x2f')][_0x480a('0x4c')]({'where':{'id':_0x4a389c[_0x480a('0x49')]['id']}})[_0x480a('0x28')](handleEntityNotFound(_0x1478a8,null))[_0x480a('0x28')](function(_0x8ea0df){if(_0x8ea0df){return _0x8ea0df[_0x480a('0x5a')](_0x4a389c[_0x480a('0x59')][_0x480a('0x5b')],_['omit'](_0x4a389c[_0x480a('0x59')],[_0x480a('0x5b'),'id'])||{});}})[_0x480a('0x28')](respondWithResult(_0x1478a8,null))[_0x480a('0x4d')](handleError(_0x1478a8,null));};exports[_0x480a('0x5c')]=function(_0x7a4662,_0x1d24ae,_0x11301f){return db['SquareProject'][_0x480a('0x4c')]({'where':{'id':_0x7a4662[_0x480a('0x49')]['id']}})['then'](handleEntityNotFound(_0x1d24ae,null))[_0x480a('0x28')](function(_0x24a43a){if(_0x24a43a){return _0x24a43a[_0x480a('0x5c')](_0x7a4662[_0x480a('0x36')][_0x480a('0x5b')])['then'](function(){if(_[_0x480a('0x5d')](_0x7a4662[_0x480a('0x36')]['ids'])){for(var _0x1f0902=0x0;_0x1f0902<_0x7a4662[_0x480a('0x36')][_0x480a('0x5b')]['length'];_0x1f0902+=0x1){socket[_0x480a('0x5e')](_0x480a('0x5f'),{'UserId':Number(_0x7a4662[_0x480a('0x36')][_0x480a('0x5b')][_0x1f0902]),'SquareProjectId':Number(_0x7a4662[_0x480a('0x49')]['id'])});}}else{socket['emit'](_0x480a('0x5f'),{'UserId':Number(_0x7a4662['query'][_0x480a('0x5b')]),'SquareProjectId':Number(_0x7a4662['params']['id'])});}});}})['then'](respondWithStatusCode(_0x1d24ae,null))['catch'](handleError(_0x1d24ae,null));};exports[_0x480a('0x60')]=function(_0x53efb5,_0x2ad5c0,_0x1dfef3){var _0xe96583={};var _0x357e8c={};var _0x481050;var _0x210511;return db[_0x480a('0x2f')]['findOne']({'where':{'id':_0x53efb5[_0x480a('0x49')]['id']}})[_0x480a('0x28')](handleEntityNotFound(_0x2ad5c0,null))[_0x480a('0x28')](function(_0x47c7ae){if(_0x47c7ae){_0x481050=_0x47c7ae;_0x357e8c[_0x480a('0x33')]=_[_0x480a('0x34')](db[_0x480a('0x61')][_0x480a('0x4a')]);_0x357e8c[_0x480a('0x36')]=_[_0x480a('0x34')](_0x53efb5[_0x480a('0x36')]);_0x357e8c[_0x480a('0x35')]=_[_0x480a('0x38')](_0x357e8c[_0x480a('0x33')],_0x357e8c[_0x480a('0x36')]);_0xe96583[_0x480a('0x37')]=_[_0x480a('0x38')](_0x357e8c['model'],qs[_0x480a('0x39')](_0x53efb5[_0x480a('0x36')][_0x480a('0x39')]));_0xe96583[_0x480a('0x37')]=_0xe96583[_0x480a('0x37')][_0x480a('0x4b')]?_0xe96583[_0x480a('0x37')]:_0x357e8c[_0x480a('0x33')];_0xe96583['order']=qs[_0x480a('0x3d')](_0x53efb5[_0x480a('0x36')][_0x480a('0x3d')]);_0xe96583[_0x480a('0x3e')]=qs['filters'](_['pick'](_0x53efb5[_0x480a('0x36')],_0x357e8c[_0x480a('0x35')]));if(_0x53efb5[_0x480a('0x36')]['filter']){_0xe96583[_0x480a('0x3e')]=_[_0x480a('0x41')](_0xe96583[_0x480a('0x3e')],{'$or':_[_0x480a('0x42')](_0xe96583[_0x480a('0x37')],function(_0x3d1f89){var _0x37de6b={};_0x37de6b[_0x3d1f89]={'$like':'%'+_0x53efb5[_0x480a('0x36')][_0x480a('0x40')]+'%'};return _0x37de6b;})});}_0xe96583=_[_0x480a('0x41')]({},_0xe96583,_0x53efb5[_0x480a('0x44')]);return _0x481050[_0x480a('0x60')](_0xe96583);}})[_0x480a('0x28')](function(_0x1cb7f3){if(_0x1cb7f3){_0x210511=_0x1cb7f3[_0x480a('0x4b')];if(!_0x53efb5[_0x480a('0x36')]['hasOwnProperty'](_0x480a('0x3b'))){_0xe96583[_0x480a('0x21')]=qs['limit'](_0x53efb5[_0x480a('0x36')][_0x480a('0x21')]);_0xe96583['offset']=qs['offset'](_0x53efb5[_0x480a('0x36')][_0x480a('0x1f')]);}return _0x481050[_0x480a('0x60')](_0xe96583);}})[_0x480a('0x28')](function(_0x514f5c){if(_0x514f5c){return _0x514f5c?{'count':_0x210511,'rows':_0x514f5c}:null;}})[_0x480a('0x28')](respondWithResult(_0x2ad5c0,null))['catch'](handleError(_0x2ad5c0,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 3127d27..d84563c 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 _0xec76=['events','../../mysqldb','SquareProject','setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0x3219ca,_0x2c010d){var _0x548aa8=function(_0x39f228){while(--_0x39f228){_0x3219ca['push'](_0x3219ca['shift']());}};_0x548aa8(++_0x2c010d);}(_0xec76,0x90));var _0x6ec7=function(_0x485212,_0x1b1266){_0x485212=_0x485212-0x0;var _0x343711=_0xec76[_0x485212];return _0x343711;};'use strict';var EventEmitter=require(_0x6ec7('0x0'));var SquareProject=require(_0x6ec7('0x1'))['db'][_0x6ec7('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x6ec7('0x3')](0x0);var events={'afterCreate':_0x6ec7('0x4'),'afterUpdate':'update','afterDestroy':_0x6ec7('0x5')};function emitEvent(_0x113b89){return function(_0x581685,_0x7e12a8,_0x5afb82){SquareProjectEvents[_0x6ec7('0x6')](_0x113b89+':'+_0x581685['id'],_0x581685);SquareProjectEvents[_0x6ec7('0x6')](_0x113b89,_0x581685);_0x5afb82(null);};}for(var e in events){if(events[_0x6ec7('0x7')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x6ec7('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x2ab8=['remove','emit','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update'];(function(_0x2f3b86,_0x1fffad){var _0x9741a0=function(_0x654b64){while(--_0x654b64){_0x2f3b86['push'](_0x2f3b86['shift']());}};_0x9741a0(++_0x1fffad);}(_0x2ab8,0x9a));var _0x82ab=function(_0x163f15,_0x4cf917){_0x163f15=_0x163f15-0x0;var _0x3a463f=_0x2ab8[_0x163f15];return _0x3a463f;};'use strict';var EventEmitter=require(_0x82ab('0x0'));var SquareProject=require(_0x82ab('0x1'))['db'][_0x82ab('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x82ab('0x3')](0x0);var events={'afterCreate':_0x82ab('0x4'),'afterUpdate':_0x82ab('0x5'),'afterDestroy':_0x82ab('0x6')};function emitEvent(_0x21995a){return function(_0x3d45f0,_0x5b9071,_0x31322c){SquareProjectEvents[_0x82ab('0x7')](_0x21995a+':'+_0x3d45f0['id'],_0x3d45f0);SquareProjectEvents[_0x82ab('0x7')](_0x21995a,_0x3d45f0);_0x31322c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x82ab('0x8')](e,emitEvent(event));}}module[_0x82ab('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 03c5fb0..d0af5a2 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 _0xb63f=['YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','changed','preproduction','savedAt'];(function(_0x28eede,_0x20d7b6){var _0x420296=function(_0x38c3b3){while(--_0x38c3b3){_0x28eede['push'](_0x28eede['shift']());}};_0x420296(++_0x20d7b6);}(_0xb63f,0xc1));var _0xfb63=function(_0x3ec333,_0x26bcbe){_0x3ec333=_0x3ec333-0x0;var _0x15ccb8=_0xb63f[_0x3ec333];return _0x15ccb8;};'use strict';var _=require(_0xfb63('0x0'));var util=require('util');var logger=require(_0xfb63('0x1'))(_0xfb63('0x2'));var moment=require(_0xfb63('0x3'));var BPromise=require(_0xfb63('0x4'));var rp=require(_0xfb63('0x5'));var fs=require('fs');var path=require(_0xfb63('0x6'));var rimraf=require(_0xfb63('0x7'));var config=require(_0xfb63('0x8'));var attributes=require(_0xfb63('0x9'));module['exports']=function(_0x3464c9,_0x25bf3d){return _0x3464c9[_0xfb63('0xa')](_0xfb63('0xb'),attributes,{'tableName':_0xfb63('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5143b6,_0x517106,_0x40c64f){if(_0x5143b6[_0xfb63('0xd')](_0xfb63('0xe'))){_0x5143b6[_0xfb63('0xf')]=moment()['format'](_0xfb63('0x10'));}if(_0x5143b6[_0xfb63('0xd')](_0xfb63('0x11'))){_0x5143b6[_0xfb63('0x12')]=moment()['format'](_0xfb63('0x10'));}_0x40c64f(null,_0x5143b6);}}});}; \ No newline at end of file +var _0x38c0=['production','publishedAt','format','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./squareProject.attributes','exports','SquareProject','square_projects','changed','savedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x32c81b,_0x2945f7){var _0x54fd24=function(_0x3749ed){while(--_0x3749ed){_0x32c81b['push'](_0x32c81b['shift']());}};_0x54fd24(++_0x2945f7);}(_0x38c0,0x147));var _0x038c=function(_0x3a7a9c,_0x24f7d6){_0x3a7a9c=_0x3a7a9c-0x0;var _0x59156e=_0x38c0[_0x3a7a9c];return _0x59156e;};'use strict';var _=require(_0x038c('0x0'));var util=require(_0x038c('0x1'));var logger=require(_0x038c('0x2'))(_0x038c('0x3'));var moment=require(_0x038c('0x4'));var BPromise=require('bluebird');var rp=require(_0x038c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x038c('0x6'));var config=require(_0x038c('0x7'));var attributes=require(_0x038c('0x8'));module[_0x038c('0x9')]=function(_0x531474,_0x23236d){return _0x531474['define'](_0x038c('0xa'),attributes,{'tableName':_0x038c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3ccdbf,_0x3f5d77,_0x110442){if(_0x3ccdbf[_0x038c('0xc')]('preproduction')){_0x3ccdbf[_0x038c('0xd')]=moment()['format'](_0x038c('0xe'));}if(_0x3ccdbf[_0x038c('0xc')](_0x038c('0xf'))){_0x3ccdbf[_0x038c('0x10')]=moment()[_0x038c('0x11')](_0x038c('0xe'));}_0x110442(null,_0x3ccdbf);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 0354f8a..6208f3e 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 _0x8e1d=['include','map','model','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','SquareProject,\x20%s,\x20%s','debug','SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSquareProject','SquareProject','find','options','raw','attributes'];(function(_0x1e3c2f,_0x53b8d1){var _0x40ac24=function(_0x418cbc){while(--_0x418cbc){_0x1e3c2f['push'](_0x1e3c2f['shift']());}};_0x40ac24(++_0x53b8d1);}(_0x8e1d,0x106));var _0xd8e1=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x8e1d[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0xd8e1('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd8e1('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd8e1('0x2'))['db'];var utils=require(_0xd8e1('0x3'));var logger=require(_0xd8e1('0x4'))(_0xd8e1('0x5'));var config=require(_0xd8e1('0x6'));var jayson=require(_0xd8e1('0x7'));var client=jayson[_0xd8e1('0x8')][_0xd8e1('0x9')]({'port':0x232a});config['redis']=_[_0xd8e1('0xa')](config[_0xd8e1('0xb')],{'host':_0xd8e1('0xc'),'port':0x18eb});var socket=require(_0xd8e1('0xd'))(new Redis(config[_0xd8e1('0xb')]));require('./squareProject.socket')[_0xd8e1('0xe')](socket);function respondWithRpcPromise(_0x385395,_0x282bd2,_0x93dfcf){return new BPromise(function(_0x28b1d3,_0x9cfdb){return client[_0xd8e1('0xf')](_0x385395,_0x93dfcf)[_0xd8e1('0x10')](function(_0x2c0856){logger[_0xd8e1('0x11')](_0xd8e1('0x12'),_0x282bd2,'request\x20sent');logger[_0xd8e1('0x13')](_0xd8e1('0x14'),_0x282bd2,_0xd8e1('0x15'),JSON[_0xd8e1('0x16')](_0x2c0856));if(_0x2c0856['error']){if(_0x2c0856[_0xd8e1('0x17')][_0xd8e1('0x18')]===0x1f4){logger[_0xd8e1('0x17')](_0xd8e1('0x12'),_0x282bd2,_0x2c0856[_0xd8e1('0x17')][_0xd8e1('0x19')]);return _0x9cfdb(_0x2c0856[_0xd8e1('0x17')][_0xd8e1('0x19')]);}logger[_0xd8e1('0x17')](_0xd8e1('0x12'),_0x282bd2,_0x2c0856[_0xd8e1('0x17')]['message']);return _0x28b1d3(_0x2c0856[_0xd8e1('0x17')][_0xd8e1('0x19')]);}else{logger[_0xd8e1('0x11')]('SquareProject,\x20%s,\x20%s',_0x282bd2,_0xd8e1('0x15'));_0x28b1d3(_0x2c0856[_0xd8e1('0x1a')]['message']);}})[_0xd8e1('0x1b')](function(_0x2f16e3){logger[_0xd8e1('0x17')](_0xd8e1('0x12'),_0x282bd2,_0x2f16e3);_0x9cfdb(_0x2f16e3);});});}exports[_0xd8e1('0x1c')]=function(_0x275b60){var _0x188c1=this;return new Promise(function(_0x5d27d0,_0x4719ed){return db[_0xd8e1('0x1d')][_0xd8e1('0x1e')]({'raw':_0x275b60[_0xd8e1('0x1f')]?_0x275b60['options'][_0xd8e1('0x20')]===undefined?!![]:![]:!![],'where':_0x275b60[_0xd8e1('0x1f')]?_0x275b60[_0xd8e1('0x1f')]['where']||null:null,'attributes':_0x275b60[_0xd8e1('0x1f')]?_0x275b60[_0xd8e1('0x1f')][_0xd8e1('0x21')]||null:null,'include':_0x275b60[_0xd8e1('0x1f')]?_0x275b60[_0xd8e1('0x1f')][_0xd8e1('0x22')]?_[_0xd8e1('0x23')](_0x275b60[_0xd8e1('0x1f')][_0xd8e1('0x22')],function(_0x2fda0e){return{'model':db[_0x2fda0e[_0xd8e1('0x24')]],'as':_0x2fda0e['as'],'attributes':_0x2fda0e[_0xd8e1('0x21')],'include':_0x2fda0e['include']?_['map'](_0x2fda0e['include'],function(_0x3bffc5){return{'model':db[_0x3bffc5['model']],'as':_0x3bffc5['as'],'attributes':_0x3bffc5[_0xd8e1('0x21')],'include':_0x3bffc5['include']?_[_0xd8e1('0x23')](_0x3bffc5[_0xd8e1('0x22')],function(_0xc2aa7e){return{'model':db[_0xc2aa7e[_0xd8e1('0x24')]],'as':_0xc2aa7e['as'],'attributes':_0xc2aa7e['attributes']};}):[]};}):[]};}):[]:[]})[_0xd8e1('0x10')](function(_0x21d782){logger['info'](_0xd8e1('0x1c'),_0x275b60);logger['debug']('ShowSquareProject',_0x275b60,JSON[_0xd8e1('0x16')](_0x21d782));_0x5d27d0(_0x21d782);})[_0xd8e1('0x1b')](function(_0x1e2d0d){logger['error']('ShowSquareProject',_0x1e2d0d[_0xd8e1('0x19')],_0x275b60);_0x4719ed(_0x188c1[_0xd8e1('0x17')](0x1f4,_0x1e2d0d['message']));});});}; \ No newline at end of file +var _0x4efd=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareProject','options','raw','attributes','map','model','include','ShowSquareProject','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4f9aff,_0x48e7e4){var _0x5292b5=function(_0x5b9183){while(--_0x5b9183){_0x4f9aff['push'](_0x4f9aff['shift']());}};_0x5292b5(++_0x48e7e4);}(_0x4efd,0xd8));var _0xd4ef=function(_0x466247,_0x5d69e3){_0x466247=_0x466247-0x0;var _0x4b352e=_0x4efd[_0x466247];return _0x4b352e;};'use strict';var _=require(_0xd4ef('0x0'));var util=require('util');var moment=require(_0xd4ef('0x1'));var BPromise=require(_0xd4ef('0x2'));var rs=require(_0xd4ef('0x3'));var fs=require('fs');var Redis=require(_0xd4ef('0x4'));var db=require(_0xd4ef('0x5'))['db'];var utils=require(_0xd4ef('0x6'));var logger=require(_0xd4ef('0x7'))(_0xd4ef('0x8'));var config=require(_0xd4ef('0x9'));var jayson=require(_0xd4ef('0xa'));var client=jayson[_0xd4ef('0xb')]['http']({'port':0x232a});config['redis']=_[_0xd4ef('0xc')](config[_0xd4ef('0xd')],{'host':_0xd4ef('0xe'),'port':0x18eb});var socket=require(_0xd4ef('0xf'))(new Redis(config['redis']));require(_0xd4ef('0x10'))['register'](socket);function respondWithRpcPromise(_0x48461b,_0x1e22f1,_0x5adb06){return new BPromise(function(_0x4adf4c,_0x13caab){return client['request'](_0x48461b,_0x5adb06)[_0xd4ef('0x11')](function(_0x53ee28){logger[_0xd4ef('0x12')](_0xd4ef('0x13'),_0x1e22f1,_0xd4ef('0x14'));logger[_0xd4ef('0x15')](_0xd4ef('0x16'),_0x1e22f1,_0xd4ef('0x14'),JSON[_0xd4ef('0x17')](_0x53ee28));if(_0x53ee28[_0xd4ef('0x18')]){if(_0x53ee28[_0xd4ef('0x18')][_0xd4ef('0x19')]===0x1f4){logger[_0xd4ef('0x18')](_0xd4ef('0x13'),_0x1e22f1,_0x53ee28[_0xd4ef('0x18')]['message']);return _0x13caab(_0x53ee28['error'][_0xd4ef('0x1a')]);}logger[_0xd4ef('0x18')](_0xd4ef('0x13'),_0x1e22f1,_0x53ee28[_0xd4ef('0x18')]['message']);return _0x4adf4c(_0x53ee28['error']['message']);}else{logger['info'](_0xd4ef('0x13'),_0x1e22f1,_0xd4ef('0x14'));_0x4adf4c(_0x53ee28[_0xd4ef('0x1b')][_0xd4ef('0x1a')]);}})[_0xd4ef('0x1c')](function(_0x514596){logger[_0xd4ef('0x18')](_0xd4ef('0x13'),_0x1e22f1,_0x514596);_0x13caab(_0x514596);});});}exports['ShowSquareProject']=function(_0x3ce125){var _0x1413cd=this;return new Promise(function(_0x37752c,_0x1e997a){return db[_0xd4ef('0x1d')]['find']({'raw':_0x3ce125['options']?_0x3ce125[_0xd4ef('0x1e')][_0xd4ef('0x1f')]===undefined?!![]:![]:!![],'where':_0x3ce125[_0xd4ef('0x1e')]?_0x3ce125['options']['where']||null:null,'attributes':_0x3ce125[_0xd4ef('0x1e')]?_0x3ce125[_0xd4ef('0x1e')][_0xd4ef('0x20')]||null:null,'include':_0x3ce125[_0xd4ef('0x1e')]?_0x3ce125['options']['include']?_[_0xd4ef('0x21')](_0x3ce125[_0xd4ef('0x1e')]['include'],function(_0x4c776a){return{'model':db[_0x4c776a[_0xd4ef('0x22')]],'as':_0x4c776a['as'],'attributes':_0x4c776a[_0xd4ef('0x20')],'include':_0x4c776a[_0xd4ef('0x23')]?_[_0xd4ef('0x21')](_0x4c776a[_0xd4ef('0x23')],function(_0x4e2498){return{'model':db[_0x4e2498['model']],'as':_0x4e2498['as'],'attributes':_0x4e2498[_0xd4ef('0x20')],'include':_0x4e2498['include']?_[_0xd4ef('0x21')](_0x4e2498[_0xd4ef('0x23')],function(_0x3c5f71){return{'model':db[_0x3c5f71[_0xd4ef('0x22')]],'as':_0x3c5f71['as'],'attributes':_0x3c5f71[_0xd4ef('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x109075){logger[_0xd4ef('0x12')](_0xd4ef('0x24'),_0x3ce125);logger[_0xd4ef('0x15')]('ShowSquareProject',_0x3ce125,JSON['stringify'](_0x109075));_0x37752c(_0x109075);})[_0xd4ef('0x1c')](function(_0x337b5d){logger[_0xd4ef('0x18')](_0xd4ef('0x24'),_0x337b5d[_0xd4ef('0x1a')],_0x3ce125);_0x1e997a(_0x1413cd[_0xd4ef('0x18')](0x1f4,_0x337b5d[_0xd4ef('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 58e7715..8aa2195 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 _0x7944=['./squareProject.events','save','remove','update','register','squareProject:'];(function(_0x328bd3,_0x9cf5a5){var _0x458149=function(_0x3f60d9){while(--_0x3f60d9){_0x328bd3['push'](_0x328bd3['shift']());}};_0x458149(++_0x9cf5a5);}(_0x7944,0x198));var _0x4794=function(_0x2c6c27,_0x583885){_0x2c6c27=_0x2c6c27-0x0;var _0x4bf010=_0x7944[_0x2c6c27];return _0x4bf010;};'use strict';var SquareProjectEvents=require(_0x4794('0x0'));var events=[_0x4794('0x1'),_0x4794('0x2'),_0x4794('0x3')];function createListener(_0x2d873d,_0x584ce6){return function(_0x5e4c5c){_0x584ce6['emit'](_0x2d873d,_0x5e4c5c);};}function removeListener(_0xbc8b0b,_0x206ee4){return function(){SquareProjectEvents['removeListener'](_0xbc8b0b,_0x206ee4);};}exports[_0x4794('0x4')]=function(_0x22eb3a){for(var _0x34c2f1=0x0,_0x504e32=events['length'];_0x34c2f1<_0x504e32;_0x34c2f1++){var _0x236137=events[_0x34c2f1];var _0x3fe24a=createListener(_0x4794('0x5')+_0x236137,_0x22eb3a);SquareProjectEvents['on'](_0x236137,_0x3fe24a);}}; \ No newline at end of file +var _0x0393=['emit','removeListener','register','length','squareProject:','save','update'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x0393,0x75));var _0x3039=function(_0x3ff7d2,_0x4584d3){_0x3ff7d2=_0x3ff7d2-0x0;var _0xe3f7ec=_0x0393[_0x3ff7d2];return _0xe3f7ec;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x3039('0x0'),'remove',_0x3039('0x1')];function createListener(_0x17c031,_0x291288){return function(_0x4e023c){_0x291288[_0x3039('0x2')](_0x17c031,_0x4e023c);};}function removeListener(_0x25fc58,_0x3f5bd0){return function(){SquareProjectEvents[_0x3039('0x3')](_0x25fc58,_0x3f5bd0);};}exports[_0x3039('0x4')]=function(_0x3b42c5){for(var _0x4bc701=0x0,_0x51e456=events[_0x3039('0x5')];_0x4bc701<_0x51e456;_0x4bc701++){var _0x5b1a7f=events[_0x4bc701];var _0x56a1a3=createListener(_0x3039('0x6')+_0x5b1a7f,_0x3b42c5);SquareProjectEvents['on'](_0x5b1a7f,_0x56a1a3);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 600854e..1e3449c 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 _0x53ec=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareRecording.controller','isAuthenticated','get','/:id','show','/:id/download','download','post','create','put'];(function(_0x193fb5,_0x395a14){var _0x383042=function(_0xed5fa5){while(--_0xed5fa5){_0x193fb5['push'](_0x193fb5['shift']());}};_0x383042(++_0x395a14);}(_0x53ec,0x192));var _0xc53e=function(_0x154983,_0xc29edf){_0x154983=_0x154983-0x0;var _0x3d1243=_0x53ec[_0x154983];return _0x3d1243;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router[_0xc53e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x12')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller[_0xc53e('0x13')]);module[_0xc53e('0x14')]=router; \ No newline at end of file +var _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','download','post','create','put','delete','exports'];(function(_0x33f4bf,_0x47e924){var _0x828f1f=function(_0x5ef84b){while(--_0x5ef84b){_0x33f4bf['push'](_0x33f4bf['shift']());}};_0x828f1f(++_0x47e924);}(_0x326f,0xd1));var _0xf326=function(_0x118d2a,_0x50f179){_0x118d2a=_0x118d2a-0x0;var _0x26f7de=_0x326f[_0x118d2a];return _0x26f7de;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('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 f3796c5..9a3be45 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 _0x5d17=['getDataValue','savePath','substring','sequelize','exports','STRING','VIRTUAL'];(function(_0x4db77e,_0x45e7a9){var _0x175f6a=function(_0x334f02){while(--_0x334f02){_0x4db77e['push'](_0x4db77e['shift']());}};_0x175f6a(++_0x45e7a9);}(_0x5d17,0x114));var _0x75d1=function(_0x5a401e,_0x2de782){_0x5a401e=_0x5a401e-0x0;var _0x2aa2cc=_0x5d17[_0x5a401e];return _0x2aa2cc;};'use strict';var Sequelize=require(_0x75d1('0x0'));module[_0x75d1('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x75d1('0x2')]},'context':{'type':Sequelize[_0x75d1('0x2')]},'extension':{'type':Sequelize[_0x75d1('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x75d1('0x2')]},'dnid':{'type':Sequelize[_0x75d1('0x2')]},'projectName':{'type':Sequelize[_0x75d1('0x2')]},'saveName':{'type':Sequelize[_0x75d1('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x75d1('0x2')]},'format':{'type':Sequelize[_0x75d1('0x3')],'get':function(){var _0x5c957a='';var _0x1ee61b=this[_0x75d1('0x4')](_0x75d1('0x5'));if(_0x1ee61b){_0x5c957a=_0x1ee61b[_0x75d1('0x6')](_0x1ee61b['lastIndexOf']('.'));}return _0x5c957a;}}}; \ No newline at end of file +var _0x9957=['sequelize','exports','STRING','VIRTUAL','getDataValue','savePath','lastIndexOf'];(function(_0x38f67c,_0x19f763){var _0x57166d=function(_0x2d15c9){while(--_0x2d15c9){_0x38f67c['push'](_0x38f67c['shift']());}};_0x57166d(++_0x19f763);}(_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')]},'callerid':{'type':Sequelize[_0x7995('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x7995('0x2')]},'extension':{'type':Sequelize[_0x7995('0x2')]},'priority':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x7995('0x2')]},'saveName':{'type':Sequelize[_0x7995('0x2')]},'filename':{'type':Sequelize[_0x7995('0x2')]},'savePath':{'type':Sequelize[_0x7995('0x2')]},'format':{'type':Sequelize[_0x7995('0x3')],'get':function(){var _0x326741='';var _0x4996ca=this[_0x7995('0x4')](_0x7995('0x5'));if(_0x4996ca){_0x326741=_0x4996ca['substring'](_0x4996ca[_0x7995('0x6')]('.'));}return _0x326741;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index ae04491..8ac1cbd 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 _0x4edd=['model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','uniqueid','filename','format','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink','message','Not\x20found','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','savePath','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','sendStatus','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type'];(function(_0xb44cf2,_0x4182b5){var _0x5238d5=function(_0x3e61d1){while(--_0x3e61d1){_0xb44cf2['push'](_0xb44cf2['shift']());}};_0x5238d5(++_0x4182b5);}(_0x4edd,0xe9));var _0xd4ed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4edd[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd4ed('0x0'));var rimraf=require(_0xd4ed('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd4ed('0x2'));var moment=require(_0xd4ed('0x3'));var BPromise=require(_0xd4ed('0x4'));var Mustache=require('mustache');var util=require(_0xd4ed('0x5'));var path=require(_0xd4ed('0x6'));var sox=require(_0xd4ed('0x7'));var csv=require('to-csv');var ejs=require(_0xd4ed('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd4ed('0x9'));var jsforce=require(_0xd4ed('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd4ed('0xb'));var querystring=require('querystring');var Papa=require(_0xd4ed('0xc'));var Redis=require(_0xd4ed('0xd'));var authService=require(_0xd4ed('0xe'));var qs=require(_0xd4ed('0xf'));var as=require(_0xd4ed('0x10'));var hardwareService=require(_0xd4ed('0x11'));var logger=require(_0xd4ed('0x12'))('api');var utils=require(_0xd4ed('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xd4ed('0x14'));var db=require(_0xd4ed('0x15'))['db'];function respondWithStatusCode(_0x4e43ea,_0x2e2c0e){_0x2e2c0e=_0x2e2c0e||0xcc;return function(_0x3c0e76){if(_0x3c0e76){return _0x4e43ea['sendStatus'](_0x2e2c0e);}return _0x4e43ea['status'](_0x2e2c0e)[_0xd4ed('0x16')]();};}function respondWithResult(_0x3d2b7a,_0x6fa300){_0x6fa300=_0x6fa300||0xc8;return function(_0x428794){if(_0x428794){return _0x3d2b7a[_0xd4ed('0x17')](_0x6fa300)[_0xd4ed('0x18')](_0x428794);}};}function respondWithFilteredResult(_0x53ce97,_0x998f63){return function(_0x4f09c6){if(_0x4f09c6){var _0x50d59f=typeof _0x998f63['offset']===_0xd4ed('0x19')&&typeof _0x998f63[_0xd4ed('0x1a')]===_0xd4ed('0x19');var _0x269c9f=_0x4f09c6[_0xd4ed('0x1b')];var _0x5d969c=_0x50d59f?0x0:_0x998f63[_0xd4ed('0x1c')];var _0x5213c0=_0x50d59f?_0x4f09c6['count']:_0x998f63[_0xd4ed('0x1c')]+_0x998f63[_0xd4ed('0x1a')];var _0x595b0e;if(_0x5213c0>=_0x269c9f){_0x5213c0=_0x269c9f;_0x595b0e=0xc8;}else{_0x595b0e=0xce;}_0x53ce97[_0xd4ed('0x17')](_0x595b0e);return _0x53ce97[_0xd4ed('0x1d')](_0xd4ed('0x1e'),_0x5d969c+'-'+_0x5213c0+'/'+_0x269c9f)['json'](_0x4f09c6);}return null;};}function patchUpdates(_0x3a9cc0){return function(_0x26118d){try{jsonpatch[_0xd4ed('0x1f')](_0x26118d,_0x3a9cc0,!![]);}catch(_0x1a8a8d){return BPromise['reject'](_0x1a8a8d);}return _0x26118d[_0xd4ed('0x20')]();};}function saveUpdates(_0x21c4e8,_0x486e0d){return function(_0x59923e){if(_0x59923e){return _0x59923e[_0xd4ed('0x21')](_0x21c4e8)[_0xd4ed('0x22')](function(_0x3ab3b6){return _0x3ab3b6;});}return null;};}function removeEntity(_0x4bb336,_0x2b4de7){return function(_0x4fa2b2){if(_0x4fa2b2){return _0x4fa2b2['destroy']()[_0xd4ed('0x22')](function(){_0x4bb336[_0xd4ed('0x17')](0xcc)[_0xd4ed('0x16')]();});}};}function handleEntityNotFound(_0x264570,_0x2dc18e){return function(_0xef16ff){if(!_0xef16ff){_0x264570[_0xd4ed('0x23')](0x194);}return _0xef16ff;};}function handleError(_0x42edff,_0x2d9c7e){_0x2d9c7e=_0x2d9c7e||0x1f4;return function(_0x4ddb5b){logger[_0xd4ed('0x24')](_0x4ddb5b[_0xd4ed('0x25')]);if(_0x4ddb5b[_0xd4ed('0x26')]){delete _0x4ddb5b['name'];}_0x42edff[_0xd4ed('0x17')](_0x2d9c7e)[_0xd4ed('0x27')](_0x4ddb5b);};}exports[_0xd4ed('0x28')]=function(_0x192623,_0x5b8c8){var _0x25dbf4={},_0x5b124f={},_0x46b1e5={'count':0x0,'rows':[]};var _0x168917=_[_0xd4ed('0x29')](db[_0xd4ed('0x2a')][_0xd4ed('0x2b')],function(_0x38ab2b){return{'name':_0x38ab2b[_0xd4ed('0x2c')],'type':_0x38ab2b[_0xd4ed('0x2d')]['key']};});_0x5b124f[_0xd4ed('0x2e')]=_[_0xd4ed('0x29')](_0x168917,'name');_0x5b124f['query']=_[_0xd4ed('0x2f')](_0x192623['query']);_0x5b124f[_0xd4ed('0x30')]=_['intersection'](_0x5b124f[_0xd4ed('0x2e')],_0x5b124f[_0xd4ed('0x31')]);_0x25dbf4[_0xd4ed('0x32')]=_[_0xd4ed('0x33')](_0x5b124f[_0xd4ed('0x2e')],qs[_0xd4ed('0x34')](_0x192623[_0xd4ed('0x31')][_0xd4ed('0x34')]));_0x25dbf4[_0xd4ed('0x32')]=_0x25dbf4[_0xd4ed('0x32')][_0xd4ed('0x35')]?_0x25dbf4[_0xd4ed('0x32')]:_0x5b124f[_0xd4ed('0x2e')];if(!_0x192623['query'][_0xd4ed('0x36')](_0xd4ed('0x37'))){_0x25dbf4[_0xd4ed('0x1a')]=qs[_0xd4ed('0x1a')](_0x192623[_0xd4ed('0x31')][_0xd4ed('0x1a')]);_0x25dbf4[_0xd4ed('0x1c')]=qs[_0xd4ed('0x1c')](_0x192623[_0xd4ed('0x31')][_0xd4ed('0x1c')]);}_0x25dbf4['order']=qs[_0xd4ed('0x38')](_0x192623[_0xd4ed('0x31')][_0xd4ed('0x38')]);_0x25dbf4[_0xd4ed('0x39')]=qs[_0xd4ed('0x30')](_['pick'](_0x192623['query'],_0x5b124f[_0xd4ed('0x30')]),_0x168917);if(_0x192623[_0xd4ed('0x31')]['filter']){_0x25dbf4[_0xd4ed('0x39')]=_[_0xd4ed('0x3a')](_0x25dbf4[_0xd4ed('0x39')],{'$or':_[_0xd4ed('0x29')](_0x168917,function(_0x1d7da0){if(_0x1d7da0[_0xd4ed('0x2d')]!==_0xd4ed('0x3b')){var _0x3a653e={};_0x3a653e[_0x1d7da0[_0xd4ed('0x26')]]={'$like':'%'+_0x192623[_0xd4ed('0x31')]['filter']+'%'};return _0x3a653e;}})});}_0x25dbf4=_[_0xd4ed('0x3a')]({},_0x25dbf4,_0x192623[_0xd4ed('0x3c')]);var _0x30a03a={'where':_0x25dbf4[_0xd4ed('0x39')]};return db[_0xd4ed('0x2a')][_0xd4ed('0x1b')](_0x30a03a)[_0xd4ed('0x22')](function(_0x311826){_0x46b1e5[_0xd4ed('0x1b')]=_0x311826;if(_0x192623[_0xd4ed('0x31')]['includeAll']){_0x25dbf4[_0xd4ed('0x3d')]=[{'all':!![]}];}return db[_0xd4ed('0x2a')][_0xd4ed('0x3e')](_0x25dbf4);})[_0xd4ed('0x22')](function(_0x1f0ed9){_0x46b1e5['rows']=_0x1f0ed9;return _0x46b1e5;})[_0xd4ed('0x22')](respondWithFilteredResult(_0x5b8c8,_0x25dbf4))[_0xd4ed('0x3f')](handleError(_0x5b8c8,null));};exports[_0xd4ed('0x40')]=function(_0x8567d9,_0x16d5ce){var _0x200509={'raw':!![],'where':{'id':_0x8567d9[_0xd4ed('0x41')]['id']}},_0x3fbde9={};_0x3fbde9['model']=_[_0xd4ed('0x2f')](db[_0xd4ed('0x2a')][_0xd4ed('0x2b')]);_0x3fbde9[_0xd4ed('0x31')]=_[_0xd4ed('0x2f')](_0x8567d9[_0xd4ed('0x31')]);_0x3fbde9[_0xd4ed('0x30')]=_[_0xd4ed('0x33')](_0x3fbde9[_0xd4ed('0x2e')],_0x3fbde9[_0xd4ed('0x31')]);_0x200509[_0xd4ed('0x32')]=_['intersection'](_0x3fbde9['model'],qs[_0xd4ed('0x34')](_0x8567d9[_0xd4ed('0x31')][_0xd4ed('0x34')]));_0x200509[_0xd4ed('0x32')]=_0x200509[_0xd4ed('0x32')][_0xd4ed('0x35')]?_0x200509[_0xd4ed('0x32')]:_0x3fbde9['model'];if(_0x8567d9['query'][_0xd4ed('0x42')]){_0x200509[_0xd4ed('0x3d')]=[{'all':!![]}];}_0x200509=_[_0xd4ed('0x3a')]({},_0x200509,_0x8567d9[_0xd4ed('0x3c')]);return db[_0xd4ed('0x2a')][_0xd4ed('0x43')](_0x200509)[_0xd4ed('0x22')](handleEntityNotFound(_0x16d5ce,null))['then'](respondWithResult(_0x16d5ce,null))[_0xd4ed('0x3f')](handleError(_0x16d5ce,null));};exports[_0xd4ed('0x44')]=function(_0x5e99fa,_0x334ab9){return db['SquareRecording'][_0xd4ed('0x44')](_0x5e99fa[_0xd4ed('0x45')],{})[_0xd4ed('0x22')](respondWithResult(_0x334ab9,0xc9))['catch'](handleError(_0x334ab9,null));};exports[_0xd4ed('0x21')]=function(_0x3c6bea,_0x1204c6){if(_0x3c6bea[_0xd4ed('0x45')]['id']){delete _0x3c6bea[_0xd4ed('0x45')]['id'];}return db[_0xd4ed('0x2a')][_0xd4ed('0x43')]({'where':{'id':_0x3c6bea[_0xd4ed('0x41')]['id']}})[_0xd4ed('0x22')](handleEntityNotFound(_0x1204c6,null))[_0xd4ed('0x22')](saveUpdates(_0x3c6bea[_0xd4ed('0x45')],null))['then'](respondWithResult(_0x1204c6,null))['catch'](handleError(_0x1204c6,null));};exports['download']=function(_0x1be989,_0x29fd2b,_0x2b6c8a){var _0x250add=require('../../components/encryptor');var _0x52b8d6=![];var _0x46aead={};if(_0x1be989[_0xd4ed('0x31')][_0xd4ed('0x2d')]&&_0x1be989[_0xd4ed('0x31')][_0xd4ed('0x2d')]===_0xd4ed('0x46')){_0x46aead[_0xd4ed('0x46')]=_0x1be989[_0xd4ed('0x41')]['id'];}else{_0x46aead['id']=_0x1be989[_0xd4ed('0x41')]['id'];}return db[_0xd4ed('0x2a')][_0xd4ed('0x43')]({'where':_0x46aead,'attributes':['id','savePath',_0xd4ed('0x47')],'raw':!![]})[_0xd4ed('0x22')](handleEntityNotFound(_0x29fd2b,null))[_0xd4ed('0x22')](function(_0x141c3d){if(_0x141c3d){var _0x5a2bcf=_0x141c3d['savePath'];var _0x1222e2=util[_0xd4ed('0x48')]('%s.cypher',_0x5a2bcf);if(fs[_0xd4ed('0x49')](_0x1222e2)){_0x52b8d6=!![];return _0x250add[_0xd4ed('0x4a')](_0x1222e2,_0x5a2bcf,config[_0xd4ed('0x4b')][_0xd4ed('0x4c')])['then'](function(){return _0x141c3d;});}return _0x141c3d;}})['then'](function(_0x1b4a8f){if(_0x1b4a8f){var _0x3ac988=_0x1b4a8f['savePath'];if(!fs['existsSync'](_0x3ac988)){throw new db[(_0xd4ed('0x4d'))][(_0xd4ed('0x4e'))](_0xd4ed('0x4f'));}if(_0x1b4a8f[_0xd4ed('0x47')]){return _0x29fd2b[_0xd4ed('0x50')](_0x3ac988,_0x1b4a8f[_0xd4ed('0x47')]+path[_0xd4ed('0x51')](_0x3ac988),function(){if(_0x52b8d6){fs[_0xd4ed('0x52')](_0x3ac988);}});}else{return _0x29fd2b[_0xd4ed('0x50')](_0x3ac988,function(_0x1d211a){if(_0x52b8d6){fs[_0xd4ed('0x52')](_0x3ac988);}});}}})[_0xd4ed('0x3f')](function(_0x525f26){if(_0x525f26[_0xd4ed('0x53')]===_0xd4ed('0x4f')){_0x29fd2b[_0xd4ed('0x17')](0x194)[_0xd4ed('0x27')](_0xd4ed('0x54'));}else{return handleError(_0x29fd2b,null);}});};exports[_0xd4ed('0x55')]=function(_0x3f1502,_0x476bb7){return db[_0xd4ed('0x2a')][_0xd4ed('0x43')]({'where':{'id':_0x3f1502[_0xd4ed('0x41')]['id']}})[_0xd4ed('0x22')](function(_0x4f0a0c){if(_[_0xd4ed('0x56')](_0x4f0a0c)){throw new ReferenceError('Entity\x20not\x20found');}return _0x4f0a0c;})['then'](function(_0x523166){var _0x6ab566=_0x523166['savePath'];logger[_0xd4ed('0x57')](_0xd4ed('0x58'),_0x6ab566);if(!_[_0xd4ed('0x56')](_0x523166[_0xd4ed('0x59')])&&fs[_0xd4ed('0x49')](_0x6ab566)){logger[_0xd4ed('0x57')](_0xd4ed('0x5a')+_0x6ab566+_0xd4ed('0x5b'));fs[_0xd4ed('0x5c')](_0x6ab566);}_0x6ab566=_0x6ab566+'.cypher';if(!_['isNil'](_0x523166[_0xd4ed('0x59')])&&fs[_0xd4ed('0x49')](_0x6ab566)){logger['info']('File:\x20\x22'+_0x6ab566+_0xd4ed('0x5b'));fs[_0xd4ed('0x5c')](_0x6ab566);}return _0x523166;})[_0xd4ed('0x22')](function(_0x4948dc){if(!_0x4948dc)throw new InternalError();return _0x4948dc['destroy']();})[_0xd4ed('0x22')](function(){_0x476bb7[_0xd4ed('0x17')](0xcc)[_0xd4ed('0x16')]();})[_0xd4ed('0x3f')](handleError(_0x476bb7,null));}; \ No newline at end of file +var _0x2cd2=['query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','SquareRecording','findAll','rows','catch','show','params','include','find','body','download','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','ValidationError','SquareRecording\x20not\x20found','extname','unlink','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','isNil','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model'];(function(_0x1ef02d,_0x1f7b1a){var _0x3e59c7=function(_0x3804e2){while(--_0x3804e2){_0x1ef02d['push'](_0x1ef02d['shift']());}};_0x3e59c7(++_0x1f7b1a);}(_0x2cd2,0xeb));var _0x22cd=function(_0x23ecfd,_0x181f8c){_0x23ecfd=_0x23ecfd-0x0;var _0x1f5091=_0x2cd2[_0x23ecfd];return _0x1f5091;};'use strict';var emlformat=require(_0x22cd('0x0'));var rimraf=require(_0x22cd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x22cd('0x2'));var rp=require(_0x22cd('0x3'));var moment=require(_0x22cd('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x22cd('0x5'));var path=require(_0x22cd('0x6'));var sox=require(_0x22cd('0x7'));var csv=require(_0x22cd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x22cd('0x9'));var _=require(_0x22cd('0xa'));var squel=require(_0x22cd('0xb'));var crypto=require(_0x22cd('0xc'));var jsforce=require(_0x22cd('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x22cd('0xe'));var Papa=require('papaparse');var Redis=require(_0x22cd('0xf'));var authService=require(_0x22cd('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x22cd('0x11'));var hardwareService=require(_0x22cd('0x12'));var logger=require(_0x22cd('0x13'))(_0x22cd('0x14'));var utils=require(_0x22cd('0x15'));var config=require(_0x22cd('0x16'));var licenseUtil=require(_0x22cd('0x17'));var db=require(_0x22cd('0x18'))['db'];function respondWithStatusCode(_0x33eefa,_0x40af50){_0x40af50=_0x40af50||0xcc;return function(_0x3b1bc2){if(_0x3b1bc2){return _0x33eefa[_0x22cd('0x19')](_0x40af50);}return _0x33eefa[_0x22cd('0x1a')](_0x40af50)[_0x22cd('0x1b')]();};}function respondWithResult(_0x377ec4,_0xc54c11){_0xc54c11=_0xc54c11||0xc8;return function(_0x51efd0){if(_0x51efd0){return _0x377ec4['status'](_0xc54c11)[_0x22cd('0x1c')](_0x51efd0);}};}function respondWithFilteredResult(_0x4fdc89,_0xed3505){return function(_0x575f4b){if(_0x575f4b){var _0x214aff=typeof _0xed3505['offset']===_0x22cd('0x1d')&&typeof _0xed3505[_0x22cd('0x1e')]==='undefined';var _0x460e19=_0x575f4b[_0x22cd('0x1f')];var _0x262a74=_0x214aff?0x0:_0xed3505[_0x22cd('0x20')];var _0x38d754=_0x214aff?_0x575f4b['count']:_0xed3505[_0x22cd('0x20')]+_0xed3505[_0x22cd('0x1e')];var _0x5deef1;if(_0x38d754>=_0x460e19){_0x38d754=_0x460e19;_0x5deef1=0xc8;}else{_0x5deef1=0xce;}_0x4fdc89[_0x22cd('0x1a')](_0x5deef1);return _0x4fdc89[_0x22cd('0x21')]('Content-Range',_0x262a74+'-'+_0x38d754+'/'+_0x460e19)['json'](_0x575f4b);}return null;};}function patchUpdates(_0x35ce16){return function(_0x3ca771){try{jsonpatch[_0x22cd('0x22')](_0x3ca771,_0x35ce16,!![]);}catch(_0x255b34){return BPromise[_0x22cd('0x23')](_0x255b34);}return _0x3ca771[_0x22cd('0x24')]();};}function saveUpdates(_0x233877,_0x153041){return function(_0x194992){if(_0x194992){return _0x194992[_0x22cd('0x25')](_0x233877)[_0x22cd('0x26')](function(_0x1b1b3f){return _0x1b1b3f;});}return null;};}function removeEntity(_0x22860e,_0x10a1b2){return function(_0x186922){if(_0x186922){return _0x186922[_0x22cd('0x27')]()[_0x22cd('0x26')](function(){_0x22860e[_0x22cd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54bbbe,_0x116cb5){return function(_0x13b7d2){if(!_0x13b7d2){_0x54bbbe[_0x22cd('0x19')](0x194);}return _0x13b7d2;};}function handleError(_0x1c714b,_0x3142b3){_0x3142b3=_0x3142b3||0x1f4;return function(_0x342de6){logger['error'](_0x342de6[_0x22cd('0x28')]);if(_0x342de6[_0x22cd('0x29')]){delete _0x342de6['name'];}_0x1c714b[_0x22cd('0x1a')](_0x3142b3)[_0x22cd('0x2a')](_0x342de6);};}exports[_0x22cd('0x2b')]=function(_0x374489,_0x5b58c2){var _0x1108bb={},_0x2af8a1={},_0x275744={'count':0x0,'rows':[]};var _0x22cec5=_[_0x22cd('0x2c')](db['SquareRecording'][_0x22cd('0x2d')],function(_0x125d45){return{'name':_0x125d45[_0x22cd('0x2e')],'type':_0x125d45[_0x22cd('0x2f')][_0x22cd('0x30')]};});_0x2af8a1[_0x22cd('0x31')]=_[_0x22cd('0x2c')](_0x22cec5,_0x22cd('0x29'));_0x2af8a1[_0x22cd('0x32')]=_[_0x22cd('0x33')](_0x374489[_0x22cd('0x32')]);_0x2af8a1[_0x22cd('0x34')]=_['intersection'](_0x2af8a1[_0x22cd('0x31')],_0x2af8a1[_0x22cd('0x32')]);_0x1108bb['attributes']=_[_0x22cd('0x35')](_0x2af8a1[_0x22cd('0x31')],qs[_0x22cd('0x36')](_0x374489[_0x22cd('0x32')][_0x22cd('0x36')]));_0x1108bb['attributes']=_0x1108bb[_0x22cd('0x37')][_0x22cd('0x38')]?_0x1108bb[_0x22cd('0x37')]:_0x2af8a1[_0x22cd('0x31')];if(!_0x374489[_0x22cd('0x32')][_0x22cd('0x39')]('nolimit')){_0x1108bb[_0x22cd('0x1e')]=qs[_0x22cd('0x1e')](_0x374489[_0x22cd('0x32')]['limit']);_0x1108bb['offset']=qs[_0x22cd('0x20')](_0x374489[_0x22cd('0x32')][_0x22cd('0x20')]);}_0x1108bb[_0x22cd('0x3a')]=qs[_0x22cd('0x3b')](_0x374489[_0x22cd('0x32')][_0x22cd('0x3b')]);_0x1108bb[_0x22cd('0x3c')]=qs[_0x22cd('0x34')](_[_0x22cd('0x3d')](_0x374489['query'],_0x2af8a1[_0x22cd('0x34')]),_0x22cec5);if(_0x374489[_0x22cd('0x32')][_0x22cd('0x3e')]){_0x1108bb[_0x22cd('0x3c')]=_[_0x22cd('0x3f')](_0x1108bb[_0x22cd('0x3c')],{'$or':_[_0x22cd('0x2c')](_0x22cec5,function(_0x53a616){if(_0x53a616[_0x22cd('0x2f')]!=='VIRTUAL'){var _0x1c0eb9={};_0x1c0eb9[_0x53a616[_0x22cd('0x29')]]={'$like':'%'+_0x374489[_0x22cd('0x32')][_0x22cd('0x3e')]+'%'};return _0x1c0eb9;}})});}_0x1108bb=_['merge']({},_0x1108bb,_0x374489[_0x22cd('0x40')]);var _0x473dce={'where':_0x1108bb[_0x22cd('0x3c')]};return db['SquareRecording'][_0x22cd('0x1f')](_0x473dce)[_0x22cd('0x26')](function(_0x5b9349){_0x275744[_0x22cd('0x1f')]=_0x5b9349;if(_0x374489[_0x22cd('0x32')][_0x22cd('0x41')]){_0x1108bb['include']=[{'all':!![]}];}return db[_0x22cd('0x42')][_0x22cd('0x43')](_0x1108bb);})[_0x22cd('0x26')](function(_0x341bd2){_0x275744[_0x22cd('0x44')]=_0x341bd2;return _0x275744;})['then'](respondWithFilteredResult(_0x5b58c2,_0x1108bb))[_0x22cd('0x45')](handleError(_0x5b58c2,null));};exports[_0x22cd('0x46')]=function(_0x2da244,_0x15ffd0){var _0x5d17b2={'raw':!![],'where':{'id':_0x2da244[_0x22cd('0x47')]['id']}},_0x291c49={};_0x291c49['model']=_[_0x22cd('0x33')](db['SquareRecording'][_0x22cd('0x2d')]);_0x291c49[_0x22cd('0x32')]=_[_0x22cd('0x33')](_0x2da244['query']);_0x291c49['filters']=_[_0x22cd('0x35')](_0x291c49[_0x22cd('0x31')],_0x291c49['query']);_0x5d17b2[_0x22cd('0x37')]=_[_0x22cd('0x35')](_0x291c49['model'],qs[_0x22cd('0x36')](_0x2da244[_0x22cd('0x32')][_0x22cd('0x36')]));_0x5d17b2[_0x22cd('0x37')]=_0x5d17b2[_0x22cd('0x37')]['length']?_0x5d17b2[_0x22cd('0x37')]:_0x291c49[_0x22cd('0x31')];if(_0x2da244['query'][_0x22cd('0x41')]){_0x5d17b2[_0x22cd('0x48')]=[{'all':!![]}];}_0x5d17b2=_[_0x22cd('0x3f')]({},_0x5d17b2,_0x2da244[_0x22cd('0x40')]);return db['SquareRecording'][_0x22cd('0x49')](_0x5d17b2)['then'](handleEntityNotFound(_0x15ffd0,null))[_0x22cd('0x26')](respondWithResult(_0x15ffd0,null))['catch'](handleError(_0x15ffd0,null));};exports['create']=function(_0x2d53e2,_0x306671){return db['SquareRecording']['create'](_0x2d53e2['body'],{})[_0x22cd('0x26')](respondWithResult(_0x306671,0xc9))['catch'](handleError(_0x306671,null));};exports[_0x22cd('0x25')]=function(_0x5426d9,_0x49b078){if(_0x5426d9['body']['id']){delete _0x5426d9[_0x22cd('0x4a')]['id'];}return db[_0x22cd('0x42')][_0x22cd('0x49')]({'where':{'id':_0x5426d9['params']['id']}})[_0x22cd('0x26')](handleEntityNotFound(_0x49b078,null))['then'](saveUpdates(_0x5426d9[_0x22cd('0x4a')],null))['then'](respondWithResult(_0x49b078,null))[_0x22cd('0x45')](handleError(_0x49b078,null));};exports[_0x22cd('0x4b')]=function(_0x20ad86,_0xc0cd73,_0x329510){var _0x181a7d=require('../../components/encryptor');var _0x3c6040=![];var _0x57ed71={};if(_0x20ad86[_0x22cd('0x32')][_0x22cd('0x2f')]&&_0x20ad86[_0x22cd('0x32')]['type']===_0x22cd('0x4c')){_0x57ed71['uniqueid']=_0x20ad86[_0x22cd('0x47')]['id'];}else{_0x57ed71['id']=_0x20ad86['params']['id'];}return db[_0x22cd('0x42')][_0x22cd('0x49')]({'where':_0x57ed71,'attributes':['id',_0x22cd('0x4d'),_0x22cd('0x4e')],'raw':!![]})[_0x22cd('0x26')](handleEntityNotFound(_0xc0cd73,null))[_0x22cd('0x26')](function(_0x4a2be1){if(_0x4a2be1){var _0x579ed9=_0x4a2be1[_0x22cd('0x4d')];var _0x24cd14=util[_0x22cd('0x4f')](_0x22cd('0x50'),_0x579ed9);if(fs[_0x22cd('0x51')](_0x24cd14)){_0x3c6040=!![];return _0x181a7d[_0x22cd('0x52')](_0x24cd14,_0x579ed9,config['secrets']['recording'])[_0x22cd('0x26')](function(){return _0x4a2be1;});}return _0x4a2be1;}})[_0x22cd('0x26')](function(_0x5e1b88){if(_0x5e1b88){var _0x518596=_0x5e1b88[_0x22cd('0x4d')];if(!fs['existsSync'](_0x518596)){throw new db['Sequelize'][(_0x22cd('0x53'))](_0x22cd('0x54'));}if(_0x5e1b88[_0x22cd('0x4e')]){return _0xc0cd73[_0x22cd('0x4b')](_0x518596,_0x5e1b88[_0x22cd('0x4e')]+path[_0x22cd('0x55')](_0x518596),function(){if(_0x3c6040){fs[_0x22cd('0x56')](_0x518596);}});}else{return _0xc0cd73[_0x22cd('0x4b')](_0x518596,function(_0x566fbf){if(_0x3c6040){fs[_0x22cd('0x56')](_0x518596);}});}}})[_0x22cd('0x45')](function(_0x2c0dbd){if(_0x2c0dbd['message']===_0x22cd('0x54')){_0xc0cd73[_0x22cd('0x1a')](0x194)[_0x22cd('0x2a')](_0x22cd('0x57'));}else{return handleError(_0xc0cd73,null);}});};exports['destroy']=function(_0x24cd36,_0x136404){return db[_0x22cd('0x42')][_0x22cd('0x49')]({'where':{'id':_0x24cd36[_0x22cd('0x47')]['id']}})[_0x22cd('0x26')](function(_0x1c8dd0){if(_['isNil'](_0x1c8dd0)){throw new ReferenceError(_0x22cd('0x58'));}return _0x1c8dd0;})['then'](function(_0x267ec8){var _0x4443a7=_0x267ec8[_0x22cd('0x4d')];logger[_0x22cd('0x59')](_0x22cd('0x5a'),_0x4443a7);if(!_['isNil'](_0x267ec8[_0x22cd('0x4d')])&&fs['existsSync'](_0x4443a7)){logger[_0x22cd('0x59')](_0x22cd('0x5b')+_0x4443a7+_0x22cd('0x5c'));fs['unlinkSync'](_0x4443a7);}_0x4443a7=_0x4443a7+_0x22cd('0x5d');if(!_[_0x22cd('0x5e')](_0x267ec8[_0x22cd('0x4d')])&&fs[_0x22cd('0x51')](_0x4443a7)){logger[_0x22cd('0x59')](_0x22cd('0x5b')+_0x4443a7+_0x22cd('0x5c'));fs['unlinkSync'](_0x4443a7);}return _0x267ec8;})[_0x22cd('0x26')](function(_0xd83e89){if(!_0xd83e89)throw new InternalError();return _0xd83e89['destroy']();})[_0x22cd('0x26')](function(){_0x136404['status'](0xcc)[_0x22cd('0x1b')]();})[_0x22cd('0x45')](handleError(_0x136404,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 2d5e25c..47728d6 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 _0xc0f9=['rimraf','../../config/environment','exports','define','square_recordings','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x420dc9,_0x56cb54){var _0x551210=function(_0xd790c7){while(--_0xd790c7){_0x420dc9['push'](_0x420dc9['shift']());}};_0x551210(++_0x56cb54);}(_0xc0f9,0xc5));var _0x9c0f=function(_0x1fd4d7,_0x2feafd){_0x1fd4d7=_0x1fd4d7-0x0;var _0x7efe8a=_0xc0f9[_0x1fd4d7];return _0x7efe8a;};'use strict';var _=require(_0x9c0f('0x0'));var util=require(_0x9c0f('0x1'));var logger=require(_0x9c0f('0x2'))(_0x9c0f('0x3'));var moment=require(_0x9c0f('0x4'));var BPromise=require(_0x9c0f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c0f('0x6'));var rimraf=require(_0x9c0f('0x7'));var config=require(_0x9c0f('0x8'));var attributes=require('./squareRecording.attributes');module[_0x9c0f('0x9')]=function(_0x18f28e,_0x2eab65){return _0x18f28e[_0x9c0f('0xa')]('SquareRecording',attributes,{'tableName':_0x9c0f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ce1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports','define','square_recordings'];(function(_0x205a28,_0x1fa8ab){var _0x10ba00=function(_0x30096f){while(--_0x30096f){_0x205a28['push'](_0x205a28['shift']());}};_0x10ba00(++_0x1fa8ab);}(_0x8ce1,0x152));var _0x18ce=function(_0x3e073a,_0x1a6fad){_0x3e073a=_0x3e073a-0x0;var _0x40c1f7=_0x8ce1[_0x3e073a];return _0x40c1f7;};'use strict';var _=require(_0x18ce('0x0'));var util=require(_0x18ce('0x1'));var logger=require(_0x18ce('0x2'))(_0x18ce('0x3'));var moment=require(_0x18ce('0x4'));var BPromise=require(_0x18ce('0x5'));var rp=require(_0x18ce('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x18ce('0x7'));var config=require(_0x18ce('0x8'));var attributes=require(_0x18ce('0x9'));module[_0x18ce('0xa')]=function(_0x532604,_0x17d12a){return _0x532604[_0x18ce('0xb')]('SquareRecording',attributes,{'tableName':_0x18ce('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 286b985..d19ce51 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 _0x9839=['../../config/environment','jayson/promise','client','http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareRecording','SquareRecording','create','body','options','then','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x9839,0x171));var _0x9983=function(_0x2973c8,_0x52a6c0){_0x2973c8=_0x2973c8-0x0;var _0x1bcc61=_0x9839[_0x2973c8];return _0x1bcc61;};'use strict';var _=require(_0x9983('0x0'));var util=require('util');var moment=require(_0x9983('0x1'));var BPromise=require(_0x9983('0x2'));var rs=require(_0x9983('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9983('0x4'))['db'];var utils=require(_0x9983('0x5'));var logger=require(_0x9983('0x6'))(_0x9983('0x7'));var config=require(_0x9983('0x8'));var jayson=require(_0x9983('0x9'));var client=jayson[_0x9983('0xa')][_0x9983('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57d5ea,_0x2232b4,_0x1397b2){return new BPromise(function(_0x465263,_0x469eb1){return client[_0x9983('0xc')](_0x57d5ea,_0x1397b2)['then'](function(_0x53e2d1){logger[_0x9983('0xd')](_0x9983('0xe'),_0x2232b4,_0x9983('0xf'));logger[_0x9983('0x10')](_0x9983('0x11'),_0x2232b4,_0x9983('0xf'),JSON[_0x9983('0x12')](_0x53e2d1));if(_0x53e2d1[_0x9983('0x13')]){if(_0x53e2d1[_0x9983('0x13')]['code']===0x1f4){logger[_0x9983('0x13')](_0x9983('0xe'),_0x2232b4,_0x53e2d1[_0x9983('0x13')][_0x9983('0x14')]);return _0x469eb1(_0x53e2d1[_0x9983('0x13')][_0x9983('0x14')]);}logger[_0x9983('0x13')](_0x9983('0xe'),_0x2232b4,_0x53e2d1['error']['message']);return _0x465263(_0x53e2d1[_0x9983('0x13')][_0x9983('0x14')]);}else{logger['info'](_0x9983('0xe'),_0x2232b4,_0x9983('0xf'));_0x465263(_0x53e2d1[_0x9983('0x15')][_0x9983('0x14')]);}})[_0x9983('0x16')](function(_0x2d64ec){logger[_0x9983('0x13')]('SquareRecording,\x20%s,\x20%s',_0x2232b4,_0x2d64ec);_0x469eb1(_0x2d64ec);});});}exports[_0x9983('0x17')]=function(_0x4f8cfa){var _0x12d0c5=this;return new Promise(function(_0x133bff,_0x320436){return db[_0x9983('0x18')][_0x9983('0x19')](_0x4f8cfa[_0x9983('0x1a')],{'raw':_0x4f8cfa[_0x9983('0x1b')]?_0x4f8cfa[_0x9983('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x9983('0x1c')](function(_0x4f5dac){logger['info'](_0x9983('0x17'),_0x4f8cfa);logger[_0x9983('0x10')](_0x9983('0x17'),_0x4f8cfa,JSON[_0x9983('0x12')](_0x4f5dac));_0x133bff(_0x4f5dac);})[_0x9983('0x16')](function(_0x52295d){logger[_0x9983('0x13')](_0x9983('0x17'),_0x52295d['message'],_0x4f8cfa);_0x320436(_0x12d0c5[_0x9983('0x13')](0x1f4,_0x52295d[_0x9983('0x14')]));});});}; \ No newline at end of file +var _0x5911=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','SquareRecording','create','body','options','CreateSquareRecording','lodash'];(function(_0x284b21,_0x1e95ec){var _0xde2265=function(_0x40d4c6){while(--_0x40d4c6){_0x284b21['push'](_0x284b21['shift']());}};_0xde2265(++_0x1e95ec);}(_0x5911,0x1bf));var _0x1591=function(_0x599e6b,_0x33bc56){_0x599e6b=_0x599e6b-0x0;var _0x32e01a=_0x5911[_0x599e6b];return _0x32e01a;};'use strict';var _=require(_0x1591('0x0'));var util=require('util');var moment=require(_0x1591('0x1'));var BPromise=require(_0x1591('0x2'));var rs=require(_0x1591('0x3'));var fs=require('fs');var Redis=require(_0x1591('0x4'));var db=require(_0x1591('0x5'))['db'];var utils=require(_0x1591('0x6'));var logger=require('../../config/logger')(_0x1591('0x7'));var config=require(_0x1591('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1591('0x9')][_0x1591('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46cfdf,_0x108fd5,_0x108484){return new BPromise(function(_0x5c628a,_0x48d7f5){return client[_0x1591('0xb')](_0x46cfdf,_0x108484)[_0x1591('0xc')](function(_0x3d8a9c){logger[_0x1591('0xd')](_0x1591('0xe'),_0x108fd5,_0x1591('0xf'));logger[_0x1591('0x10')](_0x1591('0x11'),_0x108fd5,_0x1591('0xf'),JSON[_0x1591('0x12')](_0x3d8a9c));if(_0x3d8a9c[_0x1591('0x13')]){if(_0x3d8a9c['error'][_0x1591('0x14')]===0x1f4){logger[_0x1591('0x13')](_0x1591('0xe'),_0x108fd5,_0x3d8a9c[_0x1591('0x13')][_0x1591('0x15')]);return _0x48d7f5(_0x3d8a9c['error'][_0x1591('0x15')]);}logger['error'](_0x1591('0xe'),_0x108fd5,_0x3d8a9c[_0x1591('0x13')]['message']);return _0x5c628a(_0x3d8a9c[_0x1591('0x13')][_0x1591('0x15')]);}else{logger[_0x1591('0xd')](_0x1591('0xe'),_0x108fd5,_0x1591('0xf'));_0x5c628a(_0x3d8a9c['result'][_0x1591('0x15')]);}})[_0x1591('0x16')](function(_0x5033df){logger[_0x1591('0x13')](_0x1591('0xe'),_0x108fd5,_0x5033df);_0x48d7f5(_0x5033df);});});}exports['CreateSquareRecording']=function(_0x4d491f){var _0x2e2529=this;return new Promise(function(_0x17d908,_0x325562){return db[_0x1591('0x17')][_0x1591('0x18')](_0x4d491f[_0x1591('0x19')],{'raw':_0x4d491f[_0x1591('0x1a')]?_0x4d491f[_0x1591('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3a3730){logger[_0x1591('0xd')](_0x1591('0x1b'),_0x4d491f);logger[_0x1591('0x10')](_0x1591('0x1b'),_0x4d491f,JSON['stringify'](_0x3a3730));_0x17d908(_0x3a3730);})['catch'](function(_0x32f6bd){logger[_0x1591('0x13')](_0x1591('0x1b'),_0x32f6bd[_0x1591('0x15')],_0x4d491f);_0x325562(_0x2e2529[_0x1591('0x13')](0x1f4,_0x32f6bd['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index d08ee2d..3fd6f91 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(_0x2d7d16,_0x24f25f){var _0x1456f6=function(_0x34d089){while(--_0x34d089){_0x2d7d16['push'](_0x2d7d16['shift']());}};_0x1456f6(++_0x24f25f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'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 _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(_0x480bc8,_0x1fac40){var _0x28c245=function(_0x22a049){while(--_0x22a049){_0x480bc8['push'](_0x480bc8['shift']());}};_0x28c245(++_0x1fac40);}(_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('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 7db7eef..2ac5984 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 _0x05d8=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x05d8,0xe5));var _0x805d=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x05d8[_0x485b5a];return _0xd2b34d;};'use strict';var Sequelize=require(_0x805d('0x0'));module[_0x805d('0x1')]={'network':{'type':Sequelize[_0x805d('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x805d('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x805d('0x2')]},'type':{'type':Sequelize[_0x805d('0x2')]},'uniqueid':{'type':Sequelize[_0x805d('0x2')]},'version':{'type':Sequelize[_0x805d('0x2')]},'callerid':{'type':Sequelize[_0x805d('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x805d('0x2')]},'callingani2':{'type':Sequelize[_0x805d('0x2')]},'callington':{'type':Sequelize[_0x805d('0x2')]},'callingtns':{'type':Sequelize[_0x805d('0x2')]},'dnid':{'type':Sequelize[_0x805d('0x2')]},'rdnis':{'type':Sequelize[_0x805d('0x2')]},'context':{'type':Sequelize[_0x805d('0x2')]},'extension':{'type':Sequelize[_0x805d('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x805d('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x805d('0x2')]},'project_name':{'type':Sequelize[_0x805d('0x2')]},'joinAt':{'type':Sequelize[_0x805d('0x3')]},'leaveAt':{'type':Sequelize[_0x805d('0x3')]},'bot':{'type':Sequelize[_0x805d('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x75d4=['DATE','sequelize','exports','STRING'];(function(_0x178856,_0x41f045){var _0x3c7fe7=function(_0x4d9ce4){while(--_0x4d9ce4){_0x178856['push'](_0x178856['shift']());}};_0x3c7fe7(++_0x41f045);}(_0x75d4,0x169));var _0x475d=function(_0x314cff,_0x20a36a){_0x314cff=_0x314cff-0x0;var _0xb50bc5=_0x75d4[_0x314cff];return _0xb50bc5;};'use strict';var Sequelize=require(_0x475d('0x0'));module[_0x475d('0x1')]={'network':{'type':Sequelize[_0x475d('0x2')]},'network_script':{'type':Sequelize[_0x475d('0x2')]},'request':{'type':Sequelize[_0x475d('0x2')]},'channel':{'type':Sequelize[_0x475d('0x2')]},'language':{'type':Sequelize[_0x475d('0x2')]},'type':{'type':Sequelize[_0x475d('0x2')]},'uniqueid':{'type':Sequelize[_0x475d('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x475d('0x2')]},'callingpres':{'type':Sequelize[_0x475d('0x2')]},'callingani2':{'type':Sequelize[_0x475d('0x2')]},'callington':{'type':Sequelize[_0x475d('0x2')]},'callingtns':{'type':Sequelize[_0x475d('0x2')]},'dnid':{'type':Sequelize[_0x475d('0x2')]},'rdnis':{'type':Sequelize[_0x475d('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x475d('0x2')]},'priority':{'type':Sequelize[_0x475d('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x475d('0x2')]},'project_name':{'type':Sequelize[_0x475d('0x2')]},'joinAt':{'type':Sequelize[_0x475d('0x3')]},'leaveAt':{'type':Sequelize[_0x475d('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index d6628ec..4fe3dc1 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 _0x6c6d=['params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','end','stack','name','map','SquareReport','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','catch','show'];(function(_0x33a432,_0x1acced){var _0x45bd47=function(_0x215360){while(--_0x215360){_0x33a432['push'](_0x33a432['shift']());}};_0x45bd47(++_0x1acced);}(_0x6c6d,0x97));var _0xd6c6=function(_0x184293,_0x3f3335){_0x184293=_0x184293-0x0;var _0x2d0caa=_0x6c6d[_0x184293];return _0x2d0caa;};'use strict';var emlformat=require(_0xd6c6('0x0'));var rimraf=require(_0xd6c6('0x1'));var zipdir=require(_0xd6c6('0x2'));var jsonpatch=require(_0xd6c6('0x3'));var rp=require(_0xd6c6('0x4'));var moment=require(_0xd6c6('0x5'));var BPromise=require(_0xd6c6('0x6'));var Mustache=require('mustache');var util=require(_0xd6c6('0x7'));var path=require(_0xd6c6('0x8'));var sox=require(_0xd6c6('0x9'));var csv=require(_0xd6c6('0xa'));var ejs=require(_0xd6c6('0xb'));var fs=require('fs');var fs_extra=require(_0xd6c6('0xc'));var _=require(_0xd6c6('0xd'));var squel=require(_0xd6c6('0xe'));var crypto=require('crypto');var jsforce=require(_0xd6c6('0xf'));var deskjs=require(_0xd6c6('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd6c6('0x11'));var authService=require(_0xd6c6('0x12'));var qs=require(_0xd6c6('0x13'));var as=require(_0xd6c6('0x14'));var hardwareService=require(_0xd6c6('0x15'));var logger=require('../../config/logger')(_0xd6c6('0x16'));var utils=require('../../config/utils');var config=require(_0xd6c6('0x17'));var licenseUtil=require(_0xd6c6('0x18'));var db=require(_0xd6c6('0x19'))['db'];function respondWithStatusCode(_0x5877b5,_0x58487f){_0x58487f=_0x58487f||0xcc;return function(_0x4139e4){if(_0x4139e4){return _0x5877b5[_0xd6c6('0x1a')](_0x58487f);}return _0x5877b5[_0xd6c6('0x1b')](_0x58487f)['end']();};}function respondWithResult(_0x1dc8b3,_0x4c513e){_0x4c513e=_0x4c513e||0xc8;return function(_0x6b0351){if(_0x6b0351){return _0x1dc8b3[_0xd6c6('0x1b')](_0x4c513e)[_0xd6c6('0x1c')](_0x6b0351);}};}function respondWithFilteredResult(_0x380bad,_0x18ec51){return function(_0x1681fc){if(_0x1681fc){var _0x1793c6=typeof _0x18ec51[_0xd6c6('0x1d')]===_0xd6c6('0x1e')&&typeof _0x18ec51[_0xd6c6('0x1f')]===_0xd6c6('0x1e');var _0xc3b5aa=_0x1681fc['count'];var _0x10fa30=_0x1793c6?0x0:_0x18ec51[_0xd6c6('0x1d')];var _0x2b2d0f=_0x1793c6?_0x1681fc[_0xd6c6('0x20')]:_0x18ec51['offset']+_0x18ec51[_0xd6c6('0x1f')];var _0x11771;if(_0x2b2d0f>=_0xc3b5aa){_0x2b2d0f=_0xc3b5aa;_0x11771=0xc8;}else{_0x11771=0xce;}_0x380bad[_0xd6c6('0x1b')](_0x11771);return _0x380bad[_0xd6c6('0x21')](_0xd6c6('0x22'),_0x10fa30+'-'+_0x2b2d0f+'/'+_0xc3b5aa)['json'](_0x1681fc);}return null;};}function patchUpdates(_0x5822b5){return function(_0x1754ea){try{jsonpatch[_0xd6c6('0x23')](_0x1754ea,_0x5822b5,!![]);}catch(_0x21a493){return BPromise['reject'](_0x21a493);}return _0x1754ea['save']();};}function saveUpdates(_0x56728f,_0x1be071){return function(_0x466866){if(_0x466866){return _0x466866[_0xd6c6('0x24')](_0x56728f)[_0xd6c6('0x25')](function(_0x26c9d9){return _0x26c9d9;});}return null;};}function removeEntity(_0x6aaf42,_0x31e71b){return function(_0x873747){if(_0x873747){return _0x873747[_0xd6c6('0x26')]()[_0xd6c6('0x25')](function(){_0x6aaf42[_0xd6c6('0x1b')](0xcc)[_0xd6c6('0x27')]();});}};}function handleEntityNotFound(_0x34a67d,_0xda8358){return function(_0x36e5dd){if(!_0x36e5dd){_0x34a67d[_0xd6c6('0x1a')](0x194);}return _0x36e5dd;};}function handleError(_0x52eab7,_0x263ea1){_0x263ea1=_0x263ea1||0x1f4;return function(_0x540d2b){logger['error'](_0x540d2b[_0xd6c6('0x28')]);if(_0x540d2b['name']){delete _0x540d2b[_0xd6c6('0x29')];}_0x52eab7[_0xd6c6('0x1b')](_0x263ea1)['send'](_0x540d2b);};}exports['index']=function(_0x10c6ba,_0x21e8a0){var _0x231b82={},_0x4988c5={},_0x2ed4a6={'count':0x0,'rows':[]};var _0x825e4e=_[_0xd6c6('0x2a')](db[_0xd6c6('0x2b')][_0xd6c6('0x2c')],function(_0x4a73e3){return{'name':_0x4a73e3[_0xd6c6('0x2d')],'type':_0x4a73e3['type']['key']};});_0x4988c5[_0xd6c6('0x2e')]=_[_0xd6c6('0x2a')](_0x825e4e,_0xd6c6('0x29'));_0x4988c5[_0xd6c6('0x2f')]=_[_0xd6c6('0x30')](_0x10c6ba['query']);_0x4988c5[_0xd6c6('0x31')]=_[_0xd6c6('0x32')](_0x4988c5[_0xd6c6('0x2e')],_0x4988c5[_0xd6c6('0x2f')]);_0x231b82['attributes']=_[_0xd6c6('0x32')](_0x4988c5[_0xd6c6('0x2e')],qs[_0xd6c6('0x33')](_0x10c6ba[_0xd6c6('0x2f')][_0xd6c6('0x33')]));_0x231b82[_0xd6c6('0x34')]=_0x231b82['attributes'][_0xd6c6('0x35')]?_0x231b82[_0xd6c6('0x34')]:_0x4988c5[_0xd6c6('0x2e')];if(!_0x10c6ba[_0xd6c6('0x2f')][_0xd6c6('0x36')](_0xd6c6('0x37'))){_0x231b82['limit']=qs[_0xd6c6('0x1f')](_0x10c6ba[_0xd6c6('0x2f')][_0xd6c6('0x1f')]);_0x231b82['offset']=qs[_0xd6c6('0x1d')](_0x10c6ba[_0xd6c6('0x2f')][_0xd6c6('0x1d')]);}_0x231b82[_0xd6c6('0x38')]=qs[_0xd6c6('0x39')](_0x10c6ba[_0xd6c6('0x2f')][_0xd6c6('0x39')]);_0x231b82[_0xd6c6('0x3a')]=qs['filters'](_[_0xd6c6('0x3b')](_0x10c6ba[_0xd6c6('0x2f')],_0x4988c5[_0xd6c6('0x31')]),_0x825e4e);if(_0x10c6ba[_0xd6c6('0x2f')][_0xd6c6('0x3c')]){_0x231b82[_0xd6c6('0x3a')]=_[_0xd6c6('0x3d')](_0x231b82['where'],{'$or':_['map'](_0x825e4e,function(_0x489696){if(_0x489696[_0xd6c6('0x3e')]!=='VIRTUAL'){var _0x16eab0={};_0x16eab0[_0x489696['name']]={'$like':'%'+_0x10c6ba[_0xd6c6('0x2f')][_0xd6c6('0x3c')]+'%'};return _0x16eab0;}})});}_0x231b82=_['merge']({},_0x231b82,_0x10c6ba[_0xd6c6('0x3f')]);var _0x3478a5={'where':_0x231b82[_0xd6c6('0x3a')]};return db[_0xd6c6('0x2b')][_0xd6c6('0x20')](_0x3478a5)[_0xd6c6('0x25')](function(_0x4c2e85){_0x2ed4a6['count']=_0x4c2e85;if(_0x10c6ba[_0xd6c6('0x2f')][_0xd6c6('0x40')]){_0x231b82[_0xd6c6('0x41')]=[{'all':!![]}];}return db[_0xd6c6('0x2b')]['findAll'](_0x231b82);})[_0xd6c6('0x25')](function(_0x52f691){_0x2ed4a6['rows']=_0x52f691;return _0x2ed4a6;})[_0xd6c6('0x25')](respondWithFilteredResult(_0x21e8a0,_0x231b82))[_0xd6c6('0x42')](handleError(_0x21e8a0,null));};exports[_0xd6c6('0x43')]=function(_0x142c77,_0x290435){var _0xe32cf4={'raw':!![],'where':{'id':_0x142c77[_0xd6c6('0x44')]['id']}},_0x2d1b73={};_0x2d1b73[_0xd6c6('0x2e')]=_[_0xd6c6('0x30')](db[_0xd6c6('0x2b')]['rawAttributes']);_0x2d1b73[_0xd6c6('0x2f')]=_[_0xd6c6('0x30')](_0x142c77[_0xd6c6('0x2f')]);_0x2d1b73['filters']=_[_0xd6c6('0x32')](_0x2d1b73[_0xd6c6('0x2e')],_0x2d1b73[_0xd6c6('0x2f')]);_0xe32cf4[_0xd6c6('0x34')]=_[_0xd6c6('0x32')](_0x2d1b73['model'],qs[_0xd6c6('0x33')](_0x142c77[_0xd6c6('0x2f')][_0xd6c6('0x33')]));_0xe32cf4[_0xd6c6('0x34')]=_0xe32cf4[_0xd6c6('0x34')][_0xd6c6('0x35')]?_0xe32cf4['attributes']:_0x2d1b73[_0xd6c6('0x2e')];if(_0x142c77[_0xd6c6('0x2f')][_0xd6c6('0x40')]){_0xe32cf4['include']=[{'all':!![]}];}_0xe32cf4=_[_0xd6c6('0x3d')]({},_0xe32cf4,_0x142c77['options']);return db[_0xd6c6('0x2b')][_0xd6c6('0x45')](_0xe32cf4)[_0xd6c6('0x25')](handleEntityNotFound(_0x290435,null))[_0xd6c6('0x25')](respondWithResult(_0x290435,null))[_0xd6c6('0x42')](handleError(_0x290435,null));};exports[_0xd6c6('0x46')]=function(_0x531cad,_0x4123e9){return db[_0xd6c6('0x2b')][_0xd6c6('0x46')](_0x531cad[_0xd6c6('0x47')],{})[_0xd6c6('0x25')](respondWithResult(_0x4123e9,0xc9))[_0xd6c6('0x42')](handleError(_0x4123e9,null));};exports[_0xd6c6('0x24')]=function(_0x217ac3,_0x30379d){if(_0x217ac3[_0xd6c6('0x47')]['id']){delete _0x217ac3[_0xd6c6('0x47')]['id'];}return db[_0xd6c6('0x2b')][_0xd6c6('0x45')]({'where':{'id':_0x217ac3[_0xd6c6('0x44')]['id']}})[_0xd6c6('0x25')](handleEntityNotFound(_0x30379d,null))[_0xd6c6('0x25')](saveUpdates(_0x217ac3[_0xd6c6('0x47')],null))[_0xd6c6('0x25')](respondWithResult(_0x30379d,null))['catch'](handleError(_0x30379d,null));};exports[_0xd6c6('0x26')]=function(_0x493f98,_0xba0cd1){return db[_0xd6c6('0x2b')]['find']({'where':{'id':_0x493f98[_0xd6c6('0x44')]['id']}})[_0xd6c6('0x25')](handleEntityNotFound(_0xba0cd1,null))[_0xd6c6('0x25')](removeEntity(_0xba0cd1,null))['catch'](handleError(_0xba0cd1,null));};exports['describe']=function(_0x5e23c0,_0x20d716){return db[_0xd6c6('0x2b')][_0xd6c6('0x48')]()[_0xd6c6('0x25')](respondWithResult(_0x20d716,null))['catch'](handleError(_0x20d716,null));}; \ No newline at end of file +var _0x8511=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','SquareReport','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','fieldName','type','key','model','keys','query','filters','intersection'];(function(_0x3494e8,_0x4111ea){var _0x20bd8c=function(_0x2f8fcd){while(--_0x2f8fcd){_0x3494e8['push'](_0x3494e8['shift']());}};_0x20bd8c(++_0x4111ea);}(_0x8511,0x102));var _0x1851=function(_0xae2acd,_0x2a0481){_0xae2acd=_0xae2acd-0x0;var _0x3e3307=_0x8511[_0xae2acd];return _0x3e3307;};'use strict';var emlformat=require(_0x1851('0x0'));var rimraf=require(_0x1851('0x1'));var zipdir=require(_0x1851('0x2'));var jsonpatch=require(_0x1851('0x3'));var rp=require(_0x1851('0x4'));var moment=require(_0x1851('0x5'));var BPromise=require(_0x1851('0x6'));var Mustache=require('mustache');var util=require(_0x1851('0x7'));var path=require(_0x1851('0x8'));var sox=require('sox');var csv=require(_0x1851('0x9'));var ejs=require(_0x1851('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1851('0xb'));var squel=require(_0x1851('0xc'));var crypto=require(_0x1851('0xd'));var jsforce=require(_0x1851('0xe'));var deskjs=require(_0x1851('0xf'));var toCsv=require(_0x1851('0x9'));var querystring=require(_0x1851('0x10'));var Papa=require(_0x1851('0x11'));var Redis=require('ioredis');var authService=require(_0x1851('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1851('0x13'));var hardwareService=require(_0x1851('0x14'));var logger=require(_0x1851('0x15'))('api');var utils=require(_0x1851('0x16'));var config=require(_0x1851('0x17'));var licenseUtil=require(_0x1851('0x18'));var db=require(_0x1851('0x19'))['db'];function respondWithStatusCode(_0x480ae6,_0x3b8fe3){_0x3b8fe3=_0x3b8fe3||0xcc;return function(_0x238c61){if(_0x238c61){return _0x480ae6[_0x1851('0x1a')](_0x3b8fe3);}return _0x480ae6[_0x1851('0x1b')](_0x3b8fe3)[_0x1851('0x1c')]();};}function respondWithResult(_0x36a974,_0x238ba7){_0x238ba7=_0x238ba7||0xc8;return function(_0x5c96a5){if(_0x5c96a5){return _0x36a974[_0x1851('0x1b')](_0x238ba7)[_0x1851('0x1d')](_0x5c96a5);}};}function respondWithFilteredResult(_0x25abbe,_0x4e060d){return function(_0x4d1f50){if(_0x4d1f50){var _0x8d2b84=typeof _0x4e060d[_0x1851('0x1e')]===_0x1851('0x1f')&&typeof _0x4e060d[_0x1851('0x20')]===_0x1851('0x1f');var _0x80aa80=_0x4d1f50[_0x1851('0x21')];var _0x1a1462=_0x8d2b84?0x0:_0x4e060d[_0x1851('0x1e')];var _0x24272b=_0x8d2b84?_0x4d1f50['count']:_0x4e060d[_0x1851('0x1e')]+_0x4e060d[_0x1851('0x20')];var _0x15d4f2;if(_0x24272b>=_0x80aa80){_0x24272b=_0x80aa80;_0x15d4f2=0xc8;}else{_0x15d4f2=0xce;}_0x25abbe[_0x1851('0x1b')](_0x15d4f2);return _0x25abbe[_0x1851('0x22')](_0x1851('0x23'),_0x1a1462+'-'+_0x24272b+'/'+_0x80aa80)['json'](_0x4d1f50);}return null;};}function patchUpdates(_0x83a5ed){return function(_0xe4ab06){try{jsonpatch[_0x1851('0x24')](_0xe4ab06,_0x83a5ed,!![]);}catch(_0x23165d){return BPromise[_0x1851('0x25')](_0x23165d);}return _0xe4ab06[_0x1851('0x26')]();};}function saveUpdates(_0x59bd26,_0x415acd){return function(_0x9ba0d4){if(_0x9ba0d4){return _0x9ba0d4[_0x1851('0x27')](_0x59bd26)[_0x1851('0x28')](function(_0x4e1c1c){return _0x4e1c1c;});}return null;};}function removeEntity(_0x57c8e0,_0x474143){return function(_0x330ba1){if(_0x330ba1){return _0x330ba1[_0x1851('0x29')]()[_0x1851('0x28')](function(){_0x57c8e0[_0x1851('0x1b')](0xcc)[_0x1851('0x1c')]();});}};}function handleEntityNotFound(_0x22184a,_0x50c692){return function(_0x259891){if(!_0x259891){_0x22184a[_0x1851('0x1a')](0x194);}return _0x259891;};}function handleError(_0x1517fa,_0x590a2a){_0x590a2a=_0x590a2a||0x1f4;return function(_0x292732){logger['error'](_0x292732[_0x1851('0x2a')]);if(_0x292732[_0x1851('0x2b')]){delete _0x292732[_0x1851('0x2b')];}_0x1517fa[_0x1851('0x1b')](_0x590a2a)['send'](_0x292732);};}exports[_0x1851('0x2c')]=function(_0x2f0db1,_0x451ecb){var _0x1728aa={},_0x4cfeb7={},_0x40a743={'count':0x0,'rows':[]};var _0x2af52a=_[_0x1851('0x2d')](db['SquareReport']['rawAttributes'],function(_0x407169){return{'name':_0x407169[_0x1851('0x2e')],'type':_0x407169[_0x1851('0x2f')][_0x1851('0x30')]};});_0x4cfeb7[_0x1851('0x31')]=_['map'](_0x2af52a,_0x1851('0x2b'));_0x4cfeb7['query']=_[_0x1851('0x32')](_0x2f0db1[_0x1851('0x33')]);_0x4cfeb7[_0x1851('0x34')]=_[_0x1851('0x35')](_0x4cfeb7[_0x1851('0x31')],_0x4cfeb7[_0x1851('0x33')]);_0x1728aa['attributes']=_['intersection'](_0x4cfeb7[_0x1851('0x31')],qs['fields'](_0x2f0db1[_0x1851('0x33')][_0x1851('0x36')]));_0x1728aa[_0x1851('0x37')]=_0x1728aa[_0x1851('0x37')][_0x1851('0x38')]?_0x1728aa['attributes']:_0x4cfeb7[_0x1851('0x31')];if(!_0x2f0db1['query'][_0x1851('0x39')](_0x1851('0x3a'))){_0x1728aa[_0x1851('0x20')]=qs['limit'](_0x2f0db1[_0x1851('0x33')][_0x1851('0x20')]);_0x1728aa[_0x1851('0x1e')]=qs[_0x1851('0x1e')](_0x2f0db1[_0x1851('0x33')][_0x1851('0x1e')]);}_0x1728aa[_0x1851('0x3b')]=qs['sort'](_0x2f0db1['query'][_0x1851('0x3c')]);_0x1728aa[_0x1851('0x3d')]=qs[_0x1851('0x34')](_['pick'](_0x2f0db1[_0x1851('0x33')],_0x4cfeb7['filters']),_0x2af52a);if(_0x2f0db1[_0x1851('0x33')][_0x1851('0x3e')]){_0x1728aa[_0x1851('0x3d')]=_['merge'](_0x1728aa['where'],{'$or':_['map'](_0x2af52a,function(_0xd026f4){if(_0xd026f4[_0x1851('0x2f')]!==_0x1851('0x3f')){var _0x5770e1={};_0x5770e1[_0xd026f4[_0x1851('0x2b')]]={'$like':'%'+_0x2f0db1[_0x1851('0x33')][_0x1851('0x3e')]+'%'};return _0x5770e1;}})});}_0x1728aa=_[_0x1851('0x40')]({},_0x1728aa,_0x2f0db1['options']);var _0x2d7778={'where':_0x1728aa[_0x1851('0x3d')]};return db[_0x1851('0x41')][_0x1851('0x21')](_0x2d7778)[_0x1851('0x28')](function(_0x58eaee){_0x40a743['count']=_0x58eaee;if(_0x2f0db1[_0x1851('0x33')][_0x1851('0x42')]){_0x1728aa[_0x1851('0x43')]=[{'all':!![]}];}return db[_0x1851('0x41')][_0x1851('0x44')](_0x1728aa);})[_0x1851('0x28')](function(_0xa2609a){_0x40a743[_0x1851('0x45')]=_0xa2609a;return _0x40a743;})['then'](respondWithFilteredResult(_0x451ecb,_0x1728aa))[_0x1851('0x46')](handleError(_0x451ecb,null));};exports[_0x1851('0x47')]=function(_0x1bb911,_0x1bc704){var _0x5a229e={'raw':!![],'where':{'id':_0x1bb911[_0x1851('0x48')]['id']}},_0x45f2c3={};_0x45f2c3[_0x1851('0x31')]=_[_0x1851('0x32')](db[_0x1851('0x41')]['rawAttributes']);_0x45f2c3[_0x1851('0x33')]=_[_0x1851('0x32')](_0x1bb911['query']);_0x45f2c3['filters']=_['intersection'](_0x45f2c3[_0x1851('0x31')],_0x45f2c3[_0x1851('0x33')]);_0x5a229e[_0x1851('0x37')]=_[_0x1851('0x35')](_0x45f2c3[_0x1851('0x31')],qs[_0x1851('0x36')](_0x1bb911[_0x1851('0x33')][_0x1851('0x36')]));_0x5a229e[_0x1851('0x37')]=_0x5a229e[_0x1851('0x37')][_0x1851('0x38')]?_0x5a229e[_0x1851('0x37')]:_0x45f2c3['model'];if(_0x1bb911['query']['includeAll']){_0x5a229e['include']=[{'all':!![]}];}_0x5a229e=_[_0x1851('0x40')]({},_0x5a229e,_0x1bb911[_0x1851('0x49')]);return db['SquareReport']['find'](_0x5a229e)[_0x1851('0x28')](handleEntityNotFound(_0x1bc704,null))[_0x1851('0x28')](respondWithResult(_0x1bc704,null))[_0x1851('0x46')](handleError(_0x1bc704,null));};exports[_0x1851('0x4a')]=function(_0x3a7058,_0x166e7a){return db[_0x1851('0x41')]['create'](_0x3a7058[_0x1851('0x4b')],{})['then'](respondWithResult(_0x166e7a,0xc9))[_0x1851('0x46')](handleError(_0x166e7a,null));};exports[_0x1851('0x27')]=function(_0x47e194,_0x2dfcd0){if(_0x47e194['body']['id']){delete _0x47e194['body']['id'];}return db[_0x1851('0x41')][_0x1851('0x4c')]({'where':{'id':_0x47e194['params']['id']}})['then'](handleEntityNotFound(_0x2dfcd0,null))[_0x1851('0x28')](saveUpdates(_0x47e194[_0x1851('0x4b')],null))[_0x1851('0x28')](respondWithResult(_0x2dfcd0,null))[_0x1851('0x46')](handleError(_0x2dfcd0,null));};exports['destroy']=function(_0x318a0b,_0x328c72){return db['SquareReport'][_0x1851('0x4c')]({'where':{'id':_0x318a0b['params']['id']}})[_0x1851('0x28')](handleEntityNotFound(_0x328c72,null))[_0x1851('0x28')](removeEntity(_0x328c72,null))[_0x1851('0x46')](handleError(_0x328c72,null));};exports[_0x1851('0x4d')]=function(_0x4a36c8,_0x5d9d37){return db[_0x1851('0x41')]['describe']()[_0x1851('0x28')](respondWithResult(_0x5d9d37,null))[_0x1851('0x46')](handleError(_0x5d9d37,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 97cb56d..686cdf4 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 _0x5009=['moment','bluebird','request-promise','path','./squareReport.attributes','exports','define','SquareReport','report_square','uniqueid','project_name','leaveAt','../../config/logger'];(function(_0x32d6c1,_0x37b30a){var _0x183417=function(_0x15a9a2){while(--_0x15a9a2){_0x32d6c1['push'](_0x32d6c1['shift']());}};_0x183417(++_0x37b30a);}(_0x5009,0x110));var _0x9500=function(_0x3bce0e,_0x1b0739){_0x3bce0e=_0x3bce0e-0x0;var _0x439248=_0x5009[_0x3bce0e];return _0x439248;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9500('0x0'))('api');var moment=require(_0x9500('0x1'));var BPromise=require(_0x9500('0x2'));var rp=require(_0x9500('0x3'));var fs=require('fs');var path=require(_0x9500('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9500('0x5'));module[_0x9500('0x6')]=function(_0x489f2d,_0x389f39){return _0x489f2d[_0x9500('0x7')](_0x9500('0x8'),attributes,{'tableName':_0x9500('0x9'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x9500('0xa'),_0x9500('0xb')]},{'name':_0x9500('0xc'),'fields':[_0x9500('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2f34=['../../config/environment','./squareReport.attributes','exports','define','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','rimraf'];(function(_0x4ba17b,_0x55f724){var _0x1f0669=function(_0x424ce2){while(--_0x424ce2){_0x4ba17b['push'](_0x4ba17b['shift']());}};_0x1f0669(++_0x55f724);}(_0x2f34,0x1a9));var _0x42f3=function(_0x30c649,_0x2ebbac){_0x30c649=_0x30c649-0x0;var _0x3edfb9=_0x2f34[_0x30c649];return _0x3edfb9;};'use strict';var _=require(_0x42f3('0x0'));var util=require(_0x42f3('0x1'));var logger=require(_0x42f3('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x42f3('0x3'));var config=require(_0x42f3('0x4'));var attributes=require(_0x42f3('0x5'));module[_0x42f3('0x6')]=function(_0x11c0f0,_0x48c76e){return _0x11c0f0[_0x42f3('0x7')]('SquareReport',attributes,{'tableName':_0x42f3('0x8'),'paranoid':![],'indexes':[{'name':_0x42f3('0x9'),'fields':[_0x42f3('0xa'),_0x42f3('0xb')]},{'name':_0x42f3('0xc'),'fields':[_0x42f3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index a3cc205..d40e0e8 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 _0x2c74=['code','message','result','catch','CreateSquareReport','SquareReport','body','options','raw','then','debug','UpdateSquareReport','update','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','error'];(function(_0xabc1bc,_0x4ac8ba){var _0x33654b=function(_0x49ab46){while(--_0x49ab46){_0xabc1bc['push'](_0xabc1bc['shift']());}};_0x33654b(++_0x4ac8ba);}(_0x2c74,0x19c));var _0x42c7=function(_0x49a354,_0x5297d4){_0x49a354=_0x49a354-0x0;var _0x4cdf0b=_0x2c74[_0x49a354];return _0x4cdf0b;};'use strict';var _=require(_0x42c7('0x0'));var util=require(_0x42c7('0x1'));var moment=require(_0x42c7('0x2'));var BPromise=require('bluebird');var rs=require(_0x42c7('0x3'));var fs=require('fs');var Redis=require(_0x42c7('0x4'));var db=require(_0x42c7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x42c7('0x6'))(_0x42c7('0x7'));var config=require(_0x42c7('0x8'));var jayson=require(_0x42c7('0x9'));var client=jayson[_0x42c7('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x170b3b,_0x463173,_0x277110){return new BPromise(function(_0x2a5bc4,_0x27ffa9){return client[_0x42c7('0xb')](_0x170b3b,_0x277110)['then'](function(_0x5ae4af){logger[_0x42c7('0xc')](_0x42c7('0xd'),_0x463173,_0x42c7('0xe'));logger['debug'](_0x42c7('0xf'),_0x463173,_0x42c7('0xe'),JSON['stringify'](_0x5ae4af));if(_0x5ae4af[_0x42c7('0x10')]){if(_0x5ae4af[_0x42c7('0x10')][_0x42c7('0x11')]===0x1f4){logger[_0x42c7('0x10')](_0x42c7('0xd'),_0x463173,_0x5ae4af[_0x42c7('0x10')][_0x42c7('0x12')]);return _0x27ffa9(_0x5ae4af[_0x42c7('0x10')][_0x42c7('0x12')]);}logger[_0x42c7('0x10')](_0x42c7('0xd'),_0x463173,_0x5ae4af['error'][_0x42c7('0x12')]);return _0x2a5bc4(_0x5ae4af[_0x42c7('0x10')][_0x42c7('0x12')]);}else{logger[_0x42c7('0xc')]('SquareReport,\x20%s,\x20%s',_0x463173,_0x42c7('0xe'));_0x2a5bc4(_0x5ae4af[_0x42c7('0x13')][_0x42c7('0x12')]);}})[_0x42c7('0x14')](function(_0x32a8b5){logger[_0x42c7('0x10')](_0x42c7('0xd'),_0x463173,_0x32a8b5);_0x27ffa9(_0x32a8b5);});});}exports[_0x42c7('0x15')]=function(_0x298118){var _0x2f211d=this;return new Promise(function(_0x2b8bbc,_0x1773b7){return db[_0x42c7('0x16')]['create'](_0x298118[_0x42c7('0x17')],{'raw':_0x298118['options']?_0x298118[_0x42c7('0x18')][_0x42c7('0x19')]===undefined?!![]:![]:!![]})[_0x42c7('0x1a')](function(_0xd1ffd0){logger[_0x42c7('0xc')](_0x42c7('0x15'),_0x298118);logger[_0x42c7('0x1b')](_0x42c7('0x15'),_0x298118,JSON['stringify'](_0xd1ffd0));_0x2b8bbc(_0xd1ffd0);})['catch'](function(_0x534f40){logger[_0x42c7('0x10')](_0x42c7('0x15'),_0x534f40[_0x42c7('0x12')],_0x298118);_0x1773b7(_0x2f211d[_0x42c7('0x10')](0x1f4,_0x534f40[_0x42c7('0x12')]));});});};exports[_0x42c7('0x1c')]=function(_0x189ba6){var _0x3cef09=this;return new Promise(function(_0x3fb6f2,_0x50df00){return db[_0x42c7('0x16')][_0x42c7('0x1d')](_0x189ba6[_0x42c7('0x17')],{'raw':_0x189ba6['options']?_0x189ba6[_0x42c7('0x18')][_0x42c7('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x189ba6[_0x42c7('0x18')]?_0x189ba6['options'][_0x42c7('0x1e')]||null:null,'attributes':_0x189ba6['options']?_0x189ba6[_0x42c7('0x18')][_0x42c7('0x1f')]||null:null,'limit':_0x189ba6['options']?_0x189ba6[_0x42c7('0x18')][_0x42c7('0x20')]||null:null})[_0x42c7('0x1a')](function(_0x25150a){logger[_0x42c7('0xc')](_0x42c7('0x1c'),_0x189ba6);logger[_0x42c7('0x1b')](_0x42c7('0x1c'),_0x189ba6,JSON['stringify'](_0x25150a));_0x3fb6f2(_0x25150a);})[_0x42c7('0x14')](function(_0x2405d3){logger[_0x42c7('0x10')]('UpdateSquareReport',_0x2405d3[_0x42c7('0x12')],_0x189ba6);_0x50df00(_0x3cef09['error'](0x1f4,_0x2405d3[_0x42c7('0x12')]));});});}; \ No newline at end of file +var _0x8517=['debug','stringify','error','message','result','SquareReport','body','options','raw','CreateSquareReport','catch','UpdateSquareReport','update','where','attributes','lodash','util','ioredis','../../mysqldb','rpc','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent'];(function(_0x356127,_0x4873ac){var _0x5d4c75=function(_0x4fe60c){while(--_0x4fe60c){_0x356127['push'](_0x356127['shift']());}};_0x5d4c75(++_0x4873ac);}(_0x8517,0x138));var _0x7851=function(_0x24931b,_0x54f6bb){_0x24931b=_0x24931b-0x0;var _0x2bd66f=_0x8517[_0x24931b];return _0x2bd66f;};'use strict';var _=require(_0x7851('0x0'));var util=require(_0x7851('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7851('0x2'));var db=require(_0x7851('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7851('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7851('0x5')][_0x7851('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x310097,_0x1b4f53,_0x57b86b){return new BPromise(function(_0xb25cf9,_0x131181){return client[_0x7851('0x7')](_0x310097,_0x57b86b)[_0x7851('0x8')](function(_0x595345){logger[_0x7851('0x9')](_0x7851('0xa'),_0x1b4f53,_0x7851('0xb'));logger[_0x7851('0xc')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x1b4f53,_0x7851('0xb'),JSON[_0x7851('0xd')](_0x595345));if(_0x595345[_0x7851('0xe')]){if(_0x595345[_0x7851('0xe')]['code']===0x1f4){logger['error'](_0x7851('0xa'),_0x1b4f53,_0x595345['error'][_0x7851('0xf')]);return _0x131181(_0x595345[_0x7851('0xe')][_0x7851('0xf')]);}logger[_0x7851('0xe')](_0x7851('0xa'),_0x1b4f53,_0x595345[_0x7851('0xe')][_0x7851('0xf')]);return _0xb25cf9(_0x595345[_0x7851('0xe')][_0x7851('0xf')]);}else{logger[_0x7851('0x9')]('SquareReport,\x20%s,\x20%s',_0x1b4f53,'request\x20sent');_0xb25cf9(_0x595345[_0x7851('0x10')]['message']);}})['catch'](function(_0x29d609){logger[_0x7851('0xe')]('SquareReport,\x20%s,\x20%s',_0x1b4f53,_0x29d609);_0x131181(_0x29d609);});});}exports['CreateSquareReport']=function(_0x309fa0){var _0x351995=this;return new Promise(function(_0x5bf919,_0x24bfd5){return db[_0x7851('0x11')]['create'](_0x309fa0[_0x7851('0x12')],{'raw':_0x309fa0[_0x7851('0x13')]?_0x309fa0[_0x7851('0x13')][_0x7851('0x14')]===undefined?!![]:![]:!![]})[_0x7851('0x8')](function(_0x2b6151){logger[_0x7851('0x9')](_0x7851('0x15'),_0x309fa0);logger['debug'](_0x7851('0x15'),_0x309fa0,JSON[_0x7851('0xd')](_0x2b6151));_0x5bf919(_0x2b6151);})[_0x7851('0x16')](function(_0x244986){logger[_0x7851('0xe')](_0x7851('0x15'),_0x244986[_0x7851('0xf')],_0x309fa0);_0x24bfd5(_0x351995[_0x7851('0xe')](0x1f4,_0x244986['message']));});});};exports[_0x7851('0x17')]=function(_0x586350){var _0x255c06=this;return new Promise(function(_0x180c69,_0x44b02c){return db['SquareReport'][_0x7851('0x18')](_0x586350[_0x7851('0x12')],{'raw':_0x586350[_0x7851('0x13')]?_0x586350[_0x7851('0x13')][_0x7851('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x586350[_0x7851('0x13')]?_0x586350['options'][_0x7851('0x19')]||null:null,'attributes':_0x586350[_0x7851('0x13')]?_0x586350[_0x7851('0x13')][_0x7851('0x1a')]||null:null,'limit':_0x586350[_0x7851('0x13')]?_0x586350[_0x7851('0x13')]['limit']||null:null})[_0x7851('0x8')](function(_0x2b7dc8){logger[_0x7851('0x9')](_0x7851('0x17'),_0x586350);logger[_0x7851('0xc')](_0x7851('0x17'),_0x586350,JSON['stringify'](_0x2b7dc8));_0x180c69(_0x2b7dc8);})[_0x7851('0x16')](function(_0xe839f3){logger['error']('UpdateSquareReport',_0xe839f3[_0x7851('0xf')],_0x586350);_0x44b02c(_0x255c06[_0x7851('0xe')](0x1f4,_0xe839f3[_0x7851('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 4f12a17..56bccf3 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 _0xcdf8=['connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','util','path'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xcdf8,0xb2));var _0x8cdf=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xcdf8[_0x32d457];return _0x338386;};'use strict';var multer=require('multer');var util=require(_0x8cdf('0x0'));var path=require(_0x8cdf('0x1'));var timeout=require(_0x8cdf('0x2'));var express=require(_0x8cdf('0x3'));var router=express[_0x8cdf('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8cdf('0x5'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0x8cdf('0x6')]('/',auth[_0x8cdf('0x7')](),controller[_0x8cdf('0x8')]);router['get'](_0x8cdf('0x9'),auth[_0x8cdf('0x7')](),controller[_0x8cdf('0xa')]);router[_0x8cdf('0x6')](_0x8cdf('0xb'),auth[_0x8cdf('0x7')](),controller[_0x8cdf('0xc')]);router[_0x8cdf('0xd')]('/',auth[_0x8cdf('0x7')](),controller[_0x8cdf('0xe')]);router[_0x8cdf('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x8cdf('0x10')]);router[_0x8cdf('0x11')](_0x8cdf('0xb'),auth[_0x8cdf('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc26a=['/:id','isAuthenticated','show','post','create','put','update','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','index','/describe'];(function(_0x4a049d,_0x5df213){var _0x28a322=function(_0x7febd7){while(--_0x7febd7){_0x4a049d['push'](_0x4a049d['shift']());}};_0x28a322(++_0x5df213);}(_0xc26a,0x1ac));var _0xac26=function(_0x577f71,_0x3a8951){_0x577f71=_0x577f71-0x0;var _0xfec7c2=_0xc26a[_0x577f71];return _0xfec7c2;};'use strict';var multer=require(_0xac26('0x0'));var util=require(_0xac26('0x1'));var path=require(_0xac26('0x2'));var timeout=require(_0xac26('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xac26('0x4'));var auth=require(_0xac26('0x5'));var interaction=require(_0xac26('0x6'));var config=require(_0xac26('0x7'));var controller=require(_0xac26('0x8'));router[_0xac26('0x9')]('/',auth['isAuthenticated'](),controller[_0xac26('0xa')]);router[_0xac26('0x9')](_0xac26('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xac26('0x9')](_0xac26('0xc'),auth[_0xac26('0xd')](),controller[_0xac26('0xe')]);router[_0xac26('0xf')]('/',auth['isAuthenticated'](),controller[_0xac26('0x10')]);router[_0xac26('0x11')](_0xac26('0xc'),auth[_0xac26('0xd')](),controller[_0xac26('0x12')]);router['delete'](_0xac26('0xc'),auth[_0xac26('0xd')](),controller['destroy']);module[_0xac26('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index af31185..fa1e664 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 _0x6dbc=['TEXT','STRING'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6dbc,0x147));var _0xc6db=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x6dbc[_0x422905];return _0x33dc6c;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xc6db('0x0')]},'node':{'type':Sequelize[_0xc6db('0x0')]},'application':{'type':Sequelize[_0xc6db('0x0')]},'data':{'type':Sequelize[_0xc6db('0x1')]},'project_name':{'type':Sequelize[_0xc6db('0x0')]},'callerid':{'type':Sequelize[_0xc6db('0x0')]}}; \ No newline at end of file +var _0xed9c=['STRING','TEXT','sequelize'];(function(_0x5aadc8,_0x9467d8){var _0x5ab6dc=function(_0x57e4d8){while(--_0x57e4d8){_0x5aadc8['push'](_0x5aadc8['shift']());}};_0x5ab6dc(++_0x9467d8);}(_0xed9c,0x1c7));var _0xced9=function(_0x8a66ca,_0x16ff63){_0x8a66ca=_0x8a66ca-0x0;var _0x4e75f6=_0xed9c[_0x8a66ca];return _0x4e75f6;};'use strict';var Sequelize=require(_0xced9('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xced9('0x1')]},'node':{'type':Sequelize[_0xced9('0x1')]},'application':{'type':Sequelize[_0xced9('0x1')]},'data':{'type':Sequelize[_0xced9('0x2')]},'project_name':{'type':Sequelize[_0xced9('0x1')]},'callerid':{'type':Sequelize[_0xced9('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 96cb298..0ddab48 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 _0x0592=['catch','params','keys','fields','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','SquareDetailsReport','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll'];(function(_0x21f388,_0xd3a3b7){var _0x36c9a0=function(_0x46024b){while(--_0x46024b){_0x21f388['push'](_0x21f388['shift']());}};_0x36c9a0(++_0xd3a3b7);}(_0x0592,0xf3));var _0x2059=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0592[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0x2059('0x0'));var rimraf=require(_0x2059('0x1'));var zipdir=require(_0x2059('0x2'));var jsonpatch=require(_0x2059('0x3'));var rp=require(_0x2059('0x4'));var moment=require(_0x2059('0x5'));var BPromise=require(_0x2059('0x6'));var Mustache=require('mustache');var util=require(_0x2059('0x7'));var path=require(_0x2059('0x8'));var sox=require(_0x2059('0x9'));var csv=require(_0x2059('0xa'));var ejs=require(_0x2059('0xb'));var fs=require('fs');var fs_extra=require(_0x2059('0xc'));var _=require('lodash');var squel=require(_0x2059('0xd'));var crypto=require(_0x2059('0xe'));var jsforce=require(_0x2059('0xf'));var deskjs=require(_0x2059('0x10'));var toCsv=require(_0x2059('0xa'));var querystring=require(_0x2059('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2059('0x12'));var qs=require(_0x2059('0x13'));var as=require(_0x2059('0x14'));var hardwareService=require(_0x2059('0x15'));var logger=require('../../config/logger')(_0x2059('0x16'));var utils=require(_0x2059('0x17'));var config=require(_0x2059('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2059('0x19'))['db'];function respondWithStatusCode(_0x3684f8,_0x7440f2){_0x7440f2=_0x7440f2||0xcc;return function(_0xe2cd24){if(_0xe2cd24){return _0x3684f8[_0x2059('0x1a')](_0x7440f2);}return _0x3684f8[_0x2059('0x1b')](_0x7440f2)[_0x2059('0x1c')]();};}function respondWithResult(_0x2c32aa,_0x477018){_0x477018=_0x477018||0xc8;return function(_0x297132){if(_0x297132){return _0x2c32aa[_0x2059('0x1b')](_0x477018)[_0x2059('0x1d')](_0x297132);}};}function respondWithFilteredResult(_0x220ec3,_0x51ac67){return function(_0x2b935b){if(_0x2b935b){var _0x43879=typeof _0x51ac67['offset']===_0x2059('0x1e')&&typeof _0x51ac67['limit']===_0x2059('0x1e');var _0x25952d=_0x2b935b['count'];var _0x5c9171=_0x43879?0x0:_0x51ac67[_0x2059('0x1f')];var _0x444860=_0x43879?_0x2b935b[_0x2059('0x20')]:_0x51ac67[_0x2059('0x1f')]+_0x51ac67[_0x2059('0x21')];var _0x4f482a;if(_0x444860>=_0x25952d){_0x444860=_0x25952d;_0x4f482a=0xc8;}else{_0x4f482a=0xce;}_0x220ec3[_0x2059('0x1b')](_0x4f482a);return _0x220ec3[_0x2059('0x22')](_0x2059('0x23'),_0x5c9171+'-'+_0x444860+'/'+_0x25952d)[_0x2059('0x1d')](_0x2b935b);}return null;};}function patchUpdates(_0x1a2435){return function(_0x52f3d9){try{jsonpatch[_0x2059('0x24')](_0x52f3d9,_0x1a2435,!![]);}catch(_0x263a1a){return BPromise[_0x2059('0x25')](_0x263a1a);}return _0x52f3d9[_0x2059('0x26')]();};}function saveUpdates(_0x176def,_0x575bf3){return function(_0x254c70){if(_0x254c70){return _0x254c70[_0x2059('0x27')](_0x176def)['then'](function(_0x2daaa5){return _0x2daaa5;});}return null;};}function removeEntity(_0x48bd4d,_0x5cf831){return function(_0x44f79f){if(_0x44f79f){return _0x44f79f[_0x2059('0x28')]()[_0x2059('0x29')](function(){_0x48bd4d[_0x2059('0x1b')](0xcc)[_0x2059('0x1c')]();});}};}function handleEntityNotFound(_0x4f61e8,_0x4e29bd){return function(_0x4d9c50){if(!_0x4d9c50){_0x4f61e8[_0x2059('0x1a')](0x194);}return _0x4d9c50;};}function handleError(_0x29650b,_0x1f0e78){_0x1f0e78=_0x1f0e78||0x1f4;return function(_0x25a2f2){logger[_0x2059('0x2a')](_0x25a2f2[_0x2059('0x2b')]);if(_0x25a2f2[_0x2059('0x2c')]){delete _0x25a2f2[_0x2059('0x2c')];}_0x29650b[_0x2059('0x1b')](_0x1f0e78)['send'](_0x25a2f2);};}exports[_0x2059('0x2d')]=function(_0x1f6714,_0x6c2187){var _0x2f0456={},_0x377bf6={},_0x5ec67d={'count':0x0,'rows':[]};var _0x7fcf49=_['map'](db[_0x2059('0x2e')][_0x2059('0x2f')],function(_0xb168d7){return{'name':_0xb168d7[_0x2059('0x30')],'type':_0xb168d7[_0x2059('0x31')][_0x2059('0x32')]};});_0x377bf6['model']=_[_0x2059('0x33')](_0x7fcf49,_0x2059('0x2c'));_0x377bf6[_0x2059('0x34')]=_['keys'](_0x1f6714[_0x2059('0x34')]);_0x377bf6[_0x2059('0x35')]=_[_0x2059('0x36')](_0x377bf6[_0x2059('0x37')],_0x377bf6[_0x2059('0x34')]);_0x2f0456['attributes']=_[_0x2059('0x36')](_0x377bf6[_0x2059('0x37')],qs['fields'](_0x1f6714[_0x2059('0x34')]['fields']));_0x2f0456['attributes']=_0x2f0456[_0x2059('0x38')][_0x2059('0x39')]?_0x2f0456[_0x2059('0x38')]:_0x377bf6[_0x2059('0x37')];if(!_0x1f6714['query'][_0x2059('0x3a')]('nolimit')){_0x2f0456[_0x2059('0x21')]=qs[_0x2059('0x21')](_0x1f6714[_0x2059('0x34')]['limit']);_0x2f0456['offset']=qs[_0x2059('0x1f')](_0x1f6714['query']['offset']);}_0x2f0456[_0x2059('0x3b')]=qs[_0x2059('0x3c')](_0x1f6714[_0x2059('0x34')][_0x2059('0x3c')]);_0x2f0456[_0x2059('0x3d')]=qs['filters'](_[_0x2059('0x3e')](_0x1f6714[_0x2059('0x34')],_0x377bf6['filters']),_0x7fcf49);if(_0x1f6714[_0x2059('0x34')]['filter']){_0x2f0456['where']=_['merge'](_0x2f0456[_0x2059('0x3d')],{'$or':_['map'](_0x7fcf49,function(_0x998190){if(_0x998190[_0x2059('0x31')]!==_0x2059('0x3f')){var _0x3f4dc8={};_0x3f4dc8[_0x998190[_0x2059('0x2c')]]={'$like':'%'+_0x1f6714[_0x2059('0x34')][_0x2059('0x40')]+'%'};return _0x3f4dc8;}})});}_0x2f0456=_[_0x2059('0x41')]({},_0x2f0456,_0x1f6714[_0x2059('0x42')]);var _0x3eb86c={'where':_0x2f0456[_0x2059('0x3d')]};return db[_0x2059('0x2e')][_0x2059('0x20')](_0x3eb86c)[_0x2059('0x29')](function(_0x3500d4){_0x5ec67d['count']=_0x3500d4;if(_0x1f6714[_0x2059('0x34')]['includeAll']){_0x2f0456[_0x2059('0x43')]=[{'all':!![]}];}return db[_0x2059('0x2e')][_0x2059('0x44')](_0x2f0456);})[_0x2059('0x29')](function(_0x5c3c68){_0x5ec67d['rows']=_0x5c3c68;return _0x5ec67d;})[_0x2059('0x29')](respondWithFilteredResult(_0x6c2187,_0x2f0456))[_0x2059('0x45')](handleError(_0x6c2187,null));};exports['show']=function(_0x25127d,_0x2171e6){var _0x242469={'raw':!![],'where':{'id':_0x25127d[_0x2059('0x46')]['id']}},_0x1cf315={};_0x1cf315[_0x2059('0x37')]=_['keys'](db[_0x2059('0x2e')][_0x2059('0x2f')]);_0x1cf315[_0x2059('0x34')]=_[_0x2059('0x47')](_0x25127d[_0x2059('0x34')]);_0x1cf315['filters']=_[_0x2059('0x36')](_0x1cf315[_0x2059('0x37')],_0x1cf315[_0x2059('0x34')]);_0x242469['attributes']=_[_0x2059('0x36')](_0x1cf315[_0x2059('0x37')],qs[_0x2059('0x48')](_0x25127d[_0x2059('0x34')][_0x2059('0x48')]));_0x242469[_0x2059('0x38')]=_0x242469[_0x2059('0x38')]['length']?_0x242469['attributes']:_0x1cf315['model'];if(_0x25127d[_0x2059('0x34')][_0x2059('0x49')]){_0x242469[_0x2059('0x43')]=[{'all':!![]}];}_0x242469=_[_0x2059('0x41')]({},_0x242469,_0x25127d['options']);return db['SquareDetailsReport'][_0x2059('0x4a')](_0x242469)[_0x2059('0x29')](handleEntityNotFound(_0x2171e6,null))[_0x2059('0x29')](respondWithResult(_0x2171e6,null))[_0x2059('0x45')](handleError(_0x2171e6,null));};exports['create']=function(_0x17fe15,_0x6dfd79){return db[_0x2059('0x2e')][_0x2059('0x4b')](_0x17fe15['body'],{})[_0x2059('0x29')](respondWithResult(_0x6dfd79,0xc9))[_0x2059('0x45')](handleError(_0x6dfd79,null));};exports['update']=function(_0x197bdb,_0x263374){if(_0x197bdb[_0x2059('0x4c')]['id']){delete _0x197bdb['body']['id'];}return db[_0x2059('0x2e')][_0x2059('0x4a')]({'where':{'id':_0x197bdb[_0x2059('0x46')]['id']}})['then'](handleEntityNotFound(_0x263374,null))[_0x2059('0x29')](saveUpdates(_0x197bdb['body'],null))[_0x2059('0x29')](respondWithResult(_0x263374,null))[_0x2059('0x45')](handleError(_0x263374,null));};exports[_0x2059('0x28')]=function(_0x2b7595,_0x5e9063){return db[_0x2059('0x2e')][_0x2059('0x4a')]({'where':{'id':_0x2b7595[_0x2059('0x46')]['id']}})[_0x2059('0x29')](handleEntityNotFound(_0x5e9063,null))['then'](removeEntity(_0x5e9063,null))[_0x2059('0x45')](handleError(_0x5e9063,null));};exports[_0x2059('0x4d')]=function(_0x26fd4f,_0x3048de){return db[_0x2059('0x2e')][_0x2059('0x4d')]()[_0x2059('0x29')](respondWithResult(_0x3048de,null))[_0x2059('0x45')](handleError(_0x3048de,null));}; \ No newline at end of file +var _0xeb40=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','filter','merge','options','SquareDetailsReport','includeAll','findAll','catch','params','rawAttributes','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json'];(function(_0x36bfe3,_0x358938){var _0x9b0436=function(_0x86e47d){while(--_0x86e47d){_0x36bfe3['push'](_0x36bfe3['shift']());}};_0x9b0436(++_0x358938);}(_0xeb40,0x7c));var _0x0eb4=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xeb40[_0x47aa64];return _0x549c7a;};'use strict';var emlformat=require(_0x0eb4('0x0'));var rimraf=require(_0x0eb4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0eb4('0x2'));var rp=require(_0x0eb4('0x3'));var moment=require(_0x0eb4('0x4'));var BPromise=require(_0x0eb4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0eb4('0x6'));var sox=require(_0x0eb4('0x7'));var csv=require(_0x0eb4('0x8'));var ejs=require(_0x0eb4('0x9'));var fs=require('fs');var fs_extra=require(_0x0eb4('0xa'));var _=require(_0x0eb4('0xb'));var squel=require(_0x0eb4('0xc'));var crypto=require('crypto');var jsforce=require(_0x0eb4('0xd'));var deskjs=require(_0x0eb4('0xe'));var toCsv=require(_0x0eb4('0x8'));var querystring=require(_0x0eb4('0xf'));var Papa=require(_0x0eb4('0x10'));var Redis=require(_0x0eb4('0x11'));var authService=require(_0x0eb4('0x12'));var qs=require(_0x0eb4('0x13'));var as=require(_0x0eb4('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0eb4('0x15'))(_0x0eb4('0x16'));var utils=require(_0x0eb4('0x17'));var config=require(_0x0eb4('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0eb4('0x19'))['db'];function respondWithStatusCode(_0x1b77ab,_0x17dcf8){_0x17dcf8=_0x17dcf8||0xcc;return function(_0x5b8929){if(_0x5b8929){return _0x1b77ab[_0x0eb4('0x1a')](_0x17dcf8);}return _0x1b77ab[_0x0eb4('0x1b')](_0x17dcf8)[_0x0eb4('0x1c')]();};}function respondWithResult(_0x440f4d,_0x1ddb72){_0x1ddb72=_0x1ddb72||0xc8;return function(_0x3a43a7){if(_0x3a43a7){return _0x440f4d[_0x0eb4('0x1b')](_0x1ddb72)[_0x0eb4('0x1d')](_0x3a43a7);}};}function respondWithFilteredResult(_0x5834fa,_0x44c1bd){return function(_0x36b3df){if(_0x36b3df){var _0x4e8a4c=typeof _0x44c1bd[_0x0eb4('0x1e')]===_0x0eb4('0x1f')&&typeof _0x44c1bd[_0x0eb4('0x20')]===_0x0eb4('0x1f');var _0xe4f309=_0x36b3df[_0x0eb4('0x21')];var _0x1b44b8=_0x4e8a4c?0x0:_0x44c1bd['offset'];var _0xb802a4=_0x4e8a4c?_0x36b3df['count']:_0x44c1bd[_0x0eb4('0x1e')]+_0x44c1bd[_0x0eb4('0x20')];var _0x2d31df;if(_0xb802a4>=_0xe4f309){_0xb802a4=_0xe4f309;_0x2d31df=0xc8;}else{_0x2d31df=0xce;}_0x5834fa[_0x0eb4('0x1b')](_0x2d31df);return _0x5834fa[_0x0eb4('0x22')](_0x0eb4('0x23'),_0x1b44b8+'-'+_0xb802a4+'/'+_0xe4f309)[_0x0eb4('0x1d')](_0x36b3df);}return null;};}function patchUpdates(_0x3acd73){return function(_0x440cae){try{jsonpatch[_0x0eb4('0x24')](_0x440cae,_0x3acd73,!![]);}catch(_0x1a5846){return BPromise[_0x0eb4('0x25')](_0x1a5846);}return _0x440cae[_0x0eb4('0x26')]();};}function saveUpdates(_0x488e90,_0x6836d3){return function(_0x3e0c87){if(_0x3e0c87){return _0x3e0c87[_0x0eb4('0x27')](_0x488e90)['then'](function(_0xd73634){return _0xd73634;});}return null;};}function removeEntity(_0x4160b1,_0x81a73c){return function(_0x81bd19){if(_0x81bd19){return _0x81bd19[_0x0eb4('0x28')]()[_0x0eb4('0x29')](function(){_0x4160b1[_0x0eb4('0x1b')](0xcc)[_0x0eb4('0x1c')]();});}};}function handleEntityNotFound(_0x4c3aee,_0x400dfe){return function(_0x503b44){if(!_0x503b44){_0x4c3aee['sendStatus'](0x194);}return _0x503b44;};}function handleError(_0x37d0cc,_0x3f0eb2){_0x3f0eb2=_0x3f0eb2||0x1f4;return function(_0xfe7ec9){logger[_0x0eb4('0x2a')](_0xfe7ec9[_0x0eb4('0x2b')]);if(_0xfe7ec9[_0x0eb4('0x2c')]){delete _0xfe7ec9[_0x0eb4('0x2c')];}_0x37d0cc[_0x0eb4('0x1b')](_0x3f0eb2)[_0x0eb4('0x2d')](_0xfe7ec9);};}exports['index']=function(_0x44ab11,_0xe5036f){var _0x30c376={},_0x2cc8c8={},_0x21d08a={'count':0x0,'rows':[]};var _0x12b101=_[_0x0eb4('0x2e')](db['SquareDetailsReport']['rawAttributes'],function(_0x4fa46c){return{'name':_0x4fa46c[_0x0eb4('0x2f')],'type':_0x4fa46c['type'][_0x0eb4('0x30')]};});_0x2cc8c8[_0x0eb4('0x31')]=_[_0x0eb4('0x2e')](_0x12b101,_0x0eb4('0x2c'));_0x2cc8c8[_0x0eb4('0x32')]=_[_0x0eb4('0x33')](_0x44ab11[_0x0eb4('0x32')]);_0x2cc8c8[_0x0eb4('0x34')]=_[_0x0eb4('0x35')](_0x2cc8c8[_0x0eb4('0x31')],_0x2cc8c8[_0x0eb4('0x32')]);_0x30c376['attributes']=_[_0x0eb4('0x35')](_0x2cc8c8[_0x0eb4('0x31')],qs[_0x0eb4('0x36')](_0x44ab11[_0x0eb4('0x32')][_0x0eb4('0x36')]));_0x30c376[_0x0eb4('0x37')]=_0x30c376[_0x0eb4('0x37')][_0x0eb4('0x38')]?_0x30c376[_0x0eb4('0x37')]:_0x2cc8c8[_0x0eb4('0x31')];if(!_0x44ab11[_0x0eb4('0x32')][_0x0eb4('0x39')](_0x0eb4('0x3a'))){_0x30c376[_0x0eb4('0x20')]=qs[_0x0eb4('0x20')](_0x44ab11[_0x0eb4('0x32')][_0x0eb4('0x20')]);_0x30c376[_0x0eb4('0x1e')]=qs['offset'](_0x44ab11[_0x0eb4('0x32')]['offset']);}_0x30c376['order']=qs[_0x0eb4('0x3b')](_0x44ab11[_0x0eb4('0x32')][_0x0eb4('0x3b')]);_0x30c376[_0x0eb4('0x3c')]=qs[_0x0eb4('0x34')](_[_0x0eb4('0x3d')](_0x44ab11[_0x0eb4('0x32')],_0x2cc8c8[_0x0eb4('0x34')]),_0x12b101);if(_0x44ab11[_0x0eb4('0x32')]['filter']){_0x30c376[_0x0eb4('0x3c')]=_['merge'](_0x30c376[_0x0eb4('0x3c')],{'$or':_[_0x0eb4('0x2e')](_0x12b101,function(_0x3e53f6){if(_0x3e53f6[_0x0eb4('0x3e')]!==_0x0eb4('0x3f')){var _0x1bcd8c={};_0x1bcd8c[_0x3e53f6[_0x0eb4('0x2c')]]={'$like':'%'+_0x44ab11['query'][_0x0eb4('0x40')]+'%'};return _0x1bcd8c;}})});}_0x30c376=_[_0x0eb4('0x41')]({},_0x30c376,_0x44ab11[_0x0eb4('0x42')]);var _0x35b130={'where':_0x30c376[_0x0eb4('0x3c')]};return db[_0x0eb4('0x43')][_0x0eb4('0x21')](_0x35b130)[_0x0eb4('0x29')](function(_0x19b7d3){_0x21d08a[_0x0eb4('0x21')]=_0x19b7d3;if(_0x44ab11['query'][_0x0eb4('0x44')]){_0x30c376['include']=[{'all':!![]}];}return db['SquareDetailsReport'][_0x0eb4('0x45')](_0x30c376);})[_0x0eb4('0x29')](function(_0x36d373){_0x21d08a['rows']=_0x36d373;return _0x21d08a;})[_0x0eb4('0x29')](respondWithFilteredResult(_0xe5036f,_0x30c376))[_0x0eb4('0x46')](handleError(_0xe5036f,null));};exports['show']=function(_0x43dab7,_0x1014e6){var _0x6ddf45={'raw':!![],'where':{'id':_0x43dab7[_0x0eb4('0x47')]['id']}},_0x195ee9={};_0x195ee9[_0x0eb4('0x31')]=_[_0x0eb4('0x33')](db[_0x0eb4('0x43')][_0x0eb4('0x48')]);_0x195ee9[_0x0eb4('0x32')]=_['keys'](_0x43dab7[_0x0eb4('0x32')]);_0x195ee9[_0x0eb4('0x34')]=_[_0x0eb4('0x35')](_0x195ee9[_0x0eb4('0x31')],_0x195ee9[_0x0eb4('0x32')]);_0x6ddf45[_0x0eb4('0x37')]=_[_0x0eb4('0x35')](_0x195ee9['model'],qs[_0x0eb4('0x36')](_0x43dab7[_0x0eb4('0x32')]['fields']));_0x6ddf45['attributes']=_0x6ddf45[_0x0eb4('0x37')]['length']?_0x6ddf45[_0x0eb4('0x37')]:_0x195ee9[_0x0eb4('0x31')];if(_0x43dab7[_0x0eb4('0x32')][_0x0eb4('0x44')]){_0x6ddf45['include']=[{'all':!![]}];}_0x6ddf45=_[_0x0eb4('0x41')]({},_0x6ddf45,_0x43dab7[_0x0eb4('0x42')]);return db[_0x0eb4('0x43')][_0x0eb4('0x49')](_0x6ddf45)[_0x0eb4('0x29')](handleEntityNotFound(_0x1014e6,null))[_0x0eb4('0x29')](respondWithResult(_0x1014e6,null))[_0x0eb4('0x46')](handleError(_0x1014e6,null));};exports[_0x0eb4('0x4a')]=function(_0x4256e9,_0x34251e){return db[_0x0eb4('0x43')][_0x0eb4('0x4a')](_0x4256e9[_0x0eb4('0x4b')],{})[_0x0eb4('0x29')](respondWithResult(_0x34251e,0xc9))[_0x0eb4('0x46')](handleError(_0x34251e,null));};exports[_0x0eb4('0x27')]=function(_0x29d512,_0x2f8ad3){if(_0x29d512[_0x0eb4('0x4b')]['id']){delete _0x29d512[_0x0eb4('0x4b')]['id'];}return db[_0x0eb4('0x43')]['find']({'where':{'id':_0x29d512[_0x0eb4('0x47')]['id']}})[_0x0eb4('0x29')](handleEntityNotFound(_0x2f8ad3,null))[_0x0eb4('0x29')](saveUpdates(_0x29d512[_0x0eb4('0x4b')],null))[_0x0eb4('0x29')](respondWithResult(_0x2f8ad3,null))[_0x0eb4('0x46')](handleError(_0x2f8ad3,null));};exports[_0x0eb4('0x28')]=function(_0x2b8583,_0x54741d){return db['SquareDetailsReport'][_0x0eb4('0x49')]({'where':{'id':_0x2b8583[_0x0eb4('0x47')]['id']}})[_0x0eb4('0x29')](handleEntityNotFound(_0x54741d,null))['then'](removeEntity(_0x54741d,null))[_0x0eb4('0x46')](handleError(_0x54741d,null));};exports[_0x0eb4('0x4c')]=function(_0x164c16,_0x149014){return db[_0x0eb4('0x43')][_0x0eb4('0x4c')]()['then'](respondWithResult(_0x149014,null))[_0x0eb4('0x46')](handleError(_0x149014,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index d43dbb5..94439d4 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 _0xe3a8=['api','moment','request-promise','rimraf','./squareReportDetail.attributes','define','SquareDetailsReport','lodash','util','../../config/logger'];(function(_0x24618a,_0x2cd0f4){var _0x2e3d64=function(_0x28c59c){while(--_0x28c59c){_0x24618a['push'](_0x24618a['shift']());}};_0x2e3d64(++_0x2cd0f4);}(_0xe3a8,0x1c9));var _0x8e3a=function(_0x1c378a,_0x18d6c8){_0x1c378a=_0x1c378a-0x0;var _0x2c710d=_0xe3a8[_0x1c378a];return _0x2c710d;};'use strict';var _=require(_0x8e3a('0x0'));var util=require(_0x8e3a('0x1'));var logger=require(_0x8e3a('0x2'))(_0x8e3a('0x3'));var moment=require(_0x8e3a('0x4'));var BPromise=require('bluebird');var rp=require(_0x8e3a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8e3a('0x6'));var config=require('../../config/environment');var attributes=require(_0x8e3a('0x7'));module['exports']=function(_0x383f0a,_0x542a32){return _0x383f0a[_0x8e3a('0x8')](_0x8e3a('0x9'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4a1=['exports','define','report_square_details','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes'];(function(_0x582df7,_0x3d02cf){var _0x5081fd=function(_0x3f197c){while(--_0x3f197c){_0x582df7['push'](_0x582df7['shift']());}};_0x5081fd(++_0x3d02cf);}(_0xd4a1,0x147));var _0x1d4a=function(_0x511b97,_0x51f31b){_0x511b97=_0x511b97-0x0;var _0x39f660=_0xd4a1[_0x511b97];return _0x39f660;};'use strict';var _=require(_0x1d4a('0x0'));var util=require(_0x1d4a('0x1'));var logger=require('../../config/logger')(_0x1d4a('0x2'));var moment=require('moment');var BPromise=require(_0x1d4a('0x3'));var rp=require(_0x1d4a('0x4'));var fs=require('fs');var path=require(_0x1d4a('0x5'));var rimraf=require(_0x1d4a('0x6'));var config=require(_0x1d4a('0x7'));var attributes=require(_0x1d4a('0x8'));module[_0x1d4a('0x9')]=function(_0x55afbc,_0x2b0017){return _0x55afbc[_0x1d4a('0xa')]('SquareDetailsReport',attributes,{'tableName':_0x1d4a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index f3d9117..c887e69 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 _0x02ce=['message','catch','SquareDetailsReport','create','body','options','raw','CreateSquareDetailsReport','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x41a269,_0x428821){var _0x2dfb46=function(_0x5dde4f){while(--_0x5dde4f){_0x41a269['push'](_0x41a269['shift']());}};_0x2dfb46(++_0x428821);}(_0x02ce,0x1ac));var _0xe02c=function(_0xba2f76,_0x42dd64){_0xba2f76=_0xba2f76-0x0;var _0x335578=_0x02ce[_0xba2f76];return _0x335578;};'use strict';var _=require(_0xe02c('0x0'));var util=require(_0xe02c('0x1'));var moment=require(_0xe02c('0x2'));var BPromise=require('bluebird');var rs=require(_0xe02c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe02c('0x4'))['db'];var utils=require(_0xe02c('0x5'));var logger=require(_0xe02c('0x6'))(_0xe02c('0x7'));var config=require(_0xe02c('0x8'));var jayson=require(_0xe02c('0x9'));var client=jayson[_0xe02c('0xa')][_0xe02c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36a87f,_0x4fecb3,_0x5eabb0){return new BPromise(function(_0x3c757e,_0x2d85d7){return client[_0xe02c('0xc')](_0x36a87f,_0x5eabb0)[_0xe02c('0xd')](function(_0x2afbf5){logger[_0xe02c('0xe')](_0xe02c('0xf'),_0x4fecb3,_0xe02c('0x10'));logger[_0xe02c('0x11')](_0xe02c('0x12'),_0x4fecb3,_0xe02c('0x10'),JSON[_0xe02c('0x13')](_0x2afbf5));if(_0x2afbf5[_0xe02c('0x14')]){if(_0x2afbf5[_0xe02c('0x14')][_0xe02c('0x15')]===0x1f4){logger[_0xe02c('0x14')](_0xe02c('0xf'),_0x4fecb3,_0x2afbf5[_0xe02c('0x14')]['message']);return _0x2d85d7(_0x2afbf5[_0xe02c('0x14')]['message']);}logger['error'](_0xe02c('0xf'),_0x4fecb3,_0x2afbf5['error'][_0xe02c('0x16')]);return _0x3c757e(_0x2afbf5['error'][_0xe02c('0x16')]);}else{logger['info'](_0xe02c('0xf'),_0x4fecb3,_0xe02c('0x10'));_0x3c757e(_0x2afbf5['result'][_0xe02c('0x16')]);}})[_0xe02c('0x17')](function(_0x51676c){logger[_0xe02c('0x14')](_0xe02c('0xf'),_0x4fecb3,_0x51676c);_0x2d85d7(_0x51676c);});});}exports['CreateSquareDetailsReport']=function(_0x52917f){var _0x3e37bf=this;return new Promise(function(_0x49604a,_0x1f8f37){return db[_0xe02c('0x18')][_0xe02c('0x19')](_0x52917f[_0xe02c('0x1a')],{'raw':_0x52917f[_0xe02c('0x1b')]?_0x52917f['options'][_0xe02c('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x4ea9b5){logger[_0xe02c('0xe')](_0xe02c('0x1d'),_0x52917f);logger['debug'](_0xe02c('0x1d'),_0x52917f,JSON[_0xe02c('0x13')](_0x4ea9b5));_0x49604a(_0x4ea9b5);})['catch'](function(_0x38dce2){logger[_0xe02c('0x14')](_0xe02c('0x1d'),_0x38dce2[_0xe02c('0x16')],_0x52917f);_0x1f8f37(_0x3e37bf[_0xe02c('0x14')](0x1f4,_0x38dce2[_0xe02c('0x16')]));});});}; \ No newline at end of file +var _0xfcbb=['code','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1a27f3,_0x1c082d){var _0x3ce222=function(_0x3f93e1){while(--_0x3f93e1){_0x1a27f3['push'](_0x1a27f3['shift']());}};_0x3ce222(++_0x1c082d);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x355bae,_0x3020eb){_0x355bae=_0x355bae-0x0;var _0x124de7=_0xfcbb[_0x355bae];return _0x124de7;};'use strict';var _=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var moment=require(_0xbfcb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfcb('0x3'));var db=require(_0xbfcb('0x4'))['db'];var utils=require(_0xbfcb('0x5'));var logger=require(_0xbfcb('0x6'))(_0xbfcb('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbfcb('0x8')][_0xbfcb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8d4e6a,_0x2df839,_0x288ee5){return new BPromise(function(_0x2f875c,_0x49717b){return client['request'](_0x8d4e6a,_0x288ee5)[_0xbfcb('0xa')](function(_0x331173){logger[_0xbfcb('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x2df839,_0xbfcb('0xc'));logger[_0xbfcb('0xd')](_0xbfcb('0xe'),_0x2df839,_0xbfcb('0xc'),JSON[_0xbfcb('0xf')](_0x331173));if(_0x331173[_0xbfcb('0x10')]){if(_0x331173['error'][_0xbfcb('0x11')]===0x1f4){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')]['message']);return _0x49717b(_0x331173[_0xbfcb('0x10')]['message']);}logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);return _0x2f875c(_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);}else{logger[_0xbfcb('0xb')](_0xbfcb('0x12'),_0x2df839,_0xbfcb('0xc'));_0x2f875c(_0x331173[_0xbfcb('0x14')][_0xbfcb('0x13')]);}})[_0xbfcb('0x15')](function(_0x26f335){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x26f335);_0x49717b(_0x26f335);});});}exports[_0xbfcb('0x16')]=function(_0xba1d6){var _0x38689e=this;return new Promise(function(_0x3404aa,_0x46b8d2){return db[_0xbfcb('0x17')][_0xbfcb('0x18')](_0xba1d6['body'],{'raw':_0xba1d6[_0xbfcb('0x19')]?_0xba1d6[_0xbfcb('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xbfcb('0xa')](function(_0x1a7225){logger['info']('CreateSquareDetailsReport',_0xba1d6);logger[_0xbfcb('0xd')](_0xbfcb('0x16'),_0xba1d6,JSON[_0xbfcb('0xf')](_0x1a7225));_0x3404aa(_0x1a7225);})[_0xbfcb('0x15')](function(_0x1c5924){logger['error'](_0xbfcb('0x16'),_0x1c5924[_0xbfcb('0x13')],_0xba1d6);_0x46b8d2(_0x38689e[_0xbfcb('0x10')](0x1f4,_0x1c5924[_0xbfcb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 1498db6..1ab15d2 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 _0x9155=['/process/:pid/kill','killProcess','exports','isAuthenticated','get'];(function(_0xdb623d,_0x4bcffa){var _0x107852=function(_0x3e50dd){while(--_0x3e50dd){_0xdb623d['push'](_0xdb623d['shift']());}};_0x107852(++_0x4bcffa);}(_0x9155,0x1ca));var _0x5915=function(_0x2d994d,_0x168a27){_0x2d994d=_0x2d994d-0x0;var _0xd54be4=_0x9155[_0x2d994d];return _0xd54be4;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./system.controller');router['get']('/',auth[_0x5915('0x0')](),controller['index']);router[_0x5915('0x1')](_0x5915('0x2'),auth[_0x5915('0x0')](),controller[_0x5915('0x3')]);module[_0x5915('0x4')]=router; \ No newline at end of file +var _0xc79d=['../../components/auth/service','get','index','/process/:pid/kill','isAuthenticated','killProcess','exports','Router'];(function(_0x19c2a4,_0x4df9da){var _0x42ca01=function(_0x2df3ee){while(--_0x2df3ee){_0x19c2a4['push'](_0x19c2a4['shift']());}};_0x42ca01(++_0x4df9da);}(_0xc79d,0x177));var _0xdc79=function(_0x11a16a,_0x3fdbda){_0x11a16a=_0x11a16a-0x0;var _0x729648=_0xc79d[_0x11a16a];return _0x729648;};'use strict';var express=require('express');var router=express[_0xdc79('0x0')]();var auth=require(_0xdc79('0x1'));var controller=require('./system.controller');router[_0xdc79('0x2')]('/',auth['isAuthenticated'](),controller[_0xdc79('0x3')]);router[_0xdc79('0x2')](_0xdc79('0x4'),auth[_0xdc79('0x5')](),controller[_0xdc79('0x6')]);module[_0xdc79('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 1520e77..9bd30d5 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 _0xa971=['systeminformation','child_process','../../config/logger','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','json','format','params','pid','then','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','catch'];(function(_0x358959,_0x929d6e){var _0x3fede4=function(_0x541c24){while(--_0x541c24){_0x358959['push'](_0x358959['shift']());}};_0x3fede4(++_0x929d6e);}(_0xa971,0x9a));var _0x1a97=function(_0x446867,_0x520c17){_0x446867=_0x446867-0x0;var _0x43c44f=_0xa971[_0x446867];return _0x43c44f;};'use strict';var info=require(_0x1a97('0x0'));var exec=require(_0x1a97('0x1'))['exec'];var logger=require(_0x1a97('0x2'))('api');var util=require('util');var BPromise=require('bluebird');var _=require(_0x1a97('0x3'));function handleError(_0x6352bc,_0x52f885,_0x18d099){_0x52f885=_0x52f885||0x1f4;return function(_0x489bc9){logger[_0x1a97('0x4')](_0x1a97('0x5'),_0x18d099,_0x52f885,util[_0x1a97('0x6')](_0x489bc9,{'showHidden':![],'depth':null}));delete _0x489bc9[_0x1a97('0x7')];_0x6352bc[_0x1a97('0x8')](_0x52f885)[_0x1a97('0x9')](_0x489bc9);};}exports[_0x1a97('0xa')]=function(_0x4a3474,_0x568efd){return info['getAllData']()['then'](function(_0x1a21d4){return _0x568efd[_0x1a97('0x8')](0xc8)[_0x1a97('0xb')](_0x1a21d4);})['catch'](function(_0x5922b7){return _0x568efd[_0x1a97('0x8')](0x1f4)['json'](_0x5922b7);});};exports['killProcess']=function(_0x11878f,_0x4b147a){var _0x2d1f7e=['components/import/cm'];return new BPromise(function(_0x39501e,_0x4f16fc){return exec(util[_0x1a97('0xc')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x11878f[_0x1a97('0xd')][_0x1a97('0xe')]),function(_0x1946fe,_0xb4c746,_0x238772){if(_0x1946fe){return _0x4f16fc(_0x1946fe);}return _0x39501e(_0xb4c746);});})[_0x1a97('0xf')](function(_0x2b82a2){var _0x1b3c0b=![];var _0x309bf0=_0x2b82a2['split'](/\n/);for(var _0x2b7244=0x0,_0x54e12d=_0x2d1f7e[_0x1a97('0x10')];_0x2b7244<_0x54e12d,_0x1b3c0b===![];_0x2b7244+=0x1){if(_0x2b82a2[_0x1a97('0x11')](_0x2d1f7e[_0x2b7244])>=0x0){_0x1b3c0b=!![];}}if(!_0x1b3c0b){throw new Error(util['format'](_0x1a97('0x12'),_0x11878f[_0x1a97('0xd')][_0x1a97('0xe')]));}process[_0x1a97('0x13')](_0x11878f['params'][_0x1a97('0xe')],_0x1a97('0x14'));return _0x4b147a[_0x1a97('0x8')](0xc8)[_0x1a97('0xb')]({'message':util[_0x1a97('0xc')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x11878f[_0x1a97('0xd')][_0x1a97('0xe')])});})[_0x1a97('0x15')](handleError(_0x4b147a,null,'killProcess'));}; \ No newline at end of file +var _0xd51a=['send','index','getAllData','then','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status'];(function(_0x5f0627,_0x72504a){var _0x490fe6=function(_0x421e95){while(--_0x421e95){_0x5f0627['push'](_0x5f0627['shift']());}};_0x490fe6(++_0x72504a);}(_0xd51a,0x1b5));var _0xad51=function(_0x509caf,_0x3baf64){_0x509caf=_0x509caf-0x0;var _0x511d7d=_0xd51a[_0x509caf];return _0x511d7d;};'use strict';var info=require(_0xad51('0x0'));var exec=require('child_process')[_0xad51('0x1')];var logger=require('../../config/logger')(_0xad51('0x2'));var util=require(_0xad51('0x3'));var BPromise=require(_0xad51('0x4'));var _=require(_0xad51('0x5'));function handleError(_0x36ce1f,_0x529b5e,_0x124cab){_0x529b5e=_0x529b5e||0x1f4;return function(_0x34e3d1){logger[_0xad51('0x6')](_0xad51('0x7'),_0x124cab,_0x529b5e,util[_0xad51('0x8')](_0x34e3d1,{'showHidden':![],'depth':null}));delete _0x34e3d1[_0xad51('0x9')];_0x36ce1f[_0xad51('0xa')](_0x529b5e)[_0xad51('0xb')](_0x34e3d1);};}exports[_0xad51('0xc')]=function(_0x424e88,_0xf93dd6){return info[_0xad51('0xd')]()[_0xad51('0xe')](function(_0x3a47cd){return _0xf93dd6[_0xad51('0xa')](0xc8)[_0xad51('0xf')](_0x3a47cd);})['catch'](function(_0x585843){return _0xf93dd6['status'](0x1f4)[_0xad51('0xf')](_0x585843);});};exports[_0xad51('0x10')]=function(_0x1587f0,_0x12fe29){var _0xaaad8=[_0xad51('0x11')];return new BPromise(function(_0x1cc8f8,_0x327634){return exec(util[_0xad51('0x12')](_0xad51('0x13'),_0x1587f0['params'][_0xad51('0x14')]),function(_0x238009,_0x2e36d3,_0x31ea9b){if(_0x238009){return _0x327634(_0x238009);}return _0x1cc8f8(_0x2e36d3);});})[_0xad51('0xe')](function(_0x31a0a9){var _0x409100=![];var _0x54f98a=_0x31a0a9[_0xad51('0x15')](/\n/);for(var _0x1b71e7=0x0,_0x48d9a8=_0xaaad8[_0xad51('0x16')];_0x1b71e7<_0x48d9a8,_0x409100===![];_0x1b71e7+=0x1){if(_0x31a0a9[_0xad51('0x17')](_0xaaad8[_0x1b71e7])>=0x0){_0x409100=!![];}}if(!_0x409100){throw new Error(util[_0xad51('0x12')](_0xad51('0x18'),_0x1587f0['params']['pid']));}process['kill'](_0x1587f0[_0xad51('0x19')][_0xad51('0x14')],_0xad51('0x1a'));return _0x12fe29[_0xad51('0xa')](0xc8)['json']({'message':util[_0xad51('0x12')](_0xad51('0x1b'),_0x1587f0['params'][_0xad51('0x14')])});})['catch'](handleError(_0x12fe29,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index bcfdbdc..6095e4e 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 _0xfef3=['../../components/interaction/service','./tag.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service'];(function(_0x4d26d5,_0x4fede4){var _0x1ecefc=function(_0x96fa81){while(--_0x96fa81){_0x4d26d5['push'](_0x4d26d5['shift']());}};_0x1ecefc(++_0x4fede4);}(_0xfef3,0x118));var _0x3fef=function(_0x533528,_0x409d05){_0x533528=_0x533528-0x0;var _0x3189f1=_0xfef3[_0x533528];return _0x3189f1;};'use strict';var multer=require(_0x3fef('0x0'));var util=require('util');var path=require(_0x3fef('0x1'));var timeout=require('connect-timeout');var express=require(_0x3fef('0x2'));var router=express[_0x3fef('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3fef('0x4'));var interaction=require(_0x3fef('0x5'));var config=require('../../config/environment');var controller=require(_0x3fef('0x6'));router[_0x3fef('0x7')]('/',auth['isAuthenticated'](),controller[_0x3fef('0x8')]);router[_0x3fef('0x7')](_0x3fef('0x9'),auth[_0x3fef('0xa')](),controller[_0x3fef('0xb')]);router[_0x3fef('0xc')]('/',auth[_0x3fef('0xa')](),controller[_0x3fef('0xd')]);router[_0x3fef('0xe')](_0x3fef('0x9'),auth[_0x3fef('0xa')](),controller[_0x3fef('0xf')]);router[_0x3fef('0x10')](_0x3fef('0x9'),auth['isAuthenticated'](),controller[_0x3fef('0x11')]);module[_0x3fef('0x12')]=router; \ No newline at end of file +var _0xb6a6=['multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./tag.controller','get','isAuthenticated','/:id','show','post','create','update','destroy'];(function(_0x242b8f,_0xb7845e){var _0x73a85b=function(_0xf89d0){while(--_0xf89d0){_0x242b8f['push'](_0x242b8f['shift']());}};_0x73a85b(++_0xb7845e);}(_0xb6a6,0x1a0));var _0x6b6a=function(_0xf97648,_0x3c2d9c){_0xf97648=_0xf97648-0x0;var _0x2d2321=_0xb6a6[_0xf97648];return _0x2d2321;};'use strict';var multer=require(_0x6b6a('0x0'));var util=require(_0x6b6a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6b6a('0x2'));var router=express[_0x6b6a('0x3')]();var fs_extra=require(_0x6b6a('0x4'));var auth=require(_0x6b6a('0x5'));var interaction=require(_0x6b6a('0x6'));var config=require('../../config/environment');var controller=require(_0x6b6a('0x7'));router[_0x6b6a('0x8')]('/',auth[_0x6b6a('0x9')](),controller['index']);router[_0x6b6a('0x8')](_0x6b6a('0xa'),auth['isAuthenticated'](),controller[_0x6b6a('0xb')]);router[_0x6b6a('0xc')]('/',auth['isAuthenticated'](),controller[_0x6b6a('0xd')]);router['put'](_0x6b6a('0xa'),auth[_0x6b6a('0x9')](),controller[_0x6b6a('0xe')]);router['delete']('/:id',auth[_0x6b6a('0x9')](),controller[_0x6b6a('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 5044fc6..1316443 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 _0xc04a=['STRING','#0091EA','sequelize'];(function(_0x534055,_0x42303d){var _0x986b30=function(_0x401542){while(--_0x401542){_0x534055['push'](_0x534055['shift']());}};_0x986b30(++_0x42303d);}(_0xc04a,0x12e));var _0xac04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc04a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xac04('0x0'));module['exports']={'name':{'type':Sequelize[_0xac04('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xac04('0x1')],'defaultValue':_0xac04('0x2')},'description':{'type':Sequelize[_0xac04('0x1')]}}; \ No newline at end of file +var _0xa45c=['STRING','sequelize','exports'];(function(_0x46b2a7,_0x10048e){var _0x19ec73=function(_0x2f5c40){while(--_0x2f5c40){_0x46b2a7['push'](_0x46b2a7['shift']());}};_0x19ec73(++_0x10048e);}(_0xa45c,0x6d));var _0xca45=function(_0x5707f7,_0x2f8459){_0x5707f7=_0x5707f7-0x0;var _0x6ea94=_0xa45c[_0x5707f7];return _0x6ea94;};'use strict';var Sequelize=require(_0xca45('0x0'));module[_0xca45('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xca45('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xca45('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 54471a5..decac64 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 _0xad8a=['find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','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','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','stack','name','send','map','Tag','rawAttributes','type','key','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','fields','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection'];(function(_0x15329c,_0x44a0a2){var _0x566604=function(_0x2c3c88){while(--_0x2c3c88){_0x15329c['push'](_0x15329c['shift']());}};_0x566604(++_0x44a0a2);}(_0xad8a,0xb0));var _0xaad8=function(_0x3b87e5,_0x4910bd){_0x3b87e5=_0x3b87e5-0x0;var _0x57a546=_0xad8a[_0x3b87e5];return _0x57a546;};'use strict';var emlformat=require(_0xaad8('0x0'));var rimraf=require(_0xaad8('0x1'));var zipdir=require(_0xaad8('0x2'));var jsonpatch=require(_0xaad8('0x3'));var rp=require(_0xaad8('0x4'));var moment=require('moment');var BPromise=require(_0xaad8('0x5'));var Mustache=require(_0xaad8('0x6'));var util=require(_0xaad8('0x7'));var path=require('path');var sox=require(_0xaad8('0x8'));var csv=require(_0xaad8('0x9'));var ejs=require(_0xaad8('0xa'));var fs=require('fs');var fs_extra=require(_0xaad8('0xb'));var _=require(_0xaad8('0xc'));var squel=require(_0xaad8('0xd'));var crypto=require(_0xaad8('0xe'));var jsforce=require(_0xaad8('0xf'));var deskjs=require(_0xaad8('0x10'));var toCsv=require(_0xaad8('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xaad8('0x11'));var authService=require(_0xaad8('0x12'));var qs=require(_0xaad8('0x13'));var as=require(_0xaad8('0x14'));var hardwareService=require(_0xaad8('0x15'));var logger=require(_0xaad8('0x16'))(_0xaad8('0x17'));var utils=require(_0xaad8('0x18'));var config=require(_0xaad8('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xaad8('0x1a'))['db'];function respondWithStatusCode(_0x2a13fb,_0xed6744){_0xed6744=_0xed6744||0xcc;return function(_0x456b77){if(_0x456b77){return _0x2a13fb[_0xaad8('0x1b')](_0xed6744);}return _0x2a13fb[_0xaad8('0x1c')](_0xed6744)[_0xaad8('0x1d')]();};}function respondWithResult(_0x357bf6,_0x1c70d3){_0x1c70d3=_0x1c70d3||0xc8;return function(_0x4372fc){if(_0x4372fc){return _0x357bf6[_0xaad8('0x1c')](_0x1c70d3)[_0xaad8('0x1e')](_0x4372fc);}};}function respondWithFilteredResult(_0x28bf95,_0x5e4fbb){return function(_0x334c4d){if(_0x334c4d){var _0xb63cb3=typeof _0x5e4fbb['offset']===_0xaad8('0x1f')&&typeof _0x5e4fbb[_0xaad8('0x20')]===_0xaad8('0x1f');var _0xc17ada=_0x334c4d[_0xaad8('0x21')];var _0x3895e2=_0xb63cb3?0x0:_0x5e4fbb['offset'];var _0xfd8b0a=_0xb63cb3?_0x334c4d[_0xaad8('0x21')]:_0x5e4fbb['offset']+_0x5e4fbb[_0xaad8('0x20')];var _0x4c681e;if(_0xfd8b0a>=_0xc17ada){_0xfd8b0a=_0xc17ada;_0x4c681e=0xc8;}else{_0x4c681e=0xce;}_0x28bf95[_0xaad8('0x1c')](_0x4c681e);return _0x28bf95[_0xaad8('0x22')](_0xaad8('0x23'),_0x3895e2+'-'+_0xfd8b0a+'/'+_0xc17ada)[_0xaad8('0x1e')](_0x334c4d);}return null;};}function patchUpdates(_0x5cb39b){return function(_0x18b856){try{jsonpatch[_0xaad8('0x24')](_0x18b856,_0x5cb39b,!![]);}catch(_0x594681){return BPromise[_0xaad8('0x25')](_0x594681);}return _0x18b856[_0xaad8('0x26')]();};}function saveUpdates(_0x262e57,_0x5b4b61){return function(_0x5ba0fb){if(_0x5ba0fb){return _0x5ba0fb[_0xaad8('0x27')](_0x262e57)[_0xaad8('0x28')](function(_0x3930f0){return _0x3930f0;});}return null;};}function removeEntity(_0x15e0c6,_0x29ba69){return function(_0x1daacf){if(_0x1daacf){return _0x1daacf[_0xaad8('0x29')]()[_0xaad8('0x28')](function(){var _0x477d29=_0x1daacf[_0xaad8('0x2a')]({'plain':!![]});var _0x1bbac4=_0xaad8('0x2b');return db[_0xaad8('0x2c')][_0xaad8('0x29')]({'where':{'type':_0x1bbac4,'resourceId':_0x477d29['id']}})[_0xaad8('0x28')](function(){return _0x1daacf;});})['then'](function(){_0x15e0c6[_0xaad8('0x1c')](0xcc)[_0xaad8('0x1d')]();});}};}function handleEntityNotFound(_0x3f066f,_0x47b7a2){return function(_0x237c67){if(!_0x237c67){_0x3f066f[_0xaad8('0x1b')](0x194);}return _0x237c67;};}function handleError(_0x36b180,_0x1ca776){_0x1ca776=_0x1ca776||0x1f4;return function(_0x24c01d){logger['error'](_0x24c01d[_0xaad8('0x2d')]);if(_0x24c01d[_0xaad8('0x2e')]){delete _0x24c01d[_0xaad8('0x2e')];}_0x36b180[_0xaad8('0x1c')](_0x1ca776)[_0xaad8('0x2f')](_0x24c01d);};}exports['index']=function(_0x78c862,_0x4030ea){var _0x20ea82={},_0x22f47a={},_0x47ffb7={'count':0x0,'rows':[]};var _0x30b0e2=_[_0xaad8('0x30')](db[_0xaad8('0x31')][_0xaad8('0x32')],function(_0x254ee5){return{'name':_0x254ee5['fieldName'],'type':_0x254ee5[_0xaad8('0x33')][_0xaad8('0x34')]};});_0x22f47a['model']=_['map'](_0x30b0e2,_0xaad8('0x2e'));_0x22f47a[_0xaad8('0x35')]=_[_0xaad8('0x36')](_0x78c862[_0xaad8('0x35')]);_0x22f47a['filters']=_[_0xaad8('0x37')](_0x22f47a[_0xaad8('0x38')],_0x22f47a['query']);_0x20ea82['attributes']=_[_0xaad8('0x37')](_0x22f47a[_0xaad8('0x38')],qs['fields'](_0x78c862[_0xaad8('0x35')]['fields']));_0x20ea82['attributes']=_0x20ea82[_0xaad8('0x39')][_0xaad8('0x3a')]?_0x20ea82['attributes']:_0x22f47a[_0xaad8('0x38')];if(!_0x78c862[_0xaad8('0x35')][_0xaad8('0x3b')](_0xaad8('0x3c'))){_0x20ea82['limit']=qs[_0xaad8('0x20')](_0x78c862[_0xaad8('0x35')][_0xaad8('0x20')]);_0x20ea82[_0xaad8('0x3d')]=qs[_0xaad8('0x3d')](_0x78c862[_0xaad8('0x35')]['offset']);}_0x20ea82[_0xaad8('0x3e')]=qs[_0xaad8('0x3f')](_0x78c862[_0xaad8('0x35')]['sort']);_0x20ea82[_0xaad8('0x40')]=qs[_0xaad8('0x41')](_[_0xaad8('0x42')](_0x78c862[_0xaad8('0x35')],_0x22f47a[_0xaad8('0x41')]),_0x30b0e2);if(_0x78c862[_0xaad8('0x35')][_0xaad8('0x43')]){_0x20ea82['where']=_[_0xaad8('0x44')](_0x20ea82[_0xaad8('0x40')],{'$or':_[_0xaad8('0x30')](_0x30b0e2,function(_0x25c0a4){if(_0x25c0a4[_0xaad8('0x33')]!==_0xaad8('0x45')){var _0x4e4081={};_0x4e4081[_0x25c0a4[_0xaad8('0x2e')]]={'$like':'%'+_0x78c862[_0xaad8('0x35')][_0xaad8('0x43')]+'%'};return _0x4e4081;}})});}_0x20ea82=_[_0xaad8('0x44')]({},_0x20ea82,_0x78c862['options']);var _0x543761={'where':_0x20ea82['where']};return db[_0xaad8('0x31')][_0xaad8('0x21')](_0x543761)[_0xaad8('0x28')](function(_0x5bb668){_0x47ffb7[_0xaad8('0x21')]=_0x5bb668;if(_0x78c862[_0xaad8('0x35')]['includeAll']){_0x20ea82[_0xaad8('0x46')]=[{'all':!![]}];}return db[_0xaad8('0x31')][_0xaad8('0x47')](_0x20ea82);})[_0xaad8('0x28')](function(_0x3933ac){_0x47ffb7[_0xaad8('0x48')]=_0x3933ac;return _0x47ffb7;})[_0xaad8('0x28')](respondWithFilteredResult(_0x4030ea,_0x20ea82))[_0xaad8('0x49')](handleError(_0x4030ea,null));};exports[_0xaad8('0x4a')]=function(_0xbd5191,_0x29432a){var _0x241ceb={'raw':!![],'where':{'id':_0xbd5191['params']['id']}},_0x4b5b76={};_0x4b5b76['model']=_[_0xaad8('0x36')](db['Tag'][_0xaad8('0x32')]);_0x4b5b76['query']=_['keys'](_0xbd5191[_0xaad8('0x35')]);_0x4b5b76['filters']=_[_0xaad8('0x37')](_0x4b5b76[_0xaad8('0x38')],_0x4b5b76[_0xaad8('0x35')]);_0x241ceb[_0xaad8('0x39')]=_[_0xaad8('0x37')](_0x4b5b76[_0xaad8('0x38')],qs[_0xaad8('0x4b')](_0xbd5191[_0xaad8('0x35')][_0xaad8('0x4b')]));_0x241ceb[_0xaad8('0x39')]=_0x241ceb[_0xaad8('0x39')][_0xaad8('0x3a')]?_0x241ceb[_0xaad8('0x39')]:_0x4b5b76[_0xaad8('0x38')];if(_0xbd5191[_0xaad8('0x35')]['includeAll']){_0x241ceb['include']=[{'all':!![]}];}_0x241ceb=_[_0xaad8('0x44')]({},_0x241ceb,_0xbd5191[_0xaad8('0x4c')]);return db[_0xaad8('0x31')]['find'](_0x241ceb)['then'](handleEntityNotFound(_0x29432a,null))[_0xaad8('0x28')](respondWithResult(_0x29432a,null))['catch'](handleError(_0x29432a,null));};exports[_0xaad8('0x4d')]=function(_0x1560ef,_0x313824){return db[_0xaad8('0x31')][_0xaad8('0x4d')](_0x1560ef[_0xaad8('0x4e')],{})[_0xaad8('0x28')](function(_0x23de0a){var _0xb19607=_0x1560ef['user'][_0xaad8('0x2a')]({'plain':!![]});if(!_0xb19607)throw new Error(_0xaad8('0x4f'));if(_0xb19607['role']===_0xaad8('0x50')){var _0x5e5ef1=_0x23de0a[_0xaad8('0x2a')]({'plain':!![]});var _0x15cb03=_0xaad8('0x2b');return db[_0xaad8('0x51')][_0xaad8('0x52')]({'where':{'name':_0x15cb03,'userProfileId':_0xb19607[_0xaad8('0x53')]},'raw':!![]})[_0xaad8('0x28')](function(_0x325a49){if(_0x325a49&&_0x325a49[_0xaad8('0x54')]===0x0){return db['UserProfileResource'][_0xaad8('0x4d')]({'name':_0x5e5ef1[_0xaad8('0x2e')],'resourceId':_0x5e5ef1['id'],'type':_0x325a49[_0xaad8('0x2e')],'sectionId':_0x325a49['id']},{})[_0xaad8('0x28')](function(){return _0x23de0a;});}else{return _0x23de0a;}})[_0xaad8('0x49')](function(_0x9bf893){logger['error'](_0xaad8('0x55'),_0x9bf893);throw _0x9bf893;});}return _0x23de0a;})[_0xaad8('0x28')](respondWithResult(_0x313824,0xc9))['catch'](handleError(_0x313824,null));};exports['update']=function(_0x33e743,_0x1202d4){if(_0x33e743[_0xaad8('0x4e')]['id']){delete _0x33e743[_0xaad8('0x4e')]['id'];}return db[_0xaad8('0x31')][_0xaad8('0x52')]({'where':{'id':_0x33e743['params']['id']}})[_0xaad8('0x28')](handleEntityNotFound(_0x1202d4,null))[_0xaad8('0x28')](saveUpdates(_0x33e743[_0xaad8('0x4e')],null))[_0xaad8('0x28')](respondWithResult(_0x1202d4,null))[_0xaad8('0x49')](handleError(_0x1202d4,null));};exports['destroy']=function(_0x5ddb77,_0x48edf6){return db[_0xaad8('0x31')][_0xaad8('0x52')]({'where':{'id':_0x5ddb77['params']['id']}})[_0xaad8('0x28')](handleEntityNotFound(_0x48edf6,null))[_0xaad8('0x28')](removeEntity(_0x48edf6,null))[_0xaad8('0x49')](handleError(_0x48edf6,null));}; \ No newline at end of file +var _0x073e=['save','update','then','destroy','stack','name','send','index','Tag','fieldName','type','map','keys','query','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','count','limit','set','Content-Range','apply','reject'];(function(_0x369b1b,_0x1a0416){var _0x331879=function(_0xb821c3){while(--_0xb821c3){_0x369b1b['push'](_0x369b1b['shift']());}};_0x331879(++_0x1a0416);}(_0x073e,0x181));var _0xe073=function(_0x27ee81,_0x336e7a){_0x27ee81=_0x27ee81-0x0;var _0x267182=_0x073e[_0x27ee81];return _0x267182;};'use strict';var emlformat=require(_0xe073('0x0'));var rimraf=require(_0xe073('0x1'));var zipdir=require(_0xe073('0x2'));var jsonpatch=require(_0xe073('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe073('0x4'));var util=require(_0xe073('0x5'));var path=require(_0xe073('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe073('0x7'));var _=require(_0xe073('0x8'));var squel=require(_0xe073('0x9'));var crypto=require(_0xe073('0xa'));var jsforce=require(_0xe073('0xb'));var deskjs=require(_0xe073('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe073('0xd'));var Papa=require(_0xe073('0xe'));var Redis=require(_0xe073('0xf'));var authService=require(_0xe073('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe073('0x11'));var hardwareService=require(_0xe073('0x12'));var logger=require(_0xe073('0x13'))(_0xe073('0x14'));var utils=require(_0xe073('0x15'));var config=require(_0xe073('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe073('0x17'))['db'];function respondWithStatusCode(_0x56e3f5,_0x3dedf7){_0x3dedf7=_0x3dedf7||0xcc;return function(_0x5d2f2f){if(_0x5d2f2f){return _0x56e3f5[_0xe073('0x18')](_0x3dedf7);}return _0x56e3f5['status'](_0x3dedf7)[_0xe073('0x19')]();};}function respondWithResult(_0x27d34,_0x47828d){_0x47828d=_0x47828d||0xc8;return function(_0x2ce92d){if(_0x2ce92d){return _0x27d34[_0xe073('0x1a')](_0x47828d)[_0xe073('0x1b')](_0x2ce92d);}};}function respondWithFilteredResult(_0x2f4b36,_0xfb28f5){return function(_0x208f2e){if(_0x208f2e){var _0x26f3d3=typeof _0xfb28f5[_0xe073('0x1c')]==='undefined'&&typeof _0xfb28f5['limit']==='undefined';var _0x4c578c=_0x208f2e[_0xe073('0x1d')];var _0x10486c=_0x26f3d3?0x0:_0xfb28f5[_0xe073('0x1c')];var _0x4f9c8e=_0x26f3d3?_0x208f2e[_0xe073('0x1d')]:_0xfb28f5[_0xe073('0x1c')]+_0xfb28f5[_0xe073('0x1e')];var _0x54c10e;if(_0x4f9c8e>=_0x4c578c){_0x4f9c8e=_0x4c578c;_0x54c10e=0xc8;}else{_0x54c10e=0xce;}_0x2f4b36[_0xe073('0x1a')](_0x54c10e);return _0x2f4b36[_0xe073('0x1f')](_0xe073('0x20'),_0x10486c+'-'+_0x4f9c8e+'/'+_0x4c578c)[_0xe073('0x1b')](_0x208f2e);}return null;};}function patchUpdates(_0x43668e){return function(_0x17dd4b){try{jsonpatch[_0xe073('0x21')](_0x17dd4b,_0x43668e,!![]);}catch(_0x1d7a13){return BPromise[_0xe073('0x22')](_0x1d7a13);}return _0x17dd4b[_0xe073('0x23')]();};}function saveUpdates(_0x5143fa,_0x4405fd){return function(_0x21f9c2){if(_0x21f9c2){return _0x21f9c2[_0xe073('0x24')](_0x5143fa)[_0xe073('0x25')](function(_0x39bcb4){return _0x39bcb4;});}return null;};}function removeEntity(_0x275aa8,_0x504c26){return function(_0x4c76ef){if(_0x4c76ef){return _0x4c76ef[_0xe073('0x26')]()['then'](function(){var _0x5e3b16=_0x4c76ef['get']({'plain':!![]});var _0x5c4137='Tags';return db['UserProfileResource'][_0xe073('0x26')]({'where':{'type':_0x5c4137,'resourceId':_0x5e3b16['id']}})[_0xe073('0x25')](function(){return _0x4c76ef;});})['then'](function(){_0x275aa8[_0xe073('0x1a')](0xcc)[_0xe073('0x19')]();});}};}function handleEntityNotFound(_0x436c34,_0x5a5b2b){return function(_0x10f5ba){if(!_0x10f5ba){_0x436c34['sendStatus'](0x194);}return _0x10f5ba;};}function handleError(_0x255d91,_0x2e5fac){_0x2e5fac=_0x2e5fac||0x1f4;return function(_0x599972){logger['error'](_0x599972[_0xe073('0x27')]);if(_0x599972[_0xe073('0x28')]){delete _0x599972[_0xe073('0x28')];}_0x255d91[_0xe073('0x1a')](_0x2e5fac)[_0xe073('0x29')](_0x599972);};}exports[_0xe073('0x2a')]=function(_0x4f60dd,_0x2a206a){var _0x5c04fe={},_0x1baa0a={},_0x1cdcb0={'count':0x0,'rows':[]};var _0x4a6884=_['map'](db[_0xe073('0x2b')]['rawAttributes'],function(_0x3f6564){return{'name':_0x3f6564[_0xe073('0x2c')],'type':_0x3f6564[_0xe073('0x2d')]['key']};});_0x1baa0a['model']=_[_0xe073('0x2e')](_0x4a6884,_0xe073('0x28'));_0x1baa0a['query']=_[_0xe073('0x2f')](_0x4f60dd[_0xe073('0x30')]);_0x1baa0a[_0xe073('0x31')]=_['intersection'](_0x1baa0a[_0xe073('0x32')],_0x1baa0a['query']);_0x5c04fe['attributes']=_[_0xe073('0x33')](_0x1baa0a[_0xe073('0x32')],qs[_0xe073('0x34')](_0x4f60dd['query'][_0xe073('0x34')]));_0x5c04fe[_0xe073('0x35')]=_0x5c04fe[_0xe073('0x35')]['length']?_0x5c04fe[_0xe073('0x35')]:_0x1baa0a[_0xe073('0x32')];if(!_0x4f60dd[_0xe073('0x30')][_0xe073('0x36')](_0xe073('0x37'))){_0x5c04fe[_0xe073('0x1e')]=qs['limit'](_0x4f60dd[_0xe073('0x30')][_0xe073('0x1e')]);_0x5c04fe[_0xe073('0x1c')]=qs['offset'](_0x4f60dd[_0xe073('0x30')][_0xe073('0x1c')]);}_0x5c04fe[_0xe073('0x38')]=qs[_0xe073('0x39')](_0x4f60dd[_0xe073('0x30')]['sort']);_0x5c04fe[_0xe073('0x3a')]=qs['filters'](_[_0xe073('0x3b')](_0x4f60dd[_0xe073('0x30')],_0x1baa0a[_0xe073('0x31')]),_0x4a6884);if(_0x4f60dd[_0xe073('0x30')][_0xe073('0x3c')]){_0x5c04fe[_0xe073('0x3a')]=_[_0xe073('0x3d')](_0x5c04fe[_0xe073('0x3a')],{'$or':_[_0xe073('0x2e')](_0x4a6884,function(_0x3d29e5){if(_0x3d29e5[_0xe073('0x2d')]!==_0xe073('0x3e')){var _0x16be1a={};_0x16be1a[_0x3d29e5['name']]={'$like':'%'+_0x4f60dd[_0xe073('0x30')]['filter']+'%'};return _0x16be1a;}})});}_0x5c04fe=_[_0xe073('0x3d')]({},_0x5c04fe,_0x4f60dd[_0xe073('0x3f')]);var _0x5a4e19={'where':_0x5c04fe[_0xe073('0x3a')]};return db['Tag'][_0xe073('0x1d')](_0x5a4e19)[_0xe073('0x25')](function(_0x93852a){_0x1cdcb0[_0xe073('0x1d')]=_0x93852a;if(_0x4f60dd[_0xe073('0x30')]['includeAll']){_0x5c04fe[_0xe073('0x40')]=[{'all':!![]}];}return db['Tag'][_0xe073('0x41')](_0x5c04fe);})[_0xe073('0x25')](function(_0x125d1f){_0x1cdcb0[_0xe073('0x42')]=_0x125d1f;return _0x1cdcb0;})[_0xe073('0x25')](respondWithFilteredResult(_0x2a206a,_0x5c04fe))[_0xe073('0x43')](handleError(_0x2a206a,null));};exports[_0xe073('0x44')]=function(_0x2f4939,_0x1b50c5){var _0x2d3ffe={'raw':!![],'where':{'id':_0x2f4939['params']['id']}},_0x2c312b={};_0x2c312b['model']=_[_0xe073('0x2f')](db[_0xe073('0x2b')][_0xe073('0x45')]);_0x2c312b[_0xe073('0x30')]=_[_0xe073('0x2f')](_0x2f4939['query']);_0x2c312b[_0xe073('0x31')]=_[_0xe073('0x33')](_0x2c312b[_0xe073('0x32')],_0x2c312b[_0xe073('0x30')]);_0x2d3ffe[_0xe073('0x35')]=_['intersection'](_0x2c312b[_0xe073('0x32')],qs['fields'](_0x2f4939['query'][_0xe073('0x34')]));_0x2d3ffe[_0xe073('0x35')]=_0x2d3ffe['attributes']['length']?_0x2d3ffe[_0xe073('0x35')]:_0x2c312b[_0xe073('0x32')];if(_0x2f4939[_0xe073('0x30')][_0xe073('0x46')]){_0x2d3ffe[_0xe073('0x40')]=[{'all':!![]}];}_0x2d3ffe=_[_0xe073('0x3d')]({},_0x2d3ffe,_0x2f4939[_0xe073('0x3f')]);return db['Tag'][_0xe073('0x47')](_0x2d3ffe)['then'](handleEntityNotFound(_0x1b50c5,null))[_0xe073('0x25')](respondWithResult(_0x1b50c5,null))[_0xe073('0x43')](handleError(_0x1b50c5,null));};exports[_0xe073('0x48')]=function(_0x4e1f1d,_0x4d5bcd){return db[_0xe073('0x2b')][_0xe073('0x48')](_0x4e1f1d[_0xe073('0x49')],{})['then'](function(_0x151035){var _0x338557=_0x4e1f1d[_0xe073('0x4a')][_0xe073('0x4b')]({'plain':!![]});if(!_0x338557)throw new Error(_0xe073('0x4c'));if(_0x338557[_0xe073('0x4d')]===_0xe073('0x4a')){var _0x307541=_0x151035[_0xe073('0x4b')]({'plain':!![]});var _0x5626d4=_0xe073('0x4e');return db['UserProfileSection'][_0xe073('0x47')]({'where':{'name':_0x5626d4,'userProfileId':_0x338557['userProfileId']},'raw':!![]})[_0xe073('0x25')](function(_0x202687){if(_0x202687&&_0x202687[_0xe073('0x4f')]===0x0){return db[_0xe073('0x50')]['create']({'name':_0x307541[_0xe073('0x28')],'resourceId':_0x307541['id'],'type':_0x202687[_0xe073('0x28')],'sectionId':_0x202687['id']},{})[_0xe073('0x25')](function(){return _0x151035;});}else{return _0x151035;}})['catch'](function(_0x5503c2){logger[_0xe073('0x51')](_0xe073('0x52'),_0x5503c2);throw _0x5503c2;});}return _0x151035;})[_0xe073('0x25')](respondWithResult(_0x4d5bcd,0xc9))[_0xe073('0x43')](handleError(_0x4d5bcd,null));};exports[_0xe073('0x24')]=function(_0x5212d5,_0x197c42){if(_0x5212d5[_0xe073('0x49')]['id']){delete _0x5212d5[_0xe073('0x49')]['id'];}return db[_0xe073('0x2b')][_0xe073('0x47')]({'where':{'id':_0x5212d5[_0xe073('0x53')]['id']}})[_0xe073('0x25')](handleEntityNotFound(_0x197c42,null))[_0xe073('0x25')](saveUpdates(_0x5212d5[_0xe073('0x49')],null))[_0xe073('0x25')](respondWithResult(_0x197c42,null))['catch'](handleError(_0x197c42,null));};exports[_0xe073('0x26')]=function(_0x582007,_0x5825eb){return db[_0xe073('0x2b')][_0xe073('0x47')]({'where':{'id':_0x582007[_0xe073('0x53')]['id']}})['then'](handleEntityNotFound(_0x5825eb,null))[_0xe073('0x25')](removeEntity(_0x5825eb,null))[_0xe073('0x43')](handleError(_0x5825eb,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 7209251..e362795 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 _0x4aa6=['../../config/logger','api','moment','request-promise','path','../../config/environment','exports','Tag','tools_tags','lodash','util'];(function(_0x443e1f,_0x35a1d8){var _0x288eb9=function(_0x3455ae){while(--_0x3455ae){_0x443e1f['push'](_0x443e1f['shift']());}};_0x288eb9(++_0x35a1d8);}(_0x4aa6,0x18a));var _0x64aa=function(_0x1a99ba,_0x1b1f7e){_0x1a99ba=_0x1a99ba-0x0;var _0x26376a=_0x4aa6[_0x1a99ba];return _0x26376a;};'use strict';var _=require(_0x64aa('0x0'));var util=require(_0x64aa('0x1'));var logger=require(_0x64aa('0x2'))(_0x64aa('0x3'));var moment=require(_0x64aa('0x4'));var BPromise=require('bluebird');var rp=require(_0x64aa('0x5'));var fs=require('fs');var path=require(_0x64aa('0x6'));var rimraf=require('rimraf');var config=require(_0x64aa('0x7'));var attributes=require('./tag.attributes');module[_0x64aa('0x8')]=function(_0x3abbf0,_0x30098c){return _0x3abbf0['define'](_0x64aa('0x9'),attributes,{'tableName':_0x64aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcddb=['api','bluebird','path','rimraf','exports','define','Tag','tools_tags','lodash','util','../../config/logger'];(function(_0x54eab6,_0x5e262f){var _0x1e7435=function(_0x468c91){while(--_0x468c91){_0x54eab6['push'](_0x54eab6['shift']());}};_0x1e7435(++_0x5e262f);}(_0xcddb,0x168));var _0xbcdd=function(_0x2d90f5,_0x309b75){_0x2d90f5=_0x2d90f5-0x0;var _0x438757=_0xcddb[_0x2d90f5];return _0x438757;};'use strict';var _=require(_0xbcdd('0x0'));var util=require(_0xbcdd('0x1'));var logger=require(_0xbcdd('0x2'))(_0xbcdd('0x3'));var moment=require('moment');var BPromise=require(_0xbcdd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbcdd('0x5'));var rimraf=require(_0xbcdd('0x6'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0xbcdd('0x7')]=function(_0xf8cf0a,_0x3a23a2){return _0xf8cf0a[_0xbcdd('0x8')](_0xbcdd('0x9'),attributes,{'tableName':_0xbcdd('0xa'),'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 a352f9e..f827532 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 _0x0bde=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','ioredis'];(function(_0x62a9c1,_0x1e5f1e){var _0x30e7f1=function(_0x4929f5){while(--_0x4929f5){_0x62a9c1['push'](_0x62a9c1['shift']());}};_0x30e7f1(++_0x1e5f1e);}(_0x0bde,0x110));var _0xe0bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0bde[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xe0bd('0x0'));var util=require('util');var moment=require(_0xe0bd('0x1'));var BPromise=require(_0xe0bd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0bd('0x3'));var db=require(_0xe0bd('0x4'))['db'];var utils=require(_0xe0bd('0x5'));var logger=require('../../config/logger')(_0xe0bd('0x6'));var config=require(_0xe0bd('0x7'));var jayson=require(_0xe0bd('0x8'));var client=jayson[_0xe0bd('0x9')][_0xe0bd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c8892,_0x29faee,_0x1b75c1){return new BPromise(function(_0xf790d6,_0x54d27f){return client[_0xe0bd('0xb')](_0x1c8892,_0x1b75c1)[_0xe0bd('0xc')](function(_0x12a5f1){logger['info'](_0xe0bd('0xd'),_0x29faee,_0xe0bd('0xe'));logger['debug'](_0xe0bd('0xf'),_0x29faee,'request\x20sent',JSON[_0xe0bd('0x10')](_0x12a5f1));if(_0x12a5f1[_0xe0bd('0x11')]){if(_0x12a5f1[_0xe0bd('0x11')][_0xe0bd('0x12')]===0x1f4){logger[_0xe0bd('0x11')](_0xe0bd('0xd'),_0x29faee,_0x12a5f1[_0xe0bd('0x11')]['message']);return _0x54d27f(_0x12a5f1[_0xe0bd('0x11')][_0xe0bd('0x13')]);}logger[_0xe0bd('0x11')]('Tag,\x20%s,\x20%s',_0x29faee,_0x12a5f1[_0xe0bd('0x11')]['message']);return _0xf790d6(_0x12a5f1[_0xe0bd('0x11')][_0xe0bd('0x13')]);}else{logger[_0xe0bd('0x14')](_0xe0bd('0xd'),_0x29faee,_0xe0bd('0xe'));_0xf790d6(_0x12a5f1[_0xe0bd('0x15')][_0xe0bd('0x13')]);}})[_0xe0bd('0x16')](function(_0x4ea791){logger['error'](_0xe0bd('0xd'),_0x29faee,_0x4ea791);_0x54d27f(_0x4ea791);});});} \ No newline at end of file +var _0x5ad3=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash'];(function(_0x492e80,_0x2c18c2){var _0x2ecd0a=function(_0x22083d){while(--_0x22083d){_0x492e80['push'](_0x492e80['shift']());}};_0x2ecd0a(++_0x2c18c2);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x483e3a,_0x568361){_0x483e3a=_0x483e3a-0x0;var _0x43fca9=_0x5ad3[_0x483e3a];return _0x43fca9;};'use strict';var _=require(_0x35ad('0x0'));var util=require(_0x35ad('0x1'));var moment=require(_0x35ad('0x2'));var BPromise=require(_0x35ad('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35ad('0x4'));var db=require(_0x35ad('0x5'))['db'];var utils=require(_0x35ad('0x6'));var logger=require(_0x35ad('0x7'))(_0x35ad('0x8'));var config=require(_0x35ad('0x9'));var jayson=require(_0x35ad('0xa'));var client=jayson[_0x35ad('0xb')][_0x35ad('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x31cc6a,_0x4edc59,_0x292521){return new BPromise(function(_0x3cec3e,_0x3f1f55){return client['request'](_0x31cc6a,_0x292521)[_0x35ad('0xd')](function(_0x487107){logger['info'](_0x35ad('0xe'),_0x4edc59,_0x35ad('0xf'));logger['debug'](_0x35ad('0x10'),_0x4edc59,_0x35ad('0xf'),JSON['stringify'](_0x487107));if(_0x487107['error']){if(_0x487107[_0x35ad('0x11')][_0x35ad('0x12')]===0x1f4){logger['error'](_0x35ad('0xe'),_0x4edc59,_0x487107[_0x35ad('0x11')]['message']);return _0x3f1f55(_0x487107['error'][_0x35ad('0x13')]);}logger[_0x35ad('0x11')](_0x35ad('0xe'),_0x4edc59,_0x487107['error'][_0x35ad('0x13')]);return _0x3cec3e(_0x487107[_0x35ad('0x11')]['message']);}else{logger[_0x35ad('0x14')]('Tag,\x20%s,\x20%s',_0x4edc59,'request\x20sent');_0x3cec3e(_0x487107[_0x35ad('0x15')][_0x35ad('0x13')]);}})[_0x35ad('0x16')](function(_0x56cb8e){logger[_0x35ad('0x11')](_0x35ad('0xe'),_0x4edc59,_0x56cb8e);_0x3f1f55(_0x56cb8e);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 59cb595..2b6708e 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(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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 78ecdf1..32a28d1 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 _0x757a=['exports','STRING'];(function(_0x1e7bdf,_0x28a2c4){var _0x2dfd3d=function(_0x47614a){while(--_0x47614a){_0x1e7bdf['push'](_0x1e7bdf['shift']());}};_0x2dfd3d(++_0x28a2c4);}(_0x757a,0xde));var _0xa757=function(_0xc0f837,_0x469d3d){_0xc0f837=_0xc0f837-0x0;var _0x144113=_0x757a[_0xc0f837];return _0x144113;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0x1a1062,_0x58c79d){var _0x3e21d8=function(_0x53b7ce){while(--_0x53b7ce){_0x1a1062['push'](_0x1a1062['shift']());}};_0x3e21d8(++_0x58c79d);}(_0x2032,0xd9));var _0x2203=function(_0x458172,_0x273c27){_0x458172=_0x458172-0x0;var _0x41c6fd=_0x2032[_0x458172];return _0x41c6fd;};'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/team/team.controller.js b/server/api/team/team.controller.js index 1e0489e..e789419 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 _0x6280=['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','WhatsappQueueId','UserWhatsappQueue','VoicePrefixId','getQueues','findOne','Unknown\x20channel','capitalize','channel','toLowerCase','Queue','pick','options','Queues','addQueues','isValidChannel','ValidationError','add','ids','remove','isArray','Voice','Sms','Fax','Openchannel','through','penalty','QueueId','User','findOrCreate','emit','Queue:save','interface','UserVoiceQueueRt','isNil','format','TeamVoiceQueue','all','TeamVoicePrefix','spread','removeAgents','Chat','Mail','Whatsapp','UserVoicePrefix','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./team.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','update','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','Team','includeAll','findAll','then','rows','catch','show','params','keys','length','include','find','create','body','user','get','Teams','autoAssociation','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\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','MailQueueId','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId'];(function(_0x4abd0b,_0x5b65f1){var _0x5356fc=function(_0x4a10b0){while(--_0x4a10b0){_0x4abd0b['push'](_0x4abd0b['shift']());}};_0x5356fc(++_0x5b65f1);}(_0x6280,0x15b));var _0x0628=function(_0x445bd5,_0x3e5c84){_0x445bd5=_0x445bd5-0x0;var _0x863f0e=_0x6280[_0x445bd5];return _0x863f0e;};'use strict';var emlformat=require(_0x0628('0x0'));var rimraf=require(_0x0628('0x1'));var zipdir=require(_0x0628('0x2'));var jsonpatch=require(_0x0628('0x3'));var rp=require(_0x0628('0x4'));var moment=require(_0x0628('0x5'));var BPromise=require(_0x0628('0x6'));var Mustache=require(_0x0628('0x7'));var util=require('util');var path=require(_0x0628('0x8'));var sox=require('sox');var csv=require(_0x0628('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0628('0xa'));var squel=require(_0x0628('0xb'));var crypto=require(_0x0628('0xc'));var jsforce=require(_0x0628('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0628('0xe'));var Papa=require('papaparse');var Redis=require(_0x0628('0xf'));var authService=require(_0x0628('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0628('0x11'));var hardwareService=require(_0x0628('0x12'));var logger=require(_0x0628('0x13'))(_0x0628('0x14'));var utils=require(_0x0628('0x15'));var config=require(_0x0628('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x0628('0x17')]=_[_0x0628('0x18')](config[_0x0628('0x17')],{'host':_0x0628('0x19'),'port':0x18eb});var socket=require(_0x0628('0x1a'))(new Redis(config[_0x0628('0x17')]));require(_0x0628('0x1b'))['register'](socket);function respondWithStatusCode(_0x55669a,_0x52c423){_0x52c423=_0x52c423||0xcc;return function(_0x1c76cb){if(_0x1c76cb){return _0x55669a[_0x0628('0x1c')](_0x52c423);}return _0x55669a[_0x0628('0x1d')](_0x52c423)[_0x0628('0x1e')]();};}function respondWithResult(_0x5222fd,_0x17e5d2){_0x17e5d2=_0x17e5d2||0xc8;return function(_0xf86632){if(_0xf86632){return _0x5222fd['status'](_0x17e5d2)[_0x0628('0x1f')](_0xf86632);}};}function respondWithFilteredResult(_0x58b1fb,_0x1749f7){return function(_0x49c803){if(_0x49c803){var _0x2d49b4=typeof _0x1749f7[_0x0628('0x20')]==='undefined'&&typeof _0x1749f7[_0x0628('0x21')]===_0x0628('0x22');var _0x4006fa=_0x49c803[_0x0628('0x23')];var _0x58a1e6=_0x2d49b4?0x0:_0x1749f7[_0x0628('0x20')];var _0x1d9a76=_0x2d49b4?_0x49c803[_0x0628('0x23')]:_0x1749f7[_0x0628('0x20')]+_0x1749f7['limit'];var _0xb66ec5;if(_0x1d9a76>=_0x4006fa){_0x1d9a76=_0x4006fa;_0xb66ec5=0xc8;}else{_0xb66ec5=0xce;}_0x58b1fb[_0x0628('0x1d')](_0xb66ec5);return _0x58b1fb[_0x0628('0x24')]('Content-Range',_0x58a1e6+'-'+_0x1d9a76+'/'+_0x4006fa)[_0x0628('0x1f')](_0x49c803);}return null;};}function patchUpdates(_0x5126c2){return function(_0x9588ff){try{jsonpatch['apply'](_0x9588ff,_0x5126c2,!![]);}catch(_0x529d93){return BPromise[_0x0628('0x25')](_0x529d93);}return _0x9588ff['save']();};}function saveUpdates(_0x54a60a,_0x166297){return function(_0x288efb){if(_0x288efb){return _0x288efb[_0x0628('0x26')](_0x54a60a)['then'](function(_0x270fea){return _0x270fea;});}return null;};}function handleEntityNotFound(_0x501483,_0x23daea){return function(_0x4b81f2){if(!_0x4b81f2){_0x501483[_0x0628('0x1c')](0x194);}return _0x4b81f2;};}function handleError(_0xb39be7,_0x489343){_0x489343=_0x489343||0x1f4;return function(_0x19191e){logger[_0x0628('0x27')](_0x19191e[_0x0628('0x28')]);if(_0x19191e[_0x0628('0x29')]){delete _0x19191e[_0x0628('0x29')];}_0xb39be7[_0x0628('0x1d')](_0x489343)[_0x0628('0x2a')](_0x19191e);};}exports['index']=function(_0x46a72d,_0x1e0344){var _0x52d9f8={},_0x9fbbd9={},_0x5bf125={'count':0x0,'rows':[]};var _0x12f2ba=_[_0x0628('0x2b')](db['Team'][_0x0628('0x2c')],function(_0x344f41){return{'name':_0x344f41[_0x0628('0x2d')],'type':_0x344f41[_0x0628('0x2e')]['key']};});_0x9fbbd9[_0x0628('0x2f')]=_[_0x0628('0x2b')](_0x12f2ba,_0x0628('0x29'));_0x9fbbd9[_0x0628('0x30')]=_['keys'](_0x46a72d[_0x0628('0x30')]);_0x9fbbd9[_0x0628('0x31')]=_[_0x0628('0x32')](_0x9fbbd9['model'],_0x9fbbd9[_0x0628('0x30')]);_0x52d9f8[_0x0628('0x33')]=_['intersection'](_0x9fbbd9[_0x0628('0x2f')],qs[_0x0628('0x34')](_0x46a72d[_0x0628('0x30')][_0x0628('0x34')]));_0x52d9f8[_0x0628('0x33')]=_0x52d9f8['attributes']['length']?_0x52d9f8['attributes']:_0x9fbbd9[_0x0628('0x2f')];if(!_0x46a72d[_0x0628('0x30')][_0x0628('0x35')](_0x0628('0x36'))){_0x52d9f8[_0x0628('0x21')]=qs[_0x0628('0x21')](_0x46a72d[_0x0628('0x30')][_0x0628('0x21')]);_0x52d9f8[_0x0628('0x20')]=qs[_0x0628('0x20')](_0x46a72d[_0x0628('0x30')][_0x0628('0x20')]);}_0x52d9f8[_0x0628('0x37')]=qs[_0x0628('0x38')](_0x46a72d[_0x0628('0x30')]['sort']);_0x52d9f8['where']=qs['filters'](_['pick'](_0x46a72d[_0x0628('0x30')],_0x9fbbd9[_0x0628('0x31')]),_0x12f2ba);if(_0x46a72d[_0x0628('0x30')][_0x0628('0x39')]){_0x52d9f8[_0x0628('0x3a')]=_[_0x0628('0x3b')](_0x52d9f8[_0x0628('0x3a')],{'$or':_[_0x0628('0x2b')](_0x12f2ba,function(_0x5bc223){if(_0x5bc223[_0x0628('0x2e')]!==_0x0628('0x3c')){var _0x2d11d1={};_0x2d11d1[_0x5bc223[_0x0628('0x29')]]={'$like':'%'+_0x46a72d[_0x0628('0x30')][_0x0628('0x39')]+'%'};return _0x2d11d1;}})});}_0x52d9f8=_[_0x0628('0x3b')]({},_0x52d9f8,_0x46a72d['options']);var _0x1caa99={'where':_0x52d9f8[_0x0628('0x3a')]};return db[_0x0628('0x3d')][_0x0628('0x23')](_0x1caa99)['then'](function(_0x3842d5){_0x5bf125[_0x0628('0x23')]=_0x3842d5;if(_0x46a72d[_0x0628('0x30')][_0x0628('0x3e')]){_0x52d9f8['include']=[{'all':!![]}];}return db['Team'][_0x0628('0x3f')](_0x52d9f8);})[_0x0628('0x40')](function(_0x4c2a24){_0x5bf125[_0x0628('0x41')]=_0x4c2a24;return _0x5bf125;})[_0x0628('0x40')](respondWithFilteredResult(_0x1e0344,_0x52d9f8))[_0x0628('0x42')](handleError(_0x1e0344,null));};exports[_0x0628('0x43')]=function(_0x3e23f0,_0x48d4e9){var _0x36505e={'raw':![],'where':{'id':_0x3e23f0[_0x0628('0x44')]['id']}},_0x5b83c5={};_0x5b83c5[_0x0628('0x2f')]=_[_0x0628('0x45')](db['Team'][_0x0628('0x2c')]);_0x5b83c5[_0x0628('0x30')]=_['keys'](_0x3e23f0['query']);_0x5b83c5[_0x0628('0x31')]=_[_0x0628('0x32')](_0x5b83c5[_0x0628('0x2f')],_0x5b83c5[_0x0628('0x30')]);_0x36505e[_0x0628('0x33')]=_['intersection'](_0x5b83c5['model'],qs[_0x0628('0x34')](_0x3e23f0['query'][_0x0628('0x34')]));_0x36505e['attributes']=_0x36505e['attributes'][_0x0628('0x46')]?_0x36505e[_0x0628('0x33')]:_0x5b83c5[_0x0628('0x2f')];if(_0x3e23f0[_0x0628('0x30')]['includeAll']){_0x36505e[_0x0628('0x47')]=[{'all':!![]}];}_0x36505e=_[_0x0628('0x3b')]({},_0x36505e,_0x3e23f0['options']);return db['Team'][_0x0628('0x48')](_0x36505e)['then'](handleEntityNotFound(_0x48d4e9,null))[_0x0628('0x40')](respondWithResult(_0x48d4e9,null))[_0x0628('0x42')](handleError(_0x48d4e9,null));};exports[_0x0628('0x49')]=function(_0x8b558b,_0x2ebcc7){return db[_0x0628('0x3d')][_0x0628('0x49')](_0x8b558b[_0x0628('0x4a')],{})[_0x0628('0x40')](function(_0x27d377){var _0x427918=_0x8b558b[_0x0628('0x4b')]['get']({'plain':!![]});if(!_0x427918)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x427918['role']===_0x0628('0x4b')){var _0x4af13e=_0x27d377[_0x0628('0x4c')]({'plain':!![]});var _0x2d67fd=_0x0628('0x4d');return db['UserProfileSection'][_0x0628('0x48')]({'where':{'name':_0x2d67fd,'userProfileId':_0x427918['userProfileId']},'raw':!![]})[_0x0628('0x40')](function(_0x1a48b8){if(_0x1a48b8&&_0x1a48b8[_0x0628('0x4e')]===0x0){return db[_0x0628('0x4f')][_0x0628('0x49')]({'name':_0x4af13e[_0x0628('0x29')],'resourceId':_0x4af13e['id'],'type':_0x1a48b8[_0x0628('0x29')],'sectionId':_0x1a48b8['id']},{})['then'](function(){return _0x27d377;});}else{return _0x27d377;}})[_0x0628('0x42')](function(_0x552793){logger[_0x0628('0x27')](_0x0628('0x50'),_0x552793);throw _0x552793;});}return _0x27d377;})['then'](respondWithResult(_0x2ebcc7,0xc9))[_0x0628('0x42')](handleError(_0x2ebcc7,null));};exports[_0x0628('0x26')]=function(_0x470668,_0x33a091){if(_0x470668[_0x0628('0x4a')]['id']){delete _0x470668[_0x0628('0x4a')]['id'];}return db[_0x0628('0x3d')][_0x0628('0x48')]({'where':{'id':_0x470668[_0x0628('0x44')]['id']}})[_0x0628('0x40')](handleEntityNotFound(_0x33a091,null))['then'](saveUpdates(_0x470668[_0x0628('0x4a')],null))['then'](respondWithResult(_0x33a091,null))[_0x0628('0x42')](handleError(_0x33a091,null));};exports[_0x0628('0x51')]=function(_0x1c5f8e,_0x185409){var _0x46768c=_0x1c5f8e[_0x0628('0x44')]['id'];var _0xb5b193=[];return db[_0x0628('0x52')][_0x0628('0x53')](function(_0x543bf4){var _0x2825ab=_0x0628('0x54')+_0x46768c;return db[_0x0628('0x52')][_0x0628('0x30')](_0x2825ab,{'type':db[_0x0628('0x55')][_0x0628('0x56')]['SELECT'],'raw':!![],'transaction':_0x543bf4})[_0x0628('0x40')](function(_0x2cdefc){_0xb5b193=_[_0x0628('0x2b')](_0x2cdefc,function(_0x54177f){return Number(_0x54177f['UserId']);});})['then'](function(){var _0x1d40a8=_0x0628('0x57')+_0x46768c;return db[_0x0628('0x52')][_0x0628('0x30')](_0x1d40a8,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x543bf4});})[_0x0628('0x40')](function(_0x320424){var _0x27ffe1=_[_0x0628('0x2b')](_0x320424,function(_0x277308){return Number(_0x277308[_0x0628('0x58')]);});return db[_0x0628('0x59')][_0x0628('0x51')]({'where':{'UserId':{'$in':_0xb5b193},'VoiceQueueId':{'$in':_0x27ffe1}},'transaction':_0x543bf4});})['then'](function(){var _0x119852=_0x0628('0x5a')+_0x46768c;return db[_0x0628('0x52')][_0x0628('0x30')](_0x119852,{'type':db[_0x0628('0x55')][_0x0628('0x56')][_0x0628('0x5b')],'raw':!![],'transaction':_0x543bf4});})[_0x0628('0x40')](function(_0x5d298b){var _0x1e0286=_[_0x0628('0x2b')](_0x5d298b,function(_0xf8dd8b){return Number(_0xf8dd8b[_0x0628('0x5c')]);});return db['UserMailQueue'][_0x0628('0x51')]({'where':{'UserId':{'$in':_0xb5b193},'MailQueueId':{'$in':_0x1e0286}},'transaction':_0x543bf4});})[_0x0628('0x40')](function(){var _0x4c650f='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x46768c;return db[_0x0628('0x52')][_0x0628('0x30')](_0x4c650f,{'type':db[_0x0628('0x55')][_0x0628('0x56')][_0x0628('0x5b')],'raw':!![],'transaction':_0x543bf4});})[_0x0628('0x40')](function(_0x4c3b59){var _0x490ea6=_['map'](_0x4c3b59,function(_0x3118a8){return Number(_0x3118a8[_0x0628('0x5d')]);});return db[_0x0628('0x5e')][_0x0628('0x51')]({'where':{'UserId':{'$in':_0xb5b193},'SmsQueueId':{'$in':_0x490ea6}},'transaction':_0x543bf4});})['then'](function(){var _0x2ff30f=_0x0628('0x5f')+_0x46768c;return db[_0x0628('0x52')][_0x0628('0x30')](_0x2ff30f,{'type':db[_0x0628('0x55')]['QueryTypes'][_0x0628('0x5b')],'raw':!![],'transaction':_0x543bf4});})[_0x0628('0x40')](function(_0x50716d){var _0x27696b=_[_0x0628('0x2b')](_0x50716d,function(_0xa9188a){return Number(_0xa9188a[_0x0628('0x60')]);});return db[_0x0628('0x61')][_0x0628('0x51')]({'where':{'UserId':{'$in':_0xb5b193},'ChatQueueId':{'$in':_0x27696b}},'transaction':_0x543bf4});})['then'](function(){var _0x3d6332=_0x0628('0x62')+_0x46768c;return db[_0x0628('0x52')][_0x0628('0x30')](_0x3d6332,{'type':db['Sequelize'][_0x0628('0x56')]['SELECT'],'raw':!![],'transaction':_0x543bf4});})[_0x0628('0x40')](function(_0x4bf7c4){var _0x46141e=_['map'](_0x4bf7c4,function(_0x4c3499){return Number(_0x4c3499[_0x0628('0x63')]);});return db['UserFaxQueue'][_0x0628('0x51')]({'where':{'UserId':{'$in':_0xb5b193},'FaxQueueId':{'$in':_0x46141e}},'transaction':_0x543bf4});})[_0x0628('0x40')](function(){var _0x3e47a7=_0x0628('0x64')+_0x46768c;return db[_0x0628('0x52')][_0x0628('0x30')](_0x3e47a7,{'type':db[_0x0628('0x55')][_0x0628('0x56')][_0x0628('0x5b')],'raw':!![],'transaction':_0x543bf4});})[_0x0628('0x40')](function(_0x4a309c){var _0x5b15a1=_[_0x0628('0x2b')](_0x4a309c,function(_0x4ea25c){return Number(_0x4ea25c[_0x0628('0x65')]);});return db[_0x0628('0x66')][_0x0628('0x51')]({'where':{'UserId':{'$in':_0xb5b193},'OpenchannelQueueId':{'$in':_0x5b15a1}},'transaction':_0x543bf4});})[_0x0628('0x40')](function(){var _0x48d4ac='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x46768c;return db[_0x0628('0x52')][_0x0628('0x30')](_0x48d4ac,{'type':db[_0x0628('0x55')][_0x0628('0x56')][_0x0628('0x5b')],'raw':!![],'transaction':_0x543bf4});})['then'](function(_0x217b44){var _0x25253d=_['map'](_0x217b44,function(_0x56deb9){return Number(_0x56deb9[_0x0628('0x67')]);});return db[_0x0628('0x68')][_0x0628('0x51')]({'where':{'UserId':{'$in':_0xb5b193},'WhatsappQueueId':{'$in':_0x25253d}},'transaction':_0x543bf4});})['then'](function(){return db['TeamVoicePrefix'][_0x0628('0x48')]({'where':{'TeamId':_0x46768c}});})[_0x0628('0x40')](function(_0x332d4a){if(_0x332d4a===null){return;}return db['UserVoicePrefix'][_0x0628('0x51')]({'where':{'UserId':{'$in':_0xb5b193},'VoicePrefixId':_0x332d4a[_0x0628('0x69')]},'transaction':_0x543bf4});})[_0x0628('0x40')](function(){return db['Team'][_0x0628('0x51')]({'where':{'id':_0x46768c},'cascade':!![],'transaction':_0x543bf4});})['then'](function(_0x519193){if(_0x519193===0x0){_0x185409['sendStatus'](0x194);}else{return db[_0x0628('0x4f')][_0x0628('0x51')]({'where':{'type':'Teams','resourceId':_0x46768c},'cascade':!![],'transaction':_0x543bf4})[_0x0628('0x40')](function(){_0x185409[_0x0628('0x1d')](0xcc)[_0x0628('0x1e')]();});}})[_0x0628('0x42')](function(_0x2d3a56){_0x185409[_0x0628('0x1d')](0x1f4)[_0x0628('0x2a')](_0x2d3a56);});});};exports[_0x0628('0x6a')]=function(_0x3c3162,_0x3464e8,_0x55b72e){return db['Team'][_0x0628('0x6b')]({'where':{'id':_0x3c3162[_0x0628('0x44')]['id']}})[_0x0628('0x40')](handleEntityNotFound(_0x3464e8,null))[_0x0628('0x40')](function(_0x1cf98e){if(!_0x3c3162['query']['channel']||!utils['isValidChannel'](_0x3c3162['query']['channel'])){throw new db[(_0x0628('0x55'))]['ValidationError'](_0x0628('0x6c'));}var _0x3565e0={};var _0x5b5726={};_0x5b5726['model']=_['keys'](db[_[_0x0628('0x6d')](_0x3c3162[_0x0628('0x30')][_0x0628('0x6e')][_0x0628('0x6f')]())+_0x0628('0x70')][_0x0628('0x2c')]);_0x5b5726['query']=_[_0x0628('0x45')](_0x3c3162[_0x0628('0x30')]);_0x5b5726[_0x0628('0x31')]=_['intersection'](_0x5b5726[_0x0628('0x2f')],_0x5b5726[_0x0628('0x30')]);_0x3565e0[_0x0628('0x33')]=_[_0x0628('0x32')](_0x5b5726[_0x0628('0x2f')],qs[_0x0628('0x34')](_0x3c3162['query'][_0x0628('0x34')]));_0x3565e0[_0x0628('0x33')]=_0x3565e0[_0x0628('0x33')][_0x0628('0x46')]?_0x3565e0['attributes']:_0x5b5726['model'];_0x3565e0[_0x0628('0x21')]=qs[_0x0628('0x21')](_0x3c3162[_0x0628('0x30')][_0x0628('0x21')]);_0x3565e0['offset']=qs[_0x0628('0x20')](_0x3c3162[_0x0628('0x30')][_0x0628('0x20')]);_0x3565e0['order']=qs[_0x0628('0x38')](_0x3c3162[_0x0628('0x30')]['sort']);_0x3565e0[_0x0628('0x3a')]=qs[_0x0628('0x31')](_[_0x0628('0x71')](_0x3c3162[_0x0628('0x30')],_0x5b5726[_0x0628('0x31')]));_0x3565e0=_['merge']({},_0x3565e0,_0x3c3162[_0x0628('0x72')]);return _0x1cf98e[_0x0628('0x4c')+_[_0x0628('0x6d')](_0x3c3162['query'][_0x0628('0x6e')]['toLowerCase']())+_0x0628('0x73')](_0x3565e0);})['then'](respondWithResult(_0x3464e8,null))[_0x0628('0x42')](handleError(_0x3464e8,null));};exports[_0x0628('0x74')]=function(_0x534b87,_0xa34165,_0x10be4e){return db[_0x0628('0x3d')]['findOne']({'where':{'id':_0x534b87[_0x0628('0x44')]['id']}})[_0x0628('0x40')](function(_0x49693f){if(_0x49693f){if(!_0x534b87[_0x0628('0x4a')][_0x0628('0x6e')]||!utils[_0x0628('0x75')](_0x534b87[_0x0628('0x4a')]['channel'])){throw new db[(_0x0628('0x55'))][(_0x0628('0x76'))](_0x0628('0x6c'));}return _0x49693f[_0x0628('0x77')+_[_0x0628('0x6d')](_0x534b87['body'][_0x0628('0x6e')][_0x0628('0x6f')]())+'Queues'](_0x534b87[_0x0628('0x4a')][_0x0628('0x78')]);}return null;})[_0x0628('0x40')](handleEntityNotFound(_0xa34165,null))[_0x0628('0x40')](respondWithStatusCode(_0xa34165,null))[_0x0628('0x42')](handleError(_0xa34165,null));};exports['removeQueues']=function(_0x2020cf,_0x22746c,_0x3ab809){return db[_0x0628('0x3d')][_0x0628('0x6b')]({'where':{'id':_0x2020cf['params']['id']}})[_0x0628('0x40')](function(_0x173221){if(_0x173221){if(!_0x2020cf['query']['channel']||!utils[_0x0628('0x75')](_0x2020cf[_0x0628('0x30')][_0x0628('0x6e')])){throw new db[(_0x0628('0x55'))][(_0x0628('0x76'))]('Unknown\x20channel');}return _0x173221[_0x0628('0x79')+_['capitalize'](_0x2020cf[_0x0628('0x30')][_0x0628('0x6e')][_0x0628('0x6f')]())+_0x0628('0x73')](_0x2020cf['query'][_0x0628('0x78')]);}return null;})[_0x0628('0x40')](handleEntityNotFound(_0x22746c,null))['then'](respondWithStatusCode(_0x22746c,null))[_0x0628('0x42')](handleError(_0x22746c,null));};exports['addAgents']=function(_0x253399,_0xd2fa0){var _0x13107b=_[_0x0628('0x7a')](_0x253399[_0x0628('0x4a')][_0x0628('0x78')])?_0x253399[_0x0628('0x4a')]['ids']:[_0x253399[_0x0628('0x4a')][_0x0628('0x78')]];var _0x57df19=_0x253399[_0x0628('0x44')]['id'];return db[_0x0628('0x3d')]['find']({'where':{'id':_0x57df19}})['then'](handleEntityNotFound(_0xd2fa0,null))[_0x0628('0x40')](function(_0xeec6){if(_0xeec6){var _0xa76537=[_0x0628('0x7b'),'Chat','Mail',_0x0628('0x7c'),_0x0628('0x7d'),_0x0628('0x7e'),'Whatsapp'];return db['sequelize'][_0x0628('0x53')](function(_0x5c0ad5){var _0x169961=_['map'](_0xa76537,function(_0x121706){var _0x28986b={'attributes':['id',_0x0628('0x29')]};if(_0x121706==='Voice'){_0x28986b[_0x0628('0x7f')]={'attributes':[_0x0628('0x80')]};}return _0xeec6['get'+_0x121706+'Queues'](_0x28986b)[_0x0628('0x40')](function(_0x218abb){var _0x8ee493=_[_0x0628('0x2b')](_0x218abb,function(_0x390260){var _0x250173=_[_0x0628('0x2b')](_0x13107b,function(_0x505ba7){var _0x38aa14={'where':{'UserId':_0x505ba7,[_0x121706+_0x0628('0x81')]:_0x390260['id']},'transaction':_0x5c0ad5};if(_0x121706===_0x0628('0x7b')){_0x38aa14[_0x0628('0x18')]={'penalty':_0x390260['TeamVoiceQueue'][_0x0628('0x80')]};}return db[_0x0628('0x82')+_0x121706+_0x0628('0x70')][_0x0628('0x83')](_0x38aa14)[_0x0628('0x40')](function(){socket[_0x0628('0x84')]('user'+_0x121706+_0x0628('0x85'),{'UserId':_0x505ba7,[_0x121706+_0x0628('0x81')]:_0x390260['id']});if(_0x121706!=='Voice'){return;}return db[_0x0628('0x82')]['findAll']({'where':{'id':_0x13107b,'online':0x1},'attributes':['id',_0x0628('0x29'),'online','voicePause',_0x0628('0x86')],'raw':!![]})[_0x0628('0x40')](function(_0x4fc86c){var _0x4999cd=_[_0x0628('0x2b')](_0x4fc86c,function(_0x52fabc){return db[_0x0628('0x87')]['upsert']({'membername':_0x52fabc[_0x0628('0x29')],'UserId':_0x52fabc['id'],'queue_name':_0x390260[_0x0628('0x29')],'VoiceQueueId':_0x390260['id'],'interface':_[_0x0628('0x88')](_0x52fabc[_0x0628('0x86')])?util[_0x0628('0x89')]('SIP/%s',_0x52fabc[_0x0628('0x29')]):_0x52fabc[_0x0628('0x86')],'paused':_0x52fabc['voicePause']||![],'penalty':_0x390260[_0x0628('0x8a')][_0x0628('0x80')]},{'transaction':_0x5c0ad5});});return Promise[_0x0628('0x8b')](_0x4999cd);});});});return Promise[_0x0628('0x8b')](_0x250173);});return Promise[_0x0628('0x8b')](_0x8ee493);})[_0x0628('0x40')](function(){return db[_0x0628('0x8c')][_0x0628('0x6b')]({'where':{'teamId':_0x57df19}})[_0x0628('0x40')](function(_0x218f89){if(_0x218f89){var _0x48c064=_[_0x0628('0x2b')](_0x13107b,function(_0x5bb7cf){db['UserVoicePrefix']['upsert']({'UserId':_0x5bb7cf,'VoicePrefixId':_0x218f89[_0x0628('0x69')]});});return Promise['all'](_0x48c064);}});});});return Promise[_0x0628('0x8b')](_0x169961)[_0x0628('0x40')](function(){return _0xeec6['addAgents'](_0x13107b,{'transaction':_0x5c0ad5})[_0x0628('0x8d')](function(_0x490458){return _0x490458;});});});}})['then'](respondWithResult(_0xd2fa0,null))['catch'](handleError(_0xd2fa0,null));};exports[_0x0628('0x8e')]=function(_0x2834fa,_0x2d350b){var _0x52f466=_[_0x0628('0x7a')](_0x2834fa[_0x0628('0x30')][_0x0628('0x78')])?_0x2834fa[_0x0628('0x30')][_0x0628('0x78')]:[_0x2834fa[_0x0628('0x30')]['ids']];var _0xac3a76=_0x2834fa['params']['id'];return db[_0x0628('0x3d')][_0x0628('0x48')]({'where':{'id':_0xac3a76}})[_0x0628('0x40')](handleEntityNotFound(_0x2d350b,null))[_0x0628('0x40')](function(_0xef899a){if(_0xef899a){var _0x299131=[_0x0628('0x7b'),_0x0628('0x8f'),_0x0628('0x90'),'Sms',_0x0628('0x7d'),_0x0628('0x7e'),_0x0628('0x91')];return db[_0x0628('0x52')][_0x0628('0x53')](function(_0x2f96bc){var _0x46726c=_[_0x0628('0x2b')](_0x299131,function(_0x7d3b11){var _0x4055ca={'attributes':['id',_0x0628('0x29')]};return _0xef899a[_0x0628('0x4c')+_0x7d3b11+_0x0628('0x73')](_0x4055ca)['then'](function(_0x5ef880){var _0x2b1a1f=_[_0x0628('0x2b')](_0x5ef880,function(_0x2da6bf){return _0x2da6bf[_0x0628('0x8e')](_0x52f466,{'transaction':_0x2f96bc})[_0x0628('0x40')](function(){var _0x58f72a=_[_0x0628('0x2b')](_0x52f466,function(_0x4dcceb){socket[_0x0628('0x84')](_0x0628('0x4b')+_0x7d3b11+'Queue:remove',{'UserId':Number(_0x4dcceb),[_0x7d3b11+_0x0628('0x81')]:_0x2da6bf['id']});if(_0x7d3b11!==_0x0628('0x7b')){return;}return db[_0x0628('0x87')][_0x0628('0x51')]({'where':{'VoiceQueueId':_0x2da6bf['id'],'UserId':_0x4dcceb},'transaction':_0x2f96bc});});return Promise['all'](_0x58f72a);});});return Promise[_0x0628('0x8b')](_0x2b1a1f);});});return Promise['all'](_0x46726c)[_0x0628('0x40')](function(){return _0xef899a[_0x0628('0x8e')](_0x52f466,{'transaction':_0x2f96bc});})['then'](function(){return db[_0x0628('0x8c')]['findOne']({'where':{'teamId':_0xac3a76}})[_0x0628('0x40')](function(_0x3d631d){if(_0x3d631d){var _0x5e5d29=_[_0x0628('0x2b')](_0x52f466,function(_0x2c5122){db[_0x0628('0x92')][_0x0628('0x51')]({'where':{'UserId':_0x2c5122,'VoicePrefixId':_0x3d631d[_0x0628('0x69')]}});});return Promise['all'](_0x5e5d29);}});});});}})[_0x0628('0x40')](respondWithStatusCode(_0x2d350b,null))[_0x0628('0x42')](handleError(_0x2d350b,null));};exports['getAgents']=function(_0x5e1910,_0x4a709a,_0x28c2eb){var _0x1f3c22={};var _0x489c1d={};var _0x1720f0;var _0x17cefe;return db[_0x0628('0x3d')][_0x0628('0x6b')]({'where':{'id':_0x5e1910[_0x0628('0x44')]['id']}})['then'](handleEntityNotFound(_0x4a709a,null))[_0x0628('0x40')](function(_0x9b1ee1){if(_0x9b1ee1){_0x1720f0=_0x9b1ee1;_0x489c1d['model']=_[_0x0628('0x45')](db[_0x0628('0x82')][_0x0628('0x2c')]);_0x489c1d['query']=_['keys'](_0x5e1910['query']);_0x489c1d['filters']=_[_0x0628('0x32')](_0x489c1d[_0x0628('0x2f')],_0x489c1d[_0x0628('0x30')]);_0x1f3c22[_0x0628('0x33')]=_[_0x0628('0x32')](_0x489c1d[_0x0628('0x2f')],qs[_0x0628('0x34')](_0x5e1910[_0x0628('0x30')][_0x0628('0x34')]));_0x1f3c22['attributes']=_0x1f3c22['attributes'][_0x0628('0x46')]?_0x1f3c22[_0x0628('0x33')]:_0x489c1d['model'];_0x1f3c22[_0x0628('0x37')]=qs[_0x0628('0x38')](_0x5e1910[_0x0628('0x30')]['sort']);_0x1f3c22['where']=qs['filters'](_[_0x0628('0x71')](_0x5e1910[_0x0628('0x30')],_0x489c1d[_0x0628('0x31')]));if(_0x5e1910[_0x0628('0x30')][_0x0628('0x39')]){_0x1f3c22['where']=_[_0x0628('0x3b')](_0x1f3c22[_0x0628('0x3a')],{'$or':_[_0x0628('0x2b')](_0x1f3c22[_0x0628('0x33')],function(_0x409d24){var _0x118113={};_0x118113[_0x409d24]={'$like':'%'+_0x5e1910[_0x0628('0x30')][_0x0628('0x39')]+'%'};return _0x118113;})});}_0x1f3c22=_[_0x0628('0x3b')]({},_0x1f3c22,_0x5e1910[_0x0628('0x72')]);return _0x1720f0[_0x0628('0x93')](_0x1f3c22);}})[_0x0628('0x40')](function(_0x1d2ff2){if(_0x1d2ff2){_0x17cefe=_0x1d2ff2[_0x0628('0x46')];if(!_0x5e1910[_0x0628('0x30')][_0x0628('0x35')](_0x0628('0x36'))){_0x1f3c22[_0x0628('0x21')]=qs[_0x0628('0x21')](_0x5e1910[_0x0628('0x30')][_0x0628('0x21')]);_0x1f3c22['offset']=qs[_0x0628('0x20')](_0x5e1910[_0x0628('0x30')][_0x0628('0x20')]);}return _0x1720f0['getAgents'](_0x1f3c22);}})[_0x0628('0x40')](function(_0x3272a5){if(_0x3272a5){return _0x3272a5?{'count':_0x17cefe,'rows':_0x3272a5}:null;}})[_0x0628('0x40')](respondWithResult(_0x4a709a,null))[_0x0628('0x42')](handleError(_0x4a709a,null));}; \ No newline at end of file +var _0xa31b=['rawAttributes','fields','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','VoiceQueueId','UserVoiceQueue','destroy','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','end','send','findOne','channel','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','add','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Whatsapp','through','QueueId','TeamVoiceQueue','penalty','emit','Queue:save','User','online','upsert','interface','voicePause','all','VoicePrefixId','spread','removeAgents','Fax','Queue:remove','UserVoiceQueueRt','getAgents','hasOwnProperty','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','error','stack','name','index','Team','type','key','map','keys','query','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','then','include','findAll','rows','catch','params'];(function(_0x1f6616,_0x223d01){var _0xda893b=function(_0x2bced5){while(--_0x2bced5){_0x1f6616['push'](_0x1f6616['shift']());}};_0xda893b(++_0x223d01);}(_0xa31b,0xee));var _0xba31=function(_0x225d7e,_0x206329){_0x225d7e=_0x225d7e-0x0;var _0x3d1998=_0xa31b[_0x225d7e];return _0x3d1998;};'use strict';var emlformat=require(_0xba31('0x0'));var rimraf=require(_0xba31('0x1'));var zipdir=require(_0xba31('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba31('0x3'));var moment=require('moment');var BPromise=require(_0xba31('0x4'));var Mustache=require(_0xba31('0x5'));var util=require(_0xba31('0x6'));var path=require(_0xba31('0x7'));var sox=require(_0xba31('0x8'));var csv=require(_0xba31('0x9'));var ejs=require(_0xba31('0xa'));var fs=require('fs');var fs_extra=require(_0xba31('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xba31('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xba31('0xd'));var authService=require(_0xba31('0xe'));var qs=require(_0xba31('0xf'));var as=require(_0xba31('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xba31('0x11'))(_0xba31('0x12'));var utils=require(_0xba31('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xba31('0x14'));var db=require('../../mysqldb')['db'];config[_0xba31('0x15')]=_[_0xba31('0x16')](config[_0xba31('0x15')],{'host':_0xba31('0x17'),'port':0x18eb});var socket=require(_0xba31('0x18'))(new Redis(config[_0xba31('0x15')]));require(_0xba31('0x19'))[_0xba31('0x1a')](socket);function respondWithStatusCode(_0x4a4c84,_0x33d480){_0x33d480=_0x33d480||0xcc;return function(_0x3af610){if(_0x3af610){return _0x4a4c84[_0xba31('0x1b')](_0x33d480);}return _0x4a4c84[_0xba31('0x1c')](_0x33d480)['end']();};}function respondWithResult(_0x196cf0,_0x3bcdb2){_0x3bcdb2=_0x3bcdb2||0xc8;return function(_0x15a9cb){if(_0x15a9cb){return _0x196cf0[_0xba31('0x1c')](_0x3bcdb2)[_0xba31('0x1d')](_0x15a9cb);}};}function respondWithFilteredResult(_0xa4e4d1,_0x473648){return function(_0x52700e){if(_0x52700e){var _0x58bd6c=typeof _0x473648[_0xba31('0x1e')]===_0xba31('0x1f')&&typeof _0x473648[_0xba31('0x20')]===_0xba31('0x1f');var _0x39e664=_0x52700e['count'];var _0x702636=_0x58bd6c?0x0:_0x473648[_0xba31('0x1e')];var _0x30a000=_0x58bd6c?_0x52700e[_0xba31('0x21')]:_0x473648[_0xba31('0x1e')]+_0x473648[_0xba31('0x20')];var _0x1ec53a;if(_0x30a000>=_0x39e664){_0x30a000=_0x39e664;_0x1ec53a=0xc8;}else{_0x1ec53a=0xce;}_0xa4e4d1[_0xba31('0x1c')](_0x1ec53a);return _0xa4e4d1['set'](_0xba31('0x22'),_0x702636+'-'+_0x30a000+'/'+_0x39e664)['json'](_0x52700e);}return null;};}function patchUpdates(_0x41e2b9){return function(_0x12b300){try{jsonpatch[_0xba31('0x23')](_0x12b300,_0x41e2b9,!![]);}catch(_0x467604){return BPromise['reject'](_0x467604);}return _0x12b300[_0xba31('0x24')]();};}function saveUpdates(_0x60fcf,_0x5ddd13){return function(_0x5c8086){if(_0x5c8086){return _0x5c8086[_0xba31('0x25')](_0x60fcf)['then'](function(_0x5b1a85){return _0x5b1a85;});}return null;};}function handleEntityNotFound(_0x492cf0,_0x1c7a3){return function(_0x467068){if(!_0x467068){_0x492cf0['sendStatus'](0x194);}return _0x467068;};}function handleError(_0x5ed52a,_0x4d9985){_0x4d9985=_0x4d9985||0x1f4;return function(_0x581658){logger[_0xba31('0x26')](_0x581658[_0xba31('0x27')]);if(_0x581658['name']){delete _0x581658[_0xba31('0x28')];}_0x5ed52a[_0xba31('0x1c')](_0x4d9985)['send'](_0x581658);};}exports[_0xba31('0x29')]=function(_0xc299a2,_0x41bc6d){var _0x31906e={},_0x1739af={},_0x657630={'count':0x0,'rows':[]};var _0x3c28de=_['map'](db[_0xba31('0x2a')]['rawAttributes'],function(_0x1558d7){return{'name':_0x1558d7['fieldName'],'type':_0x1558d7[_0xba31('0x2b')][_0xba31('0x2c')]};});_0x1739af['model']=_[_0xba31('0x2d')](_0x3c28de,'name');_0x1739af['query']=_[_0xba31('0x2e')](_0xc299a2[_0xba31('0x2f')]);_0x1739af[_0xba31('0x30')]=_[_0xba31('0x31')](_0x1739af[_0xba31('0x32')],_0x1739af[_0xba31('0x2f')]);_0x31906e[_0xba31('0x33')]=_[_0xba31('0x31')](_0x1739af[_0xba31('0x32')],qs['fields'](_0xc299a2[_0xba31('0x2f')]['fields']));_0x31906e[_0xba31('0x33')]=_0x31906e[_0xba31('0x33')][_0xba31('0x34')]?_0x31906e['attributes']:_0x1739af[_0xba31('0x32')];if(!_0xc299a2[_0xba31('0x2f')]['hasOwnProperty'](_0xba31('0x35'))){_0x31906e['limit']=qs[_0xba31('0x20')](_0xc299a2[_0xba31('0x2f')][_0xba31('0x20')]);_0x31906e[_0xba31('0x1e')]=qs[_0xba31('0x1e')](_0xc299a2[_0xba31('0x2f')]['offset']);}_0x31906e[_0xba31('0x36')]=qs[_0xba31('0x37')](_0xc299a2['query'][_0xba31('0x37')]);_0x31906e[_0xba31('0x38')]=qs[_0xba31('0x30')](_[_0xba31('0x39')](_0xc299a2[_0xba31('0x2f')],_0x1739af[_0xba31('0x30')]),_0x3c28de);if(_0xc299a2[_0xba31('0x2f')][_0xba31('0x3a')]){_0x31906e[_0xba31('0x38')]=_['merge'](_0x31906e[_0xba31('0x38')],{'$or':_[_0xba31('0x2d')](_0x3c28de,function(_0x33855f){if(_0x33855f['type']!==_0xba31('0x3b')){var _0xd11559={};_0xd11559[_0x33855f['name']]={'$like':'%'+_0xc299a2['query']['filter']+'%'};return _0xd11559;}})});}_0x31906e=_[_0xba31('0x3c')]({},_0x31906e,_0xc299a2[_0xba31('0x3d')]);var _0x29a557={'where':_0x31906e[_0xba31('0x38')]};return db[_0xba31('0x2a')]['count'](_0x29a557)[_0xba31('0x3e')](function(_0x125d01){_0x657630[_0xba31('0x21')]=_0x125d01;if(_0xc299a2[_0xba31('0x2f')]['includeAll']){_0x31906e[_0xba31('0x3f')]=[{'all':!![]}];}return db[_0xba31('0x2a')][_0xba31('0x40')](_0x31906e);})[_0xba31('0x3e')](function(_0x118c58){_0x657630[_0xba31('0x41')]=_0x118c58;return _0x657630;})['then'](respondWithFilteredResult(_0x41bc6d,_0x31906e))[_0xba31('0x42')](handleError(_0x41bc6d,null));};exports['show']=function(_0x1dc3a9,_0x22accd){var _0xa13d1e={'raw':![],'where':{'id':_0x1dc3a9[_0xba31('0x43')]['id']}},_0x2f6439={};_0x2f6439[_0xba31('0x32')]=_['keys'](db[_0xba31('0x2a')][_0xba31('0x44')]);_0x2f6439['query']=_['keys'](_0x1dc3a9[_0xba31('0x2f')]);_0x2f6439[_0xba31('0x30')]=_[_0xba31('0x31')](_0x2f6439[_0xba31('0x32')],_0x2f6439[_0xba31('0x2f')]);_0xa13d1e[_0xba31('0x33')]=_[_0xba31('0x31')](_0x2f6439[_0xba31('0x32')],qs[_0xba31('0x45')](_0x1dc3a9[_0xba31('0x2f')][_0xba31('0x45')]));_0xa13d1e[_0xba31('0x33')]=_0xa13d1e[_0xba31('0x33')][_0xba31('0x34')]?_0xa13d1e[_0xba31('0x33')]:_0x2f6439['model'];if(_0x1dc3a9[_0xba31('0x2f')]['includeAll']){_0xa13d1e[_0xba31('0x3f')]=[{'all':!![]}];}_0xa13d1e=_[_0xba31('0x3c')]({},_0xa13d1e,_0x1dc3a9[_0xba31('0x3d')]);return db['Team']['find'](_0xa13d1e)[_0xba31('0x3e')](handleEntityNotFound(_0x22accd,null))[_0xba31('0x3e')](respondWithResult(_0x22accd,null))['catch'](handleError(_0x22accd,null));};exports['create']=function(_0x320ab1,_0x4cdcc9){return db['Team'][_0xba31('0x46')](_0x320ab1[_0xba31('0x47')],{})[_0xba31('0x3e')](function(_0x25e44e){var _0x36f21a=_0x320ab1['user'][_0xba31('0x48')]({'plain':!![]});if(!_0x36f21a)throw new Error(_0xba31('0x49'));if(_0x36f21a[_0xba31('0x4a')]===_0xba31('0x4b')){var _0x372049=_0x25e44e[_0xba31('0x48')]({'plain':!![]});var _0x411fa7=_0xba31('0x4c');return db[_0xba31('0x4d')][_0xba31('0x4e')]({'where':{'name':_0x411fa7,'userProfileId':_0x36f21a[_0xba31('0x4f')]},'raw':!![]})['then'](function(_0x102cc6){if(_0x102cc6&&_0x102cc6['autoAssociation']===0x0){return db[_0xba31('0x50')][_0xba31('0x46')]({'name':_0x372049[_0xba31('0x28')],'resourceId':_0x372049['id'],'type':_0x102cc6[_0xba31('0x28')],'sectionId':_0x102cc6['id']},{})[_0xba31('0x3e')](function(){return _0x25e44e;});}else{return _0x25e44e;}})['catch'](function(_0x4e00fe){logger[_0xba31('0x26')](_0xba31('0x51'),_0x4e00fe);throw _0x4e00fe;});}return _0x25e44e;})[_0xba31('0x3e')](respondWithResult(_0x4cdcc9,0xc9))[_0xba31('0x42')](handleError(_0x4cdcc9,null));};exports[_0xba31('0x25')]=function(_0x2adacd,_0x1cd523){if(_0x2adacd['body']['id']){delete _0x2adacd[_0xba31('0x47')]['id'];}return db['Team'][_0xba31('0x4e')]({'where':{'id':_0x2adacd['params']['id']}})[_0xba31('0x3e')](handleEntityNotFound(_0x1cd523,null))[_0xba31('0x3e')](saveUpdates(_0x2adacd['body'],null))[_0xba31('0x3e')](respondWithResult(_0x1cd523,null))[_0xba31('0x42')](handleError(_0x1cd523,null));};exports['destroy']=function(_0x1d3a7d,_0x58e779){var _0x2b9333=_0x1d3a7d[_0xba31('0x43')]['id'];var _0x1252e0=[];return db[_0xba31('0x52')][_0xba31('0x53')](function(_0x2f088d){var _0x45aa57=_0xba31('0x54')+_0x2b9333;return db['sequelize']['query'](_0x45aa57,{'type':db['Sequelize'][_0xba31('0x55')][_0xba31('0x56')],'raw':!![],'transaction':_0x2f088d})[_0xba31('0x3e')](function(_0x4f7452){_0x1252e0=_[_0xba31('0x2d')](_0x4f7452,function(_0x47e5b5){return Number(_0x47e5b5['UserId']);});})[_0xba31('0x3e')](function(){var _0x538d05=_0xba31('0x57')+_0x2b9333;return db['sequelize'][_0xba31('0x2f')](_0x538d05,{'type':db[_0xba31('0x58')][_0xba31('0x55')]['SELECT'],'raw':!![],'transaction':_0x2f088d});})[_0xba31('0x3e')](function(_0x310f63){var _0x5727f1=_[_0xba31('0x2d')](_0x310f63,function(_0x9433e7){return Number(_0x9433e7[_0xba31('0x59')]);});return db[_0xba31('0x5a')][_0xba31('0x5b')]({'where':{'UserId':{'$in':_0x1252e0},'VoiceQueueId':{'$in':_0x5727f1}},'transaction':_0x2f088d});})[_0xba31('0x3e')](function(){var _0x2baf25='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2b9333;return db[_0xba31('0x52')][_0xba31('0x2f')](_0x2baf25,{'type':db[_0xba31('0x58')][_0xba31('0x55')]['SELECT'],'raw':!![],'transaction':_0x2f088d});})[_0xba31('0x3e')](function(_0x339548){var _0x153c5a=_[_0xba31('0x2d')](_0x339548,function(_0x30dcdb){return Number(_0x30dcdb[_0xba31('0x5c')]);});return db[_0xba31('0x5d')][_0xba31('0x5b')]({'where':{'UserId':{'$in':_0x1252e0},'MailQueueId':{'$in':_0x153c5a}},'transaction':_0x2f088d});})[_0xba31('0x3e')](function(){var _0x13e3d8=_0xba31('0x5e')+_0x2b9333;return db[_0xba31('0x52')][_0xba31('0x2f')](_0x13e3d8,{'type':db[_0xba31('0x58')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x2f088d});})[_0xba31('0x3e')](function(_0x5c06bc){var _0x1874b9=_[_0xba31('0x2d')](_0x5c06bc,function(_0x52e19a){return Number(_0x52e19a[_0xba31('0x5f')]);});return db[_0xba31('0x60')][_0xba31('0x5b')]({'where':{'UserId':{'$in':_0x1252e0},'SmsQueueId':{'$in':_0x1874b9}},'transaction':_0x2f088d});})[_0xba31('0x3e')](function(){var _0x405260=_0xba31('0x61')+_0x2b9333;return db['sequelize'][_0xba31('0x2f')](_0x405260,{'type':db[_0xba31('0x58')]['QueryTypes'][_0xba31('0x56')],'raw':!![],'transaction':_0x2f088d});})['then'](function(_0x54cf68){var _0x5596af=_[_0xba31('0x2d')](_0x54cf68,function(_0x4e8195){return Number(_0x4e8195[_0xba31('0x62')]);});return db[_0xba31('0x63')][_0xba31('0x5b')]({'where':{'UserId':{'$in':_0x1252e0},'ChatQueueId':{'$in':_0x5596af}},'transaction':_0x2f088d});})[_0xba31('0x3e')](function(){var _0x4fe801=_0xba31('0x64')+_0x2b9333;return db['sequelize'][_0xba31('0x2f')](_0x4fe801,{'type':db[_0xba31('0x58')][_0xba31('0x55')]['SELECT'],'raw':!![],'transaction':_0x2f088d});})[_0xba31('0x3e')](function(_0x74409){var _0xc2975d=_['map'](_0x74409,function(_0x2f9796){return Number(_0x2f9796[_0xba31('0x65')]);});return db[_0xba31('0x66')][_0xba31('0x5b')]({'where':{'UserId':{'$in':_0x1252e0},'FaxQueueId':{'$in':_0xc2975d}},'transaction':_0x2f088d});})[_0xba31('0x3e')](function(){var _0x5c102d=_0xba31('0x67')+_0x2b9333;return db[_0xba31('0x52')][_0xba31('0x2f')](_0x5c102d,{'type':db[_0xba31('0x58')]['QueryTypes'][_0xba31('0x56')],'raw':!![],'transaction':_0x2f088d});})[_0xba31('0x3e')](function(_0x49851c){var _0x365538=_['map'](_0x49851c,function(_0xa02af9){return Number(_0xa02af9[_0xba31('0x68')]);});return db[_0xba31('0x69')][_0xba31('0x5b')]({'where':{'UserId':{'$in':_0x1252e0},'OpenchannelQueueId':{'$in':_0x365538}},'transaction':_0x2f088d});})[_0xba31('0x3e')](function(){var _0x269aaa=_0xba31('0x6a')+_0x2b9333;return db[_0xba31('0x52')][_0xba31('0x2f')](_0x269aaa,{'type':db[_0xba31('0x58')][_0xba31('0x55')]['SELECT'],'raw':!![],'transaction':_0x2f088d});})['then'](function(_0x8568c9){var _0x546458=_[_0xba31('0x2d')](_0x8568c9,function(_0x2216e9){return Number(_0x2216e9[_0xba31('0x6b')]);});return db[_0xba31('0x6c')][_0xba31('0x5b')]({'where':{'UserId':{'$in':_0x1252e0},'WhatsappQueueId':{'$in':_0x546458}},'transaction':_0x2f088d});})[_0xba31('0x3e')](function(){return db[_0xba31('0x6d')][_0xba31('0x4e')]({'where':{'TeamId':_0x2b9333}});})['then'](function(_0x10aa17){if(_0x10aa17===null){return;}return db[_0xba31('0x6e')][_0xba31('0x5b')]({'where':{'UserId':{'$in':_0x1252e0},'VoicePrefixId':_0x10aa17['VoicePrefixId']},'transaction':_0x2f088d});})['then'](function(){return db[_0xba31('0x2a')][_0xba31('0x5b')]({'where':{'id':_0x2b9333},'cascade':!![],'transaction':_0x2f088d});})[_0xba31('0x3e')](function(_0x38835a){if(_0x38835a===0x0){_0x58e779[_0xba31('0x1b')](0x194);}else{return db[_0xba31('0x50')][_0xba31('0x5b')]({'where':{'type':_0xba31('0x4c'),'resourceId':_0x2b9333},'cascade':!![],'transaction':_0x2f088d})['then'](function(){_0x58e779[_0xba31('0x1c')](0xcc)[_0xba31('0x6f')]();});}})[_0xba31('0x42')](function(_0x7f6f25){_0x58e779[_0xba31('0x1c')](0x1f4)[_0xba31('0x70')](_0x7f6f25);});});};exports['getQueues']=function(_0x4c91f2,_0x537312,_0x3f0b50){return db['Team'][_0xba31('0x71')]({'where':{'id':_0x4c91f2[_0xba31('0x43')]['id']}})[_0xba31('0x3e')](handleEntityNotFound(_0x537312,null))[_0xba31('0x3e')](function(_0x476e38){if(!_0x4c91f2[_0xba31('0x2f')][_0xba31('0x72')]||!utils[_0xba31('0x73')](_0x4c91f2[_0xba31('0x2f')]['channel'])){throw new db[(_0xba31('0x58'))]['ValidationError'](_0xba31('0x74'));}var _0x25ea47={};var _0x522eb2={};_0x522eb2[_0xba31('0x32')]=_[_0xba31('0x2e')](db[_[_0xba31('0x75')](_0x4c91f2[_0xba31('0x2f')][_0xba31('0x72')][_0xba31('0x76')]())+_0xba31('0x77')][_0xba31('0x44')]);_0x522eb2[_0xba31('0x2f')]=_['keys'](_0x4c91f2['query']);_0x522eb2[_0xba31('0x30')]=_[_0xba31('0x31')](_0x522eb2[_0xba31('0x32')],_0x522eb2['query']);_0x25ea47['attributes']=_[_0xba31('0x31')](_0x522eb2['model'],qs[_0xba31('0x45')](_0x4c91f2[_0xba31('0x2f')]['fields']));_0x25ea47[_0xba31('0x33')]=_0x25ea47[_0xba31('0x33')][_0xba31('0x34')]?_0x25ea47['attributes']:_0x522eb2[_0xba31('0x32')];_0x25ea47[_0xba31('0x20')]=qs[_0xba31('0x20')](_0x4c91f2[_0xba31('0x2f')][_0xba31('0x20')]);_0x25ea47[_0xba31('0x1e')]=qs[_0xba31('0x1e')](_0x4c91f2[_0xba31('0x2f')][_0xba31('0x1e')]);_0x25ea47[_0xba31('0x36')]=qs[_0xba31('0x37')](_0x4c91f2[_0xba31('0x2f')]['sort']);_0x25ea47[_0xba31('0x38')]=qs[_0xba31('0x30')](_[_0xba31('0x39')](_0x4c91f2[_0xba31('0x2f')],_0x522eb2['filters']));_0x25ea47=_[_0xba31('0x3c')]({},_0x25ea47,_0x4c91f2['options']);return _0x476e38['get'+_['capitalize'](_0x4c91f2[_0xba31('0x2f')][_0xba31('0x72')]['toLowerCase']())+_0xba31('0x78')](_0x25ea47);})[_0xba31('0x3e')](respondWithResult(_0x537312,null))['catch'](handleError(_0x537312,null));};exports[_0xba31('0x79')]=function(_0x419c8c,_0x12f8b2,_0x34077a){return db[_0xba31('0x2a')][_0xba31('0x71')]({'where':{'id':_0x419c8c[_0xba31('0x43')]['id']}})[_0xba31('0x3e')](function(_0x29b2ad){if(_0x29b2ad){if(!_0x419c8c[_0xba31('0x47')]['channel']||!utils['isValidChannel'](_0x419c8c['body']['channel'])){throw new db[(_0xba31('0x58'))]['ValidationError'](_0xba31('0x74'));}return _0x29b2ad[_0xba31('0x7a')+_[_0xba31('0x75')](_0x419c8c['body'][_0xba31('0x72')][_0xba31('0x76')]())+_0xba31('0x78')](_0x419c8c['body'][_0xba31('0x7b')]);}return null;})[_0xba31('0x3e')](handleEntityNotFound(_0x12f8b2,null))[_0xba31('0x3e')](respondWithStatusCode(_0x12f8b2,null))[_0xba31('0x42')](handleError(_0x12f8b2,null));};exports[_0xba31('0x7c')]=function(_0x12382e,_0x5d719e,_0x4cbf00){return db[_0xba31('0x2a')][_0xba31('0x71')]({'where':{'id':_0x12382e[_0xba31('0x43')]['id']}})[_0xba31('0x3e')](function(_0x72018b){if(_0x72018b){if(!_0x12382e[_0xba31('0x2f')][_0xba31('0x72')]||!utils['isValidChannel'](_0x12382e[_0xba31('0x2f')]['channel'])){throw new db[(_0xba31('0x58'))]['ValidationError'](_0xba31('0x74'));}return _0x72018b[_0xba31('0x7d')+_[_0xba31('0x75')](_0x12382e[_0xba31('0x2f')][_0xba31('0x72')][_0xba31('0x76')]())+_0xba31('0x78')](_0x12382e[_0xba31('0x2f')]['ids']);}return null;})[_0xba31('0x3e')](handleEntityNotFound(_0x5d719e,null))['then'](respondWithStatusCode(_0x5d719e,null))['catch'](handleError(_0x5d719e,null));};exports[_0xba31('0x7e')]=function(_0x333652,_0x128c1){var _0x2fd54d=_[_0xba31('0x7f')](_0x333652[_0xba31('0x47')][_0xba31('0x7b')])?_0x333652['body']['ids']:[_0x333652[_0xba31('0x47')][_0xba31('0x7b')]];var _0x5d782a=_0x333652[_0xba31('0x43')]['id'];return db[_0xba31('0x2a')][_0xba31('0x4e')]({'where':{'id':_0x5d782a}})['then'](handleEntityNotFound(_0x128c1,null))[_0xba31('0x3e')](function(_0x4f51b7){if(_0x4f51b7){var _0x23ea18=[_0xba31('0x80'),_0xba31('0x81'),_0xba31('0x82'),_0xba31('0x83'),'Fax','Openchannel',_0xba31('0x84')];return db[_0xba31('0x52')][_0xba31('0x53')](function(_0x486548){var _0x379038=_[_0xba31('0x2d')](_0x23ea18,function(_0x1426a4){var _0x57a011={'attributes':['id',_0xba31('0x28')]};if(_0x1426a4==='Voice'){_0x57a011[_0xba31('0x85')]={'attributes':['penalty']};}return _0x4f51b7[_0xba31('0x48')+_0x1426a4+_0xba31('0x78')](_0x57a011)[_0xba31('0x3e')](function(_0x5dbbd2){var _0x52944b=_[_0xba31('0x2d')](_0x5dbbd2,function(_0x2c7702){var _0x1c8116=_[_0xba31('0x2d')](_0x2fd54d,function(_0xcac6cf){var _0x447260={'where':{'UserId':_0xcac6cf,[_0x1426a4+_0xba31('0x86')]:_0x2c7702['id']},'transaction':_0x486548};if(_0x1426a4===_0xba31('0x80')){_0x447260[_0xba31('0x16')]={'penalty':_0x2c7702[_0xba31('0x87')][_0xba31('0x88')]};}return db['User'+_0x1426a4+_0xba31('0x77')]['findOrCreate'](_0x447260)['then'](function(){socket[_0xba31('0x89')]('user'+_0x1426a4+_0xba31('0x8a'),{'UserId':_0xcac6cf,[_0x1426a4+_0xba31('0x86')]:_0x2c7702['id']});if(_0x1426a4!=='Voice'){return;}return db[_0xba31('0x8b')][_0xba31('0x40')]({'where':{'id':_0x2fd54d,'online':0x1},'attributes':['id',_0xba31('0x28'),_0xba31('0x8c'),'voicePause','interface'],'raw':!![]})[_0xba31('0x3e')](function(_0x308ebd){var _0x2300dc=_[_0xba31('0x2d')](_0x308ebd,function(_0x4e5841){return db['UserVoiceQueueRt'][_0xba31('0x8d')]({'membername':_0x4e5841[_0xba31('0x28')],'UserId':_0x4e5841['id'],'queue_name':_0x2c7702[_0xba31('0x28')],'VoiceQueueId':_0x2c7702['id'],'interface':_['isNil'](_0x4e5841[_0xba31('0x8e')])?util['format']('SIP/%s',_0x4e5841[_0xba31('0x28')]):_0x4e5841['interface'],'paused':_0x4e5841[_0xba31('0x8f')]||![],'penalty':_0x2c7702[_0xba31('0x87')]['penalty']},{'transaction':_0x486548});});return Promise[_0xba31('0x90')](_0x2300dc);});});});return Promise[_0xba31('0x90')](_0x1c8116);});return Promise[_0xba31('0x90')](_0x52944b);})[_0xba31('0x3e')](function(){return db[_0xba31('0x6d')][_0xba31('0x71')]({'where':{'teamId':_0x5d782a}})[_0xba31('0x3e')](function(_0x4da121){if(_0x4da121){var _0x24f195=_['map'](_0x2fd54d,function(_0x5c7517){db[_0xba31('0x6e')][_0xba31('0x8d')]({'UserId':_0x5c7517,'VoicePrefixId':_0x4da121[_0xba31('0x91')]});});return Promise['all'](_0x24f195);}});});});return Promise['all'](_0x379038)[_0xba31('0x3e')](function(){return _0x4f51b7[_0xba31('0x7e')](_0x2fd54d,{'transaction':_0x486548})[_0xba31('0x92')](function(_0x498430){return _0x498430;});});});}})[_0xba31('0x3e')](respondWithResult(_0x128c1,null))[_0xba31('0x42')](handleError(_0x128c1,null));};exports[_0xba31('0x93')]=function(_0x2dfe38,_0x484c45){var _0x547d91=_[_0xba31('0x7f')](_0x2dfe38[_0xba31('0x2f')]['ids'])?_0x2dfe38[_0xba31('0x2f')][_0xba31('0x7b')]:[_0x2dfe38['query'][_0xba31('0x7b')]];var _0x9748ea=_0x2dfe38[_0xba31('0x43')]['id'];return db[_0xba31('0x2a')][_0xba31('0x4e')]({'where':{'id':_0x9748ea}})['then'](handleEntityNotFound(_0x484c45,null))[_0xba31('0x3e')](function(_0x377177){if(_0x377177){var _0x3e146b=[_0xba31('0x80'),_0xba31('0x81'),_0xba31('0x82'),_0xba31('0x83'),_0xba31('0x94'),'Openchannel',_0xba31('0x84')];return db[_0xba31('0x52')][_0xba31('0x53')](function(_0x3c0b51){var _0x447021=_['map'](_0x3e146b,function(_0x44739e){var _0xc20888={'attributes':['id',_0xba31('0x28')]};return _0x377177[_0xba31('0x48')+_0x44739e+_0xba31('0x78')](_0xc20888)[_0xba31('0x3e')](function(_0x37f74d){var _0x31d1bc=_[_0xba31('0x2d')](_0x37f74d,function(_0x470054){return _0x470054[_0xba31('0x93')](_0x547d91,{'transaction':_0x3c0b51})[_0xba31('0x3e')](function(){var _0x4d6903=_[_0xba31('0x2d')](_0x547d91,function(_0x351a93){socket[_0xba31('0x89')](_0xba31('0x4b')+_0x44739e+_0xba31('0x95'),{'UserId':Number(_0x351a93),[_0x44739e+'QueueId']:_0x470054['id']});if(_0x44739e!==_0xba31('0x80')){return;}return db[_0xba31('0x96')][_0xba31('0x5b')]({'where':{'VoiceQueueId':_0x470054['id'],'UserId':_0x351a93},'transaction':_0x3c0b51});});return Promise[_0xba31('0x90')](_0x4d6903);});});return Promise[_0xba31('0x90')](_0x31d1bc);});});return Promise[_0xba31('0x90')](_0x447021)[_0xba31('0x3e')](function(){return _0x377177[_0xba31('0x93')](_0x547d91,{'transaction':_0x3c0b51});})[_0xba31('0x3e')](function(){return db[_0xba31('0x6d')]['findOne']({'where':{'teamId':_0x9748ea}})['then'](function(_0x2b34e1){if(_0x2b34e1){var _0x3e5cc6=_[_0xba31('0x2d')](_0x547d91,function(_0x59c47f){db[_0xba31('0x6e')][_0xba31('0x5b')]({'where':{'UserId':_0x59c47f,'VoicePrefixId':_0x2b34e1[_0xba31('0x91')]}});});return Promise[_0xba31('0x90')](_0x3e5cc6);}});});});}})['then'](respondWithStatusCode(_0x484c45,null))[_0xba31('0x42')](handleError(_0x484c45,null));};exports[_0xba31('0x97')]=function(_0x22884a,_0x1ac3b5,_0x4f102c){var _0x5748a0={};var _0x246b6f={};var _0x187696;var _0x302135;return db[_0xba31('0x2a')]['findOne']({'where':{'id':_0x22884a[_0xba31('0x43')]['id']}})['then'](handleEntityNotFound(_0x1ac3b5,null))[_0xba31('0x3e')](function(_0x513e16){if(_0x513e16){_0x187696=_0x513e16;_0x246b6f[_0xba31('0x32')]=_[_0xba31('0x2e')](db[_0xba31('0x8b')]['rawAttributes']);_0x246b6f[_0xba31('0x2f')]=_[_0xba31('0x2e')](_0x22884a[_0xba31('0x2f')]);_0x246b6f[_0xba31('0x30')]=_['intersection'](_0x246b6f[_0xba31('0x32')],_0x246b6f['query']);_0x5748a0[_0xba31('0x33')]=_[_0xba31('0x31')](_0x246b6f[_0xba31('0x32')],qs[_0xba31('0x45')](_0x22884a[_0xba31('0x2f')][_0xba31('0x45')]));_0x5748a0[_0xba31('0x33')]=_0x5748a0[_0xba31('0x33')][_0xba31('0x34')]?_0x5748a0[_0xba31('0x33')]:_0x246b6f[_0xba31('0x32')];_0x5748a0[_0xba31('0x36')]=qs[_0xba31('0x37')](_0x22884a[_0xba31('0x2f')][_0xba31('0x37')]);_0x5748a0[_0xba31('0x38')]=qs[_0xba31('0x30')](_[_0xba31('0x39')](_0x22884a[_0xba31('0x2f')],_0x246b6f[_0xba31('0x30')]));if(_0x22884a[_0xba31('0x2f')][_0xba31('0x3a')]){_0x5748a0[_0xba31('0x38')]=_['merge'](_0x5748a0[_0xba31('0x38')],{'$or':_[_0xba31('0x2d')](_0x5748a0['attributes'],function(_0x14fe9d){var _0x2f9661={};_0x2f9661[_0x14fe9d]={'$like':'%'+_0x22884a[_0xba31('0x2f')][_0xba31('0x3a')]+'%'};return _0x2f9661;})});}_0x5748a0=_[_0xba31('0x3c')]({},_0x5748a0,_0x22884a[_0xba31('0x3d')]);return _0x187696[_0xba31('0x97')](_0x5748a0);}})['then'](function(_0x4a8967){if(_0x4a8967){_0x302135=_0x4a8967['length'];if(!_0x22884a[_0xba31('0x2f')][_0xba31('0x98')](_0xba31('0x35'))){_0x5748a0[_0xba31('0x20')]=qs[_0xba31('0x20')](_0x22884a[_0xba31('0x2f')]['limit']);_0x5748a0['offset']=qs['offset'](_0x22884a[_0xba31('0x2f')][_0xba31('0x1e')]);}return _0x187696[_0xba31('0x97')](_0x5748a0);}})[_0xba31('0x3e')](function(_0x50349d){if(_0x50349d){return _0x50349d?{'count':_0x302135,'rows':_0x50349d}:null;}})[_0xba31('0x3e')](respondWithResult(_0x1ac3b5,null))[_0xba31('0x42')](handleError(_0x1ac3b5,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 130cb0b..db1412d 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 _0xbbd2=['update','emit','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0x1ca29f,_0x318ac5){var _0x576c3b=function(_0x40caab){while(--_0x40caab){_0x1ca29f['push'](_0x1ca29f['shift']());}};_0x576c3b(++_0x318ac5);}(_0xbbd2,0x1ef));var _0x2bbd=function(_0xc69f39,_0x2ce0cf){_0xc69f39=_0xc69f39-0x0;var _0x93be41=_0xbbd2[_0xc69f39];return _0x93be41;};'use strict';var EventEmitter=require(_0x2bbd('0x0'));var Team=require('../../mysqldb')['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x2bbd('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2bbd('0x2'),'afterDestroy':'remove'};function emitEvent(_0x155210){return function(_0x1d61b5,_0x380578,_0x504133){TeamEvents[_0x2bbd('0x3')](_0x155210+':'+_0x1d61b5['id'],_0x1d61b5);TeamEvents['emit'](_0x155210,_0x1d61b5);_0x504133(null);};}for(var e in events){if(events[_0x2bbd('0x4')](e)){var event=events[e];Team[_0x2bbd('0x5')](e,emitEvent(event));}}module[_0x2bbd('0x6')]=TeamEvents; \ No newline at end of file +var _0xd949=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x1b91cf,_0x3342b4){var _0x138c71=function(_0xfe49fa){while(--_0xfe49fa){_0x1b91cf['push'](_0x1b91cf['shift']());}};_0x138c71(++_0x3342b4);}(_0xd949,0x1b7));var _0x9d94=function(_0x2c5a2e,_0x126964){_0x2c5a2e=_0x2c5a2e-0x0;var _0x2fca86=_0xd949[_0x2c5a2e];return _0x2fca86;};'use strict';var EventEmitter=require(_0x9d94('0x0'));var Team=require(_0x9d94('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x9d94('0x2')](0x0);var events={'afterCreate':_0x9d94('0x3'),'afterUpdate':_0x9d94('0x4'),'afterDestroy':_0x9d94('0x5')};function emitEvent(_0x58c2e5){return function(_0x2bdb06,_0x24b506,_0x2f699f){TeamEvents[_0x9d94('0x6')](_0x58c2e5+':'+_0x2bdb06['id'],_0x2bdb06);TeamEvents[_0x9d94('0x6')](_0x58c2e5,_0x2bdb06);_0x2f699f(null);};}for(var e in events){if(events[_0x9d94('0x7')](e)){var event=events[e];Team[_0x9d94('0x8')](e,emitEvent(event));}}module[_0x9d94('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index ef45ccf..d01db32 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 _0x7e41=['./team.attributes','exports','define','Team','teams','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x596511,_0xb680e4){var _0x14ad1b=function(_0x3c424c){while(--_0x3c424c){_0x596511['push'](_0x596511['shift']());}};_0x14ad1b(++_0xb680e4);}(_0x7e41,0xa1));var _0x17e4=function(_0xc8a45c,_0x3e4a0a){_0xc8a45c=_0xc8a45c-0x0;var _0x3adee3=_0x7e41[_0xc8a45c];return _0x3adee3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x17e4('0x0'))('api');var moment=require(_0x17e4('0x1'));var BPromise=require(_0x17e4('0x2'));var rp=require(_0x17e4('0x3'));var fs=require('fs');var path=require(_0x17e4('0x4'));var rimraf=require(_0x17e4('0x5'));var config=require(_0x17e4('0x6'));var attributes=require(_0x17e4('0x7'));module[_0x17e4('0x8')]=function(_0x2cb32e,_0x4304ac){return _0x2cb32e[_0x17e4('0x9')](_0x17e4('0xa'),attributes,{'tableName':_0x17e4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9049=['moment','bluebird','request-promise','rimraf','../../config/environment','./team.attributes','Team','teams','lodash','api'];(function(_0x36dbb3,_0x5d84e8){var _0x27dd6f=function(_0x4e4506){while(--_0x4e4506){_0x36dbb3['push'](_0x36dbb3['shift']());}};_0x27dd6f(++_0x5d84e8);}(_0x9049,0x15c));var _0x9904=function(_0x576b66,_0x157b99){_0x576b66=_0x576b66-0x0;var _0x3a068b=_0x9049[_0x576b66];return _0x3a068b;};'use strict';var _=require(_0x9904('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9904('0x1'));var moment=require(_0x9904('0x2'));var BPromise=require(_0x9904('0x3'));var rp=require(_0x9904('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9904('0x5'));var config=require(_0x9904('0x6'));var attributes=require(_0x9904('0x7'));module['exports']=function(_0x3d5cb5,_0x31da79){return _0x3d5cb5['define'](_0x9904('0x8'),attributes,{'tableName':_0x9904('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index ca8f355..5250618 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 _0x9e42=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./team.socket','register','Team,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x9e42,0x157));var _0x29e4=function(_0x3ba924,_0x3b99f0){_0x3ba924=_0x3ba924-0x0;var _0x4cc1df=_0x9e42[_0x3ba924];return _0x4cc1df;};'use strict';var _=require('lodash');var util=require(_0x29e4('0x0'));var moment=require(_0x29e4('0x1'));var BPromise=require('bluebird');var rs=require(_0x29e4('0x2'));var fs=require('fs');var Redis=require(_0x29e4('0x3'));var db=require(_0x29e4('0x4'))['db'];var utils=require(_0x29e4('0x5'));var logger=require(_0x29e4('0x6'))(_0x29e4('0x7'));var config=require(_0x29e4('0x8'));var jayson=require(_0x29e4('0x9'));var client=jayson[_0x29e4('0xa')][_0x29e4('0xb')]({'port':0x232a});config[_0x29e4('0xc')]=_[_0x29e4('0xd')](config[_0x29e4('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x29e4('0xe'))(new Redis(config[_0x29e4('0xc')]));require(_0x29e4('0xf'))[_0x29e4('0x10')](socket);function respondWithRpcPromise(_0x5939d4,_0x2a97d3,_0x455eb2){return new BPromise(function(_0x581818,_0x3d193a){return client['request'](_0x5939d4,_0x455eb2)['then'](function(_0x5e32cb){logger['info'](_0x29e4('0x11'),_0x2a97d3,_0x29e4('0x12'));logger[_0x29e4('0x13')]('Team,\x20%s,\x20%s,\x20%s',_0x2a97d3,_0x29e4('0x12'),JSON[_0x29e4('0x14')](_0x5e32cb));if(_0x5e32cb[_0x29e4('0x15')]){if(_0x5e32cb['error'][_0x29e4('0x16')]===0x1f4){logger[_0x29e4('0x15')](_0x29e4('0x11'),_0x2a97d3,_0x5e32cb[_0x29e4('0x15')][_0x29e4('0x17')]);return _0x3d193a(_0x5e32cb['error'][_0x29e4('0x17')]);}logger['error'](_0x29e4('0x11'),_0x2a97d3,_0x5e32cb[_0x29e4('0x15')][_0x29e4('0x17')]);return _0x581818(_0x5e32cb['error']['message']);}else{logger[_0x29e4('0x18')](_0x29e4('0x11'),_0x2a97d3,_0x29e4('0x12'));_0x581818(_0x5e32cb['result']['message']);}})['catch'](function(_0x3e6e68){logger[_0x29e4('0x15')](_0x29e4('0x11'),_0x2a97d3,_0x3e6e68);_0x3d193a(_0x3e6e68);});});} \ No newline at end of file +var _0xcbf0=['./team.socket','register','then','info','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Team,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x10f875,_0x51f8cf){var _0x3accfa=function(_0x1918ea){while(--_0x1918ea){_0x10f875['push'](_0x10f875['shift']());}};_0x3accfa(++_0x51f8cf);}(_0xcbf0,0x112));var _0x0cbf=function(_0x514ec7,_0x2fc3f7){_0x514ec7=_0x514ec7-0x0;var _0x2024d2=_0xcbf0[_0x514ec7];return _0x2024d2;};'use strict';var _=require('lodash');var util=require(_0x0cbf('0x0'));var moment=require('moment');var BPromise=require(_0x0cbf('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0cbf('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0cbf('0x3'))('rpc');var config=require(_0x0cbf('0x4'));var jayson=require(_0x0cbf('0x5'));var client=jayson[_0x0cbf('0x6')][_0x0cbf('0x7')]({'port':0x232a});config[_0x0cbf('0x8')]=_[_0x0cbf('0x9')](config[_0x0cbf('0x8')],{'host':_0x0cbf('0xa'),'port':0x18eb});var socket=require(_0x0cbf('0xb'))(new Redis(config[_0x0cbf('0x8')]));require(_0x0cbf('0xc'))[_0x0cbf('0xd')](socket);function respondWithRpcPromise(_0x3ea876,_0x2bded9,_0xda5928){return new BPromise(function(_0x27c541,_0x24e242){return client['request'](_0x3ea876,_0xda5928)[_0x0cbf('0xe')](function(_0x21b9fd){logger[_0x0cbf('0xf')]('Team,\x20%s,\x20%s',_0x2bded9,'request\x20sent');logger[_0x0cbf('0x10')](_0x0cbf('0x11'),_0x2bded9,_0x0cbf('0x12'),JSON[_0x0cbf('0x13')](_0x21b9fd));if(_0x21b9fd[_0x0cbf('0x14')]){if(_0x21b9fd[_0x0cbf('0x14')][_0x0cbf('0x15')]===0x1f4){logger[_0x0cbf('0x14')]('Team,\x20%s,\x20%s',_0x2bded9,_0x21b9fd[_0x0cbf('0x14')][_0x0cbf('0x16')]);return _0x24e242(_0x21b9fd[_0x0cbf('0x14')][_0x0cbf('0x16')]);}logger['error'](_0x0cbf('0x17'),_0x2bded9,_0x21b9fd[_0x0cbf('0x14')][_0x0cbf('0x16')]);return _0x27c541(_0x21b9fd[_0x0cbf('0x14')][_0x0cbf('0x16')]);}else{logger[_0x0cbf('0xf')](_0x0cbf('0x17'),_0x2bded9,_0x0cbf('0x12'));_0x27c541(_0x21b9fd[_0x0cbf('0x18')][_0x0cbf('0x16')]);}})[_0x0cbf('0x19')](function(_0x4e3fc2){logger['error']('Team,\x20%s,\x20%s',_0x2bded9,_0x4e3fc2);_0x24e242(_0x4e3fc2);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index e71e357..a9976b0 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 _0xa883=['./team.events','save','remove','update','removeListener','length'];(function(_0x4959f2,_0x3d1162){var _0x12acdc=function(_0x4636f4){while(--_0x4636f4){_0x4959f2['push'](_0x4959f2['shift']());}};_0x12acdc(++_0x3d1162);}(_0xa883,0x1f2));var _0x3a88=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa883[_0x3dd15e];return _0x231fd0;};'use strict';var TeamEvents=require(_0x3a88('0x0'));var events=[_0x3a88('0x1'),_0x3a88('0x2'),_0x3a88('0x3')];function createListener(_0x372d15,_0x1ab838){return function(_0x3ac823){_0x1ab838['emit'](_0x372d15,_0x3ac823);};}function removeListener(_0x56e80e,_0x260c40){return function(){TeamEvents[_0x3a88('0x4')](_0x56e80e,_0x260c40);};}exports['register']=function(_0x21f120){for(var _0x23a4c0=0x0,_0x12d2bc=events[_0x3a88('0x5')];_0x23a4c0<_0x12d2bc;_0x23a4c0++){var _0x37ca80=events[_0x23a4c0];var _0x132a5a=createListener('team:'+_0x37ca80,_0x21f120);TeamEvents['on'](_0x37ca80,_0x132a5a);}}; \ No newline at end of file +var _0xfc0c=['remove','emit','removeListener','register','save'];(function(_0x375419,_0x3cae73){var _0x51e737=function(_0x3682e3){while(--_0x3682e3){_0x375419['push'](_0x375419['shift']());}};_0x51e737(++_0x3cae73);}(_0xfc0c,0x103));var _0xcfc0=function(_0x3992bc,_0x4c9712){_0x3992bc=_0x3992bc-0x0;var _0x316268=_0xfc0c[_0x3992bc];return _0x316268;};'use strict';var TeamEvents=require('./team.events');var events=[_0xcfc0('0x0'),_0xcfc0('0x1'),'update'];function createListener(_0x1e6de7,_0x55cb4e){return function(_0x4d8cb9){_0x55cb4e[_0xcfc0('0x2')](_0x1e6de7,_0x4d8cb9);};}function removeListener(_0x360ca4,_0x252d72){return function(){TeamEvents[_0xcfc0('0x3')](_0x360ca4,_0x252d72);};}exports[_0xcfc0('0x4')]=function(_0x5396d3){for(var _0xae6edc=0x0,_0xad2070=events['length'];_0xae6edc<_0xad2070;_0xae6edc++){var _0x3aa2b3=events[_0xae6edc];var _0xe1e48e=createListener('team:'+_0x3aa2b3,_0x5396d3);TeamEvents['on'](_0x3aa2b3,_0xe1e48e);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 7c760b0..a20dd91 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 _0xf998=['sequelize','INTEGER'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0xf998,0x6c));var _0x8f99=function(_0x5d8778,_0x3c2f0e){_0x5d8778=_0x5d8778-0x0;var _0x133e42=_0xf998[_0x5d8778];return _0x133e42;};'use strict';var Sequelize=require(_0x8f99('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x8f99('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x8f99('0x1')]}}; \ No newline at end of file +var _0x4b96=['exports','INTEGER','sequelize'];(function(_0x4a6cf8,_0x5534ef){var _0x22205e=function(_0x3f4d0d){while(--_0x3f4d0d){_0x4a6cf8['push'](_0x4a6cf8['shift']());}};_0x22205e(++_0x5534ef);}(_0x4b96,0x12e));var _0x64b9=function(_0x199e1b,_0x1e701d){_0x199e1b=_0x199e1b-0x0;var _0x5a9087=_0x4b96[_0x199e1b];return _0x5a9087;};'use strict';var Sequelize=require(_0x64b9('0x0'));module[_0x64b9('0x1')]={'TeamId':{'type':Sequelize[_0x64b9('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 91443bf..5514fa4 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 _0xe98f=['bluebird','rimraf','./teamVoicePrefix.attributes','exports','TeamVoicePrefix','team_has_voice_prefixes','lodash','../../config/logger','moment'];(function(_0xe0339b,_0x42e0da){var _0x625a2=function(_0xaf9fee){while(--_0xaf9fee){_0xe0339b['push'](_0xe0339b['shift']());}};_0x625a2(++_0x42e0da);}(_0xe98f,0xde));var _0xfe98=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe98f[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xfe98('0x0'));var util=require('util');var logger=require(_0xfe98('0x1'))('api');var moment=require(_0xfe98('0x2'));var BPromise=require(_0xfe98('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfe98('0x4'));var config=require('../../config/environment');var attributes=require(_0xfe98('0x5'));module[_0xfe98('0x6')]=function(_0x4a2baa,_0x3aab59){return _0x4a2baa['define'](_0xfe98('0x7'),attributes,{'tableName':_0xfe98('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x38c9=['../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x2464bb,_0xc0ea6){var _0x18716c=function(_0x4e01e4){while(--_0x4e01e4){_0x2464bb['push'](_0x2464bb['shift']());}};_0x18716c(++_0xc0ea6);}(_0x38c9,0x199));var _0x938c=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x38c9[_0x397cfb];return _0x15fed9;};'use strict';var _=require(_0x938c('0x0'));var util=require(_0x938c('0x1'));var logger=require(_0x938c('0x2'))('api');var moment=require(_0x938c('0x3'));var BPromise=require(_0x938c('0x4'));var rp=require(_0x938c('0x5'));var fs=require('fs');var path=require(_0x938c('0x6'));var rimraf=require('rimraf');var config=require(_0x938c('0x7'));var attributes=require(_0x938c('0x8'));module[_0x938c('0x9')]=function(_0x15a858,_0x4dae36){return _0x15a858[_0x938c('0xa')](_0x938c('0xb'),attributes,{'tableName':_0x938c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index d2b1663..7bdc907 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2b719f,_0x532745){var _0x37c8e8=function(_0x9527fa){while(--_0x9527fa){_0x2b719f['push'](_0x2b719f['shift']());}};_0x37c8e8(++_0x532745);}(_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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x592e8e,_0x182f70){var _0x59fcfa=function(_0x1717be){while(--_0x1717be){_0x592e8e['push'](_0x592e8e['shift']());}};_0x59fcfa(++_0x182f70);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 11a68ff..5ed8e91 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 _0x631e=['exports','INTEGER','sequelize'];(function(_0x1dc828,_0x22e493){var _0x3f08fa=function(_0x1f9e9d){while(--_0x1f9e9d){_0x1dc828['push'](_0x1dc828['shift']());}};_0x3f08fa(++_0x22e493);}(_0x631e,0xaa));var _0xe631=function(_0xc760c1,_0x246bc9){_0xc760c1=_0xc760c1-0x0;var _0x363c89=_0x631e[_0xc760c1];return _0x363c89;};'use strict';var Sequelize=require(_0xe631('0x0'));module[_0xe631('0x1')]={'penalty':{'type':Sequelize[_0xe631('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd334=['exports','INTEGER'];(function(_0x5ea53e,_0x19a0dc){var _0xec9350=function(_0x34ee93){while(--_0x34ee93){_0x5ea53e['push'](_0x5ea53e['shift']());}};_0xec9350(++_0x19a0dc);}(_0xd334,0x1b8));var _0x4d33=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xd334[_0x3ff085];return _0x2b68c3;};'use strict';var Sequelize=require('sequelize');module[_0x4d33('0x0')]={'penalty':{'type':Sequelize[_0x4d33('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 2e01d92..252620b 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 _0xea70=['util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','lodash'];(function(_0x435cc5,_0xbde8a4){var _0x1dfa2f=function(_0x1f224e){while(--_0x1f224e){_0x435cc5['push'](_0x435cc5['shift']());}};_0x1dfa2f(++_0xbde8a4);}(_0xea70,0x175));var _0x0ea7=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xea70[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x0ea7('0x0'));var util=require(_0x0ea7('0x1'));var logger=require(_0x0ea7('0x2'))('api');var moment=require(_0x0ea7('0x3'));var BPromise=require('bluebird');var rp=require(_0x0ea7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0ea7('0x5'));var config=require(_0x0ea7('0x6'));var attributes=require(_0x0ea7('0x7'));module[_0x0ea7('0x8')]=function(_0x168372,_0x489be9){return _0x168372[_0x0ea7('0x9')](_0x0ea7('0xa'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa41a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','team_has_voice_queues','lodash','util','api'];(function(_0x2a2edd,_0x217b41){var _0x370173=function(_0x2f6196){while(--_0x2f6196){_0x2a2edd['push'](_0x2a2edd['shift']());}};_0x370173(++_0x217b41);}(_0xa41a,0x6b));var _0xaa41=function(_0x24332d,_0x1d36f7){_0x24332d=_0x24332d-0x0;var _0x26e3e2=_0xa41a[_0x24332d];return _0x26e3e2;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var logger=require('../../config/logger')(_0xaa41('0x2'));var moment=require(_0xaa41('0x3'));var BPromise=require(_0xaa41('0x4'));var rp=require(_0xaa41('0x5'));var fs=require('fs');var path=require(_0xaa41('0x6'));var rimraf=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var attributes=require(_0xaa41('0x9'));module['exports']=function(_0x2122a0,_0x1ec9d4){return _0x2122a0['define']('TeamVoiceQueue',attributes,{'tableName':_0xaa41('0xa'),'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 6867668..f01382c 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 _0xa0e7=['request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','ioredis','../../config/logger','client','http','request','info','TeamVoiceQueue,\x20%s,\x20%s'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa0e7,0xaa));var _0x7a0e=function(_0x39e01a,_0xf22954){_0x39e01a=_0x39e01a-0x0;var _0x45a504=_0xa0e7[_0x39e01a];return _0x45a504;};'use strict';var _=require(_0x7a0e('0x0'));var util=require(_0x7a0e('0x1'));var moment=require('moment');var BPromise=require(_0x7a0e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a0e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7a0e('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7a0e('0x5')][_0x7a0e('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3ec1d7,_0x12ff84,_0xe574fc){return new BPromise(function(_0x519761,_0x486b59){return client[_0x7a0e('0x7')](_0x3ec1d7,_0xe574fc)['then'](function(_0x382e72){logger[_0x7a0e('0x8')](_0x7a0e('0x9'),_0x12ff84,_0x7a0e('0xa'));logger[_0x7a0e('0xb')](_0x7a0e('0xc'),_0x12ff84,_0x7a0e('0xa'),JSON[_0x7a0e('0xd')](_0x382e72));if(_0x382e72[_0x7a0e('0xe')]){if(_0x382e72[_0x7a0e('0xe')][_0x7a0e('0xf')]===0x1f4){logger[_0x7a0e('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x12ff84,_0x382e72[_0x7a0e('0xe')]['message']);return _0x486b59(_0x382e72[_0x7a0e('0xe')][_0x7a0e('0x10')]);}logger[_0x7a0e('0xe')](_0x7a0e('0x9'),_0x12ff84,_0x382e72[_0x7a0e('0xe')][_0x7a0e('0x10')]);return _0x519761(_0x382e72[_0x7a0e('0xe')][_0x7a0e('0x10')]);}else{logger[_0x7a0e('0x8')](_0x7a0e('0x9'),_0x12ff84,'request\x20sent');_0x519761(_0x382e72[_0x7a0e('0x11')][_0x7a0e('0x10')]);}})['catch'](function(_0x489c0c){logger[_0x7a0e('0xe')](_0x7a0e('0x9'),_0x12ff84,_0x489c0c);_0x486b59(_0x489c0c);});});} \ No newline at end of file +var _0xbacf=['TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','debug'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xbacf,0xf9));var _0xfbac=function(_0x25248b,_0x3c8491){_0x25248b=_0x25248b-0x0;var _0x509939=_0xbacf[_0x25248b];return _0x509939;};'use strict';var _=require('lodash');var util=require(_0xfbac('0x0'));var moment=require(_0xfbac('0x1'));var BPromise=require(_0xfbac('0x2'));var rs=require(_0xfbac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfbac('0x4'))(_0xfbac('0x5'));var config=require(_0xfbac('0x6'));var jayson=require(_0xfbac('0x7'));var client=jayson[_0xfbac('0x8')][_0xfbac('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32a173,_0x31ff42,_0x5880c9){return new BPromise(function(_0x38c928,_0x35d67f){return client[_0xfbac('0xa')](_0x32a173,_0x5880c9)[_0xfbac('0xb')](function(_0x1b91a6){logger[_0xfbac('0xc')](_0xfbac('0xd'),_0x31ff42,'request\x20sent');logger[_0xfbac('0xe')](_0xfbac('0xf'),_0x31ff42,_0xfbac('0x10'),JSON[_0xfbac('0x11')](_0x1b91a6));if(_0x1b91a6[_0xfbac('0x12')]){if(_0x1b91a6[_0xfbac('0x12')]['code']===0x1f4){logger[_0xfbac('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x31ff42,_0x1b91a6[_0xfbac('0x12')][_0xfbac('0x13')]);return _0x35d67f(_0x1b91a6['error'][_0xfbac('0x13')]);}logger['error'](_0xfbac('0xd'),_0x31ff42,_0x1b91a6[_0xfbac('0x12')]['message']);return _0x38c928(_0x1b91a6[_0xfbac('0x12')][_0xfbac('0x13')]);}else{logger[_0xfbac('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0x31ff42,_0xfbac('0x10'));_0x38c928(_0x1b91a6[_0xfbac('0x14')][_0xfbac('0x13')]);}})[_0xfbac('0x15')](function(_0x2b316a){logger[_0xfbac('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x31ff42,_0x2b316a);_0x35d67f(_0x2b316a);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index fe8acae..cb3c60c 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 _0xe558=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./template.controller','get','isAuthenticated','index','/:id','show','post','create','destroy','exports','multer','util'];(function(_0x16e085,_0x490c53){var _0x726c1a=function(_0x2c7b95){while(--_0x2c7b95){_0x16e085['push'](_0x16e085['shift']());}};_0x726c1a(++_0x490c53);}(_0xe558,0x70));var _0x8e55=function(_0x3fafa9,_0x26ced3){_0x3fafa9=_0x3fafa9-0x0;var _0x12e7a4=_0xe558[_0x3fafa9];return _0x12e7a4;};'use strict';var multer=require(_0x8e55('0x0'));var util=require(_0x8e55('0x1'));var path=require(_0x8e55('0x2'));var timeout=require(_0x8e55('0x3'));var express=require(_0x8e55('0x4'));var router=express[_0x8e55('0x5')]();var fs_extra=require(_0x8e55('0x6'));var auth=require(_0x8e55('0x7'));var interaction=require(_0x8e55('0x8'));var config=require('../../config/environment');var controller=require(_0x8e55('0x9'));router[_0x8e55('0xa')]('/',auth[_0x8e55('0xb')](),controller[_0x8e55('0xc')]);router[_0x8e55('0xa')](_0x8e55('0xd'),auth['isAuthenticated'](),controller[_0x8e55('0xe')]);router[_0x8e55('0xf')]('/',auth['isAuthenticated'](),controller[_0x8e55('0x10')]);router['put']('/:id',auth[_0x8e55('0xb')](),controller['update']);router['delete']('/:id',auth[_0x8e55('0xb')](),controller[_0x8e55('0x11')]);module[_0x8e55('0x12')]=router; \ No newline at end of file +var _0x2ace=['create','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x1d7300,_0x17f109){var _0x46ee98=function(_0x5ee16a){while(--_0x5ee16a){_0x1d7300['push'](_0x1d7300['shift']());}};_0x46ee98(++_0x17f109);}(_0x2ace,0x17e));var _0xe2ac=function(_0x4fe19c,_0x45d0fe){_0x4fe19c=_0x4fe19c-0x0;var _0x952ac7=_0x2ace[_0x4fe19c];return _0x952ac7;};'use strict';var multer=require('multer');var util=require(_0xe2ac('0x0'));var path=require(_0xe2ac('0x1'));var timeout=require(_0xe2ac('0x2'));var express=require('express');var router=express[_0xe2ac('0x3')]();var fs_extra=require(_0xe2ac('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe2ac('0x5'));var config=require(_0xe2ac('0x6'));var controller=require(_0xe2ac('0x7'));router[_0xe2ac('0x8')]('/',auth[_0xe2ac('0x9')](),controller[_0xe2ac('0xa')]);router[_0xe2ac('0x8')](_0xe2ac('0xb'),auth[_0xe2ac('0x9')](),controller[_0xe2ac('0xc')]);router[_0xe2ac('0xd')]('/',auth[_0xe2ac('0x9')](),controller[_0xe2ac('0xe')]);router['put']('/:id',auth[_0xe2ac('0x9')](),controller['update']);router[_0xe2ac('0xf')](_0xe2ac('0xb'),auth['isAuthenticated'](),controller[_0xe2ac('0x10')]);module[_0xe2ac('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index b598ae0..aa29c41 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 _0x87ba=['exports','STRING'];(function(_0x410bcf,_0x2e1de3){var _0x110c54=function(_0x4369d5){while(--_0x4369d5){_0x410bcf['push'](_0x410bcf['shift']());}};_0x110c54(++_0x2e1de3);}(_0x87ba,0x1da));var _0xa87b=function(_0x537044,_0x4de18f){_0x537044=_0x537044-0x0;var _0x5ba75e=_0x87ba[_0x537044];return _0x5ba75e;};'use strict';var Sequelize=require('sequelize');module[_0xa87b('0x0')]={'name':{'type':Sequelize[_0xa87b('0x1')]},'description':{'type':Sequelize[_0xa87b('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x5a03=['STRING','TEXT','sequelize','exports'];(function(_0x5b5eb4,_0x117c87){var _0x42af53=function(_0xdf6fcb){while(--_0xdf6fcb){_0x5b5eb4['push'](_0x5b5eb4['shift']());}};_0x42af53(++_0x117c87);}(_0x5a03,0x19e));var _0x35a0=function(_0x4c7006,_0x40d35b){_0x4c7006=_0x4c7006-0x0;var _0x408ca2=_0x5a03[_0x4c7006];return _0x408ca2;};'use strict';var Sequelize=require(_0x35a0('0x0'));module[_0x35a0('0x1')]={'name':{'type':Sequelize[_0x35a0('0x2')]},'description':{'type':Sequelize[_0x35a0('0x2')]},'html':{'type':Sequelize[_0x35a0('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 2103eba..8d4d0dd 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 _0x7a07=['model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','includeAll','include','rows','catch','show','params','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','Template','rawAttributes','fieldName','type','key','query','keys','filters','intersection'];(function(_0x209e9a,_0x450df3){var _0x553c12=function(_0x43a7f6){while(--_0x43a7f6){_0x209e9a['push'](_0x209e9a['shift']());}};_0x553c12(++_0x450df3);}(_0x7a07,0x6c));var _0x77a0=function(_0x38b7e4,_0x555961){_0x38b7e4=_0x38b7e4-0x0;var _0x38ff05=_0x7a07[_0x38b7e4];return _0x38ff05;};'use strict';var emlformat=require(_0x77a0('0x0'));var rimraf=require(_0x77a0('0x1'));var zipdir=require(_0x77a0('0x2'));var jsonpatch=require(_0x77a0('0x3'));var rp=require(_0x77a0('0x4'));var moment=require(_0x77a0('0x5'));var BPromise=require(_0x77a0('0x6'));var Mustache=require('mustache');var util=require(_0x77a0('0x7'));var path=require(_0x77a0('0x8'));var sox=require(_0x77a0('0x9'));var csv=require(_0x77a0('0xa'));var ejs=require(_0x77a0('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x77a0('0xc'));var squel=require('squel');var crypto=require(_0x77a0('0xd'));var jsforce=require(_0x77a0('0xe'));var deskjs=require(_0x77a0('0xf'));var toCsv=require(_0x77a0('0xa'));var querystring=require(_0x77a0('0x10'));var Papa=require('papaparse');var Redis=require(_0x77a0('0x11'));var authService=require(_0x77a0('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x77a0('0x13'));var hardwareService=require(_0x77a0('0x14'));var logger=require('../../config/logger')(_0x77a0('0x15'));var utils=require('../../config/utils');var config=require(_0x77a0('0x16'));var licenseUtil=require(_0x77a0('0x17'));var db=require(_0x77a0('0x18'))['db'];function respondWithStatusCode(_0x8b941b,_0x279738){_0x279738=_0x279738||0xcc;return function(_0xc0e9){if(_0xc0e9){return _0x8b941b[_0x77a0('0x19')](_0x279738);}return _0x8b941b['status'](_0x279738)[_0x77a0('0x1a')]();};}function respondWithResult(_0x504be4,_0x3d829d){_0x3d829d=_0x3d829d||0xc8;return function(_0x206301){if(_0x206301){return _0x504be4[_0x77a0('0x1b')](_0x3d829d)['json'](_0x206301);}};}function respondWithFilteredResult(_0x2623fd,_0x172c33){return function(_0x4478fd){if(_0x4478fd){var _0x3a2cd3=typeof _0x172c33[_0x77a0('0x1c')]===_0x77a0('0x1d')&&typeof _0x172c33[_0x77a0('0x1e')]==='undefined';var _0x550e84=_0x4478fd[_0x77a0('0x1f')];var _0x71b20f=_0x3a2cd3?0x0:_0x172c33['offset'];var _0xe83b5d=_0x3a2cd3?_0x4478fd['count']:_0x172c33[_0x77a0('0x1c')]+_0x172c33[_0x77a0('0x1e')];var _0x114a02;if(_0xe83b5d>=_0x550e84){_0xe83b5d=_0x550e84;_0x114a02=0xc8;}else{_0x114a02=0xce;}_0x2623fd['status'](_0x114a02);return _0x2623fd[_0x77a0('0x20')]('Content-Range',_0x71b20f+'-'+_0xe83b5d+'/'+_0x550e84)[_0x77a0('0x21')](_0x4478fd);}return null;};}function patchUpdates(_0x46d106){return function(_0x4be28b){try{jsonpatch[_0x77a0('0x22')](_0x4be28b,_0x46d106,!![]);}catch(_0x2ea5a8){return BPromise['reject'](_0x2ea5a8);}return _0x4be28b[_0x77a0('0x23')]();};}function saveUpdates(_0x22d9a2,_0x4d679e){return function(_0x1a6cf7){if(_0x1a6cf7){return _0x1a6cf7[_0x77a0('0x24')](_0x22d9a2)[_0x77a0('0x25')](function(_0x56e863){return _0x56e863;});}return null;};}function removeEntity(_0x4a2f2c,_0x21958c){return function(_0x1f5bbe){if(_0x1f5bbe){return _0x1f5bbe['destroy']()[_0x77a0('0x25')](function(){var _0x5481c6=_0x1f5bbe[_0x77a0('0x26')]({'plain':!![]});var _0x23aa58='Templates';return db[_0x77a0('0x27')][_0x77a0('0x28')]({'where':{'type':_0x23aa58,'resourceId':_0x5481c6['id']}})[_0x77a0('0x25')](function(){return _0x1f5bbe;});})[_0x77a0('0x25')](function(){_0x4a2f2c['status'](0xcc)[_0x77a0('0x1a')]();});}};}function handleEntityNotFound(_0x5ab5b0,_0x5eb671){return function(_0x49c8e0){if(!_0x49c8e0){_0x5ab5b0[_0x77a0('0x19')](0x194);}return _0x49c8e0;};}function handleError(_0x1242ff,_0x155757){_0x155757=_0x155757||0x1f4;return function(_0x3f1e98){logger[_0x77a0('0x29')](_0x3f1e98[_0x77a0('0x2a')]);if(_0x3f1e98[_0x77a0('0x2b')]){delete _0x3f1e98[_0x77a0('0x2b')];}_0x1242ff[_0x77a0('0x1b')](_0x155757)[_0x77a0('0x2c')](_0x3f1e98);};}exports[_0x77a0('0x2d')]=function(_0x1ed5bc,_0x4528ae){var _0x9038a3={},_0x59bae1={},_0x177e4a={'count':0x0,'rows':[]};var _0x54154a=_[_0x77a0('0x2e')](db[_0x77a0('0x2f')][_0x77a0('0x30')],function(_0x4f4a50){return{'name':_0x4f4a50[_0x77a0('0x31')],'type':_0x4f4a50[_0x77a0('0x32')][_0x77a0('0x33')]};});_0x59bae1['model']=_[_0x77a0('0x2e')](_0x54154a,_0x77a0('0x2b'));_0x59bae1[_0x77a0('0x34')]=_[_0x77a0('0x35')](_0x1ed5bc[_0x77a0('0x34')]);_0x59bae1[_0x77a0('0x36')]=_[_0x77a0('0x37')](_0x59bae1[_0x77a0('0x38')],_0x59bae1[_0x77a0('0x34')]);_0x9038a3['attributes']=_[_0x77a0('0x37')](_0x59bae1[_0x77a0('0x38')],qs[_0x77a0('0x39')](_0x1ed5bc[_0x77a0('0x34')][_0x77a0('0x39')]));_0x9038a3['attributes']=_0x9038a3[_0x77a0('0x3a')]['length']?_0x9038a3[_0x77a0('0x3a')]:_0x59bae1[_0x77a0('0x38')];if(!_0x1ed5bc[_0x77a0('0x34')][_0x77a0('0x3b')](_0x77a0('0x3c'))){_0x9038a3[_0x77a0('0x1e')]=qs['limit'](_0x1ed5bc['query']['limit']);_0x9038a3[_0x77a0('0x1c')]=qs['offset'](_0x1ed5bc[_0x77a0('0x34')][_0x77a0('0x1c')]);}_0x9038a3[_0x77a0('0x3d')]=qs['sort'](_0x1ed5bc[_0x77a0('0x34')][_0x77a0('0x3e')]);_0x9038a3[_0x77a0('0x3f')]=qs['filters'](_['pick'](_0x1ed5bc['query'],_0x59bae1['filters']),_0x54154a);if(_0x1ed5bc[_0x77a0('0x34')][_0x77a0('0x40')]){_0x9038a3[_0x77a0('0x3f')]=_['merge'](_0x9038a3[_0x77a0('0x3f')],{'$or':_[_0x77a0('0x2e')](_0x54154a,function(_0xc50425){if(_0xc50425['type']!==_0x77a0('0x41')){var _0x325175={};_0x325175[_0xc50425[_0x77a0('0x2b')]]={'$like':'%'+_0x1ed5bc['query']['filter']+'%'};return _0x325175;}})});}_0x9038a3=_['merge']({},_0x9038a3,_0x1ed5bc['options']);var _0x18d262={'where':_0x9038a3[_0x77a0('0x3f')]};return db[_0x77a0('0x2f')][_0x77a0('0x1f')](_0x18d262)['then'](function(_0x2cd90d){_0x177e4a['count']=_0x2cd90d;if(_0x1ed5bc[_0x77a0('0x34')][_0x77a0('0x42')]){_0x9038a3[_0x77a0('0x43')]=[{'all':!![]}];}return db[_0x77a0('0x2f')]['findAll'](_0x9038a3);})['then'](function(_0x64360f){_0x177e4a[_0x77a0('0x44')]=_0x64360f;return _0x177e4a;})[_0x77a0('0x25')](respondWithFilteredResult(_0x4528ae,_0x9038a3))[_0x77a0('0x45')](handleError(_0x4528ae,null));};exports[_0x77a0('0x46')]=function(_0x5ce249,_0x1217d4){var _0x4d5487={'raw':!![],'where':{'id':_0x5ce249[_0x77a0('0x47')]['id']}},_0x274bf4={};_0x274bf4['model']=_[_0x77a0('0x35')](db[_0x77a0('0x2f')]['rawAttributes']);_0x274bf4[_0x77a0('0x34')]=_[_0x77a0('0x35')](_0x5ce249[_0x77a0('0x34')]);_0x274bf4[_0x77a0('0x36')]=_[_0x77a0('0x37')](_0x274bf4[_0x77a0('0x38')],_0x274bf4[_0x77a0('0x34')]);_0x4d5487[_0x77a0('0x3a')]=_[_0x77a0('0x37')](_0x274bf4[_0x77a0('0x38')],qs[_0x77a0('0x39')](_0x5ce249['query'][_0x77a0('0x39')]));_0x4d5487[_0x77a0('0x3a')]=_0x4d5487[_0x77a0('0x3a')]['length']?_0x4d5487[_0x77a0('0x3a')]:_0x274bf4[_0x77a0('0x38')];if(_0x5ce249[_0x77a0('0x34')][_0x77a0('0x42')]){_0x4d5487[_0x77a0('0x43')]=[{'all':!![]}];}_0x4d5487=_[_0x77a0('0x48')]({},_0x4d5487,_0x5ce249['options']);return db[_0x77a0('0x2f')][_0x77a0('0x49')](_0x4d5487)[_0x77a0('0x25')](handleEntityNotFound(_0x1217d4,null))[_0x77a0('0x25')](respondWithResult(_0x1217d4,null))[_0x77a0('0x45')](handleError(_0x1217d4,null));};exports[_0x77a0('0x4a')]=function(_0x175cba,_0x553746){return db[_0x77a0('0x2f')][_0x77a0('0x4a')](_0x175cba[_0x77a0('0x4b')],{})[_0x77a0('0x25')](function(_0x3f3646){var _0x308a6c=_0x175cba[_0x77a0('0x4c')][_0x77a0('0x26')]({'plain':!![]});if(!_0x308a6c)throw new Error(_0x77a0('0x4d'));if(_0x308a6c[_0x77a0('0x4e')]==='user'){var _0x21a8e2=_0x3f3646[_0x77a0('0x26')]({'plain':!![]});var _0x3540ec='Templates';return db[_0x77a0('0x4f')][_0x77a0('0x49')]({'where':{'name':_0x3540ec,'userProfileId':_0x308a6c['userProfileId']},'raw':!![]})[_0x77a0('0x25')](function(_0x40221a){if(_0x40221a&&_0x40221a[_0x77a0('0x50')]===0x0){return db[_0x77a0('0x27')][_0x77a0('0x4a')]({'name':_0x21a8e2[_0x77a0('0x2b')],'resourceId':_0x21a8e2['id'],'type':_0x40221a[_0x77a0('0x2b')],'sectionId':_0x40221a['id']},{})[_0x77a0('0x25')](function(){return _0x3f3646;});}else{return _0x3f3646;}})[_0x77a0('0x45')](function(_0x46e064){logger[_0x77a0('0x29')](_0x77a0('0x51'),_0x46e064);throw _0x46e064;});}return _0x3f3646;})[_0x77a0('0x25')](respondWithResult(_0x553746,0xc9))[_0x77a0('0x45')](handleError(_0x553746,null));};exports['update']=function(_0x4323e2,_0x362896){if(_0x4323e2[_0x77a0('0x4b')]['id']){delete _0x4323e2[_0x77a0('0x4b')]['id'];}return db['Template'][_0x77a0('0x49')]({'where':{'id':_0x4323e2[_0x77a0('0x47')]['id']}})[_0x77a0('0x25')](handleEntityNotFound(_0x362896,null))[_0x77a0('0x25')](saveUpdates(_0x4323e2[_0x77a0('0x4b')],null))[_0x77a0('0x25')](respondWithResult(_0x362896,null))[_0x77a0('0x45')](handleError(_0x362896,null));};exports['destroy']=function(_0x2c74b0,_0x24c4ec){return db[_0x77a0('0x2f')][_0x77a0('0x49')]({'where':{'id':_0x2c74b0['params']['id']}})[_0x77a0('0x25')](handleEntityNotFound(_0x24c4ec,null))[_0x77a0('0x25')](removeEntity(_0x24c4ec,null))[_0x77a0('0x45')](handleError(_0x24c4ec,null));}; \ No newline at end of file +var _0x5d29=['../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','Templates','UserProfileResource','error','send','index','map','Template','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','catch','show','params','intersection','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3d9b04,_0x1e851a){var _0x557936=function(_0x3bf3ae){while(--_0x3bf3ae){_0x3d9b04['push'](_0x3d9b04['shift']());}};_0x557936(++_0x1e851a);}(_0x5d29,0x187));var _0x95d2=function(_0x2d1610,_0x463b9b){_0x2d1610=_0x2d1610-0x0;var _0x5bb4ca=_0x5d29[_0x2d1610];return _0x5bb4ca;};'use strict';var emlformat=require(_0x95d2('0x0'));var rimraf=require(_0x95d2('0x1'));var zipdir=require(_0x95d2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x95d2('0x3'));var moment=require('moment');var BPromise=require(_0x95d2('0x4'));var Mustache=require(_0x95d2('0x5'));var util=require(_0x95d2('0x6'));var path=require('path');var sox=require(_0x95d2('0x7'));var csv=require(_0x95d2('0x8'));var ejs=require(_0x95d2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x95d2('0xa'));var crypto=require('crypto');var jsforce=require(_0x95d2('0xb'));var deskjs=require(_0x95d2('0xc'));var toCsv=require(_0x95d2('0x8'));var querystring=require(_0x95d2('0xd'));var Papa=require(_0x95d2('0xe'));var Redis=require(_0x95d2('0xf'));var authService=require(_0x95d2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x95d2('0x11'));var hardwareService=require(_0x95d2('0x12'));var logger=require(_0x95d2('0x13'))(_0x95d2('0x14'));var utils=require('../../config/utils');var config=require(_0x95d2('0x15'));var licenseUtil=require(_0x95d2('0x16'));var db=require(_0x95d2('0x17'))['db'];function respondWithStatusCode(_0x33cf2c,_0x252b08){_0x252b08=_0x252b08||0xcc;return function(_0xb8eb94){if(_0xb8eb94){return _0x33cf2c[_0x95d2('0x18')](_0x252b08);}return _0x33cf2c[_0x95d2('0x19')](_0x252b08)[_0x95d2('0x1a')]();};}function respondWithResult(_0x20735f,_0x4f92a8){_0x4f92a8=_0x4f92a8||0xc8;return function(_0x7d959){if(_0x7d959){return _0x20735f[_0x95d2('0x19')](_0x4f92a8)['json'](_0x7d959);}};}function respondWithFilteredResult(_0x53c16f,_0x3f5dc1){return function(_0x954f4d){if(_0x954f4d){var _0x342682=typeof _0x3f5dc1[_0x95d2('0x1b')]==='undefined'&&typeof _0x3f5dc1['limit']===_0x95d2('0x1c');var _0x299947=_0x954f4d['count'];var _0x469a3f=_0x342682?0x0:_0x3f5dc1[_0x95d2('0x1b')];var _0x24db7f=_0x342682?_0x954f4d['count']:_0x3f5dc1[_0x95d2('0x1b')]+_0x3f5dc1[_0x95d2('0x1d')];var _0x491a58;if(_0x24db7f>=_0x299947){_0x24db7f=_0x299947;_0x491a58=0xc8;}else{_0x491a58=0xce;}_0x53c16f[_0x95d2('0x19')](_0x491a58);return _0x53c16f[_0x95d2('0x1e')](_0x95d2('0x1f'),_0x469a3f+'-'+_0x24db7f+'/'+_0x299947)['json'](_0x954f4d);}return null;};}function patchUpdates(_0x1bcd8a){return function(_0x5f28fc){try{jsonpatch[_0x95d2('0x20')](_0x5f28fc,_0x1bcd8a,!![]);}catch(_0x379beb){return BPromise[_0x95d2('0x21')](_0x379beb);}return _0x5f28fc[_0x95d2('0x22')]();};}function saveUpdates(_0x19c37e,_0x389f88){return function(_0x43d984){if(_0x43d984){return _0x43d984['update'](_0x19c37e)[_0x95d2('0x23')](function(_0x3223b0){return _0x3223b0;});}return null;};}function removeEntity(_0x2f2003,_0x5ad5a2){return function(_0x361667){if(_0x361667){return _0x361667[_0x95d2('0x24')]()[_0x95d2('0x23')](function(){var _0x1628e2=_0x361667['get']({'plain':!![]});var _0x110e4d=_0x95d2('0x25');return db[_0x95d2('0x26')][_0x95d2('0x24')]({'where':{'type':_0x110e4d,'resourceId':_0x1628e2['id']}})[_0x95d2('0x23')](function(){return _0x361667;});})['then'](function(){_0x2f2003['status'](0xcc)[_0x95d2('0x1a')]();});}};}function handleEntityNotFound(_0x23a8d7,_0x30b203){return function(_0x161946){if(!_0x161946){_0x23a8d7[_0x95d2('0x18')](0x194);}return _0x161946;};}function handleError(_0x486a5a,_0x1261a1){_0x1261a1=_0x1261a1||0x1f4;return function(_0x14b6cf){logger[_0x95d2('0x27')](_0x14b6cf['stack']);if(_0x14b6cf['name']){delete _0x14b6cf['name'];}_0x486a5a[_0x95d2('0x19')](_0x1261a1)[_0x95d2('0x28')](_0x14b6cf);};}exports[_0x95d2('0x29')]=function(_0x1b7d0d,_0x38a321){var _0x167a5b={},_0x95d52e={},_0x4bd3d0={'count':0x0,'rows':[]};var _0x32438a=_[_0x95d2('0x2a')](db[_0x95d2('0x2b')][_0x95d2('0x2c')],function(_0x330185){return{'name':_0x330185[_0x95d2('0x2d')],'type':_0x330185[_0x95d2('0x2e')][_0x95d2('0x2f')]};});_0x95d52e[_0x95d2('0x30')]=_[_0x95d2('0x2a')](_0x32438a,_0x95d2('0x31'));_0x95d52e[_0x95d2('0x32')]=_[_0x95d2('0x33')](_0x1b7d0d['query']);_0x95d52e[_0x95d2('0x34')]=_['intersection'](_0x95d52e[_0x95d2('0x30')],_0x95d52e[_0x95d2('0x32')]);_0x167a5b[_0x95d2('0x35')]=_['intersection'](_0x95d52e[_0x95d2('0x30')],qs['fields'](_0x1b7d0d[_0x95d2('0x32')][_0x95d2('0x36')]));_0x167a5b[_0x95d2('0x35')]=_0x167a5b[_0x95d2('0x35')][_0x95d2('0x37')]?_0x167a5b['attributes']:_0x95d52e['model'];if(!_0x1b7d0d[_0x95d2('0x32')]['hasOwnProperty']('nolimit')){_0x167a5b[_0x95d2('0x1d')]=qs[_0x95d2('0x1d')](_0x1b7d0d[_0x95d2('0x32')][_0x95d2('0x1d')]);_0x167a5b['offset']=qs[_0x95d2('0x1b')](_0x1b7d0d[_0x95d2('0x32')][_0x95d2('0x1b')]);}_0x167a5b[_0x95d2('0x38')]=qs[_0x95d2('0x39')](_0x1b7d0d[_0x95d2('0x32')][_0x95d2('0x39')]);_0x167a5b[_0x95d2('0x3a')]=qs[_0x95d2('0x34')](_[_0x95d2('0x3b')](_0x1b7d0d['query'],_0x95d52e['filters']),_0x32438a);if(_0x1b7d0d[_0x95d2('0x32')][_0x95d2('0x3c')]){_0x167a5b[_0x95d2('0x3a')]=_[_0x95d2('0x3d')](_0x167a5b['where'],{'$or':_[_0x95d2('0x2a')](_0x32438a,function(_0x3900fd){if(_0x3900fd[_0x95d2('0x2e')]!==_0x95d2('0x3e')){var _0xfbb09b={};_0xfbb09b[_0x3900fd[_0x95d2('0x31')]]={'$like':'%'+_0x1b7d0d[_0x95d2('0x32')][_0x95d2('0x3c')]+'%'};return _0xfbb09b;}})});}_0x167a5b=_[_0x95d2('0x3d')]({},_0x167a5b,_0x1b7d0d[_0x95d2('0x3f')]);var _0x2c1f4a={'where':_0x167a5b[_0x95d2('0x3a')]};return db[_0x95d2('0x2b')][_0x95d2('0x40')](_0x2c1f4a)[_0x95d2('0x23')](function(_0x1af320){_0x4bd3d0[_0x95d2('0x40')]=_0x1af320;if(_0x1b7d0d['query'][_0x95d2('0x41')]){_0x167a5b[_0x95d2('0x42')]=[{'all':!![]}];}return db[_0x95d2('0x2b')]['findAll'](_0x167a5b);})[_0x95d2('0x23')](function(_0x43122f){_0x4bd3d0['rows']=_0x43122f;return _0x4bd3d0;})[_0x95d2('0x23')](respondWithFilteredResult(_0x38a321,_0x167a5b))[_0x95d2('0x43')](handleError(_0x38a321,null));};exports[_0x95d2('0x44')]=function(_0x11e468,_0x1637dc){var _0x31627a={'raw':!![],'where':{'id':_0x11e468[_0x95d2('0x45')]['id']}},_0xcc4576={};_0xcc4576[_0x95d2('0x30')]=_[_0x95d2('0x33')](db['Template'][_0x95d2('0x2c')]);_0xcc4576[_0x95d2('0x32')]=_[_0x95d2('0x33')](_0x11e468[_0x95d2('0x32')]);_0xcc4576[_0x95d2('0x34')]=_['intersection'](_0xcc4576[_0x95d2('0x30')],_0xcc4576[_0x95d2('0x32')]);_0x31627a['attributes']=_[_0x95d2('0x46')](_0xcc4576[_0x95d2('0x30')],qs[_0x95d2('0x36')](_0x11e468[_0x95d2('0x32')][_0x95d2('0x36')]));_0x31627a['attributes']=_0x31627a['attributes'][_0x95d2('0x37')]?_0x31627a[_0x95d2('0x35')]:_0xcc4576['model'];if(_0x11e468[_0x95d2('0x32')][_0x95d2('0x41')]){_0x31627a['include']=[{'all':!![]}];}_0x31627a=_[_0x95d2('0x3d')]({},_0x31627a,_0x11e468[_0x95d2('0x3f')]);return db[_0x95d2('0x2b')]['find'](_0x31627a)[_0x95d2('0x23')](handleEntityNotFound(_0x1637dc,null))['then'](respondWithResult(_0x1637dc,null))[_0x95d2('0x43')](handleError(_0x1637dc,null));};exports['create']=function(_0x49a3a4,_0x16bdef){return db[_0x95d2('0x2b')][_0x95d2('0x47')](_0x49a3a4['body'],{})[_0x95d2('0x23')](function(_0x572f65){var _0x1f9098=_0x49a3a4[_0x95d2('0x48')]['get']({'plain':!![]});if(!_0x1f9098)throw new Error(_0x95d2('0x49'));if(_0x1f9098[_0x95d2('0x4a')]===_0x95d2('0x48')){var _0x23c416=_0x572f65[_0x95d2('0x4b')]({'plain':!![]});var _0x4e72d3=_0x95d2('0x25');return db['UserProfileSection'][_0x95d2('0x4c')]({'where':{'name':_0x4e72d3,'userProfileId':_0x1f9098[_0x95d2('0x4d')]},'raw':!![]})[_0x95d2('0x23')](function(_0x431ee6){if(_0x431ee6&&_0x431ee6[_0x95d2('0x4e')]===0x0){return db[_0x95d2('0x26')][_0x95d2('0x47')]({'name':_0x23c416[_0x95d2('0x31')],'resourceId':_0x23c416['id'],'type':_0x431ee6[_0x95d2('0x31')],'sectionId':_0x431ee6['id']},{})['then'](function(){return _0x572f65;});}else{return _0x572f65;}})[_0x95d2('0x43')](function(_0x393d1e){logger['error'](_0x95d2('0x4f'),_0x393d1e);throw _0x393d1e;});}return _0x572f65;})[_0x95d2('0x23')](respondWithResult(_0x16bdef,0xc9))[_0x95d2('0x43')](handleError(_0x16bdef,null));};exports[_0x95d2('0x50')]=function(_0x41f758,_0x5cd336){if(_0x41f758['body']['id']){delete _0x41f758[_0x95d2('0x51')]['id'];}return db['Template']['find']({'where':{'id':_0x41f758[_0x95d2('0x45')]['id']}})[_0x95d2('0x23')](handleEntityNotFound(_0x5cd336,null))['then'](saveUpdates(_0x41f758[_0x95d2('0x51')],null))[_0x95d2('0x23')](respondWithResult(_0x5cd336,null))[_0x95d2('0x43')](handleError(_0x5cd336,null));};exports[_0x95d2('0x24')]=function(_0x37f109,_0x232722){return db[_0x95d2('0x2b')][_0x95d2('0x4c')]({'where':{'id':_0x37f109[_0x95d2('0x45')]['id']}})[_0x95d2('0x23')](handleEntityNotFound(_0x232722,null))[_0x95d2('0x23')](removeEntity(_0x232722,null))['catch'](handleError(_0x232722,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 4689f5a..eb9fd49 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 _0xdbf2=['../../config/environment','./template.attributes','exports','define','tools_templates','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x2a8afb,_0x17b8b6){var _0x2e4177=function(_0x19b8b8){while(--_0x19b8b8){_0x2a8afb['push'](_0x2a8afb['shift']());}};_0x2e4177(++_0x17b8b6);}(_0xdbf2,0x16d));var _0x2dbf=function(_0x1eb75c,_0x458631){_0x1eb75c=_0x1eb75c-0x0;var _0x99af18=_0xdbf2[_0x1eb75c];return _0x99af18;};'use strict';var _=require(_0x2dbf('0x0'));var util=require(_0x2dbf('0x1'));var logger=require('../../config/logger')(_0x2dbf('0x2'));var moment=require(_0x2dbf('0x3'));var BPromise=require('bluebird');var rp=require(_0x2dbf('0x4'));var fs=require('fs');var path=require(_0x2dbf('0x5'));var rimraf=require(_0x2dbf('0x6'));var config=require(_0x2dbf('0x7'));var attributes=require(_0x2dbf('0x8'));module[_0x2dbf('0x9')]=function(_0x5c4ae5,_0x40dae6){return _0x5c4ae5[_0x2dbf('0xa')]('Template',attributes,{'tableName':_0x2dbf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74d4=['./template.attributes','exports','define','Template','tools_templates','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2a5406,_0x3087ea){var _0x309791=function(_0x4fba8c){while(--_0x4fba8c){_0x2a5406['push'](_0x2a5406['shift']());}};_0x309791(++_0x3087ea);}(_0x74d4,0x116));var _0x474d=function(_0x4fb4be,_0x1dc24d){_0x4fb4be=_0x4fb4be-0x0;var _0x9eaa4e=_0x74d4[_0x4fb4be];return _0x9eaa4e;};'use strict';var _=require(_0x474d('0x0'));var util=require('util');var logger=require(_0x474d('0x1'))(_0x474d('0x2'));var moment=require(_0x474d('0x3'));var BPromise=require(_0x474d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x474d('0x5'));var rimraf=require(_0x474d('0x6'));var config=require(_0x474d('0x7'));var attributes=require(_0x474d('0x8'));module[_0x474d('0x9')]=function(_0x345f34,_0x2518d3){return _0x345f34[_0x474d('0xa')](_0x474d('0xb'),attributes,{'tableName':_0x474d('0xc'),'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 765cd7a..dab04dd 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 _0xe48f=['request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTemplate','Template','findAll','options','raw','where','limit','include','map','model','attributes','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s'];(function(_0x271c5b,_0x46d768){var _0x1d36eb=function(_0x3b46a8){while(--_0x3b46a8){_0x271c5b['push'](_0x271c5b['shift']());}};_0x1d36eb(++_0x46d768);}(_0xe48f,0x189));var _0xfe48=function(_0x554db0,_0x4eda6b){_0x554db0=_0x554db0-0x0;var _0x2ac209=_0xe48f[_0x554db0];return _0x2ac209;};'use strict';var _=require(_0xfe48('0x0'));var util=require(_0xfe48('0x1'));var moment=require(_0xfe48('0x2'));var BPromise=require(_0xfe48('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe48('0x4'));var db=require(_0xfe48('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe48('0x6'))(_0xfe48('0x7'));var config=require('../../config/environment');var jayson=require(_0xfe48('0x8'));var client=jayson[_0xfe48('0x9')][_0xfe48('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x196b8e,_0x594b30,_0x28a32d){return new BPromise(function(_0x211f43,_0x194499){return client[_0xfe48('0xb')](_0x196b8e,_0x28a32d)[_0xfe48('0xc')](function(_0x173d0c){logger[_0xfe48('0xd')](_0xfe48('0xe'),_0x594b30,_0xfe48('0xf'));logger[_0xfe48('0x10')](_0xfe48('0x11'),_0x594b30,'request\x20sent',JSON[_0xfe48('0x12')](_0x173d0c));if(_0x173d0c[_0xfe48('0x13')]){if(_0x173d0c[_0xfe48('0x13')][_0xfe48('0x14')]===0x1f4){logger[_0xfe48('0x13')]('Template,\x20%s,\x20%s',_0x594b30,_0x173d0c[_0xfe48('0x13')][_0xfe48('0x15')]);return _0x194499(_0x173d0c[_0xfe48('0x13')][_0xfe48('0x15')]);}logger[_0xfe48('0x13')](_0xfe48('0xe'),_0x594b30,_0x173d0c[_0xfe48('0x13')]['message']);return _0x211f43(_0x173d0c[_0xfe48('0x13')][_0xfe48('0x15')]);}else{logger[_0xfe48('0xd')](_0xfe48('0xe'),_0x594b30,'request\x20sent');_0x211f43(_0x173d0c['result'][_0xfe48('0x15')]);}})[_0xfe48('0x16')](function(_0x43192f){logger[_0xfe48('0x13')]('Template,\x20%s,\x20%s',_0x594b30,_0x43192f);_0x194499(_0x43192f);});});}exports[_0xfe48('0x17')]=function(_0x4eb25f){var _0xc0dd0f=this;return new Promise(function(_0x45f995,_0x47e95){return db[_0xfe48('0x18')][_0xfe48('0x19')]({'raw':_0x4eb25f[_0xfe48('0x1a')]?_0x4eb25f[_0xfe48('0x1a')][_0xfe48('0x1b')]===undefined?!![]:![]:!![],'where':_0x4eb25f[_0xfe48('0x1a')]?_0x4eb25f[_0xfe48('0x1a')][_0xfe48('0x1c')]||null:null,'attributes':_0x4eb25f[_0xfe48('0x1a')]?_0x4eb25f[_0xfe48('0x1a')]['attributes']||null:null,'limit':_0x4eb25f['options']?_0x4eb25f[_0xfe48('0x1a')][_0xfe48('0x1d')]||null:null,'include':_0x4eb25f[_0xfe48('0x1a')]?_0x4eb25f[_0xfe48('0x1a')][_0xfe48('0x1e')]?_['map'](_0x4eb25f[_0xfe48('0x1a')][_0xfe48('0x1e')],function(_0x4d0e13){return{'model':db[_0x4d0e13['model']],'as':_0x4d0e13['as'],'attributes':_0x4d0e13['attributes'],'include':_0x4d0e13[_0xfe48('0x1e')]?_[_0xfe48('0x1f')](_0x4d0e13['include'],function(_0x45b6cb){return{'model':db[_0x45b6cb[_0xfe48('0x20')]],'as':_0x45b6cb['as'],'attributes':_0x45b6cb[_0xfe48('0x21')],'include':_0x45b6cb[_0xfe48('0x1e')]?_['map'](_0x45b6cb[_0xfe48('0x1e')],function(_0x4e464f){return{'model':db[_0x4e464f[_0xfe48('0x20')]],'as':_0x4e464f['as'],'attributes':_0x4e464f[_0xfe48('0x21')]};}):[]};}):[]};}):[]:[]})[_0xfe48('0xc')](function(_0x141a76){logger[_0xfe48('0xd')](_0xfe48('0x17'),_0x4eb25f);logger['debug'](_0xfe48('0x17'),_0x4eb25f,JSON['stringify'](_0x141a76));_0x45f995(_0x141a76);})[_0xfe48('0x16')](function(_0x5e5500){logger['error']('GetTemplate',_0x5e5500[_0xfe48('0x15')],_0x4eb25f);_0x47e95(_0xc0dd0f[_0xfe48('0x13')](0x1f4,_0x5e5500['message']));});});}; \ No newline at end of file +var _0xeae4=['code','message','info','catch','GetTemplate','Template','findAll','options','raw','where','limit','map','include','model','attributes','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','client','http','then','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x276acd,_0x5bae4d){var _0x512e58=function(_0x2576a7){while(--_0x2576a7){_0x276acd['push'](_0x276acd['shift']());}};_0x512e58(++_0x5bae4d);}(_0xeae4,0x13b));var _0x4eae=function(_0xc7f92d,_0x147594){_0xc7f92d=_0xc7f92d-0x0;var _0x1e03b0=_0xeae4[_0xc7f92d];return _0x1e03b0;};'use strict';var _=require('lodash');var util=require(_0x4eae('0x0'));var moment=require(_0x4eae('0x1'));var BPromise=require(_0x4eae('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4eae('0x3'));var db=require(_0x4eae('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x4eae('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x4eae('0x6')][_0x4eae('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2a9eb2,_0x18f5f0,_0x573b43){return new BPromise(function(_0x488f8d,_0x34e2cb){return client['request'](_0x2a9eb2,_0x573b43)[_0x4eae('0x8')](function(_0x3fe84a){logger['info'](_0x4eae('0x9'),_0x18f5f0,_0x4eae('0xa'));logger[_0x4eae('0xb')](_0x4eae('0xc'),_0x18f5f0,_0x4eae('0xa'),JSON[_0x4eae('0xd')](_0x3fe84a));if(_0x3fe84a[_0x4eae('0xe')]){if(_0x3fe84a[_0x4eae('0xe')][_0x4eae('0xf')]===0x1f4){logger[_0x4eae('0xe')](_0x4eae('0x9'),_0x18f5f0,_0x3fe84a['error']['message']);return _0x34e2cb(_0x3fe84a[_0x4eae('0xe')][_0x4eae('0x10')]);}logger[_0x4eae('0xe')](_0x4eae('0x9'),_0x18f5f0,_0x3fe84a[_0x4eae('0xe')]['message']);return _0x488f8d(_0x3fe84a['error'][_0x4eae('0x10')]);}else{logger[_0x4eae('0x11')](_0x4eae('0x9'),_0x18f5f0,'request\x20sent');_0x488f8d(_0x3fe84a['result'][_0x4eae('0x10')]);}})[_0x4eae('0x12')](function(_0x19ad93){logger['error'](_0x4eae('0x9'),_0x18f5f0,_0x19ad93);_0x34e2cb(_0x19ad93);});});}exports[_0x4eae('0x13')]=function(_0x163be7){var _0x15d7b7=this;return new Promise(function(_0xf8a600,_0x462209){return db[_0x4eae('0x14')][_0x4eae('0x15')]({'raw':_0x163be7[_0x4eae('0x16')]?_0x163be7[_0x4eae('0x16')][_0x4eae('0x17')]===undefined?!![]:![]:!![],'where':_0x163be7[_0x4eae('0x16')]?_0x163be7[_0x4eae('0x16')][_0x4eae('0x18')]||null:null,'attributes':_0x163be7[_0x4eae('0x16')]?_0x163be7[_0x4eae('0x16')]['attributes']||null:null,'limit':_0x163be7[_0x4eae('0x16')]?_0x163be7[_0x4eae('0x16')][_0x4eae('0x19')]||null:null,'include':_0x163be7[_0x4eae('0x16')]?_0x163be7[_0x4eae('0x16')]['include']?_[_0x4eae('0x1a')](_0x163be7[_0x4eae('0x16')][_0x4eae('0x1b')],function(_0x3590bc){return{'model':db[_0x3590bc[_0x4eae('0x1c')]],'as':_0x3590bc['as'],'attributes':_0x3590bc['attributes'],'include':_0x3590bc['include']?_[_0x4eae('0x1a')](_0x3590bc['include'],function(_0x55a698){return{'model':db[_0x55a698['model']],'as':_0x55a698['as'],'attributes':_0x55a698[_0x4eae('0x1d')],'include':_0x55a698[_0x4eae('0x1b')]?_['map'](_0x55a698['include'],function(_0x230d7f){return{'model':db[_0x230d7f[_0x4eae('0x1c')]],'as':_0x230d7f['as'],'attributes':_0x230d7f[_0x4eae('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x252004){logger[_0x4eae('0x11')]('GetTemplate',_0x163be7);logger[_0x4eae('0xb')]('GetTemplate',_0x163be7,JSON['stringify'](_0x252004));_0xf8a600(_0x252004);})[_0x4eae('0x12')](function(_0x173e97){logger[_0x4eae('0xe')]('GetTemplate',_0x173e97[_0x4eae('0x10')],_0x163be7);_0x462209(_0x15d7b7[_0x4eae('0xe')](0x1f4,_0x173e97[_0x4eae('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 4a54d08..aa8ea1d 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 _0x2996=['/:id/all_conditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAnyCondition','addAction','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/:id','show','get'];(function(_0x1f1326,_0x29ca0e){var _0x53f9c8=function(_0x13e20e){while(--_0x13e20e){_0x1f1326['push'](_0x1f1326['shift']());}};_0x53f9c8(++_0x29ca0e);}(_0x2996,0x1ea));var _0x6299=function(_0x15f04f,_0x5b6222){_0x15f04f=_0x15f04f-0x0;var _0x8b2bc3=_0x2996[_0x15f04f];return _0x8b2bc3;};'use strict';var multer=require(_0x6299('0x0'));var util=require(_0x6299('0x1'));var path=require(_0x6299('0x2'));var timeout=require(_0x6299('0x3'));var express=require(_0x6299('0x4'));var router=express[_0x6299('0x5')]();var fs_extra=require(_0x6299('0x6'));var auth=require(_0x6299('0x7'));var interaction=require(_0x6299('0x8'));var config=require('../../config/environment');var controller=require('./trigger.controller');router['get']('/',auth[_0x6299('0x9')](),controller[_0x6299('0xa')]);router['get'](_0x6299('0xb'),auth[_0x6299('0x9')](),controller[_0x6299('0xc')]);router[_0x6299('0xd')](_0x6299('0xe'),auth[_0x6299('0x9')](),controller['getAllConditions']);router[_0x6299('0xd')](_0x6299('0xf'),auth[_0x6299('0x9')](),controller[_0x6299('0x10')]);router[_0x6299('0xd')](_0x6299('0x11'),auth[_0x6299('0x9')](),controller[_0x6299('0x12')]);router[_0x6299('0x13')]('/',auth[_0x6299('0x9')](),controller[_0x6299('0x14')]);router[_0x6299('0x13')](_0x6299('0xe'),auth[_0x6299('0x9')](),controller['addAllCondition']);router[_0x6299('0x13')](_0x6299('0xf'),auth[_0x6299('0x9')](),controller[_0x6299('0x15')]);router['post']('/:id/actions',auth['isAuthenticated'](),controller[_0x6299('0x16')]);router[_0x6299('0x17')]('/:id',auth[_0x6299('0x9')](),controller[_0x6299('0x18')]);router[_0x6299('0x19')](_0x6299('0xb'),auth[_0x6299('0x9')](),controller[_0x6299('0x1a')]);module[_0x6299('0x1b')]=router; \ No newline at end of file +var _0xaf90=['post','addAllCondition','/:id/any_conditions','addAnyCondition','addAction','/:id','update','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trigger.controller','get','index','isAuthenticated','show','/:id/all_conditions','getAnyConditions','/:id/actions','getActions','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf90,0x1e3));var _0x0af9=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xaf90[_0x491a7f];return _0x3d8f44;};'use strict';var multer=require(_0x0af9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0af9('0x1'));var express=require(_0x0af9('0x2'));var router=express[_0x0af9('0x3')]();var fs_extra=require(_0x0af9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0af9('0x5'));var config=require(_0x0af9('0x6'));var controller=require(_0x0af9('0x7'));router[_0x0af9('0x8')]('/',auth['isAuthenticated'](),controller[_0x0af9('0x9')]);router[_0x0af9('0x8')]('/:id',auth[_0x0af9('0xa')](),controller[_0x0af9('0xb')]);router[_0x0af9('0x8')](_0x0af9('0xc'),auth[_0x0af9('0xa')](),controller['getAllConditions']);router[_0x0af9('0x8')]('/:id/any_conditions',auth[_0x0af9('0xa')](),controller[_0x0af9('0xd')]);router[_0x0af9('0x8')](_0x0af9('0xe'),auth['isAuthenticated'](),controller[_0x0af9('0xf')]);router['post']('/',auth[_0x0af9('0xa')](),controller[_0x0af9('0x10')]);router[_0x0af9('0x11')](_0x0af9('0xc'),auth['isAuthenticated'](),controller[_0x0af9('0x12')]);router[_0x0af9('0x11')](_0x0af9('0x13'),auth[_0x0af9('0xa')](),controller[_0x0af9('0x14')]);router[_0x0af9('0x11')](_0x0af9('0xe'),auth[_0x0af9('0xa')](),controller[_0x0af9('0x15')]);router['put'](_0x0af9('0x16'),auth['isAuthenticated'](),controller[_0x0af9('0x17')]);router['delete'](_0x0af9('0x16'),auth[_0x0af9('0xa')](),controller['destroy']);module[_0x0af9('0x18')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 8ea1269..62613c3 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 _0x4bf5=['STRING','sequelize'];(function(_0x88c66a,_0x279a07){var _0x1836d1=function(_0x3aca4a){while(--_0x3aca4a){_0x88c66a['push'](_0x88c66a['shift']());}};_0x1836d1(++_0x279a07);}(_0x4bf5,0x11d));var _0x54bf=function(_0x5e6e2a,_0x54984e){_0x5e6e2a=_0x5e6e2a-0x0;var _0x9ca794=_0x4bf5[_0x5e6e2a];return _0x9ca794;};'use strict';var Sequelize=require(_0x54bf('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x54bf('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xdb8b=['STRING','BOOLEAN','exports'];(function(_0x1f7839,_0x2a26e6){var _0x36b42e=function(_0x553222){while(--_0x553222){_0x1f7839['push'](_0x1f7839['shift']());}};_0x36b42e(++_0x2a26e6);}(_0xdb8b,0x1d6));var _0xbdb8=function(_0x41eb8b,_0x396d7a){_0x41eb8b=_0x41eb8b-0x0;var _0x249ad1=_0xdb8b[_0x41eb8b];return _0x249ad1;};'use strict';var Sequelize=require('sequelize');module[_0xbdb8('0x0')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xbdb8('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xbdb8('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 733fbb1..a5def1c 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 _0x7384=['model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','addAction','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','squel','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','json','offset','limit','undefined','count','status','reject','update','then','get','Triggers','UserProfileResource','destroy','sendStatus','error','name','send','index','Trigger','rawAttributes','fieldName','type','key'];(function(_0x272202,_0x569e70){var _0xcad2a7=function(_0x3b39b2){while(--_0x3b39b2){_0x272202['push'](_0x272202['shift']());}};_0xcad2a7(++_0x569e70);}(_0x7384,0x84));var _0x4738=function(_0x1268df,_0x391ad5){_0x1268df=_0x1268df-0x0;var _0x38cdf1=_0x7384[_0x1268df];return _0x38cdf1;};'use strict';var emlformat=require(_0x4738('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4738('0x1'));var jsonpatch=require(_0x4738('0x2'));var rp=require(_0x4738('0x3'));var moment=require(_0x4738('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4738('0x5'));var util=require('util');var path=require(_0x4738('0x6'));var sox=require(_0x4738('0x7'));var csv=require(_0x4738('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4738('0x9'));var _=require('lodash');var squel=require(_0x4738('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4738('0xb'));var toCsv=require(_0x4738('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4738('0xc'));var qs=require(_0x4738('0xd'));var as=require(_0x4738('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4738('0xf'));var utils=require(_0x4738('0x10'));var config=require(_0x4738('0x11'));var licenseUtil=require(_0x4738('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23c040,_0xfb9391){_0xfb9391=_0xfb9391||0xcc;return function(_0x16e93e){if(_0x16e93e){return _0x23c040['sendStatus'](_0xfb9391);}return _0x23c040['status'](_0xfb9391)['end']();};}function respondWithResult(_0x5a1d1a,_0x50a309){_0x50a309=_0x50a309||0xc8;return function(_0x54b39b){if(_0x54b39b){return _0x5a1d1a['status'](_0x50a309)[_0x4738('0x13')](_0x54b39b);}};}function respondWithFilteredResult(_0x3f01ca,_0x2d0d4d){return function(_0x57d64d){if(_0x57d64d){var _0x3724f0=typeof _0x2d0d4d[_0x4738('0x14')]==='undefined'&&typeof _0x2d0d4d[_0x4738('0x15')]===_0x4738('0x16');var _0x22f6e4=_0x57d64d[_0x4738('0x17')];var _0x515a76=_0x3724f0?0x0:_0x2d0d4d['offset'];var _0x22123e=_0x3724f0?_0x57d64d[_0x4738('0x17')]:_0x2d0d4d[_0x4738('0x14')]+_0x2d0d4d[_0x4738('0x15')];var _0x47e71a;if(_0x22123e>=_0x22f6e4){_0x22123e=_0x22f6e4;_0x47e71a=0xc8;}else{_0x47e71a=0xce;}_0x3f01ca[_0x4738('0x18')](_0x47e71a);return _0x3f01ca['set']('Content-Range',_0x515a76+'-'+_0x22123e+'/'+_0x22f6e4)[_0x4738('0x13')](_0x57d64d);}return null;};}function patchUpdates(_0x50fae1){return function(_0x28f68c){try{jsonpatch['apply'](_0x28f68c,_0x50fae1,!![]);}catch(_0x571840){return BPromise[_0x4738('0x19')](_0x571840);}return _0x28f68c['save']();};}function saveUpdates(_0x1863e4,_0x4c6af8){return function(_0x22deb5){if(_0x22deb5){return _0x22deb5[_0x4738('0x1a')](_0x1863e4)[_0x4738('0x1b')](function(_0x30e93f){return _0x30e93f;});}return null;};}function removeEntity(_0xf56748,_0x3b535f){return function(_0x5907f6){if(_0x5907f6){return _0x5907f6['destroy']()[_0x4738('0x1b')](function(){var _0x379b93=_0x5907f6[_0x4738('0x1c')]({'plain':!![]});var _0x1cd398=_0x4738('0x1d');return db[_0x4738('0x1e')][_0x4738('0x1f')]({'where':{'type':_0x1cd398,'resourceId':_0x379b93['id']}})[_0x4738('0x1b')](function(){return _0x5907f6;});})[_0x4738('0x1b')](function(){_0xf56748[_0x4738('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x302b83,_0x431719){return function(_0x4d1ece){if(!_0x4d1ece){_0x302b83[_0x4738('0x20')](0x194);}return _0x4d1ece;};}function handleError(_0x5d7640,_0xda9663){_0xda9663=_0xda9663||0x1f4;return function(_0x45007a){logger[_0x4738('0x21')](_0x45007a['stack']);if(_0x45007a[_0x4738('0x22')]){delete _0x45007a[_0x4738('0x22')];}_0x5d7640[_0x4738('0x18')](_0xda9663)[_0x4738('0x23')](_0x45007a);};}exports[_0x4738('0x24')]=function(_0x467b29,_0x184aee){var _0x22bd30={},_0x210bd3={},_0x6a74a0={'count':0x0,'rows':[]};var _0x39811c=_['map'](db[_0x4738('0x25')][_0x4738('0x26')],function(_0x3834e3){return{'name':_0x3834e3[_0x4738('0x27')],'type':_0x3834e3[_0x4738('0x28')][_0x4738('0x29')]};});_0x210bd3[_0x4738('0x2a')]=_[_0x4738('0x2b')](_0x39811c,_0x4738('0x22'));_0x210bd3[_0x4738('0x2c')]=_['keys'](_0x467b29['query']);_0x210bd3['filters']=_[_0x4738('0x2d')](_0x210bd3[_0x4738('0x2a')],_0x210bd3['query']);_0x22bd30[_0x4738('0x2e')]=_[_0x4738('0x2d')](_0x210bd3[_0x4738('0x2a')],qs[_0x4738('0x2f')](_0x467b29[_0x4738('0x2c')][_0x4738('0x2f')]));_0x22bd30[_0x4738('0x2e')]=_0x22bd30[_0x4738('0x2e')]['length']?_0x22bd30[_0x4738('0x2e')]:_0x210bd3[_0x4738('0x2a')];if(!_0x467b29[_0x4738('0x2c')][_0x4738('0x30')](_0x4738('0x31'))){_0x22bd30[_0x4738('0x15')]=qs[_0x4738('0x15')](_0x467b29[_0x4738('0x2c')][_0x4738('0x15')]);_0x22bd30['offset']=qs[_0x4738('0x14')](_0x467b29['query'][_0x4738('0x14')]);}_0x22bd30[_0x4738('0x32')]=qs[_0x4738('0x33')](_0x467b29[_0x4738('0x2c')][_0x4738('0x33')]);_0x22bd30['where']=qs[_0x4738('0x34')](_[_0x4738('0x35')](_0x467b29[_0x4738('0x2c')],_0x210bd3[_0x4738('0x34')]),_0x39811c);if(_0x467b29[_0x4738('0x2c')][_0x4738('0x36')]){_0x22bd30[_0x4738('0x37')]=_[_0x4738('0x38')](_0x22bd30[_0x4738('0x37')],{'$or':_[_0x4738('0x2b')](_0x39811c,function(_0x1a62d7){if(_0x1a62d7[_0x4738('0x28')]!=='VIRTUAL'){var _0x9ae8af={};_0x9ae8af[_0x1a62d7[_0x4738('0x22')]]={'$like':'%'+_0x467b29[_0x4738('0x2c')]['filter']+'%'};return _0x9ae8af;}})});}_0x22bd30=_[_0x4738('0x38')]({},_0x22bd30,_0x467b29[_0x4738('0x39')]);var _0x38b3d1={'where':_0x22bd30[_0x4738('0x37')]};return db[_0x4738('0x25')][_0x4738('0x17')](_0x38b3d1)[_0x4738('0x1b')](function(_0x4de82b){_0x6a74a0['count']=_0x4de82b;if(_0x467b29['query'][_0x4738('0x3a')]){_0x22bd30[_0x4738('0x3b')]=[{'all':!![]}];}return db[_0x4738('0x25')][_0x4738('0x3c')](_0x22bd30);})['then'](function(_0x19a9b6){_0x6a74a0[_0x4738('0x3d')]=_0x19a9b6;return _0x6a74a0;})[_0x4738('0x1b')](respondWithFilteredResult(_0x184aee,_0x22bd30))[_0x4738('0x3e')](handleError(_0x184aee,null));};exports['show']=function(_0x51b24c,_0x15130d){var _0x9af498={'raw':![],'where':{'id':_0x51b24c[_0x4738('0x3f')]['id']}},_0x38d649={};_0x38d649['model']=_['keys'](db['Trigger'][_0x4738('0x26')]);_0x38d649[_0x4738('0x2c')]=_[_0x4738('0x40')](_0x51b24c[_0x4738('0x2c')]);_0x38d649[_0x4738('0x34')]=_[_0x4738('0x2d')](_0x38d649[_0x4738('0x2a')],_0x38d649[_0x4738('0x2c')]);_0x9af498[_0x4738('0x2e')]=_[_0x4738('0x2d')](_0x38d649[_0x4738('0x2a')],qs[_0x4738('0x2f')](_0x51b24c[_0x4738('0x2c')]['fields']));_0x9af498['attributes']=_0x9af498['attributes'][_0x4738('0x41')]?_0x9af498[_0x4738('0x2e')]:_0x38d649[_0x4738('0x2a')];if(_0x51b24c['query']['includeAll']){_0x9af498['include']=[{'all':!![]}];}_0x9af498=_[_0x4738('0x38')]({},_0x9af498,_0x51b24c[_0x4738('0x39')]);return db[_0x4738('0x25')][_0x4738('0x42')](_0x9af498)[_0x4738('0x1b')](handleEntityNotFound(_0x15130d,null))[_0x4738('0x1b')](respondWithResult(_0x15130d,null))['catch'](handleError(_0x15130d,null));};exports[_0x4738('0x43')]=function(_0x12a629,_0x1c2ace){return db['Trigger']['create'](_0x12a629[_0x4738('0x44')],{})['then'](function(_0x5947c2){var _0x57bcee=_0x12a629['user']['get']({'plain':!![]});if(!_0x57bcee)throw new Error(_0x4738('0x45'));if(_0x57bcee[_0x4738('0x46')]===_0x4738('0x47')){var _0xca8e71=_0x5947c2[_0x4738('0x1c')]({'plain':!![]});var _0x5327f0=_0x4738('0x1d');return db[_0x4738('0x48')][_0x4738('0x42')]({'where':{'name':_0x5327f0,'userProfileId':_0x57bcee[_0x4738('0x49')]},'raw':!![]})['then'](function(_0x5d9c8c){if(_0x5d9c8c&&_0x5d9c8c[_0x4738('0x4a')]===0x0){return db[_0x4738('0x1e')][_0x4738('0x43')]({'name':_0xca8e71[_0x4738('0x22')],'resourceId':_0xca8e71['id'],'type':_0x5d9c8c[_0x4738('0x22')],'sectionId':_0x5d9c8c['id']},{})[_0x4738('0x1b')](function(){return _0x5947c2;});}else{return _0x5947c2;}})[_0x4738('0x3e')](function(_0x510f20){logger[_0x4738('0x21')](_0x4738('0x4b'),_0x510f20);throw _0x510f20;});}return _0x5947c2;})[_0x4738('0x1b')](respondWithResult(_0x1c2ace,0xc9))[_0x4738('0x3e')](handleError(_0x1c2ace,null));};exports['update']=function(_0x42df54,_0x572f81){if(_0x42df54[_0x4738('0x44')]['id']){delete _0x42df54['body']['id'];}return db[_0x4738('0x25')][_0x4738('0x42')]({'where':{'id':_0x42df54[_0x4738('0x3f')]['id']}})[_0x4738('0x1b')](handleEntityNotFound(_0x572f81,null))['then'](saveUpdates(_0x42df54[_0x4738('0x44')],null))[_0x4738('0x1b')](respondWithResult(_0x572f81,null))['catch'](handleError(_0x572f81,null));};exports[_0x4738('0x1f')]=function(_0x2e4b92,_0x1d4a95){return db[_0x4738('0x25')][_0x4738('0x42')]({'where':{'id':_0x2e4b92[_0x4738('0x3f')]['id']}})[_0x4738('0x1b')](handleEntityNotFound(_0x1d4a95,null))['then'](removeEntity(_0x1d4a95,null))[_0x4738('0x3e')](handleError(_0x1d4a95,null));};exports[_0x4738('0x4c')]=function(_0x515fbd,_0x52311d,_0x5bda6d){if(_0x515fbd[_0x4738('0x44')]['id']){delete _0x515fbd['body']['id'];}return db[_0x4738('0x25')][_0x4738('0x42')]({'where':{'id':_0x515fbd[_0x4738('0x3f')]['id']}})['then'](handleEntityNotFound(_0x52311d,null))[_0x4738('0x1b')](function(_0x2b6f82){if(_0x2b6f82){_0x515fbd[_0x4738('0x44')][_0x4738('0x4d')]=_0x2b6f82['id'];return db[_0x4738('0x4e')][_0x4738('0x43')](_0x515fbd[_0x4738('0x44')]);}})[_0x4738('0x1b')](respondWithResult(_0x52311d,null))[_0x4738('0x3e')](handleError(_0x52311d,null));};exports[_0x4738('0x4f')]=function(_0x5134f0,_0x178baa,_0x1289ca){if(_0x5134f0[_0x4738('0x44')]['id']){delete _0x5134f0[_0x4738('0x44')]['id'];}return db['Trigger'][_0x4738('0x42')]({'where':{'id':_0x5134f0[_0x4738('0x3f')]['id']}})['then'](handleEntityNotFound(_0x178baa,null))[_0x4738('0x1b')](function(_0x2b7566){if(_0x2b7566){_0x5134f0['body'][_0x4738('0x50')]=_0x2b7566['id'];return db[_0x4738('0x4e')][_0x4738('0x43')](_0x5134f0[_0x4738('0x44')]);}})['then'](respondWithResult(_0x178baa,null))[_0x4738('0x3e')](handleError(_0x178baa,null));};exports[_0x4738('0x51')]=function(_0x427aea,_0xa91ea5,_0x1d8ff3){var _0x1bae9f={};var _0x8e821f={};var _0x18e019;var _0x276d34;return db[_0x4738('0x25')][_0x4738('0x52')]({'where':{'id':_0x427aea[_0x4738('0x3f')]['id']}})[_0x4738('0x1b')](handleEntityNotFound(_0xa91ea5,null))['then'](function(_0x5da9e6){if(_0x5da9e6){_0x18e019=_0x5da9e6;_0x8e821f['model']=_['keys'](db[_0x4738('0x4e')][_0x4738('0x26')]);_0x8e821f[_0x4738('0x2c')]=_[_0x4738('0x40')](_0x427aea['query']);_0x8e821f[_0x4738('0x34')]=_['intersection'](_0x8e821f['model'],_0x8e821f[_0x4738('0x2c')]);_0x1bae9f['attributes']=_['intersection'](_0x8e821f[_0x4738('0x2a')],qs[_0x4738('0x2f')](_0x427aea[_0x4738('0x2c')][_0x4738('0x2f')]));_0x1bae9f['attributes']=_0x1bae9f[_0x4738('0x2e')]['length']?_0x1bae9f['attributes']:_0x8e821f[_0x4738('0x2a')];_0x1bae9f[_0x4738('0x32')]=qs[_0x4738('0x33')](_0x427aea[_0x4738('0x2c')]['sort']);_0x1bae9f[_0x4738('0x37')]=qs[_0x4738('0x34')](_['pick'](_0x427aea[_0x4738('0x2c')],_0x8e821f[_0x4738('0x34')]));if(_0x427aea[_0x4738('0x2c')][_0x4738('0x36')]){_0x1bae9f['where']=_[_0x4738('0x38')](_0x1bae9f['where'],{'$or':_[_0x4738('0x2b')](_0x1bae9f[_0x4738('0x2e')],function(_0x534d2a){var _0x214c3c={};_0x214c3c[_0x534d2a]={'$like':'%'+_0x427aea[_0x4738('0x2c')][_0x4738('0x36')]+'%'};return _0x214c3c;})});}_0x1bae9f=_[_0x4738('0x38')]({},_0x1bae9f,_0x427aea[_0x4738('0x39')]);return _0x18e019[_0x4738('0x51')](_0x1bae9f);}})[_0x4738('0x1b')](function(_0x21ba19){if(_0x21ba19){_0x276d34=_0x21ba19[_0x4738('0x41')];if(!_0x427aea[_0x4738('0x2c')][_0x4738('0x30')](_0x4738('0x31'))){_0x1bae9f[_0x4738('0x15')]=qs[_0x4738('0x15')](_0x427aea['query']['limit']);_0x1bae9f[_0x4738('0x14')]=qs[_0x4738('0x14')](_0x427aea[_0x4738('0x2c')][_0x4738('0x14')]);}return _0x18e019[_0x4738('0x51')](_0x1bae9f);}})['then'](function(_0x570a6d){if(_0x570a6d){return _0x570a6d?{'count':_0x276d34,'rows':_0x570a6d}:null;}})[_0x4738('0x1b')](respondWithResult(_0xa91ea5,null))[_0x4738('0x3e')](handleError(_0xa91ea5,null));};exports['getAnyConditions']=function(_0xa84339,_0x5e7859,_0x41d6d8){var _0x2ad7fa={};var _0x4a9fda={};var _0xab669b;var _0x14035a;return db[_0x4738('0x25')][_0x4738('0x52')]({'where':{'id':_0xa84339[_0x4738('0x3f')]['id']}})[_0x4738('0x1b')](handleEntityNotFound(_0x5e7859,null))[_0x4738('0x1b')](function(_0x4a444c){if(_0x4a444c){_0xab669b=_0x4a444c;_0x4a9fda['model']=_[_0x4738('0x40')](db['Condition']['rawAttributes']);_0x4a9fda[_0x4738('0x2c')]=_[_0x4738('0x40')](_0xa84339[_0x4738('0x2c')]);_0x4a9fda[_0x4738('0x34')]=_['intersection'](_0x4a9fda[_0x4738('0x2a')],_0x4a9fda['query']);_0x2ad7fa[_0x4738('0x2e')]=_[_0x4738('0x2d')](_0x4a9fda['model'],qs[_0x4738('0x2f')](_0xa84339[_0x4738('0x2c')][_0x4738('0x2f')]));_0x2ad7fa['attributes']=_0x2ad7fa[_0x4738('0x2e')]['length']?_0x2ad7fa[_0x4738('0x2e')]:_0x4a9fda[_0x4738('0x2a')];_0x2ad7fa[_0x4738('0x32')]=qs[_0x4738('0x33')](_0xa84339['query'][_0x4738('0x33')]);_0x2ad7fa['where']=qs[_0x4738('0x34')](_[_0x4738('0x35')](_0xa84339[_0x4738('0x2c')],_0x4a9fda[_0x4738('0x34')]));if(_0xa84339['query'][_0x4738('0x36')]){_0x2ad7fa[_0x4738('0x37')]=_[_0x4738('0x38')](_0x2ad7fa[_0x4738('0x37')],{'$or':_['map'](_0x2ad7fa[_0x4738('0x2e')],function(_0x41e144){var _0x15eb37={};_0x15eb37[_0x41e144]={'$like':'%'+_0xa84339[_0x4738('0x2c')][_0x4738('0x36')]+'%'};return _0x15eb37;})});}_0x2ad7fa=_[_0x4738('0x38')]({},_0x2ad7fa,_0xa84339[_0x4738('0x39')]);return _0xab669b['getAnyConditions'](_0x2ad7fa);}})[_0x4738('0x1b')](function(_0x4572bf){if(_0x4572bf){_0x14035a=_0x4572bf[_0x4738('0x41')];if(!_0xa84339['query'][_0x4738('0x30')](_0x4738('0x31'))){_0x2ad7fa['limit']=qs[_0x4738('0x15')](_0xa84339[_0x4738('0x2c')][_0x4738('0x15')]);_0x2ad7fa[_0x4738('0x14')]=qs['offset'](_0xa84339[_0x4738('0x2c')]['offset']);}return _0xab669b[_0x4738('0x53')](_0x2ad7fa);}})[_0x4738('0x1b')](function(_0x50dad9){if(_0x50dad9){return _0x50dad9?{'count':_0x14035a,'rows':_0x50dad9}:null;}})[_0x4738('0x1b')](respondWithResult(_0x5e7859,null))['catch'](handleError(_0x5e7859,null));};exports[_0x4738('0x54')]=function(_0xbe9f28,_0x1272ca,_0x4676b8){if(_0xbe9f28[_0x4738('0x44')]['id']){delete _0xbe9f28['body']['id'];}return db[_0x4738('0x25')][_0x4738('0x42')]({'where':{'id':_0xbe9f28[_0x4738('0x3f')]['id']}})[_0x4738('0x1b')](handleEntityNotFound(_0x1272ca,null))['then'](function(_0x429747){if(_0x429747){_0xbe9f28[_0x4738('0x44')]['TriggerId']=_0x429747['id'];return db[_0x4738('0x55')][_0x4738('0x43')](_0xbe9f28[_0x4738('0x44')]);}})[_0x4738('0x1b')](respondWithResult(_0x1272ca,null))[_0x4738('0x3e')](handleError(_0x1272ca,null));};exports[_0x4738('0x56')]=function(_0xf1c46a,_0x536620,_0x5c1437){var _0xdf5c9c={};var _0x47a98d={};var _0x4d3aec;var _0x13d188;return db['Trigger'][_0x4738('0x52')]({'where':{'id':_0xf1c46a['params']['id']}})['then'](handleEntityNotFound(_0x536620,null))[_0x4738('0x1b')](function(_0x4f0a78){if(_0x4f0a78){_0x4d3aec=_0x4f0a78;_0x47a98d[_0x4738('0x2a')]=_['keys'](db[_0x4738('0x55')][_0x4738('0x26')]);_0x47a98d['query']=_[_0x4738('0x40')](_0xf1c46a[_0x4738('0x2c')]);_0x47a98d[_0x4738('0x34')]=_[_0x4738('0x2d')](_0x47a98d[_0x4738('0x2a')],_0x47a98d['query']);_0xdf5c9c[_0x4738('0x2e')]=_['intersection'](_0x47a98d[_0x4738('0x2a')],qs[_0x4738('0x2f')](_0xf1c46a['query'][_0x4738('0x2f')]));_0xdf5c9c[_0x4738('0x2e')]=_0xdf5c9c[_0x4738('0x2e')]['length']?_0xdf5c9c[_0x4738('0x2e')]:_0x47a98d[_0x4738('0x2a')];_0xdf5c9c[_0x4738('0x32')]=qs['sort'](_0xf1c46a[_0x4738('0x2c')][_0x4738('0x33')]);_0xdf5c9c['where']=qs[_0x4738('0x34')](_['pick'](_0xf1c46a['query'],_0x47a98d[_0x4738('0x34')]));if(_0xf1c46a[_0x4738('0x2c')][_0x4738('0x36')]){_0xdf5c9c[_0x4738('0x37')]=_[_0x4738('0x38')](_0xdf5c9c[_0x4738('0x37')],{'$or':_[_0x4738('0x2b')](_0xdf5c9c[_0x4738('0x2e')],function(_0x5921ba){var _0x44e240={};_0x44e240[_0x5921ba]={'$like':'%'+_0xf1c46a[_0x4738('0x2c')][_0x4738('0x36')]+'%'};return _0x44e240;})});}_0xdf5c9c=_[_0x4738('0x38')]({},_0xdf5c9c,_0xf1c46a['options']);return _0x4d3aec['getActions'](_0xdf5c9c);}})[_0x4738('0x1b')](function(_0x3072d9){if(_0x3072d9){_0x13d188=_0x3072d9[_0x4738('0x41')];if(!_0xf1c46a[_0x4738('0x2c')]['hasOwnProperty']('nolimit')){_0xdf5c9c['limit']=qs['limit'](_0xf1c46a[_0x4738('0x2c')][_0x4738('0x15')]);_0xdf5c9c['offset']=qs[_0x4738('0x14')](_0xf1c46a[_0x4738('0x2c')][_0x4738('0x14')]);}return _0x4d3aec[_0x4738('0x56')](_0xdf5c9c);}})[_0x4738('0x1b')](function(_0x2507ae){if(_0x2507ae){return _0x2507ae?{'count':_0x13d188,'rows':_0x2507ae}:null;}})['then'](respondWithResult(_0x536620,null))[_0x4738('0x3e')](handleError(_0x536620,null));}; \ No newline at end of file +var _0xf61a=['lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','Triggers','UserProfileResource','error','stack','name','send','map','Trigger','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','options','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','params','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','pick','getAnyConditions','findOne','hasOwnProperty','TriggerId','Action','getActions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xf61a,0xb0));var _0xaf61=function(_0x18746a,_0x3ff3bf){_0x18746a=_0x18746a-0x0;var _0x1b851d=_0xf61a[_0x18746a];return _0x1b851d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaf61('0x0'));var zipdir=require(_0xaf61('0x1'));var jsonpatch=require(_0xaf61('0x2'));var rp=require(_0xaf61('0x3'));var moment=require(_0xaf61('0x4'));var BPromise=require(_0xaf61('0x5'));var Mustache=require(_0xaf61('0x6'));var util=require(_0xaf61('0x7'));var path=require(_0xaf61('0x8'));var sox=require('sox');var csv=require(_0xaf61('0x9'));var ejs=require(_0xaf61('0xa'));var fs=require('fs');var fs_extra=require(_0xaf61('0xb'));var _=require(_0xaf61('0xc'));var squel=require(_0xaf61('0xd'));var crypto=require(_0xaf61('0xe'));var jsforce=require(_0xaf61('0xf'));var deskjs=require(_0xaf61('0x10'));var toCsv=require(_0xaf61('0x9'));var querystring=require('querystring');var Papa=require(_0xaf61('0x11'));var Redis=require('ioredis');var authService=require(_0xaf61('0x12'));var qs=require(_0xaf61('0x13'));var as=require(_0xaf61('0x14'));var hardwareService=require(_0xaf61('0x15'));var logger=require(_0xaf61('0x16'))('api');var utils=require(_0xaf61('0x17'));var config=require(_0xaf61('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xaf61('0x19'))['db'];function respondWithStatusCode(_0x59c569,_0x823e2d){_0x823e2d=_0x823e2d||0xcc;return function(_0x33c590){if(_0x33c590){return _0x59c569[_0xaf61('0x1a')](_0x823e2d);}return _0x59c569['status'](_0x823e2d)[_0xaf61('0x1b')]();};}function respondWithResult(_0x5baac4,_0x55557e){_0x55557e=_0x55557e||0xc8;return function(_0x2c65f6){if(_0x2c65f6){return _0x5baac4[_0xaf61('0x1c')](_0x55557e)[_0xaf61('0x1d')](_0x2c65f6);}};}function respondWithFilteredResult(_0x569a6b,_0x92fb45){return function(_0x47b2a1){if(_0x47b2a1){var _0x42ba29=typeof _0x92fb45['offset']===_0xaf61('0x1e')&&typeof _0x92fb45[_0xaf61('0x1f')]===_0xaf61('0x1e');var _0x724655=_0x47b2a1[_0xaf61('0x20')];var _0x41f004=_0x42ba29?0x0:_0x92fb45['offset'];var _0x340ed1=_0x42ba29?_0x47b2a1[_0xaf61('0x20')]:_0x92fb45[_0xaf61('0x21')]+_0x92fb45[_0xaf61('0x1f')];var _0x310ee6;if(_0x340ed1>=_0x724655){_0x340ed1=_0x724655;_0x310ee6=0xc8;}else{_0x310ee6=0xce;}_0x569a6b[_0xaf61('0x1c')](_0x310ee6);return _0x569a6b[_0xaf61('0x22')]('Content-Range',_0x41f004+'-'+_0x340ed1+'/'+_0x724655)[_0xaf61('0x1d')](_0x47b2a1);}return null;};}function patchUpdates(_0xcc38a){return function(_0x27d05b){try{jsonpatch[_0xaf61('0x23')](_0x27d05b,_0xcc38a,!![]);}catch(_0x14a6c6){return BPromise[_0xaf61('0x24')](_0x14a6c6);}return _0x27d05b[_0xaf61('0x25')]();};}function saveUpdates(_0x2e19dd,_0x29af46){return function(_0x403b0d){if(_0x403b0d){return _0x403b0d[_0xaf61('0x26')](_0x2e19dd)[_0xaf61('0x27')](function(_0x3ddc8e){return _0x3ddc8e;});}return null;};}function removeEntity(_0x27c47c,_0x26af0d){return function(_0x811a81){if(_0x811a81){return _0x811a81[_0xaf61('0x28')]()[_0xaf61('0x27')](function(){var _0x5ba0a2=_0x811a81['get']({'plain':!![]});var _0x155e56=_0xaf61('0x29');return db[_0xaf61('0x2a')][_0xaf61('0x28')]({'where':{'type':_0x155e56,'resourceId':_0x5ba0a2['id']}})[_0xaf61('0x27')](function(){return _0x811a81;});})[_0xaf61('0x27')](function(){_0x27c47c[_0xaf61('0x1c')](0xcc)[_0xaf61('0x1b')]();});}};}function handleEntityNotFound(_0x2f3efb,_0x399683){return function(_0x2d7af1){if(!_0x2d7af1){_0x2f3efb[_0xaf61('0x1a')](0x194);}return _0x2d7af1;};}function handleError(_0x279a72,_0xbb7c19){_0xbb7c19=_0xbb7c19||0x1f4;return function(_0x213693){logger[_0xaf61('0x2b')](_0x213693[_0xaf61('0x2c')]);if(_0x213693[_0xaf61('0x2d')]){delete _0x213693[_0xaf61('0x2d')];}_0x279a72[_0xaf61('0x1c')](_0xbb7c19)[_0xaf61('0x2e')](_0x213693);};}exports['index']=function(_0x5c8125,_0x2ee117){var _0x59c62f={},_0x19aee4={},_0x3ce220={'count':0x0,'rows':[]};var _0x3b29be=_[_0xaf61('0x2f')](db[_0xaf61('0x30')][_0xaf61('0x31')],function(_0x3bb0ec){return{'name':_0x3bb0ec[_0xaf61('0x32')],'type':_0x3bb0ec[_0xaf61('0x33')]['key']};});_0x19aee4[_0xaf61('0x34')]=_['map'](_0x3b29be,'name');_0x19aee4[_0xaf61('0x35')]=_[_0xaf61('0x36')](_0x5c8125[_0xaf61('0x35')]);_0x19aee4[_0xaf61('0x37')]=_[_0xaf61('0x38')](_0x19aee4[_0xaf61('0x34')],_0x19aee4[_0xaf61('0x35')]);_0x59c62f[_0xaf61('0x39')]=_[_0xaf61('0x38')](_0x19aee4[_0xaf61('0x34')],qs[_0xaf61('0x3a')](_0x5c8125[_0xaf61('0x35')][_0xaf61('0x3a')]));_0x59c62f['attributes']=_0x59c62f[_0xaf61('0x39')][_0xaf61('0x3b')]?_0x59c62f[_0xaf61('0x39')]:_0x19aee4[_0xaf61('0x34')];if(!_0x5c8125[_0xaf61('0x35')]['hasOwnProperty'](_0xaf61('0x3c'))){_0x59c62f[_0xaf61('0x1f')]=qs[_0xaf61('0x1f')](_0x5c8125[_0xaf61('0x35')]['limit']);_0x59c62f[_0xaf61('0x21')]=qs['offset'](_0x5c8125[_0xaf61('0x35')][_0xaf61('0x21')]);}_0x59c62f[_0xaf61('0x3d')]=qs[_0xaf61('0x3e')](_0x5c8125['query'][_0xaf61('0x3e')]);_0x59c62f[_0xaf61('0x3f')]=qs['filters'](_['pick'](_0x5c8125[_0xaf61('0x35')],_0x19aee4[_0xaf61('0x37')]),_0x3b29be);if(_0x5c8125[_0xaf61('0x35')][_0xaf61('0x40')]){_0x59c62f['where']=_[_0xaf61('0x41')](_0x59c62f[_0xaf61('0x3f')],{'$or':_[_0xaf61('0x2f')](_0x3b29be,function(_0x3f1dbf){if(_0x3f1dbf[_0xaf61('0x33')]!=='VIRTUAL'){var _0x9e7f2d={};_0x9e7f2d[_0x3f1dbf['name']]={'$like':'%'+_0x5c8125[_0xaf61('0x35')]['filter']+'%'};return _0x9e7f2d;}})});}_0x59c62f=_[_0xaf61('0x41')]({},_0x59c62f,_0x5c8125['options']);var _0x237f2b={'where':_0x59c62f[_0xaf61('0x3f')]};return db[_0xaf61('0x30')][_0xaf61('0x20')](_0x237f2b)[_0xaf61('0x27')](function(_0x331851){_0x3ce220[_0xaf61('0x20')]=_0x331851;if(_0x5c8125[_0xaf61('0x35')][_0xaf61('0x42')]){_0x59c62f[_0xaf61('0x43')]=[{'all':!![]}];}return db[_0xaf61('0x30')][_0xaf61('0x44')](_0x59c62f);})[_0xaf61('0x27')](function(_0xb345ae){_0x3ce220['rows']=_0xb345ae;return _0x3ce220;})[_0xaf61('0x27')](respondWithFilteredResult(_0x2ee117,_0x59c62f))['catch'](handleError(_0x2ee117,null));};exports['show']=function(_0x2fc56a,_0x171ddf){var _0x5308e9={'raw':![],'where':{'id':_0x2fc56a['params']['id']}},_0x39a04c={};_0x39a04c[_0xaf61('0x34')]=_[_0xaf61('0x36')](db[_0xaf61('0x30')][_0xaf61('0x31')]);_0x39a04c[_0xaf61('0x35')]=_[_0xaf61('0x36')](_0x2fc56a['query']);_0x39a04c[_0xaf61('0x37')]=_['intersection'](_0x39a04c['model'],_0x39a04c[_0xaf61('0x35')]);_0x5308e9[_0xaf61('0x39')]=_[_0xaf61('0x38')](_0x39a04c['model'],qs[_0xaf61('0x3a')](_0x2fc56a[_0xaf61('0x35')][_0xaf61('0x3a')]));_0x5308e9[_0xaf61('0x39')]=_0x5308e9[_0xaf61('0x39')][_0xaf61('0x3b')]?_0x5308e9['attributes']:_0x39a04c[_0xaf61('0x34')];if(_0x2fc56a[_0xaf61('0x35')][_0xaf61('0x42')]){_0x5308e9[_0xaf61('0x43')]=[{'all':!![]}];}_0x5308e9=_[_0xaf61('0x41')]({},_0x5308e9,_0x2fc56a[_0xaf61('0x45')]);return db['Trigger'][_0xaf61('0x46')](_0x5308e9)[_0xaf61('0x27')](handleEntityNotFound(_0x171ddf,null))[_0xaf61('0x27')](respondWithResult(_0x171ddf,null))[_0xaf61('0x47')](handleError(_0x171ddf,null));};exports[_0xaf61('0x48')]=function(_0x375bb5,_0x15d0b1){return db['Trigger'][_0xaf61('0x48')](_0x375bb5[_0xaf61('0x49')],{})['then'](function(_0x53b1d1){var _0x43860c=_0x375bb5['user'][_0xaf61('0x4a')]({'plain':!![]});if(!_0x43860c)throw new Error(_0xaf61('0x4b'));if(_0x43860c[_0xaf61('0x4c')]===_0xaf61('0x4d')){var _0x3566b3=_0x53b1d1['get']({'plain':!![]});var _0x2abfa2=_0xaf61('0x29');return db[_0xaf61('0x4e')]['find']({'where':{'name':_0x2abfa2,'userProfileId':_0x43860c[_0xaf61('0x4f')]},'raw':!![]})[_0xaf61('0x27')](function(_0x220db6){if(_0x220db6&&_0x220db6[_0xaf61('0x50')]===0x0){return db[_0xaf61('0x2a')][_0xaf61('0x48')]({'name':_0x3566b3[_0xaf61('0x2d')],'resourceId':_0x3566b3['id'],'type':_0x220db6[_0xaf61('0x2d')],'sectionId':_0x220db6['id']},{})['then'](function(){return _0x53b1d1;});}else{return _0x53b1d1;}})['catch'](function(_0x13036f){logger[_0xaf61('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13036f);throw _0x13036f;});}return _0x53b1d1;})[_0xaf61('0x27')](respondWithResult(_0x15d0b1,0xc9))['catch'](handleError(_0x15d0b1,null));};exports[_0xaf61('0x26')]=function(_0x545799,_0x24b78){if(_0x545799[_0xaf61('0x49')]['id']){delete _0x545799['body']['id'];}return db[_0xaf61('0x30')][_0xaf61('0x46')]({'where':{'id':_0x545799['params']['id']}})[_0xaf61('0x27')](handleEntityNotFound(_0x24b78,null))['then'](saveUpdates(_0x545799['body'],null))[_0xaf61('0x27')](respondWithResult(_0x24b78,null))['catch'](handleError(_0x24b78,null));};exports[_0xaf61('0x28')]=function(_0x249d94,_0x4524a4){return db[_0xaf61('0x30')][_0xaf61('0x46')]({'where':{'id':_0x249d94[_0xaf61('0x51')]['id']}})['then'](handleEntityNotFound(_0x4524a4,null))[_0xaf61('0x27')](removeEntity(_0x4524a4,null))[_0xaf61('0x47')](handleError(_0x4524a4,null));};exports['addAllCondition']=function(_0x599e5f,_0x2caa7e,_0x1621de){if(_0x599e5f[_0xaf61('0x49')]['id']){delete _0x599e5f[_0xaf61('0x49')]['id'];}return db[_0xaf61('0x30')][_0xaf61('0x46')]({'where':{'id':_0x599e5f[_0xaf61('0x51')]['id']}})[_0xaf61('0x27')](handleEntityNotFound(_0x2caa7e,null))['then'](function(_0x22781d){if(_0x22781d){_0x599e5f[_0xaf61('0x49')][_0xaf61('0x52')]=_0x22781d['id'];return db[_0xaf61('0x53')][_0xaf61('0x48')](_0x599e5f[_0xaf61('0x49')]);}})[_0xaf61('0x27')](respondWithResult(_0x2caa7e,null))['catch'](handleError(_0x2caa7e,null));};exports[_0xaf61('0x54')]=function(_0x2ca557,_0x5ce704,_0x583896){if(_0x2ca557[_0xaf61('0x49')]['id']){delete _0x2ca557[_0xaf61('0x49')]['id'];}return db[_0xaf61('0x30')][_0xaf61('0x46')]({'where':{'id':_0x2ca557['params']['id']}})[_0xaf61('0x27')](handleEntityNotFound(_0x5ce704,null))[_0xaf61('0x27')](function(_0x1d9ebd){if(_0x1d9ebd){_0x2ca557[_0xaf61('0x49')][_0xaf61('0x55')]=_0x1d9ebd['id'];return db[_0xaf61('0x53')][_0xaf61('0x48')](_0x2ca557[_0xaf61('0x49')]);}})[_0xaf61('0x27')](respondWithResult(_0x5ce704,null))[_0xaf61('0x47')](handleError(_0x5ce704,null));};exports[_0xaf61('0x56')]=function(_0x177c18,_0xc6adf,_0x2f4f8b){var _0x26dcd1={};var _0x4d7c71={};var _0x5ed485;var _0x12d81b;return db[_0xaf61('0x30')]['findOne']({'where':{'id':_0x177c18[_0xaf61('0x51')]['id']}})['then'](handleEntityNotFound(_0xc6adf,null))[_0xaf61('0x27')](function(_0x524dc1){if(_0x524dc1){_0x5ed485=_0x524dc1;_0x4d7c71[_0xaf61('0x34')]=_[_0xaf61('0x36')](db[_0xaf61('0x53')][_0xaf61('0x31')]);_0x4d7c71[_0xaf61('0x35')]=_[_0xaf61('0x36')](_0x177c18[_0xaf61('0x35')]);_0x4d7c71[_0xaf61('0x37')]=_['intersection'](_0x4d7c71['model'],_0x4d7c71[_0xaf61('0x35')]);_0x26dcd1[_0xaf61('0x39')]=_[_0xaf61('0x38')](_0x4d7c71[_0xaf61('0x34')],qs['fields'](_0x177c18[_0xaf61('0x35')][_0xaf61('0x3a')]));_0x26dcd1[_0xaf61('0x39')]=_0x26dcd1[_0xaf61('0x39')]['length']?_0x26dcd1[_0xaf61('0x39')]:_0x4d7c71['model'];_0x26dcd1['order']=qs[_0xaf61('0x3e')](_0x177c18[_0xaf61('0x35')][_0xaf61('0x3e')]);_0x26dcd1[_0xaf61('0x3f')]=qs['filters'](_[_0xaf61('0x57')](_0x177c18['query'],_0x4d7c71['filters']));if(_0x177c18[_0xaf61('0x35')][_0xaf61('0x40')]){_0x26dcd1['where']=_[_0xaf61('0x41')](_0x26dcd1[_0xaf61('0x3f')],{'$or':_[_0xaf61('0x2f')](_0x26dcd1['attributes'],function(_0x1caa69){var _0x2f8ce1={};_0x2f8ce1[_0x1caa69]={'$like':'%'+_0x177c18[_0xaf61('0x35')]['filter']+'%'};return _0x2f8ce1;})});}_0x26dcd1=_['merge']({},_0x26dcd1,_0x177c18[_0xaf61('0x45')]);return _0x5ed485['getAllConditions'](_0x26dcd1);}})['then'](function(_0x5a104a){if(_0x5a104a){_0x12d81b=_0x5a104a[_0xaf61('0x3b')];if(!_0x177c18[_0xaf61('0x35')]['hasOwnProperty'](_0xaf61('0x3c'))){_0x26dcd1[_0xaf61('0x1f')]=qs[_0xaf61('0x1f')](_0x177c18['query'][_0xaf61('0x1f')]);_0x26dcd1[_0xaf61('0x21')]=qs[_0xaf61('0x21')](_0x177c18[_0xaf61('0x35')][_0xaf61('0x21')]);}return _0x5ed485['getAllConditions'](_0x26dcd1);}})['then'](function(_0x43f9bd){if(_0x43f9bd){return _0x43f9bd?{'count':_0x12d81b,'rows':_0x43f9bd}:null;}})[_0xaf61('0x27')](respondWithResult(_0xc6adf,null))['catch'](handleError(_0xc6adf,null));};exports[_0xaf61('0x58')]=function(_0xdcd537,_0x13d5bc,_0x58fd3b){var _0x5f3cc5={};var _0x318863={};var _0x3e81bf;var _0x5ee2cc;return db[_0xaf61('0x30')][_0xaf61('0x59')]({'where':{'id':_0xdcd537[_0xaf61('0x51')]['id']}})['then'](handleEntityNotFound(_0x13d5bc,null))['then'](function(_0x570e1f){if(_0x570e1f){_0x3e81bf=_0x570e1f;_0x318863[_0xaf61('0x34')]=_[_0xaf61('0x36')](db['Condition'][_0xaf61('0x31')]);_0x318863['query']=_['keys'](_0xdcd537[_0xaf61('0x35')]);_0x318863[_0xaf61('0x37')]=_[_0xaf61('0x38')](_0x318863[_0xaf61('0x34')],_0x318863[_0xaf61('0x35')]);_0x5f3cc5[_0xaf61('0x39')]=_['intersection'](_0x318863[_0xaf61('0x34')],qs[_0xaf61('0x3a')](_0xdcd537[_0xaf61('0x35')][_0xaf61('0x3a')]));_0x5f3cc5[_0xaf61('0x39')]=_0x5f3cc5['attributes']['length']?_0x5f3cc5[_0xaf61('0x39')]:_0x318863[_0xaf61('0x34')];_0x5f3cc5[_0xaf61('0x3d')]=qs[_0xaf61('0x3e')](_0xdcd537[_0xaf61('0x35')][_0xaf61('0x3e')]);_0x5f3cc5['where']=qs[_0xaf61('0x37')](_[_0xaf61('0x57')](_0xdcd537[_0xaf61('0x35')],_0x318863[_0xaf61('0x37')]));if(_0xdcd537[_0xaf61('0x35')]['filter']){_0x5f3cc5[_0xaf61('0x3f')]=_[_0xaf61('0x41')](_0x5f3cc5[_0xaf61('0x3f')],{'$or':_['map'](_0x5f3cc5[_0xaf61('0x39')],function(_0x54303f){var _0xc660d7={};_0xc660d7[_0x54303f]={'$like':'%'+_0xdcd537[_0xaf61('0x35')]['filter']+'%'};return _0xc660d7;})});}_0x5f3cc5=_[_0xaf61('0x41')]({},_0x5f3cc5,_0xdcd537[_0xaf61('0x45')]);return _0x3e81bf[_0xaf61('0x58')](_0x5f3cc5);}})['then'](function(_0x2a0bc4){if(_0x2a0bc4){_0x5ee2cc=_0x2a0bc4['length'];if(!_0xdcd537['query'][_0xaf61('0x5a')](_0xaf61('0x3c'))){_0x5f3cc5[_0xaf61('0x1f')]=qs[_0xaf61('0x1f')](_0xdcd537['query']['limit']);_0x5f3cc5[_0xaf61('0x21')]=qs[_0xaf61('0x21')](_0xdcd537[_0xaf61('0x35')][_0xaf61('0x21')]);}return _0x3e81bf[_0xaf61('0x58')](_0x5f3cc5);}})['then'](function(_0x3038e8){if(_0x3038e8){return _0x3038e8?{'count':_0x5ee2cc,'rows':_0x3038e8}:null;}})[_0xaf61('0x27')](respondWithResult(_0x13d5bc,null))['catch'](handleError(_0x13d5bc,null));};exports['addAction']=function(_0x170f37,_0x456e10,_0x3c9558){if(_0x170f37['body']['id']){delete _0x170f37[_0xaf61('0x49')]['id'];}return db[_0xaf61('0x30')]['find']({'where':{'id':_0x170f37['params']['id']}})[_0xaf61('0x27')](handleEntityNotFound(_0x456e10,null))[_0xaf61('0x27')](function(_0x3ae13f){if(_0x3ae13f){_0x170f37[_0xaf61('0x49')][_0xaf61('0x5b')]=_0x3ae13f['id'];return db[_0xaf61('0x5c')][_0xaf61('0x48')](_0x170f37[_0xaf61('0x49')]);}})[_0xaf61('0x27')](respondWithResult(_0x456e10,null))[_0xaf61('0x47')](handleError(_0x456e10,null));};exports[_0xaf61('0x5d')]=function(_0x41f14a,_0x37ca5d,_0x1351da){var _0xef648c={};var _0x52b8ce={};var _0x90661c;var _0x169e09;return db[_0xaf61('0x30')][_0xaf61('0x59')]({'where':{'id':_0x41f14a[_0xaf61('0x51')]['id']}})[_0xaf61('0x27')](handleEntityNotFound(_0x37ca5d,null))[_0xaf61('0x27')](function(_0x54be5d){if(_0x54be5d){_0x90661c=_0x54be5d;_0x52b8ce['model']=_[_0xaf61('0x36')](db[_0xaf61('0x5c')][_0xaf61('0x31')]);_0x52b8ce[_0xaf61('0x35')]=_['keys'](_0x41f14a[_0xaf61('0x35')]);_0x52b8ce[_0xaf61('0x37')]=_[_0xaf61('0x38')](_0x52b8ce['model'],_0x52b8ce[_0xaf61('0x35')]);_0xef648c[_0xaf61('0x39')]=_['intersection'](_0x52b8ce['model'],qs[_0xaf61('0x3a')](_0x41f14a[_0xaf61('0x35')][_0xaf61('0x3a')]));_0xef648c[_0xaf61('0x39')]=_0xef648c[_0xaf61('0x39')][_0xaf61('0x3b')]?_0xef648c[_0xaf61('0x39')]:_0x52b8ce['model'];_0xef648c[_0xaf61('0x3d')]=qs[_0xaf61('0x3e')](_0x41f14a[_0xaf61('0x35')]['sort']);_0xef648c['where']=qs[_0xaf61('0x37')](_[_0xaf61('0x57')](_0x41f14a[_0xaf61('0x35')],_0x52b8ce['filters']));if(_0x41f14a[_0xaf61('0x35')][_0xaf61('0x40')]){_0xef648c['where']=_[_0xaf61('0x41')](_0xef648c[_0xaf61('0x3f')],{'$or':_[_0xaf61('0x2f')](_0xef648c[_0xaf61('0x39')],function(_0x464c63){var _0x175e7e={};_0x175e7e[_0x464c63]={'$like':'%'+_0x41f14a['query'][_0xaf61('0x40')]+'%'};return _0x175e7e;})});}_0xef648c=_[_0xaf61('0x41')]({},_0xef648c,_0x41f14a[_0xaf61('0x45')]);return _0x90661c[_0xaf61('0x5d')](_0xef648c);}})[_0xaf61('0x27')](function(_0x22f7e6){if(_0x22f7e6){_0x169e09=_0x22f7e6['length'];if(!_0x41f14a[_0xaf61('0x35')][_0xaf61('0x5a')](_0xaf61('0x3c'))){_0xef648c[_0xaf61('0x1f')]=qs[_0xaf61('0x1f')](_0x41f14a[_0xaf61('0x35')][_0xaf61('0x1f')]);_0xef648c[_0xaf61('0x21')]=qs[_0xaf61('0x21')](_0x41f14a[_0xaf61('0x35')][_0xaf61('0x21')]);}return _0x90661c['getActions'](_0xef648c);}})['then'](function(_0x41e863){if(_0x41e863){return _0x41e863?{'count':_0x169e09,'rows':_0x41e863}:null;}})['then'](respondWithResult(_0x37ca5d,null))[_0xaf61('0x47')](handleError(_0x37ca5d,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index d18e894..2f879f7 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 _0xed1f=['tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger'];(function(_0x55012f,_0x73a0b8){var _0x40421a=function(_0x3a11e5){while(--_0x3a11e5){_0x55012f['push'](_0x55012f['shift']());}};_0x40421a(++_0x73a0b8);}(_0xed1f,0x6a));var _0xfed1=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0xed1f[_0x1a7846];return _0x48049;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var logger=require(_0xfed1('0x2'))(_0xfed1('0x3'));var moment=require(_0xfed1('0x4'));var BPromise=require(_0xfed1('0x5'));var rp=require(_0xfed1('0x6'));var fs=require('fs');var path=require(_0xfed1('0x7'));var rimraf=require(_0xfed1('0x8'));var config=require(_0xfed1('0x9'));var attributes=require(_0xfed1('0xa'));module[_0xfed1('0xb')]=function(_0x3d6706,_0x42751d){return _0x3d6706[_0xfed1('0xc')](_0xfed1('0xd'),attributes,{'tableName':_0xfed1('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fdb=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./trigger.attributes','Trigger','tools_triggers'];(function(_0x4dc25f,_0x2f84fb){var _0x168e49=function(_0x118039){while(--_0x118039){_0x4dc25f['push'](_0x4dc25f['shift']());}};_0x168e49(++_0x2f84fb);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x146e79,_0x45c82a){_0x146e79=_0x146e79-0x0;var _0x17971a=_0x4fdb[_0x146e79];return _0x17971a;};'use strict';var _=require(_0xb4fd('0x0'));var util=require(_0xb4fd('0x1'));var logger=require(_0xb4fd('0x2'))(_0xb4fd('0x3'));var moment=require(_0xb4fd('0x4'));var BPromise=require(_0xb4fd('0x5'));var rp=require(_0xb4fd('0x6'));var fs=require('fs');var path=require(_0xb4fd('0x7'));var rimraf=require(_0xb4fd('0x8'));var config=require('../../config/environment');var attributes=require(_0xb4fd('0x9'));module['exports']=function(_0x14052b,_0x5d8b39){return _0x14052b['define'](_0xb4fd('0xa'),attributes,{'tableName':_0xb4fd('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 749efa5..761ce9c 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 _0x9363=['attributes','limit','include','model','map','debug','ShowTrigger','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x9363,0x7a));var _0x3936=function(_0x5cbace,_0x33943c){_0x5cbace=_0x5cbace-0x0;var _0x6de5b8=_0x9363[_0x5cbace];return _0x6de5b8;};'use strict';var _=require(_0x3936('0x0'));var util=require(_0x3936('0x1'));var moment=require(_0x3936('0x2'));var BPromise=require(_0x3936('0x3'));var rs=require(_0x3936('0x4'));var fs=require('fs');var Redis=require(_0x3936('0x5'));var db=require(_0x3936('0x6'))['db'];var utils=require(_0x3936('0x7'));var logger=require('../../config/logger')(_0x3936('0x8'));var config=require(_0x3936('0x9'));var jayson=require(_0x3936('0xa'));var client=jayson[_0x3936('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x278516,_0x1f9b88,_0x89d359){return new BPromise(function(_0x3b6771,_0x23b78c){return client[_0x3936('0xc')](_0x278516,_0x89d359)[_0x3936('0xd')](function(_0x47e6bd){logger[_0x3936('0xe')]('Trigger,\x20%s,\x20%s',_0x1f9b88,_0x3936('0xf'));logger['debug'](_0x3936('0x10'),_0x1f9b88,_0x3936('0xf'),JSON[_0x3936('0x11')](_0x47e6bd));if(_0x47e6bd[_0x3936('0x12')]){if(_0x47e6bd['error'][_0x3936('0x13')]===0x1f4){logger['error'](_0x3936('0x14'),_0x1f9b88,_0x47e6bd[_0x3936('0x12')]['message']);return _0x23b78c(_0x47e6bd[_0x3936('0x12')][_0x3936('0x15')]);}logger[_0x3936('0x12')](_0x3936('0x14'),_0x1f9b88,_0x47e6bd[_0x3936('0x12')][_0x3936('0x15')]);return _0x3b6771(_0x47e6bd[_0x3936('0x12')][_0x3936('0x15')]);}else{logger[_0x3936('0xe')](_0x3936('0x14'),_0x1f9b88,_0x3936('0xf'));_0x3b6771(_0x47e6bd[_0x3936('0x16')][_0x3936('0x15')]);}})[_0x3936('0x17')](function(_0x4aa9ee){logger[_0x3936('0x12')](_0x3936('0x14'),_0x1f9b88,_0x4aa9ee);_0x23b78c(_0x4aa9ee);});});}exports[_0x3936('0x18')]=function(_0x1c8a4b){var _0x5e7a49=this;return new Promise(function(_0x2b0244,_0x48f0cb){return db[_0x3936('0x19')][_0x3936('0x1a')]({'raw':_0x1c8a4b[_0x3936('0x1b')]?_0x1c8a4b[_0x3936('0x1b')][_0x3936('0x1c')]===undefined?!![]:![]:!![],'where':_0x1c8a4b[_0x3936('0x1b')]?_0x1c8a4b[_0x3936('0x1b')][_0x3936('0x1d')]||null:null,'attributes':_0x1c8a4b[_0x3936('0x1b')]?_0x1c8a4b[_0x3936('0x1b')][_0x3936('0x1e')]||null:null,'limit':_0x1c8a4b[_0x3936('0x1b')]?_0x1c8a4b[_0x3936('0x1b')][_0x3936('0x1f')]||null:null,'include':_0x1c8a4b[_0x3936('0x1b')]?_0x1c8a4b[_0x3936('0x1b')]['include']?_['map'](_0x1c8a4b['options'][_0x3936('0x20')],function(_0x209d86){return{'model':db[_0x209d86[_0x3936('0x21')]],'as':_0x209d86['as'],'attributes':_0x209d86[_0x3936('0x1e')],'include':_0x209d86[_0x3936('0x20')]?_[_0x3936('0x22')](_0x209d86[_0x3936('0x20')],function(_0x3f9355){return{'model':db[_0x3f9355[_0x3936('0x21')]],'as':_0x3f9355['as'],'attributes':_0x3f9355[_0x3936('0x1e')],'include':_0x3f9355['include']?_[_0x3936('0x22')](_0x3f9355[_0x3936('0x20')],function(_0x543993){return{'model':db[_0x543993[_0x3936('0x21')]],'as':_0x543993['as'],'attributes':_0x543993[_0x3936('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x59ed00){logger[_0x3936('0xe')](_0x3936('0x18'),_0x1c8a4b);logger[_0x3936('0x23')](_0x3936('0x18'),_0x1c8a4b,JSON[_0x3936('0x11')](_0x59ed00));_0x2b0244(_0x59ed00);})[_0x3936('0x17')](function(_0x17ec10){logger[_0x3936('0x12')](_0x3936('0x18'),_0x17ec10[_0x3936('0x15')],_0x1c8a4b);_0x48f0cb(_0x5e7a49[_0x3936('0x12')](0x1f4,_0x17ec10['message']));});});};exports[_0x3936('0x24')]=function(_0x193520){var _0x3da842=this;return new Promise(function(_0x375c5c,_0x447e8d){return db[_0x3936('0x19')][_0x3936('0x25')]({'raw':_0x193520[_0x3936('0x1b')]?_0x193520[_0x3936('0x1b')][_0x3936('0x1c')]===undefined?!![]:![]:!![],'where':_0x193520[_0x3936('0x1b')]?_0x193520[_0x3936('0x1b')]['where']||null:null,'attributes':_0x193520[_0x3936('0x1b')]?_0x193520[_0x3936('0x1b')][_0x3936('0x1e')]||null:null,'include':_0x193520[_0x3936('0x1b')]?_0x193520[_0x3936('0x1b')]['include']?_[_0x3936('0x22')](_0x193520['options']['include'],function(_0x5364a3){return{'model':db[_0x5364a3['model']],'as':_0x5364a3['as'],'attributes':_0x5364a3['attributes'],'include':_0x5364a3[_0x3936('0x20')]?_['map'](_0x5364a3['include'],function(_0x28b8b9){return{'model':db[_0x28b8b9[_0x3936('0x21')]],'as':_0x28b8b9['as'],'attributes':_0x28b8b9[_0x3936('0x1e')],'include':_0x28b8b9[_0x3936('0x20')]?_['map'](_0x28b8b9[_0x3936('0x20')],function(_0x76a97d){return{'model':db[_0x76a97d['model']],'as':_0x76a97d['as'],'attributes':_0x76a97d[_0x3936('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3936('0xd')](function(_0x30a75e){logger[_0x3936('0xe')]('ShowTrigger',_0x193520);logger['debug']('ShowTrigger',_0x193520,JSON['stringify'](_0x30a75e));_0x375c5c(_0x30a75e);})[_0x3936('0x17')](function(_0x1febf2){logger[_0x3936('0x12')](_0x3936('0x24'),_0x1febf2[_0x3936('0x15')],_0x193520);_0x447e8d(_0x3da842[_0x3936('0x12')](0x1f4,_0x1febf2['message']));});});}; \ No newline at end of file +var _0xe893=['attributes','include','model','map','then','debug','ShowTrigger','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe893,0x11f));var _0x3e89=function(_0x16fe4c,_0x2421e8){_0x16fe4c=_0x16fe4c-0x0;var _0x9999d=_0xe893[_0x16fe4c];return _0x9999d;};'use strict';var _=require(_0x3e89('0x0'));var util=require(_0x3e89('0x1'));var moment=require(_0x3e89('0x2'));var BPromise=require(_0x3e89('0x3'));var rs=require(_0x3e89('0x4'));var fs=require('fs');var Redis=require(_0x3e89('0x5'));var db=require(_0x3e89('0x6'))['db'];var utils=require(_0x3e89('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x3e89('0x8'));var jayson=require(_0x3e89('0x9'));var client=jayson[_0x3e89('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33a90a,_0x5e0a7a,_0xf66edc){return new BPromise(function(_0x52065e,_0x3ba244){return client[_0x3e89('0xb')](_0x33a90a,_0xf66edc)['then'](function(_0x20f5ae){logger[_0x3e89('0xc')](_0x3e89('0xd'),_0x5e0a7a,_0x3e89('0xe'));logger['debug'](_0x3e89('0xf'),_0x5e0a7a,_0x3e89('0xe'),JSON[_0x3e89('0x10')](_0x20f5ae));if(_0x20f5ae['error']){if(_0x20f5ae[_0x3e89('0x11')][_0x3e89('0x12')]===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0x5e0a7a,_0x20f5ae[_0x3e89('0x11')][_0x3e89('0x13')]);return _0x3ba244(_0x20f5ae['error'][_0x3e89('0x13')]);}logger['error'](_0x3e89('0xd'),_0x5e0a7a,_0x20f5ae[_0x3e89('0x11')][_0x3e89('0x13')]);return _0x52065e(_0x20f5ae[_0x3e89('0x11')][_0x3e89('0x13')]);}else{logger['info'](_0x3e89('0xd'),_0x5e0a7a,_0x3e89('0xe'));_0x52065e(_0x20f5ae[_0x3e89('0x14')][_0x3e89('0x13')]);}})[_0x3e89('0x15')](function(_0x33ef5d){logger[_0x3e89('0x11')](_0x3e89('0xd'),_0x5e0a7a,_0x33ef5d);_0x3ba244(_0x33ef5d);});});}exports[_0x3e89('0x16')]=function(_0x238f17){var _0x1eb666=this;return new Promise(function(_0x5cc628,_0x4b2e62){return db[_0x3e89('0x17')][_0x3e89('0x18')]({'raw':_0x238f17[_0x3e89('0x19')]?_0x238f17['options'][_0x3e89('0x1a')]===undefined?!![]:![]:!![],'where':_0x238f17[_0x3e89('0x19')]?_0x238f17[_0x3e89('0x19')][_0x3e89('0x1b')]||null:null,'attributes':_0x238f17[_0x3e89('0x19')]?_0x238f17[_0x3e89('0x19')][_0x3e89('0x1c')]||null:null,'limit':_0x238f17[_0x3e89('0x19')]?_0x238f17[_0x3e89('0x19')]['limit']||null:null,'include':_0x238f17[_0x3e89('0x19')]?_0x238f17[_0x3e89('0x19')][_0x3e89('0x1d')]?_['map'](_0x238f17[_0x3e89('0x19')][_0x3e89('0x1d')],function(_0x43654b){return{'model':db[_0x43654b[_0x3e89('0x1e')]],'as':_0x43654b['as'],'attributes':_0x43654b[_0x3e89('0x1c')],'include':_0x43654b[_0x3e89('0x1d')]?_['map'](_0x43654b[_0x3e89('0x1d')],function(_0x4c577c){return{'model':db[_0x4c577c[_0x3e89('0x1e')]],'as':_0x4c577c['as'],'attributes':_0x4c577c['attributes'],'include':_0x4c577c['include']?_[_0x3e89('0x1f')](_0x4c577c[_0x3e89('0x1d')],function(_0x14e834){return{'model':db[_0x14e834[_0x3e89('0x1e')]],'as':_0x14e834['as'],'attributes':_0x14e834[_0x3e89('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3e89('0x20')](function(_0x51e93a){logger['info']('GetTrigger',_0x238f17);logger[_0x3e89('0x21')](_0x3e89('0x16'),_0x238f17,JSON[_0x3e89('0x10')](_0x51e93a));_0x5cc628(_0x51e93a);})['catch'](function(_0x44b190){logger[_0x3e89('0x11')](_0x3e89('0x16'),_0x44b190['message'],_0x238f17);_0x4b2e62(_0x1eb666[_0x3e89('0x11')](0x1f4,_0x44b190[_0x3e89('0x13')]));});});};exports[_0x3e89('0x22')]=function(_0x445a77){var _0x55450a=this;return new Promise(function(_0x129076,_0x598b5b){return db['Trigger']['find']({'raw':_0x445a77[_0x3e89('0x19')]?_0x445a77[_0x3e89('0x19')][_0x3e89('0x1a')]===undefined?!![]:![]:!![],'where':_0x445a77['options']?_0x445a77['options']['where']||null:null,'attributes':_0x445a77[_0x3e89('0x19')]?_0x445a77[_0x3e89('0x19')][_0x3e89('0x1c')]||null:null,'include':_0x445a77[_0x3e89('0x19')]?_0x445a77['options'][_0x3e89('0x1d')]?_[_0x3e89('0x1f')](_0x445a77['options'][_0x3e89('0x1d')],function(_0x5bf8a2){return{'model':db[_0x5bf8a2[_0x3e89('0x1e')]],'as':_0x5bf8a2['as'],'attributes':_0x5bf8a2[_0x3e89('0x1c')],'include':_0x5bf8a2[_0x3e89('0x1d')]?_['map'](_0x5bf8a2[_0x3e89('0x1d')],function(_0x19c3cd){return{'model':db[_0x19c3cd[_0x3e89('0x1e')]],'as':_0x19c3cd['as'],'attributes':_0x19c3cd['attributes'],'include':_0x19c3cd['include']?_['map'](_0x19c3cd[_0x3e89('0x1d')],function(_0x2f3e5d){return{'model':db[_0x2f3e5d[_0x3e89('0x1e')]],'as':_0x2f3e5d['as'],'attributes':_0x2f3e5d[_0x3e89('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3e89('0x20')](function(_0x5bb0ac){logger[_0x3e89('0xc')](_0x3e89('0x22'),_0x445a77);logger['debug']('ShowTrigger',_0x445a77,JSON[_0x3e89('0x10')](_0x5bb0ac));_0x129076(_0x5bb0ac);})['catch'](function(_0x1524af){logger['error'](_0x3e89('0x22'),_0x1524af[_0x3e89('0x13')],_0x445a77);_0x598b5b(_0x55450a['error'](0x1f4,_0x1524af['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 0bf1dc6..5536792 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 _0x7e1e=['../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','create','put','update','destroy','exports','util','path','Router','fs-extra'];(function(_0x544c8a,_0x141929){var _0x3c4a70=function(_0x2c8541){while(--_0x2c8541){_0x544c8a['push'](_0x544c8a['shift']());}};_0x3c4a70(++_0x141929);}(_0x7e1e,0xa7));var _0xe7e1=function(_0x12d74e,_0x312224){_0x12d74e=_0x12d74e-0x0;var _0x48468c=_0x7e1e[_0x12d74e];return _0x48468c;};'use strict';var multer=require('multer');var util=require(_0xe7e1('0x0'));var path=require(_0xe7e1('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe7e1('0x2')]();var fs_extra=require(_0xe7e1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe7e1('0x4'));var config=require(_0xe7e1('0x5'));var controller=require(_0xe7e1('0x6'));router[_0xe7e1('0x7')]('/',auth[_0xe7e1('0x8')](),controller[_0xe7e1('0x9')]);router[_0xe7e1('0x7')](_0xe7e1('0xa'),auth[_0xe7e1('0x8')](),controller[_0xe7e1('0xb')]);router[_0xe7e1('0xc')](_0xe7e1('0xd'),auth[_0xe7e1('0x8')](),controller['clone']);router['post']('/',auth[_0xe7e1('0x8')](),controller[_0xe7e1('0xe')]);router[_0xe7e1('0xf')](_0xe7e1('0xa'),auth['isAuthenticated'](),controller[_0xe7e1('0x10')]);router['delete'](_0xe7e1('0xa'),auth[_0xe7e1('0x8')](),controller[_0xe7e1('0x11')]);module[_0xe7e1('0x12')]=router; \ No newline at end of file +var _0x11d9=['destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','clone','create','put','update','delete','/:id'];(function(_0x5b4d16,_0x1c71b5){var _0x1ad075=function(_0x236666){while(--_0x236666){_0x5b4d16['push'](_0x5b4d16['shift']());}};_0x1ad075(++_0x1c71b5);}(_0x11d9,0x16b));var _0x911d=function(_0xe36193,_0x5bbd3d){_0xe36193=_0xe36193-0x0;var _0x5c6451=_0x11d9[_0xe36193];return _0x5c6451;};'use strict';var multer=require(_0x911d('0x0'));var util=require(_0x911d('0x1'));var path=require(_0x911d('0x2'));var timeout=require(_0x911d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x911d('0x4'));var auth=require(_0x911d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x911d('0x6'));var controller=require('./trunk.controller');router[_0x911d('0x7')]('/',auth[_0x911d('0x8')](),controller[_0x911d('0x9')]);router[_0x911d('0x7')]('/:id',auth[_0x911d('0x8')](),controller[_0x911d('0xa')]);router['post']('/:id/clone',auth[_0x911d('0x8')](),controller[_0x911d('0xb')]);router['post']('/',auth[_0x911d('0x8')](),controller[_0x911d('0xc')]);router[_0x911d('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x911d('0xe')]);router[_0x911d('0xf')](_0x911d('0x10'),auth[_0x911d('0x8')](),controller[_0x911d('0x11')]);module[_0x911d('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 3bfcaa6..bc36d74 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 _0x8be2=['join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','auto','yes','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','port,invite','insecure','never','\x22\x22\x20<>','INTEGER','accept','uac','pai','active','actpass','nonat','update,nonat','BOOLEAN','sequelize','exports','STRING','name','friend','user','from-voip-provider','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue'];(function(_0x1eee6e,_0x12f7a3){var _0x3caf1d=function(_0x263ed9){while(--_0x263ed9){_0x1eee6e['push'](_0x1eee6e['shift']());}};_0x3caf1d(++_0x12f7a3);}(_0x8be2,0xab));var _0x28be=function(_0x4db7c1,_0x40baeb){_0x4db7c1=_0x4db7c1-0x0;var _0x41fa35=_0x8be2[_0x4db7c1];return _0x41fa35;};'use strict';var Sequelize=require(_0x28be('0x0'));module[_0x28be('0x1')]={'name':{'type':Sequelize[_0x28be('0x2')],'allowNull':![],'unique':_0x28be('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x28be('0x4'),_0x28be('0x5'),'peer'),'allowNull':![],'defaultValue':_0x28be('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x28be('0x6')},'callingpres':{'type':Sequelize[_0x28be('0x7')]('ALLOWED_NOT_SCREENED',_0x28be('0x8'),_0x28be('0x9'),_0x28be('0xa'),_0x28be('0xb'),_0x28be('0xc'),_0x28be('0xd'),_0x28be('0xe'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x28be('0x2')]},'secret':{'type':Sequelize[_0x28be('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x28be('0x2')],'defaultValue':_0x28be('0xf'),'set':function(_0x387c33){this[_0x28be('0x10')]('transport',_0x387c33?_0x387c33[_0x28be('0x11')](','):null);},'get':function(){return this[_0x28be('0x12')](_0x28be('0x13'))?this[_0x28be('0x12')](_0x28be('0x13'))[_0x28be('0x14')](','):null;},'comment':_0x28be('0x15')},'dtmfmode':{'type':Sequelize[_0x28be('0x7')](_0x28be('0x16'),'info',_0x28be('0x17'),'inband',_0x28be('0x18')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x28be('0x7')](_0x28be('0x19'),'no','nonat',_0x28be('0x1a'),_0x28be('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x28be('0x7')](_0x28be('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x28be('0x2')]},'directmediadeny':{'type':Sequelize[_0x28be('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x28be('0x1c'),'set':function(_0x277d73){this[_0x28be('0x10')](_0x28be('0x1d'),_0x277d73?_0x277d73[_0x28be('0x11')](','):null);},'get':function(){return this[_0x28be('0x12')](_0x28be('0x1d'))?this[_0x28be('0x12')]('nat')[_0x28be('0x14')](','):null;},'comment':_0x28be('0x1e')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x28be('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x28be('0x2')]},'language':{'type':Sequelize[_0x28be('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x28be('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x28be('0x2')],'defaultValue':_0x28be('0x1f')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x28be('0x20'),'set':function(_0x3a2d70){this[_0x28be('0x10')](_0x28be('0x21'),_0x3a2d70?_0x3a2d70[_0x28be('0x11')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x28be('0x12')](_0x28be('0x21'))?this[_0x28be('0x12')](_0x28be('0x21'))[_0x28be('0x14')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x28be('0x7')](_0x28be('0x19'),'no')},'insecure':{'type':Sequelize[_0x28be('0x2')],'defaultValue':_0x28be('0x22'),'set':function(_0x400773){this['setDataValue'](_0x28be('0x23'),_0x400773?_0x400773[_0x28be('0x11')](','):null);},'get':function(){return this[_0x28be('0x12')](_0x28be('0x23'))?this[_0x28be('0x12')](_0x28be('0x23'))[_0x28be('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x28be('0x7')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x28be('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x28be('0x7')](_0x28be('0x19'),'no',_0x28be('0x24'))},'promiscredir':{'type':Sequelize['ENUM'](_0x28be('0x19'),'no')},'useclientcode':{'type':Sequelize[_0x28be('0x7')]('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x28be('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x28be('0x25')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x28be('0x7')](_0x28be('0x19'),'no'),'defaultValue':_0x28be('0x19')},'busylevel':{'type':Sequelize[_0x28be('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0x28be('0x7')](_0x28be('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x28be('0x7')](_0x28be('0x19'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x28be('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0x28be('0x7')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x28be('0x2')]},'template':{'type':Sequelize[_0x28be('0x2')]},'videosupport':{'type':Sequelize[_0x28be('0x7')](_0x28be('0x19'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x28be('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x28be('0x7')](_0x28be('0x19'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x28be('0x7')](_0x28be('0x27'),'refuse','originate')},'session_expires':{'type':Sequelize[_0x28be('0x26')](0xb)},'session_minse':{'type':Sequelize[_0x28be('0x26')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x28be('0x28'),'uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x28be('0x2')]},'regexten':{'type':Sequelize[_0x28be('0x2')]},'fromdomain':{'type':Sequelize[_0x28be('0x2')]},'fromuser':{'type':Sequelize[_0x28be('0x2')]},'port':{'type':Sequelize[_0x28be('0x26')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x28be('0x19'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x28be('0x26')](0xb)},'defaultip':{'type':Sequelize[_0x28be('0x2')]},'defaultuser':{'type':Sequelize[_0x28be('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x28be('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0x28be('0x7')]('yes','no',_0x28be('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x28be('0x2')]},'callbackextension':{'type':Sequelize[_0x28be('0x2')]},'timert1':{'type':Sequelize[_0x28be('0x26')](0xb)},'timerb':{'type':Sequelize[_0x28be('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0x28be('0x26')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x28be('0x2')]},'contactacl':{'type':Sequelize[_0x28be('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x28be('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x28be('0x26')](0xb)},'encryption':{'type':Sequelize[_0x28be('0x7')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x28be('0x7')](_0x28be('0x19'),'no')},'force_avp':{'type':Sequelize[_0x28be('0x7')](_0x28be('0x19'),'no')},'icesupport':{'type':Sequelize['ENUM']('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x28be('0x19'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x28be('0x19'),'no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x28be('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x28be('0x2')]},'dtlscipher':{'type':Sequelize[_0x28be('0x2')]},'dtlscafile':{'type':Sequelize[_0x28be('0x2')]},'dtlscapath':{'type':Sequelize[_0x28be('0x2')]},'dtlssetup':{'type':Sequelize[_0x28be('0x7')](_0x28be('0x2a'),'passive',_0x28be('0x2b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x28be('0x2')]},'usereqphone':{'type':Sequelize[_0x28be('0x7')](_0x28be('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x28be('0x2')]},'recordofffeature':{'type':Sequelize[_0x28be('0x2')]},'call_limit':{'type':Sequelize[_0x28be('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x28be('0x19'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x28be('0x19'),'no')},'vmexten':{'type':Sequelize[_0x28be('0x2')]},'mohinterpret':{'type':Sequelize[_0x28be('0x2')]},'mohsuggest':{'type':Sequelize[_0x28be('0x2')]},'parkinglot':{'type':Sequelize[_0x28be('0x2')]},'description':{'type':Sequelize[_0x28be('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x28be('0x7')](_0x28be('0x19'),'no',_0x28be('0x2c'),'update',_0x28be('0x2d')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x28be('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x28be('0x2e')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x28be('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0xe8e2=['STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','auto','rfc2833','yes','nonat','outgoing','setDataValue','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]','insecure','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','always','accept','refuse','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','sequelize','exports'];(function(_0x28dcaf,_0x27bfa1){var _0x49a38f=function(_0x1c288e){while(--_0x1c288e){_0x28dcaf['push'](_0x28dcaf['shift']());}};_0x49a38f(++_0x27bfa1);}(_0xe8e2,0x107));var _0x2e8e=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0xe8e2[_0x5cb1af];return _0x8d7940;};'use strict';var Sequelize=require(_0x2e8e('0x0'));module[_0x2e8e('0x1')]={'name':{'type':Sequelize[_0x2e8e('0x2')],'allowNull':![],'unique':_0x2e8e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x5'),_0x2e8e('0x6'),_0x2e8e('0x7')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x2e8e('0x2')],'allowNull':![],'defaultValue':_0x2e8e('0x8')},'callingpres':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x9'),_0x2e8e('0xa'),_0x2e8e('0xb'),_0x2e8e('0xc'),_0x2e8e('0xd'),'PROHIB_PASSED_SCREEN',_0x2e8e('0xe'),_0x2e8e('0xf'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x2e8e('0x2')]},'secret':{'type':Sequelize[_0x2e8e('0x2')]},'md5secret':{'type':Sequelize[_0x2e8e('0x2')]},'remotesecret':{'type':Sequelize[_0x2e8e('0x2')]},'transport':{'type':Sequelize[_0x2e8e('0x2')],'defaultValue':_0x2e8e('0x10'),'set':function(_0x505528){this['setDataValue'](_0x2e8e('0x11'),_0x505528?_0x505528[_0x2e8e('0x12')](','):null);},'get':function(){return this[_0x2e8e('0x13')](_0x2e8e('0x11'))?this[_0x2e8e('0x13')](_0x2e8e('0x11'))['split'](','):null;},'comment':_0x2e8e('0x14')},'dtmfmode':{'type':Sequelize[_0x2e8e('0x4')]('rfc2833',_0x2e8e('0x15'),_0x2e8e('0x16'),'inband',_0x2e8e('0x17')),'defaultValue':_0x2e8e('0x18')},'directmedia':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x19'),'no',_0x2e8e('0x1a'),'update',_0x2e8e('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2e8e('0x4')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x2e8e('0x2')]},'nat':{'type':Sequelize[_0x2e8e('0x2')],'defaultValue':'force_rport,comedia','set':function(_0xb8d04){this[_0x2e8e('0x1c')]('nat',_0xb8d04?_0xb8d04[_0x2e8e('0x12')](','):null);},'get':function(){return this[_0x2e8e('0x13')](_0x2e8e('0x1d'))?this[_0x2e8e('0x13')](_0x2e8e('0x1d'))['split'](','):null;},'comment':_0x2e8e('0x1e')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x2e8e('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x2e8e('0x2')]},'language':{'type':Sequelize[_0x2e8e('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2e8e('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x2e8e('0x2')],'defaultValue':_0x2e8e('0x1f')},'allow':{'type':Sequelize[_0x2e8e('0x2')],'allowNull':![],'defaultValue':_0x2e8e('0x20'),'set':function(_0x17318d){this[_0x2e8e('0x1c')](_0x2e8e('0x21'),_0x17318d?_0x17318d[_0x2e8e('0x12')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x2e8e('0x13')]('allow')?this[_0x2e8e('0x13')](_0x2e8e('0x21'))['split'](';'):null;},'comment':_0x2e8e('0x22')},'autoframing':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x19'),'no')},'insecure':{'type':Sequelize[_0x2e8e('0x2')],'defaultValue':'port,invite','set':function(_0x5126c6){this[_0x2e8e('0x1c')](_0x2e8e('0x23'),_0x5126c6?_0x5126c6[_0x2e8e('0x12')](','):null);},'get':function(){return this[_0x2e8e('0x13')]('insecure')?this[_0x2e8e('0x13')](_0x2e8e('0x23'))[_0x2e8e('0x24')](','):null;},'comment':_0x2e8e('0x25')},'trustrpid':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x2e8e('0x19'),'no',_0x2e8e('0x26'))},'promiscredir':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x19'),'no')},'useclientcode':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x19'),'no')},'accountcode':{'type':Sequelize[_0x2e8e('0x27')](0xb)},'setvar':{'type':Sequelize[_0x2e8e('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x2e8e('0x2')]},'callcounter':{'type':Sequelize[_0x2e8e('0x4')]('yes','no'),'defaultValue':_0x2e8e('0x19')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x19'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x2e8e('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0x2e8e('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x19'),'no',_0x2e8e('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2e8e('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x19'),'no')},'mailbox':{'type':Sequelize[_0x2e8e('0x2')]},'session_timers':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x29'),_0x2e8e('0x2a'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x2e8e('0x27')](0xb)},'session_refresher':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x2b'),_0x2e8e('0x2c')),'defaultValue':_0x2e8e('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0x2e8e('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x2e8e('0x2')]},'fromuser':{'type':Sequelize[_0x2e8e('0x2')]},'port':{'type':Sequelize[_0x2e8e('0x27')](0x5)},'qualify':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x19'),'no'),'defaultValue':_0x2e8e('0x19')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x2e8e('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x2e8e('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x2e8e('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x2e8e('0x27')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x2e8e('0x19'),'no',_0x2e8e('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2e8e('0x2')]},'callbackextension':{'type':Sequelize[_0x2e8e('0x2')]},'timert1':{'type':Sequelize[_0x2e8e('0x27')](0xb)},'timerb':{'type':Sequelize[_0x2e8e('0x27')](0xb)},'qualifyfreq':{'type':Sequelize[_0x2e8e('0x27')](0xb)},'contactpermit':{'type':Sequelize[_0x2e8e('0x2')]},'contactdeny':{'type':Sequelize[_0x2e8e('0x2')]},'contactacl':{'type':Sequelize[_0x2e8e('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x2e8e('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x2e8e('0x27')](0xb)},'encryption':{'type':Sequelize[_0x2e8e('0x4')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2e8e('0x4')]('yes','no')},'force_avp':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x19'),'no')},'icesupport':{'type':Sequelize[_0x2e8e('0x4')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x2e8e('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x2e8e('0x4')](_0x2e8e('0x19'),'no',_0x2e8e('0x2e'),_0x2e8e('0x2f'))},'dtlsrekey':{'type':Sequelize[_0x2e8e('0x27')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x2e8e('0x2')]},'dtlscapath':{'type':Sequelize[_0x2e8e('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x2e8e('0x30'),_0x2e8e('0x31'),_0x2e8e('0x32')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM'](_0x2e8e('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x2e8e('0x2')]},'call_limit':{'type':Sequelize[_0x2e8e('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize[_0x2e8e('0x2')]},'mohinterpret':{'type':Sequelize[_0x2e8e('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x2e8e('0x2')]},'description':{'type':Sequelize[_0x2e8e('0x2')]},'host':{'type':Sequelize[_0x2e8e('0x2')],'defaultValue':_0x2e8e('0x33')},'canreinvite':{'type':Sequelize['ENUM'](_0x2e8e('0x19'),'no',_0x2e8e('0x1a'),'update',_0x2e8e('0x34')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x2e8e('0x2')]},'otherFields':{'type':Sequelize[_0x2e8e('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x2e8e('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 5ba9291..9ca15cf 100644 --- a/server/api/trunk/trunk.controller.js +++ b/server/api/trunk/trunk.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54ef=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','include','find','get','updatedAt','omit','body','createdAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','userProfileId','root','chan_sip.so','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','http','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Trunks','UserProfileResource','name','send','index','map','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x1f7a29,_0x5e4767){var _0x37d26e=function(_0x519431){while(--_0x519431){_0x1f7a29['push'](_0x1f7a29['shift']());}};_0x37d26e(++_0x5e4767);}(_0x54ef,0x112));var _0xf54e=function(_0xd51679,_0x4e869b){_0xd51679=_0xd51679-0x0;var _0x559f6a=_0x54ef[_0xd51679];return _0x559f6a;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2033e9,_0x28f776,_0x380f26,_0x5644aa){return new BPromise(function(_0x331732,_0x1bbeaa){var _0x1855fe=_0x5644aa||client;return _0x1855fe[_0xf54e('0x1a')](_0x2033e9,_0x380f26)['then'](function(_0x2366ee){logger[_0xf54e('0x1b')](_0xf54e('0x1c'),_0x28f776,'request\x20sent');logger['debug'](_0xf54e('0x1d'),_0x28f776,_0xf54e('0x1e'),JSON[_0xf54e('0x1f')](_0x2366ee));if(_0x2366ee[_0xf54e('0x20')]){if(_0x2366ee[_0xf54e('0x20')][_0xf54e('0x21')]===0x1f4){logger[_0xf54e('0x20')](_0xf54e('0x1c'),_0x28f776,_0x2366ee[_0xf54e('0x20')][_0xf54e('0x22')]);return _0x1bbeaa(_0x2366ee[_0xf54e('0x20')]['message']);}logger['error'](_0xf54e('0x1c'),_0x28f776,_0x2366ee['error'][_0xf54e('0x22')]);return _0x331732(_0x2366ee[_0xf54e('0x20')][_0xf54e('0x22')]);}else{logger[_0xf54e('0x1b')](_0xf54e('0x1c'),_0x28f776,_0xf54e('0x1e'));_0x331732(_0x2366ee[_0xf54e('0x23')][_0xf54e('0x22')]);}})[_0xf54e('0x24')](function(_0x5f9eea){logger[_0xf54e('0x20')]('Trunk,\x20%s,\x20%s',_0x28f776,_0x5f9eea);_0x1bbeaa(_0x5f9eea);});});}function respondWithStatusCode(_0x6f6d29,_0x54f914){_0x54f914=_0x54f914||0xcc;return function(_0x264a8f){if(_0x264a8f){return _0x6f6d29[_0xf54e('0x25')](_0x54f914);}return _0x6f6d29[_0xf54e('0x26')](_0x54f914)[_0xf54e('0x27')]();};}function respondWithResult(_0x3805a7,_0x160160){_0x160160=_0x160160||0xc8;return function(_0x1e08d1){if(_0x1e08d1){return _0x3805a7[_0xf54e('0x26')](_0x160160)[_0xf54e('0x28')](_0x1e08d1);}};}function respondWithFilteredResult(_0x33457f,_0xf6cdd7){return function(_0x39c0ae){if(_0x39c0ae){var _0x2ea001=typeof _0xf6cdd7['offset']===_0xf54e('0x29')&&typeof _0xf6cdd7['limit']===_0xf54e('0x29');var _0x5e63f4=_0x39c0ae[_0xf54e('0x2a')];var _0x269f47=_0x2ea001?0x0:_0xf6cdd7[_0xf54e('0x2b')];var _0xa13cd0=_0x2ea001?_0x39c0ae[_0xf54e('0x2a')]:_0xf6cdd7[_0xf54e('0x2b')]+_0xf6cdd7[_0xf54e('0x2c')];var _0x54bd8f;if(_0xa13cd0>=_0x5e63f4){_0xa13cd0=_0x5e63f4;_0x54bd8f=0xc8;}else{_0x54bd8f=0xce;}_0x33457f['status'](_0x54bd8f);return _0x33457f[_0xf54e('0x2d')](_0xf54e('0x2e'),_0x269f47+'-'+_0xa13cd0+'/'+_0x5e63f4)[_0xf54e('0x28')](_0x39c0ae);}return null;};}function patchUpdates(_0x16d00f){return function(_0xb2d4c4){try{jsonpatch[_0xf54e('0x2f')](_0xb2d4c4,_0x16d00f,!![]);}catch(_0x2b5408){return BPromise[_0xf54e('0x30')](_0x2b5408);}return _0xb2d4c4[_0xf54e('0x31')]();};}function saveUpdates(_0x12edc3,_0x5ea0cc){return function(_0x5f29d3){if(_0x5f29d3){return _0x5f29d3[_0xf54e('0x32')](_0x12edc3)[_0xf54e('0x33')](function(_0x4d8fdd){return _0x4d8fdd;});}return null;};}function removeEntity(_0x3e319c,_0x82e313){return function(_0x379110){if(_0x379110){return _0x379110[_0xf54e('0x34')]()['then'](function(){var _0x54bea4=_0x379110['get']({'plain':!![]});var _0x3c0cca=_0xf54e('0x35');return db[_0xf54e('0x36')][_0xf54e('0x34')]({'where':{'type':_0x3c0cca,'resourceId':_0x54bea4['id']}})[_0xf54e('0x33')](function(){return _0x379110;});})[_0xf54e('0x33')](function(){_0x3e319c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x530cee,_0xc04e04){return function(_0x734187){if(!_0x734187){_0x530cee['sendStatus'](0x194);}return _0x734187;};}function handleError(_0x4d9b06,_0xda1d10){_0xda1d10=_0xda1d10||0x1f4;return function(_0x2c0d30){logger[_0xf54e('0x20')](_0x2c0d30['stack']);if(_0x2c0d30[_0xf54e('0x37')]){delete _0x2c0d30[_0xf54e('0x37')];}_0x4d9b06['status'](_0xda1d10)[_0xf54e('0x38')](_0x2c0d30);};}exports[_0xf54e('0x39')]=function(_0x5af03,_0x1eeeb4){var _0x12ef97={},_0x199056={},_0x4e00b7={'count':0x0,'rows':[]};var _0x5d45cf=_[_0xf54e('0x3a')](db[_0xf54e('0x3b')][_0xf54e('0x3c')],function(_0x4b1f84){return{'name':_0x4b1f84[_0xf54e('0x3d')],'type':_0x4b1f84[_0xf54e('0x3e')][_0xf54e('0x3f')]};});_0x199056[_0xf54e('0x40')]=_[_0xf54e('0x3a')](_0x5d45cf,_0xf54e('0x37'));_0x199056[_0xf54e('0x41')]=_[_0xf54e('0x42')](_0x5af03[_0xf54e('0x41')]);_0x199056[_0xf54e('0x43')]=_[_0xf54e('0x44')](_0x199056[_0xf54e('0x40')],_0x199056[_0xf54e('0x41')]);_0x12ef97[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x199056['model'],qs['fields'](_0x5af03['query'][_0xf54e('0x46')]));_0x12ef97[_0xf54e('0x45')]=_0x12ef97['attributes'][_0xf54e('0x47')]?_0x12ef97[_0xf54e('0x45')]:_0x199056[_0xf54e('0x40')];if(!_0x5af03['query'][_0xf54e('0x48')](_0xf54e('0x49'))){_0x12ef97[_0xf54e('0x2c')]=qs[_0xf54e('0x2c')](_0x5af03[_0xf54e('0x41')][_0xf54e('0x2c')]);_0x12ef97[_0xf54e('0x2b')]=qs[_0xf54e('0x2b')](_0x5af03[_0xf54e('0x41')]['offset']);}_0x12ef97[_0xf54e('0x4a')]=qs[_0xf54e('0x4b')](_0x5af03[_0xf54e('0x41')][_0xf54e('0x4b')]);_0x12ef97[_0xf54e('0x4c')]=qs[_0xf54e('0x43')](_['pick'](_0x5af03[_0xf54e('0x41')],_0x199056['filters']),_0x5d45cf);if(_0x5af03[_0xf54e('0x41')]['filter']){_0x12ef97[_0xf54e('0x4c')]=_[_0xf54e('0x4d')](_0x12ef97[_0xf54e('0x4c')],{'$or':_['map'](_0x5d45cf,function(_0x1af35d){if(_0x1af35d[_0xf54e('0x3e')]!==_0xf54e('0x4e')){var _0x32fb46={};_0x32fb46[_0x1af35d[_0xf54e('0x37')]]={'$like':'%'+_0x5af03['query'][_0xf54e('0x4f')]+'%'};return _0x32fb46;}})});}_0x12ef97=_[_0xf54e('0x4d')]({},_0x12ef97,_0x5af03[_0xf54e('0x50')]);var _0x45592b={'where':_0x12ef97['where']};return db[_0xf54e('0x3b')][_0xf54e('0x2a')](_0x45592b)['then'](function(_0x22c842){_0x4e00b7[_0xf54e('0x2a')]=_0x22c842;if(_0x5af03[_0xf54e('0x41')][_0xf54e('0x51')]){_0x12ef97['include']=[{'all':!![]}];}return db[_0xf54e('0x3b')][_0xf54e('0x52')](_0x12ef97);})[_0xf54e('0x33')](function(_0xb4654f){_0x4e00b7[_0xf54e('0x53')]=_0xb4654f;return _0x4e00b7;})[_0xf54e('0x33')](respondWithFilteredResult(_0x1eeeb4,_0x12ef97))[_0xf54e('0x24')](handleError(_0x1eeeb4,null));};exports[_0xf54e('0x54')]=function(_0x15bfef,_0x21f2f8){var _0xaf9bf0={'raw':![],'where':{'id':_0x15bfef[_0xf54e('0x55')]['id']}},_0x1f4cf8={};_0x1f4cf8[_0xf54e('0x40')]=_[_0xf54e('0x42')](db[_0xf54e('0x3b')][_0xf54e('0x3c')]);_0x1f4cf8[_0xf54e('0x41')]=_[_0xf54e('0x42')](_0x15bfef[_0xf54e('0x41')]);_0x1f4cf8['filters']=_['intersection'](_0x1f4cf8[_0xf54e('0x40')],_0x1f4cf8[_0xf54e('0x41')]);_0xaf9bf0[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x1f4cf8[_0xf54e('0x40')],qs[_0xf54e('0x46')](_0x15bfef[_0xf54e('0x41')][_0xf54e('0x46')]));_0xaf9bf0[_0xf54e('0x45')]=_0xaf9bf0[_0xf54e('0x45')][_0xf54e('0x47')]?_0xaf9bf0['attributes']:_0x1f4cf8[_0xf54e('0x40')];if(_0x15bfef[_0xf54e('0x41')][_0xf54e('0x51')]){_0xaf9bf0[_0xf54e('0x56')]=[{'all':!![]}];}_0xaf9bf0=_[_0xf54e('0x4d')]({},_0xaf9bf0,_0x15bfef[_0xf54e('0x50')]);return db[_0xf54e('0x3b')]['find'](_0xaf9bf0)[_0xf54e('0x33')](handleEntityNotFound(_0x21f2f8,null))[_0xf54e('0x33')](respondWithResult(_0x21f2f8,null))[_0xf54e('0x24')](handleError(_0x21f2f8,null));};exports['clone']=function(_0x3ce832,_0x54ac1a){var _0x465a0f={'where':{'id':_0x3ce832[_0xf54e('0x55')]['id']}},_0x400ee0={};_0x400ee0['model']=_[_0xf54e('0x42')](db[_0xf54e('0x3b')][_0xf54e('0x3c')]);_0x465a0f[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x400ee0[_0xf54e('0x40')],qs[_0xf54e('0x46')](_0x3ce832['query']['fields']));_0x465a0f[_0xf54e('0x45')]=_0x465a0f[_0xf54e('0x45')]['length']?_0x465a0f[_0xf54e('0x45')]:_0x400ee0['model'];if(_0x3ce832[_0xf54e('0x41')]['includeAll']){_0x465a0f[_0xf54e('0x56')]=[{'all':!![]}];}_0x465a0f=_[_0xf54e('0x4d')]({},_0x465a0f,_0x3ce832[_0xf54e('0x50')]);return db[_0xf54e('0x3b')][_0xf54e('0x57')](_0x465a0f)[_0xf54e('0x33')](handleEntityNotFound(_0x54ac1a,null))['then'](function(_0x479572){if(_0x479572){var _0x79345=_0x479572[_0xf54e('0x58')]({'plain':!![]});_0x79345=qs['omit'](_0x79345,['id','createdAt',_0xf54e('0x59')]);_0x3ce832['body']=_[_0xf54e('0x5a')](_0x3ce832[_0xf54e('0x5b')],['id',_0xf54e('0x5c'),_0xf54e('0x59')]);return db[_0xf54e('0x3b')][_0xf54e('0x5d')](_[_0xf54e('0x4d')](_0x79345,_0x3ce832[_0xf54e('0x5b')]),{'include':_0x3ce832[_0xf54e('0x41')][_0xf54e('0x51')]?[{'all':!![]}]:undefined})[_0xf54e('0x33')](function(_0x2c6d0e){var _0x65bdf2=_0x3ce832[_0xf54e('0x5e')]['get']({'plain':!![]});if(!_0x65bdf2)throw new Error(_0xf54e('0x5f'));if(_0x65bdf2[_0xf54e('0x60')]===_0xf54e('0x5e')){var _0x11908b=_0x2c6d0e[_0xf54e('0x58')]({'plain':!![]});var _0x494629=_0xf54e('0x35');return db[_0xf54e('0x61')]['find']({'where':{'name':_0x494629,'userProfileId':_0x65bdf2['userProfileId']},'raw':!![]})[_0xf54e('0x33')](function(_0x4b4a2f){if(_0x4b4a2f&&_0x4b4a2f[_0xf54e('0x62')]===0x0){return db[_0xf54e('0x36')][_0xf54e('0x5d')]({'name':_0x11908b[_0xf54e('0x37')],'resourceId':_0x11908b['id'],'type':_0x4b4a2f['name'],'sectionId':_0x4b4a2f['id']},{})[_0xf54e('0x33')](function(){return _0x2c6d0e;});}else{return _0x2c6d0e;}})['catch'](function(_0x3800d4){logger[_0xf54e('0x20')](_0xf54e('0x63'),_0x3800d4);throw _0x3800d4;});}return _0x2c6d0e;});}})['then'](respondWithResult(_0x54ac1a,0xc9))[_0xf54e('0x24')](handleError(_0x54ac1a,null));};exports['create']=function(_0x3f7224,_0x3e2101,_0x5500d7){var _0x380b4f;return db['Trunk'][_0xf54e('0x5d')](_0x3f7224[_0xf54e('0x5b')],{'raw':!![]})[_0xf54e('0x33')](function(_0x38405c){_0x380b4f=_0x38405c;return db[_0xf54e('0x3b')]['findAll']({'raw':!![]});})[_0xf54e('0x33')](function(_0x1d18d3){var _0x57db6f=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config['root'],_0xf54e('0x66')),_0xf54e('0x67'));var _0x309895=fs['readFileSync'](path[_0xf54e('0x65')](config['root'],_0xf54e('0x68')),_0xf54e('0x67'));var _0x5e45e7=ejs[_0xf54e('0x69')](_0x57db6f,{'trunks':_0x1d18d3||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6b'),_0x5e45e7);if(_0x380b4f[_0xf54e('0x6c')]){var _0x38bf71=ejs[_0xf54e('0x69')](_0x309895,{'trunks':_0x1d18d3||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x38bf71);}})[_0xf54e('0x33')](function(){return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x5d'),{'module':'chan_sip.so'});})[_0xf54e('0x33')](function(){var _0x2c20b5=_0x3f7224[_0xf54e('0x5e')]['get']({'plain':!![]});if(!_0x2c20b5)throw new Error(_0xf54e('0x5f'));if(_0x2c20b5[_0xf54e('0x60')]===_0xf54e('0x5e')){var _0x13db3e=_0x380b4f[_0xf54e('0x58')]({'plain':!![]});return db[_0xf54e('0x61')][_0xf54e('0x57')]({'where':{'name':'Trunks','userProfileId':_0x2c20b5[_0xf54e('0x6f')]},'raw':!![]})[_0xf54e('0x33')](function(_0x261c39){if(_0x261c39&&_0x261c39['autoAssociation']===0x0){return db[_0xf54e('0x36')][_0xf54e('0x5d')]({'name':_0x13db3e[_0xf54e('0x37')],'resourceId':_0x13db3e['id'],'type':_0x261c39[_0xf54e('0x37')],'sectionId':_0x261c39['id']},{})['then'](function(){return _0x380b4f;});}else{return _0x380b4f;}})['catch'](function(_0x25d05e){logger[_0xf54e('0x20')](_0xf54e('0x63'),_0x25d05e);throw _0x25d05e;});}return _0x380b4f;})[_0xf54e('0x33')](respondWithResult(_0x3e2101,0xc9))[_0xf54e('0x24')](handleError(_0x3e2101,null));};exports[_0xf54e('0x32')]=function(_0x35b5a4,_0x3b2a3e,_0xf5108b){var _0x205b47;return db['Trunk'][_0xf54e('0x57')]({'where':{'id':_0x35b5a4[_0xf54e('0x55')]['id']}})[_0xf54e('0x33')](handleEntityNotFound(_0x3b2a3e,null))[_0xf54e('0x33')](saveUpdates(_0x35b5a4['body'],null))[_0xf54e('0x33')](function(_0x1de6dd){if(_0x1de6dd){_0x205b47=_0x1de6dd;return db[_0xf54e('0x3b')][_0xf54e('0x52')]({'raw':!![]});}})['then'](function(_0x394862){if(_0x394862){var _0x4876b5=fs[_0xf54e('0x64')](path['join'](config['root'],_0xf54e('0x66')),_0xf54e('0x67'));var _0x1e2834=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config[_0xf54e('0x70')],_0xf54e('0x68')),_0xf54e('0x67'));var _0x8093bc=ejs['render'](_0x4876b5,{'trunks':_0x394862||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6b'),_0x8093bc);var _0x4ce10=ejs[_0xf54e('0x69')](_0x1e2834,{'trunks':_0x394862||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x4ce10);return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x32'),{'module':_0xf54e('0x71')});}return null;})[_0xf54e('0x33')](function(_0x11dec2){if(_0x11dec2){return _0x205b47;}})[_0xf54e('0x33')](respondWithResult(_0x3b2a3e,null))['catch'](handleError(_0x3b2a3e,null));};exports[_0xf54e('0x34')]=function(_0x1cfa09,_0x59acbc,_0x4a0614){var _0x85b108;return db[_0xf54e('0x3b')][_0xf54e('0x57')]({'where':{'id':_0x1cfa09[_0xf54e('0x55')]['id']}})[_0xf54e('0x33')](handleEntityNotFound(_0x59acbc,null))[_0xf54e('0x33')](removeEntity(_0x59acbc,null))[_0xf54e('0x33')](function(){return db[_0xf54e('0x3b')][_0xf54e('0x52')]({'raw':!![]});})['then'](function(_0x2bb31f){var _0x3c222a=fs[_0xf54e('0x64')](path['join'](config[_0xf54e('0x70')],'server/files/templates/trunk.ejs'),_0xf54e('0x67'));var _0x57bc6f=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config['root'],'server/files/templates/registry.ejs'),_0xf54e('0x67'));var _0x632240=ejs[_0xf54e('0x69')](_0x3c222a,{'trunks':_0x2bb31f});var _0x406261=ejs[_0xf54e('0x69')](_0x57bc6f,{'trunks':_0x2bb31f});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x632240);fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x406261);return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x34'),{'module':_0xf54e('0x71')});})[_0xf54e('0x24')](handleError(_0x59acbc,null));}; \ No newline at end of file +var _0x8ef6=['userProfileId','autoAssociation','UserProfileResource','readFileSync','join','root','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','utf8','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','update','destroy','Trunks','stack','name','send','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','options','Trunk','includeAll','include','findAll','rows','show','params','rawAttributes','merge','find','catch','clone','omit','createdAt','updatedAt','create','body','get','role','UserProfileSection'];(function(_0x1107f1,_0x112a19){var _0x5dae0e=function(_0x5b85c6){while(--_0x5b85c6){_0x1107f1['push'](_0x1107f1['shift']());}};_0x5dae0e(++_0x112a19);}(_0x8ef6,0xf2));var _0x68ef=function(_0x16326e,_0x1ac2ff){_0x16326e=_0x16326e-0x0;var _0x2c6066=_0x8ef6[_0x16326e];return _0x2c6066;};'use strict';var emlformat=require(_0x68ef('0x0'));var rimraf=require(_0x68ef('0x1'));var zipdir=require(_0x68ef('0x2'));var jsonpatch=require(_0x68ef('0x3'));var rp=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var BPromise=require(_0x68ef('0x6'));var Mustache=require('mustache');var util=require(_0x68ef('0x7'));var path=require(_0x68ef('0x8'));var sox=require(_0x68ef('0x9'));var csv=require(_0x68ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xa'));var querystring=require(_0x68ef('0xf'));var Papa=require(_0x68ef('0x10'));var Redis=require(_0x68ef('0x11'));var authService=require(_0x68ef('0x12'));var qs=require(_0x68ef('0x13'));var as=require(_0x68ef('0x14'));var hardwareService=require(_0x68ef('0x15'));var logger=require(_0x68ef('0x16'))(_0x68ef('0x17'));var utils=require(_0x68ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x19'));var db=require(_0x68ef('0x1a'))['db'];var jayson=require(_0x68ef('0x1b'));var client=jayson[_0x68ef('0x1c')][_0x68ef('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x288cc9,_0x508671,_0x3b48dd,_0xc50cce){return new BPromise(function(_0x2657c5,_0x47fbb5){var _0x22fe96=_0xc50cce||client;return _0x22fe96[_0x68ef('0x1e')](_0x288cc9,_0x3b48dd)[_0x68ef('0x1f')](function(_0x5005ba){logger[_0x68ef('0x20')](_0x68ef('0x21'),_0x508671,_0x68ef('0x22'));logger[_0x68ef('0x23')]('Trunk,\x20%s,\x20%s,\x20%s',_0x508671,_0x68ef('0x22'),JSON['stringify'](_0x5005ba));if(_0x5005ba['error']){if(_0x5005ba[_0x68ef('0x24')][_0x68ef('0x25')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x508671,_0x5005ba[_0x68ef('0x24')][_0x68ef('0x26')]);return _0x47fbb5(_0x5005ba[_0x68ef('0x24')]['message']);}logger[_0x68ef('0x24')](_0x68ef('0x21'),_0x508671,_0x5005ba[_0x68ef('0x24')]['message']);return _0x2657c5(_0x5005ba[_0x68ef('0x24')][_0x68ef('0x26')]);}else{logger['info'](_0x68ef('0x21'),_0x508671,_0x68ef('0x22'));_0x2657c5(_0x5005ba[_0x68ef('0x27')]['message']);}})['catch'](function(_0x59bebc){logger[_0x68ef('0x24')](_0x68ef('0x21'),_0x508671,_0x59bebc);_0x47fbb5(_0x59bebc);});});}function respondWithStatusCode(_0x312cc9,_0x2e6e39){_0x2e6e39=_0x2e6e39||0xcc;return function(_0x438b4c){if(_0x438b4c){return _0x312cc9[_0x68ef('0x28')](_0x2e6e39);}return _0x312cc9[_0x68ef('0x29')](_0x2e6e39)[_0x68ef('0x2a')]();};}function respondWithResult(_0x65fd09,_0x13280b){_0x13280b=_0x13280b||0xc8;return function(_0x5e4dbe){if(_0x5e4dbe){return _0x65fd09[_0x68ef('0x29')](_0x13280b)['json'](_0x5e4dbe);}};}function respondWithFilteredResult(_0x599243,_0x55d8b0){return function(_0x1a7ce1){if(_0x1a7ce1){var _0x268f32=typeof _0x55d8b0[_0x68ef('0x2b')]===_0x68ef('0x2c')&&typeof _0x55d8b0['limit']==='undefined';var _0x1cbe4f=_0x1a7ce1[_0x68ef('0x2d')];var _0x7bf96=_0x268f32?0x0:_0x55d8b0[_0x68ef('0x2b')];var _0x22ef25=_0x268f32?_0x1a7ce1[_0x68ef('0x2d')]:_0x55d8b0[_0x68ef('0x2b')]+_0x55d8b0[_0x68ef('0x2e')];var _0x5a6dfd;if(_0x22ef25>=_0x1cbe4f){_0x22ef25=_0x1cbe4f;_0x5a6dfd=0xc8;}else{_0x5a6dfd=0xce;}_0x599243[_0x68ef('0x29')](_0x5a6dfd);return _0x599243[_0x68ef('0x2f')](_0x68ef('0x30'),_0x7bf96+'-'+_0x22ef25+'/'+_0x1cbe4f)['json'](_0x1a7ce1);}return null;};}function patchUpdates(_0x370a8f){return function(_0x523120){try{jsonpatch[_0x68ef('0x31')](_0x523120,_0x370a8f,!![]);}catch(_0x17588a){return BPromise['reject'](_0x17588a);}return _0x523120['save']();};}function saveUpdates(_0x159395,_0x5fa72a){return function(_0x4b8fc8){if(_0x4b8fc8){return _0x4b8fc8[_0x68ef('0x32')](_0x159395)[_0x68ef('0x1f')](function(_0x2d67be){return _0x2d67be;});}return null;};}function removeEntity(_0x2d1e9f,_0x59e9fb){return function(_0x2c8bd0){if(_0x2c8bd0){return _0x2c8bd0[_0x68ef('0x33')]()['then'](function(){var _0x2f8de2=_0x2c8bd0['get']({'plain':!![]});var _0x14581d=_0x68ef('0x34');return db['UserProfileResource'][_0x68ef('0x33')]({'where':{'type':_0x14581d,'resourceId':_0x2f8de2['id']}})['then'](function(){return _0x2c8bd0;});})[_0x68ef('0x1f')](function(){_0x2d1e9f['status'](0xcc)[_0x68ef('0x2a')]();});}};}function handleEntityNotFound(_0x1444e0,_0x798276){return function(_0x569949){if(!_0x569949){_0x1444e0[_0x68ef('0x28')](0x194);}return _0x569949;};}function handleError(_0x485dc3,_0x476938){_0x476938=_0x476938||0x1f4;return function(_0x4c9506){logger[_0x68ef('0x24')](_0x4c9506[_0x68ef('0x35')]);if(_0x4c9506[_0x68ef('0x36')]){delete _0x4c9506[_0x68ef('0x36')];}_0x485dc3[_0x68ef('0x29')](_0x476938)[_0x68ef('0x37')](_0x4c9506);};}exports['index']=function(_0x294fba,_0x15a6ab){var _0x32074a={},_0x52a8b9={},_0x32eddd={'count':0x0,'rows':[]};var _0x3c5de6=_[_0x68ef('0x38')](db['Trunk']['rawAttributes'],function(_0x14f0fc){return{'name':_0x14f0fc[_0x68ef('0x39')],'type':_0x14f0fc[_0x68ef('0x3a')][_0x68ef('0x3b')]};});_0x52a8b9[_0x68ef('0x3c')]=_[_0x68ef('0x38')](_0x3c5de6,_0x68ef('0x36'));_0x52a8b9['query']=_[_0x68ef('0x3d')](_0x294fba[_0x68ef('0x3e')]);_0x52a8b9[_0x68ef('0x3f')]=_[_0x68ef('0x40')](_0x52a8b9['model'],_0x52a8b9[_0x68ef('0x3e')]);_0x32074a[_0x68ef('0x41')]=_[_0x68ef('0x40')](_0x52a8b9[_0x68ef('0x3c')],qs[_0x68ef('0x42')](_0x294fba[_0x68ef('0x3e')]['fields']));_0x32074a[_0x68ef('0x41')]=_0x32074a[_0x68ef('0x41')][_0x68ef('0x43')]?_0x32074a[_0x68ef('0x41')]:_0x52a8b9[_0x68ef('0x3c')];if(!_0x294fba[_0x68ef('0x3e')][_0x68ef('0x44')](_0x68ef('0x45'))){_0x32074a[_0x68ef('0x2e')]=qs['limit'](_0x294fba[_0x68ef('0x3e')][_0x68ef('0x2e')]);_0x32074a[_0x68ef('0x2b')]=qs[_0x68ef('0x2b')](_0x294fba[_0x68ef('0x3e')][_0x68ef('0x2b')]);}_0x32074a[_0x68ef('0x46')]=qs['sort'](_0x294fba[_0x68ef('0x3e')]['sort']);_0x32074a[_0x68ef('0x47')]=qs[_0x68ef('0x3f')](_[_0x68ef('0x48')](_0x294fba[_0x68ef('0x3e')],_0x52a8b9['filters']),_0x3c5de6);if(_0x294fba[_0x68ef('0x3e')]['filter']){_0x32074a[_0x68ef('0x47')]=_['merge'](_0x32074a[_0x68ef('0x47')],{'$or':_[_0x68ef('0x38')](_0x3c5de6,function(_0x105e8c){if(_0x105e8c['type']!=='VIRTUAL'){var _0x4044d5={};_0x4044d5[_0x105e8c[_0x68ef('0x36')]]={'$like':'%'+_0x294fba['query']['filter']+'%'};return _0x4044d5;}})});}_0x32074a=_['merge']({},_0x32074a,_0x294fba[_0x68ef('0x49')]);var _0x15c753={'where':_0x32074a[_0x68ef('0x47')]};return db[_0x68ef('0x4a')][_0x68ef('0x2d')](_0x15c753)['then'](function(_0x55f385){_0x32eddd[_0x68ef('0x2d')]=_0x55f385;if(_0x294fba[_0x68ef('0x3e')][_0x68ef('0x4b')]){_0x32074a[_0x68ef('0x4c')]=[{'all':!![]}];}return db['Trunk'][_0x68ef('0x4d')](_0x32074a);})[_0x68ef('0x1f')](function(_0x1c9b6f){_0x32eddd[_0x68ef('0x4e')]=_0x1c9b6f;return _0x32eddd;})['then'](respondWithFilteredResult(_0x15a6ab,_0x32074a))['catch'](handleError(_0x15a6ab,null));};exports[_0x68ef('0x4f')]=function(_0x3c3074,_0x566e7c){var _0xfc7a74={'raw':![],'where':{'id':_0x3c3074[_0x68ef('0x50')]['id']}},_0x12fff3={};_0x12fff3[_0x68ef('0x3c')]=_[_0x68ef('0x3d')](db['Trunk'][_0x68ef('0x51')]);_0x12fff3[_0x68ef('0x3e')]=_[_0x68ef('0x3d')](_0x3c3074['query']);_0x12fff3[_0x68ef('0x3f')]=_[_0x68ef('0x40')](_0x12fff3[_0x68ef('0x3c')],_0x12fff3['query']);_0xfc7a74[_0x68ef('0x41')]=_['intersection'](_0x12fff3['model'],qs[_0x68ef('0x42')](_0x3c3074['query'][_0x68ef('0x42')]));_0xfc7a74[_0x68ef('0x41')]=_0xfc7a74[_0x68ef('0x41')][_0x68ef('0x43')]?_0xfc7a74[_0x68ef('0x41')]:_0x12fff3[_0x68ef('0x3c')];if(_0x3c3074[_0x68ef('0x3e')][_0x68ef('0x4b')]){_0xfc7a74[_0x68ef('0x4c')]=[{'all':!![]}];}_0xfc7a74=_[_0x68ef('0x52')]({},_0xfc7a74,_0x3c3074['options']);return db['Trunk'][_0x68ef('0x53')](_0xfc7a74)[_0x68ef('0x1f')](handleEntityNotFound(_0x566e7c,null))[_0x68ef('0x1f')](respondWithResult(_0x566e7c,null))[_0x68ef('0x54')](handleError(_0x566e7c,null));};exports[_0x68ef('0x55')]=function(_0x1d11d7,_0x15400c){var _0x300a64={'where':{'id':_0x1d11d7['params']['id']}},_0x40c784={};_0x40c784['model']=_[_0x68ef('0x3d')](db['Trunk'][_0x68ef('0x51')]);_0x300a64['attributes']=_[_0x68ef('0x40')](_0x40c784[_0x68ef('0x3c')],qs['fields'](_0x1d11d7[_0x68ef('0x3e')]['fields']));_0x300a64[_0x68ef('0x41')]=_0x300a64[_0x68ef('0x41')][_0x68ef('0x43')]?_0x300a64[_0x68ef('0x41')]:_0x40c784[_0x68ef('0x3c')];if(_0x1d11d7[_0x68ef('0x3e')]['includeAll']){_0x300a64[_0x68ef('0x4c')]=[{'all':!![]}];}_0x300a64=_[_0x68ef('0x52')]({},_0x300a64,_0x1d11d7[_0x68ef('0x49')]);return db[_0x68ef('0x4a')][_0x68ef('0x53')](_0x300a64)[_0x68ef('0x1f')](handleEntityNotFound(_0x15400c,null))['then'](function(_0x9a978f){if(_0x9a978f){var _0x42d2a3=_0x9a978f['get']({'plain':!![]});_0x42d2a3=qs[_0x68ef('0x56')](_0x42d2a3,['id',_0x68ef('0x57'),_0x68ef('0x58')]);_0x1d11d7['body']=_[_0x68ef('0x56')](_0x1d11d7['body'],['id','createdAt',_0x68ef('0x58')]);return db['Trunk'][_0x68ef('0x59')](_['merge'](_0x42d2a3,_0x1d11d7[_0x68ef('0x5a')]),{'include':_0x1d11d7[_0x68ef('0x3e')][_0x68ef('0x4b')]?[{'all':!![]}]:undefined})[_0x68ef('0x1f')](function(_0x19ce17){var _0x19a9c4=_0x1d11d7['user'][_0x68ef('0x5b')]({'plain':!![]});if(!_0x19a9c4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19a9c4[_0x68ef('0x5c')]==='user'){var _0x2f97c5=_0x19ce17[_0x68ef('0x5b')]({'plain':!![]});var _0x212ec4=_0x68ef('0x34');return db[_0x68ef('0x5d')][_0x68ef('0x53')]({'where':{'name':_0x212ec4,'userProfileId':_0x19a9c4[_0x68ef('0x5e')]},'raw':!![]})['then'](function(_0x3ea4e7){if(_0x3ea4e7&&_0x3ea4e7[_0x68ef('0x5f')]===0x0){return db[_0x68ef('0x60')][_0x68ef('0x59')]({'name':_0x2f97c5[_0x68ef('0x36')],'resourceId':_0x2f97c5['id'],'type':_0x3ea4e7['name'],'sectionId':_0x3ea4e7['id']},{})[_0x68ef('0x1f')](function(){return _0x19ce17;});}else{return _0x19ce17;}})['catch'](function(_0x1ed172){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ed172);throw _0x1ed172;});}return _0x19ce17;});}})[_0x68ef('0x1f')](respondWithResult(_0x15400c,0xc9))[_0x68ef('0x54')](handleError(_0x15400c,null));};exports[_0x68ef('0x59')]=function(_0x21b2ce,_0x51f905,_0x124b49){var _0x570e0c;return db[_0x68ef('0x4a')][_0x68ef('0x59')](_0x21b2ce[_0x68ef('0x5a')],{'raw':!![]})['then'](function(_0x541e35){_0x570e0c=_0x541e35;return db[_0x68ef('0x4a')][_0x68ef('0x4d')]({'raw':!![]});})[_0x68ef('0x1f')](function(_0x454c6f){var _0x5b41e1=fs[_0x68ef('0x61')](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x64')),'utf8');var _0x3f56a7=fs['readFileSync'](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x65')),_0x68ef('0x66'));var _0xed16d1=ejs['render'](_0x5b41e1,{'trunks':_0x454c6f||[]});fs[_0x68ef('0x67')](_0x68ef('0x68'),_0xed16d1);if(_0x570e0c[_0x68ef('0x69')]){var _0x595e79=ejs[_0x68ef('0x6a')](_0x3f56a7,{'trunks':_0x454c6f||[]});fs['writeFileSync'](_0x68ef('0x6b'),_0x595e79);}})['then'](function(){return respondWithRpcPromise('Reload',_0x68ef('0x59'),{'module':_0x68ef('0x6c')});})[_0x68ef('0x1f')](function(){var _0x405971=_0x21b2ce['user'][_0x68ef('0x5b')]({'plain':!![]});if(!_0x405971)throw new Error(_0x68ef('0x6d'));if(_0x405971[_0x68ef('0x5c')]==='user'){var _0x3e14a4=_0x570e0c[_0x68ef('0x5b')]({'plain':!![]});return db[_0x68ef('0x5d')][_0x68ef('0x53')]({'where':{'name':_0x68ef('0x34'),'userProfileId':_0x405971[_0x68ef('0x5e')]},'raw':!![]})[_0x68ef('0x1f')](function(_0xfe72dc){if(_0xfe72dc&&_0xfe72dc[_0x68ef('0x5f')]===0x0){return db[_0x68ef('0x60')][_0x68ef('0x59')]({'name':_0x3e14a4[_0x68ef('0x36')],'resourceId':_0x3e14a4['id'],'type':_0xfe72dc['name'],'sectionId':_0xfe72dc['id']},{})[_0x68ef('0x1f')](function(){return _0x570e0c;});}else{return _0x570e0c;}})[_0x68ef('0x54')](function(_0x5db443){logger['error'](_0x68ef('0x6e'),_0x5db443);throw _0x5db443;});}return _0x570e0c;})['then'](respondWithResult(_0x51f905,0xc9))[_0x68ef('0x54')](handleError(_0x51f905,null));};exports[_0x68ef('0x32')]=function(_0x5f1b12,_0x4e0874,_0x31a336){var _0x5c500c;return db[_0x68ef('0x4a')]['find']({'where':{'id':_0x5f1b12[_0x68ef('0x50')]['id']}})['then'](handleEntityNotFound(_0x4e0874,null))[_0x68ef('0x1f')](saveUpdates(_0x5f1b12[_0x68ef('0x5a')],null))['then'](function(_0x3c5e35){if(_0x3c5e35){_0x5c500c=_0x3c5e35;return db[_0x68ef('0x4a')][_0x68ef('0x4d')]({'raw':!![]});}})[_0x68ef('0x1f')](function(_0x50c308){if(_0x50c308){var _0x2bebdc=fs[_0x68ef('0x61')](path['join'](config[_0x68ef('0x63')],_0x68ef('0x64')),_0x68ef('0x66'));var _0x4de1d1=fs[_0x68ef('0x61')](path['join'](config[_0x68ef('0x63')],_0x68ef('0x65')),'utf8');var _0x4b0fb4=ejs['render'](_0x2bebdc,{'trunks':_0x50c308||[]});fs['writeFileSync'](_0x68ef('0x68'),_0x4b0fb4);var _0x28ad22=ejs[_0x68ef('0x6a')](_0x4de1d1,{'trunks':_0x50c308||[]});fs[_0x68ef('0x67')](_0x68ef('0x6b'),_0x28ad22);return respondWithRpcPromise(_0x68ef('0x6f'),_0x68ef('0x32'),{'module':_0x68ef('0x6c')});}return null;})[_0x68ef('0x1f')](function(_0x3ae3e9){if(_0x3ae3e9){return _0x5c500c;}})[_0x68ef('0x1f')](respondWithResult(_0x4e0874,null))[_0x68ef('0x54')](handleError(_0x4e0874,null));};exports[_0x68ef('0x33')]=function(_0x4bd5c3,_0x2b20dc,_0x556dfc){var _0x791181;return db['Trunk']['find']({'where':{'id':_0x4bd5c3[_0x68ef('0x50')]['id']}})[_0x68ef('0x1f')](handleEntityNotFound(_0x2b20dc,null))[_0x68ef('0x1f')](removeEntity(_0x2b20dc,null))[_0x68ef('0x1f')](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0x68ef('0x1f')](function(_0x308997){var _0x1f1dfd=fs['readFileSync'](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x64')),_0x68ef('0x66'));var _0x4dc885=fs[_0x68ef('0x61')](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x65')),_0x68ef('0x66'));var _0x346049=ejs['render'](_0x1f1dfd,{'trunks':_0x308997});var _0x2a72e8=ejs['render'](_0x4dc885,{'trunks':_0x308997});fs[_0x68ef('0x67')](_0x68ef('0x68'),_0x346049);fs[_0x68ef('0x67')](_0x68ef('0x6b'),_0x2a72e8);return respondWithRpcPromise('Reload',_0x68ef('0x33'),{'module':'chan_sip.so'});})[_0x68ef('0x54')](handleError(_0x2b20dc,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index efba2df..601c3fd 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 _0xd3bc=['../../config/environment','./trunk.attributes','define','Trunk','tools_trunks','api','bluebird','request-promise','path'];(function(_0x34d993,_0x3c7017){var _0x4728c7=function(_0x12f5ca){while(--_0x12f5ca){_0x34d993['push'](_0x34d993['shift']());}};_0x4728c7(++_0x3c7017);}(_0xd3bc,0x176));var _0xcd3b=function(_0x12accd,_0x41c86c){_0x12accd=_0x12accd-0x0;var _0xa187f2=_0xd3bc[_0x12accd];return _0xa187f2;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xcd3b('0x0'));var moment=require('moment');var BPromise=require(_0xcd3b('0x1'));var rp=require(_0xcd3b('0x2'));var fs=require('fs');var path=require(_0xcd3b('0x3'));var rimraf=require('rimraf');var config=require(_0xcd3b('0x4'));var attributes=require(_0xcd3b('0x5'));module['exports']=function(_0x1a4322,_0x41674b){return _0x1a4322[_0xcd3b('0x6')](_0xcd3b('0x7'),attributes,{'tableName':_0xcd3b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e14=['api','moment','request-promise','path','../../config/environment','./trunk.attributes','exports','define','Trunk','lodash'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x6e14,0x1a3));var _0x46e1=function(_0x462d4b,_0x597689){_0x462d4b=_0x462d4b-0x0;var _0x606afe=_0x6e14[_0x462d4b];return _0x606afe;};'use strict';var _=require(_0x46e1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x46e1('0x1'));var moment=require(_0x46e1('0x2'));var BPromise=require('bluebird');var rp=require(_0x46e1('0x3'));var fs=require('fs');var path=require(_0x46e1('0x4'));var rimraf=require('rimraf');var config=require(_0x46e1('0x5'));var attributes=require(_0x46e1('0x6'));module[_0x46e1('0x7')]=function(_0x2ec55b,_0x28f9e5){return _0x2ec55b[_0x46e1('0x8')](_0x46e1('0x9'),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 d70ad2a..b37ab6c 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 _0xcf75=['rpc','../../config/environment','jayson/promise','http','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','stringify','find','ShowTrunk','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x3deb78,_0x5b8496){var _0x4d9808=function(_0x4fa8eb){while(--_0x4fa8eb){_0x3deb78['push'](_0x3deb78['shift']());}};_0x4d9808(++_0x5b8496);}(_0xcf75,0x83));var _0x5cf7=function(_0x40599f,_0x5cfb5a){_0x40599f=_0x40599f-0x0;var _0x2bcc4e=_0xcf75[_0x40599f];return _0x2bcc4e;};'use strict';var _=require('lodash');var util=require(_0x5cf7('0x0'));var moment=require(_0x5cf7('0x1'));var BPromise=require(_0x5cf7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5cf7('0x3'))['db'];var utils=require(_0x5cf7('0x4'));var logger=require('../../config/logger')(_0x5cf7('0x5'));var config=require(_0x5cf7('0x6'));var jayson=require(_0x5cf7('0x7'));var client=jayson['client'][_0x5cf7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa33b7a,_0x4ab7fe,_0x1df33e){return new BPromise(function(_0x38d9fd,_0xf9849e){return client['request'](_0xa33b7a,_0x1df33e)[_0x5cf7('0x9')](function(_0xfcbce0){logger[_0x5cf7('0xa')](_0x5cf7('0xb'),_0x4ab7fe,'request\x20sent');logger[_0x5cf7('0xc')](_0x5cf7('0xd'),_0x4ab7fe,_0x5cf7('0xe'),JSON['stringify'](_0xfcbce0));if(_0xfcbce0[_0x5cf7('0xf')]){if(_0xfcbce0[_0x5cf7('0xf')][_0x5cf7('0x10')]===0x1f4){logger[_0x5cf7('0xf')](_0x5cf7('0xb'),_0x4ab7fe,_0xfcbce0[_0x5cf7('0xf')][_0x5cf7('0x11')]);return _0xf9849e(_0xfcbce0['error'][_0x5cf7('0x11')]);}logger['error'](_0x5cf7('0xb'),_0x4ab7fe,_0xfcbce0[_0x5cf7('0xf')]['message']);return _0x38d9fd(_0xfcbce0[_0x5cf7('0xf')][_0x5cf7('0x11')]);}else{logger[_0x5cf7('0xa')]('Trunk,\x20%s,\x20%s',_0x4ab7fe,_0x5cf7('0xe'));_0x38d9fd(_0xfcbce0[_0x5cf7('0x12')][_0x5cf7('0x11')]);}})[_0x5cf7('0x13')](function(_0x43d644){logger[_0x5cf7('0xf')](_0x5cf7('0xb'),_0x4ab7fe,_0x43d644);_0xf9849e(_0x43d644);});});}exports[_0x5cf7('0x14')]=function(_0x1b374e){var _0x12b88b=this;return new Promise(function(_0x411164,_0x4dd63c){return db[_0x5cf7('0x15')][_0x5cf7('0x16')]({'raw':_0x1b374e['options']?_0x1b374e[_0x5cf7('0x17')][_0x5cf7('0x18')]===undefined?!![]:![]:!![],'where':_0x1b374e[_0x5cf7('0x17')]?_0x1b374e[_0x5cf7('0x17')][_0x5cf7('0x19')]||null:null,'attributes':_0x1b374e['options']?_0x1b374e[_0x5cf7('0x17')][_0x5cf7('0x1a')]||null:null,'limit':_0x1b374e[_0x5cf7('0x17')]?_0x1b374e[_0x5cf7('0x17')][_0x5cf7('0x1b')]||null:null,'include':_0x1b374e['options']?_0x1b374e[_0x5cf7('0x17')][_0x5cf7('0x1c')]?_[_0x5cf7('0x1d')](_0x1b374e['options'][_0x5cf7('0x1c')],function(_0x1e16a6){return{'model':db[_0x1e16a6[_0x5cf7('0x1e')]],'as':_0x1e16a6['as'],'attributes':_0x1e16a6[_0x5cf7('0x1a')],'include':_0x1e16a6[_0x5cf7('0x1c')]?_[_0x5cf7('0x1d')](_0x1e16a6['include'],function(_0x3ba3aa){return{'model':db[_0x3ba3aa[_0x5cf7('0x1e')]],'as':_0x3ba3aa['as'],'attributes':_0x3ba3aa[_0x5cf7('0x1a')],'include':_0x3ba3aa[_0x5cf7('0x1c')]?_[_0x5cf7('0x1d')](_0x3ba3aa[_0x5cf7('0x1c')],function(_0x3fec44){return{'model':db[_0x3fec44['model']],'as':_0x3fec44['as'],'attributes':_0x3fec44[_0x5cf7('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5cf7('0x9')](function(_0x556103){logger[_0x5cf7('0xa')]('GetTrunk',_0x1b374e);logger['debug'](_0x5cf7('0x14'),_0x1b374e,JSON[_0x5cf7('0x1f')](_0x556103));_0x411164(_0x556103);})[_0x5cf7('0x13')](function(_0x49de18){logger[_0x5cf7('0xf')]('GetTrunk',_0x49de18[_0x5cf7('0x11')],_0x1b374e);_0x4dd63c(_0x12b88b[_0x5cf7('0xf')](0x1f4,_0x49de18['message']));});});};exports['ShowTrunk']=function(_0x268d68){var _0x54b8bc=this;return new Promise(function(_0x5c33e0,_0x24ccf1){return db[_0x5cf7('0x15')][_0x5cf7('0x20')]({'raw':_0x268d68[_0x5cf7('0x17')]?_0x268d68[_0x5cf7('0x17')][_0x5cf7('0x18')]===undefined?!![]:![]:!![],'where':_0x268d68[_0x5cf7('0x17')]?_0x268d68[_0x5cf7('0x17')][_0x5cf7('0x19')]||null:null,'attributes':_0x268d68[_0x5cf7('0x17')]?_0x268d68[_0x5cf7('0x17')][_0x5cf7('0x1a')]||null:null,'include':_0x268d68[_0x5cf7('0x17')]?_0x268d68['options'][_0x5cf7('0x1c')]?_[_0x5cf7('0x1d')](_0x268d68[_0x5cf7('0x17')][_0x5cf7('0x1c')],function(_0x3228b4){return{'model':db[_0x3228b4['model']],'as':_0x3228b4['as'],'attributes':_0x3228b4['attributes'],'include':_0x3228b4[_0x5cf7('0x1c')]?_['map'](_0x3228b4[_0x5cf7('0x1c')],function(_0x238c70){return{'model':db[_0x238c70['model']],'as':_0x238c70['as'],'attributes':_0x238c70[_0x5cf7('0x1a')],'include':_0x238c70[_0x5cf7('0x1c')]?_[_0x5cf7('0x1d')](_0x238c70[_0x5cf7('0x1c')],function(_0x3be6cc){return{'model':db[_0x3be6cc[_0x5cf7('0x1e')]],'as':_0x3be6cc['as'],'attributes':_0x3be6cc[_0x5cf7('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5cf7('0x9')](function(_0x44fb56){logger[_0x5cf7('0xa')]('ShowTrunk',_0x268d68);logger[_0x5cf7('0xc')](_0x5cf7('0x21'),_0x268d68,JSON[_0x5cf7('0x1f')](_0x44fb56));_0x5c33e0(_0x44fb56);})['catch'](function(_0xc27f6){logger[_0x5cf7('0xf')]('ShowTrunk',_0xc27f6[_0x5cf7('0x11')],_0x268d68);_0x24ccf1(_0x54b8bc[_0x5cf7('0xf')](0x1f4,_0xc27f6[_0x5cf7('0x11')]));});});}; \ No newline at end of file +var _0x6a99=['bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','http','request','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','code','error','Trunk,\x20%s,\x20%s','message','info','result','catch','GetTrunk','Trunk','options','where','attributes','limit','include','model','map','then','ShowTrunk','find','raw','lodash','util'];(function(_0x25aaec,_0x159e5b){var _0x293c2f=function(_0x3cd42a){while(--_0x3cd42a){_0x25aaec['push'](_0x25aaec['shift']());}};_0x293c2f(++_0x159e5b);}(_0x6a99,0x148));var _0x96a9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6a99[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x96a9('0x0'));var util=require(_0x96a9('0x1'));var moment=require('moment');var BPromise=require(_0x96a9('0x2'));var rs=require(_0x96a9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x96a9('0x4'));var logger=require(_0x96a9('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x96a9('0x6'));var client=jayson['client'][_0x96a9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4b7fbf,_0x473d2d,_0xe271d5){return new BPromise(function(_0x394893,_0x4e0caf){return client[_0x96a9('0x8')](_0x4b7fbf,_0xe271d5)['then'](function(_0x5bf927){logger['info']('Trunk,\x20%s,\x20%s',_0x473d2d,_0x96a9('0x9'));logger[_0x96a9('0xa')](_0x96a9('0xb'),_0x473d2d,'request\x20sent',JSON[_0x96a9('0xc')](_0x5bf927));if(_0x5bf927['error']){if(_0x5bf927['error'][_0x96a9('0xd')]===0x1f4){logger[_0x96a9('0xe')](_0x96a9('0xf'),_0x473d2d,_0x5bf927[_0x96a9('0xe')]['message']);return _0x4e0caf(_0x5bf927[_0x96a9('0xe')][_0x96a9('0x10')]);}logger['error'](_0x96a9('0xf'),_0x473d2d,_0x5bf927[_0x96a9('0xe')][_0x96a9('0x10')]);return _0x394893(_0x5bf927['error']['message']);}else{logger[_0x96a9('0x11')]('Trunk,\x20%s,\x20%s',_0x473d2d,'request\x20sent');_0x394893(_0x5bf927[_0x96a9('0x12')]['message']);}})[_0x96a9('0x13')](function(_0x29b778){logger[_0x96a9('0xe')](_0x96a9('0xf'),_0x473d2d,_0x29b778);_0x4e0caf(_0x29b778);});});}exports[_0x96a9('0x14')]=function(_0x1a7ac6){var _0x28bc59=this;return new Promise(function(_0x11af03,_0x36d1e2){return db[_0x96a9('0x15')]['findAll']({'raw':_0x1a7ac6[_0x96a9('0x16')]?_0x1a7ac6[_0x96a9('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1a7ac6[_0x96a9('0x16')]?_0x1a7ac6['options'][_0x96a9('0x17')]||null:null,'attributes':_0x1a7ac6[_0x96a9('0x16')]?_0x1a7ac6[_0x96a9('0x16')][_0x96a9('0x18')]||null:null,'limit':_0x1a7ac6[_0x96a9('0x16')]?_0x1a7ac6[_0x96a9('0x16')][_0x96a9('0x19')]||null:null,'include':_0x1a7ac6[_0x96a9('0x16')]?_0x1a7ac6['options'][_0x96a9('0x1a')]?_['map'](_0x1a7ac6[_0x96a9('0x16')][_0x96a9('0x1a')],function(_0x1c462b){return{'model':db[_0x1c462b[_0x96a9('0x1b')]],'as':_0x1c462b['as'],'attributes':_0x1c462b[_0x96a9('0x18')],'include':_0x1c462b[_0x96a9('0x1a')]?_['map'](_0x1c462b[_0x96a9('0x1a')],function(_0xf09e76){return{'model':db[_0xf09e76[_0x96a9('0x1b')]],'as':_0xf09e76['as'],'attributes':_0xf09e76[_0x96a9('0x18')],'include':_0xf09e76['include']?_[_0x96a9('0x1c')](_0xf09e76['include'],function(_0x42a0a0){return{'model':db[_0x42a0a0[_0x96a9('0x1b')]],'as':_0x42a0a0['as'],'attributes':_0x42a0a0[_0x96a9('0x18')]};}):[]};}):[]};}):[]:[]})[_0x96a9('0x1d')](function(_0x5a3659){logger['info'](_0x96a9('0x14'),_0x1a7ac6);logger[_0x96a9('0xa')](_0x96a9('0x14'),_0x1a7ac6,JSON[_0x96a9('0xc')](_0x5a3659));_0x11af03(_0x5a3659);})['catch'](function(_0x120b79){logger[_0x96a9('0xe')](_0x96a9('0x14'),_0x120b79[_0x96a9('0x10')],_0x1a7ac6);_0x36d1e2(_0x28bc59['error'](0x1f4,_0x120b79['message']));});});};exports[_0x96a9('0x1e')]=function(_0x210c82){var _0x3b977f=this;return new Promise(function(_0x2b8ac3,_0x2afe37){return db[_0x96a9('0x15')][_0x96a9('0x1f')]({'raw':_0x210c82[_0x96a9('0x16')]?_0x210c82['options'][_0x96a9('0x20')]===undefined?!![]:![]:!![],'where':_0x210c82[_0x96a9('0x16')]?_0x210c82[_0x96a9('0x16')][_0x96a9('0x17')]||null:null,'attributes':_0x210c82[_0x96a9('0x16')]?_0x210c82[_0x96a9('0x16')][_0x96a9('0x18')]||null:null,'include':_0x210c82['options']?_0x210c82['options'][_0x96a9('0x1a')]?_[_0x96a9('0x1c')](_0x210c82[_0x96a9('0x16')]['include'],function(_0x1c0319){return{'model':db[_0x1c0319[_0x96a9('0x1b')]],'as':_0x1c0319['as'],'attributes':_0x1c0319[_0x96a9('0x18')],'include':_0x1c0319[_0x96a9('0x1a')]?_[_0x96a9('0x1c')](_0x1c0319['include'],function(_0x4c42ab){return{'model':db[_0x4c42ab['model']],'as':_0x4c42ab['as'],'attributes':_0x4c42ab[_0x96a9('0x18')],'include':_0x4c42ab['include']?_[_0x96a9('0x1c')](_0x4c42ab[_0x96a9('0x1a')],function(_0x233920){return{'model':db[_0x233920['model']],'as':_0x233920['as'],'attributes':_0x233920['attributes']};}):[]};}):[]};}):[]:[]})[_0x96a9('0x1d')](function(_0xc516c9){logger[_0x96a9('0x11')](_0x96a9('0x1e'),_0x210c82);logger[_0x96a9('0xa')]('ShowTrunk',_0x210c82,JSON[_0x96a9('0xc')](_0xc516c9));_0x2b8ac3(_0xc516c9);})[_0x96a9('0x13')](function(_0x5a448d){logger[_0x96a9('0xe')]('ShowTrunk',_0x5a448d[_0x96a9('0x10')],_0x210c82);_0x2afe37(_0x3b977f[_0x96a9('0xe')](0x1f4,_0x5a448d[_0x96a9('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index c7b0ebd..0bbf7da 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 _0x1462=['originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','/:id/sms_accounts','getSmsAccounts','/:id/whatsapp_accounts','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','%s-%s','now'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x1462,0xae));var _0x2146=function(_0x1ac5f8,_0x1e1ea7){_0x1ac5f8=_0x1ac5f8-0x0;var _0x26b238=_0x1462[_0x1ac5f8];return _0x26b238;};'use strict';var multer=require(_0x2146('0x0'));var util=require(_0x2146('0x1'));var path=require(_0x2146('0x2'));var timeout=require(_0x2146('0x3'));var express=require(_0x2146('0x4'));var router=express[_0x2146('0x5')]();var fs_extra=require(_0x2146('0x6'));var auth=require(_0x2146('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2146('0x8'));var controller=require(_0x2146('0x9'));router[_0x2146('0xa')]('/',auth[_0x2146('0xb')](),controller[_0x2146('0xc')]);router[_0x2146('0xa')](_0x2146('0xd'),auth[_0x2146('0xb')](),controller[_0x2146('0xe')]);router['get'](_0x2146('0xf'),auth[_0x2146('0xb')](),controller[_0x2146('0x10')]);router[_0x2146('0xa')](_0x2146('0x11'),auth[_0x2146('0xb')](),controller[_0x2146('0x12')]);router['get'](_0x2146('0x13'),auth[_0x2146('0xb')](),controller[_0x2146('0x14')]);router['get'](_0x2146('0x15'),controller[_0x2146('0x16')]);router['get'](_0x2146('0x17'),auth['isAuthenticated'](),controller['getOpenTabs']);router[_0x2146('0xa')](_0x2146('0x18'),auth[_0x2146('0xb')](),controller[_0x2146('0x19')]);router['get'](_0x2146('0x1a'),auth[_0x2146('0xb')](),controller[_0x2146('0x1b')]);router['get'](_0x2146('0x1c'),auth['isAuthenticated'](),controller[_0x2146('0x1d')]);router[_0x2146('0xa')](_0x2146('0x1e'),auth['isAuthenticated'](),controller[_0x2146('0x1f')]);router[_0x2146('0xa')](_0x2146('0x20'),auth[_0x2146('0xb')](),controller[_0x2146('0x21')]);router[_0x2146('0xa')](_0x2146('0x22'),auth[_0x2146('0xb')](),controller[_0x2146('0x23')]);router[_0x2146('0xa')](_0x2146('0x24'),auth[_0x2146('0xb')](),controller[_0x2146('0x25')]);router[_0x2146('0xa')](_0x2146('0x26'),auth[_0x2146('0xb')](),controller[_0x2146('0x27')]);router[_0x2146('0xa')]('/:id/mail/interactions',auth[_0x2146('0xb')](),controller['getMailInteractions']);router[_0x2146('0xa')](_0x2146('0x28'),auth['isAuthenticated'](),controller[_0x2146('0x29')]);router['get'](_0x2146('0x2a'),auth[_0x2146('0xb')](),controller[_0x2146('0x2b')]);router[_0x2146('0xa')](_0x2146('0x2c'),auth[_0x2146('0xb')](),controller['getWhatsappInteractions']);router[_0x2146('0xa')](_0x2146('0x2d'),auth['isAuthenticated'](),controller['getTeams']);router['get']('/:id/lists',auth['isAuthenticated'](),controller[_0x2146('0x2e')]);router['get'](_0x2146('0x2f'),auth[_0x2146('0xb')](),controller[_0x2146('0x30')]);router[_0x2146('0xa')](_0x2146('0x31'),auth['isAuthenticated'](),controller[_0x2146('0x32')]);router[_0x2146('0xa')](_0x2146('0x33'),auth['isAuthenticated'](),controller['getFaxAccounts']);router[_0x2146('0xa')](_0x2146('0x34'),auth[_0x2146('0xb')](),controller['getMailAccounts']);router[_0x2146('0xa')]('/:id/openchannel_accounts',auth[_0x2146('0xb')](),controller['getOpenchannelAccounts']);router[_0x2146('0xa')](_0x2146('0x35'),auth[_0x2146('0xb')](),controller[_0x2146('0x36')]);router['get']('/:id/chat_websites',auth['isAuthenticated'](),controller['getChatWebsites']);router[_0x2146('0xa')](_0x2146('0x37'),auth[_0x2146('0xb')](),controller['getWhatsappAccounts']);router[_0x2146('0xa')](_0x2146('0x38'),auth['isAuthenticated'](),controller['getSquareProjects']);router['get'](_0x2146('0x39'),auth[_0x2146('0xb')](),controller[_0x2146('0x3a')]);router[_0x2146('0xa')](_0x2146('0x3b'),auth[_0x2146('0xb')](),controller['getApiKey']);router['post']('/:id/contacts',auth[_0x2146('0xb')](),controller['addContacts']);router[_0x2146('0x3c')]('/',auth[_0x2146('0xb')](),controller['create']);router[_0x2146('0x3c')](_0x2146('0x3d'),auth[_0x2146('0xb')](),controller[_0x2146('0x3e')]);router[_0x2146('0x3c')](_0x2146('0x1a'),auth[_0x2146('0xb')](),controller[_0x2146('0x3f')]);var upload=multer({'storage':multer[_0x2146('0x40')]({'destination':function(_0x47222e,_0x50fe5c,_0x406716){_0x406716(null,path[_0x2146('0x41')](config[_0x2146('0x42')],_0x2146('0x43')));},'filename':function(_0x476803,_0x575e4f,_0x568616){_0x568616(null,util['format'](_0x2146('0x44'),Date[_0x2146('0x45')](),_0x575e4f[_0x2146('0x46')]));}})});router[_0x2146('0x3c')](_0x2146('0x15'),upload[_0x2146('0x47')](_0x2146('0x48')),controller[_0x2146('0x49')]);router['post'](_0x2146('0x4a'),auth['isAuthenticated'](),controller[_0x2146('0x4b')]);router[_0x2146('0x3c')](_0x2146('0x4c'),auth[_0x2146('0xb')](),controller[_0x2146('0x4d')]);router[_0x2146('0x3c')](_0x2146('0x4e'),auth[_0x2146('0xb')](),controller[_0x2146('0x4f')]);router[_0x2146('0x3c')](_0x2146('0x50'),auth[_0x2146('0xb')](),controller[_0x2146('0x51')]);router[_0x2146('0x3c')]('/:id/teams',auth[_0x2146('0xb')](),controller['addTeams']);router['post'](_0x2146('0x52'),auth[_0x2146('0xb')](),controller['addChatInteractions']);router[_0x2146('0x3c')](_0x2146('0x53'),auth[_0x2146('0xb')](),controller[_0x2146('0x54')]);router[_0x2146('0x3c')]('/:id/fax_interactions',auth[_0x2146('0xb')](),controller[_0x2146('0x55')]);router[_0x2146('0x3c')](_0x2146('0x56'),auth['isAuthenticated'](),controller[_0x2146('0x57')]);router[_0x2146('0x3c')](_0x2146('0x58'),auth['isAuthenticated'](),controller[_0x2146('0x59')]);router[_0x2146('0x3c')](_0x2146('0x5a'),auth[_0x2146('0xb')](),controller[_0x2146('0x5b')]);router['post'](_0x2146('0x33'),auth['isAuthenticated'](),controller[_0x2146('0x5c')]);router[_0x2146('0x3c')](_0x2146('0x34'),auth['isAuthenticated'](),controller[_0x2146('0x5d')]);router[_0x2146('0x3c')](_0x2146('0x5e'),auth['isAuthenticated'](),controller[_0x2146('0x5f')]);router['post']('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x2146('0x60')]);router['post'](_0x2146('0x61'),auth[_0x2146('0xb')](),controller[_0x2146('0x62')]);router[_0x2146('0x3c')]('/:id/whatsapp_accounts',auth[_0x2146('0xb')](),controller[_0x2146('0x63')]);router[_0x2146('0x3c')]('/:id/square_projects',auth[_0x2146('0xb')](),controller[_0x2146('0x64')]);router[_0x2146('0x3c')]('/:id/api_key',auth[_0x2146('0xb')](),controller[_0x2146('0x65')]);router[_0x2146('0x66')](_0x2146('0x13'),auth['isAuthenticated'](),controller[_0x2146('0x67')]);router['put'](_0x2146('0x68'),auth[_0x2146('0xb')](),controller[_0x2146('0x69')]);router[_0x2146('0x6a')](_0x2146('0x1a'),auth[_0x2146('0xb')](),controller[_0x2146('0x6b')]);router['delete']('/:id/teams',auth[_0x2146('0xb')](),controller[_0x2146('0x6c')]);router[_0x2146('0x6a')](_0x2146('0x13'),auth[_0x2146('0xb')](),controller[_0x2146('0x6d')]);router[_0x2146('0x6a')](_0x2146('0x52'),auth[_0x2146('0xb')](),controller[_0x2146('0x6e')]);router[_0x2146('0x6a')](_0x2146('0x53'),auth['isAuthenticated'](),controller[_0x2146('0x6f')]);router['delete']('/:id/fax_interactions',auth[_0x2146('0xb')](),controller[_0x2146('0x70')]);router[_0x2146('0x6a')](_0x2146('0x56'),auth[_0x2146('0xb')](),controller[_0x2146('0x71')]);router['delete'](_0x2146('0x58'),auth[_0x2146('0xb')](),controller[_0x2146('0x72')]);router['delete']('/:id/whatsapp_interactions',auth[_0x2146('0xb')](),controller['removeWhatsappInteractions']);router[_0x2146('0x6a')](_0x2146('0x33'),auth['isAuthenticated'](),controller[_0x2146('0x73')]);router['delete'](_0x2146('0x34'),auth[_0x2146('0xb')](),controller[_0x2146('0x74')]);router['delete'](_0x2146('0x5e'),auth[_0x2146('0xb')](),controller[_0x2146('0x75')]);router[_0x2146('0x6a')](_0x2146('0x35'),auth['isAuthenticated'](),controller['removeSmsAccounts']);router[_0x2146('0x6a')](_0x2146('0x61'),auth[_0x2146('0xb')](),controller['removeChatWebsites']);router[_0x2146('0x6a')](_0x2146('0x37'),auth['isAuthenticated'](),controller[_0x2146('0x76')]);router['delete'](_0x2146('0x38'),auth[_0x2146('0xb')](),controller[_0x2146('0x77')]);router['delete']('/:id/api_key',auth[_0x2146('0xb')](),controller[_0x2146('0x78')]);module[_0x2146('0x79')]=router; \ No newline at end of file +var _0xa887=['/presence','getPresence','/:id','show','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/sms_accounts','getChatWebsites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','/:id/api_key','getApiKey','addContacts','post','create','bulkCreate','diskStorage','join','server/files/images/','format','now','originalname','/:id/avatar','single','addAvatar','/:id/login','login','/:id/logout','/:id/pause','pause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','addSquareProjects','update','put','/:id/password','changePassword','delete','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeWhatsappAccounts','removeSquareProjects','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','/whoami','whoami'];(function(_0x3f726b,_0x232c64){var _0x5defdc=function(_0x4528fe){while(--_0x4528fe){_0x3f726b['push'](_0x3f726b['shift']());}};_0x5defdc(++_0x232c64);}(_0xa887,0xd0));var _0x7a88=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa887[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7a88('0x0'));var util=require(_0x7a88('0x1'));var path=require(_0x7a88('0x2'));var timeout=require(_0x7a88('0x3'));var express=require('express');var router=express[_0x7a88('0x4')]();var fs_extra=require(_0x7a88('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7a88('0x6'));var config=require(_0x7a88('0x7'));var controller=require(_0x7a88('0x8'));router[_0x7a88('0x9')]('/',auth[_0x7a88('0xa')](),controller['index']);router[_0x7a88('0x9')](_0x7a88('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x7a88('0xc'),auth[_0x7a88('0xa')](),controller[_0x7a88('0xd')]);router[_0x7a88('0x9')](_0x7a88('0xe'),auth[_0x7a88('0xa')](),controller[_0x7a88('0xf')]);router['get'](_0x7a88('0x10'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x11')]);router[_0x7a88('0x9')]('/:id/avatar',controller['getAvatar']);router[_0x7a88('0x9')](_0x7a88('0x12'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x13')]);router[_0x7a88('0x9')](_0x7a88('0x14'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x15')]);router['get'](_0x7a88('0x16'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x17')]);router[_0x7a88('0x9')](_0x7a88('0x18'),auth['isAuthenticated'](),controller[_0x7a88('0x19')]);router[_0x7a88('0x9')]('/:id/groups',auth[_0x7a88('0xa')](),controller['getGroups']);router[_0x7a88('0x9')]('/:id/recordings',auth[_0x7a88('0xa')](),controller[_0x7a88('0x1a')]);router[_0x7a88('0x9')](_0x7a88('0x1b'),auth[_0x7a88('0xa')](),controller['getScreenRecordings']);router[_0x7a88('0x9')](_0x7a88('0x1c'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x1d')]);router[_0x7a88('0x9')](_0x7a88('0x1e'),auth[_0x7a88('0xa')](),controller['getOpenchannelInteractions']);router[_0x7a88('0x9')](_0x7a88('0x1f'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x20')]);router['get'](_0x7a88('0x21'),auth['isAuthenticated'](),controller['getSmsInteractions']);router[_0x7a88('0x9')]('/:id/fax/interactions',auth[_0x7a88('0xa')](),controller['getFaxInteractions']);router[_0x7a88('0x9')](_0x7a88('0x22'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x23')]);router[_0x7a88('0x9')](_0x7a88('0x24'),auth['isAuthenticated'](),controller['getTeams']);router[_0x7a88('0x9')](_0x7a88('0x25'),auth['isAuthenticated'](),controller[_0x7a88('0x26')]);router[_0x7a88('0x9')](_0x7a88('0x27'),auth['isAuthenticated'](),controller[_0x7a88('0x28')]);router[_0x7a88('0x9')](_0x7a88('0x29'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x2a')]);router[_0x7a88('0x9')](_0x7a88('0x2b'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x2c')]);router[_0x7a88('0x9')](_0x7a88('0x2d'),auth[_0x7a88('0xa')](),controller['getMailAccounts']);router[_0x7a88('0x9')]('/:id/openchannel_accounts',auth[_0x7a88('0xa')](),controller['getOpenchannelAccounts']);router['get'](_0x7a88('0x2e'),auth[_0x7a88('0xa')](),controller['getSmsAccounts']);router[_0x7a88('0x9')]('/:id/chat_websites',auth[_0x7a88('0xa')](),controller[_0x7a88('0x2f')]);router['get']('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x7a88('0x30')]);router[_0x7a88('0x9')](_0x7a88('0x31'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x32')]);router[_0x7a88('0x9')](_0x7a88('0x33'),auth['isAuthenticated'](),controller['getScheduledCalls']);router['get'](_0x7a88('0x34'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x35')]);router['post'](_0x7a88('0x14'),auth['isAuthenticated'](),controller[_0x7a88('0x36')]);router[_0x7a88('0x37')]('/',auth[_0x7a88('0xa')](),controller[_0x7a88('0x38')]);router['post']('/create_many',auth['isAuthenticated'](),controller[_0x7a88('0x39')]);router[_0x7a88('0x37')]('/:id/queues',auth[_0x7a88('0xa')](),controller['addQueues']);var upload=multer({'storage':multer[_0x7a88('0x3a')]({'destination':function(_0x17d63b,_0x5d84db,_0x245c55){_0x245c55(null,path[_0x7a88('0x3b')](config['root'],_0x7a88('0x3c')));},'filename':function(_0x19733f,_0x5684d5,_0x253b68){_0x253b68(null,util[_0x7a88('0x3d')]('%s-%s',Date[_0x7a88('0x3e')](),_0x5684d5[_0x7a88('0x3f')]));}})});router[_0x7a88('0x37')](_0x7a88('0x40'),upload[_0x7a88('0x41')]('file'),controller[_0x7a88('0x42')]);router['post'](_0x7a88('0x43'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x44')]);router[_0x7a88('0x37')](_0x7a88('0x45'),auth['isAuthenticated'](),controller['logout']);router[_0x7a88('0x37')](_0x7a88('0x46'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x47')]);router['post']('/:id/unpause',auth[_0x7a88('0xa')](),controller['unpause']);router['post']('/:id/teams',auth[_0x7a88('0xa')](),controller[_0x7a88('0x48')]);router[_0x7a88('0x37')]('/:id/chat_interactions',auth[_0x7a88('0xa')](),controller[_0x7a88('0x49')]);router['post'](_0x7a88('0x4a'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x4b')]);router['post'](_0x7a88('0x4c'),auth['isAuthenticated'](),controller[_0x7a88('0x4d')]);router['post'](_0x7a88('0x4e'),auth['isAuthenticated'](),controller['addSmsInteractions']);router[_0x7a88('0x37')](_0x7a88('0x4f'),auth[_0x7a88('0xa')](),controller['addOpenchannelInteractions']);router['post'](_0x7a88('0x50'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x51')]);router[_0x7a88('0x37')](_0x7a88('0x2b'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x52')]);router[_0x7a88('0x37')](_0x7a88('0x2d'),auth['isAuthenticated'](),controller[_0x7a88('0x53')]);router[_0x7a88('0x37')](_0x7a88('0x54'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x55')]);router[_0x7a88('0x37')](_0x7a88('0x2e'),auth['isAuthenticated'](),controller[_0x7a88('0x56')]);router[_0x7a88('0x37')](_0x7a88('0x57'),auth['isAuthenticated'](),controller[_0x7a88('0x58')]);router[_0x7a88('0x37')](_0x7a88('0x59'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x5a')]);router[_0x7a88('0x37')](_0x7a88('0x31'),auth['isAuthenticated'](),controller[_0x7a88('0x5b')]);router[_0x7a88('0x37')](_0x7a88('0x34'),auth[_0x7a88('0xa')](),controller['createApiKey']);router['put']('/:id',auth[_0x7a88('0xa')](),controller[_0x7a88('0x5c')]);router[_0x7a88('0x5d')](_0x7a88('0x5e'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x5f')]);router['delete'](_0x7a88('0x16'),auth[_0x7a88('0xa')](),controller['removeQueues']);router[_0x7a88('0x60')](_0x7a88('0x24'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x61')]);router[_0x7a88('0x60')](_0x7a88('0x10'),auth['isAuthenticated'](),controller[_0x7a88('0x62')]);router[_0x7a88('0x60')](_0x7a88('0x63'),auth['isAuthenticated'](),controller[_0x7a88('0x64')]);router[_0x7a88('0x60')](_0x7a88('0x4a'),auth[_0x7a88('0xa')](),controller['removeMailInteractions']);router[_0x7a88('0x60')]('/:id/fax_interactions',auth[_0x7a88('0xa')](),controller[_0x7a88('0x65')]);router[_0x7a88('0x60')](_0x7a88('0x4e'),auth['isAuthenticated'](),controller[_0x7a88('0x66')]);router[_0x7a88('0x60')](_0x7a88('0x4f'),auth['isAuthenticated'](),controller[_0x7a88('0x67')]);router[_0x7a88('0x60')](_0x7a88('0x50'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x68')]);router['delete'](_0x7a88('0x2b'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x69')]);router[_0x7a88('0x60')](_0x7a88('0x2d'),auth[_0x7a88('0xa')](),controller['removeMailAccounts']);router[_0x7a88('0x60')]('/:id/openchannel_accounts',auth[_0x7a88('0xa')](),controller[_0x7a88('0x6a')]);router[_0x7a88('0x60')](_0x7a88('0x2e'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x6b')]);router[_0x7a88('0x60')](_0x7a88('0x57'),auth[_0x7a88('0xa')](),controller['removeChatWebsites']);router[_0x7a88('0x60')]('/:id/whatsapp_accounts',auth[_0x7a88('0xa')](),controller[_0x7a88('0x6c')]);router['delete'](_0x7a88('0x31'),auth['isAuthenticated'](),controller[_0x7a88('0x6d')]);router[_0x7a88('0x60')](_0x7a88('0x34'),auth[_0x7a88('0xa')](),controller['removeApiKey']);module[_0x7a88('0x6e')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 433668b..f1be9e9 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 _0x70e0=['refuse','originate','uac','uas','fingerprint','update,nonat','TEXT','showWebBar','get','isArray','wss','udp','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','INTEGER','BOOLEAN','DATE','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','join','transport','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','ulaw;alaw;gsm','allow','insecure','\x22\x22\x20<>','always','accept'];(function(_0x44a4e3,_0x357dd8){var _0x570ae5=function(_0x4eacdd){while(--_0x4eacdd){_0x44a4e3['push'](_0x44a4e3['shift']());}};_0x570ae5(++_0x357dd8);}(_0x70e0,0x17b));var _0x070e=function(_0x704461,_0x38d722){_0x704461=_0x704461-0x0;var _0x452c67=_0x70e0[_0x704461];return _0x452c67;};'use strict';var Sequelize=require(_0x070e('0x0'));var moment=require(_0x070e('0x1'));var util=require(_0x070e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'unique':_0x070e('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x277d32){this[_0x070e('0x5')]('name',_0x277d32);this[_0x070e('0x5')]('defaultuser',_0x277d32);},'comment':_0x070e('0x6')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x56e420){this['setDataValue'](_0x070e('0x7'),_0x56e420);this[_0x070e('0x5')](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),_0x56e420,this[_0x070e('0xb')](_0x070e('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x070e('0xd'),'validate':{'isEmail':!![]},'set':function(_0x2e3e5e){if(_0x2e3e5e){this[_0x070e('0x5')](_0x070e('0xd'),_0x2e3e5e[_0x070e('0xe')]());}}},'role':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x10'),_0x070e('0x11'),_0x070e('0x12'),_0x070e('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':![],'unique':'internal','set':function(_0x4a33d2){this['setDataValue'](_0x070e('0xc'),_0x4a33d2);this[_0x070e('0x5')]('accountcode',_0x4a33d2);this['setDataValue'](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),this[_0x070e('0xb')]('fullname'),_0x4a33d2));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x070e('0x3')]},'mobile':{'type':Sequelize[_0x070e('0x3')]},'address':{'type':Sequelize[_0x070e('0x3')]},'zipcode':{'type':Sequelize[_0x070e('0x3')]},'userpic':{'type':Sequelize[_0x070e('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x070e('0x3')]},'online':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x070e('0x16')]},'voicePause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x070e('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x070e('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x17')},'ipaddr':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x070e('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x18'),_0x070e('0x11'),_0x070e('0x19')),'allowNull':!![],'defaultValue':_0x070e('0x18')},'context':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x1a'),_0x070e('0x1b'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x070e('0x1c'),_0x070e('0x1d'),_0x070e('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x59c5b4){this[_0x070e('0x5')]('transport',_0x59c5b4?_0x59c5b4[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')]('transport')?this['getDataValue'](_0x070e('0x20'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x070e('0x22'),_0x070e('0x23'),_0x070e('0x24'),_0x070e('0x25'),_0x070e('0x26')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x28'),_0x070e('0x29'),_0x070e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x2b'),'set':function(_0x34746e){this['setDataValue']('nat',_0x34746e?_0x34746e['join'](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2c'))?this[_0x070e('0xb')](_0x070e('0x2c'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x070e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x070e('0x3')]},'pickupgroup':{'type':Sequelize[_0x070e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x070e('0x3')]},'disallow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':_0x070e('0x2d'),'set':function(_0x4800a9){this[_0x070e('0x5')]('allow',_0x4800a9?_0x4800a9[_0x070e('0x1f')](';'):_0x070e('0x2d'));},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2e'))?this[_0x070e('0xb')]('allow')[_0x070e('0x21')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'set':function(_0x38879f){this['setDataValue'](_0x070e('0x2f'),_0x38879f?_0x38879f[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2f'))?this['getDataValue'](_0x070e('0x2f'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x30')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x31')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x32'),_0x070e('0x33'),_0x070e('0x34')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x35'),'uas'),'allowNull':!![],'defaultValue':_0x070e('0x36')},'t38pt_usertpsource':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'keepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x37'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x070e('0xf')]('active','passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x28'),'update',_0x070e('0x38')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x070e('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x070e('0x39')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x4cb86f){this['setDataValue'](_0x070e('0x3a'),_0x4cb86f);var _0x1ae5cb=this[_0x070e('0x3b')]({'plain':!![]});switch(_0x4cb86f){case 0x0:case 0x1:var _0x122198=_0x1ae5cb[_0x070e('0x20')]?_[_0x070e('0x3c')](_0x1ae5cb['transport'])?_0x1ae5cb[_0x070e('0x20')]['join']():_0x1ae5cb[_0x070e('0x20')]:'udp';if(_0x122198===_0x070e('0x3d')){_0x122198=_0x070e('0x3e');}this['setDataValue'](_0x070e('0x20'),_0x122198);this['setDataValue'](_0x070e('0x3f'),'no');this[_0x070e('0x5')](_0x070e('0x40'),null);this[_0x070e('0x5')](_0x070e('0x41'),null);this[_0x070e('0x5')](_0x070e('0x42'),null);this[_0x070e('0x5')](_0x070e('0x43'),null);this[_0x070e('0x5')](_0x070e('0x44'),null);this[_0x070e('0x5')](_0x070e('0x45'),null);this[_0x070e('0x5')]('dtlscertfile',null);this[_0x070e('0x5')](_0x070e('0x46'),null);this[_0x070e('0x5')](_0x070e('0x47'),'no');break;case 0x2:this['setDataValue'](_0x070e('0x20'),_0x070e('0x3d'));this[_0x070e('0x5')](_0x070e('0x3f'),_0x070e('0x27'));this[_0x070e('0x5')]('avpf',_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x41'),_0x070e('0x27'));this['setDataValue'](_0x070e('0x42'),'yes');this[_0x070e('0x5')](_0x070e('0x43'),_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x44'),'no');this['setDataValue'](_0x070e('0x45'),_0x070e('0x48'));this[_0x070e('0x5')](_0x070e('0x49'),_0x1ae5cb['dtlscertfile']||_0x070e('0x4a'));this['setDataValue'](_0x070e('0x46'),_0x1ae5cb[_0x070e('0x46')]||_0x070e('0x4b'));this['setDataValue'](_0x070e('0x47'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x070e('0x39')],'set':function(_0x5ce157){this[_0x070e('0x5')](_0x070e('0x4c'),_0x5ce157?_0x5ce157['join'](','):[]);},'get':function(){return this[_0x070e('0xb')]('permissions')?_[_0x070e('0x4d')](this[_0x070e('0xb')]('permissions')['split'](','),function(_0x29ee66){return parseInt(_0x29ee66,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x070e('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x070e('0x4e')],'get':function(){return this[_0x070e('0xb')](_0x070e('0x4f'))?this[_0x070e('0xb')](_0x070e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x070e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4f720f){if(typeof _0x4f720f==='string'){var _0x1624cd=_0x4f720f==='1'?!![]:_0x4f720f==='0'?![]:_0x4f720f===_0x070e('0x50')?!![]:_0x4f720f===_0x070e('0x51')?![]:![];this[_0x070e('0x5')]('screenrecording',_0x1624cd);}else{this[_0x070e('0x5')](_0x070e('0x52'),_0x4f720f);}}},'blocked':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![],'set':function(_0xd74f9c){this[_0x070e('0x5')](_0x070e('0x53'),_0xd74f9c);if(_0xd74f9c===!![]){this['setDataValue'](_0x070e('0x54'),moment());this['setDataValue'](_0x070e('0x55'),0x0);}else{this[_0x070e('0x5')](_0x070e('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x070e('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x070e('0x14')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]}}; \ No newline at end of file +var _0x3ae9=['auto','yes','update','outgoing','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]','never','\x22\x22\x20<>','always','accept','originate','uac','uas','certificate','active','passive','actpass','update,nonat','showWebBar','get','isArray','wss','encryption','avpf','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','force_avp','dtlscertfile','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','util','lodash','exports','name','setDataValue','defaultuser','STRING','fullname','callerid','\x22%s\x22\x20<%s>','email','toLowerCase','user','agent','INTEGER','internal','accountcode','getDataValue','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','ENUM','friend','from-sip','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband'];(function(_0x4224df,_0x48d1a5){var _0x573fe0=function(_0x220a00){while(--_0x220a00){_0x4224df['push'](_0x4224df['shift']());}};_0x573fe0(++_0x48d1a5);}(_0x3ae9,0xdb));var _0x93ae=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x3ae9[_0x2ec461];return _0x28603d;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x93ae('0x0'));var _=require(_0x93ae('0x1'));module[_0x93ae('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x93ae('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x228854){this[_0x93ae('0x4')](_0x93ae('0x3'),_0x228854);this['setDataValue'](_0x93ae('0x5'),_0x228854);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x93ae('0x6')],'allowNull':![],'set':function(_0x32564c){this[_0x93ae('0x4')](_0x93ae('0x7'),_0x32564c);this[_0x93ae('0x4')](_0x93ae('0x8'),util['format'](_0x93ae('0x9'),_0x32564c,this['getDataValue']('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x93ae('0x6')],'allowNull':![],'unique':_0x93ae('0xa'),'validate':{'isEmail':!![]},'set':function(_0x2d0afa){if(_0x2d0afa){this[_0x93ae('0x4')](_0x93ae('0xa'),_0x2d0afa[_0x93ae('0xb')]());}}},'role':{'type':Sequelize['ENUM']('admin',_0x93ae('0xc'),_0x93ae('0xd'),'telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x93ae('0x6')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x93ae('0xe')](0xb),'allowNull':![],'unique':_0x93ae('0xf'),'set':function(_0x5b4ea1){this[_0x93ae('0x4')](_0x93ae('0xf'),_0x5b4ea1);this[_0x93ae('0x4')](_0x93ae('0x10'),_0x5b4ea1);this[_0x93ae('0x4')](_0x93ae('0x8'),util['format'](_0x93ae('0x9'),this[_0x93ae('0x11')](_0x93ae('0x7')),_0x5b4ea1));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x93ae('0x6')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x93ae('0x6')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x93ae('0x6')]},'country':{'type':Sequelize[_0x93ae('0x6')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x93ae('0x12')]},'voicePause':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x93ae('0x6')],'defaultValue':_0x93ae('0x14')},'lastPauseAt':{'type':Sequelize[_0x93ae('0x12')]},'chatCapacity':{'type':Sequelize[_0x93ae('0xe')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x93ae('0xe')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x93ae('0xe')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x93ae('0xe')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x93ae('0xe')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'host':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![],'defaultValue':_0x93ae('0x15')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x93ae('0xe')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x17'),'user','peer'),'allowNull':!![],'defaultValue':_0x93ae('0x17')},'context':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![],'defaultValue':_0x93ae('0x18')},'callingpres':{'type':Sequelize[_0x93ae('0x16')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0x93ae('0x19'),'PROHIB_NOT_SCREENED',_0x93ae('0x1a'),_0x93ae('0x1b'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'permit':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'secret':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'transport':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![],'defaultValue':_0x93ae('0x1c'),'set':function(_0x371c53){this['setDataValue'](_0x93ae('0x1d'),_0x371c53?_0x371c53[_0x93ae('0x1e')](','):null);},'get':function(){return this[_0x93ae('0x11')](_0x93ae('0x1d'))?this[_0x93ae('0x11')](_0x93ae('0x1d'))[_0x93ae('0x1f')](','):null;},'comment':_0x93ae('0x20')},'dtmfmode':{'type':Sequelize['ENUM'](_0x93ae('0x21'),'info',_0x93ae('0x22'),_0x93ae('0x23'),_0x93ae('0x24')),'allowNull':!![],'defaultValue':_0x93ae('0x21')},'directmedia':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x25'),'no','nonat',_0x93ae('0x26'),_0x93ae('0x27')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x93ae('0x16')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'nat':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x588916){this[_0x93ae('0x4')](_0x93ae('0x28'),_0x588916?_0x588916[_0x93ae('0x1e')](','):null);},'get':function(){return this[_0x93ae('0x11')](_0x93ae('0x28'))?this[_0x93ae('0x11')](_0x93ae('0x28'))[_0x93ae('0x1f')](','):null;},'comment':_0x93ae('0x29')},'callgroup':{'type':Sequelize[_0x93ae('0x6')]},'namedcallgroup':{'type':Sequelize[_0x93ae('0x6')]},'pickupgroup':{'type':Sequelize[_0x93ae('0x6')]},'namedpickupgroup':{'type':Sequelize[_0x93ae('0x6')]},'language':{'type':Sequelize[_0x93ae('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x93ae('0x6')],'allowNull':![],'defaultValue':_0x93ae('0x2a')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x93ae('0x2b'),'set':function(_0x5d6cd6){this['setDataValue'](_0x93ae('0x2c'),_0x5d6cd6?_0x5d6cd6['join'](';'):_0x93ae('0x2b'));},'get':function(){return this[_0x93ae('0x11')](_0x93ae('0x2c'))?this[_0x93ae('0x11')](_0x93ae('0x2c'))[_0x93ae('0x1f')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x25'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![],'set':function(_0x1a8bee){this[_0x93ae('0x4')](_0x93ae('0x2d'),_0x1a8bee?_0x1a8bee[_0x93ae('0x1e')](','):null);},'get':function(){return this[_0x93ae('0x11')](_0x93ae('0x2d'))?this[_0x93ae('0x11')](_0x93ae('0x2d'))['split'](','):null;},'comment':_0x93ae('0x2e')},'trustrpid':{'type':Sequelize[_0x93ae('0x16')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x93ae('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x25'),'no',_0x93ae('0x2f')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x25'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x25'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![],'defaultValue':_0x93ae('0x30')},'amaflags':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x93ae('0x16')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x93ae('0xe')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x93ae('0x25'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x25'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x25'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'template':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x93ae('0x16')]('yes','no',_0x93ae('0x31')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x93ae('0x25'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x32'),'refuse',_0x93ae('0x33')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x93ae('0xe')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x34'),_0x93ae('0x35')),'allowNull':!![],'defaultValue':_0x93ae('0x35')},'t38pt_usertpsource':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x93ae('0xe')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x93ae('0xe')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x93ae('0xe')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x93ae('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x93ae('0xe')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x93ae('0xe')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x93ae('0xe')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x93ae('0x16')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x25'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x25'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x25'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x93ae('0x16')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x93ae('0x16')]('yes','no','fingerprint',_0x93ae('0x36')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x93ae('0xe')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x37'),_0x93ae('0x38'),_0x93ae('0x39')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x25'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x93ae('0xe')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x25'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x25'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x25'),'no','nonat',_0x93ae('0x26'),_0x93ae('0x3a')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x93ae('0x12')]},'passwordResetAt':{'type':Sequelize[_0x93ae('0x12')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x93ae('0xe')],'defaultValue':0x0,'set':function(_0x45ff85){this[_0x93ae('0x4')](_0x93ae('0x3b'),_0x45ff85);var _0xb38655=this[_0x93ae('0x3c')]({'plain':!![]});switch(_0x45ff85){case 0x0:case 0x1:var _0x339459=_0xb38655['transport']?_[_0x93ae('0x3d')](_0xb38655['transport'])?_0xb38655['transport'][_0x93ae('0x1e')]():_0xb38655[_0x93ae('0x1d')]:'udp';if(_0x339459===_0x93ae('0x3e')){_0x339459=_0x93ae('0x1c');}this[_0x93ae('0x4')](_0x93ae('0x1d'),_0x339459);this[_0x93ae('0x4')](_0x93ae('0x3f'),'no');this[_0x93ae('0x4')](_0x93ae('0x40'),null);this[_0x93ae('0x4')]('force_avp',null);this['setDataValue'](_0x93ae('0x41'),null);this[_0x93ae('0x4')](_0x93ae('0x42'),null);this[_0x93ae('0x4')](_0x93ae('0x43'),null);this[_0x93ae('0x4')](_0x93ae('0x44'),null);this['setDataValue']('dtlscertfile',null);this[_0x93ae('0x4')](_0x93ae('0x45'),null);this[_0x93ae('0x4')](_0x93ae('0x46'),'no');break;case 0x2:this[_0x93ae('0x4')](_0x93ae('0x1d'),_0x93ae('0x3e'));this[_0x93ae('0x4')](_0x93ae('0x3f'),'yes');this[_0x93ae('0x4')]('avpf','yes');this[_0x93ae('0x4')](_0x93ae('0x47'),_0x93ae('0x25'));this[_0x93ae('0x4')](_0x93ae('0x41'),_0x93ae('0x25'));this[_0x93ae('0x4')](_0x93ae('0x42'),_0x93ae('0x25'));this[_0x93ae('0x4')](_0x93ae('0x43'),'no');this[_0x93ae('0x4')]('dtlssetup','actpass');this[_0x93ae('0x4')](_0x93ae('0x48'),_0xb38655[_0x93ae('0x48')]||'/etc/pki/tls/certs/motion.crt');this[_0x93ae('0x4')](_0x93ae('0x45'),_0xb38655[_0x93ae('0x45')]||'/etc/pki/tls/private/motion.key');this[_0x93ae('0x4')](_0x93ae('0x46'),_0x93ae('0x25'));break;default:}}},'permissions':{'type':Sequelize[_0x93ae('0x49')],'set':function(_0x119be3){this['setDataValue'](_0x93ae('0x4a'),_0x119be3?_0x119be3[_0x93ae('0x1e')](','):[]);},'get':function(){return this[_0x93ae('0x11')]('permissions')?_[_0x93ae('0x4b')](this[_0x93ae('0x11')]('permissions')[_0x93ae('0x1f')](','),function(_0x239921){return parseInt(_0x239921,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x93ae('0x6')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x93ae('0x6')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x93ae('0xe')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x93ae('0xe')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x93ae('0x16')](_0x93ae('0x25'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x93ae('0x6')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x93ae('0x4c')],'get':function(){return this['getDataValue'](_0x93ae('0x4d'))?this[_0x93ae('0x11')](_0x93ae('0x4d')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'interface':{'type':Sequelize[_0x93ae('0x6')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x93ae('0x6')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4d0b28){if(typeof _0x4d0b28===_0x93ae('0x4e')){var _0x470662=_0x4d0b28==='1'?!![]:_0x4d0b28==='0'?![]:_0x4d0b28===_0x93ae('0x4f')?!![]:_0x4d0b28===_0x93ae('0x50')?![]:![];this[_0x93ae('0x4')]('screenrecording',_0x470662);}else{this[_0x93ae('0x4')](_0x93ae('0x51'),_0x4d0b28);}}},'blocked':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![],'set':function(_0x4355cc){this['setDataValue']('blocked',_0x4355cc);if(_0x4355cc===!![]){this['setDataValue'](_0x93ae('0x52'),moment());this['setDataValue'](_0x93ae('0x53'),0x0);}else{this[_0x93ae('0x4')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x93ae('0x12')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x93ae('0xe')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x93ae('0xe')](0x5)[_0x93ae('0x54')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x93ae('0x13')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x93ae('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 c92488f..dd42825 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 _0xd117=['register','defaults','localhost','http','request','then','info','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','json','offset','limit','count','set','update','get','Users','Agents','agent','Telephones','map','value','includes','role','destroy','stack','name','send','index','rawAttributes','fieldName','key','filter','salt','where','User','query','include','attributes','push','rows','openTabs','true','chat','dataValues','sms','whatsapp','all','params','model','differenceBy','keys','password','filters','intersection','fields','includeAll','merge','options','find','openchannel','mail','body','describe','addContacts','omit','ids','internal','Setting','findById','securePassword','max','isNil','min_internal','sequelize','QueryTypes','SELECT','length','from','voicemail','mailbox','VoiceMail','fullname','permissions','101','102','103','104','105','106','107','108','100','114','115','create','user','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','autoAssociation','bulkCreate','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','each','telephone','isEmpty','some','compact','UserProfileResource','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','add','capitalize','toLowerCase','Queues','penalty','spread','QueueId','emit','Queue:save','voice','findAll','format','UserVoiceQueueRt','upsert','isValidChannel','Unknown\x20channel','remove','Queue:remove','addAvatar','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','userpic','download','existsSync','server/files/images/','getOpenTabs','fax','ChatOpenTabs','createdAt','FaxOpenTabs','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','SmsOpenTabs','SMS','WhatsappOpenTabs','getContacts','CmContact','order','sort','pick','CmList','Tag','color','tag','Queue','Unknown\x20role','hasOwnProperty','nolimit','getVoiceQueuesRt','getGroups','getRecordings','VoiceRecording','UserId','ScreenRecording','getChatInteractions','ChatInteraction','OpenchannelInteraction','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','WhatsappInteraction','getWhatsappInteractions','login','phone','mobile','LOCAL/%s@from-sip/n','SIP/%s','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','PAUSE','LOGININPAUSE','concat','logout','pause','QueuePause','updateAttributes','type','DEFAULT\x20PAUSE','unpause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','manual','Pause','getTeams','Team','addTeams','Voice','setDataValue','Chat','getMailQueues','getSmsQueues','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','transaction','addAgent','getDataValue','VoicePrefixId','removeTeams','getChatQueues','Mail','removeAgent','getLists','getAgents','values','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','user_has_openchannel_interactions:remove','addWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lt','$lte','$eq','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','lastName','Contact','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','nonce','token','removeApiKey','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','resolve','teams','queues','VoiceQueue','inbound','flatten','lower','col','asc','desc','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','ringing','busy','slice','toUpperCase','select','field','ui.','InteractionId','user_has_','_interactions','ui.UserId\x20=\x20?','toString','OpenTabs','moment','bluebird','util','path','lodash','squel','jayson/promise','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./user.socket'];(function(_0x2cee34,_0x7e21a9){var _0x5a369e=function(_0x5114d1){while(--_0x5114d1){_0x2cee34['push'](_0x2cee34['shift']());}};_0x5a369e(++_0x7e21a9);}(_0xd117,0x182));var _0x7d11=function(_0x5a5c11,_0x358f6b){_0x5a5c11=_0x5a5c11-0x0;var _0x5d6ba7=_0xd117[_0x5a5c11];return _0x5d6ba7;};'use strict';var moment=require(_0x7d11('0x0'));var BPromise=require(_0x7d11('0x1'));var util=require(_0x7d11('0x2'));var path=require(_0x7d11('0x3'));var fs=require('fs');var _=require(_0x7d11('0x4'));var squel=require(_0x7d11('0x5'));var jayson=require(_0x7d11('0x6'));var Redis=require(_0x7d11('0x7'));var authService=require(_0x7d11('0x8'));var qs=require(_0x7d11('0x9'));var logger=require(_0x7d11('0xa'))(_0x7d11('0xb'));var utils=require(_0x7d11('0xc'));var config=require(_0x7d11('0xd'));var licenseUtil=require(_0x7d11('0xe'));var db=require(_0x7d11('0xf'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x7d11('0x10')]));require(_0x7d11('0x11'))[_0x7d11('0x12')](socket);config['redis']=_[_0x7d11('0x13')](config[_0x7d11('0x10')],{'host':_0x7d11('0x14'),'port':0x18eb});var client=jayson['client'][_0x7d11('0x15')]({'port':0x232a});var values;function respondWithRpcPromise(_0x48b0f1,_0x58a6fd,_0xb15984,_0x5c6d5d){return new BPromise(function(_0x4a8668,_0xc52a95){var _0x48f576=_0x5c6d5d||client;return _0x48f576[_0x7d11('0x16')](_0x48b0f1,_0xb15984)[_0x7d11('0x17')](function(_0x5ee572){logger[_0x7d11('0x18')](_0x7d11('0x19'),_0x58a6fd,'request\x20sent');logger[_0x7d11('0x1a')](_0x7d11('0x1b'),_0x58a6fd,_0x7d11('0x1c'),JSON[_0x7d11('0x1d')](_0x5ee572));if(_0x5ee572[_0x7d11('0x1e')]){if(_0x5ee572[_0x7d11('0x1e')][_0x7d11('0x1f')]===0x1f4){logger[_0x7d11('0x1e')]('User,\x20%s,\x20%s',_0x58a6fd,_0x5ee572[_0x7d11('0x1e')][_0x7d11('0x20')]);return _0xc52a95(_0x5ee572[_0x7d11('0x1e')][_0x7d11('0x20')]);}logger[_0x7d11('0x1e')]('User,\x20%s,\x20%s',_0x58a6fd,_0x5ee572[_0x7d11('0x1e')][_0x7d11('0x20')]);return _0x4a8668(_0x5ee572['error']['message']);}else{logger[_0x7d11('0x18')]('User,\x20%s,\x20%s',_0x58a6fd,_0x7d11('0x1c'));_0x4a8668(_0x5ee572['result'][_0x7d11('0x20')]);}})[_0x7d11('0x21')](function(_0x328f8e){logger[_0x7d11('0x1e')](_0x7d11('0x19'),_0x58a6fd,_0x328f8e);_0xc52a95(_0x328f8e);});});}function respondWithStatusCode(_0x117bb9,_0x4297f8){_0x4297f8=_0x4297f8||0xcc;return function(_0x3d2574){if(_0x3d2574){return _0x117bb9['sendStatus'](_0x4297f8);}return _0x117bb9[_0x7d11('0x22')](_0x4297f8)['end']();};}function respondWithResult(_0x58455b,_0x5c3898){_0x5c3898=_0x5c3898||0xc8;return function(_0x27a818){if(_0x27a818){return _0x58455b[_0x7d11('0x22')](_0x5c3898)[_0x7d11('0x23')](_0x27a818);}};}function respondWithFilteredResult(_0x1a7853,_0x355d14){return function(_0xd938df){if(_0xd938df){var _0x282e5c=typeof _0x355d14[_0x7d11('0x24')]==='undefined'&&typeof _0x355d14[_0x7d11('0x25')]==='undefined';var _0x4bfa76=_0xd938df['count'];var _0x3ba092=_0x282e5c?0x0:_0x355d14['offset'];var _0x180e1e=_0x282e5c?_0xd938df[_0x7d11('0x26')]:_0x355d14[_0x7d11('0x24')]+_0x355d14['limit'];var _0x46f76a;if(_0x180e1e>=_0x4bfa76){_0x180e1e=_0x4bfa76;_0x46f76a=0xc8;}else{_0x46f76a=0xce;}_0x1a7853[_0x7d11('0x22')](_0x46f76a);return _0x1a7853[_0x7d11('0x27')]('Content-Range',_0x3ba092+'-'+_0x180e1e+'/'+_0x4bfa76)[_0x7d11('0x23')](_0xd938df);}return null;};}function saveUpdates(_0x35a789){return function(_0x18c049){if(_0x18c049){return _0x18c049[_0x7d11('0x28')](_0x35a789)['then'](function(_0x1a7745){return _0x1a7745;});}return null;};}function removeEntity(_0x512f7f){return function(_0x1bc218){if(_0x1bc218){return _0x1bc218['destroy']()[_0x7d11('0x17')](function(){var _0xba4e80=_0x1bc218[_0x7d11('0x29')]({'plain':!![]});if(_0xba4e80['role']==='admin')return;var _0x8e0a53=[{'name':_0x7d11('0x2a'),'value':'user','ignore':!![]},{'name':_0x7d11('0x2b'),'value':_0x7d11('0x2c'),'ignore':![]},{'name':_0x7d11('0x2d'),'value':'telephone','ignore':![]}];var _0x9c6609=_(_0x8e0a53)['filter']('ignore')[_0x7d11('0x2e')]('value')[_0x7d11('0x2f')]();if(_[_0x7d11('0x30')](_0x9c6609,_0xba4e80[_0x7d11('0x31')])){return;}var _0x35b997=_['find'](_0x8e0a53,[_0x7d11('0x2f'),_0xba4e80[_0x7d11('0x31')]])['name'];return db['UserProfileResource'][_0x7d11('0x32')]({'where':{'type':_0x35b997,'resourceId':_0xba4e80['id']}})[_0x7d11('0x17')](function(){return _0x1bc218;});})['then'](function(){_0x512f7f[_0x7d11('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c0113){return function(_0x1286d6){if(!_0x1286d6){_0x5c0113['sendStatus'](0x194);}return _0x1286d6;};}function handleError(_0x4e53be,_0x3414cd){_0x3414cd=_0x3414cd||0x1f4;return function(_0x30e2fa){logger[_0x7d11('0x1e')](_0x30e2fa[_0x7d11('0x33')]);if(_0x30e2fa[_0x7d11('0x34')]){delete _0x30e2fa[_0x7d11('0x34')];}_0x4e53be[_0x7d11('0x22')](_0x3414cd)[_0x7d11('0x35')](_0x30e2fa);};}exports[_0x7d11('0x36')]=function(_0x16cf5d,_0x1a9f18){var _0x779731={},_0x5d2305={'count':0x0,'rows':[]};var _0x157731=_(db['User'][_0x7d11('0x37')])[_0x7d11('0x2e')](function(_0x36be62){return{'name':_0x36be62[_0x7d11('0x38')],'type':_0x36be62['type'][_0x7d11('0x39')]};})[_0x7d11('0x3a')](function(_0x19284){return!_[_0x7d11('0x30')](['password',_0x7d11('0x3b')],_0x19284['name']);})[_0x7d11('0x2f')]();_0x779731=qs['getOptions'](_0x157731,_0x16cf5d);var _0xede1cc={'where':_0x779731[_0x7d11('0x3c')]};return db[_0x7d11('0x3d')][_0x7d11('0x26')](_0xede1cc)['then'](function(_0x57b827){_0x5d2305[_0x7d11('0x26')]=_0x57b827;if(_0x16cf5d[_0x7d11('0x3e')]['includeAll']){_0x779731[_0x7d11('0x3f')]=[{'all':!![]}];}if(!_[_0x7d11('0x30')](_0x779731[_0x7d11('0x40')],'id')){_0x779731[_0x7d11('0x40')][_0x7d11('0x41')]('id');}return db[_0x7d11('0x3d')]['findAll'](_0x779731);})[_0x7d11('0x17')](function(_0x5cf6a6){_0x5d2305[_0x7d11('0x42')]=_0x5cf6a6;if(_0x16cf5d[_0x7d11('0x3e')][_0x7d11('0x43')]===_0x7d11('0x44')){var _0x2a0c2f=[];for(var _0x29da73=0x0;_0x29da73<_0x5d2305['rows']['length'];_0x29da73++){_0x2a0c2f['push'](get_open_tabs(_0x7d11('0x45'),_0x5d2305[_0x7d11('0x42')][_0x29da73][_0x7d11('0x46')]));_0x2a0c2f[_0x7d11('0x41')](get_open_tabs(_0x7d11('0x47'),_0x5d2305['rows'][_0x29da73][_0x7d11('0x46')]));_0x2a0c2f[_0x7d11('0x41')](get_open_tabs('fax',_0x5d2305[_0x7d11('0x42')][_0x29da73][_0x7d11('0x46')]));_0x2a0c2f[_0x7d11('0x41')](get_open_tabs('mail',_0x5d2305[_0x7d11('0x42')][_0x29da73][_0x7d11('0x46')]));_0x2a0c2f[_0x7d11('0x41')](get_open_tabs('openchannel',_0x5d2305[_0x7d11('0x42')][_0x29da73]['dataValues']));_0x2a0c2f[_0x7d11('0x41')](get_open_tabs(_0x7d11('0x48'),_0x5d2305[_0x7d11('0x42')][_0x29da73][_0x7d11('0x46')]));}return BPromise[_0x7d11('0x49')](_0x2a0c2f)[_0x7d11('0x17')](function(_0x161213){return _0x5d2305;});}else{return _0x5d2305;}})[_0x7d11('0x17')](respondWithFilteredResult(_0x1a9f18,_0x779731))[_0x7d11('0x21')](handleError(_0x1a9f18,null));};exports['show']=function(_0x50d458,_0x49a21c){var _0x10c0e9={'raw':![],'where':{'id':_0x50d458[_0x7d11('0x4a')]['id']}},_0x1e5bb5={};_0x1e5bb5[_0x7d11('0x4b')]=_[_0x7d11('0x4c')](_[_0x7d11('0x4d')](db[_0x7d11('0x3d')][_0x7d11('0x37')]),[_0x7d11('0x4e'),_0x7d11('0x3b')]);_0x1e5bb5[_0x7d11('0x3e')]=_[_0x7d11('0x4d')](_0x50d458['query']);_0x1e5bb5[_0x7d11('0x4f')]=_[_0x7d11('0x50')](_0x1e5bb5[_0x7d11('0x4b')],_0x1e5bb5['query']);_0x10c0e9['attributes']=_[_0x7d11('0x50')](_0x1e5bb5[_0x7d11('0x4b')],qs[_0x7d11('0x51')](_0x50d458['query']['fields']));_0x10c0e9[_0x7d11('0x40')]=_0x10c0e9[_0x7d11('0x40')]['length']?_0x10c0e9[_0x7d11('0x40')]:_0x1e5bb5[_0x7d11('0x4b')];if(_0x50d458[_0x7d11('0x3e')][_0x7d11('0x52')]){_0x10c0e9['include']=[{'all':!![]}];}_0x10c0e9=_[_0x7d11('0x53')]({},_0x10c0e9,_0x50d458[_0x7d11('0x54')]);if(!_[_0x7d11('0x30')](_0x10c0e9['attributes'],'id')){_0x10c0e9['attributes'][_0x7d11('0x41')]('id');}return db[_0x7d11('0x3d')][_0x7d11('0x55')](_0x10c0e9)[_0x7d11('0x17')](handleEntityNotFound(_0x49a21c,null))[_0x7d11('0x17')](function(_0x4c7d7a){var _0x46a8e1=[];values=_0x4c7d7a;if(_0x50d458[_0x7d11('0x3e')][_0x7d11('0x43')]===_0x7d11('0x44')){_0x46a8e1['push'](get_open_tabs('chat',_0x4c7d7a[_0x7d11('0x46')]));_0x46a8e1[_0x7d11('0x41')](get_open_tabs(_0x7d11('0x47'),_0x4c7d7a[_0x7d11('0x46')]));_0x46a8e1[_0x7d11('0x41')](get_open_tabs(_0x7d11('0x56'),_0x4c7d7a[_0x7d11('0x46')]));_0x46a8e1[_0x7d11('0x41')](get_open_tabs(_0x7d11('0x48'),_0x4c7d7a[_0x7d11('0x46')]));_0x46a8e1['push'](get_open_tabs('fax',_0x4c7d7a['dataValues']));_0x46a8e1[_0x7d11('0x41')](get_open_tabs(_0x7d11('0x57'),_0x4c7d7a[_0x7d11('0x46')]));return BPromise['all'](_0x46a8e1);}else{return values;}})[_0x7d11('0x17')](function(_0x222375){return values;})[_0x7d11('0x17')](respondWithResult(_0x49a21c,null))[_0x7d11('0x21')](handleError(_0x49a21c,null));};exports[_0x7d11('0x28')]=function(_0x178a3a,_0x505573){if(_0x178a3a[_0x7d11('0x58')]['id']){delete _0x178a3a[_0x7d11('0x58')]['id'];}delete _0x178a3a[_0x7d11('0x58')]['role'];return db['User']['find']({'where':{'id':_0x178a3a['params']['id']}})[_0x7d11('0x17')](handleEntityNotFound(_0x505573,null))['then'](saveUpdates(_0x178a3a['body'],null))['then'](respondWithResult(_0x505573,null))[_0x7d11('0x21')](handleError(_0x505573,null));};exports[_0x7d11('0x59')]=function(_0x1072f1,_0x407f2c){return db[_0x7d11('0x3d')][_0x7d11('0x59')]()['then'](respondWithResult(_0x407f2c,null))[_0x7d11('0x21')](handleError(_0x407f2c,null));};exports['addContacts']=function(_0x34aab4,_0x49f904){return db[_0x7d11('0x3d')][_0x7d11('0x55')]({'where':{'id':_0x34aab4['params']['id']}})[_0x7d11('0x17')](handleEntityNotFound(_0x49f904,null))[_0x7d11('0x17')](function(_0x2581d5){if(_0x2581d5){return _0x2581d5[_0x7d11('0x5a')](_0x34aab4['body']['ids'],_[_0x7d11('0x5b')](_0x34aab4[_0x7d11('0x58')],[_0x7d11('0x5c'),'id'])||{});}})[_0x7d11('0x17')](respondWithResult(_0x49f904,null))[_0x7d11('0x21')](handleError(_0x49f904,null));};function validateUser(_0x492183){return new BPromise(function(_0x2b9ba0,_0x5ad800){if(_0x492183[_0x7d11('0x5d')])return _0x2b9ba0(_0x492183);return db[_0x7d11('0x5e')][_0x7d11('0x5f')](0x1)[_0x7d11('0x17')](function(_0x4df2da){if(_0x4df2da[_0x7d11('0x60')])authService['validatePasswordPattern'](_0x492183[_0x7d11('0x4e')]);db[_0x7d11('0x3d')][_0x7d11('0x61')](_0x7d11('0x5d'))[_0x7d11('0x17')](function(_0x776b20){if(_[_0x7d11('0x62')](_0x776b20)){_0x492183[_0x7d11('0x5d')]=_0x4df2da[_0x7d11('0x63')]||0x1;return;}if(_[_0x7d11('0x62')](_0x4df2da[_0x7d11('0x63')])||_0x4df2da[_0x7d11('0x63')]===_0x776b20){_0x492183[_0x7d11('0x5d')]=_0x776b20+0x1;return;}if(_0x4df2da[_0x7d11('0x63')]>_0x776b20){_0x492183['internal']=_0x4df2da[_0x7d11('0x63')];return;}return db['sequelize'][_0x7d11('0x3e')]('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)',{'type':db[_0x7d11('0x64')][_0x7d11('0x65')][_0x7d11('0x66')]})[_0x7d11('0x17')](function(_0x4aac67){if(_0x4aac67&&_0x4aac67['length']){for(var _0x1351ee=0x0,_0x15938b=_0x4aac67[_0x7d11('0x67')];_0x1351ee<_0x15938b&&_['isNil'](_0x492183[_0x7d11('0x5d')]);_0x1351ee++){if(_0x4df2da[_0x7d11('0x63')]<=_0x4aac67[_0x1351ee][_0x7d11('0x68')]){_0x492183[_0x7d11('0x5d')]=_0x4aac67[_0x1351ee][_0x7d11('0x68')];}else if(_0x4df2da[_0x7d11('0x63')]>_0x4aac67[_0x1351ee]['from']&&_0x4df2da[_0x7d11('0x63')]<=_0x4aac67[_0x1351ee]['to']){_0x492183['internal']=_0x4df2da[_0x7d11('0x63')];}}}if(_['isNil'](_0x492183['internal'])){_0x492183[_0x7d11('0x5d')]=_0x776b20+0x1;}return _0x2b9ba0(_0x492183);});});})[_0x7d11('0x21')](function(_0xeed31b){_0x5ad800(_0xeed31b);});});}function updateUser(_0x14ee15){return new BPromise(function(_0x119da7,_0x2da548){try{if(_0x14ee15[_0x7d11('0x69')]){_0x14ee15[_0x7d11('0x6a')]=_0x14ee15[_0x7d11('0x5d')];_0x14ee15[_0x7d11('0x6b')]={'mailbox':_0x14ee15[_0x7d11('0x5d')],'password':_0x14ee15['password'],'fullname':_0x14ee15[_0x7d11('0x6c')],'email':_0x14ee15['email']};}if(_0x14ee15[_0x7d11('0x31')]===_0x7d11('0x2c')){if(!_0x14ee15[_0x7d11('0x6d')])_0x14ee15[_0x7d11('0x6d')]=[_0x7d11('0x6e'),_0x7d11('0x6f'),_0x7d11('0x70'),'113','110',_0x7d11('0x71'),_0x7d11('0x72'),_0x7d11('0x73'),_0x7d11('0x74'),_0x7d11('0x75'),'109',_0x7d11('0x76'),'111',_0x7d11('0x77'),_0x7d11('0x78')];}_0x119da7(_0x14ee15);}catch(_0x1bddb4){_0x2da548(_0x1bddb4);}});}exports[_0x7d11('0x79')]=function(_0x1b5e35,_0x1c02c8){if(_0x1b5e35[_0x7d11('0x7a')][_0x7d11('0x31')]==='agent')throw new Error('Unauthorized');if(_0x1b5e35[_0x7d11('0x58')][_0x7d11('0x31')]===_0x7d11('0x7a')&&_0x1b5e35['user']['role']!==_0x7d11('0x7b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x1b5e35[_0x7d11('0x58')][_0x7d11('0x31')]===_0x7d11('0x7b')&&_0x1b5e35[_0x7d11('0x7a')]['role']!==_0x7d11('0x7b')){throw new Error(_0x7d11('0x7c'));}return licenseUtil[_0x7d11('0x7d')]([_0x1b5e35[_0x7d11('0x58')]])[_0x7d11('0x17')](function(){return validateUser(_0x1b5e35[_0x7d11('0x58')]);})[_0x7d11('0x17')](function(_0x1b719a){return updateUser(_0x1b719a)['then'](function(_0x41f989){if(_0x41f989[_0x7d11('0x31')]===_0x7d11('0x7b')){_0x41f989[_0x7d11('0x7e')]=_0x1b5e35[_0x7d11('0x7a')]['settingsEnabled'];delete _0x41f989[_0x7d11('0x7f')];}return _0x41f989;});})[_0x7d11('0x17')](function(_0xa4d2ad){return db[_0x7d11('0x3d')][_0x7d11('0x79')](_0xa4d2ad,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})['then'](function(_0x1fdae2){if(_0x1b5e35['body'][_0x7d11('0x31')]==='user')return _0x1fdae2;if(_0x1b5e35['user'][_0x7d11('0x31')]!==_0x7d11('0x7a'))return _0x1fdae2;return db[_0x7d11('0x80')][_0x7d11('0x55')]({'where':{'name':_0x1fdae2[_0x7d11('0x31')]===_0x7d11('0x2c')?_0x7d11('0x2b'):_0x7d11('0x2d'),'userProfileId':_0x1b5e35[_0x7d11('0x7a')][_0x7d11('0x7f')]},'raw':!![]})['then'](function(_0xfdfcb7){if(!_0xfdfcb7||_0xfdfcb7[_0x7d11('0x81')]!=0x0)return _0x1fdae2;return db['UserProfileResource'][_0x7d11('0x79')]({'name':_0x1fdae2[_0x7d11('0x34')],'resourceId':_0x1fdae2['id'],'type':_0xfdfcb7[_0x7d11('0x34')],'sectionId':_0xfdfcb7['id']},{})[_0x7d11('0x17')](function(){return _0x1fdae2;});})['catch'](function(_0x573fa9){logger[_0x7d11('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x573fa9);throw _0x573fa9;});})[_0x7d11('0x17')](respondWithResult(_0x1c02c8,0xc9))[_0x7d11('0x21')](handleError(_0x1c02c8,null));};exports[_0x7d11('0x82')]=function(_0x13ccd5,_0x1565d9){var _0x269f3f=_0x13ccd5[_0x7d11('0x58')];var _0x596228=[];if(_0x13ccd5[_0x7d11('0x7a')][_0x7d11('0x31')]===_0x7d11('0x2c'))throw new Error(_0x7d11('0x83'));if(_['some'](_0x269f3f,[_0x7d11('0x31'),_0x7d11('0x7a')])&&_0x13ccd5['user'][_0x7d11('0x31')]!==_0x7d11('0x7b')){throw new Error(_0x7d11('0x84'));}if(_['some'](_0x269f3f,[_0x7d11('0x31'),_0x7d11('0x7b')])&&_0x13ccd5['user'][_0x7d11('0x31')]!==_0x7d11('0x7b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x7d11('0x7d')](_0x269f3f)['then'](function(){return validateUser(_0x269f3f[0x0]);})['then'](function(){for(var _0x4ba3f6=0x1;_0x4ba3f6<_0x269f3f['length'];_0x4ba3f6++){var _0x526e65=_0x269f3f[_0x4ba3f6-0x1][_0x7d11('0x5d')];if(!_0x269f3f[_0x4ba3f6][_0x7d11('0x5d')])_0x269f3f[_0x4ba3f6][_0x7d11('0x5d')]=_0x526e65+0x1;_0x596228[_0x7d11('0x41')](validateUser(_0x269f3f[_0x4ba3f6]));}return BPromise[_0x7d11('0x49')](_0x596228);})[_0x7d11('0x17')](function(){_0x596228=[];for(var _0x1a2df6=0x0;_0x1a2df6<_0x269f3f[_0x7d11('0x67')];_0x1a2df6++){_0x596228[_0x7d11('0x41')](updateUser(_0x269f3f[_0x1a2df6]));}return BPromise['all'](_0x596228);})['then'](function(){return BPromise[_0x7d11('0x85')](_0x269f3f,function(_0x158e0f){return db['User']['create'](_0x158e0f,{'include':[{'model':db[_0x7d11('0x6b')],'as':_0x7d11('0x6b')}]})[_0x7d11('0x17')](function(_0x391d7){_0x158e0f['id']=_0x391d7['id'];return _0x158e0f;});});})['then'](function(_0x542596){if(_0x13ccd5['body'][_0x7d11('0x31')]===_0x7d11('0x7a'))return _0x542596;if(_0x13ccd5[_0x7d11('0x7a')]['role']!==_0x7d11('0x7a'))return _0x542596;var _0x238cfd=_['some'](_0x542596,function(_0x4aafef){return _0x4aafef[_0x7d11('0x31')]==='agent'||_0x4aafef['role']===_0x7d11('0x86');});if(!_0x238cfd)return _0x542596;return db[_0x7d11('0x80')]['findAll']({'where':{'name':{'$or':['Agents',_0x7d11('0x2d')]},'userProfileId':_0x13ccd5[_0x7d11('0x7a')][_0x7d11('0x7f')]},'raw':!![]})[_0x7d11('0x17')](function(_0x4af02c){if(_[_0x7d11('0x87')](_0x4af02c)||!_[_0x7d11('0x88')](_0x4af02c,[_0x7d11('0x81'),0x0]))return _0x542596;_0x596228=[];var _0x83416b=_(_0x4af02c)['map'](function(_0xdd679a){if(_0xdd679a[_0x7d11('0x81')]===0x1)return;return _0xdd679a[_0x7d11('0x34')]==='Agents'?_0x7d11('0x2c'):'telephone';})[_0x7d11('0x89')]()['value']();for(var _0x1a0e19=0x0;_0x1a0e19<_0x542596[_0x7d11('0x67')];_0x1a0e19++){if(!_[_0x7d11('0x30')](_0x83416b,_0x542596[_0x1a0e19][_0x7d11('0x31')]))return;var _0x38094f=_0x542596[_0x1a0e19][_0x7d11('0x31')]==='agent'?'Agents':_0x7d11('0x2d');_0x596228[_0x7d11('0x41')](db[_0x7d11('0x8a')][_0x7d11('0x79')]({'name':_0x542596[_0x1a0e19]['name'],'resourceId':_0x542596[_0x1a0e19]['id'],'type':_0x38094f,'sectionId':_[_0x7d11('0x55')](_0x4af02c,[_0x7d11('0x34'),_0x38094f])['id']},{}));}return BPromise[_0x7d11('0x49')](_0x596228);});})[_0x7d11('0x17')](respondWithResult(_0x1565d9,0xc9))['catch'](handleError(_0x1565d9,null));};exports[_0x7d11('0x8b')]=function(_0x2bac2a,_0x3aad38){if(_0x2bac2a[_0x7d11('0x58')]['id']){delete _0x2bac2a[_0x7d11('0x58')]['id'];}return db[_0x7d11('0x3d')]['find']({'where':{'id':_0x2bac2a[_0x7d11('0x4a')]['id']}})['then'](function(_0xe03909){if(!_0xe03909)return null;if(_0xe03909['id']===_0x2bac2a['user']['id']){if(!_0x2bac2a[_0x7d11('0x58')][_0x7d11('0x8c')]||!_0x2bac2a[_0x7d11('0x58')][_0x7d11('0x8d')]){throw new db[(_0x7d11('0x8e'))][(_0x7d11('0x8f'))](_0x7d11('0x90'));}if(!_0xe03909[_0x7d11('0x91')](_0x2bac2a[_0x7d11('0x58')][_0x7d11('0x8c')])){throw new db['Sequelize'][(_0x7d11('0x8f'))]('Wrong\x20credentials');}if(_0x2bac2a[_0x7d11('0x58')][_0x7d11('0x8c')]===_0x2bac2a[_0x7d11('0x58')][_0x7d11('0x8d')]){throw new db[(_0x7d11('0x8e'))]['ValidationError']('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x2bac2a[_0x7d11('0x7a')][_0x7d11('0x31')]==='admin'){if(!_0x2bac2a[_0x7d11('0x58')][_0x7d11('0x8d')]){throw new db[(_0x7d11('0x8e'))][(_0x7d11('0x8f'))](_0x7d11('0x92'));}}else if(_0x2bac2a['user']['role']==='user'){if(!_0x2bac2a['body'][_0x7d11('0x8d')]){throw new db[(_0x7d11('0x8e'))]['ValidationError'](_0x7d11('0x92'));}if(_0xe03909[_0x7d11('0x31')]!==_0x7d11('0x2c')){throw new db[(_0x7d11('0x8e'))][(_0x7d11('0x8f'))](_0x7d11('0x83'));}}else{throw new db[(_0x7d11('0x8e'))][(_0x7d11('0x8f'))]('Unauthorized');}return _0xe03909;})[_0x7d11('0x17')](handleEntityNotFound(_0x3aad38,null))[_0x7d11('0x17')](function(_0x54fd6a){return db[_0x7d11('0x5e')][_0x7d11('0x93')]({'attributes':['id',_0x7d11('0x60'),_0x7d11('0x94'),_0x7d11('0x95')]})[_0x7d11('0x17')](function(_0x1b8ad6){if(_0x1b8ad6[_0x7d11('0x60')])authService[_0x7d11('0x96')](_0x2bac2a[_0x7d11('0x58')][_0x7d11('0x8d')]);if(!_0x1b8ad6[_0x7d11('0x94')]||!_0x54fd6a['previousPasswords'])return _0x54fd6a;authService['validatePasswordHistory'](_0x2bac2a[_0x7d11('0x58')][_0x7d11('0x8d')],_0x54fd6a[_0x7d11('0x97')],_0x1b8ad6['passwordHistoryLimit']);return _0x54fd6a;})[_0x7d11('0x17')](saveUpdates({'password':_0x2bac2a['body'][_0x7d11('0x8d')],'passwordResetAt':_0x2bac2a[_0x7d11('0x7a')]['id']==_0x2bac2a[_0x7d11('0x4a')]['id']?moment():null,'previousPasswords':authService[_0x7d11('0x98')](_0x2bac2a[_0x7d11('0x58')][_0x7d11('0x8d')],_0x54fd6a[_0x7d11('0x97')])},null));})[_0x7d11('0x17')](respondWithResult(_0x3aad38,null))[_0x7d11('0x21')](handleError(_0x3aad38,null));};exports[_0x7d11('0x99')]=function(_0x358178,_0x460c72){var _0x2c3a17=_0x358178[_0x7d11('0x58')][_0x7d11('0x9a')];return db[_0x7d11('0x3d')][_0x7d11('0x55')]({'where':{'id':_0x358178[_0x7d11('0x4a')]['id']},'attributes':['id','name','role',_0x7d11('0x9b'),_0x7d11('0x9c'),_0x7d11('0x9d'),_0x7d11('0x9e')]})[_0x7d11('0x17')](handleEntityNotFound(_0x460c72,null))['then'](function(_0x59d543){if(_0x59d543){if(!utils['isValidChannel'](_0x2c3a17)){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}return _0x59d543[_0x7d11('0x9f')+_[_0x7d11('0xa0')](_0x2c3a17[_0x7d11('0xa1')]())+_0x7d11('0xa2')](_0x358178[_0x7d11('0x58')][_0x7d11('0x5c')],{'penalty':_0x358178[_0x7d11('0x58')][_0x7d11('0xa3')]||0x0})[_0x7d11('0xa4')](function(_0x1570be){for(var _0x4135f7=0x0;_0x4135f7<_0x358178[_0x7d11('0x58')][_0x7d11('0x5c')]['length'];_0x4135f7+=0x1){var _0x51b469={'UserId':Number(_0x358178['params']['id'])};_0x51b469[_['capitalize'](_0x2c3a17['toLowerCase']())+_0x7d11('0xa5')]=Number(_0x358178[_0x7d11('0x58')][_0x7d11('0x5c')][_0x4135f7]);socket[_0x7d11('0xa6')](_0x7d11('0x7a')+_[_0x7d11('0xa0')](_0x2c3a17[_0x7d11('0xa1')]())+_0x7d11('0xa7'),_0x51b469);}return _0x1570be;})[_0x7d11('0x17')](function(){if(_0x2c3a17===_0x7d11('0xa8')){return db['VoiceQueue'][_0x7d11('0xa9')]({'where':{'id':_0x358178[_0x7d11('0x58')][_0x7d11('0x5c')]||[]},'raw':!![],'attributes':['id',_0x7d11('0x34')]});}})[_0x7d11('0x17')](function(_0x43a20c){var _0x53887c=_0x59d543[_0x7d11('0x29')]({'plain':!![]});var _0x25c8e4=[];if(_0x2c3a17===_0x7d11('0xa8')&&_0x53887c[_0x7d11('0x31')]==='agent'&&_0x53887c[_0x7d11('0x9b')]){for(var _0xbdc907=0x0;_0xbdc907<_0x43a20c['length'];_0xbdc907+=0x1){_0x25c8e4[_0x7d11('0x41')]({'membername':_0x53887c[_0x7d11('0x34')],'UserId':_0x53887c['id'],'queue_name':_0x43a20c[_0xbdc907][_0x7d11('0x34')],'VoiceQueueId':_0x43a20c[_0xbdc907]['id'],'interface':_['isNil'](_0x53887c[_0x7d11('0x9e')])?util[_0x7d11('0xaa')]('SIP/%s',_0x53887c[_0x7d11('0x34')]):_0x53887c[_0x7d11('0x9e')],'paused':_0x53887c[_0x7d11('0x9d')]||![],'penalty':_0x358178[_0x7d11('0x58')]['penalty']||0x0});}return BPromise['each'](_0x25c8e4,function(_0x83a280){return db[_0x7d11('0xab')][_0x7d11('0xac')](_0x83a280);});}return _0x59d543;});}})[_0x7d11('0x17')](respondWithStatusCode(_0x460c72,null))[_0x7d11('0x21')](handleError(_0x460c72,null));};exports['removeQueues']=function(_0x462e6b,_0x1398e8){var _0x45f8e0;return db[_0x7d11('0x3d')]['find']({'where':{'id':_0x462e6b[_0x7d11('0x4a')]['id']},'attributes':['id',_0x7d11('0x34'),_0x7d11('0x31')]})['then'](handleEntityNotFound(_0x1398e8,null))[_0x7d11('0x17')](function(_0x3fb52a){if(_0x3fb52a){_0x45f8e0=_0x3fb52a;if(!_0x462e6b[_0x7d11('0x3e')]['channel']||!utils[_0x7d11('0xad')](_0x462e6b[_0x7d11('0x3e')][_0x7d11('0x9a')])){throw new db[(_0x7d11('0x8e'))][(_0x7d11('0x8f'))](_0x7d11('0xae'));}return _0x3fb52a[_0x7d11('0xaf')+_['capitalize'](_0x462e6b[_0x7d11('0x3e')]['channel'][_0x7d11('0xa1')]())+_0x7d11('0xa2')](_0x462e6b[_0x7d11('0x3e')][_0x7d11('0x5c')]);}})['then'](function(_0x2e4eac){if(_['isArray'](_0x462e6b['query'][_0x7d11('0x5c')])){for(var _0x1ebd24=0x0;_0x1ebd24<_0x462e6b['query'][_0x7d11('0x5c')]['length'];_0x1ebd24+=0x1){var _0x451e24={'UserId':Number(_0x462e6b['params']['id'])};_0x451e24[_['capitalize'](_0x462e6b[_0x7d11('0x3e')]['channel'][_0x7d11('0xa1')]())+_0x7d11('0xa5')]=Number(_0x462e6b['query'][_0x7d11('0x5c')][_0x1ebd24]);socket['emit']('user'+_[_0x7d11('0xa0')](_0x462e6b['query']['channel']['toLowerCase']())+_0x7d11('0xb0'),_0x451e24);}}else{var _0x451e24={'UserId':Number(_0x462e6b[_0x7d11('0x4a')]['id'])};_0x451e24[_[_0x7d11('0xa0')](_0x462e6b[_0x7d11('0x3e')]['channel'][_0x7d11('0xa1')]())+_0x7d11('0xa5')]=Number(_0x462e6b[_0x7d11('0x3e')][_0x7d11('0x5c')]);socket[_0x7d11('0xa6')](_0x7d11('0x7a')+_['capitalize'](_0x462e6b[_0x7d11('0x3e')][_0x7d11('0x9a')][_0x7d11('0xa1')]())+_0x7d11('0xb0'),_0x451e24);}return _0x2e4eac;})[_0x7d11('0x17')](function(){if(_0x462e6b[_0x7d11('0x3e')]['channel']===_0x7d11('0xa8')){return db[_0x7d11('0xab')][_0x7d11('0x32')]({'where':{'UserId':_0x462e6b['params']['id'],'VoiceQueueId':_0x462e6b[_0x7d11('0x3e')][_0x7d11('0x5c')]},'individualHooks':!![]})[_0x7d11('0x17')](function(){return _0x45f8e0;});}return _0x45f8e0;})['then'](respondWithStatusCode(_0x1398e8,null))[_0x7d11('0x21')](handleError(_0x1398e8,null));};exports[_0x7d11('0xb1')]=function(_0x945c35,_0xd55b9b){_0x945c35[_0x7d11('0x58')]['userpic']=_0x945c35[_0x7d11('0xb2')][_0x7d11('0xb3')];return db[_0x7d11('0x3d')][_0x7d11('0x55')]({'where':{'id':_0x945c35[_0x7d11('0x4a')]['id']}})['then'](handleEntityNotFound(_0xd55b9b,null))['then'](saveUpdates(_0x945c35[_0x7d11('0x58')],null))[_0x7d11('0x17')](respondWithResult(_0xd55b9b,null))[_0x7d11('0x21')](handleError(_0xd55b9b,null));};exports[_0x7d11('0xb4')]=function(_0x388028,_0x3e8c11){var _0x3aceef=path[_0x7d11('0xb5')](config[_0x7d11('0xb6')],_0x7d11('0xb7'));return db[_0x7d11('0x3d')][_0x7d11('0x55')]({'where':{'id':_0x388028['params']['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x3e8c11,null))[_0x7d11('0x17')](function(_0x2ff073){if(_0x2ff073){if(_[_0x7d11('0x62')](_0x2ff073[_0x7d11('0xb8')])){return _0x3e8c11[_0x7d11('0xb9')](_0x3aceef);}else{if(!fs[_0x7d11('0xba')](path[_0x7d11('0xb5')](config[_0x7d11('0xb6')],_0x7d11('0xbb'),_0x2ff073['userpic']))){return _0x3e8c11[_0x7d11('0xb9')](_0x3aceef);}return _0x3e8c11[_0x7d11('0xb9')](path[_0x7d11('0xb5')](config['root'],_0x7d11('0xbb'),_0x2ff073[_0x7d11('0xb8')]));}}})[_0x7d11('0x21')](handleError(_0x3e8c11,null));};exports[_0x7d11('0xbc')]=function(_0x39c200,_0x250b96){return db['User'][_0x7d11('0x55')]({'where':{'id':_0x39c200['params']['id']},'attributes':['id']})[_0x7d11('0x17')](handleEntityNotFound(_0x250b96,null))[_0x7d11('0x17')](function(_0x248f58){var _0x1b65aa=[];values=_0x248f58[_0x7d11('0x46')];_0x1b65aa['push'](get_open_tabs('chat',_0x248f58['dataValues']));_0x1b65aa[_0x7d11('0x41')](get_open_tabs(_0x7d11('0x47'),_0x248f58[_0x7d11('0x46')]));_0x1b65aa[_0x7d11('0x41')](get_open_tabs(_0x7d11('0x56'),_0x248f58['dataValues']));_0x1b65aa[_0x7d11('0x41')](get_open_tabs(_0x7d11('0x48'),_0x248f58['dataValues']));_0x1b65aa[_0x7d11('0x41')](get_open_tabs(_0x7d11('0xbd'),_0x248f58[_0x7d11('0x46')]));_0x1b65aa[_0x7d11('0x41')](get_open_tabs('mail',_0x248f58['dataValues']));return BPromise[_0x7d11('0x49')](_0x1b65aa);})['then'](function(_0x10890c){var _0x58e579=[];if(_0x10890c){for(var _0x3604e7=0x0;_0x3604e7=_0x562952){_0x3233d7=_0x562952;_0x1d0d3f=0xc8;}else{_0x1d0d3f=0xce;}_0x54a8b0[_0x04c6('0x1c')](_0x1d0d3f);return _0x54a8b0['set'](_0x04c6('0x22'),_0x2ab1d2+'-'+_0x3233d7+'/'+_0x562952)[_0x04c6('0x23')](_0x348ea3);}return null;};}function saveUpdates(_0x5f1331){return function(_0x5c9003){if(_0x5c9003){return _0x5c9003[_0x04c6('0x24')](_0x5f1331)[_0x04c6('0x25')](function(_0x2a191f){return _0x2a191f;});}return null;};}function removeEntity(_0xbb9e81){return function(_0x23c500){if(_0x23c500){return _0x23c500[_0x04c6('0x26')]()['then'](function(){var _0x5d8c88=_0x23c500['get']({'plain':!![]});if(_0x5d8c88[_0x04c6('0x27')]==='admin')return;var _0x1e76e2=[{'name':_0x04c6('0x28'),'value':'user','ignore':!![]},{'name':_0x04c6('0x29'),'value':_0x04c6('0x2a'),'ignore':![]},{'name':_0x04c6('0x2b'),'value':_0x04c6('0x2c'),'ignore':![]}];var _0x5b2056=_(_0x1e76e2)[_0x04c6('0x2d')](_0x04c6('0x2e'))[_0x04c6('0x2f')](_0x04c6('0x30'))[_0x04c6('0x30')]();if(_[_0x04c6('0x31')](_0x5b2056,_0x5d8c88[_0x04c6('0x27')])){return;}var _0x46380e=_[_0x04c6('0x32')](_0x1e76e2,[_0x04c6('0x30'),_0x5d8c88[_0x04c6('0x27')]])[_0x04c6('0x33')];return db[_0x04c6('0x34')][_0x04c6('0x26')]({'where':{'type':_0x46380e,'resourceId':_0x5d8c88['id']}})[_0x04c6('0x25')](function(){return _0x23c500;});})['then'](function(){_0xbb9e81[_0x04c6('0x1c')](0xcc)[_0x04c6('0x1d')]();});}};}function handleEntityNotFound(_0x332811){return function(_0x206e32){if(!_0x206e32){_0x332811['sendStatus'](0x194);}return _0x206e32;};}function handleError(_0x181736,_0x31de0f){_0x31de0f=_0x31de0f||0x1f4;return function(_0x4e1cfa){logger['error'](_0x4e1cfa['stack']);if(_0x4e1cfa[_0x04c6('0x33')]){delete _0x4e1cfa[_0x04c6('0x33')];}_0x181736['status'](_0x31de0f)[_0x04c6('0x35')](_0x4e1cfa);};}exports['index']=function(_0x15c270,_0x1373ca){var _0x3806ea={},_0x2b28cd={'count':0x0,'rows':[]};var _0x5144f5=_(db['User'][_0x04c6('0x36')])[_0x04c6('0x2f')](function(_0x50041f){return{'name':_0x50041f[_0x04c6('0x37')],'type':_0x50041f['type']['key']};})[_0x04c6('0x2d')](function(_0x5aede6){return!_[_0x04c6('0x31')]([_0x04c6('0x38'),'salt'],_0x5aede6[_0x04c6('0x33')]);})['value']();_0x3806ea=qs[_0x04c6('0x39')](_0x5144f5,_0x15c270);var _0x39513d={'where':_0x3806ea[_0x04c6('0x3a')]};return db[_0x04c6('0x3b')][_0x04c6('0x21')](_0x39513d)['then'](function(_0x297b25){_0x2b28cd['count']=_0x297b25;if(_0x15c270[_0x04c6('0x3c')]['includeAll']){_0x3806ea[_0x04c6('0x3d')]=[{'all':!![]}];}if(!_[_0x04c6('0x31')](_0x3806ea[_0x04c6('0x3e')],'id')){_0x3806ea[_0x04c6('0x3e')][_0x04c6('0x3f')]('id');}return db[_0x04c6('0x3b')][_0x04c6('0x40')](_0x3806ea);})['then'](function(_0xdfdc34){_0x2b28cd['rows']=_0xdfdc34;if(_0x15c270[_0x04c6('0x3c')]['openTabs']==='true'){var _0x463222=[];for(var _0x58a9ad=0x0;_0x58a9ad<_0x2b28cd[_0x04c6('0x41')][_0x04c6('0x42')];_0x58a9ad++){_0x463222[_0x04c6('0x3f')](get_open_tabs('chat',_0x2b28cd[_0x04c6('0x41')][_0x58a9ad][_0x04c6('0x43')]));_0x463222[_0x04c6('0x3f')](get_open_tabs(_0x04c6('0x44'),_0x2b28cd[_0x04c6('0x41')][_0x58a9ad][_0x04c6('0x43')]));_0x463222[_0x04c6('0x3f')](get_open_tabs('fax',_0x2b28cd['rows'][_0x58a9ad][_0x04c6('0x43')]));_0x463222[_0x04c6('0x3f')](get_open_tabs(_0x04c6('0x45'),_0x2b28cd['rows'][_0x58a9ad][_0x04c6('0x43')]));_0x463222[_0x04c6('0x3f')](get_open_tabs(_0x04c6('0x46'),_0x2b28cd['rows'][_0x58a9ad]['dataValues']));_0x463222['push'](get_open_tabs(_0x04c6('0x47'),_0x2b28cd[_0x04c6('0x41')][_0x58a9ad]['dataValues']));}return BPromise[_0x04c6('0x48')](_0x463222)[_0x04c6('0x25')](function(_0x2bd045){return _0x2b28cd;});}else{return _0x2b28cd;}})['then'](respondWithFilteredResult(_0x1373ca,_0x3806ea))[_0x04c6('0x1b')](handleError(_0x1373ca,null));};exports[_0x04c6('0x49')]=function(_0x5e68e0,_0x25a6fc){var _0x203943={'raw':![],'where':{'id':_0x5e68e0[_0x04c6('0x4a')]['id']}},_0x2472ed={};_0x2472ed['model']=_[_0x04c6('0x4b')](_[_0x04c6('0x4c')](db[_0x04c6('0x3b')][_0x04c6('0x36')]),['password',_0x04c6('0x4d')]);_0x2472ed[_0x04c6('0x3c')]=_[_0x04c6('0x4c')](_0x5e68e0[_0x04c6('0x3c')]);_0x2472ed['filters']=_[_0x04c6('0x4e')](_0x2472ed[_0x04c6('0x4f')],_0x2472ed[_0x04c6('0x3c')]);_0x203943['attributes']=_[_0x04c6('0x4e')](_0x2472ed[_0x04c6('0x4f')],qs[_0x04c6('0x50')](_0x5e68e0[_0x04c6('0x3c')][_0x04c6('0x50')]));_0x203943[_0x04c6('0x3e')]=_0x203943[_0x04c6('0x3e')][_0x04c6('0x42')]?_0x203943[_0x04c6('0x3e')]:_0x2472ed[_0x04c6('0x4f')];if(_0x5e68e0[_0x04c6('0x3c')][_0x04c6('0x51')]){_0x203943[_0x04c6('0x3d')]=[{'all':!![]}];}_0x203943=_['merge']({},_0x203943,_0x5e68e0[_0x04c6('0x52')]);if(!_[_0x04c6('0x31')](_0x203943[_0x04c6('0x3e')],'id')){_0x203943[_0x04c6('0x3e')][_0x04c6('0x3f')]('id');}return db['User'][_0x04c6('0x32')](_0x203943)[_0x04c6('0x25')](handleEntityNotFound(_0x25a6fc,null))[_0x04c6('0x25')](function(_0x32d5e8){var _0x28dfd0=[];values=_0x32d5e8;if(_0x5e68e0[_0x04c6('0x3c')][_0x04c6('0x53')]===_0x04c6('0x54')){_0x28dfd0[_0x04c6('0x3f')](get_open_tabs(_0x04c6('0x55'),_0x32d5e8['dataValues']));_0x28dfd0['push'](get_open_tabs('sms',_0x32d5e8['dataValues']));_0x28dfd0[_0x04c6('0x3f')](get_open_tabs('openchannel',_0x32d5e8[_0x04c6('0x43')]));_0x28dfd0['push'](get_open_tabs(_0x04c6('0x47'),_0x32d5e8[_0x04c6('0x43')]));_0x28dfd0['push'](get_open_tabs('fax',_0x32d5e8[_0x04c6('0x43')]));_0x28dfd0[_0x04c6('0x3f')](get_open_tabs(_0x04c6('0x45'),_0x32d5e8[_0x04c6('0x43')]));return BPromise['all'](_0x28dfd0);}else{return values;}})[_0x04c6('0x25')](function(_0xf4e9d6){return values;})[_0x04c6('0x25')](respondWithResult(_0x25a6fc,null))[_0x04c6('0x1b')](handleError(_0x25a6fc,null));};exports[_0x04c6('0x24')]=function(_0x29c72f,_0x145854){if(_0x29c72f['body']['id']){delete _0x29c72f[_0x04c6('0x56')]['id'];}delete _0x29c72f['body'][_0x04c6('0x27')];return db[_0x04c6('0x3b')]['find']({'where':{'id':_0x29c72f[_0x04c6('0x4a')]['id']}})[_0x04c6('0x25')](handleEntityNotFound(_0x145854,null))[_0x04c6('0x25')](saveUpdates(_0x29c72f[_0x04c6('0x56')],null))[_0x04c6('0x25')](respondWithResult(_0x145854,null))[_0x04c6('0x1b')](handleError(_0x145854,null));};exports[_0x04c6('0x57')]=function(_0x3333a4,_0x5c51dc){return db[_0x04c6('0x3b')]['describe']()[_0x04c6('0x25')](respondWithResult(_0x5c51dc,null))[_0x04c6('0x1b')](handleError(_0x5c51dc,null));};exports['addContacts']=function(_0x503426,_0x2e649d){return db['User'][_0x04c6('0x32')]({'where':{'id':_0x503426[_0x04c6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2e649d,null))[_0x04c6('0x25')](function(_0x4520f0){if(_0x4520f0){return _0x4520f0[_0x04c6('0x58')](_0x503426[_0x04c6('0x56')][_0x04c6('0x59')],_[_0x04c6('0x5a')](_0x503426[_0x04c6('0x56')],[_0x04c6('0x59'),'id'])||{});}})[_0x04c6('0x25')](respondWithResult(_0x2e649d,null))[_0x04c6('0x1b')](handleError(_0x2e649d,null));};function validateUser(_0x2c9c36){return new BPromise(function(_0x52413f,_0x3aaa1e){if(_0x2c9c36[_0x04c6('0x5b')])return _0x52413f(_0x2c9c36);return db[_0x04c6('0x5c')][_0x04c6('0x5d')](0x1)['then'](function(_0x1598f0){if(_0x1598f0[_0x04c6('0x5e')])authService[_0x04c6('0x5f')](_0x2c9c36['password']);db['User'][_0x04c6('0x60')](_0x04c6('0x5b'))[_0x04c6('0x25')](function(_0x396f79){if(_[_0x04c6('0x61')](_0x396f79)){_0x2c9c36[_0x04c6('0x5b')]=_0x1598f0['min_internal']||0x1;return;}if(_[_0x04c6('0x61')](_0x1598f0[_0x04c6('0x62')])||_0x1598f0[_0x04c6('0x62')]===_0x396f79){_0x2c9c36['internal']=_0x396f79+0x1;return;}if(_0x1598f0['min_internal']>_0x396f79){_0x2c9c36[_0x04c6('0x5b')]=_0x1598f0[_0x04c6('0x62')];return;}return db[_0x04c6('0x63')][_0x04c6('0x3c')]('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)',{'type':db[_0x04c6('0x63')]['QueryTypes']['SELECT']})[_0x04c6('0x25')](function(_0xe178dd){if(_0xe178dd&&_0xe178dd[_0x04c6('0x42')]){for(var _0x1904d4=0x0,_0x43260e=_0xe178dd[_0x04c6('0x42')];_0x1904d4<_0x43260e&&_[_0x04c6('0x61')](_0x2c9c36['internal']);_0x1904d4++){if(_0x1598f0[_0x04c6('0x62')]<=_0xe178dd[_0x1904d4][_0x04c6('0x64')]){_0x2c9c36[_0x04c6('0x5b')]=_0xe178dd[_0x1904d4][_0x04c6('0x64')];}else if(_0x1598f0[_0x04c6('0x62')]>_0xe178dd[_0x1904d4]['from']&&_0x1598f0['min_internal']<=_0xe178dd[_0x1904d4]['to']){_0x2c9c36[_0x04c6('0x5b')]=_0x1598f0[_0x04c6('0x62')];}}}if(_[_0x04c6('0x61')](_0x2c9c36['internal'])){_0x2c9c36[_0x04c6('0x5b')]=_0x396f79+0x1;}return _0x52413f(_0x2c9c36);});});})[_0x04c6('0x1b')](function(_0x4c9507){_0x3aaa1e(_0x4c9507);});});}function updateUser(_0x12d92e){return new BPromise(function(_0x866829,_0x152a00){try{if(_0x12d92e[_0x04c6('0x65')]){_0x12d92e[_0x04c6('0x66')]=_0x12d92e[_0x04c6('0x5b')];_0x12d92e[_0x04c6('0x67')]={'mailbox':_0x12d92e[_0x04c6('0x5b')],'password':_0x12d92e[_0x04c6('0x38')],'fullname':_0x12d92e[_0x04c6('0x68')],'email':_0x12d92e[_0x04c6('0x69')]};}if(_0x12d92e[_0x04c6('0x27')]===_0x04c6('0x2a')){if(!_0x12d92e['permissions'])_0x12d92e[_0x04c6('0x6a')]=[_0x04c6('0x6b'),'102',_0x04c6('0x6c'),_0x04c6('0x6d'),_0x04c6('0x6e'),_0x04c6('0x6f'),_0x04c6('0x70'),'106',_0x04c6('0x71'),'108',_0x04c6('0x72'),'100',_0x04c6('0x73'),_0x04c6('0x74'),_0x04c6('0x75')];}_0x866829(_0x12d92e);}catch(_0x23ce75){_0x152a00(_0x23ce75);}});}exports[_0x04c6('0x76')]=function(_0x150639,_0x34f7a6){if(_0x150639[_0x04c6('0x77')][_0x04c6('0x27')]==='agent')throw new Error(_0x04c6('0x78'));if(_0x150639[_0x04c6('0x56')]['role']===_0x04c6('0x77')&&_0x150639['user'][_0x04c6('0x27')]!==_0x04c6('0x79')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x150639[_0x04c6('0x56')][_0x04c6('0x27')]==='admin'&&_0x150639[_0x04c6('0x77')][_0x04c6('0x27')]!=='admin'){throw new Error(_0x04c6('0x7a'));}return licenseUtil[_0x04c6('0x7b')]([_0x150639['body']])[_0x04c6('0x25')](function(){return validateUser(_0x150639[_0x04c6('0x56')]);})['then'](function(_0x5314ee){return updateUser(_0x5314ee)['then'](function(_0x37d3e0){if(_0x37d3e0[_0x04c6('0x27')]===_0x04c6('0x79')){_0x37d3e0[_0x04c6('0x7c')]=_0x150639[_0x04c6('0x77')]['settingsEnabled'];delete _0x37d3e0[_0x04c6('0x7d')];}return _0x37d3e0;});})[_0x04c6('0x25')](function(_0x1a5356){return db[_0x04c6('0x3b')][_0x04c6('0x76')](_0x1a5356,{'include':[{'model':db[_0x04c6('0x67')],'as':_0x04c6('0x67')}]});})['then'](function(_0x22e182){if(_0x150639['body'][_0x04c6('0x27')]==='user')return _0x22e182;if(_0x150639['user'][_0x04c6('0x27')]!=='user')return _0x22e182;return db[_0x04c6('0x7e')][_0x04c6('0x32')]({'where':{'name':_0x22e182[_0x04c6('0x27')]===_0x04c6('0x2a')?_0x04c6('0x29'):'Telephones','userProfileId':_0x150639['user'][_0x04c6('0x7d')]},'raw':!![]})[_0x04c6('0x25')](function(_0x38d8b2){if(!_0x38d8b2||_0x38d8b2[_0x04c6('0x7f')]!=0x0)return _0x22e182;return db[_0x04c6('0x34')][_0x04c6('0x76')]({'name':_0x22e182['name'],'resourceId':_0x22e182['id'],'type':_0x38d8b2[_0x04c6('0x33')],'sectionId':_0x38d8b2['id']},{})['then'](function(){return _0x22e182;});})['catch'](function(_0x866f47){logger[_0x04c6('0x18')](_0x04c6('0x80'),_0x866f47);throw _0x866f47;});})[_0x04c6('0x25')](respondWithResult(_0x34f7a6,0xc9))[_0x04c6('0x1b')](handleError(_0x34f7a6,null));};exports[_0x04c6('0x81')]=function(_0x2e65f0,_0x243553){var _0x338e58=_0x2e65f0[_0x04c6('0x56')];var _0x21dc7c=[];if(_0x2e65f0['user'][_0x04c6('0x27')]==='agent')throw new Error('Unauthorized');if(_[_0x04c6('0x82')](_0x338e58,[_0x04c6('0x27'),_0x04c6('0x77')])&&_0x2e65f0[_0x04c6('0x77')][_0x04c6('0x27')]!==_0x04c6('0x79')){throw new Error(_0x04c6('0x83'));}if(_[_0x04c6('0x82')](_0x338e58,[_0x04c6('0x27'),_0x04c6('0x79')])&&_0x2e65f0[_0x04c6('0x77')]['role']!=='admin'){throw new Error(_0x04c6('0x84'));}return licenseUtil[_0x04c6('0x7b')](_0x338e58)['then'](function(){return validateUser(_0x338e58[0x0]);})[_0x04c6('0x25')](function(){for(var _0x3addb1=0x1;_0x3addb1<_0x338e58['length'];_0x3addb1++){var _0x4504fc=_0x338e58[_0x3addb1-0x1][_0x04c6('0x5b')];if(!_0x338e58[_0x3addb1][_0x04c6('0x5b')])_0x338e58[_0x3addb1][_0x04c6('0x5b')]=_0x4504fc+0x1;_0x21dc7c[_0x04c6('0x3f')](validateUser(_0x338e58[_0x3addb1]));}return BPromise[_0x04c6('0x48')](_0x21dc7c);})[_0x04c6('0x25')](function(){_0x21dc7c=[];for(var _0x5efcc8=0x0;_0x5efcc8<_0x338e58['length'];_0x5efcc8++){_0x21dc7c[_0x04c6('0x3f')](updateUser(_0x338e58[_0x5efcc8]));}return BPromise['all'](_0x21dc7c);})[_0x04c6('0x25')](function(){return BPromise[_0x04c6('0x85')](_0x338e58,function(_0x23b79a){return db[_0x04c6('0x3b')][_0x04c6('0x76')](_0x23b79a,{'include':[{'model':db[_0x04c6('0x67')],'as':'VoiceMail'}]})[_0x04c6('0x25')](function(_0x1b7cec){_0x23b79a['id']=_0x1b7cec['id'];return _0x23b79a;});});})[_0x04c6('0x25')](function(_0x54fe47){if(_0x2e65f0['body']['role']===_0x04c6('0x77'))return _0x54fe47;if(_0x2e65f0[_0x04c6('0x77')]['role']!==_0x04c6('0x77'))return _0x54fe47;var _0x29461e=_[_0x04c6('0x82')](_0x54fe47,function(_0x5c47a4){return _0x5c47a4[_0x04c6('0x27')]==='agent'||_0x5c47a4[_0x04c6('0x27')]===_0x04c6('0x2c');});if(!_0x29461e)return _0x54fe47;return db[_0x04c6('0x7e')]['findAll']({'where':{'name':{'$or':['Agents',_0x04c6('0x2b')]},'userProfileId':_0x2e65f0[_0x04c6('0x77')][_0x04c6('0x7d')]},'raw':!![]})[_0x04c6('0x25')](function(_0x546f5d){if(_['isEmpty'](_0x546f5d)||!_[_0x04c6('0x82')](_0x546f5d,[_0x04c6('0x7f'),0x0]))return _0x54fe47;_0x21dc7c=[];var _0x91f883=_(_0x546f5d)['map'](function(_0x2c1536){if(_0x2c1536[_0x04c6('0x7f')]===0x1)return;return _0x2c1536[_0x04c6('0x33')]===_0x04c6('0x29')?_0x04c6('0x2a'):_0x04c6('0x2c');})[_0x04c6('0x86')]()[_0x04c6('0x30')]();for(var _0x2192ff=0x0;_0x2192ff<_0x54fe47[_0x04c6('0x42')];_0x2192ff++){if(!_['includes'](_0x91f883,_0x54fe47[_0x2192ff][_0x04c6('0x27')]))return;var _0x388811=_0x54fe47[_0x2192ff][_0x04c6('0x27')]===_0x04c6('0x2a')?_0x04c6('0x29'):_0x04c6('0x2b');_0x21dc7c[_0x04c6('0x3f')](db['UserProfileResource'][_0x04c6('0x76')]({'name':_0x54fe47[_0x2192ff][_0x04c6('0x33')],'resourceId':_0x54fe47[_0x2192ff]['id'],'type':_0x388811,'sectionId':_[_0x04c6('0x32')](_0x546f5d,[_0x04c6('0x33'),_0x388811])['id']},{}));}return BPromise[_0x04c6('0x48')](_0x21dc7c);});})[_0x04c6('0x25')](respondWithResult(_0x243553,0xc9))[_0x04c6('0x1b')](handleError(_0x243553,null));};exports[_0x04c6('0x87')]=function(_0x4bfb6c,_0x203630){if(_0x4bfb6c[_0x04c6('0x56')]['id']){delete _0x4bfb6c['body']['id'];}return db[_0x04c6('0x3b')][_0x04c6('0x32')]({'where':{'id':_0x4bfb6c[_0x04c6('0x4a')]['id']}})[_0x04c6('0x25')](function(_0x29b5f2){if(!_0x29b5f2)return null;if(_0x29b5f2['id']===_0x4bfb6c['user']['id']){if(!_0x4bfb6c['body'][_0x04c6('0x88')]||!_0x4bfb6c[_0x04c6('0x56')][_0x04c6('0x89')]){throw new db['Sequelize'][(_0x04c6('0x8a'))](_0x04c6('0x8b'));}if(!_0x29b5f2['authenticate'](_0x4bfb6c['body'][_0x04c6('0x88')])){throw new db[(_0x04c6('0x8c'))]['ValidationError'](_0x04c6('0x8d'));}if(_0x4bfb6c[_0x04c6('0x56')][_0x04c6('0x88')]===_0x4bfb6c[_0x04c6('0x56')]['newPassword']){throw new db[(_0x04c6('0x8c'))][(_0x04c6('0x8a'))](_0x04c6('0x8e'));}}else if(_0x4bfb6c[_0x04c6('0x77')][_0x04c6('0x27')]===_0x04c6('0x79')){if(!_0x4bfb6c['body'][_0x04c6('0x89')]){throw new db[(_0x04c6('0x8c'))][(_0x04c6('0x8a'))](_0x04c6('0x8f'));}}else if(_0x4bfb6c[_0x04c6('0x77')][_0x04c6('0x27')]===_0x04c6('0x77')){if(!_0x4bfb6c[_0x04c6('0x56')]['newPassword']){throw new db['Sequelize'][(_0x04c6('0x8a'))](_0x04c6('0x8f'));}if(_0x29b5f2[_0x04c6('0x27')]!=='agent'){throw new db[(_0x04c6('0x8c'))][(_0x04c6('0x8a'))](_0x04c6('0x78'));}}else{throw new db['Sequelize']['ValidationError'](_0x04c6('0x78'));}return _0x29b5f2;})[_0x04c6('0x25')](handleEntityNotFound(_0x203630,null))[_0x04c6('0x25')](function(_0x414e80){return db[_0x04c6('0x5c')][_0x04c6('0x90')]({'attributes':['id','securePassword','enforcePasswordHistory','passwordHistoryLimit']})[_0x04c6('0x25')](function(_0x531c75){if(_0x531c75['securePassword'])authService[_0x04c6('0x5f')](_0x4bfb6c[_0x04c6('0x56')][_0x04c6('0x89')]);if(!_0x531c75['enforcePasswordHistory']||!_0x414e80[_0x04c6('0x91')])return _0x414e80;authService[_0x04c6('0x92')](_0x4bfb6c[_0x04c6('0x56')][_0x04c6('0x89')],_0x414e80['previousPasswords'],_0x531c75['passwordHistoryLimit']);return _0x414e80;})['then'](saveUpdates({'password':_0x4bfb6c[_0x04c6('0x56')][_0x04c6('0x89')],'passwordResetAt':_0x4bfb6c['user']['id']==_0x4bfb6c['params']['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x4bfb6c[_0x04c6('0x56')]['newPassword'],_0x414e80[_0x04c6('0x91')])},null));})[_0x04c6('0x25')](respondWithResult(_0x203630,null))[_0x04c6('0x1b')](handleError(_0x203630,null));};exports[_0x04c6('0x93')]=function(_0x3906b2,_0x410bc2){var _0x59a97f=_0x3906b2[_0x04c6('0x56')][_0x04c6('0x94')];return db[_0x04c6('0x3b')][_0x04c6('0x32')]({'where':{'id':_0x3906b2[_0x04c6('0x4a')]['id']},'attributes':['id','name',_0x04c6('0x27'),_0x04c6('0x95'),_0x04c6('0x96'),'voicePause',_0x04c6('0x97')]})[_0x04c6('0x25')](handleEntityNotFound(_0x410bc2,null))[_0x04c6('0x25')](function(_0x5ee1d3){if(_0x5ee1d3){if(!utils[_0x04c6('0x98')](_0x59a97f)){throw new db[(_0x04c6('0x8c'))][(_0x04c6('0x8a'))](_0x04c6('0x99'));}return _0x5ee1d3[_0x04c6('0x9a')+_[_0x04c6('0x9b')](_0x59a97f[_0x04c6('0x9c')]())+_0x04c6('0x9d')](_0x3906b2['body'][_0x04c6('0x59')],{'penalty':_0x3906b2[_0x04c6('0x56')][_0x04c6('0x9e')]||0x0})['spread'](function(_0x55f0b9){for(var _0x4dfaa4=0x0;_0x4dfaa4<_0x3906b2[_0x04c6('0x56')][_0x04c6('0x59')][_0x04c6('0x42')];_0x4dfaa4+=0x1){var _0x579168={'UserId':Number(_0x3906b2[_0x04c6('0x4a')]['id'])};_0x579168[_[_0x04c6('0x9b')](_0x59a97f[_0x04c6('0x9c')]())+_0x04c6('0x9f')]=Number(_0x3906b2['body'][_0x04c6('0x59')][_0x4dfaa4]);socket[_0x04c6('0xa0')](_0x04c6('0x77')+_[_0x04c6('0x9b')](_0x59a97f['toLowerCase']())+_0x04c6('0xa1'),_0x579168);}return _0x55f0b9;})['then'](function(){if(_0x59a97f===_0x04c6('0xa2')){return db[_0x04c6('0xa3')]['findAll']({'where':{'id':_0x3906b2[_0x04c6('0x56')][_0x04c6('0x59')]||[]},'raw':!![],'attributes':['id',_0x04c6('0x33')]});}})['then'](function(_0x39985f){var _0x2e71fa=_0x5ee1d3[_0x04c6('0xa4')]({'plain':!![]});var _0x4fb402=[];if(_0x59a97f===_0x04c6('0xa2')&&_0x2e71fa[_0x04c6('0x27')]==='agent'&&_0x2e71fa['online']){for(var _0x487c2a=0x0;_0x487c2a<_0x39985f['length'];_0x487c2a+=0x1){_0x4fb402[_0x04c6('0x3f')]({'membername':_0x2e71fa[_0x04c6('0x33')],'UserId':_0x2e71fa['id'],'queue_name':_0x39985f[_0x487c2a]['name'],'VoiceQueueId':_0x39985f[_0x487c2a]['id'],'interface':_[_0x04c6('0x61')](_0x2e71fa[_0x04c6('0x97')])?util['format'](_0x04c6('0xa5'),_0x2e71fa[_0x04c6('0x33')]):_0x2e71fa['interface'],'paused':_0x2e71fa[_0x04c6('0xa6')]||![],'penalty':_0x3906b2[_0x04c6('0x56')][_0x04c6('0x9e')]||0x0});}return BPromise['each'](_0x4fb402,function(_0x4c616d){return db['UserVoiceQueueRt'][_0x04c6('0xa7')](_0x4c616d);});}return _0x5ee1d3;});}})[_0x04c6('0x25')](respondWithStatusCode(_0x410bc2,null))[_0x04c6('0x1b')](handleError(_0x410bc2,null));};exports['removeQueues']=function(_0x4ed0a4,_0x55c939){var _0x29e5b4;return db['User']['find']({'where':{'id':_0x4ed0a4[_0x04c6('0x4a')]['id']},'attributes':['id','name',_0x04c6('0x27')]})[_0x04c6('0x25')](handleEntityNotFound(_0x55c939,null))[_0x04c6('0x25')](function(_0x287fa8){if(_0x287fa8){_0x29e5b4=_0x287fa8;if(!_0x4ed0a4[_0x04c6('0x3c')]['channel']||!utils['isValidChannel'](_0x4ed0a4[_0x04c6('0x3c')][_0x04c6('0x94')])){throw new db[(_0x04c6('0x8c'))][(_0x04c6('0x8a'))](_0x04c6('0x99'));}return _0x287fa8[_0x04c6('0xa8')+_['capitalize'](_0x4ed0a4['query'][_0x04c6('0x94')][_0x04c6('0x9c')]())+'Queues'](_0x4ed0a4[_0x04c6('0x3c')]['ids']);}})['then'](function(_0x3a9b88){if(_[_0x04c6('0xa9')](_0x4ed0a4['query'][_0x04c6('0x59')])){for(var _0x314e68=0x0;_0x314e68<_0x4ed0a4[_0x04c6('0x3c')]['ids'][_0x04c6('0x42')];_0x314e68+=0x1){var _0x7b32e6={'UserId':Number(_0x4ed0a4[_0x04c6('0x4a')]['id'])};_0x7b32e6[_[_0x04c6('0x9b')](_0x4ed0a4[_0x04c6('0x3c')][_0x04c6('0x94')][_0x04c6('0x9c')]())+_0x04c6('0x9f')]=Number(_0x4ed0a4['query'][_0x04c6('0x59')][_0x314e68]);socket['emit'](_0x04c6('0x77')+_[_0x04c6('0x9b')](_0x4ed0a4[_0x04c6('0x3c')][_0x04c6('0x94')][_0x04c6('0x9c')]())+'Queue:remove',_0x7b32e6);}}else{var _0x7b32e6={'UserId':Number(_0x4ed0a4[_0x04c6('0x4a')]['id'])};_0x7b32e6[_['capitalize'](_0x4ed0a4[_0x04c6('0x3c')][_0x04c6('0x94')][_0x04c6('0x9c')]())+'QueueId']=Number(_0x4ed0a4[_0x04c6('0x3c')]['ids']);socket['emit'](_0x04c6('0x77')+_['capitalize'](_0x4ed0a4[_0x04c6('0x3c')][_0x04c6('0x94')][_0x04c6('0x9c')]())+'Queue:remove',_0x7b32e6);}return _0x3a9b88;})[_0x04c6('0x25')](function(){if(_0x4ed0a4['query'][_0x04c6('0x94')]==='voice'){return db['UserVoiceQueueRt'][_0x04c6('0x26')]({'where':{'UserId':_0x4ed0a4['params']['id'],'VoiceQueueId':_0x4ed0a4[_0x04c6('0x3c')][_0x04c6('0x59')]},'individualHooks':!![]})[_0x04c6('0x25')](function(){return _0x29e5b4;});}return _0x29e5b4;})[_0x04c6('0x25')](respondWithStatusCode(_0x55c939,null))[_0x04c6('0x1b')](handleError(_0x55c939,null));};exports[_0x04c6('0xaa')]=function(_0x257524,_0x81e27b){_0x257524[_0x04c6('0x56')][_0x04c6('0xab')]=_0x257524['file']['filename'];return db[_0x04c6('0x3b')][_0x04c6('0x32')]({'where':{'id':_0x257524[_0x04c6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x81e27b,null))[_0x04c6('0x25')](saveUpdates(_0x257524['body'],null))['then'](respondWithResult(_0x81e27b,null))[_0x04c6('0x1b')](handleError(_0x81e27b,null));};exports[_0x04c6('0xac')]=function(_0x3a3d48,_0xeca2d9){var _0x4bf86a=path['join'](config[_0x04c6('0xad')],_0x04c6('0xae'));return db['User'][_0x04c6('0x32')]({'where':{'id':_0x3a3d48[_0x04c6('0x4a')]['id']},'attributes':['id',_0x04c6('0xab')],'raw':!![]})['then'](handleEntityNotFound(_0xeca2d9,null))['then'](function(_0x37fbde){if(_0x37fbde){if(_[_0x04c6('0x61')](_0x37fbde[_0x04c6('0xab')])){return _0xeca2d9[_0x04c6('0xaf')](_0x4bf86a);}else{if(!fs[_0x04c6('0xb0')](path[_0x04c6('0xb1')](config[_0x04c6('0xad')],_0x04c6('0xb2'),_0x37fbde['userpic']))){return _0xeca2d9['download'](_0x4bf86a);}return _0xeca2d9['download'](path[_0x04c6('0xb1')](config[_0x04c6('0xad')],_0x04c6('0xb2'),_0x37fbde[_0x04c6('0xab')]));}}})[_0x04c6('0x1b')](handleError(_0xeca2d9,null));};exports[_0x04c6('0xb3')]=function(_0xc7dfe5,_0x53982d){return db[_0x04c6('0x3b')]['find']({'where':{'id':_0xc7dfe5['params']['id']},'attributes':['id']})[_0x04c6('0x25')](handleEntityNotFound(_0x53982d,null))[_0x04c6('0x25')](function(_0x3eac1f){var _0x10a9ae=[];values=_0x3eac1f[_0x04c6('0x43')];_0x10a9ae[_0x04c6('0x3f')](get_open_tabs(_0x04c6('0x55'),_0x3eac1f['dataValues']));_0x10a9ae['push'](get_open_tabs(_0x04c6('0x44'),_0x3eac1f[_0x04c6('0x43')]));_0x10a9ae[_0x04c6('0x3f')](get_open_tabs('openchannel',_0x3eac1f[_0x04c6('0x43')]));_0x10a9ae[_0x04c6('0x3f')](get_open_tabs(_0x04c6('0x47'),_0x3eac1f[_0x04c6('0x43')]));_0x10a9ae['push'](get_open_tabs(_0x04c6('0xb4'),_0x3eac1f[_0x04c6('0x43')]));_0x10a9ae[_0x04c6('0x3f')](get_open_tabs('mail',_0x3eac1f[_0x04c6('0x43')]));return BPromise[_0x04c6('0x48')](_0x10a9ae);})[_0x04c6('0x25')](function(_0x2cc0d2){var _0x3d6281=[];if(_0x2cc0d2){for(var _0x24e786=0x0;_0x24e786=_0x917ee6[_0x86f1('0x54')]){throw new Error(_0x86f1('0x55'));}})[_0x86f1('0xe')](function(){if(_0x1bb040){return db[_0x86f1('0x2b')][_0x86f1('0x56')]({'where':{'membername':_0x1bb040[_0x86f1('0x28')]},'individualHooks':!![]});}})['then'](function(){if(_0x1bb040){return _0x1bb040[_0x86f1('0x57')]({'raw':!![]});}})[_0x86f1('0xe')](function(_0x120fd5){if(_0x1bb040){if(_0x120fd5){var _0x4c1a59=[];_0x442253=_0x120fd5;if(_0x442253['length']){for(var _0x38fcba=0x0;_0x38fcba<_0x442253[_0x86f1('0x31')];_0x38fcba++){_0x4c1a59[_0x86f1('0x33')](db[_0x86f1('0x2b')][_0x86f1('0x58')]({'membername':_0x1bb040[_0x86f1('0x28')],'UserId':_0x1bb040['id'],'queue_name':_0x442253[_0x38fcba]['name'],'VoiceQueueId':_0x442253[_0x38fcba]['id'],'interface':_0x421b2f,'paused':_0x1bb040['loginInPause']||![],'penalty':_0x442253[_0x38fcba][_0x86f1('0x59')]||0x0}));}return BPromise[_0x86f1('0x5a')](_0x4c1a59);}}}})['then'](function(){if(_0x1bb040){return db[_0x86f1('0x2d')][_0x86f1('0x1a')]({'where':{'membername':_0x1bb040['name'],'exitAt':null}});}})[_0x86f1('0xe')](function(_0x641ca7){if(_0x1bb040){if(_0x641ca7&&_0x641ca7[_0x86f1('0x31')]){var _0x2fc0bc=[];_0x641ca7['forEach'](function(_0x2b109f){_0x2fc0bc['push'](_0x2b109f['update']({'exitAt':moment()[_0x86f1('0x2f')](_0x86f1('0x30'))}));});return BPromise['all'](_0x2fc0bc);}}})['then'](function(_0x4d8bfb){if(_0x1bb040){var _0x897cd6=[];var _0x69fae6=[];var _0x4965ea=utils[_0x86f1('0x5b')]();var _0x2b176e={'membername':_0x1bb040[_0x86f1('0x28')],'interface':_0x421b2f,'enterAt':moment()[_0x86f1('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x1bb040[_0x86f1('0x39')],'internal':_0x1bb040['internal']};_0x4965ea[_0x86f1('0x4c')](function(_0x186125){_0x897cd6[_0x86f1('0x33')](_[_0x86f1('0x5c')]({'channel':_0x186125,'type':_0x86f1('0x5d'),'data1':'callysquare','data2':_0x421b2f},_0x2b176e));if(_0x1bb040[_0x86f1('0x4f')]){_0x69fae6[_0x86f1('0x33')](_[_0x86f1('0x5c')]({'channel':_0x186125,'type':'PAUSE','data1':_0x86f1('0x5e')},_0x2b176e));}});return db[_0x86f1('0x2d')]['bulkCreate'](_0x897cd6[_0x86f1('0x5f')](_0x69fae6),{'individualHooks':!![]});}})['then'](function(){if(_0x1bb040){return _0x1bb040[_0x86f1('0x2c')]({'online':!![],'lastLoginAt':moment()[_0x86f1('0x2f')](_0x86f1('0x30')),'voicePause':_0x1bb040[_0x86f1('0x4f')]||![],'mailPause':_0x1bb040[_0x86f1('0x4f')]||![],'chatPause':_0x1bb040['loginInPause']||![],'faxPause':_0x1bb040[_0x86f1('0x4f')]||![],'smsPause':_0x1bb040[_0x86f1('0x4f')]||![],'openchannelPause':_0x1bb040[_0x86f1('0x4f')]||![],'pauseType':_0x1bb040[_0x86f1('0x4f')]?_0x86f1('0x5e'):null,'lastPauseAt':moment()[_0x86f1('0x2f')](_0x86f1('0x30')),'interface':_0x421b2f});}})[_0x86f1('0xe')](function(_0x16bdca){_0x5ee776(_0x16bdca);})[_0x86f1('0x23')](function(_0x225a4b){_0x595ced(_0x455b59[_0x86f1('0x15')](0x1f4,_0x225a4b[_0x86f1('0x17')]));});});}; \ No newline at end of file +var _0x54fa=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./user.socket','request','info','User,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetUser','User','options','raw','where','attributes','limit','include','map','model','then','ShowUser','debug','PauseUser','find','name','role','internal','interface','UserVoiceQueueRt','update','MemberReport','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','push','format','SIP/%s','body','type','DEFAULT\x20PAUSE','bulkCreate','UnpauseUser','findOne','channel','Unknown\x20channel','system','mail','chat','fax','openchannel','whatsapp','%s%s','Pause','findAll','forEach','all','LogoutUser','destroy','LoginUser','phone','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','loginInPause','UserVoiceQueue.penalty','merge','LOGIN'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x54fa,0x1c7));var _0xa54f=function(_0x44b7d6,_0x4a3f3f){_0x44b7d6=_0x44b7d6-0x0;var _0x5346f0=_0x54fa[_0x44b7d6];return _0x5346f0;};'use strict';var _=require(_0xa54f('0x0'));var util=require(_0xa54f('0x1'));var moment=require('moment');var BPromise=require(_0xa54f('0x2'));var rs=require(_0xa54f('0x3'));var fs=require('fs');var Redis=require(_0xa54f('0x4'));var db=require(_0xa54f('0x5'))['db'];var utils=require(_0xa54f('0x6'));var logger=require(_0xa54f('0x7'))(_0xa54f('0x8'));var config=require(_0xa54f('0x9'));var jayson=require(_0xa54f('0xa'));var client=jayson[_0xa54f('0xb')][_0xa54f('0xc')]({'port':0x232a});config[_0xa54f('0xd')]=_[_0xa54f('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa54f('0xf'))(new Redis(config[_0xa54f('0xd')]));require(_0xa54f('0x10'))['register'](socket);function respondWithRpcPromise(_0x3c1652,_0x591db4,_0x32ca40){return new BPromise(function(_0x35ba6f,_0x4d6e27){return client[_0xa54f('0x11')](_0x3c1652,_0x32ca40)['then'](function(_0x3508cb){logger[_0xa54f('0x12')](_0xa54f('0x13'),_0x591db4,_0xa54f('0x14'));logger['debug']('User,\x20%s,\x20%s,\x20%s',_0x591db4,_0xa54f('0x14'),JSON[_0xa54f('0x15')](_0x3508cb));if(_0x3508cb['error']){if(_0x3508cb[_0xa54f('0x16')][_0xa54f('0x17')]===0x1f4){logger['error'](_0xa54f('0x13'),_0x591db4,_0x3508cb[_0xa54f('0x16')][_0xa54f('0x18')]);return _0x4d6e27(_0x3508cb[_0xa54f('0x16')][_0xa54f('0x18')]);}logger['error']('User,\x20%s,\x20%s',_0x591db4,_0x3508cb[_0xa54f('0x16')][_0xa54f('0x18')]);return _0x35ba6f(_0x3508cb['error']['message']);}else{logger[_0xa54f('0x12')](_0xa54f('0x13'),_0x591db4,_0xa54f('0x14'));_0x35ba6f(_0x3508cb[_0xa54f('0x19')]['message']);}})[_0xa54f('0x1a')](function(_0xacf808){logger[_0xa54f('0x16')]('User,\x20%s,\x20%s',_0x591db4,_0xacf808);_0x4d6e27(_0xacf808);});});}exports[_0xa54f('0x1b')]=function(_0x56e16c){var _0x7952c6=this;return new Promise(function(_0x2e3f9e,_0x492a14){return db[_0xa54f('0x1c')]['findAll']({'raw':_0x56e16c['options']?_0x56e16c[_0xa54f('0x1d')][_0xa54f('0x1e')]===undefined?!![]:![]:!![],'where':_0x56e16c['options']?_0x56e16c[_0xa54f('0x1d')][_0xa54f('0x1f')]||null:null,'attributes':_0x56e16c[_0xa54f('0x1d')]?_0x56e16c[_0xa54f('0x1d')][_0xa54f('0x20')]||null:null,'limit':_0x56e16c[_0xa54f('0x1d')]?_0x56e16c['options'][_0xa54f('0x21')]||null:null,'include':_0x56e16c[_0xa54f('0x1d')]?_0x56e16c[_0xa54f('0x1d')][_0xa54f('0x22')]?_[_0xa54f('0x23')](_0x56e16c['options'][_0xa54f('0x22')],function(_0x1fa597){return{'model':db[_0x1fa597[_0xa54f('0x24')]],'as':_0x1fa597['as'],'attributes':_0x1fa597[_0xa54f('0x20')],'include':_0x1fa597[_0xa54f('0x22')]?_[_0xa54f('0x23')](_0x1fa597['include'],function(_0x44d2af){return{'model':db[_0x44d2af[_0xa54f('0x24')]],'as':_0x44d2af['as'],'attributes':_0x44d2af[_0xa54f('0x20')],'include':_0x44d2af[_0xa54f('0x22')]?_[_0xa54f('0x23')](_0x44d2af[_0xa54f('0x22')],function(_0x25f798){return{'model':db[_0x25f798['model']],'as':_0x25f798['as'],'attributes':_0x25f798[_0xa54f('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa54f('0x25')](function(_0x525fa2){logger[_0xa54f('0x12')](_0xa54f('0x1b'),_0x56e16c);logger['debug'](_0xa54f('0x1b'),_0x56e16c,JSON[_0xa54f('0x15')](_0x525fa2));_0x2e3f9e(_0x525fa2);})[_0xa54f('0x1a')](function(_0x214cb9){logger['error']('GetUser',_0x214cb9['message'],_0x56e16c);_0x492a14(_0x7952c6[_0xa54f('0x16')](0x1f4,_0x214cb9[_0xa54f('0x18')]));});});};exports['ShowUser']=function(_0x17aea0){var _0x718171=this;return new Promise(function(_0x4c32be,_0x38d302){return db[_0xa54f('0x1c')]['find']({'raw':_0x17aea0[_0xa54f('0x1d')]?_0x17aea0['options'][_0xa54f('0x1e')]===undefined?!![]:![]:!![],'where':_0x17aea0[_0xa54f('0x1d')]?_0x17aea0[_0xa54f('0x1d')][_0xa54f('0x1f')]||null:null,'attributes':_0x17aea0[_0xa54f('0x1d')]?_0x17aea0['options'][_0xa54f('0x20')]||null:null,'include':_0x17aea0[_0xa54f('0x1d')]?_0x17aea0[_0xa54f('0x1d')][_0xa54f('0x22')]?_['map'](_0x17aea0['options'][_0xa54f('0x22')],function(_0x20f10f){return{'model':db[_0x20f10f['model']],'as':_0x20f10f['as'],'attributes':_0x20f10f['attributes'],'include':_0x20f10f[_0xa54f('0x22')]?_[_0xa54f('0x23')](_0x20f10f[_0xa54f('0x22')],function(_0x4a9ad8){return{'model':db[_0x4a9ad8[_0xa54f('0x24')]],'as':_0x4a9ad8['as'],'attributes':_0x4a9ad8[_0xa54f('0x20')],'include':_0x4a9ad8[_0xa54f('0x22')]?_[_0xa54f('0x23')](_0x4a9ad8['include'],function(_0x9dc66e){return{'model':db[_0x9dc66e[_0xa54f('0x24')]],'as':_0x9dc66e['as'],'attributes':_0x9dc66e[_0xa54f('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa54f('0x25')](function(_0x59695c){logger[_0xa54f('0x12')](_0xa54f('0x26'),_0x17aea0);logger[_0xa54f('0x27')](_0xa54f('0x26'),_0x17aea0,JSON[_0xa54f('0x15')](_0x59695c));_0x4c32be(_0x59695c);})[_0xa54f('0x1a')](function(_0x3415ba){logger[_0xa54f('0x16')](_0xa54f('0x26'),_0x3415ba[_0xa54f('0x18')],_0x17aea0);_0x38d302(_0x718171[_0xa54f('0x16')](0x1f4,_0x3415ba[_0xa54f('0x18')]));});});};exports[_0xa54f('0x28')]=function(_0x15974c){var _0x3a8bc1=this;return new Promise(function(_0x541fba,_0x3859ec){var _0x235102;return db['User'][_0xa54f('0x29')]({'where':_0x15974c['options']['where']||{},'attributes':['id',_0xa54f('0x2a'),_0xa54f('0x2b'),_0xa54f('0x2c'),_0xa54f('0x2d')]})[_0xa54f('0x25')](function(_0x4a139b){if(_0x4a139b){_0x235102=_0x4a139b;return db[_0xa54f('0x2e')][_0xa54f('0x2f')]({'paused':0x1},{'where':{'UserId':_0x235102['id']},'individualHooks':!![]});}})[_0xa54f('0x25')](function(){if(_0x235102){return db[_0xa54f('0x30')]['findAll']({'where':{'membername':_0x235102[_0xa54f('0x2a')],'type':_0xa54f('0x31'),'exitAt':null}});}})[_0xa54f('0x25')](function(_0x1fc286){if(_0x235102){if(_0x1fc286&&_0x1fc286[_0xa54f('0x32')]){var _0xace988=moment()['format'](_0xa54f('0x33'));for(var _0x2fc0c4=0x0,_0x507032=_0x1fc286[_0xa54f('0x32')];_0x2fc0c4<_0x507032;_0x2fc0c4++){_0x1fc286[_0x2fc0c4][_0xa54f('0x34')]({'exitAt':_0xace988});}}}})[_0xa54f('0x25')](function(){if(_0x235102){var _0x42d98f=[];var _0x5a8975=utils[_0xa54f('0x35')]();_0x5a8975['forEach'](function(_0x43a0c8){_0x42d98f[_0xa54f('0x36')]({'channel':_0x43a0c8,'membername':_0x235102[_0xa54f('0x2a')],'interface':_['isNil'](_0x235102[_0xa54f('0x2d')])?util[_0xa54f('0x37')](_0xa54f('0x38'),_0x235102[_0xa54f('0x2a')]):_0x235102[_0xa54f('0x2d')],'type':'PAUSE','enterAt':moment()[_0xa54f('0x37')](_0xa54f('0x33')),'data1':_0x15974c[_0xa54f('0x39')][_0xa54f('0x3a')]||_0xa54f('0x3b'),'role':_0x235102[_0xa54f('0x2b')],'internal':_0x235102['internal'],'uniqueid':_0x15974c[_0xa54f('0x39')]['uniqueid']||null});});return db[_0xa54f('0x30')][_0xa54f('0x3c')](_0x42d98f,{'individualHooks':!![]});}})[_0xa54f('0x25')](function(){if(_0x235102){return _0x235102['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x15974c['body'][_0xa54f('0x3a')]||_0xa54f('0x3b'),'lastPauseAt':moment()['format'](_0xa54f('0x33'))});}})[_0xa54f('0x25')](function(_0x10a972){_0x541fba(_0x10a972);})[_0xa54f('0x1a')](function(_0x3fc586){_0x3859ec(_0x3a8bc1['error'](0x1f4,_0x3fc586[_0xa54f('0x18')]));});});};exports[_0xa54f('0x3d')]=function(_0x7f93a){var _0x2bd753=this;return new Promise(function(_0x3eb657,_0x47423e){var _0x2a52bf;return db[_0xa54f('0x1c')][_0xa54f('0x3e')]({'where':_0x7f93a[_0xa54f('0x1d')]['where']||{},'attributes':['id',_0xa54f('0x2a')]})[_0xa54f('0x25')](function(_0x2bbd76){if(_0x2bbd76){_0x2a52bf=_0x2bbd76;if(_0x7f93a['body']['channel']&&!utils['isValidChannel'](_0x7f93a['body'][_0xa54f('0x3f')])){throw new Error(_0xa54f('0x40'));}switch(_0x7f93a['body'][_0xa54f('0x3f')]){case'voice':return db[_0xa54f('0x2e')][_0xa54f('0x2f')]({'paused':0x0},{'where':{'UserId':_0x2a52bf['id']}})[_0xa54f('0x25')](function(){return db[_0xa54f('0x30')][_0xa54f('0x29')]({'where':{'channel':_0x7f93a['body'][_0xa54f('0x3f')],'membername':_0x2a52bf['name'],'type':_0xa54f('0x31'),'exitAt':null}});})[_0xa54f('0x25')](function(_0x3fe0ec){if(_0x3fe0ec){return _0x3fe0ec['update']({'exitAt':moment()[_0xa54f('0x37')](_0xa54f('0x33')),'data2':_0xa54f('0x41')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x2a52bf['update']({'voicePause':![]});});case _0xa54f('0x42'):case _0xa54f('0x43'):case _0xa54f('0x44'):case'sms':case _0xa54f('0x45'):case _0xa54f('0x46'):return db[_0xa54f('0x30')][_0xa54f('0x29')]({'where':{'channel':_0x7f93a[_0xa54f('0x39')][_0xa54f('0x3f')],'membername':_0x2a52bf[_0xa54f('0x2a')],'type':_0xa54f('0x31'),'exitAt':null}})['then'](function(_0x1aaf18){return _0x1aaf18[_0xa54f('0x2f')]({'exitAt':moment()['format'](_0xa54f('0x33')),'data2':_0xa54f('0x41')},{'individualHooks':!![]});})['then'](function(){var _0x4a49d5={};_['set'](_0x4a49d5,util[_0xa54f('0x37')](_0xa54f('0x47'),_0x7f93a[_0xa54f('0x39')]['channel'],_0xa54f('0x48')),![]);return _0x2a52bf[_0xa54f('0x2f')](_0x4a49d5);});default:return db[_0xa54f('0x2e')][_0xa54f('0x2f')]({'paused':0x0},{'where':{'UserId':_0x2a52bf['id']}})['then'](function(){return db[_0xa54f('0x30')][_0xa54f('0x49')]({'where':{'membername':_0x2a52bf[_0xa54f('0x2a')],'type':_0xa54f('0x31'),'exitAt':null}});})[_0xa54f('0x25')](function(_0x1ede31){var _0x2c3470=[];_0x1ede31[_0xa54f('0x4a')](function(_0x1c1918){_0x2c3470[_0xa54f('0x36')](_0x1c1918[_0xa54f('0x2f')]({'exitAt':moment()[_0xa54f('0x37')](_0xa54f('0x33')),'data2':_0xa54f('0x41')}));});return BPromise[_0xa54f('0x4b')](_0x2c3470);})[_0xa54f('0x25')](function(){return _0x2a52bf[_0xa54f('0x2f')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xa54f('0x25')](function(_0x4cecf8){_0x3eb657(_0x4cecf8);})['catch'](function(_0x2b0d68){_0x47423e(_0x2bd753['error'](0x1f4,_0x2b0d68[_0xa54f('0x18')]));});});};exports[_0xa54f('0x4c')]=function(_0x58dc42){var _0x1d7b86=this;return new Promise(function(_0x377a3f,_0x438622){var _0xe6c176;return db[_0xa54f('0x1c')]['findOne']({'where':_0x58dc42['options'][_0xa54f('0x1f')]||{},'attributes':['id',_0xa54f('0x2a')]})[_0xa54f('0x25')](function(_0x7ba212){if(_0x7ba212){_0xe6c176=_0x7ba212;return db[_0xa54f('0x2e')][_0xa54f('0x4d')]({'where':{'membername':_0xe6c176[_0xa54f('0x2a')]},'individualHooks':!![]});}})[_0xa54f('0x25')](function(){if(_0xe6c176){return db[_0xa54f('0x30')]['findAll']({'where':{'membername':_0xe6c176[_0xa54f('0x2a')],'exitAt':null}});}})['then'](function(_0x2025cc){if(_0xe6c176){if(_0x2025cc&&_0x2025cc['length']){var _0x2910b2=[];_0x2025cc[_0xa54f('0x4a')](function(_0x4b8ea6){_0x2910b2[_0xa54f('0x36')](_0x4b8ea6['update']({'exitAt':moment()[_0xa54f('0x37')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xa54f('0x4b')](_0x2910b2);}}})[_0xa54f('0x25')](function(){if(_0xe6c176){return _0xe6c176[_0xa54f('0x2f')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xa54f('0x25')](function(_0x352645){_0x377a3f(_0x352645);})[_0xa54f('0x1a')](function(_0x2b1540){_0x438622(_0x1d7b86['error'](0x1f4,_0x2b1540[_0xa54f('0x18')]));});});};exports[_0xa54f('0x4e')]=function(_0x276ef2){var _0x74026f=this;return new Promise(function(_0x2773bb,_0x5c6401){var _0x5ed39b;var _0x497179;var _0xddeff3;var _0x3762b6;return db[_0xa54f('0x1c')][_0xa54f('0x3e')]({'where':_0x276ef2[_0xa54f('0x1d')][_0xa54f('0x1f')]||{},'attributes':['id',_0xa54f('0x2a'),_0xa54f('0x2b'),'mobile',_0xa54f('0x4f'),_0xa54f('0x2c'),'loginInPause',_0xa54f('0x2d')]})[_0xa54f('0x25')](function(_0x11ea9b){if(_0x11ea9b){_0x5ed39b=_0x11ea9b;_0x3762b6=_0x276ef2['body'][_0xa54f('0x2d')]?_0x276ef2[_0xa54f('0x39')][_0xa54f('0x2d')]:util[_0xa54f('0x37')](_0xa54f('0x38'),_0x5ed39b[_0xa54f('0x2a')]);return db['User'][_0xa54f('0x50')]({'where':{'role':_0xa54f('0x51'),'online':!![],'id':{'$ne':_0x5ed39b['id']}}});}})[_0xa54f('0x25')](function(_0x59cf20){if(_0x59cf20){_0xddeff3=_0x59cf20;return require(_0xa54f('0x52'))[_0xa54f('0x53')]();}})['then'](function(_0x2396f0){if(_0x2396f0&&_0x2396f0[_0xa54f('0x54')]&&_0xddeff3>=_0x2396f0[_0xa54f('0x54')]){throw new Error(_0xa54f('0x55'));}})[_0xa54f('0x25')](function(){if(_0x5ed39b){return db[_0xa54f('0x2e')][_0xa54f('0x4d')]({'where':{'membername':_0x5ed39b[_0xa54f('0x2a')]},'individualHooks':!![]});}})['then'](function(){if(_0x5ed39b){return _0x5ed39b[_0xa54f('0x56')]({'raw':!![]});}})[_0xa54f('0x25')](function(_0x1f5653){if(_0x5ed39b){if(_0x1f5653){var _0x322485=[];_0x497179=_0x1f5653;if(_0x497179[_0xa54f('0x32')]){for(var _0x4e739b=0x0;_0x4e739b<_0x497179['length'];_0x4e739b++){_0x322485[_0xa54f('0x36')](db[_0xa54f('0x2e')]['upsert']({'membername':_0x5ed39b[_0xa54f('0x2a')],'UserId':_0x5ed39b['id'],'queue_name':_0x497179[_0x4e739b][_0xa54f('0x2a')],'VoiceQueueId':_0x497179[_0x4e739b]['id'],'interface':_0x3762b6,'paused':_0x5ed39b[_0xa54f('0x57')]||![],'penalty':_0x497179[_0x4e739b][_0xa54f('0x58')]||0x0}));}return BPromise[_0xa54f('0x4b')](_0x322485);}}}})['then'](function(){if(_0x5ed39b){return db[_0xa54f('0x30')][_0xa54f('0x49')]({'where':{'membername':_0x5ed39b[_0xa54f('0x2a')],'exitAt':null}});}})[_0xa54f('0x25')](function(_0x332e8d){if(_0x5ed39b){if(_0x332e8d&&_0x332e8d[_0xa54f('0x32')]){var _0x518005=[];_0x332e8d[_0xa54f('0x4a')](function(_0x5c31d5){_0x518005[_0xa54f('0x36')](_0x5c31d5[_0xa54f('0x2f')]({'exitAt':moment()[_0xa54f('0x37')](_0xa54f('0x33'))}));});return BPromise['all'](_0x518005);}}})['then'](function(_0x35df6b){if(_0x5ed39b){var _0x4f5877=[];var _0x5473a2=[];var _0x1b67ad=utils[_0xa54f('0x35')]();var _0x5e3e41={'membername':_0x5ed39b[_0xa54f('0x2a')],'interface':_0x3762b6,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x5ed39b[_0xa54f('0x2b')],'internal':_0x5ed39b['internal']};_0x1b67ad[_0xa54f('0x4a')](function(_0x360581){_0x4f5877[_0xa54f('0x36')](_[_0xa54f('0x59')]({'channel':_0x360581,'type':_0xa54f('0x5a'),'data1':'callysquare','data2':_0x3762b6},_0x5e3e41));if(_0x5ed39b[_0xa54f('0x57')]){_0x5473a2['push'](_[_0xa54f('0x59')]({'channel':_0x360581,'type':_0xa54f('0x31'),'data1':'LOGININPAUSE'},_0x5e3e41));}});return db[_0xa54f('0x30')]['bulkCreate'](_0x4f5877['concat'](_0x5473a2),{'individualHooks':!![]});}})[_0xa54f('0x25')](function(){if(_0x5ed39b){return _0x5ed39b['update']({'online':!![],'lastLoginAt':moment()[_0xa54f('0x37')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x5ed39b[_0xa54f('0x57')]||![],'mailPause':_0x5ed39b[_0xa54f('0x57')]||![],'chatPause':_0x5ed39b[_0xa54f('0x57')]||![],'faxPause':_0x5ed39b['loginInPause']||![],'smsPause':_0x5ed39b[_0xa54f('0x57')]||![],'openchannelPause':_0x5ed39b[_0xa54f('0x57')]||![],'pauseType':_0x5ed39b[_0xa54f('0x57')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xa54f('0x37')](_0xa54f('0x33')),'interface':_0x3762b6});}})[_0xa54f('0x25')](function(_0x1ae35c){_0x2773bb(_0x1ae35c);})[_0xa54f('0x1a')](function(_0x3e0867){_0x5c6401(_0x74026f[_0xa54f('0x16')](0x1f4,_0x3e0867[_0xa54f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index d218df1..eee68bb 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 _0xb3d6=['length','./user.events','save','remove','update','removeListener','register'];(function(_0x10cba9,_0x4c22b1){var _0x255cad=function(_0x40c4a2){while(--_0x40c4a2){_0x10cba9['push'](_0x10cba9['shift']());}};_0x255cad(++_0x4c22b1);}(_0xb3d6,0x12e));var _0x6b3d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb3d6[_0xa464c9];return _0x3d73c4;};'use strict';var UserEvents=require(_0x6b3d('0x0'));var events=[_0x6b3d('0x1'),_0x6b3d('0x2'),_0x6b3d('0x3')];function createListener(_0x1ae7f8,_0x2067b1){return function(_0x46b5a1){_0x2067b1['emit'](_0x1ae7f8,_0x46b5a1);};}function removeListener(_0x198114,_0x76baf4){return function(){UserEvents[_0x6b3d('0x4')](_0x198114,_0x76baf4);};}exports[_0x6b3d('0x5')]=function(_0x3acc99){for(var _0x23e480=0x0,_0x27bc29=events[_0x6b3d('0x6')];_0x23e480<_0x27bc29;_0x23e480++){var _0x377f76=events[_0x23e480];var _0x1ba64a=createListener('user:'+_0x377f76,_0x3acc99);UserEvents['on'](_0x377f76,_0x1ba64a);}}; \ No newline at end of file +var _0x6420=['./user.events','save','update','removeListener','register','length'];(function(_0x15ed84,_0x589521){var _0x426d2b=function(_0x5d294a){while(--_0x5d294a){_0x15ed84['push'](_0x15ed84['shift']());}};_0x426d2b(++_0x589521);}(_0x6420,0xe4));var _0x0642=function(_0x9729d7,_0x1b79a8){_0x9729d7=_0x9729d7-0x0;var _0x3c4ac6=_0x6420[_0x9729d7];return _0x3c4ac6;};'use strict';var UserEvents=require(_0x0642('0x0'));var events=[_0x0642('0x1'),'remove',_0x0642('0x2')];function createListener(_0xf9df62,_0x20a20d){return function(_0x3b44a3){_0x20a20d['emit'](_0xf9df62,_0x3b44a3);};}function removeListener(_0x151d3e,_0x664471){return function(){UserEvents[_0x0642('0x3')](_0x151d3e,_0x664471);};}exports[_0x0642('0x4')]=function(_0x47f0fa){for(var _0x47a6de=0x0,_0x19bc86=events[_0x0642('0x5')];_0x47a6de<_0x19bc86;_0x47a6de++){var _0x5684e9=events[_0x47a6de];var _0x1d72b6=createListener('user:'+_0x5684e9,_0x47f0fa);UserEvents['on'](_0x5684e9,_0x1d72b6);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index f18fc0a..72125cc 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4bd950,_0x184ed5){var _0x5dc59a=function(_0x6ff30f){while(--_0x6ff30f){_0x4bd950['push'](_0x4bd950['shift']());}};_0x5dc59a(++_0x184ed5);}(_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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x36923f,_0x3caad1){var _0x56bab1=function(_0x46ab96){while(--_0x46ab96){_0x36923f['push'](_0x36923f['shift']());}};_0x56bab1(++_0x3caad1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 004d1f7..d2ab47d 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 _0x5511=['sequelize','exports','INTEGER'];(function(_0x2666ab,_0x210d73){var _0x182e4f=function(_0x361868){while(--_0x361868){_0x2666ab['push'](_0x2666ab['shift']());}};_0x182e4f(++_0x210d73);}(_0x5511,0x10b));var _0x1551=function(_0x1843d6,_0xa5a262){_0x1843d6=_0x1843d6-0x0;var _0xa8ae52=_0x5511[_0x1843d6];return _0xa8ae52;};'use strict';var Sequelize=require(_0x1551('0x0'));module[_0x1551('0x1')]={'penalty':{'type':Sequelize[_0x1551('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc439=['sequelize','exports','INTEGER'];(function(_0x3005d5,_0xf588c7){var _0x547c7e=function(_0x4514dc){while(--_0x4514dc){_0x3005d5['push'](_0x3005d5['shift']());}};_0x547c7e(++_0xf588c7);}(_0xc439,0x174));var _0x9c43=function(_0x5da7db,_0x23d34c){_0x5da7db=_0x5da7db-0x0;var _0x2c3f2d=_0xc439[_0x5da7db];return _0x2c3f2d;};'use strict';var Sequelize=require(_0x9c43('0x0'));module[_0x9c43('0x1')]={'penalty':{'type':Sequelize[_0x9c43('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 c169fad..319e694 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 _0xb898=['UserChatQueue','user_has_chat_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userChatQueue.attributes'];(function(_0x454f1e,_0x287ec6){var _0x613cea=function(_0x216aa5){while(--_0x216aa5){_0x454f1e['push'](_0x454f1e['shift']());}};_0x613cea(++_0x287ec6);}(_0xb898,0x14c));var _0x8b89=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xb898[_0x432682];return _0x463d05;};'use strict';var _=require(_0x8b89('0x0'));var util=require('util');var logger=require(_0x8b89('0x1'))(_0x8b89('0x2'));var moment=require(_0x8b89('0x3'));var BPromise=require(_0x8b89('0x4'));var rp=require(_0x8b89('0x5'));var fs=require('fs');var path=require(_0x8b89('0x6'));var rimraf=require(_0x8b89('0x7'));var config=require('../../config/environment');var attributes=require(_0x8b89('0x8'));module['exports']=function(_0x414c2c,_0x469cd9){return _0x414c2c['define'](_0x8b89('0x9'),attributes,{'tableName':_0x8b89('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbc0=['user_has_chat_queues','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userChatQueue.attributes','exports','define'];(function(_0x14a396,_0x8f50d2){var _0x100c25=function(_0x2a90cd){while(--_0x2a90cd){_0x14a396['push'](_0x14a396['shift']());}};_0x100c25(++_0x8f50d2);}(_0xcbc0,0x1b9));var _0x0cbc=function(_0x101aea,_0x5d0370){_0x101aea=_0x101aea-0x0;var _0x14d8d6=_0xcbc0[_0x101aea];return _0x14d8d6;};'use strict';var _=require('lodash');var util=require(_0x0cbc('0x0'));var logger=require(_0x0cbc('0x1'))(_0x0cbc('0x2'));var moment=require('moment');var BPromise=require(_0x0cbc('0x3'));var rp=require(_0x0cbc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0cbc('0x5'));var config=require(_0x0cbc('0x6'));var attributes=require(_0x0cbc('0x7'));module[_0x0cbc('0x8')]=function(_0x4f71b1,_0x345042){return _0x4f71b1[_0x0cbc('0x9')]('UserChatQueue',attributes,{'tableName':_0x0cbc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 4abded1..e287843 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 _0x9aa8=['request\x20sent','debug','stringify','error','message','info','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','UserChatQueue,\x20%s,\x20%s'];(function(_0x337449,_0x24a2d3){var _0x3a0bbc=function(_0x3d43dc){while(--_0x3d43dc){_0x337449['push'](_0x337449['shift']());}};_0x3a0bbc(++_0x24a2d3);}(_0x9aa8,0x137));var _0x89aa=function(_0x28c125,_0x32bac2){_0x28c125=_0x28c125-0x0;var _0xe264de=_0x9aa8[_0x28c125];return _0xe264de;};'use strict';var _=require('lodash');var util=require(_0x89aa('0x0'));var moment=require(_0x89aa('0x1'));var BPromise=require(_0x89aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x89aa('0x3'));var db=require(_0x89aa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x89aa('0x5'))(_0x89aa('0x6'));var config=require(_0x89aa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x89aa('0x8')][_0x89aa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e5599,_0x3d52a7,_0x4a99cc){return new BPromise(function(_0x1c3ec1,_0x497593){return client['request'](_0x5e5599,_0x4a99cc)[_0x89aa('0xa')](function(_0x31f9f6){logger['info'](_0x89aa('0xb'),_0x3d52a7,_0x89aa('0xc'));logger[_0x89aa('0xd')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x3d52a7,'request\x20sent',JSON[_0x89aa('0xe')](_0x31f9f6));if(_0x31f9f6[_0x89aa('0xf')]){if(_0x31f9f6['error']['code']===0x1f4){logger[_0x89aa('0xf')](_0x89aa('0xb'),_0x3d52a7,_0x31f9f6['error'][_0x89aa('0x10')]);return _0x497593(_0x31f9f6[_0x89aa('0xf')]['message']);}logger['error'](_0x89aa('0xb'),_0x3d52a7,_0x31f9f6['error'][_0x89aa('0x10')]);return _0x1c3ec1(_0x31f9f6[_0x89aa('0xf')]['message']);}else{logger[_0x89aa('0x11')](_0x89aa('0xb'),_0x3d52a7,_0x89aa('0xc'));_0x1c3ec1(_0x31f9f6['result'][_0x89aa('0x10')]);}})[_0x89aa('0x12')](function(_0xf4288c){logger[_0x89aa('0xf')](_0x89aa('0xb'),_0x3d52a7,_0xf4288c);_0x497593(_0xf4288c);});});} \ No newline at end of file +var _0x6d96=['error','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x29cb64,_0x53cb46){var _0x4e6010=function(_0x2a885d){while(--_0x2a885d){_0x29cb64['push'](_0x29cb64['shift']());}};_0x4e6010(++_0x53cb46);}(_0x6d96,0x10e));var _0x66d9=function(_0x3a3d83,_0x419a5a){_0x3a3d83=_0x3a3d83-0x0;var _0x2b9c43=_0x6d96[_0x3a3d83];return _0x2b9c43;};'use strict';var _=require(_0x66d9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x66d9('0x1'));var fs=require('fs');var Redis=require(_0x66d9('0x2'));var db=require(_0x66d9('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x66d9('0x4'))(_0x66d9('0x5'));var config=require(_0x66d9('0x6'));var jayson=require(_0x66d9('0x7'));var client=jayson[_0x66d9('0x8')][_0x66d9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30dde2,_0x10e90e,_0x465f5a){return new BPromise(function(_0x61ffbd,_0x366d75){return client['request'](_0x30dde2,_0x465f5a)[_0x66d9('0xa')](function(_0x4a7199){logger[_0x66d9('0xb')](_0x66d9('0xc'),_0x10e90e,_0x66d9('0xd'));logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x10e90e,_0x66d9('0xd'),JSON[_0x66d9('0xe')](_0x4a7199));if(_0x4a7199[_0x66d9('0xf')]){if(_0x4a7199[_0x66d9('0xf')]['code']===0x1f4){logger[_0x66d9('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x10e90e,_0x4a7199['error'][_0x66d9('0x10')]);return _0x366d75(_0x4a7199[_0x66d9('0xf')][_0x66d9('0x10')]);}logger[_0x66d9('0xf')](_0x66d9('0xc'),_0x10e90e,_0x4a7199['error'][_0x66d9('0x10')]);return _0x61ffbd(_0x4a7199[_0x66d9('0xf')][_0x66d9('0x10')]);}else{logger[_0x66d9('0xb')](_0x66d9('0xc'),_0x10e90e,_0x66d9('0xd'));_0x61ffbd(_0x4a7199[_0x66d9('0x11')][_0x66d9('0x10')]);}})[_0x66d9('0x12')](function(_0x2607c8){logger['error'](_0x66d9('0xc'),_0x10e90e,_0x2607c8);_0x366d75(_0x2607c8);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index ab161a3..6809681 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1264a5,_0x4d86ad){var _0x123f7a=function(_0x24551d){while(--_0x24551d){_0x1264a5['push'](_0x1264a5['shift']());}};_0x123f7a(++_0x4d86ad);}(_0x70e0,0x17b));var _0x070e=function(_0x219e29,_0x334cc5){_0x219e29=_0x219e29-0x0;var _0x4cdb46=_0x70e0[_0x219e29];return _0x4cdb46;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3bbb66,_0x280aa2){var _0x872225=function(_0x1725e6){while(--_0x1725e6){_0x3bbb66['push'](_0x3bbb66['shift']());}};_0x872225(++_0x280aa2);}(_0x9c44,0x178));var _0x49c4=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x9c44[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index ec26d84..507629f 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 _0x833a=['sequelize','exports'];(function(_0x188cc4,_0x16289f){var _0x327b03=function(_0x17689c){while(--_0x17689c){_0x188cc4['push'](_0x188cc4['shift']());}};_0x327b03(++_0x16289f);}(_0x833a,0xc8));var _0xa833=function(_0x4c26e,_0x4920d2){_0x4c26e=_0x4c26e-0x0;var _0x58f12e=_0x833a[_0x4c26e];return _0x58f12e;};'use strict';var Sequelize=require(_0xa833('0x0'));module[_0xa833('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa99a=['exports','INTEGER','STRING','sequelize'];(function(_0x4aeab5,_0x9e37c4){var _0xcd3269=function(_0x1c671a){while(--_0x1c671a){_0x4aeab5['push'](_0x4aeab5['shift']());}};_0xcd3269(++_0x9e37c4);}(_0xa99a,0xd3));var _0xaa99=function(_0x566ad2,_0x32c79){_0x566ad2=_0x566ad2-0x0;var _0x5aa2f4=_0xa99a[_0x566ad2];return _0x5aa2f4;};'use strict';var Sequelize=require(_0xaa99('0x0'));module[_0xaa99('0x1')]={'penalty':{'type':Sequelize[_0xaa99('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xaa99('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xaa99('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 7c0c23c..1afe412 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 _0x89c5=['exports','define','UserFaxQueue','user_has_fax_queues','util','../../config/logger','api','bluebird','../../config/environment','./userFaxQueue.attributes'];(function(_0x5c14f6,_0x2979d8){var _0x4949b3=function(_0xcc4206){while(--_0xcc4206){_0x5c14f6['push'](_0x5c14f6['shift']());}};_0x4949b3(++_0x2979d8);}(_0x89c5,0x130));var _0x589c=function(_0x479877,_0x29dfe7){_0x479877=_0x479877-0x0;var _0x51b454=_0x89c5[_0x479877];return _0x51b454;};'use strict';var _=require('lodash');var util=require(_0x589c('0x0'));var logger=require(_0x589c('0x1'))(_0x589c('0x2'));var moment=require('moment');var BPromise=require(_0x589c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x589c('0x4'));var attributes=require(_0x589c('0x5'));module[_0x589c('0x6')]=function(_0x3408d2,_0x53fce8){return _0x3408d2[_0x589c('0x7')](_0x589c('0x8'),attributes,{'tableName':_0x589c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1e8=['../../config/logger','moment','path','./userFaxQueue.attributes','exports','UserFaxQueue','user_has_fax_queues','lodash','util'];(function(_0x267ced,_0x4ed942){var _0x2dc8aa=function(_0x16bf91){while(--_0x16bf91){_0x267ced['push'](_0x267ced['shift']());}};_0x2dc8aa(++_0x4ed942);}(_0xd1e8,0x1d2));var _0x8d1e=function(_0x4d04d6,_0x38ae19){_0x4d04d6=_0x4d04d6-0x0;var _0x2e937a=_0xd1e8[_0x4d04d6];return _0x2e937a;};'use strict';var _=require(_0x8d1e('0x0'));var util=require(_0x8d1e('0x1'));var logger=require(_0x8d1e('0x2'))('api');var moment=require(_0x8d1e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8d1e('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8d1e('0x5'));module[_0x8d1e('0x6')]=function(_0xf02f43,_0x5a1ce3){return _0xf02f43['define'](_0x8d1e('0x7'),attributes,{'tableName':_0x8d1e('0x8'),'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 6518235..05c8225 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 _0xc14c=['../../config/logger','../../config/environment','client','request','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x370e6c,_0x2f95ec){var _0x51d351=function(_0x54161f){while(--_0x54161f){_0x370e6c['push'](_0x370e6c['shift']());}};_0x51d351(++_0x2f95ec);}(_0xc14c,0x1da));var _0xcc14=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xc14c[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xcc14('0x0'));var util=require(_0xcc14('0x1'));var moment=require(_0xcc14('0x2'));var BPromise=require('bluebird');var rs=require(_0xcc14('0x3'));var fs=require('fs');var Redis=require(_0xcc14('0x4'));var db=require(_0xcc14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc14('0x6'))('rpc');var config=require(_0xcc14('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcc14('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58d43d,_0x3630af,_0x3227e6){return new BPromise(function(_0x5da6d2,_0x20cf13){return client[_0xcc14('0x9')](_0x58d43d,_0x3227e6)[_0xcc14('0xa')](function(_0x5c32ec){logger['info'](_0xcc14('0xb'),_0x3630af,_0xcc14('0xc'));logger[_0xcc14('0xd')](_0xcc14('0xe'),_0x3630af,_0xcc14('0xc'),JSON['stringify'](_0x5c32ec));if(_0x5c32ec[_0xcc14('0xf')]){if(_0x5c32ec[_0xcc14('0xf')]['code']===0x1f4){logger[_0xcc14('0xf')](_0xcc14('0xb'),_0x3630af,_0x5c32ec['error'][_0xcc14('0x10')]);return _0x20cf13(_0x5c32ec[_0xcc14('0xf')][_0xcc14('0x10')]);}logger[_0xcc14('0xf')](_0xcc14('0xb'),_0x3630af,_0x5c32ec[_0xcc14('0xf')][_0xcc14('0x10')]);return _0x5da6d2(_0x5c32ec[_0xcc14('0xf')][_0xcc14('0x10')]);}else{logger[_0xcc14('0x11')](_0xcc14('0xb'),_0x3630af,'request\x20sent');_0x5da6d2(_0x5c32ec[_0xcc14('0x12')][_0xcc14('0x10')]);}})[_0xcc14('0x13')](function(_0xb89c7){logger[_0xcc14('0xf')](_0xcc14('0xb'),_0x3630af,_0xb89c7);_0x20cf13(_0xb89c7);});});} \ No newline at end of file +var _0x611d=['rpc','../../config/environment','jayson/promise','client','http','request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','bluebird','randomstring','../../config/utils'];(function(_0x4ad4cc,_0x1f991e){var _0xb92c35=function(_0x2c9366){while(--_0x2c9366){_0x4ad4cc['push'](_0x4ad4cc['shift']());}};_0xb92c35(++_0x1f991e);}(_0x611d,0x1f0));var _0xd611=function(_0xcb1e6d,_0x50f22e){_0xcb1e6d=_0xcb1e6d-0x0;var _0x621f25=_0x611d[_0xcb1e6d];return _0x621f25;};'use strict';var _=require(_0xd611('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd611('0x1'));var rs=require(_0xd611('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd611('0x3'));var logger=require('../../config/logger')(_0xd611('0x4'));var config=require(_0xd611('0x5'));var jayson=require(_0xd611('0x6'));var client=jayson[_0xd611('0x7')][_0xd611('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x56654c,_0x3c1f63,_0x1a8821){return new BPromise(function(_0x2d4d89,_0x5d7d1f){return client[_0xd611('0x9')](_0x56654c,_0x1a8821)['then'](function(_0x5d96db){logger[_0xd611('0xa')](_0xd611('0xb'),_0x3c1f63,_0xd611('0xc'));logger[_0xd611('0xd')](_0xd611('0xe'),_0x3c1f63,_0xd611('0xc'),JSON[_0xd611('0xf')](_0x5d96db));if(_0x5d96db[_0xd611('0x10')]){if(_0x5d96db[_0xd611('0x10')]['code']===0x1f4){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x3c1f63,_0x5d96db['error'][_0xd611('0x11')]);return _0x5d7d1f(_0x5d96db[_0xd611('0x10')]['message']);}logger[_0xd611('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x3c1f63,_0x5d96db[_0xd611('0x10')][_0xd611('0x11')]);return _0x2d4d89(_0x5d96db[_0xd611('0x10')][_0xd611('0x11')]);}else{logger[_0xd611('0xa')](_0xd611('0xb'),_0x3c1f63,'request\x20sent');_0x2d4d89(_0x5d96db[_0xd611('0x12')]['message']);}})[_0xd611('0x13')](function(_0x2c21bb){logger['error'](_0xd611('0xb'),_0x3c1f63,_0x2c21bb);_0x5d7d1f(_0x2c21bb);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index e0399bf..49cb899 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x58dc50,_0x2af0b7){var _0x1fda34=function(_0x5cf61b){while(--_0x5cf61b){_0x58dc50['push'](_0x58dc50['shift']());}};_0x1fda34(++_0x2af0b7);}(_0x9c44,0x178));var _0x49c4=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9c44[_0x4f9b18];return _0x29f20c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4ea17a,_0x4b9c83){var _0x58e65f=function(_0x46ad6d){while(--_0x46ad6d){_0x4ea17a['push'](_0x4ea17a['shift']());}};_0x58e65f(++_0x4b9c83);}(_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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 975b254..4b74088 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 _0x5827=['exports','INTEGER','sequelize'];(function(_0x33217c,_0x188f63){var _0x587797=function(_0x56d413){while(--_0x56d413){_0x33217c['push'](_0x33217c['shift']());}};_0x587797(++_0x188f63);}(_0x5827,0xb0));var _0x7582=function(_0x21e20f,_0x15f8f1){_0x21e20f=_0x21e20f-0x0;var _0x47e5ff=_0x5827[_0x21e20f];return _0x47e5ff;};'use strict';var Sequelize=require(_0x7582('0x0'));module[_0x7582('0x1')]={'penalty':{'type':Sequelize[_0x7582('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb005=['sequelize','exports','INTEGER'];(function(_0x3f0786,_0x33449e){var _0x259401=function(_0x4d0dee){while(--_0x4d0dee){_0x3f0786['push'](_0x3f0786['shift']());}};_0x259401(++_0x33449e);}(_0xb005,0x159));var _0x5b00=function(_0x25c692,_0x170ddc){_0x25c692=_0x25c692-0x0;var _0x44f341=_0xb005[_0x25c692];return _0x44f341;};'use strict';var Sequelize=require(_0x5b00('0x0'));module[_0x5b00('0x1')]={'penalty':{'type':Sequelize[_0x5b00('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index b6c4f46..4b858a1 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 _0xa17f=['bluebird','request-promise','path','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger'];(function(_0x352de7,_0x42d665){var _0x76cff2=function(_0x4e9f7c){while(--_0x4e9f7c){_0x352de7['push'](_0x352de7['shift']());}};_0x76cff2(++_0x42d665);}(_0xa17f,0x8d));var _0xfa17=function(_0x423097,_0x8a09f4){_0x423097=_0x423097-0x0;var _0x3a73f1=_0xa17f[_0x423097];return _0x3a73f1;};'use strict';var _=require(_0xfa17('0x0'));var util=require(_0xfa17('0x1'));var logger=require(_0xfa17('0x2'))('api');var moment=require('moment');var BPromise=require(_0xfa17('0x3'));var rp=require(_0xfa17('0x4'));var fs=require('fs');var path=require(_0xfa17('0x5'));var rimraf=require('rimraf');var config=require(_0xfa17('0x6'));var attributes=require(_0xfa17('0x7'));module[_0xfa17('0x8')]=function(_0x508127,_0x7d9b4b){return _0x508127[_0xfa17('0x9')](_0xfa17('0xa'),attributes,{'tableName':_0xfa17('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8704=['request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x587300,_0x1da910){var _0x558b95=function(_0x40e531){while(--_0x40e531){_0x587300['push'](_0x587300['shift']());}};_0x558b95(++_0x1da910);}(_0x8704,0x180));var _0x4870=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0x8704[_0x44a64f];return _0x52024b;};'use strict';var _=require(_0x4870('0x0'));var util=require(_0x4870('0x1'));var logger=require(_0x4870('0x2'))(_0x4870('0x3'));var moment=require(_0x4870('0x4'));var BPromise=require(_0x4870('0x5'));var rp=require(_0x4870('0x6'));var fs=require('fs');var path=require(_0x4870('0x7'));var rimraf=require(_0x4870('0x8'));var config=require(_0x4870('0x9'));var attributes=require(_0x4870('0xa'));module[_0x4870('0xb')]=function(_0x42e52b,_0xf40ed5){return _0x42e52b[_0x4870('0xc')](_0x4870('0xd'),attributes,{'tableName':_0x4870('0xe'),'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 5032a42..588d963 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 _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x7217,0x19e));var _0x7721=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x7217[_0x29b609];return _0x54c952;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file +var _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x7217,0x19e));var _0x7721=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x7217[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index f3947b0..aa0adc8 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 _0x2d86=['post','isAuthenticated','sendUserNotification','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x334c92,_0x2b3208){var _0x2d7243=function(_0x39ee81){while(--_0x39ee81){_0x334c92['push'](_0x334c92['shift']());}};_0x2d7243(++_0x2b3208);}(_0x2d86,0x1dd));var _0x62d8=function(_0x5280f4,_0x3c36d0){_0x5280f4=_0x5280f4-0x0;var _0xba93e7=_0x2d86[_0x5280f4];return _0xba93e7;};'use strict';var multer=require(_0x62d8('0x0'));var util=require('util');var path=require(_0x62d8('0x1'));var timeout=require(_0x62d8('0x2'));var express=require(_0x62d8('0x3'));var router=express['Router']();var fs_extra=require(_0x62d8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x62d8('0x5'));var config=require(_0x62d8('0x6'));var controller=require('./userNotification.controller');router[_0x62d8('0x7')]('/',auth[_0x62d8('0x8')](),controller[_0x62d8('0x9')]);module[_0x62d8('0xa')]=router; \ No newline at end of file +var _0x722d=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','post','sendUserNotification','exports','multer','util','path','express'];(function(_0x3f6c29,_0x370d86){var _0x4af959=function(_0x263612){while(--_0x263612){_0x3f6c29['push'](_0x3f6c29['shift']());}};_0x4af959(++_0x370d86);}(_0x722d,0xc8));var _0xd722=function(_0xe5b3e1,_0x57a645){_0xe5b3e1=_0xe5b3e1-0x0;var _0x121dad=_0x722d[_0xe5b3e1];return _0x121dad;};'use strict';var multer=require(_0xd722('0x0'));var util=require(_0xd722('0x1'));var path=require(_0xd722('0x2'));var timeout=require('connect-timeout');var express=require(_0xd722('0x3'));var router=express[_0xd722('0x4')]();var fs_extra=require(_0xd722('0x5'));var auth=require(_0xd722('0x6'));var interaction=require(_0xd722('0x7'));var config=require(_0xd722('0x8'));var controller=require('./userNotification.controller');router[_0xd722('0x9')]('/',auth['isAuthenticated'](),controller[_0xd722('0xa')]);module[_0xd722('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index c5a3956..63e0046 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 _0xce6e=['TEXT','sequelize','STRING'];(function(_0x1987fc,_0x13edb7){var _0x383253=function(_0x878d6d){while(--_0x878d6d){_0x1987fc['push'](_0x1987fc['shift']());}};_0x383253(++_0x13edb7);}(_0xce6e,0x16c));var _0xece6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce6e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xece6('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xece6('0x1')]},'recipientsId':{'type':Sequelize[_0xece6('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x5868=['TEXT','STRING','sequelize'];(function(_0x4eb1c9,_0x5d20c7){var _0x3a7511=function(_0x54ce39){while(--_0x54ce39){_0x4eb1c9['push'](_0x4eb1c9['shift']());}};_0x3a7511(++_0x5d20c7);}(_0x5868,0xcb));var _0x8586=function(_0x3c635e,_0x2569fe){_0x3c635e=_0x3c635e-0x0;var _0x52a6e8=_0x5868[_0x3c635e];return _0x52a6e8;};'use strict';var Sequelize=require(_0x8586('0x0'));module['exports']={'body':{'type':Sequelize[_0x8586('0x1')]},'senderName':{'type':Sequelize[_0x8586('0x2')]},'recipientsId':{'type':Sequelize[_0x8586('0x1')]},'recipientsDescription':{'type':Sequelize[_0x8586('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index b90e180..97ed947 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 _0x484f=['user','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','beep','forEach','emit','userNotification:send','catch','Template','Invalid\x20\x27TemplateId\x27\x20parameter','html','view','startCase','model','User','ids','queue','replace','Queue','all','flatten','findOne','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','update','then','error','stack','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','recipients','parse','faxqueue','mailqueue','openchannelqueue','voicequeue'];(function(_0x59d471,_0x2b1e92){var _0x5e23b1=function(_0x55c456){while(--_0x55c456){_0x59d471['push'](_0x59d471['shift']());}};_0x5e23b1(++_0x2b1e92);}(_0x484f,0x1a3));var _0xf484=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x484f[_0x2576d7];return _0x16a08c;};'use strict';var emlformat=require(_0xf484('0x0'));var rimraf=require(_0xf484('0x1'));var zipdir=require(_0xf484('0x2'));var jsonpatch=require(_0xf484('0x3'));var rp=require(_0xf484('0x4'));var moment=require(_0xf484('0x5'));var BPromise=require(_0xf484('0x6'));var Mustache=require('mustache');var util=require(_0xf484('0x7'));var path=require(_0xf484('0x8'));var sox=require(_0xf484('0x9'));var csv=require('to-csv');var ejs=require(_0xf484('0xa'));var fs=require('fs');var fs_extra=require(_0xf484('0xb'));var _=require(_0xf484('0xc'));var squel=require('squel');var crypto=require(_0xf484('0xd'));var jsforce=require(_0xf484('0xe'));var deskjs=require(_0xf484('0xf'));var toCsv=require(_0xf484('0x10'));var querystring=require(_0xf484('0x11'));var Papa=require(_0xf484('0x12'));var Redis=require('ioredis');var authService=require(_0xf484('0x13'));var qs=require(_0xf484('0x14'));var as=require(_0xf484('0x15'));var hardwareService=require(_0xf484('0x16'));var logger=require('../../config/logger')(_0xf484('0x17'));var utils=require('../../config/utils');var config=require(_0xf484('0x18'));var licenseUtil=require(_0xf484('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xf484('0x1a')](config[_0xf484('0x1b')],{'host':_0xf484('0x1c'),'port':0x18eb});var socket=require(_0xf484('0x1d'))(new Redis(config[_0xf484('0x1b')]));require(_0xf484('0x1e'))['register'](socket);function respondWithStatusCode(_0x2be1bd,_0x2a8d3d){_0x2a8d3d=_0x2a8d3d||0xcc;return function(_0x4b8042){if(_0x4b8042){return _0x2be1bd[_0xf484('0x1f')](_0x2a8d3d);}return _0x2be1bd[_0xf484('0x20')](_0x2a8d3d)[_0xf484('0x21')]();};}function respondWithResult(_0x54848a,_0x476fc2){_0x476fc2=_0x476fc2||0xc8;return function(_0x4731c1){if(_0x4731c1){return _0x54848a['status'](_0x476fc2)['json'](_0x4731c1);}};}function respondWithFilteredResult(_0xee3e0e,_0x23a155){return function(_0x401c11){if(_0x401c11){var _0x55dc1c=typeof _0x23a155[_0xf484('0x22')]==='undefined'&&typeof _0x23a155[_0xf484('0x23')]===_0xf484('0x24');var _0x340b4a=_0x401c11[_0xf484('0x25')];var _0x25d56c=_0x55dc1c?0x0:_0x23a155['offset'];var _0x5c2e5d=_0x55dc1c?_0x401c11[_0xf484('0x25')]:_0x23a155[_0xf484('0x22')]+_0x23a155[_0xf484('0x23')];var _0xcb1662;if(_0x5c2e5d>=_0x340b4a){_0x5c2e5d=_0x340b4a;_0xcb1662=0xc8;}else{_0xcb1662=0xce;}_0xee3e0e[_0xf484('0x20')](_0xcb1662);return _0xee3e0e['set'](_0xf484('0x26'),_0x25d56c+'-'+_0x5c2e5d+'/'+_0x340b4a)[_0xf484('0x27')](_0x401c11);}return null;};}function patchUpdates(_0x2e9c97){return function(_0x208792){try{jsonpatch[_0xf484('0x28')](_0x208792,_0x2e9c97,!![]);}catch(_0x592a65){return BPromise[_0xf484('0x29')](_0x592a65);}return _0x208792['save']();};}function saveUpdates(_0x1ec211,_0x44d79d){return function(_0x15c697){if(_0x15c697){return _0x15c697[_0xf484('0x2a')](_0x1ec211)[_0xf484('0x2b')](function(_0x404127){return _0x404127;});}return null;};}function removeEntity(_0x398a67,_0x4cc237){return function(_0x568b49){if(_0x568b49){return _0x568b49['destroy']()[_0xf484('0x2b')](function(){_0x398a67[_0xf484('0x20')](0xcc)[_0xf484('0x21')]();});}};}function handleEntityNotFound(_0x1e3d4d,_0x402e85){return function(_0x5aad04){if(!_0x5aad04){_0x1e3d4d[_0xf484('0x1f')](0x194);}return _0x5aad04;};}function handleError(_0x251c29,_0x536ebe){_0x536ebe=_0x536ebe||0x1f4;return function(_0x3add62){logger[_0xf484('0x2c')](_0x3add62[_0xf484('0x2d')]);if(_0x3add62[_0xf484('0x2e')]){delete _0x3add62[_0xf484('0x2e')];}_0x251c29[_0xf484('0x20')](_0x536ebe)['send'](_0x3add62);};}exports[_0xf484('0x2f')]=function(_0x4b5ce5,_0x55e868,_0x2beabf){if(!_0x4b5ce5[_0xf484('0x30')][_0xf484('0x31')](_0xf484('0x32'))&&!_0x4b5ce5[_0xf484('0x30')][_0xf484('0x31')](_0xf484('0x33'))){throw new db[(_0xf484('0x34'))][(_0xf484('0x35'))](_0xf484('0x36'));}else{if(_0x4b5ce5[_0xf484('0x30')]['hasOwnProperty'](_0xf484('0x33'))&&!_0x4b5ce5['body']['hasOwnProperty']('view')){throw new db['Sequelize'][(_0xf484('0x35'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x4b5ce5[_0xf484('0x30')][_0xf484('0x31')](_0xf484('0x37'))){throw new db[(_0xf484('0x34'))]['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x270e3f=JSON[_0xf484('0x38')](_0x4b5ce5['body']['recipients']);}catch(_0x2645f7){logger[_0xf484('0x2c')](_0x2645f7);throw new db[(_0xf484('0x34'))]['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x55fd9f=['chatqueue',_0xf484('0x39'),_0xf484('0x3a'),_0xf484('0x3b'),'smsqueue',_0xf484('0x3c'),'whatsappqueue','team',_0xf484('0x3d')];if(_['some'](_0x270e3f,function(_0x30a0c7){return!_[_0xf484('0x3e')](_0x55fd9f,_0x30a0c7['model'][_0xf484('0x3f')]());})){throw new db[(_0xf484('0x34'))][(_0xf484('0x35'))](_0xf484('0x40'));}}}var _0x3bdcdb={};_0x3bdcdb[_0xf484('0x41')]=_0x4b5ce5[_0xf484('0x30')]['hasOwnProperty'](_0xf484('0x41'))?_0x4b5ce5[_0xf484('0x30')][_0xf484('0x41')]:_0x4b5ce5[_0xf484('0x3d')][_0xf484('0x42')];_0x3bdcdb[_0xf484('0x43')]=_[_0xf484('0x44')](_0x4b5ce5[_0xf484('0x30')]['recipientsDescription'])?null:_0x4b5ce5[_0xf484('0x30')][_0xf484('0x43')];_0x3bdcdb['beep']=_0x4b5ce5[_0xf484('0x30')]['beep']||![];_0x3bdcdb[_0xf484('0x45')]=_0x4b5ce5[_0xf484('0x3d')]['id'];return getContent(_0x4b5ce5[_0xf484('0x30')])['then'](function(_0xff3d0a){_0x3bdcdb[_0xf484('0x30')]=_0xff3d0a;return getRecipients(_0x270e3f);})[_0xf484('0x2b')](function(_0x1d4212){_0x3bdcdb[_0xf484('0x46')]=_[_0xf484('0x47')](_0x1d4212)[_0xf484('0x48')](',');return db[_0xf484('0x49')][_0xf484('0x4a')](function(_0x159f04){return db[_0xf484('0x4b')]['create'](_0x3bdcdb,{'raw':!![],'transaction':_0x159f04})[_0xf484('0x2b')](function(_0x8595d1){var _0x4aeab8={'sender':_0x3bdcdb[_0xf484('0x41')],'description':_0x3bdcdb['recipientsDescription'],'content':_0x3bdcdb[_0xf484('0x30')],'beep':_0x3bdcdb[_0xf484('0x4c')]};_0x1d4212[_0xf484('0x4d')](function(_0x4ba130){_0x4aeab8['recipient']=_0x4ba130;socket[_0xf484('0x4e')](_0xf484('0x4f'),_0x4aeab8);});return _0x8595d1;});});})[_0xf484('0x2b')](respondWithResult(_0x55e868,0xc9))[_0xf484('0x50')](handleError(_0x55e868,null));};function getContent(_0x21f2dc){return new BPromise(function(_0x3f1a49,_0x38b978){if(_0x21f2dc[_0xf484('0x32')]){_0x3f1a49(_0x21f2dc[_0xf484('0x32')]);return;}return db[_0xf484('0x51')]['findOne']({'attributes':['html'],'where':{'id':_0x21f2dc['TemplateId']},'raw':!![]})[_0xf484('0x2b')](function(_0x235895){if(!_0x235895)throw new db[(_0xf484('0x34'))]['ValidationError'](_0xf484('0x52'));var _0x4ddeed=Mustache['render'](_0x235895[_0xf484('0x53')],_0x21f2dc[_0xf484('0x54')]);_0x3f1a49(_0x4ddeed);})[_0xf484('0x50')](function(_0x5c5558){_0x38b978(_0x5c5558);});});}function getRecipients(_0x435655){return new BPromise(function(_0x4d3832,_0x4054bc){var _0x31c267=[];var _0xe8d0c1=[];_0x435655[_0xf484('0x4d')](function(_0x3fbf10){var _0x2c0d7e=_[_0xf484('0x55')](_0x3fbf10[_0xf484('0x56')][_0xf484('0x3f')]());if(_0x2c0d7e===_0xf484('0x57')){_0x31c267=_['union'](_0x31c267,_0x3fbf10[_0xf484('0x58')]);}else{if(_['includes'](_0x2c0d7e,_0xf484('0x59')))_0x2c0d7e=_0x2c0d7e[_0xf484('0x5a')](_0xf484('0x59'),_0xf484('0x5b'));_0x3fbf10[_0xf484('0x58')]['forEach'](function(_0xe347e6){_0xe8d0c1['push'](getAgents(_0x2c0d7e,_0xe347e6));});}});return BPromise[_0xf484('0x5c')](_0xe8d0c1)[_0xf484('0x2b')](function(_0x10c01e){_0x31c267=_['union'](_0x31c267,_[_0xf484('0x5d')](_0x10c01e));_0x4d3832(_0x31c267);})['catch'](function(_0x21f7a8){_0x4054bc(_0x21f7a8);});});}function getAgents(_0x39d4d6,_0x15a527){return new BPromise(function(_0x82c52c,_0x13080e){return db[_0x39d4d6][_0xf484('0x5e')]({'where':{'id':_0x15a527}})[_0xf484('0x2b')](function(_0x260387){return _0x260387[_0xf484('0x5f')]({'attributes':['id'],'raw':!![]})[_0xf484('0x2b')](function(_0x2260b7){var _0x558723=_['map'](_0x2260b7,'id');_0x82c52c(_0x558723);});})[_0xf484('0x50')](function(_0x19b385){_0x13080e(_0x19b385);});});} \ No newline at end of file +var _0x5f66=['body','text','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','create','forEach','recipient','emit','catch','Template','findOne','html','render','startCase','toLowerCase','User','union','ids','queue','all','flatten','getAgents','map','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','sendUserNotification'];(function(_0x2ddf2d,_0x272b8a){var _0x53dd02=function(_0x5a889c){while(--_0x5a889c){_0x2ddf2d['push'](_0x2ddf2d['shift']());}};_0x53dd02(++_0x272b8a);}(_0x5f66,0x1dc));var _0x65f6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f66[_0x432682];return _0x463d05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require(_0x65f6('0x1'));var jsonpatch=require(_0x65f6('0x2'));var rp=require(_0x65f6('0x3'));var moment=require('moment');var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require(_0x65f6('0x9'));var _=require(_0x65f6('0xa'));var squel=require(_0x65f6('0xb'));var crypto=require(_0x65f6('0xc'));var jsforce=require(_0x65f6('0xd'));var deskjs=require(_0x65f6('0xe'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xf'));var Papa=require(_0x65f6('0x10'));var Redis=require(_0x65f6('0x11'));var authService=require(_0x65f6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x65f6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x65f6('0x14'))('api');var utils=require(_0x65f6('0x15'));var config=require(_0x65f6('0x16'));var licenseUtil=require(_0x65f6('0x17'));var db=require(_0x65f6('0x18'))['db'];config[_0x65f6('0x19')]=_[_0x65f6('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x65f6('0x1b'))(new Redis(config[_0x65f6('0x19')]));require('./userNotification.socket')['register'](socket);function respondWithStatusCode(_0x3ef914,_0x326e17){_0x326e17=_0x326e17||0xcc;return function(_0x3cdc71){if(_0x3cdc71){return _0x3ef914[_0x65f6('0x1c')](_0x326e17);}return _0x3ef914[_0x65f6('0x1d')](_0x326e17)[_0x65f6('0x1e')]();};}function respondWithResult(_0x214921,_0x1fee96){_0x1fee96=_0x1fee96||0xc8;return function(_0x369269){if(_0x369269){return _0x214921['status'](_0x1fee96)[_0x65f6('0x1f')](_0x369269);}};}function respondWithFilteredResult(_0x39a3e5,_0x14a5ec){return function(_0x598c41){if(_0x598c41){var _0x4e3650=typeof _0x14a5ec['offset']===_0x65f6('0x20')&&typeof _0x14a5ec[_0x65f6('0x21')]===_0x65f6('0x20');var _0x47caff=_0x598c41[_0x65f6('0x22')];var _0x2eb276=_0x4e3650?0x0:_0x14a5ec[_0x65f6('0x23')];var _0x2be908=_0x4e3650?_0x598c41[_0x65f6('0x22')]:_0x14a5ec[_0x65f6('0x23')]+_0x14a5ec['limit'];var _0x182c0c;if(_0x2be908>=_0x47caff){_0x2be908=_0x47caff;_0x182c0c=0xc8;}else{_0x182c0c=0xce;}_0x39a3e5[_0x65f6('0x1d')](_0x182c0c);return _0x39a3e5[_0x65f6('0x24')](_0x65f6('0x25'),_0x2eb276+'-'+_0x2be908+'/'+_0x47caff)[_0x65f6('0x1f')](_0x598c41);}return null;};}function patchUpdates(_0x57b1e2){return function(_0x1c2bcc){try{jsonpatch[_0x65f6('0x26')](_0x1c2bcc,_0x57b1e2,!![]);}catch(_0x6476cd){return BPromise[_0x65f6('0x27')](_0x6476cd);}return _0x1c2bcc[_0x65f6('0x28')]();};}function saveUpdates(_0x419e0d,_0x164409){return function(_0x1837b3){if(_0x1837b3){return _0x1837b3[_0x65f6('0x29')](_0x419e0d)[_0x65f6('0x2a')](function(_0x533954){return _0x533954;});}return null;};}function removeEntity(_0x39f7ab,_0x373553){return function(_0x2e392e){if(_0x2e392e){return _0x2e392e[_0x65f6('0x2b')]()[_0x65f6('0x2a')](function(){_0x39f7ab['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x54aa2f,_0x4a7493){return function(_0x3877b6){if(!_0x3877b6){_0x54aa2f[_0x65f6('0x1c')](0x194);}return _0x3877b6;};}function handleError(_0x1471f8,_0x6c8cc1){_0x6c8cc1=_0x6c8cc1||0x1f4;return function(_0x48fa98){logger[_0x65f6('0x2c')](_0x48fa98[_0x65f6('0x2d')]);if(_0x48fa98[_0x65f6('0x2e')]){delete _0x48fa98[_0x65f6('0x2e')];}_0x1471f8['status'](_0x6c8cc1)[_0x65f6('0x2f')](_0x48fa98);};}exports[_0x65f6('0x30')]=function(_0x496fc8,_0x5f52d5,_0x39af72){if(!_0x496fc8[_0x65f6('0x31')]['hasOwnProperty'](_0x65f6('0x32'))&&!_0x496fc8['body'][_0x65f6('0x33')](_0x65f6('0x34'))){throw new db[(_0x65f6('0x35'))][(_0x65f6('0x36'))](_0x65f6('0x37'));}else{if(_0x496fc8[_0x65f6('0x31')][_0x65f6('0x33')]('TemplateId')&&!_0x496fc8[_0x65f6('0x31')][_0x65f6('0x33')](_0x65f6('0x38'))){throw new db[(_0x65f6('0x35'))][(_0x65f6('0x36'))](_0x65f6('0x39'));}if(!_0x496fc8[_0x65f6('0x31')]['hasOwnProperty'](_0x65f6('0x3a'))){throw new db[(_0x65f6('0x35'))][(_0x65f6('0x36'))](_0x65f6('0x3b'));}else{try{var _0x67bed2=JSON[_0x65f6('0x3c')](_0x496fc8[_0x65f6('0x31')]['recipients']);}catch(_0x45c9fe){logger[_0x65f6('0x2c')](_0x45c9fe);throw new db[(_0x65f6('0x35'))][(_0x65f6('0x36'))](_0x65f6('0x3d'));}var _0x239bbc=[_0x65f6('0x3e'),_0x65f6('0x3f'),_0x65f6('0x40'),_0x65f6('0x41'),_0x65f6('0x42'),_0x65f6('0x43'),_0x65f6('0x44'),_0x65f6('0x45'),_0x65f6('0x46')];if(_[_0x65f6('0x47')](_0x67bed2,function(_0x58e653){return!_[_0x65f6('0x48')](_0x239bbc,_0x58e653[_0x65f6('0x49')]['toLowerCase']());})){throw new db[(_0x65f6('0x35'))][(_0x65f6('0x36'))](_0x65f6('0x4a'));}}}var _0x45ffad={};_0x45ffad[_0x65f6('0x4b')]=_0x496fc8[_0x65f6('0x31')][_0x65f6('0x33')](_0x65f6('0x4b'))?_0x496fc8[_0x65f6('0x31')]['senderName']:_0x496fc8[_0x65f6('0x46')][_0x65f6('0x4c')];_0x45ffad[_0x65f6('0x4d')]=_[_0x65f6('0x4e')](_0x496fc8[_0x65f6('0x31')][_0x65f6('0x4d')])?null:_0x496fc8[_0x65f6('0x31')][_0x65f6('0x4d')];_0x45ffad[_0x65f6('0x4f')]=_0x496fc8['body'][_0x65f6('0x4f')]||![];_0x45ffad[_0x65f6('0x50')]=_0x496fc8[_0x65f6('0x46')]['id'];return getContent(_0x496fc8['body'])[_0x65f6('0x2a')](function(_0x15628a){_0x45ffad[_0x65f6('0x31')]=_0x15628a;return getRecipients(_0x67bed2);})['then'](function(_0x4520ac){_0x45ffad[_0x65f6('0x51')]=_[_0x65f6('0x52')](_0x4520ac)[_0x65f6('0x53')](',');return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x2f9247){return db['UserNotification'][_0x65f6('0x56')](_0x45ffad,{'raw':!![],'transaction':_0x2f9247})[_0x65f6('0x2a')](function(_0x5b4f67){var _0x41208c={'sender':_0x45ffad['senderName'],'description':_0x45ffad['recipientsDescription'],'content':_0x45ffad[_0x65f6('0x31')],'beep':_0x45ffad[_0x65f6('0x4f')]};_0x4520ac[_0x65f6('0x57')](function(_0x1a0b2f){_0x41208c[_0x65f6('0x58')]=_0x1a0b2f;socket[_0x65f6('0x59')]('userNotification:send',_0x41208c);});return _0x5b4f67;});});})[_0x65f6('0x2a')](respondWithResult(_0x5f52d5,0xc9))[_0x65f6('0x5a')](handleError(_0x5f52d5,null));};function getContent(_0x8186d5){return new BPromise(function(_0x262abd,_0x449a29){if(_0x8186d5[_0x65f6('0x32')]){_0x262abd(_0x8186d5[_0x65f6('0x32')]);return;}return db[_0x65f6('0x5b')][_0x65f6('0x5c')]({'attributes':[_0x65f6('0x5d')],'where':{'id':_0x8186d5[_0x65f6('0x34')]},'raw':!![]})[_0x65f6('0x2a')](function(_0x3a5873){if(!_0x3a5873)throw new db['Sequelize'][(_0x65f6('0x36'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x4ceb0e=Mustache[_0x65f6('0x5e')](_0x3a5873[_0x65f6('0x5d')],_0x8186d5[_0x65f6('0x38')]);_0x262abd(_0x4ceb0e);})['catch'](function(_0x5dd793){_0x449a29(_0x5dd793);});});}function getRecipients(_0x57a38c){return new BPromise(function(_0x969d7b,_0x5692d6){var _0x1c6787=[];var _0x917e48=[];_0x57a38c['forEach'](function(_0x24fe43){var _0x46d61c=_[_0x65f6('0x5f')](_0x24fe43[_0x65f6('0x49')][_0x65f6('0x60')]());if(_0x46d61c===_0x65f6('0x61')){_0x1c6787=_[_0x65f6('0x62')](_0x1c6787,_0x24fe43[_0x65f6('0x63')]);}else{if(_[_0x65f6('0x48')](_0x46d61c,'queue'))_0x46d61c=_0x46d61c['replace'](_0x65f6('0x64'),'Queue');_0x24fe43[_0x65f6('0x63')]['forEach'](function(_0x12f71a){_0x917e48['push'](getAgents(_0x46d61c,_0x12f71a));});}});return BPromise[_0x65f6('0x65')](_0x917e48)['then'](function(_0x3c1f48){_0x1c6787=_[_0x65f6('0x62')](_0x1c6787,_[_0x65f6('0x66')](_0x3c1f48));_0x969d7b(_0x1c6787);})['catch'](function(_0x189e83){_0x5692d6(_0x189e83);});});}function getAgents(_0x43002b,_0x15bead){return new BPromise(function(_0x269b6f,_0x580b67){return db[_0x43002b][_0x65f6('0x5c')]({'where':{'id':_0x15bead}})[_0x65f6('0x2a')](function(_0x3a6e19){return _0x3a6e19[_0x65f6('0x67')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1a9848){var _0x202a04=_[_0x65f6('0x68')](_0x1a9848,'id');_0x269b6f(_0x202a04);});})[_0x65f6('0x5a')](function(_0x2d7c3d){_0x580b67(_0x2d7c3d);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index b7525d6..3f1648a 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 _0xe2ee=['hasOwnProperty','hook','exports','events','UserNotification','save','update','remove'];(function(_0xe8331e,_0x211221){var _0x59a90d=function(_0x3ec496){while(--_0x3ec496){_0xe8331e['push'](_0xe8331e['shift']());}};_0x59a90d(++_0x211221);}(_0xe2ee,0xf3));var _0xee2e=function(_0x5e6ea3,_0x9addd2){_0x5e6ea3=_0x5e6ea3-0x0;var _0x4048b5=_0xe2ee[_0x5e6ea3];return _0x4048b5;};'use strict';var EventEmitter=require(_0xee2e('0x0'));var UserNotification=require('../../mysqldb')['db'][_0xee2e('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xee2e('0x2'),'afterUpdate':_0xee2e('0x3'),'afterDestroy':_0xee2e('0x4')};function emitEvent(_0x3ab147){return function(_0x4be93e,_0x1ea576,_0x19c00a){UserNotificationEvents['emit'](_0x3ab147+':'+_0x4be93e['id'],_0x4be93e);UserNotificationEvents['emit'](_0x3ab147,_0x4be93e);_0x19c00a(null);};}for(var e in events){if(events[_0xee2e('0x5')](e)){var event=events[e];UserNotification[_0xee2e('0x6')](e,emitEvent(event));}}module[_0xee2e('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0xed1f=['hook','exports','events','../../mysqldb','UserNotification','setMaxListeners','save','emit'];(function(_0x171fdc,_0x16ae91){var _0x3782ea=function(_0x58b691){while(--_0x58b691){_0x171fdc['push'](_0x171fdc['shift']());}};_0x3782ea(++_0x16ae91);}(_0xed1f,0x1c2));var _0xfed1=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0xed1f[_0x12f688];return _0x59c3de;};'use strict';var EventEmitter=require(_0xfed1('0x0'));var UserNotification=require(_0xfed1('0x1'))['db'][_0xfed1('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xfed1('0x3')](0x0);var events={'afterCreate':_0xfed1('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3e3cdb){return function(_0x52d4e8,_0x4f3ba,_0x51bd46){UserNotificationEvents[_0xfed1('0x5')](_0x3e3cdb+':'+_0x52d4e8['id'],_0x52d4e8);UserNotificationEvents['emit'](_0x3e3cdb,_0x52d4e8);_0x51bd46(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0xfed1('0x6')](e,emitEvent(event));}}module[_0xfed1('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 18256ff..d8c99ea 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 _0x8136=['path','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','utf8mb4','lodash','../../config/logger','api','moment','bluebird'];(function(_0x41beac,_0x3375b9){var _0x10d9e6=function(_0x2a1416){while(--_0x2a1416){_0x41beac['push'](_0x41beac['shift']());}};_0x10d9e6(++_0x3375b9);}(_0x8136,0x1c2));var _0x6813=function(_0x334fc6,_0x16598d){_0x334fc6=_0x334fc6-0x0;var _0x5ef523=_0x8136[_0x334fc6];return _0x5ef523;};'use strict';var _=require(_0x6813('0x0'));var util=require('util');var logger=require(_0x6813('0x1'))(_0x6813('0x2'));var moment=require(_0x6813('0x3'));var BPromise=require(_0x6813('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6813('0x5'));var rimraf=require(_0x6813('0x6'));var config=require(_0x6813('0x7'));var attributes=require(_0x6813('0x8'));module[_0x6813('0x9')]=function(_0x597632,_0x451dd8){return _0x597632[_0x6813('0xa')](_0x6813('0xb'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6813('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3107=['rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','bluebird','path'];(function(_0x1017c3,_0x7127ba){var _0x335335=function(_0x26a87e){while(--_0x26a87e){_0x1017c3['push'](_0x1017c3['shift']());}};_0x335335(++_0x7127ba);}(_0x3107,0x1b8));var _0x7310=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3107[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7310('0x0'))(_0x7310('0x1'));var moment=require('moment');var BPromise=require(_0x7310('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7310('0x3'));var rimraf=require(_0x7310('0x4'));var config=require(_0x7310('0x5'));var attributes=require(_0x7310('0x6'));module[_0x7310('0x7')]=function(_0x11338c,_0xcb315f){return _0x11338c[_0x7310('0x8')](_0x7310('0x9'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7310('0xa'),'collate':_0x7310('0xb')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 6c55115..501c057 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 _0xb2d6=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','UserNotification,\x20%s,\x20%s','message','catch','util'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xb2d6,0xae));var _0x6b2d=function(_0x43e53e,_0x346f3f){_0x43e53e=_0x43e53e-0x0;var _0x487bf0=_0xb2d6[_0x43e53e];return _0x487bf0;};'use strict';var _=require('lodash');var util=require(_0x6b2d('0x0'));var moment=require('moment');var BPromise=require(_0x6b2d('0x1'));var rs=require(_0x6b2d('0x2'));var fs=require('fs');var Redis=require(_0x6b2d('0x3'));var db=require(_0x6b2d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6b2d('0x5'))(_0x6b2d('0x6'));var config=require(_0x6b2d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6b2d('0x8')][_0x6b2d('0x9')]({'port':0x232a});config[_0x6b2d('0xa')]=_[_0x6b2d('0xb')](config[_0x6b2d('0xa')],{'host':_0x6b2d('0xc'),'port':0x18eb});var socket=require(_0x6b2d('0xd'))(new Redis(config[_0x6b2d('0xa')]));require('./userNotification.socket')[_0x6b2d('0xe')](socket);function respondWithRpcPromise(_0x55bb81,_0x4cd9ec,_0x521871){return new BPromise(function(_0x381387,_0x19a582){return client[_0x6b2d('0xf')](_0x55bb81,_0x521871)[_0x6b2d('0x10')](function(_0x53bf04){logger[_0x6b2d('0x11')]('UserNotification,\x20%s,\x20%s',_0x4cd9ec,'request\x20sent');logger['debug'](_0x6b2d('0x12'),_0x4cd9ec,_0x6b2d('0x13'),JSON[_0x6b2d('0x14')](_0x53bf04));if(_0x53bf04[_0x6b2d('0x15')]){if(_0x53bf04[_0x6b2d('0x15')]['code']===0x1f4){logger[_0x6b2d('0x15')](_0x6b2d('0x16'),_0x4cd9ec,_0x53bf04[_0x6b2d('0x15')][_0x6b2d('0x17')]);return _0x19a582(_0x53bf04[_0x6b2d('0x15')][_0x6b2d('0x17')]);}logger[_0x6b2d('0x15')]('UserNotification,\x20%s,\x20%s',_0x4cd9ec,_0x53bf04[_0x6b2d('0x15')][_0x6b2d('0x17')]);return _0x381387(_0x53bf04[_0x6b2d('0x15')][_0x6b2d('0x17')]);}else{logger['info'](_0x6b2d('0x16'),_0x4cd9ec,_0x6b2d('0x13'));_0x381387(_0x53bf04['result'][_0x6b2d('0x17')]);}})[_0x6b2d('0x18')](function(_0x5b7b61){logger[_0x6b2d('0x15')](_0x6b2d('0x16'),_0x4cd9ec,_0x5b7b61);_0x19a582(_0x5b7b61);});});} \ No newline at end of file +var _0xb83f=['message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','then','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x16e9db,_0x548630){var _0x133a3e=function(_0x27ddfb){while(--_0x27ddfb){_0x16e9db['push'](_0x16e9db['shift']());}};_0x133a3e(++_0x548630);}(_0xb83f,0x64));var _0xfb83=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xb83f[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0xfb83('0x0'));var util=require(_0xfb83('0x1'));var moment=require(_0xfb83('0x2'));var BPromise=require(_0xfb83('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb83('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfb83('0x5'));var config=require(_0xfb83('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfb83('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0xfb83('0x8')],{'host':_0xfb83('0x9'),'port':0x18eb});var socket=require(_0xfb83('0xa'))(new Redis(config['redis']));require(_0xfb83('0xb'))[_0xfb83('0xc')](socket);function respondWithRpcPromise(_0x1b9ce3,_0x1ab903,_0x511610){return new BPromise(function(_0xea70e6,_0x23b3ad){return client[_0xfb83('0xd')](_0x1b9ce3,_0x511610)[_0xfb83('0xe')](function(_0x7d74bf){logger['info'](_0xfb83('0xf'),_0x1ab903,'request\x20sent');logger[_0xfb83('0x10')](_0xfb83('0x11'),_0x1ab903,_0xfb83('0x12'),JSON['stringify'](_0x7d74bf));if(_0x7d74bf[_0xfb83('0x13')]){if(_0x7d74bf[_0xfb83('0x13')]['code']===0x1f4){logger['error']('UserNotification,\x20%s,\x20%s',_0x1ab903,_0x7d74bf[_0xfb83('0x13')]['message']);return _0x23b3ad(_0x7d74bf[_0xfb83('0x13')][_0xfb83('0x14')]);}logger[_0xfb83('0x13')](_0xfb83('0xf'),_0x1ab903,_0x7d74bf[_0xfb83('0x13')][_0xfb83('0x14')]);return _0xea70e6(_0x7d74bf[_0xfb83('0x13')][_0xfb83('0x14')]);}else{logger[_0xfb83('0x15')](_0xfb83('0xf'),_0x1ab903,_0xfb83('0x12'));_0xea70e6(_0x7d74bf[_0xfb83('0x16')][_0xfb83('0x14')]);}})[_0xfb83('0x17')](function(_0x306560){logger['error'](_0xfb83('0xf'),_0x1ab903,_0x306560);_0x23b3ad(_0x306560);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index b4899bd..d844ad7 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 _0x0a0e=['save','remove','removeListener','register','length','userNotification:','./userNotification.events'];(function(_0xd79b97,_0x138e95){var _0x2a600f=function(_0x64dc99){while(--_0x64dc99){_0xd79b97['push'](_0xd79b97['shift']());}};_0x2a600f(++_0x138e95);}(_0x0a0e,0x117));var _0xe0a0=function(_0x16de85,_0x5b0595){_0x16de85=_0x16de85-0x0;var _0x28f2ea=_0x0a0e[_0x16de85];return _0x28f2ea;};'use strict';var UserNotificationEvents=require(_0xe0a0('0x0'));var events=[_0xe0a0('0x1'),_0xe0a0('0x2'),'update'];function createListener(_0x1afafe,_0x338bfa){return function(_0x25fedf){_0x338bfa['emit'](_0x1afafe,_0x25fedf);};}function removeListener(_0x16e7cf,_0x54c350){return function(){UserNotificationEvents[_0xe0a0('0x3')](_0x16e7cf,_0x54c350);};}exports[_0xe0a0('0x4')]=function(_0x134c6b){for(var _0x3d50ff=0x0,_0x10f0b3=events[_0xe0a0('0x5')];_0x3d50ff<_0x10f0b3;_0x3d50ff++){var _0x3a2a16=events[_0x3d50ff];var _0x5d47cd=createListener(_0xe0a0('0x6')+_0x3a2a16,_0x134c6b);UserNotificationEvents['on'](_0x3a2a16,_0x5d47cd);}}; \ No newline at end of file +var _0xc388=['./userNotification.events','remove','emit','removeListener','register','userNotification:'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc388,0x198));var _0x8c38=function(_0x33db25,_0x2b1e8b){_0x33db25=_0x33db25-0x0;var _0x3aac0f=_0xc388[_0x33db25];return _0x3aac0f;};'use strict';var UserNotificationEvents=require(_0x8c38('0x0'));var events=['save',_0x8c38('0x1'),'update'];function createListener(_0x20b154,_0x48836e){return function(_0x35ccb6){_0x48836e[_0x8c38('0x2')](_0x20b154,_0x35ccb6);};}function removeListener(_0x5d19ab,_0x583e6b){return function(){UserNotificationEvents[_0x8c38('0x3')](_0x5d19ab,_0x583e6b);};}exports[_0x8c38('0x4')]=function(_0x18bac8){for(var _0x9ca034=0x0,_0x19e6d7=events['length'];_0x9ca034<_0x19e6d7;_0x9ca034++){var _0x5c26b9=events[_0x9ca034];var _0x550baf=createListener(_0x8c38('0x5')+_0x5c26b9,_0x18bac8);UserNotificationEvents['on'](_0x5c26b9,_0x550baf);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 396538b..bf1408d 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2b1b53,_0x339dd0){var _0x5d55e1=function(_0x31f6e8){while(--_0x31f6e8){_0x2b1b53['push'](_0x2b1b53['shift']());}};_0x5d55e1(++_0x339dd0);}(_0xe706,0xa3));var _0x6e70=function(_0x360319,_0x1cd1ee){_0x360319=_0x360319-0x0;var _0x4062fb=_0xe706[_0x360319];return _0x4062fb;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x2bf846,_0x455687){var _0x2e62ee=function(_0x444881){while(--_0x444881){_0x2bf846['push'](_0x2bf846['shift']());}};_0x2e62ee(++_0x455687);}(_0xedd9,0xfc));var _0x9edd=function(_0x50f241,_0x5c2b5f){_0x50f241=_0x50f241-0x0;var _0xa594ee=_0xedd9[_0x50f241];return _0xa594ee;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 8a4a42b..e0d2516 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 _0x7819=['INTEGER','sequelize'];(function(_0x334ec7,_0x258b39){var _0x394bd4=function(_0x5486c0){while(--_0x5486c0){_0x334ec7['push'](_0x334ec7['shift']());}};_0x394bd4(++_0x258b39);}(_0x7819,0xbb));var _0x9781=function(_0x45dad7,_0x18a23c){_0x45dad7=_0x45dad7-0x0;var _0x25edf3=_0x7819[_0x45dad7];return _0x25edf3;};'use strict';var Sequelize=require(_0x9781('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x9781('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1755=['exports','INTEGER','sequelize'];(function(_0x475265,_0xb6a2a6){var _0x18328e=function(_0x3e886d){while(--_0x3e886d){_0x475265['push'](_0x475265['shift']());}};_0x18328e(++_0xb6a2a6);}(_0x1755,0xce));var _0x5175=function(_0x46867c,_0x2ad9de){_0x46867c=_0x46867c-0x0;var _0x5af482=_0x1755[_0x46867c];return _0x5af482;};'use strict';var Sequelize=require(_0x5175('0x0'));module[_0x5175('0x1')]={'penalty':{'type':Sequelize[_0x5175('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 88e1b3f..bd8dad5 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 _0xa7b9=['exports','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x341aa3,_0xa93441){var _0x55ed7e=function(_0x5e7c94){while(--_0x5e7c94){_0x341aa3['push'](_0x341aa3['shift']());}};_0x55ed7e(++_0xa93441);}(_0xa7b9,0x83));var _0x9a7b=function(_0x32c98a,_0x5e6eb0){_0x32c98a=_0x32c98a-0x0;var _0x1796d3=_0xa7b9[_0x32c98a];return _0x1796d3;};'use strict';var _=require(_0x9a7b('0x0'));var util=require(_0x9a7b('0x1'));var logger=require(_0x9a7b('0x2'))('api');var moment=require(_0x9a7b('0x3'));var BPromise=require(_0x9a7b('0x4'));var rp=require(_0x9a7b('0x5'));var fs=require('fs');var path=require(_0x9a7b('0x6'));var rimraf=require(_0x9a7b('0x7'));var config=require(_0x9a7b('0x8'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x9a7b('0x9')]=function(_0x4e70c0,_0x43a84c){return _0x4e70c0['define']('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x603e=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util'];(function(_0x2cef86,_0xbae0a6){var _0x46dfd6=function(_0x52e464){while(--_0x52e464){_0x2cef86['push'](_0x2cef86['shift']());}};_0x46dfd6(++_0xbae0a6);}(_0x603e,0x16a));var _0xe603=function(_0xc80b2b,_0x5a12e9){_0xc80b2b=_0xc80b2b-0x0;var _0x22af6f=_0x603e[_0xc80b2b];return _0x22af6f;};'use strict';var _=require(_0xe603('0x0'));var util=require(_0xe603('0x1'));var logger=require(_0xe603('0x2'))('api');var moment=require(_0xe603('0x3'));var BPromise=require('bluebird');var rp=require(_0xe603('0x4'));var fs=require('fs');var path=require(_0xe603('0x5'));var rimraf=require(_0xe603('0x6'));var config=require(_0xe603('0x7'));var attributes=require(_0xe603('0x8'));module[_0xe603('0x9')]=function(_0x123276,_0x459c86){return _0x123276[_0xe603('0xa')](_0xe603('0xb'),attributes,{'tableName':_0xe603('0xc'),'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 24eb4bd..e82d0ba 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 _0x5f6f=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis'];(function(_0x5b7784,_0x341318){var _0x58272c=function(_0x4ea804){while(--_0x4ea804){_0x5b7784['push'](_0x5b7784['shift']());}};_0x58272c(++_0x341318);}(_0x5f6f,0xc2));var _0xf5f6=function(_0x21bb01,_0x4988f2){_0x21bb01=_0x21bb01-0x0;var _0x4a8035=_0x5f6f[_0x21bb01];return _0x4a8035;};'use strict';var _=require(_0xf5f6('0x0'));var util=require('util');var moment=require(_0xf5f6('0x1'));var BPromise=require(_0xf5f6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf5f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf5f6('0x4'))(_0xf5f6('0x5'));var config=require(_0xf5f6('0x6'));var jayson=require(_0xf5f6('0x7'));var client=jayson[_0xf5f6('0x8')][_0xf5f6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4aeddf,_0x48601a,_0x2f0887){return new BPromise(function(_0xf1ab2a,_0x1cf1b0){return client[_0xf5f6('0xa')](_0x4aeddf,_0x2f0887)['then'](function(_0xb997d0){logger[_0xf5f6('0xb')](_0xf5f6('0xc'),_0x48601a,_0xf5f6('0xd'));logger[_0xf5f6('0xe')](_0xf5f6('0xf'),_0x48601a,_0xf5f6('0xd'),JSON[_0xf5f6('0x10')](_0xb997d0));if(_0xb997d0[_0xf5f6('0x11')]){if(_0xb997d0[_0xf5f6('0x11')][_0xf5f6('0x12')]===0x1f4){logger[_0xf5f6('0x11')](_0xf5f6('0xc'),_0x48601a,_0xb997d0[_0xf5f6('0x11')][_0xf5f6('0x13')]);return _0x1cf1b0(_0xb997d0['error']['message']);}logger[_0xf5f6('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x48601a,_0xb997d0[_0xf5f6('0x11')][_0xf5f6('0x13')]);return _0xf1ab2a(_0xb997d0[_0xf5f6('0x11')]['message']);}else{logger[_0xf5f6('0xb')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x48601a,'request\x20sent');_0xf1ab2a(_0xb997d0[_0xf5f6('0x14')][_0xf5f6('0x13')]);}})[_0xf5f6('0x15')](function(_0x430193){logger[_0xf5f6('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x48601a,_0x430193);_0x1cf1b0(_0x430193);});});} \ No newline at end of file +var _0xd5a1=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis'];(function(_0x1d8472,_0x4e1392){var _0x27a1a3=function(_0x230256){while(--_0x230256){_0x1d8472['push'](_0x1d8472['shift']());}};_0x27a1a3(++_0x4e1392);}(_0xd5a1,0x164));var _0x1d5a=function(_0x1982c5,_0x5e4fbf){_0x1982c5=_0x1982c5-0x0;var _0x38d139=_0xd5a1[_0x1982c5];return _0x38d139;};'use strict';var _=require('lodash');var util=require(_0x1d5a('0x0'));var moment=require('moment');var BPromise=require(_0x1d5a('0x1'));var rs=require(_0x1d5a('0x2'));var fs=require('fs');var Redis=require(_0x1d5a('0x3'));var db=require(_0x1d5a('0x4'))['db'];var utils=require(_0x1d5a('0x5'));var logger=require(_0x1d5a('0x6'))(_0x1d5a('0x7'));var config=require(_0x1d5a('0x8'));var jayson=require(_0x1d5a('0x9'));var client=jayson[_0x1d5a('0xa')][_0x1d5a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10bc60,_0x31841f,_0x361a08){return new BPromise(function(_0x2ecadc,_0x2d0594){return client['request'](_0x10bc60,_0x361a08)[_0x1d5a('0xc')](function(_0x5f512d){logger[_0x1d5a('0xd')](_0x1d5a('0xe'),_0x31841f,_0x1d5a('0xf'));logger[_0x1d5a('0x10')](_0x1d5a('0x11'),_0x31841f,'request\x20sent',JSON[_0x1d5a('0x12')](_0x5f512d));if(_0x5f512d[_0x1d5a('0x13')]){if(_0x5f512d[_0x1d5a('0x13')][_0x1d5a('0x14')]===0x1f4){logger[_0x1d5a('0x13')](_0x1d5a('0xe'),_0x31841f,_0x5f512d[_0x1d5a('0x13')][_0x1d5a('0x15')]);return _0x2d0594(_0x5f512d[_0x1d5a('0x13')]['message']);}logger['error'](_0x1d5a('0xe'),_0x31841f,_0x5f512d[_0x1d5a('0x13')][_0x1d5a('0x15')]);return _0x2ecadc(_0x5f512d[_0x1d5a('0x13')][_0x1d5a('0x15')]);}else{logger['info'](_0x1d5a('0xe'),_0x31841f,'request\x20sent');_0x2ecadc(_0x5f512d[_0x1d5a('0x16')]['message']);}})[_0x1d5a('0x17')](function(_0x4ee9f0){logger['error'](_0x1d5a('0xe'),_0x31841f,_0x4ee9f0);_0x2d0594(_0x4ee9f0);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 1d495d9..ecfdfc9 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 _0x870d=['delete','/:id','destroy','removeSections','/:id/resources','removeResources','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','index','get','/describe','describe','isAuthenticated','show','/:id/sections','create','/:id/clone','clone','addSections','post','addResources','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x870d,0x1e7));var _0xd870=function(_0xd2534e,_0x376c72){_0xd2534e=_0xd2534e-0x0;var _0x157cfc=_0x870d[_0xd2534e];return _0x157cfc;};'use strict';var multer=require('multer');var util=require(_0xd870('0x0'));var path=require(_0xd870('0x1'));var timeout=require(_0xd870('0x2'));var express=require(_0xd870('0x3'));var router=express[_0xd870('0x4')]();var fs_extra=require(_0xd870('0x5'));var auth=require(_0xd870('0x6'));var interaction=require(_0xd870('0x7'));var config=require(_0xd870('0x8'));var controller=require(_0xd870('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xd870('0xa')]);router[_0xd870('0xb')](_0xd870('0xc'),auth['isAuthenticated'](),controller[_0xd870('0xd')]);router[_0xd870('0xb')]('/:id',auth[_0xd870('0xe')](),controller[_0xd870('0xf')]);router[_0xd870('0xb')](_0xd870('0x10'),auth['isAuthenticated'](),controller['getSections']);router[_0xd870('0xb')]('/:id/resources',auth[_0xd870('0xe')](),controller['getResources']);router['post']('/',auth[_0xd870('0xe')](),controller[_0xd870('0x11')]);router['post'](_0xd870('0x12'),auth[_0xd870('0xe')](),controller[_0xd870('0x13')]);router['post'](_0xd870('0x10'),auth[_0xd870('0xe')](),controller[_0xd870('0x14')]);router[_0xd870('0x15')]('/:id/resources',auth[_0xd870('0xe')](),controller[_0xd870('0x16')]);router[_0xd870('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xd870('0x18')]);router[_0xd870('0x19')](_0xd870('0x1a'),auth['isAuthenticated'](),controller[_0xd870('0x1b')]);router[_0xd870('0x19')]('/:id/sections',auth[_0xd870('0xe')](),controller[_0xd870('0x1c')]);router[_0xd870('0x19')](_0xd870('0x1d'),auth['isAuthenticated'](),controller[_0xd870('0x1e')]);module[_0xd870('0x1f')]=router; \ No newline at end of file +var _0xc172=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/sections','getSections','/:id/resources','getResources','create','post','/:id/clone','clone','addSections','addResources','put','update','delete','removeSections','removeResources','multer','util','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc172,0x1bd));var _0x2c17=function(_0x7ac660,_0x5937e1){_0x7ac660=_0x7ac660-0x0;var _0x1bbb8d=_0xc172[_0x7ac660];return _0x1bbb8d;};'use strict';var multer=require(_0x2c17('0x0'));var util=require(_0x2c17('0x1'));var path=require(_0x2c17('0x2'));var timeout=require(_0x2c17('0x3'));var express=require(_0x2c17('0x4'));var router=express[_0x2c17('0x5')]();var fs_extra=require(_0x2c17('0x6'));var auth=require(_0x2c17('0x7'));var interaction=require(_0x2c17('0x8'));var config=require(_0x2c17('0x9'));var controller=require(_0x2c17('0xa'));router[_0x2c17('0xb')]('/',auth['isAuthenticated'](),controller[_0x2c17('0xc')]);router[_0x2c17('0xb')](_0x2c17('0xd'),auth[_0x2c17('0xe')](),controller[_0x2c17('0xf')]);router[_0x2c17('0xb')](_0x2c17('0x10'),auth[_0x2c17('0xe')](),controller['show']);router['get'](_0x2c17('0x11'),auth[_0x2c17('0xe')](),controller[_0x2c17('0x12')]);router[_0x2c17('0xb')](_0x2c17('0x13'),auth[_0x2c17('0xe')](),controller[_0x2c17('0x14')]);router['post']('/',auth[_0x2c17('0xe')](),controller[_0x2c17('0x15')]);router[_0x2c17('0x16')](_0x2c17('0x17'),auth[_0x2c17('0xe')](),controller[_0x2c17('0x18')]);router[_0x2c17('0x16')](_0x2c17('0x11'),auth[_0x2c17('0xe')](),controller[_0x2c17('0x19')]);router['post']('/:id/resources',auth[_0x2c17('0xe')](),controller[_0x2c17('0x1a')]);router[_0x2c17('0x1b')](_0x2c17('0x10'),auth[_0x2c17('0xe')](),controller[_0x2c17('0x1c')]);router[_0x2c17('0x1d')](_0x2c17('0x10'),auth[_0x2c17('0xe')](),controller['destroy']);router[_0x2c17('0x1d')]('/:id/sections',auth[_0x2c17('0xe')](),controller[_0x2c17('0x1e')]);router[_0x2c17('0x1d')](_0x2c17('0x13'),auth['isAuthenticated'](),controller[_0x2c17('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 5b94463..3f2bc9b 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 _0x9e1f=['crudPermissions','join','getDataValue','split','BOOLEAN','exports','STRING','name','setDataValue'];(function(_0xde27fe,_0x217845){var _0x3857d8=function(_0x4dea9a){while(--_0x4dea9a){_0xde27fe['push'](_0xde27fe['shift']());}};_0x3857d8(++_0x217845);}(_0x9e1f,0x10a));var _0xf9e1=function(_0x327869,_0x3e8156){_0x327869=_0x327869-0x0;var _0x3ccce4=_0x9e1f[_0x327869];return _0x3ccce4;};'use strict';var Sequelize=require('sequelize');module[_0xf9e1('0x0')]={'name':{'type':Sequelize[_0xf9e1('0x1')],'allowNull':![],'unique':_0xf9e1('0x2')},'crudPermissions':{'type':Sequelize[_0xf9e1('0x1')],'set':function(_0x21c3f1){this[_0xf9e1('0x3')](_0xf9e1('0x4'),_0x21c3f1?_0x21c3f1[_0xf9e1('0x5')](''):[]);},'get':function(){return this[_0xf9e1('0x6')](_0xf9e1('0x4'))?this[_0xf9e1('0x6')](_0xf9e1('0x4'))[_0xf9e1('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xf9e1('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xf9e1('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xf9e1('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xf9e1('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xf9e1('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4132=['exports','STRING','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize'];(function(_0x52d4c1,_0x4a106e){var _0x592a16=function(_0x43cba9){while(--_0x43cba9){_0x52d4c1['push'](_0x52d4c1['shift']());}};_0x592a16(++_0x4a106e);}(_0x4132,0xaa));var _0x2413=function(_0x30e94a,_0x35ecf){_0x30e94a=_0x30e94a-0x0;var _0x275fcb=_0x4132[_0x30e94a];return _0x275fcb;};'use strict';var Sequelize=require(_0x2413('0x0'));module[_0x2413('0x1')]={'name':{'type':Sequelize[_0x2413('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x2413('0x2')],'set':function(_0x54a170){this[_0x2413('0x3')](_0x2413('0x4'),_0x54a170?_0x54a170[_0x2413('0x5')](''):[]);},'get':function(){return this[_0x2413('0x6')](_0x2413('0x4'))?this[_0x2413('0x6')](_0x2413('0x4'))[_0x2413('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x2413('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x2413('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x2413('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x2413('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x2413('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x2413('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x2413('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x2413('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 07f0b14..7c13e76 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 _0x1678=['updatedAt','crudPermissions','body','sequelize','get','UserProfileSection','autoAssociation','UserProfileResource','findAll','sectionId','userProfileId','Resources','describe','addSections','transaction','push','removeSections','ids','getSections','includes','isEmpty','subsections','enabled','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','section','hasOwnProperty','getResources','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','status','end','json','offset','limit','count','set','apply','save','update','destroy','sendStatus','error','name','send','index','map','UserProfile','rawAttributes','fieldName','key','query','keys','attributes','intersection','model','fields','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','then','rows','catch','show','params','length','includeAll','find','create','clone','omit','createdAt'];(function(_0x19035a,_0x27888){var _0x27c40c=function(_0x5d657e){while(--_0x5d657e){_0x19035a['push'](_0x19035a['shift']());}};_0x27c40c(++_0x27888);}(_0x1678,0x17b));var _0x8167=function(_0x34239f,_0x3acb88){_0x34239f=_0x34239f-0x0;var _0x5dce6d=_0x1678[_0x34239f];return _0x5dce6d;};'use strict';var emlformat=require(_0x8167('0x0'));var rimraf=require(_0x8167('0x1'));var zipdir=require(_0x8167('0x2'));var jsonpatch=require(_0x8167('0x3'));var rp=require(_0x8167('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8167('0x5'));var util=require(_0x8167('0x6'));var path=require(_0x8167('0x7'));var sox=require(_0x8167('0x8'));var csv=require(_0x8167('0x9'));var ejs=require(_0x8167('0xa'));var fs=require('fs');var fs_extra=require(_0x8167('0xb'));var _=require('lodash');var squel=require(_0x8167('0xc'));var crypto=require(_0x8167('0xd'));var jsforce=require(_0x8167('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8167('0xf'));var Papa=require(_0x8167('0x10'));var Redis=require('ioredis');var authService=require(_0x8167('0x11'));var qs=require(_0x8167('0x12'));var as=require(_0x8167('0x13'));var hardwareService=require(_0x8167('0x14'));var logger=require(_0x8167('0x15'))(_0x8167('0x16'));var utils=require(_0x8167('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8167('0x18'))['db'];config['redis']=_[_0x8167('0x19')](config[_0x8167('0x1a')],{'host':_0x8167('0x1b'),'port':0x18eb});var socket=require(_0x8167('0x1c'))(new Redis(config[_0x8167('0x1a')]));require('./userProfile.socket')[_0x8167('0x1d')](socket);function respondWithStatusCode(_0x48890d,_0x5968f3){_0x5968f3=_0x5968f3||0xcc;return function(_0x591413){if(_0x591413){return _0x48890d['sendStatus'](_0x5968f3);}return _0x48890d[_0x8167('0x1e')](_0x5968f3)[_0x8167('0x1f')]();};}function respondWithResult(_0x2aab53,_0x9bd451){_0x9bd451=_0x9bd451||0xc8;return function(_0x239b9f){if(_0x239b9f){return _0x2aab53[_0x8167('0x1e')](_0x9bd451)[_0x8167('0x20')](_0x239b9f);}};}function respondWithFilteredResult(_0xc5aef2,_0x269965){return function(_0x138504){if(_0x138504){var _0x5f4569=typeof _0x269965[_0x8167('0x21')]==='undefined'&&typeof _0x269965[_0x8167('0x22')]==='undefined';var _0x41b81a=_0x138504[_0x8167('0x23')];var _0x4a67d2=_0x5f4569?0x0:_0x269965[_0x8167('0x21')];var _0x25a59a=_0x5f4569?_0x138504[_0x8167('0x23')]:_0x269965[_0x8167('0x21')]+_0x269965[_0x8167('0x22')];var _0x30d4e3;if(_0x25a59a>=_0x41b81a){_0x25a59a=_0x41b81a;_0x30d4e3=0xc8;}else{_0x30d4e3=0xce;}_0xc5aef2[_0x8167('0x1e')](_0x30d4e3);return _0xc5aef2[_0x8167('0x24')]('Content-Range',_0x4a67d2+'-'+_0x25a59a+'/'+_0x41b81a)[_0x8167('0x20')](_0x138504);}return null;};}function patchUpdates(_0x51e7bc){return function(_0x565673){try{jsonpatch[_0x8167('0x25')](_0x565673,_0x51e7bc,!![]);}catch(_0x5a29f2){return BPromise['reject'](_0x5a29f2);}return _0x565673[_0x8167('0x26')]();};}function saveUpdates(_0x5a9bce,_0xbf60c3){return function(_0x4edb8a){if(_0x4edb8a){return _0x4edb8a[_0x8167('0x27')](_0x5a9bce)['then'](function(_0x44e579){return _0x44e579;});}return null;};}function removeEntity(_0x59a422,_0x16843e){return function(_0x32dae3){if(_0x32dae3){return _0x32dae3[_0x8167('0x28')]()['then'](function(){_0x59a422[_0x8167('0x1e')](0xcc)[_0x8167('0x1f')]();});}};}function handleEntityNotFound(_0x120834,_0x3995b2){return function(_0x643d1b){if(!_0x643d1b){_0x120834[_0x8167('0x29')](0x194);}return _0x643d1b;};}function handleError(_0x3307ed,_0x4ee50e){_0x4ee50e=_0x4ee50e||0x1f4;return function(_0x2ff3b3){logger[_0x8167('0x2a')](_0x2ff3b3['stack']);if(_0x2ff3b3[_0x8167('0x2b')]){delete _0x2ff3b3[_0x8167('0x2b')];}_0x3307ed[_0x8167('0x1e')](_0x4ee50e)[_0x8167('0x2c')](_0x2ff3b3);};}exports[_0x8167('0x2d')]=function(_0x1e625e,_0x1c9968){var _0x587f84={},_0x438460={},_0x2f5871={'count':0x0,'rows':[]};var _0x517c05=_[_0x8167('0x2e')](db[_0x8167('0x2f')][_0x8167('0x30')],function(_0x3f1cee){return{'name':_0x3f1cee[_0x8167('0x31')],'type':_0x3f1cee['type'][_0x8167('0x32')]};});_0x438460['model']=_[_0x8167('0x2e')](_0x517c05,_0x8167('0x2b'));_0x438460[_0x8167('0x33')]=_[_0x8167('0x34')](_0x1e625e[_0x8167('0x33')]);_0x438460['filters']=_['intersection'](_0x438460['model'],_0x438460['query']);_0x587f84[_0x8167('0x35')]=_[_0x8167('0x36')](_0x438460[_0x8167('0x37')],qs[_0x8167('0x38')](_0x1e625e[_0x8167('0x33')][_0x8167('0x38')]));_0x587f84['attributes']=_0x587f84[_0x8167('0x35')]['length']?_0x587f84[_0x8167('0x35')]:_0x438460[_0x8167('0x37')];if(!_0x1e625e['query']['hasOwnProperty'](_0x8167('0x39'))){_0x587f84[_0x8167('0x22')]=qs[_0x8167('0x22')](_0x1e625e[_0x8167('0x33')][_0x8167('0x22')]);_0x587f84['offset']=qs['offset'](_0x1e625e[_0x8167('0x33')]['offset']);}_0x587f84[_0x8167('0x3a')]=qs[_0x8167('0x3b')](_0x1e625e['query'][_0x8167('0x3b')]);_0x587f84[_0x8167('0x3c')]=qs[_0x8167('0x3d')](_[_0x8167('0x3e')](_0x1e625e[_0x8167('0x33')],_0x438460[_0x8167('0x3d')]),_0x517c05);if(_0x1e625e[_0x8167('0x33')][_0x8167('0x3f')]){_0x587f84[_0x8167('0x3c')]=_[_0x8167('0x40')](_0x587f84[_0x8167('0x3c')],{'$or':_[_0x8167('0x2e')](_0x517c05,function(_0x11e3e1){if(_0x11e3e1[_0x8167('0x41')]!==_0x8167('0x42')){var _0x59a194={};_0x59a194[_0x11e3e1[_0x8167('0x2b')]]={'$like':'%'+_0x1e625e['query'][_0x8167('0x3f')]+'%'};return _0x59a194;}})});}_0x587f84=_['merge']({},_0x587f84,_0x1e625e[_0x8167('0x43')]);var _0xbbcfd2={'where':_0x587f84['where']};return db[_0x8167('0x2f')]['count'](_0xbbcfd2)['then'](function(_0x40982e){_0x2f5871['count']=_0x40982e;if(_0x1e625e[_0x8167('0x33')]['includeAll']){_0x587f84[_0x8167('0x44')]=[{'all':!![]}];}return db[_0x8167('0x2f')]['findAll'](_0x587f84);})[_0x8167('0x45')](function(_0xfb3781){_0x2f5871[_0x8167('0x46')]=_0xfb3781;return _0x2f5871;})[_0x8167('0x45')](respondWithFilteredResult(_0x1c9968,_0x587f84))[_0x8167('0x47')](handleError(_0x1c9968,null));};exports[_0x8167('0x48')]=function(_0x338dc7,_0x3ec268){var _0x1d623b={'raw':![],'where':{'id':_0x338dc7[_0x8167('0x49')]['id']}},_0x1d13ce={};_0x1d13ce[_0x8167('0x37')]=_[_0x8167('0x34')](db[_0x8167('0x2f')]['rawAttributes']);_0x1d13ce[_0x8167('0x33')]=_[_0x8167('0x34')](_0x338dc7[_0x8167('0x33')]);_0x1d13ce['filters']=_[_0x8167('0x36')](_0x1d13ce[_0x8167('0x37')],_0x1d13ce[_0x8167('0x33')]);_0x1d623b[_0x8167('0x35')]=_[_0x8167('0x36')](_0x1d13ce[_0x8167('0x37')],qs[_0x8167('0x38')](_0x338dc7[_0x8167('0x33')][_0x8167('0x38')]));_0x1d623b[_0x8167('0x35')]=_0x1d623b[_0x8167('0x35')][_0x8167('0x4a')]?_0x1d623b[_0x8167('0x35')]:_0x1d13ce['model'];if(_0x338dc7[_0x8167('0x33')][_0x8167('0x4b')]){_0x1d623b[_0x8167('0x44')]=[{'all':!![]}];}_0x1d623b=_[_0x8167('0x40')]({},_0x1d623b,_0x338dc7[_0x8167('0x43')]);return db[_0x8167('0x2f')][_0x8167('0x4c')](_0x1d623b)['then'](handleEntityNotFound(_0x3ec268,null))[_0x8167('0x45')](respondWithResult(_0x3ec268,null))['catch'](handleError(_0x3ec268,null));};exports[_0x8167('0x4d')]=function(_0x3a864a,_0x2404ae){return db[_0x8167('0x2f')][_0x8167('0x4d')](_0x3a864a['body'],{})[_0x8167('0x45')](respondWithResult(_0x2404ae,0xc9))[_0x8167('0x47')](handleError(_0x2404ae,null));};exports[_0x8167('0x4e')]=function(_0x96305,_0x28b70c){var _0x50783b={'where':{'id':_0x96305[_0x8167('0x49')]['id']}},_0x2de1d4={};_0x2de1d4[_0x8167('0x37')]=_[_0x8167('0x34')](db[_0x8167('0x2f')][_0x8167('0x30')]);_0x50783b[_0x8167('0x35')]=_[_0x8167('0x36')](_0x2de1d4[_0x8167('0x37')],qs[_0x8167('0x38')](_0x96305[_0x8167('0x33')]['fields']));_0x50783b[_0x8167('0x35')]=_0x50783b[_0x8167('0x35')][_0x8167('0x4a')]?_0x50783b[_0x8167('0x35')]:_0x2de1d4['model'];if(_0x96305[_0x8167('0x33')][_0x8167('0x4b')]){_0x50783b[_0x8167('0x44')]=[{'all':!![]}];}_0x50783b=_[_0x8167('0x40')]({},_0x50783b,_0x96305[_0x8167('0x43')]);return db[_0x8167('0x2f')][_0x8167('0x4c')](_0x50783b)[_0x8167('0x45')](handleEntityNotFound(_0x28b70c,null))[_0x8167('0x45')](function(_0x4cf163){if(_0x4cf163){var _0x193727=_0x4cf163['get']({'plain':!![]});_0x193727=qs[_0x8167('0x4f')](_0x193727,['id',_0x8167('0x50'),_0x8167('0x51'),_0x8167('0x52')]);_0x96305[_0x8167('0x53')]=_[_0x8167('0x4f')](_0x96305['body'],['id',_0x8167('0x50'),'updatedAt']);return db[_0x8167('0x54')]['transaction'](function(_0x57ac0e){return db['UserProfile'][_0x8167('0x4d')](_['merge'](_0x193727,_0x96305[_0x8167('0x53')]),{'include':_0x96305[_0x8167('0x33')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x57ac0e})[_0x8167('0x45')](function(_0x330805){var _0x2186a7=_0x330805[_0x8167('0x55')]({'plain':!![]});return db[_0x8167('0x56')]['findAll']({'where':{'userProfileId':_0x96305['params']['id']},'raw':!![]})[_0x8167('0x45')](function(_0x59c776){if(_0x59c776){return BPromise['each'](_0x59c776,function(_0x3abcd7){return new BPromise(function(_0x1efa3d,_0x135aa0){if(_0x3abcd7[_0x8167('0x57')]===null||_0x3abcd7[_0x8167('0x57')]===0x1)_0x1efa3d(null);return db[_0x8167('0x58')][_0x8167('0x59')]({'where':{'sectionId':_0x3abcd7['id']},'raw':!![]})['then'](function(_0x570e58){var _0x3d7d82=_[_0x8167('0x2e')](_0x570e58,function(_0x114c2f){return qs['omit'](_0x114c2f,['id',_0x8167('0x50'),_0x8167('0x51'),_0x8167('0x5a')]);});_0x1efa3d(_0x3d7d82);})[_0x8167('0x47')](function(_0x8b0b7a){_0x135aa0(_0x8b0b7a);});})[_0x8167('0x45')](function(_0xf96845){var _0x247665=qs[_0x8167('0x4f')](_0x3abcd7,['id',_0x8167('0x50'),_0x8167('0x51')]);_0x247665[_0x8167('0x5b')]=_0x2186a7['id'];if(_0xf96845)_0x247665[_0x8167('0x5c')]=_0xf96845;return _0x247665;})[_0x8167('0x45')](function(_0x13338c){return db['UserProfileSection'][_0x8167('0x4d')](_0x13338c,{'include':[{'model':db[_0x8167('0x58')],'as':'Resources'}],'raw':!![],'transaction':_0x57ac0e});});})[_0x8167('0x45')](function(){return _0x2186a7;});}});});});}})[_0x8167('0x45')](respondWithResult(_0x28b70c,0xc9))['catch'](handleError(_0x28b70c,null));};exports[_0x8167('0x27')]=function(_0x4cd085,_0x14e55b){if(_0x4cd085[_0x8167('0x53')]['id']){delete _0x4cd085[_0x8167('0x53')]['id'];}return db[_0x8167('0x2f')][_0x8167('0x4c')]({'where':{'id':_0x4cd085[_0x8167('0x49')]['id']}})[_0x8167('0x45')](handleEntityNotFound(_0x14e55b,null))[_0x8167('0x45')](saveUpdates(_0x4cd085[_0x8167('0x53')],null))[_0x8167('0x45')](respondWithResult(_0x14e55b,null))[_0x8167('0x47')](handleError(_0x14e55b,null));};exports['destroy']=function(_0x26d67a,_0x321894){return db[_0x8167('0x2f')][_0x8167('0x4c')]({'where':{'id':_0x26d67a[_0x8167('0x49')]['id']}})[_0x8167('0x45')](handleEntityNotFound(_0x321894,null))[_0x8167('0x45')](removeEntity(_0x321894,null))[_0x8167('0x47')](handleError(_0x321894,null));};exports['describe']=function(_0x210073,_0x180eaa){return db['UserProfile'][_0x8167('0x5d')]()[_0x8167('0x45')](respondWithResult(_0x180eaa,null))[_0x8167('0x47')](handleError(_0x180eaa,null));};exports[_0x8167('0x5e')]=function(_0x62f627,_0x54ec97){var _0x1e9062=_0x62f627[_0x8167('0x53')];return db['UserProfile'][_0x8167('0x4c')]({'where':{'id':_0x62f627[_0x8167('0x49')]['id']}})['then'](handleEntityNotFound(_0x54ec97,null))[_0x8167('0x45')](function(_0x18a1b2){if(_0x18a1b2){return db[_0x8167('0x54')][_0x8167('0x5f')](function(_0x412cfe){return db[_0x8167('0x56')]['destroy']({'where':{'userProfileId':_0x62f627[_0x8167('0x49')]['id'],'sectionId':_[_0x8167('0x2e')](_0x1e9062,function(_0x136d20){return _0x136d20[_0x8167('0x5a')];})},'transaction':_0x412cfe})['then'](function(){var _0x2935fe=_[_0x8167('0x2e')](_0x1e9062,function(_0x132223){_0x132223['userProfileId']=_0x62f627[_0x8167('0x49')]['id'];return _0x132223;});var _0x36b537=[];return BPromise['each'](_0x2935fe,function(_0x10aca7){return db[_0x8167('0x56')]['create'](_0x10aca7,{'include':[{'model':db[_0x8167('0x58')],'as':_0x8167('0x5c')}],'raw':!![],'transaction':_0x412cfe})['then'](function(_0x43a87e){_0x36b537[_0x8167('0x60')](_0x43a87e[_0x8167('0x55')]({'plain':!![]}));});})[_0x8167('0x45')](function(){return _0x36b537;});});});}})[_0x8167('0x45')](function(_0x4bcbdc){return _0x4bcbdc;})[_0x8167('0x45')](respondWithResult(_0x54ec97,null))['catch'](handleError(_0x54ec97,null));};exports[_0x8167('0x61')]=function(_0x2a5348,_0x4e81fb){var _0x1b4e4d;return db[_0x8167('0x2f')][_0x8167('0x4c')]({'where':{'id':_0x2a5348[_0x8167('0x49')]['id']},'attributes':['id',_0x8167('0x2b')]})[_0x8167('0x45')](handleEntityNotFound(_0x4e81fb,null))['then'](function(_0x333bde){if(_0x333bde){_0x1b4e4d=_0x333bde;return db[_0x8167('0x56')][_0x8167('0x28')]({'where':{'userProfileId':_0x2a5348[_0x8167('0x49')]['id'],'sectionId':_0x2a5348[_0x8167('0x33')][_0x8167('0x62')]}});}})[_0x8167('0x45')](function(){return _0x1b4e4d;})[_0x8167('0x45')](respondWithStatusCode(_0x4e81fb,null))[_0x8167('0x47')](handleError(_0x4e81fb,null));};exports[_0x8167('0x63')]=function(_0x3896b8,_0x2feae6){var _0xd49171=[];var _0x2858fe=[];return db[_0x8167('0x56')][_0x8167('0x59')]({'where':{'userProfileId':_0x3896b8[_0x8167('0x49')]['id']},'raw':!![]})[_0x8167('0x45')](function(_0x393907){_0xd49171=_[_0x8167('0x3f')](_0x393907,function(_0x30ba80){return _0x30ba80['enabled']===0x1||_[_0x8167('0x64')]([0x3eb,0x709],_0x30ba80[_0x8167('0x5a')]);});if(!_[_0x8167('0x65')](_0xd49171)){return _[_0x8167('0x2e')](_0xd49171,function(_0x562e81){return _0x562e81[_0x8167('0x5a')];});}else{return;}})[_0x8167('0x45')](function(_0xa1866f){if(_0xa1866f)_0x2858fe=_0xa1866f;if(_['includes'](_0x2858fe,0x64)){var _0x3e6c74=_[_0x8167('0x4c')](_0xd49171,{'sectionId':0x64});return hasDefaultDashboard(_0x3e6c74)[_0x8167('0x45')](function(_0x4544b3){return _['map'](_0xd49171,function(_0x4a5897){if(_0x4a5897[_0x8167('0x5a')]===0x64){_0x4a5897[_0x8167('0x66')]=_0x4544b3;}return _0x4a5897;});});}else{return;}})['then'](function(_0xc35e78){if(_0xc35e78)_0xd49171=_0xc35e78;if(_[_0x8167('0x64')](_0x2858fe,0x3eb)){var _0x53d018=_[_0x8167('0x4c')](_0xd49171,{'sectionId':0x3eb});return getCustomDashboards(_0x53d018)[_0x8167('0x45')](function(_0x2c210e){return _[_0x8167('0x2e')](_0xd49171,function(_0x332737){if(_0x53d018[_0x8167('0x67')]){if(_0x332737[_0x8167('0x5a')]===0x3eb){_0x332737[_0x8167('0x66')]=_0x2c210e;}}else{if(_0x332737[_0x8167('0x5a')]===0x64){_0x332737[_0x8167('0x66')]=_0x2c210e;}}return _0x332737;});});}else{return;}})[_0x8167('0x45')](function(_0x344128){if(_0x344128)_0xd49171=_0x344128;if(_[_0x8167('0x64')](_0x2858fe,0x709)){var _0x37f37a=_[_0x8167('0x4c')](_0xd49171,{'sectionId':0x709});return getPlugins(_0x37f37a)['then'](function(_0x1b6d7e){if(_0x37f37a[_0x8167('0x67')]){return _[_0x8167('0x2e')](_0xd49171,function(_0x2b592c){if(_0x2b592c['sectionId']===0x709){_0x2b592c[_0x8167('0x66')]=_0x1b6d7e;}return _0x2b592c;});}else{var _0x2a538f={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1b6d7e};var _0x5dcf02=_[_0x8167('0x2e')](_0xd49171);_0x5dcf02[_0x8167('0x60')](_0x2a538f);return _0x5dcf02;}});}else{return;}})['then'](function(_0x267d3a){if(_0x267d3a)_0xd49171=_0x267d3a;return _[_0x8167('0x3f')](_0xd49171,[_0x8167('0x67'),0x1]);})[_0x8167('0x45')](respondWithResult(_0x2feae6,null))[_0x8167('0x47')](handleError(_0x2feae6,null));};function hasDefaultDashboard(_0xd4f345){var _0x21e954=[0x65];return new BPromise(function(_0x9b85cf,_0x1599ee){try{if(_0xd4f345[_0x8167('0x57')]){_0x9b85cf(_0x21e954);}else{return db[_0x8167('0x58')][_0x8167('0x68')]({'where':{'sectionId':_0xd4f345['id']},'raw':!![]})['then'](function(_0x1c93ce){_0x1c93ce?_0x9b85cf(_0x21e954):_0x9b85cf();});}}catch(_0x5e084f){_0x1599ee(_0x5e084f);}});}function getCustomDashboards(_0x19658c){var _0x5126dc=[];return new BPromise(function(_0x213ad3,_0x1b7eca){try{if(_0x19658c[_0x8167('0x57')]){return db[_0x8167('0x69')]['findAll']({'raw':!![]})[_0x8167('0x45')](function(_0x588f45){_0x588f45[_0x8167('0x6a')](function(_0xd19c80){_0x5126dc[_0x8167('0x60')](_0xd19c80['id']+0x1869f);});_0x213ad3(_0x5126dc);});}else{return db['UserProfileResource'][_0x8167('0x59')]({'where':{'sectionId':_0x19658c['id']},'raw':!![]})['then'](function(_0x5de1d5){_0x5de1d5[_0x8167('0x6a')](function(_0x2824ad){_0x5126dc[_0x8167('0x60')](_0x2824ad[_0x8167('0x6b')]+0x1869f);});_0x213ad3(_0x5126dc);});}}catch(_0x31ba1a){_0x1b7eca(_0x31ba1a);}});}function getPlugins(_0x16d5dc){var _0x5894a3=[];return new BPromise(function(_0x188504,_0x49c2d5){try{if(_0x16d5dc[_0x8167('0x57')]){return db[_0x8167('0x6c')][_0x8167('0x59')]({'raw':!![]})[_0x8167('0x45')](function(_0x21bc48){_0x21bc48[_0x8167('0x6a')](function(_0x2433d9){_0x5894a3[_0x8167('0x60')](_0x2433d9['id']+0x15b38);});_0x188504(_0x5894a3);});}else{return db[_0x8167('0x58')]['findAll']({'where':{'sectionId':_0x16d5dc['id']},'raw':!![]})['then'](function(_0x67f17e){_0x67f17e[_0x8167('0x6a')](function(_0xb760e2){_0x5894a3['push'](_0xb760e2[_0x8167('0x6b')]+0x15b38);});_0x188504(_0x5894a3);});}}catch(_0x6deb0){_0x49c2d5(_0x6deb0);}});}exports[_0x8167('0x6d')]=function(_0x3d7b94,_0x3cf0b8){return db[_0x8167('0x2f')][_0x8167('0x4c')]({'where':{'id':_0x3d7b94[_0x8167('0x49')]['id']}})['then'](handleEntityNotFound(_0x3cf0b8,null))[_0x8167('0x45')](function(_0x55063e){if(_0x55063e){return db[_0x8167('0x54')][_0x8167('0x5f')](function(_0x5c6182){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x3d7b94[_0x8167('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0x8167('0x45')](function(_0x13b2bb){if(_0x13b2bb){return db[_0x8167('0x56')][_0x8167('0x28')]({'where':{'userProfileId':_0x3d7b94[_0x8167('0x49')]['id'],'id':_[_0x8167('0x2e')](_0x13b2bb,function(_0x28a945){return _0x28a945['id'];})},'transaction':_0x5c6182});}})['then'](function(_0x4e14ea){var _0x42014a=_[_0x8167('0x2e')](_0x3d7b94[_0x8167('0x53')],function(_0x120b57){_0x120b57[_0x8167('0x5b')]=_0x3d7b94['params']['id'];return _0x120b57;});return db[_0x8167('0x56')][_0x8167('0x6e')](_0x42014a,{'raw':!![],'transaction':_0x5c6182});})[_0x8167('0x45')](function(_0x1a04cd){var _0x3d4712=_[_0x8167('0x3f')](_[_0x8167('0x2e')](_0x1a04cd,function(_0x5ad8a7){return _0x5ad8a7[_0x8167('0x55')]({'plain':!![]});}),{'includeAll':![]});if(_0x3d4712){return db[_0x8167('0x56')][_0x8167('0x59')]({'where':{'userProfileId':_0x3d7b94[_0x8167('0x49')]['id'],'sectionId':_['map'](_0x3d4712,function(_0x240b55){return _0x240b55[_0x8167('0x5a')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x8167('0x45')](function(_0x2d8b97){var _0x440e45=_[_0x8167('0x2e')](_0x3d7b94[_0x8167('0x53')],function(_0x1d833c){_0x1d833c[_0x8167('0x5b')]=_0x3d7b94[_0x8167('0x49')]['id'];return _0x1d833c;});return db[_0x8167('0x58')][_0x8167('0x6e')](_0x440e45,{'raw':!![],'transaction':_0x5c6182});});}})['catch'](handleError(_0x3cf0b8,null));});}})[_0x8167('0x45')](function(_0x206c9a){var _0x4fffa5=_[_0x8167('0x2e')](_0x206c9a,function(_0x5b1235){return _0x5b1235['get']({'plain':!![]});});})[_0x8167('0x45')](respondWithResult(_0x3cf0b8,null))[_0x8167('0x47')](handleError(_0x3cf0b8,null));};exports[_0x8167('0x6f')]=function(_0x11db09,_0x148b75,_0x576745){return db[_0x8167('0x2f')][_0x8167('0x4c')]({'where':{'id':_0x11db09[_0x8167('0x49')]['id']}})[_0x8167('0x45')](handleEntityNotFound(_0x148b75,null))['then'](function(_0x3cc6c3){if(_0x3cc6c3){return _0x3cc6c3[_0x8167('0x6f')](_0x11db09['query'][_0x8167('0x62')]);}})['then'](respondWithStatusCode(_0x148b75,null))[_0x8167('0x47')](handleError(_0x148b75,null));};exports['getResources']=function(_0x35fae4,_0x5476de){var _0x1919d2={};if(!_0x35fae4['query'][_0x8167('0x70')])throw new Error('Missing\x20section\x20parameter');if(!_0x35fae4['query'][_0x8167('0x71')](_0x8167('0x39'))){_0x1919d2[_0x8167('0x22')]=qs['limit'](_0x35fae4[_0x8167('0x33')][_0x8167('0x22')]);_0x1919d2[_0x8167('0x21')]=qs['offset'](_0x35fae4['query'][_0x8167('0x21')]);}return db[_0x8167('0x2f')][_0x8167('0x4c')]({'where':{'id':_0x35fae4['params']['id']}})[_0x8167('0x45')](function(_0x2c40cd){if(!_0x2c40cd)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x35fae4[_0x8167('0x49')]['id']);return db['UserProfile'][_0x8167('0x72')](_0x35fae4);})[_0x8167('0x45')](respondWithFilteredResult(_0x5476de,_0x1919d2))[_0x8167('0x47')](handleError(_0x5476de,null));}; \ No newline at end of file +var _0x1775=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','name','send','index','UserProfile','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','then','include','params','includeAll','find','catch','create','clone','rawAttributes','options','get','updatedAt','crudPermissions','body','omit','createdAt','sequelize','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','sectionId','Resources','describe','addSections','transaction','userProfileId','removeSections','ids','getSections','includes','isEmpty','subsections','enabled','push','findOne','Dashboard','resourceId','forEach','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x408de5,_0x24fa7b){var _0x2015a1=function(_0x13082c){while(--_0x13082c){_0x408de5['push'](_0x408de5['shift']());}};_0x2015a1(++_0x24fa7b);}(_0x1775,0x1db));var _0x5177=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1775[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5177('0x0'));var zipdir=require(_0x5177('0x1'));var jsonpatch=require(_0x5177('0x2'));var rp=require(_0x5177('0x3'));var moment=require(_0x5177('0x4'));var BPromise=require(_0x5177('0x5'));var Mustache=require(_0x5177('0x6'));var util=require(_0x5177('0x7'));var path=require(_0x5177('0x8'));var sox=require(_0x5177('0x9'));var csv=require(_0x5177('0xa'));var ejs=require(_0x5177('0xb'));var fs=require('fs');var fs_extra=require(_0x5177('0xc'));var _=require(_0x5177('0xd'));var squel=require(_0x5177('0xe'));var crypto=require(_0x5177('0xf'));var jsforce=require(_0x5177('0x10'));var deskjs=require(_0x5177('0x11'));var toCsv=require(_0x5177('0xa'));var querystring=require(_0x5177('0x12'));var Papa=require(_0x5177('0x13'));var Redis=require(_0x5177('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5177('0x15'));var hardwareService=require(_0x5177('0x16'));var logger=require(_0x5177('0x17'))(_0x5177('0x18'));var utils=require(_0x5177('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x5177('0x1a'));var db=require(_0x5177('0x1b'))['db'];config[_0x5177('0x1c')]=_[_0x5177('0x1d')](config[_0x5177('0x1c')],{'host':_0x5177('0x1e'),'port':0x18eb});var socket=require(_0x5177('0x1f'))(new Redis(config[_0x5177('0x1c')]));require(_0x5177('0x20'))[_0x5177('0x21')](socket);function respondWithStatusCode(_0x41bef4,_0x2bf5bb){_0x2bf5bb=_0x2bf5bb||0xcc;return function(_0x29cd2c){if(_0x29cd2c){return _0x41bef4[_0x5177('0x22')](_0x2bf5bb);}return _0x41bef4[_0x5177('0x23')](_0x2bf5bb)[_0x5177('0x24')]();};}function respondWithResult(_0x2ab5e5,_0x7dba6f){_0x7dba6f=_0x7dba6f||0xc8;return function(_0xe6dcf6){if(_0xe6dcf6){return _0x2ab5e5['status'](_0x7dba6f)[_0x5177('0x25')](_0xe6dcf6);}};}function respondWithFilteredResult(_0x41e687,_0x3f5ab5){return function(_0x1b4102){if(_0x1b4102){var _0x5f5bd4=typeof _0x3f5ab5[_0x5177('0x26')]===_0x5177('0x27')&&typeof _0x3f5ab5[_0x5177('0x28')]==='undefined';var _0x86f5f8=_0x1b4102['count'];var _0xc2b2b5=_0x5f5bd4?0x0:_0x3f5ab5[_0x5177('0x26')];var _0x219744=_0x5f5bd4?_0x1b4102[_0x5177('0x29')]:_0x3f5ab5[_0x5177('0x26')]+_0x3f5ab5[_0x5177('0x28')];var _0x174c4f;if(_0x219744>=_0x86f5f8){_0x219744=_0x86f5f8;_0x174c4f=0xc8;}else{_0x174c4f=0xce;}_0x41e687[_0x5177('0x23')](_0x174c4f);return _0x41e687[_0x5177('0x2a')](_0x5177('0x2b'),_0xc2b2b5+'-'+_0x219744+'/'+_0x86f5f8)[_0x5177('0x25')](_0x1b4102);}return null;};}function patchUpdates(_0x3b0c37){return function(_0x5d9a9c){try{jsonpatch[_0x5177('0x2c')](_0x5d9a9c,_0x3b0c37,!![]);}catch(_0x556f96){return BPromise[_0x5177('0x2d')](_0x556f96);}return _0x5d9a9c[_0x5177('0x2e')]();};}function saveUpdates(_0x3b39b5,_0x2d51d0){return function(_0x4bc8e2){if(_0x4bc8e2){return _0x4bc8e2[_0x5177('0x2f')](_0x3b39b5)['then'](function(_0x564139){return _0x564139;});}return null;};}function removeEntity(_0x19a0c2,_0x15cb93){return function(_0x577bf7){if(_0x577bf7){return _0x577bf7[_0x5177('0x30')]()['then'](function(){_0x19a0c2[_0x5177('0x23')](0xcc)[_0x5177('0x24')]();});}};}function handleEntityNotFound(_0x58846c,_0x3e021a){return function(_0x2554ec){if(!_0x2554ec){_0x58846c[_0x5177('0x22')](0x194);}return _0x2554ec;};}function handleError(_0x7f86e,_0xe98ff1){_0xe98ff1=_0xe98ff1||0x1f4;return function(_0x1cef5d){logger['error'](_0x1cef5d['stack']);if(_0x1cef5d[_0x5177('0x31')]){delete _0x1cef5d[_0x5177('0x31')];}_0x7f86e[_0x5177('0x23')](_0xe98ff1)[_0x5177('0x32')](_0x1cef5d);};}exports[_0x5177('0x33')]=function(_0x8134f9,_0x31eb9f){var _0x72dced={},_0x49f6f1={},_0x42e1db={'count':0x0,'rows':[]};var _0x2233a2=_['map'](db[_0x5177('0x34')]['rawAttributes'],function(_0x172b36){return{'name':_0x172b36[_0x5177('0x35')],'type':_0x172b36[_0x5177('0x36')]['key']};});_0x49f6f1['model']=_[_0x5177('0x37')](_0x2233a2,_0x5177('0x31'));_0x49f6f1[_0x5177('0x38')]=_[_0x5177('0x39')](_0x8134f9[_0x5177('0x38')]);_0x49f6f1[_0x5177('0x3a')]=_[_0x5177('0x3b')](_0x49f6f1[_0x5177('0x3c')],_0x49f6f1['query']);_0x72dced[_0x5177('0x3d')]=_[_0x5177('0x3b')](_0x49f6f1['model'],qs[_0x5177('0x3e')](_0x8134f9[_0x5177('0x38')][_0x5177('0x3e')]));_0x72dced[_0x5177('0x3d')]=_0x72dced[_0x5177('0x3d')][_0x5177('0x3f')]?_0x72dced['attributes']:_0x49f6f1[_0x5177('0x3c')];if(!_0x8134f9[_0x5177('0x38')][_0x5177('0x40')](_0x5177('0x41'))){_0x72dced[_0x5177('0x28')]=qs[_0x5177('0x28')](_0x8134f9[_0x5177('0x38')]['limit']);_0x72dced[_0x5177('0x26')]=qs[_0x5177('0x26')](_0x8134f9['query']['offset']);}_0x72dced[_0x5177('0x42')]=qs[_0x5177('0x43')](_0x8134f9[_0x5177('0x38')][_0x5177('0x43')]);_0x72dced[_0x5177('0x44')]=qs[_0x5177('0x3a')](_[_0x5177('0x45')](_0x8134f9[_0x5177('0x38')],_0x49f6f1[_0x5177('0x3a')]),_0x2233a2);if(_0x8134f9[_0x5177('0x38')][_0x5177('0x46')]){_0x72dced[_0x5177('0x44')]=_[_0x5177('0x47')](_0x72dced['where'],{'$or':_[_0x5177('0x37')](_0x2233a2,function(_0x2a4db1){if(_0x2a4db1['type']!==_0x5177('0x48')){var _0x56f297={};_0x56f297[_0x2a4db1[_0x5177('0x31')]]={'$like':'%'+_0x8134f9[_0x5177('0x38')][_0x5177('0x46')]+'%'};return _0x56f297;}})});}_0x72dced=_['merge']({},_0x72dced,_0x8134f9['options']);var _0x210510={'where':_0x72dced[_0x5177('0x44')]};return db[_0x5177('0x34')][_0x5177('0x29')](_0x210510)[_0x5177('0x49')](function(_0x3e710d){_0x42e1db[_0x5177('0x29')]=_0x3e710d;if(_0x8134f9[_0x5177('0x38')]['includeAll']){_0x72dced[_0x5177('0x4a')]=[{'all':!![]}];}return db['UserProfile']['findAll'](_0x72dced);})[_0x5177('0x49')](function(_0x17dc98){_0x42e1db['rows']=_0x17dc98;return _0x42e1db;})[_0x5177('0x49')](respondWithFilteredResult(_0x31eb9f,_0x72dced))['catch'](handleError(_0x31eb9f,null));};exports['show']=function(_0x46c833,_0x1769cd){var _0x262c71={'raw':![],'where':{'id':_0x46c833[_0x5177('0x4b')]['id']}},_0x3776b8={};_0x3776b8[_0x5177('0x3c')]=_[_0x5177('0x39')](db['UserProfile']['rawAttributes']);_0x3776b8[_0x5177('0x38')]=_['keys'](_0x46c833[_0x5177('0x38')]);_0x3776b8[_0x5177('0x3a')]=_[_0x5177('0x3b')](_0x3776b8[_0x5177('0x3c')],_0x3776b8['query']);_0x262c71[_0x5177('0x3d')]=_[_0x5177('0x3b')](_0x3776b8[_0x5177('0x3c')],qs[_0x5177('0x3e')](_0x46c833[_0x5177('0x38')][_0x5177('0x3e')]));_0x262c71[_0x5177('0x3d')]=_0x262c71[_0x5177('0x3d')][_0x5177('0x3f')]?_0x262c71[_0x5177('0x3d')]:_0x3776b8[_0x5177('0x3c')];if(_0x46c833['query'][_0x5177('0x4c')]){_0x262c71['include']=[{'all':!![]}];}_0x262c71=_['merge']({},_0x262c71,_0x46c833['options']);return db[_0x5177('0x34')][_0x5177('0x4d')](_0x262c71)['then'](handleEntityNotFound(_0x1769cd,null))[_0x5177('0x49')](respondWithResult(_0x1769cd,null))[_0x5177('0x4e')](handleError(_0x1769cd,null));};exports[_0x5177('0x4f')]=function(_0x4891fe,_0x1d4ae4){return db['UserProfile']['create'](_0x4891fe['body'],{})[_0x5177('0x49')](respondWithResult(_0x1d4ae4,0xc9))[_0x5177('0x4e')](handleError(_0x1d4ae4,null));};exports[_0x5177('0x50')]=function(_0x5a1f8b,_0x4e53e4){var _0x42b827={'where':{'id':_0x5a1f8b[_0x5177('0x4b')]['id']}},_0x5be355={};_0x5be355[_0x5177('0x3c')]=_[_0x5177('0x39')](db[_0x5177('0x34')][_0x5177('0x51')]);_0x42b827[_0x5177('0x3d')]=_[_0x5177('0x3b')](_0x5be355[_0x5177('0x3c')],qs[_0x5177('0x3e')](_0x5a1f8b[_0x5177('0x38')][_0x5177('0x3e')]));_0x42b827[_0x5177('0x3d')]=_0x42b827[_0x5177('0x3d')]['length']?_0x42b827['attributes']:_0x5be355[_0x5177('0x3c')];if(_0x5a1f8b['query'][_0x5177('0x4c')]){_0x42b827['include']=[{'all':!![]}];}_0x42b827=_[_0x5177('0x47')]({},_0x42b827,_0x5a1f8b[_0x5177('0x52')]);return db[_0x5177('0x34')]['find'](_0x42b827)['then'](handleEntityNotFound(_0x4e53e4,null))[_0x5177('0x49')](function(_0x43b5b9){if(_0x43b5b9){var _0x2eb560=_0x43b5b9[_0x5177('0x53')]({'plain':!![]});_0x2eb560=qs['omit'](_0x2eb560,['id','createdAt',_0x5177('0x54'),_0x5177('0x55')]);_0x5a1f8b[_0x5177('0x56')]=_[_0x5177('0x57')](_0x5a1f8b['body'],['id',_0x5177('0x58'),_0x5177('0x54')]);return db[_0x5177('0x59')]['transaction'](function(_0x2b39ba){return db[_0x5177('0x34')][_0x5177('0x4f')](_['merge'](_0x2eb560,_0x5a1f8b[_0x5177('0x56')]),{'include':_0x5a1f8b['query'][_0x5177('0x4c')]?[{'all':!![]}]:undefined,'transaction':_0x2b39ba})[_0x5177('0x49')](function(_0x3268bd){var _0x5101fc=_0x3268bd[_0x5177('0x53')]({'plain':!![]});return db[_0x5177('0x5a')][_0x5177('0x5b')]({'where':{'userProfileId':_0x5a1f8b[_0x5177('0x4b')]['id']},'raw':!![]})[_0x5177('0x49')](function(_0x74589e){if(_0x74589e){return BPromise[_0x5177('0x5c')](_0x74589e,function(_0x267599){return new BPromise(function(_0x5ceed2,_0x5d96ce){if(_0x267599['autoAssociation']===null||_0x267599[_0x5177('0x5d')]===0x1)_0x5ceed2(null);return db[_0x5177('0x5e')][_0x5177('0x5b')]({'where':{'sectionId':_0x267599['id']},'raw':!![]})[_0x5177('0x49')](function(_0x2472e9){var _0x62a68a=_['map'](_0x2472e9,function(_0x523531){return qs[_0x5177('0x57')](_0x523531,['id',_0x5177('0x58'),_0x5177('0x54'),_0x5177('0x5f')]);});_0x5ceed2(_0x62a68a);})[_0x5177('0x4e')](function(_0x1b1778){_0x5d96ce(_0x1b1778);});})[_0x5177('0x49')](function(_0xd9c1db){var _0xbfb3d7=qs['omit'](_0x267599,['id',_0x5177('0x58'),_0x5177('0x54')]);_0xbfb3d7['userProfileId']=_0x5101fc['id'];if(_0xd9c1db)_0xbfb3d7[_0x5177('0x60')]=_0xd9c1db;return _0xbfb3d7;})[_0x5177('0x49')](function(_0x4edebc){return db[_0x5177('0x5a')][_0x5177('0x4f')](_0x4edebc,{'include':[{'model':db[_0x5177('0x5e')],'as':'Resources'}],'raw':!![],'transaction':_0x2b39ba});});})[_0x5177('0x49')](function(){return _0x5101fc;});}});});});}})[_0x5177('0x49')](respondWithResult(_0x4e53e4,0xc9))['catch'](handleError(_0x4e53e4,null));};exports['update']=function(_0x102c27,_0x4f76d7){if(_0x102c27[_0x5177('0x56')]['id']){delete _0x102c27['body']['id'];}return db[_0x5177('0x34')][_0x5177('0x4d')]({'where':{'id':_0x102c27['params']['id']}})[_0x5177('0x49')](handleEntityNotFound(_0x4f76d7,null))[_0x5177('0x49')](saveUpdates(_0x102c27[_0x5177('0x56')],null))[_0x5177('0x49')](respondWithResult(_0x4f76d7,null))[_0x5177('0x4e')](handleError(_0x4f76d7,null));};exports[_0x5177('0x30')]=function(_0x20d476,_0x58ebdd){return db[_0x5177('0x34')]['find']({'where':{'id':_0x20d476['params']['id']}})[_0x5177('0x49')](handleEntityNotFound(_0x58ebdd,null))[_0x5177('0x49')](removeEntity(_0x58ebdd,null))['catch'](handleError(_0x58ebdd,null));};exports[_0x5177('0x61')]=function(_0xa889bd,_0x43abdd){return db[_0x5177('0x34')][_0x5177('0x61')]()[_0x5177('0x49')](respondWithResult(_0x43abdd,null))[_0x5177('0x4e')](handleError(_0x43abdd,null));};exports[_0x5177('0x62')]=function(_0x478d5e,_0x54b28f){var _0xee5f8b=_0x478d5e[_0x5177('0x56')];return db[_0x5177('0x34')][_0x5177('0x4d')]({'where':{'id':_0x478d5e[_0x5177('0x4b')]['id']}})[_0x5177('0x49')](handleEntityNotFound(_0x54b28f,null))['then'](function(_0x3692b2){if(_0x3692b2){return db[_0x5177('0x59')][_0x5177('0x63')](function(_0x46d72e){return db['UserProfileSection'][_0x5177('0x30')]({'where':{'userProfileId':_0x478d5e[_0x5177('0x4b')]['id'],'sectionId':_[_0x5177('0x37')](_0xee5f8b,function(_0x22da9d){return _0x22da9d[_0x5177('0x5f')];})},'transaction':_0x46d72e})['then'](function(){var _0x2734fc=_['map'](_0xee5f8b,function(_0x1a6499){_0x1a6499[_0x5177('0x64')]=_0x478d5e['params']['id'];return _0x1a6499;});var _0x67d605=[];return BPromise[_0x5177('0x5c')](_0x2734fc,function(_0x367784){return db[_0x5177('0x5a')]['create'](_0x367784,{'include':[{'model':db[_0x5177('0x5e')],'as':_0x5177('0x60')}],'raw':!![],'transaction':_0x46d72e})[_0x5177('0x49')](function(_0x20fc85){_0x67d605['push'](_0x20fc85[_0x5177('0x53')]({'plain':!![]}));});})[_0x5177('0x49')](function(){return _0x67d605;});});});}})[_0x5177('0x49')](function(_0x4c8a15){return _0x4c8a15;})['then'](respondWithResult(_0x54b28f,null))[_0x5177('0x4e')](handleError(_0x54b28f,null));};exports[_0x5177('0x65')]=function(_0x3f42a5,_0x170e25){var _0xb2aca2;return db[_0x5177('0x34')][_0x5177('0x4d')]({'where':{'id':_0x3f42a5[_0x5177('0x4b')]['id']},'attributes':['id',_0x5177('0x31')]})['then'](handleEntityNotFound(_0x170e25,null))['then'](function(_0x597a84){if(_0x597a84){_0xb2aca2=_0x597a84;return db[_0x5177('0x5a')]['destroy']({'where':{'userProfileId':_0x3f42a5[_0x5177('0x4b')]['id'],'sectionId':_0x3f42a5[_0x5177('0x38')][_0x5177('0x66')]}});}})[_0x5177('0x49')](function(){return _0xb2aca2;})[_0x5177('0x49')](respondWithStatusCode(_0x170e25,null))['catch'](handleError(_0x170e25,null));};exports[_0x5177('0x67')]=function(_0x10247,_0x41a7fa){var _0x4fce32=[];var _0x3d845e=[];return db['UserProfileSection'][_0x5177('0x5b')]({'where':{'userProfileId':_0x10247[_0x5177('0x4b')]['id']},'raw':!![]})['then'](function(_0xe5a705){_0x4fce32=_[_0x5177('0x46')](_0xe5a705,function(_0x53ccd8){return _0x53ccd8['enabled']===0x1||_[_0x5177('0x68')]([0x3eb,0x709],_0x53ccd8['sectionId']);});if(!_[_0x5177('0x69')](_0x4fce32)){return _[_0x5177('0x37')](_0x4fce32,function(_0x5a9bc8){return _0x5a9bc8[_0x5177('0x5f')];});}else{return;}})[_0x5177('0x49')](function(_0xcbbb73){if(_0xcbbb73)_0x3d845e=_0xcbbb73;if(_[_0x5177('0x68')](_0x3d845e,0x64)){var _0x43a584=_[_0x5177('0x4d')](_0x4fce32,{'sectionId':0x64});return hasDefaultDashboard(_0x43a584)[_0x5177('0x49')](function(_0x10b062){return _['map'](_0x4fce32,function(_0x2c9025){if(_0x2c9025['sectionId']===0x64){_0x2c9025[_0x5177('0x6a')]=_0x10b062;}return _0x2c9025;});});}else{return;}})[_0x5177('0x49')](function(_0x46d726){if(_0x46d726)_0x4fce32=_0x46d726;if(_[_0x5177('0x68')](_0x3d845e,0x3eb)){var _0x4ea67b=_[_0x5177('0x4d')](_0x4fce32,{'sectionId':0x3eb});return getCustomDashboards(_0x4ea67b)[_0x5177('0x49')](function(_0x52f8ca){return _[_0x5177('0x37')](_0x4fce32,function(_0x30c2dc){if(_0x4ea67b['enabled']){if(_0x30c2dc[_0x5177('0x5f')]===0x3eb){_0x30c2dc['subsections']=_0x52f8ca;}}else{if(_0x30c2dc[_0x5177('0x5f')]===0x64){_0x30c2dc['subsections']=_0x52f8ca;}}return _0x30c2dc;});});}else{return;}})['then'](function(_0x5cd8a1){if(_0x5cd8a1)_0x4fce32=_0x5cd8a1;if(_[_0x5177('0x68')](_0x3d845e,0x709)){var _0x348da7=_[_0x5177('0x4d')](_0x4fce32,{'sectionId':0x709});return getPlugins(_0x348da7)['then'](function(_0x34f74c){if(_0x348da7[_0x5177('0x6b')]){return _[_0x5177('0x37')](_0x4fce32,function(_0x3b68b2){if(_0x3b68b2[_0x5177('0x5f')]===0x709){_0x3b68b2['subsections']=_0x34f74c;}return _0x3b68b2;});}else{var _0x346d91={'sectionId':0x76c,'enabled':0x1,'subsections':_0x34f74c};var _0x1dccb4=_['map'](_0x4fce32);_0x1dccb4[_0x5177('0x6c')](_0x346d91);return _0x1dccb4;}});}else{return;}})['then'](function(_0x5b8953){if(_0x5b8953)_0x4fce32=_0x5b8953;return _['filter'](_0x4fce32,[_0x5177('0x6b'),0x1]);})[_0x5177('0x49')](respondWithResult(_0x41a7fa,null))[_0x5177('0x4e')](handleError(_0x41a7fa,null));};function hasDefaultDashboard(_0x11cce2){var _0x3447b9=[0x65];return new BPromise(function(_0x2d4619,_0x4ba911){try{if(_0x11cce2['autoAssociation']){_0x2d4619(_0x3447b9);}else{return db[_0x5177('0x5e')][_0x5177('0x6d')]({'where':{'sectionId':_0x11cce2['id']},'raw':!![]})[_0x5177('0x49')](function(_0x550197){_0x550197?_0x2d4619(_0x3447b9):_0x2d4619();});}}catch(_0x405b03){_0x4ba911(_0x405b03);}});}function getCustomDashboards(_0x2f2939){var _0x4ee41d=[];return new BPromise(function(_0x43e2ee,_0x568174){try{if(_0x2f2939[_0x5177('0x5d')]){return db[_0x5177('0x6e')][_0x5177('0x5b')]({'raw':!![]})['then'](function(_0x33b82b){_0x33b82b['forEach'](function(_0x11dbd1){_0x4ee41d[_0x5177('0x6c')](_0x11dbd1['id']+0x1869f);});_0x43e2ee(_0x4ee41d);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x2f2939['id']},'raw':!![]})['then'](function(_0x249b0f){_0x249b0f['forEach'](function(_0x34b17e){_0x4ee41d[_0x5177('0x6c')](_0x34b17e[_0x5177('0x6f')]+0x1869f);});_0x43e2ee(_0x4ee41d);});}}catch(_0x57adf4){_0x568174(_0x57adf4);}});}function getPlugins(_0x5e4963){var _0x5e870f=[];return new BPromise(function(_0x10ad1c,_0x3a9b08){try{if(_0x5e4963[_0x5177('0x5d')]){return db['Plugin'][_0x5177('0x5b')]({'raw':!![]})[_0x5177('0x49')](function(_0x5225a4){_0x5225a4[_0x5177('0x70')](function(_0x526459){_0x5e870f[_0x5177('0x6c')](_0x526459['id']+0x15b38);});_0x10ad1c(_0x5e870f);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x5e4963['id']},'raw':!![]})['then'](function(_0x3940dd){_0x3940dd['forEach'](function(_0x16426e){_0x5e870f[_0x5177('0x6c')](_0x16426e[_0x5177('0x6f')]+0x15b38);});_0x10ad1c(_0x5e870f);});}}catch(_0x1372ad){_0x3a9b08(_0x1372ad);}});}exports[_0x5177('0x71')]=function(_0x197377,_0x580d34){return db[_0x5177('0x34')][_0x5177('0x4d')]({'where':{'id':_0x197377['params']['id']}})[_0x5177('0x49')](handleEntityNotFound(_0x580d34,null))[_0x5177('0x49')](function(_0x1e64fa){if(_0x1e64fa){return db['sequelize']['transaction'](function(_0x5de7f4){return db[_0x5177('0x5a')][_0x5177('0x5b')]({'where':{'userProfileId':_0x197377[_0x5177('0x4b')]['id']},'attributes':['id'],'raw':!![]})[_0x5177('0x49')](function(_0x10dc41){if(_0x10dc41){return db[_0x5177('0x5a')][_0x5177('0x30')]({'where':{'userProfileId':_0x197377[_0x5177('0x4b')]['id'],'id':_[_0x5177('0x37')](_0x10dc41,function(_0x107705){return _0x107705['id'];})},'transaction':_0x5de7f4});}})[_0x5177('0x49')](function(_0x39f1db){var _0x59930d=_[_0x5177('0x37')](_0x197377['body'],function(_0x2f254e){_0x2f254e[_0x5177('0x64')]=_0x197377[_0x5177('0x4b')]['id'];return _0x2f254e;});return db['UserProfileSection'][_0x5177('0x72')](_0x59930d,{'raw':!![],'transaction':_0x5de7f4});})[_0x5177('0x49')](function(_0x3867c9){var _0x221a4e=_[_0x5177('0x46')](_[_0x5177('0x37')](_0x3867c9,function(_0x2c9c12){return _0x2c9c12[_0x5177('0x53')]({'plain':!![]});}),{'includeAll':![]});if(_0x221a4e){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x197377[_0x5177('0x4b')]['id'],'sectionId':_['map'](_0x221a4e,function(_0x2e8e26){return _0x2e8e26[_0x5177('0x5f')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x5177('0x49')](function(_0x1fb680){var _0x54efd0=_[_0x5177('0x37')](_0x197377[_0x5177('0x56')],function(_0x2458a9){_0x2458a9[_0x5177('0x64')]=_0x197377[_0x5177('0x4b')]['id'];return _0x2458a9;});return db[_0x5177('0x5e')][_0x5177('0x72')](_0x54efd0,{'raw':!![],'transaction':_0x5de7f4});});}})[_0x5177('0x4e')](handleError(_0x580d34,null));});}})[_0x5177('0x49')](function(_0x8c0153){var _0x3cd09d=_[_0x5177('0x37')](_0x8c0153,function(_0xf2635c){return _0xf2635c['get']({'plain':!![]});});})[_0x5177('0x49')](respondWithResult(_0x580d34,null))[_0x5177('0x4e')](handleError(_0x580d34,null));};exports[_0x5177('0x73')]=function(_0x4e5ee8,_0x363010,_0xa08446){return db['UserProfile'][_0x5177('0x4d')]({'where':{'id':_0x4e5ee8['params']['id']}})['then'](handleEntityNotFound(_0x363010,null))[_0x5177('0x49')](function(_0x1eaea0){if(_0x1eaea0){return _0x1eaea0[_0x5177('0x73')](_0x4e5ee8[_0x5177('0x38')][_0x5177('0x66')]);}})[_0x5177('0x49')](respondWithStatusCode(_0x363010,null))['catch'](handleError(_0x363010,null));};exports[_0x5177('0x74')]=function(_0xcb831c,_0x48c814){var _0x1aa8ca={};if(!_0xcb831c[_0x5177('0x38')][_0x5177('0x75')])throw new Error(_0x5177('0x76'));if(!_0xcb831c[_0x5177('0x38')][_0x5177('0x40')](_0x5177('0x41'))){_0x1aa8ca[_0x5177('0x28')]=qs['limit'](_0xcb831c[_0x5177('0x38')]['limit']);_0x1aa8ca[_0x5177('0x26')]=qs['offset'](_0xcb831c[_0x5177('0x38')][_0x5177('0x26')]);}return db[_0x5177('0x34')][_0x5177('0x4d')]({'where':{'id':_0xcb831c['params']['id']}})[_0x5177('0x49')](function(_0x1b7c52){if(!_0x1b7c52)throw new Error(_0x5177('0x77')+_0xcb831c[_0x5177('0x4b')]['id']);return db['UserProfile']['getResources'](_0xcb831c);})['then'](respondWithFilteredResult(_0x48c814,_0x1aa8ca))['catch'](handleError(_0x48c814,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 3193fc2..7a29f2c 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 _0xed1c=['events','../../mysqldb','remove','emit','hasOwnProperty','exports'];(function(_0x1beb36,_0xc46e97){var _0x5a1cc0=function(_0x4741ab){while(--_0x4741ab){_0x1beb36['push'](_0x1beb36['shift']());}};_0x5a1cc0(++_0xc46e97);}(_0xed1c,0xe4));var _0xced1=function(_0xd0027b,_0x1d2f91){_0xd0027b=_0xd0027b-0x0;var _0x4c50f7=_0xed1c[_0xd0027b];return _0x4c50f7;};'use strict';var EventEmitter=require(_0xced1('0x0'));var UserProfile=require(_0xced1('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xced1('0x2')};function emitEvent(_0x329a0a){return function(_0x79202e,_0x47a45c,_0x1e23a9){UserProfileEvents[_0xced1('0x3')](_0x329a0a+':'+_0x79202e['id'],_0x79202e);UserProfileEvents[_0xced1('0x3')](_0x329a0a,_0x79202e);_0x1e23a9(null);};}for(var e in events){if(events[_0xced1('0x4')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xced1('0x5')]=UserProfileEvents; \ No newline at end of file +var _0x33af=['hook','exports','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x374f9c,_0x43fef3){var _0x317f18=function(_0x42b4c5){while(--_0x42b4c5){_0x374f9c['push'](_0x374f9c['shift']());}};_0x317f18(++_0x43fef3);}(_0x33af,0xec));var _0xf33a=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x33af[_0x1ac595];return _0x455fff;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xf33a('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xf33a('0x1')](0x0);var events={'afterCreate':_0xf33a('0x2'),'afterUpdate':_0xf33a('0x3'),'afterDestroy':_0xf33a('0x4')};function emitEvent(_0x169f02){return function(_0x25f156,_0x4c734e,_0x433e25){UserProfileEvents[_0xf33a('0x5')](_0x169f02+':'+_0x25f156['id'],_0x25f156);UserProfileEvents['emit'](_0x169f02,_0x25f156);_0x433e25(null);};}for(var e in events){if(events[_0xf33a('0x6')](e)){var event=events[e];UserProfile[_0xf33a('0x7')](e,emitEvent(event));}}module[_0xf33a('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 e0d7418..8c8939f 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 _0x9536=['options','includeAll','include','reportType','custom','count','rows','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','fax','openchannel','lodash','./userProfile.attributes','../../components/parsers/qs','squel','models','filter','field','findAll','then','map','catch','value','model','associatedResources','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','childModel','SquareProject','squarerecordings','SquareRecording','parentSections','SquareProjects','projects','contacts','CmContact','Lists','lists','CmList','CmCompany','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','FaxAccount','inboundroutes','internalroutes','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','role','agent','Telephones','User','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','whatsappqueues','whatsappaccounts','WhatsappAccount','teams','Team','queuecampaigns','users','agents','telephones','Users','user','zendeskaccounts','salesforceaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','pauses','Pause','Schedule','sounds','Tag','Template','triggers','Trigger','trunks','Trunk','variables','Variable','Plugin','extractedreports','Reports','reportId','AnalyticMetric','charAt','toUpperCase','Sequelize','SELECT','select','ui.','InteractionId','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','toString','OpenTabs','define','UserProfile','user_profiles','query','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','rawAttributes','keys','filters','attributes','intersection','fields','nolimit','limit','offset','order','pick','key','VIRTUAL','foreignKey','forEach','merge'];(function(_0x5f2d8a,_0x18c2f9){var _0x479a9f=function(_0x3ce34d){while(--_0x3ce34d){_0x5f2d8a['push'](_0x5f2d8a['shift']());}};_0x479a9f(++_0x18c2f9);}(_0x9536,0x179));var _0x6953=function(_0x148c09,_0x4fd39f){_0x148c09=_0x148c09-0x0;var _0x18e613=_0x9536[_0x148c09];return _0x18e613;};'use strict';var _=require(_0x6953('0x0'));var attributes=require(_0x6953('0x1'));var qs=require(_0x6953('0x2'));var squel=require(_0x6953('0x3'));module['exports']=function(_0xc3e4dd){var _0x53b172=_0xc3e4dd[_0x6953('0x4')];function _0x3c32c7(_0x1dee7c,_0x3ba964){return new Promise(function(_0x2f3cc3,_0x494ac2){if(!_0x3ba964)return _0x2f3cc3(null);var _0x2b273e=_0x3ba964[_0x6953('0x5')]?{[_0x3ba964[_0x6953('0x5')][_0x6953('0x6')]]:_0x3ba964[_0x6953('0x5')]['value']}:undefined;return _0x53b172[_0x1dee7c][_0x6953('0x7')]({'where':_0x2b273e,'raw':!![]})[_0x6953('0x8')](function(_0x449acb){_0x3ba964['associatedResources']=_[_0x6953('0x9')](_0x449acb,'id');_0x2f3cc3(_0x3ba964);})[_0x6953('0xa')](function(_0x300c48){_0x494ac2(_0x300c48);});});}function _0xb13f2c(_0x448c89,_0x1f3062){return new Promise(function(_0x246534,_0x2144c5){var _0xdd0b40=_0x448c89['filter']?{[_0x448c89[_0x6953('0x5')]['field']]:_0x448c89[_0x6953('0x5')][_0x6953('0xb')]}:undefined;return _0x53b172[_0x448c89[_0x6953('0xc')]][_0x6953('0x7')]({'where':_0xdd0b40,'raw':!![]})[_0x6953('0x8')](function(_0x244713){_0x1f3062[_0x6953('0xd')]=_[_0x6953('0x9')](_0x244713,function(_0x28433e){return _0x28433e[_0x6953('0xe')];});_0x246534(_0x1f3062);})[_0x6953('0xa')](function(_0x548473){_0x2144c5(_0x548473);});});}function _0x5f49db(_0x399b9b,_0x44e8a2,_0x16b79b){if(!_0x44e8a2)return Promise[_0x6953('0xf')](null);return new Promise(function(_0x510d46,_0x1b6dcb){return _0x53b172[_0x6953('0x10')]['findAll']({'where':{'sectionId':_0x44e8a2['id']},'raw':!![]})[_0x6953('0x8')](function(_0x3207dd){if(_0x399b9b[_0x6953('0x6')]&&_0x399b9b[_0x6953('0x6')]!=='id'){_0x44e8a2[_0x6953('0xd')]=_['map'](_0x3207dd,function(_0x3a93e1){return _0x3a93e1[_0x399b9b[_0x6953('0x6')]];});}else{if(_0x16b79b===_0x6953('0x11')){_0x44e8a2[_0x6953('0xd')]=_[_0x6953('0x9')](_0x3207dd,function(_0x5e33ec){return{'id':_0x5e33ec[_0x6953('0x12')],'type':_0x5e33ec[_0x6953('0x13')]};});}else{_0x44e8a2['associatedResources']=_[_0x6953('0x9')](_0x3207dd,function(_0x40c9d1){return _0x40c9d1[_0x6953('0x12')];});}}_0x510d46(_0x44e8a2);})[_0x6953('0xa')](function(_0x53640a){_0x1b6dcb(_0x53640a);});});}function _0x37f339(_0x231cb2,_0x2a7f6a){var _0x508ea7={'parentSections':[]};switch(_0x231cb2['toLowerCase']()){case'squareprojects':_0x508ea7[_0x6953('0x14')]=_0x6953('0x15');break;case'odbc':_0x508ea7[_0x6953('0x14')]='SquareOdbc';break;case _0x6953('0x16'):_0x508ea7[_0x6953('0x14')]=_0x6953('0x17');_0x508ea7[_0x6953('0x18')]=[{'name':_0x6953('0x19'),'field':_0x6953('0xe'),'foreignKey':'projectName'}];break;case _0x6953('0x1a'):_0x508ea7[_0x6953('0x14')]='JscriptyProject';break;case _0x6953('0x1b'):_0x508ea7['childModel']=_0x6953('0x1c');_0x508ea7[_0x6953('0x18')]=[{'name':_0x6953('0x1d'),'field':'id','foreignKey':'ListId'}];break;case _0x6953('0x1e'):_0x508ea7[_0x6953('0x14')]=_0x6953('0x1f');break;case'companies':_0x508ea7[_0x6953('0x14')]=_0x6953('0x20');break;case'globalcustomfields':_0x508ea7['childModel']=_0x6953('0x21');break;case _0x6953('0x22'):_0x508ea7[_0x6953('0x14')]=_0x6953('0x23');break;case _0x6953('0x24'):_0x508ea7['childModel']=_0x6953('0x25');break;case'faxqueues':_0x508ea7[_0x6953('0x14')]=_0x6953('0x26');break;case'faxaccounts':_0x508ea7['childModel']=_0x6953('0x27');break;case _0x6953('0x28'):case _0x6953('0x29'):case'outboundroutes':_0x508ea7[_0x6953('0x14')]='VoiceExtension';break;case'contexts':_0x508ea7['childModel']='VoiceContext';break;case _0x6953('0x2a'):_0x508ea7[_0x6953('0x14')]=_0x6953('0x2b');break;case _0x6953('0x2c'):_0x508ea7[_0x6953('0x14')]=_0x6953('0x2d');_0x508ea7['parentSections']=[{'name':_0x6953('0x2e'),'field':'name','foreignKey':_0x6953('0x2f'),'model':'User','filter':{'field':_0x6953('0x30'),'value':[_0x6953('0x31')]}},{'name':_0x6953('0x32'),'field':_0x6953('0xe'),'foreignKey':'membername','model':_0x6953('0x33'),'filter':{'field':_0x6953('0x30'),'value':[_0x6953('0x34')]}},{'name':_0x6953('0x35'),'field':_0x6953('0xe'),'foreignKey':_0x6953('0x36'),'model':_0x6953('0x37'),'filter':{'field':_0x6953('0x13'),'value':[_0x6953('0x38')]}},{'name':_0x6953('0x39'),'field':_0x6953('0xe'),'foreignKey':'queue','model':_0x6953('0x37'),'filter':{'field':_0x6953('0x13'),'value':[_0x6953('0x3a')]}}];break;case'musiconholds':_0x508ea7['childModel']=_0x6953('0x3b');break;case'chanspies':_0x508ea7['childModel']=_0x6953('0x3c');break;case _0x6953('0x3d'):_0x508ea7['childModel']=_0x6953('0x3e');break;case _0x6953('0x3f'):_0x508ea7[_0x6953('0x14')]=_0x6953('0x40');break;case _0x6953('0x41'):_0x508ea7[_0x6953('0x14')]='MailQueue';break;case _0x6953('0x42'):_0x508ea7[_0x6953('0x14')]=_0x6953('0x43');break;case _0x6953('0x44'):_0x508ea7[_0x6953('0x14')]=_0x6953('0x45');break;case'openchannelqueues':_0x508ea7['childModel']=_0x6953('0x46');break;case'openchannelaccounts':_0x508ea7['childModel']=_0x6953('0x47');break;case _0x6953('0x48'):_0x508ea7[_0x6953('0x14')]=_0x6953('0x49');break;case _0x6953('0x4a'):_0x508ea7['childModel']='SmsAccount';break;case _0x6953('0x4b'):_0x508ea7[_0x6953('0x14')]='WhatsappQueue';break;case _0x6953('0x4c'):_0x508ea7['childModel']=_0x6953('0x4d');break;case _0x6953('0x4e'):_0x508ea7[_0x6953('0x14')]=_0x6953('0x4f');break;case'voicequeues':case _0x6953('0x50'):_0x508ea7[_0x6953('0x14')]='VoiceQueue';if(_0x2a7f6a){_0x508ea7[_0x6953('0x18')]=[{'name':_0x6953('0x35')},{'name':_0x6953('0x39')}];}break;case _0x6953('0x51'):case _0x6953('0x52'):case _0x6953('0x53'):_0x508ea7[_0x6953('0x14')]=_0x6953('0x33');if(_0x2a7f6a){_0x508ea7[_0x6953('0x18')]=[{'name':_0x6953('0x54'),'filter':{'field':_0x6953('0x30'),'value':['admin',_0x6953('0x55')]},'ignore':!![]},{'name':'Agents'},{'name':_0x6953('0x32')}];}break;case _0x6953('0x56'):_0x508ea7[_0x6953('0x14')]='ZendeskAccount';break;case _0x6953('0x57'):_0x508ea7[_0x6953('0x14')]='SalesforceAccount';break;case'freshdeskaccounts':_0x508ea7[_0x6953('0x14')]=_0x6953('0x58');break;case _0x6953('0x59'):_0x508ea7[_0x6953('0x14')]=_0x6953('0x5a');break;case _0x6953('0x5b'):_0x508ea7[_0x6953('0x14')]=_0x6953('0x5c');break;case _0x6953('0x5d'):_0x508ea7[_0x6953('0x14')]=_0x6953('0x5e');break;case'vtigeraccounts':_0x508ea7['childModel']=_0x6953('0x33');break;case _0x6953('0x5f'):_0x508ea7[_0x6953('0x14')]=_0x6953('0x60');break;case _0x6953('0x61'):_0x508ea7[_0x6953('0x14')]=_0x6953('0x62');break;case _0x6953('0x63'):_0x508ea7[_0x6953('0x14')]='Dashboard';break;case'intervals':_0x508ea7['childModel']='Interval';break;case _0x6953('0x64'):_0x508ea7[_0x6953('0x14')]=_0x6953('0x65');break;case'scheduler':_0x508ea7['childModel']=_0x6953('0x66');break;case _0x6953('0x67'):_0x508ea7[_0x6953('0x14')]='Sound';break;case'tags':_0x508ea7[_0x6953('0x14')]=_0x6953('0x68');break;case'templates':_0x508ea7['childModel']=_0x6953('0x69');break;case _0x6953('0x6a'):_0x508ea7[_0x6953('0x14')]=_0x6953('0x6b');break;case _0x6953('0x6c'):_0x508ea7['childModel']=_0x6953('0x6d');break;case _0x6953('0x6e'):_0x508ea7['childModel']=_0x6953('0x6f');break;case'plugins':_0x508ea7[_0x6953('0x14')]=_0x6953('0x70');break;case _0x6953('0x71'):_0x508ea7[_0x6953('0x14')]='AnalyticExtractedReport';_0x508ea7[_0x6953('0x18')]=[{'name':_0x6953('0x72'),'field':'id','foreignKey':_0x6953('0x73')}];break;case'metrics':_0x508ea7['childModel']=_0x6953('0x74');break;}return _0x508ea7;}function _0x224ce6(_0x2d0abd,_0x482f3b){var _0x4c6180=_0x2d0abd[_0x6953('0x75')](0x0)[_0x6953('0x76')]()+_0x2d0abd['slice'](0x1);var _0x4f3df2={'type':_0x53b172[_0x6953('0x77')]['QueryTypes'][_0x6953('0x78')],'raw':!![]};return new Promise(function(_0x1e824a,_0x109b5e){var _0x4443e2=squel[_0x6953('0x79')]()['field'](_0x6953('0x7a')+_0x4c6180+_0x6953('0x7b'),'id')[_0x6953('0x6')]('ui.createdAt')['from'](_0x6953('0x7c')+_0x2d0abd+_0x6953('0x7d'),'ui')[_0x6953('0x7e')](_0x6953('0x7f'),_0x482f3b['id']);return _0x53b172[_0x6953('0x80')]['query'](_0x4443e2[_0x6953('0x81')](),_0x4f3df2)[_0x6953('0x8')](function(_0xe93bf2){_0x482f3b[_0x4c6180+_0x6953('0x82')]=_0xe93bf2;_0x1e824a(_0xe93bf2);})[_0x6953('0xa')](function(_0x1d3520){_0x109b5e(_0x1d3520);});});}return _0xc3e4dd[_0x6953('0x83')](_0x6953('0x84'),attributes,{'tableName':_0x6953('0x85'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0xcbbba5){var _0xb26c63={'raw':![],'where':{}};var _0x390ba0={};var _0x25ac55={'count':0x0,'rows':[]};var _0x583e1f=_0xcbbba5[_0x6953('0x86')][_0x6953('0x87')];var _0x3f5ab9=_0xcbbba5[_0x6953('0x86')][_0x6953('0x88')]||![];var _0x523a4a=_0x37f339(_0x583e1f,_0x3f5ab9);if(!_0x523a4a['childModel'])throw new Error(_0x6953('0x89')+_0x583e1f+'\x27');var _0x54822e=[{'name':_0x583e1f}];if(!_[_0x6953('0x8a')](_0x523a4a[_0x6953('0x18')]))_0x54822e=_0x523a4a[_0x6953('0x18')];var _0x235739=[];for(var _0x4c8e6c=0x0;_0x4c8e6c<_0x54822e[_0x6953('0x8b')];_0x4c8e6c++){_0x235739[_0x6953('0x8c')](_0x53b172[_0x6953('0x8d')][_0x6953('0x8e')]({'where':{'userProfileId':_0xcbbba5[_0x6953('0x8f')]['id'],'name':_0x54822e[_0x4c8e6c][_0x6953('0xe')]},'raw':!![]}));}return Promise[_0x6953('0x90')](_0x235739)[_0x6953('0x8')](function(_0x3582b6){var _0x155c63=_[_0x6953('0x5')](_0x3582b6,function(_0xce3eef){return _0xce3eef?_0xce3eef:undefined;});var _0x2e97ac=_[_0x6953('0x5')](_0x54822e,[_0x6953('0x91'),!![]]);var _0x5c5942=_[_0x6953('0x8a')](_0x155c63)&&_[_0x6953('0x8a')](_0x2e97ac)?null:_[_0x6953('0x92')](_0x2e97ac,_0x155c63);if(!_0x5c5942)return null;var _0x2d4b48=[];for(var _0x3f0c9e=0x0;_0x3f0c9e<_0x5c5942[_0x6953('0x8b')];_0x3f0c9e++){var _0x3e19f1=_['find'](_0x54822e,function(_0x3bb873){return _0x5c5942[_0x3f0c9e]?_0x3bb873[_0x6953('0xe')]===_0x5c5942[_0x3f0c9e]['name']:null;});if(_0x3e19f1){if(_0x5c5942[_0x3f0c9e][_0x6953('0x91')]){_0x2d4b48[_0x6953('0x8c')](_0x3c32c7(_0x523a4a[_0x6953('0x14')],_0x5c5942[_0x3f0c9e]));}else{if(!_0x5c5942[_0x3f0c9e]['autoAssociation']){_0x2d4b48['push'](_0x5f49db(_0x3e19f1,_0x5c5942[_0x3f0c9e],_0x523a4a[_0x6953('0x14')]));}else{if(_0x3e19f1[_0x6953('0xc')]){_0x2d4b48[_0x6953('0x8c')](_0xb13f2c(_0x3e19f1,_0x5c5942[_0x3f0c9e]));}}}}}return Promise[_0x6953('0x90')](_0x2d4b48);})[_0x6953('0x8')](function(_0x43a39f){var _0x3cf1c0=_0x43a39f;var _0x1515a9=null;if(_0x3cf1c0){_0x1515a9=_0x3cf1c0[_0x6953('0x8b')]===0x1?_0x3cf1c0[0x0]:null;}if(!_0x1515a9&&!_0x3cf1c0)return _0x25ac55;var _0x51bf39=_0x53b172[_0x523a4a[_0x6953('0x14')]][_0x6953('0x93')];_0x390ba0[_0x6953('0xc')]=_[_0x6953('0x94')](_0x51bf39);_0x390ba0['query']=_[_0x6953('0x94')](_0xcbbba5[_0x6953('0x86')]);_0x390ba0[_0x6953('0x95')]=_['intersection'](_0x390ba0[_0x6953('0xc')],_0x390ba0[_0x6953('0x86')]);_0xb26c63[_0x6953('0x96')]=_[_0x6953('0x97')](_0x390ba0['model'],qs[_0x6953('0x98')](_0xcbbba5[_0x6953('0x86')][_0x6953('0x98')]));_0xb26c63[_0x6953('0x96')]=_0xb26c63['attributes']['length']?_0xb26c63[_0x6953('0x96')]:_0x390ba0[_0x6953('0xc')];if(!_0xcbbba5['query']['hasOwnProperty'](_0x6953('0x99'))){_0xb26c63[_0x6953('0x9a')]=qs[_0x6953('0x9a')](_0xcbbba5[_0x6953('0x86')]['limit']);_0xb26c63[_0x6953('0x9b')]=qs[_0x6953('0x9b')](_0xcbbba5['query'][_0x6953('0x9b')]);}_0xb26c63[_0x6953('0x9c')]=qs['sort'](_0xcbbba5['query']['sort']);_0xb26c63[_0x6953('0x7e')]=qs[_0x6953('0x95')](_[_0x6953('0x9d')](_0xcbbba5[_0x6953('0x86')],_0x390ba0[_0x6953('0x95')]));if(_0xcbbba5[_0x6953('0x86')][_0x6953('0x5')]){_0xb26c63[_0x6953('0x7e')]=_['merge'](_0xb26c63[_0x6953('0x7e')],{'$or':_[_0x6953('0x9')](_0x51bf39,function(_0x131ea7){if(_0x131ea7[_0x6953('0x13')][_0x6953('0x9e')]!==_0x6953('0x9f')){var _0x481102={};_0x481102[_0x131ea7[_0x6953('0x6')]]={'$like':'%'+_0xcbbba5['query'][_0x6953('0x5')]+'%'};return _0x481102;}})});}var _0x52e762=[];var _0x1691dc=null;var _0x9de87a={};if(_0x1515a9){_0x1691dc=_[_0x6953('0x8e')](_0x54822e,['name',_0x1515a9[_0x6953('0xe')]]);if(_0x1691dc[_0x6953('0x6')]){_0x9de87a={};if(_0x523a4a[_0x6953('0x14')]===_0x6953('0x11')){_0x9de87a[_0x1691dc[_0x6953('0xa0')]]=_[_0x6953('0x9')](_0x1515a9['associatedResources'],'id');}else{_0x9de87a[_0x1691dc[_0x6953('0xa0')]]=_0x1515a9[_0x6953('0xd')];}_0x52e762[_0x6953('0x8c')](_0x9de87a);}else{_0xb26c63[_0x6953('0x7e')]['id']=_0x1515a9[_0x6953('0xd')];}}else{for(var _0x32c681=0x0;_0x32c681<_0x3cf1c0[_0x6953('0x8b')];_0x32c681++){_0x1691dc=_[_0x6953('0x8e')](_0x54822e,[_0x6953('0xe'),_0x3cf1c0[_0x32c681][_0x6953('0xe')]]);if(_0x1691dc[_0x6953('0x6')]){_0x9de87a={};_0x9de87a[_0x1691dc['foreignKey']]=_0x3cf1c0[_0x32c681][_0x6953('0xd')];_0x52e762[_0x6953('0x8c')](_0x9de87a);}else{if(!_0xb26c63[_0x6953('0x7e')]['id'])_0xb26c63[_0x6953('0x7e')]['id']=[];_0x3cf1c0[_0x32c681][_0x6953('0xd')][_0x6953('0xa1')](function(_0x16f3db){_0xb26c63[_0x6953('0x7e')]['id'][_0x6953('0x8c')](_0x16f3db);});}}}if(!_[_0x6953('0x8a')](_0x52e762)){_0xb26c63[_0x6953('0x7e')]=_['merge'](_0xb26c63[_0x6953('0x7e')],{'$and':{'$or':_0x52e762}});}_0xb26c63=_[_0x6953('0xa2')]({},_0xb26c63,_0xcbbba5[_0x6953('0xa3')]);if(_0x1515a9&&!_0x1515a9['autoAssociation']&&_0x523a4a[_0x6953('0x14')]==='AnalyticExtractedReport'){if(_0xcbbba5['query'][_0x6953('0xa4')]){_0xb26c63[_0x6953('0xa5')]=[{'all':!![]}];}return _0x53b172[_0x523a4a[_0x6953('0x14')]][_0x6953('0x7')](_0xb26c63)[_0x6953('0x8')](function(_0x2928c3){var _0x228544=[];_0x2928c3['forEach'](function(_0x150720){var _0x3113c0;switch(_0x150720[_0x6953('0xa6')]){case'default':_0x3113c0=_[_0x6953('0x8e')](_0x1515a9[_0x6953('0xd')],function(_0x4e48ef){return _0x4e48ef['id']===_0x150720[_0x6953('0x73')]&&_0x4e48ef['type']==='DefaultReports';});break;case _0x6953('0xa7'):_0x3113c0=_['find'](_0x1515a9['associatedResources'],function(_0x3c3dd4){return _0x3c3dd4['id']===_0x150720[_0x6953('0x73')]&&_0x3c3dd4[_0x6953('0x13')]==='CustomReports';});break;}if(_0x3113c0)_0x228544[_0x6953('0x8c')](_0x150720);});_0x25ac55[_0x6953('0xa8')]=_0x228544['length'];_0x25ac55[_0x6953('0xa9')]=_0x228544;return _0x25ac55;});}else{return _0x53b172[_0x523a4a[_0x6953('0x14')]][_0x6953('0xa8')]({'where':_0xb26c63[_0x6953('0x7e')]})[_0x6953('0x8')](function(_0x31d847){_0x25ac55[_0x6953('0xa8')]=_0x31d847;if(_0xcbbba5[_0x6953('0x86')][_0x6953('0xa4')]){if(_0x523a4a['childModel']===_0x6953('0x1c')){_0xb26c63[_0x6953('0xa5')]=[{'model':_0x53b172['Tag'],'as':_0x6953('0xaa'),'attributes':['id',_0x6953('0xe'),_0x6953('0xab')],'required':_0xcbbba5[_0x6953('0x86')][_0x6953('0xac')]?!![]:![]},{'model':_0x53b172[_0x6953('0x68')],'as':_0x6953('0xad'),'attributes':['id','name',_0x6953('0xab')],'through':_0xcbbba5[_0x6953('0x86')][_0x6953('0xac')]?{'attributes':[],'where':{'TagId':_0xcbbba5[_0x6953('0x86')][_0x6953('0xac')]||undefined}}:{},'required':_0xcbbba5[_0x6953('0x86')][_0x6953('0xac')]?!![]:![]}];}else{_0xb26c63[_0x6953('0xa5')]=[{'all':!![]}];}}return _0x53b172[_0x523a4a[_0x6953('0x14')]]['findAll'](_0xb26c63);})[_0x6953('0x8')](function(_0x5661d2){_0x25ac55[_0x6953('0xa9')]=_0x5661d2;if(_0x583e1f==='Agents'&&_0xcbbba5[_0x6953('0x86')][_0x6953('0xae')]===_0x6953('0xaf')){var _0x46bcec=[];for(var _0x2dae06=0x0;_0x2dae06<_0x25ac55['rows'][_0x6953('0x8b')];_0x2dae06++){_0x46bcec['push'](_0x224ce6(_0x6953('0xb0'),_0x25ac55[_0x6953('0xa9')][_0x2dae06][_0x6953('0xb1')]));_0x46bcec[_0x6953('0x8c')](_0x224ce6('sms',_0x25ac55[_0x6953('0xa9')][_0x2dae06][_0x6953('0xb1')]));_0x46bcec[_0x6953('0x8c')](_0x224ce6(_0x6953('0xb2'),_0x25ac55[_0x6953('0xa9')][_0x2dae06][_0x6953('0xb1')]));_0x46bcec[_0x6953('0x8c')](_0x224ce6('mail',_0x25ac55[_0x6953('0xa9')][_0x2dae06][_0x6953('0xb1')]));_0x46bcec[_0x6953('0x8c')](_0x224ce6(_0x6953('0xb3'),_0x25ac55[_0x6953('0xa9')][_0x2dae06]['dataValues']));_0x46bcec['push'](_0x224ce6('whatsapp',_0x25ac55[_0x6953('0xa9')][_0x2dae06][_0x6953('0xb1')]));}return Promise[_0x6953('0x90')](_0x46bcec)['then'](function(){return _0x25ac55;});}return _0x25ac55;});}});}}});}; \ No newline at end of file +var _0x5430=['Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','user_profiles','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','autoAssociation','rawAttributes','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','foreignKey','forEach','options','includeAll','reportType','default','reportId','custom','CustomReports','rows','count','include','Tags','color','tag','ThroughTags','openTabs','true','sms','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','filter','value','findAll','then','associatedResources','catch','field','model','name','resolve','UserProfileResource','map','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','faxqueues','FaxQueue','faxaccounts','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','agent','Telephones','role','telephone','queue','VoiceQueue','inbound','QueueCampaigns','type','outbound','musiconholds','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','whatsappaccounts','Team','queuecampaigns','users','telephones','Users','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','Variable','Plugin','extractedreports','AnalyticExtractedReport','Reports','metrics','AnalyticMetric','charAt','toUpperCase','slice'];(function(_0x1d17ae,_0x55682e){var _0x4dcf07=function(_0x33fc1e){while(--_0x33fc1e){_0x1d17ae['push'](_0x1d17ae['shift']());}};_0x4dcf07(++_0x55682e);}(_0x5430,0x10c));var _0x0543=function(_0x4879f3,_0x54a581){_0x4879f3=_0x4879f3-0x0;var _0x331642=_0x5430[_0x4879f3];return _0x331642;};'use strict';var _=require(_0x0543('0x0'));var attributes=require(_0x0543('0x1'));var qs=require(_0x0543('0x2'));var squel=require(_0x0543('0x3'));module[_0x0543('0x4')]=function(_0x3b93d7){var _0x5518f8=_0x3b93d7['models'];function _0x1c5ab7(_0x4ee416,_0x523f3d){return new Promise(function(_0xce0b65,_0x45b909){if(!_0x523f3d)return _0xce0b65(null);var _0x9754ba=_0x523f3d[_0x0543('0x5')]?{[_0x523f3d[_0x0543('0x5')]['field']]:_0x523f3d[_0x0543('0x5')][_0x0543('0x6')]}:undefined;return _0x5518f8[_0x4ee416][_0x0543('0x7')]({'where':_0x9754ba,'raw':!![]})[_0x0543('0x8')](function(_0x2fb723){_0x523f3d[_0x0543('0x9')]=_['map'](_0x2fb723,'id');_0xce0b65(_0x523f3d);})[_0x0543('0xa')](function(_0x1ac048){_0x45b909(_0x1ac048);});});}function _0x52c9b7(_0x46bbc1,_0x20a264){return new Promise(function(_0x2bb810,_0x43b934){var _0x3f74f8=_0x46bbc1[_0x0543('0x5')]?{[_0x46bbc1[_0x0543('0x5')][_0x0543('0xb')]]:_0x46bbc1[_0x0543('0x5')][_0x0543('0x6')]}:undefined;return _0x5518f8[_0x46bbc1[_0x0543('0xc')]][_0x0543('0x7')]({'where':_0x3f74f8,'raw':!![]})['then'](function(_0x4f1f2a){_0x20a264[_0x0543('0x9')]=_['map'](_0x4f1f2a,function(_0x4c4763){return _0x4c4763[_0x0543('0xd')];});_0x2bb810(_0x20a264);})[_0x0543('0xa')](function(_0x1dff7d){_0x43b934(_0x1dff7d);});});}function _0x1cfadf(_0x38a32e,_0x50d504,_0xe69a3d){if(!_0x50d504)return Promise[_0x0543('0xe')](null);return new Promise(function(_0x2dd5cb,_0x25254e){return _0x5518f8[_0x0543('0xf')][_0x0543('0x7')]({'where':{'sectionId':_0x50d504['id']},'raw':!![]})[_0x0543('0x8')](function(_0x5eb03e){if(_0x38a32e[_0x0543('0xb')]&&_0x38a32e['field']!=='id'){_0x50d504['associatedResources']=_[_0x0543('0x10')](_0x5eb03e,function(_0x419913){return _0x419913[_0x38a32e[_0x0543('0xb')]];});}else{if(_0xe69a3d==='AnalyticExtractedReport'){_0x50d504[_0x0543('0x9')]=_['map'](_0x5eb03e,function(_0x401da5){return{'id':_0x401da5[_0x0543('0x11')],'type':_0x401da5['type']};});}else{_0x50d504[_0x0543('0x9')]=_[_0x0543('0x10')](_0x5eb03e,function(_0x427919){return _0x427919[_0x0543('0x11')];});}}_0x2dd5cb(_0x50d504);})[_0x0543('0xa')](function(_0xe14f94){_0x25254e(_0xe14f94);});});}function _0x4adba7(_0x5979d2,_0x59f1b2){var _0xbfe5dc={'parentSections':[]};switch(_0x5979d2[_0x0543('0x12')]()){case _0x0543('0x13'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x15');break;case _0x0543('0x16'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x17');break;case _0x0543('0x18'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x19');_0xbfe5dc[_0x0543('0x1a')]=[{'name':'SquareProjects','field':_0x0543('0xd'),'foreignKey':_0x0543('0x1b')}];break;case _0x0543('0x1c'):_0xbfe5dc['childModel']=_0x0543('0x1d');break;case _0x0543('0x1e'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x1f');_0xbfe5dc['parentSections']=[{'name':_0x0543('0x20'),'field':'id','foreignKey':_0x0543('0x21')}];break;case'lists':_0xbfe5dc['childModel']=_0x0543('0x22');break;case _0x0543('0x23'):_0xbfe5dc['childModel']=_0x0543('0x24');break;case _0x0543('0x25'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x26');break;case _0x0543('0x27'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x28');break;case'chatwebsites':_0xbfe5dc[_0x0543('0x14')]='ChatWebsite';break;case _0x0543('0x29'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x2a');break;case _0x0543('0x2b'):_0xbfe5dc[_0x0543('0x14')]='FaxAccount';break;case _0x0543('0x2c'):case'internalroutes':case _0x0543('0x2d'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x2e');break;case _0x0543('0x2f'):_0xbfe5dc['childModel']=_0x0543('0x30');break;case'voicemails':_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x31');break;case _0x0543('0x32'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x33');_0xbfe5dc[_0x0543('0x1a')]=[{'name':_0x0543('0x34'),'field':_0x0543('0xd'),'foreignKey':_0x0543('0x35'),'model':_0x0543('0x36'),'filter':{'field':'role','value':[_0x0543('0x37')]}},{'name':_0x0543('0x38'),'field':'name','foreignKey':_0x0543('0x35'),'model':'User','filter':{'field':_0x0543('0x39'),'value':[_0x0543('0x3a')]}},{'name':'VoiceQueues','field':'name','foreignKey':_0x0543('0x3b'),'model':_0x0543('0x3c'),'filter':{'field':'type','value':[_0x0543('0x3d')]}},{'name':_0x0543('0x3e'),'field':'name','foreignKey':_0x0543('0x3b'),'model':_0x0543('0x3c'),'filter':{'field':_0x0543('0x3f'),'value':[_0x0543('0x40')]}}];break;case _0x0543('0x41'):_0xbfe5dc['childModel']='VoiceMusicOnHold';break;case'chanspies':_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x42');break;case _0x0543('0x43'):_0xbfe5dc[_0x0543('0x14')]='VoicePrefix';break;case _0x0543('0x44'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x45');break;case _0x0543('0x46'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x47');break;case _0x0543('0x48'):_0xbfe5dc['childModel']=_0x0543('0x49');break;case _0x0543('0x4a'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x4b');break;case _0x0543('0x4c'):_0xbfe5dc[_0x0543('0x14')]='OpenchannelQueue';break;case'openchannelaccounts':_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x4d');break;case _0x0543('0x4e'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x4f');break;case _0x0543('0x50'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x51');break;case _0x0543('0x52'):_0xbfe5dc['childModel']='WhatsappQueue';break;case _0x0543('0x53'):_0xbfe5dc[_0x0543('0x14')]='WhatsappAccount';break;case'teams':_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x54');break;case'voicequeues':case _0x0543('0x55'):_0xbfe5dc['childModel']=_0x0543('0x3c');if(_0x59f1b2){_0xbfe5dc[_0x0543('0x1a')]=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case _0x0543('0x56'):case'agents':case _0x0543('0x57'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x36');if(_0x59f1b2){_0xbfe5dc[_0x0543('0x1a')]=[{'name':_0x0543('0x58'),'filter':{'field':_0x0543('0x39'),'value':['admin',_0x0543('0x59')]},'ignore':!![]},{'name':_0x0543('0x34')},{'name':_0x0543('0x38')}];}break;case _0x0543('0x5a'):_0xbfe5dc[_0x0543('0x14')]='ZendeskAccount';break;case _0x0543('0x5b'):_0xbfe5dc['childModel']=_0x0543('0x5c');break;case _0x0543('0x5d'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x5e');break;case _0x0543('0x5f'):_0xbfe5dc[_0x0543('0x14')]='SugarcrmAccount';break;case'deskaccounts':_0xbfe5dc['childModel']=_0x0543('0x60');break;case _0x0543('0x61'):_0xbfe5dc['childModel']=_0x0543('0x62');break;case _0x0543('0x63'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x36');break;case _0x0543('0x64'):_0xbfe5dc[_0x0543('0x14')]='CannedAnswer';break;case _0x0543('0x65'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x66');break;case _0x0543('0x67'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x68');break;case _0x0543('0x69'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x6a');break;case _0x0543('0x6b'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x6c');break;case _0x0543('0x6d'):_0xbfe5dc[_0x0543('0x14')]='Schedule';break;case _0x0543('0x6e'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x6f');break;case _0x0543('0x70'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x71');break;case _0x0543('0x72'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x73');break;case _0x0543('0x74'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x75');break;case _0x0543('0x76'):_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x77');break;case'variables':_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x78');break;case'plugins':_0xbfe5dc[_0x0543('0x14')]=_0x0543('0x79');break;case _0x0543('0x7a'):_0xbfe5dc['childModel']=_0x0543('0x7b');_0xbfe5dc['parentSections']=[{'name':_0x0543('0x7c'),'field':'id','foreignKey':'reportId'}];break;case _0x0543('0x7d'):_0xbfe5dc['childModel']=_0x0543('0x7e');break;}return _0xbfe5dc;}function _0x2496d3(_0x1e6786,_0x5e6b95){var _0x117466=_0x1e6786[_0x0543('0x7f')](0x0)[_0x0543('0x80')]()+_0x1e6786[_0x0543('0x81')](0x1);var _0x313937={'type':_0x5518f8[_0x0543('0x82')][_0x0543('0x83')][_0x0543('0x84')],'raw':!![]};return new Promise(function(_0x2bf1f9,_0x21ec88){var _0x8a3879=squel[_0x0543('0x85')]()[_0x0543('0xb')](_0x0543('0x86')+_0x117466+_0x0543('0x87'),'id')['field']('ui.createdAt')[_0x0543('0x88')](_0x0543('0x89')+_0x1e6786+_0x0543('0x8a'),'ui')[_0x0543('0x8b')](_0x0543('0x8c'),_0x5e6b95['id']);return _0x5518f8[_0x0543('0x8d')][_0x0543('0x8e')](_0x8a3879[_0x0543('0x8f')](),_0x313937)[_0x0543('0x8')](function(_0x51e4e2){_0x5e6b95[_0x117466+_0x0543('0x90')]=_0x51e4e2;_0x2bf1f9(_0x51e4e2);})[_0x0543('0xa')](function(_0x42f644){_0x21ec88(_0x42f644);});});}return _0x3b93d7[_0x0543('0x91')]('UserProfile',attributes,{'tableName':_0x0543('0x92'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1cbb25){var _0x1bd8d3={'raw':![],'where':{}};var _0x5f08ce={};var _0x5c140c={'count':0x0,'rows':[]};var _0x2f4d15=_0x1cbb25[_0x0543('0x8e')][_0x0543('0x93')];var _0x5311b7=_0x1cbb25[_0x0543('0x8e')][_0x0543('0x94')]||![];var _0x29b72c=_0x4adba7(_0x2f4d15,_0x5311b7);if(!_0x29b72c['childModel'])throw new Error(_0x0543('0x95')+_0x2f4d15+'\x27');var _0x180082=[{'name':_0x2f4d15}];if(!_[_0x0543('0x96')](_0x29b72c[_0x0543('0x1a')]))_0x180082=_0x29b72c[_0x0543('0x1a')];var _0x1e694e=[];for(var _0x16da76=0x0;_0x16da76<_0x180082[_0x0543('0x97')];_0x16da76++){_0x1e694e[_0x0543('0x98')](_0x5518f8[_0x0543('0x99')][_0x0543('0x9a')]({'where':{'userProfileId':_0x1cbb25[_0x0543('0x9b')]['id'],'name':_0x180082[_0x16da76][_0x0543('0xd')]},'raw':!![]}));}return Promise[_0x0543('0x9c')](_0x1e694e)['then'](function(_0x50abbb){var _0x41f0f2=_[_0x0543('0x5')](_0x50abbb,function(_0x3a6d64){return _0x3a6d64?_0x3a6d64:undefined;});var _0x2ee541=_['filter'](_0x180082,[_0x0543('0x9d'),!![]]);var _0x49516c=_[_0x0543('0x96')](_0x41f0f2)&&_[_0x0543('0x96')](_0x2ee541)?null:_[_0x0543('0x9e')](_0x2ee541,_0x41f0f2);if(!_0x49516c)return null;var _0x5bd53d=[];for(var _0x5cb8ce=0x0;_0x5cb8ce<_0x49516c[_0x0543('0x97')];_0x5cb8ce++){var _0x537b7d=_['find'](_0x180082,function(_0x30ee35){return _0x49516c[_0x5cb8ce]?_0x30ee35[_0x0543('0xd')]===_0x49516c[_0x5cb8ce][_0x0543('0xd')]:null;});if(_0x537b7d){if(_0x49516c[_0x5cb8ce][_0x0543('0x9d')]){_0x5bd53d[_0x0543('0x98')](_0x1c5ab7(_0x29b72c[_0x0543('0x14')],_0x49516c[_0x5cb8ce]));}else{if(!_0x49516c[_0x5cb8ce][_0x0543('0x9f')]){_0x5bd53d[_0x0543('0x98')](_0x1cfadf(_0x537b7d,_0x49516c[_0x5cb8ce],_0x29b72c[_0x0543('0x14')]));}else{if(_0x537b7d['model']){_0x5bd53d[_0x0543('0x98')](_0x52c9b7(_0x537b7d,_0x49516c[_0x5cb8ce]));}}}}}return Promise[_0x0543('0x9c')](_0x5bd53d);})[_0x0543('0x8')](function(_0x2e081e){var _0x3d918d=_0x2e081e;var _0x53f0f3=null;if(_0x3d918d){_0x53f0f3=_0x3d918d[_0x0543('0x97')]===0x1?_0x3d918d[0x0]:null;}if(!_0x53f0f3&&!_0x3d918d)return _0x5c140c;var _0x5738de=_0x5518f8[_0x29b72c[_0x0543('0x14')]][_0x0543('0xa0')];_0x5f08ce[_0x0543('0xc')]=_[_0x0543('0xa1')](_0x5738de);_0x5f08ce['query']=_[_0x0543('0xa1')](_0x1cbb25[_0x0543('0x8e')]);_0x5f08ce[_0x0543('0xa2')]=_['intersection'](_0x5f08ce[_0x0543('0xc')],_0x5f08ce['query']);_0x1bd8d3[_0x0543('0xa3')]=_[_0x0543('0xa4')](_0x5f08ce[_0x0543('0xc')],qs[_0x0543('0xa5')](_0x1cbb25[_0x0543('0x8e')][_0x0543('0xa5')]));_0x1bd8d3['attributes']=_0x1bd8d3['attributes']['length']?_0x1bd8d3[_0x0543('0xa3')]:_0x5f08ce[_0x0543('0xc')];if(!_0x1cbb25[_0x0543('0x8e')][_0x0543('0xa6')](_0x0543('0xa7'))){_0x1bd8d3[_0x0543('0xa8')]=qs[_0x0543('0xa8')](_0x1cbb25[_0x0543('0x8e')]['limit']);_0x1bd8d3['offset']=qs[_0x0543('0xa9')](_0x1cbb25[_0x0543('0x8e')]['offset']);}_0x1bd8d3[_0x0543('0xaa')]=qs['sort'](_0x1cbb25[_0x0543('0x8e')][_0x0543('0xab')]);_0x1bd8d3[_0x0543('0x8b')]=qs[_0x0543('0xa2')](_[_0x0543('0xac')](_0x1cbb25['query'],_0x5f08ce[_0x0543('0xa2')]));if(_0x1cbb25[_0x0543('0x8e')]['filter']){_0x1bd8d3[_0x0543('0x8b')]=_[_0x0543('0xad')](_0x1bd8d3[_0x0543('0x8b')],{'$or':_['map'](_0x5738de,function(_0xf5c02c){if(_0xf5c02c[_0x0543('0x3f')][_0x0543('0xae')]!=='VIRTUAL'){var _0x18d597={};_0x18d597[_0xf5c02c[_0x0543('0xb')]]={'$like':'%'+_0x1cbb25[_0x0543('0x8e')][_0x0543('0x5')]+'%'};return _0x18d597;}})});}var _0x553023=[];var _0x27fc39=null;var _0x9ede99={};if(_0x53f0f3){_0x27fc39=_[_0x0543('0x9a')](_0x180082,[_0x0543('0xd'),_0x53f0f3[_0x0543('0xd')]]);if(_0x27fc39[_0x0543('0xb')]){_0x9ede99={};if(_0x29b72c[_0x0543('0x14')]===_0x0543('0x7b')){_0x9ede99[_0x27fc39[_0x0543('0xaf')]]=_[_0x0543('0x10')](_0x53f0f3[_0x0543('0x9')],'id');}else{_0x9ede99[_0x27fc39[_0x0543('0xaf')]]=_0x53f0f3[_0x0543('0x9')];}_0x553023[_0x0543('0x98')](_0x9ede99);}else{_0x1bd8d3[_0x0543('0x8b')]['id']=_0x53f0f3[_0x0543('0x9')];}}else{for(var _0x1bbba9=0x0;_0x1bbba9<_0x3d918d['length'];_0x1bbba9++){_0x27fc39=_[_0x0543('0x9a')](_0x180082,[_0x0543('0xd'),_0x3d918d[_0x1bbba9][_0x0543('0xd')]]);if(_0x27fc39[_0x0543('0xb')]){_0x9ede99={};_0x9ede99[_0x27fc39[_0x0543('0xaf')]]=_0x3d918d[_0x1bbba9][_0x0543('0x9')];_0x553023[_0x0543('0x98')](_0x9ede99);}else{if(!_0x1bd8d3[_0x0543('0x8b')]['id'])_0x1bd8d3[_0x0543('0x8b')]['id']=[];_0x3d918d[_0x1bbba9][_0x0543('0x9')][_0x0543('0xb0')](function(_0x4bb8ea){_0x1bd8d3[_0x0543('0x8b')]['id'][_0x0543('0x98')](_0x4bb8ea);});}}}if(!_[_0x0543('0x96')](_0x553023)){_0x1bd8d3['where']=_[_0x0543('0xad')](_0x1bd8d3['where'],{'$and':{'$or':_0x553023}});}_0x1bd8d3=_['merge']({},_0x1bd8d3,_0x1cbb25[_0x0543('0xb1')]);if(_0x53f0f3&&!_0x53f0f3['autoAssociation']&&_0x29b72c[_0x0543('0x14')]===_0x0543('0x7b')){if(_0x1cbb25[_0x0543('0x8e')][_0x0543('0xb2')]){_0x1bd8d3['include']=[{'all':!![]}];}return _0x5518f8[_0x29b72c['childModel']][_0x0543('0x7')](_0x1bd8d3)[_0x0543('0x8')](function(_0x7eafcf){var _0x5ef577=[];_0x7eafcf[_0x0543('0xb0')](function(_0xdfd945){var _0x4cf0ca;switch(_0xdfd945[_0x0543('0xb3')]){case _0x0543('0xb4'):_0x4cf0ca=_['find'](_0x53f0f3['associatedResources'],function(_0x22e8fa){return _0x22e8fa['id']===_0xdfd945[_0x0543('0xb5')]&&_0x22e8fa[_0x0543('0x3f')]==='DefaultReports';});break;case _0x0543('0xb6'):_0x4cf0ca=_[_0x0543('0x9a')](_0x53f0f3[_0x0543('0x9')],function(_0x55952a){return _0x55952a['id']===_0xdfd945['reportId']&&_0x55952a[_0x0543('0x3f')]===_0x0543('0xb7');});break;}if(_0x4cf0ca)_0x5ef577[_0x0543('0x98')](_0xdfd945);});_0x5c140c['count']=_0x5ef577[_0x0543('0x97')];_0x5c140c[_0x0543('0xb8')]=_0x5ef577;return _0x5c140c;});}else{return _0x5518f8[_0x29b72c[_0x0543('0x14')]][_0x0543('0xb9')]({'where':_0x1bd8d3[_0x0543('0x8b')]})[_0x0543('0x8')](function(_0x190b81){_0x5c140c[_0x0543('0xb9')]=_0x190b81;if(_0x1cbb25[_0x0543('0x8e')][_0x0543('0xb2')]){if(_0x29b72c[_0x0543('0x14')]===_0x0543('0x1f')){_0x1bd8d3[_0x0543('0xba')]=[{'model':_0x5518f8[_0x0543('0x71')],'as':_0x0543('0xbb'),'attributes':['id',_0x0543('0xd'),_0x0543('0xbc')],'required':_0x1cbb25['query'][_0x0543('0xbd')]?!![]:![]},{'model':_0x5518f8[_0x0543('0x71')],'as':_0x0543('0xbe'),'attributes':['id',_0x0543('0xd'),'color'],'through':_0x1cbb25[_0x0543('0x8e')][_0x0543('0xbd')]?{'attributes':[],'where':{'TagId':_0x1cbb25[_0x0543('0x8e')][_0x0543('0xbd')]||undefined}}:{},'required':_0x1cbb25['query'][_0x0543('0xbd')]?!![]:![]}];}else{_0x1bd8d3[_0x0543('0xba')]=[{'all':!![]}];}}return _0x5518f8[_0x29b72c['childModel']][_0x0543('0x7')](_0x1bd8d3);})[_0x0543('0x8')](function(_0x34f06a){_0x5c140c[_0x0543('0xb8')]=_0x34f06a;if(_0x2f4d15==='Agents'&&_0x1cbb25[_0x0543('0x8e')][_0x0543('0xbf')]===_0x0543('0xc0')){var _0x24fca2=[];for(var _0x2d7617=0x0;_0x2d7617<_0x5c140c['rows'][_0x0543('0x97')];_0x2d7617++){_0x24fca2[_0x0543('0x98')](_0x2496d3('chat',_0x5c140c[_0x0543('0xb8')][_0x2d7617]['dataValues']));_0x24fca2[_0x0543('0x98')](_0x2496d3(_0x0543('0xc1'),_0x5c140c[_0x0543('0xb8')][_0x2d7617][_0x0543('0xc2')]));_0x24fca2['push'](_0x2496d3(_0x0543('0xc3'),_0x5c140c['rows'][_0x2d7617][_0x0543('0xc2')]));_0x24fca2[_0x0543('0x98')](_0x2496d3(_0x0543('0xc4'),_0x5c140c[_0x0543('0xb8')][_0x2d7617][_0x0543('0xc2')]));_0x24fca2[_0x0543('0x98')](_0x2496d3(_0x0543('0xc5'),_0x5c140c[_0x0543('0xb8')][_0x2d7617][_0x0543('0xc2')]));_0x24fca2[_0x0543('0x98')](_0x2496d3(_0x0543('0xc6'),_0x5c140c['rows'][_0x2d7617][_0x0543('0xc2')]));}return Promise[_0x0543('0x9c')](_0x24fca2)[_0x0543('0x8')](function(){return _0x5c140c;});}return _0x5c140c;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 643862d..80315bb 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 _0xaa37=['UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./userProfile.socket','register','then','info'];(function(_0x455471,_0xe4fc72){var _0x367d9a=function(_0x48ff5b){while(--_0x48ff5b){_0x455471['push'](_0x455471['shift']());}};_0x367d9a(++_0xe4fc72);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xaa37[_0x24061a];return _0x82054e;};'use strict';var _=require(_0x7aa3('0x0'));var util=require(_0x7aa3('0x1'));var moment=require(_0x7aa3('0x2'));var BPromise=require(_0x7aa3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7aa3('0x4'));var db=require(_0x7aa3('0x5'))['db'];var utils=require(_0x7aa3('0x6'));var logger=require(_0x7aa3('0x7'))(_0x7aa3('0x8'));var config=require(_0x7aa3('0x9'));var jayson=require(_0x7aa3('0xa'));var client=jayson['client'][_0x7aa3('0xb')]({'port':0x232a});config[_0x7aa3('0xc')]=_['defaults'](config[_0x7aa3('0xc')],{'host':_0x7aa3('0xd'),'port':0x18eb});var socket=require(_0x7aa3('0xe'))(new Redis(config['redis']));require(_0x7aa3('0xf'))[_0x7aa3('0x10')](socket);function respondWithRpcPromise(_0x321fd3,_0x1725d1,_0x10aa91){return new BPromise(function(_0x67838e,_0x5aa7f2){return client['request'](_0x321fd3,_0x10aa91)[_0x7aa3('0x11')](function(_0x509eb9){logger[_0x7aa3('0x12')](_0x7aa3('0x13'),_0x1725d1,'request\x20sent');logger[_0x7aa3('0x14')](_0x7aa3('0x15'),_0x1725d1,'request\x20sent',JSON['stringify'](_0x509eb9));if(_0x509eb9['error']){if(_0x509eb9[_0x7aa3('0x16')][_0x7aa3('0x17')]===0x1f4){logger[_0x7aa3('0x16')](_0x7aa3('0x13'),_0x1725d1,_0x509eb9[_0x7aa3('0x16')]['message']);return _0x5aa7f2(_0x509eb9[_0x7aa3('0x16')][_0x7aa3('0x18')]);}logger[_0x7aa3('0x16')](_0x7aa3('0x13'),_0x1725d1,_0x509eb9['error']['message']);return _0x67838e(_0x509eb9[_0x7aa3('0x16')]['message']);}else{logger[_0x7aa3('0x12')](_0x7aa3('0x13'),_0x1725d1,'request\x20sent');_0x67838e(_0x509eb9[_0x7aa3('0x19')][_0x7aa3('0x18')]);}})[_0x7aa3('0x1a')](function(_0x357564){logger[_0x7aa3('0x16')]('UserProfile,\x20%s,\x20%s',_0x1725d1,_0x357564);_0x5aa7f2(_0x357564);});});} \ No newline at end of file +var _0x044a=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x38be8f,_0x58f8d2){var _0x532dcf=function(_0x357ebc){while(--_0x357ebc){_0x38be8f['push'](_0x38be8f['shift']());}};_0x532dcf(++_0x58f8d2);}(_0x044a,0x173));var _0xa044=function(_0x33e4b5,_0x16da83){_0x33e4b5=_0x33e4b5-0x0;var _0x5c6a78=_0x044a[_0x33e4b5];return _0x5c6a78;};'use strict';var _=require(_0xa044('0x0'));var util=require(_0xa044('0x1'));var moment=require(_0xa044('0x2'));var BPromise=require(_0xa044('0x3'));var rs=require(_0xa044('0x4'));var fs=require('fs');var Redis=require(_0xa044('0x5'));var db=require(_0xa044('0x6'))['db'];var utils=require(_0xa044('0x7'));var logger=require(_0xa044('0x8'))(_0xa044('0x9'));var config=require('../../config/environment');var jayson=require(_0xa044('0xa'));var client=jayson[_0xa044('0xb')][_0xa044('0xc')]({'port':0x232a});config[_0xa044('0xd')]=_['defaults'](config[_0xa044('0xd')],{'host':_0xa044('0xe'),'port':0x18eb});var socket=require(_0xa044('0xf'))(new Redis(config[_0xa044('0xd')]));require('./userProfile.socket')[_0xa044('0x10')](socket);function respondWithRpcPromise(_0x9dec14,_0x3f170b,_0x47a9dc){return new BPromise(function(_0xdf14f6,_0xa3b07f){return client[_0xa044('0x11')](_0x9dec14,_0x47a9dc)[_0xa044('0x12')](function(_0x5e203d){logger[_0xa044('0x13')]('UserProfile,\x20%s,\x20%s',_0x3f170b,'request\x20sent');logger[_0xa044('0x14')](_0xa044('0x15'),_0x3f170b,_0xa044('0x16'),JSON[_0xa044('0x17')](_0x5e203d));if(_0x5e203d[_0xa044('0x18')]){if(_0x5e203d[_0xa044('0x18')][_0xa044('0x19')]===0x1f4){logger['error'](_0xa044('0x1a'),_0x3f170b,_0x5e203d['error'][_0xa044('0x1b')]);return _0xa3b07f(_0x5e203d[_0xa044('0x18')][_0xa044('0x1b')]);}logger[_0xa044('0x18')](_0xa044('0x1a'),_0x3f170b,_0x5e203d['error']['message']);return _0xdf14f6(_0x5e203d[_0xa044('0x18')]['message']);}else{logger[_0xa044('0x13')](_0xa044('0x1a'),_0x3f170b,_0xa044('0x16'));_0xdf14f6(_0x5e203d[_0xa044('0x1c')][_0xa044('0x1b')]);}})['catch'](function(_0x567124){logger['error'](_0xa044('0x1a'),_0x3f170b,_0x567124);_0xa3b07f(_0x567124);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 5ba1a9c..c858413 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 _0x2752=['userProfile:','save','remove','emit','removeListener','register','length'];(function(_0x4702ee,_0xaf6a45){var _0x62ca7d=function(_0x5b3af7){while(--_0x5b3af7){_0x4702ee['push'](_0x4702ee['shift']());}};_0x62ca7d(++_0xaf6a45);}(_0x2752,0x104));var _0x2275=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2752[_0x321bb2];return _0x9c12ed;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x2275('0x0'),_0x2275('0x1'),'update'];function createListener(_0x12dc88,_0x2db7b6){return function(_0x50e3fd){_0x2db7b6[_0x2275('0x2')](_0x12dc88,_0x50e3fd);};}function removeListener(_0x3f13bf,_0x5dcd55){return function(){UserProfileEvents[_0x2275('0x3')](_0x3f13bf,_0x5dcd55);};}exports[_0x2275('0x4')]=function(_0xd6641c){for(var _0x33a6ab=0x0,_0x2beca7=events[_0x2275('0x5')];_0x33a6ab<_0x2beca7;_0x33a6ab++){var _0x287a09=events[_0x33a6ab];var _0x1d398d=createListener(_0x2275('0x6')+_0x287a09,_0xd6641c);UserProfileEvents['on'](_0x287a09,_0x1d398d);}}; \ No newline at end of file +var _0x64c7=['length','remove','update','emit','register'];(function(_0x45c712,_0x2e68b2){var _0xb612e0=function(_0x51b7fe){while(--_0x51b7fe){_0x45c712['push'](_0x45c712['shift']());}};_0xb612e0(++_0x2e68b2);}(_0x64c7,0x1dc));var _0x764c=function(_0x5dfc2a,_0x1a953f){_0x5dfc2a=_0x5dfc2a-0x0;var _0x3f1a71=_0x64c7[_0x5dfc2a];return _0x3f1a71;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save',_0x764c('0x0'),_0x764c('0x1')];function createListener(_0x33ff53,_0x491659){return function(_0x2940c1){_0x491659[_0x764c('0x2')](_0x33ff53,_0x2940c1);};}function removeListener(_0x4ed892,_0x4813af){return function(){UserProfileEvents['removeListener'](_0x4ed892,_0x4813af);};}exports[_0x764c('0x3')]=function(_0x4bf70e){for(var _0x1d94dd=0x0,_0x4ea75c=events[_0x764c('0x4')];_0x1d94dd<_0x4ea75c;_0x1d94dd++){var _0x5397a5=events[_0x1d94dd];var _0x3b0f53=createListener('userProfile:'+_0x5397a5,_0x4bf70e);UserProfileEvents['on'](_0x5397a5,_0x3b0f53);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index a2a20fc..dabfa3a 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 _0xec59=['delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','update'];(function(_0x2a80b4,_0x43199e){var _0x7a10c5=function(_0x2da4f8){while(--_0x2da4f8){_0x2a80b4['push'](_0x2a80b4['shift']());}};_0x7a10c5(++_0x43199e);}(_0xec59,0xdf));var _0x9ec5=function(_0x44b216,_0x40f725){_0x44b216=_0x44b216-0x0;var _0x25efaa=_0xec59[_0x44b216];return _0x25efaa;};'use strict';var multer=require(_0x9ec5('0x0'));var util=require('util');var path=require(_0x9ec5('0x1'));var timeout=require('connect-timeout');var express=require(_0x9ec5('0x2'));var router=express[_0x9ec5('0x3')]();var fs_extra=require(_0x9ec5('0x4'));var auth=require(_0x9ec5('0x5'));var interaction=require(_0x9ec5('0x6'));var config=require('../../config/environment');var controller=require(_0x9ec5('0x7'));router[_0x9ec5('0x8')]('/',auth['isAuthenticated'](),controller[_0x9ec5('0x9')]);router[_0x9ec5('0x8')](_0x9ec5('0xa'),auth[_0x9ec5('0xb')](),controller[_0x9ec5('0xc')]);router[_0x9ec5('0x8')](_0x9ec5('0xd'),auth[_0x9ec5('0xb')](),controller['show']);router[_0x9ec5('0xe')]('/',auth[_0x9ec5('0xb')](),controller[_0x9ec5('0xf')]);router['put'](_0x9ec5('0xd'),auth[_0x9ec5('0xb')](),controller[_0x9ec5('0x10')]);router[_0x9ec5('0x11')]('/:id',auth[_0x9ec5('0xb')](),controller[_0x9ec5('0x12')]);module[_0x9ec5('0x13')]=router; \ No newline at end of file +var _0xaf3f=['show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','index','isAuthenticated','describe','/:id'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xaf3f,0x182));var _0xfaf3=function(_0x129170,_0x5110dc){_0x129170=_0x129170-0x0;var _0x523b0a=_0xaf3f[_0x129170];return _0x523b0a;};'use strict';var multer=require(_0xfaf3('0x0'));var util=require(_0xfaf3('0x1'));var path=require(_0xfaf3('0x2'));var timeout=require(_0xfaf3('0x3'));var express=require(_0xfaf3('0x4'));var router=express['Router']();var fs_extra=require(_0xfaf3('0x5'));var auth=require(_0xfaf3('0x6'));var interaction=require(_0xfaf3('0x7'));var config=require('../../config/environment');var controller=require(_0xfaf3('0x8'));router[_0xfaf3('0x9')]('/',auth['isAuthenticated'](),controller[_0xfaf3('0xa')]);router[_0xfaf3('0x9')]('/describe',auth[_0xfaf3('0xb')](),controller[_0xfaf3('0xc')]);router[_0xfaf3('0x9')](_0xfaf3('0xd'),auth['isAuthenticated'](),controller[_0xfaf3('0xe')]);router[_0xfaf3('0xf')]('/',auth['isAuthenticated'](),controller[_0xfaf3('0x10')]);router['put']('/:id',auth[_0xfaf3('0xb')](),controller['update']);router[_0xfaf3('0x11')](_0xfaf3('0xd'),auth[_0xfaf3('0xb')](),controller[_0xfaf3('0x12')]);module[_0xfaf3('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index dcf4f44..f69767b 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 _0xfc09=['sequelize','STRING','INTEGER'];(function(_0x3b2d81,_0x3a5ee8){var _0x1ac262=function(_0xb01f3c){while(--_0xb01f3c){_0x3b2d81['push'](_0x3b2d81['shift']());}};_0x1ac262(++_0x3a5ee8);}(_0xfc09,0x9c));var _0x9fc0=function(_0x35d7e7,_0xb8aed8){_0x35d7e7=_0x35d7e7-0x0;var _0x1652c6=_0xfc09[_0x35d7e7];return _0x1652c6;};'use strict';var Sequelize=require(_0x9fc0('0x0'));module['exports']={'name':{'type':Sequelize[_0x9fc0('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x9fc0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9fc0('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x545c=['INTEGER','STRING','sequelize','exports'];(function(_0x490702,_0x590e55){var _0x31f197=function(_0x125300){while(--_0x125300){_0x490702['push'](_0x490702['shift']());}};_0x31f197(++_0x590e55);}(_0x545c,0x1c6));var _0xc545=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x545c[_0x36ed3c];return _0x52a2e0;};'use strict';var Sequelize=require(_0xc545('0x0'));module[_0xc545('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xc545('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc545('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 14b513e..21ceb05 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 _0xe3da=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','order','sort','where','pick','map','VIRTUAL','filter','merge','options','count','include','findAll','rows','catch','show','params','length','includeAll','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','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x287d3d,_0x42ffba){var _0xd472a8=function(_0x125b48){while(--_0x125b48){_0x287d3d['push'](_0x287d3d['shift']());}};_0xd472a8(++_0x42ffba);}(_0xe3da,0x1cd));var _0xae3d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe3da[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0xae3d('0x0'));var rimraf=require(_0xae3d('0x1'));var zipdir=require(_0xae3d('0x2'));var jsonpatch=require(_0xae3d('0x3'));var rp=require(_0xae3d('0x4'));var moment=require(_0xae3d('0x5'));var BPromise=require(_0xae3d('0x6'));var Mustache=require(_0xae3d('0x7'));var util=require(_0xae3d('0x8'));var path=require(_0xae3d('0x9'));var sox=require(_0xae3d('0xa'));var csv=require(_0xae3d('0xb'));var ejs=require(_0xae3d('0xc'));var fs=require('fs');var fs_extra=require(_0xae3d('0xd'));var _=require(_0xae3d('0xe'));var squel=require(_0xae3d('0xf'));var crypto=require('crypto');var jsforce=require(_0xae3d('0x10'));var deskjs=require(_0xae3d('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae3d('0x12'));var Redis=require(_0xae3d('0x13'));var authService=require(_0xae3d('0x14'));var qs=require(_0xae3d('0x15'));var as=require(_0xae3d('0x16'));var hardwareService=require(_0xae3d('0x17'));var logger=require('../../config/logger')(_0xae3d('0x18'));var utils=require('../../config/utils');var config=require(_0xae3d('0x19'));var licenseUtil=require(_0xae3d('0x1a'));var db=require(_0xae3d('0x1b'))['db'];function respondWithStatusCode(_0x172f7a,_0x48aa74){_0x48aa74=_0x48aa74||0xcc;return function(_0xfb7869){if(_0xfb7869){return _0x172f7a[_0xae3d('0x1c')](_0x48aa74);}return _0x172f7a[_0xae3d('0x1d')](_0x48aa74)[_0xae3d('0x1e')]();};}function respondWithResult(_0x2afdd3,_0x430659){_0x430659=_0x430659||0xc8;return function(_0x31498d){if(_0x31498d){return _0x2afdd3['status'](_0x430659)[_0xae3d('0x1f')](_0x31498d);}};}function respondWithFilteredResult(_0x42f4b4,_0x46295b){return function(_0x230afb){if(_0x230afb){var _0x192c13=typeof _0x46295b[_0xae3d('0x20')]==='undefined'&&typeof _0x46295b[_0xae3d('0x21')]===_0xae3d('0x22');var _0x2e31f1=_0x230afb['count'];var _0x3f8cf9=_0x192c13?0x0:_0x46295b[_0xae3d('0x20')];var _0x558e42=_0x192c13?_0x230afb['count']:_0x46295b[_0xae3d('0x20')]+_0x46295b[_0xae3d('0x21')];var _0x19c44d;if(_0x558e42>=_0x2e31f1){_0x558e42=_0x2e31f1;_0x19c44d=0xc8;}else{_0x19c44d=0xce;}_0x42f4b4[_0xae3d('0x1d')](_0x19c44d);return _0x42f4b4[_0xae3d('0x23')]('Content-Range',_0x3f8cf9+'-'+_0x558e42+'/'+_0x2e31f1)[_0xae3d('0x1f')](_0x230afb);}return null;};}function patchUpdates(_0x48f00e){return function(_0x4a09c2){try{jsonpatch[_0xae3d('0x24')](_0x4a09c2,_0x48f00e,!![]);}catch(_0x1415e8){return BPromise[_0xae3d('0x25')](_0x1415e8);}return _0x4a09c2[_0xae3d('0x26')]();};}function saveUpdates(_0x3e7afc,_0x26c419){return function(_0x155099){if(_0x155099){return _0x155099[_0xae3d('0x27')](_0x3e7afc)[_0xae3d('0x28')](function(_0x300be8){return _0x300be8;});}return null;};}function removeEntity(_0x9bf34a,_0x37f5ff){return function(_0x1b2acb){if(_0x1b2acb){return _0x1b2acb[_0xae3d('0x29')]()[_0xae3d('0x28')](function(){_0x9bf34a[_0xae3d('0x1d')](0xcc)[_0xae3d('0x1e')]();});}};}function handleEntityNotFound(_0x2131e9,_0x1b1217){return function(_0x5d45db){if(!_0x5d45db){_0x2131e9[_0xae3d('0x1c')](0x194);}return _0x5d45db;};}function handleError(_0x185e71,_0xb5940){_0xb5940=_0xb5940||0x1f4;return function(_0x52df0f){logger[_0xae3d('0x2a')](_0x52df0f[_0xae3d('0x2b')]);if(_0x52df0f[_0xae3d('0x2c')]){delete _0x52df0f['name'];}_0x185e71['status'](_0xb5940)[_0xae3d('0x2d')](_0x52df0f);};}exports[_0xae3d('0x2e')]=function(_0x3a5840,_0x3114f9){var _0xb69ec9={},_0x561371={},_0x1d1483={'count':0x0,'rows':[]};var _0x3a2434=_['map'](db[_0xae3d('0x2f')][_0xae3d('0x30')],function(_0x2cf750){return{'name':_0x2cf750[_0xae3d('0x31')],'type':_0x2cf750[_0xae3d('0x32')][_0xae3d('0x33')]};});_0x561371['model']=_['map'](_0x3a2434,'name');_0x561371[_0xae3d('0x34')]=_[_0xae3d('0x35')](_0x3a5840[_0xae3d('0x34')]);_0x561371[_0xae3d('0x36')]=_['intersection'](_0x561371[_0xae3d('0x37')],_0x561371[_0xae3d('0x34')]);_0xb69ec9[_0xae3d('0x38')]=_[_0xae3d('0x39')](_0x561371[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0x3a5840[_0xae3d('0x34')]['fields']));_0xb69ec9[_0xae3d('0x38')]=_0xb69ec9['attributes']['length']?_0xb69ec9[_0xae3d('0x38')]:_0x561371['model'];if(!_0x3a5840[_0xae3d('0x34')]['hasOwnProperty']('nolimit')){_0xb69ec9[_0xae3d('0x21')]=qs[_0xae3d('0x21')](_0x3a5840[_0xae3d('0x34')]['limit']);_0xb69ec9[_0xae3d('0x20')]=qs['offset'](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x20')]);}_0xb69ec9[_0xae3d('0x3b')]=qs[_0xae3d('0x3c')](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x3c')]);_0xb69ec9[_0xae3d('0x3d')]=qs[_0xae3d('0x36')](_[_0xae3d('0x3e')](_0x3a5840[_0xae3d('0x34')],_0x561371[_0xae3d('0x36')]),_0x3a2434);if(_0x3a5840['query']['filter']){_0xb69ec9[_0xae3d('0x3d')]=_['merge'](_0xb69ec9[_0xae3d('0x3d')],{'$or':_[_0xae3d('0x3f')](_0x3a2434,function(_0x1db3c1){if(_0x1db3c1[_0xae3d('0x32')]!==_0xae3d('0x40')){var _0x35db44={};_0x35db44[_0x1db3c1[_0xae3d('0x2c')]]={'$like':'%'+_0x3a5840[_0xae3d('0x34')][_0xae3d('0x41')]+'%'};return _0x35db44;}})});}_0xb69ec9=_[_0xae3d('0x42')]({},_0xb69ec9,_0x3a5840[_0xae3d('0x43')]);var _0x549db8={'where':_0xb69ec9[_0xae3d('0x3d')]};return db[_0xae3d('0x2f')][_0xae3d('0x44')](_0x549db8)['then'](function(_0x4df102){_0x1d1483[_0xae3d('0x44')]=_0x4df102;if(_0x3a5840[_0xae3d('0x34')]['includeAll']){_0xb69ec9[_0xae3d('0x45')]=[{'all':!![]}];}return db[_0xae3d('0x2f')][_0xae3d('0x46')](_0xb69ec9);})[_0xae3d('0x28')](function(_0x436a04){_0x1d1483[_0xae3d('0x47')]=_0x436a04;return _0x1d1483;})['then'](respondWithFilteredResult(_0x3114f9,_0xb69ec9))[_0xae3d('0x48')](handleError(_0x3114f9,null));};exports[_0xae3d('0x49')]=function(_0xce7f34,_0x938811){var _0x1fef90={'raw':![],'where':{'id':_0xce7f34[_0xae3d('0x4a')]['id']}},_0x515220={};_0x515220['model']=_[_0xae3d('0x35')](db[_0xae3d('0x2f')][_0xae3d('0x30')]);_0x515220[_0xae3d('0x34')]=_['keys'](_0xce7f34['query']);_0x515220['filters']=_[_0xae3d('0x39')](_0x515220[_0xae3d('0x37')],_0x515220['query']);_0x1fef90['attributes']=_['intersection'](_0x515220[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0xce7f34[_0xae3d('0x34')][_0xae3d('0x3a')]));_0x1fef90[_0xae3d('0x38')]=_0x1fef90[_0xae3d('0x38')][_0xae3d('0x4b')]?_0x1fef90['attributes']:_0x515220['model'];if(_0xce7f34['query'][_0xae3d('0x4c')]){_0x1fef90['include']=[{'all':!![]}];}_0x1fef90=_[_0xae3d('0x42')]({},_0x1fef90,_0xce7f34[_0xae3d('0x43')]);return db[_0xae3d('0x2f')][_0xae3d('0x4d')](_0x1fef90)[_0xae3d('0x28')](handleEntityNotFound(_0x938811,null))[_0xae3d('0x28')](respondWithResult(_0x938811,null))[_0xae3d('0x48')](handleError(_0x938811,null));};exports[_0xae3d('0x4e')]=function(_0x38f92d,_0x4ed0f9){return db[_0xae3d('0x2f')]['create'](_0x38f92d['body'],{})['then'](respondWithResult(_0x4ed0f9,0xc9))[_0xae3d('0x48')](handleError(_0x4ed0f9,null));};exports[_0xae3d('0x27')]=function(_0x39f213,_0x6fa6c){if(_0x39f213['body']['id']){delete _0x39f213['body']['id'];}return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x39f213[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x6fa6c,null))['then'](saveUpdates(_0x39f213[_0xae3d('0x4f')],null))[_0xae3d('0x28')](respondWithResult(_0x6fa6c,null))[_0xae3d('0x48')](handleError(_0x6fa6c,null));};exports[_0xae3d('0x29')]=function(_0x2a6a24,_0x38ccf1){return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'id':_0x2a6a24[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x38ccf1,null))[_0xae3d('0x28')](removeEntity(_0x38ccf1,null))[_0xae3d('0x48')](handleError(_0x38ccf1,null));};exports['describe']=function(_0x4f4694,_0x4c6dab){return db[_0xae3d('0x2f')][_0xae3d('0x50')]()['then'](respondWithResult(_0x4c6dab,null))[_0xae3d('0x48')](handleError(_0x4c6dab,null));}; \ No newline at end of file +var _0x01d9=['rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send','index','map','UserProfileResource'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x901d('0x0'));var rimraf=require(_0x901d('0x1'));var zipdir=require(_0x901d('0x2'));var jsonpatch=require(_0x901d('0x3'));var rp=require('request-promise');var moment=require(_0x901d('0x4'));var BPromise=require(_0x901d('0x5'));var Mustache=require(_0x901d('0x6'));var util=require(_0x901d('0x7'));var path=require(_0x901d('0x8'));var sox=require(_0x901d('0x9'));var csv=require(_0x901d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x901d('0xb'));var _=require(_0x901d('0xc'));var squel=require(_0x901d('0xd'));var crypto=require(_0x901d('0xe'));var jsforce=require(_0x901d('0xf'));var deskjs=require(_0x901d('0x10'));var toCsv=require(_0x901d('0xa'));var querystring=require(_0x901d('0x11'));var Papa=require(_0x901d('0x12'));var Redis=require(_0x901d('0x13'));var authService=require(_0x901d('0x14'));var qs=require(_0x901d('0x15'));var as=require(_0x901d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x901d('0x17'))('api');var utils=require(_0x901d('0x18'));var config=require(_0x901d('0x19'));var licenseUtil=require(_0x901d('0x1a'));var db=require(_0x901d('0x1b'))['db'];function respondWithStatusCode(_0x15ebaf,_0x5d2345){_0x5d2345=_0x5d2345||0xcc;return function(_0x1d8117){if(_0x1d8117){return _0x15ebaf[_0x901d('0x1c')](_0x5d2345);}return _0x15ebaf[_0x901d('0x1d')](_0x5d2345)[_0x901d('0x1e')]();};}function respondWithResult(_0xb8869a,_0x14d99b){_0x14d99b=_0x14d99b||0xc8;return function(_0x530a2b){if(_0x530a2b){return _0xb8869a[_0x901d('0x1d')](_0x14d99b)[_0x901d('0x1f')](_0x530a2b);}};}function respondWithFilteredResult(_0x11b0cc,_0x17d451){return function(_0x1aba97){if(_0x1aba97){var _0x7dd5f4=typeof _0x17d451[_0x901d('0x20')]===_0x901d('0x21')&&typeof _0x17d451[_0x901d('0x22')]===_0x901d('0x21');var _0x28caae=_0x1aba97[_0x901d('0x23')];var _0x285353=_0x7dd5f4?0x0:_0x17d451[_0x901d('0x20')];var _0x38f42b=_0x7dd5f4?_0x1aba97[_0x901d('0x23')]:_0x17d451[_0x901d('0x20')]+_0x17d451[_0x901d('0x22')];var _0x57d518;if(_0x38f42b>=_0x28caae){_0x38f42b=_0x28caae;_0x57d518=0xc8;}else{_0x57d518=0xce;}_0x11b0cc[_0x901d('0x1d')](_0x57d518);return _0x11b0cc[_0x901d('0x24')]('Content-Range',_0x285353+'-'+_0x38f42b+'/'+_0x28caae)['json'](_0x1aba97);}return null;};}function patchUpdates(_0x496a06){return function(_0x53f8ae){try{jsonpatch[_0x901d('0x25')](_0x53f8ae,_0x496a06,!![]);}catch(_0x44ea6f){return BPromise['reject'](_0x44ea6f);}return _0x53f8ae[_0x901d('0x26')]();};}function saveUpdates(_0x3ea3f6,_0x488e24){return function(_0x20778b){if(_0x20778b){return _0x20778b[_0x901d('0x27')](_0x3ea3f6)[_0x901d('0x28')](function(_0x3f80b9){return _0x3f80b9;});}return null;};}function removeEntity(_0x1e7d36,_0x1818d3){return function(_0x46e5c6){if(_0x46e5c6){return _0x46e5c6[_0x901d('0x29')]()['then'](function(){_0x1e7d36[_0x901d('0x1d')](0xcc)[_0x901d('0x1e')]();});}};}function handleEntityNotFound(_0xbc89a5,_0x1f0ee5){return function(_0x557809){if(!_0x557809){_0xbc89a5[_0x901d('0x1c')](0x194);}return _0x557809;};}function handleError(_0x23fd43,_0x27f4ca){_0x27f4ca=_0x27f4ca||0x1f4;return function(_0x3cbe43){logger[_0x901d('0x2a')](_0x3cbe43['stack']);if(_0x3cbe43[_0x901d('0x2b')]){delete _0x3cbe43[_0x901d('0x2b')];}_0x23fd43[_0x901d('0x1d')](_0x27f4ca)[_0x901d('0x2c')](_0x3cbe43);};}exports[_0x901d('0x2d')]=function(_0x3de9b9,_0x48e86e){var _0xae6dfe={},_0x533038={},_0x128830={'count':0x0,'rows':[]};var _0x389fd9=_[_0x901d('0x2e')](db[_0x901d('0x2f')][_0x901d('0x30')],function(_0x20df02){return{'name':_0x20df02[_0x901d('0x31')],'type':_0x20df02[_0x901d('0x32')][_0x901d('0x33')]};});_0x533038[_0x901d('0x34')]=_[_0x901d('0x2e')](_0x389fd9,_0x901d('0x2b'));_0x533038[_0x901d('0x35')]=_[_0x901d('0x36')](_0x3de9b9[_0x901d('0x35')]);_0x533038['filters']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],_0x533038[_0x901d('0x35')]);_0xae6dfe['attributes']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],qs[_0x901d('0x38')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x38')]));_0xae6dfe[_0x901d('0x39')]=_0xae6dfe[_0x901d('0x39')][_0x901d('0x3a')]?_0xae6dfe[_0x901d('0x39')]:_0x533038[_0x901d('0x34')];if(!_0x3de9b9['query']['hasOwnProperty'](_0x901d('0x3b'))){_0xae6dfe['limit']=qs[_0x901d('0x22')](_0x3de9b9[_0x901d('0x35')]['limit']);_0xae6dfe[_0x901d('0x20')]=qs[_0x901d('0x20')](_0x3de9b9[_0x901d('0x35')]['offset']);}_0xae6dfe[_0x901d('0x3c')]=qs[_0x901d('0x3d')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x3d')]);_0xae6dfe[_0x901d('0x3e')]=qs[_0x901d('0x3f')](_[_0x901d('0x40')](_0x3de9b9[_0x901d('0x35')],_0x533038[_0x901d('0x3f')]),_0x389fd9);if(_0x3de9b9[_0x901d('0x35')][_0x901d('0x41')]){_0xae6dfe[_0x901d('0x3e')]=_[_0x901d('0x42')](_0xae6dfe[_0x901d('0x3e')],{'$or':_[_0x901d('0x2e')](_0x389fd9,function(_0x1644d8){if(_0x1644d8['type']!==_0x901d('0x43')){var _0x423cab={};_0x423cab[_0x1644d8['name']]={'$like':'%'+_0x3de9b9['query'][_0x901d('0x41')]+'%'};return _0x423cab;}})});}_0xae6dfe=_['merge']({},_0xae6dfe,_0x3de9b9[_0x901d('0x44')]);var _0x3d0556={'where':_0xae6dfe[_0x901d('0x3e')]};return db[_0x901d('0x2f')][_0x901d('0x23')](_0x3d0556)[_0x901d('0x28')](function(_0x5df4cb){_0x128830['count']=_0x5df4cb;if(_0x3de9b9['query']['includeAll']){_0xae6dfe[_0x901d('0x45')]=[{'all':!![]}];}return db[_0x901d('0x2f')]['findAll'](_0xae6dfe);})[_0x901d('0x28')](function(_0x22fc44){_0x128830['rows']=_0x22fc44;return _0x128830;})[_0x901d('0x28')](respondWithFilteredResult(_0x48e86e,_0xae6dfe))[_0x901d('0x46')](handleError(_0x48e86e,null));};exports[_0x901d('0x47')]=function(_0x2c1895,_0x53663d){var _0x5aeb41={'raw':![],'where':{'id':_0x2c1895[_0x901d('0x48')]['id']}},_0xa9c008={};_0xa9c008[_0x901d('0x34')]=_[_0x901d('0x36')](db[_0x901d('0x2f')][_0x901d('0x30')]);_0xa9c008[_0x901d('0x35')]=_[_0x901d('0x36')](_0x2c1895[_0x901d('0x35')]);_0xa9c008[_0x901d('0x3f')]=_[_0x901d('0x37')](_0xa9c008['model'],_0xa9c008[_0x901d('0x35')]);_0x5aeb41['attributes']=_[_0x901d('0x37')](_0xa9c008['model'],qs[_0x901d('0x38')](_0x2c1895['query'][_0x901d('0x38')]));_0x5aeb41[_0x901d('0x39')]=_0x5aeb41[_0x901d('0x39')][_0x901d('0x3a')]?_0x5aeb41[_0x901d('0x39')]:_0xa9c008[_0x901d('0x34')];if(_0x2c1895[_0x901d('0x35')][_0x901d('0x49')]){_0x5aeb41[_0x901d('0x45')]=[{'all':!![]}];}_0x5aeb41=_[_0x901d('0x42')]({},_0x5aeb41,_0x2c1895[_0x901d('0x44')]);return db['UserProfileResource'][_0x901d('0x4a')](_0x5aeb41)[_0x901d('0x28')](handleEntityNotFound(_0x53663d,null))[_0x901d('0x28')](respondWithResult(_0x53663d,null))[_0x901d('0x46')](handleError(_0x53663d,null));};exports[_0x901d('0x4b')]=function(_0x24b6fa,_0x27459b){return db[_0x901d('0x2f')][_0x901d('0x4b')](_0x24b6fa[_0x901d('0x4c')],{})[_0x901d('0x28')](respondWithResult(_0x27459b,0xc9))[_0x901d('0x46')](handleError(_0x27459b,null));};exports[_0x901d('0x27')]=function(_0x23f2a9,_0x4888e8){if(_0x23f2a9['body']['id']){delete _0x23f2a9[_0x901d('0x4c')]['id'];}return db[_0x901d('0x2f')][_0x901d('0x4a')]({'where':{'id':_0x23f2a9[_0x901d('0x48')]['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x4888e8,null))['then'](saveUpdates(_0x23f2a9['body'],null))[_0x901d('0x28')](respondWithResult(_0x4888e8,null))[_0x901d('0x46')](handleError(_0x4888e8,null));};exports['destroy']=function(_0x23673d,_0x165207){return db['UserProfileResource'][_0x901d('0x4a')]({'where':{'id':_0x23673d['params']['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x165207,null))[_0x901d('0x28')](removeEntity(_0x165207,null))[_0x901d('0x46')](handleError(_0x165207,null));};exports[_0x901d('0x4d')]=function(_0x52aa2d,_0x3a3ea6){return db[_0x901d('0x2f')][_0x901d('0x4d')]()[_0x901d('0x28')](respondWithResult(_0x3a3ea6,null))[_0x901d('0x46')](handleError(_0x3a3ea6,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 30baced..1627be6 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 _0x446b=['resourceId','sectionId','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','user_profile_has_resources','compositeIndex'];(function(_0x429ddd,_0x52bdf9){var _0x1225f7=function(_0x44510){while(--_0x44510){_0x429ddd['push'](_0x429ddd['shift']());}};_0x1225f7(++_0x52bdf9);}(_0x446b,0x15b));var _0xb446=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x446b[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require('lodash');var util=require(_0xb446('0x0'));var logger=require(_0xb446('0x1'))(_0xb446('0x2'));var moment=require(_0xb446('0x3'));var BPromise=require(_0xb446('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb446('0x5'));var rimraf=require(_0xb446('0x6'));var config=require(_0xb446('0x7'));var attributes=require(_0xb446('0x8'));module[_0xb446('0x9')]=function(_0x11d192,_0x5b2875){return _0x11d192[_0xb446('0xa')]('UserProfileResource',attributes,{'tableName':_0xb446('0xb'),'paranoid':![],'indexes':[{'name':_0xb446('0xc'),'fields':[_0xb446('0xd'),_0xb446('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1932=['resourceId','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./userProfileResource.attributes','define','UserProfileResource','compositeIndex'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x1932,0x6d));var _0x2193=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x1932[_0x2064e5];return _0x21a233;};'use strict';var _=require(_0x2193('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2193('0x1'));var moment=require(_0x2193('0x2'));var BPromise=require(_0x2193('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2193('0x4'));var rimraf=require(_0x2193('0x5'));var config=require(_0x2193('0x6'));var attributes=require(_0x2193('0x7'));module['exports']=function(_0x5e1e43,_0x47ea94){return _0x5e1e43[_0x2193('0x8')](_0x2193('0x9'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x2193('0xa'),'fields':[_0x2193('0xb'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 8429338..e18ddc4 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 _0x7ec6=['randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x4d40dd,_0x39592b){var _0x1c51f2=function(_0x53e502){while(--_0x53e502){_0x4d40dd['push'](_0x4d40dd['shift']());}};_0x1c51f2(++_0x39592b);}(_0x7ec6,0xec));var _0x67ec=function(_0x514260,_0x1891e1){_0x514260=_0x514260-0x0;var _0x4ac81b=_0x7ec6[_0x514260];return _0x4ac81b;};'use strict';var _=require(_0x67ec('0x0'));var util=require(_0x67ec('0x1'));var moment=require(_0x67ec('0x2'));var BPromise=require(_0x67ec('0x3'));var rs=require(_0x67ec('0x4'));var fs=require('fs');var Redis=require(_0x67ec('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x67ec('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x67ec('0x7'));var jayson=require(_0x67ec('0x8'));var client=jayson[_0x67ec('0x9')][_0x67ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4dfdf5,_0xa28984,_0x458e19){return new BPromise(function(_0x24cc84,_0x459fa3){return client[_0x67ec('0xb')](_0x4dfdf5,_0x458e19)[_0x67ec('0xc')](function(_0x599a63){logger['info'](_0x67ec('0xd'),_0xa28984,'request\x20sent');logger[_0x67ec('0xe')](_0x67ec('0xf'),_0xa28984,_0x67ec('0x10'),JSON[_0x67ec('0x11')](_0x599a63));if(_0x599a63[_0x67ec('0x12')]){if(_0x599a63[_0x67ec('0x12')][_0x67ec('0x13')]===0x1f4){logger[_0x67ec('0x12')](_0x67ec('0xd'),_0xa28984,_0x599a63[_0x67ec('0x12')][_0x67ec('0x14')]);return _0x459fa3(_0x599a63['error'][_0x67ec('0x14')]);}logger[_0x67ec('0x12')](_0x67ec('0xd'),_0xa28984,_0x599a63[_0x67ec('0x12')][_0x67ec('0x14')]);return _0x24cc84(_0x599a63[_0x67ec('0x12')][_0x67ec('0x14')]);}else{logger[_0x67ec('0x15')](_0x67ec('0xd'),_0xa28984,_0x67ec('0x10'));_0x24cc84(_0x599a63[_0x67ec('0x16')][_0x67ec('0x14')]);}})[_0x67ec('0x17')](function(_0x1a816f){logger[_0x67ec('0x12')](_0x67ec('0xd'),_0xa28984,_0x1a816f);_0x459fa3(_0x1a816f);});});} \ No newline at end of file +var _0x18b8=['message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x29de5d,_0x318caf){var _0x975265=function(_0x27e955){while(--_0x27e955){_0x29de5d['push'](_0x29de5d['shift']());}};_0x975265(++_0x318caf);}(_0x18b8,0xba));var _0x818b=function(_0x1962d2,_0x2f1ab7){_0x1962d2=_0x1962d2-0x0;var _0x110efe=_0x18b8[_0x1962d2];return _0x110efe;};'use strict';var _=require(_0x818b('0x0'));var util=require(_0x818b('0x1'));var moment=require(_0x818b('0x2'));var BPromise=require('bluebird');var rs=require(_0x818b('0x3'));var fs=require('fs');var Redis=require(_0x818b('0x4'));var db=require(_0x818b('0x5'))['db'];var utils=require(_0x818b('0x6'));var logger=require(_0x818b('0x7'))('rpc');var config=require(_0x818b('0x8'));var jayson=require(_0x818b('0x9'));var client=jayson[_0x818b('0xa')][_0x818b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x291bb6,_0x3b4530,_0x2bb2c9){return new BPromise(function(_0x593292,_0x2e5478){return client[_0x818b('0xc')](_0x291bb6,_0x2bb2c9)[_0x818b('0xd')](function(_0x6a04b0){logger[_0x818b('0xe')](_0x818b('0xf'),_0x3b4530,_0x818b('0x10'));logger[_0x818b('0x11')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x3b4530,_0x818b('0x10'),JSON[_0x818b('0x12')](_0x6a04b0));if(_0x6a04b0[_0x818b('0x13')]){if(_0x6a04b0[_0x818b('0x13')][_0x818b('0x14')]===0x1f4){logger[_0x818b('0x13')](_0x818b('0xf'),_0x3b4530,_0x6a04b0[_0x818b('0x13')][_0x818b('0x15')]);return _0x2e5478(_0x6a04b0[_0x818b('0x13')][_0x818b('0x15')]);}logger[_0x818b('0x13')](_0x818b('0xf'),_0x3b4530,_0x6a04b0[_0x818b('0x13')]['message']);return _0x593292(_0x6a04b0[_0x818b('0x13')][_0x818b('0x15')]);}else{logger[_0x818b('0xe')](_0x818b('0xf'),_0x3b4530,_0x818b('0x10'));_0x593292(_0x6a04b0['result'][_0x818b('0x15')]);}})[_0x818b('0x16')](function(_0x127027){logger[_0x818b('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x3b4530,_0x127027);_0x2e5478(_0x127027);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 7cdaf37..7da5081 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 _0xf74f=['get','index','/describe','isAuthenticated','describe','/:id','create','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x36f015,_0x2c0ab1){var _0x3ff08e=function(_0x38f61b){while(--_0x38f61b){_0x36f015['push'](_0x36f015['shift']());}};_0x3ff08e(++_0x2c0ab1);}(_0xf74f,0x107));var _0xff74=function(_0x495ff7,_0x3e38b0){_0x495ff7=_0x495ff7-0x0;var _0x65fe36=_0xf74f[_0x495ff7];return _0x65fe36;};'use strict';var multer=require(_0xff74('0x0'));var util=require(_0xff74('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xff74('0x2'));var router=express['Router']();var fs_extra=require(_0xff74('0x3'));var auth=require(_0xff74('0x4'));var interaction=require(_0xff74('0x5'));var config=require(_0xff74('0x6'));var controller=require('./userProfileSection.controller');router[_0xff74('0x7')]('/',auth['isAuthenticated'](),controller[_0xff74('0x8')]);router['get'](_0xff74('0x9'),auth[_0xff74('0xa')](),controller[_0xff74('0xb')]);router[_0xff74('0x7')](_0xff74('0xc'),auth[_0xff74('0xa')](),controller['show']);router['post']('/',auth[_0xff74('0xa')](),controller[_0xff74('0xd')]);router['put'](_0xff74('0xc'),auth[_0xff74('0xa')](),controller['update']);router['delete']('/:id',auth[_0xff74('0xa')](),controller['destroy']);module[_0xff74('0xe')]=router; \ No newline at end of file +var _0x44f3=['../../components/auth/service','../../components/interaction/service','../../config/environment','index','/describe','isAuthenticated','describe','get','show','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra'];(function(_0x57975f,_0x388556){var _0x4793b8=function(_0x652c05){while(--_0x652c05){_0x57975f['push'](_0x57975f['shift']());}};_0x4793b8(++_0x388556);}(_0x44f3,0x122));var _0x344f=function(_0x3275fb,_0x19f753){_0x3275fb=_0x3275fb-0x0;var _0x1323d4=_0x44f3[_0x3275fb];return _0x1323d4;};'use strict';var multer=require(_0x344f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x344f('0x1'));var express=require(_0x344f('0x2'));var router=express['Router']();var fs_extra=require(_0x344f('0x3'));var auth=require(_0x344f('0x4'));var interaction=require(_0x344f('0x5'));var config=require(_0x344f('0x6'));var controller=require('./userProfileSection.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x344f('0x7')]);router['get'](_0x344f('0x8'),auth[_0x344f('0x9')](),controller[_0x344f('0xa')]);router[_0x344f('0xb')]('/:id',auth[_0x344f('0x9')](),controller[_0x344f('0xc')]);router[_0x344f('0xd')]('/',auth[_0x344f('0x9')](),controller[_0x344f('0xe')]);router[_0x344f('0xf')](_0x344f('0x10'),auth[_0x344f('0x9')](),controller[_0x344f('0x11')]);router[_0x344f('0x12')](_0x344f('0x10'),auth[_0x344f('0x9')](),controller[_0x344f('0x13')]);module[_0x344f('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 5af0160..3107a8a 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 _0xfff0=['BOOLEAN','setDataValue','crudPermissions','getDataValue','split','exports','STRING'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0xfff0,0x139));var _0x0fff=function(_0x50b894,_0x350a88){_0x50b894=_0x50b894-0x0;var _0x2d99c6=_0xfff0[_0x50b894];return _0x2d99c6;};'use strict';var Sequelize=require('sequelize');module[_0x0fff('0x0')]={'name':{'type':Sequelize[_0x0fff('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x0fff('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x0fff('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x0fff('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x0fff('0x1')],'set':function(_0x4bec60){this[_0x0fff('0x3')](_0x0fff('0x4'),_0x4bec60?_0x4bec60['join'](''):[]);},'get':function(){return this[_0x0fff('0x5')](_0x0fff('0x4'))?this[_0x0fff('0x5')]('crudPermissions')[_0x0fff('0x6')](''):[];}}}; \ No newline at end of file +var _0xb9a7=['getDataValue','split','exports','BOOLEAN','STRING','setDataValue','crudPermissions','join'];(function(_0x1fe100,_0x2694f0){var _0x22b013=function(_0x39193a){while(--_0x39193a){_0x1fe100['push'](_0x1fe100['shift']());}};_0x22b013(++_0x2694f0);}(_0xb9a7,0x112));var _0x7b9a=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xb9a7[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require('sequelize');module[_0x7b9a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x7b9a('0x1')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x7b9a('0x2')],'set':function(_0x40ef7d){this[_0x7b9a('0x3')](_0x7b9a('0x4'),_0x40ef7d?_0x40ef7d[_0x7b9a('0x5')](''):[]);},'get':function(){return this[_0x7b9a('0x6')](_0x7b9a('0x4'))?this[_0x7b9a('0x6')](_0x7b9a('0x4'))[_0x7b9a('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index bcfe91c..91604fd 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 _0xc6bf=['fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','show','params','rawAttributes','find','create','body','catch','update','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','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','name','send','index','map','UserProfileSection'];(function(_0x453fb0,_0x1efeb0){var _0x2e9f68=function(_0x390670){while(--_0x390670){_0x453fb0['push'](_0x453fb0['shift']());}};_0x2e9f68(++_0x1efeb0);}(_0xc6bf,0x19e));var _0xfc6b=function(_0x548d7d,_0x2d41fc){_0x548d7d=_0x548d7d-0x0;var _0xb1c878=_0xc6bf[_0x548d7d];return _0xb1c878;};'use strict';var emlformat=require(_0xfc6b('0x0'));var rimraf=require(_0xfc6b('0x1'));var zipdir=require(_0xfc6b('0x2'));var jsonpatch=require(_0xfc6b('0x3'));var rp=require(_0xfc6b('0x4'));var moment=require('moment');var BPromise=require(_0xfc6b('0x5'));var Mustache=require(_0xfc6b('0x6'));var util=require(_0xfc6b('0x7'));var path=require(_0xfc6b('0x8'));var sox=require(_0xfc6b('0x9'));var csv=require(_0xfc6b('0xa'));var ejs=require(_0xfc6b('0xb'));var fs=require('fs');var fs_extra=require(_0xfc6b('0xc'));var _=require(_0xfc6b('0xd'));var squel=require(_0xfc6b('0xe'));var crypto=require(_0xfc6b('0xf'));var jsforce=require(_0xfc6b('0x10'));var deskjs=require(_0xfc6b('0x11'));var toCsv=require(_0xfc6b('0xa'));var querystring=require(_0xfc6b('0x12'));var Papa=require(_0xfc6b('0x13'));var Redis=require(_0xfc6b('0x14'));var authService=require(_0xfc6b('0x15'));var qs=require(_0xfc6b('0x16'));var as=require(_0xfc6b('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc6b('0x18'))('api');var utils=require(_0xfc6b('0x19'));var config=require(_0xfc6b('0x1a'));var licenseUtil=require(_0xfc6b('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x335388,_0x5785ad){_0x5785ad=_0x5785ad||0xcc;return function(_0x21b2eb){if(_0x21b2eb){return _0x335388[_0xfc6b('0x1c')](_0x5785ad);}return _0x335388['status'](_0x5785ad)[_0xfc6b('0x1d')]();};}function respondWithResult(_0x1a53b4,_0x1dcce9){_0x1dcce9=_0x1dcce9||0xc8;return function(_0x28cc2b){if(_0x28cc2b){return _0x1a53b4[_0xfc6b('0x1e')](_0x1dcce9)[_0xfc6b('0x1f')](_0x28cc2b);}};}function respondWithFilteredResult(_0x24be14,_0x1dffc9){return function(_0x34fb9f){if(_0x34fb9f){var _0x11fe8d=typeof _0x1dffc9[_0xfc6b('0x20')]===_0xfc6b('0x21')&&typeof _0x1dffc9['limit']===_0xfc6b('0x21');var _0x299f91=_0x34fb9f[_0xfc6b('0x22')];var _0x57cbde=_0x11fe8d?0x0:_0x1dffc9['offset'];var _0xc88b1d=_0x11fe8d?_0x34fb9f['count']:_0x1dffc9[_0xfc6b('0x20')]+_0x1dffc9[_0xfc6b('0x23')];var _0xb1b557;if(_0xc88b1d>=_0x299f91){_0xc88b1d=_0x299f91;_0xb1b557=0xc8;}else{_0xb1b557=0xce;}_0x24be14[_0xfc6b('0x1e')](_0xb1b557);return _0x24be14[_0xfc6b('0x24')](_0xfc6b('0x25'),_0x57cbde+'-'+_0xc88b1d+'/'+_0x299f91)[_0xfc6b('0x1f')](_0x34fb9f);}return null;};}function patchUpdates(_0x304000){return function(_0x4e026f){try{jsonpatch[_0xfc6b('0x26')](_0x4e026f,_0x304000,!![]);}catch(_0x82c5dc){return BPromise[_0xfc6b('0x27')](_0x82c5dc);}return _0x4e026f[_0xfc6b('0x28')]();};}function saveUpdates(_0x233627,_0x3dbfdf){return function(_0x1e4947){if(_0x1e4947){return _0x1e4947['update'](_0x233627)['then'](function(_0xd02043){return _0xd02043;});}return null;};}function removeEntity(_0x1f5569,_0x33db72){return function(_0x3bd58b){if(_0x3bd58b){return _0x3bd58b[_0xfc6b('0x29')]()[_0xfc6b('0x2a')](function(){_0x1f5569[_0xfc6b('0x1e')](0xcc)[_0xfc6b('0x1d')]();});}};}function handleEntityNotFound(_0x2cceef,_0x4ed023){return function(_0x326b01){if(!_0x326b01){_0x2cceef[_0xfc6b('0x1c')](0x194);}return _0x326b01;};}function handleError(_0x52c083,_0x342689){_0x342689=_0x342689||0x1f4;return function(_0x2edec1){logger['error'](_0x2edec1['stack']);if(_0x2edec1[_0xfc6b('0x2b')]){delete _0x2edec1[_0xfc6b('0x2b')];}_0x52c083['status'](_0x342689)[_0xfc6b('0x2c')](_0x2edec1);};}exports[_0xfc6b('0x2d')]=function(_0x26c403,_0x31a56c){var _0x37e9a7={},_0x5dce4b={},_0x8e4dc0={'count':0x0,'rows':[]};var _0x177380=_[_0xfc6b('0x2e')](db[_0xfc6b('0x2f')]['rawAttributes'],function(_0x2fc26a){return{'name':_0x2fc26a[_0xfc6b('0x30')],'type':_0x2fc26a[_0xfc6b('0x31')]['key']};});_0x5dce4b['model']=_['map'](_0x177380,_0xfc6b('0x2b'));_0x5dce4b[_0xfc6b('0x32')]=_[_0xfc6b('0x33')](_0x26c403[_0xfc6b('0x32')]);_0x5dce4b[_0xfc6b('0x34')]=_[_0xfc6b('0x35')](_0x5dce4b[_0xfc6b('0x36')],_0x5dce4b[_0xfc6b('0x32')]);_0x37e9a7[_0xfc6b('0x37')]=_[_0xfc6b('0x35')](_0x5dce4b['model'],qs[_0xfc6b('0x38')](_0x26c403[_0xfc6b('0x32')][_0xfc6b('0x38')]));_0x37e9a7['attributes']=_0x37e9a7['attributes'][_0xfc6b('0x39')]?_0x37e9a7[_0xfc6b('0x37')]:_0x5dce4b[_0xfc6b('0x36')];if(!_0x26c403[_0xfc6b('0x32')][_0xfc6b('0x3a')]('nolimit')){_0x37e9a7[_0xfc6b('0x23')]=qs['limit'](_0x26c403[_0xfc6b('0x32')][_0xfc6b('0x23')]);_0x37e9a7['offset']=qs[_0xfc6b('0x20')](_0x26c403[_0xfc6b('0x32')]['offset']);}_0x37e9a7[_0xfc6b('0x3b')]=qs['sort'](_0x26c403[_0xfc6b('0x32')][_0xfc6b('0x3c')]);_0x37e9a7[_0xfc6b('0x3d')]=qs['filters'](_['pick'](_0x26c403[_0xfc6b('0x32')],_0x5dce4b[_0xfc6b('0x34')]),_0x177380);if(_0x26c403['query'][_0xfc6b('0x3e')]){_0x37e9a7[_0xfc6b('0x3d')]=_[_0xfc6b('0x3f')](_0x37e9a7[_0xfc6b('0x3d')],{'$or':_[_0xfc6b('0x2e')](_0x177380,function(_0x448e75){if(_0x448e75[_0xfc6b('0x31')]!==_0xfc6b('0x40')){var _0xe44e47={};_0xe44e47[_0x448e75[_0xfc6b('0x2b')]]={'$like':'%'+_0x26c403[_0xfc6b('0x32')][_0xfc6b('0x3e')]+'%'};return _0xe44e47;}})});}_0x37e9a7=_[_0xfc6b('0x3f')]({},_0x37e9a7,_0x26c403[_0xfc6b('0x41')]);var _0x4c4184={'where':_0x37e9a7[_0xfc6b('0x3d')]};return db[_0xfc6b('0x2f')]['count'](_0x4c4184)[_0xfc6b('0x2a')](function(_0x2726ed){_0x8e4dc0['count']=_0x2726ed;if(_0x26c403[_0xfc6b('0x32')][_0xfc6b('0x42')]){_0x37e9a7['include']=[{'all':!![]}];}return db[_0xfc6b('0x2f')]['findAll'](_0x37e9a7);})[_0xfc6b('0x2a')](function(_0x4a3249){_0x8e4dc0[_0xfc6b('0x43')]=_0x4a3249;return _0x8e4dc0;})[_0xfc6b('0x2a')](respondWithFilteredResult(_0x31a56c,_0x37e9a7))['catch'](handleError(_0x31a56c,null));};exports[_0xfc6b('0x44')]=function(_0x16fd9a,_0x489ee4){var _0x69421d={'raw':![],'where':{'id':_0x16fd9a[_0xfc6b('0x45')]['id']}},_0x5c4291={};_0x5c4291[_0xfc6b('0x36')]=_[_0xfc6b('0x33')](db[_0xfc6b('0x2f')][_0xfc6b('0x46')]);_0x5c4291[_0xfc6b('0x32')]=_[_0xfc6b('0x33')](_0x16fd9a[_0xfc6b('0x32')]);_0x5c4291[_0xfc6b('0x34')]=_['intersection'](_0x5c4291[_0xfc6b('0x36')],_0x5c4291[_0xfc6b('0x32')]);_0x69421d[_0xfc6b('0x37')]=_[_0xfc6b('0x35')](_0x5c4291[_0xfc6b('0x36')],qs[_0xfc6b('0x38')](_0x16fd9a[_0xfc6b('0x32')]['fields']));_0x69421d[_0xfc6b('0x37')]=_0x69421d[_0xfc6b('0x37')][_0xfc6b('0x39')]?_0x69421d[_0xfc6b('0x37')]:_0x5c4291[_0xfc6b('0x36')];if(_0x16fd9a['query'][_0xfc6b('0x42')]){_0x69421d['include']=[{'all':!![]}];}_0x69421d=_[_0xfc6b('0x3f')]({},_0x69421d,_0x16fd9a[_0xfc6b('0x41')]);return db['UserProfileSection'][_0xfc6b('0x47')](_0x69421d)['then'](handleEntityNotFound(_0x489ee4,null))[_0xfc6b('0x2a')](respondWithResult(_0x489ee4,null))['catch'](handleError(_0x489ee4,null));};exports[_0xfc6b('0x48')]=function(_0x89a109,_0x45d2bd){return db[_0xfc6b('0x2f')][_0xfc6b('0x48')](_0x89a109[_0xfc6b('0x49')],{})[_0xfc6b('0x2a')](respondWithResult(_0x45d2bd,0xc9))[_0xfc6b('0x4a')](handleError(_0x45d2bd,null));};exports[_0xfc6b('0x4b')]=function(_0x3cd789,_0x1fbe87){if(_0x3cd789[_0xfc6b('0x49')]['id']){delete _0x3cd789['body']['id'];}return db[_0xfc6b('0x2f')]['find']({'where':{'id':_0x3cd789[_0xfc6b('0x45')]['id']}})[_0xfc6b('0x2a')](handleEntityNotFound(_0x1fbe87,null))['then'](saveUpdates(_0x3cd789[_0xfc6b('0x49')],null))[_0xfc6b('0x2a')](respondWithResult(_0x1fbe87,null))['catch'](handleError(_0x1fbe87,null));};exports[_0xfc6b('0x29')]=function(_0x16e4aa,_0x372be9){return db[_0xfc6b('0x2f')][_0xfc6b('0x47')]({'where':{'id':_0x16e4aa[_0xfc6b('0x45')]['id']}})[_0xfc6b('0x2a')](handleEntityNotFound(_0x372be9,null))[_0xfc6b('0x2a')](removeEntity(_0x372be9,null))[_0xfc6b('0x4a')](handleError(_0x372be9,null));};exports[_0xfc6b('0x4c')]=function(_0x1c50da,_0x4ec023){return db[_0xfc6b('0x2f')]['describe']()[_0xfc6b('0x2a')](respondWithResult(_0x4ec023,null))[_0xfc6b('0x4a')](handleError(_0x4ec023,null));}; \ No newline at end of file +var _0xcf99=['util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','sendStatus','error','name','send','index','rawAttributes','type','model','map','query','keys','filters','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','UserProfileSection','intersection','create','body','update','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x13b84b,_0x5ab566){var _0x111501=function(_0x4b5967){while(--_0x4b5967){_0x13b84b['push'](_0x13b84b['shift']());}};_0x111501(++_0x5ab566);}(_0xcf99,0x11d));var _0x9cf9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcf99[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x9cf9('0x0'));var rimraf=require(_0x9cf9('0x1'));var zipdir=require(_0x9cf9('0x2'));var jsonpatch=require(_0x9cf9('0x3'));var rp=require(_0x9cf9('0x4'));var moment=require(_0x9cf9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9cf9('0x6'));var util=require(_0x9cf9('0x7'));var path=require(_0x9cf9('0x8'));var sox=require('sox');var csv=require(_0x9cf9('0x9'));var ejs=require(_0x9cf9('0xa'));var fs=require('fs');var fs_extra=require(_0x9cf9('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9cf9('0xc'));var jsforce=require(_0x9cf9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9cf9('0x9'));var querystring=require(_0x9cf9('0xe'));var Papa=require('papaparse');var Redis=require(_0x9cf9('0xf'));var authService=require(_0x9cf9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9cf9('0x11'));var hardwareService=require(_0x9cf9('0x12'));var logger=require(_0x9cf9('0x13'))(_0x9cf9('0x14'));var utils=require(_0x9cf9('0x15'));var config=require(_0x9cf9('0x16'));var licenseUtil=require(_0x9cf9('0x17'));var db=require(_0x9cf9('0x18'))['db'];function respondWithStatusCode(_0x2330c8,_0x3dd1e8){_0x3dd1e8=_0x3dd1e8||0xcc;return function(_0x4c3345){if(_0x4c3345){return _0x2330c8['sendStatus'](_0x3dd1e8);}return _0x2330c8[_0x9cf9('0x19')](_0x3dd1e8)[_0x9cf9('0x1a')]();};}function respondWithResult(_0x224e1a,_0x2c6dae){_0x2c6dae=_0x2c6dae||0xc8;return function(_0x5609af){if(_0x5609af){return _0x224e1a[_0x9cf9('0x19')](_0x2c6dae)[_0x9cf9('0x1b')](_0x5609af);}};}function respondWithFilteredResult(_0x2f051c,_0xae38c6){return function(_0x2c2632){if(_0x2c2632){var _0x218000=typeof _0xae38c6['offset']===_0x9cf9('0x1c')&&typeof _0xae38c6[_0x9cf9('0x1d')]==='undefined';var _0x1ea2d6=_0x2c2632[_0x9cf9('0x1e')];var _0x78da88=_0x218000?0x0:_0xae38c6['offset'];var _0x174638=_0x218000?_0x2c2632[_0x9cf9('0x1e')]:_0xae38c6[_0x9cf9('0x1f')]+_0xae38c6['limit'];var _0x12b7b8;if(_0x174638>=_0x1ea2d6){_0x174638=_0x1ea2d6;_0x12b7b8=0xc8;}else{_0x12b7b8=0xce;}_0x2f051c[_0x9cf9('0x19')](_0x12b7b8);return _0x2f051c[_0x9cf9('0x20')](_0x9cf9('0x21'),_0x78da88+'-'+_0x174638+'/'+_0x1ea2d6)['json'](_0x2c2632);}return null;};}function patchUpdates(_0x489689){return function(_0x4af9b3){try{jsonpatch[_0x9cf9('0x22')](_0x4af9b3,_0x489689,!![]);}catch(_0x502e67){return BPromise['reject'](_0x502e67);}return _0x4af9b3[_0x9cf9('0x23')]();};}function saveUpdates(_0x571e7c,_0x13f372){return function(_0x181b9a){if(_0x181b9a){return _0x181b9a['update'](_0x571e7c)[_0x9cf9('0x24')](function(_0x16e6dc){return _0x16e6dc;});}return null;};}function removeEntity(_0x18a0c1,_0x48bfd6){return function(_0x533096){if(_0x533096){return _0x533096['destroy']()[_0x9cf9('0x24')](function(){_0x18a0c1[_0x9cf9('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3da26a,_0x50583b){return function(_0x2449b6){if(!_0x2449b6){_0x3da26a[_0x9cf9('0x25')](0x194);}return _0x2449b6;};}function handleError(_0x59331a,_0x5cfb11){_0x5cfb11=_0x5cfb11||0x1f4;return function(_0x1319bf){logger[_0x9cf9('0x26')](_0x1319bf['stack']);if(_0x1319bf[_0x9cf9('0x27')]){delete _0x1319bf[_0x9cf9('0x27')];}_0x59331a[_0x9cf9('0x19')](_0x5cfb11)[_0x9cf9('0x28')](_0x1319bf);};}exports[_0x9cf9('0x29')]=function(_0x3a463c,_0x18f31b){var _0x2a8901={},_0x381a64={},_0x1b6dec={'count':0x0,'rows':[]};var _0x23cb51=_['map'](db['UserProfileSection'][_0x9cf9('0x2a')],function(_0x3769d7){return{'name':_0x3769d7['fieldName'],'type':_0x3769d7[_0x9cf9('0x2b')]['key']};});_0x381a64[_0x9cf9('0x2c')]=_[_0x9cf9('0x2d')](_0x23cb51,_0x9cf9('0x27'));_0x381a64[_0x9cf9('0x2e')]=_[_0x9cf9('0x2f')](_0x3a463c[_0x9cf9('0x2e')]);_0x381a64[_0x9cf9('0x30')]=_['intersection'](_0x381a64['model'],_0x381a64['query']);_0x2a8901['attributes']=_['intersection'](_0x381a64[_0x9cf9('0x2c')],qs['fields'](_0x3a463c[_0x9cf9('0x2e')][_0x9cf9('0x31')]));_0x2a8901[_0x9cf9('0x32')]=_0x2a8901[_0x9cf9('0x32')][_0x9cf9('0x33')]?_0x2a8901[_0x9cf9('0x32')]:_0x381a64[_0x9cf9('0x2c')];if(!_0x3a463c[_0x9cf9('0x2e')]['hasOwnProperty'](_0x9cf9('0x34'))){_0x2a8901[_0x9cf9('0x1d')]=qs[_0x9cf9('0x1d')](_0x3a463c['query'][_0x9cf9('0x1d')]);_0x2a8901[_0x9cf9('0x1f')]=qs[_0x9cf9('0x1f')](_0x3a463c[_0x9cf9('0x2e')][_0x9cf9('0x1f')]);}_0x2a8901['order']=qs[_0x9cf9('0x35')](_0x3a463c[_0x9cf9('0x2e')][_0x9cf9('0x35')]);_0x2a8901[_0x9cf9('0x36')]=qs[_0x9cf9('0x30')](_[_0x9cf9('0x37')](_0x3a463c[_0x9cf9('0x2e')],_0x381a64[_0x9cf9('0x30')]),_0x23cb51);if(_0x3a463c[_0x9cf9('0x2e')][_0x9cf9('0x38')]){_0x2a8901[_0x9cf9('0x36')]=_[_0x9cf9('0x39')](_0x2a8901[_0x9cf9('0x36')],{'$or':_[_0x9cf9('0x2d')](_0x23cb51,function(_0x147a57){if(_0x147a57[_0x9cf9('0x2b')]!==_0x9cf9('0x3a')){var _0x79e07d={};_0x79e07d[_0x147a57[_0x9cf9('0x27')]]={'$like':'%'+_0x3a463c[_0x9cf9('0x2e')][_0x9cf9('0x38')]+'%'};return _0x79e07d;}})});}_0x2a8901=_[_0x9cf9('0x39')]({},_0x2a8901,_0x3a463c[_0x9cf9('0x3b')]);var _0x2c1c80={'where':_0x2a8901['where']};return db['UserProfileSection']['count'](_0x2c1c80)[_0x9cf9('0x24')](function(_0x266910){_0x1b6dec[_0x9cf9('0x1e')]=_0x266910;if(_0x3a463c[_0x9cf9('0x2e')][_0x9cf9('0x3c')]){_0x2a8901[_0x9cf9('0x3d')]=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x2a8901);})['then'](function(_0x3b21b2){_0x1b6dec[_0x9cf9('0x3e')]=_0x3b21b2;return _0x1b6dec;})[_0x9cf9('0x24')](respondWithFilteredResult(_0x18f31b,_0x2a8901))[_0x9cf9('0x3f')](handleError(_0x18f31b,null));};exports[_0x9cf9('0x40')]=function(_0x451264,_0x346dce){var _0x4600a5={'raw':![],'where':{'id':_0x451264[_0x9cf9('0x41')]['id']}},_0x32e134={};_0x32e134[_0x9cf9('0x2c')]=_[_0x9cf9('0x2f')](db[_0x9cf9('0x42')][_0x9cf9('0x2a')]);_0x32e134[_0x9cf9('0x2e')]=_['keys'](_0x451264[_0x9cf9('0x2e')]);_0x32e134[_0x9cf9('0x30')]=_[_0x9cf9('0x43')](_0x32e134[_0x9cf9('0x2c')],_0x32e134[_0x9cf9('0x2e')]);_0x4600a5['attributes']=_[_0x9cf9('0x43')](_0x32e134[_0x9cf9('0x2c')],qs[_0x9cf9('0x31')](_0x451264['query'][_0x9cf9('0x31')]));_0x4600a5[_0x9cf9('0x32')]=_0x4600a5[_0x9cf9('0x32')][_0x9cf9('0x33')]?_0x4600a5[_0x9cf9('0x32')]:_0x32e134[_0x9cf9('0x2c')];if(_0x451264[_0x9cf9('0x2e')]['includeAll']){_0x4600a5[_0x9cf9('0x3d')]=[{'all':!![]}];}_0x4600a5=_[_0x9cf9('0x39')]({},_0x4600a5,_0x451264[_0x9cf9('0x3b')]);return db['UserProfileSection']['find'](_0x4600a5)[_0x9cf9('0x24')](handleEntityNotFound(_0x346dce,null))['then'](respondWithResult(_0x346dce,null))[_0x9cf9('0x3f')](handleError(_0x346dce,null));};exports[_0x9cf9('0x44')]=function(_0x131347,_0x24c42d){return db[_0x9cf9('0x42')][_0x9cf9('0x44')](_0x131347[_0x9cf9('0x45')],{})[_0x9cf9('0x24')](respondWithResult(_0x24c42d,0xc9))[_0x9cf9('0x3f')](handleError(_0x24c42d,null));};exports[_0x9cf9('0x46')]=function(_0xcb7e54,_0x106c06){if(_0xcb7e54['body']['id']){delete _0xcb7e54[_0x9cf9('0x45')]['id'];}return db['UserProfileSection'][_0x9cf9('0x47')]({'where':{'id':_0xcb7e54[_0x9cf9('0x41')]['id']}})[_0x9cf9('0x24')](handleEntityNotFound(_0x106c06,null))[_0x9cf9('0x24')](saveUpdates(_0xcb7e54[_0x9cf9('0x45')],null))['then'](respondWithResult(_0x106c06,null))[_0x9cf9('0x3f')](handleError(_0x106c06,null));};exports[_0x9cf9('0x48')]=function(_0x29101c,_0x3f04cb){return db[_0x9cf9('0x42')][_0x9cf9('0x47')]({'where':{'id':_0x29101c[_0x9cf9('0x41')]['id']}})[_0x9cf9('0x24')](handleEntityNotFound(_0x3f04cb,null))['then'](removeEntity(_0x3f04cb,null))[_0x9cf9('0x3f')](handleError(_0x3f04cb,null));};exports['describe']=function(_0x136b6a,_0x555750){return db[_0x9cf9('0x42')]['describe']()['then'](respondWithResult(_0x555750,null))[_0x9cf9('0x3f')](handleError(_0x555750,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index c7a2f9a..c57fb82 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 _0x22f8=['userProfileId','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','define','UserProfileSection','compositeIndex'];(function(_0x5ee3d3,_0x537c30){var _0x4b272f=function(_0x3dc277){while(--_0x3dc277){_0x5ee3d3['push'](_0x5ee3d3['shift']());}};_0x4b272f(++_0x537c30);}(_0x22f8,0x187));var _0x822f=function(_0x22da96,_0xfc5108){_0x22da96=_0x22da96-0x0;var _0x5a35dd=_0x22f8[_0x22da96];return _0x5a35dd;};'use strict';var _=require('lodash');var util=require(_0x822f('0x0'));var logger=require('../../config/logger')(_0x822f('0x1'));var moment=require(_0x822f('0x2'));var BPromise=require(_0x822f('0x3'));var rp=require(_0x822f('0x4'));var fs=require('fs');var path=require(_0x822f('0x5'));var rimraf=require(_0x822f('0x6'));var config=require(_0x822f('0x7'));var attributes=require(_0x822f('0x8'));module['exports']=function(_0x2b60df,_0x24e5a7){return _0x2b60df[_0x822f('0x9')](_0x822f('0xa'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x822f('0xb'),'fields':['sectionId',_0x822f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x734c=['./userProfileSection.attributes','exports','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x6523e4,_0x5b02f2){var _0x39317e=function(_0x534685){while(--_0x534685){_0x6523e4['push'](_0x6523e4['shift']());}};_0x39317e(++_0x5b02f2);}(_0x734c,0xe2));var _0xc734=function(_0x2c7fcd,_0x5977ae){_0x2c7fcd=_0x2c7fcd-0x0;var _0x204929=_0x734c[_0x2c7fcd];return _0x204929;};'use strict';var _=require(_0xc734('0x0'));var util=require(_0xc734('0x1'));var logger=require(_0xc734('0x2'))(_0xc734('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc734('0x4'));var fs=require('fs');var path=require(_0xc734('0x5'));var rimraf=require(_0xc734('0x6'));var config=require(_0xc734('0x7'));var attributes=require(_0xc734('0x8'));module[_0xc734('0x9')]=function(_0x5487fc,_0x373873){return _0x5487fc['define']('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xc734('0xa'),'fields':[_0xc734('0xb'),_0xc734('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 36f757e..20c217f 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 _0x34f2=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x2f705e,_0x3864c8){var _0x4ee780=function(_0x3d0008){while(--_0x3d0008){_0x2f705e['push'](_0x2f705e['shift']());}};_0x4ee780(++_0x3864c8);}(_0x34f2,0x15a));var _0x234f=function(_0x254f11,_0x1f835d){_0x254f11=_0x254f11-0x0;var _0x2877b8=_0x34f2[_0x254f11];return _0x2877b8;};'use strict';var _=require(_0x234f('0x0'));var util=require(_0x234f('0x1'));var moment=require('moment');var BPromise=require(_0x234f('0x2'));var rs=require(_0x234f('0x3'));var fs=require('fs');var Redis=require(_0x234f('0x4'));var db=require(_0x234f('0x5'))['db'];var utils=require(_0x234f('0x6'));var logger=require(_0x234f('0x7'))(_0x234f('0x8'));var config=require(_0x234f('0x9'));var jayson=require(_0x234f('0xa'));var client=jayson[_0x234f('0xb')][_0x234f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x254f37,_0x3aaf6c,_0x477918){return new BPromise(function(_0x691793,_0x514588){return client[_0x234f('0xd')](_0x254f37,_0x477918)[_0x234f('0xe')](function(_0x5d9661){logger['info'](_0x234f('0xf'),_0x3aaf6c,_0x234f('0x10'));logger[_0x234f('0x11')](_0x234f('0x12'),_0x3aaf6c,_0x234f('0x10'),JSON['stringify'](_0x5d9661));if(_0x5d9661[_0x234f('0x13')]){if(_0x5d9661[_0x234f('0x13')][_0x234f('0x14')]===0x1f4){logger[_0x234f('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x3aaf6c,_0x5d9661[_0x234f('0x13')]['message']);return _0x514588(_0x5d9661[_0x234f('0x13')][_0x234f('0x15')]);}logger[_0x234f('0x13')](_0x234f('0xf'),_0x3aaf6c,_0x5d9661[_0x234f('0x13')][_0x234f('0x15')]);return _0x691793(_0x5d9661[_0x234f('0x13')]['message']);}else{logger['info'](_0x234f('0xf'),_0x3aaf6c,_0x234f('0x10'));_0x691793(_0x5d9661['result'][_0x234f('0x15')]);}})[_0x234f('0x16')](function(_0x228dcc){logger[_0x234f('0x13')](_0x234f('0xf'),_0x3aaf6c,_0x228dcc);_0x514588(_0x228dcc);});});} \ No newline at end of file +var _0xb719=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x494f4d,_0x2807fa){var _0x3e7dfc=function(_0x14f2d2){while(--_0x14f2d2){_0x494f4d['push'](_0x494f4d['shift']());}};_0x3e7dfc(++_0x2807fa);}(_0xb719,0x1f4));var _0x9b71=function(_0x364cf8,_0x146b9b){_0x364cf8=_0x364cf8-0x0;var _0x6a59ee=_0xb719[_0x364cf8];return _0x6a59ee;};'use strict';var _=require(_0x9b71('0x0'));var util=require(_0x9b71('0x1'));var moment=require(_0x9b71('0x2'));var BPromise=require(_0x9b71('0x3'));var rs=require(_0x9b71('0x4'));var fs=require('fs');var Redis=require(_0x9b71('0x5'));var db=require(_0x9b71('0x6'))['db'];var utils=require(_0x9b71('0x7'));var logger=require('../../config/logger')(_0x9b71('0x8'));var config=require(_0x9b71('0x9'));var jayson=require(_0x9b71('0xa'));var client=jayson['client'][_0x9b71('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39e280,_0x2d9fcb,_0x4cd350){return new BPromise(function(_0x5e3951,_0x2a4d12){return client[_0x9b71('0xc')](_0x39e280,_0x4cd350)[_0x9b71('0xd')](function(_0x18bc6c){logger[_0x9b71('0xe')](_0x9b71('0xf'),_0x2d9fcb,_0x9b71('0x10'));logger[_0x9b71('0x11')](_0x9b71('0x12'),_0x2d9fcb,'request\x20sent',JSON[_0x9b71('0x13')](_0x18bc6c));if(_0x18bc6c[_0x9b71('0x14')]){if(_0x18bc6c[_0x9b71('0x14')][_0x9b71('0x15')]===0x1f4){logger[_0x9b71('0x14')](_0x9b71('0xf'),_0x2d9fcb,_0x18bc6c[_0x9b71('0x14')][_0x9b71('0x16')]);return _0x2a4d12(_0x18bc6c[_0x9b71('0x14')]['message']);}logger[_0x9b71('0x14')](_0x9b71('0xf'),_0x2d9fcb,_0x18bc6c[_0x9b71('0x14')]['message']);return _0x5e3951(_0x18bc6c[_0x9b71('0x14')]['message']);}else{logger[_0x9b71('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x2d9fcb,_0x9b71('0x10'));_0x5e3951(_0x18bc6c[_0x9b71('0x17')][_0x9b71('0x16')]);}})[_0x9b71('0x18')](function(_0x10b0cc){logger['error'](_0x9b71('0xf'),_0x2d9fcb,_0x10b0cc);_0x2a4d12(_0x10b0cc);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 33b9492..9f36602 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5cd406,_0x552a6e){var _0x380edb=function(_0xa79895){while(--_0xa79895){_0x5cd406['push'](_0x5cd406['shift']());}};_0x380edb(++_0x552a6e);}(_0xe706,0xa3));var _0x6e70=function(_0x3c81b5,_0x3f5ed7){_0x3c81b5=_0x3c81b5-0x0;var _0x5888c4=_0xe706[_0x3c81b5];return _0x5888c4;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2418bd,_0x1ddd5){var _0x12d19c=function(_0x3fc285){while(--_0x3fc285){_0x2418bd['push'](_0x2418bd['shift']());}};_0x12d19c(++_0x1ddd5);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 1d7b39a..318a298 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 _0x28d0=['sequelize'];(function(_0x1f71d8,_0x278518){var _0x10b045=function(_0x57aea4){while(--_0x57aea4){_0x1f71d8['push'](_0x1f71d8['shift']());}};_0x10b045(++_0x278518);}(_0x28d0,0x163));var _0x028d=function(_0x1ae82e,_0x493c9a){_0x1ae82e=_0x1ae82e-0x0;var _0x3cdd3d=_0x28d0[_0x1ae82e];return _0x3cdd3d;};'use strict';var Sequelize=require(_0x028d('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd5b1=['sequelize'];(function(_0x517b8d,_0x40e01d){var _0x416b3c=function(_0xee87aa){while(--_0xee87aa){_0x517b8d['push'](_0x517b8d['shift']());}};_0x416b3c(++_0x40e01d);}(_0xd5b1,0x116));var _0x1d5b=function(_0x2ede20,_0x15ead9){_0x2ede20=_0x2ede20-0x0;var _0x1743a8=_0xd5b1[_0x2ede20];return _0x1743a8;};'use strict';var Sequelize=require(_0x1d5b('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 14d035c..1710a4d 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 _0x7046=['path','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0xf5936,_0x5ddef2){var _0x124458=function(_0x1b03b){while(--_0x1b03b){_0xf5936['push'](_0xf5936['shift']());}};_0x124458(++_0x5ddef2);}(_0x7046,0x144));var _0x6704=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x7046[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var logger=require(_0x6704('0x2'))(_0x6704('0x3'));var moment=require('moment');var BPromise=require(_0x6704('0x4'));var rp=require(_0x6704('0x5'));var fs=require('fs');var path=require(_0x6704('0x6'));var rimraf=require('rimraf');var config=require(_0x6704('0x7'));var attributes=require(_0x6704('0x8'));module[_0x6704('0x9')]=function(_0x626a14,_0x2917be){return _0x626a14['define'](_0x6704('0xa'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ee1=['user_has_sms_queues','lodash','moment','bluebird','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define'];(function(_0x469a8b,_0x50fa2c){var _0x59ffbb=function(_0x6f120b){while(--_0x6f120b){_0x469a8b['push'](_0x469a8b['shift']());}};_0x59ffbb(++_0x50fa2c);}(_0x7ee1,0x8d));var _0x17ee=function(_0x2f7281,_0x3a81fc){_0x2f7281=_0x2f7281-0x0;var _0x25abf7=_0x7ee1[_0x2f7281];return _0x25abf7;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x17ee('0x1'));var BPromise=require(_0x17ee('0x2'));var rp=require(_0x17ee('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x17ee('0x4'));var config=require(_0x17ee('0x5'));var attributes=require(_0x17ee('0x6'));module[_0x17ee('0x7')]=function(_0x5c0617,_0x52b1db){return _0x5c0617[_0x17ee('0x8')]('UserSmsQueue',attributes,{'tableName':_0x17ee('0x9'),'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 38d68af..acf8aa6 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 _0x95fc=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','request\x20sent','result','catch'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x95fc,0x1e3));var _0xc95f=function(_0x392284,_0x3c44c6){_0x392284=_0x392284-0x0;var _0x1738c5=_0x95fc[_0x392284];return _0x1738c5;};'use strict';var _=require(_0xc95f('0x0'));var util=require(_0xc95f('0x1'));var moment=require('moment');var BPromise=require(_0xc95f('0x2'));var rs=require(_0xc95f('0x3'));var fs=require('fs');var Redis=require(_0xc95f('0x4'));var db=require(_0xc95f('0x5'))['db'];var utils=require(_0xc95f('0x6'));var logger=require(_0xc95f('0x7'))(_0xc95f('0x8'));var config=require(_0xc95f('0x9'));var jayson=require(_0xc95f('0xa'));var client=jayson['client'][_0xc95f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47d518,_0x52f585,_0x271ac8){return new BPromise(function(_0x28d61e,_0x5871eb){return client[_0xc95f('0xc')](_0x47d518,_0x271ac8)[_0xc95f('0xd')](function(_0x4423e7){logger[_0xc95f('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x52f585,'request\x20sent');logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x52f585,'request\x20sent',JSON[_0xc95f('0xf')](_0x4423e7));if(_0x4423e7[_0xc95f('0x10')]){if(_0x4423e7[_0xc95f('0x10')][_0xc95f('0x11')]===0x1f4){logger['error'](_0xc95f('0x12'),_0x52f585,_0x4423e7['error']['message']);return _0x5871eb(_0x4423e7[_0xc95f('0x10')]['message']);}logger[_0xc95f('0x10')](_0xc95f('0x12'),_0x52f585,_0x4423e7[_0xc95f('0x10')][_0xc95f('0x13')]);return _0x28d61e(_0x4423e7[_0xc95f('0x10')][_0xc95f('0x13')]);}else{logger[_0xc95f('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x52f585,_0xc95f('0x14'));_0x28d61e(_0x4423e7[_0xc95f('0x15')][_0xc95f('0x13')]);}})[_0xc95f('0x16')](function(_0x4f80a9){logger[_0xc95f('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x52f585,_0x4f80a9);_0x5871eb(_0x4f80a9);});});} \ No newline at end of file +var _0x3a72=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','UserSmsQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','util','moment'];(function(_0x213441,_0x323ba4){var _0x55f6a0=function(_0x4eb95e){while(--_0x4eb95e){_0x213441['push'](_0x213441['shift']());}};_0x55f6a0(++_0x323ba4);}(_0x3a72,0x91));var _0x23a7=function(_0x24734d,_0x1faa70){_0x24734d=_0x24734d-0x0;var _0x657c5a=_0x3a72[_0x24734d];return _0x657c5a;};'use strict';var _=require('lodash');var util=require(_0x23a7('0x0'));var moment=require(_0x23a7('0x1'));var BPromise=require(_0x23a7('0x2'));var rs=require(_0x23a7('0x3'));var fs=require('fs');var Redis=require(_0x23a7('0x4'));var db=require(_0x23a7('0x5'))['db'];var utils=require(_0x23a7('0x6'));var logger=require(_0x23a7('0x7'))(_0x23a7('0x8'));var config=require(_0x23a7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x23a7('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa9104e,_0x79a8fc,_0x10e567){return new BPromise(function(_0xe23891,_0x33be3e){return client[_0x23a7('0xb')](_0xa9104e,_0x10e567)['then'](function(_0x3662c5){logger[_0x23a7('0xc')](_0x23a7('0xd'),_0x79a8fc,'request\x20sent');logger[_0x23a7('0xe')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x79a8fc,_0x23a7('0xf'),JSON[_0x23a7('0x10')](_0x3662c5));if(_0x3662c5[_0x23a7('0x11')]){if(_0x3662c5[_0x23a7('0x11')]['code']===0x1f4){logger[_0x23a7('0x11')](_0x23a7('0xd'),_0x79a8fc,_0x3662c5[_0x23a7('0x11')][_0x23a7('0x12')]);return _0x33be3e(_0x3662c5['error'][_0x23a7('0x12')]);}logger[_0x23a7('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x79a8fc,_0x3662c5['error'][_0x23a7('0x12')]);return _0xe23891(_0x3662c5[_0x23a7('0x11')][_0x23a7('0x12')]);}else{logger[_0x23a7('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x79a8fc,_0x23a7('0xf'));_0xe23891(_0x3662c5[_0x23a7('0x13')][_0x23a7('0x12')]);}})[_0x23a7('0x14')](function(_0x2c4c6e){logger[_0x23a7('0x11')](_0x23a7('0xd'),_0x79a8fc,_0x2c4c6e);_0x33be3e(_0x2c4c6e);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index cdba1fd..7d0f504 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 _0xfeba=['sequelize','exports','INTEGER'];(function(_0x44b249,_0x5b4811){var _0x23b853=function(_0x3f90ef){while(--_0x3f90ef){_0x44b249['push'](_0x44b249['shift']());}};_0x23b853(++_0x5b4811);}(_0xfeba,0x174));var _0xafeb=function(_0x28a141,_0x46f7d8){_0x28a141=_0x28a141-0x0;var _0x58717d=_0xfeba[_0x28a141];return _0x58717d;};'use strict';var Sequelize=require(_0xafeb('0x0'));module[_0xafeb('0x1')]={'UserId':{'type':Sequelize[_0xafeb('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xafeb('0x2')]}}; \ No newline at end of file +var _0x4ec9=['exports','INTEGER','sequelize'];(function(_0x5d860f,_0x467498){var _0x236490=function(_0x5e045c){while(--_0x5e045c){_0x5d860f['push'](_0x5d860f['shift']());}};_0x236490(++_0x467498);}(_0x4ec9,0x98));var _0x94ec=function(_0x3a1b90,_0x3c0158){_0x3a1b90=_0x3a1b90-0x0;var _0xf6de77=_0x4ec9[_0x3a1b90];return _0xf6de77;};'use strict';var Sequelize=require(_0x94ec('0x0'));module[_0x94ec('0x1')]={'UserId':{'type':Sequelize[_0x94ec('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x94ec('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 35aa77a..6959a67 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(_0x282efd,_0x3efbb6){var _0x598ddc=function(_0x51c045){while(--_0x51c045){_0x282efd['push'](_0x282efd['shift']());}};_0x598ddc(++_0x3efbb6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x43efc8,_0x5b3af2){var _0x2cd5cc=function(_0x2c0405){while(--_0x2c0405){_0x43efc8['push'](_0x43efc8['shift']());}};_0x2cd5cc(++_0x5b3af2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 bbdfd48..266a5ab 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xab41f8,_0x2cf1ba){var _0x249cb7=function(_0x3790e6){while(--_0x3790e6){_0xab41f8['push'](_0xab41f8['shift']());}};_0x249cb7(++_0x2cf1ba);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x35fabd,_0x825452){_0x35fabd=_0x35fabd-0x0;var _0x61a8ee=_0xcb91[_0x35fabd];return _0x61a8ee;};'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(_0x3c3caf,_0x2560d8){var _0x3fb5df=function(_0x116326){while(--_0x116326){_0x3c3caf['push'](_0x3c3caf['shift']());}};_0x3fb5df(++_0x2560d8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x59616b,_0x38e534){_0x59616b=_0x59616b-0x0;var _0x5c4523=_0xcb91[_0x59616b];return _0x5c4523;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 90b1199..fbfb9a2 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 _0x8509=['INTEGER','exports'];(function(_0x231a47,_0x46a963){var _0x48d7c9=function(_0x1e69b1){while(--_0x1e69b1){_0x231a47['push'](_0x231a47['shift']());}};_0x48d7c9(++_0x46a963);}(_0x8509,0x1c1));var _0x9850=function(_0x46ec32,_0x1e842f){_0x46ec32=_0x46ec32-0x0;var _0x338f60=_0x8509[_0x46ec32];return _0x338f60;};'use strict';var Sequelize=require('sequelize');module[_0x9850('0x0')]={'penalty':{'type':Sequelize[_0x9850('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb09b=['exports'];(function(_0x764397,_0x13654c){var _0x138255=function(_0x4d75d0){while(--_0x4d75d0){_0x764397['push'](_0x764397['shift']());}};_0x138255(++_0x13654c);}(_0xb09b,0x1af));var _0xbb09=function(_0x2bcb75,_0x5789a7){_0x2bcb75=_0x2bcb75-0x0;var _0x175345=_0xb09b[_0x2bcb75];return _0x175345;};'use strict';var Sequelize=require('sequelize');module[_0xbb09('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 9a9a18e..e3125fb 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 _0x775e=['rimraf','../../config/environment','./userVoiceQueue.attributes','exports','user_has_voice_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x14018a,_0x30d5f3){var _0x7ac820=function(_0xca6be2){while(--_0xca6be2){_0x14018a['push'](_0x14018a['shift']());}};_0x7ac820(++_0x30d5f3);}(_0x775e,0x127));var _0xe775=function(_0x15e102,_0x4c839c){_0x15e102=_0x15e102-0x0;var _0xcdfb6d=_0x775e[_0x15e102];return _0xcdfb6d;};'use strict';var _=require(_0xe775('0x0'));var util=require(_0xe775('0x1'));var logger=require(_0xe775('0x2'))('api');var moment=require(_0xe775('0x3'));var BPromise=require(_0xe775('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe775('0x5'));var config=require(_0xe775('0x6'));var attributes=require(_0xe775('0x7'));module[_0xe775('0x8')]=function(_0x4b2bcf,_0x5a6e51){return _0x4b2bcf['define']('UserVoiceQueue',attributes,{'tableName':_0xe775('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6078=['user_has_voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','UserVoiceQueue'];(function(_0x5a60ce,_0x48f080){var _0x393e5e=function(_0x1c58fc){while(--_0x1c58fc){_0x5a60ce['push'](_0x5a60ce['shift']());}};_0x393e5e(++_0x48f080);}(_0x6078,0x11f));var _0x8607=function(_0x2acb7a,_0x18bbb3){_0x2acb7a=_0x2acb7a-0x0;var _0x51850e=_0x6078[_0x2acb7a];return _0x51850e;};'use strict';var _=require(_0x8607('0x0'));var util=require(_0x8607('0x1'));var logger=require(_0x8607('0x2'))(_0x8607('0x3'));var moment=require('moment');var BPromise=require(_0x8607('0x4'));var rp=require(_0x8607('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8607('0x6'));var config=require(_0x8607('0x7'));var attributes=require('./userVoiceQueue.attributes');module[_0x8607('0x8')]=function(_0x143778,_0x4eec57){return _0x143778['define'](_0x8607('0x9'),attributes,{'tableName':_0x8607('0xa'),'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 0eaf1b6..9d97328 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 _0x21ad=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring'];(function(_0x144c0c,_0x113cfe){var _0x436221=function(_0x231dd7){while(--_0x231dd7){_0x144c0c['push'](_0x144c0c['shift']());}};_0x436221(++_0x113cfe);}(_0x21ad,0x150));var _0xd21a=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x21ad[_0x409353];return _0x4f4b59;};'use strict';var _=require(_0xd21a('0x0'));var util=require(_0xd21a('0x1'));var moment=require(_0xd21a('0x2'));var BPromise=require('bluebird');var rs=require(_0xd21a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd21a('0x4'))['db'];var utils=require(_0xd21a('0x5'));var logger=require(_0xd21a('0x6'))(_0xd21a('0x7'));var config=require(_0xd21a('0x8'));var jayson=require(_0xd21a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x39f667,_0x80463a,_0x289d87){return new BPromise(function(_0x211b13,_0x32fc78){return client['request'](_0x39f667,_0x289d87)['then'](function(_0x3b5e32){logger[_0xd21a('0xa')](_0xd21a('0xb'),_0x80463a,_0xd21a('0xc'));logger['debug'](_0xd21a('0xd'),_0x80463a,_0xd21a('0xc'),JSON[_0xd21a('0xe')](_0x3b5e32));if(_0x3b5e32[_0xd21a('0xf')]){if(_0x3b5e32[_0xd21a('0xf')][_0xd21a('0x10')]===0x1f4){logger[_0xd21a('0xf')](_0xd21a('0xb'),_0x80463a,_0x3b5e32[_0xd21a('0xf')][_0xd21a('0x11')]);return _0x32fc78(_0x3b5e32['error'][_0xd21a('0x11')]);}logger[_0xd21a('0xf')](_0xd21a('0xb'),_0x80463a,_0x3b5e32['error'][_0xd21a('0x11')]);return _0x211b13(_0x3b5e32[_0xd21a('0xf')]['message']);}else{logger[_0xd21a('0xa')]('UserVoiceQueue,\x20%s,\x20%s',_0x80463a,_0xd21a('0xc'));_0x211b13(_0x3b5e32[_0xd21a('0x12')][_0xd21a('0x11')]);}})[_0xd21a('0x13')](function(_0x4c3ef5){logger[_0xd21a('0xf')](_0xd21a('0xb'),_0x80463a,_0x4c3ef5);_0x32fc78(_0x4c3ef5);});});} \ No newline at end of file +var _0x8c00=['client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x189579,_0x791321){var _0x5d55a8=function(_0x51ea37){while(--_0x51ea37){_0x189579['push'](_0x189579['shift']());}};_0x5d55a8(++_0x791321);}(_0x8c00,0x110));var _0x08c0=function(_0x48d3f8,_0x502a1b){_0x48d3f8=_0x48d3f8-0x0;var _0x3f6498=_0x8c00[_0x48d3f8];return _0x3f6498;};'use strict';var _=require('lodash');var util=require(_0x08c0('0x0'));var moment=require('moment');var BPromise=require(_0x08c0('0x1'));var rs=require(_0x08c0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x08c0('0x3'))['db'];var utils=require(_0x08c0('0x4'));var logger=require(_0x08c0('0x5'))(_0x08c0('0x6'));var config=require('../../config/environment');var jayson=require(_0x08c0('0x7'));var client=jayson[_0x08c0('0x8')][_0x08c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x389121,_0x7ee27,_0x5be9b5){return new BPromise(function(_0x56c98f,_0x5381af){return client[_0x08c0('0xa')](_0x389121,_0x5be9b5)[_0x08c0('0xb')](function(_0x5a094f){logger[_0x08c0('0xc')](_0x08c0('0xd'),_0x7ee27,_0x08c0('0xe'));logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x7ee27,'request\x20sent',JSON[_0x08c0('0xf')](_0x5a094f));if(_0x5a094f[_0x08c0('0x10')]){if(_0x5a094f[_0x08c0('0x10')]['code']===0x1f4){logger[_0x08c0('0x10')](_0x08c0('0xd'),_0x7ee27,_0x5a094f['error'][_0x08c0('0x11')]);return _0x5381af(_0x5a094f['error'][_0x08c0('0x11')]);}logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x7ee27,_0x5a094f[_0x08c0('0x10')][_0x08c0('0x11')]);return _0x56c98f(_0x5a094f[_0x08c0('0x10')][_0x08c0('0x11')]);}else{logger[_0x08c0('0xc')](_0x08c0('0xd'),_0x7ee27,_0x08c0('0xe'));_0x56c98f(_0x5a094f[_0x08c0('0x12')][_0x08c0('0x11')]);}})[_0x08c0('0x13')](function(_0x2886f3){logger[_0x08c0('0x10')](_0x08c0('0xd'),_0x7ee27,_0x2886f3);_0x5381af(_0x2886f3);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 553b562..0b9d89b 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x49fca7,_0x586050){var _0x425773=function(_0x2db904){while(--_0x2db904){_0x49fca7['push'](_0x49fca7['shift']());}};_0x425773(++_0x586050);}(_0xe706,0xa3));var _0x6e70=function(_0x49e734,_0xc04f4f){_0x49e734=_0x49e734-0x0;var _0x2a2d42=_0xe706[_0x49e734];return _0x2a2d42;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xc93161,_0x347e90){var _0x13c4f0=function(_0x5c552e){while(--_0x5c552e){_0xc93161['push'](_0xc93161['shift']());}};_0x13c4f0(++_0x347e90);}(_0x9c44,0x178));var _0x49c4=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9c44[_0x1694f5];return _0x5b4321;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 5edfc4f..874ac89 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 _0x4f29=['sequelize','exports','STRING','INTEGER','queue_interface','Required\x20by\x20Asterisk'];(function(_0x524e02,_0x2937cd){var _0x4d90aa=function(_0x3cdd03){while(--_0x3cdd03){_0x524e02['push'](_0x524e02['shift']());}};_0x4d90aa(++_0x2937cd);}(_0x4f29,0x1e0));var _0x94f2=function(_0x50e624,_0x541815){_0x50e624=_0x50e624-0x0;var _0x6f2b55=_0x4f29[_0x50e624];return _0x6f2b55;};'use strict';var Sequelize=require(_0x94f2('0x0'));module[_0x94f2('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x94f2('0x2')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x94f2('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x94f2('0x2')],'allowNull':![],'unique':_0x94f2('0x4'),'comment':_0x94f2('0x5')},'VoiceQueueId':{'type':Sequelize[_0x94f2('0x3')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x94f2('0x4'),'comment':_0x94f2('0x5')},'penalty':{'type':Sequelize[_0x94f2('0x3')](0xb),'defaultValue':0x0,'comment':_0x94f2('0x5')},'paused':{'type':Sequelize[_0x94f2('0x3')](0xb),'defaultValue':0x0,'comment':_0x94f2('0x5')}}; \ No newline at end of file +var _0xa008=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports'];(function(_0x212a37,_0xf35b2e){var _0x5d0bf9=function(_0x51850f){while(--_0x51850f){_0x212a37['push'](_0x212a37['shift']());}};_0x5d0bf9(++_0xf35b2e);}(_0xa008,0x64));var _0x8a00=function(_0x2e583f,_0x5af3d0){_0x2e583f=_0x2e583f-0x0;var _0x1370e7=_0xa008[_0x2e583f];return _0x1370e7;};'use strict';var Sequelize=require(_0x8a00('0x0'));module[_0x8a00('0x1')]={'uniqueid':{'type':Sequelize[_0x8a00('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x8a00('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x8a00('0x4')],'allowNull':![],'unique':_0x8a00('0x5'),'comment':_0x8a00('0x3')},'VoiceQueueId':{'type':Sequelize[_0x8a00('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x8a00('0x4')],'allowNull':![],'unique':_0x8a00('0x5'),'comment':_0x8a00('0x3')},'penalty':{'type':Sequelize[_0x8a00('0x2')](0xb),'defaultValue':0x0,'comment':_0x8a00('0x3')},'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 23f8799..329cae1 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 _0xcc1a=['save','update','emit','hook','exports','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0x1ce87f,_0xef0e99){var _0x1b2000=function(_0x4f30ef){while(--_0x4f30ef){_0x1ce87f['push'](_0x1ce87f['shift']());}};_0x1b2000(++_0xef0e99);}(_0xcc1a,0x105));var _0xacc1=function(_0x137da3,_0xa6277a){_0x137da3=_0x137da3-0x0;var _0x1ac46c=_0xcc1a[_0x137da3];return _0x1ac46c;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xacc1('0x0'))['db'][_0xacc1('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xacc1('0x2')](0x0);var events={'afterCreate':_0xacc1('0x3'),'afterUpdate':_0xacc1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3b7841){return function(_0x1bec80,_0x26d2e2,_0x3c8473){UserVoiceQueueRtEvents[_0xacc1('0x5')](_0x3b7841+':'+_0x1bec80['id'],_0x1bec80);UserVoiceQueueRtEvents['emit'](_0x3b7841,_0x1bec80);_0x3c8473(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xacc1('0x6')](e,emitEvent(event));}}module[_0xacc1('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xd651=['hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','remove','emit'];(function(_0x27fbe2,_0x3e5f9a){var _0x560ef2=function(_0x467140){while(--_0x467140){_0x27fbe2['push'](_0x27fbe2['shift']());}};_0x560ef2(++_0x3e5f9a);}(_0xd651,0x172));var _0x1d65=function(_0x37803f,_0x26ba8f){_0x37803f=_0x37803f-0x0;var _0x480480=_0xd651[_0x37803f];return _0x480480;};'use strict';var EventEmitter=require(_0x1d65('0x0'));var UserVoiceQueueRt=require(_0x1d65('0x1'))['db'][_0x1d65('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x1d65('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1d65('0x4')};function emitEvent(_0x49082c){return function(_0x184745,_0x70893c,_0xa61444){UserVoiceQueueRtEvents['emit'](_0x49082c+':'+_0x184745['id'],_0x184745);UserVoiceQueueRtEvents[_0x1d65('0x5')](_0x49082c,_0x184745);_0xa61444(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x1d65('0x6')](e,emitEvent(event));}}module[_0x1d65('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 7fe36f8..2b52617 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 _0x8027=['./userVoiceQueueRt.attributes','exports','user_has_voice_queues_rt','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x527f2a,_0x33c012){var _0x1a48a9=function(_0x41a503){while(--_0x41a503){_0x527f2a['push'](_0x527f2a['shift']());}};_0x1a48a9(++_0x33c012);}(_0x8027,0xfd));var _0x7802=function(_0x2d14b0,_0x362cb4){_0x2d14b0=_0x2d14b0-0x0;var _0x4395ac=_0x8027[_0x2d14b0];return _0x4395ac;};'use strict';var _=require('lodash');var util=require(_0x7802('0x0'));var logger=require('../../config/logger')(_0x7802('0x1'));var moment=require(_0x7802('0x2'));var BPromise=require('bluebird');var rp=require(_0x7802('0x3'));var fs=require('fs');var path=require(_0x7802('0x4'));var rimraf=require(_0x7802('0x5'));var config=require(_0x7802('0x6'));var attributes=require(_0x7802('0x7'));module[_0x7802('0x8')]=function(_0x39b25f,_0x344a28){return _0x39b25f['define']('UserVoiceQueueRt',attributes,{'tableName':_0x7802('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b6e=['./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','lodash','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1049f0,_0x10622b){var _0x40961b=function(_0xcd2952){while(--_0xcd2952){_0x1049f0['push'](_0x1049f0['shift']());}};_0x40961b(++_0x10622b);}(_0x9b6e,0x7d));var _0xe9b6=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x9b6e[_0x381589];return _0x2a075d;};'use strict';var _=require(_0xe9b6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe9b6('0x1'));var moment=require(_0xe9b6('0x2'));var BPromise=require(_0xe9b6('0x3'));var rp=require(_0xe9b6('0x4'));var fs=require('fs');var path=require(_0xe9b6('0x5'));var rimraf=require('rimraf');var config=require(_0xe9b6('0x6'));var attributes=require(_0xe9b6('0x7'));module[_0xe9b6('0x8')]=function(_0x7d3afc,_0xefb380){return _0x7d3afc[_0xe9b6('0x9')](_0xe9b6('0xa'),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 d6e94f3..6a94d3b 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 _0x3686=['defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','UserVoiceQueueRt,\x20%s,\x20%s','message','result','GetVoiceQueueRtPauses','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','info','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x42d0ed,_0x91a115){var _0x3f63f6=function(_0x2e961b){while(--_0x2e961b){_0x42d0ed['push'](_0x42d0ed['shift']());}};_0x3f63f6(++_0x91a115);}(_0x3686,0xb2));var _0x6368=function(_0x2921fe,_0x3cbff2){_0x2921fe=_0x2921fe-0x0;var _0x506707=_0x3686[_0x2921fe];return _0x506707;};'use strict';var _=require(_0x6368('0x0'));var util=require('util');var moment=require(_0x6368('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6368('0x2'));var db=require(_0x6368('0x3'))['db'];var utils=require(_0x6368('0x4'));var logger=require(_0x6368('0x5'))(_0x6368('0x6'));var config=require(_0x6368('0x7'));var jayson=require(_0x6368('0x8'));var client=jayson[_0x6368('0x9')][_0x6368('0xa')]({'port':0x232a});config[_0x6368('0xb')]=_[_0x6368('0xc')](config[_0x6368('0xb')],{'host':_0x6368('0xd'),'port':0x18eb});var socket=require(_0x6368('0xe'))(new Redis(config['redis']));require(_0x6368('0xf'))[_0x6368('0x10')](socket);function respondWithRpcPromise(_0x57a8f6,_0xa7715e,_0x2e96cf){return new BPromise(function(_0x235ef0,_0x47d934){return client[_0x6368('0x11')](_0x57a8f6,_0x2e96cf)[_0x6368('0x12')](function(_0x5694b2){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0xa7715e,'request\x20sent');logger[_0x6368('0x13')](_0x6368('0x14'),_0xa7715e,_0x6368('0x15'),JSON[_0x6368('0x16')](_0x5694b2));if(_0x5694b2[_0x6368('0x17')]){if(_0x5694b2['error']['code']===0x1f4){logger[_0x6368('0x17')](_0x6368('0x18'),_0xa7715e,_0x5694b2[_0x6368('0x17')][_0x6368('0x19')]);return _0x47d934(_0x5694b2['error'][_0x6368('0x19')]);}logger[_0x6368('0x17')](_0x6368('0x18'),_0xa7715e,_0x5694b2[_0x6368('0x17')][_0x6368('0x19')]);return _0x235ef0(_0x5694b2[_0x6368('0x17')][_0x6368('0x19')]);}else{logger['info'](_0x6368('0x18'),_0xa7715e,'request\x20sent');_0x235ef0(_0x5694b2[_0x6368('0x1a')][_0x6368('0x19')]);}})['catch'](function(_0x43235){logger[_0x6368('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0xa7715e,_0x43235);_0x47d934(_0x43235);});});}exports[_0x6368('0x1b')]=function(_0x1e42cc){var _0x2bcdf4=this;return new Promise(function(_0x46eb91,_0x123211){return db['UserVoiceQueueRt'][_0x6368('0x1c')]({'raw':_0x1e42cc[_0x6368('0x1d')]?_0x1e42cc[_0x6368('0x1d')][_0x6368('0x1e')]===undefined?!![]:![]:!![],'where':_0x1e42cc[_0x6368('0x1d')]?_0x1e42cc[_0x6368('0x1d')][_0x6368('0x1f')]||null:null,'attributes':[[db[_0x6368('0x20')]['fn'](_0x6368('0x21'),db[_0x6368('0x20')]['fn']('IF',db['sequelize'][_0x6368('0x22')](_0x6368('0x23')))),_0x6368('0x24')]]})['then'](function(_0x292274){logger[_0x6368('0x25')](_0x6368('0x1b'),_0x1e42cc);logger[_0x6368('0x13')](_0x6368('0x1b'),_0x1e42cc,JSON[_0x6368('0x16')](_0x292274));_0x46eb91(_0x292274);})['catch'](function(_0x2bc806){logger[_0x6368('0x17')](_0x6368('0x1b'),_0x2bc806[_0x6368('0x19')],_0x1e42cc);_0x123211(_0x2bcdf4[_0x6368('0x17')](0x1f4,_0x2bc806['message']));});});}; \ No newline at end of file +var _0xd266=['info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize','COUNT','literal','outboundQueuePauses','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then'];(function(_0x93d3c7,_0x26a78c){var _0xe283b4=function(_0x255928){while(--_0x255928){_0x93d3c7['push'](_0x93d3c7['shift']());}};_0xe283b4(++_0x26a78c);}(_0xd266,0x18f));var _0x6d26=function(_0x157c2b,_0x2e593){_0x157c2b=_0x157c2b-0x0;var _0x5df6b8=_0xd266[_0x157c2b];return _0x5df6b8;};'use strict';var _=require(_0x6d26('0x0'));var util=require(_0x6d26('0x1'));var moment=require(_0x6d26('0x2'));var BPromise=require(_0x6d26('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d26('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d26('0x5'));var logger=require(_0x6d26('0x6'))(_0x6d26('0x7'));var config=require(_0x6d26('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6d26('0x9')][_0x6d26('0xa')]({'port':0x232a});config[_0x6d26('0xb')]=_[_0x6d26('0xc')](config[_0x6d26('0xb')],{'host':_0x6d26('0xd'),'port':0x18eb});var socket=require(_0x6d26('0xe'))(new Redis(config['redis']));require(_0x6d26('0xf'))[_0x6d26('0x10')](socket);function respondWithRpcPromise(_0x2e1bd2,_0x42d74a,_0x12d808){return new BPromise(function(_0x133633,_0x1cbcb7){return client[_0x6d26('0x11')](_0x2e1bd2,_0x12d808)[_0x6d26('0x12')](function(_0x2a9ebe){logger[_0x6d26('0x13')](_0x6d26('0x14'),_0x42d74a,_0x6d26('0x15'));logger[_0x6d26('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x42d74a,'request\x20sent',JSON[_0x6d26('0x17')](_0x2a9ebe));if(_0x2a9ebe[_0x6d26('0x18')]){if(_0x2a9ebe['error'][_0x6d26('0x19')]===0x1f4){logger[_0x6d26('0x18')](_0x6d26('0x14'),_0x42d74a,_0x2a9ebe['error'][_0x6d26('0x1a')]);return _0x1cbcb7(_0x2a9ebe[_0x6d26('0x18')]['message']);}logger[_0x6d26('0x18')](_0x6d26('0x14'),_0x42d74a,_0x2a9ebe[_0x6d26('0x18')][_0x6d26('0x1a')]);return _0x133633(_0x2a9ebe[_0x6d26('0x18')][_0x6d26('0x1a')]);}else{logger[_0x6d26('0x13')](_0x6d26('0x14'),_0x42d74a,_0x6d26('0x15'));_0x133633(_0x2a9ebe[_0x6d26('0x1b')][_0x6d26('0x1a')]);}})[_0x6d26('0x1c')](function(_0x12ec61){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x42d74a,_0x12ec61);_0x1cbcb7(_0x12ec61);});});}exports[_0x6d26('0x1d')]=function(_0x34a570){var _0x11f15d=this;return new Promise(function(_0x4f3938,_0x1980d2){return db[_0x6d26('0x1e')][_0x6d26('0x1f')]({'raw':_0x34a570[_0x6d26('0x20')]?_0x34a570[_0x6d26('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x34a570[_0x6d26('0x20')]?_0x34a570[_0x6d26('0x20')][_0x6d26('0x21')]||null:null,'attributes':[[db[_0x6d26('0x22')]['fn'](_0x6d26('0x23'),db[_0x6d26('0x22')]['fn']('IF',db[_0x6d26('0x22')][_0x6d26('0x24')]('`paused`\x20=\x201,\x201,\x20null'))),_0x6d26('0x25')]]})[_0x6d26('0x12')](function(_0x550033){logger[_0x6d26('0x13')](_0x6d26('0x1d'),_0x34a570);logger[_0x6d26('0x16')](_0x6d26('0x1d'),_0x34a570,JSON[_0x6d26('0x17')](_0x550033));_0x4f3938(_0x550033);})[_0x6d26('0x1c')](function(_0x1e5f19){logger[_0x6d26('0x18')]('GetVoiceQueueRtPauses',_0x1e5f19[_0x6d26('0x1a')],_0x34a570);_0x1980d2(_0x11f15d[_0x6d26('0x18')](0x1f4,_0x1e5f19[_0x6d26('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 2c0d139..3090ad6 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 _0x539d=['length','./userVoiceQueueRt.events','remove','update','emit','removeListener'];(function(_0x499180,_0x50759c){var _0xd02366=function(_0xecdfa2){while(--_0xecdfa2){_0x499180['push'](_0x499180['shift']());}};_0xd02366(++_0x50759c);}(_0x539d,0x17b));var _0xd539=function(_0x10dc64,_0x11bb29){_0x10dc64=_0x10dc64-0x0;var _0x9cf98d=_0x539d[_0x10dc64];return _0x9cf98d;};'use strict';var UserVoiceQueueRtEvents=require(_0xd539('0x0'));var events=['save',_0xd539('0x1'),_0xd539('0x2')];function createListener(_0x4f0303,_0x58f7bd){return function(_0x62877f){_0x58f7bd[_0xd539('0x3')](_0x4f0303,_0x62877f);};}function removeListener(_0xe8e6e4,_0x19ae25){return function(){UserVoiceQueueRtEvents[_0xd539('0x4')](_0xe8e6e4,_0x19ae25);};}exports['register']=function(_0x341dd4){for(var _0x158719=0x0,_0x27f14e=events[_0xd539('0x5')];_0x158719<_0x27f14e;_0x158719++){var _0x8d4eb5=events[_0x158719];var _0x3cb142=createListener('userVoiceQueueRt:'+_0x8d4eb5,_0x341dd4);UserVoiceQueueRtEvents['on'](_0x8d4eb5,_0x3cb142);}}; \ No newline at end of file +var _0x102b=['length','userVoiceQueueRt:','save','update','emit','removeListener'];(function(_0x25c8a8,_0x47e7ea){var _0x404c1b=function(_0x1abad3){while(--_0x1abad3){_0x25c8a8['push'](_0x25c8a8['shift']());}};_0x404c1b(++_0x47e7ea);}(_0x102b,0x1be));var _0xb102=function(_0xb82164,_0x2d6ebb){_0xb82164=_0xb82164-0x0;var _0x1a68de=_0x102b[_0xb82164];return _0x1a68de;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xb102('0x0'),'remove',_0xb102('0x1')];function createListener(_0x3e1311,_0x42172c){return function(_0x1be904){_0x42172c[_0xb102('0x2')](_0x3e1311,_0x1be904);};}function removeListener(_0x1402fb,_0x19e35d){return function(){UserVoiceQueueRtEvents[_0xb102('0x3')](_0x1402fb,_0x19e35d);};}exports['register']=function(_0x3325b7){for(var _0x370baa=0x0,_0xd131eb=events[_0xb102('0x4')];_0x370baa<_0xd131eb;_0x370baa++){var _0x1ee0c0=events[_0x370baa];var _0x5879bb=createListener(_0xb102('0x5')+_0x1ee0c0,_0x3325b7);UserVoiceQueueRtEvents['on'](_0x1ee0c0,_0x5879bb);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index e81cf2d..8e1bf39 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(_0x517456,_0x18c8d2){var _0x239445=function(_0x1f8d73){while(--_0x1f8d73){_0x517456['push'](_0x517456['shift']());}};_0x239445(++_0x18c8d2);}(_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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x95a8a0,_0x16f119){var _0x36a8fd=function(_0x49588a){while(--_0x49588a){_0x95a8a0['push'](_0x95a8a0['shift']());}};_0x36a8fd(++_0x16f119);}(_0xe706,0xa3));var _0x6e70=function(_0x12fec1,_0x20be9c){_0x12fec1=_0x12fec1-0x0;var _0x26c3af=_0xe706[_0x12fec1];return _0x26c3af;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 970b07a..6447f07 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 _0xb1c1=['exports','INTEGER','sequelize'];(function(_0xe95af,_0x4b849b){var _0x16effb=function(_0x454cd0){while(--_0x454cd0){_0xe95af['push'](_0xe95af['shift']());}};_0x16effb(++_0x4b849b);}(_0xb1c1,0x1c4));var _0x1b1c=function(_0x397bfb,_0x589665){_0x397bfb=_0x397bfb-0x0;var _0x16c9b9=_0xb1c1[_0x397bfb];return _0x16c9b9;};'use strict';var Sequelize=require(_0x1b1c('0x0'));module[_0x1b1c('0x1')]={'penalty':{'type':Sequelize[_0x1b1c('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3efe=['INTEGER','sequelize','exports'];(function(_0x62396d,_0x1ad1ba){var _0x49db3e=function(_0x4ef041){while(--_0x4ef041){_0x62396d['push'](_0x62396d['shift']());}};_0x49db3e(++_0x1ad1ba);}(_0x3efe,0x136));var _0xe3ef=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x3efe[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0xe3ef('0x0'));module[_0xe3ef('0x1')]={'penalty':{'type':Sequelize[_0xe3ef('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 003a53d..6fb307a 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 _0x3d67=['../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','api','moment','bluebird','rimraf'];(function(_0x3312ca,_0xb487b6){var _0x16532a=function(_0x10831d){while(--_0x10831d){_0x3312ca['push'](_0x3312ca['shift']());}};_0x16532a(++_0xb487b6);}(_0x3d67,0x1d4));var _0x73d6=function(_0x16ab58,_0x591ef3){_0x16ab58=_0x16ab58-0x0;var _0x33f05f=_0x3d67[_0x16ab58];return _0x33f05f;};'use strict';var _=require(_0x73d6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x73d6('0x1'));var moment=require(_0x73d6('0x2'));var BPromise=require(_0x73d6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x73d6('0x4'));var config=require(_0x73d6('0x5'));var attributes=require(_0x73d6('0x6'));module[_0x73d6('0x7')]=function(_0xa5fe4d,_0x39a856){return _0xa5fe4d[_0x73d6('0x8')](_0x73d6('0x9'),attributes,{'tableName':_0x73d6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe215=['api','moment','bluebird','request-promise','path','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','lodash','util','../../config/logger'];(function(_0x14415e,_0x4daea0){var _0x1c7933=function(_0x53c68e){while(--_0x53c68e){_0x14415e['push'](_0x14415e['shift']());}};_0x1c7933(++_0x4daea0);}(_0xe215,0x1de));var _0x5e21=function(_0x5d01ec,_0x17d179){_0x5d01ec=_0x5d01ec-0x0;var _0x10112e=_0xe215[_0x5d01ec];return _0x10112e;};'use strict';var _=require(_0x5e21('0x0'));var util=require(_0x5e21('0x1'));var logger=require(_0x5e21('0x2'))(_0x5e21('0x3'));var moment=require(_0x5e21('0x4'));var BPromise=require(_0x5e21('0x5'));var rp=require(_0x5e21('0x6'));var fs=require('fs');var path=require(_0x5e21('0x7'));var rimraf=require('rimraf');var config=require(_0x5e21('0x8'));var attributes=require(_0x5e21('0x9'));module[_0x5e21('0xa')]=function(_0x82e68f,_0x3e86f9){return _0x82e68f[_0x5e21('0xb')](_0x5e21('0xc'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 5d6a24c..079e9b3 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 _0x867d=['http','request','UserWhatsappQueue,\x20%s,\x20%s','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x5b22b4,_0x156560){var _0x13c83a=function(_0x311dd1){while(--_0x311dd1){_0x5b22b4['push'](_0x5b22b4['shift']());}};_0x13c83a(++_0x156560);}(_0x867d,0x1b0));var _0xd867=function(_0x280194,_0x15d56b){_0x280194=_0x280194-0x0;var _0x183fc3=_0x867d[_0x280194];return _0x183fc3;};'use strict';var _=require(_0xd867('0x0'));var util=require(_0xd867('0x1'));var moment=require('moment');var BPromise=require(_0xd867('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd867('0x3'))['db'];var utils=require(_0xd867('0x4'));var logger=require('../../config/logger')(_0xd867('0x5'));var config=require(_0xd867('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd867('0x7')][_0xd867('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x287db1,_0x19d490,_0x1048bd){return new BPromise(function(_0x384ad8,_0x155276){return client[_0xd867('0x9')](_0x287db1,_0x1048bd)['then'](function(_0x3e29d8){logger['info'](_0xd867('0xa'),_0x19d490,'request\x20sent');logger['debug'](_0xd867('0xb'),_0x19d490,_0xd867('0xc'),JSON[_0xd867('0xd')](_0x3e29d8));if(_0x3e29d8[_0xd867('0xe')]){if(_0x3e29d8[_0xd867('0xe')][_0xd867('0xf')]===0x1f4){logger[_0xd867('0xe')](_0xd867('0xa'),_0x19d490,_0x3e29d8[_0xd867('0xe')]['message']);return _0x155276(_0x3e29d8[_0xd867('0xe')][_0xd867('0x10')]);}logger['error'](_0xd867('0xa'),_0x19d490,_0x3e29d8[_0xd867('0xe')][_0xd867('0x10')]);return _0x384ad8(_0x3e29d8[_0xd867('0xe')][_0xd867('0x10')]);}else{logger[_0xd867('0x11')](_0xd867('0xa'),_0x19d490,_0xd867('0xc'));_0x384ad8(_0x3e29d8[_0xd867('0x12')][_0xd867('0x10')]);}})[_0xd867('0x13')](function(_0x3428c0){logger['error'](_0xd867('0xa'),_0x19d490,_0x3428c0);_0x155276(_0x3428c0);});});} \ No newline at end of file +var _0x0afb=['request\x20sent','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s'];(function(_0xc758e3,_0x290d9f){var _0x1190ea=function(_0x43365d){while(--_0x43365d){_0xc758e3['push'](_0xc758e3['shift']());}};_0x1190ea(++_0x290d9f);}(_0x0afb,0x1d4));var _0xb0af=function(_0x491bd2,_0x55f078){_0x491bd2=_0x491bd2-0x0;var _0x5f1d55=_0x0afb[_0x491bd2];return _0x5f1d55;};'use strict';var _=require(_0xb0af('0x0'));var util=require('util');var moment=require(_0xb0af('0x1'));var BPromise=require(_0xb0af('0x2'));var rs=require(_0xb0af('0x3'));var fs=require('fs');var Redis=require(_0xb0af('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb0af('0x5'))(_0xb0af('0x6'));var config=require(_0xb0af('0x7'));var jayson=require(_0xb0af('0x8'));var client=jayson['client'][_0xb0af('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23b5bf,_0x1c7007,_0x5beb8d){return new BPromise(function(_0x398094,_0x451c6b){return client[_0xb0af('0xa')](_0x23b5bf,_0x5beb8d)[_0xb0af('0xb')](function(_0x282331){logger[_0xb0af('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x1c7007,'request\x20sent');logger[_0xb0af('0xd')](_0xb0af('0xe'),_0x1c7007,_0xb0af('0xf'),JSON[_0xb0af('0x10')](_0x282331));if(_0x282331[_0xb0af('0x11')]){if(_0x282331['error'][_0xb0af('0x12')]===0x1f4){logger[_0xb0af('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x1c7007,_0x282331['error']['message']);return _0x451c6b(_0x282331[_0xb0af('0x11')]['message']);}logger[_0xb0af('0x11')](_0xb0af('0x13'),_0x1c7007,_0x282331['error']['message']);return _0x398094(_0x282331[_0xb0af('0x11')][_0xb0af('0x14')]);}else{logger[_0xb0af('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x1c7007,_0xb0af('0xf'));_0x398094(_0x282331[_0xb0af('0x15')]['message']);}})[_0xb0af('0x16')](function(_0x2d1761){logger['error'](_0xb0af('0x13'),_0x1c7007,_0x2d1761);_0x451c6b(_0x2d1761);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 3196d95..4e8af0e 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 _0xd6ce=['index','show','create','put','/:id','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./variable.controller','get','isAuthenticated'];(function(_0x1499c4,_0x53273c){var _0x19dc30=function(_0x494a92){while(--_0x494a92){_0x1499c4['push'](_0x1499c4['shift']());}};_0x19dc30(++_0x53273c);}(_0xd6ce,0x127));var _0xed6c=function(_0x4f2e1c,_0x4c9b5b){_0x4f2e1c=_0x4f2e1c-0x0;var _0x26a47f=_0xd6ce[_0x4f2e1c];return _0x26a47f;};'use strict';var multer=require(_0xed6c('0x0'));var util=require(_0xed6c('0x1'));var path=require(_0xed6c('0x2'));var timeout=require(_0xed6c('0x3'));var express=require(_0xed6c('0x4'));var router=express[_0xed6c('0x5')]();var fs_extra=require(_0xed6c('0x6'));var auth=require(_0xed6c('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xed6c('0x8'));router[_0xed6c('0x9')]('/',auth[_0xed6c('0xa')](),controller[_0xed6c('0xb')]);router['get']('/:id',auth[_0xed6c('0xa')](),controller[_0xed6c('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xed6c('0xd')]);router[_0xed6c('0xe')](_0xed6c('0xf'),auth[_0xed6c('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xed6c('0x10')]);module['exports']=router; \ No newline at end of file +var _0x61a1=['fs-extra','../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0xc5e294,_0x8a5012){var _0x4a86f0=function(_0x39be23){while(--_0x39be23){_0xc5e294['push'](_0xc5e294['shift']());}};_0x4a86f0(++_0x8a5012);}(_0x61a1,0x127));var _0x161a=function(_0xed5f9c,_0x5a25cd){_0xed5f9c=_0xed5f9c-0x0;var _0x3a1c43=_0x61a1[_0xed5f9c];return _0x3a1c43;};'use strict';var multer=require(_0x161a('0x0'));var util=require(_0x161a('0x1'));var path=require(_0x161a('0x2'));var timeout=require(_0x161a('0x3'));var express=require(_0x161a('0x4'));var router=express['Router']();var fs_extra=require(_0x161a('0x5'));var auth=require(_0x161a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x161a('0x7'));var controller=require(_0x161a('0x8'));router[_0x161a('0x9')]('/',auth[_0x161a('0xa')](),controller[_0x161a('0xb')]);router[_0x161a('0x9')](_0x161a('0xc'),auth[_0x161a('0xa')](),controller[_0x161a('0xd')]);router[_0x161a('0xe')]('/',auth[_0x161a('0xa')](),controller[_0x161a('0xf')]);router[_0x161a('0x10')](_0x161a('0xc'),auth[_0x161a('0xa')](),controller[_0x161a('0x11')]);router[_0x161a('0x12')](_0x161a('0xc'),auth[_0x161a('0xa')](),controller[_0x161a('0x13')]);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 d29649d..db9d036 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 _0x5a9a=['STRING','exports'];(function(_0x27c31d,_0x2f34e3){var _0x4709aa=function(_0x5197ae){while(--_0x5197ae){_0x27c31d['push'](_0x27c31d['shift']());}};_0x4709aa(++_0x2f34e3);}(_0x5a9a,0x85));var _0xa5a9=function(_0x19139a,_0x2dc2df){_0x19139a=_0x19139a-0x0;var _0x10cca3=_0x5a9a[_0x19139a];return _0x10cca3;};'use strict';var Sequelize=require('sequelize');module[_0xa5a9('0x0')]={'name':{'type':Sequelize[_0xa5a9('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa5a9('0x1')]}}; \ No newline at end of file +var _0xffc1=['name','sequelize','STRING'];(function(_0x3bbe5b,_0xfb4c3e){var _0x1f529d=function(_0x2cfe4a){while(--_0x2cfe4a){_0x3bbe5b['push'](_0x3bbe5b['shift']());}};_0x1f529d(++_0xfb4c3e);}(_0xffc1,0x1b4));var _0x1ffc=function(_0x2947f3,_0x1fabe9){_0x2947f3=_0x2947f3-0x0;var _0x19bf35=_0xffc1[_0x2947f3];return _0x19bf35;};'use strict';var Sequelize=require(_0x1ffc('0x0'));module['exports']={'name':{'type':Sequelize[_0x1ffc('0x1')],'unique':_0x1ffc('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1ffc('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index c6cf122..7156fbf 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 _0xeaa3=['userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','Variable','includeAll','include','findAll','catch','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','UserProfileSection'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xeaa3,0x103));var _0x3eaa=function(_0x373ad1,_0xb11e66){_0x373ad1=_0x373ad1-0x0;var _0x30fbe3=_0xeaa3[_0x373ad1];return _0x30fbe3;};'use strict';var emlformat=require(_0x3eaa('0x0'));var rimraf=require(_0x3eaa('0x1'));var zipdir=require(_0x3eaa('0x2'));var jsonpatch=require(_0x3eaa('0x3'));var rp=require(_0x3eaa('0x4'));var moment=require('moment');var BPromise=require(_0x3eaa('0x5'));var Mustache=require(_0x3eaa('0x6'));var util=require(_0x3eaa('0x7'));var path=require(_0x3eaa('0x8'));var sox=require('sox');var csv=require(_0x3eaa('0x9'));var ejs=require(_0x3eaa('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3eaa('0xb'));var squel=require(_0x3eaa('0xc'));var crypto=require(_0x3eaa('0xd'));var jsforce=require(_0x3eaa('0xe'));var deskjs=require(_0x3eaa('0xf'));var toCsv=require(_0x3eaa('0x9'));var querystring=require(_0x3eaa('0x10'));var Papa=require(_0x3eaa('0x11'));var Redis=require(_0x3eaa('0x12'));var authService=require(_0x3eaa('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3eaa('0x14'));var hardwareService=require(_0x3eaa('0x15'));var logger=require(_0x3eaa('0x16'))(_0x3eaa('0x17'));var utils=require(_0x3eaa('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3eaa('0x19'))['db'];function respondWithStatusCode(_0x101660,_0x5eb7bc){_0x5eb7bc=_0x5eb7bc||0xcc;return function(_0x38f130){if(_0x38f130){return _0x101660[_0x3eaa('0x1a')](_0x5eb7bc);}return _0x101660[_0x3eaa('0x1b')](_0x5eb7bc)[_0x3eaa('0x1c')]();};}function respondWithResult(_0x7821d,_0x280b68){_0x280b68=_0x280b68||0xc8;return function(_0x507dc0){if(_0x507dc0){return _0x7821d[_0x3eaa('0x1b')](_0x280b68)[_0x3eaa('0x1d')](_0x507dc0);}};}function respondWithFilteredResult(_0xfaa47d,_0x201c39){return function(_0x7a8135){if(_0x7a8135){var _0x59003f=typeof _0x201c39[_0x3eaa('0x1e')]==='undefined'&&typeof _0x201c39['limit']===_0x3eaa('0x1f');var _0x4a3d11=_0x7a8135[_0x3eaa('0x20')];var _0x3f382e=_0x59003f?0x0:_0x201c39[_0x3eaa('0x1e')];var _0x5c4c6b=_0x59003f?_0x7a8135[_0x3eaa('0x20')]:_0x201c39[_0x3eaa('0x1e')]+_0x201c39[_0x3eaa('0x21')];var _0x1ff92c;if(_0x5c4c6b>=_0x4a3d11){_0x5c4c6b=_0x4a3d11;_0x1ff92c=0xc8;}else{_0x1ff92c=0xce;}_0xfaa47d[_0x3eaa('0x1b')](_0x1ff92c);return _0xfaa47d['set'](_0x3eaa('0x22'),_0x3f382e+'-'+_0x5c4c6b+'/'+_0x4a3d11)[_0x3eaa('0x1d')](_0x7a8135);}return null;};}function patchUpdates(_0x1543d4){return function(_0x2a7c89){try{jsonpatch[_0x3eaa('0x23')](_0x2a7c89,_0x1543d4,!![]);}catch(_0x3306f1){return BPromise[_0x3eaa('0x24')](_0x3306f1);}return _0x2a7c89['save']();};}function saveUpdates(_0x1470f9,_0xae0ac7){return function(_0x202300){if(_0x202300){return _0x202300[_0x3eaa('0x25')](_0x1470f9)[_0x3eaa('0x26')](function(_0x2c281d){return _0x2c281d;});}return null;};}function removeEntity(_0x45ceb1,_0x3324fc){return function(_0x3bb596){if(_0x3bb596){return _0x3bb596[_0x3eaa('0x27')]()['then'](function(){var _0x347b66=_0x3bb596['get']({'plain':!![]});var _0x27db1b='Variables';return db['UserProfileResource'][_0x3eaa('0x27')]({'where':{'type':_0x27db1b,'resourceId':_0x347b66['id']}})[_0x3eaa('0x26')](function(){return _0x3bb596;});})[_0x3eaa('0x26')](function(){_0x45ceb1[_0x3eaa('0x1b')](0xcc)[_0x3eaa('0x1c')]();});}};}function handleEntityNotFound(_0x25b8e0,_0x2c9fd1){return function(_0x2973c1){if(!_0x2973c1){_0x25b8e0[_0x3eaa('0x1a')](0x194);}return _0x2973c1;};}function handleError(_0x4f8435,_0x3fb3af){_0x3fb3af=_0x3fb3af||0x1f4;return function(_0x509473){logger[_0x3eaa('0x28')](_0x509473[_0x3eaa('0x29')]);if(_0x509473[_0x3eaa('0x2a')]){delete _0x509473[_0x3eaa('0x2a')];}_0x4f8435[_0x3eaa('0x1b')](_0x3fb3af)[_0x3eaa('0x2b')](_0x509473);};}exports['index']=function(_0x4407a0,_0x152ccc){var _0x5f2aa6={},_0x3fe2fc={},_0x286084={'count':0x0,'rows':[]};var _0x183555=_['map'](db['Variable'][_0x3eaa('0x2c')],function(_0x2d3f17){return{'name':_0x2d3f17['fieldName'],'type':_0x2d3f17[_0x3eaa('0x2d')][_0x3eaa('0x2e')]};});_0x3fe2fc[_0x3eaa('0x2f')]=_[_0x3eaa('0x30')](_0x183555,_0x3eaa('0x2a'));_0x3fe2fc[_0x3eaa('0x31')]=_[_0x3eaa('0x32')](_0x4407a0[_0x3eaa('0x31')]);_0x3fe2fc[_0x3eaa('0x33')]=_[_0x3eaa('0x34')](_0x3fe2fc[_0x3eaa('0x2f')],_0x3fe2fc[_0x3eaa('0x31')]);_0x5f2aa6[_0x3eaa('0x35')]=_[_0x3eaa('0x34')](_0x3fe2fc[_0x3eaa('0x2f')],qs[_0x3eaa('0x36')](_0x4407a0[_0x3eaa('0x31')][_0x3eaa('0x36')]));_0x5f2aa6['attributes']=_0x5f2aa6[_0x3eaa('0x35')][_0x3eaa('0x37')]?_0x5f2aa6[_0x3eaa('0x35')]:_0x3fe2fc['model'];if(!_0x4407a0['query'][_0x3eaa('0x38')](_0x3eaa('0x39'))){_0x5f2aa6[_0x3eaa('0x21')]=qs['limit'](_0x4407a0[_0x3eaa('0x31')]['limit']);_0x5f2aa6[_0x3eaa('0x1e')]=qs[_0x3eaa('0x1e')](_0x4407a0['query']['offset']);}_0x5f2aa6[_0x3eaa('0x3a')]=qs['sort'](_0x4407a0[_0x3eaa('0x31')][_0x3eaa('0x3b')]);_0x5f2aa6['where']=qs[_0x3eaa('0x33')](_[_0x3eaa('0x3c')](_0x4407a0[_0x3eaa('0x31')],_0x3fe2fc['filters']),_0x183555);if(_0x4407a0[_0x3eaa('0x31')][_0x3eaa('0x3d')]){_0x5f2aa6['where']=_[_0x3eaa('0x3e')](_0x5f2aa6[_0x3eaa('0x3f')],{'$or':_[_0x3eaa('0x30')](_0x183555,function(_0x553fcc){if(_0x553fcc[_0x3eaa('0x2d')]!==_0x3eaa('0x40')){var _0x2d61e5={};_0x2d61e5[_0x553fcc['name']]={'$like':'%'+_0x4407a0['query']['filter']+'%'};return _0x2d61e5;}})});}_0x5f2aa6=_[_0x3eaa('0x3e')]({},_0x5f2aa6,_0x4407a0[_0x3eaa('0x41')]);var _0x11c6aa={'where':_0x5f2aa6[_0x3eaa('0x3f')]};return db[_0x3eaa('0x42')][_0x3eaa('0x20')](_0x11c6aa)[_0x3eaa('0x26')](function(_0x45d153){_0x286084[_0x3eaa('0x20')]=_0x45d153;if(_0x4407a0['query'][_0x3eaa('0x43')]){_0x5f2aa6[_0x3eaa('0x44')]=[{'all':!![]}];}return db['Variable'][_0x3eaa('0x45')](_0x5f2aa6);})['then'](function(_0x24cd0e){_0x286084['rows']=_0x24cd0e;return _0x286084;})[_0x3eaa('0x26')](respondWithFilteredResult(_0x152ccc,_0x5f2aa6))[_0x3eaa('0x46')](handleError(_0x152ccc,null));};exports[_0x3eaa('0x47')]=function(_0x1ec4dc,_0x58e386){var _0x1bbbb5={'raw':!![],'where':{'id':_0x1ec4dc['params']['id']}},_0x504596={};_0x504596[_0x3eaa('0x2f')]=_[_0x3eaa('0x32')](db[_0x3eaa('0x42')][_0x3eaa('0x2c')]);_0x504596[_0x3eaa('0x31')]=_[_0x3eaa('0x32')](_0x1ec4dc['query']);_0x504596[_0x3eaa('0x33')]=_['intersection'](_0x504596[_0x3eaa('0x2f')],_0x504596[_0x3eaa('0x31')]);_0x1bbbb5[_0x3eaa('0x35')]=_[_0x3eaa('0x34')](_0x504596['model'],qs[_0x3eaa('0x36')](_0x1ec4dc['query'][_0x3eaa('0x36')]));_0x1bbbb5[_0x3eaa('0x35')]=_0x1bbbb5[_0x3eaa('0x35')][_0x3eaa('0x37')]?_0x1bbbb5[_0x3eaa('0x35')]:_0x504596['model'];if(_0x1ec4dc[_0x3eaa('0x31')][_0x3eaa('0x43')]){_0x1bbbb5['include']=[{'all':!![]}];}_0x1bbbb5=_['merge']({},_0x1bbbb5,_0x1ec4dc[_0x3eaa('0x41')]);return db[_0x3eaa('0x42')][_0x3eaa('0x48')](_0x1bbbb5)[_0x3eaa('0x26')](handleEntityNotFound(_0x58e386,null))[_0x3eaa('0x26')](respondWithResult(_0x58e386,null))[_0x3eaa('0x46')](handleError(_0x58e386,null));};exports[_0x3eaa('0x49')]=function(_0x349a5b,_0x5460e7){return db['Variable'][_0x3eaa('0x49')](_0x349a5b[_0x3eaa('0x4a')],{})[_0x3eaa('0x26')](function(_0x3e4183){var _0x1298a3=_0x349a5b[_0x3eaa('0x4b')][_0x3eaa('0x4c')]({'plain':!![]});if(!_0x1298a3)throw new Error(_0x3eaa('0x4d'));if(_0x1298a3[_0x3eaa('0x4e')]===_0x3eaa('0x4b')){var _0x8ba8a9=_0x3e4183['get']({'plain':!![]});var _0x1f9987=_0x3eaa('0x4f');return db[_0x3eaa('0x50')][_0x3eaa('0x48')]({'where':{'name':_0x1f9987,'userProfileId':_0x1298a3[_0x3eaa('0x51')]},'raw':!![]})[_0x3eaa('0x26')](function(_0x4ffba0){if(_0x4ffba0&&_0x4ffba0['autoAssociation']===0x0){return db[_0x3eaa('0x52')]['create']({'name':_0x8ba8a9[_0x3eaa('0x2a')],'resourceId':_0x8ba8a9['id'],'type':_0x4ffba0[_0x3eaa('0x2a')],'sectionId':_0x4ffba0['id']},{})['then'](function(){return _0x3e4183;});}else{return _0x3e4183;}})['catch'](function(_0x46d333){logger[_0x3eaa('0x28')](_0x3eaa('0x53'),_0x46d333);throw _0x46d333;});}return _0x3e4183;})[_0x3eaa('0x26')](respondWithResult(_0x5460e7,0xc9))[_0x3eaa('0x46')](handleError(_0x5460e7,null));};exports[_0x3eaa('0x25')]=function(_0x20d148,_0x1a468a){if(_0x20d148[_0x3eaa('0x4a')]['id']){delete _0x20d148[_0x3eaa('0x4a')]['id'];}return db[_0x3eaa('0x42')][_0x3eaa('0x48')]({'where':{'id':_0x20d148[_0x3eaa('0x54')]['id']}})['then'](handleEntityNotFound(_0x1a468a,null))[_0x3eaa('0x26')](saveUpdates(_0x20d148[_0x3eaa('0x4a')],null))['then'](respondWithResult(_0x1a468a,null))['catch'](handleError(_0x1a468a,null));};exports[_0x3eaa('0x27')]=function(_0x102643,_0x19efed){return db[_0x3eaa('0x42')][_0x3eaa('0x48')]({'where':{'id':_0x102643[_0x3eaa('0x54')]['id']}})[_0x3eaa('0x26')](handleEntityNotFound(_0x19efed,null))[_0x3eaa('0x26')](removeEntity(_0x19efed,null))['catch'](handleError(_0x19efed,null));}; \ No newline at end of file +var _0x2e45=['path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','get','Variables','UserProfileResource','stack','name','send','index','Variable','rawAttributes','fieldName','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x51be8b,_0x5670b5){var _0x4d5518=function(_0x1e0612){while(--_0x1e0612){_0x51be8b['push'](_0x51be8b['shift']());}};_0x4d5518(++_0x5670b5);}(_0x2e45,0x149));var _0x52e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2e45[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x52e4('0x0'));var rimraf=require(_0x52e4('0x1'));var zipdir=require(_0x52e4('0x2'));var jsonpatch=require(_0x52e4('0x3'));var rp=require(_0x52e4('0x4'));var moment=require('moment');var BPromise=require(_0x52e4('0x5'));var Mustache=require(_0x52e4('0x6'));var util=require('util');var path=require(_0x52e4('0x7'));var sox=require(_0x52e4('0x8'));var csv=require(_0x52e4('0x9'));var ejs=require(_0x52e4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x52e4('0xb'));var crypto=require(_0x52e4('0xc'));var jsforce=require(_0x52e4('0xd'));var deskjs=require(_0x52e4('0xe'));var toCsv=require(_0x52e4('0x9'));var querystring=require(_0x52e4('0xf'));var Papa=require(_0x52e4('0x10'));var Redis=require(_0x52e4('0x11'));var authService=require(_0x52e4('0x12'));var qs=require(_0x52e4('0x13'));var as=require(_0x52e4('0x14'));var hardwareService=require(_0x52e4('0x15'));var logger=require(_0x52e4('0x16'))(_0x52e4('0x17'));var utils=require('../../config/utils');var config=require(_0x52e4('0x18'));var licenseUtil=require(_0x52e4('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x305b42,_0x2b1908){_0x2b1908=_0x2b1908||0xcc;return function(_0x2f4c28){if(_0x2f4c28){return _0x305b42[_0x52e4('0x1a')](_0x2b1908);}return _0x305b42[_0x52e4('0x1b')](_0x2b1908)[_0x52e4('0x1c')]();};}function respondWithResult(_0x4e3da8,_0x3bf2ef){_0x3bf2ef=_0x3bf2ef||0xc8;return function(_0x45deae){if(_0x45deae){return _0x4e3da8['status'](_0x3bf2ef)[_0x52e4('0x1d')](_0x45deae);}};}function respondWithFilteredResult(_0x511a7,_0x27ce08){return function(_0x5e1aac){if(_0x5e1aac){var _0x1b034c=typeof _0x27ce08[_0x52e4('0x1e')]===_0x52e4('0x1f')&&typeof _0x27ce08['limit']==='undefined';var _0x5e58e8=_0x5e1aac['count'];var _0xe1232d=_0x1b034c?0x0:_0x27ce08[_0x52e4('0x1e')];var _0x17622e=_0x1b034c?_0x5e1aac[_0x52e4('0x20')]:_0x27ce08[_0x52e4('0x1e')]+_0x27ce08[_0x52e4('0x21')];var _0x47628b;if(_0x17622e>=_0x5e58e8){_0x17622e=_0x5e58e8;_0x47628b=0xc8;}else{_0x47628b=0xce;}_0x511a7['status'](_0x47628b);return _0x511a7['set'](_0x52e4('0x22'),_0xe1232d+'-'+_0x17622e+'/'+_0x5e58e8)[_0x52e4('0x1d')](_0x5e1aac);}return null;};}function patchUpdates(_0x2ec84d){return function(_0x14b6ad){try{jsonpatch[_0x52e4('0x23')](_0x14b6ad,_0x2ec84d,!![]);}catch(_0x51fc5d){return BPromise[_0x52e4('0x24')](_0x51fc5d);}return _0x14b6ad[_0x52e4('0x25')]();};}function saveUpdates(_0x3c454a,_0x353570){return function(_0x52af28){if(_0x52af28){return _0x52af28[_0x52e4('0x26')](_0x3c454a)['then'](function(_0xf8a13a){return _0xf8a13a;});}return null;};}function removeEntity(_0x3e6dda,_0x2c2139){return function(_0x2f8515){if(_0x2f8515){return _0x2f8515[_0x52e4('0x27')]()[_0x52e4('0x28')](function(){var _0x4cf0c0=_0x2f8515[_0x52e4('0x29')]({'plain':!![]});var _0x5f3c6a=_0x52e4('0x2a');return db[_0x52e4('0x2b')]['destroy']({'where':{'type':_0x5f3c6a,'resourceId':_0x4cf0c0['id']}})[_0x52e4('0x28')](function(){return _0x2f8515;});})['then'](function(){_0x3e6dda[_0x52e4('0x1b')](0xcc)[_0x52e4('0x1c')]();});}};}function handleEntityNotFound(_0x20fbb2,_0x4f50c0){return function(_0x60be5){if(!_0x60be5){_0x20fbb2[_0x52e4('0x1a')](0x194);}return _0x60be5;};}function handleError(_0x3c14c6,_0x26686c){_0x26686c=_0x26686c||0x1f4;return function(_0x1090ca){logger['error'](_0x1090ca[_0x52e4('0x2c')]);if(_0x1090ca['name']){delete _0x1090ca[_0x52e4('0x2d')];}_0x3c14c6['status'](_0x26686c)[_0x52e4('0x2e')](_0x1090ca);};}exports[_0x52e4('0x2f')]=function(_0x4a18de,_0x50c579){var _0x3daf82={},_0x49df2a={},_0x2faddc={'count':0x0,'rows':[]};var _0x47cf92=_['map'](db[_0x52e4('0x30')][_0x52e4('0x31')],function(_0x447b3a){return{'name':_0x447b3a[_0x52e4('0x32')],'type':_0x447b3a['type']['key']};});_0x49df2a[_0x52e4('0x33')]=_[_0x52e4('0x34')](_0x47cf92,_0x52e4('0x2d'));_0x49df2a[_0x52e4('0x35')]=_[_0x52e4('0x36')](_0x4a18de[_0x52e4('0x35')]);_0x49df2a['filters']=_[_0x52e4('0x37')](_0x49df2a['model'],_0x49df2a[_0x52e4('0x35')]);_0x3daf82[_0x52e4('0x38')]=_[_0x52e4('0x37')](_0x49df2a[_0x52e4('0x33')],qs[_0x52e4('0x39')](_0x4a18de[_0x52e4('0x35')][_0x52e4('0x39')]));_0x3daf82[_0x52e4('0x38')]=_0x3daf82[_0x52e4('0x38')][_0x52e4('0x3a')]?_0x3daf82['attributes']:_0x49df2a[_0x52e4('0x33')];if(!_0x4a18de[_0x52e4('0x35')][_0x52e4('0x3b')](_0x52e4('0x3c'))){_0x3daf82['limit']=qs[_0x52e4('0x21')](_0x4a18de['query'][_0x52e4('0x21')]);_0x3daf82['offset']=qs[_0x52e4('0x1e')](_0x4a18de[_0x52e4('0x35')][_0x52e4('0x1e')]);}_0x3daf82[_0x52e4('0x3d')]=qs[_0x52e4('0x3e')](_0x4a18de['query'][_0x52e4('0x3e')]);_0x3daf82[_0x52e4('0x3f')]=qs['filters'](_['pick'](_0x4a18de['query'],_0x49df2a[_0x52e4('0x40')]),_0x47cf92);if(_0x4a18de['query'][_0x52e4('0x41')]){_0x3daf82[_0x52e4('0x3f')]=_[_0x52e4('0x42')](_0x3daf82['where'],{'$or':_[_0x52e4('0x34')](_0x47cf92,function(_0x54d037){if(_0x54d037['type']!==_0x52e4('0x43')){var _0x1371f8={};_0x1371f8[_0x54d037[_0x52e4('0x2d')]]={'$like':'%'+_0x4a18de[_0x52e4('0x35')][_0x52e4('0x41')]+'%'};return _0x1371f8;}})});}_0x3daf82=_['merge']({},_0x3daf82,_0x4a18de['options']);var _0x1402c5={'where':_0x3daf82[_0x52e4('0x3f')]};return db[_0x52e4('0x30')]['count'](_0x1402c5)[_0x52e4('0x28')](function(_0xa29f51){_0x2faddc['count']=_0xa29f51;if(_0x4a18de['query'][_0x52e4('0x44')]){_0x3daf82[_0x52e4('0x45')]=[{'all':!![]}];}return db['Variable']['findAll'](_0x3daf82);})[_0x52e4('0x28')](function(_0x10fdbe){_0x2faddc[_0x52e4('0x46')]=_0x10fdbe;return _0x2faddc;})['then'](respondWithFilteredResult(_0x50c579,_0x3daf82))[_0x52e4('0x47')](handleError(_0x50c579,null));};exports[_0x52e4('0x48')]=function(_0x3d25a8,_0x12f48b){var _0x15fcd7={'raw':!![],'where':{'id':_0x3d25a8['params']['id']}},_0x5b6d44={};_0x5b6d44['model']=_['keys'](db['Variable'][_0x52e4('0x31')]);_0x5b6d44[_0x52e4('0x35')]=_[_0x52e4('0x36')](_0x3d25a8[_0x52e4('0x35')]);_0x5b6d44[_0x52e4('0x40')]=_[_0x52e4('0x37')](_0x5b6d44[_0x52e4('0x33')],_0x5b6d44['query']);_0x15fcd7[_0x52e4('0x38')]=_[_0x52e4('0x37')](_0x5b6d44['model'],qs[_0x52e4('0x39')](_0x3d25a8['query']['fields']));_0x15fcd7[_0x52e4('0x38')]=_0x15fcd7[_0x52e4('0x38')][_0x52e4('0x3a')]?_0x15fcd7[_0x52e4('0x38')]:_0x5b6d44[_0x52e4('0x33')];if(_0x3d25a8[_0x52e4('0x35')][_0x52e4('0x44')]){_0x15fcd7['include']=[{'all':!![]}];}_0x15fcd7=_[_0x52e4('0x42')]({},_0x15fcd7,_0x3d25a8['options']);return db[_0x52e4('0x30')][_0x52e4('0x49')](_0x15fcd7)['then'](handleEntityNotFound(_0x12f48b,null))['then'](respondWithResult(_0x12f48b,null))['catch'](handleError(_0x12f48b,null));};exports['create']=function(_0x41ca06,_0x3ed44a){return db[_0x52e4('0x30')][_0x52e4('0x4a')](_0x41ca06['body'],{})['then'](function(_0x213daf){var _0x4e85ab=_0x41ca06[_0x52e4('0x4b')][_0x52e4('0x29')]({'plain':!![]});if(!_0x4e85ab)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e85ab[_0x52e4('0x4c')]===_0x52e4('0x4b')){var _0x1af47d=_0x213daf[_0x52e4('0x29')]({'plain':!![]});var _0x48a3f4='Variables';return db[_0x52e4('0x4d')][_0x52e4('0x49')]({'where':{'name':_0x48a3f4,'userProfileId':_0x4e85ab[_0x52e4('0x4e')]},'raw':!![]})['then'](function(_0x52c588){if(_0x52c588&&_0x52c588[_0x52e4('0x4f')]===0x0){return db[_0x52e4('0x2b')]['create']({'name':_0x1af47d[_0x52e4('0x2d')],'resourceId':_0x1af47d['id'],'type':_0x52c588[_0x52e4('0x2d')],'sectionId':_0x52c588['id']},{})['then'](function(){return _0x213daf;});}else{return _0x213daf;}})[_0x52e4('0x47')](function(_0xf57d82){logger[_0x52e4('0x50')](_0x52e4('0x51'),_0xf57d82);throw _0xf57d82;});}return _0x213daf;})['then'](respondWithResult(_0x3ed44a,0xc9))[_0x52e4('0x47')](handleError(_0x3ed44a,null));};exports[_0x52e4('0x26')]=function(_0x5aeacc,_0x548c33){if(_0x5aeacc['body']['id']){delete _0x5aeacc[_0x52e4('0x52')]['id'];}return db[_0x52e4('0x30')][_0x52e4('0x49')]({'where':{'id':_0x5aeacc[_0x52e4('0x53')]['id']}})[_0x52e4('0x28')](handleEntityNotFound(_0x548c33,null))[_0x52e4('0x28')](saveUpdates(_0x5aeacc['body'],null))[_0x52e4('0x28')](respondWithResult(_0x548c33,null))[_0x52e4('0x47')](handleError(_0x548c33,null));};exports['destroy']=function(_0x23a555,_0x550aa1){return db[_0x52e4('0x30')][_0x52e4('0x49')]({'where':{'id':_0x23a555[_0x52e4('0x53')]['id']}})[_0x52e4('0x28')](handleEntityNotFound(_0x550aa1,null))[_0x52e4('0x28')](removeEntity(_0x550aa1,null))[_0x52e4('0x47')](handleError(_0x550aa1,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 98dc5b0..4957fa6 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 _0xb295=['tools_variables','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./variable.attributes','define','Variable'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xb295,0x16d));var _0x5b29=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xb295[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0x5b29('0x0'));var util=require(_0x5b29('0x1'));var logger=require(_0x5b29('0x2'))(_0x5b29('0x3'));var moment=require(_0x5b29('0x4'));var BPromise=require(_0x5b29('0x5'));var rp=require(_0x5b29('0x6'));var fs=require('fs');var path=require(_0x5b29('0x7'));var rimraf=require('rimraf');var config=require(_0x5b29('0x8'));var attributes=require(_0x5b29('0x9'));module['exports']=function(_0x4c45f4,_0xc99141){return _0x4c45f4[_0x5b29('0xa')](_0x5b29('0xb'),attributes,{'tableName':_0x5b29('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5a3=['define','Variable','tools_variables','util','api','moment','bluebird','path','rimraf','exports'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xb5a3,0x111));var _0x3b5a=function(_0x418549,_0x11b13d){_0x418549=_0x418549-0x0;var _0x288826=_0xb5a3[_0x418549];return _0x288826;};'use strict';var _=require('lodash');var util=require(_0x3b5a('0x0'));var logger=require('../../config/logger')(_0x3b5a('0x1'));var moment=require(_0x3b5a('0x2'));var BPromise=require(_0x3b5a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3b5a('0x4'));var rimraf=require(_0x3b5a('0x5'));var config=require('../../config/environment');var attributes=require('./variable.attributes');module[_0x3b5a('0x6')]=function(_0x3c5bfb,_0x1af818){return _0x3c5bfb[_0x3b5a('0x7')](_0x3b5a('0x8'),attributes,{'tableName':_0x3b5a('0x9'),'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 33ba1c7..d534704 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 _0xf494=['where','attributes','include','map','model','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','Variable,\x20%s,\x20%s,\x20%s','error','message','catch','ShowVariable','find','options','raw'];(function(_0x43b290,_0x2aa146){var _0x2f611e=function(_0x18eaad){while(--_0x18eaad){_0x43b290['push'](_0x43b290['shift']());}};_0x2f611e(++_0x2aa146);}(_0xf494,0x1c6));var _0x4f49=function(_0x1f69a0,_0x561598){_0x1f69a0=_0x1f69a0-0x0;var _0x14ce9e=_0xf494[_0x1f69a0];return _0x14ce9e;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});}exports[_0x4f49('0x16')]=function(_0x4e85df){var _0x49cdaf=this;return new Promise(function(_0x5bb23b,_0x560592){return db['Variable'][_0x4f49('0x17')]({'raw':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x19')]===undefined?!![]:![]:!![],'where':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1a')]||null:null,'attributes':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1b')]||null:null,'include':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x4e85df['options'][_0x4f49('0x1c')],function(_0x1d70a7){return{'model':db[_0x1d70a7[_0x4f49('0x1e')]],'as':_0x1d70a7['as'],'attributes':_0x1d70a7[_0x4f49('0x1b')],'include':_0x1d70a7[_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x1d70a7['include'],function(_0x4e9041){return{'model':db[_0x4e9041[_0x4f49('0x1e')]],'as':_0x4e9041['as'],'attributes':_0x4e9041[_0x4f49('0x1b')],'include':_0x4e9041['include']?_[_0x4f49('0x1d')](_0x4e9041[_0x4f49('0x1c')],function(_0x35f8e0){return{'model':db[_0x35f8e0['model']],'as':_0x35f8e0['as'],'attributes':_0x35f8e0[_0x4f49('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4f49('0xe')](function(_0x298785){logger[_0x4f49('0xf')](_0x4f49('0x16'),_0x4e85df);logger[_0x4f49('0x1f')]('ShowVariable',_0x4e85df,JSON['stringify'](_0x298785));_0x5bb23b(_0x298785);})[_0x4f49('0x15')](function(_0x2c00ee){logger[_0x4f49('0x13')]('ShowVariable',_0x2c00ee[_0x4f49('0x14')],_0x4e85df);_0x560592(_0x49cdaf[_0x4f49('0x13')](0x1f4,_0x2c00ee[_0x4f49('0x14')]));});});}; \ No newline at end of file +var _0xabce=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowVariable','Variable','find','options','attributes','map','include','model','catch','lodash','util'];(function(_0x2c59fd,_0x48cec3){var _0x3258e8=function(_0x5cdd50){while(--_0x5cdd50){_0x2c59fd['push'](_0x2c59fd['shift']());}};_0x3258e8(++_0x48cec3);}(_0xabce,0x103));var _0xeabc=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xabce[_0x5b561d];return _0x431060;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Variable,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});}exports[_0xeabc('0x14')]=function(_0x58a3c0){var _0x16f08b=this;return new Promise(function(_0x31dd53,_0x31f52a){return db[_0xeabc('0x15')][_0xeabc('0x16')]({'raw':_0x58a3c0['options']?_0x58a3c0[_0xeabc('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['where']||null:null,'attributes':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x18')]||null:null,'include':_0x58a3c0[_0xeabc('0x17')]?_0x58a3c0[_0xeabc('0x17')]['include']?_[_0xeabc('0x19')](_0x58a3c0[_0xeabc('0x17')][_0xeabc('0x1a')],function(_0x5bdd57){return{'model':db[_0x5bdd57[_0xeabc('0x1b')]],'as':_0x5bdd57['as'],'attributes':_0x5bdd57[_0xeabc('0x18')],'include':_0x5bdd57[_0xeabc('0x1a')]?_[_0xeabc('0x19')](_0x5bdd57['include'],function(_0x109e1d){return{'model':db[_0x109e1d['model']],'as':_0x109e1d['as'],'attributes':_0x109e1d[_0xeabc('0x18')],'include':_0x109e1d['include']?_[_0xeabc('0x19')](_0x109e1d[_0xeabc('0x1a')],function(_0x269621){return{'model':db[_0x269621[_0xeabc('0x1b')]],'as':_0x269621['as'],'attributes':_0x269621[_0xeabc('0x18')]};}):[]};}):[]};}):[]:[]})[_0xeabc('0x9')](function(_0x131722){logger['info']('ShowVariable',_0x58a3c0);logger[_0xeabc('0xd')]('ShowVariable',_0x58a3c0,JSON[_0xeabc('0xf')](_0x131722));_0x31dd53(_0x131722);})[_0xeabc('0x1c')](function(_0x48fb52){logger[_0xeabc('0x10')](_0xeabc('0x14'),_0x48fb52[_0xeabc('0x12')],_0x58a3c0);_0x31f52a(_0x16f08b[_0xeabc('0x10')](0x1f4,_0x48fb52[_0xeabc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 7baaad7..f36fe64 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 _0xf4cc=['canUpdate','fetch','/reset','reset','/pull','/restart','restart','migrations','exports','express','./version.controller','index','get','isAuthenticated'];(function(_0x321834,_0x19eb7f){var _0x661285=function(_0x5d9436){while(--_0x5d9436){_0x321834['push'](_0x321834['shift']());}};_0x661285(++_0x19eb7f);}(_0xf4cc,0x19f));var _0xcf4c=function(_0x432b71,_0x509152){_0x432b71=_0x432b71-0x0;var _0x4d8581=_0xf4cc[_0x432b71];return _0x4d8581;};'use strict';var express=require(_0xcf4c('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xcf4c('0x1'));router['get']('/',controller[_0xcf4c('0x2')]);router[_0xcf4c('0x3')]('/fetch',auth[_0xcf4c('0x4')](),auth[_0xcf4c('0x5')](),controller[_0xcf4c('0x6')]);router[_0xcf4c('0x3')](_0xcf4c('0x7'),auth[_0xcf4c('0x4')](),auth[_0xcf4c('0x5')](),controller[_0xcf4c('0x8')]);router[_0xcf4c('0x3')](_0xcf4c('0x9'),auth[_0xcf4c('0x4')](),auth[_0xcf4c('0x5')](),controller['pull']);router[_0xcf4c('0x3')](_0xcf4c('0xa'),auth[_0xcf4c('0x4')](),controller[_0xcf4c('0xb')]);router[_0xcf4c('0x3')]('/migrations',controller[_0xcf4c('0xc')]);module[_0xcf4c('0xd')]=router; \ No newline at end of file +var _0xcb93=['isAuthenticated','canUpdate','fetch','/reset','reset','pull','/restart','restart','/migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch'];(function(_0xa61fd8,_0x17b182){var _0x49d410=function(_0x48fadb){while(--_0x48fadb){_0xa61fd8['push'](_0xa61fd8['shift']());}};_0x49d410(++_0x17b182);}(_0xcb93,0x1c4));var _0x3cb9=function(_0x38b4b8,_0x52ee16){_0x38b4b8=_0x38b4b8-0x0;var _0x39db0e=_0xcb93[_0x38b4b8];return _0x39db0e;};'use strict';var express=require(_0x3cb9('0x0'));var router=express[_0x3cb9('0x1')]();var auth=require(_0x3cb9('0x2'));var controller=require(_0x3cb9('0x3'));router[_0x3cb9('0x4')]('/',controller[_0x3cb9('0x5')]);router[_0x3cb9('0x4')](_0x3cb9('0x6'),auth[_0x3cb9('0x7')](),auth[_0x3cb9('0x8')](),controller[_0x3cb9('0x9')]);router[_0x3cb9('0x4')](_0x3cb9('0xa'),auth[_0x3cb9('0x7')](),auth['canUpdate'](),controller[_0x3cb9('0xb')]);router[_0x3cb9('0x4')]('/pull',auth[_0x3cb9('0x7')](),auth[_0x3cb9('0x8')](),controller[_0x3cb9('0xc')]);router[_0x3cb9('0x4')](_0x3cb9('0xd'),auth['isAuthenticated'](),controller[_0x3cb9('0xe')]);router[_0x3cb9('0x4')](_0x3cb9('0xf'),controller['migrations']);module[_0x3cb9('0x10')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 710d953..8f7703f 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 _0x8e15=['json','origin','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','replace','.js','push','length','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','map','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','../../mysqldb','../../config/pm2','../../config/logger','update','simple-git','root','index','query','fetch','latest','exports','2.0.0','status'];(function(_0x32933c,_0x2d6c7b){var _0x472e6a=function(_0x32f9f8){while(--_0x32f9f8){_0x32933c['push'](_0x32933c['shift']());}};_0x472e6a(++_0x2d6c7b);}(_0x8e15,0x1e4));var _0x58e1=function(_0x209cc0,_0x59bb37){_0x209cc0=_0x209cc0-0x0;var _0x3c5029=_0x8e15[_0x209cc0];return _0x3c5029;};'use strict';var Umzug=require(_0x58e1('0x0'));var path=require(_0x58e1('0x1'));var fs=require('fs');var _=require(_0x58e1('0x2'));var pkginfo=require(_0x58e1('0x3'))(module,_0x58e1('0x4'));var compareVersions=require(_0x58e1('0x5'));var exec=require(_0x58e1('0x6'))['exec'];var db=require(_0x58e1('0x7'))['db'];var config=require('../../config/environment');var pm2=require(_0x58e1('0x8'));var logger=require(_0x58e1('0x9'))(_0x58e1('0xa'));var git=require(_0x58e1('0xb'))(config[_0x58e1('0xc')]);exports[_0x58e1('0xd')]=function(_0x39b0ba,_0x375c60){var _0x4c4501={'current':module['exports'][_0x58e1('0x4')],'phonebar':0x2};if(_0x39b0ba[_0x58e1('0xe')]&&_0x39b0ba['query']['latest']){return git[_0x58e1('0xf')]()['tags'](function(_0x566495,_0x560bda){_0x4c4501[_0x58e1('0x10')]=(_0x566495?module[_0x58e1('0x11')][_0x58e1('0x4')]:_0x560bda[_0x58e1('0x10')])||_0x58e1('0x12');return _0x375c60[_0x58e1('0x13')](0xc8)['json'](_0x4c4501);});}else{return _0x375c60[_0x58e1('0x13')](0xc8)[_0x58e1('0x14')](_0x4c4501);}};exports[_0x58e1('0xf')]=function(_0x470099,_0x21037a){return git['fetch']([_0x58e1('0x15'),_0x58e1('0x16')],function(_0x2d78e7){if(_0x2d78e7){logger[_0x58e1('0x17')](_0x2d78e7);return _0x21037a[_0x58e1('0x13')](0x1f4)['json'](_0x2d78e7);}logger['info'](_0x58e1('0x18'));return _0x21037a[_0x58e1('0x13')](0xc8)[_0x58e1('0x14')]({'output':_0x58e1('0x19')});});};exports[_0x58e1('0x1a')]=function(_0x1643ed,_0x89efc){return git[_0x58e1('0x1a')]([_0x58e1('0x1b'),_0x58e1('0x1c')],function(_0x29705c){if(_0x29705c){logger[_0x58e1('0x17')](_0x29705c);return _0x89efc[_0x58e1('0x13')](0x1f4)[_0x58e1('0x14')](_0x29705c);}logger[_0x58e1('0x1d')](_0x58e1('0x1e'));return _0x89efc[_0x58e1('0x13')](0xc8)['json']({'output':_0x58e1('0x1f')});});};exports['pull']=function(_0x3e6861,_0xf014f2){exec(_0x58e1('0x20'),function(_0x2efc8e,_0x5210a8,_0x4e9e88){logger[_0x58e1('0x1d')](_0x5210a8);logger[_0x58e1('0x1d')](_0x4e9e88);if(_0x2efc8e){logger[_0x58e1('0x17')](_0x2efc8e);return _0xf014f2['status'](0x1f4)[_0x58e1('0x14')](_0x2efc8e);}return _0xf014f2[_0x58e1('0x13')](0xc8)['json']({'output':_0x5210a8});});};exports['restart']=function(_0x330a4d,_0x4aca12){return pm2[_0x58e1('0x21')](_0x58e1('0x22'))[_0x58e1('0x23')](function(_0x477525){logger[_0x58e1('0x1d')](_0x58e1('0x24'),_0x477525);return _0x4aca12[_0x58e1('0x13')](0xc8)[_0x58e1('0x14')]({'output':_0x58e1('0x25')});})[_0x58e1('0x26')](function(_0x17d97b){logger[_0x58e1('0x17')](_0x17d97b);return _0x4aca12[_0x58e1('0x13')](0x1f4)[_0x58e1('0x14')](_0x17d97b);});};exports[_0x58e1('0x27')]=function(_0x5b4672,_0x30d5c6){var _0x3a4029=fs[_0x58e1('0x28')](path[_0x58e1('0x29')](config[_0x58e1('0xc')],'server',_0x58e1('0x27')));var _0x249223=[];for(var _0x1c235c=0x0;_0x1c235c<_0x3a4029['length'];_0x1c235c++){var _0x29b0b9=_0x3a4029[_0x1c235c][_0x58e1('0x2a')](_0x58e1('0x2b'),'');if(compareVersions(module[_0x58e1('0x11')]['version'],_0x29b0b9)===-0x1){_0x249223[_0x58e1('0x2c')](_0x29b0b9);}}if(_0x249223[_0x58e1('0x2d')]){var _0x3d11c2=_0x249223['sort'](compareVersions);var _0x513e66=new Umzug({'storage':_0x58e1('0x2e'),'storageOptions':{'model':db[_0x58e1('0x2f')],'modelName':'Migration','columnName':_0x58e1('0x4')},'migrations':{'params':[db[_0x58e1('0x2e')]['getQueryInterface'](),db[_0x58e1('0x2e')][_0x58e1('0x30')],function(){throw new Error(_0x58e1('0x31'));}],'path':path[_0x58e1('0x29')](config['root'],_0x58e1('0x32'),_0x58e1('0x27')),'pattern':/\.js$/}});_0x513e66['up']({'migrations':_[_0x58e1('0x33')](_0x3d11c2,function(_0xd7a7e7){return _0xd7a7e7+_0x58e1('0x2b');})})[_0x58e1('0x23')](function(){return _0x30d5c6[_0x58e1('0x13')](0xc8)[_0x58e1('0x14')]({'output':_0x58e1('0x34')+module[_0x58e1('0x11')][_0x58e1('0x4')]+'\x20to\x20'+_[_0x58e1('0x35')](_0x3d11c2),'migrations':_['join'](_0x3d11c2)});})[_0x58e1('0x26')](function(_0x2b1900){if(_0x2b1900 instanceof db[_0x58e1('0x2e')][_0x58e1('0x36')]){return _0x30d5c6[_0x58e1('0x13')](0xc8)[_0x58e1('0x14')]({'output':_0x58e1('0x37')});}else{return _0x30d5c6[_0x58e1('0x13')](0x1f4)[_0x58e1('0x14')](_0x2b1900);}});}else{return _0x30d5c6[_0x58e1('0x13')](0xc8)[_0x58e1('0x14')]({'output':_0x58e1('0x37')});}}; \ No newline at end of file +var _0x6f0e=['simple-git','root','exports','query','latest','fetch','tags','2.0.0','json','status','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','server','migrations','replace','.js','push','length','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','umzug','path','lodash','pkginfo','version','child_process','exec','../../config/pm2','../../config/logger','update'];(function(_0x5bcafc,_0x322f20){var _0x57c9f2=function(_0x115a27){while(--_0x115a27){_0x5bcafc['push'](_0x5bcafc['shift']());}};_0x57c9f2(++_0x322f20);}(_0x6f0e,0xa1));var _0xe6f0=function(_0x4a5a60,_0x4dd8a4){_0x4a5a60=_0x4a5a60-0x0;var _0x5ed5b3=_0x6f0e[_0x4a5a60];return _0x5ed5b3;};'use strict';var Umzug=require(_0xe6f0('0x0'));var path=require(_0xe6f0('0x1'));var fs=require('fs');var _=require(_0xe6f0('0x2'));var pkginfo=require(_0xe6f0('0x3'))(module,_0xe6f0('0x4'));var compareVersions=require('compare-versions');var exec=require(_0xe6f0('0x5'))[_0xe6f0('0x6')];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require(_0xe6f0('0x7'));var logger=require(_0xe6f0('0x8'))(_0xe6f0('0x9'));var git=require(_0xe6f0('0xa'))(config[_0xe6f0('0xb')]);exports['index']=function(_0x41292e,_0x232c93){var _0x5d9d68={'current':module[_0xe6f0('0xc')][_0xe6f0('0x4')],'phonebar':0x2};if(_0x41292e[_0xe6f0('0xd')]&&_0x41292e[_0xe6f0('0xd')][_0xe6f0('0xe')]){return git[_0xe6f0('0xf')]()[_0xe6f0('0x10')](function(_0x3f4207,_0x1ab712){_0x5d9d68['latest']=(_0x3f4207?module[_0xe6f0('0xc')][_0xe6f0('0x4')]:_0x1ab712[_0xe6f0('0xe')])||_0xe6f0('0x11');return _0x232c93['status'](0xc8)[_0xe6f0('0x12')](_0x5d9d68);});}else{return _0x232c93[_0xe6f0('0x13')](0xc8)[_0xe6f0('0x12')](_0x5d9d68);}};exports['fetch']=function(_0x2f794d,_0x4adcbf){return git[_0xe6f0('0xf')]([_0xe6f0('0x14'),_0xe6f0('0x15')],function(_0x228f6c){if(_0x228f6c){logger[_0xe6f0('0x16')](_0x228f6c);return _0x4adcbf[_0xe6f0('0x13')](0x1f4)[_0xe6f0('0x12')](_0x228f6c);}logger[_0xe6f0('0x17')](_0xe6f0('0x18'));return _0x4adcbf[_0xe6f0('0x13')](0xc8)['json']({'output':_0xe6f0('0x19')});});};exports[_0xe6f0('0x1a')]=function(_0x3451b8,_0x4ed380){return git[_0xe6f0('0x1a')]([_0xe6f0('0x1b'),_0xe6f0('0x1c')],function(_0x59a649){if(_0x59a649){logger['error'](_0x59a649);return _0x4ed380[_0xe6f0('0x13')](0x1f4)[_0xe6f0('0x12')](_0x59a649);}logger[_0xe6f0('0x17')](_0xe6f0('0x1d'));return _0x4ed380['status'](0xc8)[_0xe6f0('0x12')]({'output':_0xe6f0('0x1e')});});};exports['pull']=function(_0xadc895,_0x19e1d5){exec(_0xe6f0('0x1f'),function(_0x3956b1,_0x5d8ab7,_0x5aa4fa){logger[_0xe6f0('0x17')](_0x5d8ab7);logger['info'](_0x5aa4fa);if(_0x3956b1){logger[_0xe6f0('0x16')](_0x3956b1);return _0x19e1d5[_0xe6f0('0x13')](0x1f4)[_0xe6f0('0x12')](_0x3956b1);}return _0x19e1d5[_0xe6f0('0x13')](0xc8)['json']({'output':_0x5d8ab7});});};exports[_0xe6f0('0x20')]=function(_0x7c6289,_0x450e69){return pm2[_0xe6f0('0x20')](_0xe6f0('0x21'))['then'](function(_0x536ec1){logger['info'](_0xe6f0('0x22'),_0x536ec1);return _0x450e69['status'](0xc8)['json']({'output':_0xe6f0('0x23')});})[_0xe6f0('0x24')](function(_0x1de9ef){logger[_0xe6f0('0x16')](_0x1de9ef);return _0x450e69[_0xe6f0('0x13')](0x1f4)['json'](_0x1de9ef);});};exports['migrations']=function(_0xe20fe5,_0x5caaa9){var _0xd67c17=fs[_0xe6f0('0x25')](path[_0xe6f0('0x26')](config[_0xe6f0('0xb')],_0xe6f0('0x27'),_0xe6f0('0x28')));var _0xb0dabf=[];for(var _0x2c441f=0x0;_0x2c441f<_0xd67c17['length'];_0x2c441f++){var _0x349fda=_0xd67c17[_0x2c441f][_0xe6f0('0x29')](_0xe6f0('0x2a'),'');if(compareVersions(module['exports'][_0xe6f0('0x4')],_0x349fda)===-0x1){_0xb0dabf[_0xe6f0('0x2b')](_0x349fda);}}if(_0xb0dabf[_0xe6f0('0x2c')]){var _0x38e910=_0xb0dabf[_0xe6f0('0x2d')](compareVersions);var _0x3876c7=new Umzug({'storage':_0xe6f0('0x2e'),'storageOptions':{'model':db['Migration'],'modelName':_0xe6f0('0x2f'),'columnName':'version'},'migrations':{'params':[db['sequelize'][_0xe6f0('0x30')](),db['sequelize'][_0xe6f0('0x31')],function(){throw new Error(_0xe6f0('0x32'));}],'path':path[_0xe6f0('0x26')](config[_0xe6f0('0xb')],'server',_0xe6f0('0x28')),'pattern':/\.js$/}});_0x3876c7['up']({'migrations':_[_0xe6f0('0x33')](_0x38e910,function(_0x3b62fa){return _0x3b62fa+_0xe6f0('0x2a');})})[_0xe6f0('0x34')](function(){return _0x5caaa9[_0xe6f0('0x13')](0xc8)[_0xe6f0('0x12')]({'output':_0xe6f0('0x35')+module[_0xe6f0('0xc')][_0xe6f0('0x4')]+_0xe6f0('0x36')+_[_0xe6f0('0x37')](_0x38e910),'migrations':_[_0xe6f0('0x26')](_0x38e910)});})[_0xe6f0('0x24')](function(_0x304eaf){if(_0x304eaf instanceof db['sequelize'][_0xe6f0('0x38')]){return _0x5caaa9[_0xe6f0('0x13')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}else{return _0x5caaa9[_0xe6f0('0x13')](0x1f4)['json'](_0x304eaf);}});}else{return _0x5caaa9[_0xe6f0('0x13')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index ff049ba..ff8580e 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 _0x4024=['/describe','describe','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index'];(function(_0x22e3ef,_0xed518b){var _0x30723f=function(_0x452f6d){while(--_0x452f6d){_0x22e3ef['push'](_0x22e3ef['shift']());}};_0x30723f(++_0xed518b);}(_0x4024,0xa9));var _0x4402=function(_0x3166f6,_0x4c0843){_0x3166f6=_0x3166f6-0x0;var _0x34dc43=_0x4024[_0x3166f6];return _0x34dc43;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require(_0x4402('0x2'));var timeout=require(_0x4402('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4402('0x4'));var interaction=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var controller=require(_0x4402('0x7'));router[_0x4402('0x8')]('/',auth[_0x4402('0x9')](),controller[_0x4402('0xa')]);router[_0x4402('0x8')](_0x4402('0xb'),auth[_0x4402('0x9')](),controller[_0x4402('0xc')]);router[_0x4402('0x8')](_0x4402('0xd'),auth[_0x4402('0x9')](),controller[_0x4402('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4402('0xf')]);router[_0x4402('0x10')](_0x4402('0xd'),auth['isAuthenticated'](),controller[_0x4402('0x11')]);router[_0x4402('0x12')]('/:id',auth[_0x4402('0x9')](),controller['destroy']);module[_0x4402('0x13')]=router; \ No newline at end of file +var _0x6a49=['multer','util','express','Router','fs-extra','get','isAuthenticated','index','describe','/:id','show','post','update','exports'];(function(_0x5efd67,_0xac2b40){var _0x1bc565=function(_0x1f166c){while(--_0x1f166c){_0x5efd67['push'](_0x5efd67['shift']());}};_0x1bc565(++_0xac2b40);}(_0x6a49,0xb6));var _0x96a4=function(_0x34e250,_0x2ef7fb){_0x34e250=_0x34e250-0x0;var _0x26ef2b=_0x6a49[_0x34e250];return _0x26ef2b;};'use strict';var multer=require(_0x96a4('0x0'));var util=require(_0x96a4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x96a4('0x2'));var router=express[_0x96a4('0x3')]();var fs_extra=require(_0x96a4('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router[_0x96a4('0x5')]('/',auth[_0x96a4('0x6')](),controller[_0x96a4('0x7')]);router[_0x96a4('0x5')]('/describe',auth['isAuthenticated'](),controller[_0x96a4('0x8')]);router['get'](_0x96a4('0x9'),auth[_0x96a4('0x6')](),controller[_0x96a4('0xa')]);router[_0x96a4('0xb')]('/',auth[_0x96a4('0x6')](),controller['create']);router['put'](_0x96a4('0x9'),auth[_0x96a4('0x6')](),controller[_0x96a4('0xc')]);router['delete']('/:id',auth[_0x96a4('0x6')](),controller['destroy']);module[_0x96a4('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 8677a70..6dd68e4 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 _0x6901=['BOOLEAN','sequelize','STRING','DATE','INTEGER'];(function(_0x4aff96,_0x555fae){var _0x305c9e=function(_0x4fb19){while(--_0x4fb19){_0x4aff96['push'](_0x4aff96['shift']());}};_0x305c9e(++_0x555fae);}(_0x6901,0x100));var _0x1690=function(_0x133399,_0x1af694){_0x133399=_0x133399-0x0;var _0x5e56ab=_0x6901[_0x133399];return _0x5e56ab;};'use strict';var Sequelize=require(_0x1690('0x0'));module['exports']={'type':{'type':Sequelize[_0x1690('0x1')]},'uniqueid':{'type':Sequelize[_0x1690('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x1690('0x1')]},'interface':{'type':Sequelize[_0x1690('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x1690('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x1690('0x2')]},'holdtime':{'type':Sequelize[_0x1690('0x3')]},'agentcomplete':{'type':Sequelize[_0x1690('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x1690('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x1690('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x1690('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x1690('0x3')]},'reason':{'type':Sequelize[_0x1690('0x1')]},'lastevent':{'type':Sequelize[_0x1690('0x1')]},'channel':{'type':Sequelize[_0x1690('0x1')]},'channelstate':{'type':Sequelize[_0x1690('0x3')]},'channelstatedesc':{'type':Sequelize[_0x1690('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x1690('0x1')]},'language':{'type':Sequelize[_0x1690('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x1690('0x1')]},'exten':{'type':Sequelize[_0x1690('0x1')]},'priority':{'type':Sequelize[_0x1690('0x1')]},'destchannel':{'type':Sequelize[_0x1690('0x1')]},'destchannelstate':{'type':Sequelize[_0x1690('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x1690('0x1')]},'destcalleridnum':{'type':Sequelize[_0x1690('0x1')]},'destcalleridname':{'type':Sequelize[_0x1690('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x1690('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x1690('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x1690('0x1')]},'destcontext':{'type':Sequelize[_0x1690('0x1')]},'destexten':{'type':Sequelize[_0x1690('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x1690('0x1')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x1690('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x1690('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x1690('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8cda=['FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x33f1a3,_0x1557a5){var _0x1f3d03=function(_0xfc6e8b){while(--_0xfc6e8b){_0x33f1a3['push'](_0x33f1a3['shift']());}};_0x1f3d03(++_0x1557a5);}(_0x8cda,0x1db));var _0xa8cd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8cda[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xa8cd('0x0')]={'type':{'type':Sequelize[_0xa8cd('0x1')]},'uniqueid':{'type':Sequelize[_0xa8cd('0x1')]},'calleridnum':{'type':Sequelize[_0xa8cd('0x1')]},'calleridname':{'type':Sequelize[_0xa8cd('0x1')]},'queue':{'type':Sequelize[_0xa8cd('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xa8cd('0x1')]},'agentcalledAt':{'type':Sequelize[_0xa8cd('0x2')]},'agentconnectAt':{'type':Sequelize[_0xa8cd('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xa8cd('0x2')]},'agentdumpAt':{'type':Sequelize[_0xa8cd('0x2')]},'holdtime':{'type':Sequelize[_0xa8cd('0x3')]},'agentcomplete':{'type':Sequelize[_0xa8cd('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xa8cd('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xa8cd('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xa8cd('0x3')]},'agentacw':{'type':Sequelize[_0xa8cd('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa8cd('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xa8cd('0x1')]},'connectedlinenum':{'type':Sequelize[_0xa8cd('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa8cd('0x1')]},'accountcode':{'type':Sequelize[_0xa8cd('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xa8cd('0x1')]},'destchannel':{'type':Sequelize[_0xa8cd('0x1')]},'destchannelstate':{'type':Sequelize[_0xa8cd('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xa8cd('0x1')]},'destcalleridnum':{'type':Sequelize[_0xa8cd('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xa8cd('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xa8cd('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xa8cd('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xa8cd('0x1')]},'destuniqueid':{'type':Sequelize[_0xa8cd('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xa8cd('0x1')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa8cd('0x1')],'comment':_0xa8cd('0x5')},'transferexten':{'type':Sequelize[_0xa8cd('0x1')]},'transferuniqueid':{'type':Sequelize[_0xa8cd('0x1')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 2b41c92..90cb36b 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(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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 a81ea43..c3207c5 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 _0x0f89=['../../config/environment','./voiceAgentReport.attributes','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x783d5c,_0x45caed){var _0x3cd8a1=function(_0x3a70de){while(--_0x3a70de){_0x783d5c['push'](_0x783d5c['shift']());}};_0x3cd8a1(++_0x45caed);}(_0x0f89,0x111));var _0x90f8=function(_0x560da1,_0x33aa7e){_0x560da1=_0x560da1-0x0;var _0x29191e=_0x0f89[_0x560da1];return _0x29191e;};'use strict';var _=require(_0x90f8('0x0'));var util=require(_0x90f8('0x1'));var logger=require(_0x90f8('0x2'))('api');var moment=require(_0x90f8('0x3'));var BPromise=require(_0x90f8('0x4'));var rp=require(_0x90f8('0x5'));var fs=require('fs');var path=require(_0x90f8('0x6'));var rimraf=require('rimraf');var config=require(_0x90f8('0x7'));var attributes=require(_0x90f8('0x8'));module['exports']=function(_0x7b8d25,_0x4439a9){return _0x7b8d25[_0x90f8('0x9')](_0x90f8('0xa'),attributes,{'tableName':_0x90f8('0xb'),'paranoid':![],'indexes':[{'fields':[_0x90f8('0xc'),_0x90f8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfd7b=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport','uniqueid','util','../../config/logger'];(function(_0x9bd22a,_0x4e6cf0){var _0x25c3dd=function(_0x3701f7){while(--_0x3701f7){_0x9bd22a['push'](_0x9bd22a['shift']());}};_0x25c3dd(++_0x4e6cf0);}(_0xfd7b,0x1df));var _0xbfd7=function(_0xfcbcb8,_0x35bf6b){_0xfcbcb8=_0xfcbcb8-0x0;var _0x1b1f97=_0xfd7b[_0xfcbcb8];return _0x1b1f97;};'use strict';var _=require('lodash');var util=require(_0xbfd7('0x0'));var logger=require(_0xbfd7('0x1'))(_0xbfd7('0x2'));var moment=require(_0xbfd7('0x3'));var BPromise=require(_0xbfd7('0x4'));var rp=require(_0xbfd7('0x5'));var fs=require('fs');var path=require(_0xbfd7('0x6'));var rimraf=require(_0xbfd7('0x7'));var config=require(_0xbfd7('0x8'));var attributes=require(_0xbfd7('0x9'));module[_0xbfd7('0xa')]=function(_0x2ad158,_0x639dd4){return _0x2ad158['define'](_0xbfd7('0xb'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xbfd7('0xc'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 63121b9..1c0173a 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 _0x5286=['rpc','../../config/environment','jayson/promise','client','http','request','info','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','VoiceAgentReport,\x20%s,\x20%s','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','then','stringify','update','where','attributes','UpdateVoiceAgentReport','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xe0e0bd,_0x3c4477){var _0x11f0ca=function(_0x570803){while(--_0x570803){_0xe0e0bd['push'](_0xe0e0bd['shift']());}};_0x11f0ca(++_0x3c4477);}(_0x5286,0xe7));var _0x6528=function(_0x404dc4,_0x4125f9){_0x404dc4=_0x404dc4-0x0;var _0x1825ab=_0x5286[_0x404dc4];return _0x1825ab;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6528('0x0'));var BPromise=require(_0x6528('0x1'));var rs=require(_0x6528('0x2'));var fs=require('fs');var Redis=require(_0x6528('0x3'));var db=require(_0x6528('0x4'))['db'];var utils=require(_0x6528('0x5'));var logger=require(_0x6528('0x6'))(_0x6528('0x7'));var config=require(_0x6528('0x8'));var jayson=require(_0x6528('0x9'));var client=jayson[_0x6528('0xa')][_0x6528('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39d494,_0x273e62,_0x4e4904){return new BPromise(function(_0x8f7b1,_0x4842b4){return client[_0x6528('0xc')](_0x39d494,_0x4e4904)['then'](function(_0x23bd2a){logger[_0x6528('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x273e62,'request\x20sent');logger[_0x6528('0xe')](_0x6528('0xf'),_0x273e62,_0x6528('0x10'),JSON['stringify'](_0x23bd2a));if(_0x23bd2a['error']){if(_0x23bd2a['error']['code']===0x1f4){logger[_0x6528('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x273e62,_0x23bd2a[_0x6528('0x11')][_0x6528('0x12')]);return _0x4842b4(_0x23bd2a['error'][_0x6528('0x12')]);}logger[_0x6528('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x273e62,_0x23bd2a['error'][_0x6528('0x12')]);return _0x8f7b1(_0x23bd2a[_0x6528('0x11')]['message']);}else{logger[_0x6528('0xd')](_0x6528('0x13'),_0x273e62,_0x6528('0x10'));_0x8f7b1(_0x23bd2a[_0x6528('0x14')][_0x6528('0x12')]);}})[_0x6528('0x15')](function(_0x90becc){logger[_0x6528('0x11')](_0x6528('0x13'),_0x273e62,_0x90becc);_0x4842b4(_0x90becc);});});}exports[_0x6528('0x16')]=function(_0x4dedc5){var _0x46cbe0=this;return new Promise(function(_0x402b95,_0x535c82){return db[_0x6528('0x17')][_0x6528('0x18')](_0x4dedc5[_0x6528('0x19')],{'raw':_0x4dedc5[_0x6528('0x1a')]?_0x4dedc5[_0x6528('0x1a')][_0x6528('0x1b')]===undefined?!![]:![]:!![]})[_0x6528('0x1c')](function(_0x24ec1e){logger[_0x6528('0xd')](_0x6528('0x16'),_0x4dedc5);logger[_0x6528('0xe')]('CreateVoiceAgentReport',_0x4dedc5,JSON[_0x6528('0x1d')](_0x24ec1e));_0x402b95(_0x24ec1e);})['catch'](function(_0x56a999){logger[_0x6528('0x11')](_0x6528('0x16'),_0x56a999[_0x6528('0x12')],_0x4dedc5);_0x535c82(_0x46cbe0[_0x6528('0x11')](0x1f4,_0x56a999[_0x6528('0x12')]));});});};exports['UpdateVoiceAgentReport']=function(_0x1673a7){var _0x15d09b=this;return new Promise(function(_0x456608,_0x147283){return db[_0x6528('0x17')][_0x6528('0x1e')](_0x1673a7[_0x6528('0x19')],{'raw':_0x1673a7['options']?_0x1673a7['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1673a7[_0x6528('0x1a')]?_0x1673a7['options'][_0x6528('0x1f')]||null:null,'attributes':_0x1673a7[_0x6528('0x1a')]?_0x1673a7[_0x6528('0x1a')][_0x6528('0x20')]||null:null,'limit':_0x1673a7[_0x6528('0x1a')]?_0x1673a7[_0x6528('0x1a')]['limit']||null:null})[_0x6528('0x1c')](function(_0x1a58d6){logger[_0x6528('0xd')](_0x6528('0x21'),_0x1673a7);logger[_0x6528('0xe')](_0x6528('0x21'),_0x1673a7,JSON['stringify'](_0x1a58d6));_0x456608(_0x1a58d6);})[_0x6528('0x15')](function(_0x4aac85){logger['error'](_0x6528('0x21'),_0x4aac85[_0x6528('0x12')],_0x1673a7);_0x147283(_0x15d09b[_0x6528('0x11')](0x1f4,_0x4aac85[_0x6528('0x12')]));});});}; \ No newline at end of file +var _0x8c02=['raw','where','attributes','UpdateVoiceAgentReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','catch'];(function(_0x131590,_0x5e6254){var _0x7decaf=function(_0x196132){while(--_0x196132){_0x131590['push'](_0x131590['shift']());}};_0x7decaf(++_0x5e6254);}(_0x8c02,0x1e4));var _0x28c0=function(_0x385674,_0x314442){_0x385674=_0x385674-0x0;var _0x256638=_0x8c02[_0x385674];return _0x256638;};'use strict';var _=require(_0x28c0('0x0'));var util=require(_0x28c0('0x1'));var moment=require(_0x28c0('0x2'));var BPromise=require(_0x28c0('0x3'));var rs=require(_0x28c0('0x4'));var fs=require('fs');var Redis=require(_0x28c0('0x5'));var db=require(_0x28c0('0x6'))['db'];var utils=require(_0x28c0('0x7'));var logger=require(_0x28c0('0x8'))(_0x28c0('0x9'));var config=require(_0x28c0('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x28c0('0xb')][_0x28c0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4b83c5,_0x39b27e,_0x44d5c6){return new BPromise(function(_0x1db428,_0x573652){return client['request'](_0x4b83c5,_0x44d5c6)[_0x28c0('0xd')](function(_0x593f1e){logger[_0x28c0('0xe')](_0x28c0('0xf'),_0x39b27e,_0x28c0('0x10'));logger[_0x28c0('0x11')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x39b27e,_0x28c0('0x10'),JSON[_0x28c0('0x12')](_0x593f1e));if(_0x593f1e[_0x28c0('0x13')]){if(_0x593f1e[_0x28c0('0x13')]['code']===0x1f4){logger['error'](_0x28c0('0xf'),_0x39b27e,_0x593f1e['error'][_0x28c0('0x14')]);return _0x573652(_0x593f1e[_0x28c0('0x13')]['message']);}logger[_0x28c0('0x13')](_0x28c0('0xf'),_0x39b27e,_0x593f1e[_0x28c0('0x13')][_0x28c0('0x14')]);return _0x1db428(_0x593f1e[_0x28c0('0x13')][_0x28c0('0x14')]);}else{logger[_0x28c0('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x39b27e,_0x28c0('0x10'));_0x1db428(_0x593f1e[_0x28c0('0x15')][_0x28c0('0x14')]);}})['catch'](function(_0x4ceb47){logger[_0x28c0('0x13')](_0x28c0('0xf'),_0x39b27e,_0x4ceb47);_0x573652(_0x4ceb47);});});}exports[_0x28c0('0x16')]=function(_0x54de65){var _0x15b92=this;return new Promise(function(_0x5a25a6,_0x5f1c5b){return db[_0x28c0('0x17')][_0x28c0('0x18')](_0x54de65[_0x28c0('0x19')],{'raw':_0x54de65[_0x28c0('0x1a')]?_0x54de65[_0x28c0('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x28c0('0xd')](function(_0x392f87){logger['info'](_0x28c0('0x16'),_0x54de65);logger['debug'](_0x28c0('0x16'),_0x54de65,JSON[_0x28c0('0x12')](_0x392f87));_0x5a25a6(_0x392f87);})[_0x28c0('0x1b')](function(_0x367297){logger[_0x28c0('0x13')](_0x28c0('0x16'),_0x367297[_0x28c0('0x14')],_0x54de65);_0x5f1c5b(_0x15b92[_0x28c0('0x13')](0x1f4,_0x367297[_0x28c0('0x14')]));});});};exports['UpdateVoiceAgentReport']=function(_0x346010){var _0xc2d917=this;return new Promise(function(_0x5361f7,_0x5e9ba9){return db[_0x28c0('0x17')]['update'](_0x346010[_0x28c0('0x19')],{'raw':_0x346010[_0x28c0('0x1a')]?_0x346010[_0x28c0('0x1a')][_0x28c0('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x346010[_0x28c0('0x1a')]?_0x346010[_0x28c0('0x1a')][_0x28c0('0x1d')]||null:null,'attributes':_0x346010[_0x28c0('0x1a')]?_0x346010[_0x28c0('0x1a')][_0x28c0('0x1e')]||null:null,'limit':_0x346010[_0x28c0('0x1a')]?_0x346010[_0x28c0('0x1a')]['limit']||null:null})[_0x28c0('0xd')](function(_0x3d9cbb){logger[_0x28c0('0xe')](_0x28c0('0x1f'),_0x346010);logger[_0x28c0('0x11')](_0x28c0('0x1f'),_0x346010,JSON[_0x28c0('0x12')](_0x3d9cbb));_0x5361f7(_0x3d9cbb);})[_0x28c0('0x1b')](function(_0x34e440){logger[_0x28c0('0x13')](_0x28c0('0x1f'),_0x34e440['message'],_0x346010);_0x5e9ba9(_0xc2d917[_0x28c0('0x13')](0x1f4,_0x34e440['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index a68c58f..b5a1c05 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 _0x7fbe=['/describe','describe','/:id','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index'];(function(_0x3e6a2d,_0x2ab70f){var _0x16507c=function(_0x3f9563){while(--_0x3f9563){_0x3e6a2d['push'](_0x3e6a2d['shift']());}};_0x16507c(++_0x2ab70f);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x59fc33,_0x2e182d){_0x59fc33=_0x59fc33-0x0;var _0x39066f=_0x7fbe[_0x59fc33];return _0x39066f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['show']);router['post']('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);router[_0xe7fb('0x10')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x11')]);router[_0xe7fb('0x12')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x13')]);module[_0xe7fb('0x14')]=router; \ No newline at end of file +var _0x7fbe=['/describe','describe','/:id','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index'];(function(_0x343ddd,_0x1bb27f){var _0x1298f0=function(_0x1d22d7){while(--_0x1d22d7){_0x343ddd['push'](_0x343ddd['shift']());}};_0x1298f0(++_0x1bb27f);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0xb3d48d,_0xa90785){_0xb3d48d=_0xb3d48d-0x0;var _0x501bad=_0x7fbe[_0xb3d48d];return _0x501bad;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['show']);router['post']('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);router[_0xe7fb('0x10')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x11')]);router[_0xe7fb('0x12')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x13')]);module[_0xe7fb('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index b93a43e..2361b4d 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 _0x40a3=['inbound','outbound','inbound-fax','outbound-fax','dialer','STRING','TEXT','DATE','INTEGER','sequelize'];(function(_0x3ba016,_0x48855b){var _0x4b9762=function(_0x467176){while(--_0x467176){_0x3ba016['push'](_0x3ba016['shift']());}};_0x4b9762(++_0x48855b);}(_0x40a3,0x153));var _0x340a=function(_0x5094c1,_0x54540d){_0x5094c1=_0x5094c1-0x0;var _0x2991fb=_0x40a3[_0x5094c1];return _0x2991fb;};'use strict';var Sequelize=require(_0x340a('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x340a('0x1'),'internal',_0x340a('0x2'),_0x340a('0x3'),_0x340a('0x4'),_0x340a('0x5'))},'tag':{'type':Sequelize[_0x340a('0x6')]},'accountcode':{'type':Sequelize[_0x340a('0x6')]},'source':{'type':Sequelize[_0x340a('0x6')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x340a('0x6')]},'callerid':{'type':Sequelize[_0x340a('0x6')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x340a('0x6')]},'lastapplication':{'type':Sequelize[_0x340a('0x6')]},'lastdata':{'type':Sequelize[_0x340a('0x7')]},'starttime':{'type':Sequelize[_0x340a('0x8')]},'systemanswertime':{'type':Sequelize[_0x340a('0x8')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x340a('0x8')]},'duration':{'type':Sequelize[_0x340a('0x9')]},'billableseconds':{'type':Sequelize[_0x340a('0x9')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x340a('0x6')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x340a('0x6')]},'userDisposition':{'type':Sequelize[_0x340a('0x6')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x340a('0x6')]},'note':{'type':Sequelize[_0x340a('0x6')]},'prefix':{'type':Sequelize[_0x340a('0x6')]},'routeid':{'type':Sequelize[_0x340a('0x9')]},'sipcallid':{'type':Sequelize[_0x340a('0x6')]}}; \ No newline at end of file +var _0xedca=['INTEGER','sequelize','exports','inbound','outbound','inbound-fax','outbound-fax','dialer','STRING','DATE'];(function(_0x32f9ca,_0x2fa8bc){var _0x52e083=function(_0x4fd86a){while(--_0x4fd86a){_0x32f9ca['push'](_0x32f9ca['shift']());}};_0x52e083(++_0x2fa8bc);}(_0xedca,0xc9));var _0xaedc=function(_0x538a12,_0x5c95b0){_0x538a12=_0x538a12-0x0;var _0x2e9260=_0xedca[_0x538a12];return _0x2e9260;};'use strict';var Sequelize=require(_0xaedc('0x0'));module[_0xaedc('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0xaedc('0x2'),'internal',_0xaedc('0x3'),_0xaedc('0x4'),_0xaedc('0x5'),_0xaedc('0x6'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xaedc('0x7')]},'source':{'type':Sequelize[_0xaedc('0x7')]},'destination':{'type':Sequelize[_0xaedc('0x7')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0xaedc('0x7')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xaedc('0x8')]},'systemanswertime':{'type':Sequelize[_0xaedc('0x8')]},'answertime':{'type':Sequelize[_0xaedc('0x8')]},'endtime':{'type':Sequelize[_0xaedc('0x8')]},'duration':{'type':Sequelize[_0xaedc('0x9')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xaedc('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xaedc('0x7')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xaedc('0x7')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xaedc('0x7')]},'userThirdDisposition':{'type':Sequelize[_0xaedc('0x7')]},'note':{'type':Sequelize[_0xaedc('0x7')]},'prefix':{'type':Sequelize[_0xaedc('0x7')]},'routeid':{'type':Sequelize[_0xaedc('0x9')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index bd4f64a..a82fa21 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 _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x25bc49,_0x5dfdbb){_0x25bc49=_0x25bc49-0x0;var _0x12a22f=_0x2032[_0x25bc49];return _0x12a22f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file +var _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x5e8989,_0x5e0933){_0x5e8989=_0x5e8989-0x0;var _0x44b1c1=_0x2032[_0x5e8989];return _0x44b1c1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index ecb988e..ce33474 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 _0x7858=['util','moment','bluebird','request-promise','path','../../config/environment','./voiceCallReport.attributes','exports','define','report_call'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x7858,0x10e));var _0x8785=function(_0x113d2e,_0x132b0f){_0x113d2e=_0x113d2e-0x0;var _0x406d1e=_0x7858[_0x113d2e];return _0x406d1e;};'use strict';var _=require('lodash');var util=require(_0x8785('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x8785('0x1'));var BPromise=require(_0x8785('0x2'));var rp=require(_0x8785('0x3'));var fs=require('fs');var path=require(_0x8785('0x4'));var rimraf=require('rimraf');var config=require(_0x8785('0x5'));var attributes=require(_0x8785('0x6'));module[_0x8785('0x7')]=function(_0x2e0594,_0x269b7d){return _0x2e0594[_0x8785('0x8')]('VoiceCallReport',attributes,{'tableName':_0x8785('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x48f1=['uniqueid','lodash','../../config/logger','api','request-promise','path','rimraf','exports','VoiceCallReport','report_call'];(function(_0x37a45b,_0x1056ef){var _0x35f3bb=function(_0x5d73cd){while(--_0x5d73cd){_0x37a45b['push'](_0x37a45b['shift']());}};_0x35f3bb(++_0x1056ef);}(_0x48f1,0x1eb));var _0x148f=function(_0x1c2a60,_0x12f45a){_0x1c2a60=_0x1c2a60-0x0;var _0x578eb8=_0x48f1[_0x1c2a60];return _0x578eb8;};'use strict';var _=require(_0x148f('0x0'));var util=require('util');var logger=require(_0x148f('0x1'))(_0x148f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x148f('0x3'));var fs=require('fs');var path=require(_0x148f('0x4'));var rimraf=require(_0x148f('0x5'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0x148f('0x6')]=function(_0x4f1cd7,_0xe71fa7){return _0x4f1cd7['define'](_0x148f('0x7'),attributes,{'tableName':_0x148f('0x8'),'paranoid':![],'indexes':[{'fields':[_0x148f('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index faec5f7..ea94f6c 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 _0x0348=['http','request','then','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceCallReport,\x20%s,\x20%s','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','where','options','attributes','limit','include','model','create','raw','CreateVoiceCallReport','UpdateVoiceCallReport','update','body','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x8c79ee,_0x3ef183){var _0x273577=function(_0x1c7672){while(--_0x1c7672){_0x8c79ee['push'](_0x8c79ee['shift']());}};_0x273577(++_0x3ef183);}(_0x0348,0x17c));var _0x8034=function(_0x5c365f,_0x3b40ed){_0x5c365f=_0x5c365f-0x0;var _0x295e1b=_0x0348[_0x5c365f];return _0x295e1b;};'use strict';var _=require(_0x8034('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8034('0x1'));var rs=require(_0x8034('0x2'));var fs=require('fs');var Redis=require(_0x8034('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8034('0x4'));var logger=require(_0x8034('0x5'))(_0x8034('0x6'));var config=require(_0x8034('0x7'));var jayson=require(_0x8034('0x8'));var client=jayson[_0x8034('0x9')][_0x8034('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b8f13,_0x43de83,_0x396fb0){return new BPromise(function(_0x166e6b,_0x6e25d6){return client[_0x8034('0xb')](_0x4b8f13,_0x396fb0)[_0x8034('0xc')](function(_0x48ca6a){logger[_0x8034('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x43de83,_0x8034('0xe'));logger[_0x8034('0xf')](_0x8034('0x10'),_0x43de83,_0x8034('0xe'),JSON[_0x8034('0x11')](_0x48ca6a));if(_0x48ca6a[_0x8034('0x12')]){if(_0x48ca6a[_0x8034('0x12')][_0x8034('0x13')]===0x1f4){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x43de83,_0x48ca6a[_0x8034('0x12')]['message']);return _0x6e25d6(_0x48ca6a[_0x8034('0x12')][_0x8034('0x14')]);}logger[_0x8034('0x12')](_0x8034('0x15'),_0x43de83,_0x48ca6a[_0x8034('0x12')][_0x8034('0x14')]);return _0x166e6b(_0x48ca6a[_0x8034('0x12')][_0x8034('0x14')]);}else{logger[_0x8034('0xd')](_0x8034('0x15'),_0x43de83,'request\x20sent');_0x166e6b(_0x48ca6a[_0x8034('0x16')][_0x8034('0x14')]);}})[_0x8034('0x17')](function(_0x12271e){logger[_0x8034('0x12')](_0x8034('0x15'),_0x43de83,_0x12271e);_0x6e25d6(_0x12271e);});});}exports[_0x8034('0x18')]=function(_0x427ffd){var _0x1f559b=this;return new Promise(function(_0x2473c0,_0x4fc281){return db[_0x8034('0x19')][_0x8034('0x1a')]({'raw':_0x427ffd['options']?_0x427ffd['options']['raw']===undefined?!![]:![]:!![],'where':_0x427ffd['options']?_0x427ffd['options'][_0x8034('0x1b')]||null:null,'attributes':_0x427ffd['options']?_0x427ffd[_0x8034('0x1c')][_0x8034('0x1d')]||null:null,'limit':_0x427ffd[_0x8034('0x1c')]?_0x427ffd[_0x8034('0x1c')][_0x8034('0x1e')]||null:null,'include':_0x427ffd[_0x8034('0x1c')]?_0x427ffd[_0x8034('0x1c')][_0x8034('0x1f')]?_['map'](_0x427ffd['options'][_0x8034('0x1f')],function(_0x4dd0dd){return{'model':db[_0x4dd0dd[_0x8034('0x20')]],'as':_0x4dd0dd['as'],'attributes':_0x4dd0dd[_0x8034('0x1d')],'include':_0x4dd0dd[_0x8034('0x1f')]?_['map'](_0x4dd0dd['include'],function(_0x417436){return{'model':db[_0x417436[_0x8034('0x20')]],'as':_0x417436['as'],'attributes':_0x417436[_0x8034('0x1d')],'include':_0x417436[_0x8034('0x1f')]?_['map'](_0x417436['include'],function(_0x2739d7){return{'model':db[_0x2739d7[_0x8034('0x20')]],'as':_0x2739d7['as'],'attributes':_0x2739d7[_0x8034('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8034('0xc')](function(_0x3c3ee1){logger[_0x8034('0xd')](_0x8034('0x18'),_0x427ffd);logger[_0x8034('0xf')]('GetVoiceCallReport',_0x427ffd,JSON[_0x8034('0x11')](_0x3c3ee1));_0x2473c0(_0x3c3ee1);})[_0x8034('0x17')](function(_0x2837e2){logger[_0x8034('0x12')](_0x8034('0x18'),_0x2837e2['message'],_0x427ffd);_0x4fc281(_0x1f559b['error'](0x1f4,_0x2837e2['message']));});});};exports['CreateVoiceCallReport']=function(_0x2b5b74){var _0x4cd264=this;return new Promise(function(_0x3d87b0,_0x3d4beb){return db['VoiceCallReport'][_0x8034('0x21')](_0x2b5b74['body'],{'raw':_0x2b5b74[_0x8034('0x1c')]?_0x2b5b74[_0x8034('0x1c')][_0x8034('0x22')]===undefined?!![]:![]:!![]})[_0x8034('0xc')](function(_0x29a8d2){logger[_0x8034('0xd')](_0x8034('0x23'),_0x2b5b74);logger[_0x8034('0xf')](_0x8034('0x23'),_0x2b5b74,JSON['stringify'](_0x29a8d2));_0x3d87b0(_0x29a8d2);})[_0x8034('0x17')](function(_0x3c05fc){logger[_0x8034('0x12')](_0x8034('0x23'),_0x3c05fc['message'],_0x2b5b74);_0x3d4beb(_0x4cd264[_0x8034('0x12')](0x1f4,_0x3c05fc['message']));});});};exports[_0x8034('0x24')]=function(_0x41e638){var _0x1821f7=this;return new Promise(function(_0x10f0b6,_0x343e6a){return db[_0x8034('0x19')][_0x8034('0x25')](_0x41e638[_0x8034('0x26')],{'raw':_0x41e638[_0x8034('0x1c')]?_0x41e638[_0x8034('0x1c')][_0x8034('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41e638[_0x8034('0x1c')]?_0x41e638[_0x8034('0x1c')]['where']||null:null,'attributes':_0x41e638[_0x8034('0x1c')]?_0x41e638[_0x8034('0x1c')][_0x8034('0x1d')]||null:null,'limit':_0x41e638[_0x8034('0x1c')]?_0x41e638[_0x8034('0x1c')][_0x8034('0x1e')]||null:null})['then'](function(_0x95dce2){logger[_0x8034('0xd')]('UpdateVoiceCallReport',_0x41e638);logger['debug'](_0x8034('0x24'),_0x41e638,JSON[_0x8034('0x11')](_0x95dce2));_0x10f0b6(_0x95dce2);})['catch'](function(_0x44fc88){logger[_0x8034('0x12')](_0x8034('0x24'),_0x44fc88[_0x8034('0x14')],_0x41e638);_0x343e6a(_0x1821f7[_0x8034('0x12')](0x1f4,_0x44fc88[_0x8034('0x14')]));});});}; \ No newline at end of file +var _0x6502=['raw','where','attributes','limit','map','include','model','debug','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options'];(function(_0x44674e,_0x347237){var _0x5aba7e=function(_0x2da505){while(--_0x2da505){_0x44674e['push'](_0x44674e['shift']());}};_0x5aba7e(++_0x347237);}(_0x6502,0xf6));var _0x2650=function(_0x1f77cc,_0xacb2df){_0x1f77cc=_0x1f77cc-0x0;var _0x1da892=_0x6502[_0x1f77cc];return _0x1da892;};'use strict';var _=require('lodash');var util=require(_0x2650('0x0'));var moment=require(_0x2650('0x1'));var BPromise=require(_0x2650('0x2'));var rs=require(_0x2650('0x3'));var fs=require('fs');var Redis=require(_0x2650('0x4'));var db=require(_0x2650('0x5'))['db'];var utils=require(_0x2650('0x6'));var logger=require(_0x2650('0x7'))(_0x2650('0x8'));var config=require('../../config/environment');var jayson=require(_0x2650('0x9'));var client=jayson[_0x2650('0xa')][_0x2650('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e1413,_0x546315,_0x14b10e){return new BPromise(function(_0x198108,_0x28df19){return client['request'](_0x5e1413,_0x14b10e)[_0x2650('0xc')](function(_0x2ac506){logger[_0x2650('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x546315,'request\x20sent');logger['debug'](_0x2650('0xe'),_0x546315,_0x2650('0xf'),JSON[_0x2650('0x10')](_0x2ac506));if(_0x2ac506[_0x2650('0x11')]){if(_0x2ac506[_0x2650('0x11')][_0x2650('0x12')]===0x1f4){logger[_0x2650('0x11')](_0x2650('0x13'),_0x546315,_0x2ac506[_0x2650('0x11')][_0x2650('0x14')]);return _0x28df19(_0x2ac506[_0x2650('0x11')][_0x2650('0x14')]);}logger['error'](_0x2650('0x13'),_0x546315,_0x2ac506['error'][_0x2650('0x14')]);return _0x198108(_0x2ac506[_0x2650('0x11')]['message']);}else{logger[_0x2650('0xd')](_0x2650('0x13'),_0x546315,_0x2650('0xf'));_0x198108(_0x2ac506[_0x2650('0x15')]['message']);}})[_0x2650('0x16')](function(_0x298799){logger['error'](_0x2650('0x13'),_0x546315,_0x298799);_0x28df19(_0x298799);});});}exports[_0x2650('0x17')]=function(_0x14f75a){var _0x5a4dbf=this;return new Promise(function(_0x1c5086,_0x3071dc){return db[_0x2650('0x18')][_0x2650('0x19')]({'raw':_0x14f75a[_0x2650('0x1a')]?_0x14f75a[_0x2650('0x1a')][_0x2650('0x1b')]===undefined?!![]:![]:!![],'where':_0x14f75a[_0x2650('0x1a')]?_0x14f75a[_0x2650('0x1a')][_0x2650('0x1c')]||null:null,'attributes':_0x14f75a[_0x2650('0x1a')]?_0x14f75a[_0x2650('0x1a')][_0x2650('0x1d')]||null:null,'limit':_0x14f75a[_0x2650('0x1a')]?_0x14f75a[_0x2650('0x1a')][_0x2650('0x1e')]||null:null,'include':_0x14f75a['options']?_0x14f75a[_0x2650('0x1a')]['include']?_[_0x2650('0x1f')](_0x14f75a[_0x2650('0x1a')][_0x2650('0x20')],function(_0x453792){return{'model':db[_0x453792[_0x2650('0x21')]],'as':_0x453792['as'],'attributes':_0x453792[_0x2650('0x1d')],'include':_0x453792[_0x2650('0x20')]?_[_0x2650('0x1f')](_0x453792['include'],function(_0x3552d2){return{'model':db[_0x3552d2['model']],'as':_0x3552d2['as'],'attributes':_0x3552d2[_0x2650('0x1d')],'include':_0x3552d2[_0x2650('0x20')]?_['map'](_0x3552d2[_0x2650('0x20')],function(_0x238b87){return{'model':db[_0x238b87[_0x2650('0x21')]],'as':_0x238b87['as'],'attributes':_0x238b87['attributes']};}):[]};}):[]};}):[]:[]})[_0x2650('0xc')](function(_0x207da1){logger[_0x2650('0xd')](_0x2650('0x17'),_0x14f75a);logger[_0x2650('0x22')](_0x2650('0x17'),_0x14f75a,JSON['stringify'](_0x207da1));_0x1c5086(_0x207da1);})[_0x2650('0x16')](function(_0x3a0bc5){logger[_0x2650('0x11')](_0x2650('0x17'),_0x3a0bc5['message'],_0x14f75a);_0x3071dc(_0x5a4dbf[_0x2650('0x11')](0x1f4,_0x3a0bc5[_0x2650('0x14')]));});});};exports[_0x2650('0x23')]=function(_0x1e4d06){var _0x3a8234=this;return new Promise(function(_0x106b6d,_0xa206ef){return db['VoiceCallReport'][_0x2650('0x24')](_0x1e4d06[_0x2650('0x25')],{'raw':_0x1e4d06['options']?_0x1e4d06['options']['raw']===undefined?!![]:![]:!![]})[_0x2650('0xc')](function(_0x381887){logger[_0x2650('0xd')](_0x2650('0x23'),_0x1e4d06);logger['debug'](_0x2650('0x23'),_0x1e4d06,JSON[_0x2650('0x10')](_0x381887));_0x106b6d(_0x381887);})['catch'](function(_0x18b11d){logger[_0x2650('0x11')](_0x2650('0x23'),_0x18b11d[_0x2650('0x14')],_0x1e4d06);_0xa206ef(_0x3a8234['error'](0x1f4,_0x18b11d[_0x2650('0x14')]));});});};exports[_0x2650('0x26')]=function(_0x1ea69e){var _0x20ac4f=this;return new Promise(function(_0x4b0a23,_0x4dc0ec){return db[_0x2650('0x18')]['update'](_0x1ea69e['body'],{'raw':_0x1ea69e[_0x2650('0x1a')]?_0x1ea69e['options'][_0x2650('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ea69e[_0x2650('0x1a')]?_0x1ea69e[_0x2650('0x1a')][_0x2650('0x1c')]||null:null,'attributes':_0x1ea69e[_0x2650('0x1a')]?_0x1ea69e[_0x2650('0x1a')][_0x2650('0x1d')]||null:null,'limit':_0x1ea69e['options']?_0x1ea69e[_0x2650('0x1a')][_0x2650('0x1e')]||null:null})[_0x2650('0xc')](function(_0x386e3f){logger[_0x2650('0xd')](_0x2650('0x26'),_0x1ea69e);logger[_0x2650('0x22')](_0x2650('0x26'),_0x1ea69e,JSON[_0x2650('0x10')](_0x386e3f));_0x4b0a23(_0x386e3f);})[_0x2650('0x16')](function(_0x4a641c){logger[_0x2650('0x11')](_0x2650('0x26'),_0x4a641c[_0x2650('0x14')],_0x1ea69e);_0x4dc0ec(_0x20ac4f[_0x2650('0x11')](0x1f4,_0x4a641c[_0x2650('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 43cc407..0e4ea24 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 _0x4759=['../../components/auth/service','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x4759,0x13c));var _0x9475=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x4759[_0x12d033];return _0x3b4e80;};'use strict';var multer=require(_0x9475('0x0'));var util=require(_0x9475('0x1'));var path=require(_0x9475('0x2'));var timeout=require(_0x9475('0x3'));var express=require(_0x9475('0x4'));var router=express[_0x9475('0x5')]();var fs_extra=require(_0x9475('0x6'));var auth=require(_0x9475('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9475('0x8'));router[_0x9475('0x9')]('/',auth[_0x9475('0xa')](),controller[_0x9475('0xb')]);router['get'](_0x9475('0xc'),auth[_0x9475('0xa')](),controller[_0x9475('0xd')]);router[_0x9475('0xe')]('/',auth[_0x9475('0xa')](),controller[_0x9475('0xf')]);router['put'](_0x9475('0xc'),auth[_0x9475('0xa')](),controller[_0x9475('0x10')]);router[_0x9475('0x11')]('/:id',auth[_0x9475('0xa')](),controller[_0x9475('0x12')]);module['exports']=router; \ No newline at end of file +var _0x701d=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','get','show','post','put','/:id','update','delete','multer','util','path','connect-timeout','express','Router'];(function(_0x382f34,_0x34347e){var _0x231ecc=function(_0x36915b){while(--_0x36915b){_0x382f34['push'](_0x382f34['shift']());}};_0x231ecc(++_0x34347e);}(_0x701d,0x126));var _0xd701=function(_0x102a36,_0x576780){_0x102a36=_0x102a36-0x0;var _0x4e11e6=_0x701d[_0x102a36];return _0x4e11e6;};'use strict';var multer=require(_0xd701('0x0'));var util=require(_0xd701('0x1'));var path=require(_0xd701('0x2'));var timeout=require(_0xd701('0x3'));var express=require(_0xd701('0x4'));var router=express[_0xd701('0x5')]();var fs_extra=require(_0xd701('0x6'));var auth=require(_0xd701('0x7'));var interaction=require(_0xd701('0x8'));var config=require(_0xd701('0x9'));var controller=require(_0xd701('0xa'));router['get']('/',auth[_0xd701('0xb')](),controller[_0xd701('0xc')]);router[_0xd701('0xd')]('/:id',auth[_0xd701('0xb')](),controller[_0xd701('0xe')]);router[_0xd701('0xf')]('/',auth[_0xd701('0xb')](),controller['create']);router[_0xd701('0x10')](_0xd701('0x11'),auth[_0xd701('0xb')](),controller[_0xd701('0x12')]);router[_0xd701('0x13')](_0xd701('0x11'),auth[_0xd701('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index bc9e5df..18a2079 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 _0x51fb=['split','BOOLEAN','STRING','sequelize','exports','name','setDataValue','join','options'];(function(_0x27c190,_0x550696){var _0x45661e=function(_0x433abd){while(--_0x433abd){_0x27c190['push'](_0x27c190['shift']());}};_0x45661e(++_0x550696);}(_0x51fb,0x174));var _0xb51f=function(_0x22aa6a,_0x178874){_0x22aa6a=_0x22aa6a-0x0;var _0x3425c3=_0x51fb[_0x22aa6a];return _0x3425c3;};'use strict';var Sequelize=require(_0xb51f('0x0'));module[_0xb51f('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0xb51f('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x11ef88){this[_0xb51f('0x3')]('options',_0x11ef88?_0x11ef88[_0xb51f('0x4')](''):[]);},'get':function(){return this['getDataValue']('options')?this['getDataValue'](_0xb51f('0x5'))[_0xb51f('0x6')](''):[];}},'auth':{'type':Sequelize[_0xb51f('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xb51f('0x8')]},'record':{'type':Sequelize[_0xb51f('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xb51f('0x8')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8d85=['exports','STRING','name','getDataValue','options','split','BOOLEAN','sequelize'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x8d85,0x187));var _0x58d8=function(_0x265c0e,_0x2277d6){_0x265c0e=_0x265c0e-0x0;var _0xd8a413=_0x8d85[_0x265c0e];return _0xd8a413;};'use strict';var Sequelize=require(_0x58d8('0x0'));module[_0x58d8('0x1')]={'name':{'type':Sequelize[_0x58d8('0x2')]},'prefix':{'type':Sequelize[_0x58d8('0x2')],'unique':_0x58d8('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x58d8('0x2')],'set':function(_0x51d7ad){this['setDataValue']('options',_0x51d7ad?_0x51d7ad['join'](''):[]);},'get':function(){return this[_0x58d8('0x4')]('options')?this['getDataValue'](_0x58d8('0x5'))[_0x58d8('0x6')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x58d8('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x58d8('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 0c655b0..66ed248 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 _0x5cd8=['to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','save','update','then','destroy','ChanSpies','UserProfileResource','error','name','send','map','VoiceChanSpy','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','order','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','show','params','length','includeAll','options','catch','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','autoAssociation','create','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox'];(function(_0x12a1e1,_0x581d7b){var _0x567133=function(_0x406a5f){while(--_0x406a5f){_0x12a1e1['push'](_0x12a1e1['shift']());}};_0x567133(++_0x581d7b);}(_0x5cd8,0x1d2));var _0x85cd=function(_0x46e1bc,_0x4275bf){_0x46e1bc=_0x46e1bc-0x0;var _0x74333b=_0x5cd8[_0x46e1bc];return _0x74333b;};'use strict';var emlformat=require(_0x85cd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x85cd('0x1'));var jsonpatch=require(_0x85cd('0x2'));var rp=require(_0x85cd('0x3'));var moment=require(_0x85cd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x85cd('0x5'));var util=require('util');var path=require(_0x85cd('0x6'));var sox=require(_0x85cd('0x7'));var csv=require(_0x85cd('0x8'));var ejs=require(_0x85cd('0x9'));var fs=require('fs');var fs_extra=require(_0x85cd('0xa'));var _=require('lodash');var squel=require(_0x85cd('0xb'));var crypto=require(_0x85cd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x85cd('0xd'));var toCsv=require(_0x85cd('0x8'));var querystring=require(_0x85cd('0xe'));var Papa=require(_0x85cd('0xf'));var Redis=require(_0x85cd('0x10'));var authService=require(_0x85cd('0x11'));var qs=require(_0x85cd('0x12'));var as=require(_0x85cd('0x13'));var hardwareService=require(_0x85cd('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x85cd('0x15'));var config=require(_0x85cd('0x16'));var licenseUtil=require(_0x85cd('0x17'));var db=require(_0x85cd('0x18'))['db'];function respondWithStatusCode(_0x4f054b,_0x3c3ffe){_0x3c3ffe=_0x3c3ffe||0xcc;return function(_0x398f7c){if(_0x398f7c){return _0x4f054b[_0x85cd('0x19')](_0x3c3ffe);}return _0x4f054b[_0x85cd('0x1a')](_0x3c3ffe)[_0x85cd('0x1b')]();};}function respondWithResult(_0x3639c2,_0x58c13e){_0x58c13e=_0x58c13e||0xc8;return function(_0x3d4c54){if(_0x3d4c54){return _0x3639c2['status'](_0x58c13e)[_0x85cd('0x1c')](_0x3d4c54);}};}function respondWithFilteredResult(_0x3e5e89,_0x208490){return function(_0x424a01){if(_0x424a01){var _0xedc03b=typeof _0x208490['offset']===_0x85cd('0x1d')&&typeof _0x208490['limit']===_0x85cd('0x1d');var _0x51dc9c=_0x424a01[_0x85cd('0x1e')];var _0x4d9c64=_0xedc03b?0x0:_0x208490[_0x85cd('0x1f')];var _0x11292e=_0xedc03b?_0x424a01[_0x85cd('0x1e')]:_0x208490[_0x85cd('0x1f')]+_0x208490[_0x85cd('0x20')];var _0x1123c0;if(_0x11292e>=_0x51dc9c){_0x11292e=_0x51dc9c;_0x1123c0=0xc8;}else{_0x1123c0=0xce;}_0x3e5e89[_0x85cd('0x1a')](_0x1123c0);return _0x3e5e89[_0x85cd('0x21')]('Content-Range',_0x4d9c64+'-'+_0x11292e+'/'+_0x51dc9c)[_0x85cd('0x1c')](_0x424a01);}return null;};}function patchUpdates(_0x425779){return function(_0x5bb4cc){try{jsonpatch['apply'](_0x5bb4cc,_0x425779,!![]);}catch(_0x5c268f){return BPromise['reject'](_0x5c268f);}return _0x5bb4cc[_0x85cd('0x22')]();};}function saveUpdates(_0x597e6e,_0x3cf6c6){return function(_0x2385e7){if(_0x2385e7){return _0x2385e7[_0x85cd('0x23')](_0x597e6e)[_0x85cd('0x24')](function(_0x592b77){return _0x592b77;});}return null;};}function removeEntity(_0x290b57,_0x2b00a8){return function(_0x358202){if(_0x358202){return _0x358202[_0x85cd('0x25')]()[_0x85cd('0x24')](function(){var _0x37646b=_0x358202['get']({'plain':!![]});var _0xb3500f=_0x85cd('0x26');return db[_0x85cd('0x27')][_0x85cd('0x25')]({'where':{'type':_0xb3500f,'resourceId':_0x37646b['id']}})['then'](function(){return _0x358202;});})[_0x85cd('0x24')](function(){_0x290b57[_0x85cd('0x1a')](0xcc)[_0x85cd('0x1b')]();});}};}function handleEntityNotFound(_0x5a58a0,_0x48e80d){return function(_0x2ea68b){if(!_0x2ea68b){_0x5a58a0['sendStatus'](0x194);}return _0x2ea68b;};}function handleError(_0x1c6db6,_0x1f36ad){_0x1f36ad=_0x1f36ad||0x1f4;return function(_0x26e79c){logger[_0x85cd('0x28')](_0x26e79c['stack']);if(_0x26e79c[_0x85cd('0x29')]){delete _0x26e79c[_0x85cd('0x29')];}_0x1c6db6[_0x85cd('0x1a')](_0x1f36ad)[_0x85cd('0x2a')](_0x26e79c);};}exports['index']=function(_0x331415,_0x1334c1){var _0x1872cf={},_0x51b2fc={},_0x5b2c6f={'count':0x0,'rows':[]};var _0x9eda6c=_[_0x85cd('0x2b')](db[_0x85cd('0x2c')][_0x85cd('0x2d')],function(_0x439af1){return{'name':_0x439af1[_0x85cd('0x2e')],'type':_0x439af1[_0x85cd('0x2f')][_0x85cd('0x30')]};});_0x51b2fc['model']=_[_0x85cd('0x2b')](_0x9eda6c,_0x85cd('0x29'));_0x51b2fc[_0x85cd('0x31')]=_[_0x85cd('0x32')](_0x331415['query']);_0x51b2fc[_0x85cd('0x33')]=_[_0x85cd('0x34')](_0x51b2fc[_0x85cd('0x35')],_0x51b2fc[_0x85cd('0x31')]);_0x1872cf[_0x85cd('0x36')]=_['intersection'](_0x51b2fc[_0x85cd('0x35')],qs[_0x85cd('0x37')](_0x331415['query'][_0x85cd('0x37')]));_0x1872cf[_0x85cd('0x36')]=_0x1872cf[_0x85cd('0x36')]['length']?_0x1872cf['attributes']:_0x51b2fc[_0x85cd('0x35')];if(!_0x331415[_0x85cd('0x31')]['hasOwnProperty']('nolimit')){_0x1872cf[_0x85cd('0x20')]=qs['limit'](_0x331415['query'][_0x85cd('0x20')]);_0x1872cf[_0x85cd('0x1f')]=qs[_0x85cd('0x1f')](_0x331415[_0x85cd('0x31')][_0x85cd('0x1f')]);}_0x1872cf[_0x85cd('0x38')]=qs[_0x85cd('0x39')](_0x331415[_0x85cd('0x31')][_0x85cd('0x39')]);_0x1872cf[_0x85cd('0x3a')]=qs[_0x85cd('0x33')](_[_0x85cd('0x3b')](_0x331415[_0x85cd('0x31')],_0x51b2fc[_0x85cd('0x33')]),_0x9eda6c);if(_0x331415[_0x85cd('0x31')]['filter']){_0x1872cf[_0x85cd('0x3a')]=_[_0x85cd('0x3c')](_0x1872cf[_0x85cd('0x3a')],{'$or':_[_0x85cd('0x2b')](_0x9eda6c,function(_0x38ecf5){if(_0x38ecf5[_0x85cd('0x2f')]!==_0x85cd('0x3d')){var _0x46c8f2={};_0x46c8f2[_0x38ecf5[_0x85cd('0x29')]]={'$like':'%'+_0x331415[_0x85cd('0x31')][_0x85cd('0x3e')]+'%'};return _0x46c8f2;}})});}_0x1872cf=_['merge']({},_0x1872cf,_0x331415['options']);var _0x467589={'where':_0x1872cf[_0x85cd('0x3a')]};return db[_0x85cd('0x2c')][_0x85cd('0x1e')](_0x467589)['then'](function(_0x324626){_0x5b2c6f[_0x85cd('0x1e')]=_0x324626;if(_0x331415[_0x85cd('0x31')]['includeAll']){_0x1872cf[_0x85cd('0x3f')]=[{'all':!![]}];}return db[_0x85cd('0x2c')][_0x85cd('0x40')](_0x1872cf);})[_0x85cd('0x24')](function(_0x2a0518){_0x5b2c6f[_0x85cd('0x41')]=_0x2a0518;return _0x5b2c6f;})['then'](respondWithFilteredResult(_0x1334c1,_0x1872cf))['catch'](handleError(_0x1334c1,null));};exports[_0x85cd('0x42')]=function(_0x36d721,_0x3f2b8a){var _0x4e4ef0={'raw':![],'where':{'id':_0x36d721[_0x85cd('0x43')]['id']}},_0x425e21={};_0x425e21[_0x85cd('0x35')]=_['keys'](db[_0x85cd('0x2c')]['rawAttributes']);_0x425e21['query']=_[_0x85cd('0x32')](_0x36d721[_0x85cd('0x31')]);_0x425e21[_0x85cd('0x33')]=_[_0x85cd('0x34')](_0x425e21[_0x85cd('0x35')],_0x425e21[_0x85cd('0x31')]);_0x4e4ef0['attributes']=_[_0x85cd('0x34')](_0x425e21[_0x85cd('0x35')],qs[_0x85cd('0x37')](_0x36d721[_0x85cd('0x31')][_0x85cd('0x37')]));_0x4e4ef0[_0x85cd('0x36')]=_0x4e4ef0[_0x85cd('0x36')][_0x85cd('0x44')]?_0x4e4ef0['attributes']:_0x425e21['model'];if(_0x36d721[_0x85cd('0x31')][_0x85cd('0x45')]){_0x4e4ef0[_0x85cd('0x3f')]=[{'all':!![]}];}_0x4e4ef0=_[_0x85cd('0x3c')]({},_0x4e4ef0,_0x36d721[_0x85cd('0x46')]);return db[_0x85cd('0x2c')]['find'](_0x4e4ef0)[_0x85cd('0x24')](handleEntityNotFound(_0x3f2b8a,null))[_0x85cd('0x24')](respondWithResult(_0x3f2b8a,null))[_0x85cd('0x47')](handleError(_0x3f2b8a,null));};exports['create']=function(_0x4c50bc,_0x5a746c){return db['VoiceChanSpy']['create'](_0x4c50bc[_0x85cd('0x48')],{})['then'](function(_0x4caf62){var _0x5ca77c=_0x4c50bc[_0x85cd('0x49')][_0x85cd('0x4a')]({'plain':!![]});if(!_0x5ca77c)throw new Error(_0x85cd('0x4b'));if(_0x5ca77c['role']===_0x85cd('0x49')){var _0x15f4f1=_0x4caf62['get']({'plain':!![]});var _0x58f5ce=_0x85cd('0x26');return db['UserProfileSection'][_0x85cd('0x4c')]({'where':{'name':_0x58f5ce,'userProfileId':_0x5ca77c['userProfileId']},'raw':!![]})[_0x85cd('0x24')](function(_0x17f378){if(_0x17f378&&_0x17f378[_0x85cd('0x4d')]===0x0){return db['UserProfileResource'][_0x85cd('0x4e')]({'name':_0x15f4f1[_0x85cd('0x29')],'resourceId':_0x15f4f1['id'],'type':_0x17f378[_0x85cd('0x29')],'sectionId':_0x17f378['id']},{})[_0x85cd('0x24')](function(){return _0x4caf62;});}else{return _0x4caf62;}})['catch'](function(_0x1fbee7){logger[_0x85cd('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1fbee7);throw _0x1fbee7;});}return _0x4caf62;})[_0x85cd('0x24')](respondWithResult(_0x5a746c,0xc9))['catch'](handleError(_0x5a746c,null));};exports[_0x85cd('0x23')]=function(_0x462b04,_0xa10d45){if(_0x462b04[_0x85cd('0x48')]['id']){delete _0x462b04[_0x85cd('0x48')]['id'];}return db[_0x85cd('0x2c')]['find']({'where':{'id':_0x462b04['params']['id']}})[_0x85cd('0x24')](handleEntityNotFound(_0xa10d45,null))[_0x85cd('0x24')](saveUpdates(_0x462b04[_0x85cd('0x48')],null))[_0x85cd('0x24')](respondWithResult(_0xa10d45,null))['catch'](handleError(_0xa10d45,null));};exports[_0x85cd('0x25')]=function(_0x1afbff,_0x1d2293){return db[_0x85cd('0x2c')][_0x85cd('0x4c')]({'where':{'id':_0x1afbff[_0x85cd('0x43')]['id']}})[_0x85cd('0x24')](handleEntityNotFound(_0x1d2293,null))['then'](removeEntity(_0x1d2293,null))['catch'](handleError(_0x1d2293,null));}; \ No newline at end of file +var _0xe80c=['model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','show','keys','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChanSpies','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','json','offset','count','limit','Content-Range','reject','save','then','destroy','get','UserProfileResource','status','sendStatus','error','stack','name','send','index','VoiceChanSpy','rawAttributes','fieldName','type','key'];(function(_0x420f2a,_0x2cc58d){var _0x28f802=function(_0x3329cc){while(--_0x3329cc){_0x420f2a['push'](_0x420f2a['shift']());}};_0x28f802(++_0x2cc58d);}(_0xe80c,0x1c2));var _0xce80=function(_0x52e0b4,_0x99d4e1){_0x52e0b4=_0x52e0b4-0x0;var _0x57e02b=_0xe80c[_0x52e0b4];return _0x57e02b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xce80('0x0'));var zipdir=require(_0xce80('0x1'));var jsonpatch=require(_0xce80('0x2'));var rp=require(_0xce80('0x3'));var moment=require(_0xce80('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xce80('0x5'));var util=require(_0xce80('0x6'));var path=require(_0xce80('0x7'));var sox=require(_0xce80('0x8'));var csv=require('to-csv');var ejs=require(_0xce80('0x9'));var fs=require('fs');var fs_extra=require(_0xce80('0xa'));var _=require(_0xce80('0xb'));var squel=require('squel');var crypto=require(_0xce80('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xce80('0xd'));var toCsv=require('to-csv');var querystring=require(_0xce80('0xe'));var Papa=require(_0xce80('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xce80('0x10'));var as=require(_0xce80('0x11'));var hardwareService=require(_0xce80('0x12'));var logger=require(_0xce80('0x13'))(_0xce80('0x14'));var utils=require(_0xce80('0x15'));var config=require(_0xce80('0x16'));var licenseUtil=require(_0xce80('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45a9b7,_0x37561b){_0x37561b=_0x37561b||0xcc;return function(_0x12d8c7){if(_0x12d8c7){return _0x45a9b7['sendStatus'](_0x37561b);}return _0x45a9b7['status'](_0x37561b)[_0xce80('0x18')]();};}function respondWithResult(_0x1903ec,_0x15f870){_0x15f870=_0x15f870||0xc8;return function(_0x3cac82){if(_0x3cac82){return _0x1903ec['status'](_0x15f870)[_0xce80('0x19')](_0x3cac82);}};}function respondWithFilteredResult(_0x5d134e,_0x9402b9){return function(_0x48796f){if(_0x48796f){var _0x24efa3=typeof _0x9402b9[_0xce80('0x1a')]==='undefined'&&typeof _0x9402b9['limit']==='undefined';var _0x35b40d=_0x48796f[_0xce80('0x1b')];var _0x148d57=_0x24efa3?0x0:_0x9402b9[_0xce80('0x1a')];var _0x4375b7=_0x24efa3?_0x48796f['count']:_0x9402b9[_0xce80('0x1a')]+_0x9402b9[_0xce80('0x1c')];var _0x4d4345;if(_0x4375b7>=_0x35b40d){_0x4375b7=_0x35b40d;_0x4d4345=0xc8;}else{_0x4d4345=0xce;}_0x5d134e['status'](_0x4d4345);return _0x5d134e['set'](_0xce80('0x1d'),_0x148d57+'-'+_0x4375b7+'/'+_0x35b40d)[_0xce80('0x19')](_0x48796f);}return null;};}function patchUpdates(_0x468b61){return function(_0x44f399){try{jsonpatch['apply'](_0x44f399,_0x468b61,!![]);}catch(_0x259a0b){return BPromise[_0xce80('0x1e')](_0x259a0b);}return _0x44f399[_0xce80('0x1f')]();};}function saveUpdates(_0x5315eb,_0x4df9bb){return function(_0x116b5e){if(_0x116b5e){return _0x116b5e['update'](_0x5315eb)[_0xce80('0x20')](function(_0x348d2d){return _0x348d2d;});}return null;};}function removeEntity(_0x2c5d01,_0x34f511){return function(_0x4fc91c){if(_0x4fc91c){return _0x4fc91c[_0xce80('0x21')]()['then'](function(){var _0x42a1dd=_0x4fc91c[_0xce80('0x22')]({'plain':!![]});var _0x4cd1f5='ChanSpies';return db[_0xce80('0x23')]['destroy']({'where':{'type':_0x4cd1f5,'resourceId':_0x42a1dd['id']}})[_0xce80('0x20')](function(){return _0x4fc91c;});})[_0xce80('0x20')](function(){_0x2c5d01[_0xce80('0x24')](0xcc)[_0xce80('0x18')]();});}};}function handleEntityNotFound(_0x4c3e8a,_0x8fd32c){return function(_0x148e90){if(!_0x148e90){_0x4c3e8a[_0xce80('0x25')](0x194);}return _0x148e90;};}function handleError(_0x3d7c49,_0x2e19da){_0x2e19da=_0x2e19da||0x1f4;return function(_0x4792fe){logger[_0xce80('0x26')](_0x4792fe[_0xce80('0x27')]);if(_0x4792fe['name']){delete _0x4792fe[_0xce80('0x28')];}_0x3d7c49[_0xce80('0x24')](_0x2e19da)[_0xce80('0x29')](_0x4792fe);};}exports[_0xce80('0x2a')]=function(_0x279931,_0x2f445c){var _0x3b8b30={},_0x50da6e={},_0x52e1bb={'count':0x0,'rows':[]};var _0x58e8d0=_['map'](db[_0xce80('0x2b')][_0xce80('0x2c')],function(_0x39c1c0){return{'name':_0x39c1c0[_0xce80('0x2d')],'type':_0x39c1c0[_0xce80('0x2e')][_0xce80('0x2f')]};});_0x50da6e[_0xce80('0x30')]=_[_0xce80('0x31')](_0x58e8d0,'name');_0x50da6e[_0xce80('0x32')]=_['keys'](_0x279931[_0xce80('0x32')]);_0x50da6e[_0xce80('0x33')]=_[_0xce80('0x34')](_0x50da6e[_0xce80('0x30')],_0x50da6e[_0xce80('0x32')]);_0x3b8b30[_0xce80('0x35')]=_['intersection'](_0x50da6e[_0xce80('0x30')],qs[_0xce80('0x36')](_0x279931[_0xce80('0x32')][_0xce80('0x36')]));_0x3b8b30[_0xce80('0x35')]=_0x3b8b30[_0xce80('0x35')]['length']?_0x3b8b30['attributes']:_0x50da6e[_0xce80('0x30')];if(!_0x279931[_0xce80('0x32')][_0xce80('0x37')](_0xce80('0x38'))){_0x3b8b30[_0xce80('0x1c')]=qs['limit'](_0x279931[_0xce80('0x32')][_0xce80('0x1c')]);_0x3b8b30[_0xce80('0x1a')]=qs[_0xce80('0x1a')](_0x279931[_0xce80('0x32')][_0xce80('0x1a')]);}_0x3b8b30[_0xce80('0x39')]=qs[_0xce80('0x3a')](_0x279931[_0xce80('0x32')][_0xce80('0x3a')]);_0x3b8b30['where']=qs[_0xce80('0x33')](_['pick'](_0x279931[_0xce80('0x32')],_0x50da6e[_0xce80('0x33')]),_0x58e8d0);if(_0x279931[_0xce80('0x32')][_0xce80('0x3b')]){_0x3b8b30[_0xce80('0x3c')]=_['merge'](_0x3b8b30[_0xce80('0x3c')],{'$or':_[_0xce80('0x31')](_0x58e8d0,function(_0x5d0b1b){if(_0x5d0b1b['type']!==_0xce80('0x3d')){var _0x4908c8={};_0x4908c8[_0x5d0b1b[_0xce80('0x28')]]={'$like':'%'+_0x279931[_0xce80('0x32')][_0xce80('0x3b')]+'%'};return _0x4908c8;}})});}_0x3b8b30=_[_0xce80('0x3e')]({},_0x3b8b30,_0x279931[_0xce80('0x3f')]);var _0xbdd463={'where':_0x3b8b30['where']};return db[_0xce80('0x2b')][_0xce80('0x1b')](_0xbdd463)[_0xce80('0x20')](function(_0x12bb2c){_0x52e1bb['count']=_0x12bb2c;if(_0x279931[_0xce80('0x32')]['includeAll']){_0x3b8b30[_0xce80('0x40')]=[{'all':!![]}];}return db[_0xce80('0x2b')][_0xce80('0x41')](_0x3b8b30);})[_0xce80('0x20')](function(_0x338393){_0x52e1bb[_0xce80('0x42')]=_0x338393;return _0x52e1bb;})[_0xce80('0x20')](respondWithFilteredResult(_0x2f445c,_0x3b8b30))[_0xce80('0x43')](handleError(_0x2f445c,null));};exports[_0xce80('0x44')]=function(_0x5ef5a2,_0x268516){var _0x1a2bf2={'raw':![],'where':{'id':_0x5ef5a2['params']['id']}},_0x215d8f={};_0x215d8f[_0xce80('0x30')]=_[_0xce80('0x45')](db[_0xce80('0x2b')]['rawAttributes']);_0x215d8f[_0xce80('0x32')]=_['keys'](_0x5ef5a2[_0xce80('0x32')]);_0x215d8f[_0xce80('0x33')]=_[_0xce80('0x34')](_0x215d8f['model'],_0x215d8f[_0xce80('0x32')]);_0x1a2bf2[_0xce80('0x35')]=_[_0xce80('0x34')](_0x215d8f['model'],qs[_0xce80('0x36')](_0x5ef5a2['query']['fields']));_0x1a2bf2[_0xce80('0x35')]=_0x1a2bf2[_0xce80('0x35')][_0xce80('0x46')]?_0x1a2bf2[_0xce80('0x35')]:_0x215d8f[_0xce80('0x30')];if(_0x5ef5a2[_0xce80('0x32')][_0xce80('0x47')]){_0x1a2bf2[_0xce80('0x40')]=[{'all':!![]}];}_0x1a2bf2=_['merge']({},_0x1a2bf2,_0x5ef5a2[_0xce80('0x3f')]);return db['VoiceChanSpy'][_0xce80('0x48')](_0x1a2bf2)[_0xce80('0x20')](handleEntityNotFound(_0x268516,null))[_0xce80('0x20')](respondWithResult(_0x268516,null))[_0xce80('0x43')](handleError(_0x268516,null));};exports[_0xce80('0x49')]=function(_0x118583,_0x595662){return db[_0xce80('0x2b')]['create'](_0x118583[_0xce80('0x4a')],{})['then'](function(_0x58a336){var _0x28d4e6=_0x118583[_0xce80('0x4b')][_0xce80('0x22')]({'plain':!![]});if(!_0x28d4e6)throw new Error(_0xce80('0x4c'));if(_0x28d4e6['role']===_0xce80('0x4b')){var _0xc420ef=_0x58a336['get']({'plain':!![]});var _0x300901=_0xce80('0x4d');return db[_0xce80('0x4e')][_0xce80('0x48')]({'where':{'name':_0x300901,'userProfileId':_0x28d4e6['userProfileId']},'raw':!![]})['then'](function(_0x4a1ce1){if(_0x4a1ce1&&_0x4a1ce1[_0xce80('0x4f')]===0x0){return db[_0xce80('0x23')][_0xce80('0x49')]({'name':_0xc420ef['name'],'resourceId':_0xc420ef['id'],'type':_0x4a1ce1['name'],'sectionId':_0x4a1ce1['id']},{})[_0xce80('0x20')](function(){return _0x58a336;});}else{return _0x58a336;}})['catch'](function(_0x10d90a){logger[_0xce80('0x26')](_0xce80('0x50'),_0x10d90a);throw _0x10d90a;});}return _0x58a336;})[_0xce80('0x20')](respondWithResult(_0x595662,0xc9))[_0xce80('0x43')](handleError(_0x595662,null));};exports[_0xce80('0x51')]=function(_0x2869cf,_0x3884d8){if(_0x2869cf[_0xce80('0x4a')]['id']){delete _0x2869cf[_0xce80('0x4a')]['id'];}return db[_0xce80('0x2b')]['find']({'where':{'id':_0x2869cf[_0xce80('0x52')]['id']}})[_0xce80('0x20')](handleEntityNotFound(_0x3884d8,null))[_0xce80('0x20')](saveUpdates(_0x2869cf[_0xce80('0x4a')],null))['then'](respondWithResult(_0x3884d8,null))[_0xce80('0x43')](handleError(_0x3884d8,null));};exports['destroy']=function(_0x46a4ad,_0x1cc190){return db[_0xce80('0x2b')][_0xce80('0x48')]({'where':{'id':_0x46a4ad[_0xce80('0x52')]['id']}})[_0xce80('0x20')](handleEntityNotFound(_0x1cc190,null))[_0xce80('0x20')](removeEntity(_0x1cc190,null))[_0xce80('0x43')](handleError(_0x1cc190,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index c80000e..d7d21be 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 _0xda28=['catch','exports','define','voice_chanspy','then','VoiceExtension','bulkCreate','destroy','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','agent'];(function(_0x14e1cb,_0xd3465e){var _0x18a337=function(_0x3b97f3){while(--_0x3b97f3){_0x14e1cb['push'](_0x14e1cb['shift']());}};_0x18a337(++_0xd3465e);}(_0xda28,0x119));var _0x8da2=function(_0xe98f6e,_0x404a61){_0xe98f6e=_0xe98f6e-0x0;var _0x48db85=_0xda28[_0xe98f6e];return _0x48db85;};'use strict';var _=require('lodash');var util=require(_0x8da2('0x0'));var BPromise=require(_0x8da2('0x1'));var attributes=require(_0x8da2('0x2'));var getUserApplications=function(_0x5e89de,_0x352333,_0x1b135a){var _0x1b4957=0x1;var _0x571463=[];var _0x24e3db={'context':_0x352333[_0x8da2('0x3')]||_0x8da2('0x4'),'exten':util[_0x8da2('0x5')](_0x8da2('0x6'),_0x5e89de[_0x8da2('0x7')],_0x1b135a),'type':'system','isApp':![],'ChanSpyId':_0x5e89de['id'],'UserId':_0x352333['id']};_0x571463[_0x8da2('0x8')](_[_0x8da2('0x9')]({'app':_0x8da2('0xa'),'appdata':util[_0x8da2('0x5')](_0x8da2('0xb'),_0x8da2('0xc')),'priority':_0x1b4957++},_0x24e3db));if(_0x5e89de[_0x8da2('0xd')]){_0x571463[_0x8da2('0x8')](_[_0x8da2('0x9')]({'app':_0x8da2('0xe'),'appdata':util['format'](_0x8da2('0xf'),_0x5e89de['recordingFormat']),'priority':_0x1b4957++},_0x24e3db));}if(_0x5e89de[_0x8da2('0x10')]){_0x571463[_0x8da2('0x8')](_[_0x8da2('0x9')]({'app':_0x8da2('0x11'),'appdata':_0x5e89de[_0x8da2('0x12')],'priority':_0x1b4957++},_0x24e3db));}_0x571463['push'](_[_0x8da2('0x9')]({'app':_0x8da2('0x13'),'appdata':util['format'](_0x8da2('0x14'),_0x352333[_0x8da2('0x15')],_0x5e89de['options']?_0x5e89de[_0x8da2('0x16')][_0x8da2('0x17')](''):''),'priority':_0x1b4957++},_0x24e3db));if(_0x5e89de['record']){_0x571463[_0x8da2('0x8')](_[_0x8da2('0x9')]({'app':_0x8da2('0x18'),'priority':_0x1b4957++},_0x24e3db));}return _0x571463;};var getChanSpyApplications=function(_0x13d789,_0x5a9a63){var _0xf281ef=[];for(var _0x2dffce=0x0,_0x1fc09d=0x1;_0x2dffce<_0x5a9a63[_0x8da2('0x19')];_0x2dffce++,_0x1fc09d=0x1){_0xf281ef=_0xf281ef[_0x8da2('0x1a')](getUserApplications(_0x13d789,_0x5a9a63[_0x2dffce],_0x5a9a63[_0x2dffce]['internal']));if(_0x5a9a63[_0x2dffce][_0x8da2('0x1b')]!=_0x5a9a63[_0x2dffce][_0x8da2('0x15')]){_0xf281ef=_0xf281ef[_0x8da2('0x1a')](getUserApplications(_0x13d789,_0x5a9a63[_0x2dffce],_0x5a9a63[_0x2dffce][_0x8da2('0x15')]));}}return _0xf281ef;};var getChanSpyPromise=function(_0x4d9a97,_0x2a068d){return new BPromise(function(_0x5ebeab,_0x1d055e){return _0x4d9a97[_0x8da2('0x1c')][_0x8da2('0x1d')]({'attributes':['id',_0x8da2('0x15'),'internal'],'where':{'role':_0x8da2('0x1e'),'chanspy':!![]},'raw':!![]})['then'](function(_0x420dec){if(_0x420dec){return _0x5ebeab(getChanSpyApplications(_0x2a068d,_0x420dec));}return _0x5ebeab([]);})[_0x8da2('0x1f')](function(_0x500f74){_0x1d055e(_0x500f74);});});};module[_0x8da2('0x20')]=function(_0x18789b,_0x1361e4){var _0x474292=_0x18789b['models'];return _0x18789b[_0x8da2('0x21')]('VoiceChanSpy',attributes,{'tableName':_0x8da2('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1f04ea,_0x4e4f9e,_0x5aef5d){return getChanSpyPromise(_0x474292,_0x1f04ea)[_0x8da2('0x23')](function(_0x7a2b2c){if(_0x7a2b2c&&_0x7a2b2c[_0x8da2('0x19')]){return _0x474292[_0x8da2('0x24')][_0x8da2('0x25')](_0x7a2b2c);}})[_0x8da2('0x23')](function(){_0x5aef5d();})[_0x8da2('0x1f')](function(_0x2387e9){_0x5aef5d(_0x2387e9);});},'afterUpdate':function(_0x4b2c92,_0x29056b,_0xdc3041){return _0x474292[_0x8da2('0x24')][_0x8da2('0x26')]({'where':{'ChanSpyId':_0x4b2c92['id']}})['then'](function(){return getChanSpyPromise(_0x474292,_0x4b2c92);})['then'](function(_0xa748f7){if(_0xa748f7&&_0xa748f7[_0x8da2('0x19')]){return _0x474292[_0x8da2('0x24')]['bulkCreate'](_0xa748f7);}})[_0x8da2('0x23')](function(){_0xdc3041();})[_0x8da2('0x1f')](function(_0x54005){_0xdc3041(_0x54005);});},'afterDestroy':function(_0x5a1da3,_0x1f11db,_0x4e7927){return _0x474292[_0x8da2('0x24')][_0x8da2('0x26')]({'where':{'ChanSpyId':_0x5a1da3['id']}})['then'](function(){_0x4e7927();})[_0x8da2('0x1f')](function(_0x3fc0e9){_0x4e7927(_0x3fc0e9);});}}});}; \ No newline at end of file +var _0x08fa=['record','StopMixMonitor','concat','internal','name','User','agent','then','catch','exports','models','VoiceChanSpy','voice_chanspy','length','VoiceExtension','destroy','bluebird','from-sip','system','merge','Set','CDR(type)=%s','push','MixMonitor','format','${UNIQUEID}.%s,a','recordingFormat','password','ChanSpy','SIP/%s,%s','options','join'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x08fa,0x90));var _0xa08f=function(_0x1db5de,_0x37c0ef){_0x1db5de=_0x1db5de-0x0;var _0x4b165e=_0x08fa[_0x1db5de];return _0x4b165e;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0xa08f('0x0'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x3a9df3,_0x27d565,_0x3d0928){var _0x384931=0x1;var _0x1ffaaa=[];var _0xc44669={'context':_0x27d565['context']||_0xa08f('0x1'),'exten':util['format']('%s%s',_0x3a9df3['prefix'],_0x3d0928),'type':_0xa08f('0x2'),'isApp':![],'ChanSpyId':_0x3a9df3['id'],'UserId':_0x27d565['id']};_0x1ffaaa['push'](_[_0xa08f('0x3')]({'app':_0xa08f('0x4'),'appdata':util['format'](_0xa08f('0x5'),'chanspy'),'priority':_0x384931++},_0xc44669));if(_0x3a9df3['record']){_0x1ffaaa[_0xa08f('0x6')](_['merge']({'app':_0xa08f('0x7'),'appdata':util[_0xa08f('0x8')](_0xa08f('0x9'),_0x3a9df3[_0xa08f('0xa')]),'priority':_0x384931++},_0xc44669));}if(_0x3a9df3['auth']){_0x1ffaaa[_0xa08f('0x6')](_[_0xa08f('0x3')]({'app':'Authenticate','appdata':_0x3a9df3[_0xa08f('0xb')],'priority':_0x384931++},_0xc44669));}_0x1ffaaa[_0xa08f('0x6')](_[_0xa08f('0x3')]({'app':_0xa08f('0xc'),'appdata':util[_0xa08f('0x8')](_0xa08f('0xd'),_0x27d565['name'],_0x3a9df3[_0xa08f('0xe')]?_0x3a9df3['options'][_0xa08f('0xf')](''):''),'priority':_0x384931++},_0xc44669));if(_0x3a9df3[_0xa08f('0x10')]){_0x1ffaaa['push'](_['merge']({'app':_0xa08f('0x11'),'priority':_0x384931++},_0xc44669));}return _0x1ffaaa;};var getChanSpyApplications=function(_0x1e7c7c,_0xbf4fe2){var _0x587844=[];for(var _0xd5a9e9=0x0,_0xfc1a36=0x1;_0xd5a9e9<_0xbf4fe2['length'];_0xd5a9e9++,_0xfc1a36=0x1){_0x587844=_0x587844[_0xa08f('0x12')](getUserApplications(_0x1e7c7c,_0xbf4fe2[_0xd5a9e9],_0xbf4fe2[_0xd5a9e9][_0xa08f('0x13')]));if(_0xbf4fe2[_0xd5a9e9][_0xa08f('0x13')]!=_0xbf4fe2[_0xd5a9e9]['name']){_0x587844=_0x587844['concat'](getUserApplications(_0x1e7c7c,_0xbf4fe2[_0xd5a9e9],_0xbf4fe2[_0xd5a9e9][_0xa08f('0x14')]));}}return _0x587844;};var getChanSpyPromise=function(_0x295631,_0x32a7f9){return new BPromise(function(_0x5c6391,_0x24b0b8){return _0x295631[_0xa08f('0x15')]['findAll']({'attributes':['id',_0xa08f('0x14'),_0xa08f('0x13')],'where':{'role':_0xa08f('0x16'),'chanspy':!![]},'raw':!![]})[_0xa08f('0x17')](function(_0x2c62d1){if(_0x2c62d1){return _0x5c6391(getChanSpyApplications(_0x32a7f9,_0x2c62d1));}return _0x5c6391([]);})[_0xa08f('0x18')](function(_0x2b79ca){_0x24b0b8(_0x2b79ca);});});};module[_0xa08f('0x19')]=function(_0x20f551,_0x3384e8){var _0x207bec=_0x20f551[_0xa08f('0x1a')];return _0x20f551['define'](_0xa08f('0x1b'),attributes,{'tableName':_0xa08f('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x18b23d,_0x3952,_0x21a223){return getChanSpyPromise(_0x207bec,_0x18b23d)[_0xa08f('0x17')](function(_0x42cd52){if(_0x42cd52&&_0x42cd52[_0xa08f('0x1d')]){return _0x207bec[_0xa08f('0x1e')]['bulkCreate'](_0x42cd52);}})[_0xa08f('0x17')](function(){_0x21a223();})[_0xa08f('0x18')](function(_0x330eba){_0x21a223(_0x330eba);});},'afterUpdate':function(_0x1479f6,_0x5d7acf,_0x518817){return _0x207bec[_0xa08f('0x1e')][_0xa08f('0x1f')]({'where':{'ChanSpyId':_0x1479f6['id']}})[_0xa08f('0x17')](function(){return getChanSpyPromise(_0x207bec,_0x1479f6);})[_0xa08f('0x17')](function(_0x2835ae){if(_0x2835ae&&_0x2835ae[_0xa08f('0x1d')]){return _0x207bec[_0xa08f('0x1e')]['bulkCreate'](_0x2835ae);}})[_0xa08f('0x17')](function(){_0x518817();})['catch'](function(_0x29ff20){_0x518817(_0x29ff20);});},'afterDestroy':function(_0x2edb3b,_0x3d0f2d,_0x3a2188){return _0x207bec[_0xa08f('0x1e')][_0xa08f('0x1f')]({'where':{'ChanSpyId':_0x2edb3b['id']}})[_0xa08f('0x17')](function(){_0x3a2188();})['catch'](function(_0x4d3f02){_0x3a2188(_0x4d3f02);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 1acb8d0..ad1dd59 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 _0x9354=['message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error'];(function(_0x1ce348,_0x25d2f9){var _0x819a00=function(_0x839314){while(--_0x839314){_0x1ce348['push'](_0x1ce348['shift']());}};_0x819a00(++_0x25d2f9);}(_0x9354,0x96));var _0x4935=function(_0x1f5303,_0x354414){_0x1f5303=_0x1f5303-0x0;var _0x84ef1a=_0x9354[_0x1f5303];return _0x84ef1a;};'use strict';var _=require('lodash');var util=require(_0x4935('0x0'));var moment=require(_0x4935('0x1'));var BPromise=require('bluebird');var rs=require(_0x4935('0x2'));var fs=require('fs');var Redis=require(_0x4935('0x3'));var db=require(_0x4935('0x4'))['db'];var utils=require(_0x4935('0x5'));var logger=require('../../config/logger')(_0x4935('0x6'));var config=require(_0x4935('0x7'));var jayson=require(_0x4935('0x8'));var client=jayson[_0x4935('0x9')][_0x4935('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e47bd,_0x118d36,_0x2d735e){return new BPromise(function(_0x10793e,_0x4c9902){return client[_0x4935('0xb')](_0x2e47bd,_0x2d735e)['then'](function(_0x2aac9a){logger[_0x4935('0xc')](_0x4935('0xd'),_0x118d36,_0x4935('0xe'));logger[_0x4935('0xf')](_0x4935('0x10'),_0x118d36,'request\x20sent',JSON['stringify'](_0x2aac9a));if(_0x2aac9a[_0x4935('0x11')]){if(_0x2aac9a['error']['code']===0x1f4){logger[_0x4935('0x11')](_0x4935('0xd'),_0x118d36,_0x2aac9a[_0x4935('0x11')][_0x4935('0x12')]);return _0x4c9902(_0x2aac9a[_0x4935('0x11')][_0x4935('0x12')]);}logger[_0x4935('0x11')](_0x4935('0xd'),_0x118d36,_0x2aac9a[_0x4935('0x11')][_0x4935('0x12')]);return _0x10793e(_0x2aac9a[_0x4935('0x11')][_0x4935('0x12')]);}else{logger[_0x4935('0xc')](_0x4935('0xd'),_0x118d36,_0x4935('0xe'));_0x10793e(_0x2aac9a[_0x4935('0x13')]['message']);}})[_0x4935('0x14')](function(_0x46526a){logger[_0x4935('0x11')](_0x4935('0xd'),_0x118d36,_0x46526a);_0x4c9902(_0x46526a);});});} \ No newline at end of file +var _0xc788=['request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','message','VoiceChanSpy,\x20%s,\x20%s','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xc788,0xc4));var _0x8c78=function(_0x380b8f,_0x32271d){_0x380b8f=_0x380b8f-0x0;var _0x646c69=_0xc788[_0x380b8f];return _0x646c69;};'use strict';var _=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var moment=require(_0x8c78('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c78('0x3'));var db=require(_0x8c78('0x4'))['db'];var utils=require(_0x8c78('0x5'));var logger=require(_0x8c78('0x6'))(_0x8c78('0x7'));var config=require('../../config/environment');var jayson=require(_0x8c78('0x8'));var client=jayson[_0x8c78('0x9')][_0x8c78('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ac27f,_0x205cc1,_0x4d54a5){return new BPromise(function(_0x247188,_0x299d9d){return client[_0x8c78('0xb')](_0x1ac27f,_0x4d54a5)[_0x8c78('0xc')](function(_0xdb0c17){logger[_0x8c78('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x205cc1,_0x8c78('0xe'));logger['debug'](_0x8c78('0xf'),_0x205cc1,_0x8c78('0xe'),JSON['stringify'](_0xdb0c17));if(_0xdb0c17[_0x8c78('0x10')]){if(_0xdb0c17[_0x8c78('0x10')]['code']===0x1f4){logger[_0x8c78('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x205cc1,_0xdb0c17['error'][_0x8c78('0x11')]);return _0x299d9d(_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);}logger[_0x8c78('0x10')](_0x8c78('0x12'),_0x205cc1,_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);return _0x247188(_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);}else{logger[_0x8c78('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x205cc1,_0x8c78('0xe'));_0x247188(_0xdb0c17[_0x8c78('0x13')]['message']);}})[_0x8c78('0x14')](function(_0x554464){logger[_0x8c78('0x10')](_0x8c78('0x12'),_0x205cc1,_0x554464);_0x299d9d(_0x554464);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index f1436ee..d67c5dd 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 _0xf7c0=['path','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','show','post','put','/:id','destroy','exports','multer','util'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xf7c0,0xfa));var _0x0f7c=function(_0x598e5c,_0x1006ce){_0x598e5c=_0x598e5c-0x0;var _0x45edac=_0xf7c0[_0x598e5c];return _0x45edac;};'use strict';var multer=require(_0x0f7c('0x0'));var util=require(_0x0f7c('0x1'));var path=require(_0x0f7c('0x2'));var timeout=require(_0x0f7c('0x3'));var express=require(_0x0f7c('0x4'));var router=express[_0x0f7c('0x5')]();var fs_extra=require(_0x0f7c('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0f7c('0x7'));var controller=require(_0x0f7c('0x8'));router[_0x0f7c('0x9')]('/',auth[_0x0f7c('0xa')](),controller[_0x0f7c('0xb')]);router['get']('/:id',auth[_0x0f7c('0xa')](),controller[_0x0f7c('0xc')]);router[_0x0f7c('0xd')]('/',auth[_0x0f7c('0xa')](),controller['create']);router[_0x0f7c('0xe')](_0x0f7c('0xf'),auth[_0x0f7c('0xa')](),controller['update']);router['delete']('/:id',auth[_0x0f7c('0xa')](),controller[_0x0f7c('0x10')]);module[_0x0f7c('0x11')]=router; \ No newline at end of file +var _0xbad8=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x51806f,_0x53dad6){var _0x424bea=function(_0x54da82){while(--_0x54da82){_0x51806f['push'](_0x51806f['shift']());}};_0x424bea(++_0x53dad6);}(_0xbad8,0x18b));var _0x8bad=function(_0x571c1d,_0x3b0586){_0x571c1d=_0x571c1d-0x0;var _0x33c609=_0xbad8[_0x571c1d];return _0x33c609;};'use strict';var multer=require(_0x8bad('0x0'));var util=require(_0x8bad('0x1'));var path=require(_0x8bad('0x2'));var timeout=require(_0x8bad('0x3'));var express=require(_0x8bad('0x4'));var router=express[_0x8bad('0x5')]();var fs_extra=require(_0x8bad('0x6'));var auth=require(_0x8bad('0x7'));var interaction=require(_0x8bad('0x8'));var config=require('../../config/environment');var controller=require(_0x8bad('0x9'));router['get']('/',auth[_0x8bad('0xa')](),controller[_0x8bad('0xb')]);router[_0x8bad('0xc')](_0x8bad('0xd'),auth[_0x8bad('0xa')](),controller[_0x8bad('0xe')]);router[_0x8bad('0xf')]('/',auth[_0x8bad('0xa')](),controller[_0x8bad('0x10')]);router[_0x8bad('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x8bad('0x12')]);router[_0x8bad('0x13')](_0x8bad('0xd'),auth[_0x8bad('0xa')](),controller[_0x8bad('0x14')]);module[_0x8bad('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index fcfa783..f3184fa 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 _0x12e3=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x12e3,0x16a));var _0x312e=function(_0x41971b,_0x539b61){_0x41971b=_0x41971b-0x0;var _0x4996b7=_0x12e3[_0x41971b];return _0x4996b7;};'use strict';var Sequelize=require(_0x312e('0x0'));module[_0x312e('0x1')]={'name':{'type':Sequelize[_0x312e('0x2')],'unique':_0x312e('0x3')},'description':{'type':Sequelize[_0x312e('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x312e('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xab4f=['STRING','name','exports'];(function(_0x5608b1,_0x5772e3){var _0x19fb2d=function(_0x46515e){while(--_0x46515e){_0x5608b1['push'](_0x5608b1['shift']());}};_0x19fb2d(++_0x5772e3);}(_0xab4f,0x95));var _0xfab4=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xab4f[_0x36ed48];return _0x51c63a;};'use strict';var Sequelize=require('sequelize');module[_0xfab4('0x0')]={'name':{'type':Sequelize[_0xfab4('0x1')],'unique':_0xfab4('0x2')},'description':{'type':Sequelize[_0xfab4('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 348a85b..679c9f2 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 _0x3645=['render','writeFileSync','Reload','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','chan_sip.so','/etc/asterisk/extensions_xcally_contexts.conf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','destroy','Contexts','UserProfileResource','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','filter','where','merge','options','include','rows','catch','params','keys','includeAll','find','create','body','findAll','readFileSync','root','server/files/templates/context.ejs','utf8'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x3645,0x154));var _0x5364=function(_0x101802,_0x11f913){_0x101802=_0x101802-0x0;var _0x5d61ce=_0x3645[_0x101802];return _0x5d61ce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5364('0x0'));var zipdir=require(_0x5364('0x1'));var jsonpatch=require(_0x5364('0x2'));var rp=require(_0x5364('0x3'));var moment=require(_0x5364('0x4'));var BPromise=require(_0x5364('0x5'));var Mustache=require(_0x5364('0x6'));var util=require('util');var path=require(_0x5364('0x7'));var sox=require(_0x5364('0x8'));var csv=require(_0x5364('0x9'));var ejs=require(_0x5364('0xa'));var fs=require('fs');var fs_extra=require(_0x5364('0xb'));var _=require(_0x5364('0xc'));var squel=require(_0x5364('0xd'));var crypto=require(_0x5364('0xe'));var jsforce=require(_0x5364('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x5364('0x9'));var querystring=require(_0x5364('0x10'));var Papa=require(_0x5364('0x11'));var Redis=require(_0x5364('0x12'));var authService=require(_0x5364('0x13'));var qs=require(_0x5364('0x14'));var as=require(_0x5364('0x15'));var hardwareService=require(_0x5364('0x16'));var logger=require(_0x5364('0x17'))(_0x5364('0x18'));var utils=require(_0x5364('0x19'));var config=require(_0x5364('0x1a'));var licenseUtil=require(_0x5364('0x1b'));var db=require('../../mysqldb')['db'];var jayson=require(_0x5364('0x1c'));var client=jayson[_0x5364('0x1d')][_0x5364('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x44e995,_0x5a2552,_0x3eb7f3,_0x50c5ab){return new BPromise(function(_0x3aa29e,_0x4d7f1c){var _0x3ffd5d=_0x50c5ab||client;return _0x3ffd5d[_0x5364('0x1f')](_0x44e995,_0x3eb7f3)[_0x5364('0x20')](function(_0x2abe2a){logger[_0x5364('0x21')]('VoiceContext,\x20%s,\x20%s',_0x5a2552,'request\x20sent');logger[_0x5364('0x22')](_0x5364('0x23'),_0x5a2552,_0x5364('0x24'),JSON[_0x5364('0x25')](_0x2abe2a));if(_0x2abe2a[_0x5364('0x26')]){if(_0x2abe2a[_0x5364('0x26')][_0x5364('0x27')]===0x1f4){logger[_0x5364('0x26')](_0x5364('0x28'),_0x5a2552,_0x2abe2a['error'][_0x5364('0x29')]);return _0x4d7f1c(_0x2abe2a[_0x5364('0x26')][_0x5364('0x29')]);}logger[_0x5364('0x26')](_0x5364('0x28'),_0x5a2552,_0x2abe2a[_0x5364('0x26')][_0x5364('0x29')]);return _0x3aa29e(_0x2abe2a[_0x5364('0x26')][_0x5364('0x29')]);}else{logger[_0x5364('0x21')](_0x5364('0x28'),_0x5a2552,'request\x20sent');_0x3aa29e(_0x2abe2a[_0x5364('0x2a')]['message']);}})['catch'](function(_0x46089e){logger['error'](_0x5364('0x28'),_0x5a2552,_0x46089e);_0x4d7f1c(_0x46089e);});});}function respondWithStatusCode(_0x2a8dd6,_0x1c08f9){_0x1c08f9=_0x1c08f9||0xcc;return function(_0x38a963){if(_0x38a963){return _0x2a8dd6[_0x5364('0x2b')](_0x1c08f9);}return _0x2a8dd6['status'](_0x1c08f9)[_0x5364('0x2c')]();};}function respondWithResult(_0x4d2218,_0x1e7df2){_0x1e7df2=_0x1e7df2||0xc8;return function(_0x1bc363){if(_0x1bc363){return _0x4d2218['status'](_0x1e7df2)[_0x5364('0x2d')](_0x1bc363);}};}function respondWithFilteredResult(_0x2edc31,_0x5bd2f7){return function(_0xb5ae80){if(_0xb5ae80){var _0x3302c8=typeof _0x5bd2f7[_0x5364('0x2e')]===_0x5364('0x2f')&&typeof _0x5bd2f7['limit']===_0x5364('0x2f');var _0x35b9dd=_0xb5ae80[_0x5364('0x30')];var _0x41e256=_0x3302c8?0x0:_0x5bd2f7[_0x5364('0x2e')];var _0xb0d1b3=_0x3302c8?_0xb5ae80['count']:_0x5bd2f7['offset']+_0x5bd2f7[_0x5364('0x31')];var _0x566f77;if(_0xb0d1b3>=_0x35b9dd){_0xb0d1b3=_0x35b9dd;_0x566f77=0xc8;}else{_0x566f77=0xce;}_0x2edc31[_0x5364('0x32')](_0x566f77);return _0x2edc31[_0x5364('0x33')](_0x5364('0x34'),_0x41e256+'-'+_0xb0d1b3+'/'+_0x35b9dd)[_0x5364('0x2d')](_0xb5ae80);}return null;};}function patchUpdates(_0xef474d){return function(_0x5cd5d8){try{jsonpatch[_0x5364('0x35')](_0x5cd5d8,_0xef474d,!![]);}catch(_0x1fcc54){return BPromise[_0x5364('0x36')](_0x1fcc54);}return _0x5cd5d8[_0x5364('0x37')]();};}function saveUpdates(_0x22b34b,_0xd30636){return function(_0x294482){if(_0x294482){return _0x294482[_0x5364('0x38')](_0x22b34b)[_0x5364('0x20')](function(_0x428851){return _0x428851;});}return null;};}function removeEntity(_0x5d388e,_0x56b7b1){return function(_0x4b1a7a){if(_0x4b1a7a){return _0x4b1a7a[_0x5364('0x39')]()[_0x5364('0x20')](function(){var _0xa6607f=_0x4b1a7a['get']({'plain':!![]});var _0x545efe=_0x5364('0x3a');return db[_0x5364('0x3b')][_0x5364('0x39')]({'where':{'type':_0x545efe,'resourceId':_0xa6607f['id']}})['then'](function(){return _0x4b1a7a;});})[_0x5364('0x20')](function(){_0x5d388e['status'](0xcc)[_0x5364('0x2c')]();});}};}function handleEntityNotFound(_0x5cedf1,_0x56fa9c){return function(_0x319bb2){if(!_0x319bb2){_0x5cedf1[_0x5364('0x2b')](0x194);}return _0x319bb2;};}function handleError(_0x179d3d,_0x2e8d02){_0x2e8d02=_0x2e8d02||0x1f4;return function(_0x45e949){logger['error'](_0x45e949['stack']);if(_0x45e949[_0x5364('0x3c')]){delete _0x45e949[_0x5364('0x3c')];}_0x179d3d[_0x5364('0x32')](_0x2e8d02)[_0x5364('0x3d')](_0x45e949);};}exports[_0x5364('0x3e')]=function(_0x8ff578,_0x214ea9){var _0x53f40c={},_0x524950={},_0x50b596={'count':0x0,'rows':[]};var _0x446037=_[_0x5364('0x3f')](db[_0x5364('0x40')][_0x5364('0x41')],function(_0x2e6575){return{'name':_0x2e6575[_0x5364('0x42')],'type':_0x2e6575[_0x5364('0x43')][_0x5364('0x44')]};});_0x524950[_0x5364('0x45')]=_[_0x5364('0x3f')](_0x446037,_0x5364('0x3c'));_0x524950[_0x5364('0x46')]=_['keys'](_0x8ff578[_0x5364('0x46')]);_0x524950[_0x5364('0x47')]=_[_0x5364('0x48')](_0x524950[_0x5364('0x45')],_0x524950[_0x5364('0x46')]);_0x53f40c[_0x5364('0x49')]=_[_0x5364('0x48')](_0x524950[_0x5364('0x45')],qs[_0x5364('0x4a')](_0x8ff578[_0x5364('0x46')][_0x5364('0x4a')]));_0x53f40c[_0x5364('0x49')]=_0x53f40c[_0x5364('0x49')][_0x5364('0x4b')]?_0x53f40c[_0x5364('0x49')]:_0x524950['model'];if(!_0x8ff578[_0x5364('0x46')]['hasOwnProperty']('nolimit')){_0x53f40c[_0x5364('0x31')]=qs[_0x5364('0x31')](_0x8ff578[_0x5364('0x46')][_0x5364('0x31')]);_0x53f40c[_0x5364('0x2e')]=qs[_0x5364('0x2e')](_0x8ff578['query'][_0x5364('0x2e')]);}_0x53f40c[_0x5364('0x4c')]=qs[_0x5364('0x4d')](_0x8ff578['query'][_0x5364('0x4d')]);_0x53f40c['where']=qs[_0x5364('0x47')](_['pick'](_0x8ff578[_0x5364('0x46')],_0x524950['filters']),_0x446037);if(_0x8ff578['query'][_0x5364('0x4e')]){_0x53f40c[_0x5364('0x4f')]=_[_0x5364('0x50')](_0x53f40c['where'],{'$or':_[_0x5364('0x3f')](_0x446037,function(_0x4c5b41){if(_0x4c5b41[_0x5364('0x43')]!=='VIRTUAL'){var _0x541445={};_0x541445[_0x4c5b41['name']]={'$like':'%'+_0x8ff578[_0x5364('0x46')][_0x5364('0x4e')]+'%'};return _0x541445;}})});}_0x53f40c=_[_0x5364('0x50')]({},_0x53f40c,_0x8ff578[_0x5364('0x51')]);var _0x4321fe={'where':_0x53f40c[_0x5364('0x4f')]};return db[_0x5364('0x40')][_0x5364('0x30')](_0x4321fe)['then'](function(_0xb8de70){_0x50b596[_0x5364('0x30')]=_0xb8de70;if(_0x8ff578[_0x5364('0x46')]['includeAll']){_0x53f40c[_0x5364('0x52')]=[{'all':!![]}];}return db[_0x5364('0x40')]['findAll'](_0x53f40c);})[_0x5364('0x20')](function(_0x41441b){_0x50b596[_0x5364('0x53')]=_0x41441b;return _0x50b596;})[_0x5364('0x20')](respondWithFilteredResult(_0x214ea9,_0x53f40c))[_0x5364('0x54')](handleError(_0x214ea9,null));};exports['show']=function(_0x47215d,_0x30863f){var _0xebf44f={'raw':![],'where':{'id':_0x47215d[_0x5364('0x55')]['id']}},_0x20e701={};_0x20e701[_0x5364('0x45')]=_[_0x5364('0x56')](db['VoiceContext']['rawAttributes']);_0x20e701[_0x5364('0x46')]=_[_0x5364('0x56')](_0x47215d[_0x5364('0x46')]);_0x20e701[_0x5364('0x47')]=_[_0x5364('0x48')](_0x20e701[_0x5364('0x45')],_0x20e701['query']);_0xebf44f[_0x5364('0x49')]=_[_0x5364('0x48')](_0x20e701[_0x5364('0x45')],qs[_0x5364('0x4a')](_0x47215d[_0x5364('0x46')][_0x5364('0x4a')]));_0xebf44f['attributes']=_0xebf44f[_0x5364('0x49')][_0x5364('0x4b')]?_0xebf44f['attributes']:_0x20e701[_0x5364('0x45')];if(_0x47215d[_0x5364('0x46')][_0x5364('0x57')]){_0xebf44f[_0x5364('0x52')]=[{'all':!![]}];}_0xebf44f=_['merge']({},_0xebf44f,_0x47215d[_0x5364('0x51')]);return db[_0x5364('0x40')][_0x5364('0x58')](_0xebf44f)[_0x5364('0x20')](handleEntityNotFound(_0x30863f,null))['then'](respondWithResult(_0x30863f,null))[_0x5364('0x54')](handleError(_0x30863f,null));};exports[_0x5364('0x59')]=function(_0x25c199,_0x14a2b7,_0x5ea472){var _0x17be21;return db[_0x5364('0x40')]['create'](_0x25c199[_0x5364('0x5a')],{'raw':!![]})[_0x5364('0x20')](function(_0x441c01){_0x17be21=_0x441c01;return db[_0x5364('0x40')][_0x5364('0x5b')]({'raw':!![]});})[_0x5364('0x20')](function(_0x5050cd){var _0x40c248=fs[_0x5364('0x5c')](path['join'](config[_0x5364('0x5d')],_0x5364('0x5e')),_0x5364('0x5f'));var _0x4ae984=ejs[_0x5364('0x60')](_0x40c248,{'contexts':_0x5050cd||[]});fs[_0x5364('0x61')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x4ae984);})[_0x5364('0x20')](function(){return respondWithRpcPromise(_0x5364('0x62'),_0x5364('0x59'),{'module':'chan_sip.so'});})[_0x5364('0x20')](function(){var _0x5a70be=_0x25c199[_0x5364('0x63')][_0x5364('0x64')]({'plain':!![]});if(!_0x5a70be)throw new Error(_0x5364('0x65'));if(_0x5a70be[_0x5364('0x66')]===_0x5364('0x63')){var _0x254a7f=_0x17be21[_0x5364('0x64')]({'plain':!![]});return db['UserProfileSection'][_0x5364('0x58')]({'where':{'name':'Contexts','userProfileId':_0x5a70be[_0x5364('0x67')]},'raw':!![]})[_0x5364('0x20')](function(_0x30e45d){if(_0x30e45d&&_0x30e45d[_0x5364('0x68')]===0x0){return db[_0x5364('0x3b')][_0x5364('0x59')]({'name':_0x254a7f[_0x5364('0x3c')],'resourceId':_0x254a7f['id'],'type':_0x30e45d['name'],'sectionId':_0x30e45d['id']},{})[_0x5364('0x20')](function(){return _0x17be21;});}else{return _0x17be21;}})[_0x5364('0x54')](function(_0x424d03){logger[_0x5364('0x26')](_0x5364('0x69'),_0x424d03);throw _0x424d03;});}return _0x17be21;})[_0x5364('0x20')](respondWithResult(_0x14a2b7,0xc9))[_0x5364('0x54')](handleError(_0x14a2b7,null));};exports['update']=function(_0x56cb89,_0x20c573,_0x1cbe7a){var _0x5b953e;return db[_0x5364('0x40')][_0x5364('0x58')]({'where':{'id':_0x56cb89[_0x5364('0x55')]['id']}})[_0x5364('0x20')](handleEntityNotFound(_0x20c573,null))[_0x5364('0x20')](saveUpdates(_0x56cb89[_0x5364('0x5a')],null))[_0x5364('0x20')](function(_0x4e0125){if(_0x4e0125){_0x5b953e=_0x4e0125;return db[_0x5364('0x40')][_0x5364('0x5b')]({'raw':!![]});}})['then'](function(_0x507a91){var _0x575339=fs['readFileSync'](path[_0x5364('0x6a')](config[_0x5364('0x5d')],_0x5364('0x5e')),_0x5364('0x5f'));var _0x93a9dd=ejs[_0x5364('0x60')](_0x575339,{'contexts':_0x507a91||[]});fs[_0x5364('0x61')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x93a9dd);})[_0x5364('0x20')](function(){return respondWithRpcPromise(_0x5364('0x62'),_0x5364('0x38'),{'module':_0x5364('0x6b')});})[_0x5364('0x20')](function(){return _0x5b953e;})['then'](respondWithResult(_0x20c573,null))[_0x5364('0x54')](handleError(_0x20c573,null));};exports[_0x5364('0x39')]=function(_0xe9ae66,_0x1287cb,_0x388bed){var _0x4c4660;return db[_0x5364('0x40')][_0x5364('0x58')]({'where':{'id':_0xe9ae66[_0x5364('0x55')]['id']}})[_0x5364('0x20')](handleEntityNotFound(_0x1287cb,null))['then'](removeEntity(_0x1287cb,null))[_0x5364('0x20')](function(){return db[_0x5364('0x40')][_0x5364('0x5b')]({'raw':!![]});})[_0x5364('0x20')](function(_0x8aa2fa){var _0x5b76cd=fs[_0x5364('0x5c')](path['join'](config[_0x5364('0x5d')],_0x5364('0x5e')),_0x5364('0x5f'));var _0x7a9056=ejs[_0x5364('0x60')](_0x5b76cd,{'contexts':_0x8aa2fa});fs[_0x5364('0x61')](_0x5364('0x6c'),_0x7a9056);return respondWithRpcPromise(_0x5364('0x62'),'destroy',{'module':_0x5364('0x6b')});})[_0x5364('0x54')](handleError(_0x1287cb,null));}; \ No newline at end of file +var _0x0889=['save','update','then','Contexts','UserProfileResource','end','stack','name','index','map','VoiceContext','fieldName','key','keys','query','model','attributes','fields','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','params','rawAttributes','intersection','create','findAll','join','root','server/files/templates/context.ejs','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','utf8','writeFileSync','chan_sip.so','destroy','readFileSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','client','request','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','VoiceContext,\x20%s,\x20%s','message','result','sendStatus','status','offset','undefined','count','limit','Content-Range','json','apply'];(function(_0x5ae2c,_0x216476){var _0x3962fd=function(_0x4941e7){while(--_0x4941e7){_0x5ae2c['push'](_0x5ae2c['shift']());}};_0x3962fd(++_0x216476);}(_0x0889,0x9a));var _0x9088=function(_0x5a4c64,_0x4d4138){_0x5a4c64=_0x5a4c64-0x0;var _0xed35d2=_0x0889[_0x5a4c64];return _0xed35d2;};'use strict';var emlformat=require(_0x9088('0x0'));var rimraf=require(_0x9088('0x1'));var zipdir=require(_0x9088('0x2'));var jsonpatch=require(_0x9088('0x3'));var rp=require(_0x9088('0x4'));var moment=require(_0x9088('0x5'));var BPromise=require(_0x9088('0x6'));var Mustache=require(_0x9088('0x7'));var util=require(_0x9088('0x8'));var path=require(_0x9088('0x9'));var sox=require(_0x9088('0xa'));var csv=require(_0x9088('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9088('0xc'));var crypto=require(_0x9088('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9088('0xe'));var toCsv=require(_0x9088('0xb'));var querystring=require('querystring');var Papa=require(_0x9088('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9088('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9088('0x11'));var logger=require(_0x9088('0x12'))('api');var utils=require(_0x9088('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9088('0x14'))['db'];var jayson=require(_0x9088('0x15'));var client=jayson[_0x9088('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b9393,_0x556550,_0x16b7a8,_0x1967bf){return new BPromise(function(_0x46d652,_0x473dff){var _0xabc9db=_0x1967bf||client;return _0xabc9db[_0x9088('0x17')](_0x3b9393,_0x16b7a8)['then'](function(_0x5bfc7b){logger[_0x9088('0x18')]('VoiceContext,\x20%s,\x20%s',_0x556550,_0x9088('0x19'));logger[_0x9088('0x1a')](_0x9088('0x1b'),_0x556550,_0x9088('0x19'),JSON['stringify'](_0x5bfc7b));if(_0x5bfc7b[_0x9088('0x1c')]){if(_0x5bfc7b[_0x9088('0x1c')][_0x9088('0x1d')]===0x1f4){logger[_0x9088('0x1c')](_0x9088('0x1e'),_0x556550,_0x5bfc7b[_0x9088('0x1c')][_0x9088('0x1f')]);return _0x473dff(_0x5bfc7b[_0x9088('0x1c')]['message']);}logger[_0x9088('0x1c')](_0x9088('0x1e'),_0x556550,_0x5bfc7b[_0x9088('0x1c')][_0x9088('0x1f')]);return _0x46d652(_0x5bfc7b[_0x9088('0x1c')][_0x9088('0x1f')]);}else{logger['info'](_0x9088('0x1e'),_0x556550,'request\x20sent');_0x46d652(_0x5bfc7b[_0x9088('0x20')]['message']);}})['catch'](function(_0x10d454){logger[_0x9088('0x1c')]('VoiceContext,\x20%s,\x20%s',_0x556550,_0x10d454);_0x473dff(_0x10d454);});});}function respondWithStatusCode(_0xb36d78,_0x48106c){_0x48106c=_0x48106c||0xcc;return function(_0x16eb4e){if(_0x16eb4e){return _0xb36d78[_0x9088('0x21')](_0x48106c);}return _0xb36d78[_0x9088('0x22')](_0x48106c)['end']();};}function respondWithResult(_0x51a3a4,_0x1d6e65){_0x1d6e65=_0x1d6e65||0xc8;return function(_0x3157af){if(_0x3157af){return _0x51a3a4[_0x9088('0x22')](_0x1d6e65)['json'](_0x3157af);}};}function respondWithFilteredResult(_0x2d54b4,_0x61dde7){return function(_0x538863){if(_0x538863){var _0x23584c=typeof _0x61dde7[_0x9088('0x23')]===_0x9088('0x24')&&typeof _0x61dde7['limit']===_0x9088('0x24');var _0xac5356=_0x538863[_0x9088('0x25')];var _0x136069=_0x23584c?0x0:_0x61dde7[_0x9088('0x23')];var _0x289bcc=_0x23584c?_0x538863[_0x9088('0x25')]:_0x61dde7[_0x9088('0x23')]+_0x61dde7[_0x9088('0x26')];var _0x4b306b;if(_0x289bcc>=_0xac5356){_0x289bcc=_0xac5356;_0x4b306b=0xc8;}else{_0x4b306b=0xce;}_0x2d54b4[_0x9088('0x22')](_0x4b306b);return _0x2d54b4['set'](_0x9088('0x27'),_0x136069+'-'+_0x289bcc+'/'+_0xac5356)[_0x9088('0x28')](_0x538863);}return null;};}function patchUpdates(_0x7fcd8a){return function(_0x5d462a){try{jsonpatch[_0x9088('0x29')](_0x5d462a,_0x7fcd8a,!![]);}catch(_0x7074c3){return BPromise['reject'](_0x7074c3);}return _0x5d462a[_0x9088('0x2a')]();};}function saveUpdates(_0x3134ff,_0x5ea317){return function(_0x46ad6d){if(_0x46ad6d){return _0x46ad6d[_0x9088('0x2b')](_0x3134ff)[_0x9088('0x2c')](function(_0x4b0c63){return _0x4b0c63;});}return null;};}function removeEntity(_0x1129e0,_0xbc2793){return function(_0x5d73e6){if(_0x5d73e6){return _0x5d73e6['destroy']()[_0x9088('0x2c')](function(){var _0x3f0230=_0x5d73e6['get']({'plain':!![]});var _0x2db6b4=_0x9088('0x2d');return db[_0x9088('0x2e')]['destroy']({'where':{'type':_0x2db6b4,'resourceId':_0x3f0230['id']}})['then'](function(){return _0x5d73e6;});})[_0x9088('0x2c')](function(){_0x1129e0[_0x9088('0x22')](0xcc)[_0x9088('0x2f')]();});}};}function handleEntityNotFound(_0x5ecab4,_0x1262e2){return function(_0x53afb8){if(!_0x53afb8){_0x5ecab4['sendStatus'](0x194);}return _0x53afb8;};}function handleError(_0x4d5dbf,_0x174845){_0x174845=_0x174845||0x1f4;return function(_0x2da0d6){logger[_0x9088('0x1c')](_0x2da0d6[_0x9088('0x30')]);if(_0x2da0d6[_0x9088('0x31')]){delete _0x2da0d6[_0x9088('0x31')];}_0x4d5dbf['status'](_0x174845)['send'](_0x2da0d6);};}exports[_0x9088('0x32')]=function(_0xb69b3,_0x234da7){var _0xae6745={},_0x31d769={},_0x5da2d3={'count':0x0,'rows':[]};var _0x4d4c40=_[_0x9088('0x33')](db[_0x9088('0x34')]['rawAttributes'],function(_0x27a9fd){return{'name':_0x27a9fd[_0x9088('0x35')],'type':_0x27a9fd['type'][_0x9088('0x36')]};});_0x31d769['model']=_[_0x9088('0x33')](_0x4d4c40,'name');_0x31d769['query']=_[_0x9088('0x37')](_0xb69b3[_0x9088('0x38')]);_0x31d769['filters']=_['intersection'](_0x31d769[_0x9088('0x39')],_0x31d769['query']);_0xae6745[_0x9088('0x3a')]=_['intersection'](_0x31d769[_0x9088('0x39')],qs[_0x9088('0x3b')](_0xb69b3[_0x9088('0x38')][_0x9088('0x3b')]));_0xae6745[_0x9088('0x3a')]=_0xae6745[_0x9088('0x3a')]['length']?_0xae6745['attributes']:_0x31d769[_0x9088('0x39')];if(!_0xb69b3[_0x9088('0x38')][_0x9088('0x3c')]('nolimit')){_0xae6745['limit']=qs[_0x9088('0x26')](_0xb69b3[_0x9088('0x38')][_0x9088('0x26')]);_0xae6745[_0x9088('0x23')]=qs['offset'](_0xb69b3[_0x9088('0x38')][_0x9088('0x23')]);}_0xae6745['order']=qs[_0x9088('0x3d')](_0xb69b3[_0x9088('0x38')][_0x9088('0x3d')]);_0xae6745[_0x9088('0x3e')]=qs[_0x9088('0x3f')](_[_0x9088('0x40')](_0xb69b3[_0x9088('0x38')],_0x31d769[_0x9088('0x3f')]),_0x4d4c40);if(_0xb69b3[_0x9088('0x38')][_0x9088('0x41')]){_0xae6745[_0x9088('0x3e')]=_[_0x9088('0x42')](_0xae6745[_0x9088('0x3e')],{'$or':_[_0x9088('0x33')](_0x4d4c40,function(_0x4bf522){if(_0x4bf522['type']!==_0x9088('0x43')){var _0x4ce006={};_0x4ce006[_0x4bf522[_0x9088('0x31')]]={'$like':'%'+_0xb69b3[_0x9088('0x38')][_0x9088('0x41')]+'%'};return _0x4ce006;}})});}_0xae6745=_[_0x9088('0x42')]({},_0xae6745,_0xb69b3[_0x9088('0x44')]);var _0x402e2d={'where':_0xae6745[_0x9088('0x3e')]};return db[_0x9088('0x34')][_0x9088('0x25')](_0x402e2d)[_0x9088('0x2c')](function(_0x549385){_0x5da2d3[_0x9088('0x25')]=_0x549385;if(_0xb69b3[_0x9088('0x38')][_0x9088('0x45')]){_0xae6745[_0x9088('0x46')]=[{'all':!![]}];}return db[_0x9088('0x34')]['findAll'](_0xae6745);})[_0x9088('0x2c')](function(_0x350378){_0x5da2d3['rows']=_0x350378;return _0x5da2d3;})[_0x9088('0x2c')](respondWithFilteredResult(_0x234da7,_0xae6745))[_0x9088('0x47')](handleError(_0x234da7,null));};exports['show']=function(_0x5753a0,_0x192bbc){var _0x1d7eb9={'raw':![],'where':{'id':_0x5753a0[_0x9088('0x48')]['id']}},_0x55a225={};_0x55a225[_0x9088('0x39')]=_[_0x9088('0x37')](db['VoiceContext'][_0x9088('0x49')]);_0x55a225['query']=_[_0x9088('0x37')](_0x5753a0[_0x9088('0x38')]);_0x55a225[_0x9088('0x3f')]=_[_0x9088('0x4a')](_0x55a225[_0x9088('0x39')],_0x55a225[_0x9088('0x38')]);_0x1d7eb9[_0x9088('0x3a')]=_[_0x9088('0x4a')](_0x55a225['model'],qs[_0x9088('0x3b')](_0x5753a0[_0x9088('0x38')]['fields']));_0x1d7eb9[_0x9088('0x3a')]=_0x1d7eb9[_0x9088('0x3a')]['length']?_0x1d7eb9['attributes']:_0x55a225[_0x9088('0x39')];if(_0x5753a0[_0x9088('0x38')][_0x9088('0x45')]){_0x1d7eb9[_0x9088('0x46')]=[{'all':!![]}];}_0x1d7eb9=_['merge']({},_0x1d7eb9,_0x5753a0['options']);return db[_0x9088('0x34')]['find'](_0x1d7eb9)['then'](handleEntityNotFound(_0x192bbc,null))[_0x9088('0x2c')](respondWithResult(_0x192bbc,null))['catch'](handleError(_0x192bbc,null));};exports[_0x9088('0x4b')]=function(_0x346339,_0x5a2299,_0x4e88fb){var _0x17104a;return db[_0x9088('0x34')][_0x9088('0x4b')](_0x346339['body'],{'raw':!![]})[_0x9088('0x2c')](function(_0x11abf0){_0x17104a=_0x11abf0;return db[_0x9088('0x34')][_0x9088('0x4c')]({'raw':!![]});})['then'](function(_0x59f352){var _0x2d02e9=fs['readFileSync'](path[_0x9088('0x4d')](config[_0x9088('0x4e')],_0x9088('0x4f')),'utf8');var _0x43e0ed=ejs[_0x9088('0x50')](_0x2d02e9,{'contexts':_0x59f352||[]});fs['writeFileSync'](_0x9088('0x51'),_0x43e0ed);})[_0x9088('0x2c')](function(){return respondWithRpcPromise(_0x9088('0x52'),_0x9088('0x4b'),{'module':'chan_sip.so'});})[_0x9088('0x2c')](function(){var _0x2dae59=_0x346339['user'][_0x9088('0x53')]({'plain':!![]});if(!_0x2dae59)throw new Error(_0x9088('0x54'));if(_0x2dae59[_0x9088('0x55')]===_0x9088('0x56')){var _0x36b27f=_0x17104a['get']({'plain':!![]});return db[_0x9088('0x57')][_0x9088('0x58')]({'where':{'name':_0x9088('0x2d'),'userProfileId':_0x2dae59[_0x9088('0x59')]},'raw':!![]})['then'](function(_0x4341ce){if(_0x4341ce&&_0x4341ce[_0x9088('0x5a')]===0x0){return db['UserProfileResource']['create']({'name':_0x36b27f[_0x9088('0x31')],'resourceId':_0x36b27f['id'],'type':_0x4341ce['name'],'sectionId':_0x4341ce['id']},{})[_0x9088('0x2c')](function(){return _0x17104a;});}else{return _0x17104a;}})[_0x9088('0x47')](function(_0x267879){logger[_0x9088('0x1c')](_0x9088('0x5b'),_0x267879);throw _0x267879;});}return _0x17104a;})[_0x9088('0x2c')](respondWithResult(_0x5a2299,0xc9))[_0x9088('0x47')](handleError(_0x5a2299,null));};exports[_0x9088('0x2b')]=function(_0x54f601,_0x260f8a,_0x185621){var _0x2e6058;return db[_0x9088('0x34')][_0x9088('0x58')]({'where':{'id':_0x54f601[_0x9088('0x48')]['id']}})[_0x9088('0x2c')](handleEntityNotFound(_0x260f8a,null))[_0x9088('0x2c')](saveUpdates(_0x54f601[_0x9088('0x5c')],null))[_0x9088('0x2c')](function(_0x3cd3ec){if(_0x3cd3ec){_0x2e6058=_0x3cd3ec;return db[_0x9088('0x34')][_0x9088('0x4c')]({'raw':!![]});}})[_0x9088('0x2c')](function(_0x166e2b){var _0x5ed281=fs['readFileSync'](path['join'](config[_0x9088('0x4e')],_0x9088('0x4f')),_0x9088('0x5d'));var _0x32cc37=ejs['render'](_0x5ed281,{'contexts':_0x166e2b||[]});fs[_0x9088('0x5e')](_0x9088('0x51'),_0x32cc37);})[_0x9088('0x2c')](function(){return respondWithRpcPromise(_0x9088('0x52'),_0x9088('0x2b'),{'module':_0x9088('0x5f')});})[_0x9088('0x2c')](function(){return _0x2e6058;})[_0x9088('0x2c')](respondWithResult(_0x260f8a,null))['catch'](handleError(_0x260f8a,null));};exports[_0x9088('0x60')]=function(_0x437b76,_0x4c13d1,_0x5d5a29){var _0x1971ba;return db['VoiceContext'][_0x9088('0x58')]({'where':{'id':_0x437b76[_0x9088('0x48')]['id']}})[_0x9088('0x2c')](handleEntityNotFound(_0x4c13d1,null))[_0x9088('0x2c')](removeEntity(_0x4c13d1,null))[_0x9088('0x2c')](function(){return db[_0x9088('0x34')][_0x9088('0x4c')]({'raw':!![]});})[_0x9088('0x2c')](function(_0x26ea51){var _0x4b2cce=fs[_0x9088('0x61')](path['join'](config['root'],_0x9088('0x4f')),_0x9088('0x5d'));var _0x1a48be=ejs[_0x9088('0x50')](_0x4b2cce,{'contexts':_0x26ea51});fs[_0x9088('0x5e')](_0x9088('0x51'),_0x1a48be);return respondWithRpcPromise(_0x9088('0x52'),_0x9088('0x60'),{'module':_0x9088('0x5f')});})['catch'](handleError(_0x4c13d1,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 30aa7ab..a266b07 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 _0x7af2=['moment','./voiceContext.attributes','exports','VoiceContext','voice_contexts','lodash','util','../../config/logger','api'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x7af2,0x1eb));var _0x27af=function(_0x46da7a,_0x534410){_0x46da7a=_0x46da7a-0x0;var _0xe8f722=_0x7af2[_0x46da7a];return _0xe8f722;};'use strict';var _=require(_0x27af('0x0'));var util=require(_0x27af('0x1'));var logger=require(_0x27af('0x2'))(_0x27af('0x3'));var moment=require(_0x27af('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x27af('0x5'));module[_0x27af('0x6')]=function(_0x4c47fa,_0x5746b8){return _0x4c47fa['define'](_0x27af('0x7'),attributes,{'tableName':_0x27af('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x832c=['../../config/environment','exports','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','bluebird'];(function(_0x5565d9,_0xd96730){var _0x2ad4f0=function(_0x1950ad){while(--_0x1950ad){_0x5565d9['push'](_0x5565d9['shift']());}};_0x2ad4f0(++_0xd96730);}(_0x832c,0x1e5));var _0xc832=function(_0x7f681f,_0x59759a){_0x7f681f=_0x7f681f-0x0;var _0x141025=_0x832c[_0x7f681f];return _0x141025;};'use strict';var _=require(_0xc832('0x0'));var util=require(_0xc832('0x1'));var logger=require(_0xc832('0x2'))(_0xc832('0x3'));var moment=require('moment');var BPromise=require(_0xc832('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc832('0x5'));var attributes=require('./voiceContext.attributes');module[_0xc832('0x6')]=function(_0x367089,_0x152a12){return _0x367089[_0xc832('0x7')](_0xc832('0x8'),attributes,{'tableName':_0xc832('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index f7ece96..1456f50 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 _0x2c64=['stringify','error','code','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','request','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s'];(function(_0x299867,_0x3d673f){var _0x69e89e=function(_0x117df3){while(--_0x117df3){_0x299867['push'](_0x299867['shift']());}};_0x69e89e(++_0x3d673f);}(_0x2c64,0x181));var _0x42c6=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x2c64[_0xe73080];return _0x12cbc4;};'use strict';var _=require(_0x42c6('0x0'));var util=require(_0x42c6('0x1'));var moment=require('moment');var BPromise=require(_0x42c6('0x2'));var rs=require(_0x42c6('0x3'));var fs=require('fs');var Redis=require(_0x42c6('0x4'));var db=require(_0x42c6('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x42c6('0x6'));var config=require(_0x42c6('0x7'));var jayson=require(_0x42c6('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x58d2d0,_0x1d7439,_0x2c3d36){return new BPromise(function(_0x40abb6,_0x420503){return client[_0x42c6('0x9')](_0x58d2d0,_0x2c3d36)['then'](function(_0x373994){logger[_0x42c6('0xa')](_0x42c6('0xb'),_0x1d7439,'request\x20sent');logger[_0x42c6('0xc')](_0x42c6('0xd'),_0x1d7439,'request\x20sent',JSON[_0x42c6('0xe')](_0x373994));if(_0x373994[_0x42c6('0xf')]){if(_0x373994[_0x42c6('0xf')][_0x42c6('0x10')]===0x1f4){logger[_0x42c6('0xf')](_0x42c6('0xb'),_0x1d7439,_0x373994[_0x42c6('0xf')]['message']);return _0x420503(_0x373994[_0x42c6('0xf')][_0x42c6('0x11')]);}logger[_0x42c6('0xf')](_0x42c6('0xb'),_0x1d7439,_0x373994[_0x42c6('0xf')][_0x42c6('0x11')]);return _0x40abb6(_0x373994[_0x42c6('0xf')]['message']);}else{logger[_0x42c6('0xa')](_0x42c6('0xb'),_0x1d7439,_0x42c6('0x12'));_0x40abb6(_0x373994[_0x42c6('0x13')]['message']);}})[_0x42c6('0x14')](function(_0x4ee7e2){logger[_0x42c6('0xf')](_0x42c6('0xb'),_0x1d7439,_0x4ee7e2);_0x420503(_0x4ee7e2);});});} \ No newline at end of file +var _0x15f9=['stringify','error','code','VoiceContext,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s'];(function(_0xe6b037,_0x6ef873){var _0x2d1dcb=function(_0x34e554){while(--_0x34e554){_0xe6b037['push'](_0xe6b037['shift']());}};_0x2d1dcb(++_0x6ef873);}(_0x15f9,0xf7));var _0x915f=function(_0x1614c9,_0x1b6f1f){_0x1614c9=_0x1614c9-0x0;var _0x27ed63=_0x15f9[_0x1614c9];return _0x27ed63;};'use strict';var _=require(_0x915f('0x0'));var util=require(_0x915f('0x1'));var moment=require(_0x915f('0x2'));var BPromise=require(_0x915f('0x3'));var rs=require(_0x915f('0x4'));var fs=require('fs');var Redis=require(_0x915f('0x5'));var db=require(_0x915f('0x6'))['db'];var utils=require(_0x915f('0x7'));var logger=require(_0x915f('0x8'))('rpc');var config=require(_0x915f('0x9'));var jayson=require(_0x915f('0xa'));var client=jayson[_0x915f('0xb')][_0x915f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x59aea6,_0x45d20c,_0x17f4d7){return new BPromise(function(_0x130699,_0x301a66){return client['request'](_0x59aea6,_0x17f4d7)[_0x915f('0xd')](function(_0x139b5c){logger['info']('VoiceContext,\x20%s,\x20%s',_0x45d20c,_0x915f('0xe'));logger[_0x915f('0xf')](_0x915f('0x10'),_0x45d20c,_0x915f('0xe'),JSON[_0x915f('0x11')](_0x139b5c));if(_0x139b5c[_0x915f('0x12')]){if(_0x139b5c[_0x915f('0x12')][_0x915f('0x13')]===0x1f4){logger[_0x915f('0x12')](_0x915f('0x14'),_0x45d20c,_0x139b5c[_0x915f('0x12')][_0x915f('0x15')]);return _0x301a66(_0x139b5c['error'][_0x915f('0x15')]);}logger[_0x915f('0x12')](_0x915f('0x14'),_0x45d20c,_0x139b5c[_0x915f('0x12')]['message']);return _0x130699(_0x139b5c[_0x915f('0x12')]['message']);}else{logger[_0x915f('0x16')](_0x915f('0x14'),_0x45d20c,'request\x20sent');_0x130699(_0x139b5c[_0x915f('0x17')][_0x915f('0x15')]);}})['catch'](function(_0x23e0c2){logger[_0x915f('0x12')](_0x915f('0x14'),_0x45d20c,_0x23e0c2);_0x301a66(_0x23e0c2);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index beca546..3d74a2a 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 _0x01b7=['post','create','put','update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','index','/describe','isAuthenticated','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01b7,0x17f));var _0x701b=function(_0x3dfd18,_0x4b7fac){_0x3dfd18=_0x3dfd18-0x0;var _0x9c0fd=_0x01b7[_0x3dfd18];return _0x9c0fd;};'use strict';var multer=require(_0x701b('0x0'));var util=require(_0x701b('0x1'));var path=require(_0x701b('0x2'));var timeout=require('connect-timeout');var express=require(_0x701b('0x3'));var router=express[_0x701b('0x4')]();var fs_extra=require(_0x701b('0x5'));var auth=require(_0x701b('0x6'));var interaction=require(_0x701b('0x7'));var config=require(_0x701b('0x8'));var controller=require(_0x701b('0x9'));router[_0x701b('0xa')]('/',auth['isAuthenticated'](),controller[_0x701b('0xb')]);router[_0x701b('0xa')](_0x701b('0xc'),auth[_0x701b('0xd')](),controller['describe']);router['get'](_0x701b('0xe'),auth[_0x701b('0xd')](),controller[_0x701b('0xf')]);router[_0x701b('0x10')]('/',auth[_0x701b('0xd')](),controller[_0x701b('0x11')]);router[_0x701b('0x12')](_0x701b('0xe'),auth[_0x701b('0xd')](),controller[_0x701b('0x13')]);router['delete'](_0x701b('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x701b('0x14')]=router; \ No newline at end of file +var _0x45e4=['path','express','Router','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','delete','destroy','exports','multer','util'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x45e4,0x18e));var _0x445e=function(_0x42e223,_0x36df9b){_0x42e223=_0x42e223-0x0;var _0x571f9d=_0x45e4[_0x42e223];return _0x571f9d;};'use strict';var multer=require(_0x445e('0x0'));var util=require(_0x445e('0x1'));var path=require(_0x445e('0x2'));var timeout=require('connect-timeout');var express=require(_0x445e('0x3'));var router=express[_0x445e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x445e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x445e('0x6'));var controller=require(_0x445e('0x7'));router[_0x445e('0x8')]('/',auth[_0x445e('0x9')](),controller[_0x445e('0xa')]);router['get'](_0x445e('0xb'),auth['isAuthenticated'](),controller[_0x445e('0xc')]);router[_0x445e('0x8')](_0x445e('0xd'),auth[_0x445e('0x9')](),controller['show']);router[_0x445e('0xe')]('/',auth[_0x445e('0x9')](),controller[_0x445e('0xf')]);router[_0x445e('0x10')](_0x445e('0xd'),auth[_0x445e('0x9')](),controller['update']);router[_0x445e('0x11')](_0x445e('0xd'),auth['isAuthenticated'](),controller[_0x445e('0x12')]);module[_0x445e('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 41653be..f46dad2 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 _0x9957=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x77b8de,_0x4515df){var _0x3b685f=function(_0x58997f){while(--_0x58997f){_0x77b8de['push'](_0x77b8de['shift']());}};_0x3b685f(++_0x4515df);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'privilege':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize[_0x7995('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x7995('0x2')]},'calleridnum':{'type':Sequelize[_0x7995('0x2')]},'calleridname':{'type':Sequelize[_0x7995('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7995('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'context':{'type':Sequelize[_0x7995('0x2')]},'exten':{'type':Sequelize[_0x7995('0x2')]},'priority':{'type':Sequelize[_0x7995('0x3')]},'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x7995('0x2')]},'destchannelstate':{'type':Sequelize[_0x7995('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x7995('0x2')]},'destcalleridname':{'type':Sequelize[_0x7995('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7995('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7995('0x2')]},'destlanguage':{'type':Sequelize[_0x7995('0x2')]},'destaccountcode':{'type':Sequelize[_0x7995('0x2')]},'destcontext':{'type':Sequelize[_0x7995('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x7995('0x3')]},'destuniqueid':{'type':Sequelize[_0x7995('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x7995('0x2')]},'dialstatus':{'type':Sequelize[_0x7995('0x2')]},'starttime':{'type':Sequelize[_0x7995('0x4')]},'answertime':{'type':Sequelize[_0x7995('0x4')]},'endtime':{'type':Sequelize[_0x7995('0x4')]},'lastevent':{'type':Sequelize[_0x7995('0x2')],'comment':_0x7995('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x7995('0x3')]},'billableseconds':{'type':Sequelize[_0x7995('0x3')]}}; \ No newline at end of file +var _0x4b84=['INTEGER','STRING','DATE','called,connect,complete','sequelize','exports'];(function(_0x25e7da,_0x20e853){var _0x310d03=function(_0x575faa){while(--_0x575faa){_0x25e7da['push'](_0x25e7da['shift']());}};_0x310d03(++_0x20e853);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3e8cae,_0x4cb96a){_0x3e8cae=_0x3e8cae-0x0;var _0x45c4d6=_0x4b84[_0x3e8cae];return _0x45c4d6;};'use strict';var Sequelize=require(_0x44b8('0x0'));module[_0x44b8('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x44b8('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x44b8('0x3')]},'connectedlinenum':{'type':Sequelize[_0x44b8('0x3')]},'connectedlinename':{'type':Sequelize[_0x44b8('0x3')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x44b8('0x3')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x44b8('0x3')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x44b8('0x3')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x44b8('0x3')]},'destcalleridname':{'type':Sequelize[_0x44b8('0x3')]},'destconnectedlinenum':{'type':Sequelize[_0x44b8('0x3')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x44b8('0x3')]},'destaccountcode':{'type':Sequelize[_0x44b8('0x3')]},'destcontext':{'type':Sequelize[_0x44b8('0x3')]},'destexten':{'type':Sequelize[_0x44b8('0x3')]},'destpriority':{'type':Sequelize[_0x44b8('0x2')]},'destuniqueid':{'type':Sequelize[_0x44b8('0x3')]},'destlinkedid':{'type':Sequelize[_0x44b8('0x3')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x44b8('0x3')]},'starttime':{'type':Sequelize[_0x44b8('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x44b8('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x44b8('0x5')},'routeId':{'type':Sequelize[_0x44b8('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x44b8('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index fddb3f3..e0919dd 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 _0x985f=['sendStatus','end','json','undefined','count','offset','limit','status','set','Content-Range','apply','save','update','destroy','error','stack','name','send','index','map','VoiceDialReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','then','includeAll','include','findAll','rows','show','params','rawAttributes','merge','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x1ba51e,_0x5dbcd4){var _0x3881a9=function(_0x3cfde6){while(--_0x3cfde6){_0x1ba51e['push'](_0x1ba51e['shift']());}};_0x3881a9(++_0x5dbcd4);}(_0x985f,0x1cc));var _0xf985=function(_0x26fdfc,_0x5ede52){_0x26fdfc=_0x26fdfc-0x0;var _0x5c9e63=_0x985f[_0x26fdfc];return _0x5c9e63;};'use strict';var emlformat=require(_0xf985('0x0'));var rimraf=require(_0xf985('0x1'));var zipdir=require(_0xf985('0x2'));var jsonpatch=require(_0xf985('0x3'));var rp=require(_0xf985('0x4'));var moment=require('moment');var BPromise=require(_0xf985('0x5'));var Mustache=require(_0xf985('0x6'));var util=require(_0xf985('0x7'));var path=require(_0xf985('0x8'));var sox=require('sox');var csv=require(_0xf985('0x9'));var ejs=require(_0xf985('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf985('0xb'));var squel=require(_0xf985('0xc'));var crypto=require(_0xf985('0xd'));var jsforce=require(_0xf985('0xe'));var deskjs=require(_0xf985('0xf'));var toCsv=require(_0xf985('0x9'));var querystring=require(_0xf985('0x10'));var Papa=require(_0xf985('0x11'));var Redis=require(_0xf985('0x12'));var authService=require(_0xf985('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xf985('0x14'));var hardwareService=require(_0xf985('0x15'));var logger=require(_0xf985('0x16'))(_0xf985('0x17'));var utils=require(_0xf985('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf985('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x571573,_0x25d403){_0x25d403=_0x25d403||0xcc;return function(_0x1238bd){if(_0x1238bd){return _0x571573[_0xf985('0x1a')](_0x25d403);}return _0x571573['status'](_0x25d403)[_0xf985('0x1b')]();};}function respondWithResult(_0x3796a9,_0x1724e7){_0x1724e7=_0x1724e7||0xc8;return function(_0x7f594b){if(_0x7f594b){return _0x3796a9['status'](_0x1724e7)[_0xf985('0x1c')](_0x7f594b);}};}function respondWithFilteredResult(_0xb921c7,_0x2014f6){return function(_0x588803){if(_0x588803){var _0xfe2cbd=typeof _0x2014f6['offset']===_0xf985('0x1d')&&typeof _0x2014f6['limit']==='undefined';var _0x45a908=_0x588803['count'];var _0x3a0096=_0xfe2cbd?0x0:_0x2014f6['offset'];var _0x567347=_0xfe2cbd?_0x588803[_0xf985('0x1e')]:_0x2014f6[_0xf985('0x1f')]+_0x2014f6[_0xf985('0x20')];var _0xd46ce7;if(_0x567347>=_0x45a908){_0x567347=_0x45a908;_0xd46ce7=0xc8;}else{_0xd46ce7=0xce;}_0xb921c7[_0xf985('0x21')](_0xd46ce7);return _0xb921c7[_0xf985('0x22')](_0xf985('0x23'),_0x3a0096+'-'+_0x567347+'/'+_0x45a908)[_0xf985('0x1c')](_0x588803);}return null;};}function patchUpdates(_0x3cab46){return function(_0x5c1c98){try{jsonpatch[_0xf985('0x24')](_0x5c1c98,_0x3cab46,!![]);}catch(_0x44f77a){return BPromise['reject'](_0x44f77a);}return _0x5c1c98[_0xf985('0x25')]();};}function saveUpdates(_0x5a2202,_0x6a323f){return function(_0x174fc2){if(_0x174fc2){return _0x174fc2[_0xf985('0x26')](_0x5a2202)['then'](function(_0x2c172d){return _0x2c172d;});}return null;};}function removeEntity(_0x3133b2,_0x37a7dd){return function(_0x2fb6cf){if(_0x2fb6cf){return _0x2fb6cf[_0xf985('0x27')]()['then'](function(){_0x3133b2[_0xf985('0x21')](0xcc)[_0xf985('0x1b')]();});}};}function handleEntityNotFound(_0x9a3eee,_0x4d2bb9){return function(_0x25df4e){if(!_0x25df4e){_0x9a3eee[_0xf985('0x1a')](0x194);}return _0x25df4e;};}function handleError(_0x5b9ce2,_0x48a27c){_0x48a27c=_0x48a27c||0x1f4;return function(_0x2123c7){logger[_0xf985('0x28')](_0x2123c7[_0xf985('0x29')]);if(_0x2123c7[_0xf985('0x2a')]){delete _0x2123c7[_0xf985('0x2a')];}_0x5b9ce2[_0xf985('0x21')](_0x48a27c)[_0xf985('0x2b')](_0x2123c7);};}exports[_0xf985('0x2c')]=function(_0x24fd43,_0x5817c9){var _0xbb35a3={},_0x420aa8={},_0x8c9d7f={'count':0x0,'rows':[]};var _0x29bf72=_[_0xf985('0x2d')](db[_0xf985('0x2e')]['rawAttributes'],function(_0x3a815e){return{'name':_0x3a815e[_0xf985('0x2f')],'type':_0x3a815e[_0xf985('0x30')][_0xf985('0x31')]};});_0x420aa8[_0xf985('0x32')]=_[_0xf985('0x2d')](_0x29bf72,_0xf985('0x2a'));_0x420aa8[_0xf985('0x33')]=_[_0xf985('0x34')](_0x24fd43['query']);_0x420aa8[_0xf985('0x35')]=_[_0xf985('0x36')](_0x420aa8[_0xf985('0x32')],_0x420aa8[_0xf985('0x33')]);_0xbb35a3[_0xf985('0x37')]=_[_0xf985('0x36')](_0x420aa8[_0xf985('0x32')],qs[_0xf985('0x38')](_0x24fd43[_0xf985('0x33')]['fields']));_0xbb35a3[_0xf985('0x37')]=_0xbb35a3[_0xf985('0x37')][_0xf985('0x39')]?_0xbb35a3[_0xf985('0x37')]:_0x420aa8['model'];if(!_0x24fd43[_0xf985('0x33')][_0xf985('0x3a')](_0xf985('0x3b'))){_0xbb35a3[_0xf985('0x20')]=qs[_0xf985('0x20')](_0x24fd43[_0xf985('0x33')][_0xf985('0x20')]);_0xbb35a3[_0xf985('0x1f')]=qs[_0xf985('0x1f')](_0x24fd43['query'][_0xf985('0x1f')]);}_0xbb35a3[_0xf985('0x3c')]=qs[_0xf985('0x3d')](_0x24fd43[_0xf985('0x33')]['sort']);_0xbb35a3[_0xf985('0x3e')]=qs[_0xf985('0x35')](_[_0xf985('0x3f')](_0x24fd43[_0xf985('0x33')],_0x420aa8[_0xf985('0x35')]),_0x29bf72);if(_0x24fd43[_0xf985('0x33')]['filter']){_0xbb35a3[_0xf985('0x3e')]=_['merge'](_0xbb35a3['where'],{'$or':_['map'](_0x29bf72,function(_0x39a342){if(_0x39a342[_0xf985('0x30')]!==_0xf985('0x40')){var _0xb4c6ff={};_0xb4c6ff[_0x39a342['name']]={'$like':'%'+_0x24fd43[_0xf985('0x33')][_0xf985('0x41')]+'%'};return _0xb4c6ff;}})});}_0xbb35a3=_['merge']({},_0xbb35a3,_0x24fd43[_0xf985('0x42')]);var _0x52e618={'where':_0xbb35a3[_0xf985('0x3e')]};return db[_0xf985('0x2e')][_0xf985('0x1e')](_0x52e618)[_0xf985('0x43')](function(_0x5e94e3){_0x8c9d7f[_0xf985('0x1e')]=_0x5e94e3;if(_0x24fd43[_0xf985('0x33')][_0xf985('0x44')]){_0xbb35a3[_0xf985('0x45')]=[{'all':!![]}];}return db[_0xf985('0x2e')][_0xf985('0x46')](_0xbb35a3);})['then'](function(_0x448f04){_0x8c9d7f[_0xf985('0x47')]=_0x448f04;return _0x8c9d7f;})[_0xf985('0x43')](respondWithFilteredResult(_0x5817c9,_0xbb35a3))['catch'](handleError(_0x5817c9,null));};exports[_0xf985('0x48')]=function(_0x5e3abc,_0xab7121){var _0x18449f={'raw':!![],'where':{'id':_0x5e3abc[_0xf985('0x49')]['id']}},_0xcddb9={};_0xcddb9['model']=_[_0xf985('0x34')](db[_0xf985('0x2e')][_0xf985('0x4a')]);_0xcddb9[_0xf985('0x33')]=_[_0xf985('0x34')](_0x5e3abc[_0xf985('0x33')]);_0xcddb9[_0xf985('0x35')]=_[_0xf985('0x36')](_0xcddb9[_0xf985('0x32')],_0xcddb9['query']);_0x18449f[_0xf985('0x37')]=_[_0xf985('0x36')](_0xcddb9['model'],qs[_0xf985('0x38')](_0x5e3abc['query'][_0xf985('0x38')]));_0x18449f['attributes']=_0x18449f[_0xf985('0x37')][_0xf985('0x39')]?_0x18449f[_0xf985('0x37')]:_0xcddb9['model'];if(_0x5e3abc[_0xf985('0x33')][_0xf985('0x44')]){_0x18449f['include']=[{'all':!![]}];}_0x18449f=_[_0xf985('0x4b')]({},_0x18449f,_0x5e3abc[_0xf985('0x42')]);return db[_0xf985('0x2e')][_0xf985('0x4c')](_0x18449f)[_0xf985('0x43')](handleEntityNotFound(_0xab7121,null))['then'](respondWithResult(_0xab7121,null))[_0xf985('0x4d')](handleError(_0xab7121,null));};exports[_0xf985('0x4e')]=function(_0x1747f6,_0x488be2){return db[_0xf985('0x2e')][_0xf985('0x4e')](_0x1747f6[_0xf985('0x4f')],{})[_0xf985('0x43')](respondWithResult(_0x488be2,0xc9))[_0xf985('0x4d')](handleError(_0x488be2,null));};exports[_0xf985('0x26')]=function(_0x43661a,_0x37d6aa){if(_0x43661a[_0xf985('0x4f')]['id']){delete _0x43661a[_0xf985('0x4f')]['id'];}return db[_0xf985('0x2e')][_0xf985('0x4c')]({'where':{'id':_0x43661a[_0xf985('0x49')]['id']}})['then'](handleEntityNotFound(_0x37d6aa,null))[_0xf985('0x43')](saveUpdates(_0x43661a[_0xf985('0x4f')],null))['then'](respondWithResult(_0x37d6aa,null))[_0xf985('0x4d')](handleError(_0x37d6aa,null));};exports['destroy']=function(_0x236d79,_0x50a340){return db[_0xf985('0x2e')][_0xf985('0x4c')]({'where':{'id':_0x236d79[_0xf985('0x49')]['id']}})['then'](handleEntityNotFound(_0x50a340,null))['then'](removeEntity(_0x50a340,null))[_0xf985('0x4d')](handleError(_0x50a340,null));};exports[_0xf985('0x50')]=function(_0x26f334,_0x116ced){return db[_0xf985('0x2e')][_0xf985('0x50')]()['then'](respondWithResult(_0x116ced,null))[_0xf985('0x4d')](handleError(_0x116ced,null));}; \ No newline at end of file +var _0x1c35=['limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','map','VoiceDialReport','fieldName','key','model','name','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','count'];(function(_0x2d0d68,_0x11e7ab){var _0xb8b405=function(_0x505fe6){while(--_0x505fe6){_0x2d0d68['push'](_0x2d0d68['shift']());}};_0xb8b405(++_0x11e7ab);}(_0x1c35,0x1ae));var _0x51c3=function(_0x5e27e3,_0x3f477f){_0x5e27e3=_0x5e27e3-0x0;var _0x299dfd=_0x1c35[_0x5e27e3];return _0x299dfd;};'use strict';var emlformat=require(_0x51c3('0x0'));var rimraf=require(_0x51c3('0x1'));var zipdir=require(_0x51c3('0x2'));var jsonpatch=require(_0x51c3('0x3'));var rp=require(_0x51c3('0x4'));var moment=require(_0x51c3('0x5'));var BPromise=require(_0x51c3('0x6'));var Mustache=require(_0x51c3('0x7'));var util=require(_0x51c3('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x51c3('0x9'));var ejs=require(_0x51c3('0xa'));var fs=require('fs');var fs_extra=require(_0x51c3('0xb'));var _=require(_0x51c3('0xc'));var squel=require(_0x51c3('0xd'));var crypto=require(_0x51c3('0xe'));var jsforce=require(_0x51c3('0xf'));var deskjs=require(_0x51c3('0x10'));var toCsv=require('to-csv');var querystring=require(_0x51c3('0x11'));var Papa=require(_0x51c3('0x12'));var Redis=require(_0x51c3('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x51c3('0x14'));var hardwareService=require(_0x51c3('0x15'));var logger=require(_0x51c3('0x16'))(_0x51c3('0x17'));var utils=require(_0x51c3('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x51c3('0x19'))['db'];function respondWithStatusCode(_0x2a7825,_0x32269d){_0x32269d=_0x32269d||0xcc;return function(_0x46184e){if(_0x46184e){return _0x2a7825[_0x51c3('0x1a')](_0x32269d);}return _0x2a7825[_0x51c3('0x1b')](_0x32269d)['end']();};}function respondWithResult(_0x456f97,_0x12c0c7){_0x12c0c7=_0x12c0c7||0xc8;return function(_0x4ad6b4){if(_0x4ad6b4){return _0x456f97[_0x51c3('0x1b')](_0x12c0c7)[_0x51c3('0x1c')](_0x4ad6b4);}};}function respondWithFilteredResult(_0xa12a4d,_0x203f42){return function(_0x227d25){if(_0x227d25){var _0x50e7aa=typeof _0x203f42[_0x51c3('0x1d')]===_0x51c3('0x1e')&&typeof _0x203f42['limit']===_0x51c3('0x1e');var _0x787947=_0x227d25[_0x51c3('0x1f')];var _0x314de0=_0x50e7aa?0x0:_0x203f42[_0x51c3('0x1d')];var _0x349d03=_0x50e7aa?_0x227d25[_0x51c3('0x1f')]:_0x203f42[_0x51c3('0x1d')]+_0x203f42[_0x51c3('0x20')];var _0x3d736d;if(_0x349d03>=_0x787947){_0x349d03=_0x787947;_0x3d736d=0xc8;}else{_0x3d736d=0xce;}_0xa12a4d[_0x51c3('0x1b')](_0x3d736d);return _0xa12a4d[_0x51c3('0x21')](_0x51c3('0x22'),_0x314de0+'-'+_0x349d03+'/'+_0x787947)[_0x51c3('0x1c')](_0x227d25);}return null;};}function patchUpdates(_0x44eaf8){return function(_0x4eb94b){try{jsonpatch[_0x51c3('0x23')](_0x4eb94b,_0x44eaf8,!![]);}catch(_0x49fa4b){return BPromise[_0x51c3('0x24')](_0x49fa4b);}return _0x4eb94b[_0x51c3('0x25')]();};}function saveUpdates(_0x520634,_0x21cf38){return function(_0x4b44ac){if(_0x4b44ac){return _0x4b44ac[_0x51c3('0x26')](_0x520634)[_0x51c3('0x27')](function(_0x4b80e6){return _0x4b80e6;});}return null;};}function removeEntity(_0x55c152,_0x5bc063){return function(_0x3417ff){if(_0x3417ff){return _0x3417ff[_0x51c3('0x28')]()[_0x51c3('0x27')](function(){_0x55c152[_0x51c3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c0b3a,_0x464ec0){return function(_0x5dd5e3){if(!_0x5dd5e3){_0x4c0b3a[_0x51c3('0x1a')](0x194);}return _0x5dd5e3;};}function handleError(_0x4ab84d,_0x55a43b){_0x55a43b=_0x55a43b||0x1f4;return function(_0x3e7159){logger[_0x51c3('0x29')](_0x3e7159[_0x51c3('0x2a')]);if(_0x3e7159['name']){delete _0x3e7159['name'];}_0x4ab84d['status'](_0x55a43b)[_0x51c3('0x2b')](_0x3e7159);};}exports[_0x51c3('0x2c')]=function(_0x21010a,_0x3f91fb){var _0x45080f={},_0x27ae77={},_0x21c761={'count':0x0,'rows':[]};var _0x49de02=_[_0x51c3('0x2d')](db[_0x51c3('0x2e')]['rawAttributes'],function(_0x102d04){return{'name':_0x102d04[_0x51c3('0x2f')],'type':_0x102d04['type'][_0x51c3('0x30')]};});_0x27ae77[_0x51c3('0x31')]=_[_0x51c3('0x2d')](_0x49de02,_0x51c3('0x32'));_0x27ae77[_0x51c3('0x33')]=_[_0x51c3('0x34')](_0x21010a[_0x51c3('0x33')]);_0x27ae77['filters']=_[_0x51c3('0x35')](_0x27ae77[_0x51c3('0x31')],_0x27ae77[_0x51c3('0x33')]);_0x45080f[_0x51c3('0x36')]=_[_0x51c3('0x35')](_0x27ae77['model'],qs['fields'](_0x21010a['query'][_0x51c3('0x37')]));_0x45080f['attributes']=_0x45080f[_0x51c3('0x36')]['length']?_0x45080f[_0x51c3('0x36')]:_0x27ae77[_0x51c3('0x31')];if(!_0x21010a[_0x51c3('0x33')][_0x51c3('0x38')]('nolimit')){_0x45080f[_0x51c3('0x20')]=qs[_0x51c3('0x20')](_0x21010a[_0x51c3('0x33')][_0x51c3('0x20')]);_0x45080f[_0x51c3('0x1d')]=qs[_0x51c3('0x1d')](_0x21010a[_0x51c3('0x33')][_0x51c3('0x1d')]);}_0x45080f[_0x51c3('0x39')]=qs[_0x51c3('0x3a')](_0x21010a[_0x51c3('0x33')]['sort']);_0x45080f[_0x51c3('0x3b')]=qs['filters'](_[_0x51c3('0x3c')](_0x21010a[_0x51c3('0x33')],_0x27ae77[_0x51c3('0x3d')]),_0x49de02);if(_0x21010a[_0x51c3('0x33')][_0x51c3('0x3e')]){_0x45080f['where']=_[_0x51c3('0x3f')](_0x45080f[_0x51c3('0x3b')],{'$or':_[_0x51c3('0x2d')](_0x49de02,function(_0x7a70c){if(_0x7a70c[_0x51c3('0x40')]!==_0x51c3('0x41')){var _0x523ebe={};_0x523ebe[_0x7a70c['name']]={'$like':'%'+_0x21010a['query'][_0x51c3('0x3e')]+'%'};return _0x523ebe;}})});}_0x45080f=_[_0x51c3('0x3f')]({},_0x45080f,_0x21010a[_0x51c3('0x42')]);var _0x3aa4ab={'where':_0x45080f['where']};return db[_0x51c3('0x2e')][_0x51c3('0x1f')](_0x3aa4ab)[_0x51c3('0x27')](function(_0x30099c){_0x21c761[_0x51c3('0x1f')]=_0x30099c;if(_0x21010a[_0x51c3('0x33')][_0x51c3('0x43')]){_0x45080f[_0x51c3('0x44')]=[{'all':!![]}];}return db[_0x51c3('0x2e')][_0x51c3('0x45')](_0x45080f);})[_0x51c3('0x27')](function(_0x32a1e1){_0x21c761['rows']=_0x32a1e1;return _0x21c761;})[_0x51c3('0x27')](respondWithFilteredResult(_0x3f91fb,_0x45080f))[_0x51c3('0x46')](handleError(_0x3f91fb,null));};exports['show']=function(_0x245ea8,_0x57d262){var _0x3980af={'raw':!![],'where':{'id':_0x245ea8[_0x51c3('0x47')]['id']}},_0x35a8ff={};_0x35a8ff[_0x51c3('0x31')]=_['keys'](db[_0x51c3('0x2e')][_0x51c3('0x48')]);_0x35a8ff[_0x51c3('0x33')]=_[_0x51c3('0x34')](_0x245ea8['query']);_0x35a8ff[_0x51c3('0x3d')]=_[_0x51c3('0x35')](_0x35a8ff['model'],_0x35a8ff[_0x51c3('0x33')]);_0x3980af[_0x51c3('0x36')]=_[_0x51c3('0x35')](_0x35a8ff[_0x51c3('0x31')],qs['fields'](_0x245ea8[_0x51c3('0x33')]['fields']));_0x3980af[_0x51c3('0x36')]=_0x3980af[_0x51c3('0x36')]['length']?_0x3980af[_0x51c3('0x36')]:_0x35a8ff['model'];if(_0x245ea8[_0x51c3('0x33')][_0x51c3('0x43')]){_0x3980af[_0x51c3('0x44')]=[{'all':!![]}];}_0x3980af=_[_0x51c3('0x3f')]({},_0x3980af,_0x245ea8[_0x51c3('0x42')]);return db[_0x51c3('0x2e')][_0x51c3('0x49')](_0x3980af)[_0x51c3('0x27')](handleEntityNotFound(_0x57d262,null))[_0x51c3('0x27')](respondWithResult(_0x57d262,null))[_0x51c3('0x46')](handleError(_0x57d262,null));};exports[_0x51c3('0x4a')]=function(_0x3c58c3,_0x3c32fa){return db[_0x51c3('0x2e')][_0x51c3('0x4a')](_0x3c58c3[_0x51c3('0x4b')],{})[_0x51c3('0x27')](respondWithResult(_0x3c32fa,0xc9))[_0x51c3('0x46')](handleError(_0x3c32fa,null));};exports[_0x51c3('0x26')]=function(_0x261fa4,_0x45f722){if(_0x261fa4[_0x51c3('0x4b')]['id']){delete _0x261fa4[_0x51c3('0x4b')]['id'];}return db['VoiceDialReport'][_0x51c3('0x49')]({'where':{'id':_0x261fa4[_0x51c3('0x47')]['id']}})['then'](handleEntityNotFound(_0x45f722,null))[_0x51c3('0x27')](saveUpdates(_0x261fa4['body'],null))[_0x51c3('0x27')](respondWithResult(_0x45f722,null))[_0x51c3('0x46')](handleError(_0x45f722,null));};exports['destroy']=function(_0x3bde0d,_0x190aa5){return db[_0x51c3('0x2e')]['find']({'where':{'id':_0x3bde0d['params']['id']}})['then'](handleEntityNotFound(_0x190aa5,null))[_0x51c3('0x27')](removeEntity(_0x190aa5,null))[_0x51c3('0x46')](handleError(_0x190aa5,null));};exports[_0x51c3('0x4c')]=function(_0x135d9f,_0x5466ff){return db['VoiceDialReport']['describe']()['then'](respondWithResult(_0x5466ff,null))[_0x51c3('0x46')](handleError(_0x5466ff,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index a7dce64..c6886ec 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 _0xc904=['../../config/environment','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','moment','bluebird','path','rimraf'];(function(_0x388bd7,_0x1869e1){var _0x12cf5b=function(_0x2ab881){while(--_0x2ab881){_0x388bd7['push'](_0x388bd7['shift']());}};_0x12cf5b(++_0x1869e1);}(_0xc904,0x1aa));var _0x4c90=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xc904[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0x4c90('0x0'));var util=require(_0x4c90('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4c90('0x2'));var BPromise=require(_0x4c90('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c90('0x4'));var rimraf=require(_0x4c90('0x5'));var config=require(_0x4c90('0x6'));var attributes=require('./voiceDialReport.attributes');module[_0x4c90('0x7')]=function(_0x2dee19,_0x12343f){return _0x2dee19[_0x4c90('0x8')](_0x4c90('0x9'),attributes,{'tableName':_0x4c90('0xa'),'paranoid':![],'indexes':[{'fields':[_0x4c90('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x412d=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','lodash','../../config/logger','api'];(function(_0x4bf96c,_0x4d24fd){var _0x281d09=function(_0x56538e){while(--_0x56538e){_0x4bf96c['push'](_0x4bf96c['shift']());}};_0x281d09(++_0x4d24fd);}(_0x412d,0xe7));var _0xd412=function(_0x1fb6da,_0x28ddde){_0x1fb6da=_0x1fb6da-0x0;var _0x5ceb98=_0x412d[_0x1fb6da];return _0x5ceb98;};'use strict';var _=require(_0xd412('0x0'));var util=require('util');var logger=require(_0xd412('0x1'))(_0xd412('0x2'));var moment=require(_0xd412('0x3'));var BPromise=require(_0xd412('0x4'));var rp=require(_0xd412('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd412('0x6'));var config=require(_0xd412('0x7'));var attributes=require(_0xd412('0x8'));module[_0xd412('0x9')]=function(_0x3f4e92,_0xb03909){return _0x3f4e92[_0xd412('0xa')](_0xd412('0xb'),attributes,{'tableName':_0xd412('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 21f3aef..32f5bff 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 _0x5ecc=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','stringify','UpdateVoiceDialReport','update','where','attributes','limit','then'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5ecc,0x129));var _0xc5ec=function(_0x389ba4,_0x4aad50){_0x389ba4=_0x389ba4-0x0;var _0x565839=_0x5ecc[_0x389ba4];return _0x565839;};'use strict';var _=require(_0xc5ec('0x0'));var util=require('util');var moment=require(_0xc5ec('0x1'));var BPromise=require(_0xc5ec('0x2'));var rs=require(_0xc5ec('0x3'));var fs=require('fs');var Redis=require(_0xc5ec('0x4'));var db=require(_0xc5ec('0x5'))['db'];var utils=require(_0xc5ec('0x6'));var logger=require(_0xc5ec('0x7'))(_0xc5ec('0x8'));var config=require(_0xc5ec('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc5ec('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cc3f0,_0xa5155a,_0x47c9db){return new BPromise(function(_0x58fd41,_0x3c5308){return client['request'](_0x1cc3f0,_0x47c9db)['then'](function(_0x241773){logger[_0xc5ec('0xb')](_0xc5ec('0xc'),_0xa5155a,_0xc5ec('0xd'));logger[_0xc5ec('0xe')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0xa5155a,_0xc5ec('0xd'),JSON['stringify'](_0x241773));if(_0x241773['error']){if(_0x241773[_0xc5ec('0xf')][_0xc5ec('0x10')]===0x1f4){logger[_0xc5ec('0xf')](_0xc5ec('0xc'),_0xa5155a,_0x241773['error'][_0xc5ec('0x11')]);return _0x3c5308(_0x241773[_0xc5ec('0xf')][_0xc5ec('0x11')]);}logger[_0xc5ec('0xf')](_0xc5ec('0xc'),_0xa5155a,_0x241773[_0xc5ec('0xf')][_0xc5ec('0x11')]);return _0x58fd41(_0x241773['error'][_0xc5ec('0x11')]);}else{logger[_0xc5ec('0xb')](_0xc5ec('0xc'),_0xa5155a,_0xc5ec('0xd'));_0x58fd41(_0x241773[_0xc5ec('0x12')][_0xc5ec('0x11')]);}})[_0xc5ec('0x13')](function(_0x2dd697){logger[_0xc5ec('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0xa5155a,_0x2dd697);_0x3c5308(_0x2dd697);});});}exports[_0xc5ec('0x14')]=function(_0x2a6b58){var _0x1b6f0e=this;return new Promise(function(_0x177319,_0x12618b){return db[_0xc5ec('0x15')][_0xc5ec('0x16')](_0x2a6b58[_0xc5ec('0x17')],{'raw':_0x2a6b58[_0xc5ec('0x18')]?_0x2a6b58['options'][_0xc5ec('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3f9fcf){logger[_0xc5ec('0xb')](_0xc5ec('0x14'),_0x2a6b58);logger[_0xc5ec('0xe')](_0xc5ec('0x14'),_0x2a6b58,JSON[_0xc5ec('0x1a')](_0x3f9fcf));_0x177319(_0x3f9fcf);})[_0xc5ec('0x13')](function(_0x22269f){logger[_0xc5ec('0xf')](_0xc5ec('0x14'),_0x22269f[_0xc5ec('0x11')],_0x2a6b58);_0x12618b(_0x1b6f0e[_0xc5ec('0xf')](0x1f4,_0x22269f[_0xc5ec('0x11')]));});});};exports[_0xc5ec('0x1b')]=function(_0x173451){var _0x30c1e8=this;return new Promise(function(_0x422bd5,_0x532a0f){return db['VoiceDialReport'][_0xc5ec('0x1c')](_0x173451[_0xc5ec('0x17')],{'raw':_0x173451[_0xc5ec('0x18')]?_0x173451[_0xc5ec('0x18')][_0xc5ec('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x173451[_0xc5ec('0x18')]?_0x173451['options'][_0xc5ec('0x1d')]||null:null,'attributes':_0x173451[_0xc5ec('0x18')]?_0x173451[_0xc5ec('0x18')][_0xc5ec('0x1e')]||null:null,'limit':_0x173451[_0xc5ec('0x18')]?_0x173451[_0xc5ec('0x18')][_0xc5ec('0x1f')]||null:null})[_0xc5ec('0x20')](function(_0x2a1c86){logger[_0xc5ec('0xb')](_0xc5ec('0x1b'),_0x173451);logger[_0xc5ec('0xe')](_0xc5ec('0x1b'),_0x173451,JSON[_0xc5ec('0x1a')](_0x2a1c86));_0x422bd5(_0x2a1c86);})[_0xc5ec('0x13')](function(_0x4503bd){logger[_0xc5ec('0xf')](_0xc5ec('0x1b'),_0x4503bd['message'],_0x173451);_0x532a0f(_0x30c1e8[_0xc5ec('0xf')](0x1f4,_0x4503bd[_0xc5ec('0x11')]));});});}; \ No newline at end of file +var _0x9cb1=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','VoiceDialReport','create','body','options','raw','CreateVoiceDialReport','catch','attributes','limit','UpdateVoiceDialReport','lodash','util','moment'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0x9cb1,0x105));var _0x19cb=function(_0xd66dfa,_0xcc9c84){_0xd66dfa=_0xd66dfa-0x0;var _0x26b033=_0x9cb1[_0xd66dfa];return _0x26b033;};'use strict';var _=require(_0x19cb('0x0'));var util=require(_0x19cb('0x1'));var moment=require(_0x19cb('0x2'));var BPromise=require(_0x19cb('0x3'));var rs=require(_0x19cb('0x4'));var fs=require('fs');var Redis=require(_0x19cb('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x19cb('0x6'));var logger=require(_0x19cb('0x7'))(_0x19cb('0x8'));var config=require(_0x19cb('0x9'));var jayson=require(_0x19cb('0xa'));var client=jayson[_0x19cb('0xb')][_0x19cb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x61edbf,_0x1c49e8,_0x38e146){return new BPromise(function(_0x308c6d,_0x19b168){return client['request'](_0x61edbf,_0x38e146)[_0x19cb('0xd')](function(_0x25eace){logger['info'](_0x19cb('0xe'),_0x1c49e8,_0x19cb('0xf'));logger[_0x19cb('0x10')](_0x19cb('0x11'),_0x1c49e8,_0x19cb('0xf'),JSON[_0x19cb('0x12')](_0x25eace));if(_0x25eace[_0x19cb('0x13')]){if(_0x25eace[_0x19cb('0x13')]['code']===0x1f4){logger[_0x19cb('0x13')](_0x19cb('0xe'),_0x1c49e8,_0x25eace[_0x19cb('0x13')][_0x19cb('0x14')]);return _0x19b168(_0x25eace[_0x19cb('0x13')][_0x19cb('0x14')]);}logger[_0x19cb('0x13')](_0x19cb('0xe'),_0x1c49e8,_0x25eace[_0x19cb('0x13')][_0x19cb('0x14')]);return _0x308c6d(_0x25eace[_0x19cb('0x13')]['message']);}else{logger[_0x19cb('0x15')]('VoiceDialReport,\x20%s,\x20%s',_0x1c49e8,_0x19cb('0xf'));_0x308c6d(_0x25eace[_0x19cb('0x16')]['message']);}})['catch'](function(_0x1caee9){logger[_0x19cb('0x13')](_0x19cb('0xe'),_0x1c49e8,_0x1caee9);_0x19b168(_0x1caee9);});});}exports['CreateVoiceDialReport']=function(_0x316d28){var _0x4d584f=this;return new Promise(function(_0x46cd90,_0x45802d){return db[_0x19cb('0x17')][_0x19cb('0x18')](_0x316d28[_0x19cb('0x19')],{'raw':_0x316d28[_0x19cb('0x1a')]?_0x316d28[_0x19cb('0x1a')][_0x19cb('0x1b')]===undefined?!![]:![]:!![]})[_0x19cb('0xd')](function(_0x3823c7){logger['info'](_0x19cb('0x1c'),_0x316d28);logger['debug']('CreateVoiceDialReport',_0x316d28,JSON[_0x19cb('0x12')](_0x3823c7));_0x46cd90(_0x3823c7);})[_0x19cb('0x1d')](function(_0x42cb25){logger['error'](_0x19cb('0x1c'),_0x42cb25['message'],_0x316d28);_0x45802d(_0x4d584f[_0x19cb('0x13')](0x1f4,_0x42cb25['message']));});});};exports['UpdateVoiceDialReport']=function(_0x10c2d9){var _0xeeb669=this;return new Promise(function(_0x1da08c,_0x5cdb8b){return db[_0x19cb('0x17')]['update'](_0x10c2d9[_0x19cb('0x19')],{'raw':_0x10c2d9[_0x19cb('0x1a')]?_0x10c2d9[_0x19cb('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10c2d9[_0x19cb('0x1a')]?_0x10c2d9[_0x19cb('0x1a')]['where']||null:null,'attributes':_0x10c2d9[_0x19cb('0x1a')]?_0x10c2d9[_0x19cb('0x1a')][_0x19cb('0x1e')]||null:null,'limit':_0x10c2d9[_0x19cb('0x1a')]?_0x10c2d9[_0x19cb('0x1a')][_0x19cb('0x1f')]||null:null})[_0x19cb('0xd')](function(_0x33e8e9){logger[_0x19cb('0x15')]('UpdateVoiceDialReport',_0x10c2d9);logger[_0x19cb('0x10')](_0x19cb('0x20'),_0x10c2d9,JSON[_0x19cb('0x12')](_0x33e8e9));_0x1da08c(_0x33e8e9);})['catch'](function(_0x3351c8){logger[_0x19cb('0x13')]('UpdateVoiceDialReport',_0x3351c8[_0x19cb('0x14')],_0x10c2d9);_0x5cdb8b(_0xeeb669['error'](0x1f4,_0x3351c8[_0x19cb('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index e8ef933..584976f 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 _0xc293=['isAuthenticated','/:id','show','post','create','addApplications','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get'];(function(_0x12c550,_0xe8d7ac){var _0x16568b=function(_0x596181){while(--_0x596181){_0x12c550['push'](_0x12c550['shift']());}};_0x16568b(++_0xe8d7ac);}(_0xc293,0x16d));var _0x3c29=function(_0x10bd3d,_0x478dfb){_0x10bd3d=_0x10bd3d-0x0;var _0x48d6fd=_0xc293[_0x10bd3d];return _0x48d6fd;};'use strict';var multer=require(_0x3c29('0x0'));var util=require(_0x3c29('0x1'));var path=require('path');var timeout=require(_0x3c29('0x2'));var express=require('express');var router=express[_0x3c29('0x3')]();var fs_extra=require(_0x3c29('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3c29('0x5'));var config=require(_0x3c29('0x6'));var controller=require(_0x3c29('0x7'));router[_0x3c29('0x8')]('/',auth[_0x3c29('0x9')](),controller['index']);router['get'](_0x3c29('0xa'),auth[_0x3c29('0x9')](),controller[_0x3c29('0xb')]);router[_0x3c29('0xc')]('/',auth['isAuthenticated'](),controller[_0x3c29('0xd')]);router[_0x3c29('0xc')]('/:id/applications',auth[_0x3c29('0x9')](),controller[_0x3c29('0xe')]);router['put'](_0x3c29('0xa'),auth[_0x3c29('0x9')](),controller['update']);router[_0x3c29('0xf')](_0x3c29('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x3c29('0x10')]=router; \ No newline at end of file +var _0x67f6=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated','get','show','create','post','/:id/applications','addApplications','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x67f6,0x19e));var _0x667f=function(_0x13c72e,_0x52d828){_0x13c72e=_0x13c72e-0x0;var _0x998314=_0x67f6[_0x13c72e];return _0x998314;};'use strict';var multer=require(_0x667f('0x0'));var util=require(_0x667f('0x1'));var path=require(_0x667f('0x2'));var timeout=require(_0x667f('0x3'));var express=require(_0x667f('0x4'));var router=express[_0x667f('0x5')]();var fs_extra=require(_0x667f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x667f('0x7'));var config=require(_0x667f('0x8'));var controller=require(_0x667f('0x9'));router['get']('/',auth[_0x667f('0xa')](),controller['index']);router[_0x667f('0xb')]('/:id',auth[_0x667f('0xa')](),controller[_0x667f('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x667f('0xd')]);router[_0x667f('0xe')](_0x667f('0xf'),auth[_0x667f('0xa')](),controller[_0x667f('0x10')]);router[_0x667f('0x11')](_0x667f('0x12'),auth[_0x667f('0xa')](),controller['update']);router[_0x667f('0x13')](_0x667f('0x12'),auth[_0x667f('0xa')](),controller[_0x667f('0x14')]);module[_0x667f('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index ee749f8..5cf6b32 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 _0xee65=['sequelize','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','system','*,*,*,*','INTEGER','BOOLEAN','VIRTUAL'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xee65,0x82));var _0x5ee6=function(_0x3904fa,_0x176291){_0x3904fa=_0x3904fa-0x0;var _0x28ad2a=_0xee65[_0x3904fa];return _0x28ad2a;};'use strict';var Sequelize=require(_0x5ee6('0x0'));module['exports']={'context':{'type':Sequelize[_0x5ee6('0x1')],'allowNull':![],'unique':_0x5ee6('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x5ee6('0x1')],'allowNull':![],'unique':_0x5ee6('0x2')},'priority':{'type':Sequelize[_0x5ee6('0x1')],'allowNull':![],'defaultValue':'1','unique':_0x5ee6('0x2')},'tag':{'type':Sequelize[_0x5ee6('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5ee6('0x3')},'appdata':{'type':Sequelize[_0x5ee6('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x5ee6('0x4')](_0x5ee6('0x5'),_0x5ee6('0x6'),_0x5ee6('0x7'),'inbound-fax','outbound-fax',_0x5ee6('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x5ee6('0x1')],'allowNull':![],'defaultValue':_0x5ee6('0x9')},'IntervalId':{'type':Sequelize[_0x5ee6('0xa')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x5ee6('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x5ee6('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x5ee6('0xa')]},'recordingFormat':{'type':Sequelize[_0x5ee6('0x1')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x5ee6('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x5ee6('0xc')],'get':function(_0x104ca3){return this['getDataValue']('exten');}},'alias':{'type':Sequelize[_0x5ee6('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x8287=['inbound-fax','outbound-fax','system','any','BOOLEAN','INTEGER','sequelize','exports','STRING','compositeIndex','ENUM','inbound'];(function(_0x74c6c6,_0x54d54e){var _0x56ba8b=function(_0x2c885f){while(--_0x2c885f){_0x74c6c6['push'](_0x74c6c6['shift']());}};_0x56ba8b(++_0x54d54e);}(_0x8287,0x1b6));var _0x7828=function(_0x2aeca6,_0x565154){_0x2aeca6=_0x2aeca6-0x0;var _0x48c8c9=_0x8287[_0x2aeca6];return _0x48c8c9;};'use strict';var Sequelize=require(_0x7828('0x0'));module[_0x7828('0x1')]={'context':{'type':Sequelize[_0x7828('0x2')],'allowNull':![],'unique':_0x7828('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x7828('0x2')],'allowNull':![],'unique':_0x7828('0x3')},'priority':{'type':Sequelize[_0x7828('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x7828('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x7828('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x7828('0x4')](_0x7828('0x5'),'outbound','internal',_0x7828('0x6'),_0x7828('0x7'),_0x7828('0x8'),_0x7828('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x7828('0x2')]},'interval':{'type':Sequelize[_0x7828('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x7828('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x7828('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x7828('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x7828('0xa')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x7828('0xb')]},'recordingFormat':{'type':Sequelize[_0x7828('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4d4395){return this['getDataValue']('exten');}},'alias':{'type':Sequelize[_0x7828('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 447676a..028159a 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 _0x4703=['recordingFormat','cutdigits','alias','addApplications','sequelize','Transaction','ISOLATION_LEVELS','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','priority','error','finally','lodash','../../config/logger','api','../../config/environment','redis','./voiceExtension.socket','register','sendStatus','status','end','offset','undefined','count','set','Content-Range','destroy','get','inbound','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','includes','type','find','name','UserProfileResource','then','stack','send','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','limit','order','sort','pick','where','merge','VIRTUAL','options','VoiceExtension','includeAll','include','findAll','rows','catch','show','params','length','body','startsWith','exten','concat','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','internal','UserProfileSection','userProfileId','update','context','description'];(function(_0x12edf3,_0x2dc683){var _0x3e8216=function(_0x421e37){while(--_0x421e37){_0x12edf3['push'](_0x12edf3['shift']());}};_0x3e8216(++_0x2dc683);}(_0x4703,0x124));var _0x3470=function(_0x5e5756,_0x5dce02){_0x5e5756=_0x5e5756-0x0;var _0x2b6d76=_0x4703[_0x5e5756];return _0x2b6d76;};'use strict';var _=require(_0x3470('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x3470('0x1'))(_0x3470('0x2'));var config=require(_0x3470('0x3'));var db=require('../../mysqldb')['db'];config[_0x3470('0x4')]=_['defaults'](config[_0x3470('0x4')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3470('0x4')]));require(_0x3470('0x5'))[_0x3470('0x6')](socket);function respondWithStatusCode(_0x36119a,_0x576ec8){_0x576ec8=_0x576ec8||0xcc;return function(_0x56ac88){if(_0x56ac88){return _0x36119a[_0x3470('0x7')](_0x576ec8);}return _0x36119a[_0x3470('0x8')](_0x576ec8)[_0x3470('0x9')]();};}function respondWithResult(_0x212ba7,_0x4f1143){_0x4f1143=_0x4f1143||0xc8;return function(_0xa3a334){if(_0xa3a334){return _0x212ba7[_0x3470('0x8')](_0x4f1143)['json'](_0xa3a334);}};}function respondWithFilteredResult(_0x329d64,_0x437945){return function(_0x19ca06){if(_0x19ca06){var _0x59659b=typeof _0x437945[_0x3470('0xa')]===_0x3470('0xb')&&typeof _0x437945['limit']==='undefined';var _0x3f9c2e=_0x19ca06['count'];var _0x2e88e4=_0x59659b?0x0:_0x437945['offset'];var _0x230aba=_0x59659b?_0x19ca06[_0x3470('0xc')]:_0x437945['offset']+_0x437945['limit'];var _0x5f5521;if(_0x230aba>=_0x3f9c2e){_0x230aba=_0x3f9c2e;_0x5f5521=0xc8;}else{_0x5f5521=0xce;}_0x329d64[_0x3470('0x8')](_0x5f5521);return _0x329d64[_0x3470('0xd')](_0x3470('0xe'),_0x2e88e4+'-'+_0x230aba+'/'+_0x3f9c2e)['json'](_0x19ca06);}return null;};}function removeEntity(_0x3af0c9){return function(_0x501106){if(_0x501106){return _0x501106[_0x3470('0xf')]()['then'](function(){var _0x5514c9=_0x501106[_0x3470('0x10')]({'plain':!![]});var _0x3f7d6e=[{'name':'InboundRoutes','value':_0x3470('0x11'),'ignore':![]},{'name':_0x3470('0x12'),'value':_0x3470('0x13'),'ignore':![]},{'name':_0x3470('0x14'),'value':'internal','ignore':![]}];var _0x291cb9=_(_0x3f7d6e)[_0x3470('0x15')](_0x3470('0x16'))[_0x3470('0x17')](_0x3470('0x18'))[_0x3470('0x18')]();if(_[_0x3470('0x19')](_0x291cb9,_0x5514c9[_0x3470('0x1a')])){return;}var _0x2d2a10=_[_0x3470('0x1b')](_0x3f7d6e,[_0x3470('0x18'),_0x5514c9['type']])[_0x3470('0x1c')];return db[_0x3470('0x1d')][_0x3470('0xf')]({'where':{'type':_0x2d2a10,'resourceId':_0x5514c9['id']}})[_0x3470('0x1e')](function(){return _0x501106;});})[_0x3470('0x1e')](function(){_0x3af0c9[_0x3470('0x8')](0xcc)[_0x3470('0x9')]();});}};}function handleEntityNotFound(_0x114a10){return function(_0x2ee1ec){if(!_0x2ee1ec){_0x114a10['sendStatus'](0x194);}return _0x2ee1ec;};}function handleError(_0x3523f1,_0x1110d7){_0x1110d7=_0x1110d7||0x1f4;return function(_0x20ad03){logger['error'](_0x20ad03[_0x3470('0x1f')]);if(_0x20ad03[_0x3470('0x1c')]){delete _0x20ad03[_0x3470('0x1c')];}_0x3523f1['status'](_0x1110d7)[_0x3470('0x20')](_0x20ad03);};}exports[_0x3470('0x21')]=function(_0x166658,_0x19b790){var _0x3b5eba={},_0x8d633={},_0x21359d={'count':0x0,'rows':[]};var _0x6c264e=_['map'](db['VoiceExtension'][_0x3470('0x22')],function(_0x55bdaa){return{'name':_0x55bdaa[_0x3470('0x23')],'type':_0x55bdaa[_0x3470('0x1a')][_0x3470('0x24')]};});_0x8d633[_0x3470('0x25')]=_[_0x3470('0x17')](_0x6c264e,_0x3470('0x1c'));_0x8d633[_0x3470('0x26')]=_[_0x3470('0x27')](_0x166658['query']);_0x8d633[_0x3470('0x28')]=_[_0x3470('0x29')](_0x8d633[_0x3470('0x25')],_0x8d633['query']);_0x3b5eba[_0x3470('0x2a')]=_[_0x3470('0x29')](_0x8d633[_0x3470('0x25')],qs[_0x3470('0x2b')](_0x166658[_0x3470('0x26')][_0x3470('0x2b')]));_0x3b5eba[_0x3470('0x2a')]=_0x3b5eba[_0x3470('0x2a')]['length']?_0x3b5eba['attributes']:_0x8d633[_0x3470('0x25')];if(!_0x166658[_0x3470('0x26')]['hasOwnProperty']('nolimit')){_0x3b5eba[_0x3470('0x2c')]=qs['limit'](_0x166658[_0x3470('0x26')][_0x3470('0x2c')]);_0x3b5eba[_0x3470('0xa')]=qs[_0x3470('0xa')](_0x166658['query']['offset']);}_0x3b5eba[_0x3470('0x2d')]=qs[_0x3470('0x2e')](_0x166658['query'][_0x3470('0x2e')]);_0x3b5eba['where']=qs[_0x3470('0x28')](_[_0x3470('0x2f')](_0x166658['query'],_0x8d633[_0x3470('0x28')]),_0x6c264e);if(_0x166658[_0x3470('0x26')][_0x3470('0x15')]){_0x3b5eba[_0x3470('0x30')]=_[_0x3470('0x31')](_0x3b5eba[_0x3470('0x30')],{'$or':_[_0x3470('0x17')](_0x6c264e,function(_0xf996c0){if(_0xf996c0[_0x3470('0x1a')]!==_0x3470('0x32')){var _0x4259bd={};_0x4259bd[_0xf996c0[_0x3470('0x1c')]]={'$like':'%'+_0x166658[_0x3470('0x26')]['filter']+'%'};return _0x4259bd;}})});}_0x3b5eba=_[_0x3470('0x31')]({},_0x3b5eba,_0x166658[_0x3470('0x33')]);var _0x44c14e={'where':_0x3b5eba[_0x3470('0x30')]};return db[_0x3470('0x34')][_0x3470('0xc')](_0x44c14e)[_0x3470('0x1e')](function(_0x1f81c4){_0x21359d['count']=_0x1f81c4;if(_0x166658[_0x3470('0x26')][_0x3470('0x35')]){_0x3b5eba[_0x3470('0x36')]=[{'all':!![]}];}return db[_0x3470('0x34')][_0x3470('0x37')](_0x3b5eba);})[_0x3470('0x1e')](function(_0x4ef900){_0x21359d[_0x3470('0x38')]=_0x4ef900;return _0x21359d;})[_0x3470('0x1e')](respondWithFilteredResult(_0x19b790,_0x3b5eba))[_0x3470('0x39')](handleError(_0x19b790,null));};exports[_0x3470('0x3a')]=function(_0x47d088,_0x233073){var _0xf27660={'raw':![],'where':{'id':_0x47d088[_0x3470('0x3b')]['id']}},_0xd10133={};_0xd10133[_0x3470('0x25')]=_[_0x3470('0x27')](db[_0x3470('0x34')][_0x3470('0x22')]);_0xd10133[_0x3470('0x26')]=_[_0x3470('0x27')](_0x47d088['query']);_0xd10133['filters']=_['intersection'](_0xd10133[_0x3470('0x25')],_0xd10133[_0x3470('0x26')]);_0xf27660['attributes']=_[_0x3470('0x29')](_0xd10133[_0x3470('0x25')],qs[_0x3470('0x2b')](_0x47d088[_0x3470('0x26')]['fields']));_0xf27660['attributes']=_0xf27660['attributes'][_0x3470('0x3c')]?_0xf27660[_0x3470('0x2a')]:_0xd10133[_0x3470('0x25')];if(_0x47d088['query'][_0x3470('0x35')]){_0xf27660[_0x3470('0x36')]=[{'all':!![]}];}_0xf27660=_[_0x3470('0x31')]({},_0xf27660,_0x47d088[_0x3470('0x33')]);return db[_0x3470('0x34')][_0x3470('0x1b')](_0xf27660)[_0x3470('0x1e')](handleEntityNotFound(_0x233073,null))[_0x3470('0x1e')](respondWithResult(_0x233073,null))[_0x3470('0x39')](handleError(_0x233073,null));};exports[_0x3470('0xf')]=function(_0x21d5a4,_0x590ea3){return db['VoiceExtension'][_0x3470('0x1b')]({'where':{'id':_0x21d5a4['params']['id']}})[_0x3470('0x1e')](handleEntityNotFound(_0x590ea3,null))[_0x3470('0x1e')](removeEntity(_0x590ea3,null))[_0x3470('0x39')](handleError(_0x590ea3,null));};exports['create']=function(_0x314d97,_0x32d3c4){if(_0x314d97[_0x3470('0x3d')][_0x3470('0x1a')]==='outbound'&&!_[_0x3470('0x3e')](_0x314d97[_0x3470('0x3d')][_0x3470('0x3f')],'_')){_0x314d97['body'][_0x3470('0x3f')]='_'[_0x3470('0x40')](_0x314d97[_0x3470('0x3d')][_0x3470('0x3f')]);}return db[_0x3470('0x34')][_0x3470('0x41')](_0x314d97[_0x3470('0x3d')],{'raw':![]})[_0x3470('0x1e')](function(_0x294607){var _0xe4e046=_0x314d97[_0x3470('0x42')][_0x3470('0x10')]({'plain':!![]});if(!_0xe4e046)throw new Error(_0x3470('0x43'));if(_0xe4e046[_0x3470('0x44')]==='user'){var _0x4b42f0=_0x294607[_0x3470('0x10')]({'plain':!![]});var _0x4f6757=[{'name':_0x3470('0x45'),'value':_0x3470('0x11')},{'name':'OutboundRoutes','value':'outbound'},{'name':_0x3470('0x14'),'value':_0x3470('0x46')}];var _0x4603c1=_[_0x3470('0x1b')](_0x4f6757,[_0x3470('0x18'),_0x4b42f0['type']])[_0x3470('0x1c')];return db[_0x3470('0x47')][_0x3470('0x1b')]({'where':{'name':_0x4603c1,'userProfileId':_0xe4e046[_0x3470('0x48')]},'raw':!![]})[_0x3470('0x1e')](function(_0x2f8baa){if(_0x2f8baa&&_0x2f8baa['autoAssociation']===0x0){return db[_0x3470('0x1d')][_0x3470('0x41')]({'name':_0x4b42f0[_0x3470('0x1c')],'resourceId':_0x4b42f0['id'],'type':_0x2f8baa[_0x3470('0x1c')],'sectionId':_0x2f8baa['id']},{})[_0x3470('0x1e')](function(){return _0x294607;});}else{return _0x294607;}})[_0x3470('0x39')](function(_0x1adfa0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1adfa0);throw _0x1adfa0;});}return _0x294607;})[_0x3470('0x1e')](respondWithResult(_0x32d3c4,0xc9))['catch'](handleError(_0x32d3c4,null));};exports[_0x3470('0x49')]=function(_0x513a2d,_0x191a10){if(_0x513a2d[_0x3470('0x3d')]['id']){delete _0x513a2d[_0x3470('0x3d')]['id'];}return db['VoiceExtension'][_0x3470('0x1b')]({'where':{'id':_0x513a2d[_0x3470('0x3b')]['id']}})['then'](handleEntityNotFound(_0x191a10,null))['then'](function(_0x5199aa){if(_0x5199aa){return db[_0x3470('0x34')][_0x3470('0x49')](_[_0x3470('0x2f')](_0x513a2d[_0x3470('0x3d')],[_0x3470('0x3f'),_0x3470('0x4a'),_0x3470('0x4b'),_0x3470('0x4c'),_0x3470('0x4d'),'mandatoryDisposition',_0x3470('0x4e')]),{'where':{'context':_0x5199aa['context'],'exten':_0x5199aa['exten']},'individualHooks':!![]})['then'](function(_0x4b3df0){return _0x4b3df0;});}return null;})[_0x3470('0x1e')](respondWithStatusCode(_0x191a10,null))[_0x3470('0x39')](handleError(_0x191a10,null));};exports[_0x3470('0x4f')]=function(_0x2fd301,_0x3bfb04){var _0x217af4=_0x2fd301['params']['id'];var _0x2870db=_0x2fd301[_0x3470('0x3d')];var _0x2a711f=0xc8;var _0x99d527=null;return db[_0x3470('0x50')]['transaction']({'isolationLevel':db[_0x3470('0x50')][_0x3470('0x51')][_0x3470('0x52')]['READ_COMMITTED']},function(_0x5cdeb2){return db[_0x3470('0x34')][_0x3470('0x53')]({'where':{'id':_0x217af4},'transaction':_0x5cdeb2})[_0x3470('0x1e')](function(_0x386054){if(_0x386054){return db[_0x3470('0x34')][_0x3470('0xf')]({'where':{'VoiceExtensionId':_0x217af4},'transaction':_0x5cdeb2})[_0x3470('0x1e')](function(){var _0x2ad864=_['map'](_0x2870db,function(_0x42cb07){_0x42cb07[_0x3470('0x54')]=_0x217af4;_0x42cb07[_0x3470('0x55')]=!![];return _0x42cb07;});return _0x386054[_0x3470('0x56')](_0x2ad864);})[_0x3470('0x1e')](function(_0x32e709){return db['VoiceExtension'][_0x3470('0x57')](_0x32e709,{'transaction':_0x5cdeb2});});}else{_0x2a711f=0x194;_0x99d527=[];}});})[_0x3470('0x1e')](function(){if(_0x2a711f!==0x194){return db[_0x3470('0x34')][_0x3470('0x58')]({'where':{'isApp':!![],'VoiceExtensionId':_0x217af4},'order':_0x3470('0x59')})[_0x3470('0x1e')](function(_0x2b5a9c){_0x99d527=_0x2b5a9c;});}})[_0x3470('0x39')](function(_0x31b7ae){_0x2a711f=0x1f4;logger[_0x3470('0x5a')](_0x31b7ae[_0x3470('0x1f')]);if(_0x31b7ae[_0x3470('0x1c')]){delete _0x31b7ae[_0x3470('0x1c')];}_0x99d527=_0x31b7ae;})[_0x3470('0x5b')](function(){if(_0x99d527===null){_0x3bfb04['sendStatus'](_0x2a711f);}else{if(_0x2a711f===0x1f4){_0x3bfb04[_0x3470('0x8')](_0x2a711f)[_0x3470('0x20')](_0x99d527);}else{_0x3bfb04['status'](_0x2a711f)['json'](_0x99d527);}}});}; \ No newline at end of file +var _0xa3b9=['register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','then','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','find','value','type','end','error','stack','name','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','inbound','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','mandatoryDisposition','alias','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','findOne','destroy','VoiceExtensionId','isApp','createRouting','findAndCountAll','priority','finally','lodash','ioredis','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./voiceExtension.socket'];(function(_0x18cae7,_0x4bce2d){var _0x44d7cc=function(_0xf1e74e){while(--_0xf1e74e){_0x18cae7['push'](_0x18cae7['shift']());}};_0x44d7cc(++_0x4bce2d);}(_0xa3b9,0x10e));var _0x9a3b=function(_0x4108f0,_0xf11c7c){_0x4108f0=_0x4108f0-0x0;var _0xf538b4=_0xa3b9[_0x4108f0];return _0xf538b4;};'use strict';var _=require(_0x9a3b('0x0'));var Redis=require(_0x9a3b('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x9a3b('0x2'))(_0x9a3b('0x3'));var config=require(_0x9a3b('0x4'));var db=require('../../mysqldb')['db'];config[_0x9a3b('0x5')]=_['defaults'](config[_0x9a3b('0x5')],{'host':_0x9a3b('0x6'),'port':0x18eb});var socket=require(_0x9a3b('0x7'))(new Redis(config['redis']));require(_0x9a3b('0x8'))[_0x9a3b('0x9')](socket);function respondWithStatusCode(_0x4b9e99,_0x4528b1){_0x4528b1=_0x4528b1||0xcc;return function(_0x3a849a){if(_0x3a849a){return _0x4b9e99[_0x9a3b('0xa')](_0x4528b1);}return _0x4b9e99[_0x9a3b('0xb')](_0x4528b1)['end']();};}function respondWithResult(_0x3bb0e6,_0x4b5104){_0x4b5104=_0x4b5104||0xc8;return function(_0x36ef98){if(_0x36ef98){return _0x3bb0e6[_0x9a3b('0xb')](_0x4b5104)[_0x9a3b('0xc')](_0x36ef98);}};}function respondWithFilteredResult(_0xf3f47e,_0x3e9530){return function(_0x450bd7){if(_0x450bd7){var _0x257bfb=typeof _0x3e9530['offset']===_0x9a3b('0xd')&&typeof _0x3e9530[_0x9a3b('0xe')]==='undefined';var _0x50a824=_0x450bd7[_0x9a3b('0xf')];var _0x367ada=_0x257bfb?0x0:_0x3e9530['offset'];var _0x5db8cb=_0x257bfb?_0x450bd7[_0x9a3b('0xf')]:_0x3e9530[_0x9a3b('0x10')]+_0x3e9530['limit'];var _0x4cd464;if(_0x5db8cb>=_0x50a824){_0x5db8cb=_0x50a824;_0x4cd464=0xc8;}else{_0x4cd464=0xce;}_0xf3f47e[_0x9a3b('0xb')](_0x4cd464);return _0xf3f47e[_0x9a3b('0x11')](_0x9a3b('0x12'),_0x367ada+'-'+_0x5db8cb+'/'+_0x50a824)['json'](_0x450bd7);}return null;};}function removeEntity(_0x3d4441){return function(_0x557a3d){if(_0x557a3d){return _0x557a3d['destroy']()[_0x9a3b('0x13')](function(){var _0x44b843=_0x557a3d['get']({'plain':!![]});var _0x82d9a2=[{'name':_0x9a3b('0x14'),'value':'inbound','ignore':![]},{'name':_0x9a3b('0x15'),'value':_0x9a3b('0x16'),'ignore':![]},{'name':_0x9a3b('0x17'),'value':_0x9a3b('0x18'),'ignore':![]}];var _0x29a264=_(_0x82d9a2)[_0x9a3b('0x19')](_0x9a3b('0x1a'))[_0x9a3b('0x1b')]('value')['value']();if(_['includes'](_0x29a264,_0x44b843['type'])){return;}var _0x4b5201=_[_0x9a3b('0x1c')](_0x82d9a2,[_0x9a3b('0x1d'),_0x44b843[_0x9a3b('0x1e')]])['name'];return db['UserProfileResource']['destroy']({'where':{'type':_0x4b5201,'resourceId':_0x44b843['id']}})[_0x9a3b('0x13')](function(){return _0x557a3d;});})['then'](function(){_0x3d4441[_0x9a3b('0xb')](0xcc)[_0x9a3b('0x1f')]();});}};}function handleEntityNotFound(_0x5129db){return function(_0x3d0be3){if(!_0x3d0be3){_0x5129db[_0x9a3b('0xa')](0x194);}return _0x3d0be3;};}function handleError(_0x23935e,_0x4c263e){_0x4c263e=_0x4c263e||0x1f4;return function(_0x30f4d4){logger[_0x9a3b('0x20')](_0x30f4d4[_0x9a3b('0x21')]);if(_0x30f4d4[_0x9a3b('0x22')]){delete _0x30f4d4['name'];}_0x23935e['status'](_0x4c263e)['send'](_0x30f4d4);};}exports['index']=function(_0x201b35,_0x49f6a2){var _0x5b4a26={},_0x43c69a={},_0x209332={'count':0x0,'rows':[]};var _0x410fe3=_['map'](db[_0x9a3b('0x23')][_0x9a3b('0x24')],function(_0x12020e){return{'name':_0x12020e[_0x9a3b('0x25')],'type':_0x12020e[_0x9a3b('0x1e')][_0x9a3b('0x26')]};});_0x43c69a[_0x9a3b('0x27')]=_[_0x9a3b('0x1b')](_0x410fe3,_0x9a3b('0x22'));_0x43c69a[_0x9a3b('0x28')]=_[_0x9a3b('0x29')](_0x201b35[_0x9a3b('0x28')]);_0x43c69a[_0x9a3b('0x2a')]=_[_0x9a3b('0x2b')](_0x43c69a['model'],_0x43c69a[_0x9a3b('0x28')]);_0x5b4a26[_0x9a3b('0x2c')]=_[_0x9a3b('0x2b')](_0x43c69a[_0x9a3b('0x27')],qs[_0x9a3b('0x2d')](_0x201b35[_0x9a3b('0x28')][_0x9a3b('0x2d')]));_0x5b4a26['attributes']=_0x5b4a26[_0x9a3b('0x2c')][_0x9a3b('0x2e')]?_0x5b4a26[_0x9a3b('0x2c')]:_0x43c69a[_0x9a3b('0x27')];if(!_0x201b35[_0x9a3b('0x28')][_0x9a3b('0x2f')]('nolimit')){_0x5b4a26[_0x9a3b('0xe')]=qs[_0x9a3b('0xe')](_0x201b35[_0x9a3b('0x28')][_0x9a3b('0xe')]);_0x5b4a26[_0x9a3b('0x10')]=qs['offset'](_0x201b35[_0x9a3b('0x28')][_0x9a3b('0x10')]);}_0x5b4a26[_0x9a3b('0x30')]=qs[_0x9a3b('0x31')](_0x201b35[_0x9a3b('0x28')][_0x9a3b('0x31')]);_0x5b4a26[_0x9a3b('0x32')]=qs['filters'](_[_0x9a3b('0x33')](_0x201b35[_0x9a3b('0x28')],_0x43c69a[_0x9a3b('0x2a')]),_0x410fe3);if(_0x201b35[_0x9a3b('0x28')][_0x9a3b('0x19')]){_0x5b4a26[_0x9a3b('0x32')]=_[_0x9a3b('0x34')](_0x5b4a26[_0x9a3b('0x32')],{'$or':_[_0x9a3b('0x1b')](_0x410fe3,function(_0x54da4e){if(_0x54da4e['type']!==_0x9a3b('0x35')){var _0x47b8e4={};_0x47b8e4[_0x54da4e[_0x9a3b('0x22')]]={'$like':'%'+_0x201b35[_0x9a3b('0x28')][_0x9a3b('0x19')]+'%'};return _0x47b8e4;}})});}_0x5b4a26=_[_0x9a3b('0x34')]({},_0x5b4a26,_0x201b35[_0x9a3b('0x36')]);var _0x360a3f={'where':_0x5b4a26['where']};return db[_0x9a3b('0x23')][_0x9a3b('0xf')](_0x360a3f)[_0x9a3b('0x13')](function(_0x4d63e2){_0x209332[_0x9a3b('0xf')]=_0x4d63e2;if(_0x201b35[_0x9a3b('0x28')]['includeAll']){_0x5b4a26[_0x9a3b('0x37')]=[{'all':!![]}];}return db[_0x9a3b('0x23')][_0x9a3b('0x38')](_0x5b4a26);})[_0x9a3b('0x13')](function(_0x2fe32e){_0x209332[_0x9a3b('0x39')]=_0x2fe32e;return _0x209332;})['then'](respondWithFilteredResult(_0x49f6a2,_0x5b4a26))[_0x9a3b('0x3a')](handleError(_0x49f6a2,null));};exports[_0x9a3b('0x3b')]=function(_0x4c1004,_0x3ad43c){var _0x368a33={'raw':![],'where':{'id':_0x4c1004['params']['id']}},_0x924bf={};_0x924bf[_0x9a3b('0x27')]=_[_0x9a3b('0x29')](db[_0x9a3b('0x23')][_0x9a3b('0x24')]);_0x924bf[_0x9a3b('0x28')]=_[_0x9a3b('0x29')](_0x4c1004[_0x9a3b('0x28')]);_0x924bf[_0x9a3b('0x2a')]=_[_0x9a3b('0x2b')](_0x924bf[_0x9a3b('0x27')],_0x924bf[_0x9a3b('0x28')]);_0x368a33['attributes']=_[_0x9a3b('0x2b')](_0x924bf[_0x9a3b('0x27')],qs[_0x9a3b('0x2d')](_0x4c1004[_0x9a3b('0x28')][_0x9a3b('0x2d')]));_0x368a33['attributes']=_0x368a33['attributes'][_0x9a3b('0x2e')]?_0x368a33['attributes']:_0x924bf[_0x9a3b('0x27')];if(_0x4c1004['query']['includeAll']){_0x368a33[_0x9a3b('0x37')]=[{'all':!![]}];}_0x368a33=_['merge']({},_0x368a33,_0x4c1004['options']);return db[_0x9a3b('0x23')][_0x9a3b('0x1c')](_0x368a33)[_0x9a3b('0x13')](handleEntityNotFound(_0x3ad43c,null))[_0x9a3b('0x13')](respondWithResult(_0x3ad43c,null))['catch'](handleError(_0x3ad43c,null));};exports['destroy']=function(_0x30e9a1,_0x39baf2){return db[_0x9a3b('0x23')][_0x9a3b('0x1c')]({'where':{'id':_0x30e9a1[_0x9a3b('0x3c')]['id']}})[_0x9a3b('0x13')](handleEntityNotFound(_0x39baf2,null))[_0x9a3b('0x13')](removeEntity(_0x39baf2,null))[_0x9a3b('0x3a')](handleError(_0x39baf2,null));};exports[_0x9a3b('0x3d')]=function(_0x5520bd,_0x59c71){if(_0x5520bd[_0x9a3b('0x3e')]['type']==='outbound'&&!_[_0x9a3b('0x3f')](_0x5520bd[_0x9a3b('0x3e')][_0x9a3b('0x40')],'_')){_0x5520bd[_0x9a3b('0x3e')][_0x9a3b('0x40')]='_'[_0x9a3b('0x41')](_0x5520bd['body'][_0x9a3b('0x40')]);}return db[_0x9a3b('0x23')][_0x9a3b('0x3d')](_0x5520bd[_0x9a3b('0x3e')],{'raw':![]})['then'](function(_0x4cf2a0){var _0x476092=_0x5520bd[_0x9a3b('0x42')]['get']({'plain':!![]});if(!_0x476092)throw new Error(_0x9a3b('0x43'));if(_0x476092[_0x9a3b('0x44')]===_0x9a3b('0x42')){var _0x4c13da=_0x4cf2a0[_0x9a3b('0x45')]({'plain':!![]});var _0x12ef16=[{'name':_0x9a3b('0x14'),'value':_0x9a3b('0x46')},{'name':_0x9a3b('0x15'),'value':_0x9a3b('0x16')},{'name':'InternalRoutes','value':_0x9a3b('0x18')}];var _0x11428d=_['find'](_0x12ef16,[_0x9a3b('0x1d'),_0x4c13da[_0x9a3b('0x1e')]])[_0x9a3b('0x22')];return db[_0x9a3b('0x47')][_0x9a3b('0x1c')]({'where':{'name':_0x11428d,'userProfileId':_0x476092[_0x9a3b('0x48')]},'raw':!![]})[_0x9a3b('0x13')](function(_0x6be382){if(_0x6be382&&_0x6be382['autoAssociation']===0x0){return db[_0x9a3b('0x49')][_0x9a3b('0x3d')]({'name':_0x4c13da[_0x9a3b('0x22')],'resourceId':_0x4c13da['id'],'type':_0x6be382['name'],'sectionId':_0x6be382['id']},{})[_0x9a3b('0x13')](function(){return _0x4cf2a0;});}else{return _0x4cf2a0;}})[_0x9a3b('0x3a')](function(_0x6ec944){logger[_0x9a3b('0x20')](_0x9a3b('0x4a'),_0x6ec944);throw _0x6ec944;});}return _0x4cf2a0;})[_0x9a3b('0x13')](respondWithResult(_0x59c71,0xc9))[_0x9a3b('0x3a')](handleError(_0x59c71,null));};exports[_0x9a3b('0x4b')]=function(_0x30ffb1,_0x3b6bca){if(_0x30ffb1[_0x9a3b('0x3e')]['id']){delete _0x30ffb1[_0x9a3b('0x3e')]['id'];}return db[_0x9a3b('0x23')][_0x9a3b('0x1c')]({'where':{'id':_0x30ffb1[_0x9a3b('0x3c')]['id']}})[_0x9a3b('0x13')](handleEntityNotFound(_0x3b6bca,null))[_0x9a3b('0x13')](function(_0x5eb9f8){if(_0x5eb9f8){return db[_0x9a3b('0x23')][_0x9a3b('0x4b')](_[_0x9a3b('0x33')](_0x30ffb1['body'],['exten',_0x9a3b('0x4c'),_0x9a3b('0x4d'),_0x9a3b('0x4e'),'cutdigits',_0x9a3b('0x4f'),_0x9a3b('0x50')]),{'where':{'context':_0x5eb9f8[_0x9a3b('0x4c')],'exten':_0x5eb9f8[_0x9a3b('0x40')]},'individualHooks':!![]})[_0x9a3b('0x13')](function(_0x50900a){return _0x50900a;});}return null;})[_0x9a3b('0x13')](respondWithStatusCode(_0x3b6bca,null))['catch'](handleError(_0x3b6bca,null));};exports['addApplications']=function(_0x3c3c4e,_0x4ab8e0){var _0x3af095=_0x3c3c4e[_0x9a3b('0x3c')]['id'];var _0x1f2d86=_0x3c3c4e['body'];var _0x4a790c=0xc8;var _0x3159f3=null;return db['sequelize'][_0x9a3b('0x51')]({'isolationLevel':db[_0x9a3b('0x52')]['Transaction'][_0x9a3b('0x53')][_0x9a3b('0x54')]},function(_0x5eddfa){return db[_0x9a3b('0x23')][_0x9a3b('0x55')]({'where':{'id':_0x3af095},'transaction':_0x5eddfa})[_0x9a3b('0x13')](function(_0x2a25a7){if(_0x2a25a7){return db['VoiceExtension'][_0x9a3b('0x56')]({'where':{'VoiceExtensionId':_0x3af095},'transaction':_0x5eddfa})[_0x9a3b('0x13')](function(){var _0x75055f=_[_0x9a3b('0x1b')](_0x1f2d86,function(_0x2770c5){_0x2770c5[_0x9a3b('0x57')]=_0x3af095;_0x2770c5[_0x9a3b('0x58')]=!![];return _0x2770c5;});return _0x2a25a7[_0x9a3b('0x59')](_0x75055f);})['then'](function(_0x3cab47){return db[_0x9a3b('0x23')]['bulkCreate'](_0x3cab47,{'transaction':_0x5eddfa});});}else{_0x4a790c=0x194;_0x3159f3=[];}});})[_0x9a3b('0x13')](function(){if(_0x4a790c!==0x194){return db[_0x9a3b('0x23')][_0x9a3b('0x5a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3af095},'order':_0x9a3b('0x5b')})['then'](function(_0x444a35){_0x3159f3=_0x444a35;});}})[_0x9a3b('0x3a')](function(_0x390592){_0x4a790c=0x1f4;logger[_0x9a3b('0x20')](_0x390592[_0x9a3b('0x21')]);if(_0x390592[_0x9a3b('0x22')]){delete _0x390592[_0x9a3b('0x22')];}_0x3159f3=_0x390592;})[_0x9a3b('0x5c')](function(){if(_0x3159f3===null){_0x4ab8e0['sendStatus'](_0x4a790c);}else{if(_0x4a790c===0x1f4){_0x4ab8e0[_0x9a3b('0xb')](_0x4a790c)['send'](_0x3159f3);}else{_0x4ab8e0[_0x9a3b('0xb')](_0x4a790c)['json'](_0x3159f3);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index a9ad53b..0d8a432 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 _0x67ab=['hasOwnProperty','hook','exports','events','save','remove','emit'];(function(_0x10c3dc,_0x1b5d4b){var _0x3a4bec=function(_0x5efbe1){while(--_0x5efbe1){_0x10c3dc['push'](_0x10c3dc['shift']());}};_0x3a4bec(++_0x1b5d4b);}(_0x67ab,0x1e6));var _0xb67a=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x67ab[_0x167cc1];return _0x10bc4b;};'use strict';var EventEmitter=require(_0xb67a('0x0'));var VoiceExtension=require('../../mysqldb')['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb67a('0x1'),'afterUpdate':'update','afterDestroy':_0xb67a('0x2')};function emitEvent(_0x5ee193){return function(_0x37d602,_0x12d92e,_0x529c9c){VoiceExtensionEvents[_0xb67a('0x3')](_0x5ee193+':'+_0x37d602['id'],_0x37d602);VoiceExtensionEvents[_0xb67a('0x3')](_0x5ee193,_0x37d602);_0x529c9c(null);};}for(var e in events){if(events[_0xb67a('0x4')](e)){var event=events[e];VoiceExtension[_0xb67a('0x5')](e,emitEvent(event));}}module[_0xb67a('0x6')]=VoiceExtensionEvents; \ No newline at end of file +var _0x04b1=['events','../../mysqldb','VoiceExtension','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x04b1,0x129));var _0x104b=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0x04b1[_0x4dcc2d];return _0x1bbd79;};'use strict';var EventEmitter=require(_0x104b('0x0'));var VoiceExtension=require(_0x104b('0x1'))['db'][_0x104b('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x104b('0x3'),'afterUpdate':'update','afterDestroy':_0x104b('0x4')};function emitEvent(_0x5ad2c6){return function(_0x5aa386,_0x5191ee,_0x68a38c){VoiceExtensionEvents['emit'](_0x5ad2c6+':'+_0x5aa386['id'],_0x5aa386);VoiceExtensionEvents[_0x104b('0x5')](_0x5ad2c6,_0x5aa386);_0x68a38c(null);};}for(var e in events){if(events[_0x104b('0x6')](e)){var event=events[e];VoiceExtension[_0x104b('0x7')](e,emitEvent(event));}}module[_0x104b('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 f28f479..506cb7e 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 _0x425d=['lodash','exports','models','type','Set','CDR(type)=','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','trunk','options','split','length','name','param','prefix','phone','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','Interval','interval','IntervalId','then','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','callerID','NoOp(No\x20number\x20available)','answer','queue','includes','app','appType','custom','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','last','priority','catch','define','voice_extensions','get','concat','Hangup'];(function(_0x3566ea,_0x50e87d){var _0x24c0b9=function(_0x1f22a5){while(--_0x1f22a5){_0x3566ea['push'](_0x3566ea['shift']());}};_0x24c0b9(++_0x50e87d);}(_0x425d,0x1e0));var _0xd425=function(_0x502c83,_0x1db15d){_0x502c83=_0x502c83-0x0;var _0x40dd62=_0x425d[_0x502c83];return _0x40dd62;};'use strict';var _=require(_0xd425('0x0'));var attributes=require('./voiceExtension.attributes');module[_0xd425('0x1')]=function(_0x2d1eb3){var _0x314a2b=_0x2d1eb3[_0xd425('0x2')];function _0x183caa(_0x44ba48){var _0x47043f=0x2;var _0x596be7=[{'type':_0x44ba48[_0xd425('0x3')],'app':_0xd425('0x4'),'appdata':_0xd425('0x5')+_0x44ba48[_0xd425('0x3')],'context':_0x44ba48[_0xd425('0x6')],'exten':_0x44ba48[_0xd425('0x7')],'priority':_0x47043f++,'VoiceExtensionId':_0x44ba48['id']},{'type':_0x44ba48['type'],'app':_0x44ba48[_0xd425('0x8')]?_0xd425('0x4'):_0xd425('0x9'),'appdata':_0x44ba48[_0xd425('0x8')]?_0xd425('0xa')+_0x44ba48[_0xd425('0x8')]:_0xd425('0xb'),'context':_0x44ba48[_0xd425('0x6')],'exten':_0x44ba48[_0xd425('0x7')],'priority':_0x47043f++,'VoiceExtensionId':_0x44ba48['id']}];if(_0x44ba48[_0xd425('0x3')]===_0xd425('0xc')){_0x596be7[_0xd425('0xd')]({'type':_0xd425('0xc'),'app':_0xd425('0x4'),'appdata':_0xd425('0xe')+_0x44ba48['id'],'context':_0x44ba48[_0xd425('0x6')],'exten':_0x44ba48[_0xd425('0x7')],'priority':_0x47043f++,'VoiceExtensionId':_0x44ba48['id']});}_0x596be7[_0xd425('0xd')]({'type':_0x44ba48[_0xd425('0x3')],'app':_0xd425('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x44ba48[_0xd425('0x6')],'exten':_0x44ba48[_0xd425('0x7')],'priority':_0x47043f++,'VoiceExtensionId':_0x44ba48['id']},{'type':_0x44ba48[_0xd425('0x3')],'app':'Set','appdata':_0xd425('0xf'),'context':_0x44ba48[_0xd425('0x6')],'exten':_0x44ba48[_0xd425('0x7')],'priority':_0x47043f++,'VoiceExtensionId':_0x44ba48['id']},{'type':_0x44ba48[_0xd425('0x3')],'app':_0xd425('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0x44ba48[_0xd425('0x6')],'exten':_0x44ba48[_0xd425('0x7')],'priority':_0x47043f++,'VoiceExtensionId':_0x44ba48['id']});return _0x596be7;}function _0x7e267e(_0x5dda0c){var _0x5d6585=0x2;var _0x19d7d4=[{'type':_0xd425('0x10'),'app':_0xd425('0x4'),'appdata':_0xd425('0x11'),'context':_0x5dda0c['context'],'exten':_0x5dda0c['exten'],'priority':_0x5d6585++,'VoiceExtensionId':_0x5dda0c['id']},{'type':'outbound','app':_0x5dda0c['alias']?_0xd425('0x4'):_0xd425('0x9'),'appdata':_0x5dda0c[_0xd425('0x8')]?'CDR(routeAlias)='+_0x5dda0c[_0xd425('0x8')]:_0xd425('0xb'),'context':_0x5dda0c['context'],'exten':_0x5dda0c[_0xd425('0x7')],'priority':_0x5d6585++,'VoiceExtensionId':_0x5dda0c['id']},{'type':_0xd425('0x10'),'app':_0xd425('0x4'),'appdata':_0xd425('0x12')+(_0x5dda0c[_0xd425('0x13')]?_0xd425('0x14')+_0x5dda0c[_0xd425('0x13')]+'}':_0xd425('0x15')),'context':_0x5dda0c[_0xd425('0x6')],'exten':_0x5dda0c[_0xd425('0x7')],'priority':_0x5d6585++,'VoiceExtensionId':_0x5dda0c['id']},{'type':_0xd425('0x10'),'app':_0xd425('0x4'),'appdata':'CDR(routeid)='+_0x5dda0c['id'],'context':_0x5dda0c[_0xd425('0x6')],'exten':_0x5dda0c[_0xd425('0x7')],'priority':_0x5d6585++,'VoiceExtensionId':_0x5dda0c['id']},{'type':_0xd425('0x10'),'app':_0xd425('0x16'),'appdata':_0xd425('0x17')+(_0x5d6585+0x2)+_0xd425('0x18')+(_0x5d6585+0x1)+')','context':_0x5dda0c[_0xd425('0x6')],'exten':_0x5dda0c['exten'],'priority':_0x5d6585++,'VoiceExtensionId':_0x5dda0c['id']},{'type':_0xd425('0x10'),'app':_0xd425('0x4'),'appdata':_0x5dda0c[_0xd425('0x13')]?'CDR(prefix)=${EXTEN:0:'+_0x5dda0c[_0xd425('0x13')]+'}':_0xd425('0x19'),'context':_0x5dda0c[_0xd425('0x6')],'exten':_0x5dda0c[_0xd425('0x7')],'priority':_0x5d6585++,'VoiceExtensionId':_0x5dda0c['id']},{'type':_0xd425('0x10'),'app':_0xd425('0x4'),'appdata':_0xd425('0x1a'),'context':_0x5dda0c[_0xd425('0x6')],'exten':_0x5dda0c[_0xd425('0x7')],'priority':_0x5d6585++,'VoiceExtensionId':_0x5dda0c['id']},{'type':_0xd425('0x10'),'app':'Set','appdata':_0xd425('0xf'),'context':_0x5dda0c[_0xd425('0x6')],'exten':_0x5dda0c[_0xd425('0x7')],'priority':_0x5d6585++,'VoiceExtensionId':_0x5dda0c['id']},{'type':_0xd425('0x10'),'app':_0xd425('0x4'),'appdata':_0xd425('0x1b'),'context':_0x5dda0c[_0xd425('0x6')],'exten':_0x5dda0c[_0xd425('0x7')],'priority':_0x5d6585++,'VoiceExtensionId':_0x5dda0c['id']},{'type':_0xd425('0x10'),'app':_0xd425('0x4'),'appdata':_0xd425('0x1c')+_0x5dda0c['id'],'context':_0x5dda0c['context'],'exten':_0x5dda0c[_0xd425('0x7')],'priority':_0x5d6585++,'VoiceExtensionId':_0x5dda0c['id']}];if(_0x5dda0c[_0xd425('0x1d')](_0xd425('0x1e'))&&_0x5dda0c[_0xd425('0x1e')]!==_0xd425('0x1f')){_0x19d7d4['push']({'type':_0xd425('0x10'),'app':_0xd425('0x4'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x5dda0c['context'],'exten':_0x5dda0c['exten'],'priority':_0x5d6585++,'VoiceExtensionId':_0x5dda0c['id']},{'type':_0xd425('0x10'),'app':_0xd425('0x4'),'appdata':_0xd425('0x20')+_0x5dda0c[_0xd425('0x1e')]||'wav','context':_0x5dda0c[_0xd425('0x6')],'exten':_0x5dda0c[_0xd425('0x7')],'priority':_0x5d6585++,'VoiceExtensionId':_0x5dda0c['id']});}return _0x19d7d4;}function _0x30a9dc(_0x1c7f72,_0x27b9e2){var _0x1e12f2=[{'name':_0xd425('0x21'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0xd425('0x22'),'param':0x2},{'name':'url','param':0x3}];var _0x22df81={};var _0x29cca9=_0x27b9e2[_0xd425('0x23')](',');var _0x4ef4ab=[];for(var _0x3ccbed=0x0;_0x3ccbed<_0x1e12f2[_0xd425('0x24')];_0x3ccbed++){switch(_0x1e12f2[_0x3ccbed][_0xd425('0x25')]){case _0xd425('0x21'):_0x22df81['trunk']=_0x29cca9[_0x1e12f2[_0x3ccbed][_0xd425('0x26')]][_0xd425('0x23')]('/')[0x1];_0x22df81['phone']=_0x29cca9[_0x1e12f2[_0x3ccbed]['param']]['split']('/')[0x2];_0x22df81[_0xd425('0x27')]=_0x22df81[_0xd425('0x28')]?_0x22df81[_0xd425('0x28')]['split']('$')[0x0]:undefined;_0x22df81['phone']=_0x1c7f72['cutdigits']?(_0x22df81[_0xd425('0x27')]||'')+_0xd425('0x14')+_0x1c7f72[_0xd425('0x13')]+'}':(_0x22df81[_0xd425('0x27')]||'')+_0xd425('0x15');_0x4ef4ab[_0x1e12f2[_0x3ccbed][_0xd425('0x26')]]=[_0xd425('0x29'),_0x22df81['trunk'],_0x22df81[_0xd425('0x28')]][_0xd425('0x2a')]('/');break;case _0xd425('0x22'):_0x22df81['options']=_0x29cca9[_0x1e12f2[_0x3ccbed][_0xd425('0x26')]];if(_0x1c7f72[_0xd425('0x1e')]!==_0xd425('0x1f')){if(_0x22df81['options'][_0xd425('0x2b')](_0xd425('0x2c'))<0x0){_0x22df81[_0xd425('0x22')]+=_0xd425('0x2c');}}else{_0x22df81['options']=_0x22df81[_0xd425('0x22')][_0xd425('0x2d')](_0xd425('0x2c'),'');}_0x4ef4ab[_0x1e12f2[_0x3ccbed][_0xd425('0x26')]]=_0x22df81[_0xd425('0x22')];break;default:_0x4ef4ab[_0x1e12f2[_0x3ccbed][_0xd425('0x26')]]=_0x29cca9[_0x1e12f2[_0x3ccbed][_0xd425('0x26')]];}}return _0x4ef4ab['join'](',');}function _0x26e7cd(_0x62f360,_0x5b65fe,_0x1a44a8){return new Promise(function(_0x491c51,_0x5e12bf){var _0x3783d2=[];if(_['isEmpty'](_0x5b65fe))return _0x491c51(_0x3783d2);_0x314a2b[_0xd425('0x2e')]['findAll']({'attributes':['id',_0xd425('0x2f'),_0xd425('0x30')],'raw':!![]})[_0xd425('0x31')](function(_0x3516f3){for(var _0x4420d2=0x0,_0x4f3af2=0x0;_0x4420d2<_0x5b65fe[_0xd425('0x24')];_0x4420d2++,_0x4f3af2=0x0){var _0x5f3cfd=_0x5b65fe[_0x4420d2];var _0x261c67=[];var _0x55a15d=[];delete _0x5f3cfd['id'];if(_0x5f3cfd[_0xd425('0x2f')]!==_0xd425('0x32')){_0x5f3cfd[_0xd425('0x33')]=[_0x5f3cfd[_0xd425('0x2f')]];}else{_0x5f3cfd[_0xd425('0x33')]=_0x5f3cfd['IntervalId']?_[_0xd425('0x34')](_[_0xd425('0x35')](_0x3516f3,{'IntervalId':_0x5f3cfd[_0xd425('0x30')]}),_0xd425('0x2f')):[];}_0x5f3cfd[_0xd425('0x6')]=_0x62f360['context'];_0x5f3cfd[_0xd425('0x7')]=_0x62f360[_0xd425('0x7')];if(_0x5f3cfd[_0xd425('0x3')])_0x5f3cfd[_0xd425('0x3')]=_0x5f3cfd[_0xd425('0x3')][_0xd425('0x36')]();if(_0x62f360['type']===_0xd425('0x10')){if(_0x5f3cfd[_0xd425('0x1d')]('tag')&&_0x5f3cfd[_0xd425('0x37')]&&_0x5f3cfd[_0xd425('0x37')]!=='--'){_0x261c67[_0xd425('0xd')]({'type':_0x5f3cfd[_0xd425('0x3')]['toLowerCase'](),'app':_0xd425('0x4'),'appdata':_0xd425('0x38')+_0x5f3cfd[_0xd425('0x37')],'context':_0x62f360[_0xd425('0x6')],'exten':_0x62f360[_0xd425('0x7')],'priority':_0x5f3cfd['intervals']['length']+_0x1a44a8+_0x4f3af2++,'VoiceExtensionId':_0x62f360['id']});}_0x261c67[_0xd425('0xd')]({'type':_0x5f3cfd['type'][_0xd425('0x36')](),'app':_0xd425('0x16'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x5f3cfd[_0xd425('0x39')]?'Set(CALLERID(all)='+_0x5f3cfd['callerID']+')':_0xd425('0x3a')),'context':_0x62f360[_0xd425('0x6')],'exten':_0x62f360[_0xd425('0x7')],'priority':_0x5f3cfd[_0xd425('0x33')][_0xd425('0x24')]+_0x1a44a8+_0x4f3af2++,'VoiceExtensionId':_0x62f360['id']});}else{if(_0x5f3cfd[_0xd425('0x1d')](_0xd425('0x3b'))){if([_0xd425('0x3c'),'playback'][_0xd425('0x3d')](_0x5f3cfd[_0xd425('0x3e')][_0xd425('0x36')]())&&_0x5f3cfd[_0xd425('0x3f')]!==_0xd425('0x40')){if(_0x5f3cfd[_0xd425('0x3b')]){_0x261c67[_0xd425('0xd')]({'type':_0x5f3cfd[_0xd425('0x3')]['toLowerCase'](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x62f360[_0xd425('0x6')],'exten':_0x62f360[_0xd425('0x7')],'priority':_0x5f3cfd[_0xd425('0x33')][_0xd425('0x24')]+_0x1a44a8+_0x4f3af2++,'VoiceExtensionId':_0x62f360['id']});_0x261c67['push']({'type':_0x5f3cfd['type']['toLowerCase'](),'app':'Set','appdata':_0xd425('0x41'),'context':_0x62f360[_0xd425('0x6')],'exten':_0x62f360['exten'],'priority':_0x5f3cfd[_0xd425('0x33')][_0xd425('0x24')]+_0x1a44a8+_0x4f3af2++,'VoiceExtensionId':_0x62f360['id']});}else{_0x261c67[_0xd425('0xd')]({'type':_0x5f3cfd['type']['toLowerCase'](),'app':_0xd425('0x16'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x62f360['context'],'exten':_0x62f360['exten'],'priority':_0x5f3cfd[_0xd425('0x33')][_0xd425('0x24')]+_0x1a44a8+_0x4f3af2++,'VoiceExtensionId':_0x62f360['id']});_0x261c67[_0xd425('0xd')]({'type':_0x5f3cfd['type'][_0xd425('0x36')](),'app':'Set','appdata':_0xd425('0x42'),'context':_0x62f360[_0xd425('0x6')],'exten':_0x62f360[_0xd425('0x7')],'priority':_0x5f3cfd[_0xd425('0x33')][_0xd425('0x24')]+_0x1a44a8+_0x4f3af2++,'VoiceExtensionId':_0x62f360['id']});}}}}for(var _0xd261a=0x0;_0xd261a<_0x5f3cfd[_0xd425('0x33')][_0xd425('0x24')];_0xd261a++){var _0x23f9f1=_0x1a44a8+_0x5f3cfd['intervals'][_0xd425('0x24')];var _0x1d9d10=_0xd261a===_0x5f3cfd[_0xd425('0x33')][_0xd425('0x24')]-0x1?_0x1a44a8+_0x261c67['length']+_0x55a15d['length']+0x2:_0x1a44a8+_0xd261a+0x1;_0x261c67[_0xd425('0x43')](_0xd261a,0x0,{'type':_0x62f360[_0xd425('0x3')],'app':_0xd425('0x44'),'appdata':_0x5f3cfd[_0xd425('0x33')][_0xd261a]+'?'+_0x62f360[_0xd425('0x6')]+_0xd425('0x45')+_0x23f9f1+':'+_0x62f360[_0xd425('0x6')]+_0xd425('0x45')+_0x1d9d10,'exten':_0x62f360[_0xd425('0x7')],'context':_0x62f360[_0xd425('0x6')],'priority':_0x1a44a8+_0xd261a,'VoiceExtensionId':_0x62f360['id']});}if(_0x5f3cfd[_0xd425('0x3f')]===_0xd425('0x46'))_0x5f3cfd[_0xd425('0x47')]=_0x30a9dc(_0x62f360,_0x5f3cfd[_0xd425('0x47')]);_0x5f3cfd['priority']=_0x261c67[_0xd425('0x24')]?_[_0xd425('0x48')](_0x261c67)[_0xd425('0x49')]+0x1:_0x1a44a8;_0x3783d2=_['concat'](_0x3783d2,_0x261c67,[_0x5f3cfd],_0x55a15d);_0x1a44a8=_['last'](_0x3783d2)['priority']+0x1;}return _0x491c51(_0x3783d2);})[_0xd425('0x4a')](function(_0x34d065){_0x5e12bf(_0x34d065);});});}return _0x2d1eb3[_0xd425('0x4b')]('VoiceExtension',attributes,{'tableName':_0xd425('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4c1878){var _0x2811a4=this[_0xd425('0x4d')]({'plain':!![]});var _0x21d26e=_0x2811a4['type']===_0xd425('0x10')?_0x7e267e(_0x2811a4):_0x183caa(_0x2811a4);return _0x26e7cd(_0x2811a4,_0x4c1878,_[_0xd425('0x48')](_0x21d26e)[_0xd425('0x49')]+0x1)[_0xd425('0x31')](function(_0x28c2f4){var _0x43b1a9=_[_0xd425('0x4e')](_0x21d26e,_0x28c2f4);_0x43b1a9[_0xd425('0xd')]({'type':_0x2811a4[_0xd425('0x3')],'app':_0xd425('0x4f'),'exten':_0x2811a4[_0xd425('0x7')],'context':_0x2811a4[_0xd425('0x6')],'priority':_[_0xd425('0x48')](_0x43b1a9)[_0xd425('0x49')]+0x1,'VoiceExtensionId':_0x2811a4['id']});return _0x43b1a9;});}}});}; \ No newline at end of file +var _0x35c8=['lodash','./voiceExtension.attributes','exports','type','Set','CDR(type)=','context','alias','CDR(routeAlias)=','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','No\x20alias\x20set','CDR(destination)=','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','recordingFormat','wav','timeout','url','split','name','param','prefix','phone','${EXTEN:','SIP','join','options','indexOf','replace','isEmpty','Interval','interval','IntervalId','then','length','*,*,*,*','intervals','map','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','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','priority','last','concat','catch','get','Hangup'];(function(_0x485ae4,_0x139ea9){var _0x2c2cd4=function(_0x500ec2){while(--_0x500ec2){_0x485ae4['push'](_0x485ae4['shift']());}};_0x2c2cd4(++_0x139ea9);}(_0x35c8,0xa6));var _0x835c=function(_0x51345b,_0x25625c){_0x51345b=_0x51345b-0x0;var _0xdaad61=_0x35c8[_0x51345b];return _0xdaad61;};'use strict';var _=require(_0x835c('0x0'));var attributes=require(_0x835c('0x1'));module[_0x835c('0x2')]=function(_0x1763c3){var _0x306f59=_0x1763c3['models'];function _0x5a9764(_0xbb7e9f){var _0x1339d3=0x2;var _0x10c49b=[{'type':_0xbb7e9f[_0x835c('0x3')],'app':_0x835c('0x4'),'appdata':_0x835c('0x5')+_0xbb7e9f[_0x835c('0x3')],'context':_0xbb7e9f[_0x835c('0x6')],'exten':_0xbb7e9f['exten'],'priority':_0x1339d3++,'VoiceExtensionId':_0xbb7e9f['id']},{'type':_0xbb7e9f[_0x835c('0x3')],'app':_0xbb7e9f[_0x835c('0x7')]?_0x835c('0x4'):'NoOp','appdata':_0xbb7e9f[_0x835c('0x7')]?_0x835c('0x8')+_0xbb7e9f[_0x835c('0x7')]:'No\x20alias\x20set','context':_0xbb7e9f[_0x835c('0x6')],'exten':_0xbb7e9f[_0x835c('0x9')],'priority':_0x1339d3++,'VoiceExtensionId':_0xbb7e9f['id']}];if(_0xbb7e9f[_0x835c('0x3')]===_0x835c('0xa')){_0x10c49b[_0x835c('0xb')]({'type':'inbound','app':'Set','appdata':_0x835c('0xc')+_0xbb7e9f['id'],'context':_0xbb7e9f[_0x835c('0x6')],'exten':_0xbb7e9f[_0x835c('0x9')],'priority':_0x1339d3++,'VoiceExtensionId':_0xbb7e9f['id']});}_0x10c49b['push']({'type':_0xbb7e9f[_0x835c('0x3')],'app':_0x835c('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0xbb7e9f['context'],'exten':_0xbb7e9f[_0x835c('0x9')],'priority':_0x1339d3++,'VoiceExtensionId':_0xbb7e9f['id']},{'type':_0xbb7e9f[_0x835c('0x3')],'app':_0x835c('0x4'),'appdata':_0x835c('0xd'),'context':_0xbb7e9f[_0x835c('0x6')],'exten':_0xbb7e9f['exten'],'priority':_0x1339d3++,'VoiceExtensionId':_0xbb7e9f['id']},{'type':_0xbb7e9f[_0x835c('0x3')],'app':_0x835c('0x4'),'appdata':_0x835c('0xe'),'context':_0xbb7e9f[_0x835c('0x6')],'exten':_0xbb7e9f[_0x835c('0x9')],'priority':_0x1339d3++,'VoiceExtensionId':_0xbb7e9f['id']});return _0x10c49b;}function _0x202aa9(_0x44b26c){var _0x30002a=0x2;var _0x9dfe14=[{'type':_0x835c('0xf'),'app':_0x835c('0x4'),'appdata':_0x835c('0x10'),'context':_0x44b26c['context'],'exten':_0x44b26c[_0x835c('0x9')],'priority':_0x30002a++,'VoiceExtensionId':_0x44b26c['id']},{'type':_0x835c('0xf'),'app':_0x44b26c[_0x835c('0x7')]?_0x835c('0x4'):'NoOp','appdata':_0x44b26c['alias']?_0x835c('0x8')+_0x44b26c[_0x835c('0x7')]:_0x835c('0x11'),'context':_0x44b26c[_0x835c('0x6')],'exten':_0x44b26c['exten'],'priority':_0x30002a++,'VoiceExtensionId':_0x44b26c['id']},{'type':'outbound','app':_0x835c('0x4'),'appdata':_0x835c('0x12')+(_0x44b26c['cutdigits']?'${EXTEN:'+_0x44b26c['cutdigits']+'}':_0x835c('0x13')),'context':_0x44b26c[_0x835c('0x6')],'exten':_0x44b26c[_0x835c('0x9')],'priority':_0x30002a++,'VoiceExtensionId':_0x44b26c['id']},{'type':_0x835c('0xf'),'app':'Set','appdata':_0x835c('0xc')+_0x44b26c['id'],'context':_0x44b26c[_0x835c('0x6')],'exten':_0x44b26c[_0x835c('0x9')],'priority':_0x30002a++,'VoiceExtensionId':_0x44b26c['id']},{'type':_0x835c('0xf'),'app':_0x835c('0x14'),'appdata':_0x835c('0x15')+(_0x30002a+0x2)+_0x835c('0x16')+(_0x30002a+0x1)+')','context':_0x44b26c['context'],'exten':_0x44b26c[_0x835c('0x9')],'priority':_0x30002a++,'VoiceExtensionId':_0x44b26c['id']},{'type':_0x835c('0xf'),'app':_0x835c('0x4'),'appdata':_0x44b26c[_0x835c('0x17')]?_0x835c('0x18')+_0x44b26c['cutdigits']+'}':_0x835c('0x19'),'context':_0x44b26c[_0x835c('0x6')],'exten':_0x44b26c[_0x835c('0x9')],'priority':_0x30002a++,'VoiceExtensionId':_0x44b26c['id']},{'type':_0x835c('0xf'),'app':_0x835c('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x44b26c[_0x835c('0x6')],'exten':_0x44b26c[_0x835c('0x9')],'priority':_0x30002a++,'VoiceExtensionId':_0x44b26c['id']},{'type':'outbound','app':_0x835c('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x44b26c['context'],'exten':_0x44b26c['exten'],'priority':_0x30002a++,'VoiceExtensionId':_0x44b26c['id']},{'type':_0x835c('0xf'),'app':'Set','appdata':_0x835c('0xe'),'context':_0x44b26c['context'],'exten':_0x44b26c[_0x835c('0x9')],'priority':_0x30002a++,'VoiceExtensionId':_0x44b26c['id']},{'type':_0x835c('0xf'),'app':_0x835c('0x4'),'appdata':'outboundrouteid='+_0x44b26c['id'],'context':_0x44b26c['context'],'exten':_0x44b26c[_0x835c('0x9')],'priority':_0x30002a++,'VoiceExtensionId':_0x44b26c['id']}];if(_0x44b26c[_0x835c('0x1a')]('recordingFormat')&&_0x44b26c['recordingFormat']!==_0x835c('0x1b')){_0x9dfe14[_0x835c('0xb')]({'type':'outbound','app':_0x835c('0x4'),'appdata':_0x835c('0x1c'),'context':_0x44b26c[_0x835c('0x6')],'exten':_0x44b26c['exten'],'priority':_0x30002a++,'VoiceExtensionId':_0x44b26c['id']},{'type':_0x835c('0xf'),'app':_0x835c('0x4'),'appdata':_0x835c('0x1d')+_0x44b26c[_0x835c('0x1e')]||_0x835c('0x1f'),'context':_0x44b26c[_0x835c('0x6')],'exten':_0x44b26c[_0x835c('0x9')],'priority':_0x30002a++,'VoiceExtensionId':_0x44b26c['id']});}return _0x9dfe14;}function _0x1ed24d(_0x3d1c10,_0x2a25a1){var _0x1f5b31=[{'name':'trunk','param':0x0},{'name':_0x835c('0x20'),'param':0x1},{'name':'options','param':0x2},{'name':_0x835c('0x21'),'param':0x3}];var _0x1f6822={};var _0x20ca5b=_0x2a25a1[_0x835c('0x22')](',');var _0x1bebc9=[];for(var _0x142090=0x0;_0x142090<_0x1f5b31['length'];_0x142090++){switch(_0x1f5b31[_0x142090][_0x835c('0x23')]){case'trunk':_0x1f6822['trunk']=_0x20ca5b[_0x1f5b31[_0x142090][_0x835c('0x24')]][_0x835c('0x22')]('/')[0x1];_0x1f6822['phone']=_0x20ca5b[_0x1f5b31[_0x142090][_0x835c('0x24')]][_0x835c('0x22')]('/')[0x2];_0x1f6822[_0x835c('0x25')]=_0x1f6822[_0x835c('0x26')]?_0x1f6822[_0x835c('0x26')][_0x835c('0x22')]('$')[0x0]:undefined;_0x1f6822[_0x835c('0x26')]=_0x3d1c10['cutdigits']?(_0x1f6822[_0x835c('0x25')]||'')+_0x835c('0x27')+_0x3d1c10['cutdigits']+'}':(_0x1f6822[_0x835c('0x25')]||'')+_0x835c('0x13');_0x1bebc9[_0x1f5b31[_0x142090][_0x835c('0x24')]]=[_0x835c('0x28'),_0x1f6822['trunk'],_0x1f6822[_0x835c('0x26')]][_0x835c('0x29')]('/');break;case'options':_0x1f6822[_0x835c('0x2a')]=_0x20ca5b[_0x1f5b31[_0x142090][_0x835c('0x24')]];if(_0x3d1c10['recordingFormat']!==_0x835c('0x1b')){if(_0x1f6822[_0x835c('0x2a')][_0x835c('0x2b')]('U(xcally-mixmonitor-context)')<0x0){_0x1f6822[_0x835c('0x2a')]+='U(xcally-mixmonitor-context)';}}else{_0x1f6822[_0x835c('0x2a')]=_0x1f6822[_0x835c('0x2a')][_0x835c('0x2c')]('U(xcally-mixmonitor-context)','');}_0x1bebc9[_0x1f5b31[_0x142090][_0x835c('0x24')]]=_0x1f6822['options'];break;default:_0x1bebc9[_0x1f5b31[_0x142090][_0x835c('0x24')]]=_0x20ca5b[_0x1f5b31[_0x142090]['param']];}}return _0x1bebc9[_0x835c('0x29')](',');}function _0x182ba5(_0x4f038f,_0x40334b,_0x555718){return new Promise(function(_0xdf39ef,_0x5b2a81){var _0x2153d8=[];if(_[_0x835c('0x2d')](_0x40334b))return _0xdf39ef(_0x2153d8);_0x306f59[_0x835c('0x2e')]['findAll']({'attributes':['id',_0x835c('0x2f'),_0x835c('0x30')],'raw':!![]})[_0x835c('0x31')](function(_0x3721df){for(var _0x344a3d=0x0,_0x25f8bc=0x0;_0x344a3d<_0x40334b[_0x835c('0x32')];_0x344a3d++,_0x25f8bc=0x0){var _0xf2b9c2=_0x40334b[_0x344a3d];var _0x33729d=[];var _0x22b9ad=[];delete _0xf2b9c2['id'];if(_0xf2b9c2[_0x835c('0x2f')]!==_0x835c('0x33')){_0xf2b9c2[_0x835c('0x34')]=[_0xf2b9c2['interval']];}else{_0xf2b9c2[_0x835c('0x34')]=_0xf2b9c2['IntervalId']?_[_0x835c('0x35')](_['filter'](_0x3721df,{'IntervalId':_0xf2b9c2['IntervalId']}),_0x835c('0x2f')):[];}_0xf2b9c2[_0x835c('0x6')]=_0x4f038f[_0x835c('0x6')];_0xf2b9c2[_0x835c('0x9')]=_0x4f038f[_0x835c('0x9')];if(_0xf2b9c2[_0x835c('0x3')])_0xf2b9c2[_0x835c('0x3')]=_0xf2b9c2[_0x835c('0x3')][_0x835c('0x36')]();if(_0x4f038f[_0x835c('0x3')]===_0x835c('0xf')){if(_0xf2b9c2[_0x835c('0x1a')](_0x835c('0x37'))&&_0xf2b9c2[_0x835c('0x37')]&&_0xf2b9c2['tag']!=='--'){_0x33729d[_0x835c('0xb')]({'type':_0xf2b9c2[_0x835c('0x3')]['toLowerCase'](),'app':_0x835c('0x4'),'appdata':_0x835c('0x38')+_0xf2b9c2['tag'],'context':_0x4f038f[_0x835c('0x6')],'exten':_0x4f038f[_0x835c('0x9')],'priority':_0xf2b9c2[_0x835c('0x34')][_0x835c('0x32')]+_0x555718+_0x25f8bc++,'VoiceExtensionId':_0x4f038f['id']});}_0x33729d[_0x835c('0xb')]({'type':_0xf2b9c2[_0x835c('0x3')][_0x835c('0x36')](),'app':'ExecIf','appdata':_0x835c('0x39')+(_0xf2b9c2[_0x835c('0x3a')]?_0x835c('0x3b')+_0xf2b9c2['callerID']+')':_0x835c('0x3c')),'context':_0x4f038f['context'],'exten':_0x4f038f[_0x835c('0x9')],'priority':_0xf2b9c2[_0x835c('0x34')]['length']+_0x555718+_0x25f8bc++,'VoiceExtensionId':_0x4f038f['id']});}else{if(_0xf2b9c2[_0x835c('0x1a')](_0x835c('0x3d'))){if([_0x835c('0x3e'),_0x835c('0x3f')][_0x835c('0x40')](_0xf2b9c2[_0x835c('0x41')]['toLowerCase']())&&_0xf2b9c2[_0x835c('0x42')]!==_0x835c('0x43')){if(_0xf2b9c2[_0x835c('0x3d')]){_0x33729d['push']({'type':_0xf2b9c2['type']['toLowerCase'](),'app':_0x835c('0x14'),'appdata':_0x835c('0x44'),'context':_0x4f038f[_0x835c('0x6')],'exten':_0x4f038f[_0x835c('0x9')],'priority':_0xf2b9c2[_0x835c('0x34')][_0x835c('0x32')]+_0x555718+_0x25f8bc++,'VoiceExtensionId':_0x4f038f['id']});_0x33729d[_0x835c('0xb')]({'type':_0xf2b9c2['type'][_0x835c('0x36')](),'app':_0x835c('0x4'),'appdata':_0x835c('0x45'),'context':_0x4f038f[_0x835c('0x6')],'exten':_0x4f038f[_0x835c('0x9')],'priority':_0xf2b9c2[_0x835c('0x34')][_0x835c('0x32')]+_0x555718+_0x25f8bc++,'VoiceExtensionId':_0x4f038f['id']});}else{_0x33729d[_0x835c('0xb')]({'type':_0xf2b9c2[_0x835c('0x3')]['toLowerCase'](),'app':_0x835c('0x14'),'appdata':_0x835c('0x46'),'context':_0x4f038f[_0x835c('0x6')],'exten':_0x4f038f[_0x835c('0x9')],'priority':_0xf2b9c2[_0x835c('0x34')]['length']+_0x555718+_0x25f8bc++,'VoiceExtensionId':_0x4f038f['id']});_0x33729d[_0x835c('0xb')]({'type':_0xf2b9c2[_0x835c('0x3')][_0x835c('0x36')](),'app':_0x835c('0x4'),'appdata':_0x835c('0x47'),'context':_0x4f038f[_0x835c('0x6')],'exten':_0x4f038f[_0x835c('0x9')],'priority':_0xf2b9c2[_0x835c('0x34')][_0x835c('0x32')]+_0x555718+_0x25f8bc++,'VoiceExtensionId':_0x4f038f['id']});}}}}for(var _0x5d8e80=0x0;_0x5d8e80<_0xf2b9c2[_0x835c('0x34')][_0x835c('0x32')];_0x5d8e80++){var _0xb0a03e=_0x555718+_0xf2b9c2[_0x835c('0x34')][_0x835c('0x32')];var _0x34d6f7=_0x5d8e80===_0xf2b9c2[_0x835c('0x34')][_0x835c('0x32')]-0x1?_0x555718+_0x33729d['length']+_0x22b9ad[_0x835c('0x32')]+0x2:_0x555718+_0x5d8e80+0x1;_0x33729d[_0x835c('0x48')](_0x5d8e80,0x0,{'type':_0x4f038f['type'],'app':_0x835c('0x49'),'appdata':_0xf2b9c2['intervals'][_0x5d8e80]+'?'+_0x4f038f[_0x835c('0x6')]+_0x835c('0x4a')+_0xb0a03e+':'+_0x4f038f['context']+_0x835c('0x4a')+_0x34d6f7,'exten':_0x4f038f['exten'],'context':_0x4f038f['context'],'priority':_0x555718+_0x5d8e80,'VoiceExtensionId':_0x4f038f['id']});}if(_0xf2b9c2['appType']===_0x835c('0x4b'))_0xf2b9c2[_0x835c('0x4c')]=_0x1ed24d(_0x4f038f,_0xf2b9c2[_0x835c('0x4c')]);_0xf2b9c2[_0x835c('0x4d')]=_0x33729d['length']?_[_0x835c('0x4e')](_0x33729d)[_0x835c('0x4d')]+0x1:_0x555718;_0x2153d8=_[_0x835c('0x4f')](_0x2153d8,_0x33729d,[_0xf2b9c2],_0x22b9ad);_0x555718=_[_0x835c('0x4e')](_0x2153d8)[_0x835c('0x4d')]+0x1;}return _0xdf39ef(_0x2153d8);})[_0x835c('0x50')](function(_0x176757){_0x5b2a81(_0x176757);});});}return _0x1763c3['define']('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x5b6449){var _0x49d672=this[_0x835c('0x51')]({'plain':!![]});var _0x5f0eda=_0x49d672[_0x835c('0x3')]===_0x835c('0xf')?_0x202aa9(_0x49d672):_0x5a9764(_0x49d672);return _0x182ba5(_0x49d672,_0x5b6449,_[_0x835c('0x4e')](_0x5f0eda)[_0x835c('0x4d')]+0x1)[_0x835c('0x31')](function(_0x201db1){var _0x5e842e=_[_0x835c('0x4f')](_0x5f0eda,_0x201db1);_0x5e842e[_0x835c('0xb')]({'type':_0x49d672['type'],'app':_0x835c('0x52'),'exten':_0x49d672[_0x835c('0x9')],'context':_0x49d672['context'],'priority':_['last'](_0x5e842e)[_0x835c('0x4d')]+0x1,'VoiceExtensionId':_0x49d672['id']});return _0x5e842e;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 6f1aeff..9256b26 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 _0x74f3=['socket.io-emitter','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','error','message','catch','GetVoiceExtension','VoiceExtension','findAll','options','where','attributes','limit','include','map','model','debug','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x3bb9da,_0x502962){var _0x17eef7=function(_0x94c254){while(--_0x94c254){_0x3bb9da['push'](_0x3bb9da['shift']());}};_0x17eef7(++_0x502962);}(_0x74f3,0x164));var _0x374f=function(_0x150d01,_0x40fad1){_0x150d01=_0x150d01-0x0;var _0x28e865=_0x74f3[_0x150d01];return _0x28e865;};'use strict';var _=require(_0x374f('0x0'));var util=require(_0x374f('0x1'));var moment=require(_0x374f('0x2'));var BPromise=require('bluebird');var rs=require(_0x374f('0x3'));var fs=require('fs');var Redis=require(_0x374f('0x4'));var db=require(_0x374f('0x5'))['db'];var utils=require(_0x374f('0x6'));var logger=require('../../config/logger')(_0x374f('0x7'));var config=require(_0x374f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x374f('0x9')][_0x374f('0xa')]({'port':0x232a});config[_0x374f('0xb')]=_[_0x374f('0xc')](config[_0x374f('0xb')],{'host':_0x374f('0xd'),'port':0x18eb});var socket=require(_0x374f('0xe'))(new Redis(config[_0x374f('0xb')]));require('./voiceExtension.socket')[_0x374f('0xf')](socket);function respondWithRpcPromise(_0x11e8dd,_0xe6724c,_0x272059){return new BPromise(function(_0x2161e4,_0x58cfc5){return client[_0x374f('0x10')](_0x11e8dd,_0x272059)[_0x374f('0x11')](function(_0x5c1716){logger[_0x374f('0x12')](_0x374f('0x13'),_0xe6724c,_0x374f('0x14'));logger['debug'](_0x374f('0x15'),_0xe6724c,_0x374f('0x14'),JSON['stringify'](_0x5c1716));if(_0x5c1716[_0x374f('0x16')]){if(_0x5c1716[_0x374f('0x16')]['code']===0x1f4){logger[_0x374f('0x16')]('VoiceExtension,\x20%s,\x20%s',_0xe6724c,_0x5c1716[_0x374f('0x16')][_0x374f('0x17')]);return _0x58cfc5(_0x5c1716[_0x374f('0x16')][_0x374f('0x17')]);}logger[_0x374f('0x16')](_0x374f('0x13'),_0xe6724c,_0x5c1716[_0x374f('0x16')][_0x374f('0x17')]);return _0x2161e4(_0x5c1716[_0x374f('0x16')][_0x374f('0x17')]);}else{logger[_0x374f('0x12')](_0x374f('0x13'),_0xe6724c,_0x374f('0x14'));_0x2161e4(_0x5c1716['result']['message']);}})[_0x374f('0x18')](function(_0x4e98ca){logger[_0x374f('0x16')](_0x374f('0x13'),_0xe6724c,_0x4e98ca);_0x58cfc5(_0x4e98ca);});});}exports[_0x374f('0x19')]=function(_0x5e2fd9){var _0x2828a7=this;return new Promise(function(_0x52d382,_0xbcc48f){return db[_0x374f('0x1a')][_0x374f('0x1b')]({'raw':_0x5e2fd9['options']?_0x5e2fd9[_0x374f('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x5e2fd9[_0x374f('0x1c')]?_0x5e2fd9[_0x374f('0x1c')][_0x374f('0x1d')]||null:null,'attributes':_0x5e2fd9[_0x374f('0x1c')]?_0x5e2fd9[_0x374f('0x1c')][_0x374f('0x1e')]||null:null,'limit':_0x5e2fd9['options']?_0x5e2fd9['options'][_0x374f('0x1f')]||null:null,'include':_0x5e2fd9[_0x374f('0x1c')]?_0x5e2fd9[_0x374f('0x1c')]['include']?_['map'](_0x5e2fd9[_0x374f('0x1c')]['include'],function(_0x5418cd){return{'model':db[_0x5418cd['model']],'as':_0x5418cd['as'],'attributes':_0x5418cd['attributes'],'include':_0x5418cd[_0x374f('0x20')]?_[_0x374f('0x21')](_0x5418cd['include'],function(_0x15a3f4){return{'model':db[_0x15a3f4[_0x374f('0x22')]],'as':_0x15a3f4['as'],'attributes':_0x15a3f4[_0x374f('0x1e')],'include':_0x15a3f4[_0x374f('0x20')]?_['map'](_0x15a3f4[_0x374f('0x20')],function(_0x4900b9){return{'model':db[_0x4900b9[_0x374f('0x22')]],'as':_0x4900b9['as'],'attributes':_0x4900b9[_0x374f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x374f('0x11')](function(_0x2761e5){logger[_0x374f('0x12')](_0x374f('0x19'),_0x5e2fd9);logger[_0x374f('0x23')](_0x374f('0x19'),_0x5e2fd9,JSON[_0x374f('0x24')](_0x2761e5));_0x52d382(_0x2761e5);})[_0x374f('0x18')](function(_0x5614a0){logger[_0x374f('0x16')](_0x374f('0x19'),_0x5614a0['message'],_0x5e2fd9);_0xbcc48f(_0x2828a7[_0x374f('0x16')](0x1f4,_0x5614a0['message']));});});}; \ No newline at end of file +var _0x77f7=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetVoiceExtension','findAll','options','raw','where','include','map','model','attributes','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4e8ac4,_0x2b9802){var _0x3a3e06=function(_0x2c5461){while(--_0x2c5461){_0x4e8ac4['push'](_0x4e8ac4['shift']());}};_0x3a3e06(++_0x2b9802);}(_0x77f7,0xbd));var _0x777f=function(_0x36adce,_0x3c5a1a){_0x36adce=_0x36adce-0x0;var _0x2ff31e=_0x77f7[_0x36adce];return _0x2ff31e;};'use strict';var _=require(_0x777f('0x0'));var util=require(_0x777f('0x1'));var moment=require(_0x777f('0x2'));var BPromise=require(_0x777f('0x3'));var rs=require(_0x777f('0x4'));var fs=require('fs');var Redis=require(_0x777f('0x5'));var db=require(_0x777f('0x6'))['db'];var utils=require(_0x777f('0x7'));var logger=require(_0x777f('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x777f('0x9'));var client=jayson[_0x777f('0xa')][_0x777f('0xb')]({'port':0x232a});config[_0x777f('0xc')]=_[_0x777f('0xd')](config[_0x777f('0xc')],{'host':_0x777f('0xe'),'port':0x18eb});var socket=require(_0x777f('0xf'))(new Redis(config[_0x777f('0xc')]));require(_0x777f('0x10'))['register'](socket);function respondWithRpcPromise(_0xd2273,_0x5c218b,_0x26e215){return new BPromise(function(_0x167e01,_0x4d6f47){return client[_0x777f('0x11')](_0xd2273,_0x26e215)[_0x777f('0x12')](function(_0x1a4853){logger['info'](_0x777f('0x13'),_0x5c218b,_0x777f('0x14'));logger[_0x777f('0x15')](_0x777f('0x16'),_0x5c218b,_0x777f('0x14'),JSON[_0x777f('0x17')](_0x1a4853));if(_0x1a4853['error']){if(_0x1a4853[_0x777f('0x18')][_0x777f('0x19')]===0x1f4){logger['error'](_0x777f('0x13'),_0x5c218b,_0x1a4853[_0x777f('0x18')][_0x777f('0x1a')]);return _0x4d6f47(_0x1a4853[_0x777f('0x18')][_0x777f('0x1a')]);}logger[_0x777f('0x18')](_0x777f('0x13'),_0x5c218b,_0x1a4853['error'][_0x777f('0x1a')]);return _0x167e01(_0x1a4853[_0x777f('0x18')][_0x777f('0x1a')]);}else{logger[_0x777f('0x1b')](_0x777f('0x13'),_0x5c218b,_0x777f('0x14'));_0x167e01(_0x1a4853[_0x777f('0x1c')]['message']);}})['catch'](function(_0x40c91e){logger[_0x777f('0x18')](_0x777f('0x13'),_0x5c218b,_0x40c91e);_0x4d6f47(_0x40c91e);});});}exports[_0x777f('0x1d')]=function(_0xa0c7f1){var _0x1c4b0f=this;return new Promise(function(_0x1897f0,_0x143f3d){return db['VoiceExtension'][_0x777f('0x1e')]({'raw':_0xa0c7f1['options']?_0xa0c7f1[_0x777f('0x1f')][_0x777f('0x20')]===undefined?!![]:![]:!![],'where':_0xa0c7f1[_0x777f('0x1f')]?_0xa0c7f1[_0x777f('0x1f')][_0x777f('0x21')]||null:null,'attributes':_0xa0c7f1[_0x777f('0x1f')]?_0xa0c7f1[_0x777f('0x1f')]['attributes']||null:null,'limit':_0xa0c7f1[_0x777f('0x1f')]?_0xa0c7f1[_0x777f('0x1f')]['limit']||null:null,'include':_0xa0c7f1[_0x777f('0x1f')]?_0xa0c7f1['options'][_0x777f('0x22')]?_[_0x777f('0x23')](_0xa0c7f1[_0x777f('0x1f')][_0x777f('0x22')],function(_0x43a7c1){return{'model':db[_0x43a7c1[_0x777f('0x24')]],'as':_0x43a7c1['as'],'attributes':_0x43a7c1[_0x777f('0x25')],'include':_0x43a7c1[_0x777f('0x22')]?_[_0x777f('0x23')](_0x43a7c1['include'],function(_0x5b865c){return{'model':db[_0x5b865c[_0x777f('0x24')]],'as':_0x5b865c['as'],'attributes':_0x5b865c[_0x777f('0x25')],'include':_0x5b865c[_0x777f('0x22')]?_[_0x777f('0x23')](_0x5b865c[_0x777f('0x22')],function(_0x32007e){return{'model':db[_0x32007e[_0x777f('0x24')]],'as':_0x32007e['as'],'attributes':_0x32007e['attributes']};}):[]};}):[]};}):[]:[]})[_0x777f('0x12')](function(_0x3940cb){logger['info'](_0x777f('0x1d'),_0xa0c7f1);logger[_0x777f('0x15')]('GetVoiceExtension',_0xa0c7f1,JSON['stringify'](_0x3940cb));_0x1897f0(_0x3940cb);})[_0x777f('0x26')](function(_0x10e02e){logger[_0x777f('0x18')](_0x777f('0x1d'),_0x10e02e[_0x777f('0x1a')],_0xa0c7f1);_0x143f3d(_0x1c4b0f[_0x777f('0x18')](0x1f4,_0x10e02e[_0x777f('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index c7bf9b7..5eefe34 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 _0x0295=['emit','removeListener','register','voiceExtension:','./voiceExtension.events','update'];(function(_0x5b3a6e,_0x273ced){var _0xb26a6e=function(_0x30c280){while(--_0x30c280){_0x5b3a6e['push'](_0x5b3a6e['shift']());}};_0xb26a6e(++_0x273ced);}(_0x0295,0x1f0));var _0x5029=function(_0xed6f46,_0x1c9006){_0xed6f46=_0xed6f46-0x0;var _0x5b267c=_0x0295[_0xed6f46];return _0x5b267c;};'use strict';var VoiceExtensionEvents=require(_0x5029('0x0'));var events=['save','remove',_0x5029('0x1')];function createListener(_0x4f552a,_0x53c2e1){return function(_0x315589){_0x53c2e1[_0x5029('0x2')](_0x4f552a,_0x315589);};}function removeListener(_0x157a4f,_0x3d0af1){return function(){VoiceExtensionEvents[_0x5029('0x3')](_0x157a4f,_0x3d0af1);};}exports[_0x5029('0x4')]=function(_0x200217){for(var _0x215955=0x0,_0x5b3cd=events['length'];_0x215955<_0x5b3cd;_0x215955++){var _0x54978f=events[_0x215955];var _0x4ee867=createListener(_0x5029('0x5')+_0x54978f,_0x200217);VoiceExtensionEvents['on'](_0x54978f,_0x4ee867);}}; \ No newline at end of file +var _0xf494=['save','remove','emit','removeListener','register','voiceExtension:','./voiceExtension.events'];(function(_0x24a6d1,_0x5eb1f1){var _0x445f60=function(_0x461585){while(--_0x461585){_0x24a6d1['push'](_0x24a6d1['shift']());}};_0x445f60(++_0x5eb1f1);}(_0xf494,0x1c6));var _0x4f49=function(_0x46c2aa,_0x202480){_0x46c2aa=_0x46c2aa-0x0;var _0x2e98fa=_0xf494[_0x46c2aa];return _0x2e98fa;};'use strict';var VoiceExtensionEvents=require(_0x4f49('0x0'));var events=[_0x4f49('0x1'),_0x4f49('0x2'),'update'];function createListener(_0x3aeeb8,_0x1d54cc){return function(_0x423b25){_0x1d54cc[_0x4f49('0x3')](_0x3aeeb8,_0x423b25);};}function removeListener(_0x20c0d7,_0x2a15fb){return function(){VoiceExtensionEvents[_0x4f49('0x4')](_0x20c0d7,_0x2a15fb);};}exports[_0x4f49('0x5')]=function(_0xc5e778){for(var _0x413530=0x0,_0x42b0e8=events['length'];_0x413530<_0x42b0e8;_0x413530++){var _0x58e9a0=events[_0x413530];var _0x169c95=createListener(_0x4f49('0x6')+_0x58e9a0,_0xc5e778);VoiceExtensionEvents['on'](_0x58e9a0,_0x169c95);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 9d1408e..8513c71 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 _0x33af=['fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','index','/:id','isAuthenticated','show','getMessages','post','create','put','update','delete','destroy','util','connect-timeout','express','Router'];(function(_0x5806d2,_0x174795){var _0x5c84de=function(_0x554651){while(--_0x554651){_0x5806d2['push'](_0x5806d2['shift']());}};_0x5c84de(++_0x174795);}(_0x33af,0xec));var _0xf33a=function(_0x4da196,_0x357dc9){_0x4da196=_0x4da196-0x0;var _0x375df3=_0x33af[_0x4da196];return _0x375df3;};'use strict';var multer=require('multer');var util=require(_0xf33a('0x0'));var path=require('path');var timeout=require(_0xf33a('0x1'));var express=require(_0xf33a('0x2'));var router=express[_0xf33a('0x3')]();var fs_extra=require(_0xf33a('0x4'));var auth=require(_0xf33a('0x5'));var interaction=require(_0xf33a('0x6'));var config=require('../../config/environment');var controller=require(_0xf33a('0x7'));router[_0xf33a('0x8')]('/',auth['isAuthenticated'](),controller[_0xf33a('0x9')]);router[_0xf33a('0x8')](_0xf33a('0xa'),auth[_0xf33a('0xb')](),controller[_0xf33a('0xc')]);router[_0xf33a('0x8')]('/:id/messages',auth[_0xf33a('0xb')](),controller[_0xf33a('0xd')]);router[_0xf33a('0xe')]('/',auth[_0xf33a('0xb')](),controller[_0xf33a('0xf')]);router[_0xf33a('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xf33a('0x11')]);router[_0xf33a('0x12')](_0xf33a('0xa'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x13')]);module['exports']=router; \ No newline at end of file +var _0xfb11=['index','/:id','show','get','/:id/messages','getMessages','post','create','update','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./voiceMail.controller','isAuthenticated'];(function(_0x4e696a,_0x50fba7){var _0x2b81d3=function(_0x57de84){while(--_0x57de84){_0x4e696a['push'](_0x4e696a['shift']());}};_0x2b81d3(++_0x50fba7);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xfb11[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0x1fb1('0x0'));var util=require('util');var path=require(_0x1fb1('0x1'));var timeout=require(_0x1fb1('0x2'));var express=require('express');var router=express[_0x1fb1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1fb1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1fb1('0x5'));var controller=require(_0x1fb1('0x6'));router['get']('/',auth[_0x1fb1('0x7')](),controller[_0x1fb1('0x8')]);router['get'](_0x1fb1('0x9'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0xa')]);router[_0x1fb1('0xb')](_0x1fb1('0xc'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0xd')]);router[_0x1fb1('0xe')]('/',auth[_0x1fb1('0x7')](),controller[_0x1fb1('0xf')]);router['put'](_0x1fb1('0x9'),auth['isAuthenticated'](),controller[_0x1fb1('0x10')]);router['delete'](_0x1fb1('0x9'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0x11')]);module[_0x1fb1('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index e7bc3bf..d7f74b3 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 _0xa2df=['INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue','mailbox','exports','STRING','from-voicemail','contest_mailbox','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP'];(function(_0x374efe,_0x1353e7){var _0x209344=function(_0x937e9a){while(--_0x937e9a){_0x374efe['push'](_0x374efe['shift']());}};_0x209344(++_0x1353e7);}(_0xa2df,0x16e));var _0xfa2d=function(_0x3ffcca,_0x1504cd){_0x3ffcca=_0x3ffcca-0x0;var _0x57b0fb=_0xa2df[_0x3ffcca];return _0x57b0fb;};'use strict';var Sequelize=require('sequelize');module[_0xfa2d('0x0')]={'customer_id':{'type':Sequelize[_0xfa2d('0x1')]},'context':{'type':Sequelize[_0xfa2d('0x1')],'defaultValue':_0xfa2d('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xfa2d('0x1')],'defaultValue':'','allowNull':![],'unique':_0xfa2d('0x3')},'password':{'type':Sequelize[_0xfa2d('0x1')]},'fullname':{'type':Sequelize[_0xfa2d('0x1')]},'email':{'type':Sequelize[_0xfa2d('0x1')],'validate':{'isEmail':!![]},'set':function(_0x3f536e){this['setDataValue'](_0xfa2d('0x4'),typeof _0x3f536e===_0xfa2d('0x5')&&_0x3f536e[_0xfa2d('0x6')]()?_0x3f536e['trim']():null);}},'pager':{'type':Sequelize[_0xfa2d('0x1')]},'tz':{'type':Sequelize[_0xfa2d('0x1')],'defaultValue':_0xfa2d('0x7')},'attach':{'type':Sequelize[_0xfa2d('0x8')](_0xfa2d('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xfa2d('0x8')]('yes','no'),'defaultValue':_0xfa2d('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize['ENUM'](_0xfa2d('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xfa2d('0x8')](_0xfa2d('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xfa2d('0x8')](_0xfa2d('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xfa2d('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xfa2d('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xfa2d('0x8')](_0xfa2d('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xfa2d('0x9'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0xfa2d('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xfa2d('0x8')]('yes','no'),'defaultValue':_0xfa2d('0x9'),'allowNull':![]},'stamp':{'type':_0xfa2d('0xb')},'emailsubject':{'type':Sequelize[_0xfa2d('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0xfa2d('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xfa2d('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xfa2d('0xd')],'get':function(){return this['getDataValue'](_0xfa2d('0xe'))+_0xfa2d('0xf')+this[_0xfa2d('0x10')](_0xfa2d('0x11'));}}}; \ No newline at end of file +var _0x05a3=['from-voicemail','contest_mailbox','email','central','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','sequelize','exports','STRING'];(function(_0x118cd4,_0x2d4e5a){var _0x31b976=function(_0x265365){while(--_0x265365){_0x118cd4['push'](_0x118cd4['shift']());}};_0x31b976(++_0x2d4e5a);}(_0x05a3,0x1dd));var _0x305a=function(_0x382d3a,_0x1d4635){_0x382d3a=_0x382d3a-0x0;var _0x3a960d=_0x05a3[_0x382d3a];return _0x3a960d;};'use strict';var Sequelize=require(_0x305a('0x0'));module[_0x305a('0x1')]={'customer_id':{'type':Sequelize[_0x305a('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x305a('0x3'),'unique':_0x305a('0x4')},'mailbox':{'type':Sequelize[_0x305a('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x305a('0x2')]},'fullname':{'type':Sequelize[_0x305a('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x3cdd25){this['setDataValue'](_0x305a('0x5'),typeof _0x3cdd25==='string'&&_0x3cdd25['trim']()?_0x3cdd25['trim']():null);}},'pager':{'type':Sequelize[_0x305a('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x305a('0x6')},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x305a('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0x305a('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x305a('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x305a('0x8')](_0x305a('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x305a('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x305a('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x305a('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x305a('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x305a('0x8')](_0x305a('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x305a('0x8')](_0x305a('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x305a('0x8')](_0x305a('0x7'),'no'),'defaultValue':_0x305a('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0x305a('0x8')](_0x305a('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x305a('0x8')](_0x305a('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x305a('0x8')](_0x305a('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x305a('0xa')},'emailsubject':{'type':Sequelize[_0x305a('0x2')]},'emailbody':{'type':Sequelize[_0x305a('0x2')]},'maxsecs':{'type':Sequelize[_0x305a('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x305a('0xc')],'get':function(){return this[_0x305a('0xd')](_0x305a('0xe'))+_0x305a('0xf')+this[_0x305a('0xd')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 8c7c257..74b8c2c 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 _0x4cf8=['UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','VoiceMail','include','findAll','catch','find','create','body','user','UserProfileSection','userProfileId','params','getMessages','findOne','VoiceMailMessage','mailbox','options','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Voicemails'];(function(_0x2b2c53,_0x4bcf9b){var _0x311ec2=function(_0x4a8e72){while(--_0x4a8e72){_0x2b2c53['push'](_0x2b2c53['shift']());}};_0x311ec2(++_0x4bcf9b);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x4459b8,_0x3271b8){_0x4459b8=_0x4459b8-0x0;var _0x4a4b07=_0x4cf8[_0x4459b8];return _0x4a4b07;};'use strict';var emlformat=require(_0x84cf('0x0'));var rimraf=require(_0x84cf('0x1'));var zipdir=require(_0x84cf('0x2'));var jsonpatch=require(_0x84cf('0x3'));var rp=require(_0x84cf('0x4'));var moment=require(_0x84cf('0x5'));var BPromise=require(_0x84cf('0x6'));var Mustache=require(_0x84cf('0x7'));var util=require(_0x84cf('0x8'));var path=require(_0x84cf('0x9'));var sox=require(_0x84cf('0xa'));var csv=require(_0x84cf('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x84cf('0xc'));var squel=require('squel');var crypto=require(_0x84cf('0xd'));var jsforce=require(_0x84cf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x84cf('0xb'));var querystring=require(_0x84cf('0xf'));var Papa=require('papaparse');var Redis=require(_0x84cf('0x10'));var authService=require(_0x84cf('0x11'));var qs=require(_0x84cf('0x12'));var as=require(_0x84cf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x84cf('0x14'))(_0x84cf('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x84cf('0x16'));var db=require(_0x84cf('0x17'))['db'];function respondWithStatusCode(_0x35f852,_0x33f83e){_0x33f83e=_0x33f83e||0xcc;return function(_0x172d04){if(_0x172d04){return _0x35f852[_0x84cf('0x18')](_0x33f83e);}return _0x35f852[_0x84cf('0x19')](_0x33f83e)[_0x84cf('0x1a')]();};}function respondWithResult(_0xced48,_0x250a19){_0x250a19=_0x250a19||0xc8;return function(_0x2fc41f){if(_0x2fc41f){return _0xced48[_0x84cf('0x19')](_0x250a19)[_0x84cf('0x1b')](_0x2fc41f);}};}function respondWithFilteredResult(_0x20e79c,_0x27261b){return function(_0x167c3e){if(_0x167c3e){var _0x464e70=typeof _0x27261b[_0x84cf('0x1c')]===_0x84cf('0x1d')&&typeof _0x27261b['limit']===_0x84cf('0x1d');var _0x5d6a93=_0x167c3e[_0x84cf('0x1e')];var _0x1abe2d=_0x464e70?0x0:_0x27261b[_0x84cf('0x1c')];var _0x13ba16=_0x464e70?_0x167c3e[_0x84cf('0x1e')]:_0x27261b['offset']+_0x27261b['limit'];var _0x42d6d4;if(_0x13ba16>=_0x5d6a93){_0x13ba16=_0x5d6a93;_0x42d6d4=0xc8;}else{_0x42d6d4=0xce;}_0x20e79c[_0x84cf('0x19')](_0x42d6d4);return _0x20e79c[_0x84cf('0x1f')](_0x84cf('0x20'),_0x1abe2d+'-'+_0x13ba16+'/'+_0x5d6a93)[_0x84cf('0x1b')](_0x167c3e);}return null;};}function patchUpdates(_0x5dda3f){return function(_0x39a37b){try{jsonpatch[_0x84cf('0x21')](_0x39a37b,_0x5dda3f,!![]);}catch(_0x3ca1be){return BPromise[_0x84cf('0x22')](_0x3ca1be);}return _0x39a37b[_0x84cf('0x23')]();};}function saveUpdates(_0x54405a,_0x42fa45){return function(_0x160f86){if(_0x160f86){return _0x160f86[_0x84cf('0x24')](_0x54405a)[_0x84cf('0x25')](function(_0x3e5e94){return _0x3e5e94;});}return null;};}function removeEntity(_0x29e9e1,_0x7feb4){return function(_0x4c9d1c){if(_0x4c9d1c){return _0x4c9d1c[_0x84cf('0x26')]()[_0x84cf('0x25')](function(){var _0x1c7747=_0x4c9d1c[_0x84cf('0x27')]({'plain':!![]});var _0x1d220a=_0x84cf('0x28');return db[_0x84cf('0x29')][_0x84cf('0x26')]({'where':{'type':_0x1d220a,'resourceId':_0x1c7747['id']}})[_0x84cf('0x25')](function(){return _0x4c9d1c;});})[_0x84cf('0x25')](function(){_0x29e9e1['status'](0xcc)[_0x84cf('0x1a')]();});}};}function handleEntityNotFound(_0x17bc92,_0x2a4973){return function(_0x41a5db){if(!_0x41a5db){_0x17bc92['sendStatus'](0x194);}return _0x41a5db;};}function handleError(_0x1595dd,_0x5a428c){_0x5a428c=_0x5a428c||0x1f4;return function(_0x29455e){logger[_0x84cf('0x2a')](_0x29455e[_0x84cf('0x2b')]);if(_0x29455e[_0x84cf('0x2c')]){delete _0x29455e[_0x84cf('0x2c')];}_0x1595dd[_0x84cf('0x19')](_0x5a428c)[_0x84cf('0x2d')](_0x29455e);};}exports[_0x84cf('0x2e')]=function(_0x1bfa56,_0xb4fc5a){var _0x31dbf5={},_0x308f8f={},_0x18243d={'count':0x0,'rows':[]};var _0x44f16e=_['map'](db['VoiceMail'][_0x84cf('0x2f')],function(_0x25de3a){return{'name':_0x25de3a[_0x84cf('0x30')],'type':_0x25de3a[_0x84cf('0x31')][_0x84cf('0x32')]};});_0x308f8f[_0x84cf('0x33')]=_[_0x84cf('0x34')](_0x44f16e,_0x84cf('0x2c'));_0x308f8f['query']=_[_0x84cf('0x35')](_0x1bfa56[_0x84cf('0x36')]);_0x308f8f['filters']=_[_0x84cf('0x37')](_0x308f8f['model'],_0x308f8f[_0x84cf('0x36')]);_0x31dbf5[_0x84cf('0x38')]=_[_0x84cf('0x37')](_0x308f8f[_0x84cf('0x33')],qs[_0x84cf('0x39')](_0x1bfa56['query'][_0x84cf('0x39')]));_0x31dbf5['attributes']=_0x31dbf5['attributes'][_0x84cf('0x3a')]?_0x31dbf5[_0x84cf('0x38')]:_0x308f8f['model'];if(!_0x1bfa56[_0x84cf('0x36')][_0x84cf('0x3b')](_0x84cf('0x3c'))){_0x31dbf5[_0x84cf('0x3d')]=qs[_0x84cf('0x3d')](_0x1bfa56[_0x84cf('0x36')]['limit']);_0x31dbf5[_0x84cf('0x1c')]=qs[_0x84cf('0x1c')](_0x1bfa56[_0x84cf('0x36')][_0x84cf('0x1c')]);}_0x31dbf5[_0x84cf('0x3e')]=qs[_0x84cf('0x3f')](_0x1bfa56['query'][_0x84cf('0x3f')]);_0x31dbf5['where']=qs[_0x84cf('0x40')](_[_0x84cf('0x41')](_0x1bfa56[_0x84cf('0x36')],_0x308f8f[_0x84cf('0x40')]),_0x44f16e);if(_0x1bfa56[_0x84cf('0x36')][_0x84cf('0x42')]){_0x31dbf5[_0x84cf('0x43')]=_[_0x84cf('0x44')](_0x31dbf5[_0x84cf('0x43')],{'$or':_['map'](_0x44f16e,function(_0x44e6f0){if(_0x44e6f0['type']!==_0x84cf('0x45')){var _0xc75386={};_0xc75386[_0x44e6f0['name']]={'$like':'%'+_0x1bfa56[_0x84cf('0x36')]['filter']+'%'};return _0xc75386;}})});}_0x31dbf5=_[_0x84cf('0x44')]({},_0x31dbf5,_0x1bfa56['options']);var _0x3fc160={'where':_0x31dbf5['where']};return db[_0x84cf('0x46')][_0x84cf('0x1e')](_0x3fc160)['then'](function(_0x847ce9){_0x18243d[_0x84cf('0x1e')]=_0x847ce9;if(_0x1bfa56[_0x84cf('0x36')]['includeAll']){_0x31dbf5[_0x84cf('0x47')]=[{'all':!![]}];}return db['VoiceMail'][_0x84cf('0x48')](_0x31dbf5);})['then'](function(_0x56b0e5){_0x18243d['rows']=_0x56b0e5;return _0x18243d;})[_0x84cf('0x25')](respondWithFilteredResult(_0xb4fc5a,_0x31dbf5))[_0x84cf('0x49')](handleError(_0xb4fc5a,null));};exports['show']=function(_0x2b737e,_0x56b623){var _0x191ad8={'raw':!![],'where':{'id':_0x2b737e['params']['id']}},_0x3fe8c1={};_0x3fe8c1[_0x84cf('0x33')]=_['keys'](db[_0x84cf('0x46')]['rawAttributes']);_0x3fe8c1['query']=_['keys'](_0x2b737e['query']);_0x3fe8c1['filters']=_['intersection'](_0x3fe8c1['model'],_0x3fe8c1[_0x84cf('0x36')]);_0x191ad8[_0x84cf('0x38')]=_[_0x84cf('0x37')](_0x3fe8c1[_0x84cf('0x33')],qs['fields'](_0x2b737e[_0x84cf('0x36')]['fields']));_0x191ad8[_0x84cf('0x38')]=_0x191ad8[_0x84cf('0x38')][_0x84cf('0x3a')]?_0x191ad8[_0x84cf('0x38')]:_0x3fe8c1[_0x84cf('0x33')];if(_0x2b737e[_0x84cf('0x36')]['includeAll']){_0x191ad8[_0x84cf('0x47')]=[{'all':!![]}];}_0x191ad8=_[_0x84cf('0x44')]({},_0x191ad8,_0x2b737e['options']);return db[_0x84cf('0x46')][_0x84cf('0x4a')](_0x191ad8)[_0x84cf('0x25')](handleEntityNotFound(_0x56b623,null))['then'](respondWithResult(_0x56b623,null))['catch'](handleError(_0x56b623,null));};exports['create']=function(_0x1cf3f6,_0x104421){return db[_0x84cf('0x46')][_0x84cf('0x4b')](_0x1cf3f6[_0x84cf('0x4c')],{})[_0x84cf('0x25')](function(_0x51d725){var _0x350985=_0x1cf3f6['user'][_0x84cf('0x27')]({'plain':!![]});if(!_0x350985)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x350985['role']===_0x84cf('0x4d')){var _0xb1c3a8=_0x51d725[_0x84cf('0x27')]({'plain':!![]});var _0x55e24e='Voicemails';return db[_0x84cf('0x4e')][_0x84cf('0x4a')]({'where':{'name':_0x55e24e,'userProfileId':_0x350985[_0x84cf('0x4f')]},'raw':!![]})[_0x84cf('0x25')](function(_0x401ced){if(_0x401ced&&_0x401ced['autoAssociation']===0x0){return db[_0x84cf('0x29')][_0x84cf('0x4b')]({'name':_0xb1c3a8['name'],'resourceId':_0xb1c3a8['id'],'type':_0x401ced[_0x84cf('0x2c')],'sectionId':_0x401ced['id']},{})['then'](function(){return _0x51d725;});}else{return _0x51d725;}})['catch'](function(_0x147194){logger[_0x84cf('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x147194);throw _0x147194;});}return _0x51d725;})['then'](respondWithResult(_0x104421,0xc9))[_0x84cf('0x49')](handleError(_0x104421,null));};exports[_0x84cf('0x24')]=function(_0x2f739a,_0x1e2676){if(_0x2f739a[_0x84cf('0x4c')]['id']){delete _0x2f739a[_0x84cf('0x4c')]['id'];}return db[_0x84cf('0x46')][_0x84cf('0x4a')]({'where':{'id':_0x2f739a['params']['id']}})[_0x84cf('0x25')](handleEntityNotFound(_0x1e2676,null))[_0x84cf('0x25')](saveUpdates(_0x2f739a['body'],null))['then'](respondWithResult(_0x1e2676,null))[_0x84cf('0x49')](handleError(_0x1e2676,null));};exports[_0x84cf('0x26')]=function(_0x3912cb,_0x2a4f20){return db[_0x84cf('0x46')][_0x84cf('0x4a')]({'where':{'id':_0x3912cb[_0x84cf('0x50')]['id']}})['then'](handleEntityNotFound(_0x2a4f20,null))[_0x84cf('0x25')](removeEntity(_0x2a4f20,null))['catch'](handleError(_0x2a4f20,null));};exports[_0x84cf('0x51')]=function(_0x5c0122,_0x2a60bc,_0x1c2f1b){return db['VoiceMail'][_0x84cf('0x52')]({'where':{'id':_0x5c0122[_0x84cf('0x50')]['id']}})['then'](handleEntityNotFound(_0x2a60bc,null))[_0x84cf('0x25')](function(_0x53bfb8){var _0x577d55;var _0x5cc371={},_0x50cde2={};_0x50cde2[_0x84cf('0x33')]=_[_0x84cf('0x35')](db[_0x84cf('0x53')][_0x84cf('0x2f')]);_0x50cde2['query']=_[_0x84cf('0x35')](_0x5c0122[_0x84cf('0x36')]);_0x50cde2['filters']=_[_0x84cf('0x37')](_0x50cde2[_0x84cf('0x33')],_0x50cde2[_0x84cf('0x36')]);_0x5cc371[_0x84cf('0x38')]=_[_0x84cf('0x37')](_0x50cde2[_0x84cf('0x33')],qs[_0x84cf('0x39')](_0x5c0122[_0x84cf('0x36')]['fields']));_0x5cc371[_0x84cf('0x38')]=_0x5cc371['attributes'][_0x84cf('0x3a')]?_0x5cc371[_0x84cf('0x38')]:_0x50cde2[_0x84cf('0x33')];if(!_0x5c0122[_0x84cf('0x36')][_0x84cf('0x3b')]('nolimit')){_0x5cc371[_0x84cf('0x3d')]=qs[_0x84cf('0x3d')](_0x5c0122[_0x84cf('0x36')]['limit']);_0x5cc371[_0x84cf('0x1c')]=qs[_0x84cf('0x1c')](_0x5c0122['query'][_0x84cf('0x1c')]);}_0x5cc371['order']=qs[_0x84cf('0x3f')](_0x5c0122[_0x84cf('0x36')]['sort']);_0x5cc371[_0x84cf('0x43')]=qs[_0x84cf('0x40')](_['pick'](_0x5c0122[_0x84cf('0x36')],_0x50cde2[_0x84cf('0x40')]));if(_0x5c0122[_0x84cf('0x36')][_0x84cf('0x42')]){_0x5cc371['where']=_[_0x84cf('0x44')](_0x5cc371[_0x84cf('0x43')],{'$or':_['map'](_0x5cc371['attributes'],function(_0x4d40e2){var _0x1b000c={};_0x1b000c[_0x4d40e2]={'$like':'%'+_0x5c0122[_0x84cf('0x36')][_0x84cf('0x42')]+'%'};return _0x1b000c;})});}_0x5cc371['where']=_['merge'](_0x5cc371[_0x84cf('0x43')],{'mailboxuser':_0x53bfb8[_0x84cf('0x54')]});_0x5cc371=_[_0x84cf('0x44')]({},_0x5cc371,_0x5c0122[_0x84cf('0x55')]);return db[_0x84cf('0x53')][_0x84cf('0x56')](_0x5cc371)[_0x84cf('0x25')](respondWithFilteredResult(_0x2a60bc,_0x5cc371));})[_0x84cf('0x49')](handleError(_0x2a60bc,null));}; \ No newline at end of file +var _0x3f8c=['create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findAndCountAll','zip-dir','fast-json-patch','request-promise','moment','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','reject','save','update','then','Voicemails','UserProfileResource','destroy','error','stack','name','index','map','VoiceMail','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch'];(function(_0x17e369,_0x24c4cd){var _0x3e8060=function(_0x269879){while(--_0x269879){_0x17e369['push'](_0x17e369['shift']());}};_0x3e8060(++_0x24c4cd);}(_0x3f8c,0x104));var _0xc3f8=function(_0x1c935e,_0x4dd0bc){_0x1c935e=_0x1c935e-0x0;var _0x12db19=_0x3f8c[_0x1c935e];return _0x12db19;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc3f8('0x0'));var jsonpatch=require(_0xc3f8('0x1'));var rp=require(_0xc3f8('0x2'));var moment=require(_0xc3f8('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc3f8('0x4'));var ejs=require(_0xc3f8('0x5'));var fs=require('fs');var fs_extra=require(_0xc3f8('0x6'));var _=require(_0xc3f8('0x7'));var squel=require(_0xc3f8('0x8'));var crypto=require(_0xc3f8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc3f8('0xa'));var toCsv=require(_0xc3f8('0x4'));var querystring=require(_0xc3f8('0xb'));var Papa=require(_0xc3f8('0xc'));var Redis=require(_0xc3f8('0xd'));var authService=require(_0xc3f8('0xe'));var qs=require(_0xc3f8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3f8('0x10'));var logger=require(_0xc3f8('0x11'))(_0xc3f8('0x12'));var utils=require(_0xc3f8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc3f8('0x14'));var db=require(_0xc3f8('0x15'))['db'];function respondWithStatusCode(_0x256e3d,_0x155c80){_0x155c80=_0x155c80||0xcc;return function(_0x511763){if(_0x511763){return _0x256e3d[_0xc3f8('0x16')](_0x155c80);}return _0x256e3d[_0xc3f8('0x17')](_0x155c80)[_0xc3f8('0x18')]();};}function respondWithResult(_0x44632a,_0x6155e9){_0x6155e9=_0x6155e9||0xc8;return function(_0x47754c){if(_0x47754c){return _0x44632a[_0xc3f8('0x17')](_0x6155e9)[_0xc3f8('0x19')](_0x47754c);}};}function respondWithFilteredResult(_0x12b141,_0x2fd8e8){return function(_0x3cb28a){if(_0x3cb28a){var _0x2a9f64=typeof _0x2fd8e8[_0xc3f8('0x1a')]==='undefined'&&typeof _0x2fd8e8[_0xc3f8('0x1b')]==='undefined';var _0x51807b=_0x3cb28a[_0xc3f8('0x1c')];var _0x2e7c0f=_0x2a9f64?0x0:_0x2fd8e8[_0xc3f8('0x1a')];var _0xb4ab67=_0x2a9f64?_0x3cb28a['count']:_0x2fd8e8[_0xc3f8('0x1a')]+_0x2fd8e8[_0xc3f8('0x1b')];var _0x5df6f9;if(_0xb4ab67>=_0x51807b){_0xb4ab67=_0x51807b;_0x5df6f9=0xc8;}else{_0x5df6f9=0xce;}_0x12b141[_0xc3f8('0x17')](_0x5df6f9);return _0x12b141['set'](_0xc3f8('0x1d'),_0x2e7c0f+'-'+_0xb4ab67+'/'+_0x51807b)[_0xc3f8('0x19')](_0x3cb28a);}return null;};}function patchUpdates(_0x3b2e98){return function(_0x53ada5){try{jsonpatch['apply'](_0x53ada5,_0x3b2e98,!![]);}catch(_0x113cd2){return BPromise[_0xc3f8('0x1e')](_0x113cd2);}return _0x53ada5[_0xc3f8('0x1f')]();};}function saveUpdates(_0x25a4c7,_0x6522e9){return function(_0x251bf7){if(_0x251bf7){return _0x251bf7[_0xc3f8('0x20')](_0x25a4c7)[_0xc3f8('0x21')](function(_0x49aeea){return _0x49aeea;});}return null;};}function removeEntity(_0x571f92,_0x4b83f0){return function(_0x2559a4){if(_0x2559a4){return _0x2559a4['destroy']()[_0xc3f8('0x21')](function(){var _0x3f196d=_0x2559a4['get']({'plain':!![]});var _0x4569c2=_0xc3f8('0x22');return db[_0xc3f8('0x23')][_0xc3f8('0x24')]({'where':{'type':_0x4569c2,'resourceId':_0x3f196d['id']}})[_0xc3f8('0x21')](function(){return _0x2559a4;});})[_0xc3f8('0x21')](function(){_0x571f92[_0xc3f8('0x17')](0xcc)[_0xc3f8('0x18')]();});}};}function handleEntityNotFound(_0x21b002,_0xbea3b8){return function(_0x22c8e6){if(!_0x22c8e6){_0x21b002[_0xc3f8('0x16')](0x194);}return _0x22c8e6;};}function handleError(_0x238ff5,_0x429fd8){_0x429fd8=_0x429fd8||0x1f4;return function(_0x59e4dd){logger[_0xc3f8('0x25')](_0x59e4dd[_0xc3f8('0x26')]);if(_0x59e4dd[_0xc3f8('0x27')]){delete _0x59e4dd['name'];}_0x238ff5[_0xc3f8('0x17')](_0x429fd8)['send'](_0x59e4dd);};}exports[_0xc3f8('0x28')]=function(_0x32343e,_0x47ab53){var _0x48b32e={},_0x21a225={},_0x25df65={'count':0x0,'rows':[]};var _0xd32b09=_[_0xc3f8('0x29')](db[_0xc3f8('0x2a')][_0xc3f8('0x2b')],function(_0x680047){return{'name':_0x680047[_0xc3f8('0x2c')],'type':_0x680047[_0xc3f8('0x2d')][_0xc3f8('0x2e')]};});_0x21a225['model']=_[_0xc3f8('0x29')](_0xd32b09,_0xc3f8('0x27'));_0x21a225[_0xc3f8('0x2f')]=_[_0xc3f8('0x30')](_0x32343e[_0xc3f8('0x2f')]);_0x21a225['filters']=_['intersection'](_0x21a225[_0xc3f8('0x31')],_0x21a225[_0xc3f8('0x2f')]);_0x48b32e[_0xc3f8('0x32')]=_[_0xc3f8('0x33')](_0x21a225[_0xc3f8('0x31')],qs['fields'](_0x32343e[_0xc3f8('0x2f')][_0xc3f8('0x34')]));_0x48b32e[_0xc3f8('0x32')]=_0x48b32e['attributes'][_0xc3f8('0x35')]?_0x48b32e[_0xc3f8('0x32')]:_0x21a225[_0xc3f8('0x31')];if(!_0x32343e['query'][_0xc3f8('0x36')](_0xc3f8('0x37'))){_0x48b32e['limit']=qs[_0xc3f8('0x1b')](_0x32343e[_0xc3f8('0x2f')][_0xc3f8('0x1b')]);_0x48b32e[_0xc3f8('0x1a')]=qs[_0xc3f8('0x1a')](_0x32343e[_0xc3f8('0x2f')]['offset']);}_0x48b32e[_0xc3f8('0x38')]=qs[_0xc3f8('0x39')](_0x32343e[_0xc3f8('0x2f')][_0xc3f8('0x39')]);_0x48b32e[_0xc3f8('0x3a')]=qs['filters'](_[_0xc3f8('0x3b')](_0x32343e[_0xc3f8('0x2f')],_0x21a225[_0xc3f8('0x3c')]),_0xd32b09);if(_0x32343e['query'][_0xc3f8('0x3d')]){_0x48b32e[_0xc3f8('0x3a')]=_[_0xc3f8('0x3e')](_0x48b32e[_0xc3f8('0x3a')],{'$or':_['map'](_0xd32b09,function(_0x306182){if(_0x306182[_0xc3f8('0x2d')]!==_0xc3f8('0x3f')){var _0x37b104={};_0x37b104[_0x306182['name']]={'$like':'%'+_0x32343e[_0xc3f8('0x2f')]['filter']+'%'};return _0x37b104;}})});}_0x48b32e=_['merge']({},_0x48b32e,_0x32343e[_0xc3f8('0x40')]);var _0x1f3aef={'where':_0x48b32e[_0xc3f8('0x3a')]};return db[_0xc3f8('0x2a')]['count'](_0x1f3aef)['then'](function(_0x361a85){_0x25df65[_0xc3f8('0x1c')]=_0x361a85;if(_0x32343e[_0xc3f8('0x2f')][_0xc3f8('0x41')]){_0x48b32e[_0xc3f8('0x42')]=[{'all':!![]}];}return db[_0xc3f8('0x2a')][_0xc3f8('0x43')](_0x48b32e);})[_0xc3f8('0x21')](function(_0x13d8dc){_0x25df65[_0xc3f8('0x44')]=_0x13d8dc;return _0x25df65;})[_0xc3f8('0x21')](respondWithFilteredResult(_0x47ab53,_0x48b32e))['catch'](handleError(_0x47ab53,null));};exports[_0xc3f8('0x45')]=function(_0x22e9b3,_0x4b327f){var _0x1aff20={'raw':!![],'where':{'id':_0x22e9b3['params']['id']}},_0x172f1a={};_0x172f1a[_0xc3f8('0x31')]=_[_0xc3f8('0x30')](db[_0xc3f8('0x2a')][_0xc3f8('0x2b')]);_0x172f1a[_0xc3f8('0x2f')]=_[_0xc3f8('0x30')](_0x22e9b3[_0xc3f8('0x2f')]);_0x172f1a[_0xc3f8('0x3c')]=_[_0xc3f8('0x33')](_0x172f1a[_0xc3f8('0x31')],_0x172f1a[_0xc3f8('0x2f')]);_0x1aff20['attributes']=_[_0xc3f8('0x33')](_0x172f1a[_0xc3f8('0x31')],qs['fields'](_0x22e9b3[_0xc3f8('0x2f')][_0xc3f8('0x34')]));_0x1aff20[_0xc3f8('0x32')]=_0x1aff20[_0xc3f8('0x32')]['length']?_0x1aff20['attributes']:_0x172f1a[_0xc3f8('0x31')];if(_0x22e9b3[_0xc3f8('0x2f')][_0xc3f8('0x41')]){_0x1aff20['include']=[{'all':!![]}];}_0x1aff20=_[_0xc3f8('0x3e')]({},_0x1aff20,_0x22e9b3[_0xc3f8('0x40')]);return db[_0xc3f8('0x2a')][_0xc3f8('0x46')](_0x1aff20)[_0xc3f8('0x21')](handleEntityNotFound(_0x4b327f,null))['then'](respondWithResult(_0x4b327f,null))[_0xc3f8('0x47')](handleError(_0x4b327f,null));};exports[_0xc3f8('0x48')]=function(_0x5961ab,_0x1becae){return db[_0xc3f8('0x2a')][_0xc3f8('0x48')](_0x5961ab[_0xc3f8('0x49')],{})[_0xc3f8('0x21')](function(_0x3045bc){var _0x1ca7c9=_0x5961ab['user'][_0xc3f8('0x4a')]({'plain':!![]});if(!_0x1ca7c9)throw new Error(_0xc3f8('0x4b'));if(_0x1ca7c9['role']===_0xc3f8('0x4c')){var _0x2e9f93=_0x3045bc[_0xc3f8('0x4a')]({'plain':!![]});var _0x33e5c5=_0xc3f8('0x22');return db[_0xc3f8('0x4d')][_0xc3f8('0x46')]({'where':{'name':_0x33e5c5,'userProfileId':_0x1ca7c9['userProfileId']},'raw':!![]})[_0xc3f8('0x21')](function(_0x2c6999){if(_0x2c6999&&_0x2c6999[_0xc3f8('0x4e')]===0x0){return db[_0xc3f8('0x23')][_0xc3f8('0x48')]({'name':_0x2e9f93[_0xc3f8('0x27')],'resourceId':_0x2e9f93['id'],'type':_0x2c6999[_0xc3f8('0x27')],'sectionId':_0x2c6999['id']},{})[_0xc3f8('0x21')](function(){return _0x3045bc;});}else{return _0x3045bc;}})['catch'](function(_0x51249a){logger[_0xc3f8('0x25')](_0xc3f8('0x4f'),_0x51249a);throw _0x51249a;});}return _0x3045bc;})['then'](respondWithResult(_0x1becae,0xc9))['catch'](handleError(_0x1becae,null));};exports[_0xc3f8('0x20')]=function(_0x4b4adb,_0x1b1e13){if(_0x4b4adb[_0xc3f8('0x49')]['id']){delete _0x4b4adb[_0xc3f8('0x49')]['id'];}return db['VoiceMail'][_0xc3f8('0x46')]({'where':{'id':_0x4b4adb['params']['id']}})['then'](handleEntityNotFound(_0x1b1e13,null))[_0xc3f8('0x21')](saveUpdates(_0x4b4adb['body'],null))[_0xc3f8('0x21')](respondWithResult(_0x1b1e13,null))[_0xc3f8('0x47')](handleError(_0x1b1e13,null));};exports[_0xc3f8('0x24')]=function(_0x490f37,_0xcb45c1){return db[_0xc3f8('0x2a')][_0xc3f8('0x46')]({'where':{'id':_0x490f37[_0xc3f8('0x50')]['id']}})[_0xc3f8('0x21')](handleEntityNotFound(_0xcb45c1,null))['then'](removeEntity(_0xcb45c1,null))['catch'](handleError(_0xcb45c1,null));};exports[_0xc3f8('0x51')]=function(_0x326dcc,_0x2f1b68,_0x3a268d){return db[_0xc3f8('0x2a')]['findOne']({'where':{'id':_0x326dcc[_0xc3f8('0x50')]['id']}})['then'](handleEntityNotFound(_0x2f1b68,null))[_0xc3f8('0x21')](function(_0x337029){var _0x163264;var _0xd5d6a7={},_0x5c6f6e={};_0x5c6f6e[_0xc3f8('0x31')]=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0x5c6f6e['query']=_[_0xc3f8('0x30')](_0x326dcc[_0xc3f8('0x2f')]);_0x5c6f6e[_0xc3f8('0x3c')]=_[_0xc3f8('0x33')](_0x5c6f6e[_0xc3f8('0x31')],_0x5c6f6e[_0xc3f8('0x2f')]);_0xd5d6a7[_0xc3f8('0x32')]=_[_0xc3f8('0x33')](_0x5c6f6e['model'],qs[_0xc3f8('0x34')](_0x326dcc[_0xc3f8('0x2f')][_0xc3f8('0x34')]));_0xd5d6a7[_0xc3f8('0x32')]=_0xd5d6a7[_0xc3f8('0x32')]['length']?_0xd5d6a7[_0xc3f8('0x32')]:_0x5c6f6e[_0xc3f8('0x31')];if(!_0x326dcc[_0xc3f8('0x2f')][_0xc3f8('0x36')](_0xc3f8('0x37'))){_0xd5d6a7['limit']=qs[_0xc3f8('0x1b')](_0x326dcc[_0xc3f8('0x2f')][_0xc3f8('0x1b')]);_0xd5d6a7[_0xc3f8('0x1a')]=qs[_0xc3f8('0x1a')](_0x326dcc[_0xc3f8('0x2f')]['offset']);}_0xd5d6a7[_0xc3f8('0x38')]=qs[_0xc3f8('0x39')](_0x326dcc[_0xc3f8('0x2f')]['sort']);_0xd5d6a7[_0xc3f8('0x3a')]=qs[_0xc3f8('0x3c')](_['pick'](_0x326dcc['query'],_0x5c6f6e[_0xc3f8('0x3c')]));if(_0x326dcc[_0xc3f8('0x2f')]['filter']){_0xd5d6a7[_0xc3f8('0x3a')]=_[_0xc3f8('0x3e')](_0xd5d6a7[_0xc3f8('0x3a')],{'$or':_[_0xc3f8('0x29')](_0xd5d6a7[_0xc3f8('0x32')],function(_0x30a23a){var _0x1e62ec={};_0x1e62ec[_0x30a23a]={'$like':'%'+_0x326dcc[_0xc3f8('0x2f')]['filter']+'%'};return _0x1e62ec;})});}_0xd5d6a7['where']=_[_0xc3f8('0x3e')](_0xd5d6a7['where'],{'mailboxuser':_0x337029['mailbox']});_0xd5d6a7=_['merge']({},_0xd5d6a7,_0x326dcc['options']);return db['VoiceMailMessage'][_0xc3f8('0x52')](_0xd5d6a7)[_0xc3f8('0x21')](respondWithFilteredResult(_0x2f1b68,_0xd5d6a7));})[_0xc3f8('0x47')](handleError(_0x2f1b68,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 3eadfe5..206fc9d 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 _0x0a54=['rimraf','./voiceMail.attributes','exports','define','voice_voicemail','mailbox','lodash','api','moment','path'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x0a54,0xf6));var _0x40a5=function(_0x26721d,_0x448ba5){_0x26721d=_0x26721d-0x0;var _0x1035c5=_0x0a54[_0x26721d];return _0x1035c5;};'use strict';var _=require(_0x40a5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x40a5('0x1'));var moment=require(_0x40a5('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x40a5('0x3'));var rimraf=require(_0x40a5('0x4'));var config=require('../../config/environment');var attributes=require(_0x40a5('0x5'));module[_0x40a5('0x6')]=function(_0x2774e3,_0x4b370e){return _0x2774e3[_0x40a5('0x7')]('VoiceMail',attributes,{'tableName':_0x40a5('0x8'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x40a5('0x9'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5847=['voice_voicemail','mailbox_context','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMail.attributes','exports','define'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x5847,0x7b));var _0x7584=function(_0xd6e35c,_0x31fde0){_0xd6e35c=_0xd6e35c-0x0;var _0x51f501=_0x5847[_0xd6e35c];return _0x51f501;};'use strict';var _=require(_0x7584('0x0'));var util=require(_0x7584('0x1'));var logger=require(_0x7584('0x2'))(_0x7584('0x3'));var moment=require(_0x7584('0x4'));var BPromise=require(_0x7584('0x5'));var rp=require(_0x7584('0x6'));var fs=require('fs');var path=require(_0x7584('0x7'));var rimraf=require(_0x7584('0x8'));var config=require('../../config/environment');var attributes=require(_0x7584('0x9'));module[_0x7584('0xa')]=function(_0x346986,_0x3eb95e){return _0x346986[_0x7584('0xb')]('VoiceMail',attributes,{'tableName':_0x7584('0xc'),'paranoid':![],'indexes':[{'name':_0x7584('0xd'),'fields':['mailbox',_0x7584('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 7382de6..0e35656 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 _0x794c=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','lodash','moment','bluebird','ioredis'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x794c,0x1f0));var _0xc794=function(_0x9cfe28,_0x1a335c){_0x9cfe28=_0x9cfe28-0x0;var _0x54a1d0=_0x794c[_0x9cfe28];return _0x54a1d0;};'use strict';var _=require(_0xc794('0x0'));var util=require('util');var moment=require(_0xc794('0x1'));var BPromise=require(_0xc794('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc794('0x3'));var db=require(_0xc794('0x4'))['db'];var utils=require(_0xc794('0x5'));var logger=require(_0xc794('0x6'))(_0xc794('0x7'));var config=require(_0xc794('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc794('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2bb6a4,_0x23f116,_0x2da885){return new BPromise(function(_0x7869c1,_0x2bd9a6){return client[_0xc794('0xa')](_0x2bb6a4,_0x2da885)[_0xc794('0xb')](function(_0x18702e){logger[_0xc794('0xc')](_0xc794('0xd'),_0x23f116,'request\x20sent');logger[_0xc794('0xe')](_0xc794('0xf'),_0x23f116,_0xc794('0x10'),JSON[_0xc794('0x11')](_0x18702e));if(_0x18702e[_0xc794('0x12')]){if(_0x18702e['error']['code']===0x1f4){logger[_0xc794('0x12')]('VoiceMail,\x20%s,\x20%s',_0x23f116,_0x18702e[_0xc794('0x12')][_0xc794('0x13')]);return _0x2bd9a6(_0x18702e[_0xc794('0x12')][_0xc794('0x13')]);}logger['error'](_0xc794('0xd'),_0x23f116,_0x18702e['error'][_0xc794('0x13')]);return _0x7869c1(_0x18702e[_0xc794('0x12')][_0xc794('0x13')]);}else{logger[_0xc794('0xc')](_0xc794('0xd'),_0x23f116,_0xc794('0x10'));_0x7869c1(_0x18702e['result'][_0xc794('0x13')]);}})['catch'](function(_0x5422bd){logger[_0xc794('0x12')](_0xc794('0xd'),_0x23f116,_0x5422bd);_0x2bd9a6(_0x5422bd);});});} \ No newline at end of file +var _0x4ee1=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','VoiceMail,\x20%s,\x20%s','message','result','catch'];(function(_0x1ed1ec,_0x5abb1c){var _0x4fd7f0=function(_0xb64b38){while(--_0xb64b38){_0x1ed1ec['push'](_0x1ed1ec['shift']());}};_0x4fd7f0(++_0x5abb1c);}(_0x4ee1,0x18c));var _0x14ee=function(_0x234b48,_0x59757b){_0x234b48=_0x234b48-0x0;var _0x210836=_0x4ee1[_0x234b48];return _0x210836;};'use strict';var _=require(_0x14ee('0x0'));var util=require(_0x14ee('0x1'));var moment=require('moment');var BPromise=require(_0x14ee('0x2'));var rs=require(_0x14ee('0x3'));var fs=require('fs');var Redis=require(_0x14ee('0x4'));var db=require(_0x14ee('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x14ee('0x6'))(_0x14ee('0x7'));var config=require(_0x14ee('0x8'));var jayson=require(_0x14ee('0x9'));var client=jayson[_0x14ee('0xa')][_0x14ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5db406,_0xa8ebfe,_0x304f13){return new BPromise(function(_0x5711bc,_0x1633a9){return client[_0x14ee('0xc')](_0x5db406,_0x304f13)[_0x14ee('0xd')](function(_0x37bffb){logger['info']('VoiceMail,\x20%s,\x20%s',_0xa8ebfe,_0x14ee('0xe'));logger['debug'](_0x14ee('0xf'),_0xa8ebfe,'request\x20sent',JSON['stringify'](_0x37bffb));if(_0x37bffb[_0x14ee('0x10')]){if(_0x37bffb[_0x14ee('0x10')][_0x14ee('0x11')]===0x1f4){logger[_0x14ee('0x10')](_0x14ee('0x12'),_0xa8ebfe,_0x37bffb['error'][_0x14ee('0x13')]);return _0x1633a9(_0x37bffb[_0x14ee('0x10')][_0x14ee('0x13')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0xa8ebfe,_0x37bffb[_0x14ee('0x10')][_0x14ee('0x13')]);return _0x5711bc(_0x37bffb['error'][_0x14ee('0x13')]);}else{logger['info'](_0x14ee('0x12'),_0xa8ebfe,_0x14ee('0xe'));_0x5711bc(_0x37bffb[_0x14ee('0x14')]['message']);}})[_0x14ee('0x15')](function(_0x401b29){logger['error'](_0x14ee('0x12'),_0xa8ebfe,_0x401b29);_0x1633a9(_0x401b29);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 8ec3340..64bb0cc 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 _0x798b=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','update','exports'];(function(_0x5489c4,_0x1e7a17){var _0x2c4624=function(_0x42675a){while(--_0x42675a){_0x5489c4['push'](_0x5489c4['shift']());}};_0x2c4624(++_0x1e7a17);}(_0x798b,0x111));var _0xb798=function(_0x393c29,_0x2a94ab){_0x393c29=_0x393c29-0x0;var _0x1eb139=_0x798b[_0x393c29];return _0x1eb139;};'use strict';var multer=require(_0xb798('0x0'));var util=require('util');var path=require(_0xb798('0x1'));var timeout=require(_0xb798('0x2'));var express=require(_0xb798('0x3'));var router=express[_0xb798('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb798('0x5'));var interaction=require(_0xb798('0x6'));var config=require(_0xb798('0x7'));var controller=require(_0xb798('0x8'));router[_0xb798('0x9')]('/',auth[_0xb798('0xa')](),controller[_0xb798('0xb')]);router[_0xb798('0x9')](_0xb798('0xc'),auth[_0xb798('0xa')](),controller[_0xb798('0xd')]);router[_0xb798('0x9')](_0xb798('0xe'),auth[_0xb798('0xa')](),controller[_0xb798('0xf')]);router[_0xb798('0x10')]('/',auth[_0xb798('0xa')](),controller[_0xb798('0x11')]);router[_0xb798('0x12')]('/:id',auth[_0xb798('0xa')](),controller[_0xb798('0x13')]);router['delete'](_0xb798('0xc'),auth[_0xb798('0xa')](),controller['destroy']);module[_0xb798('0x14')]=router; \ No newline at end of file +var _0x3030=['index','show','/:id/download','download','post','put','/:id','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated'];(function(_0x5eaefe,_0xc72159){var _0xe64929=function(_0x15f626){while(--_0x15f626){_0x5eaefe['push'](_0x5eaefe['shift']());}};_0xe64929(++_0xc72159);}(_0x3030,0xe6));var _0x0303=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x3030[_0x166d93];return _0xba708;};'use strict';var multer=require(_0x0303('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0303('0x1'));var express=require('express');var router=express[_0x0303('0x2')]();var fs_extra=require(_0x0303('0x3'));var auth=require(_0x0303('0x4'));var interaction=require(_0x0303('0x5'));var config=require(_0x0303('0x6'));var controller=require(_0x0303('0x7'));router[_0x0303('0x8')]('/',auth[_0x0303('0x9')](),controller[_0x0303('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x0303('0xb')]);router['get'](_0x0303('0xc'),auth['isAuthenticated'](),controller[_0x0303('0xd')]);router[_0x0303('0xe')]('/',auth[_0x0303('0x9')](),controller['create']);router[_0x0303('0xf')](_0x0303('0x10'),auth[_0x0303('0x9')](),controller['update']);router[_0x0303('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x0303('0x12')]);module[_0x0303('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 b3fdf0d..96dff40 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 _0x03a5=['STRING','BLOB','long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER'];(function(_0xb7a2a5,_0x5a38a4){var _0x45ebac=function(_0x54360f){while(--_0x54360f){_0xb7a2a5['push'](_0xb7a2a5['shift']());}};_0x45ebac(++_0x5a38a4);}(_0x03a5,0x11d));var _0x503a=function(_0x4b9f35,_0x287585){_0x4b9f35=_0x4b9f35-0x0;var _0x200ea1=_0x03a5[_0x4b9f35];return _0x200ea1;};'use strict';var Sequelize=require(_0x503a('0x0'));module[_0x503a('0x1')]={'name':{'type':Sequelize[_0x503a('0x2')],'get':function(_0x249495){return this[_0x503a('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x503a('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x503a('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x503a('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x503a('0x5')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x503a('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x503a('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x503a('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x503a('0x6')](_0x503a('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0x503a('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x503a('0x5')],'defaultValue':''},'stamp':{'type':_0x503a('0x8'),'defaultValue':Sequelize['literal'](_0x503a('0x9'))}}; \ No newline at end of file +var _0xfc9e=['BLOB','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL','getDataValue','INTEGER','STRING'];(function(_0x4b247d,_0x39bde){var _0x22e8aa=function(_0x13d152){while(--_0x13d152){_0x4b247d['push'](_0x4b247d['shift']());}};_0x22e8aa(++_0x39bde);}(_0xfc9e,0x94));var _0xefc9=function(_0x2c3a8f,_0x374e56){_0x2c3a8f=_0x2c3a8f-0x0;var _0x189412=_0xfc9e[_0x2c3a8f];return _0x189412;};'use strict';var Sequelize=require('sequelize');module[_0xefc9('0x0')]={'name':{'type':Sequelize[_0xefc9('0x1')],'get':function(_0x4600e5){return this[_0xefc9('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xefc9('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xefc9('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xefc9('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xefc9('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xefc9('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xefc9('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xefc9('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xefc9('0x4')],'defaultValue':''},'stamp':{'type':_0xefc9('0x6'),'defaultValue':Sequelize[_0xefc9('0x7')](_0xefc9('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 3a7d24e..4c51248 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 _0x4574=['count','offset','limit','set','Content-Range','save','then','destroy','error','stack','name','send','index','map','VoiceMailMessage','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','rawAttributes','length','options','find','create','update','body','msg_id','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','attachment;\x20filename=\x22','.wav\x22','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined'];(function(_0x3add10,_0x457d16){var _0x2da348=function(_0x1fcaa9){while(--_0x1fcaa9){_0x3add10['push'](_0x3add10['shift']());}};_0x2da348(++_0x457d16);}(_0x4574,0x189));var _0x4457=function(_0x46343d,_0x5ba15d){_0x46343d=_0x46343d-0x0;var _0x4f9d86=_0x4574[_0x46343d];return _0x4f9d86;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4457('0x0'));var zipdir=require(_0x4457('0x1'));var jsonpatch=require(_0x4457('0x2'));var rp=require(_0x4457('0x3'));var moment=require(_0x4457('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4457('0x5'));var util=require(_0x4457('0x6'));var path=require(_0x4457('0x7'));var sox=require('sox');var csv=require(_0x4457('0x8'));var ejs=require(_0x4457('0x9'));var fs=require('fs');var fs_extra=require(_0x4457('0xa'));var _=require(_0x4457('0xb'));var squel=require(_0x4457('0xc'));var crypto=require(_0x4457('0xd'));var jsforce=require(_0x4457('0xe'));var deskjs=require(_0x4457('0xf'));var toCsv=require(_0x4457('0x8'));var querystring=require(_0x4457('0x10'));var Papa=require(_0x4457('0x11'));var Redis=require(_0x4457('0x12'));var authService=require(_0x4457('0x13'));var qs=require(_0x4457('0x14'));var as=require(_0x4457('0x15'));var hardwareService=require(_0x4457('0x16'));var logger=require(_0x4457('0x17'))(_0x4457('0x18'));var utils=require(_0x4457('0x19'));var config=require(_0x4457('0x1a'));var licenseUtil=require(_0x4457('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18c605,_0x4692cb){_0x4692cb=_0x4692cb||0xcc;return function(_0x500535){if(_0x500535){return _0x18c605[_0x4457('0x1c')](_0x4692cb);}return _0x18c605[_0x4457('0x1d')](_0x4692cb)[_0x4457('0x1e')]();};}function respondWithResult(_0x4e023f,_0x348e94){_0x348e94=_0x348e94||0xc8;return function(_0x3b84c6){if(_0x3b84c6){return _0x4e023f[_0x4457('0x1d')](_0x348e94)['json'](_0x3b84c6);}};}function respondWithFilteredResult(_0x1292b0,_0x36bd6f){return function(_0x1c79ab){if(_0x1c79ab){var _0x560205=typeof _0x36bd6f['offset']===_0x4457('0x1f')&&typeof _0x36bd6f['limit']===_0x4457('0x1f');var _0x1b39a3=_0x1c79ab[_0x4457('0x20')];var _0x2fb0c8=_0x560205?0x0:_0x36bd6f[_0x4457('0x21')];var _0x4ec901=_0x560205?_0x1c79ab[_0x4457('0x20')]:_0x36bd6f[_0x4457('0x21')]+_0x36bd6f[_0x4457('0x22')];var _0x18fafe;if(_0x4ec901>=_0x1b39a3){_0x4ec901=_0x1b39a3;_0x18fafe=0xc8;}else{_0x18fafe=0xce;}_0x1292b0[_0x4457('0x1d')](_0x18fafe);return _0x1292b0[_0x4457('0x23')](_0x4457('0x24'),_0x2fb0c8+'-'+_0x4ec901+'/'+_0x1b39a3)['json'](_0x1c79ab);}return null;};}function patchUpdates(_0x25941e){return function(_0x23bea7){try{jsonpatch['apply'](_0x23bea7,_0x25941e,!![]);}catch(_0x25e303){return BPromise['reject'](_0x25e303);}return _0x23bea7[_0x4457('0x25')]();};}function saveUpdates(_0x290227,_0x68116a){return function(_0x5d8687){if(_0x5d8687){return _0x5d8687['update'](_0x290227)[_0x4457('0x26')](function(_0x878795){return _0x878795;});}return null;};}function removeEntity(_0x616415,_0x30e213){return function(_0x71eb9e){if(_0x71eb9e){return _0x71eb9e[_0x4457('0x27')]()[_0x4457('0x26')](function(){_0x616415['status'](0xcc)[_0x4457('0x1e')]();});}};}function handleEntityNotFound(_0x958686,_0x4f3856){return function(_0x20d662){if(!_0x20d662){_0x958686[_0x4457('0x1c')](0x194);}return _0x20d662;};}function handleError(_0x12b48e,_0x290a19){_0x290a19=_0x290a19||0x1f4;return function(_0x1b1e6a){logger[_0x4457('0x28')](_0x1b1e6a[_0x4457('0x29')]);if(_0x1b1e6a[_0x4457('0x2a')]){delete _0x1b1e6a[_0x4457('0x2a')];}_0x12b48e[_0x4457('0x1d')](_0x290a19)[_0x4457('0x2b')](_0x1b1e6a);};}exports[_0x4457('0x2c')]=function(_0x5553b5,_0x24b382){var _0x4a0167={},_0x575090={},_0x2c1f8d={'count':0x0,'rows':[]};var _0x17ff9f=_[_0x4457('0x2d')](db[_0x4457('0x2e')]['rawAttributes'],function(_0x488c28){return{'name':_0x488c28['fieldName'],'type':_0x488c28['type']['key']};});_0x575090[_0x4457('0x2f')]=_['differenceBy'](_[_0x4457('0x2d')](_0x17ff9f,_0x4457('0x2a')),[_0x4457('0x2a')]);_0x575090[_0x4457('0x30')]=_[_0x4457('0x31')](_0x5553b5[_0x4457('0x30')]);_0x575090[_0x4457('0x32')]=_[_0x4457('0x33')](_0x575090['model'],_0x575090[_0x4457('0x30')]);_0x4a0167[_0x4457('0x34')]=_['intersection'](_0x575090[_0x4457('0x2f')],qs[_0x4457('0x35')](_0x5553b5[_0x4457('0x30')][_0x4457('0x35')]));_0x4a0167[_0x4457('0x34')]=_0x4a0167['attributes']['length']?_0x4a0167['attributes']:_0x575090[_0x4457('0x2f')];if(!_0x5553b5[_0x4457('0x30')][_0x4457('0x36')](_0x4457('0x37'))){_0x4a0167[_0x4457('0x22')]=qs[_0x4457('0x22')](_0x5553b5[_0x4457('0x30')][_0x4457('0x22')]);_0x4a0167[_0x4457('0x21')]=qs[_0x4457('0x21')](_0x5553b5[_0x4457('0x30')][_0x4457('0x21')]);}_0x4a0167[_0x4457('0x38')]=qs['sort'](_0x5553b5['query'][_0x4457('0x39')]);_0x4a0167[_0x4457('0x3a')]=qs[_0x4457('0x32')](_['pick'](_0x5553b5[_0x4457('0x30')],_0x575090[_0x4457('0x32')]),_0x17ff9f);if(_0x5553b5[_0x4457('0x30')][_0x4457('0x3b')]){_0x4a0167[_0x4457('0x3a')]=_[_0x4457('0x3c')](_0x4a0167[_0x4457('0x3a')],{'$or':_[_0x4457('0x2d')](_0x17ff9f,function(_0x17b3c7){if(_0x17b3c7[_0x4457('0x3d')]!==_0x4457('0x3e')){var _0x51ffe2={};_0x51ffe2[_0x17b3c7[_0x4457('0x2a')]]={'$like':'%'+_0x5553b5[_0x4457('0x30')][_0x4457('0x3b')]+'%'};return _0x51ffe2;}})});}_0x4a0167=_[_0x4457('0x3c')]({},_0x4a0167,_0x5553b5['options']);var _0x176643={'where':_0x4a0167['where']};return db[_0x4457('0x2e')][_0x4457('0x20')](_0x176643)[_0x4457('0x26')](function(_0x54573d){_0x2c1f8d['count']=_0x54573d;if(_0x5553b5['query'][_0x4457('0x3f')]){_0x4a0167[_0x4457('0x40')]=[{'all':!![]}];}return db[_0x4457('0x2e')][_0x4457('0x41')](_0x4a0167);})[_0x4457('0x26')](function(_0x32c7da){_0x2c1f8d[_0x4457('0x42')]=_0x32c7da;return _0x2c1f8d;})['then'](respondWithFilteredResult(_0x24b382,_0x4a0167))[_0x4457('0x43')](handleError(_0x24b382,null));};exports['show']=function(_0x194fdd,_0x4a770b){var _0x458693={'raw':!![],'where':{'id':_0x194fdd[_0x4457('0x44')]['id']}},_0x3948cc={};_0x3948cc[_0x4457('0x2f')]=_['keys'](db[_0x4457('0x2e')][_0x4457('0x45')]);_0x3948cc[_0x4457('0x30')]=_[_0x4457('0x31')](_0x194fdd[_0x4457('0x30')]);_0x3948cc[_0x4457('0x32')]=_[_0x4457('0x33')](_0x3948cc[_0x4457('0x2f')],_0x3948cc[_0x4457('0x30')]);_0x458693[_0x4457('0x34')]=_[_0x4457('0x33')](_0x3948cc[_0x4457('0x2f')],qs['fields'](_0x194fdd[_0x4457('0x30')][_0x4457('0x35')]));_0x458693[_0x4457('0x34')]=_0x458693[_0x4457('0x34')][_0x4457('0x46')]?_0x458693[_0x4457('0x34')]:_0x3948cc[_0x4457('0x2f')];if(_0x194fdd[_0x4457('0x30')]['includeAll']){_0x458693[_0x4457('0x40')]=[{'all':!![]}];}_0x458693=_[_0x4457('0x3c')]({},_0x458693,_0x194fdd[_0x4457('0x47')]);return db[_0x4457('0x2e')][_0x4457('0x48')](_0x458693)['then'](handleEntityNotFound(_0x4a770b,null))[_0x4457('0x26')](respondWithResult(_0x4a770b,null))[_0x4457('0x43')](handleError(_0x4a770b,null));};exports[_0x4457('0x49')]=function(_0x272f01,_0x4c5944){return db[_0x4457('0x2e')]['create'](_0x272f01['body'],{})[_0x4457('0x26')](respondWithResult(_0x4c5944,0xc9))[_0x4457('0x43')](handleError(_0x4c5944,null));};exports[_0x4457('0x4a')]=function(_0x22be22,_0x1ec46d){if(_0x22be22[_0x4457('0x4b')]['id']){delete _0x22be22[_0x4457('0x4b')]['id'];}return db[_0x4457('0x2e')][_0x4457('0x48')]({'where':{'id':_0x22be22['params']['id']}})[_0x4457('0x26')](handleEntityNotFound(_0x1ec46d,null))[_0x4457('0x26')](saveUpdates(_0x22be22[_0x4457('0x4b')],null))['then'](respondWithResult(_0x1ec46d,null))['catch'](handleError(_0x1ec46d,null));};exports['destroy']=function(_0x187805,_0x38ceaa){return db[_0x4457('0x2e')][_0x4457('0x48')]({'where':{'id':_0x187805[_0x4457('0x44')]['id']}})[_0x4457('0x26')](handleEntityNotFound(_0x38ceaa,null))['then'](removeEntity(_0x38ceaa,null))['catch'](handleError(_0x38ceaa,null));};exports['download']=function(_0x2cf1f2,_0x4c416e,_0x3c321f){return db[_0x4457('0x2e')]['find']({'where':{'id':_0x2cf1f2[_0x4457('0x44')]['id']},'attributes':['id','recording',_0x4457('0x4c')]})[_0x4457('0x26')](handleEntityNotFound(_0x4c416e,null))['then'](function(_0x5f0881){if(_0x5f0881){if(!_0x5f0881[_0x4457('0x4d')]){throw new db[(_0x4457('0x4e'))][(_0x4457('0x4f'))](_0x4457('0x50'));}var _0x195c2f={'Content-Type':_0x4457('0x51'),'Content-Disposition':_0x4457('0x52')};if(_0x5f0881[_0x4457('0x4c')]){_0x195c2f['Content-Disposition']=_0x4457('0x53')+_0x5f0881['msg_id']+_0x4457('0x54');}_0x4c416e['set'](_0x195c2f);return _0x4c416e[_0x4457('0x2b')](new Buffer(_0x5f0881['recording']));}})[_0x4457('0x43')](handleError(_0x4c416e,null));}; \ No newline at end of file +var _0x0752=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','update','destroy','then','error','name','send','index','map','rawAttributes','type','model','differenceBy','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','VoiceMailMessage','includeAll','rows','catch','show','params','find','create','body','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0xc78d20,_0x5d0e2e){var _0x4c703d=function(_0x228ad6){while(--_0x228ad6){_0xc78d20['push'](_0xc78d20['shift']());}};_0x4c703d(++_0x5d0e2e);}(_0x0752,0x8b));var _0x2075=function(_0x110114,_0x27ce4b){_0x110114=_0x110114-0x0;var _0x35ddba=_0x0752[_0x110114];return _0x35ddba;};'use strict';var emlformat=require(_0x2075('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2075('0x1'));var jsonpatch=require(_0x2075('0x2'));var rp=require(_0x2075('0x3'));var moment=require(_0x2075('0x4'));var BPromise=require(_0x2075('0x5'));var Mustache=require(_0x2075('0x6'));var util=require(_0x2075('0x7'));var path=require(_0x2075('0x8'));var sox=require(_0x2075('0x9'));var csv=require(_0x2075('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2075('0xb'));var _=require(_0x2075('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2075('0xd'));var toCsv=require(_0x2075('0xa'));var querystring=require('querystring');var Papa=require(_0x2075('0xe'));var Redis=require(_0x2075('0xf'));var authService=require(_0x2075('0x10'));var qs=require(_0x2075('0x11'));var as=require(_0x2075('0x12'));var hardwareService=require(_0x2075('0x13'));var logger=require(_0x2075('0x14'))('api');var utils=require(_0x2075('0x15'));var config=require(_0x2075('0x16'));var licenseUtil=require(_0x2075('0x17'));var db=require(_0x2075('0x18'))['db'];function respondWithStatusCode(_0x258438,_0xc03e4b){_0xc03e4b=_0xc03e4b||0xcc;return function(_0x53b5d9){if(_0x53b5d9){return _0x258438[_0x2075('0x19')](_0xc03e4b);}return _0x258438[_0x2075('0x1a')](_0xc03e4b)[_0x2075('0x1b')]();};}function respondWithResult(_0x3f2cb8,_0x1e31ce){_0x1e31ce=_0x1e31ce||0xc8;return function(_0x919dca){if(_0x919dca){return _0x3f2cb8[_0x2075('0x1a')](_0x1e31ce)['json'](_0x919dca);}};}function respondWithFilteredResult(_0x42faf8,_0x54696d){return function(_0x709766){if(_0x709766){var _0x3883cb=typeof _0x54696d['offset']==='undefined'&&typeof _0x54696d['limit']===_0x2075('0x1c');var _0x4aeeca=_0x709766[_0x2075('0x1d')];var _0x18c579=_0x3883cb?0x0:_0x54696d[_0x2075('0x1e')];var _0x108cea=_0x3883cb?_0x709766[_0x2075('0x1d')]:_0x54696d[_0x2075('0x1e')]+_0x54696d[_0x2075('0x1f')];var _0x54d6ee;if(_0x108cea>=_0x4aeeca){_0x108cea=_0x4aeeca;_0x54d6ee=0xc8;}else{_0x54d6ee=0xce;}_0x42faf8['status'](_0x54d6ee);return _0x42faf8['set']('Content-Range',_0x18c579+'-'+_0x108cea+'/'+_0x4aeeca)['json'](_0x709766);}return null;};}function patchUpdates(_0x21d324){return function(_0x20dfbf){try{jsonpatch['apply'](_0x20dfbf,_0x21d324,!![]);}catch(_0x2a3fa7){return BPromise['reject'](_0x2a3fa7);}return _0x20dfbf['save']();};}function saveUpdates(_0x376fc1,_0x3bd784){return function(_0x552ffa){if(_0x552ffa){return _0x552ffa[_0x2075('0x20')](_0x376fc1)['then'](function(_0x20a45a){return _0x20a45a;});}return null;};}function removeEntity(_0x2dc622,_0x155126){return function(_0x59ef6f){if(_0x59ef6f){return _0x59ef6f[_0x2075('0x21')]()[_0x2075('0x22')](function(){_0x2dc622['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x462dee,_0x44d31a){return function(_0x22c9f8){if(!_0x22c9f8){_0x462dee[_0x2075('0x19')](0x194);}return _0x22c9f8;};}function handleError(_0x4a294a,_0x5965c9){_0x5965c9=_0x5965c9||0x1f4;return function(_0x43a87a){logger[_0x2075('0x23')](_0x43a87a['stack']);if(_0x43a87a[_0x2075('0x24')]){delete _0x43a87a[_0x2075('0x24')];}_0x4a294a[_0x2075('0x1a')](_0x5965c9)[_0x2075('0x25')](_0x43a87a);};}exports[_0x2075('0x26')]=function(_0x218f70,_0x472b66){var _0x3abffa={},_0x236940={},_0x2542b9={'count':0x0,'rows':[]};var _0x5c7316=_[_0x2075('0x27')](db['VoiceMailMessage'][_0x2075('0x28')],function(_0x134bf2){return{'name':_0x134bf2['fieldName'],'type':_0x134bf2[_0x2075('0x29')]['key']};});_0x236940[_0x2075('0x2a')]=_[_0x2075('0x2b')](_[_0x2075('0x27')](_0x5c7316,'name'),['name']);_0x236940[_0x2075('0x2c')]=_[_0x2075('0x2d')](_0x218f70[_0x2075('0x2c')]);_0x236940[_0x2075('0x2e')]=_[_0x2075('0x2f')](_0x236940[_0x2075('0x2a')],_0x236940['query']);_0x3abffa['attributes']=_[_0x2075('0x2f')](_0x236940[_0x2075('0x2a')],qs['fields'](_0x218f70[_0x2075('0x2c')][_0x2075('0x30')]));_0x3abffa[_0x2075('0x31')]=_0x3abffa[_0x2075('0x31')][_0x2075('0x32')]?_0x3abffa[_0x2075('0x31')]:_0x236940['model'];if(!_0x218f70[_0x2075('0x2c')][_0x2075('0x33')](_0x2075('0x34'))){_0x3abffa['limit']=qs['limit'](_0x218f70['query'][_0x2075('0x1f')]);_0x3abffa['offset']=qs[_0x2075('0x1e')](_0x218f70['query'][_0x2075('0x1e')]);}_0x3abffa['order']=qs[_0x2075('0x35')](_0x218f70[_0x2075('0x2c')][_0x2075('0x35')]);_0x3abffa['where']=qs['filters'](_[_0x2075('0x36')](_0x218f70[_0x2075('0x2c')],_0x236940[_0x2075('0x2e')]),_0x5c7316);if(_0x218f70[_0x2075('0x2c')][_0x2075('0x37')]){_0x3abffa['where']=_[_0x2075('0x38')](_0x3abffa[_0x2075('0x39')],{'$or':_[_0x2075('0x27')](_0x5c7316,function(_0x94cf7){if(_0x94cf7[_0x2075('0x29')]!==_0x2075('0x3a')){var _0x5d0ed2={};_0x5d0ed2[_0x94cf7[_0x2075('0x24')]]={'$like':'%'+_0x218f70[_0x2075('0x2c')][_0x2075('0x37')]+'%'};return _0x5d0ed2;}})});}_0x3abffa=_[_0x2075('0x38')]({},_0x3abffa,_0x218f70[_0x2075('0x3b')]);var _0x5d37b0={'where':_0x3abffa[_0x2075('0x39')]};return db[_0x2075('0x3c')][_0x2075('0x1d')](_0x5d37b0)[_0x2075('0x22')](function(_0x11dea0){_0x2542b9[_0x2075('0x1d')]=_0x11dea0;if(_0x218f70[_0x2075('0x2c')][_0x2075('0x3d')]){_0x3abffa['include']=[{'all':!![]}];}return db['VoiceMailMessage']['findAll'](_0x3abffa);})[_0x2075('0x22')](function(_0x3dc7c9){_0x2542b9[_0x2075('0x3e')]=_0x3dc7c9;return _0x2542b9;})['then'](respondWithFilteredResult(_0x472b66,_0x3abffa))[_0x2075('0x3f')](handleError(_0x472b66,null));};exports[_0x2075('0x40')]=function(_0x2328cc,_0x22f63d){var _0x344aed={'raw':!![],'where':{'id':_0x2328cc[_0x2075('0x41')]['id']}},_0x1c5eb1={};_0x1c5eb1[_0x2075('0x2a')]=_[_0x2075('0x2d')](db[_0x2075('0x3c')]['rawAttributes']);_0x1c5eb1['query']=_[_0x2075('0x2d')](_0x2328cc['query']);_0x1c5eb1['filters']=_[_0x2075('0x2f')](_0x1c5eb1[_0x2075('0x2a')],_0x1c5eb1[_0x2075('0x2c')]);_0x344aed[_0x2075('0x31')]=_[_0x2075('0x2f')](_0x1c5eb1[_0x2075('0x2a')],qs[_0x2075('0x30')](_0x2328cc[_0x2075('0x2c')][_0x2075('0x30')]));_0x344aed[_0x2075('0x31')]=_0x344aed[_0x2075('0x31')][_0x2075('0x32')]?_0x344aed[_0x2075('0x31')]:_0x1c5eb1[_0x2075('0x2a')];if(_0x2328cc[_0x2075('0x2c')][_0x2075('0x3d')]){_0x344aed['include']=[{'all':!![]}];}_0x344aed=_['merge']({},_0x344aed,_0x2328cc[_0x2075('0x3b')]);return db[_0x2075('0x3c')][_0x2075('0x42')](_0x344aed)[_0x2075('0x22')](handleEntityNotFound(_0x22f63d,null))[_0x2075('0x22')](respondWithResult(_0x22f63d,null))['catch'](handleError(_0x22f63d,null));};exports['create']=function(_0x3762ae,_0x175250){return db[_0x2075('0x3c')][_0x2075('0x43')](_0x3762ae[_0x2075('0x44')],{})[_0x2075('0x22')](respondWithResult(_0x175250,0xc9))[_0x2075('0x3f')](handleError(_0x175250,null));};exports[_0x2075('0x20')]=function(_0xd5e2b6,_0x34ec9e){if(_0xd5e2b6[_0x2075('0x44')]['id']){delete _0xd5e2b6[_0x2075('0x44')]['id'];}return db['VoiceMailMessage'][_0x2075('0x42')]({'where':{'id':_0xd5e2b6[_0x2075('0x41')]['id']}})[_0x2075('0x22')](handleEntityNotFound(_0x34ec9e,null))['then'](saveUpdates(_0xd5e2b6[_0x2075('0x44')],null))[_0x2075('0x22')](respondWithResult(_0x34ec9e,null))[_0x2075('0x3f')](handleError(_0x34ec9e,null));};exports[_0x2075('0x21')]=function(_0x1fec60,_0x54a79b){return db['VoiceMailMessage'][_0x2075('0x42')]({'where':{'id':_0x1fec60[_0x2075('0x41')]['id']}})[_0x2075('0x22')](handleEntityNotFound(_0x54a79b,null))['then'](removeEntity(_0x54a79b,null))['catch'](handleError(_0x54a79b,null));};exports['download']=function(_0x594662,_0x46f080,_0x1e7d13){return db[_0x2075('0x3c')][_0x2075('0x42')]({'where':{'id':_0x594662[_0x2075('0x41')]['id']},'attributes':['id',_0x2075('0x45'),_0x2075('0x46')]})[_0x2075('0x22')](handleEntityNotFound(_0x46f080,null))[_0x2075('0x22')](function(_0x384230){if(_0x384230){if(!_0x384230[_0x2075('0x45')]){throw new db[(_0x2075('0x47'))][(_0x2075('0x48'))](_0x2075('0x49'));}var _0x4ffcdd={'Content-Type':_0x2075('0x4a'),'Content-Disposition':_0x2075('0x4b')};if(_0x384230['msg_id']){_0x4ffcdd[_0x2075('0x4c')]=_0x2075('0x4d')+_0x384230[_0x2075('0x46')]+_0x2075('0x4e');}_0x46f080[_0x2075('0x4f')](_0x4ffcdd);return _0x46f080['send'](new Buffer(_0x384230['recording']));}})[_0x2075('0x3f')](handleError(_0x46f080,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 977e43a..fafc5d5 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 _0x475b=['voice_voicemail_messages','dir','lodash','../../config/logger','bluebird','request-promise','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage'];(function(_0xa45395,_0x5579e6){var _0x3c83d2=function(_0x5d013c){while(--_0x5d013c){_0xa45395['push'](_0xa45395['shift']());}};_0x3c83d2(++_0x5579e6);}(_0x475b,0xbd));var _0xb475=function(_0x188084,_0x2c186a){_0x188084=_0x188084-0x0;var _0x5597e2=_0x475b[_0x188084];return _0x5597e2;};'use strict';var _=require(_0xb475('0x0'));var util=require('util');var logger=require(_0xb475('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb475('0x2'));var rp=require(_0xb475('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb475('0x4'));var attributes=require(_0xb475('0x5'));module[_0xb475('0x6')]=function(_0xb1b6fe,_0x364e93){return _0xb1b6fe[_0xb475('0x7')](_0xb475('0x8'),attributes,{'tableName':_0xb475('0x9'),'paranoid':![],'indexes':[{'name':_0xb475('0xa'),'fields':[_0xb475('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9ca2=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','dir','lodash','util','../../config/logger','moment'];(function(_0x1b885d,_0xb38593){var _0x1e7eaa=function(_0x124db1){while(--_0x124db1){_0x1b885d['push'](_0x1b885d['shift']());}};_0x1e7eaa(++_0xb38593);}(_0x9ca2,0x130));var _0x29ca=function(_0x2e493a,_0xe4a84e){_0x2e493a=_0x2e493a-0x0;var _0x1152d9=_0x9ca2[_0x2e493a];return _0x1152d9;};'use strict';var _=require(_0x29ca('0x0'));var util=require(_0x29ca('0x1'));var logger=require(_0x29ca('0x2'))('api');var moment=require(_0x29ca('0x3'));var BPromise=require(_0x29ca('0x4'));var rp=require(_0x29ca('0x5'));var fs=require('fs');var path=require(_0x29ca('0x6'));var rimraf=require(_0x29ca('0x7'));var config=require(_0x29ca('0x8'));var attributes=require(_0x29ca('0x9'));module[_0x29ca('0xa')]=function(_0x403f5f,_0x2da442){return _0x403f5f[_0x29ca('0xb')](_0x29ca('0xc'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x29ca('0xd'),'fields':[_0x29ca('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 039c4af..41753a2 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 _0x9fdc=['code','message','result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3aa6a0,_0x17f574){var _0x1561b7=function(_0x1c91b8){while(--_0x1c91b8){_0x3aa6a0['push'](_0x3aa6a0['shift']());}};_0x1561b7(++_0x17f574);}(_0x9fdc,0x14e));var _0xc9fd=function(_0x5cc8,_0x1faa02){_0x5cc8=_0x5cc8-0x0;var _0x450661=_0x9fdc[_0x5cc8];return _0x450661;};'use strict';var _=require('lodash');var util=require(_0xc9fd('0x0'));var moment=require(_0xc9fd('0x1'));var BPromise=require(_0xc9fd('0x2'));var rs=require(_0xc9fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc9fd('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xc9fd('0x5'));var jayson=require(_0xc9fd('0x6'));var client=jayson[_0xc9fd('0x7')][_0xc9fd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4fe418,_0x1e7c08,_0x8369b){return new BPromise(function(_0x207c51,_0x188967){return client[_0xc9fd('0x9')](_0x4fe418,_0x8369b)[_0xc9fd('0xa')](function(_0x1c65b8){logger[_0xc9fd('0xb')](_0xc9fd('0xc'),_0x1e7c08,_0xc9fd('0xd'));logger[_0xc9fd('0xe')](_0xc9fd('0xf'),_0x1e7c08,_0xc9fd('0xd'),JSON[_0xc9fd('0x10')](_0x1c65b8));if(_0x1c65b8[_0xc9fd('0x11')]){if(_0x1c65b8[_0xc9fd('0x11')][_0xc9fd('0x12')]===0x1f4){logger[_0xc9fd('0x11')](_0xc9fd('0xc'),_0x1e7c08,_0x1c65b8[_0xc9fd('0x11')][_0xc9fd('0x13')]);return _0x188967(_0x1c65b8[_0xc9fd('0x11')][_0xc9fd('0x13')]);}logger[_0xc9fd('0x11')](_0xc9fd('0xc'),_0x1e7c08,_0x1c65b8[_0xc9fd('0x11')][_0xc9fd('0x13')]);return _0x207c51(_0x1c65b8['error'][_0xc9fd('0x13')]);}else{logger[_0xc9fd('0xb')](_0xc9fd('0xc'),_0x1e7c08,_0xc9fd('0xd'));_0x207c51(_0x1c65b8[_0xc9fd('0x14')][_0xc9fd('0x13')]);}})[_0xc9fd('0x15')](function(_0x250eff){logger['error'](_0xc9fd('0xc'),_0x1e7c08,_0x250eff);_0x188967(_0x250eff);});});} \ No newline at end of file +var _0x596b=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client','http','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x596b,0xb5));var _0xb596=function(_0x67a5ef,_0x1b90e2){_0x67a5ef=_0x67a5ef-0x0;var _0x18afed=_0x596b[_0x67a5ef];return _0x18afed;};'use strict';var _=require(_0xb596('0x0'));var util=require(_0xb596('0x1'));var moment=require(_0xb596('0x2'));var BPromise=require(_0xb596('0x3'));var rs=require(_0xb596('0x4'));var fs=require('fs');var Redis=require(_0xb596('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb596('0x6'));var logger=require(_0xb596('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb596('0x8')][_0xb596('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f23b6,_0x4bb87e,_0x271ce2){return new BPromise(function(_0x5f0fa1,_0x9de6d4){return client['request'](_0x4f23b6,_0x271ce2)[_0xb596('0xa')](function(_0x26c2a2){logger['info'](_0xb596('0xb'),_0x4bb87e,_0xb596('0xc'));logger[_0xb596('0xd')](_0xb596('0xe'),_0x4bb87e,_0xb596('0xc'),JSON[_0xb596('0xf')](_0x26c2a2));if(_0x26c2a2[_0xb596('0x10')]){if(_0x26c2a2['error'][_0xb596('0x11')]===0x1f4){logger[_0xb596('0x10')](_0xb596('0xb'),_0x4bb87e,_0x26c2a2['error'][_0xb596('0x12')]);return _0x9de6d4(_0x26c2a2['error']['message']);}logger[_0xb596('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x4bb87e,_0x26c2a2[_0xb596('0x10')]['message']);return _0x5f0fa1(_0x26c2a2['error'][_0xb596('0x12')]);}else{logger['info'](_0xb596('0xb'),_0x4bb87e,_0xb596('0xc'));_0x5f0fa1(_0x26c2a2['result'][_0xb596('0x12')]);}})[_0xb596('0x13')](function(_0x37f260){logger['error'](_0xb596('0xb'),_0x4bb87e,_0x37f260);_0x9de6d4(_0x37f260);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 4aa21cb..b17805f 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 _0x2150=['../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','/:id/sounds','getSounds','create','post','addSound','put','update','destroy','delete','/:id/sounds/:id2','removeSound','exports','multer','util','path','express','Router','../../components/interaction/service'];(function(_0x4063a4,_0x19d730){var _0x17908d=function(_0x3ce714){while(--_0x3ce714){_0x4063a4['push'](_0x4063a4['shift']());}};_0x17908d(++_0x19d730);}(_0x2150,0x162));var _0x0215=function(_0x335202,_0x16d8a7){_0x335202=_0x335202-0x0;var _0x93ca72=_0x2150[_0x335202];return _0x93ca72;};'use strict';var multer=require(_0x0215('0x0'));var util=require(_0x0215('0x1'));var path=require(_0x0215('0x2'));var timeout=require('connect-timeout');var express=require(_0x0215('0x3'));var router=express[_0x0215('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0215('0x5'));var config=require(_0x0215('0x6'));var controller=require(_0x0215('0x7'));router[_0x0215('0x8')]('/',auth[_0x0215('0x9')](),controller[_0x0215('0xa')]);router[_0x0215('0x8')](_0x0215('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x0215('0x8')](_0x0215('0xc'),auth['isAuthenticated'](),controller[_0x0215('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0215('0xe')]);router[_0x0215('0xf')](_0x0215('0xc'),auth[_0x0215('0x9')](),controller[_0x0215('0x10')]);router[_0x0215('0x11')](_0x0215('0xb'),auth[_0x0215('0x9')](),controller[_0x0215('0x12')]);router['delete'](_0x0215('0xb'),auth[_0x0215('0x9')](),controller[_0x0215('0x13')]);router[_0x0215('0x14')](_0x0215('0x15'),auth[_0x0215('0x9')](),controller[_0x0215('0x16')]);module[_0x0215('0x17')]=router; \ No newline at end of file +var _0x8078=['addSound','put','/:id','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','show','post','create'];(function(_0x3d58ca,_0x3acbd8){var _0x1644a4=function(_0x46d3bd){while(--_0x46d3bd){_0x3d58ca['push'](_0x3d58ca['shift']());}};_0x1644a4(++_0x3acbd8);}(_0x8078,0x99));var _0x8807=function(_0x1e324c,_0x1dac6f){_0x1e324c=_0x1e324c-0x0;var _0x4afcad=_0x8078[_0x1e324c];return _0x4afcad;};'use strict';var multer=require(_0x8807('0x0'));var util=require(_0x8807('0x1'));var path=require(_0x8807('0x2'));var timeout=require('connect-timeout');var express=require(_0x8807('0x3'));var router=express[_0x8807('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8807('0x5'));var interaction=require(_0x8807('0x6'));var config=require(_0x8807('0x7'));var controller=require(_0x8807('0x8'));router[_0x8807('0x9')]('/',auth[_0x8807('0xa')](),controller[_0x8807('0xb')]);router['get']('/:id',auth[_0x8807('0xa')](),controller[_0x8807('0xc')]);router[_0x8807('0x9')]('/:id/sounds',auth[_0x8807('0xa')](),controller['getSounds']);router[_0x8807('0xd')]('/',auth[_0x8807('0xa')](),controller[_0x8807('0xe')]);router['post']('/:id/sounds',auth['isAuthenticated'](),controller[_0x8807('0xf')]);router[_0x8807('0x10')](_0x8807('0x11'),auth[_0x8807('0xa')](),controller[_0x8807('0x12')]);router[_0x8807('0x13')](_0x8807('0x11'),auth['isAuthenticated'](),controller[_0x8807('0x14')]);router[_0x8807('0x13')](_0x8807('0x15'),auth[_0x8807('0xa')](),controller[_0x8807('0x16')]);module[_0x8807('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index a2bffe9..78c062a 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 _0xc2ff=['exports','STRING','name','ENUM','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize'];(function(_0x5e9876,_0x16052d){var _0x576c48=function(_0x338c97){while(--_0x338c97){_0x5e9876['push'](_0x5e9876['shift']());}};_0x576c48(++_0x16052d);}(_0xc2ff,0x1ed));var _0xfc2f=function(_0x4f01a1,_0x354cf1){_0x4f01a1=_0x4f01a1-0x0;var _0x1d0dc5=_0xc2ff[_0x4f01a1];return _0x1d0dc5;};'use strict';var Sequelize=require(_0xfc2f('0x0'));module[_0xfc2f('0x1')]={'name':{'type':Sequelize[_0xfc2f('0x2')],'allowNull':![],'unique':_0xfc2f('0x3')},'mode':{'type':Sequelize[_0xfc2f('0x4')]('custom',_0xfc2f('0x5'),_0xfc2f('0x6'),_0xfc2f('0x7'),_0xfc2f('0x8'),_0xfc2f('0x9')),'allowNull':!![],'defaultValue':_0xfc2f('0x5')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xfc2f('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xfc2f('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xfc2f('0x2')],'allowNull':!![],'defaultValue':_0xfc2f('0xa')},'format':{'type':Sequelize[_0xfc2f('0x2')],'allowNull':!![]},'stamp':{'type':_0xfc2f('0xb')},'defaultEntry':{'type':Sequelize[_0xfc2f('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf218=['STRING','custom','mp3nb','quietmp3nb','quietmp3','mp3','files','alpha','TIMESTAMP','BOOLEAN','sequelize','exports'];(function(_0x2daad1,_0x2681a2){var _0x3b5125=function(_0xf1307){while(--_0xf1307){_0x2daad1['push'](_0x2daad1['shift']());}};_0x3b5125(++_0x2681a2);}(_0xf218,0xe2));var _0x8f21=function(_0x3965a3,_0x4fcebb){_0x3965a3=_0x3965a3-0x0;var _0x55f51d=_0xf218[_0x3965a3];return _0x55f51d;};'use strict';var Sequelize=require(_0x8f21('0x0'));module[_0x8f21('0x1')]={'name':{'type':Sequelize[_0x8f21('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM'](_0x8f21('0x3'),'files',_0x8f21('0x4'),_0x8f21('0x5'),_0x8f21('0x6'),_0x8f21('0x7')),'allowNull':!![],'defaultValue':_0x8f21('0x8')},'directory':{'type':Sequelize[_0x8f21('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x8f21('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x8f21('0x2')],'allowNull':!![],'defaultValue':_0x8f21('0x9')},'format':{'type':Sequelize[_0x8f21('0x2')],'allowNull':!![]},'stamp':{'type':_0x8f21('0xa')},'defaultEntry':{'type':Sequelize[_0x8f21('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 70ef97f..5e625a3 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 _0xda93=['path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','reject','save','update','then','get','MusicOnHolds','UserProfileResource','destroy','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','filter','merge','VIRTUAL','options','count','include','catch','show','includeAll','find','body','params','create','sequelize','mode','files','directory','root','mkdirSync','user','role','UserProfileSection','userProfileId','autoAssociation','transaction','forEach','unlinkSync','join','rmdirSync','Sequelize','message','addSound','save_name','converted_format','format','basename','extname','server/files/moh','%s.%s','symlinkSync','ValidationError','removeSound','id2','createdAt','getSounds','Sound','pick','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x7bec53,_0x201e06){var _0xff91aa=function(_0xd9ae3a){while(--_0xd9ae3a){_0x7bec53['push'](_0x7bec53['shift']());}};_0xff91aa(++_0x201e06);}(_0xda93,0x1c3));var _0x3da9=function(_0x528176,_0x48a565){_0x528176=_0x528176-0x0;var _0x12b66c=_0xda93[_0x528176];return _0x12b66c;};'use strict';var emlformat=require(_0x3da9('0x0'));var rimraf=require(_0x3da9('0x1'));var zipdir=require(_0x3da9('0x2'));var jsonpatch=require(_0x3da9('0x3'));var rp=require(_0x3da9('0x4'));var moment=require(_0x3da9('0x5'));var BPromise=require(_0x3da9('0x6'));var Mustache=require(_0x3da9('0x7'));var util=require(_0x3da9('0x8'));var path=require(_0x3da9('0x9'));var sox=require(_0x3da9('0xa'));var csv=require(_0x3da9('0xb'));var ejs=require(_0x3da9('0xc'));var fs=require('fs');var fs_extra=require(_0x3da9('0xd'));var _=require('lodash');var squel=require(_0x3da9('0xe'));var crypto=require(_0x3da9('0xf'));var jsforce=require(_0x3da9('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x3da9('0xb'));var querystring=require(_0x3da9('0x11'));var Papa=require(_0x3da9('0x12'));var Redis=require(_0x3da9('0x13'));var authService=require(_0x3da9('0x14'));var qs=require(_0x3da9('0x15'));var as=require(_0x3da9('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3da9('0x17'))(_0x3da9('0x18'));var utils=require(_0x3da9('0x19'));var config=require(_0x3da9('0x1a'));var licenseUtil=require(_0x3da9('0x1b'));var db=require(_0x3da9('0x1c'))['db'];function respondWithStatusCode(_0x9d807c,_0x496551){_0x496551=_0x496551||0xcc;return function(_0x34dae2){if(_0x34dae2){return _0x9d807c[_0x3da9('0x1d')](_0x496551);}return _0x9d807c[_0x3da9('0x1e')](_0x496551)[_0x3da9('0x1f')]();};}function respondWithResult(_0x465338,_0x4d23d5){_0x4d23d5=_0x4d23d5||0xc8;return function(_0x121dc9){if(_0x121dc9){return _0x465338[_0x3da9('0x1e')](_0x4d23d5)[_0x3da9('0x20')](_0x121dc9);}};}function respondWithFilteredResult(_0x457997,_0x39a396){return function(_0x408fd9){if(_0x408fd9){var _0x4397cb=typeof _0x39a396['offset']===_0x3da9('0x21')&&typeof _0x39a396[_0x3da9('0x22')]===_0x3da9('0x21');var _0x3393de=_0x408fd9['count'];var _0xaa803c=_0x4397cb?0x0:_0x39a396[_0x3da9('0x23')];var _0x4ac406=_0x4397cb?_0x408fd9['count']:_0x39a396[_0x3da9('0x23')]+_0x39a396[_0x3da9('0x22')];var _0x22a2d8;if(_0x4ac406>=_0x3393de){_0x4ac406=_0x3393de;_0x22a2d8=0xc8;}else{_0x22a2d8=0xce;}_0x457997[_0x3da9('0x1e')](_0x22a2d8);return _0x457997[_0x3da9('0x24')](_0x3da9('0x25'),_0xaa803c+'-'+_0x4ac406+'/'+_0x3393de)[_0x3da9('0x20')](_0x408fd9);}return null;};}function patchUpdates(_0x277f8a){return function(_0x1c0df4){try{jsonpatch['apply'](_0x1c0df4,_0x277f8a,!![]);}catch(_0x56520a){return BPromise[_0x3da9('0x26')](_0x56520a);}return _0x1c0df4[_0x3da9('0x27')]();};}function saveUpdates(_0x59b28f,_0x506f9d){return function(_0xca7a6){if(_0xca7a6){return _0xca7a6[_0x3da9('0x28')](_0x59b28f)[_0x3da9('0x29')](function(_0x4ea0e3){return _0x4ea0e3;});}return null;};}function removeEntity(_0x2a773e,_0x27142f){return function(_0x4b175d){if(_0x4b175d){return _0x4b175d['destroy']()['then'](function(){var _0x21b63c=_0x4b175d[_0x3da9('0x2a')]({'plain':!![]});var _0x393678=_0x3da9('0x2b');return db[_0x3da9('0x2c')][_0x3da9('0x2d')]({'where':{'type':_0x393678,'resourceId':_0x21b63c['id']}})[_0x3da9('0x29')](function(){return _0x4b175d;});})[_0x3da9('0x29')](function(){_0x2a773e[_0x3da9('0x1e')](0xcc)[_0x3da9('0x1f')]();});}};}function handleEntityNotFound(_0x5aec79,_0x533f5e){return function(_0x5b180e){if(!_0x5b180e){_0x5aec79[_0x3da9('0x1d')](0x194);}return _0x5b180e;};}function handleError(_0x87695f,_0x306e3d){_0x306e3d=_0x306e3d||0x1f4;return function(_0x14abe6){logger[_0x3da9('0x2e')](_0x14abe6[_0x3da9('0x2f')]);if(_0x14abe6[_0x3da9('0x30')]){delete _0x14abe6[_0x3da9('0x30')];}_0x87695f[_0x3da9('0x1e')](_0x306e3d)[_0x3da9('0x31')](_0x14abe6);};}exports[_0x3da9('0x32')]=function(_0x469ab2,_0xc623d7){var _0x53f500={},_0x9be535={},_0x3a1bdf={'count':0x0,'rows':[]};var _0x588da2=_[_0x3da9('0x33')](db[_0x3da9('0x34')][_0x3da9('0x35')],function(_0x2664b0){return{'name':_0x2664b0[_0x3da9('0x36')],'type':_0x2664b0['type'][_0x3da9('0x37')]};});_0x9be535[_0x3da9('0x38')]=_[_0x3da9('0x33')](_0x588da2,'name');_0x9be535[_0x3da9('0x39')]=_[_0x3da9('0x3a')](_0x469ab2[_0x3da9('0x39')]);_0x9be535[_0x3da9('0x3b')]=_[_0x3da9('0x3c')](_0x9be535[_0x3da9('0x38')],_0x9be535[_0x3da9('0x39')]);_0x53f500['attributes']=_['intersection'](_0x9be535[_0x3da9('0x38')],qs['fields'](_0x469ab2['query'][_0x3da9('0x3d')]));_0x53f500['attributes']=_0x53f500[_0x3da9('0x3e')][_0x3da9('0x3f')]?_0x53f500[_0x3da9('0x3e')]:_0x9be535[_0x3da9('0x38')];if(!_0x469ab2[_0x3da9('0x39')]['hasOwnProperty']('nolimit')){_0x53f500[_0x3da9('0x22')]=qs[_0x3da9('0x22')](_0x469ab2[_0x3da9('0x39')][_0x3da9('0x22')]);_0x53f500[_0x3da9('0x23')]=qs['offset'](_0x469ab2[_0x3da9('0x39')][_0x3da9('0x23')]);}_0x53f500[_0x3da9('0x40')]=qs[_0x3da9('0x41')](_0x469ab2[_0x3da9('0x39')][_0x3da9('0x41')]);delete _0x469ab2['query']['sort'];_0x53f500[_0x3da9('0x42')]=qs['filters'](_['pick'](_0x469ab2['query'],_0x9be535[_0x3da9('0x3b')]),_0x588da2);if(_0x469ab2[_0x3da9('0x39')][_0x3da9('0x43')]){_0x53f500[_0x3da9('0x42')]=_[_0x3da9('0x44')](_0x53f500[_0x3da9('0x42')],{'$or':_[_0x3da9('0x33')](_0x588da2,function(_0x2f0906){if(_0x2f0906['type']!==_0x3da9('0x45')){var _0x531ba6={};_0x531ba6[_0x2f0906[_0x3da9('0x30')]]={'$like':'%'+_0x469ab2['query'][_0x3da9('0x43')]+'%'};return _0x531ba6;}})});}_0x53f500=_[_0x3da9('0x44')]({},_0x53f500,_0x469ab2[_0x3da9('0x46')]);var _0x39e455={'where':_0x53f500[_0x3da9('0x42')]};return db[_0x3da9('0x34')][_0x3da9('0x47')](_0x39e455)[_0x3da9('0x29')](function(_0x4c2d93){_0x3a1bdf[_0x3da9('0x47')]=_0x4c2d93;if(_0x469ab2[_0x3da9('0x39')]['includeAll']){_0x53f500[_0x3da9('0x48')]=[{'all':!![]}];}return db['VoiceMusicOnHold']['findAll'](_0x53f500);})[_0x3da9('0x29')](function(_0x10b664){_0x3a1bdf['rows']=_0x10b664;return _0x3a1bdf;})[_0x3da9('0x29')](respondWithFilteredResult(_0xc623d7,_0x53f500))[_0x3da9('0x49')](handleError(_0xc623d7,null));};exports[_0x3da9('0x4a')]=function(_0x21140a,_0x344a48){var _0x16e367={'raw':![],'where':{'id':_0x21140a['params']['id']}},_0x5ce04f={};_0x5ce04f['model']=_[_0x3da9('0x3a')](db[_0x3da9('0x34')][_0x3da9('0x35')]);_0x5ce04f[_0x3da9('0x39')]=_[_0x3da9('0x3a')](_0x21140a[_0x3da9('0x39')]);_0x5ce04f['filters']=_[_0x3da9('0x3c')](_0x5ce04f[_0x3da9('0x38')],_0x5ce04f['query']);_0x16e367[_0x3da9('0x3e')]=_[_0x3da9('0x3c')](_0x5ce04f['model'],qs[_0x3da9('0x3d')](_0x21140a[_0x3da9('0x39')][_0x3da9('0x3d')]));_0x16e367['attributes']=_0x16e367['attributes'][_0x3da9('0x3f')]?_0x16e367['attributes']:_0x5ce04f[_0x3da9('0x38')];if(_0x21140a[_0x3da9('0x39')][_0x3da9('0x4b')]){_0x16e367[_0x3da9('0x48')]=[{'all':!![]}];}_0x16e367=_[_0x3da9('0x44')]({},_0x16e367,_0x21140a[_0x3da9('0x46')]);return db[_0x3da9('0x34')][_0x3da9('0x4c')](_0x16e367)['then'](handleEntityNotFound(_0x344a48,null))[_0x3da9('0x29')](respondWithResult(_0x344a48,null))['catch'](handleError(_0x344a48,null));};exports['update']=function(_0x47816f,_0x2f5ac5){if(_0x47816f[_0x3da9('0x4d')]['id']){delete _0x47816f[_0x3da9('0x4d')]['id'];}return db[_0x3da9('0x34')][_0x3da9('0x4c')]({'where':{'id':_0x47816f[_0x3da9('0x4e')]['id']}})[_0x3da9('0x29')](handleEntityNotFound(_0x2f5ac5,null))[_0x3da9('0x29')](saveUpdates(_0x47816f['body'],null))[_0x3da9('0x29')](respondWithResult(_0x2f5ac5,null))[_0x3da9('0x49')](handleError(_0x2f5ac5,null));};exports[_0x3da9('0x4f')]=function(_0x21e710,_0x517429,_0x5aa55b){return db[_0x3da9('0x50')]['transaction'](function(_0xa965e3){if(_0x21e710['body'][_0x3da9('0x51')]===_0x3da9('0x52')){_0x21e710[_0x3da9('0x4d')][_0x3da9('0x53')]=path['join'](config[_0x3da9('0x54')],'server/files/moh',_0x21e710[_0x3da9('0x4d')]['name']);}return db[_0x3da9('0x34')]['create'](_0x21e710[_0x3da9('0x4d')],{'transaction':_0xa965e3})[_0x3da9('0x29')](function(_0xe360bc){if(_0x21e710[_0x3da9('0x4d')][_0x3da9('0x51')]===_0x3da9('0x52')){fs[_0x3da9('0x55')](_0xe360bc[_0x3da9('0x53')],parseInt('0777',0x8));}var _0x2687e7=_0x21e710[_0x3da9('0x56')][_0x3da9('0x2a')]({'plain':!![]});if(!_0x2687e7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2687e7[_0x3da9('0x57')]===_0x3da9('0x56')){var _0x7d6566=_0xe360bc['get']({'plain':!![]});return db[_0x3da9('0x58')][_0x3da9('0x4c')]({'where':{'name':_0x3da9('0x2b'),'userProfileId':_0x2687e7[_0x3da9('0x59')]},'raw':!![]})[_0x3da9('0x29')](function(_0x179555){if(_0x179555&&_0x179555[_0x3da9('0x5a')]===0x0){return db['UserProfileResource'][_0x3da9('0x4f')]({'name':_0x7d6566[_0x3da9('0x30')],'resourceId':_0x7d6566['id'],'type':_0x179555[_0x3da9('0x30')],'sectionId':_0x179555['id']},{})['then'](function(){return _0xe360bc;});}else{return _0xe360bc;}})[_0x3da9('0x49')](function(_0x49fbac){logger[_0x3da9('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49fbac);});}return _0xe360bc;});})[_0x3da9('0x29')](respondWithResult(_0x517429,0xc9))[_0x3da9('0x49')](handleError(_0x517429,null));};exports[_0x3da9('0x2d')]=function(_0x25355f,_0x5930e8,_0x594b4f){var _0x4c24bf;return db[_0x3da9('0x34')]['find']({'where':{'id':_0x25355f['params']['id']}})[_0x3da9('0x29')](function(_0x3a3af9){if(_0x3a3af9){return db[_0x3da9('0x50')][_0x3da9('0x5b')](function(_0x49ce23){return _0x3a3af9[_0x3da9('0x2d')]({'transaction':_0x49ce23,'raw':!![]})[_0x3da9('0x29')](function(_0x437357){if(_0x437357[_0x3da9('0x53')]){fs['readdirSync'](_0x437357[_0x3da9('0x53')])[_0x3da9('0x5c')](function(_0x5d88e4){fs[_0x3da9('0x5d')](path[_0x3da9('0x5e')](_0x437357['directory'],_0x5d88e4));});fs[_0x3da9('0x5f')](_0x437357[_0x3da9('0x53')]);}return _0x437357;});})[_0x3da9('0x49')](function(_0x53e4a1){throw new db[(_0x3da9('0x60'))]['ValidationError'](_0x53e4a1[_0x3da9('0x61')]);});}})[_0x3da9('0x29')](handleEntityNotFound(_0x5930e8,null))[_0x3da9('0x29')](removeEntity(_0x5930e8,null))[_0x3da9('0x49')](handleError(_0x5930e8,null));};exports[_0x3da9('0x62')]=function(_0x11422f,_0x2be7ad,_0x3d1578){return db[_0x3da9('0x50')][_0x3da9('0x5b')](function(_0x44bd8e){var _0x2ef186;return db[_0x3da9('0x34')]['find']({'where':{'id':_0x11422f[_0x3da9('0x4e')]['id']}})[_0x3da9('0x29')](function(_0x505ca0){if(_0x505ca0){_0x2ef186=_0x505ca0;return _0x505ca0[_0x3da9('0x62')](_0x11422f[_0x3da9('0x4d')]['id'],{'transaction':_0x44bd8e});}})[_0x3da9('0x29')](function(_0x54e6ec){if(_0x54e6ec){return db['Sound']['findOne']({'where':{'id':_0x11422f['body']['id']},'attributes':['id',_0x3da9('0x30'),_0x3da9('0x63'),_0x3da9('0x64'),'createdAt'],'raw':!![]});}})['then'](function(_0x583afd){if(_0x583afd){var _0x2524cb=path[_0x3da9('0x5e')](config['root'],'server/files/sounds/converted',util[_0x3da9('0x65')]('%s.%s',path[_0x3da9('0x66')](_0x583afd[_0x3da9('0x63')],path[_0x3da9('0x67')](_0x583afd[_0x3da9('0x63')])),_0x583afd[_0x3da9('0x64')]));var _0x4724e1=path['join'](config['root'],_0x3da9('0x68'),_0x2ef186[_0x3da9('0x30')],util['format'](_0x3da9('0x69'),_0x583afd[_0x3da9('0x30')],_0x583afd[_0x3da9('0x64')]));fs[_0x3da9('0x6a')](_0x2524cb,_0x4724e1);return _0x583afd;}})['catch'](function(_0x56976f){throw new db['Sequelize'][(_0x3da9('0x6b'))](_0x56976f[_0x3da9('0x61')]);});})[_0x3da9('0x29')](handleEntityNotFound(_0x2be7ad,null))[_0x3da9('0x29')](respondWithResult(_0x2be7ad,0xc9))[_0x3da9('0x49')](handleError(_0x2be7ad,null));};exports[_0x3da9('0x6c')]=function(_0x14fd49,_0x13e05d,_0x2271a6){return db[_0x3da9('0x50')]['transaction'](function(_0x135cb5){var _0xb1fd1a;return db[_0x3da9('0x34')]['findOne']({'where':{'id':_0x14fd49['params']['id']}})['then'](handleEntityNotFound(_0x13e05d,null))[_0x3da9('0x29')](function(_0x59e2cf){if(_0x59e2cf){_0xb1fd1a=_0x59e2cf;return _0x59e2cf[_0x3da9('0x6c')](_0x14fd49[_0x3da9('0x4e')][_0x3da9('0x6d')]);}})['then'](function(_0x43979b){if(_0x43979b){return db['Sound']['findOne']({'where':{'id':_0x14fd49[_0x3da9('0x4e')][_0x3da9('0x6d')]},'attributes':['id','name',_0x3da9('0x63'),_0x3da9('0x64'),_0x3da9('0x6e')],'raw':!![]});}})[_0x3da9('0x29')](function(_0x47d3ad){if(_0x47d3ad){fs[_0x3da9('0x5d')](path[_0x3da9('0x5e')](_0xb1fd1a[_0x3da9('0x53')],util[_0x3da9('0x65')](_0x3da9('0x69'),_0x47d3ad[_0x3da9('0x30')],_0x47d3ad[_0x3da9('0x64')])));return _0x47d3ad;}})[_0x3da9('0x49')](function(_0x2289f0){throw new db['Sequelize'][(_0x3da9('0x6b'))](_0x2289f0['message']);});})[_0x3da9('0x29')](handleEntityNotFound(_0x13e05d,null))[_0x3da9('0x29')](respondWithStatusCode(_0x13e05d,0xcc))[_0x3da9('0x49')](handleError(_0x13e05d,null));};exports[_0x3da9('0x6f')]=function(_0x4eed50,_0x57f5de,_0x3a444c){var _0x6c7178={};var _0x1b4b60={};var _0x1d7afd;var _0xd02592;return db[_0x3da9('0x34')]['findOne']({'where':{'id':_0x4eed50[_0x3da9('0x4e')]['id']}})[_0x3da9('0x29')](handleEntityNotFound(_0x57f5de,null))['then'](function(_0x4f64fe){if(_0x4f64fe){_0x1d7afd=_0x4f64fe;_0x1b4b60[_0x3da9('0x38')]=_[_0x3da9('0x3a')](db[_0x3da9('0x70')][_0x3da9('0x35')]);_0x1b4b60[_0x3da9('0x39')]=_['keys'](_0x4eed50[_0x3da9('0x39')]);_0x1b4b60['filters']=_[_0x3da9('0x3c')](_0x1b4b60['model'],_0x1b4b60[_0x3da9('0x39')]);_0x6c7178['attributes']=_[_0x3da9('0x3c')](_0x1b4b60[_0x3da9('0x38')],qs['fields'](_0x4eed50[_0x3da9('0x39')][_0x3da9('0x3d')]));_0x6c7178[_0x3da9('0x3e')]=_0x6c7178[_0x3da9('0x3e')]['length']?_0x6c7178['attributes']:_0x1b4b60['model'];_0x6c7178[_0x3da9('0x40')]=qs['sort'](_0x4eed50['query']['sort']);_0x6c7178[_0x3da9('0x42')]=qs[_0x3da9('0x3b')](_[_0x3da9('0x71')](_0x4eed50['query'],_0x1b4b60[_0x3da9('0x3b')]));if(_0x4eed50[_0x3da9('0x39')][_0x3da9('0x43')]){_0x6c7178[_0x3da9('0x42')]=_[_0x3da9('0x44')](_0x6c7178[_0x3da9('0x42')],{'$or':_[_0x3da9('0x33')](_0x6c7178[_0x3da9('0x3e')],function(_0x183cb4){var _0x2968ee={};_0x2968ee[_0x183cb4]={'$like':'%'+_0x4eed50[_0x3da9('0x39')][_0x3da9('0x43')]+'%'};return _0x2968ee;})});}_0x6c7178=_[_0x3da9('0x44')]({},_0x6c7178,_0x4eed50[_0x3da9('0x46')]);return _0x1d7afd['getSounds'](_0x6c7178);}})[_0x3da9('0x29')](function(_0x5a6a4e){if(_0x5a6a4e){_0xd02592=_0x5a6a4e['length'];if(!_0x4eed50['query'][_0x3da9('0x72')]('nolimit')){_0x6c7178[_0x3da9('0x22')]=qs[_0x3da9('0x22')](_0x4eed50['query']['limit']);_0x6c7178[_0x3da9('0x23')]=qs['offset'](_0x4eed50['query'][_0x3da9('0x23')]);}return _0x1d7afd[_0x3da9('0x6f')](_0x6c7178);}})[_0x3da9('0x29')](function(_0x1bb75a){if(_0x1bb75a){return _0x1bb75a?{'count':_0xd02592,'rows':_0x1bb75a}:null;}})['then'](respondWithResult(_0x57f5de,null))[_0x3da9('0x49')](handleError(_0x57f5de,null));}; \ No newline at end of file +var _0x46e5=['params','readdirSync','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','transaction','Sound','findOne','save_name','converted_format','createdAt','basename','extname','format','%s.%s','removeSound','id2','getSounds','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','get','MusicOnHolds','UserProfileResource','sendStatus','error','stack','name','send','index','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','update','body','sequelize','files','directory','join','root','server/files/moh','create','mode','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x46e5,0x8a));var _0x546e=function(_0x5980db,_0x1ce203){_0x5980db=_0x5980db-0x0;var _0x27040f=_0x46e5[_0x5980db];return _0x27040f;};'use strict';var emlformat=require(_0x546e('0x0'));var rimraf=require(_0x546e('0x1'));var zipdir=require(_0x546e('0x2'));var jsonpatch=require(_0x546e('0x3'));var rp=require(_0x546e('0x4'));var moment=require('moment');var BPromise=require(_0x546e('0x5'));var Mustache=require(_0x546e('0x6'));var util=require(_0x546e('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x546e('0x8'));var ejs=require(_0x546e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x546e('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x546e('0xb'));var deskjs=require(_0x546e('0xc'));var toCsv=require(_0x546e('0x8'));var querystring=require(_0x546e('0xd'));var Papa=require(_0x546e('0xe'));var Redis=require(_0x546e('0xf'));var authService=require(_0x546e('0x10'));var qs=require(_0x546e('0x11'));var as=require(_0x546e('0x12'));var hardwareService=require(_0x546e('0x13'));var logger=require(_0x546e('0x14'))(_0x546e('0x15'));var utils=require('../../config/utils');var config=require(_0x546e('0x16'));var licenseUtil=require(_0x546e('0x17'));var db=require(_0x546e('0x18'))['db'];function respondWithStatusCode(_0xa8e1b9,_0x13c3f8){_0x13c3f8=_0x13c3f8||0xcc;return function(_0x2f477b){if(_0x2f477b){return _0xa8e1b9['sendStatus'](_0x13c3f8);}return _0xa8e1b9[_0x546e('0x19')](_0x13c3f8)[_0x546e('0x1a')]();};}function respondWithResult(_0x10da8a,_0x27c592){_0x27c592=_0x27c592||0xc8;return function(_0x1256c4){if(_0x1256c4){return _0x10da8a['status'](_0x27c592)[_0x546e('0x1b')](_0x1256c4);}};}function respondWithFilteredResult(_0x8a7e46,_0x52375a){return function(_0xc4fe48){if(_0xc4fe48){var _0x3ee5f8=typeof _0x52375a[_0x546e('0x1c')]===_0x546e('0x1d')&&typeof _0x52375a[_0x546e('0x1e')]===_0x546e('0x1d');var _0x2aea17=_0xc4fe48[_0x546e('0x1f')];var _0x4feb41=_0x3ee5f8?0x0:_0x52375a[_0x546e('0x1c')];var _0x51751e=_0x3ee5f8?_0xc4fe48['count']:_0x52375a[_0x546e('0x1c')]+_0x52375a[_0x546e('0x1e')];var _0x5abdec;if(_0x51751e>=_0x2aea17){_0x51751e=_0x2aea17;_0x5abdec=0xc8;}else{_0x5abdec=0xce;}_0x8a7e46['status'](_0x5abdec);return _0x8a7e46[_0x546e('0x20')](_0x546e('0x21'),_0x4feb41+'-'+_0x51751e+'/'+_0x2aea17)['json'](_0xc4fe48);}return null;};}function patchUpdates(_0x4f99f7){return function(_0x57aa0c){try{jsonpatch[_0x546e('0x22')](_0x57aa0c,_0x4f99f7,!![]);}catch(_0x24867b){return BPromise[_0x546e('0x23')](_0x24867b);}return _0x57aa0c['save']();};}function saveUpdates(_0x2cbbd6,_0x51d4a2){return function(_0x508f10){if(_0x508f10){return _0x508f10['update'](_0x2cbbd6)[_0x546e('0x24')](function(_0x1f5dc0){return _0x1f5dc0;});}return null;};}function removeEntity(_0x1ee1ea,_0x57134b){return function(_0x44cb08){if(_0x44cb08){return _0x44cb08[_0x546e('0x25')]()[_0x546e('0x24')](function(){var _0x2405b4=_0x44cb08[_0x546e('0x26')]({'plain':!![]});var _0x189bfe=_0x546e('0x27');return db[_0x546e('0x28')]['destroy']({'where':{'type':_0x189bfe,'resourceId':_0x2405b4['id']}})[_0x546e('0x24')](function(){return _0x44cb08;});})[_0x546e('0x24')](function(){_0x1ee1ea[_0x546e('0x19')](0xcc)[_0x546e('0x1a')]();});}};}function handleEntityNotFound(_0xe84e03,_0x44ec32){return function(_0xca2a5e){if(!_0xca2a5e){_0xe84e03[_0x546e('0x29')](0x194);}return _0xca2a5e;};}function handleError(_0x2cf87b,_0x46fe8b){_0x46fe8b=_0x46fe8b||0x1f4;return function(_0x2abda6){logger[_0x546e('0x2a')](_0x2abda6[_0x546e('0x2b')]);if(_0x2abda6['name']){delete _0x2abda6[_0x546e('0x2c')];}_0x2cf87b[_0x546e('0x19')](_0x46fe8b)[_0x546e('0x2d')](_0x2abda6);};}exports[_0x546e('0x2e')]=function(_0x301f86,_0x1f8541){var _0x340d4c={},_0x5d3d3b={},_0x30bbb0={'count':0x0,'rows':[]};var _0x497196=_['map'](db[_0x546e('0x2f')][_0x546e('0x30')],function(_0x3f1acd){return{'name':_0x3f1acd[_0x546e('0x31')],'type':_0x3f1acd[_0x546e('0x32')][_0x546e('0x33')]};});_0x5d3d3b[_0x546e('0x34')]=_[_0x546e('0x35')](_0x497196,_0x546e('0x2c'));_0x5d3d3b[_0x546e('0x36')]=_[_0x546e('0x37')](_0x301f86[_0x546e('0x36')]);_0x5d3d3b[_0x546e('0x38')]=_[_0x546e('0x39')](_0x5d3d3b[_0x546e('0x34')],_0x5d3d3b[_0x546e('0x36')]);_0x340d4c['attributes']=_['intersection'](_0x5d3d3b[_0x546e('0x34')],qs[_0x546e('0x3a')](_0x301f86[_0x546e('0x36')][_0x546e('0x3a')]));_0x340d4c['attributes']=_0x340d4c[_0x546e('0x3b')][_0x546e('0x3c')]?_0x340d4c[_0x546e('0x3b')]:_0x5d3d3b['model'];if(!_0x301f86[_0x546e('0x36')][_0x546e('0x3d')](_0x546e('0x3e'))){_0x340d4c[_0x546e('0x1e')]=qs['limit'](_0x301f86[_0x546e('0x36')]['limit']);_0x340d4c[_0x546e('0x1c')]=qs[_0x546e('0x1c')](_0x301f86[_0x546e('0x36')][_0x546e('0x1c')]);}_0x340d4c[_0x546e('0x3f')]=qs[_0x546e('0x40')](_0x301f86[_0x546e('0x36')]['sort']);delete _0x301f86['query'][_0x546e('0x40')];_0x340d4c['where']=qs[_0x546e('0x38')](_['pick'](_0x301f86['query'],_0x5d3d3b[_0x546e('0x38')]),_0x497196);if(_0x301f86[_0x546e('0x36')][_0x546e('0x41')]){_0x340d4c[_0x546e('0x42')]=_[_0x546e('0x43')](_0x340d4c[_0x546e('0x42')],{'$or':_[_0x546e('0x35')](_0x497196,function(_0x44ece2){if(_0x44ece2[_0x546e('0x32')]!==_0x546e('0x44')){var _0x5cb0f3={};_0x5cb0f3[_0x44ece2[_0x546e('0x2c')]]={'$like':'%'+_0x301f86['query'][_0x546e('0x41')]+'%'};return _0x5cb0f3;}})});}_0x340d4c=_[_0x546e('0x43')]({},_0x340d4c,_0x301f86[_0x546e('0x45')]);var _0x517b6e={'where':_0x340d4c[_0x546e('0x42')]};return db[_0x546e('0x2f')][_0x546e('0x1f')](_0x517b6e)['then'](function(_0x54e9f3){_0x30bbb0[_0x546e('0x1f')]=_0x54e9f3;if(_0x301f86[_0x546e('0x36')][_0x546e('0x46')]){_0x340d4c[_0x546e('0x47')]=[{'all':!![]}];}return db[_0x546e('0x2f')][_0x546e('0x48')](_0x340d4c);})[_0x546e('0x24')](function(_0x15cd3a){_0x30bbb0[_0x546e('0x49')]=_0x15cd3a;return _0x30bbb0;})['then'](respondWithFilteredResult(_0x1f8541,_0x340d4c))[_0x546e('0x4a')](handleError(_0x1f8541,null));};exports['show']=function(_0x15d560,_0x465919){var _0x121afe={'raw':![],'where':{'id':_0x15d560['params']['id']}},_0x3d1f89={};_0x3d1f89[_0x546e('0x34')]=_[_0x546e('0x37')](db[_0x546e('0x2f')][_0x546e('0x30')]);_0x3d1f89[_0x546e('0x36')]=_['keys'](_0x15d560[_0x546e('0x36')]);_0x3d1f89[_0x546e('0x38')]=_[_0x546e('0x39')](_0x3d1f89['model'],_0x3d1f89[_0x546e('0x36')]);_0x121afe[_0x546e('0x3b')]=_[_0x546e('0x39')](_0x3d1f89[_0x546e('0x34')],qs[_0x546e('0x3a')](_0x15d560[_0x546e('0x36')]['fields']));_0x121afe[_0x546e('0x3b')]=_0x121afe['attributes'][_0x546e('0x3c')]?_0x121afe[_0x546e('0x3b')]:_0x3d1f89[_0x546e('0x34')];if(_0x15d560['query']['includeAll']){_0x121afe[_0x546e('0x47')]=[{'all':!![]}];}_0x121afe=_['merge']({},_0x121afe,_0x15d560['options']);return db['VoiceMusicOnHold'][_0x546e('0x4b')](_0x121afe)[_0x546e('0x24')](handleEntityNotFound(_0x465919,null))[_0x546e('0x24')](respondWithResult(_0x465919,null))[_0x546e('0x4a')](handleError(_0x465919,null));};exports[_0x546e('0x4c')]=function(_0x48f481,_0x217e01){if(_0x48f481[_0x546e('0x4d')]['id']){delete _0x48f481[_0x546e('0x4d')]['id'];}return db[_0x546e('0x2f')][_0x546e('0x4b')]({'where':{'id':_0x48f481['params']['id']}})[_0x546e('0x24')](handleEntityNotFound(_0x217e01,null))[_0x546e('0x24')](saveUpdates(_0x48f481[_0x546e('0x4d')],null))[_0x546e('0x24')](respondWithResult(_0x217e01,null))['catch'](handleError(_0x217e01,null));};exports['create']=function(_0x187c20,_0x3c4c47,_0x540cbe){return db[_0x546e('0x4e')]['transaction'](function(_0x480ee3){if(_0x187c20['body']['mode']===_0x546e('0x4f')){_0x187c20[_0x546e('0x4d')][_0x546e('0x50')]=path[_0x546e('0x51')](config[_0x546e('0x52')],_0x546e('0x53'),_0x187c20[_0x546e('0x4d')][_0x546e('0x2c')]);}return db[_0x546e('0x2f')][_0x546e('0x54')](_0x187c20[_0x546e('0x4d')],{'transaction':_0x480ee3})['then'](function(_0x54da32){if(_0x187c20[_0x546e('0x4d')][_0x546e('0x55')]===_0x546e('0x4f')){fs[_0x546e('0x56')](_0x54da32[_0x546e('0x50')],parseInt(_0x546e('0x57'),0x8));}var _0x1cf399=_0x187c20[_0x546e('0x58')][_0x546e('0x26')]({'plain':!![]});if(!_0x1cf399)throw new Error(_0x546e('0x59'));if(_0x1cf399[_0x546e('0x5a')]===_0x546e('0x58')){var _0x89e1c7=_0x54da32[_0x546e('0x26')]({'plain':!![]});return db[_0x546e('0x5b')]['find']({'where':{'name':_0x546e('0x27'),'userProfileId':_0x1cf399[_0x546e('0x5c')]},'raw':!![]})[_0x546e('0x24')](function(_0x201243){if(_0x201243&&_0x201243[_0x546e('0x5d')]===0x0){return db[_0x546e('0x28')][_0x546e('0x54')]({'name':_0x89e1c7[_0x546e('0x2c')],'resourceId':_0x89e1c7['id'],'type':_0x201243[_0x546e('0x2c')],'sectionId':_0x201243['id']},{})[_0x546e('0x24')](function(){return _0x54da32;});}else{return _0x54da32;}})[_0x546e('0x4a')](function(_0x17cf4d){logger[_0x546e('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17cf4d);});}return _0x54da32;});})[_0x546e('0x24')](respondWithResult(_0x3c4c47,0xc9))[_0x546e('0x4a')](handleError(_0x3c4c47,null));};exports[_0x546e('0x25')]=function(_0x492ab7,_0x1b73a1,_0x450159){var _0x4cf1bc;return db[_0x546e('0x2f')][_0x546e('0x4b')]({'where':{'id':_0x492ab7[_0x546e('0x5e')]['id']}})[_0x546e('0x24')](function(_0x1257e1){if(_0x1257e1){return db['sequelize']['transaction'](function(_0x44ca9d){return _0x1257e1[_0x546e('0x25')]({'transaction':_0x44ca9d,'raw':!![]})[_0x546e('0x24')](function(_0x2606dd){if(_0x2606dd[_0x546e('0x50')]){fs[_0x546e('0x5f')](_0x2606dd[_0x546e('0x50')])['forEach'](function(_0x5e3cf0){fs[_0x546e('0x60')](path[_0x546e('0x51')](_0x2606dd[_0x546e('0x50')],_0x5e3cf0));});fs[_0x546e('0x61')](_0x2606dd[_0x546e('0x50')]);}return _0x2606dd;});})[_0x546e('0x4a')](function(_0x1ef72a){throw new db[(_0x546e('0x62'))][(_0x546e('0x63'))](_0x1ef72a[_0x546e('0x64')]);});}})[_0x546e('0x24')](handleEntityNotFound(_0x1b73a1,null))['then'](removeEntity(_0x1b73a1,null))['catch'](handleError(_0x1b73a1,null));};exports[_0x546e('0x65')]=function(_0x562bd8,_0x344276,_0x1f8445){return db[_0x546e('0x4e')][_0x546e('0x66')](function(_0x2235d0){var _0x4674ec;return db[_0x546e('0x2f')][_0x546e('0x4b')]({'where':{'id':_0x562bd8[_0x546e('0x5e')]['id']}})[_0x546e('0x24')](function(_0xa31658){if(_0xa31658){_0x4674ec=_0xa31658;return _0xa31658[_0x546e('0x65')](_0x562bd8[_0x546e('0x4d')]['id'],{'transaction':_0x2235d0});}})[_0x546e('0x24')](function(_0x51e943){if(_0x51e943){return db[_0x546e('0x67')][_0x546e('0x68')]({'where':{'id':_0x562bd8['body']['id']},'attributes':['id','name',_0x546e('0x69'),_0x546e('0x6a'),_0x546e('0x6b')],'raw':!![]});}})[_0x546e('0x24')](function(_0xd88efc){if(_0xd88efc){var _0x3ec6f8=path[_0x546e('0x51')](config[_0x546e('0x52')],'server/files/sounds/converted',util['format']('%s.%s',path[_0x546e('0x6c')](_0xd88efc[_0x546e('0x69')],path[_0x546e('0x6d')](_0xd88efc[_0x546e('0x69')])),_0xd88efc[_0x546e('0x6a')]));var _0x12e025=path[_0x546e('0x51')](config[_0x546e('0x52')],'server/files/moh',_0x4674ec[_0x546e('0x2c')],util[_0x546e('0x6e')](_0x546e('0x6f'),_0xd88efc['name'],_0xd88efc[_0x546e('0x6a')]));fs['symlinkSync'](_0x3ec6f8,_0x12e025);return _0xd88efc;}})[_0x546e('0x4a')](function(_0x291cdb){throw new db['Sequelize'][(_0x546e('0x63'))](_0x291cdb[_0x546e('0x64')]);});})[_0x546e('0x24')](handleEntityNotFound(_0x344276,null))[_0x546e('0x24')](respondWithResult(_0x344276,0xc9))[_0x546e('0x4a')](handleError(_0x344276,null));};exports[_0x546e('0x70')]=function(_0x493279,_0x3bf34f,_0x31d1ff){return db[_0x546e('0x4e')][_0x546e('0x66')](function(_0x3bab10){var _0x5c43b5;return db['VoiceMusicOnHold'][_0x546e('0x68')]({'where':{'id':_0x493279[_0x546e('0x5e')]['id']}})[_0x546e('0x24')](handleEntityNotFound(_0x3bf34f,null))['then'](function(_0x3f1a91){if(_0x3f1a91){_0x5c43b5=_0x3f1a91;return _0x3f1a91[_0x546e('0x70')](_0x493279[_0x546e('0x5e')]['id2']);}})[_0x546e('0x24')](function(_0x10a6d9){if(_0x10a6d9){return db[_0x546e('0x67')][_0x546e('0x68')]({'where':{'id':_0x493279[_0x546e('0x5e')][_0x546e('0x71')]},'attributes':['id','name',_0x546e('0x69'),'converted_format',_0x546e('0x6b')],'raw':!![]});}})[_0x546e('0x24')](function(_0x21f5ae){if(_0x21f5ae){fs[_0x546e('0x60')](path[_0x546e('0x51')](_0x5c43b5['directory'],util[_0x546e('0x6e')](_0x546e('0x6f'),_0x21f5ae[_0x546e('0x2c')],_0x21f5ae['converted_format'])));return _0x21f5ae;}})[_0x546e('0x4a')](function(_0xf5b3e5){throw new db[(_0x546e('0x62'))][(_0x546e('0x63'))](_0xf5b3e5['message']);});})['then'](handleEntityNotFound(_0x3bf34f,null))[_0x546e('0x24')](respondWithStatusCode(_0x3bf34f,0xcc))[_0x546e('0x4a')](handleError(_0x3bf34f,null));};exports[_0x546e('0x72')]=function(_0x5bc919,_0x2df0d2,_0x1dc627){var _0x4075d9={};var _0x58f680={};var _0x24cbe3;var _0x21ff6a;return db[_0x546e('0x2f')][_0x546e('0x68')]({'where':{'id':_0x5bc919[_0x546e('0x5e')]['id']}})[_0x546e('0x24')](handleEntityNotFound(_0x2df0d2,null))[_0x546e('0x24')](function(_0x9117b){if(_0x9117b){_0x24cbe3=_0x9117b;_0x58f680['model']=_[_0x546e('0x37')](db[_0x546e('0x67')][_0x546e('0x30')]);_0x58f680['query']=_['keys'](_0x5bc919[_0x546e('0x36')]);_0x58f680['filters']=_[_0x546e('0x39')](_0x58f680[_0x546e('0x34')],_0x58f680[_0x546e('0x36')]);_0x4075d9['attributes']=_['intersection'](_0x58f680['model'],qs[_0x546e('0x3a')](_0x5bc919[_0x546e('0x36')][_0x546e('0x3a')]));_0x4075d9['attributes']=_0x4075d9[_0x546e('0x3b')][_0x546e('0x3c')]?_0x4075d9[_0x546e('0x3b')]:_0x58f680[_0x546e('0x34')];_0x4075d9[_0x546e('0x3f')]=qs[_0x546e('0x40')](_0x5bc919[_0x546e('0x36')][_0x546e('0x40')]);_0x4075d9[_0x546e('0x42')]=qs[_0x546e('0x38')](_[_0x546e('0x73')](_0x5bc919['query'],_0x58f680[_0x546e('0x38')]));if(_0x5bc919[_0x546e('0x36')][_0x546e('0x41')]){_0x4075d9[_0x546e('0x42')]=_[_0x546e('0x43')](_0x4075d9[_0x546e('0x42')],{'$or':_[_0x546e('0x35')](_0x4075d9[_0x546e('0x3b')],function(_0x176b94){var _0x34d0c7={};_0x34d0c7[_0x176b94]={'$like':'%'+_0x5bc919[_0x546e('0x36')]['filter']+'%'};return _0x34d0c7;})});}_0x4075d9=_[_0x546e('0x43')]({},_0x4075d9,_0x5bc919['options']);return _0x24cbe3['getSounds'](_0x4075d9);}})[_0x546e('0x24')](function(_0x3fa9bf){if(_0x3fa9bf){_0x21ff6a=_0x3fa9bf['length'];if(!_0x5bc919['query'][_0x546e('0x3d')](_0x546e('0x3e'))){_0x4075d9['limit']=qs['limit'](_0x5bc919['query'][_0x546e('0x1e')]);_0x4075d9[_0x546e('0x1c')]=qs[_0x546e('0x1c')](_0x5bc919['query']['offset']);}return _0x24cbe3['getSounds'](_0x4075d9);}})[_0x546e('0x24')](function(_0x159127){if(_0x159127){return _0x159127?{'count':_0x21ff6a,'rows':_0x159127}:null;}})[_0x546e('0x24')](respondWithResult(_0x2df0d2,null))[_0x546e('0x4a')](handleError(_0x2df0d2,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index af00689..b69651c 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 _0xfb08=['../../config/environment','define','VoiceMusicOnHold','voice_musiconhold','../../config/logger','api','path','rimraf'];(function(_0x41f3c7,_0x60fdb0){var _0x321911=function(_0x35895c){while(--_0x35895c){_0x41f3c7['push'](_0x41f3c7['shift']());}};_0x321911(++_0x60fdb0);}(_0xfb08,0x12c));var _0x8fb0=function(_0x5e9dfb,_0x318663){_0x5e9dfb=_0x5e9dfb-0x0;var _0x33994d=_0xfb08[_0x5e9dfb];return _0x33994d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8fb0('0x0'))(_0x8fb0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8fb0('0x2'));var rimraf=require(_0x8fb0('0x3'));var config=require(_0x8fb0('0x4'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x19b140,_0x4458ce){return _0x19b140[_0x8fb0('0x5')](_0x8fb0('0x6'),attributes,{'tableName':_0x8fb0('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0e7=['voice_musiconhold','../../config/logger','rimraf','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xd0e7,0x121));var _0x7d0e=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0xd0e7[_0x51c819];return _0x15c5d2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7d0e('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7d0e('0x1'));var config=require('../../config/environment');var attributes=require(_0x7d0e('0x2'));module[_0x7d0e('0x3')]=function(_0x1bae67,_0x513da9){return _0x1bae67['define'](_0x7d0e('0x4'),attributes,{'tableName':_0x7d0e('0x5'),'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 563703d..fcee19b 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 _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0x20f95d,_0x58be12){var _0x48d778=function(_0x5d48ff){while(--_0x5d48ff){_0x20f95d['push'](_0x20f95d['shift']());}};_0x48d778(++_0x58be12);}(_0xedd9,0xfc));var _0x9edd=function(_0x27662b,_0x3f3347){_0x27662b=_0x27662b-0x0;var _0x3d4405=_0xedd9[_0x27662b];return _0x3d4405;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file +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(_0x4fdfec,_0x1568ee){var _0x4477b9=function(_0x3eb73b){while(--_0x3eb73b){_0x4fdfec['push'](_0x4fdfec['shift']());}};_0x4477b9(++_0x1568ee);}(_0x34e8,0x12c));var _0x834e=function(_0x1a28ca,_0x429ae4){_0x1a28ca=_0x1a28ca-0x0;var _0x12de74=_0x34e8[_0x1a28ca];return _0x12de74;};'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 diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 00a04d9..ba67cd3 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 _0xf88f=['create','addAgents','addTeams','put','update','delete','destroy','removeAgents','removeTeams','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post'];(function(_0x3ee4cc,_0x31e6b3){var _0x505ba2=function(_0xb55aca){while(--_0xb55aca){_0x3ee4cc['push'](_0x3ee4cc['shift']());}};_0x505ba2(++_0x31e6b3);}(_0xf88f,0x1bb));var _0xff88=function(_0x4f77a2,_0x43b267){_0x4f77a2=_0x4f77a2-0x0;var _0x383f81=_0xf88f[_0x4f77a2];return _0x383f81;};'use strict';var multer=require(_0xff88('0x0'));var util=require(_0xff88('0x1'));var path=require(_0xff88('0x2'));var timeout=require(_0xff88('0x3'));var express=require(_0xff88('0x4'));var router=express[_0xff88('0x5')]();var fs_extra=require(_0xff88('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xff88('0x7'));var config=require(_0xff88('0x8'));var controller=require(_0xff88('0x9'));router['get']('/',auth[_0xff88('0xa')](),controller[_0xff88('0xb')]);router[_0xff88('0xc')](_0xff88('0xd'),auth[_0xff88('0xa')](),controller[_0xff88('0xe')]);router['get'](_0xff88('0xf'),auth[_0xff88('0xa')](),controller[_0xff88('0x10')]);router[_0xff88('0xc')](_0xff88('0x11'),auth[_0xff88('0xa')](),controller[_0xff88('0x12')]);router[_0xff88('0xc')](_0xff88('0x13'),auth[_0xff88('0xa')](),controller[_0xff88('0x14')]);router[_0xff88('0x15')]('/',auth[_0xff88('0xa')](),controller[_0xff88('0x16')]);router[_0xff88('0x15')]('/:id/users',auth[_0xff88('0xa')](),controller[_0xff88('0x17')]);router[_0xff88('0x15')]('/:id/teams',auth[_0xff88('0xa')](),controller[_0xff88('0x18')]);router[_0xff88('0x19')](_0xff88('0xf'),auth[_0xff88('0xa')](),controller[_0xff88('0x1a')]);router[_0xff88('0x1b')](_0xff88('0xf'),auth['isAuthenticated'](),controller[_0xff88('0x1c')]);router[_0xff88('0x1b')]('/:id/users',auth['isAuthenticated'](),controller[_0xff88('0x1d')]);router[_0xff88('0x1b')]('/:id/teams',auth[_0xff88('0xa')](),controller[_0xff88('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x4f5d=['/:id','show','getAgents','/:id/teams','getTeams','post','create','/:id/users','put','update','delete','destroy','removeAgents','removeTeams','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe'];(function(_0xc3b53b,_0x1c1267){var _0x5c3e73=function(_0x4f2218){while(--_0x4f2218){_0xc3b53b['push'](_0xc3b53b['shift']());}};_0x5c3e73(++_0x1c1267);}(_0x4f5d,0x1d1));var _0xd4f5=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x4f5d[_0x565c49];return _0x20ca34;};'use strict';var multer=require(_0xd4f5('0x0'));var util=require(_0xd4f5('0x1'));var path=require(_0xd4f5('0x2'));var timeout=require(_0xd4f5('0x3'));var express=require(_0xd4f5('0x4'));var router=express[_0xd4f5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd4f5('0x6'));var interaction=require(_0xd4f5('0x7'));var config=require(_0xd4f5('0x8'));var controller=require(_0xd4f5('0x9'));router[_0xd4f5('0xa')]('/',auth[_0xd4f5('0xb')](),controller[_0xd4f5('0xc')]);router[_0xd4f5('0xa')](_0xd4f5('0xd'),auth[_0xd4f5('0xb')](),controller[_0xd4f5('0xe')]);router[_0xd4f5('0xa')](_0xd4f5('0xf'),auth['isAuthenticated'](),controller[_0xd4f5('0x10')]);router[_0xd4f5('0xa')]('/:id/users',auth[_0xd4f5('0xb')](),controller[_0xd4f5('0x11')]);router[_0xd4f5('0xa')](_0xd4f5('0x12'),auth[_0xd4f5('0xb')](),controller[_0xd4f5('0x13')]);router[_0xd4f5('0x14')]('/',auth[_0xd4f5('0xb')](),controller[_0xd4f5('0x15')]);router['post'](_0xd4f5('0x16'),auth[_0xd4f5('0xb')](),controller['addAgents']);router[_0xd4f5('0x14')](_0xd4f5('0x12'),auth[_0xd4f5('0xb')](),controller['addTeams']);router[_0xd4f5('0x17')](_0xd4f5('0xf'),auth[_0xd4f5('0xb')](),controller[_0xd4f5('0x18')]);router[_0xd4f5('0x19')](_0xd4f5('0xf'),auth[_0xd4f5('0xb')](),controller[_0xd4f5('0x1a')]);router['delete'](_0xd4f5('0x16'),auth['isAuthenticated'](),controller[_0xd4f5('0x1b')]);router['delete'](_0xd4f5('0x12'),auth[_0xd4f5('0xb')](),controller[_0xd4f5('0x1c')]);module[_0xd4f5('0x1d')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 9dffc23..aacc329 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 _0xba49=['VIRTUAL','system-','getDataValue','INTEGER','sequelize','STRING','name'];(function(_0x22f924,_0x33d2ac){var _0x126cc9=function(_0x4f3027){while(--_0x4f3027){_0x22f924['push'](_0x22f924['shift']());}};_0x126cc9(++_0x33d2ac);}(_0xba49,0xf2));var _0x9ba4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xba49[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require(_0x9ba4('0x0'));module['exports']={'name':{'type':Sequelize[_0x9ba4('0x1')],'allowNull':![],'unique':_0x9ba4('0x2')},'prefix':{'type':Sequelize[_0x9ba4('0x3')],'get':function(_0x5beb58){return _0x9ba4('0x4')+this[_0x9ba4('0x5')](_0x9ba4('0x2'))+'-';}},'description':{'type':Sequelize[_0x9ba4('0x1')]},'callerIdAll':{'type':Sequelize[_0x9ba4('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x9ba4('0x6')]}}; \ No newline at end of file +var _0xcc01=['name','VIRTUAL','system-','getDataValue','INTEGER','sequelize','exports','STRING'];(function(_0x2fafc2,_0x795839){var _0x1aecfd=function(_0x4a339d){while(--_0x4a339d){_0x2fafc2['push'](_0x2fafc2['shift']());}};_0x1aecfd(++_0x795839);}(_0xcc01,0x18d));var _0x1cc0=function(_0x9c79b3,_0x5c5ac0){_0x9c79b3=_0x9c79b3-0x0;var _0x2b897a=_0xcc01[_0x9c79b3];return _0x2b897a;};'use strict';var Sequelize=require(_0x1cc0('0x0'));module[_0x1cc0('0x1')]={'name':{'type':Sequelize[_0x1cc0('0x2')],'allowNull':![],'unique':_0x1cc0('0x3')},'prefix':{'type':Sequelize[_0x1cc0('0x4')],'get':function(_0x232590){return _0x1cc0('0x5')+this[_0x1cc0('0x6')](_0x1cc0('0x3'))+'-';}},'description':{'type':Sequelize[_0x1cc0('0x2')]},'callerIdAll':{'type':Sequelize[_0x1cc0('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x1cc0('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 46af248..3bf2382 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 _0x63a5=['merge','VIRTUAL','options','includeAll','include','VoicePrefix','findAll','rows','catch','show','params','rawAttributes','keys','find','describe','create','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','context','from-sip','exten','app','appdata','prefix','NoOp','VoicePrefixId','VoiceExtension','bulkCreate','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','No\x20callerid\x20available','goto','charAt','system-','transaction','findById','addAgents','ids','spread','emit','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','pick','getTeams','Team','Agents','online','voicePause','interface','flatMap','sequelize','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','userVoicePrefix:save','removeTeams','select','field','tq.TeamId','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','compact','value','isEmpty','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','VoicePrefixes','UserProfileResource','sendStatus','error','stack','name','send','index','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter'];(function(_0x3f972e,_0x1dbde2){var _0x2dfb57=function(_0x5051c2){while(--_0x5051c2){_0x3f972e['push'](_0x3f972e['shift']());}};_0x2dfb57(++_0x1dbde2);}(_0x63a5,0x18e));var _0x563a=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x63a5[_0x15c421];return _0x5e5ed5;};'use strict';var emlformat=require(_0x563a('0x0'));var rimraf=require(_0x563a('0x1'));var zipdir=require(_0x563a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x563a('0x3'));var moment=require('moment');var BPromise=require(_0x563a('0x4'));var Mustache=require(_0x563a('0x5'));var util=require(_0x563a('0x6'));var path=require(_0x563a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x563a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x563a('0x9'));var squel=require(_0x563a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x563a('0xb'));var toCsv=require(_0x563a('0xc'));var querystring=require(_0x563a('0xd'));var Papa=require(_0x563a('0xe'));var Redis=require(_0x563a('0xf'));var authService=require(_0x563a('0x10'));var qs=require(_0x563a('0x11'));var as=require(_0x563a('0x12'));var hardwareService=require(_0x563a('0x13'));var logger=require(_0x563a('0x14'))(_0x563a('0x15'));var utils=require(_0x563a('0x16'));var config=require(_0x563a('0x17'));var licenseUtil=require(_0x563a('0x18'));var db=require('../../mysqldb')['db'];config[_0x563a('0x19')]=_[_0x563a('0x1a')](config[_0x563a('0x19')],{'host':_0x563a('0x1b'),'port':0x18eb});var socket=require(_0x563a('0x1c'))(new Redis(config[_0x563a('0x19')]));require('./voicePrefix.socket')[_0x563a('0x1d')](socket);function respondWithStatusCode(_0x3045ac,_0x8c3727){_0x8c3727=_0x8c3727||0xcc;return function(_0x26987f){if(_0x26987f){return _0x3045ac['sendStatus'](_0x8c3727);}return _0x3045ac['status'](_0x8c3727)[_0x563a('0x1e')]();};}function respondWithResult(_0x2ad667,_0x5b291f){_0x5b291f=_0x5b291f||0xc8;return function(_0x2ade24){if(_0x2ade24){return _0x2ad667[_0x563a('0x1f')](_0x5b291f)[_0x563a('0x20')](_0x2ade24);}};}function respondWithFilteredResult(_0x9c2f77,_0x4f947d){return function(_0x598693){if(_0x598693){var _0xe3d2bd=typeof _0x4f947d[_0x563a('0x21')]===_0x563a('0x22')&&typeof _0x4f947d['limit']==='undefined';var _0x52b99a=_0x598693['count'];var _0x40916a=_0xe3d2bd?0x0:_0x4f947d[_0x563a('0x21')];var _0x26061f=_0xe3d2bd?_0x598693[_0x563a('0x23')]:_0x4f947d['offset']+_0x4f947d['limit'];var _0x3930f0;if(_0x26061f>=_0x52b99a){_0x26061f=_0x52b99a;_0x3930f0=0xc8;}else{_0x3930f0=0xce;}_0x9c2f77[_0x563a('0x1f')](_0x3930f0);return _0x9c2f77[_0x563a('0x24')](_0x563a('0x25'),_0x40916a+'-'+_0x26061f+'/'+_0x52b99a)[_0x563a('0x20')](_0x598693);}return null;};}function patchUpdates(_0x2dc7e2){return function(_0x44b460){try{jsonpatch[_0x563a('0x26')](_0x44b460,_0x2dc7e2,!![]);}catch(_0x506491){return BPromise[_0x563a('0x27')](_0x506491);}return _0x44b460['save']();};}function saveUpdates(_0x44e2c1,_0xd3e0ae){return function(_0x3a36a4){if(_0x3a36a4){return _0x3a36a4[_0x563a('0x28')](_0x44e2c1)[_0x563a('0x29')](function(_0x1682ee){return _0x1682ee;});}return null;};}function removeEntity(_0x3642b3,_0x173990){return function(_0x4de4c3){if(_0x4de4c3){return _0x4de4c3[_0x563a('0x2a')]()[_0x563a('0x29')](function(){var _0x2311f2=_0x4de4c3[_0x563a('0x2b')]({'plain':!![]});var _0xce8165=_0x563a('0x2c');return db[_0x563a('0x2d')][_0x563a('0x2a')]({'where':{'type':_0xce8165,'resourceId':_0x2311f2['id']}})[_0x563a('0x29')](function(){return _0x4de4c3;});})[_0x563a('0x29')](function(){_0x3642b3[_0x563a('0x1f')](0xcc)[_0x563a('0x1e')]();});}};}function handleEntityNotFound(_0x1bdfb0,_0x7696c2){return function(_0x579cb5){if(!_0x579cb5){_0x1bdfb0[_0x563a('0x2e')](0x194);}return _0x579cb5;};}function handleError(_0x3c16d0,_0x2257e1){_0x2257e1=_0x2257e1||0x1f4;return function(_0x4aaa3d){logger[_0x563a('0x2f')](_0x4aaa3d[_0x563a('0x30')]);if(_0x4aaa3d[_0x563a('0x31')]){delete _0x4aaa3d[_0x563a('0x31')];}_0x3c16d0[_0x563a('0x1f')](_0x2257e1)[_0x563a('0x32')](_0x4aaa3d);};}exports[_0x563a('0x33')]=function(_0x4a2d28,_0x2418ae){var _0x24ec9d={},_0x4259f6={},_0x2ea6c2={'count':0x0,'rows':[]};var _0x1a77b8=_['map'](db['VoicePrefix']['rawAttributes'],function(_0x4e5c46){return{'name':_0x4e5c46[_0x563a('0x34')],'type':_0x4e5c46[_0x563a('0x35')][_0x563a('0x36')]};});_0x4259f6[_0x563a('0x37')]=_[_0x563a('0x38')](_0x1a77b8,_0x563a('0x31'));_0x4259f6['query']=_['keys'](_0x4a2d28[_0x563a('0x39')]);_0x4259f6[_0x563a('0x3a')]=_[_0x563a('0x3b')](_0x4259f6[_0x563a('0x37')],_0x4259f6[_0x563a('0x39')]);_0x24ec9d[_0x563a('0x3c')]=_[_0x563a('0x3b')](_0x4259f6[_0x563a('0x37')],qs[_0x563a('0x3d')](_0x4a2d28[_0x563a('0x39')][_0x563a('0x3d')]));_0x24ec9d[_0x563a('0x3c')]=_0x24ec9d[_0x563a('0x3c')][_0x563a('0x3e')]?_0x24ec9d[_0x563a('0x3c')]:_0x4259f6[_0x563a('0x37')];if(!_0x4a2d28['query'][_0x563a('0x3f')](_0x563a('0x40'))){_0x24ec9d[_0x563a('0x41')]=qs['limit'](_0x4a2d28[_0x563a('0x39')]['limit']);_0x24ec9d[_0x563a('0x21')]=qs[_0x563a('0x21')](_0x4a2d28['query']['offset']);}_0x24ec9d[_0x563a('0x42')]=qs['sort'](_0x4a2d28[_0x563a('0x39')][_0x563a('0x43')]);_0x24ec9d[_0x563a('0x44')]=qs[_0x563a('0x3a')](_['pick'](_0x4a2d28['query'],_0x4259f6[_0x563a('0x3a')]),_0x1a77b8);if(_0x4a2d28['query'][_0x563a('0x45')]){_0x24ec9d[_0x563a('0x44')]=_[_0x563a('0x46')](_0x24ec9d[_0x563a('0x44')],{'$or':_[_0x563a('0x38')](_0x1a77b8,function(_0x38fab5){if(_0x38fab5[_0x563a('0x35')]!==_0x563a('0x47')){var _0x4c71df={};_0x4c71df[_0x38fab5[_0x563a('0x31')]]={'$like':'%'+_0x4a2d28['query'][_0x563a('0x45')]+'%'};return _0x4c71df;}})});}_0x24ec9d=_[_0x563a('0x46')]({},_0x24ec9d,_0x4a2d28[_0x563a('0x48')]);var _0x2d3800={'where':_0x24ec9d['where']};return db['VoicePrefix']['count'](_0x2d3800)[_0x563a('0x29')](function(_0x1255da){_0x2ea6c2[_0x563a('0x23')]=_0x1255da;if(_0x4a2d28[_0x563a('0x39')][_0x563a('0x49')]){_0x24ec9d[_0x563a('0x4a')]=[{'all':!![]}];}return db[_0x563a('0x4b')][_0x563a('0x4c')](_0x24ec9d);})[_0x563a('0x29')](function(_0x433353){_0x2ea6c2[_0x563a('0x4d')]=_0x433353;return _0x2ea6c2;})[_0x563a('0x29')](respondWithFilteredResult(_0x2418ae,_0x24ec9d))[_0x563a('0x4e')](handleError(_0x2418ae,null));};exports[_0x563a('0x4f')]=function(_0x144e15,_0x456d27){var _0x4643c4={'raw':![],'where':{'id':_0x144e15[_0x563a('0x50')]['id']}},_0x21bafb={};_0x21bafb['model']=_['keys'](db[_0x563a('0x4b')][_0x563a('0x51')]);_0x21bafb[_0x563a('0x39')]=_[_0x563a('0x52')](_0x144e15[_0x563a('0x39')]);_0x21bafb[_0x563a('0x3a')]=_[_0x563a('0x3b')](_0x21bafb[_0x563a('0x37')],_0x21bafb['query']);_0x4643c4['attributes']=_[_0x563a('0x3b')](_0x21bafb[_0x563a('0x37')],qs[_0x563a('0x3d')](_0x144e15[_0x563a('0x39')][_0x563a('0x3d')]));_0x4643c4[_0x563a('0x3c')]=_0x4643c4[_0x563a('0x3c')][_0x563a('0x3e')]?_0x4643c4['attributes']:_0x21bafb[_0x563a('0x37')];if(_0x144e15[_0x563a('0x39')]['includeAll']){_0x4643c4[_0x563a('0x4a')]=[{'all':!![]}];}_0x4643c4=_['merge']({},_0x4643c4,_0x144e15[_0x563a('0x48')]);return db[_0x563a('0x4b')][_0x563a('0x53')](_0x4643c4)['then'](handleEntityNotFound(_0x456d27,null))[_0x563a('0x29')](respondWithResult(_0x456d27,null))[_0x563a('0x4e')](handleError(_0x456d27,null));};exports[_0x563a('0x2a')]=function(_0x39c104,_0x6fe8a9){return db[_0x563a('0x4b')][_0x563a('0x53')]({'where':{'id':_0x39c104[_0x563a('0x50')]['id']}})[_0x563a('0x29')](handleEntityNotFound(_0x6fe8a9,null))[_0x563a('0x29')](removeEntity(_0x6fe8a9,null))[_0x563a('0x4e')](handleError(_0x6fe8a9,null));};exports[_0x563a('0x54')]=function(_0x406d4a,_0x497469){return db['VoicePrefix'][_0x563a('0x54')]()[_0x563a('0x29')](respondWithResult(_0x497469,null))[_0x563a('0x4e')](handleError(_0x497469,null));};exports['create']=function(_0x5ae08f,_0x13530f){var _0x1fc4d2;return db['sequelize']['transaction'](function(_0x51e142){return db[_0x563a('0x4b')][_0x563a('0x55')](_0x5ae08f[_0x563a('0x56')],{'transaction':_0x51e142})[_0x563a('0x29')](function(_0x8d3997){_0x1fc4d2=_0x8d3997[_0x563a('0x2b')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x1fc4d2[_0x563a('0x57')]},'raw':!![]})['then'](function(_0x4453b2){return createVoicePrefixExtensions(_0x1fc4d2,_0x4453b2,_0x51e142);});});})[_0x563a('0x29')](function(){var _0x3e993e=_0x5ae08f[_0x563a('0x58')][_0x563a('0x2b')]({'plain':!![]});if(!_0x3e993e)throw new Error(_0x563a('0x59'));if(_0x3e993e[_0x563a('0x5a')]==='user'){var _0x22cc91=_0x1fc4d2;return db[_0x563a('0x5b')]['find']({'where':{'name':_0x563a('0x2c'),'userProfileId':_0x3e993e[_0x563a('0x5c')]},'raw':!![]})[_0x563a('0x29')](function(_0x2afa8c){if(_0x2afa8c&&_0x2afa8c[_0x563a('0x5d')]===0x0){return db[_0x563a('0x2d')][_0x563a('0x55')]({'name':_0x22cc91[_0x563a('0x31')],'resourceId':_0x22cc91['id'],'type':_0x2afa8c[_0x563a('0x31')],'sectionId':_0x2afa8c['id']},{})[_0x563a('0x29')](function(){return _0x1fc4d2;});}else{return _0x1fc4d2;}})['catch'](function(_0x1926f1){logger[_0x563a('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1926f1);throw _0x1926f1;});}return _0x1fc4d2;})['then'](respondWithResult(_0x13530f,null))[_0x563a('0x4e')](handleError(_0x13530f,null));};function Extension(_0x709bfd,_0x579d61,_0x19edc3,_0x59e371){this[_0x563a('0x5e')]=_0x563a('0x5f');this[_0x563a('0x60')]=_0x709bfd;this[_0x563a('0x61')]=_0x19edc3;this[_0x563a('0x35')]='system';this['description']='Voice\x20Prefix\x20Extension';this['priority']=_0x579d61;this[_0x563a('0x62')]=_0x59e371;}function createVoicePrefixExtensions(_0x5141d5,_0x111444,_0x496b6a){return new BPromise(function(_0x2a82cf,_0x3f2750){var _0xbe3343=new Extension(formatPrefixName(_0x5141d5[_0x563a('0x63')]),0x1,_0x563a('0x64'),'Voice\x20Prefix');_0xbe3343[_0x563a('0x65')]=_0x5141d5['id'];return db['VoiceExtension']['create'](_0xbe3343,{'transaction':_0x496b6a})[_0x563a('0x29')](function(_0x3b7993){var _0x409f3c=_0x3b7993[_0x563a('0x2b')]({'plain':!![]});var _0x1c8ad7=_['map'](addVoicePrefixExtensions(_0x5141d5,_0x111444),function(_0x10eb03){_0x10eb03[_0x563a('0x57')]=_0x409f3c['id'];_0x10eb03[_0x563a('0x65')]=_0x5141d5['id'];return _0x10eb03;});return db[_0x563a('0x66')][_0x563a('0x67')](_0x1c8ad7,{'transaction':_0x496b6a})['then'](function(_0xac578c){if(!_0xac578c){return _0x3f2750('Extensions\x20creation\x20failed');}else{return _0x2a82cf(_0xac578c);}})[_0x563a('0x4e')](function(_0x201c9d){return _0x3f2750(_0x201c9d);});});;});};function addVoicePrefixExtensions(_0x47d6cd,_0x34dd59){var _0x30bf2b=[];var _0x18a26b=formatPrefixName(_0x47d6cd[_0x563a('0x63')]);_0x30bf2b[_0x563a('0x68')](new Extension(_0x18a26b,0x2,_0x563a('0x69'),_0x563a('0x6a')+_0x47d6cd[_0x563a('0x31')]));if(_0x47d6cd['callerIdAll']){_0x30bf2b[_0x563a('0x68')](new Extension(_0x18a26b,0x3,_0x563a('0x69'),_0x563a('0x6b')+_0x47d6cd[_0x563a('0x6c')]));}else{_0x30bf2b[_0x563a('0x68')](new Extension(_0x18a26b,0x3,_0x563a('0x64'),_0x563a('0x6d')));}_0x30bf2b['push'](new Extension(_0x18a26b,0x4,_0x563a('0x6e'),_0x34dd59['context']+','+'${EXTEN:'+(0x8+_0x47d6cd['name'][_0x563a('0x3e')])+'}'+','+0x1));return _0x30bf2b;}function formatPrefixName(_0x4e4e60){var _0x529587='_';for(var _0x30d775=0x0;_0x30d775<_0x4e4e60[_0x563a('0x3e')];_0x30d775++){if(_0x4e4e60[_0x563a('0x6f')](_0x30d775)=='-'){_0x529587+=_0x4e4e60[_0x563a('0x6f')](_0x30d775);}else{_0x529587+='['+_0x4e4e60[_0x563a('0x6f')](_0x30d775)+']';}}_0x529587+='.';return _0x529587;}exports['update']=function(_0x4814b3,_0x4c9ad7,_0x39b8f8){var _0x8b2e10=_0x4814b3[_0x563a('0x56')];_0x8b2e10[_0x563a('0x63')]=_0x563a('0x70')+_0x8b2e10[_0x563a('0x31')]+'-';return db['sequelize'][_0x563a('0x71')](function(_0x43b2f1){return db['VoicePrefix'][_0x563a('0x28')](_0x8b2e10,{'where':{'id':_0x8b2e10['id']},'transaction':_0x43b2f1})[_0x563a('0x29')](function(){return db[_0x563a('0x66')]['destroy']({'where':{'VoicePrefixId':_0x8b2e10['id']},'transaction':_0x43b2f1})[_0x563a('0x29')](function(){return db[_0x563a('0x66')][_0x563a('0x53')]({'where':{'id':_0x8b2e10[_0x563a('0x57')]},'raw':!![]})['then'](function(_0x229690){return createVoicePrefixExtensions(_0x8b2e10,_0x229690,_0x43b2f1);});});});})[_0x563a('0x29')](function(){return db[_0x563a('0x4b')][_0x563a('0x72')](_0x8b2e10['id']);})[_0x563a('0x29')](respondWithResult(_0x4c9ad7,null))['catch'](handleError(_0x4c9ad7,null));};exports['addAgents']=function(_0x4346fe,_0x598a91,_0x46beba){return db[_0x563a('0x4b')][_0x563a('0x53')]({'where':{'id':_0x4346fe[_0x563a('0x50')]['id']}})[_0x563a('0x29')](handleEntityNotFound(_0x598a91,null))[_0x563a('0x29')](function(_0x3f66be){if(_0x3f66be){return _0x3f66be[_0x563a('0x73')](_0x4346fe[_0x563a('0x56')][_0x563a('0x74')],_['omit'](_0x4346fe[_0x563a('0x56')],['ids','id'])||{})[_0x563a('0x75')](function(_0x441933){for(var _0x54c512=0x0;_0x54c512<_0x4346fe[_0x563a('0x56')]['ids'][_0x563a('0x3e')];_0x54c512+=0x1){socket[_0x563a('0x76')]('userVoicePrefix:save',{'UserId':Number(_0x4346fe[_0x563a('0x56')][_0x563a('0x74')][_0x54c512]),'VoicePrefixId':Number(_0x4346fe[_0x563a('0x50')]['id'])});}return _0x441933;});}})[_0x563a('0x29')](respondWithResult(_0x598a91,null))['catch'](handleError(_0x598a91,null));};exports[_0x563a('0x77')]=function(_0x31faef,_0x17000b,_0x3cdfc1){return db[_0x563a('0x4b')][_0x563a('0x53')]({'where':{'id':_0x31faef[_0x563a('0x50')]['id']}})[_0x563a('0x29')](handleEntityNotFound(_0x17000b,null))[_0x563a('0x29')](function(_0x238ae4){if(_0x238ae4){return _0x238ae4['removeAgents'](_0x31faef[_0x563a('0x39')][_0x563a('0x74')])[_0x563a('0x29')](function(){if(_['isArray'](_0x31faef[_0x563a('0x39')][_0x563a('0x74')])){for(var _0x3dc800=0x0;_0x3dc800<_0x31faef[_0x563a('0x39')][_0x563a('0x74')][_0x563a('0x3e')];_0x3dc800+=0x1){socket[_0x563a('0x76')](_0x563a('0x78'),{'UserId':Number(_0x31faef[_0x563a('0x39')][_0x563a('0x74')][_0x3dc800]),'VoicePrefixId':Number(_0x31faef[_0x563a('0x50')]['id'])});}}else{socket[_0x563a('0x76')](_0x563a('0x78'),{'UserId':Number(_0x31faef['query'][_0x563a('0x74')]),'VoicePrefixId':Number(_0x31faef[_0x563a('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x17000b,null))[_0x563a('0x4e')](handleError(_0x17000b,null));};exports[_0x563a('0x79')]=function(_0x1ecca5,_0x162ab6,_0xf3ed04){var _0x44cbb4={};var _0x3a00b8={};var _0x9b753b;var _0x41898f;return db['VoicePrefix'][_0x563a('0x7a')]({'where':{'id':_0x1ecca5[_0x563a('0x50')]['id']}})[_0x563a('0x29')](handleEntityNotFound(_0x162ab6,null))[_0x563a('0x29')](function(_0x4c5547){if(_0x4c5547){_0x9b753b=_0x4c5547;_0x3a00b8['model']=_['keys'](db[_0x563a('0x7b')][_0x563a('0x51')]);_0x3a00b8[_0x563a('0x39')]=_[_0x563a('0x52')](_0x1ecca5[_0x563a('0x39')]);_0x3a00b8[_0x563a('0x3a')]=_[_0x563a('0x3b')](_0x3a00b8[_0x563a('0x37')],_0x3a00b8[_0x563a('0x39')]);_0x44cbb4[_0x563a('0x3c')]=_['intersection'](_0x3a00b8[_0x563a('0x37')],qs[_0x563a('0x3d')](_0x1ecca5[_0x563a('0x39')][_0x563a('0x3d')]));_0x44cbb4[_0x563a('0x3c')]=_0x44cbb4[_0x563a('0x3c')][_0x563a('0x3e')]?_0x44cbb4[_0x563a('0x3c')]:_0x3a00b8[_0x563a('0x37')];_0x44cbb4[_0x563a('0x42')]=qs[_0x563a('0x43')](_0x1ecca5[_0x563a('0x39')][_0x563a('0x43')]);_0x44cbb4['where']=qs[_0x563a('0x3a')](_[_0x563a('0x7c')](_0x1ecca5[_0x563a('0x39')],_0x3a00b8[_0x563a('0x3a')]));if(_0x1ecca5[_0x563a('0x39')][_0x563a('0x45')]){_0x44cbb4[_0x563a('0x44')]=_['merge'](_0x44cbb4[_0x563a('0x44')],{'$or':_[_0x563a('0x38')](_0x44cbb4[_0x563a('0x3c')],function(_0x562120){var _0x1e3b8c={};_0x1e3b8c[_0x562120]={'$like':'%'+_0x1ecca5[_0x563a('0x39')][_0x563a('0x45')]+'%'};return _0x1e3b8c;})});}_0x44cbb4=_[_0x563a('0x46')]({},_0x44cbb4,_0x1ecca5[_0x563a('0x48')]);return _0x9b753b[_0x563a('0x79')](_0x44cbb4);}})['then'](function(_0x2d46f5){if(_0x2d46f5){_0x41898f=_0x2d46f5[_0x563a('0x3e')];if(!_0x1ecca5[_0x563a('0x39')][_0x563a('0x3f')](_0x563a('0x40'))){_0x44cbb4['limit']=qs[_0x563a('0x41')](_0x1ecca5[_0x563a('0x39')][_0x563a('0x41')]);_0x44cbb4[_0x563a('0x21')]=qs['offset'](_0x1ecca5[_0x563a('0x39')][_0x563a('0x21')]);}return _0x9b753b['getAgents'](_0x44cbb4);}})['then'](function(_0x458a21){if(_0x458a21){return _0x458a21?{'count':_0x41898f,'rows':_0x458a21}:null;}})[_0x563a('0x29')](respondWithResult(_0x162ab6,null))[_0x563a('0x4e')](handleError(_0x162ab6,null));};exports[_0x563a('0x7d')]=function(_0x241361,_0x31a58e,_0x1e324a){var _0x38857b={};var _0x43b6a2={};var _0x2385eb;var _0x36fe22;return db['VoicePrefix'][_0x563a('0x7a')]({'where':{'id':_0x241361[_0x563a('0x50')]['id']}})[_0x563a('0x29')](handleEntityNotFound(_0x31a58e,null))['then'](function(_0x1dc77d){if(_0x1dc77d){_0x2385eb=_0x1dc77d;_0x43b6a2[_0x563a('0x37')]=_['keys'](db[_0x563a('0x7e')][_0x563a('0x51')]);_0x43b6a2[_0x563a('0x39')]=_[_0x563a('0x52')](_0x241361[_0x563a('0x39')]);_0x43b6a2[_0x563a('0x3a')]=_[_0x563a('0x3b')](_0x43b6a2[_0x563a('0x37')],_0x43b6a2['query']);_0x38857b[_0x563a('0x3c')]=_[_0x563a('0x3b')](_0x43b6a2[_0x563a('0x37')],qs[_0x563a('0x3d')](_0x241361[_0x563a('0x39')]['fields']));_0x38857b[_0x563a('0x3c')]=_0x38857b['attributes']['length']?_0x38857b[_0x563a('0x3c')]:_0x43b6a2[_0x563a('0x37')];_0x38857b[_0x563a('0x42')]=qs[_0x563a('0x43')](_0x241361['query'][_0x563a('0x43')]);_0x38857b[_0x563a('0x44')]=qs['filters'](_[_0x563a('0x7c')](_0x241361['query'],_0x43b6a2[_0x563a('0x3a')]));if(_0x241361[_0x563a('0x39')][_0x563a('0x45')]){_0x38857b[_0x563a('0x44')]=_[_0x563a('0x46')](_0x38857b[_0x563a('0x44')],{'$or':_[_0x563a('0x38')](_0x38857b[_0x563a('0x3c')],function(_0x372e43){var _0x484953={};_0x484953[_0x372e43]={'$like':'%'+_0x241361[_0x563a('0x39')]['filter']+'%'};return _0x484953;})});}_0x38857b=_['merge']({},_0x38857b,_0x241361[_0x563a('0x48')]);return _0x2385eb[_0x563a('0x7d')](_0x38857b);}})['then'](function(_0x44859c){if(_0x44859c){_0x36fe22=_0x44859c[_0x563a('0x3e')];if(!_0x241361[_0x563a('0x39')][_0x563a('0x3f')](_0x563a('0x40'))){_0x38857b[_0x563a('0x41')]=qs[_0x563a('0x41')](_0x241361[_0x563a('0x39')]['limit']);_0x38857b[_0x563a('0x21')]=qs[_0x563a('0x21')](_0x241361['query'][_0x563a('0x21')]);}return _0x2385eb[_0x563a('0x7d')](_0x38857b);}})['then'](function(_0x38601a){if(_0x38601a){return _0x38601a?{'count':_0x36fe22,'rows':_0x38601a}:null;}})[_0x563a('0x29')](respondWithResult(_0x31a58e,null))[_0x563a('0x4e')](handleError(_0x31a58e,null));};exports['addTeams']=function(_0x10c81e,_0x4928de,_0x95bb77){var _0x33d74b=_0x10c81e[_0x563a('0x56')]['ids'];var _0x2d9810;return db['Team'][_0x563a('0x4c')]({'where':{'id':_0x33d74b},'attributes':['id'],'include':[{'model':db['User'],'as':_0x563a('0x7f'),'attributes':['id',_0x563a('0x31'),_0x563a('0x80'),_0x563a('0x81'),_0x563a('0x82')],'raw':!![]}]})[_0x563a('0x29')](function(_0x2d2cb9){if(_0x2d2cb9){_0x2d9810=_0x2d2cb9;var _0x2c4b52=_[_0x563a('0x83')](_0x2d2cb9,function(_0x5c8df5){var _0x579601=_0x5c8df5[_0x563a('0x2b')]({'plain':!![]});return _0x579601[_0x563a('0x7f')];});return db['VoicePrefix'][_0x563a('0x53')]({'where':{'id':_0x10c81e[_0x563a('0x50')]['id']}})[_0x563a('0x29')](function(_0x1ebdd0){return db[_0x563a('0x84')][_0x563a('0x71')](function(_0x2a3bdd){return _0x1ebdd0['addTeams'](_0x33d74b,{'transaction':_0x2a3bdd})[_0x563a('0x29')](function(){return BPromise[_0x563a('0x85')](_0x2d9810,function(_0x28bbe5){return db[_0x563a('0x86')]['upsert']({'TeamId':_0x28bbe5['id'],'VoicePrefixId':_0x10c81e[_0x563a('0x50')]['id']},{'transaction':_0x2a3bdd});});})[_0x563a('0x29')](function(){return BPromise[_0x563a('0x85')](_0x2c4b52,function(_0x150fd6){return db[_0x563a('0x87')][_0x563a('0x88')]({'where':{'UserId':_0x150fd6['id'],'VoicePrefixId':_0x10c81e[_0x563a('0x50')]['id']},'transaction':_0x2a3bdd});});})[_0x563a('0x29')](function(){_0x2c4b52[_0x563a('0x89')](function(_0x3f78b7){socket[_0x563a('0x76')](_0x563a('0x8a'),{'UserId':_0x3f78b7['id'],'VoicePrefixId':_0x1ebdd0['id']});});});});});}})[_0x563a('0x29')](respondWithStatusCode(_0x4928de,null))[_0x563a('0x4e')](handleError(_0x4928de,null));};exports[_0x563a('0x8b')]=function(_0x115188,_0x713637,_0x12bb1b){return db[_0x563a('0x7e')][_0x563a('0x4c')]({'where':{'id':_0x115188[_0x563a('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0x563a('0x7b')],'as':_0x563a('0x7f'),'attributes':['id'],'raw':!![]}]})[_0x563a('0x29')](handleEntityNotFound(_0x713637,null))[_0x563a('0x29')](function(_0xb9cbc9){var _0x42831f=_[_0x563a('0x38')](_0xb9cbc9,'id');var _0x5385e0=[];var _0x1d0ed4=[];var _0x14bc9e=squel[_0x563a('0x8c')]();_0x14bc9e[_0x563a('0x8d')](_0x563a('0x8e'))['from'](_0x563a('0x8f'),'tq')['join'](_0x563a('0x90'),'ut',_0x563a('0x91'))[_0x563a('0x44')]('VoicePrefixId\x20=\x20?',_0x115188[_0x563a('0x50')]['id']);for(var _0x25e5d1=0x0;_0x25e5d1<_0xb9cbc9[_0x563a('0x3e')];_0x25e5d1+=0x1){let _0x5ba698=_0xb9cbc9[_0x25e5d1];for(var _0x2dadc1=0x0;_0x2dadc1<_0x5ba698[_0x563a('0x7f')]['length'];_0x2dadc1+=0x1){let _0x55f64e=_0x5ba698[_0x563a('0x7f')][_0x2dadc1];var _0x41d0df=_0x14bc9e['clone']();_0x41d0df['where'](_0x563a('0x92'),_0x55f64e['id']);_0x1d0ed4['push'](db[_0x563a('0x84')][_0x563a('0x39')](_0x41d0df[_0x563a('0x93')](),{'type':db[_0x563a('0x84')][_0x563a('0x94')][_0x563a('0x95')]})[_0x563a('0x29')](function(_0xc24817){if(_0xc24817[_0x563a('0x3e')]===0x1){return _0x55f64e['id'];}else{var _0xd04cd=_[_0x563a('0x96')](_['map'](_0xc24817,'TeamId'),function(_0x571a84){return _[_0x563a('0x97')](_0x42831f,_0x571a84);});if(_0xd04cd){return _0x55f64e['id'];}}}));}}return BPromise[_0x563a('0x98')](_0x1d0ed4)[_0x563a('0x29')](function(_0x5244e5){_0x5385e0=_(_0x5385e0)['union'](_0x5244e5)[_0x563a('0x99')]()[_0x563a('0x9a')]();return db[_0x563a('0x4b')][_0x563a('0x53')]({'where':{'id':_0x115188[_0x563a('0x50')]['id']}})[_0x563a('0x29')](function(_0x23e33f){return db['sequelize'][_0x563a('0x71')](function(_0x25049d){return _0x23e33f[_0x563a('0x8b')](_0x115188[_0x563a('0x39')][_0x563a('0x74')],{'transaction':_0x25049d})[_0x563a('0x29')](function(){if(!_[_0x563a('0x9b')](_0x5385e0)){return _0x23e33f[_0x563a('0x77')](_0x5385e0,{'transaction':_0x25049d});}})[_0x563a('0x29')](function(){_0x5385e0[_0x563a('0x89')](function(_0x482d21){socket[_0x563a('0x76')]('userVoicePrefix:remove',{'UserId':_0x482d21,'VoicePrefixId':_0x23e33f['id']});});});});});});})[_0x563a('0x29')](respondWithStatusCode(_0x713637,null))[_0x563a('0x4e')](handleError(_0x713637,null));}; \ No newline at end of file +var _0x36ee=['show','params','find','describe','create','sequelize','transaction','get','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','Voice\x20Prefix','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','charAt','body','findById','addAgents','spread','ids','userVoicePrefix:save','removeAgents','emit','userVoicePrefix:remove','getAgents','User','nolimit','getTeams','findOne','Team','findAll','Agents','voicePause','interface','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','field','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','includes','all','forEach','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','update','then','destroy','UserProfileResource','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch'];(function(_0x1eda65,_0x13d2d7){var _0x57d5ad=function(_0xc731b2){while(--_0xc731b2){_0x1eda65['push'](_0x1eda65['shift']());}};_0x57d5ad(++_0x13d2d7);}(_0x36ee,0xe8));var _0xe36e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x36ee[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe36e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe36e('0x1'));var moment=require(_0xe36e('0x2'));var BPromise=require(_0xe36e('0x3'));var Mustache=require(_0xe36e('0x4'));var util=require(_0xe36e('0x5'));var path=require(_0xe36e('0x6'));var sox=require(_0xe36e('0x7'));var csv=require(_0xe36e('0x8'));var ejs=require(_0xe36e('0x9'));var fs=require('fs');var fs_extra=require(_0xe36e('0xa'));var _=require(_0xe36e('0xb'));var squel=require(_0xe36e('0xc'));var crypto=require('crypto');var jsforce=require(_0xe36e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe36e('0x8'));var querystring=require(_0xe36e('0xe'));var Papa=require(_0xe36e('0xf'));var Redis=require('ioredis');var authService=require(_0xe36e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe36e('0x11'));var hardwareService=require(_0xe36e('0x12'));var logger=require(_0xe36e('0x13'))(_0xe36e('0x14'));var utils=require(_0xe36e('0x15'));var config=require(_0xe36e('0x16'));var licenseUtil=require(_0xe36e('0x17'));var db=require(_0xe36e('0x18'))['db'];config['redis']=_[_0xe36e('0x19')](config[_0xe36e('0x1a')],{'host':_0xe36e('0x1b'),'port':0x18eb});var socket=require(_0xe36e('0x1c'))(new Redis(config['redis']));require(_0xe36e('0x1d'))['register'](socket);function respondWithStatusCode(_0x525155,_0x27ff47){_0x27ff47=_0x27ff47||0xcc;return function(_0x300f21){if(_0x300f21){return _0x525155[_0xe36e('0x1e')](_0x27ff47);}return _0x525155[_0xe36e('0x1f')](_0x27ff47)[_0xe36e('0x20')]();};}function respondWithResult(_0x924cd5,_0x2096f6){_0x2096f6=_0x2096f6||0xc8;return function(_0x39bae8){if(_0x39bae8){return _0x924cd5[_0xe36e('0x1f')](_0x2096f6)[_0xe36e('0x21')](_0x39bae8);}};}function respondWithFilteredResult(_0x5792e8,_0x333554){return function(_0x2184ae){if(_0x2184ae){var _0x56c019=typeof _0x333554[_0xe36e('0x22')]==='undefined'&&typeof _0x333554[_0xe36e('0x23')]===_0xe36e('0x24');var _0x5e15f5=_0x2184ae[_0xe36e('0x25')];var _0x6aa186=_0x56c019?0x0:_0x333554[_0xe36e('0x22')];var _0x597331=_0x56c019?_0x2184ae[_0xe36e('0x25')]:_0x333554[_0xe36e('0x22')]+_0x333554[_0xe36e('0x23')];var _0x3c4017;if(_0x597331>=_0x5e15f5){_0x597331=_0x5e15f5;_0x3c4017=0xc8;}else{_0x3c4017=0xce;}_0x5792e8[_0xe36e('0x1f')](_0x3c4017);return _0x5792e8[_0xe36e('0x26')]('Content-Range',_0x6aa186+'-'+_0x597331+'/'+_0x5e15f5)[_0xe36e('0x21')](_0x2184ae);}return null;};}function patchUpdates(_0x4f214a){return function(_0x23bcf3){try{jsonpatch[_0xe36e('0x27')](_0x23bcf3,_0x4f214a,!![]);}catch(_0x437f3f){return BPromise['reject'](_0x437f3f);}return _0x23bcf3['save']();};}function saveUpdates(_0x4749a8,_0x10818d){return function(_0xb0cd85){if(_0xb0cd85){return _0xb0cd85[_0xe36e('0x28')](_0x4749a8)[_0xe36e('0x29')](function(_0x1507f9){return _0x1507f9;});}return null;};}function removeEntity(_0x1a045c,_0x5ac484){return function(_0x3cafbf){if(_0x3cafbf){return _0x3cafbf[_0xe36e('0x2a')]()[_0xe36e('0x29')](function(){var _0x262caa=_0x3cafbf['get']({'plain':!![]});var _0x2d757c='VoicePrefixes';return db[_0xe36e('0x2b')]['destroy']({'where':{'type':_0x2d757c,'resourceId':_0x262caa['id']}})[_0xe36e('0x29')](function(){return _0x3cafbf;});})['then'](function(){_0x1a045c[_0xe36e('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b1045,_0x59548b){return function(_0x4bb75b){if(!_0x4bb75b){_0x3b1045['sendStatus'](0x194);}return _0x4bb75b;};}function handleError(_0x5b5d53,_0x203fa2){_0x203fa2=_0x203fa2||0x1f4;return function(_0x1fc639){logger['error'](_0x1fc639['stack']);if(_0x1fc639[_0xe36e('0x2c')]){delete _0x1fc639[_0xe36e('0x2c')];}_0x5b5d53[_0xe36e('0x1f')](_0x203fa2)[_0xe36e('0x2d')](_0x1fc639);};}exports[_0xe36e('0x2e')]=function(_0x4759b4,_0x57bb9b){var _0xb98e78={},_0x11c95d={},_0x57272f={'count':0x0,'rows':[]};var _0x87e595=_[_0xe36e('0x2f')](db[_0xe36e('0x30')][_0xe36e('0x31')],function(_0x21623e){return{'name':_0x21623e[_0xe36e('0x32')],'type':_0x21623e[_0xe36e('0x33')][_0xe36e('0x34')]};});_0x11c95d[_0xe36e('0x35')]=_[_0xe36e('0x2f')](_0x87e595,_0xe36e('0x2c'));_0x11c95d['query']=_[_0xe36e('0x36')](_0x4759b4['query']);_0x11c95d['filters']=_[_0xe36e('0x37')](_0x11c95d['model'],_0x11c95d[_0xe36e('0x38')]);_0xb98e78[_0xe36e('0x39')]=_[_0xe36e('0x37')](_0x11c95d[_0xe36e('0x35')],qs['fields'](_0x4759b4['query'][_0xe36e('0x3a')]));_0xb98e78[_0xe36e('0x39')]=_0xb98e78[_0xe36e('0x39')][_0xe36e('0x3b')]?_0xb98e78['attributes']:_0x11c95d[_0xe36e('0x35')];if(!_0x4759b4[_0xe36e('0x38')][_0xe36e('0x3c')]('nolimit')){_0xb98e78[_0xe36e('0x23')]=qs[_0xe36e('0x23')](_0x4759b4['query'][_0xe36e('0x23')]);_0xb98e78[_0xe36e('0x22')]=qs[_0xe36e('0x22')](_0x4759b4[_0xe36e('0x38')][_0xe36e('0x22')]);}_0xb98e78[_0xe36e('0x3d')]=qs[_0xe36e('0x3e')](_0x4759b4[_0xe36e('0x38')][_0xe36e('0x3e')]);_0xb98e78[_0xe36e('0x3f')]=qs[_0xe36e('0x40')](_[_0xe36e('0x41')](_0x4759b4[_0xe36e('0x38')],_0x11c95d['filters']),_0x87e595);if(_0x4759b4[_0xe36e('0x38')][_0xe36e('0x42')]){_0xb98e78[_0xe36e('0x3f')]=_[_0xe36e('0x43')](_0xb98e78[_0xe36e('0x3f')],{'$or':_['map'](_0x87e595,function(_0x591e33){if(_0x591e33[_0xe36e('0x33')]!==_0xe36e('0x44')){var _0x1acc12={};_0x1acc12[_0x591e33[_0xe36e('0x2c')]]={'$like':'%'+_0x4759b4[_0xe36e('0x38')][_0xe36e('0x42')]+'%'};return _0x1acc12;}})});}_0xb98e78=_[_0xe36e('0x43')]({},_0xb98e78,_0x4759b4[_0xe36e('0x45')]);var _0x48066c={'where':_0xb98e78[_0xe36e('0x3f')]};return db[_0xe36e('0x30')]['count'](_0x48066c)[_0xe36e('0x29')](function(_0x5ef3e4){_0x57272f[_0xe36e('0x25')]=_0x5ef3e4;if(_0x4759b4[_0xe36e('0x38')][_0xe36e('0x46')]){_0xb98e78[_0xe36e('0x47')]=[{'all':!![]}];}return db[_0xe36e('0x30')]['findAll'](_0xb98e78);})[_0xe36e('0x29')](function(_0x2961c9){_0x57272f[_0xe36e('0x48')]=_0x2961c9;return _0x57272f;})[_0xe36e('0x29')](respondWithFilteredResult(_0x57bb9b,_0xb98e78))[_0xe36e('0x49')](handleError(_0x57bb9b,null));};exports[_0xe36e('0x4a')]=function(_0x569809,_0x122704){var _0x134d71={'raw':![],'where':{'id':_0x569809[_0xe36e('0x4b')]['id']}},_0x2a6817={};_0x2a6817[_0xe36e('0x35')]=_['keys'](db[_0xe36e('0x30')][_0xe36e('0x31')]);_0x2a6817[_0xe36e('0x38')]=_[_0xe36e('0x36')](_0x569809[_0xe36e('0x38')]);_0x2a6817[_0xe36e('0x40')]=_[_0xe36e('0x37')](_0x2a6817[_0xe36e('0x35')],_0x2a6817[_0xe36e('0x38')]);_0x134d71['attributes']=_['intersection'](_0x2a6817[_0xe36e('0x35')],qs['fields'](_0x569809[_0xe36e('0x38')][_0xe36e('0x3a')]));_0x134d71[_0xe36e('0x39')]=_0x134d71[_0xe36e('0x39')]['length']?_0x134d71[_0xe36e('0x39')]:_0x2a6817[_0xe36e('0x35')];if(_0x569809['query'][_0xe36e('0x46')]){_0x134d71[_0xe36e('0x47')]=[{'all':!![]}];}_0x134d71=_[_0xe36e('0x43')]({},_0x134d71,_0x569809[_0xe36e('0x45')]);return db[_0xe36e('0x30')][_0xe36e('0x4c')](_0x134d71)[_0xe36e('0x29')](handleEntityNotFound(_0x122704,null))[_0xe36e('0x29')](respondWithResult(_0x122704,null))[_0xe36e('0x49')](handleError(_0x122704,null));};exports[_0xe36e('0x2a')]=function(_0x7307bc,_0x13ccc5){return db[_0xe36e('0x30')][_0xe36e('0x4c')]({'where':{'id':_0x7307bc[_0xe36e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x13ccc5,null))[_0xe36e('0x29')](removeEntity(_0x13ccc5,null))['catch'](handleError(_0x13ccc5,null));};exports['describe']=function(_0x10b8ff,_0x3e8ccb){return db['VoicePrefix'][_0xe36e('0x4d')]()[_0xe36e('0x29')](respondWithResult(_0x3e8ccb,null))[_0xe36e('0x49')](handleError(_0x3e8ccb,null));};exports[_0xe36e('0x4e')]=function(_0xa4be24,_0x22788b){var _0x935e84;return db[_0xe36e('0x4f')][_0xe36e('0x50')](function(_0x55d190){return db[_0xe36e('0x30')][_0xe36e('0x4e')](_0xa4be24['body'],{'transaction':_0x55d190})[_0xe36e('0x29')](function(_0x1da952){_0x935e84=_0x1da952[_0xe36e('0x51')]({'plain':!![]});return db[_0xe36e('0x52')][_0xe36e('0x4c')]({'where':{'id':_0x935e84['VoiceExtensionId']},'raw':!![]})['then'](function(_0x56f5b6){return createVoicePrefixExtensions(_0x935e84,_0x56f5b6,_0x55d190);});});})['then'](function(){var _0x47605d=_0xa4be24[_0xe36e('0x53')][_0xe36e('0x51')]({'plain':!![]});if(!_0x47605d)throw new Error(_0xe36e('0x54'));if(_0x47605d[_0xe36e('0x55')]===_0xe36e('0x53')){var _0x7c3766=_0x935e84;return db[_0xe36e('0x56')][_0xe36e('0x4c')]({'where':{'name':'VoicePrefixes','userProfileId':_0x47605d[_0xe36e('0x57')]},'raw':!![]})[_0xe36e('0x29')](function(_0x5a058b){if(_0x5a058b&&_0x5a058b[_0xe36e('0x58')]===0x0){return db[_0xe36e('0x2b')][_0xe36e('0x4e')]({'name':_0x7c3766[_0xe36e('0x2c')],'resourceId':_0x7c3766['id'],'type':_0x5a058b[_0xe36e('0x2c')],'sectionId':_0x5a058b['id']},{})[_0xe36e('0x29')](function(){return _0x935e84;});}else{return _0x935e84;}})[_0xe36e('0x49')](function(_0x1a70d1){logger[_0xe36e('0x59')](_0xe36e('0x5a'),_0x1a70d1);throw _0x1a70d1;});}return _0x935e84;})[_0xe36e('0x29')](respondWithResult(_0x22788b,null))[_0xe36e('0x49')](handleError(_0x22788b,null));};function Extension(_0x389e91,_0x6f979f,_0x3512ec,_0x3e4860){this[_0xe36e('0x5b')]=_0xe36e('0x5c');this[_0xe36e('0x5d')]=_0x389e91;this[_0xe36e('0x5e')]=_0x3512ec;this[_0xe36e('0x33')]=_0xe36e('0x5f');this[_0xe36e('0x60')]=_0xe36e('0x61');this[_0xe36e('0x62')]=_0x6f979f;this['appdata']=_0x3e4860;}function createVoicePrefixExtensions(_0x429a01,_0xedaa96,_0x49336b){return new BPromise(function(_0xce5583,_0x41bad0){var _0x180dc3=new Extension(formatPrefixName(_0x429a01[_0xe36e('0x63')]),0x1,_0xe36e('0x64'),_0xe36e('0x65'));_0x180dc3['VoicePrefixId']=_0x429a01['id'];return db[_0xe36e('0x52')]['create'](_0x180dc3,{'transaction':_0x49336b})[_0xe36e('0x29')](function(_0x1fc1e5){var _0x2b0059=_0x1fc1e5[_0xe36e('0x51')]({'plain':!![]});var _0x2a767d=_[_0xe36e('0x2f')](addVoicePrefixExtensions(_0x429a01,_0xedaa96),function(_0x2ab6aa){_0x2ab6aa[_0xe36e('0x66')]=_0x2b0059['id'];_0x2ab6aa['VoicePrefixId']=_0x429a01['id'];return _0x2ab6aa;});return db[_0xe36e('0x52')][_0xe36e('0x67')](_0x2a767d,{'transaction':_0x49336b})['then'](function(_0x3068e1){if(!_0x3068e1){return _0x41bad0(_0xe36e('0x68'));}else{return _0xce5583(_0x3068e1);}})[_0xe36e('0x49')](function(_0x1e8943){return _0x41bad0(_0x1e8943);});});;});};function addVoicePrefixExtensions(_0x30786a,_0x3565cb){var _0x3d4874=[];var _0x48ff05=formatPrefixName(_0x30786a[_0xe36e('0x63')]);_0x3d4874[_0xe36e('0x69')](new Extension(_0x48ff05,0x2,_0xe36e('0x6a'),_0xe36e('0x6b')+_0x30786a[_0xe36e('0x2c')]));if(_0x30786a[_0xe36e('0x6c')]){_0x3d4874[_0xe36e('0x69')](new Extension(_0x48ff05,0x3,_0xe36e('0x6a'),_0xe36e('0x6d')+_0x30786a[_0xe36e('0x6c')]));}else{_0x3d4874[_0xe36e('0x69')](new Extension(_0x48ff05,0x3,'NoOp',_0xe36e('0x6e')));}_0x3d4874[_0xe36e('0x69')](new Extension(_0x48ff05,0x4,_0xe36e('0x6f'),_0x3565cb[_0xe36e('0x5b')]+','+'${EXTEN:'+(0x8+_0x30786a['name'][_0xe36e('0x3b')])+'}'+','+0x1));return _0x3d4874;}function formatPrefixName(_0x55911b){var _0x585bd5='_';for(var _0x59c454=0x0;_0x59c454<_0x55911b[_0xe36e('0x3b')];_0x59c454++){if(_0x55911b['charAt'](_0x59c454)=='-'){_0x585bd5+=_0x55911b[_0xe36e('0x70')](_0x59c454);}else{_0x585bd5+='['+_0x55911b[_0xe36e('0x70')](_0x59c454)+']';}}_0x585bd5+='.';return _0x585bd5;}exports[_0xe36e('0x28')]=function(_0x221a90,_0x1bd60d,_0x46f789){var _0x11e610=_0x221a90[_0xe36e('0x71')];_0x11e610[_0xe36e('0x63')]='system-'+_0x11e610[_0xe36e('0x2c')]+'-';return db['sequelize'][_0xe36e('0x50')](function(_0x517c2a){return db[_0xe36e('0x30')][_0xe36e('0x28')](_0x11e610,{'where':{'id':_0x11e610['id']},'transaction':_0x517c2a})[_0xe36e('0x29')](function(){return db[_0xe36e('0x52')]['destroy']({'where':{'VoicePrefixId':_0x11e610['id']},'transaction':_0x517c2a})['then'](function(){return db[_0xe36e('0x52')][_0xe36e('0x4c')]({'where':{'id':_0x11e610[_0xe36e('0x66')]},'raw':!![]})[_0xe36e('0x29')](function(_0x3be728){return createVoicePrefixExtensions(_0x11e610,_0x3be728,_0x517c2a);});});});})[_0xe36e('0x29')](function(){return db['VoicePrefix'][_0xe36e('0x72')](_0x11e610['id']);})[_0xe36e('0x29')](respondWithResult(_0x1bd60d,null))['catch'](handleError(_0x1bd60d,null));};exports[_0xe36e('0x73')]=function(_0x5eea4f,_0x45ebca,_0x421c28){return db[_0xe36e('0x30')][_0xe36e('0x4c')]({'where':{'id':_0x5eea4f['params']['id']}})[_0xe36e('0x29')](handleEntityNotFound(_0x45ebca,null))['then'](function(_0x49a74b){if(_0x49a74b){return _0x49a74b[_0xe36e('0x73')](_0x5eea4f[_0xe36e('0x71')]['ids'],_['omit'](_0x5eea4f[_0xe36e('0x71')],['ids','id'])||{})[_0xe36e('0x74')](function(_0x36ddc0){for(var _0x2c0ed5=0x0;_0x2c0ed5<_0x5eea4f[_0xe36e('0x71')][_0xe36e('0x75')][_0xe36e('0x3b')];_0x2c0ed5+=0x1){socket['emit'](_0xe36e('0x76'),{'UserId':Number(_0x5eea4f[_0xe36e('0x71')][_0xe36e('0x75')][_0x2c0ed5]),'VoicePrefixId':Number(_0x5eea4f[_0xe36e('0x4b')]['id'])});}return _0x36ddc0;});}})['then'](respondWithResult(_0x45ebca,null))[_0xe36e('0x49')](handleError(_0x45ebca,null));};exports[_0xe36e('0x77')]=function(_0x2eef73,_0x39c9fe,_0x5ee201){return db[_0xe36e('0x30')]['find']({'where':{'id':_0x2eef73[_0xe36e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x39c9fe,null))[_0xe36e('0x29')](function(_0x522968){if(_0x522968){return _0x522968['removeAgents'](_0x2eef73[_0xe36e('0x38')][_0xe36e('0x75')])[_0xe36e('0x29')](function(){if(_['isArray'](_0x2eef73[_0xe36e('0x38')][_0xe36e('0x75')])){for(var _0x48e4f5=0x0;_0x48e4f5<_0x2eef73[_0xe36e('0x38')][_0xe36e('0x75')][_0xe36e('0x3b')];_0x48e4f5+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x2eef73[_0xe36e('0x38')][_0xe36e('0x75')][_0x48e4f5]),'VoicePrefixId':Number(_0x2eef73[_0xe36e('0x4b')]['id'])});}}else{socket[_0xe36e('0x78')](_0xe36e('0x79'),{'UserId':Number(_0x2eef73['query'][_0xe36e('0x75')]),'VoicePrefixId':Number(_0x2eef73[_0xe36e('0x4b')]['id'])});}});}})[_0xe36e('0x29')](respondWithStatusCode(_0x39c9fe,null))[_0xe36e('0x49')](handleError(_0x39c9fe,null));};exports[_0xe36e('0x7a')]=function(_0x5bdeea,_0x3712f6,_0x24fcf8){var _0x188dc9={};var _0x493d0f={};var _0x25e4eb;var _0x499f0a;return db[_0xe36e('0x30')]['findOne']({'where':{'id':_0x5bdeea[_0xe36e('0x4b')]['id']}})[_0xe36e('0x29')](handleEntityNotFound(_0x3712f6,null))['then'](function(_0x463355){if(_0x463355){_0x25e4eb=_0x463355;_0x493d0f['model']=_[_0xe36e('0x36')](db[_0xe36e('0x7b')][_0xe36e('0x31')]);_0x493d0f[_0xe36e('0x38')]=_[_0xe36e('0x36')](_0x5bdeea['query']);_0x493d0f[_0xe36e('0x40')]=_['intersection'](_0x493d0f[_0xe36e('0x35')],_0x493d0f[_0xe36e('0x38')]);_0x188dc9[_0xe36e('0x39')]=_[_0xe36e('0x37')](_0x493d0f[_0xe36e('0x35')],qs[_0xe36e('0x3a')](_0x5bdeea['query'][_0xe36e('0x3a')]));_0x188dc9[_0xe36e('0x39')]=_0x188dc9[_0xe36e('0x39')]['length']?_0x188dc9[_0xe36e('0x39')]:_0x493d0f[_0xe36e('0x35')];_0x188dc9[_0xe36e('0x3d')]=qs[_0xe36e('0x3e')](_0x5bdeea['query'][_0xe36e('0x3e')]);_0x188dc9['where']=qs[_0xe36e('0x40')](_['pick'](_0x5bdeea[_0xe36e('0x38')],_0x493d0f[_0xe36e('0x40')]));if(_0x5bdeea[_0xe36e('0x38')]['filter']){_0x188dc9[_0xe36e('0x3f')]=_[_0xe36e('0x43')](_0x188dc9['where'],{'$or':_[_0xe36e('0x2f')](_0x188dc9[_0xe36e('0x39')],function(_0x1f4dd2){var _0x531eac={};_0x531eac[_0x1f4dd2]={'$like':'%'+_0x5bdeea['query'][_0xe36e('0x42')]+'%'};return _0x531eac;})});}_0x188dc9=_[_0xe36e('0x43')]({},_0x188dc9,_0x5bdeea[_0xe36e('0x45')]);return _0x25e4eb[_0xe36e('0x7a')](_0x188dc9);}})[_0xe36e('0x29')](function(_0x5e62f1){if(_0x5e62f1){_0x499f0a=_0x5e62f1[_0xe36e('0x3b')];if(!_0x5bdeea[_0xe36e('0x38')][_0xe36e('0x3c')](_0xe36e('0x7c'))){_0x188dc9['limit']=qs[_0xe36e('0x23')](_0x5bdeea[_0xe36e('0x38')]['limit']);_0x188dc9['offset']=qs['offset'](_0x5bdeea[_0xe36e('0x38')]['offset']);}return _0x25e4eb['getAgents'](_0x188dc9);}})[_0xe36e('0x29')](function(_0x96f37a){if(_0x96f37a){return _0x96f37a?{'count':_0x499f0a,'rows':_0x96f37a}:null;}})[_0xe36e('0x29')](respondWithResult(_0x3712f6,null))[_0xe36e('0x49')](handleError(_0x3712f6,null));};exports[_0xe36e('0x7d')]=function(_0x378126,_0x48fbed,_0x2ebe8e){var _0x4f9354={};var _0x493692={};var _0x4451ec;var _0x21644d;return db[_0xe36e('0x30')][_0xe36e('0x7e')]({'where':{'id':_0x378126['params']['id']}})[_0xe36e('0x29')](handleEntityNotFound(_0x48fbed,null))[_0xe36e('0x29')](function(_0x23e62d){if(_0x23e62d){_0x4451ec=_0x23e62d;_0x493692[_0xe36e('0x35')]=_['keys'](db[_0xe36e('0x7f')]['rawAttributes']);_0x493692[_0xe36e('0x38')]=_[_0xe36e('0x36')](_0x378126[_0xe36e('0x38')]);_0x493692[_0xe36e('0x40')]=_[_0xe36e('0x37')](_0x493692['model'],_0x493692[_0xe36e('0x38')]);_0x4f9354[_0xe36e('0x39')]=_[_0xe36e('0x37')](_0x493692[_0xe36e('0x35')],qs[_0xe36e('0x3a')](_0x378126[_0xe36e('0x38')][_0xe36e('0x3a')]));_0x4f9354[_0xe36e('0x39')]=_0x4f9354[_0xe36e('0x39')][_0xe36e('0x3b')]?_0x4f9354[_0xe36e('0x39')]:_0x493692[_0xe36e('0x35')];_0x4f9354[_0xe36e('0x3d')]=qs['sort'](_0x378126['query']['sort']);_0x4f9354[_0xe36e('0x3f')]=qs[_0xe36e('0x40')](_[_0xe36e('0x41')](_0x378126[_0xe36e('0x38')],_0x493692['filters']));if(_0x378126[_0xe36e('0x38')][_0xe36e('0x42')]){_0x4f9354[_0xe36e('0x3f')]=_[_0xe36e('0x43')](_0x4f9354['where'],{'$or':_[_0xe36e('0x2f')](_0x4f9354[_0xe36e('0x39')],function(_0xdd1816){var _0x18dd36={};_0x18dd36[_0xdd1816]={'$like':'%'+_0x378126['query']['filter']+'%'};return _0x18dd36;})});}_0x4f9354=_[_0xe36e('0x43')]({},_0x4f9354,_0x378126[_0xe36e('0x45')]);return _0x4451ec['getTeams'](_0x4f9354);}})['then'](function(_0x59bf4d){if(_0x59bf4d){_0x21644d=_0x59bf4d[_0xe36e('0x3b')];if(!_0x378126[_0xe36e('0x38')][_0xe36e('0x3c')]('nolimit')){_0x4f9354[_0xe36e('0x23')]=qs[_0xe36e('0x23')](_0x378126[_0xe36e('0x38')][_0xe36e('0x23')]);_0x4f9354['offset']=qs[_0xe36e('0x22')](_0x378126[_0xe36e('0x38')][_0xe36e('0x22')]);}return _0x4451ec[_0xe36e('0x7d')](_0x4f9354);}})['then'](function(_0x3de53b){if(_0x3de53b){return _0x3de53b?{'count':_0x21644d,'rows':_0x3de53b}:null;}})['then'](respondWithResult(_0x48fbed,null))[_0xe36e('0x49')](handleError(_0x48fbed,null));};exports['addTeams']=function(_0x1c95cd,_0x2b3e81,_0x498822){var _0x2376b2=_0x1c95cd[_0xe36e('0x71')]['ids'];var _0x179b3f;return db[_0xe36e('0x7f')][_0xe36e('0x80')]({'where':{'id':_0x2376b2},'attributes':['id'],'include':[{'model':db[_0xe36e('0x7b')],'as':_0xe36e('0x81'),'attributes':['id',_0xe36e('0x2c'),'online',_0xe36e('0x82'),_0xe36e('0x83')],'raw':!![]}]})['then'](function(_0xda5f86){if(_0xda5f86){_0x179b3f=_0xda5f86;var _0x48e276=_[_0xe36e('0x84')](_0xda5f86,function(_0x7872d5){var _0x2aefd4=_0x7872d5[_0xe36e('0x51')]({'plain':!![]});return _0x2aefd4['Agents'];});return db[_0xe36e('0x30')][_0xe36e('0x4c')]({'where':{'id':_0x1c95cd[_0xe36e('0x4b')]['id']}})[_0xe36e('0x29')](function(_0x43f149){return db['sequelize'][_0xe36e('0x50')](function(_0x25abc5){return _0x43f149['addTeams'](_0x2376b2,{'transaction':_0x25abc5})['then'](function(){return BPromise[_0xe36e('0x85')](_0x179b3f,function(_0x51c98c){return db[_0xe36e('0x86')][_0xe36e('0x87')]({'TeamId':_0x51c98c['id'],'VoicePrefixId':_0x1c95cd[_0xe36e('0x4b')]['id']},{'transaction':_0x25abc5});});})[_0xe36e('0x29')](function(){return BPromise[_0xe36e('0x85')](_0x48e276,function(_0x3bd8e1){return db[_0xe36e('0x88')][_0xe36e('0x89')]({'where':{'UserId':_0x3bd8e1['id'],'VoicePrefixId':_0x1c95cd[_0xe36e('0x4b')]['id']},'transaction':_0x25abc5});});})[_0xe36e('0x29')](function(){_0x48e276['forEach'](function(_0xab0e50){socket['emit'](_0xe36e('0x76'),{'UserId':_0xab0e50['id'],'VoicePrefixId':_0x43f149['id']});});});});});}})[_0xe36e('0x29')](respondWithStatusCode(_0x2b3e81,null))[_0xe36e('0x49')](handleError(_0x2b3e81,null));};exports['removeTeams']=function(_0x3fc054,_0x947053,_0x51c758){return db[_0xe36e('0x7f')]['findAll']({'where':{'id':_0x3fc054[_0xe36e('0x38')][_0xe36e('0x75')]},'attributes':['id'],'include':[{'model':db[_0xe36e('0x7b')],'as':_0xe36e('0x81'),'attributes':['id'],'raw':!![]}]})[_0xe36e('0x29')](handleEntityNotFound(_0x947053,null))[_0xe36e('0x29')](function(_0x257b00){var _0x2056ed=_[_0xe36e('0x2f')](_0x257b00,'id');var _0x31ae71=[];var _0x166c22=[];var _0x47b082=squel['select']();_0x47b082[_0xe36e('0x8a')](_0xe36e('0x8b'))[_0xe36e('0x8c')](_0xe36e('0x8d'),'tq')['join'](_0xe36e('0x8e'),'ut',_0xe36e('0x8f'))['where'](_0xe36e('0x90'),_0x3fc054['params']['id']);for(var _0x260fff=0x0;_0x260fff<_0x257b00[_0xe36e('0x3b')];_0x260fff+=0x1){let _0x27d09b=_0x257b00[_0x260fff];for(var _0x5bc8b1=0x0;_0x5bc8b1<_0x27d09b[_0xe36e('0x81')][_0xe36e('0x3b')];_0x5bc8b1+=0x1){let _0x2e0e12=_0x27d09b[_0xe36e('0x81')][_0x5bc8b1];var _0x7a5d80=_0x47b082[_0xe36e('0x91')]();_0x7a5d80[_0xe36e('0x3f')]('ut.UserId\x20=\x20?',_0x2e0e12['id']);_0x166c22[_0xe36e('0x69')](db[_0xe36e('0x4f')][_0xe36e('0x38')](_0x7a5d80[_0xe36e('0x92')](),{'type':db[_0xe36e('0x4f')][_0xe36e('0x93')][_0xe36e('0x94')]})[_0xe36e('0x29')](function(_0xacc91e){if(_0xacc91e['length']===0x1){return _0x2e0e12['id'];}else{var _0x3e0dc9=_[_0xe36e('0x95')](_['map'](_0xacc91e,'TeamId'),function(_0x546461){return _[_0xe36e('0x96')](_0x2056ed,_0x546461);});if(_0x3e0dc9){return _0x2e0e12['id'];}}}));}}return BPromise[_0xe36e('0x97')](_0x166c22)['then'](function(_0x20208c){_0x31ae71=_(_0x31ae71)['union'](_0x20208c)['compact']()['value']();return db[_0xe36e('0x30')][_0xe36e('0x4c')]({'where':{'id':_0x3fc054['params']['id']}})[_0xe36e('0x29')](function(_0x2c9191){return db['sequelize'][_0xe36e('0x50')](function(_0x15b38e){return _0x2c9191['removeTeams'](_0x3fc054[_0xe36e('0x38')][_0xe36e('0x75')],{'transaction':_0x15b38e})['then'](function(){if(!_['isEmpty'](_0x31ae71)){return _0x2c9191[_0xe36e('0x77')](_0x31ae71,{'transaction':_0x15b38e});}})[_0xe36e('0x29')](function(){_0x31ae71[_0xe36e('0x98')](function(_0x3c7778){socket[_0xe36e('0x78')](_0xe36e('0x79'),{'UserId':_0x3c7778,'VoicePrefixId':_0x2c9191['id']});});});});});});})[_0xe36e('0x29')](respondWithStatusCode(_0x947053,null))[_0xe36e('0x49')](handleError(_0x947053,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index b9b5c7c..5e7a71a 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 _0x3ae7=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove'];(function(_0x21aee9,_0x19bbce){var _0x36edab=function(_0x25a957){while(--_0x25a957){_0x21aee9['push'](_0x21aee9['shift']());}};_0x36edab(++_0x19bbce);}(_0x3ae7,0x1dd));var _0x73ae=function(_0x25d4ec,_0xd84313){_0x25d4ec=_0x25d4ec-0x0;var _0x5164f4=_0x3ae7[_0x25d4ec];return _0x5164f4;};'use strict';var EventEmitter=require(_0x73ae('0x0'));var VoicePrefix=require(_0x73ae('0x1'))['db'][_0x73ae('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x73ae('0x3')](0x0);var events={'afterCreate':_0x73ae('0x4'),'afterUpdate':_0x73ae('0x5'),'afterDestroy':_0x73ae('0x6')};function emitEvent(_0x4b0343){return function(_0x4efb6d,_0xe6e076,_0x25471f){VoicePrefixEvents[_0x73ae('0x7')](_0x4b0343+':'+_0x4efb6d['id'],_0x4efb6d);VoicePrefixEvents[_0x73ae('0x7')](_0x4b0343,_0x4efb6d);_0x25471f(null);};}for(var e in events){if(events[_0x73ae('0x8')](e)){var event=events[e];VoicePrefix[_0x73ae('0x9')](e,emitEvent(event));}}module[_0x73ae('0xa')]=VoicePrefixEvents; \ No newline at end of file +var _0x5b2a=['exports','events','VoicePrefix','update','remove','hasOwnProperty','hook'];(function(_0x48e49a,_0x37a906){var _0x5f4dcd=function(_0x5d14c6){while(--_0x5d14c6){_0x48e49a['push'](_0x48e49a['shift']());}};_0x5f4dcd(++_0x37a906);}(_0x5b2a,0x120));var _0xa5b2=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x5b2a[_0x56916d];return _0x2b7f1f;};'use strict';var EventEmitter=require(_0xa5b2('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0xa5b2('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa5b2('0x2'),'afterDestroy':_0xa5b2('0x3')};function emitEvent(_0x7ecb68){return function(_0x20bd79,_0x163d4d,_0x3a421f){VoicePrefixEvents['emit'](_0x7ecb68+':'+_0x20bd79['id'],_0x20bd79);VoicePrefixEvents['emit'](_0x7ecb68,_0x20bd79);_0x3a421f(null);};}for(var e in events){if(events[_0xa5b2('0x4')](e)){var event=events[e];VoicePrefix[_0xa5b2('0x5')](e,emitEvent(event));}}module[_0xa5b2('0x6')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index e4aaf32..b0ce971 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 _0x2e02=['path','rimraf','./voicePrefix.attributes','define','VoicePrefix','voice_prefixes','util','../../config/logger','api','moment','bluebird'];(function(_0x5c232f,_0x48d6ad){var _0x33e678=function(_0x44d5ac){while(--_0x44d5ac){_0x5c232f['push'](_0x5c232f['shift']());}};_0x33e678(++_0x48d6ad);}(_0x2e02,0x171));var _0x22e0=function(_0x31b5de,_0x1c4fee){_0x31b5de=_0x31b5de-0x0;var _0x16ff09=_0x2e02[_0x31b5de];return _0x16ff09;};'use strict';var _=require('lodash');var util=require(_0x22e0('0x0'));var logger=require(_0x22e0('0x1'))(_0x22e0('0x2'));var moment=require(_0x22e0('0x3'));var BPromise=require(_0x22e0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x22e0('0x5'));var rimraf=require(_0x22e0('0x6'));var config=require('../../config/environment');var attributes=require(_0x22e0('0x7'));module['exports']=function(_0xcff115,_0x3e334f){return _0xcff115[_0x22e0('0x8')](_0x22e0('0x9'),attributes,{'tableName':_0x22e0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6042=['exports','VoicePrefix','voice_prefixes','bluebird','request-promise','rimraf','../../config/environment','./voicePrefix.attributes'];(function(_0x12adcb,_0x21cea0){var _0x3115eb=function(_0x5b6997){while(--_0x5b6997){_0x12adcb['push'](_0x12adcb['shift']());}};_0x3115eb(++_0x21cea0);}(_0x6042,0x11b));var _0x2604=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6042[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2604('0x0'));var rp=require(_0x2604('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2604('0x2'));var config=require(_0x2604('0x3'));var attributes=require(_0x2604('0x4'));module[_0x2604('0x5')]=function(_0x1c10d4,_0x18d4d3){return _0x1c10d4['define'](_0x2604('0x6'),attributes,{'tableName':_0x2604('0x7'),'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 3d16c00..9f6f34e 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 _0x0af5=['../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','./voicePrefix.socket','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x53442d,_0x5edd84){var _0x14308a=function(_0x3f0dab){while(--_0x3f0dab){_0x53442d['push'](_0x53442d['shift']());}};_0x14308a(++_0x5edd84);}(_0x0af5,0x158));var _0x50af=function(_0x1d359f,_0x55d26b){_0x1d359f=_0x1d359f-0x0;var _0x341611=_0x0af5[_0x1d359f];return _0x341611;};'use strict';var _=require('lodash');var util=require(_0x50af('0x0'));var moment=require(_0x50af('0x1'));var BPromise=require(_0x50af('0x2'));var rs=require(_0x50af('0x3'));var fs=require('fs');var Redis=require(_0x50af('0x4'));var db=require(_0x50af('0x5'))['db'];var utils=require(_0x50af('0x6'));var logger=require(_0x50af('0x7'))(_0x50af('0x8'));var config=require(_0x50af('0x9'));var jayson=require(_0x50af('0xa'));var client=jayson[_0x50af('0xb')]['http']({'port':0x232a});config['redis']=_[_0x50af('0xc')](config[_0x50af('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x50af('0xd')]));require(_0x50af('0xe'))['register'](socket);function respondWithRpcPromise(_0x4bef88,_0x3ec74c,_0x8298e8){return new BPromise(function(_0x5e8754,_0x3ccbee){return client[_0x50af('0xf')](_0x4bef88,_0x8298e8)[_0x50af('0x10')](function(_0x3a4c2f){logger['info'](_0x50af('0x11'),_0x3ec74c,_0x50af('0x12'));logger[_0x50af('0x13')](_0x50af('0x14'),_0x3ec74c,_0x50af('0x12'),JSON[_0x50af('0x15')](_0x3a4c2f));if(_0x3a4c2f['error']){if(_0x3a4c2f['error']['code']===0x1f4){logger[_0x50af('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x3ec74c,_0x3a4c2f[_0x50af('0x16')][_0x50af('0x17')]);return _0x3ccbee(_0x3a4c2f['error']['message']);}logger[_0x50af('0x16')](_0x50af('0x11'),_0x3ec74c,_0x3a4c2f['error']['message']);return _0x5e8754(_0x3a4c2f[_0x50af('0x16')][_0x50af('0x17')]);}else{logger[_0x50af('0x18')](_0x50af('0x11'),_0x3ec74c,_0x50af('0x12'));_0x5e8754(_0x3a4c2f[_0x50af('0x19')][_0x50af('0x17')]);}})[_0x50af('0x1a')](function(_0x1dbb30){logger[_0x50af('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x3ec74c,_0x1dbb30);_0x3ccbee(_0x1dbb30);});});} \ No newline at end of file +var _0x44fe=['http','redis','localhost','socket.io-emitter','./voicePrefix.socket','request','then','info','request\x20sent','debug','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2f1719,_0x482ff3){var _0x22063b=function(_0x2c4fb8){while(--_0x2c4fb8){_0x2f1719['push'](_0x2f1719['shift']());}};_0x22063b(++_0x482ff3);}(_0x44fe,0x16f));var _0xe44f=function(_0x40cb19,_0x5f4b75){_0x40cb19=_0x40cb19-0x0;var _0x1c62ff=_0x44fe[_0x40cb19];return _0x1c62ff;};'use strict';var _=require(_0xe44f('0x0'));var util=require(_0xe44f('0x1'));var moment=require(_0xe44f('0x2'));var BPromise=require(_0xe44f('0x3'));var rs=require(_0xe44f('0x4'));var fs=require('fs');var Redis=require(_0xe44f('0x5'));var db=require(_0xe44f('0x6'))['db'];var utils=require(_0xe44f('0x7'));var logger=require(_0xe44f('0x8'))(_0xe44f('0x9'));var config=require(_0xe44f('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe44f('0xb')]({'port':0x232a});config[_0xe44f('0xc')]=_['defaults'](config[_0xe44f('0xc')],{'host':_0xe44f('0xd'),'port':0x18eb});var socket=require(_0xe44f('0xe'))(new Redis(config[_0xe44f('0xc')]));require(_0xe44f('0xf'))['register'](socket);function respondWithRpcPromise(_0x12bdfb,_0x28ed63,_0x44b180){return new BPromise(function(_0x447184,_0x2d6ec5){return client[_0xe44f('0x10')](_0x12bdfb,_0x44b180)[_0xe44f('0x11')](function(_0xdb9b6c){logger[_0xe44f('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x28ed63,_0xe44f('0x13'));logger[_0xe44f('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x28ed63,_0xe44f('0x13'),JSON[_0xe44f('0x15')](_0xdb9b6c));if(_0xdb9b6c[_0xe44f('0x16')]){if(_0xdb9b6c[_0xe44f('0x16')][_0xe44f('0x17')]===0x1f4){logger[_0xe44f('0x16')](_0xe44f('0x18'),_0x28ed63,_0xdb9b6c[_0xe44f('0x16')]['message']);return _0x2d6ec5(_0xdb9b6c[_0xe44f('0x16')][_0xe44f('0x19')]);}logger[_0xe44f('0x16')](_0xe44f('0x18'),_0x28ed63,_0xdb9b6c[_0xe44f('0x16')][_0xe44f('0x19')]);return _0x447184(_0xdb9b6c[_0xe44f('0x16')][_0xe44f('0x19')]);}else{logger[_0xe44f('0x12')](_0xe44f('0x18'),_0x28ed63,_0xe44f('0x13'));_0x447184(_0xdb9b6c[_0xe44f('0x1a')]['message']);}})['catch'](function(_0xf3b4df){logger[_0xe44f('0x16')](_0xe44f('0x18'),_0x28ed63,_0xf3b4df);_0x2d6ec5(_0xf3b4df);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index d50de22..3ecc54e 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 _0x8868=['emit','removeListener','voicePrefix:','./voicePrefix.events','save','remove','update'];(function(_0x1ace4c,_0x3b14f0){var _0x1e142c=function(_0x2872db){while(--_0x2872db){_0x1ace4c['push'](_0x1ace4c['shift']());}};_0x1e142c(++_0x3b14f0);}(_0x8868,0x1ca));var _0x8886=function(_0x58893e,_0xa92cb0){_0x58893e=_0x58893e-0x0;var _0x425bd9=_0x8868[_0x58893e];return _0x425bd9;};'use strict';var VoicePrefixEvents=require(_0x8886('0x0'));var events=[_0x8886('0x1'),_0x8886('0x2'),_0x8886('0x3')];function createListener(_0x11d0f9,_0x46ec8e){return function(_0x34cd50){_0x46ec8e[_0x8886('0x4')](_0x11d0f9,_0x34cd50);};}function removeListener(_0x230fbb,_0x224e93){return function(){VoicePrefixEvents[_0x8886('0x5')](_0x230fbb,_0x224e93);};}exports['register']=function(_0x544272){for(var _0x2b2f5d=0x0,_0x26b94d=events['length'];_0x2b2f5d<_0x26b94d;_0x2b2f5d++){var _0x1a85e1=events[_0x2b2f5d];var _0x56b9fa=createListener(_0x8886('0x6')+_0x1a85e1,_0x544272);VoicePrefixEvents['on'](_0x1a85e1,_0x56b9fa);}}; \ No newline at end of file +var _0xcb18=['remove','emit','removeListener','register','voicePrefix:'];(function(_0x1ad6da,_0x1cd3aa){var _0x127557=function(_0x28d275){while(--_0x28d275){_0x1ad6da['push'](_0x1ad6da['shift']());}};_0x127557(++_0x1cd3aa);}(_0xcb18,0x159));var _0x8cb1=function(_0x368749,_0x5df9ab){_0x368749=_0x368749-0x0;var _0x88d295=_0xcb18[_0x368749];return _0x88d295;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save',_0x8cb1('0x0'),'update'];function createListener(_0x3df352,_0x50513d){return function(_0x5e800d){_0x50513d[_0x8cb1('0x1')](_0x3df352,_0x5e800d);};}function removeListener(_0x87b1d3,_0x15d761){return function(){VoicePrefixEvents[_0x8cb1('0x2')](_0x87b1d3,_0x15d761);};}exports[_0x8cb1('0x3')]=function(_0x503927){for(var _0x355d91=0x0,_0x335e41=events['length'];_0x355d91<_0x335e41;_0x355d91++){var _0x186f71=events[_0x355d91];var _0x510e92=createListener(_0x8cb1('0x4')+_0x186f71,_0x503927);VoicePrefixEvents['on'](_0x186f71,_0x510e92);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 757ba51..eef4817 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(_0x29cc3a,_0x26e97e){var _0x33023f=function(_0x5bc665){while(--_0x5bc665){_0x29cc3a['push'](_0x29cc3a['shift']());}};_0x33023f(++_0x26e97e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x39a1f1,_0x522fd7){var _0xbbbc47=function(_0x173de8){while(--_0x173de8){_0x39a1f1['push'](_0x39a1f1['shift']());}};_0xbbbc47(++_0x522fd7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 2ab730a..47e4020 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 _0xae4e=['Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','STRING','name','ENUM','inbound','outbound','default','ringall','leastrecent','random','linear','rrordered','setDataValue','strategy','rrmemory','getDataValue','type','dialMethod','booked','roundrobin','progressive','power','INTEGER','yes','once','TEXT','periodic_announce','split','joinempty','join','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','predictive','Dial\x20Method.'];(function(_0x55442f,_0x1d99dc){var _0x359be8=function(_0x49d9d0){while(--_0x49d9d0){_0x55442f['push'](_0x55442f['shift']());}};_0x359be8(++_0x1d99dc);}(_0xae4e,0x16c));var _0xeae4=function(_0x3e0b7f,_0x5a56f3){_0x3e0b7f=_0x3e0b7f-0x0;var _0x492939=_0xae4e[_0x3e0b7f];return _0x492939;};'use strict';var Sequelize=require(_0xeae4('0x0'));module['exports']={'name':{'type':Sequelize[_0xeae4('0x1')],'allowNull':![],'unique':_0xeae4('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xeae4('0x3')](_0xeae4('0x4'),_0xeae4('0x5')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0xeae4('0x6')},'announce':{'type':Sequelize[_0xeae4('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0xeae4('0x3')]('rr',_0xeae4('0x7'),_0xeae4('0x8'),'fewestcalls',_0xeae4('0x9'),'rrmemory',_0xeae4('0xa'),'wrandom',_0xeae4('0xb')),'allowNull':![],'defaultValue':_0xeae4('0x7'),'set':function(_0x497e4d){this[_0xeae4('0xc')](_0xeae4('0xd'),_0x497e4d?_0x497e4d:_0xeae4('0xe'));},'get':function(){var _0x2f3663=this[_0xeae4('0xf')](_0xeae4('0x10'));var _0x329827=this[_0xeae4('0xf')](_0xeae4('0x11'));var _0xb4ba7e=this[_0xeae4('0xf')](_0xeae4('0xd'));if(_0x2f3663===_0xeae4('0x4')){return _0xb4ba7e;}if(_0x329827===_0xeae4('0x12')&&_0xb4ba7e===_0xeae4('0xe')||_0x329827===_0xeae4('0x12')&&_0xb4ba7e===_0xeae4('0x13')){return _0xb4ba7e;}if(_0x329827===_0xeae4('0x14')||_0x329827==='predictive'||_0x329827===_0xeae4('0x15')){return _0xb4ba7e;}return null;}},'servicelevel':{'type':Sequelize[_0xeae4('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xeae4('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xeae4('0x16')](0xb)},'timeout':{'type':Sequelize[_0xeae4('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xeae4('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xeae4('0x1')]},'weight':{'type':Sequelize[_0xeae4('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xeae4('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xeae4('0x3')](_0xeae4('0x17'),'no'),'defaultValue':_0xeae4('0x17')},'autopause':{'type':Sequelize['ENUM'](_0xeae4('0x17'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xeae4('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0xeae4('0x3')](_0xeae4('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0xeae4('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xeae4('0x3')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xeae4('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xeae4('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xeae4('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xeae4('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xeae4('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xeae4('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xeae4('0x3')](_0xeae4('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xeae4('0x3')](_0xeae4('0x17'),'no'),'defaultValue':_0xeae4('0x17')},'announce_holdtime':{'type':Sequelize[_0xeae4('0x3')]('yes','no',_0xeae4('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xeae4('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xeae4('0x3')](_0xeae4('0x17'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xeae4('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xeae4('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xeae4('0x1')]},'queue_youarenext':{'type':Sequelize[_0xeae4('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xeae4('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xeae4('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xeae4('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xeae4('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xeae4('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xeae4('0x1')]},'queue_quantity1':{'type':Sequelize[_0xeae4('0x1')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xeae4('0x1')]},'queue_less_than':{'type':Sequelize[_0xeae4('0x1')]},'periodic_announce':{'type':Sequelize[_0xeae4('0x19')],'set':function(_0x41e291){this[_0xeae4('0xc')]('periodic_announce',_0x41e291?_0x41e291['join'](','):[]);},'get':function(){return this[_0xeae4('0xf')](_0xeae4('0x1a'))?this[_0xeae4('0xf')]('periodic_announce')[_0xeae4('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0xeae4('0x1')],'defaultValue':_0xeae4('0x17'),'set':function(_0x26a1ae){this[_0xeae4('0xc')](_0xeae4('0x1c'),_0x26a1ae?_0x26a1ae[_0xeae4('0x1d')](','):undefined);},'get':function(){return this[_0xeae4('0xf')]('joinempty')?this[_0xeae4('0xf')](_0xeae4('0x1c'))[_0xeae4('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xeae4('0x1')],'defaultValue':'no','set':function(_0x64256b){this[_0xeae4('0xc')]('leavewhenempty',_0x64256b?_0x64256b[_0xeae4('0x1d')](','):undefined);},'get':function(){return this['getDataValue'](_0xeae4('0x1e'))?this['getDataValue'](_0xeae4('0x1e'))[_0xeae4('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0xeae4('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xeae4('0x3')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xeae4('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xeae4('0x3')](_0xeae4('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xeae4('0x1')]},'description':{'type':Sequelize[_0xeae4('0x1')]},'acw':{'type':Sequelize[_0xeae4('0x1f')],'defaultValue':0x0,'set':function(_0x1bcea3){this['setDataValue']('acw',_0x1bcea3);if(_0x1bcea3){if(this[_0xeae4('0xf')](_0xeae4('0x20'))<0x2){this[_0xeae4('0xc')](_0xeae4('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xeae4('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xeae4('0x1f')],'defaultValue':0x0,'comment':_0xeae4('0x21')},'dialMethod':{'type':Sequelize['ENUM']('preview',_0xeae4('0x14'),_0xeae4('0x15'),_0xeae4('0x22'),_0xeae4('0x12')),'defaultValue':_0xeae4('0x14'),'comment':_0xeae4('0x23')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xeae4('0x24')},'dialLimitQueue':{'type':Sequelize[_0xeae4('0x16')](0x4)[_0xeae4('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xeae4('0x26')},'dialPowerLevel':{'type':Sequelize[_0xeae4('0x27')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0xeae4('0x3')]('agentBusyFactor',_0xeae4('0x28')),'defaultValue':'dropRate','comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xeae4('0x27')](0x2)[_0xeae4('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xeae4('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0xeae4('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xeae4('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xeae4('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xeae4('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xeae4('0x2a')},'dialQueueOptions':{'type':Sequelize[_0xeae4('0x1')],'defaultValue':_0xeae4('0x2b'),'comment':_0xeae4('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0xeae4('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xeae4('0x2d')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xeae4('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xeae4('0x2e')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xeae4('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xeae4('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0xeae4('0x16')](0x3)[_0xeae4('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xeae4('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0xeae4('0x16')](0x5)[_0xeae4('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xeae4('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xeae4('0x25')],'defaultValue':0x3,'comment':_0xeae4('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xeae4('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xeae4('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0xeae4('0x16')](0x3)[_0xeae4('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xeae4('0x34')},'dialTimezone':{'type':Sequelize[_0xeae4('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xeae4('0x35')},'dialPrefix':{'type':Sequelize[_0xeae4('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xeae4('0x3')](_0xeae4('0x36'),_0xeae4('0x37'),_0xeae4('0x38')),'defaultValue':_0xeae4('0x36')},'dialAMDActive':{'type':Sequelize[_0xeae4('0x1f')],'defaultValue':0x0,'comment':_0xeae4('0x39')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xeae4('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xeae4('0x3a')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xeae4('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xeae4('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xeae4('0x16')](0x9)[_0xeae4('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xeae4('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xeae4('0x16')](0x9)[_0xeae4('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xeae4('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0xeae4('0x16')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xeae4('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xeae4('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xeae4('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xeae4('0x16')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xeae4('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xeae4('0x16')](0x5)[_0xeae4('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xeae4('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xeae4('0x41')},'dialRecallMeTimeout':{'type':Sequelize[_0xeae4('0x16')](0x5)[_0xeae4('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xeae4('0x42')},'dialRecallInQueue':{'type':Sequelize[_0xeae4('0x1f')],'defaultValue':0x0,'comment':_0xeae4('0x43')},'dialOrderByScheduledAt':{'type':Sequelize[_0xeae4('0x3')](_0xeae4('0x44'),_0xeae4('0x45')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0xeae4('0x46')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xeae4('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xeae4('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xeae4('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xeae4('0x47')},'dialCutDigit':{'type':Sequelize[_0xeae4('0x16')](0x3)[_0xeae4('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xeae4('0x48')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xeae4('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xeae4('0x16')](0x3)[_0xeae4('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xeae4('0x49')},'dialDropRetryFrequency':{'type':Sequelize[_0xeae4('0x16')](0x5)[_0xeae4('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xeae4('0x4a')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xeae4('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xeae4('0x16')](0x5)[_0xeae4('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xeae4('0x16')](0x3)[_0xeae4('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xeae4('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize[_0xeae4('0x16')](0x5)[_0xeae4('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xeae4('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xeae4('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xeae4('0x16')](0x5)[_0xeae4('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0xeae4('0x16')],'allowNull':!![],'comment':_0xeae4('0x4d')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xeae4('0x4e'),'set':function(_0x18dc8a){if(!_0x18dc8a)this['setDataValue'](_0xeae4('0x4f'),null);this[_0xeae4('0xc')]('mandatoryDisposition',_0x18dc8a);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xeae4('0x16')](0x3)[_0xeae4('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xeae4('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xeae4('0x1f')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xde6f=['outbound','STRING','default','ringall','leastrecent','fewestcalls','rrmemory','wrandom','rrordered','setDataValue','strategy','type','dialMethod','getDataValue','booked','roundrobin','progressive','predictive','INTEGER','yes','all','TEXT','periodic_announce','join','joinempty','split','leavewhenempty','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','ENUM','inbound'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xde6f,0xcc));var _0xfde6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xde6f[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xfde6('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xfde6('0x1')](_0xfde6('0x2'),_0xfde6('0x3')),'allowNull':![],'defaultValue':_0xfde6('0x2')},'musiconhold':{'type':Sequelize[_0xfde6('0x4')],'defaultValue':_0xfde6('0x5')},'announce':{'type':Sequelize[_0xfde6('0x4')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xfde6('0x6'),_0xfde6('0x7'),_0xfde6('0x8'),'random',_0xfde6('0x9'),'linear',_0xfde6('0xa'),_0xfde6('0xb')),'allowNull':![],'defaultValue':_0xfde6('0x6'),'set':function(_0x48f07b){this[_0xfde6('0xc')](_0xfde6('0xd'),_0x48f07b?_0x48f07b:_0xfde6('0x9'));},'get':function(){var _0x45648e=this['getDataValue'](_0xfde6('0xe'));var _0x4b7a6e=this['getDataValue'](_0xfde6('0xf'));var _0x36ffe8=this[_0xfde6('0x10')](_0xfde6('0xd'));if(_0x45648e==='inbound'){return _0x36ffe8;}if(_0x4b7a6e==='booked'&&_0x36ffe8===_0xfde6('0x9')||_0x4b7a6e===_0xfde6('0x11')&&_0x36ffe8===_0xfde6('0x12')){return _0x36ffe8;}if(_0x4b7a6e===_0xfde6('0x13')||_0x4b7a6e===_0xfde6('0x14')||_0x4b7a6e==='power'){return _0x36ffe8;}return null;}},'servicelevel':{'type':Sequelize[_0xfde6('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xfde6('0x15')](0xb)},'timeout':{'type':Sequelize[_0xfde6('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xfde6('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0xfde6('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0xfde6('0x16'),'no'),'defaultValue':_0xfde6('0x16')},'autopause':{'type':Sequelize[_0xfde6('0x1')](_0xfde6('0x16'),'no',_0xfde6('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xfde6('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0xfde6('0x1')](_0xfde6('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xfde6('0x1')](_0xfde6('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xfde6('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xfde6('0x1')](_0xfde6('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xfde6('0x1')](_0xfde6('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xfde6('0x1')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xfde6('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xfde6('0x4')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xfde6('0x4')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xfde6('0x1')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xfde6('0x1')]('yes','no'),'defaultValue':_0xfde6('0x16')},'announce_holdtime':{'type':Sequelize[_0xfde6('0x1')](_0xfde6('0x16'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize[_0xfde6('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xfde6('0x4')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xfde6('0x4')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xfde6('0x4')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xfde6('0x4')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xfde6('0x4')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xfde6('0x4')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xfde6('0x4')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xfde6('0x4')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xfde6('0x4')]},'queue_periodic_announce':{'type':Sequelize[_0xfde6('0x4')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0xfde6('0x18')],'set':function(_0x22f07e){this['setDataValue'](_0xfde6('0x19'),_0x22f07e?_0x22f07e[_0xfde6('0x1a')](','):[]);},'get':function(){return this['getDataValue'](_0xfde6('0x19'))?this[_0xfde6('0x10')](_0xfde6('0x19'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0xfde6('0x4')],'defaultValue':_0xfde6('0x16'),'set':function(_0x3cebdf){this['setDataValue'](_0xfde6('0x1b'),_0x3cebdf?_0x3cebdf[_0xfde6('0x1a')](','):undefined);},'get':function(){return this[_0xfde6('0x10')]('joinempty')?this[_0xfde6('0x10')](_0xfde6('0x1b'))[_0xfde6('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xfde6('0x4')],'defaultValue':'no','set':function(_0x39c389){this['setDataValue'](_0xfde6('0x1d'),_0x39c389?_0x39c389[_0xfde6('0x1a')](','):undefined);},'get':function(){return this[_0xfde6('0x10')](_0xfde6('0x1d'))?this[_0xfde6('0x10')](_0xfde6('0x1d'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xfde6('0x1')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xfde6('0x1')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfde6('0x4')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x28bdee){this[_0xfde6('0xc')]('acw',_0x28bdee);if(_0x28bdee){if(this[_0xfde6('0x10')](_0xfde6('0x1e'))<0x2){this[_0xfde6('0xc')](_0xfde6('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xfde6('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xfde6('0x1f')],'defaultValue':0x0,'comment':_0xfde6('0x20')},'dialMethod':{'type':Sequelize[_0xfde6('0x1')](_0xfde6('0x21'),'progressive','power',_0xfde6('0x14'),_0xfde6('0x11')),'defaultValue':_0xfde6('0x13'),'comment':_0xfde6('0x22')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0xfde6('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0xfde6('0x15')](0x4)[_0xfde6('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xfde6('0x24')},'dialPowerLevel':{'type':Sequelize[_0xfde6('0x25')](0x2)[_0xfde6('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0xfde6('0x1')](_0xfde6('0x26'),_0xfde6('0x27')),'defaultValue':'dropRate','comment':_0xfde6('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xfde6('0x25')](0x2)[_0xfde6('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xfde6('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0xfde6('0x15')](0x3)[_0xfde6('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xfde6('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xfde6('0x4')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfde6('0x2a')},'dialQueueOptions':{'type':Sequelize[_0xfde6('0x4')],'defaultValue':_0xfde6('0x2b'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xfde6('0x15')](0x3)[_0xfde6('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0xfde6('0x2c')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xfde6('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfde6('0x2d')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xfde6('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfde6('0x2e')},'dialBusyMaxRetry':{'type':Sequelize[_0xfde6('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfde6('0x2f')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfde6('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xfde6('0x15')](0x3)[_0xfde6('0x23')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xfde6('0x15')](0x5)[_0xfde6('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfde6('0x30')},'dialGlobalMaxRetry':{'type':Sequelize[_0xfde6('0x15')](0x3)[_0xfde6('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xfde6('0x4')],'defaultValue':_0xfde6('0x31')},'dialPrefix':{'type':Sequelize[_0xfde6('0x4')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xfde6('0x1')](_0xfde6('0x32'),_0xfde6('0x33'),'onlyIfOpen'),'defaultValue':_0xfde6('0x32')},'dialAMDActive':{'type':Sequelize[_0xfde6('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xfde6('0x15')](0x9)[_0xfde6('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xfde6('0x34')},'dialAMDGreeting':{'type':Sequelize[_0xfde6('0x15')](0x9)[_0xfde6('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xfde6('0x35')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xfde6('0x15')](0x9)[_0xfde6('0x23')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xfde6('0x36')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xfde6('0x15')](0x9)[_0xfde6('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xfde6('0x37')},'dialAMDMinWordLength':{'type':Sequelize[_0xfde6('0x15')](0x9)[_0xfde6('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xfde6('0x38')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xfde6('0x15')](0x9)[_0xfde6('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xfde6('0x15')](0x9)[_0xfde6('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xfde6('0x15')](0x5)[_0xfde6('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xfde6('0x39')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xfde6('0x15')](0x9)[_0xfde6('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0xfde6('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xfde6('0x3a')},'dialRecallInQueue':{'type':Sequelize[_0xfde6('0x1f')],'defaultValue':0x0,'comment':_0xfde6('0x3b')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xfde6('0x3c'),_0xfde6('0x3d')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xfde6('0x4')],'comment':_0xfde6('0x2c')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xfde6('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xfde6('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xfde6('0x15')](0x3)[_0xfde6('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xfde6('0x15')](0x3)[_0xfde6('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfde6('0x3e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xfde6('0x15')](0x3)[_0xfde6('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfde6('0x3f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xfde6('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xfde6('0x15')](0x3)[_0xfde6('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfde6('0x40')},'dialDropRetryFrequency':{'type':Sequelize[_0xfde6('0x15')](0x5)[_0xfde6('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xfde6('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfde6('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xfde6('0x15')](0x3)[_0xfde6('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfde6('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfde6('0x41')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xfde6('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfde6('0x42')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfde6('0x15')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xfde6('0x1f')],'defaultValue':![],'comment':_0xfde6('0x43'),'set':function(_0x4cc9f1){if(!_0x4cc9f1)this[_0xfde6('0xc')](_0xfde6('0x44'),null);this[_0xfde6('0xc')]('mandatoryDisposition',_0x4cc9f1);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xfde6('0x15')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xfde6('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xfde6('0x1f')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xfde6('0x1f')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 9d3b15e..c15f632 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 _0xc31a=['ListId','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','scheduledAt','removeLists','getBlackLists','addBlackLists','removeBlackLists','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','status','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','VoiceQueues','inbound','QueueCampaigns','outbound','filter','map','includes','type','find','name','UserProfileResource','end','error','index','VoiceQueue','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','include','findAll','rows','catch','show','rawAttributes','includeAll','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','value','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','UserProfileSection','autoAssociation','getHoppers','findOne','CmHopper','VoiceQueueId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','Agents','online','voicePause','forEach','penalty','sequelize','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','interface','format','emit','userVoiceQueue:save','removeTeams','Team','User','field','from','team_has_voice_queues','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','union','compact','transaction','isEmpty','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','ids','spread','all','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','select','CmListId'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc31a,0xc0));var _0xac31=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc31a[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xac31('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xac31('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xac31('0x2'));var moment=require(_0xac31('0x3'));var BPromise=require(_0xac31('0x4'));var Mustache=require('mustache');var util=require(_0xac31('0x5'));var path=require(_0xac31('0x6'));var sox=require(_0xac31('0x7'));var csv=require('to-csv');var ejs=require(_0xac31('0x8'));var fs=require('fs');var fs_extra=require(_0xac31('0x9'));var _=require(_0xac31('0xa'));var squel=require(_0xac31('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xac31('0xc'));var toCsv=require('to-csv');var querystring=require(_0xac31('0xd'));var Papa=require(_0xac31('0xe'));var Redis=require(_0xac31('0xf'));var authService=require(_0xac31('0x10'));var qs=require(_0xac31('0x11'));var as=require(_0xac31('0x12'));var hardwareService=require(_0xac31('0x13'));var logger=require('../../config/logger')(_0xac31('0x14'));var utils=require('../../config/utils');var config=require(_0xac31('0x15'));var licenseUtil=require(_0xac31('0x16'));var db=require('../../mysqldb')['db'];config[_0xac31('0x17')]=_['defaults'](config[_0xac31('0x17')],{'host':_0xac31('0x18'),'port':0x18eb});var socket=require(_0xac31('0x19'))(new Redis(config[_0xac31('0x17')]));require(_0xac31('0x1a'))['register'](socket);function respondWithStatusCode(_0x2af68d,_0x5d5a0d){_0x5d5a0d=_0x5d5a0d||0xcc;return function(_0x4dd466){if(_0x4dd466){return _0x2af68d[_0xac31('0x1b')](_0x5d5a0d);}return _0x2af68d[_0xac31('0x1c')](_0x5d5a0d)['end']();};}function respondWithResult(_0x544180,_0x161e4f){_0x161e4f=_0x161e4f||0xc8;return function(_0xb212d3){if(_0xb212d3){return _0x544180[_0xac31('0x1c')](_0x161e4f)[_0xac31('0x1d')](_0xb212d3);}};}function respondWithFilteredResult(_0x32fef3,_0x350d92){return function(_0x2a5cf6){if(_0x2a5cf6){var _0x57ee45=typeof _0x350d92[_0xac31('0x1e')]==='undefined'&&typeof _0x350d92[_0xac31('0x1f')]==='undefined';var _0x286375=_0x2a5cf6[_0xac31('0x20')];var _0x53d13a=_0x57ee45?0x0:_0x350d92['offset'];var _0x45b17a=_0x57ee45?_0x2a5cf6[_0xac31('0x20')]:_0x350d92['offset']+_0x350d92[_0xac31('0x1f')];var _0x56ca43;if(_0x45b17a>=_0x286375){_0x45b17a=_0x286375;_0x56ca43=0xc8;}else{_0x56ca43=0xce;}_0x32fef3[_0xac31('0x1c')](_0x56ca43);return _0x32fef3['set'](_0xac31('0x21'),_0x53d13a+'-'+_0x45b17a+'/'+_0x286375)[_0xac31('0x1d')](_0x2a5cf6);}return null;};}function patchUpdates(_0x3af8c9){return function(_0x5af964){try{jsonpatch[_0xac31('0x22')](_0x5af964,_0x3af8c9,!![]);}catch(_0x567720){return BPromise[_0xac31('0x23')](_0x567720);}return _0x5af964[_0xac31('0x24')]();};}function saveUpdates(_0x5f13b4,_0x8f2b04){return function(_0x36c84e){if(_0x36c84e){return _0x36c84e[_0xac31('0x25')](_0x5f13b4)[_0xac31('0x26')](function(_0xf70099){return _0xf70099;});}return null;};}function removeEntity(_0x325610,_0x4dc290){return function(_0x5f1f46){if(_0x5f1f46){return _0x5f1f46[_0xac31('0x27')]()[_0xac31('0x26')](function(){var _0x3d0146=_0x5f1f46['get']({'plain':!![]});var _0xc8d713=[{'name':_0xac31('0x28'),'value':_0xac31('0x29'),'ignore':![]},{'name':_0xac31('0x2a'),'value':_0xac31('0x2b'),'ignore':![]}];var _0x115fb1=_(_0xc8d713)[_0xac31('0x2c')]('ignore')[_0xac31('0x2d')]('value')['value']();if(_[_0xac31('0x2e')](_0x115fb1,_0x3d0146[_0xac31('0x2f')])){return;}var _0x317304=_[_0xac31('0x30')](_0xc8d713,['value',_0x3d0146[_0xac31('0x2f')]])[_0xac31('0x31')];return db[_0xac31('0x32')][_0xac31('0x27')]({'where':{'type':_0x317304,'resourceId':_0x3d0146['id']}})[_0xac31('0x26')](function(){return _0x5f1f46;});})[_0xac31('0x26')](function(){_0x325610[_0xac31('0x1c')](0xcc)[_0xac31('0x33')]();});}};}function handleEntityNotFound(_0x1ec36a,_0xd1c145){return function(_0x46db3e){if(!_0x46db3e){_0x1ec36a[_0xac31('0x1b')](0x194);}return _0x46db3e;};}function handleError(_0xd1aa0b,_0x47ceb3){_0x47ceb3=_0x47ceb3||0x1f4;return function(_0x4a743f){logger[_0xac31('0x34')](_0x4a743f['stack']);if(_0x4a743f[_0xac31('0x31')]){delete _0x4a743f[_0xac31('0x31')];}_0xd1aa0b[_0xac31('0x1c')](_0x47ceb3)['send'](_0x4a743f);};}exports[_0xac31('0x35')]=function(_0x1b208d,_0x595262){var _0x1e3181={},_0x1c22ad={},_0x3dc4df={'count':0x0,'rows':[]};var _0x52bebb=_[_0xac31('0x2d')](db[_0xac31('0x36')]['rawAttributes'],function(_0x4f14cb){return{'name':_0x4f14cb[_0xac31('0x37')],'type':_0x4f14cb[_0xac31('0x2f')][_0xac31('0x38')]};});_0x1c22ad[_0xac31('0x39')]=_[_0xac31('0x2d')](_0x52bebb,_0xac31('0x31'));_0x1c22ad[_0xac31('0x3a')]=_[_0xac31('0x3b')](_0x1b208d['query']);_0x1c22ad[_0xac31('0x3c')]=_['intersection'](_0x1c22ad[_0xac31('0x39')],_0x1c22ad['query']);_0x1e3181[_0xac31('0x3d')]=_[_0xac31('0x3e')](_0x1c22ad[_0xac31('0x39')],qs[_0xac31('0x3f')](_0x1b208d[_0xac31('0x3a')][_0xac31('0x3f')]));_0x1e3181[_0xac31('0x3d')]=_0x1e3181[_0xac31('0x3d')][_0xac31('0x40')]?_0x1e3181['attributes']:_0x1c22ad['model'];if(!_0x1b208d[_0xac31('0x3a')][_0xac31('0x41')](_0xac31('0x42'))){_0x1e3181[_0xac31('0x1f')]=qs[_0xac31('0x1f')](_0x1b208d[_0xac31('0x3a')][_0xac31('0x1f')]);_0x1e3181['offset']=qs[_0xac31('0x1e')](_0x1b208d['query'][_0xac31('0x1e')]);}_0x1e3181[_0xac31('0x43')]=qs[_0xac31('0x44')](_0x1b208d[_0xac31('0x3a')]['sort']);_0x1e3181[_0xac31('0x45')]=qs[_0xac31('0x3c')](_[_0xac31('0x46')](_0x1b208d['query'],_0x1c22ad[_0xac31('0x3c')]),_0x52bebb);if(_0x1b208d[_0xac31('0x3a')][_0xac31('0x2c')]){_0x1e3181[_0xac31('0x45')]=_['merge'](_0x1e3181[_0xac31('0x45')],{'$or':_[_0xac31('0x2d')](_0x52bebb,function(_0x3e3c4b){if(_0x3e3c4b[_0xac31('0x2f')]!=='VIRTUAL'){var _0x2ac18f={};_0x2ac18f[_0x3e3c4b[_0xac31('0x31')]]={'$like':'%'+_0x1b208d['query'][_0xac31('0x2c')]+'%'};return _0x2ac18f;}})});}_0x1e3181=_[_0xac31('0x47')]({},_0x1e3181,_0x1b208d[_0xac31('0x48')]);var _0x4a5adc={'where':_0x1e3181[_0xac31('0x45')]};return db[_0xac31('0x36')][_0xac31('0x20')](_0x4a5adc)['then'](function(_0x512feb){_0x3dc4df[_0xac31('0x20')]=_0x512feb;if(_0x1b208d['query']['includeAll']){_0x1e3181[_0xac31('0x49')]=[{'all':!![]}];}return db[_0xac31('0x36')][_0xac31('0x4a')](_0x1e3181);})[_0xac31('0x26')](function(_0xa6dda9){_0x3dc4df[_0xac31('0x4b')]=_0xa6dda9;return _0x3dc4df;})['then'](respondWithFilteredResult(_0x595262,_0x1e3181))[_0xac31('0x4c')](handleError(_0x595262,null));};exports[_0xac31('0x4d')]=function(_0x126ad6,_0x3a7541){var _0x3a3866={'raw':![],'where':{'id':_0x126ad6['params']['id']}},_0x3afafb={};_0x3afafb[_0xac31('0x39')]=_[_0xac31('0x3b')](db[_0xac31('0x36')][_0xac31('0x4e')]);_0x3afafb[_0xac31('0x3a')]=_[_0xac31('0x3b')](_0x126ad6[_0xac31('0x3a')]);_0x3afafb['filters']=_[_0xac31('0x3e')](_0x3afafb[_0xac31('0x39')],_0x3afafb[_0xac31('0x3a')]);_0x3a3866[_0xac31('0x3d')]=_[_0xac31('0x3e')](_0x3afafb[_0xac31('0x39')],qs[_0xac31('0x3f')](_0x126ad6[_0xac31('0x3a')]['fields']));_0x3a3866[_0xac31('0x3d')]=_0x3a3866['attributes']['length']?_0x3a3866[_0xac31('0x3d')]:_0x3afafb[_0xac31('0x39')];if(_0x126ad6[_0xac31('0x3a')][_0xac31('0x4f')]){_0x3a3866['include']=[{'all':!![]}];}_0x3a3866=_[_0xac31('0x47')]({},_0x3a3866,_0x126ad6[_0xac31('0x48')]);return db['VoiceQueue'][_0xac31('0x30')](_0x3a3866)[_0xac31('0x26')](handleEntityNotFound(_0x3a7541,null))[_0xac31('0x26')](respondWithResult(_0x3a7541,null))[_0xac31('0x4c')](handleError(_0x3a7541,null));};exports[_0xac31('0x50')]=function(_0x38423b,_0x4c8c08){return db[_0xac31('0x36')][_0xac31('0x50')](_0x38423b[_0xac31('0x51')],{})[_0xac31('0x26')](function(_0x106e16){var _0x2e6e64=_0x38423b[_0xac31('0x52')][_0xac31('0x53')]({'plain':!![]});if(!_0x2e6e64)throw new Error(_0xac31('0x54'));if(_0x2e6e64[_0xac31('0x55')]===_0xac31('0x52')){var _0x1badc2=_0x106e16[_0xac31('0x53')]({'plain':!![]});var _0x6f740e=[{'name':_0xac31('0x28'),'value':_0xac31('0x29')},{'name':_0xac31('0x2a'),'value':_0xac31('0x2b')}];var _0x20ee98=_[_0xac31('0x30')](_0x6f740e,[_0xac31('0x56'),_0x1badc2['type']])[_0xac31('0x31')];return db['UserProfileSection'][_0xac31('0x30')]({'where':{'name':_0x20ee98,'userProfileId':_0x2e6e64[_0xac31('0x57')]},'raw':!![]})[_0xac31('0x26')](function(_0x520188){if(_0x520188&&_0x520188['autoAssociation']===0x0){return db[_0xac31('0x32')][_0xac31('0x50')]({'name':_0x1badc2[_0xac31('0x31')],'resourceId':_0x1badc2['id'],'type':_0x520188['name'],'sectionId':_0x520188['id']},{})[_0xac31('0x26')](function(){return _0x106e16;});}else{return _0x106e16;}})['catch'](function(_0x360a07){logger['error'](_0xac31('0x58'),_0x360a07);throw _0x360a07;});}return _0x106e16;})[_0xac31('0x26')](respondWithResult(_0x4c8c08,0xc9))[_0xac31('0x4c')](handleError(_0x4c8c08,null));};exports[_0xac31('0x59')]=function(_0x4e3da2,_0x252285){var _0x3f8ec2={'where':{'id':_0x4e3da2[_0xac31('0x5a')]['id']}},_0x4b77a1={};_0x4b77a1[_0xac31('0x39')]=_[_0xac31('0x3b')](db['VoiceQueue']['rawAttributes']);_0x3f8ec2[_0xac31('0x3d')]=_['intersection'](_0x4b77a1['model'],qs['fields'](_0x4e3da2[_0xac31('0x3a')][_0xac31('0x3f')]));_0x3f8ec2[_0xac31('0x3d')]=_0x3f8ec2['attributes'][_0xac31('0x40')]?_0x3f8ec2[_0xac31('0x3d')]:_0x4b77a1[_0xac31('0x39')];if(_0x4e3da2['query'][_0xac31('0x4f')]){_0x3f8ec2[_0xac31('0x49')]=[{'all':!![]}];}_0x3f8ec2=_[_0xac31('0x47')]({},_0x3f8ec2,_0x4e3da2[_0xac31('0x48')]);return db['VoiceQueue'][_0xac31('0x30')](_0x3f8ec2)[_0xac31('0x26')](handleEntityNotFound(_0x252285,null))['then'](function(_0x4bdff4){if(_0x4bdff4){var _0xeb77e7=_0x4bdff4[_0xac31('0x53')]({'plain':!![]});_0xeb77e7=qs[_0xac31('0x5b')](_0xeb77e7,['id',_0xac31('0x5c'),_0xac31('0x5d')]);_0x4e3da2[_0xac31('0x51')]=_[_0xac31('0x5b')](_0x4e3da2[_0xac31('0x51')],['id',_0xac31('0x5c'),_0xac31('0x5d')]);return db[_0xac31('0x36')][_0xac31('0x50')](_[_0xac31('0x47')](_0xeb77e7,_0x4e3da2[_0xac31('0x51')]),{'include':_0x4e3da2[_0xac31('0x3a')][_0xac31('0x4f')]?[{'all':!![]}]:undefined})['then'](function(_0x218c48){var _0x4b9adf=_0x4e3da2[_0xac31('0x52')][_0xac31('0x53')]({'plain':!![]});if(!_0x4b9adf)throw new Error(_0xac31('0x54'));if(_0x4b9adf['role']===_0xac31('0x52')){var _0x221664=_0x218c48[_0xac31('0x53')]({'plain':!![]});var _0x281a4b=[{'name':'VoiceQueues','value':_0xac31('0x29')},{'name':_0xac31('0x2a'),'value':'outbound'}];var _0x53574f=_['find'](_0x281a4b,[_0xac31('0x56'),_0x221664['type']])[_0xac31('0x31')];return db[_0xac31('0x5e')][_0xac31('0x30')]({'where':{'name':_0x53574f,'userProfileId':_0x4b9adf['userProfileId']},'raw':!![]})[_0xac31('0x26')](function(_0x38def9){if(_0x38def9&&_0x38def9[_0xac31('0x5f')]===0x0){return db['UserProfileResource']['create']({'name':_0x221664[_0xac31('0x31')],'resourceId':_0x221664['id'],'type':_0x38def9[_0xac31('0x31')],'sectionId':_0x38def9['id']},{})['then'](function(){return _0x218c48;});}else{return _0x218c48;}})['catch'](function(_0x1a91f3){logger[_0xac31('0x34')](_0xac31('0x58'),_0x1a91f3);throw _0x1a91f3;});}return _0x218c48;});}})[_0xac31('0x26')](respondWithResult(_0x252285,0xc9))[_0xac31('0x4c')](handleError(_0x252285,null));};exports[_0xac31('0x25')]=function(_0x52f076,_0xc1a507){if(_0x52f076[_0xac31('0x51')]['id']){delete _0x52f076['body']['id'];}return db[_0xac31('0x36')]['find']({'where':{'id':_0x52f076['params']['id']}})[_0xac31('0x26')](handleEntityNotFound(_0xc1a507,null))[_0xac31('0x26')](saveUpdates(_0x52f076[_0xac31('0x51')],null))['then'](respondWithResult(_0xc1a507,null))[_0xac31('0x4c')](handleError(_0xc1a507,null));};exports['destroy']=function(_0x588316,_0x2fa416){return db[_0xac31('0x36')][_0xac31('0x30')]({'where':{'id':_0x588316[_0xac31('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2fa416,null))['then'](removeEntity(_0x2fa416,null))['catch'](handleError(_0x2fa416,null));};exports[_0xac31('0x60')]=function(_0xa04199,_0x287cd0,_0x73d8e6){var _0x4c3e3d={'raw':![],'where':{}};var _0xa2fdc2={};var _0xa92759={'count':0x0,'rows':[]};return db[_0xac31('0x36')][_0xac31('0x61')]({'where':{'id':_0xa04199[_0xac31('0x5a')]['id']}})[_0xac31('0x26')](handleEntityNotFound(_0x287cd0,null))['then'](function(_0x519ff3){if(_0x519ff3){_0xa2fdc2[_0xac31('0x39')]=_[_0xac31('0x3b')](db[_0xac31('0x62')]['rawAttributes']);_0xa2fdc2['query']=_['keys'](_0xa04199[_0xac31('0x3a')]);_0xa2fdc2[_0xac31('0x3c')]=_[_0xac31('0x3e')](_0xa2fdc2[_0xac31('0x39')],_0xa2fdc2[_0xac31('0x3a')]);_0x4c3e3d['attributes']=_['intersection'](_0xa2fdc2[_0xac31('0x39')],qs[_0xac31('0x3f')](_0xa04199[_0xac31('0x3a')][_0xac31('0x3f')]));_0x4c3e3d[_0xac31('0x3d')]=_0x4c3e3d[_0xac31('0x3d')][_0xac31('0x40')]?_0x4c3e3d[_0xac31('0x3d')]:_0xa2fdc2[_0xac31('0x39')];if(!_0xa04199[_0xac31('0x3a')][_0xac31('0x41')](_0xac31('0x42'))){_0x4c3e3d[_0xac31('0x1f')]=qs[_0xac31('0x1f')](_0xa04199[_0xac31('0x3a')]['limit']);_0x4c3e3d['offset']=qs['offset'](_0xa04199[_0xac31('0x3a')][_0xac31('0x1e')]);}_0x4c3e3d['order']=qs[_0xac31('0x44')](_0xa04199[_0xac31('0x3a')][_0xac31('0x44')]);_0x4c3e3d['where']=qs[_0xac31('0x3c')](_['pick'](_0xa04199[_0xac31('0x3a')],_0xa2fdc2[_0xac31('0x3c')]));_0x4c3e3d[_0xac31('0x45')][_0xac31('0x63')]=_0x519ff3['id'];if(_0xa04199['query'][_0xac31('0x2c')]){_0x4c3e3d[_0xac31('0x45')]=_[_0xac31('0x47')](_0x4c3e3d['where'],{'$or':_['map'](_0x4c3e3d[_0xac31('0x3d')],function(_0xe4813a){var _0x37d522={};_0x37d522[_0xe4813a]={'$like':'%'+_0xa04199[_0xac31('0x3a')][_0xac31('0x2c')]+'%'};return _0x37d522;})});}_0x4c3e3d=_[_0xac31('0x47')]({},_0x4c3e3d,_0xa04199[_0xac31('0x48')]);return db[_0xac31('0x62')][_0xac31('0x20')]({'where':_0x4c3e3d[_0xac31('0x45')]})[_0xac31('0x26')](function(_0x33d352){_0xa92759['count']=_0x33d352;if(_0xa04199[_0xac31('0x3a')][_0xac31('0x4f')]){_0x4c3e3d[_0xac31('0x49')]=[{'all':!![]}];}return db[_0xac31('0x62')][_0xac31('0x4a')](_0x4c3e3d);})['then'](function(_0x15377f){_0xa92759[_0xac31('0x4b')]=_0x15377f;return _0xa92759;});}})['then'](respondWithFilteredResult(_0x287cd0,_0x4c3e3d))[_0xac31('0x4c')](handleError(_0x287cd0,null));};exports['getHopperHistories']=function(_0x574740,_0x27df73,_0x59595b){var _0x10264a={'raw':!![],'where':{}};var _0x24e1ad={};var _0x549afe={'count':0x0,'rows':[]};return db[_0xac31('0x36')]['findOne']({'where':{'id':_0x574740[_0xac31('0x5a')]['id']}})[_0xac31('0x26')](handleEntityNotFound(_0x27df73,null))[_0xac31('0x26')](function(_0x1331d0){if(_0x1331d0){_0x24e1ad[_0xac31('0x39')]=_[_0xac31('0x3b')](db[_0xac31('0x64')]['rawAttributes']);_0x24e1ad[_0xac31('0x3a')]=_[_0xac31('0x3b')](_0x574740[_0xac31('0x3a')]);_0x24e1ad[_0xac31('0x3c')]=_[_0xac31('0x3e')](_0x24e1ad[_0xac31('0x39')],_0x24e1ad[_0xac31('0x3a')]);_0x10264a['attributes']=_[_0xac31('0x3e')](_0x24e1ad[_0xac31('0x39')],qs[_0xac31('0x3f')](_0x574740[_0xac31('0x3a')][_0xac31('0x3f')]));_0x10264a['attributes']=_0x10264a[_0xac31('0x3d')][_0xac31('0x40')]?_0x10264a[_0xac31('0x3d')]:_0x24e1ad['model'];if(!_0x574740['query']['hasOwnProperty'](_0xac31('0x42'))){_0x10264a[_0xac31('0x1f')]=qs['limit'](_0x574740['query'][_0xac31('0x1f')]);_0x10264a[_0xac31('0x1e')]=qs[_0xac31('0x1e')](_0x574740[_0xac31('0x3a')][_0xac31('0x1e')]);}_0x10264a['order']=qs['sort'](_0x574740['query'][_0xac31('0x44')]);_0x10264a[_0xac31('0x45')]=qs[_0xac31('0x3c')](_['pick'](_0x574740['query'],_0x24e1ad[_0xac31('0x3c')]));_0x10264a[_0xac31('0x45')][_0xac31('0x63')]=_0x1331d0['id'];if(_0x574740['query'][_0xac31('0x2c')]){_0x10264a[_0xac31('0x45')]=_[_0xac31('0x47')](_0x10264a[_0xac31('0x45')],{'$or':_['map'](_0x10264a[_0xac31('0x3d')],function(_0x4c7d25){var _0x5993cf={};_0x5993cf[_0x4c7d25]={'$like':'%'+_0x574740[_0xac31('0x3a')]['filter']+'%'};return _0x5993cf;})});}_0x10264a=_[_0xac31('0x47')]({},_0x10264a,_0x574740['options']);return db[_0xac31('0x64')][_0xac31('0x20')]({'where':_0x10264a[_0xac31('0x45')]})['then'](function(_0x294ede){_0x549afe[_0xac31('0x20')]=_0x294ede;if(_0x574740['query'][_0xac31('0x4f')]){_0x10264a[_0xac31('0x49')]=[{'all':!![]}];}return db[_0xac31('0x64')]['findAll'](_0x10264a);})[_0xac31('0x26')](function(_0x5eb00d){_0x549afe[_0xac31('0x4b')]=_0x5eb00d;return _0x549afe;});}})['then'](respondWithFilteredResult(_0x27df73,_0x10264a))[_0xac31('0x4c')](handleError(_0x27df73,null));};exports[_0xac31('0x65')]=function(_0x227e5d,_0xaff2a,_0x3e7fd4){var _0x4f48c5={'raw':!![],'where':{}};var _0x5d82e9={};var _0x3b8f10={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xac31('0x61')]({'where':{'id':_0x227e5d['params']['id']}})[_0xac31('0x26')](handleEntityNotFound(_0xaff2a,null))[_0xac31('0x26')](function(_0x39f160){if(_0x39f160){_0x5d82e9[_0xac31('0x39')]=_[_0xac31('0x3b')](db[_0xac31('0x66')]['rawAttributes']);_0x5d82e9[_0xac31('0x3a')]=_[_0xac31('0x3b')](_0x227e5d[_0xac31('0x3a')]);_0x5d82e9[_0xac31('0x3c')]=_[_0xac31('0x3e')](_0x5d82e9[_0xac31('0x39')],_0x5d82e9[_0xac31('0x3a')]);_0x4f48c5[_0xac31('0x3d')]=_['intersection'](_0x5d82e9[_0xac31('0x39')],qs[_0xac31('0x3f')](_0x227e5d[_0xac31('0x3a')][_0xac31('0x3f')]));_0x4f48c5[_0xac31('0x3d')]=_0x4f48c5[_0xac31('0x3d')][_0xac31('0x40')]?_0x4f48c5['attributes']:_0x5d82e9['model'];if(!_0x227e5d[_0xac31('0x3a')][_0xac31('0x41')](_0xac31('0x42'))){_0x4f48c5[_0xac31('0x1f')]=qs[_0xac31('0x1f')](_0x227e5d[_0xac31('0x3a')][_0xac31('0x1f')]);_0x4f48c5[_0xac31('0x1e')]=qs[_0xac31('0x1e')](_0x227e5d[_0xac31('0x3a')][_0xac31('0x1e')]);}_0x4f48c5[_0xac31('0x43')]=qs[_0xac31('0x44')](_0x227e5d[_0xac31('0x3a')]['sort']);_0x4f48c5[_0xac31('0x45')]=qs[_0xac31('0x3c')](_[_0xac31('0x46')](_0x227e5d['query'],_0x5d82e9[_0xac31('0x3c')]));_0x4f48c5[_0xac31('0x45')][_0xac31('0x63')]=_0x39f160['id'];if(_0x227e5d[_0xac31('0x3a')][_0xac31('0x2c')]){_0x4f48c5[_0xac31('0x45')]=_['merge'](_0x4f48c5['where'],{'$or':_['map'](_0x4f48c5[_0xac31('0x3d')],function(_0x17cf75){var _0x4e0cd7={};_0x4e0cd7[_0x17cf75]={'$like':'%'+_0x227e5d[_0xac31('0x3a')]['filter']+'%'};return _0x4e0cd7;})});}_0x4f48c5=_[_0xac31('0x47')]({},_0x4f48c5,_0x227e5d[_0xac31('0x48')]);return db[_0xac31('0x66')][_0xac31('0x20')]({'where':_0x4f48c5[_0xac31('0x45')]})[_0xac31('0x26')](function(_0xba534e){_0x3b8f10[_0xac31('0x20')]=_0xba534e;if(_0x227e5d['query'][_0xac31('0x4f')]){_0x4f48c5['include']=[{'all':!![]}];}return db[_0xac31('0x66')][_0xac31('0x4a')](_0x4f48c5);})[_0xac31('0x26')](function(_0x537de0){_0x3b8f10['rows']=_0x537de0;return _0x3b8f10;});}})['then'](respondWithFilteredResult(_0xaff2a,_0x4f48c5))['catch'](handleError(_0xaff2a,null));};exports[_0xac31('0x67')]=function(_0x2c0d75,_0x5bf56e,_0x23be6a){var _0x48762f={'raw':!![],'where':{}};var _0x55499e={};var _0x1089df={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xac31('0x61')]({'where':{'id':_0x2c0d75[_0xac31('0x5a')]['id']}})[_0xac31('0x26')](handleEntityNotFound(_0x5bf56e,null))[_0xac31('0x26')](function(_0x326c35){if(_0x326c35){_0x55499e[_0xac31('0x39')]=_[_0xac31('0x3b')](db['CmHopperBlack'][_0xac31('0x4e')]);_0x55499e[_0xac31('0x3a')]=_[_0xac31('0x3b')](_0x2c0d75[_0xac31('0x3a')]);_0x55499e[_0xac31('0x3c')]=_[_0xac31('0x3e')](_0x55499e[_0xac31('0x39')],_0x55499e['query']);_0x48762f[_0xac31('0x3d')]=_[_0xac31('0x3e')](_0x55499e[_0xac31('0x39')],qs[_0xac31('0x3f')](_0x2c0d75[_0xac31('0x3a')][_0xac31('0x3f')]));_0x48762f[_0xac31('0x3d')]=_0x48762f[_0xac31('0x3d')][_0xac31('0x40')]?_0x48762f['attributes']:_0x55499e['model'];if(!_0x2c0d75['query'][_0xac31('0x41')](_0xac31('0x42'))){_0x48762f[_0xac31('0x1f')]=qs[_0xac31('0x1f')](_0x2c0d75[_0xac31('0x3a')]['limit']);_0x48762f[_0xac31('0x1e')]=qs['offset'](_0x2c0d75[_0xac31('0x3a')]['offset']);}_0x48762f[_0xac31('0x43')]=qs[_0xac31('0x44')](_0x2c0d75[_0xac31('0x3a')][_0xac31('0x44')]);_0x48762f[_0xac31('0x45')]=qs['filters'](_[_0xac31('0x46')](_0x2c0d75['query'],_0x55499e['filters']));_0x48762f[_0xac31('0x45')][_0xac31('0x63')]=_0x326c35['id'];if(_0x2c0d75[_0xac31('0x3a')][_0xac31('0x2c')]){_0x48762f['where']=_['merge'](_0x48762f[_0xac31('0x45')],{'$or':_['map'](_0x48762f['attributes'],function(_0x4301a2){var _0x5e974e={};_0x5e974e[_0x4301a2]={'$like':'%'+_0x2c0d75[_0xac31('0x3a')][_0xac31('0x2c')]+'%'};return _0x5e974e;})});}_0x48762f=_[_0xac31('0x47')]({},_0x48762f,_0x2c0d75[_0xac31('0x48')]);return db[_0xac31('0x68')][_0xac31('0x20')]({'where':_0x48762f[_0xac31('0x45')]})['then'](function(_0x41ff57){_0x1089df[_0xac31('0x20')]=_0x41ff57;if(_0x2c0d75[_0xac31('0x3a')][_0xac31('0x4f')]){_0x48762f[_0xac31('0x49')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xac31('0x4a')](_0x48762f);})['then'](function(_0x57fd73){_0x1089df['rows']=_0x57fd73;return _0x1089df;});}})[_0xac31('0x26')](respondWithFilteredResult(_0x5bf56e,_0x48762f))[_0xac31('0x4c')](handleError(_0x5bf56e,null));};exports[_0xac31('0x69')]=function(_0x27613b,_0x364515,_0x11cd41){var _0x32104c={};var _0x26e2c0={};var _0x15efe8;var _0x1f98e2;return db['VoiceQueue']['findOne']({'where':{'id':_0x27613b['params']['id']}})[_0xac31('0x26')](handleEntityNotFound(_0x364515,null))[_0xac31('0x26')](function(_0x51df12){if(_0x51df12){_0x15efe8=_0x51df12;_0x26e2c0[_0xac31('0x39')]=_[_0xac31('0x3b')](db['Team'][_0xac31('0x4e')]);_0x26e2c0[_0xac31('0x3a')]=_[_0xac31('0x3b')](_0x27613b['query']);_0x26e2c0[_0xac31('0x3c')]=_['intersection'](_0x26e2c0[_0xac31('0x39')],_0x26e2c0[_0xac31('0x3a')]);_0x32104c[_0xac31('0x3d')]=_['intersection'](_0x26e2c0[_0xac31('0x39')],qs[_0xac31('0x3f')](_0x27613b[_0xac31('0x3a')][_0xac31('0x3f')]));_0x32104c[_0xac31('0x3d')]=_0x32104c[_0xac31('0x3d')]['length']?_0x32104c[_0xac31('0x3d')]:_0x26e2c0[_0xac31('0x39')];_0x32104c[_0xac31('0x43')]=qs['sort'](_0x27613b[_0xac31('0x3a')][_0xac31('0x44')]);_0x32104c[_0xac31('0x45')]=qs[_0xac31('0x3c')](_[_0xac31('0x46')](_0x27613b['query'],_0x26e2c0[_0xac31('0x3c')]));if(_0x27613b[_0xac31('0x3a')][_0xac31('0x2c')]){_0x32104c['where']=_[_0xac31('0x47')](_0x32104c[_0xac31('0x45')],{'$or':_[_0xac31('0x2d')](_0x32104c[_0xac31('0x3d')],function(_0x4b689c){var _0xce8afd={};_0xce8afd[_0x4b689c]={'$like':'%'+_0x27613b[_0xac31('0x3a')][_0xac31('0x2c')]+'%'};return _0xce8afd;})});}_0x32104c=_[_0xac31('0x47')]({},_0x32104c,_0x27613b[_0xac31('0x48')]);return _0x15efe8[_0xac31('0x69')](_0x32104c);}})[_0xac31('0x26')](function(_0x2a614f){if(_0x2a614f){_0x1f98e2=_0x2a614f[_0xac31('0x40')];if(!_0x27613b[_0xac31('0x3a')][_0xac31('0x41')](_0xac31('0x42'))){_0x32104c[_0xac31('0x1f')]=qs[_0xac31('0x1f')](_0x27613b[_0xac31('0x3a')][_0xac31('0x1f')]);_0x32104c['offset']=qs[_0xac31('0x1e')](_0x27613b[_0xac31('0x3a')][_0xac31('0x1e')]);}return _0x15efe8[_0xac31('0x69')](_0x32104c);}})[_0xac31('0x26')](function(_0x13e98d){if(_0x13e98d){return _0x13e98d?{'count':_0x1f98e2,'rows':_0x13e98d}:null;}})[_0xac31('0x26')](respondWithResult(_0x364515,null))['catch'](handleError(_0x364515,null));};exports[_0xac31('0x6a')]=function(_0x11dc3d,_0x78ce8e,_0x31155f){var _0x504ed2=_0x11dc3d[_0xac31('0x51')]['teams'];var _0x218b8c=_[_0xac31('0x2d')](_0x504ed2,'id');return db['Team'][_0xac31('0x4a')]({'where':{'id':_0x218b8c},'attributes':['id'],'include':[{'model':db['User'],'as':_0xac31('0x6b'),'attributes':['id',_0xac31('0x31'),_0xac31('0x6c'),_0xac31('0x6d'),'interface'],'raw':!![]}]})['then'](function(_0x579632){if(_0x579632){var _0x377db0=_['flatMap'](_0x579632,function(_0x2cda69){var _0xdd775e=_0x2cda69[_0xac31('0x53')]({'plain':!![]});_0xdd775e[_0xac31('0x6b')][_0xac31('0x6e')](function(_0x42a87c){_0x42a87c['penalty']=_['find'](_0x504ed2,{'id':_0xdd775e['id']})[_0xac31('0x6f')];});return _0xdd775e[_0xac31('0x6b')];});return db[_0xac31('0x36')][_0xac31('0x30')]({'where':{'id':_0x11dc3d[_0xac31('0x5a')]['id']}})[_0xac31('0x26')](function(_0x378024){return db[_0xac31('0x70')]['transaction'](function(_0x96f67e){return _0x378024[_0xac31('0x6a')](_0x218b8c,{'transaction':_0x96f67e})['then'](function(){return BPromise[_0xac31('0x71')](_0x504ed2,function(_0x42bb52){return db[_0xac31('0x72')][_0xac31('0x73')]({'TeamId':_0x42bb52['id'],'VoiceQueueId':_0x11dc3d[_0xac31('0x5a')]['id'],'penalty':_0x42bb52['penalty']},{'transaction':_0x96f67e});});})[_0xac31('0x26')](function(){return BPromise[_0xac31('0x71')](_0x377db0,function(_0x43813f){return db[_0xac31('0x74')][_0xac31('0x75')]({'where':{'UserId':_0x43813f['id'],'VoiceQueueId':_0x11dc3d['params']['id']},'defaults':{'penalty':_0x43813f[_0xac31('0x6f')]},'transaction':_0x96f67e});});})[_0xac31('0x26')](function(){return BPromise['each'](_[_0xac31('0x2c')](_0x377db0,{'online':!![]}),function(_0x1f0cae){return db['UserVoiceQueueRt']['upsert']({'membername':_0x1f0cae[_0xac31('0x31')],'UserId':_0x1f0cae['id'],'queue_name':_0x378024['name'],'VoiceQueueId':_0x378024['id'],'interface':_['isNil'](_0x1f0cae[_0xac31('0x76')])?util[_0xac31('0x77')]('SIP/%s',_0x1f0cae[_0xac31('0x31')]):_0x1f0cae['interface'],'paused':_0x1f0cae[_0xac31('0x6d')]||![],'penalty':_0x1f0cae[_0xac31('0x6f')]},{'transaction':_0x96f67e});});})[_0xac31('0x26')](function(){_0x377db0[_0xac31('0x6e')](function(_0x6aad58){socket[_0xac31('0x78')](_0xac31('0x79'),{'UserId':_0x6aad58['id'],'VoiceQueueId':_0x378024['id']});});});});});}})[_0xac31('0x26')](respondWithStatusCode(_0x78ce8e,null))[_0xac31('0x4c')](handleError(_0x78ce8e,null));};exports[_0xac31('0x7a')]=function(_0x46e6ea,_0x2b8495,_0x4c544e){return db[_0xac31('0x7b')][_0xac31('0x4a')]({'where':{'id':_0x46e6ea[_0xac31('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db[_0xac31('0x7c')],'as':_0xac31('0x6b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2b8495,null))[_0xac31('0x26')](function(_0xc04e6f){var _0x1bcc37=_[_0xac31('0x2d')](_0xc04e6f,'id');var _0x1db5c8=[];var _0x5e405b=[];var _0x46a09b=squel['select']();_0x46a09b[_0xac31('0x7d')]('tq.TeamId')[_0xac31('0x7e')](_0xac31('0x7f'),'tq')['join'](_0xac31('0x80'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xac31('0x45')](_0xac31('0x81'),_0x46e6ea[_0xac31('0x5a')]['id']);for(var _0x2b4be8=0x0;_0x2b4be8<_0xc04e6f[_0xac31('0x40')];_0x2b4be8+=0x1){let _0x6752a4=_0xc04e6f[_0x2b4be8];for(var _0x16e8ad=0x0;_0x16e8ad<_0x6752a4['Agents']['length'];_0x16e8ad+=0x1){let _0x13c600=_0x6752a4[_0xac31('0x6b')][_0x16e8ad];var _0x5c853f=_0x46a09b[_0xac31('0x59')]();_0x5c853f[_0xac31('0x45')](_0xac31('0x82'),_0x13c600['id']);_0x5e405b[_0xac31('0x83')](db[_0xac31('0x70')][_0xac31('0x3a')](_0x5c853f[_0xac31('0x84')](),{'type':db[_0xac31('0x70')][_0xac31('0x85')][_0xac31('0x86')]})[_0xac31('0x26')](function(_0x2fee7b){if(_0x2fee7b[_0xac31('0x40')]===0x1){return _0x13c600['id'];}else{var _0x301fc4=_['every'](_[_0xac31('0x2d')](_0x2fee7b,'TeamId'),function(_0x1c4043){return _[_0xac31('0x2e')](_0x1bcc37,_0x1c4043);});if(_0x301fc4){return _0x13c600['id'];}}}));}}return BPromise['all'](_0x5e405b)['then'](function(_0x30dad3){_0x1db5c8=_(_0x1db5c8)[_0xac31('0x87')](_0x30dad3)[_0xac31('0x88')]()[_0xac31('0x56')]();return db[_0xac31('0x36')][_0xac31('0x30')]({'where':{'id':_0x46e6ea['params']['id']}})[_0xac31('0x26')](function(_0x31d22b){return db[_0xac31('0x70')][_0xac31('0x89')](function(_0x5f391f){return _0x31d22b[_0xac31('0x7a')](_0x46e6ea['query']['ids'],{'transaction':_0x5f391f})[_0xac31('0x26')](function(){if(!_[_0xac31('0x8a')](_0x1db5c8)){return _0x31d22b[_0xac31('0x8b')](_0x1db5c8,{'transaction':_0x5f391f})[_0xac31('0x26')](function(){return db[_0xac31('0x8c')]['destroy']({'where':{'VoiceQueueId':_0x46e6ea[_0xac31('0x5a')]['id'],'UserId':_0x1db5c8},'transaction':_0x5f391f});});}})['then'](function(){_0x1db5c8[_0xac31('0x6e')](function(_0x4d5ac2){socket[_0xac31('0x78')](_0xac31('0x8d'),{'UserId':_0x4d5ac2,'VoiceQueueId':_0x31d22b['id']});});});});});});})[_0xac31('0x26')](respondWithStatusCode(_0x2b8495,null))['catch'](handleError(_0x2b8495,null));};exports[_0xac31('0x8e')]=function(_0x463732,_0x6ecbf6,_0x102f6b){var _0x37b1fe,_0x5ed6a9;return db[_0xac31('0x36')][_0xac31('0x30')]({'where':{'id':_0x463732[_0xac31('0x5a')]['id']}})[_0xac31('0x26')](handleEntityNotFound(_0x6ecbf6,null))[_0xac31('0x26')](function(_0x545733){if(_0x545733){_0x5ed6a9=_0x545733;return _0x545733[_0xac31('0x8e')](_0x463732[_0xac31('0x51')]['ids'],_['omit'](_0x463732['body'],[_0xac31('0x8f'),'id'])||{})[_0xac31('0x90')](function(_0x1c43f4){for(var _0x393e28=0x0;_0x393e28<_0x463732[_0xac31('0x51')]['ids']['length'];_0x393e28+=0x1){socket[_0xac31('0x78')](_0xac31('0x79'),{'UserId':Number(_0x463732['body'][_0xac31('0x8f')][_0x393e28]),'VoiceQueueId':Number(_0x463732['params']['id'])});}return _0x1c43f4;});}})[_0xac31('0x26')](function(_0x4ccac2){_0x37b1fe=_0x4ccac2||[];if(_0x5ed6a9){return db[_0xac31('0x7c')][_0xac31('0x4a')]({'where':{'id':_0x463732[_0xac31('0x51')][_0xac31('0x8f')]},'attributes':['id',_0xac31('0x31'),_0xac31('0x6c'),_0xac31('0x6d'),_0xac31('0x76')],'raw':!![]});}})[_0xac31('0x26')](function(_0x24423c){if(!_[_0xac31('0x8a')](_0x24423c)){var _0x2aa5d4=[];for(var _0x4fb71d=0x0;_0x4fb71d<_0x24423c[_0xac31('0x40')];_0x4fb71d++){if(_0x24423c[_0x4fb71d]['online']){_0x2aa5d4[_0xac31('0x83')](db[_0xac31('0x8c')][_0xac31('0x73')]({'membername':_0x24423c[_0x4fb71d][_0xac31('0x31')],'UserId':_0x24423c[_0x4fb71d]['id'],'queue_name':_0x5ed6a9[_0xac31('0x31')],'VoiceQueueId':_0x5ed6a9['id'],'interface':_['isNil'](_0x24423c[_0x4fb71d]['interface'])?util[_0xac31('0x77')]('SIP/%s',_0x24423c[_0x4fb71d][_0xac31('0x31')]):_0x24423c[_0x4fb71d][_0xac31('0x76')],'paused':_0x24423c[_0x4fb71d][_0xac31('0x6d')]||![],'penalty':_0x463732['body'][_0xac31('0x6f')]||0x0}));}}return BPromise[_0xac31('0x91')](_0x2aa5d4);}})[_0xac31('0x26')](function(){return _0x37b1fe;})['then'](respondWithResult(_0x6ecbf6,null))[_0xac31('0x4c')](handleError(_0x6ecbf6,null));};exports[_0xac31('0x8b')]=function(_0x45a085,_0x544072,_0x5ca645){return db[_0xac31('0x36')]['find']({'where':{'id':_0x45a085[_0xac31('0x5a')]['id']}})[_0xac31('0x26')](handleEntityNotFound(_0x544072,null))[_0xac31('0x26')](function(_0x41f985){if(_0x41f985){return _0x41f985[_0xac31('0x8b')](_0x45a085[_0xac31('0x3a')]['ids'])[_0xac31('0x26')](function(){if(_[_0xac31('0x92')](_0x45a085['query'][_0xac31('0x8f')])){for(var _0x16dfaf=0x0;_0x16dfaf<_0x45a085['query'][_0xac31('0x8f')]['length'];_0x16dfaf+=0x1){socket[_0xac31('0x78')](_0xac31('0x8d'),{'UserId':Number(_0x45a085[_0xac31('0x3a')][_0xac31('0x8f')][_0x16dfaf]),'VoiceQueueId':Number(_0x45a085[_0xac31('0x5a')]['id'])});}}else{socket[_0xac31('0x78')]('userVoiceQueue:remove',{'UserId':Number(_0x45a085[_0xac31('0x3a')][_0xac31('0x8f')]),'VoiceQueueId':Number(_0x45a085[_0xac31('0x5a')]['id'])});}});}})[_0xac31('0x26')](function(_0x2ecca7){return db['UserVoiceQueueRt'][_0xac31('0x27')]({'where':{'VoiceQueueId':_0x45a085[_0xac31('0x5a')]['id'],'UserId':_0x45a085[_0xac31('0x3a')][_0xac31('0x8f')]}})[_0xac31('0x26')](function(){return _0x2ecca7;});})[_0xac31('0x26')](respondWithStatusCode(_0x544072,null))[_0xac31('0x4c')](handleError(_0x544072,null));};exports['getAgents']=function(_0x3226a4,_0x311494,_0xb4419b){var _0x2d62c6={};var _0x1ddd4f={};var _0x3742e1;var _0x6d0a34;return db[_0xac31('0x36')][_0xac31('0x61')]({'where':{'id':_0x3226a4[_0xac31('0x5a')]['id']}})[_0xac31('0x26')](handleEntityNotFound(_0x311494,null))[_0xac31('0x26')](function(_0x5926d0){if(_0x5926d0){_0x3742e1=_0x5926d0;_0x1ddd4f[_0xac31('0x39')]=_['keys'](db[_0xac31('0x7c')][_0xac31('0x4e')]);_0x1ddd4f['query']=_[_0xac31('0x3b')](_0x3226a4['query']);_0x1ddd4f[_0xac31('0x3c')]=_['intersection'](_0x1ddd4f[_0xac31('0x39')],_0x1ddd4f[_0xac31('0x3a')]);_0x2d62c6[_0xac31('0x3d')]=_[_0xac31('0x3e')](_0x1ddd4f[_0xac31('0x39')],qs[_0xac31('0x3f')](_0x3226a4[_0xac31('0x3a')][_0xac31('0x3f')]));_0x2d62c6[_0xac31('0x3d')]=_0x2d62c6[_0xac31('0x3d')][_0xac31('0x40')]?_0x2d62c6['attributes']:_0x1ddd4f['model'];_0x2d62c6[_0xac31('0x43')]=qs[_0xac31('0x44')](_0x3226a4[_0xac31('0x3a')]['sort']);_0x2d62c6['where']=qs[_0xac31('0x3c')](_['pick'](_0x3226a4[_0xac31('0x3a')],_0x1ddd4f['filters']));if(_0x3226a4[_0xac31('0x3a')][_0xac31('0x2c')]){_0x2d62c6[_0xac31('0x45')]=_[_0xac31('0x47')](_0x2d62c6['where'],{'$or':_[_0xac31('0x2d')](_0x2d62c6[_0xac31('0x3d')],function(_0x576a17){var _0x34fb1b={};_0x34fb1b[_0x576a17]={'$like':'%'+_0x3226a4[_0xac31('0x3a')]['filter']+'%'};return _0x34fb1b;})});}_0x2d62c6=_[_0xac31('0x47')]({},_0x2d62c6,_0x3226a4[_0xac31('0x48')]);return _0x3742e1[_0xac31('0x93')](_0x2d62c6);}})[_0xac31('0x26')](function(_0xd60e18){if(_0xd60e18){_0x6d0a34=_0xd60e18[_0xac31('0x40')];if(!_0x3226a4[_0xac31('0x3a')][_0xac31('0x41')](_0xac31('0x42'))){_0x2d62c6[_0xac31('0x1f')]=qs[_0xac31('0x1f')](_0x3226a4['query']['limit']);_0x2d62c6[_0xac31('0x1e')]=qs[_0xac31('0x1e')](_0x3226a4['query'][_0xac31('0x1e')]);}return _0x3742e1[_0xac31('0x93')](_0x2d62c6);}})[_0xac31('0x26')](function(_0x9d69ad){if(_0x9d69ad){return _0x9d69ad?{'count':_0x6d0a34,'rows':_0x9d69ad}:null;}})['then'](respondWithResult(_0x311494,null))['catch'](handleError(_0x311494,null));};exports['getMembers']=function(_0x27e4de,_0x4abef0,_0x355cea){var _0x18078e={};var _0x1ae04a={};var _0x2f09f3;var _0x45bc22;return db[_0xac31('0x36')][_0xac31('0x61')]({'where':{'id':_0x27e4de[_0xac31('0x5a')]['id']}})[_0xac31('0x26')](handleEntityNotFound(_0x4abef0,null))[_0xac31('0x26')](function(_0x452d36){if(_0x452d36){_0x2f09f3=_0x452d36;_0x1ae04a[_0xac31('0x39')]=_['keys'](db[_0xac31('0x8c')][_0xac31('0x4e')]);_0x1ae04a[_0xac31('0x3a')]=_[_0xac31('0x3b')](_0x27e4de[_0xac31('0x3a')]);_0x1ae04a[_0xac31('0x3c')]=_[_0xac31('0x3e')](_0x1ae04a[_0xac31('0x39')],_0x1ae04a[_0xac31('0x3a')]);_0x18078e[_0xac31('0x3d')]=_[_0xac31('0x3e')](_0x1ae04a[_0xac31('0x39')],qs[_0xac31('0x3f')](_0x27e4de[_0xac31('0x3a')][_0xac31('0x3f')]));_0x18078e['attributes']=_0x18078e[_0xac31('0x3d')]['length']?_0x18078e[_0xac31('0x3d')]:_0x1ae04a[_0xac31('0x39')];_0x18078e['order']=qs[_0xac31('0x44')](_0x27e4de[_0xac31('0x3a')][_0xac31('0x44')]);_0x18078e[_0xac31('0x45')]=qs[_0xac31('0x3c')](_[_0xac31('0x46')](_0x27e4de[_0xac31('0x3a')],_0x1ae04a[_0xac31('0x3c')]));if(_0x27e4de[_0xac31('0x3a')][_0xac31('0x2c')]){_0x18078e[_0xac31('0x45')]=_[_0xac31('0x47')](_0x18078e[_0xac31('0x45')],{'$or':_[_0xac31('0x2d')](_0x18078e[_0xac31('0x3d')],function(_0xb05598){var _0x37a883={};_0x37a883[_0xb05598]={'$like':'%'+_0x27e4de[_0xac31('0x3a')][_0xac31('0x2c')]+'%'};return _0x37a883;})});}_0x18078e=_[_0xac31('0x47')]({},_0x18078e,_0x27e4de[_0xac31('0x48')]);return _0x2f09f3[_0xac31('0x94')](_0x18078e);}})[_0xac31('0x26')](function(_0x4f412f){if(_0x4f412f){_0x45bc22=_0x4f412f[_0xac31('0x40')];if(!_0x27e4de['query'][_0xac31('0x41')](_0xac31('0x42'))){_0x18078e[_0xac31('0x1f')]=qs[_0xac31('0x1f')](_0x27e4de[_0xac31('0x3a')][_0xac31('0x1f')]);_0x18078e[_0xac31('0x1e')]=qs[_0xac31('0x1e')](_0x27e4de['query'][_0xac31('0x1e')]);}return _0x2f09f3[_0xac31('0x94')](_0x18078e);}})[_0xac31('0x26')](function(_0x15a3ca){return _0x15a3ca?{'count':_0x45bc22,'rows':_0x15a3ca}:null;})[_0xac31('0x26')](respondWithResult(_0x4abef0,null))[_0xac31('0x4c')](handleError(_0x4abef0,null));};exports[_0xac31('0x95')]=function(_0x2b4246,_0x356634,_0x4677a2){var _0x233690={};var _0x475b2b={};var _0x2688dd;var _0x55a647;return db['VoiceQueue']['findOne']({'where':{'id':_0x2b4246['params']['id']}})[_0xac31('0x26')](handleEntityNotFound(_0x356634,null))['then'](function(_0x1b5b1d){if(_0x1b5b1d){_0x2688dd=_0x1b5b1d;_0x475b2b['model']=_[_0xac31('0x3b')](db[_0xac31('0x96')][_0xac31('0x4e')]);_0x475b2b['query']=_[_0xac31('0x3b')](_0x2b4246[_0xac31('0x3a')]);_0x475b2b['filters']=_[_0xac31('0x3e')](_0x475b2b[_0xac31('0x39')],_0x475b2b[_0xac31('0x3a')]);_0x233690['attributes']=_[_0xac31('0x3e')](_0x475b2b['model'],qs[_0xac31('0x3f')](_0x2b4246[_0xac31('0x3a')][_0xac31('0x3f')]));_0x233690[_0xac31('0x3d')]=_0x233690['attributes']['length']?_0x233690[_0xac31('0x3d')]:_0x475b2b['model'];_0x233690[_0xac31('0x43')]=qs['sort'](_0x2b4246[_0xac31('0x3a')][_0xac31('0x44')]);_0x233690[_0xac31('0x45')]=qs[_0xac31('0x3c')](_[_0xac31('0x46')](_0x2b4246['query'],_0x475b2b[_0xac31('0x3c')]));if(_0x2b4246[_0xac31('0x3a')][_0xac31('0x2c')]){_0x233690['where']=_['merge'](_0x233690['where'],{'$or':_[_0xac31('0x2d')](_0x233690[_0xac31('0x3d')],function(_0x14a022){var _0xe55a0={};_0xe55a0[_0x14a022]={'$like':'%'+_0x2b4246[_0xac31('0x3a')][_0xac31('0x2c')]+'%'};return _0xe55a0;})});}_0x233690=_[_0xac31('0x47')]({},_0x233690,_0x2b4246[_0xac31('0x48')]);return _0x2688dd[_0xac31('0x95')](_0x233690);}})['then'](function(_0x1c12f2){if(_0x1c12f2){_0x55a647=_0x1c12f2['length'];if(!_0x2b4246[_0xac31('0x3a')][_0xac31('0x41')]('nolimit')){_0x233690['limit']=qs[_0xac31('0x1f')](_0x2b4246[_0xac31('0x3a')][_0xac31('0x1f')]);_0x233690[_0xac31('0x1e')]=qs[_0xac31('0x1e')](_0x2b4246['query'][_0xac31('0x1e')]);}return _0x2688dd[_0xac31('0x95')](_0x233690);}})[_0xac31('0x26')](function(_0x45d723){if(_0x45d723){return _0x45d723?{'count':_0x55a647,'rows':_0x45d723}:null;}})[_0xac31('0x26')](respondWithResult(_0x356634,null))[_0xac31('0x4c')](handleError(_0x356634,null));};exports[_0xac31('0x97')]=function(_0x1a5868,_0x4af079,_0x1975b4){var _0x22c448,_0x328c72;return db[_0xac31('0x36')][_0xac31('0x30')]({'where':{'id':_0x1a5868[_0xac31('0x5a')]['id']}})[_0xac31('0x26')](handleEntityNotFound(_0x4af079,null))[_0xac31('0x26')](function(_0x2c34b3){if(_0x2c34b3){_0x328c72=_0x2c34b3;return _0x2c34b3[_0xac31('0x97')](_0x1a5868['body'][_0xac31('0x8f')],_[_0xac31('0x5b')](_0x1a5868[_0xac31('0x51')],[_0xac31('0x8f'),'id'])||{});}return null;})[_0xac31('0x90')](function(_0x39bec0){var _0x16a6e1;_0x22c448=_0x39bec0||[];var _0xf556f=[];if(_0x39bec0){for(var _0x342981=0x0;_0x342981<_0x39bec0[_0xac31('0x40')];_0x342981+=0x1){var _0x2cdd4c=_0x39bec0[_0x342981][_0xac31('0x53')]({'plain':!![]});_0x328c72[_0xac31('0x98')]=_0x1a5868[_0xac31('0x51')]['dialCheckDuplicateType']?_0x1a5868[_0xac31('0x51')][_0xac31('0x98')]:_0x328c72[_0xac31('0x98')];switch(_0x328c72['dialCheckDuplicateType']){case _0xac31('0x99'):_0x16a6e1=squel[_0xac31('0x9a')]()[_0xac31('0x9b')](_0xac31('0x9c'))[_0xac31('0x9d')]([_0xac31('0x9e'),'scheduledAt',_0xac31('0x9f'),'ListId',_0xac31('0x63'),_0xac31('0x5c'),_0xac31('0x5d')],squel[_0xac31('0xa0')]()[_0xac31('0x7d')](_0xac31('0x9e'),'phone')[_0xac31('0x7d')]('NOW()','scheduledAt')['field']('id',_0xac31('0x9f'))['field'](_0x2cdd4c[_0xac31('0xa1')][_0xac31('0x84')](),_0xac31('0xa2'))['field'](_0x1a5868[_0xac31('0x5a')]['id'][_0xac31('0x84')](),'VoiceQueueId')[_0xac31('0x7d')]('NOW()',_0xac31('0x5c'))[_0xac31('0x7d')](_0xac31('0xa3'),'updatedAt')['from'](_0xac31('0xa4'))[_0xac31('0x45')](_0xac31('0xa5'))['where'](_0xac31('0xa6'),_0x2cdd4c[_0xac31('0xa1')][_0xac31('0x84')]())[_0xac31('0x45')](_0xac31('0xa7'))[_0xac31('0x45')](_0xac31('0xa8'),squel['select']()[_0xac31('0x7d')](_0xac31('0xa9'))['from'](_0xac31('0xaa'))[_0xac31('0x45')](_0xac31('0x81'),_0x1a5868[_0xac31('0x5a')]['id'][_0xac31('0x84')]()))[_0xac31('0x45')](_0xac31('0xa8'),squel[_0xac31('0xa0')]()[_0xac31('0x7d')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0xac31('0x45')](_0xac31('0x81'),_0x1a5868['params']['id'][_0xac31('0x84')]())))[_0xac31('0x84')]();break;case _0xac31('0xab'):_0x16a6e1=squel['insert']()['into'](_0xac31('0x9c'))['fromQuery']([_0xac31('0x9e'),_0xac31('0xac'),_0xac31('0x9f'),_0xac31('0xa2'),'VoiceQueueId','createdAt','updatedAt'],squel[_0xac31('0xa0')]()[_0xac31('0x7d')](_0xac31('0x9e'),_0xac31('0x9e'))[_0xac31('0x7d')](_0xac31('0xa3'),_0xac31('0xac'))[_0xac31('0x7d')]('id',_0xac31('0x9f'))['field'](_0x2cdd4c['CmListId'][_0xac31('0x84')](),_0xac31('0xa2'))['field'](_0x1a5868[_0xac31('0x5a')]['id']['toString'](),_0xac31('0x63'))[_0xac31('0x7d')]('NOW()','createdAt')[_0xac31('0x7d')](_0xac31('0xa3'),'updatedAt')[_0xac31('0x7e')](_0xac31('0xa4'))[_0xac31('0x45')](_0xac31('0xa5'))['where']('ListId\x20=\x20?',_0x2cdd4c[_0xac31('0xa1')][_0xac31('0x84')]())[_0xac31('0x45')](_0xac31('0xa7'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xac31('0xa0')]()[_0xac31('0x7d')]('COALESCE(phone,\x27\x27)')[_0xac31('0x7e')](_0xac31('0x9c'))[_0xac31('0x45')](_0xac31('0x81'),_0x1a5868[_0xac31('0x5a')]['id'][_0xac31('0x84')]())))[_0xac31('0x84')]();break;default:_0x16a6e1=squel[_0xac31('0x9a')]()[_0xac31('0x9b')](_0xac31('0x9c'))[_0xac31('0x9d')]([_0xac31('0x9e'),_0xac31('0xac'),_0xac31('0x9f'),_0xac31('0xa2'),_0xac31('0x63'),'createdAt',_0xac31('0x5d')],squel[_0xac31('0xa0')]()[_0xac31('0x7d')](_0xac31('0x9e'),_0xac31('0x9e'))['field'](_0xac31('0xa3'),_0xac31('0xac'))['field']('id',_0xac31('0x9f'))[_0xac31('0x7d')](_0x2cdd4c['CmListId'][_0xac31('0x84')](),_0xac31('0xa2'))[_0xac31('0x7d')](_0x1a5868[_0xac31('0x5a')]['id'][_0xac31('0x84')](),_0xac31('0x63'))['field'](_0xac31('0xa3'),_0xac31('0x5c'))[_0xac31('0x7d')](_0xac31('0xa3'),_0xac31('0x5d'))['from'](_0xac31('0xa4'))[_0xac31('0x45')](_0xac31('0xa5'))[_0xac31('0x45')](_0xac31('0xa6'),_0x2cdd4c[_0xac31('0xa1')][_0xac31('0x84')]())[_0xac31('0x45')](_0xac31('0xa7')))[_0xac31('0x84')]();}_0xf556f[_0xac31('0x83')](db['sequelize']['query'](_0x16a6e1));}return BPromise['all'](_0xf556f);}})[_0xac31('0x26')](function(){return _0x22c448;})[_0xac31('0x26')](respondWithResult(_0x4af079,null))[_0xac31('0x4c')](handleError(_0x4af079,null));};exports[_0xac31('0xad')]=function(_0x4c7029,_0x26ee77,_0x2e3691){return db[_0xac31('0x36')][_0xac31('0x30')]({'where':{'id':_0x4c7029[_0xac31('0x5a')]['id']}})['then'](handleEntityNotFound(_0x26ee77,null))['then'](function(_0x36fba8){if(_0x36fba8){return _0x36fba8[_0xac31('0xad')](_0x4c7029['query'][_0xac31('0x8f')]);}})['then'](function(_0x1bf297){if(_0x1bf297){return db[_0xac31('0x62')]['destroy']({'where':{'ListId':_0x4c7029[_0xac31('0x3a')][_0xac31('0x8f')],'VoiceQueueId':_0x4c7029[_0xac31('0x5a')]['id']}})[_0xac31('0x26')](function(){return _0x1bf297;});}})[_0xac31('0x26')](respondWithStatusCode(_0x26ee77,null))[_0xac31('0x4c')](handleError(_0x26ee77,null));};exports['getBlackLists']=function(_0x223c16,_0x2a97fa,_0x4c1c73){var _0x267188={};var _0x4e34a6={};var _0x4c6af0;var _0x552ec2;return db[_0xac31('0x36')][_0xac31('0x61')]({'where':{'id':_0x223c16['params']['id']}})[_0xac31('0x26')](handleEntityNotFound(_0x2a97fa,null))['then'](function(_0x6b949f){if(_0x6b949f){_0x4c6af0=_0x6b949f;_0x4e34a6[_0xac31('0x39')]=_['keys'](db[_0xac31('0x96')][_0xac31('0x4e')]);_0x4e34a6[_0xac31('0x3a')]=_[_0xac31('0x3b')](_0x223c16[_0xac31('0x3a')]);_0x4e34a6['filters']=_[_0xac31('0x3e')](_0x4e34a6[_0xac31('0x39')],_0x4e34a6['query']);_0x267188[_0xac31('0x3d')]=_[_0xac31('0x3e')](_0x4e34a6[_0xac31('0x39')],qs[_0xac31('0x3f')](_0x223c16[_0xac31('0x3a')][_0xac31('0x3f')]));_0x267188[_0xac31('0x3d')]=_0x267188[_0xac31('0x3d')]['length']?_0x267188[_0xac31('0x3d')]:_0x4e34a6[_0xac31('0x39')];_0x267188['order']=qs[_0xac31('0x44')](_0x223c16['query']['sort']);_0x267188[_0xac31('0x45')]=qs['filters'](_[_0xac31('0x46')](_0x223c16[_0xac31('0x3a')],_0x4e34a6[_0xac31('0x3c')]));if(_0x223c16[_0xac31('0x3a')]['filter']){_0x267188[_0xac31('0x45')]=_[_0xac31('0x47')](_0x267188[_0xac31('0x45')],{'$or':_['map'](_0x267188[_0xac31('0x3d')],function(_0x1b439f){var _0x1c563f={};_0x1c563f[_0x1b439f]={'$like':'%'+_0x223c16[_0xac31('0x3a')][_0xac31('0x2c')]+'%'};return _0x1c563f;})});}_0x267188=_[_0xac31('0x47')]({},_0x267188,_0x223c16['options']);return _0x4c6af0['getBlackLists'](_0x267188);}})[_0xac31('0x26')](function(_0x597113){if(_0x597113){_0x552ec2=_0x597113[_0xac31('0x40')];if(!_0x223c16['query'][_0xac31('0x41')](_0xac31('0x42'))){_0x267188[_0xac31('0x1f')]=qs[_0xac31('0x1f')](_0x223c16[_0xac31('0x3a')][_0xac31('0x1f')]);_0x267188[_0xac31('0x1e')]=qs['offset'](_0x223c16[_0xac31('0x3a')]['offset']);}return _0x4c6af0[_0xac31('0xae')](_0x267188);}})[_0xac31('0x26')](function(_0xfecf36){if(_0xfecf36){return _0xfecf36?{'count':_0x552ec2,'rows':_0xfecf36}:null;}})[_0xac31('0x26')](respondWithResult(_0x2a97fa,null))[_0xac31('0x4c')](handleError(_0x2a97fa,null));};exports[_0xac31('0xaf')]=function(_0x1d4aa9,_0xfee4e7,_0x5c5cc1){var _0x2f3899,_0x524095;return db[_0xac31('0x36')][_0xac31('0x30')]({'where':{'id':_0x1d4aa9[_0xac31('0x5a')]['id']}})[_0xac31('0x26')](handleEntityNotFound(_0xfee4e7,null))[_0xac31('0x26')](function(_0x342348){if(_0x342348){_0x524095=_0x342348;return _0x342348[_0xac31('0xaf')](_0x1d4aa9['body'][_0xac31('0x8f')],_['omit'](_0x1d4aa9['body'],[_0xac31('0x8f'),'id'])||{});}return null;})[_0xac31('0x90')](function(_0x132d58){var _0x476b9b;_0x2f3899=_0x132d58||[];var _0x4fefef=[];if(_0x132d58){for(var _0x3df5c2=0x0;_0x3df5c2<_0x132d58[_0xac31('0x40')];_0x3df5c2+=0x1){var _0x323e31=_0x132d58[_0x3df5c2][_0xac31('0x53')]({'plain':!![]});_0x476b9b=squel[_0xac31('0x9a')]()[_0xac31('0x9b')]('cm_hopper_black')['fromQuery']([_0xac31('0x9e'),'ContactId',_0xac31('0xa2'),_0xac31('0x63'),_0xac31('0x5c'),'updatedAt'],squel['select']()[_0xac31('0x7d')]('phone','phone')['field']('id',_0xac31('0x9f'))[_0xac31('0x7d')](_0x323e31[_0xac31('0xa1')][_0xac31('0x84')](),_0xac31('0xa2'))['field'](_0x1d4aa9[_0xac31('0x5a')]['id']['toString'](),_0xac31('0x63'))[_0xac31('0x7d')]('NOW()',_0xac31('0x5c'))[_0xac31('0x7d')]('NOW()',_0xac31('0x5d'))[_0xac31('0x7e')]('cm_contacts')[_0xac31('0x45')]('deletedAt\x20IS\x20NULL')[_0xac31('0x45')](_0xac31('0xa6'),_0x323e31['CmListId']['toString']())[_0xac31('0x45')](_0xac31('0xa7')))[_0xac31('0x84')]();_0x4fefef[_0xac31('0x83')](db[_0xac31('0x70')]['query'](_0x476b9b));}return BPromise[_0xac31('0x91')](_0x4fefef);}})['then'](function(){return _0x2f3899;})[_0xac31('0x26')](respondWithResult(_0xfee4e7,null))['catch'](handleError(_0xfee4e7,null));};exports[_0xac31('0xb0')]=function(_0x935c10,_0x943b06,_0x140a35){return db[_0xac31('0x36')][_0xac31('0x30')]({'where':{'id':_0x935c10[_0xac31('0x5a')]['id']}})[_0xac31('0x26')](handleEntityNotFound(_0x943b06,null))['then'](function(_0x155503){if(_0x155503){return _0x155503[_0xac31('0xb0')](_0x935c10['query'][_0xac31('0x8f')]);}})[_0xac31('0x26')](function(_0x2cf4ff){if(_0x2cf4ff){return db[_0xac31('0x68')]['destroy']({'where':{'ListId':_0x935c10[_0xac31('0x3a')]['ids'],'VoiceQueueId':_0x935c10[_0xac31('0x5a')]['id']}})[_0xac31('0x26')](function(){return _0x2cf4ff;});}})[_0xac31('0x26')](respondWithStatusCode(_0x943b06,null))['catch'](handleError(_0x943b06,null));}; \ No newline at end of file +var _0xb5db=['CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','ContactId','phone','NOW()','scheduledAt','toString','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','CmListId','phone\x20NOT\x20IN\x20(?)','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueue.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','inbound','QueueCampaigns','filter','ignore','map','value','includes','type','find','name','UserProfileResource','then','error','stack','send','index','VoiceQueue','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','show','keys','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','outbound','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','role','VoiceQueues','UserProfileSection','userProfileId','params','getHoppers','findOne','CmHopper','rawAttributes','sort','VoiceQueueId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','addTeams','teams','User','Agents','voicePause','interface','flatMap','penalty','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','Team','select','field','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','TeamId','all','union','compact','isEmpty','forEach','userVoiceQueue:remove','addAgents','ids','spread','online','removeAgents','isArray','getAgents','getMembers','getLists'];(function(_0x2b37aa,_0x1d40dc){var _0x52b73d=function(_0x5eb623){while(--_0x5eb623){_0x2b37aa['push'](_0x2b37aa['shift']());}};_0x52b73d(++_0x1d40dc);}(_0xb5db,0xd9));var _0xbb5d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb5db[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xbb5d('0x0'));var rimraf=require(_0xbb5d('0x1'));var zipdir=require(_0xbb5d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbb5d('0x3'));var moment=require(_0xbb5d('0x4'));var BPromise=require(_0xbb5d('0x5'));var Mustache=require(_0xbb5d('0x6'));var util=require(_0xbb5d('0x7'));var path=require('path');var sox=require(_0xbb5d('0x8'));var csv=require(_0xbb5d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb5d('0xa'));var _=require('lodash');var squel=require(_0xbb5d('0xb'));var crypto=require('crypto');var jsforce=require(_0xbb5d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbb5d('0x9'));var querystring=require(_0xbb5d('0xd'));var Papa=require(_0xbb5d('0xe'));var Redis=require('ioredis');var authService=require(_0xbb5d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xbb5d('0x10'));var hardwareService=require(_0xbb5d('0x11'));var logger=require(_0xbb5d('0x12'))(_0xbb5d('0x13'));var utils=require(_0xbb5d('0x14'));var config=require(_0xbb5d('0x15'));var licenseUtil=require(_0xbb5d('0x16'));var db=require(_0xbb5d('0x17'))['db'];config[_0xbb5d('0x18')]=_[_0xbb5d('0x19')](config[_0xbb5d('0x18')],{'host':_0xbb5d('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbb5d('0x18')]));require(_0xbb5d('0x1b'))[_0xbb5d('0x1c')](socket);function respondWithStatusCode(_0x4efe98,_0x4b1a8d){_0x4b1a8d=_0x4b1a8d||0xcc;return function(_0x13c9b1){if(_0x13c9b1){return _0x4efe98['sendStatus'](_0x4b1a8d);}return _0x4efe98[_0xbb5d('0x1d')](_0x4b1a8d)[_0xbb5d('0x1e')]();};}function respondWithResult(_0x2f4742,_0x4a8192){_0x4a8192=_0x4a8192||0xc8;return function(_0x5c79b0){if(_0x5c79b0){return _0x2f4742['status'](_0x4a8192)[_0xbb5d('0x1f')](_0x5c79b0);}};}function respondWithFilteredResult(_0x472727,_0x354531){return function(_0x1a7397){if(_0x1a7397){var _0x18f910=typeof _0x354531[_0xbb5d('0x20')]===_0xbb5d('0x21')&&typeof _0x354531['limit']===_0xbb5d('0x21');var _0x5ba641=_0x1a7397[_0xbb5d('0x22')];var _0x1d4090=_0x18f910?0x0:_0x354531[_0xbb5d('0x20')];var _0x4d8085=_0x18f910?_0x1a7397['count']:_0x354531[_0xbb5d('0x20')]+_0x354531[_0xbb5d('0x23')];var _0x1babe7;if(_0x4d8085>=_0x5ba641){_0x4d8085=_0x5ba641;_0x1babe7=0xc8;}else{_0x1babe7=0xce;}_0x472727[_0xbb5d('0x1d')](_0x1babe7);return _0x472727[_0xbb5d('0x24')](_0xbb5d('0x25'),_0x1d4090+'-'+_0x4d8085+'/'+_0x5ba641)[_0xbb5d('0x1f')](_0x1a7397);}return null;};}function patchUpdates(_0x44f29f){return function(_0x1f8633){try{jsonpatch[_0xbb5d('0x26')](_0x1f8633,_0x44f29f,!![]);}catch(_0x32363c){return BPromise[_0xbb5d('0x27')](_0x32363c);}return _0x1f8633[_0xbb5d('0x28')]();};}function saveUpdates(_0x462302,_0x4c9c57){return function(_0x51cc45){if(_0x51cc45){return _0x51cc45[_0xbb5d('0x29')](_0x462302)['then'](function(_0x3c0755){return _0x3c0755;});}return null;};}function removeEntity(_0x113c58,_0x43b22d){return function(_0x26c922){if(_0x26c922){return _0x26c922[_0xbb5d('0x2a')]()['then'](function(){var _0x489fc4=_0x26c922['get']({'plain':!![]});var _0x14ef52=[{'name':'VoiceQueues','value':_0xbb5d('0x2b'),'ignore':![]},{'name':_0xbb5d('0x2c'),'value':'outbound','ignore':![]}];var _0x1b415d=_(_0x14ef52)[_0xbb5d('0x2d')](_0xbb5d('0x2e'))[_0xbb5d('0x2f')](_0xbb5d('0x30'))[_0xbb5d('0x30')]();if(_[_0xbb5d('0x31')](_0x1b415d,_0x489fc4[_0xbb5d('0x32')])){return;}var _0x44ad34=_[_0xbb5d('0x33')](_0x14ef52,[_0xbb5d('0x30'),_0x489fc4[_0xbb5d('0x32')]])[_0xbb5d('0x34')];return db[_0xbb5d('0x35')][_0xbb5d('0x2a')]({'where':{'type':_0x44ad34,'resourceId':_0x489fc4['id']}})[_0xbb5d('0x36')](function(){return _0x26c922;});})[_0xbb5d('0x36')](function(){_0x113c58['status'](0xcc)[_0xbb5d('0x1e')]();});}};}function handleEntityNotFound(_0x1ae590,_0x214714){return function(_0x5a58f9){if(!_0x5a58f9){_0x1ae590['sendStatus'](0x194);}return _0x5a58f9;};}function handleError(_0x1654e1,_0x13abca){_0x13abca=_0x13abca||0x1f4;return function(_0x542e7d){logger[_0xbb5d('0x37')](_0x542e7d[_0xbb5d('0x38')]);if(_0x542e7d[_0xbb5d('0x34')]){delete _0x542e7d[_0xbb5d('0x34')];}_0x1654e1['status'](_0x13abca)[_0xbb5d('0x39')](_0x542e7d);};}exports[_0xbb5d('0x3a')]=function(_0x24727c,_0x2b93bd){var _0x5c12b1={},_0x1951ba={},_0x2b2d56={'count':0x0,'rows':[]};var _0x4d716b=_['map'](db[_0xbb5d('0x3b')]['rawAttributes'],function(_0x44b4ad){return{'name':_0x44b4ad['fieldName'],'type':_0x44b4ad['type'][_0xbb5d('0x3c')]};});_0x1951ba[_0xbb5d('0x3d')]=_[_0xbb5d('0x2f')](_0x4d716b,_0xbb5d('0x34'));_0x1951ba[_0xbb5d('0x3e')]=_['keys'](_0x24727c[_0xbb5d('0x3e')]);_0x1951ba[_0xbb5d('0x3f')]=_[_0xbb5d('0x40')](_0x1951ba[_0xbb5d('0x3d')],_0x1951ba[_0xbb5d('0x3e')]);_0x5c12b1[_0xbb5d('0x41')]=_[_0xbb5d('0x40')](_0x1951ba['model'],qs[_0xbb5d('0x42')](_0x24727c[_0xbb5d('0x3e')]['fields']));_0x5c12b1[_0xbb5d('0x41')]=_0x5c12b1[_0xbb5d('0x41')][_0xbb5d('0x43')]?_0x5c12b1[_0xbb5d('0x41')]:_0x1951ba[_0xbb5d('0x3d')];if(!_0x24727c[_0xbb5d('0x3e')][_0xbb5d('0x44')](_0xbb5d('0x45'))){_0x5c12b1[_0xbb5d('0x23')]=qs[_0xbb5d('0x23')](_0x24727c[_0xbb5d('0x3e')][_0xbb5d('0x23')]);_0x5c12b1[_0xbb5d('0x20')]=qs[_0xbb5d('0x20')](_0x24727c['query'][_0xbb5d('0x20')]);}_0x5c12b1[_0xbb5d('0x46')]=qs['sort'](_0x24727c['query']['sort']);_0x5c12b1[_0xbb5d('0x47')]=qs[_0xbb5d('0x3f')](_[_0xbb5d('0x48')](_0x24727c[_0xbb5d('0x3e')],_0x1951ba[_0xbb5d('0x3f')]),_0x4d716b);if(_0x24727c['query'][_0xbb5d('0x2d')]){_0x5c12b1[_0xbb5d('0x47')]=_[_0xbb5d('0x49')](_0x5c12b1[_0xbb5d('0x47')],{'$or':_[_0xbb5d('0x2f')](_0x4d716b,function(_0x113168){if(_0x113168[_0xbb5d('0x32')]!==_0xbb5d('0x4a')){var _0xc01040={};_0xc01040[_0x113168[_0xbb5d('0x34')]]={'$like':'%'+_0x24727c[_0xbb5d('0x3e')][_0xbb5d('0x2d')]+'%'};return _0xc01040;}})});}_0x5c12b1=_[_0xbb5d('0x49')]({},_0x5c12b1,_0x24727c[_0xbb5d('0x4b')]);var _0x4f22fd={'where':_0x5c12b1[_0xbb5d('0x47')]};return db[_0xbb5d('0x3b')]['count'](_0x4f22fd)[_0xbb5d('0x36')](function(_0x516dcf){_0x2b2d56['count']=_0x516dcf;if(_0x24727c[_0xbb5d('0x3e')][_0xbb5d('0x4c')]){_0x5c12b1[_0xbb5d('0x4d')]=[{'all':!![]}];}return db['VoiceQueue']['findAll'](_0x5c12b1);})['then'](function(_0x1d841e){_0x2b2d56[_0xbb5d('0x4e')]=_0x1d841e;return _0x2b2d56;})[_0xbb5d('0x36')](respondWithFilteredResult(_0x2b93bd,_0x5c12b1))[_0xbb5d('0x4f')](handleError(_0x2b93bd,null));};exports[_0xbb5d('0x50')]=function(_0x16ffa0,_0xc42d62){var _0x51f358={'raw':![],'where':{'id':_0x16ffa0['params']['id']}},_0x2bf48d={};_0x2bf48d[_0xbb5d('0x3d')]=_[_0xbb5d('0x51')](db[_0xbb5d('0x3b')]['rawAttributes']);_0x2bf48d['query']=_['keys'](_0x16ffa0[_0xbb5d('0x3e')]);_0x2bf48d[_0xbb5d('0x3f')]=_['intersection'](_0x2bf48d[_0xbb5d('0x3d')],_0x2bf48d[_0xbb5d('0x3e')]);_0x51f358[_0xbb5d('0x41')]=_['intersection'](_0x2bf48d[_0xbb5d('0x3d')],qs['fields'](_0x16ffa0[_0xbb5d('0x3e')][_0xbb5d('0x42')]));_0x51f358['attributes']=_0x51f358[_0xbb5d('0x41')]['length']?_0x51f358[_0xbb5d('0x41')]:_0x2bf48d['model'];if(_0x16ffa0[_0xbb5d('0x3e')]['includeAll']){_0x51f358['include']=[{'all':!![]}];}_0x51f358=_[_0xbb5d('0x49')]({},_0x51f358,_0x16ffa0['options']);return db[_0xbb5d('0x3b')][_0xbb5d('0x33')](_0x51f358)[_0xbb5d('0x36')](handleEntityNotFound(_0xc42d62,null))[_0xbb5d('0x36')](respondWithResult(_0xc42d62,null))['catch'](handleError(_0xc42d62,null));};exports[_0xbb5d('0x52')]=function(_0x3b2e22,_0x517879){return db[_0xbb5d('0x3b')][_0xbb5d('0x52')](_0x3b2e22[_0xbb5d('0x53')],{})['then'](function(_0x5cb2bc){var _0x3f0d0c=_0x3b2e22[_0xbb5d('0x54')][_0xbb5d('0x55')]({'plain':!![]});if(!_0x3f0d0c)throw new Error(_0xbb5d('0x56'));if(_0x3f0d0c['role']===_0xbb5d('0x54')){var _0x3e68e4=_0x5cb2bc[_0xbb5d('0x55')]({'plain':!![]});var _0x57224d=[{'name':'VoiceQueues','value':_0xbb5d('0x2b')},{'name':_0xbb5d('0x2c'),'value':_0xbb5d('0x57')}];var _0x55de86=_[_0xbb5d('0x33')](_0x57224d,[_0xbb5d('0x30'),_0x3e68e4[_0xbb5d('0x32')]])[_0xbb5d('0x34')];return db['UserProfileSection'][_0xbb5d('0x33')]({'where':{'name':_0x55de86,'userProfileId':_0x3f0d0c['userProfileId']},'raw':!![]})[_0xbb5d('0x36')](function(_0x17c1ba){if(_0x17c1ba&&_0x17c1ba['autoAssociation']===0x0){return db[_0xbb5d('0x35')][_0xbb5d('0x52')]({'name':_0x3e68e4[_0xbb5d('0x34')],'resourceId':_0x3e68e4['id'],'type':_0x17c1ba['name'],'sectionId':_0x17c1ba['id']},{})[_0xbb5d('0x36')](function(){return _0x5cb2bc;});}else{return _0x5cb2bc;}})[_0xbb5d('0x4f')](function(_0x20f4ea){logger[_0xbb5d('0x37')](_0xbb5d('0x58'),_0x20f4ea);throw _0x20f4ea;});}return _0x5cb2bc;})[_0xbb5d('0x36')](respondWithResult(_0x517879,0xc9))[_0xbb5d('0x4f')](handleError(_0x517879,null));};exports['clone']=function(_0x5ba94d,_0x3903eb){var _0xbf433a={'where':{'id':_0x5ba94d['params']['id']}},_0x5de825={};_0x5de825['model']=_[_0xbb5d('0x51')](db[_0xbb5d('0x3b')]['rawAttributes']);_0xbf433a[_0xbb5d('0x41')]=_[_0xbb5d('0x40')](_0x5de825[_0xbb5d('0x3d')],qs['fields'](_0x5ba94d[_0xbb5d('0x3e')][_0xbb5d('0x42')]));_0xbf433a[_0xbb5d('0x41')]=_0xbf433a[_0xbb5d('0x41')][_0xbb5d('0x43')]?_0xbf433a['attributes']:_0x5de825[_0xbb5d('0x3d')];if(_0x5ba94d['query'][_0xbb5d('0x4c')]){_0xbf433a[_0xbb5d('0x4d')]=[{'all':!![]}];}_0xbf433a=_[_0xbb5d('0x49')]({},_0xbf433a,_0x5ba94d[_0xbb5d('0x4b')]);return db[_0xbb5d('0x3b')][_0xbb5d('0x33')](_0xbf433a)['then'](handleEntityNotFound(_0x3903eb,null))['then'](function(_0x3fb92f){if(_0x3fb92f){var _0x50a314=_0x3fb92f[_0xbb5d('0x55')]({'plain':!![]});_0x50a314=qs[_0xbb5d('0x59')](_0x50a314,['id',_0xbb5d('0x5a'),_0xbb5d('0x5b')]);_0x5ba94d[_0xbb5d('0x53')]=_['omit'](_0x5ba94d[_0xbb5d('0x53')],['id','createdAt',_0xbb5d('0x5b')]);return db[_0xbb5d('0x3b')][_0xbb5d('0x52')](_['merge'](_0x50a314,_0x5ba94d[_0xbb5d('0x53')]),{'include':_0x5ba94d[_0xbb5d('0x3e')][_0xbb5d('0x4c')]?[{'all':!![]}]:undefined})['then'](function(_0x26fd23){var _0x5a52ad=_0x5ba94d[_0xbb5d('0x54')][_0xbb5d('0x55')]({'plain':!![]});if(!_0x5a52ad)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a52ad[_0xbb5d('0x5c')]===_0xbb5d('0x54')){var _0x4c5136=_0x26fd23[_0xbb5d('0x55')]({'plain':!![]});var _0x2c2567=[{'name':_0xbb5d('0x5d'),'value':_0xbb5d('0x2b')},{'name':_0xbb5d('0x2c'),'value':_0xbb5d('0x57')}];var _0x3d368d=_[_0xbb5d('0x33')](_0x2c2567,[_0xbb5d('0x30'),_0x4c5136[_0xbb5d('0x32')]])[_0xbb5d('0x34')];return db[_0xbb5d('0x5e')][_0xbb5d('0x33')]({'where':{'name':_0x3d368d,'userProfileId':_0x5a52ad[_0xbb5d('0x5f')]},'raw':!![]})[_0xbb5d('0x36')](function(_0x26d1e0){if(_0x26d1e0&&_0x26d1e0['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x4c5136['name'],'resourceId':_0x4c5136['id'],'type':_0x26d1e0[_0xbb5d('0x34')],'sectionId':_0x26d1e0['id']},{})['then'](function(){return _0x26fd23;});}else{return _0x26fd23;}})[_0xbb5d('0x4f')](function(_0x3a4419){logger[_0xbb5d('0x37')](_0xbb5d('0x58'),_0x3a4419);throw _0x3a4419;});}return _0x26fd23;});}})[_0xbb5d('0x36')](respondWithResult(_0x3903eb,0xc9))[_0xbb5d('0x4f')](handleError(_0x3903eb,null));};exports[_0xbb5d('0x29')]=function(_0x5a2ccd,_0x16bf0c){if(_0x5a2ccd['body']['id']){delete _0x5a2ccd[_0xbb5d('0x53')]['id'];}return db[_0xbb5d('0x3b')]['find']({'where':{'id':_0x5a2ccd[_0xbb5d('0x60')]['id']}})['then'](handleEntityNotFound(_0x16bf0c,null))['then'](saveUpdates(_0x5a2ccd[_0xbb5d('0x53')],null))[_0xbb5d('0x36')](respondWithResult(_0x16bf0c,null))[_0xbb5d('0x4f')](handleError(_0x16bf0c,null));};exports[_0xbb5d('0x2a')]=function(_0x504fb5,_0x1f677b){return db[_0xbb5d('0x3b')][_0xbb5d('0x33')]({'where':{'id':_0x504fb5[_0xbb5d('0x60')]['id']}})[_0xbb5d('0x36')](handleEntityNotFound(_0x1f677b,null))[_0xbb5d('0x36')](removeEntity(_0x1f677b,null))[_0xbb5d('0x4f')](handleError(_0x1f677b,null));};exports[_0xbb5d('0x61')]=function(_0x14323c,_0x41a5c9,_0x44d5cf){var _0x38115a={'raw':![],'where':{}};var _0x3ed444={};var _0x41ea0b={'count':0x0,'rows':[]};return db[_0xbb5d('0x3b')][_0xbb5d('0x62')]({'where':{'id':_0x14323c[_0xbb5d('0x60')]['id']}})[_0xbb5d('0x36')](handleEntityNotFound(_0x41a5c9,null))['then'](function(_0x4891d7){if(_0x4891d7){_0x3ed444[_0xbb5d('0x3d')]=_[_0xbb5d('0x51')](db[_0xbb5d('0x63')][_0xbb5d('0x64')]);_0x3ed444[_0xbb5d('0x3e')]=_[_0xbb5d('0x51')](_0x14323c[_0xbb5d('0x3e')]);_0x3ed444[_0xbb5d('0x3f')]=_['intersection'](_0x3ed444['model'],_0x3ed444['query']);_0x38115a[_0xbb5d('0x41')]=_[_0xbb5d('0x40')](_0x3ed444[_0xbb5d('0x3d')],qs[_0xbb5d('0x42')](_0x14323c[_0xbb5d('0x3e')][_0xbb5d('0x42')]));_0x38115a['attributes']=_0x38115a[_0xbb5d('0x41')][_0xbb5d('0x43')]?_0x38115a[_0xbb5d('0x41')]:_0x3ed444[_0xbb5d('0x3d')];if(!_0x14323c[_0xbb5d('0x3e')]['hasOwnProperty'](_0xbb5d('0x45'))){_0x38115a['limit']=qs['limit'](_0x14323c['query'][_0xbb5d('0x23')]);_0x38115a[_0xbb5d('0x20')]=qs[_0xbb5d('0x20')](_0x14323c['query'][_0xbb5d('0x20')]);}_0x38115a[_0xbb5d('0x46')]=qs[_0xbb5d('0x65')](_0x14323c[_0xbb5d('0x3e')][_0xbb5d('0x65')]);_0x38115a[_0xbb5d('0x47')]=qs[_0xbb5d('0x3f')](_[_0xbb5d('0x48')](_0x14323c[_0xbb5d('0x3e')],_0x3ed444[_0xbb5d('0x3f')]));_0x38115a[_0xbb5d('0x47')][_0xbb5d('0x66')]=_0x4891d7['id'];if(_0x14323c[_0xbb5d('0x3e')]['filter']){_0x38115a[_0xbb5d('0x47')]=_['merge'](_0x38115a['where'],{'$or':_[_0xbb5d('0x2f')](_0x38115a[_0xbb5d('0x41')],function(_0x39c736){var _0x4fdaa1={};_0x4fdaa1[_0x39c736]={'$like':'%'+_0x14323c[_0xbb5d('0x3e')][_0xbb5d('0x2d')]+'%'};return _0x4fdaa1;})});}_0x38115a=_[_0xbb5d('0x49')]({},_0x38115a,_0x14323c[_0xbb5d('0x4b')]);return db['CmHopper']['count']({'where':_0x38115a[_0xbb5d('0x47')]})[_0xbb5d('0x36')](function(_0x1139dd){_0x41ea0b[_0xbb5d('0x22')]=_0x1139dd;if(_0x14323c[_0xbb5d('0x3e')][_0xbb5d('0x4c')]){_0x38115a[_0xbb5d('0x4d')]=[{'all':!![]}];}return db[_0xbb5d('0x63')][_0xbb5d('0x67')](_0x38115a);})[_0xbb5d('0x36')](function(_0x19146c){_0x41ea0b[_0xbb5d('0x4e')]=_0x19146c;return _0x41ea0b;});}})[_0xbb5d('0x36')](respondWithFilteredResult(_0x41a5c9,_0x38115a))[_0xbb5d('0x4f')](handleError(_0x41a5c9,null));};exports[_0xbb5d('0x68')]=function(_0x252771,_0xdd2920,_0xf3e3c0){var _0x3ba338={'raw':!![],'where':{}};var _0x2b074f={};var _0x4c8479={'count':0x0,'rows':[]};return db[_0xbb5d('0x3b')][_0xbb5d('0x62')]({'where':{'id':_0x252771[_0xbb5d('0x60')]['id']}})[_0xbb5d('0x36')](handleEntityNotFound(_0xdd2920,null))['then'](function(_0x5e65bb){if(_0x5e65bb){_0x2b074f[_0xbb5d('0x3d')]=_[_0xbb5d('0x51')](db[_0xbb5d('0x69')]['rawAttributes']);_0x2b074f['query']=_['keys'](_0x252771[_0xbb5d('0x3e')]);_0x2b074f[_0xbb5d('0x3f')]=_['intersection'](_0x2b074f[_0xbb5d('0x3d')],_0x2b074f[_0xbb5d('0x3e')]);_0x3ba338[_0xbb5d('0x41')]=_['intersection'](_0x2b074f[_0xbb5d('0x3d')],qs['fields'](_0x252771[_0xbb5d('0x3e')][_0xbb5d('0x42')]));_0x3ba338['attributes']=_0x3ba338[_0xbb5d('0x41')]['length']?_0x3ba338[_0xbb5d('0x41')]:_0x2b074f[_0xbb5d('0x3d')];if(!_0x252771[_0xbb5d('0x3e')]['hasOwnProperty'](_0xbb5d('0x45'))){_0x3ba338[_0xbb5d('0x23')]=qs[_0xbb5d('0x23')](_0x252771[_0xbb5d('0x3e')]['limit']);_0x3ba338[_0xbb5d('0x20')]=qs[_0xbb5d('0x20')](_0x252771[_0xbb5d('0x3e')][_0xbb5d('0x20')]);}_0x3ba338['order']=qs['sort'](_0x252771['query'][_0xbb5d('0x65')]);_0x3ba338[_0xbb5d('0x47')]=qs[_0xbb5d('0x3f')](_[_0xbb5d('0x48')](_0x252771[_0xbb5d('0x3e')],_0x2b074f[_0xbb5d('0x3f')]));_0x3ba338['where'][_0xbb5d('0x66')]=_0x5e65bb['id'];if(_0x252771[_0xbb5d('0x3e')][_0xbb5d('0x2d')]){_0x3ba338[_0xbb5d('0x47')]=_['merge'](_0x3ba338['where'],{'$or':_[_0xbb5d('0x2f')](_0x3ba338[_0xbb5d('0x41')],function(_0x15cdb2){var _0x120481={};_0x120481[_0x15cdb2]={'$like':'%'+_0x252771[_0xbb5d('0x3e')][_0xbb5d('0x2d')]+'%'};return _0x120481;})});}_0x3ba338=_[_0xbb5d('0x49')]({},_0x3ba338,_0x252771[_0xbb5d('0x4b')]);return db['CmHopperHistory'][_0xbb5d('0x22')]({'where':_0x3ba338[_0xbb5d('0x47')]})[_0xbb5d('0x36')](function(_0x1c4448){_0x4c8479[_0xbb5d('0x22')]=_0x1c4448;if(_0x252771[_0xbb5d('0x3e')]['includeAll']){_0x3ba338[_0xbb5d('0x4d')]=[{'all':!![]}];}return db[_0xbb5d('0x69')][_0xbb5d('0x67')](_0x3ba338);})[_0xbb5d('0x36')](function(_0x15cfaf){_0x4c8479[_0xbb5d('0x4e')]=_0x15cfaf;return _0x4c8479;});}})[_0xbb5d('0x36')](respondWithFilteredResult(_0xdd2920,_0x3ba338))[_0xbb5d('0x4f')](handleError(_0xdd2920,null));};exports[_0xbb5d('0x6a')]=function(_0x2eb76c,_0x2764c0,_0x261c83){var _0xd828d9={'raw':!![],'where':{}};var _0x72a81c={};var _0x53eac6={'count':0x0,'rows':[]};return db[_0xbb5d('0x3b')][_0xbb5d('0x62')]({'where':{'id':_0x2eb76c[_0xbb5d('0x60')]['id']}})[_0xbb5d('0x36')](handleEntityNotFound(_0x2764c0,null))['then'](function(_0x4e6c9b){if(_0x4e6c9b){_0x72a81c[_0xbb5d('0x3d')]=_['keys'](db[_0xbb5d('0x6b')][_0xbb5d('0x64')]);_0x72a81c['query']=_[_0xbb5d('0x51')](_0x2eb76c[_0xbb5d('0x3e')]);_0x72a81c[_0xbb5d('0x3f')]=_[_0xbb5d('0x40')](_0x72a81c['model'],_0x72a81c[_0xbb5d('0x3e')]);_0xd828d9[_0xbb5d('0x41')]=_[_0xbb5d('0x40')](_0x72a81c[_0xbb5d('0x3d')],qs[_0xbb5d('0x42')](_0x2eb76c[_0xbb5d('0x3e')][_0xbb5d('0x42')]));_0xd828d9[_0xbb5d('0x41')]=_0xd828d9[_0xbb5d('0x41')][_0xbb5d('0x43')]?_0xd828d9['attributes']:_0x72a81c['model'];if(!_0x2eb76c[_0xbb5d('0x3e')]['hasOwnProperty'](_0xbb5d('0x45'))){_0xd828d9[_0xbb5d('0x23')]=qs[_0xbb5d('0x23')](_0x2eb76c['query']['limit']);_0xd828d9[_0xbb5d('0x20')]=qs['offset'](_0x2eb76c[_0xbb5d('0x3e')][_0xbb5d('0x20')]);}_0xd828d9['order']=qs[_0xbb5d('0x65')](_0x2eb76c['query'][_0xbb5d('0x65')]);_0xd828d9[_0xbb5d('0x47')]=qs[_0xbb5d('0x3f')](_['pick'](_0x2eb76c[_0xbb5d('0x3e')],_0x72a81c[_0xbb5d('0x3f')]));_0xd828d9[_0xbb5d('0x47')]['VoiceQueueId']=_0x4e6c9b['id'];if(_0x2eb76c[_0xbb5d('0x3e')][_0xbb5d('0x2d')]){_0xd828d9[_0xbb5d('0x47')]=_[_0xbb5d('0x49')](_0xd828d9[_0xbb5d('0x47')],{'$or':_['map'](_0xd828d9[_0xbb5d('0x41')],function(_0x57981e){var _0x1b5c45={};_0x1b5c45[_0x57981e]={'$like':'%'+_0x2eb76c['query']['filter']+'%'};return _0x1b5c45;})});}_0xd828d9=_[_0xbb5d('0x49')]({},_0xd828d9,_0x2eb76c['options']);return db[_0xbb5d('0x6b')]['count']({'where':_0xd828d9[_0xbb5d('0x47')]})['then'](function(_0x269ead){_0x53eac6[_0xbb5d('0x22')]=_0x269ead;if(_0x2eb76c[_0xbb5d('0x3e')][_0xbb5d('0x4c')]){_0xd828d9[_0xbb5d('0x4d')]=[{'all':!![]}];}return db[_0xbb5d('0x6b')][_0xbb5d('0x67')](_0xd828d9);})[_0xbb5d('0x36')](function(_0x33f982){_0x53eac6[_0xbb5d('0x4e')]=_0x33f982;return _0x53eac6;});}})[_0xbb5d('0x36')](respondWithFilteredResult(_0x2764c0,_0xd828d9))['catch'](handleError(_0x2764c0,null));};exports['getHopperBlacks']=function(_0x3c73c8,_0x46060e,_0x16c062){var _0x222801={'raw':!![],'where':{}};var _0x35f350={};var _0x30eb67={'count':0x0,'rows':[]};return db[_0xbb5d('0x3b')][_0xbb5d('0x62')]({'where':{'id':_0x3c73c8[_0xbb5d('0x60')]['id']}})[_0xbb5d('0x36')](handleEntityNotFound(_0x46060e,null))[_0xbb5d('0x36')](function(_0x25dafe){if(_0x25dafe){_0x35f350[_0xbb5d('0x3d')]=_['keys'](db[_0xbb5d('0x6c')][_0xbb5d('0x64')]);_0x35f350[_0xbb5d('0x3e')]=_[_0xbb5d('0x51')](_0x3c73c8['query']);_0x35f350[_0xbb5d('0x3f')]=_[_0xbb5d('0x40')](_0x35f350[_0xbb5d('0x3d')],_0x35f350[_0xbb5d('0x3e')]);_0x222801['attributes']=_[_0xbb5d('0x40')](_0x35f350[_0xbb5d('0x3d')],qs[_0xbb5d('0x42')](_0x3c73c8[_0xbb5d('0x3e')]['fields']));_0x222801[_0xbb5d('0x41')]=_0x222801[_0xbb5d('0x41')][_0xbb5d('0x43')]?_0x222801['attributes']:_0x35f350['model'];if(!_0x3c73c8[_0xbb5d('0x3e')][_0xbb5d('0x44')](_0xbb5d('0x45'))){_0x222801[_0xbb5d('0x23')]=qs[_0xbb5d('0x23')](_0x3c73c8[_0xbb5d('0x3e')][_0xbb5d('0x23')]);_0x222801['offset']=qs[_0xbb5d('0x20')](_0x3c73c8[_0xbb5d('0x3e')][_0xbb5d('0x20')]);}_0x222801[_0xbb5d('0x46')]=qs[_0xbb5d('0x65')](_0x3c73c8[_0xbb5d('0x3e')][_0xbb5d('0x65')]);_0x222801['where']=qs['filters'](_['pick'](_0x3c73c8['query'],_0x35f350[_0xbb5d('0x3f')]));_0x222801[_0xbb5d('0x47')]['VoiceQueueId']=_0x25dafe['id'];if(_0x3c73c8[_0xbb5d('0x3e')][_0xbb5d('0x2d')]){_0x222801[_0xbb5d('0x47')]=_[_0xbb5d('0x49')](_0x222801[_0xbb5d('0x47')],{'$or':_['map'](_0x222801[_0xbb5d('0x41')],function(_0x394917){var _0x36457b={};_0x36457b[_0x394917]={'$like':'%'+_0x3c73c8[_0xbb5d('0x3e')][_0xbb5d('0x2d')]+'%'};return _0x36457b;})});}_0x222801=_[_0xbb5d('0x49')]({},_0x222801,_0x3c73c8[_0xbb5d('0x4b')]);return db[_0xbb5d('0x6c')][_0xbb5d('0x22')]({'where':_0x222801['where']})[_0xbb5d('0x36')](function(_0x56bee8){_0x30eb67[_0xbb5d('0x22')]=_0x56bee8;if(_0x3c73c8['query']['includeAll']){_0x222801['include']=[{'all':!![]}];}return db[_0xbb5d('0x6c')][_0xbb5d('0x67')](_0x222801);})[_0xbb5d('0x36')](function(_0x3c0292){_0x30eb67[_0xbb5d('0x4e')]=_0x3c0292;return _0x30eb67;});}})[_0xbb5d('0x36')](respondWithFilteredResult(_0x46060e,_0x222801))['catch'](handleError(_0x46060e,null));};exports[_0xbb5d('0x6d')]=function(_0x4de8e0,_0x895241,_0x3466c8){var _0x5ec189={};var _0x2fa055={};var _0x3fc69d;var _0x58224b;return db[_0xbb5d('0x3b')]['findOne']({'where':{'id':_0x4de8e0[_0xbb5d('0x60')]['id']}})[_0xbb5d('0x36')](handleEntityNotFound(_0x895241,null))['then'](function(_0x5416ce){if(_0x5416ce){_0x3fc69d=_0x5416ce;_0x2fa055[_0xbb5d('0x3d')]=_[_0xbb5d('0x51')](db['Team'][_0xbb5d('0x64')]);_0x2fa055[_0xbb5d('0x3e')]=_[_0xbb5d('0x51')](_0x4de8e0[_0xbb5d('0x3e')]);_0x2fa055[_0xbb5d('0x3f')]=_[_0xbb5d('0x40')](_0x2fa055['model'],_0x2fa055[_0xbb5d('0x3e')]);_0x5ec189[_0xbb5d('0x41')]=_[_0xbb5d('0x40')](_0x2fa055['model'],qs[_0xbb5d('0x42')](_0x4de8e0[_0xbb5d('0x3e')][_0xbb5d('0x42')]));_0x5ec189[_0xbb5d('0x41')]=_0x5ec189['attributes'][_0xbb5d('0x43')]?_0x5ec189['attributes']:_0x2fa055[_0xbb5d('0x3d')];_0x5ec189[_0xbb5d('0x46')]=qs[_0xbb5d('0x65')](_0x4de8e0[_0xbb5d('0x3e')][_0xbb5d('0x65')]);_0x5ec189[_0xbb5d('0x47')]=qs[_0xbb5d('0x3f')](_[_0xbb5d('0x48')](_0x4de8e0[_0xbb5d('0x3e')],_0x2fa055[_0xbb5d('0x3f')]));if(_0x4de8e0[_0xbb5d('0x3e')][_0xbb5d('0x2d')]){_0x5ec189[_0xbb5d('0x47')]=_[_0xbb5d('0x49')](_0x5ec189[_0xbb5d('0x47')],{'$or':_['map'](_0x5ec189[_0xbb5d('0x41')],function(_0x163916){var _0x2ca49e={};_0x2ca49e[_0x163916]={'$like':'%'+_0x4de8e0[_0xbb5d('0x3e')][_0xbb5d('0x2d')]+'%'};return _0x2ca49e;})});}_0x5ec189=_[_0xbb5d('0x49')]({},_0x5ec189,_0x4de8e0[_0xbb5d('0x4b')]);return _0x3fc69d[_0xbb5d('0x6d')](_0x5ec189);}})[_0xbb5d('0x36')](function(_0x3b134b){if(_0x3b134b){_0x58224b=_0x3b134b[_0xbb5d('0x43')];if(!_0x4de8e0[_0xbb5d('0x3e')][_0xbb5d('0x44')](_0xbb5d('0x45'))){_0x5ec189[_0xbb5d('0x23')]=qs[_0xbb5d('0x23')](_0x4de8e0[_0xbb5d('0x3e')]['limit']);_0x5ec189[_0xbb5d('0x20')]=qs[_0xbb5d('0x20')](_0x4de8e0[_0xbb5d('0x3e')][_0xbb5d('0x20')]);}return _0x3fc69d['getTeams'](_0x5ec189);}})[_0xbb5d('0x36')](function(_0x3c4b6e){if(_0x3c4b6e){return _0x3c4b6e?{'count':_0x58224b,'rows':_0x3c4b6e}:null;}})[_0xbb5d('0x36')](respondWithResult(_0x895241,null))['catch'](handleError(_0x895241,null));};exports[_0xbb5d('0x6e')]=function(_0x358cae,_0x30c2ea,_0x255931){var _0x1aef4e=_0x358cae[_0xbb5d('0x53')][_0xbb5d('0x6f')];var _0xccc6c2=_[_0xbb5d('0x2f')](_0x1aef4e,'id');return db['Team']['findAll']({'where':{'id':_0xccc6c2},'attributes':['id'],'include':[{'model':db[_0xbb5d('0x70')],'as':_0xbb5d('0x71'),'attributes':['id',_0xbb5d('0x34'),'online',_0xbb5d('0x72'),_0xbb5d('0x73')],'raw':!![]}]})['then'](function(_0x5f74d2){if(_0x5f74d2){var _0x490831=_[_0xbb5d('0x74')](_0x5f74d2,function(_0x341841){var _0x5a3516=_0x341841[_0xbb5d('0x55')]({'plain':!![]});_0x5a3516[_0xbb5d('0x71')]['forEach'](function(_0x2d2aec){_0x2d2aec[_0xbb5d('0x75')]=_[_0xbb5d('0x33')](_0x1aef4e,{'id':_0x5a3516['id']})['penalty'];});return _0x5a3516['Agents'];});return db['VoiceQueue'][_0xbb5d('0x33')]({'where':{'id':_0x358cae['params']['id']}})[_0xbb5d('0x36')](function(_0x13bc11){return db['sequelize'][_0xbb5d('0x76')](function(_0x3648e4){return _0x13bc11[_0xbb5d('0x6e')](_0xccc6c2,{'transaction':_0x3648e4})['then'](function(){return BPromise[_0xbb5d('0x77')](_0x1aef4e,function(_0xd31f06){return db[_0xbb5d('0x78')][_0xbb5d('0x79')]({'TeamId':_0xd31f06['id'],'VoiceQueueId':_0x358cae[_0xbb5d('0x60')]['id'],'penalty':_0xd31f06[_0xbb5d('0x75')]},{'transaction':_0x3648e4});});})['then'](function(){return BPromise[_0xbb5d('0x77')](_0x490831,function(_0x47fe84){return db[_0xbb5d('0x7a')][_0xbb5d('0x7b')]({'where':{'UserId':_0x47fe84['id'],'VoiceQueueId':_0x358cae[_0xbb5d('0x60')]['id']},'defaults':{'penalty':_0x47fe84[_0xbb5d('0x75')]},'transaction':_0x3648e4});});})[_0xbb5d('0x36')](function(){return BPromise[_0xbb5d('0x77')](_[_0xbb5d('0x2d')](_0x490831,{'online':!![]}),function(_0x19e899){return db[_0xbb5d('0x7c')][_0xbb5d('0x79')]({'membername':_0x19e899[_0xbb5d('0x34')],'UserId':_0x19e899['id'],'queue_name':_0x13bc11[_0xbb5d('0x34')],'VoiceQueueId':_0x13bc11['id'],'interface':_[_0xbb5d('0x7d')](_0x19e899[_0xbb5d('0x73')])?util[_0xbb5d('0x7e')](_0xbb5d('0x7f'),_0x19e899[_0xbb5d('0x34')]):_0x19e899[_0xbb5d('0x73')],'paused':_0x19e899[_0xbb5d('0x72')]||![],'penalty':_0x19e899['penalty']},{'transaction':_0x3648e4});});})[_0xbb5d('0x36')](function(){_0x490831['forEach'](function(_0x4236e6){socket[_0xbb5d('0x80')](_0xbb5d('0x81'),{'UserId':_0x4236e6['id'],'VoiceQueueId':_0x13bc11['id']});});});});});}})[_0xbb5d('0x36')](respondWithStatusCode(_0x30c2ea,null))['catch'](handleError(_0x30c2ea,null));};exports[_0xbb5d('0x82')]=function(_0x588166,_0x1b4c96,_0x15f1fa){return db[_0xbb5d('0x83')][_0xbb5d('0x67')]({'where':{'id':_0x588166[_0xbb5d('0x3e')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbb5d('0x36')](handleEntityNotFound(_0x1b4c96,null))['then'](function(_0xd3dfd0){var _0x47b90d=_[_0xbb5d('0x2f')](_0xd3dfd0,'id');var _0x37b2fc=[];var _0x55ac25=[];var _0x15cf6f=squel[_0xbb5d('0x84')]();_0x15cf6f[_0xbb5d('0x85')]('tq.TeamId')['from'](_0xbb5d('0x86'),'tq')[_0xbb5d('0x87')](_0xbb5d('0x88'),'ut',_0xbb5d('0x89'))['where'](_0xbb5d('0x8a'),_0x588166['params']['id']);for(var _0xfb3bf7=0x0;_0xfb3bf7<_0xd3dfd0[_0xbb5d('0x43')];_0xfb3bf7+=0x1){let _0x361ac5=_0xd3dfd0[_0xfb3bf7];for(var _0x5dfeb8=0x0;_0x5dfeb8<_0x361ac5[_0xbb5d('0x71')][_0xbb5d('0x43')];_0x5dfeb8+=0x1){let _0x2fb0fd=_0x361ac5[_0xbb5d('0x71')][_0x5dfeb8];var _0x3a5923=_0x15cf6f[_0xbb5d('0x8b')]();_0x3a5923[_0xbb5d('0x47')](_0xbb5d('0x8c'),_0x2fb0fd['id']);_0x55ac25[_0xbb5d('0x8d')](db[_0xbb5d('0x8e')][_0xbb5d('0x3e')](_0x3a5923['toString'](),{'type':db[_0xbb5d('0x8e')]['QueryTypes']['SELECT']})[_0xbb5d('0x36')](function(_0x22462e){if(_0x22462e[_0xbb5d('0x43')]===0x1){return _0x2fb0fd['id'];}else{var _0x32c3fd=_['every'](_[_0xbb5d('0x2f')](_0x22462e,_0xbb5d('0x8f')),function(_0x4a99c1){return _[_0xbb5d('0x31')](_0x47b90d,_0x4a99c1);});if(_0x32c3fd){return _0x2fb0fd['id'];}}}));}}return BPromise[_0xbb5d('0x90')](_0x55ac25)[_0xbb5d('0x36')](function(_0x13baa8){_0x37b2fc=_(_0x37b2fc)[_0xbb5d('0x91')](_0x13baa8)[_0xbb5d('0x92')]()['value']();return db['VoiceQueue']['find']({'where':{'id':_0x588166[_0xbb5d('0x60')]['id']}})[_0xbb5d('0x36')](function(_0x236d71){return db[_0xbb5d('0x8e')]['transaction'](function(_0x5c2f00){return _0x236d71['removeTeams'](_0x588166[_0xbb5d('0x3e')]['ids'],{'transaction':_0x5c2f00})[_0xbb5d('0x36')](function(){if(!_[_0xbb5d('0x93')](_0x37b2fc)){return _0x236d71['removeAgents'](_0x37b2fc,{'transaction':_0x5c2f00})[_0xbb5d('0x36')](function(){return db[_0xbb5d('0x7c')]['destroy']({'where':{'VoiceQueueId':_0x588166[_0xbb5d('0x60')]['id'],'UserId':_0x37b2fc},'transaction':_0x5c2f00});});}})[_0xbb5d('0x36')](function(){_0x37b2fc[_0xbb5d('0x94')](function(_0x2c9599){socket[_0xbb5d('0x80')](_0xbb5d('0x95'),{'UserId':_0x2c9599,'VoiceQueueId':_0x236d71['id']});});});});});});})[_0xbb5d('0x36')](respondWithStatusCode(_0x1b4c96,null))[_0xbb5d('0x4f')](handleError(_0x1b4c96,null));};exports[_0xbb5d('0x96')]=function(_0x1dff86,_0x18ff44,_0x3a91ab){var _0x854ebc,_0x15de86;return db['VoiceQueue'][_0xbb5d('0x33')]({'where':{'id':_0x1dff86[_0xbb5d('0x60')]['id']}})['then'](handleEntityNotFound(_0x18ff44,null))[_0xbb5d('0x36')](function(_0x278bb8){if(_0x278bb8){_0x15de86=_0x278bb8;return _0x278bb8[_0xbb5d('0x96')](_0x1dff86[_0xbb5d('0x53')]['ids'],_['omit'](_0x1dff86[_0xbb5d('0x53')],[_0xbb5d('0x97'),'id'])||{})[_0xbb5d('0x98')](function(_0x1a01a6){for(var _0x1feb82=0x0;_0x1feb82<_0x1dff86['body']['ids'][_0xbb5d('0x43')];_0x1feb82+=0x1){socket[_0xbb5d('0x80')](_0xbb5d('0x81'),{'UserId':Number(_0x1dff86[_0xbb5d('0x53')][_0xbb5d('0x97')][_0x1feb82]),'VoiceQueueId':Number(_0x1dff86[_0xbb5d('0x60')]['id'])});}return _0x1a01a6;});}})[_0xbb5d('0x36')](function(_0x47b3e4){_0x854ebc=_0x47b3e4||[];if(_0x15de86){return db[_0xbb5d('0x70')][_0xbb5d('0x67')]({'where':{'id':_0x1dff86[_0xbb5d('0x53')][_0xbb5d('0x97')]},'attributes':['id',_0xbb5d('0x34'),'online','voicePause',_0xbb5d('0x73')],'raw':!![]});}})[_0xbb5d('0x36')](function(_0x59f753){if(!_[_0xbb5d('0x93')](_0x59f753)){var _0x3d51b2=[];for(var _0x5cd39f=0x0;_0x5cd39f<_0x59f753[_0xbb5d('0x43')];_0x5cd39f++){if(_0x59f753[_0x5cd39f][_0xbb5d('0x99')]){_0x3d51b2[_0xbb5d('0x8d')](db[_0xbb5d('0x7c')][_0xbb5d('0x79')]({'membername':_0x59f753[_0x5cd39f][_0xbb5d('0x34')],'UserId':_0x59f753[_0x5cd39f]['id'],'queue_name':_0x15de86['name'],'VoiceQueueId':_0x15de86['id'],'interface':_[_0xbb5d('0x7d')](_0x59f753[_0x5cd39f][_0xbb5d('0x73')])?util[_0xbb5d('0x7e')](_0xbb5d('0x7f'),_0x59f753[_0x5cd39f][_0xbb5d('0x34')]):_0x59f753[_0x5cd39f][_0xbb5d('0x73')],'paused':_0x59f753[_0x5cd39f][_0xbb5d('0x72')]||![],'penalty':_0x1dff86[_0xbb5d('0x53')][_0xbb5d('0x75')]||0x0}));}}return BPromise[_0xbb5d('0x90')](_0x3d51b2);}})[_0xbb5d('0x36')](function(){return _0x854ebc;})['then'](respondWithResult(_0x18ff44,null))[_0xbb5d('0x4f')](handleError(_0x18ff44,null));};exports['removeAgents']=function(_0x326a2f,_0x3283d9,_0x5d374e){return db['VoiceQueue'][_0xbb5d('0x33')]({'where':{'id':_0x326a2f[_0xbb5d('0x60')]['id']}})[_0xbb5d('0x36')](handleEntityNotFound(_0x3283d9,null))[_0xbb5d('0x36')](function(_0x5dbc2b){if(_0x5dbc2b){return _0x5dbc2b[_0xbb5d('0x9a')](_0x326a2f[_0xbb5d('0x3e')]['ids'])['then'](function(){if(_[_0xbb5d('0x9b')](_0x326a2f[_0xbb5d('0x3e')][_0xbb5d('0x97')])){for(var _0xbcb56f=0x0;_0xbcb56f<_0x326a2f[_0xbb5d('0x3e')][_0xbb5d('0x97')]['length'];_0xbcb56f+=0x1){socket[_0xbb5d('0x80')]('userVoiceQueue:remove',{'UserId':Number(_0x326a2f['query'][_0xbb5d('0x97')][_0xbcb56f]),'VoiceQueueId':Number(_0x326a2f['params']['id'])});}}else{socket[_0xbb5d('0x80')](_0xbb5d('0x95'),{'UserId':Number(_0x326a2f[_0xbb5d('0x3e')][_0xbb5d('0x97')]),'VoiceQueueId':Number(_0x326a2f[_0xbb5d('0x60')]['id'])});}});}})[_0xbb5d('0x36')](function(_0x237f79){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x326a2f[_0xbb5d('0x60')]['id'],'UserId':_0x326a2f[_0xbb5d('0x3e')][_0xbb5d('0x97')]}})[_0xbb5d('0x36')](function(){return _0x237f79;});})['then'](respondWithStatusCode(_0x3283d9,null))['catch'](handleError(_0x3283d9,null));};exports[_0xbb5d('0x9c')]=function(_0x4f644b,_0x26a89e,_0x506527){var _0x4ae518={};var _0x2fd7cd={};var _0x34eb2c;var _0x45d0b7;return db['VoiceQueue'][_0xbb5d('0x62')]({'where':{'id':_0x4f644b[_0xbb5d('0x60')]['id']}})['then'](handleEntityNotFound(_0x26a89e,null))['then'](function(_0x13c845){if(_0x13c845){_0x34eb2c=_0x13c845;_0x2fd7cd[_0xbb5d('0x3d')]=_[_0xbb5d('0x51')](db[_0xbb5d('0x70')][_0xbb5d('0x64')]);_0x2fd7cd['query']=_[_0xbb5d('0x51')](_0x4f644b[_0xbb5d('0x3e')]);_0x2fd7cd[_0xbb5d('0x3f')]=_[_0xbb5d('0x40')](_0x2fd7cd[_0xbb5d('0x3d')],_0x2fd7cd[_0xbb5d('0x3e')]);_0x4ae518[_0xbb5d('0x41')]=_[_0xbb5d('0x40')](_0x2fd7cd[_0xbb5d('0x3d')],qs[_0xbb5d('0x42')](_0x4f644b[_0xbb5d('0x3e')][_0xbb5d('0x42')]));_0x4ae518[_0xbb5d('0x41')]=_0x4ae518[_0xbb5d('0x41')][_0xbb5d('0x43')]?_0x4ae518[_0xbb5d('0x41')]:_0x2fd7cd['model'];_0x4ae518[_0xbb5d('0x46')]=qs[_0xbb5d('0x65')](_0x4f644b[_0xbb5d('0x3e')][_0xbb5d('0x65')]);_0x4ae518[_0xbb5d('0x47')]=qs[_0xbb5d('0x3f')](_[_0xbb5d('0x48')](_0x4f644b[_0xbb5d('0x3e')],_0x2fd7cd[_0xbb5d('0x3f')]));if(_0x4f644b[_0xbb5d('0x3e')][_0xbb5d('0x2d')]){_0x4ae518['where']=_[_0xbb5d('0x49')](_0x4ae518[_0xbb5d('0x47')],{'$or':_[_0xbb5d('0x2f')](_0x4ae518[_0xbb5d('0x41')],function(_0x5f18a9){var _0x4cc770={};_0x4cc770[_0x5f18a9]={'$like':'%'+_0x4f644b[_0xbb5d('0x3e')][_0xbb5d('0x2d')]+'%'};return _0x4cc770;})});}_0x4ae518=_['merge']({},_0x4ae518,_0x4f644b[_0xbb5d('0x4b')]);return _0x34eb2c[_0xbb5d('0x9c')](_0x4ae518);}})[_0xbb5d('0x36')](function(_0xd5dcb3){if(_0xd5dcb3){_0x45d0b7=_0xd5dcb3['length'];if(!_0x4f644b[_0xbb5d('0x3e')][_0xbb5d('0x44')](_0xbb5d('0x45'))){_0x4ae518[_0xbb5d('0x23')]=qs[_0xbb5d('0x23')](_0x4f644b[_0xbb5d('0x3e')][_0xbb5d('0x23')]);_0x4ae518[_0xbb5d('0x20')]=qs[_0xbb5d('0x20')](_0x4f644b['query'][_0xbb5d('0x20')]);}return _0x34eb2c['getAgents'](_0x4ae518);}})[_0xbb5d('0x36')](function(_0x216a1e){if(_0x216a1e){return _0x216a1e?{'count':_0x45d0b7,'rows':_0x216a1e}:null;}})[_0xbb5d('0x36')](respondWithResult(_0x26a89e,null))[_0xbb5d('0x4f')](handleError(_0x26a89e,null));};exports['getMembers']=function(_0x4bdf99,_0x158ee5,_0x86db83){var _0x19d639={};var _0x5bf0a7={};var _0x1db051;var _0x38d046;return db[_0xbb5d('0x3b')][_0xbb5d('0x62')]({'where':{'id':_0x4bdf99[_0xbb5d('0x60')]['id']}})['then'](handleEntityNotFound(_0x158ee5,null))[_0xbb5d('0x36')](function(_0xba0b66){if(_0xba0b66){_0x1db051=_0xba0b66;_0x5bf0a7[_0xbb5d('0x3d')]=_[_0xbb5d('0x51')](db[_0xbb5d('0x7c')][_0xbb5d('0x64')]);_0x5bf0a7['query']=_[_0xbb5d('0x51')](_0x4bdf99[_0xbb5d('0x3e')]);_0x5bf0a7[_0xbb5d('0x3f')]=_['intersection'](_0x5bf0a7[_0xbb5d('0x3d')],_0x5bf0a7[_0xbb5d('0x3e')]);_0x19d639['attributes']=_['intersection'](_0x5bf0a7[_0xbb5d('0x3d')],qs[_0xbb5d('0x42')](_0x4bdf99[_0xbb5d('0x3e')][_0xbb5d('0x42')]));_0x19d639[_0xbb5d('0x41')]=_0x19d639['attributes'][_0xbb5d('0x43')]?_0x19d639['attributes']:_0x5bf0a7[_0xbb5d('0x3d')];_0x19d639[_0xbb5d('0x46')]=qs[_0xbb5d('0x65')](_0x4bdf99[_0xbb5d('0x3e')][_0xbb5d('0x65')]);_0x19d639[_0xbb5d('0x47')]=qs['filters'](_[_0xbb5d('0x48')](_0x4bdf99[_0xbb5d('0x3e')],_0x5bf0a7['filters']));if(_0x4bdf99[_0xbb5d('0x3e')][_0xbb5d('0x2d')]){_0x19d639[_0xbb5d('0x47')]=_['merge'](_0x19d639[_0xbb5d('0x47')],{'$or':_[_0xbb5d('0x2f')](_0x19d639[_0xbb5d('0x41')],function(_0xba20e){var _0x30c662={};_0x30c662[_0xba20e]={'$like':'%'+_0x4bdf99[_0xbb5d('0x3e')]['filter']+'%'};return _0x30c662;})});}_0x19d639=_[_0xbb5d('0x49')]({},_0x19d639,_0x4bdf99[_0xbb5d('0x4b')]);return _0x1db051[_0xbb5d('0x9d')](_0x19d639);}})[_0xbb5d('0x36')](function(_0x2a4d12){if(_0x2a4d12){_0x38d046=_0x2a4d12[_0xbb5d('0x43')];if(!_0x4bdf99['query'][_0xbb5d('0x44')](_0xbb5d('0x45'))){_0x19d639[_0xbb5d('0x23')]=qs[_0xbb5d('0x23')](_0x4bdf99[_0xbb5d('0x3e')]['limit']);_0x19d639[_0xbb5d('0x20')]=qs[_0xbb5d('0x20')](_0x4bdf99[_0xbb5d('0x3e')][_0xbb5d('0x20')]);}return _0x1db051[_0xbb5d('0x9d')](_0x19d639);}})['then'](function(_0x452a76){return _0x452a76?{'count':_0x38d046,'rows':_0x452a76}:null;})['then'](respondWithResult(_0x158ee5,null))['catch'](handleError(_0x158ee5,null));};exports[_0xbb5d('0x9e')]=function(_0x16b692,_0x4ad940,_0x106dd0){var _0x38693d={};var _0x2aba3a={};var _0x2f460c;var _0x384687;return db['VoiceQueue']['findOne']({'where':{'id':_0x16b692[_0xbb5d('0x60')]['id']}})['then'](handleEntityNotFound(_0x4ad940,null))[_0xbb5d('0x36')](function(_0x2b1109){if(_0x2b1109){_0x2f460c=_0x2b1109;_0x2aba3a[_0xbb5d('0x3d')]=_[_0xbb5d('0x51')](db[_0xbb5d('0x9f')][_0xbb5d('0x64')]);_0x2aba3a[_0xbb5d('0x3e')]=_[_0xbb5d('0x51')](_0x16b692[_0xbb5d('0x3e')]);_0x2aba3a[_0xbb5d('0x3f')]=_['intersection'](_0x2aba3a[_0xbb5d('0x3d')],_0x2aba3a[_0xbb5d('0x3e')]);_0x38693d['attributes']=_[_0xbb5d('0x40')](_0x2aba3a[_0xbb5d('0x3d')],qs['fields'](_0x16b692[_0xbb5d('0x3e')][_0xbb5d('0x42')]));_0x38693d[_0xbb5d('0x41')]=_0x38693d[_0xbb5d('0x41')][_0xbb5d('0x43')]?_0x38693d[_0xbb5d('0x41')]:_0x2aba3a[_0xbb5d('0x3d')];_0x38693d[_0xbb5d('0x46')]=qs[_0xbb5d('0x65')](_0x16b692[_0xbb5d('0x3e')][_0xbb5d('0x65')]);_0x38693d[_0xbb5d('0x47')]=qs[_0xbb5d('0x3f')](_[_0xbb5d('0x48')](_0x16b692[_0xbb5d('0x3e')],_0x2aba3a[_0xbb5d('0x3f')]));if(_0x16b692[_0xbb5d('0x3e')]['filter']){_0x38693d[_0xbb5d('0x47')]=_['merge'](_0x38693d[_0xbb5d('0x47')],{'$or':_[_0xbb5d('0x2f')](_0x38693d[_0xbb5d('0x41')],function(_0x8a8767){var _0x365e6d={};_0x365e6d[_0x8a8767]={'$like':'%'+_0x16b692[_0xbb5d('0x3e')][_0xbb5d('0x2d')]+'%'};return _0x365e6d;})});}_0x38693d=_[_0xbb5d('0x49')]({},_0x38693d,_0x16b692[_0xbb5d('0x4b')]);return _0x2f460c['getLists'](_0x38693d);}})[_0xbb5d('0x36')](function(_0x5c50d6){if(_0x5c50d6){_0x384687=_0x5c50d6['length'];if(!_0x16b692[_0xbb5d('0x3e')][_0xbb5d('0x44')]('nolimit')){_0x38693d[_0xbb5d('0x23')]=qs[_0xbb5d('0x23')](_0x16b692[_0xbb5d('0x3e')][_0xbb5d('0x23')]);_0x38693d['offset']=qs[_0xbb5d('0x20')](_0x16b692[_0xbb5d('0x3e')]['offset']);}return _0x2f460c[_0xbb5d('0x9e')](_0x38693d);}})[_0xbb5d('0x36')](function(_0x20cb47){if(_0x20cb47){return _0x20cb47?{'count':_0x384687,'rows':_0x20cb47}:null;}})[_0xbb5d('0x36')](respondWithResult(_0x4ad940,null))[_0xbb5d('0x4f')](handleError(_0x4ad940,null));};exports[_0xbb5d('0xa0')]=function(_0x15a27c,_0x1e4546,_0x2b5b85){var _0x55c5e3,_0x44ab1c;return db[_0xbb5d('0x3b')][_0xbb5d('0x33')]({'where':{'id':_0x15a27c[_0xbb5d('0x60')]['id']}})[_0xbb5d('0x36')](handleEntityNotFound(_0x1e4546,null))[_0xbb5d('0x36')](function(_0x5be6f3){if(_0x5be6f3){_0x44ab1c=_0x5be6f3;return _0x5be6f3['addLists'](_0x15a27c[_0xbb5d('0x53')]['ids'],_[_0xbb5d('0x59')](_0x15a27c[_0xbb5d('0x53')],[_0xbb5d('0x97'),'id'])||{});}return null;})['spread'](function(_0x954e7){var _0x50cbff;_0x55c5e3=_0x954e7||[];var _0x341e6c=[];if(_0x954e7){for(var _0x7250d0=0x0;_0x7250d0<_0x954e7[_0xbb5d('0x43')];_0x7250d0+=0x1){var _0x51d9d9=_0x954e7[_0x7250d0][_0xbb5d('0x55')]({'plain':!![]});_0x44ab1c[_0xbb5d('0xa1')]=_0x15a27c['body'][_0xbb5d('0xa1')]?_0x15a27c['body'][_0xbb5d('0xa1')]:_0x44ab1c[_0xbb5d('0xa1')];switch(_0x44ab1c[_0xbb5d('0xa1')]){case _0xbb5d('0xa2'):_0x50cbff=squel[_0xbb5d('0xa3')]()[_0xbb5d('0xa4')](_0xbb5d('0xa5'))[_0xbb5d('0xa6')](['phone','scheduledAt',_0xbb5d('0xa7'),'ListId','VoiceQueueId',_0xbb5d('0x5a'),_0xbb5d('0x5b')],squel['select']()['field'](_0xbb5d('0xa8'),_0xbb5d('0xa8'))[_0xbb5d('0x85')](_0xbb5d('0xa9'),_0xbb5d('0xaa'))['field']('id',_0xbb5d('0xa7'))[_0xbb5d('0x85')](_0x51d9d9['CmListId'][_0xbb5d('0xab')](),_0xbb5d('0xac'))[_0xbb5d('0x85')](_0x15a27c[_0xbb5d('0x60')]['id'][_0xbb5d('0xab')](),'VoiceQueueId')[_0xbb5d('0x85')](_0xbb5d('0xa9'),'createdAt')['field'](_0xbb5d('0xa9'),_0xbb5d('0x5b'))[_0xbb5d('0xad')](_0xbb5d('0xae'))['where'](_0xbb5d('0xaf'))[_0xbb5d('0x47')]('ListId\x20=\x20?',_0x51d9d9['CmListId'][_0xbb5d('0xab')]())[_0xbb5d('0x47')](_0xbb5d('0xb0'))[_0xbb5d('0x47')]('phone\x20NOT\x20IN\x20(?)',squel[_0xbb5d('0x84')]()['field'](_0xbb5d('0xb1'))[_0xbb5d('0xad')](_0xbb5d('0xb2'))[_0xbb5d('0x47')]('VoiceQueueId\x20=\x20?',_0x15a27c[_0xbb5d('0x60')]['id'][_0xbb5d('0xab')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xbb5d('0x84')]()['field'](_0xbb5d('0xb3'))[_0xbb5d('0xad')](_0xbb5d('0xa5'))[_0xbb5d('0x47')](_0xbb5d('0x8a'),_0x15a27c[_0xbb5d('0x60')]['id'][_0xbb5d('0xab')]())))[_0xbb5d('0xab')]();break;case _0xbb5d('0xb4'):_0x50cbff=squel[_0xbb5d('0xa3')]()[_0xbb5d('0xa4')](_0xbb5d('0xa5'))['fromQuery']([_0xbb5d('0xa8'),_0xbb5d('0xaa'),'ContactId',_0xbb5d('0xac'),'VoiceQueueId','createdAt',_0xbb5d('0x5b')],squel[_0xbb5d('0x84')]()[_0xbb5d('0x85')]('phone',_0xbb5d('0xa8'))[_0xbb5d('0x85')](_0xbb5d('0xa9'),_0xbb5d('0xaa'))['field']('id','ContactId')[_0xbb5d('0x85')](_0x51d9d9[_0xbb5d('0xb5')][_0xbb5d('0xab')](),_0xbb5d('0xac'))[_0xbb5d('0x85')](_0x15a27c[_0xbb5d('0x60')]['id'][_0xbb5d('0xab')](),'VoiceQueueId')[_0xbb5d('0x85')](_0xbb5d('0xa9'),_0xbb5d('0x5a'))['field'](_0xbb5d('0xa9'),'updatedAt')[_0xbb5d('0xad')](_0xbb5d('0xae'))[_0xbb5d('0x47')](_0xbb5d('0xaf'))['where']('ListId\x20=\x20?',_0x51d9d9[_0xbb5d('0xb5')][_0xbb5d('0xab')]())[_0xbb5d('0x47')](_0xbb5d('0xb0'))[_0xbb5d('0x47')](_0xbb5d('0xb6'),squel[_0xbb5d('0x84')]()['field'](_0xbb5d('0xb3'))[_0xbb5d('0xad')](_0xbb5d('0xa5'))[_0xbb5d('0x47')]('VoiceQueueId\x20=\x20?',_0x15a27c[_0xbb5d('0x60')]['id'][_0xbb5d('0xab')]())))[_0xbb5d('0xab')]();break;default:_0x50cbff=squel[_0xbb5d('0xa3')]()[_0xbb5d('0xa4')](_0xbb5d('0xa5'))[_0xbb5d('0xa6')]([_0xbb5d('0xa8'),_0xbb5d('0xaa'),_0xbb5d('0xa7'),'ListId','VoiceQueueId',_0xbb5d('0x5a'),_0xbb5d('0x5b')],squel[_0xbb5d('0x84')]()[_0xbb5d('0x85')](_0xbb5d('0xa8'),_0xbb5d('0xa8'))[_0xbb5d('0x85')](_0xbb5d('0xa9'),'scheduledAt')[_0xbb5d('0x85')]('id',_0xbb5d('0xa7'))[_0xbb5d('0x85')](_0x51d9d9[_0xbb5d('0xb5')][_0xbb5d('0xab')](),_0xbb5d('0xac'))['field'](_0x15a27c[_0xbb5d('0x60')]['id'][_0xbb5d('0xab')](),_0xbb5d('0x66'))[_0xbb5d('0x85')]('NOW()','createdAt')[_0xbb5d('0x85')]('NOW()',_0xbb5d('0x5b'))[_0xbb5d('0xad')](_0xbb5d('0xae'))[_0xbb5d('0x47')](_0xbb5d('0xaf'))[_0xbb5d('0x47')]('ListId\x20=\x20?',_0x51d9d9[_0xbb5d('0xb5')]['toString']())[_0xbb5d('0x47')](_0xbb5d('0xb0')))[_0xbb5d('0xab')]();}_0x341e6c[_0xbb5d('0x8d')](db[_0xbb5d('0x8e')][_0xbb5d('0x3e')](_0x50cbff));}return BPromise[_0xbb5d('0x90')](_0x341e6c);}})[_0xbb5d('0x36')](function(){return _0x55c5e3;})[_0xbb5d('0x36')](respondWithResult(_0x1e4546,null))[_0xbb5d('0x4f')](handleError(_0x1e4546,null));};exports[_0xbb5d('0xb7')]=function(_0x11bf27,_0x1785a7,_0xe73259){return db[_0xbb5d('0x3b')][_0xbb5d('0x33')]({'where':{'id':_0x11bf27['params']['id']}})[_0xbb5d('0x36')](handleEntityNotFound(_0x1785a7,null))[_0xbb5d('0x36')](function(_0x47ec60){if(_0x47ec60){return _0x47ec60[_0xbb5d('0xb7')](_0x11bf27[_0xbb5d('0x3e')][_0xbb5d('0x97')]);}})['then'](function(_0x2d36cc){if(_0x2d36cc){return db[_0xbb5d('0x63')]['destroy']({'where':{'ListId':_0x11bf27[_0xbb5d('0x3e')][_0xbb5d('0x97')],'VoiceQueueId':_0x11bf27[_0xbb5d('0x60')]['id']}})[_0xbb5d('0x36')](function(){return _0x2d36cc;});}})[_0xbb5d('0x36')](respondWithStatusCode(_0x1785a7,null))[_0xbb5d('0x4f')](handleError(_0x1785a7,null));};exports[_0xbb5d('0xb8')]=function(_0x2838ee,_0x329705,_0x59a9c8){var _0x56318a={};var _0x10dd86={};var _0xde2089;var _0x7c787e;return db[_0xbb5d('0x3b')]['findOne']({'where':{'id':_0x2838ee['params']['id']}})[_0xbb5d('0x36')](handleEntityNotFound(_0x329705,null))[_0xbb5d('0x36')](function(_0xd4e3c0){if(_0xd4e3c0){_0xde2089=_0xd4e3c0;_0x10dd86[_0xbb5d('0x3d')]=_[_0xbb5d('0x51')](db[_0xbb5d('0x9f')][_0xbb5d('0x64')]);_0x10dd86['query']=_['keys'](_0x2838ee[_0xbb5d('0x3e')]);_0x10dd86[_0xbb5d('0x3f')]=_[_0xbb5d('0x40')](_0x10dd86[_0xbb5d('0x3d')],_0x10dd86['query']);_0x56318a[_0xbb5d('0x41')]=_['intersection'](_0x10dd86['model'],qs['fields'](_0x2838ee[_0xbb5d('0x3e')][_0xbb5d('0x42')]));_0x56318a['attributes']=_0x56318a[_0xbb5d('0x41')]['length']?_0x56318a[_0xbb5d('0x41')]:_0x10dd86[_0xbb5d('0x3d')];_0x56318a[_0xbb5d('0x46')]=qs[_0xbb5d('0x65')](_0x2838ee[_0xbb5d('0x3e')][_0xbb5d('0x65')]);_0x56318a[_0xbb5d('0x47')]=qs[_0xbb5d('0x3f')](_[_0xbb5d('0x48')](_0x2838ee[_0xbb5d('0x3e')],_0x10dd86[_0xbb5d('0x3f')]));if(_0x2838ee['query'][_0xbb5d('0x2d')]){_0x56318a[_0xbb5d('0x47')]=_[_0xbb5d('0x49')](_0x56318a['where'],{'$or':_[_0xbb5d('0x2f')](_0x56318a[_0xbb5d('0x41')],function(_0x478062){var _0x5049dc={};_0x5049dc[_0x478062]={'$like':'%'+_0x2838ee[_0xbb5d('0x3e')][_0xbb5d('0x2d')]+'%'};return _0x5049dc;})});}_0x56318a=_[_0xbb5d('0x49')]({},_0x56318a,_0x2838ee['options']);return _0xde2089[_0xbb5d('0xb8')](_0x56318a);}})['then'](function(_0x4cc702){if(_0x4cc702){_0x7c787e=_0x4cc702[_0xbb5d('0x43')];if(!_0x2838ee[_0xbb5d('0x3e')][_0xbb5d('0x44')](_0xbb5d('0x45'))){_0x56318a[_0xbb5d('0x23')]=qs[_0xbb5d('0x23')](_0x2838ee[_0xbb5d('0x3e')][_0xbb5d('0x23')]);_0x56318a['offset']=qs[_0xbb5d('0x20')](_0x2838ee[_0xbb5d('0x3e')][_0xbb5d('0x20')]);}return _0xde2089['getBlackLists'](_0x56318a);}})[_0xbb5d('0x36')](function(_0x4dc8d2){if(_0x4dc8d2){return _0x4dc8d2?{'count':_0x7c787e,'rows':_0x4dc8d2}:null;}})[_0xbb5d('0x36')](respondWithResult(_0x329705,null))['catch'](handleError(_0x329705,null));};exports[_0xbb5d('0xb9')]=function(_0x5734a4,_0x53a264,_0x2322db){var _0x489026,_0x2d0586;return db[_0xbb5d('0x3b')][_0xbb5d('0x33')]({'where':{'id':_0x5734a4[_0xbb5d('0x60')]['id']}})['then'](handleEntityNotFound(_0x53a264,null))[_0xbb5d('0x36')](function(_0x1c2db4){if(_0x1c2db4){_0x2d0586=_0x1c2db4;return _0x1c2db4[_0xbb5d('0xb9')](_0x5734a4['body'][_0xbb5d('0x97')],_['omit'](_0x5734a4['body'],[_0xbb5d('0x97'),'id'])||{});}return null;})[_0xbb5d('0x98')](function(_0x2d8029){var _0x3e0d6c;_0x489026=_0x2d8029||[];var _0x22cdd9=[];if(_0x2d8029){for(var _0x4d617b=0x0;_0x4d617b<_0x2d8029[_0xbb5d('0x43')];_0x4d617b+=0x1){var _0x1c5ea0=_0x2d8029[_0x4d617b]['get']({'plain':!![]});_0x3e0d6c=squel[_0xbb5d('0xa3')]()[_0xbb5d('0xa4')](_0xbb5d('0xba'))[_0xbb5d('0xa6')]([_0xbb5d('0xa8'),'ContactId',_0xbb5d('0xac'),_0xbb5d('0x66'),'createdAt',_0xbb5d('0x5b')],squel[_0xbb5d('0x84')]()[_0xbb5d('0x85')](_0xbb5d('0xa8'),_0xbb5d('0xa8'))[_0xbb5d('0x85')]('id',_0xbb5d('0xa7'))[_0xbb5d('0x85')](_0x1c5ea0[_0xbb5d('0xb5')]['toString'](),_0xbb5d('0xac'))[_0xbb5d('0x85')](_0x5734a4[_0xbb5d('0x60')]['id']['toString'](),_0xbb5d('0x66'))[_0xbb5d('0x85')]('NOW()',_0xbb5d('0x5a'))['field']('NOW()',_0xbb5d('0x5b'))[_0xbb5d('0xad')](_0xbb5d('0xae'))[_0xbb5d('0x47')](_0xbb5d('0xaf'))['where']('ListId\x20=\x20?',_0x1c5ea0[_0xbb5d('0xb5')][_0xbb5d('0xab')]())[_0xbb5d('0x47')](_0xbb5d('0xb0')))['toString']();_0x22cdd9[_0xbb5d('0x8d')](db['sequelize'][_0xbb5d('0x3e')](_0x3e0d6c));}return BPromise[_0xbb5d('0x90')](_0x22cdd9);}})['then'](function(){return _0x489026;})[_0xbb5d('0x36')](respondWithResult(_0x53a264,null))['catch'](handleError(_0x53a264,null));};exports['removeBlackLists']=function(_0x2bc901,_0xe949d5,_0x11bacd){return db[_0xbb5d('0x3b')][_0xbb5d('0x33')]({'where':{'id':_0x2bc901[_0xbb5d('0x60')]['id']}})[_0xbb5d('0x36')](handleEntityNotFound(_0xe949d5,null))['then'](function(_0x2153bd){if(_0x2153bd){return _0x2153bd[_0xbb5d('0xbb')](_0x2bc901['query'][_0xbb5d('0x97')]);}})[_0xbb5d('0x36')](function(_0x3d4fcd){if(_0x3d4fcd){return db[_0xbb5d('0x6c')][_0xbb5d('0x2a')]({'where':{'ListId':_0x2bc901[_0xbb5d('0x3e')][_0xbb5d('0x97')],'VoiceQueueId':_0x2bc901[_0xbb5d('0x60')]['id']}})[_0xbb5d('0x36')](function(){return _0x3d4fcd;});}})[_0xbb5d('0x36')](respondWithStatusCode(_0xe949d5,null))['catch'](handleError(_0xe949d5,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index eb2b6a6..883aeef 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 _0x65e2=['../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2cc569,_0x4e9568){var _0x1bfc2e=function(_0x5b8fcb){while(--_0x5b8fcb){_0x2cc569['push'](_0x2cc569['shift']());}};_0x1bfc2e(++_0x4e9568);}(_0x65e2,0xaf));var _0x265e=function(_0x55c328,_0x2b940d){_0x55c328=_0x55c328-0x0;var _0x1c453f=_0x65e2[_0x55c328];return _0x1c453f;};'use strict';var EventEmitter=require(_0x265e('0x0'));var VoiceQueue=require(_0x265e('0x1'))['db'][_0x265e('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x265e('0x3')](0x0);var events={'afterCreate':_0x265e('0x4'),'afterUpdate':_0x265e('0x5'),'afterDestroy':_0x265e('0x6')};function emitEvent(_0x5be0b7){return function(_0x51660b,_0x53f03a,_0x211119){VoiceQueueEvents[_0x265e('0x7')](_0x5be0b7+':'+_0x51660b['id'],_0x51660b);VoiceQueueEvents[_0x265e('0x7')](_0x5be0b7,_0x51660b);_0x211119(null);};}for(var e in events){if(events[_0x265e('0x8')](e)){var event=events[e];VoiceQueue[_0x265e('0x9')](e,emitEvent(event));}}module[_0x265e('0xa')]=VoiceQueueEvents; \ No newline at end of file +var _0xae6d=['update','remove','emit','hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save'];(function(_0x3971ab,_0x1021c1){var _0xe5d74c=function(_0x3d10f7){while(--_0x3d10f7){_0x3971ab['push'](_0x3971ab['shift']());}};_0xe5d74c(++_0x1021c1);}(_0xae6d,0xd7));var _0xdae6=function(_0x397014,_0x17cc12){_0x397014=_0x397014-0x0;var _0x1163f7=_0xae6d[_0x397014];return _0x1163f7;};'use strict';var EventEmitter=require(_0xdae6('0x0'));var VoiceQueue=require(_0xdae6('0x1'))['db'][_0xdae6('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xdae6('0x3')](0x0);var events={'afterCreate':_0xdae6('0x4'),'afterUpdate':_0xdae6('0x5'),'afterDestroy':_0xdae6('0x6')};function emitEvent(_0x4b997a){return function(_0x5dea21,_0xd2c29a,_0x9121b9){VoiceQueueEvents[_0xdae6('0x7')](_0x4b997a+':'+_0x5dea21['id'],_0x5dea21);VoiceQueueEvents[_0xdae6('0x7')](_0x4b997a,_0x5dea21);_0x9121b9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xdae6('0x8')](e,emitEvent(event));}}module[_0xdae6('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 30a6b00..8201171 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x34b34a,_0x524a99){var _0x3167f1=function(_0x48eeaa){while(--_0x48eeaa){_0x34b34a['push'](_0x34b34a['shift']());}};_0x3167f1(++_0x524a99);}(_0x34e8,0x12c));var _0x834e=function(_0x55e7af,_0x2693e9){_0x55e7af=_0x55e7af-0x0;var _0x2de41a=_0x34e8[_0x55e7af];return _0x2de41a;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x2c3028,_0x1e3edf){var _0x786274=function(_0xc128e5){while(--_0xc128e5){_0x2c3028['push'](_0x2c3028['shift']());}};_0x786274(++_0x1e3edf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 0a9ea93..00f841c 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 _0xa6ba=['VoiceQueue','findAll','options','where','attributes','limit','include','model','GetVoiceQueue','find','raw','map','ShowVoiceQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','register','request','then','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','info','result','catch'];(function(_0x18ada7,_0xb86ff2){var _0x26bb05=function(_0x4afad9){while(--_0x4afad9){_0x18ada7['push'](_0x18ada7['shift']());}};_0x26bb05(++_0xb86ff2);}(_0xa6ba,0x1c5));var _0xaa6b=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xa6ba[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0xaa6b('0x0'));var util=require(_0xaa6b('0x1'));var moment=require(_0xaa6b('0x2'));var BPromise=require(_0xaa6b('0x3'));var rs=require(_0xaa6b('0x4'));var fs=require('fs');var Redis=require(_0xaa6b('0x5'));var db=require(_0xaa6b('0x6'))['db'];var utils=require(_0xaa6b('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xaa6b('0x8'));var jayson=require(_0xaa6b('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xaa6b('0xa')](config[_0xaa6b('0xb')],{'host':_0xaa6b('0xc'),'port':0x18eb});var socket=require(_0xaa6b('0xd'))(new Redis(config[_0xaa6b('0xb')]));require('./voiceQueue.socket')[_0xaa6b('0xe')](socket);function respondWithRpcPromise(_0xb06c4d,_0x45a513,_0x1a5791){return new BPromise(function(_0x142a74,_0x50e6e9){return client[_0xaa6b('0xf')](_0xb06c4d,_0x1a5791)[_0xaa6b('0x10')](function(_0x21e455){logger['info']('VoiceQueue,\x20%s,\x20%s',_0x45a513,'request\x20sent');logger[_0xaa6b('0x11')](_0xaa6b('0x12'),_0x45a513,'request\x20sent',JSON[_0xaa6b('0x13')](_0x21e455));if(_0x21e455[_0xaa6b('0x14')]){if(_0x21e455['error'][_0xaa6b('0x15')]===0x1f4){logger[_0xaa6b('0x14')](_0xaa6b('0x16'),_0x45a513,_0x21e455[_0xaa6b('0x14')][_0xaa6b('0x17')]);return _0x50e6e9(_0x21e455[_0xaa6b('0x14')]['message']);}logger[_0xaa6b('0x14')](_0xaa6b('0x16'),_0x45a513,_0x21e455[_0xaa6b('0x14')][_0xaa6b('0x17')]);return _0x142a74(_0x21e455[_0xaa6b('0x14')][_0xaa6b('0x17')]);}else{logger[_0xaa6b('0x18')](_0xaa6b('0x16'),_0x45a513,'request\x20sent');_0x142a74(_0x21e455[_0xaa6b('0x19')][_0xaa6b('0x17')]);}})[_0xaa6b('0x1a')](function(_0xe24342){logger[_0xaa6b('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x45a513,_0xe24342);_0x50e6e9(_0xe24342);});});}exports['GetVoiceQueue']=function(_0x1fb975){var _0x1cdadc=this;return new Promise(function(_0x3995ad,_0x23f75e){return db[_0xaa6b('0x1b')][_0xaa6b('0x1c')]({'raw':_0x1fb975['options']?_0x1fb975[_0xaa6b('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1fb975['options']?_0x1fb975[_0xaa6b('0x1d')][_0xaa6b('0x1e')]||null:null,'attributes':_0x1fb975[_0xaa6b('0x1d')]?_0x1fb975['options'][_0xaa6b('0x1f')]||null:null,'limit':_0x1fb975[_0xaa6b('0x1d')]?_0x1fb975[_0xaa6b('0x1d')][_0xaa6b('0x20')]||null:null,'include':_0x1fb975[_0xaa6b('0x1d')]?_0x1fb975['options'][_0xaa6b('0x21')]?_['map'](_0x1fb975['options'][_0xaa6b('0x21')],function(_0x323ce9){return{'model':db[_0x323ce9[_0xaa6b('0x22')]],'as':_0x323ce9['as'],'attributes':_0x323ce9['attributes'],'include':_0x323ce9[_0xaa6b('0x21')]?_['map'](_0x323ce9[_0xaa6b('0x21')],function(_0x5de0f0){return{'model':db[_0x5de0f0[_0xaa6b('0x22')]],'as':_0x5de0f0['as'],'attributes':_0x5de0f0[_0xaa6b('0x1f')],'include':_0x5de0f0['include']?_['map'](_0x5de0f0[_0xaa6b('0x21')],function(_0x3b29ee){return{'model':db[_0x3b29ee['model']],'as':_0x3b29ee['as'],'attributes':_0x3b29ee['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa6b('0x10')](function(_0x5db08a){logger[_0xaa6b('0x18')]('GetVoiceQueue',_0x1fb975);logger['debug'](_0xaa6b('0x23'),_0x1fb975,JSON[_0xaa6b('0x13')](_0x5db08a));_0x3995ad(_0x5db08a);})[_0xaa6b('0x1a')](function(_0x1b4e0a){logger[_0xaa6b('0x14')]('GetVoiceQueue',_0x1b4e0a['message'],_0x1fb975);_0x23f75e(_0x1cdadc[_0xaa6b('0x14')](0x1f4,_0x1b4e0a[_0xaa6b('0x17')]));});});};exports['ShowVoiceQueue']=function(_0xd37cdc){var _0x211237=this;return new Promise(function(_0x263753,_0x436cb4){return db[_0xaa6b('0x1b')][_0xaa6b('0x24')]({'raw':_0xd37cdc[_0xaa6b('0x1d')]?_0xd37cdc[_0xaa6b('0x1d')][_0xaa6b('0x25')]===undefined?!![]:![]:!![],'where':_0xd37cdc['options']?_0xd37cdc['options'][_0xaa6b('0x1e')]||null:null,'attributes':_0xd37cdc[_0xaa6b('0x1d')]?_0xd37cdc[_0xaa6b('0x1d')][_0xaa6b('0x1f')]||null:null,'include':_0xd37cdc[_0xaa6b('0x1d')]?_0xd37cdc[_0xaa6b('0x1d')][_0xaa6b('0x21')]?_['map'](_0xd37cdc[_0xaa6b('0x1d')][_0xaa6b('0x21')],function(_0x510262){return{'model':db[_0x510262[_0xaa6b('0x22')]],'as':_0x510262['as'],'attributes':_0x510262['attributes'],'include':_0x510262['include']?_[_0xaa6b('0x26')](_0x510262[_0xaa6b('0x21')],function(_0x5701c5){return{'model':db[_0x5701c5[_0xaa6b('0x22')]],'as':_0x5701c5['as'],'attributes':_0x5701c5[_0xaa6b('0x1f')],'include':_0x5701c5[_0xaa6b('0x21')]?_[_0xaa6b('0x26')](_0x5701c5[_0xaa6b('0x21')],function(_0x1865ff){return{'model':db[_0x1865ff[_0xaa6b('0x22')]],'as':_0x1865ff['as'],'attributes':_0x1865ff[_0xaa6b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xaa6b('0x10')](function(_0x37488d){logger[_0xaa6b('0x18')](_0xaa6b('0x27'),_0xd37cdc);logger[_0xaa6b('0x11')](_0xaa6b('0x27'),_0xd37cdc,JSON[_0xaa6b('0x13')](_0x37488d));_0x263753(_0x37488d);})['catch'](function(_0x27cff5){logger[_0xaa6b('0x14')](_0xaa6b('0x27'),_0x27cff5[_0xaa6b('0x17')],_0xd37cdc);_0x436cb4(_0x211237[_0xaa6b('0x14')](0x1f4,_0x27cff5[_0xaa6b('0x17')]));});});}; \ No newline at end of file +var _0xdb58=['defaults','socket.io-emitter','./voiceQueue.socket','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','limit','include','map','attributes','model','find','ShowVoiceQueue','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis'];(function(_0x5abe2e,_0x5c1dfc){var _0x5bfd79=function(_0xc436bd){while(--_0xc436bd){_0x5abe2e['push'](_0x5abe2e['shift']());}};_0x5bfd79(++_0x5c1dfc);}(_0xdb58,0xdf));var _0x8db5=function(_0x3f815f,_0x481053){_0x3f815f=_0x3f815f-0x0;var _0x5a65c6=_0xdb58[_0x3f815f];return _0x5a65c6;};'use strict';var _=require(_0x8db5('0x0'));var util=require(_0x8db5('0x1'));var moment=require(_0x8db5('0x2'));var BPromise=require(_0x8db5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8db5('0x5'));var logger=require('../../config/logger')(_0x8db5('0x6'));var config=require(_0x8db5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8db5('0x8')][_0x8db5('0x9')]({'port':0x232a});config[_0x8db5('0xa')]=_[_0x8db5('0xb')](config[_0x8db5('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x8db5('0xc'))(new Redis(config['redis']));require(_0x8db5('0xd'))['register'](socket);function respondWithRpcPromise(_0x3e6083,_0x3abcf4,_0x3e57ae){return new BPromise(function(_0x442af0,_0xab0833){return client[_0x8db5('0xe')](_0x3e6083,_0x3e57ae)[_0x8db5('0xf')](function(_0x409d17){logger[_0x8db5('0x10')](_0x8db5('0x11'),_0x3abcf4,_0x8db5('0x12'));logger[_0x8db5('0x13')](_0x8db5('0x14'),_0x3abcf4,_0x8db5('0x12'),JSON[_0x8db5('0x15')](_0x409d17));if(_0x409d17[_0x8db5('0x16')]){if(_0x409d17['error'][_0x8db5('0x17')]===0x1f4){logger[_0x8db5('0x16')](_0x8db5('0x11'),_0x3abcf4,_0x409d17[_0x8db5('0x16')][_0x8db5('0x18')]);return _0xab0833(_0x409d17[_0x8db5('0x16')][_0x8db5('0x18')]);}logger[_0x8db5('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x3abcf4,_0x409d17[_0x8db5('0x16')][_0x8db5('0x18')]);return _0x442af0(_0x409d17[_0x8db5('0x16')]['message']);}else{logger['info'](_0x8db5('0x11'),_0x3abcf4,'request\x20sent');_0x442af0(_0x409d17['result'][_0x8db5('0x18')]);}})[_0x8db5('0x19')](function(_0x1b4036){logger[_0x8db5('0x16')](_0x8db5('0x11'),_0x3abcf4,_0x1b4036);_0xab0833(_0x1b4036);});});}exports[_0x8db5('0x1a')]=function(_0x1bfbdc){var _0x5f43a3=this;return new Promise(function(_0x481136,_0x537083){return db[_0x8db5('0x1b')][_0x8db5('0x1c')]({'raw':_0x1bfbdc[_0x8db5('0x1d')]?_0x1bfbdc[_0x8db5('0x1d')][_0x8db5('0x1e')]===undefined?!![]:![]:!![],'where':_0x1bfbdc['options']?_0x1bfbdc['options'][_0x8db5('0x1f')]||null:null,'attributes':_0x1bfbdc['options']?_0x1bfbdc[_0x8db5('0x1d')]['attributes']||null:null,'limit':_0x1bfbdc[_0x8db5('0x1d')]?_0x1bfbdc['options'][_0x8db5('0x20')]||null:null,'include':_0x1bfbdc[_0x8db5('0x1d')]?_0x1bfbdc[_0x8db5('0x1d')][_0x8db5('0x21')]?_[_0x8db5('0x22')](_0x1bfbdc[_0x8db5('0x1d')][_0x8db5('0x21')],function(_0x6f0539){return{'model':db[_0x6f0539['model']],'as':_0x6f0539['as'],'attributes':_0x6f0539[_0x8db5('0x23')],'include':_0x6f0539[_0x8db5('0x21')]?_['map'](_0x6f0539[_0x8db5('0x21')],function(_0x78d0e4){return{'model':db[_0x78d0e4['model']],'as':_0x78d0e4['as'],'attributes':_0x78d0e4['attributes'],'include':_0x78d0e4[_0x8db5('0x21')]?_[_0x8db5('0x22')](_0x78d0e4['include'],function(_0x1d2c83){return{'model':db[_0x1d2c83[_0x8db5('0x24')]],'as':_0x1d2c83['as'],'attributes':_0x1d2c83[_0x8db5('0x23')]};}):[]};}):[]};}):[]:[]})[_0x8db5('0xf')](function(_0x20d31e){logger[_0x8db5('0x10')](_0x8db5('0x1a'),_0x1bfbdc);logger[_0x8db5('0x13')](_0x8db5('0x1a'),_0x1bfbdc,JSON[_0x8db5('0x15')](_0x20d31e));_0x481136(_0x20d31e);})[_0x8db5('0x19')](function(_0x324f8b){logger[_0x8db5('0x16')](_0x8db5('0x1a'),_0x324f8b[_0x8db5('0x18')],_0x1bfbdc);_0x537083(_0x5f43a3[_0x8db5('0x16')](0x1f4,_0x324f8b['message']));});});};exports['ShowVoiceQueue']=function(_0x473bac){var _0x57ee5a=this;return new Promise(function(_0x64cb7,_0x44afe2){return db['VoiceQueue'][_0x8db5('0x25')]({'raw':_0x473bac[_0x8db5('0x1d')]?_0x473bac['options'][_0x8db5('0x1e')]===undefined?!![]:![]:!![],'where':_0x473bac[_0x8db5('0x1d')]?_0x473bac['options'][_0x8db5('0x1f')]||null:null,'attributes':_0x473bac[_0x8db5('0x1d')]?_0x473bac['options'][_0x8db5('0x23')]||null:null,'include':_0x473bac[_0x8db5('0x1d')]?_0x473bac[_0x8db5('0x1d')][_0x8db5('0x21')]?_[_0x8db5('0x22')](_0x473bac[_0x8db5('0x1d')][_0x8db5('0x21')],function(_0x2c36fa){return{'model':db[_0x2c36fa[_0x8db5('0x24')]],'as':_0x2c36fa['as'],'attributes':_0x2c36fa['attributes'],'include':_0x2c36fa[_0x8db5('0x21')]?_[_0x8db5('0x22')](_0x2c36fa[_0x8db5('0x21')],function(_0x2163ee){return{'model':db[_0x2163ee[_0x8db5('0x24')]],'as':_0x2163ee['as'],'attributes':_0x2163ee[_0x8db5('0x23')],'include':_0x2163ee['include']?_['map'](_0x2163ee[_0x8db5('0x21')],function(_0x531703){return{'model':db[_0x531703['model']],'as':_0x531703['as'],'attributes':_0x531703[_0x8db5('0x23')]};}):[]};}):[]};}):[]:[]})[_0x8db5('0xf')](function(_0x52e83b){logger['info']('ShowVoiceQueue',_0x473bac);logger[_0x8db5('0x13')](_0x8db5('0x26'),_0x473bac,JSON[_0x8db5('0x15')](_0x52e83b));_0x64cb7(_0x52e83b);})[_0x8db5('0x19')](function(_0x57a6be){logger[_0x8db5('0x16')](_0x8db5('0x26'),_0x57a6be['message'],_0x473bac);_0x44afe2(_0x57ee5a[_0x8db5('0x16')](0x1f4,_0x57a6be[_0x8db5('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 3dbe35c..996a40f 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 _0x0395=['update','emit','register','voiceQueue:','./voiceQueue.events','save','remove'];(function(_0x234405,_0x332f9c){var _0x25d2b3=function(_0x1ab751){while(--_0x1ab751){_0x234405['push'](_0x234405['shift']());}};_0x25d2b3(++_0x332f9c);}(_0x0395,0xd6));var _0x5039=function(_0x19d24c,_0x62bc50){_0x19d24c=_0x19d24c-0x0;var _0x2fae8d=_0x0395[_0x19d24c];return _0x2fae8d;};'use strict';var VoiceQueueEvents=require(_0x5039('0x0'));var events=[_0x5039('0x1'),_0x5039('0x2'),_0x5039('0x3')];function createListener(_0x1ea47d,_0x3e26a6){return function(_0x1c6f54){_0x3e26a6[_0x5039('0x4')](_0x1ea47d,_0x1c6f54);};}function removeListener(_0x8a370c,_0x21c556){return function(){VoiceQueueEvents['removeListener'](_0x8a370c,_0x21c556);};}exports[_0x5039('0x5')]=function(_0x49eae2){for(var _0x50e9a1=0x0,_0x1f8ee6=events['length'];_0x50e9a1<_0x1f8ee6;_0x50e9a1++){var _0x5d1183=events[_0x50e9a1];var _0x26184c=createListener(_0x5039('0x6')+_0x5d1183,_0x49eae2);VoiceQueueEvents['on'](_0x5d1183,_0x26184c);}}; \ No newline at end of file +var _0x8b32=['./voiceQueue.events','save','remove','removeListener','length','voiceQueue:'];(function(_0x4077df,_0x10621c){var _0x57aeff=function(_0x3f1af0){while(--_0x3f1af0){_0x4077df['push'](_0x4077df['shift']());}};_0x57aeff(++_0x10621c);}(_0x8b32,0xde));var _0x28b3=function(_0xee793d,_0x3bd83c){_0xee793d=_0xee793d-0x0;var _0x59bec0=_0x8b32[_0xee793d];return _0x59bec0;};'use strict';var VoiceQueueEvents=require(_0x28b3('0x0'));var events=[_0x28b3('0x1'),_0x28b3('0x2'),'update'];function createListener(_0x3d1553,_0x91b73){return function(_0x43bc56){_0x91b73['emit'](_0x3d1553,_0x43bc56);};}function removeListener(_0x718fd4,_0x495a67){return function(){VoiceQueueEvents[_0x28b3('0x3')](_0x718fd4,_0x495a67);};}exports['register']=function(_0x1ce947){for(var _0x2fc7c6=0x0,_0x3d884f=events[_0x28b3('0x4')];_0x2fc7c6<_0x3d884f;_0x2fc7c6++){var _0x34a626=events[_0x2fc7c6];var _0x2bf1c0=createListener(_0x28b3('0x5')+_0x34a626,_0x1ce947);VoiceQueueEvents['on'](_0x34a626,_0x2bf1c0);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index adfda18..e7d6248 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 _0xc077=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','index','get','/describe','describe','/index','isAuthenticated','getVoiceQueuesReport','/:id','show','post','put','delete'];(function(_0x9c8b4a,_0x2387ff){var _0x198bef=function(_0x2eb4e8){while(--_0x2eb4e8){_0x9c8b4a['push'](_0x9c8b4a['shift']());}};_0x198bef(++_0x2387ff);}(_0xc077,0x109));var _0x7c07=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xc077[_0x36dfbd];return _0x4ecad9;};'use strict';var multer=require(_0x7c07('0x0'));var util=require(_0x7c07('0x1'));var path=require(_0x7c07('0x2'));var timeout=require(_0x7c07('0x3'));var express=require('express');var router=express[_0x7c07('0x4')]();var fs_extra=require(_0x7c07('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7c07('0x6'));var config=require(_0x7c07('0x7'));var controller=require(_0x7c07('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x7c07('0x9')]);router[_0x7c07('0xa')](_0x7c07('0xb'),auth['isAuthenticated'](),controller[_0x7c07('0xc')]);router[_0x7c07('0xa')](_0x7c07('0xd'),auth[_0x7c07('0xe')](),controller[_0x7c07('0xf')]);router[_0x7c07('0xa')](_0x7c07('0x10'),auth[_0x7c07('0xe')](),controller[_0x7c07('0x11')]);router[_0x7c07('0x12')]('/',auth[_0x7c07('0xe')](),controller['create']);router[_0x7c07('0x13')](_0x7c07('0x10'),auth[_0x7c07('0xe')](),controller['update']);router[_0x7c07('0x14')](_0x7c07('0x10'),auth[_0x7c07('0xe')](),controller['destroy']);module[_0x7c07('0x15')]=router; \ No newline at end of file +var _0x360c=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','index','/describe','isAuthenticated','describe','/index','getVoiceQueuesReport','/:id','show','post','update','delete'];(function(_0x2fe457,_0x1c58d6){var _0x40dac7=function(_0x29839b){while(--_0x29839b){_0x2fe457['push'](_0x2fe457['shift']());}};_0x40dac7(++_0x1c58d6);}(_0x360c,0x1d0));var _0xc360=function(_0x30078d,_0x24abbd){_0x30078d=_0x30078d-0x0;var _0x18417d=_0x360c[_0x30078d];return _0x18417d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc360('0x0'));var timeout=require(_0xc360('0x1'));var express=require(_0xc360('0x2'));var router=express[_0xc360('0x3')]();var fs_extra=require(_0xc360('0x4'));var auth=require(_0xc360('0x5'));var interaction=require(_0xc360('0x6'));var config=require('../../config/environment');var controller=require(_0xc360('0x7'));router[_0xc360('0x8')]('/',auth['isAuthenticated'](),controller[_0xc360('0x9')]);router['get'](_0xc360('0xa'),auth[_0xc360('0xb')](),controller[_0xc360('0xc')]);router[_0xc360('0x8')](_0xc360('0xd'),auth[_0xc360('0xb')](),controller[_0xc360('0xe')]);router['get'](_0xc360('0xf'),auth['isAuthenticated'](),controller[_0xc360('0x10')]);router[_0xc360('0x11')]('/',auth[_0xc360('0xb')](),controller['create']);router['put'](_0xc360('0xf'),auth['isAuthenticated'](),controller[_0xc360('0x12')]);router[_0xc360('0x13')]('/:id',auth[_0xc360('0xb')](),controller[_0xc360('0x14')]);module[_0xc360('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 0e3d1a9..2bf4e96 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 _0x4f5b=['moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0x4f5b,0xc3));var _0xb4f5=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4f5b[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb4f5('0x0'));module[_0xb4f5('0x1')]={'type':{'type':Sequelize[_0xb4f5('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb4f5('0x2')]},'calleridname':{'type':Sequelize[_0xb4f5('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xb4f5('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xb4f5('0x3')],'set':function(_0x401b89){var _0x3a1b05=moment(_0x401b89);var _0x1bffa0=moment(this[_0xb4f5('0x4')](_0xb4f5('0x5')))[_0xb4f5('0x6')](_0xb4f5('0x7'));var _0x34fbed=_0x3a1b05[_0xb4f5('0x8')](_0x1bffa0,'seconds');this[_0xb4f5('0x9')]('queuecallerleaveAt',_0x401b89);this[_0xb4f5('0x9')](_0xb4f5('0xa'),_0x34fbed||null);}},'position':{'type':Sequelize[_0xb4f5('0xb')]},'count':{'type':Sequelize[_0xb4f5('0xb')]},'queuecallerabandon':{'type':Sequelize[_0xb4f5('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xb4f5('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xb4f5('0x2')],'comment':_0xb4f5('0xd')},'originalposition':{'type':Sequelize[_0xb4f5('0xb')]},'channel':{'type':Sequelize[_0xb4f5('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb4f5('0x2')]},'accountcode':{'type':Sequelize[_0xb4f5('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb4f5('0x2')]},'holdtime':{'type':Sequelize[_0xb4f5('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xb4f5('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xb4f5('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xb4f5('0xe')},'transferexten':{'type':Sequelize[_0xb4f5('0x2')]},'transferuniqueid':{'type':Sequelize[_0xb4f5('0x2')]},'disposition':{'type':Sequelize[_0xb4f5('0x2')]},'secondDisposition':{'type':Sequelize[_0xb4f5('0x2')]},'thirdDisposition':{'type':Sequelize[_0xb4f5('0x2')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5460=['BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER'];(function(_0x2c0dc0,_0x19900d){var _0x4c0990=function(_0x530791){while(--_0x530791){_0x2c0dc0['push'](_0x2c0dc0['shift']());}};_0x4c0990(++_0x19900d);}(_0x5460,0x1f3));var _0x0546=function(_0x36c3b7,_0x596033){_0x36c3b7=_0x36c3b7-0x0;var _0x21eedf=_0x5460[_0x36c3b7];return _0x21eedf;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0546('0x0'));module[_0x0546('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x0546('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0546('0x2')]},'queue':{'type':Sequelize[_0x0546('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x0546('0x3')],'set':function(_0x161567){var _0x36c667=moment(_0x161567);var _0x599437=moment(this[_0x0546('0x4')]('queuecallerjoinAt'))[_0x0546('0x5')](_0x0546('0x6'));var _0x827007=_0x36c667[_0x0546('0x7')](_0x599437,_0x0546('0x8'));this[_0x0546('0x9')](_0x0546('0xa'),_0x161567);this[_0x0546('0x9')](_0x0546('0xb'),_0x827007||null);}},'position':{'type':Sequelize[_0x0546('0xc')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x0546('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x0546('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x0546('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x0546('0x3')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x0546('0xe')},'originalposition':{'type':Sequelize[_0x0546('0xc')]},'channel':{'type':Sequelize[_0x0546('0x2')]},'connectedlinenum':{'type':Sequelize[_0x0546('0x2')]},'connectedlinename':{'type':Sequelize[_0x0546('0x2')]},'accountcode':{'type':Sequelize[_0x0546('0x2')]},'context':{'type':Sequelize[_0x0546('0x2')]},'exten':{'type':Sequelize[_0x0546('0x2')]},'priority':{'type':Sequelize[_0x0546('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x0546('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x0546('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x0546('0x2')]},'transfer':{'type':Sequelize[_0x0546('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0546('0x2')],'comment':_0x0546('0xf')},'transferexten':{'type':Sequelize[_0x0546('0x2')]},'transferuniqueid':{'type':Sequelize[_0x0546('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x0546('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x0546('0xc')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 63ce5cf..72ed8de 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 _0xa7b7=['redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','json','limit','undefined','offset','count','set','Content-Range','save','update','destroy','then','end','sendStatus','error','stack','name','send','map','VoiceQueueReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','keys','length','include','catch','create','body','find','describe','getVoiceQueuesReport','order','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults'];(function(_0x2a5d70,_0x4a7a48){var _0x212df6=function(_0x4e7f6){while(--_0x4e7f6){_0x2a5d70['push'](_0x2a5d70['shift']());}};_0x212df6(++_0x4a7a48);}(_0xa7b7,0x132));var _0x7a7b=function(_0xcdabbe,_0x4051fe){_0xcdabbe=_0xcdabbe-0x0;var _0x5cc288=_0xa7b7[_0xcdabbe];return _0x5cc288;};'use strict';var emlformat=require(_0x7a7b('0x0'));var rimraf=require(_0x7a7b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7a7b('0x2'));var rp=require(_0x7a7b('0x3'));var moment=require(_0x7a7b('0x4'));var BPromise=require(_0x7a7b('0x5'));var Mustache=require(_0x7a7b('0x6'));var util=require(_0x7a7b('0x7'));var path=require(_0x7a7b('0x8'));var sox=require(_0x7a7b('0x9'));var csv=require(_0x7a7b('0xa'));var ejs=require(_0x7a7b('0xb'));var fs=require('fs');var fs_extra=require(_0x7a7b('0xc'));var _=require(_0x7a7b('0xd'));var squel=require(_0x7a7b('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7a7b('0xf'));var toCsv=require(_0x7a7b('0xa'));var querystring=require(_0x7a7b('0x10'));var Papa=require(_0x7a7b('0x11'));var Redis=require(_0x7a7b('0x12'));var authService=require(_0x7a7b('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7a7b('0x14'))(_0x7a7b('0x15'));var utils=require(_0x7a7b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7a7b('0x17'));var db=require(_0x7a7b('0x18'))['db'];config['redis']=_[_0x7a7b('0x19')](config[_0x7a7b('0x1a')],{'host':_0x7a7b('0x1b'),'port':0x18eb});var socket=require(_0x7a7b('0x1c'))(new Redis(config[_0x7a7b('0x1a')]));require(_0x7a7b('0x1d'))[_0x7a7b('0x1e')](socket);function respondWithStatusCode(_0x35e08b,_0x4b9a27){_0x4b9a27=_0x4b9a27||0xcc;return function(_0xd263a){if(_0xd263a){return _0x35e08b['sendStatus'](_0x4b9a27);}return _0x35e08b[_0x7a7b('0x1f')](_0x4b9a27)['end']();};}function respondWithResult(_0x4246b0,_0x2062c7){_0x2062c7=_0x2062c7||0xc8;return function(_0x50c61d){if(_0x50c61d){return _0x4246b0[_0x7a7b('0x1f')](_0x2062c7)[_0x7a7b('0x20')](_0x50c61d);}};}function respondWithFilteredResult(_0x3d78fa,_0x2199d0){return function(_0x179294){if(_0x179294){var _0x4a48eb=typeof _0x2199d0['offset']==='undefined'&&typeof _0x2199d0[_0x7a7b('0x21')]===_0x7a7b('0x22');var _0x6e9175=_0x179294['count'];var _0x22715a=_0x4a48eb?0x0:_0x2199d0[_0x7a7b('0x23')];var _0x3c588f=_0x4a48eb?_0x179294[_0x7a7b('0x24')]:_0x2199d0[_0x7a7b('0x23')]+_0x2199d0[_0x7a7b('0x21')];var _0x3d8062;if(_0x3c588f>=_0x6e9175){_0x3c588f=_0x6e9175;_0x3d8062=0xc8;}else{_0x3d8062=0xce;}_0x3d78fa[_0x7a7b('0x1f')](_0x3d8062);return _0x3d78fa[_0x7a7b('0x25')](_0x7a7b('0x26'),_0x22715a+'-'+_0x3c588f+'/'+_0x6e9175)[_0x7a7b('0x20')](_0x179294);}return null;};}function patchUpdates(_0x23cfdf){return function(_0x25e5a1){try{jsonpatch['apply'](_0x25e5a1,_0x23cfdf,!![]);}catch(_0x5a2b30){return BPromise['reject'](_0x5a2b30);}return _0x25e5a1[_0x7a7b('0x27')]();};}function saveUpdates(_0x593e3c,_0x4060e0){return function(_0xb3cc7e){if(_0xb3cc7e){return _0xb3cc7e[_0x7a7b('0x28')](_0x593e3c)['then'](function(_0x4a3e58){return _0x4a3e58;});}return null;};}function removeEntity(_0x2e5a31,_0x3fa3cc){return function(_0x52f1cb){if(_0x52f1cb){return _0x52f1cb[_0x7a7b('0x29')]()[_0x7a7b('0x2a')](function(){_0x2e5a31[_0x7a7b('0x1f')](0xcc)[_0x7a7b('0x2b')]();});}};}function handleEntityNotFound(_0x35a0f0,_0x5f50c3){return function(_0x81799d){if(!_0x81799d){_0x35a0f0[_0x7a7b('0x2c')](0x194);}return _0x81799d;};}function handleError(_0x39d42e,_0x10fbb2){_0x10fbb2=_0x10fbb2||0x1f4;return function(_0x421933){logger[_0x7a7b('0x2d')](_0x421933[_0x7a7b('0x2e')]);if(_0x421933[_0x7a7b('0x2f')]){delete _0x421933[_0x7a7b('0x2f')];}_0x39d42e['status'](_0x10fbb2)[_0x7a7b('0x30')](_0x421933);};}exports['index']=function(_0x4e9d7a,_0x357b49){var _0x2fc5ef={},_0x153988={},_0x1a7f43={'count':0x0,'rows':[]};var _0x3177ae=_[_0x7a7b('0x31')](db[_0x7a7b('0x32')][_0x7a7b('0x33')],function(_0x40a50b){return{'name':_0x40a50b[_0x7a7b('0x34')],'type':_0x40a50b[_0x7a7b('0x35')]['key']};});_0x153988[_0x7a7b('0x36')]=_[_0x7a7b('0x31')](_0x3177ae,_0x7a7b('0x2f'));_0x153988[_0x7a7b('0x37')]=_['keys'](_0x4e9d7a[_0x7a7b('0x37')]);_0x153988[_0x7a7b('0x38')]=_[_0x7a7b('0x39')](_0x153988[_0x7a7b('0x36')],_0x153988[_0x7a7b('0x37')]);_0x2fc5ef[_0x7a7b('0x3a')]=_['intersection'](_0x153988['model'],qs[_0x7a7b('0x3b')](_0x4e9d7a[_0x7a7b('0x37')][_0x7a7b('0x3b')]));_0x2fc5ef['attributes']=_0x2fc5ef[_0x7a7b('0x3a')]['length']?_0x2fc5ef[_0x7a7b('0x3a')]:_0x153988[_0x7a7b('0x36')];if(!_0x4e9d7a[_0x7a7b('0x37')][_0x7a7b('0x3c')](_0x7a7b('0x3d'))){_0x2fc5ef[_0x7a7b('0x21')]=qs[_0x7a7b('0x21')](_0x4e9d7a[_0x7a7b('0x37')][_0x7a7b('0x21')]);_0x2fc5ef['offset']=qs[_0x7a7b('0x23')](_0x4e9d7a['query']['offset']);}_0x2fc5ef['order']=qs['sort'](_0x4e9d7a['query'][_0x7a7b('0x3e')]);_0x2fc5ef[_0x7a7b('0x3f')]=qs[_0x7a7b('0x38')](_[_0x7a7b('0x40')](_0x4e9d7a['query'],_0x153988[_0x7a7b('0x38')]),_0x3177ae);if(_0x4e9d7a[_0x7a7b('0x37')][_0x7a7b('0x41')]){_0x2fc5ef[_0x7a7b('0x3f')]=_[_0x7a7b('0x42')](_0x2fc5ef[_0x7a7b('0x3f')],{'$or':_[_0x7a7b('0x31')](_0x3177ae,function(_0x2e7be9){if(_0x2e7be9[_0x7a7b('0x35')]!=='VIRTUAL'){var _0x3aad6a={};_0x3aad6a[_0x2e7be9[_0x7a7b('0x2f')]]={'$like':'%'+_0x4e9d7a['query']['filter']+'%'};return _0x3aad6a;}})});}_0x2fc5ef=_['merge']({},_0x2fc5ef,_0x4e9d7a[_0x7a7b('0x43')]);var _0x58ff18={'where':_0x2fc5ef[_0x7a7b('0x3f')]};return db[_0x7a7b('0x32')][_0x7a7b('0x24')](_0x58ff18)[_0x7a7b('0x2a')](function(_0x26f717){_0x1a7f43[_0x7a7b('0x24')]=_0x26f717;if(_0x4e9d7a[_0x7a7b('0x37')][_0x7a7b('0x44')]){_0x2fc5ef['include']=[{'all':!![]}];}return db[_0x7a7b('0x32')][_0x7a7b('0x45')](_0x2fc5ef);})[_0x7a7b('0x2a')](function(_0xbb9be5){_0x1a7f43[_0x7a7b('0x46')]=_0xbb9be5;return _0x1a7f43;})[_0x7a7b('0x2a')](respondWithFilteredResult(_0x357b49,_0x2fc5ef))['catch'](handleError(_0x357b49,null));};exports[_0x7a7b('0x47')]=function(_0x2c2d76,_0x5bda03){var _0x55645d={'raw':![],'where':{'id':_0x2c2d76[_0x7a7b('0x48')]['id']}},_0x4d7759={};_0x4d7759[_0x7a7b('0x36')]=_[_0x7a7b('0x49')](db['VoiceQueueReport']['rawAttributes']);_0x4d7759[_0x7a7b('0x37')]=_[_0x7a7b('0x49')](_0x2c2d76['query']);_0x4d7759[_0x7a7b('0x38')]=_[_0x7a7b('0x39')](_0x4d7759[_0x7a7b('0x36')],_0x4d7759[_0x7a7b('0x37')]);_0x55645d[_0x7a7b('0x3a')]=_['intersection'](_0x4d7759[_0x7a7b('0x36')],qs[_0x7a7b('0x3b')](_0x2c2d76[_0x7a7b('0x37')][_0x7a7b('0x3b')]));_0x55645d[_0x7a7b('0x3a')]=_0x55645d[_0x7a7b('0x3a')][_0x7a7b('0x4a')]?_0x55645d[_0x7a7b('0x3a')]:_0x4d7759[_0x7a7b('0x36')];if(_0x2c2d76[_0x7a7b('0x37')][_0x7a7b('0x44')]){_0x55645d[_0x7a7b('0x4b')]=[{'all':!![]}];}_0x55645d=_['merge']({},_0x55645d,_0x2c2d76[_0x7a7b('0x43')]);return db[_0x7a7b('0x32')]['find'](_0x55645d)[_0x7a7b('0x2a')](handleEntityNotFound(_0x5bda03,null))[_0x7a7b('0x2a')](respondWithResult(_0x5bda03,null))[_0x7a7b('0x4c')](handleError(_0x5bda03,null));};exports[_0x7a7b('0x4d')]=function(_0x3f73ed,_0x2fa48b){return db[_0x7a7b('0x32')][_0x7a7b('0x4d')](_0x3f73ed[_0x7a7b('0x4e')],{})[_0x7a7b('0x2a')](respondWithResult(_0x2fa48b,0xc9))[_0x7a7b('0x4c')](handleError(_0x2fa48b,null));};exports[_0x7a7b('0x28')]=function(_0x23e86b,_0x33ee1c){if(_0x23e86b[_0x7a7b('0x4e')]['id']){delete _0x23e86b[_0x7a7b('0x4e')]['id'];}return db[_0x7a7b('0x32')][_0x7a7b('0x4f')]({'where':{'id':_0x23e86b[_0x7a7b('0x48')]['id']}})[_0x7a7b('0x2a')](handleEntityNotFound(_0x33ee1c,null))['then'](saveUpdates(_0x23e86b[_0x7a7b('0x4e')],null))[_0x7a7b('0x2a')](respondWithResult(_0x33ee1c,null))[_0x7a7b('0x4c')](handleError(_0x33ee1c,null));};exports[_0x7a7b('0x29')]=function(_0x33b8c0,_0x1c9ea3){return db[_0x7a7b('0x32')][_0x7a7b('0x4f')]({'where':{'id':_0x33b8c0[_0x7a7b('0x48')]['id']}})['then'](handleEntityNotFound(_0x1c9ea3,null))[_0x7a7b('0x2a')](removeEntity(_0x1c9ea3,null))[_0x7a7b('0x4c')](handleError(_0x1c9ea3,null));};exports[_0x7a7b('0x50')]=function(_0x981493,_0x1ee856){return db[_0x7a7b('0x32')][_0x7a7b('0x50')]()[_0x7a7b('0x2a')](respondWithResult(_0x1ee856,null))[_0x7a7b('0x4c')](handleError(_0x1ee856,null));};exports[_0x7a7b('0x51')]=function(_0x2aa7f3,_0x576aa8){var _0x57a90c={},_0x26fd51={},_0x5285a1={'count':0x0,'rows':[]};_0x26fd51[_0x7a7b('0x36')]=_[_0x7a7b('0x49')](db[_0x7a7b('0x32')][_0x7a7b('0x33')]);_0x26fd51[_0x7a7b('0x37')]=_['keys'](_0x2aa7f3['query']);_0x26fd51[_0x7a7b('0x38')]=_[_0x7a7b('0x39')](_0x26fd51['model'],_0x26fd51[_0x7a7b('0x37')]);_0x57a90c['attributes']=_[_0x7a7b('0x39')](_0x26fd51[_0x7a7b('0x36')],qs['fields'](_0x2aa7f3[_0x7a7b('0x37')][_0x7a7b('0x3b')]));_0x57a90c['attributes']=_0x57a90c[_0x7a7b('0x3a')][_0x7a7b('0x4a')]?_0x57a90c[_0x7a7b('0x3a')]:_0x26fd51[_0x7a7b('0x36')];if(!_0x2aa7f3[_0x7a7b('0x37')][_0x7a7b('0x3c')]('nolimit')){_0x57a90c[_0x7a7b('0x21')]=qs[_0x7a7b('0x21')](_0x2aa7f3['query'][_0x7a7b('0x21')]);_0x57a90c[_0x7a7b('0x23')]=qs['offset'](_0x2aa7f3['query'][_0x7a7b('0x23')]);}_0x57a90c[_0x7a7b('0x52')]=qs[_0x7a7b('0x3e')](_0x2aa7f3[_0x7a7b('0x37')]['sort']);_0x57a90c[_0x7a7b('0x3f')]=qs[_0x7a7b('0x38')](_['pick'](_0x2aa7f3[_0x7a7b('0x37')],_0x26fd51[_0x7a7b('0x38')]));if(_0x2aa7f3[_0x7a7b('0x37')]['filter']){_0x57a90c[_0x7a7b('0x3f')]=_[_0x7a7b('0x42')](_0x57a90c[_0x7a7b('0x3f')],{'$or':_[_0x7a7b('0x31')](_0x57a90c[_0x7a7b('0x3a')],function(_0x2aa17e){var _0x3f707e={};_0x3f707e[_0x2aa17e]={'$like':'%'+_0x2aa7f3['query'][_0x7a7b('0x41')]+'%'};return _0x3f707e;})});}_0x57a90c=_['merge']({},_0x57a90c,_0x2aa7f3[_0x7a7b('0x43')]);var _0x5a5157={'where':_0x57a90c[_0x7a7b('0x3f')]};return db[_0x7a7b('0x32')]['count'](_0x5a5157)[_0x7a7b('0x2a')](function(_0x182538){_0x5285a1['count']=_0x182538;if(_0x2aa7f3[_0x7a7b('0x37')]['includeAll']){_0x57a90c[_0x7a7b('0x4b')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x7a7b('0x45')](_0x57a90c);})[_0x7a7b('0x2a')](function(_0x375ccf){_0x5285a1[_0x7a7b('0x46')]=_0x375ccf;return _0x5285a1;})[_0x7a7b('0x2a')](respondWithFilteredResult(_0x576aa8,_0x57a90c,_0x7a7b('0x51')))[_0x7a7b('0x4c')](handleError(_0x576aa8,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x921e=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','show','params','intersection','find','catch','create','body','describe','getVoiceQueuesReport','rows','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x921e,0xa4));var _0xe921=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x921e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xe921('0x0'));var rimraf=require(_0xe921('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe921('0x2'));var rp=require(_0xe921('0x3'));var moment=require(_0xe921('0x4'));var BPromise=require(_0xe921('0x5'));var Mustache=require('mustache');var util=require(_0xe921('0x6'));var path=require(_0xe921('0x7'));var sox=require(_0xe921('0x8'));var csv=require('to-csv');var ejs=require(_0xe921('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe921('0xa'));var squel=require(_0xe921('0xb'));var crypto=require(_0xe921('0xc'));var jsforce=require(_0xe921('0xd'));var deskjs=require(_0xe921('0xe'));var toCsv=require(_0xe921('0xf'));var querystring=require(_0xe921('0x10'));var Papa=require(_0xe921('0x11'));var Redis=require(_0xe921('0x12'));var authService=require(_0xe921('0x13'));var qs=require(_0xe921('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe921('0x15'));var logger=require('../../config/logger')(_0xe921('0x16'));var utils=require(_0xe921('0x17'));var config=require(_0xe921('0x18'));var licenseUtil=require(_0xe921('0x19'));var db=require(_0xe921('0x1a'))['db'];config['redis']=_['defaults'](config[_0xe921('0x1b')],{'host':_0xe921('0x1c'),'port':0x18eb});var socket=require(_0xe921('0x1d'))(new Redis(config[_0xe921('0x1b')]));require(_0xe921('0x1e'))[_0xe921('0x1f')](socket);function respondWithStatusCode(_0x478f66,_0x136b72){_0x136b72=_0x136b72||0xcc;return function(_0xdfbf0a){if(_0xdfbf0a){return _0x478f66[_0xe921('0x20')](_0x136b72);}return _0x478f66[_0xe921('0x21')](_0x136b72)[_0xe921('0x22')]();};}function respondWithResult(_0x25e066,_0x184ad9){_0x184ad9=_0x184ad9||0xc8;return function(_0x1396c0){if(_0x1396c0){return _0x25e066[_0xe921('0x21')](_0x184ad9)[_0xe921('0x23')](_0x1396c0);}};}function respondWithFilteredResult(_0x2394a1,_0x45be17){return function(_0x3a292d){if(_0x3a292d){var _0x223b81=typeof _0x45be17[_0xe921('0x24')]===_0xe921('0x25')&&typeof _0x45be17['limit']===_0xe921('0x25');var _0xb31b0d=_0x3a292d[_0xe921('0x26')];var _0x2da47c=_0x223b81?0x0:_0x45be17[_0xe921('0x24')];var _0x8e85d4=_0x223b81?_0x3a292d['count']:_0x45be17[_0xe921('0x24')]+_0x45be17['limit'];var _0x469d46;if(_0x8e85d4>=_0xb31b0d){_0x8e85d4=_0xb31b0d;_0x469d46=0xc8;}else{_0x469d46=0xce;}_0x2394a1[_0xe921('0x21')](_0x469d46);return _0x2394a1[_0xe921('0x27')](_0xe921('0x28'),_0x2da47c+'-'+_0x8e85d4+'/'+_0xb31b0d)[_0xe921('0x23')](_0x3a292d);}return null;};}function patchUpdates(_0x51ebcf){return function(_0x5689f7){try{jsonpatch[_0xe921('0x29')](_0x5689f7,_0x51ebcf,!![]);}catch(_0x3f938d){return BPromise[_0xe921('0x2a')](_0x3f938d);}return _0x5689f7[_0xe921('0x2b')]();};}function saveUpdates(_0x5ee0e1,_0x43845f){return function(_0x5e3250){if(_0x5e3250){return _0x5e3250[_0xe921('0x2c')](_0x5ee0e1)[_0xe921('0x2d')](function(_0x1b3bdd){return _0x1b3bdd;});}return null;};}function removeEntity(_0x378cd8,_0x491af0){return function(_0x34e7d8){if(_0x34e7d8){return _0x34e7d8[_0xe921('0x2e')]()[_0xe921('0x2d')](function(){_0x378cd8[_0xe921('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44da32,_0x21f822){return function(_0x4e2beb){if(!_0x4e2beb){_0x44da32[_0xe921('0x20')](0x194);}return _0x4e2beb;};}function handleError(_0x2ef390,_0x165eca){_0x165eca=_0x165eca||0x1f4;return function(_0x4a4980){logger[_0xe921('0x2f')](_0x4a4980[_0xe921('0x30')]);if(_0x4a4980[_0xe921('0x31')]){delete _0x4a4980[_0xe921('0x31')];}_0x2ef390[_0xe921('0x21')](_0x165eca)[_0xe921('0x32')](_0x4a4980);};}exports[_0xe921('0x33')]=function(_0x188f4c,_0x50819b){var _0x3c0899={},_0x1a76fd={},_0x66b47={'count':0x0,'rows':[]};var _0x5c7537=_[_0xe921('0x34')](db[_0xe921('0x35')][_0xe921('0x36')],function(_0x5c728e){return{'name':_0x5c728e[_0xe921('0x37')],'type':_0x5c728e[_0xe921('0x38')][_0xe921('0x39')]};});_0x1a76fd[_0xe921('0x3a')]=_[_0xe921('0x34')](_0x5c7537,_0xe921('0x31'));_0x1a76fd[_0xe921('0x3b')]=_[_0xe921('0x3c')](_0x188f4c[_0xe921('0x3b')]);_0x1a76fd[_0xe921('0x3d')]=_['intersection'](_0x1a76fd['model'],_0x1a76fd['query']);_0x3c0899[_0xe921('0x3e')]=_['intersection'](_0x1a76fd[_0xe921('0x3a')],qs[_0xe921('0x3f')](_0x188f4c[_0xe921('0x3b')][_0xe921('0x3f')]));_0x3c0899[_0xe921('0x3e')]=_0x3c0899[_0xe921('0x3e')][_0xe921('0x40')]?_0x3c0899[_0xe921('0x3e')]:_0x1a76fd[_0xe921('0x3a')];if(!_0x188f4c[_0xe921('0x3b')][_0xe921('0x41')](_0xe921('0x42'))){_0x3c0899[_0xe921('0x43')]=qs[_0xe921('0x43')](_0x188f4c[_0xe921('0x3b')][_0xe921('0x43')]);_0x3c0899[_0xe921('0x24')]=qs[_0xe921('0x24')](_0x188f4c['query'][_0xe921('0x24')]);}_0x3c0899[_0xe921('0x44')]=qs[_0xe921('0x45')](_0x188f4c['query'][_0xe921('0x45')]);_0x3c0899['where']=qs[_0xe921('0x3d')](_[_0xe921('0x46')](_0x188f4c[_0xe921('0x3b')],_0x1a76fd[_0xe921('0x3d')]),_0x5c7537);if(_0x188f4c[_0xe921('0x3b')][_0xe921('0x47')]){_0x3c0899['where']=_[_0xe921('0x48')](_0x3c0899[_0xe921('0x49')],{'$or':_[_0xe921('0x34')](_0x5c7537,function(_0x5616a7){if(_0x5616a7[_0xe921('0x38')]!==_0xe921('0x4a')){var _0x5d8ebc={};_0x5d8ebc[_0x5616a7['name']]={'$like':'%'+_0x188f4c[_0xe921('0x3b')][_0xe921('0x47')]+'%'};return _0x5d8ebc;}})});}_0x3c0899=_['merge']({},_0x3c0899,_0x188f4c[_0xe921('0x4b')]);var _0x21713d={'where':_0x3c0899['where']};return db[_0xe921('0x35')][_0xe921('0x26')](_0x21713d)[_0xe921('0x2d')](function(_0x19306d){_0x66b47[_0xe921('0x26')]=_0x19306d;if(_0x188f4c[_0xe921('0x3b')][_0xe921('0x4c')]){_0x3c0899[_0xe921('0x4d')]=[{'all':!![]}];}return db[_0xe921('0x35')][_0xe921('0x4e')](_0x3c0899);})[_0xe921('0x2d')](function(_0x5c0ef1){_0x66b47['rows']=_0x5c0ef1;return _0x66b47;})[_0xe921('0x2d')](respondWithFilteredResult(_0x50819b,_0x3c0899))['catch'](handleError(_0x50819b,null));};exports[_0xe921('0x4f')]=function(_0x557cdf,_0x58abd7){var _0x36a2d7={'raw':![],'where':{'id':_0x557cdf[_0xe921('0x50')]['id']}},_0x37c6e0={};_0x37c6e0[_0xe921('0x3a')]=_[_0xe921('0x3c')](db[_0xe921('0x35')][_0xe921('0x36')]);_0x37c6e0['query']=_[_0xe921('0x3c')](_0x557cdf[_0xe921('0x3b')]);_0x37c6e0[_0xe921('0x3d')]=_[_0xe921('0x51')](_0x37c6e0[_0xe921('0x3a')],_0x37c6e0[_0xe921('0x3b')]);_0x36a2d7[_0xe921('0x3e')]=_['intersection'](_0x37c6e0[_0xe921('0x3a')],qs['fields'](_0x557cdf[_0xe921('0x3b')][_0xe921('0x3f')]));_0x36a2d7[_0xe921('0x3e')]=_0x36a2d7[_0xe921('0x3e')][_0xe921('0x40')]?_0x36a2d7[_0xe921('0x3e')]:_0x37c6e0[_0xe921('0x3a')];if(_0x557cdf[_0xe921('0x3b')][_0xe921('0x4c')]){_0x36a2d7[_0xe921('0x4d')]=[{'all':!![]}];}_0x36a2d7=_[_0xe921('0x48')]({},_0x36a2d7,_0x557cdf['options']);return db[_0xe921('0x35')][_0xe921('0x52')](_0x36a2d7)[_0xe921('0x2d')](handleEntityNotFound(_0x58abd7,null))['then'](respondWithResult(_0x58abd7,null))[_0xe921('0x53')](handleError(_0x58abd7,null));};exports[_0xe921('0x54')]=function(_0x2dc3cf,_0x501868){return db['VoiceQueueReport'][_0xe921('0x54')](_0x2dc3cf['body'],{})[_0xe921('0x2d')](respondWithResult(_0x501868,0xc9))[_0xe921('0x53')](handleError(_0x501868,null));};exports[_0xe921('0x2c')]=function(_0xfe0395,_0x7abf59){if(_0xfe0395[_0xe921('0x55')]['id']){delete _0xfe0395[_0xe921('0x55')]['id'];}return db['VoiceQueueReport'][_0xe921('0x52')]({'where':{'id':_0xfe0395['params']['id']}})['then'](handleEntityNotFound(_0x7abf59,null))['then'](saveUpdates(_0xfe0395['body'],null))[_0xe921('0x2d')](respondWithResult(_0x7abf59,null))[_0xe921('0x53')](handleError(_0x7abf59,null));};exports[_0xe921('0x2e')]=function(_0x13ff1e,_0x37fc74){return db[_0xe921('0x35')][_0xe921('0x52')]({'where':{'id':_0x13ff1e[_0xe921('0x50')]['id']}})['then'](handleEntityNotFound(_0x37fc74,null))[_0xe921('0x2d')](removeEntity(_0x37fc74,null))[_0xe921('0x53')](handleError(_0x37fc74,null));};exports[_0xe921('0x56')]=function(_0x59ba0b,_0x432f5f){return db[_0xe921('0x35')][_0xe921('0x56')]()[_0xe921('0x2d')](respondWithResult(_0x432f5f,null))[_0xe921('0x53')](handleError(_0x432f5f,null));};exports[_0xe921('0x57')]=function(_0x41ba35,_0x3ea140){var _0x494bc2={},_0x314a6b={},_0x524fb0={'count':0x0,'rows':[]};_0x314a6b[_0xe921('0x3a')]=_[_0xe921('0x3c')](db[_0xe921('0x35')]['rawAttributes']);_0x314a6b['query']=_[_0xe921('0x3c')](_0x41ba35[_0xe921('0x3b')]);_0x314a6b['filters']=_[_0xe921('0x51')](_0x314a6b[_0xe921('0x3a')],_0x314a6b['query']);_0x494bc2[_0xe921('0x3e')]=_[_0xe921('0x51')](_0x314a6b[_0xe921('0x3a')],qs['fields'](_0x41ba35[_0xe921('0x3b')][_0xe921('0x3f')]));_0x494bc2[_0xe921('0x3e')]=_0x494bc2[_0xe921('0x3e')][_0xe921('0x40')]?_0x494bc2[_0xe921('0x3e')]:_0x314a6b[_0xe921('0x3a')];if(!_0x41ba35[_0xe921('0x3b')]['hasOwnProperty']('nolimit')){_0x494bc2[_0xe921('0x43')]=qs[_0xe921('0x43')](_0x41ba35['query'][_0xe921('0x43')]);_0x494bc2[_0xe921('0x24')]=qs[_0xe921('0x24')](_0x41ba35[_0xe921('0x3b')][_0xe921('0x24')]);}_0x494bc2[_0xe921('0x44')]=qs[_0xe921('0x45')](_0x41ba35['query'][_0xe921('0x45')]);_0x494bc2['where']=qs['filters'](_['pick'](_0x41ba35[_0xe921('0x3b')],_0x314a6b['filters']));if(_0x41ba35[_0xe921('0x3b')][_0xe921('0x47')]){_0x494bc2[_0xe921('0x49')]=_[_0xe921('0x48')](_0x494bc2['where'],{'$or':_[_0xe921('0x34')](_0x494bc2['attributes'],function(_0x5e069b){var _0x3488e0={};_0x3488e0[_0x5e069b]={'$like':'%'+_0x41ba35[_0xe921('0x3b')]['filter']+'%'};return _0x3488e0;})});}_0x494bc2=_[_0xe921('0x48')]({},_0x494bc2,_0x41ba35['options']);var _0x1e8438={'where':_0x494bc2['where']};return db[_0xe921('0x35')]['count'](_0x1e8438)[_0xe921('0x2d')](function(_0x2c89ca){_0x524fb0[_0xe921('0x26')]=_0x2c89ca;if(_0x41ba35[_0xe921('0x3b')][_0xe921('0x4c')]){_0x494bc2[_0xe921('0x4d')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xe921('0x4e')](_0x494bc2);})[_0xe921('0x2d')](function(_0x4dde83){_0x524fb0[_0xe921('0x58')]=_0x4dde83;return _0x524fb0;})['then'](respondWithFilteredResult(_0x3ea140,_0x494bc2,_0xe921('0x57')))[_0xe921('0x53')](handleError(_0x3ea140,null,_0xe921('0x57')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 158a91c..8948151 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 _0x3239=['VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x3239,0xda));var _0x9323=function(_0x3ba01f,_0x3c000e){_0x3ba01f=_0x3ba01f-0x0;var _0x53f5a5=_0x3239[_0x3ba01f];return _0x53f5a5;};'use strict';var EventEmitter=require(_0x9323('0x0'));var VoiceQueueReport=require(_0x9323('0x1'))['db'][_0x9323('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x9323('0x3')](0x0);var events={'afterCreate':_0x9323('0x4'),'afterUpdate':_0x9323('0x5'),'afterDestroy':_0x9323('0x6')};function emitEvent(_0x5294d5){return function(_0x53b92d,_0x256d21,_0x759214){VoiceQueueReportEvents[_0x9323('0x7')](_0x5294d5+':'+_0x53b92d['id'],_0x53b92d);VoiceQueueReportEvents['emit'](_0x5294d5,_0x53b92d);_0x759214(null);};}for(var e in events){if(events[_0x9323('0x8')](e)){var event=events[e];VoiceQueueReport[_0x9323('0x9')](e,emitEvent(event));}}module[_0x9323('0xa')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xd77f=['../../mysqldb','VoiceQueueReport','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd77f,0x1c2));var _0xfd77=function(_0x15f055,_0x3d3d41){_0x15f055=_0x15f055-0x0;var _0x1523a8=_0xd77f[_0x15f055];return _0x1523a8;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xfd77('0x0'))['db'][_0xfd77('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfd77('0x2'),'afterUpdate':_0xfd77('0x3'),'afterDestroy':_0xfd77('0x4')};function emitEvent(_0x2503e9){return function(_0x525a5b,_0x446b68,_0x4be99c){VoiceQueueReportEvents[_0xfd77('0x5')](_0x2503e9+':'+_0x525a5b['id'],_0x525a5b);VoiceQueueReportEvents[_0xfd77('0x5')](_0x2503e9,_0x525a5b);_0x4be99c(null);};}for(var e in events){if(events[_0xfd77('0x6')](e)){var event=events[e];VoiceQueueReport[_0xfd77('0x7')](e,emitEvent(event));}}module[_0xfd77('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index d46fbdc..e93cff2 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 _0x26b7=['uniqueid','calleridnum','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue'];(function(_0xfd322a,_0x377fb1){var _0x3a79da=function(_0x20ae69){while(--_0x20ae69){_0xfd322a['push'](_0xfd322a['shift']());}};_0x3a79da(++_0x377fb1);}(_0x26b7,0x10c));var _0x726b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x26b7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x726b('0x0'));var util=require('util');var logger=require(_0x726b('0x1'))(_0x726b('0x2'));var moment=require(_0x726b('0x3'));var BPromise=require(_0x726b('0x4'));var rp=require(_0x726b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x726b('0x6'));var attributes=require(_0x726b('0x7'));module[_0x726b('0x8')]=function(_0x4e1de6,_0x266dfe){return _0x4e1de6[_0x726b('0x9')](_0x726b('0xa'),attributes,{'tableName':_0x726b('0xb'),'paranoid':![],'indexes':[{'fields':[_0x726b('0xc')]},{'fields':[_0x726b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x487c=['define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./voiceQueueReport.attributes'];(function(_0x555142,_0x3c15df){var _0x4f6d0b=function(_0x51bfdc){while(--_0x51bfdc){_0x555142['push'](_0x555142['shift']());}};_0x4f6d0b(++_0x3c15df);}(_0x487c,0x19b));var _0xc487=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x487c[_0x1b828b];return _0x98da1a;};'use strict';var _=require(_0xc487('0x0'));var util=require(_0xc487('0x1'));var logger=require(_0xc487('0x2'))(_0xc487('0x3'));var moment=require(_0xc487('0x4'));var BPromise=require('bluebird');var rp=require(_0xc487('0x5'));var fs=require('fs');var path=require(_0xc487('0x6'));var rimraf=require(_0xc487('0x7'));var config=require('../../config/environment');var attributes=require(_0xc487('0x8'));module['exports']=function(_0x14d4e4,_0x2ddf3d){return _0x14d4e4[_0xc487('0x9')](_0xc487('0xa'),attributes,{'tableName':_0xc487('0xb'),'paranoid':![],'indexes':[{'fields':[_0xc487('0xc')]},{'fields':[_0xc487('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 66bc243..c05d15b 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 _0x7e04=['attributes','limit','include','model','map','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','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','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x7e04,0xc1));var _0x47e0=function(_0x548eba,_0x432729){_0x548eba=_0x548eba-0x0;var _0x3fd279=_0x7e04[_0x548eba];return _0x3fd279;};'use strict';var _=require(_0x47e0('0x0'));var util=require(_0x47e0('0x1'));var moment=require(_0x47e0('0x2'));var BPromise=require(_0x47e0('0x3'));var rs=require(_0x47e0('0x4'));var fs=require('fs');var Redis=require(_0x47e0('0x5'));var db=require(_0x47e0('0x6'))['db'];var utils=require(_0x47e0('0x7'));var logger=require(_0x47e0('0x8'))(_0x47e0('0x9'));var config=require(_0x47e0('0xa'));var jayson=require(_0x47e0('0xb'));var client=jayson[_0x47e0('0xc')][_0x47e0('0xd')]({'port':0x232a});config['redis']=_['defaults'](config[_0x47e0('0xe')],{'host':_0x47e0('0xf'),'port':0x18eb});var socket=require(_0x47e0('0x10'))(new Redis(config[_0x47e0('0xe')]));require('./voiceQueueReport.socket')[_0x47e0('0x11')](socket);function respondWithRpcPromise(_0x12047a,_0x3e4a92,_0x560710){return new BPromise(function(_0x490036,_0x27676e){return client[_0x47e0('0x12')](_0x12047a,_0x560710)[_0x47e0('0x13')](function(_0x4a0ca2){logger[_0x47e0('0x14')](_0x47e0('0x15'),_0x3e4a92,_0x47e0('0x16'));logger[_0x47e0('0x17')](_0x47e0('0x18'),_0x3e4a92,'request\x20sent',JSON[_0x47e0('0x19')](_0x4a0ca2));if(_0x4a0ca2['error']){if(_0x4a0ca2[_0x47e0('0x1a')][_0x47e0('0x1b')]===0x1f4){logger[_0x47e0('0x1a')]('VoiceQueueReport,\x20%s,\x20%s',_0x3e4a92,_0x4a0ca2[_0x47e0('0x1a')][_0x47e0('0x1c')]);return _0x27676e(_0x4a0ca2[_0x47e0('0x1a')][_0x47e0('0x1c')]);}logger[_0x47e0('0x1a')](_0x47e0('0x15'),_0x3e4a92,_0x4a0ca2[_0x47e0('0x1a')][_0x47e0('0x1c')]);return _0x490036(_0x4a0ca2[_0x47e0('0x1a')]['message']);}else{logger[_0x47e0('0x14')](_0x47e0('0x15'),_0x3e4a92,_0x47e0('0x16'));_0x490036(_0x4a0ca2[_0x47e0('0x1d')][_0x47e0('0x1c')]);}})[_0x47e0('0x1e')](function(_0x4a3332){logger[_0x47e0('0x1a')](_0x47e0('0x15'),_0x3e4a92,_0x4a3332);_0x27676e(_0x4a3332);});});}exports[_0x47e0('0x1f')]=function(_0x18c8ff){var _0xb325f7=this;return new Promise(function(_0x54f920,_0x31d707){return db[_0x47e0('0x20')][_0x47e0('0x21')]({'raw':_0x18c8ff[_0x47e0('0x22')]?_0x18c8ff['options'][_0x47e0('0x23')]===undefined?!![]:![]:!![],'where':_0x18c8ff[_0x47e0('0x22')]?_0x18c8ff['options'][_0x47e0('0x24')]||null:null,'attributes':_0x18c8ff['options']?_0x18c8ff[_0x47e0('0x22')][_0x47e0('0x25')]||null:null,'limit':_0x18c8ff['options']?_0x18c8ff['options'][_0x47e0('0x26')]||null:null,'include':_0x18c8ff['options']?_0x18c8ff[_0x47e0('0x22')][_0x47e0('0x27')]?_['map'](_0x18c8ff['options']['include'],function(_0x1e8bbc){return{'model':db[_0x1e8bbc[_0x47e0('0x28')]],'as':_0x1e8bbc['as'],'attributes':_0x1e8bbc[_0x47e0('0x25')],'include':_0x1e8bbc['include']?_['map'](_0x1e8bbc[_0x47e0('0x27')],function(_0x139151){return{'model':db[_0x139151['model']],'as':_0x139151['as'],'attributes':_0x139151[_0x47e0('0x25')],'include':_0x139151[_0x47e0('0x27')]?_[_0x47e0('0x29')](_0x139151[_0x47e0('0x27')],function(_0x2e44b0){return{'model':db[_0x2e44b0[_0x47e0('0x28')]],'as':_0x2e44b0['as'],'attributes':_0x2e44b0['attributes']};}):[]};}):[]};}):[]:[]})[_0x47e0('0x13')](function(_0x567eb4){logger[_0x47e0('0x14')](_0x47e0('0x1f'),_0x18c8ff);logger[_0x47e0('0x17')](_0x47e0('0x1f'),_0x18c8ff,JSON[_0x47e0('0x19')](_0x567eb4));_0x54f920(_0x567eb4);})['catch'](function(_0x2fe85c){logger[_0x47e0('0x1a')](_0x47e0('0x1f'),_0x2fe85c[_0x47e0('0x1c')],_0x18c8ff);_0x31d707(_0xb325f7[_0x47e0('0x1a')](0x1f4,_0x2fe85c[_0x47e0('0x1c')]));});});};exports[_0x47e0('0x2a')]=function(_0xa03b29){var _0x2d6fb9=this;return new Promise(function(_0x455d54,_0x1151a0){return db[_0x47e0('0x20')][_0x47e0('0x2b')](_0xa03b29['body'],{'raw':_0xa03b29['options']?_0xa03b29[_0x47e0('0x22')][_0x47e0('0x23')]===undefined?!![]:![]:!![]})[_0x47e0('0x13')](function(_0x307b6a){logger[_0x47e0('0x14')]('CreateVoiceQueueReport',_0xa03b29);logger[_0x47e0('0x17')]('CreateVoiceQueueReport',_0xa03b29,JSON['stringify'](_0x307b6a));_0x455d54(_0x307b6a);})['catch'](function(_0x562c0d){logger[_0x47e0('0x1a')](_0x47e0('0x2a'),_0x562c0d[_0x47e0('0x1c')],_0xa03b29);_0x1151a0(_0x2d6fb9[_0x47e0('0x1a')](0x1f4,_0x562c0d[_0x47e0('0x1c')]));});});};exports['UpdateVoiceQueueReport']=function(_0x1e18b0){var _0x3dfccc=this;return new Promise(function(_0x150cd2,_0x24c50e){return db[_0x47e0('0x20')]['update'](_0x1e18b0[_0x47e0('0x2c')],{'raw':_0x1e18b0[_0x47e0('0x22')]?_0x1e18b0[_0x47e0('0x22')][_0x47e0('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e18b0['options']?_0x1e18b0[_0x47e0('0x22')]['where']||null:null,'attributes':_0x1e18b0[_0x47e0('0x22')]?_0x1e18b0[_0x47e0('0x22')][_0x47e0('0x25')]||null:null,'limit':_0x1e18b0[_0x47e0('0x22')]?_0x1e18b0['options']['limit']||null:null})[_0x47e0('0x13')](function(_0x4c08d0){logger[_0x47e0('0x14')](_0x47e0('0x2d'),_0x1e18b0);logger[_0x47e0('0x17')](_0x47e0('0x2d'),_0x1e18b0,JSON[_0x47e0('0x19')](_0x4c08d0));_0x150cd2(_0x4c08d0);})[_0x47e0('0x1e')](function(_0x1823d3){logger[_0x47e0('0x1a')](_0x47e0('0x2d'),_0x1823d3[_0x47e0('0x1c')],_0x1e18b0);_0x24c50e(_0x3dfccc[_0x47e0('0x1a')](0x1f4,_0x1823d3[_0x47e0('0x1c')]));});});}; \ No newline at end of file +var _0x6eb9=['http','redis','defaults','./voiceQueueReport.socket','register','request','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','GetVoiceQueueReport','options','where','attributes','limit','include','map','model','stringify','CreateVoiceQueueReport','VoiceQueueReport','create','body','raw','debug','update','UpdateVoiceQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x48429d,_0x4d334d){var _0x1f7c03=function(_0x38762a){while(--_0x38762a){_0x48429d['push'](_0x48429d['shift']());}};_0x1f7c03(++_0x4d334d);}(_0x6eb9,0x145));var _0x96eb=function(_0x46e5fc,_0x5db9aa){_0x46e5fc=_0x46e5fc-0x0;var _0x52f4e6=_0x6eb9[_0x46e5fc];return _0x52f4e6;};'use strict';var _=require(_0x96eb('0x0'));var util=require(_0x96eb('0x1'));var moment=require(_0x96eb('0x2'));var BPromise=require(_0x96eb('0x3'));var rs=require(_0x96eb('0x4'));var fs=require('fs');var Redis=require(_0x96eb('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x96eb('0x6'));var logger=require(_0x96eb('0x7'))(_0x96eb('0x8'));var config=require('../../config/environment');var jayson=require(_0x96eb('0x9'));var client=jayson[_0x96eb('0xa')][_0x96eb('0xb')]({'port':0x232a});config[_0x96eb('0xc')]=_[_0x96eb('0xd')](config[_0x96eb('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x96eb('0xc')]));require(_0x96eb('0xe'))[_0x96eb('0xf')](socket);function respondWithRpcPromise(_0x517522,_0x2d26e4,_0x4c38b6){return new BPromise(function(_0x54f7e2,_0x483b89){return client[_0x96eb('0x10')](_0x517522,_0x4c38b6)[_0x96eb('0x11')](function(_0x5675e1){logger['info'](_0x96eb('0x12'),_0x2d26e4,'request\x20sent');logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x2d26e4,_0x96eb('0x13'),JSON['stringify'](_0x5675e1));if(_0x5675e1[_0x96eb('0x14')]){if(_0x5675e1['error']['code']===0x1f4){logger[_0x96eb('0x14')](_0x96eb('0x12'),_0x2d26e4,_0x5675e1[_0x96eb('0x14')][_0x96eb('0x15')]);return _0x483b89(_0x5675e1[_0x96eb('0x14')]['message']);}logger[_0x96eb('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x2d26e4,_0x5675e1[_0x96eb('0x14')][_0x96eb('0x15')]);return _0x54f7e2(_0x5675e1[_0x96eb('0x14')][_0x96eb('0x15')]);}else{logger[_0x96eb('0x16')](_0x96eb('0x12'),_0x2d26e4,_0x96eb('0x13'));_0x54f7e2(_0x5675e1[_0x96eb('0x17')][_0x96eb('0x15')]);}})[_0x96eb('0x18')](function(_0x166dc9){logger[_0x96eb('0x14')](_0x96eb('0x12'),_0x2d26e4,_0x166dc9);_0x483b89(_0x166dc9);});});}exports[_0x96eb('0x19')]=function(_0xd4e0a2){var _0x526ddf=this;return new Promise(function(_0x1ccf10,_0x4f6d56){return db['VoiceQueueReport']['findAll']({'raw':_0xd4e0a2[_0x96eb('0x1a')]?_0xd4e0a2[_0x96eb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xd4e0a2[_0x96eb('0x1a')]?_0xd4e0a2[_0x96eb('0x1a')][_0x96eb('0x1b')]||null:null,'attributes':_0xd4e0a2[_0x96eb('0x1a')]?_0xd4e0a2[_0x96eb('0x1a')][_0x96eb('0x1c')]||null:null,'limit':_0xd4e0a2[_0x96eb('0x1a')]?_0xd4e0a2[_0x96eb('0x1a')][_0x96eb('0x1d')]||null:null,'include':_0xd4e0a2['options']?_0xd4e0a2[_0x96eb('0x1a')][_0x96eb('0x1e')]?_[_0x96eb('0x1f')](_0xd4e0a2[_0x96eb('0x1a')][_0x96eb('0x1e')],function(_0x46916f){return{'model':db[_0x46916f[_0x96eb('0x20')]],'as':_0x46916f['as'],'attributes':_0x46916f['attributes'],'include':_0x46916f[_0x96eb('0x1e')]?_[_0x96eb('0x1f')](_0x46916f['include'],function(_0xabbf4f){return{'model':db[_0xabbf4f['model']],'as':_0xabbf4f['as'],'attributes':_0xabbf4f[_0x96eb('0x1c')],'include':_0xabbf4f[_0x96eb('0x1e')]?_['map'](_0xabbf4f['include'],function(_0x5cfc84){return{'model':db[_0x5cfc84[_0x96eb('0x20')]],'as':_0x5cfc84['as'],'attributes':_0x5cfc84['attributes']};}):[]};}):[]};}):[]:[]})[_0x96eb('0x11')](function(_0xebb162){logger['info']('GetVoiceQueueReport',_0xd4e0a2);logger['debug'](_0x96eb('0x19'),_0xd4e0a2,JSON[_0x96eb('0x21')](_0xebb162));_0x1ccf10(_0xebb162);})[_0x96eb('0x18')](function(_0x563b67){logger['error'](_0x96eb('0x19'),_0x563b67[_0x96eb('0x15')],_0xd4e0a2);_0x4f6d56(_0x526ddf['error'](0x1f4,_0x563b67['message']));});});};exports[_0x96eb('0x22')]=function(_0x5f18e2){var _0x5c431f=this;return new Promise(function(_0x5856e3,_0x110b57){return db[_0x96eb('0x23')][_0x96eb('0x24')](_0x5f18e2[_0x96eb('0x25')],{'raw':_0x5f18e2[_0x96eb('0x1a')]?_0x5f18e2[_0x96eb('0x1a')][_0x96eb('0x26')]===undefined?!![]:![]:!![]})[_0x96eb('0x11')](function(_0x53028d){logger['info'](_0x96eb('0x22'),_0x5f18e2);logger[_0x96eb('0x27')](_0x96eb('0x22'),_0x5f18e2,JSON['stringify'](_0x53028d));_0x5856e3(_0x53028d);})['catch'](function(_0x5a10d2){logger[_0x96eb('0x14')](_0x96eb('0x22'),_0x5a10d2['message'],_0x5f18e2);_0x110b57(_0x5c431f[_0x96eb('0x14')](0x1f4,_0x5a10d2[_0x96eb('0x15')]));});});};exports['UpdateVoiceQueueReport']=function(_0x425070){var _0x295a0b=this;return new Promise(function(_0x5f4ed2,_0x1199a0){return db[_0x96eb('0x23')][_0x96eb('0x28')](_0x425070[_0x96eb('0x25')],{'raw':_0x425070[_0x96eb('0x1a')]?_0x425070[_0x96eb('0x1a')][_0x96eb('0x26')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x425070['options']?_0x425070['options'][_0x96eb('0x1b')]||null:null,'attributes':_0x425070[_0x96eb('0x1a')]?_0x425070['options'][_0x96eb('0x1c')]||null:null,'limit':_0x425070[_0x96eb('0x1a')]?_0x425070[_0x96eb('0x1a')][_0x96eb('0x1d')]||null:null})[_0x96eb('0x11')](function(_0x5d0ace){logger[_0x96eb('0x16')](_0x96eb('0x29'),_0x425070);logger[_0x96eb('0x27')](_0x96eb('0x29'),_0x425070,JSON[_0x96eb('0x21')](_0x5d0ace));_0x5f4ed2(_0x5d0ace);})[_0x96eb('0x18')](function(_0x3d0242){logger[_0x96eb('0x14')](_0x96eb('0x29'),_0x3d0242[_0x96eb('0x15')],_0x425070);_0x1199a0(_0x295a0b[_0x96eb('0x14')](0x1f4,_0x3d0242[_0x96eb('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index ef73902..5255606 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 _0x379e=['./voiceQueueReport.events','emit','removeListener','length','voiceQueueReport:'];(function(_0x438c0e,_0x275ab1){var _0x21c813=function(_0x1756ba){while(--_0x1756ba){_0x438c0e['push'](_0x438c0e['shift']());}};_0x21c813(++_0x275ab1);}(_0x379e,0x104));var _0xe379=function(_0x181fe5,_0x1b3565){_0x181fe5=_0x181fe5-0x0;var _0x1c975f=_0x379e[_0x181fe5];return _0x1c975f;};'use strict';var VoiceQueueReportEvents=require(_0xe379('0x0'));var events=['save','remove','update'];function createListener(_0x594cd4,_0xccbef2){return function(_0x1e24f9){_0xccbef2[_0xe379('0x1')](_0x594cd4,_0x1e24f9);};}function removeListener(_0x3db31a,_0x475418){return function(){VoiceQueueReportEvents[_0xe379('0x2')](_0x3db31a,_0x475418);};}exports['register']=function(_0x1f6c46){for(var _0x24221c=0x0,_0x166621=events[_0xe379('0x3')];_0x24221c<_0x166621;_0x24221c++){var _0x22cb37=events[_0x24221c];var _0x5475e7=createListener(_0xe379('0x4')+_0x22cb37,_0x1f6c46);VoiceQueueReportEvents['on'](_0x22cb37,_0x5475e7);}}; \ No newline at end of file +var _0x25b4=['./voiceQueueReport.events','remove','update','emit','removeListener','length','voiceQueueReport:'];(function(_0x42fc46,_0x54879a){var _0x25617c=function(_0x5dd602){while(--_0x5dd602){_0x42fc46['push'](_0x42fc46['shift']());}};_0x25617c(++_0x54879a);}(_0x25b4,0x1ab));var _0x425b=function(_0x393d69,_0x3a8c83){_0x393d69=_0x393d69-0x0;var _0x3cee37=_0x25b4[_0x393d69];return _0x3cee37;};'use strict';var VoiceQueueReportEvents=require(_0x425b('0x0'));var events=['save',_0x425b('0x1'),_0x425b('0x2')];function createListener(_0x23e1a1,_0x3d56e5){return function(_0x5d3f43){_0x3d56e5[_0x425b('0x3')](_0x23e1a1,_0x5d3f43);};}function removeListener(_0x448a81,_0xcf7b62){return function(){VoiceQueueReportEvents[_0x425b('0x4')](_0x448a81,_0xcf7b62);};}exports['register']=function(_0x27e02e){for(var _0x1e22e4=0x0,_0x306290=events[_0x425b('0x5')];_0x1e22e4<_0x306290;_0x1e22e4++){var _0x4509c2=events[_0x1e22e4];var _0x55c12b=createListener(_0x425b('0x6')+_0x4509c2,_0x27e02e);VoiceQueueReportEvents['on'](_0x4509c2,_0x55c12b);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 58a7db6..904a62a 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 _0x2cca=['./voiceQueuesLog.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x2500b9,_0x38d7b2){var _0x38ffb9=function(_0x544b42){while(--_0x544b42){_0x2500b9['push'](_0x2500b9['shift']());}};_0x38ffb9(++_0x38d7b2);}(_0x2cca,0xa4));var _0xa2cc=function(_0x2de263,_0x5970a7){_0x2de263=_0x2de263-0x0;var _0x5a7a8b=_0x2cca[_0x2de263];return _0x5a7a8b;};'use strict';var multer=require(_0xa2cc('0x0'));var util=require('util');var path=require(_0xa2cc('0x1'));var timeout=require(_0xa2cc('0x2'));var express=require(_0xa2cc('0x3'));var router=express[_0xa2cc('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa2cc('0x5'));var config=require(_0xa2cc('0x6'));var controller=require(_0xa2cc('0x7'));router[_0xa2cc('0x8')]('/',auth[_0xa2cc('0x9')](),controller[_0xa2cc('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa2cc('0xb')]);router[_0xa2cc('0xc')]('/',auth[_0xa2cc('0x9')](),controller[_0xa2cc('0xd')]);router[_0xa2cc('0xe')](_0xa2cc('0xf'),auth[_0xa2cc('0x9')](),controller[_0xa2cc('0x10')]);router[_0xa2cc('0x11')](_0xa2cc('0xf'),auth['isAuthenticated'](),controller[_0xa2cc('0x12')]);module['exports']=router; \ No newline at end of file +var _0x0ec2=['index','/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated'];(function(_0x4cdfd7,_0x4487f3){var _0x345c0c=function(_0x92022){while(--_0x92022){_0x4cdfd7['push'](_0x4cdfd7['shift']());}};_0x345c0c(++_0x4487f3);}(_0x0ec2,0x72));var _0x20ec=function(_0xfc406a,_0x4479e1){_0xfc406a=_0xfc406a-0x0;var _0x395473=_0x0ec2[_0xfc406a];return _0x395473;};'use strict';var multer=require(_0x20ec('0x0'));var util=require('util');var path=require(_0x20ec('0x1'));var timeout=require(_0x20ec('0x2'));var express=require(_0x20ec('0x3'));var router=express[_0x20ec('0x4')]();var fs_extra=require(_0x20ec('0x5'));var auth=require(_0x20ec('0x6'));var interaction=require(_0x20ec('0x7'));var config=require(_0x20ec('0x8'));var controller=require(_0x20ec('0x9'));router[_0x20ec('0xa')]('/',auth[_0x20ec('0xb')](),controller[_0x20ec('0xc')]);router[_0x20ec('0xa')](_0x20ec('0xd'),auth[_0x20ec('0xb')](),controller['show']);router[_0x20ec('0xe')]('/',auth['isAuthenticated'](),controller[_0x20ec('0xf')]);router[_0x20ec('0x10')](_0x20ec('0xd'),auth[_0x20ec('0xb')](),controller[_0x20ec('0x11')]);router[_0x20ec('0x12')](_0x20ec('0xd'),auth[_0x20ec('0xb')](),controller[_0x20ec('0x13')]);module[_0x20ec('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index b94a071..d054508 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 _0xd20e=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','STRING'];(function(_0x23df64,_0x2ac15b){var _0xa0ccdb=function(_0x40f1b3){while(--_0x40f1b3){_0x23df64['push'](_0x23df64['shift']());}};_0xa0ccdb(++_0x2ac15b);}(_0xd20e,0x198));var _0xed20=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xd20e[_0x82129b];return _0x2ae5dc;};'use strict';var Sequelize=require(_0xed20('0x0'));var moment=require('moment');module['exports']={'time':{'type':Sequelize[_0xed20('0x1')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xed20('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xed20('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xed20('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xed20('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xed20('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xed20('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xed20('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xed20('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xed20('0x2')],'allowNull':![],'defaultValue':moment()[_0xed20('0x3')](_0xed20('0x4'))}}; \ No newline at end of file +var _0x9583=['moment','exports','STRING','DATE','format','sequelize'];(function(_0x19ddd7,_0x4adc14){var _0x1326d1=function(_0x581913){while(--_0x581913){_0x19ddd7['push'](_0x19ddd7['shift']());}};_0x1326d1(++_0x4adc14);}(_0x9583,0xcb));var _0x3958=function(_0x8809b4,_0x3bdc8a){_0x8809b4=_0x8809b4-0x0;var _0xc33cb7=_0x9583[_0x8809b4];return _0xc33cb7;};'use strict';var Sequelize=require(_0x3958('0x0'));var moment=require(_0x3958('0x1'));module[_0x3958('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x3958('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x3958('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x3958('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x3958('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x3958('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x3958('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x3958('0x4')],'allowNull':![],'defaultValue':moment()[_0x3958('0x5')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 2aa5621..b118188 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 _0x1e64=['query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','options','find','create','body','update','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','then','error','name','index','VoiceQueuesLog','rawAttributes','type','map'];(function(_0x4a08ec,_0x637688){var _0x3136e3=function(_0xbcfd82){while(--_0xbcfd82){_0x4a08ec['push'](_0x4a08ec['shift']());}};_0x3136e3(++_0x637688);}(_0x1e64,0x1ad));var _0x41e6=function(_0x27d801,_0x1839ce){_0x27d801=_0x27d801-0x0;var _0x5403ec=_0x1e64[_0x27d801];return _0x5403ec;};'use strict';var emlformat=require(_0x41e6('0x0'));var rimraf=require(_0x41e6('0x1'));var zipdir=require(_0x41e6('0x2'));var jsonpatch=require(_0x41e6('0x3'));var rp=require(_0x41e6('0x4'));var moment=require(_0x41e6('0x5'));var BPromise=require(_0x41e6('0x6'));var Mustache=require(_0x41e6('0x7'));var util=require(_0x41e6('0x8'));var path=require(_0x41e6('0x9'));var sox=require(_0x41e6('0xa'));var csv=require(_0x41e6('0xb'));var ejs=require(_0x41e6('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x41e6('0xd'));var squel=require('squel');var crypto=require(_0x41e6('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x41e6('0xf'));var Papa=require(_0x41e6('0x10'));var Redis=require('ioredis');var authService=require(_0x41e6('0x11'));var qs=require(_0x41e6('0x12'));var as=require(_0x41e6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x41e6('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x41e6('0x15'))['db'];function respondWithStatusCode(_0x60808,_0x1aae21){_0x1aae21=_0x1aae21||0xcc;return function(_0x21a633){if(_0x21a633){return _0x60808[_0x41e6('0x16')](_0x1aae21);}return _0x60808[_0x41e6('0x17')](_0x1aae21)[_0x41e6('0x18')]();};}function respondWithResult(_0x283586,_0x59f84d){_0x59f84d=_0x59f84d||0xc8;return function(_0x6dfa4d){if(_0x6dfa4d){return _0x283586['status'](_0x59f84d)[_0x41e6('0x19')](_0x6dfa4d);}};}function respondWithFilteredResult(_0x312d91,_0x48c9d9){return function(_0x4d233d){if(_0x4d233d){var _0x4ae733=typeof _0x48c9d9[_0x41e6('0x1a')]===_0x41e6('0x1b')&&typeof _0x48c9d9[_0x41e6('0x1c')]==='undefined';var _0x440595=_0x4d233d[_0x41e6('0x1d')];var _0x5e24a8=_0x4ae733?0x0:_0x48c9d9[_0x41e6('0x1a')];var _0x45861b=_0x4ae733?_0x4d233d[_0x41e6('0x1d')]:_0x48c9d9[_0x41e6('0x1a')]+_0x48c9d9[_0x41e6('0x1c')];var _0x374d0a;if(_0x45861b>=_0x440595){_0x45861b=_0x440595;_0x374d0a=0xc8;}else{_0x374d0a=0xce;}_0x312d91[_0x41e6('0x17')](_0x374d0a);return _0x312d91['set'](_0x41e6('0x1e'),_0x5e24a8+'-'+_0x45861b+'/'+_0x440595)[_0x41e6('0x19')](_0x4d233d);}return null;};}function patchUpdates(_0x2988fa){return function(_0x474e3f){try{jsonpatch['apply'](_0x474e3f,_0x2988fa,!![]);}catch(_0x3017f3){return BPromise[_0x41e6('0x1f')](_0x3017f3);}return _0x474e3f['save']();};}function saveUpdates(_0x2357c4,_0x4137bd){return function(_0x409d5a){if(_0x409d5a){return _0x409d5a['update'](_0x2357c4)[_0x41e6('0x20')](function(_0x1525c4){return _0x1525c4;});}return null;};}function removeEntity(_0x56fbbe,_0x571e24){return function(_0x44f7b9){if(_0x44f7b9){return _0x44f7b9['destroy']()[_0x41e6('0x20')](function(){_0x56fbbe[_0x41e6('0x17')](0xcc)[_0x41e6('0x18')]();});}};}function handleEntityNotFound(_0x3b931e,_0x1f3e3f){return function(_0x4d919f){if(!_0x4d919f){_0x3b931e[_0x41e6('0x16')](0x194);}return _0x4d919f;};}function handleError(_0x2d0bfb,_0x2592a5){_0x2592a5=_0x2592a5||0x1f4;return function(_0x458081){logger[_0x41e6('0x21')](_0x458081['stack']);if(_0x458081['name']){delete _0x458081[_0x41e6('0x22')];}_0x2d0bfb[_0x41e6('0x17')](_0x2592a5)['send'](_0x458081);};}exports[_0x41e6('0x23')]=function(_0x4812f8,_0x1b7c6a){var _0x7955c0={},_0x4d1a79={},_0x83ebf={'count':0x0,'rows':[]};var _0x35b112=_['map'](db[_0x41e6('0x24')][_0x41e6('0x25')],function(_0x12eea5){return{'name':_0x12eea5['fieldName'],'type':_0x12eea5[_0x41e6('0x26')]['key']};});_0x4d1a79['model']=_[_0x41e6('0x27')](_0x35b112,'name');_0x4d1a79[_0x41e6('0x28')]=_[_0x41e6('0x29')](_0x4812f8['query']);_0x4d1a79[_0x41e6('0x2a')]=_['intersection'](_0x4d1a79[_0x41e6('0x2b')],_0x4d1a79[_0x41e6('0x28')]);_0x7955c0[_0x41e6('0x2c')]=_[_0x41e6('0x2d')](_0x4d1a79['model'],qs['fields'](_0x4812f8['query'][_0x41e6('0x2e')]));_0x7955c0[_0x41e6('0x2c')]=_0x7955c0[_0x41e6('0x2c')][_0x41e6('0x2f')]?_0x7955c0[_0x41e6('0x2c')]:_0x4d1a79[_0x41e6('0x2b')];if(!_0x4812f8[_0x41e6('0x28')]['hasOwnProperty'](_0x41e6('0x30'))){_0x7955c0[_0x41e6('0x1c')]=qs['limit'](_0x4812f8[_0x41e6('0x28')]['limit']);_0x7955c0['offset']=qs[_0x41e6('0x1a')](_0x4812f8['query']['offset']);}_0x7955c0[_0x41e6('0x31')]=qs[_0x41e6('0x32')](_0x4812f8['query'][_0x41e6('0x32')]);_0x7955c0[_0x41e6('0x33')]=qs[_0x41e6('0x2a')](_[_0x41e6('0x34')](_0x4812f8[_0x41e6('0x28')],_0x4d1a79[_0x41e6('0x2a')]),_0x35b112);if(_0x4812f8[_0x41e6('0x28')]['filter']){_0x7955c0[_0x41e6('0x33')]=_[_0x41e6('0x35')](_0x7955c0[_0x41e6('0x33')],{'$or':_[_0x41e6('0x27')](_0x35b112,function(_0x69dec3){if(_0x69dec3[_0x41e6('0x26')]!==_0x41e6('0x36')){var _0x145990={};_0x145990[_0x69dec3['name']]={'$like':'%'+_0x4812f8[_0x41e6('0x28')][_0x41e6('0x37')]+'%'};return _0x145990;}})});}_0x7955c0=_[_0x41e6('0x35')]({},_0x7955c0,_0x4812f8['options']);var _0x114d72={'where':_0x7955c0[_0x41e6('0x33')]};return db[_0x41e6('0x24')][_0x41e6('0x1d')](_0x114d72)['then'](function(_0x1c6707){_0x83ebf[_0x41e6('0x1d')]=_0x1c6707;if(_0x4812f8[_0x41e6('0x28')]['includeAll']){_0x7955c0[_0x41e6('0x38')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x41e6('0x39')](_0x7955c0);})[_0x41e6('0x20')](function(_0x4a9e73){_0x83ebf[_0x41e6('0x3a')]=_0x4a9e73;return _0x83ebf;})[_0x41e6('0x20')](respondWithFilteredResult(_0x1b7c6a,_0x7955c0))[_0x41e6('0x3b')](handleError(_0x1b7c6a,null));};exports['show']=function(_0x50c880,_0x172cd5){var _0x5e8272={'raw':!![],'where':{'id':_0x50c880['params']['id']}},_0x2e9a1b={};_0x2e9a1b['model']=_[_0x41e6('0x29')](db['VoiceQueuesLog'][_0x41e6('0x25')]);_0x2e9a1b['query']=_[_0x41e6('0x29')](_0x50c880[_0x41e6('0x28')]);_0x2e9a1b[_0x41e6('0x2a')]=_[_0x41e6('0x2d')](_0x2e9a1b[_0x41e6('0x2b')],_0x2e9a1b[_0x41e6('0x28')]);_0x5e8272[_0x41e6('0x2c')]=_[_0x41e6('0x2d')](_0x2e9a1b[_0x41e6('0x2b')],qs[_0x41e6('0x2e')](_0x50c880['query'][_0x41e6('0x2e')]));_0x5e8272[_0x41e6('0x2c')]=_0x5e8272[_0x41e6('0x2c')]['length']?_0x5e8272[_0x41e6('0x2c')]:_0x2e9a1b[_0x41e6('0x2b')];if(_0x50c880[_0x41e6('0x28')]['includeAll']){_0x5e8272[_0x41e6('0x38')]=[{'all':!![]}];}_0x5e8272=_['merge']({},_0x5e8272,_0x50c880[_0x41e6('0x3c')]);return db[_0x41e6('0x24')][_0x41e6('0x3d')](_0x5e8272)[_0x41e6('0x20')](handleEntityNotFound(_0x172cd5,null))[_0x41e6('0x20')](respondWithResult(_0x172cd5,null))[_0x41e6('0x3b')](handleError(_0x172cd5,null));};exports[_0x41e6('0x3e')]=function(_0x28e2d9,_0x34d8b4){return db[_0x41e6('0x24')][_0x41e6('0x3e')](_0x28e2d9[_0x41e6('0x3f')],{})[_0x41e6('0x20')](respondWithResult(_0x34d8b4,0xc9))[_0x41e6('0x3b')](handleError(_0x34d8b4,null));};exports[_0x41e6('0x40')]=function(_0x277252,_0x2bf2b8){if(_0x277252[_0x41e6('0x3f')]['id']){delete _0x277252['body']['id'];}return db[_0x41e6('0x24')]['find']({'where':{'id':_0x277252[_0x41e6('0x41')]['id']}})[_0x41e6('0x20')](handleEntityNotFound(_0x2bf2b8,null))[_0x41e6('0x20')](saveUpdates(_0x277252[_0x41e6('0x3f')],null))[_0x41e6('0x20')](respondWithResult(_0x2bf2b8,null))[_0x41e6('0x3b')](handleError(_0x2bf2b8,null));};exports[_0x41e6('0x42')]=function(_0x173309,_0x180113){return db['VoiceQueuesLog']['find']({'where':{'id':_0x173309[_0x41e6('0x41')]['id']}})[_0x41e6('0x20')](handleEntityNotFound(_0x180113,null))[_0x41e6('0x20')](removeEntity(_0x180113,null))[_0x41e6('0x3b')](handleError(_0x180113,null));}; \ No newline at end of file +var _0xf213=['options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../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','update','then','destroy','error','name','VoiceQueuesLog','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter'];(function(_0x40f467,_0x544d10){var _0x749420=function(_0x53a842){while(--_0x53a842){_0x40f467['push'](_0x40f467['shift']());}};_0x749420(++_0x544d10);}(_0xf213,0x17f));var _0x3f21=function(_0x5d2a0b,_0x1386a3){_0x5d2a0b=_0x5d2a0b-0x0;var _0x2bb4a4=_0xf213[_0x5d2a0b];return _0x2bb4a4;};'use strict';var emlformat=require(_0x3f21('0x0'));var rimraf=require(_0x3f21('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3f21('0x2'));var rp=require(_0x3f21('0x3'));var moment=require(_0x3f21('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3f21('0x5'));var util=require(_0x3f21('0x6'));var path=require(_0x3f21('0x7'));var sox=require(_0x3f21('0x8'));var csv=require(_0x3f21('0x9'));var ejs=require(_0x3f21('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3f21('0xb'));var squel=require(_0x3f21('0xc'));var crypto=require(_0x3f21('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3f21('0xe'));var toCsv=require(_0x3f21('0x9'));var querystring=require(_0x3f21('0xf'));var Papa=require(_0x3f21('0x10'));var Redis=require(_0x3f21('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3f21('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f21('0x13'));var logger=require(_0x3f21('0x14'))(_0x3f21('0x15'));var utils=require(_0x3f21('0x16'));var config=require(_0x3f21('0x17'));var licenseUtil=require(_0x3f21('0x18'));var db=require(_0x3f21('0x19'))['db'];function respondWithStatusCode(_0x3a02a0,_0xa4b7eb){_0xa4b7eb=_0xa4b7eb||0xcc;return function(_0x2554e3){if(_0x2554e3){return _0x3a02a0[_0x3f21('0x1a')](_0xa4b7eb);}return _0x3a02a0[_0x3f21('0x1b')](_0xa4b7eb)[_0x3f21('0x1c')]();};}function respondWithResult(_0x421add,_0x5b61a5){_0x5b61a5=_0x5b61a5||0xc8;return function(_0x38e3c6){if(_0x38e3c6){return _0x421add['status'](_0x5b61a5)[_0x3f21('0x1d')](_0x38e3c6);}};}function respondWithFilteredResult(_0x244ebf,_0x4ff946){return function(_0x36e966){if(_0x36e966){var _0x34ca69=typeof _0x4ff946[_0x3f21('0x1e')]===_0x3f21('0x1f')&&typeof _0x4ff946[_0x3f21('0x20')]===_0x3f21('0x1f');var _0x564ee5=_0x36e966[_0x3f21('0x21')];var _0x1b58e4=_0x34ca69?0x0:_0x4ff946['offset'];var _0x5ba352=_0x34ca69?_0x36e966['count']:_0x4ff946[_0x3f21('0x1e')]+_0x4ff946[_0x3f21('0x20')];var _0x164574;if(_0x5ba352>=_0x564ee5){_0x5ba352=_0x564ee5;_0x164574=0xc8;}else{_0x164574=0xce;}_0x244ebf[_0x3f21('0x1b')](_0x164574);return _0x244ebf[_0x3f21('0x22')]('Content-Range',_0x1b58e4+'-'+_0x5ba352+'/'+_0x564ee5)[_0x3f21('0x1d')](_0x36e966);}return null;};}function patchUpdates(_0x4803f2){return function(_0x6d12c3){try{jsonpatch[_0x3f21('0x23')](_0x6d12c3,_0x4803f2,!![]);}catch(_0x101dc3){return BPromise['reject'](_0x101dc3);}return _0x6d12c3['save']();};}function saveUpdates(_0x393029,_0x284055){return function(_0x227a52){if(_0x227a52){return _0x227a52[_0x3f21('0x24')](_0x393029)[_0x3f21('0x25')](function(_0x192bfb){return _0x192bfb;});}return null;};}function removeEntity(_0x53fbf8,_0xf01ffb){return function(_0x3ad4ba){if(_0x3ad4ba){return _0x3ad4ba[_0x3f21('0x26')]()[_0x3f21('0x25')](function(){_0x53fbf8[_0x3f21('0x1b')](0xcc)[_0x3f21('0x1c')]();});}};}function handleEntityNotFound(_0x1ed675,_0x269960){return function(_0x51f9e7){if(!_0x51f9e7){_0x1ed675['sendStatus'](0x194);}return _0x51f9e7;};}function handleError(_0x582f09,_0x26c6d6){_0x26c6d6=_0x26c6d6||0x1f4;return function(_0xfb571c){logger[_0x3f21('0x27')](_0xfb571c['stack']);if(_0xfb571c[_0x3f21('0x28')]){delete _0xfb571c[_0x3f21('0x28')];}_0x582f09['status'](_0x26c6d6)['send'](_0xfb571c);};}exports['index']=function(_0x55c67e,_0x34dff2){var _0x3696ca={},_0xf617c0={},_0x21d1c6={'count':0x0,'rows':[]};var _0x4d318d=_['map'](db[_0x3f21('0x29')]['rawAttributes'],function(_0x554865){return{'name':_0x554865['fieldName'],'type':_0x554865[_0x3f21('0x2a')][_0x3f21('0x2b')]};});_0xf617c0['model']=_[_0x3f21('0x2c')](_0x4d318d,_0x3f21('0x28'));_0xf617c0[_0x3f21('0x2d')]=_['keys'](_0x55c67e[_0x3f21('0x2d')]);_0xf617c0[_0x3f21('0x2e')]=_[_0x3f21('0x2f')](_0xf617c0[_0x3f21('0x30')],_0xf617c0[_0x3f21('0x2d')]);_0x3696ca[_0x3f21('0x31')]=_[_0x3f21('0x2f')](_0xf617c0[_0x3f21('0x30')],qs[_0x3f21('0x32')](_0x55c67e[_0x3f21('0x2d')]['fields']));_0x3696ca[_0x3f21('0x31')]=_0x3696ca[_0x3f21('0x31')][_0x3f21('0x33')]?_0x3696ca['attributes']:_0xf617c0[_0x3f21('0x30')];if(!_0x55c67e[_0x3f21('0x2d')][_0x3f21('0x34')](_0x3f21('0x35'))){_0x3696ca['limit']=qs[_0x3f21('0x20')](_0x55c67e[_0x3f21('0x2d')][_0x3f21('0x20')]);_0x3696ca['offset']=qs[_0x3f21('0x1e')](_0x55c67e[_0x3f21('0x2d')]['offset']);}_0x3696ca[_0x3f21('0x36')]=qs[_0x3f21('0x37')](_0x55c67e[_0x3f21('0x2d')][_0x3f21('0x37')]);_0x3696ca['where']=qs[_0x3f21('0x2e')](_[_0x3f21('0x38')](_0x55c67e[_0x3f21('0x2d')],_0xf617c0[_0x3f21('0x2e')]),_0x4d318d);if(_0x55c67e[_0x3f21('0x2d')]['filter']){_0x3696ca[_0x3f21('0x39')]=_[_0x3f21('0x3a')](_0x3696ca[_0x3f21('0x39')],{'$or':_['map'](_0x4d318d,function(_0x10b321){if(_0x10b321[_0x3f21('0x2a')]!==_0x3f21('0x3b')){var _0x561608={};_0x561608[_0x10b321[_0x3f21('0x28')]]={'$like':'%'+_0x55c67e['query'][_0x3f21('0x3c')]+'%'};return _0x561608;}})});}_0x3696ca=_['merge']({},_0x3696ca,_0x55c67e[_0x3f21('0x3d')]);var _0x14b30c={'where':_0x3696ca[_0x3f21('0x39')]};return db[_0x3f21('0x29')][_0x3f21('0x21')](_0x14b30c)[_0x3f21('0x25')](function(_0x257544){_0x21d1c6[_0x3f21('0x21')]=_0x257544;if(_0x55c67e[_0x3f21('0x2d')][_0x3f21('0x3e')]){_0x3696ca['include']=[{'all':!![]}];}return db[_0x3f21('0x29')][_0x3f21('0x3f')](_0x3696ca);})[_0x3f21('0x25')](function(_0x53f925){_0x21d1c6[_0x3f21('0x40')]=_0x53f925;return _0x21d1c6;})[_0x3f21('0x25')](respondWithFilteredResult(_0x34dff2,_0x3696ca))[_0x3f21('0x41')](handleError(_0x34dff2,null));};exports[_0x3f21('0x42')]=function(_0x3d64df,_0x45ead9){var _0x16fe7b={'raw':!![],'where':{'id':_0x3d64df[_0x3f21('0x43')]['id']}},_0x70ed13={};_0x70ed13[_0x3f21('0x30')]=_[_0x3f21('0x44')](db[_0x3f21('0x29')][_0x3f21('0x45')]);_0x70ed13['query']=_[_0x3f21('0x44')](_0x3d64df[_0x3f21('0x2d')]);_0x70ed13[_0x3f21('0x2e')]=_[_0x3f21('0x2f')](_0x70ed13[_0x3f21('0x30')],_0x70ed13[_0x3f21('0x2d')]);_0x16fe7b[_0x3f21('0x31')]=_[_0x3f21('0x2f')](_0x70ed13[_0x3f21('0x30')],qs[_0x3f21('0x32')](_0x3d64df['query'][_0x3f21('0x32')]));_0x16fe7b['attributes']=_0x16fe7b['attributes'][_0x3f21('0x33')]?_0x16fe7b['attributes']:_0x70ed13[_0x3f21('0x30')];if(_0x3d64df[_0x3f21('0x2d')][_0x3f21('0x3e')]){_0x16fe7b[_0x3f21('0x46')]=[{'all':!![]}];}_0x16fe7b=_['merge']({},_0x16fe7b,_0x3d64df[_0x3f21('0x3d')]);return db[_0x3f21('0x29')][_0x3f21('0x47')](_0x16fe7b)[_0x3f21('0x25')](handleEntityNotFound(_0x45ead9,null))[_0x3f21('0x25')](respondWithResult(_0x45ead9,null))[_0x3f21('0x41')](handleError(_0x45ead9,null));};exports['create']=function(_0x5e524b,_0x1acaca){return db[_0x3f21('0x29')][_0x3f21('0x48')](_0x5e524b[_0x3f21('0x49')],{})['then'](respondWithResult(_0x1acaca,0xc9))['catch'](handleError(_0x1acaca,null));};exports[_0x3f21('0x24')]=function(_0x592486,_0x21466b){if(_0x592486['body']['id']){delete _0x592486['body']['id'];}return db[_0x3f21('0x29')]['find']({'where':{'id':_0x592486[_0x3f21('0x43')]['id']}})[_0x3f21('0x25')](handleEntityNotFound(_0x21466b,null))[_0x3f21('0x25')](saveUpdates(_0x592486['body'],null))[_0x3f21('0x25')](respondWithResult(_0x21466b,null))[_0x3f21('0x41')](handleError(_0x21466b,null));};exports['destroy']=function(_0x409e35,_0x15a8bd){return db[_0x3f21('0x29')][_0x3f21('0x47')]({'where':{'id':_0x409e35[_0x3f21('0x43')]['id']}})['then'](handleEntityNotFound(_0x15a8bd,null))['then'](removeEntity(_0x15a8bd,null))['catch'](handleError(_0x15a8bd,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index c29a2bd..219437e 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 _0x0a1c=['exports','define','VoiceQueuesLog','event_dtm','dtm','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./voiceQueuesLog.attributes'];(function(_0x576345,_0xa8c2c4){var _0x5a2b56=function(_0x36afa0){while(--_0x36afa0){_0x576345['push'](_0x576345['shift']());}};_0x5a2b56(++_0xa8c2c4);}(_0x0a1c,0x7a));var _0xc0a1=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x0a1c[_0x33032e];return _0x13316b;};'use strict';var _=require(_0xc0a1('0x0'));var util=require(_0xc0a1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc0a1('0x2'));var BPromise=require(_0xc0a1('0x3'));var rp=require(_0xc0a1('0x4'));var fs=require('fs');var path=require(_0xc0a1('0x5'));var rimraf=require('rimraf');var config=require(_0xc0a1('0x6'));var attributes=require(_0xc0a1('0x7'));module[_0xc0a1('0x8')]=function(_0x3bfb64,_0x5916d9){return _0x3bfb64[_0xc0a1('0x9')](_0xc0a1('0xa'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xc0a1('0xb'),'fields':['event',_0xc0a1('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x50ea=['request-promise','path','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5001ed,_0x1ecb28){var _0xe9378d=function(_0x289142){while(--_0x289142){_0x5001ed['push'](_0x5001ed['shift']());}};_0xe9378d(++_0x1ecb28);}(_0x50ea,0x1ca));var _0xa50e=function(_0x1713bc,_0x337d8c){_0x1713bc=_0x1713bc-0x0;var _0x59fe87=_0x50ea[_0x1713bc];return _0x59fe87;};'use strict';var _=require(_0xa50e('0x0'));var util=require(_0xa50e('0x1'));var logger=require(_0xa50e('0x2'))(_0xa50e('0x3'));var moment=require(_0xa50e('0x4'));var BPromise=require(_0xa50e('0x5'));var rp=require(_0xa50e('0x6'));var fs=require('fs');var path=require(_0xa50e('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa50e('0x8'));module[_0xa50e('0x9')]=function(_0x35794c,_0x10e8c9){return _0x35794c[_0xa50e('0xa')](_0xa50e('0xb'),attributes,{'tableName':_0xa50e('0xc'),'paranoid':![],'indexes':[{'name':_0xa50e('0xd'),'fields':[_0xa50e('0xe'),_0xa50e('0xf')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index e4b37cf..254222b 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 _0x6ff1=['result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2573d5,_0x849ad){var _0x419cf=function(_0x266d77){while(--_0x266d77){_0x2573d5['push'](_0x2573d5['shift']());}};_0x419cf(++_0x849ad);}(_0x6ff1,0x10a));var _0x16ff=function(_0xb62eac,_0xfea519){_0xb62eac=_0xb62eac-0x0;var _0x3f16b2=_0x6ff1[_0xb62eac];return _0x3f16b2;};'use strict';var _=require(_0x16ff('0x0'));var util=require(_0x16ff('0x1'));var moment=require(_0x16ff('0x2'));var BPromise=require(_0x16ff('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x16ff('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x16ff('0x5'))(_0x16ff('0x6'));var config=require(_0x16ff('0x7'));var jayson=require(_0x16ff('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x560612,_0x4e6fbf,_0x133612){return new BPromise(function(_0x218c28,_0x3b368c){return client[_0x16ff('0x9')](_0x560612,_0x133612)[_0x16ff('0xa')](function(_0xc1a41){logger[_0x16ff('0xb')](_0x16ff('0xc'),_0x4e6fbf,_0x16ff('0xd'));logger[_0x16ff('0xe')](_0x16ff('0xf'),_0x4e6fbf,_0x16ff('0xd'),JSON[_0x16ff('0x10')](_0xc1a41));if(_0xc1a41[_0x16ff('0x11')]){if(_0xc1a41[_0x16ff('0x11')][_0x16ff('0x12')]===0x1f4){logger[_0x16ff('0x11')](_0x16ff('0xc'),_0x4e6fbf,_0xc1a41[_0x16ff('0x11')][_0x16ff('0x13')]);return _0x3b368c(_0xc1a41['error']['message']);}logger[_0x16ff('0x11')](_0x16ff('0xc'),_0x4e6fbf,_0xc1a41[_0x16ff('0x11')][_0x16ff('0x13')]);return _0x218c28(_0xc1a41[_0x16ff('0x11')][_0x16ff('0x13')]);}else{logger['info'](_0x16ff('0xc'),_0x4e6fbf,_0x16ff('0xd'));_0x218c28(_0xc1a41[_0x16ff('0x14')]['message']);}})[_0x16ff('0x15')](function(_0x43b519){logger[_0x16ff('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4e6fbf,_0x43b519);_0x3b368c(_0x43b519);});});} \ No newline at end of file +var _0x1e32=['error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x532d78,_0x25b6a8){var _0x5990c4=function(_0x3f23fe){while(--_0x3f23fe){_0x532d78['push'](_0x532d78['shift']());}};_0x5990c4(++_0x25b6a8);}(_0x1e32,0xac));var _0x21e3=function(_0x42c7b1,_0x41c915){_0x42c7b1=_0x42c7b1-0x0;var _0x1de606=_0x1e32[_0x42c7b1];return _0x1de606;};'use strict';var _=require(_0x21e3('0x0'));var util=require(_0x21e3('0x1'));var moment=require(_0x21e3('0x2'));var BPromise=require(_0x21e3('0x3'));var rs=require(_0x21e3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x21e3('0x5'))['db'];var utils=require(_0x21e3('0x6'));var logger=require(_0x21e3('0x7'))(_0x21e3('0x8'));var config=require('../../config/environment');var jayson=require(_0x21e3('0x9'));var client=jayson[_0x21e3('0xa')][_0x21e3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19a18c,_0x1aa10a,_0x2086d6){return new BPromise(function(_0x3a346f,_0x4db89c){return client[_0x21e3('0xc')](_0x19a18c,_0x2086d6)[_0x21e3('0xd')](function(_0x44b775){logger['info'](_0x21e3('0xe'),_0x1aa10a,_0x21e3('0xf'));logger['debug']('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x1aa10a,_0x21e3('0xf'),JSON[_0x21e3('0x10')](_0x44b775));if(_0x44b775[_0x21e3('0x11')]){if(_0x44b775['error'][_0x21e3('0x12')]===0x1f4){logger['error'](_0x21e3('0xe'),_0x1aa10a,_0x44b775[_0x21e3('0x11')][_0x21e3('0x13')]);return _0x4db89c(_0x44b775[_0x21e3('0x11')]['message']);}logger[_0x21e3('0x11')](_0x21e3('0xe'),_0x1aa10a,_0x44b775[_0x21e3('0x11')][_0x21e3('0x13')]);return _0x3a346f(_0x44b775[_0x21e3('0x11')][_0x21e3('0x13')]);}else{logger['info'](_0x21e3('0xe'),_0x1aa10a,_0x21e3('0xf'));_0x3a346f(_0x44b775[_0x21e3('0x14')][_0x21e3('0x13')]);}})['catch'](function(_0x2450c7){logger[_0x21e3('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1aa10a,_0x2450c7);_0x4db89c(_0x2450c7);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index e7794a6..038b837 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 _0xc2f7=['path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/download','download','/:id/downloads','/:id/transcribe','post','put','multer'];(function(_0x34933a,_0x327378){var _0x36abb4=function(_0x2d6814){while(--_0x2d6814){_0x34933a['push'](_0x34933a['shift']());}};_0x36abb4(++_0x327378);}(_0xc2f7,0x1b7));var _0x7c2f=function(_0x188ae8,_0xb46eae){_0x188ae8=_0x188ae8-0x0;var _0x5e31f0=_0xc2f7[_0x188ae8];return _0x5e31f0;};'use strict';var multer=require(_0x7c2f('0x0'));var util=require('util');var path=require(_0x7c2f('0x1'));var timeout=require(_0x7c2f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7c2f('0x3'));var auth=require(_0x7c2f('0x4'));var interaction=require(_0x7c2f('0x5'));var config=require(_0x7c2f('0x6'));var controller=require(_0x7c2f('0x7'));router[_0x7c2f('0x8')]('/',auth[_0x7c2f('0x9')](),controller[_0x7c2f('0xa')]);router[_0x7c2f('0x8')](_0x7c2f('0xb'),auth[_0x7c2f('0x9')](),controller['describe']);router[_0x7c2f('0x8')](_0x7c2f('0xc'),auth['isAuthenticated'](),controller[_0x7c2f('0xd')]);router[_0x7c2f('0x8')](_0x7c2f('0xe'),auth['isAuthenticated'](),controller[_0x7c2f('0xf')]);router[_0x7c2f('0x8')](_0x7c2f('0x10'),controller['downloads']);router[_0x7c2f('0x8')](_0x7c2f('0x11'),auth[_0x7c2f('0x9')](),controller['downloadTranscribe']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x7c2f('0x12')](_0x7c2f('0x11'),auth['isAuthenticated'](),controller['runTranscribe']);router[_0x7c2f('0x13')](_0x7c2f('0xc'),auth[_0x7c2f('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8fe8=['/:id/transcribe','runTranscribe','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceRecording.controller','index','get','/describe','isAuthenticated','show','/:id/download','download','downloads','downloadTranscribe','post','create'];(function(_0x413b4d,_0xa3459c){var _0x8b810a=function(_0x22d441){while(--_0x22d441){_0x413b4d['push'](_0x413b4d['shift']());}};_0x8b810a(++_0xa3459c);}(_0x8fe8,0x123));var _0x88fe=function(_0x1bef55,_0x37a6b2){_0x1bef55=_0x1bef55-0x0;var _0x9eea45=_0x8fe8[_0x1bef55];return _0x9eea45;};'use strict';var multer=require(_0x88fe('0x0'));var util=require(_0x88fe('0x1'));var path=require(_0x88fe('0x2'));var timeout=require(_0x88fe('0x3'));var express=require(_0x88fe('0x4'));var router=express[_0x88fe('0x5')]();var fs_extra=require(_0x88fe('0x6'));var auth=require(_0x88fe('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x88fe('0x8'));var controller=require(_0x88fe('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x88fe('0xa')]);router[_0x88fe('0xb')](_0x88fe('0xc'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x88fe('0xd')](),controller[_0x88fe('0xe')]);router[_0x88fe('0xb')](_0x88fe('0xf'),auth[_0x88fe('0xd')](),controller[_0x88fe('0x10')]);router[_0x88fe('0xb')]('/:id/downloads',controller[_0x88fe('0x11')]);router[_0x88fe('0xb')]('/:id/transcribe',auth[_0x88fe('0xd')](),controller[_0x88fe('0x12')]);router[_0x88fe('0x13')]('/',auth[_0x88fe('0xd')](),controller[_0x88fe('0x14')]);router['post'](_0x88fe('0x15'),auth[_0x88fe('0xd')](),controller[_0x88fe('0x16')]);router['put'](_0x88fe('0x17'),auth[_0x88fe('0xd')](),controller[_0x88fe('0x18')]);router['delete'](_0x88fe('0x17'),auth[_0x88fe('0xd')](),controller[_0x88fe('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 937c2f3..125efca 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(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_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 diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 3cc041e..93a5d4e 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 _0xdb20=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','error','stack','name','send','map','VoiceRecording','rawAttributes','fieldName','type','differenceBy','query','keys','filters','model','attributes','intersection','fields','sort','where','filter','merge','include','catch','show','params','length','includeAll','options','find','create','update','body','describe','uniqueid','value','existsSync','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','download','filename','extname','unlink','message','downloads','../../components/encryptor','sequelize','MD5','col','token','$and','push','format','%s.cypher','secrets','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','createBucket','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','findOne','decryptFile','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','IN_PROGRESS','updateAttributes','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available'];(function(_0x1fa759,_0x4ecdce){var _0x2da9f4=function(_0x463e2a){while(--_0x463e2a){_0x1fa759['push'](_0x1fa759['shift']());}};_0x2da9f4(++_0x4ecdce);}(_0xdb20,0x8d));var _0x0db2=function(_0x2a7b6c,_0x2372cf){_0x2a7b6c=_0x2a7b6c-0x0;var _0x37fdfb=_0xdb20[_0x2a7b6c];return _0x37fdfb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0db2('0x0'));var zipdir=require(_0x0db2('0x1'));var jsonpatch=require(_0x0db2('0x2'));var rp=require(_0x0db2('0x3'));var moment=require(_0x0db2('0x4'));var BPromise=require(_0x0db2('0x5'));var Mustache=require(_0x0db2('0x6'));var util=require('util');var path=require(_0x0db2('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0db2('0x8'));var fs=require('fs');var fs_extra=require(_0x0db2('0x9'));var _=require(_0x0db2('0xa'));var squel=require('squel');var crypto=require(_0x0db2('0xb'));var jsforce=require(_0x0db2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0db2('0xd'));var querystring=require('querystring');var Papa=require(_0x0db2('0xe'));var AWS=require(_0x0db2('0xf'));var uuidv4=require(_0x0db2('0x10'));var Redis=require(_0x0db2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0db2('0x12'));var as=require(_0x0db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0db2('0x14'))(_0x0db2('0x15'));var utils=require(_0x0db2('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0db2('0x17'));var db=require(_0x0db2('0x18'))['db'];function respondWithStatusCode(_0x471f43,_0x3727d5){_0x3727d5=_0x3727d5||0xcc;return function(_0x3eddf9){if(_0x3eddf9){return _0x471f43[_0x0db2('0x19')](_0x3727d5);}return _0x471f43[_0x0db2('0x1a')](_0x3727d5)['end']();};}function respondWithResult(_0x53deab,_0x4c40e3){_0x4c40e3=_0x4c40e3||0xc8;return function(_0x4a1032){if(_0x4a1032){return _0x53deab[_0x0db2('0x1a')](_0x4c40e3)[_0x0db2('0x1b')](_0x4a1032);}};}function respondWithFilteredResult(_0x17ccc7,_0x64f92e){return function(_0x3516d5){if(_0x3516d5){var _0x5d2bbd=typeof _0x64f92e[_0x0db2('0x1c')]===_0x0db2('0x1d')&&typeof _0x64f92e[_0x0db2('0x1e')]===_0x0db2('0x1d');var _0x351780=_0x3516d5[_0x0db2('0x1f')];var _0x447ac2=_0x5d2bbd?0x0:_0x64f92e[_0x0db2('0x1c')];var _0x4f0c6d=_0x5d2bbd?_0x3516d5[_0x0db2('0x1f')]:_0x64f92e[_0x0db2('0x1c')]+_0x64f92e[_0x0db2('0x1e')];var _0x61d46f;if(_0x4f0c6d>=_0x351780){_0x4f0c6d=_0x351780;_0x61d46f=0xc8;}else{_0x61d46f=0xce;}_0x17ccc7[_0x0db2('0x1a')](_0x61d46f);return _0x17ccc7['set'](_0x0db2('0x20'),_0x447ac2+'-'+_0x4f0c6d+'/'+_0x351780)[_0x0db2('0x1b')](_0x3516d5);}return null;};}function patchUpdates(_0x15c364){return function(_0x2871e4){try{jsonpatch[_0x0db2('0x21')](_0x2871e4,_0x15c364,!![]);}catch(_0x555a74){return BPromise[_0x0db2('0x22')](_0x555a74);}return _0x2871e4['save']();};}function saveUpdates(_0x5bdc8a,_0x9224f4){return function(_0x42015c){if(_0x42015c){return _0x42015c['update'](_0x5bdc8a)[_0x0db2('0x23')](function(_0x356d65){return _0x356d65;});}return null;};}function removeEntity(_0x31313f,_0x38978d){return function(_0x9739eb){if(_0x9739eb){return _0x9739eb[_0x0db2('0x24')]()['then'](function(){_0x31313f[_0x0db2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d4576,_0x1e1724){return function(_0x3859ff){if(!_0x3859ff){_0x4d4576[_0x0db2('0x19')](0x194);}return _0x3859ff;};}function handleError(_0xd8ea4c,_0x5070de){_0x5070de=_0x5070de||0x1f4;return function(_0x48e22a){logger[_0x0db2('0x25')](_0x48e22a[_0x0db2('0x26')]);if(_0x48e22a[_0x0db2('0x27')]){delete _0x48e22a[_0x0db2('0x27')];}_0xd8ea4c[_0x0db2('0x1a')](_0x5070de)[_0x0db2('0x28')](_0x48e22a);};}exports['index']=function(_0x713511,_0x4951a8){var _0x3cadfb={},_0x3403ec={},_0x773a1e={'count':0x0,'rows':[]};var _0x295751=_[_0x0db2('0x29')](db[_0x0db2('0x2a')][_0x0db2('0x2b')],function(_0xea17ec){return{'name':_0xea17ec[_0x0db2('0x2c')],'type':_0xea17ec[_0x0db2('0x2d')]['key']};});_0x3403ec['model']=_[_0x0db2('0x2e')](_[_0x0db2('0x29')](_0x295751,'name'),['format']);_0x3403ec[_0x0db2('0x2f')]=_[_0x0db2('0x30')](_0x713511[_0x0db2('0x2f')]);_0x3403ec[_0x0db2('0x31')]=_['intersection'](_0x3403ec[_0x0db2('0x32')],_0x3403ec[_0x0db2('0x2f')]);_0x3cadfb[_0x0db2('0x33')]=_[_0x0db2('0x34')](_0x3403ec[_0x0db2('0x32')],qs[_0x0db2('0x35')](_0x713511[_0x0db2('0x2f')][_0x0db2('0x35')]));_0x3cadfb[_0x0db2('0x33')]=_0x3cadfb[_0x0db2('0x33')]['length']?_0x3cadfb['attributes']:_0x3403ec['model'];if(!_0x713511[_0x0db2('0x2f')]['hasOwnProperty']('nolimit')){_0x3cadfb[_0x0db2('0x1e')]=qs[_0x0db2('0x1e')](_0x713511[_0x0db2('0x2f')]['limit']);_0x3cadfb[_0x0db2('0x1c')]=qs[_0x0db2('0x1c')](_0x713511[_0x0db2('0x2f')]['offset']);}_0x3cadfb['order']=qs[_0x0db2('0x36')](_0x713511[_0x0db2('0x2f')]['sort']);_0x3cadfb[_0x0db2('0x37')]=qs[_0x0db2('0x31')](_['pick'](_0x713511[_0x0db2('0x2f')],_0x3403ec[_0x0db2('0x31')]),_0x295751);if(_0x713511['query'][_0x0db2('0x38')]){_0x3cadfb[_0x0db2('0x37')]=_[_0x0db2('0x39')](_0x3cadfb[_0x0db2('0x37')],{'$or':_[_0x0db2('0x29')](_0x295751,function(_0x3377d4){if(_0x3377d4[_0x0db2('0x2d')]!=='VIRTUAL'){var _0x488758={};_0x488758[_0x3377d4[_0x0db2('0x27')]]={'$like':'%'+_0x713511[_0x0db2('0x2f')][_0x0db2('0x38')]+'%'};return _0x488758;}})});}_0x3cadfb=_[_0x0db2('0x39')]({},_0x3cadfb,_0x713511['options']);var _0x264101={'where':_0x3cadfb['where']};return db[_0x0db2('0x2a')]['count'](_0x264101)[_0x0db2('0x23')](function(_0x58c09d){_0x773a1e['count']=_0x58c09d;if(_0x713511[_0x0db2('0x2f')]['includeAll']){_0x3cadfb[_0x0db2('0x3a')]=[{'all':!![]}];}return db[_0x0db2('0x2a')]['findAll'](_0x3cadfb);})['then'](function(_0x40c68f){_0x773a1e['rows']=_0x40c68f;return _0x773a1e;})[_0x0db2('0x23')](respondWithFilteredResult(_0x4951a8,_0x3cadfb))[_0x0db2('0x3b')](handleError(_0x4951a8,null));};exports[_0x0db2('0x3c')]=function(_0x57eecb,_0x74645){var _0x5a7983={'raw':![],'where':{'id':_0x57eecb[_0x0db2('0x3d')]['id']}},_0x316289={};_0x316289[_0x0db2('0x32')]=_['keys'](db['VoiceRecording'][_0x0db2('0x2b')]);_0x316289['query']=_[_0x0db2('0x30')](_0x57eecb[_0x0db2('0x2f')]);_0x316289['filters']=_[_0x0db2('0x34')](_0x316289[_0x0db2('0x32')],_0x316289[_0x0db2('0x2f')]);_0x5a7983[_0x0db2('0x33')]=_[_0x0db2('0x34')](_0x316289[_0x0db2('0x32')],qs[_0x0db2('0x35')](_0x57eecb[_0x0db2('0x2f')][_0x0db2('0x35')]));_0x5a7983[_0x0db2('0x33')]=_0x5a7983[_0x0db2('0x33')][_0x0db2('0x3e')]?_0x5a7983[_0x0db2('0x33')]:_0x316289[_0x0db2('0x32')];if(_0x57eecb[_0x0db2('0x2f')][_0x0db2('0x3f')]){_0x5a7983[_0x0db2('0x3a')]=[{'all':!![]}];}_0x5a7983=_[_0x0db2('0x39')]({},_0x5a7983,_0x57eecb[_0x0db2('0x40')]);return db[_0x0db2('0x2a')][_0x0db2('0x41')](_0x5a7983)[_0x0db2('0x23')](handleEntityNotFound(_0x74645,null))[_0x0db2('0x23')](respondWithResult(_0x74645,null))[_0x0db2('0x3b')](handleError(_0x74645,null));};exports['create']=function(_0x5749b0,_0x301069){return db[_0x0db2('0x2a')][_0x0db2('0x42')](_0x5749b0['body'],{})['then'](respondWithResult(_0x301069,0xc9))[_0x0db2('0x3b')](handleError(_0x301069,null));};exports[_0x0db2('0x43')]=function(_0x19ca2d,_0x557c2c){if(_0x19ca2d[_0x0db2('0x44')]['id']){delete _0x19ca2d[_0x0db2('0x44')]['id'];}return db['VoiceRecording'][_0x0db2('0x41')]({'where':{'id':_0x19ca2d['params']['id']}})[_0x0db2('0x23')](handleEntityNotFound(_0x557c2c,null))[_0x0db2('0x23')](saveUpdates(_0x19ca2d['body'],null))[_0x0db2('0x23')](respondWithResult(_0x557c2c,null))[_0x0db2('0x3b')](handleError(_0x557c2c,null));};exports[_0x0db2('0x45')]=function(_0x51d797,_0xf8aa23){return db[_0x0db2('0x2a')][_0x0db2('0x45')]()[_0x0db2('0x23')](respondWithResult(_0xf8aa23,null))['catch'](handleError(_0xf8aa23,null));};exports['download']=function(_0x14f8ec,_0x433894,_0x46f277){var _0x5d05d4=require('../../components/encryptor');var _0x3dab3f=![];var _0x464fd0={};if(_0x14f8ec[_0x0db2('0x2f')][_0x0db2('0x2d')]&&_0x14f8ec[_0x0db2('0x2f')]['type']===_0x0db2('0x46')){_0x464fd0[_0x0db2('0x46')]=_0x14f8ec[_0x0db2('0x3d')]['id'];}else{_0x464fd0['id']=_0x14f8ec[_0x0db2('0x3d')]['id'];}return db[_0x0db2('0x2a')][_0x0db2('0x41')]({'where':_0x464fd0,'attributes':['id',_0x0db2('0x47')],'raw':!![]})[_0x0db2('0x23')](handleEntityNotFound(_0x433894,null))[_0x0db2('0x23')](function(_0x4c458d){if(_0x4c458d){var _0xe3baa0=_0x4c458d['value'];var _0x56038e=util['format']('%s.cypher',_0xe3baa0);if(fs[_0x0db2('0x48')](_0x56038e)){_0x3dab3f=!![];return _0x5d05d4['decryptFile'](_0x56038e,_0xe3baa0,config['secrets'][_0x0db2('0x49')])[_0x0db2('0x23')](function(){return _0x4c458d;});}return _0x4c458d;}})[_0x0db2('0x23')](function(_0x330a7f){if(_0x330a7f){var _0x4b627e=_0x330a7f['value'];if(!fs['existsSync'](_0x4b627e)){throw new db[(_0x0db2('0x4a'))][(_0x0db2('0x4b'))](_0x0db2('0x4c'));}if(_0x330a7f['filename']){return _0x433894[_0x0db2('0x4d')](_0x4b627e,_0x330a7f[_0x0db2('0x4e')]+path[_0x0db2('0x4f')](_0x4b627e),function(){if(_0x3dab3f){fs[_0x0db2('0x50')](_0x4b627e);}});}else{return _0x433894[_0x0db2('0x4d')](_0x4b627e,function(_0x5c5c69){if(_0x3dab3f){fs[_0x0db2('0x50')](_0x4b627e);}});}}})[_0x0db2('0x3b')](function(_0x3e0df0){if(_0x3e0df0[_0x0db2('0x51')]===_0x0db2('0x4c')){_0x433894['status'](0x194)[_0x0db2('0x28')]('Not\x20found');}else{return handleError(_0x433894,null);}});};exports[_0x0db2('0x52')]=function(_0x3fb729,_0x35a102,_0x37f2e4){var _0x53a509=require(_0x0db2('0x53'));var _0x2f63be=![];var _0x52e512={'$and':[db[_0x0db2('0x54')][_0x0db2('0x37')](db[_0x0db2('0x54')]['fn'](_0x0db2('0x55'),db[_0x0db2('0x54')][_0x0db2('0x56')](_0x0db2('0x46'))),_0x3fb729[_0x0db2('0x2f')][_0x0db2('0x57')])]};if(_0x3fb729[_0x0db2('0x2f')]['type']&&_0x3fb729[_0x0db2('0x2f')][_0x0db2('0x2d')]==='uniqueid'){_0x52e512[_0x0db2('0x58')][_0x0db2('0x59')]({'uniqueid':_0x3fb729[_0x0db2('0x3d')]['id']});}else{_0x52e512[_0x0db2('0x58')][_0x0db2('0x59')]({'id':_0x3fb729['params']['id']});}return db[_0x0db2('0x2a')][_0x0db2('0x41')]({'where':_0x52e512,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x35a102,null))[_0x0db2('0x23')](function(_0x32e9b2){if(_0x32e9b2){var _0x2e9761=util[_0x0db2('0x5a')](_0x0db2('0x5b'),_0x32e9b2[_0x0db2('0x47')]);if(fs[_0x0db2('0x48')](_0x2e9761)){_0x2f63be=!![];return _0x53a509['decryptFile'](_0x2e9761,_0x32e9b2[_0x0db2('0x47')],config[_0x0db2('0x5c')]['recording'])[_0x0db2('0x23')](function(){return _0x32e9b2;});}return _0x32e9b2;}})['then'](function(_0x21ed6b){if(_0x21ed6b){if(!fs[_0x0db2('0x48')](_0x21ed6b['value'])){throw new db[(_0x0db2('0x4a'))]['ValidationError'](_0x0db2('0x4c'));}if(_0x21ed6b[_0x0db2('0x4e')]){return _0x35a102['download'](_0x21ed6b[_0x0db2('0x47')],_0x21ed6b['filename']+path[_0x0db2('0x4f')](_0x21ed6b[_0x0db2('0x47')]),function(){if(_0x2f63be){fs['unlink'](_0x21ed6b[_0x0db2('0x47')]);}});}else{return _0x35a102[_0x0db2('0x4d')](_0x21ed6b[_0x0db2('0x47')],function(_0x2dcff9){if(_0x2f63be){fs['unlink'](_0x21ed6b[_0x0db2('0x47')]);}});}}})['catch'](handleError(_0x35a102,null));};exports[_0x0db2('0x24')]=function(_0x4526f7,_0x412690){return db[_0x0db2('0x2a')][_0x0db2('0x41')]({'where':{'id':_0x4526f7['params']['id']}})[_0x0db2('0x23')](function(_0x34eb57){if(_['isNil'](_0x34eb57)){throw new ReferenceError(_0x0db2('0x5d'));}return _0x34eb57;})[_0x0db2('0x23')](function(_0xba7a6e){var _0x86f3cc=_0xba7a6e['value'];logger[_0x0db2('0x5e')]('cancellazione\x20fisica\x20documento\x20%s',_0x86f3cc);if(!_[_0x0db2('0x5f')](_0xba7a6e[_0x0db2('0x47')])&&fs[_0x0db2('0x48')](_0x86f3cc)){logger[_0x0db2('0x5e')](_0x0db2('0x60')+_0x86f3cc+_0x0db2('0x61'));fs[_0x0db2('0x62')](_0x86f3cc);}_0x86f3cc=_0x86f3cc+_0x0db2('0x63');if(!_[_0x0db2('0x5f')](_0xba7a6e[_0x0db2('0x47')])&&fs['existsSync'](_0x86f3cc)){logger[_0x0db2('0x5e')](_0x0db2('0x60')+_0x86f3cc+_0x0db2('0x61'));fs['unlinkSync'](_0x86f3cc);}return _0xba7a6e;})[_0x0db2('0x23')](function(_0x18f0d1){if(!_0x18f0d1)throw new InternalError();return _0x18f0d1['destroy']();})[_0x0db2('0x23')](function(){_0x412690[_0x0db2('0x1a')](0xcc)['end']();})['catch'](handleError(_0x412690,null));};function getBucketslist(_0x4e3e33,_0xc42467,_0x52e7ee){return new Promise(function(_0x5ca201,_0x1b285e){var _0x1e9b2e=new AWS['S3']({'accessKeyId':_0xc42467,'secretAccessKey':_0x4e3e33,'region':_0x52e7ee});_0x1e9b2e['listBuckets']({},function(_0x475057,_0x71dd37){if(_0x475057){return _0x1b285e(_0x475057);}else{return _0x5ca201(_0x71dd37);}});});}function createBucket(_0x1a58fd,_0x38e2f0,_0x2873b2,_0x36348b){return new Promise(function(_0xc6da3f,_0x3e1543){var _0x5d5600=new AWS['S3']({'accessKeyId':_0x38e2f0,'secretAccessKey':_0x1a58fd,'region':_0x2873b2});_0x5d5600[_0x0db2('0x64')]({'Bucket':_0x36348b},function(_0xea02d0,_0x29beff){if(_0xea02d0){return _0x3e1543(_0xea02d0);}else{return _0xc6da3f(_0x29beff);}});});}function uploadFile(_0x303851,_0x865c78,_0x32ca23,_0x4500ce,_0x2f9c5a,_0x98349b){return new Promise(function(_0x289ccb,_0x104652){var _0x3318d0=new AWS['S3']({'accessKeyId':_0x865c78,'secretAccessKey':_0x303851,'region':_0x32ca23});_0x3318d0['upload']({'Bucket':_0x4500ce,'Key':_0x2f9c5a,'Body':_0x98349b},function(_0x16d7be,_0xeb5151){if(_0x16d7be){return _0x104652(_0x16d7be);}else{return _0x289ccb(_0xeb5151);}});});}function startTranscribe(_0x10d533,_0x215dca,_0x4ffcd9,_0x53802f,_0x2637bc,_0x81f9cb){return new Promise(function(_0x253aca,_0x41778d){var _0x552ee1=new AWS[(_0x0db2('0x65'))]({'accessKeyId':_0x215dca,'secretAccessKey':_0x10d533,'region':_0x4ffcd9});_0x552ee1[_0x0db2('0x66')]({'TranscriptionJobName':_0x53802f,'LanguageCode':_0x2637bc,'Media':{'MediaFileUri':_0x81f9cb}},function(_0x2f935d,_0x2b0301){if(_0x2f935d){return _0x41778d(_0x2f935d);}else{return _0x253aca(_0x2b0301);}});});}function transcribe(_0x2f5cde,_0x5bfe00,_0x2cbf91,_0x7ae25,_0x30e205,_0x58afec,_0x3b8f2e){return new Promise(function(_0x320747,_0x179296){var _0x4ceb9b={};logger[_0x0db2('0x5e')](util[_0x0db2('0x5a')](_0x0db2('0x67'),_0x2f5cde,_0x30e205));return uploadFile(_0x5bfe00,_0x2cbf91,_0x7ae25,_0x30e205,path['basename'](_0x58afec),fs[_0x0db2('0x68')](_0x58afec))['then'](function(_0x682597){logger['info'](util[_0x0db2('0x5a')](_0x0db2('0x69'),_0x2f5cde,_0x30e205,_0x682597['Location']));_0x4ceb9b[_0x0db2('0x6a')]=_0x682597[_0x0db2('0x6b')];_0x4ceb9b['location']=_0x682597[_0x0db2('0x6c')];logger[_0x0db2('0x5e')](util[_0x0db2('0x5a')](_0x0db2('0x6d'),_0x2f5cde));return startTranscribe(_0x5bfe00,_0x2cbf91,_0x7ae25,uuidv4(),_0x3b8f2e,_0x682597[_0x0db2('0x6c')]);})['then'](function(_0x344aca){logger['info'](util[_0x0db2('0x5a')](_0x0db2('0x6e'),_0x2f5cde,_0x344aca[_0x0db2('0x6f')][_0x0db2('0x70')]));_0x4ceb9b[_0x0db2('0x71')]=_0x344aca['TranscriptionJob']['TranscriptionJobName'];_0x4ceb9b[_0x0db2('0x72')]=_0x344aca['TranscriptionJob']['TranscriptionJobStatus'];return _0x320747(_0x4ceb9b);})[_0x0db2('0x3b')](function(_0x19fcc5){return _0x179296(_0x19fcc5);});});}exports['runTranscribe']=function(_0x52c50e,_0x4d0a08,_0xd03196){var _0x294031;var _0x3de22d;var _0x2b73a0;var _0x4edfcf=require('../../components/encryptor');return db[_0x0db2('0x2a')][_0x0db2('0x73')]({'where':{'id':_0x52c50e['params']['id']}})[_0x0db2('0x23')](function(_0x15efcc){if(_0x15efcc){var _0x6920d7=util['format'](_0x0db2('0x5b'),_0x15efcc[_0x0db2('0x47')]);if(fs['existsSync'](_0x6920d7)){cypher=!![];return _0x4edfcf[_0x0db2('0x74')](_0x6920d7,_0x15efcc[_0x0db2('0x47')],config[_0x0db2('0x5c')][_0x0db2('0x49')])[_0x0db2('0x23')](function(){return _0x15efcc;});}return _0x15efcc;}})[_0x0db2('0x23')](function(_0x53e6f2){if(!_0x53e6f2){throw new db['Sequelize'][(_0x0db2('0x4b'))](_0x0db2('0x75'));}_0x3de22d=_0x53e6f2;return db[_0x0db2('0x76')][_0x0db2('0x73')]({'where':{'id':0x1}});})[_0x0db2('0x23')](handleEntityNotFound(_0x4d0a08,null))['then'](function(_0x530995){if(_0x530995){_0x294031=_0x530995;if(!_0x294031[_0x0db2('0x77')]||!_0x294031[_0x0db2('0x78')]||!_0x294031[_0x0db2('0x79')]||!_0x294031['language']||!_0x294031['bucket']){throw new db[(_0x0db2('0x4a'))][(_0x0db2('0x4b'))](_0x0db2('0x7a'));}if(_0x52c50e['body'][_0x0db2('0x7b')]&&(!_0x294031[_0x0db2('0x7c')]||!_0x294031[_0x0db2('0x7d')]||!_0x294031[_0x0db2('0x7e')]||!_0x294031[_0x0db2('0x7f')]||!_0x294031[_0x0db2('0x6a')])){throw new db['Sequelize'][(_0x0db2('0x4b'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x0db2('0x80')][_0x0db2('0x73')]({'where':{'id':_0x294031[_0x0db2('0x78')]}});}})['then'](function(_0x1d3841){if(!_0x1d3841){throw new db[(_0x0db2('0x4a'))][(_0x0db2('0x4b'))](_0x0db2('0x81'));}if(!_0x1d3841[_0x0db2('0x82')]||!_0x1d3841[_0x0db2('0x83')]){throw new db[(_0x0db2('0x4a'))]['ValidationError'](_0x0db2('0x84'));}_0x2b73a0=_0x1d3841;return getBucketslist(_0x2b73a0[_0x0db2('0x82')],_0x2b73a0[_0x0db2('0x83')],_0x294031[_0x0db2('0x79')]);})['then'](function(_0x4e3e0c){if(_0x4e3e0c&&_0x4e3e0c[_0x0db2('0x85')]){var _0x354f20=_[_0x0db2('0x41')](_0x4e3e0c['Buckets'],function(_0x3b73f2){return _0x3b73f2['Name']===_0x294031[_0x0db2('0x6a')];});if(!_0x354f20){logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x52c50e[_0x0db2('0x3d')]['id'],_0x294031[_0x0db2('0x6a')]));return createBucket(_0x2b73a0[_0x0db2('0x82')],_0x2b73a0['data2'],_0x294031[_0x0db2('0x79')],_0x294031['bucket']);}logger['info'](util[_0x0db2('0x5a')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x52c50e[_0x0db2('0x3d')]['id'],_0x294031[_0x0db2('0x6a')]));return;}})['then'](function(_0x410613){if(_0x3de22d[_0x0db2('0x72')]==='NEW'){return transcribe(_0x52c50e[_0x0db2('0x3d')]['id'],_0x2b73a0[_0x0db2('0x82')],_0x2b73a0['data2'],_0x294031[_0x0db2('0x79')],_0x294031[_0x0db2('0x6a')],_0x3de22d[_0x0db2('0x47')],_0x294031[_0x0db2('0x7f')]);}else{logger[_0x0db2('0x5e')](util[_0x0db2('0x5a')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x52c50e['params']['id']));return{'transcribeStatus':_0x0db2('0x86')};}})[_0x0db2('0x23')](function(_0xd90ad7){if(_0xd90ad7){_0xd90ad7['tempSentiment']=_0x52c50e[_0x0db2('0x44')][_0x0db2('0x7b')];return _0x3de22d[_0x0db2('0x87')](_0xd90ad7);}})[_0x0db2('0x23')](respondWithResult(_0x4d0a08,null))[_0x0db2('0x3b')](handleError(_0x4d0a08,null));};function writeFile(_0x50a008,_0x596fe6){return new Promise(function(_0x184ff1,_0x2cf83b){fs['writeFile'](_0x596fe6,_0x50a008,function(_0x5528ec,_0x147211){if(_0x5528ec){return _0x2cf83b(_0x5528ec);}else{return _0x184ff1(_0x147211);}});});}exports['downloadTranscribe']=function(_0x5f521f,_0x26798a,_0x3f8c50){return db[_0x0db2('0x2a')][_0x0db2('0x73')]({'where':{'id':_0x5f521f[_0x0db2('0x3d')]['id']}})[_0x0db2('0x23')](handleEntityNotFound(_0x26798a))[_0x0db2('0x23')](function(_0x444e99){if(_0x444e99&&_0x444e99['fileText']){var _0x4a54f8=_0x444e99[_0x0db2('0x88')];var _0x215495=config[_0x0db2('0x89')]+_0x0db2('0x8a')+_0x444e99['id']+_0x0db2('0x8b');if(fs[_0x0db2('0x48')](_0x215495)){return _0x215495;}return writeFile(_0x4a54f8,_0x215495)['then'](function(){return _0x215495;});}else{throw new db[(_0x0db2('0x4a'))]['ValidationError'](_0x0db2('0x8c'));}})[_0x0db2('0x23')](function(_0x5d08e1){return _0x26798a[_0x0db2('0x4d')](_0x5d08e1);})[_0x0db2('0x3b')](handleError(_0x26798a));}; \ No newline at end of file +var _0xed7a=['error','name','send','index','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','map','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','describe','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','secrets','existsSync','Sequelize','VoiceRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','recording','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','upload','TranscribeService','startTranscriptionJob','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','runTranscribe','ValidationError','Setting','findOne','transcribe','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','root','Transcript\x20not\x20available','eml-format','fast-json-patch','request-promise','moment','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','undefined','status','set','Content-Range','apply','reject','save','then','destroy'];(function(_0x19de6f,_0x12dc21){var _0x587129=function(_0x2f489c){while(--_0x2f489c){_0x19de6f['push'](_0x19de6f['shift']());}};_0x587129(++_0x12dc21);}(_0xed7a,0x111));var _0xaed7=function(_0xc4f3e8,_0x53d218){_0xc4f3e8=_0xc4f3e8-0x0;var _0x39da96=_0xed7a[_0xc4f3e8];return _0x39da96;};'use strict';var emlformat=require(_0xaed7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaed7('0x1'));var rp=require(_0xaed7('0x2'));var moment=require(_0xaed7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xaed7('0x4'));var util=require(_0xaed7('0x5'));var path=require('path');var sox=require(_0xaed7('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaed7('0x7'));var _=require(_0xaed7('0x8'));var squel=require(_0xaed7('0x9'));var crypto=require(_0xaed7('0xa'));var jsforce=require(_0xaed7('0xb'));var deskjs=require(_0xaed7('0xc'));var toCsv=require('to-csv');var querystring=require(_0xaed7('0xd'));var Papa=require(_0xaed7('0xe'));var AWS=require(_0xaed7('0xf'));var uuidv4=require(_0xaed7('0x10'));var Redis=require(_0xaed7('0x11'));var authService=require(_0xaed7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xaed7('0x13'));var hardwareService=require(_0xaed7('0x14'));var logger=require(_0xaed7('0x15'))(_0xaed7('0x16'));var utils=require('../../config/utils');var config=require(_0xaed7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xaed7('0x18'))['db'];function respondWithStatusCode(_0x1ab4ae,_0x3d2bab){_0x3d2bab=_0x3d2bab||0xcc;return function(_0x492c5c){if(_0x492c5c){return _0x1ab4ae[_0xaed7('0x19')](_0x3d2bab);}return _0x1ab4ae['status'](_0x3d2bab)[_0xaed7('0x1a')]();};}function respondWithResult(_0x28c8e2,_0x750324){_0x750324=_0x750324||0xc8;return function(_0x1473ae){if(_0x1473ae){return _0x28c8e2['status'](_0x750324)[_0xaed7('0x1b')](_0x1473ae);}};}function respondWithFilteredResult(_0x1acaa9,_0x13b7ee){return function(_0x5ce89f){if(_0x5ce89f){var _0x442c5e=typeof _0x13b7ee[_0xaed7('0x1c')]==='undefined'&&typeof _0x13b7ee[_0xaed7('0x1d')]===_0xaed7('0x1e');var _0x101030=_0x5ce89f['count'];var _0x1a108b=_0x442c5e?0x0:_0x13b7ee[_0xaed7('0x1c')];var _0x285b98=_0x442c5e?_0x5ce89f['count']:_0x13b7ee[_0xaed7('0x1c')]+_0x13b7ee[_0xaed7('0x1d')];var _0x731cde;if(_0x285b98>=_0x101030){_0x285b98=_0x101030;_0x731cde=0xc8;}else{_0x731cde=0xce;}_0x1acaa9[_0xaed7('0x1f')](_0x731cde);return _0x1acaa9[_0xaed7('0x20')](_0xaed7('0x21'),_0x1a108b+'-'+_0x285b98+'/'+_0x101030)['json'](_0x5ce89f);}return null;};}function patchUpdates(_0x348ef7){return function(_0x2e3593){try{jsonpatch[_0xaed7('0x22')](_0x2e3593,_0x348ef7,!![]);}catch(_0x176998){return BPromise[_0xaed7('0x23')](_0x176998);}return _0x2e3593[_0xaed7('0x24')]();};}function saveUpdates(_0x2562c6,_0x52754c){return function(_0xea417b){if(_0xea417b){return _0xea417b['update'](_0x2562c6)[_0xaed7('0x25')](function(_0x161ba8){return _0x161ba8;});}return null;};}function removeEntity(_0x35c434,_0x26dc45){return function(_0x2e85b4){if(_0x2e85b4){return _0x2e85b4[_0xaed7('0x26')]()[_0xaed7('0x25')](function(){_0x35c434[_0xaed7('0x1f')](0xcc)[_0xaed7('0x1a')]();});}};}function handleEntityNotFound(_0x322726,_0x4eb46c){return function(_0x4fd65a){if(!_0x4fd65a){_0x322726[_0xaed7('0x19')](0x194);}return _0x4fd65a;};}function handleError(_0x5bc9d2,_0x3a066f){_0x3a066f=_0x3a066f||0x1f4;return function(_0x1ba825){logger[_0xaed7('0x27')](_0x1ba825['stack']);if(_0x1ba825['name']){delete _0x1ba825[_0xaed7('0x28')];}_0x5bc9d2[_0xaed7('0x1f')](_0x3a066f)[_0xaed7('0x29')](_0x1ba825);};}exports[_0xaed7('0x2a')]=function(_0x478540,_0x211431){var _0x4eaa68={},_0x9a37b1={},_0x5568aa={'count':0x0,'rows':[]};var _0x59523f=_['map'](db[_0xaed7('0x2b')][_0xaed7('0x2c')],function(_0x3bf4d8){return{'name':_0x3bf4d8[_0xaed7('0x2d')],'type':_0x3bf4d8[_0xaed7('0x2e')][_0xaed7('0x2f')]};});_0x9a37b1[_0xaed7('0x30')]=_[_0xaed7('0x31')](_[_0xaed7('0x32')](_0x59523f,'name'),[_0xaed7('0x33')]);_0x9a37b1[_0xaed7('0x34')]=_[_0xaed7('0x35')](_0x478540['query']);_0x9a37b1[_0xaed7('0x36')]=_[_0xaed7('0x37')](_0x9a37b1[_0xaed7('0x30')],_0x9a37b1[_0xaed7('0x34')]);_0x4eaa68[_0xaed7('0x38')]=_[_0xaed7('0x37')](_0x9a37b1['model'],qs[_0xaed7('0x39')](_0x478540[_0xaed7('0x34')]['fields']));_0x4eaa68[_0xaed7('0x38')]=_0x4eaa68[_0xaed7('0x38')][_0xaed7('0x3a')]?_0x4eaa68[_0xaed7('0x38')]:_0x9a37b1[_0xaed7('0x30')];if(!_0x478540[_0xaed7('0x34')][_0xaed7('0x3b')](_0xaed7('0x3c'))){_0x4eaa68[_0xaed7('0x1d')]=qs['limit'](_0x478540[_0xaed7('0x34')][_0xaed7('0x1d')]);_0x4eaa68[_0xaed7('0x1c')]=qs['offset'](_0x478540[_0xaed7('0x34')][_0xaed7('0x1c')]);}_0x4eaa68[_0xaed7('0x3d')]=qs[_0xaed7('0x3e')](_0x478540[_0xaed7('0x34')][_0xaed7('0x3e')]);_0x4eaa68[_0xaed7('0x3f')]=qs['filters'](_[_0xaed7('0x40')](_0x478540['query'],_0x9a37b1[_0xaed7('0x36')]),_0x59523f);if(_0x478540['query'][_0xaed7('0x41')]){_0x4eaa68[_0xaed7('0x3f')]=_[_0xaed7('0x42')](_0x4eaa68[_0xaed7('0x3f')],{'$or':_[_0xaed7('0x32')](_0x59523f,function(_0xcba2d6){if(_0xcba2d6['type']!==_0xaed7('0x43')){var _0x8b13f7={};_0x8b13f7[_0xcba2d6[_0xaed7('0x28')]]={'$like':'%'+_0x478540['query'][_0xaed7('0x41')]+'%'};return _0x8b13f7;}})});}_0x4eaa68=_[_0xaed7('0x42')]({},_0x4eaa68,_0x478540[_0xaed7('0x44')]);var _0x3d4f38={'where':_0x4eaa68[_0xaed7('0x3f')]};return db['VoiceRecording'][_0xaed7('0x45')](_0x3d4f38)['then'](function(_0x5d16bf){_0x5568aa[_0xaed7('0x45')]=_0x5d16bf;if(_0x478540['query'][_0xaed7('0x46')]){_0x4eaa68[_0xaed7('0x47')]=[{'all':!![]}];}return db[_0xaed7('0x2b')][_0xaed7('0x48')](_0x4eaa68);})[_0xaed7('0x25')](function(_0x191de8){_0x5568aa[_0xaed7('0x49')]=_0x191de8;return _0x5568aa;})['then'](respondWithFilteredResult(_0x211431,_0x4eaa68))[_0xaed7('0x4a')](handleError(_0x211431,null));};exports[_0xaed7('0x4b')]=function(_0x40b936,_0x47619e){var _0x3d805e={'raw':![],'where':{'id':_0x40b936[_0xaed7('0x4c')]['id']}},_0x3b89fb={};_0x3b89fb[_0xaed7('0x30')]=_['keys'](db[_0xaed7('0x2b')][_0xaed7('0x2c')]);_0x3b89fb[_0xaed7('0x34')]=_[_0xaed7('0x35')](_0x40b936[_0xaed7('0x34')]);_0x3b89fb['filters']=_[_0xaed7('0x37')](_0x3b89fb['model'],_0x3b89fb[_0xaed7('0x34')]);_0x3d805e['attributes']=_[_0xaed7('0x37')](_0x3b89fb[_0xaed7('0x30')],qs['fields'](_0x40b936[_0xaed7('0x34')][_0xaed7('0x39')]));_0x3d805e['attributes']=_0x3d805e['attributes'][_0xaed7('0x3a')]?_0x3d805e[_0xaed7('0x38')]:_0x3b89fb[_0xaed7('0x30')];if(_0x40b936[_0xaed7('0x34')][_0xaed7('0x46')]){_0x3d805e[_0xaed7('0x47')]=[{'all':!![]}];}_0x3d805e=_['merge']({},_0x3d805e,_0x40b936['options']);return db[_0xaed7('0x2b')][_0xaed7('0x4d')](_0x3d805e)['then'](handleEntityNotFound(_0x47619e,null))[_0xaed7('0x25')](respondWithResult(_0x47619e,null))[_0xaed7('0x4a')](handleError(_0x47619e,null));};exports[_0xaed7('0x4e')]=function(_0xe861cc,_0x138a9a){return db[_0xaed7('0x2b')][_0xaed7('0x4e')](_0xe861cc[_0xaed7('0x4f')],{})[_0xaed7('0x25')](respondWithResult(_0x138a9a,0xc9))[_0xaed7('0x4a')](handleError(_0x138a9a,null));};exports[_0xaed7('0x50')]=function(_0x2dd40c,_0x15daa6){if(_0x2dd40c[_0xaed7('0x4f')]['id']){delete _0x2dd40c['body']['id'];}return db[_0xaed7('0x2b')][_0xaed7('0x4d')]({'where':{'id':_0x2dd40c[_0xaed7('0x4c')]['id']}})[_0xaed7('0x25')](handleEntityNotFound(_0x15daa6,null))['then'](saveUpdates(_0x2dd40c[_0xaed7('0x4f')],null))[_0xaed7('0x25')](respondWithResult(_0x15daa6,null))['catch'](handleError(_0x15daa6,null));};exports[_0xaed7('0x51')]=function(_0xf2a043,_0x278a75){return db[_0xaed7('0x2b')][_0xaed7('0x51')]()[_0xaed7('0x25')](respondWithResult(_0x278a75,null))[_0xaed7('0x4a')](handleError(_0x278a75,null));};exports['download']=function(_0x1c2c23,_0x363c3f,_0x37be4d){var _0x498ea0=require(_0xaed7('0x52'));var _0x11cc11=![];var _0x5c6ee8={};if(_0x1c2c23[_0xaed7('0x34')][_0xaed7('0x2e')]&&_0x1c2c23['query'][_0xaed7('0x2e')]===_0xaed7('0x53')){_0x5c6ee8[_0xaed7('0x53')]=_0x1c2c23[_0xaed7('0x4c')]['id'];}else{_0x5c6ee8['id']=_0x1c2c23['params']['id'];}return db[_0xaed7('0x2b')][_0xaed7('0x4d')]({'where':_0x5c6ee8,'attributes':['id',_0xaed7('0x54')],'raw':!![]})[_0xaed7('0x25')](handleEntityNotFound(_0x363c3f,null))['then'](function(_0x177fb4){if(_0x177fb4){var _0x191a19=_0x177fb4[_0xaed7('0x54')];var _0x204c7e=util[_0xaed7('0x33')](_0xaed7('0x55'),_0x191a19);if(fs['existsSync'](_0x204c7e)){_0x11cc11=!![];return _0x498ea0[_0xaed7('0x56')](_0x204c7e,_0x191a19,config[_0xaed7('0x57')]['recording'])[_0xaed7('0x25')](function(){return _0x177fb4;});}return _0x177fb4;}})[_0xaed7('0x25')](function(_0xc45b91){if(_0xc45b91){var _0x1cbc91=_0xc45b91[_0xaed7('0x54')];if(!fs[_0xaed7('0x58')](_0x1cbc91)){throw new db[(_0xaed7('0x59'))]['ValidationError'](_0xaed7('0x5a'));}if(_0xc45b91[_0xaed7('0x5b')]){return _0x363c3f[_0xaed7('0x5c')](_0x1cbc91,_0xc45b91['filename']+path[_0xaed7('0x5d')](_0x1cbc91),function(){if(_0x11cc11){fs[_0xaed7('0x5e')](_0x1cbc91);}});}else{return _0x363c3f[_0xaed7('0x5c')](_0x1cbc91,function(_0x58190b){if(_0x11cc11){fs[_0xaed7('0x5e')](_0x1cbc91);}});}}})['catch'](function(_0x480b80){if(_0x480b80[_0xaed7('0x5f')]===_0xaed7('0x5a')){_0x363c3f[_0xaed7('0x1f')](0x194)[_0xaed7('0x29')](_0xaed7('0x60'));}else{return handleError(_0x363c3f,null);}});};exports[_0xaed7('0x61')]=function(_0x44de87,_0x376f25,_0x26da3c){var _0x5b8c01=require(_0xaed7('0x52'));var _0xb4d863=![];var _0xc9cf1c={'$and':[db[_0xaed7('0x62')][_0xaed7('0x3f')](db[_0xaed7('0x62')]['fn'](_0xaed7('0x63'),db['sequelize'][_0xaed7('0x64')]('uniqueid')),_0x44de87['query'][_0xaed7('0x65')])]};if(_0x44de87[_0xaed7('0x34')][_0xaed7('0x2e')]&&_0x44de87[_0xaed7('0x34')][_0xaed7('0x2e')]===_0xaed7('0x53')){_0xc9cf1c[_0xaed7('0x66')]['push']({'uniqueid':_0x44de87['params']['id']});}else{_0xc9cf1c[_0xaed7('0x66')][_0xaed7('0x67')]({'id':_0x44de87[_0xaed7('0x4c')]['id']});}return db[_0xaed7('0x2b')][_0xaed7('0x4d')]({'where':_0xc9cf1c,'attributes':['id','value'],'raw':!![]})[_0xaed7('0x25')](handleEntityNotFound(_0x376f25,null))[_0xaed7('0x25')](function(_0x58ca02){if(_0x58ca02){var _0x50ab5d=util['format'](_0xaed7('0x55'),_0x58ca02['value']);if(fs['existsSync'](_0x50ab5d)){_0xb4d863=!![];return _0x5b8c01[_0xaed7('0x56')](_0x50ab5d,_0x58ca02[_0xaed7('0x54')],config[_0xaed7('0x57')][_0xaed7('0x68')])[_0xaed7('0x25')](function(){return _0x58ca02;});}return _0x58ca02;}})[_0xaed7('0x25')](function(_0x2cdb98){if(_0x2cdb98){if(!fs[_0xaed7('0x58')](_0x2cdb98[_0xaed7('0x54')])){throw new db[(_0xaed7('0x59'))]['ValidationError'](_0xaed7('0x5a'));}if(_0x2cdb98[_0xaed7('0x5b')]){return _0x376f25[_0xaed7('0x5c')](_0x2cdb98[_0xaed7('0x54')],_0x2cdb98['filename']+path[_0xaed7('0x5d')](_0x2cdb98[_0xaed7('0x54')]),function(){if(_0xb4d863){fs[_0xaed7('0x5e')](_0x2cdb98[_0xaed7('0x54')]);}});}else{return _0x376f25[_0xaed7('0x5c')](_0x2cdb98[_0xaed7('0x54')],function(_0x5d4b16){if(_0xb4d863){fs[_0xaed7('0x5e')](_0x2cdb98[_0xaed7('0x54')]);}});}}})[_0xaed7('0x4a')](handleError(_0x376f25,null));};exports[_0xaed7('0x26')]=function(_0x10bfbc,_0x525ec3){return db[_0xaed7('0x2b')][_0xaed7('0x4d')]({'where':{'id':_0x10bfbc[_0xaed7('0x4c')]['id']}})['then'](function(_0x4c7f93){if(_[_0xaed7('0x69')](_0x4c7f93)){throw new ReferenceError(_0xaed7('0x6a'));}return _0x4c7f93;})[_0xaed7('0x25')](function(_0x3f2089){var _0x38bfab=_0x3f2089[_0xaed7('0x54')];logger[_0xaed7('0x6b')](_0xaed7('0x6c'),_0x38bfab);if(!_[_0xaed7('0x69')](_0x3f2089[_0xaed7('0x54')])&&fs[_0xaed7('0x58')](_0x38bfab)){logger[_0xaed7('0x6b')](_0xaed7('0x6d')+_0x38bfab+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x38bfab);}_0x38bfab=_0x38bfab+_0xaed7('0x6e');if(!_[_0xaed7('0x69')](_0x3f2089[_0xaed7('0x54')])&&fs['existsSync'](_0x38bfab)){logger[_0xaed7('0x6b')](_0xaed7('0x6d')+_0x38bfab+_0xaed7('0x6f'));fs['unlinkSync'](_0x38bfab);}return _0x3f2089;})[_0xaed7('0x25')](function(_0x50d867){if(!_0x50d867)throw new InternalError();return _0x50d867[_0xaed7('0x26')]();})[_0xaed7('0x25')](function(){_0x525ec3[_0xaed7('0x1f')](0xcc)['end']();})[_0xaed7('0x4a')](handleError(_0x525ec3,null));};function getBucketslist(_0x1b3dfa,_0x3b523e,_0x2dd023){return new Promise(function(_0x59c34f,_0x200dcd){var _0x47f795=new AWS['S3']({'accessKeyId':_0x3b523e,'secretAccessKey':_0x1b3dfa,'region':_0x2dd023});_0x47f795[_0xaed7('0x70')]({},function(_0x226ece,_0x19fa3d){if(_0x226ece){return _0x200dcd(_0x226ece);}else{return _0x59c34f(_0x19fa3d);}});});}function createBucket(_0x458624,_0x3407e7,_0x2f213f,_0x1a9af6){return new Promise(function(_0x5ca6f,_0x412354){var _0x4a796c=new AWS['S3']({'accessKeyId':_0x3407e7,'secretAccessKey':_0x458624,'region':_0x2f213f});_0x4a796c['createBucket']({'Bucket':_0x1a9af6},function(_0xfe5663,_0x2ab369){if(_0xfe5663){return _0x412354(_0xfe5663);}else{return _0x5ca6f(_0x2ab369);}});});}function uploadFile(_0x41e5af,_0x32d05d,_0x1a00d4,_0x5609b2,_0x30a753,_0x128afb){return new Promise(function(_0x28fc3f,_0x3695e6){var _0x568b81=new AWS['S3']({'accessKeyId':_0x32d05d,'secretAccessKey':_0x41e5af,'region':_0x1a00d4});_0x568b81[_0xaed7('0x71')]({'Bucket':_0x5609b2,'Key':_0x30a753,'Body':_0x128afb},function(_0x262fde,_0x5c7a2f){if(_0x262fde){return _0x3695e6(_0x262fde);}else{return _0x28fc3f(_0x5c7a2f);}});});}function startTranscribe(_0x4d1d52,_0x4409c4,_0x3aa259,_0x2f4ed6,_0x7d3f0a,_0x160af9){return new Promise(function(_0x5996c8,_0x2f77e4){var _0x28351d=new AWS[(_0xaed7('0x72'))]({'accessKeyId':_0x4409c4,'secretAccessKey':_0x4d1d52,'region':_0x3aa259});_0x28351d[_0xaed7('0x73')]({'TranscriptionJobName':_0x2f4ed6,'LanguageCode':_0x7d3f0a,'Media':{'MediaFileUri':_0x160af9}},function(_0x4fc4db,_0x42ca47){if(_0x4fc4db){return _0x2f77e4(_0x4fc4db);}else{return _0x5996c8(_0x42ca47);}});});}function transcribe(_0x431f3e,_0x463ce0,_0x1f8d9a,_0x5a35aa,_0xbcf0e8,_0x3ce6b9,_0x4294a2){return new Promise(function(_0x5716a2,_0x48a3c2){var _0x188031={};logger[_0xaed7('0x6b')](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x431f3e,_0xbcf0e8));return uploadFile(_0x463ce0,_0x1f8d9a,_0x5a35aa,_0xbcf0e8,path['basename'](_0x3ce6b9),fs[_0xaed7('0x74')](_0x3ce6b9))[_0xaed7('0x25')](function(_0x494cc4){logger[_0xaed7('0x6b')](util[_0xaed7('0x33')](_0xaed7('0x75'),_0x431f3e,_0xbcf0e8,_0x494cc4['Location']));_0x188031[_0xaed7('0x76')]=_0x494cc4[_0xaed7('0x77')];_0x188031[_0xaed7('0x78')]=_0x494cc4['Location'];logger[_0xaed7('0x6b')](util['format']('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x431f3e));return startTranscribe(_0x463ce0,_0x1f8d9a,_0x5a35aa,uuidv4(),_0x4294a2,_0x494cc4[_0xaed7('0x79')]);})['then'](function(_0x5b6baf){logger[_0xaed7('0x6b')](util[_0xaed7('0x33')](_0xaed7('0x7a'),_0x431f3e,_0x5b6baf[_0xaed7('0x7b')][_0xaed7('0x7c')]));_0x188031[_0xaed7('0x7d')]=_0x5b6baf[_0xaed7('0x7b')][_0xaed7('0x7c')];_0x188031[_0xaed7('0x7e')]=_0x5b6baf['TranscriptionJob']['TranscriptionJobStatus'];return _0x5716a2(_0x188031);})[_0xaed7('0x4a')](function(_0x49143d){return _0x48a3c2(_0x49143d);});});}exports[_0xaed7('0x7f')]=function(_0x2b4d7a,_0x4ecc0b,_0x3aee9c){var _0x36f4c4;var _0x38db16;var _0x22ddc5;var _0x5512cd=require('../../components/encryptor');return db['VoiceRecording']['findOne']({'where':{'id':_0x2b4d7a[_0xaed7('0x4c')]['id']}})[_0xaed7('0x25')](function(_0x540a51){if(_0x540a51){var _0xf808e1=util['format'](_0xaed7('0x55'),_0x540a51[_0xaed7('0x54')]);if(fs[_0xaed7('0x58')](_0xf808e1)){cypher=!![];return _0x5512cd['decryptFile'](_0xf808e1,_0x540a51[_0xaed7('0x54')],config[_0xaed7('0x57')][_0xaed7('0x68')])[_0xaed7('0x25')](function(){return _0x540a51;});}return _0x540a51;}})['then'](function(_0x274c90){if(!_0x274c90){throw new db[(_0xaed7('0x59'))][(_0xaed7('0x80'))]('Voice\x20Recording\x20not\x20found');}_0x38db16=_0x274c90;return db[_0xaed7('0x81')][_0xaed7('0x82')]({'where':{'id':0x1}});})[_0xaed7('0x25')](handleEntityNotFound(_0x4ecc0b,null))[_0xaed7('0x25')](function(_0x1a7bc5){if(_0x1a7bc5){_0x36f4c4=_0x1a7bc5;if(!_0x36f4c4[_0xaed7('0x83')]||!_0x36f4c4['transcribeAccountId']||!_0x36f4c4[_0xaed7('0x84')]||!_0x36f4c4[_0xaed7('0x85')]||!_0x36f4c4['bucket']){throw new db['Sequelize'][(_0xaed7('0x80'))](_0xaed7('0x86'));}if(_0x2b4d7a[_0xaed7('0x4f')][_0xaed7('0x87')]&&(!_0x36f4c4['sentiment']||!_0x36f4c4['sentimentAccountId']||!_0x36f4c4[_0xaed7('0x88')]||!_0x36f4c4['language']||!_0x36f4c4[_0xaed7('0x76')])){throw new db[(_0xaed7('0x59'))]['ValidationError'](_0xaed7('0x89'));}return db[_0xaed7('0x8a')][_0xaed7('0x82')]({'where':{'id':_0x36f4c4[_0xaed7('0x8b')]}});}})[_0xaed7('0x25')](function(_0x1d5e9a){if(!_0x1d5e9a){throw new db[(_0xaed7('0x59'))]['ValidationError'](_0xaed7('0x8c'));}if(!_0x1d5e9a[_0xaed7('0x8d')]||!_0x1d5e9a[_0xaed7('0x8e')]){throw new db[(_0xaed7('0x59'))][(_0xaed7('0x80'))]('Cloud\x20Provider\x20not\x20configured');}_0x22ddc5=_0x1d5e9a;return getBucketslist(_0x22ddc5[_0xaed7('0x8d')],_0x22ddc5[_0xaed7('0x8e')],_0x36f4c4[_0xaed7('0x84')]);})['then'](function(_0x329c16){if(_0x329c16&&_0x329c16[_0xaed7('0x8f')]){var _0x15a8e5=_[_0xaed7('0x4d')](_0x329c16[_0xaed7('0x8f')],function(_0x6b65d9){return _0x6b65d9[_0xaed7('0x90')]===_0x36f4c4[_0xaed7('0x76')];});if(!_0x15a8e5){logger[_0xaed7('0x6b')](util[_0xaed7('0x33')](_0xaed7('0x91'),_0x2b4d7a[_0xaed7('0x4c')]['id'],_0x36f4c4[_0xaed7('0x76')]));return createBucket(_0x22ddc5[_0xaed7('0x8d')],_0x22ddc5[_0xaed7('0x8e')],_0x36f4c4[_0xaed7('0x84')],_0x36f4c4[_0xaed7('0x76')]);}logger[_0xaed7('0x6b')](util[_0xaed7('0x33')](_0xaed7('0x92'),_0x2b4d7a['params']['id'],_0x36f4c4['bucket']));return;}})[_0xaed7('0x25')](function(_0x46a4cf){if(_0x38db16[_0xaed7('0x7e')]===_0xaed7('0x93')){return transcribe(_0x2b4d7a[_0xaed7('0x4c')]['id'],_0x22ddc5[_0xaed7('0x8d')],_0x22ddc5[_0xaed7('0x8e')],_0x36f4c4['transcribeRegion'],_0x36f4c4[_0xaed7('0x76')],_0x38db16['value'],_0x36f4c4[_0xaed7('0x85')]);}else{logger['info'](util[_0xaed7('0x33')](_0xaed7('0x94'),_0x2b4d7a[_0xaed7('0x4c')]['id']));return{'transcribeStatus':_0xaed7('0x95')};}})[_0xaed7('0x25')](function(_0x32661b){if(_0x32661b){_0x32661b[_0xaed7('0x96')]=_0x2b4d7a['body'][_0xaed7('0x87')];return _0x38db16[_0xaed7('0x97')](_0x32661b);}})[_0xaed7('0x25')](respondWithResult(_0x4ecc0b,null))[_0xaed7('0x4a')](handleError(_0x4ecc0b,null));};function writeFile(_0xd9941b,_0x578ebd){return new Promise(function(_0x1a2d03,_0x365fa7){fs[_0xaed7('0x98')](_0x578ebd,_0xd9941b,function(_0x713ebb,_0x3a3788){if(_0x713ebb){return _0x365fa7(_0x713ebb);}else{return _0x1a2d03(_0x3a3788);}});});}exports['downloadTranscribe']=function(_0x4615de,_0x526fa3,_0x25ae95){return db['VoiceRecording'][_0xaed7('0x82')]({'where':{'id':_0x4615de['params']['id']}})[_0xaed7('0x25')](handleEntityNotFound(_0x526fa3))['then'](function(_0x184da2){if(_0x184da2&&_0x184da2[_0xaed7('0x99')]){var _0x1fc15c=_0x184da2['fileText'];var _0x290705=config[_0xaed7('0x9a')]+'/server/files/transcribes/transcribe_'+_0x184da2['id']+'.txt';if(fs[_0xaed7('0x58')](_0x290705)){return _0x290705;}return writeFile(_0x1fc15c,_0x290705)['then'](function(){return _0x290705;});}else{throw new db[(_0xaed7('0x59'))][(_0xaed7('0x80'))](_0xaed7('0x9b'));}})['then'](function(_0x55085b){return _0x526fa3[_0xaed7('0x5c')](_0x55085b);})[_0xaed7('0x4a')](handleError(_0x526fa3));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index ac8c365..c230ee0 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 _0xa269=['path','rimraf','../../config/environment','./voiceRecording.attributes','voice_recordings','lodash','util','moment','bluebird','request-promise'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xa269,0x1ef));var _0x9a26=function(_0x3efbfe,_0x1086b9){_0x3efbfe=_0x3efbfe-0x0;var _0x5647b8=_0xa269[_0x3efbfe];return _0x5647b8;};'use strict';var _=require(_0x9a26('0x0'));var util=require(_0x9a26('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9a26('0x2'));var BPromise=require(_0x9a26('0x3'));var rp=require(_0x9a26('0x4'));var fs=require('fs');var path=require(_0x9a26('0x5'));var rimraf=require(_0x9a26('0x6'));var config=require(_0x9a26('0x7'));var attributes=require(_0x9a26('0x8'));module['exports']=function(_0x3e434c,_0x2ca33d){return _0x3e434c['define']('VoiceRecording',attributes,{'tableName':_0x9a26('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7b1f=['define','VoiceRecording','uniqueid','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports'];(function(_0x44e800,_0x35a701){var _0x297773=function(_0x258ad5){while(--_0x258ad5){_0x44e800['push'](_0x44e800['shift']());}};_0x297773(++_0x35a701);}(_0x7b1f,0x13b));var _0xf7b1=function(_0xd89cec,_0x4e3c06){_0xd89cec=_0xd89cec-0x0;var _0x2d5bb3=_0x7b1f[_0xd89cec];return _0x2d5bb3;};'use strict';var _=require(_0xf7b1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf7b1('0x1'));var moment=require(_0xf7b1('0x2'));var BPromise=require(_0xf7b1('0x3'));var rp=require(_0xf7b1('0x4'));var fs=require('fs');var path=require(_0xf7b1('0x5'));var rimraf=require(_0xf7b1('0x6'));var config=require(_0xf7b1('0x7'));var attributes=require(_0xf7b1('0x8'));module[_0xf7b1('0x9')]=function(_0x117c8c,_0x41ff7f){return _0x117c8c[_0xf7b1('0xa')](_0xf7b1('0xb'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xf7b1('0xc'),'fields':[_0xf7b1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 3592c6a..bf201d0 100644 --- a/server/api/voiceRecording/voiceRecording.rpc.js +++ b/server/api/voiceRecording/voiceRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d04=['result','VoiceRecording','body','options','raw','where','attributes','limit','UpdateVoiceRecording','debug','catch','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','format','%s.cypher','value','encryptFile','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','stringify','error','VoiceRecording,\x20%s,\x20%s','message','info'];(function(_0x5f1cf8,_0x5e0923){var _0x27d0fa=function(_0x3f1171){while(--_0x3f1171){_0x5f1cf8['push'](_0x5f1cf8['shift']());}};_0x27d0fa(++_0x5e0923);}(_0x3d04,0xbe));var _0x43d0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3d04[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var moment=require(_0x43d0('0x2'));var BPromise=require(_0x43d0('0x3'));var rs=require(_0x43d0('0x4'));var fs=require('fs');var Redis=require(_0x43d0('0x5'));var db=require(_0x43d0('0x6'))['db'];var utils=require(_0x43d0('0x7'));var logger=require('../../config/logger')(_0x43d0('0x8'));var config=require(_0x43d0('0x9'));var jayson=require(_0x43d0('0xa'));var client=jayson[_0x43d0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x484271,_0x50919e,_0x5efb95){return new BPromise(function(_0x457550,_0x3344d3){return client[_0x43d0('0xc')](_0x484271,_0x5efb95)[_0x43d0('0xd')](function(_0x44a763){logger['info']('VoiceRecording,\x20%s,\x20%s',_0x50919e,_0x43d0('0xe'));logger['debug']('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x50919e,_0x43d0('0xe'),JSON[_0x43d0('0xf')](_0x44a763));if(_0x44a763[_0x43d0('0x10')]){if(_0x44a763[_0x43d0('0x10')]['code']===0x1f4){logger[_0x43d0('0x10')](_0x43d0('0x11'),_0x50919e,_0x44a763['error'][_0x43d0('0x12')]);return _0x3344d3(_0x44a763[_0x43d0('0x10')][_0x43d0('0x12')]);}logger['error'](_0x43d0('0x11'),_0x50919e,_0x44a763[_0x43d0('0x10')][_0x43d0('0x12')]);return _0x457550(_0x44a763['error'][_0x43d0('0x12')]);}else{logger[_0x43d0('0x13')](_0x43d0('0x11'),_0x50919e,_0x43d0('0xe'));_0x457550(_0x44a763[_0x43d0('0x14')]['message']);}})['catch'](function(_0x1e91a7){logger[_0x43d0('0x10')](_0x43d0('0x11'),_0x50919e,_0x1e91a7);_0x3344d3(_0x1e91a7);});});}exports['UpdateVoiceRecording']=function(_0x2c641e){var _0x532402=this;return new Promise(function(_0x2c9d06,_0x468ca2){return db[_0x43d0('0x15')]['update'](_0x2c641e[_0x43d0('0x16')],{'raw':_0x2c641e[_0x43d0('0x17')]?_0x2c641e['options'][_0x43d0('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c641e[_0x43d0('0x17')]?_0x2c641e[_0x43d0('0x17')][_0x43d0('0x19')]||null:null,'attributes':_0x2c641e[_0x43d0('0x17')]?_0x2c641e[_0x43d0('0x17')][_0x43d0('0x1a')]||null:null,'limit':_0x2c641e[_0x43d0('0x17')]?_0x2c641e[_0x43d0('0x17')][_0x43d0('0x1b')]||null:null})[_0x43d0('0xd')](function(_0x19d2ff){logger[_0x43d0('0x13')](_0x43d0('0x1c'),_0x2c641e);logger[_0x43d0('0x1d')]('UpdateVoiceRecording',_0x2c641e,JSON[_0x43d0('0xf')](_0x19d2ff));_0x2c9d06(_0x19d2ff);})[_0x43d0('0x1e')](function(_0x509041){logger[_0x43d0('0x10')]('UpdateVoiceRecording',_0x509041[_0x43d0('0x12')],_0x2c641e);_0x468ca2(_0x532402[_0x43d0('0x10')](0x1f4,_0x509041['message']));});});};exports[_0x43d0('0x1f')]=function(_0x238c64){var _0x5ac4c0=this;return new Promise(function(_0x12df30,_0x4692bc){var _0x22ae3c=require('../../components/encryptor');var _0x447725;return db[_0x43d0('0x20')][_0x43d0('0x21')]({'attributes':['id',_0x43d0('0x22')],'where':{'id':0x1},'raw':!![]})[_0x43d0('0xd')](function(_0x440ecb){_0x447725=_0x440ecb;return db[_0x43d0('0x15')]['create'](_0x238c64[_0x43d0('0x16')]);})[_0x43d0('0xd')](function(_0x6bc471){if(_0x447725['callRecordingEncryption']&&fs['existsSync'](_0x6bc471['value'])){var _0x3c1ea3=util[_0x43d0('0x23')](_0x43d0('0x24'),_0x6bc471[_0x43d0('0x25')]);return _0x22ae3c[_0x43d0('0x26')](_0x6bc471[_0x43d0('0x25')],_0x3c1ea3,config['secrets'][_0x43d0('0x27')])[_0x43d0('0xd')](function(){fs[_0x43d0('0x28')](_0x6bc471[_0x43d0('0x25')]);logger[_0x43d0('0x13')](_0x43d0('0x29'));return _0x6bc471;});}return _0x6bc471;})[_0x43d0('0xd')](function(_0x1bdd74){logger[_0x43d0('0x13')](_0x43d0('0x1f'),_0x238c64);logger[_0x43d0('0x1d')]('CreateVoiceRecording',_0x238c64,JSON[_0x43d0('0xf')](_0x1bdd74));_0x12df30(_0x1bdd74);})[_0x43d0('0x1e')](function(_0x45ec78){logger[_0x43d0('0x10')]('CreateVoiceRecording',_0x45ec78[_0x43d0('0x12')],_0x238c64);_0x4692bc(_0x5ac4c0['error'](0x1f4,_0x45ec78[_0x43d0('0x12')]));});});}; \ No newline at end of file +var _0x8f4c=['../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','CreateVoiceRecording'];(function(_0x4e4f88,_0x2be77c){var _0x51ec61=function(_0x5f4076){while(--_0x5f4076){_0x4e4f88['push'](_0x4e4f88['shift']());}};_0x51ec61(++_0x2be77c);}(_0x8f4c,0x113));var _0xc8f4=function(_0x100f05,_0x2de0fa){_0x100f05=_0x100f05-0x0;var _0x2bcde1=_0x8f4c[_0x100f05];return _0x2bcde1;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var moment=require(_0xc8f4('0x2'));var BPromise=require(_0xc8f4('0x3'));var rs=require(_0xc8f4('0x4'));var fs=require('fs');var Redis=require(_0xc8f4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8f4('0x6'));var logger=require(_0xc8f4('0x7'))(_0xc8f4('0x8'));var config=require('../../config/environment');var jayson=require(_0xc8f4('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x520063,_0x373506,_0x48c39d){return new BPromise(function(_0x3ea9a2,_0x3a9ab1){return client[_0xc8f4('0xa')](_0x520063,_0x48c39d)[_0xc8f4('0xb')](function(_0x34f05f){logger['info'](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));logger[_0xc8f4('0xe')](_0xc8f4('0xf'),_0x373506,'request\x20sent',JSON[_0xc8f4('0x10')](_0x34f05f));if(_0x34f05f['error']){if(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x12')]===0x1f4){logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')]['message']);return _0x3a9ab1(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);}logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);return _0x3ea9a2(_0x34f05f['error'][_0xc8f4('0x13')]);}else{logger[_0xc8f4('0x14')](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));_0x3ea9a2(_0x34f05f[_0xc8f4('0x15')]['message']);}})[_0xc8f4('0x16')](function(_0x4d2b77){logger['error'](_0xc8f4('0xc'),_0x373506,_0x4d2b77);_0x3a9ab1(_0x4d2b77);});});}exports[_0xc8f4('0x17')]=function(_0x108076){var _0x7bb973=this;return new Promise(function(_0x4763c1,_0x374761){return db[_0xc8f4('0x18')][_0xc8f4('0x19')](_0x108076[_0xc8f4('0x1a')],{'raw':_0x108076[_0xc8f4('0x1b')]?_0x108076[_0xc8f4('0x1b')][_0xc8f4('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x108076[_0xc8f4('0x1b')]?_0x108076['options'][_0xc8f4('0x1d')]||null:null,'attributes':_0x108076[_0xc8f4('0x1b')]?_0x108076[_0xc8f4('0x1b')][_0xc8f4('0x1e')]||null:null,'limit':_0x108076[_0xc8f4('0x1b')]?_0x108076[_0xc8f4('0x1b')][_0xc8f4('0x1f')]||null:null})[_0xc8f4('0xb')](function(_0x5e62aa){logger[_0xc8f4('0x14')](_0xc8f4('0x17'),_0x108076);logger[_0xc8f4('0xe')](_0xc8f4('0x17'),_0x108076,JSON['stringify'](_0x5e62aa));_0x4763c1(_0x5e62aa);})[_0xc8f4('0x16')](function(_0x4a44e0){logger[_0xc8f4('0x11')]('UpdateVoiceRecording',_0x4a44e0[_0xc8f4('0x13')],_0x108076);_0x374761(_0x7bb973[_0xc8f4('0x11')](0x1f4,_0x4a44e0['message']));});});};exports[_0xc8f4('0x20')]=function(_0x21062f){var _0x11f766=this;return new Promise(function(_0x2fa052,_0x4ce586){var _0x3db490=require(_0xc8f4('0x21'));var _0x5db666;return db[_0xc8f4('0x22')][_0xc8f4('0x23')]({'attributes':['id',_0xc8f4('0x24')],'where':{'id':0x1},'raw':!![]})[_0xc8f4('0xb')](function(_0x24bef0){_0x5db666=_0x24bef0;return db[_0xc8f4('0x18')]['create'](_0x21062f[_0xc8f4('0x1a')]);})[_0xc8f4('0xb')](function(_0x1ea3d9){if(_0x5db666['callRecordingEncryption']&&fs[_0xc8f4('0x25')](_0x1ea3d9[_0xc8f4('0x26')])){var _0x5ab6cb=util['format']('%s.cypher',_0x1ea3d9[_0xc8f4('0x26')]);return _0x3db490[_0xc8f4('0x27')](_0x1ea3d9[_0xc8f4('0x26')],_0x5ab6cb,config[_0xc8f4('0x28')][_0xc8f4('0x29')])[_0xc8f4('0xb')](function(){fs[_0xc8f4('0x2a')](_0x1ea3d9[_0xc8f4('0x26')]);logger['info'](_0xc8f4('0x2b'));return _0x1ea3d9;});}return _0x1ea3d9;})[_0xc8f4('0xb')](function(_0x3910f3){logger['info'](_0xc8f4('0x20'),_0x21062f);logger[_0xc8f4('0xe')]('CreateVoiceRecording',_0x21062f,JSON[_0xc8f4('0x10')](_0x3910f3));_0x2fa052(_0x3910f3);})[_0xc8f4('0x16')](function(_0x36f24f){logger['error'](_0xc8f4('0x20'),_0x36f24f[_0xc8f4('0x13')],_0x21062f);_0x4ce586(_0x11f766[_0xc8f4('0x11')](0x1f4,_0x36f24f['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index d814a3a..8683102 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 _0x7f8a=['/:id','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','index','get','isAuthenticated','show','post','create','put','update','delete'];(function(_0x2e4b84,_0x19ad5a){var _0x3a0444=function(_0x2a86db){while(--_0x2a86db){_0x2e4b84['push'](_0x2e4b84['shift']());}};_0x3a0444(++_0x19ad5a);}(_0x7f8a,0x192));var _0xa7f8=function(_0x1c3e69,_0x57c7bd){_0x1c3e69=_0x1c3e69-0x0;var _0x5080a6=_0x7f8a[_0x1c3e69];return _0x5080a6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa7f8('0x0'));var timeout=require(_0xa7f8('0x1'));var express=require(_0xa7f8('0x2'));var router=express[_0xa7f8('0x3')]();var fs_extra=require(_0xa7f8('0x4'));var auth=require(_0xa7f8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa7f8('0x6'));var controller=require('./voiceTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xa7f8('0x7')]);router[_0xa7f8('0x8')]('/describe',auth[_0xa7f8('0x9')](),controller['describe']);router[_0xa7f8('0x8')]('/:id',auth[_0xa7f8('0x9')](),controller[_0xa7f8('0xa')]);router[_0xa7f8('0xb')]('/',auth[_0xa7f8('0x9')](),controller[_0xa7f8('0xc')]);router[_0xa7f8('0xd')]('/:id',auth[_0xa7f8('0x9')](),controller[_0xa7f8('0xe')]);router[_0xa7f8('0xf')](_0xa7f8('0x10'),auth[_0xa7f8('0x9')](),controller[_0xa7f8('0x11')]);module[_0xa7f8('0x12')]=router; \ No newline at end of file +var _0x8ec6=['../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','Router','fs-extra'];(function(_0x91d019,_0x5223c4){var _0x19de1f=function(_0x3e1311){while(--_0x3e1311){_0x91d019['push'](_0x91d019['shift']());}};_0x19de1f(++_0x5223c4);}(_0x8ec6,0x1b8));var _0x68ec=function(_0x4d8362,_0x3aaad4){_0x4d8362=_0x4d8362-0x0;var _0x6926fc=_0x8ec6[_0x4d8362];return _0x6926fc;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x68ec('0x0')]();var fs_extra=require(_0x68ec('0x1'));var auth=require(_0x68ec('0x2'));var interaction=require(_0x68ec('0x3'));var config=require('../../config/environment');var controller=require(_0x68ec('0x4'));router[_0x68ec('0x5')]('/',auth[_0x68ec('0x6')](),controller[_0x68ec('0x7')]);router['get'](_0x68ec('0x8'),auth[_0x68ec('0x6')](),controller[_0x68ec('0x9')]);router[_0x68ec('0x5')](_0x68ec('0xa'),auth[_0x68ec('0x6')](),controller[_0x68ec('0xb')]);router[_0x68ec('0xc')]('/',auth[_0x68ec('0x6')](),controller[_0x68ec('0xd')]);router[_0x68ec('0xe')](_0x68ec('0xa'),auth[_0x68ec('0x6')](),controller['update']);router[_0x68ec('0xf')](_0x68ec('0xa'),auth['isAuthenticated'](),controller[_0x68ec('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 27da5e4..b72e6c9 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 _0x8f7f=['STRING','Yes','sequelize','moment','exports','ENUM','attended'];(function(_0x4422b2,_0x20f99b){var _0x4edd02=function(_0x5d322e){while(--_0x5d322e){_0x4422b2['push'](_0x4422b2['shift']());}};_0x4edd02(++_0x20f99b);}(_0x8f7f,0xb1));var _0xf8f7=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x8f7f[_0xda464c];return _0x19e222;};'use strict';var Sequelize=require(_0xf8f7('0x0'));var moment=require(_0xf8f7('0x1'));module[_0xf8f7('0x2')]={'type':{'type':Sequelize[_0xf8f7('0x3')]('blind',_0xf8f7('0x4'))},'result':{'type':Sequelize[_0xf8f7('0x5')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0xf8f7('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xf8f7('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xf8f7('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xf8f7('0x5')]},'transfereechannel':{'type':Sequelize[_0xf8f7('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xf8f7('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xf8f7('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xf8f7('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xf8f7('0x5')]},'transfereecontext':{'type':Sequelize[_0xf8f7('0x5')]},'transfereeexten':{'type':Sequelize[_0xf8f7('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xf8f7('0x5')]},'isexternal':{'type':Sequelize[_0xf8f7('0x3')](_0xf8f7('0x6'),'No')},'context':{'type':Sequelize[_0xf8f7('0x5')]},'extension':{'type':Sequelize[_0xf8f7('0x5')]}}; \ No newline at end of file +var _0x259b=['exports','ENUM','STRING','Yes','sequelize','moment'];(function(_0x28ec1b,_0x5412ea){var _0x1ae01c=function(_0x2697c5){while(--_0x2697c5){_0x28ec1b['push'](_0x28ec1b['shift']());}};_0x1ae01c(++_0x5412ea);}(_0x259b,0x1e4));var _0xb259=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x259b[_0xe66cf2];return _0x2d84e7;};'use strict';var Sequelize=require(_0xb259('0x0'));var moment=require(_0xb259('0x1'));module[_0xb259('0x2')]={'type':{'type':Sequelize[_0xb259('0x3')]('blind','attended')},'result':{'type':Sequelize[_0xb259('0x4')]},'transfererchannel':{'type':Sequelize[_0xb259('0x4')]},'transferercalleridnum':{'type':Sequelize[_0xb259('0x4')]},'transferercalleridname':{'type':Sequelize[_0xb259('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0xb259('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xb259('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xb259('0x4')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xb259('0x4')]},'transfererlinkedid':{'type':Sequelize[_0xb259('0x4')]},'transfereechannel':{'type':Sequelize[_0xb259('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xb259('0x4')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xb259('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0xb259('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0xb259('0x4')]},'transfereecontext':{'type':Sequelize[_0xb259('0x4')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xb259('0x4')]},'isexternal':{'type':Sequelize[_0xb259('0x3')](_0xb259('0x5'),'No')},'context':{'type':Sequelize[_0xb259('0x4')]},'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 3a0cd31..cbc2e0b 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 _0x140f=['body','destroy','describe','eml-format','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','then','error','name','send','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','VoiceTransferReport','includeAll','include','catch','show','params','merge','find'];(function(_0x386af4,_0x504421){var _0x1a5f2b=function(_0x544964){while(--_0x544964){_0x386af4['push'](_0x386af4['shift']());}};_0x1a5f2b(++_0x504421);}(_0x140f,0x89));var _0xf140=function(_0x5e9876,_0x16052d){_0x5e9876=_0x5e9876-0x0;var _0x576c48=_0x140f[_0x5e9876];return _0x576c48;};'use strict';var emlformat=require(_0xf140('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf140('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf140('0x2'));var BPromise=require(_0xf140('0x3'));var Mustache=require(_0xf140('0x4'));var util=require(_0xf140('0x5'));var path=require(_0xf140('0x6'));var sox=require('sox');var csv=require(_0xf140('0x7'));var ejs=require(_0xf140('0x8'));var fs=require('fs');var fs_extra=require(_0xf140('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf140('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf140('0xb'));var Papa=require(_0xf140('0xc'));var Redis=require(_0xf140('0xd'));var authService=require(_0xf140('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xf140('0xf'));var hardwareService=require(_0xf140('0x10'));var logger=require(_0xf140('0x11'))(_0xf140('0x12'));var utils=require(_0xf140('0x13'));var config=require(_0xf140('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf140('0x15'))['db'];function respondWithStatusCode(_0xcb25fd,_0x5b37d5){_0x5b37d5=_0x5b37d5||0xcc;return function(_0x199013){if(_0x199013){return _0xcb25fd[_0xf140('0x16')](_0x5b37d5);}return _0xcb25fd[_0xf140('0x17')](_0x5b37d5)[_0xf140('0x18')]();};}function respondWithResult(_0x76a8cf,_0x36ba4a){_0x36ba4a=_0x36ba4a||0xc8;return function(_0x6e4d3b){if(_0x6e4d3b){return _0x76a8cf[_0xf140('0x17')](_0x36ba4a)['json'](_0x6e4d3b);}};}function respondWithFilteredResult(_0x505233,_0xdac89f){return function(_0x2a7522){if(_0x2a7522){var _0xa539a5=typeof _0xdac89f[_0xf140('0x19')]===_0xf140('0x1a')&&typeof _0xdac89f[_0xf140('0x1b')]==='undefined';var _0x2be8a3=_0x2a7522[_0xf140('0x1c')];var _0xacd0b6=_0xa539a5?0x0:_0xdac89f[_0xf140('0x19')];var _0x295b7e=_0xa539a5?_0x2a7522['count']:_0xdac89f['offset']+_0xdac89f[_0xf140('0x1b')];var _0x27c069;if(_0x295b7e>=_0x2be8a3){_0x295b7e=_0x2be8a3;_0x27c069=0xc8;}else{_0x27c069=0xce;}_0x505233[_0xf140('0x17')](_0x27c069);return _0x505233[_0xf140('0x1d')](_0xf140('0x1e'),_0xacd0b6+'-'+_0x295b7e+'/'+_0x2be8a3)['json'](_0x2a7522);}return null;};}function patchUpdates(_0x468dfb){return function(_0x54e131){try{jsonpatch['apply'](_0x54e131,_0x468dfb,!![]);}catch(_0x367121){return BPromise[_0xf140('0x1f')](_0x367121);}return _0x54e131['save']();};}function saveUpdates(_0x2dde2b,_0x1a1ff4){return function(_0xaac3a2){if(_0xaac3a2){return _0xaac3a2['update'](_0x2dde2b)[_0xf140('0x20')](function(_0x300db3){return _0x300db3;});}return null;};}function removeEntity(_0x9131f3,_0x203f9e){return function(_0x493b4a){if(_0x493b4a){return _0x493b4a['destroy']()[_0xf140('0x20')](function(){_0x9131f3[_0xf140('0x17')](0xcc)[_0xf140('0x18')]();});}};}function handleEntityNotFound(_0x10b407,_0x38797e){return function(_0x520afb){if(!_0x520afb){_0x10b407[_0xf140('0x16')](0x194);}return _0x520afb;};}function handleError(_0x11b07e,_0x4a2dd1){_0x4a2dd1=_0x4a2dd1||0x1f4;return function(_0x4a4451){logger[_0xf140('0x21')](_0x4a4451['stack']);if(_0x4a4451[_0xf140('0x22')]){delete _0x4a4451[_0xf140('0x22')];}_0x11b07e[_0xf140('0x17')](_0x4a2dd1)[_0xf140('0x23')](_0x4a4451);};}exports['index']=function(_0xbad27d,_0x4d4ed1){var _0xd829a={},_0x5eb617={},_0x565814={'count':0x0,'rows':[]};var _0x488da8=_['map'](db['VoiceTransferReport'][_0xf140('0x24')],function(_0x18cbde){return{'name':_0x18cbde['fieldName'],'type':_0x18cbde[_0xf140('0x25')][_0xf140('0x26')]};});_0x5eb617[_0xf140('0x27')]=_[_0xf140('0x28')](_0x488da8,_0xf140('0x22'));_0x5eb617[_0xf140('0x29')]=_[_0xf140('0x2a')](_0xbad27d[_0xf140('0x29')]);_0x5eb617[_0xf140('0x2b')]=_['intersection'](_0x5eb617[_0xf140('0x27')],_0x5eb617[_0xf140('0x29')]);_0xd829a[_0xf140('0x2c')]=_[_0xf140('0x2d')](_0x5eb617['model'],qs[_0xf140('0x2e')](_0xbad27d[_0xf140('0x29')][_0xf140('0x2e')]));_0xd829a['attributes']=_0xd829a['attributes'][_0xf140('0x2f')]?_0xd829a[_0xf140('0x2c')]:_0x5eb617[_0xf140('0x27')];if(!_0xbad27d['query'][_0xf140('0x30')]('nolimit')){_0xd829a[_0xf140('0x1b')]=qs[_0xf140('0x1b')](_0xbad27d[_0xf140('0x29')][_0xf140('0x1b')]);_0xd829a[_0xf140('0x19')]=qs[_0xf140('0x19')](_0xbad27d['query'][_0xf140('0x19')]);}_0xd829a[_0xf140('0x31')]=qs[_0xf140('0x32')](_0xbad27d[_0xf140('0x29')]['sort']);_0xd829a['where']=qs[_0xf140('0x2b')](_[_0xf140('0x33')](_0xbad27d[_0xf140('0x29')],_0x5eb617[_0xf140('0x2b')]),_0x488da8);if(_0xbad27d[_0xf140('0x29')][_0xf140('0x34')]){_0xd829a['where']=_['merge'](_0xd829a[_0xf140('0x35')],{'$or':_['map'](_0x488da8,function(_0x5e7840){if(_0x5e7840[_0xf140('0x25')]!==_0xf140('0x36')){var _0x24f6b1={};_0x24f6b1[_0x5e7840[_0xf140('0x22')]]={'$like':'%'+_0xbad27d[_0xf140('0x29')]['filter']+'%'};return _0x24f6b1;}})});}_0xd829a=_['merge']({},_0xd829a,_0xbad27d[_0xf140('0x37')]);var _0x44f8c6={'where':_0xd829a[_0xf140('0x35')]};return db[_0xf140('0x38')]['count'](_0x44f8c6)[_0xf140('0x20')](function(_0x2ee7ab){_0x565814[_0xf140('0x1c')]=_0x2ee7ab;if(_0xbad27d[_0xf140('0x29')][_0xf140('0x39')]){_0xd829a[_0xf140('0x3a')]=[{'all':!![]}];}return db['VoiceTransferReport']['findAll'](_0xd829a);})['then'](function(_0x3aac00){_0x565814['rows']=_0x3aac00;return _0x565814;})['then'](respondWithFilteredResult(_0x4d4ed1,_0xd829a))[_0xf140('0x3b')](handleError(_0x4d4ed1,null));};exports[_0xf140('0x3c')]=function(_0x1592f3,_0xac84f1){var _0x57bbd9={'raw':!![],'where':{'id':_0x1592f3[_0xf140('0x3d')]['id']}},_0x56db43={};_0x56db43[_0xf140('0x27')]=_[_0xf140('0x2a')](db[_0xf140('0x38')][_0xf140('0x24')]);_0x56db43[_0xf140('0x29')]=_['keys'](_0x1592f3['query']);_0x56db43[_0xf140('0x2b')]=_[_0xf140('0x2d')](_0x56db43[_0xf140('0x27')],_0x56db43[_0xf140('0x29')]);_0x57bbd9[_0xf140('0x2c')]=_[_0xf140('0x2d')](_0x56db43[_0xf140('0x27')],qs[_0xf140('0x2e')](_0x1592f3[_0xf140('0x29')][_0xf140('0x2e')]));_0x57bbd9[_0xf140('0x2c')]=_0x57bbd9[_0xf140('0x2c')][_0xf140('0x2f')]?_0x57bbd9[_0xf140('0x2c')]:_0x56db43[_0xf140('0x27')];if(_0x1592f3['query']['includeAll']){_0x57bbd9[_0xf140('0x3a')]=[{'all':!![]}];}_0x57bbd9=_[_0xf140('0x3e')]({},_0x57bbd9,_0x1592f3[_0xf140('0x37')]);return db['VoiceTransferReport'][_0xf140('0x3f')](_0x57bbd9)[_0xf140('0x20')](handleEntityNotFound(_0xac84f1,null))['then'](respondWithResult(_0xac84f1,null))['catch'](handleError(_0xac84f1,null));};exports['create']=function(_0xff4d12,_0x350599){return db['VoiceTransferReport']['create'](_0xff4d12['body'],{})[_0xf140('0x20')](respondWithResult(_0x350599,0xc9))[_0xf140('0x3b')](handleError(_0x350599,null));};exports['update']=function(_0x33afcd,_0x814872){if(_0x33afcd['body']['id']){delete _0x33afcd[_0xf140('0x40')]['id'];}return db['VoiceTransferReport'][_0xf140('0x3f')]({'where':{'id':_0x33afcd['params']['id']}})[_0xf140('0x20')](handleEntityNotFound(_0x814872,null))['then'](saveUpdates(_0x33afcd[_0xf140('0x40')],null))[_0xf140('0x20')](respondWithResult(_0x814872,null))[_0xf140('0x3b')](handleError(_0x814872,null));};exports[_0xf140('0x41')]=function(_0x2025ce,_0x2995a4){return db[_0xf140('0x38')]['find']({'where':{'id':_0x2025ce[_0xf140('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2995a4,null))['then'](removeEntity(_0x2995a4,null))[_0xf140('0x3b')](handleError(_0x2995a4,null));};exports[_0xf140('0x42')]=function(_0xee026c,_0xeddfb2){return db[_0xf140('0x38')]['describe']()[_0xf140('0x20')](respondWithResult(_0xeddfb2,null))[_0xf140('0x3b')](handleError(_0xeddfb2,null));}; \ No newline at end of file +var _0xcec6=['destroy','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','then','include','rows','show','params','keys','includeAll','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update'];(function(_0x1c99c6,_0x1479e7){var _0x34ae7d=function(_0x5f33fa){while(--_0x5f33fa){_0x1c99c6['push'](_0x1c99c6['shift']());}};_0x34ae7d(++_0x1479e7);}(_0xcec6,0xff));var _0x6cec=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcec6[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x6cec('0x0'));var rimraf=require(_0x6cec('0x1'));var zipdir=require(_0x6cec('0x2'));var jsonpatch=require(_0x6cec('0x3'));var rp=require(_0x6cec('0x4'));var moment=require(_0x6cec('0x5'));var BPromise=require(_0x6cec('0x6'));var Mustache=require('mustache');var util=require(_0x6cec('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6cec('0x8'));var fs=require('fs');var fs_extra=require(_0x6cec('0x9'));var _=require('lodash');var squel=require(_0x6cec('0xa'));var crypto=require('crypto');var jsforce=require(_0x6cec('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6cec('0xc'));var Papa=require(_0x6cec('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6cec('0xe'));var hardwareService=require(_0x6cec('0xf'));var logger=require('../../config/logger')(_0x6cec('0x10'));var utils=require(_0x6cec('0x11'));var config=require(_0x6cec('0x12'));var licenseUtil=require(_0x6cec('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x363cac,_0x47c8ce){_0x47c8ce=_0x47c8ce||0xcc;return function(_0xf24da){if(_0xf24da){return _0x363cac[_0x6cec('0x14')](_0x47c8ce);}return _0x363cac[_0x6cec('0x15')](_0x47c8ce)[_0x6cec('0x16')]();};}function respondWithResult(_0x41ee55,_0xfeca3c){_0xfeca3c=_0xfeca3c||0xc8;return function(_0x4442eb){if(_0x4442eb){return _0x41ee55['status'](_0xfeca3c)[_0x6cec('0x17')](_0x4442eb);}};}function respondWithFilteredResult(_0x2cbb70,_0x19ccfe){return function(_0x479e91){if(_0x479e91){var _0x52fe52=typeof _0x19ccfe['offset']===_0x6cec('0x18')&&typeof _0x19ccfe[_0x6cec('0x19')]===_0x6cec('0x18');var _0x417080=_0x479e91[_0x6cec('0x1a')];var _0x209835=_0x52fe52?0x0:_0x19ccfe[_0x6cec('0x1b')];var _0x11793d=_0x52fe52?_0x479e91[_0x6cec('0x1a')]:_0x19ccfe[_0x6cec('0x1b')]+_0x19ccfe[_0x6cec('0x19')];var _0x1c09c2;if(_0x11793d>=_0x417080){_0x11793d=_0x417080;_0x1c09c2=0xc8;}else{_0x1c09c2=0xce;}_0x2cbb70[_0x6cec('0x15')](_0x1c09c2);return _0x2cbb70['set'](_0x6cec('0x1c'),_0x209835+'-'+_0x11793d+'/'+_0x417080)['json'](_0x479e91);}return null;};}function patchUpdates(_0x10ab1a){return function(_0x8d62ac){try{jsonpatch[_0x6cec('0x1d')](_0x8d62ac,_0x10ab1a,!![]);}catch(_0x4fb250){return BPromise[_0x6cec('0x1e')](_0x4fb250);}return _0x8d62ac[_0x6cec('0x1f')]();};}function saveUpdates(_0x3102f5,_0x300e5e){return function(_0x22170d){if(_0x22170d){return _0x22170d[_0x6cec('0x20')](_0x3102f5)['then'](function(_0x2ff6e8){return _0x2ff6e8;});}return null;};}function removeEntity(_0x5baec7,_0x361687){return function(_0x3dd1fc){if(_0x3dd1fc){return _0x3dd1fc[_0x6cec('0x21')]()['then'](function(){_0x5baec7['status'](0xcc)[_0x6cec('0x16')]();});}};}function handleEntityNotFound(_0x5035f9,_0x1c2b77){return function(_0x6a97bd){if(!_0x6a97bd){_0x5035f9[_0x6cec('0x14')](0x194);}return _0x6a97bd;};}function handleError(_0x3c8cf1,_0x5d3712){_0x5d3712=_0x5d3712||0x1f4;return function(_0x45efbf){logger['error'](_0x45efbf[_0x6cec('0x22')]);if(_0x45efbf[_0x6cec('0x23')]){delete _0x45efbf[_0x6cec('0x23')];}_0x3c8cf1['status'](_0x5d3712)['send'](_0x45efbf);};}exports[_0x6cec('0x24')]=function(_0x3b8145,_0x5537e1){var _0x236d09={},_0x1c09d5={},_0xb79d57={'count':0x0,'rows':[]};var _0x33a615=_[_0x6cec('0x25')](db[_0x6cec('0x26')][_0x6cec('0x27')],function(_0x231c0e){return{'name':_0x231c0e[_0x6cec('0x28')],'type':_0x231c0e[_0x6cec('0x29')][_0x6cec('0x2a')]};});_0x1c09d5['model']=_['map'](_0x33a615,'name');_0x1c09d5[_0x6cec('0x2b')]=_['keys'](_0x3b8145[_0x6cec('0x2b')]);_0x1c09d5['filters']=_[_0x6cec('0x2c')](_0x1c09d5[_0x6cec('0x2d')],_0x1c09d5[_0x6cec('0x2b')]);_0x236d09[_0x6cec('0x2e')]=_[_0x6cec('0x2c')](_0x1c09d5[_0x6cec('0x2d')],qs['fields'](_0x3b8145['query'][_0x6cec('0x2f')]));_0x236d09[_0x6cec('0x2e')]=_0x236d09[_0x6cec('0x2e')][_0x6cec('0x30')]?_0x236d09[_0x6cec('0x2e')]:_0x1c09d5['model'];if(!_0x3b8145[_0x6cec('0x2b')][_0x6cec('0x31')](_0x6cec('0x32'))){_0x236d09[_0x6cec('0x19')]=qs[_0x6cec('0x19')](_0x3b8145['query'][_0x6cec('0x19')]);_0x236d09[_0x6cec('0x1b')]=qs[_0x6cec('0x1b')](_0x3b8145[_0x6cec('0x2b')][_0x6cec('0x1b')]);}_0x236d09[_0x6cec('0x33')]=qs[_0x6cec('0x34')](_0x3b8145[_0x6cec('0x2b')][_0x6cec('0x34')]);_0x236d09['where']=qs[_0x6cec('0x35')](_[_0x6cec('0x36')](_0x3b8145['query'],_0x1c09d5[_0x6cec('0x35')]),_0x33a615);if(_0x3b8145[_0x6cec('0x2b')][_0x6cec('0x37')]){_0x236d09['where']=_[_0x6cec('0x38')](_0x236d09[_0x6cec('0x39')],{'$or':_['map'](_0x33a615,function(_0x1f8fd7){if(_0x1f8fd7[_0x6cec('0x29')]!==_0x6cec('0x3a')){var _0x1fe754={};_0x1fe754[_0x1f8fd7[_0x6cec('0x23')]]={'$like':'%'+_0x3b8145[_0x6cec('0x2b')][_0x6cec('0x37')]+'%'};return _0x1fe754;}})});}_0x236d09=_[_0x6cec('0x38')]({},_0x236d09,_0x3b8145[_0x6cec('0x3b')]);var _0x1adcd3={'where':_0x236d09[_0x6cec('0x39')]};return db[_0x6cec('0x26')]['count'](_0x1adcd3)[_0x6cec('0x3c')](function(_0x51d7bb){_0xb79d57[_0x6cec('0x1a')]=_0x51d7bb;if(_0x3b8145[_0x6cec('0x2b')]['includeAll']){_0x236d09[_0x6cec('0x3d')]=[{'all':!![]}];}return db[_0x6cec('0x26')]['findAll'](_0x236d09);})[_0x6cec('0x3c')](function(_0x3cdf44){_0xb79d57[_0x6cec('0x3e')]=_0x3cdf44;return _0xb79d57;})[_0x6cec('0x3c')](respondWithFilteredResult(_0x5537e1,_0x236d09))['catch'](handleError(_0x5537e1,null));};exports[_0x6cec('0x3f')]=function(_0x5b1710,_0x49d0df){var _0x3b1a33={'raw':!![],'where':{'id':_0x5b1710[_0x6cec('0x40')]['id']}},_0x11f38b={};_0x11f38b[_0x6cec('0x2d')]=_[_0x6cec('0x41')](db[_0x6cec('0x26')][_0x6cec('0x27')]);_0x11f38b[_0x6cec('0x2b')]=_[_0x6cec('0x41')](_0x5b1710['query']);_0x11f38b[_0x6cec('0x35')]=_[_0x6cec('0x2c')](_0x11f38b[_0x6cec('0x2d')],_0x11f38b[_0x6cec('0x2b')]);_0x3b1a33[_0x6cec('0x2e')]=_[_0x6cec('0x2c')](_0x11f38b['model'],qs['fields'](_0x5b1710['query'][_0x6cec('0x2f')]));_0x3b1a33[_0x6cec('0x2e')]=_0x3b1a33[_0x6cec('0x2e')][_0x6cec('0x30')]?_0x3b1a33[_0x6cec('0x2e')]:_0x11f38b['model'];if(_0x5b1710['query'][_0x6cec('0x42')]){_0x3b1a33['include']=[{'all':!![]}];}_0x3b1a33=_['merge']({},_0x3b1a33,_0x5b1710[_0x6cec('0x3b')]);return db['VoiceTransferReport']['find'](_0x3b1a33)[_0x6cec('0x3c')](handleEntityNotFound(_0x49d0df,null))['then'](respondWithResult(_0x49d0df,null))[_0x6cec('0x43')](handleError(_0x49d0df,null));};exports[_0x6cec('0x44')]=function(_0x2a6e3b,_0x442103){return db[_0x6cec('0x26')]['create'](_0x2a6e3b[_0x6cec('0x45')],{})[_0x6cec('0x3c')](respondWithResult(_0x442103,0xc9))[_0x6cec('0x43')](handleError(_0x442103,null));};exports[_0x6cec('0x20')]=function(_0x105687,_0x2a57ee){if(_0x105687[_0x6cec('0x45')]['id']){delete _0x105687['body']['id'];}return db[_0x6cec('0x26')][_0x6cec('0x46')]({'where':{'id':_0x105687[_0x6cec('0x40')]['id']}})[_0x6cec('0x3c')](handleEntityNotFound(_0x2a57ee,null))[_0x6cec('0x3c')](saveUpdates(_0x105687[_0x6cec('0x45')],null))[_0x6cec('0x3c')](respondWithResult(_0x2a57ee,null))['catch'](handleError(_0x2a57ee,null));};exports[_0x6cec('0x21')]=function(_0x55a40f,_0x5550e5){return db[_0x6cec('0x26')][_0x6cec('0x46')]({'where':{'id':_0x55a40f[_0x6cec('0x40')]['id']}})[_0x6cec('0x3c')](handleEntityNotFound(_0x5550e5,null))['then'](removeEntity(_0x5550e5,null))['catch'](handleError(_0x5550e5,null));};exports[_0x6cec('0x47')]=function(_0x558d3f,_0x2ed872){return db[_0x6cec('0x26')]['describe']()[_0x6cec('0x3c')](respondWithResult(_0x2ed872,null))[_0x6cec('0x43')](handleError(_0x2ed872,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 5ea8122..50c25cf 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 _0x10e9=['moment','bluebird','request-promise','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','../../config/logger','api'];(function(_0x31d4a7,_0x135a21){var _0x12b3c6=function(_0x110b8d){while(--_0x110b8d){_0x31d4a7['push'](_0x31d4a7['shift']());}};_0x12b3c6(++_0x135a21);}(_0x10e9,0xb1));var _0x910e=function(_0x1b5383,_0x55d8cf){_0x1b5383=_0x1b5383-0x0;var _0x4a2ad9=_0x10e9[_0x1b5383];return _0x4a2ad9;};'use strict';var _=require(_0x910e('0x0'));var util=require('util');var logger=require(_0x910e('0x1'))(_0x910e('0x2'));var moment=require(_0x910e('0x3'));var BPromise=require(_0x910e('0x4'));var rp=require(_0x910e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x910e('0x6'));var attributes=require(_0x910e('0x7'));module[_0x910e('0x8')]=function(_0x42fed6,_0x4d2c77){return _0x42fed6[_0x910e('0x9')](_0x910e('0xa'),attributes,{'tableName':_0x910e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d97=['bluebird','../../config/environment','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger'];(function(_0x1a58dc,_0x4d3bf4){var _0x23ea3b=function(_0x4e6087){while(--_0x4e6087){_0x1a58dc['push'](_0x1a58dc['shift']());}};_0x23ea3b(++_0x4d3bf4);}(_0x4d97,0x15c));var _0x74d9=function(_0x4f15b7,_0x2bd8bd){_0x4f15b7=_0x4f15b7-0x0;var _0x361c49=_0x4d97[_0x4f15b7];return _0x361c49;};'use strict';var _=require(_0x74d9('0x0'));var util=require(_0x74d9('0x1'));var logger=require(_0x74d9('0x2'))('api');var moment=require('moment');var BPromise=require(_0x74d9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x74d9('0x4'));var attributes=require('./voiceTransferReport.attributes');module[_0x74d9('0x5')]=function(_0x3dada2,_0x21564b){return _0x3dada2[_0x74d9('0x6')](_0x74d9('0x7'),attributes,{'tableName':_0x74d9('0x8'),'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 974275d..e648b5c 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 _0x5819=['create','body','options','raw','then','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','CreateVoiceTransferReport','VoiceTransferReport'];(function(_0x2ace66,_0x388b28){var _0x564e75=function(_0x3fb07d){while(--_0x3fb07d){_0x2ace66['push'](_0x2ace66['shift']());}};_0x564e75(++_0x388b28);}(_0x5819,0x1e2));var _0x9581=function(_0xcbb451,_0x57e7ab){_0xcbb451=_0xcbb451-0x0;var _0x1fb6d1=_0x5819[_0xcbb451];return _0x1fb6d1;};'use strict';var _=require(_0x9581('0x0'));var util=require(_0x9581('0x1'));var moment=require(_0x9581('0x2'));var BPromise=require(_0x9581('0x3'));var rs=require(_0x9581('0x4'));var fs=require('fs');var Redis=require(_0x9581('0x5'));var db=require(_0x9581('0x6'))['db'];var utils=require(_0x9581('0x7'));var logger=require('../../config/logger')(_0x9581('0x8'));var config=require(_0x9581('0x9'));var jayson=require(_0x9581('0xa'));var client=jayson[_0x9581('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c6e48,_0x33c048,_0x1d71cd){return new BPromise(function(_0x3c65cc,_0x4b29dd){return client['request'](_0x4c6e48,_0x1d71cd)['then'](function(_0x1779f5){logger[_0x9581('0xc')](_0x9581('0xd'),_0x33c048,'request\x20sent');logger[_0x9581('0xe')](_0x9581('0xf'),_0x33c048,_0x9581('0x10'),JSON['stringify'](_0x1779f5));if(_0x1779f5[_0x9581('0x11')]){if(_0x1779f5['error']['code']===0x1f4){logger[_0x9581('0x11')](_0x9581('0xd'),_0x33c048,_0x1779f5[_0x9581('0x11')]['message']);return _0x4b29dd(_0x1779f5[_0x9581('0x11')][_0x9581('0x12')]);}logger[_0x9581('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x33c048,_0x1779f5['error'][_0x9581('0x12')]);return _0x3c65cc(_0x1779f5[_0x9581('0x11')][_0x9581('0x12')]);}else{logger['info'](_0x9581('0xd'),_0x33c048,_0x9581('0x10'));_0x3c65cc(_0x1779f5['result'][_0x9581('0x12')]);}})[_0x9581('0x13')](function(_0x46ae53){logger[_0x9581('0x11')](_0x9581('0xd'),_0x33c048,_0x46ae53);_0x4b29dd(_0x46ae53);});});}exports[_0x9581('0x14')]=function(_0x5eee2a){var _0x3b2fc8=this;return new Promise(function(_0x20c3d1,_0x4d3d18){return db[_0x9581('0x15')][_0x9581('0x16')](_0x5eee2a[_0x9581('0x17')],{'raw':_0x5eee2a[_0x9581('0x18')]?_0x5eee2a[_0x9581('0x18')][_0x9581('0x19')]===undefined?!![]:![]:!![]})[_0x9581('0x1a')](function(_0x3ab8a9){logger[_0x9581('0xc')](_0x9581('0x14'),_0x5eee2a);logger[_0x9581('0xe')](_0x9581('0x14'),_0x5eee2a,JSON[_0x9581('0x1b')](_0x3ab8a9));_0x20c3d1(_0x3ab8a9);})['catch'](function(_0x330890){logger[_0x9581('0x11')](_0x9581('0x14'),_0x330890[_0x9581('0x12')],_0x5eee2a);_0x4d3d18(_0x3b2fc8['error'](0x1f4,_0x330890[_0x9581('0x12')]));});});}; \ No newline at end of file +var _0xd200=['result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','then','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x5efe7c,_0x31bfce){var _0x38bdde=function(_0x483e5f){while(--_0x483e5f){_0x5efe7c['push'](_0x5efe7c['shift']());}};_0x38bdde(++_0x31bfce);}(_0xd200,0x165));var _0x0d20=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0xd200[_0x599e60];return _0x468e19;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0d20('0x0'));var BPromise=require(_0x0d20('0x1'));var rs=require(_0x0d20('0x2'));var fs=require('fs');var Redis=require(_0x0d20('0x3'));var db=require(_0x0d20('0x4'))['db'];var utils=require(_0x0d20('0x5'));var logger=require(_0x0d20('0x6'))(_0x0d20('0x7'));var config=require('../../config/environment');var jayson=require(_0x0d20('0x8'));var client=jayson[_0x0d20('0x9')][_0x0d20('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x588257,_0x1eb8df,_0x9d7e78){return new BPromise(function(_0x40cd31,_0x47ec50){return client[_0x0d20('0xb')](_0x588257,_0x9d7e78)['then'](function(_0x5da547){logger[_0x0d20('0xc')](_0x0d20('0xd'),_0x1eb8df,_0x0d20('0xe'));logger[_0x0d20('0xf')](_0x0d20('0x10'),_0x1eb8df,_0x0d20('0xe'),JSON[_0x0d20('0x11')](_0x5da547));if(_0x5da547[_0x0d20('0x12')]){if(_0x5da547[_0x0d20('0x12')]['code']===0x1f4){logger[_0x0d20('0x12')](_0x0d20('0xd'),_0x1eb8df,_0x5da547[_0x0d20('0x12')][_0x0d20('0x13')]);return _0x47ec50(_0x5da547[_0x0d20('0x12')][_0x0d20('0x13')]);}logger['error'](_0x0d20('0xd'),_0x1eb8df,_0x5da547[_0x0d20('0x12')]['message']);return _0x40cd31(_0x5da547[_0x0d20('0x12')]['message']);}else{logger['info'](_0x0d20('0xd'),_0x1eb8df,'request\x20sent');_0x40cd31(_0x5da547[_0x0d20('0x14')]['message']);}})[_0x0d20('0x15')](function(_0x11c971){logger['error'](_0x0d20('0xd'),_0x1eb8df,_0x11c971);_0x47ec50(_0x11c971);});});}exports[_0x0d20('0x16')]=function(_0xc6dee7){var _0x22b594=this;return new Promise(function(_0x3508c1,_0x57ff26){return db[_0x0d20('0x17')][_0x0d20('0x18')](_0xc6dee7[_0x0d20('0x19')],{'raw':_0xc6dee7[_0x0d20('0x1a')]?_0xc6dee7[_0x0d20('0x1a')][_0x0d20('0x1b')]===undefined?!![]:![]:!![]})[_0x0d20('0x1c')](function(_0x24b912){logger[_0x0d20('0xc')]('CreateVoiceTransferReport',_0xc6dee7);logger[_0x0d20('0xf')](_0x0d20('0x16'),_0xc6dee7,JSON[_0x0d20('0x11')](_0x24b912));_0x3508c1(_0x24b912);})[_0x0d20('0x15')](function(_0x5169cc){logger[_0x0d20('0x12')](_0x0d20('0x16'),_0x5169cc['message'],_0xc6dee7);_0x57ff26(_0x22b594['error'](0x1f4,_0x5169cc['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 6998313..8556c1c 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 _0x91a7=['/originate','isWebrtcLicence','/hangup','isAuthenticated','hangup','/answer','answer','post','/hold','/unhold','unhold','/calls','/transfer','transfer','exports','Router','../../components/auth/service','./webbar.controller'];(function(_0x8e9597,_0x2aa555){var _0x3be06a=function(_0x7a8e7a){while(--_0x7a8e7a){_0x8e9597['push'](_0x8e9597['shift']());}};_0x3be06a(++_0x2aa555);}(_0x91a7,0xe7));var _0x791a=function(_0x4d0fa2,_0x539cb0){_0x4d0fa2=_0x4d0fa2-0x0;var _0x51969b=_0x91a7[_0x4d0fa2];return _0x51969b;};'use strict';var express=require('express');var router=express[_0x791a('0x0')]();var auth=require(_0x791a('0x1'));var controller=require(_0x791a('0x2'));router['post'](_0x791a('0x3'),auth['isAuthenticated'](),auth[_0x791a('0x4')](),controller['originate']);router['post'](_0x791a('0x5'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x7')]);router['post'](_0x791a('0x8'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x9')]);router[_0x791a('0xa')](_0x791a('0xb'),auth[_0x791a('0x6')](),auth[_0x791a('0x4')](),controller['hold']);router[_0x791a('0xa')](_0x791a('0xc'),auth['isAuthenticated'](),auth[_0x791a('0x4')](),controller[_0x791a('0xd')]);router[_0x791a('0xa')](_0x791a('0xe'),auth[_0x791a('0x6')](),auth[_0x791a('0x4')](),controller['calls']);router['post'](_0x791a('0xf'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x10')]);module[_0x791a('0x11')]=router; \ No newline at end of file +var _0xcb91=['/unhold','unhold','/calls','transfer','exports','../../components/auth/service','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','isAuthenticated','hangup','hold'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x307bf6,_0x55bdd5){_0x307bf6=_0x307bf6-0x0;var _0x2878fc=_0xcb91[_0x307bf6];return _0x2878fc;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x1cb9('0x0'));var controller=require(_0x1cb9('0x1'));router[_0x1cb9('0x2')](_0x1cb9('0x3'),auth['isAuthenticated'](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0x5')]);router['post'](_0x1cb9('0x6'),auth[_0x1cb9('0x7')](),auth['isWebrtcLicence'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x2')]('/answer',auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller['answer']);router[_0x1cb9('0x2')]('/hold',auth['isAuthenticated'](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x2')](_0x1cb9('0xa'),auth[_0x1cb9('0x7')](),auth['isWebrtcLicence'](),controller[_0x1cb9('0xb')]);router[_0x1cb9('0x2')](_0x1cb9('0xc'),auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller['calls']);router['post']('/transfer',auth[_0x1cb9('0x7')](),auth[_0x1cb9('0x4')](),controller[_0x1cb9('0xd')]);module[_0x1cb9('0xe')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 2220416..935013a 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 _0x98d3=['transfer\x20executed!','path','lodash','../../config/environment','bluebird','client','http','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','emit','log','handleError:','name','status','send','request','error','message','catch','User','findOne','agent','then','VoiceChannels','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','all','UserId','conference','webbar:conference','transfer\x20fired:','transferNumber'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x98d3,0x173));var _0x398d=function(_0x1e9c0c,_0x61b24f){_0x1e9c0c=_0x1e9c0c-0x0;var _0x4bceff=_0x98d3[_0x1e9c0c];return _0x4bceff;};'use strict';var path=require(_0x398d('0x0'));var fs=require('fs');var _=require(_0x398d('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x398d('0x2'));var util=require('util');var BPromise=require(_0x398d('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x398d('0x4')][_0x398d('0x5')]({'port':0x232a});var logger=require('../../config/logger')('webbarapi');var Redis=require(_0x398d('0x6'));config[_0x398d('0x7')]=_[_0x398d('0x8')](config['redis'],{'host':_0x398d('0x9'),'port':0x18eb});var io=require(_0x398d('0xa'))(new Redis(config[_0x398d('0x7')]));var Schema=require(_0x398d('0xb'));var originateValidation=new Schema({'userId':{'type':_0x398d('0xc'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x398d('0xd'),'required':[!![],_0x398d('0xe')]},'callerId':{'type':_0x398d('0xd')},'callbackUrl':{'type':_0x398d('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x398d('0xc'),'required':[!![],_0x398d('0xf')]},'sessionId':{'type':_0x398d('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x398d('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x398d('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x398d('0xc'),'required':[!![],_0x398d('0xf')]},'sessionId':{'type':_0x398d('0xd'),'required':[!![],_0x398d('0x10')]},'transferNumber':{'type':_0x398d('0xd'),'required':[!![],_0x398d('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x398d('0xc'),'required':[!![],_0x398d('0xf')]},'sessionId':{'type':_0x398d('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x398d('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x398d('0xc'),'required':[!![],_0x398d('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x398d('0xc'),'required':[!![],_0x398d('0xf')]}});function emit(_0x278004,_0x4099a5,_0x3ff03c){logger[_0x398d('0x12')](_0x278004,_0x4099a5,JSON['stringify'](_0x3ff03c));io['to'](_0x278004)[_0x398d('0x13')](_0x4099a5,_0x3ff03c);}function handleError(_0x54e717){return function(_0x673840){console[_0x398d('0x14')](_0x398d('0x15'),_0x673840,_0x673840 instanceof RangeError);logger['error'](_0x673840['stack']);if(_0x673840 instanceof RangeError){if(_0x673840['name']){delete _0x673840[_0x398d('0x16')];}_0x54e717[_0x398d('0x17')](0x194)[_0x398d('0x18')](_0x673840);}else{if(_0x673840[_0x398d('0x16')]){delete _0x673840[_0x398d('0x16')];}_0x54e717[_0x398d('0x17')](0x1f4)[_0x398d('0x18')](_0x673840);}};}function checkError(){return function(_0x552411){if(!_0x552411){throw new RangeError('NotFound');}return _0x552411;};}function respondWithRpcPromise(_0x5e667d,_0x16e580){return new BPromise(function(_0x3b275a,_0x1ea5f9){var _0x2affed=amiClient;return _0x2affed[_0x398d('0x19')](_0x5e667d,_0x16e580)['then'](function(_0x5c4c70){if(_0x5c4c70[_0x398d('0x1a')]){if(_0x5c4c70[_0x398d('0x1a')]['code']===0x1f4){return _0x1ea5f9(_0x5c4c70[_0x398d('0x1a')][_0x398d('0x1b')]);}return _0x3b275a(_0x5c4c70['error']['message']);}else{_0x3b275a(_0x5c4c70['result']);}})[_0x398d('0x1c')](function(_0x2cc4ef){_0x1ea5f9(_0x2cc4ef);});});}function getAgent(_0x24fa2c){return db[_0x398d('0x1d')][_0x398d('0x1e')]({'where':{'id':_0x24fa2c,'role':_0x398d('0x1f')}})[_0x398d('0x20')](checkError());}function getAgentCheckSession(_0x17318c,_0x4f4466){return new BPromise(function(_0x35bd19,_0x557dce){var _0x4aa568=respondWithRpcPromise(_0x398d('0x21'));var _0x27bc6e=getAgent(_0x17318c);Promise['all']([_0x4aa568,_0x27bc6e])[_0x398d('0x20')](function(_0x558249){var _0x3ae172=_0x558249[0x0];var _0x8abf30=_0x558249[0x1];var _0x582d16=_['filter'](_0x3ae172[_0x398d('0x22')],function(_0x2ca780){return _0x2ca780['UserId']==_0x8abf30['id']&&_0x2ca780[_0x398d('0x23')]==_0x4f4466;});if(_0x582d16[_0x398d('0x24')]==0x1){_0x35bd19(_0x8abf30);}else{_0x557dce(new RangeError(_0x398d('0x25')+_0x4f4466+_0x398d('0x26')));}});});}exports[_0x398d('0x27')]=function(_0x3bcc5e,_0x490bee){logger['info'](_0x398d('0x28'),_0x3bcc5e[_0x398d('0x29')]);var _0x45f1a3=originateValidation[_0x398d('0xb')](_0x3bcc5e[_0x398d('0x29')]);if(_0x45f1a3[_0x398d('0x24')]>0x0){return _0x490bee[_0x398d('0x17')](0x190)[_0x398d('0x2a')](_0x45f1a3);}var _0x1827be=_0x3bcc5e['body'][_0x398d('0x2b')];var _0x3807f0=_0x3bcc5e[_0x398d('0x29')]['callNumber'];var _0x5be779=_0x3bcc5e[_0x398d('0x29')][_0x398d('0x2c')];var _0x3fb8ff=_0x3bcc5e[_0x398d('0x29')][_0x398d('0x2d')];return getAgent(_0x1827be)[_0x398d('0x20')](function(_0x324d76){logger[_0x398d('0x12')](_0x398d('0x2e'),_0x324d76[_0x398d('0x16')]);emit(util[_0x398d('0x2f')](_0x398d('0x30'),_0x324d76[_0x398d('0x16')]),_0x398d('0x31'),{'callNumber':_0x3807f0,'callerId':_0x5be779,'callbackUrl':_0x3fb8ff});return _0x490bee[_0x398d('0x17')](0xc8)[_0x398d('0x2a')]({'error':![],'message':_0x398d('0x32')});})[_0x398d('0x1c')](handleError(_0x490bee));};exports[_0x398d('0x33')]=function(_0x5ae43b,_0x244512){logger[_0x398d('0x12')](_0x398d('0x34'),_0x5ae43b[_0x398d('0x29')]);var _0x209c2b=hangupValidation[_0x398d('0xb')](_0x5ae43b[_0x398d('0x29')]);if(_0x209c2b['length']>0x0){return _0x244512[_0x398d('0x17')](0x190)[_0x398d('0x2a')](_0x209c2b);}var _0x165d26=_0x5ae43b[_0x398d('0x29')][_0x398d('0x2b')];var _0x219651=_0x5ae43b[_0x398d('0x29')][_0x398d('0x23')];return getAgent(_0x165d26)['then'](function(_0x208eb2){logger[_0x398d('0x12')](_0x398d('0x2e'),_0x208eb2[_0x398d('0x16')]);emit(util[_0x398d('0x2f')]('user:%s',_0x208eb2[_0x398d('0x16')]),_0x398d('0x35'),{'sessionId':_0x219651});return _0x244512['status'](0xc8)[_0x398d('0x2a')]({'error':![],'message':_0x398d('0x36')});})[_0x398d('0x1c')](handleError(_0x244512));};exports[_0x398d('0x37')]=function(_0x217fc0,_0x30ac4d){logger[_0x398d('0x12')](_0x398d('0x38'),_0x217fc0[_0x398d('0x29')]);var _0x5d7d33=answerValidation[_0x398d('0xb')](_0x217fc0[_0x398d('0x29')]);if(_0x5d7d33[_0x398d('0x24')]>0x0){return _0x30ac4d[_0x398d('0x17')](0x190)[_0x398d('0x2a')](_0x5d7d33);}var _0x227984=_0x217fc0['body'][_0x398d('0x2b')];var _0x1a6bdc=_0x217fc0['body'][_0x398d('0x23')];return getAgent(_0x227984)[_0x398d('0x20')](function(_0x2f419f){logger['info'](_0x398d('0x2e'),_0x2f419f[_0x398d('0x16')]);emit(util[_0x398d('0x2f')](_0x398d('0x30'),_0x2f419f[_0x398d('0x16')]),'webbar:answer',{'sessionId':_0x1a6bdc});return _0x30ac4d[_0x398d('0x17')](0xc8)[_0x398d('0x2a')]({'error':![],'message':_0x398d('0x39')});})['catch'](handleError(_0x30ac4d));};exports[_0x398d('0x3a')]=function(_0x3f9fb2,_0x578a0f){logger[_0x398d('0x12')](_0x398d('0x3b'),_0x3f9fb2[_0x398d('0x29')]);var _0x1f67a9=holdValidation[_0x398d('0xb')](_0x3f9fb2[_0x398d('0x29')]);if(_0x1f67a9[_0x398d('0x24')]>0x0){return _0x578a0f[_0x398d('0x17')](0x190)['json'](_0x1f67a9);}var _0x34c0fc=_0x3f9fb2[_0x398d('0x29')]['userId'];var _0x5f4aef=_0x3f9fb2[_0x398d('0x29')][_0x398d('0x23')];return getAgent(_0x34c0fc)[_0x398d('0x20')](function(_0x35d260){logger['info'](_0x398d('0x2e'),_0x35d260['name']);emit(util[_0x398d('0x2f')]('user:%s',_0x35d260[_0x398d('0x16')]),'webbar:hold',{'sessionId':_0x5f4aef});return _0x578a0f['status'](0xc8)['json']({'error':![],'message':_0x398d('0x3c')});})[_0x398d('0x1c')](handleError(_0x578a0f));};exports[_0x398d('0x3d')]=function(_0x3fa030,_0x578784){logger['info'](_0x398d('0x3e'),_0x3fa030[_0x398d('0x29')]);var _0x1615ee=unholdValidation['validate'](_0x3fa030[_0x398d('0x29')]);if(_0x1615ee[_0x398d('0x24')]>0x0){return _0x578784[_0x398d('0x17')](0x190)[_0x398d('0x2a')](_0x1615ee);}var _0x20c488=_0x3fa030[_0x398d('0x29')]['userId'];var _0x158828=_0x3fa030[_0x398d('0x29')][_0x398d('0x23')];return getAgent(_0x20c488)[_0x398d('0x20')](function(_0x499f2e){logger[_0x398d('0x12')](_0x398d('0x2e'),_0x499f2e[_0x398d('0x16')]);emit(util[_0x398d('0x2f')]('user:%s',_0x499f2e['name']),_0x398d('0x3f'),{'sessionId':_0x158828});return _0x578784['status'](0xc8)[_0x398d('0x2a')]({'error':![],'message':_0x398d('0x40')});})['catch'](handleError(_0x578784));};exports[_0x398d('0x41')]=function(_0x5109e7,_0x2eac8c){logger[_0x398d('0x12')](_0x398d('0x42'),_0x2eac8c[_0x398d('0x29')]);var _0x360e67=callsValidation[_0x398d('0xb')](_0x5109e7[_0x398d('0x29')]);if(_0x360e67[_0x398d('0x24')]>0x0){return _0x2eac8c[_0x398d('0x17')](0x190)[_0x398d('0x2a')](_0x360e67);}var _0x179862=_0x5109e7[_0x398d('0x29')][_0x398d('0x2b')];var _0x783c74=respondWithRpcPromise(_0x398d('0x21'));var _0x3f3108=getAgent(_0x179862);return Promise[_0x398d('0x43')]([_0x783c74,_0x3f3108])[_0x398d('0x20')](function(_0x4717cf){var _0xb25709=_0x4717cf[0x0];var _0x7f4acb=_0x4717cf[0x1];var _0xcd2b9d=_['filter'](_0xb25709[_0x398d('0x22')],function(_0x26d6f8){return _0x26d6f8[_0x398d('0x44')]==_0x7f4acb['id'];});return _0x2eac8c[_0x398d('0x17')](0xc8)[_0x398d('0x2a')]({'count':_0xcd2b9d[_0x398d('0x24')],'rows':_0xcd2b9d});})[_0x398d('0x1c')](handleError(_0x2eac8c));};exports[_0x398d('0x45')]=function(_0xe6cf33,_0x9c3971){logger[_0x398d('0x12')]('conference\x20fired:',_0xe6cf33[_0x398d('0x29')]);var _0x207fd6=conferenceValidation['validate'](_0xe6cf33[_0x398d('0x29')]);if(_0x207fd6['length']>0x0){return _0x9c3971['status'](0x190)['json'](_0x207fd6);}var _0x37646f=_0xe6cf33[_0x398d('0x29')]['userId'];return getAgent(_0x37646f)[_0x398d('0x20')](function(_0x278262){logger[_0x398d('0x12')]('entityFound:',_0x278262[_0x398d('0x16')]);emit(util[_0x398d('0x2f')](_0x398d('0x30'),_0x278262['name']),_0x398d('0x46'));return _0x9c3971['status'](0xc8)[_0x398d('0x2a')]({'error':![],'message':'conference\x20executed!'});})[_0x398d('0x1c')](handleError(_0x9c3971));};exports['transfer']=function(_0x35c204,_0x1b5929){logger[_0x398d('0x12')](_0x398d('0x47'),_0x35c204[_0x398d('0x29')]);var _0x56e3f6=transferValidation[_0x398d('0xb')](_0x35c204[_0x398d('0x29')]);if(_0x56e3f6[_0x398d('0x24')]>0x0){return _0x1b5929[_0x398d('0x17')](0x190)[_0x398d('0x2a')](_0x56e3f6);}var _0x12d76f=_0x35c204[_0x398d('0x29')]['userId'];var _0x227661=_0x35c204[_0x398d('0x29')][_0x398d('0x23')];var _0x5085f4=_0x35c204['body'][_0x398d('0x48')];return getAgent(_0x12d76f)[_0x398d('0x20')](function(_0x540121){logger['info'](_0x398d('0x2e'),_0x540121['name']);emit(util[_0x398d('0x2f')]('user:%s',_0x540121[_0x398d('0x16')]),'webbar:transfer',{'sessionId':_0x227661,'transferNumber':_0x5085f4});return _0x1b5929['status'](0xc8)['json']({'error':![],'message':_0x398d('0x49')});})[_0x398d('0x1c')](handleError(_0x1b5929));}; \ No newline at end of file +var _0xca66=['sessionId\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','code','message','result','catch','User','findOne','agent','all','filter','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','callNumber','callerId','callbackUrl','entityFound:','user:%s','webbar:originate','hangup','hangup\x20fired:','validate','then','format','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','userId','sessionId','answer\x20executed!','hold','webbar:hold','unhold\x20fired:','webbar:unhold','calls','calls\x20fired:','VoiceChannels','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transferNumber','transfer\x20executed!','path','../../config/environment','util','bluebird','client','../../config/logger','ioredis','redis','defaults','localhost','socket.io-emitter','number','userId\x20is\x20required','string','callNumber\x20is\x20required'];(function(_0x383fac,_0xeda6b6){var _0x38d3b6=function(_0x481966){while(--_0x481966){_0x383fac['push'](_0x383fac['shift']());}};_0x38d3b6(++_0xeda6b6);}(_0xca66,0x8b));var _0x6ca6=function(_0x37364b,_0x45fc56){_0x37364b=_0x37364b-0x0;var _0x262ce7=_0xca66[_0x37364b];return _0x262ce7;};'use strict';var path=require(_0x6ca6('0x0'));var fs=require('fs');var _=require('lodash');var db=require('../../mysqldb')['db'];var config=require(_0x6ca6('0x1'));var util=require(_0x6ca6('0x2'));var BPromise=require(_0x6ca6('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x6ca6('0x4')]['http']({'port':0x232a});var logger=require(_0x6ca6('0x5'))('webbarapi');var Redis=require(_0x6ca6('0x6'));config[_0x6ca6('0x7')]=_[_0x6ca6('0x8')](config[_0x6ca6('0x7')],{'host':_0x6ca6('0x9'),'port':0x18eb});var io=require(_0x6ca6('0xa'))(new Redis(config[_0x6ca6('0x7')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x6ca6('0xb'),'required':[!![],_0x6ca6('0xc')]},'callNumber':{'type':_0x6ca6('0xd'),'required':[!![],_0x6ca6('0xe')]},'callerId':{'type':_0x6ca6('0xd')},'callbackUrl':{'type':_0x6ca6('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x6ca6('0xb'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x6ca6('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x6ca6('0xb'),'required':[!![],_0x6ca6('0xc')]},'sessionId':{'type':_0x6ca6('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x6ca6('0xb'),'required':[!![],_0x6ca6('0xc')]},'sessionId':{'type':'string','required':[!![],_0x6ca6('0xf')]},'transferNumber':{'type':_0x6ca6('0xd'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x6ca6('0xb'),'required':[!![],_0x6ca6('0xc')]},'sessionId':{'type':_0x6ca6('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x6ca6('0xb'),'required':[!![],_0x6ca6('0xc')]},'sessionId':{'type':_0x6ca6('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6ca6('0xc')]}});function emit(_0x19e94f,_0x260b56,_0x3f03e6){logger[_0x6ca6('0x10')](_0x19e94f,_0x260b56,JSON[_0x6ca6('0x11')](_0x3f03e6));io['to'](_0x19e94f)[_0x6ca6('0x12')](_0x260b56,_0x3f03e6);}function handleError(_0x4f056d){return function(_0x2391ce){console[_0x6ca6('0x13')](_0x6ca6('0x14'),_0x2391ce,_0x2391ce instanceof RangeError);logger[_0x6ca6('0x15')](_0x2391ce[_0x6ca6('0x16')]);if(_0x2391ce instanceof RangeError){if(_0x2391ce[_0x6ca6('0x17')]){delete _0x2391ce[_0x6ca6('0x17')];}_0x4f056d[_0x6ca6('0x18')](0x194)[_0x6ca6('0x19')](_0x2391ce);}else{if(_0x2391ce[_0x6ca6('0x17')]){delete _0x2391ce[_0x6ca6('0x17')];}_0x4f056d['status'](0x1f4)[_0x6ca6('0x19')](_0x2391ce);}};}function checkError(){return function(_0x254afe){if(!_0x254afe){throw new RangeError(_0x6ca6('0x1a'));}return _0x254afe;};}function respondWithRpcPromise(_0x195c92,_0x3a24aa){return new BPromise(function(_0x438694,_0x593f15){var _0xfb962d=amiClient;return _0xfb962d[_0x6ca6('0x1b')](_0x195c92,_0x3a24aa)['then'](function(_0x4927c1){if(_0x4927c1[_0x6ca6('0x15')]){if(_0x4927c1[_0x6ca6('0x15')][_0x6ca6('0x1c')]===0x1f4){return _0x593f15(_0x4927c1[_0x6ca6('0x15')][_0x6ca6('0x1d')]);}return _0x438694(_0x4927c1['error'][_0x6ca6('0x1d')]);}else{_0x438694(_0x4927c1[_0x6ca6('0x1e')]);}})[_0x6ca6('0x1f')](function(_0x2d8c64){_0x593f15(_0x2d8c64);});});}function getAgent(_0x3971a2){return db[_0x6ca6('0x20')][_0x6ca6('0x21')]({'where':{'id':_0x3971a2,'role':_0x6ca6('0x22')}})['then'](checkError());}function getAgentCheckSession(_0x55b07f,_0x144ec5){return new BPromise(function(_0x9467bd,_0xf1d821){var _0x141c0f=respondWithRpcPromise('VoiceChannels');var _0x5ea6f7=getAgent(_0x55b07f);Promise[_0x6ca6('0x23')]([_0x141c0f,_0x5ea6f7])['then'](function(_0x4ab84c){var _0x141e78=_0x4ab84c[0x0];var _0xefd407=_0x4ab84c[0x1];var _0x4a15cb=_[_0x6ca6('0x24')](_0x141e78[_0x6ca6('0x25')],function(_0xac50e8){return _0xac50e8[_0x6ca6('0x26')]==_0xefd407['id']&&_0xac50e8['sessionId']==_0x144ec5;});if(_0x4a15cb[_0x6ca6('0x27')]==0x1){_0x9467bd(_0xefd407);}else{_0xf1d821(new RangeError(_0x6ca6('0x28')+_0x144ec5+_0x6ca6('0x29')));}});});}exports[_0x6ca6('0x2a')]=function(_0x480264,_0x467a89){logger[_0x6ca6('0x10')](_0x6ca6('0x2b'),_0x480264[_0x6ca6('0x2c')]);var _0x5788a2=originateValidation['validate'](_0x480264['body']);if(_0x5788a2['length']>0x0){return _0x467a89['status'](0x190)[_0x6ca6('0x2d')](_0x5788a2);}var _0x3389c2=_0x480264[_0x6ca6('0x2c')]['userId'];var _0x206ecd=_0x480264[_0x6ca6('0x2c')][_0x6ca6('0x2e')];var _0x388e32=_0x480264['body'][_0x6ca6('0x2f')];var _0x40de00=_0x480264[_0x6ca6('0x2c')][_0x6ca6('0x30')];return getAgent(_0x3389c2)['then'](function(_0x1e28b4){logger['info'](_0x6ca6('0x31'),_0x1e28b4['name']);emit(util['format'](_0x6ca6('0x32'),_0x1e28b4[_0x6ca6('0x17')]),_0x6ca6('0x33'),{'callNumber':_0x206ecd,'callerId':_0x388e32,'callbackUrl':_0x40de00});return _0x467a89[_0x6ca6('0x18')](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})[_0x6ca6('0x1f')](handleError(_0x467a89));};exports[_0x6ca6('0x34')]=function(_0x49c8a4,_0x43c2cb){logger['info'](_0x6ca6('0x35'),_0x49c8a4['body']);var _0x1ada8b=hangupValidation[_0x6ca6('0x36')](_0x49c8a4[_0x6ca6('0x2c')]);if(_0x1ada8b[_0x6ca6('0x27')]>0x0){return _0x43c2cb[_0x6ca6('0x18')](0x190)[_0x6ca6('0x2d')](_0x1ada8b);}var _0x45e77b=_0x49c8a4[_0x6ca6('0x2c')]['userId'];var _0x2f6daf=_0x49c8a4['body']['sessionId'];return getAgent(_0x45e77b)[_0x6ca6('0x37')](function(_0x306eda){logger['info'](_0x6ca6('0x31'),_0x306eda['name']);emit(util[_0x6ca6('0x38')](_0x6ca6('0x32'),_0x306eda[_0x6ca6('0x17')]),_0x6ca6('0x39'),{'sessionId':_0x2f6daf});return _0x43c2cb['status'](0xc8)['json']({'error':![],'message':_0x6ca6('0x3a')});})[_0x6ca6('0x1f')](handleError(_0x43c2cb));};exports[_0x6ca6('0x3b')]=function(_0x3423e2,_0x4e6d4){logger['info'](_0x6ca6('0x3c'),_0x3423e2[_0x6ca6('0x2c')]);var _0x5bed6e=answerValidation[_0x6ca6('0x36')](_0x3423e2[_0x6ca6('0x2c')]);if(_0x5bed6e[_0x6ca6('0x27')]>0x0){return _0x4e6d4[_0x6ca6('0x18')](0x190)[_0x6ca6('0x2d')](_0x5bed6e);}var _0x3e658e=_0x3423e2[_0x6ca6('0x2c')][_0x6ca6('0x3d')];var _0x1a8b7e=_0x3423e2['body'][_0x6ca6('0x3e')];return getAgent(_0x3e658e)[_0x6ca6('0x37')](function(_0x243661){logger[_0x6ca6('0x10')](_0x6ca6('0x31'),_0x243661[_0x6ca6('0x17')]);emit(util[_0x6ca6('0x38')](_0x6ca6('0x32'),_0x243661['name']),'webbar:answer',{'sessionId':_0x1a8b7e});return _0x4e6d4[_0x6ca6('0x18')](0xc8)[_0x6ca6('0x2d')]({'error':![],'message':_0x6ca6('0x3f')});})[_0x6ca6('0x1f')](handleError(_0x4e6d4));};exports[_0x6ca6('0x40')]=function(_0x33f5d5,_0x1f51f4){logger['info']('hold\x20fired:',_0x33f5d5[_0x6ca6('0x2c')]);var _0x42b263=holdValidation['validate'](_0x33f5d5[_0x6ca6('0x2c')]);if(_0x42b263[_0x6ca6('0x27')]>0x0){return _0x1f51f4[_0x6ca6('0x18')](0x190)[_0x6ca6('0x2d')](_0x42b263);}var _0xc1928f=_0x33f5d5[_0x6ca6('0x2c')][_0x6ca6('0x3d')];var _0x5f27f5=_0x33f5d5[_0x6ca6('0x2c')][_0x6ca6('0x3e')];return getAgent(_0xc1928f)[_0x6ca6('0x37')](function(_0x4fde51){logger[_0x6ca6('0x10')]('entityFound:',_0x4fde51[_0x6ca6('0x17')]);emit(util['format']('user:%s',_0x4fde51['name']),_0x6ca6('0x41'),{'sessionId':_0x5f27f5});return _0x1f51f4[_0x6ca6('0x18')](0xc8)[_0x6ca6('0x2d')]({'error':![],'message':'hold\x20executed!'});})[_0x6ca6('0x1f')](handleError(_0x1f51f4));};exports['unhold']=function(_0x1f552d,_0x1010a6){logger[_0x6ca6('0x10')](_0x6ca6('0x42'),_0x1f552d[_0x6ca6('0x2c')]);var _0x2e6364=unholdValidation[_0x6ca6('0x36')](_0x1f552d[_0x6ca6('0x2c')]);if(_0x2e6364[_0x6ca6('0x27')]>0x0){return _0x1010a6[_0x6ca6('0x18')](0x190)[_0x6ca6('0x2d')](_0x2e6364);}var _0x5578fb=_0x1f552d[_0x6ca6('0x2c')][_0x6ca6('0x3d')];var _0x1de2ca=_0x1f552d[_0x6ca6('0x2c')][_0x6ca6('0x3e')];return getAgent(_0x5578fb)['then'](function(_0x14d87a){logger[_0x6ca6('0x10')](_0x6ca6('0x31'),_0x14d87a['name']);emit(util['format']('user:%s',_0x14d87a['name']),_0x6ca6('0x43'),{'sessionId':_0x1de2ca});return _0x1010a6[_0x6ca6('0x18')](0xc8)[_0x6ca6('0x2d')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x1010a6));};exports[_0x6ca6('0x44')]=function(_0x2cbf30,_0x2591de){logger['info'](_0x6ca6('0x45'),_0x2591de['body']);var _0x281759=callsValidation[_0x6ca6('0x36')](_0x2cbf30[_0x6ca6('0x2c')]);if(_0x281759[_0x6ca6('0x27')]>0x0){return _0x2591de['status'](0x190)[_0x6ca6('0x2d')](_0x281759);}var _0x4874d8=_0x2cbf30['body'][_0x6ca6('0x3d')];var _0x11538e=respondWithRpcPromise(_0x6ca6('0x46'));var _0x35854a=getAgent(_0x4874d8);return Promise['all']([_0x11538e,_0x35854a])[_0x6ca6('0x37')](function(_0x1c12ae){var _0x2c4053=_0x1c12ae[0x0];var _0x13d3ea=_0x1c12ae[0x1];var _0x43881a=_[_0x6ca6('0x24')](_0x2c4053[_0x6ca6('0x25')],function(_0x405609){return _0x405609[_0x6ca6('0x26')]==_0x13d3ea['id'];});return _0x2591de[_0x6ca6('0x18')](0xc8)[_0x6ca6('0x2d')]({'count':_0x43881a[_0x6ca6('0x27')],'rows':_0x43881a});})[_0x6ca6('0x1f')](handleError(_0x2591de));};exports[_0x6ca6('0x47')]=function(_0x2eeed6,_0x290c04){logger['info'](_0x6ca6('0x48'),_0x2eeed6[_0x6ca6('0x2c')]);var _0x2f4886=conferenceValidation[_0x6ca6('0x36')](_0x2eeed6[_0x6ca6('0x2c')]);if(_0x2f4886[_0x6ca6('0x27')]>0x0){return _0x290c04[_0x6ca6('0x18')](0x190)[_0x6ca6('0x2d')](_0x2f4886);}var _0x3328ea=_0x2eeed6[_0x6ca6('0x2c')][_0x6ca6('0x3d')];return getAgent(_0x3328ea)[_0x6ca6('0x37')](function(_0x9834d6){logger[_0x6ca6('0x10')](_0x6ca6('0x31'),_0x9834d6[_0x6ca6('0x17')]);emit(util['format'](_0x6ca6('0x32'),_0x9834d6[_0x6ca6('0x17')]),_0x6ca6('0x49'));return _0x290c04[_0x6ca6('0x18')](0xc8)[_0x6ca6('0x2d')]({'error':![],'message':_0x6ca6('0x4a')});})['catch'](handleError(_0x290c04));};exports['transfer']=function(_0x509fe3,_0x21f786){logger[_0x6ca6('0x10')]('transfer\x20fired:',_0x509fe3[_0x6ca6('0x2c')]);var _0xc6021a=transferValidation[_0x6ca6('0x36')](_0x509fe3['body']);if(_0xc6021a[_0x6ca6('0x27')]>0x0){return _0x21f786[_0x6ca6('0x18')](0x190)[_0x6ca6('0x2d')](_0xc6021a);}var _0x1c3064=_0x509fe3[_0x6ca6('0x2c')]['userId'];var _0x514684=_0x509fe3[_0x6ca6('0x2c')][_0x6ca6('0x3e')];var _0x47d420=_0x509fe3[_0x6ca6('0x2c')][_0x6ca6('0x4b')];return getAgent(_0x1c3064)[_0x6ca6('0x37')](function(_0x19e7ac){logger[_0x6ca6('0x10')](_0x6ca6('0x31'),_0x19e7ac[_0x6ca6('0x17')]);emit(util[_0x6ca6('0x38')](_0x6ca6('0x32'),_0x19e7ac['name']),'webbar:transfer',{'sessionId':_0x514684,'transferNumber':_0x47d420});return _0x21f786[_0x6ca6('0x18')](0xc8)[_0x6ca6('0x2d')]({'error':![],'message':_0x6ca6('0x4c')});})[_0x6ca6('0x1f')](handleError(_0x21f786));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index b09ffca..965e468 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 _0xd943=['show','get','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','create','post','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','send','put','/:id','destroy','/:id/dispositions','removeDispositions','delete','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','describe'];(function(_0x552995,_0x3455be){var _0x42643e=function(_0x26d4e0){while(--_0x26d4e0){_0x552995['push'](_0x552995['shift']());}};_0x42643e(++_0x3455be);}(_0xd943,0x15d));var _0x3d94=function(_0x129f50,_0x224bb4){_0x129f50=_0x129f50-0x0;var _0x114277=_0xd943[_0x129f50];return _0x114277;};'use strict';var multer=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var path=require(_0x3d94('0x2'));var timeout=require(_0x3d94('0x3'));var express=require('express');var router=express[_0x3d94('0x4')]();var fs_extra=require(_0x3d94('0x5'));var auth=require(_0x3d94('0x6'));var interaction=require(_0x3d94('0x7'));var config=require(_0x3d94('0x8'));var controller=require('./whatsappAccount.controller');router['get']('/',auth[_0x3d94('0x9')](),controller['index']);router['get']('/describe',auth[_0x3d94('0x9')](),controller[_0x3d94('0xa')]);router['get']('/:id',auth[_0x3d94('0x9')](),controller[_0x3d94('0xb')]);router[_0x3d94('0xc')]('/:id/dispositions',auth[_0x3d94('0x9')](),controller['getDispositions']);router[_0x3d94('0xc')](_0x3d94('0xd'),auth['isAuthenticated'](),controller[_0x3d94('0xe')]);router[_0x3d94('0xc')](_0x3d94('0xf'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x10')]);router['get'](_0x3d94('0x11'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x12')]);router['post']('/',auth[_0x3d94('0x9')](),controller[_0x3d94('0x13')]);router[_0x3d94('0x14')]('/:id/dispositions',auth[_0x3d94('0x9')](),controller[_0x3d94('0x15')]);router[_0x3d94('0x14')](_0x3d94('0xd'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x16')]);router[_0x3d94('0x14')](_0x3d94('0xf'),auth['isAuthenticated'](),controller[_0x3d94('0x17')]);router[_0x3d94('0x14')](_0x3d94('0x11'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x18')]);router[_0x3d94('0x14')](_0x3d94('0x19'),controller['notify']);router[_0x3d94('0x14')]('/:id/send',auth[_0x3d94('0x9')](),controller[_0x3d94('0x1a')]);router[_0x3d94('0x1b')](_0x3d94('0x1c'),auth[_0x3d94('0x9')](),controller['update']);router['delete'](_0x3d94('0x1c'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x1d')]);router['delete'](_0x3d94('0x1e'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x1f')]);router[_0x3d94('0x20')](_0x3d94('0xd'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x21')]);router[_0x3d94('0x20')](_0x3d94('0xf'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x22')]);module[_0x3d94('0x23')]=router; \ No newline at end of file +var _0x9f0e=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','post','/:id/canned_answers','/:id/users','addAgents','/:id/notify','notify','/:id/send','send','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util'];(function(_0x4251a4,_0x17292f){var _0x27d2f1=function(_0xf0a495){while(--_0xf0a495){_0x4251a4['push'](_0x4251a4['shift']());}};_0x27d2f1(++_0x17292f);}(_0x9f0e,0x116));var _0xe9f0=function(_0x3f7192,_0xdb2d27){_0x3f7192=_0x3f7192-0x0;var _0x251e82=_0x9f0e[_0x3f7192];return _0x251e82;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var path=require(_0xe9f0('0x2'));var timeout=require(_0xe9f0('0x3'));var express=require(_0xe9f0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe9f0('0x5'));var interaction=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var controller=require(_0xe9f0('0x8'));router[_0xe9f0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe9f0('0x9')](_0xe9f0('0xa'),auth[_0xe9f0('0xb')](),controller['describe']);router[_0xe9f0('0x9')](_0xe9f0('0xc'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0x9')](_0xe9f0('0xe'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x9')]('/:id/canned_answers',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x10')]);router[_0xe9f0('0x9')]('/:id/users',auth[_0xe9f0('0xb')](),controller['getAgents']);router[_0xe9f0('0x9')](_0xe9f0('0x11'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x12')]);router['post']('/',auth[_0xe9f0('0xb')](),controller['create']);router[_0xe9f0('0x13')](_0xe9f0('0xe'),auth[_0xe9f0('0xb')](),controller['addDisposition']);router[_0xe9f0('0x13')](_0xe9f0('0x14'),auth[_0xe9f0('0xb')](),controller['addAnswer']);router[_0xe9f0('0x13')](_0xe9f0('0x15'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x16')]);router[_0xe9f0('0x13')](_0xe9f0('0x11'),auth[_0xe9f0('0xb')](),controller['addApplications']);router[_0xe9f0('0x13')](_0xe9f0('0x17'),controller[_0xe9f0('0x18')]);router['post'](_0xe9f0('0x19'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x1a')]);router[_0xe9f0('0x1b')]('/:id',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x1c')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe9f0('0x1d')]);router[_0xe9f0('0x1e')](_0xe9f0('0xe'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x1f')]);router['delete'](_0xe9f0('0x14'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x20')]);router[_0xe9f0('0x1e')](_0xe9f0('0x15'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0x21')]);module[_0xe9f0('0x22')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 0331ffe..4be9c82 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 _0x8168=['sequelize','randomstring','STRING','name','generate','sinch','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8168,0xcc));var _0x8816=function(_0x329905,_0x13c144){_0x329905=_0x329905-0x0;var _0x3aa42=_0x8168[_0x329905];return _0x3aa42;};'use strict';var Sequelize=require(_0x8816('0x0'));var rs=require(_0x8816('0x1'));module['exports']={'name':{'type':Sequelize[_0x8816('0x2')],'unique':_0x8816('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x8816('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x8816('0x2')],'defaultValue':function(){return rs[_0x8816('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM']('twilio',_0x8816('0x5'))},'accountSid':{'type':Sequelize[_0x8816('0x2')]},'baseUrl':{'type':Sequelize[_0x8816('0x2')]},'authToken':{'type':Sequelize[_0x8816('0x2')]},'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[_0x8816('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8816('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8816('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8816('0x7')],'comment':_0x8816('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x8816('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2a779a){if(!_0x2a779a){this[_0x8816('0x9')](_0x8816('0xa'),null);}this[_0x8816('0x9')](_0x8816('0xb'),_0x2a779a);}},'description':{'type':Sequelize[_0x8816('0x2')]}}; \ No newline at end of file +var _0xec33=['sinch','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','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio'];(function(_0x34025d,_0x5c6de7){var _0x4d51e7=function(_0x5615a2){while(--_0x5615a2){_0x34025d['push'](_0x34025d['shift']());}};_0x4d51e7(++_0x5c6de7);}(_0xec33,0x108));var _0x3ec3=function(_0x13f3e7,_0x22c4d3){_0x13f3e7=_0x13f3e7-0x0;var _0x225877=_0xec33[_0x13f3e7];return _0x225877;};'use strict';var Sequelize=require(_0x3ec3('0x0'));var rs=require(_0x3ec3('0x1'));module[_0x3ec3('0x2')]={'name':{'type':Sequelize[_0x3ec3('0x3')],'unique':_0x3ec3('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x3ec3('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x3ec3('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x3ec3('0x3')],'defaultValue':function(){return rs[_0x3ec3('0x5')]();}},'phone':{'type':Sequelize[_0x3ec3('0x3')]},'type':{'type':Sequelize[_0x3ec3('0x6')](_0x3ec3('0x7'),_0x3ec3('0x8'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x3ec3('0x3')]},'authToken':{'type':Sequelize[_0x3ec3('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x3ec3('0x9');}},'notificationSound':{'type':Sequelize[_0x3ec3('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x3ec3('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3ec3('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3ec3('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3ec3('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3ec3('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3ec3('0xb')],'comment':_0x3ec3('0xc')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x3ec3('0xd'),'set':function(_0x4e9644){if(!_0x4e9644){this[_0x3ec3('0xe')](_0x3ec3('0xf'),null);}this['setDataValue'](_0x3ec3('0x10'),_0x4e9644);}},'description':{'type':Sequelize[_0x3ec3('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index dc65d87..b845148 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 _0x7009=['ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','whatsapp:','Body','messageId','notifications','isNil','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','contact','WhatsappInteraction','interaction','autoclose','close','unmanaged','*,*,*,*','created','AttachmentId','UserId','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','stringify','set','Content-Type','text/xml','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','CmList','List','out','dataValues','Messages','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','client','http','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','WhatsappAccounts','sendStatus','stack','name','send','index','Pause','map','WhatsappAccount','fieldName','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','findAll','rows','show','params','mandatoryDispositionPause','intersection','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','rawAttributes','merge','include','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','message_id','applications','orderBy','asc','CmContact','Sequelize'];(function(_0xd589b6,_0x49fce9){var _0x4231bd=function(_0x163474){while(--_0x163474){_0xd589b6['push'](_0xd589b6['shift']());}};_0x4231bd(++_0x49fce9);}(_0x7009,0x1c4));var _0x9700=function(_0x55fc38,_0x19bc7d){_0x55fc38=_0x55fc38-0x0;var _0x3cd5e4=_0x7009[_0x55fc38];return _0x3cd5e4;};'use strict';var emlformat=require(_0x9700('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9700('0x1'));var jsonpatch=require(_0x9700('0x2'));var rp=require(_0x9700('0x3'));var moment=require(_0x9700('0x4'));var BPromise=require(_0x9700('0x5'));var Mustache=require(_0x9700('0x6'));var util=require(_0x9700('0x7'));var path=require('path');var sox=require(_0x9700('0x8'));var csv=require('to-csv');var ejs=require(_0x9700('0x9'));var fs=require('fs');var fs_extra=require(_0x9700('0xa'));var _=require(_0x9700('0xb'));var squel=require(_0x9700('0xc'));var crypto=require(_0x9700('0xd'));var jsforce=require(_0x9700('0xe'));var deskjs=require(_0x9700('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9700('0x10'));var Papa=require(_0x9700('0x11'));var Redis=require(_0x9700('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9700('0x13'));var as=require(_0x9700('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9700('0x15'))(_0x9700('0x16'));var utils=require(_0x9700('0x17'));var config=require(_0x9700('0x18'));var licenseUtil=require(_0x9700('0x19'));var db=require(_0x9700('0x1a'))['db'];config['redis']=_[_0x9700('0x1b')](config[_0x9700('0x1c')],{'host':_0x9700('0x1d'),'port':0x18eb});var socket=require(_0x9700('0x1e'))(new Redis(config[_0x9700('0x1c')]));require(_0x9700('0x1f'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x9700('0x20')][_0x9700('0x21')]({'port':0x232c});function respondWithRpcPromise(_0xceed3e,_0x190547,_0x317ebe,_0x58ebb9){return new BPromise(function(_0x5445d7,_0x508f77){var _0x108d83=_0x58ebb9||client;return _0x108d83[_0x9700('0x22')](_0xceed3e,_0x317ebe)['then'](function(_0x4f44db){logger[_0x9700('0x23')](_0x9700('0x24'),_0x190547,_0x9700('0x25'));logger[_0x9700('0x26')](_0x9700('0x27'),_0x190547,_0x9700('0x25'),JSON['stringify'](_0x4f44db));if(_0x4f44db[_0x9700('0x28')]){if(_0x4f44db[_0x9700('0x28')]['code']===0x1f4){logger[_0x9700('0x28')](_0x9700('0x24'),_0x190547,_0x4f44db[_0x9700('0x28')]['message']);return _0x508f77(_0x4f44db[_0x9700('0x28')][_0x9700('0x29')]);}logger[_0x9700('0x28')](_0x9700('0x24'),_0x190547,_0x4f44db[_0x9700('0x28')]['message']);return _0x5445d7(_0x4f44db[_0x9700('0x28')][_0x9700('0x29')]);}else{logger['info'](_0x9700('0x24'),_0x190547,'request\x20sent');_0x5445d7(_0x4f44db['result'][_0x9700('0x29')]);}})['catch'](function(_0x61883b){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x190547,_0x61883b);_0x508f77(_0x61883b);});});}function respondWithStatusCode(_0x39ed63,_0x1d8ece){_0x1d8ece=_0x1d8ece||0xcc;return function(_0x36bbf0){if(_0x36bbf0){return _0x39ed63['sendStatus'](_0x1d8ece);}return _0x39ed63['status'](_0x1d8ece)[_0x9700('0x2a')]();};}function respondWithResult(_0x2d3ced,_0x198077){_0x198077=_0x198077||0xc8;return function(_0x3f1777){if(_0x3f1777){return _0x2d3ced[_0x9700('0x2b')](_0x198077)[_0x9700('0x2c')](_0x3f1777);}};}function respondWithFilteredResult(_0x95b37,_0x43fc68){return function(_0x1fff3b){if(_0x1fff3b){var _0x121a2f=typeof _0x43fc68[_0x9700('0x2d')]===_0x9700('0x2e')&&typeof _0x43fc68[_0x9700('0x2f')]==='undefined';var _0x2f4918=_0x1fff3b['count'];var _0x537dcf=_0x121a2f?0x0:_0x43fc68[_0x9700('0x2d')];var _0x10ed89=_0x121a2f?_0x1fff3b[_0x9700('0x30')]:_0x43fc68[_0x9700('0x2d')]+_0x43fc68[_0x9700('0x2f')];var _0x36958f;if(_0x10ed89>=_0x2f4918){_0x10ed89=_0x2f4918;_0x36958f=0xc8;}else{_0x36958f=0xce;}_0x95b37[_0x9700('0x2b')](_0x36958f);return _0x95b37['set'](_0x9700('0x31'),_0x537dcf+'-'+_0x10ed89+'/'+_0x2f4918)[_0x9700('0x2c')](_0x1fff3b);}return null;};}function patchUpdates(_0x393f98){return function(_0x2e8a44){try{jsonpatch[_0x9700('0x32')](_0x2e8a44,_0x393f98,!![]);}catch(_0x590463){return BPromise[_0x9700('0x33')](_0x590463);}return _0x2e8a44[_0x9700('0x34')]();};}function saveUpdates(_0xdad5f6,_0x2918b7){return function(_0x3c4e45){if(_0x3c4e45){return _0x3c4e45[_0x9700('0x35')](_0xdad5f6)[_0x9700('0x36')](function(_0x3e2b16){return _0x3e2b16;});}return null;};}function removeEntity(_0x231c9e,_0x30f81d){return function(_0x710bae){if(_0x710bae){return _0x710bae[_0x9700('0x37')]()['then'](function(){var _0x23c5ed=_0x710bae[_0x9700('0x38')]({'plain':!![]});var _0x289a45=_0x9700('0x39');return db['UserProfileResource'][_0x9700('0x37')]({'where':{'type':_0x289a45,'resourceId':_0x23c5ed['id']}})[_0x9700('0x36')](function(){return _0x710bae;});})[_0x9700('0x36')](function(){_0x231c9e[_0x9700('0x2b')](0xcc)[_0x9700('0x2a')]();});}};}function handleEntityNotFound(_0x4cda2a,_0x36f564){return function(_0x195284){if(!_0x195284){_0x4cda2a[_0x9700('0x3a')](0x194);}return _0x195284;};}function handleError(_0xc22d67,_0x27cd61){_0x27cd61=_0x27cd61||0x1f4;return function(_0xbb9902){logger[_0x9700('0x28')](_0xbb9902[_0x9700('0x3b')]);if(_0xbb9902[_0x9700('0x3c')]){delete _0xbb9902['name'];}_0xc22d67[_0x9700('0x2b')](_0x27cd61)[_0x9700('0x3d')](_0xbb9902);};}exports[_0x9700('0x3e')]=function(_0x640b55,_0xf5ac56){var _0x219cd2={'include':[{'model':db[_0x9700('0x3f')],'as':'mandatoryDispositionPause'}]},_0x3fdc57={},_0x2ebba8={'count':0x0,'rows':[]};var _0xef64=_[_0x9700('0x40')](db[_0x9700('0x41')]['rawAttributes'],function(_0x3f7e3c){return{'name':_0x3f7e3c[_0x9700('0x42')],'type':_0x3f7e3c['type'][_0x9700('0x43')]};});_0x3fdc57['model']=_[_0x9700('0x40')](_0xef64,_0x9700('0x3c'));_0x3fdc57[_0x9700('0x44')]=_[_0x9700('0x45')](_0x640b55['query']);_0x3fdc57[_0x9700('0x46')]=_['intersection'](_0x3fdc57[_0x9700('0x47')],_0x3fdc57[_0x9700('0x44')]);_0x219cd2[_0x9700('0x48')]=_['intersection'](_0x3fdc57[_0x9700('0x47')],qs[_0x9700('0x49')](_0x640b55[_0x9700('0x44')][_0x9700('0x49')]));_0x219cd2[_0x9700('0x48')]=_0x219cd2['attributes'][_0x9700('0x4a')]?_0x219cd2[_0x9700('0x48')]:_0x3fdc57['model'];if(!_0x640b55[_0x9700('0x44')][_0x9700('0x4b')](_0x9700('0x4c'))){_0x219cd2[_0x9700('0x2f')]=qs[_0x9700('0x2f')](_0x640b55[_0x9700('0x44')][_0x9700('0x2f')]);_0x219cd2[_0x9700('0x2d')]=qs['offset'](_0x640b55[_0x9700('0x44')][_0x9700('0x2d')]);}_0x219cd2[_0x9700('0x4d')]=qs[_0x9700('0x4e')](_0x640b55[_0x9700('0x44')][_0x9700('0x4e')]);_0x219cd2[_0x9700('0x4f')]=qs[_0x9700('0x46')](_[_0x9700('0x50')](_0x640b55[_0x9700('0x44')],_0x3fdc57[_0x9700('0x46')]),_0xef64);if(_0x640b55[_0x9700('0x44')][_0x9700('0x51')]){_0x219cd2['where']=_['merge'](_0x219cd2[_0x9700('0x4f')],{'$or':_[_0x9700('0x40')](_0xef64,function(_0xb025d1){if(_0xb025d1[_0x9700('0x52')]!==_0x9700('0x53')){var _0x21e4b8={};_0x21e4b8[_0xb025d1['name']]={'$like':'%'+_0x640b55[_0x9700('0x44')][_0x9700('0x51')]+'%'};return _0x21e4b8;}})});}_0x219cd2=_['merge']({},_0x219cd2,_0x640b55[_0x9700('0x54')]);var _0x3d1bfc={'where':_0x219cd2['where']};return db['WhatsappAccount'][_0x9700('0x30')](_0x3d1bfc)[_0x9700('0x36')](function(_0x4f7087){_0x2ebba8[_0x9700('0x30')]=_0x4f7087;if(_0x640b55[_0x9700('0x44')]['includeAll']){_0x219cd2['include']=[{'all':!![]}];}return db['WhatsappAccount'][_0x9700('0x55')](_0x219cd2);})[_0x9700('0x36')](function(_0x320efb){_0x2ebba8[_0x9700('0x56')]=_0x320efb;return _0x2ebba8;})['then'](respondWithFilteredResult(_0xf5ac56,_0x219cd2))['catch'](handleError(_0xf5ac56,null));};exports[_0x9700('0x57')]=function(_0x4656a9,_0x49f6ee){var _0x29fb96={'raw':![],'where':{'id':_0x4656a9[_0x9700('0x58')]['id']},'include':[{'model':db[_0x9700('0x3f')],'as':_0x9700('0x59')}]},_0x41fc04={};_0x41fc04[_0x9700('0x47')]=_[_0x9700('0x45')](db['WhatsappAccount']['rawAttributes']);_0x41fc04['query']=_[_0x9700('0x45')](_0x4656a9[_0x9700('0x44')]);_0x41fc04[_0x9700('0x46')]=_['intersection'](_0x41fc04[_0x9700('0x47')],_0x41fc04['query']);_0x29fb96[_0x9700('0x48')]=_[_0x9700('0x5a')](_0x41fc04[_0x9700('0x47')],qs[_0x9700('0x49')](_0x4656a9[_0x9700('0x44')][_0x9700('0x49')]));_0x29fb96['attributes']=_0x29fb96[_0x9700('0x48')][_0x9700('0x4a')]?_0x29fb96[_0x9700('0x48')]:_0x41fc04['model'];if(_0x4656a9[_0x9700('0x44')][_0x9700('0x5b')]){_0x29fb96['include']=[{'all':!![]}];}_0x29fb96=_['merge']({},_0x29fb96,_0x4656a9[_0x9700('0x54')]);return db[_0x9700('0x41')][_0x9700('0x5c')](_0x29fb96)['then'](handleEntityNotFound(_0x49f6ee,null))['then'](respondWithResult(_0x49f6ee,null))[_0x9700('0x5d')](handleError(_0x49f6ee,null));};exports[_0x9700('0x5e')]=function(_0x429965,_0x3ad29e){return db[_0x9700('0x41')]['create'](_0x429965[_0x9700('0x5f')],{})[_0x9700('0x36')](function(_0x57475f){var _0xd0991c=_0x429965[_0x9700('0x60')]['get']({'plain':!![]});if(!_0xd0991c)throw new Error(_0x9700('0x61'));if(_0xd0991c[_0x9700('0x62')]==='user'){var _0x1eeaaf=_0x57475f[_0x9700('0x38')]({'plain':!![]});var _0x1dda73=_0x9700('0x39');return db[_0x9700('0x63')]['find']({'where':{'name':_0x1dda73,'userProfileId':_0xd0991c['userProfileId']},'raw':!![]})[_0x9700('0x36')](function(_0x2ac471){if(_0x2ac471&&_0x2ac471[_0x9700('0x64')]===0x0){return db[_0x9700('0x65')]['create']({'name':_0x1eeaaf[_0x9700('0x3c')],'resourceId':_0x1eeaaf['id'],'type':_0x2ac471[_0x9700('0x3c')],'sectionId':_0x2ac471['id']},{})[_0x9700('0x36')](function(){return _0x57475f;});}else{return _0x57475f;}})[_0x9700('0x5d')](function(_0x1ae731){logger[_0x9700('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ae731);throw _0x1ae731;});}return _0x57475f;})[_0x9700('0x36')](respondWithResult(_0x3ad29e,0xc9))[_0x9700('0x5d')](handleError(_0x3ad29e,null));};exports[_0x9700('0x35')]=function(_0x206d64,_0x4a81ea){if(_0x206d64[_0x9700('0x5f')]['id']){delete _0x206d64[_0x9700('0x5f')]['id'];}return db[_0x9700('0x41')][_0x9700('0x5c')]({'where':{'id':_0x206d64[_0x9700('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0x9700('0x59')}]})[_0x9700('0x36')](handleEntityNotFound(_0x4a81ea,null))[_0x9700('0x36')](saveUpdates(_0x206d64['body'],null))[_0x9700('0x36')](respondWithResult(_0x4a81ea,null))[_0x9700('0x5d')](handleError(_0x4a81ea,null));};exports[_0x9700('0x37')]=function(_0xad708e,_0x2d5491){return db[_0x9700('0x41')][_0x9700('0x5c')]({'where':{'id':_0xad708e[_0x9700('0x58')]['id']}})[_0x9700('0x36')](handleEntityNotFound(_0x2d5491,null))[_0x9700('0x36')](removeEntity(_0x2d5491,null))[_0x9700('0x5d')](handleError(_0x2d5491,null));};exports[_0x9700('0x66')]=function(_0x4e82e8,_0x3bf2ab){return db[_0x9700('0x41')][_0x9700('0x66')]()[_0x9700('0x36')](respondWithResult(_0x3bf2ab,null))[_0x9700('0x5d')](handleError(_0x3bf2ab,null));};exports[_0x9700('0x67')]=function(_0x4d4614,_0x2da116,_0x1df85e){if(_0x4d4614[_0x9700('0x5f')]['id']){delete _0x4d4614['body']['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x4d4614[_0x9700('0x58')]['id']}})[_0x9700('0x36')](handleEntityNotFound(_0x2da116,null))[_0x9700('0x36')](function(_0x5e0788){if(_0x5e0788){_0x4d4614['body'][_0x9700('0x68')]=_0x5e0788['id'];return db['Disposition'][_0x9700('0x5e')](_0x4d4614[_0x9700('0x5f')]);}})[_0x9700('0x36')](respondWithResult(_0x2da116,null))[_0x9700('0x5d')](handleError(_0x2da116,null));};exports[_0x9700('0x69')]=function(_0x50a00d,_0x2df0ca,_0x336e55){var _0x33263e={'raw':![],'where':{}};var _0x101e1c={};var _0x47041a={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x9700('0x6a')]({'where':{'id':_0x50a00d[_0x9700('0x58')]['id']}})['then'](handleEntityNotFound(_0x2df0ca,null))[_0x9700('0x36')](function(_0x5b5563){if(_0x5b5563){_0x101e1c[_0x9700('0x47')]=_[_0x9700('0x45')](db[_0x9700('0x6b')][_0x9700('0x6c')]);_0x101e1c['query']=_[_0x9700('0x45')](_0x50a00d[_0x9700('0x44')]);_0x101e1c['filters']=_[_0x9700('0x5a')](_0x101e1c[_0x9700('0x47')],_0x101e1c[_0x9700('0x44')]);_0x33263e[_0x9700('0x48')]=_['intersection'](_0x101e1c[_0x9700('0x47')],qs['fields'](_0x50a00d[_0x9700('0x44')]['fields']));_0x33263e['attributes']=_0x33263e[_0x9700('0x48')][_0x9700('0x4a')]?_0x33263e['attributes']:_0x101e1c[_0x9700('0x47')];if(!_0x50a00d['query'][_0x9700('0x4b')]('nolimit')){_0x33263e[_0x9700('0x2f')]=qs['limit'](_0x50a00d['query'][_0x9700('0x2f')]);_0x33263e[_0x9700('0x2d')]=qs[_0x9700('0x2d')](_0x50a00d[_0x9700('0x44')]['offset']);}_0x33263e[_0x9700('0x4d')]=qs[_0x9700('0x4e')](_0x50a00d['query']['sort']);_0x33263e[_0x9700('0x4f')]=qs[_0x9700('0x46')](_[_0x9700('0x50')](_0x50a00d[_0x9700('0x44')],_0x101e1c[_0x9700('0x46')]));_0x33263e['where']['WhatsappAccountId']=_0x5b5563['id'];if(_0x50a00d['query']['filter']){_0x33263e[_0x9700('0x4f')]=_[_0x9700('0x6d')](_0x33263e[_0x9700('0x4f')],{'$or':_[_0x9700('0x40')](_0x33263e[_0x9700('0x48')],function(_0x250a88){var _0x4aa932={};_0x4aa932[_0x250a88]={'$like':'%'+_0x50a00d[_0x9700('0x44')][_0x9700('0x51')]+'%'};return _0x4aa932;})});}_0x33263e=_[_0x9700('0x6d')]({},_0x33263e,_0x50a00d['options']);return db[_0x9700('0x6b')][_0x9700('0x30')]({'where':_0x33263e[_0x9700('0x4f')]})[_0x9700('0x36')](function(_0x29346a){_0x47041a[_0x9700('0x30')]=_0x29346a;if(_0x50a00d['query'][_0x9700('0x5b')]){_0x33263e[_0x9700('0x6e')]=[{'all':!![]}];}return db[_0x9700('0x6b')][_0x9700('0x55')](_0x33263e);})['then'](function(_0x2cbddb){_0x47041a[_0x9700('0x56')]=_0x2cbddb;return _0x47041a;});}})[_0x9700('0x36')](respondWithFilteredResult(_0x2df0ca,_0x33263e))['catch'](handleError(_0x2df0ca,null));};exports['removeDispositions']=function(_0x2189df,_0x34e19f,_0x231e9f){return db[_0x9700('0x41')][_0x9700('0x5c')]({'where':{'id':_0x2189df['params']['id']}})[_0x9700('0x36')](handleEntityNotFound(_0x34e19f,null))[_0x9700('0x36')](function(_0x80d848){if(_0x80d848){return _0x80d848[_0x9700('0x6f')](_0x2189df['query'][_0x9700('0x70')]);}})[_0x9700('0x36')](respondWithStatusCode(_0x34e19f,null))[_0x9700('0x5d')](handleError(_0x34e19f,null));};exports[_0x9700('0x71')]=function(_0x58d369,_0x3f6ef8,_0x262787){if(_0x58d369[_0x9700('0x5f')]['id']){delete _0x58d369[_0x9700('0x5f')]['id'];}return db[_0x9700('0x41')][_0x9700('0x5c')]({'where':{'id':_0x58d369[_0x9700('0x58')]['id']}})[_0x9700('0x36')](handleEntityNotFound(_0x3f6ef8,null))[_0x9700('0x36')](function(_0x416d95){if(_0x416d95){_0x58d369[_0x9700('0x5f')][_0x9700('0x68')]=_0x416d95['id'];return db[_0x9700('0x72')][_0x9700('0x5e')](_0x58d369[_0x9700('0x5f')]);}})[_0x9700('0x36')](respondWithResult(_0x3f6ef8,null))[_0x9700('0x5d')](handleError(_0x3f6ef8,null));};exports['getAnswers']=function(_0x5288bd,_0x4caee1,_0x12e219){var _0x17ea1b={'raw':![],'where':{}};var _0x41e18f={};var _0x59905f={'count':0x0,'rows':[]};return db[_0x9700('0x41')][_0x9700('0x6a')]({'where':{'id':_0x5288bd[_0x9700('0x58')]['id']}})['then'](handleEntityNotFound(_0x4caee1,null))[_0x9700('0x36')](function(_0x3cb3ef){if(_0x3cb3ef){_0x41e18f['model']=_[_0x9700('0x45')](db['CannedAnswer'][_0x9700('0x6c')]);_0x41e18f[_0x9700('0x44')]=_[_0x9700('0x45')](_0x5288bd[_0x9700('0x44')]);_0x41e18f[_0x9700('0x46')]=_[_0x9700('0x5a')](_0x41e18f['model'],_0x41e18f[_0x9700('0x44')]);_0x17ea1b['attributes']=_[_0x9700('0x5a')](_0x41e18f[_0x9700('0x47')],qs[_0x9700('0x49')](_0x5288bd[_0x9700('0x44')][_0x9700('0x49')]));_0x17ea1b[_0x9700('0x48')]=_0x17ea1b[_0x9700('0x48')][_0x9700('0x4a')]?_0x17ea1b[_0x9700('0x48')]:_0x41e18f[_0x9700('0x47')];if(!_0x5288bd[_0x9700('0x44')][_0x9700('0x4b')]('nolimit')){_0x17ea1b[_0x9700('0x2f')]=qs[_0x9700('0x2f')](_0x5288bd['query'][_0x9700('0x2f')]);_0x17ea1b[_0x9700('0x2d')]=qs[_0x9700('0x2d')](_0x5288bd['query'][_0x9700('0x2d')]);}_0x17ea1b[_0x9700('0x4d')]=qs[_0x9700('0x4e')](_0x5288bd[_0x9700('0x44')]['sort']);_0x17ea1b[_0x9700('0x4f')]=qs['filters'](_[_0x9700('0x50')](_0x5288bd[_0x9700('0x44')],_0x41e18f[_0x9700('0x46')]));_0x17ea1b[_0x9700('0x4f')][_0x9700('0x68')]=_0x3cb3ef['id'];if(_0x5288bd[_0x9700('0x44')][_0x9700('0x51')]){_0x17ea1b[_0x9700('0x4f')]=_[_0x9700('0x6d')](_0x17ea1b['where'],{'$or':_['map'](_0x17ea1b[_0x9700('0x48')],function(_0x5f0f7c){var _0x5acab1={};_0x5acab1[_0x5f0f7c]={'$like':'%'+_0x5288bd[_0x9700('0x44')][_0x9700('0x51')]+'%'};return _0x5acab1;})});}_0x17ea1b=_[_0x9700('0x6d')]({},_0x17ea1b,_0x5288bd[_0x9700('0x54')]);return db[_0x9700('0x72')][_0x9700('0x30')]({'where':_0x17ea1b['where']})['then'](function(_0x899527){_0x59905f[_0x9700('0x30')]=_0x899527;if(_0x5288bd[_0x9700('0x44')][_0x9700('0x5b')]){_0x17ea1b[_0x9700('0x6e')]=[{'all':!![]}];}return db[_0x9700('0x72')][_0x9700('0x55')](_0x17ea1b);})[_0x9700('0x36')](function(_0x275296){_0x59905f[_0x9700('0x56')]=_0x275296;return _0x59905f;});}})['then'](respondWithFilteredResult(_0x4caee1,_0x17ea1b))[_0x9700('0x5d')](handleError(_0x4caee1,null));};exports[_0x9700('0x73')]=function(_0x2a5120,_0x2e976d,_0x26d86b){return db[_0x9700('0x41')]['find']({'where':{'id':_0x2a5120[_0x9700('0x58')]['id']}})['then'](handleEntityNotFound(_0x2e976d,null))[_0x9700('0x36')](function(_0x4a07f0){if(_0x4a07f0){return _0x4a07f0[_0x9700('0x73')](_0x2a5120[_0x9700('0x44')]['ids']);}})[_0x9700('0x36')](respondWithStatusCode(_0x2e976d,null))[_0x9700('0x5d')](handleError(_0x2e976d,null));};exports['addAgents']=function(_0x1d961e,_0x409253,_0x23ce1a){return db[_0x9700('0x41')][_0x9700('0x5c')]({'where':{'id':_0x1d961e[_0x9700('0x58')]['id']}})[_0x9700('0x36')](handleEntityNotFound(_0x409253,null))[_0x9700('0x36')](function(_0x503595){if(_0x503595){return _0x503595[_0x9700('0x74')](_0x1d961e[_0x9700('0x5f')][_0x9700('0x70')],_[_0x9700('0x75')](_0x1d961e['body'],[_0x9700('0x70'),'id'])||{})[_0x9700('0x76')](function(_0x166686){for(var _0x2c9477=0x0;_0x2c9477<_0x1d961e[_0x9700('0x5f')][_0x9700('0x70')][_0x9700('0x4a')];_0x2c9477+=0x1){socket[_0x9700('0x77')]('userWhatsappAccount:save',{'UserId':Number(_0x1d961e[_0x9700('0x5f')][_0x9700('0x70')][_0x2c9477]),'WhatsappAccountId':Number(_0x1d961e[_0x9700('0x58')]['id'])});}return _0x166686;});}})[_0x9700('0x36')](respondWithResult(_0x409253,null))['catch'](handleError(_0x409253,null));};exports['removeAgents']=function(_0x448a9,_0x4b01c2,_0x55436a){return db[_0x9700('0x41')][_0x9700('0x5c')]({'where':{'id':_0x448a9[_0x9700('0x58')]['id']}})[_0x9700('0x36')](handleEntityNotFound(_0x4b01c2,null))[_0x9700('0x36')](function(_0x15b9cf){if(_0x15b9cf){return _0x15b9cf[_0x9700('0x78')](_0x448a9[_0x9700('0x44')][_0x9700('0x70')])['then'](function(){if(_[_0x9700('0x79')](_0x448a9[_0x9700('0x44')][_0x9700('0x70')])){for(var _0x5b3acf=0x0;_0x5b3acf<_0x448a9[_0x9700('0x44')][_0x9700('0x70')]['length'];_0x5b3acf+=0x1){socket[_0x9700('0x77')]('userWhatsappAccount:remove',{'UserId':Number(_0x448a9['query'][_0x9700('0x70')][_0x5b3acf]),'WhatsappAccountId':Number(_0x448a9[_0x9700('0x58')]['id'])});}}else{socket[_0x9700('0x77')](_0x9700('0x7a'),{'UserId':Number(_0x448a9[_0x9700('0x44')]['ids']),'WhatsappAccountId':Number(_0x448a9['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4b01c2,null))[_0x9700('0x5d')](handleError(_0x4b01c2,null));};exports[_0x9700('0x7b')]=function(_0x556c17,_0x1bed12,_0x42e2c6){var _0x1039e7={};var _0x51d837={};var _0x106d04;var _0x51cfe7;return db[_0x9700('0x41')][_0x9700('0x6a')]({'where':{'id':_0x556c17['params']['id']}})[_0x9700('0x36')](handleEntityNotFound(_0x1bed12,null))['then'](function(_0x1da5c7){if(_0x1da5c7){_0x106d04=_0x1da5c7;_0x51d837[_0x9700('0x47')]=_[_0x9700('0x45')](db[_0x9700('0x7c')][_0x9700('0x6c')]);_0x51d837['query']=_[_0x9700('0x45')](_0x556c17[_0x9700('0x44')]);_0x51d837[_0x9700('0x46')]=_['intersection'](_0x51d837[_0x9700('0x47')],_0x51d837['query']);_0x1039e7['attributes']=_[_0x9700('0x5a')](_0x51d837['model'],qs[_0x9700('0x49')](_0x556c17['query'][_0x9700('0x49')]));_0x1039e7[_0x9700('0x48')]=_0x1039e7['attributes']['length']?_0x1039e7[_0x9700('0x48')]:_0x51d837[_0x9700('0x47')];_0x1039e7[_0x9700('0x4d')]=qs[_0x9700('0x4e')](_0x556c17[_0x9700('0x44')]['sort']);_0x1039e7['where']=qs[_0x9700('0x46')](_[_0x9700('0x50')](_0x556c17[_0x9700('0x44')],_0x51d837['filters']));if(_0x556c17['query'][_0x9700('0x51')]){_0x1039e7[_0x9700('0x4f')]=_[_0x9700('0x6d')](_0x1039e7['where'],{'$or':_['map'](_0x1039e7['attributes'],function(_0x538670){var _0x3b3cec={};_0x3b3cec[_0x538670]={'$like':'%'+_0x556c17[_0x9700('0x44')][_0x9700('0x51')]+'%'};return _0x3b3cec;})});}_0x1039e7=_[_0x9700('0x6d')]({},_0x1039e7,_0x556c17[_0x9700('0x54')]);return _0x106d04[_0x9700('0x7b')](_0x1039e7);}})[_0x9700('0x36')](function(_0x1cfa24){if(_0x1cfa24){_0x51cfe7=_0x1cfa24[_0x9700('0x4a')];if(!_0x556c17[_0x9700('0x44')]['hasOwnProperty'](_0x9700('0x4c'))){_0x1039e7[_0x9700('0x2f')]=qs['limit'](_0x556c17['query'][_0x9700('0x2f')]);_0x1039e7[_0x9700('0x2d')]=qs[_0x9700('0x2d')](_0x556c17['query']['offset']);}return _0x106d04['getAgents'](_0x1039e7);}})['then'](function(_0x51a374){if(_0x51a374){return _0x51a374?{'count':_0x51cfe7,'rows':_0x51a374}:null;}})[_0x9700('0x36')](respondWithResult(_0x1bed12,null))[_0x9700('0x5d')](handleError(_0x1bed12,null));};exports[_0x9700('0x7d')]=function(_0x41ee90,_0x243a17){var _0x56da7d=_0x41ee90[_0x9700('0x58')]['id'];var _0x414e9c=_0x41ee90[_0x9700('0x5f')];var _0x544f0a=0xc8;var _0x246768=null;return db[_0x9700('0x7e')][_0x9700('0x7f')]({'isolationLevel':db['sequelize'][_0x9700('0x80')][_0x9700('0x81')][_0x9700('0x82')]},function(_0x1da45e){return db[_0x9700('0x41')][_0x9700('0x6a')]({'where':{'id':_0x56da7d},'transaction':_0x1da45e})[_0x9700('0x36')](function(_0x40ea8a){if(_0x40ea8a){return db[_0x9700('0x83')]['destroy']({'where':{'WhatsappAccountId':_0x56da7d},'transaction':_0x1da45e})[_0x9700('0x36')](function(){var _0x413ff0=_[_0x9700('0x40')](_0x414e9c,function(_0x36f25c){_0x36f25c[_0x9700('0x68')]=_0x56da7d;return _0x36f25c;});return db[_0x9700('0x83')][_0x9700('0x84')](_0x413ff0,{'transaction':_0x1da45e});});}else{_0x544f0a=0x194;_0x246768=[];}});})[_0x9700('0x36')](function(){if(_0x544f0a!==0x194){return db[_0x9700('0x83')][_0x9700('0x85')]({'where':{'WhatsappAccountId':_0x56da7d},'order':_0x9700('0x86')})[_0x9700('0x36')](function(_0x132e1e){_0x246768=_0x132e1e;});}})[_0x9700('0x5d')](function(_0x3eb8d2){_0x544f0a=0x1f4;logger['error'](_0x3eb8d2[_0x9700('0x3b')]);if(_0x3eb8d2['name']){delete _0x3eb8d2[_0x9700('0x3c')];}_0x246768=_0x3eb8d2;})['finally'](function(){if(_0x246768===null){_0x243a17[_0x9700('0x3a')](_0x544f0a);}else{if(_0x544f0a===0x1f4){_0x243a17[_0x9700('0x2b')](_0x544f0a)['send'](_0x246768);}else{_0x243a17[_0x9700('0x2b')](_0x544f0a)[_0x9700('0x2c')](_0x246768);}}});};exports[_0x9700('0x87')]=function(_0x5ecd82,_0x4e13e9,_0x405d3a){var _0x3ed4a7={};var _0x3ed28b={};var _0x1b9a43;var _0xbeb8a6;return db[_0x9700('0x41')][_0x9700('0x6a')]({'where':{'id':_0x5ecd82[_0x9700('0x58')]['id']}})[_0x9700('0x36')](handleEntityNotFound(_0x4e13e9,null))['then'](function(_0x26dcec){if(_0x26dcec){_0x1b9a43=_0x26dcec;_0x3ed28b[_0x9700('0x47')]=_['keys'](db[_0x9700('0x83')][_0x9700('0x6c')]);_0x3ed28b[_0x9700('0x44')]=_[_0x9700('0x45')](_0x5ecd82[_0x9700('0x44')]);_0x3ed28b[_0x9700('0x46')]=_[_0x9700('0x5a')](_0x3ed28b[_0x9700('0x47')],_0x3ed28b['query']);_0x3ed4a7['attributes']=_[_0x9700('0x5a')](_0x3ed28b['model'],qs[_0x9700('0x49')](_0x5ecd82[_0x9700('0x44')][_0x9700('0x49')]));_0x3ed4a7[_0x9700('0x48')]=_0x3ed4a7['attributes']['length']?_0x3ed4a7['attributes']:_0x3ed28b[_0x9700('0x47')];_0x3ed4a7[_0x9700('0x4d')]=qs[_0x9700('0x4e')](_0x5ecd82[_0x9700('0x44')]['sort']);_0x3ed4a7['where']=qs[_0x9700('0x46')](_[_0x9700('0x50')](_0x5ecd82[_0x9700('0x44')],_0x3ed28b[_0x9700('0x46')]));if(_0x5ecd82[_0x9700('0x44')][_0x9700('0x51')]){_0x3ed4a7[_0x9700('0x4f')]=_[_0x9700('0x6d')](_0x3ed4a7[_0x9700('0x4f')],{'$or':_['map'](_0x3ed4a7[_0x9700('0x48')],function(_0x24afc0){var _0x245ddb={};_0x245ddb[_0x24afc0]={'$like':'%'+_0x5ecd82[_0x9700('0x44')][_0x9700('0x51')]+'%'};return _0x245ddb;})});}_0x3ed4a7=_[_0x9700('0x6d')]({},_0x3ed4a7,_0x5ecd82[_0x9700('0x54')]);return _0x1b9a43[_0x9700('0x87')](_0x3ed4a7);}})[_0x9700('0x36')](function(_0x547123){if(_0x547123){_0xbeb8a6=_0x547123[_0x9700('0x4a')];if(!_0x5ecd82[_0x9700('0x44')]['hasOwnProperty'](_0x9700('0x4c'))){_0x3ed4a7[_0x9700('0x2f')]=qs[_0x9700('0x2f')](_0x5ecd82[_0x9700('0x44')]['limit']);_0x3ed4a7[_0x9700('0x2d')]=qs[_0x9700('0x2d')](_0x5ecd82[_0x9700('0x44')][_0x9700('0x2d')]);}return _0x1b9a43[_0x9700('0x87')](_0x3ed4a7);}})[_0x9700('0x36')](function(_0x2c3360){if(_0x2c3360){return _0x2c3360?{'count':_0xbeb8a6,'rows':_0x2c3360}:null;}})['then'](respondWithResult(_0x4e13e9,null))['catch'](handleError(_0x4e13e9,null));};exports[_0x9700('0x88')]=function(_0x453c11,_0x3c1783,_0x3f5f3f){var _0x538100={'channel':_0x9700('0x89')};var _0x3c95df=[];var _0x5d8f4a=[];var _0x38230e={};return db[_0x9700('0x41')][_0x9700('0x5c')]({'where':{'id':_0x453c11[_0x9700('0x58')]['id']},'include':[{'model':db[_0x9700('0x83')],'as':_0x9700('0x8a')}]})[_0x9700('0x36')](handleEntityNotFound(_0x3c1783,null))['then'](function(_0x1e3f4c){_0x538100['account']=_0x1e3f4c;if(_0x538100['account']&&_0x538100[_0x9700('0x8b')]['type']===_0x9700('0x8c')&&_0x453c11[_0x9700('0x5f')]['statuses']){if(_0x453c11[_0x9700('0x5f')][_0x9700('0x8d')][_0x9700('0x4a')]===0x0)return;if(_0x453c11['body'][_0x9700('0x8d')][0x0][_0x9700('0x8e')]!==_0x9700('0x8f'))return;return db[_0x9700('0x90')]['update']({'read':!![],'readAt':_0x453c11[_0x9700('0x5f')][_0x9700('0x8d')][0x0]['timestamp']},{'where':{'messageId':_0x453c11[_0x9700('0x5f')]['statuses'][0x0][_0x9700('0x91')]},'individualHooks':!![]})[_0x9700('0x36')](function(_0x4bb5f9){return _0x3c1783[_0x9700('0x2b')](0xc8)['json'](_0x4bb5f9);});}_0x538100[_0x9700('0x92')]=_[_0x9700('0x93')](_0x1e3f4c['Applications'],[_0x9700('0x86')],[_0x9700('0x94')]);if(_0x538100[_0x9700('0x8b')][_0x9700('0x8a')]){delete _0x538100[_0x9700('0x8b')][_0x9700('0x8a')];}return db[_0x9700('0x95')][_0x9700('0x66')]()[_0x9700('0x36')](function(_0x2b9d9b){if(!_0x2b9d9b){throw new db[(_0x9700('0x96'))][(_0x9700('0x97'))](_0x9700('0x98'));}_0x3c95df=_[_0x9700('0x99')](_[_0x9700('0x45')](_0x2b9d9b),[_0x9700('0x9a'),'updatedAt']);_0x5d8f4a=_[_0x9700('0x99')](_[_0x9700('0x45')](_0x2b9d9b),['createdAt',_0x9700('0x9b'),_0x9700('0x9c'),_0x9700('0x9d')]);_0x538100[_0x9700('0x5f')]={'mapKey':_0x9700('0x9e')};if(_0x538100['account']&&_0x538100['account'][_0x9700('0x52')]===_0x9700('0x9f')){_0x538100[_0x9700('0x5f')][_0x9700('0xa0')]=_0x453c11[_0x9700('0x5f')][_0x9700('0xa1')]['replace'](_0x9700('0xa2'),'');_0x538100[_0x9700('0x5f')][_0x9700('0x5f')]=_0x453c11['body'][_0x9700('0xa3')];_0x538100[_0x9700('0x5f')][_0x9700('0xa4')]=_0x453c11[_0x9700('0x5f')]['MessageSid'];}if(_0x538100[_0x9700('0x8b')]&&_0x538100['account'][_0x9700('0x52')]==='sinch'){_0x538100['body'][_0x9700('0xa0')]=_0x453c11['body'][_0x9700('0xa5')][0x0]['from'];_0x538100[_0x9700('0x5f')]['body']=_0x453c11[_0x9700('0x5f')][_0x9700('0xa5')][0x0][_0x9700('0x29')][_0x9700('0x5f')];_0x538100[_0x9700('0x5f')][_0x9700('0xa4')]=_0x453c11[_0x9700('0x5f')]['notifications'][0x0][_0x9700('0x91')];}if(_0x538100[_0x9700('0x5f')]['id']){delete _0x538100[_0x9700('0x5f')]['id'];}if(_[_0x9700('0xa6')](_0x538100[_0x9700('0x5f')][_0x9700('0xa0')])){throw new db[(_0x9700('0x96'))][(_0x9700('0x97'))](_0x9700('0xa7'));}if(_[_0x9700('0xa6')](_0x538100['body'][_0x9700('0x5f')])||_0x538100[_0x9700('0x5f')][_0x9700('0x5f')]===''){throw new db['Sequelize'][(_0x9700('0x97'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x538100['body'][_0x9700('0xa8')])){throw new db[(_0x9700('0x96'))][(_0x9700('0x97'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5d8f4a);}if(!_[_0x9700('0xa9')](_0x5d8f4a,_0x538100[_0x9700('0x5f')][_0x9700('0xa8')])){throw new db['Sequelize'][(_0x9700('0x97'))](_0x9700('0xaa')+_0x5d8f4a);}_0x38230e[_0x538100['body'][_0x9700('0xa8')]]=_0x538100[_0x9700('0x5f')][_0x9700('0xa0')];return db['CmList']['find']({'where':{'id':_0x538100[_0x9700('0x8b')]['ListId']},'include':[{'model':db['CmContact'],'as':_0x9700('0xab'),'where':_0x38230e,'limit':0x1,'order':[[_0x9700('0x9b'),_0x9700('0xac')]]}]});})[_0x9700('0x36')](handleEntityNotFound(_0x3c1783,null))[_0x9700('0x36')](function(_0x275d5f){if(_0x275d5f){_0x538100[_0x9700('0xad')]=_[_0x9700('0x75')](_0x275d5f,['Contacts']);if(_0x275d5f[_0x9700('0xab')][_0x9700('0x4a')]){return _0x275d5f['Contacts'][0x0];}var _0x4092b1=_['defaults'](_0x538100[_0x9700('0x5f')],{'firstName':_0x538100['body'][_0x9700('0xa0')],'ListId':_0x275d5f['id']});_0x4092b1[_0x538100[_0x9700('0x5f')][_0x9700('0xa8')]]=_0x538100['body'][_0x9700('0xa0')];return db['CmContact']['create'](_0x4092b1,{'fields':_0x3c95df,'raw':!![]});}})[_0x9700('0x36')](handleEntityNotFound(_0x3c1783,null))['then'](function(_0x3bba67){if(_0x3bba67){_0x538100[_0x9700('0xae')]=_0x3bba67;var _0x2fa1da={'ContactId':_0x3bba67['id'],'phone':_0x538100[_0x9700('0x5f')][_0x9700('0xa0')],'WhatsappAccountId':_0x453c11[_0x9700('0x58')]['id']};var _0x3c1a91={'ContactId':_0x3bba67['id'],'WhatsappAccountId':_0x453c11[_0x9700('0x58')]['id'],'closed':![]};return db[_0x9700('0xaf')]['find']({'where':_0x3c1a91})[_0x9700('0x36')](function(_0x352c44){if(_0x352c44){return[_0x352c44,![]];}return db[_0x9700('0xaf')][_0x9700('0x5e')](_0x2fa1da)[_0x9700('0x36')](function(_0x92e40a){return[_0x92e40a,!![]];});});}})['spread'](function(_0x33d12b,_0x1d7988){_0x538100[_0x9700('0xb0')]=_0x33d12b[_0x9700('0x38')]({'plain':!![]});_0x538100[_0x9700('0xb0')]['created']=![];if(_0x1d7988){if(_0x538100[_0x9700('0x8b')][_0x9700('0xb1')]){_0x538100[_0x9700('0x92')]['push']({'id':0x0,'priority':_0x538100[_0x9700('0x92')][_0x9700('0x4a')]+0x1,'app':_0x9700('0xb2'),'appdata':_0x9700('0xb3'),'interval':_0x9700('0xb4')});}_0x538100[_0x9700('0xb0')][_0x9700('0xb5')]=!![];}return db[_0x9700('0x90')]['create']({'phone':_0x538100[_0x9700('0x5f')][_0x9700('0xa0')],'messageId':_0x538100['body']['messageId'],'body':_0x538100[_0x9700('0x5f')][_0x9700('0x5f')],'WhatsappAccountId':_0x453c11['params']['id'],'WhatsappInteractionId':_0x33d12b['id'],'direction':'in','ContactId':_0x33d12b['ContactId'],'AttachmentId':_0x538100[_0x9700('0x5f')][_0x9700('0xb6')]});})['then'](function(_0xa98a03){_0x538100[_0x9700('0x29')]=_0xa98a03;if(_0x538100[_0x9700('0xb0')][_0x9700('0xb7')]){return db[_0x9700('0x7c')][_0x9700('0x5c')]({'attributes':['id',_0x9700('0x3c')],'where':{'id':_0x538100[_0x9700('0xb0')][_0x9700('0xb7')]}})['then'](function(_0x3ca486){if(_0x3ca486){_0x538100[_0x9700('0x92')]['unshift']({'id':0x0,'priority':0x0,'app':_0x9700('0xb8'),'appdata':_0x3ca486[_0x9700('0x3c')]+','+(_0x538100[_0x9700('0x8b')][_0x9700('0xb9')]||0xa),'interval':_0x9700('0xb4')});}return respondWithRpcPromise(_0x9700('0xba'),_0x9700('0xbb'),_0x538100);});}return respondWithRpcPromise(_0x9700('0xba'),'startRouting',_0x538100);})[_0x9700('0x36')](function(_0x58cb7b){if(_0x58cb7b){var _0xa700ad=0xc8;var _0x18e8d6=_0x9700('0xbc');logger[_0x9700('0x23')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x18e8d6,_0xa700ad,_0x9700('0xbd'));logger[_0x9700('0x26')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x18e8d6,_0xa700ad,_0x9700('0xbd'),JSON[_0x9700('0xbe')](_0x58cb7b));if(_0x538100[_0x9700('0x8b')]['type']==='twilio'){return _0x3c1783[_0x9700('0x2b')](_0xa700ad)[_0x9700('0xbf')](_0x9700('0xc0'),_0x9700('0xc1'))[_0x9700('0x3d')]('\x0a');}else{return _0x3c1783[_0x9700('0x2b')](_0xa700ad)[_0x9700('0x2c')](_0x58cb7b);}}});})[_0x9700('0x5d')](handleError(_0x3c1783,null));};exports[_0x9700('0x3d')]=function(_0x1eb2a1,_0x1dfbb1,_0x12468d){var _0x4a88cf,_0x9a671a,_0x2e54e4;if(_[_0x9700('0xa6')](_0x1eb2a1[_0x9700('0x5f')][_0x9700('0x5f')])||_0x1eb2a1['body'][_0x9700('0x5f')]===''){throw new db[(_0x9700('0x96'))][(_0x9700('0x97'))](_0x9700('0xc2'));}if(_[_0x9700('0xa6')](_0x1eb2a1[_0x9700('0x5f')]['to'])){throw new db['Sequelize'][(_0x9700('0x97'))](_0x9700('0xc3'));}_0x4a88cf=_0x1eb2a1[_0x9700('0x5f')]['to'];return db[_0x9700('0x41')][_0x9700('0x5c')]({'where':{'id':_0x1eb2a1[_0x9700('0x58')]['id']},'include':[{'model':db[_0x9700('0xc4')],'as':'List','include':[{'model':db[_0x9700('0x95')],'as':_0x9700('0xab'),'where':{'mobile':_0x4a88cf},'limit':0x1,'order':[[_0x9700('0x9b'),_0x9700('0xac')]]}]}]})[_0x9700('0x36')](handleEntityNotFound(_0x1dfbb1,null))[_0x9700('0x36')](function(_0x4e03c4){if(_0x4e03c4&&_0x4e03c4[_0x9700('0xc5')]){_0x9a671a=_0x4e03c4[_0x9700('0x38')]({'plain':!![]});if(_0x9a671a[_0x9700('0xc5')]&&_0x9a671a[_0x9700('0xc5')]['Contacts'][_0x9700('0x4a')]){return _0x9a671a[_0x9700('0xc5')][_0x9700('0xab')][0x0];}return db['CmContact'][_0x9700('0x5e')](_[_0x9700('0x1b')](_0x1eb2a1['body'],{'firstName':_0x4a88cf,'mobile':_0x4a88cf,'phone':_0x4a88cf,'ListId':_0x9a671a[_0x9700('0x9d')]}));}})[_0x9700('0x36')](handleEntityNotFound(_0x1dfbb1,null))[_0x9700('0x36')](function(_0x26c842){if(_0x26c842){_0x2e54e4=_0x26c842;return db[_0x9700('0xaf')][_0x9700('0x5c')]({'where':{'ContactId':_0x2e54e4['id'],'closed':![],'WhatsappAccountId':_0x9a671a['id']}})[_0x9700('0x36')](function(_0x320e6f){if(_0x320e6f){return[_0x320e6f,![]];}return db[_0x9700('0xaf')][_0x9700('0x5e')]({'UserId':_0x1eb2a1[_0x9700('0x60')]['id'],'ContactId':_0x2e54e4['id'],'WhatsappAccountId':_0x9a671a['id'],'phone':_0x4a88cf,'firstMsgDirection':_0x9700('0xc6'),'Messages':[_[_0x9700('0x6d')](_0x1eb2a1[_0x9700('0x5f')],{'read':![],'body':_0x1eb2a1[_0x9700('0x5f')]['body'],'phone':_0x4a88cf,'WhatsappAccountId':_0x9a671a['id'],'UserId':_0x1eb2a1[_0x9700('0x60')]['id'],'ContactId':_0x2e54e4['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})['then'](function(_0x15850f){return[_0x15850f,!![]];});});}})[_0x9700('0x76')](function(_0x1be5c9,_0x2d6a4a){if(_0x2d6a4a){return _0x1be5c9;}return db[_0x9700('0x90')][_0x9700('0x5e')](_[_0x9700('0x6d')](_0x1eb2a1[_0x9700('0x5f')],{'read':![],'body':_0x1eb2a1[_0x9700('0x5f')]['body'],'phone':_0x4a88cf,'WhatsappAccountId':_0x9a671a['id'],'WhatsappInteractionId':_0x1be5c9['id'],'UserId':_0x1eb2a1[_0x9700('0x60')]['id'],'ContactId':_0x2e54e4['id']}))[_0x9700('0x36')](function(_0x2f66ef){_0x1be5c9[_0x9700('0xc7')][_0x9700('0xc8')]=[];_0x1be5c9[_0x9700('0xc7')][_0x9700('0xc8')]['push'](_0x2f66ef[_0x9700('0xc7')]);return _0x1be5c9;});})['then'](respondWithResult(_0x1dfbb1,null))[_0x9700('0x5d')](handleError(_0x1dfbb1,null));}; \ No newline at end of file +var _0x24c6=['to\x20is\x20mandatory','List','DESC','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappAccount','includeAll','include','findAll','rows','show','keys','create','body','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','removeDispositions','CannedAnswer','removeAnswers','ids','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','sequelize','transaction','ISOLATION_LEVELS','WhatsappApplication','findAndCountAll','priority','finally','getApplications','notify','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','orderBy','asc','CmContact','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','mobile','from','From','Body','MessageSid','notifications','messageId','message_id','Sequelize','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','list','contact','WhatsappInteraction','interaction','created','applications','push','unmanaged','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','receiveMessage','entity\x20found','Content-Type','text/xml','\x0a'];(function(_0x1535ec,_0x187b31){var _0x3a958e=function(_0xfacd12){while(--_0xfacd12){_0x1535ec['push'](_0x1535ec['shift']());}};_0x3a958e(++_0x187b31);}(_0x24c6,0xc6));var _0x624c=function(_0x1ef382,_0x86b051){_0x1ef382=_0x1ef382-0x0;var _0x505217=_0x24c6[_0x1ef382];return _0x505217;};'use strict';var emlformat=require(_0x624c('0x0'));var rimraf=require(_0x624c('0x1'));var zipdir=require(_0x624c('0x2'));var jsonpatch=require(_0x624c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x624c('0x4'));var util=require(_0x624c('0x5'));var path=require('path');var sox=require(_0x624c('0x6'));var csv=require('to-csv');var ejs=require(_0x624c('0x7'));var fs=require('fs');var fs_extra=require(_0x624c('0x8'));var _=require('lodash');var squel=require(_0x624c('0x9'));var crypto=require(_0x624c('0xa'));var jsforce=require(_0x624c('0xb'));var deskjs=require(_0x624c('0xc'));var toCsv=require(_0x624c('0xd'));var querystring=require(_0x624c('0xe'));var Papa=require('papaparse');var Redis=require(_0x624c('0xf'));var authService=require(_0x624c('0x10'));var qs=require(_0x624c('0x11'));var as=require(_0x624c('0x12'));var hardwareService=require(_0x624c('0x13'));var logger=require('../../config/logger')(_0x624c('0x14'));var utils=require('../../config/utils');var config=require(_0x624c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x624c('0x16'))['db'];config[_0x624c('0x17')]=_[_0x624c('0x18')](config[_0x624c('0x17')],{'host':_0x624c('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x624c('0x17')]));require(_0x624c('0x1a'))[_0x624c('0x1b')](socket);var jayson=require(_0x624c('0x1c'));var client=jayson[_0x624c('0x1d')][_0x624c('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x6d52b0,_0xf0f459,_0x565b3b,_0x4ac376){return new BPromise(function(_0x4be612,_0x306cc2){var _0x323b36=_0x4ac376||client;return _0x323b36[_0x624c('0x1f')](_0x6d52b0,_0x565b3b)[_0x624c('0x20')](function(_0x19eeae){logger[_0x624c('0x21')](_0x624c('0x22'),_0xf0f459,_0x624c('0x23'));logger[_0x624c('0x24')](_0x624c('0x25'),_0xf0f459,_0x624c('0x23'),JSON[_0x624c('0x26')](_0x19eeae));if(_0x19eeae[_0x624c('0x27')]){if(_0x19eeae[_0x624c('0x27')][_0x624c('0x28')]===0x1f4){logger['error'](_0x624c('0x22'),_0xf0f459,_0x19eeae[_0x624c('0x27')]['message']);return _0x306cc2(_0x19eeae[_0x624c('0x27')][_0x624c('0x29')]);}logger[_0x624c('0x27')](_0x624c('0x22'),_0xf0f459,_0x19eeae['error']['message']);return _0x4be612(_0x19eeae[_0x624c('0x27')]['message']);}else{logger[_0x624c('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0xf0f459,_0x624c('0x23'));_0x4be612(_0x19eeae[_0x624c('0x2a')][_0x624c('0x29')]);}})[_0x624c('0x2b')](function(_0x54f271){logger[_0x624c('0x27')](_0x624c('0x22'),_0xf0f459,_0x54f271);_0x306cc2(_0x54f271);});});}function respondWithStatusCode(_0x51329d,_0x1fcd60){_0x1fcd60=_0x1fcd60||0xcc;return function(_0x250869){if(_0x250869){return _0x51329d[_0x624c('0x2c')](_0x1fcd60);}return _0x51329d[_0x624c('0x2d')](_0x1fcd60)['end']();};}function respondWithResult(_0x1b3865,_0x2b0c65){_0x2b0c65=_0x2b0c65||0xc8;return function(_0x3707ab){if(_0x3707ab){return _0x1b3865[_0x624c('0x2d')](_0x2b0c65)[_0x624c('0x2e')](_0x3707ab);}};}function respondWithFilteredResult(_0x602233,_0x49f10c){return function(_0x49a935){if(_0x49a935){var _0x3bf30c=typeof _0x49f10c[_0x624c('0x2f')]===_0x624c('0x30')&&typeof _0x49f10c[_0x624c('0x31')]==='undefined';var _0x2f6dda=_0x49a935['count'];var _0x37bb10=_0x3bf30c?0x0:_0x49f10c[_0x624c('0x2f')];var _0xa8e01b=_0x3bf30c?_0x49a935[_0x624c('0x32')]:_0x49f10c[_0x624c('0x2f')]+_0x49f10c[_0x624c('0x31')];var _0x159332;if(_0xa8e01b>=_0x2f6dda){_0xa8e01b=_0x2f6dda;_0x159332=0xc8;}else{_0x159332=0xce;}_0x602233['status'](_0x159332);return _0x602233[_0x624c('0x33')](_0x624c('0x34'),_0x37bb10+'-'+_0xa8e01b+'/'+_0x2f6dda)[_0x624c('0x2e')](_0x49a935);}return null;};}function patchUpdates(_0x2d34f){return function(_0x40dc41){try{jsonpatch[_0x624c('0x35')](_0x40dc41,_0x2d34f,!![]);}catch(_0x14e0b5){return BPromise[_0x624c('0x36')](_0x14e0b5);}return _0x40dc41[_0x624c('0x37')]();};}function saveUpdates(_0x27d726,_0x4330f1){return function(_0x3cfe32){if(_0x3cfe32){return _0x3cfe32[_0x624c('0x38')](_0x27d726)[_0x624c('0x20')](function(_0x56fde1){return _0x56fde1;});}return null;};}function removeEntity(_0x10187b,_0x5511c4){return function(_0x4f3c28){if(_0x4f3c28){return _0x4f3c28[_0x624c('0x39')]()[_0x624c('0x20')](function(){var _0x411c38=_0x4f3c28[_0x624c('0x3a')]({'plain':!![]});var _0x506864=_0x624c('0x3b');return db[_0x624c('0x3c')][_0x624c('0x39')]({'where':{'type':_0x506864,'resourceId':_0x411c38['id']}})[_0x624c('0x20')](function(){return _0x4f3c28;});})[_0x624c('0x20')](function(){_0x10187b[_0x624c('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x308c66,_0x5afbde){return function(_0x6d2c76){if(!_0x6d2c76){_0x308c66[_0x624c('0x2c')](0x194);}return _0x6d2c76;};}function handleError(_0x596416,_0x172192){_0x172192=_0x172192||0x1f4;return function(_0x154bfa){logger[_0x624c('0x27')](_0x154bfa[_0x624c('0x3d')]);if(_0x154bfa[_0x624c('0x3e')]){delete _0x154bfa[_0x624c('0x3e')];}_0x596416[_0x624c('0x2d')](_0x172192)[_0x624c('0x3f')](_0x154bfa);};}exports[_0x624c('0x40')]=function(_0x2babaf,_0x53697c){var _0x305482={'include':[{'model':db[_0x624c('0x41')],'as':_0x624c('0x42')}]},_0x584719={},_0x1efb4c={'count':0x0,'rows':[]};var _0x54a442=_[_0x624c('0x43')](db['WhatsappAccount'][_0x624c('0x44')],function(_0x52e48b){return{'name':_0x52e48b[_0x624c('0x45')],'type':_0x52e48b[_0x624c('0x46')][_0x624c('0x47')]};});_0x584719[_0x624c('0x48')]=_[_0x624c('0x43')](_0x54a442,'name');_0x584719['query']=_['keys'](_0x2babaf[_0x624c('0x49')]);_0x584719[_0x624c('0x4a')]=_[_0x624c('0x4b')](_0x584719[_0x624c('0x48')],_0x584719[_0x624c('0x49')]);_0x305482[_0x624c('0x4c')]=_[_0x624c('0x4b')](_0x584719['model'],qs[_0x624c('0x4d')](_0x2babaf[_0x624c('0x49')]['fields']));_0x305482[_0x624c('0x4c')]=_0x305482[_0x624c('0x4c')][_0x624c('0x4e')]?_0x305482[_0x624c('0x4c')]:_0x584719[_0x624c('0x48')];if(!_0x2babaf[_0x624c('0x49')][_0x624c('0x4f')](_0x624c('0x50'))){_0x305482[_0x624c('0x31')]=qs[_0x624c('0x31')](_0x2babaf[_0x624c('0x49')]['limit']);_0x305482[_0x624c('0x2f')]=qs[_0x624c('0x2f')](_0x2babaf['query']['offset']);}_0x305482[_0x624c('0x51')]=qs[_0x624c('0x52')](_0x2babaf[_0x624c('0x49')]['sort']);_0x305482[_0x624c('0x53')]=qs[_0x624c('0x4a')](_[_0x624c('0x54')](_0x2babaf[_0x624c('0x49')],_0x584719['filters']),_0x54a442);if(_0x2babaf[_0x624c('0x49')][_0x624c('0x55')]){_0x305482[_0x624c('0x53')]=_[_0x624c('0x56')](_0x305482['where'],{'$or':_[_0x624c('0x43')](_0x54a442,function(_0x11e484){if(_0x11e484[_0x624c('0x46')]!==_0x624c('0x57')){var _0x577f00={};_0x577f00[_0x11e484[_0x624c('0x3e')]]={'$like':'%'+_0x2babaf[_0x624c('0x49')][_0x624c('0x55')]+'%'};return _0x577f00;}})});}_0x305482=_[_0x624c('0x56')]({},_0x305482,_0x2babaf[_0x624c('0x58')]);var _0x413147={'where':_0x305482[_0x624c('0x53')]};return db[_0x624c('0x59')]['count'](_0x413147)[_0x624c('0x20')](function(_0x452205){_0x1efb4c['count']=_0x452205;if(_0x2babaf[_0x624c('0x49')][_0x624c('0x5a')]){_0x305482[_0x624c('0x5b')]=[{'all':!![]}];}return db[_0x624c('0x59')][_0x624c('0x5c')](_0x305482);})[_0x624c('0x20')](function(_0x31f42f){_0x1efb4c[_0x624c('0x5d')]=_0x31f42f;return _0x1efb4c;})[_0x624c('0x20')](respondWithFilteredResult(_0x53697c,_0x305482))[_0x624c('0x2b')](handleError(_0x53697c,null));};exports[_0x624c('0x5e')]=function(_0x48ff3e,_0x150882){var _0x320d65={'raw':![],'where':{'id':_0x48ff3e['params']['id']},'include':[{'model':db[_0x624c('0x41')],'as':'mandatoryDispositionPause'}]},_0x5a3c7d={};_0x5a3c7d[_0x624c('0x48')]=_[_0x624c('0x5f')](db['WhatsappAccount']['rawAttributes']);_0x5a3c7d[_0x624c('0x49')]=_[_0x624c('0x5f')](_0x48ff3e[_0x624c('0x49')]);_0x5a3c7d[_0x624c('0x4a')]=_[_0x624c('0x4b')](_0x5a3c7d[_0x624c('0x48')],_0x5a3c7d['query']);_0x320d65['attributes']=_[_0x624c('0x4b')](_0x5a3c7d['model'],qs['fields'](_0x48ff3e[_0x624c('0x49')][_0x624c('0x4d')]));_0x320d65[_0x624c('0x4c')]=_0x320d65[_0x624c('0x4c')][_0x624c('0x4e')]?_0x320d65['attributes']:_0x5a3c7d[_0x624c('0x48')];if(_0x48ff3e[_0x624c('0x49')]['includeAll']){_0x320d65[_0x624c('0x5b')]=[{'all':!![]}];}_0x320d65=_['merge']({},_0x320d65,_0x48ff3e[_0x624c('0x58')]);return db[_0x624c('0x59')]['find'](_0x320d65)[_0x624c('0x20')](handleEntityNotFound(_0x150882,null))['then'](respondWithResult(_0x150882,null))[_0x624c('0x2b')](handleError(_0x150882,null));};exports[_0x624c('0x60')]=function(_0xbf3ec4,_0x10c4e3){return db[_0x624c('0x59')][_0x624c('0x60')](_0xbf3ec4[_0x624c('0x61')],{})[_0x624c('0x20')](function(_0x29af8f){var _0x286923=_0xbf3ec4[_0x624c('0x62')]['get']({'plain':!![]});if(!_0x286923)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x286923['role']===_0x624c('0x62')){var _0x163e21=_0x29af8f[_0x624c('0x3a')]({'plain':!![]});var _0x2a6f8b='WhatsappAccounts';return db[_0x624c('0x63')][_0x624c('0x64')]({'where':{'name':_0x2a6f8b,'userProfileId':_0x286923['userProfileId']},'raw':!![]})['then'](function(_0x212d1d){if(_0x212d1d&&_0x212d1d[_0x624c('0x65')]===0x0){return db[_0x624c('0x3c')]['create']({'name':_0x163e21[_0x624c('0x3e')],'resourceId':_0x163e21['id'],'type':_0x212d1d[_0x624c('0x3e')],'sectionId':_0x212d1d['id']},{})[_0x624c('0x20')](function(){return _0x29af8f;});}else{return _0x29af8f;}})['catch'](function(_0x53354c){logger['error'](_0x624c('0x66'),_0x53354c);throw _0x53354c;});}return _0x29af8f;})[_0x624c('0x20')](respondWithResult(_0x10c4e3,0xc9))[_0x624c('0x2b')](handleError(_0x10c4e3,null));};exports[_0x624c('0x38')]=function(_0x35ee09,_0x236b5a){if(_0x35ee09[_0x624c('0x61')]['id']){delete _0x35ee09[_0x624c('0x61')]['id'];}return db[_0x624c('0x59')][_0x624c('0x64')]({'where':{'id':_0x35ee09[_0x624c('0x67')]['id']},'include':[{'model':db[_0x624c('0x41')],'as':_0x624c('0x42')}]})[_0x624c('0x20')](handleEntityNotFound(_0x236b5a,null))[_0x624c('0x20')](saveUpdates(_0x35ee09[_0x624c('0x61')],null))[_0x624c('0x20')](respondWithResult(_0x236b5a,null))[_0x624c('0x2b')](handleError(_0x236b5a,null));};exports[_0x624c('0x39')]=function(_0x3468b8,_0x3e9d26){return db[_0x624c('0x59')][_0x624c('0x64')]({'where':{'id':_0x3468b8[_0x624c('0x67')]['id']}})[_0x624c('0x20')](handleEntityNotFound(_0x3e9d26,null))[_0x624c('0x20')](removeEntity(_0x3e9d26,null))[_0x624c('0x2b')](handleError(_0x3e9d26,null));};exports[_0x624c('0x68')]=function(_0x3a802c,_0x3fc711){return db['WhatsappAccount'][_0x624c('0x68')]()[_0x624c('0x20')](respondWithResult(_0x3fc711,null))[_0x624c('0x2b')](handleError(_0x3fc711,null));};exports[_0x624c('0x69')]=function(_0x2544a9,_0x27d36c,_0xad549d){if(_0x2544a9[_0x624c('0x61')]['id']){delete _0x2544a9[_0x624c('0x61')]['id'];}return db[_0x624c('0x59')][_0x624c('0x64')]({'where':{'id':_0x2544a9['params']['id']}})[_0x624c('0x20')](handleEntityNotFound(_0x27d36c,null))[_0x624c('0x20')](function(_0x544592){if(_0x544592){_0x2544a9[_0x624c('0x61')][_0x624c('0x6a')]=_0x544592['id'];return db[_0x624c('0x6b')][_0x624c('0x60')](_0x2544a9['body']);}})[_0x624c('0x20')](respondWithResult(_0x27d36c,null))['catch'](handleError(_0x27d36c,null));};exports[_0x624c('0x6c')]=function(_0x42ad3f,_0x22a327,_0x38bcee){var _0x3b458b={'raw':![],'where':{}};var _0x21c8ea={};var _0x5ccc3c={'count':0x0,'rows':[]};return db[_0x624c('0x59')][_0x624c('0x6d')]({'where':{'id':_0x42ad3f[_0x624c('0x67')]['id']}})[_0x624c('0x20')](handleEntityNotFound(_0x22a327,null))[_0x624c('0x20')](function(_0x8d0ba9){if(_0x8d0ba9){_0x21c8ea[_0x624c('0x48')]=_['keys'](db[_0x624c('0x6b')][_0x624c('0x44')]);_0x21c8ea[_0x624c('0x49')]=_[_0x624c('0x5f')](_0x42ad3f['query']);_0x21c8ea[_0x624c('0x4a')]=_[_0x624c('0x4b')](_0x21c8ea[_0x624c('0x48')],_0x21c8ea[_0x624c('0x49')]);_0x3b458b[_0x624c('0x4c')]=_[_0x624c('0x4b')](_0x21c8ea[_0x624c('0x48')],qs[_0x624c('0x4d')](_0x42ad3f['query'][_0x624c('0x4d')]));_0x3b458b[_0x624c('0x4c')]=_0x3b458b[_0x624c('0x4c')][_0x624c('0x4e')]?_0x3b458b[_0x624c('0x4c')]:_0x21c8ea[_0x624c('0x48')];if(!_0x42ad3f[_0x624c('0x49')]['hasOwnProperty']('nolimit')){_0x3b458b[_0x624c('0x31')]=qs[_0x624c('0x31')](_0x42ad3f[_0x624c('0x49')][_0x624c('0x31')]);_0x3b458b[_0x624c('0x2f')]=qs[_0x624c('0x2f')](_0x42ad3f[_0x624c('0x49')][_0x624c('0x2f')]);}_0x3b458b['order']=qs['sort'](_0x42ad3f[_0x624c('0x49')][_0x624c('0x52')]);_0x3b458b[_0x624c('0x53')]=qs[_0x624c('0x4a')](_['pick'](_0x42ad3f['query'],_0x21c8ea[_0x624c('0x4a')]));_0x3b458b[_0x624c('0x53')][_0x624c('0x6a')]=_0x8d0ba9['id'];if(_0x42ad3f[_0x624c('0x49')][_0x624c('0x55')]){_0x3b458b[_0x624c('0x53')]=_[_0x624c('0x56')](_0x3b458b[_0x624c('0x53')],{'$or':_[_0x624c('0x43')](_0x3b458b[_0x624c('0x4c')],function(_0x34a356){var _0x1b09a2={};_0x1b09a2[_0x34a356]={'$like':'%'+_0x42ad3f[_0x624c('0x49')]['filter']+'%'};return _0x1b09a2;})});}_0x3b458b=_[_0x624c('0x56')]({},_0x3b458b,_0x42ad3f[_0x624c('0x58')]);return db[_0x624c('0x6b')]['count']({'where':_0x3b458b['where']})[_0x624c('0x20')](function(_0x24e94a){_0x5ccc3c['count']=_0x24e94a;if(_0x42ad3f[_0x624c('0x49')]['includeAll']){_0x3b458b[_0x624c('0x5b')]=[{'all':!![]}];}return db[_0x624c('0x6b')]['findAll'](_0x3b458b);})[_0x624c('0x20')](function(_0x25c632){_0x5ccc3c[_0x624c('0x5d')]=_0x25c632;return _0x5ccc3c;});}})['then'](respondWithFilteredResult(_0x22a327,_0x3b458b))[_0x624c('0x2b')](handleError(_0x22a327,null));};exports['removeDispositions']=function(_0x33647a,_0x14edf9,_0x1d4cef){return db[_0x624c('0x59')][_0x624c('0x64')]({'where':{'id':_0x33647a[_0x624c('0x67')]['id']}})[_0x624c('0x20')](handleEntityNotFound(_0x14edf9,null))[_0x624c('0x20')](function(_0x3961eb){if(_0x3961eb){return _0x3961eb[_0x624c('0x6e')](_0x33647a[_0x624c('0x49')]['ids']);}})[_0x624c('0x20')](respondWithStatusCode(_0x14edf9,null))['catch'](handleError(_0x14edf9,null));};exports['addAnswer']=function(_0x257c39,_0x4fe034,_0x5c33a1){if(_0x257c39[_0x624c('0x61')]['id']){delete _0x257c39['body']['id'];}return db[_0x624c('0x59')][_0x624c('0x64')]({'where':{'id':_0x257c39[_0x624c('0x67')]['id']}})[_0x624c('0x20')](handleEntityNotFound(_0x4fe034,null))[_0x624c('0x20')](function(_0x12112d){if(_0x12112d){_0x257c39[_0x624c('0x61')]['WhatsappAccountId']=_0x12112d['id'];return db['CannedAnswer'][_0x624c('0x60')](_0x257c39['body']);}})['then'](respondWithResult(_0x4fe034,null))[_0x624c('0x2b')](handleError(_0x4fe034,null));};exports['getAnswers']=function(_0xb7b1f5,_0x21c47a,_0x504f3d){var _0x3f128e={'raw':![],'where':{}};var _0x2346a8={};var _0x16dc61={'count':0x0,'rows':[]};return db[_0x624c('0x59')][_0x624c('0x6d')]({'where':{'id':_0xb7b1f5[_0x624c('0x67')]['id']}})[_0x624c('0x20')](handleEntityNotFound(_0x21c47a,null))[_0x624c('0x20')](function(_0x1c99ec){if(_0x1c99ec){_0x2346a8['model']=_[_0x624c('0x5f')](db[_0x624c('0x6f')][_0x624c('0x44')]);_0x2346a8[_0x624c('0x49')]=_['keys'](_0xb7b1f5[_0x624c('0x49')]);_0x2346a8['filters']=_[_0x624c('0x4b')](_0x2346a8[_0x624c('0x48')],_0x2346a8[_0x624c('0x49')]);_0x3f128e[_0x624c('0x4c')]=_['intersection'](_0x2346a8[_0x624c('0x48')],qs['fields'](_0xb7b1f5[_0x624c('0x49')]['fields']));_0x3f128e[_0x624c('0x4c')]=_0x3f128e['attributes'][_0x624c('0x4e')]?_0x3f128e[_0x624c('0x4c')]:_0x2346a8[_0x624c('0x48')];if(!_0xb7b1f5[_0x624c('0x49')][_0x624c('0x4f')](_0x624c('0x50'))){_0x3f128e[_0x624c('0x31')]=qs['limit'](_0xb7b1f5[_0x624c('0x49')][_0x624c('0x31')]);_0x3f128e[_0x624c('0x2f')]=qs[_0x624c('0x2f')](_0xb7b1f5[_0x624c('0x49')][_0x624c('0x2f')]);}_0x3f128e[_0x624c('0x51')]=qs[_0x624c('0x52')](_0xb7b1f5['query'][_0x624c('0x52')]);_0x3f128e[_0x624c('0x53')]=qs[_0x624c('0x4a')](_['pick'](_0xb7b1f5['query'],_0x2346a8['filters']));_0x3f128e['where'][_0x624c('0x6a')]=_0x1c99ec['id'];if(_0xb7b1f5[_0x624c('0x49')][_0x624c('0x55')]){_0x3f128e[_0x624c('0x53')]=_[_0x624c('0x56')](_0x3f128e['where'],{'$or':_[_0x624c('0x43')](_0x3f128e[_0x624c('0x4c')],function(_0x489e28){var _0x82262e={};_0x82262e[_0x489e28]={'$like':'%'+_0xb7b1f5[_0x624c('0x49')][_0x624c('0x55')]+'%'};return _0x82262e;})});}_0x3f128e=_[_0x624c('0x56')]({},_0x3f128e,_0xb7b1f5['options']);return db[_0x624c('0x6f')][_0x624c('0x32')]({'where':_0x3f128e[_0x624c('0x53')]})['then'](function(_0x151fcb){_0x16dc61['count']=_0x151fcb;if(_0xb7b1f5['query'][_0x624c('0x5a')]){_0x3f128e[_0x624c('0x5b')]=[{'all':!![]}];}return db[_0x624c('0x6f')][_0x624c('0x5c')](_0x3f128e);})[_0x624c('0x20')](function(_0x22dbac){_0x16dc61[_0x624c('0x5d')]=_0x22dbac;return _0x16dc61;});}})[_0x624c('0x20')](respondWithFilteredResult(_0x21c47a,_0x3f128e))[_0x624c('0x2b')](handleError(_0x21c47a,null));};exports[_0x624c('0x70')]=function(_0x28571e,_0x2ab5d1,_0x4a18ce){return db[_0x624c('0x59')][_0x624c('0x64')]({'where':{'id':_0x28571e[_0x624c('0x67')]['id']}})[_0x624c('0x20')](handleEntityNotFound(_0x2ab5d1,null))[_0x624c('0x20')](function(_0x499f9d){if(_0x499f9d){return _0x499f9d[_0x624c('0x70')](_0x28571e[_0x624c('0x49')][_0x624c('0x71')]);}})[_0x624c('0x20')](respondWithStatusCode(_0x2ab5d1,null))['catch'](handleError(_0x2ab5d1,null));};exports[_0x624c('0x72')]=function(_0x141b92,_0x5a5b85,_0x10c4b9){return db[_0x624c('0x59')]['find']({'where':{'id':_0x141b92[_0x624c('0x67')]['id']}})[_0x624c('0x20')](handleEntityNotFound(_0x5a5b85,null))[_0x624c('0x20')](function(_0x58e633){if(_0x58e633){return _0x58e633[_0x624c('0x72')](_0x141b92[_0x624c('0x61')][_0x624c('0x71')],_[_0x624c('0x73')](_0x141b92[_0x624c('0x61')],[_0x624c('0x71'),'id'])||{})[_0x624c('0x74')](function(_0x591328){for(var _0x1d5d49=0x0;_0x1d5d49<_0x141b92[_0x624c('0x61')][_0x624c('0x71')][_0x624c('0x4e')];_0x1d5d49+=0x1){socket['emit'](_0x624c('0x75'),{'UserId':Number(_0x141b92[_0x624c('0x61')]['ids'][_0x1d5d49]),'WhatsappAccountId':Number(_0x141b92[_0x624c('0x67')]['id'])});}return _0x591328;});}})[_0x624c('0x20')](respondWithResult(_0x5a5b85,null))['catch'](handleError(_0x5a5b85,null));};exports[_0x624c('0x76')]=function(_0x25098f,_0xce8c75,_0x4aa3b9){return db[_0x624c('0x59')][_0x624c('0x64')]({'where':{'id':_0x25098f[_0x624c('0x67')]['id']}})[_0x624c('0x20')](handleEntityNotFound(_0xce8c75,null))[_0x624c('0x20')](function(_0xf1031c){if(_0xf1031c){return _0xf1031c[_0x624c('0x76')](_0x25098f[_0x624c('0x49')]['ids'])['then'](function(){if(_[_0x624c('0x77')](_0x25098f[_0x624c('0x49')][_0x624c('0x71')])){for(var _0x3c41d5=0x0;_0x3c41d5<_0x25098f['query'][_0x624c('0x71')][_0x624c('0x4e')];_0x3c41d5+=0x1){socket['emit'](_0x624c('0x78'),{'UserId':Number(_0x25098f['query'][_0x624c('0x71')][_0x3c41d5]),'WhatsappAccountId':Number(_0x25098f[_0x624c('0x67')]['id'])});}}else{socket['emit'](_0x624c('0x78'),{'UserId':Number(_0x25098f['query'][_0x624c('0x71')]),'WhatsappAccountId':Number(_0x25098f[_0x624c('0x67')]['id'])});}});}})['then'](respondWithStatusCode(_0xce8c75,null))[_0x624c('0x2b')](handleError(_0xce8c75,null));};exports['getAgents']=function(_0x135de0,_0x2466f8,_0x5a4141){var _0x4f27dd={};var _0x498509={};var _0x1106fe;var _0xaca5da;return db[_0x624c('0x59')][_0x624c('0x6d')]({'where':{'id':_0x135de0[_0x624c('0x67')]['id']}})[_0x624c('0x20')](handleEntityNotFound(_0x2466f8,null))['then'](function(_0x55c59e){if(_0x55c59e){_0x1106fe=_0x55c59e;_0x498509[_0x624c('0x48')]=_[_0x624c('0x5f')](db[_0x624c('0x79')]['rawAttributes']);_0x498509[_0x624c('0x49')]=_[_0x624c('0x5f')](_0x135de0[_0x624c('0x49')]);_0x498509['filters']=_[_0x624c('0x4b')](_0x498509['model'],_0x498509[_0x624c('0x49')]);_0x4f27dd[_0x624c('0x4c')]=_['intersection'](_0x498509['model'],qs[_0x624c('0x4d')](_0x135de0[_0x624c('0x49')]['fields']));_0x4f27dd[_0x624c('0x4c')]=_0x4f27dd[_0x624c('0x4c')][_0x624c('0x4e')]?_0x4f27dd[_0x624c('0x4c')]:_0x498509[_0x624c('0x48')];_0x4f27dd[_0x624c('0x51')]=qs['sort'](_0x135de0['query']['sort']);_0x4f27dd[_0x624c('0x53')]=qs['filters'](_['pick'](_0x135de0[_0x624c('0x49')],_0x498509[_0x624c('0x4a')]));if(_0x135de0[_0x624c('0x49')][_0x624c('0x55')]){_0x4f27dd[_0x624c('0x53')]=_[_0x624c('0x56')](_0x4f27dd['where'],{'$or':_[_0x624c('0x43')](_0x4f27dd[_0x624c('0x4c')],function(_0xf3acab){var _0x32290c={};_0x32290c[_0xf3acab]={'$like':'%'+_0x135de0[_0x624c('0x49')][_0x624c('0x55')]+'%'};return _0x32290c;})});}_0x4f27dd=_[_0x624c('0x56')]({},_0x4f27dd,_0x135de0['options']);return _0x1106fe[_0x624c('0x7a')](_0x4f27dd);}})['then'](function(_0x3b40f4){if(_0x3b40f4){_0xaca5da=_0x3b40f4[_0x624c('0x4e')];if(!_0x135de0[_0x624c('0x49')][_0x624c('0x4f')](_0x624c('0x50'))){_0x4f27dd[_0x624c('0x31')]=qs[_0x624c('0x31')](_0x135de0[_0x624c('0x49')][_0x624c('0x31')]);_0x4f27dd[_0x624c('0x2f')]=qs[_0x624c('0x2f')](_0x135de0['query'][_0x624c('0x2f')]);}return _0x1106fe[_0x624c('0x7a')](_0x4f27dd);}})[_0x624c('0x20')](function(_0x2d1ee9){if(_0x2d1ee9){return _0x2d1ee9?{'count':_0xaca5da,'rows':_0x2d1ee9}:null;}})[_0x624c('0x20')](respondWithResult(_0x2466f8,null))['catch'](handleError(_0x2466f8,null));};exports['addApplications']=function(_0x3e596a,_0x468bda){var _0x4260eb=_0x3e596a[_0x624c('0x67')]['id'];var _0x333873=_0x3e596a[_0x624c('0x61')];var _0x36087e=0xc8;var _0x1db731=null;return db[_0x624c('0x7b')][_0x624c('0x7c')]({'isolationLevel':db[_0x624c('0x7b')]['Transaction'][_0x624c('0x7d')]['READ_COMMITTED']},function(_0x6a6663){return db[_0x624c('0x59')][_0x624c('0x6d')]({'where':{'id':_0x4260eb},'transaction':_0x6a6663})[_0x624c('0x20')](function(_0x5657a7){if(_0x5657a7){return db[_0x624c('0x7e')][_0x624c('0x39')]({'where':{'WhatsappAccountId':_0x4260eb},'transaction':_0x6a6663})[_0x624c('0x20')](function(){var _0x1d3c6d=_['map'](_0x333873,function(_0x5ce731){_0x5ce731[_0x624c('0x6a')]=_0x4260eb;return _0x5ce731;});return db[_0x624c('0x7e')]['bulkCreate'](_0x1d3c6d,{'transaction':_0x6a6663});});}else{_0x36087e=0x194;_0x1db731=[];}});})['then'](function(){if(_0x36087e!==0x194){return db['WhatsappApplication'][_0x624c('0x7f')]({'where':{'WhatsappAccountId':_0x4260eb},'order':_0x624c('0x80')})['then'](function(_0x4ede3f){_0x1db731=_0x4ede3f;});}})[_0x624c('0x2b')](function(_0x262ef0){_0x36087e=0x1f4;logger[_0x624c('0x27')](_0x262ef0[_0x624c('0x3d')]);if(_0x262ef0[_0x624c('0x3e')]){delete _0x262ef0['name'];}_0x1db731=_0x262ef0;})[_0x624c('0x81')](function(){if(_0x1db731===null){_0x468bda['sendStatus'](_0x36087e);}else{if(_0x36087e===0x1f4){_0x468bda['status'](_0x36087e)[_0x624c('0x3f')](_0x1db731);}else{_0x468bda[_0x624c('0x2d')](_0x36087e)[_0x624c('0x2e')](_0x1db731);}}});};exports[_0x624c('0x82')]=function(_0x49fb0e,_0x321625,_0x17b9a1){var _0x1c6895={};var _0x572936={};var _0xddead0;var _0x2d2a57;return db[_0x624c('0x59')]['findOne']({'where':{'id':_0x49fb0e[_0x624c('0x67')]['id']}})[_0x624c('0x20')](handleEntityNotFound(_0x321625,null))[_0x624c('0x20')](function(_0x5ce3d5){if(_0x5ce3d5){_0xddead0=_0x5ce3d5;_0x572936[_0x624c('0x48')]=_[_0x624c('0x5f')](db[_0x624c('0x7e')][_0x624c('0x44')]);_0x572936[_0x624c('0x49')]=_[_0x624c('0x5f')](_0x49fb0e[_0x624c('0x49')]);_0x572936['filters']=_[_0x624c('0x4b')](_0x572936[_0x624c('0x48')],_0x572936['query']);_0x1c6895[_0x624c('0x4c')]=_[_0x624c('0x4b')](_0x572936['model'],qs['fields'](_0x49fb0e[_0x624c('0x49')][_0x624c('0x4d')]));_0x1c6895[_0x624c('0x4c')]=_0x1c6895[_0x624c('0x4c')][_0x624c('0x4e')]?_0x1c6895['attributes']:_0x572936[_0x624c('0x48')];_0x1c6895[_0x624c('0x51')]=qs[_0x624c('0x52')](_0x49fb0e['query'][_0x624c('0x52')]);_0x1c6895[_0x624c('0x53')]=qs[_0x624c('0x4a')](_[_0x624c('0x54')](_0x49fb0e[_0x624c('0x49')],_0x572936[_0x624c('0x4a')]));if(_0x49fb0e[_0x624c('0x49')][_0x624c('0x55')]){_0x1c6895[_0x624c('0x53')]=_[_0x624c('0x56')](_0x1c6895[_0x624c('0x53')],{'$or':_['map'](_0x1c6895[_0x624c('0x4c')],function(_0x461109){var _0x286080={};_0x286080[_0x461109]={'$like':'%'+_0x49fb0e[_0x624c('0x49')]['filter']+'%'};return _0x286080;})});}_0x1c6895=_[_0x624c('0x56')]({},_0x1c6895,_0x49fb0e[_0x624c('0x58')]);return _0xddead0['getApplications'](_0x1c6895);}})[_0x624c('0x20')](function(_0x402658){if(_0x402658){_0x2d2a57=_0x402658[_0x624c('0x4e')];if(!_0x49fb0e[_0x624c('0x49')][_0x624c('0x4f')](_0x624c('0x50'))){_0x1c6895[_0x624c('0x31')]=qs[_0x624c('0x31')](_0x49fb0e[_0x624c('0x49')][_0x624c('0x31')]);_0x1c6895[_0x624c('0x2f')]=qs['offset'](_0x49fb0e[_0x624c('0x49')][_0x624c('0x2f')]);}return _0xddead0[_0x624c('0x82')](_0x1c6895);}})[_0x624c('0x20')](function(_0x31d51c){if(_0x31d51c){return _0x31d51c?{'count':_0x2d2a57,'rows':_0x31d51c}:null;}})[_0x624c('0x20')](respondWithResult(_0x321625,null))[_0x624c('0x2b')](handleError(_0x321625,null));};exports[_0x624c('0x83')]=function(_0x4ae931,_0x2bdaec,_0x50300b){var _0x41e55b={'channel':'whatsapp'};var _0x43d777=[];var _0x14d10b=[];var _0x597f8f={};return db['WhatsappAccount'][_0x624c('0x64')]({'where':{'id':_0x4ae931['params']['id']},'include':[{'model':db[_0x624c('0x7e')],'as':_0x624c('0x84')}]})[_0x624c('0x20')](handleEntityNotFound(_0x2bdaec,null))[_0x624c('0x20')](function(_0x5a5ba2){_0x41e55b[_0x624c('0x85')]=_0x5a5ba2;if(_0x41e55b['account']&&_0x41e55b[_0x624c('0x85')][_0x624c('0x46')]===_0x624c('0x86')&&_0x4ae931[_0x624c('0x61')][_0x624c('0x87')]){if(_0x4ae931[_0x624c('0x61')]['statuses'][_0x624c('0x4e')]===0x0)return;if(_0x4ae931[_0x624c('0x61')][_0x624c('0x87')][0x0][_0x624c('0x88')]!==_0x624c('0x89'))return;return db[_0x624c('0x8a')]['update']({'read':!![],'readAt':_0x4ae931[_0x624c('0x61')][_0x624c('0x87')][0x0][_0x624c('0x8b')]},{'where':{'messageId':_0x4ae931['body']['statuses'][0x0]['message_id']},'individualHooks':!![]})[_0x624c('0x20')](function(_0x1a3bfa){return _0x2bdaec[_0x624c('0x2d')](0xc8)[_0x624c('0x2e')](_0x1a3bfa);});}_0x41e55b['applications']=_[_0x624c('0x8c')](_0x5a5ba2['Applications'],[_0x624c('0x80')],[_0x624c('0x8d')]);if(_0x41e55b[_0x624c('0x85')][_0x624c('0x84')]){delete _0x41e55b['account']['Applications'];}return db[_0x624c('0x8e')][_0x624c('0x68')]()['then'](function(_0x3042d5){if(!_0x3042d5){throw new db['Sequelize'][(_0x624c('0x8f'))](_0x624c('0x90'));}_0x43d777=_['difference'](_[_0x624c('0x5f')](_0x3042d5),[_0x624c('0x91'),_0x624c('0x92')]);_0x14d10b=_[_0x624c('0x93')](_['keys'](_0x3042d5),[_0x624c('0x91'),_0x624c('0x92'),'CompanyId',_0x624c('0x94')]);_0x41e55b[_0x624c('0x61')]={'mapKey':_0x624c('0x95')};if(_0x41e55b[_0x624c('0x85')]&&_0x41e55b[_0x624c('0x85')][_0x624c('0x46')]==='twilio'){_0x41e55b[_0x624c('0x61')][_0x624c('0x96')]=_0x4ae931[_0x624c('0x61')][_0x624c('0x97')]['replace']('whatsapp:','');_0x41e55b[_0x624c('0x61')][_0x624c('0x61')]=_0x4ae931[_0x624c('0x61')][_0x624c('0x98')];_0x41e55b['body']['messageId']=_0x4ae931[_0x624c('0x61')][_0x624c('0x99')];}if(_0x41e55b[_0x624c('0x85')]&&_0x41e55b[_0x624c('0x85')][_0x624c('0x46')]==='sinch'){_0x41e55b[_0x624c('0x61')][_0x624c('0x96')]=_0x4ae931[_0x624c('0x61')]['notifications'][0x0][_0x624c('0x96')];_0x41e55b[_0x624c('0x61')][_0x624c('0x61')]=_0x4ae931[_0x624c('0x61')][_0x624c('0x9a')][0x0][_0x624c('0x29')]['body'];_0x41e55b[_0x624c('0x61')][_0x624c('0x9b')]=_0x4ae931[_0x624c('0x61')][_0x624c('0x9a')][0x0][_0x624c('0x9c')];}if(_0x41e55b[_0x624c('0x61')]['id']){delete _0x41e55b[_0x624c('0x61')]['id'];}if(_['isNil'](_0x41e55b[_0x624c('0x61')][_0x624c('0x96')])){throw new db[(_0x624c('0x9d'))][(_0x624c('0x8f'))](_0x624c('0x9e'));}if(_[_0x624c('0x9f')](_0x41e55b[_0x624c('0x61')][_0x624c('0x61')])||_0x41e55b[_0x624c('0x61')][_0x624c('0x61')]===''){throw new db[(_0x624c('0x9d'))][(_0x624c('0x8f'))](_0x624c('0xa0'));}if(_['isNil'](_0x41e55b['body'][_0x624c('0xa1')])){throw new db[(_0x624c('0x9d'))][(_0x624c('0x8f'))](_0x624c('0xa2')+_0x14d10b);}if(!_[_0x624c('0xa3')](_0x14d10b,_0x41e55b[_0x624c('0x61')]['mapKey'])){throw new db[(_0x624c('0x9d'))][(_0x624c('0x8f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x14d10b);}_0x597f8f[_0x41e55b['body'][_0x624c('0xa1')]]=_0x41e55b['body'][_0x624c('0x96')];return db[_0x624c('0xa4')]['find']({'where':{'id':_0x41e55b[_0x624c('0x85')]['ListId']},'include':[{'model':db[_0x624c('0x8e')],'as':_0x624c('0xa5'),'where':_0x597f8f,'limit':0x1,'order':[[_0x624c('0x92'),'DESC']]}]});})[_0x624c('0x20')](handleEntityNotFound(_0x2bdaec,null))[_0x624c('0x20')](function(_0x3db123){if(_0x3db123){_0x41e55b[_0x624c('0xa6')]=_[_0x624c('0x73')](_0x3db123,['Contacts']);if(_0x3db123['Contacts']['length']){return _0x3db123[_0x624c('0xa5')][0x0];}var _0x5a9f61=_[_0x624c('0x18')](_0x41e55b['body'],{'firstName':_0x41e55b[_0x624c('0x61')][_0x624c('0x96')],'ListId':_0x3db123['id']});_0x5a9f61[_0x41e55b['body'][_0x624c('0xa1')]]=_0x41e55b[_0x624c('0x61')][_0x624c('0x96')];return db['CmContact'][_0x624c('0x60')](_0x5a9f61,{'fields':_0x43d777,'raw':!![]});}})['then'](handleEntityNotFound(_0x2bdaec,null))[_0x624c('0x20')](function(_0x515cc8){if(_0x515cc8){_0x41e55b[_0x624c('0xa7')]=_0x515cc8;var _0xa49c07={'ContactId':_0x515cc8['id'],'phone':_0x41e55b['body']['from'],'WhatsappAccountId':_0x4ae931[_0x624c('0x67')]['id']};var _0x4186da={'ContactId':_0x515cc8['id'],'WhatsappAccountId':_0x4ae931[_0x624c('0x67')]['id'],'closed':![]};return db[_0x624c('0xa8')]['find']({'where':_0x4186da})[_0x624c('0x20')](function(_0x5a17b0){if(_0x5a17b0){return[_0x5a17b0,![]];}return db[_0x624c('0xa8')][_0x624c('0x60')](_0xa49c07)[_0x624c('0x20')](function(_0x201cfd){return[_0x201cfd,!![]];});});}})['spread'](function(_0x1580b5,_0x11a107){_0x41e55b[_0x624c('0xa9')]=_0x1580b5[_0x624c('0x3a')]({'plain':!![]});_0x41e55b['interaction'][_0x624c('0xaa')]=![];if(_0x11a107){if(_0x41e55b[_0x624c('0x85')]['autoclose']){_0x41e55b[_0x624c('0xab')][_0x624c('0xac')]({'id':0x0,'priority':_0x41e55b['applications']['length']+0x1,'app':'close','appdata':_0x624c('0xad'),'interval':'*,*,*,*'});}_0x41e55b[_0x624c('0xa9')][_0x624c('0xaa')]=!![];}return db[_0x624c('0x8a')][_0x624c('0x60')]({'phone':_0x41e55b[_0x624c('0x61')][_0x624c('0x96')],'messageId':_0x41e55b[_0x624c('0x61')][_0x624c('0x9b')],'body':_0x41e55b[_0x624c('0x61')][_0x624c('0x61')],'WhatsappAccountId':_0x4ae931[_0x624c('0x67')]['id'],'WhatsappInteractionId':_0x1580b5['id'],'direction':'in','ContactId':_0x1580b5[_0x624c('0xae')],'AttachmentId':_0x41e55b['body'][_0x624c('0xaf')]});})['then'](function(_0x21b4b6){_0x41e55b[_0x624c('0x29')]=_0x21b4b6;if(_0x41e55b[_0x624c('0xa9')][_0x624c('0xb0')]){return db[_0x624c('0x79')][_0x624c('0x64')]({'attributes':['id',_0x624c('0x3e')],'where':{'id':_0x41e55b[_0x624c('0xa9')][_0x624c('0xb0')]}})[_0x624c('0x20')](function(_0x15ba2c){if(_0x15ba2c){_0x41e55b[_0x624c('0xab')][_0x624c('0xb1')]({'id':0x0,'priority':0x0,'app':_0x624c('0xb2'),'appdata':_0x15ba2c[_0x624c('0x3e')]+','+(_0x41e55b[_0x624c('0x85')][_0x624c('0xb3')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x624c('0xb4'),'startRouting',_0x41e55b);});}return respondWithRpcPromise(_0x624c('0xb4'),'startRouting',_0x41e55b);})[_0x624c('0x20')](function(_0x43d4a1){if(_0x43d4a1){var _0x41f385=0xc8;var _0x2f4959=_0x624c('0xb5');logger[_0x624c('0x21')](_0x624c('0x25'),_0x2f4959,_0x41f385,_0x624c('0xb6'));logger[_0x624c('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x2f4959,_0x41f385,'entity\x20found',JSON[_0x624c('0x26')](_0x43d4a1));if(_0x41e55b[_0x624c('0x85')][_0x624c('0x46')]==='twilio'){return _0x2bdaec['status'](_0x41f385)[_0x624c('0x33')](_0x624c('0xb7'),_0x624c('0xb8'))[_0x624c('0x3f')](_0x624c('0xb9'));}else{return _0x2bdaec[_0x624c('0x2d')](_0x41f385)[_0x624c('0x2e')](_0x43d4a1);}}});})[_0x624c('0x2b')](handleError(_0x2bdaec,null));};exports['send']=function(_0xbcc8ed,_0x58ff28,_0x4b7b8b){var _0x3bb3fe,_0x2c61b8,_0x1a52d6;if(_['isNil'](_0xbcc8ed['body'][_0x624c('0x61')])||_0xbcc8ed[_0x624c('0x61')][_0x624c('0x61')]===''){throw new db[(_0x624c('0x9d'))][(_0x624c('0x8f'))](_0x624c('0xa0'));}if(_[_0x624c('0x9f')](_0xbcc8ed[_0x624c('0x61')]['to'])){throw new db[(_0x624c('0x9d'))][(_0x624c('0x8f'))](_0x624c('0xba'));}_0x3bb3fe=_0xbcc8ed[_0x624c('0x61')]['to'];return db['WhatsappAccount']['find']({'where':{'id':_0xbcc8ed[_0x624c('0x67')]['id']},'include':[{'model':db['CmList'],'as':_0x624c('0xbb'),'include':[{'model':db[_0x624c('0x8e')],'as':_0x624c('0xa5'),'where':{'mobile':_0x3bb3fe},'limit':0x1,'order':[['updatedAt',_0x624c('0xbc')]]}]}]})[_0x624c('0x20')](handleEntityNotFound(_0x58ff28,null))[_0x624c('0x20')](function(_0x3f61ee){if(_0x3f61ee&&_0x3f61ee[_0x624c('0xbb')]){_0x2c61b8=_0x3f61ee[_0x624c('0x3a')]({'plain':!![]});if(_0x2c61b8[_0x624c('0xbb')]&&_0x2c61b8[_0x624c('0xbb')][_0x624c('0xa5')]['length']){return _0x2c61b8[_0x624c('0xbb')][_0x624c('0xa5')][0x0];}return db[_0x624c('0x8e')][_0x624c('0x60')](_[_0x624c('0x18')](_0xbcc8ed[_0x624c('0x61')],{'firstName':_0x3bb3fe,'mobile':_0x3bb3fe,'phone':_0x3bb3fe,'ListId':_0x2c61b8[_0x624c('0x94')]}));}})['then'](handleEntityNotFound(_0x58ff28,null))['then'](function(_0x5c99e7){if(_0x5c99e7){_0x1a52d6=_0x5c99e7;return db[_0x624c('0xa8')][_0x624c('0x64')]({'where':{'ContactId':_0x1a52d6['id'],'closed':![],'WhatsappAccountId':_0x2c61b8['id']}})['then'](function(_0x3fa565){if(_0x3fa565){return[_0x3fa565,![]];}return db[_0x624c('0xa8')][_0x624c('0x60')]({'UserId':_0xbcc8ed['user']['id'],'ContactId':_0x1a52d6['id'],'WhatsappAccountId':_0x2c61b8['id'],'phone':_0x3bb3fe,'firstMsgDirection':_0x624c('0xbd'),'Messages':[_['merge'](_0xbcc8ed[_0x624c('0x61')],{'read':![],'body':_0xbcc8ed['body'][_0x624c('0x61')],'phone':_0x3bb3fe,'WhatsappAccountId':_0x2c61b8['id'],'UserId':_0xbcc8ed['user']['id'],'ContactId':_0x1a52d6['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})[_0x624c('0x20')](function(_0x2ce4a7){return[_0x2ce4a7,!![]];});});}})[_0x624c('0x74')](function(_0x23ddf7,_0x4b0a50){if(_0x4b0a50){return _0x23ddf7;}return db[_0x624c('0x8a')][_0x624c('0x60')](_[_0x624c('0x56')](_0xbcc8ed[_0x624c('0x61')],{'read':![],'body':_0xbcc8ed[_0x624c('0x61')][_0x624c('0x61')],'phone':_0x3bb3fe,'WhatsappAccountId':_0x2c61b8['id'],'WhatsappInteractionId':_0x23ddf7['id'],'UserId':_0xbcc8ed[_0x624c('0x62')]['id'],'ContactId':_0x1a52d6['id']}))['then'](function(_0x4c01a8){_0x23ddf7['dataValues'][_0x624c('0xbe')]=[];_0x23ddf7[_0x624c('0xbf')][_0x624c('0xbe')][_0x624c('0xac')](_0x4c01a8[_0x624c('0xbf')]);return _0x23ddf7;});})[_0x624c('0x20')](respondWithResult(_0x58ff28,null))[_0x624c('0x2b')](handleError(_0x58ff28,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index c3ff005..fae6038 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 _0x50cf=['setMaxListeners','save','emit','hasOwnProperty','hook','events','WhatsappAccount'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x50cf,0x1d3));var _0xf50c=function(_0x115232,_0x1ebb6f){_0x115232=_0x115232-0x0;var _0x15de43=_0x50cf[_0x115232];return _0x15de43;};'use strict';var EventEmitter=require(_0xf50c('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0xf50c('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xf50c('0x2')](0x0);var events={'afterCreate':_0xf50c('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4140da){return function(_0x4fb4dd,_0x10e9e5,_0x56badb){WhatsappAccountEvents[_0xf50c('0x4')](_0x4140da+':'+_0x4fb4dd['id'],_0x4fb4dd);WhatsappAccountEvents['emit'](_0x4140da,_0x4fb4dd);_0x56badb(null);};}for(var e in events){if(events[_0xf50c('0x5')](e)){var event=events[e];WhatsappAccount[_0xf50c('0x6')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0xa2d5=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x138156,_0x1155e6){var _0x45fb01=function(_0x3bfdec){while(--_0x3bfdec){_0x138156['push'](_0x138156['shift']());}};_0x45fb01(++_0x1155e6);}(_0xa2d5,0x15d));var _0x5a2d=function(_0x1e66c8,_0x1fc5af){_0x1e66c8=_0x1e66c8-0x0;var _0x9f577d=_0xa2d5[_0x1e66c8];return _0x9f577d;};'use strict';var EventEmitter=require(_0x5a2d('0x0'));var WhatsappAccount=require(_0x5a2d('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x5a2d('0x2')](0x0);var events={'afterCreate':_0x5a2d('0x3'),'afterUpdate':_0x5a2d('0x4'),'afterDestroy':_0x5a2d('0x5')};function emitEvent(_0x18610d){return function(_0x15c170,_0x25ff05,_0x4dcac4){WhatsappAccountEvents[_0x5a2d('0x6')](_0x18610d+':'+_0x15c170['id'],_0x15c170);WhatsappAccountEvents[_0x5a2d('0x6')](_0x18610d,_0x15c170);_0x4dcac4(null);};}for(var e in events){if(events[_0x5a2d('0x7')](e)){var event=events[e];WhatsappAccount[_0x5a2d('0x8')](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 c108f75..e1f4ae3 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 _0x8264=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash'];(function(_0x41b9b9,_0x308c72){var _0xd10dfa=function(_0x28be45){while(--_0x28be45){_0x41b9b9['push'](_0x41b9b9['shift']());}};_0xd10dfa(++_0x308c72);}(_0x8264,0x1db));var _0x4826=function(_0x5d8018,_0x588592){_0x5d8018=_0x5d8018-0x0;var _0x151ac4=_0x8264[_0x5d8018];return _0x151ac4;};'use strict';var _=require(_0x4826('0x0'));var util=require('util');var logger=require(_0x4826('0x1'))(_0x4826('0x2'));var moment=require(_0x4826('0x3'));var BPromise=require(_0x4826('0x4'));var rp=require(_0x4826('0x5'));var fs=require('fs');var path=require(_0x4826('0x6'));var rimraf=require(_0x4826('0x7'));var config=require(_0x4826('0x8'));var attributes=require(_0x4826('0x9'));module[_0x4826('0xa')]=function(_0x55236d,_0x4c1b7f){return _0x55236d[_0x4826('0xb')](_0x4826('0xc'),attributes,{'tableName':_0x4826('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07b3=['util','../../config/logger','moment','path','../../config/environment','./whatsappAccount.attributes','WhatsappAccount','whatsapp_accounts','lodash'];(function(_0x2dcd15,_0x978a36){var _0x58ae7d=function(_0x95a26d){while(--_0x95a26d){_0x2dcd15['push'](_0x2dcd15['shift']());}};_0x58ae7d(++_0x978a36);}(_0x07b3,0x19d));var _0x307b=function(_0x3d5653,_0x4aa515){_0x3d5653=_0x3d5653-0x0;var _0x46519b=_0x07b3[_0x3d5653];return _0x46519b;};'use strict';var _=require(_0x307b('0x0'));var util=require(_0x307b('0x1'));var logger=require(_0x307b('0x2'))('api');var moment=require(_0x307b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x307b('0x4'));var rimraf=require('rimraf');var config=require(_0x307b('0x5'));var attributes=require(_0x307b('0x6'));module['exports']=function(_0x562552,_0x48e0a6){return _0x562552['define'](_0x307b('0x7'),attributes,{'tableName':_0x307b('0x8'),'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 9a148af..0f205a2 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 _0x620f=['WhatsappAccount','find','options','raw','where','attributes','include','map','model','ShowWhatsappAccount','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0x620f,0x1e6));var _0xf620=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x620f[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0xf620('0x0'));var moment=require(_0xf620('0x1'));var BPromise=require('bluebird');var rs=require(_0xf620('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf620('0x3'))['db'];var utils=require(_0xf620('0x4'));var logger=require(_0xf620('0x5'))('rpc');var config=require(_0xf620('0x6'));var jayson=require(_0xf620('0x7'));var client=jayson['client'][_0xf620('0x8')]({'port':0x232a});config[_0xf620('0x9')]=_[_0xf620('0xa')](config[_0xf620('0x9')],{'host':_0xf620('0xb'),'port':0x18eb});var socket=require(_0xf620('0xc'))(new Redis(config[_0xf620('0x9')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0xcb82df,_0x150560,_0x1ae887){return new BPromise(function(_0x4bef57,_0x2b6188){return client[_0xf620('0xd')](_0xcb82df,_0x1ae887)[_0xf620('0xe')](function(_0x2b8c04){logger[_0xf620('0xf')](_0xf620('0x10'),_0x150560,_0xf620('0x11'));logger[_0xf620('0x12')](_0xf620('0x13'),_0x150560,'request\x20sent',JSON['stringify'](_0x2b8c04));if(_0x2b8c04['error']){if(_0x2b8c04[_0xf620('0x14')][_0xf620('0x15')]===0x1f4){logger[_0xf620('0x14')](_0xf620('0x10'),_0x150560,_0x2b8c04[_0xf620('0x14')][_0xf620('0x16')]);return _0x2b6188(_0x2b8c04[_0xf620('0x14')][_0xf620('0x16')]);}logger[_0xf620('0x14')](_0xf620('0x10'),_0x150560,_0x2b8c04[_0xf620('0x14')]['message']);return _0x4bef57(_0x2b8c04[_0xf620('0x14')][_0xf620('0x16')]);}else{logger[_0xf620('0xf')](_0xf620('0x10'),_0x150560,_0xf620('0x11'));_0x4bef57(_0x2b8c04['result'][_0xf620('0x16')]);}})[_0xf620('0x17')](function(_0xfd5f7c){logger[_0xf620('0x14')](_0xf620('0x10'),_0x150560,_0xfd5f7c);_0x2b6188(_0xfd5f7c);});});}exports['ShowWhatsappAccount']=function(_0x354c8a){var _0x4bfa48=this;return new Promise(function(_0xce499d,_0x55423e){return db[_0xf620('0x18')][_0xf620('0x19')]({'raw':_0x354c8a[_0xf620('0x1a')]?_0x354c8a[_0xf620('0x1a')][_0xf620('0x1b')]===undefined?!![]:![]:!![],'where':_0x354c8a[_0xf620('0x1a')]?_0x354c8a['options'][_0xf620('0x1c')]||null:null,'attributes':_0x354c8a[_0xf620('0x1a')]?_0x354c8a[_0xf620('0x1a')][_0xf620('0x1d')]||null:null,'include':_0x354c8a[_0xf620('0x1a')]?_0x354c8a[_0xf620('0x1a')][_0xf620('0x1e')]?_['map'](_0x354c8a[_0xf620('0x1a')][_0xf620('0x1e')],function(_0x54cfa8){return{'model':db[_0x54cfa8['model']],'as':_0x54cfa8['as'],'attributes':_0x54cfa8['attributes'],'include':_0x54cfa8[_0xf620('0x1e')]?_[_0xf620('0x1f')](_0x54cfa8[_0xf620('0x1e')],function(_0x114e99){return{'model':db[_0x114e99[_0xf620('0x20')]],'as':_0x114e99['as'],'attributes':_0x114e99[_0xf620('0x1d')],'include':_0x114e99[_0xf620('0x1e')]?_['map'](_0x114e99['include'],function(_0x23003a){return{'model':db[_0x23003a['model']],'as':_0x23003a['as'],'attributes':_0x23003a[_0xf620('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf620('0xe')](function(_0x37dccc){logger[_0xf620('0xf')](_0xf620('0x21'),_0x354c8a);logger[_0xf620('0x12')](_0xf620('0x21'),_0x354c8a,JSON['stringify'](_0x37dccc));_0xce499d(_0x37dccc);})[_0xf620('0x17')](function(_0x48d5d2){logger['error'](_0xf620('0x21'),_0x48d5d2[_0xf620('0x16')],_0x354c8a);_0x55423e(_0x4bfa48[_0xf620('0x14')](0x1f4,_0x48d5d2[_0xf620('0x16')]));});});}; \ No newline at end of file +var _0x8bef=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','then','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','catch','WhatsappAccount','find','options','raw','where','include','map','model','attributes','ShowWhatsappAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x26a776,_0xb78d93){var _0x440e98=function(_0x3ee6d8){while(--_0x3ee6d8){_0x26a776['push'](_0x26a776['shift']());}};_0x440e98(++_0xb78d93);}(_0x8bef,0x66));var _0xf8be=function(_0xaecc27,_0x3b15ab){_0xaecc27=_0xaecc27-0x0;var _0x2203ec=_0x8bef[_0xaecc27];return _0x2203ec;};'use strict';var _=require(_0xf8be('0x0'));var util=require(_0xf8be('0x1'));var moment=require(_0xf8be('0x2'));var BPromise=require(_0xf8be('0x3'));var rs=require(_0xf8be('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf8be('0x5'))['db'];var utils=require(_0xf8be('0x6'));var logger=require(_0xf8be('0x7'))(_0xf8be('0x8'));var config=require(_0xf8be('0x9'));var jayson=require(_0xf8be('0xa'));var client=jayson[_0xf8be('0xb')][_0xf8be('0xc')]({'port':0x232a});config[_0xf8be('0xd')]=_[_0xf8be('0xe')](config['redis'],{'host':_0xf8be('0xf'),'port':0x18eb});var socket=require(_0xf8be('0x10'))(new Redis(config[_0xf8be('0xd')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0xba0b30,_0x41bc53,_0x1810f0){return new BPromise(function(_0x4051eb,_0x11b15e){return client['request'](_0xba0b30,_0x1810f0)[_0xf8be('0x11')](function(_0x3f411c){logger[_0xf8be('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x41bc53,'request\x20sent');logger[_0xf8be('0x13')](_0xf8be('0x14'),_0x41bc53,_0xf8be('0x15'),JSON[_0xf8be('0x16')](_0x3f411c));if(_0x3f411c[_0xf8be('0x17')]){if(_0x3f411c['error']['code']===0x1f4){logger[_0xf8be('0x17')](_0xf8be('0x18'),_0x41bc53,_0x3f411c[_0xf8be('0x17')]['message']);return _0x11b15e(_0x3f411c[_0xf8be('0x17')][_0xf8be('0x19')]);}logger[_0xf8be('0x17')](_0xf8be('0x18'),_0x41bc53,_0x3f411c[_0xf8be('0x17')][_0xf8be('0x19')]);return _0x4051eb(_0x3f411c[_0xf8be('0x17')]['message']);}else{logger[_0xf8be('0x12')](_0xf8be('0x18'),_0x41bc53,_0xf8be('0x15'));_0x4051eb(_0x3f411c['result'][_0xf8be('0x19')]);}})[_0xf8be('0x1a')](function(_0x4069b5){logger['error'](_0xf8be('0x18'),_0x41bc53,_0x4069b5);_0x11b15e(_0x4069b5);});});}exports['ShowWhatsappAccount']=function(_0x2783f9){var _0x2db0a1=this;return new Promise(function(_0x5775a8,_0x852f98){return db[_0xf8be('0x1b')][_0xf8be('0x1c')]({'raw':_0x2783f9[_0xf8be('0x1d')]?_0x2783f9[_0xf8be('0x1d')][_0xf8be('0x1e')]===undefined?!![]:![]:!![],'where':_0x2783f9[_0xf8be('0x1d')]?_0x2783f9['options'][_0xf8be('0x1f')]||null:null,'attributes':_0x2783f9['options']?_0x2783f9[_0xf8be('0x1d')]['attributes']||null:null,'include':_0x2783f9[_0xf8be('0x1d')]?_0x2783f9[_0xf8be('0x1d')][_0xf8be('0x20')]?_[_0xf8be('0x21')](_0x2783f9[_0xf8be('0x1d')][_0xf8be('0x20')],function(_0x5bb12f){return{'model':db[_0x5bb12f[_0xf8be('0x22')]],'as':_0x5bb12f['as'],'attributes':_0x5bb12f['attributes'],'include':_0x5bb12f[_0xf8be('0x20')]?_[_0xf8be('0x21')](_0x5bb12f[_0xf8be('0x20')],function(_0x2a7c77){return{'model':db[_0x2a7c77[_0xf8be('0x22')]],'as':_0x2a7c77['as'],'attributes':_0x2a7c77[_0xf8be('0x23')],'include':_0x2a7c77[_0xf8be('0x20')]?_[_0xf8be('0x21')](_0x2a7c77[_0xf8be('0x20')],function(_0x4f5e02){return{'model':db[_0x4f5e02[_0xf8be('0x22')]],'as':_0x4f5e02['as'],'attributes':_0x4f5e02['attributes']};}):[]};}):[]};}):[]:[]})[_0xf8be('0x11')](function(_0x5eedc6){logger[_0xf8be('0x12')]('ShowWhatsappAccount',_0x2783f9);logger['debug'](_0xf8be('0x24'),_0x2783f9,JSON[_0xf8be('0x16')](_0x5eedc6));_0x5775a8(_0x5eedc6);})[_0xf8be('0x1a')](function(_0x520eac){logger[_0xf8be('0x17')](_0xf8be('0x24'),_0x520eac[_0xf8be('0x19')],_0x2783f9);_0x852f98(_0x2db0a1[_0xf8be('0x17')](0x1f4,_0x520eac[_0xf8be('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index ee71163..4e0ae1a 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 _0xc711=['length','whatsappAccount:','./whatsappAccount.events','save','remove','emit','removeListener','register'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc711,0x1b2));var _0x1c71=function(_0x3a8db5,_0x31cff7){_0x3a8db5=_0x3a8db5-0x0;var _0x2c03cd=_0xc711[_0x3a8db5];return _0x2c03cd;};'use strict';var WhatsappAccountEvents=require(_0x1c71('0x0'));var events=[_0x1c71('0x1'),_0x1c71('0x2'),'update'];function createListener(_0x52634d,_0x340a9e){return function(_0x3a1779){_0x340a9e[_0x1c71('0x3')](_0x52634d,_0x3a1779);};}function removeListener(_0x35afc1,_0x268afd){return function(){WhatsappAccountEvents[_0x1c71('0x4')](_0x35afc1,_0x268afd);};}exports[_0x1c71('0x5')]=function(_0x50721c){for(var _0x3713af=0x0,_0x398c1b=events[_0x1c71('0x6')];_0x3713af<_0x398c1b;_0x3713af++){var _0x2e40c3=events[_0x3713af];var _0x434447=createListener(_0x1c71('0x7')+_0x2e40c3,_0x50721c);WhatsappAccountEvents['on'](_0x2e40c3,_0x434447);}}; \ No newline at end of file +var _0x6da1=['remove','update','emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events','save'];(function(_0x4b744a,_0x308bef){var _0x4572fc=function(_0x53f5c4){while(--_0x53f5c4){_0x4b744a['push'](_0x4b744a['shift']());}};_0x4572fc(++_0x308bef);}(_0x6da1,0x1db));var _0x16da=function(_0x2d0d9f,_0x22c0d8){_0x2d0d9f=_0x2d0d9f-0x0;var _0x30243d=_0x6da1[_0x2d0d9f];return _0x30243d;};'use strict';var WhatsappAccountEvents=require(_0x16da('0x0'));var events=[_0x16da('0x1'),_0x16da('0x2'),_0x16da('0x3')];function createListener(_0x3ae787,_0x2504cd){return function(_0xe792bf){_0x2504cd[_0x16da('0x4')](_0x3ae787,_0xe792bf);};}function removeListener(_0x20a92d,_0xfcb555){return function(){WhatsappAccountEvents[_0x16da('0x5')](_0x20a92d,_0xfcb555);};}exports[_0x16da('0x6')]=function(_0x16fcf9){for(var _0x5927cb=0x0,_0x45d30b=events[_0x16da('0x7')];_0x5927cb<_0x45d30b;_0x5927cb++){var _0x6cf20e=events[_0x5927cb];var _0xb93207=createListener(_0x16da('0x8')+_0x6cf20e,_0x16fcf9);WhatsappAccountEvents['on'](_0x6cf20e,_0xb93207);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 37efcdb..204d696 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 _0x196e=['update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x1749bc,_0x25cf8d){var _0x41244f=function(_0x341cb1){while(--_0x341cb1){_0x1749bc['push'](_0x1749bc['shift']());}};_0x41244f(++_0x25cf8d);}(_0x196e,0x1d0));var _0xe196=function(_0x2f87cd,_0xcaf299){_0x2f87cd=_0x2f87cd-0x0;var _0x5d7eda=_0x196e[_0x2f87cd];return _0x5d7eda;};'use strict';var multer=require('multer');var util=require(_0xe196('0x0'));var path=require(_0xe196('0x1'));var timeout=require('connect-timeout');var express=require(_0xe196('0x2'));var router=express[_0xe196('0x3')]();var fs_extra=require(_0xe196('0x4'));var auth=require(_0xe196('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe196('0x6'));var controller=require(_0xe196('0x7'));router[_0xe196('0x8')]('/',auth[_0xe196('0x9')](),controller[_0xe196('0xa')]);router[_0xe196('0x8')](_0xe196('0xb'),auth[_0xe196('0x9')](),controller[_0xe196('0xc')]);router[_0xe196('0xd')]('/',auth['isAuthenticated'](),controller[_0xe196('0xe')]);router[_0xe196('0xf')](_0xe196('0xb'),auth[_0xe196('0x9')](),controller[_0xe196('0x10')]);router[_0xe196('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xe196('0x12')]);module[_0xe196('0x13')]=router; \ No newline at end of file +var _0x0fe9=['/:id','post','create','put','update','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0fe9,0x1e7));var _0x90fe=function(_0x470613,_0x5b4daa){_0x470613=_0x470613-0x0;var _0x437860=_0x0fe9[_0x470613];return _0x437860;};'use strict';var multer=require(_0x90fe('0x0'));var util=require('util');var path=require(_0x90fe('0x1'));var timeout=require(_0x90fe('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x90fe('0x3'));var interaction=require(_0x90fe('0x4'));var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router[_0x90fe('0x5')]('/',auth[_0x90fe('0x6')](),controller[_0x90fe('0x7')]);router[_0x90fe('0x5')](_0x90fe('0x8'),auth[_0x90fe('0x6')](),controller['show']);router[_0x90fe('0x9')]('/',auth[_0x90fe('0x6')](),controller[_0x90fe('0xa')]);router[_0x90fe('0xb')](_0x90fe('0x8'),auth[_0x90fe('0x6')](),controller[_0x90fe('0xc')]);router['delete'](_0x90fe('0x8'),auth[_0x90fe('0x6')](),controller[_0x90fe('0xd')]);module[_0x90fe('0xe')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index ad5c22d..204fcd2 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 _0xe4be=['TEXT','*,*,*,*','STRING','noop'];(function(_0x9ed750,_0x113b83){var _0x554f93=function(_0x2af747){while(--_0x2af747){_0x9ed750['push'](_0x9ed750['shift']());}};_0x554f93(++_0x113b83);}(_0xe4be,0x1ee));var _0xee4b=function(_0x291d16,_0x3eed8f){_0x291d16=_0x291d16-0x0;var _0x5823c6=_0xe4be[_0x291d16];return _0x5823c6;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xee4b('0x0')],'allowNull':![],'defaultValue':_0xee4b('0x1')},'appdata':{'type':Sequelize[_0xee4b('0x2')]()},'description':{'type':Sequelize[_0xee4b('0x0')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xee4b('0x3')}}; \ No newline at end of file +var _0xe62d=['TEXT','*,*,*,*','exports','STRING','noop'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe62d,0xb6));var _0xde62=function(_0x340b1b,_0x4f21b6){_0x340b1b=_0x340b1b-0x0;var _0x41b74e=_0xe62d[_0x340b1b];return _0x41b74e;};'use strict';var Sequelize=require('sequelize');module[_0xde62('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xde62('0x1')],'allowNull':![],'defaultValue':_0xde62('0x2')},'appdata':{'type':Sequelize[_0xde62('0x3')]()},'description':{'type':Sequelize[_0xde62('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xde62('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 789cc37..1413e07 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 _0xba6f=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','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','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','map','WhatsappApplication','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','rawAttributes','options','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x2732f9,_0x177341){var _0x2ec373=function(_0x2c26d7){while(--_0x2c26d7){_0x2732f9['push'](_0x2732f9['shift']());}};_0x2ec373(++_0x177341);}(_0xba6f,0x1d0));var _0xfba6=function(_0x1b5a05,_0x2c80de){_0x1b5a05=_0x1b5a05-0x0;var _0x347931=_0xba6f[_0x1b5a05];return _0x347931;};'use strict';var emlformat=require(_0xfba6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfba6('0x1'));var jsonpatch=require(_0xfba6('0x2'));var rp=require(_0xfba6('0x3'));var moment=require(_0xfba6('0x4'));var BPromise=require(_0xfba6('0x5'));var Mustache=require(_0xfba6('0x6'));var util=require(_0xfba6('0x7'));var path=require(_0xfba6('0x8'));var sox=require(_0xfba6('0x9'));var csv=require(_0xfba6('0xa'));var ejs=require(_0xfba6('0xb'));var fs=require('fs');var fs_extra=require(_0xfba6('0xc'));var _=require(_0xfba6('0xd'));var squel=require('squel');var crypto=require(_0xfba6('0xe'));var jsforce=require(_0xfba6('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfba6('0x10'));var Redis=require(_0xfba6('0x11'));var authService=require(_0xfba6('0x12'));var qs=require(_0xfba6('0x13'));var as=require(_0xfba6('0x14'));var hardwareService=require(_0xfba6('0x15'));var logger=require(_0xfba6('0x16'))(_0xfba6('0x17'));var utils=require(_0xfba6('0x18'));var config=require(_0xfba6('0x19'));var licenseUtil=require(_0xfba6('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcfafdb,_0xd34d87){_0xd34d87=_0xd34d87||0xcc;return function(_0x315faf){if(_0x315faf){return _0xcfafdb[_0xfba6('0x1b')](_0xd34d87);}return _0xcfafdb['status'](_0xd34d87)[_0xfba6('0x1c')]();};}function respondWithResult(_0x5dc9e1,_0x4f465f){_0x4f465f=_0x4f465f||0xc8;return function(_0x184169){if(_0x184169){return _0x5dc9e1[_0xfba6('0x1d')](_0x4f465f)[_0xfba6('0x1e')](_0x184169);}};}function respondWithFilteredResult(_0x1d76de,_0x38055e){return function(_0x2c4692){if(_0x2c4692){var _0x24b6a0=typeof _0x38055e[_0xfba6('0x1f')]===_0xfba6('0x20')&&typeof _0x38055e[_0xfba6('0x21')]===_0xfba6('0x20');var _0xf3dbbc=_0x2c4692[_0xfba6('0x22')];var _0x5a29a4=_0x24b6a0?0x0:_0x38055e[_0xfba6('0x1f')];var _0x267c09=_0x24b6a0?_0x2c4692['count']:_0x38055e['offset']+_0x38055e[_0xfba6('0x21')];var _0x204784;if(_0x267c09>=_0xf3dbbc){_0x267c09=_0xf3dbbc;_0x204784=0xc8;}else{_0x204784=0xce;}_0x1d76de['status'](_0x204784);return _0x1d76de[_0xfba6('0x23')](_0xfba6('0x24'),_0x5a29a4+'-'+_0x267c09+'/'+_0xf3dbbc)[_0xfba6('0x1e')](_0x2c4692);}return null;};}function patchUpdates(_0x4f1d15){return function(_0x167528){try{jsonpatch[_0xfba6('0x25')](_0x167528,_0x4f1d15,!![]);}catch(_0xa16868){return BPromise['reject'](_0xa16868);}return _0x167528[_0xfba6('0x26')]();};}function saveUpdates(_0x12f000,_0x25e0ff){return function(_0x2afd26){if(_0x2afd26){return _0x2afd26[_0xfba6('0x27')](_0x12f000)[_0xfba6('0x28')](function(_0x203a4e){return _0x203a4e;});}return null;};}function removeEntity(_0x56b427,_0x5e09ff){return function(_0x41b356){if(_0x41b356){return _0x41b356[_0xfba6('0x29')]()[_0xfba6('0x28')](function(){_0x56b427[_0xfba6('0x1d')](0xcc)[_0xfba6('0x1c')]();});}};}function handleEntityNotFound(_0x53c99a,_0x408ccc){return function(_0x4114bc){if(!_0x4114bc){_0x53c99a[_0xfba6('0x1b')](0x194);}return _0x4114bc;};}function handleError(_0x11bde3,_0x3af399){_0x3af399=_0x3af399||0x1f4;return function(_0x7c7f6a){logger['error'](_0x7c7f6a[_0xfba6('0x2a')]);if(_0x7c7f6a[_0xfba6('0x2b')]){delete _0x7c7f6a['name'];}_0x11bde3[_0xfba6('0x1d')](_0x3af399)[_0xfba6('0x2c')](_0x7c7f6a);};}exports['index']=function(_0x2d703e,_0x3da118){var _0x5f31af={},_0x47973f={},_0x56e8e6={'count':0x0,'rows':[]};var _0xf8134a=_[_0xfba6('0x2d')](db[_0xfba6('0x2e')]['rawAttributes'],function(_0x17440e){return{'name':_0x17440e[_0xfba6('0x2f')],'type':_0x17440e[_0xfba6('0x30')][_0xfba6('0x31')]};});_0x47973f['model']=_[_0xfba6('0x2d')](_0xf8134a,'name');_0x47973f[_0xfba6('0x32')]=_[_0xfba6('0x33')](_0x2d703e[_0xfba6('0x32')]);_0x47973f[_0xfba6('0x34')]=_[_0xfba6('0x35')](_0x47973f['model'],_0x47973f[_0xfba6('0x32')]);_0x5f31af[_0xfba6('0x36')]=_['intersection'](_0x47973f[_0xfba6('0x37')],qs[_0xfba6('0x38')](_0x2d703e[_0xfba6('0x32')][_0xfba6('0x38')]));_0x5f31af[_0xfba6('0x36')]=_0x5f31af[_0xfba6('0x36')][_0xfba6('0x39')]?_0x5f31af[_0xfba6('0x36')]:_0x47973f[_0xfba6('0x37')];if(!_0x2d703e[_0xfba6('0x32')][_0xfba6('0x3a')](_0xfba6('0x3b'))){_0x5f31af['limit']=qs[_0xfba6('0x21')](_0x2d703e[_0xfba6('0x32')][_0xfba6('0x21')]);_0x5f31af[_0xfba6('0x1f')]=qs[_0xfba6('0x1f')](_0x2d703e[_0xfba6('0x32')][_0xfba6('0x1f')]);}_0x5f31af[_0xfba6('0x3c')]=qs[_0xfba6('0x3d')](_0x2d703e[_0xfba6('0x32')][_0xfba6('0x3d')]);_0x5f31af['where']=qs[_0xfba6('0x34')](_['pick'](_0x2d703e[_0xfba6('0x32')],_0x47973f[_0xfba6('0x34')]),_0xf8134a);if(_0x2d703e[_0xfba6('0x32')][_0xfba6('0x3e')]){_0x5f31af[_0xfba6('0x3f')]=_[_0xfba6('0x40')](_0x5f31af[_0xfba6('0x3f')],{'$or':_[_0xfba6('0x2d')](_0xf8134a,function(_0x5bad10){if(_0x5bad10[_0xfba6('0x30')]!==_0xfba6('0x41')){var _0x4807f5={};_0x4807f5[_0x5bad10[_0xfba6('0x2b')]]={'$like':'%'+_0x2d703e['query'][_0xfba6('0x3e')]+'%'};return _0x4807f5;}})});}_0x5f31af=_[_0xfba6('0x40')]({},_0x5f31af,_0x2d703e['options']);var _0x203c67={'where':_0x5f31af[_0xfba6('0x3f')]};return db[_0xfba6('0x2e')]['count'](_0x203c67)[_0xfba6('0x28')](function(_0x18d17c){_0x56e8e6[_0xfba6('0x22')]=_0x18d17c;if(_0x2d703e[_0xfba6('0x32')][_0xfba6('0x42')]){_0x5f31af[_0xfba6('0x43')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xfba6('0x44')](_0x5f31af);})[_0xfba6('0x28')](function(_0x27a493){_0x56e8e6[_0xfba6('0x45')]=_0x27a493;return _0x56e8e6;})[_0xfba6('0x28')](respondWithFilteredResult(_0x3da118,_0x5f31af))[_0xfba6('0x46')](handleError(_0x3da118,null));};exports[_0xfba6('0x47')]=function(_0x28a9d6,_0x51ee39){var _0x47ca82={'raw':!![],'where':{'id':_0x28a9d6['params']['id']}},_0x18b81d={};_0x18b81d[_0xfba6('0x37')]=_[_0xfba6('0x33')](db[_0xfba6('0x2e')][_0xfba6('0x48')]);_0x18b81d['query']=_[_0xfba6('0x33')](_0x28a9d6['query']);_0x18b81d[_0xfba6('0x34')]=_['intersection'](_0x18b81d[_0xfba6('0x37')],_0x18b81d[_0xfba6('0x32')]);_0x47ca82[_0xfba6('0x36')]=_[_0xfba6('0x35')](_0x18b81d[_0xfba6('0x37')],qs[_0xfba6('0x38')](_0x28a9d6[_0xfba6('0x32')][_0xfba6('0x38')]));_0x47ca82[_0xfba6('0x36')]=_0x47ca82['attributes'][_0xfba6('0x39')]?_0x47ca82[_0xfba6('0x36')]:_0x18b81d[_0xfba6('0x37')];if(_0x28a9d6[_0xfba6('0x32')][_0xfba6('0x42')]){_0x47ca82[_0xfba6('0x43')]=[{'all':!![]}];}_0x47ca82=_[_0xfba6('0x40')]({},_0x47ca82,_0x28a9d6[_0xfba6('0x49')]);return db[_0xfba6('0x2e')][_0xfba6('0x4a')](_0x47ca82)[_0xfba6('0x28')](handleEntityNotFound(_0x51ee39,null))[_0xfba6('0x28')](respondWithResult(_0x51ee39,null))[_0xfba6('0x46')](handleError(_0x51ee39,null));};exports[_0xfba6('0x4b')]=function(_0x2c3e90,_0x56900e){return db[_0xfba6('0x2e')][_0xfba6('0x4b')](_0x2c3e90[_0xfba6('0x4c')],{})[_0xfba6('0x28')](respondWithResult(_0x56900e,0xc9))[_0xfba6('0x46')](handleError(_0x56900e,null));};exports[_0xfba6('0x27')]=function(_0x26c050,_0xb637ca){if(_0x26c050['body']['id']){delete _0x26c050['body']['id'];}return db[_0xfba6('0x2e')][_0xfba6('0x4a')]({'where':{'id':_0x26c050[_0xfba6('0x4d')]['id']}})[_0xfba6('0x28')](handleEntityNotFound(_0xb637ca,null))[_0xfba6('0x28')](saveUpdates(_0x26c050['body'],null))['then'](respondWithResult(_0xb637ca,null))[_0xfba6('0x46')](handleError(_0xb637ca,null));};exports[_0xfba6('0x29')]=function(_0x4f78ff,_0x4c150){return db[_0xfba6('0x2e')][_0xfba6('0x4a')]({'where':{'id':_0x4f78ff['params']['id']}})[_0xfba6('0x28')](handleEntityNotFound(_0x4c150,null))['then'](removeEntity(_0x4c150,null))[_0xfba6('0x46')](handleError(_0x4c150,null));}; \ No newline at end of file +var _0x2bab=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','params','find','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','WhatsappApplication','rawAttributes','fieldName','key','model','query','keys','intersection'];(function(_0x9095fe,_0x18050c){var _0x21ddc0=function(_0xf20c02){while(--_0xf20c02){_0x9095fe['push'](_0x9095fe['shift']());}};_0x21ddc0(++_0x18050c);}(_0x2bab,0x1ba));var _0xb2ba=function(_0x58dbf2,_0x485b1b){_0x58dbf2=_0x58dbf2-0x0;var _0x1d2a8c=_0x2bab[_0x58dbf2];return _0x1d2a8c;};'use strict';var emlformat=require(_0xb2ba('0x0'));var rimraf=require(_0xb2ba('0x1'));var zipdir=require(_0xb2ba('0x2'));var jsonpatch=require(_0xb2ba('0x3'));var rp=require('request-promise');var moment=require(_0xb2ba('0x4'));var BPromise=require(_0xb2ba('0x5'));var Mustache=require(_0xb2ba('0x6'));var util=require('util');var path=require(_0xb2ba('0x7'));var sox=require(_0xb2ba('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb2ba('0x9'));var squel=require('squel');var crypto=require(_0xb2ba('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb2ba('0xb'));var querystring=require(_0xb2ba('0xc'));var Papa=require(_0xb2ba('0xd'));var Redis=require(_0xb2ba('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb2ba('0xf'));var as=require(_0xb2ba('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb2ba('0x11'));var utils=require(_0xb2ba('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xb2ba('0x13'));var db=require(_0xb2ba('0x14'))['db'];function respondWithStatusCode(_0x294301,_0x55317a){_0x55317a=_0x55317a||0xcc;return function(_0x44fe02){if(_0x44fe02){return _0x294301[_0xb2ba('0x15')](_0x55317a);}return _0x294301[_0xb2ba('0x16')](_0x55317a)[_0xb2ba('0x17')]();};}function respondWithResult(_0x14b5bc,_0x5d0455){_0x5d0455=_0x5d0455||0xc8;return function(_0x4f09a9){if(_0x4f09a9){return _0x14b5bc['status'](_0x5d0455)[_0xb2ba('0x18')](_0x4f09a9);}};}function respondWithFilteredResult(_0x1093cf,_0xaf8c1d){return function(_0x1f73a1){if(_0x1f73a1){var _0x52716a=typeof _0xaf8c1d['offset']===_0xb2ba('0x19')&&typeof _0xaf8c1d[_0xb2ba('0x1a')]===_0xb2ba('0x19');var _0x3a9fa6=_0x1f73a1[_0xb2ba('0x1b')];var _0x3e770f=_0x52716a?0x0:_0xaf8c1d[_0xb2ba('0x1c')];var _0x326b49=_0x52716a?_0x1f73a1[_0xb2ba('0x1b')]:_0xaf8c1d[_0xb2ba('0x1c')]+_0xaf8c1d[_0xb2ba('0x1a')];var _0x5189fa;if(_0x326b49>=_0x3a9fa6){_0x326b49=_0x3a9fa6;_0x5189fa=0xc8;}else{_0x5189fa=0xce;}_0x1093cf[_0xb2ba('0x16')](_0x5189fa);return _0x1093cf[_0xb2ba('0x1d')](_0xb2ba('0x1e'),_0x3e770f+'-'+_0x326b49+'/'+_0x3a9fa6)[_0xb2ba('0x18')](_0x1f73a1);}return null;};}function patchUpdates(_0x34aab5){return function(_0x5643a6){try{jsonpatch[_0xb2ba('0x1f')](_0x5643a6,_0x34aab5,!![]);}catch(_0x11a8f3){return BPromise[_0xb2ba('0x20')](_0x11a8f3);}return _0x5643a6[_0xb2ba('0x21')]();};}function saveUpdates(_0x19c0b8,_0x4639a9){return function(_0x588e34){if(_0x588e34){return _0x588e34[_0xb2ba('0x22')](_0x19c0b8)[_0xb2ba('0x23')](function(_0x45aeba){return _0x45aeba;});}return null;};}function removeEntity(_0x52d48d,_0xb4e5cf){return function(_0x2b22f5){if(_0x2b22f5){return _0x2b22f5[_0xb2ba('0x24')]()['then'](function(){_0x52d48d[_0xb2ba('0x16')](0xcc)[_0xb2ba('0x17')]();});}};}function handleEntityNotFound(_0x3684e3,_0xa86dbb){return function(_0x383c14){if(!_0x383c14){_0x3684e3[_0xb2ba('0x15')](0x194);}return _0x383c14;};}function handleError(_0xa64b7d,_0x4e9ae8){_0x4e9ae8=_0x4e9ae8||0x1f4;return function(_0x5ca398){logger[_0xb2ba('0x25')](_0x5ca398['stack']);if(_0x5ca398[_0xb2ba('0x26')]){delete _0x5ca398[_0xb2ba('0x26')];}_0xa64b7d[_0xb2ba('0x16')](_0x4e9ae8)['send'](_0x5ca398);};}exports[_0xb2ba('0x27')]=function(_0x5506f9,_0xba600a){var _0x2e63c9={},_0x254312={},_0x553cec={'count':0x0,'rows':[]};var _0x1248e7=_['map'](db[_0xb2ba('0x28')][_0xb2ba('0x29')],function(_0x4baaf5){return{'name':_0x4baaf5[_0xb2ba('0x2a')],'type':_0x4baaf5['type'][_0xb2ba('0x2b')]};});_0x254312[_0xb2ba('0x2c')]=_['map'](_0x1248e7,_0xb2ba('0x26'));_0x254312[_0xb2ba('0x2d')]=_[_0xb2ba('0x2e')](_0x5506f9['query']);_0x254312['filters']=_[_0xb2ba('0x2f')](_0x254312[_0xb2ba('0x2c')],_0x254312[_0xb2ba('0x2d')]);_0x2e63c9['attributes']=_[_0xb2ba('0x2f')](_0x254312[_0xb2ba('0x2c')],qs['fields'](_0x5506f9[_0xb2ba('0x2d')][_0xb2ba('0x30')]));_0x2e63c9['attributes']=_0x2e63c9[_0xb2ba('0x31')][_0xb2ba('0x32')]?_0x2e63c9[_0xb2ba('0x31')]:_0x254312['model'];if(!_0x5506f9[_0xb2ba('0x2d')][_0xb2ba('0x33')](_0xb2ba('0x34'))){_0x2e63c9['limit']=qs[_0xb2ba('0x1a')](_0x5506f9[_0xb2ba('0x2d')][_0xb2ba('0x1a')]);_0x2e63c9[_0xb2ba('0x1c')]=qs[_0xb2ba('0x1c')](_0x5506f9['query'][_0xb2ba('0x1c')]);}_0x2e63c9[_0xb2ba('0x35')]=qs[_0xb2ba('0x36')](_0x5506f9[_0xb2ba('0x2d')][_0xb2ba('0x36')]);_0x2e63c9[_0xb2ba('0x37')]=qs[_0xb2ba('0x38')](_[_0xb2ba('0x39')](_0x5506f9[_0xb2ba('0x2d')],_0x254312['filters']),_0x1248e7);if(_0x5506f9['query'][_0xb2ba('0x3a')]){_0x2e63c9['where']=_[_0xb2ba('0x3b')](_0x2e63c9['where'],{'$or':_['map'](_0x1248e7,function(_0x444b01){if(_0x444b01[_0xb2ba('0x3c')]!=='VIRTUAL'){var _0x2b970c={};_0x2b970c[_0x444b01[_0xb2ba('0x26')]]={'$like':'%'+_0x5506f9[_0xb2ba('0x2d')][_0xb2ba('0x3a')]+'%'};return _0x2b970c;}})});}_0x2e63c9=_[_0xb2ba('0x3b')]({},_0x2e63c9,_0x5506f9[_0xb2ba('0x3d')]);var _0x356102={'where':_0x2e63c9[_0xb2ba('0x37')]};return db[_0xb2ba('0x28')][_0xb2ba('0x1b')](_0x356102)[_0xb2ba('0x23')](function(_0x4461c2){_0x553cec[_0xb2ba('0x1b')]=_0x4461c2;if(_0x5506f9[_0xb2ba('0x2d')][_0xb2ba('0x3e')]){_0x2e63c9[_0xb2ba('0x3f')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xb2ba('0x40')](_0x2e63c9);})[_0xb2ba('0x23')](function(_0x1f3541){_0x553cec[_0xb2ba('0x41')]=_0x1f3541;return _0x553cec;})['then'](respondWithFilteredResult(_0xba600a,_0x2e63c9))[_0xb2ba('0x42')](handleError(_0xba600a,null));};exports['show']=function(_0x789d99,_0x5a7811){var _0x51bb6b={'raw':!![],'where':{'id':_0x789d99[_0xb2ba('0x43')]['id']}},_0x13c316={};_0x13c316[_0xb2ba('0x2c')]=_[_0xb2ba('0x2e')](db['WhatsappApplication'][_0xb2ba('0x29')]);_0x13c316['query']=_[_0xb2ba('0x2e')](_0x789d99[_0xb2ba('0x2d')]);_0x13c316[_0xb2ba('0x38')]=_[_0xb2ba('0x2f')](_0x13c316[_0xb2ba('0x2c')],_0x13c316['query']);_0x51bb6b[_0xb2ba('0x31')]=_[_0xb2ba('0x2f')](_0x13c316[_0xb2ba('0x2c')],qs[_0xb2ba('0x30')](_0x789d99['query']['fields']));_0x51bb6b[_0xb2ba('0x31')]=_0x51bb6b[_0xb2ba('0x31')]['length']?_0x51bb6b[_0xb2ba('0x31')]:_0x13c316[_0xb2ba('0x2c')];if(_0x789d99[_0xb2ba('0x2d')][_0xb2ba('0x3e')]){_0x51bb6b[_0xb2ba('0x3f')]=[{'all':!![]}];}_0x51bb6b=_[_0xb2ba('0x3b')]({},_0x51bb6b,_0x789d99[_0xb2ba('0x3d')]);return db[_0xb2ba('0x28')][_0xb2ba('0x44')](_0x51bb6b)[_0xb2ba('0x23')](handleEntityNotFound(_0x5a7811,null))['then'](respondWithResult(_0x5a7811,null))[_0xb2ba('0x42')](handleError(_0x5a7811,null));};exports['create']=function(_0x1c496d,_0xd17afe){return db['WhatsappApplication']['create'](_0x1c496d[_0xb2ba('0x45')],{})[_0xb2ba('0x23')](respondWithResult(_0xd17afe,0xc9))[_0xb2ba('0x42')](handleError(_0xd17afe,null));};exports[_0xb2ba('0x22')]=function(_0x3ffde0,_0x4939d2){if(_0x3ffde0['body']['id']){delete _0x3ffde0['body']['id'];}return db[_0xb2ba('0x28')][_0xb2ba('0x44')]({'where':{'id':_0x3ffde0['params']['id']}})['then'](handleEntityNotFound(_0x4939d2,null))[_0xb2ba('0x23')](saveUpdates(_0x3ffde0['body'],null))[_0xb2ba('0x23')](respondWithResult(_0x4939d2,null))['catch'](handleError(_0x4939d2,null));};exports[_0xb2ba('0x24')]=function(_0x44827d,_0x155320){return db[_0xb2ba('0x28')][_0xb2ba('0x44')]({'where':{'id':_0x44827d[_0xb2ba('0x43')]['id']}})[_0xb2ba('0x23')](handleEntityNotFound(_0x155320,null))[_0xb2ba('0x23')](removeEntity(_0x155320,null))[_0xb2ba('0x42')](handleError(_0x155320,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 98d2ee1..aa83428 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 _0x7c8e=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x23adc7,_0x179278){var _0x5c2d5c=function(_0x371a00){while(--_0x371a00){_0x23adc7['push'](_0x23adc7['shift']());}};_0x5c2d5c(++_0x179278);}(_0x7c8e,0x10e));var _0xe7c8=function(_0x20ee5a,_0x409903){_0x20ee5a=_0x20ee5a-0x0;var _0x4573bf=_0x7c8e[_0x20ee5a];return _0x4573bf;};'use strict';var _=require('lodash');var util=require(_0xe7c8('0x0'));var logger=require(_0xe7c8('0x1'))(_0xe7c8('0x2'));var moment=require(_0xe7c8('0x3'));var BPromise=require(_0xe7c8('0x4'));var rp=require(_0xe7c8('0x5'));var fs=require('fs');var path=require(_0xe7c8('0x6'));var rimraf=require(_0xe7c8('0x7'));var config=require(_0xe7c8('0x8'));var attributes=require(_0xe7c8('0x9'));module[_0xe7c8('0xa')]=function(_0x1f0a65,_0x293383){return _0x1f0a65[_0xe7c8('0xb')](_0xe7c8('0xc'),attributes,{'tableName':_0xe7c8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe7c8('0xe'),'collate':_0xe7c8('0xf')});}; \ No newline at end of file +var _0x34e5=['./whatsappApplication.attributes','exports','define','WhatsappApplication','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x445edd,_0x34fbce){var _0x2f7128=function(_0x490275){while(--_0x490275){_0x445edd['push'](_0x445edd['shift']());}};_0x2f7128(++_0x34fbce);}(_0x34e5,0x172));var _0x534e=function(_0x6d243d,_0x566e5d){_0x6d243d=_0x6d243d-0x0;var _0x4ed985=_0x34e5[_0x6d243d];return _0x4ed985;};'use strict';var _=require('lodash');var util=require(_0x534e('0x0'));var logger=require('../../config/logger')(_0x534e('0x1'));var moment=require(_0x534e('0x2'));var BPromise=require(_0x534e('0x3'));var rp=require(_0x534e('0x4'));var fs=require('fs');var path=require(_0x534e('0x5'));var rimraf=require('rimraf');var config=require(_0x534e('0x6'));var attributes=require(_0x534e('0x7'));module[_0x534e('0x8')]=function(_0x117f0c,_0x436a92){return _0x117f0c[_0x534e('0x9')](_0x534e('0xa'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x534e('0xb'),'collate':_0x534e('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 2883fb2..a464035 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 _0x9f62=['util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','WhatsappApplication,\x20%s,\x20%s','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch'];(function(_0x54fcb1,_0x5d76e1){var _0x34cc0d=function(_0x5abfbe){while(--_0x5abfbe){_0x54fcb1['push'](_0x54fcb1['shift']());}};_0x34cc0d(++_0x5d76e1);}(_0x9f62,0x154));var _0x29f6=function(_0x58405a,_0x10b503){_0x58405a=_0x58405a-0x0;var _0x342e34=_0x9f62[_0x58405a];return _0x342e34;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var moment=require('moment');var BPromise=require(_0x29f6('0x1'));var rs=require(_0x29f6('0x2'));var fs=require('fs');var Redis=require(_0x29f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x29f6('0x4'))(_0x29f6('0x5'));var config=require(_0x29f6('0x6'));var jayson=require(_0x29f6('0x7'));var client=jayson['client'][_0x29f6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x272876,_0x9a43fe,_0x2ba602){return new BPromise(function(_0x416c6c,_0x5e9945){return client['request'](_0x272876,_0x2ba602)['then'](function(_0x549f64){logger[_0x29f6('0x9')](_0x29f6('0xa'),_0x9a43fe,'request\x20sent');logger['debug'](_0x29f6('0xb'),_0x9a43fe,_0x29f6('0xc'),JSON['stringify'](_0x549f64));if(_0x549f64[_0x29f6('0xd')]){if(_0x549f64[_0x29f6('0xd')]['code']===0x1f4){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x9a43fe,_0x549f64['error'][_0x29f6('0xe')]);return _0x5e9945(_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);}logger[_0x29f6('0xd')](_0x29f6('0xa'),_0x9a43fe,_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);return _0x416c6c(_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);}else{logger[_0x29f6('0x9')](_0x29f6('0xa'),_0x9a43fe,_0x29f6('0xc'));_0x416c6c(_0x549f64[_0x29f6('0xf')][_0x29f6('0xe')]);}})[_0x29f6('0x10')](function(_0x14dd56){logger[_0x29f6('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x9a43fe,_0x14dd56);_0x5e9945(_0x14dd56);});});} \ No newline at end of file +var _0xda55=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x22ac92,_0x5b15e8){var _0x489cde=function(_0xa927cf){while(--_0xa927cf){_0x22ac92['push'](_0x22ac92['shift']());}};_0x489cde(++_0x5b15e8);}(_0xda55,0x6d));var _0x5da5=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xda55[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5da5('0x2'));var fs=require('fs');var Redis=require(_0x5da5('0x3'));var db=require(_0x5da5('0x4'))['db'];var utils=require(_0x5da5('0x5'));var logger=require(_0x5da5('0x6'))('rpc');var config=require(_0x5da5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5da5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fd877,_0x267469,_0x71b187){return new BPromise(function(_0x46290d,_0x3debdf){return client[_0x5da5('0x9')](_0x2fd877,_0x71b187)[_0x5da5('0xa')](function(_0x302795){logger['info'](_0x5da5('0xb'),_0x267469,_0x5da5('0xc'));logger[_0x5da5('0xd')](_0x5da5('0xe'),_0x267469,_0x5da5('0xc'),JSON[_0x5da5('0xf')](_0x302795));if(_0x302795[_0x5da5('0x10')]){if(_0x302795['error'][_0x5da5('0x11')]===0x1f4){logger[_0x5da5('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x267469,_0x302795[_0x5da5('0x10')][_0x5da5('0x12')]);return _0x3debdf(_0x302795[_0x5da5('0x10')][_0x5da5('0x12')]);}logger[_0x5da5('0x10')](_0x5da5('0xb'),_0x267469,_0x302795['error']['message']);return _0x46290d(_0x302795['error'][_0x5da5('0x12')]);}else{logger[_0x5da5('0x13')](_0x5da5('0xb'),_0x267469,_0x5da5('0xc'));_0x46290d(_0x302795[_0x5da5('0x14')][_0x5da5('0x12')]);}})[_0x5da5('0x15')](function(_0x4a952a){logger[_0x5da5('0x10')](_0x5da5('0xb'),_0x267469,_0x4a952a);_0x3debdf(_0x4a952a);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 881476e..b286853 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 _0x31af=['addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','destroy','delete','removeTags','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/messages','getMessages','download','post'];(function(_0x27c822,_0x4850f1){var _0x2e60b2=function(_0x14e1aa){while(--_0x14e1aa){_0x27c822['push'](_0x27c822['shift']());}};_0x2e60b2(++_0x4850f1);}(_0x31af,0xde));var _0xf31a=function(_0x53c683,_0x311959){_0x53c683=_0x53c683-0x0;var _0x32fd03=_0x31af[_0x53c683];return _0x32fd03;};'use strict';var multer=require(_0xf31a('0x0'));var util=require(_0xf31a('0x1'));var path=require(_0xf31a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf31a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf31a('0x4'));var interaction=require(_0xf31a('0x5'));var config=require(_0xf31a('0x6'));var controller=require(_0xf31a('0x7'));router['get']('/',auth[_0xf31a('0x8')](),controller[_0xf31a('0x9')]);router[_0xf31a('0xa')](_0xf31a('0xb'),auth['isAuthenticated'](),controller[_0xf31a('0xc')]);router[_0xf31a('0xa')](_0xf31a('0xd'),auth[_0xf31a('0x8')](),controller['show']);router[_0xf31a('0xa')](_0xf31a('0xe'),auth[_0xf31a('0x8')](),controller[_0xf31a('0xf')]);router[_0xf31a('0xa')]('/:id/download',auth[_0xf31a('0x8')](),controller[_0xf31a('0x10')]);router[_0xf31a('0x11')]('/',auth[_0xf31a('0x8')](),controller['create']);router[_0xf31a('0x11')](_0xf31a('0xe'),auth['isAuthenticated'](),controller[_0xf31a('0x12')]);router[_0xf31a('0x11')](_0xf31a('0x13'),auth[_0xf31a('0x8')](),interaction[_0xf31a('0x14')](_0xf31a('0x15'),_0xf31a('0x16')),controller[_0xf31a('0x17')]);router[_0xf31a('0x18')](_0xf31a('0xd'),auth[_0xf31a('0x8')](),interaction[_0xf31a('0x14')](_0xf31a('0x15'),_0xf31a('0x19')),controller[_0xf31a('0x1a')]);router['delete'](_0xf31a('0xd'),auth[_0xf31a('0x8')](),interaction[_0xf31a('0x14')](_0xf31a('0x15'),'whatsappinteraction:destroy'),controller[_0xf31a('0x1b')]);router[_0xf31a('0x1c')](_0xf31a('0x13'),auth[_0xf31a('0x8')](),controller[_0xf31a('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xabce=['show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','whatsappinteraction:addtags','addTags','put','tracked','update','/:id','whatsapp','whatsappinteraction:destroy','destroy','delete','removeTags','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe'];(function(_0x35d525,_0x502576){var _0x1b3692=function(_0x58a387){while(--_0x58a387){_0x35d525['push'](_0x35d525['shift']());}};_0x1b3692(++_0x502576);}(_0xabce,0x103));var _0xeabc=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xabce[_0x4bfac3];return _0x15f0f2;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./whatsappInteraction.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/describe',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0x9')](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0x9')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xf')]);router[_0xeabc('0x10')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0x11')]);router[_0xeabc('0x10')](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller['addMessage']);router[_0xeabc('0x10')](_0xeabc('0x12'),auth[_0xeabc('0x8')](),interaction['tracked']('whatsapp',_0xeabc('0x13')),controller[_0xeabc('0x14')]);router[_0xeabc('0x15')]('/:id',auth[_0xeabc('0x8')](),interaction[_0xeabc('0x16')]('whatsapp','whatsappinteraction:update'),controller[_0xeabc('0x17')]);router['delete'](_0xeabc('0x18'),auth[_0xeabc('0x8')](),interaction[_0xeabc('0x16')](_0xeabc('0x19'),_0xeabc('0x1a')),controller[_0xeabc('0x1b')]);router[_0xeabc('0x1c')](_0xeabc('0x12'),auth['isAuthenticated'](),controller[_0xeabc('0x1d')]);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 8ebc9fd..2afd8b7 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 _0xf693=['moment','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x4bed75,_0x211cc7){var _0x2dd8e8=function(_0x6369c7){while(--_0x6369c7){_0x4bed75['push'](_0x4bed75['shift']());}};_0x2dd8e8(++_0x211cc7);}(_0xf693,0x181));var _0x3f69=function(_0x4a5608,_0x2c2306){_0x4a5608=_0x4a5608-0x0;var _0x263e1d=_0xf693[_0x4a5608];return _0x263e1d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3f69('0x0'));module[_0x3f69('0x1')]={'closed':{'type':Sequelize[_0x3f69('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3f69('0x3')]},'disposition':{'type':Sequelize[_0x3f69('0x4')]},'secondDisposition':{'type':Sequelize[_0x3f69('0x4')]},'thirdDisposition':{'type':Sequelize[_0x3f69('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x3f69('0x4')]},'read1stAt':{'type':Sequelize[_0x3f69('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x3f69('0x5')]('in',_0x3f69('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3f69('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x3f69('0x5')]('in',_0x3f69('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x3f69('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x0f80=['BOOLEAN','DATE','STRING','ENUM','out','moment','exports'];(function(_0x269ab7,_0x5eba4e){var _0x25b5a7=function(_0x5a6b3e){while(--_0x5a6b3e){_0x269ab7['push'](_0x269ab7['shift']());}};_0x25b5a7(++_0x5eba4e);}(_0x0f80,0x108));var _0x00f8=function(_0x46b163,_0x58cb1a){_0x46b163=_0x46b163-0x0;var _0x1f0437=_0x0f80[_0x46b163];return _0x1f0437;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x00f8('0x0'));module[_0x00f8('0x1')]={'closed':{'type':Sequelize[_0x00f8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x00f8('0x3')]},'disposition':{'type':Sequelize[_0x00f8('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x00f8('0x4')]},'note':{'type':Sequelize[_0x00f8('0x4')]},'phone':{'type':Sequelize[_0x00f8('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x00f8('0x5')]('in',_0x00f8('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x00f8('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x00f8('0x5')]('in',_0x00f8('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x00f8('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index b3296aa..a2a3091 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 _0x0ba7=['body','isEmpty','where','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','contactName','DESC','t.id\x20IN\x20?','WhatsappAccountId','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','role','sequelize','toString','keyBy','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','all','rows','show','params','rawAttributes','includeAll','include','merge','options','find','create','update','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','omit','spread','Tag','findAll','emit','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Contact','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Account','Owner','mkdirSync','Whatsapp','N.A.','closed','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','firstName','renderFile','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','destroy','error','send','Users','map','fullname','TagIds','Tags','forEach','catch','WhatsappInteraction','type','key','model','name','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_whatsapp_interactions','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','length','unreadMessages','value','`\x20=\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x0ba7,0x16d));var _0x70ba=function(_0x1fbcc6,_0x137ddf){_0x1fbcc6=_0x1fbcc6-0x0;var _0x455989=_0x0ba7[_0x1fbcc6];return _0x455989;};'use strict';var emlformat=require(_0x70ba('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x70ba('0x1'));var jsonpatch=require(_0x70ba('0x2'));var rp=require(_0x70ba('0x3'));var moment=require(_0x70ba('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x70ba('0x5'));var util=require(_0x70ba('0x6'));var path=require(_0x70ba('0x7'));var sox=require(_0x70ba('0x8'));var csv=require(_0x70ba('0x9'));var ejs=require(_0x70ba('0xa'));var fs=require('fs');var fs_extra=require(_0x70ba('0xb'));var _=require(_0x70ba('0xc'));var squel=require(_0x70ba('0xd'));var crypto=require(_0x70ba('0xe'));var jsforce=require(_0x70ba('0xf'));var deskjs=require(_0x70ba('0x10'));var toCsv=require(_0x70ba('0x9'));var querystring=require(_0x70ba('0x11'));var Papa=require(_0x70ba('0x12'));var Redis=require('ioredis');var authService=require(_0x70ba('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x70ba('0x14'));var pdf=require(_0x70ba('0x15'));var hardwareService=require(_0x70ba('0x16'));var logger=require(_0x70ba('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x70ba('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x70ba('0x19'))['db'];config['redis']=_[_0x70ba('0x1a')](config[_0x70ba('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x70ba('0x1c'))(new Redis(config['redis']));require(_0x70ba('0x1d'))[_0x70ba('0x1e')](socket);function respondWithStatusCode(_0x211b0e,_0x10613f){_0x10613f=_0x10613f||0xcc;return function(_0x2516fd){if(_0x2516fd){return _0x211b0e[_0x70ba('0x1f')](_0x10613f);}return _0x211b0e[_0x70ba('0x20')](_0x10613f)[_0x70ba('0x21')]();};}function respondWithResult(_0x18334a,_0x3e27e8){_0x3e27e8=_0x3e27e8||0xc8;return function(_0x30ac22){if(_0x30ac22){return _0x18334a[_0x70ba('0x20')](_0x3e27e8)[_0x70ba('0x22')](_0x30ac22);}};}function respondWithFilteredResult(_0xb6d69a,_0x5ed907){return function(_0x5dad2d){if(_0x5dad2d){var _0x489cf9=typeof _0x5ed907[_0x70ba('0x23')]===_0x70ba('0x24')&&typeof _0x5ed907[_0x70ba('0x25')]===_0x70ba('0x24');var _0x43caa4=_0x5dad2d[_0x70ba('0x26')];var _0x1426d9=_0x489cf9?0x0:_0x5ed907[_0x70ba('0x23')];var _0x415879=_0x489cf9?_0x5dad2d[_0x70ba('0x26')]:_0x5ed907[_0x70ba('0x23')]+_0x5ed907[_0x70ba('0x25')];var _0x2a1328;if(_0x415879>=_0x43caa4){_0x415879=_0x43caa4;_0x2a1328=0xc8;}else{_0x2a1328=0xce;}_0xb6d69a[_0x70ba('0x20')](_0x2a1328);return _0xb6d69a[_0x70ba('0x27')]('Content-Range',_0x1426d9+'-'+_0x415879+'/'+_0x43caa4)[_0x70ba('0x22')](_0x5dad2d);}return null;};}function patchUpdates(_0x4203cc){return function(_0x52accf){try{jsonpatch[_0x70ba('0x28')](_0x52accf,_0x4203cc,!![]);}catch(_0x5519d4){return BPromise['reject'](_0x5519d4);}return _0x52accf[_0x70ba('0x29')]();};}function saveUpdates(_0x5152b2,_0x45bbf2){return function(_0x304a41){if(_0x304a41){return _0x304a41['update'](_0x5152b2)[_0x70ba('0x2a')](function(_0x4ef847){return _0x4ef847;});}return null;};}function removeEntity(_0x5ad828,_0x39482c){return function(_0x47ae00){if(_0x47ae00){return _0x47ae00[_0x70ba('0x2b')]()[_0x70ba('0x2a')](function(){_0x5ad828[_0x70ba('0x20')](0xcc)[_0x70ba('0x21')]();});}};}function handleEntityNotFound(_0x2c6d18,_0x265423){return function(_0x5a8558){if(!_0x5a8558){_0x2c6d18[_0x70ba('0x1f')](0x194);}return _0x5a8558;};}function handleError(_0x190bb5,_0x797467){_0x797467=_0x797467||0x1f4;return function(_0x5179c6){logger[_0x70ba('0x2c')](_0x5179c6['stack']);if(_0x5179c6['name']){delete _0x5179c6['name'];}_0x190bb5[_0x70ba('0x20')](_0x797467)[_0x70ba('0x2d')](_0x5179c6);};}function getInteractionUsers(_0x5b6e6e,_0x51b3e3){return new BPromise(function(_0x16dc2f,_0x4ff810){try{if(_0x51b3e3[_0x5b6e6e['id']]){_0x5b6e6e[_0x70ba('0x2e')]=_[_0x70ba('0x2f')](_0x51b3e3[_0x5b6e6e['id']],function(_0x46b7e3){return{'id':_0x46b7e3['id'],'fullname':_0x46b7e3[_0x70ba('0x30')]};});}}catch(_0x1db0c4){_0x4ff810(_0x1db0c4);}_0x16dc2f(_0x5b6e6e);});}function getInteractionTags(_0x269943,_0x1f86cf){return new BPromise(function(_0x9bafd,_0x2c6581){try{if(_0x269943[_0x70ba('0x31')]){_0x269943[_0x70ba('0x32')]=[];_0x269943['TagIds']['split'](',')[_0x70ba('0x33')](function(_0x39433a){_0x269943[_0x70ba('0x32')]['push'](_0x1f86cf[_0x39433a]);});}delete _0x269943['TagIds'];}catch(_0x507f00){_0x2c6581(_0x507f00);}_0x9bafd(_0x269943);});}function updateWhatsappInteraction(_0x2ada50,_0x806866,_0x2200d3){return new BPromise(function(_0x4d37d0,_0x45ab8f){return getInteractionUsers(_0x2ada50,_0x2200d3)['then'](function(_0x4f06fc){return getInteractionTags(_0x4f06fc,_0x806866);})[_0x70ba('0x2a')](function(_0x591596){_0x4d37d0(_0x591596);})[_0x70ba('0x34')](function(_0x14c86d){_0x45ab8f(_0x14c86d);});});}exports['index']=function(_0x68316e,_0x295044){var _0x1a562f={},_0x48328e={},_0x1402b2={'count':0x0,'rows':[]};var _0x20c3fd=_[_0x70ba('0x2f')](db[_0x70ba('0x35')]['rawAttributes'],function(_0x1b9fed){return{'name':_0x1b9fed['fieldName'],'type':_0x1b9fed[_0x70ba('0x36')][_0x70ba('0x37')]};});_0x48328e[_0x70ba('0x38')]=_[_0x70ba('0x2f')](_0x20c3fd,_0x70ba('0x39'));_0x48328e[_0x70ba('0x3a')]=_[_0x70ba('0x3b')](_0x68316e['query']);_0x48328e[_0x70ba('0x3c')]=_[_0x70ba('0x3d')](_0x48328e[_0x70ba('0x38')],_0x48328e[_0x70ba('0x3a')]);_0x1a562f[_0x70ba('0x3e')]=_[_0x70ba('0x3d')](_0x48328e['model'],qs[_0x70ba('0x3f')](_0x68316e[_0x70ba('0x3a')][_0x70ba('0x3f')]));_0x1a562f['attributes']=_0x1a562f['attributes']['length']?_0x1a562f[_0x70ba('0x3e')]:_0x48328e[_0x70ba('0x38')];if(!_0x68316e[_0x70ba('0x3a')]['hasOwnProperty'](_0x70ba('0x40'))){_0x1a562f[_0x70ba('0x25')]=qs[_0x70ba('0x25')](_0x68316e[_0x70ba('0x3a')][_0x70ba('0x25')]);_0x1a562f['offset']=qs['offset'](_0x68316e[_0x70ba('0x3a')][_0x70ba('0x23')]);}_0x1a562f[_0x70ba('0x41')]=qs['sort'](_0x68316e['query'][_0x70ba('0x42')]);_0x1a562f['where']=qs[_0x70ba('0x3c')](_[_0x70ba('0x43')](_0x68316e[_0x70ba('0x3a')],_0x48328e[_0x70ba('0x3c')]),_0x20c3fd);var _0x3f1d0f=[];var _0x51f4df=squel[_0x70ba('0x44')]()[_0x70ba('0x45')]('id')[_0x70ba('0x45')](_0x70ba('0x39'))[_0x70ba('0x45')](_0x70ba('0x46'))[_0x70ba('0x47')](_0x70ba('0x48'));var _0xfb180d=squel[_0x70ba('0x44')]()[_0x70ba('0x45')](_0x70ba('0x49'))[_0x70ba('0x45')](_0x70ba('0x4a'))[_0x70ba('0x45')]('ui.WhatsappInteractionId')[_0x70ba('0x47')](_0x70ba('0x4b'),'ui')['left_join'](_0x70ba('0x4c'),'u',_0x70ba('0x4d'));var _0x3de825=squel[_0x70ba('0x44')]()[_0x70ba('0x47')](_0x70ba('0x4e'),'i')[_0x70ba('0x4f')]('cm_contacts','c',_0x70ba('0x50'))[_0x70ba('0x4f')](_0x70ba('0x4c'),'o',_0x70ba('0x51'))[_0x70ba('0x4f')](_0x70ba('0x52'),'a',_0x70ba('0x53'))[_0x70ba('0x4f')](_0x70ba('0x54'),'me',_0x70ba('0x55'))[_0x70ba('0x4f')](_0x70ba('0x56'),'it',_0x70ba('0x57'))[_0x70ba('0x4f')](_0x70ba('0x48'),'t',_0x70ba('0x58'));var _0x9f97c5=squel['expr']();var _0x44683d=[];var _0x33f6e5=squel[_0x70ba('0x59')]();var _0x19c99c;if(_0x68316e['query']['search']){_0x19c99c=as['parseSearch'](_0x68316e[_0x70ba('0x3a')][_0x70ba('0x5a')]);var _0x500c59=_0x19c99c['sqlOperator'];for(var _0x6a3dc6=0x0;_0x6a3dc6<_0x19c99c[_0x70ba('0x5b')][_0x70ba('0x5c')];_0x6a3dc6++){var _0x3d7f90=_0x19c99c[_0x70ba('0x5b')][_0x6a3dc6];var _0x4e2397='i';var _0x3b05c6=_['find'](_0x20c3fd,['name',_0x3d7f90[_0x70ba('0x45')]]);if(!_0x3b05c6){switch(_0x3d7f90[_0x70ba('0x45')]){case _0x70ba('0x5d'):if(_0x3d7f90[_0x70ba('0x5e')]==0x1){_0x3de825['having']('`'+_0x3d7f90[_0x70ba('0x45')]+_0x70ba('0x5f'));}else{_0x3de825['having']('`'+_0x3d7f90['field']+'`\x20>\x200');}break;case'Contact':if(_0x3d7f90[_0x70ba('0x60')]===_0x70ba('0x61')){if(_0x3d7f90[_0x70ba('0x5e')]['split']('\x20')[_0x70ba('0x5c')]>0x1){_0x9f97c5[_0x500c59](_0x70ba('0x62'),qs[_0x70ba('0x63')](_0x3d7f90['value']),null);}else{var _0x1bdcd4='%'+_0x3d7f90[_0x70ba('0x5e')]+'%';_0x9f97c5[_0x500c59]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1bdcd4,_0x1bdcd4,_0x1bdcd4);}}else{_0x3b05c6=_['find'](_0x20c3fd,[_0x70ba('0x39'),_0x70ba('0x64')]);_0x3d7f90[_0x70ba('0x45')]=_0x70ba('0x64');_0x2a46cd=as[_0x70ba('0x65')](_0x4e2397,_0x3b05c6[_0x70ba('0x36')],_0x3d7f90);_0x9f97c5[_0x500c59](_0x2a46cd[_0x70ba('0x66')],_0x2a46cd['value'][_0x70ba('0x67')],_0x2a46cd[_0x70ba('0x5e')]['end']);}break;case'Tag':var _0x137b7d=_0x3d7f90[_0x70ba('0x5e')]['split'](',')['map'](function(_0x3279bf){return Number(_0x3279bf);});_0x137b7d['forEach'](function(_0x4aef80){_0x33f6e5['or'](_0x70ba('0x68'),'%,'+_0x4aef80+',%');});_0x44683d=_[_0x70ba('0x69')](_0x44683d,_0x137b7d);break;case _0x70ba('0x6a'):if(_0x3d7f90[_0x70ba('0x60')]===_0x70ba('0x61')){_0x9f97c5[_0x500c59](_0x70ba('0x6b'),'%'+_0x3d7f90[_0x70ba('0x5e')]+'%',null);}else{_0x3b05c6=_['find'](_0x20c3fd,[_0x70ba('0x39'),_0x70ba('0x6c')]);_0x3d7f90[_0x70ba('0x45')]=_0x70ba('0x6c');_0x2a46cd=as[_0x70ba('0x65')](_0x4e2397,_0x3b05c6[_0x70ba('0x36')],_0x3d7f90);_0x9f97c5[_0x500c59](_0x2a46cd['text'],_0x2a46cd[_0x70ba('0x5e')]['start'],_0x2a46cd[_0x70ba('0x5e')]['end']);}break;case _0x70ba('0x6d'):_0x2a46cd=as[_0x70ba('0x65')]('me',null,_0x3d7f90);_0x9f97c5[_0x500c59](_0x2a46cd[_0x70ba('0x66')],_0x2a46cd[_0x70ba('0x5e')][_0x70ba('0x67')],_0x2a46cd[_0x70ba('0x5e')]['end']);break;}}else{var _0x2a46cd=as['buildExpression'](_0x4e2397,_0x3b05c6['type'],_0x3d7f90);_0x9f97c5[_0x500c59](_0x2a46cd[_0x70ba('0x66')],_0x2a46cd[_0x70ba('0x5e')]['start'],_0x2a46cd[_0x70ba('0x5e')]['end']);}}}else{var _0x7ba1ca=_(_0x68316e[_0x70ba('0x3a')])[_0x70ba('0x3b')]()['map'](function(_0x327219){return _['some'](_0x20c3fd,[_0x70ba('0x39'),_0x327219])?_0x327219:undefined;})['compact']()[_0x70ba('0x5e')]();if(!_[_0x70ba('0x6e')](_0x7ba1ca)){_0x7ba1ca[_0x70ba('0x33')](function(_0x4ebc09){if(_0x4ebc09==='WhatsappAccountId'){_0x3de825[_0x70ba('0x6f')]('i.WhatsappAccountId\x20IN\x20?',[][_0x70ba('0x70')](_0x68316e[_0x70ba('0x3a')][_0x4ebc09]));}else if(_0x4ebc09===_0x70ba('0x71')){var _0x32a246=JSON['parse'](_0x68316e[_0x70ba('0x3a')][_0x4ebc09])[_0x70ba('0x72')];var _0x3a2132=JSON[_0x70ba('0x73')](_0x68316e[_0x70ba('0x3a')][_0x4ebc09])[_0x70ba('0x74')];_0x3de825[_0x70ba('0x6f')](_0x70ba('0x75'),_0x32a246,_0x3a2132);}else{if(_0x68316e['query'][_0x4ebc09]===_0x70ba('0x76')){_0x3de825[_0x70ba('0x6f')]('i.'+_0x4ebc09+_0x70ba('0x77'));}else{_0x3de825[_0x70ba('0x6f')]('i.'+_0x4ebc09+_0x70ba('0x78'),_0x68316e[_0x70ba('0x3a')][_0x4ebc09]);}}});}if(_0x68316e[_0x70ba('0x3a')]['read']){if(_0x68316e[_0x70ba('0x3a')][_0x70ba('0x79')]==0x1){_0x3de825[_0x70ba('0x7a')](_0x70ba('0x7b'));}else{_0x3de825[_0x70ba('0x7a')](_0x70ba('0x7c'));}}if(_0x68316e[_0x70ba('0x3a')][_0x70ba('0x7d')]){_0x44683d=_['isArray'](_0x68316e['query'][_0x70ba('0x7d')])?_0x68316e[_0x70ba('0x3a')][_0x70ba('0x7d')]:new Array(_0x68316e['query'][_0x70ba('0x7d')]);_0x44683d[_0x70ba('0x33')](function(_0x6df701){_0x33f6e5['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x6df701+',%');});}if(_0x68316e[_0x70ba('0x3a')][_0x70ba('0x7e')]){var _0xa9009d=_0x68316e[_0x70ba('0x3a')][_0x70ba('0x7e')][_0x70ba('0x7f')]('\x5c','\x5c\x5c')[_0x70ba('0x7f')](/'/g,'\x27\x27');if(qs['isNumeric'](_0xa9009d)){_0x9f97c5['or'](_0x70ba('0x80'),_0xa9009d+'%')['or']('i.phone\x20LIKE\x20?',_0xa9009d+'%');}else{_0x9f97c5['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x70ba('0x63')](_0xa9009d))['or'](_0x70ba('0x81'),_0xa9009d+'%');}}}_0x3de825[_0x70ba('0x6f')](_0x9f97c5);_0x3de825[_0x70ba('0x82')](_0x70ba('0x83'));var _0x408f46={'type':db[_0x70ba('0x84')][_0x70ba('0x85')]['SELECT'],'raw':!![]};var _0x122ea1=_0x3de825[_0x70ba('0x86')]();_0x122ea1[_0x70ba('0x45')]('i.id');_0x122ea1['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x70ba('0x5d'));if(_0x1a562f['order']){_0x1a562f['order']['forEach'](function(_0x308d0d){var _0x2ad01e=_0x308d0d[0x0]===_0x70ba('0x87')?_0x308d0d[0x0]:'i.'+_0x308d0d[0x0];_0x3de825[_0x70ba('0x41')](_0x2ad01e,_0x308d0d[0x1]===_0x70ba('0x88')?![]:!![]);});}if(!_['isEmpty'](_0x44683d)){_0x3de825['having'](_0x33f6e5);_0x122ea1[_0x70ba('0x6f')](_0x70ba('0x89'),_0x44683d);}BPromise['resolve']()[_0x70ba('0x2a')](function(){if(!_0x19c99c){if(_0x68316e[_0x70ba('0x3a')][_0x70ba('0x8a')])return;_0x122ea1['where'](_0x70ba('0x8b'));_0x3de825['where'](_0x70ba('0x8b'));return;}if(_0x68316e[_0x70ba('0x8c')]['role']!==_0x70ba('0x8d'))return;return _0x68316e['user'][_0x70ba('0x8e')]({'attributes':['id'],'raw':!![]})[_0x70ba('0x2a')](function(_0x59b245){if(_[_0x70ba('0x6e')](_0x59b245)){_0x122ea1[_0x70ba('0x6f')](_0x70ba('0x8f'));_0x3de825[_0x70ba('0x6f')](_0x70ba('0x8f'));}else{_0x122ea1[_0x70ba('0x6f')](_0x70ba('0x90'),_[_0x70ba('0x2f')](_0x59b245,'id'));_0x3de825[_0x70ba('0x6f')](_0x70ba('0x90'),_['map'](_0x59b245,'id'));}});})[_0x70ba('0x2a')](function(){if(_0x68316e[_0x70ba('0x8c')][_0x70ba('0x91')]===_0x70ba('0x8d')&&!_0x19c99c&&!_0x68316e['query'][_0x70ba('0x8a')])return[];return db['sequelize'][_0x70ba('0x3a')](_0x122ea1['toString'](),_0x408f46);})[_0x70ba('0x2a')](function(_0x18d129){_0x1402b2['count']=_0x18d129[_0x70ba('0x5c')];if(_0x1402b2[_0x70ba('0x26')]===0x0)return[];return db[_0x70ba('0x92')][_0x70ba('0x3a')](_0x51f4df[_0x70ba('0x93')](),_0x408f46)[_0x70ba('0x2a')](function(_0x1546ec){_0x3f1d0f=_[_0x70ba('0x94')](_0x1546ec,'id');_0x408f46=_['merge'](_0x408f46,{'model':db[_0x70ba('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x68316e[_0x70ba('0x3a')][_0x70ba('0x3f')]){_0x1a562f[_0x70ba('0x3e')][_0x70ba('0x33')](function(_0x460795){_0x3de825[_0x70ba('0x45')]('i.'+_0x460795);});}else{_0x3de825[_0x70ba('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x70ba('0x5d'));_0x3de825[_0x70ba('0x45')](_0x70ba('0x95'),'Account.key');_0x3de825[_0x70ba('0x45')](_0x70ba('0x96'),_0x70ba('0x97'));_0x3de825['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x70ba('0x87'));_0x3de825['field']('i.*');_0x3de825[_0x70ba('0x45')](_0x70ba('0x98'),_0x70ba('0x99'));_0x3de825[_0x70ba('0x45')](_0x70ba('0x9a'),_0x70ba('0x9b'));_0x3de825['field']('c.email',_0x70ba('0x9c'));_0x3de825[_0x70ba('0x45')](_0x70ba('0x9d'),_0x70ba('0x9e'));_0x3de825['field'](_0x70ba('0x9f'),_0x70ba('0xa0'));_0x3de825[_0x70ba('0x45')](_0x70ba('0xa1'),_0x70ba('0xa2'));_0x3de825[_0x70ba('0x45')](_0x70ba('0xa3'),_0x70ba('0xa4'));_0x3de825[_0x70ba('0x45')](_0x70ba('0xa5'),_0x70ba('0xa6'));_0x3de825[_0x70ba('0x45')](_0x70ba('0xa7'),_0x70ba('0x31'));}if(_0x1a562f['limit'])_0x3de825[_0x70ba('0x25')](_0x1a562f[_0x70ba('0x25')]);if(_0x1a562f[_0x70ba('0x23')])_0x3de825['offset'](_0x1a562f['offset']);return db['sequelize'][_0x70ba('0x3a')](_0x3de825[_0x70ba('0x93')](),_0x408f46);})[_0x70ba('0x2a')](function(_0x36b871){if(_0x36b871['length']>0x0)_0xfb180d[_0x70ba('0x6f')](_0x70ba('0xa8'),_[_0x70ba('0x2f')](_0x36b871,'id'));return db[_0x70ba('0x92')]['query'](_0xfb180d['toString'](),_0x408f46)['then'](function(_0x443ecb){var _0x5deba6=_[_0x70ba('0xa9')](_0x443ecb,'WhatsappInteractionId');var _0x81bf0a=[];_0x36b871[_0x70ba('0x33')](function(_0x4f9d65){_0x81bf0a['push'](updateWhatsappInteraction(_0x4f9d65,_0x3f1d0f,_0x5deba6));});return BPromise[_0x70ba('0xaa')](_0x81bf0a);});});})['then'](function(_0x594d69){_0x1402b2[_0x70ba('0xab')]=_0x594d69;return _0x1402b2;})[_0x70ba('0x2a')](respondWithFilteredResult(_0x295044,_0x1a562f))[_0x70ba('0x34')](handleError(_0x295044,null));};exports[_0x70ba('0xac')]=function(_0x4577a9,_0x130029){var _0x1d11dc={'raw':![],'where':{'id':_0x4577a9[_0x70ba('0xad')]['id']}},_0x2c9391={};_0x2c9391[_0x70ba('0x38')]=_[_0x70ba('0x3b')](db[_0x70ba('0x35')][_0x70ba('0xae')]);_0x2c9391[_0x70ba('0x3a')]=_[_0x70ba('0x3b')](_0x4577a9['query']);_0x2c9391[_0x70ba('0x3c')]=_[_0x70ba('0x3d')](_0x2c9391[_0x70ba('0x38')],_0x2c9391['query']);_0x1d11dc[_0x70ba('0x3e')]=_[_0x70ba('0x3d')](_0x2c9391['model'],qs[_0x70ba('0x3f')](_0x4577a9['query']['fields']));_0x1d11dc[_0x70ba('0x3e')]=_0x1d11dc['attributes'][_0x70ba('0x5c')]?_0x1d11dc['attributes']:_0x2c9391[_0x70ba('0x38')];if(_0x4577a9[_0x70ba('0x3a')][_0x70ba('0xaf')]){_0x1d11dc[_0x70ba('0xb0')]=[{'all':!![]}];}_0x1d11dc=_[_0x70ba('0xb1')]({},_0x1d11dc,_0x4577a9[_0x70ba('0xb2')]);return db[_0x70ba('0x35')][_0x70ba('0xb3')](_0x1d11dc)[_0x70ba('0x2a')](handleEntityNotFound(_0x130029,null))['then'](respondWithResult(_0x130029,null))[_0x70ba('0x34')](handleError(_0x130029,null));};exports['create']=function(_0x308ec3,_0x2ad5a6){return db[_0x70ba('0x35')][_0x70ba('0xb4')](_0x308ec3[_0x70ba('0x6d')],{})[_0x70ba('0x2a')](respondWithResult(_0x2ad5a6,0xc9))[_0x70ba('0x34')](handleError(_0x2ad5a6,null));};exports[_0x70ba('0xb5')]=function(_0x1e537b,_0x5ebb9a){if(_0x1e537b['body']['id']){delete _0x1e537b['body']['id'];}return db[_0x70ba('0x35')]['find']({'where':{'id':_0x1e537b[_0x70ba('0xad')]['id']}})[_0x70ba('0x2a')](handleEntityNotFound(_0x5ebb9a,null))[_0x70ba('0x2a')](saveUpdates(_0x1e537b['body'],null))[_0x70ba('0x2a')](respondWithResult(_0x5ebb9a,null))[_0x70ba('0x34')](handleError(_0x5ebb9a,null));};exports[_0x70ba('0x2b')]=function(_0x363aad,_0x21dff6){return db[_0x70ba('0x35')]['find']({'where':{'id':_0x363aad['params']['id']}})[_0x70ba('0x2a')](handleEntityNotFound(_0x21dff6,null))[_0x70ba('0x2a')](removeEntity(_0x21dff6,null))['catch'](handleError(_0x21dff6,null));};exports[_0x70ba('0xb6')]=function(_0x5905df,_0xe5e6ff){return db[_0x70ba('0x35')]['describe']()[_0x70ba('0x2a')](respondWithResult(_0xe5e6ff,null))[_0x70ba('0x34')](handleError(_0xe5e6ff,null));};exports[_0x70ba('0xb7')]=function(_0x25ecf0,_0x4bb009,_0x83c4df){return db[_0x70ba('0xb8')][_0x70ba('0xb3')]({'where':{'id':_0x25ecf0[_0x70ba('0xad')]['id']}})['then'](handleEntityNotFound(_0x4bb009,null))[_0x70ba('0x2a')](function(_0xec5942){if(_0xec5942){return _0xec5942[_0x70ba('0xb7')](_0x25ecf0[_0x70ba('0x6d')]['ids'],_['omit'](_0x25ecf0[_0x70ba('0x6d')],[_0x70ba('0xb9'),'id'])||{});}})['then'](respondWithResult(_0x4bb009,null))[_0x70ba('0x34')](handleError(_0x4bb009,null));};exports[_0x70ba('0xba')]=function(_0x235403,_0xcdd6c4,_0x2cfbd8){var _0x18d0c4={'raw':![],'where':{}};var _0xd2ebc8={};var _0x18678f={'count':0x0,'rows':[]};return db[_0x70ba('0x35')][_0x70ba('0xbb')]({'where':{'id':_0x235403[_0x70ba('0xad')]['id']}})[_0x70ba('0x2a')](handleEntityNotFound(_0xcdd6c4,null))[_0x70ba('0x2a')](function(_0xa83ff8){if(_0xa83ff8){_0xd2ebc8[_0x70ba('0x38')]=_[_0x70ba('0x3b')](db[_0x70ba('0xb8')]['rawAttributes']);_0xd2ebc8[_0x70ba('0x3a')]=_[_0x70ba('0x3b')](_0x235403[_0x70ba('0x3a')]);_0xd2ebc8[_0x70ba('0x3c')]=_[_0x70ba('0x3d')](_0xd2ebc8[_0x70ba('0x38')],_0xd2ebc8[_0x70ba('0x3a')]);_0x18d0c4['attributes']=_['intersection'](_0xd2ebc8[_0x70ba('0x38')],qs['fields'](_0x235403[_0x70ba('0x3a')][_0x70ba('0x3f')]));_0x18d0c4[_0x70ba('0x3e')]=_0x18d0c4[_0x70ba('0x3e')][_0x70ba('0x5c')]?_0x18d0c4[_0x70ba('0x3e')]:_0xd2ebc8[_0x70ba('0x38')];if(!_0x235403['query'][_0x70ba('0xbc')](_0x70ba('0x40'))){_0x18d0c4[_0x70ba('0x25')]=qs[_0x70ba('0x25')](_0x235403[_0x70ba('0x3a')][_0x70ba('0x25')]);_0x18d0c4['offset']=qs[_0x70ba('0x23')](_0x235403[_0x70ba('0x3a')][_0x70ba('0x23')]);}_0x18d0c4[_0x70ba('0x41')]=qs[_0x70ba('0x42')](_0x235403[_0x70ba('0x3a')][_0x70ba('0x42')]);_0x18d0c4['where']=qs['filters'](_[_0x70ba('0x43')](_0x235403[_0x70ba('0x3a')],_0xd2ebc8['filters']));_0x18d0c4[_0x70ba('0x6f')]['WhatsappInteractionId']=_0xa83ff8['id'];if(_0x235403[_0x70ba('0x3a')][_0x70ba('0x7e')]){_0x18d0c4[_0x70ba('0x6f')]=_[_0x70ba('0xb1')](_0x18d0c4[_0x70ba('0x6f')],{'$or':_[_0x70ba('0x2f')](_0x18d0c4[_0x70ba('0x3e')],function(_0x22791d){var _0x2248b6={};_0x2248b6[_0x22791d]={'$like':'%'+_0x235403['query'][_0x70ba('0x7e')]+'%'};return _0x2248b6;})});}if(_0x235403[_0x70ba('0x3a')][_0x70ba('0x72')]){var _0x58075d=_0x235403[_0x70ba('0x3a')][_0x70ba('0x72')]['split'](',');var _0x208a25={};_0x208a25[_0x58075d[0x0]]={'$gte':moment(_0x58075d[0x1])[_0x70ba('0xbd')](_0x70ba('0xbe'))};_0x18d0c4[_0x70ba('0x6f')]=_[_0x70ba('0xb1')](_0x18d0c4[_0x70ba('0x6f')],_0x208a25);}_0x18d0c4=_[_0x70ba('0xb1')]({},_0x18d0c4,_0x235403[_0x70ba('0xb2')]);return db[_0x70ba('0xb8')][_0x70ba('0x26')]({'where':_0x18d0c4[_0x70ba('0x6f')]})[_0x70ba('0x2a')](function(_0x500107){_0x18678f['count']=_0x500107;if(_0x235403[_0x70ba('0x3a')]['includeAll']){_0x18d0c4[_0x70ba('0xb0')]=[{'all':!![]}];}return db[_0x70ba('0xb8')]['findAll'](_0x18d0c4);})['then'](function(_0x5e5e6b){_0x18678f[_0x70ba('0xab')]=_0x5e5e6b;return _0x18678f;});}})[_0x70ba('0x2a')](respondWithFilteredResult(_0xcdd6c4,_0x18d0c4))[_0x70ba('0x34')](handleError(_0xcdd6c4,null));};exports[_0x70ba('0xbf')]=function(_0x226f09,_0x5cb03a,_0x554439){return db[_0x70ba('0x35')]['find']({'where':{'id':_0x226f09[_0x70ba('0xad')]['id']}})[_0x70ba('0x2a')](handleEntityNotFound(_0x5cb03a,null))[_0x70ba('0x2a')](function(_0x95e0fc){if(_0x95e0fc){return _0x95e0fc[_0x70ba('0xc0')](_0x226f09[_0x70ba('0x6d')][_0x70ba('0xb9')],_[_0x70ba('0xc1')](_0x226f09[_0x70ba('0x6d')],[_0x70ba('0xb9'),'id'])||{})[_0x70ba('0xc2')](function(){return db[_0x70ba('0xc3')][_0x70ba('0xc4')]({'attributes':['id',_0x70ba('0x39'),_0x70ba('0x46')],'where':{'id':_0x226f09[_0x70ba('0x6d')]['ids']}});})[_0x70ba('0x2a')](function(_0x5036cb){socket[_0x70ba('0xc5')]('whatsappInteractionTags:save',{'id':Number(_0x226f09[_0x70ba('0xad')]['id']),'tags':_0x5036cb||[]});return{'id':Number(_0x226f09[_0x70ba('0xad')]['id']),'tags':_0x5036cb||[]};});}})['then'](respondWithResult(_0x5cb03a,null))[_0x70ba('0x34')](handleError(_0x5cb03a,null));};exports[_0x70ba('0xc6')]=function(_0x18915a,_0x2e6661,_0x89be4){return db[_0x70ba('0x35')][_0x70ba('0xb3')]({'where':{'id':_0x18915a[_0x70ba('0xad')]['id']}})[_0x70ba('0x2a')](handleEntityNotFound(_0x2e6661,null))[_0x70ba('0x2a')](function(_0x365d84){if(_0x365d84){return _0x365d84['removeTags'](_0x18915a[_0x70ba('0x3a')][_0x70ba('0xb9')]);}})[_0x70ba('0x2a')](respondWithStatusCode(_0x2e6661,null))['catch'](handleError(_0x2e6661,null));};exports[_0x70ba('0xc7')]=function(_0x4a58cc,_0x1cdcc8){var _0x51dc73=moment()[_0x70ba('0xc8')]()[_0x70ba('0x93')]();var _0x17bf92=path[_0x70ba('0xc9')](config[_0x70ba('0xca')],_0x70ba('0xcb'),_0x70ba('0xcc'),_0x70ba('0xcd'));var _0xf91183=path[_0x70ba('0xc9')](config['root'],'server','files',_0x70ba('0xce'));var _0x214d7f=path[_0x70ba('0xc9')](_0x17bf92,_0x51dc73);var _0x9868f6=util['format'](_0x70ba('0xcf'),_0x4a58cc[_0x70ba('0xad')]['id'],_0x51dc73);var _0xf83354=path[_0x70ba('0xc9')](_0x17bf92,_0x9868f6);var _0x530409=[];_0x530409[_0x70ba('0xd0')]({'model':db[_0x70ba('0x6a')],'as':'User','attributes':['id',_0x70ba('0x30')],'raw':!![]});_0x530409[_0x70ba('0xd0')]({'model':db['CmContact'],'as':_0x70ba('0xd1'),'attributes':['id','firstName',_0x70ba('0xd2')],'raw':!![]});if(_0x4a58cc[_0x70ba('0x3a')][_0x70ba('0xce')]){_0x530409[_0x70ba('0xd0')]({'model':db['Attachment'],'as':_0x70ba('0xd3'),'raw':!![]});}var _0x26f86f=[{'model':db[_0x70ba('0xb8')],'as':_0x70ba('0xd4'),'attributes':['id',_0x70ba('0x6d'),'createdAt',_0x70ba('0xd5'),_0x70ba('0xd6'),'read'],'include':_0x530409}];_0x26f86f[_0x70ba('0xd0')]({'model':db[_0x70ba('0xd7')],'as':_0x70ba('0xd8'),'attributes':['id',_0x70ba('0x39')]});_0x26f86f[_0x70ba('0xd0')]({'model':db['User'],'as':_0x70ba('0xd9'),'attributes':['id','fullname']});return db['WhatsappInteraction'][_0x70ba('0xb3')]({'where':{'id':_0x4a58cc[_0x70ba('0xad')]['id']},'include':_0x26f86f})['then'](handleEntityNotFound(_0x1cdcc8,null))[_0x70ba('0x2a')](function(_0x39d643){if(_0x39d643){var _0x4ad225=_0x39d643['get']({'plain':!![]});fs[_0x70ba('0xda')](_0x214d7f);var _0x54fabc={'channel':_0x70ba('0xdb'),'account':_0x4ad225[_0x70ba('0xd8')][_0x70ba('0x39')],'agent':_0x4ad225[_0x70ba('0xd9')]?_0x4ad225['Owner'][_0x70ba('0x30')]:_0x70ba('0xdc'),'createdAt':moment(_0x4ad225[_0x70ba('0x71')])[_0x70ba('0xbd')](_0x70ba('0xbe'))['toString'](),'closedAt':_0x4ad225[_0x70ba('0xdd')]?moment(_0x4ad225['closedAt'])[_0x70ba('0xbd')](_0x70ba('0xbe'))['toString']():'','disposition':_0x4ad225[_0x70ba('0xde')],'messages':_(_0x4ad225[_0x70ba('0xd4')])[_0x70ba('0x7e')]({'secret':![]})[_0x70ba('0x2f')](function(_0x5c5ec8){if(_0x5c5ec8['Attachment']){var _0x2d6203=path['join'](_0xf91183,_0x5c5ec8[_0x70ba('0xd3')][_0x70ba('0xdf')]);if(fs[_0x70ba('0xe0')](_0x2d6203)){fs[_0x70ba('0xe1')](_0x2d6203)[_0x70ba('0xe2')](fs[_0x70ba('0xe3')](path['join'](_0x214d7f,_0x5c5ec8[_0x70ba('0xd3')][_0x70ba('0xdf')])));}}return{'date':moment(_0x5c5ec8[_0x70ba('0x71')])[_0x70ba('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')[_0x70ba('0x93')](),'sender':_0x5c5ec8[_0x70ba('0xd5')]===_0x70ba('0xe4')?_0x5c5ec8[_0x70ba('0x6a')]?_0x5c5ec8[_0x70ba('0x6a')]['fullname']:_0x70ba('0xe5'):_0x5c5ec8[_0x70ba('0xd1')][_0x70ba('0xe6')]+(_0x5c5ec8[_0x70ba('0xd1')][_0x70ba('0xd2')]?'\x20'+_0x5c5ec8['Contact'][_0x70ba('0xd2')]:''),'body':_0x5c5ec8[_0x70ba('0xd3')]?_0x5c5ec8[_0x70ba('0xd3')][_0x70ba('0xdf')]:_0x5c5ec8['body'],'direction':_0x5c5ec8['direction']===_0x70ba('0xe4')?'A':'C','secret':_0x5c5ec8[_0x70ba('0xd6')],'read':_0x5c5ec8['read'],'attachment':_0x5c5ec8['Attachment']};})[_0x70ba('0x5e')]()};return ejs[_0x70ba('0xe7')](path[_0x70ba('0xc9')](config['root'],_0x70ba('0xcb'),'views',_0x70ba('0xe8')),{'interaction':_0x54fabc})[_0x70ba('0x2a')](function(_0x44ad9a){var _0x1ea5b8=path[_0x70ba('0xc9')](_0x214d7f,_0x70ba('0xe9')+_0x4ad225['id']+'-'+_0x51dc73+'.pdf');var _0x168463={'path':_0x1ea5b8,'channel':'Whatsapp','interactionId':_0x4ad225['id']};return pdf[_0x70ba('0xea')](_0x44ad9a,_0x168463);})[_0x70ba('0x2a')](function(){return new BPromise(function(_0x296c66,_0xa5dc50){zipdir(_0x214d7f,{'saveTo':_0xf83354},function(_0x1025d8,_0x1cf059){if(_0x1025d8)return _0xa5dc50(_0x1025d8);return _0x296c66(_0x1cf059);});})[_0x70ba('0x2a')](function(){return new BPromise(function(_0x1e08dd,_0x15f364){rimraf(_0x214d7f,function(_0x288811){if(_0x288811)_0x15f364(_0x288811);return _0x1e08dd();});});})[_0x70ba('0x2a')](function(){return _0x1cdcc8[_0x70ba('0xc7')](_0xf83354,_0x9868f6,function(_0x293bb6){if(_0x293bb6){console[_0x70ba('0xeb')](_0x70ba('0xec'),_0x293bb6);}else{fs['unlinkSync'](_0xf83354);}});});});}else{return _0x1cdcc8['sendStatus'](0xc8);}})[_0x70ba('0x34')](handleError(_0x1cdcc8,null));}; \ No newline at end of file +var _0xca8d=['Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','buildExpression','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','i.WhatsappAccountId\x20IS\x20NULL','role','agent','sequelize','toString','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','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','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.mobile','Contact.mobile','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','all','rows','show','params','includeAll','include','merge','options','create','describe','WhatsappMessage','ids','omit','findOne','pick','WhatsappInteractionId','format','findAll','addTags','setTags','spread','Tag','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','CmContact','Attachment','Messages','direction','secret','WhatsappAccount','Account','mkdirSync','Owner','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','firstName','lastName','renderFile','views','transcript-','.pdf','Whatsapp','createPdfFromHTML','log','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','name','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','WhatsappInteraction','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','order','sort','where','filters','select','field','color','tools_tags','u.id','ui.WhatsappInteractionId','from','user_has_whatsapp_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','users','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','whatsapp_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xca8d,0x172));var _0xdca8=function(_0x2df2d0,_0x1d6ea8){_0x2df2d0=_0x2df2d0-0x0;var _0x3c4438=_0xca8d[_0x2df2d0];return _0x3c4438;};'use strict';var emlformat=require(_0xdca8('0x0'));var rimraf=require(_0xdca8('0x1'));var zipdir=require(_0xdca8('0x2'));var jsonpatch=require(_0xdca8('0x3'));var rp=require(_0xdca8('0x4'));var moment=require(_0xdca8('0x5'));var BPromise=require(_0xdca8('0x6'));var Mustache=require(_0xdca8('0x7'));var util=require(_0xdca8('0x8'));var path=require(_0xdca8('0x9'));var sox=require(_0xdca8('0xa'));var csv=require(_0xdca8('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdca8('0xc'));var _=require(_0xdca8('0xd'));var squel=require(_0xdca8('0xe'));var crypto=require(_0xdca8('0xf'));var jsforce=require(_0xdca8('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xdca8('0xb'));var querystring=require(_0xdca8('0x11'));var Papa=require(_0xdca8('0x12'));var Redis=require('ioredis');var authService=require(_0xdca8('0x13'));var qs=require(_0xdca8('0x14'));var as=require(_0xdca8('0x15'));var pdf=require(_0xdca8('0x16'));var hardwareService=require(_0xdca8('0x17'));var logger=require(_0xdca8('0x18'))(_0xdca8('0x19'));var utils=require(_0xdca8('0x1a'));var config=require(_0xdca8('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xdca8('0x1c')]=_[_0xdca8('0x1d')](config[_0xdca8('0x1c')],{'host':_0xdca8('0x1e'),'port':0x18eb});var socket=require(_0xdca8('0x1f'))(new Redis(config[_0xdca8('0x1c')]));require(_0xdca8('0x20'))[_0xdca8('0x21')](socket);function respondWithStatusCode(_0x446974,_0x6fc479){_0x6fc479=_0x6fc479||0xcc;return function(_0x308d92){if(_0x308d92){return _0x446974['sendStatus'](_0x6fc479);}return _0x446974['status'](_0x6fc479)[_0xdca8('0x22')]();};}function respondWithResult(_0x574f68,_0x52c910){_0x52c910=_0x52c910||0xc8;return function(_0x13c269){if(_0x13c269){return _0x574f68['status'](_0x52c910)[_0xdca8('0x23')](_0x13c269);}};}function respondWithFilteredResult(_0x2c3cb2,_0x278d9e){return function(_0x490650){if(_0x490650){var _0x5778f9=typeof _0x278d9e[_0xdca8('0x24')]===_0xdca8('0x25')&&typeof _0x278d9e[_0xdca8('0x26')]===_0xdca8('0x25');var _0x4ffe19=_0x490650[_0xdca8('0x27')];var _0x105020=_0x5778f9?0x0:_0x278d9e['offset'];var _0x10dd28=_0x5778f9?_0x490650[_0xdca8('0x27')]:_0x278d9e[_0xdca8('0x24')]+_0x278d9e['limit'];var _0x5205b3;if(_0x10dd28>=_0x4ffe19){_0x10dd28=_0x4ffe19;_0x5205b3=0xc8;}else{_0x5205b3=0xce;}_0x2c3cb2[_0xdca8('0x28')](_0x5205b3);return _0x2c3cb2[_0xdca8('0x29')](_0xdca8('0x2a'),_0x105020+'-'+_0x10dd28+'/'+_0x4ffe19)[_0xdca8('0x23')](_0x490650);}return null;};}function patchUpdates(_0x19ce0c){return function(_0x358def){try{jsonpatch[_0xdca8('0x2b')](_0x358def,_0x19ce0c,!![]);}catch(_0x5e0cbb){return BPromise[_0xdca8('0x2c')](_0x5e0cbb);}return _0x358def[_0xdca8('0x2d')]();};}function saveUpdates(_0x11dff3,_0x5b618e){return function(_0x2ddd89){if(_0x2ddd89){return _0x2ddd89[_0xdca8('0x2e')](_0x11dff3)['then'](function(_0x108ead){return _0x108ead;});}return null;};}function removeEntity(_0x3e77d1,_0x3ff576){return function(_0x4228d4){if(_0x4228d4){return _0x4228d4[_0xdca8('0x2f')]()[_0xdca8('0x30')](function(){_0x3e77d1['status'](0xcc)[_0xdca8('0x22')]();});}};}function handleEntityNotFound(_0x5b85e4,_0x1c92ee){return function(_0x4078e3){if(!_0x4078e3){_0x5b85e4[_0xdca8('0x31')](0x194);}return _0x4078e3;};}function handleError(_0x5a089b,_0x448fa3){_0x448fa3=_0x448fa3||0x1f4;return function(_0x54f87a){logger[_0xdca8('0x32')](_0x54f87a['stack']);if(_0x54f87a[_0xdca8('0x33')]){delete _0x54f87a['name'];}_0x5a089b[_0xdca8('0x28')](_0x448fa3)['send'](_0x54f87a);};}function getInteractionUsers(_0x3ccf0c,_0x33728c){return new BPromise(function(_0xe9e785,_0x5eda19){try{if(_0x33728c[_0x3ccf0c['id']]){_0x3ccf0c[_0xdca8('0x34')]=_[_0xdca8('0x35')](_0x33728c[_0x3ccf0c['id']],function(_0xa070f6){return{'id':_0xa070f6['id'],'fullname':_0xa070f6[_0xdca8('0x36')]};});}}catch(_0x1a8149){_0x5eda19(_0x1a8149);}_0xe9e785(_0x3ccf0c);});}function getInteractionTags(_0x509cc9,_0x5009bd){return new BPromise(function(_0x1ae002,_0x453e00){try{if(_0x509cc9[_0xdca8('0x37')]){_0x509cc9[_0xdca8('0x38')]=[];_0x509cc9['TagIds'][_0xdca8('0x39')](',')[_0xdca8('0x3a')](function(_0x10a379){_0x509cc9[_0xdca8('0x38')][_0xdca8('0x3b')](_0x5009bd[_0x10a379]);});}delete _0x509cc9[_0xdca8('0x37')];}catch(_0x5458b2){_0x453e00(_0x5458b2);}_0x1ae002(_0x509cc9);});}function updateWhatsappInteraction(_0x2be4f1,_0x300b24,_0x169e54){return new BPromise(function(_0x3b61fd,_0x567e33){return getInteractionUsers(_0x2be4f1,_0x169e54)['then'](function(_0x497168){return getInteractionTags(_0x497168,_0x300b24);})[_0xdca8('0x30')](function(_0x220b42){_0x3b61fd(_0x220b42);})[_0xdca8('0x3c')](function(_0x3cbfe6){_0x567e33(_0x3cbfe6);});});}exports['index']=function(_0x37c2d8,_0x2f962d){var _0x28e0f0={},_0x18d2cc={},_0x5c8b40={'count':0x0,'rows':[]};var _0xdcf5b8=_[_0xdca8('0x35')](db[_0xdca8('0x3d')][_0xdca8('0x3e')],function(_0x3ecc88){return{'name':_0x3ecc88['fieldName'],'type':_0x3ecc88['type'][_0xdca8('0x3f')]};});_0x18d2cc[_0xdca8('0x40')]=_[_0xdca8('0x35')](_0xdcf5b8,'name');_0x18d2cc[_0xdca8('0x41')]=_[_0xdca8('0x42')](_0x37c2d8['query']);_0x18d2cc['filters']=_[_0xdca8('0x43')](_0x18d2cc[_0xdca8('0x40')],_0x18d2cc['query']);_0x28e0f0['attributes']=_[_0xdca8('0x43')](_0x18d2cc[_0xdca8('0x40')],qs[_0xdca8('0x44')](_0x37c2d8[_0xdca8('0x41')]['fields']));_0x28e0f0[_0xdca8('0x45')]=_0x28e0f0[_0xdca8('0x45')][_0xdca8('0x46')]?_0x28e0f0[_0xdca8('0x45')]:_0x18d2cc[_0xdca8('0x40')];if(!_0x37c2d8[_0xdca8('0x41')]['hasOwnProperty']('nolimit')){_0x28e0f0[_0xdca8('0x26')]=qs[_0xdca8('0x26')](_0x37c2d8['query'][_0xdca8('0x26')]);_0x28e0f0[_0xdca8('0x24')]=qs[_0xdca8('0x24')](_0x37c2d8['query']['offset']);}_0x28e0f0[_0xdca8('0x47')]=qs[_0xdca8('0x48')](_0x37c2d8[_0xdca8('0x41')][_0xdca8('0x48')]);_0x28e0f0[_0xdca8('0x49')]=qs['filters'](_['pick'](_0x37c2d8['query'],_0x18d2cc[_0xdca8('0x4a')]),_0xdcf5b8);var _0x15234c=[];var _0x47e900=squel[_0xdca8('0x4b')]()[_0xdca8('0x4c')]('id')['field'](_0xdca8('0x33'))[_0xdca8('0x4c')](_0xdca8('0x4d'))['from'](_0xdca8('0x4e'));var _0x3a00ef=squel[_0xdca8('0x4b')]()[_0xdca8('0x4c')](_0xdca8('0x4f'))[_0xdca8('0x4c')]('u.fullname')[_0xdca8('0x4c')](_0xdca8('0x50'))[_0xdca8('0x51')](_0xdca8('0x52'),'ui')['left_join']('users','u','u.id\x20=\x20ui.UserId');var _0x41fc0a=squel[_0xdca8('0x4b')]()[_0xdca8('0x51')]('whatsapp_interactions','i')['left_join']('cm_contacts','c',_0xdca8('0x53'))[_0xdca8('0x54')](_0xdca8('0x55'),'o',_0xdca8('0x56'))['left_join'](_0xdca8('0x57'),'a',_0xdca8('0x58'))[_0xdca8('0x54')](_0xdca8('0x59'),'me','me.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0xdca8('0x5a'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0xdca8('0x54')](_0xdca8('0x4e'),'t',_0xdca8('0x5b'));var _0x40c50c=squel[_0xdca8('0x5c')]();var _0x176448=[];var _0x22a989=squel[_0xdca8('0x5c')]();var _0x5ecc40;if(_0x37c2d8[_0xdca8('0x41')][_0xdca8('0x5d')]){_0x5ecc40=as[_0xdca8('0x5e')](_0x37c2d8[_0xdca8('0x41')][_0xdca8('0x5d')]);var _0x349649=_0x5ecc40[_0xdca8('0x5f')];for(var _0x55da66=0x0;_0x55da66<_0x5ecc40['conditions'][_0xdca8('0x46')];_0x55da66++){var _0x10122a=_0x5ecc40[_0xdca8('0x60')][_0x55da66];var _0x2613e1='i';var _0x316d3c=_[_0xdca8('0x61')](_0xdcf5b8,[_0xdca8('0x33'),_0x10122a[_0xdca8('0x4c')]]);if(!_0x316d3c){switch(_0x10122a[_0xdca8('0x4c')]){case _0xdca8('0x62'):if(_0x10122a['value']==0x1){_0x41fc0a[_0xdca8('0x63')]('`'+_0x10122a[_0xdca8('0x4c')]+_0xdca8('0x64'));}else{_0x41fc0a['having']('`'+_0x10122a[_0xdca8('0x4c')]+_0xdca8('0x65'));}break;case _0xdca8('0x66'):if(_0x10122a[_0xdca8('0x67')]===_0xdca8('0x68')){if(_0x10122a['value']['split']('\x20')[_0xdca8('0x46')]>0x1){_0x40c50c[_0x349649](_0xdca8('0x69'),qs[_0xdca8('0x6a')](_0x10122a['value']),null);}else{var _0x26172c='%'+_0x10122a[_0xdca8('0x6b')]+'%';_0x40c50c[_0x349649]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x26172c,_0x26172c,_0x26172c);}}else{_0x316d3c=_[_0xdca8('0x61')](_0xdcf5b8,[_0xdca8('0x33'),'ContactId']);_0x10122a[_0xdca8('0x4c')]='ContactId';_0x3a469d=as[_0xdca8('0x6c')](_0x2613e1,_0x316d3c[_0xdca8('0x6d')],_0x10122a);_0x40c50c[_0x349649](_0x3a469d[_0xdca8('0x6e')],_0x3a469d[_0xdca8('0x6b')][_0xdca8('0x6f')],_0x3a469d[_0xdca8('0x6b')][_0xdca8('0x22')]);}break;case'Tag':var _0x4366f1=_0x10122a[_0xdca8('0x6b')][_0xdca8('0x39')](',')[_0xdca8('0x35')](function(_0x564b19){return Number(_0x564b19);});_0x4366f1[_0xdca8('0x3a')](function(_0x17b43e){_0x22a989['or'](_0xdca8('0x70'),'%,'+_0x17b43e+',%');});_0x176448=_['union'](_0x176448,_0x4366f1);break;case _0xdca8('0x71'):if(_0x10122a[_0xdca8('0x67')]===_0xdca8('0x68')){_0x40c50c[_0x349649](_0xdca8('0x72'),'%'+_0x10122a['value']+'%',null);}else{_0x316d3c=_['find'](_0xdcf5b8,[_0xdca8('0x33'),_0xdca8('0x73')]);_0x10122a['field']=_0xdca8('0x73');_0x3a469d=as[_0xdca8('0x6c')](_0x2613e1,_0x316d3c[_0xdca8('0x6d')],_0x10122a);_0x40c50c[_0x349649](_0x3a469d['text'],_0x3a469d['value'][_0xdca8('0x6f')],_0x3a469d[_0xdca8('0x6b')]['end']);}break;case _0xdca8('0x74'):_0x3a469d=as['buildExpression']('me',null,_0x10122a);_0x40c50c[_0x349649](_0x3a469d[_0xdca8('0x6e')],_0x3a469d[_0xdca8('0x6b')]['start'],_0x3a469d[_0xdca8('0x6b')]['end']);break;}}else{var _0x3a469d=as['buildExpression'](_0x2613e1,_0x316d3c[_0xdca8('0x6d')],_0x10122a);_0x40c50c[_0x349649](_0x3a469d[_0xdca8('0x6e')],_0x3a469d[_0xdca8('0x6b')]['start'],_0x3a469d[_0xdca8('0x6b')][_0xdca8('0x22')]);}}}else{var _0x2917df=_(_0x37c2d8[_0xdca8('0x41')])[_0xdca8('0x42')]()[_0xdca8('0x35')](function(_0x55ed43){return _[_0xdca8('0x75')](_0xdcf5b8,[_0xdca8('0x33'),_0x55ed43])?_0x55ed43:undefined;})[_0xdca8('0x76')]()['value']();if(!_[_0xdca8('0x77')](_0x2917df)){_0x2917df[_0xdca8('0x3a')](function(_0x56a81d){if(_0x56a81d===_0xdca8('0x78')){_0x41fc0a[_0xdca8('0x49')](_0xdca8('0x79'),[]['concat'](_0x37c2d8[_0xdca8('0x41')][_0x56a81d]));}else if(_0x56a81d===_0xdca8('0x7a')){var _0x59daf8=JSON[_0xdca8('0x7b')](_0x37c2d8['query'][_0x56a81d])[_0xdca8('0x7c')];var _0x40c0af=JSON[_0xdca8('0x7b')](_0x37c2d8[_0xdca8('0x41')][_0x56a81d])[_0xdca8('0x7d')];_0x41fc0a[_0xdca8('0x49')](_0xdca8('0x7e'),_0x59daf8,_0x40c0af);}else{if(_0x37c2d8[_0xdca8('0x41')][_0x56a81d]===_0xdca8('0x7f')){_0x41fc0a[_0xdca8('0x49')]('i.'+_0x56a81d+_0xdca8('0x80'));}else{_0x41fc0a[_0xdca8('0x49')]('i.'+_0x56a81d+_0xdca8('0x81'),_0x37c2d8[_0xdca8('0x41')][_0x56a81d]);}}});}if(_0x37c2d8[_0xdca8('0x41')][_0xdca8('0x82')]){if(_0x37c2d8[_0xdca8('0x41')][_0xdca8('0x82')]==0x1){_0x41fc0a[_0xdca8('0x63')]('`unreadMessages`\x20=\x200');}else{_0x41fc0a[_0xdca8('0x63')](_0xdca8('0x83'));}}if(_0x37c2d8[_0xdca8('0x41')][_0xdca8('0x84')]){_0x176448=_['isArray'](_0x37c2d8[_0xdca8('0x41')][_0xdca8('0x84')])?_0x37c2d8['query'][_0xdca8('0x84')]:new Array(_0x37c2d8[_0xdca8('0x41')][_0xdca8('0x84')]);_0x176448[_0xdca8('0x3a')](function(_0x4000e9){_0x22a989['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4000e9+',%');});}if(_0x37c2d8[_0xdca8('0x41')][_0xdca8('0x85')]){var _0x25dfd8=_0x37c2d8[_0xdca8('0x41')]['filter'][_0xdca8('0x86')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xdca8('0x87')](_0x25dfd8)){_0x40c50c['or'](_0xdca8('0x88'),_0x25dfd8+'%')['or'](_0xdca8('0x89'),_0x25dfd8+'%');}else{_0x40c50c['or'](_0xdca8('0x8a'),qs['getFullTextValue'](_0x25dfd8))['or'](_0xdca8('0x8b'),_0x25dfd8+'%');}}}_0x41fc0a['where'](_0x40c50c);_0x41fc0a[_0xdca8('0x8c')](_0xdca8('0x8d'));var _0x2248bd={'type':db[_0xdca8('0x8e')][_0xdca8('0x8f')][_0xdca8('0x90')],'raw':!![]};var _0x218cfa=_0x41fc0a[_0xdca8('0x91')]();_0x218cfa[_0xdca8('0x4c')](_0xdca8('0x8d'));_0x218cfa[_0xdca8('0x4c')](_0xdca8('0x92'),'unreadMessages');if(_0x28e0f0[_0xdca8('0x47')]){_0x28e0f0['order'][_0xdca8('0x3a')](function(_0x286c1a){var _0xaae3a2=_0x286c1a[0x0]===_0xdca8('0x93')?_0x286c1a[0x0]:'i.'+_0x286c1a[0x0];_0x41fc0a[_0xdca8('0x47')](_0xaae3a2,_0x286c1a[0x1]==='DESC'?![]:!![]);});}if(!_[_0xdca8('0x77')](_0x176448)){_0x41fc0a['having'](_0x22a989);_0x218cfa[_0xdca8('0x49')](_0xdca8('0x94'),_0x176448);}BPromise[_0xdca8('0x95')]()[_0xdca8('0x30')](function(){if(!_0x5ecc40){if(_0x37c2d8[_0xdca8('0x41')][_0xdca8('0x78')])return;_0x218cfa[_0xdca8('0x49')](_0xdca8('0x96'));_0x41fc0a[_0xdca8('0x49')](_0xdca8('0x96'));return;}if(_0x37c2d8['user']['role']!=='agent')return;return _0x37c2d8[_0xdca8('0x97')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0xdca8('0x30')](function(_0x2d3e1d){if(_['isEmpty'](_0x2d3e1d)){_0x218cfa[_0xdca8('0x49')]('i.WhatsappAccountId\x20IS\x20NULL');_0x41fc0a['where'](_0xdca8('0x98'));}else{_0x218cfa[_0xdca8('0x49')](_0xdca8('0x79'),_[_0xdca8('0x35')](_0x2d3e1d,'id'));_0x41fc0a[_0xdca8('0x49')](_0xdca8('0x79'),_[_0xdca8('0x35')](_0x2d3e1d,'id'));}});})[_0xdca8('0x30')](function(){if(_0x37c2d8[_0xdca8('0x97')][_0xdca8('0x99')]===_0xdca8('0x9a')&&!_0x5ecc40&&!_0x37c2d8[_0xdca8('0x41')]['WhatsappAccountId'])return[];return db[_0xdca8('0x9b')][_0xdca8('0x41')](_0x218cfa[_0xdca8('0x9c')](),_0x2248bd);})[_0xdca8('0x30')](function(_0x4854b6){_0x5c8b40[_0xdca8('0x27')]=_0x4854b6[_0xdca8('0x46')];if(_0x5c8b40[_0xdca8('0x27')]===0x0)return[];return db['sequelize'][_0xdca8('0x41')](_0x47e900[_0xdca8('0x9c')](),_0x2248bd)[_0xdca8('0x30')](function(_0x6cb44c){_0x15234c=_['keyBy'](_0x6cb44c,'id');_0x2248bd=_['merge'](_0x2248bd,{'model':db[_0xdca8('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x37c2d8['query'][_0xdca8('0x44')]){_0x28e0f0[_0xdca8('0x45')][_0xdca8('0x3a')](function(_0x152713){_0x41fc0a['field']('i.'+_0x152713);});}else{_0x41fc0a[_0xdca8('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xdca8('0x62'));_0x41fc0a[_0xdca8('0x4c')](_0xdca8('0x9d'),_0xdca8('0x9e'));_0x41fc0a[_0xdca8('0x4c')](_0xdca8('0x9f'),_0xdca8('0xa0'));_0x41fc0a[_0xdca8('0x4c')](_0xdca8('0xa1'),_0xdca8('0x93'));_0x41fc0a[_0xdca8('0x4c')]('i.*');_0x41fc0a[_0xdca8('0x4c')]('c.firstName',_0xdca8('0xa2'));_0x41fc0a[_0xdca8('0x4c')](_0xdca8('0xa3'),_0xdca8('0xa4'));_0x41fc0a[_0xdca8('0x4c')](_0xdca8('0xa5'),_0xdca8('0xa6'));_0x41fc0a[_0xdca8('0x4c')]('c.phone','Contact.phone');_0x41fc0a[_0xdca8('0x4c')](_0xdca8('0xa7'),_0xdca8('0xa8'));_0x41fc0a['field']('c.fax',_0xdca8('0xa9'));_0x41fc0a['field'](_0xdca8('0xaa'),'Owner.fullname');_0x41fc0a['field'](_0xdca8('0xab'),'Owner.internal');_0x41fc0a[_0xdca8('0x4c')](_0xdca8('0xac'),_0xdca8('0x37'));}if(_0x28e0f0[_0xdca8('0x26')])_0x41fc0a[_0xdca8('0x26')](_0x28e0f0[_0xdca8('0x26')]);if(_0x28e0f0[_0xdca8('0x24')])_0x41fc0a['offset'](_0x28e0f0[_0xdca8('0x24')]);return db[_0xdca8('0x9b')]['query'](_0x41fc0a[_0xdca8('0x9c')](),_0x2248bd);})['then'](function(_0x2ae9a6){if(_0x2ae9a6[_0xdca8('0x46')]>0x0)_0x3a00ef['where']('ui.WhatsappInteractionId\x20IN\x20?',_['map'](_0x2ae9a6,'id'));return db[_0xdca8('0x9b')]['query'](_0x3a00ef[_0xdca8('0x9c')](),_0x2248bd)['then'](function(_0x27a347){var _0x1a0df1=_['groupBy'](_0x27a347,'WhatsappInteractionId');var _0x3f1544=[];_0x2ae9a6['forEach'](function(_0xf0f2ae){_0x3f1544['push'](updateWhatsappInteraction(_0xf0f2ae,_0x15234c,_0x1a0df1));});return BPromise[_0xdca8('0xad')](_0x3f1544);});});})[_0xdca8('0x30')](function(_0x3fccd8){_0x5c8b40[_0xdca8('0xae')]=_0x3fccd8;return _0x5c8b40;})[_0xdca8('0x30')](respondWithFilteredResult(_0x2f962d,_0x28e0f0))[_0xdca8('0x3c')](handleError(_0x2f962d,null));};exports[_0xdca8('0xaf')]=function(_0x441efe,_0x45117c){var _0x5215ea={'raw':![],'where':{'id':_0x441efe[_0xdca8('0xb0')]['id']}},_0x599e43={};_0x599e43[_0xdca8('0x40')]=_[_0xdca8('0x42')](db[_0xdca8('0x3d')][_0xdca8('0x3e')]);_0x599e43['query']=_[_0xdca8('0x42')](_0x441efe[_0xdca8('0x41')]);_0x599e43['filters']=_[_0xdca8('0x43')](_0x599e43['model'],_0x599e43[_0xdca8('0x41')]);_0x5215ea[_0xdca8('0x45')]=_[_0xdca8('0x43')](_0x599e43[_0xdca8('0x40')],qs[_0xdca8('0x44')](_0x441efe[_0xdca8('0x41')][_0xdca8('0x44')]));_0x5215ea[_0xdca8('0x45')]=_0x5215ea[_0xdca8('0x45')]['length']?_0x5215ea['attributes']:_0x599e43[_0xdca8('0x40')];if(_0x441efe[_0xdca8('0x41')][_0xdca8('0xb1')]){_0x5215ea[_0xdca8('0xb2')]=[{'all':!![]}];}_0x5215ea=_[_0xdca8('0xb3')]({},_0x5215ea,_0x441efe[_0xdca8('0xb4')]);return db[_0xdca8('0x3d')][_0xdca8('0x61')](_0x5215ea)[_0xdca8('0x30')](handleEntityNotFound(_0x45117c,null))[_0xdca8('0x30')](respondWithResult(_0x45117c,null))[_0xdca8('0x3c')](handleError(_0x45117c,null));};exports[_0xdca8('0xb5')]=function(_0x2d6c54,_0x46ab16){return db[_0xdca8('0x3d')][_0xdca8('0xb5')](_0x2d6c54[_0xdca8('0x74')],{})[_0xdca8('0x30')](respondWithResult(_0x46ab16,0xc9))['catch'](handleError(_0x46ab16,null));};exports[_0xdca8('0x2e')]=function(_0x4d1fb6,_0x572329){if(_0x4d1fb6[_0xdca8('0x74')]['id']){delete _0x4d1fb6[_0xdca8('0x74')]['id'];}return db['WhatsappInteraction']['find']({'where':{'id':_0x4d1fb6[_0xdca8('0xb0')]['id']}})[_0xdca8('0x30')](handleEntityNotFound(_0x572329,null))[_0xdca8('0x30')](saveUpdates(_0x4d1fb6['body'],null))[_0xdca8('0x30')](respondWithResult(_0x572329,null))['catch'](handleError(_0x572329,null));};exports[_0xdca8('0x2f')]=function(_0x174d34,_0x5bfd42){return db[_0xdca8('0x3d')][_0xdca8('0x61')]({'where':{'id':_0x174d34[_0xdca8('0xb0')]['id']}})[_0xdca8('0x30')](handleEntityNotFound(_0x5bfd42,null))[_0xdca8('0x30')](removeEntity(_0x5bfd42,null))[_0xdca8('0x3c')](handleError(_0x5bfd42,null));};exports[_0xdca8('0xb6')]=function(_0x1d849f,_0x2a52c1){return db[_0xdca8('0x3d')][_0xdca8('0xb6')]()[_0xdca8('0x30')](respondWithResult(_0x2a52c1,null))[_0xdca8('0x3c')](handleError(_0x2a52c1,null));};exports['addMessage']=function(_0x5c2b10,_0xa21d67,_0x5e5984){return db[_0xdca8('0xb7')][_0xdca8('0x61')]({'where':{'id':_0x5c2b10[_0xdca8('0xb0')]['id']}})[_0xdca8('0x30')](handleEntityNotFound(_0xa21d67,null))[_0xdca8('0x30')](function(_0x20ca45){if(_0x20ca45){return _0x20ca45['addMessage'](_0x5c2b10[_0xdca8('0x74')][_0xdca8('0xb8')],_[_0xdca8('0xb9')](_0x5c2b10[_0xdca8('0x74')],['ids','id'])||{});}})[_0xdca8('0x30')](respondWithResult(_0xa21d67,null))['catch'](handleError(_0xa21d67,null));};exports['getMessages']=function(_0x2289b2,_0x4a6d6a,_0x3d02f8){var _0x45a18a={'raw':![],'where':{}};var _0x2accd5={};var _0x8f1d52={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xdca8('0xba')]({'where':{'id':_0x2289b2[_0xdca8('0xb0')]['id']}})['then'](handleEntityNotFound(_0x4a6d6a,null))['then'](function(_0x5c3c55){if(_0x5c3c55){_0x2accd5[_0xdca8('0x40')]=_[_0xdca8('0x42')](db[_0xdca8('0xb7')][_0xdca8('0x3e')]);_0x2accd5[_0xdca8('0x41')]=_[_0xdca8('0x42')](_0x2289b2['query']);_0x2accd5[_0xdca8('0x4a')]=_[_0xdca8('0x43')](_0x2accd5[_0xdca8('0x40')],_0x2accd5[_0xdca8('0x41')]);_0x45a18a[_0xdca8('0x45')]=_[_0xdca8('0x43')](_0x2accd5[_0xdca8('0x40')],qs[_0xdca8('0x44')](_0x2289b2['query'][_0xdca8('0x44')]));_0x45a18a[_0xdca8('0x45')]=_0x45a18a[_0xdca8('0x45')][_0xdca8('0x46')]?_0x45a18a[_0xdca8('0x45')]:_0x2accd5[_0xdca8('0x40')];if(!_0x2289b2[_0xdca8('0x41')]['hasOwnProperty']('nolimit')){_0x45a18a[_0xdca8('0x26')]=qs[_0xdca8('0x26')](_0x2289b2[_0xdca8('0x41')][_0xdca8('0x26')]);_0x45a18a[_0xdca8('0x24')]=qs[_0xdca8('0x24')](_0x2289b2[_0xdca8('0x41')][_0xdca8('0x24')]);}_0x45a18a[_0xdca8('0x47')]=qs[_0xdca8('0x48')](_0x2289b2['query']['sort']);_0x45a18a[_0xdca8('0x49')]=qs[_0xdca8('0x4a')](_[_0xdca8('0xbb')](_0x2289b2[_0xdca8('0x41')],_0x2accd5[_0xdca8('0x4a')]));_0x45a18a[_0xdca8('0x49')][_0xdca8('0xbc')]=_0x5c3c55['id'];if(_0x2289b2['query'][_0xdca8('0x85')]){_0x45a18a[_0xdca8('0x49')]=_[_0xdca8('0xb3')](_0x45a18a[_0xdca8('0x49')],{'$or':_[_0xdca8('0x35')](_0x45a18a[_0xdca8('0x45')],function(_0x3296c8){var _0x1dd14c={};_0x1dd14c[_0x3296c8]={'$like':'%'+_0x2289b2[_0xdca8('0x41')][_0xdca8('0x85')]+'%'};return _0x1dd14c;})});}if(_0x2289b2[_0xdca8('0x41')][_0xdca8('0x7c')]){var _0xdada30=_0x2289b2['query'][_0xdca8('0x7c')]['split'](',');var _0x2e7bff={};_0x2e7bff[_0xdada30[0x0]]={'$gte':moment(_0xdada30[0x1])[_0xdca8('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')};_0x45a18a['where']=_[_0xdca8('0xb3')](_0x45a18a[_0xdca8('0x49')],_0x2e7bff);}_0x45a18a=_[_0xdca8('0xb3')]({},_0x45a18a,_0x2289b2[_0xdca8('0xb4')]);return db[_0xdca8('0xb7')][_0xdca8('0x27')]({'where':_0x45a18a[_0xdca8('0x49')]})[_0xdca8('0x30')](function(_0x2f2aef){_0x8f1d52['count']=_0x2f2aef;if(_0x2289b2[_0xdca8('0x41')][_0xdca8('0xb1')]){_0x45a18a[_0xdca8('0xb2')]=[{'all':!![]}];}return db[_0xdca8('0xb7')][_0xdca8('0xbe')](_0x45a18a);})[_0xdca8('0x30')](function(_0x4e1624){_0x8f1d52[_0xdca8('0xae')]=_0x4e1624;return _0x8f1d52;});}})[_0xdca8('0x30')](respondWithFilteredResult(_0x4a6d6a,_0x45a18a))[_0xdca8('0x3c')](handleError(_0x4a6d6a,null));};exports[_0xdca8('0xbf')]=function(_0x57b2af,_0x546481,_0x148b63){return db[_0xdca8('0x3d')]['find']({'where':{'id':_0x57b2af[_0xdca8('0xb0')]['id']}})['then'](handleEntityNotFound(_0x546481,null))['then'](function(_0x555419){if(_0x555419){return _0x555419[_0xdca8('0xc0')](_0x57b2af[_0xdca8('0x74')][_0xdca8('0xb8')],_[_0xdca8('0xb9')](_0x57b2af[_0xdca8('0x74')],[_0xdca8('0xb8'),'id'])||{})[_0xdca8('0xc1')](function(){return db[_0xdca8('0xc2')][_0xdca8('0xbe')]({'attributes':['id',_0xdca8('0x33'),_0xdca8('0x4d')],'where':{'id':_0x57b2af['body'][_0xdca8('0xb8')]}});})[_0xdca8('0x30')](function(_0x107ca1){socket[_0xdca8('0xc3')](_0xdca8('0xc4'),{'id':Number(_0x57b2af[_0xdca8('0xb0')]['id']),'tags':_0x107ca1||[]});return{'id':Number(_0x57b2af[_0xdca8('0xb0')]['id']),'tags':_0x107ca1||[]};});}})[_0xdca8('0x30')](respondWithResult(_0x546481,null))[_0xdca8('0x3c')](handleError(_0x546481,null));};exports[_0xdca8('0xc5')]=function(_0x2925e9,_0x4bf69c,_0x4a5ffc){return db['WhatsappInteraction'][_0xdca8('0x61')]({'where':{'id':_0x2925e9['params']['id']}})[_0xdca8('0x30')](handleEntityNotFound(_0x4bf69c,null))[_0xdca8('0x30')](function(_0xece5b3){if(_0xece5b3){return _0xece5b3[_0xdca8('0xc5')](_0x2925e9[_0xdca8('0x41')][_0xdca8('0xb8')]);}})[_0xdca8('0x30')](respondWithStatusCode(_0x4bf69c,null))[_0xdca8('0x3c')](handleError(_0x4bf69c,null));};exports[_0xdca8('0xc6')]=function(_0x376e3a,_0x9489ee){var _0x3beb25=moment()[_0xdca8('0xc7')]()[_0xdca8('0x9c')]();var _0x7407d9=path[_0xdca8('0xc8')](config[_0xdca8('0xc9')],_0xdca8('0xca'),_0xdca8('0xcb'),'tmp');var _0x5c8457=path[_0xdca8('0xc8')](config[_0xdca8('0xc9')],_0xdca8('0xca'),'files',_0xdca8('0xcc'));var _0x29bcd4=path['join'](_0x7407d9,_0x3beb25);var _0x56e032=util[_0xdca8('0xbd')](_0xdca8('0xcd'),_0x376e3a[_0xdca8('0xb0')]['id'],_0x3beb25);var _0x671c8=path[_0xdca8('0xc8')](_0x7407d9,_0x56e032);var _0x812ac8=[];_0x812ac8[_0xdca8('0x3b')]({'model':db[_0xdca8('0x71')],'as':_0xdca8('0x71'),'attributes':['id',_0xdca8('0x36')],'raw':!![]});_0x812ac8[_0xdca8('0x3b')]({'model':db[_0xdca8('0xce')],'as':_0xdca8('0x66'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x376e3a['query'][_0xdca8('0xcc')]){_0x812ac8[_0xdca8('0x3b')]({'model':db[_0xdca8('0xcf')],'as':_0xdca8('0xcf'),'raw':!![]});}var _0x56d54d=[{'model':db['WhatsappMessage'],'as':_0xdca8('0xd0'),'attributes':['id',_0xdca8('0x74'),_0xdca8('0x7a'),_0xdca8('0xd1'),_0xdca8('0xd2'),_0xdca8('0x82')],'include':_0x812ac8}];_0x56d54d[_0xdca8('0x3b')]({'model':db[_0xdca8('0xd3')],'as':_0xdca8('0xd4'),'attributes':['id',_0xdca8('0x33')]});_0x56d54d[_0xdca8('0x3b')]({'model':db[_0xdca8('0x71')],'as':'Owner','attributes':['id','fullname']});return db[_0xdca8('0x3d')][_0xdca8('0x61')]({'where':{'id':_0x376e3a[_0xdca8('0xb0')]['id']},'include':_0x56d54d})[_0xdca8('0x30')](handleEntityNotFound(_0x9489ee,null))['then'](function(_0x281525){if(_0x281525){var _0x4f49c1=_0x281525['get']({'plain':!![]});fs[_0xdca8('0xd5')](_0x29bcd4);var _0x2b38e4={'channel':'Whatsapp','account':_0x4f49c1['Account']['name'],'agent':_0x4f49c1[_0xdca8('0xd6')]?_0x4f49c1[_0xdca8('0xd6')][_0xdca8('0x36')]:'N.A.','createdAt':moment(_0x4f49c1['createdAt'])[_0xdca8('0xbd')](_0xdca8('0xd7'))[_0xdca8('0x9c')](),'closedAt':_0x4f49c1[_0xdca8('0xd8')]?moment(_0x4f49c1[_0xdca8('0xd9')])[_0xdca8('0xbd')](_0xdca8('0xd7'))[_0xdca8('0x9c')]():'','disposition':_0x4f49c1[_0xdca8('0xda')],'messages':_(_0x4f49c1[_0xdca8('0xd0')])[_0xdca8('0x85')]({'secret':![]})[_0xdca8('0x35')](function(_0x2dac3f){if(_0x2dac3f['Attachment']){var _0x213a5f=path[_0xdca8('0xc8')](_0x5c8457,_0x2dac3f['Attachment'][_0xdca8('0xdb')]);if(fs[_0xdca8('0xdc')](_0x213a5f)){fs[_0xdca8('0xdd')](_0x213a5f)[_0xdca8('0xde')](fs[_0xdca8('0xdf')](path[_0xdca8('0xc8')](_0x29bcd4,_0x2dac3f[_0xdca8('0xcf')]['basename'])));}}return{'date':moment(_0x2dac3f[_0xdca8('0x7a')])[_0xdca8('0xbd')](_0xdca8('0xd7'))[_0xdca8('0x9c')](),'sender':_0x2dac3f['direction']===_0xdca8('0xe0')?_0x2dac3f[_0xdca8('0x71')]?_0x2dac3f[_0xdca8('0x71')]['fullname']:_0xdca8('0xe1'):_0x2dac3f[_0xdca8('0x66')][_0xdca8('0xe2')]+(_0x2dac3f[_0xdca8('0x66')][_0xdca8('0xe3')]?'\x20'+_0x2dac3f['Contact']['lastName']:''),'body':_0x2dac3f[_0xdca8('0xcf')]?_0x2dac3f[_0xdca8('0xcf')][_0xdca8('0xdb')]:_0x2dac3f[_0xdca8('0x74')],'direction':_0x2dac3f[_0xdca8('0xd1')]===_0xdca8('0xe0')?'A':'C','secret':_0x2dac3f[_0xdca8('0xd2')],'read':_0x2dac3f['read'],'attachment':_0x2dac3f[_0xdca8('0xcf')]};})[_0xdca8('0x6b')]()};return ejs[_0xdca8('0xe4')](path[_0xdca8('0xc8')](config[_0xdca8('0xc9')],_0xdca8('0xca'),_0xdca8('0xe5'),'downloadInteraction.ejs'),{'interaction':_0x2b38e4})[_0xdca8('0x30')](function(_0x1ed620){var _0x2b45b7=path[_0xdca8('0xc8')](_0x29bcd4,_0xdca8('0xe6')+_0x4f49c1['id']+'-'+_0x3beb25+_0xdca8('0xe7'));var _0xc1656a={'path':_0x2b45b7,'channel':_0xdca8('0xe8'),'interactionId':_0x4f49c1['id']};return pdf[_0xdca8('0xe9')](_0x1ed620,_0xc1656a);})[_0xdca8('0x30')](function(){return new BPromise(function(_0x5a4e6a,_0x4700e3){zipdir(_0x29bcd4,{'saveTo':_0x671c8},function(_0x46299d,_0x33cf14){if(_0x46299d)return _0x4700e3(_0x46299d);return _0x5a4e6a(_0x33cf14);});})[_0xdca8('0x30')](function(){return new BPromise(function(_0x5dbad6,_0x4b3e80){rimraf(_0x29bcd4,function(_0x348f8b){if(_0x348f8b)_0x4b3e80(_0x348f8b);return _0x5dbad6();});});})[_0xdca8('0x30')](function(){return _0x9489ee[_0xdca8('0xc6')](_0x671c8,_0x56e032,function(_0x26499c){if(_0x26499c){console[_0xdca8('0xea')]('err',_0x26499c);}else{fs[_0xdca8('0xeb')](_0x671c8);}});});});}else{return _0x9489ee['sendStatus'](0xc8);}})['catch'](handleError(_0x9489ee,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 0dfd2ef..3d891ea 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 _0x61a5=['events','WhatsappInteraction','../../mysqldb','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports'];(function(_0x33bc57,_0x5ecc75){var _0x484b88=function(_0x4b805c){while(--_0x4b805c){_0x33bc57['push'](_0x33bc57['shift']());}};_0x484b88(++_0x5ecc75);}(_0x61a5,0x19e));var _0x561a=function(_0x466bc5,_0x3a0f2a){_0x466bc5=_0x466bc5-0x0;var _0x138952=_0x61a5[_0x466bc5];return _0x138952;};'use strict';var EventEmitter=require(_0x561a('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x561a('0x1')];var WhatsappMessage=require(_0x561a('0x2'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x561a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x561a('0x4'),'afterDestroy':_0x561a('0x5')};function emitEvent(_0x1d8bd8){return function(_0x1bce83,_0x2261b3,_0x28ff42){_0x1bce83[_0x561a('0x6')]({'attributes':['id'],'raw':!![]})[_0x561a('0x7')](function(_0x4c2853){_0x1bce83[_0x561a('0x8')](_0x561a('0x9'),_0x4c2853[_0x561a('0xa')](function(_0x5cd4f6){return{'id':_0x5cd4f6['id']};}));return WhatsappMessage[_0x561a('0xb')]({'where':{'WhatsappInteractionId':_0x1bce83['id'],'direction':'in','read':![]},'raw':!![]});})[_0x561a('0x7')](function(_0x5a4e9b){_0x1bce83[_0x561a('0x8')](_0x561a('0xc'),_0x5a4e9b[_0x561a('0xd')]);WhatsappInteractionEvents[_0x561a('0xe')](_0x1d8bd8+':'+_0x1bce83['id'],_0x1bce83);WhatsappInteractionEvents['emit'](_0x1d8bd8,_0x1bce83);_0x28ff42(null);})['catch'](_0x28ff42(null));};}for(var e in events){if(events[_0x561a('0xf')](e)){var event=events[e];WhatsappInteraction[_0x561a('0x10')](e,emitEvent(event));}}module[_0x561a('0x11')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x0884=['../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','remove','Users','map','findAll','then','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','exports','events'];(function(_0x2584bc,_0x35d9f5){var _0x405f2c=function(_0x4a1d1e){while(--_0x4a1d1e){_0x2584bc['push'](_0x2584bc['shift']());}};_0x405f2c(++_0x35d9f5);}(_0x0884,0xb3));var _0x4088=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0884[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x4088('0x0'));var WhatsappInteraction=require(_0x4088('0x1'))['db'][_0x4088('0x2')];var WhatsappMessage=require(_0x4088('0x1'))['db'][_0x4088('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x4088('0x4')](0x0);var events={'afterCreate':_0x4088('0x5'),'afterUpdate':'update','afterDestroy':_0x4088('0x6')};function emitEvent(_0x634f6f){return function(_0x19841,_0x426db2,_0x3b1d74){_0x19841['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x42b2c3){_0x19841['setDataValue'](_0x4088('0x7'),_0x42b2c3[_0x4088('0x8')](function(_0x38e9d9){return{'id':_0x38e9d9['id']};}));return WhatsappMessage[_0x4088('0x9')]({'where':{'WhatsappInteractionId':_0x19841['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4088('0xa')](function(_0x29c7ec){_0x19841[_0x4088('0xb')](_0x4088('0xc'),_0x29c7ec[_0x4088('0xd')]);WhatsappInteractionEvents['emit'](_0x634f6f+':'+_0x19841['id'],_0x19841);WhatsappInteractionEvents[_0x4088('0xe')](_0x634f6f,_0x19841);_0x3b1d74(null);})[_0x4088('0xf')](_0x3b1d74(null));};}for(var e in events){if(events[_0x4088('0x10')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x4088('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 3113cfd..abcd742 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 _0xf696=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xdd4411,_0x12361a){var _0x21163f=function(_0x1b074b){while(--_0x1b074b){_0xdd4411['push'](_0xdd4411['shift']());}};_0x21163f(++_0x12361a);}(_0xf696,0x180));var _0x6f69=function(_0x44c32e,_0x5194ad){_0x44c32e=_0x44c32e-0x0;var _0x51d703=_0xf696[_0x44c32e];return _0x51d703;};'use strict';var _=require('lodash');var util=require(_0x6f69('0x0'));var logger=require('../../config/logger')(_0x6f69('0x1'));var moment=require(_0x6f69('0x2'));var BPromise=require(_0x6f69('0x3'));var rp=require(_0x6f69('0x4'));var fs=require('fs');var path=require(_0x6f69('0x5'));var rimraf=require(_0x6f69('0x6'));var config=require(_0x6f69('0x7'));var attributes=require(_0x6f69('0x8'));module[_0x6f69('0x9')]=function(_0x525ad3,_0x1f82da){return _0x525ad3['define'](_0x6f69('0xa'),attributes,{'tableName':_0x6f69('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3c3a46,_0x3a91a9,_0x1106e9){if(_0x3c3a46[_0x6f69('0xc')](_0x6f69('0xd'))){_0x3c3a46[_0x6f69('0xe')]=moment()['format'](_0x6f69('0xf'));}_0x1106e9(null,_0x3c3a46);}}});}; \ No newline at end of file +var _0x2820=['bluebird','request-promise','rimraf','define','WhatsappInteraction','whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2820,0xb2));var _0x0282=function(_0x1103aa,_0x36973f){_0x1103aa=_0x1103aa-0x0;var _0x250eb4=_0x2820[_0x1103aa];return _0x250eb4;};'use strict';var _=require(_0x0282('0x0'));var util=require(_0x0282('0x1'));var logger=require('../../config/logger')(_0x0282('0x2'));var moment=require(_0x0282('0x3'));var BPromise=require(_0x0282('0x4'));var rp=require(_0x0282('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0282('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0x4e088f,_0x2f428a){return _0x4e088f[_0x0282('0x7')](_0x0282('0x8'),attributes,{'tableName':_0x0282('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x33b344,_0x118d2d,_0x2e8e61){if(_0x33b344['changed'](_0x0282('0xa'))){_0x33b344[_0x0282('0xb')]=moment()[_0x0282('0xc')](_0x0282('0xd'));}_0x2e8e61(null,_0x33b344);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index fde1c8f..b03131a 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 _0x266d=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','WhatsappInteraction','body','options','raw','where','attributes','limit','UpdateWhatsappInteraction','stringify','AddTagsToWhatsappInteraction','find','ids','spread','AddTags','lodash','util','bluebird','randomstring','../../config/utils','rpc'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x266d,0x1bd));var _0xd266=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x266d[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xd266('0x0'));var util=require(_0xd266('0x1'));var moment=require('moment');var BPromise=require(_0xd266('0x2'));var rs=require(_0xd266('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd266('0x4'));var logger=require('../../config/logger')(_0xd266('0x5'));var config=require(_0xd266('0x6'));var jayson=require(_0xd266('0x7'));var client=jayson[_0xd266('0x8')][_0xd266('0x9')]({'port':0x232a});config[_0xd266('0xa')]=_[_0xd266('0xb')](config['redis'],{'host':_0xd266('0xc'),'port':0x18eb});var socket=require(_0xd266('0xd'))(new Redis(config[_0xd266('0xa')]));require(_0xd266('0xe'))[_0xd266('0xf')](socket);function respondWithRpcPromise(_0x36b023,_0x4558ca,_0x54810f){return new BPromise(function(_0x1b9875,_0x5c87ed){return client[_0xd266('0x10')](_0x36b023,_0x54810f)[_0xd266('0x11')](function(_0xa8e1e1){logger[_0xd266('0x12')](_0xd266('0x13'),_0x4558ca,_0xd266('0x14'));logger[_0xd266('0x15')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x4558ca,_0xd266('0x14'),JSON['stringify'](_0xa8e1e1));if(_0xa8e1e1[_0xd266('0x16')]){if(_0xa8e1e1[_0xd266('0x16')][_0xd266('0x17')]===0x1f4){logger[_0xd266('0x16')](_0xd266('0x13'),_0x4558ca,_0xa8e1e1[_0xd266('0x16')][_0xd266('0x18')]);return _0x5c87ed(_0xa8e1e1[_0xd266('0x16')][_0xd266('0x18')]);}logger[_0xd266('0x16')](_0xd266('0x13'),_0x4558ca,_0xa8e1e1['error']['message']);return _0x1b9875(_0xa8e1e1[_0xd266('0x16')][_0xd266('0x18')]);}else{logger[_0xd266('0x12')](_0xd266('0x13'),_0x4558ca,_0xd266('0x14'));_0x1b9875(_0xa8e1e1[_0xd266('0x19')]['message']);}})[_0xd266('0x1a')](function(_0x7d84cd){logger[_0xd266('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x4558ca,_0x7d84cd);_0x5c87ed(_0x7d84cd);});});}exports['UpdateWhatsappInteraction']=function(_0x47d659){var _0x398f04=this;return new Promise(function(_0x33ca28,_0x42e6da){return db[_0xd266('0x1b')]['update'](_0x47d659[_0xd266('0x1c')],{'raw':_0x47d659['options']?_0x47d659[_0xd266('0x1d')][_0xd266('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47d659[_0xd266('0x1d')]?_0x47d659[_0xd266('0x1d')][_0xd266('0x1f')]||null:null,'attributes':_0x47d659[_0xd266('0x1d')]?_0x47d659[_0xd266('0x1d')][_0xd266('0x20')]||null:null,'limit':_0x47d659[_0xd266('0x1d')]?_0x47d659[_0xd266('0x1d')][_0xd266('0x21')]||null:null})['then'](function(_0x1ea4e8){logger[_0xd266('0x12')]('UpdateWhatsappInteraction',_0x47d659);logger[_0xd266('0x15')](_0xd266('0x22'),_0x47d659,JSON[_0xd266('0x23')](_0x1ea4e8));_0x33ca28(_0x1ea4e8);})[_0xd266('0x1a')](function(_0x351588){logger[_0xd266('0x16')](_0xd266('0x22'),_0x351588[_0xd266('0x18')],_0x47d659);_0x42e6da(_0x398f04[_0xd266('0x16')](0x1f4,_0x351588[_0xd266('0x18')]));});});};exports[_0xd266('0x24')]=function(_0x3028be){return new Promise(function(_0x1987c0,_0x3a4420){return db[_0xd266('0x1b')][_0xd266('0x25')]({'where':_0x3028be[_0xd266('0x1d')]?_0x3028be[_0xd266('0x1d')]['where']||null:null})[_0xd266('0x11')](function(_0x4cd96b){if(_0x4cd96b){return _0x4cd96b['addTags'](_0x3028be[_0xd266('0x1c')][_0xd266('0x26')],_['omit'](_0x3028be['body'],[_0xd266('0x26'),'id'])||{});}})[_0xd266('0x27')](function(_0x2031d9){logger[_0xd266('0x12')](_0xd266('0x28'),_0x3028be);logger[_0xd266('0x15')](_0xd266('0x28'),_0x3028be,JSON[_0xd266('0x23')](_0x2031d9));_0x1987c0(_0x2031d9);})[_0xd266('0x1a')](function(_0x31b8cc){logger[_0xd266('0x16')](_0xd266('0x28'),_0x31b8cc['message'],_0x3028be);_0x3a4420(_this[_0xd266('0x16')](0x1f4,_0x31b8cc['message']));});});}; \ No newline at end of file +var _0x3f2c=['localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','find','addTags','body','ids','spread','AddTags','lodash','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x4e7012,_0x5d5f73){var _0xcd56d5=function(_0x330847){while(--_0x330847){_0x4e7012['push'](_0x4e7012['shift']());}};_0xcd56d5(++_0x5d5f73);}(_0x3f2c,0xb9));var _0xc3f2=function(_0x21cc16,_0x411798){_0x21cc16=_0x21cc16-0x0;var _0x5e6ca7=_0x3f2c[_0x21cc16];return _0x5e6ca7;};'use strict';var _=require(_0xc3f2('0x0'));var util=require('util');var moment=require(_0xc3f2('0x1'));var BPromise=require(_0xc3f2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc3f2('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc3f2('0x4'))('rpc');var config=require(_0xc3f2('0x5'));var jayson=require(_0xc3f2('0x6'));var client=jayson['client'][_0xc3f2('0x7')]({'port':0x232a});config[_0xc3f2('0x8')]=_[_0xc3f2('0x9')](config[_0xc3f2('0x8')],{'host':_0xc3f2('0xa'),'port':0x18eb});var socket=require(_0xc3f2('0xb'))(new Redis(config['redis']));require(_0xc3f2('0xc'))[_0xc3f2('0xd')](socket);function respondWithRpcPromise(_0x4ae83a,_0xdaf5a1,_0x596685){return new BPromise(function(_0x394105,_0x1207e8){return client[_0xc3f2('0xe')](_0x4ae83a,_0x596685)[_0xc3f2('0xf')](function(_0x1cb5f3){logger[_0xc3f2('0x10')](_0xc3f2('0x11'),_0xdaf5a1,'request\x20sent');logger[_0xc3f2('0x12')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0xdaf5a1,_0xc3f2('0x13'),JSON[_0xc3f2('0x14')](_0x1cb5f3));if(_0x1cb5f3[_0xc3f2('0x15')]){if(_0x1cb5f3[_0xc3f2('0x15')]['code']===0x1f4){logger[_0xc3f2('0x15')](_0xc3f2('0x11'),_0xdaf5a1,_0x1cb5f3['error'][_0xc3f2('0x16')]);return _0x1207e8(_0x1cb5f3[_0xc3f2('0x15')]['message']);}logger[_0xc3f2('0x15')](_0xc3f2('0x11'),_0xdaf5a1,_0x1cb5f3[_0xc3f2('0x15')][_0xc3f2('0x16')]);return _0x394105(_0x1cb5f3[_0xc3f2('0x15')][_0xc3f2('0x16')]);}else{logger[_0xc3f2('0x10')](_0xc3f2('0x11'),_0xdaf5a1,_0xc3f2('0x13'));_0x394105(_0x1cb5f3['result'][_0xc3f2('0x16')]);}})[_0xc3f2('0x17')](function(_0x4488bf){logger[_0xc3f2('0x15')](_0xc3f2('0x11'),_0xdaf5a1,_0x4488bf);_0x1207e8(_0x4488bf);});});}exports[_0xc3f2('0x18')]=function(_0x5213d4){var _0x35b298=this;return new Promise(function(_0x32d6cc,_0x5c4322){return db[_0xc3f2('0x19')][_0xc3f2('0x1a')](_0x5213d4['body'],{'raw':_0x5213d4[_0xc3f2('0x1b')]?_0x5213d4[_0xc3f2('0x1b')][_0xc3f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5213d4[_0xc3f2('0x1b')]?_0x5213d4[_0xc3f2('0x1b')][_0xc3f2('0x1d')]||null:null,'attributes':_0x5213d4['options']?_0x5213d4[_0xc3f2('0x1b')][_0xc3f2('0x1e')]||null:null,'limit':_0x5213d4[_0xc3f2('0x1b')]?_0x5213d4[_0xc3f2('0x1b')][_0xc3f2('0x1f')]||null:null})[_0xc3f2('0xf')](function(_0x1fd9d6){logger[_0xc3f2('0x10')](_0xc3f2('0x18'),_0x5213d4);logger[_0xc3f2('0x12')](_0xc3f2('0x18'),_0x5213d4,JSON[_0xc3f2('0x14')](_0x1fd9d6));_0x32d6cc(_0x1fd9d6);})[_0xc3f2('0x17')](function(_0x14309e){logger[_0xc3f2('0x15')](_0xc3f2('0x18'),_0x14309e[_0xc3f2('0x16')],_0x5213d4);_0x5c4322(_0x35b298[_0xc3f2('0x15')](0x1f4,_0x14309e[_0xc3f2('0x16')]));});});};exports[_0xc3f2('0x20')]=function(_0x22192d){return new Promise(function(_0x38dcfc,_0x2d6f9b){return db[_0xc3f2('0x19')][_0xc3f2('0x21')]({'where':_0x22192d[_0xc3f2('0x1b')]?_0x22192d['options'][_0xc3f2('0x1d')]||null:null})[_0xc3f2('0xf')](function(_0xc45ec3){if(_0xc45ec3){return _0xc45ec3[_0xc3f2('0x22')](_0x22192d[_0xc3f2('0x23')][_0xc3f2('0x24')],_['omit'](_0x22192d[_0xc3f2('0x23')],['ids','id'])||{});}})[_0xc3f2('0x25')](function(_0x428636){logger[_0xc3f2('0x10')]('AddTags',_0x22192d);logger[_0xc3f2('0x12')]('AddTags',_0x22192d,JSON[_0xc3f2('0x14')](_0x428636));_0x38dcfc(_0x428636);})[_0xc3f2('0x17')](function(_0x258bab){logger['error'](_0xc3f2('0x26'),_0x258bab['message'],_0x22192d);_0x2d6f9b(_this[_0xc3f2('0x15')](0x1f4,_0x258bab[_0xc3f2('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 0e2e920..5aa56c6 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 _0xa1b2=['remove','update','emit','removeListener','register','length','./whatsappInteraction.events','save'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xa1b2,0x19e));var _0x2a1b=function(_0x5f1094,_0x13a841){_0x5f1094=_0x5f1094-0x0;var _0x454771=_0xa1b2[_0x5f1094];return _0x454771;};'use strict';var WhatsappInteractionEvents=require(_0x2a1b('0x0'));var events=[_0x2a1b('0x1'),_0x2a1b('0x2'),_0x2a1b('0x3')];function createListener(_0x8013d9,_0x26e09c){return function(_0x4203fe){_0x26e09c[_0x2a1b('0x4')](_0x8013d9,_0x4203fe);};}function removeListener(_0x2b36d0,_0x58be13){return function(){WhatsappInteractionEvents[_0x2a1b('0x5')](_0x2b36d0,_0x58be13);};}exports[_0x2a1b('0x6')]=function(_0x4f2646){for(var _0x92a183=0x0,_0xa8038b=events[_0x2a1b('0x7')];_0x92a183<_0xa8038b;_0x92a183++){var _0x16f135=events[_0x92a183];var _0x2bbc06=createListener('whatsappInteraction:'+_0x16f135,_0x4f2646);WhatsappInteractionEvents['on'](_0x16f135,_0x2bbc06);}}; \ No newline at end of file +var _0xe6be=['remove','update','emit','removeListener','register','length','whatsappInteraction:'];(function(_0x1308cb,_0x23d743){var _0x4a241=function(_0x4f00ae){while(--_0x4f00ae){_0x1308cb['push'](_0x1308cb['shift']());}};_0x4a241(++_0x23d743);}(_0xe6be,0xa1));var _0xee6b=function(_0x3fd2b2,_0x5627f1){_0x3fd2b2=_0x3fd2b2-0x0;var _0x5d290f=_0xe6be[_0x3fd2b2];return _0x5d290f;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0xee6b('0x0'),_0xee6b('0x1')];function createListener(_0x5901d1,_0x1cb0f0){return function(_0x18d1bb){_0x1cb0f0[_0xee6b('0x2')](_0x5901d1,_0x18d1bb);};}function removeListener(_0x4f0de5,_0x55ebb9){return function(){WhatsappInteractionEvents[_0xee6b('0x3')](_0x4f0de5,_0x55ebb9);};}exports[_0xee6b('0x4')]=function(_0x3550fc){for(var _0x2b97d7=0x0,_0x1ce7c1=events[_0xee6b('0x5')];_0x2b97d7<_0x1ce7c1;_0x2b97d7++){var _0x4e1e9f=events[_0x2b97d7];var _0x1b3fbc=createListener(_0xee6b('0x6')+_0x4e1e9f,_0x3550fc);WhatsappInteractionEvents['on'](_0x4e1e9f,_0x1b3fbc);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 14a3c65..a28ef2b 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 _0xa47f=['describe','/:id','show','whatsapp','create','/:id/status','put','update','/:id/accept','/:id/reject','reject','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','index','/describe','isAuthenticated'];(function(_0x54b8cf,_0x10d9cf){var _0x5c13c6=function(_0x322a3b){while(--_0x322a3b){_0x54b8cf['push'](_0x54b8cf['shift']());}};_0x5c13c6(++_0x10d9cf);}(_0xa47f,0x1a2));var _0xfa47=function(_0x30a73d,_0x21f4dc){_0x30a73d=_0x30a73d-0x0;var _0x365eca=_0xa47f[_0x30a73d];return _0x365eca;};'use strict';var multer=require(_0xfa47('0x0'));var util=require('util');var path=require(_0xfa47('0x1'));var timeout=require(_0xfa47('0x2'));var express=require(_0xfa47('0x3'));var router=express[_0xfa47('0x4')]();var fs_extra=require(_0xfa47('0x5'));var auth=require(_0xfa47('0x6'));var interaction=require(_0xfa47('0x7'));var config=require(_0xfa47('0x8'));var controller=require(_0xfa47('0x9'));router[_0xfa47('0xa')]('/',auth['isAuthenticated'](),controller[_0xfa47('0xb')]);router[_0xfa47('0xa')](_0xfa47('0xc'),auth[_0xfa47('0xd')](),controller[_0xfa47('0xe')]);router[_0xfa47('0xa')](_0xfa47('0xf'),auth['isAuthenticated'](),controller[_0xfa47('0x10')]);router['post']('/',auth[_0xfa47('0xd')](),interaction['tracked'](_0xfa47('0x11'),'whatsappmessage:create'),controller[_0xfa47('0x12')]);router['post'](_0xfa47('0x13'),controller['status']);router[_0xfa47('0x14')](_0xfa47('0xf'),auth[_0xfa47('0xd')](),controller[_0xfa47('0x15')]);router[_0xfa47('0x14')](_0xfa47('0x16'),auth[_0xfa47('0xd')](),controller['accept']);router['put'](_0xfa47('0x17'),auth['isAuthenticated'](),controller[_0xfa47('0x18')]);router['delete'](_0xfa47('0xf'),auth['isAuthenticated'](),controller[_0xfa47('0x19')]);module[_0xfa47('0x1a')]=router; \ No newline at end of file +var _0x7b84=['/:id/reject','reject','delete','/:id','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','index','/describe','isAuthenticated','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','put','update','/:id/accept','accept'];(function(_0x1d9163,_0x79567d){var _0xb42197=function(_0x3818e8){while(--_0x3818e8){_0x1d9163['push'](_0x1d9163['shift']());}};_0xb42197(++_0x79567d);}(_0x7b84,0x9b));var _0x47b8=function(_0x121fcf,_0x4b0586){_0x121fcf=_0x121fcf-0x0;var _0x268822=_0x7b84[_0x121fcf];return _0x268822;};'use strict';var multer=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var path=require('path');var timeout=require(_0x47b8('0x2'));var express=require(_0x47b8('0x3'));var router=express[_0x47b8('0x4')]();var fs_extra=require(_0x47b8('0x5'));var auth=require(_0x47b8('0x6'));var interaction=require(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var controller=require(_0x47b8('0x9'));router[_0x47b8('0xa')]('/',auth['isAuthenticated'](),controller[_0x47b8('0xb')]);router['get'](_0x47b8('0xc'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x47b8('0xd')](),controller[_0x47b8('0xe')]);router[_0x47b8('0xf')]('/',auth['isAuthenticated'](),interaction[_0x47b8('0x10')](_0x47b8('0x11'),_0x47b8('0x12')),controller[_0x47b8('0x13')]);router[_0x47b8('0xf')](_0x47b8('0x14'),controller['status']);router[_0x47b8('0x15')]('/:id',auth[_0x47b8('0xd')](),controller[_0x47b8('0x16')]);router[_0x47b8('0x15')](_0x47b8('0x17'),auth[_0x47b8('0xd')](),controller[_0x47b8('0x18')]);router['put'](_0x47b8('0x19'),auth[_0x47b8('0xd')](),controller[_0x47b8('0x1a')]);router[_0x47b8('0x1b')](_0x47b8('0x1c'),auth[_0x47b8('0xd')](),controller['destroy']);module[_0x47b8('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index b4c13be..6948bd8 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 _0x3936=['STRING','DATE','sequelize','TEXT','medium','BOOLEAN','out'];(function(_0x17ff84,_0x513e44){var _0x4d6138=function(_0x291862){while(--_0x291862){_0x17ff84['push'](_0x17ff84['shift']());}};_0x4d6138(++_0x513e44);}(_0x3936,0x1ec));var _0x6393=function(_0x5e06a1,_0x340f61){_0x5e06a1=_0x5e06a1-0x0;var _0x5b3253=_0x3936[_0x5e06a1];return _0x5b3253;};'use strict';var Sequelize=require(_0x6393('0x0'));module['exports']={'body':{'type':Sequelize[_0x6393('0x1')](_0x6393('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x6393('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x6393('0x4')),'defaultValue':_0x6393('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x6393('0x5')](0xbe)},'phone':{'type':Sequelize[_0x6393('0x5')]},'readAt':{'type':Sequelize[_0x6393('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x6393('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x3ccc=['STRING','DATE','sequelize','TEXT','medium','BOOLEAN','out'];(function(_0x10f60f,_0x5a3eea){var _0xd84616=function(_0x467c34){while(--_0x467c34){_0x10f60f['push'](_0x10f60f['shift']());}};_0xd84616(++_0x5a3eea);}(_0x3ccc,0x1bb));var _0xc3cc=function(_0x1a9ed0,_0x1085fc){_0x1a9ed0=_0x1a9ed0-0x0;var _0x47bbd6=_0x3ccc[_0x1a9ed0];return _0x47bbd6;};'use strict';var Sequelize=require(_0xc3cc('0x0'));module['exports']={'body':{'type':Sequelize[_0xc3cc('0x1')](_0xc3cc('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc3cc('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xc3cc('0x4')),'defaultValue':_0xc3cc('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc3cc('0x5')](0xbe)},'phone':{'type':Sequelize[_0xc3cc('0x5')]},'readAt':{'type':Sequelize[_0xc3cc('0x6')]},'secret':{'type':Sequelize[_0xc3cc('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xc3cc('0x5')]},'providerResponse':{'type':Sequelize[_0xc3cc('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 465c97e..d27af9a 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 _0x0711=['rows','show','params','includeAll','find','create','catch','body','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','SIP/%s','channel','motionChannel','EventManager','acceptmessage','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','User','interface','event','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','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','redis','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','info','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','update','destroy','stack','name','send','index','WhatsappMessage','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','filter','options','include'];(function(_0x23747f,_0x40cdb0){var _0x3febfd=function(_0x2d8521){while(--_0x2d8521){_0x23747f['push'](_0x23747f['shift']());}};_0x3febfd(++_0x40cdb0);}(_0x0711,0xcb));var _0x1071=function(_0x36767e,_0x1c254e){_0x36767e=_0x36767e-0x0;var _0x5df892=_0x0711[_0x36767e];return _0x5df892;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1071('0x0'));var zipdir=require(_0x1071('0x1'));var jsonpatch=require(_0x1071('0x2'));var rp=require(_0x1071('0x3'));var moment=require('moment');var BPromise=require(_0x1071('0x4'));var Mustache=require(_0x1071('0x5'));var util=require(_0x1071('0x6'));var path=require('path');var sox=require(_0x1071('0x7'));var csv=require('to-csv');var ejs=require(_0x1071('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1071('0x9'));var squel=require('squel');var crypto=require(_0x1071('0xa'));var jsforce=require(_0x1071('0xb'));var deskjs=require(_0x1071('0xc'));var toCsv=require(_0x1071('0xd'));var querystring=require(_0x1071('0xe'));var Papa=require(_0x1071('0xf'));var Redis=require(_0x1071('0x10'));var authService=require(_0x1071('0x11'));var qs=require(_0x1071('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1071('0x13'));var logger=require(_0x1071('0x14'))(_0x1071('0x15'));var utils=require(_0x1071('0x16'));var config=require(_0x1071('0x17'));var licenseUtil=require(_0x1071('0x18'));var db=require(_0x1071('0x19'))['db'];config[_0x1071('0x1a')]=_['defaults'](config[_0x1071('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x1071('0x1b'))(new Redis(config[_0x1071('0x1a')]));require(_0x1071('0x1c'))[_0x1071('0x1d')](socket);var jayson=require(_0x1071('0x1e'));var client=jayson[_0x1071('0x1f')][_0x1071('0x20')]({'port':0x232c});var client9002=jayson[_0x1071('0x1f')][_0x1071('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x418fb5,_0x464a19,_0x2403db,_0x1e07ef){return new BPromise(function(_0x57f718,_0x46f555){var _0x3374df=_0x1e07ef||client;return _0x3374df[_0x1071('0x21')](_0x418fb5,_0x2403db)[_0x1071('0x22')](function(_0x5724be){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x464a19,_0x1071('0x23'));logger[_0x1071('0x24')](_0x1071('0x25'),_0x464a19,_0x1071('0x23'),JSON[_0x1071('0x26')](_0x5724be));if(_0x5724be[_0x1071('0x27')]){if(_0x5724be['error'][_0x1071('0x28')]===0x1f4){logger['error'](_0x1071('0x29'),_0x464a19,_0x5724be[_0x1071('0x27')]['message']);return _0x46f555(_0x5724be[_0x1071('0x27')][_0x1071('0x2a')]);}logger['error'](_0x1071('0x29'),_0x464a19,_0x5724be[_0x1071('0x27')][_0x1071('0x2a')]);return _0x57f718(_0x5724be['error'][_0x1071('0x2a')]);}else{logger[_0x1071('0x2b')]('WhatsappMessage,\x20%s,\x20%s',_0x464a19,_0x1071('0x23'));_0x57f718(_0x5724be['result']['message']);}})['catch'](function(_0x594c73){logger[_0x1071('0x27')](_0x1071('0x29'),_0x464a19,_0x594c73);_0x46f555(_0x594c73);});});}function respondWithStatusCode(_0x18fe83,_0x41acf0){_0x41acf0=_0x41acf0||0xcc;return function(_0x435d43){if(_0x435d43){return _0x18fe83[_0x1071('0x2c')](_0x41acf0);}return _0x18fe83[_0x1071('0x2d')](_0x41acf0)[_0x1071('0x2e')]();};}function respondWithResult(_0x31296b,_0x431b48){_0x431b48=_0x431b48||0xc8;return function(_0x128fa3){if(_0x128fa3){return _0x31296b[_0x1071('0x2d')](_0x431b48)[_0x1071('0x2f')](_0x128fa3);}};}function respondWithFilteredResult(_0x3a6c8e,_0x4814c3){return function(_0x4ae633){if(_0x4ae633){var _0x375558=typeof _0x4814c3[_0x1071('0x30')]===_0x1071('0x31')&&typeof _0x4814c3[_0x1071('0x32')]===_0x1071('0x31');var _0x7cc059=_0x4ae633['count'];var _0x1398aa=_0x375558?0x0:_0x4814c3[_0x1071('0x30')];var _0x1847a2=_0x375558?_0x4ae633[_0x1071('0x33')]:_0x4814c3[_0x1071('0x30')]+_0x4814c3['limit'];var _0xf12108;if(_0x1847a2>=_0x7cc059){_0x1847a2=_0x7cc059;_0xf12108=0xc8;}else{_0xf12108=0xce;}_0x3a6c8e['status'](_0xf12108);return _0x3a6c8e['set'](_0x1071('0x34'),_0x1398aa+'-'+_0x1847a2+'/'+_0x7cc059)[_0x1071('0x2f')](_0x4ae633);}return null;};}function patchUpdates(_0x258c72){return function(_0x1d2142){try{jsonpatch['apply'](_0x1d2142,_0x258c72,!![]);}catch(_0x4eea81){return BPromise['reject'](_0x4eea81);}return _0x1d2142[_0x1071('0x35')]();};}function saveUpdates(_0x16e8c2,_0x2aafff){return function(_0x266970){if(_0x266970){return _0x266970[_0x1071('0x36')](_0x16e8c2)[_0x1071('0x22')](function(_0xcf45f0){return _0xcf45f0;});}return null;};}function removeEntity(_0x3af3b1,_0x45c73a){return function(_0x4bfce8){if(_0x4bfce8){return _0x4bfce8[_0x1071('0x37')]()[_0x1071('0x22')](function(){_0x3af3b1[_0x1071('0x2d')](0xcc)[_0x1071('0x2e')]();});}};}function handleEntityNotFound(_0x1da7a0,_0xb3a47c){return function(_0x1a1488){if(!_0x1a1488){_0x1da7a0[_0x1071('0x2c')](0x194);}return _0x1a1488;};}function handleError(_0x25612c,_0x42b58d){_0x42b58d=_0x42b58d||0x1f4;return function(_0x427e19){logger[_0x1071('0x27')](_0x427e19[_0x1071('0x38')]);if(_0x427e19[_0x1071('0x39')]){delete _0x427e19[_0x1071('0x39')];}_0x25612c['status'](_0x42b58d)[_0x1071('0x3a')](_0x427e19);};}exports[_0x1071('0x3b')]=function(_0x4c837d,_0x493e0a){var _0x495a06={},_0x25714c={},_0x316a6e={'count':0x0,'rows':[]};var _0x21cbc4=_['map'](db[_0x1071('0x3c')][_0x1071('0x3d')],function(_0x4fa15c){return{'name':_0x4fa15c['fieldName'],'type':_0x4fa15c[_0x1071('0x3e')][_0x1071('0x3f')]};});_0x25714c[_0x1071('0x40')]=_[_0x1071('0x41')](_0x21cbc4,_0x1071('0x39'));_0x25714c[_0x1071('0x42')]=_[_0x1071('0x43')](_0x4c837d['query']);_0x25714c['filters']=_[_0x1071('0x44')](_0x25714c[_0x1071('0x40')],_0x25714c[_0x1071('0x42')]);_0x495a06[_0x1071('0x45')]=_[_0x1071('0x44')](_0x25714c[_0x1071('0x40')],qs[_0x1071('0x46')](_0x4c837d[_0x1071('0x42')][_0x1071('0x46')]));_0x495a06[_0x1071('0x45')]=_0x495a06[_0x1071('0x45')][_0x1071('0x47')]?_0x495a06[_0x1071('0x45')]:_0x25714c[_0x1071('0x40')];if(!_0x4c837d[_0x1071('0x42')][_0x1071('0x48')](_0x1071('0x49'))){_0x495a06[_0x1071('0x32')]=qs[_0x1071('0x32')](_0x4c837d['query'][_0x1071('0x32')]);_0x495a06['offset']=qs['offset'](_0x4c837d[_0x1071('0x42')][_0x1071('0x30')]);}_0x495a06[_0x1071('0x4a')]=qs[_0x1071('0x4b')](_0x4c837d[_0x1071('0x42')][_0x1071('0x4b')]);_0x495a06[_0x1071('0x4c')]=qs['filters'](_[_0x1071('0x4d')](_0x4c837d[_0x1071('0x42')],_0x25714c[_0x1071('0x4e')]),_0x21cbc4);if(_0x4c837d[_0x1071('0x42')]['filter']){_0x495a06[_0x1071('0x4c')]=_[_0x1071('0x4f')](_0x495a06['where'],{'$or':_[_0x1071('0x41')](_0x21cbc4,function(_0x338831){if(_0x338831['type']!=='VIRTUAL'){var _0x2b6835={};_0x2b6835[_0x338831[_0x1071('0x39')]]={'$like':'%'+_0x4c837d[_0x1071('0x42')][_0x1071('0x50')]+'%'};return _0x2b6835;}})});}_0x495a06=_[_0x1071('0x4f')]({},_0x495a06,_0x4c837d[_0x1071('0x51')]);var _0x214cbc={'where':_0x495a06[_0x1071('0x4c')]};return db['WhatsappMessage']['count'](_0x214cbc)[_0x1071('0x22')](function(_0x406ae4){_0x316a6e[_0x1071('0x33')]=_0x406ae4;if(_0x4c837d[_0x1071('0x42')]['includeAll']){_0x495a06[_0x1071('0x52')]=[{'all':!![]}];}return db[_0x1071('0x3c')]['findAll'](_0x495a06);})[_0x1071('0x22')](function(_0x540dab){_0x316a6e[_0x1071('0x53')]=_0x540dab;return _0x316a6e;})['then'](respondWithFilteredResult(_0x493e0a,_0x495a06))['catch'](handleError(_0x493e0a,null));};exports[_0x1071('0x54')]=function(_0x1437ad,_0x128d9){var _0x51a331={'raw':!![],'where':{'id':_0x1437ad[_0x1071('0x55')]['id']}},_0xa23688={};_0xa23688['model']=_[_0x1071('0x43')](db[_0x1071('0x3c')]['rawAttributes']);_0xa23688[_0x1071('0x42')]=_[_0x1071('0x43')](_0x1437ad[_0x1071('0x42')]);_0xa23688[_0x1071('0x4e')]=_['intersection'](_0xa23688[_0x1071('0x40')],_0xa23688['query']);_0x51a331['attributes']=_[_0x1071('0x44')](_0xa23688['model'],qs['fields'](_0x1437ad['query'][_0x1071('0x46')]));_0x51a331['attributes']=_0x51a331[_0x1071('0x45')]['length']?_0x51a331[_0x1071('0x45')]:_0xa23688[_0x1071('0x40')];if(_0x1437ad[_0x1071('0x42')][_0x1071('0x56')]){_0x51a331['include']=[{'all':!![]}];}_0x51a331=_[_0x1071('0x4f')]({},_0x51a331,_0x1437ad[_0x1071('0x51')]);return db[_0x1071('0x3c')][_0x1071('0x57')](_0x51a331)[_0x1071('0x22')](handleEntityNotFound(_0x128d9,null))['then'](respondWithResult(_0x128d9,null))['catch'](handleError(_0x128d9,null));};exports[_0x1071('0x58')]=function(_0x2c834c,_0x14eac9){return db['WhatsappMessage'][_0x1071('0x58')](_0x2c834c['body'],{})['then'](respondWithResult(_0x14eac9,0xc9))[_0x1071('0x59')](handleError(_0x14eac9,null));};exports[_0x1071('0x36')]=function(_0xeef6c1,_0xd5a7f4){if(_0xeef6c1[_0x1071('0x5a')]['id']){delete _0xeef6c1['body']['id'];}return db['WhatsappMessage'][_0x1071('0x57')]({'where':{'id':_0xeef6c1[_0x1071('0x55')]['id']}})[_0x1071('0x22')](handleEntityNotFound(_0xd5a7f4,null))['then'](saveUpdates(_0xeef6c1[_0x1071('0x5a')],null))['then'](respondWithResult(_0xd5a7f4,null))[_0x1071('0x59')](handleError(_0xd5a7f4,null));};exports[_0x1071('0x37')]=function(_0x4c89bb,_0x2edaa3){return db['WhatsappMessage'][_0x1071('0x57')]({'where':{'id':_0x4c89bb['params']['id']}})[_0x1071('0x22')](handleEntityNotFound(_0x2edaa3,null))['then'](removeEntity(_0x2edaa3,null))[_0x1071('0x59')](handleError(_0x2edaa3,null));};exports[_0x1071('0x5b')]=function(_0x3f8eba,_0x339959){return db[_0x1071('0x3c')]['describe']()['then'](respondWithResult(_0x339959,null))['catch'](handleError(_0x339959,null));};var interaction_log=require(_0x1071('0x14'))(_0x1071('0x5c'));exports[_0x1071('0x5d')]=function(_0x29d188,_0xcdb6a7,_0x34a41c){var _0x808192={'agent':{},'channel':_0x1071('0x5e')};if(_0x29d188[_0x1071('0x5a')]['id']){delete _0x29d188['body']['id'];}_0x29d188['body'][_0x1071('0x5f')]=!![];_0x29d188['body'][_0x1071('0x60')]=moment()[_0x1071('0x61')](_0x1071('0x62'));_0x29d188['body'][_0x1071('0x63')]=_0x29d188[_0x1071('0x5a')]['UserId']||_0x29d188[_0x1071('0x64')]['id'];_0x808192[_0x1071('0x65')]['id']=_0x29d188[_0x1071('0x5a')][_0x1071('0x63')];return db[_0x1071('0x3c')]['find']({'where':{'id':_0x29d188['params']['id'],'UserId':null}})[_0x1071('0x22')](handleEntityNotFound(_0xcdb6a7,null))[_0x1071('0x22')](saveUpdates(_0x29d188['body'],null))[_0x1071('0x22')](function(_0x150bfb){if(_0x150bfb){_0x808192[_0x1071('0x2a')]=_0x150bfb[_0x1071('0x66')]({'plain':!![]});return db[_0x1071('0x67')][_0x1071('0x57')]({'where':{'id':_0x150bfb[_0x1071('0x68')]}});}return null;})[_0x1071('0x22')](handleEntityNotFound(_0xcdb6a7,null))['then'](function(_0x4c0035){if(_0x4c0035){return _0x4c0035[_0x1071('0x36')]({'UserId':_0x29d188[_0x1071('0x5a')][_0x1071('0x63')],'read1stAt':_[_0x1071('0x69')](_0x4c0035['read1stAt'])?moment()[_0x1071('0x61')](_0x1071('0x62')):undefined});}return null;})[_0x1071('0x22')](function(_0x1f337f){if(_0x1f337f){_0x808192['interaction']=_0x1f337f[_0x1071('0x66')]({'plain':!![]});interaction_log[_0x1071('0x2b')](_0x1071('0x6a'),_0x29d188[_0x1071('0x64')]['id'],_0x29d188[_0x1071('0x64')]['name'],_0x29d188[_0x1071('0x64')][_0x1071('0x6b')],_0x808192[_0x1071('0x6c')]['id'],_0x29d188[_0x1071('0x5a')]?JSON[_0x1071('0x26')](_0x29d188['body']):_0x1071('0x6d'));return respondWithRpcPromise(_0x1071('0x6e'),_0x1071('0x6f'),_0x808192);}return null;})[_0x1071('0x22')](function(_0x67de68){var _0x5e57d2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x67de68[_0x1071('0x2a')][_0x1071('0x70')];return db[_0x1071('0x71')][_0x1071('0x42')](_0x5e57d2,{'type':db[_0x1071('0x72')][_0x1071('0x73')][_0x1071('0x74')],'raw':!![]})[_0x1071('0x22')](function(_0x146447){return _0x146447;});})['then'](function(_0x32ae69){if(_0x32ae69){_0x808192[_0x1071('0x2a')][_0x1071('0x75')]=_0x32ae69[0x0];if(!_0x29d188[_0x1071('0x5a')][_0x1071('0x63')])return;return db['User'][_0x1071('0x57')]({'where':{'id':_0x29d188[_0x1071('0x5a')][_0x1071('0x63')],'role':_0x1071('0x65')},'attributes':['id',_0x1071('0x39'),_0x1071('0x76'),_0x1071('0x77'),_0x1071('0x78')],'raw':!![]});}return null;})[_0x1071('0x22')](function(_0x1bc4c0){if(!_0x1bc4c0)return null;_0x808192['message']['agent']=_0x1bc4c0;return _0x808192;})[_0x1071('0x22')](function(_0x513a1b){if(_0x513a1b){if(_0x29d188['body'][_0x1071('0x79')]){_0x808192[_0x1071('0x2a')]['interface']=util[_0x1071('0x61')](_0x1071('0x7a'),_0x29d188['user'][_0x1071('0x39')]);_0x808192['message'][_0x1071('0x7b')]=_0x808192[_0x1071('0x7b')];_0x808192[_0x1071('0x2a')][_0x1071('0x7c')]=_0x808192[_0x1071('0x7b')];_0x808192[_0x1071('0x2a')]['event']=_0x1071('0x5d');return respondWithRpcPromise(_0x1071('0x7d'),_0x1071('0x7d'),{'event':_0x1071('0x7e'),'message':_0x808192[_0x1071('0x2a')]},client9002)[_0x1071('0x22')](function(){return _0x808192;});}return _0x808192;}return null;})[_0x1071('0x22')](respondWithResult(_0xcdb6a7,null))['catch'](handleError(_0xcdb6a7,null));};var interaction_log=require(_0x1071('0x14'))('whatsapp-interactions');exports[_0x1071('0x7f')]=function(_0x517c8b,_0x557b21,_0xfa8a4b){var _0xe1858e={'agent':{},'channel':_0x1071('0x5e')};if(_0x517c8b['body']['id']){delete _0x517c8b[_0x1071('0x5a')]['id'];}_0x517c8b[_0x1071('0x5a')][_0x1071('0x63')]=_0x517c8b[_0x1071('0x5a')][_0x1071('0x63')]||_0x517c8b[_0x1071('0x64')]['id'];_0xe1858e[_0x1071('0x65')]['id']=_0x517c8b[_0x1071('0x5a')][_0x1071('0x63')];return db[_0x1071('0x3c')][_0x1071('0x57')]({'where':{'id':_0x517c8b['params']['id'],'UserId':null}})[_0x1071('0x22')](handleEntityNotFound(_0x557b21,null))[_0x1071('0x22')](function(_0x5373be){if(_0x5373be){_0xe1858e[_0x1071('0x2a')]=_0x5373be[_0x1071('0x66')]({'plain':!![]});return db[_0x1071('0x67')]['find']({'where':{'id':_0x5373be['WhatsappInteractionId']}});}return null;})[_0x1071('0x22')](handleEntityNotFound(_0x557b21,null))['then'](function(_0x16b488){if(_0x16b488){_0xe1858e[_0x1071('0x6c')]=_0x16b488[_0x1071('0x66')]({'plain':!![]});interaction_log[_0x1071('0x2b')](_0x1071('0x80'),_0x517c8b[_0x1071('0x64')]['id'],_0x517c8b[_0x1071('0x64')][_0x1071('0x39')],_0x517c8b[_0x1071('0x64')]['role'],_0xe1858e[_0x1071('0x6c')]['id'],_0x517c8b['body']?JSON[_0x1071('0x26')](_0x517c8b[_0x1071('0x5a')]):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0xe1858e);}return null;})[_0x1071('0x22')](function(_0x15a799){var _0x463790=_0x1071('0x81')+_0x15a799[_0x1071('0x2a')][_0x1071('0x70')];return db['sequelize'][_0x1071('0x42')](_0x463790,{'type':db[_0x1071('0x72')][_0x1071('0x73')][_0x1071('0x74')],'raw':!![]})[_0x1071('0x22')](function(_0x205c63){return _0x205c63;});})[_0x1071('0x22')](function(_0x49c78e){if(_0x49c78e){_0xe1858e['message']['contact']=_0x49c78e[0x0];if(!_0x517c8b[_0x1071('0x5a')][_0x1071('0x63')])return;return db[_0x1071('0x82')][_0x1071('0x57')]({'where':{'id':_0x517c8b[_0x1071('0x5a')][_0x1071('0x63')],'role':'agent'},'attributes':['id',_0x1071('0x39'),_0x1071('0x76'),_0x1071('0x77'),_0x1071('0x78')],'raw':!![]});}return null;})[_0x1071('0x22')](function(_0x126f95){if(!_0x126f95)return null;_0xe1858e['message'][_0x1071('0x65')]=_0x126f95;return _0xe1858e;})[_0x1071('0x22')](function(_0x4b5264){if(_0x4b5264){_0x4b5264[_0x1071('0x2a')][_0x1071('0x83')]=util['format'](_0x1071('0x7a'),_0x517c8b[_0x1071('0x64')]['name']);_0x4b5264[_0x1071('0x2a')][_0x1071('0x7b')]=_0xe1858e[_0x1071('0x7b')];_0x4b5264[_0x1071('0x2a')][_0x1071('0x7c')]=_0xe1858e[_0x1071('0x7b')];_0x4b5264[_0x1071('0x2a')][_0x1071('0x84')]=_0x1071('0x7f');respondWithRpcPromise(_0x1071('0x7d'),_0x1071('0x7d'),{'event':_0x1071('0x85'),'message':_0x4b5264['message']},client9002);return _0xe1858e;}return null;})['then'](respondWithResult(_0x557b21,null))['catch'](handleError(_0x557b21,null));};exports['status']=function(_0x43e726,_0x52315f,_0x15d055){if(_0x43e726[_0x1071('0x5a')]['id']){delete _0x43e726['body']['id'];}var _0x25d702;return db[_0x1071('0x3c')][_0x1071('0x57')]({'where':{'id':_0x43e726[_0x1071('0x55')]['id']}})[_0x1071('0x22')](handleEntityNotFound(_0x52315f,null))[_0x1071('0x22')](function(_0x377327){if(_0x377327){_0x25d702=_0x377327;return db['WhatsappAccount'][_0x1071('0x57')]({'where':{'id':_0x377327[_0x1071('0x86')]}});}})[_0x1071('0x22')](handleEntityNotFound(_0x52315f,null))[_0x1071('0x22')](function(_0x32d276){if(_0x32d276){logger[_0x1071('0x24')](_0x1071('0x87'),'status',_0x1071('0x88'),_0x32d276['type'],util['inspect'](_0x43e726[_0x1071('0x5a')],{'showHidden':![],'depth':null}));switch(_0x32d276[_0x1071('0x3e')]){case _0x1071('0x89'):if(_0x43e726[_0x1071('0x5a')][_0x1071('0x8a')]&&_0x43e726[_0x1071('0x5a')][_0x1071('0x8a')]===_0x25d702[_0x1071('0x8b')]&&_0x43e726[_0x1071('0x5a')][_0x1071('0x8c')]&&_0x43e726['body'][_0x1071('0x8c')]==='read'){return _0x25d702[_0x1071('0x36')]({'read':!![]});}else{logger['error'](_0x1071('0x8d'),_0x1071('0x2d'),_0x1071('0x89'),util[_0x1071('0x8e')](_0x43e726[_0x1071('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x25d702;}})[_0x1071('0x22')](respondWithResult(_0x52315f,null))['catch'](handleError(_0x52315f,null));}; \ No newline at end of file +var _0xff92=['twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','jayson/promise','client','http','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','send','index','map','WhatsappMessage','rawAttributes','type','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','show','params','find','create','body','describe','whatsapp','format','UserId','user','agent','WhatsappInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','get','RejectMessage','rejectMessage','sequelize','internal','interface','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect'];(function(_0x212930,_0x2561f0){var _0x1103c5=function(_0x2c1a9a){while(--_0x2c1a9a){_0x212930['push'](_0x212930['shift']());}};_0x1103c5(++_0x2561f0);}(_0xff92,0x119));var _0x2ff9=function(_0x2bcc97,_0x3d284e){_0x2bcc97=_0x2bcc97-0x0;var _0x32a9b4=_0xff92[_0x2bcc97];return _0x32a9b4;};'use strict';var emlformat=require(_0x2ff9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2ff9('0x1'));var jsonpatch=require(_0x2ff9('0x2'));var rp=require(_0x2ff9('0x3'));var moment=require(_0x2ff9('0x4'));var BPromise=require(_0x2ff9('0x5'));var Mustache=require(_0x2ff9('0x6'));var util=require('util');var path=require(_0x2ff9('0x7'));var sox=require('sox');var csv=require(_0x2ff9('0x8'));var ejs=require(_0x2ff9('0x9'));var fs=require('fs');var fs_extra=require(_0x2ff9('0xa'));var _=require(_0x2ff9('0xb'));var squel=require(_0x2ff9('0xc'));var crypto=require(_0x2ff9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2ff9('0xe'));var toCsv=require(_0x2ff9('0x8'));var querystring=require('querystring');var Papa=require(_0x2ff9('0xf'));var Redis=require('ioredis');var authService=require(_0x2ff9('0x10'));var qs=require(_0x2ff9('0x11'));var as=require(_0x2ff9('0x12'));var hardwareService=require(_0x2ff9('0x13'));var logger=require(_0x2ff9('0x14'))('api');var utils=require(_0x2ff9('0x15'));var config=require(_0x2ff9('0x16'));var licenseUtil=require(_0x2ff9('0x17'));var db=require(_0x2ff9('0x18'))['db'];config[_0x2ff9('0x19')]=_[_0x2ff9('0x1a')](config[_0x2ff9('0x19')],{'host':_0x2ff9('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2ff9('0x1c'))['register'](socket);var jayson=require(_0x2ff9('0x1d'));var client=jayson[_0x2ff9('0x1e')][_0x2ff9('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x41830a,_0x28074e,_0x1ae965,_0x58dac3){return new BPromise(function(_0x1055ec,_0x8a029b){var _0x117a2e=_0x58dac3||client;return _0x117a2e['request'](_0x41830a,_0x1ae965)['then'](function(_0x281277){logger[_0x2ff9('0x20')](_0x2ff9('0x21'),_0x28074e,'request\x20sent');logger[_0x2ff9('0x22')](_0x2ff9('0x23'),_0x28074e,_0x2ff9('0x24'),JSON[_0x2ff9('0x25')](_0x281277));if(_0x281277[_0x2ff9('0x26')]){if(_0x281277[_0x2ff9('0x26')][_0x2ff9('0x27')]===0x1f4){logger[_0x2ff9('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x28074e,_0x281277[_0x2ff9('0x26')][_0x2ff9('0x28')]);return _0x8a029b(_0x281277['error']['message']);}logger[_0x2ff9('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x28074e,_0x281277[_0x2ff9('0x26')][_0x2ff9('0x28')]);return _0x1055ec(_0x281277['error'][_0x2ff9('0x28')]);}else{logger[_0x2ff9('0x20')](_0x2ff9('0x21'),_0x28074e,_0x2ff9('0x24'));_0x1055ec(_0x281277['result']['message']);}})[_0x2ff9('0x29')](function(_0x2978af){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x28074e,_0x2978af);_0x8a029b(_0x2978af);});});}function respondWithStatusCode(_0x2cd015,_0x16a31c){_0x16a31c=_0x16a31c||0xcc;return function(_0x534c77){if(_0x534c77){return _0x2cd015['sendStatus'](_0x16a31c);}return _0x2cd015['status'](_0x16a31c)[_0x2ff9('0x2a')]();};}function respondWithResult(_0x498044,_0x315b71){_0x315b71=_0x315b71||0xc8;return function(_0x141aac){if(_0x141aac){return _0x498044[_0x2ff9('0x2b')](_0x315b71)['json'](_0x141aac);}};}function respondWithFilteredResult(_0x1617b4,_0x5955da){return function(_0x47e4eb){if(_0x47e4eb){var _0xc436fb=typeof _0x5955da[_0x2ff9('0x2c')]==='undefined'&&typeof _0x5955da['limit']===_0x2ff9('0x2d');var _0x315790=_0x47e4eb[_0x2ff9('0x2e')];var _0xdb38b3=_0xc436fb?0x0:_0x5955da[_0x2ff9('0x2c')];var _0xbe1d7=_0xc436fb?_0x47e4eb[_0x2ff9('0x2e')]:_0x5955da[_0x2ff9('0x2c')]+_0x5955da[_0x2ff9('0x2f')];var _0x7c07f1;if(_0xbe1d7>=_0x315790){_0xbe1d7=_0x315790;_0x7c07f1=0xc8;}else{_0x7c07f1=0xce;}_0x1617b4[_0x2ff9('0x2b')](_0x7c07f1);return _0x1617b4[_0x2ff9('0x30')](_0x2ff9('0x31'),_0xdb38b3+'-'+_0xbe1d7+'/'+_0x315790)[_0x2ff9('0x32')](_0x47e4eb);}return null;};}function patchUpdates(_0x4b1554){return function(_0x5b7d87){try{jsonpatch[_0x2ff9('0x33')](_0x5b7d87,_0x4b1554,!![]);}catch(_0xd750db){return BPromise[_0x2ff9('0x34')](_0xd750db);}return _0x5b7d87[_0x2ff9('0x35')]();};}function saveUpdates(_0xbb34a5,_0x402d57){return function(_0x21dd13){if(_0x21dd13){return _0x21dd13[_0x2ff9('0x36')](_0xbb34a5)[_0x2ff9('0x37')](function(_0x221318){return _0x221318;});}return null;};}function removeEntity(_0x5cf170,_0x2905d6){return function(_0x20e701){if(_0x20e701){return _0x20e701[_0x2ff9('0x38')]()['then'](function(){_0x5cf170[_0x2ff9('0x2b')](0xcc)[_0x2ff9('0x2a')]();});}};}function handleEntityNotFound(_0x5583e2,_0x39152c){return function(_0x25043d){if(!_0x25043d){_0x5583e2['sendStatus'](0x194);}return _0x25043d;};}function handleError(_0x1f52bd,_0x3163ef){_0x3163ef=_0x3163ef||0x1f4;return function(_0x47b3ff){logger[_0x2ff9('0x26')](_0x47b3ff[_0x2ff9('0x39')]);if(_0x47b3ff['name']){delete _0x47b3ff['name'];}_0x1f52bd[_0x2ff9('0x2b')](_0x3163ef)[_0x2ff9('0x3a')](_0x47b3ff);};}exports[_0x2ff9('0x3b')]=function(_0x551f20,_0x261187){var _0x310123={},_0x502606={},_0x329154={'count':0x0,'rows':[]};var _0x5afafa=_[_0x2ff9('0x3c')](db[_0x2ff9('0x3d')][_0x2ff9('0x3e')],function(_0x529344){return{'name':_0x529344['fieldName'],'type':_0x529344[_0x2ff9('0x3f')]['key']};});_0x502606[_0x2ff9('0x40')]=_[_0x2ff9('0x3c')](_0x5afafa,_0x2ff9('0x41'));_0x502606[_0x2ff9('0x42')]=_[_0x2ff9('0x43')](_0x551f20['query']);_0x502606[_0x2ff9('0x44')]=_['intersection'](_0x502606[_0x2ff9('0x40')],_0x502606['query']);_0x310123['attributes']=_[_0x2ff9('0x45')](_0x502606[_0x2ff9('0x40')],qs['fields'](_0x551f20['query'][_0x2ff9('0x46')]));_0x310123[_0x2ff9('0x47')]=_0x310123[_0x2ff9('0x47')][_0x2ff9('0x48')]?_0x310123[_0x2ff9('0x47')]:_0x502606[_0x2ff9('0x40')];if(!_0x551f20[_0x2ff9('0x42')][_0x2ff9('0x49')](_0x2ff9('0x4a'))){_0x310123[_0x2ff9('0x2f')]=qs[_0x2ff9('0x2f')](_0x551f20[_0x2ff9('0x42')][_0x2ff9('0x2f')]);_0x310123[_0x2ff9('0x2c')]=qs[_0x2ff9('0x2c')](_0x551f20['query']['offset']);}_0x310123[_0x2ff9('0x4b')]=qs[_0x2ff9('0x4c')](_0x551f20[_0x2ff9('0x42')]['sort']);_0x310123['where']=qs[_0x2ff9('0x44')](_[_0x2ff9('0x4d')](_0x551f20['query'],_0x502606['filters']),_0x5afafa);if(_0x551f20[_0x2ff9('0x42')][_0x2ff9('0x4e')]){_0x310123['where']=_['merge'](_0x310123[_0x2ff9('0x4f')],{'$or':_[_0x2ff9('0x3c')](_0x5afafa,function(_0x1a8720){if(_0x1a8720[_0x2ff9('0x3f')]!=='VIRTUAL'){var _0x30bcde={};_0x30bcde[_0x1a8720['name']]={'$like':'%'+_0x551f20['query'][_0x2ff9('0x4e')]+'%'};return _0x30bcde;}})});}_0x310123=_[_0x2ff9('0x50')]({},_0x310123,_0x551f20[_0x2ff9('0x51')]);var _0x45229b={'where':_0x310123[_0x2ff9('0x4f')]};return db[_0x2ff9('0x3d')][_0x2ff9('0x2e')](_0x45229b)['then'](function(_0x402f19){_0x329154['count']=_0x402f19;if(_0x551f20['query'][_0x2ff9('0x52')]){_0x310123['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0x2ff9('0x53')](_0x310123);})[_0x2ff9('0x37')](function(_0x3a9e0d){_0x329154[_0x2ff9('0x54')]=_0x3a9e0d;return _0x329154;})[_0x2ff9('0x37')](respondWithFilteredResult(_0x261187,_0x310123))[_0x2ff9('0x29')](handleError(_0x261187,null));};exports[_0x2ff9('0x55')]=function(_0x4491ca,_0x2b947c){var _0x207a41={'raw':!![],'where':{'id':_0x4491ca[_0x2ff9('0x56')]['id']}},_0x575d7e={};_0x575d7e[_0x2ff9('0x40')]=_[_0x2ff9('0x43')](db[_0x2ff9('0x3d')][_0x2ff9('0x3e')]);_0x575d7e['query']=_[_0x2ff9('0x43')](_0x4491ca['query']);_0x575d7e['filters']=_[_0x2ff9('0x45')](_0x575d7e[_0x2ff9('0x40')],_0x575d7e[_0x2ff9('0x42')]);_0x207a41['attributes']=_[_0x2ff9('0x45')](_0x575d7e[_0x2ff9('0x40')],qs[_0x2ff9('0x46')](_0x4491ca[_0x2ff9('0x42')][_0x2ff9('0x46')]));_0x207a41[_0x2ff9('0x47')]=_0x207a41[_0x2ff9('0x47')][_0x2ff9('0x48')]?_0x207a41['attributes']:_0x575d7e[_0x2ff9('0x40')];if(_0x4491ca[_0x2ff9('0x42')][_0x2ff9('0x52')]){_0x207a41['include']=[{'all':!![]}];}_0x207a41=_[_0x2ff9('0x50')]({},_0x207a41,_0x4491ca[_0x2ff9('0x51')]);return db[_0x2ff9('0x3d')][_0x2ff9('0x57')](_0x207a41)[_0x2ff9('0x37')](handleEntityNotFound(_0x2b947c,null))[_0x2ff9('0x37')](respondWithResult(_0x2b947c,null))['catch'](handleError(_0x2b947c,null));};exports[_0x2ff9('0x58')]=function(_0x5a79cf,_0x470690){return db[_0x2ff9('0x3d')][_0x2ff9('0x58')](_0x5a79cf['body'],{})[_0x2ff9('0x37')](respondWithResult(_0x470690,0xc9))['catch'](handleError(_0x470690,null));};exports[_0x2ff9('0x36')]=function(_0x2e0abd,_0xc46797){if(_0x2e0abd['body']['id']){delete _0x2e0abd[_0x2ff9('0x59')]['id'];}return db[_0x2ff9('0x3d')][_0x2ff9('0x57')]({'where':{'id':_0x2e0abd[_0x2ff9('0x56')]['id']}})['then'](handleEntityNotFound(_0xc46797,null))['then'](saveUpdates(_0x2e0abd[_0x2ff9('0x59')],null))[_0x2ff9('0x37')](respondWithResult(_0xc46797,null))[_0x2ff9('0x29')](handleError(_0xc46797,null));};exports[_0x2ff9('0x38')]=function(_0x559123,_0x5330b5){return db[_0x2ff9('0x3d')][_0x2ff9('0x57')]({'where':{'id':_0x559123[_0x2ff9('0x56')]['id']}})[_0x2ff9('0x37')](handleEntityNotFound(_0x5330b5,null))[_0x2ff9('0x37')](removeEntity(_0x5330b5,null))[_0x2ff9('0x29')](handleError(_0x5330b5,null));};exports['describe']=function(_0x40dcab,_0x29d661){return db[_0x2ff9('0x3d')][_0x2ff9('0x5a')]()['then'](respondWithResult(_0x29d661,null))[_0x2ff9('0x29')](handleError(_0x29d661,null));};var interaction_log=require(_0x2ff9('0x14'))('whatsapp-interactions');exports['accept']=function(_0x4a113b,_0x563a74,_0x323c88){var _0x5ed130={'agent':{},'channel':_0x2ff9('0x5b')};if(_0x4a113b[_0x2ff9('0x59')]['id']){delete _0x4a113b[_0x2ff9('0x59')]['id'];}_0x4a113b[_0x2ff9('0x59')]['read']=!![];_0x4a113b[_0x2ff9('0x59')]['readAt']=moment()[_0x2ff9('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x4a113b[_0x2ff9('0x59')][_0x2ff9('0x5d')]=_0x4a113b['body'][_0x2ff9('0x5d')]||_0x4a113b[_0x2ff9('0x5e')]['id'];_0x5ed130[_0x2ff9('0x5f')]['id']=_0x4a113b[_0x2ff9('0x59')][_0x2ff9('0x5d')];return db['WhatsappMessage']['find']({'where':{'id':_0x4a113b['params']['id'],'UserId':null}})[_0x2ff9('0x37')](handleEntityNotFound(_0x563a74,null))[_0x2ff9('0x37')](saveUpdates(_0x4a113b['body'],null))[_0x2ff9('0x37')](function(_0x44a44b){if(_0x44a44b){_0x5ed130[_0x2ff9('0x28')]=_0x44a44b['get']({'plain':!![]});return db[_0x2ff9('0x60')][_0x2ff9('0x57')]({'where':{'id':_0x44a44b['WhatsappInteractionId']}});}return null;})[_0x2ff9('0x37')](handleEntityNotFound(_0x563a74,null))[_0x2ff9('0x37')](function(_0x1a3c1a){if(_0x1a3c1a){return _0x1a3c1a[_0x2ff9('0x36')]({'UserId':_0x4a113b[_0x2ff9('0x59')]['UserId'],'read1stAt':_[_0x2ff9('0x61')](_0x1a3c1a[_0x2ff9('0x62')])?moment()['format'](_0x2ff9('0x63')):undefined});}return null;})[_0x2ff9('0x37')](function(_0x4cc4ed){if(_0x4cc4ed){_0x5ed130['interaction']=_0x4cc4ed['get']({'plain':!![]});interaction_log[_0x2ff9('0x20')](_0x2ff9('0x64'),_0x4a113b[_0x2ff9('0x5e')]['id'],_0x4a113b[_0x2ff9('0x5e')]['name'],_0x4a113b[_0x2ff9('0x5e')][_0x2ff9('0x65')],_0x5ed130[_0x2ff9('0x66')]['id'],_0x4a113b[_0x2ff9('0x59')]?JSON['stringify'](_0x4a113b['body']):_0x2ff9('0x67'));return respondWithRpcPromise('AcceptMessage',_0x2ff9('0x68'),_0x5ed130);}return null;})[_0x2ff9('0x37')](function(_0x5f2935){var _0x4d7cc0=_0x2ff9('0x69')+_0x5f2935[_0x2ff9('0x28')][_0x2ff9('0x6a')];return db['sequelize'][_0x2ff9('0x42')](_0x4d7cc0,{'type':db[_0x2ff9('0x6b')][_0x2ff9('0x6c')][_0x2ff9('0x6d')],'raw':!![]})[_0x2ff9('0x37')](function(_0x437b7a){return _0x437b7a;});})[_0x2ff9('0x37')](function(_0x2c2960){if(_0x2c2960){_0x5ed130['message'][_0x2ff9('0x6e')]=_0x2c2960[0x0];if(!_0x4a113b[_0x2ff9('0x59')]['UserId'])return;return db[_0x2ff9('0x6f')][_0x2ff9('0x57')]({'where':{'id':_0x4a113b[_0x2ff9('0x59')]['UserId'],'role':_0x2ff9('0x5f')},'attributes':['id',_0x2ff9('0x41'),_0x2ff9('0x70'),_0x2ff9('0x71'),'internal'],'raw':!![]});}return null;})[_0x2ff9('0x37')](function(_0x1c5260){if(!_0x1c5260)return null;_0x5ed130[_0x2ff9('0x28')][_0x2ff9('0x5f')]=_0x1c5260;return _0x5ed130;})[_0x2ff9('0x37')](function(_0x1f06a5){if(_0x1f06a5){if(_0x4a113b[_0x2ff9('0x59')][_0x2ff9('0x72')]){_0x5ed130['message']['interface']=util[_0x2ff9('0x5c')](_0x2ff9('0x73'),_0x4a113b['user'][_0x2ff9('0x41')]);_0x5ed130[_0x2ff9('0x28')][_0x2ff9('0x74')]=_0x5ed130[_0x2ff9('0x74')];_0x5ed130[_0x2ff9('0x28')][_0x2ff9('0x75')]=_0x5ed130[_0x2ff9('0x74')];_0x5ed130[_0x2ff9('0x28')][_0x2ff9('0x76')]='accept';return respondWithRpcPromise(_0x2ff9('0x77'),_0x2ff9('0x77'),{'event':_0x2ff9('0x78'),'message':_0x5ed130[_0x2ff9('0x28')]},client9002)['then'](function(){return _0x5ed130;});}return _0x5ed130;}return null;})[_0x2ff9('0x37')](respondWithResult(_0x563a74,null))[_0x2ff9('0x29')](handleError(_0x563a74,null));};var interaction_log=require(_0x2ff9('0x14'))('whatsapp-interactions');exports[_0x2ff9('0x34')]=function(_0x179f1e,_0x3d4012,_0x4f887d){var _0x1fccd2={'agent':{},'channel':_0x2ff9('0x5b')};if(_0x179f1e[_0x2ff9('0x59')]['id']){delete _0x179f1e[_0x2ff9('0x59')]['id'];}_0x179f1e[_0x2ff9('0x59')][_0x2ff9('0x5d')]=_0x179f1e['body'][_0x2ff9('0x5d')]||_0x179f1e[_0x2ff9('0x5e')]['id'];_0x1fccd2['agent']['id']=_0x179f1e[_0x2ff9('0x59')][_0x2ff9('0x5d')];return db[_0x2ff9('0x3d')][_0x2ff9('0x57')]({'where':{'id':_0x179f1e[_0x2ff9('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3d4012,null))[_0x2ff9('0x37')](function(_0x5bc1bf){if(_0x5bc1bf){_0x1fccd2[_0x2ff9('0x28')]=_0x5bc1bf[_0x2ff9('0x79')]({'plain':!![]});return db[_0x2ff9('0x60')][_0x2ff9('0x57')]({'where':{'id':_0x5bc1bf['WhatsappInteractionId']}});}return null;})[_0x2ff9('0x37')](handleEntityNotFound(_0x3d4012,null))[_0x2ff9('0x37')](function(_0x40835b){if(_0x40835b){_0x1fccd2['interaction']=_0x40835b[_0x2ff9('0x79')]({'plain':!![]});interaction_log[_0x2ff9('0x20')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x179f1e['user']['id'],_0x179f1e[_0x2ff9('0x5e')]['name'],_0x179f1e['user'][_0x2ff9('0x65')],_0x1fccd2[_0x2ff9('0x66')]['id'],_0x179f1e['body']?JSON[_0x2ff9('0x25')](_0x179f1e['body']):_0x2ff9('0x67'));return respondWithRpcPromise(_0x2ff9('0x7a'),_0x2ff9('0x7b'),_0x1fccd2);}return null;})[_0x2ff9('0x37')](function(_0x209e5a){var _0x162108=_0x2ff9('0x69')+_0x209e5a['message'][_0x2ff9('0x6a')];return db[_0x2ff9('0x7c')]['query'](_0x162108,{'type':db[_0x2ff9('0x6b')]['QueryTypes'][_0x2ff9('0x6d')],'raw':!![]})['then'](function(_0x414b8b){return _0x414b8b;});})[_0x2ff9('0x37')](function(_0x4f680c){if(_0x4f680c){_0x1fccd2[_0x2ff9('0x28')][_0x2ff9('0x6e')]=_0x4f680c[0x0];if(!_0x179f1e['body'][_0x2ff9('0x5d')])return;return db[_0x2ff9('0x6f')][_0x2ff9('0x57')]({'where':{'id':_0x179f1e[_0x2ff9('0x59')][_0x2ff9('0x5d')],'role':_0x2ff9('0x5f')},'attributes':['id','name',_0x2ff9('0x70'),_0x2ff9('0x71'),_0x2ff9('0x7d')],'raw':!![]});}return null;})[_0x2ff9('0x37')](function(_0x2ba020){if(!_0x2ba020)return null;_0x1fccd2[_0x2ff9('0x28')]['agent']=_0x2ba020;return _0x1fccd2;})['then'](function(_0x1fadda){if(_0x1fadda){_0x1fadda[_0x2ff9('0x28')][_0x2ff9('0x7e')]=util['format'](_0x2ff9('0x73'),_0x179f1e[_0x2ff9('0x5e')][_0x2ff9('0x41')]);_0x1fadda[_0x2ff9('0x28')][_0x2ff9('0x74')]=_0x1fccd2['channel'];_0x1fadda[_0x2ff9('0x28')]['motionChannel']=_0x1fccd2[_0x2ff9('0x74')];_0x1fadda[_0x2ff9('0x28')][_0x2ff9('0x76')]='reject';respondWithRpcPromise('EventManager',_0x2ff9('0x77'),{'event':_0x2ff9('0x7f'),'message':_0x1fadda[_0x2ff9('0x28')]},client9002);return _0x1fccd2;}return null;})[_0x2ff9('0x37')](respondWithResult(_0x3d4012,null))[_0x2ff9('0x29')](handleError(_0x3d4012,null));};exports[_0x2ff9('0x2b')]=function(_0x51c232,_0x3ef30c,_0x1b121f){if(_0x51c232['body']['id']){delete _0x51c232['body']['id'];}var _0x19cbe6;return db[_0x2ff9('0x3d')][_0x2ff9('0x57')]({'where':{'id':_0x51c232[_0x2ff9('0x56')]['id']}})['then'](handleEntityNotFound(_0x3ef30c,null))[_0x2ff9('0x37')](function(_0x32ede2){if(_0x32ede2){_0x19cbe6=_0x32ede2;return db[_0x2ff9('0x80')][_0x2ff9('0x57')]({'where':{'id':_0x32ede2[_0x2ff9('0x81')]}});}})[_0x2ff9('0x37')](handleEntityNotFound(_0x3ef30c,null))[_0x2ff9('0x37')](function(_0x44cf97){if(_0x44cf97){logger[_0x2ff9('0x22')](_0x2ff9('0x82'),'status',_0x2ff9('0x83'),_0x44cf97['type'],util[_0x2ff9('0x84')](_0x51c232[_0x2ff9('0x59')],{'showHidden':![],'depth':null}));switch(_0x44cf97['type']){case _0x2ff9('0x85'):if(_0x51c232[_0x2ff9('0x59')][_0x2ff9('0x86')]&&_0x51c232[_0x2ff9('0x59')][_0x2ff9('0x86')]===_0x19cbe6[_0x2ff9('0x87')]&&_0x51c232[_0x2ff9('0x59')][_0x2ff9('0x88')]&&_0x51c232[_0x2ff9('0x59')][_0x2ff9('0x88')]==='read'){return _0x19cbe6[_0x2ff9('0x36')]({'read':!![]});}else{logger[_0x2ff9('0x26')](_0x2ff9('0x89'),_0x2ff9('0x2b'),_0x2ff9('0x85'),util[_0x2ff9('0x84')](_0x51c232[_0x2ff9('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x19cbe6;}})[_0x2ff9('0x37')](respondWithResult(_0x3ef30c,null))[_0x2ff9('0x29')](handleError(_0x3ef30c,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 654bc92..de04615 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 _0xb688=['../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x46939d,_0xc1b36d){var _0x5105e8=function(_0x536281){while(--_0x536281){_0x46939d['push'](_0x46939d['shift']());}};_0x5105e8(++_0xc1b36d);}(_0xb688,0xcf));var _0x8b68=function(_0xb23011,_0x1ba2fa){_0xb23011=_0xb23011-0x0;var _0x46a1bd=_0xb688[_0xb23011];return _0x46a1bd;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x8b68('0x0'))['db'][_0x8b68('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x8b68('0x2')](0x0);var events={'afterCreate':_0x8b68('0x3'),'afterUpdate':_0x8b68('0x4'),'afterDestroy':_0x8b68('0x5')};function emitEvent(_0x4e281c){return function(_0x41030e,_0x27925d,_0x30f33d){WhatsappMessageEvents[_0x8b68('0x6')](_0x4e281c+':'+_0x41030e['id'],_0x41030e);WhatsappMessageEvents['emit'](_0x4e281c,_0x41030e);_0x30f33d(null);};}for(var e in events){if(events[_0x8b68('0x7')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x8b68('0x8')]=WhatsappMessageEvents; \ No newline at end of file +var _0x4024=['hook','events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x1704d6,_0x2c4c8d){var _0x1651a6=function(_0x46c435){while(--_0x46c435){_0x1704d6['push'](_0x1704d6['shift']());}};_0x1651a6(++_0x2c4c8d);}(_0x4024,0x89));var _0x4402=function(_0x589bac,_0x56768a){_0x589bac=_0x589bac-0x0;var _0x26a374=_0x4024[_0x589bac];return _0x26a374;};'use strict';var EventEmitter=require(_0x4402('0x0'));var WhatsappMessage=require(_0x4402('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x4402('0x2')](0x0);var events={'afterCreate':_0x4402('0x3'),'afterUpdate':'update','afterDestroy':_0x4402('0x4')};function emitEvent(_0x47f001){return function(_0x950c82,_0x117f90,_0x5bdb3f){WhatsappMessageEvents['emit'](_0x47f001+':'+_0x950c82['id'],_0x950c82);WhatsappMessageEvents[_0x4402('0x5')](_0x47f001,_0x950c82);_0x5bdb3f(null);};}for(var e in events){if(events[_0x4402('0x6')](e)){var event=events[e];WhatsappMessage[_0x4402('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 3632a34..cb1df1e 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 _0x7dfd=['create','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','/whatsapp/v1/','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','error','find','WhatsappAccountId','type','twilio','authToken','accountSid'];(function(_0x545312,_0x563053){var _0x52bc56=function(_0x14a75d){while(--_0x14a75d){_0x545312['push'](_0x545312['shift']());}};_0x52bc56(++_0x563053);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var logger=require(_0xd7df('0x2'))(_0xd7df('0x3'));var moment=require(_0xd7df('0x4'));var BPromise=require(_0xd7df('0x5'));var rp=require(_0xd7df('0x6'));var fetch=require(_0xd7df('0x7'));var fs=require('fs');var path=require(_0xd7df('0x8'));var rimraf=require(_0xd7df('0x9'));var config=require(_0xd7df('0xa'));var attributes=require(_0xd7df('0xb'));module[_0xd7df('0xc')]=function(_0x39ce98,_0x354ea7){return _0x39ce98[_0xd7df('0xd')](_0xd7df('0xe'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xd7df('0xf'),'fields':[_0xd7df('0xf')]},{'name':_0xd7df('0x10'),'fields':[_0xd7df('0x11')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x32c5b5,_0x532c14,_0x183ace){var _0x567e83=_0x39ce98[_0xd7df('0x12')];var _0x82f1c0=_0x32c5b5[_0xd7df('0x13')]({'plain':!![]});if(_0x82f1c0[_0xd7df('0x14')][_0xd7df('0x15')]()==='in'||_0x82f1c0[_0xd7df('0x14')][_0xd7df('0x15')]()===_0xd7df('0x16')&&!_0x82f1c0[_0xd7df('0x17')]&&!_[_0xd7df('0x18')](_0x82f1c0[_0xd7df('0x19')])){_0x567e83[_0xd7df('0x1a')][_0xd7df('0x1b')]({'where':{'id':_0x82f1c0[_0xd7df('0x1c')]}})[_0xd7df('0x1d')](function(_0x202833){if(_0x202833){_0x202833[_0xd7df('0x1e')]({'lastMsgAt':_0x82f1c0['createdAt'],'lastMsgDirection':_0x82f1c0[_0xd7df('0x14')][_0xd7df('0x15')]()});}})['catch'](function(_0x18d38f){console[_0xd7df('0x1f')](_0x18d38f);});}if(_0x82f1c0['direction']===_0xd7df('0x16')&&!_0x82f1c0[_0xd7df('0x17')]){var _0x35e0a;_0x567e83['WhatsappAccount'][_0xd7df('0x20')]({'where':{'id':_0x82f1c0[_0xd7df('0x21')]},'raw':!![]})[_0xd7df('0x1d')](function(_0x5ba653){_0x35e0a=_0x5ba653;if(_0x35e0a&&_0x35e0a[_0xd7df('0x22')]){switch(_0x35e0a[_0xd7df('0x22')]){case _0xd7df('0x23'):var _0x5acb0a=require(_0xd7df('0x23'));if(_0x35e0a['accountSid']&&_0x35e0a[_0xd7df('0x24')]&&_0x35e0a['phone']){var _0x3ae7c3=new _0x5acb0a(_0x35e0a[_0xd7df('0x25')],_0x35e0a[_0xd7df('0x24')]);_0x3ae7c3['messages'][_0xd7df('0x26')]({'body':_0x82f1c0['body'],'to':_0xd7df('0x27')+_0x82f1c0[_0xd7df('0x28')],'from':_0xd7df('0x27')+_0x35e0a[_0xd7df('0x28')],'statusCallback':_0x35e0a[_0xd7df('0x29')]+_0xd7df('0x2a')+_0x82f1c0['id']+_0xd7df('0x2b')+_0x35e0a['token']})['then'](function(_0x36f2bd){if(_0x36f2bd[_0xd7df('0x2c')]){return _0x32c5b5[_0xd7df('0x1e')]({'messageId':_0x36f2bd[_0xd7df('0x2c')]});}})[_0xd7df('0x2d')](function(_0x11a4a8){logger[_0xd7df('0x1f')](_0xd7df('0x2e'),_0xd7df('0x2f'),'twilio',util[_0xd7df('0x30')](_0x11a4a8,{'showHidden':![],'depth':null}));});}else{logger[_0xd7df('0x1f')](_0xd7df('0x2e'),_0xd7df('0x2f'),_0xd7df('0x23'),_0xd7df('0x31'));}break;case _0xd7df('0x32'):var _0x36de76=_0x35e0a['accountSid'];var _0x4ba779=_0x35e0a['authToken'];var _0x58584d=_0x35e0a['baseUrl']+_0xd7df('0x33')+_0x36de76+'/messages/';var _0xd366b={'to':[_0x82f1c0[_0xd7df('0x28')]],'message':{'type':'text','text':_0x82f1c0[_0xd7df('0x11')]}};var _0x2887db={'method':'POST','uri':_0x58584d,'headers':{'Authorization':_0xd7df('0x34')+_0x4ba779,'Content-Type':_0xd7df('0x35')},'body':_0xd366b,'json':!![]};rp(_0x2887db)[_0xd7df('0x1d')](function(_0x3cf290){if(_0x3cf290[_0xd7df('0x36')][0x0][_0xd7df('0x37')]){return _0x32c5b5['update']({'messageId':_0x3cf290[_0xd7df('0x36')][0x0][_0xd7df('0x37')]});}})[_0xd7df('0x2d')](function(_0x1d81b2){logger[_0xd7df('0x38')](_0xd7df('0x39'),_0x1d81b2);});break;}}})[_0xd7df('0x3a')](function(){_0x183ace();});}else{_0x183ace();}}},'charset':_0xd7df('0x3b'),'collate':_0xd7df('0x3c')});}; \ No newline at end of file +var _0xf6da=['messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','update','createdAt','error','out','WhatsappAccount','WhatsappAccountId','then','type','twilio','accountSid','authToken','phone','whatsapp:','/api/whatsapp/messages/','token','sid','catch','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','/whatsapp/v1/','text','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','WhatsappMessage'];(function(_0x2c6c77,_0x516ae2){var _0x25a647=function(_0xf80a2c){while(--_0xf80a2c){_0x2c6c77['push'](_0x2c6c77['shift']());}};_0x25a647(++_0x516ae2);}(_0xf6da,0x65));var _0xaf6d=function(_0x26b8e4,_0x460f4f){_0x26b8e4=_0x26b8e4-0x0;var _0x24984b=_0xf6da[_0x26b8e4];return _0x24984b;};'use strict';var _=require(_0xaf6d('0x0'));var util=require(_0xaf6d('0x1'));var logger=require(_0xaf6d('0x2'))(_0xaf6d('0x3'));var moment=require(_0xaf6d('0x4'));var BPromise=require(_0xaf6d('0x5'));var rp=require(_0xaf6d('0x6'));var fetch=require(_0xaf6d('0x7'));var fs=require('fs');var path=require(_0xaf6d('0x8'));var rimraf=require(_0xaf6d('0x9'));var config=require(_0xaf6d('0xa'));var attributes=require(_0xaf6d('0xb'));module['exports']=function(_0x268e28,_0x3e97dc){return _0x268e28['define'](_0xaf6d('0xc'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xaf6d('0xd'),'fields':[_0xaf6d('0xd')]},{'name':_0xaf6d('0xe'),'fields':[_0xaf6d('0xf')],'type':_0xaf6d('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x459868,_0x583b20,_0x20aa96){var _0x5a6255=_0x268e28[_0xaf6d('0x11')];var _0x240f34=_0x459868[_0xaf6d('0x12')]({'plain':!![]});if(_0x240f34[_0xaf6d('0x13')][_0xaf6d('0x14')]()==='in'||_0x240f34['direction'][_0xaf6d('0x14')]()==='out'&&!_0x240f34[_0xaf6d('0x15')]&&!_[_0xaf6d('0x16')](_0x240f34[_0xaf6d('0x17')])){_0x5a6255[_0xaf6d('0x18')]['findOne']({'where':{'id':_0x240f34[_0xaf6d('0x19')]}})['then'](function(_0x570613){if(_0x570613){_0x570613[_0xaf6d('0x1a')]({'lastMsgAt':_0x240f34[_0xaf6d('0x1b')],'lastMsgDirection':_0x240f34[_0xaf6d('0x13')][_0xaf6d('0x14')]()});}})['catch'](function(_0x4feae1){console[_0xaf6d('0x1c')](_0x4feae1);});}if(_0x240f34[_0xaf6d('0x13')]===_0xaf6d('0x1d')&&!_0x240f34[_0xaf6d('0x15')]){var _0x53794f;_0x5a6255[_0xaf6d('0x1e')]['find']({'where':{'id':_0x240f34[_0xaf6d('0x1f')]},'raw':!![]})[_0xaf6d('0x20')](function(_0x312e4c){_0x53794f=_0x312e4c;if(_0x53794f&&_0x53794f[_0xaf6d('0x21')]){switch(_0x53794f['type']){case'twilio':var _0x2b4ac7=require(_0xaf6d('0x22'));if(_0x53794f[_0xaf6d('0x23')]&&_0x53794f[_0xaf6d('0x24')]&&_0x53794f[_0xaf6d('0x25')]){var _0x3ecebc=new _0x2b4ac7(_0x53794f['accountSid'],_0x53794f['authToken']);_0x3ecebc['messages']['create']({'body':_0x240f34[_0xaf6d('0xf')],'to':_0xaf6d('0x26')+_0x240f34[_0xaf6d('0x25')],'from':_0xaf6d('0x26')+_0x53794f['phone'],'statusCallback':_0x53794f['remote']+_0xaf6d('0x27')+_0x240f34['id']+'/status?token='+_0x53794f[_0xaf6d('0x28')]})[_0xaf6d('0x20')](function(_0x34a361){if(_0x34a361[_0xaf6d('0x29')]){return _0x459868['update']({'messageId':_0x34a361[_0xaf6d('0x29')]});}})[_0xaf6d('0x2a')](function(_0x247598){logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xaf6d('0x2b'),'twilio',util[_0xaf6d('0x2c')](_0x247598,{'showHidden':![],'depth':null}));});}else{logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xaf6d('0x2b'),_0xaf6d('0x22'),_0xaf6d('0x2d'));}break;case _0xaf6d('0x2e'):var _0x4e2694=_0x53794f['accountSid'];var _0xb4edde=_0x53794f[_0xaf6d('0x24')];var _0x12e672=_0x53794f['baseUrl']+_0xaf6d('0x2f')+_0x4e2694+'/messages/';var _0x170820={'to':[_0x240f34['phone']],'message':{'type':_0xaf6d('0x30'),'text':_0x240f34['body']}};var _0x4c8e27={'method':_0xaf6d('0x31'),'uri':_0x12e672,'headers':{'Authorization':_0xaf6d('0x32')+_0xb4edde,'Content-Type':_0xaf6d('0x33')},'body':_0x170820,'json':!![]};rp(_0x4c8e27)[_0xaf6d('0x20')](function(_0x577f89){if(_0x577f89[_0xaf6d('0x34')][0x0]['message_id']){return _0x459868[_0xaf6d('0x1a')]({'messageId':_0x577f89[_0xaf6d('0x34')][0x0][_0xaf6d('0x35')]});}})[_0xaf6d('0x2a')](function(_0x1b6d54){logger[_0xaf6d('0x36')](_0xaf6d('0x37'),_0x1b6d54);});break;}}})['finally'](function(){_0x20aa96();});}else{_0x20aa96();}}},'charset':'utf8mb4','collate':_0xaf6d('0x38')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 589ecf3..9c36449 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 _0x1d5f=['raw','CreateWhatsappMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','WhatsappMessage','create','body','options'];(function(_0x42942b,_0x45da73){var _0x3dd7f6=function(_0x1d7dd1){while(--_0x1d7dd1){_0x42942b['push'](_0x42942b['shift']());}};_0x3dd7f6(++_0x45da73);}(_0x1d5f,0xe2));var _0xf1d5=function(_0x1fdb40,_0x51351c){_0x1fdb40=_0x1fdb40-0x0;var _0x281f93=_0x1d5f[_0x1fdb40];return _0x281f93;};'use strict';var _=require(_0xf1d5('0x0'));var util=require(_0xf1d5('0x1'));var moment=require(_0xf1d5('0x2'));var BPromise=require(_0xf1d5('0x3'));var rs=require(_0xf1d5('0x4'));var fs=require('fs');var Redis=require(_0xf1d5('0x5'));var db=require(_0xf1d5('0x6'))['db'];var utils=require(_0xf1d5('0x7'));var logger=require(_0xf1d5('0x8'))(_0xf1d5('0x9'));var config=require('../../config/environment');var jayson=require(_0xf1d5('0xa'));var client=jayson[_0xf1d5('0xb')]['http']({'port':0x232a});config[_0xf1d5('0xc')]=_['defaults'](config[_0xf1d5('0xc')],{'host':_0xf1d5('0xd'),'port':0x18eb});var socket=require(_0xf1d5('0xe'))(new Redis(config['redis']));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x45de07,_0x7a67cb,_0x3d9e7c){return new BPromise(function(_0x3118de,_0x53b634){return client['request'](_0x45de07,_0x3d9e7c)[_0xf1d5('0xf')](function(_0x4c77ff){logger[_0xf1d5('0x10')](_0xf1d5('0x11'),_0x7a67cb,_0xf1d5('0x12'));logger[_0xf1d5('0x13')](_0xf1d5('0x14'),_0x7a67cb,'request\x20sent',JSON[_0xf1d5('0x15')](_0x4c77ff));if(_0x4c77ff['error']){if(_0x4c77ff[_0xf1d5('0x16')][_0xf1d5('0x17')]===0x1f4){logger[_0xf1d5('0x16')](_0xf1d5('0x11'),_0x7a67cb,_0x4c77ff[_0xf1d5('0x16')][_0xf1d5('0x18')]);return _0x53b634(_0x4c77ff[_0xf1d5('0x16')][_0xf1d5('0x18')]);}logger[_0xf1d5('0x16')](_0xf1d5('0x11'),_0x7a67cb,_0x4c77ff[_0xf1d5('0x16')]['message']);return _0x3118de(_0x4c77ff['error'][_0xf1d5('0x18')]);}else{logger[_0xf1d5('0x10')]('WhatsappMessage,\x20%s,\x20%s',_0x7a67cb,_0xf1d5('0x12'));_0x3118de(_0x4c77ff['result'][_0xf1d5('0x18')]);}})[_0xf1d5('0x19')](function(_0xc3312){logger[_0xf1d5('0x16')](_0xf1d5('0x11'),_0x7a67cb,_0xc3312);_0x53b634(_0xc3312);});});}exports['CreateWhatsappMessage']=function(_0x3bc19e){var _0x19ac3c=this;return new Promise(function(_0x42027d,_0x3f0710){return db[_0xf1d5('0x1a')][_0xf1d5('0x1b')](_0x3bc19e[_0xf1d5('0x1c')],{'raw':_0x3bc19e[_0xf1d5('0x1d')]?_0x3bc19e[_0xf1d5('0x1d')][_0xf1d5('0x1e')]===undefined?!![]:![]:!![]})[_0xf1d5('0xf')](function(_0xeff38b){logger[_0xf1d5('0x10')]('CreateWhatsappMessage',_0x3bc19e);logger[_0xf1d5('0x13')](_0xf1d5('0x1f'),_0x3bc19e,JSON[_0xf1d5('0x15')](_0xeff38b));_0x42027d(_0xeff38b);})[_0xf1d5('0x19')](function(_0x47c17b){logger[_0xf1d5('0x16')](_0xf1d5('0x1f'),_0x47c17b[_0xf1d5('0x18')],_0x3bc19e);_0x3f0710(_0x19ac3c['error'](0x1f4,_0x47c17b['message']));});});}; \ No newline at end of file +var _0x19be=['request','then','WhatsappMessage,\x20%s,\x20%s','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','WhatsappMessage','create','body','options','raw','CreateWhatsappMessage','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','socket.io-emitter','./whatsappMessage.socket','register'];(function(_0x5cc735,_0x5786bd){var _0x8c1101=function(_0x1ed0ea){while(--_0x1ed0ea){_0x5cc735['push'](_0x5cc735['shift']());}};_0x8c1101(++_0x5786bd);}(_0x19be,0x15b));var _0xe19b=function(_0x351fc0,_0x3e6594){_0x351fc0=_0x351fc0-0x0;var _0x277585=_0x19be[_0x351fc0];return _0x277585;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe19b('0x0'));var BPromise=require(_0xe19b('0x1'));var rs=require(_0xe19b('0x2'));var fs=require('fs');var Redis=require(_0xe19b('0x3'));var db=require(_0xe19b('0x4'))['db'];var utils=require(_0xe19b('0x5'));var logger=require(_0xe19b('0x6'))('rpc');var config=require(_0xe19b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe19b('0x8')]['http']({'port':0x232a});config[_0xe19b('0x9')]=_['defaults'](config[_0xe19b('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xe19b('0xa'))(new Redis(config[_0xe19b('0x9')]));require(_0xe19b('0xb'))[_0xe19b('0xc')](socket);function respondWithRpcPromise(_0x2f1417,_0x592227,_0x5b0db7){return new BPromise(function(_0x1dd2b2,_0x5b549b){return client[_0xe19b('0xd')](_0x2f1417,_0x5b0db7)[_0xe19b('0xe')](function(_0x5a00ee){logger['info'](_0xe19b('0xf'),_0x592227,'request\x20sent');logger['debug'](_0xe19b('0x10'),_0x592227,'request\x20sent',JSON[_0xe19b('0x11')](_0x5a00ee));if(_0x5a00ee[_0xe19b('0x12')]){if(_0x5a00ee[_0xe19b('0x12')]['code']===0x1f4){logger[_0xe19b('0x12')](_0xe19b('0xf'),_0x592227,_0x5a00ee[_0xe19b('0x12')][_0xe19b('0x13')]);return _0x5b549b(_0x5a00ee[_0xe19b('0x12')]['message']);}logger[_0xe19b('0x12')](_0xe19b('0xf'),_0x592227,_0x5a00ee[_0xe19b('0x12')][_0xe19b('0x13')]);return _0x1dd2b2(_0x5a00ee[_0xe19b('0x12')][_0xe19b('0x13')]);}else{logger[_0xe19b('0x14')](_0xe19b('0xf'),_0x592227,_0xe19b('0x15'));_0x1dd2b2(_0x5a00ee[_0xe19b('0x16')]['message']);}})[_0xe19b('0x17')](function(_0x5a6d57){logger[_0xe19b('0x12')](_0xe19b('0xf'),_0x592227,_0x5a6d57);_0x5b549b(_0x5a6d57);});});}exports['CreateWhatsappMessage']=function(_0x1e92c3){var _0x535367=this;return new Promise(function(_0x5b80c2,_0x50aa1c){return db[_0xe19b('0x18')][_0xe19b('0x19')](_0x1e92c3[_0xe19b('0x1a')],{'raw':_0x1e92c3[_0xe19b('0x1b')]?_0x1e92c3['options'][_0xe19b('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x215080){logger['info']('CreateWhatsappMessage',_0x1e92c3);logger['debug'](_0xe19b('0x1d'),_0x1e92c3,JSON[_0xe19b('0x11')](_0x215080));_0x5b80c2(_0x215080);})[_0xe19b('0x17')](function(_0x521082){logger[_0xe19b('0x12')](_0xe19b('0x1d'),_0x521082[_0xe19b('0x13')],_0x1e92c3);_0x50aa1c(_0x535367['error'](0x1f4,_0x521082[_0xe19b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 99fc453..864e487 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 _0x2295=['./whatsappMessage.events','save','register','length','whatsappMessage:'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2295,0x1bd));var _0x5229=function(_0x5c2ccb,_0x1b48cf){_0x5c2ccb=_0x5c2ccb-0x0;var _0x2835aa=_0x2295[_0x5c2ccb];return _0x2835aa;};'use strict';var WhatsappMessageEvents=require(_0x5229('0x0'));var events=[_0x5229('0x1'),'remove','update'];function createListener(_0x1f682f,_0xb84554){return function(_0x5db086){_0xb84554['emit'](_0x1f682f,_0x5db086);};}function removeListener(_0x131914,_0x342551){return function(){WhatsappMessageEvents['removeListener'](_0x131914,_0x342551);};}exports[_0x5229('0x2')]=function(_0x1d5098){for(var _0x297d14=0x0,_0x15ab4c=events[_0x5229('0x3')];_0x297d14<_0x15ab4c;_0x297d14++){var _0x37de70=events[_0x297d14];var _0x2e5892=createListener(_0x5229('0x4')+_0x37de70,_0x1d5098);WhatsappMessageEvents['on'](_0x37de70,_0x2e5892);}}; \ No newline at end of file +var _0xd11c=['emit','removeListener','whatsappMessage:'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xd11c,0x1ef));var _0xcd11=function(_0x25f28b,_0x4a11b0){_0x25f28b=_0x25f28b-0x0;var _0x3b7411=_0xd11c[_0x25f28b];return _0x3b7411;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=['save','remove','update'];function createListener(_0x52e498,_0x1d1461){return function(_0x307eaa){_0x1d1461[_0xcd11('0x0')](_0x52e498,_0x307eaa);};}function removeListener(_0x5565a9,_0x27129c){return function(){WhatsappMessageEvents[_0xcd11('0x1')](_0x5565a9,_0x27129c);};}exports['register']=function(_0x4d78d1){for(var _0x3ae954=0x0,_0x2caecd=events['length'];_0x3ae954<_0x2caecd;_0x3ae954++){var _0x1b54aa=events[_0x3ae954];var _0x2ddd92=createListener(_0xcd11('0x2')+_0x1b54aa,_0x4d78d1);WhatsappMessageEvents['on'](_0x1b54aa,_0x2ddd92);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 63cdace..039ac41 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 _0xed0c=['/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','put','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','getTeams'];(function(_0x5b2b7b,_0x2ac3d7){var _0x27f857=function(_0x2e55df){while(--_0x2e55df){_0x5b2b7b['push'](_0x5b2b7b['shift']());}};_0x27f857(++_0x2ac3d7);}(_0xed0c,0xc5));var _0xced0=function(_0x4d2f55,_0x400b07){_0x4d2f55=_0x4d2f55-0x0;var _0x2ac704=_0xed0c[_0x4d2f55];return _0x2ac704;};'use strict';var multer=require(_0xced0('0x0'));var util=require(_0xced0('0x1'));var path=require(_0xced0('0x2'));var timeout=require(_0xced0('0x3'));var express=require(_0xced0('0x4'));var router=express[_0xced0('0x5')]();var fs_extra=require(_0xced0('0x6'));var auth=require(_0xced0('0x7'));var interaction=require(_0xced0('0x8'));var config=require(_0xced0('0x9'));var controller=require(_0xced0('0xa'));router[_0xced0('0xb')]('/',auth[_0xced0('0xc')](),controller['index']);router['get'](_0xced0('0xd'),auth[_0xced0('0xc')](),controller[_0xced0('0xe')]);router[_0xced0('0xb')](_0xced0('0xf'),auth[_0xced0('0xc')](),controller[_0xced0('0x10')]);router['get'](_0xced0('0x11'),auth[_0xced0('0xc')](),controller[_0xced0('0x12')]);router[_0xced0('0xb')]('/:id/teams',auth[_0xced0('0xc')](),controller[_0xced0('0x13')]);router[_0xced0('0xb')](_0xced0('0x14'),auth[_0xced0('0xc')](),controller[_0xced0('0x15')]);router['post']('/',auth[_0xced0('0xc')](),controller['create']);router[_0xced0('0x16')](_0xced0('0x17'),auth[_0xced0('0xc')](),controller[_0xced0('0x18')]);router['post']('/:id/users',auth[_0xced0('0xc')](),controller[_0xced0('0x19')]);router[_0xced0('0x1a')](_0xced0('0xf'),auth[_0xced0('0xc')](),controller['update']);router['delete']('/:id',auth[_0xced0('0xc')](),controller['destroy']);router[_0xced0('0x1b')]('/:id/teams',auth[_0xced0('0xc')](),controller[_0xced0('0x1c')]);router[_0xced0('0x1b')](_0xced0('0x14'),auth['isAuthenticated'](),controller[_0xced0('0x1d')]);module[_0xced0('0x1e')]=router; \ No newline at end of file +var _0x155f=['/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','describe','/:id','show','getMembers'];(function(_0x2aa060,_0x5e3fb9){var _0x3306cc=function(_0x24aafe){while(--_0x24aafe){_0x2aa060['push'](_0x2aa060['shift']());}};_0x3306cc(++_0x5e3fb9);}(_0x155f,0x85));var _0xf155=function(_0x4bf643,_0x4ce13b){_0x4bf643=_0x4bf643-0x0;var _0x183cd0=_0x155f[_0x4bf643];return _0x183cd0;};'use strict';var multer=require(_0xf155('0x0'));var util=require(_0xf155('0x1'));var path=require(_0xf155('0x2'));var timeout=require('connect-timeout');var express=require(_0xf155('0x3'));var router=express[_0xf155('0x4')]();var fs_extra=require(_0xf155('0x5'));var auth=require(_0xf155('0x6'));var interaction=require(_0xf155('0x7'));var config=require(_0xf155('0x8'));var controller=require(_0xf155('0x9'));router[_0xf155('0xa')]('/',auth[_0xf155('0xb')](),controller[_0xf155('0xc')]);router[_0xf155('0xa')]('/describe',auth[_0xf155('0xb')](),controller[_0xf155('0xd')]);router[_0xf155('0xa')](_0xf155('0xe'),auth[_0xf155('0xb')](),controller[_0xf155('0xf')]);router[_0xf155('0xa')]('/:id/members',auth[_0xf155('0xb')](),controller[_0xf155('0x10')]);router[_0xf155('0xa')](_0xf155('0x11'),auth['isAuthenticated'](),controller[_0xf155('0x12')]);router[_0xf155('0xa')](_0xf155('0x13'),auth[_0xf155('0xb')](),controller[_0xf155('0x14')]);router[_0xf155('0x15')]('/',auth['isAuthenticated'](),controller[_0xf155('0x16')]);router[_0xf155('0x15')](_0xf155('0x11'),auth['isAuthenticated'](),controller[_0xf155('0x17')]);router[_0xf155('0x15')](_0xf155('0x13'),auth[_0xf155('0xb')](),controller['addAgents']);router[_0xf155('0x18')](_0xf155('0xe'),auth[_0xf155('0xb')](),controller['update']);router[_0xf155('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xf155('0x1a')]);router[_0xf155('0x19')](_0xf155('0x11'),auth[_0xf155('0xb')](),controller[_0xf155('0x1b')]);router[_0xf155('0x19')](_0xf155('0x13'),auth[_0xf155('0xb')](),controller[_0xf155('0x1c')]);module[_0xf155('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 6aa38ac..a8791c6 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 _0xccdc=['rrmemory','beepall','roundrobin','STRING','sequelize','exports','INTEGER','ENUM'];(function(_0x31f72f,_0x11be2d){var _0x3c0d1e=function(_0x4185e7){while(--_0x4185e7){_0x31f72f['push'](_0x31f72f['shift']());}};_0x3c0d1e(++_0x11be2d);}(_0xccdc,0x1c4));var _0xcccd=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0xccdc[_0x2df507];return _0x1f7167;};'use strict';var Sequelize=require(_0xcccd('0x0'));module[_0xcccd('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xcccd('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcccd('0x3')](_0xcccd('0x4'),_0xcccd('0x5'),_0xcccd('0x6'))},'description':{'type':Sequelize[_0xcccd('0x7')]}}; \ No newline at end of file +var _0x4de7=['rrmemory','roundrobin','sequelize','STRING','name','INTEGER','ENUM'];(function(_0x2afffb,_0x52f011){var _0x3a0a8b=function(_0x16674b){while(--_0x16674b){_0x2afffb['push'](_0x2afffb['shift']());}};_0x3a0a8b(++_0x52f011);}(_0x4de7,0x1f3));var _0x74de=function(_0x1ba6ba,_0xad4992){_0x1ba6ba=_0x1ba6ba-0x0;var _0x2749c9=_0x4de7[_0x1ba6ba];return _0x2749c9;};'use strict';var Sequelize=require(_0x74de('0x0'));module['exports']={'name':{'type':Sequelize[_0x74de('0x1')],'unique':_0x74de('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x74de('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x74de('0x4')](_0x74de('0x5'),'beepall',_0x74de('0x6'))},'description':{'type':Sequelize[_0x74de('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index a20ccd8..4de1989 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 _0xf6ab=['ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','WhatsappQueues','sendStatus','error','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','params','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserWhatsappQueue','pick','WhatsappQueueId','agent','whatsappPause','updatedAt','createdAt','rows','format','%s/%s','SIP','findOne','getTeams','ids','Team','Agents','online','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','select','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','userWhatsappQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse'];(function(_0x496366,_0x451cb2){var _0x2df64c=function(_0x123202){while(--_0x123202){_0x496366['push'](_0x496366['shift']());}};_0x2df64c(++_0x451cb2);}(_0xf6ab,0x116));var _0xbf6a=function(_0x99405,_0x1040e7){_0x99405=_0x99405-0x0;var _0x4e354a=_0xf6ab[_0x99405];return _0x4e354a;};'use strict';var emlformat=require(_0xbf6a('0x0'));var rimraf=require(_0xbf6a('0x1'));var zipdir=require(_0xbf6a('0x2'));var jsonpatch=require(_0xbf6a('0x3'));var rp=require(_0xbf6a('0x4'));var moment=require(_0xbf6a('0x5'));var BPromise=require(_0xbf6a('0x6'));var Mustache=require(_0xbf6a('0x7'));var util=require(_0xbf6a('0x8'));var path=require(_0xbf6a('0x9'));var sox=require(_0xbf6a('0xa'));var csv=require('to-csv');var ejs=require(_0xbf6a('0xb'));var fs=require('fs');var fs_extra=require(_0xbf6a('0xc'));var _=require(_0xbf6a('0xd'));var squel=require(_0xbf6a('0xe'));var crypto=require(_0xbf6a('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xbf6a('0x10'));var toCsv=require(_0xbf6a('0x11'));var querystring=require(_0xbf6a('0x12'));var Papa=require(_0xbf6a('0x13'));var Redis=require(_0xbf6a('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbf6a('0x15'));var hardwareService=require(_0xbf6a('0x16'));var logger=require(_0xbf6a('0x17'))(_0xbf6a('0x18'));var utils=require(_0xbf6a('0x19'));var config=require(_0xbf6a('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xbf6a('0x1b'))['db'];config[_0xbf6a('0x1c')]=_['defaults'](config[_0xbf6a('0x1c')],{'host':_0xbf6a('0x1d'),'port':0x18eb});var socket=require(_0xbf6a('0x1e'))(new Redis(config[_0xbf6a('0x1c')]));require('./whatsappQueue.socket')[_0xbf6a('0x1f')](socket);function respondWithStatusCode(_0x140404,_0x4dc7f5){_0x4dc7f5=_0x4dc7f5||0xcc;return function(_0xe45142){if(_0xe45142){return _0x140404['sendStatus'](_0x4dc7f5);}return _0x140404[_0xbf6a('0x20')](_0x4dc7f5)[_0xbf6a('0x21')]();};}function respondWithResult(_0x3221bd,_0x17e319){_0x17e319=_0x17e319||0xc8;return function(_0x279585){if(_0x279585){return _0x3221bd[_0xbf6a('0x20')](_0x17e319)[_0xbf6a('0x22')](_0x279585);}};}function respondWithFilteredResult(_0x22f2f9,_0x19b168){return function(_0x3a87fd){if(_0x3a87fd){var _0x4da73d=typeof _0x19b168[_0xbf6a('0x23')]===_0xbf6a('0x24')&&typeof _0x19b168[_0xbf6a('0x25')]==='undefined';var _0x2d3297=_0x3a87fd[_0xbf6a('0x26')];var _0xbbd2f2=_0x4da73d?0x0:_0x19b168[_0xbf6a('0x23')];var _0x5efe13=_0x4da73d?_0x3a87fd[_0xbf6a('0x26')]:_0x19b168[_0xbf6a('0x23')]+_0x19b168[_0xbf6a('0x25')];var _0x14d5fa;if(_0x5efe13>=_0x2d3297){_0x5efe13=_0x2d3297;_0x14d5fa=0xc8;}else{_0x14d5fa=0xce;}_0x22f2f9['status'](_0x14d5fa);return _0x22f2f9[_0xbf6a('0x27')](_0xbf6a('0x28'),_0xbbd2f2+'-'+_0x5efe13+'/'+_0x2d3297)[_0xbf6a('0x22')](_0x3a87fd);}return null;};}function patchUpdates(_0x550cbe){return function(_0x19f84f){try{jsonpatch[_0xbf6a('0x29')](_0x19f84f,_0x550cbe,!![]);}catch(_0x193e75){return BPromise[_0xbf6a('0x2a')](_0x193e75);}return _0x19f84f['save']();};}function saveUpdates(_0x4acba8,_0x4ddd65){return function(_0x38bff8){if(_0x38bff8){return _0x38bff8[_0xbf6a('0x2b')](_0x4acba8)[_0xbf6a('0x2c')](function(_0x48cb86){return _0x48cb86;});}return null;};}function removeEntity(_0x55d722,_0x38a889){return function(_0xc0c762){if(_0xc0c762){return _0xc0c762[_0xbf6a('0x2d')]()[_0xbf6a('0x2c')](function(){var _0xf6bca6=_0xc0c762[_0xbf6a('0x2e')]({'plain':!![]});var _0x4d88d5=_0xbf6a('0x2f');return db['UserProfileResource'][_0xbf6a('0x2d')]({'where':{'type':_0x4d88d5,'resourceId':_0xf6bca6['id']}})[_0xbf6a('0x2c')](function(){return _0xc0c762;});})[_0xbf6a('0x2c')](function(){_0x55d722['status'](0xcc)[_0xbf6a('0x21')]();});}};}function handleEntityNotFound(_0x5b8257,_0x2a5dbb){return function(_0x58f7a8){if(!_0x58f7a8){_0x5b8257[_0xbf6a('0x30')](0x194);}return _0x58f7a8;};}function handleError(_0x2b9e0f,_0x373160){_0x373160=_0x373160||0x1f4;return function(_0x4923ed){logger[_0xbf6a('0x31')](_0x4923ed['stack']);if(_0x4923ed[_0xbf6a('0x32')]){delete _0x4923ed['name'];}_0x2b9e0f[_0xbf6a('0x20')](_0x373160)[_0xbf6a('0x33')](_0x4923ed);};}exports[_0xbf6a('0x34')]=function(_0x1791bf,_0x13744d){var _0x2ce31f={},_0x525d8c={},_0x416a03={'count':0x0,'rows':[]};var _0x494a0e=_[_0xbf6a('0x35')](db[_0xbf6a('0x36')][_0xbf6a('0x37')],function(_0x5732e2){return{'name':_0x5732e2[_0xbf6a('0x38')],'type':_0x5732e2['type'][_0xbf6a('0x39')]};});_0x525d8c['model']=_['map'](_0x494a0e,_0xbf6a('0x32'));_0x525d8c[_0xbf6a('0x3a')]=_[_0xbf6a('0x3b')](_0x1791bf['query']);_0x525d8c[_0xbf6a('0x3c')]=_[_0xbf6a('0x3d')](_0x525d8c['model'],_0x525d8c[_0xbf6a('0x3a')]);_0x2ce31f[_0xbf6a('0x3e')]=_[_0xbf6a('0x3d')](_0x525d8c[_0xbf6a('0x3f')],qs[_0xbf6a('0x40')](_0x1791bf[_0xbf6a('0x3a')][_0xbf6a('0x40')]));_0x2ce31f[_0xbf6a('0x3e')]=_0x2ce31f[_0xbf6a('0x3e')][_0xbf6a('0x41')]?_0x2ce31f[_0xbf6a('0x3e')]:_0x525d8c['model'];if(!_0x1791bf['query'][_0xbf6a('0x42')](_0xbf6a('0x43'))){_0x2ce31f[_0xbf6a('0x25')]=qs[_0xbf6a('0x25')](_0x1791bf[_0xbf6a('0x3a')]['limit']);_0x2ce31f['offset']=qs[_0xbf6a('0x23')](_0x1791bf[_0xbf6a('0x3a')]['offset']);}_0x2ce31f[_0xbf6a('0x44')]=qs[_0xbf6a('0x45')](_0x1791bf[_0xbf6a('0x3a')][_0xbf6a('0x45')]);_0x2ce31f[_0xbf6a('0x46')]=qs['filters'](_['pick'](_0x1791bf[_0xbf6a('0x3a')],_0x525d8c[_0xbf6a('0x3c')]),_0x494a0e);if(_0x1791bf[_0xbf6a('0x3a')][_0xbf6a('0x47')]){_0x2ce31f[_0xbf6a('0x46')]=_['merge'](_0x2ce31f[_0xbf6a('0x46')],{'$or':_[_0xbf6a('0x35')](_0x494a0e,function(_0x49a3b8){if(_0x49a3b8[_0xbf6a('0x48')]!==_0xbf6a('0x49')){var _0x2b55ba={};_0x2b55ba[_0x49a3b8[_0xbf6a('0x32')]]={'$like':'%'+_0x1791bf[_0xbf6a('0x3a')]['filter']+'%'};return _0x2b55ba;}})});}_0x2ce31f=_[_0xbf6a('0x4a')]({},_0x2ce31f,_0x1791bf[_0xbf6a('0x4b')]);var _0x441e76={'where':_0x2ce31f[_0xbf6a('0x46')]};return db[_0xbf6a('0x36')][_0xbf6a('0x26')](_0x441e76)[_0xbf6a('0x2c')](function(_0x514268){_0x416a03[_0xbf6a('0x26')]=_0x514268;if(_0x1791bf[_0xbf6a('0x3a')][_0xbf6a('0x4c')]){_0x2ce31f[_0xbf6a('0x4d')]=[{'all':!![]}];}return db[_0xbf6a('0x36')][_0xbf6a('0x4e')](_0x2ce31f);})[_0xbf6a('0x2c')](function(_0x498657){_0x416a03['rows']=_0x498657;return _0x416a03;})[_0xbf6a('0x2c')](respondWithFilteredResult(_0x13744d,_0x2ce31f))['catch'](handleError(_0x13744d,null));};exports['show']=function(_0x315de4,_0x3c6b7f){var _0x5c95b5={'raw':!![],'where':{'id':_0x315de4[_0xbf6a('0x4f')]['id']}},_0x521d3a={};_0x521d3a[_0xbf6a('0x3f')]=_[_0xbf6a('0x3b')](db[_0xbf6a('0x36')][_0xbf6a('0x37')]);_0x521d3a[_0xbf6a('0x3a')]=_[_0xbf6a('0x3b')](_0x315de4[_0xbf6a('0x3a')]);_0x521d3a[_0xbf6a('0x3c')]=_[_0xbf6a('0x3d')](_0x521d3a[_0xbf6a('0x3f')],_0x521d3a[_0xbf6a('0x3a')]);_0x5c95b5[_0xbf6a('0x3e')]=_[_0xbf6a('0x3d')](_0x521d3a[_0xbf6a('0x3f')],qs['fields'](_0x315de4[_0xbf6a('0x3a')][_0xbf6a('0x40')]));_0x5c95b5[_0xbf6a('0x3e')]=_0x5c95b5[_0xbf6a('0x3e')][_0xbf6a('0x41')]?_0x5c95b5[_0xbf6a('0x3e')]:_0x521d3a[_0xbf6a('0x3f')];if(_0x315de4[_0xbf6a('0x3a')]['includeAll']){_0x5c95b5[_0xbf6a('0x4d')]=[{'all':!![]}];}_0x5c95b5=_['merge']({},_0x5c95b5,_0x315de4[_0xbf6a('0x4b')]);return db[_0xbf6a('0x36')][_0xbf6a('0x50')](_0x5c95b5)[_0xbf6a('0x2c')](handleEntityNotFound(_0x3c6b7f,null))[_0xbf6a('0x2c')](respondWithResult(_0x3c6b7f,null))[_0xbf6a('0x51')](handleError(_0x3c6b7f,null));};exports[_0xbf6a('0x52')]=function(_0x5e428b,_0x187603){return db[_0xbf6a('0x36')][_0xbf6a('0x52')](_0x5e428b[_0xbf6a('0x53')],{})['then'](function(_0xa27c4b){var _0x2ccd5f=_0x5e428b['user']['get']({'plain':!![]});if(!_0x2ccd5f)throw new Error(_0xbf6a('0x54'));if(_0x2ccd5f[_0xbf6a('0x55')]===_0xbf6a('0x56')){var _0x12d0b7=_0xa27c4b[_0xbf6a('0x2e')]({'plain':!![]});var _0x1fcd1c='WhatsappQueues';return db[_0xbf6a('0x57')][_0xbf6a('0x50')]({'where':{'name':_0x1fcd1c,'userProfileId':_0x2ccd5f[_0xbf6a('0x58')]},'raw':!![]})[_0xbf6a('0x2c')](function(_0x320a8b){if(_0x320a8b&&_0x320a8b[_0xbf6a('0x59')]===0x0){return db[_0xbf6a('0x5a')][_0xbf6a('0x52')]({'name':_0x12d0b7['name'],'resourceId':_0x12d0b7['id'],'type':_0x320a8b['name'],'sectionId':_0x320a8b['id']},{})[_0xbf6a('0x2c')](function(){return _0xa27c4b;});}else{return _0xa27c4b;}})[_0xbf6a('0x51')](function(_0x282402){logger[_0xbf6a('0x31')](_0xbf6a('0x5b'),_0x282402);throw _0x282402;});}return _0xa27c4b;})['then'](respondWithResult(_0x187603,0xc9))['catch'](handleError(_0x187603,null));};exports[_0xbf6a('0x2b')]=function(_0x39b063,_0x338320){if(_0x39b063[_0xbf6a('0x53')]['id']){delete _0x39b063['body']['id'];}return db[_0xbf6a('0x36')][_0xbf6a('0x50')]({'where':{'id':_0x39b063[_0xbf6a('0x4f')]['id']}})[_0xbf6a('0x2c')](handleEntityNotFound(_0x338320,null))['then'](saveUpdates(_0x39b063[_0xbf6a('0x53')],null))[_0xbf6a('0x2c')](respondWithResult(_0x338320,null))[_0xbf6a('0x51')](handleError(_0x338320,null));};exports['destroy']=function(_0xa50461,_0x19ef4b){return db['WhatsappQueue'][_0xbf6a('0x50')]({'where':{'id':_0xa50461['params']['id']}})[_0xbf6a('0x2c')](handleEntityNotFound(_0x19ef4b,null))[_0xbf6a('0x2c')](removeEntity(_0x19ef4b,null))[_0xbf6a('0x51')](handleError(_0x19ef4b,null));};exports[_0xbf6a('0x5c')]=function(_0x166dcd,_0x11cfad){return db['WhatsappQueue'][_0xbf6a('0x5c')]()[_0xbf6a('0x2c')](respondWithResult(_0x11cfad,null))['catch'](handleError(_0x11cfad,null));};exports[_0xbf6a('0x5d')]=function(_0x6581f2,_0x16cfe5,_0x42219e){var _0x11c15a={'raw':!![],'where':{}},_0x479bf8={},_0x7e9797;return db[_0xbf6a('0x36')]['findOne']({'where':{'id':_0x6581f2['params']['id']}})[_0xbf6a('0x2c')](handleEntityNotFound(_0x16cfe5,null))[_0xbf6a('0x2c')](function(_0x472671){if(_0x472671){_0x7e9797=_0x472671['get']({'plain':!![]});_0x479bf8[_0xbf6a('0x3f')]=_[_0xbf6a('0x3b')](db[_0xbf6a('0x5e')][_0xbf6a('0x37')]);_0x479bf8['query']=_['keys'](_0x6581f2[_0xbf6a('0x3a')]);_0x479bf8['filters']=_[_0xbf6a('0x3d')](_0x479bf8[_0xbf6a('0x3f')],_0x479bf8[_0xbf6a('0x3a')]);_0x11c15a['attributes']=_[_0xbf6a('0x3d')](_0x479bf8[_0xbf6a('0x3f')],qs['fields'](_0x6581f2[_0xbf6a('0x3a')]['fields']));_0x11c15a['attributes']=_0x11c15a[_0xbf6a('0x3e')][_0xbf6a('0x41')]?_0x11c15a[_0xbf6a('0x3e')]:_0x479bf8['model'];if(!_0x6581f2['query']['hasOwnProperty']('nolimit')){_0x11c15a[_0xbf6a('0x25')]=qs[_0xbf6a('0x25')](_0x6581f2['query'][_0xbf6a('0x25')]);_0x11c15a['offset']=qs[_0xbf6a('0x23')](_0x6581f2[_0xbf6a('0x3a')][_0xbf6a('0x23')]);}_0x11c15a[_0xbf6a('0x44')]=qs['sort'](_0x6581f2[_0xbf6a('0x3a')]['sort']);_0x11c15a[_0xbf6a('0x46')]=qs['filters'](_[_0xbf6a('0x5f')](_0x6581f2[_0xbf6a('0x3a')],_0x479bf8[_0xbf6a('0x3c')]));_0x11c15a[_0xbf6a('0x46')][_0xbf6a('0x60')]=_0x472671['id'];if(_0x6581f2[_0xbf6a('0x3a')][_0xbf6a('0x47')]){_0x11c15a['where']=_['merge'](_0x11c15a['where'],{'$or':_['map'](_0x11c15a[_0xbf6a('0x3e')],function(_0x550fb8){var _0x541f6b={};_0x541f6b[_0x550fb8]={'$like':'%'+_0x6581f2['query'][_0xbf6a('0x47')]+'%'};return _0x541f6b;})});}_0x11c15a=_[_0xbf6a('0x4a')]({},_0x11c15a,_0x6581f2[_0xbf6a('0x4b')]);return db[_0xbf6a('0x5e')][_0xbf6a('0x4e')](_0x11c15a);}})[_0xbf6a('0x2c')](function(_0x1c44be){if(_0x1c44be){return db['User']['findAndCountAll']({'where':{'id':_[_0xbf6a('0x35')](_0x1c44be,'UserId'),'role':_0xbf6a('0x61')},'attributes':['id','name',_0xbf6a('0x62'),_0xbf6a('0x63'),_0xbf6a('0x64')]});}})[_0xbf6a('0x2c')](function(_0x2f8e85){if(_0x2f8e85){return{'count':_0x2f8e85[_0xbf6a('0x26')],'rows':_['map'](_0x2f8e85[_0xbf6a('0x65')],function(_0x2c89d7){return{'membername':_0x2c89d7[_0xbf6a('0x32')],'UserId':_0x2c89d7['id'],'queue_name':_0x7e9797[_0xbf6a('0x32')],'WhatsappQueueId':_0x7e9797['id'],'interface':util[_0xbf6a('0x66')](_0xbf6a('0x67'),_0xbf6a('0x68'),_0x2c89d7[_0xbf6a('0x32')]),'penalty':0x0,'paused':_0x2c89d7[_0xbf6a('0x62')],'createdAt':_0x2c89d7[_0xbf6a('0x64')],'updatedAt':_0x2c89d7['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xbf6a('0x2c')](respondWithFilteredResult(_0x16cfe5,_0x11c15a))['catch'](handleError(_0x16cfe5,null));};exports['getTeams']=function(_0x55dfa2,_0x4fb453,_0x22d4d0){var _0x190ca1={};var _0x131f65={};var _0x3572dc;var _0x253a0a;return db[_0xbf6a('0x36')][_0xbf6a('0x69')]({'where':{'id':_0x55dfa2['params']['id']}})['then'](handleEntityNotFound(_0x4fb453,null))[_0xbf6a('0x2c')](function(_0x1d27a9){if(_0x1d27a9){_0x3572dc=_0x1d27a9;_0x131f65[_0xbf6a('0x3f')]=_[_0xbf6a('0x3b')](db['Team'][_0xbf6a('0x37')]);_0x131f65[_0xbf6a('0x3a')]=_[_0xbf6a('0x3b')](_0x55dfa2['query']);_0x131f65[_0xbf6a('0x3c')]=_[_0xbf6a('0x3d')](_0x131f65[_0xbf6a('0x3f')],_0x131f65[_0xbf6a('0x3a')]);_0x190ca1[_0xbf6a('0x3e')]=_[_0xbf6a('0x3d')](_0x131f65[_0xbf6a('0x3f')],qs[_0xbf6a('0x40')](_0x55dfa2['query']['fields']));_0x190ca1[_0xbf6a('0x3e')]=_0x190ca1[_0xbf6a('0x3e')][_0xbf6a('0x41')]?_0x190ca1['attributes']:_0x131f65[_0xbf6a('0x3f')];_0x190ca1['order']=qs['sort'](_0x55dfa2[_0xbf6a('0x3a')][_0xbf6a('0x45')]);_0x190ca1[_0xbf6a('0x46')]=qs[_0xbf6a('0x3c')](_[_0xbf6a('0x5f')](_0x55dfa2[_0xbf6a('0x3a')],_0x131f65[_0xbf6a('0x3c')]));if(_0x55dfa2[_0xbf6a('0x3a')][_0xbf6a('0x47')]){_0x190ca1[_0xbf6a('0x46')]=_[_0xbf6a('0x4a')](_0x190ca1[_0xbf6a('0x46')],{'$or':_[_0xbf6a('0x35')](_0x190ca1['attributes'],function(_0x1b253c){var _0x103889={};_0x103889[_0x1b253c]={'$like':'%'+_0x55dfa2['query'][_0xbf6a('0x47')]+'%'};return _0x103889;})});}_0x190ca1=_[_0xbf6a('0x4a')]({},_0x190ca1,_0x55dfa2[_0xbf6a('0x4b')]);return _0x3572dc[_0xbf6a('0x6a')](_0x190ca1);}})['then'](function(_0x104ea9){if(_0x104ea9){_0x253a0a=_0x104ea9['length'];if(!_0x55dfa2['query'][_0xbf6a('0x42')](_0xbf6a('0x43'))){_0x190ca1['limit']=qs[_0xbf6a('0x25')](_0x55dfa2[_0xbf6a('0x3a')]['limit']);_0x190ca1[_0xbf6a('0x23')]=qs['offset'](_0x55dfa2[_0xbf6a('0x3a')][_0xbf6a('0x23')]);}return _0x3572dc['getTeams'](_0x190ca1);}})['then'](function(_0x803627){if(_0x803627){return _0x803627?{'count':_0x253a0a,'rows':_0x803627}:null;}})['then'](respondWithResult(_0x4fb453,null))[_0xbf6a('0x51')](handleError(_0x4fb453,null));};exports['addTeams']=function(_0xbf715,_0x52919e,_0x56266f){var _0x29b11f=_0xbf715['body'][_0xbf6a('0x6b')];return db[_0xbf6a('0x6c')][_0xbf6a('0x4e')]({'where':{'id':_0x29b11f},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbf6a('0x6d'),'attributes':['id',_0xbf6a('0x32'),_0xbf6a('0x6e'),'voicePause',_0xbf6a('0x6f')],'raw':!![]}]})[_0xbf6a('0x2c')](function(_0x106e43){if(_0x106e43){var _0x81d0e8=_[_0xbf6a('0x70')](_0x106e43,function(_0x1c0556){var _0x5af1ef=_0x1c0556[_0xbf6a('0x2e')]({'plain':!![]});return _0x5af1ef[_0xbf6a('0x6d')];});return db[_0xbf6a('0x36')]['find']({'where':{'id':_0xbf715[_0xbf6a('0x4f')]['id']}})[_0xbf6a('0x2c')](function(_0x3e2546){return db['sequelize'][_0xbf6a('0x71')](function(_0x2f899f){return _0x3e2546['addTeams'](_0x29b11f,{'transaction':_0x2f899f})[_0xbf6a('0x2c')](function(){return BPromise[_0xbf6a('0x72')](_0x81d0e8,function(_0x1d60af){return db[_0xbf6a('0x5e')][_0xbf6a('0x73')]({'where':{'UserId':_0x1d60af['id'],'WhatsappQueueId':_0xbf715[_0xbf6a('0x4f')]['id']},'transaction':_0x2f899f});});})['then'](function(){_0x81d0e8[_0xbf6a('0x74')](function(_0x15d104){socket[_0xbf6a('0x75')](_0xbf6a('0x76'),{'UserId':_0x15d104['id'],'WhatsappQueueId':_0x3e2546['id']});});});});});}})['then'](respondWithStatusCode(_0x52919e,null))['catch'](handleError(_0x52919e,null));};exports['removeTeams']=function(_0x3f8489,_0x490a91,_0x3917e0){return db['Team'][_0xbf6a('0x4e')]({'where':{'id':_0x3f8489[_0xbf6a('0x3a')][_0xbf6a('0x6b')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbf6a('0x2c')](handleEntityNotFound(_0x490a91,null))['then'](function(_0x7b5065){var _0x287f3a=_[_0xbf6a('0x35')](_0x7b5065,'id');var _0x235687=[];var _0x19c713=[];var _0x51bdef=squel[_0xbf6a('0x77')]();_0x51bdef['field'](_0xbf6a('0x78'))[_0xbf6a('0x79')](_0xbf6a('0x7a'),'tq')[_0xbf6a('0x7b')](_0xbf6a('0x7c'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xbf6a('0x46')](_0xbf6a('0x7d'),_0x3f8489['params']['id']);for(var _0x5b4fc8=0x0;_0x5b4fc8<_0x7b5065['length'];_0x5b4fc8+=0x1){let _0x398853=_0x7b5065[_0x5b4fc8];for(var _0x4f4191=0x0;_0x4f4191<_0x398853[_0xbf6a('0x6d')][_0xbf6a('0x41')];_0x4f4191+=0x1){let _0x5bc1bd=_0x398853['Agents'][_0x4f4191];var _0x4e293f=_0x51bdef[_0xbf6a('0x7e')]();_0x4e293f[_0xbf6a('0x46')](_0xbf6a('0x7f'),_0x5bc1bd['id']);_0x19c713[_0xbf6a('0x80')](db[_0xbf6a('0x81')][_0xbf6a('0x3a')](_0x4e293f[_0xbf6a('0x82')](),{'type':db['sequelize'][_0xbf6a('0x83')][_0xbf6a('0x84')]})[_0xbf6a('0x2c')](function(_0x2c2ed6){if(_0x2c2ed6[_0xbf6a('0x41')]===0x1){return _0x5bc1bd['id'];}else{var _0x2ec8fc=_['every'](_[_0xbf6a('0x35')](_0x2c2ed6,_0xbf6a('0x85')),function(_0x385dbf){return _[_0xbf6a('0x86')](_0x287f3a,_0x385dbf);});if(_0x2ec8fc){return _0x5bc1bd['id'];}}}));}}return BPromise[_0xbf6a('0x87')](_0x19c713)['then'](function(_0x109acd){_0x235687=_(_0x235687)[_0xbf6a('0x88')](_0x109acd)[_0xbf6a('0x89')]()[_0xbf6a('0x8a')]();return db[_0xbf6a('0x36')]['find']({'where':{'id':_0x3f8489[_0xbf6a('0x4f')]['id']}})['then'](function(_0x2ebe42){return db[_0xbf6a('0x81')]['transaction'](function(_0x5cd428){return _0x2ebe42[_0xbf6a('0x8b')](_0x3f8489['query'][_0xbf6a('0x6b')],{'transaction':_0x5cd428})[_0xbf6a('0x2c')](function(){if(!_[_0xbf6a('0x8c')](_0x235687)){return _0x2ebe42['removeAgents'](_0x235687,{'transaction':_0x5cd428});}})[_0xbf6a('0x2c')](function(){_0x235687[_0xbf6a('0x74')](function(_0x4b653a){socket[_0xbf6a('0x75')](_0xbf6a('0x8d'),{'UserId':_0x4b653a,'WhatsappQueueId':_0x2ebe42['id']});});});});});});})[_0xbf6a('0x2c')](respondWithStatusCode(_0x490a91,null))[_0xbf6a('0x51')](handleError(_0x490a91,null));};exports[_0xbf6a('0x8e')]=function(_0xb21148,_0x486a9b,_0x261bce){return db[_0xbf6a('0x36')][_0xbf6a('0x50')]({'where':{'id':_0xb21148[_0xbf6a('0x4f')]['id']}})[_0xbf6a('0x2c')](handleEntityNotFound(_0x486a9b,null))[_0xbf6a('0x2c')](function(_0x1c56b){if(_0x1c56b){return _0x1c56b[_0xbf6a('0x8e')](_0xb21148['body'][_0xbf6a('0x6b')],_[_0xbf6a('0x8f')](_0xb21148['body'],[_0xbf6a('0x6b'),'id'])||{})[_0xbf6a('0x90')](function(_0x34fec0){for(var _0x17613f=0x0;_0x17613f<_0xb21148[_0xbf6a('0x53')]['ids'][_0xbf6a('0x41')];_0x17613f+=0x1){socket[_0xbf6a('0x75')](_0xbf6a('0x76'),{'UserId':Number(_0xb21148[_0xbf6a('0x53')]['ids'][_0x17613f]),'WhatsappQueueId':Number(_0xb21148[_0xbf6a('0x4f')]['id'])});}return _0x34fec0;});}})['then'](respondWithResult(_0x486a9b,null))['catch'](handleError(_0x486a9b,null));};exports['removeAgents']=function(_0x3840fc,_0x40f9b2,_0x2d8324){return db[_0xbf6a('0x36')][_0xbf6a('0x50')]({'where':{'id':_0x3840fc[_0xbf6a('0x4f')]['id']}})[_0xbf6a('0x2c')](handleEntityNotFound(_0x40f9b2,null))[_0xbf6a('0x2c')](function(_0x4172d7){if(_0x4172d7){return _0x4172d7[_0xbf6a('0x91')](_0x3840fc[_0xbf6a('0x3a')][_0xbf6a('0x6b')])[_0xbf6a('0x2c')](function(){if(_[_0xbf6a('0x92')](_0x3840fc[_0xbf6a('0x3a')][_0xbf6a('0x6b')])){for(var _0x4ba8d8=0x0;_0x4ba8d8<_0x3840fc[_0xbf6a('0x3a')][_0xbf6a('0x6b')]['length'];_0x4ba8d8+=0x1){socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x3840fc[_0xbf6a('0x3a')][_0xbf6a('0x6b')][_0x4ba8d8]),'WhatsappQueueId':Number(_0x3840fc['params']['id'])});}}else{socket[_0xbf6a('0x75')](_0xbf6a('0x8d'),{'UserId':Number(_0x3840fc['query'][_0xbf6a('0x6b')]),'WhatsappQueueId':Number(_0x3840fc[_0xbf6a('0x4f')]['id'])});}});}})[_0xbf6a('0x2c')](respondWithStatusCode(_0x40f9b2,null))['catch'](handleError(_0x40f9b2,null));};exports[_0xbf6a('0x93')]=function(_0x204732,_0xd59d3f,_0x4781b5){var _0x5b97fa={};var _0x1caa13={};var _0xfa7e7c;var _0x10a910;return db[_0xbf6a('0x36')][_0xbf6a('0x69')]({'where':{'id':_0x204732[_0xbf6a('0x4f')]['id']}})['then'](handleEntityNotFound(_0xd59d3f,null))[_0xbf6a('0x2c')](function(_0x2eac53){if(_0x2eac53){_0xfa7e7c=_0x2eac53;_0x1caa13[_0xbf6a('0x3f')]=_['keys'](db[_0xbf6a('0x94')]['rawAttributes']);_0x1caa13['query']=_[_0xbf6a('0x3b')](_0x204732[_0xbf6a('0x3a')]);_0x1caa13[_0xbf6a('0x3c')]=_[_0xbf6a('0x3d')](_0x1caa13[_0xbf6a('0x3f')],_0x1caa13[_0xbf6a('0x3a')]);_0x5b97fa['attributes']=_['intersection'](_0x1caa13[_0xbf6a('0x3f')],qs[_0xbf6a('0x40')](_0x204732[_0xbf6a('0x3a')][_0xbf6a('0x40')]));_0x5b97fa[_0xbf6a('0x3e')]=_0x5b97fa['attributes'][_0xbf6a('0x41')]?_0x5b97fa['attributes']:_0x1caa13['model'];_0x5b97fa[_0xbf6a('0x44')]=qs[_0xbf6a('0x45')](_0x204732['query'][_0xbf6a('0x45')]);_0x5b97fa[_0xbf6a('0x46')]=qs['filters'](_[_0xbf6a('0x5f')](_0x204732[_0xbf6a('0x3a')],_0x1caa13['filters']));if(_0x204732[_0xbf6a('0x3a')]['filter']){_0x5b97fa['where']=_[_0xbf6a('0x4a')](_0x5b97fa['where'],{'$or':_[_0xbf6a('0x35')](_0x5b97fa[_0xbf6a('0x3e')],function(_0x3e62bf){var _0x5b2937={};_0x5b2937[_0x3e62bf]={'$like':'%'+_0x204732[_0xbf6a('0x3a')]['filter']+'%'};return _0x5b2937;})});}_0x5b97fa=_[_0xbf6a('0x4a')]({},_0x5b97fa,_0x204732['options']);return _0xfa7e7c[_0xbf6a('0x93')](_0x5b97fa);}})[_0xbf6a('0x2c')](function(_0x236dc2){if(_0x236dc2){_0x10a910=_0x236dc2[_0xbf6a('0x41')];if(!_0x204732['query'][_0xbf6a('0x42')](_0xbf6a('0x43'))){_0x5b97fa[_0xbf6a('0x25')]=qs[_0xbf6a('0x25')](_0x204732[_0xbf6a('0x3a')][_0xbf6a('0x25')]);_0x5b97fa[_0xbf6a('0x23')]=qs[_0xbf6a('0x23')](_0x204732[_0xbf6a('0x3a')][_0xbf6a('0x23')]);}return _0xfa7e7c[_0xbf6a('0x93')](_0x5b97fa);}})['then'](function(_0x305060){if(_0x305060){return _0x305060?{'count':_0x10a910,'rows':_0x305060}:null;}})['then'](respondWithResult(_0xd59d3f,null))[_0xbf6a('0x51')](handleError(_0xd59d3f,null));}; \ No newline at end of file +var _0x8574=['filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','order','pick','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','rows','format','SIP','getTeams','Team','length','Agents','online','voicePause','interface','flatMap','sequelize','addTeams','each','findOrCreate','forEach','emit','removeTeams','ids','tq.TeamId','from','team_has_whatsapp_queues','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','includes','compact','value','transaction','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','userWhatsappQueue:save','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','get','WhatsappQueues','UserProfileResource','destroy','end','error','stack','name','send','index','WhatsappQueue','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','fields','attributes','nolimit','sort','where'];(function(_0xce44ee,_0x387d70){var _0xf97a49=function(_0x3ceab0){while(--_0x3ceab0){_0xce44ee['push'](_0xce44ee['shift']());}};_0xf97a49(++_0x387d70);}(_0x8574,0x1e9));var _0x4857=function(_0x34dc5c,_0x3a1077){_0x34dc5c=_0x34dc5c-0x0;var _0x1af497=_0x8574[_0x34dc5c];return _0x1af497;};'use strict';var emlformat=require(_0x4857('0x0'));var rimraf=require(_0x4857('0x1'));var zipdir=require(_0x4857('0x2'));var jsonpatch=require(_0x4857('0x3'));var rp=require('request-promise');var moment=require(_0x4857('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4857('0x5'));var path=require(_0x4857('0x6'));var sox=require(_0x4857('0x7'));var csv=require(_0x4857('0x8'));var ejs=require(_0x4857('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4857('0xa'));var squel=require('squel');var crypto=require(_0x4857('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4857('0xc'));var Papa=require(_0x4857('0xd'));var Redis=require(_0x4857('0xe'));var authService=require(_0x4857('0xf'));var qs=require(_0x4857('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4857('0x11'))(_0x4857('0x12'));var utils=require('../../config/utils');var config=require(_0x4857('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x4857('0x14'))['db'];config[_0x4857('0x15')]=_['defaults'](config[_0x4857('0x15')],{'host':_0x4857('0x16'),'port':0x18eb});var socket=require(_0x4857('0x17'))(new Redis(config[_0x4857('0x15')]));require(_0x4857('0x18'))['register'](socket);function respondWithStatusCode(_0xbca60f,_0x23581d){_0x23581d=_0x23581d||0xcc;return function(_0x340d69){if(_0x340d69){return _0xbca60f[_0x4857('0x19')](_0x23581d);}return _0xbca60f[_0x4857('0x1a')](_0x23581d)['end']();};}function respondWithResult(_0x51b4bf,_0x1db6ca){_0x1db6ca=_0x1db6ca||0xc8;return function(_0x2f2401){if(_0x2f2401){return _0x51b4bf[_0x4857('0x1a')](_0x1db6ca)['json'](_0x2f2401);}};}function respondWithFilteredResult(_0x193f6c,_0x1b440d){return function(_0x318d6a){if(_0x318d6a){var _0x4db031=typeof _0x1b440d[_0x4857('0x1b')]===_0x4857('0x1c')&&typeof _0x1b440d[_0x4857('0x1d')]==='undefined';var _0x28137a=_0x318d6a[_0x4857('0x1e')];var _0x22e852=_0x4db031?0x0:_0x1b440d['offset'];var _0x5075c4=_0x4db031?_0x318d6a[_0x4857('0x1e')]:_0x1b440d['offset']+_0x1b440d[_0x4857('0x1d')];var _0xedc41c;if(_0x5075c4>=_0x28137a){_0x5075c4=_0x28137a;_0xedc41c=0xc8;}else{_0xedc41c=0xce;}_0x193f6c['status'](_0xedc41c);return _0x193f6c[_0x4857('0x1f')](_0x4857('0x20'),_0x22e852+'-'+_0x5075c4+'/'+_0x28137a)[_0x4857('0x21')](_0x318d6a);}return null;};}function patchUpdates(_0x23459c){return function(_0x1a9fc7){try{jsonpatch[_0x4857('0x22')](_0x1a9fc7,_0x23459c,!![]);}catch(_0x34bbd1){return BPromise[_0x4857('0x23')](_0x34bbd1);}return _0x1a9fc7['save']();};}function saveUpdates(_0x5ebdb1,_0x118265){return function(_0xada7c4){if(_0xada7c4){return _0xada7c4[_0x4857('0x24')](_0x5ebdb1)[_0x4857('0x25')](function(_0x31ff9d){return _0x31ff9d;});}return null;};}function removeEntity(_0x2c4b62,_0x9a1396){return function(_0x2762d7){if(_0x2762d7){return _0x2762d7['destroy']()[_0x4857('0x25')](function(){var _0x5d481f=_0x2762d7[_0x4857('0x26')]({'plain':!![]});var _0x240511=_0x4857('0x27');return db[_0x4857('0x28')][_0x4857('0x29')]({'where':{'type':_0x240511,'resourceId':_0x5d481f['id']}})[_0x4857('0x25')](function(){return _0x2762d7;});})[_0x4857('0x25')](function(){_0x2c4b62['status'](0xcc)[_0x4857('0x2a')]();});}};}function handleEntityNotFound(_0xdbb3ea,_0x24d9b9){return function(_0x49e0ca){if(!_0x49e0ca){_0xdbb3ea[_0x4857('0x19')](0x194);}return _0x49e0ca;};}function handleError(_0x1f6afa,_0x572bb8){_0x572bb8=_0x572bb8||0x1f4;return function(_0x215862){logger[_0x4857('0x2b')](_0x215862[_0x4857('0x2c')]);if(_0x215862[_0x4857('0x2d')]){delete _0x215862[_0x4857('0x2d')];}_0x1f6afa[_0x4857('0x1a')](_0x572bb8)[_0x4857('0x2e')](_0x215862);};}exports[_0x4857('0x2f')]=function(_0x30239f,_0x31f9a5){var _0x564d86={},_0x5a87dc={},_0x309c85={'count':0x0,'rows':[]};var _0x14dff0=_['map'](db[_0x4857('0x30')][_0x4857('0x31')],function(_0x4115d3){return{'name':_0x4115d3[_0x4857('0x32')],'type':_0x4115d3[_0x4857('0x33')][_0x4857('0x34')]};});_0x5a87dc[_0x4857('0x35')]=_[_0x4857('0x36')](_0x14dff0,_0x4857('0x2d'));_0x5a87dc['query']=_[_0x4857('0x37')](_0x30239f[_0x4857('0x38')]);_0x5a87dc['filters']=_['intersection'](_0x5a87dc['model'],_0x5a87dc[_0x4857('0x38')]);_0x564d86['attributes']=_[_0x4857('0x39')](_0x5a87dc[_0x4857('0x35')],qs[_0x4857('0x3a')](_0x30239f[_0x4857('0x38')][_0x4857('0x3a')]));_0x564d86[_0x4857('0x3b')]=_0x564d86[_0x4857('0x3b')]['length']?_0x564d86['attributes']:_0x5a87dc[_0x4857('0x35')];if(!_0x30239f[_0x4857('0x38')]['hasOwnProperty'](_0x4857('0x3c'))){_0x564d86[_0x4857('0x1d')]=qs['limit'](_0x30239f['query'][_0x4857('0x1d')]);_0x564d86[_0x4857('0x1b')]=qs[_0x4857('0x1b')](_0x30239f[_0x4857('0x38')]['offset']);}_0x564d86['order']=qs['sort'](_0x30239f[_0x4857('0x38')][_0x4857('0x3d')]);_0x564d86[_0x4857('0x3e')]=qs[_0x4857('0x3f')](_['pick'](_0x30239f['query'],_0x5a87dc[_0x4857('0x3f')]),_0x14dff0);if(_0x30239f[_0x4857('0x38')][_0x4857('0x40')]){_0x564d86[_0x4857('0x3e')]=_[_0x4857('0x41')](_0x564d86[_0x4857('0x3e')],{'$or':_[_0x4857('0x36')](_0x14dff0,function(_0x3d2f1e){if(_0x3d2f1e[_0x4857('0x33')]!==_0x4857('0x42')){var _0x3b5606={};_0x3b5606[_0x3d2f1e[_0x4857('0x2d')]]={'$like':'%'+_0x30239f['query'][_0x4857('0x40')]+'%'};return _0x3b5606;}})});}_0x564d86=_[_0x4857('0x41')]({},_0x564d86,_0x30239f[_0x4857('0x43')]);var _0x19bb51={'where':_0x564d86['where']};return db[_0x4857('0x30')][_0x4857('0x1e')](_0x19bb51)['then'](function(_0xf43505){_0x309c85[_0x4857('0x1e')]=_0xf43505;if(_0x30239f[_0x4857('0x38')][_0x4857('0x44')]){_0x564d86[_0x4857('0x45')]=[{'all':!![]}];}return db[_0x4857('0x30')][_0x4857('0x46')](_0x564d86);})[_0x4857('0x25')](function(_0x5018a1){_0x309c85['rows']=_0x5018a1;return _0x309c85;})['then'](respondWithFilteredResult(_0x31f9a5,_0x564d86))['catch'](handleError(_0x31f9a5,null));};exports[_0x4857('0x47')]=function(_0x23e53c,_0x384e11){var _0x2872bb={'raw':!![],'where':{'id':_0x23e53c[_0x4857('0x48')]['id']}},_0xce05eb={};_0xce05eb[_0x4857('0x35')]=_['keys'](db[_0x4857('0x30')][_0x4857('0x31')]);_0xce05eb[_0x4857('0x38')]=_[_0x4857('0x37')](_0x23e53c['query']);_0xce05eb[_0x4857('0x3f')]=_[_0x4857('0x39')](_0xce05eb[_0x4857('0x35')],_0xce05eb[_0x4857('0x38')]);_0x2872bb[_0x4857('0x3b')]=_[_0x4857('0x39')](_0xce05eb[_0x4857('0x35')],qs[_0x4857('0x3a')](_0x23e53c['query'][_0x4857('0x3a')]));_0x2872bb[_0x4857('0x3b')]=_0x2872bb[_0x4857('0x3b')]['length']?_0x2872bb[_0x4857('0x3b')]:_0xce05eb[_0x4857('0x35')];if(_0x23e53c[_0x4857('0x38')][_0x4857('0x44')]){_0x2872bb[_0x4857('0x45')]=[{'all':!![]}];}_0x2872bb=_[_0x4857('0x41')]({},_0x2872bb,_0x23e53c[_0x4857('0x43')]);return db[_0x4857('0x30')][_0x4857('0x49')](_0x2872bb)['then'](handleEntityNotFound(_0x384e11,null))[_0x4857('0x25')](respondWithResult(_0x384e11,null))[_0x4857('0x4a')](handleError(_0x384e11,null));};exports[_0x4857('0x4b')]=function(_0x333b80,_0x4f0c3f){return db[_0x4857('0x30')][_0x4857('0x4b')](_0x333b80['body'],{})['then'](function(_0x3fd1bf){var _0x20582f=_0x333b80[_0x4857('0x4c')][_0x4857('0x26')]({'plain':!![]});if(!_0x20582f)throw new Error(_0x4857('0x4d'));if(_0x20582f[_0x4857('0x4e')]==='user'){var _0xfa4229=_0x3fd1bf[_0x4857('0x26')]({'plain':!![]});var _0x2e7f8b=_0x4857('0x27');return db[_0x4857('0x4f')][_0x4857('0x49')]({'where':{'name':_0x2e7f8b,'userProfileId':_0x20582f[_0x4857('0x50')]},'raw':!![]})[_0x4857('0x25')](function(_0x6bbad0){if(_0x6bbad0&&_0x6bbad0['autoAssociation']===0x0){return db[_0x4857('0x28')]['create']({'name':_0xfa4229[_0x4857('0x2d')],'resourceId':_0xfa4229['id'],'type':_0x6bbad0['name'],'sectionId':_0x6bbad0['id']},{})[_0x4857('0x25')](function(){return _0x3fd1bf;});}else{return _0x3fd1bf;}})[_0x4857('0x4a')](function(_0x54ebd8){logger[_0x4857('0x2b')](_0x4857('0x51'),_0x54ebd8);throw _0x54ebd8;});}return _0x3fd1bf;})['then'](respondWithResult(_0x4f0c3f,0xc9))['catch'](handleError(_0x4f0c3f,null));};exports[_0x4857('0x24')]=function(_0x18a204,_0x27cf45){if(_0x18a204[_0x4857('0x52')]['id']){delete _0x18a204[_0x4857('0x52')]['id'];}return db[_0x4857('0x30')][_0x4857('0x49')]({'where':{'id':_0x18a204[_0x4857('0x48')]['id']}})[_0x4857('0x25')](handleEntityNotFound(_0x27cf45,null))['then'](saveUpdates(_0x18a204['body'],null))[_0x4857('0x25')](respondWithResult(_0x27cf45,null))['catch'](handleError(_0x27cf45,null));};exports[_0x4857('0x29')]=function(_0x33a6c6,_0x31ec9b){return db[_0x4857('0x30')][_0x4857('0x49')]({'where':{'id':_0x33a6c6[_0x4857('0x48')]['id']}})['then'](handleEntityNotFound(_0x31ec9b,null))[_0x4857('0x25')](removeEntity(_0x31ec9b,null))[_0x4857('0x4a')](handleError(_0x31ec9b,null));};exports[_0x4857('0x53')]=function(_0x362366,_0x52c9aa){return db[_0x4857('0x30')][_0x4857('0x53')]()[_0x4857('0x25')](respondWithResult(_0x52c9aa,null))[_0x4857('0x4a')](handleError(_0x52c9aa,null));};exports[_0x4857('0x54')]=function(_0x2531a7,_0x3eb32a,_0x1ac988){var _0x304208={'raw':!![],'where':{}},_0x3ab3a9={},_0x2add61;return db[_0x4857('0x30')][_0x4857('0x55')]({'where':{'id':_0x2531a7[_0x4857('0x48')]['id']}})[_0x4857('0x25')](handleEntityNotFound(_0x3eb32a,null))[_0x4857('0x25')](function(_0x42178e){if(_0x42178e){_0x2add61=_0x42178e[_0x4857('0x26')]({'plain':!![]});_0x3ab3a9[_0x4857('0x35')]=_[_0x4857('0x37')](db[_0x4857('0x56')][_0x4857('0x31')]);_0x3ab3a9[_0x4857('0x38')]=_['keys'](_0x2531a7[_0x4857('0x38')]);_0x3ab3a9['filters']=_[_0x4857('0x39')](_0x3ab3a9[_0x4857('0x35')],_0x3ab3a9[_0x4857('0x38')]);_0x304208[_0x4857('0x3b')]=_[_0x4857('0x39')](_0x3ab3a9[_0x4857('0x35')],qs['fields'](_0x2531a7['query'][_0x4857('0x3a')]));_0x304208[_0x4857('0x3b')]=_0x304208[_0x4857('0x3b')]['length']?_0x304208['attributes']:_0x3ab3a9[_0x4857('0x35')];if(!_0x2531a7[_0x4857('0x38')][_0x4857('0x57')](_0x4857('0x3c'))){_0x304208[_0x4857('0x1d')]=qs[_0x4857('0x1d')](_0x2531a7[_0x4857('0x38')][_0x4857('0x1d')]);_0x304208['offset']=qs[_0x4857('0x1b')](_0x2531a7['query']['offset']);}_0x304208[_0x4857('0x58')]=qs[_0x4857('0x3d')](_0x2531a7[_0x4857('0x38')][_0x4857('0x3d')]);_0x304208[_0x4857('0x3e')]=qs[_0x4857('0x3f')](_[_0x4857('0x59')](_0x2531a7[_0x4857('0x38')],_0x3ab3a9[_0x4857('0x3f')]));_0x304208[_0x4857('0x3e')]['WhatsappQueueId']=_0x42178e['id'];if(_0x2531a7['query'][_0x4857('0x40')]){_0x304208['where']=_['merge'](_0x304208[_0x4857('0x3e')],{'$or':_[_0x4857('0x36')](_0x304208['attributes'],function(_0x3d3be1){var _0x44abf9={};_0x44abf9[_0x3d3be1]={'$like':'%'+_0x2531a7['query'][_0x4857('0x40')]+'%'};return _0x44abf9;})});}_0x304208=_[_0x4857('0x41')]({},_0x304208,_0x2531a7[_0x4857('0x43')]);return db[_0x4857('0x56')][_0x4857('0x46')](_0x304208);}})[_0x4857('0x25')](function(_0x243bf3){if(_0x243bf3){return db[_0x4857('0x5a')][_0x4857('0x5b')]({'where':{'id':_[_0x4857('0x36')](_0x243bf3,_0x4857('0x5c')),'role':_0x4857('0x5d')},'attributes':['id',_0x4857('0x2d'),_0x4857('0x5e'),_0x4857('0x5f'),_0x4857('0x60')]});}})[_0x4857('0x25')](function(_0x1e38a5){if(_0x1e38a5){return{'count':_0x1e38a5[_0x4857('0x1e')],'rows':_[_0x4857('0x36')](_0x1e38a5[_0x4857('0x61')],function(_0x41f0b3){return{'membername':_0x41f0b3[_0x4857('0x2d')],'UserId':_0x41f0b3['id'],'queue_name':_0x2add61[_0x4857('0x2d')],'WhatsappQueueId':_0x2add61['id'],'interface':util[_0x4857('0x62')]('%s/%s',_0x4857('0x63'),_0x41f0b3[_0x4857('0x2d')]),'penalty':0x0,'paused':_0x41f0b3[_0x4857('0x5e')],'createdAt':_0x41f0b3[_0x4857('0x60')],'updatedAt':_0x41f0b3[_0x4857('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4857('0x25')](respondWithFilteredResult(_0x3eb32a,_0x304208))['catch'](handleError(_0x3eb32a,null));};exports[_0x4857('0x64')]=function(_0x5268fc,_0x4dfb90,_0x2e2f2c){var _0x59f862={};var _0xfde5b9={};var _0x40bfbe;var _0x3af469;return db['WhatsappQueue'][_0x4857('0x55')]({'where':{'id':_0x5268fc[_0x4857('0x48')]['id']}})[_0x4857('0x25')](handleEntityNotFound(_0x4dfb90,null))['then'](function(_0x13e48c){if(_0x13e48c){_0x40bfbe=_0x13e48c;_0xfde5b9[_0x4857('0x35')]=_[_0x4857('0x37')](db[_0x4857('0x65')][_0x4857('0x31')]);_0xfde5b9['query']=_[_0x4857('0x37')](_0x5268fc[_0x4857('0x38')]);_0xfde5b9[_0x4857('0x3f')]=_['intersection'](_0xfde5b9[_0x4857('0x35')],_0xfde5b9[_0x4857('0x38')]);_0x59f862[_0x4857('0x3b')]=_[_0x4857('0x39')](_0xfde5b9[_0x4857('0x35')],qs[_0x4857('0x3a')](_0x5268fc[_0x4857('0x38')][_0x4857('0x3a')]));_0x59f862[_0x4857('0x3b')]=_0x59f862[_0x4857('0x3b')][_0x4857('0x66')]?_0x59f862[_0x4857('0x3b')]:_0xfde5b9['model'];_0x59f862[_0x4857('0x58')]=qs['sort'](_0x5268fc['query'][_0x4857('0x3d')]);_0x59f862[_0x4857('0x3e')]=qs[_0x4857('0x3f')](_[_0x4857('0x59')](_0x5268fc[_0x4857('0x38')],_0xfde5b9[_0x4857('0x3f')]));if(_0x5268fc[_0x4857('0x38')]['filter']){_0x59f862['where']=_[_0x4857('0x41')](_0x59f862['where'],{'$or':_[_0x4857('0x36')](_0x59f862[_0x4857('0x3b')],function(_0x5ee627){var _0x45f110={};_0x45f110[_0x5ee627]={'$like':'%'+_0x5268fc[_0x4857('0x38')][_0x4857('0x40')]+'%'};return _0x45f110;})});}_0x59f862=_['merge']({},_0x59f862,_0x5268fc[_0x4857('0x43')]);return _0x40bfbe['getTeams'](_0x59f862);}})[_0x4857('0x25')](function(_0x3c49e8){if(_0x3c49e8){_0x3af469=_0x3c49e8[_0x4857('0x66')];if(!_0x5268fc[_0x4857('0x38')][_0x4857('0x57')](_0x4857('0x3c'))){_0x59f862[_0x4857('0x1d')]=qs['limit'](_0x5268fc['query'][_0x4857('0x1d')]);_0x59f862[_0x4857('0x1b')]=qs[_0x4857('0x1b')](_0x5268fc['query']['offset']);}return _0x40bfbe['getTeams'](_0x59f862);}})[_0x4857('0x25')](function(_0x1ae1a4){if(_0x1ae1a4){return _0x1ae1a4?{'count':_0x3af469,'rows':_0x1ae1a4}:null;}})[_0x4857('0x25')](respondWithResult(_0x4dfb90,null))[_0x4857('0x4a')](handleError(_0x4dfb90,null));};exports['addTeams']=function(_0x4f5caa,_0x3d38e5,_0x5c09e5){var _0x1d4099=_0x4f5caa[_0x4857('0x52')]['ids'];return db[_0x4857('0x65')]['findAll']({'where':{'id':_0x1d4099},'attributes':['id'],'include':[{'model':db[_0x4857('0x5a')],'as':_0x4857('0x67'),'attributes':['id','name',_0x4857('0x68'),_0x4857('0x69'),_0x4857('0x6a')],'raw':!![]}]})[_0x4857('0x25')](function(_0x5557f0){if(_0x5557f0){var _0xb4cf92=_[_0x4857('0x6b')](_0x5557f0,function(_0x519fe7){var _0x13e5ce=_0x519fe7[_0x4857('0x26')]({'plain':!![]});return _0x13e5ce[_0x4857('0x67')];});return db[_0x4857('0x30')][_0x4857('0x49')]({'where':{'id':_0x4f5caa[_0x4857('0x48')]['id']}})[_0x4857('0x25')](function(_0x3e6196){return db[_0x4857('0x6c')]['transaction'](function(_0xdd59d8){return _0x3e6196[_0x4857('0x6d')](_0x1d4099,{'transaction':_0xdd59d8})['then'](function(){return BPromise[_0x4857('0x6e')](_0xb4cf92,function(_0x37192e){return db['UserWhatsappQueue'][_0x4857('0x6f')]({'where':{'UserId':_0x37192e['id'],'WhatsappQueueId':_0x4f5caa[_0x4857('0x48')]['id']},'transaction':_0xdd59d8});});})[_0x4857('0x25')](function(){_0xb4cf92[_0x4857('0x70')](function(_0x562de2){socket[_0x4857('0x71')]('userWhatsappQueue:save',{'UserId':_0x562de2['id'],'WhatsappQueueId':_0x3e6196['id']});});});});});}})[_0x4857('0x25')](respondWithStatusCode(_0x3d38e5,null))[_0x4857('0x4a')](handleError(_0x3d38e5,null));};exports[_0x4857('0x72')]=function(_0x30078d,_0x424b18,_0x10837b){return db['Team'][_0x4857('0x46')]({'where':{'id':_0x30078d['query'][_0x4857('0x73')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x4857('0x25')](handleEntityNotFound(_0x424b18,null))[_0x4857('0x25')](function(_0x58de0e){var _0x428bd3=_[_0x4857('0x36')](_0x58de0e,'id');var _0x4c9258=[];var _0x1f82ba=[];var _0x567b5e=squel['select']();_0x567b5e['field'](_0x4857('0x74'))[_0x4857('0x75')](_0x4857('0x76'),'tq')['join']('user_has_teams','ut',_0x4857('0x77'))[_0x4857('0x3e')](_0x4857('0x78'),_0x30078d['params']['id']);for(var _0x521735=0x0;_0x521735<_0x58de0e['length'];_0x521735+=0x1){let _0x3fac9c=_0x58de0e[_0x521735];for(var _0x15e306=0x0;_0x15e306<_0x3fac9c[_0x4857('0x67')][_0x4857('0x66')];_0x15e306+=0x1){let _0x5e4134=_0x3fac9c[_0x4857('0x67')][_0x15e306];var _0x4d0637=_0x567b5e[_0x4857('0x79')]();_0x4d0637[_0x4857('0x3e')]('ut.UserId\x20=\x20?',_0x5e4134['id']);_0x1f82ba[_0x4857('0x7a')](db[_0x4857('0x6c')][_0x4857('0x38')](_0x4d0637[_0x4857('0x7b')](),{'type':db['sequelize'][_0x4857('0x7c')][_0x4857('0x7d')]})['then'](function(_0x441e5f){if(_0x441e5f[_0x4857('0x66')]===0x1){return _0x5e4134['id'];}else{var _0x3687e4=_[_0x4857('0x7e')](_[_0x4857('0x36')](_0x441e5f,'TeamId'),function(_0x4344a0){return _[_0x4857('0x7f')](_0x428bd3,_0x4344a0);});if(_0x3687e4){return _0x5e4134['id'];}}}));}}return BPromise['all'](_0x1f82ba)['then'](function(_0x20542a){_0x4c9258=_(_0x4c9258)['union'](_0x20542a)[_0x4857('0x80')]()[_0x4857('0x81')]();return db[_0x4857('0x30')]['find']({'where':{'id':_0x30078d[_0x4857('0x48')]['id']}})['then'](function(_0x33a852){return db[_0x4857('0x6c')][_0x4857('0x82')](function(_0x954e90){return _0x33a852[_0x4857('0x72')](_0x30078d[_0x4857('0x38')][_0x4857('0x73')],{'transaction':_0x954e90})['then'](function(){if(!_['isEmpty'](_0x4c9258)){return _0x33a852[_0x4857('0x83')](_0x4c9258,{'transaction':_0x954e90});}})['then'](function(){_0x4c9258['forEach'](function(_0x9df481){socket[_0x4857('0x71')](_0x4857('0x84'),{'UserId':_0x9df481,'WhatsappQueueId':_0x33a852['id']});});});});});});})[_0x4857('0x25')](respondWithStatusCode(_0x424b18,null))[_0x4857('0x4a')](handleError(_0x424b18,null));};exports[_0x4857('0x85')]=function(_0x16db02,_0x3c1136,_0xbb5944){return db[_0x4857('0x30')][_0x4857('0x49')]({'where':{'id':_0x16db02[_0x4857('0x48')]['id']}})[_0x4857('0x25')](handleEntityNotFound(_0x3c1136,null))[_0x4857('0x25')](function(_0x3a4785){if(_0x3a4785){return _0x3a4785['addAgents'](_0x16db02[_0x4857('0x52')]['ids'],_[_0x4857('0x86')](_0x16db02[_0x4857('0x52')],['ids','id'])||{})[_0x4857('0x87')](function(_0x1802b8){for(var _0x1f7692=0x0;_0x1f7692<_0x16db02[_0x4857('0x52')][_0x4857('0x73')][_0x4857('0x66')];_0x1f7692+=0x1){socket['emit'](_0x4857('0x88'),{'UserId':Number(_0x16db02[_0x4857('0x52')][_0x4857('0x73')][_0x1f7692]),'WhatsappQueueId':Number(_0x16db02['params']['id'])});}return _0x1802b8;});}})['then'](respondWithResult(_0x3c1136,null))[_0x4857('0x4a')](handleError(_0x3c1136,null));};exports[_0x4857('0x83')]=function(_0x519f6d,_0x412713,_0x115a95){return db['WhatsappQueue']['find']({'where':{'id':_0x519f6d[_0x4857('0x48')]['id']}})[_0x4857('0x25')](handleEntityNotFound(_0x412713,null))[_0x4857('0x25')](function(_0x3969e8){if(_0x3969e8){return _0x3969e8[_0x4857('0x83')](_0x519f6d['query'][_0x4857('0x73')])['then'](function(){if(_['isArray'](_0x519f6d[_0x4857('0x38')][_0x4857('0x73')])){for(var _0x259d03=0x0;_0x259d03<_0x519f6d[_0x4857('0x38')][_0x4857('0x73')][_0x4857('0x66')];_0x259d03+=0x1){socket[_0x4857('0x71')]('userWhatsappQueue:remove',{'UserId':Number(_0x519f6d[_0x4857('0x38')][_0x4857('0x73')][_0x259d03]),'WhatsappQueueId':Number(_0x519f6d[_0x4857('0x48')]['id'])});}}else{socket[_0x4857('0x71')](_0x4857('0x84'),{'UserId':Number(_0x519f6d[_0x4857('0x38')][_0x4857('0x73')]),'WhatsappQueueId':Number(_0x519f6d[_0x4857('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x412713,null))[_0x4857('0x4a')](handleError(_0x412713,null));};exports['getAgents']=function(_0x153a34,_0x3f7efa,_0x1364be){var _0x2b2a9e={};var _0x28bc4b={};var _0x26a3e3;var _0x238049;return db['WhatsappQueue']['findOne']({'where':{'id':_0x153a34[_0x4857('0x48')]['id']}})[_0x4857('0x25')](handleEntityNotFound(_0x3f7efa,null))['then'](function(_0x15a7c2){if(_0x15a7c2){_0x26a3e3=_0x15a7c2;_0x28bc4b[_0x4857('0x35')]=_[_0x4857('0x37')](db[_0x4857('0x5a')][_0x4857('0x31')]);_0x28bc4b[_0x4857('0x38')]=_['keys'](_0x153a34['query']);_0x28bc4b[_0x4857('0x3f')]=_[_0x4857('0x39')](_0x28bc4b['model'],_0x28bc4b[_0x4857('0x38')]);_0x2b2a9e[_0x4857('0x3b')]=_[_0x4857('0x39')](_0x28bc4b[_0x4857('0x35')],qs[_0x4857('0x3a')](_0x153a34['query'][_0x4857('0x3a')]));_0x2b2a9e[_0x4857('0x3b')]=_0x2b2a9e[_0x4857('0x3b')][_0x4857('0x66')]?_0x2b2a9e[_0x4857('0x3b')]:_0x28bc4b[_0x4857('0x35')];_0x2b2a9e[_0x4857('0x58')]=qs[_0x4857('0x3d')](_0x153a34['query'][_0x4857('0x3d')]);_0x2b2a9e[_0x4857('0x3e')]=qs['filters'](_['pick'](_0x153a34[_0x4857('0x38')],_0x28bc4b['filters']));if(_0x153a34[_0x4857('0x38')][_0x4857('0x40')]){_0x2b2a9e[_0x4857('0x3e')]=_['merge'](_0x2b2a9e[_0x4857('0x3e')],{'$or':_[_0x4857('0x36')](_0x2b2a9e[_0x4857('0x3b')],function(_0x23c2bb){var _0x33a80f={};_0x33a80f[_0x23c2bb]={'$like':'%'+_0x153a34[_0x4857('0x38')]['filter']+'%'};return _0x33a80f;})});}_0x2b2a9e=_['merge']({},_0x2b2a9e,_0x153a34['options']);return _0x26a3e3[_0x4857('0x89')](_0x2b2a9e);}})[_0x4857('0x25')](function(_0x1fce9f){if(_0x1fce9f){_0x238049=_0x1fce9f['length'];if(!_0x153a34[_0x4857('0x38')]['hasOwnProperty'](_0x4857('0x3c'))){_0x2b2a9e['limit']=qs[_0x4857('0x1d')](_0x153a34['query'][_0x4857('0x1d')]);_0x2b2a9e[_0x4857('0x1b')]=qs[_0x4857('0x1b')](_0x153a34[_0x4857('0x38')][_0x4857('0x1b')]);}return _0x26a3e3['getAgents'](_0x2b2a9e);}})[_0x4857('0x25')](function(_0x3d77f9){if(_0x3d77f9){return _0x3d77f9?{'count':_0x238049,'rows':_0x3d77f9}:null;}})[_0x4857('0x25')](respondWithResult(_0x3f7efa,null))[_0x4857('0x4a')](handleError(_0x3f7efa,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 0e2bba4..e9b25fd 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 _0x2e71=['events','setMaxListeners','save','update','emit','hook','exports'];(function(_0x33166b,_0x3b835e){var _0xf43735=function(_0x512675){while(--_0x512675){_0x33166b['push'](_0x33166b['shift']());}};_0xf43735(++_0x3b835e);}(_0x2e71,0x9a));var _0x12e7=function(_0x3ec1da,_0x1e36f5){_0x3ec1da=_0x3ec1da-0x0;var _0x472358=_0x2e71[_0x3ec1da];return _0x472358;};'use strict';var EventEmitter=require(_0x12e7('0x0'));var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x12e7('0x1')](0x0);var events={'afterCreate':_0x12e7('0x2'),'afterUpdate':_0x12e7('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4f757a){return function(_0x5c0f2d,_0x3b008e,_0x2ed677){WhatsappQueueEvents[_0x12e7('0x4')](_0x4f757a+':'+_0x5c0f2d['id'],_0x5c0f2d);WhatsappQueueEvents[_0x12e7('0x4')](_0x4f757a,_0x5c0f2d);_0x2ed677(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x12e7('0x5')](e,emitEvent(event));}}module[_0x12e7('0x6')]=WhatsappQueueEvents; \ No newline at end of file +var _0x6f8b=['remove','emit','hasOwnProperty','exports','WhatsappQueue','save'];(function(_0x428220,_0x4c383c){var _0x5d9fac=function(_0x14777f){while(--_0x14777f){_0x428220['push'](_0x428220['shift']());}};_0x5d9fac(++_0x4c383c);}(_0x6f8b,0x112));var _0xb6f8=function(_0x3dc874,_0x5ee037){_0x3dc874=_0x3dc874-0x0;var _0x23bd94=_0x6f8b[_0x3dc874];return _0x23bd94;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db'][_0xb6f8('0x0')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb6f8('0x1'),'afterUpdate':'update','afterDestroy':_0xb6f8('0x2')};function emitEvent(_0x60441c){return function(_0x3ab037,_0xa145d0,_0x161954){WhatsappQueueEvents[_0xb6f8('0x3')](_0x60441c+':'+_0x3ab037['id'],_0x3ab037);WhatsappQueueEvents[_0xb6f8('0x3')](_0x60441c,_0x3ab037);_0x161954(null);};}for(var e in events){if(events[_0xb6f8('0x4')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xb6f8('0x5')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 90eb21e..d6868ac 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 _0xbaa4=['whatsapp_queues','lodash','api','bluebird','path','rimraf','./whatsappQueue.attributes','WhatsappQueue'];(function(_0x5c63c0,_0x50ca46){var _0x1053e8=function(_0x12a937){while(--_0x12a937){_0x5c63c0['push'](_0x5c63c0['shift']());}};_0x1053e8(++_0x50ca46);}(_0xbaa4,0xb9));var _0x4baa=function(_0x3f3d9e,_0x11ee96){_0x3f3d9e=_0x3f3d9e-0x0;var _0x4d129a=_0xbaa4[_0x3f3d9e];return _0x4d129a;};'use strict';var _=require(_0x4baa('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4baa('0x1'));var moment=require('moment');var BPromise=require(_0x4baa('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4baa('0x3'));var rimraf=require(_0x4baa('0x4'));var config=require('../../config/environment');var attributes=require(_0x4baa('0x5'));module['exports']=function(_0x33f808,_0x24ab91){return _0x33f808['define'](_0x4baa('0x6'),attributes,{'tableName':_0x4baa('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfeb5=['../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x4c33fd,_0x4ec65){var _0x33cb98=function(_0x4f491c){while(--_0x4f491c){_0x4c33fd['push'](_0x4c33fd['shift']());}};_0x33cb98(++_0x4ec65);}(_0xfeb5,0x172));var _0x5feb=function(_0xe5b539,_0x467802){_0xe5b539=_0xe5b539-0x0;var _0x4bd185=_0xfeb5[_0xe5b539];return _0x4bd185;};'use strict';var _=require('lodash');var util=require(_0x5feb('0x0'));var logger=require(_0x5feb('0x1'))(_0x5feb('0x2'));var moment=require(_0x5feb('0x3'));var BPromise=require(_0x5feb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5feb('0x5'));var rimraf=require(_0x5feb('0x6'));var config=require(_0x5feb('0x7'));var attributes=require(_0x5feb('0x8'));module[_0x5feb('0x9')]=function(_0x1908f9,_0x23c4da){return _0x1908f9[_0x5feb('0xa')](_0x5feb('0xb'),attributes,{'tableName':_0x5feb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index cee9f8e..cccfb2f 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 _0x86aa=['WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappQueue,\x20%s,\x20%s','result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','limit','include','map','model','attributes','catch','ShowWhatsappQueue','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','register','then','info','request\x20sent','debug'];(function(_0x1709e3,_0x53bcdf){var _0x28683f=function(_0x12c0a4){while(--_0x12c0a4){_0x1709e3['push'](_0x1709e3['shift']());}};_0x28683f(++_0x53bcdf);}(_0x86aa,0x86));var _0xa86a=function(_0x11967c,_0x35b040){_0x11967c=_0x11967c-0x0;var _0xb958aa=_0x86aa[_0x11967c];return _0xb958aa;};'use strict';var _=require(_0xa86a('0x0'));var util=require(_0xa86a('0x1'));var moment=require('moment');var BPromise=require(_0xa86a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa86a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa86a('0x4'));var logger=require(_0xa86a('0x5'))(_0xa86a('0x6'));var config=require(_0xa86a('0x7'));var jayson=require(_0xa86a('0x8'));var client=jayson[_0xa86a('0x9')]['http']({'port':0x232a});config[_0xa86a('0xa')]=_[_0xa86a('0xb')](config[_0xa86a('0xa')],{'host':_0xa86a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa86a('0xa')]));require('./whatsappQueue.socket')[_0xa86a('0xd')](socket);function respondWithRpcPromise(_0x2a5a58,_0x3c57f5,_0x33b5ca){return new BPromise(function(_0x5d40d4,_0x108b78){return client['request'](_0x2a5a58,_0x33b5ca)[_0xa86a('0xe')](function(_0x416846){logger[_0xa86a('0xf')]('WhatsappQueue,\x20%s,\x20%s',_0x3c57f5,_0xa86a('0x10'));logger[_0xa86a('0x11')](_0xa86a('0x12'),_0x3c57f5,'request\x20sent',JSON[_0xa86a('0x13')](_0x416846));if(_0x416846[_0xa86a('0x14')]){if(_0x416846[_0xa86a('0x14')][_0xa86a('0x15')]===0x1f4){logger[_0xa86a('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x3c57f5,_0x416846[_0xa86a('0x14')][_0xa86a('0x16')]);return _0x108b78(_0x416846['error']['message']);}logger[_0xa86a('0x14')](_0xa86a('0x17'),_0x3c57f5,_0x416846[_0xa86a('0x14')][_0xa86a('0x16')]);return _0x5d40d4(_0x416846['error'][_0xa86a('0x16')]);}else{logger[_0xa86a('0xf')]('WhatsappQueue,\x20%s,\x20%s',_0x3c57f5,_0xa86a('0x10'));_0x5d40d4(_0x416846[_0xa86a('0x18')]['message']);}})['catch'](function(_0x588659){logger[_0xa86a('0x14')](_0xa86a('0x17'),_0x3c57f5,_0x588659);_0x108b78(_0x588659);});});}exports[_0xa86a('0x19')]=function(_0x2ef8fa){var _0x476b42=this;return new Promise(function(_0x3db51a,_0x1e968e){return db[_0xa86a('0x1a')][_0xa86a('0x1b')]({'raw':_0x2ef8fa[_0xa86a('0x1c')]?_0x2ef8fa[_0xa86a('0x1c')][_0xa86a('0x1d')]===undefined?!![]:![]:!![],'where':_0x2ef8fa[_0xa86a('0x1c')]?_0x2ef8fa[_0xa86a('0x1c')][_0xa86a('0x1e')]||null:null,'attributes':_0x2ef8fa[_0xa86a('0x1c')]?_0x2ef8fa[_0xa86a('0x1c')]['attributes']||null:null,'limit':_0x2ef8fa[_0xa86a('0x1c')]?_0x2ef8fa['options'][_0xa86a('0x1f')]||null:null,'include':_0x2ef8fa['options']?_0x2ef8fa['options'][_0xa86a('0x20')]?_[_0xa86a('0x21')](_0x2ef8fa[_0xa86a('0x1c')][_0xa86a('0x20')],function(_0x266ca5){return{'model':db[_0x266ca5[_0xa86a('0x22')]],'as':_0x266ca5['as'],'attributes':_0x266ca5[_0xa86a('0x23')],'include':_0x266ca5['include']?_[_0xa86a('0x21')](_0x266ca5['include'],function(_0x18cd6d){return{'model':db[_0x18cd6d[_0xa86a('0x22')]],'as':_0x18cd6d['as'],'attributes':_0x18cd6d[_0xa86a('0x23')],'include':_0x18cd6d[_0xa86a('0x20')]?_['map'](_0x18cd6d[_0xa86a('0x20')],function(_0xfe9270){return{'model':db[_0xfe9270[_0xa86a('0x22')]],'as':_0xfe9270['as'],'attributes':_0xfe9270[_0xa86a('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e97d9){logger[_0xa86a('0xf')](_0xa86a('0x19'),_0x2ef8fa);logger[_0xa86a('0x11')](_0xa86a('0x19'),_0x2ef8fa,JSON[_0xa86a('0x13')](_0x4e97d9));_0x3db51a(_0x4e97d9);})[_0xa86a('0x24')](function(_0x238ead){logger[_0xa86a('0x14')](_0xa86a('0x19'),_0x238ead[_0xa86a('0x16')],_0x2ef8fa);_0x1e968e(_0x476b42['error'](0x1f4,_0x238ead[_0xa86a('0x16')]));});});};exports[_0xa86a('0x25')]=function(_0x2e2895){var _0x196809=this;return new Promise(function(_0x349eaf,_0x323024){return db[_0xa86a('0x1a')]['find']({'raw':_0x2e2895[_0xa86a('0x1c')]?_0x2e2895[_0xa86a('0x1c')][_0xa86a('0x1d')]===undefined?!![]:![]:!![],'where':_0x2e2895[_0xa86a('0x1c')]?_0x2e2895[_0xa86a('0x1c')][_0xa86a('0x1e')]||null:null,'attributes':_0x2e2895[_0xa86a('0x1c')]?_0x2e2895['options'][_0xa86a('0x23')]||null:null,'include':_0x2e2895[_0xa86a('0x1c')]?_0x2e2895[_0xa86a('0x1c')][_0xa86a('0x20')]?_[_0xa86a('0x21')](_0x2e2895[_0xa86a('0x1c')][_0xa86a('0x20')],function(_0x5889a1){return{'model':db[_0x5889a1[_0xa86a('0x22')]],'as':_0x5889a1['as'],'attributes':_0x5889a1[_0xa86a('0x23')],'include':_0x5889a1['include']?_[_0xa86a('0x21')](_0x5889a1[_0xa86a('0x20')],function(_0x59cfde){return{'model':db[_0x59cfde[_0xa86a('0x22')]],'as':_0x59cfde['as'],'attributes':_0x59cfde['attributes'],'include':_0x59cfde['include']?_['map'](_0x59cfde[_0xa86a('0x20')],function(_0x5d40d0){return{'model':db[_0x5d40d0[_0xa86a('0x22')]],'as':_0x5d40d0['as'],'attributes':_0x5d40d0['attributes']};}):[]};}):[]};}):[]:[]})[_0xa86a('0xe')](function(_0x2464fa){logger[_0xa86a('0xf')](_0xa86a('0x25'),_0x2e2895);logger['debug']('ShowWhatsappQueue',_0x2e2895,JSON[_0xa86a('0x13')](_0x2464fa));_0x349eaf(_0x2464fa);})['catch'](function(_0xd86694){logger[_0xa86a('0x14')](_0xa86a('0x25'),_0xd86694[_0xa86a('0x16')],_0x2e2895);_0x323024(_0x196809[_0xa86a('0x14')](0x1f4,_0xd86694['message']));});});}; \ No newline at end of file +var _0x0be0=['lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetWhatsappQueue','findAll','options','where','include','model','attributes','map','then','info','WhatsappQueue','find','ShowWhatsappQueue'];(function(_0xacb5cb,_0x1cdd12){var _0x272275=function(_0xb46a40){while(--_0xb46a40){_0xacb5cb['push'](_0xacb5cb['shift']());}};_0x272275(++_0x1cdd12);}(_0x0be0,0x17c));var _0x00be=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x0be0[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0x00be('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x00be('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x00be('0x2'));var db=require(_0x00be('0x3'))['db'];var utils=require(_0x00be('0x4'));var logger=require(_0x00be('0x5'))('rpc');var config=require(_0x00be('0x6'));var jayson=require(_0x00be('0x7'));var client=jayson['client'][_0x00be('0x8')]({'port':0x232a});config[_0x00be('0x9')]=_[_0x00be('0xa')](config['redis'],{'host':_0x00be('0xb'),'port':0x18eb});var socket=require(_0x00be('0xc'))(new Redis(config[_0x00be('0x9')]));require(_0x00be('0xd'))[_0x00be('0xe')](socket);function respondWithRpcPromise(_0x219855,_0x17f0e4,_0x5adab3){return new BPromise(function(_0x19a658,_0x4cd378){return client['request'](_0x219855,_0x5adab3)['then'](function(_0x55e2f2){logger['info'](_0x00be('0xf'),_0x17f0e4,'request\x20sent');logger[_0x00be('0x10')](_0x00be('0x11'),_0x17f0e4,'request\x20sent',JSON[_0x00be('0x12')](_0x55e2f2));if(_0x55e2f2[_0x00be('0x13')]){if(_0x55e2f2[_0x00be('0x13')][_0x00be('0x14')]===0x1f4){logger[_0x00be('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x17f0e4,_0x55e2f2[_0x00be('0x13')][_0x00be('0x15')]);return _0x4cd378(_0x55e2f2['error'][_0x00be('0x15')]);}logger[_0x00be('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x17f0e4,_0x55e2f2[_0x00be('0x13')]['message']);return _0x19a658(_0x55e2f2['error']['message']);}else{logger['info'](_0x00be('0xf'),_0x17f0e4,_0x00be('0x16'));_0x19a658(_0x55e2f2[_0x00be('0x17')]['message']);}})[_0x00be('0x18')](function(_0x160fa1){logger[_0x00be('0x13')](_0x00be('0xf'),_0x17f0e4,_0x160fa1);_0x4cd378(_0x160fa1);});});}exports[_0x00be('0x19')]=function(_0x34d542){var _0x30abeb=this;return new Promise(function(_0x5bbe5f,_0x563faf){return db['WhatsappQueue'][_0x00be('0x1a')]({'raw':_0x34d542[_0x00be('0x1b')]?_0x34d542[_0x00be('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x34d542[_0x00be('0x1b')]?_0x34d542[_0x00be('0x1b')][_0x00be('0x1c')]||null:null,'attributes':_0x34d542[_0x00be('0x1b')]?_0x34d542[_0x00be('0x1b')]['attributes']||null:null,'limit':_0x34d542[_0x00be('0x1b')]?_0x34d542[_0x00be('0x1b')]['limit']||null:null,'include':_0x34d542['options']?_0x34d542['options'][_0x00be('0x1d')]?_['map'](_0x34d542[_0x00be('0x1b')][_0x00be('0x1d')],function(_0x22fcf4){return{'model':db[_0x22fcf4[_0x00be('0x1e')]],'as':_0x22fcf4['as'],'attributes':_0x22fcf4['attributes'],'include':_0x22fcf4[_0x00be('0x1d')]?_['map'](_0x22fcf4['include'],function(_0xf62900){return{'model':db[_0xf62900[_0x00be('0x1e')]],'as':_0xf62900['as'],'attributes':_0xf62900[_0x00be('0x1f')],'include':_0xf62900['include']?_[_0x00be('0x20')](_0xf62900[_0x00be('0x1d')],function(_0x312b7d){return{'model':db[_0x312b7d[_0x00be('0x1e')]],'as':_0x312b7d['as'],'attributes':_0x312b7d[_0x00be('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x00be('0x21')](function(_0x23e112){logger[_0x00be('0x22')](_0x00be('0x19'),_0x34d542);logger[_0x00be('0x10')](_0x00be('0x19'),_0x34d542,JSON[_0x00be('0x12')](_0x23e112));_0x5bbe5f(_0x23e112);})['catch'](function(_0xa87537){logger[_0x00be('0x13')](_0x00be('0x19'),_0xa87537['message'],_0x34d542);_0x563faf(_0x30abeb[_0x00be('0x13')](0x1f4,_0xa87537[_0x00be('0x15')]));});});};exports['ShowWhatsappQueue']=function(_0x23d408){var _0x3676fc=this;return new Promise(function(_0x4d4359,_0x54ff46){return db[_0x00be('0x23')][_0x00be('0x24')]({'raw':_0x23d408[_0x00be('0x1b')]?_0x23d408[_0x00be('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x23d408[_0x00be('0x1b')]?_0x23d408['options'][_0x00be('0x1c')]||null:null,'attributes':_0x23d408[_0x00be('0x1b')]?_0x23d408[_0x00be('0x1b')][_0x00be('0x1f')]||null:null,'include':_0x23d408[_0x00be('0x1b')]?_0x23d408['options']['include']?_[_0x00be('0x20')](_0x23d408[_0x00be('0x1b')][_0x00be('0x1d')],function(_0x3bcf59){return{'model':db[_0x3bcf59[_0x00be('0x1e')]],'as':_0x3bcf59['as'],'attributes':_0x3bcf59[_0x00be('0x1f')],'include':_0x3bcf59[_0x00be('0x1d')]?_['map'](_0x3bcf59['include'],function(_0x15cb91){return{'model':db[_0x15cb91[_0x00be('0x1e')]],'as':_0x15cb91['as'],'attributes':_0x15cb91['attributes'],'include':_0x15cb91[_0x00be('0x1d')]?_['map'](_0x15cb91[_0x00be('0x1d')],function(_0x5689fe){return{'model':db[_0x5689fe['model']],'as':_0x5689fe['as'],'attributes':_0x5689fe['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x17beb6){logger[_0x00be('0x22')]('ShowWhatsappQueue',_0x23d408);logger[_0x00be('0x10')](_0x00be('0x25'),_0x23d408,JSON[_0x00be('0x12')](_0x17beb6));_0x4d4359(_0x17beb6);})[_0x00be('0x18')](function(_0x1c9e9b){logger[_0x00be('0x13')]('ShowWhatsappQueue',_0x1c9e9b[_0x00be('0x15')],_0x23d408);_0x54ff46(_0x3676fc[_0x00be('0x13')](0x1f4,_0x1c9e9b['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 735165e..ebda445 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 _0xa9c3=['length','whatsappQueue:','./whatsappQueue.events','save','remove','update','emit','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9c3,0xb2));var _0x3a9c=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0xa9c3[_0xda464c];return _0x19e222;};'use strict';var WhatsappQueueEvents=require(_0x3a9c('0x0'));var events=[_0x3a9c('0x1'),_0x3a9c('0x2'),_0x3a9c('0x3')];function createListener(_0x338ae9,_0x2930bc){return function(_0x235cb2){_0x2930bc[_0x3a9c('0x4')](_0x338ae9,_0x235cb2);};}function removeListener(_0x54d2f1,_0x426579){return function(){WhatsappQueueEvents['removeListener'](_0x54d2f1,_0x426579);};}exports[_0x3a9c('0x5')]=function(_0x3373b2){for(var _0x1b2905=0x0,_0x3faa8e=events[_0x3a9c('0x6')];_0x1b2905<_0x3faa8e;_0x1b2905++){var _0x1f1978=events[_0x1b2905];var _0x29d634=createListener(_0x3a9c('0x7')+_0x1f1978,_0x3373b2);WhatsappQueueEvents['on'](_0x1f1978,_0x29d634);}}; \ No newline at end of file +var _0xb524=['register','length','save','update','emit'];(function(_0x76195,_0x58d0f9){var _0x1994e8=function(_0x1c00f9){while(--_0x1c00f9){_0x76195['push'](_0x76195['shift']());}};_0x1994e8(++_0x58d0f9);}(_0xb524,0x183));var _0x4b52=function(_0x324375,_0x452529){_0x324375=_0x324375-0x0;var _0x1f5239=_0xb524[_0x324375];return _0x1f5239;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x4b52('0x0'),'remove',_0x4b52('0x1')];function createListener(_0x47c108,_0x8bc474){return function(_0x1e7c36){_0x8bc474[_0x4b52('0x2')](_0x47c108,_0x1e7c36);};}function removeListener(_0x4aa162,_0x98941e){return function(){WhatsappQueueEvents['removeListener'](_0x4aa162,_0x98941e);};}exports[_0x4b52('0x3')]=function(_0x5935e8){for(var _0x12cc64=0x0,_0x2eadd6=events[_0x4b52('0x4')];_0x12cc64<_0x2eadd6;_0x12cc64++){var _0x277508=events[_0x12cc64];var _0x274cc2=createListener('whatsappQueue:'+_0x277508,_0x5935e8);WhatsappQueueEvents['on'](_0x277508,_0x274cc2);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 14f3344..2b1a23a 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 _0xd0fa=['describe','/:id','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','get','/describe'];(function(_0x3ae192,_0x379373){var _0x1d81b9=function(_0x488b6c){while(--_0x488b6c){_0x3ae192['push'](_0x3ae192['shift']());}};_0x1d81b9(++_0x379373);}(_0xd0fa,0x1ab));var _0xad0f=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xd0fa[_0x68c979];return _0x4f0001;};'use strict';var multer=require(_0xad0f('0x0'));var util=require('util');var path=require(_0xad0f('0x1'));var timeout=require(_0xad0f('0x2'));var express=require(_0xad0f('0x3'));var router=express[_0xad0f('0x4')]();var fs_extra=require(_0xad0f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xad0f('0x6'));var config=require(_0xad0f('0x7'));var controller=require(_0xad0f('0x8'));router['get']('/',auth[_0xad0f('0x9')](),controller[_0xad0f('0xa')]);router[_0xad0f('0xb')](_0xad0f('0xc'),auth[_0xad0f('0x9')](),controller[_0xad0f('0xd')]);router[_0xad0f('0xb')](_0xad0f('0xe'),auth[_0xad0f('0x9')](),controller[_0xad0f('0xf')]);router[_0xad0f('0x10')]('/',auth['isAuthenticated'](),controller[_0xad0f('0x11')]);router['put'](_0xad0f('0xe'),auth['isAuthenticated'](),controller[_0xad0f('0x12')]);router[_0xad0f('0x13')](_0xad0f('0xe'),auth[_0xad0f('0x9')](),controller[_0xad0f('0x14')]);module[_0xad0f('0x15')]=router; \ No newline at end of file +var _0x5254=['create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post'];(function(_0x80efcb,_0x4ac9a1){var _0x959e68=function(_0x119a25){while(--_0x119a25){_0x80efcb['push'](_0x80efcb['shift']());}};_0x959e68(++_0x4ac9a1);}(_0x5254,0x1d3));var _0x4525=function(_0x359377,_0x1a63ef){_0x359377=_0x359377-0x0;var _0x8be18a=_0x5254[_0x359377];return _0x8be18a;};'use strict';var multer=require(_0x4525('0x0'));var util=require(_0x4525('0x1'));var path=require(_0x4525('0x2'));var timeout=require(_0x4525('0x3'));var express=require(_0x4525('0x4'));var router=express['Router']();var fs_extra=require(_0x4525('0x5'));var auth=require(_0x4525('0x6'));var interaction=require(_0x4525('0x7'));var config=require('../../config/environment');var controller=require(_0x4525('0x8'));router[_0x4525('0x9')]('/',auth[_0x4525('0xa')](),controller[_0x4525('0xb')]);router[_0x4525('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x4525('0xc')]);router[_0x4525('0x9')](_0x4525('0xd'),auth[_0x4525('0xa')](),controller[_0x4525('0xe')]);router[_0x4525('0xf')]('/',auth[_0x4525('0xa')](),controller[_0x4525('0x10')]);router[_0x4525('0x11')](_0x4525('0xd'),auth['isAuthenticated'](),controller[_0x4525('0x12')]);router[_0x4525('0x13')](_0x4525('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x4525('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 0dc2c57..5d72f1d 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(_0x50b447,_0x4daf47){var _0x4a8a17=function(_0x1258f0){while(--_0x1258f0){_0x50b447['push'](_0x50b447['shift']());}};_0x4a8a17(++_0x4daf47);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x497573,_0x424abd){var _0x4a5eab=function(_0x2774c2){while(--_0x2774c2){_0x497573['push'](_0x497573['shift']());}};_0x4a5eab(++_0x424abd);}(_0x7a54,0x106));var _0x47a5=function(_0x3600b9,_0x3f1d07){_0x3600b9=_0x3600b9-0x0;var _0x5a1cc8=_0x7a54[_0x3600b9];return _0x5a1cc8;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index aa1c7a4..02d50f7 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 _0x8f59=['../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','find','create','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service'];(function(_0x5427b4,_0x1bf134){var _0x42f900=function(_0x5da37a){while(--_0x5da37a){_0x5427b4['push'](_0x5427b4['shift']());}};_0x42f900(++_0x1bf134);}(_0x8f59,0x11d));var _0x98f5=function(_0xfed19f,_0x510931){_0xfed19f=_0xfed19f-0x0;var _0x507042=_0x8f59[_0xfed19f];return _0x507042;};'use strict';var emlformat=require(_0x98f5('0x0'));var rimraf=require(_0x98f5('0x1'));var zipdir=require(_0x98f5('0x2'));var jsonpatch=require(_0x98f5('0x3'));var rp=require(_0x98f5('0x4'));var moment=require(_0x98f5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x98f5('0x6'));var util=require(_0x98f5('0x7'));var path=require(_0x98f5('0x8'));var sox=require(_0x98f5('0x9'));var csv=require('to-csv');var ejs=require(_0x98f5('0xa'));var fs=require('fs');var fs_extra=require(_0x98f5('0xb'));var _=require(_0x98f5('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x98f5('0xd'));var deskjs=require(_0x98f5('0xe'));var toCsv=require(_0x98f5('0xf'));var querystring=require('querystring');var Papa=require(_0x98f5('0x10'));var Redis=require(_0x98f5('0x11'));var authService=require(_0x98f5('0x12'));var qs=require(_0x98f5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98f5('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x98f5('0x15'));var config=require(_0x98f5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x98f5('0x17'))['db'];function respondWithStatusCode(_0x259abe,_0x1f00e8){_0x1f00e8=_0x1f00e8||0xcc;return function(_0x160626){if(_0x160626){return _0x259abe[_0x98f5('0x18')](_0x1f00e8);}return _0x259abe[_0x98f5('0x19')](_0x1f00e8)['end']();};}function respondWithResult(_0x24a7a9,_0xbade31){_0xbade31=_0xbade31||0xc8;return function(_0x5b8bab){if(_0x5b8bab){return _0x24a7a9[_0x98f5('0x19')](_0xbade31)[_0x98f5('0x1a')](_0x5b8bab);}};}function respondWithFilteredResult(_0xaa951a,_0x4ae70d){return function(_0x2437e7){if(_0x2437e7){var _0xc7a49b=typeof _0x4ae70d[_0x98f5('0x1b')]==='undefined'&&typeof _0x4ae70d[_0x98f5('0x1c')]===_0x98f5('0x1d');var _0x574644=_0x2437e7[_0x98f5('0x1e')];var _0x51a567=_0xc7a49b?0x0:_0x4ae70d[_0x98f5('0x1b')];var _0x9e42dd=_0xc7a49b?_0x2437e7[_0x98f5('0x1e')]:_0x4ae70d[_0x98f5('0x1b')]+_0x4ae70d[_0x98f5('0x1c')];var _0xa4477c;if(_0x9e42dd>=_0x574644){_0x9e42dd=_0x574644;_0xa4477c=0xc8;}else{_0xa4477c=0xce;}_0xaa951a['status'](_0xa4477c);return _0xaa951a[_0x98f5('0x1f')]('Content-Range',_0x51a567+'-'+_0x9e42dd+'/'+_0x574644)[_0x98f5('0x1a')](_0x2437e7);}return null;};}function patchUpdates(_0x191f23){return function(_0x5deca0){try{jsonpatch[_0x98f5('0x20')](_0x5deca0,_0x191f23,!![]);}catch(_0x2933d1){return BPromise[_0x98f5('0x21')](_0x2933d1);}return _0x5deca0[_0x98f5('0x22')]();};}function saveUpdates(_0x3b2d9d,_0x3dc7c2){return function(_0x38b46d){if(_0x38b46d){return _0x38b46d['update'](_0x3b2d9d)[_0x98f5('0x23')](function(_0x49ee4e){return _0x49ee4e;});}return null;};}function removeEntity(_0xcb10d6,_0x495889){return function(_0x44bfbb){if(_0x44bfbb){return _0x44bfbb[_0x98f5('0x24')]()[_0x98f5('0x23')](function(){_0xcb10d6[_0x98f5('0x19')](0xcc)[_0x98f5('0x25')]();});}};}function handleEntityNotFound(_0x18052d,_0x46dbd4){return function(_0x58d506){if(!_0x58d506){_0x18052d[_0x98f5('0x18')](0x194);}return _0x58d506;};}function handleError(_0x2b80a1,_0x5d7423){_0x5d7423=_0x5d7423||0x1f4;return function(_0x1a1c55){logger[_0x98f5('0x26')](_0x1a1c55[_0x98f5('0x27')]);if(_0x1a1c55[_0x98f5('0x28')]){delete _0x1a1c55[_0x98f5('0x28')];}_0x2b80a1[_0x98f5('0x19')](_0x5d7423)[_0x98f5('0x29')](_0x1a1c55);};}exports[_0x98f5('0x2a')]=function(_0x576c4b,_0x4c10b8){var _0x428c85={},_0x71661e={},_0x18bb29={'count':0x0,'rows':[]};var _0x209d15=_[_0x98f5('0x2b')](db[_0x98f5('0x2c')]['rawAttributes'],function(_0x29e1f5){return{'name':_0x29e1f5[_0x98f5('0x2d')],'type':_0x29e1f5[_0x98f5('0x2e')][_0x98f5('0x2f')]};});_0x71661e[_0x98f5('0x30')]=_[_0x98f5('0x2b')](_0x209d15,'name');_0x71661e[_0x98f5('0x31')]=_[_0x98f5('0x32')](_0x576c4b[_0x98f5('0x31')]);_0x71661e[_0x98f5('0x33')]=_['intersection'](_0x71661e[_0x98f5('0x30')],_0x71661e[_0x98f5('0x31')]);_0x428c85[_0x98f5('0x34')]=_[_0x98f5('0x35')](_0x71661e[_0x98f5('0x30')],qs[_0x98f5('0x36')](_0x576c4b[_0x98f5('0x31')][_0x98f5('0x36')]));_0x428c85[_0x98f5('0x34')]=_0x428c85[_0x98f5('0x34')][_0x98f5('0x37')]?_0x428c85[_0x98f5('0x34')]:_0x71661e[_0x98f5('0x30')];if(!_0x576c4b[_0x98f5('0x31')][_0x98f5('0x38')](_0x98f5('0x39'))){_0x428c85[_0x98f5('0x1c')]=qs[_0x98f5('0x1c')](_0x576c4b[_0x98f5('0x31')][_0x98f5('0x1c')]);_0x428c85['offset']=qs[_0x98f5('0x1b')](_0x576c4b['query']['offset']);}_0x428c85[_0x98f5('0x3a')]=qs[_0x98f5('0x3b')](_0x576c4b[_0x98f5('0x31')][_0x98f5('0x3b')]);_0x428c85['where']=qs[_0x98f5('0x33')](_[_0x98f5('0x3c')](_0x576c4b[_0x98f5('0x31')],_0x71661e['filters']),_0x209d15);if(_0x576c4b[_0x98f5('0x31')][_0x98f5('0x3d')]){_0x428c85['where']=_[_0x98f5('0x3e')](_0x428c85[_0x98f5('0x3f')],{'$or':_[_0x98f5('0x2b')](_0x209d15,function(_0x580f19){if(_0x580f19[_0x98f5('0x2e')]!==_0x98f5('0x40')){var _0x19f045={};_0x19f045[_0x580f19[_0x98f5('0x28')]]={'$like':'%'+_0x576c4b[_0x98f5('0x31')]['filter']+'%'};return _0x19f045;}})});}_0x428c85=_['merge']({},_0x428c85,_0x576c4b[_0x98f5('0x41')]);var _0x14faf2={'where':_0x428c85[_0x98f5('0x3f')]};return db[_0x98f5('0x2c')][_0x98f5('0x1e')](_0x14faf2)[_0x98f5('0x23')](function(_0x58064e){_0x18bb29['count']=_0x58064e;if(_0x576c4b[_0x98f5('0x31')][_0x98f5('0x42')]){_0x428c85[_0x98f5('0x43')]=[{'all':!![]}];}return db[_0x98f5('0x2c')]['findAll'](_0x428c85);})['then'](function(_0x2dafcd){_0x18bb29[_0x98f5('0x44')]=_0x2dafcd;return _0x18bb29;})[_0x98f5('0x23')](respondWithFilteredResult(_0x4c10b8,_0x428c85))[_0x98f5('0x45')](handleError(_0x4c10b8,null));};exports['show']=function(_0x51ae92,_0x3db067){var _0x3a191f={'raw':!![],'where':{'id':_0x51ae92['params']['id']}},_0x372c33={};_0x372c33[_0x98f5('0x30')]=_['keys'](db[_0x98f5('0x2c')]['rawAttributes']);_0x372c33[_0x98f5('0x31')]=_[_0x98f5('0x32')](_0x51ae92[_0x98f5('0x31')]);_0x372c33['filters']=_[_0x98f5('0x35')](_0x372c33[_0x98f5('0x30')],_0x372c33['query']);_0x3a191f[_0x98f5('0x34')]=_[_0x98f5('0x35')](_0x372c33['model'],qs[_0x98f5('0x36')](_0x51ae92['query'][_0x98f5('0x36')]));_0x3a191f[_0x98f5('0x34')]=_0x3a191f['attributes']['length']?_0x3a191f['attributes']:_0x372c33['model'];if(_0x51ae92[_0x98f5('0x31')]['includeAll']){_0x3a191f[_0x98f5('0x43')]=[{'all':!![]}];}_0x3a191f=_[_0x98f5('0x3e')]({},_0x3a191f,_0x51ae92[_0x98f5('0x41')]);return db[_0x98f5('0x2c')][_0x98f5('0x46')](_0x3a191f)[_0x98f5('0x23')](handleEntityNotFound(_0x3db067,null))['then'](respondWithResult(_0x3db067,null))[_0x98f5('0x45')](handleError(_0x3db067,null));};exports[_0x98f5('0x47')]=function(_0x4b3fa8,_0x2c3cef){return db[_0x98f5('0x2c')][_0x98f5('0x47')](_0x4b3fa8['body'],{})[_0x98f5('0x23')](respondWithResult(_0x2c3cef,0xc9))[_0x98f5('0x45')](handleError(_0x2c3cef,null));};exports[_0x98f5('0x48')]=function(_0x1d4b3b,_0x4a0cda){if(_0x1d4b3b[_0x98f5('0x49')]['id']){delete _0x1d4b3b[_0x98f5('0x49')]['id'];}return db[_0x98f5('0x2c')][_0x98f5('0x46')]({'where':{'id':_0x1d4b3b[_0x98f5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4a0cda,null))[_0x98f5('0x23')](saveUpdates(_0x1d4b3b[_0x98f5('0x49')],null))['then'](respondWithResult(_0x4a0cda,null))[_0x98f5('0x45')](handleError(_0x4a0cda,null));};exports['destroy']=function(_0x27ed57,_0x4cb157){return db[_0x98f5('0x2c')][_0x98f5('0x46')]({'where':{'id':_0x27ed57[_0x98f5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4cb157,null))[_0x98f5('0x23')](removeEntity(_0x4cb157,null))[_0x98f5('0x45')](handleError(_0x4cb157,null));};exports[_0x98f5('0x4b')]=function(_0x2953e3,_0xde3d2d){return db[_0x98f5('0x2c')][_0x98f5('0x4b')]()[_0x98f5('0x23')](respondWithResult(_0xde3d2d,null))[_0x98f5('0x45')](handleError(_0xde3d2d,null));}; \ No newline at end of file +var _0x0fd9=['includeAll','include','rows','catch','show','params','create','body','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','WhatsappQueueReport','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options'];(function(_0x2e6b0a,_0x4ff642){var _0x444e95=function(_0x1bf0a6){while(--_0x1bf0a6){_0x2e6b0a['push'](_0x2e6b0a['shift']());}};_0x444e95(++_0x4ff642);}(_0x0fd9,0xa3));var _0x90fd=function(_0x351509,_0x54725c){_0x351509=_0x351509-0x0;var _0x4e9861=_0x0fd9[_0x351509];return _0x4e9861;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x90fd('0x0'));var zipdir=require(_0x90fd('0x1'));var jsonpatch=require(_0x90fd('0x2'));var rp=require(_0x90fd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x90fd('0x4'));var util=require(_0x90fd('0x5'));var path=require(_0x90fd('0x6'));var sox=require(_0x90fd('0x7'));var csv=require(_0x90fd('0x8'));var ejs=require(_0x90fd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x90fd('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x90fd('0xb'));var toCsv=require(_0x90fd('0x8'));var querystring=require('querystring');var Papa=require(_0x90fd('0xc'));var Redis=require(_0x90fd('0xd'));var authService=require(_0x90fd('0xe'));var qs=require(_0x90fd('0xf'));var as=require(_0x90fd('0x10'));var hardwareService=require(_0x90fd('0x11'));var logger=require(_0x90fd('0x12'))(_0x90fd('0x13'));var utils=require(_0x90fd('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x90fd('0x15'));var db=require(_0x90fd('0x16'))['db'];function respondWithStatusCode(_0x4e8b99,_0x1439ed){_0x1439ed=_0x1439ed||0xcc;return function(_0x37a0f8){if(_0x37a0f8){return _0x4e8b99[_0x90fd('0x17')](_0x1439ed);}return _0x4e8b99['status'](_0x1439ed)[_0x90fd('0x18')]();};}function respondWithResult(_0x48e701,_0x1cae40){_0x1cae40=_0x1cae40||0xc8;return function(_0xb402d9){if(_0xb402d9){return _0x48e701[_0x90fd('0x19')](_0x1cae40)[_0x90fd('0x1a')](_0xb402d9);}};}function respondWithFilteredResult(_0x3c5da8,_0x442a19){return function(_0x296a64){if(_0x296a64){var _0x4eb953=typeof _0x442a19['offset']===_0x90fd('0x1b')&&typeof _0x442a19[_0x90fd('0x1c')]==='undefined';var _0x130489=_0x296a64[_0x90fd('0x1d')];var _0x1fcc87=_0x4eb953?0x0:_0x442a19['offset'];var _0x3f9c76=_0x4eb953?_0x296a64[_0x90fd('0x1d')]:_0x442a19[_0x90fd('0x1e')]+_0x442a19[_0x90fd('0x1c')];var _0x251957;if(_0x3f9c76>=_0x130489){_0x3f9c76=_0x130489;_0x251957=0xc8;}else{_0x251957=0xce;}_0x3c5da8[_0x90fd('0x19')](_0x251957);return _0x3c5da8[_0x90fd('0x1f')](_0x90fd('0x20'),_0x1fcc87+'-'+_0x3f9c76+'/'+_0x130489)[_0x90fd('0x1a')](_0x296a64);}return null;};}function patchUpdates(_0x90197e){return function(_0x19e79b){try{jsonpatch[_0x90fd('0x21')](_0x19e79b,_0x90197e,!![]);}catch(_0x1fb31a){return BPromise[_0x90fd('0x22')](_0x1fb31a);}return _0x19e79b[_0x90fd('0x23')]();};}function saveUpdates(_0x493c26,_0x35ce4e){return function(_0xc4e4e2){if(_0xc4e4e2){return _0xc4e4e2[_0x90fd('0x24')](_0x493c26)[_0x90fd('0x25')](function(_0x411a6a){return _0x411a6a;});}return null;};}function removeEntity(_0x3ad6c6,_0x30f67e){return function(_0x300262){if(_0x300262){return _0x300262['destroy']()[_0x90fd('0x25')](function(){_0x3ad6c6['status'](0xcc)[_0x90fd('0x18')]();});}};}function handleEntityNotFound(_0x18d5b3,_0x2ffea2){return function(_0x31667c){if(!_0x31667c){_0x18d5b3[_0x90fd('0x17')](0x194);}return _0x31667c;};}function handleError(_0x4c962f,_0x35c38d){_0x35c38d=_0x35c38d||0x1f4;return function(_0xe333f0){logger[_0x90fd('0x26')](_0xe333f0[_0x90fd('0x27')]);if(_0xe333f0[_0x90fd('0x28')]){delete _0xe333f0[_0x90fd('0x28')];}_0x4c962f['status'](_0x35c38d)['send'](_0xe333f0);};}exports[_0x90fd('0x29')]=function(_0x170cfb,_0x2924e9){var _0x404971={},_0x397aaf={},_0x59b3e8={'count':0x0,'rows':[]};var _0x4f69e7=_[_0x90fd('0x2a')](db[_0x90fd('0x2b')][_0x90fd('0x2c')],function(_0x3a0102){return{'name':_0x3a0102['fieldName'],'type':_0x3a0102['type'][_0x90fd('0x2d')]};});_0x397aaf[_0x90fd('0x2e')]=_[_0x90fd('0x2a')](_0x4f69e7,_0x90fd('0x28'));_0x397aaf['query']=_[_0x90fd('0x2f')](_0x170cfb[_0x90fd('0x30')]);_0x397aaf[_0x90fd('0x31')]=_[_0x90fd('0x32')](_0x397aaf[_0x90fd('0x2e')],_0x397aaf[_0x90fd('0x30')]);_0x404971[_0x90fd('0x33')]=_[_0x90fd('0x32')](_0x397aaf[_0x90fd('0x2e')],qs[_0x90fd('0x34')](_0x170cfb[_0x90fd('0x30')][_0x90fd('0x34')]));_0x404971[_0x90fd('0x33')]=_0x404971[_0x90fd('0x33')][_0x90fd('0x35')]?_0x404971[_0x90fd('0x33')]:_0x397aaf['model'];if(!_0x170cfb[_0x90fd('0x30')][_0x90fd('0x36')](_0x90fd('0x37'))){_0x404971[_0x90fd('0x1c')]=qs[_0x90fd('0x1c')](_0x170cfb[_0x90fd('0x30')][_0x90fd('0x1c')]);_0x404971[_0x90fd('0x1e')]=qs[_0x90fd('0x1e')](_0x170cfb[_0x90fd('0x30')][_0x90fd('0x1e')]);}_0x404971[_0x90fd('0x38')]=qs[_0x90fd('0x39')](_0x170cfb['query'][_0x90fd('0x39')]);_0x404971[_0x90fd('0x3a')]=qs[_0x90fd('0x31')](_[_0x90fd('0x3b')](_0x170cfb['query'],_0x397aaf[_0x90fd('0x31')]),_0x4f69e7);if(_0x170cfb[_0x90fd('0x30')][_0x90fd('0x3c')]){_0x404971['where']=_['merge'](_0x404971[_0x90fd('0x3a')],{'$or':_[_0x90fd('0x2a')](_0x4f69e7,function(_0x377319){if(_0x377319[_0x90fd('0x3d')]!==_0x90fd('0x3e')){var _0x254200={};_0x254200[_0x377319[_0x90fd('0x28')]]={'$like':'%'+_0x170cfb[_0x90fd('0x30')][_0x90fd('0x3c')]+'%'};return _0x254200;}})});}_0x404971=_[_0x90fd('0x3f')]({},_0x404971,_0x170cfb[_0x90fd('0x40')]);var _0x43c84c={'where':_0x404971[_0x90fd('0x3a')]};return db[_0x90fd('0x2b')][_0x90fd('0x1d')](_0x43c84c)[_0x90fd('0x25')](function(_0x2717ca){_0x59b3e8[_0x90fd('0x1d')]=_0x2717ca;if(_0x170cfb['query'][_0x90fd('0x41')]){_0x404971[_0x90fd('0x42')]=[{'all':!![]}];}return db[_0x90fd('0x2b')]['findAll'](_0x404971);})['then'](function(_0x47b8c8){_0x59b3e8[_0x90fd('0x43')]=_0x47b8c8;return _0x59b3e8;})[_0x90fd('0x25')](respondWithFilteredResult(_0x2924e9,_0x404971))[_0x90fd('0x44')](handleError(_0x2924e9,null));};exports[_0x90fd('0x45')]=function(_0x1361d9,_0x311c7e){var _0x363365={'raw':!![],'where':{'id':_0x1361d9[_0x90fd('0x46')]['id']}},_0x733d4d={};_0x733d4d[_0x90fd('0x2e')]=_[_0x90fd('0x2f')](db[_0x90fd('0x2b')][_0x90fd('0x2c')]);_0x733d4d[_0x90fd('0x30')]=_[_0x90fd('0x2f')](_0x1361d9['query']);_0x733d4d['filters']=_[_0x90fd('0x32')](_0x733d4d[_0x90fd('0x2e')],_0x733d4d[_0x90fd('0x30')]);_0x363365['attributes']=_['intersection'](_0x733d4d[_0x90fd('0x2e')],qs[_0x90fd('0x34')](_0x1361d9['query']['fields']));_0x363365[_0x90fd('0x33')]=_0x363365[_0x90fd('0x33')]['length']?_0x363365['attributes']:_0x733d4d[_0x90fd('0x2e')];if(_0x1361d9[_0x90fd('0x30')][_0x90fd('0x41')]){_0x363365['include']=[{'all':!![]}];}_0x363365=_[_0x90fd('0x3f')]({},_0x363365,_0x1361d9[_0x90fd('0x40')]);return db['WhatsappQueueReport']['find'](_0x363365)['then'](handleEntityNotFound(_0x311c7e,null))[_0x90fd('0x25')](respondWithResult(_0x311c7e,null))[_0x90fd('0x44')](handleError(_0x311c7e,null));};exports['create']=function(_0x2d42b3,_0x2b73f7){return db[_0x90fd('0x2b')][_0x90fd('0x47')](_0x2d42b3[_0x90fd('0x48')],{})['then'](respondWithResult(_0x2b73f7,0xc9))['catch'](handleError(_0x2b73f7,null));};exports[_0x90fd('0x24')]=function(_0x326e4d,_0x125874){if(_0x326e4d[_0x90fd('0x48')]['id']){delete _0x326e4d[_0x90fd('0x48')]['id'];}return db[_0x90fd('0x2b')][_0x90fd('0x49')]({'where':{'id':_0x326e4d[_0x90fd('0x46')]['id']}})[_0x90fd('0x25')](handleEntityNotFound(_0x125874,null))[_0x90fd('0x25')](saveUpdates(_0x326e4d['body'],null))[_0x90fd('0x25')](respondWithResult(_0x125874,null))[_0x90fd('0x44')](handleError(_0x125874,null));};exports[_0x90fd('0x4a')]=function(_0x38021b,_0x4b47bc){return db['WhatsappQueueReport'][_0x90fd('0x49')]({'where':{'id':_0x38021b['params']['id']}})['then'](handleEntityNotFound(_0x4b47bc,null))[_0x90fd('0x25')](removeEntity(_0x4b47bc,null))[_0x90fd('0x44')](handleError(_0x4b47bc,null));};exports[_0x90fd('0x4b')]=function(_0xb8a2af,_0x13c428){return db[_0x90fd('0x2b')][_0x90fd('0x4b')]()['then'](respondWithResult(_0x13c428,null))['catch'](handleError(_0x13c428,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 0cd817c..8843846 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 _0x4a68=['exports','WhatsappQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappQueueReport.attributes'];(function(_0x259768,_0xca25e6){var _0x5de093=function(_0x337f93){while(--_0x337f93){_0x259768['push'](_0x259768['shift']());}};_0x5de093(++_0xca25e6);}(_0x4a68,0x78));var _0x84a6=function(_0x1a613b,_0x381801){_0x1a613b=_0x1a613b-0x0;var _0x5b80f0=_0x4a68[_0x1a613b];return _0x5b80f0;};'use strict';var _=require(_0x84a6('0x0'));var util=require(_0x84a6('0x1'));var logger=require(_0x84a6('0x2'))(_0x84a6('0x3'));var moment=require(_0x84a6('0x4'));var BPromise=require(_0x84a6('0x5'));var rp=require(_0x84a6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x84a6('0x7'));var config=require(_0x84a6('0x8'));var attributes=require(_0x84a6('0x9'));module[_0x84a6('0xa')]=function(_0x230d4f,_0x4d9c0d){return _0x230d4f['define'](_0x84a6('0xb'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x84a6('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc0a2=['bluebird','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x110f86,_0x160c75){var _0x40eef0=function(_0x451166){while(--_0x451166){_0x110f86['push'](_0x110f86['shift']());}};_0x40eef0(++_0x160c75);}(_0xc0a2,0x175));var _0x2c0a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc0a2[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x2c0a('0x0'));var util=require(_0x2c0a('0x1'));var logger=require(_0x2c0a('0x2'))(_0x2c0a('0x3'));var moment=require(_0x2c0a('0x4'));var BPromise=require(_0x2c0a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c0a('0x6'));var rimraf=require(_0x2c0a('0x7'));var config=require(_0x2c0a('0x8'));var attributes=require(_0x2c0a('0x9'));module['exports']=function(_0x33fd14,_0x39d9bc){return _0x33fd14[_0x2c0a('0xa')](_0x2c0a('0xb'),attributes,{'tableName':_0x2c0a('0xc'),'paranoid':![],'indexes':[{'name':_0x2c0a('0xd'),'fields':[_0x2c0a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index bb6d990..71396fc 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 _0xafc6=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappQueueReport,\x20%s,\x20%s','message','result','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','raw','catch','UpdateWhatsappQueueReport','update','body','limit'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0xafc6,0x180));var _0x6afc=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0xafc6[_0xfa634c];return _0x73e478;};'use strict';var _=require(_0x6afc('0x0'));var util=require(_0x6afc('0x1'));var moment=require(_0x6afc('0x2'));var BPromise=require(_0x6afc('0x3'));var rs=require(_0x6afc('0x4'));var fs=require('fs');var Redis=require(_0x6afc('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6afc('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6afc('0x7'));var jayson=require(_0x6afc('0x8'));var client=jayson[_0x6afc('0x9')][_0x6afc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ba654,_0x3dc352,_0x15f18c){return new BPromise(function(_0x138c5e,_0x1b7efc){return client[_0x6afc('0xb')](_0x5ba654,_0x15f18c)[_0x6afc('0xc')](function(_0x4f35a0){logger[_0x6afc('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3dc352,_0x6afc('0xe'));logger[_0x6afc('0xf')](_0x6afc('0x10'),_0x3dc352,'request\x20sent',JSON[_0x6afc('0x11')](_0x4f35a0));if(_0x4f35a0[_0x6afc('0x12')]){if(_0x4f35a0[_0x6afc('0x12')]['code']===0x1f4){logger[_0x6afc('0x12')](_0x6afc('0x13'),_0x3dc352,_0x4f35a0[_0x6afc('0x12')][_0x6afc('0x14')]);return _0x1b7efc(_0x4f35a0[_0x6afc('0x12')][_0x6afc('0x14')]);}logger['error'](_0x6afc('0x13'),_0x3dc352,_0x4f35a0[_0x6afc('0x12')][_0x6afc('0x14')]);return _0x138c5e(_0x4f35a0[_0x6afc('0x12')][_0x6afc('0x14')]);}else{logger[_0x6afc('0xd')](_0x6afc('0x13'),_0x3dc352,_0x6afc('0xe'));_0x138c5e(_0x4f35a0[_0x6afc('0x15')][_0x6afc('0x14')]);}})['catch'](function(_0x1d52fc){logger[_0x6afc('0x12')](_0x6afc('0x13'),_0x3dc352,_0x1d52fc);_0x1b7efc(_0x1d52fc);});});}exports[_0x6afc('0x16')]=function(_0x32fc38){var _0x196b38=this;return new Promise(function(_0x5b4109,_0x55d8bd){return db[_0x6afc('0x17')][_0x6afc('0x18')](_0x32fc38['body'],{'raw':_0x32fc38[_0x6afc('0x19')]?_0x32fc38[_0x6afc('0x19')][_0x6afc('0x1a')]===undefined?!![]:![]:!![]})[_0x6afc('0xc')](function(_0x23e935){logger[_0x6afc('0xd')]('CreateWhatsappQueueReport',_0x32fc38);logger[_0x6afc('0xf')](_0x6afc('0x16'),_0x32fc38,JSON[_0x6afc('0x11')](_0x23e935));_0x5b4109(_0x23e935);})[_0x6afc('0x1b')](function(_0x47ef1b){logger[_0x6afc('0x12')](_0x6afc('0x16'),_0x47ef1b[_0x6afc('0x14')],_0x32fc38);_0x55d8bd(_0x196b38[_0x6afc('0x12')](0x1f4,_0x47ef1b[_0x6afc('0x14')]));});});};exports[_0x6afc('0x1c')]=function(_0x4e4d0d){var _0x22d7ef=this;return new Promise(function(_0x4b317b,_0x418970){return db[_0x6afc('0x17')][_0x6afc('0x1d')](_0x4e4d0d[_0x6afc('0x1e')],{'raw':_0x4e4d0d[_0x6afc('0x19')]?_0x4e4d0d[_0x6afc('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e4d0d[_0x6afc('0x19')]?_0x4e4d0d[_0x6afc('0x19')]['where']||null:null,'attributes':_0x4e4d0d[_0x6afc('0x19')]?_0x4e4d0d['options']['attributes']||null:null,'limit':_0x4e4d0d['options']?_0x4e4d0d[_0x6afc('0x19')][_0x6afc('0x1f')]||null:null})[_0x6afc('0xc')](function(_0x5c8392){logger[_0x6afc('0xd')](_0x6afc('0x1c'),_0x4e4d0d);logger[_0x6afc('0xf')](_0x6afc('0x1c'),_0x4e4d0d,JSON['stringify'](_0x5c8392));_0x4b317b(_0x5c8392);})[_0x6afc('0x1b')](function(_0x57c9dd){logger[_0x6afc('0x12')](_0x6afc('0x1c'),_0x57c9dd[_0x6afc('0x14')],_0x4e4d0d);_0x418970(_0x22d7ef['error'](0x1f4,_0x57c9dd[_0x6afc('0x14')]));});});}; \ No newline at end of file +var _0xd426=['stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','create','body','options','raw','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','where'];(function(_0x4d4d2e,_0x2fdea8){var _0x5741c4=function(_0x49ec4c){while(--_0x49ec4c){_0x4d4d2e['push'](_0x4d4d2e['shift']());}};_0x5741c4(++_0x2fdea8);}(_0xd426,0x141));var _0x6d42=function(_0x12dc66,_0x43aab9){_0x12dc66=_0x12dc66-0x0;var _0x7bf9c6=_0xd426[_0x12dc66];return _0x7bf9c6;};'use strict';var _=require('lodash');var util=require(_0x6d42('0x0'));var moment=require(_0x6d42('0x1'));var BPromise=require(_0x6d42('0x2'));var rs=require(_0x6d42('0x3'));var fs=require('fs');var Redis=require(_0x6d42('0x4'));var db=require(_0x6d42('0x5'))['db'];var utils=require(_0x6d42('0x6'));var logger=require(_0x6d42('0x7'))(_0x6d42('0x8'));var config=require(_0x6d42('0x9'));var jayson=require(_0x6d42('0xa'));var client=jayson[_0x6d42('0xb')][_0x6d42('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x23896b,_0x24e093,_0x1318d8){return new BPromise(function(_0x12d4d4,_0x28dcc4){return client['request'](_0x23896b,_0x1318d8)[_0x6d42('0xd')](function(_0x42b574){logger[_0x6d42('0xe')](_0x6d42('0xf'),_0x24e093,_0x6d42('0x10'));logger[_0x6d42('0x11')](_0x6d42('0x12'),_0x24e093,_0x6d42('0x10'),JSON['stringify'](_0x42b574));if(_0x42b574[_0x6d42('0x13')]){if(_0x42b574[_0x6d42('0x13')][_0x6d42('0x14')]===0x1f4){logger[_0x6d42('0x13')](_0x6d42('0xf'),_0x24e093,_0x42b574[_0x6d42('0x13')][_0x6d42('0x15')]);return _0x28dcc4(_0x42b574[_0x6d42('0x13')][_0x6d42('0x15')]);}logger['error'](_0x6d42('0xf'),_0x24e093,_0x42b574['error'][_0x6d42('0x15')]);return _0x12d4d4(_0x42b574['error']['message']);}else{logger[_0x6d42('0xe')](_0x6d42('0xf'),_0x24e093,_0x6d42('0x10'));_0x12d4d4(_0x42b574['result'][_0x6d42('0x15')]);}})[_0x6d42('0x16')](function(_0x5c0ea7){logger['error'](_0x6d42('0xf'),_0x24e093,_0x5c0ea7);_0x28dcc4(_0x5c0ea7);});});}exports['CreateWhatsappQueueReport']=function(_0x2fa289){var _0x29f853=this;return new Promise(function(_0x5b3b6d,_0x3bf2e5){return db['WhatsappQueueReport'][_0x6d42('0x17')](_0x2fa289[_0x6d42('0x18')],{'raw':_0x2fa289[_0x6d42('0x19')]?_0x2fa289[_0x6d42('0x19')][_0x6d42('0x1a')]===undefined?!![]:![]:!![]})[_0x6d42('0xd')](function(_0xdb03f6){logger[_0x6d42('0xe')](_0x6d42('0x1b'),_0x2fa289);logger['debug']('CreateWhatsappQueueReport',_0x2fa289,JSON['stringify'](_0xdb03f6));_0x5b3b6d(_0xdb03f6);})[_0x6d42('0x16')](function(_0x512373){logger[_0x6d42('0x13')](_0x6d42('0x1b'),_0x512373[_0x6d42('0x15')],_0x2fa289);_0x3bf2e5(_0x29f853[_0x6d42('0x13')](0x1f4,_0x512373[_0x6d42('0x15')]));});});};exports[_0x6d42('0x1c')]=function(_0x30837e){var _0x5dc5a2=this;return new Promise(function(_0x17dc44,_0xfd3e02){return db['WhatsappQueueReport'][_0x6d42('0x1d')](_0x30837e[_0x6d42('0x18')],{'raw':_0x30837e[_0x6d42('0x19')]?_0x30837e[_0x6d42('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30837e[_0x6d42('0x19')]?_0x30837e['options'][_0x6d42('0x1e')]||null:null,'attributes':_0x30837e['options']?_0x30837e['options']['attributes']||null:null,'limit':_0x30837e['options']?_0x30837e[_0x6d42('0x19')]['limit']||null:null})[_0x6d42('0xd')](function(_0x4733b6){logger[_0x6d42('0xe')]('UpdateWhatsappQueueReport',_0x30837e);logger['debug'](_0x6d42('0x1c'),_0x30837e,JSON[_0x6d42('0x1f')](_0x4733b6));_0x17dc44(_0x4733b6);})[_0x6d42('0x16')](function(_0x2c3748){logger[_0x6d42('0x13')](_0x6d42('0x1c'),_0x2c3748[_0x6d42('0x15')],_0x30837e);_0xfd3e02(_0x5dc5a2[_0x6d42('0x13')](0x1f4,_0x2c3748[_0x6d42('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 7da21b1..f96a6bd 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 _0x8111=['describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','index'];(function(_0x1d656b,_0x4b67cb){var _0x57aafc=function(_0x5c11b4){while(--_0x5c11b4){_0x1d656b['push'](_0x1d656b['shift']());}};_0x57aafc(++_0x4b67cb);}(_0x8111,0x1d6));var _0x1811=function(_0x20e557,_0x44a3f3){_0x20e557=_0x20e557-0x0;var _0x22265f=_0x8111[_0x20e557];return _0x22265f;};'use strict';var multer=require(_0x1811('0x0'));var util=require(_0x1811('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1811('0x2'));var router=express[_0x1811('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1811('0x4'));var interaction=require(_0x1811('0x5'));var config=require('../../config/environment');var controller=require(_0x1811('0x6'));router[_0x1811('0x7')]('/',auth[_0x1811('0x8')](),controller[_0x1811('0x9')]);router[_0x1811('0x7')]('/describe',auth[_0x1811('0x8')](),controller[_0x1811('0xa')]);router['get']('/:id',auth[_0x1811('0x8')](),controller[_0x1811('0xb')]);router[_0x1811('0xc')]('/',auth[_0x1811('0x8')](),controller[_0x1811('0xd')]);router[_0x1811('0xe')](_0x1811('0xf'),auth[_0x1811('0x8')](),controller[_0x1811('0x10')]);router[_0x1811('0x11')](_0x1811('0xf'),auth[_0x1811('0x8')](),controller[_0x1811('0x12')]);module[_0x1811('0x13')]=router; \ No newline at end of file +var _0x5d89=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','show','post','create','put','update','delete','destroy'];(function(_0x4eb6ec,_0x7f2520){var _0x58881b=function(_0x4f375f){while(--_0x4f375f){_0x4eb6ec['push'](_0x4eb6ec['shift']());}};_0x58881b(++_0x7f2520);}(_0x5d89,0x190));var _0x95d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d89[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x95d8('0x0'));var util=require(_0x95d8('0x1'));var path=require(_0x95d8('0x2'));var timeout=require(_0x95d8('0x3'));var express=require(_0x95d8('0x4'));var router=express[_0x95d8('0x5')]();var fs_extra=require(_0x95d8('0x6'));var auth=require(_0x95d8('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x95d8('0x8'));var controller=require('./whatsappTransferReport.controller');router[_0x95d8('0x9')]('/',auth[_0x95d8('0xa')](),controller[_0x95d8('0xb')]);router['get'](_0x95d8('0xc'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x95d8('0xd')]);router[_0x95d8('0xe')]('/',auth[_0x95d8('0xa')](),controller[_0x95d8('0xf')]);router[_0x95d8('0x10')]('/:id',auth[_0x95d8('0xa')](),controller[_0x95d8('0x11')]);router[_0x95d8('0x12')]('/:id',auth[_0x95d8('0xa')](),controller[_0x95d8('0x13')]);module[_0x95d8('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 61fa512..be23a8e 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 _0xb921=['account','DATE','sequelize','exports','STRING','ENUM'];(function(_0x41b4cc,_0x529f9d){var _0x548fa4=function(_0x5c97c8){while(--_0x5c97c8){_0x41b4cc['push'](_0x41b4cc['shift']());}};_0x548fa4(++_0x529f9d);}(_0xb921,0x16a));var _0x1b92=function(_0x181b84,_0x42f8f1){_0x181b84=_0x181b84-0x0;var _0x3f773d=_0xb921[_0x181b84];return _0x3f773d;};'use strict';var Sequelize=require(_0x1b92('0x0'));module[_0x1b92('0x1')]={'uniqueid':{'type':Sequelize[_0x1b92('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1b92('0x3')](_0x1b92('0x4'),'agent','queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x1b92('0x5')]}}; \ No newline at end of file +var _0x76d2=['agent','queue','DATE','sequelize','exports','STRING','account'];(function(_0x1b2422,_0x1e98d4){var _0x376573=function(_0x5db41b){while(--_0x5db41b){_0x1b2422['push'](_0x1b2422['shift']());}};_0x376573(++_0x1e98d4);}(_0x76d2,0xf8));var _0x276d=function(_0x43bc1c,_0xb21fc1){_0x43bc1c=_0x43bc1c-0x0;var _0x4bfe93=_0x76d2[_0x43bc1c];return _0x4bfe93;};'use strict';var Sequelize=require(_0x276d('0x0'));module[_0x276d('0x1')]={'uniqueid':{'type':Sequelize[_0x276d('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x276d('0x3'),_0x276d('0x4'),_0x276d('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x276d('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 5d17cbd..20ee109 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 _0xe588=['catch','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','stack','name','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','where','merge','VIRTUAL','includeAll','include','findAll','show','params','options','find','create','body'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xe588,0xda));var _0x8e58=function(_0x1768c9,_0x20b0f3){_0x1768c9=_0x1768c9-0x0;var _0x26fd99=_0xe588[_0x1768c9];return _0x26fd99;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8e58('0x0'));var zipdir=require(_0x8e58('0x1'));var jsonpatch=require(_0x8e58('0x2'));var rp=require(_0x8e58('0x3'));var moment=require(_0x8e58('0x4'));var BPromise=require(_0x8e58('0x5'));var Mustache=require(_0x8e58('0x6'));var util=require('util');var path=require('path');var sox=require(_0x8e58('0x7'));var csv=require(_0x8e58('0x8'));var ejs=require(_0x8e58('0x9'));var fs=require('fs');var fs_extra=require(_0x8e58('0xa'));var _=require('lodash');var squel=require(_0x8e58('0xb'));var crypto=require('crypto');var jsforce=require(_0x8e58('0xc'));var deskjs=require(_0x8e58('0xd'));var toCsv=require(_0x8e58('0x8'));var querystring=require(_0x8e58('0xe'));var Papa=require('papaparse');var Redis=require(_0x8e58('0xf'));var authService=require(_0x8e58('0x10'));var qs=require(_0x8e58('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8e58('0x12'));var logger=require(_0x8e58('0x13'))(_0x8e58('0x14'));var utils=require(_0x8e58('0x15'));var config=require(_0x8e58('0x16'));var licenseUtil=require(_0x8e58('0x17'));var db=require(_0x8e58('0x18'))['db'];function respondWithStatusCode(_0x3bfd24,_0x493a3f){_0x493a3f=_0x493a3f||0xcc;return function(_0x4efe85){if(_0x4efe85){return _0x3bfd24['sendStatus'](_0x493a3f);}return _0x3bfd24[_0x8e58('0x19')](_0x493a3f)[_0x8e58('0x1a')]();};}function respondWithResult(_0x2820a8,_0x5bb282){_0x5bb282=_0x5bb282||0xc8;return function(_0x4fab58){if(_0x4fab58){return _0x2820a8[_0x8e58('0x19')](_0x5bb282)[_0x8e58('0x1b')](_0x4fab58);}};}function respondWithFilteredResult(_0x58619c,_0x4538aa){return function(_0x16002b){if(_0x16002b){var _0x526a18=typeof _0x4538aa[_0x8e58('0x1c')]===_0x8e58('0x1d')&&typeof _0x4538aa[_0x8e58('0x1e')]===_0x8e58('0x1d');var _0x17f39e=_0x16002b[_0x8e58('0x1f')];var _0x3b2211=_0x526a18?0x0:_0x4538aa['offset'];var _0x255b10=_0x526a18?_0x16002b[_0x8e58('0x1f')]:_0x4538aa[_0x8e58('0x1c')]+_0x4538aa['limit'];var _0x4a12e5;if(_0x255b10>=_0x17f39e){_0x255b10=_0x17f39e;_0x4a12e5=0xc8;}else{_0x4a12e5=0xce;}_0x58619c[_0x8e58('0x19')](_0x4a12e5);return _0x58619c[_0x8e58('0x20')](_0x8e58('0x21'),_0x3b2211+'-'+_0x255b10+'/'+_0x17f39e)[_0x8e58('0x1b')](_0x16002b);}return null;};}function patchUpdates(_0x15d6c7){return function(_0x477093){try{jsonpatch['apply'](_0x477093,_0x15d6c7,!![]);}catch(_0x26b42a){return BPromise['reject'](_0x26b42a);}return _0x477093['save']();};}function saveUpdates(_0x2e5b5b,_0x5ee81b){return function(_0x284c1a){if(_0x284c1a){return _0x284c1a[_0x8e58('0x22')](_0x2e5b5b)[_0x8e58('0x23')](function(_0x52685d){return _0x52685d;});}return null;};}function removeEntity(_0x3c557c,_0x3950d7){return function(_0x985951){if(_0x985951){return _0x985951[_0x8e58('0x24')]()['then'](function(){_0x3c557c[_0x8e58('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43954b,_0x16e3ac){return function(_0xb7a4cb){if(!_0xb7a4cb){_0x43954b['sendStatus'](0x194);}return _0xb7a4cb;};}function handleError(_0x26a577,_0x2b2ce8){_0x2b2ce8=_0x2b2ce8||0x1f4;return function(_0x494ce1){logger['error'](_0x494ce1[_0x8e58('0x25')]);if(_0x494ce1[_0x8e58('0x26')]){delete _0x494ce1[_0x8e58('0x26')];}_0x26a577[_0x8e58('0x19')](_0x2b2ce8)['send'](_0x494ce1);};}exports[_0x8e58('0x27')]=function(_0x391738,_0x40f763){var _0x6024c7={},_0xfdd4f8={},_0x59bddc={'count':0x0,'rows':[]};var _0x275716=_[_0x8e58('0x28')](db[_0x8e58('0x29')][_0x8e58('0x2a')],function(_0x4ff030){return{'name':_0x4ff030[_0x8e58('0x2b')],'type':_0x4ff030[_0x8e58('0x2c')][_0x8e58('0x2d')]};});_0xfdd4f8[_0x8e58('0x2e')]=_[_0x8e58('0x28')](_0x275716,_0x8e58('0x26'));_0xfdd4f8[_0x8e58('0x2f')]=_[_0x8e58('0x30')](_0x391738[_0x8e58('0x2f')]);_0xfdd4f8['filters']=_[_0x8e58('0x31')](_0xfdd4f8[_0x8e58('0x2e')],_0xfdd4f8['query']);_0x6024c7[_0x8e58('0x32')]=_[_0x8e58('0x31')](_0xfdd4f8['model'],qs[_0x8e58('0x33')](_0x391738[_0x8e58('0x2f')]['fields']));_0x6024c7[_0x8e58('0x32')]=_0x6024c7['attributes'][_0x8e58('0x34')]?_0x6024c7['attributes']:_0xfdd4f8[_0x8e58('0x2e')];if(!_0x391738[_0x8e58('0x2f')][_0x8e58('0x35')]('nolimit')){_0x6024c7[_0x8e58('0x1e')]=qs[_0x8e58('0x1e')](_0x391738['query'][_0x8e58('0x1e')]);_0x6024c7[_0x8e58('0x1c')]=qs[_0x8e58('0x1c')](_0x391738[_0x8e58('0x2f')]['offset']);}_0x6024c7[_0x8e58('0x36')]=qs['sort'](_0x391738['query'][_0x8e58('0x37')]);_0x6024c7['where']=qs[_0x8e58('0x38')](_['pick'](_0x391738[_0x8e58('0x2f')],_0xfdd4f8['filters']),_0x275716);if(_0x391738[_0x8e58('0x2f')][_0x8e58('0x39')]){_0x6024c7[_0x8e58('0x3a')]=_[_0x8e58('0x3b')](_0x6024c7[_0x8e58('0x3a')],{'$or':_[_0x8e58('0x28')](_0x275716,function(_0x218184){if(_0x218184[_0x8e58('0x2c')]!==_0x8e58('0x3c')){var _0x43589e={};_0x43589e[_0x218184['name']]={'$like':'%'+_0x391738[_0x8e58('0x2f')][_0x8e58('0x39')]+'%'};return _0x43589e;}})});}_0x6024c7=_[_0x8e58('0x3b')]({},_0x6024c7,_0x391738['options']);var _0x3ced08={'where':_0x6024c7[_0x8e58('0x3a')]};return db[_0x8e58('0x29')][_0x8e58('0x1f')](_0x3ced08)[_0x8e58('0x23')](function(_0x1d9051){_0x59bddc[_0x8e58('0x1f')]=_0x1d9051;if(_0x391738[_0x8e58('0x2f')][_0x8e58('0x3d')]){_0x6024c7[_0x8e58('0x3e')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x8e58('0x3f')](_0x6024c7);})[_0x8e58('0x23')](function(_0x834435){_0x59bddc['rows']=_0x834435;return _0x59bddc;})[_0x8e58('0x23')](respondWithFilteredResult(_0x40f763,_0x6024c7))['catch'](handleError(_0x40f763,null));};exports[_0x8e58('0x40')]=function(_0x268bf4,_0x62bd01){var _0x5aafbb={'raw':!![],'where':{'id':_0x268bf4[_0x8e58('0x41')]['id']}},_0x41a8cc={};_0x41a8cc[_0x8e58('0x2e')]=_[_0x8e58('0x30')](db[_0x8e58('0x29')][_0x8e58('0x2a')]);_0x41a8cc[_0x8e58('0x2f')]=_['keys'](_0x268bf4[_0x8e58('0x2f')]);_0x41a8cc[_0x8e58('0x38')]=_[_0x8e58('0x31')](_0x41a8cc['model'],_0x41a8cc['query']);_0x5aafbb['attributes']=_[_0x8e58('0x31')](_0x41a8cc[_0x8e58('0x2e')],qs[_0x8e58('0x33')](_0x268bf4[_0x8e58('0x2f')][_0x8e58('0x33')]));_0x5aafbb[_0x8e58('0x32')]=_0x5aafbb['attributes'][_0x8e58('0x34')]?_0x5aafbb[_0x8e58('0x32')]:_0x41a8cc[_0x8e58('0x2e')];if(_0x268bf4[_0x8e58('0x2f')][_0x8e58('0x3d')]){_0x5aafbb[_0x8e58('0x3e')]=[{'all':!![]}];}_0x5aafbb=_[_0x8e58('0x3b')]({},_0x5aafbb,_0x268bf4[_0x8e58('0x42')]);return db['WhatsappTransferReport'][_0x8e58('0x43')](_0x5aafbb)[_0x8e58('0x23')](handleEntityNotFound(_0x62bd01,null))['then'](respondWithResult(_0x62bd01,null))['catch'](handleError(_0x62bd01,null));};exports[_0x8e58('0x44')]=function(_0x3281fa,_0x90d807){return db[_0x8e58('0x29')][_0x8e58('0x44')](_0x3281fa[_0x8e58('0x45')],{})['then'](respondWithResult(_0x90d807,0xc9))['catch'](handleError(_0x90d807,null));};exports[_0x8e58('0x22')]=function(_0x6d6209,_0x45f7cb){if(_0x6d6209['body']['id']){delete _0x6d6209['body']['id'];}return db['WhatsappTransferReport'][_0x8e58('0x43')]({'where':{'id':_0x6d6209[_0x8e58('0x41')]['id']}})['then'](handleEntityNotFound(_0x45f7cb,null))['then'](saveUpdates(_0x6d6209[_0x8e58('0x45')],null))[_0x8e58('0x23')](respondWithResult(_0x45f7cb,null))[_0x8e58('0x46')](handleError(_0x45f7cb,null));};exports['destroy']=function(_0x246fc2,_0x328d1e){return db[_0x8e58('0x29')][_0x8e58('0x43')]({'where':{'id':_0x246fc2[_0x8e58('0x41')]['id']}})[_0x8e58('0x23')](handleEntityNotFound(_0x328d1e,null))[_0x8e58('0x23')](removeEntity(_0x328d1e,null))[_0x8e58('0x46')](handleError(_0x328d1e,null));};exports['describe']=function(_0x7b0323,_0x415939){return db[_0x8e58('0x29')][_0x8e58('0x47')]()['then'](respondWithResult(_0x415939,null))[_0x8e58('0x46')](handleError(_0x415939,null));}; \ No newline at end of file +var _0x33d0=['params','rawAttributes','create','body','update','find','describe','eml-format','zip-dir','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','WhatsappTransferReport','rows','catch','show'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x33d0,0x99));var _0x033d=function(_0x49c8fb,_0x3621b9){_0x49c8fb=_0x49c8fb-0x0;var _0x283aca=_0x33d0[_0x49c8fb];return _0x283aca;};'use strict';var emlformat=require(_0x033d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x033d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x033d('0x2'));var BPromise=require(_0x033d('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x033d('0x4'));var sox=require(_0x033d('0x5'));var csv=require(_0x033d('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x033d('0x7'));var squel=require(_0x033d('0x8'));var crypto=require(_0x033d('0x9'));var jsforce=require(_0x033d('0xa'));var deskjs=require(_0x033d('0xb'));var toCsv=require(_0x033d('0x6'));var querystring=require(_0x033d('0xc'));var Papa=require(_0x033d('0xd'));var Redis=require(_0x033d('0xe'));var authService=require(_0x033d('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x033d('0x10'))(_0x033d('0x11'));var utils=require(_0x033d('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x033d('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x529ef7,_0x4eb9e8){_0x4eb9e8=_0x4eb9e8||0xcc;return function(_0x7cb71e){if(_0x7cb71e){return _0x529ef7[_0x033d('0x14')](_0x4eb9e8);}return _0x529ef7[_0x033d('0x15')](_0x4eb9e8)[_0x033d('0x16')]();};}function respondWithResult(_0x47fdbc,_0x3c9f46){_0x3c9f46=_0x3c9f46||0xc8;return function(_0x3c06ba){if(_0x3c06ba){return _0x47fdbc[_0x033d('0x15')](_0x3c9f46)[_0x033d('0x17')](_0x3c06ba);}};}function respondWithFilteredResult(_0x15fc3d,_0x61b2bf){return function(_0x37c0d0){if(_0x37c0d0){var _0x488152=typeof _0x61b2bf['offset']===_0x033d('0x18')&&typeof _0x61b2bf[_0x033d('0x19')]===_0x033d('0x18');var _0x4f6ea8=_0x37c0d0[_0x033d('0x1a')];var _0x2a639e=_0x488152?0x0:_0x61b2bf[_0x033d('0x1b')];var _0xec6478=_0x488152?_0x37c0d0[_0x033d('0x1a')]:_0x61b2bf[_0x033d('0x1b')]+_0x61b2bf[_0x033d('0x19')];var _0x319ed7;if(_0xec6478>=_0x4f6ea8){_0xec6478=_0x4f6ea8;_0x319ed7=0xc8;}else{_0x319ed7=0xce;}_0x15fc3d[_0x033d('0x15')](_0x319ed7);return _0x15fc3d[_0x033d('0x1c')](_0x033d('0x1d'),_0x2a639e+'-'+_0xec6478+'/'+_0x4f6ea8)[_0x033d('0x17')](_0x37c0d0);}return null;};}function patchUpdates(_0x2aa6f7){return function(_0x11c2d4){try{jsonpatch[_0x033d('0x1e')](_0x11c2d4,_0x2aa6f7,!![]);}catch(_0x49d029){return BPromise[_0x033d('0x1f')](_0x49d029);}return _0x11c2d4[_0x033d('0x20')]();};}function saveUpdates(_0x307efb,_0x3bef){return function(_0x50f3ba){if(_0x50f3ba){return _0x50f3ba['update'](_0x307efb)[_0x033d('0x21')](function(_0x4a49ea){return _0x4a49ea;});}return null;};}function removeEntity(_0x144325,_0x5eddcb){return function(_0x50dd24){if(_0x50dd24){return _0x50dd24[_0x033d('0x22')]()[_0x033d('0x21')](function(){_0x144325['status'](0xcc)[_0x033d('0x16')]();});}};}function handleEntityNotFound(_0x160709,_0x248dfb){return function(_0x5df126){if(!_0x5df126){_0x160709['sendStatus'](0x194);}return _0x5df126;};}function handleError(_0x5687bc,_0x23e0c3){_0x23e0c3=_0x23e0c3||0x1f4;return function(_0x1d4a28){logger[_0x033d('0x23')](_0x1d4a28['stack']);if(_0x1d4a28[_0x033d('0x24')]){delete _0x1d4a28[_0x033d('0x24')];}_0x5687bc[_0x033d('0x15')](_0x23e0c3)[_0x033d('0x25')](_0x1d4a28);};}exports[_0x033d('0x26')]=function(_0x2fb0cd,_0x558448){var _0x516e13={},_0xe61d79={},_0x193bd1={'count':0x0,'rows':[]};var _0x7d58e6=_[_0x033d('0x27')](db['WhatsappTransferReport']['rawAttributes'],function(_0x23d21a){return{'name':_0x23d21a[_0x033d('0x28')],'type':_0x23d21a[_0x033d('0x29')][_0x033d('0x2a')]};});_0xe61d79[_0x033d('0x2b')]=_['map'](_0x7d58e6,'name');_0xe61d79[_0x033d('0x2c')]=_[_0x033d('0x2d')](_0x2fb0cd[_0x033d('0x2c')]);_0xe61d79['filters']=_['intersection'](_0xe61d79[_0x033d('0x2b')],_0xe61d79[_0x033d('0x2c')]);_0x516e13[_0x033d('0x2e')]=_[_0x033d('0x2f')](_0xe61d79['model'],qs[_0x033d('0x30')](_0x2fb0cd[_0x033d('0x2c')][_0x033d('0x30')]));_0x516e13[_0x033d('0x2e')]=_0x516e13['attributes'][_0x033d('0x31')]?_0x516e13[_0x033d('0x2e')]:_0xe61d79[_0x033d('0x2b')];if(!_0x2fb0cd[_0x033d('0x2c')][_0x033d('0x32')](_0x033d('0x33'))){_0x516e13['limit']=qs['limit'](_0x2fb0cd[_0x033d('0x2c')]['limit']);_0x516e13[_0x033d('0x1b')]=qs[_0x033d('0x1b')](_0x2fb0cd[_0x033d('0x2c')]['offset']);}_0x516e13['order']=qs[_0x033d('0x34')](_0x2fb0cd[_0x033d('0x2c')][_0x033d('0x34')]);_0x516e13[_0x033d('0x35')]=qs[_0x033d('0x36')](_[_0x033d('0x37')](_0x2fb0cd[_0x033d('0x2c')],_0xe61d79[_0x033d('0x36')]),_0x7d58e6);if(_0x2fb0cd[_0x033d('0x2c')][_0x033d('0x38')]){_0x516e13[_0x033d('0x35')]=_[_0x033d('0x39')](_0x516e13[_0x033d('0x35')],{'$or':_[_0x033d('0x27')](_0x7d58e6,function(_0x1c3791){if(_0x1c3791['type']!==_0x033d('0x3a')){var _0x22be68={};_0x22be68[_0x1c3791[_0x033d('0x24')]]={'$like':'%'+_0x2fb0cd[_0x033d('0x2c')][_0x033d('0x38')]+'%'};return _0x22be68;}})});}_0x516e13=_['merge']({},_0x516e13,_0x2fb0cd[_0x033d('0x3b')]);var _0x4bc6e3={'where':_0x516e13[_0x033d('0x35')]};return db['WhatsappTransferReport'][_0x033d('0x1a')](_0x4bc6e3)[_0x033d('0x21')](function(_0x4438a9){_0x193bd1[_0x033d('0x1a')]=_0x4438a9;if(_0x2fb0cd[_0x033d('0x2c')][_0x033d('0x3c')]){_0x516e13[_0x033d('0x3d')]=[{'all':!![]}];}return db[_0x033d('0x3e')]['findAll'](_0x516e13);})[_0x033d('0x21')](function(_0x5940d6){_0x193bd1[_0x033d('0x3f')]=_0x5940d6;return _0x193bd1;})[_0x033d('0x21')](respondWithFilteredResult(_0x558448,_0x516e13))[_0x033d('0x40')](handleError(_0x558448,null));};exports[_0x033d('0x41')]=function(_0x3b6733,_0x16b631){var _0x1d3e74={'raw':!![],'where':{'id':_0x3b6733[_0x033d('0x42')]['id']}},_0x4cc682={};_0x4cc682[_0x033d('0x2b')]=_[_0x033d('0x2d')](db[_0x033d('0x3e')][_0x033d('0x43')]);_0x4cc682['query']=_[_0x033d('0x2d')](_0x3b6733[_0x033d('0x2c')]);_0x4cc682['filters']=_['intersection'](_0x4cc682[_0x033d('0x2b')],_0x4cc682[_0x033d('0x2c')]);_0x1d3e74[_0x033d('0x2e')]=_[_0x033d('0x2f')](_0x4cc682[_0x033d('0x2b')],qs[_0x033d('0x30')](_0x3b6733['query'][_0x033d('0x30')]));_0x1d3e74[_0x033d('0x2e')]=_0x1d3e74[_0x033d('0x2e')][_0x033d('0x31')]?_0x1d3e74[_0x033d('0x2e')]:_0x4cc682[_0x033d('0x2b')];if(_0x3b6733[_0x033d('0x2c')]['includeAll']){_0x1d3e74[_0x033d('0x3d')]=[{'all':!![]}];}_0x1d3e74=_[_0x033d('0x39')]({},_0x1d3e74,_0x3b6733[_0x033d('0x3b')]);return db[_0x033d('0x3e')]['find'](_0x1d3e74)['then'](handleEntityNotFound(_0x16b631,null))[_0x033d('0x21')](respondWithResult(_0x16b631,null))[_0x033d('0x40')](handleError(_0x16b631,null));};exports[_0x033d('0x44')]=function(_0x554369,_0x38a16b){return db['WhatsappTransferReport'][_0x033d('0x44')](_0x554369[_0x033d('0x45')],{})[_0x033d('0x21')](respondWithResult(_0x38a16b,0xc9))['catch'](handleError(_0x38a16b,null));};exports[_0x033d('0x46')]=function(_0x34e1a8,_0x517703){if(_0x34e1a8['body']['id']){delete _0x34e1a8[_0x033d('0x45')]['id'];}return db[_0x033d('0x3e')][_0x033d('0x47')]({'where':{'id':_0x34e1a8[_0x033d('0x42')]['id']}})[_0x033d('0x21')](handleEntityNotFound(_0x517703,null))[_0x033d('0x21')](saveUpdates(_0x34e1a8['body'],null))[_0x033d('0x21')](respondWithResult(_0x517703,null))['catch'](handleError(_0x517703,null));};exports[_0x033d('0x22')]=function(_0x2640a3,_0x4d1bf7){return db[_0x033d('0x3e')]['find']({'where':{'id':_0x2640a3['params']['id']}})[_0x033d('0x21')](handleEntityNotFound(_0x4d1bf7,null))['then'](removeEntity(_0x4d1bf7,null))[_0x033d('0x40')](handleError(_0x4d1bf7,null));};exports[_0x033d('0x48')]=function(_0x1cb2f0,_0x5222d7){return db[_0x033d('0x3e')][_0x033d('0x48')]()[_0x033d('0x21')](respondWithResult(_0x5222d7,null))[_0x033d('0x40')](handleError(_0x5222d7,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index e0224d2..17c0cc2 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 _0xc93e=['moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','../../config/logger','api'];(function(_0x29f2d6,_0x299a94){var _0x3863f2=function(_0x16c3bb){while(--_0x16c3bb){_0x29f2d6['push'](_0x29f2d6['shift']());}};_0x3863f2(++_0x299a94);}(_0xc93e,0x1bd));var _0xec93=function(_0x4aac5a,_0x15b04c){_0x4aac5a=_0x4aac5a-0x0;var _0x42e7bc=_0xc93e[_0x4aac5a];return _0x42e7bc;};'use strict';var _=require('lodash');var util=require(_0xec93('0x0'));var logger=require(_0xec93('0x1'))(_0xec93('0x2'));var moment=require(_0xec93('0x3'));var BPromise=require(_0xec93('0x4'));var rp=require(_0xec93('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xec93('0x6'));var config=require(_0xec93('0x7'));var attributes=require(_0xec93('0x8'));module[_0xec93('0x9')]=function(_0x97d7a3,_0x5f16f9){return _0x97d7a3[_0xec93('0xa')](_0xec93('0xb'),attributes,{'tableName':_0xec93('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xec93('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe330=['request-promise','path','rimraf','./whatsappTransferReport.attributes','define','WhatsappTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x556763,_0x57e1df){var _0x201dc8=function(_0x43b443){while(--_0x43b443){_0x556763['push'](_0x556763['shift']());}};_0x201dc8(++_0x57e1df);}(_0xe330,0xb0));var _0x0e33=function(_0x1bc6c1,_0x31dd45){_0x1bc6c1=_0x1bc6c1-0x0;var _0x3fd1c2=_0xe330[_0x1bc6c1];return _0x3fd1c2;};'use strict';var _=require(_0x0e33('0x0'));var util=require(_0x0e33('0x1'));var logger=require(_0x0e33('0x2'))(_0x0e33('0x3'));var moment=require(_0x0e33('0x4'));var BPromise=require(_0x0e33('0x5'));var rp=require(_0x0e33('0x6'));var fs=require('fs');var path=require(_0x0e33('0x7'));var rimraf=require(_0x0e33('0x8'));var config=require('../../config/environment');var attributes=require(_0x0e33('0x9'));module['exports']=function(_0x5be414,_0x7611b2){return _0x5be414[_0x0e33('0xa')](_0x0e33('0xb'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x0e33('0xc'),'fields':[_0x0e33('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index f33ba73..d2c6255 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 _0x3f76=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','then','info','WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','moment','bluebird'];(function(_0x33b731,_0x59f6ab){var _0x285490=function(_0x3af914){while(--_0x3af914){_0x33b731['push'](_0x33b731['shift']());}};_0x285490(++_0x59f6ab);}(_0x3f76,0x166));var _0x63f7=function(_0x4a08d4,_0x3b489c){_0x4a08d4=_0x4a08d4-0x0;var _0x56749b=_0x3f76[_0x4a08d4];return _0x56749b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x63f7('0x0'));var BPromise=require(_0x63f7('0x1'));var rs=require(_0x63f7('0x2'));var fs=require('fs');var Redis=require(_0x63f7('0x3'));var db=require(_0x63f7('0x4'))['db'];var utils=require(_0x63f7('0x5'));var logger=require(_0x63f7('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x63f7('0x7'));var client=jayson[_0x63f7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b2c1f,_0x2d4549,_0x4d7fad){return new BPromise(function(_0x5713e1,_0x6e2814){return client['request'](_0x1b2c1f,_0x4d7fad)[_0x63f7('0x9')](function(_0x437b65){logger[_0x63f7('0xa')](_0x63f7('0xb'),_0x2d4549,'request\x20sent');logger[_0x63f7('0xc')](_0x63f7('0xd'),_0x2d4549,'request\x20sent',JSON[_0x63f7('0xe')](_0x437b65));if(_0x437b65[_0x63f7('0xf')]){if(_0x437b65[_0x63f7('0xf')]['code']===0x1f4){logger['error'](_0x63f7('0xb'),_0x2d4549,_0x437b65[_0x63f7('0xf')][_0x63f7('0x10')]);return _0x6e2814(_0x437b65[_0x63f7('0xf')][_0x63f7('0x10')]);}logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x2d4549,_0x437b65[_0x63f7('0xf')][_0x63f7('0x10')]);return _0x5713e1(_0x437b65['error'][_0x63f7('0x10')]);}else{logger[_0x63f7('0xa')](_0x63f7('0xb'),_0x2d4549,_0x63f7('0x11'));_0x5713e1(_0x437b65[_0x63f7('0x12')][_0x63f7('0x10')]);}})[_0x63f7('0x13')](function(_0x293b05){logger[_0x63f7('0xf')](_0x63f7('0xb'),_0x2d4549,_0x293b05);_0x6e2814(_0x293b05);});});} \ No newline at end of file +var _0x2f1a=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','bluebird'];(function(_0x4aa78a,_0x15c09c){var _0x444b3b=function(_0x7c30bb){while(--_0x7c30bb){_0x4aa78a['push'](_0x4aa78a['shift']());}};_0x444b3b(++_0x15c09c);}(_0x2f1a,0x129));var _0xa2f1=function(_0x149684,_0x13ea4a){_0x149684=_0x149684-0x0;var _0x2161b5=_0x2f1a[_0x149684];return _0x2161b5;};'use strict';var _=require(_0xa2f1('0x0'));var util=require(_0xa2f1('0x1'));var moment=require('moment');var BPromise=require(_0xa2f1('0x2'));var rs=require(_0xa2f1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa2f1('0x4'))['db'];var utils=require(_0xa2f1('0x5'));var logger=require(_0xa2f1('0x6'))('rpc');var config=require(_0xa2f1('0x7'));var jayson=require(_0xa2f1('0x8'));var client=jayson[_0xa2f1('0x9')][_0xa2f1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48d36a,_0x16bdfc,_0x3cd1a2){return new BPromise(function(_0x2e93f4,_0x2cab89){return client['request'](_0x48d36a,_0x3cd1a2)[_0xa2f1('0xb')](function(_0x5b2e0a){logger[_0xa2f1('0xc')](_0xa2f1('0xd'),_0x16bdfc,_0xa2f1('0xe'));logger[_0xa2f1('0xf')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x16bdfc,_0xa2f1('0xe'),JSON['stringify'](_0x5b2e0a));if(_0x5b2e0a['error']){if(_0x5b2e0a[_0xa2f1('0x10')][_0xa2f1('0x11')]===0x1f4){logger[_0xa2f1('0x10')](_0xa2f1('0xd'),_0x16bdfc,_0x5b2e0a['error'][_0xa2f1('0x12')]);return _0x2cab89(_0x5b2e0a[_0xa2f1('0x10')][_0xa2f1('0x12')]);}logger[_0xa2f1('0x10')](_0xa2f1('0xd'),_0x16bdfc,_0x5b2e0a[_0xa2f1('0x10')]['message']);return _0x2e93f4(_0x5b2e0a[_0xa2f1('0x10')][_0xa2f1('0x12')]);}else{logger[_0xa2f1('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x16bdfc,_0xa2f1('0xe'));_0x2e93f4(_0x5b2e0a[_0xa2f1('0x13')][_0xa2f1('0x12')]);}})['catch'](function(_0x52cf1d){logger['error'](_0xa2f1('0xd'),_0x16bdfc,_0x52cf1d);_0x2cab89(_0x52cf1d);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index c6f74ab..a766a39 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9eac=['then','listen','info','start','map','online','join','Offline\x20apps:','status','None','./config/seedDB','default','catch','exit','lodash','./rpc','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize'];(function(_0x26a945,_0x39f54f){var _0x5a65f2=function(_0x51701b){while(--_0x51701b){_0x26a945['push'](_0x26a945['shift']());}};_0x5a65f2(++_0x39f54f);}(_0x9eac,0xf4));var _0xc9ea=function(_0x43aee5,_0x11268b){_0x43aee5=_0x43aee5-0x0;var _0x76d1d0=_0x9eac[_0x43aee5];return _0x76d1d0;};'use strict';var _=require(_0xc9ea('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0xc9ea('0x1'));var config=require(_0xc9ea('0x2'));var logger=require(_0xc9ea('0x3'))(_0xc9ea('0x4'));var pm2=require('./config/pm2');var pm2Config=require(_0xc9ea('0x5'));var schedule=require('./config/schedule');var chat=require('./config/schedule/chat');var whatsapp=require(_0xc9ea('0x6'));var transcribe=require(_0xc9ea('0x7'));function main(){return mysqldb['db'][_0xc9ea('0x8')]['sync']()[_0xc9ea('0x9')](function(){return rpc[_0xc9ea('0xa')]();})[_0xc9ea('0x9')](function(_0x18e865){logger[_0xc9ea('0xb')](_0x18e865);return chat[_0xc9ea('0xc')]();})[_0xc9ea('0x9')](function(){return whatsapp[_0xc9ea('0xc')]();})[_0xc9ea('0x9')](function(){return schedule[_0xc9ea('0xc')]();})['then'](function(){return transcribe[_0xc9ea('0xc')]();})[_0xc9ea('0x9')](function(_0xea0a5){logger[_0xc9ea('0xb')](_0xea0a5);return pm2[_0xc9ea('0xc')](pm2Config);})[_0xc9ea('0x9')](function(_0x5d97b0){logger[_0xc9ea('0xb')]('Online\x20apps:',_[_0xc9ea('0xd')](_['filter'](_0x5d97b0,{'status':_0xc9ea('0xe')}),'name')[_0xc9ea('0xf')]());logger['info'](_0xc9ea('0x10'),_['map'](_['filter'](_0x5d97b0,function(_0x361819){return _0x361819[_0xc9ea('0x11')]!==_0xc9ea('0xe');}),'name')['join']()||_0xc9ea('0x12'));config['seedDB']&&require(_0xc9ea('0x13'))[_0xc9ea('0x14')]();require('./config/license')['default']();})[_0xc9ea('0x15')](function(_0x4a4bc9){logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x4a4bc9);process[_0xc9ea('0x16')](0x1);});}main(); \ No newline at end of file +var _0x8ad2=['info','start','Online\x20apps:','map','filter','join','status','None','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./rpc','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','sync','listen','then'];(function(_0x443af1,_0x39c2d4){var _0x521c5c=function(_0x117d77){while(--_0x117d77){_0x443af1['push'](_0x443af1['shift']());}};_0x521c5c(++_0x39c2d4);}(_0x8ad2,0x91));var _0x28ad=function(_0x358b1c,_0x4f34c3){_0x358b1c=_0x358b1c-0x0;var _0x2ac97b=_0x8ad2[_0x358b1c];return _0x2ac97b;};'use strict';var _=require(_0x28ad('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0x28ad('0x1'));var config=require('./config/environment');var logger=require(_0x28ad('0x2'))(_0x28ad('0x3'));var pm2=require(_0x28ad('0x4'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x28ad('0x5'));var chat=require(_0x28ad('0x6'));var whatsapp=require(_0x28ad('0x7'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db']['sequelize'][_0x28ad('0x8')]()['then'](function(){return rpc[_0x28ad('0x9')]();})[_0x28ad('0xa')](function(_0x5ac9c2){logger[_0x28ad('0xb')](_0x5ac9c2);return chat[_0x28ad('0xc')]();})[_0x28ad('0xa')](function(){return whatsapp[_0x28ad('0xc')]();})[_0x28ad('0xa')](function(){return schedule['start']();})[_0x28ad('0xa')](function(){return transcribe[_0x28ad('0xc')]();})[_0x28ad('0xa')](function(_0x1a8027){logger['info'](_0x1a8027);return pm2[_0x28ad('0xc')](pm2Config);})[_0x28ad('0xa')](function(_0x171f39){logger['info'](_0x28ad('0xd'),_[_0x28ad('0xe')](_[_0x28ad('0xf')](_0x171f39,{'status':'online'}),'name')[_0x28ad('0x10')]());logger['info']('Offline\x20apps:',_[_0x28ad('0xe')](_['filter'](_0x171f39,function(_0x3ac346){return _0x3ac346[_0x28ad('0x11')]!=='online';}),'name')[_0x28ad('0x10')]()||_0x28ad('0x12'));config['seedDB']&&require(_0x28ad('0x13'))[_0x28ad('0x14')]();require(_0x28ad('0x15'))[_0x28ad('0x14')]();})[_0x28ad('0x16')](function(_0x57e508){logger[_0x28ad('0x17')](_0x28ad('0x18'),_0x57e508);process[_0x28ad('0x19')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 48ce7e4..b5132da 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 _0xf65a=['pass','Wrong\x20credentials.','headers','query','apikey','getUuid','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','webrtc','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','redirect','/dashboards/general','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','updatePasswordsHistory','length','join','promisify','secret','payload','options','verify','randomBytes','hex','toString','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','basic-auth','crypto','util','moment','secrets','session','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','faxPause','smsPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','isAuthenticated','use','user','ChatInteraction','findOne','params','disposition','then','closed','status','unmanaged','json','Forbidden.','catch','authorization','Basic','User','find','authenticate'];(function(_0x27d329,_0x339866){var _0x5579d7=function(_0x14362b){while(--_0x14362b){_0x27d329['push'](_0x27d329['shift']());}};_0x5579d7(++_0x339866);}(_0xf65a,0xbb));var _0xaf65=function(_0x35e519,_0x4de457){_0x35e519=_0x35e519-0x0;var _0x47b06f=_0xf65a[_0x35e519];return _0x47b06f;};'use strict';var db=require(_0xaf65('0x0'))['db'];var config=require(_0xaf65('0x1'));var hardwareConf=require(_0xaf65('0x2'));var licenseUtil=require(_0xaf65('0x3'));var encryptor=require(_0xaf65('0x4'));var _=require('lodash');var jwt=require(_0xaf65('0x5'));var expressJwt=require(_0xaf65('0x6'));var compose=require('composable-middleware');var basicAuth=require(_0xaf65('0x7'));var crypto=require(_0xaf65('0x8'));var BPromise=require('bluebird');var util=require(_0xaf65('0x9'));var moment=require(_0xaf65('0xa'));var validateJwt=expressJwt({'secret':config[_0xaf65('0xb')][_0xaf65('0xc')]});var userAttributes=['id','role',_0xaf65('0xd'),_0xaf65('0xe'),_0xaf65('0xf'),_0xaf65('0x10'),_0xaf65('0x11'),_0xaf65('0x12'),_0xaf65('0x13'),_0xaf65('0x14'),'chatPause','mailPause',_0xaf65('0x15'),_0xaf65('0x16'),_0xaf65('0x17'),_0xaf65('0x18'),'showWebBar',_0xaf65('0x19'),_0xaf65('0x1a'),_0xaf65('0x1b'),_0xaf65('0x1c'),_0xaf65('0x1d'),_0xaf65('0x1e'),'phoneBarAutoAnswer',_0xaf65('0x1f'),_0xaf65('0x20'),_0xaf65('0x21'),_0xaf65('0x22'),_0xaf65('0x23'),'phoneBarExpires',_0xaf65('0x24'),'phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk',_0xaf65('0x25'),_0xaf65('0x26'),_0xaf65('0x27'),'settingsEnabled',_0xaf65('0x28'),_0xaf65('0x29'),_0xaf65('0x2a'),_0xaf65('0x2b'),_0xaf65('0x2c'),_0xaf65('0x2d')];exports['isChatInteractionAuthorized']=function(){return this[_0xaf65('0x2e')](!![])[_0xaf65('0x2f')](function(_0xfd91d9,_0xb05369,_0x206e7d){if(_0xfd91d9[_0xaf65('0x30')]){_0x206e7d();}else{return db[_0xaf65('0x31')][_0xaf65('0x32')]({'where':{'id':_0xfd91d9[_0xaf65('0x33')]['id']},'attributes':['id','closed',_0xaf65('0x34')],'raw':!![]})[_0xaf65('0x35')](function(_0x45dd85){if(_0x45dd85&&_0x45dd85[_0xaf65('0x36')]){return _0xb05369[_0xaf65('0x37')](_0x45dd85['disposition']===_0xaf65('0x38')?0x195:0x193)[_0xaf65('0x39')]({'message':_0x45dd85[_0xaf65('0x34')]===_0xaf65('0x38')?'Unmanaged.':_0xaf65('0x3a')});}else{_0x206e7d();}})[_0xaf65('0x3b')](function(_0x24e70b){_0x206e7d(_0x24e70b);});}});};exports['isAuthenticated']=function isAuthenticated(_0x519b57){return compose()[_0xaf65('0x2f')](function(_0x4b5916,_0x1bbf34,_0xda6d13){var _0x296776;if(_0x4b5916['headers'][_0xaf65('0x3c')]){if(_['startsWith'](_0x4b5916['headers']['authorization'],_0xaf65('0x3d'))){var _0x1d8a47=basicAuth(_0x4b5916);db[_0xaf65('0x3e')][_0xaf65('0x3f')]({'where':{'name':_0x1d8a47[_0xaf65('0xe')]}})['then'](function(_0x486d92){if(!_0x486d92||!_0x486d92[_0xaf65('0x40')](_0x1d8a47[_0xaf65('0x41')])){return _0x1bbf34['status'](0x191)[_0xaf65('0x39')]({'message':_0xaf65('0x42')});}_0x4b5916['user']={'id':_0x486d92['id']};_0xda6d13();})[_0xaf65('0x3b')](function(_0x213ddc){_0xda6d13(_0x213ddc);});}else if(_['startsWith'](_0x4b5916[_0xaf65('0x43')][_0xaf65('0x3c')],'Bearer')){validateJwt(_0x4b5916,_0x1bbf34,_0xda6d13);}else{if(_0x519b57){_0xda6d13();}else{return _0x1bbf34[_0xaf65('0x37')](0x193)[_0xaf65('0x39')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x4b5916[_0xaf65('0x44')][_0xaf65('0x45')]){try{var _0x3afd04={'audience':hardwareConf[_0xaf65('0x46')](),'issuer':hardwareConf[_0xaf65('0x46')]()};verifyJwt(_0x4b5916[_0xaf65('0x44')][_0xaf65('0x45')],_0x3afd04)[_0xaf65('0x35')](function(_0x43c70c){return db[_0xaf65('0x3e')][_0xaf65('0x3f')]({'where':{'id':_0x43c70c[_0xaf65('0x47')]}})['then'](function(_0x1aec78){_0x296776=_0x1aec78;return db[_0xaf65('0x48')]['findOne']({'where':{'id':0x1},'attributes':[_0xaf65('0x49'),_0xaf65('0x4a')],'raw':!![]});})[_0xaf65('0x35')](function(_0x4ade89){if(!_0x296776||!_[_0xaf65('0x4b')](_0x296776[_0xaf65('0x4c')],_0x43c70c[_0xaf65('0x4d')])){return _0x1bbf34['status'](0x191)[_0xaf65('0x39')]({'message':_0xaf65('0x4e')});}if(_0x296776['disabled']){return _0x1bbf34[_0xaf65('0x37')](0x191)[_0xaf65('0x39')]({'message':_0xaf65('0x4f')});}if(_0x296776[_0xaf65('0x50')]){if(_0x4ade89[_0xaf65('0x4a')]>0x0){if(moment(_0x296776[_0xaf65('0x51')])[_0xaf65('0x52')](_0x4ade89['blockDuration'],_0xaf65('0x53'))>moment()){return _0x1bbf34[_0xaf65('0x37')](0x191)['json']({'message':_0xaf65('0x4f')});}}else{return _0x1bbf34[_0xaf65('0x37')](0x191)['json']({'message':_0xaf65('0x4f')});}}_0x4b5916[_0xaf65('0x30')]={'id':_0x296776['id']};_0xda6d13();});})[_0xaf65('0x3b')](function(){return _0x1bbf34[_0xaf65('0x37')](0x191)[_0xaf65('0x39')]({'message':_0xaf65('0x4f')});});}catch(_0x43c85c){_0xda6d13(_0x43c85c);}}else if(_0x519b57){_0xda6d13();}else{return _0x1bbf34[_0xaf65('0x37')](0x193)['json']({'message':_0xaf65('0x54')});}})[_0xaf65('0x2f')](function(_0x5d223c,_0x2646cc,_0x51e19a){if(_0x5d223c[_0xaf65('0x30')]){db['User']['find']({'where':{'id':_0x5d223c[_0xaf65('0x30')]['id']},'attributes':userAttributes})['then'](function(_0x280806){if(!_0x280806){return _0x2646cc[_0xaf65('0x37')](0x194)[_0xaf65('0x39')]({'message':_0xaf65('0x55')});}_0x5d223c[_0xaf65('0x30')]=_0x280806;_0x51e19a();})['catch'](function(_0x7b43ad){_0x51e19a(_0x7b43ad);});}else if(_0x519b57){_0x51e19a();}else{return _0x2646cc['status'](0x194)[_0xaf65('0x39')]({'message':_0xaf65('0x56')});}});};exports[_0xaf65('0x57')]=function canUpdate(){return compose()[_0xaf65('0x2f')](function(_0x1c2ebe,_0x49d330,_0x4819d2){return licenseUtil[_0xaf65('0x58')]()[_0xaf65('0x35')](function(_0x2d39a2){if(_0x2d39a2[_0xaf65('0x59')]){_0x4819d2();}else{return _0x49d330[_0xaf65('0x37')](0x193)[_0xaf65('0x39')]({'message':'Forbidden'});}})[_0xaf65('0x3b')](function(_0x4a56d0){_0x4819d2(_0x4a56d0);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0xaf65('0x2f')](function(_0x304314,_0x5c7e5c,_0x30034b){return licenseUtil[_0xaf65('0x58')]()[_0xaf65('0x35')](function(_0x25a2aa){if(_0x25a2aa[_0xaf65('0x5a')]){_0x30034b();}else{return _0x5c7e5c[_0xaf65('0x37')](0x193)[_0xaf65('0x39')]({'message':_0xaf65('0x5b')});}})[_0xaf65('0x3b')](function(_0x205ec5){_0x30034b(_0x205ec5);});});};exports[_0xaf65('0x5c')]=function(_0x125213,_0x4841af,_0x5172a2){_0x125213[_0xaf65('0x5c')]=!![];return _0x5172a2();};exports[_0xaf65('0x5d')]=function signToken(_0xb97b58){return signJwt(_0xb97b58);};exports[_0xaf65('0x5e')]=function(_0xe68270,_0x1f4f97){if(!_0xe68270[_0xaf65('0x30')]){return _0x1f4f97[_0xaf65('0x37')](0x194)[_0xaf65('0x39')]({'message':_0xaf65('0x5f')});}var _0x2fff47={'payload':{'id':_0xe68270['user']['id'],'role':_0xe68270[_0xaf65('0x30')][_0xaf65('0x60')]},'options':{'expiresIn':0x15180}};return signJwt(_0x2fff47)[_0xaf65('0x35')](function(_0x488ff4){_0x1f4f97['cookie']('motion.token',_0x488ff4);_0x1f4f97[_0xaf65('0x61')](_0xaf65('0x62'));})[_0xaf65('0x3b')](function(_0x46ceb3){return _0x1f4f97[_0xaf65('0x37')](0x1f4)[_0xaf65('0x63')](_0x46ceb3);});};exports['retrieveApiKey']=function(_0x4d80c9){if(_[_0xaf65('0x64')](_0x4d80c9['apiKeyNonce'])||_[_0xaf65('0x64')](_0x4d80c9[_0xaf65('0x65')])){return null;}else{return createJwt(_0x4d80c9);}};exports[_0xaf65('0x66')]=function(_0x56abc8){_0x56abc8[_0xaf65('0x4c')]=generateNonce();_0x56abc8['apiKeyIat']=generateIssuedAt();return createJwt(_0x56abc8);};exports[_0xaf65('0x67')]=function(_0x1c5c1a,_0x371daf){var _0x142cc6=_0x1c5c1a['query'][_0xaf65('0x45')];if(_0x142cc6){var _0x33cc6b={'nonce':_0x371daf[_0xaf65('0x4c')],'iat':_0x371daf[_0xaf65('0x65')],'audience':hardwareConf[_0xaf65('0x46')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x142cc6,_0x33cc6b)[_0xaf65('0x35')](function(){return generateApiKey(_0x371daf);});}else{throw{'message':_0xaf65('0x68')};}};exports[_0xaf65('0x69')]=function(_0x5418bc){var _0x4064ce=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x4064ce[_0xaf65('0x6a')](_0x5418bc))throw new db[(_0xaf65('0x6b'))][(_0xaf65('0x6c'))](_0xaf65('0x6d'));return;};exports[_0xaf65('0x6e')]=function(_0x2e6f94,_0x31ed70,_0x434d4a){var _0x57adfa=encryptor[_0xaf65('0x6f')](_0x31ed70)[_0xaf65('0x70')](',');for(var _0x23acf2=0x0;_0x23acf2<_0x434d4a;_0x23acf2++){if(!_0x57adfa[_0x23acf2])break;if(_0x2e6f94[_0xaf65('0x71')]()===_0x57adfa[_0x23acf2][_0xaf65('0x71')]()){var _0x391457=util[_0xaf65('0x72')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x434d4a);if(_0x434d4a===0x1){_0x391457='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db['Sequelize'][(_0xaf65('0x6c'))](_0x391457);}}return;};exports[_0xaf65('0x73')]=function(_0x5c69e6,_0x19f171){var _0x45989a=_0x19f171?encryptor['decryptString'](_0x19f171)['split'](','):[];if(_0x45989a[_0xaf65('0x74')]===0x5){_0x45989a['splice'](-0x1,0x1);}_0x45989a['unshift'](_0x5c69e6);return encryptor['encryptString'](_0x45989a[_0xaf65('0x75')](','));};function signJwt(_0x47e406){var _0x2da68b=BPromise[_0xaf65('0x76')](jwt['sign'],{'context':jwt});var _0x40932e=_0x47e406[_0xaf65('0x77')]||config[_0xaf65('0xb')][_0xaf65('0xc')];return new BPromise(function(_0x1f4764,_0x18ab82){_0x2da68b(_0x47e406[_0xaf65('0x78')],_0x40932e,_0x47e406[_0xaf65('0x79')])[_0xaf65('0x35')](function(_0x5455d9){_0x1f4764(_0x5455d9);})[_0xaf65('0x3b')](function(_0x4c7fa1){_0x18ab82(_0x4c7fa1);});});}function verifyJwt(_0x382755,_0x2125d7,_0x40e40f){var _0x19cbff=BPromise[_0xaf65('0x76')](jwt[_0xaf65('0x7a')],{'context':jwt});var _0x51d78f=_0x40e40f||config['secrets'][_0xaf65('0xc')];return new BPromise(function(_0x114b5e,_0x32d537){_0x19cbff(_0x382755,_0x51d78f,_0x2125d7)[_0xaf65('0x35')](function(_0x20db57){_0x114b5e(_0x20db57);})[_0xaf65('0x3b')](function(_0x4ede89){_0x32d537(_0x4ede89);});});}function generateNonce(){return crypto[_0xaf65('0x7b')](0x10)['toString'](_0xaf65('0x7c'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0xaf65('0x7d')]();}function createJwt(_0x1e91ec){var _0x6f4b6b={'payload':{'iat':_0x1e91ec['apiKeyIat'],'nonce':_0x1e91ec[_0xaf65('0x4c')]},'options':{'algorithm':'HS512','subject':_0x1e91ec['id'][_0xaf65('0x7d')](),'issuer':hardwareConf[_0xaf65('0x46')](),'audience':hardwareConf[_0xaf65('0x46')]()}};return signJwt(_0x6f4b6b)[_0xaf65('0x35')](function(_0x3eb38e){return{'iat':_0x1e91ec[_0xaf65('0x65')],'nonce':_0x1e91ec[_0xaf65('0x4c')],'token':_0x3eb38e};});} \ No newline at end of file +var _0xc66c=['util','moment','secrets','session','role','fullname','name','internal','email','userpic','permissions','md5secret','faxPause','smsPause','openchannelPause','pauseType','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','Forbidden.','startsWith','headers','authorization','Basic','User','find','authenticate','pass','Wrong\x20credentials.','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','blockDuration','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','minutes','Invalid\x20API\x20access\x20key','catch','User\x20not\x20found.','Forbidden','isWebrtcLicence','getLicense','webrtc','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','sign','payload','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware'];(function(_0x28a725,_0x117901){var _0x305969=function(_0x261d8a){while(--_0x261d8a){_0x28a725['push'](_0x28a725['shift']());}};_0x305969(++_0x117901);}(_0xc66c,0x77));var _0xcc66=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xc66c[_0x17d9e3];return _0x14192d;};'use strict';var db=require(_0xcc66('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xcc66('0x1'));var encryptor=require(_0xcc66('0x2'));var _=require(_0xcc66('0x3'));var jwt=require(_0xcc66('0x4'));var expressJwt=require(_0xcc66('0x5'));var compose=require(_0xcc66('0x6'));var basicAuth=require('basic-auth');var crypto=require('crypto');var BPromise=require('bluebird');var util=require(_0xcc66('0x7'));var moment=require(_0xcc66('0x8'));var validateJwt=expressJwt({'secret':config[_0xcc66('0x9')][_0xcc66('0xa')]});var userAttributes=['id',_0xcc66('0xb'),_0xcc66('0xc'),_0xcc66('0xd'),_0xcc66('0xe'),_0xcc66('0xf'),_0xcc66('0x10'),_0xcc66('0x11'),_0xcc66('0x12'),'voicePause','chatPause','mailPause',_0xcc66('0x13'),_0xcc66('0x14'),_0xcc66('0x15'),_0xcc66('0x16'),'showWebBar','lastLoginAt',_0xcc66('0x17'),_0xcc66('0x18'),_0xcc66('0x19'),_0xcc66('0x1a'),_0xcc66('0x1b'),_0xcc66('0x1c'),'phoneBarAutoAnswerDelay',_0xcc66('0x1d'),_0xcc66('0x1e'),_0xcc66('0x1f'),'phoneBarEnableSettings',_0xcc66('0x20'),_0xcc66('0x21'),_0xcc66('0x22'),_0xcc66('0x23'),_0xcc66('0x24'),_0xcc66('0x25'),_0xcc66('0x26'),_0xcc66('0x27'),_0xcc66('0x28'),'wssPort',_0xcc66('0x29'),'downloadOmnichannelInteractions',_0xcc66('0x2a'),_0xcc66('0x2b'),_0xcc66('0x2c')];exports['isChatInteractionAuthorized']=function(){return this[_0xcc66('0x2d')](!![])[_0xcc66('0x2e')](function(_0x29a5a4,_0x3208c1,_0x164c0a){if(_0x29a5a4[_0xcc66('0x2f')]){_0x164c0a();}else{return db[_0xcc66('0x30')][_0xcc66('0x31')]({'where':{'id':_0x29a5a4[_0xcc66('0x32')]['id']},'attributes':['id',_0xcc66('0x33'),_0xcc66('0x34')],'raw':!![]})[_0xcc66('0x35')](function(_0x4c48e3){if(_0x4c48e3&&_0x4c48e3[_0xcc66('0x33')]){return _0x3208c1[_0xcc66('0x36')](_0x4c48e3[_0xcc66('0x34')]===_0xcc66('0x37')?0x195:0x193)[_0xcc66('0x38')]({'message':_0x4c48e3[_0xcc66('0x34')]===_0xcc66('0x37')?_0xcc66('0x39'):_0xcc66('0x3a')});}else{_0x164c0a();}})['catch'](function(_0x58f52a){_0x164c0a(_0x58f52a);});}});};exports['isAuthenticated']=function isAuthenticated(_0xc80dea){return compose()['use'](function(_0x3210f3,_0x1bd09f,_0x11043b){var _0x52c4be;if(_0x3210f3['headers']['authorization']){if(_[_0xcc66('0x3b')](_0x3210f3[_0xcc66('0x3c')][_0xcc66('0x3d')],_0xcc66('0x3e'))){var _0x45934b=basicAuth(_0x3210f3);db[_0xcc66('0x3f')][_0xcc66('0x40')]({'where':{'name':_0x45934b[_0xcc66('0xd')]}})[_0xcc66('0x35')](function(_0x41b68b){if(!_0x41b68b||!_0x41b68b[_0xcc66('0x41')](_0x45934b[_0xcc66('0x42')])){return _0x1bd09f[_0xcc66('0x36')](0x191)[_0xcc66('0x38')]({'message':_0xcc66('0x43')});}_0x3210f3['user']={'id':_0x41b68b['id']};_0x11043b();})['catch'](function(_0xe263f1){_0x11043b(_0xe263f1);});}else if(_['startsWith'](_0x3210f3[_0xcc66('0x3c')][_0xcc66('0x3d')],'Bearer')){validateJwt(_0x3210f3,_0x1bd09f,_0x11043b);}else{if(_0xc80dea){_0x11043b();}else{return _0x1bd09f['status'](0x193)['json']({'message':_0xcc66('0x44')});}}}else if(_0x3210f3[_0xcc66('0x45')][_0xcc66('0x46')]){try{var _0xbcdc8a={'audience':hardwareConf[_0xcc66('0x47')](),'issuer':hardwareConf[_0xcc66('0x47')]()};verifyJwt(_0x3210f3[_0xcc66('0x45')][_0xcc66('0x46')],_0xbcdc8a)[_0xcc66('0x35')](function(_0x878d10){return db[_0xcc66('0x3f')][_0xcc66('0x40')]({'where':{'id':_0x878d10[_0xcc66('0x48')]}})['then'](function(_0x3f6948){_0x52c4be=_0x3f6948;return db[_0xcc66('0x49')][_0xcc66('0x31')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xcc66('0x4a')],'raw':!![]});})['then'](function(_0xe0bf5){if(!_0x52c4be||!_['isEqual'](_0x52c4be[_0xcc66('0x4b')],_0x878d10['nonce'])){return _0x1bd09f[_0xcc66('0x36')](0x191)[_0xcc66('0x38')]({'message':_0xcc66('0x4c')});}if(_0x52c4be[_0xcc66('0x4d')]){return _0x1bd09f[_0xcc66('0x36')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}if(_0x52c4be[_0xcc66('0x4e')]){if(_0xe0bf5[_0xcc66('0x4a')]>0x0){if(moment(_0x52c4be[_0xcc66('0x4f')])['add'](_0xe0bf5[_0xcc66('0x4a')],_0xcc66('0x50'))>moment()){return _0x1bd09f[_0xcc66('0x36')](0x191)[_0xcc66('0x38')]({'message':_0xcc66('0x51')});}}else{return _0x1bd09f['status'](0x191)[_0xcc66('0x38')]({'message':_0xcc66('0x51')});}}_0x3210f3[_0xcc66('0x2f')]={'id':_0x52c4be['id']};_0x11043b();});})[_0xcc66('0x52')](function(){return _0x1bd09f[_0xcc66('0x36')](0x191)[_0xcc66('0x38')]({'message':_0xcc66('0x51')});});}catch(_0x3730a7){_0x11043b(_0x3730a7);}}else if(_0xc80dea){_0x11043b();}else{return _0x1bd09f[_0xcc66('0x36')](0x193)[_0xcc66('0x38')]({'message':_0xcc66('0x44')});}})[_0xcc66('0x2e')](function(_0x10f41d,_0x58850c,_0x5aacd3){if(_0x10f41d[_0xcc66('0x2f')]){db[_0xcc66('0x3f')]['find']({'where':{'id':_0x10f41d[_0xcc66('0x2f')]['id']},'attributes':userAttributes})[_0xcc66('0x35')](function(_0x64b629){if(!_0x64b629){return _0x58850c['status'](0x194)['json']({'message':_0xcc66('0x53')});}_0x10f41d[_0xcc66('0x2f')]=_0x64b629;_0x5aacd3();})[_0xcc66('0x52')](function(_0x281c57){_0x5aacd3(_0x281c57);});}else if(_0xc80dea){_0x5aacd3();}else{return _0x58850c[_0xcc66('0x36')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x153aca,_0x53e85c,_0x35adab){return licenseUtil['getLicense']()[_0xcc66('0x35')](function(_0x511088){if(_0x511088['update']){_0x35adab();}else{return _0x53e85c['status'](0x193)[_0xcc66('0x38')]({'message':_0xcc66('0x54')});}})[_0xcc66('0x52')](function(_0x581c1a){_0x35adab(_0x581c1a);});});};exports[_0xcc66('0x55')]=function isWebrtcLicence(){return compose()[_0xcc66('0x2e')](function(_0x3463be,_0x28692e,_0x2755dd){return licenseUtil[_0xcc66('0x56')]()[_0xcc66('0x35')](function(_0x2a0a20){if(_0x2a0a20[_0xcc66('0x57')]){_0x2755dd();}else{return _0x28692e['status'](0x193)[_0xcc66('0x38')]({'message':_0xcc66('0x54')});}})['catch'](function(_0x4dc3bb){_0x2755dd(_0x4dc3bb);});});};exports[_0xcc66('0x58')]=function(_0x57e02b,_0x2e75b4,_0x115655){_0x57e02b[_0xcc66('0x58')]=!![];return _0x115655();};exports[_0xcc66('0x59')]=function signToken(_0x183f22){return signJwt(_0x183f22);};exports['setTokenCookie']=function(_0x549b14,_0xde054c){if(!_0x549b14['user']){return _0xde054c[_0xcc66('0x36')](0x194)[_0xcc66('0x38')]({'message':_0xcc66('0x5a')});}var _0x46f0c4={'payload':{'id':_0x549b14[_0xcc66('0x2f')]['id'],'role':_0x549b14[_0xcc66('0x2f')][_0xcc66('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x46f0c4)[_0xcc66('0x35')](function(_0x397cfd){_0xde054c[_0xcc66('0x5b')]('motion.token',_0x397cfd);_0xde054c[_0xcc66('0x5c')]('/dashboards/general');})[_0xcc66('0x52')](function(_0x354c90){return _0xde054c[_0xcc66('0x36')](0x1f4)[_0xcc66('0x5d')](_0x354c90);});};exports[_0xcc66('0x5e')]=function(_0x347d9f){if(_[_0xcc66('0x5f')](_0x347d9f[_0xcc66('0x4b')])||_[_0xcc66('0x5f')](_0x347d9f[_0xcc66('0x60')])){return null;}else{return createJwt(_0x347d9f);}};exports[_0xcc66('0x61')]=function(_0x39a459){_0x39a459['apiKeyNonce']=generateNonce();_0x39a459[_0xcc66('0x60')]=generateIssuedAt();return createJwt(_0x39a459);};exports[_0xcc66('0x62')]=function(_0xe68c6b,_0x3bccda){var _0x147448=_0xe68c6b[_0xcc66('0x45')][_0xcc66('0x46')];if(_0x147448){var _0x32cde3={'nonce':_0x3bccda[_0xcc66('0x4b')],'iat':_0x3bccda[_0xcc66('0x60')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x147448,_0x32cde3)[_0xcc66('0x35')](function(){return generateApiKey(_0x3bccda);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xcc66('0x63')]=function(_0x314b42){var _0x266887=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x266887[_0xcc66('0x64')](_0x314b42))throw new db[(_0xcc66('0x65'))][(_0xcc66('0x66'))](_0xcc66('0x67'));return;};exports['validatePasswordHistory']=function(_0x1a5a6e,_0x1090ea,_0x546a17){var _0x162918=encryptor[_0xcc66('0x68')](_0x1090ea)[_0xcc66('0x69')](',');for(var _0x2e0b9d=0x0;_0x2e0b9d<_0x546a17;_0x2e0b9d++){if(!_0x162918[_0x2e0b9d])break;if(_0x1a5a6e['toLowerCase']()===_0x162918[_0x2e0b9d][_0xcc66('0x6a')]()){var _0x5dd55f=util[_0xcc66('0x6b')](_0xcc66('0x6c'),_0x546a17);if(_0x546a17===0x1){_0x5dd55f=_0xcc66('0x6d');}throw new db[(_0xcc66('0x65'))]['ValidationError'](_0x5dd55f);}}return;};exports[_0xcc66('0x6e')]=function(_0x3cb71f,_0x406791){var _0x5c81b5=_0x406791?encryptor[_0xcc66('0x68')](_0x406791)[_0xcc66('0x69')](','):[];if(_0x5c81b5[_0xcc66('0x6f')]===0x5){_0x5c81b5[_0xcc66('0x70')](-0x1,0x1);}_0x5c81b5[_0xcc66('0x71')](_0x3cb71f);return encryptor[_0xcc66('0x72')](_0x5c81b5[_0xcc66('0x73')](','));};function signJwt(_0x4bb3df){var _0x447d5e=BPromise[_0xcc66('0x74')](jwt[_0xcc66('0x75')],{'context':jwt});var _0xa66aad=_0x4bb3df['secret']||config[_0xcc66('0x9')]['session'];return new BPromise(function(_0x56dd4d,_0x41b34e){_0x447d5e(_0x4bb3df[_0xcc66('0x76')],_0xa66aad,_0x4bb3df['options'])[_0xcc66('0x35')](function(_0x37cd11){_0x56dd4d(_0x37cd11);})[_0xcc66('0x52')](function(_0x405e2b){_0x41b34e(_0x405e2b);});});}function verifyJwt(_0x208aba,_0x25cfa2,_0x506736){var _0x22a33e=BPromise[_0xcc66('0x74')](jwt[_0xcc66('0x77')],{'context':jwt});var _0x20a8d3=_0x506736||config[_0xcc66('0x9')]['session'];return new BPromise(function(_0x31c425,_0x191334){_0x22a33e(_0x208aba,_0x20a8d3,_0x25cfa2)['then'](function(_0x3f6566){_0x31c425(_0x3f6566);})['catch'](function(_0x5f1eef){_0x191334(_0x5f1eef);});});}function generateNonce(){return crypto[_0xcc66('0x78')](0x10)[_0xcc66('0x79')](_0xcc66('0x7a'));}function generateIssuedAt(){return Math[_0xcc66('0x7b')](Date[_0xcc66('0x7c')]()/0x3e8)[_0xcc66('0x79')]();}function createJwt(_0x2f2ad9){var _0x3ae16c={'payload':{'iat':_0x2f2ad9[_0xcc66('0x60')],'nonce':_0x2f2ad9[_0xcc66('0x4b')]},'options':{'algorithm':_0xcc66('0x7d'),'subject':_0x2f2ad9['id']['toString'](),'issuer':hardwareConf[_0xcc66('0x47')](),'audience':hardwareConf[_0xcc66('0x47')]()}};return signJwt(_0x3ae16c)[_0xcc66('0x35')](function(_0x55f6e8){return{'iat':_0x2f2ad9[_0xcc66('0x60')],'nonce':_0x2f2ad9[_0xcc66('0x4b')],'token':_0x55f6e8};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 726958b..25f39f4 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 _0x9cd4=['secret','utf8','base64','decryptString','lodash','../../config/environment','../../config/logger','app','secrets','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','binary','end','write','close','unlink','decryptFile','createDecipher','update','final','encryptString'];(function(_0x4debaa,_0x3690db){var _0x234eb6=function(_0x5b3699){while(--_0x5b3699){_0x4debaa['push'](_0x4debaa['shift']());}};_0x234eb6(++_0x3690db);}(_0x9cd4,0x185));var _0x49cd=function(_0x5e944a,_0x2847b4){_0x5e944a=_0x5e944a-0x0;var _0x38f07b=_0x9cd4[_0x5e944a];return _0x38f07b;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x49cd('0x0'));var config=require(_0x49cd('0x1'));var logger=require(_0x49cd('0x2'))(_0x49cd('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x49cd('0x4')]['session'],'algorithm':_0x49cd('0x5')};const fileOptions={'algorithm':_0x49cd('0x6')};if(config[_0x49cd('0x7')]&&config[_0x49cd('0x7')][_0x49cd('0x8')]){var isSupported=isAlgorithmSupported(config[_0x49cd('0x7')][_0x49cd('0x8')]);if(isSupported){fileOptions[_0x49cd('0x8')]=config[_0x49cd('0x7')][_0x49cd('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x49cd('0x9')](',\x20');logger[_0x49cd('0xa')](config[_0x49cd('0x7')]['algorithm'],_0x49cd('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x1fb4fa){return AES_SUPPORTED_RX[_0x49cd('0xc')](_0x1fb4fa);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x49cd('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x223c02){return getSupportedCiphers()[_0x49cd('0xe')](_0x223c02)>-0x1;}function combineOptions(_0x38652e){var _0x5e68d4={};for(var _0x22aa3e in fileOptions){if(fileOptions[_0x49cd('0xf')](_0x22aa3e)){_0x5e68d4[_0x22aa3e]=fileOptions[_0x22aa3e];}}if(_0x38652e){for(var _0x37a8e8 in _0x38652e){if(_0x38652e[_0x49cd('0xf')](_0x37a8e8)){_0x5e68d4[_0x37a8e8]=_0x38652e[_0x37a8e8];}}}return _0x5e68d4;}exports[_0x49cd('0x10')]=function(_0x210ecd,_0x2dbc98,_0x2b8024,_0x4d9cf7){return new BPromise(function(_0x2d039f,_0x3a4238){_0x4d9cf7=combineOptions(_0x4d9cf7);var _0x333891=new Buffer(_0x2b8024);var _0x48c79b=fs[_0x49cd('0x11')](_0x210ecd);var _0x4ba7d=fs[_0x49cd('0x12')](_0x2dbc98);var _0x465ee9=crypto[_0x49cd('0x13')](_0x4d9cf7[_0x49cd('0x8')],_0x333891);_0x48c79b['on'](_0x49cd('0x14'),function(_0x295ec0){var _0x332808=new Buffer(_0x465ee9['update'](_0x295ec0),_0x49cd('0x15'));_0x4ba7d['write'](_0x332808);});_0x48c79b['on'](_0x49cd('0x16'),function(){try{var _0x2a9ebc=new Buffer(_0x465ee9['final'](_0x49cd('0x15')),'binary');_0x4ba7d[_0x49cd('0x17')](_0x2a9ebc);_0x4ba7d[_0x49cd('0x16')]();_0x4ba7d['on'](_0x49cd('0x18'),function(){return _0x2d039f(_0x2dbc98);});}catch(_0x3d264e){fs[_0x49cd('0x19')](_0x2dbc98);return _0x3a4238(_0x3d264e);}});});};exports[_0x49cd('0x1a')]=function(_0x900ec6,_0x204b71,_0x466ccf,_0x393cf3){return new BPromise(function(_0x48e2bb,_0x3d8aa4){_0x393cf3=combineOptions(_0x393cf3);var _0x2e117f=new Buffer(_0x466ccf);var _0x480b5d=fs['createReadStream'](_0x900ec6);var _0xed790e=fs[_0x49cd('0x12')](_0x204b71);var _0x53a6ee=crypto[_0x49cd('0x1b')](_0x393cf3[_0x49cd('0x8')],_0x2e117f);_0x480b5d['on'](_0x49cd('0x14'),function(_0x20f0b6){var _0x6907ad=new Buffer(_0x53a6ee[_0x49cd('0x1c')](_0x20f0b6),_0x49cd('0x15'));_0xed790e[_0x49cd('0x17')](_0x6907ad);});_0x480b5d['on']('end',function(){try{var _0xaccf8a=new Buffer(_0x53a6ee[_0x49cd('0x1d')](_0x49cd('0x15')),_0x49cd('0x15'));_0xed790e[_0x49cd('0x17')](_0xaccf8a);_0xed790e[_0x49cd('0x16')]();_0xed790e['on'](_0x49cd('0x18'),function(){return _0x48e2bb(_0x204b71);});}catch(_0x1020cf){fs[_0x49cd('0x19')](_0x204b71);return _0x3d8aa4(_0x1020cf);}});});};exports[_0x49cd('0x1e')]=function(_0x23a610,_0x1d4fea,_0x1cbba5){var _0x5b9907=_0x1cbba5||stringOptions[_0x49cd('0x8')];var _0x1fdea2=_0x1d4fea||stringOptions[_0x49cd('0x1f')];var _0x44d992=crypto[_0x49cd('0x13')](_0x5b9907,_0x1fdea2);var _0x52f70b=_0x44d992['update'](_0x23a610,_0x49cd('0x20'),_0x49cd('0x21'));_0x52f70b+=_0x44d992[_0x49cd('0x1d')](_0x49cd('0x21'));return _0x52f70b;};exports[_0x49cd('0x22')]=function(_0x4b4fd4,_0x3b3b59,_0x2ec8b3){var _0x42e28b=_0x2ec8b3||stringOptions[_0x49cd('0x8')];var _0x2d2e49=_0x3b3b59||stringOptions[_0x49cd('0x1f')];var _0x3d5950=crypto[_0x49cd('0x1b')](_0x42e28b,_0x2d2e49);var _0x4fd233=_0x3d5950[_0x49cd('0x1c')](_0x4b4fd4,'base64',_0x49cd('0x20'));_0x4fd233+=_0x3d5950[_0x49cd('0x1d')](_0x49cd('0x20'));return _0x4fd233;}; \ No newline at end of file +var _0xbb72=['binary','write','end','final','unlink','decryptFile','createWriteStream','createDecipher','close','secret','createCipher','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','aes192','encrypt','algorithm','join','error','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','data','update'];(function(_0x3d44a9,_0x36fd3a){var _0x1ce0a6=function(_0x4ad80a){while(--_0x4ad80a){_0x3d44a9['push'](_0x3d44a9['shift']());}};_0x1ce0a6(++_0x36fd3a);}(_0xbb72,0x176));var _0x2bb7=function(_0xff4b2d,_0xcaa14c){_0xff4b2d=_0xff4b2d-0x0;var _0x2c230a=_0xbb72[_0xff4b2d];return _0x2c230a;};'use strict';var crypto=require(_0x2bb7('0x0'));var fs=require('fs');var BPromise=require(_0x2bb7('0x1'));var _=require(_0x2bb7('0x2'));var config=require(_0x2bb7('0x3'));var logger=require(_0x2bb7('0x4'))(_0x2bb7('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x2bb7('0x6')][_0x2bb7('0x7')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x2bb7('0x8')};if(config[_0x2bb7('0x9')]&&config[_0x2bb7('0x9')][_0x2bb7('0xa')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x2bb7('0xa')]);if(isSupported){fileOptions['algorithm']=config[_0x2bb7('0x9')][_0x2bb7('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x2bb7('0xb')](',\x20');logger[_0x2bb7('0xc')](config[_0x2bb7('0x9')][_0x2bb7('0xa')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x4498be){return AES_SUPPORTED_RX[_0x2bb7('0xd')](_0x4498be);}function getSupportedCiphers(){return crypto[_0x2bb7('0xe')]()[_0x2bb7('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x1ffc00){return getSupportedCiphers()[_0x2bb7('0x10')](_0x1ffc00)>-0x1;}function combineOptions(_0x118ff8){var _0x3e57d7={};for(var _0x3d5ef7 in fileOptions){if(fileOptions[_0x2bb7('0x11')](_0x3d5ef7)){_0x3e57d7[_0x3d5ef7]=fileOptions[_0x3d5ef7];}}if(_0x118ff8){for(var _0x41653f in _0x118ff8){if(_0x118ff8[_0x2bb7('0x11')](_0x41653f)){_0x3e57d7[_0x41653f]=_0x118ff8[_0x41653f];}}}return _0x3e57d7;}exports[_0x2bb7('0x12')]=function(_0x444665,_0x47c210,_0x512e91,_0x1ce7d1){return new BPromise(function(_0x5783ca,_0x12ada7){_0x1ce7d1=combineOptions(_0x1ce7d1);var _0x597864=new Buffer(_0x512e91);var _0x405525=fs[_0x2bb7('0x13')](_0x444665);var _0x27e455=fs['createWriteStream'](_0x47c210);var _0xda3d9a=crypto['createCipher'](_0x1ce7d1['algorithm'],_0x597864);_0x405525['on'](_0x2bb7('0x14'),function(_0x1c27ec){var _0x11d975=new Buffer(_0xda3d9a[_0x2bb7('0x15')](_0x1c27ec),_0x2bb7('0x16'));_0x27e455[_0x2bb7('0x17')](_0x11d975);});_0x405525['on'](_0x2bb7('0x18'),function(){try{var _0x34adb7=new Buffer(_0xda3d9a[_0x2bb7('0x19')](_0x2bb7('0x16')),'binary');_0x27e455[_0x2bb7('0x17')](_0x34adb7);_0x27e455[_0x2bb7('0x18')]();_0x27e455['on']('close',function(){return _0x5783ca(_0x47c210);});}catch(_0x44773a){fs[_0x2bb7('0x1a')](_0x47c210);return _0x12ada7(_0x44773a);}});});};exports[_0x2bb7('0x1b')]=function(_0x2c16cb,_0x32cfc8,_0x238ff4,_0x2a6c3){return new BPromise(function(_0x4b6d02,_0x1d9ef8){_0x2a6c3=combineOptions(_0x2a6c3);var _0x571f64=new Buffer(_0x238ff4);var _0x16b686=fs[_0x2bb7('0x13')](_0x2c16cb);var _0x2c8ce4=fs[_0x2bb7('0x1c')](_0x32cfc8);var _0x102cb7=crypto[_0x2bb7('0x1d')](_0x2a6c3[_0x2bb7('0xa')],_0x571f64);_0x16b686['on']('data',function(_0x3edbe4){var _0xcfb5b5=new Buffer(_0x102cb7['update'](_0x3edbe4),_0x2bb7('0x16'));_0x2c8ce4['write'](_0xcfb5b5);});_0x16b686['on']('end',function(){try{var _0x270002=new Buffer(_0x102cb7[_0x2bb7('0x19')]('binary'),_0x2bb7('0x16'));_0x2c8ce4[_0x2bb7('0x17')](_0x270002);_0x2c8ce4[_0x2bb7('0x18')]();_0x2c8ce4['on'](_0x2bb7('0x1e'),function(){return _0x4b6d02(_0x32cfc8);});}catch(_0x3ac7ab){fs[_0x2bb7('0x1a')](_0x32cfc8);return _0x1d9ef8(_0x3ac7ab);}});});};exports['encryptString']=function(_0x3f9453,_0x33eacf,_0x4f6300){var _0x55f4e6=_0x4f6300||stringOptions['algorithm'];var _0x3893cf=_0x33eacf||stringOptions[_0x2bb7('0x1f')];var _0x594602=crypto[_0x2bb7('0x20')](_0x55f4e6,_0x3893cf);var _0x376a80=_0x594602[_0x2bb7('0x15')](_0x3f9453,_0x2bb7('0x21'),_0x2bb7('0x22'));_0x376a80+=_0x594602[_0x2bb7('0x19')](_0x2bb7('0x22'));return _0x376a80;};exports[_0x2bb7('0x23')]=function(_0x44a34f,_0x5703e2,_0x2de5be){var _0x28d3d7=_0x2de5be||stringOptions[_0x2bb7('0xa')];var _0x1b1399=_0x5703e2||stringOptions['secret'];var _0x45d416=crypto[_0x2bb7('0x1d')](_0x28d3d7,_0x1b1399);var _0xef00a1=_0x45d416[_0x2bb7('0x15')](_0x44a34f,_0x2bb7('0x22'),_0x2bb7('0x21'));_0xef00a1+=_0x45d416['final']('utf8');return _0xef00a1;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 6c64da8..d617739 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 _0x4d56=['Empty','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','join','mkdirSync','each','length','%s%d.%s','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','csv','catch','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','path','to-csv','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num'];(function(_0x3eece,_0x386727){var _0x5a6214=function(_0xf62511){while(--_0xf62511){_0x3eece['push'](_0x3eece['shift']());}};_0x5a6214(++_0x386727);}(_0x4d56,0xa9));var _0x64d5=function(_0x2c369a,_0x221669){_0x2c369a=_0x2c369a-0x0;var _0x1d2c9f=_0x4d56[_0x2c369a];return _0x1d2c9f;};'use strict';var util=require('util');var path=require(_0x64d5('0x0'));var _=require('lodash');var csv=require(_0x64d5('0x1'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x64d5('0x2'));var rimraf=require('rimraf');var db=require(_0x64d5('0x3'))['db'];var dbH=require(_0x64d5('0x3'))[_0x64d5('0x4')];var logger=require(_0x64d5('0x5'))(_0x64d5('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x64d5('0x7')][0x2]);var QUERY=process[_0x64d5('0x7')][0x3];var PATH=process[_0x64d5('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5d6415,_0x2cd973){var _0x4ba0ed={'status':_0x5d6415};var _0x43abc5={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2cd973){_0x4ba0ed[_0x64d5('0x8')]=_0x2cd973;}return db[_0x64d5('0x9')][_0x64d5('0xa')](_0x4ba0ed,_0x43abc5);}function main(){var _0x307af9=0x1388;var _0x1672ef;logger['info'](util[_0x64d5('0xb')](_0x64d5('0xc'),EXTRACTED_REPORT_ID,_0x64d5('0xd')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x64d5('0xe'),_0x64d5('0xf')]})[_0x64d5('0x10')](function(_0x3359a8){if(_0x3359a8){_0x1672ef=_0x3359a8;_0x307af9=_0x1672ef[_0x64d5('0xf')]||0x1388;}})[_0x64d5('0x10')](function(){return dbH[_0x64d5('0x11')][_0x64d5('0x12')](util[_0x64d5('0xb')](_0x64d5('0x13'),QUERY),{'type':dbH[_0x64d5('0x11')][_0x64d5('0x14')][_0x64d5('0x15')]});})[_0x64d5('0x10')](function(_0xd4c9a3){if(!_0xd4c9a3[0x0][_0x64d5('0x16')]){return analyticExtractedReport(_0x64d5('0x17'));}var _0x27e149=[];var _0xb73218=0x0;if(_0x1672ef[_0x64d5('0xe')]){if(_0xd4c9a3&&_0xd4c9a3['length']){var _0xe8d1db=_['range'](_0xd4c9a3[0x0]['num']/_0x307af9);var _0x2e538e=Number[_0x64d5('0x18')](_0xd4c9a3[0x0][_0x64d5('0x16')]/_0x307af9)?_0xd4c9a3[0x0][_0x64d5('0x16')]%_0x307af9:0x0;_0xe8d1db[_0x64d5('0x19')](function(_0x21d309){if(_0x21d309>0x0){_0xb73218+=_0x307af9;}_0x27e149[_0x64d5('0x1a')](dbH[_0x64d5('0x11')][_0x64d5('0x12')](util[_0x64d5('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x307af9,_0xb73218),{'type':dbH[_0x64d5('0x11')]['QueryTypes'][_0x64d5('0x15')]}));});if(_0x2e538e>0x0){_0xb73218+=_0x307af9;_0x27e149[_0x64d5('0x1a')](dbH[_0x64d5('0x11')]['query'](util[_0x64d5('0xb')](_0x64d5('0x1b'),QUERY,_0x2e538e,_0xb73218),{'type':dbH[_0x64d5('0x11')]['QueryTypes']['SELECT']}));}}}else{_0x27e149[_0x64d5('0x1a')](dbH['sequelize'][_0x64d5('0x12')](QUERY,{'type':dbH[_0x64d5('0x11')][_0x64d5('0x14')]['SELECT']}));}var _0x576c1b=path[_0x64d5('0x1c')](PATH);var _0x144316=path[_0x64d5('0x1d')](PATH,_0x64d5('0x1e'));var _0x2c3956=_0x1672ef[_0x64d5('0xe')]&&_0x27e149['length']>0x1;var _0x6b1cbd=[];if(!fs['existsSync'](path[_0x64d5('0x1f')](_0x576c1b,_0x144316))&&_0x2c3956){fs[_0x64d5('0x20')](path[_0x64d5('0x1f')](_0x576c1b,_0x144316));}return BPromise[_0x64d5('0x21')](_0x27e149,function(_0x20b6d1){_0x6b1cbd['push'](_0x20b6d1);})[_0x64d5('0x10')](function(){for(var _0x195914=0x0;_0x195914<_0x6b1cbd[_0x64d5('0x22')];_0x195914+=0x1){var _0x3b0b4a;var _0x26e2cc=_0x6b1cbd[_0x195914];if(_0x2c3956){_0x3b0b4a=path[_0x64d5('0x1f')](_0x576c1b,_0x144316,util['format'](_0x64d5('0x23'),_0x144316,_0x195914,'csv'));}else{_0x3b0b4a=path['join'](_0x576c1b,util[_0x64d5('0xb')](_0x64d5('0x24'),_0x144316,'csv'));}fs['writeFileSync'](_0x3b0b4a,csv(_0x26e2cc));}})['then'](function(){if(_0x2c3956){return new Promise(function(_0x1e357f){zipdir(path[_0x64d5('0x1f')](_0x576c1b,_0x144316),{'saveTo':path[_0x64d5('0x1f')](_0x576c1b,util[_0x64d5('0xb')](_0x64d5('0x24'),_0x144316,_0x64d5('0x25')))},function(_0x42e40c,_0x383d68){rimraf(path['join'](_0x576c1b,_0x144316),function(){});_0x1e357f('zip\x20finished');});});}})[_0x64d5('0x10')](function(){logger['info'](util[_0x64d5('0xb')](_0x64d5('0x26'),EXTRACTED_REPORT_ID,_0x64d5('0xd')));return analyticExtractedReport(_0x64d5('0x27'),_0x2c3956?util['format'](_0x64d5('0x24'),_0x144316,_0x2c3956?_0x64d5('0x25'):_0x64d5('0x28')):null);});})[_0x64d5('0x29')](function(_0x365ef8){logger[_0x64d5('0x2a')](util[_0x64d5('0xb')](_0x64d5('0x2b'),EXTRACTED_REPORT_ID,'CSV'),util[_0x64d5('0x2c')](_0x365ef8,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x64d5('0x2d'));})[_0x64d5('0x2e')](function(){process[_0x64d5('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xc73f=['num','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','.csv','existsSync','join','each','csv','%s.%s','zip','zip\x20finished','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','path','lodash','to-csv','bluebird','../../mysqldb','dbH','analytics','argv','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','SELECT','Empty','length','range'];(function(_0x537f32,_0x30b628){var _0x53dd91=function(_0x238564){while(--_0x238564){_0x537f32['push'](_0x537f32['shift']());}};_0x53dd91(++_0x30b628);}(_0xc73f,0x173));var _0xfc73=function(_0x27f29c,_0x5f2c79){_0x27f29c=_0x27f29c-0x0;var _0x18eba8=_0xc73f[_0x27f29c];return _0x18eba8;};'use strict';var util=require(_0xfc73('0x0'));var path=require(_0xfc73('0x1'));var _=require(_0xfc73('0x2'));var csv=require(_0xfc73('0x3'));var fs=require('fs');var BPromise=require(_0xfc73('0x4'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0xfc73('0x5'))[_0xfc73('0x6')];var logger=require('../../config/logger')(_0xfc73('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xfc73('0x8')][0x2]);var QUERY=process[_0xfc73('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xdbeede,_0x4d2018){var _0x3d6837={'status':_0xdbeede};var _0x1699c2={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4d2018){_0x3d6837['savename']=_0x4d2018;}return db['AnalyticExtractedReport']['update'](_0x3d6837,_0x1699c2);}function main(){var _0x4748ff=0x1388;var _0x4d5076;logger[_0xfc73('0x9')](util[_0xfc73('0xa')](_0xfc73('0xb'),EXTRACTED_REPORT_ID,_0xfc73('0xc')));return db[_0xfc73('0xd')][_0xfc73('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xfc73('0xf'),'splitSizeCsv']})['then'](function(_0x4a95d0){if(_0x4a95d0){_0x4d5076=_0x4a95d0;_0x4748ff=_0x4d5076[_0xfc73('0x10')]||0x1388;}})[_0xfc73('0x11')](function(){return dbH['sequelize'][_0xfc73('0x12')](util[_0xfc73('0xa')](_0xfc73('0x13'),QUERY),{'type':dbH[_0xfc73('0x14')]['QueryTypes'][_0xfc73('0x15')]});})[_0xfc73('0x11')](function(_0x5b3412){if(!_0x5b3412[0x0]['num']){return analyticExtractedReport(_0xfc73('0x16'));}var _0x2e8169=[];var _0x2f775c=0x0;if(_0x4d5076['split']){if(_0x5b3412&&_0x5b3412[_0xfc73('0x17')]){var _0x3ff625=_[_0xfc73('0x18')](_0x5b3412[0x0][_0xfc73('0x19')]/_0x4748ff);var _0x206f11=Number['isInteger'](_0x5b3412[0x0][_0xfc73('0x19')]/_0x4748ff)?_0x5b3412[0x0][_0xfc73('0x19')]%_0x4748ff:0x0;_0x3ff625[_0xfc73('0x1a')](function(_0x5d80c0){if(_0x5d80c0>0x0){_0x2f775c+=_0x4748ff;}_0x2e8169[_0xfc73('0x1b')](dbH[_0xfc73('0x14')][_0xfc73('0x12')](util[_0xfc73('0xa')](_0xfc73('0x1c'),QUERY,_0x4748ff,_0x2f775c),{'type':dbH[_0xfc73('0x14')]['QueryTypes'][_0xfc73('0x15')]}));});if(_0x206f11>0x0){_0x2f775c+=_0x4748ff;_0x2e8169[_0xfc73('0x1b')](dbH[_0xfc73('0x14')]['query'](util[_0xfc73('0xa')](_0xfc73('0x1c'),QUERY,_0x206f11,_0x2f775c),{'type':dbH[_0xfc73('0x14')][_0xfc73('0x1d')][_0xfc73('0x15')]}));}}}else{_0x2e8169['push'](dbH[_0xfc73('0x14')][_0xfc73('0x12')](QUERY,{'type':dbH[_0xfc73('0x14')][_0xfc73('0x1d')][_0xfc73('0x15')]}));}var _0x5936ae=path[_0xfc73('0x1e')](PATH);var _0x2b8e0f=path['basename'](PATH,_0xfc73('0x1f'));var _0x17591d=_0x4d5076[_0xfc73('0xf')]&&_0x2e8169['length']>0x1;var _0x1baed5=[];if(!fs[_0xfc73('0x20')](path[_0xfc73('0x21')](_0x5936ae,_0x2b8e0f))&&_0x17591d){fs['mkdirSync'](path[_0xfc73('0x21')](_0x5936ae,_0x2b8e0f));}return BPromise[_0xfc73('0x22')](_0x2e8169,function(_0x47491b){_0x1baed5[_0xfc73('0x1b')](_0x47491b);})[_0xfc73('0x11')](function(){for(var _0x5c024c=0x0;_0x5c024c<_0x1baed5[_0xfc73('0x17')];_0x5c024c+=0x1){var _0x148303;var _0x247d11=_0x1baed5[_0x5c024c];if(_0x17591d){_0x148303=path[_0xfc73('0x21')](_0x5936ae,_0x2b8e0f,util[_0xfc73('0xa')]('%s%d.%s',_0x2b8e0f,_0x5c024c,_0xfc73('0x23')));}else{_0x148303=path[_0xfc73('0x21')](_0x5936ae,util['format'](_0xfc73('0x24'),_0x2b8e0f,_0xfc73('0x23')));}fs['writeFileSync'](_0x148303,csv(_0x247d11));}})['then'](function(){if(_0x17591d){return new Promise(function(_0x110841){zipdir(path[_0xfc73('0x21')](_0x5936ae,_0x2b8e0f),{'saveTo':path[_0xfc73('0x21')](_0x5936ae,util['format'](_0xfc73('0x24'),_0x2b8e0f,_0xfc73('0x25')))},function(_0x4db17e,_0x165d15){rimraf(path[_0xfc73('0x21')](_0x5936ae,_0x2b8e0f),function(){});_0x110841(_0xfc73('0x26'));});});}})[_0xfc73('0x11')](function(){logger['info'](util[_0xfc73('0xa')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xfc73('0xc')));return analyticExtractedReport(_0xfc73('0x27'),_0x17591d?util[_0xfc73('0xa')](_0xfc73('0x24'),_0x2b8e0f,_0x17591d?_0xfc73('0x25'):_0xfc73('0x23')):null);});})['catch'](function(_0x13fa8e){logger[_0xfc73('0x9')](util[_0xfc73('0xa')](_0xfc73('0x28'),EXTRACTED_REPORT_ID,_0xfc73('0xc')),util[_0xfc73('0x29')](_0x13fa8e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xfc73('0x2a'));})['finally'](function(){process[_0xfc73('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 0d95da9..a5fc0d3 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 _0xee63=['push','concat','chunk','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','header','margin','landscape','\x20/\x20','footer','num','Empty','find','splitSizePdf','then','split','range','isInteger','sequelize','query','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','pdf','%s.%s','zip','zip\x20finished','info','PDF','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','pipe','finish','end','path','moment','html-to-pdfmake','pdfmake/src/printer','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','map','pick','toString','value','fill','length','auto','body'];(function(_0x47466c,_0x3ae120){var _0x425ccb=function(_0x3326be){while(--_0x3326be){_0x47466c['push'](_0x47466c['shift']());}};_0x425ccb(++_0x3ae120);}(_0xee63,0xd2));var _0x3ee6=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xee63[_0x82129b];return _0x2ae5dc;};'use strict';var _=require('lodash');var fs=require('fs');var util=require('util');var path=require(_0x3ee6('0x0'));var moment=require(_0x3ee6('0x1'));var htmlToPdfmake=require(_0x3ee6('0x2'));var PdfPrinter=require(_0x3ee6('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x3ee6('0x4'));var JSDOM=require(_0x3ee6('0x5'))[_0x3ee6('0x6')];var window=new JSDOM('')[_0x3ee6('0x7')];var BPromise=require(_0x3ee6('0x8'));var db=require('../../mysqldb')['db'];var dbH=require(_0x3ee6('0x9'))['dbH'];var logger=require(_0x3ee6('0xa'))(_0x3ee6('0xb'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x3ee6('0xc')][0x4];var NAME=process[_0x3ee6('0xc')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1f651f,_0x422fee){var _0x491fb5={'status':_0x1f651f};var _0x2463ab={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x422fee){_0x491fb5[_0x3ee6('0xd')]=_0x422fee;}return db[_0x3ee6('0xe')][_0x3ee6('0xf')](_0x491fb5,_0x2463ab);}function getHeaders(_0x5bdc0b){return _[_0x3ee6('0x10')](_0x5bdc0b,function(_0x321341){return{'text':_0x321341,'style':'tableHeader'};});}function getRows(_0x153614,_0x3dee5a){return _[_0x3ee6('0x10')](_0x3dee5a,function(_0x4ed524){return _(_0x4ed524)[_0x3ee6('0x11')](_0x153614)[_0x3ee6('0x10')](function(_0x4781f8){return _0x4781f8?_[_0x3ee6('0x12')](_0x4781f8):'';})[_0x3ee6('0x13')]();});}function createTable(_0x2ed9eb,_0x52567e){var _0x42e9d3={'widths':_[_0x3ee6('0x14')](Array(_0x2ed9eb[_0x3ee6('0x15')]),0x91),'heights':function(_0x135ca7){return _0x135ca7===0x0?_0x3ee6('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x5c1048=getHeaders(_0x2ed9eb);_0x42e9d3[_0x3ee6('0x17')][_0x3ee6('0x18')](_0x5c1048);var _0x14354d=getRows(_0x2ed9eb,_0x52567e);_0x42e9d3[_0x3ee6('0x17')]=_0x42e9d3[_0x3ee6('0x17')][_0x3ee6('0x19')](_0x14354d);return _0x42e9d3;}function createTables(_0x428a10){var _0x465138=[];var _0x45118e=_[_0x3ee6('0x1a')](Object['keys'](_0x428a10[0x0]),0x5);_0x45118e[_0x3ee6('0x1b')](function(_0x21c380){_0x465138['push'](createTable(_0x21c380,_0x428a10));});return _0x465138;}function getPDFDocDefinition(_0x421842){var _0x1e563a=util[_0x3ee6('0x1c')](_0x3ee6('0x1d'),NAME,EXTRACTED_REPORT[_0x3ee6('0x1e')],moment(EXTRACTED_REPORT['startDate'])[_0x3ee6('0x1c')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x3ee6('0x1c')](FORMAT));var _0x329732=[];for(var _0x288202=0x0;_0x288202<_0x421842['length'];_0x288202++){var _0x23ddd5=[];if(_0x288202===0x0){_0x23ddd5['push']({'text':_0x1e563a,'style':_0x3ee6('0x1f')});}var _0xefcd1d={'table':_0x421842[_0x288202]};if(_0x288202>0x0){_0xefcd1d['pageBreak']='before';_0xefcd1d[_0x3ee6('0x20')]=[0x0,0x46,0x0,0x0];}_0x23ddd5['push'](_0xefcd1d);_0x329732[_0x3ee6('0x18')](_0x23ddd5);}return{'pageSize':'A4','pageOrientation':_0x3ee6('0x21'),'content':_0x329732,'footer':function(_0x325040,_0x519cb8){return{'text':_0x325040[_0x3ee6('0x12')]()+_0x3ee6('0x22')+_0x519cb8,'style':_0x3ee6('0x23')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0xe607fd){var _0x4dfe3e=0x1388;var _0x42f518;if(!_0xe607fd[0x0][_0x3ee6('0x24')]){return analyticExtractedReport(_0x3ee6('0x25'));}return db['Setting'][_0x3ee6('0x26')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x3ee6('0x27')]})[_0x3ee6('0x28')](function(_0x54aaf5){if(_0x54aaf5){_0x42f518=_0x54aaf5;_0x4dfe3e=_0x42f518[_0x3ee6('0x27')]||0x3e8;}})[_0x3ee6('0x28')](function(){var _0x35d3a1=[];var _0x2589f2=0x0;if(_0x42f518[_0x3ee6('0x29')]){if(_0xe607fd&&_0xe607fd[_0x3ee6('0x15')]){var _0x121364=_[_0x3ee6('0x2a')](_0xe607fd[0x0][_0x3ee6('0x24')]/_0x4dfe3e);var _0xb49cfc=Number[_0x3ee6('0x2b')](_0xe607fd[0x0]['num']/_0x4dfe3e)?_0xe607fd[0x0][_0x3ee6('0x24')]%_0x4dfe3e:0x0;_0x121364[_0x3ee6('0x1b')](function(_0x5316f2){if(_0x5316f2>0x0){_0x2589f2+=_0x4dfe3e;}_0x35d3a1[_0x3ee6('0x18')](dbH[_0x3ee6('0x2c')][_0x3ee6('0x2d')](util[_0x3ee6('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4dfe3e,_0x2589f2),{'type':dbH[_0x3ee6('0x2c')][_0x3ee6('0x2e')][_0x3ee6('0x2f')]}));});if(_0xb49cfc>0x0){_0x2589f2+=_0x4dfe3e;_0x35d3a1[_0x3ee6('0x18')](dbH[_0x3ee6('0x2c')][_0x3ee6('0x2d')](util['format'](_0x3ee6('0x30'),QUERY,_0xb49cfc,_0x2589f2),{'type':dbH['sequelize']['QueryTypes'][_0x3ee6('0x2f')]}));}}}else{_0x35d3a1[_0x3ee6('0x18')](dbH[_0x3ee6('0x2c')]['query'](QUERY,{'type':dbH[_0x3ee6('0x2c')][_0x3ee6('0x2e')][_0x3ee6('0x2f')]}));}var _0x263ec6=path['dirname'](PATH);var _0x10699c=path['basename'](PATH,_0x3ee6('0x31'));var _0x3fe131=_0x42f518[_0x3ee6('0x29')]&&_0x35d3a1[_0x3ee6('0x15')]>0x1;var _0x883f46=[];if(!fs[_0x3ee6('0x32')](path[_0x3ee6('0x33')](_0x263ec6,_0x10699c))&&_0x3fe131){fs[_0x3ee6('0x34')](path[_0x3ee6('0x33')](_0x263ec6,_0x10699c));}return BPromise[_0x3ee6('0x35')](_0x35d3a1,function(_0x1e0e90){_0x883f46[_0x3ee6('0x18')](_0x1e0e90);})[_0x3ee6('0x28')](function(){var _0x13fc70=[];for(var _0x27e4a0=0x0;_0x27e4a0<_0x883f46[_0x3ee6('0x15')];_0x27e4a0+=0x1){var _0x2c8671=_0x883f46[_0x27e4a0];var _0x2c099c=createTables(_[_0x3ee6('0x36')](_0x2c8671));var _0x4fd6c4;var _0x1a084=getPDFDocDefinition(_0x2c099c);var _0x9ad550=getPDFPrinter();var _0x4519d3=_0x9ad550[_0x3ee6('0x37')](_0x1a084);if(_0x3fe131){_0x4fd6c4=path[_0x3ee6('0x33')](_0x263ec6,_0x10699c,util[_0x3ee6('0x1c')]('%s%d.%s',_0x10699c,_0x27e4a0,_0x3ee6('0x38')));}else{_0x4fd6c4=path[_0x3ee6('0x33')](_0x263ec6,util[_0x3ee6('0x1c')](_0x3ee6('0x39'),_0x10699c,_0x3ee6('0x38')));}_0x13fc70[_0x3ee6('0x18')](writePDFDocument(_0x4519d3,_0x4fd6c4));}return Promise['all'](_0x13fc70);})[_0x3ee6('0x28')](function(){if(_0x3fe131){return new Promise(function(_0x30f90c){zipdir(path[_0x3ee6('0x33')](_0x263ec6,_0x10699c),{'saveTo':path[_0x3ee6('0x33')](_0x263ec6,util[_0x3ee6('0x1c')](_0x3ee6('0x39'),_0x10699c,_0x3ee6('0x3a')))},function(){rimraf(path[_0x3ee6('0x33')](_0x263ec6,_0x10699c),function(){});_0x30f90c(_0x3ee6('0x3b'));});});}})[_0x3ee6('0x28')](function(){if(!_0x3fe131)return;rimraf(path[_0x3ee6('0x33')](_0x263ec6,_0x10699c),function(){});})['then'](function(){logger[_0x3ee6('0x3c')](util[_0x3ee6('0x1c')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x3ee6('0x3d')));return analyticExtractedReport(_0x3ee6('0x3e'),_0x3fe131?util[_0x3ee6('0x1c')]('%s.%s',_0x10699c,_0x3fe131?'zip':_0x3ee6('0x38')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x3ee6('0x3d')));return db[_0x3ee6('0xe')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x3ee6('0x28')](function(_0x5841b1){EXTRACTED_REPORT=_0x5841b1;return dbH[_0x3ee6('0x2c')]['query'](util[_0x3ee6('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x3ee6('0x2c')][_0x3ee6('0x2e')][_0x3ee6('0x2f')]});})['then'](extractReport)[_0x3ee6('0x3f')](function(_0x1eae0d){logger['info'](util['format'](_0x3ee6('0x40'),EXTRACTED_REPORT_ID,_0x3ee6('0x3d')),util['inspect'](_0x1eae0d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x3ee6('0x41')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x1c7b53=new PdfPrinter({'Arial':{'normal':__dirname+_0x3ee6('0x42'),'bold':__dirname+_0x3ee6('0x43'),'italics':__dirname+_0x3ee6('0x44'),'bolditalics':__dirname+_0x3ee6('0x45')}});return _0x1c7b53;}function getPDFDocDefinitionFromHTML(_0x222fc8,_0x392d0f){var _0x2b66d6=util['format'](_0x3ee6('0x46'),_0x392d0f['channel'],_0x392d0f['interactionId']);var _0x1c381b=moment()[_0x3ee6('0x1c')](_0x3ee6('0x47'))[_0x3ee6('0x12')]();var _0x367b76=htmlToPdfmake(_0x222fc8,{'window':window,'tableAutoSize':!![]});return{'content':[_0x367b76],'defaultStyle':{'font':_0x3ee6('0x48')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x3ee6('0x49'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x3ee6('0x49'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x3ee6('0x49')}},'header':function(){return[{'text':_0x3ee6('0x4a'),'style':'header'}];},'footer':function(_0x1647fa,_0x19f5f1){return[{'text':util[_0x3ee6('0x1c')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x2b66d6,_0x1647fa,_0x19f5f1,_0x1c381b),'style':_0x3ee6('0x23')}];}};}function writePDFDocument(_0x320f34,_0x3051f2){return new Promise(function(_0x330d57,_0x3c7151){var _0x4ac84d=_0x320f34[_0x3ee6('0x4b')](fs['createWriteStream'](_0x3051f2));_0x4ac84d['on'](_0x3ee6('0x4c'),function(){_0x330d57(_0x3ee6('0x4c'));});_0x4ac84d['on']('error',function(_0x58e603){_0x3c7151(_0x58e603);});_0x320f34[_0x3ee6('0x4d')]();});}exports['createPdfFromHTML']=function(_0x5b889b,_0x2813ff){var _0x187675=getPDFPrinter();var _0x3ee917=getPDFDocDefinitionFromHTML(_0x5b889b,_0x2813ff);var _0x2fd9f3=_0x187675[_0x3ee6('0x37')](_0x3ee917);return writePDFDocument(_0x2fd9f3,_0x2813ff[_0x3ee6('0x0')])[_0x3ee6('0x3f')](function(_0x384038){throw _0x384038;});}; \ No newline at end of file +var _0xb571=['range','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','mkdirSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','createWriteStream','finish','createPdfFromHTML','path','util','html-to-pdfmake','pdfmake/src/printer','rimraf','jsdom','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','toString','fill','length','auto','push','body','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','endDate','header','pageBreak','before','\x20/\x20','black','num','Setting','find','split','then','splitSizePdf'];(function(_0x235ec6,_0x14b872){var _0x2c4dad=function(_0x3861c5){while(--_0x3861c5){_0x235ec6['push'](_0x235ec6['shift']());}};_0x2c4dad(++_0x14b872);}(_0xb571,0x18f));var _0x1b57=function(_0x303d23,_0x46cd57){_0x303d23=_0x303d23-0x0;var _0x217e39=_0xb571[_0x303d23];return _0x217e39;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x1b57('0x0'));var path=require('path');var moment=require('moment');var htmlToPdfmake=require(_0x1b57('0x1'));var PdfPrinter=require(_0x1b57('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0x1b57('0x3'));var JSDOM=require(_0x1b57('0x4'))[_0x1b57('0x5')];var window=new JSDOM('')['window'];var BPromise=require(_0x1b57('0x6'));var db=require(_0x1b57('0x7'))['db'];var dbH=require(_0x1b57('0x7'))[_0x1b57('0x8')];var logger=require(_0x1b57('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x1b57('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x1b57('0xa')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x1b57('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4ff826,_0x35d4d4){var _0xfe1f9b={'status':_0x4ff826};var _0x4ddfe0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x35d4d4){_0xfe1f9b[_0x1b57('0xc')]=_0x35d4d4;}return db[_0x1b57('0xd')][_0x1b57('0xe')](_0xfe1f9b,_0x4ddfe0);}function getHeaders(_0x140385){return _[_0x1b57('0xf')](_0x140385,function(_0x2b1932){return{'text':_0x2b1932,'style':_0x1b57('0x10')};});}function getRows(_0x424e7a,_0x232398){return _[_0x1b57('0xf')](_0x232398,function(_0x4a2e86){return _(_0x4a2e86)['pick'](_0x424e7a)[_0x1b57('0xf')](function(_0x29a046){return _0x29a046?_[_0x1b57('0x11')](_0x29a046):'';})['value']();});}function createTable(_0x4bb4b0,_0x55f6bd){var _0xbdae34={'widths':_[_0x1b57('0x12')](Array(_0x4bb4b0[_0x1b57('0x13')]),0x91),'heights':function(_0x57c401){return _0x57c401===0x0?_0x1b57('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x24492c=getHeaders(_0x4bb4b0);_0xbdae34['body'][_0x1b57('0x15')](_0x24492c);var _0x3ddcbb=getRows(_0x4bb4b0,_0x55f6bd);_0xbdae34[_0x1b57('0x16')]=_0xbdae34['body'][_0x1b57('0x17')](_0x3ddcbb);return _0xbdae34;}function createTables(_0x57c8f7){var _0x361440=[];var _0x1bdc4d=_[_0x1b57('0x18')](Object[_0x1b57('0x19')](_0x57c8f7[0x0]),0x5);_0x1bdc4d[_0x1b57('0x1a')](function(_0x108726){_0x361440['push'](createTable(_0x108726,_0x57c8f7));});return _0x361440;}function getPDFDocDefinition(_0x1d8438){var _0x3d866e=util[_0x1b57('0x1b')](_0x1b57('0x1c'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT['startDate'])[_0x1b57('0x1b')](FORMAT),moment(EXTRACTED_REPORT[_0x1b57('0x1d')])[_0x1b57('0x1b')](FORMAT));var _0x479de7=[];for(var _0x230d39=0x0;_0x230d39<_0x1d8438['length'];_0x230d39++){var _0x5d7f6f=[];if(_0x230d39===0x0){_0x5d7f6f[_0x1b57('0x15')]({'text':_0x3d866e,'style':_0x1b57('0x1e')});}var _0x4bed4e={'table':_0x1d8438[_0x230d39]};if(_0x230d39>0x0){_0x4bed4e[_0x1b57('0x1f')]=_0x1b57('0x20');_0x4bed4e['margin']=[0x0,0x46,0x0,0x0];}_0x5d7f6f['push'](_0x4bed4e);_0x479de7['push'](_0x5d7f6f);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x479de7,'footer':function(_0x3d3b89,_0x55be21){return{'text':_0x3d3b89['toString']()+_0x1b57('0x21')+_0x55be21,'style':'footer'};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x1b57('0x22')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0xb9efd9){var _0x77ad22=0x1388;var _0xe6300d;if(!_0xb9efd9[0x0][_0x1b57('0x23')]){return analyticExtractedReport('Empty');}return db[_0x1b57('0x24')][_0x1b57('0x25')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1b57('0x26'),'splitSizePdf']})[_0x1b57('0x27')](function(_0x518fbc){if(_0x518fbc){_0xe6300d=_0x518fbc;_0x77ad22=_0xe6300d[_0x1b57('0x28')]||0x3e8;}})[_0x1b57('0x27')](function(){var _0x508005=[];var _0x128d2d=0x0;if(_0xe6300d[_0x1b57('0x26')]){if(_0xb9efd9&&_0xb9efd9['length']){var _0x48006f=_[_0x1b57('0x29')](_0xb9efd9[0x0][_0x1b57('0x23')]/_0x77ad22);var _0x5d4907=Number['isInteger'](_0xb9efd9[0x0][_0x1b57('0x23')]/_0x77ad22)?_0xb9efd9[0x0][_0x1b57('0x23')]%_0x77ad22:0x0;_0x48006f[_0x1b57('0x1a')](function(_0x4722f4){if(_0x4722f4>0x0){_0x128d2d+=_0x77ad22;}_0x508005[_0x1b57('0x15')](dbH[_0x1b57('0x2a')][_0x1b57('0x2b')](util[_0x1b57('0x1b')](_0x1b57('0x2c'),QUERY,_0x77ad22,_0x128d2d),{'type':dbH[_0x1b57('0x2a')][_0x1b57('0x2d')][_0x1b57('0x2e')]}));});if(_0x5d4907>0x0){_0x128d2d+=_0x77ad22;_0x508005[_0x1b57('0x15')](dbH[_0x1b57('0x2a')]['query'](util[_0x1b57('0x1b')](_0x1b57('0x2c'),QUERY,_0x5d4907,_0x128d2d),{'type':dbH['sequelize'][_0x1b57('0x2d')]['SELECT']}));}}}else{_0x508005['push'](dbH[_0x1b57('0x2a')]['query'](QUERY,{'type':dbH['sequelize'][_0x1b57('0x2d')]['SELECT']}));}var _0x2b42e5=path['dirname'](PATH);var _0x31e0f4=path['basename'](PATH,'.pdf');var _0x50ab49=_0xe6300d[_0x1b57('0x26')]&&_0x508005[_0x1b57('0x13')]>0x1;var _0x128a82=[];if(!fs[_0x1b57('0x2f')](path['join'](_0x2b42e5,_0x31e0f4))&&_0x50ab49){fs[_0x1b57('0x30')](path[_0x1b57('0x31')](_0x2b42e5,_0x31e0f4));}return BPromise[_0x1b57('0x32')](_0x508005,function(_0x57e41b){_0x128a82[_0x1b57('0x15')](_0x57e41b);})[_0x1b57('0x27')](function(){var _0x33cbe8=[];for(var _0x2ea307=0x0;_0x2ea307<_0x128a82['length'];_0x2ea307+=0x1){var _0x14f887=_0x128a82[_0x2ea307];var _0x5e54e2=createTables(_[_0x1b57('0x33')](_0x14f887));var _0x4e38a;var _0x19923a=getPDFDocDefinition(_0x5e54e2);var _0x1306f7=getPDFPrinter();var _0x62292c=_0x1306f7[_0x1b57('0x34')](_0x19923a);if(_0x50ab49){_0x4e38a=path['join'](_0x2b42e5,_0x31e0f4,util[_0x1b57('0x1b')](_0x1b57('0x35'),_0x31e0f4,_0x2ea307,_0x1b57('0x36')));}else{_0x4e38a=path[_0x1b57('0x31')](_0x2b42e5,util['format'](_0x1b57('0x37'),_0x31e0f4,_0x1b57('0x36')));}_0x33cbe8[_0x1b57('0x15')](writePDFDocument(_0x62292c,_0x4e38a));}return Promise[_0x1b57('0x38')](_0x33cbe8);})[_0x1b57('0x27')](function(){if(_0x50ab49){return new Promise(function(_0x153403){zipdir(path[_0x1b57('0x31')](_0x2b42e5,_0x31e0f4),{'saveTo':path[_0x1b57('0x31')](_0x2b42e5,util['format']('%s.%s',_0x31e0f4,_0x1b57('0x39')))},function(){rimraf(path['join'](_0x2b42e5,_0x31e0f4),function(){});_0x153403(_0x1b57('0x3a'));});});}})[_0x1b57('0x27')](function(){if(!_0x50ab49)return;rimraf(path[_0x1b57('0x31')](_0x2b42e5,_0x31e0f4),function(){});})[_0x1b57('0x27')](function(){logger[_0x1b57('0x3b')](util[_0x1b57('0x1b')](_0x1b57('0x3c'),EXTRACTED_REPORT_ID,_0x1b57('0x3d')));return analyticExtractedReport(_0x1b57('0x3e'),_0x50ab49?util[_0x1b57('0x1b')](_0x1b57('0x37'),_0x31e0f4,_0x50ab49?'zip':_0x1b57('0x36')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x1b57('0x3b')](util['format'](_0x1b57('0x3f'),EXTRACTED_REPORT_ID,_0x1b57('0x3d')));return db['AnalyticExtractedReport']['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x398915){EXTRACTED_REPORT=_0x398915;return dbH[_0x1b57('0x2a')][_0x1b57('0x2b')](util[_0x1b57('0x1b')](_0x1b57('0x40'),QUERY),{'type':dbH['sequelize'][_0x1b57('0x2d')]['SELECT']});})['then'](extractReport)[_0x1b57('0x41')](function(_0x1b774a){logger[_0x1b57('0x3b')](util[_0x1b57('0x1b')](_0x1b57('0x42'),EXTRACTED_REPORT_ID,_0x1b57('0x3d')),util[_0x1b57('0x43')](_0x1b774a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1b57('0x44'));})[_0x1b57('0x45')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x15352d=new PdfPrinter({'Arial':{'normal':__dirname+_0x1b57('0x46'),'bold':__dirname+_0x1b57('0x47'),'italics':__dirname+_0x1b57('0x48'),'bolditalics':__dirname+_0x1b57('0x49')}});return _0x15352d;}function getPDFDocDefinitionFromHTML(_0x454e3f,_0xd90188){var _0x59caff=util[_0x1b57('0x1b')](_0x1b57('0x4a'),_0xd90188[_0x1b57('0x4b')],_0xd90188[_0x1b57('0x4c')]);var _0x46ef6f=moment()[_0x1b57('0x1b')](_0x1b57('0x4d'))[_0x1b57('0x11')]();var _0x203e75=htmlToPdfmake(_0x454e3f,{'window':window,'tableAutoSize':!![]});return{'content':[_0x203e75],'defaultStyle':{'font':_0x1b57('0x4e')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x1b57('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x1b57('0x50'),'style':_0x1b57('0x1e')}];},'footer':function(_0x23ba92,_0x19e943){return[{'text':util[_0x1b57('0x1b')](_0x1b57('0x51'),_0x59caff,_0x23ba92,_0x19e943,_0x46ef6f),'style':_0x1b57('0x52')}];}};}function writePDFDocument(_0x2ce192,_0x41c5bc){return new Promise(function(_0x154f3e,_0x21a33e){var _0x4f8640=_0x2ce192[_0x1b57('0x53')](fs[_0x1b57('0x54')](_0x41c5bc));_0x4f8640['on'](_0x1b57('0x55'),function(){_0x154f3e(_0x1b57('0x55'));});_0x4f8640['on']('error',function(_0x524816){_0x21a33e(_0x524816);});_0x2ce192['end']();});}exports[_0x1b57('0x56')]=function(_0x5bc481,_0x5770ca){var _0x171e7a=getPDFPrinter();var _0x56b7e4=getPDFDocDefinitionFromHTML(_0x5bc481,_0x5770ca);var _0x226c1b=_0x171e7a[_0x1b57('0x34')](_0x56b7e4);return writePDFDocument(_0x226c1b,_0x5770ca[_0x1b57('0x57')])[_0x1b57('0x41')](function(_0x423422){throw _0x423422;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index fcc3bdd..2a25914 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 _0x0833=['Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','inspect','Failed','finally','util','path','lodash','json2xls','bluebird','../../mysqldb','../../config/logger','analytics','argv','savename','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','existsSync','join','each','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished'];(function(_0x36f243,_0x188505){var _0x426436=function(_0x1c8622){while(--_0x1c8622){_0x36f243['push'](_0x36f243['shift']());}};_0x426436(++_0x188505);}(_0x0833,0x1bd));var _0x3083=function(_0x1fb3b7,_0x4c0a7c){_0x1fb3b7=_0x1fb3b7-0x0;var _0x5d59a=_0x0833[_0x1fb3b7];return _0x5d59a;};'use strict';var util=require(_0x3083('0x0'));var path=require(_0x3083('0x1'));var _=require(_0x3083('0x2'));var fs=require('fs');var json2xls=require(_0x3083('0x3'));var BPromise=require(_0x3083('0x4'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0x3083('0x5'))['dbH'];var logger=require(_0x3083('0x6'))(_0x3083('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x3083('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x3083('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1378a5,_0x529df1){var _0x5591b0={'status':_0x1378a5};var _0x4f51da={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x529df1){_0x5591b0[_0x3083('0x9')]=_0x529df1;}return db['AnalyticExtractedReport']['update'](_0x5591b0,_0x4f51da);}function main(){var _0x43f038=0x1388;var _0x2e7419;logger[_0x3083('0xa')](util[_0x3083('0xb')](_0x3083('0xc'),EXTRACTED_REPORT_ID,_0x3083('0xd')));return db[_0x3083('0xe')][_0x3083('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3083('0x10'),_0x3083('0x11')]})[_0x3083('0x12')](function(_0x4960f9){if(_0x4960f9){_0x2e7419=_0x4960f9;_0x43f038=_0x2e7419[_0x3083('0x11')]||0x1388;}})[_0x3083('0x12')](function(){return dbH[_0x3083('0x13')]['query'](util[_0x3083('0xb')](_0x3083('0x14'),QUERY),{'type':dbH['sequelize'][_0x3083('0x15')][_0x3083('0x16')]});})['then'](function(_0x293ca0){if(!_0x293ca0[0x0][_0x3083('0x17')]){return analyticExtractedReport(_0x3083('0x18'));}var _0x143cac=[];var _0x3f1f08=0x0;if(_0x2e7419[_0x3083('0x10')]){if(_0x293ca0&&_0x293ca0[_0x3083('0x19')]){var _0x4d9193=_['range'](_0x293ca0[0x0]['num']/_0x43f038);var _0x424c59=Number['isInteger'](_0x293ca0[0x0][_0x3083('0x17')]/_0x43f038)?_0x293ca0[0x0][_0x3083('0x17')]%_0x43f038:0x0;_0x4d9193[_0x3083('0x1a')](function(_0x3b61db){if(_0x3b61db>0x0){_0x3f1f08+=_0x43f038;}_0x143cac[_0x3083('0x1b')](dbH[_0x3083('0x13')][_0x3083('0x1c')](util[_0x3083('0xb')](_0x3083('0x1d'),QUERY,_0x43f038,_0x3f1f08),{'type':dbH[_0x3083('0x13')][_0x3083('0x15')][_0x3083('0x16')]}));});if(_0x424c59>0x0){_0x3f1f08+=_0x43f038;_0x143cac[_0x3083('0x1b')](dbH[_0x3083('0x13')]['query'](util['format'](_0x3083('0x1d'),QUERY,_0x424c59,_0x3f1f08),{'type':dbH['sequelize'][_0x3083('0x15')][_0x3083('0x16')]}));}}}else{_0x143cac[_0x3083('0x1b')](dbH[_0x3083('0x13')][_0x3083('0x1c')](QUERY,{'type':dbH[_0x3083('0x13')][_0x3083('0x15')][_0x3083('0x16')]}));}var _0x4501b2=path['dirname'](PATH);var _0x3b11d1=path['basename'](PATH,'.xlsx');var _0x1bea50=_0x2e7419[_0x3083('0x10')]&&_0x143cac[_0x3083('0x19')]>0x1;var _0x2efe93=[];if(!fs[_0x3083('0x1e')](path[_0x3083('0x1f')](_0x4501b2,_0x3b11d1))&&_0x1bea50){fs['mkdirSync'](path[_0x3083('0x1f')](_0x4501b2,_0x3b11d1));}return BPromise[_0x3083('0x20')](_0x143cac,function(_0x1d8600){_0x2efe93[_0x3083('0x1b')](_0x1d8600);})['then'](function(){for(var _0x3055d2=0x0;_0x3055d2<_0x2efe93['length'];_0x3055d2+=0x1){var _0x5d9c98;var _0x1677de=_0x2efe93[_0x3055d2];if(_0x1bea50){_0x5d9c98=path[_0x3083('0x1f')](_0x4501b2,_0x3b11d1,util[_0x3083('0xb')]('%s%d.%s',_0x3b11d1,_0x3055d2,_0x3083('0x21')));}else{_0x5d9c98=path[_0x3083('0x1f')](_0x4501b2,util[_0x3083('0xb')](_0x3083('0x22'),_0x3b11d1,_0x3083('0x21')));}fs[_0x3083('0x23')](_0x5d9c98,json2xls(_0x1677de),_0x3083('0x24'));}})[_0x3083('0x12')](function(){if(_0x1bea50){return new Promise(function(_0x31f840){zipdir(path[_0x3083('0x1f')](_0x4501b2,_0x3b11d1),{'saveTo':path[_0x3083('0x1f')](_0x4501b2,util[_0x3083('0xb')](_0x3083('0x22'),_0x3b11d1,_0x3083('0x25')))},function(_0x2ff391,_0x3dedf1){rimraf(path[_0x3083('0x1f')](_0x4501b2,_0x3b11d1),function(){});_0x31f840(_0x3083('0x26'));});});}})[_0x3083('0x12')](function(){logger[_0x3083('0xa')](util['format'](_0x3083('0x27'),EXTRACTED_REPORT_ID,_0x3083('0xd')));return analyticExtractedReport('Completed',_0x1bea50?util[_0x3083('0xb')](_0x3083('0x22'),_0x3b11d1,_0x1bea50?'zip':'xlsx'):null);});})[_0x3083('0x28')](function(_0x44e5b9){logger[_0x3083('0xa')](util[_0x3083('0xb')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util[_0x3083('0x29')](_0x44e5b9,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3083('0x2a'));})[_0x3083('0x2b')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x1e24=['split','then','splitSizeXlsx','sequelize','QueryTypes','SELECT','num','Empty','length','range','isInteger','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting'];(function(_0x338654,_0x9a50e2){var _0x437626=function(_0x2b19cc){while(--_0x2b19cc){_0x338654['push'](_0x338654['shift']());}};_0x437626(++_0x9a50e2);}(_0x1e24,0x82));var _0x41e2=function(_0x37b022,_0x742861){_0x37b022=_0x37b022-0x0;var _0x3b6c68=_0x1e24[_0x37b022];return _0x3b6c68;};'use strict';var util=require(_0x41e2('0x0'));var path=require(_0x41e2('0x1'));var _=require(_0x41e2('0x2'));var fs=require('fs');var json2xls=require(_0x41e2('0x3'));var BPromise=require('bluebird');var zipdir=require(_0x41e2('0x4'));var rimraf=require(_0x41e2('0x5'));var db=require(_0x41e2('0x6'))['db'];var dbH=require(_0x41e2('0x6'))['dbH'];var logger=require(_0x41e2('0x7'))(_0x41e2('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x41e2('0x9')][0x2]);var QUERY=process[_0x41e2('0x9')][0x3];var PATH=process[_0x41e2('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3d52b3,_0x12955b){var _0x1b6dd9={'status':_0x3d52b3};var _0x470d69={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x12955b){_0x1b6dd9['savename']=_0x12955b;}return db[_0x41e2('0xa')][_0x41e2('0xb')](_0x1b6dd9,_0x470d69);}function main(){var _0x46015d=0x1388;var _0x1fed0f;logger[_0x41e2('0xc')](util[_0x41e2('0xd')](_0x41e2('0xe'),EXTRACTED_REPORT_ID,_0x41e2('0xf')));return db[_0x41e2('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x41e2('0x11'),'splitSizeXlsx']})[_0x41e2('0x12')](function(_0x33160d){if(_0x33160d){_0x1fed0f=_0x33160d;_0x46015d=_0x1fed0f[_0x41e2('0x13')]||0x1388;}})['then'](function(){return dbH[_0x41e2('0x14')]['query'](util[_0x41e2('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x41e2('0x14')][_0x41e2('0x15')][_0x41e2('0x16')]});})['then'](function(_0x9aab16){if(!_0x9aab16[0x0][_0x41e2('0x17')]){return analyticExtractedReport(_0x41e2('0x18'));}var _0x348630=[];var _0x491f50=0x0;if(_0x1fed0f[_0x41e2('0x11')]){if(_0x9aab16&&_0x9aab16[_0x41e2('0x19')]){var _0x7085dc=_[_0x41e2('0x1a')](_0x9aab16[0x0]['num']/_0x46015d);var _0x3dd4b7=Number[_0x41e2('0x1b')](_0x9aab16[0x0][_0x41e2('0x17')]/_0x46015d)?_0x9aab16[0x0][_0x41e2('0x17')]%_0x46015d:0x0;_0x7085dc['forEach'](function(_0x2108f5){if(_0x2108f5>0x0){_0x491f50+=_0x46015d;}_0x348630[_0x41e2('0x1c')](dbH[_0x41e2('0x14')][_0x41e2('0x1d')](util[_0x41e2('0xd')](_0x41e2('0x1e'),QUERY,_0x46015d,_0x491f50),{'type':dbH[_0x41e2('0x14')][_0x41e2('0x15')][_0x41e2('0x16')]}));});if(_0x3dd4b7>0x0){_0x491f50+=_0x46015d;_0x348630[_0x41e2('0x1c')](dbH[_0x41e2('0x14')][_0x41e2('0x1d')](util[_0x41e2('0xd')](_0x41e2('0x1e'),QUERY,_0x3dd4b7,_0x491f50),{'type':dbH[_0x41e2('0x14')][_0x41e2('0x15')][_0x41e2('0x16')]}));}}}else{_0x348630['push'](dbH[_0x41e2('0x14')]['query'](QUERY,{'type':dbH[_0x41e2('0x14')][_0x41e2('0x15')][_0x41e2('0x16')]}));}var _0x3dced4=path[_0x41e2('0x1f')](PATH);var _0x2cae5d=path[_0x41e2('0x20')](PATH,_0x41e2('0x21'));var _0x5ec732=_0x1fed0f['split']&&_0x348630[_0x41e2('0x19')]>0x1;var _0x49ec8e=[];if(!fs['existsSync'](path[_0x41e2('0x22')](_0x3dced4,_0x2cae5d))&&_0x5ec732){fs['mkdirSync'](path['join'](_0x3dced4,_0x2cae5d));}return BPromise[_0x41e2('0x23')](_0x348630,function(_0x668108){_0x49ec8e[_0x41e2('0x1c')](_0x668108);})[_0x41e2('0x12')](function(){for(var _0x314d8e=0x0;_0x314d8e<_0x49ec8e[_0x41e2('0x19')];_0x314d8e+=0x1){var _0x4f99ef;var _0x273710=_0x49ec8e[_0x314d8e];if(_0x5ec732){_0x4f99ef=path['join'](_0x3dced4,_0x2cae5d,util[_0x41e2('0xd')](_0x41e2('0x24'),_0x2cae5d,_0x314d8e,_0x41e2('0x25')));}else{_0x4f99ef=path[_0x41e2('0x22')](_0x3dced4,util[_0x41e2('0xd')](_0x41e2('0x26'),_0x2cae5d,_0x41e2('0x25')));}fs[_0x41e2('0x27')](_0x4f99ef,json2xls(_0x273710),_0x41e2('0x28'));}})[_0x41e2('0x12')](function(){if(_0x5ec732){return new Promise(function(_0x271a24){zipdir(path[_0x41e2('0x22')](_0x3dced4,_0x2cae5d),{'saveTo':path['join'](_0x3dced4,util['format'](_0x41e2('0x26'),_0x2cae5d,_0x41e2('0x29')))},function(_0x2b7403,_0x54855b){rimraf(path[_0x41e2('0x22')](_0x3dced4,_0x2cae5d),function(){});_0x271a24(_0x41e2('0x2a'));});});}})[_0x41e2('0x12')](function(){logger[_0x41e2('0xc')](util['format'](_0x41e2('0x2b'),EXTRACTED_REPORT_ID,_0x41e2('0xf')));return analyticExtractedReport('Completed',_0x5ec732?util[_0x41e2('0xd')](_0x41e2('0x26'),_0x2cae5d,_0x5ec732?'zip':_0x41e2('0x25')):null);});})[_0x41e2('0x2c')](function(_0xbb0b1d){logger[_0x41e2('0xc')](util[_0x41e2('0xd')](_0x41e2('0x2d'),EXTRACTED_REPORT_ID,_0x41e2('0xf')),util[_0x41e2('0x2e')](_0xbb0b1d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x41e2('0x2f'));})['finally'](function(){process[_0x41e2('0x30')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 7302b70..e0ffe89 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 _0xae9e=['CDR(destination)=','ExecIf','):Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','IntervalId','map','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress',',${EXTEN},','last','concat','transaction','sortBy','catch','error','rewrite','lodash','util','Interval','findAll','then','intervals','models','VoiceExtension','uniq','exten','filter','queue','playback','hasOwnProperty','priority','extensions','extension','push','type','Set','format','CDR(type)=%s','inbound','CDR(routeid)=','VoiceExtensionId','context','outbound'];(function(_0x3050e3,_0x39c6c3){var _0x36e1ce=function(_0x5bf7da){while(--_0x5bf7da){_0x3050e3['push'](_0x3050e3['shift']());}};_0x36e1ce(++_0x39c6c3);}(_0xae9e,0x1c1));var _0xeae9=function(_0x472be3,_0x1862a1){_0x472be3=_0x472be3-0x0;var _0x401b35=_0xae9e[_0x472be3];return _0x401b35;};'use strict';var _=require(_0xeae9('0x0'));var util=require(_0xeae9('0x1'));function rewrite(_0x59857d,_0x1a92af){var _0x554675=this;return _0x59857d['models'][_0xeae9('0x2')][_0xeae9('0x3')]({'raw':!![]})[_0xeae9('0x4')](function(_0x246462){_0x554675[_0xeae9('0x5')]=_0x246462;return _0x59857d[_0xeae9('0x6')][_0xeae9('0x7')][_0xeae9('0x3')]({'where':{'IntervalId':_0x1a92af['IntervalId']},'raw':!![]});})[_0xeae9('0x4')](function(_0x4366ce){return _0x59857d['models'][_0xeae9('0x7')]['findAll']({'where':{'exten':{'$in':_[_0xeae9('0x8')](_['map'](_0x4366ce,_0xeae9('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x19c793){var _0x53388e=_[_0xeae9('0xa')](_0x19c793,{'priority':'1'});var _0x1373ca=_['filter'](_0x19c793,{'isApp':0x1});var _0x353b9b=_['groupBy'](_0x1373ca,'exten');var _0x8bceb0=[_0xeae9('0xb'),_0xeae9('0xc')];var _0x378190=[];var _0x17c028=[];for(var _0x43a5a0 in _0x353b9b){if(_0x353b9b[_0xeae9('0xd')](_0x43a5a0)){_0x554675[_0xeae9('0xe')]=0x2;_0x554675[_0xeae9('0xf')]=[];_0x554675[_0xeae9('0x10')]=_['find'](_0x53388e,{'exten':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x9')]});_0x554675['extensions'][_0xeae9('0x11')]({'type':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x12')],'app':_0xeae9('0x13'),'appdata':util[_0xeae9('0x14')](_0xeae9('0x15'),_0x353b9b[_0x43a5a0][0x0]['type']),'context':_0x353b9b[_0x43a5a0][0x0]['context'],'exten':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x9')],'priority':_0x554675[_0xeae9('0xe')]++,'VoiceExtensionId':_0x353b9b[_0x43a5a0][0x0]['VoiceExtensionId']});if(_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x12')]===_0xeae9('0x16')){_0x554675[_0xeae9('0xf')]['push']({'type':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x12')],'app':'Set','appdata':_0xeae9('0x17')+_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x18')],'context':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x19')],'exten':_0x353b9b[_0x43a5a0][0x0]['exten'],'priority':_0x554675[_0xeae9('0xe')]++,'VoiceExtensionId':_0x353b9b[_0x43a5a0][0x0]['VoiceExtensionId']});}else if(_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x12')]===_0xeae9('0x1a')){if(_0x554675['extension']){_0x554675[_0xeae9('0xf')]['push']({'type':_0x353b9b[_0x43a5a0][0x0]['type'],'app':_0xeae9('0x13'),'appdata':_0xeae9('0x1b')+(_0x554675[_0xeae9('0x10')]['cutdigits']?'${EXTEN:'+_0x554675[_0xeae9('0x10')]['cutdigits']+'}':'${EXTEN}'),'context':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x19')],'exten':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x9')],'priority':_0x554675[_0xeae9('0xe')]++,'VoiceExtensionId':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x18')]});}_0x554675[_0xeae9('0xf')]['push']({'type':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x12')],'app':'Set','appdata':_0xeae9('0x17')+_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x18')],'context':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x19')],'exten':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x9')],'priority':_0x554675[_0xeae9('0xe')]++,'VoiceExtensionId':_0x353b9b[_0x43a5a0][0x0]['VoiceExtensionId']});var _0x4a2f1e=_0x554675[_0xeae9('0xe')]++;_0x554675[_0xeae9('0xf')][_0xeae9('0x11')]({'type':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x12')],'app':_0xeae9('0x1c'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x4a2f1e+0x2)+_0xeae9('0x1d')+(_0x4a2f1e+0x1)+')','context':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x19')],'exten':_0x353b9b[_0x43a5a0][0x0]['exten'],'priority':_0x4a2f1e,'VoiceExtensionId':_0x353b9b[_0x43a5a0][0x0]['VoiceExtensionId']});if(_0x554675['extension']){_0x554675[_0xeae9('0xf')][_0xeae9('0x11')]({'type':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x12')],'app':_0xeae9('0x13'),'appdata':_0x554675['extension'][_0xeae9('0x1e')]?_0xeae9('0x1f')+_0x554675[_0xeae9('0x10')][_0xeae9('0x1e')]+'}':_0xeae9('0x20'),'context':_0x353b9b[_0x43a5a0][0x0]['context'],'exten':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x9')],'priority':_0x554675[_0xeae9('0xe')]++,'VoiceExtensionId':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x18')]});}_0x554675['extensions'][_0xeae9('0x11')]({'type':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x12')],'app':'Set','appdata':_0xeae9('0x21')+_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x18')],'context':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x19')],'exten':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x9')],'priority':_0x554675[_0xeae9('0xe')]++,'VoiceExtensionId':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x18')]});if(_0x554675['extension']&&_0x554675['extension'][_0xeae9('0xd')](_0xeae9('0x22'))&&_0x554675[_0xeae9('0x10')][_0xeae9('0x22')]!==_0xeae9('0x23')){_0x554675['extensions'][_0xeae9('0x11')]({'type':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x12')],'app':_0xeae9('0x13'),'appdata':_0xeae9('0x24'),'context':_0x353b9b[_0x43a5a0][0x0]['context'],'exten':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x9')],'priority':_0x554675[_0xeae9('0xe')]++,'VoiceExtensionId':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x18')]});_0x554675[_0xeae9('0xf')][_0xeae9('0x11')]({'type':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x12')],'app':'Set','appdata':_0xeae9('0x25')+_0x554675[_0xeae9('0x10')][_0xeae9('0x22')]||_0xeae9('0x26'),'context':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x19')],'exten':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x9')],'priority':_0x554675[_0xeae9('0xe')]++,'VoiceExtensionId':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x18')]});}}_0x554675[_0xeae9('0xf')][_0xeae9('0x11')]({'type':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x12')],'app':_0xeae9('0x13'),'appdata':_0xeae9('0x27'),'context':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x19')],'exten':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x9')],'priority':_0x554675['priority']++,'VoiceExtensionId':_0x353b9b[_0x43a5a0][0x0]['VoiceExtensionId']});_0x554675[_0xeae9('0xf')][_0xeae9('0x11')]({'type':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x12')],'app':_0xeae9('0x13'),'appdata':_0xeae9('0x28'),'context':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x19')],'exten':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x9')],'priority':_0x554675['priority']++,'VoiceExtensionId':_0x353b9b[_0x43a5a0][0x0]['VoiceExtensionId']});_0x554675[_0xeae9('0xf')][_0xeae9('0x11')]({'type':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x12')],'app':_0xeae9('0x13'),'appdata':_0xeae9('0x29'),'context':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x19')],'exten':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x9')],'priority':_0x554675['priority']++,'VoiceExtensionId':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x18')]});for(var _0x4ea2b8=0x0,_0x39afa8=0x0;_0x4ea2b8<_0x353b9b[_0x43a5a0][_0xeae9('0x2a')];_0x4ea2b8+=0x1,_0x39afa8=0x0){var _0x5f02b6=_0x353b9b[_0x43a5a0][_0x4ea2b8];if(_0x5f02b6[_0xeae9('0x12')]){_0x5f02b6[_0xeae9('0x12')]=_0x5f02b6[_0xeae9('0x12')][_0xeae9('0x2b')]();}var _0x28b419=[];var _0x235580=[];delete _0x5f02b6['id'];delete _0x5f02b6[_0xeae9('0x2c')];delete _0x5f02b6[_0xeae9('0x2d')];var _0x10f36b=_0x5f02b6['interval']!==_0xeae9('0x2e')?[_0x5f02b6[_0xeae9('0x2f')]]:_0x5f02b6[_0xeae9('0x30')]?_[_0xeae9('0x31')](_[_0xeae9('0xa')](_0x554675[_0xeae9('0x5')],{'IntervalId':_0x5f02b6[_0xeae9('0x30')]}),'interval'):[];if(_0x5f02b6[_0xeae9('0xd')](_0xeae9('0x32'))){if(_0x5f02b6[_0xeae9('0x32')]&&_0x5f02b6['tag']!=='--'){_0x28b419[_0xeae9('0x11')]({'type':_0x5f02b6[_0xeae9('0x12')],'app':_0xeae9('0x13'),'appdata':'CDR(tag)='+_0x5f02b6[_0xeae9('0x32')],'context':_0x5f02b6[_0xeae9('0x19')],'exten':_0x5f02b6[_0xeae9('0x9')],'priority':_0x10f36b[_0xeae9('0x2a')]+_0x554675[_0xeae9('0xe')]+_0x39afa8++,'VoiceExtensionId':_0x5f02b6[_0xeae9('0x18')]});}}if(_0x5f02b6[_0xeae9('0x12')]===_0xeae9('0x1a')&&_0x5f02b6[_0xeae9('0xd')](_0xeae9('0x33'))){if(_0x5f02b6[_0xeae9('0x33')]){_0x28b419[_0xeae9('0x11')]({'type':_0x5f02b6['type'],'app':_0xeae9('0x1c'),'appdata':_0xeae9('0x34')+_0x5f02b6['callerID']+')','context':_0x5f02b6[_0xeae9('0x19')],'exten':_0x5f02b6[_0xeae9('0x9')],'priority':_0x10f36b[_0xeae9('0x2a')]+_0x554675[_0xeae9('0xe')]+_0x39afa8++,'VoiceExtensionId':_0x5f02b6['VoiceExtensionId']});}else{_0x28b419[_0xeae9('0x11')]({'type':_0x5f02b6[_0xeae9('0x12')],'app':'ExecIf','appdata':_0xeae9('0x35'),'context':_0x5f02b6[_0xeae9('0x19')],'exten':_0x5f02b6[_0xeae9('0x9')],'priority':_0x10f36b[_0xeae9('0x2a')]+_0x554675[_0xeae9('0xe')]+_0x39afa8++,'VoiceExtensionId':_0x5f02b6[_0xeae9('0x18')]});}}if(_0x5f02b6[_0xeae9('0xd')](_0xeae9('0x36'))){if(_0x8bceb0[_0xeae9('0x37')](_0x5f02b6['app'][_0xeae9('0x2b')]())>=0x0&&_0x5f02b6[_0xeae9('0x38')]!==_0xeae9('0x39')){if(_0x5f02b6['answer']){_0x28b419['push']({'type':_0x5f02b6[_0xeae9('0x12')],'app':_0xeae9('0x1c'),'appdata':_0xeae9('0x3a'),'context':_0x5f02b6[_0xeae9('0x19')],'exten':_0x5f02b6[_0xeae9('0x9')],'priority':_0x10f36b[_0xeae9('0x2a')]+_0x554675[_0xeae9('0xe')]+_0x39afa8++,'VoiceExtensionId':_0x5f02b6[_0xeae9('0x18')]});_0x28b419[_0xeae9('0x11')]({'type':_0x5f02b6['type'],'app':_0xeae9('0x13'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x5f02b6[_0xeae9('0x19')],'exten':_0x5f02b6[_0xeae9('0x9')],'priority':_0x10f36b['length']+_0x554675['priority']+_0x39afa8++,'VoiceExtensionId':_0x5f02b6[_0xeae9('0x18')]});}else{_0x28b419['push']({'type':_0x5f02b6[_0xeae9('0x12')],'app':'ExecIf','appdata':_0xeae9('0x3b'),'context':_0x5f02b6['context'],'exten':_0x5f02b6['exten'],'priority':_0x10f36b[_0xeae9('0x2a')]+_0x554675[_0xeae9('0xe')]+_0x39afa8++,'VoiceExtensionId':_0x5f02b6[_0xeae9('0x18')]});_0x28b419[_0xeae9('0x11')]({'type':_0x5f02b6['type'],'app':_0xeae9('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x5f02b6['context'],'exten':_0x5f02b6[_0xeae9('0x9')],'priority':_0x10f36b[_0xeae9('0x2a')]+_0x554675[_0xeae9('0xe')]+_0x39afa8++,'VoiceExtensionId':_0x5f02b6[_0xeae9('0x18')]});}}}for(var _0x4b6449=0x0;_0x4b6449<_0x10f36b[_0xeae9('0x2a')];_0x4b6449+=0x1){var _0x5c9a97=_0x554675[_0xeae9('0xe')]+_0x10f36b[_0xeae9('0x2a')];var _0x1d9b1d=_0x4b6449===_0x10f36b[_0xeae9('0x2a')]-0x1?_0x554675[_0xeae9('0xe')]+_0x28b419[_0xeae9('0x2a')]+_0x235580[_0xeae9('0x2a')]+0x2:_0x554675['priority']+_0x4b6449+0x1;_0x28b419['splice'](_0x4b6449,0x0,{'type':_0x5f02b6[_0xeae9('0x12')],'app':'GotoIfTime','appdata':_0x10f36b[_0x4b6449]+'?'+_0x5f02b6['context']+_0xeae9('0x3c')+_0x5c9a97+':'+_0x5f02b6[_0xeae9('0x19')]+_0xeae9('0x3c')+_0x1d9b1d,'exten':_0x5f02b6[_0xeae9('0x9')],'context':_0x5f02b6['context'],'priority':_0x554675[_0xeae9('0xe')]+_0x4b6449,'VoiceExtensionId':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x18')]});}_0x5f02b6[_0xeae9('0xe')]=_0x28b419[_0xeae9('0x2a')]?_[_0xeae9('0x3d')](_0x28b419)[_0xeae9('0xe')]+0x1:_0x554675['priority'];_0x554675[_0xeae9('0xe')]=(_0x235580['length']?_[_0xeae9('0x3d')](_0x235580)['priority']:_0x5f02b6[_0xeae9('0xe')])+0x1;_0x554675['extensions']=_[_0xeae9('0x3e')](_0x554675[_0xeae9('0xf')],_0x28b419,[_0x5f02b6],_0x235580);}_0x554675[_0xeae9('0xf')][_0xeae9('0x11')]({'type':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x12')],'app':'Hangup','exten':_0x353b9b[_0x43a5a0][0x0]['exten'],'context':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x19')],'priority':_0x554675[_0xeae9('0xe')],'VoiceExtensionId':_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x18')]});_0x378190['push'](_0x353b9b[_0x43a5a0][0x0][_0xeae9('0x18')]);_0x17c028=_[_0xeae9('0x3e')](_0x17c028,_0x554675[_0xeae9('0xf')]);}}return _0x59857d[_0xeae9('0x3f')](function(_0x45a1b6){return _0x59857d[_0xeae9('0x6')][_0xeae9('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x378190}},'transaction':_0x45a1b6})[_0xeae9('0x4')](function(_0x29336d){return _0x59857d['models']['VoiceExtension']['bulkCreate'](_[_0xeae9('0x40')](_0x17c028,_0xeae9('0xe')),{'transaction':_0x45a1b6});});});})[_0xeae9('0x41')](function(_0x249b6a){console[_0xeae9('0x42')](_0x249b6a);});}exports[_0xeae9('0x43')]=rewrite; \ No newline at end of file +var _0x65ec=['type','Set','format','context','priority','inbound','CDR(routeid)=','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','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)','answer','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','VoiceExtension','IntervalId','then','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','hasOwnProperty','extensions','extension','find','push'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x65ec,0x186));var _0xc65e=function(_0xaf5222,_0x2f96c2){_0xaf5222=_0xaf5222-0x0;var _0x3972c1=_0x65ec[_0xaf5222];return _0x3972c1;};'use strict';var _=require(_0xc65e('0x0'));var util=require(_0xc65e('0x1'));function rewrite(_0x1954c2,_0x1ca52e){var _0x1d4558=this;return _0x1954c2[_0xc65e('0x2')][_0xc65e('0x3')][_0xc65e('0x4')]({'raw':!![]})['then'](function(_0x20f372){_0x1d4558['intervals']=_0x20f372;return _0x1954c2['models'][_0xc65e('0x5')][_0xc65e('0x4')]({'where':{'IntervalId':_0x1ca52e[_0xc65e('0x6')]},'raw':!![]});})[_0xc65e('0x7')](function(_0x36f6f2){return _0x1954c2[_0xc65e('0x2')]['VoiceExtension']['findAll']({'where':{'exten':{'$in':_['uniq'](_[_0xc65e('0x8')](_0x36f6f2,_0xc65e('0x9')))}},'order':[{'raw':_0xc65e('0xa')}],'raw':!![]});})[_0xc65e('0x7')](function(_0x2a1f85){var _0x3c57f4=_[_0xc65e('0xb')](_0x2a1f85,{'priority':'1'});var _0x4e88d7=_[_0xc65e('0xb')](_0x2a1f85,{'isApp':0x1});var _0x9df071=_[_0xc65e('0xc')](_0x4e88d7,'exten');var _0xf38b65=['queue','playback'];var _0x244ab7=[];var _0x5f1a6d=[];for(var _0x5a73b6 in _0x9df071){if(_0x9df071[_0xc65e('0xd')](_0x5a73b6)){_0x1d4558['priority']=0x2;_0x1d4558[_0xc65e('0xe')]=[];_0x1d4558[_0xc65e('0xf')]=_[_0xc65e('0x10')](_0x3c57f4,{'exten':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x9')]});_0x1d4558[_0xc65e('0xe')][_0xc65e('0x11')]({'type':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x12')],'app':_0xc65e('0x13'),'appdata':util[_0xc65e('0x14')]('CDR(type)=%s',_0x9df071[_0x5a73b6][0x0][_0xc65e('0x12')]),'context':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x15')],'exten':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x9')],'priority':_0x1d4558[_0xc65e('0x16')]++,'VoiceExtensionId':_0x9df071[_0x5a73b6][0x0]['VoiceExtensionId']});if(_0x9df071[_0x5a73b6][0x0][_0xc65e('0x12')]===_0xc65e('0x17')){_0x1d4558[_0xc65e('0xe')][_0xc65e('0x11')]({'type':_0x9df071[_0x5a73b6][0x0]['type'],'app':_0xc65e('0x13'),'appdata':_0xc65e('0x18')+_0x9df071[_0x5a73b6][0x0][_0xc65e('0x19')],'context':_0x9df071[_0x5a73b6][0x0]['context'],'exten':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x9')],'priority':_0x1d4558[_0xc65e('0x16')]++,'VoiceExtensionId':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x19')]});}else if(_0x9df071[_0x5a73b6][0x0][_0xc65e('0x12')]===_0xc65e('0x1a')){if(_0x1d4558[_0xc65e('0xf')]){_0x1d4558['extensions'][_0xc65e('0x11')]({'type':_0x9df071[_0x5a73b6][0x0]['type'],'app':_0xc65e('0x13'),'appdata':_0xc65e('0x1b')+(_0x1d4558[_0xc65e('0xf')][_0xc65e('0x1c')]?_0xc65e('0x1d')+_0x1d4558['extension']['cutdigits']+'}':_0xc65e('0x1e')),'context':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x15')],'exten':_0x9df071[_0x5a73b6][0x0]['exten'],'priority':_0x1d4558[_0xc65e('0x16')]++,'VoiceExtensionId':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x19')]});}_0x1d4558[_0xc65e('0xe')]['push']({'type':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x12')],'app':'Set','appdata':'CDR(routeid)='+_0x9df071[_0x5a73b6][0x0][_0xc65e('0x19')],'context':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x15')],'exten':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x9')],'priority':_0x1d4558[_0xc65e('0x16')]++,'VoiceExtensionId':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x19')]});var _0x2283d1=_0x1d4558[_0xc65e('0x16')]++;_0x1d4558[_0xc65e('0xe')][_0xc65e('0x11')]({'type':_0x9df071[_0x5a73b6][0x0]['type'],'app':_0xc65e('0x1f'),'appdata':_0xc65e('0x20')+(_0x2283d1+0x2)+_0xc65e('0x21')+(_0x2283d1+0x1)+')','context':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x15')],'exten':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x9')],'priority':_0x2283d1,'VoiceExtensionId':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x19')]});if(_0x1d4558[_0xc65e('0xf')]){_0x1d4558[_0xc65e('0xe')][_0xc65e('0x11')]({'type':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x12')],'app':_0xc65e('0x13'),'appdata':_0x1d4558['extension'][_0xc65e('0x1c')]?'CDR(prefix)=${EXTEN:0:'+_0x1d4558[_0xc65e('0xf')][_0xc65e('0x1c')]+'}':'CDR(prefix)=noprefix','context':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x15')],'exten':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x9')],'priority':_0x1d4558['priority']++,'VoiceExtensionId':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x19')]});}_0x1d4558[_0xc65e('0xe')]['push']({'type':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x12')],'app':_0xc65e('0x13'),'appdata':'outboundrouteid='+_0x9df071[_0x5a73b6][0x0][_0xc65e('0x19')],'context':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x15')],'exten':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x9')],'priority':_0x1d4558[_0xc65e('0x16')]++,'VoiceExtensionId':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x19')]});if(_0x1d4558[_0xc65e('0xf')]&&_0x1d4558[_0xc65e('0xf')][_0xc65e('0xd')](_0xc65e('0x22'))&&_0x1d4558[_0xc65e('0xf')]['recordingFormat']!==_0xc65e('0x23')){_0x1d4558[_0xc65e('0xe')][_0xc65e('0x11')]({'type':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x12')],'app':_0xc65e('0x13'),'appdata':_0xc65e('0x24'),'context':_0x9df071[_0x5a73b6][0x0]['context'],'exten':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x9')],'priority':_0x1d4558[_0xc65e('0x16')]++,'VoiceExtensionId':_0x9df071[_0x5a73b6][0x0]['VoiceExtensionId']});_0x1d4558['extensions'][_0xc65e('0x11')]({'type':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x12')],'app':_0xc65e('0x13'),'appdata':_0xc65e('0x25')+_0x1d4558[_0xc65e('0xf')]['recordingFormat']||'wav','context':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x15')],'exten':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x9')],'priority':_0x1d4558['priority']++,'VoiceExtensionId':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x19')]});}}_0x1d4558[_0xc65e('0xe')]['push']({'type':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x12')],'app':_0xc65e('0x13'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x15')],'exten':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x9')],'priority':_0x1d4558[_0xc65e('0x16')]++,'VoiceExtensionId':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x19')]});_0x1d4558[_0xc65e('0xe')][_0xc65e('0x11')]({'type':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x12')],'app':'Set','appdata':_0xc65e('0x26'),'context':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x15')],'exten':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x9')],'priority':_0x1d4558[_0xc65e('0x16')]++,'VoiceExtensionId':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x19')]});_0x1d4558[_0xc65e('0xe')][_0xc65e('0x11')]({'type':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x12')],'app':_0xc65e('0x13'),'appdata':_0xc65e('0x27'),'context':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x15')],'exten':_0x9df071[_0x5a73b6][0x0]['exten'],'priority':_0x1d4558[_0xc65e('0x16')]++,'VoiceExtensionId':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x19')]});for(var _0x5def2c=0x0,_0x1940e1=0x0;_0x5def2c<_0x9df071[_0x5a73b6][_0xc65e('0x28')];_0x5def2c+=0x1,_0x1940e1=0x0){var _0x393229=_0x9df071[_0x5a73b6][_0x5def2c];if(_0x393229['type']){_0x393229['type']=_0x393229[_0xc65e('0x12')][_0xc65e('0x29')]();}var _0x5232e3=[];var _0x2519c0=[];delete _0x393229['id'];delete _0x393229[_0xc65e('0x2a')];delete _0x393229[_0xc65e('0x2b')];var _0x5a9782=_0x393229['interval']!==_0xc65e('0x2c')?[_0x393229['interval']]:_0x393229['IntervalId']?_[_0xc65e('0x8')](_[_0xc65e('0xb')](_0x1d4558['intervals'],{'IntervalId':_0x393229['IntervalId']}),_0xc65e('0x2d')):[];if(_0x393229[_0xc65e('0xd')](_0xc65e('0x2e'))){if(_0x393229[_0xc65e('0x2e')]&&_0x393229['tag']!=='--'){_0x5232e3[_0xc65e('0x11')]({'type':_0x393229[_0xc65e('0x12')],'app':_0xc65e('0x13'),'appdata':_0xc65e('0x2f')+_0x393229[_0xc65e('0x2e')],'context':_0x393229[_0xc65e('0x15')],'exten':_0x393229[_0xc65e('0x9')],'priority':_0x5a9782[_0xc65e('0x28')]+_0x1d4558[_0xc65e('0x16')]+_0x1940e1++,'VoiceExtensionId':_0x393229[_0xc65e('0x19')]});}}if(_0x393229['type']===_0xc65e('0x1a')&&_0x393229[_0xc65e('0xd')](_0xc65e('0x30'))){if(_0x393229[_0xc65e('0x30')]){_0x5232e3[_0xc65e('0x11')]({'type':_0x393229[_0xc65e('0x12')],'app':_0xc65e('0x1f'),'appdata':_0xc65e('0x31')+_0x393229['callerID']+')','context':_0x393229[_0xc65e('0x15')],'exten':_0x393229[_0xc65e('0x9')],'priority':_0x5a9782[_0xc65e('0x28')]+_0x1d4558[_0xc65e('0x16')]+_0x1940e1++,'VoiceExtensionId':_0x393229[_0xc65e('0x19')]});}else{_0x5232e3[_0xc65e('0x11')]({'type':_0x393229[_0xc65e('0x12')],'app':_0xc65e('0x1f'),'appdata':_0xc65e('0x32'),'context':_0x393229[_0xc65e('0x15')],'exten':_0x393229[_0xc65e('0x9')],'priority':_0x5a9782['length']+_0x1d4558[_0xc65e('0x16')]+_0x1940e1++,'VoiceExtensionId':_0x393229[_0xc65e('0x19')]});}}if(_0x393229[_0xc65e('0xd')](_0xc65e('0x33'))){if(_0xf38b65['indexOf'](_0x393229['app']['toLowerCase']())>=0x0&&_0x393229[_0xc65e('0x34')]!==_0xc65e('0x35')){if(_0x393229['answer']){_0x5232e3[_0xc65e('0x11')]({'type':_0x393229[_0xc65e('0x12')],'app':_0xc65e('0x1f'),'appdata':_0xc65e('0x36'),'context':_0x393229[_0xc65e('0x15')],'exten':_0x393229[_0xc65e('0x9')],'priority':_0x5a9782['length']+_0x1d4558[_0xc65e('0x16')]+_0x1940e1++,'VoiceExtensionId':_0x393229[_0xc65e('0x19')]});_0x5232e3['push']({'type':_0x393229[_0xc65e('0x12')],'app':_0xc65e('0x13'),'appdata':_0xc65e('0x37'),'context':_0x393229[_0xc65e('0x15')],'exten':_0x393229['exten'],'priority':_0x5a9782[_0xc65e('0x28')]+_0x1d4558[_0xc65e('0x16')]+_0x1940e1++,'VoiceExtensionId':_0x393229[_0xc65e('0x19')]});}else{_0x5232e3[_0xc65e('0x11')]({'type':_0x393229[_0xc65e('0x12')],'app':_0xc65e('0x1f'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x393229[_0xc65e('0x15')],'exten':_0x393229[_0xc65e('0x9')],'priority':_0x5a9782[_0xc65e('0x28')]+_0x1d4558['priority']+_0x1940e1++,'VoiceExtensionId':_0x393229[_0xc65e('0x19')]});_0x5232e3[_0xc65e('0x11')]({'type':_0x393229[_0xc65e('0x12')],'app':_0xc65e('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x393229[_0xc65e('0x15')],'exten':_0x393229['exten'],'priority':_0x5a9782[_0xc65e('0x28')]+_0x1d4558[_0xc65e('0x16')]+_0x1940e1++,'VoiceExtensionId':_0x393229[_0xc65e('0x19')]});}}}for(var _0x19676a=0x0;_0x19676a<_0x5a9782['length'];_0x19676a+=0x1){var _0x5574b1=_0x1d4558[_0xc65e('0x16')]+_0x5a9782[_0xc65e('0x28')];var _0x4ade4c=_0x19676a===_0x5a9782[_0xc65e('0x28')]-0x1?_0x1d4558[_0xc65e('0x16')]+_0x5232e3[_0xc65e('0x28')]+_0x2519c0[_0xc65e('0x28')]+0x2:_0x1d4558[_0xc65e('0x16')]+_0x19676a+0x1;_0x5232e3[_0xc65e('0x38')](_0x19676a,0x0,{'type':_0x393229[_0xc65e('0x12')],'app':_0xc65e('0x39'),'appdata':_0x5a9782[_0x19676a]+'?'+_0x393229[_0xc65e('0x15')]+_0xc65e('0x3a')+_0x5574b1+':'+_0x393229[_0xc65e('0x15')]+_0xc65e('0x3a')+_0x4ade4c,'exten':_0x393229['exten'],'context':_0x393229[_0xc65e('0x15')],'priority':_0x1d4558[_0xc65e('0x16')]+_0x19676a,'VoiceExtensionId':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x19')]});}_0x393229[_0xc65e('0x16')]=_0x5232e3[_0xc65e('0x28')]?_[_0xc65e('0x3b')](_0x5232e3)[_0xc65e('0x16')]+0x1:_0x1d4558[_0xc65e('0x16')];_0x1d4558[_0xc65e('0x16')]=(_0x2519c0[_0xc65e('0x28')]?_['last'](_0x2519c0)[_0xc65e('0x16')]:_0x393229[_0xc65e('0x16')])+0x1;_0x1d4558['extensions']=_[_0xc65e('0x3c')](_0x1d4558['extensions'],_0x5232e3,[_0x393229],_0x2519c0);}_0x1d4558[_0xc65e('0xe')][_0xc65e('0x11')]({'type':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x12')],'app':_0xc65e('0x3d'),'exten':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x9')],'context':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x15')],'priority':_0x1d4558[_0xc65e('0x16')],'VoiceExtensionId':_0x9df071[_0x5a73b6][0x0][_0xc65e('0x19')]});_0x244ab7[_0xc65e('0x11')](_0x9df071[_0x5a73b6][0x0][_0xc65e('0x19')]);_0x5f1a6d=_[_0xc65e('0x3c')](_0x5f1a6d,_0x1d4558[_0xc65e('0xe')]);}}return _0x1954c2['transaction'](function(_0x40c898){return _0x1954c2[_0xc65e('0x2')][_0xc65e('0x5')][_0xc65e('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x244ab7}},'transaction':_0x40c898})[_0xc65e('0x7')](function(_0x46ffc9){return _0x1954c2[_0xc65e('0x2')][_0xc65e('0x5')][_0xc65e('0x3f')](_[_0xc65e('0x40')](_0x5f1a6d,_0xc65e('0x16')),{'transaction':_0x40c898});});});})[_0xc65e('0x41')](function(_0x297d2c){console[_0xc65e('0x42')](_0x297d2c);});}exports[_0xc65e('0x43')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index ad691e9..401a873 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 _0xce72=['always','sequelize','query','VoiceQueueId','all','BlackLists','Campaign','CampaignId','findAll','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','createReadStream','CSV\x20parse\x20error','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','register','argv','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','undefined','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','duplicate','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','inspect','insert','cm_hopper','scheduledAt','ContactId','createdAt','field','NOW()','toString','updatedAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','into','ListId\x20=\x20?','id\x20IN\x20?','str','calleridnum','cm_hopper_final','\x20=\x20?','fromQuery','cm_hopper_black','VoiceQueue','outbound','dialCheckDuplicateType','CmList','Lists','get'];(function(_0x55a888,_0xa74862){var _0x1637f9=function(_0x479671){while(--_0x479671){_0x55a888['push'](_0x55a888['shift']());}};_0x1637f9(++_0xa74862);}(_0xce72,0x1d7));var _0x2ce7=function(_0x3d8006,_0x2125ca){_0x3d8006=_0x3d8006-0x0;var _0x74a024=_0xce72[_0x3d8006];return _0x74a024;};'use strict';var BPromise=require(_0x2ce7('0x0'));var util=require(_0x2ce7('0x1'));var _=require(_0x2ce7('0x2'));var fs=require('fs');var squel=require(_0x2ce7('0x3'));var Papa=require(_0x2ce7('0x4'));var Redis=require(_0x2ce7('0x5'));var db=require(_0x2ce7('0x6'))['db'];var config=require(_0x2ce7('0x7'));var logger=require(_0x2ce7('0x8'))(_0x2ce7('0x9'));config[_0x2ce7('0xa')]=_[_0x2ce7('0xb')](config[_0x2ce7('0xa')],{'host':_0x2ce7('0xc'),'port':0x18eb});var socket=require(_0x2ce7('0xd'))(new Redis(config[_0x2ce7('0xa')]));require('../../../api/cmContact/cmContact.socket')[_0x2ce7('0xe')](socket);try{if(!process['argv'][0x2]||process[_0x2ce7('0xf')][0x2]==='undefined'||process[_0x2ce7('0xf')][0x2]===_0x2ce7('0x10')){throw new Error(_0x2ce7('0x11'));}var FILEPATH=process[_0x2ce7('0xf')][0x2];if(!process[_0x2ce7('0xf')][0x3]||process['argv'][0x3]==='undefined'||process['argv'][0x3]==='null'||!process[_0x2ce7('0xf')][0x4]||process[_0x2ce7('0xf')][0x4]==='undefined'||process[_0x2ce7('0xf')][0x4]==='null'){throw new Error(_0x2ce7('0x12'));}var FIELDS=_[_0x2ce7('0x13')](process[_0x2ce7('0xf')][0x3][_0x2ce7('0x14')](','),process['argv'][0x4][_0x2ce7('0x14')](','));if(!process['argv'][0x5]||process['argv'][0x5]===_0x2ce7('0x15')||process['argv'][0x5]===_0x2ce7('0x10')){throw new Error(_0x2ce7('0x16'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x2ce7('0xf')][0x6]&&process[_0x2ce7('0xf')][0x6]!==_0x2ce7('0x15')&&process[_0x2ce7('0xf')][0x6]!=='null'?process[_0x2ce7('0xf')][0x6]:null;var DUPLICATES=process[_0x2ce7('0xf')][0x7]&&process['argv'][0x7]!==_0x2ce7('0x15')&&process[_0x2ce7('0xf')][0x7]!==_0x2ce7('0x10')?process[_0x2ce7('0xf')][0x7]:null;if(!process[_0x2ce7('0xf')][0x8]||process[_0x2ce7('0xf')][0x8]==='undefined'||process[_0x2ce7('0xf')][0x8]==='null'){throw new Error(_0x2ce7('0x17'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x3b92f4){logger['error'](_0x3b92f4);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(_0x3076ae,_0x4d13cd,_0x279042,_0x5587eb){var _0x48e3b4={'message':_0x4d13cd};_0x48e3b4[_0x3076ae]=!![];if(_0x279042){_0x48e3b4[_0x2ce7('0x18')]=_0x279042;}if(_0x5587eb){_0x48e3b4[_0x2ce7('0x19')]=_0x5587eb;}return _0x48e3b4;}function isEmail(_0x5d2dd2){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))*$/[_0x2ce7('0x1a')](_0x5d2dd2);}function checkRow(_0x69f1cb,_0x38a641,_0x4efed7){return new BPromise(function(_0x4262ac,_0x3c333d){if(_[_0x2ce7('0x1b')](_0x69f1cb)){return _0x3c333d(handleCheckRowError(_0x2ce7('0x1c'),_0x2ce7('0x1d'),null,_0x4efed7));}if(_0x69f1cb['errors']&&_0x69f1cb[_0x2ce7('0x1e')][_0x2ce7('0x1f')]){var _0x45812e=_[_0x2ce7('0x20')](_0x69f1cb[_0x2ce7('0x1e')],_0x2ce7('0x21'))[_0x2ce7('0x22')](';');return _0x3c333d(handleCheckRowError('error',_0x45812e,null,_0x4efed7));}var _0x1dec81={};for(var _0x3ddf55 in FIELDS){if(FIELDS[_0x2ce7('0x23')](_0x3ddf55)&&FIELDS[_0x3ddf55]){_0x1dec81[_0x3ddf55]=_0x69f1cb[_0x2ce7('0x24')][0x0][FIELDS[_0x3ddf55]]||_0x69f1cb[_0x2ce7('0x24')][0x0]['\ufeff'+FIELDS[_0x3ddf55]];}}if(!_0x1dec81[_0x2ce7('0x25')]){return _0x3c333d(handleCheckRowError('error',_0x2ce7('0x26'),null,_0x4efed7));}if(!_0x1dec81[_0x2ce7('0x27')]){return _0x3c333d(handleCheckRowError(_0x2ce7('0x1c'),_0x2ce7('0x28'),null,_0x4efed7));}if(_0x1dec81[_0x2ce7('0x29')]){var _0x33f89a=moment(_0x1dec81[_0x2ce7('0x29')],'YYYY-MM-DD');if(!_0x33f89a[_0x2ce7('0x2a')]()){return _0x3c333d(handleCheckRowError(_0x2ce7('0x1c'),_0x2ce7('0x2b'),null,_0x4efed7));}}if(_0x1dec81[_0x2ce7('0x2c')]){if(!isEmail(_0x1dec81[_0x2ce7('0x2c')])){return _0x3c333d(handleCheckRowError(_0x2ce7('0x1c'),'email\x20format\x20is\x20not\x20valid!',null,_0x4efed7));}}_0x1dec81[_0x2ce7('0x2d')]=LISTID;_0x1dec81[_0x2ce7('0x2e')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x2ce7('0x1f')]&&_0x38a641){var _0x25b372={};for(var _0x2fd099=0x0,_0x45651f=DUPLICATES[_0x2ce7('0x1f')];_0x2fd099<_0x45651f;_0x2fd099+=0x1){_0x25b372[DUPLICATES[_0x2fd099]]=_0x1dec81[DUPLICATES[_0x2fd099]];}var _0x3278c6=_['find'](_0x38a641,_0x25b372);if(_0x3278c6){return _0x3c333d(handleCheckRowError(_0x2ce7('0x2f'),'Duplicate\x20Contact',_0x3278c6,_0x4efed7));}}return db[_0x2ce7('0x30')][_0x2ce7('0x31')](_0x1dec81,{'raw':!![],'hooks':![],'fields':_[_0x2ce7('0x32')](_0x1dec81)})[_0x2ce7('0x33')](function(_0x486dba){if(DUPLICATES&&DUPLICATES[_0x2ce7('0x1f')]&&_0x38a641){_0x38a641[_0x2ce7('0x34')](_[_0x2ce7('0x35')](_0x1dec81,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x486dba['id'];return _0x4262ac();})[_0x2ce7('0x36')](function(_0x27092d){return _0x3c333d(handleCheckRowError(_0x2ce7('0x1c'),_0x2ce7('0x37')+(_0x27092d[_0x2ce7('0x21')]||JSON['stringify'](_0x27092d)),null,_0x4efed7));});});}function checkHopper(){function _0x3f8a25(){return function(_0x1acbf6){logger[_0x2ce7('0x1c')](_0x2ce7('0x38'),'checkHopper',util[_0x2ce7('0x39')](_0x1acbf6,{'showHidden':![],'depth':null}));};}var _0x35da7f=function(_0xc94054,_0x433876){var _0x13cac2=squel[_0x2ce7('0x3a')]()['into'](_0x2ce7('0x3b'))['fromQuery'](['phone',_0x2ce7('0x3c'),_0x2ce7('0x3d'),_0x2ce7('0x2d'),_0x433876,_0x2ce7('0x3e'),'updatedAt'],squel['select']()[_0x2ce7('0x3f')](_0x2ce7('0x27'),_0x2ce7('0x27'))['field'](_0x2ce7('0x40'),_0x2ce7('0x3c'))[_0x2ce7('0x3f')]('id',_0x2ce7('0x3d'))[_0x2ce7('0x3f')](LISTID[_0x2ce7('0x41')](),_0x2ce7('0x2d'))[_0x2ce7('0x3f')](_0xc94054['id'][_0x2ce7('0x41')](),_0x433876)['field'](_0x2ce7('0x40'),'createdAt')[_0x2ce7('0x3f')](_0x2ce7('0x40'),_0x2ce7('0x42'))[_0x2ce7('0x43')](_0x2ce7('0x44'))[_0x2ce7('0x45')](_0x2ce7('0x46'))[_0x2ce7('0x45')]('ListId\x20=\x20?',LISTID[_0x2ce7('0x41')]())[_0x2ce7('0x45')](_0x2ce7('0x47'))[_0x2ce7('0x45')](_0x2ce7('0x48'),squel[_0x2ce7('0x49')]()[_0x2ce7('0x3f')](_0x2ce7('0x27'))['from'](_0x2ce7('0x3b'))[_0x2ce7('0x45')](_0x433876+'\x20=\x20?',_0xc94054['id'][_0x2ce7('0x41')]())))[_0x2ce7('0x41')]();return _0x13cac2;};var _0x1ce35e=function(_0x14e675,_0x279470){var _0x512ab1=squel[_0x2ce7('0x3a')]()[_0x2ce7('0x4a')]('cm_hopper')['fromQuery'](['phone',_0x2ce7('0x3c'),_0x2ce7('0x3d'),_0x2ce7('0x2d'),_0x279470,_0x2ce7('0x3e'),_0x2ce7('0x42')],squel[_0x2ce7('0x49')]()[_0x2ce7('0x3f')](_0x2ce7('0x27'),'phone')[_0x2ce7('0x3f')](_0x2ce7('0x40'),_0x2ce7('0x3c'))['field']('id','ContactId')[_0x2ce7('0x3f')](LISTID[_0x2ce7('0x41')](),_0x2ce7('0x2d'))[_0x2ce7('0x3f')](_0x14e675['id'][_0x2ce7('0x41')](),_0x279470)[_0x2ce7('0x3f')]('NOW()',_0x2ce7('0x3e'))[_0x2ce7('0x3f')](_0x2ce7('0x40'),_0x2ce7('0x42'))[_0x2ce7('0x43')](_0x2ce7('0x44'))[_0x2ce7('0x45')]('deletedAt\x20IS\x20NULL')[_0x2ce7('0x45')](_0x2ce7('0x4b'),LISTID['toString']())[_0x2ce7('0x45')](_0x2ce7('0x4c'),squel[_0x2ce7('0x4d')](hopperContacts))['where'](_0x2ce7('0x47'))['where'](_0x2ce7('0x48'),squel[_0x2ce7('0x49')]()['field'](_0x2ce7('0x4e'))['from'](_0x2ce7('0x4f'))['where'](_0x279470+_0x2ce7('0x50'),_0x14e675['id'][_0x2ce7('0x41')]()))[_0x2ce7('0x45')](_0x2ce7('0x48'),squel['select']()[_0x2ce7('0x3f')](_0x2ce7('0x27'))['from'](_0x2ce7('0x3b'))['where'](_0x279470+_0x2ce7('0x50'),_0x14e675['id']['toString']())))['toString']();return _0x512ab1;};function _0x3a08f3(_0xca100f,_0xc5d86f){var _0x32363d=squel[_0x2ce7('0x3a')]()[_0x2ce7('0x4a')](_0x2ce7('0x3b'))[_0x2ce7('0x51')]([_0x2ce7('0x27'),_0x2ce7('0x3c'),_0x2ce7('0x3d'),_0x2ce7('0x2d'),_0xc5d86f,_0x2ce7('0x3e'),_0x2ce7('0x42')],squel['select']()[_0x2ce7('0x3f')](_0x2ce7('0x27'),'phone')['field'](_0x2ce7('0x40'),_0x2ce7('0x3c'))[_0x2ce7('0x3f')]('id',_0x2ce7('0x3d'))[_0x2ce7('0x3f')](LISTID[_0x2ce7('0x41')](),'ListId')[_0x2ce7('0x3f')](_0xca100f['id']['toString'](),_0xc5d86f)['field']('NOW()',_0x2ce7('0x3e'))[_0x2ce7('0x3f')]('NOW()',_0x2ce7('0x42'))[_0x2ce7('0x43')](_0x2ce7('0x44'))[_0x2ce7('0x45')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID[_0x2ce7('0x41')]())[_0x2ce7('0x45')]('id\x20IN\x20?',squel[_0x2ce7('0x4d')](hopperContacts))[_0x2ce7('0x45')](_0x2ce7('0x47')))[_0x2ce7('0x41')]();return _0x32363d;}function _0x4c5068(_0xc576ce,_0xb36af0){var _0x48ed08=squel['insert']()[_0x2ce7('0x4a')](_0x2ce7('0x52'))[_0x2ce7('0x51')]([_0x2ce7('0x27'),'ContactId',_0x2ce7('0x2d'),_0xb36af0,_0x2ce7('0x3e'),_0x2ce7('0x42')],squel['select']()['field']('phone',_0x2ce7('0x27'))['field']('id',_0x2ce7('0x3d'))[_0x2ce7('0x3f')](LISTID[_0x2ce7('0x41')](),'ListId')[_0x2ce7('0x3f')](_0xc576ce['id'][_0x2ce7('0x41')](),_0xb36af0)[_0x2ce7('0x3f')](_0x2ce7('0x40'),'createdAt')[_0x2ce7('0x3f')](_0x2ce7('0x40'),_0x2ce7('0x42'))[_0x2ce7('0x43')]('cm_contacts')[_0x2ce7('0x45')](_0x2ce7('0x46'))[_0x2ce7('0x45')](_0x2ce7('0x4b'),LISTID[_0x2ce7('0x41')]())[_0x2ce7('0x45')](_0x2ce7('0x4c'),squel[_0x2ce7('0x4d')](hopperContacts))[_0x2ce7('0x45')](_0x2ce7('0x47')))[_0x2ce7('0x41')]();return _0x48ed08;}return db[_0x2ce7('0x53')]['findAll']({'where':{'type':_0x2ce7('0x54')},'attributes':['id',_0x2ce7('0x55')],'include':[{'model':db[_0x2ce7('0x56')],'as':_0x2ce7('0x57'),'where':{'id':LISTID}}]})['then'](function(_0x10caeb){var _0x1050a5=[];if(_0x10caeb){var _0x2ace2a;for(var _0x3dc787=0x0,_0xe11e7d;_0x3dc787<_0x10caeb[_0x2ce7('0x1f')];_0x3dc787+=0x1){_0xe11e7d=_0x10caeb[_0x3dc787][_0x2ce7('0x58')]({'plain':!![]});switch(_0xe11e7d[_0x2ce7('0x55')]){case _0x2ce7('0x59'):_0x1050a5[_0x2ce7('0x34')](db[_0x2ce7('0x5a')][_0x2ce7('0x5b')](_0x1ce35e(_0xe11e7d,_0x2ce7('0x5c')))['then'](function(){})[_0x2ce7('0x36')](_0x3f8a25()));break;case'onlyIfOpen':_0x1050a5[_0x2ce7('0x34')](db[_0x2ce7('0x5a')][_0x2ce7('0x5b')](_0x35da7f(_0xe11e7d,_0x2ce7('0x5c')))[_0x2ce7('0x33')](function(){})[_0x2ce7('0x36')](_0x3f8a25()));break;default:_0x1050a5[_0x2ce7('0x34')](db[_0x2ce7('0x5a')]['query'](_0x3a08f3(_0xe11e7d,_0x2ce7('0x5c')))[_0x2ce7('0x33')](function(){})['catch'](_0x3f8a25()));}}}return _0x1050a5;})[_0x2ce7('0x5d')]()['then'](function(){return db['VoiceQueue']['findAll']({'where':{'type':_0x2ce7('0x54')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x2ce7('0x5e'),'where':{'id':LISTID}}]})[_0x2ce7('0x33')](function(_0x4f5214){var _0x3fb59c=[];if(_0x4f5214){var _0xdab00b;for(var _0x55b0cd=0x0,_0x15e61d;_0x55b0cd<_0x4f5214[_0x2ce7('0x1f')];_0x55b0cd+=0x1){_0x15e61d=_0x4f5214[_0x55b0cd][_0x2ce7('0x58')]({'plain':!![]});_0x3fb59c['push'](db['sequelize'][_0x2ce7('0x5b')](_0x4c5068(_0x15e61d,_0x2ce7('0x5c')))[_0x2ce7('0x33')](function(){})[_0x2ce7('0x36')](_0x3f8a25()));}}return _0x3fb59c;})['all']();})[_0x2ce7('0x33')](function(){return db[_0x2ce7('0x5f')]['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x2ce7('0x56')],'as':_0x2ce7('0x57'),'where':{'id':LISTID}}]})['then'](function(_0x10ab2f){var _0x29d6a1=[];if(_0x10ab2f){for(var _0x343c5f=0x0,_0x2e4cb3;_0x343c5f<_0x10ab2f['length'];_0x343c5f+=0x1){_0x2e4cb3=_0x10ab2f[_0x343c5f][_0x2ce7('0x58')]({'plain':!![]});switch(_0x2e4cb3[_0x2ce7('0x55')]){case _0x2ce7('0x59'):_0x29d6a1[_0x2ce7('0x34')](db[_0x2ce7('0x5a')]['query'](_0x1ce35e(_0x2e4cb3,'CampaignId'))[_0x2ce7('0x33')](function(){})[_0x2ce7('0x36')](_0x3f8a25()));break;case'onlyIfOpen':_0x29d6a1['push'](db[_0x2ce7('0x5a')][_0x2ce7('0x5b')](_0x35da7f(_0x2e4cb3,'CampaignId'))[_0x2ce7('0x33')](function(){})[_0x2ce7('0x36')](_0x3f8a25()));break;default:_0x29d6a1[_0x2ce7('0x34')](db[_0x2ce7('0x5a')][_0x2ce7('0x5b')](_0x3a08f3(_0x2e4cb3,_0x2ce7('0x60')))[_0x2ce7('0x33')](function(){})[_0x2ce7('0x36')](_0x3f8a25()));}}}return _0x29d6a1;})[_0x2ce7('0x5d')]();})[_0x2ce7('0x33')](function(){return db[_0x2ce7('0x5f')][_0x2ce7('0x61')]({'attributes':['id'],'include':[{'model':db[_0x2ce7('0x56')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x8e41cb){var _0x4dc47c=[];if(_0x8e41cb){for(var _0x12d9cc=0x0,_0x211cac;_0x12d9cc<_0x8e41cb[_0x2ce7('0x1f')];_0x12d9cc+=0x1){_0x211cac=_0x8e41cb[_0x12d9cc]['get']({'plain':!![]});_0x4dc47c[_0x2ce7('0x34')](db[_0x2ce7('0x5a')][_0x2ce7('0x5b')](_0x4c5068(_0x211cac,_0x2ce7('0x60')))[_0x2ce7('0x33')](function(){})[_0x2ce7('0x36')](_0x3f8a25()));}}return _0x4dc47c;})[_0x2ce7('0x5d')]();})[_0x2ce7('0x36')](function(_0x26a96d){logger['error']('cmContact,\x20%s,\x20%s',_0x2ce7('0x62'),_0x26a96d[_0x2ce7('0x21')]);});}var processPromises=function(_0x3b2e71){return BPromise['all'](promises)['then'](function(_0x722338){})[_0x2ce7('0x36')](function(_0x239c7e){logger['error'](_0x2ce7('0x63'),JSON[_0x2ce7('0x64')](_0x239c7e));})['finally'](function(){socket[_0x2ce7('0x65')](_0x2ce7('0x66')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x3b2e71){return _0x3b2e71[_0x2ce7('0x67')]();}});};var endCsv=function(){return BPromise[_0x2ce7('0x68')]()[_0x2ce7('0x33')](function(){if(hopperContacts){return checkHopper();}})[_0x2ce7('0x33')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x2ce7('0x69')](FILEPATH);}catch(_0x2625b9){logger[_0x2ce7('0x1c')](_0x2ce7('0x6a'),JSON['stringify'](_0x2625b9));}finally{process[_0x2ce7('0x6b')](0x0);}});};process['on'](_0x2ce7('0x6c'),function(){logger[_0x2ce7('0x6d')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x2ce7('0x68')]()[_0x2ce7('0x33')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x2ce7('0x14')](',');return db[_0x2ce7('0x30')][_0x2ce7('0x61')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x2ce7('0x33')](function(_0x25fb34){var _0x34e125=fs[_0x2ce7('0x6e')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x34e125,{'header':!![],'skipEmptyLines':!![],'step':function(_0x487ac5,_0x21b66c){total+=0x1;var _0x56df30=total;promises['push'](checkRow(_0x487ac5,_0x25fb34,_0x56df30)[_0x2ce7('0x33')](function(){success+=0x1;})['catch'](function(_0x353475){if(_0x353475[_0x2ce7('0x1c')]){errors+=0x1;delete _0x353475[_0x2ce7('0x1c')];}else if(_0x353475[_0x2ce7('0x2f')]){duplicates+=0x1;delete _0x353475['duplicate'];}rows[_0x2ce7('0x34')](_0x353475);}));if(total%0xc8===0x0){_0x21b66c['pause']();return processPromises(_0x21b66c);}},'complete':function(){return processPromises()['then'](function(){logger[_0x2ce7('0x6d')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x51950e,_0x17fc60){logger[_0x2ce7('0x6d')](_0x2ce7('0x6f'),JSON[_0x2ce7('0x64')](_0x51950e));endCsv();}});})[_0x2ce7('0x36')](function(_0xbf47e){logger[_0x2ce7('0x1c')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x2ce7('0x64')](_0xbf47e));});}main(); \ No newline at end of file +var _0xab94=['Error\x20while\x20creating\x20contact:\x20','stringify','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','ListId','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','findAll','outbound','CmList','Lists','then','get','dialCheckDuplicateType','sequelize','VoiceQueueId','onlyIfOpen','query','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','finally','emit','contact:csv_','resume','resolve','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','CSV\x20import\x20process\x20stopped!','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','squel','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20socket_timestamp\x20parameter!','index','test','isNil','error','errors','length','map','message','join','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','find','duplicate','Duplicate\x20Contact','CmContact','create','push','pick','catch'];(function(_0x1febe9,_0x8dd768){var _0x2ed0bf=function(_0x47aded){while(--_0x47aded){_0x1febe9['push'](_0x1febe9['shift']());}};_0x2ed0bf(++_0x8dd768);}(_0xab94,0x16e));var _0x4ab9=function(_0x4953dd,_0x2946ab){_0x4953dd=_0x4953dd-0x0;var _0x11ce36=_0xab94[_0x4953dd];return _0x11ce36;};'use strict';var BPromise=require('bluebird');var util=require(_0x4ab9('0x0'));var _=require('lodash');var fs=require('fs');var squel=require(_0x4ab9('0x1'));var Papa=require(_0x4ab9('0x2'));var Redis=require('ioredis');var db=require(_0x4ab9('0x3'))['db'];var config=require(_0x4ab9('0x4'));var logger=require(_0x4ab9('0x5'))(_0x4ab9('0x6'));config['redis']=_['defaults'](config[_0x4ab9('0x7')],{'host':_0x4ab9('0x8'),'port':0x18eb});var socket=require(_0x4ab9('0x9'))(new Redis(config[_0x4ab9('0x7')]));require(_0x4ab9('0xa'))[_0x4ab9('0xb')](socket);try{if(!process[_0x4ab9('0xc')][0x2]||process['argv'][0x2]===_0x4ab9('0xd')||process[_0x4ab9('0xc')][0x2]===_0x4ab9('0xe')){throw new Error(_0x4ab9('0xf'));}var FILEPATH=process[_0x4ab9('0xc')][0x2];if(!process[_0x4ab9('0xc')][0x3]||process[_0x4ab9('0xc')][0x3]===_0x4ab9('0xd')||process['argv'][0x3]===_0x4ab9('0xe')||!process['argv'][0x4]||process[_0x4ab9('0xc')][0x4]===_0x4ab9('0xd')||process[_0x4ab9('0xc')][0x4]===_0x4ab9('0xe')){throw new Error(_0x4ab9('0x10'));}var FIELDS=_['zipObject'](process[_0x4ab9('0xc')][0x3][_0x4ab9('0x11')](','),process[_0x4ab9('0xc')][0x4][_0x4ab9('0x11')](','));if(!process[_0x4ab9('0xc')][0x5]||process[_0x4ab9('0xc')][0x5]==='undefined'||process[_0x4ab9('0xc')][0x5]===_0x4ab9('0xe')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x4ab9('0xc')][0x5];var COMPANYID=process[_0x4ab9('0xc')][0x6]&&process[_0x4ab9('0xc')][0x6]!==_0x4ab9('0xd')&&process[_0x4ab9('0xc')][0x6]!==_0x4ab9('0xe')?process[_0x4ab9('0xc')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x4ab9('0xc')][0x7]!==_0x4ab9('0xd')&&process[_0x4ab9('0xc')][0x7]!==_0x4ab9('0xe')?process[_0x4ab9('0xc')][0x7]:null;if(!process[_0x4ab9('0xc')][0x8]||process['argv'][0x8]===_0x4ab9('0xd')||process[_0x4ab9('0xc')][0x8]===_0x4ab9('0xe')){throw new Error(_0x4ab9('0x12'));}var SOCKET_TIMESTAMP=process[_0x4ab9('0xc')][0x8];}catch(_0x131fe9){logger['error'](_0x131fe9);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(_0x27e742,_0x31afc9,_0x4f133d,_0x43b231){var _0xfd8de7={'message':_0x31afc9};_0xfd8de7[_0x27e742]=!![];if(_0x4f133d){_0xfd8de7['contact']=_0x4f133d;}if(_0x43b231){_0xfd8de7[_0x4ab9('0x13')]=_0x43b231;}return _0xfd8de7;}function isEmail(_0x340812){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))*$/[_0x4ab9('0x14')](_0x340812);}function checkRow(_0x1921c1,_0x32b522,_0xccb97f){return new BPromise(function(_0x5d0d01,_0x272424){if(_[_0x4ab9('0x15')](_0x1921c1)){return _0x272424(handleCheckRowError(_0x4ab9('0x16'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0xccb97f));}if(_0x1921c1[_0x4ab9('0x17')]&&_0x1921c1[_0x4ab9('0x17')][_0x4ab9('0x18')]){var _0x558792=_[_0x4ab9('0x19')](_0x1921c1[_0x4ab9('0x17')],_0x4ab9('0x1a'))[_0x4ab9('0x1b')](';');return _0x272424(handleCheckRowError(_0x4ab9('0x16'),_0x558792,null,_0xccb97f));}var _0x39b687={};for(var _0x135720 in FIELDS){if(FIELDS['hasOwnProperty'](_0x135720)&&FIELDS[_0x135720]){_0x39b687[_0x135720]=_0x1921c1[_0x4ab9('0x1c')][0x0][FIELDS[_0x135720]]||_0x1921c1[_0x4ab9('0x1c')][0x0]['\ufeff'+FIELDS[_0x135720]];}}if(!_0x39b687[_0x4ab9('0x1d')]){return _0x272424(handleCheckRowError('error',_0x4ab9('0x1e'),null,_0xccb97f));}if(!_0x39b687[_0x4ab9('0x1f')]){return _0x272424(handleCheckRowError(_0x4ab9('0x16'),_0x4ab9('0x20'),null,_0xccb97f));}if(_0x39b687[_0x4ab9('0x21')]){var _0xd5c088=moment(_0x39b687[_0x4ab9('0x21')],_0x4ab9('0x22'));if(!_0xd5c088[_0x4ab9('0x23')]()){return _0x272424(handleCheckRowError(_0x4ab9('0x16'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0xccb97f));}}if(_0x39b687[_0x4ab9('0x24')]){if(!isEmail(_0x39b687['email'])){return _0x272424(handleCheckRowError(_0x4ab9('0x16'),_0x4ab9('0x25'),null,_0xccb97f));}}_0x39b687['ListId']=LISTID;_0x39b687['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x4ab9('0x18')]&&_0x32b522){var _0x11ea36={};for(var _0x15f0a5=0x0,_0x579153=DUPLICATES['length'];_0x15f0a5<_0x579153;_0x15f0a5+=0x1){_0x11ea36[DUPLICATES[_0x15f0a5]]=_0x39b687[DUPLICATES[_0x15f0a5]];}var _0x4d5cd4=_[_0x4ab9('0x26')](_0x32b522,_0x11ea36);if(_0x4d5cd4){return _0x272424(handleCheckRowError(_0x4ab9('0x27'),_0x4ab9('0x28'),_0x4d5cd4,_0xccb97f));}}return db[_0x4ab9('0x29')][_0x4ab9('0x2a')](_0x39b687,{'raw':!![],'hooks':![],'fields':_['keys'](_0x39b687)})['then'](function(_0xf08f5f){if(DUPLICATES&&DUPLICATES[_0x4ab9('0x18')]&&_0x32b522){_0x32b522[_0x4ab9('0x2b')](_[_0x4ab9('0x2c')](_0x39b687,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xf08f5f['id'];return _0x5d0d01();})[_0x4ab9('0x2d')](function(_0x3edde8){return _0x272424(handleCheckRowError('error',_0x4ab9('0x2e')+(_0x3edde8[_0x4ab9('0x1a')]||JSON[_0x4ab9('0x2f')](_0x3edde8)),null,_0xccb97f));});});}function checkHopper(){function _0x2f6557(){return function(_0x55888f){logger[_0x4ab9('0x16')]('cmContact','checkHopper',util[_0x4ab9('0x30')](_0x55888f,{'showHidden':![],'depth':null}));};}var _0x10c064=function(_0x446e8a,_0x16b8f7){var _0x4abb16=squel[_0x4ab9('0x31')]()[_0x4ab9('0x32')](_0x4ab9('0x33'))[_0x4ab9('0x34')]([_0x4ab9('0x1f'),_0x4ab9('0x35'),_0x4ab9('0x36'),'ListId',_0x16b8f7,_0x4ab9('0x37'),_0x4ab9('0x38')],squel[_0x4ab9('0x39')]()[_0x4ab9('0x3a')]('phone',_0x4ab9('0x1f'))[_0x4ab9('0x3a')](_0x4ab9('0x3b'),_0x4ab9('0x35'))[_0x4ab9('0x3a')]('id',_0x4ab9('0x36'))[_0x4ab9('0x3a')](LISTID['toString'](),_0x4ab9('0x3c'))[_0x4ab9('0x3a')](_0x446e8a['id'][_0x4ab9('0x3d')](),_0x16b8f7)[_0x4ab9('0x3a')](_0x4ab9('0x3b'),'createdAt')[_0x4ab9('0x3a')](_0x4ab9('0x3b'),'updatedAt')[_0x4ab9('0x3e')](_0x4ab9('0x3f'))[_0x4ab9('0x40')](_0x4ab9('0x41'))['where']('ListId\x20=\x20?',LISTID['toString']())[_0x4ab9('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0x4ab9('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x4ab9('0x39')]()[_0x4ab9('0x3a')](_0x4ab9('0x1f'))[_0x4ab9('0x3e')](_0x4ab9('0x33'))[_0x4ab9('0x40')](_0x16b8f7+_0x4ab9('0x42'),_0x446e8a['id'][_0x4ab9('0x3d')]())))[_0x4ab9('0x3d')]();return _0x4abb16;};var _0x122383=function(_0x869540,_0x4a1089){var _0x2ada02=squel[_0x4ab9('0x31')]()[_0x4ab9('0x32')](_0x4ab9('0x33'))[_0x4ab9('0x34')]([_0x4ab9('0x1f'),_0x4ab9('0x35'),'ContactId',_0x4ab9('0x3c'),_0x4a1089,_0x4ab9('0x37'),_0x4ab9('0x38')],squel[_0x4ab9('0x39')]()['field']('phone',_0x4ab9('0x1f'))['field'](_0x4ab9('0x3b'),_0x4ab9('0x35'))['field']('id',_0x4ab9('0x36'))[_0x4ab9('0x3a')](LISTID[_0x4ab9('0x3d')](),_0x4ab9('0x3c'))['field'](_0x869540['id'][_0x4ab9('0x3d')](),_0x4a1089)['field'](_0x4ab9('0x3b'),_0x4ab9('0x37'))[_0x4ab9('0x3a')](_0x4ab9('0x3b'),_0x4ab9('0x38'))['from']('cm_contacts')[_0x4ab9('0x40')]('deletedAt\x20IS\x20NULL')[_0x4ab9('0x40')](_0x4ab9('0x43'),LISTID[_0x4ab9('0x3d')]())[_0x4ab9('0x40')](_0x4ab9('0x44'),squel[_0x4ab9('0x45')](hopperContacts))['where'](_0x4ab9('0x46'))['where'](_0x4ab9('0x47'),squel['select']()[_0x4ab9('0x3a')]('calleridnum')['from'](_0x4ab9('0x48'))[_0x4ab9('0x40')](_0x4a1089+_0x4ab9('0x42'),_0x869540['id'][_0x4ab9('0x3d')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x4ab9('0x39')]()[_0x4ab9('0x3a')]('phone')['from'](_0x4ab9('0x33'))[_0x4ab9('0x40')](_0x4a1089+_0x4ab9('0x42'),_0x869540['id']['toString']())))[_0x4ab9('0x3d')]();return _0x2ada02;};function _0x15fa61(_0x37aadc,_0x501337){var _0x5973f9=squel[_0x4ab9('0x31')]()[_0x4ab9('0x32')](_0x4ab9('0x33'))[_0x4ab9('0x34')](['phone',_0x4ab9('0x35'),_0x4ab9('0x36'),_0x4ab9('0x3c'),_0x501337,'createdAt',_0x4ab9('0x38')],squel[_0x4ab9('0x39')]()['field'](_0x4ab9('0x1f'),'phone')[_0x4ab9('0x3a')](_0x4ab9('0x3b'),_0x4ab9('0x35'))[_0x4ab9('0x3a')]('id',_0x4ab9('0x36'))[_0x4ab9('0x3a')](LISTID[_0x4ab9('0x3d')](),_0x4ab9('0x3c'))[_0x4ab9('0x3a')](_0x37aadc['id'][_0x4ab9('0x3d')](),_0x501337)[_0x4ab9('0x3a')]('NOW()',_0x4ab9('0x37'))[_0x4ab9('0x3a')]('NOW()','updatedAt')[_0x4ab9('0x3e')](_0x4ab9('0x3f'))[_0x4ab9('0x40')](_0x4ab9('0x41'))[_0x4ab9('0x40')](_0x4ab9('0x43'),LISTID['toString']())['where'](_0x4ab9('0x44'),squel[_0x4ab9('0x45')](hopperContacts))[_0x4ab9('0x40')](_0x4ab9('0x46')))[_0x4ab9('0x3d')]();return _0x5973f9;}function _0x15ebd1(_0x3229a8,_0x30a43f){var _0x31fc0f=squel['insert']()[_0x4ab9('0x32')]('cm_hopper_black')[_0x4ab9('0x34')](['phone',_0x4ab9('0x36'),_0x4ab9('0x3c'),_0x30a43f,_0x4ab9('0x37'),'updatedAt'],squel['select']()['field'](_0x4ab9('0x1f'),'phone')[_0x4ab9('0x3a')]('id',_0x4ab9('0x36'))['field'](LISTID['toString'](),_0x4ab9('0x3c'))['field'](_0x3229a8['id']['toString'](),_0x30a43f)[_0x4ab9('0x3a')](_0x4ab9('0x3b'),_0x4ab9('0x37'))['field'](_0x4ab9('0x3b'),_0x4ab9('0x38'))['from'](_0x4ab9('0x3f'))[_0x4ab9('0x40')](_0x4ab9('0x41'))['where']('ListId\x20=\x20?',LISTID['toString']())[_0x4ab9('0x40')](_0x4ab9('0x44'),squel[_0x4ab9('0x45')](hopperContacts))['where'](_0x4ab9('0x46')))[_0x4ab9('0x3d')]();return _0x31fc0f;}return db['VoiceQueue'][_0x4ab9('0x49')]({'where':{'type':_0x4ab9('0x4a')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x4ab9('0x4b')],'as':_0x4ab9('0x4c'),'where':{'id':LISTID}}]})[_0x4ab9('0x4d')](function(_0x5cedd6){var _0x2e8bd3=[];if(_0x5cedd6){var _0x3a467e;for(var _0x13ac4f=0x0,_0x4430e8;_0x13ac4f<_0x5cedd6[_0x4ab9('0x18')];_0x13ac4f+=0x1){_0x4430e8=_0x5cedd6[_0x13ac4f][_0x4ab9('0x4e')]({'plain':!![]});switch(_0x4430e8[_0x4ab9('0x4f')]){case'always':_0x2e8bd3[_0x4ab9('0x2b')](db[_0x4ab9('0x50')]['query'](_0x122383(_0x4430e8,_0x4ab9('0x51')))[_0x4ab9('0x4d')](function(){})[_0x4ab9('0x2d')](_0x2f6557()));break;case _0x4ab9('0x52'):_0x2e8bd3[_0x4ab9('0x2b')](db[_0x4ab9('0x50')][_0x4ab9('0x53')](_0x10c064(_0x4430e8,'VoiceQueueId'))[_0x4ab9('0x4d')](function(){})[_0x4ab9('0x2d')](_0x2f6557()));break;default:_0x2e8bd3[_0x4ab9('0x2b')](db[_0x4ab9('0x50')][_0x4ab9('0x53')](_0x15fa61(_0x4430e8,_0x4ab9('0x51')))['then'](function(){})[_0x4ab9('0x2d')](_0x2f6557()));}}}return _0x2e8bd3;})[_0x4ab9('0x54')]()[_0x4ab9('0x4d')](function(){return db['VoiceQueue'][_0x4ab9('0x49')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x4ab9('0x4b')],'as':_0x4ab9('0x55'),'where':{'id':LISTID}}]})['then'](function(_0x3b84fb){var _0x5863b6=[];if(_0x3b84fb){var _0x28053b;for(var _0x70594e=0x0,_0x33bb93;_0x70594e<_0x3b84fb[_0x4ab9('0x18')];_0x70594e+=0x1){_0x33bb93=_0x3b84fb[_0x70594e][_0x4ab9('0x4e')]({'plain':!![]});_0x5863b6['push'](db[_0x4ab9('0x50')]['query'](_0x15ebd1(_0x33bb93,_0x4ab9('0x51')))[_0x4ab9('0x4d')](function(){})[_0x4ab9('0x2d')](_0x2f6557()));}}return _0x5863b6;})[_0x4ab9('0x54')]();})[_0x4ab9('0x4d')](function(){return db[_0x4ab9('0x56')][_0x4ab9('0x49')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0x4ab9('0x4d')](function(_0x5b9052){var _0x1a21a3=[];if(_0x5b9052){for(var _0x122368=0x0,_0x3397e0;_0x122368<_0x5b9052[_0x4ab9('0x18')];_0x122368+=0x1){_0x3397e0=_0x5b9052[_0x122368][_0x4ab9('0x4e')]({'plain':!![]});switch(_0x3397e0[_0x4ab9('0x4f')]){case'always':_0x1a21a3[_0x4ab9('0x2b')](db[_0x4ab9('0x50')][_0x4ab9('0x53')](_0x122383(_0x3397e0,'CampaignId'))[_0x4ab9('0x4d')](function(){})['catch'](_0x2f6557()));break;case _0x4ab9('0x52'):_0x1a21a3[_0x4ab9('0x2b')](db[_0x4ab9('0x50')][_0x4ab9('0x53')](_0x10c064(_0x3397e0,_0x4ab9('0x57')))[_0x4ab9('0x4d')](function(){})[_0x4ab9('0x2d')](_0x2f6557()));break;default:_0x1a21a3[_0x4ab9('0x2b')](db[_0x4ab9('0x50')][_0x4ab9('0x53')](_0x15fa61(_0x3397e0,'CampaignId'))['then'](function(){})[_0x4ab9('0x2d')](_0x2f6557()));}}}return _0x1a21a3;})[_0x4ab9('0x54')]();})[_0x4ab9('0x4d')](function(){return db[_0x4ab9('0x56')][_0x4ab9('0x49')]({'attributes':['id'],'include':[{'model':db[_0x4ab9('0x4b')],'as':_0x4ab9('0x55'),'where':{'id':LISTID}}]})[_0x4ab9('0x4d')](function(_0x5b40d4){var _0x386a1e=[];if(_0x5b40d4){for(var _0x5d0641=0x0,_0x161244;_0x5d0641<_0x5b40d4[_0x4ab9('0x18')];_0x5d0641+=0x1){_0x161244=_0x5b40d4[_0x5d0641]['get']({'plain':!![]});_0x386a1e[_0x4ab9('0x2b')](db[_0x4ab9('0x50')][_0x4ab9('0x53')](_0x15ebd1(_0x161244,_0x4ab9('0x57')))['then'](function(){})['catch'](_0x2f6557()));}}return _0x386a1e;})['all']();})[_0x4ab9('0x2d')](function(_0x1f2240){logger[_0x4ab9('0x16')](_0x4ab9('0x58'),_0x4ab9('0x59'),_0x1f2240[_0x4ab9('0x1a')]);});}var processPromises=function(_0x385ada){return BPromise['all'](promises)[_0x4ab9('0x4d')](function(_0x48c158){})['catch'](function(_0x2ba901){logger[_0x4ab9('0x16')]('Error\x20processing\x20rows\x20block:',JSON[_0x4ab9('0x2f')](_0x2ba901));})[_0x4ab9('0x5a')](function(){socket[_0x4ab9('0x5b')](_0x4ab9('0x5c')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x385ada){return _0x385ada[_0x4ab9('0x5d')]();}});};var endCsv=function(){return BPromise[_0x4ab9('0x5e')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x4ab9('0x4d')](function(){socket['emit'](_0x4ab9('0x5c')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x1fa5de){logger['error'](_0x4ab9('0x5f'),JSON[_0x4ab9('0x2f')](_0x1fa5de));}finally{process['exit'](0x0);}});};process['on'](_0x4ab9('0x60'),function(){logger[_0x4ab9('0x61')](_0x4ab9('0x62'));endCsv();});function main(){return BPromise[_0x4ab9('0x5e')]()[_0x4ab9('0x4d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x4ab9('0x11')](',');return db[_0x4ab9('0x29')][_0x4ab9('0x49')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0xcb4aec){var _0x35576e=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x35576e,{'header':!![],'skipEmptyLines':!![],'step':function(_0x2fbfb0,_0x1cb50b){total+=0x1;var _0x27be1a=total;promises[_0x4ab9('0x2b')](checkRow(_0x2fbfb0,_0xcb4aec,_0x27be1a)[_0x4ab9('0x4d')](function(){success+=0x1;})[_0x4ab9('0x2d')](function(_0x19eddb){if(_0x19eddb[_0x4ab9('0x16')]){errors+=0x1;delete _0x19eddb[_0x4ab9('0x16')];}else if(_0x19eddb[_0x4ab9('0x27')]){duplicates+=0x1;delete _0x19eddb[_0x4ab9('0x27')];}rows['push'](_0x19eddb);}));if(total%0xc8===0x0){_0x1cb50b[_0x4ab9('0x63')]();return processPromises(_0x1cb50b);}},'complete':function(){return processPromises()[_0x4ab9('0x4d')](function(){logger[_0x4ab9('0x61')](_0x4ab9('0x64'));endCsv();});},'error':function(_0x5ece1e,_0x36e628){logger['info'](_0x4ab9('0x65'),JSON[_0x4ab9('0x2f')](_0x5ece1e));endCsv();}});})[_0x4ab9('0x2d')](function(_0x37ff10){logger[_0x4ab9('0x16')](_0x4ab9('0x66'),JSON[_0x4ab9('0x2f')](_0x37ff10));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 222c63b..c143576 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 _0xec85=['firstName','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CompanyId','isNil','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns_has_cm_lists','campaigns','CampaignId','each','then','finish','affectedRows','unlink','complete','argv','existsSync','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','UserId','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','test','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.updatedAt','cm_contacts.priority','insert','into','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','cm_hopper','toString','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_hopper_black','ListId\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','error','exit','errors','push','code','message','catch','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','header','parse','data','length','rows','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xec85,0x12c));var _0x5ec8=function(_0x929b28,_0x1940c5){_0x929b28=_0x929b28-0x0;var _0x405c81=_0xec85[_0x929b28];return _0x405c81;};'use strict';var fs=require('fs');var path=require(_0x5ec8('0x0'));var _=require(_0x5ec8('0x1'));var Papa=require(_0x5ec8('0x2'));var util=require(_0x5ec8('0x3'));var BPromise=require(_0x5ec8('0x4'));var moment=require(_0x5ec8('0x5'));var squel=require(_0x5ec8('0x6'));var Redis=require(_0x5ec8('0x7'));var db=require(_0x5ec8('0x8'))['db'];var config=require(_0x5ec8('0x9'));var logger=require(_0x5ec8('0xa'))(_0x5ec8('0xb'));config[_0x5ec8('0xc')]=_[_0x5ec8('0xd')](config[_0x5ec8('0xc')],{'host':_0x5ec8('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5ec8('0xc')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x526188){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))*$/[_0x5ec8('0xf')](_0x526188);}function selectNotIn(_0x472abd,_0x33a4ca,_0x17553a,_0xc694d3,_0x3cda9a){return squel[_0x5ec8('0x10')]()[_0x5ec8('0x11')](_0x5ec8('0x12'))[_0x5ec8('0x13')](_0xc694d3)[_0x5ec8('0x14')](_0x33a4ca,null,_0x33a4ca+_0x5ec8('0x15')+_0xc694d3+'.'+_0x17553a)[_0x5ec8('0x16')](_0xc694d3+'.'+_0x17553a+'\x20=\x20'+_0x472abd+'.'+_0x17553a)['where'](_0x33a4ca+_0x5ec8('0x17')+_0x3cda9a['join']()+')');}function insertCmHopper(_0x58cb00,_0x57d713,_0x669cce,_0x4f6058,_0x3d7e27){var _0x3e0032=[_0x5ec8('0x18'),'cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId',_0x57d713+'.'+_0x4f6058,'cm_contacts.createdAt',_0x5ec8('0x19'),_0x5ec8('0x1a'),'cm_contacts.UserId','\x22'+_0x3d7e27+'\x22'];return squel[_0x5ec8('0x1b')]()[_0x5ec8('0x1c')]('cm_hopper')[_0x5ec8('0x1d')]([_0x5ec8('0x12'),_0x5ec8('0x1e'),_0x5ec8('0x1f'),_0x5ec8('0x20'),_0x4f6058,_0x5ec8('0x21'),_0x5ec8('0x22'),_0x5ec8('0x23'),'UserId',_0x5ec8('0x24')],squel['select']()[_0x5ec8('0x25')](_0x3e0032)[_0x5ec8('0x13')](_0x57d713)[_0x5ec8('0x14')](_0x5ec8('0x26'),null,_0x5ec8('0x27')+_0x57d713+_0x5ec8('0x28'))[_0x5ec8('0x14')](_0x669cce,null,_0x669cce+_0x5ec8('0x15')+_0x57d713+'.'+_0x4f6058)[_0x5ec8('0x16')](_0x57d713+_0x5ec8('0x29'),_0x58cb00)[_0x5ec8('0x16')](_0x5ec8('0x2a'),NOW)[_0x5ec8('0x16')](_0x5ec8('0x2b'),selectNotIn(_0x57d713,_0x669cce,_0x4f6058,'cm_hopper',[_0x5ec8('0x2c'),'\x22onlyIfOpen\x22']))[_0x5ec8('0x16')](_0x5ec8('0x2b'),selectNotIn(_0x57d713,_0x669cce,_0x4f6058,_0x5ec8('0x2d'),[_0x5ec8('0x2c')])))[_0x5ec8('0x2e')]();}function insertCmHopperBlack(_0xdd8569,_0x279992,_0x5e8cb6,_0x59ae88){var _0x5507ca=['cm_contacts.phone',_0x5ec8('0x2f'),_0x5ec8('0x30'),_0x279992+'.'+_0x59ae88,_0x5ec8('0x31'),_0x5ec8('0x19')];return squel[_0x5ec8('0x1b')]()[_0x5ec8('0x1c')]('cm_hopper_black')[_0x5ec8('0x1d')]([_0x5ec8('0x12'),_0x5ec8('0x1f'),'ListId',_0x59ae88,_0x5ec8('0x21'),_0x5ec8('0x22')],squel[_0x5ec8('0x10')]()['fields'](_0x5507ca)[_0x5ec8('0x13')](_0x279992)[_0x5ec8('0x14')]('cm_contacts',null,_0x5ec8('0x27')+_0x279992+_0x5ec8('0x28'))['join'](_0x5e8cb6,null,_0x5e8cb6+_0x5ec8('0x15')+_0x279992+'.'+_0x59ae88)['where'](_0x279992+_0x5ec8('0x29'),_0xdd8569)['where'](_0x5ec8('0x2a'),NOW)['where'](_0x5ec8('0x2b'),squel[_0x5ec8('0x10')]()[_0x5ec8('0x11')]('phone')[_0x5ec8('0x13')](_0x5ec8('0x32'))[_0x5ec8('0x16')](_0x5ec8('0x33'),_0xdd8569)[_0x5ec8('0x16')](_0x59ae88+'\x20=\x20?',_0x279992+'.'+_0x59ae88)))[_0x5ec8('0x2e')]();}function insertCmContact(_0x1a7ea7,_0x455a77,_0xb6975,_0xf163b6){var _0x1a3a32=_[_0x5ec8('0x34')](_[_0x5ec8('0x35')](_0xf163b6),[_0x5ec8('0x20'),'CompanyId','createdAt',_0x5ec8('0x22')]);return squel['insert']()[_0x5ec8('0x1c')](_0x5ec8('0x26'))[_0x5ec8('0x1d')](_0x1a3a32,squel['select']()['fields'](_0x1a3a32)[_0x5ec8('0x13')](_0x455a77)[_0x5ec8('0x16')]('('+_0xb6975['join'](',')+_0x5ec8('0x36'),squel[_0x5ec8('0x10')]()[_0x5ec8('0x25')](_0xb6975)[_0x5ec8('0x13')](_0x5ec8('0x26'))['where'](_0x5ec8('0x33'),_0x1a7ea7)[_0x5ec8('0x16')](_0x5ec8('0x37')))[_0x5ec8('0x16')](_0x5ec8('0x38'),squel[_0x5ec8('0x10')]()[_0x5ec8('0x11')](_0x5ec8('0x39'),'min_id')['from'](_0x455a77)[_0x5ec8('0x3a')](_0xb6975[_0x5ec8('0x14')](','))))[_0x5ec8('0x2e')]();}function handleStop(){logger[_0x5ec8('0x3b')](_0x5ec8('0x3c'));stopped=!![];}function handleUncaughtException(_0x2c7747){logger[_0x5ec8('0x3d')](_0x2c7747['message']);process[_0x5ec8('0x3e')](0x1);}function handleError(_0x2d0174,_0x2febda){stats[_0x5ec8('0x3f')][_0x5ec8('0x40')]({'name':_0x2febda[_0x5ec8('0x41')],'message':_0x2febda[_0x5ec8('0x42')],'row':_0x2d0174});}function handleQuery(_0x49f36e){logger[_0x5ec8('0x3b')](_0x49f36e);return db['sequelize']['query'](_0x49f36e)['spread'](function(_0x4e02da){results[_0x5ec8('0x40')](_0x4e02da);})[_0x5ec8('0x43')](function(_0x27e54b){logger['error'](_0x27e54b[_0x5ec8('0x42')]);});}function main(_0x2cecbe,_0x4b65dc,_0x1d28ad,_0x5c639d){logger[_0x5ec8('0x3b')](_0x5ec8('0x44'),_0x2cecbe,JSON[_0x5ec8('0x45')](_0x4b65dc));process[_0x5ec8('0x46')](_0x5ec8('0x47'));var _0x5ae3ee=_0x4b65dc[_0x5ec8('0x48')];var _0x1a13c2=_0x4b65dc[_0x5ec8('0x49')];var _0x1f24c7=path['join'](config[_0x5ec8('0x4a')],_0x5ec8('0x4b'),_0x1a13c2+_0x5ec8('0x4c'));var _0x436159=_[_0x5ec8('0x35')](_0x5ae3ee)[_0x5ec8('0x14')]();logger['info'](_0x5ec8('0x4d'),_0x436159);fs['writeFileSync'](_0x1f24c7,_0x436159+'\x0a');Papa[_0x5ec8('0x4e')](fs['createReadStream'](_0x2cecbe),{'header':!![],'skipEmptyLines':!![],'step':function(_0x254e16,_0x4053cc){try{for(var _0x5aa3ce=0x0,_0x1526f1=[];_0x5aa3ce<_0x254e16[_0x5ec8('0x4f')][_0x5ec8('0x50')];_0x5aa3ce++){stats[_0x5ec8('0x51')]+=0x1;if(_0x254e16[_0x5ec8('0x3f')][_0x5aa3ce]){handleError(_0x254e16[_0x5ec8('0x4f')][_0x5aa3ce],_0x254e16[_0x5ec8('0x3f')][_0x5aa3ce]);}else{var _0x4905ca=[];for(var _0x5773bc in _0x5ae3ee){if(_0x5ae3ee[_0x5ec8('0x52')](_0x5773bc)){if(_0x254e16[_0x5ec8('0x4f')][_0x5aa3ce][_0x5ae3ee[_0x5773bc]]){var _0x53d2b4=_[_0x5ec8('0x53')](_0x254e16[_0x5ec8('0x4f')][_0x5aa3ce][_0x5ae3ee[_0x5773bc]][_0x5ec8('0x54')](/"/g,'\x27'));switch(_0x5773bc){case'scheduledat':var _0x3c96a4=moment(_0x53d2b4,_0x5ec8('0x55'),!![]);if(_0x3c96a4['isValid']()){_0x1526f1['push']('\x22'+_0x53d2b4+'\x22');}else{_0x4905ca[_0x5ec8('0x40')](_0x5ec8('0x56'));}break;case _0x5ec8('0x23'):var _0x892675=parseInt(_0x53d2b4);_0x53d2b4=_[_0x5ec8('0x57')](_0x892675)||_0x892675<0x0||_0x892675>0x4?_0x5c639d?0x3:0x2:_0x892675;_0x1526f1['push']('\x22'+_0x53d2b4+'\x22');break;case'UserId':var _0x18e9b3=parseInt(_0x53d2b4);if(_[_0x5ec8('0x58')](_0x18e9b3)&&_[_0x5ec8('0x59')](_0x1d28ad,_0x18e9b3)){_0x1526f1['push']('\x22'+_0x18e9b3+'\x22');}else{_0x4905ca[_0x5ec8('0x40')](_0x5ec8('0x5a'));}break;case'email':if(isEmail(_0x53d2b4)){_0x1526f1['push']('\x22'+_0x53d2b4+'\x22');}else{_0x4905ca[_0x5ec8('0x40')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x437ea6=moment(_0x53d2b4,'YYYY-MM-DD',!![]);if(_0x437ea6[_0x5ec8('0x5b')]()){_0x1526f1[_0x5ec8('0x40')]('\x22'+_0x53d2b4+'\x22');}else{_0x4905ca[_0x5ec8('0x40')](_0x5ec8('0x5c'));}break;default:_0x1526f1[_0x5ec8('0x40')]('\x22'+_0x53d2b4+'\x22');}}else{switch(_0x5773bc){case _0x5ec8('0x5d'):case'phone':_0x4905ca[_0x5ec8('0x40')](_0x5773bc+'\x20not\x20specified');break;default:_0x1526f1[_0x5ec8('0x40')]('\x22\x22');}}}}if(_0x4905ca[_0x5ec8('0x50')]){handleError(_0x254e16['data'][_0x5aa3ce],{'code':_0x5ec8('0x5e'),'message':_0x4905ca['join']()});}else{fs[_0x5ec8('0x5f')](_0x1f24c7,_0x1526f1['join']()+'\x0a');}_0x1526f1=[];}if(!(stats[_0x5ec8('0x51')]%0xc8)){socket[_0x5ec8('0x60')](_0x5ec8('0x61')+_0x1a13c2,stats);stats[_0x5ec8('0x3f')]=[];}}if(stopped){logger[_0x5ec8('0x3b')](_0x5ec8('0x62'));_0x4053cc[_0x5ec8('0x63')]();}}catch(_0x129390){handleError(_0x254e16[_0x5ec8('0x4f')][_0x5aa3ce],{'code':'SystemError','message':_0x129390['message']});logger['error'](_0x5ec8('0x64'),_0x129390[_0x5ec8('0x42')]);}},'complete':function(){try{var _0x344a67=[];var _0x474ac9=_0x5ec8('0x26');if(_0x4b65dc[_0x5ec8('0x65')]&&_0x4b65dc[_0x5ec8('0x65')][_0x5ec8('0x50')]){_0x474ac9='cm_contacts_'+_0x1a13c2;_0x344a67[_0x5ec8('0x40')](_0x5ec8('0x66')+_0x474ac9+_0x5ec8('0x67'));}var _0x375a15=util['format']('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x1f24c7,_0x474ac9,_0x436159,_0x4b65dc[_0x5ec8('0x20')],_0x4b65dc[_0x5ec8('0x68')]||null,NOW,NOW);if(_[_0x5ec8('0x69')](_0x5ae3ee[_0x5ec8('0x1e')])){_0x375a15+=',\x20scheduledAt\x20=\x20NOW()';}_0x344a67[_0x5ec8('0x40')](_0x375a15);if(_0x4b65dc[_0x5ec8('0x65')]&&_0x4b65dc[_0x5ec8('0x65')][_0x5ec8('0x50')]){_0x344a67[_0x5ec8('0x40')](insertCmContact(_0x4b65dc['ListId'],_0x474ac9,_0x4b65dc[_0x5ec8('0x65')],_0x5ae3ee));_0x344a67[_0x5ec8('0x40')](_0x5ec8('0x6a')+_0x474ac9+';');}_0x344a67[_0x5ec8('0x40')](insertCmHopper(_0x4b65dc[_0x5ec8('0x20')],_0x5ec8('0x6b'),_0x5ec8('0x6c'),'VoiceQueueId',_0x5c639d));_0x344a67[_0x5ec8('0x40')](insertCmHopperBlack(_0x4b65dc['ListId'],_0x5ec8('0x6d'),_0x5ec8('0x6c'),_0x5ec8('0x6e')));_0x344a67[_0x5ec8('0x40')](insertCmHopper(_0x4b65dc[_0x5ec8('0x20')],_0x5ec8('0x6f'),_0x5ec8('0x70'),_0x5ec8('0x71'),_0x5c639d));_0x344a67[_0x5ec8('0x40')](insertCmHopperBlack(_0x4b65dc['ListId'],'campaigns_has_cm_blacklists',_0x5ec8('0x70'),'CampaignId'));BPromise[_0x5ec8('0x72')](_0x344a67,handleQuery)[_0x5ec8('0x73')](function(_0x33a5d7){stats[_0x5ec8('0x74')]=!![];stats[_0x5ec8('0x75')]=_0x4b65dc[_0x5ec8('0x65')]&&_0x4b65dc[_0x5ec8('0x65')][_0x5ec8('0x50')]?results[0x2][_0x5ec8('0x75')]:results[0x0][_0x5ec8('0x75')];socket[_0x5ec8('0x60')](_0x5ec8('0x61')+_0x1a13c2,stats);fs[_0x5ec8('0x76')](_0x2cecbe);fs[_0x5ec8('0x76')](_0x1f24c7);process['exit'](0x0);})[_0x5ec8('0x43')](function(_0x7861da){logger[_0x5ec8('0x3d')](_0x7861da['message']);process['exit'](0x1);});}catch(_0x3a917f){logger[_0x5ec8('0x3d')](_0x5ec8('0x77'),_0x3a917f[_0x5ec8('0x42')]);process[_0x5ec8('0x3e')](0x1);}},'error':function(_0x1773b1,_0x2538d6,_0x108f97,_0x2a6bc1){throw new Error(_0x2a6bc1);}});}function validate(){if(process[_0x5ec8('0x78')]&&process[_0x5ec8('0x78')]['length']<0x4){throw new Error('arguments\x20\x20\x20');}var _0x137878=path['join'](config['root'],_0x5ec8('0x4b'),process[_0x5ec8('0x78')][0x2]);if(!fs[_0x5ec8('0x79')](_0x137878)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x32153c={};try{_0x32153c=JSON[_0x5ec8('0x4e')](process[_0x5ec8('0x78')][0x3]);if(!_0x32153c[_0x5ec8('0x48')]){throw new Error(_0x5ec8('0x7a'));}if(!_0x32153c[_0x5ec8('0x48')][_0x5ec8('0x12')]){throw new Error(_0x5ec8('0x7b'));}if(!_0x32153c['binding'][_0x5ec8('0x5d')]){throw new Error('firstName\x20is\x20mandatory');}var _0x9bfff=0x0;if(_0x32153c[_0x5ec8('0x48')][_0x5ec8('0x7c')]){_0x9bfff=0x1;}if(!_0x32153c[_0x5ec8('0x20')]){throw new Error(_0x5ec8('0x7d'));}}catch(_0x46cf35){throw new Error(_0x5ec8('0x7e'));}var _0x2c12f0=[];try{_0x2c12f0=_[_0x5ec8('0x7f')](JSON[_0x5ec8('0x4e')](process[_0x5ec8('0x78')][0x4]),'id');}catch(_0x3f4bfa){logger['info'](_0x5ec8('0x80'));}main(_0x137878,_0x32153c,_0x2c12f0,_0x9bfff);}validate();process['on'](_0x5ec8('0x81'),handleStop);process['on'](_0x5ec8('0x82'),handleUncaughtException); \ No newline at end of file +var _0xa47f=['cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.createdAt','cm_hopper_black','select','ListId\x20=\x20?','\x20=\x20?','concat','keys','CompanyId','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','errors','push','message','query','spread','catch','stringify','start','binding','socket_timestamp','root','server/files/tmp','.csv','header','parse','createReadStream','data','length','rows','hasOwnProperty','trim','replace','isValid','UserId','includes','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','contact:import:','Abort\x20parser','SystemError','step','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','isNil','scheduledat',',\x20scheduledAt\x20=\x20NOW()','duplicates','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','emit','unlink','exit','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','import','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','field','from','join','.id\x20=\x20','where','\x20=\x20','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','insert','into','fromQuery','phone','ContactId','ListId','createdAt','updatedAt','priority','fields'];(function(_0x2401c8,_0x523747){var _0x2106dc=function(_0x1fbc55){while(--_0x1fbc55){_0x2401c8['push'](_0x2401c8['shift']());}};_0x2106dc(++_0x523747);}(_0xa47f,0x1f3));var _0xfa47=function(_0x2b0ac5,_0x56bb92){_0x2b0ac5=_0x2b0ac5-0x0;var _0x2612e0=_0xa47f[_0x2b0ac5];return _0x2612e0;};'use strict';var fs=require('fs');var path=require(_0xfa47('0x0'));var _=require(_0xfa47('0x1'));var Papa=require(_0xfa47('0x2'));var util=require(_0xfa47('0x3'));var BPromise=require(_0xfa47('0x4'));var moment=require(_0xfa47('0x5'));var squel=require(_0xfa47('0x6'));var Redis=require('ioredis');var db=require(_0xfa47('0x7'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xfa47('0x8'));config[_0xfa47('0x9')]=_[_0xfa47('0xa')](config[_0xfa47('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xfa47('0xb'))(new Redis(config[_0xfa47('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xfa47('0xc')](_0xfa47('0xd'));function isEmail(_0x4991c6){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))*$/[_0xfa47('0xe')](_0x4991c6);}function selectNotIn(_0x317bfd,_0x23a560,_0x4d019b,_0xa862e,_0x2bfa79){return squel['select']()[_0xfa47('0xf')]('phone')[_0xfa47('0x10')](_0xa862e)[_0xfa47('0x11')](_0x23a560,null,_0x23a560+_0xfa47('0x12')+_0xa862e+'.'+_0x4d019b)[_0xfa47('0x13')](_0xa862e+'.'+_0x4d019b+_0xfa47('0x14')+_0x317bfd+'.'+_0x4d019b)[_0xfa47('0x13')](_0x23a560+'.dialCheckDuplicateType\x20IN\x20('+_0x2bfa79[_0xfa47('0x11')]()+')');}function insertCmHopper(_0x5128bb,_0x4f8537,_0x26176b,_0x4fb3a6,_0x566d72){var _0xcb3500=[_0xfa47('0x15'),_0xfa47('0x16'),_0xfa47('0x17'),_0xfa47('0x18'),_0x4f8537+'.'+_0x4fb3a6,'cm_contacts.createdAt',_0xfa47('0x19'),_0xfa47('0x1a'),'cm_contacts.UserId','\x22'+_0x566d72+'\x22'];return squel[_0xfa47('0x1b')]()[_0xfa47('0x1c')]('cm_hopper')[_0xfa47('0x1d')]([_0xfa47('0x1e'),'scheduledat',_0xfa47('0x1f'),_0xfa47('0x20'),_0x4fb3a6,_0xfa47('0x21'),_0xfa47('0x22'),_0xfa47('0x23'),'UserId','recallme'],squel['select']()[_0xfa47('0x24')](_0xcb3500)[_0xfa47('0x10')](_0x4f8537)['join'](_0xfa47('0x25'),null,_0xfa47('0x26')+_0x4f8537+_0xfa47('0x27'))['join'](_0x26176b,null,_0x26176b+_0xfa47('0x12')+_0x4f8537+'.'+_0x4fb3a6)['where'](_0x4f8537+'.CmListId\x20=\x20?',_0x5128bb)['where'](_0xfa47('0x28'),NOW)[_0xfa47('0x13')](_0xfa47('0x29'),selectNotIn(_0x4f8537,_0x26176b,_0x4fb3a6,_0xfa47('0x2a'),[_0xfa47('0x2b'),_0xfa47('0x2c')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4f8537,_0x26176b,_0x4fb3a6,_0xfa47('0x2a'),['\x22always\x22'])))[_0xfa47('0x2d')]();}function insertCmHopperBlack(_0x17eca3,_0x3d8c6c,_0x5f2137,_0x5dc68e){var _0x32bd4a=['cm_contacts.phone',_0xfa47('0x17'),_0xfa47('0x18'),_0x3d8c6c+'.'+_0x5dc68e,_0xfa47('0x2e'),_0xfa47('0x19')];return squel[_0xfa47('0x1b')]()['into'](_0xfa47('0x2f'))[_0xfa47('0x1d')]([_0xfa47('0x1e'),_0xfa47('0x1f'),_0xfa47('0x20'),_0x5dc68e,_0xfa47('0x21'),_0xfa47('0x22')],squel[_0xfa47('0x30')]()[_0xfa47('0x24')](_0x32bd4a)[_0xfa47('0x10')](_0x3d8c6c)[_0xfa47('0x11')](_0xfa47('0x25'),null,_0xfa47('0x26')+_0x3d8c6c+'.CmListId')[_0xfa47('0x11')](_0x5f2137,null,_0x5f2137+_0xfa47('0x12')+_0x3d8c6c+'.'+_0x5dc68e)[_0xfa47('0x13')](_0x3d8c6c+'.CmListId\x20=\x20?',_0x17eca3)[_0xfa47('0x13')](_0xfa47('0x28'),NOW)[_0xfa47('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xfa47('0x30')]()[_0xfa47('0xf')](_0xfa47('0x1e'))['from'](_0xfa47('0x2f'))[_0xfa47('0x13')](_0xfa47('0x31'),_0x17eca3)['where'](_0x5dc68e+_0xfa47('0x32'),_0x3d8c6c+'.'+_0x5dc68e)))['toString']();}function insertCmContact(_0x3dcdcc,_0x5da66a,_0x2409b4,_0x2297b2){var _0x2fdcdd=_[_0xfa47('0x33')](_[_0xfa47('0x34')](_0x2297b2),[_0xfa47('0x20'),_0xfa47('0x35'),'createdAt',_0xfa47('0x22')]);return squel[_0xfa47('0x1b')]()[_0xfa47('0x1c')]('cm_contacts')[_0xfa47('0x1d')](_0x2fdcdd,squel[_0xfa47('0x30')]()['fields'](_0x2fdcdd)[_0xfa47('0x10')](_0x5da66a)[_0xfa47('0x13')]('('+_0x2409b4[_0xfa47('0x11')](',')+')\x20NOT\x20IN\x20?',squel[_0xfa47('0x30')]()[_0xfa47('0x24')](_0x2409b4)[_0xfa47('0x10')](_0xfa47('0x25'))['where']('ListId\x20=\x20?',_0x3dcdcc)['where'](_0xfa47('0x36')))[_0xfa47('0x13')](_0xfa47('0x37'),squel[_0xfa47('0x30')]()[_0xfa47('0xf')](_0xfa47('0x38'),_0xfa47('0x39'))[_0xfa47('0x10')](_0x5da66a)[_0xfa47('0x3a')](_0x2409b4['join'](','))))[_0xfa47('0x2d')]();}function handleStop(){logger[_0xfa47('0x3b')](_0xfa47('0x3c'));stopped=!![];}function handleUncaughtException(_0x12958c){logger[_0xfa47('0x3d')](_0x12958c['message']);process['exit'](0x1);}function handleError(_0x23bbb6,_0x517c69){stats[_0xfa47('0x3e')][_0xfa47('0x3f')]({'name':_0x517c69['code'],'message':_0x517c69[_0xfa47('0x40')],'row':_0x23bbb6});}function handleQuery(_0xa8d64){logger[_0xfa47('0x3b')](_0xa8d64);return db['sequelize'][_0xfa47('0x41')](_0xa8d64)[_0xfa47('0x42')](function(_0xf193fd){results[_0xfa47('0x3f')](_0xf193fd);})[_0xfa47('0x43')](function(_0x18c450){logger['error'](_0x18c450['message']);});}function main(_0x56857b,_0x4c2f3a,_0x1a86af,_0x1c1fb8){logger[_0xfa47('0x3b')]('main',_0x56857b,JSON[_0xfa47('0x44')](_0x4c2f3a));process['send'](_0xfa47('0x45'));var _0x4db1e0=_0x4c2f3a[_0xfa47('0x46')];var _0x3f9e7d=_0x4c2f3a[_0xfa47('0x47')];var _0x191250=path[_0xfa47('0x11')](config[_0xfa47('0x48')],_0xfa47('0x49'),_0x3f9e7d+_0xfa47('0x4a'));var _0x4ed5da=_[_0xfa47('0x34')](_0x4db1e0)[_0xfa47('0x11')]();logger[_0xfa47('0x3b')](_0xfa47('0x4b'),_0x4ed5da);fs['writeFileSync'](_0x191250,_0x4ed5da+'\x0a');Papa[_0xfa47('0x4c')](fs[_0xfa47('0x4d')](_0x56857b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x21fe8f,_0x4624c4){try{for(var _0x8ecf92=0x0,_0x253632=[];_0x8ecf92<_0x21fe8f[_0xfa47('0x4e')][_0xfa47('0x4f')];_0x8ecf92++){stats[_0xfa47('0x50')]+=0x1;if(_0x21fe8f[_0xfa47('0x3e')][_0x8ecf92]){handleError(_0x21fe8f['data'][_0x8ecf92],_0x21fe8f[_0xfa47('0x3e')][_0x8ecf92]);}else{var _0x5d7a1d=[];for(var _0x4ecdee in _0x4db1e0){if(_0x4db1e0[_0xfa47('0x51')](_0x4ecdee)){if(_0x21fe8f[_0xfa47('0x4e')][_0x8ecf92][_0x4db1e0[_0x4ecdee]]){var _0x5a6b2f=_[_0xfa47('0x52')](_0x21fe8f['data'][_0x8ecf92][_0x4db1e0[_0x4ecdee]][_0xfa47('0x53')](/"/g,'\x27'));switch(_0x4ecdee){case'scheduledat':var _0x446c08=moment(_0x5a6b2f,_0xfa47('0xd'),!![]);if(_0x446c08[_0xfa47('0x54')]()){_0x253632[_0xfa47('0x3f')]('\x22'+_0x5a6b2f+'\x22');}else{_0x5d7a1d[_0xfa47('0x3f')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xfa47('0x23'):var _0x498728=parseInt(_0x5a6b2f);_0x5a6b2f=_['isNaN'](_0x498728)||_0x498728<0x0||_0x498728>0x4?_0x1c1fb8?0x3:0x2:_0x498728;_0x253632['push']('\x22'+_0x5a6b2f+'\x22');break;case _0xfa47('0x55'):var _0xe9d8a8=parseInt(_0x5a6b2f);if(_['isNumber'](_0xe9d8a8)&&_[_0xfa47('0x56')](_0x1a86af,_0xe9d8a8)){_0x253632[_0xfa47('0x3f')]('\x22'+_0xe9d8a8+'\x22');}else{_0x5d7a1d[_0xfa47('0x3f')]('agent\x20not\x20exists');}break;case _0xfa47('0x57'):if(isEmail(_0x5a6b2f)){_0x253632['push']('\x22'+_0x5a6b2f+'\x22');}else{_0x5d7a1d['push'](_0xfa47('0x58'));}break;case _0xfa47('0x59'):var _0x19ff8b=moment(_0x5a6b2f,_0xfa47('0x5a'),!![]);if(_0x19ff8b[_0xfa47('0x54')]()){_0x253632[_0xfa47('0x3f')]('\x22'+_0x5a6b2f+'\x22');}else{_0x5d7a1d[_0xfa47('0x3f')](_0xfa47('0x5b'));}break;default:_0x253632['push']('\x22'+_0x5a6b2f+'\x22');}}else{switch(_0x4ecdee){case _0xfa47('0x5c'):case _0xfa47('0x1e'):_0x5d7a1d[_0xfa47('0x3f')](_0x4ecdee+_0xfa47('0x5d'));break;default:_0x253632['push']('\x22\x22');}}}}if(_0x5d7a1d[_0xfa47('0x4f')]){handleError(_0x21fe8f[_0xfa47('0x4e')][_0x8ecf92],{'code':_0xfa47('0x5e'),'message':_0x5d7a1d[_0xfa47('0x11')]()});}else{fs[_0xfa47('0x5f')](_0x191250,_0x253632['join']()+'\x0a');}_0x253632=[];}if(!(stats[_0xfa47('0x50')]%0xc8)){socket['emit'](_0xfa47('0x60')+_0x3f9e7d,stats);stats[_0xfa47('0x3e')]=[];}}if(stopped){logger[_0xfa47('0x3b')](_0xfa47('0x61'));_0x4624c4['abort']();}}catch(_0x4cd551){handleError(_0x21fe8f[_0xfa47('0x4e')][_0x8ecf92],{'code':_0xfa47('0x62'),'message':_0x4cd551['message']});logger[_0xfa47('0x3d')](_0xfa47('0x63'),_0x4cd551[_0xfa47('0x40')]);}},'complete':function(){try{var _0x18ac6d=[];var _0x488d52=_0xfa47('0x25');if(_0x4c2f3a['duplicates']&&_0x4c2f3a['duplicates'][_0xfa47('0x4f')]){_0x488d52=_0xfa47('0x64')+_0x3f9e7d;_0x18ac6d[_0xfa47('0x3f')](_0xfa47('0x65')+_0x488d52+_0xfa47('0x66'));}var _0x562a16=util[_0xfa47('0xc')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x191250,_0x488d52,_0x4ed5da,_0x4c2f3a['ListId'],_0x4c2f3a[_0xfa47('0x35')]||null,NOW,NOW);if(_[_0xfa47('0x67')](_0x4db1e0[_0xfa47('0x68')])){_0x562a16+=_0xfa47('0x69');}_0x18ac6d['push'](_0x562a16);if(_0x4c2f3a[_0xfa47('0x6a')]&&_0x4c2f3a[_0xfa47('0x6a')][_0xfa47('0x4f')]){_0x18ac6d[_0xfa47('0x3f')](insertCmContact(_0x4c2f3a[_0xfa47('0x20')],_0x488d52,_0x4c2f3a[_0xfa47('0x6a')],_0x4db1e0));_0x18ac6d[_0xfa47('0x3f')](_0xfa47('0x6b')+_0x488d52+';');}_0x18ac6d['push'](insertCmHopper(_0x4c2f3a[_0xfa47('0x20')],_0xfa47('0x6c'),_0xfa47('0x6d'),'VoiceQueueId',_0x1c1fb8));_0x18ac6d[_0xfa47('0x3f')](insertCmHopperBlack(_0x4c2f3a[_0xfa47('0x20')],_0xfa47('0x6e'),_0xfa47('0x6d'),_0xfa47('0x6f')));_0x18ac6d[_0xfa47('0x3f')](insertCmHopper(_0x4c2f3a[_0xfa47('0x20')],_0xfa47('0x70'),_0xfa47('0x71'),_0xfa47('0x72'),_0x1c1fb8));_0x18ac6d['push'](insertCmHopperBlack(_0x4c2f3a['ListId'],_0xfa47('0x73'),_0xfa47('0x71'),_0xfa47('0x72')));BPromise[_0xfa47('0x74')](_0x18ac6d,handleQuery)[_0xfa47('0x75')](function(_0x14fd71){stats[_0xfa47('0x76')]=!![];stats[_0xfa47('0x77')]=_0x4c2f3a[_0xfa47('0x6a')]&&_0x4c2f3a[_0xfa47('0x6a')][_0xfa47('0x4f')]?results[0x2][_0xfa47('0x77')]:results[0x0][_0xfa47('0x77')];socket[_0xfa47('0x78')](_0xfa47('0x60')+_0x3f9e7d,stats);fs['unlink'](_0x56857b);fs[_0xfa47('0x79')](_0x191250);process[_0xfa47('0x7a')](0x0);})[_0xfa47('0x43')](function(_0x26d291){logger[_0xfa47('0x3d')](_0x26d291['message']);process['exit'](0x1);});}catch(_0x547b63){logger[_0xfa47('0x3d')](_0xfa47('0x7b'),_0x547b63['message']);process[_0xfa47('0x7a')](0x1);}},'error':function(_0x1c13cd,_0x4c5eda,_0x20a752,_0xe6ff3a){throw new Error(_0xe6ff3a);}});}function validate(){if(process['argv']&&process[_0xfa47('0x7c')][_0xfa47('0x4f')]<0x4){throw new Error(_0xfa47('0x7d'));}var _0x5c28da=path[_0xfa47('0x11')](config[_0xfa47('0x48')],_0xfa47('0x49'),process[_0xfa47('0x7c')][0x2]);if(!fs['existsSync'](_0x5c28da)){throw new Error(_0xfa47('0x7e'));}var _0x1b9359={};try{_0x1b9359=JSON[_0xfa47('0x4c')](process[_0xfa47('0x7c')][0x3]);if(!_0x1b9359['binding']){throw new Error(_0xfa47('0x7f'));}if(!_0x1b9359['binding']['phone']){throw new Error(_0xfa47('0x80'));}if(!_0x1b9359[_0xfa47('0x46')][_0xfa47('0x5c')]){throw new Error(_0xfa47('0x81'));}var _0x1c88ff=0x0;if(_0x1b9359[_0xfa47('0x46')][_0xfa47('0x55')]){_0x1c88ff=0x1;}if(!_0x1b9359['ListId']){throw new Error(_0xfa47('0x82'));}}catch(_0x187e7d){throw new Error(_0xfa47('0x83'));}var _0x13d7ea=[];try{_0x13d7ea=_['map'](JSON[_0xfa47('0x4c')](process[_0xfa47('0x7c')][0x4]),'id');}catch(_0x241952){logger[_0xfa47('0x3b')](_0xfa47('0x84'));}main(_0x5c28da,_0x1b9359,_0x13d7ea,_0x1c88ff);}validate();process['on']('SIGINT',handleStop);process['on'](_0xfa47('0x85'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 1ed2b0d..c863fe2 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8381=['***\x20Agent\x20Info\x20***','destcalleridname','***\x20Time\x20Info\x20***','agentconnectAt','Agent\x20Complete','Hold\x20Time','holdtime','talktime','Called\x20Number','membername','UniqueId','Date','starttime','answertime','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','inbound','push','queue','outbound','string','Outbound\x20Call','destcalleridnum','getDescriptions','voice','toLowerCase','***\x20Call\x20Info\x20***','Caller\x20Number','calleridnum','keyValue','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','variable','uniqueid','agentcalledAt'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x8381,0x91));var _0x1838=function(_0x51954b,_0x3c0be6){_0x51954b=_0x51954b-0x0;var _0x281c55=_0x8381[_0x51954b];return _0x281c55;};'use strict';exports[_0x1838('0x0')]=function(_0xcc1fc8,_0x1fb6a8){var _0x3cc49b=[{'type':'string','content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0xcc1fc8['toLowerCase']()){case'voice':switch(_0x1fb6a8['toLowerCase']()){case _0x1838('0x1'):_0x3cc49b[_0x1838('0x2')]({'type':'variable','content':'','variableName':_0x1838('0x3')});_0x3cc49b[_0x1838('0x2')]({'type':'variable','content':'','variableName':'calleridnum'});break;case _0x1838('0x4'):_0x3cc49b['push']({'type':_0x1838('0x5'),'content':_0x1838('0x6'),'variableName':null});_0x3cc49b['push']({'type':'variable','content':'','variableName':_0x1838('0x7')});break;}}return _0x3cc49b;};exports[_0x1838('0x8')]=function(_0x170fbd,_0x230232){var _0xe3abfd=[];switch(_0x170fbd['toLowerCase']()){case _0x1838('0x9'):switch(_0x230232[_0x1838('0xa')]()){case _0x1838('0x1'):_0xe3abfd=[{'type':'string','content':_0x1838('0xb'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x1838('0xc'),'keyType':'variable','variableName':_0x1838('0xd')},{'type':_0x1838('0xe'),'content':'','key':_0x1838('0xf'),'keyType':'variable','variableName':_0x1838('0x10')},{'type':_0x1838('0xe'),'content':'','key':_0x1838('0x11'),'keyType':'variable','variableName':_0x1838('0x12')},{'type':'keyValue','content':'','key':_0x1838('0x13'),'keyType':'variable','variableName':_0x1838('0x3')},{'type':_0x1838('0xe'),'content':'','key':'UniqueId','keyType':_0x1838('0x14'),'variableName':_0x1838('0x15')},{'type':_0x1838('0xe'),'content':'','key':'Date','keyType':'variable','variableName':_0x1838('0x16')},{'type':_0x1838('0x5'),'content':_0x1838('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0x1838('0xe'),'content':'','key':'Agent\x20Name','keyType':'variable','variableName':_0x1838('0x18')},{'type':_0x1838('0xe'),'content':'','key':'Agent\x20Number','keyType':_0x1838('0x14'),'variableName':'destcalleridnum'},{'type':_0x1838('0x5'),'content':_0x1838('0x19'),'key':null,'keyType':null,'variableName':null},{'type':_0x1838('0xe'),'content':'','key':'Agent\x20Ring','keyType':_0x1838('0x14'),'variableName':_0x1838('0x16')},{'type':_0x1838('0xe'),'content':'','key':'Agent\x20Connect','keyType':'variable','variableName':_0x1838('0x1a')},{'type':'keyValue','content':'','key':_0x1838('0x1b'),'keyType':'variable','variableName':'agentcompleteAt'},{'type':_0x1838('0xe'),'content':'','key':_0x1838('0x1c'),'keyType':_0x1838('0x14'),'variableName':_0x1838('0x1d')},{'type':'keyValue','content':'','key':'Talk\x20Time','keyType':_0x1838('0x14'),'variableName':_0x1838('0x1e')}];break;case _0x1838('0x4'):_0xe3abfd=[{'type':'string','content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0x1838('0xe'),'content':'','key':_0x1838('0x1f'),'keyType':_0x1838('0x14'),'keyContent':'','variableName':_0x1838('0x7')},{'type':'keyValue','content':'','key':'Member\x20Name','keyType':_0x1838('0x14'),'keyContent':'','variableName':_0x1838('0x20')},{'type':_0x1838('0xe'),'content':'','key':_0x1838('0x21'),'keyType':_0x1838('0x14'),'keyContent':'','variableName':_0x1838('0x15')},{'type':_0x1838('0xe'),'content':'','key':_0x1838('0x22'),'keyType':_0x1838('0x14'),'keyContent':'','variableName':_0x1838('0x23')},{'type':_0x1838('0x5'),'content':_0x1838('0x19')},{'type':'keyValue','content':'','key':'Answer\x20Time','keyType':_0x1838('0x14'),'keyContent':'','variableName':_0x1838('0x24')},{'type':_0x1838('0xe'),'content':'','key':'Complete\x20Time','keyType':_0x1838('0x14'),'keyContent':'','variableName':_0x1838('0x25')},{'type':_0x1838('0xe'),'content':'','key':_0x1838('0x26'),'keyType':_0x1838('0x14'),'keyContent':'','variableName':_0x1838('0x27')},{'type':'keyValue','content':'','key':_0x1838('0x28'),'keyType':_0x1838('0x14'),'keyContent':'','variableName':_0x1838('0x29')}];break;}}return _0xe3abfd;}; \ No newline at end of file +var _0x4f5c=['uniqueid','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','agentcalledAt','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','talktime','outbound','Called\x20Number','membername','Date','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','queue','Outbound\x20Call','variable','destcalleridnum','getDescriptions','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','Queue'];(function(_0x109371,_0x441c8e){var _0x4fd858=function(_0x13504f){while(--_0x13504f){_0x109371['push'](_0x109371['shift']());}};_0x4fd858(++_0x441c8e);}(_0x4f5c,0x1a7));var _0xc4f5=function(_0x2552ab,_0x232d4a){_0x2552ab=_0x2552ab-0x0;var _0x180c2b=_0x4f5c[_0x2552ab];return _0x180c2b;};'use strict';exports['getSubjects']=function(_0x2f8f35,_0x8e2f2c){var _0x4019e2=[{'type':_0xc4f5('0x0'),'content':_0xc4f5('0x1'),'variableName':null}];switch(_0x2f8f35[_0xc4f5('0x2')]()){case _0xc4f5('0x3'):switch(_0x8e2f2c[_0xc4f5('0x2')]()){case _0xc4f5('0x4'):_0x4019e2[_0xc4f5('0x5')]({'type':'variable','content':'','variableName':_0xc4f5('0x6')});_0x4019e2[_0xc4f5('0x5')]({'type':'variable','content':'','variableName':'calleridnum'});break;case'outbound':_0x4019e2['push']({'type':'string','content':_0xc4f5('0x7'),'variableName':null});_0x4019e2['push']({'type':_0xc4f5('0x8'),'content':'','variableName':_0xc4f5('0x9')});break;}}return _0x4019e2;};exports[_0xc4f5('0xa')]=function(_0xfc9a66,_0x4cf22b){var _0x299cd1=[];switch(_0xfc9a66[_0xc4f5('0x2')]()){case'voice':switch(_0x4cf22b[_0xc4f5('0x2')]()){case _0xc4f5('0x4'):_0x299cd1=[{'type':_0xc4f5('0x0'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xc4f5('0xb'),'content':'','key':_0xc4f5('0xc'),'keyType':_0xc4f5('0x8'),'variableName':'calleridnum'},{'type':_0xc4f5('0xb'),'content':'','key':_0xc4f5('0xd'),'keyType':_0xc4f5('0x8'),'variableName':_0xc4f5('0xe')},{'type':'keyValue','content':'','key':_0xc4f5('0xf'),'keyType':_0xc4f5('0x8'),'variableName':'destexten'},{'type':_0xc4f5('0xb'),'content':'','key':_0xc4f5('0x10'),'keyType':_0xc4f5('0x8'),'variableName':'queue'},{'type':_0xc4f5('0xb'),'content':'','key':'UniqueId','keyType':_0xc4f5('0x8'),'variableName':_0xc4f5('0x11')},{'type':_0xc4f5('0xb'),'content':'','key':'Date','keyType':'variable','variableName':'agentcalledAt'},{'type':_0xc4f5('0x0'),'content':_0xc4f5('0x12'),'key':null,'keyType':null,'variableName':null},{'type':_0xc4f5('0xb'),'content':'','key':_0xc4f5('0x13'),'keyType':_0xc4f5('0x8'),'variableName':_0xc4f5('0x14')},{'type':_0xc4f5('0xb'),'content':'','key':'Agent\x20Number','keyType':_0xc4f5('0x8'),'variableName':_0xc4f5('0x9')},{'type':_0xc4f5('0x0'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xc4f5('0xb'),'content':'','key':'Agent\x20Ring','keyType':_0xc4f5('0x8'),'variableName':_0xc4f5('0x15')},{'type':_0xc4f5('0xb'),'content':'','key':_0xc4f5('0x16'),'keyType':'variable','variableName':_0xc4f5('0x17')},{'type':_0xc4f5('0xb'),'content':'','key':_0xc4f5('0x18'),'keyType':_0xc4f5('0x8'),'variableName':_0xc4f5('0x19')},{'type':_0xc4f5('0xb'),'content':'','key':_0xc4f5('0x1a'),'keyType':_0xc4f5('0x8'),'variableName':_0xc4f5('0x1b')},{'type':'keyValue','content':'','key':'Talk\x20Time','keyType':_0xc4f5('0x8'),'variableName':_0xc4f5('0x1c')}];break;case _0xc4f5('0x1d'):_0x299cd1=[{'type':_0xc4f5('0x0'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0xc4f5('0xb'),'content':'','key':_0xc4f5('0x1e'),'keyType':'variable','keyContent':'','variableName':_0xc4f5('0x9')},{'type':_0xc4f5('0xb'),'content':'','key':'Member\x20Name','keyType':_0xc4f5('0x8'),'keyContent':'','variableName':_0xc4f5('0x1f')},{'type':'keyValue','content':'','key':'UniqueId','keyType':_0xc4f5('0x8'),'keyContent':'','variableName':_0xc4f5('0x11')},{'type':'keyValue','content':'','key':_0xc4f5('0x20'),'keyType':_0xc4f5('0x8'),'keyContent':'','variableName':_0xc4f5('0x21')},{'type':_0xc4f5('0x0'),'content':'***\x20Time\x20Info\x20***'},{'type':_0xc4f5('0xb'),'content':'','key':_0xc4f5('0x22'),'keyType':_0xc4f5('0x8'),'keyContent':'','variableName':_0xc4f5('0x23')},{'type':_0xc4f5('0xb'),'content':'','key':_0xc4f5('0x24'),'keyType':_0xc4f5('0x8'),'keyContent':'','variableName':_0xc4f5('0x25')},{'type':_0xc4f5('0xb'),'content':'','key':_0xc4f5('0x26'),'keyType':_0xc4f5('0x8'),'keyContent':'','variableName':_0xc4f5('0x27')},{'type':_0xc4f5('0xb'),'content':'','key':'Billable\x20Time','keyType':_0xc4f5('0x8'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x299cd1;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index efddca3..773d415 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4e2e=['query','clone','body','omit','html','phone','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','chat-interactions','whatsapp-interactions','InteractionId','upperFirst','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','stringify','null','then','update','info','catch','error','tracked','user'];(function(_0x460f12,_0x395883){var _0x117f9b=function(_0x49d9f9){while(--_0x49d9f9){_0x460f12['push'](_0x460f12['shift']());}};_0x117f9b(++_0x395883);}(_0x4e2e,0x10c));var _0xe4e2=function(_0x17787a,_0x54be43){_0x17787a=_0x17787a-0x0;var _0x1468a1=_0x4e2e[_0x17787a];return _0x1468a1;};'use strict';var _=require(_0xe4e2('0x0'));var db=require(_0xe4e2('0x1'))['db'];var loggers={'openchannel':require(_0xe4e2('0x2'))(_0xe4e2('0x3')),'mail':require('../../config/logger')('mail-interactions'),'fax':require(_0xe4e2('0x2'))(_0xe4e2('0x4')),'sms':require(_0xe4e2('0x2'))('sms-interactions'),'chat':require(_0xe4e2('0x2'))(_0xe4e2('0x5')),'whatsapp':require('../../config/logger')(_0xe4e2('0x6'))};function getInteractionId(_0x4dc389,_0x265865,_0x32fcda){if(_0x4dc389&&_0x4dc389[_['upperFirst'](_0x32fcda)+_0xe4e2('0x7')]){return _0x4dc389[_[_0xe4e2('0x8')](_0x32fcda)+_0xe4e2('0x7')];}else if(_0x4dc389&&_0x4dc389['id']){return _0x4dc389['id'];}else if(_0x265865&&_0x265865['id']){return _0x265865['id'];}else{return _0xe4e2('0x9');}}function log(_0x4651ea,_0x19b098,_0x5257e7,_0xe6ff5d,_0x1b15e4,_0x351451){loggers[_0x1b15e4[_0xe4e2('0xa')]()][_0x4651ea](_0xe4e2('0xb'),_0x351451['toUpperCase'](),_0x19b098?_0x19b098['id']:null,_0x19b098?_0x19b098[_0xe4e2('0xc')]:null,_0x19b098?_0x19b098['role']:null,getInteractionId(_0x5257e7,_0xe6ff5d,_0x1b15e4),_0x5257e7?JSON[_0xe4e2('0xd')](_0x5257e7):_0xe4e2('0xe'));}function updateUser(_0x5b27b9,_0x50c96f,_0x4e9bda,_0x40ef2c,_0x114c68){db[_['upperFirst'](_0x40ef2c)+'Interaction']['findOne']({'where':{'id':getInteractionId(_0x50c96f,_0x4e9bda,_0x40ef2c)}})[_0xe4e2('0xf')](function(_0x4cf9c2){if(_0x4cf9c2){return _0x4cf9c2[_0xe4e2('0x10')]({'UserId':_0x5b27b9?_0x5b27b9['id']:null});}})[_0xe4e2('0xf')](function(_0x10d9fb){if(_0x10d9fb){log(_0xe4e2('0x11'),_0x5b27b9,_0x50c96f,_0x4e9bda,_0x40ef2c,_0x114c68);}})[_0xe4e2('0x12')](function(){log(_0xe4e2('0x13'),_0x5b27b9,_0x50c96f,_0x4e9bda,_0x40ef2c,_0x114c68);});}exports[_0xe4e2('0x14')]=function(_0x2e07b8,_0x1e6da5){return function(_0x13504f,_0x53df88,_0x1521c2){var _0x204e58=_0x13504f[_0xe4e2('0x15')];var _0x172ee1={};var _0x436649=_0x13504f[_0xe4e2('0x16')];if(_0x172ee1){_0x172ee1=_[_0xe4e2('0x17')](_0x13504f[_0xe4e2('0x18')]);_0x172ee1=_[_0xe4e2('0x19')](_0x172ee1,[_0xe4e2('0x18'),_0xe4e2('0x1a'),_0xe4e2('0x1b'),'fax',_0xe4e2('0x1c')]);}updateUser(_0x204e58,_0x172ee1,_0x436649,_0x2e07b8,_0x1e6da5);_0x1521c2(null);};}; \ No newline at end of file +var _0x1f36=['error','tracked','user','body','omit','html','fax','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','null','findOne','update','then','info'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x1f36,0x1ed));var _0x61f3=function(_0x2842b4,_0x2b1b7b){_0x2842b4=_0x2842b4-0x0;var _0x2b9521=_0x1f36[_0x2842b4];return _0x2b9521;};'use strict';var _=require(_0x61f3('0x0'));var db=require(_0x61f3('0x1'))['db'];var loggers={'openchannel':require(_0x61f3('0x2'))(_0x61f3('0x3')),'mail':require('../../config/logger')(_0x61f3('0x4')),'fax':require('../../config/logger')(_0x61f3('0x5')),'sms':require(_0x61f3('0x2'))(_0x61f3('0x6')),'chat':require(_0x61f3('0x2'))(_0x61f3('0x7')),'whatsapp':require(_0x61f3('0x2'))(_0x61f3('0x8'))};function getInteractionId(_0x52a5eb,_0x2e5a92,_0x2f1f60){if(_0x52a5eb&&_0x52a5eb[_[_0x61f3('0x9')](_0x2f1f60)+_0x61f3('0xa')]){return _0x52a5eb[_[_0x61f3('0x9')](_0x2f1f60)+_0x61f3('0xa')];}else if(_0x52a5eb&&_0x52a5eb['id']){return _0x52a5eb['id'];}else if(_0x2e5a92&&_0x2e5a92['id']){return _0x2e5a92['id'];}else{return _0x61f3('0xb');}}function log(_0x51f786,_0x1dba23,_0x183bf0,_0x14b24e,_0x3ae705,_0x2326bf){loggers[_0x3ae705['toLowerCase']()][_0x51f786](_0x61f3('0xc'),_0x2326bf['toUpperCase'](),_0x1dba23?_0x1dba23['id']:null,_0x1dba23?_0x1dba23[_0x61f3('0xd')]:null,_0x1dba23?_0x1dba23[_0x61f3('0xe')]:null,getInteractionId(_0x183bf0,_0x14b24e,_0x3ae705),_0x183bf0?JSON['stringify'](_0x183bf0):_0x61f3('0xf'));}function updateUser(_0x2eacb1,_0x545004,_0x1e0d4b,_0x585822,_0x42c8b4){db[_[_0x61f3('0x9')](_0x585822)+'Interaction'][_0x61f3('0x10')]({'where':{'id':getInteractionId(_0x545004,_0x1e0d4b,_0x585822)}})['then'](function(_0x1b74c4){if(_0x1b74c4){return _0x1b74c4[_0x61f3('0x11')]({'UserId':_0x2eacb1?_0x2eacb1['id']:null});}})[_0x61f3('0x12')](function(_0x55c02e){if(_0x55c02e){log(_0x61f3('0x13'),_0x2eacb1,_0x545004,_0x1e0d4b,_0x585822,_0x42c8b4);}})['catch'](function(){log(_0x61f3('0x14'),_0x2eacb1,_0x545004,_0x1e0d4b,_0x585822,_0x42c8b4);});}exports[_0x61f3('0x15')]=function(_0xf55071,_0x2e339f){return function(_0x1d6fde,_0x433113,_0x45e9ac){var _0x37f16d=_0x1d6fde[_0x61f3('0x16')];var _0x33f258={};var _0xb61897=_0x1d6fde['query'];if(_0x33f258){_0x33f258=_['clone'](_0x1d6fde[_0x61f3('0x17')]);_0x33f258=_[_0x61f3('0x18')](_0x33f258,[_0x61f3('0x17'),_0x61f3('0x19'),'phone',_0x61f3('0x1a'),'mobile']);}updateUser(_0x37f16d,_0x33f258,_0xb61897,_0xf55071,_0x2e339f);_0x45e9ac(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 7b9ce18..3c03274 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 _0x333b=['util','composable-middleware','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','status','json','catch','users','User','user','isUserLimit','crypto'];(function(_0x53d6d9,_0x40999b){var _0x29a6c8=function(_0x483271){while(--_0x483271){_0x53d6d9['push'](_0x53d6d9['shift']());}};_0x29a6c8(++_0x40999b);}(_0x333b,0x8b));var _0xb333=function(_0x1a8f86,_0x5ed9c4){_0x1a8f86=_0x1a8f86-0x0;var _0x20d876=_0x333b[_0x1a8f86];return _0x20d876;};'use strict';var crypto=require(_0xb333('0x0'));var util=require(_0xb333('0x1'));var compose=require(_0xb333('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0xb333('0x3'));function getValueFromLicense(_0xb6bff7,_0x30c3e6){if(_0xb6bff7&&_0x30c3e6){if(_0x30c3e6[_0xb333('0x4')]&&_0x30c3e6[_0xb333('0x5')]){var _0x1961f4=_0x30c3e6[_0xb333('0x4')];var _0x59471c=_0x30c3e6[_0xb333('0x5')];var _0x4aaf05=_0x1961f4[_0xb333('0x6')]('-')[0x4];var _0x1c1270=_0x1961f4[_0xb333('0x6')]('-')[0x0];var _0x4d23e7=crypto[_0xb333('0x7')](_0xb333('0x8'),util[_0xb333('0x9')](_0xb333('0xa'),_0x4aaf05,_0x1961f4,_0x1c1270));var _0x1f5f5=_0x4d23e7['update'](_0x59471c,_0xb333('0xb'),_0xb333('0xc'));_0x1f5f5+=_0x4d23e7[_0xb333('0xd')](_0xb333('0xc'));var _0x2110b9=JSON[_0xb333('0xe')](_0x1f5f5);return _0x2110b9[_0xb333('0xf')](_0xb6bff7)?_0x2110b9[_0xb6bff7]:null;}}return null;}function isLimit(_0x20c974,_0xd63c1b,_0x358ed4,_0x818f0b){var _0x388f62=_0xd63c1b;return compose()[_0xb333('0x10')](function(_0x4558c3,_0x7315c,_0x2c2f9e){return db[_0xb333('0x11')][_0xb333('0x12')]({'where':{'id':0x1},'raw':!![]})[_0xb333('0x13')](function(_0x2fb798){var _0x52cf43=getValueFromLicense(_0x20c974,_0x2fb798);return _0x52cf43?_0x52cf43:_0x388f62;})[_0xb333('0x13')](function(_0xf88a){_0x388f62=_0xf88a;return _0x358ed4[_0xb333('0x14')](_0x818f0b);})[_0xb333('0x13')](function(_0x482ebf){if(_0x482ebf>=_0x388f62){return _0x7315c[_0xb333('0x15')](0x193)[_0xb333('0x16')]({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x20c974)});}_0x2c2f9e();})[_0xb333('0x17')](function(_0x3bc5f7){_0x2c2f9e(_0x3bc5f7);});});}function isUserLimit(){return isLimit(_0xb333('0x18'),0x1,db[_0xb333('0x19')],{'where':{'$or':[{'role':'admin'},{'role':_0xb333('0x1a')}]}});}exports[_0xb333('0x1b')]=isUserLimit; \ No newline at end of file +var _0x537a=['license','data1','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','use','License','findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb'];(function(_0x106d4a,_0x5b5994){var _0xcdafb7=function(_0x563fec){while(--_0x563fec){_0x106d4a['push'](_0x106d4a['shift']());}};_0xcdafb7(++_0x5b5994);}(_0x537a,0xcc));var _0xa537=function(_0x487368,_0x417826){_0x487368=_0x487368-0x0;var _0x2895d8=_0x537a[_0x487368];return _0x2895d8;};'use strict';var crypto=require(_0xa537('0x0'));var util=require(_0xa537('0x1'));var compose=require(_0xa537('0x2'));var db=require(_0xa537('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x5f2944,_0x4f2d5d){if(_0x5f2944&&_0x4f2d5d){if(_0x4f2d5d['data1']&&_0x4f2d5d[_0xa537('0x4')]){var _0x55402c=_0x4f2d5d[_0xa537('0x5')];var _0x560cd0=_0x4f2d5d['license'];var _0xa326fa=_0x55402c[_0xa537('0x6')]('-')[0x4];var _0xebb91d=_0x55402c[_0xa537('0x6')]('-')[0x0];var _0x5ec3a1=crypto[_0xa537('0x7')](_0xa537('0x8'),util[_0xa537('0x9')](_0xa537('0xa'),_0xa326fa,_0x55402c,_0xebb91d));var _0x5a59de=_0x5ec3a1[_0xa537('0xb')](_0x560cd0,_0xa537('0xc'),_0xa537('0xd'));_0x5a59de+=_0x5ec3a1[_0xa537('0xe')]('utf8');var _0x18c9d1=JSON['parse'](_0x5a59de);return _0x18c9d1['hasOwnProperty'](_0x5f2944)?_0x18c9d1[_0x5f2944]:null;}}return null;}function isLimit(_0x2b03b2,_0x4664a0,_0x199a84,_0x9333e7){var _0x8de31b=_0x4664a0;return compose()[_0xa537('0xf')](function(_0x2de8bd,_0x3f26e5,_0x5909cb){return db[_0xa537('0x10')][_0xa537('0x11')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x17d7c4){var _0x43ee49=getValueFromLicense(_0x2b03b2,_0x17d7c4);return _0x43ee49?_0x43ee49:_0x8de31b;})[_0xa537('0x12')](function(_0x114bcb){_0x8de31b=_0x114bcb;return _0x199a84['count'](_0x9333e7);})[_0xa537('0x12')](function(_0x373459){if(_0x373459>=_0x8de31b){return _0x3f26e5[_0xa537('0x13')](0x193)[_0xa537('0x14')]({'message':util[_0xa537('0x9')](_0xa537('0x15'),_0x2b03b2)});}_0x5909cb();})[_0xa537('0x16')](function(_0x1664bc){_0x5909cb(_0x1664bc);});});}function isUserLimit(){return isLimit('users',0x1,db[_0xa537('0x17')],{'where':{'$or':[{'role':'admin'},{'role':_0xa537('0x18')}]}});}exports[_0xa537('0x19')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 7edbdbe..618623a 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 _0x6931=['CAST(','field','\x20AS\x20','castTo','$ne','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','$notIn','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','replace','[$and]','[$or]','length','split','forEach','shift','match','filter','indexOf','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','add','days','format','text'];(function(_0x36f560,_0x72b2c3){var _0x501598=function(_0x5dfb3f){while(--_0x5dfb3f){_0x36f560['push'](_0x36f560['shift']());}};_0x501598(++_0x72b2c3);}(_0x6931,0x1b3));var _0x1693=function(_0x29b8d4,_0x519ec1){_0x29b8d4=_0x29b8d4-0x0;var _0x5333f9=_0x6931[_0x29b8d4];return _0x5333f9;};'use strict';var _=require(_0x1693('0x0'));var moment=require(_0x1693('0x1'));exports[_0x1693('0x2')]=function(_0x432595){var _0x463c0e={'conditions':[]};_0x463c0e[_0x1693('0x3')]=_['startsWith'](_0x432595,'[$or]')?'or':'and';var _0x1c309b=_0x432595[_0x1693('0x4')](_0x1693('0x5'),'')[_0x1693('0x4')](_0x1693('0x6'),'')['split']('||');for(var _0x1d8748=0x0;_0x1d8748<_0x1c309b[_0x1693('0x7')];_0x1d8748++){var _0x4a3286=_0x1c309b[_0x1d8748][_0x1693('0x8')](':=');var _0x1b1248=_0x4a3286[0x0];var _0x2ec296=_0x4a3286['slice'](0x1);_0x2ec296[_0x1693('0x9')](function(_0x3b56d7){var _0x44744b=_0x3b56d7[_0x1693('0x8')]('[')[_0x1693('0xa')]();var _0x33e401=_0x3b56d7[_0x1693('0xb')](/\[(.*?)\]/g);_0x33e401[_0x1693('0x9')](function(_0x4854aa){var _0x8699f2=_0x4854aa[_0x1693('0x8')]('[')[_0x1693('0xc')](function(_0x4251be){return _0x4251be[_0x1693('0xd')](']')>-0x1;})['map'](function(_0xff810e){return _0xff810e['split'](']')[0x0];})[0x0];_0x463c0e[_0x1693('0xe')][_0x1693('0xf')]({'field':_0x1b1248,'operator':_0x44744b,'value':_0x8699f2});});});}return _0x463c0e;};exports[_0x1693('0x10')]=function(_0xd59b0d,_0x2c640c,_0x1e5946){var _0x11d67d={};if(_0x2c640c===_0x1693('0x11')){if(_0x1e5946[_0x1693('0x12')]===_0x1693('0x13')){_0x1e5946[_0x1693('0x12')]=_0x1693('0x14');_0x1e5946['value']+=','+_0x1e5946[_0x1693('0x15')];}else if(_[_0x1693('0x16')]([_0x1693('0x17'),_0x1693('0x18')],_0x1e5946[_0x1693('0x12')])){_0x1e5946[_0x1693('0x15')]=moment(_0x1e5946['value'])[_0x1693('0x19')](0x1,_0x1693('0x1a'))[_0x1693('0x1b')]('YYYY-MM-DD');}}if(_0x1e5946['castTo']){_0x2c640c=_0x1e5946['castTo'];_0x11d67d[_0x1693('0x1c')]=_0x1693('0x1d')+_0xd59b0d+'.'+_0x1e5946[_0x1693('0x1e')]+_0x1693('0x1f')+_0x1e5946[_0x1693('0x20')]+')\x20'+parseOperator(_0x1e5946[_0x1693('0x12')]);}else{_0x11d67d[_0x1693('0x1c')]=_0xd59b0d+'.'+_0x1e5946['field']+'\x20'+parseOperator(_0x1e5946[_0x1693('0x12')]);}if(_['includes']([_0x1693('0x21'),'$notIn'],_0x1e5946[_0x1693('0x12')]))_0x11d67d[_0x1693('0x1c')]='('+_0x11d67d[_0x1693('0x1c')]+_0x1693('0x22')+_0xd59b0d+'.'+_0x1e5946[_0x1693('0x1e')]+_0x1693('0x23');_0x11d67d['value']=parseValue(_0x2c640c,_0x1e5946[_0x1693('0x12')],_0x1e5946[_0x1693('0x15')]);return _0x11d67d;};function parseOperator(_0x3b2758){var _0x3d09af;switch(_0x3b2758){case _0x1693('0x24'):_0x3d09af=_0x1693('0x25');break;case _0x1693('0x26'):_0x3d09af='NOT\x20IN\x20?';break;case'$eq':_0x3d09af=_0x1693('0x27');break;case'$ne':_0x3d09af=_0x1693('0x28');break;case _0x1693('0x29'):case _0x1693('0x2a'):case _0x1693('0x2b'):_0x3d09af=_0x1693('0x2c');break;case _0x1693('0x2d'):_0x3d09af=_0x1693('0x2e');break;case _0x1693('0x17'):_0x3d09af=_0x1693('0x2f');break;case _0x1693('0x18'):_0x3d09af=_0x1693('0x30');break;case _0x1693('0x31'):_0x3d09af=_0x1693('0x32');break;case'$between':_0x3d09af=_0x1693('0x33');break;}return _0x3d09af;}function parseValue(_0x2ae5e0,_0x14a5d8,_0x1ed857){var _0x3f5dd8={'start':undefined,'end':undefined};switch(_0x14a5d8){case _0x1693('0x24'):case'$notIn':_0x3f5dd8[_0x1693('0x34')]=_0x1ed857[_0x1693('0x8')](',');break;case _0x1693('0x29'):_0x3f5dd8[_0x1693('0x34')]='%'+_0x1ed857+'%';break;case _0x1693('0x2a'):_0x3f5dd8[_0x1693('0x34')]=_0x1ed857+'%';break;case _0x1693('0x2b'):_0x3f5dd8[_0x1693('0x34')]='%'+_0x1ed857;break;case'$between':var _0x55df83=_0x1ed857[_0x1693('0x8')](',');var _0x1ed857=_0x55df83[_0x1693('0xa')]();var _0x2d7057=_0x55df83[_0x1693('0x35')]();if(_0x2ae5e0===_0x1693('0x11')){_0x1ed857=moment(_0x1ed857)[_0x1693('0x36')](0x0,!![])[_0x1693('0x1b')]();_0x2d7057=moment(_0x2d7057)[_0x1693('0x36')](0x0,!![])[_0x1693('0x19')](0x17,_0x1693('0x37'))[_0x1693('0x19')](0x3b,_0x1693('0x38'))[_0x1693('0x19')](0x3b,_0x1693('0x39'))[_0x1693('0x1b')]();}_0x3f5dd8={'start':_0x1ed857,'end':_0x2d7057};break;default:_0x3f5dd8[_0x1693('0x34')]=_0x1ed857;break;}return _0x3f5dd8;} \ No newline at end of file +var _0x2255=['LIKE\x20?','<\x20?','>\x20?','$lte','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','hours','minutes','seconds','lodash','moment','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','forEach','shift','match','filter','indexOf','map','buildExpression','DATE','operator','$eq','$between','value','$gt','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','includes','\x20OR\x20','\x20IS\x20NULL)','$in','$notIn','NOT\x20IN\x20?','=\x20?','$ne','$substring','$startsWith','$endsWith'];(function(_0x115b95,_0xa1f8b9){var _0x460b3d=function(_0x510c02){while(--_0x510c02){_0x115b95['push'](_0x115b95['shift']());}};_0x460b3d(++_0xa1f8b9);}(_0x2255,0x121));var _0x5225=function(_0x260e2f,_0xf3321e){_0x260e2f=_0x260e2f-0x0;var _0x568330=_0x2255[_0x260e2f];return _0x568330;};'use strict';var _=require(_0x5225('0x0'));var moment=require(_0x5225('0x1'));exports['parseSearch']=function(_0x573c76){var _0x59fe18={'conditions':[]};_0x59fe18[_0x5225('0x2')]=_[_0x5225('0x3')](_0x573c76,_0x5225('0x4'))?'or':_0x5225('0x5');var _0x3fe16e=_0x573c76[_0x5225('0x6')](_0x5225('0x7'),'')[_0x5225('0x6')](_0x5225('0x4'),'')[_0x5225('0x8')]('||');for(var _0x55fe3f=0x0;_0x55fe3f<_0x3fe16e['length'];_0x55fe3f++){var _0x3b57fb=_0x3fe16e[_0x55fe3f][_0x5225('0x8')](':=');var _0x49b971=_0x3b57fb[0x0];var _0x46c635=_0x3b57fb['slice'](0x1);_0x46c635[_0x5225('0x9')](function(_0x50ac8c){var _0x62b3e2=_0x50ac8c[_0x5225('0x8')]('[')[_0x5225('0xa')]();var _0x2f499f=_0x50ac8c[_0x5225('0xb')](/\[(.*?)\]/g);_0x2f499f[_0x5225('0x9')](function(_0x4c953f){var _0x47feed=_0x4c953f['split']('[')[_0x5225('0xc')](function(_0x1605a8){return _0x1605a8[_0x5225('0xd')](']')>-0x1;})[_0x5225('0xe')](function(_0x437d31){return _0x437d31[_0x5225('0x8')](']')[0x0];})[0x0];_0x59fe18['conditions']['push']({'field':_0x49b971,'operator':_0x62b3e2,'value':_0x47feed});});});}return _0x59fe18;};exports[_0x5225('0xf')]=function(_0x4841db,_0x3e3a60,_0x285e98){var _0x426b23={};if(_0x3e3a60===_0x5225('0x10')){if(_0x285e98[_0x5225('0x11')]===_0x5225('0x12')){_0x285e98[_0x5225('0x11')]=_0x5225('0x13');_0x285e98[_0x5225('0x14')]+=','+_0x285e98['value'];}else if(_['includes']([_0x5225('0x15'),'$lte'],_0x285e98['operator'])){_0x285e98[_0x5225('0x14')]=moment(_0x285e98[_0x5225('0x14')])[_0x5225('0x16')](0x1,_0x5225('0x17'))[_0x5225('0x18')](_0x5225('0x19'));}}if(_0x285e98[_0x5225('0x1a')]){_0x3e3a60=_0x285e98['castTo'];_0x426b23[_0x5225('0x1b')]=_0x5225('0x1c')+_0x4841db+'.'+_0x285e98[_0x5225('0x1d')]+'\x20AS\x20'+_0x285e98[_0x5225('0x1a')]+')\x20'+parseOperator(_0x285e98[_0x5225('0x11')]);}else{_0x426b23[_0x5225('0x1b')]=_0x4841db+'.'+_0x285e98['field']+'\x20'+parseOperator(_0x285e98[_0x5225('0x11')]);}if(_[_0x5225('0x1e')](['$ne','$notIn'],_0x285e98[_0x5225('0x11')]))_0x426b23['text']='('+_0x426b23['text']+_0x5225('0x1f')+_0x4841db+'.'+_0x285e98[_0x5225('0x1d')]+_0x5225('0x20');_0x426b23[_0x5225('0x14')]=parseValue(_0x3e3a60,_0x285e98[_0x5225('0x11')],_0x285e98[_0x5225('0x14')]);return _0x426b23;};function parseOperator(_0x47dacd){var _0x7aab0b;switch(_0x47dacd){case _0x5225('0x21'):_0x7aab0b='IN\x20?';break;case _0x5225('0x22'):_0x7aab0b=_0x5225('0x23');break;case'$eq':_0x7aab0b=_0x5225('0x24');break;case _0x5225('0x25'):_0x7aab0b='<>\x20?';break;case _0x5225('0x26'):case _0x5225('0x27'):case _0x5225('0x28'):_0x7aab0b=_0x5225('0x29');break;case'$lt':_0x7aab0b=_0x5225('0x2a');break;case'$gt':_0x7aab0b=_0x5225('0x2b');break;case _0x5225('0x2c'):_0x7aab0b=_0x5225('0x2d');break;case _0x5225('0x2e'):_0x7aab0b=_0x5225('0x2f');break;case _0x5225('0x13'):_0x7aab0b=_0x5225('0x30');break;}return _0x7aab0b;}function parseValue(_0x353691,_0x547166,_0x5a739e){var _0xc631b7={'start':undefined,'end':undefined};switch(_0x547166){case _0x5225('0x21'):case'$notIn':_0xc631b7[_0x5225('0x31')]=_0x5a739e['split'](',');break;case _0x5225('0x26'):_0xc631b7[_0x5225('0x31')]='%'+_0x5a739e+'%';break;case'$startsWith':_0xc631b7[_0x5225('0x31')]=_0x5a739e+'%';break;case _0x5225('0x28'):_0xc631b7[_0x5225('0x31')]='%'+_0x5a739e;break;case _0x5225('0x13'):var _0x1f7e30=_0x5a739e[_0x5225('0x8')](',');var _0x5a739e=_0x1f7e30[_0x5225('0xa')]();var _0x51c9a9=_0x1f7e30[_0x5225('0x32')]();if(_0x353691===_0x5225('0x10')){_0x5a739e=moment(_0x5a739e)[_0x5225('0x33')](0x0,!![])['format']();_0x51c9a9=moment(_0x51c9a9)['utcOffset'](0x0,!![])[_0x5225('0x16')](0x17,_0x5225('0x34'))[_0x5225('0x16')](0x3b,_0x5225('0x35'))[_0x5225('0x16')](0x3b,_0x5225('0x36'))['format']();}_0xc631b7={'start':_0x5a739e,'end':_0x51c9a9};break;default:_0xc631b7[_0x5225('0x31')]=_0x5a739e;break;}return _0xc631b7;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 1582359..b989c0c 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 _0x6d5f=['forEach','replace','push','join','getOptions','query','$id','model','attributes','intersection','order','sort','where','pick','filter','object','value','VIRTUAL','lower','merge','options','sequelize','moment','parse','keys','includes','fields','split','filters','isEmpty','forOwn','find','type','$gte','YYYY-MM-DD','utc','format','subtract','name','uniqueid','isArray','limit','offset','map','indexOf','cast','priority','unsigned','DESC','col','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','^[+]?[0-9]*$','isEmail','match','getFullTextValue'];(function(_0x55f837,_0x3927f7){var _0x1a3a97=function(_0x192b2f){while(--_0x192b2f){_0x55f837['push'](_0x55f837['shift']());}};_0x1a3a97(++_0x3927f7);}(_0x6d5f,0xcf));var _0xf6d5=function(_0x2b2560,_0x578291){_0x2b2560=_0x2b2560-0x0;var _0xf198a0=_0x6d5f[_0x2b2560];return _0xf198a0;};'use strict';var _=require('lodash');var sequelize=require(_0xf6d5('0x0'));var moment=require(_0xf6d5('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x3d7e32){var _0x4eeb63=['ne'];try{var _0x29c1bf=JSON[_0xf6d5('0x2')](_0x3d7e32);var _0x4485a2=Object[_0xf6d5('0x3')](_0x29c1bf)[0x0];return _0x4eeb63[_0xf6d5('0x4')](_0x4485a2);}catch(_0x11c81c){return![];}}function getOperatorValue(_0x590314){var _0x153846=JSON['parse'](_0x590314);var _0x1b40ec=Object[_0xf6d5('0x3')](_0x153846)[0x0];var _0x550066=_0x153846[_0x1b40ec];return{['$'+_0x1b40ec]:_0x550066};}exports[_0xf6d5('0x5')]=function(_0x3b1dfb){var _0x73b28f=null;if(_0x3b1dfb){_0x73b28f=_0x3b1dfb[_0xf6d5('0x6')](',');}return _0x73b28f;};exports[_0xf6d5('0x7')]=function(_0x5a5c4e,_0x2ae062){var _0x148d4a={};if(!_[_0xf6d5('0x8')](_0x5a5c4e)){_[_0xf6d5('0x9')](_0x5a5c4e,function(_0x29e9a0,_0x3117db){try{if(_0x2ae062){var _0x83afce=_[_0xf6d5('0xa')](_0x2ae062,{'name':_0x3117db})||{};if(hasSequelizeOperator(_0x29e9a0)){_0x148d4a[_0x3117db]=getOperatorValue(_0x29e9a0);}else if(_0x83afce[_0xf6d5('0xb')]==='DATE'&&_['isPlainObject'](_0x29e9a0)){var _0x1f1ea5=JSON['parse'](_0x29e9a0);var _0x2fc26a={'$gte':moment(moment(_0x1f1ea5[_0xf6d5('0xc')])['format'](_0xf6d5('0xd')))[_0xf6d5('0xe')]()['format'](),'$lte':moment(moment(_0x1f1ea5['$lte'])[_0xf6d5('0xf')]('YYYY-MM-DD'))[_0xf6d5('0xe')]()[_0xf6d5('0x10')](0x1,'s')[_0xf6d5('0xf')]()};_0x148d4a[_0x3117db]=_0x2fc26a;}else if(_0x83afce[_0xf6d5('0x11')]===_0xf6d5('0x12')){_0x148d4a[_0x3117db]=_0x29e9a0;}else{_0x148d4a[_0x3117db]=_[_0xf6d5('0x13')](_0x29e9a0)?_0x29e9a0:JSON[_0xf6d5('0x2')](_0x29e9a0);}}else{_0x148d4a[_0x3117db]=_[_0xf6d5('0x13')](_0x29e9a0)?_0x29e9a0:JSON[_0xf6d5('0x2')](_0x29e9a0);}}catch(_0x50dc81){_0x148d4a[_0x3117db]=_0x29e9a0[_0xf6d5('0x6')](',');}});}return _0x148d4a;};exports[_0xf6d5('0x14')]=function(_0x3ac2ca){_0x3ac2ca=parseInt(_0x3ac2ca,0xa);if(!_0x3ac2ca||_0x3ac2ca<0x0){_0x3ac2ca=LIMIT_VALUE;}return _0x3ac2ca;};exports[_0xf6d5('0x15')]=function(_0x252631){_0x252631=parseInt(_0x252631,0xa);if(!_0x252631||_0x252631<0x0){_0x252631=0x0;}return _0x252631;};exports['sort']=function(_0x33a114){var _0x58092a,_0x18b330=null;if(_0x33a114){_0x58092a=_0x33a114[_0xf6d5('0x6')](',');_0x18b330=_[_0xf6d5('0x16')](_0x58092a,function(_0x4c877f){if(_0x4c877f[_0xf6d5('0x17')]('-')===0x0){return[_0x4c877f==='priority'?sequelize[_0xf6d5('0x18')](sequelize['col'](_0xf6d5('0x19')),_0xf6d5('0x1a')):_0x4c877f['substr'](0x1),_0xf6d5('0x1b')];}else{return[_0x4c877f==='priority'?sequelize[_0xf6d5('0x18')](sequelize[_0xf6d5('0x1c')]('priority'),_0xf6d5('0x1a')):_0x4c877f,_0xf6d5('0x1d')];}});}return _0x18b330;};exports[_0xf6d5('0x1e')]=function(_0x4d58a0,_0x5ca15b){if(_[_0xf6d5('0x8')](_0x4d58a0)){return _0x4d58a0;}if(_[_0xf6d5('0x13')](_0x4d58a0)){for(var _0x2b1c88=0x0;_0x2b1c88<_0x4d58a0[_0xf6d5('0x1f')];_0x2b1c88+=0x1){_0x4d58a0[_0x2b1c88]=this[_0xf6d5('0x1e')](_0x4d58a0[_0x2b1c88],_0x5ca15b);}return _0x4d58a0;}if(!_[_0xf6d5('0x20')](_0x4d58a0)){return _0x4d58a0;}if(_[_0xf6d5('0x21')](_0x5ca15b)){_0x5ca15b=[_0x5ca15b];}if(!_[_0xf6d5('0x13')](_0x5ca15b)){return _0x4d58a0;}for(var _0x1958dd=0x0;_0x1958dd<_0x5ca15b[_0xf6d5('0x1f')];_0x1958dd+=0x1){_[_0xf6d5('0x22')](_0x4d58a0,_0x5ca15b[_0x1958dd]);}for(var _0x1d95d in _0x4d58a0){if(_0x4d58a0[_0xf6d5('0x23')](_0x1d95d)){_0x4d58a0[_0x1d95d]=this[_0xf6d5('0x1e')](_0x4d58a0[_0x1d95d],_0x5ca15b);}}return _0x4d58a0;};exports[_0xf6d5('0x24')]=function(_0x3b68b4){return _0x3b68b4['match'](RegExp(_0xf6d5('0x25')))?!![]:![];};exports[_0xf6d5('0x26')]=function(_0x32c48a){return _0x32c48a[_0xf6d5('0x27')](/^\S+@\S+$/)?!![]:![];};exports[_0xf6d5('0x28')]=function(_0x8e6075){var _0x37597d=[];_0x8e6075[_0xf6d5('0x6')](/[ ,]+/)[_0xf6d5('0x29')](function(_0x42dbab){_0x42dbab=_0x42dbab[_0xf6d5('0x2a')](/([^:]")"+/g,'$1');_0x42dbab='+'+_0x42dbab+'*';if(_0x42dbab['includes']('@'))_0x42dbab='\x22'+_0x42dbab+'\x22';_0x37597d[_0xf6d5('0x2b')](_0x42dbab);});return _0x37597d[_0xf6d5('0x2c')]('\x20');};exports[_0xf6d5('0x2d')]=function(_0x37a770,_0x53f328,_0x41ac1e){var _0x35c787={},_0x4d95a2={};if(_0x53f328[_0xf6d5('0x2e')][_0xf6d5('0x2f')]){_0x53f328[_0xf6d5('0x2e')]['id']=_0x53f328[_0xf6d5('0x2e')]['$id'];delete _0x53f328[_0xf6d5('0x2e')][_0xf6d5('0x2f')];}_0x35c787[_0xf6d5('0x30')]=_[_0xf6d5('0x16')](_0x37a770,'name');_0x35c787[_0xf6d5('0x2e')]=_[_0xf6d5('0x3')](_0x53f328['query']);_0x35c787[_0xf6d5('0x7')]=_['intersection'](_0x35c787['model'],_0x35c787[_0xf6d5('0x2e')]);_0x4d95a2[_0xf6d5('0x31')]=_[_0xf6d5('0x32')](_0x35c787[_0xf6d5('0x30')],this[_0xf6d5('0x5')](_0x53f328[_0xf6d5('0x2e')][_0xf6d5('0x5')]));_0x4d95a2['attributes']=_0x4d95a2[_0xf6d5('0x31')][_0xf6d5('0x1f')]?_0x4d95a2[_0xf6d5('0x31')]:_0x35c787[_0xf6d5('0x30')];if(!_0x53f328[_0xf6d5('0x2e')][_0xf6d5('0x23')]('nolimit')){_0x4d95a2['limit']=this[_0xf6d5('0x14')](_0x53f328[_0xf6d5('0x2e')]['limit']);_0x4d95a2[_0xf6d5('0x15')]=this[_0xf6d5('0x15')](_0x53f328['query'][_0xf6d5('0x15')]);}_0x4d95a2[_0xf6d5('0x33')]=this['sort'](_0x53f328[_0xf6d5('0x2e')][_0xf6d5('0x34')]);_0x4d95a2[_0xf6d5('0x35')]=this[_0xf6d5('0x7')](_[_0xf6d5('0x36')](_0x53f328[_0xf6d5('0x2e')],_0x35c787[_0xf6d5('0x7')]),_0x37a770);if(_0x53f328['query'][_0xf6d5('0x37')]){var _0x197eaf=_0x37a770;var _0x3dd1b0=_0x53f328[_0xf6d5('0x2e')][_0xf6d5('0x37')];if(typeof _0x3dd1b0===_0xf6d5('0x38')){_0x197eaf=_['filter'](_0x37a770,function(_0x377c7c){return _[_0xf6d5('0x4')](_0x3dd1b0['columns'],_0x377c7c['name']);});_0x3dd1b0=_0x3dd1b0[_0xf6d5('0x39')];}_0x4d95a2['where']=_['merge'](_0x4d95a2[_0xf6d5('0x35')],{'$or':_[_0xf6d5('0x16')](_0x197eaf,function(_0x3112de){if(_0x3112de[_0xf6d5('0xb')]!==_0xf6d5('0x3a')){if(_0x41ac1e){return sequelize[_0xf6d5('0x35')](sequelize['fn'](_0xf6d5('0x3b'),sequelize['col'](_0x3112de[_0xf6d5('0x11')])),{'$like':sequelize['fn'](_0xf6d5('0x3b'),'%'+_0x53f328[_0xf6d5('0x2e')][_0xf6d5('0x37')]+'%')});}else{var _0x282310={};_0x282310[_0x3112de['name']]={'$like':'%'+_0x53f328['query'][_0xf6d5('0x37')]+'%'};return _0x282310;}}})});}_0x4d95a2=_[_0xf6d5('0x3c')]({},_0x4d95a2,_0x53f328[_0xf6d5('0x3d')]);return _0x4d95a2;}; \ No newline at end of file +var _0x855a=['type','DATE','isPlainObject','$gte','format','utc','subtract','name','uniqueid','isArray','offset','sort','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','isEmail','getFullTextValue','forEach','replace','push','query','$id','intersection','model','attributes','fields','nolimit','limit','where','pick','filter','object','columns','value','merge','map','VIRTUAL','lower','sequelize','includes','parse','keys','split','filters','isEmpty','forOwn','find'];(function(_0x13c2eb,_0x3ec240){var _0x3b8845=function(_0x2ee861){while(--_0x2ee861){_0x13c2eb['push'](_0x13c2eb['shift']());}};_0x3b8845(++_0x3ec240);}(_0x855a,0x6f));var _0xa855=function(_0x17406e,_0x1049fd){_0x17406e=_0x17406e-0x0;var _0x2bfc5a=_0x855a[_0x17406e];return _0x2bfc5a;};'use strict';var _=require('lodash');var sequelize=require(_0xa855('0x0'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0xece8db){var _0x2ae28b=['ne'];try{var _0xa1a5a7=JSON['parse'](_0xece8db);var _0x513fdf=Object['keys'](_0xa1a5a7)[0x0];return _0x2ae28b[_0xa855('0x1')](_0x513fdf);}catch(_0x373344){return![];}}function getOperatorValue(_0x523a90){var _0x54b354=JSON[_0xa855('0x2')](_0x523a90);var _0x2bb2c9=Object[_0xa855('0x3')](_0x54b354)[0x0];var _0x24d243=_0x54b354[_0x2bb2c9];return{['$'+_0x2bb2c9]:_0x24d243};}exports['fields']=function(_0x1775fb){var _0x4e9b27=null;if(_0x1775fb){_0x4e9b27=_0x1775fb[_0xa855('0x4')](',');}return _0x4e9b27;};exports[_0xa855('0x5')]=function(_0x38b09f,_0x3f77e3){var _0x67f08={};if(!_[_0xa855('0x6')](_0x38b09f)){_[_0xa855('0x7')](_0x38b09f,function(_0x2bbd31,_0x4c684f){try{if(_0x3f77e3){var _0x1df018=_[_0xa855('0x8')](_0x3f77e3,{'name':_0x4c684f})||{};if(hasSequelizeOperator(_0x2bbd31)){_0x67f08[_0x4c684f]=getOperatorValue(_0x2bbd31);}else if(_0x1df018[_0xa855('0x9')]===_0xa855('0xa')&&_[_0xa855('0xb')](_0x2bbd31)){var _0xdd7dff=JSON[_0xa855('0x2')](_0x2bbd31);var _0x4f3910={'$gte':moment(moment(_0xdd7dff[_0xa855('0xc')])[_0xa855('0xd')]('YYYY-MM-DD'))[_0xa855('0xe')]()[_0xa855('0xd')](),'$lte':moment(moment(_0xdd7dff['$lte'])['format']('YYYY-MM-DD'))[_0xa855('0xe')]()[_0xa855('0xf')](0x1,'s')[_0xa855('0xd')]()};_0x67f08[_0x4c684f]=_0x4f3910;}else if(_0x1df018[_0xa855('0x10')]===_0xa855('0x11')){_0x67f08[_0x4c684f]=_0x2bbd31;}else{_0x67f08[_0x4c684f]=_[_0xa855('0x12')](_0x2bbd31)?_0x2bbd31:JSON[_0xa855('0x2')](_0x2bbd31);}}else{_0x67f08[_0x4c684f]=_[_0xa855('0x12')](_0x2bbd31)?_0x2bbd31:JSON[_0xa855('0x2')](_0x2bbd31);}}catch(_0x5cb1a4){_0x67f08[_0x4c684f]=_0x2bbd31[_0xa855('0x4')](',');}});}return _0x67f08;};exports['limit']=function(_0x5952ed){_0x5952ed=parseInt(_0x5952ed,0xa);if(!_0x5952ed||_0x5952ed<0x0){_0x5952ed=LIMIT_VALUE;}return _0x5952ed;};exports[_0xa855('0x13')]=function(_0x525d0e){_0x525d0e=parseInt(_0x525d0e,0xa);if(!_0x525d0e||_0x525d0e<0x0){_0x525d0e=0x0;}return _0x525d0e;};exports[_0xa855('0x14')]=function(_0x4ea7a8){var _0x32401c,_0x1eb045=null;if(_0x4ea7a8){_0x32401c=_0x4ea7a8[_0xa855('0x4')](',');_0x1eb045=_['map'](_0x32401c,function(_0x20f68d){if(_0x20f68d[_0xa855('0x15')]('-')===0x0){return[_0x20f68d===_0xa855('0x16')?sequelize[_0xa855('0x17')](sequelize[_0xa855('0x18')](_0xa855('0x16')),_0xa855('0x19')):_0x20f68d[_0xa855('0x1a')](0x1),_0xa855('0x1b')];}else{return[_0x20f68d===_0xa855('0x16')?sequelize[_0xa855('0x17')](sequelize[_0xa855('0x18')](_0xa855('0x16')),_0xa855('0x19')):_0x20f68d,_0xa855('0x1c')];}});}return _0x1eb045;};exports[_0xa855('0x1d')]=function(_0x4ddf25,_0x24efb3){if(_[_0xa855('0x6')](_0x4ddf25)){return _0x4ddf25;}if(_[_0xa855('0x12')](_0x4ddf25)){for(var _0x20e41b=0x0;_0x20e41b<_0x4ddf25[_0xa855('0x1e')];_0x20e41b+=0x1){_0x4ddf25[_0x20e41b]=this[_0xa855('0x1d')](_0x4ddf25[_0x20e41b],_0x24efb3);}return _0x4ddf25;}if(!_[_0xa855('0x1f')](_0x4ddf25)){return _0x4ddf25;}if(_[_0xa855('0x20')](_0x24efb3)){_0x24efb3=[_0x24efb3];}if(!_[_0xa855('0x12')](_0x24efb3)){return _0x4ddf25;}for(var _0x390d66=0x0;_0x390d66<_0x24efb3[_0xa855('0x1e')];_0x390d66+=0x1){_[_0xa855('0x21')](_0x4ddf25,_0x24efb3[_0x390d66]);}for(var _0x6768f5 in _0x4ddf25){if(_0x4ddf25[_0xa855('0x22')](_0x6768f5)){_0x4ddf25[_0x6768f5]=this['omit'](_0x4ddf25[_0x6768f5],_0x24efb3);}}return _0x4ddf25;};exports[_0xa855('0x23')]=function(_0x1f8171){return _0x1f8171[_0xa855('0x24')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0xa855('0x25')]=function(_0x3a7c6e){return _0x3a7c6e[_0xa855('0x24')](/^\S+@\S+$/)?!![]:![];};exports[_0xa855('0x26')]=function(_0x5214d8){var _0x523769=[];_0x5214d8[_0xa855('0x4')](/[ ,]+/)[_0xa855('0x27')](function(_0x5c1b5b){_0x5c1b5b=_0x5c1b5b[_0xa855('0x28')](/([^:]")"+/g,'$1');_0x5c1b5b='+'+_0x5c1b5b+'*';if(_0x5c1b5b[_0xa855('0x1')]('@'))_0x5c1b5b='\x22'+_0x5c1b5b+'\x22';_0x523769[_0xa855('0x29')](_0x5c1b5b);});return _0x523769['join']('\x20');};exports['getOptions']=function(_0x53b8a2,_0x2d796d,_0x957866){var _0x462cc5={},_0x3d88eb={};if(_0x2d796d[_0xa855('0x2a')]['$id']){_0x2d796d['query']['id']=_0x2d796d['query'][_0xa855('0x2b')];delete _0x2d796d[_0xa855('0x2a')][_0xa855('0x2b')];}_0x462cc5['model']=_['map'](_0x53b8a2,_0xa855('0x10'));_0x462cc5[_0xa855('0x2a')]=_[_0xa855('0x3')](_0x2d796d[_0xa855('0x2a')]);_0x462cc5[_0xa855('0x5')]=_[_0xa855('0x2c')](_0x462cc5[_0xa855('0x2d')],_0x462cc5['query']);_0x3d88eb[_0xa855('0x2e')]=_[_0xa855('0x2c')](_0x462cc5[_0xa855('0x2d')],this[_0xa855('0x2f')](_0x2d796d[_0xa855('0x2a')][_0xa855('0x2f')]));_0x3d88eb[_0xa855('0x2e')]=_0x3d88eb[_0xa855('0x2e')]['length']?_0x3d88eb[_0xa855('0x2e')]:_0x462cc5[_0xa855('0x2d')];if(!_0x2d796d[_0xa855('0x2a')][_0xa855('0x22')](_0xa855('0x30'))){_0x3d88eb['limit']=this['limit'](_0x2d796d['query'][_0xa855('0x31')]);_0x3d88eb[_0xa855('0x13')]=this[_0xa855('0x13')](_0x2d796d[_0xa855('0x2a')][_0xa855('0x13')]);}_0x3d88eb['order']=this['sort'](_0x2d796d[_0xa855('0x2a')][_0xa855('0x14')]);_0x3d88eb[_0xa855('0x32')]=this[_0xa855('0x5')](_[_0xa855('0x33')](_0x2d796d[_0xa855('0x2a')],_0x462cc5['filters']),_0x53b8a2);if(_0x2d796d['query'][_0xa855('0x34')]){var _0x340f57=_0x53b8a2;var _0x590cf5=_0x2d796d['query']['filter'];if(typeof _0x590cf5===_0xa855('0x35')){_0x340f57=_[_0xa855('0x34')](_0x53b8a2,function(_0x67325){return _[_0xa855('0x1')](_0x590cf5[_0xa855('0x36')],_0x67325['name']);});_0x590cf5=_0x590cf5[_0xa855('0x37')];}_0x3d88eb[_0xa855('0x32')]=_[_0xa855('0x38')](_0x3d88eb[_0xa855('0x32')],{'$or':_[_0xa855('0x39')](_0x340f57,function(_0x276912){if(_0x276912[_0xa855('0x9')]!==_0xa855('0x3a')){if(_0x957866){return sequelize[_0xa855('0x32')](sequelize['fn'](_0xa855('0x3b'),sequelize[_0xa855('0x18')](_0x276912[_0xa855('0x10')])),{'$like':sequelize['fn']('lower','%'+_0x2d796d[_0xa855('0x2a')][_0xa855('0x34')]+'%')});}else{var _0x3042e1={};_0x3042e1[_0x276912[_0xa855('0x10')]]={'$like':'%'+_0x2d796d['query']['filter']+'%'};return _0x3042e1;}}})});}_0x3d88eb=_['merge']({},_0x3d88eb,_0x2d796d['options']);return _0x3d88eb;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index f42a62a..b101e41 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1393=['/server/views','engine','html','ejs','view\x20engine','urlencoded','initialize','serve-favicon','body-parser','errorhandler','path','passport','cors','moment','./environment','../mysqldb','default','get','set','appPath','root','join','client','toISOString','split','use'];(function(_0x1c8428,_0x5058db){var _0x419030=function(_0x3654c){while(--_0x3654c){_0x1c8428['push'](_0x1c8428['shift']());}};_0x419030(++_0x5058db);}(_0x1393,0x18d));var _0x3139=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x1393[_0x21a9d9];return _0x46adce;};'use strict';var express=require('express');var favicon=require(_0x3139('0x0'));var bodyParser=require(_0x3139('0x1'));var methodOverride=require('method-override');var cookieParser=require('cookie-parser');var errorHandler=require(_0x3139('0x2'));var path=require(_0x3139('0x3'));var passport=require(_0x3139('0x4'));var cors=require(_0x3139('0x5'));var moment=require(_0x3139('0x6'));var config=require(_0x3139('0x7'));var db=require(_0x3139('0x8'))['db'];exports[_0x3139('0x9')]=function(_0x382b12){var _0x454c37=_0x382b12[_0x3139('0xa')]('env');if(_0x454c37==='production'){_0x382b12[_0x3139('0xb')](_0x3139('0xc'),path['join'](config[_0x3139('0xd')],'public'));}if(_0x454c37==='development'||_0x454c37==='test'){_0x382b12[_0x3139('0xb')](_0x3139('0xc'),path[_0x3139('0xe')](config['root'],_0x3139('0xf')));_0x382b12['use'](errorHandler());}_0x382b12[_0x3139('0xb')]('json\x20replacer',function(_0x33d810,_0xcb72e4){if(this[_0x33d810]instanceof Date){_0xcb72e4=this[_0x33d810][_0x3139('0x10')]()[_0x3139('0x11')]('.')[0x0]+'Z';}return _0xcb72e4;});_0x382b12[_0x3139('0x12')](express['static'](_0x382b12[_0x3139('0xa')](_0x3139('0xc'))));_0x382b12[_0x3139('0xb')]('views',config[_0x3139('0xd')]+_0x3139('0x13'));_0x382b12[_0x3139('0x14')](_0x3139('0x15'),require(_0x3139('0x16'))['renderFile']);_0x382b12['set'](_0x3139('0x17'),_0x3139('0x15'));_0x382b12[_0x3139('0x12')](bodyParser[_0x3139('0x18')]({'limit':'50mb','extended':!![]}));_0x382b12[_0x3139('0x12')](bodyParser['json']({'limit':'50mb'}));_0x382b12['use'](cors());_0x382b12['use'](methodOverride());_0x382b12[_0x3139('0x12')](cookieParser());_0x382b12['use'](passport[_0x3139('0x19')]());}; \ No newline at end of file +var _0xac5d=['50mb','json','initialize','express','serve-favicon','method-override','cookie-parser','cors','moment','./environment','../mysqldb','default','get','env','root','public','test','appPath','join','client','use','json\x20replacer','split','static','set','/server/views','engine','ejs','renderFile','view\x20engine','html','urlencoded'];(function(_0x5bec42,_0xe1a92a){var _0x4fca51=function(_0x26408d){while(--_0x26408d){_0x5bec42['push'](_0x5bec42['shift']());}};_0x4fca51(++_0xe1a92a);}(_0xac5d,0x163));var _0xdac5=function(_0x22df9f,_0x9ec477){_0x22df9f=_0x22df9f-0x0;var _0x4ed906=_0xac5d[_0x22df9f];return _0x4ed906;};'use strict';var express=require(_0xdac5('0x0'));var favicon=require(_0xdac5('0x1'));var bodyParser=require('body-parser');var methodOverride=require(_0xdac5('0x2'));var cookieParser=require(_0xdac5('0x3'));var errorHandler=require('errorhandler');var path=require('path');var passport=require('passport');var cors=require(_0xdac5('0x4'));var moment=require(_0xdac5('0x5'));var config=require(_0xdac5('0x6'));var db=require(_0xdac5('0x7'))['db'];exports[_0xdac5('0x8')]=function(_0xca0803){var _0x22a3f7=_0xca0803[_0xdac5('0x9')](_0xdac5('0xa'));if(_0x22a3f7==='production'){_0xca0803['set']('appPath',path['join'](config[_0xdac5('0xb')],_0xdac5('0xc')));}if(_0x22a3f7==='development'||_0x22a3f7===_0xdac5('0xd')){_0xca0803['set'](_0xdac5('0xe'),path[_0xdac5('0xf')](config[_0xdac5('0xb')],_0xdac5('0x10')));_0xca0803[_0xdac5('0x11')](errorHandler());}_0xca0803['set'](_0xdac5('0x12'),function(_0x1783f4,_0xa623d2){if(this[_0x1783f4]instanceof Date){_0xa623d2=this[_0x1783f4]['toISOString']()[_0xdac5('0x13')]('.')[0x0]+'Z';}return _0xa623d2;});_0xca0803['use'](express[_0xdac5('0x14')](_0xca0803[_0xdac5('0x9')](_0xdac5('0xe'))));_0xca0803[_0xdac5('0x15')]('views',config[_0xdac5('0xb')]+_0xdac5('0x16'));_0xca0803[_0xdac5('0x17')]('html',require(_0xdac5('0x18'))[_0xdac5('0x19')]);_0xca0803[_0xdac5('0x15')](_0xdac5('0x1a'),_0xdac5('0x1b'));_0xca0803[_0xdac5('0x11')](bodyParser[_0xdac5('0x1c')]({'limit':_0xdac5('0x1d'),'extended':!![]}));_0xca0803[_0xdac5('0x11')](bodyParser[_0xdac5('0x1e')]({'limit':_0xdac5('0x1d')}));_0xca0803[_0xdac5('0x11')](cors());_0xca0803[_0xdac5('0x11')](methodOverride());_0xca0803[_0xdac5('0x11')](cookieParser());_0xca0803[_0xdac5('0x11')](passport[_0xdac5('0x1f')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index d6f1bbb..d219df7 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 _0x6032=['hostname','macAddress','ipAddress','substring','lodash','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','length','filter','family','internal','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','cpus','map','model','join','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','replace'];(function(_0x536bed,_0x17aea5){var _0x58f2cf=function(_0xa25e93){while(--_0xa25e93){_0x536bed['push'](_0x536bed['shift']());}};_0x58f2cf(++_0x17aea5);}(_0x6032,0x12c));var _0x2603=function(_0xf428e2,_0x4d65f8){_0xf428e2=_0xf428e2-0x0;var _0x2001b4=_0x6032[_0xf428e2];return _0x2001b4;};'use strict';var _=require(_0x2603('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x2603('0x1'));var exec=require(_0x2603('0x2'))[_0x2603('0x3')];var config=require(_0x2603('0x4'));function getInterfaces(){var _0x204b66=[];var _0x503784=os[_0x2603('0x5')]();var _0x48ef0d=_[_0x2603('0x6')](_['keys'](_0x503784));for(var _0x13a760=0x0;_0x13a760<_0x48ef0d[_0x2603('0x7')];_0x13a760++){var _0x29af6a=_0x503784[_0x48ef0d[_0x13a760]][_0x2603('0x8')](function(_0x36ab25){return _0x36ab25[_0x2603('0x9')]==='IPv4'&&_0x36ab25[_0x2603('0xa')]===![];});_0x204b66=_0x204b66[_0x2603('0xb')](_0x29af6a);}return _0x204b66;}function getFirstInterface(){var _0x1bd681=_[_0x2603('0xc')](getInterfaces());return{'macAddress':_0x1bd681&&_0x1bd681[_0x2603('0xd')]?_0x1bd681[_0x2603('0xd')]:_0x2603('0xe'),'ipAddress':_0x1bd681&&_0x1bd681[_0x2603('0xf')]?_0x1bd681[_0x2603('0xf')]:'127.0.0.1'};}exports[_0x2603('0x10')]=getFirstInterface;function getCPUhash(){var _0x516e38=_[_0x2603('0x6')](os[_0x2603('0x11')]()[_0x2603('0x12')](function(_0x454d78){return _0x454d78[_0x2603('0x13')];}))[_0x2603('0x14')](':');return crypto[_0x2603('0x15')](_0x2603('0x16'))[_0x2603('0x17')](_0x516e38)[_0x2603('0x18')](_0x2603('0x19'));}exports[_0x2603('0x1a')]=function(){var _0x4904d4=os[_0x2603('0x1b')]();var _0x5c8a35=/[0-9a-f-]{36}/;if(config[_0x2603('0x1c')]&&_0x5c8a35[_0x2603('0x1d')](config[_0x2603('0x1c')])){return config[_0x2603('0x1c')];}else if(_0x4904d4===_0x2603('0x1e')){return exec(_0x2603('0x1f'),{'encoding':'utf8'})[_0x2603('0x20')]('\x0d\x0a','');}else{var _0x3d0a02=getFirstInterface();var _0x50ccf9=getCPUhash();var _0x23d8a9=_0x50ccf9+'|'+os[_0x2603('0x21')]()+'|'+_0x3d0a02[_0x2603('0x22')]+'|'+_0x3d0a02[_0x2603('0x23')];var _0x426ad5=crypto[_0x2603('0x15')](_0x2603('0x16'))[_0x2603('0x17')](_0x23d8a9)[_0x2603('0x18')](_0x2603('0x19'));return _0x426ad5['substring'](0x0,0x8)+'-'+_0x426ad5['substring'](0x8,0xc)+'-'+_0x426ad5['substring'](0xc,0x10)+'-'+_0x426ad5['substring'](0x10,0x14)+'-'+_0x426ad5[_0x2603('0x24')](0x14);}}; \ No newline at end of file +var _0xdbd8=['00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','model','createHash','md5','update','digest','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','replace','hostname','macAddress','hex','substring','lodash','crypto','child_process','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac'];(function(_0x138836,_0x229129){var _0x322688=function(_0x54b101){while(--_0x54b101){_0x138836['push'](_0x138836['shift']());}};_0x322688(++_0x229129);}(_0xdbd8,0xc4));var _0x8dbd=function(_0x9e4333,_0x3828a7){_0x9e4333=_0x9e4333-0x0;var _0xc426ea=_0xdbd8[_0x9e4333];return _0xc426ea;};'use strict';var _=require(_0x8dbd('0x0'));var os=require('os');var crypto=require(_0x8dbd('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0x8dbd('0x2'))['execSync'];var config=require('../environment');function getInterfaces(){var _0x4f280a=[];var _0x4da5ae=os[_0x8dbd('0x3')]();var _0x125fce=_[_0x8dbd('0x4')](_[_0x8dbd('0x5')](_0x4da5ae));for(var _0x4ca8bd=0x0;_0x4ca8bd<_0x125fce[_0x8dbd('0x6')];_0x4ca8bd++){var _0x301397=_0x4da5ae[_0x125fce[_0x4ca8bd]][_0x8dbd('0x7')](function(_0x3dc101){return _0x3dc101[_0x8dbd('0x8')]===_0x8dbd('0x9')&&_0x3dc101[_0x8dbd('0xa')]===![];});_0x4f280a=_0x4f280a[_0x8dbd('0xb')](_0x301397);}return _0x4f280a;}function getFirstInterface(){var _0x40def0=_[_0x8dbd('0xc')](getInterfaces());return{'macAddress':_0x40def0&&_0x40def0['mac']?_0x40def0[_0x8dbd('0xd')]:_0x8dbd('0xe'),'ipAddress':_0x40def0&&_0x40def0[_0x8dbd('0xf')]?_0x40def0[_0x8dbd('0xf')]:_0x8dbd('0x10')};}exports[_0x8dbd('0x11')]=getFirstInterface;function getCPUhash(){var _0x5d36be=_[_0x8dbd('0x4')](os[_0x8dbd('0x12')]()['map'](function(_0x254314){return _0x254314[_0x8dbd('0x13')];}))['join'](':');return crypto[_0x8dbd('0x14')](_0x8dbd('0x15'))[_0x8dbd('0x16')](_0x5d36be)[_0x8dbd('0x17')]('hex');}exports[_0x8dbd('0x18')]=function(){var _0x4130e5=os[_0x8dbd('0x19')]();var _0x117305=/[0-9a-f-]{36}/;if(config[_0x8dbd('0x1a')]&&_0x117305[_0x8dbd('0x1b')](config[_0x8dbd('0x1a')])){return config[_0x8dbd('0x1a')];}else if(_0x4130e5===_0x8dbd('0x1c')){return exec(_0x8dbd('0x1d'),{'encoding':'utf8'})[_0x8dbd('0x1e')]('\x0d\x0a','');}else{var _0x2355da=getFirstInterface();var _0x39468a=getCPUhash();var _0x702437=_0x39468a+'|'+os[_0x8dbd('0x1f')]()+'|'+_0x2355da[_0x8dbd('0x20')]+'|'+_0x2355da['ipAddress'];var _0x516376=crypto[_0x8dbd('0x14')](_0x8dbd('0x15'))['update'](_0x702437)[_0x8dbd('0x17')](_0x8dbd('0x21'));return _0x516376[_0x8dbd('0x22')](0x0,0x8)+'-'+_0x516376[_0x8dbd('0x22')](0x8,0xc)+'-'+_0x516376[_0x8dbd('0x22')](0xc,0x10)+'-'+_0x516376[_0x8dbd('0x22')](0x10,0x14)+'-'+_0x516376['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 994f34d..7733882 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 _0x151f=['NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','moment','bluebird','version','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','then','catch','data1','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed'];(function(_0x5c722e,_0x83c9bd){var _0x680a07=function(_0xef992a){while(--_0xef992a){_0x5c722e['push'](_0x5c722e['shift']());}};_0x680a07(++_0x83c9bd);}(_0x151f,0xa3));var _0xf151=function(_0x18c8d2,_0x3713ff){_0x18c8d2=_0x18c8d2-0x0;var _0x244f28=_0x151f[_0x18c8d2];return _0x244f28;};'use strict';var util=require(_0xf151('0x0'));var moment=require(_0xf151('0x1'));var rp=require('request-promise');var BPromise=require(_0xf151('0x2'));var pkginfo=require('pkginfo')(module,_0xf151('0x3'));var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xf151('0x4'));var logger=require(_0xf151('0x5'))(_0xf151('0x6'));var HOST=_0xf151('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4aa2e7){return new BPromise(function(_0x45190d,_0x4a1b43){var _0x1e5e80=util[_0xf151('0x8')]('%s/api/servers/%s/check?version=%s',HOST,_0x4aa2e7,module['exports']['version']);if(oldToken){_0x1e5e80=util['format'](_0xf151('0x9'),HOST,_0x4aa2e7,module[_0xf151('0xa')][_0xf151('0x3')],oldToken);}var _0xa408c9={'uri':_0x1e5e80,'method':_0xf151('0xb'),'timeout':0xea60,'json':!![]};return rp(_0xa408c9)[_0xf151('0xc')](function(_0x5a421b){_0x45190d(_0x5a421b);})[_0xf151('0xd')](function(_0x27cce3){_0x4a1b43(_0x27cce3);});});}function manageLicense(_0x42d4e5,_0x192858){var _0x4c6ca0=_0x192858['get']({'plain':!![]});if(!isOldTokenSent&&_0x4c6ca0[_0xf151('0xe')]!==_0x42d4e5&&!_0x4c6ca0[_0xf151('0xf')]){oldToken=_0x4c6ca0['data1'];}httpRequest(_0x42d4e5)['then'](function(_0x33b94f){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x33b94f['active']){isOldTokenSent=![];if(!_0x4c6ca0[_0xf151('0x6')]&&_0x4c6ca0[_0xf151('0x6')]!=_0x33b94f[_0xf151('0x6')]||_0x4c6ca0['license']&&_0x4c6ca0[_0xf151('0xf')]){logger['info'](_0xf151('0x10'));}if(_0x4c6ca0['license']&&!_0x4c6ca0[_0xf151('0xf')]&&_0x4c6ca0[_0xf151('0x6')]!=_0x33b94f[_0xf151('0x6')]){logger[_0xf151('0x11')](_0xf151('0x12'));}if(_0x4c6ca0['license']&&!_0x4c6ca0[_0xf151('0xf')]&&_0x4c6ca0[_0xf151('0x6')]==_0x33b94f['license']){return _0x192858;}return _0x192858[_0xf151('0x13')]({'data1':_0x42d4e5,'data2':null,'license':_0x33b94f[_0xf151('0x6')]});}else{if(_0x33b94f[_0xf151('0x6')]||_0x4c6ca0[_0xf151('0x6')]){if(!_0x4c6ca0[_0xf151('0xf')]){if(_0x4c6ca0['data1']==_0x42d4e5){GRAY_PERIOD_REASON='Disabled';logger['info'](_0xf151('0x14'));}else{GRAY_PERIOD_REASON=_0xf151('0x15');logger[_0xf151('0x11')](_0xf151('0x16'),_0x4c6ca0[_0xf151('0xe')],_0x42d4e5);}logger[_0xf151('0x11')](_0xf151('0x17'),GRAY_PERIOD_REASON[_0xf151('0x18')](),moment()[_0xf151('0x8')](_0xf151('0x19')));return _0x192858['update']({'data2':encryptor[_0xf151('0x1a')](moment()[_0xf151('0x8')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0xf151('0x1b')](encryptor['decryptString'](_0x4c6ca0['data2']),_0xf151('0x1c'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()[_0xf151('0x8')](_0xf151('0x19')));isOldTokenSent=![];return _0x192858[_0xf151('0x13')]({'data1':_0x42d4e5,'data2':null,'license':null});}}}else{if(_0x4c6ca0[_0xf151('0xe')]!=_0x42d4e5){logger[_0xf151('0x11')](_0xf151('0x16'),_0x4c6ca0[_0xf151('0xe')],_0x42d4e5);return _0x192858[_0xf151('0x13')]({'data1':_0x42d4e5,'data2':null,'license':null});}}}return _0x192858;})[_0xf151('0xc')](function(_0x3c5ec3){_0x192858=_0x3c5ec3;})[_0xf151('0xd')](function(_0xcda298){logger['error'](_0xcda298['message']);})[_0xf151('0x1d')](function(){setTimeout(function(){manageLicense(hardware[_0xf151('0x1e')](),_0x192858);},TIME);});}function defaultLicense(){var _0x31b165=hardware[_0xf151('0x1e')]();if(_0x31b165){return db[_0xf151('0x1f')][_0xf151('0x20')]({'where':{'id':0x1},'defaults':{'data1':_0x31b165}})[_0xf151('0x21')](function(_0x96451e,_0x288494){logger[_0xf151('0x11')](_0xf151('0x22'),_0x31b165);manageLicense(_0x31b165,_0x96451e);})['catch'](function(_0x5751cc){logger[_0xf151('0x23')](_0x5751cc['message']);});}}exports[_0xf151('0x24')]=defaultLicense; \ No newline at end of file +var _0xb17c=['toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','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','data1','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s'];(function(_0x4ca65f,_0x48906c){var _0x1b193c=function(_0xec2461){while(--_0xec2461){_0x4ca65f['push'](_0x4ca65f['shift']());}};_0x1b193c(++_0x48906c);}(_0xb17c,0x1e7));var _0xcb17=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xb17c[_0x2112d4];return _0x434972;};'use strict';var util=require(_0xcb17('0x0'));var moment=require(_0xcb17('0x1'));var rp=require(_0xcb17('0x2'));var BPromise=require(_0xcb17('0x3'));var pkginfo=require(_0xcb17('0x4'))(module,_0xcb17('0x5'));var db=require(_0xcb17('0x6'))['db'];var encryptor=require(_0xcb17('0x7'));var hardware=require(_0xcb17('0x8'));var logger=require('../logger')(_0xcb17('0x9'));var HOST=_0xcb17('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x94da63){return new BPromise(function(_0x353800,_0x48afdb){var _0x279b52=util[_0xcb17('0xb')](_0xcb17('0xc'),HOST,_0x94da63,module[_0xcb17('0xd')][_0xcb17('0x5')]);if(oldToken){_0x279b52=util[_0xcb17('0xb')](_0xcb17('0xe'),HOST,_0x94da63,module['exports'][_0xcb17('0x5')],oldToken);}var _0x26983c={'uri':_0x279b52,'method':_0xcb17('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x26983c)[_0xcb17('0x10')](function(_0x4f960d){_0x353800(_0x4f960d);})[_0xcb17('0x11')](function(_0x5a7f82){_0x48afdb(_0x5a7f82);});});}function manageLicense(_0x52306f,_0x442ab7){var _0x7acd9a=_0x442ab7[_0xcb17('0x12')]({'plain':!![]});if(!isOldTokenSent&&_0x7acd9a[_0xcb17('0x13')]!==_0x52306f&&!_0x7acd9a[_0xcb17('0x14')]){oldToken=_0x7acd9a[_0xcb17('0x13')];}httpRequest(_0x52306f)[_0xcb17('0x10')](function(_0x144ae7){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x144ae7['active']){isOldTokenSent=![];if(!_0x7acd9a[_0xcb17('0x9')]&&_0x7acd9a[_0xcb17('0x9')]!=_0x144ae7[_0xcb17('0x9')]||_0x7acd9a['license']&&_0x7acd9a[_0xcb17('0x14')]){logger[_0xcb17('0x15')](_0xcb17('0x16'));}if(_0x7acd9a[_0xcb17('0x9')]&&!_0x7acd9a[_0xcb17('0x14')]&&_0x7acd9a[_0xcb17('0x9')]!=_0x144ae7['license']){logger[_0xcb17('0x15')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x7acd9a[_0xcb17('0x9')]&&!_0x7acd9a[_0xcb17('0x14')]&&_0x7acd9a['license']==_0x144ae7[_0xcb17('0x9')]){return _0x442ab7;}return _0x442ab7[_0xcb17('0x17')]({'data1':_0x52306f,'data2':null,'license':_0x144ae7['license']});}else{if(_0x144ae7[_0xcb17('0x9')]||_0x7acd9a[_0xcb17('0x9')]){if(!_0x7acd9a[_0xcb17('0x14')]){if(_0x7acd9a['data1']==_0x52306f){GRAY_PERIOD_REASON=_0xcb17('0x18');logger['info'](_0xcb17('0x19'));}else{GRAY_PERIOD_REASON=_0xcb17('0x1a');logger[_0xcb17('0x15')](_0xcb17('0x1b'),_0x7acd9a[_0xcb17('0x13')],_0x52306f);}logger[_0xcb17('0x15')](_0xcb17('0x1c'),GRAY_PERIOD_REASON[_0xcb17('0x1d')](),moment()[_0xcb17('0xb')](_0xcb17('0x1e')));return _0x442ab7['update']({'data2':encryptor[_0xcb17('0x1f')](moment()[_0xcb17('0xb')](_0xcb17('0x1e')))});}else{if(moment()[_0xcb17('0x20')](encryptor[_0xcb17('0x21')](_0x7acd9a[_0xcb17('0x14')]),_0xcb17('0x22'))>DAYS){logger[_0xcb17('0x15')](_0xcb17('0x23'),moment()[_0xcb17('0xb')](_0xcb17('0x1e')));isOldTokenSent=![];return _0x442ab7[_0xcb17('0x17')]({'data1':_0x52306f,'data2':null,'license':null});}}}else{if(_0x7acd9a[_0xcb17('0x13')]!=_0x52306f){logger['info'](_0xcb17('0x1b'),_0x7acd9a['data1'],_0x52306f);return _0x442ab7[_0xcb17('0x17')]({'data1':_0x52306f,'data2':null,'license':null});}}}return _0x442ab7;})[_0xcb17('0x10')](function(_0x3cced0){_0x442ab7=_0x3cced0;})['catch'](function(_0x412932){logger[_0xcb17('0x24')](_0x412932[_0xcb17('0x25')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xcb17('0x26')](),_0x442ab7);},TIME);});}function defaultLicense(){var _0x36c580=hardware[_0xcb17('0x26')]();if(_0x36c580){return db[_0xcb17('0x27')][_0xcb17('0x28')]({'where':{'id':0x1},'defaults':{'data1':_0x36c580}})[_0xcb17('0x29')](function(_0x158092,_0x57b689){logger[_0xcb17('0x15')](_0xcb17('0x2a'),_0x36c580);manageLicense(_0x36c580,_0x158092);})[_0xcb17('0x11')](function(_0x561ea6){logger[_0xcb17('0x24')](_0x561ea6[_0xcb17('0x25')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index c2d75f0..d0eeddb 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 _0x3c79=['uuid','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','decryptString','format','%s:%s:%s','machineUuid','getUuid','deadline','add','days','changed','disabled','message','User','findAll','role','sequelize','COUNT','count','admin','telephone','users','forEach','user','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','lodash','moment','./hardware','../../mysqldb','Demo\x20license','2027-01-01T00:00:00.000Z','License','find','defaults','then','catch'];(function(_0x6cae31,_0x31578d){var _0x572281=function(_0x38f135){while(--_0x38f135){_0x6cae31['push'](_0x6cae31['shift']());}};_0x572281(++_0x31578d);}(_0x3c79,0x1ed));var _0x93c7=function(_0x3b94c3,_0x7f0fc6){_0x3b94c3=_0x3b94c3-0x0;var _0x1134e0=_0x3c79[_0x3b94c3];return _0x1134e0;};'use strict';var util=require('util');var _=require(_0x93c7('0x0'));var moment=require(_0x93c7('0x1'));var BPromise=require('bluebird');var hardware=require(_0x93c7('0x2'));var encryptor=require('../../components/encryptor');var db=require(_0x93c7('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x93c7('0x4'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x93c7('0x5'),'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(_0x354ffa){return new BPromise(function(_0x35b96d,_0x154ffa){return db[_0x93c7('0x6')][_0x93c7('0x7')](_[_0x93c7('0x8')](_0x354ffa,{'raw':!![],'where':{'id':0x1}}))[_0x93c7('0x9')](function(_0x9b4b9b){return checkLicense(_0x9b4b9b,null);})['then'](function(_0x3f1b9b){_0x35b96d(_0x3f1b9b);return;})[_0x93c7('0xa')](function(_0x1bca7c){_0x154ffa(_0x1bca7c);});});}function checkLicense(_0x4211e4,_0x23a6ee){if(!_0x4211e4){demoLicense[_0x93c7('0xb')]=_0x4211e4['data1'];return demoLicense;}try{var _0x4cbf5c=_0x23a6ee||_0x4211e4['license'];if(_[_0x93c7('0xc')](_0x4cbf5c)){throw new Error(_0x93c7('0xd'));}var _0x32f067=_0x4211e4[_0x93c7('0xe')];var _0x5b0293=_0x4211e4[_0x93c7('0xf')];var _0x246f89=_0x32f067[_0x93c7('0x10')]('-')[0x4];var _0x435994=_0x32f067['split']('-')[0x0];var _0xfd66f4=encryptor[_0x93c7('0x11')](_0x4cbf5c,util[_0x93c7('0x12')](_0x93c7('0x13'),_0x246f89,_0x32f067,_0x435994));var _0x5b8873=JSON['parse'](_0xfd66f4);_0x5b8873['demo']=![];_0x5b8873[_0x93c7('0xb')]=_0x32f067;_0x5b8873[_0x93c7('0x14')]=hardware[_0x93c7('0x15')]();if(_0x5b0293){var _0x2e6778=encryptor[_0x93c7('0x11')](_0x5b0293);_0x5b8873['gray']=_0x2e6778;_0x5b8873[_0x93c7('0x16')]=moment(_0x2e6778)[_0x93c7('0x17')](0x7,_0x93c7('0x18'))[_0x93c7('0x12')]();_0x5b8873['grayReason']=_0x5b8873[_0x93c7('0xb')]!=_0x5b8873[_0x93c7('0x14')]?_0x93c7('0x19'):_0x93c7('0x1a');}return _0x5b8873;}catch(_0xaaec61){breakingLicense[_0x93c7('0xb')]=_0x4211e4[_0x93c7('0xe')];breakingLicense[_0x93c7('0x1b')]=_0xaaec61[_0x93c7('0x1b')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2bb558,_0x52087f){getLicense()[_0x93c7('0x9')](function(_0x1a096c){return db[_0x93c7('0x1c')][_0x93c7('0x1d')]({'attributes':[_0x93c7('0x1e'),[db[_0x93c7('0x1f')]['fn'](_0x93c7('0x20'),db['sequelize']['col'](_0x93c7('0x1e'))),_0x93c7('0x21')]],'group':_0x93c7('0x1e'),'where':{'role':{'$or':[_0x93c7('0x22'),'user',_0x93c7('0x23')]}},'raw':!![]})[_0x93c7('0x9')](function(_0x345973){var _0x4d88e2={'user':_0x1a096c[_0x93c7('0x24')]||0x0,'telephone':_0x1a096c['telephones']||0x0};_0x345973[_0x93c7('0x25')](function(_0x17800a){var _0x16f40d=_0x17800a['role']==='admin'?_0x93c7('0x26'):_0x17800a[_0x93c7('0x1e')];_0x4d88e2[_0x16f40d]-=_0x17800a[_0x93c7('0x21')];if(_0x4d88e2[_0x16f40d]<0x0)_0x4d88e2[_0x16f40d]=0x0;});_0x2bb558(_0x4d88e2);return;});})[_0x93c7('0xa')](function(_0x1c035a){_0x52087f(_0x1c035a);});});}function checkUserLimits(_0x378e82){return new BPromise(function(_0x157803,_0x4421ad){getLimits()[_0x93c7('0x9')](function(_0x45142d){var _0x47bb81=_[_0x93c7('0x27')](_[_0x93c7('0x28')](_0x378e82,'role'),['admin','user',_0x93c7('0x23')]);var _0xe5a04d=(_0x47bb81[_0x93c7('0x22')]||0x0)+(_0x47bb81['user']||0x0);var _0x124462=_0x47bb81[_0x93c7('0x23')]||0x0;if(_0xe5a04d>_0x45142d[_0x93c7('0x26')])return _0x4421ad('License\x20limit\x20reached\x20for\x20users');if(_0x124462>_0x45142d[_0x93c7('0x23')])return _0x4421ad(_0x93c7('0x29'));return _0x157803();})[_0x93c7('0xa')](function(_0xb2da9c){_0x4421ad(_0xb2da9c);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x3d2a=['disabled','message','User','findAll','role','COUNT','sequelize','col','count','admin','user','users','telephones','forEach','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20users','util','lodash','moment','bluebird','./hardware','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','License','defaults','then','catch','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','format','%s:%s:%s','parse','demo','uuid','machineUuid','gray','deadline','add','days'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x3d2a,0x9c));var _0xa3d2=function(_0x36921f,_0x3d8888){_0x36921f=_0x36921f-0x0;var _0x2a20bb=_0x3d2a[_0x36921f];return _0x2a20bb;};'use strict';var util=require(_0xa3d2('0x0'));var _=require(_0xa3d2('0x1'));var moment=require(_0xa3d2('0x2'));var BPromise=require(_0xa3d2('0x3'));var hardware=require(_0xa3d2('0x4'));var encryptor=require('../../components/encryptor');var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xa3d2('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xa3d2('0x6'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xa3d2('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xa3d2('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x5dc516){return new BPromise(function(_0x231f56,_0x5bbca2){return db[_0xa3d2('0x8')]['find'](_[_0xa3d2('0x9')](_0x5dc516,{'raw':!![],'where':{'id':0x1}}))[_0xa3d2('0xa')](function(_0x5a35f6){return checkLicense(_0x5a35f6,null);})[_0xa3d2('0xa')](function(_0x41b3f8){_0x231f56(_0x41b3f8);return;})[_0xa3d2('0xb')](function(_0x58f901){_0x5bbca2(_0x58f901);});});}function checkLicense(_0x213bf4,_0x2e7de8){if(!_0x213bf4){demoLicense['uuid']=_0x213bf4['data1'];return demoLicense;}try{var _0x483cb9=_0x2e7de8||_0x213bf4[_0xa3d2('0xc')];if(_[_0xa3d2('0xd')](_0x483cb9)){throw new Error(_0xa3d2('0xe'));}var _0x2e8093=_0x213bf4[_0xa3d2('0xf')];var _0x11c100=_0x213bf4[_0xa3d2('0x10')];var _0x643935=_0x2e8093['split']('-')[0x4];var _0x217ee5=_0x2e8093[_0xa3d2('0x11')]('-')[0x0];var _0x59f34e=encryptor['decryptString'](_0x483cb9,util[_0xa3d2('0x12')](_0xa3d2('0x13'),_0x643935,_0x2e8093,_0x217ee5));var _0x17a72d=JSON[_0xa3d2('0x14')](_0x59f34e);_0x17a72d[_0xa3d2('0x15')]=![];_0x17a72d[_0xa3d2('0x16')]=_0x2e8093;_0x17a72d[_0xa3d2('0x17')]=hardware['getUuid']();if(_0x11c100){var _0x526f9d=encryptor['decryptString'](_0x11c100);_0x17a72d[_0xa3d2('0x18')]=_0x526f9d;_0x17a72d[_0xa3d2('0x19')]=moment(_0x526f9d)[_0xa3d2('0x1a')](0x7,_0xa3d2('0x1b'))[_0xa3d2('0x12')]();_0x17a72d['grayReason']=_0x17a72d[_0xa3d2('0x16')]!=_0x17a72d[_0xa3d2('0x17')]?'changed':_0xa3d2('0x1c');}return _0x17a72d;}catch(_0x26cf85){breakingLicense[_0xa3d2('0x16')]=_0x213bf4[_0xa3d2('0xf')];breakingLicense[_0xa3d2('0x1d')]=_0x26cf85[_0xa3d2('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xdc556d,_0x1afc16){getLicense()[_0xa3d2('0xa')](function(_0x107a1b){return db[_0xa3d2('0x1e')][_0xa3d2('0x1f')]({'attributes':[_0xa3d2('0x20'),[db['sequelize']['fn'](_0xa3d2('0x21'),db[_0xa3d2('0x22')][_0xa3d2('0x23')](_0xa3d2('0x20'))),_0xa3d2('0x24')]],'group':_0xa3d2('0x20'),'where':{'role':{'$or':[_0xa3d2('0x25'),_0xa3d2('0x26'),'telephone']}},'raw':!![]})[_0xa3d2('0xa')](function(_0x1ff067){var _0x2dead6={'user':_0x107a1b[_0xa3d2('0x27')]||0x0,'telephone':_0x107a1b[_0xa3d2('0x28')]||0x0};_0x1ff067[_0xa3d2('0x29')](function(_0x52c2e4){var _0x53b60c=_0x52c2e4[_0xa3d2('0x20')]===_0xa3d2('0x25')?_0xa3d2('0x26'):_0x52c2e4[_0xa3d2('0x20')];_0x2dead6[_0x53b60c]-=_0x52c2e4[_0xa3d2('0x24')];if(_0x2dead6[_0x53b60c]<0x0)_0x2dead6[_0x53b60c]=0x0;});_0xdc556d(_0x2dead6);return;});})[_0xa3d2('0xb')](function(_0x4e1ec3){_0x1afc16(_0x4e1ec3);});});}function checkUserLimits(_0x5428f8){return new BPromise(function(_0x4497ec,_0x2bc6d7){getLimits()[_0xa3d2('0xa')](function(_0x324137){var _0x458e9d=_[_0xa3d2('0x2a')](_[_0xa3d2('0x2b')](_0x5428f8,_0xa3d2('0x20')),['admin',_0xa3d2('0x26'),_0xa3d2('0x2c')]);var _0x4f90da=(_0x458e9d[_0xa3d2('0x25')]||0x0)+(_0x458e9d[_0xa3d2('0x26')]||0x0);var _0x2a4a01=_0x458e9d[_0xa3d2('0x2c')]||0x0;if(_0x4f90da>_0x324137[_0xa3d2('0x26')])return _0x2bc6d7(_0xa3d2('0x2d'));if(_0x2a4a01>_0x324137[_0xa3d2('0x2c')])return _0x2bc6d7('License\x20limit\x20reached\x20for\x20telephones');return _0x4497ec();})[_0xa3d2('0xb')](function(_0x3dd684){_0x2bc6d7(_0x3dd684);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 9908dd9..4a41411 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 _0x8952=['app-id','secret','http://localhost:9000','myappanuglar-secret'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8952,0x17e));var _0x2895=function(_0x1281cf,_0x1d9965){_0x1281cf=_0x1281cf-0x0;var _0x464135=_0x8952[_0x1281cf];return _0x464135;};'use strict';module['exports']={'DOMAIN':_0x2895('0x0'),'SESSION_SECRET':_0x2895('0x1'),'GOOGLE_ID':_0x2895('0x2'),'GOOGLE_SECRET':_0x2895('0x3'),'DEBUG':''}; \ No newline at end of file +var _0xe2cf=['app-id','http://localhost:9000'];(function(_0x2ed1a0,_0x36acd9){var _0x3d272e=function(_0x41460c){while(--_0x41460c){_0x2ed1a0['push'](_0x2ed1a0['shift']());}};_0x3d272e(++_0x36acd9);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x3e0600,_0x9bb3c9){_0x3e0600=_0x3e0600-0x0;var _0x5e1117=_0xe2cf[_0x3e0600];return _0x5e1117;};'use strict';module['exports']={'DOMAIN':_0xfe2c('0x0'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xfe2c('0x1'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index cea8d2e..e4ae539 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb9a=['log','format','%s-%s.log','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','Logger','transports','File','%s-%s','error','info','Console','env','debugLevel','winston','util','path','join','/var'];(function(_0x94d729,_0xaf7d60){var _0x1eefa7=function(_0x1e254e){while(--_0x1e254e){_0x94d729['push'](_0x94d729['shift']());}};_0x1eefa7(++_0xaf7d60);}(_0xcb9a,0x8b));var _0xacb9=function(_0x2aaf0c,_0x120301){_0x2aaf0c=_0x2aaf0c-0x0;var _0x2ccbed=_0xcb9a[_0x2aaf0c];return _0x2ccbed;};'use strict';var moment=require('moment');var winston=require(_0xacb9('0x0'));var util=require(_0xacb9('0x1'));var path=require(_0xacb9('0x2'));var debugLevel='INFO';function filename(_0x457a0b,_0x45d126){return path[_0xacb9('0x3')](_0xacb9('0x4'),_0xacb9('0x5'),'xcally',util[_0xacb9('0x6')](_0xacb9('0x7'),_0x457a0b,_0x45d126));}function formatter(_0x3af957,_0x1c450){_0x1c450['message']=_0x1c450[_0xacb9('0x8')][_0xacb9('0x9')](/@@{/g,'{{{')[_0xacb9('0x9')](/}@@/g,_0xacb9('0xa'))[_0xacb9('0x9')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xacb9('0x6')](_0xacb9('0xb'),moment()[_0xacb9('0x6')](_0xacb9('0xc')),_0x1c450[_0xacb9('0xd')][_0xacb9('0xe')](),_0x3af957,_0x1c450['message']);}module['exports']=function(_0x2919b6){return new winston[(_0xacb9('0xf'))]({'transports':[new winston[(_0xacb9('0x10'))][(_0xacb9('0x11'))]({'name':util['format'](_0xacb9('0x12'),_0x2919b6,_0xacb9('0x13')),'filename':filename(_0x2919b6,_0xacb9('0x13')),'level':_0xacb9('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x431759){return formatter(_0x2919b6,_0x431759);}}),new winston[(_0xacb9('0x10'))][(_0xacb9('0x11'))]({'name':util['format'](_0xacb9('0x12'),_0x2919b6,_0xacb9('0x14')),'filename':filename(_0x2919b6,_0xacb9('0x14')),'level':_0xacb9('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x13c37f){return formatter(_0x2919b6,_0x13c37f);}}),new winston[(_0xacb9('0x10'))][(_0xacb9('0x15'))]({'level':process[_0xacb9('0x16')][_0xacb9('0x17')]||debugLevel,'json':![],'formatter':function(_0x198da9){return formatter(_0x2919b6,_0x198da9);}})]});}; \ No newline at end of file +var _0x0cf1=['%s-%s','error','transports','info','Console','env','debugLevel','winston','util','INFO','/var','log','xcally','%s-%s.log','message','{{{','replace','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','exports','Logger','File'];(function(_0x22eb96,_0x3c2d8d){var _0x5e1adf=function(_0x22e392){while(--_0x22e392){_0x22eb96['push'](_0x22eb96['shift']());}};_0x5e1adf(++_0x3c2d8d);}(_0x0cf1,0xb6));var _0x10cf=function(_0x2dbfad,_0x2e40bd){_0x2dbfad=_0x2dbfad-0x0;var _0xba3bd5=_0x0cf1[_0x2dbfad];return _0xba3bd5;};'use strict';var moment=require('moment');var winston=require(_0x10cf('0x0'));var util=require(_0x10cf('0x1'));var path=require('path');var debugLevel=_0x10cf('0x2');function filename(_0x16c3ea,_0x2a2474){return path['join'](_0x10cf('0x3'),_0x10cf('0x4'),_0x10cf('0x5'),util['format'](_0x10cf('0x6'),_0x16c3ea,_0x2a2474));}function formatter(_0x42a4d5,_0x3aae22){_0x3aae22[_0x10cf('0x7')]=_0x3aae22[_0x10cf('0x7')]['replace'](/@@{/g,_0x10cf('0x8'))[_0x10cf('0x9')](/}@@/g,_0x10cf('0xa'))[_0x10cf('0x9')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x10cf('0xb')](_0x10cf('0xc'),moment()[_0x10cf('0xb')](_0x10cf('0xd')),_0x3aae22[_0x10cf('0xe')]['toUpperCase'](),_0x42a4d5,_0x3aae22[_0x10cf('0x7')]);}module[_0x10cf('0xf')]=function(_0x27371a){return new winston[(_0x10cf('0x10'))]({'transports':[new winston['transports'][(_0x10cf('0x11'))]({'name':util[_0x10cf('0xb')](_0x10cf('0x12'),_0x27371a,'error'),'filename':filename(_0x27371a,_0x10cf('0x13')),'level':_0x10cf('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5775f2){return formatter(_0x27371a,_0x5775f2);}}),new winston[(_0x10cf('0x14'))][(_0x10cf('0x11'))]({'name':util[_0x10cf('0xb')]('%s-%s',_0x27371a,_0x10cf('0x15')),'filename':filename(_0x27371a,_0x10cf('0x15')),'level':_0x10cf('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x159433){return formatter(_0x27371a,_0x159433);}}),new winston[(_0x10cf('0x14'))][(_0x10cf('0x16'))]({'level':process[_0x10cf('0x17')][_0x10cf('0x18')]||debugLevel,'json':![],'formatter':function(_0x514f13){return formatter(_0x27371a,_0x514f13);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 3b32f42..493f354 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 _0x9e5d=['exports','express','../../services/express/index.js','join','agi','email','xdr'];(function(_0x25bbd6,_0x18f6d3){var _0x3a4c78=function(_0x277579){while(--_0x277579){_0x25bbd6['push'](_0x25bbd6['shift']());}};_0x3a4c78(++_0x18f6d3);}(_0x9e5d,0x120));var _0xd9e5=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x9e5d[_0xd09668];return _0x68726;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0xd9e5('0x0'),'script':path['join'](__dirname,_0xd9e5('0x1'))},{'name':'ami','script':path[_0xd9e5('0x2')](__dirname,'../../services/ami/index.js')},{'name':_0xd9e5('0x3'),'script':path[_0xd9e5('0x2')](__dirname,'../../services/agi/index.js')},{'name':_0xd9e5('0x4'),'script':path['join'](__dirname,'../../services/email/index.js')},{'name':'routing','script':path['join'](__dirname,'../../services/routing/index.js')},{'name':_0xd9e5('0x5'),'script':path[_0xd9e5('0x2')](__dirname,'../../services/xdr/index.js')}]};module[_0xd9e5('0x6')]=config; \ No newline at end of file +var _0x1087=['ami','../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','express','join','../../services/express/index.js'];(function(_0x102ff9,_0x907658){var _0x24fa97=function(_0x3622ff){while(--_0x3622ff){_0x102ff9['push'](_0x102ff9['shift']());}};_0x24fa97(++_0x907658);}(_0x1087,0x1aa));var _0x7108=function(_0x1ecb2a,_0x12a47f){_0x1ecb2a=_0x1ecb2a-0x0;var _0x532f48=_0x1087[_0x1ecb2a];return _0x532f48;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x7108('0x0'),'script':path[_0x7108('0x1')](__dirname,_0x7108('0x2'))},{'name':_0x7108('0x3'),'script':path[_0x7108('0x1')](__dirname,_0x7108('0x4'))},{'name':'agi','script':path[_0x7108('0x1')](__dirname,_0x7108('0x5'))},{'name':_0x7108('0x6'),'script':path[_0x7108('0x1')](__dirname,_0x7108('0x7'))},{'name':_0x7108('0x8'),'script':path[_0x7108('0x1')](__dirname,_0x7108('0x9'))},{'name':_0x7108('0xa'),'script':path[_0x7108('0x1')](__dirname,_0x7108('0xb'))}]};module[_0x7108('0xc')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 7efe157..ff10953 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 _0x8dbe=['restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connected','start','stop','then','disconnect'];(function(_0xf86253,_0x51e992){var _0xfe5a7=function(_0x356e4c){while(--_0x356e4c){_0xf86253['push'](_0xf86253['shift']());}};_0xfe5a7(++_0x51e992);}(_0x8dbe,0x1c6));var _0xe8db=function(_0xa28428,_0x1313c2){_0xa28428=_0xa28428-0x0;var _0x3b551c=_0x8dbe[_0xa28428];return _0x3b551c;};'use strict';var pm2=require(_0xe8db('0x0'));var BPromise=require(_0xe8db('0x1'));var config=require(_0xe8db('0x2'));function connect(){return new BPromise(function(_0x10ea88,_0x539b4f){return pm2['connect'](function(_0x3dfadc){if(_0x3dfadc){return _0x539b4f(_0x3dfadc);}return _0x10ea88(_0xe8db('0x3'));});});};exports['start']=function(_0x1df332){return connect()['then'](function(){return new BPromise(function(_0x9f62c7,_0xe05d99){return pm2[_0xe8db('0x4')](_0x1df332,function(_0xaf12c6,_0x5cbe83){if(_0xaf12c6){return _0xe05d99(_0xaf12c6);}pm2['disconnect']();return _0x9f62c7(_0x5cbe83);});});});};exports[_0xe8db('0x5')]=function(_0x56095f){return connect()[_0xe8db('0x6')](function(){return new BPromise(function(_0x49c997,_0x2de8b0){return pm2[_0xe8db('0x5')](_0x56095f,function(_0x18c6fc,_0x18c168){if(_0x18c6fc){return _0x2de8b0(_0x18c6fc);}pm2[_0xe8db('0x7')]();return _0x49c997(_0x18c168);});});});};exports[_0xe8db('0x8')]=function(_0x48d67a){return connect()[_0xe8db('0x6')](function(){return new BPromise(function(_0x1f9f8d,_0x55266d){return pm2[_0xe8db('0x8')](_0x48d67a,function(_0x513761,_0x2932b4){if(_0x513761){return _0x55266d(_0x513761);}pm2[_0xe8db('0x7')]();return _0x1f9f8d(_0x2932b4);});});});};exports['list']=function(){return connect()[_0xe8db('0x6')](function(){return new BPromise(function(_0x345537,_0x2705d8){return pm2[_0xe8db('0x9')](function(_0x27dd16,_0x49aacc){if(_0x27dd16){return _0x2705d8(_0x27dd16);}pm2[_0xe8db('0x7')]();return _0x345537(_0x49aacc);});});});};exports[_0xe8db('0xa')]=function(_0x107385){return connect()[_0xe8db('0x6')](function(){return new BPromise(function(_0x184143,_0x6d7f91){return pm2[_0xe8db('0xa')](_0x107385,function(_0x1807ef,_0xf73a83){if(_0x1807ef){return _0x6d7f91(_0x1807ef);}pm2[_0xe8db('0x7')]();return _0x184143(_0xf73a83);});});});};exports[_0xe8db('0xb')]=function(_0x10c042){return connect()[_0xe8db('0x6')](function(){return new BPromise(function(_0x47428d,_0x1146f0){return pm2[_0xe8db('0xb')](_0x10c042,function(_0x167bd7,_0x1627b6){if(_0x167bd7){return _0x1146f0(_0x167bd7);}pm2[_0xe8db('0x7')]();return _0x47428d(_0x1627b6);});});});};exports[_0xe8db('0xc')]=function(){return connect()[_0xe8db('0x6')](function(){return new BPromise(function(_0xf96c1a,_0x26a08f){return pm2['dump'](function(_0x4e1e03){if(_0x4e1e03){return _0x26a08f(_0x4e1e03);}return _0xf96c1a(_0xe8db('0xd'));});});});}; \ No newline at end of file +var _0xc630=['start','then','stop','disconnect','restart','list','describe','delete','dump','bluebird','./config'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xc630,0x153));var _0x0c63=function(_0x2e349f,_0x313c79){_0x2e349f=_0x2e349f-0x0;var _0x4a41dd=_0xc630[_0x2e349f];return _0x4a41dd;};'use strict';var pm2=require('pm2');var BPromise=require(_0x0c63('0x0'));var config=require(_0x0c63('0x1'));function connect(){return new BPromise(function(_0x10127e,_0x4ad945){return pm2['connect'](function(_0x5a9b0a){if(_0x5a9b0a){return _0x4ad945(_0x5a9b0a);}return _0x10127e('connected');});});};exports[_0x0c63('0x2')]=function(_0x1827f2){return connect()[_0x0c63('0x3')](function(){return new BPromise(function(_0x219b4b,_0x1bcbf7){return pm2[_0x0c63('0x2')](_0x1827f2,function(_0xccb9d6,_0x4c2a28){if(_0xccb9d6){return _0x1bcbf7(_0xccb9d6);}pm2['disconnect']();return _0x219b4b(_0x4c2a28);});});});};exports['stop']=function(_0x17a325){return connect()[_0x0c63('0x3')](function(){return new BPromise(function(_0xb4f64,_0x3bc2b9){return pm2[_0x0c63('0x4')](_0x17a325,function(_0x11f3fc,_0x15eb60){if(_0x11f3fc){return _0x3bc2b9(_0x11f3fc);}pm2[_0x0c63('0x5')]();return _0xb4f64(_0x15eb60);});});});};exports[_0x0c63('0x6')]=function(_0x3d2858){return connect()[_0x0c63('0x3')](function(){return new BPromise(function(_0x18a791,_0x4997b0){return pm2[_0x0c63('0x6')](_0x3d2858,function(_0x12aa16,_0x75e950){if(_0x12aa16){return _0x4997b0(_0x12aa16);}pm2[_0x0c63('0x5')]();return _0x18a791(_0x75e950);});});});};exports[_0x0c63('0x7')]=function(){return connect()[_0x0c63('0x3')](function(){return new BPromise(function(_0x153b01,_0xb8bb28){return pm2['list'](function(_0x3ef7e4,_0x163aa8){if(_0x3ef7e4){return _0xb8bb28(_0x3ef7e4);}pm2[_0x0c63('0x5')]();return _0x153b01(_0x163aa8);});});});};exports[_0x0c63('0x8')]=function(_0x3bc04c){return connect()[_0x0c63('0x3')](function(){return new BPromise(function(_0x5bd9d1,_0x285e8f){return pm2[_0x0c63('0x8')](_0x3bc04c,function(_0x5f24e0,_0x2d8347){if(_0x5f24e0){return _0x285e8f(_0x5f24e0);}pm2['disconnect']();return _0x5bd9d1(_0x2d8347);});});});};exports[_0x0c63('0x9')]=function(_0x4d2309){return connect()[_0x0c63('0x3')](function(){return new BPromise(function(_0x3f9b61,_0x14a6fe){return pm2[_0x0c63('0x9')](_0x4d2309,function(_0x38eafa,_0x4e87bf){if(_0x38eafa){return _0x14a6fe(_0x38eafa);}pm2[_0x0c63('0x5')]();return _0x3f9b61(_0x4e87bf);});});});};exports[_0x0c63('0xa')]=function(){return connect()['then'](function(){return new BPromise(function(_0x1b2c38,_0x1138b6){return pm2[_0x0c63('0xa')](function(_0xd49509){if(_0xd49509){return _0x1138b6(_0xd49509);}return _0x1b2c38('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 538eadf..4c073d9 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 _0x26bc=['map','info','[CHAT]\x20Interactions\x20to\x20close:','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','[CHAT]\x20Error\x20closing\x20interactions','moment','../logger','schedule','defaults','redis','socket.io-emitter','Setting','find','chatTimeout','ChatInteraction','findAll','lastMsgAt','minutes','then','length'];(function(_0x3a2118,_0x31fc3c){var _0x1d181d=function(_0x26a734){while(--_0x26a734){_0x3a2118['push'](_0x3a2118['shift']());}};_0x1d181d(++_0x31fc3c);}(_0x26bc,0x8d));var _0xc26b=function(_0x527345,_0x4cfd5d){_0x527345=_0x527345-0x0;var _0x4ff0a5=_0x26bc[_0x527345];return _0x4ff0a5;};'use strict';var _=require('lodash');var moment=require(_0xc26b('0x0'));var Redis=require('ioredis');var util=require('util');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0xc26b('0x1'))(_0xc26b('0x2'));config['redis']=_[_0xc26b('0x3')](config[_0xc26b('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xc26b('0x5'))(new Redis(config[_0xc26b('0x4')]));function closeInteractions(){var _0x3e7ee5=0x0;var _0x2ee731=[];return db[_0xc26b('0x6')][_0xc26b('0x7')]({'raw':!![],'attributes':['id',_0xc26b('0x8')],'where':{'id':0x1}})['then'](function(_0x3d03d6){_0x3e7ee5=_0x3d03d6[_0xc26b('0x8')];if(_0x3e7ee5){return db[_0xc26b('0x9')][_0xc26b('0xa')]({'raw':!![],'attributes':['id',_0xc26b('0xb')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x3d03d6[_0xc26b('0x8')],_0xc26b('0xc'))}}});}else{return[];}})[_0xc26b('0xd')](function(_0x27b3ee){if(_0x27b3ee&&_0x27b3ee[_0xc26b('0xe')]){_0x2ee731=_[_0xc26b('0xf')](_0x27b3ee||[],'id');logger[_0xc26b('0x10')](_0xc26b('0x11'),_0x2ee731['join']());return db[_0xc26b('0x9')]['update']({'closeReason':'system','disposition':_0xc26b('0x12'),'closed':!![],'closedAt':moment()[_0xc26b('0x13')](_0xc26b('0x14'))},{'where':{'id':_0x2ee731}});}})[_0xc26b('0xd')](function(){if(_0x2ee731&&_0x2ee731[_0xc26b('0xe')]){logger[_0xc26b('0x10')](_0xc26b('0x15'),_0x2ee731['join']());for(var _0x4adb96=0x0;_0x4adb96<_0x2ee731[_0xc26b('0xe')];_0x4adb96++){io[_0xc26b('0x16')]('chatInteraction:update',{'id':_0x2ee731[_0x4adb96],'closed':!![]});}}})[_0xc26b('0x17')](function(_0x903485){logger[_0xc26b('0x18')](_0xc26b('0x19'),_0x903485?util['inspect'](_0x903485,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x8387=['[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','info'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x8387,0x15a));var _0x7838=function(_0x3c27df,_0xc6d32b){_0x3c27df=_0x3c27df-0x0;var _0x56f1f0=_0x8387[_0x3c27df];return _0x56f1f0;};'use strict';var _=require(_0x7838('0x0'));var moment=require(_0x7838('0x1'));var Redis=require(_0x7838('0x2'));var util=require(_0x7838('0x3'));var config=require(_0x7838('0x4'));var db=require(_0x7838('0x5'))['db'];var logger=require(_0x7838('0x6'))(_0x7838('0x7'));config[_0x7838('0x8')]=_[_0x7838('0x9')](config['redis'],{'host':_0x7838('0xa'),'port':0x18eb});var io=require(_0x7838('0xb'))(new Redis(config[_0x7838('0x8')]));function closeInteractions(){var _0x4f3d8c=0x0;var _0x479128=[];return db[_0x7838('0xc')][_0x7838('0xd')]({'raw':!![],'attributes':['id',_0x7838('0xe')],'where':{'id':0x1}})[_0x7838('0xf')](function(_0x5d2530){_0x4f3d8c=_0x5d2530[_0x7838('0xe')];if(_0x4f3d8c){return db[_0x7838('0x10')][_0x7838('0x11')]({'raw':!![],'attributes':['id',_0x7838('0x12')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x7838('0x13')](_0x5d2530[_0x7838('0xe')],_0x7838('0x14'))}}});}else{return[];}})[_0x7838('0xf')](function(_0x5927d7){if(_0x5927d7&&_0x5927d7[_0x7838('0x15')]){_0x479128=_[_0x7838('0x16')](_0x5927d7||[],'id');logger[_0x7838('0x17')](_0x7838('0x18'),_0x479128[_0x7838('0x19')]());return db[_0x7838('0x10')][_0x7838('0x1a')]({'closeReason':_0x7838('0x1b'),'disposition':_0x7838('0x1c'),'closed':!![],'closedAt':moment()[_0x7838('0x1d')](_0x7838('0x1e'))},{'where':{'id':_0x479128}});}})['then'](function(){if(_0x479128&&_0x479128[_0x7838('0x15')]){logger['info']('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x479128[_0x7838('0x19')]());for(var _0x399ce2=0x0;_0x399ce2<_0x479128[_0x7838('0x15')];_0x399ce2++){io[_0x7838('0x1f')](_0x7838('0x20'),{'id':_0x479128[_0x399ce2],'closed':!![]});}}})[_0x7838('0x21')](function(_0x5cb1ab){logger[_0x7838('0x22')](_0x7838('0x23'),_0x5cb1ab?util['inspect'](_0x5cb1ab,{'showHidden':![],'depth':null}):'');});}exports[_0x7838('0x24')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index f961407..cfa1ba1 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 _0xb930=['SendMail','then','email\x20sent','catch','error\x20mail','error','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','toString','difference','length','exists','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','stop','stop\x20cron','update','update\x20cron','run','path','moment','cron-job-manager','jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','service','Smtp','host','secure','authentication','auth','user','name','email','bcc','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','extname','zip','existsSync','status','message','attachments','text','stringify','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','info'];(function(_0x5b4536,_0x18a2c6){var _0x1475cf=function(_0x10050e){while(--_0x10050e){_0x5b4536['push'](_0x5b4536['shift']());}};_0x1475cf(++_0x18a2c6);}(_0xb930,0x88));var _0x0b93=function(_0x45e0a2,_0x5b3aec){_0x45e0a2=_0x45e0a2-0x0;var _0x29b175=_0xb930[_0x45e0a2];return _0x29b175;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x0b93('0x0'));var _=require('lodash');var moment=require(_0x0b93('0x1'));var CronJobManager=require(_0x0b93('0x2'));var jayson=require(_0x0b93('0x3'));var BPromise=require('bluebird');var logger=require(_0x0b93('0x4'))(_0x0b93('0x5'));var db=require(_0x0b93('0x6'))['db'];var analyticCustomReportController=require(_0x0b93('0x7'));var analyticDefaultReportController=require(_0x0b93('0x8'));var client=jayson[_0x0b93('0x9')][_0x0b93('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5427e3,_0x456008){return function(){logger['info'](_0x0b93('0xb'),_0x5427e3['email']);var _0x2da3ba=!![];var _0x1972fc={'tls':{'rejectUnauthorized':![]}};if(_0x5427e3[_0x0b93('0xc')]['Smtp']['service']){_0x1972fc[_0x0b93('0xd')]=_0x5427e3[_0x0b93('0xc')][_0x0b93('0xe')]['service'];}else{_0x1972fc['host']=_0x5427e3[_0x0b93('0xc')][_0x0b93('0xe')][_0x0b93('0xf')];_0x1972fc['port']=_0x5427e3[_0x0b93('0xc')][_0x0b93('0xe')]['port'];_0x1972fc[_0x0b93('0x10')]=_0x5427e3[_0x0b93('0xc')]['Smtp'][_0x0b93('0x10')];}if(_0x5427e3[_0x0b93('0xc')][_0x0b93('0xe')][_0x0b93('0x11')]){_0x1972fc[_0x0b93('0x12')]={'user':_0x5427e3[_0x0b93('0xc')]['Smtp'][_0x0b93('0x13')],'pass':_0x5427e3['MailAccount'][_0x0b93('0xe')]['pass']};}var _0x422088={'account':_0x1972fc,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x5427e3[_0x0b93('0xc')][_0x0b93('0x14')],_0x5427e3[_0x0b93('0xc')]['email']||_0x5427e3[_0x0b93('0xc')][_0x0b93('0xe')][_0x0b93('0x13')]),'to':_0x5427e3[_0x0b93('0x15')],'cc':_0x5427e3['cc'],'bcc':_0x5427e3[_0x0b93('0x16')],'subject':util[_0x0b93('0x17')](_0x0b93('0x18'),_0x456008[_0x0b93('0x14')],_0x5427e3[_0x0b93('0x19')],_0x5427e3[_0x0b93('0x1a')])}};var _0x5735f8=path[_0x0b93('0x1b')](__dirname,_0x0b93('0x1c'));var _0xbb3d5f=_0x456008[_0x0b93('0x1d')];var _0x36cfd0=util[_0x0b93('0x17')](_0x0b93('0x1e'),path['basename'](_0x456008[_0x0b93('0x1d')],path[_0x0b93('0x1f')](_0x456008[_0x0b93('0x1d')])),_0x0b93('0x20'));var _0x36da87=path['join'](_0x5735f8,_0xbb3d5f);var _0x42729a=path[_0x0b93('0x1b')](_0x5735f8,_0x36cfd0);if(fs[_0x0b93('0x21')](_0x36da87)){_0x456008[_0x0b93('0x22')]='Sent';_0x422088[_0x0b93('0x23')][_0x0b93('0x24')]=[{'filename':_0xbb3d5f,'path':_0x36da87}];_0x422088[_0x0b93('0x23')][_0x0b93('0x25')]=util[_0x0b93('0x17')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x0b93('0x26')](_0x456008,null,0x2));}else if(fs['existsSync'](_0x42729a)){_0x456008[_0x0b93('0x22')]=_0x0b93('0x27');_0x422088['message']['attachments']=[{'filename':_0x36cfd0,'path':_0x42729a}];}else{_0x422088[_0x0b93('0x23')][_0x0b93('0x25')]=_0x0b93('0x28');if(!_0x5427e3['sendIfEmpty']){_0x2da3ba=![];logger[_0x0b93('0x29')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x2da3ba){return client['request'](_0x0b93('0x2a'),_0x422088)[_0x0b93('0x2b')](function(_0x419f25){if(_0x419f25['error']){return logger['error']('error\x20mail',JSON['stringify'](_0x419f25));}return logger[_0x0b93('0x29')](_0x0b93('0x2c'));})[_0x0b93('0x2d')](function(_0x259c41){return logger['error'](_0x0b93('0x2e'),JSON[_0x0b93('0x26')](_0x259c41));});}};}function handleError(){return function(_0x329070){return logger[_0x0b93('0x2f')](JSON[_0x0b93('0x26')](_0x329070));};}function handleResult(_0xf9b6bf){return function(_0x62a96f){logger[_0x0b93('0x29')](_0x0b93('0x30'),JSON[_0x0b93('0x26')](_0x62a96f));if(_0xf9b6bf[_0x0b93('0xc')]&&_0xf9b6bf[_0x0b93('0xc')][_0x0b93('0xe')]&&!_['isNil'](_0xf9b6bf[_0x0b93('0x15')])){setTimeout(handleSendEmail(_0xf9b6bf,_0x62a96f),0x3c*0x3e8);}};}function handleJob(_0x4e3965){return function(){try{if(_[_0x0b93('0x31')](_0x4e3965['subtractNumber'])){return logger[_0x0b93('0x29')](_0x0b93('0x32'));}if(_[_0x0b93('0x31')](_0x4e3965[_0x0b93('0x1a')])){return logger[_0x0b93('0x29')](_0x0b93('0x33'));}var _0x1ca8a1={'startDate':moment()['subtract'](_0x4e3965[_0x0b93('0x19')],_0x4e3965[_0x0b93('0x1a')])[_0x0b93('0x17')](_0x0b93('0x34')),'endDate':moment()[_0x0b93('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x0b93('0x35'),'output':_0x4e3965[_0x0b93('0x36')],'name':_0x4e3965[_0x0b93('0x14')]};if(!_[_0x0b93('0x31')](_0x4e3965[_0x0b93('0x37')])){logger[_0x0b93('0x29')](_0x0b93('0x38'),_0x4e3965[_0x0b93('0x37')]);return analyticDefaultReportController['runReport']({'id':_0x4e3965[_0x0b93('0x37')]},_0x1ca8a1)[_0x0b93('0x2b')](handleResult(_0x4e3965))[_0x0b93('0x2d')](handleError());}if(!_[_0x0b93('0x31')](_0x4e3965[_0x0b93('0x39')])){logger[_0x0b93('0x29')](_0x0b93('0x3a'),_0x4e3965[_0x0b93('0x39')]);return analyticCustomReportController[_0x0b93('0x3b')]({'id':_0x4e3965[_0x0b93('0x39')]},_0x1ca8a1)['then'](handleResult(_0x4e3965))[_0x0b93('0x2d')](handleError());}}catch(_0x3b4917){logger[_0x0b93('0x2f')](JSON[_0x0b93('0x26')](_0x3b4917));}return logger[_0x0b93('0x29')](_0x0b93('0x3c'));};}function getJobs(_0x1a421e){var _0x4c1e33={};if(_0x1a421e){_0x4c1e33['id']=_0x1a421e;}return db[_0x0b93('0x3d')][_0x0b93('0x3e')]({'where':_0x4c1e33,'include':[{'model':db[_0x0b93('0xc')],'attributes':['id','name','email'],'include':[{'model':db[_0x0b93('0x3f')],'as':_0x0b93('0xe')}]}]})[_0x0b93('0x2b')](function(_0x2a5bfc){var _0x33d378=_[_0x0b93('0x40')](manager[_0x0b93('0x41')]);var _0x468c66=_[_0x0b93('0x42')](_0x2a5bfc,function(_0x39cdfb){return _0x39cdfb['id'][_0x0b93('0x43')]();});var _0x3b4fcf=_['keyBy'](_0x2a5bfc,function(_0x572bfc){return _0x572bfc['id']['toString']();});var _0x450ac1=_0x1a421e?_0x468c66:_[_0x0b93('0x44')](_0x468c66,_0x33d378);var _0x528bbc=_['intersection'](_0x468c66,_0x33d378);var _0x367d80=_[_0x0b93('0x44')](_0x33d378,_0x468c66);var _0x43b672;var _0x23f6dc;for(_0x43b672=0x0;_0x43b672<_0x367d80[_0x0b93('0x45')]&&!_0x1a421e;_0x43b672+=0x1){_0x23f6dc=_0x367d80[_0x43b672][_0x0b93('0x43')]();if(manager[_0x0b93('0x46')](_0x23f6dc)){manager['stop'](_0x23f6dc);manager[_0x0b93('0x47')](_0x23f6dc);logger[_0x0b93('0x29')](_0x0b93('0x48'),_0x23f6dc);}}logger[_0x0b93('0x29')](_0x0b93('0x49'),JSON[_0x0b93('0x26')](_0x450ac1));for(_0x43b672=0x0;_0x43b672<_0x450ac1[_0x0b93('0x45')];_0x43b672+=0x1){_0x23f6dc=_0x450ac1[_0x43b672][_0x0b93('0x43')]();logger[_0x0b93('0x29')](_0x0b93('0x4a'),_0x23f6dc);if(_0x1a421e){logger['info'](_0x0b93('0x4b'),_0x1a421e);logger[_0x0b93('0x29')](JSON['stringify'](_0x3b4fcf[_0x23f6dc]));BPromise[_0x0b93('0x4c')]()[_0x0b93('0x2b')](handleJob(_0x3b4fcf[_0x23f6dc]));logger[_0x0b93('0x29')](_0x0b93('0x4d'),_0x3b4fcf[_0x23f6dc][_0x0b93('0x14')],_0x3b4fcf[_0x23f6dc][_0x0b93('0x4e')]);}else if(_0x3b4fcf[_0x23f6dc][_0x0b93('0x4e')]&&_0x3b4fcf[_0x23f6dc][_0x0b93('0x4f')]&&moment()[_0x0b93('0x50')](_0x3b4fcf[_0x23f6dc][_0x0b93('0x51')],_0x3b4fcf[_0x23f6dc][_0x0b93('0x52')])){manager[_0x0b93('0x53')](_0x23f6dc,_0x3b4fcf[_0x23f6dc][_0x0b93('0x4e')],handleJob(_0x3b4fcf[_0x23f6dc]));manager['start'](_0x23f6dc);logger['info']('add\x20cron',_0x3b4fcf[_0x23f6dc][_0x0b93('0x14')],_0x3b4fcf[_0x23f6dc][_0x0b93('0x4e')]);}else if(manager['exists'](_0x23f6dc)){manager[_0x0b93('0x54')](_0x23f6dc);manager['deleteJob'](_0x23f6dc);logger['info'](_0x0b93('0x55'),_0x3b4fcf[_0x23f6dc][_0x0b93('0x14')],_0x3b4fcf[_0x23f6dc][_0x0b93('0x4e')]);}}for(_0x43b672=0x0,_0x23f6dc;_0x43b672<_0x528bbc[_0x0b93('0x45')]&&!_0x1a421e;_0x43b672+=0x1){_0x23f6dc=_0x528bbc[_0x43b672][_0x0b93('0x43')]();if(manager[_0x0b93('0x46')](_0x23f6dc)){if(_0x3b4fcf[_0x23f6dc][_0x0b93('0x4e')]&&_0x3b4fcf[_0x23f6dc]['active']&&moment()[_0x0b93('0x50')](_0x3b4fcf[_0x23f6dc][_0x0b93('0x51')],_0x3b4fcf[_0x23f6dc][_0x0b93('0x52')])){manager[_0x0b93('0x56')](_0x23f6dc,_0x3b4fcf[_0x23f6dc][_0x0b93('0x4e')],handleJob(_0x3b4fcf[_0x23f6dc]));logger[_0x0b93('0x29')](_0x0b93('0x57'),_0x3b4fcf[_0x23f6dc][_0x0b93('0x14')],_0x3b4fcf[_0x23f6dc][_0x0b93('0x4e')]);}else{manager[_0x0b93('0x54')](_0x23f6dc);manager['deleteJob'](_0x23f6dc);logger[_0x0b93('0x29')](_0x0b93('0x55'),_0x3b4fcf[_0x23f6dc][_0x0b93('0x14')],_0x3b4fcf[_0x23f6dc][_0x0b93('0x4e')]);}}}})[_0x0b93('0x2d')](function(_0x5ee1ad){logger['error'](JSON['stringify'](_0x5ee1ad));});}exports[_0x0b93('0x58')]=function(_0x703e38){return getJobs(_0x703e38);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xdba8=['Schedule','findAll','keys','jobs','map','keyBy','difference','intersection','length','toString','stop','deleteJob','delete\x20cron','toRun','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','exists','stop\x20cron','update','update\x20cron','run','util','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','service','Smtp','host','port','secure','authentication','auth','user','format','\x22%s\x22\x20<%s>','name','email','bcc','subtractUnit','../../files/reports','%s.%s','basename','extname','savename','zip','join','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','status','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','SendMail','then','error','error\x20mail','email\x20sent','catch','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id'];(function(_0x2b8a92,_0x192f64){var _0x31f0da=function(_0x208455){while(--_0x208455){_0x2b8a92['push'](_0x2b8a92['shift']());}};_0x31f0da(++_0x192f64);}(_0xdba8,0x196));var _0x8dba=function(_0x56193f,_0x21888a){_0x56193f=_0x56193f-0x0;var _0x22197f=_0xdba8[_0x56193f];return _0x22197f;};'use strict';var fs=require('fs');var util=require(_0x8dba('0x0'));var path=require('path');var _=require('lodash');var moment=require(_0x8dba('0x1'));var CronJobManager=require(_0x8dba('0x2'));var jayson=require(_0x8dba('0x3'));var BPromise=require(_0x8dba('0x4'));var logger=require(_0x8dba('0x5'))(_0x8dba('0x6'));var db=require(_0x8dba('0x7'))['db'];var analyticCustomReportController=require(_0x8dba('0x8'));var analyticDefaultReportController=require(_0x8dba('0x9'));var client=jayson[_0x8dba('0xa')][_0x8dba('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4b9319,_0x3cd0de){return function(){logger[_0x8dba('0xc')](_0x8dba('0xd'),_0x4b9319['email']);var _0x3d4d99=!![];var _0x12191c={'tls':{'rejectUnauthorized':![]}};if(_0x4b9319[_0x8dba('0xe')]['Smtp'][_0x8dba('0xf')]){_0x12191c['service']=_0x4b9319[_0x8dba('0xe')][_0x8dba('0x10')]['service'];}else{_0x12191c[_0x8dba('0x11')]=_0x4b9319[_0x8dba('0xe')][_0x8dba('0x10')][_0x8dba('0x11')];_0x12191c[_0x8dba('0x12')]=_0x4b9319['MailAccount']['Smtp']['port'];_0x12191c['secure']=_0x4b9319['MailAccount'][_0x8dba('0x10')][_0x8dba('0x13')];}if(_0x4b9319[_0x8dba('0xe')][_0x8dba('0x10')][_0x8dba('0x14')]){_0x12191c[_0x8dba('0x15')]={'user':_0x4b9319[_0x8dba('0xe')][_0x8dba('0x10')][_0x8dba('0x16')],'pass':_0x4b9319[_0x8dba('0xe')][_0x8dba('0x10')]['pass']};}var _0x262c90={'account':_0x12191c,'message':{'from':util[_0x8dba('0x17')](_0x8dba('0x18'),_0x4b9319[_0x8dba('0xe')][_0x8dba('0x19')],_0x4b9319[_0x8dba('0xe')]['email']||_0x4b9319[_0x8dba('0xe')][_0x8dba('0x10')][_0x8dba('0x16')]),'to':_0x4b9319[_0x8dba('0x1a')],'cc':_0x4b9319['cc'],'bcc':_0x4b9319[_0x8dba('0x1b')],'subject':util[_0x8dba('0x17')]('Report\x20%s\x20last\x20%s\x20%s',_0x3cd0de[_0x8dba('0x19')],_0x4b9319['subtractNumber'],_0x4b9319[_0x8dba('0x1c')])}};var _0x1ce292=path['join'](__dirname,_0x8dba('0x1d'));var _0x440ba5=_0x3cd0de['savename'];var _0x4aa64e=util[_0x8dba('0x17')](_0x8dba('0x1e'),path[_0x8dba('0x1f')](_0x3cd0de['savename'],path[_0x8dba('0x20')](_0x3cd0de[_0x8dba('0x21')])),_0x8dba('0x22'));var _0x337158=path[_0x8dba('0x23')](_0x1ce292,_0x440ba5);var _0x52abe9=path[_0x8dba('0x23')](_0x1ce292,_0x4aa64e);if(fs['existsSync'](_0x337158)){_0x3cd0de['status']=_0x8dba('0x24');_0x262c90[_0x8dba('0x25')][_0x8dba('0x26')]=[{'filename':_0x440ba5,'path':_0x337158}];_0x262c90[_0x8dba('0x25')][_0x8dba('0x27')]=util[_0x8dba('0x17')](_0x8dba('0x28'),JSON[_0x8dba('0x29')](_0x3cd0de,null,0x2));}else if(fs['existsSync'](_0x52abe9)){_0x3cd0de[_0x8dba('0x2a')]=_0x8dba('0x24');_0x262c90['message'][_0x8dba('0x26')]=[{'filename':_0x4aa64e,'path':_0x52abe9}];}else{_0x262c90['message'][_0x8dba('0x27')]=_0x8dba('0x2b');if(!_0x4b9319[_0x8dba('0x2c')]){_0x3d4d99=![];logger[_0x8dba('0xc')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x3d4d99){return client['request'](_0x8dba('0x2d'),_0x262c90)[_0x8dba('0x2e')](function(_0x4deb77){if(_0x4deb77[_0x8dba('0x2f')]){return logger[_0x8dba('0x2f')](_0x8dba('0x30'),JSON[_0x8dba('0x29')](_0x4deb77));}return logger['info'](_0x8dba('0x31'));})[_0x8dba('0x32')](function(_0x58c63c){return logger[_0x8dba('0x2f')](_0x8dba('0x30'),JSON[_0x8dba('0x29')](_0x58c63c));});}};}function handleError(){return function(_0x28c078){return logger[_0x8dba('0x2f')](JSON[_0x8dba('0x29')](_0x28c078));};}function handleResult(_0x2a3f0d){return function(_0x3e2341){logger[_0x8dba('0xc')]('data',JSON[_0x8dba('0x29')](_0x3e2341));if(_0x2a3f0d[_0x8dba('0xe')]&&_0x2a3f0d[_0x8dba('0xe')]['Smtp']&&!_[_0x8dba('0x33')](_0x2a3f0d[_0x8dba('0x1a')])){setTimeout(handleSendEmail(_0x2a3f0d,_0x3e2341),0x3c*0x3e8);}};}function handleJob(_0x49e73c){return function(){try{if(_[_0x8dba('0x33')](_0x49e73c[_0x8dba('0x34')])){return logger[_0x8dba('0xc')](_0x8dba('0x35'));}if(_['isNil'](_0x49e73c['subtractUnit'])){return logger[_0x8dba('0xc')](_0x8dba('0x36'));}var _0x4996f0={'startDate':moment()[_0x8dba('0x37')](_0x49e73c['subtractNumber'],_0x49e73c[_0x8dba('0x1c')])[_0x8dba('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x8dba('0x17')](_0x8dba('0x38')),'type':'scheduled','output':_0x49e73c[_0x8dba('0x39')],'name':_0x49e73c[_0x8dba('0x19')]};if(!_[_0x8dba('0x33')](_0x49e73c[_0x8dba('0x3a')])){logger['info'](_0x8dba('0x3b'),_0x49e73c['DefaultReportId']);return analyticDefaultReportController[_0x8dba('0x3c')]({'id':_0x49e73c[_0x8dba('0x3a')]},_0x4996f0)[_0x8dba('0x2e')](handleResult(_0x49e73c))[_0x8dba('0x32')](handleError());}if(!_[_0x8dba('0x33')](_0x49e73c[_0x8dba('0x3d')])){logger[_0x8dba('0xc')](_0x8dba('0x3e'),_0x49e73c[_0x8dba('0x3d')]);return analyticCustomReportController[_0x8dba('0x3c')]({'id':_0x49e73c[_0x8dba('0x3d')]},_0x4996f0)['then'](handleResult(_0x49e73c))[_0x8dba('0x32')](handleError());}}catch(_0x3de9bb){logger[_0x8dba('0x2f')](JSON[_0x8dba('0x29')](_0x3de9bb));}return logger[_0x8dba('0xc')](_0x8dba('0x3f'));};}function getJobs(_0x447a4a){var _0x5a7a0f={};if(_0x447a4a){_0x5a7a0f['id']=_0x447a4a;}return db[_0x8dba('0x40')][_0x8dba('0x41')]({'where':_0x5a7a0f,'include':[{'model':db['MailAccount'],'attributes':['id',_0x8dba('0x19'),_0x8dba('0x1a')],'include':[{'model':db['MailServerOut'],'as':'Smtp'}]}]})[_0x8dba('0x2e')](function(_0x5176cf){var _0x5748c1=_[_0x8dba('0x42')](manager[_0x8dba('0x43')]);var _0x56afe1=_[_0x8dba('0x44')](_0x5176cf,function(_0x787820){return _0x787820['id']['toString']();});var _0x4b7403=_[_0x8dba('0x45')](_0x5176cf,function(_0x12ee9d){return _0x12ee9d['id']['toString']();});var _0x329c1d=_0x447a4a?_0x56afe1:_[_0x8dba('0x46')](_0x56afe1,_0x5748c1);var _0x420317=_[_0x8dba('0x47')](_0x56afe1,_0x5748c1);var _0x3e5a97=_[_0x8dba('0x46')](_0x5748c1,_0x56afe1);var _0x392c92;var _0x4a8543;for(_0x392c92=0x0;_0x392c92<_0x3e5a97[_0x8dba('0x48')]&&!_0x447a4a;_0x392c92+=0x1){_0x4a8543=_0x3e5a97[_0x392c92][_0x8dba('0x49')]();if(manager['exists'](_0x4a8543)){manager[_0x8dba('0x4a')](_0x4a8543);manager[_0x8dba('0x4b')](_0x4a8543);logger[_0x8dba('0xc')](_0x8dba('0x4c'),_0x4a8543);}}logger[_0x8dba('0xc')](_0x8dba('0x4d'),JSON[_0x8dba('0x29')](_0x329c1d));for(_0x392c92=0x0;_0x392c92<_0x329c1d[_0x8dba('0x48')];_0x392c92+=0x1){_0x4a8543=_0x329c1d[_0x392c92]['toString']();logger['info']('index',_0x4a8543);if(_0x447a4a){logger[_0x8dba('0xc')](_0x8dba('0x4e'),_0x447a4a);logger[_0x8dba('0xc')](JSON['stringify'](_0x4b7403[_0x4a8543]));BPromise[_0x8dba('0x4f')]()[_0x8dba('0x2e')](handleJob(_0x4b7403[_0x4a8543]));logger[_0x8dba('0xc')](_0x8dba('0x50'),_0x4b7403[_0x4a8543][_0x8dba('0x19')],_0x4b7403[_0x4a8543][_0x8dba('0x51')]);}else if(_0x4b7403[_0x4a8543]['cron']&&_0x4b7403[_0x4a8543][_0x8dba('0x52')]&&moment()[_0x8dba('0x53')](_0x4b7403[_0x4a8543][_0x8dba('0x54')],_0x4b7403[_0x4a8543][_0x8dba('0x55')])){manager[_0x8dba('0x56')](_0x4a8543,_0x4b7403[_0x4a8543][_0x8dba('0x51')],handleJob(_0x4b7403[_0x4a8543]));manager[_0x8dba('0x57')](_0x4a8543);logger[_0x8dba('0xc')](_0x8dba('0x58'),_0x4b7403[_0x4a8543]['name'],_0x4b7403[_0x4a8543][_0x8dba('0x51')]);}else if(manager[_0x8dba('0x59')](_0x4a8543)){manager[_0x8dba('0x4a')](_0x4a8543);manager[_0x8dba('0x4b')](_0x4a8543);logger[_0x8dba('0xc')](_0x8dba('0x5a'),_0x4b7403[_0x4a8543][_0x8dba('0x19')],_0x4b7403[_0x4a8543][_0x8dba('0x51')]);}}for(_0x392c92=0x0,_0x4a8543;_0x392c92<_0x420317[_0x8dba('0x48')]&&!_0x447a4a;_0x392c92+=0x1){_0x4a8543=_0x420317[_0x392c92][_0x8dba('0x49')]();if(manager['exists'](_0x4a8543)){if(_0x4b7403[_0x4a8543]['cron']&&_0x4b7403[_0x4a8543][_0x8dba('0x52')]&&moment()[_0x8dba('0x53')](_0x4b7403[_0x4a8543]['startAt'],_0x4b7403[_0x4a8543][_0x8dba('0x55')])){manager[_0x8dba('0x5b')](_0x4a8543,_0x4b7403[_0x4a8543][_0x8dba('0x51')],handleJob(_0x4b7403[_0x4a8543]));logger['info'](_0x8dba('0x5c'),_0x4b7403[_0x4a8543][_0x8dba('0x19')],_0x4b7403[_0x4a8543][_0x8dba('0x51')]);}else{manager[_0x8dba('0x4a')](_0x4a8543);manager['deleteJob'](_0x4a8543);logger[_0x8dba('0xc')](_0x8dba('0x5a'),_0x4b7403[_0x4a8543]['name'],_0x4b7403[_0x4a8543][_0x8dba('0x51')]);}}}})[_0x8dba('0x32')](function(_0x3ba7f5){logger[_0x8dba('0x2f')](JSON['stringify'](_0x3ba7f5));});}exports[_0x8dba('0x5d')]=function(_0x418a6b){return getJobs(_0x418a6b);};exports[_0x8dba('0x57')]=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 ab17197..cbe983f 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 _0x3423=['[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','then','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','CloudProvider','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','error','start','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update'];(function(_0x57f7af,_0x4a262a){var _0x1cef18=function(_0xf8889b){while(--_0xf8889b){_0x57f7af['push'](_0x57f7af['shift']());}};_0x1cef18(++_0x4a262a);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0x3342('0x0'));var util=require(_0x3342('0x1'));var BPromise=require(_0x3342('0x2'));var db=require(_0x3342('0x3'))['db'];var logger=require(_0x3342('0x4'))(_0x3342('0x5'));function getTranscriptionJob(_0x2207ce,_0x3c5d8d,_0x3075f8,_0x19206f){return new Promise(function(_0x467453,_0x2ccbe0){var _0x29c40c=new AWS[(_0x3342('0x6'))]({'accessKeyId':_0x3c5d8d,'secretAccessKey':_0x2207ce,'region':_0x3075f8});_0x29c40c[_0x3342('0x7')]({'TranscriptionJobName':_0x19206f},function(_0xce08ab,_0x305d13){if(_0xce08ab){return _0x2ccbe0(_0xce08ab);}else{return _0x467453(_0x305d13);}});});}function sentiment(_0xd9d129,_0x9cc419,_0x4ae4f3,_0x582c37,_0x2d0cb0){return new Promise(function(_0x481a17,_0x5a1fba){var _0x51b276=new AWS['Comprehend']({'accessKeyId':_0x9cc419,'secretAccessKey':_0xd9d129,'region':_0x4ae4f3});_0x51b276[_0x3342('0x8')]({'Text':_0x582c37,'LanguageCode':_0x2d0cb0[_0x3342('0x9')](0x0,0x2)},function(_0x51496d,_0x2d14c4){if(_0x51496d){return _0x5a1fba(_0x51496d);}else{return _0x481a17(_0x2d14c4);}});});}function checkTranscribeJob(_0x5a3cb1,_0x716d80,_0x36e1f4){var _0x592ba8;return new BPromise(function(_0x3e418d,_0x334f0e){logger[_0x3342('0xa')](util[_0x3342('0xb')](_0x3342('0xc'),_0x5a3cb1['id'],_0x5a3cb1[_0x3342('0xd')]));return getTranscriptionJob(_0x36e1f4[_0x3342('0xe')],_0x36e1f4['data2'],_0x716d80[_0x3342('0xf')],_0x5a3cb1[_0x3342('0xd')])['then'](function(_0x40d609){logger[_0x3342('0xa')](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x5a3cb1['id'],_0x5a3cb1[_0x3342('0xd')],_0x40d609[_0x3342('0x10')][_0x3342('0x11')]));if(!_0x5a3cb1[_0x3342('0x12')]){switch(_0x40d609[_0x3342('0x10')][_0x3342('0x11')]){case _0x3342('0x13'):var _0x3ebf6b={'transcribeStatus':_0x40d609[_0x3342('0x10')]['TranscriptionJobStatus'],'fileUri':_0x40d609[_0x3342('0x10')][_0x3342('0x14')][_0x3342('0x15')]};logger['info'](util[_0x3342('0xb')](_0x3342('0x16'),_0x5a3cb1['id']));return rp({'uri':_0x40d609['TranscriptionJob'][_0x3342('0x14')][_0x3342('0x15')],'json':!![]})['then'](function(_0x4e1b19){logger['info'](util[_0x3342('0xb')](_0x3342('0x17'),_0x5a3cb1['id']));if(_0x4e1b19&&_0x4e1b19[_0x3342('0x18')]&&_0x4e1b19[_0x3342('0x18')][_0x3342('0x19')]&&_0x4e1b19[_0x3342('0x18')][_0x3342('0x19')][_0x3342('0x1a')]){_0x3ebf6b['fileText']='';for(var _0x30ffc9=0x0;_0x30ffc9<_0x4e1b19['results']['transcripts'][_0x3342('0x1a')];_0x30ffc9++){_0x3ebf6b['fileText']+=_0x4e1b19['results'][_0x3342('0x19')][_0x30ffc9]['transcript']+'';}}return _0x5a3cb1[_0x3342('0x1b')](_0x3ebf6b);})['then'](function(){logger['info'](util['format'](_0x3342('0x1c'),_0x5a3cb1['id']));if(!_0x5a3cb1[_0x3342('0x1d')]){throw new db[(_0x3342('0x1e'))]['ValidationError'](_0x3342('0x1f'));}if(!_0x716d80[_0x3342('0x20')]||!_0x716d80[_0x3342('0x21')]||!_0x716d80[_0x3342('0x22')]||!_0x716d80['language']||!_0x716d80[_0x3342('0x23')]){throw new db[(_0x3342('0x1e'))][(_0x3342('0x24'))](_0x3342('0x25'));}if(!_0x3ebf6b[_0x3342('0x12')]){throw new Error(_0x3342('0x26'));}if(_0x716d80[_0x3342('0x21')]===_0x36e1f4['id']){return _0x36e1f4;}else{return db['CloudProvider'][_0x3342('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x3342('0x28')](function(_0x407f8c){if(!_0x407f8c){throw new db['Sequelize'][(_0x3342('0x24'))](_0x3342('0x29'));}if(!_0x407f8c[_0x3342('0xe')]||!_0x407f8c[_0x3342('0x2a')]){throw new db['Sequelize'][(_0x3342('0x24'))](_0x3342('0x2b'));}_0x592ba8=_0x407f8c;logger[_0x3342('0xa')](util[_0x3342('0xb')](_0x3342('0x2c'),_0x5a3cb1['id']));return sentiment(_0x592ba8[_0x3342('0xe')],_0x592ba8[_0x3342('0x2a')],_0x716d80[_0x3342('0x22')],_0x3ebf6b[_0x3342('0x12')],_0x716d80[_0x3342('0x2d')]);})[_0x3342('0x28')](function(_0x30dcea){logger['info'](util['format'](_0x3342('0x2e'),_0x5a3cb1['id']));return _0x5a3cb1['update']({'sentiment':_0x30dcea[_0x3342('0x2f')],'sPositive':_0x30dcea[_0x3342('0x30')][_0x3342('0x31')],'sNegative':_0x30dcea[_0x3342('0x30')][_0x3342('0x32')],'sMixed':_0x30dcea[_0x3342('0x30')][_0x3342('0x33')],'sNeutral':_0x30dcea['SentimentScore'][_0x3342('0x34')]});})[_0x3342('0x28')](function(){logger[_0x3342('0xa')](util[_0x3342('0xb')](_0x3342('0x1c'),_0x5a3cb1['id']));_0x3e418d();});case'FAILED':return _0x5a3cb1[_0x3342('0x1b')]({'transcribeStatus':'FAILED','failureReason':_0x40d609[_0x3342('0x10')][_0x3342('0x35')]})[_0x3342('0x28')](function(){logger[_0x3342('0xa')](util['format'](_0x3342('0x1c'),_0x5a3cb1['id']));_0x3e418d();});default:logger['info'](util[_0x3342('0xb')](_0x3342('0x36'),_0x5a3cb1['id']));break;}}else{return BPromise[_0x3342('0x37')]()[_0x3342('0x28')](function(){if(!_0x5a3cb1[_0x3342('0x1d')]){throw new db[(_0x3342('0x1e'))][(_0x3342('0x24'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x716d80[_0x3342('0x20')]||!_0x716d80[_0x3342('0x21')]||!_0x716d80['sentimentRegion']||!_0x716d80[_0x3342('0x2d')]||!_0x716d80[_0x3342('0x23')]){throw new db['Sequelize'][(_0x3342('0x24'))](_0x3342('0x25'));}if(!_0x5a3cb1['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x716d80['sentimentAccountId']===_0x36e1f4['id']){return _0x36e1f4;}else{return db[_0x3342('0x38')][_0x3342('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x3342('0x28')](function(_0x2a1f7e){if(!_0x2a1f7e){throw new db[(_0x3342('0x1e'))][(_0x3342('0x24'))](_0x3342('0x29'));}if(!_0x2a1f7e[_0x3342('0xe')]||!_0x2a1f7e[_0x3342('0x2a')]){throw new db[(_0x3342('0x1e'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x592ba8=_0x2a1f7e;logger[_0x3342('0xa')](util[_0x3342('0xb')](_0x3342('0x2c'),_0x5a3cb1['id']));return sentiment(_0x592ba8[_0x3342('0xe')],_0x592ba8[_0x3342('0x2a')],_0x716d80[_0x3342('0x22')],_0x5a3cb1['fileText'],_0x716d80[_0x3342('0x2d')]);})[_0x3342('0x28')](function(_0x283ce9){logger[_0x3342('0xa')](util[_0x3342('0xb')](_0x3342('0x2e'),_0x5a3cb1['id']));return _0x5a3cb1['update']({'sentiment':_0x283ce9[_0x3342('0x2f')],'sPositive':_0x283ce9['SentimentScore'][_0x3342('0x31')],'sNegative':_0x283ce9[_0x3342('0x30')][_0x3342('0x32')],'sMixed':_0x283ce9[_0x3342('0x30')]['Mixed'],'sNeutral':_0x283ce9[_0x3342('0x30')][_0x3342('0x34')],'transcribeStatus':'COMPLETED'});})[_0x3342('0x28')](function(){logger[_0x3342('0xa')](util[_0x3342('0xb')](_0x3342('0x1c'),_0x5a3cb1['id']));_0x3e418d();});}})['catch'](function(_0x2e2ebc){if(_0x2e2ebc){if(!_0x2e2ebc[_0x3342('0x39')]||_0x2e2ebc['name']!==_0x3342('0x3a')){logger['error'](util['format'](_0x3342('0x3b'),_0x5a3cb1['id']),util[_0x3342('0x3c')](_0x2e2ebc,{'showHidden':![],'depth':null}));}}_0x3e418d();});});}function checkTranscribe(){var _0x346534;var _0x296cbb;var _0x23925e;return db[_0x3342('0x3d')][_0x3342('0x3e')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x3817fd){if(!_0x3817fd||!_0x3817fd['length']){throw new db[(_0x3342('0x1e'))]['ValidationError']('No\x20transcribe\x20job\x20to\x20check');}_0x346534=_0x3817fd;return db['Setting'][_0x3342('0x27')]({'where':{'id':0x1}});})[_0x3342('0x28')](function(_0x29ccb6){if(!_0x29ccb6){throw new db[(_0x3342('0x1e'))]['ValidationError'](_0x3342('0x3f'));}_0x296cbb=_0x29ccb6;if(!_0x296cbb[_0x3342('0x5')]||!_0x296cbb['transcribeAccountId']||!_0x296cbb[_0x3342('0xf')]||!_0x296cbb[_0x3342('0x2d')]||!_0x296cbb[_0x3342('0x23')]){throw new db['Sequelize'][(_0x3342('0x24'))](_0x3342('0x40'));}return db[_0x3342('0x38')][_0x3342('0x27')]({'where':{'id':_0x296cbb[_0x3342('0x41')]}});})['then'](function(_0x2699d2){if(!_0x2699d2){throw new db[(_0x3342('0x1e'))][(_0x3342('0x24'))](_0x3342('0x29'));}if(!_0x2699d2[_0x3342('0xe')]||!_0x2699d2[_0x3342('0x2a')]){throw new db[(_0x3342('0x1e'))][(_0x3342('0x24'))](_0x3342('0x2b'));}_0x23925e=_0x2699d2;var _0x542181=[];_0x346534[_0x3342('0x42')](function(_0x4eebaa){_0x542181[_0x3342('0x43')](checkTranscribeJob(_0x4eebaa,_0x296cbb,_0x23925e));});return BPromise['all'](_0x542181);})['catch'](function(_0x5bff74){if(_0x5bff74){if(!_0x5bff74['name']||_0x5bff74[_0x3342('0x39')]!==_0x3342('0x3a')){logger[_0x3342('0x44')](util[_0x3342('0x3c')](_0x5bff74,{'showHidden':![],'depth':null}));}}});}exports[_0x3342('0x45')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xb921=['TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','ValidationError','sentiment','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','sentimentAccountId','CloudProvider','findOne','Sequelize','Cloud\x20Provider\x20not\x20available','data2','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Negative','SentimentScore','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Sentiment\x20Analysis\x20not\x20requested','Transcript\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Positive','COMPLETED','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','error','start','lodash','aws-sdk','request-promise','util','bluebird','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s'];(function(_0x26a898,_0x20fd99){var _0xac386c=function(_0x10310e){while(--_0x10310e){_0x26a898['push'](_0x26a898['shift']());}};_0xac386c(++_0x20fd99);}(_0xb921,0x16a));var _0x1b92=function(_0x161d41,_0x306119){_0x161d41=_0x161d41-0x0;var _0x21daf6=_0xb921[_0x161d41];return _0x21daf6;};var _=require(_0x1b92('0x0'));var AWS=require(_0x1b92('0x1'));var rp=require(_0x1b92('0x2'));var util=require(_0x1b92('0x3'));var BPromise=require(_0x1b92('0x4'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x1b92('0x5'));function getTranscriptionJob(_0xc3832e,_0x1e49a8,_0x10868d,_0x464cc4){return new Promise(function(_0x29a1db,_0x4358e3){var _0x8a6282=new AWS[(_0x1b92('0x6'))]({'accessKeyId':_0x1e49a8,'secretAccessKey':_0xc3832e,'region':_0x10868d});_0x8a6282[_0x1b92('0x7')]({'TranscriptionJobName':_0x464cc4},function(_0x1545f9,_0x64a3ed){if(_0x1545f9){return _0x4358e3(_0x1545f9);}else{return _0x29a1db(_0x64a3ed);}});});}function sentiment(_0x2cf050,_0x37b876,_0x4567ab,_0x4c8e30,_0x31e314){return new Promise(function(_0x1e5802,_0x154b6d){var _0x146d68=new AWS[(_0x1b92('0x8'))]({'accessKeyId':_0x37b876,'secretAccessKey':_0x2cf050,'region':_0x4567ab});_0x146d68[_0x1b92('0x9')]({'Text':_0x4c8e30,'LanguageCode':_0x31e314[_0x1b92('0xa')](0x0,0x2)},function(_0x4aee95,_0x352b18){if(_0x4aee95){return _0x154b6d(_0x4aee95);}else{return _0x1e5802(_0x352b18);}});});}function checkTranscribeJob(_0x3b5e5b,_0x5a1ca5,_0x81cbe0){var _0x29a7ed;return new BPromise(function(_0x2c07a4,_0x178f66){logger[_0x1b92('0xb')](util[_0x1b92('0xc')](_0x1b92('0xd'),_0x3b5e5b['id'],_0x3b5e5b['transcribeName']));return getTranscriptionJob(_0x81cbe0[_0x1b92('0xe')],_0x81cbe0['data2'],_0x5a1ca5[_0x1b92('0xf')],_0x3b5e5b['transcribeName'])[_0x1b92('0x10')](function(_0x523285){logger[_0x1b92('0xb')](util[_0x1b92('0xc')](_0x1b92('0x11'),_0x3b5e5b['id'],_0x3b5e5b['transcribeName'],_0x523285[_0x1b92('0x12')][_0x1b92('0x13')]));if(!_0x3b5e5b[_0x1b92('0x14')]){switch(_0x523285[_0x1b92('0x12')][_0x1b92('0x13')]){case'COMPLETED':var _0x4024bf={'transcribeStatus':_0x523285[_0x1b92('0x12')][_0x1b92('0x13')],'fileUri':_0x523285['TranscriptionJob'][_0x1b92('0x15')][_0x1b92('0x16')]};logger[_0x1b92('0xb')](util['format'](_0x1b92('0x17'),_0x3b5e5b['id']));return rp({'uri':_0x523285['TranscriptionJob'][_0x1b92('0x15')][_0x1b92('0x16')],'json':!![]})['then'](function(_0x4ea25f){logger[_0x1b92('0xb')](util[_0x1b92('0xc')](_0x1b92('0x18'),_0x3b5e5b['id']));if(_0x4ea25f&&_0x4ea25f[_0x1b92('0x19')]&&_0x4ea25f[_0x1b92('0x19')][_0x1b92('0x1a')]&&_0x4ea25f['results'][_0x1b92('0x1a')][_0x1b92('0x1b')]){_0x4024bf[_0x1b92('0x14')]='';for(var _0x39dcaa=0x0;_0x39dcaa<_0x4ea25f['results'][_0x1b92('0x1a')]['length'];_0x39dcaa++){_0x4024bf[_0x1b92('0x14')]+=_0x4ea25f[_0x1b92('0x19')][_0x1b92('0x1a')][_0x39dcaa][_0x1b92('0x1c')]+'';}}return _0x3b5e5b[_0x1b92('0x1d')](_0x4024bf);})[_0x1b92('0x10')](function(){logger[_0x1b92('0xb')](util[_0x1b92('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3b5e5b['id']));if(!_0x3b5e5b['tempSentiment']){throw new db['Sequelize'][(_0x1b92('0x1e'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x5a1ca5[_0x1b92('0x1f')]||!_0x5a1ca5['sentimentAccountId']||!_0x5a1ca5[_0x1b92('0x20')]||!_0x5a1ca5[_0x1b92('0x21')]||!_0x5a1ca5[_0x1b92('0x22')]){throw new db['Sequelize'][(_0x1b92('0x1e'))](_0x1b92('0x23'));}if(!_0x4024bf['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x5a1ca5[_0x1b92('0x24')]===_0x81cbe0['id']){return _0x81cbe0;}else{return db[_0x1b92('0x25')][_0x1b92('0x26')]({'where':{'id':_settings[_0x1b92('0x24')]}});}})[_0x1b92('0x10')](function(_0x50eddf){if(!_0x50eddf){throw new db[(_0x1b92('0x27'))][(_0x1b92('0x1e'))](_0x1b92('0x28'));}if(!_0x50eddf[_0x1b92('0xe')]||!_0x50eddf[_0x1b92('0x29')]){throw new db[(_0x1b92('0x27'))][(_0x1b92('0x1e'))]('Cloud\x20Provider\x20not\x20configured');}_0x29a7ed=_0x50eddf;logger[_0x1b92('0xb')](util[_0x1b92('0xc')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x3b5e5b['id']));return sentiment(_0x29a7ed[_0x1b92('0xe')],_0x29a7ed[_0x1b92('0x29')],_0x5a1ca5[_0x1b92('0x20')],_0x4024bf['fileText'],_0x5a1ca5[_0x1b92('0x21')]);})[_0x1b92('0x10')](function(_0x5cce14){logger['info'](util[_0x1b92('0xc')](_0x1b92('0x2a'),_0x3b5e5b['id']));return _0x3b5e5b[_0x1b92('0x1d')]({'sentiment':_0x5cce14[_0x1b92('0x2b')],'sPositive':_0x5cce14['SentimentScore']['Positive'],'sNegative':_0x5cce14['SentimentScore'][_0x1b92('0x2c')],'sMixed':_0x5cce14[_0x1b92('0x2d')][_0x1b92('0x2e')],'sNeutral':_0x5cce14[_0x1b92('0x2d')][_0x1b92('0x2f')]});})[_0x1b92('0x10')](function(){logger[_0x1b92('0xb')](util['format'](_0x1b92('0x30'),_0x3b5e5b['id']));_0x2c07a4();});case _0x1b92('0x31'):return _0x3b5e5b['update']({'transcribeStatus':_0x1b92('0x31'),'failureReason':_0x523285[_0x1b92('0x12')][_0x1b92('0x32')]})[_0x1b92('0x10')](function(){logger[_0x1b92('0xb')](util[_0x1b92('0xc')](_0x1b92('0x30'),_0x3b5e5b['id']));_0x2c07a4();});default:logger[_0x1b92('0xb')](util[_0x1b92('0xc')](_0x1b92('0x33'),_0x3b5e5b['id']));break;}}else{return BPromise['resolve']()[_0x1b92('0x10')](function(){if(!_0x3b5e5b['tempSentiment']){throw new db[(_0x1b92('0x27'))]['ValidationError'](_0x1b92('0x34'));}if(!_0x5a1ca5[_0x1b92('0x1f')]||!_0x5a1ca5[_0x1b92('0x24')]||!_0x5a1ca5[_0x1b92('0x20')]||!_0x5a1ca5[_0x1b92('0x21')]||!_0x5a1ca5[_0x1b92('0x22')]){throw new db[(_0x1b92('0x27'))][(_0x1b92('0x1e'))](_0x1b92('0x23'));}if(!_0x3b5e5b['fileText']){throw new Error(_0x1b92('0x35'));}if(_0x5a1ca5['sentimentAccountId']===_0x81cbe0['id']){return _0x81cbe0;}else{return db[_0x1b92('0x25')][_0x1b92('0x26')]({'where':{'id':_settings[_0x1b92('0x24')]}});}})[_0x1b92('0x10')](function(_0x52a982){if(!_0x52a982){throw new db[(_0x1b92('0x27'))][(_0x1b92('0x1e'))](_0x1b92('0x28'));}if(!_0x52a982[_0x1b92('0xe')]||!_0x52a982[_0x1b92('0x29')]){throw new db[(_0x1b92('0x27'))]['ValidationError'](_0x1b92('0x36'));}_0x29a7ed=_0x52a982;logger[_0x1b92('0xb')](util[_0x1b92('0xc')](_0x1b92('0x37'),_0x3b5e5b['id']));return sentiment(_0x29a7ed[_0x1b92('0xe')],_0x29a7ed[_0x1b92('0x29')],_0x5a1ca5['sentimentRegion'],_0x3b5e5b[_0x1b92('0x14')],_0x5a1ca5[_0x1b92('0x21')]);})['then'](function(_0x4af49c){logger['info'](util[_0x1b92('0xc')](_0x1b92('0x2a'),_0x3b5e5b['id']));return _0x3b5e5b[_0x1b92('0x1d')]({'sentiment':_0x4af49c['Sentiment'],'sPositive':_0x4af49c[_0x1b92('0x2d')][_0x1b92('0x38')],'sNegative':_0x4af49c['SentimentScore']['Negative'],'sMixed':_0x4af49c['SentimentScore'][_0x1b92('0x2e')],'sNeutral':_0x4af49c[_0x1b92('0x2d')][_0x1b92('0x2f')],'transcribeStatus':_0x1b92('0x39')});})[_0x1b92('0x10')](function(){logger[_0x1b92('0xb')](util['format'](_0x1b92('0x30'),_0x3b5e5b['id']));_0x2c07a4();});}})[_0x1b92('0x3a')](function(_0x498012){if(_0x498012){if(!_0x498012[_0x1b92('0x3b')]||_0x498012[_0x1b92('0x3b')]!==_0x1b92('0x3c')){logger['error'](util[_0x1b92('0xc')](_0x1b92('0x3d'),_0x3b5e5b['id']),util[_0x1b92('0x3e')](_0x498012,{'showHidden':![],'depth':null}));}}_0x2c07a4();});});}function checkTranscribe(){var _0x3d57d3;var _0x199c29;var _0x5ac096;return db[_0x1b92('0x3f')][_0x1b92('0x40')]({'where':{'transcribeStatus':_0x1b92('0x41')}})[_0x1b92('0x10')](function(_0x619e35){if(!_0x619e35||!_0x619e35['length']){throw new db['Sequelize'][(_0x1b92('0x1e'))](_0x1b92('0x42'));}_0x3d57d3=_0x619e35;return db[_0x1b92('0x43')][_0x1b92('0x26')]({'where':{'id':0x1}});})['then'](function(_0x4e0954){if(!_0x4e0954){throw new db[(_0x1b92('0x27'))]['ValidationError'](_0x1b92('0x44'));}_0x199c29=_0x4e0954;if(!_0x199c29[_0x1b92('0x5')]||!_0x199c29[_0x1b92('0x45')]||!_0x199c29['transcribeRegion']||!_0x199c29[_0x1b92('0x21')]||!_0x199c29[_0x1b92('0x22')]){throw new db[(_0x1b92('0x27'))][(_0x1b92('0x1e'))](_0x1b92('0x46'));}return db[_0x1b92('0x25')][_0x1b92('0x26')]({'where':{'id':_0x199c29[_0x1b92('0x45')]}});})['then'](function(_0x140202){if(!_0x140202){throw new db['Sequelize'][(_0x1b92('0x1e'))](_0x1b92('0x28'));}if(!_0x140202[_0x1b92('0xe')]||!_0x140202[_0x1b92('0x29')]){throw new db[(_0x1b92('0x27'))][(_0x1b92('0x1e'))](_0x1b92('0x36'));}_0x5ac096=_0x140202;var _0x32d994=[];_0x3d57d3[_0x1b92('0x47')](function(_0x23e03a){_0x32d994[_0x1b92('0x48')](checkTranscribeJob(_0x23e03a,_0x199c29,_0x5ac096));});return BPromise[_0x1b92('0x49')](_0x32d994);})[_0x1b92('0x3a')](function(_0x181e03){if(_0x181e03){if(!_0x181e03[_0x1b92('0x3b')]||_0x181e03[_0x1b92('0x3b')]!==_0x1b92('0x3c')){logger[_0x1b92('0x4a')](util[_0x1b92('0x3e')](_0x181e03,{'showHidden':![],'depth':null}));}}});}exports[_0x1b92('0x4b')]=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 5b86081..9c4044a 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 _0x353f=['emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','moment','util','../../config/environment','../logger','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','hours','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:'];(function(_0x5a90cb,_0x4de316){var _0x331166=function(_0x38a3a7){while(--_0x38a3a7){_0x5a90cb['push'](_0x5a90cb['shift']());}};_0x331166(++_0x4de316);}(_0x353f,0x1d7));var _0xf353=function(_0x91d709,_0x4f8974){_0x91d709=_0x91d709-0x0;var _0x1e42f6=_0x353f[_0x91d709];return _0x1e42f6;};'use strict';var _=require('lodash');var moment=require(_0xf353('0x0'));var Redis=require('ioredis');var util=require(_0xf353('0x1'));var config=require(_0xf353('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xf353('0x3'))(_0xf353('0x4'));config[_0xf353('0x5')]=_['defaults'](config[_0xf353('0x5')],{'host':_0xf353('0x6'),'port':0x18eb});var io=require(_0xf353('0x7'))(new Redis(config['redis']));function closeInteractions(){var _0x58c82a=[];return db[_0xf353('0x8')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xf353('0x9'))}}})[_0xf353('0xa')](function(_0x3d55d9){if(_0x3d55d9&&_0x3d55d9[_0xf353('0xb')]){_0x58c82a=_[_0xf353('0xc')](_0x3d55d9||[],'id');logger['info'](_0xf353('0xd'),_0x58c82a[_0xf353('0xe')]());return db['WhatsappInteraction'][_0xf353('0xf')]({'closeReason':_0xf353('0x10'),'disposition':_0xf353('0x11'),'closed':!![],'closedAt':moment()[_0xf353('0x12')](_0xf353('0x13'))},{'where':{'id':_0x58c82a}});}})[_0xf353('0xa')](function(){if(_0x58c82a&&_0x58c82a['length']){logger[_0xf353('0x14')](_0xf353('0x15'),_0x58c82a[_0xf353('0xe')]());for(var _0x599f7a=0x0;_0x599f7a<_0x58c82a[_0xf353('0xb')];_0x599f7a++){io[_0xf353('0x16')](_0xf353('0x17'),{'id':_0x58c82a[_0x599f7a],'closed':!![]});}}})[_0xf353('0x18')](function(_0x236253){logger[_0xf353('0x19')](_0xf353('0x1a'),_0x236253?util[_0xf353('0x1b')](_0x236253,{'showHidden':![],'depth':null}):'');});}exports[_0xf353('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x90ac=['hours','length','map','join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','ioredis','util','../../config/environment','../../mysqldb','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt'];(function(_0x10d8e5,_0x22bc56){var _0x5c3923=function(_0x5f3bab){while(--_0x5f3bab){_0x10d8e5['push'](_0x10d8e5['shift']());}};_0x5c3923(++_0x22bc56);}(_0x90ac,0x1b4));var _0xc90a=function(_0x107b59,_0x283272){_0x107b59=_0x107b59-0x0;var _0xfac415=_0x90ac[_0x107b59];return _0xfac415;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0xc90a('0x0'));var util=require(_0xc90a('0x1'));var config=require(_0xc90a('0x2'));var db=require(_0xc90a('0x3'))['db'];var logger=require('../logger')(_0xc90a('0x4'));config[_0xc90a('0x5')]=_[_0xc90a('0x6')](config[_0xc90a('0x5')],{'host':_0xc90a('0x7'),'port':0x18eb});var io=require(_0xc90a('0x8'))(new Redis(config[_0xc90a('0x5')]));function closeInteractions(){var _0x439866=[];return db[_0xc90a('0x9')][_0xc90a('0xa')]({'raw':!![],'attributes':['id',_0xc90a('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xc90a('0xc'))}}})['then'](function(_0x577c44){if(_0x577c44&&_0x577c44[_0xc90a('0xd')]){_0x439866=_[_0xc90a('0xe')](_0x577c44||[],'id');logger['info']('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x439866[_0xc90a('0xf')]());return db[_0xc90a('0x9')][_0xc90a('0x10')]({'closeReason':'system','disposition':_0xc90a('0x11'),'closed':!![],'closedAt':moment()[_0xc90a('0x12')](_0xc90a('0x13'))},{'where':{'id':_0x439866}});}})[_0xc90a('0x14')](function(){if(_0x439866&&_0x439866['length']){logger['info'](_0xc90a('0x15'),_0x439866[_0xc90a('0xf')]());for(var _0x3859bc=0x0;_0x3859bc<_0x439866[_0xc90a('0xd')];_0x3859bc++){io[_0xc90a('0x16')]('whatsappInteraction:update',{'id':_0x439866[_0x3859bc],'closed':!![]});}}})[_0xc90a('0x17')](function(_0x2d065d){logger[_0xc90a('0x18')](_0xc90a('0x19'),_0x2d065d?util[_0xc90a('0x1a')](_0x2d065d,{'showHidden':![],'depth':null}):'');});}exports[_0xc90a('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index e88f941..889467e 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x30ac=['now','innocenzo.biondo','destroy','then','CmContact','bulkCreate','finished\x20populating','contacts1','CmHopper','log','hopper2','util','../mysqldb','push','Innocenzo','Biondo','@xcally.com'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x30ac,0x11b));var _0xc30a=function(_0x5ac9b9,_0x1a2212){_0x5ac9b9=_0x5ac9b9-0x0;var _0x4e1ca1=_0x30ac[_0x5ac9b9];return _0x4e1ca1;};'use strict';var util=require(_0xc30a('0x0'));var db=require(_0xc30a('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xc30a('0x2')]({'id':i,'firstName':_0xc30a('0x3')+i,'lastName':_0xc30a('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xc30a('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xc30a('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc30a('0x6')](),'updatedAt':Date[_0xc30a('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xc30a('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xc30a('0x7')+i+_0xc30a('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc30a('0x6')](),'updatedAt':Date['now']()});}db['CmContact'][_0xc30a('0x8')]({'where':{}})[_0xc30a('0x9')](function(){return db[_0xc30a('0xa')][_0xc30a('0xb')](contacts);})['then'](function(){console['log'](_0xc30a('0xc'),_0xc30a('0xd'));return db['CmHopper']['destroy']({'where':{}});})[_0xc30a('0x9')](function(){return db[_0xc30a('0xe')][_0xc30a('0xb')](hopper);})['then'](function(){console[_0xc30a('0xf')]('finished\x20populating','hopper1');return db['CmContact'][_0xc30a('0xb')](contacts2);})[_0xc30a('0x9')](function(){console[_0xc30a('0xf')](_0xc30a('0xc'),'contacts2');return db[_0xc30a('0xe')][_0xc30a('0xb')](hopper2);})[_0xc30a('0x9')](function(){console[_0xc30a('0xf')](_0xc30a('0xc'),_0xc30a('0x10'));})['catch'](function(_0x5165b3){console['log'](_0x5165b3);}); \ No newline at end of file +var _0xd050=['@xcally.com','push','now','CmContact','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','destroy','hopper1','contacts2','hopper2','catch','util','../mysqldb','Innocenzo','Biondo','innocenzo.biondo'];(function(_0x2c5435,_0x1bbff8){var _0x1f7ffe=function(_0x5c6ac3){while(--_0x5c6ac3){_0x2c5435['push'](_0x2c5435['shift']());}};_0x1f7ffe(++_0x1bbff8);}(_0xd050,0x1c7));var _0x0d05=function(_0x4cac8c,_0x2664d2){_0x4cac8c=_0x4cac8c-0x0;var _0x52def9=_0xd050[_0x4cac8c];return _0x52def9;};'use strict';var util=require(_0x0d05('0x0'));var db=require(_0x0d05('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x0d05('0x2')+i,'lastName':_0x0d05('0x3')+i,'phone':0xf879fb460+i,'email':_0x0d05('0x4')+i+_0x0d05('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x0d05('0x6')]({'id':i,'active':![],'scheduledat':Date[_0x0d05('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x0d05('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x0d05('0x6')]({'id':i,'firstName':_0x0d05('0x2')+i,'lastName':_0x0d05('0x3')+i,'phone':0xf879fb460+i,'email':_0x0d05('0x4')+i+_0x0d05('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x0d05('0x6')]({'id':i,'active':![],'scheduledat':Date[_0x0d05('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x0d05('0x7')](),'updatedAt':Date[_0x0d05('0x7')]()});}db[_0x0d05('0x8')]['destroy']({'where':{}})[_0x0d05('0x9')](function(){return db['CmContact'][_0x0d05('0xa')](contacts);})['then'](function(){console[_0x0d05('0xb')](_0x0d05('0xc'),_0x0d05('0xd'));return db[_0x0d05('0xe')][_0x0d05('0xf')]({'where':{}});})[_0x0d05('0x9')](function(){return db[_0x0d05('0xe')]['bulkCreate'](hopper);})['then'](function(){console[_0x0d05('0xb')]('finished\x20populating',_0x0d05('0x10'));return db[_0x0d05('0x8')][_0x0d05('0xa')](contacts2);})[_0x0d05('0x9')](function(){console['log'](_0x0d05('0xc'),_0x0d05('0x11'));return db[_0x0d05('0xe')]['bulkCreate'](hopper2);})[_0x0d05('0x9')](function(){console[_0x0d05('0xb')](_0x0d05('0xc'),_0x0d05('0x12'));})[_0x0d05('0x13')](function(_0x52843e){console[_0x0d05('0xb')](_0x52843e);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 125a311..60ca3e9 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7c92=['bulkCreate','then','log','add\x20user','catch','../mysqldb','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User'];(function(_0x5ce8ce,_0xad22fc){var _0x59497c=function(_0x16acbd){while(--_0x16acbd){_0x5ce8ce['push'](_0x5ce8ce['shift']());}};_0x59497c(++_0xad22fc);}(_0x7c92,0x1d3));var _0x27c9=function(_0x4a9793,_0x10bdb7){_0x4a9793=_0x4a9793-0x0;var _0x16855f=_0x7c92[_0x4a9793];return _0x16855f;};'use strict';var util=require('util');var db=require(_0x27c9('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x27c9('0x1')](_0x27c9('0x2'),_0x27c9('0x3'),i),'fullname':util[_0x27c9('0x1')](_0x27c9('0x2'),'agent',i),'email':util[_0x27c9('0x1')](_0x27c9('0x4'),_0x27c9('0x3'),i),'role':_0x27c9('0x3'),'password':_0x27c9('0x5'),'internal':0xfa0+i,'type':_0x27c9('0x6'),'transport':[_0x27c9('0x7'),'ws',_0x27c9('0x8')],'disallow':[_0x27c9('0x9')],'allow':[_0x27c9('0xa')],'defaultuser':util[_0x27c9('0x1')](_0x27c9('0x2'),_0x27c9('0x3'),i),'encryption':_0x27c9('0xb'),'avpf':'yes','force_avp':_0x27c9('0xb'),'icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x27c9('0xc'),'dtlsprivatekey':_0x27c9('0xd'),'dtlssetup':_0x27c9('0xe'),'callerid':util[_0x27c9('0x1')](_0x27c9('0xf'),util[_0x27c9('0x1')]('%s%s',_0x27c9('0x3'),i),0xfa0+i)});}db[_0x27c9('0x10')][_0x27c9('0x11')](users)[_0x27c9('0x12')](function(){console[_0x27c9('0x13')](_0x27c9('0x14'));})[_0x27c9('0x15')](function(_0x2f5569){console[_0x27c9('0x13')](_0x2f5569);}); \ No newline at end of file +var _0x1ca3=['../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','wss','all','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','util'];(function(_0x4fad65,_0x5e60a0){var _0xb990a3=function(_0x4d7c08){while(--_0x4d7c08){_0x4fad65['push'](_0x4fad65['shift']());}};_0xb990a3(++_0x5e60a0);}(_0x1ca3,0x110));var _0x31ca=function(_0xd9e557,_0x43dabb){_0xd9e557=_0xd9e557-0x0;var _0x9358e6=_0x1ca3[_0xd9e557];return _0x9358e6;};'use strict';var util=require(_0x31ca('0x0'));var db=require(_0x31ca('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x31ca('0x2')]({'name':util[_0x31ca('0x3')](_0x31ca('0x4'),_0x31ca('0x5'),i),'fullname':util[_0x31ca('0x3')](_0x31ca('0x4'),_0x31ca('0x5'),i),'email':util[_0x31ca('0x3')](_0x31ca('0x6'),_0x31ca('0x5'),i),'role':_0x31ca('0x5'),'password':_0x31ca('0x7'),'internal':0xfa0+i,'type':_0x31ca('0x8'),'transport':['udp','ws',_0x31ca('0x9')],'disallow':[_0x31ca('0xa')],'allow':[_0x31ca('0xb')],'defaultuser':util['format'](_0x31ca('0x4'),'agent',i),'encryption':'yes','avpf':'yes','force_avp':_0x31ca('0xc'),'icesupport':_0x31ca('0xc'),'dtlsenable':_0x31ca('0xc'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x31ca('0xd'),'dtlssetup':_0x31ca('0xe'),'callerid':util[_0x31ca('0x3')](_0x31ca('0xf'),util[_0x31ca('0x3')](_0x31ca('0x4'),_0x31ca('0x5'),i),0xfa0+i)});}db[_0x31ca('0x10')][_0x31ca('0x11')](users)[_0x31ca('0x12')](function(){console[_0x31ca('0x13')](_0x31ca('0x14'));})['catch'](function(_0x566051){console['log'](_0x566051);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index d2191bb..a60f4b7 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x87bc=['resourceId','User','where','role','Campaign','type','format','%s:queue:%s','length','query','find','handshake','ChatInteraction','ChatInteractions','MailInteraction','SmsInteraction','SmsInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','user','userProfileId','ChatQueues','WhatsappQueue','Telephones','Trunks','agent','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','user_has_mail_interactions:remove','FaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','connection','setMaxListeners','address','request','remotePort','connectedAt','log','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','lodash','util','../mysqldb','Agents','name','telephone','ivr','UserProfileSection','findOne','then','autoAssociation','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','IvrCampaigns','UserProfileResource','map'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0x87bc,0x189));var _0xc87b=function(_0x19d742,_0x81328b){_0x19d742=_0x19d742-0x0;var _0xfbee15=_0x87bc[_0x19d742];return _0xfbee15;};'use strict';var _=require(_0xc87b('0x0'));var util=require(_0xc87b('0x1'));var BPromise=require('bluebird');var db=require(_0xc87b('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':_0xc87b('0x3'),'model':db['User'],'attributes':['id',_0xc87b('0x4'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0xc87b('0x5')}};var queryTrunks={'raw':!![],'attributes':['id',_0xc87b('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xc87b('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id','name','type'],'where':{'type':_0xc87b('0x6')}};function getAssociatedResources(_0x169bbb,_0x1144cc,_0x19b571){return db[_0xc87b('0x7')][_0xc87b('0x8')]({'where':{'name':_0x169bbb,'userProfileId':_0x1144cc},'raw':!![]})[_0xc87b('0x9')](function(_0x1d834a){if(_0x1d834a){if(_0x1d834a[_0xc87b('0xa')]){switch(_0x169bbb){case'VoiceQueues':case'ChatQueues':case _0xc87b('0xb'):case'SmsQueues':case _0xc87b('0xc'):case _0xc87b('0xd'):case _0xc87b('0xe'):return db[_0x19b571][_0xc87b('0xf')](queryQueues);case'Telephones':return db[_0x19b571][_0xc87b('0xf')](queryTelephones);case'Trunks':return db[_0x19b571][_0xc87b('0xf')](queryTrunks);case _0xc87b('0x10'):return db[_0x19b571]['findAll'](queryCampaigns);}}else{return db[_0xc87b('0x11')][_0xc87b('0xf')]({'attributes':['resourceId'],'where':{'sectionId':_0x1d834a['id']},'raw':!![]})[_0xc87b('0x9')](function(_0x21f1d1){if(_0x21f1d1){var _0x34195e={'where':{'id':_[_0xc87b('0x12')](_0x21f1d1,_0xc87b('0x13'))},'raw':!![]};switch(_0x19b571){case _0xc87b('0x14'):_0x34195e[_0xc87b('0x15')][_0xc87b('0x16')]='telephone';break;case _0xc87b('0x17'):_0x34195e['where'][_0xc87b('0x18')]=_0xc87b('0x6');break;}return db[_0x19b571]['findAll'](_0x34195e);}else{return[];}});}}else{return[];}})[_0xc87b('0x9')](function(_0x372665){return _0x372665;});}function joinOrLeaveQueues(_0x4f56a0,_0x35b58f,_0x4cceeb,_0x36c8c4){_0x4f56a0[_0x35b58f](util[_0xc87b('0x19')](_0xc87b('0x1a'),_0x4cceeb,_0x36c8c4[_0xc87b('0x4')]));if(_0x36c8c4[_0xc87b('0x3')]){for(var _0x211b3c=0x0;_0x211b3c<_0x36c8c4[_0xc87b('0x3')][_0xc87b('0x1b')];_0x211b3c+=0x1){_0x4f56a0[_0x35b58f](util[_0xc87b('0x19')]('user:%s',_0x36c8c4[_0xc87b('0x3')][_0x211b3c]['name']));}}}function joinOrLeave(_0x3c6d50,_0x42d099,_0x147731){var _0x4bff29;if(_0x3c6d50['handshake'][_0xc87b('0x1c')]['id']){db[_0xc87b('0x14')][_0xc87b('0x1d')]({'attributes':['id',_0xc87b('0x4'),_0xc87b('0x16'),'userProfileId'],'where':{'id':_0x3c6d50[_0xc87b('0x1e')][_0xc87b('0x1c')]['id']},'include':[{'model':db[_0xc87b('0x1f')],'as':_0xc87b('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0xc87b('0x21')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xc87b('0x22')],'as':_0xc87b('0x23'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xc87b('0x24')],'as':_0xc87b('0x25'),'attributes':['id'],'raw':!![]}]})[_0xc87b('0x9')](function(_0x4e02d7){if(_0x4e02d7){_0x4bff29=_0x4e02d7;_0x3c6d50[_0x42d099](util[_0xc87b('0x19')](_0xc87b('0x26'),_0x4e02d7[_0xc87b('0x4')]));var _0x4b1ac6=[];switch(_0x4e02d7[_0xc87b('0x16')]){case _0xc87b('0x27'):_0x3c6d50[_0x42d099](_0xc87b('0x28'));_0x3c6d50[_0x42d099](_0xc87b('0x29'));if(queryQueues[_0xc87b('0x2a')](_0xc87b('0x2b'))){delete queryQueues[_0xc87b('0x2b')];}_0x4b1ac6[_0xc87b('0x2c')](db[_0xc87b('0x2d')][_0xc87b('0xf')](queryQueues));_0x4b1ac6[_0xc87b('0x2c')](db[_0xc87b('0x2e')]['findAll'](queryQueues));_0x4b1ac6[_0xc87b('0x2c')](db[_0xc87b('0x2f')]['findAll'](queryQueues));_0x4b1ac6[_0xc87b('0x2c')](db[_0xc87b('0x30')][_0xc87b('0xf')](queryQueues));_0x4b1ac6['push'](db[_0xc87b('0x31')][_0xc87b('0xf')](queryQueues));_0x4b1ac6[_0xc87b('0x2c')](db[_0xc87b('0x32')][_0xc87b('0xf')](queryQueues));_0x4b1ac6['push'](db['WhatsappQueue'][_0xc87b('0xf')](queryQueues));_0x4b1ac6['push'](db[_0xc87b('0x14')][_0xc87b('0xf')](queryTelephones));_0x4b1ac6[_0xc87b('0x2c')](db[_0xc87b('0x33')]['findAll'](queryTrunks));_0x4b1ac6[_0xc87b('0x2c')](db[_0xc87b('0x17')][_0xc87b('0xf')](queryCampaigns));_0x4b1ac6[_0xc87b('0x2c')](db[_0xc87b('0x14')][_0xc87b('0xf')](queryAgents));break;case _0xc87b('0x34'):_0x3c6d50[_0x42d099]('voice:inbound');_0x3c6d50[_0x42d099](_0xc87b('0x29'));_0x4b1ac6['push'](getAssociatedResources('VoiceQueues',_0x4e02d7[_0xc87b('0x35')],_0xc87b('0x2d')));_0x4b1ac6[_0xc87b('0x2c')](getAssociatedResources(_0xc87b('0x36'),_0x4e02d7[_0xc87b('0x35')],_0xc87b('0x2e')));_0x4b1ac6['push'](getAssociatedResources(_0xc87b('0xb'),_0x4e02d7[_0xc87b('0x35')],_0xc87b('0x2f')));_0x4b1ac6[_0xc87b('0x2c')](getAssociatedResources('SmsQueues',_0x4e02d7[_0xc87b('0x35')],_0xc87b('0x30')));_0x4b1ac6[_0xc87b('0x2c')](getAssociatedResources(_0xc87b('0xc'),_0x4e02d7['userProfileId'],'MailQueue'));_0x4b1ac6['push'](getAssociatedResources(_0xc87b('0xd'),_0x4e02d7[_0xc87b('0x35')],'OpenchannelQueue'));_0x4b1ac6[_0xc87b('0x2c')](getAssociatedResources(_0xc87b('0xe'),_0x4e02d7[_0xc87b('0x35')],_0xc87b('0x37')));_0x4b1ac6[_0xc87b('0x2c')](getAssociatedResources(_0xc87b('0x38'),_0x4e02d7[_0xc87b('0x35')],_0xc87b('0x14')));_0x4b1ac6[_0xc87b('0x2c')](getAssociatedResources(_0xc87b('0x39'),_0x4e02d7[_0xc87b('0x35')],_0xc87b('0x33')));_0x4b1ac6[_0xc87b('0x2c')](getAssociatedResources(_0xc87b('0x10'),_0x4e02d7[_0xc87b('0x35')],'Campaign'));_0x4b1ac6[_0xc87b('0x2c')](db[_0xc87b('0x14')][_0xc87b('0xf')](queryAgents));break;case _0xc87b('0x3a'):_0x3c6d50[_0x42d099](_0xc87b('0x28'));_0x3c6d50[_0x42d099]('voice:outbound');_0x4b1ac6['push'](_0x4e02d7[_0xc87b('0x3b')]({'attributes':['id',_0xc87b('0x4')]}));_0x4b1ac6['push'](_0x4e02d7[_0xc87b('0x3c')]({'attributes':['id',_0xc87b('0x4')]}));_0x4b1ac6[_0xc87b('0x2c')](_0x4e02d7[_0xc87b('0x3d')]({'attributes':['id',_0xc87b('0x4')]}));_0x4b1ac6[_0xc87b('0x2c')](_0x4e02d7['getSmsQueues']({'attributes':['id','name']}));_0x4b1ac6[_0xc87b('0x2c')](_0x4e02d7[_0xc87b('0x3e')]({'attributes':['id',_0xc87b('0x4')]}));_0x4b1ac6[_0xc87b('0x2c')](_0x4e02d7[_0xc87b('0x3f')]({'attributes':['id',_0xc87b('0x4')]}));_0x4b1ac6[_0xc87b('0x2c')](_0x4e02d7[_0xc87b('0x40')]({'attributes':['id',_0xc87b('0x4')]}));break;}return BPromise[_0xc87b('0x41')](_0x4b1ac6);}})[_0xc87b('0x9')](function(_0x2fe333){if(_0x2fe333&&_0x2fe333[_0xc87b('0x1b')]){for(var _0x5ee6ea=0x0;_0x5ee6ea<_0x2fe333[_0xc87b('0x1b')];_0x5ee6ea+=0x1){for(var _0x3b6d31=0x0;_0x3b6d31<_0x2fe333[_0x5ee6ea]['length'];_0x3b6d31+=0x1){switch(_0x5ee6ea){case 0x0:joinOrLeaveQueues(_0x3c6d50,_0x42d099,_0xc87b('0x42'),_0x2fe333[_0x5ee6ea][_0x3b6d31]);break;case 0x1:joinOrLeaveQueues(_0x3c6d50,_0x42d099,_0xc87b('0x43'),_0x2fe333[_0x5ee6ea][_0x3b6d31]);break;case 0x2:joinOrLeaveQueues(_0x3c6d50,_0x42d099,_0xc87b('0x44'),_0x2fe333[_0x5ee6ea][_0x3b6d31]);break;case 0x3:joinOrLeaveQueues(_0x3c6d50,_0x42d099,_0xc87b('0x45'),_0x2fe333[_0x5ee6ea][_0x3b6d31]);break;case 0x4:joinOrLeaveQueues(_0x3c6d50,_0x42d099,_0xc87b('0x46'),_0x2fe333[_0x5ee6ea][_0x3b6d31]);break;case 0x5:joinOrLeaveQueues(_0x3c6d50,_0x42d099,_0xc87b('0x47'),_0x2fe333[_0x5ee6ea][_0x3b6d31]);break;case 0x6:joinOrLeaveQueues(_0x3c6d50,_0x42d099,_0xc87b('0x48'),_0x2fe333[_0x5ee6ea][_0x3b6d31]);break;case 0x7:if(_0x4bff29['role']!=='agent')_0x3c6d50[_0x42d099](util[_0xc87b('0x19')]('telephone:%s',_0x2fe333[_0x5ee6ea][_0x3b6d31][_0xc87b('0x4')]));break;case 0x8:if(_0x4bff29[_0xc87b('0x16')]!==_0xc87b('0x3a'))_0x3c6d50[_0x42d099](util['format'](_0xc87b('0x49'),_0x2fe333[_0x5ee6ea][_0x3b6d31][_0xc87b('0x4')]));break;case 0x9:if(_0x4bff29[_0xc87b('0x16')]!==_0xc87b('0x3a'))_0x3c6d50[_0x42d099](util[_0xc87b('0x19')](_0xc87b('0x4a'),_0x2fe333[_0x5ee6ea][_0x3b6d31][_0xc87b('0x18')],_0x2fe333[_0x5ee6ea][_0x3b6d31]['name']));break;case 0xa:_0x3c6d50[_0x42d099](util['format'](_0xc87b('0x26'),_0x2fe333[_0x5ee6ea][_0x3b6d31][_0xc87b('0x4')]));break;}}}}})[_0xc87b('0x9')](function(){if(_0x42d099===_0xc87b('0x4b')){var _0xe73d52=_['map'](_0x4bff29['ChatInteractions'],'id');return _0x4bff29[_0xc87b('0x4c')](_0xe73d52)[_0xc87b('0x9')](function(){for(var _0x4ac1ca=0x0;_0x4ac1ca<_0xe73d52[_0xc87b('0x1b')];_0x4ac1ca+=0x1){_0x147731[_0xc87b('0x4d')](_0xc87b('0x4e'),{'ChatInteractionId':Number(_0xe73d52[_0x4ac1ca]),'UserId':Number(_0x4bff29['id'])});}});}})[_0xc87b('0x9')](function(){if(_0x42d099==='leave'){var _0x1a38e5=_[_0xc87b('0x12')](_0x4bff29[_0xc87b('0x4f')],'id');return _0x4bff29['removeMailInteractions'](_0x1a38e5)[_0xc87b('0x9')](function(){for(var _0x1d5a58=0x0;_0x1d5a58<_0x1a38e5['length'];_0x1d5a58+=0x1){_0x147731[_0xc87b('0x4d')](_0xc87b('0x50'),{'MailInteractionId':Number(_0x1a38e5[_0x1d5a58]),'UserId':Number(_0x4bff29['id'])});}});}})[_0xc87b('0x9')](function(){if(_0x42d099===_0xc87b('0x4b')){var _0x2fbaf0=_[_0xc87b('0x12')](_0x4bff29[_0xc87b('0x51')],'id');return _0x4bff29['removeFaxInteractions'](_0x2fbaf0)['then'](function(){for(var _0x27f74d=0x0;_0x27f74d<_0x2fbaf0[_0xc87b('0x1b')];_0x27f74d+=0x1){_0x147731[_0xc87b('0x4d')](_0xc87b('0x52'),{'FaxInteractionId':Number(_0x2fbaf0[_0x27f74d]),'UserId':Number(_0x4bff29['id'])});}});}})[_0xc87b('0x9')](function(){if(_0x42d099===_0xc87b('0x4b')){var _0x57dbec=_['map'](_0x4bff29[_0xc87b('0x23')],'id');return _0x4bff29['removeSmsInteractions'](_0x57dbec)['then'](function(){for(var _0x2ef012=0x0;_0x2ef012<_0x57dbec[_0xc87b('0x1b')];_0x2ef012+=0x1){_0x147731[_0xc87b('0x4d')](_0xc87b('0x53'),{'SmsInteractionId':Number(_0x57dbec[_0x2ef012]),'UserId':Number(_0x4bff29['id'])});}});}})[_0xc87b('0x9')](function(){if(_0x42d099===_0xc87b('0x4b')){var _0x3f1a63=_['map'](_0x4bff29[_0xc87b('0x54')],'id');return _0x4bff29[_0xc87b('0x55')](_0x3f1a63)[_0xc87b('0x9')](function(){for(var _0x1594e8=0x0;_0x1594e8<_0x3f1a63[_0xc87b('0x1b')];_0x1594e8+=0x1){_0x147731[_0xc87b('0x4d')](_0xc87b('0x56'),{'OpenchannelInteractionId':Number(_0x3f1a63[_0x1594e8]),'UserId':Number(_0x4bff29['id'])});}});}})[_0xc87b('0x9')](function(){if(_0x42d099===_0xc87b('0x4b')){var _0x5f4553=_[_0xc87b('0x12')](_0x4bff29[_0xc87b('0x25')],'id');return _0x4bff29[_0xc87b('0x57')](_0x5f4553)[_0xc87b('0x9')](function(){for(var _0x5337c9=0x0;_0x5337c9<_0x5f4553[_0xc87b('0x1b')];_0x5337c9+=0x1){_0x147731['emit'](_0xc87b('0x58'),{'WhatsappInteractionId':Number(_0x5f4553[_0x5337c9]),'UserId':Number(_0x4bff29['id'])});}});}})[_0xc87b('0x59')](function(_0xaf8206){_0x3c6d50['log'](_0xaf8206);});}}function onDisconnect(_0x3a7e5b,_0x1900c9){joinOrLeave(_0x3a7e5b,_0xc87b('0x4b'),_0x1900c9);}function onConnect(_0x438abe){joinOrLeave(_0x438abe,_0xc87b('0x5a'));}exports[_0xc87b('0x5b')]=function(_0x342f05){_0x342f05['on'](_0xc87b('0x5c'),function(_0x1c0807){_0x1c0807[_0xc87b('0x5d')](0x0);_0x1c0807[_0xc87b('0x5e')]=_0x1c0807[_0xc87b('0x5f')][_0xc87b('0x5c')]['remoteAddress']+':'+_0x1c0807['request'][_0xc87b('0x5c')][_0xc87b('0x60')];_0x1c0807[_0xc87b('0x61')]=new Date();_0x1c0807[_0xc87b('0x62')]=function(_0x58a215){console[_0xc87b('0x62')](_0xc87b('0x63')+_0x1c0807['nsp'][_0xc87b('0x4')]+'['+_0x1c0807[_0xc87b('0x5e')]+']',_0x58a215);};_0x1c0807['on'](_0xc87b('0x64'),function(){onDisconnect(_0x1c0807,_0x342f05);_0x1c0807[_0xc87b('0x62')](_0xc87b('0x65'));});onConnect(_0x1c0807);_0x1c0807[_0xc87b('0x62')](_0xc87b('0x66'));});}; \ No newline at end of file +var _0x2542=['userProfileId','handshake','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','WhatsappQueue','Trunk','user','FaxQueues','SmsQueues','MailQueue','Trunks','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','leave','removeChatInteractions','map','emit','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','connection','setMaxListeners','request','connectedAt','log','SocketIO\x20','address','disconnect','lodash','util','bluebird','../mysqldb','name','User','role','agent','type','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','IvrCampaigns','UserProfileResource','resourceId','then','where','telephone','Campaign','format','Agents','user:%s','find'];(function(_0x46f1f4,_0x74fd4e){var _0x1b925d=function(_0x55144b){while(--_0x55144b){_0x46f1f4['push'](_0x46f1f4['shift']());}};_0x1b925d(++_0x74fd4e);}(_0x2542,0x169));var _0x2254=function(_0x2d2ad2,_0x1a52aa){_0x2d2ad2=_0x2d2ad2-0x0;var _0x6af9b0=_0x2542[_0x2d2ad2];return _0x6af9b0;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var BPromise=require(_0x2254('0x2'));var db=require(_0x2254('0x3'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x2254('0x4')],'include':[{'as':'Agents','model':db[_0x2254('0x5')],'attributes':['id',_0x2254('0x4'),_0x2254('0x6')],'raw':!![],'where':{'role':_0x2254('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x2254('0x4')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x2254('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x2254('0x4')],'where':{'role':_0x2254('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x2254('0x4'),_0x2254('0x8')],'where':{'type':_0x2254('0x9')}};function getAssociatedResources(_0x263459,_0xbf1c18,_0xb395da){return db[_0x2254('0xa')][_0x2254('0xb')]({'where':{'name':_0x263459,'userProfileId':_0xbf1c18},'raw':!![]})['then'](function(_0x336e14){if(_0x336e14){if(_0x336e14[_0x2254('0xc')]){switch(_0x263459){case _0x2254('0xd'):case _0x2254('0xe'):case'FaxQueues':case'SmsQueues':case _0x2254('0xf'):case _0x2254('0x10'):case _0x2254('0x11'):return db[_0xb395da][_0x2254('0x12')](queryQueues);case _0x2254('0x13'):return db[_0xb395da][_0x2254('0x12')](queryTelephones);case'Trunks':return db[_0xb395da][_0x2254('0x12')](queryTrunks);case _0x2254('0x14'):return db[_0xb395da]['findAll'](queryCampaigns);}}else{return db[_0x2254('0x15')][_0x2254('0x12')]({'attributes':[_0x2254('0x16')],'where':{'sectionId':_0x336e14['id']},'raw':!![]})[_0x2254('0x17')](function(_0x26285a){if(_0x26285a){var _0xbc5548={'where':{'id':_['map'](_0x26285a,_0x2254('0x16'))},'raw':!![]};switch(_0xb395da){case'User':_0xbc5548[_0x2254('0x18')][_0x2254('0x6')]=_0x2254('0x19');break;case _0x2254('0x1a'):_0xbc5548[_0x2254('0x18')][_0x2254('0x8')]='ivr';break;}return db[_0xb395da]['findAll'](_0xbc5548);}else{return[];}});}}else{return[];}})['then'](function(_0xb05559){return _0xb05559;});}function joinOrLeaveQueues(_0x3a79f8,_0x3c3a98,_0x1f1163,_0x2801d9){_0x3a79f8[_0x3c3a98](util[_0x2254('0x1b')]('%s:queue:%s',_0x1f1163,_0x2801d9[_0x2254('0x4')]));if(_0x2801d9[_0x2254('0x1c')]){for(var _0x906cde=0x0;_0x906cde<_0x2801d9['Agents']['length'];_0x906cde+=0x1){_0x3a79f8[_0x3c3a98](util['format'](_0x2254('0x1d'),_0x2801d9[_0x2254('0x1c')][_0x906cde][_0x2254('0x4')]));}}}function joinOrLeave(_0x56b91e,_0x5713e4,_0x4d8faf){var _0x540020;if(_0x56b91e['handshake']['query']['id']){db[_0x2254('0x5')][_0x2254('0x1e')]({'attributes':['id',_0x2254('0x4'),_0x2254('0x6'),_0x2254('0x1f')],'where':{'id':_0x56b91e[_0x2254('0x20')]['query']['id']},'include':[{'model':db['ChatInteraction'],'as':_0x2254('0x21'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x2254('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x2254('0x23')],'as':_0x2254('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x2254('0x25')],'as':_0x2254('0x26'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x2254('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x2254('0x28')],'as':_0x2254('0x29'),'attributes':['id'],'raw':!![]}]})[_0x2254('0x17')](function(_0x13366a){if(_0x13366a){_0x540020=_0x13366a;_0x56b91e[_0x5713e4](util[_0x2254('0x1b')](_0x2254('0x1d'),_0x13366a[_0x2254('0x4')]));var _0x29975f=[];switch(_0x13366a[_0x2254('0x6')]){case _0x2254('0x2a'):_0x56b91e[_0x5713e4](_0x2254('0x2b'));_0x56b91e[_0x5713e4](_0x2254('0x2c'));if(queryQueues[_0x2254('0x2d')](_0x2254('0x2e'))){delete queryQueues[_0x2254('0x2e')];}_0x29975f[_0x2254('0x2f')](db[_0x2254('0x30')][_0x2254('0x12')](queryQueues));_0x29975f['push'](db[_0x2254('0x31')][_0x2254('0x12')](queryQueues));_0x29975f[_0x2254('0x2f')](db[_0x2254('0x32')][_0x2254('0x12')](queryQueues));_0x29975f[_0x2254('0x2f')](db[_0x2254('0x33')][_0x2254('0x12')](queryQueues));_0x29975f[_0x2254('0x2f')](db['MailQueue'][_0x2254('0x12')](queryQueues));_0x29975f[_0x2254('0x2f')](db['OpenchannelQueue'][_0x2254('0x12')](queryQueues));_0x29975f[_0x2254('0x2f')](db[_0x2254('0x34')][_0x2254('0x12')](queryQueues));_0x29975f['push'](db['User'][_0x2254('0x12')](queryTelephones));_0x29975f['push'](db[_0x2254('0x35')][_0x2254('0x12')](queryTrunks));_0x29975f[_0x2254('0x2f')](db[_0x2254('0x1a')][_0x2254('0x12')](queryCampaigns));_0x29975f[_0x2254('0x2f')](db[_0x2254('0x5')]['findAll'](queryAgents));break;case _0x2254('0x36'):_0x56b91e[_0x5713e4](_0x2254('0x2b'));_0x56b91e[_0x5713e4](_0x2254('0x2c'));_0x29975f[_0x2254('0x2f')](getAssociatedResources(_0x2254('0xd'),_0x13366a[_0x2254('0x1f')],_0x2254('0x30')));_0x29975f[_0x2254('0x2f')](getAssociatedResources(_0x2254('0xe'),_0x13366a[_0x2254('0x1f')],'ChatQueue'));_0x29975f[_0x2254('0x2f')](getAssociatedResources(_0x2254('0x37'),_0x13366a[_0x2254('0x1f')],_0x2254('0x32')));_0x29975f['push'](getAssociatedResources(_0x2254('0x38'),_0x13366a[_0x2254('0x1f')],_0x2254('0x33')));_0x29975f[_0x2254('0x2f')](getAssociatedResources(_0x2254('0xf'),_0x13366a[_0x2254('0x1f')],_0x2254('0x39')));_0x29975f[_0x2254('0x2f')](getAssociatedResources('OpenchannelQueues',_0x13366a[_0x2254('0x1f')],'OpenchannelQueue'));_0x29975f[_0x2254('0x2f')](getAssociatedResources(_0x2254('0x11'),_0x13366a[_0x2254('0x1f')],_0x2254('0x34')));_0x29975f[_0x2254('0x2f')](getAssociatedResources(_0x2254('0x13'),_0x13366a[_0x2254('0x1f')],'User'));_0x29975f[_0x2254('0x2f')](getAssociatedResources(_0x2254('0x3a'),_0x13366a[_0x2254('0x1f')],_0x2254('0x35')));_0x29975f[_0x2254('0x2f')](getAssociatedResources('IvrCampaigns',_0x13366a[_0x2254('0x1f')],_0x2254('0x1a')));_0x29975f[_0x2254('0x2f')](db[_0x2254('0x5')][_0x2254('0x12')](queryAgents));break;case'agent':_0x56b91e[_0x5713e4](_0x2254('0x2b'));_0x56b91e[_0x5713e4]('voice:outbound');_0x29975f[_0x2254('0x2f')](_0x13366a[_0x2254('0x3b')]({'attributes':['id',_0x2254('0x4')]}));_0x29975f[_0x2254('0x2f')](_0x13366a[_0x2254('0x3c')]({'attributes':['id',_0x2254('0x4')]}));_0x29975f[_0x2254('0x2f')](_0x13366a[_0x2254('0x3d')]({'attributes':['id',_0x2254('0x4')]}));_0x29975f[_0x2254('0x2f')](_0x13366a[_0x2254('0x3e')]({'attributes':['id',_0x2254('0x4')]}));_0x29975f[_0x2254('0x2f')](_0x13366a['getMailQueues']({'attributes':['id',_0x2254('0x4')]}));_0x29975f[_0x2254('0x2f')](_0x13366a[_0x2254('0x3f')]({'attributes':['id','name']}));_0x29975f[_0x2254('0x2f')](_0x13366a[_0x2254('0x40')]({'attributes':['id',_0x2254('0x4')]}));break;}return BPromise[_0x2254('0x41')](_0x29975f);}})[_0x2254('0x17')](function(_0x470241){if(_0x470241&&_0x470241[_0x2254('0x42')]){for(var _0x3c685e=0x0;_0x3c685e<_0x470241[_0x2254('0x42')];_0x3c685e+=0x1){for(var _0x4fc83c=0x0;_0x4fc83c<_0x470241[_0x3c685e][_0x2254('0x42')];_0x4fc83c+=0x1){switch(_0x3c685e){case 0x0:joinOrLeaveQueues(_0x56b91e,_0x5713e4,_0x2254('0x43'),_0x470241[_0x3c685e][_0x4fc83c]);break;case 0x1:joinOrLeaveQueues(_0x56b91e,_0x5713e4,_0x2254('0x44'),_0x470241[_0x3c685e][_0x4fc83c]);break;case 0x2:joinOrLeaveQueues(_0x56b91e,_0x5713e4,_0x2254('0x45'),_0x470241[_0x3c685e][_0x4fc83c]);break;case 0x3:joinOrLeaveQueues(_0x56b91e,_0x5713e4,_0x2254('0x46'),_0x470241[_0x3c685e][_0x4fc83c]);break;case 0x4:joinOrLeaveQueues(_0x56b91e,_0x5713e4,_0x2254('0x47'),_0x470241[_0x3c685e][_0x4fc83c]);break;case 0x5:joinOrLeaveQueues(_0x56b91e,_0x5713e4,_0x2254('0x48'),_0x470241[_0x3c685e][_0x4fc83c]);break;case 0x6:joinOrLeaveQueues(_0x56b91e,_0x5713e4,_0x2254('0x49'),_0x470241[_0x3c685e][_0x4fc83c]);break;case 0x7:if(_0x540020[_0x2254('0x6')]!==_0x2254('0x7'))_0x56b91e[_0x5713e4](util['format'](_0x2254('0x4a'),_0x470241[_0x3c685e][_0x4fc83c][_0x2254('0x4')]));break;case 0x8:if(_0x540020['role']!==_0x2254('0x7'))_0x56b91e[_0x5713e4](util[_0x2254('0x1b')](_0x2254('0x4b'),_0x470241[_0x3c685e][_0x4fc83c][_0x2254('0x4')]));break;case 0x9:if(_0x540020['role']!==_0x2254('0x7'))_0x56b91e[_0x5713e4](util[_0x2254('0x1b')]('campaign:%s:%s',_0x470241[_0x3c685e][_0x4fc83c][_0x2254('0x8')],_0x470241[_0x3c685e][_0x4fc83c][_0x2254('0x4')]));break;case 0xa:_0x56b91e[_0x5713e4](util[_0x2254('0x1b')](_0x2254('0x1d'),_0x470241[_0x3c685e][_0x4fc83c]['name']));break;}}}}})[_0x2254('0x17')](function(){if(_0x5713e4===_0x2254('0x4c')){var _0x222a4e=_['map'](_0x540020['ChatInteractions'],'id');return _0x540020[_0x2254('0x4d')](_0x222a4e)[_0x2254('0x17')](function(){for(var _0x5d6628=0x0;_0x5d6628<_0x222a4e[_0x2254('0x42')];_0x5d6628+=0x1){_0x4d8faf['emit']('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x222a4e[_0x5d6628]),'UserId':Number(_0x540020['id'])});}});}})[_0x2254('0x17')](function(){if(_0x5713e4===_0x2254('0x4c')){var _0x3be0f3=_[_0x2254('0x4e')](_0x540020[_0x2254('0x22')],'id');return _0x540020['removeMailInteractions'](_0x3be0f3)['then'](function(){for(var _0x1bd988=0x0;_0x1bd988<_0x3be0f3['length'];_0x1bd988+=0x1){_0x4d8faf[_0x2254('0x4f')](_0x2254('0x50'),{'MailInteractionId':Number(_0x3be0f3[_0x1bd988]),'UserId':Number(_0x540020['id'])});}});}})[_0x2254('0x17')](function(){if(_0x5713e4===_0x2254('0x4c')){var _0x49c60d=_[_0x2254('0x4e')](_0x540020[_0x2254('0x24')],'id');return _0x540020['removeFaxInteractions'](_0x49c60d)['then'](function(){for(var _0x1a2973=0x0;_0x1a2973<_0x49c60d['length'];_0x1a2973+=0x1){_0x4d8faf[_0x2254('0x4f')](_0x2254('0x51'),{'FaxInteractionId':Number(_0x49c60d[_0x1a2973]),'UserId':Number(_0x540020['id'])});}});}})[_0x2254('0x17')](function(){if(_0x5713e4===_0x2254('0x4c')){var _0x301a12=_['map'](_0x540020['SmsInteractions'],'id');return _0x540020[_0x2254('0x52')](_0x301a12)['then'](function(){for(var _0x335c66=0x0;_0x335c66<_0x301a12['length'];_0x335c66+=0x1){_0x4d8faf['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x301a12[_0x335c66]),'UserId':Number(_0x540020['id'])});}});}})[_0x2254('0x17')](function(){if(_0x5713e4===_0x2254('0x4c')){var _0x1d4b90=_[_0x2254('0x4e')](_0x540020[_0x2254('0x27')],'id');return _0x540020[_0x2254('0x53')](_0x1d4b90)[_0x2254('0x17')](function(){for(var _0x25137c=0x0;_0x25137c<_0x1d4b90[_0x2254('0x42')];_0x25137c+=0x1){_0x4d8faf[_0x2254('0x4f')](_0x2254('0x54'),{'OpenchannelInteractionId':Number(_0x1d4b90[_0x25137c]),'UserId':Number(_0x540020['id'])});}});}})[_0x2254('0x17')](function(){if(_0x5713e4===_0x2254('0x4c')){var _0x24e57a=_[_0x2254('0x4e')](_0x540020[_0x2254('0x29')],'id');return _0x540020[_0x2254('0x55')](_0x24e57a)[_0x2254('0x17')](function(){for(var _0x179cf1=0x0;_0x179cf1<_0x24e57a['length'];_0x179cf1+=0x1){_0x4d8faf[_0x2254('0x4f')](_0x2254('0x56'),{'WhatsappInteractionId':Number(_0x24e57a[_0x179cf1]),'UserId':Number(_0x540020['id'])});}});}})[_0x2254('0x57')](function(_0x38be3b){_0x56b91e['log'](_0x38be3b);});}}function onDisconnect(_0x494347,_0x471fdd){joinOrLeave(_0x494347,_0x2254('0x4c'),_0x471fdd);}function onConnect(_0x1d73a3){joinOrLeave(_0x1d73a3,_0x2254('0x58'));}exports[_0x2254('0x59')]=function(_0x53b55b){_0x53b55b['on'](_0x2254('0x5a'),function(_0x2d8a53){_0x2d8a53[_0x2254('0x5b')](0x0);_0x2d8a53['address']=_0x2d8a53['request'][_0x2254('0x5a')]['remoteAddress']+':'+_0x2d8a53[_0x2254('0x5c')][_0x2254('0x5a')]['remotePort'];_0x2d8a53[_0x2254('0x5d')]=new Date();_0x2d8a53[_0x2254('0x5e')]=function(_0x4d30a5){console[_0x2254('0x5e')](_0x2254('0x5f')+_0x2d8a53['nsp']['name']+'['+_0x2d8a53[_0x2254('0x60')]+']',_0x4d30a5);};_0x2d8a53['on'](_0x2254('0x61'),function(){onDisconnect(_0x2d8a53,_0x53b55b);_0x2d8a53['log']('DISCONNECTED');});onConnect(_0x2d8a53);_0x2d8a53[_0x2254('0x5e')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 4c8b49e..a2d2a08 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 _0xecf8=['model','hook','callback','condition','util','../../mysqldb','jayson/promise','triggers','http','Chat','ChatInteraction','afterCreate','newinteraction','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','afterUpdate','SmsMessage','WhatsappInteraction','Whatsapp','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','Openchannel','OpenchannelInteraction','then','info','Trigger,\x20%s','EventManager','error','code','catch','channel','motionChannel','event','direction','resolve','ContactId','sequelize','query','Sequelize','QueryTypes','contact','undefined','UserId','interface','format','name','incomingmessage','outgoingmessage','AfterCreateMessage','get','opened','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SELECT','SIP/%s','agent','AfterCreate','changed','closed','substatus','AfterUpdate','User','find','email','internal','length'];(function(_0x58a975,_0x4f7451){var _0x47f055=function(_0x4f57e1){while(--_0x4f57e1){_0x58a975['push'](_0x58a975['shift']());}};_0x47f055(++_0x4f7451);}(_0xecf8,0x94));var _0x8ecf=function(_0xa668af,_0xa882f9){_0xa668af=_0xa668af-0x0;var _0x1151f5=_0xecf8[_0xa668af];return _0x1151f5;};'use strict';var util=require(_0x8ecf('0x0'));var db=require(_0x8ecf('0x1'))['db'];var jayson=require(_0x8ecf('0x2'));var logger=require('../logger')(_0x8ecf('0x3'));var client=jayson['client'][_0x8ecf('0x4')]({'port':0x232a});var triggers=[{'channel':_0x8ecf('0x5'),'model':_0x8ecf('0x6'),'event':_0x8ecf('0x7'),'condition':_0x8ecf('0x8'),'callback':afterCreate},{'channel':_0x8ecf('0x5'),'model':_0x8ecf('0x6'),'event':'afterUpdate','condition':_0x8ecf('0x9'),'callback':afterUpdate},{'channel':'Chat','model':_0x8ecf('0xa'),'event':_0x8ecf('0x7'),'condition':_0x8ecf('0xb'),'callback':afterCreateMessage},{'channel':_0x8ecf('0xc'),'model':_0x8ecf('0xd'),'event':_0x8ecf('0x7'),'condition':_0x8ecf('0x8'),'callback':afterCreate},{'channel':_0x8ecf('0xc'),'model':'SmsInteraction','event':_0x8ecf('0xe'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x8ecf('0xc'),'model':_0x8ecf('0xf'),'event':_0x8ecf('0x7'),'condition':_0x8ecf('0xb'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0x8ecf('0x10'),'event':_0x8ecf('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x8ecf('0x11'),'model':'WhatsappInteraction','event':_0x8ecf('0xe'),'condition':_0x8ecf('0x9'),'callback':afterUpdate},{'channel':_0x8ecf('0x11'),'model':_0x8ecf('0x12'),'event':_0x8ecf('0x7'),'condition':_0x8ecf('0xb'),'callback':afterCreateMessage},{'channel':_0x8ecf('0x13'),'model':_0x8ecf('0x14'),'event':_0x8ecf('0x7'),'condition':_0x8ecf('0x8'),'callback':afterCreate},{'channel':_0x8ecf('0x13'),'model':_0x8ecf('0x14'),'event':_0x8ecf('0xe'),'condition':_0x8ecf('0x9'),'callback':afterUpdate},{'channel':_0x8ecf('0x13'),'model':_0x8ecf('0x15'),'event':_0x8ecf('0x7'),'condition':_0x8ecf('0xb'),'callback':afterCreateMessage},{'channel':_0x8ecf('0x16'),'model':'MailInteraction','event':_0x8ecf('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x8ecf('0x16'),'model':_0x8ecf('0x17'),'event':_0x8ecf('0xe'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x8ecf('0x16'),'model':'MailMessage','event':_0x8ecf('0x7'),'condition':_0x8ecf('0xb'),'callback':afterCreateMessage},{'channel':_0x8ecf('0x18'),'model':'OpenchannelInteraction','event':'afterCreate','condition':_0x8ecf('0x8'),'callback':afterCreate},{'channel':_0x8ecf('0x18'),'model':_0x8ecf('0x19'),'event':_0x8ecf('0xe'),'condition':_0x8ecf('0x9'),'callback':afterUpdate},{'channel':_0x8ecf('0x18'),'model':'OpenchannelMessage','event':_0x8ecf('0x7'),'condition':_0x8ecf('0xb'),'callback':afterCreateMessage}];function request(_0x13e29d){return client['request']('EventManager',_0x13e29d)[_0x8ecf('0x1a')](function(_0x55b622){logger[_0x8ecf('0x1b')](_0x8ecf('0x1c'),_0x8ecf('0x1d'),_0x55b622);if(_0x55b622[_0x8ecf('0x1e')]){if(_0x55b622['error'][_0x8ecf('0x1f')]===0x1f4){logger[_0x8ecf('0x1e')]('Trigger,\x20%s',_0x8ecf('0x1d'),_0x55b622[_0x8ecf('0x1e')]);}}})[_0x8ecf('0x20')](function(_0xc6dc16){logger[_0x8ecf('0x1e')](_0x8ecf('0x1c'),_0x8ecf('0x1d'),_0xc6dc16);});}function afterCreateMessage(_0x141136){return function(_0x342d7d){_0x342d7d=_0x342d7d['get']({'plain':!![]});_0x342d7d[_0x8ecf('0x21')]=_0x141136;_0x342d7d[_0x8ecf('0x22')]=_0x141136;_0x342d7d[_0x8ecf('0x23')]=_0x342d7d[_0x8ecf('0x24')];Promise[_0x8ecf('0x25')]()[_0x8ecf('0x1a')](function(){if(typeof _0x342d7d[_0x8ecf('0x26')]==='undefined')return null;var _0x3899aa='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x342d7d[_0x8ecf('0x26')];return db[_0x8ecf('0x27')][_0x8ecf('0x28')](_0x3899aa,{'type':db[_0x8ecf('0x29')][_0x8ecf('0x2a')]['SELECT'],'raw':!![]});})[_0x8ecf('0x1a')](function(_0x31ca17){if(_0x31ca17){_0x342d7d[_0x8ecf('0x2b')]=_0x31ca17[0x0];}if(typeof _0x342d7d['UserId']===_0x8ecf('0x2c'))return;return getAgent(_0x342d7d[_0x8ecf('0x2d')]);})[_0x8ecf('0x1a')](function(_0x498243){if(_0x498243){_0x342d7d[_0x8ecf('0x2e')]=util[_0x8ecf('0x2f')]('SIP/%s',_0x498243[_0x8ecf('0x30')]);_0x342d7d['agent']=_0x498243;_0x342d7d[_0x8ecf('0x21')]=_0x141136;return request({'event':_0x8ecf('0x31'),'message':_0x342d7d});}else{return request({'event':_0x8ecf('0x32'),'message':_0x342d7d});}})[_0x8ecf('0x20')](function(_0x4e9bff){logger[_0x8ecf('0x1e')](_0x8ecf('0x1c'),_0x8ecf('0x33'),_0x4e9bff);});};}function afterCreate(_0x2889ec,_0x57675a){return function(_0x42f603){_0x42f603=_0x42f603[_0x8ecf('0x34')]({'plain':!![]});_0x42f603[_0x8ecf('0x21')]=_0x2889ec;_0x42f603[_0x8ecf('0x22')]=_0x2889ec;_0x42f603[_0x8ecf('0x23')]=_0x8ecf('0x35');Promise[_0x8ecf('0x25')]()[_0x8ecf('0x1a')](function(){var _0x172f87=_0x8ecf('0x36')+_0x42f603[_0x8ecf('0x26')];return db[_0x8ecf('0x27')]['query'](_0x172f87,{'type':db[_0x8ecf('0x29')][_0x8ecf('0x2a')][_0x8ecf('0x37')],'raw':!![]});})[_0x8ecf('0x1a')](function(_0x483726){if(_0x483726){_0x42f603[_0x8ecf('0x2b')]=_0x483726[0x0];}if(typeof _0x42f603[_0x8ecf('0x2d')]===_0x8ecf('0x2c'))return;return getAgent(_0x42f603[_0x8ecf('0x2d')]);})[_0x8ecf('0x1a')](function(_0x5d8d1f){if(_0x5d8d1f){_0x42f603['interface']=util[_0x8ecf('0x2f')](_0x8ecf('0x38'),_0x5d8d1f[_0x8ecf('0x30')]);_0x42f603[_0x8ecf('0x39')]=_0x5d8d1f;}return request({'event':_0x57675a,'message':_0x42f603});})['catch'](function(_0x3f966b){logger[_0x8ecf('0x1e')]('Trigger,\x20%s',_0x8ecf('0x3a'),_0x3f966b);});};}function afterUpdate(_0x49a881){return function(_0x4bf83f){var _0x7a894e=_0x4bf83f[_0x8ecf('0x3b')](_0x8ecf('0x3c'))&&_0x4bf83f['closed'];var _0x52acc3=_0x4bf83f['changed']('substatus');if(_0x7a894e||_0x52acc3){var _0x194a05=_0x7a894e?'closedinteraction':'substatus';var _0x421ab4=_0x4bf83f[_0x8ecf('0x34')]({'plain':!![]});_0x421ab4[_0x8ecf('0x21')]=_0x49a881;_0x421ab4[_0x8ecf('0x22')]=_0x49a881;_0x421ab4[_0x8ecf('0x23')]=_0x7a894e?_0x8ecf('0x3c'):_0x8ecf('0x3d');var _0x312bd9='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x421ab4[_0x8ecf('0x26')];return db[_0x8ecf('0x27')][_0x8ecf('0x28')](_0x312bd9,{'type':db[_0x8ecf('0x29')][_0x8ecf('0x2a')]['SELECT'],'raw':!![]})[_0x8ecf('0x1a')](function(_0x420023){if(_0x420023){_0x421ab4[_0x8ecf('0x2b')]=_0x420023[0x0];}if(typeof _0x421ab4[_0x8ecf('0x2d')]===_0x8ecf('0x2c'))return;return getAgent(_0x421ab4[_0x8ecf('0x2d')]);})[_0x8ecf('0x1a')](function(_0x4f634a){if(_0x4f634a){_0x421ab4['interface']=util[_0x8ecf('0x2f')](_0x8ecf('0x38'),_0x4f634a[_0x8ecf('0x30')]);_0x421ab4[_0x8ecf('0x39')]=_0x4f634a;}return request({'event':_0x194a05,'message':_0x421ab4});})['catch'](function(_0x4b190e){logger[_0x8ecf('0x1e')](_0x8ecf('0x1c'),_0x8ecf('0x3e'),_0x4b190e);});}};}function getAgent(_0x596fdf){return db[_0x8ecf('0x3f')][_0x8ecf('0x40')]({'where':{'id':_0x596fdf},'attributes':['id',_0x8ecf('0x30'),'fullname',_0x8ecf('0x41'),_0x8ecf('0x42')],'raw':!![]})[_0x8ecf('0x1a')](function(_0x5ae157){return _0x5ae157;});}exports['default']=function(){for(var _0x4ca864=0x0;_0x4ca864=_0x5ee720['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x330bf2(_0x2b4abb);})[_0x3a29('0xf')](function(_0x193108){_0x3cf1d0(_0x193108);});});}; \ No newline at end of file +var _0x1e08=['count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','bluebird','./license/util','voice','mail','chat','fax','sms','whatsapp','openchannel','isValidChannel','includes','clearBlockUser','isUndefined','updateAttributes','getLicense','role','agent','User'];(function(_0x499c0d,_0x3a36b7){var _0x19dfb4=function(_0x55463f){while(--_0x55463f){_0x499c0d['push'](_0x499c0d['shift']());}};_0x19dfb4(++_0x3a36b7);}(_0x1e08,0xbd));var _0x81e0=function(_0x75c3f2,_0x245ea8){_0x75c3f2=_0x75c3f2-0x0;var _0x3f1182=_0x1e08[_0x75c3f2];return _0x3f1182;};'use strict';var _=require('lodash');var BPromise=require(_0x81e0('0x0'));var db=require('../mysqldb')['db'];var util=require(_0x81e0('0x1'));var channels=[_0x81e0('0x2'),_0x81e0('0x3'),_0x81e0('0x4'),_0x81e0('0x5'),_0x81e0('0x6'),_0x81e0('0x7'),_0x81e0('0x8')];exports['getChannels']=function(){return channels;};exports[_0x81e0('0x9')]=function(_0x3fada5){_0x3fada5=_0x3fada5['toLowerCase']();return _[_0x81e0('0xa')](channels,_0x3fada5);};exports[_0x81e0('0xb')]=function(_0x1027ac,_0x2a0514,_0x1f10ad,_0x1f67bc){var _0x274604={'loginAttempts':_0x2a0514,'blocked':_0x1f10ad};if(!_[_0x81e0('0xc')](_0x1f67bc)){_0x274604['blockedAt']=_0x1f67bc;}return _0x1027ac[_0x81e0('0xd')](_0x274604);};exports[_0x81e0('0xe')]=function(_0x541e57){return new BPromise(function(_0x409598,_0x831d0b){var _0x32be1d=0x0;if(_0x541e57[_0x81e0('0xf')]!==_0x81e0('0x10')){_0x409598(_0x541e57);}db[_0x81e0('0x11')][_0x81e0('0x12')]({'where':{'role':_0x81e0('0x10'),'online':!![],'id':{'$ne':_0x541e57['id']}}})['then'](function(_0x4afbb6){_0x32be1d=_0x4afbb6;return util[_0x81e0('0xe')]();})[_0x81e0('0x13')](function(_0x3afaaf){if(_0x3afaaf&&_0x3afaaf[_0x81e0('0x14')]&&_0x32be1d>=_0x3afaaf[_0x81e0('0x14')]){throw Error(_0x81e0('0x15'));}_0x409598(_0x541e57);})[_0x81e0('0x16')](function(_0x68d8a7){_0x831d0b(_0x68d8a7);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 242fd1e..7981c5a 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5227=['render','json','send','exports','404','status'];(function(_0x381d3e,_0xd5747c){var _0x4924cc=function(_0x12b24c){while(--_0x12b24c){_0x381d3e['push'](_0x381d3e['shift']());}};_0x4924cc(++_0xd5747c);}(_0x5227,0x1d1));var _0x7522=function(_0x41bd0d,_0x283017){_0x41bd0d=_0x41bd0d-0x0;var _0x5a4f5d=_0x5227[_0x41bd0d];return _0x5a4f5d;};'use strict';module[_0x7522('0x0')][0x194]=function pageNotFound(_0x28e7ee,_0x40041b){var _0x51da2c=_0x7522('0x1');var _0x186c99=0x194;var _0x5eb1d1={'status':_0x186c99};_0x40041b[_0x7522('0x2')](_0x5eb1d1[_0x7522('0x2')]);_0x40041b[_0x7522('0x3')](_0x51da2c,{},function(_0x37eafe,_0x51144a){if(_0x37eafe){return _0x40041b[_0x7522('0x2')](_0x5eb1d1[_0x7522('0x2')])[_0x7522('0x4')](_0x5eb1d1);}_0x40041b[_0x7522('0x5')](_0x51144a);});}; \ No newline at end of file +var _0x995f=['status','send','exports'];(function(_0x49137e,_0x5e7642){var _0x110571=function(_0x5d871d){while(--_0x5d871d){_0x49137e['push'](_0x49137e['shift']());}};_0x110571(++_0x5e7642);}(_0x995f,0x1b2));var _0xf995=function(_0x3c78e7,_0x19a615){_0x3c78e7=_0x3c78e7-0x0;var _0x46c763=_0x995f[_0x3c78e7];return _0x46c763;};'use strict';module[_0xf995('0x0')][0x194]=function pageNotFound(_0x3e441e,_0x339654){var _0x26fef7='404';var _0x50d464=0x194;var _0x3ba99d={'status':_0x50d464};_0x339654[_0xf995('0x1')](_0x3ba99d[_0xf995('0x1')]);_0x339654['render'](_0x26fef7,{},function(_0x143361,_0x46134d){if(_0x143361){return _0x339654[_0xf995('0x1')](_0x3ba99d['status'])['json'](_0x3ba99d);}_0x339654[_0xf995('0x2')](_0x46134d);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 760eee0..f87aade 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c76=['../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../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','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','User','hasOne','cascade','UserId','Recordings','hasMany','VoiceQueuesRt','VoiceExtension','OpenchannelInteractions','SmsInteractions','FaxInteractions','MailInteractions','UserNotifications','SenderId','belongsTo','UserProfile','userProfileId','Groups','chat_group_has_users','belongsToMany','Contacts','cm_user_has_contacts','cm_user_has_lists','user_has_teams','MailInteraction','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','VoicePrefixes','MailQueue','MailQueues','FaxQueues','SmsQueues','OpenchannelQueues','ChatWebsites','FaxAccounts','MailAccount','user_has_mail_accounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperFinals','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','Imap','Smtp','Dispositions','Answers','Interactions','List','ListId','TemplateId','team_has_mail_queues','Teams','MailInteractionId','Account','CmContact','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Interaction','ChatOfflineMessageId','restrict','TagId','Items','FaxAccountId','Exntensions','FaxMessage','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','Attachment','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','ChatWebsiteId','ChatProactiveAction','ProactiveActions','user_has_chat_websites','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatGroupId','CompanyId','CmHopper','Company','cm_contact_has_tags','Agent','Campaign','OwnerId','OneAll','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','SalesforceConfiguration','Configurations','Subjects','SubjectId','Descriptions','FieldId','AccountId','Subject','Description','DescriptionId','Field','VariableId','SugarcrmAccount','DeskAccount','int_desk_configuration_has_tags','ZendeskConfiguration','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskConfiguration','FreshdeskAccount','Dynamics365Account','Dynamics365Configuration','FreshsalesField','FromId','JscriptyQuestionReport','SessionId','ProjectId','team_has_chat_queues','ChatQueues','team_has_sms_queues','team_has_openchannel_queues','CampaignId','Lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToQueue','ToMailAccountId','ChatTransferReport','FromChatWebsiteId','ToAgent','ToChatQueueId','ToAccount','FromFaxAccountId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsAccountId','CmCustomField','HopperHistory','Queues','voice_queues_has_cm_lists','Extensions','UserProfileSection','UserProfileSections','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','sequelize','lodash','determine','motion2','xcall','127.0.0.1','mysql','name','sequelizeHistory','defaultsDeep','xC@LL1234','utf8','utf8_general_ci','database','username','password','options','import','../api/user/user.model','VoiceChanSpy','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory'];(function(_0x3d064a,_0x12cf18){var _0x5b2a83=function(_0x241866){while(--_0x241866){_0x3d064a['push'](_0x3d064a['shift']());}};_0x5b2a83(++_0x12cf18);}(_0x6c76,0x184));var _0x66c7=function(_0x5cd395,_0x507285){_0x5cd395=_0x5cd395-0x0;var _0x141227=_0x6c76[_0x5cd395];return _0x141227;};'use strict';var config=require(_0x66c7('0x0'));var Sequelize=require(_0x66c7('0x1'));var _=require(_0x66c7('0x2'));var jstz=require('jstz');var timezone=jstz[_0x66c7('0x3')]();config[_0x66c7('0x1')]=_['defaultsDeep'](config['sequelize'],{'database':_0x66c7('0x4'),'username':_0x66c7('0x5'),'password':'xC@LL1234','options':{'host':_0x66c7('0x6'),'port':0xcea,'dialect':_0x66c7('0x7'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x66c7('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});config[_0x66c7('0x9')]=_[_0x66c7('0xa')](config[_0x66c7('0x9')],{'database':'motion2','username':_0x66c7('0x5'),'password':_0x66c7('0xb'),'options':{'host':_0x66c7('0x6'),'port':0xcea,'dialect':_0x66c7('0x7'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x66c7('0x8')](),'define':{'charset':_0x66c7('0xc'),'collate':_0x66c7('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x66c7('0x1')][_0x66c7('0xe')],config[_0x66c7('0x1')][_0x66c7('0xf')],config['sequelize'][_0x66c7('0x10')],config[_0x66c7('0x1')][_0x66c7('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x66c7('0x9')][_0x66c7('0xe')],config[_0x66c7('0x9')][_0x66c7('0xf')],config[_0x66c7('0x9')][_0x66c7('0x10')],config['sequelizeHistory'][_0x66c7('0x11')])};db['User']=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x13'));db[_0x66c7('0x14')]=db[_0x66c7('0x1')]['import']('../api/voiceChanSpy/voiceChanSpy.model');db['VoiceContext']=db['sequelize'][_0x66c7('0x12')](_0x66c7('0x15'));db['VoiceExtension']=db['sequelize'][_0x66c7('0x12')](_0x66c7('0x16'));db[_0x66c7('0x17')]=db[_0x66c7('0x1')]['import']('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x66c7('0x18')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x19'));db[_0x66c7('0x1a')]=db[_0x66c7('0x1')]['import'](_0x66c7('0x1b'));db[_0x66c7('0x1c')]=db['sequelize'][_0x66c7('0x12')](_0x66c7('0x1d'));db[_0x66c7('0x1e')]=db[_0x66c7('0x1')]['import'](_0x66c7('0x1f'));db[_0x66c7('0x20')]=db['sequelize'][_0x66c7('0x12')](_0x66c7('0x21'));db[_0x66c7('0x22')]=db[_0x66c7('0x1')][_0x66c7('0x12')]('../api/voiceCallReport/voiceCallReport.model');db['VoiceDialReport']=db['sequelize'][_0x66c7('0x12')](_0x66c7('0x23'));db['VoiceAgentReport']=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x24'));db[_0x66c7('0x25')]=db[_0x66c7('0x1')][_0x66c7('0x12')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x66c7('0x26')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x27'));db[_0x66c7('0x28')]=db['sequelize'][_0x66c7('0x12')]('../api/trunk/trunk.model');db[_0x66c7('0x29')]=db['sequelize'][_0x66c7('0x12')](_0x66c7('0x2a'));db[_0x66c7('0x2b')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x2c'));db['UserVoiceQueue']=db['sequelize'][_0x66c7('0x12')](_0x66c7('0x2d'));db[_0x66c7('0x2e')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x2f'));db[_0x66c7('0x30')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x31'));db[_0x66c7('0x32')]=db[_0x66c7('0x1')]['import']('../api/userFaxQueue/userFaxQueue.model');db[_0x66c7('0x33')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x34'));db[_0x66c7('0x35')]=db[_0x66c7('0x1')][_0x66c7('0x12')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x66c7('0x36')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x37'));db[_0x66c7('0x38')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x39'));db[_0x66c7('0x3a')]=db[_0x66c7('0x1')][_0x66c7('0x12')]('../api/mailServerOut/mailServerOut.model');db['MailAccount']=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x3b'));db['MailQueue']=db['sequelize'][_0x66c7('0x12')](_0x66c7('0x3c'));db['MailSubstatus']=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x3d'));db['MailInteraction']=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x3e'));db[_0x66c7('0x3f')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x40'));db[_0x66c7('0x41')]=db[_0x66c7('0x1')]['import'](_0x66c7('0x42'));db[_0x66c7('0x43')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x44'));db[_0x66c7('0x45')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x46'));db[_0x66c7('0x47')]=db['sequelize']['import']('../api/dashboardItem/dashboardItem.model');db[_0x66c7('0x48')]=db[_0x66c7('0x1')]['import']('../api/faxAccount/faxAccount.model');db[_0x66c7('0x49')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x4a'));db[_0x66c7('0x4b')]=db['sequelize'][_0x66c7('0x12')]('../api/faxInteraction/faxInteraction.model');db['FaxMessage']=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x4c'));db[_0x66c7('0x4d')]=db['sequelize']['import'](_0x66c7('0x4e'));db['FaxQueueReport']=db['sequelize'][_0x66c7('0x12')](_0x66c7('0x4f'));db[_0x66c7('0x50')]=db[_0x66c7('0x1')]['import'](_0x66c7('0x51'));db[_0x66c7('0x52')]=db[_0x66c7('0x1')]['import'](_0x66c7('0x53'));db[_0x66c7('0x54')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x55'));db[_0x66c7('0x56')]=db[_0x66c7('0x1')][_0x66c7('0x12')]('../api/smsMessage/smsMessage.model');db[_0x66c7('0x57')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x58'));db[_0x66c7('0x59')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x5a'));db[_0x66c7('0x5b')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x5c'));db[_0x66c7('0x5d')]=db[_0x66c7('0x1')]['import'](_0x66c7('0x5e'));db[_0x66c7('0x5f')]=db[_0x66c7('0x1')][_0x66c7('0x12')]('../api/openchannelMessage/openchannelMessage.model');db[_0x66c7('0x60')]=db[_0x66c7('0x1')]['import'](_0x66c7('0x61'));db[_0x66c7('0x62')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x63'));db[_0x66c7('0x64')]=db[_0x66c7('0x1')]['import'](_0x66c7('0x65'));db[_0x66c7('0x66')]=db['sequelize'][_0x66c7('0x12')](_0x66c7('0x67'));db[_0x66c7('0x68')]=db['sequelize'][_0x66c7('0x12')](_0x66c7('0x69'));db[_0x66c7('0x6a')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x6b'));db[_0x66c7('0x6c')]=db[_0x66c7('0x1')]['import'](_0x66c7('0x6d'));db[_0x66c7('0x6e')]=db['sequelize'][_0x66c7('0x12')](_0x66c7('0x6f'));db[_0x66c7('0x70')]=db['sequelize']['import'](_0x66c7('0x71'));db['ChatProactiveAction']=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x72'));db[_0x66c7('0x73')]=db[_0x66c7('0x1')][_0x66c7('0x12')]('../api/cmCompany/cmCompany.model');db['CmContact']=db[_0x66c7('0x1')][_0x66c7('0x12')]('../api/cmContact/cmContact.model');db['CmHopper']=db[_0x66c7('0x1')]['import'](_0x66c7('0x74'));db[_0x66c7('0x75')]=db[_0x66c7('0x1')][_0x66c7('0x12')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x66c7('0x76')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x77'));db[_0x66c7('0x78')]=db[_0x66c7('0x1')]['import'](_0x66c7('0x79'));db[_0x66c7('0x7a')]=db[_0x66c7('0x1')]['import'](_0x66c7('0x7b'));db['CmCustomField']=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x7c'));db[_0x66c7('0x7d')]=db[_0x66c7('0x1')][_0x66c7('0x12')]('../api/action/action.model');db[_0x66c7('0x7e')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x7f'));db[_0x66c7('0x80')]=db['sequelize'][_0x66c7('0x12')](_0x66c7('0x81'));db[_0x66c7('0x82')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x83'));db[_0x66c7('0x84')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x85'));db[_0x66c7('0x86')]=db[_0x66c7('0x1')]['import'](_0x66c7('0x87'));db[_0x66c7('0x88')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x89'));db[_0x66c7('0x8a')]=db[_0x66c7('0x1')]['import'](_0x66c7('0x8b'));db[_0x66c7('0x8c')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x8d'));db[_0x66c7('0x8e')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x8f'));db[_0x66c7('0x90')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x91'));db[_0x66c7('0x92')]=db[_0x66c7('0x1')][_0x66c7('0x12')]('../api/tag/tag.model');db[_0x66c7('0x93')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x94'));db[_0x66c7('0x95')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x96'));db[_0x66c7('0x97')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x98'));db[_0x66c7('0x99')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x9a'));db[_0x66c7('0x9b')]=db['sequelize'][_0x66c7('0x12')](_0x66c7('0x9c'));db[_0x66c7('0x9d')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x9e'));db['AnalyticDefaultReport']=db['sequelize'][_0x66c7('0x12')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x66c7('0x9f')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xa0'));db[_0x66c7('0xa1')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xa2'));db[_0x66c7('0xa3')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xa4'));db['AnalyticTreeReport']=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xa5'));db[_0x66c7('0xa6')]=db['sequelize'][_0x66c7('0x12')](_0x66c7('0xa7'));db['SalesforceConfiguration']=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xa8'));db[_0x66c7('0xa9')]=db[_0x66c7('0x1')][_0x66c7('0x12')]('../api/intSalesforceField/intSalesforceField.model');db['SugarcrmAccount']=db[_0x66c7('0x1')]['import']('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x66c7('0xaa')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xab'));db[_0x66c7('0xac')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xad'));db['DeskAccount']=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xae'));db[_0x66c7('0xaf')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xb0'));db[_0x66c7('0xb1')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xb2'));db[_0x66c7('0xb3')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xb4'));db[_0x66c7('0xb5')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xb6'));db[_0x66c7('0xb7')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xb8'));db[_0x66c7('0xb9')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xba'));db['ZendeskConfiguration']=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xbb'));db['ZendeskField']=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xbc'));db['FreshdeskAccount']=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xbd'));db['FreshdeskConfiguration']=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xbe'));db[_0x66c7('0xbf')]=db['sequelize'][_0x66c7('0x12')](_0x66c7('0xc0'));db[_0x66c7('0xc1')]=db[_0x66c7('0x1')]['import']('../api/intVtigerAccount/intVtigerAccount.model');db[_0x66c7('0xc2')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xc3'));db[_0x66c7('0xc4')]=db['sequelize'][_0x66c7('0x12')](_0x66c7('0xc5'));db[_0x66c7('0xc6')]=db[_0x66c7('0x1')][_0x66c7('0x12')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x66c7('0xc7')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xc8'));db[_0x66c7('0xc9')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xca'));db['Dynamics365Account']=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xcb'));db['Dynamics365Configuration']=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xcc'));db[_0x66c7('0xcd')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xce'));db[_0x66c7('0xcf')]=db['sequelize'][_0x66c7('0x12')](_0x66c7('0xd0'));db[_0x66c7('0xd1')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xd2'));db['FreshsalesField']=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xd3'));db[_0x66c7('0x99')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x9a'));db[_0x66c7('0xd4')]=db['sequelize'][_0x66c7('0x12')](_0x66c7('0xd5'));db[_0x66c7('0xd6')]=db['sequelize'][_0x66c7('0x12')](_0x66c7('0xd7'));db[_0x66c7('0xd8')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xd9'));db[_0x66c7('0xda')]=db['sequelize'][_0x66c7('0x12')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db['JscriptyQuestionReport']=db['sequelize']['import'](_0x66c7('0xdb'));db[_0x66c7('0xdc')]=db['sequelize']['import'](_0x66c7('0xdd'));db[_0x66c7('0xde')]=db['sequelize']['import'](_0x66c7('0xdf'));db['SquareReport']=db['sequelize'][_0x66c7('0x12')](_0x66c7('0xe0'));db['SquareDetailsReport']=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xe1'));db[_0x66c7('0xe2')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xe3'));db[_0x66c7('0xe4')]=db[_0x66c7('0x1')]['import'](_0x66c7('0xe5'));db['SquareOdbc']=db[_0x66c7('0x1')][_0x66c7('0x12')]('../api/squareOdbc/squareOdbc.model');db[_0x66c7('0xe6')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xe7'));db[_0x66c7('0xe8')]=db['sequelize'][_0x66c7('0x12')]('../api/squareRecording/squareRecording.model');db[_0x66c7('0xe9')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xea'));db[_0x66c7('0xeb')]=db[_0x66c7('0x1')][_0x66c7('0x12')]('../api/team/team.model');db['License']=db[_0x66c7('0x1')]['import']('../api/license/license.model');db['Campaign']=db[_0x66c7('0x1')]['import'](_0x66c7('0xec'));db[_0x66c7('0xed')]=db[_0x66c7('0x1')]['import'](_0x66c7('0xee'));db['Attachment']=db[_0x66c7('0x1')]['import'](_0x66c7('0xef'));db[_0x66c7('0xf0')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xf1'));db[_0x66c7('0xf2')]=db[_0x66c7('0x1')]['import'](_0x66c7('0xf3'));db['ChatTransferReport']=db['sequelize'][_0x66c7('0x12')](_0x66c7('0xf4'));db[_0x66c7('0xf5')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xf6'));db[_0x66c7('0xf7')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xf8'));db[_0x66c7('0xf9')]=db[_0x66c7('0x1')][_0x66c7('0x12')]('../api/smsTransferReport/smsTransferReport.model');db[_0x66c7('0xfa')]=db['sequelize'][_0x66c7('0x12')](_0x66c7('0xfb'));db[_0x66c7('0xfc')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xfd'));db['UserProfile']=db['sequelize']['import']('../api/userProfile/userProfile.model');db['UserProfileSection']=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0xfe'));db[_0x66c7('0xff')]=db['sequelize']['import'](_0x66c7('0x100'));db[_0x66c7('0x101')]=db['sequelize'][_0x66c7('0x12')](_0x66c7('0x102'));db['WhatsappAccount']=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x103'));db[_0x66c7('0x104')]=db['sequelize']['import'](_0x66c7('0x105'));db[_0x66c7('0x106')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x107'));db[_0x66c7('0x108')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x109'));db[_0x66c7('0x10a')]=db['sequelize'][_0x66c7('0x12')](_0x66c7('0x10b'));db[_0x66c7('0x10c')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x10d'));db[_0x66c7('0x10e')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x10f'));db['CloudProvider']=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x110'));db[_0x66c7('0x111')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x112'));db[_0x66c7('0x113')]=db['sequelize'][_0x66c7('0x12')](_0x66c7('0x114'));db[_0x66c7('0x115')]=db[_0x66c7('0x1')][_0x66c7('0x12')](_0x66c7('0x116'));db[_0x66c7('0x117')][_0x66c7('0x118')](db[_0x66c7('0x1e')],{'as':_0x66c7('0x1e'),'onDelete':_0x66c7('0x119'),'foreignKey':_0x66c7('0x11a')});db['User']['hasMany'](db[_0x66c7('0x1a')],{'as':_0x66c7('0x11b'),'foreignKey':_0x66c7('0x11a')});db[_0x66c7('0x117')][_0x66c7('0x11c')](db[_0x66c7('0x2b')],{'as':_0x66c7('0x11d'),'foreignKey':_0x66c7('0x11a')});db['User'][_0x66c7('0x11c')](db[_0x66c7('0x11e')],{'as':'Extensions','onDelete':_0x66c7('0x119'),'hooks':!![]});db[_0x66c7('0x117')][_0x66c7('0x11c')](db[_0x66c7('0x76')],{'as':'HopperFinals','foreignKey':_0x66c7('0x11a')});db[_0x66c7('0x117')][_0x66c7('0x11c')](db[_0x66c7('0x78')],{'as':'HopperHistory','foreignKey':'UserId'});db[_0x66c7('0x117')][_0x66c7('0x11c')](db[_0x66c7('0x7a')],{'as':_0x66c7('0x7a'),'foreignKey':_0x66c7('0x11a')});db[_0x66c7('0x117')]['hasMany'](db[_0x66c7('0x5d')],{'as':_0x66c7('0x11f'),'foreignKey':_0x66c7('0x11a')});db[_0x66c7('0x117')]['hasMany'](db[_0x66c7('0x68')],{'as':'ChatInteractions','foreignKey':_0x66c7('0x11a')});db['User']['hasMany'](db[_0x66c7('0x54')],{'as':_0x66c7('0x120'),'foreignKey':'UserId'});db['User'][_0x66c7('0x11c')](db['FaxInteraction'],{'as':_0x66c7('0x121'),'foreignKey':_0x66c7('0x11a')});db[_0x66c7('0x117')][_0x66c7('0x11c')](db['MailInteraction'],{'as':_0x66c7('0x122'),'foreignKey':_0x66c7('0x11a')});db[_0x66c7('0x117')][_0x66c7('0x11c')](db[_0x66c7('0x106')],{'as':'WhatsappInteractions','foreignKey':'UserId'});db[_0x66c7('0x117')][_0x66c7('0x11c')](db[_0x66c7('0x101')],{'as':_0x66c7('0x123'),'foreignKey':_0x66c7('0x124')});db['User'][_0x66c7('0x125')](db[_0x66c7('0x126')],{'as':_0x66c7('0x126'),'foreignKey':_0x66c7('0x127')});db[_0x66c7('0x117')]['belongsToMany'](db['ChatGroup'],{'as':_0x66c7('0x128'),'through':_0x66c7('0x129')});db['User'][_0x66c7('0x12a')](db['CmContact'],{'as':_0x66c7('0x12b'),'through':_0x66c7('0x12c')});db[_0x66c7('0x117')]['belongsToMany'](db[_0x66c7('0xfa')],{'as':'Lists','through':_0x66c7('0x12d')});db['User'][_0x66c7('0x12a')](db[_0x66c7('0xeb')],{'through':_0x66c7('0x12e')});db[_0x66c7('0x117')]['belongsToMany'](db[_0x66c7('0x12f')],{'as':_0x66c7('0x122'),'through':'user_has_mail_interactions'});db[_0x66c7('0x117')][_0x66c7('0x12a')](db['ChatInteraction'],{'as':_0x66c7('0x130'),'through':_0x66c7('0x131')});db[_0x66c7('0x117')][_0x66c7('0x12a')](db['FaxInteraction'],{'as':'FaxInteractions','through':_0x66c7('0x132')});db['User'][_0x66c7('0x12a')](db[_0x66c7('0x54')],{'as':'SmsInteractions','through':_0x66c7('0x133')});db['User'][_0x66c7('0x12a')](db[_0x66c7('0x5d')],{'as':_0x66c7('0x11f'),'through':_0x66c7('0x134')});db['User'][_0x66c7('0x12a')](db[_0x66c7('0x106')],{'as':'WhatsappInteractions','through':_0x66c7('0x135')});db[_0x66c7('0x117')][_0x66c7('0x12a')](db[_0x66c7('0x18')],{'as':_0x66c7('0x136'),'through':_0x66c7('0x137'),'required':![]});db[_0x66c7('0x117')][_0x66c7('0x12a')](db[_0x66c7('0xfc')],{'as':_0x66c7('0x138'),'through':_0x66c7('0x115'),'required':![]});db[_0x66c7('0x117')][_0x66c7('0x12a')](db[_0x66c7('0x139')],{'as':_0x66c7('0x13a'),'through':_0x66c7('0x30'),'required':![]});db['User'][_0x66c7('0x12a')](db['ChatQueue'],{'as':'ChatQueues','through':_0x66c7('0x2e'),'required':![],'hooks':!![]});db[_0x66c7('0x117')]['belongsToMany'](db[_0x66c7('0x4d')],{'as':_0x66c7('0x13b'),'through':_0x66c7('0x32'),'required':![]});db[_0x66c7('0x117')][_0x66c7('0x12a')](db['SmsQueue'],{'as':_0x66c7('0x13c'),'through':_0x66c7('0x33'),'required':![]});db[_0x66c7('0x117')][_0x66c7('0x12a')](db[_0x66c7('0x60')],{'as':_0x66c7('0x13d'),'through':'UserOpenchannelQueue','required':![]});db[_0x66c7('0x117')]['belongsToMany'](db[_0x66c7('0x10e')],{'as':'WhatsappQueues','through':_0x66c7('0x36'),'required':![]});db[_0x66c7('0x117')][_0x66c7('0x12a')](db[_0x66c7('0xfa')],{'through':_0x66c7('0x12d')});db['User'][_0x66c7('0x12a')](db[_0x66c7('0x62')],{'as':_0x66c7('0x13e'),'through':'user_has_chat_websites'});db[_0x66c7('0x117')]['belongsToMany'](db[_0x66c7('0x48')],{'as':_0x66c7('0x13f'),'through':'user_has_fax_accounts'});db[_0x66c7('0x117')][_0x66c7('0x12a')](db[_0x66c7('0x140')],{'as':'MailAccounts','through':_0x66c7('0x141')});db[_0x66c7('0x117')][_0x66c7('0x12a')](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':_0x66c7('0x142')});db['User'][_0x66c7('0x12a')](db[_0x66c7('0x50')],{'as':'SmsAccounts','through':_0x66c7('0x143')});db['User']['belongsToMany'](db[_0x66c7('0x144')],{'as':_0x66c7('0x145'),'through':_0x66c7('0x146')});db['User'][_0x66c7('0x12a')](db[_0x66c7('0xe6')],{'as':_0x66c7('0x147'),'through':_0x66c7('0x148')});db[_0x66c7('0x14')]['hasMany'](db[_0x66c7('0x11e')],{'as':_0x66c7('0x149'),'onDelete':_0x66c7('0x119'),'foreignKey':'ChanSpyId'});db[_0x66c7('0x14a')]['hasMany'](db[_0x66c7('0x11e')],{'onDelete':_0x66c7('0x119')});db[_0x66c7('0x11e')][_0x66c7('0x11c')](db[_0x66c7('0x11e')],{'as':_0x66c7('0x14b'),'onDelete':'cascade'});db[_0x66c7('0x17')][_0x66c7('0x12a')](db['Sound'],{'as':_0x66c7('0x14c'),'through':_0x66c7('0x14d')});db[_0x66c7('0x18')][_0x66c7('0x11c')](db['UserVoiceQueueRt'],{'as':_0x66c7('0x14e'),'foreignKey':_0x66c7('0x14f')});db['VoiceQueue']['hasMany'](db['CmHopper'],{'as':_0x66c7('0x150'),'foreignKey':_0x66c7('0x14f')});db[_0x66c7('0x18')][_0x66c7('0x11c')](db[_0x66c7('0x76')],{'as':_0x66c7('0x151'),'foreignKey':'VoiceQueueId'});db[_0x66c7('0x18')][_0x66c7('0x11c')](db[_0x66c7('0x78')],{'as':_0x66c7('0x152'),'foreignKey':_0x66c7('0x14f')});db[_0x66c7('0x18')][_0x66c7('0x11c')](db['ReportAgentPreview'],{'as':_0x66c7('0x7a'),'foreignKey':'VoiceQueueId'});db[_0x66c7('0x18')][_0x66c7('0x11c')](db['CmHopperBlack'],{'as':_0x66c7('0x153'),'foreignKey':_0x66c7('0x14f')});db[_0x66c7('0x18')]['hasMany'](db[_0x66c7('0xdc')],{'as':_0x66c7('0x154'),'foreignKey':_0x66c7('0x14f')});db[_0x66c7('0x18')][_0x66c7('0x125')](db['Trunk'],{'as':_0x66c7('0x28'),'foreignKey':_0x66c7('0x155')});db[_0x66c7('0x18')][_0x66c7('0x125')](db['Trunk'],{'as':_0x66c7('0x156'),'foreignKey':_0x66c7('0x157')});db[_0x66c7('0x18')]['belongsTo'](db['Interval'],{'as':_0x66c7('0x86'),'foreignKey':_0x66c7('0x158')});db[_0x66c7('0x18')][_0x66c7('0x125')](db[_0x66c7('0x88')],{'as':_0x66c7('0x159'),'foreignKey':_0x66c7('0x15a')});db[_0x66c7('0x18')][_0x66c7('0x12a')](db[_0x66c7('0xfa')],{'as':'Lists','through':'voice_queues_has_cm_lists'});db[_0x66c7('0x18')][_0x66c7('0x12a')](db[_0x66c7('0x117')],{'as':_0x66c7('0x15b'),'through':_0x66c7('0x137')});db[_0x66c7('0x18')][_0x66c7('0x12a')](db['Team'],{'as':'Teams','through':_0x66c7('0x111')});db[_0x66c7('0x18')][_0x66c7('0x12a')](db[_0x66c7('0xfa')],{'as':_0x66c7('0x15c'),'through':_0x66c7('0x15d')});db[_0x66c7('0x1a')]['belongsTo'](db[_0x66c7('0x117')],{'as':_0x66c7('0x117'),'foreignKey':_0x66c7('0x11a')});db[_0x66c7('0x1c')][_0x66c7('0x125')](db[_0x66c7('0x117')],{'as':_0x66c7('0x117'),'foreignKey':_0x66c7('0x11a')});db[_0x66c7('0x1e')]['hasMany'](db[_0x66c7('0x20')],{'as':_0x66c7('0x15e'),'onDelete':'cascade','foreignKey':_0x66c7('0x15f'),'sourceKey':_0x66c7('0x160')});db[_0x66c7('0x20')][_0x66c7('0x125')](db[_0x66c7('0x1e')],{'foreignKey':_0x66c7('0x15f'),'targetKey':'mailbox'});db[_0x66c7('0x22')]['hasMany'](db[_0x66c7('0x25')],{'as':_0x66c7('0x161'),'foreignKey':_0x66c7('0x162'),'constraints':![]});db[_0x66c7('0x22')][_0x66c7('0x11c')](db['VoiceAgentReport'],{'as':_0x66c7('0x163'),'foreignKey':_0x66c7('0x162'),'constraints':![]});db[_0x66c7('0x22')][_0x66c7('0x125')](db[_0x66c7('0x117')],{'as':'User','foreignKey':_0x66c7('0x11a')});db[_0x66c7('0x22')][_0x66c7('0x125')](db['CmContact'],{'as':_0x66c7('0x164'),'foreignKey':_0x66c7('0x165')});db[_0x66c7('0x38')][_0x66c7('0x125')](db[_0x66c7('0x140')],{'as':_0x66c7('0x140'),'foreignKey':_0x66c7('0x166')});db['MailServerOut'][_0x66c7('0x125')](db[_0x66c7('0x140')],{'as':_0x66c7('0x140'),'foreignKey':_0x66c7('0x166')});db[_0x66c7('0x140')]['hasOne'](db['MailServerIn'],{'as':_0x66c7('0x167'),'onDelete':_0x66c7('0x119')});db[_0x66c7('0x140')]['hasOne'](db[_0x66c7('0x3a')],{'as':_0x66c7('0x168'),'onDelete':_0x66c7('0x119')});db[_0x66c7('0x140')][_0x66c7('0x11c')](db[_0x66c7('0x82')],{'as':_0x66c7('0x169'),'foreignKey':'MailAccountId','onDelete':'cascade'});db[_0x66c7('0x140')][_0x66c7('0x11c')](db['CannedAnswer'],{'as':_0x66c7('0x16a'),'foreignKey':_0x66c7('0x166')});db[_0x66c7('0x140')][_0x66c7('0x11c')](db['MailMessage'],{'as':_0x66c7('0x15e'),'foreignKey':_0x66c7('0x166')});db['MailAccount'][_0x66c7('0x11c')](db[_0x66c7('0x12f')],{'as':_0x66c7('0x16b')});db['MailAccount'][_0x66c7('0x11c')](db['MailApplication'],{'as':'Applications'});db[_0x66c7('0x140')][_0x66c7('0x125')](db[_0x66c7('0xfa')],{'as':_0x66c7('0x16c'),'foreignKey':_0x66c7('0x16d')});db[_0x66c7('0x140')][_0x66c7('0x125')](db[_0x66c7('0x93')],{'as':_0x66c7('0x93'),'foreignKey':_0x66c7('0x16e')});db[_0x66c7('0x140')][_0x66c7('0x125')](db[_0x66c7('0x88')],{'as':'mandatoryDispositionPause','foreignKey':_0x66c7('0x15a')});db[_0x66c7('0x140')][_0x66c7('0x12a')](db[_0x66c7('0x117')],{'as':_0x66c7('0x15b'),'through':_0x66c7('0x141')});db[_0x66c7('0x139')]['belongsToMany'](db[_0x66c7('0x117')],{'as':_0x66c7('0x15b'),'through':_0x66c7('0x30')});db[_0x66c7('0x139')][_0x66c7('0x12a')](db[_0x66c7('0xeb')],{'through':_0x66c7('0x16f'),'as':_0x66c7('0x170')});db[_0x66c7('0x12f')][_0x66c7('0x11c')](db[_0x66c7('0x3f')],{'as':'Messages','onDelete':_0x66c7('0x119'),'foreignKey':_0x66c7('0x171')});db[_0x66c7('0x12f')][_0x66c7('0x125')](db[_0x66c7('0x140')],{'as':_0x66c7('0x172'),'foreignKey':'MailAccountId'});db[_0x66c7('0x12f')]['belongsTo'](db[_0x66c7('0x173')],{'as':_0x66c7('0x164'),'foreignKey':_0x66c7('0x165')});db[_0x66c7('0x12f')][_0x66c7('0x125')](db[_0x66c7('0x117')],{'as':_0x66c7('0x174'),'foreignKey':_0x66c7('0x11a')});db[_0x66c7('0x12f')][_0x66c7('0x12a')](db[_0x66c7('0x92')],{'through':_0x66c7('0x175'),'as':_0x66c7('0x176')});db[_0x66c7('0x12f')][_0x66c7('0x12a')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0x66c7('0x177')});db['MailInteraction']['belongsToMany'](db['User'],{'as':_0x66c7('0x178'),'through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db['MailMessage']['hasMany'](db['Attachment'],{'as':_0x66c7('0x179'),'onDelete':_0x66c7('0x119')});db[_0x66c7('0x3f')][_0x66c7('0x125')](db[_0x66c7('0x117')],{'as':_0x66c7('0x117')});db[_0x66c7('0x3f')]['belongsTo'](db['CmContact'],{'onDelete':_0x66c7('0x119'),'as':_0x66c7('0x164')});db[_0x66c7('0x3f')][_0x66c7('0x125')](db[_0x66c7('0x12f')],{'as':_0x66c7('0x17a'),'foreignKey':_0x66c7('0x171')});db['MailMessage'][_0x66c7('0x125')](db[_0x66c7('0x140')],{'as':_0x66c7('0x172'),'foreignKey':_0x66c7('0x166')});db[_0x66c7('0x3f')]['belongsTo'](db[_0x66c7('0x62')],{'as':_0x66c7('0x62'),'foreignKey':'ChatWebsiteId'});db[_0x66c7('0x3f')][_0x66c7('0x125')](db[_0x66c7('0x6c')],{'as':_0x66c7('0x6c'),'foreignKey':_0x66c7('0x17b')});db['MailApplication']['belongsTo'](db[_0x66c7('0x117')],{'onDelete':'restrict'});db[_0x66c7('0x41')][_0x66c7('0x125')](db['MailQueue'],{'onDelete':_0x66c7('0x17c')});db[_0x66c7('0x41')][_0x66c7('0x125')](db[_0x66c7('0x140')],{'onDelete':'restrict'});db[_0x66c7('0x41')][_0x66c7('0x125')](db[_0x66c7('0x86')],{'onDelete':'restrict','foreignKey':'IntervalId'});db['MailApplication'][_0x66c7('0x125')](db[_0x66c7('0x92')],{'onDelete':'restrict','foreignKey':_0x66c7('0x17d')});db[_0x66c7('0x43')][_0x66c7('0x125')](db[_0x66c7('0x140')],{});db[_0x66c7('0x43')][_0x66c7('0x125')](db[_0x66c7('0xfa')],{'as':_0x66c7('0x16c'),'foreignKey':_0x66c7('0x16d')});db[_0x66c7('0x43')]['belongsTo'](db[_0x66c7('0x173')],{'as':_0x66c7('0x164'),'foreignKey':_0x66c7('0x165')});db['MailQueueReport'][_0x66c7('0x125')](db['MailInteraction'],{});db[_0x66c7('0x43')][_0x66c7('0x125')](db[_0x66c7('0x3f')],{});db['MailQueueReport'][_0x66c7('0x125')](db[_0x66c7('0x117')],{});db[_0x66c7('0x43')]['belongsTo'](db[_0x66c7('0x139')],{});db[_0x66c7('0x45')]['hasMany'](db['DashboardItem'],{'as':_0x66c7('0x17e'),'onDelete':'cascade'});db[_0x66c7('0x48')][_0x66c7('0x11c')](db[_0x66c7('0x82')],{'as':_0x66c7('0x169'),'foreignKey':_0x66c7('0x17f'),'onDelete':_0x66c7('0x119')});db[_0x66c7('0x48')][_0x66c7('0x11c')](db[_0x66c7('0x80')],{'as':_0x66c7('0x16a'),'foreignKey':'FaxAccountId'});db['FaxAccount'][_0x66c7('0x11c')](db['FaxInteraction'],{'as':'Interactions'});db[_0x66c7('0x48')][_0x66c7('0x11c')](db[_0x66c7('0x49')],{'as':_0x66c7('0x14b')});db[_0x66c7('0x48')][_0x66c7('0x11c')](db[_0x66c7('0x11e')],{'as':_0x66c7('0x180'),'onDelete':'cascade'});db[_0x66c7('0x48')][_0x66c7('0x11c')](db[_0x66c7('0x181')],{'as':_0x66c7('0x15e')});db[_0x66c7('0x48')][_0x66c7('0x125')](db[_0x66c7('0x28')],{'as':_0x66c7('0x28')});db['FaxAccount'][_0x66c7('0x125')](db[_0x66c7('0xfa')],{'as':_0x66c7('0x16c'),'foreignKey':'ListId'});db[_0x66c7('0x48')]['belongsTo'](db[_0x66c7('0x88')],{'as':_0x66c7('0x159'),'foreignKey':_0x66c7('0x15a')});db[_0x66c7('0x48')][_0x66c7('0x12a')](db[_0x66c7('0x117')],{'as':'Agents','through':_0x66c7('0x182')});db[_0x66c7('0x49')][_0x66c7('0x125')](db[_0x66c7('0x117')],{'onDelete':_0x66c7('0x17c')});db[_0x66c7('0x49')][_0x66c7('0x125')](db['FaxQueue'],{'onDelete':_0x66c7('0x17c')});db[_0x66c7('0x49')][_0x66c7('0x125')](db[_0x66c7('0x48')],{'onDelete':_0x66c7('0x17c')});db[_0x66c7('0x49')][_0x66c7('0x125')](db[_0x66c7('0x92')],{'onDelete':_0x66c7('0x17c'),'foreignKey':_0x66c7('0x17d')});db[_0x66c7('0x4b')]['hasMany'](db[_0x66c7('0x181')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x66c7('0x183')});db[_0x66c7('0x4b')][_0x66c7('0x125')](db[_0x66c7('0x48')],{'as':_0x66c7('0x172'),'foreignKey':_0x66c7('0x17f')});db[_0x66c7('0x4b')][_0x66c7('0x125')](db['CmContact'],{'as':_0x66c7('0x164'),'foreignKey':_0x66c7('0x165')});db['FaxInteraction'][_0x66c7('0x125')](db[_0x66c7('0x117')],{'as':'Owner','foreignKey':_0x66c7('0x11a')});db[_0x66c7('0x4b')][_0x66c7('0x12a')](db[_0x66c7('0x92')],{'through':_0x66c7('0x184'),'as':_0x66c7('0x176')});db[_0x66c7('0x4b')][_0x66c7('0x12a')](db[_0x66c7('0x92')],{'through':_0x66c7('0x184'),'as':_0x66c7('0x177')});db[_0x66c7('0x4b')][_0x66c7('0x12a')](db[_0x66c7('0x117')],{'as':_0x66c7('0x178'),'through':_0x66c7('0x132'),'foreignKey':_0x66c7('0x183')});db[_0x66c7('0x181')][_0x66c7('0x125')](db[_0x66c7('0x117')],{'onDelete':_0x66c7('0x119'),'as':_0x66c7('0x117')});db[_0x66c7('0x181')][_0x66c7('0x125')](db[_0x66c7('0x4b')],{'as':'Interaction','foreignKey':'FaxInteractionId'});db[_0x66c7('0x181')][_0x66c7('0x125')](db[_0x66c7('0x173')],{'onDelete':_0x66c7('0x119'),'as':_0x66c7('0x164')});db[_0x66c7('0x181')][_0x66c7('0x125')](db[_0x66c7('0x185')],{'as':_0x66c7('0x185'),'foreignKey':_0x66c7('0x186')});db[_0x66c7('0x181')]['belongsTo'](db[_0x66c7('0x48')],{'as':_0x66c7('0x172'),'foreignKey':_0x66c7('0x17f')});db[_0x66c7('0x4d')][_0x66c7('0x12a')](db['User'],{'as':'Agents','through':_0x66c7('0x32')});db[_0x66c7('0x4d')]['belongsToMany'](db[_0x66c7('0xeb')],{'through':_0x66c7('0x187'),'as':_0x66c7('0x170')});db['FaxQueueReport'][_0x66c7('0x125')](db['FaxAccount'],{});db[_0x66c7('0x188')]['belongsTo'](db[_0x66c7('0xfa')],{'as':_0x66c7('0x16c'),'foreignKey':_0x66c7('0x16d')});db['FaxQueueReport'][_0x66c7('0x125')](db[_0x66c7('0x173')],{'as':_0x66c7('0x164'),'foreignKey':_0x66c7('0x165')});db[_0x66c7('0x188')]['belongsTo'](db['FaxInteraction'],{});db[_0x66c7('0x188')]['belongsTo'](db[_0x66c7('0x181')],{});db[_0x66c7('0x188')][_0x66c7('0x125')](db['User'],{});db[_0x66c7('0x188')][_0x66c7('0x125')](db[_0x66c7('0x4d')],{});db['SmsAccount']['hasMany'](db[_0x66c7('0x82')],{'as':_0x66c7('0x169'),'foreignKey':_0x66c7('0x189'),'onDelete':_0x66c7('0x119')});db[_0x66c7('0x50')][_0x66c7('0x11c')](db['CannedAnswer'],{'as':'Answers','foreignKey':'SmsAccountId'});db[_0x66c7('0x50')][_0x66c7('0x11c')](db[_0x66c7('0x56')],{'as':_0x66c7('0x15e'),'foreignKey':_0x66c7('0x189')});db[_0x66c7('0x50')][_0x66c7('0x11c')](db['SmsInteraction'],{'as':_0x66c7('0x16b')});db['SmsAccount']['hasMany'](db[_0x66c7('0x52')],{'as':_0x66c7('0x14b')});db[_0x66c7('0x50')][_0x66c7('0x125')](db[_0x66c7('0xfa')],{'as':_0x66c7('0x16c'),'foreignKey':'ListId'});db[_0x66c7('0x50')][_0x66c7('0x125')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['SmsAccount'][_0x66c7('0x12a')](db[_0x66c7('0x117')],{'as':_0x66c7('0x15b'),'through':_0x66c7('0x143')});db['SmsApplication']['belongsTo'](db[_0x66c7('0x117')],{'onDelete':_0x66c7('0x17c')});db[_0x66c7('0x52')][_0x66c7('0x125')](db[_0x66c7('0x57')],{'onDelete':_0x66c7('0x17c')});db[_0x66c7('0x52')]['belongsTo'](db[_0x66c7('0x50')],{'onDelete':_0x66c7('0x17c')});db[_0x66c7('0x52')][_0x66c7('0x125')](db[_0x66c7('0x86')],{'onDelete':_0x66c7('0x17c'),'foreignKey':_0x66c7('0x158')});db[_0x66c7('0x52')]['belongsTo'](db[_0x66c7('0x92')],{'onDelete':_0x66c7('0x17c'),'foreignKey':_0x66c7('0x17d')});db[_0x66c7('0x54')][_0x66c7('0x11c')](db[_0x66c7('0x56')],{'as':_0x66c7('0x15e'),'onDelete':_0x66c7('0x119'),'foreignKey':'SmsInteractionId'});db[_0x66c7('0x54')]['belongsTo'](db[_0x66c7('0x50')],{'as':_0x66c7('0x172'),'foreignKey':_0x66c7('0x189')});db[_0x66c7('0x54')][_0x66c7('0x125')](db[_0x66c7('0x173')],{'as':_0x66c7('0x164'),'foreignKey':_0x66c7('0x165')});db[_0x66c7('0x54')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':'UserId'});db[_0x66c7('0x54')][_0x66c7('0x12a')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0x66c7('0x176')});db[_0x66c7('0x54')][_0x66c7('0x12a')](db['Tag'],{'through':_0x66c7('0x18a'),'as':_0x66c7('0x177')});db[_0x66c7('0x54')][_0x66c7('0x12a')](db[_0x66c7('0x117')],{'as':_0x66c7('0x178'),'through':_0x66c7('0x133'),'foreignKey':_0x66c7('0x18b')});db[_0x66c7('0x56')][_0x66c7('0x125')](db['User'],{'as':'User'});db['SmsMessage'][_0x66c7('0x125')](db[_0x66c7('0x173')],{'onDelete':_0x66c7('0x119'),'as':_0x66c7('0x164')});db[_0x66c7('0x56')][_0x66c7('0x125')](db[_0x66c7('0x54')],{'onDelete':_0x66c7('0x119'),'as':_0x66c7('0x17a'),'foreignKey':_0x66c7('0x18b')});db[_0x66c7('0x56')][_0x66c7('0x125')](db[_0x66c7('0x50')],{'as':_0x66c7('0x172'),'foreignKey':'SmsAccountId'});db[_0x66c7('0x57')][_0x66c7('0x12a')](db[_0x66c7('0x117')],{'as':_0x66c7('0x15b'),'through':_0x66c7('0x33'),'foreignKey':_0x66c7('0x18c')});db[_0x66c7('0x57')][_0x66c7('0x12a')](db['Team'],{'through':'team_has_sms_queues','as':_0x66c7('0x170')});db[_0x66c7('0x59')][_0x66c7('0x11c')](db[_0x66c7('0x82')],{'as':_0x66c7('0x169'),'foreignKey':_0x66c7('0x18d'),'onDelete':_0x66c7('0x119')});db[_0x66c7('0x59')][_0x66c7('0x11c')](db[_0x66c7('0x80')],{'as':'Answers','foreignKey':_0x66c7('0x18d')});db['OpenchannelAccount'][_0x66c7('0x11c')](db[_0x66c7('0x5d')],{'as':'Interactions','foreignKey':_0x66c7('0x18d')});db['OpenchannelAccount'][_0x66c7('0x11c')](db[_0x66c7('0x5f')],{'as':_0x66c7('0x15e'),'foreignKey':'OpenchannelAccountId'});db[_0x66c7('0x59')][_0x66c7('0x11c')](db[_0x66c7('0x5b')],{'as':_0x66c7('0x14b'),'foreignKey':_0x66c7('0x18d')});db[_0x66c7('0x59')][_0x66c7('0x125')](db['CmList'],{'as':_0x66c7('0x16c'),'foreignKey':'ListId'});db[_0x66c7('0x59')][_0x66c7('0x125')](db[_0x66c7('0x88')],{'as':_0x66c7('0x159'),'foreignKey':_0x66c7('0x15a')});db['OpenchannelAccount'][_0x66c7('0x12a')](db[_0x66c7('0x117')],{'as':'Agents','through':_0x66c7('0x142')});db[_0x66c7('0x5b')]['belongsTo'](db[_0x66c7('0x117')],{'onDelete':_0x66c7('0x17c')});db[_0x66c7('0x5b')]['belongsTo'](db[_0x66c7('0x60')],{'onDelete':'restrict','foreignKey':_0x66c7('0x18e')});db['OpenchannelApplication'][_0x66c7('0x125')](db[_0x66c7('0x59')],{'onDelete':_0x66c7('0x17c'),'foreignKey':_0x66c7('0x18d')});db[_0x66c7('0x5b')][_0x66c7('0x125')](db[_0x66c7('0x86')],{'onDelete':_0x66c7('0x17c'),'foreignKey':_0x66c7('0x158')});db['OpenchannelApplication'][_0x66c7('0x125')](db['Tag'],{'onDelete':_0x66c7('0x17c'),'foreignKey':_0x66c7('0x17d')});db[_0x66c7('0x5d')][_0x66c7('0x11c')](db[_0x66c7('0x5f')],{'as':_0x66c7('0x15e'),'onDelete':_0x66c7('0x119'),'foreignKey':_0x66c7('0x18f')});db[_0x66c7('0x5d')][_0x66c7('0x125')](db['OpenchannelAccount'],{'as':'Account','foreignKey':_0x66c7('0x18d')});db[_0x66c7('0x5d')][_0x66c7('0x125')](db[_0x66c7('0x173')],{'as':_0x66c7('0x164'),'foreignKey':'ContactId'});db['OpenchannelInteraction'][_0x66c7('0x125')](db[_0x66c7('0x117')],{'as':_0x66c7('0x174'),'foreignKey':_0x66c7('0x11a')});db[_0x66c7('0x5d')][_0x66c7('0x12a')](db[_0x66c7('0x92')],{'through':_0x66c7('0x190'),'as':_0x66c7('0x176')});db['OpenchannelInteraction'][_0x66c7('0x12a')](db[_0x66c7('0x92')],{'through':_0x66c7('0x190'),'as':_0x66c7('0x177')});db[_0x66c7('0x5d')][_0x66c7('0x12a')](db['User'],{'as':_0x66c7('0x178'),'through':_0x66c7('0x134'),'foreignKey':'OpenchannelInteractionId'});db[_0x66c7('0x5f')][_0x66c7('0x125')](db[_0x66c7('0x117')],{'onDelete':'cascade','as':'User'});db[_0x66c7('0x5f')][_0x66c7('0x125')](db['CmContact'],{'onDelete':_0x66c7('0x119'),'as':_0x66c7('0x164')});db[_0x66c7('0x5f')]['belongsTo'](db[_0x66c7('0x5d')],{'onDelete':_0x66c7('0x119'),'as':_0x66c7('0x17a'),'foreignKey':'OpenchannelInteractionId'});db[_0x66c7('0x5f')]['belongsTo'](db['Attachment'],{'as':_0x66c7('0x185'),'foreignKey':'AttachmentId'});db['OpenchannelMessage'][_0x66c7('0x125')](db[_0x66c7('0x59')],{'as':_0x66c7('0x172'),'foreignKey':'OpenchannelAccountId'});db[_0x66c7('0x60')][_0x66c7('0x12a')](db[_0x66c7('0x117')],{'as':_0x66c7('0x15b'),'through':_0x66c7('0x35'),'foreignKey':_0x66c7('0x18e')});db[_0x66c7('0x60')]['belongsToMany'](db['Team'],{'through':'team_has_openchannel_queues','as':'Teams'});db[_0x66c7('0x62')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x66c7('0x191'),'onDelete':_0x66c7('0x119')});db[_0x66c7('0x62')][_0x66c7('0x11c')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x66c7('0x191')});db['ChatWebsite'][_0x66c7('0x11c')](db[_0x66c7('0x192')],{'as':_0x66c7('0x193')});db['ChatWebsite']['hasMany'](db[_0x66c7('0x68')],{'as':'Interactions'});db[_0x66c7('0x62')][_0x66c7('0x11c')](db[_0x66c7('0x66')],{'as':'Applications'});db[_0x66c7('0x62')]['hasMany'](db[_0x66c7('0x6a')],{'as':_0x66c7('0x15e')});db[_0x66c7('0x62')][_0x66c7('0x125')](db[_0x66c7('0xfa')],{'as':_0x66c7('0x16c'),'foreignKey':_0x66c7('0x16d')});db[_0x66c7('0x62')]['belongsTo'](db[_0x66c7('0x86')],{'as':_0x66c7('0x86'),'foreignKey':_0x66c7('0x158')});db[_0x66c7('0x62')]['belongsTo'](db[_0x66c7('0x140')],{'as':_0x66c7('0x140'),'foreignKey':_0x66c7('0x166')});db[_0x66c7('0x62')]['belongsTo'](db[_0x66c7('0x88')],{'as':_0x66c7('0x159'),'foreignKey':_0x66c7('0x15a')});db[_0x66c7('0x62')][_0x66c7('0x12a')](db[_0x66c7('0x117')],{'as':_0x66c7('0x15b'),'through':_0x66c7('0x194')});db['OpenchannelQueueReport'][_0x66c7('0x125')](db['OpenchannelAccount'],{});db[_0x66c7('0x64')]['belongsTo'](db[_0x66c7('0xfa')],{'as':_0x66c7('0x16c'),'foreignKey':_0x66c7('0x16d')});db[_0x66c7('0x64')][_0x66c7('0x125')](db['CmContact'],{'as':_0x66c7('0x164'),'foreignKey':'ContactId'});db['OpenchannelQueueReport'][_0x66c7('0x125')](db[_0x66c7('0x5d')],{});db[_0x66c7('0x64')]['belongsTo'](db[_0x66c7('0x5f')],{});db[_0x66c7('0x64')][_0x66c7('0x125')](db['User'],{});db[_0x66c7('0x64')]['belongsTo'](db[_0x66c7('0x60')],{});db['ChatApplication'][_0x66c7('0x125')](db[_0x66c7('0x117')],{'as':'Agent','foreignKey':_0x66c7('0x11a'),'onDelete':_0x66c7('0x17c')});db[_0x66c7('0x66')][_0x66c7('0x125')](db[_0x66c7('0x6e')],{'as':_0x66c7('0x195'),'foreignKey':_0x66c7('0x196'),'onDelete':_0x66c7('0x17c')});db[_0x66c7('0x66')]['belongsTo'](db[_0x66c7('0x62')],{'as':_0x66c7('0x197'),'foreignKey':_0x66c7('0x191'),'onDelete':_0x66c7('0x17c')});db[_0x66c7('0x66')][_0x66c7('0x125')](db[_0x66c7('0x92')],{'onDelete':_0x66c7('0x17c'),'foreignKey':_0x66c7('0x17d')});db['ChatInteraction'][_0x66c7('0x11c')](db[_0x66c7('0x6a')],{'as':_0x66c7('0x15e'),'onDelete':_0x66c7('0x119'),'foreignKey':_0x66c7('0x198')});db[_0x66c7('0x68')][_0x66c7('0x125')](db[_0x66c7('0x62')],{'as':'Account','foreignKey':_0x66c7('0x191')});db[_0x66c7('0x68')][_0x66c7('0x125')](db['CmContact'],{'as':_0x66c7('0x164'),'foreignKey':'ContactId'});db[_0x66c7('0x68')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x66c7('0x11a')});db[_0x66c7('0x68')][_0x66c7('0x12a')](db[_0x66c7('0x92')],{'through':'chat_interaction_has_tags','as':_0x66c7('0x176')});db[_0x66c7('0x68')][_0x66c7('0x12a')](db[_0x66c7('0x92')],{'through':_0x66c7('0x199'),'as':_0x66c7('0x177')});db['ChatInteraction']['belongsToMany'](db[_0x66c7('0x117')],{'as':_0x66c7('0x178'),'through':'user_has_chat_interactions','foreignKey':'ChatInteractionId'});db[_0x66c7('0x6a')][_0x66c7('0x125')](db['User'],{'onDelete':_0x66c7('0x119'),'as':_0x66c7('0x117')});db[_0x66c7('0x6a')][_0x66c7('0x125')](db[_0x66c7('0x173')],{'onDelete':_0x66c7('0x119'),'as':_0x66c7('0x164'),'foreignKey':_0x66c7('0x165')});db[_0x66c7('0x6a')][_0x66c7('0x125')](db['ChatInteraction'],{'onDelete':'cascade','as':_0x66c7('0x17a'),'foreignKey':_0x66c7('0x198')});db['ChatMessage'][_0x66c7('0x125')](db[_0x66c7('0x185')],{'as':'Attachment','foreignKey':'AttachmentId'});db['ChatMessage'][_0x66c7('0x125')](db[_0x66c7('0x62')],{'as':_0x66c7('0x172'),'foreignKey':_0x66c7('0x191')});db[_0x66c7('0x6c')][_0x66c7('0x11c')](db[_0x66c7('0x185')],{'as':_0x66c7('0x179'),'foreignKey':_0x66c7('0x17b'),'onDelete':_0x66c7('0x119'),'hooks':!![]});db['ChatOfflineMessage'][_0x66c7('0x125')](db['CmContact'],{'onDelete':_0x66c7('0x119'),'as':_0x66c7('0x164'),'foreignKey':_0x66c7('0x165')});db[_0x66c7('0x6c')][_0x66c7('0x125')](db[_0x66c7('0x62')],{'as':_0x66c7('0x172'),'foreignKey':_0x66c7('0x191')});db['ChatQueue'][_0x66c7('0x12a')](db[_0x66c7('0x117')],{'as':_0x66c7('0x15b'),'through':_0x66c7('0x2e'),'hooks':!![]});db[_0x66c7('0x6e')][_0x66c7('0x12a')](db[_0x66c7('0xeb')],{'through':'team_has_chat_queues','as':'Teams'});db[_0x66c7('0x70')][_0x66c7('0x11c')](db['ChatInternalMessage'],{'as':_0x66c7('0x15e'),'foreignKey':_0x66c7('0x19a'),'onDelete':_0x66c7('0x119')});db['ChatGroup'][_0x66c7('0x12a')](db[_0x66c7('0x117')],{'as':_0x66c7('0x14e'),'through':'chat_group_has_users'});db[_0x66c7('0x192')][_0x66c7('0x125')](db['ChatWebsite'],{'as':_0x66c7('0x197'),'foreignKey':_0x66c7('0x191')});db[_0x66c7('0x73')]['hasMany'](db[_0x66c7('0x173')],{'as':_0x66c7('0x12b'),'foreignKey':_0x66c7('0x19b')});db[_0x66c7('0x173')][_0x66c7('0x11c')](db[_0x66c7('0x19c')],{'as':_0x66c7('0x150'),'foreignKey':'ContactId'});db[_0x66c7('0x173')][_0x66c7('0x11c')](db[_0x66c7('0x76')],{'as':_0x66c7('0x151'),'foreignKey':_0x66c7('0x165')});db[_0x66c7('0x173')][_0x66c7('0x11c')](db[_0x66c7('0x78')],{'as':_0x66c7('0x152'),'foreignKey':'ContactId'});db[_0x66c7('0x173')][_0x66c7('0x11c')](db[_0x66c7('0x7a')],{'as':_0x66c7('0x7a'),'foreignKey':'ContactId'});db[_0x66c7('0x173')][_0x66c7('0x11c')](db[_0x66c7('0xdc')],{'as':_0x66c7('0x154'),'foreignKey':_0x66c7('0x165')});db[_0x66c7('0x173')][_0x66c7('0x11c')](db['OpenchannelInteraction'],{'as':_0x66c7('0x11f'),'foreignKey':'ContactId','onDelete':'restrict'});db['CmContact'][_0x66c7('0x11c')](db['ChatInteraction'],{'as':_0x66c7('0x130'),'foreignKey':_0x66c7('0x165'),'onDelete':_0x66c7('0x17c')});db[_0x66c7('0x173')][_0x66c7('0x11c')](db[_0x66c7('0x54')],{'as':_0x66c7('0x120'),'foreignKey':_0x66c7('0x165'),'onDelete':_0x66c7('0x17c')});db[_0x66c7('0x173')][_0x66c7('0x11c')](db[_0x66c7('0x4b')],{'as':_0x66c7('0x121'),'foreignKey':'ContactId','onDelete':_0x66c7('0x17c')});db[_0x66c7('0x173')][_0x66c7('0x11c')](db[_0x66c7('0x12f')],{'as':'MailInteractions','foreignKey':_0x66c7('0x165'),'onDelete':_0x66c7('0x17c')});db[_0x66c7('0x173')][_0x66c7('0x125')](db['CmCompany'],{'as':_0x66c7('0x19d'),'foreignKey':_0x66c7('0x19b')});db[_0x66c7('0x173')]['belongsTo'](db['CmList'],{'as':_0x66c7('0x16c'),'foreignKey':_0x66c7('0x16d'),'onDelete':'cascade'});db['CmContact'][_0x66c7('0x12a')](db[_0x66c7('0x117')],{'as':_0x66c7('0x178'),'through':_0x66c7('0x12c')});db[_0x66c7('0x173')][_0x66c7('0x12a')](db[_0x66c7('0x92')],{'as':_0x66c7('0x176'),'through':'cm_contact_has_tags'});db[_0x66c7('0x173')][_0x66c7('0x12a')](db[_0x66c7('0x92')],{'through':_0x66c7('0x19e'),'as':_0x66c7('0x177')});db[_0x66c7('0x19c')][_0x66c7('0x125')](db[_0x66c7('0x173')],{'as':_0x66c7('0x164'),'foreignKey':_0x66c7('0x165'),'onDelete':_0x66c7('0x119')});db[_0x66c7('0x19c')][_0x66c7('0x125')](db[_0x66c7('0xfa')],{'as':_0x66c7('0x16c'),'foreignKey':_0x66c7('0x16d'),'onDelete':_0x66c7('0x119')});db['CmHopper'][_0x66c7('0x125')](db[_0x66c7('0x117')],{'as':_0x66c7('0x19f'),'foreignKey':'UserId'});db[_0x66c7('0x19c')][_0x66c7('0x125')](db['VoiceQueue'],{'as':_0x66c7('0x195'),'foreignKey':_0x66c7('0x14f'),'onDelete':'cascade'});db['CmHopper'][_0x66c7('0x125')](db['Campaign'],{'as':_0x66c7('0x1a0'),'foreignKey':'CampaignId','onDelete':_0x66c7('0x119')});db[_0x66c7('0x19c')][_0x66c7('0x125')](db[_0x66c7('0x117')],{'as':'Owner','foreignKey':_0x66c7('0x1a1')});db['CmHopperBlack'][_0x66c7('0x125')](db[_0x66c7('0x173')],{'as':_0x66c7('0x164'),'foreignKey':_0x66c7('0x165'),'onDelete':_0x66c7('0x119')});db[_0x66c7('0x75')][_0x66c7('0x125')](db[_0x66c7('0xfa')],{'as':_0x66c7('0x16c'),'foreignKey':_0x66c7('0x16d'),'onDelete':_0x66c7('0x119')});db[_0x66c7('0x75')]['belongsTo'](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x66c7('0x14f'),'onDelete':_0x66c7('0x119')});db['CmHopperBlack'][_0x66c7('0x125')](db[_0x66c7('0x1a0')],{'as':_0x66c7('0x1a0'),'foreignKey':'CampaignId','onDelete':'cascade'});db[_0x66c7('0x7e')][_0x66c7('0x11c')](db['Condition'],{'as':{'plural':'All','singular':_0x66c7('0x1a2')},'foreignKey':'AutomationAllId','onDelete':_0x66c7('0x119'),'hooks':!![]});db[_0x66c7('0x7e')][_0x66c7('0x11c')](db['Condition'],{'as':{'plural':_0x66c7('0x1a3'),'singular':_0x66c7('0x1a4')},'foreignKey':_0x66c7('0x1a5'),'onDelete':_0x66c7('0x119'),'hooks':!![]});db[_0x66c7('0x7e')][_0x66c7('0x11c')](db['Action'],{'as':_0x66c7('0x1a6'),'foreignKey':_0x66c7('0x1a7'),'onDelete':_0x66c7('0x119'),'hooks':!![]});db[_0x66c7('0x82')][_0x66c7('0x11c')](db[_0x66c7('0x82')],{'as':_0x66c7('0x169'),'foreignKey':_0x66c7('0x1a8'),'onDelete':_0x66c7('0x119')});db['Interval'][_0x66c7('0x11c')](db[_0x66c7('0x86')],{'as':_0x66c7('0x1a9'),'foreignKey':_0x66c7('0x158'),'onDelete':_0x66c7('0x119'),'hooks':!![],'required':![]});db[_0x66c7('0x86')][_0x66c7('0x11c')](db['VoiceExtension'],{'as':'Extensions','foreignKey':'IntervalId','onDelete':_0x66c7('0x17c')});db['Interval'][_0x66c7('0x11c')](db[_0x66c7('0x41')],{'as':_0x66c7('0x1aa'),'foreignKey':_0x66c7('0x158')});db['Interval'][_0x66c7('0x11c')](db['ChatApplication'],{'as':_0x66c7('0x1ab'),'foreignKey':_0x66c7('0x158')});db[_0x66c7('0x86')][_0x66c7('0x11c')](db[_0x66c7('0x49')],{'as':_0x66c7('0x1ac'),'foreignKey':_0x66c7('0x158')});db[_0x66c7('0x86')][_0x66c7('0x11c')](db[_0x66c7('0x52')],{'as':_0x66c7('0x1ad'),'foreignKey':_0x66c7('0x158')});db[_0x66c7('0x8e')][_0x66c7('0x125')](db['MailAccount'],{});db[_0x66c7('0x8e')][_0x66c7('0x125')](db[_0x66c7('0x1ae')],{'foreignKey':_0x66c7('0x1af')});db[_0x66c7('0x8e')][_0x66c7('0x125')](db[_0x66c7('0x9d')],{'foreignKey':_0x66c7('0x1b0')});db[_0x66c7('0x90')][_0x66c7('0x12a')](db[_0x66c7('0x17')],{'as':_0x66c7('0x1b1'),'through':_0x66c7('0x14d'),'onDelete':_0x66c7('0x17c')});db['Tag'][_0x66c7('0x12a')](db[_0x66c7('0x173')],{'through':_0x66c7('0x19e')});db[_0x66c7('0x92')][_0x66c7('0x12a')](db[_0x66c7('0x68')],{'through':_0x66c7('0x199')});db[_0x66c7('0x92')][_0x66c7('0x12a')](db[_0x66c7('0x12f')],{'through':_0x66c7('0x175')});db[_0x66c7('0x92')]['belongsToMany'](db['SmsInteraction'],{'through':_0x66c7('0x18a')});db[_0x66c7('0x92')][_0x66c7('0x12a')](db[_0x66c7('0x4b')],{'through':_0x66c7('0x184')});db['Tag'][_0x66c7('0x12a')](db[_0x66c7('0x5d')],{'through':_0x66c7('0x190')});db['Tag']['belongsToMany'](db['WhatsappInteraction'],{'through':_0x66c7('0x1b2')});db[_0x66c7('0x95')]['hasMany'](db['Condition'],{'as':{'plural':_0x66c7('0x1b3'),'singular':_0x66c7('0x1b4')},'foreignKey':_0x66c7('0x1b5'),'onDelete':'cascade','hooks':!![]});db['Trigger'][_0x66c7('0x11c')](db[_0x66c7('0x84')],{'as':{'plural':'AnyConditions','singular':_0x66c7('0x1b6')},'foreignKey':_0x66c7('0x1b7'),'onDelete':_0x66c7('0x119'),'hooks':!![]});db[_0x66c7('0x95')][_0x66c7('0x11c')](db[_0x66c7('0x7d')],{'as':_0x66c7('0x1a6'),'foreignKey':_0x66c7('0x1b8'),'onDelete':_0x66c7('0x119'),'hooks':!![]});db[_0x66c7('0x9d')][_0x66c7('0x11c')](db[_0x66c7('0xa3')],{'as':'Fields','onDelete':_0x66c7('0x119'),'foreignKey':_0x66c7('0x1b0'),'hooks':!![]});db[_0x66c7('0x1ae')][_0x66c7('0x11c')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x66c7('0x119'),'foreignKey':_0x66c7('0x1af')});db[_0x66c7('0xa1')][_0x66c7('0x11c')](db[_0x66c7('0xa3')],{'as':_0x66c7('0x1b9'),'onDelete':_0x66c7('0x119'),'foreignKey':_0x66c7('0x1ba')});db[_0x66c7('0xa3')][_0x66c7('0x125')](db[_0x66c7('0xa1')],{'foreignKey':'MetricId'});db[_0x66c7('0xa6')][_0x66c7('0x11c')](db[_0x66c7('0x1bb')],{'as':_0x66c7('0x1bc'),'onDelete':_0x66c7('0x119'),'foreignKey':'AccountId'});db[_0x66c7('0x1bb')][_0x66c7('0x11c')](db[_0x66c7('0xa9')],{'as':_0x66c7('0x1bd'),'onDelete':_0x66c7('0x119'),'foreignKey':_0x66c7('0x1be')});db[_0x66c7('0x1bb')]['hasMany'](db[_0x66c7('0xa9')],{'as':_0x66c7('0x1bf'),'onDelete':_0x66c7('0x119'),'foreignKey':'DescriptionId'});db[_0x66c7('0x1bb')][_0x66c7('0x11c')](db['SalesforceField'],{'as':_0x66c7('0x1b9'),'onDelete':'cascade','foreignKey':_0x66c7('0x1c0')});db[_0x66c7('0x1bb')]['belongsTo'](db['SalesforceAccount'],{'as':_0x66c7('0x172'),'foreignKey':_0x66c7('0x1c1')});db[_0x66c7('0xa9')][_0x66c7('0x11c')](db[_0x66c7('0xa9')],{'as':_0x66c7('0x1c2'),'foreignKey':_0x66c7('0x1be')});db['SalesforceField']['hasMany'](db[_0x66c7('0xa9')],{'as':_0x66c7('0x1c3'),'foreignKey':_0x66c7('0x1c4')});db[_0x66c7('0xa9')]['hasMany'](db[_0x66c7('0xa9')],{'as':_0x66c7('0x1c5'),'foreignKey':_0x66c7('0x1c0')});db[_0x66c7('0xa9')][_0x66c7('0x125')](db[_0x66c7('0x97')],{'as':_0x66c7('0x97'),'foreignKey':_0x66c7('0x1c6')});db['SugarcrmAccount'][_0x66c7('0x11c')](db[_0x66c7('0xaa')],{'as':_0x66c7('0x1bc'),'onDelete':_0x66c7('0x119'),'foreignKey':_0x66c7('0x1c1')});db[_0x66c7('0xaa')][_0x66c7('0x11c')](db[_0x66c7('0xac')],{'as':_0x66c7('0x1bd'),'onDelete':_0x66c7('0x119'),'foreignKey':_0x66c7('0x1be')});db[_0x66c7('0xaa')][_0x66c7('0x11c')](db['SugarcrmField'],{'as':_0x66c7('0x1bf'),'onDelete':_0x66c7('0x119'),'foreignKey':_0x66c7('0x1c4')});db['SugarcrmConfiguration']['hasMany'](db['SugarcrmField'],{'as':'Fields','onDelete':_0x66c7('0x119'),'foreignKey':'FieldId'});db['SugarcrmConfiguration'][_0x66c7('0x125')](db[_0x66c7('0x1c7')],{'as':_0x66c7('0x172'),'foreignKey':_0x66c7('0x1c1')});db[_0x66c7('0xac')]['hasMany'](db[_0x66c7('0xac')],{'as':'Subject','foreignKey':_0x66c7('0x1be')});db[_0x66c7('0xac')]['hasMany'](db[_0x66c7('0xac')],{'as':_0x66c7('0x1c3'),'foreignKey':_0x66c7('0x1c4')});db['SugarcrmField'][_0x66c7('0x11c')](db[_0x66c7('0xac')],{'as':_0x66c7('0x1c5'),'foreignKey':_0x66c7('0x1c0')});db['SugarcrmField']['belongsTo'](db[_0x66c7('0x97')],{'as':_0x66c7('0x97'),'foreignKey':'VariableId'});db['DeskAccount'][_0x66c7('0x11c')](db[_0x66c7('0xaf')],{'as':_0x66c7('0x1bc'),'onDelete':'cascade','foreignKey':_0x66c7('0x1c1')});db[_0x66c7('0xaf')][_0x66c7('0x11c')](db[_0x66c7('0xb1')],{'as':_0x66c7('0x1bd'),'onDelete':_0x66c7('0x119'),'foreignKey':'SubjectId'});db[_0x66c7('0xaf')][_0x66c7('0x11c')](db[_0x66c7('0xb1')],{'as':_0x66c7('0x1bf'),'onDelete':_0x66c7('0x119'),'foreignKey':_0x66c7('0x1c4')});db[_0x66c7('0xaf')][_0x66c7('0x11c')](db[_0x66c7('0xb1')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x66c7('0x1c0')});db[_0x66c7('0xaf')][_0x66c7('0x125')](db[_0x66c7('0x1c8')],{'as':'Account','foreignKey':'AccountId'});db['DeskConfiguration']['belongsToMany'](db[_0x66c7('0x92')],{'through':_0x66c7('0x1c9')});db[_0x66c7('0xb1')][_0x66c7('0x11c')](db[_0x66c7('0xb1')],{'as':_0x66c7('0x1c2'),'foreignKey':_0x66c7('0x1be')});db['DeskField']['hasMany'](db['DeskField'],{'as':_0x66c7('0x1c3'),'foreignKey':_0x66c7('0x1c4')});db[_0x66c7('0xb1')][_0x66c7('0x11c')](db[_0x66c7('0xb1')],{'as':_0x66c7('0x1c5'),'foreignKey':_0x66c7('0x1c0')});db[_0x66c7('0xb1')][_0x66c7('0x125')](db[_0x66c7('0x97')],{'as':_0x66c7('0x97'),'foreignKey':'VariableId'});db['ZohoAccount'][_0x66c7('0x11c')](db[_0x66c7('0xb5')],{'as':'Configurations','onDelete':_0x66c7('0x119'),'foreignKey':'AccountId'});db[_0x66c7('0xb5')][_0x66c7('0x11c')](db[_0x66c7('0xb7')],{'as':'Subjects','onDelete':_0x66c7('0x119'),'foreignKey':'SubjectId'});db[_0x66c7('0xb5')][_0x66c7('0x11c')](db[_0x66c7('0xb7')],{'as':_0x66c7('0x1bf'),'onDelete':_0x66c7('0x119'),'foreignKey':_0x66c7('0x1c4')});db[_0x66c7('0xb5')]['hasMany'](db[_0x66c7('0xb7')],{'as':_0x66c7('0x1b9'),'onDelete':_0x66c7('0x119'),'foreignKey':_0x66c7('0x1c0')});db['ZohoConfiguration'][_0x66c7('0x125')](db[_0x66c7('0xb3')],{'as':_0x66c7('0x172'),'foreignKey':_0x66c7('0x1c1')});db['ZohoField']['hasMany'](db['ZohoField'],{'as':_0x66c7('0x1c2'),'foreignKey':'SubjectId'});db['ZohoField']['hasMany'](db[_0x66c7('0xb7')],{'as':_0x66c7('0x1c3'),'foreignKey':_0x66c7('0x1c4')});db[_0x66c7('0xb7')]['hasMany'](db[_0x66c7('0xb7')],{'as':_0x66c7('0x1c5'),'foreignKey':_0x66c7('0x1c0')});db['ZohoField']['belongsTo'](db[_0x66c7('0x97')],{'as':'Variable','foreignKey':'VariableId'});db[_0x66c7('0xb9')][_0x66c7('0x11c')](db['ZendeskConfiguration'],{'as':_0x66c7('0x1bc'),'onDelete':_0x66c7('0x119'),'foreignKey':_0x66c7('0x1c1')});db[_0x66c7('0x1ca')]['hasMany'](db[_0x66c7('0x1cb')],{'as':_0x66c7('0x1bd'),'foreignKey':_0x66c7('0x1be')});db[_0x66c7('0x1ca')][_0x66c7('0x11c')](db[_0x66c7('0x1cb')],{'as':_0x66c7('0x1bf'),'foreignKey':_0x66c7('0x1c4')});db[_0x66c7('0x1ca')][_0x66c7('0x11c')](db['ZendeskField'],{'as':_0x66c7('0x1b9'),'foreignKey':_0x66c7('0x1c0')});db[_0x66c7('0x1ca')][_0x66c7('0x125')](db[_0x66c7('0xb9')],{'as':_0x66c7('0x172'),'foreignKey':_0x66c7('0x1c1')});db[_0x66c7('0x1ca')][_0x66c7('0x12a')](db[_0x66c7('0x92')],{'through':_0x66c7('0x1cc')});db[_0x66c7('0x1cb')]['hasMany'](db[_0x66c7('0x1cb')],{'as':_0x66c7('0x1c2'),'foreignKey':_0x66c7('0x1be')});db[_0x66c7('0x1cb')][_0x66c7('0x11c')](db[_0x66c7('0x1cb')],{'as':_0x66c7('0x1c3'),'foreignKey':'DescriptionId'});db[_0x66c7('0x1cb')][_0x66c7('0x11c')](db['ZendeskField'],{'as':'Field','foreignKey':_0x66c7('0x1c0')});db[_0x66c7('0x1cb')][_0x66c7('0x125')](db['Variable'],{'as':_0x66c7('0x97'),'foreignKey':_0x66c7('0x1c6')});db['FreshdeskAccount'][_0x66c7('0x11c')](db['FreshdeskConfiguration'],{'as':_0x66c7('0x1bc'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x66c7('0x1cd')][_0x66c7('0x11c')](db[_0x66c7('0xbf')],{'as':_0x66c7('0x1bd'),'onDelete':'cascade','foreignKey':_0x66c7('0x1be')});db[_0x66c7('0x1cd')]['hasMany'](db[_0x66c7('0xbf')],{'as':_0x66c7('0x1bf'),'onDelete':_0x66c7('0x119'),'foreignKey':'DescriptionId'});db['FreshdeskConfiguration']['hasMany'](db['FreshdeskField'],{'as':_0x66c7('0x1b9'),'onDelete':_0x66c7('0x119'),'foreignKey':'FieldId'});db[_0x66c7('0x1cd')][_0x66c7('0x125')](db[_0x66c7('0x1ce')],{'as':_0x66c7('0x172'),'foreignKey':_0x66c7('0x1c1')});db['FreshdeskConfiguration'][_0x66c7('0x12a')](db[_0x66c7('0x92')],{'through':'int_freshdesk_configuration_has_tags'});db['FreshdeskField'][_0x66c7('0x11c')](db['FreshdeskField'],{'as':_0x66c7('0x1c2'),'foreignKey':'SubjectId'});db[_0x66c7('0xbf')][_0x66c7('0x11c')](db[_0x66c7('0xbf')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x66c7('0xbf')][_0x66c7('0x11c')](db[_0x66c7('0xbf')],{'as':_0x66c7('0x1c5'),'foreignKey':_0x66c7('0x1c0')});db[_0x66c7('0xbf')][_0x66c7('0x125')](db[_0x66c7('0x97')],{'as':_0x66c7('0x97'),'foreignKey':'VariableId'});db[_0x66c7('0xc1')][_0x66c7('0x11c')](db[_0x66c7('0xc2')],{'as':'Configurations','onDelete':_0x66c7('0x119'),'foreignKey':'AccountId'});db[_0x66c7('0xc2')][_0x66c7('0x11c')](db[_0x66c7('0xc4')],{'as':_0x66c7('0x1bd'),'foreignKey':'SubjectId'});db[_0x66c7('0xc2')][_0x66c7('0x11c')](db['VtigerField'],{'as':_0x66c7('0x1bf'),'foreignKey':_0x66c7('0x1c4')});db['VtigerConfiguration'][_0x66c7('0x11c')](db['VtigerField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x66c7('0xc2')]['belongsTo'](db['VtigerAccount'],{'as':_0x66c7('0x172'),'foreignKey':_0x66c7('0x1c1')});db[_0x66c7('0xc4')][_0x66c7('0x11c')](db['VtigerField'],{'as':'Subject','foreignKey':_0x66c7('0x1be')});db[_0x66c7('0xc4')][_0x66c7('0x11c')](db[_0x66c7('0xc4')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x66c7('0xc4')][_0x66c7('0x11c')](db[_0x66c7('0xc4')],{'as':_0x66c7('0x1c5'),'foreignKey':'FieldId'});db[_0x66c7('0xc4')][_0x66c7('0x125')](db[_0x66c7('0x97')],{'as':'Variable','foreignKey':'VariableId'});db[_0x66c7('0xc6')][_0x66c7('0x11c')](db['ServicenowConfiguration'],{'as':_0x66c7('0x1bc'),'onDelete':_0x66c7('0x119'),'foreignKey':_0x66c7('0x1c1')});db[_0x66c7('0xc7')][_0x66c7('0x11c')](db[_0x66c7('0xc9')],{'as':_0x66c7('0x1bd'),'foreignKey':_0x66c7('0x1be')});db['ServicenowConfiguration'][_0x66c7('0x11c')](db[_0x66c7('0xc9')],{'as':_0x66c7('0x1bf'),'foreignKey':_0x66c7('0x1c4')});db[_0x66c7('0xc7')]['hasMany'](db['ServicenowField'],{'as':_0x66c7('0x1b9'),'foreignKey':'FieldId'});db[_0x66c7('0xc7')][_0x66c7('0x125')](db[_0x66c7('0xc6')],{'as':_0x66c7('0x172'),'foreignKey':_0x66c7('0x1c1')});db[_0x66c7('0xc9')][_0x66c7('0x11c')](db[_0x66c7('0xc9')],{'as':_0x66c7('0x1c2'),'foreignKey':'SubjectId'});db[_0x66c7('0xc9')][_0x66c7('0x11c')](db[_0x66c7('0xc9')],{'as':_0x66c7('0x1c3'),'foreignKey':'DescriptionId'});db[_0x66c7('0xc9')][_0x66c7('0x11c')](db[_0x66c7('0xc9')],{'as':'Field','foreignKey':_0x66c7('0x1c0')});db[_0x66c7('0xc9')][_0x66c7('0x125')](db[_0x66c7('0x97')],{'as':_0x66c7('0x97'),'foreignKey':_0x66c7('0x1c6')});db[_0x66c7('0x1cf')][_0x66c7('0x11c')](db[_0x66c7('0x1d0')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0x66c7('0x1d0')][_0x66c7('0x11c')](db[_0x66c7('0xcd')],{'as':_0x66c7('0x1bd'),'onDelete':'cascade','foreignKey':_0x66c7('0x1be')});db[_0x66c7('0x1d0')][_0x66c7('0x11c')](db['Dynamics365Field'],{'as':_0x66c7('0x1bf'),'onDelete':'cascade','foreignKey':_0x66c7('0x1c4')});db[_0x66c7('0x1d0')][_0x66c7('0x11c')](db[_0x66c7('0xcd')],{'as':_0x66c7('0x1b9'),'onDelete':'cascade','foreignKey':_0x66c7('0x1c0')});db[_0x66c7('0x1d0')][_0x66c7('0x125')](db[_0x66c7('0x1cf')],{'as':_0x66c7('0x172'),'foreignKey':'AccountId'});db[_0x66c7('0xcd')]['hasMany'](db['Dynamics365Field'],{'as':'Subject','foreignKey':_0x66c7('0x1be')});db[_0x66c7('0xcd')][_0x66c7('0x11c')](db[_0x66c7('0xcd')],{'as':_0x66c7('0x1c3'),'foreignKey':_0x66c7('0x1c4')});db['Dynamics365Field']['hasMany'](db[_0x66c7('0xcd')],{'as':'Field','foreignKey':'FieldId'});db[_0x66c7('0xcd')][_0x66c7('0x125')](db['Variable'],{'as':_0x66c7('0x97'),'foreignKey':'VariableId'});db[_0x66c7('0xcf')][_0x66c7('0x11c')](db[_0x66c7('0xd1')],{'as':_0x66c7('0x1bc'),'onDelete':_0x66c7('0x119'),'foreignKey':'AccountId'});db[_0x66c7('0xd1')]['hasMany'](db['FreshsalesField'],{'as':_0x66c7('0x1bd'),'foreignKey':_0x66c7('0x1be')});db[_0x66c7('0xd1')]['hasMany'](db[_0x66c7('0x1d1')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['FreshsalesConfiguration'][_0x66c7('0x11c')](db[_0x66c7('0x1d1')],{'as':_0x66c7('0x1b9'),'foreignKey':_0x66c7('0x1c0')});db[_0x66c7('0xd1')]['belongsTo'](db[_0x66c7('0xcf')],{'as':_0x66c7('0x172'),'foreignKey':_0x66c7('0x1c1')});db[_0x66c7('0x1d1')][_0x66c7('0x11c')](db[_0x66c7('0x1d1')],{'as':'Subject','foreignKey':_0x66c7('0x1be')});db[_0x66c7('0x1d1')][_0x66c7('0x11c')](db[_0x66c7('0x1d1')],{'as':_0x66c7('0x1c3'),'foreignKey':_0x66c7('0x1c4')});db[_0x66c7('0x1d1')][_0x66c7('0x11c')](db[_0x66c7('0x1d1')],{'as':_0x66c7('0x1c5'),'foreignKey':_0x66c7('0x1c0')});db[_0x66c7('0x1d1')][_0x66c7('0x125')](db[_0x66c7('0x97')],{'as':_0x66c7('0x97'),'foreignKey':_0x66c7('0x1c6')});db[_0x66c7('0xd6')][_0x66c7('0x125')](db['ChatWebsite'],{});db[_0x66c7('0xd6')][_0x66c7('0x125')](db[_0x66c7('0xfa')],{'as':'List','foreignKey':'ListId'});db[_0x66c7('0xd6')][_0x66c7('0x125')](db[_0x66c7('0x173')],{'as':_0x66c7('0x164'),'foreignKey':_0x66c7('0x165')});db[_0x66c7('0xd6')][_0x66c7('0x125')](db['ChatInteraction'],{});db[_0x66c7('0xd6')][_0x66c7('0x125')](db[_0x66c7('0x6a')],{});db[_0x66c7('0xd6')][_0x66c7('0x125')](db[_0x66c7('0x117')],{});db[_0x66c7('0xd6')][_0x66c7('0x125')](db[_0x66c7('0x6e')],{});db[_0x66c7('0xd8')][_0x66c7('0x125')](db[_0x66c7('0x117')],{'onDelete':_0x66c7('0x119'),'foreignKey':_0x66c7('0x1d2')});db[_0x66c7('0xd8')][_0x66c7('0x125')](db[_0x66c7('0x117')],{'onDelete':'cascade','foreignKey':'ToId'});db[_0x66c7('0xdc')]['hasMany'](db[_0x66c7('0x1d3')],{'foreignKey':_0x66c7('0x1d4'),'onDelete':_0x66c7('0x119')});db[_0x66c7('0xdc')][_0x66c7('0x11c')](db[_0x66c7('0xda')],{'foreignKey':_0x66c7('0x1d4'),'onDelete':_0x66c7('0x119')});db[_0x66c7('0xde')][_0x66c7('0x125')](db[_0x66c7('0x50')],{});db[_0x66c7('0xde')][_0x66c7('0x125')](db['CmList'],{'as':_0x66c7('0x16c'),'foreignKey':_0x66c7('0x16d')});db[_0x66c7('0xde')][_0x66c7('0x125')](db[_0x66c7('0x173')],{'as':_0x66c7('0x164'),'foreignKey':_0x66c7('0x165')});db[_0x66c7('0xde')][_0x66c7('0x125')](db[_0x66c7('0x54')],{});db[_0x66c7('0xde')][_0x66c7('0x125')](db['SmsMessage'],{});db[_0x66c7('0xde')][_0x66c7('0x125')](db[_0x66c7('0x117')],{});db['SmsQueueReport']['belongsTo'](db[_0x66c7('0x57')],{});db[_0x66c7('0xe2')][_0x66c7('0x11c')](db[_0x66c7('0xdc')],{'foreignKey':_0x66c7('0x1d5')});db['JscriptyProject'][_0x66c7('0x11c')](db[_0x66c7('0x1d3')],{'foreignKey':_0x66c7('0x1d5')});db[_0x66c7('0xe2')][_0x66c7('0x11c')](db[_0x66c7('0xda')],{'foreignKey':_0x66c7('0x1d5')});db[_0x66c7('0xe6')][_0x66c7('0x12a')](db[_0x66c7('0x117')],{'as':'Users','through':_0x66c7('0x148')});db[_0x66c7('0xeb')]['belongsToMany'](db[_0x66c7('0x117')],{'as':_0x66c7('0x15b'),'through':_0x66c7('0x12e')});db[_0x66c7('0xeb')][_0x66c7('0x12a')](db[_0x66c7('0x18')],{'through':_0x66c7('0x111'),'as':_0x66c7('0x136')});db[_0x66c7('0xeb')][_0x66c7('0x12a')](db[_0x66c7('0x139')],{'through':'team_has_mail_queues','as':_0x66c7('0x13a')});db[_0x66c7('0xeb')][_0x66c7('0x12a')](db[_0x66c7('0x6e')],{'through':_0x66c7('0x1d6'),'as':_0x66c7('0x1d7')});db[_0x66c7('0xeb')][_0x66c7('0x12a')](db['FaxQueue'],{'through':'team_has_fax_queues','as':_0x66c7('0x13b')});db[_0x66c7('0xeb')]['belongsToMany'](db[_0x66c7('0x57')],{'through':_0x66c7('0x1d8'),'as':_0x66c7('0x13c')});db[_0x66c7('0xeb')][_0x66c7('0x12a')](db['OpenchannelQueue'],{'through':_0x66c7('0x1d9'),'as':_0x66c7('0x13d')});db[_0x66c7('0xeb')]['belongsToMany'](db[_0x66c7('0x10e')],{'through':'team_has_whatsapp_queues','as':'WhatsappQueues'});db[_0x66c7('0xeb')]['belongsToMany'](db['VoicePrefix'],{'through':_0x66c7('0x113'),'as':_0x66c7('0x138')});db[_0x66c7('0x1a0')][_0x66c7('0x11c')](db['CmHopper'],{'as':_0x66c7('0x150'),'foreignKey':_0x66c7('0x1da')});db[_0x66c7('0x1a0')][_0x66c7('0x11c')](db[_0x66c7('0x76')],{'as':'HopperFinals','foreignKey':_0x66c7('0x1da')});db['Campaign'][_0x66c7('0x11c')](db[_0x66c7('0x78')],{'as':_0x66c7('0x152'),'foreignKey':'CampaignId'});db[_0x66c7('0x1a0')][_0x66c7('0x11c')](db[_0x66c7('0x75')],{'as':_0x66c7('0x153'),'foreignKey':_0x66c7('0x1da')});db['Campaign'][_0x66c7('0x125')](db['Trunk'],{'as':_0x66c7('0x28'),'foreignKey':_0x66c7('0x155')});db['Campaign'][_0x66c7('0x125')](db[_0x66c7('0x28')],{'as':_0x66c7('0x156'),'foreignKey':_0x66c7('0x157')});db[_0x66c7('0x1a0')][_0x66c7('0x125')](db['Interval'],{'as':_0x66c7('0x86'),'foreignKey':_0x66c7('0x158')});db[_0x66c7('0x1a0')][_0x66c7('0x125')](db[_0x66c7('0xe6')],{'as':_0x66c7('0xe6'),'foreignKey':'SquareProjectId'});db[_0x66c7('0x1a0')][_0x66c7('0x12a')](db['CmList'],{'as':_0x66c7('0x1db'),'through':'campaigns_has_cm_lists'});db[_0x66c7('0x1a0')][_0x66c7('0x12a')](db[_0x66c7('0xfa')],{'as':_0x66c7('0x15c'),'through':_0x66c7('0x1dc')});db[_0x66c7('0x185')][_0x66c7('0x125')](db[_0x66c7('0x6c')],{'as':_0x66c7('0x6c'),'foreignKey':_0x66c7('0x17b')});db[_0x66c7('0xf2')]['belongsTo'](db['MailMessage'],{});db[_0x66c7('0xf2')][_0x66c7('0x125')](db[_0x66c7('0x12f')],{});db[_0x66c7('0xf2')][_0x66c7('0x125')](db[_0x66c7('0x140')],{'foreignKey':_0x66c7('0x1dd'),'as':_0x66c7('0x1de')});db[_0x66c7('0xf2')][_0x66c7('0x125')](db[_0x66c7('0x117')],{'foreignKey':_0x66c7('0x1df'),'as':_0x66c7('0x1e0')});db['MailTransferReport'][_0x66c7('0x125')](db[_0x66c7('0x117')],{'foreignKey':_0x66c7('0x1e1'),'as':'ToAgent'});db['MailTransferReport'][_0x66c7('0x125')](db[_0x66c7('0x139')],{'foreignKey':'ToMailQueueId','as':_0x66c7('0x1e2')});db[_0x66c7('0xf2')][_0x66c7('0x125')](db[_0x66c7('0x140')],{'foreignKey':_0x66c7('0x1e3'),'as':'ToAccount'});db[_0x66c7('0x1e4')][_0x66c7('0x125')](db[_0x66c7('0x6a')],{});db[_0x66c7('0x1e4')]['belongsTo'](db[_0x66c7('0x68')],{});db[_0x66c7('0x1e4')]['belongsTo'](db[_0x66c7('0x62')],{'foreignKey':_0x66c7('0x1e5'),'as':_0x66c7('0x1de')});db[_0x66c7('0x1e4')][_0x66c7('0x125')](db['User'],{'foreignKey':_0x66c7('0x1df'),'as':_0x66c7('0x1e0')});db['ChatTransferReport'][_0x66c7('0x125')](db[_0x66c7('0x117')],{'foreignKey':_0x66c7('0x1e1'),'as':_0x66c7('0x1e6')});db[_0x66c7('0x1e4')][_0x66c7('0x125')](db[_0x66c7('0x6e')],{'foreignKey':_0x66c7('0x1e7'),'as':'ToQueue'});db[_0x66c7('0x1e4')]['belongsTo'](db[_0x66c7('0x62')],{'foreignKey':'ToChatWebsiteId','as':_0x66c7('0x1e8')});db[_0x66c7('0xf5')]['belongsTo'](db[_0x66c7('0x181')],{});db[_0x66c7('0xf5')]['belongsTo'](db[_0x66c7('0x4b')],{});db[_0x66c7('0xf5')][_0x66c7('0x125')](db[_0x66c7('0x48')],{'foreignKey':_0x66c7('0x1e9'),'as':'FromAccount'});db[_0x66c7('0xf5')][_0x66c7('0x125')](db[_0x66c7('0x117')],{'foreignKey':_0x66c7('0x1df'),'as':_0x66c7('0x1e0')});db['FaxTransferReport'][_0x66c7('0x125')](db[_0x66c7('0x117')],{'foreignKey':_0x66c7('0x1e1'),'as':_0x66c7('0x1e6')});db[_0x66c7('0xf5')][_0x66c7('0x125')](db[_0x66c7('0x4d')],{'foreignKey':_0x66c7('0x1ea'),'as':_0x66c7('0x1e2')});db[_0x66c7('0xf5')]['belongsTo'](db[_0x66c7('0x48')],{'foreignKey':'ToFaxAccountId','as':_0x66c7('0x1e8')});db[_0x66c7('0xf7')][_0x66c7('0x125')](db['OpenchannelMessage'],{});db[_0x66c7('0xf7')]['belongsTo'](db[_0x66c7('0x5d')],{});db[_0x66c7('0xf7')][_0x66c7('0x125')](db[_0x66c7('0x59')],{'foreignKey':_0x66c7('0x1eb'),'as':_0x66c7('0x1de')});db['OpenchannelTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x66c7('0x1df'),'as':_0x66c7('0x1e0')});db['OpenchannelTransferReport'][_0x66c7('0x125')](db[_0x66c7('0x117')],{'foreignKey':_0x66c7('0x1e1'),'as':_0x66c7('0x1e6')});db['OpenchannelTransferReport'][_0x66c7('0x125')](db['OpenchannelQueue'],{'foreignKey':_0x66c7('0x1ec'),'as':_0x66c7('0x1e2')});db[_0x66c7('0xf7')]['belongsTo'](db[_0x66c7('0x59')],{'foreignKey':_0x66c7('0x1ed'),'as':'ToAccount'});db[_0x66c7('0xf9')]['belongsTo'](db['SmsMessage'],{});db[_0x66c7('0xf9')]['belongsTo'](db[_0x66c7('0x54')],{});db[_0x66c7('0xf9')]['belongsTo'](db[_0x66c7('0x50')],{'foreignKey':_0x66c7('0x1ee'),'as':_0x66c7('0x1de')});db[_0x66c7('0xf9')][_0x66c7('0x125')](db['User'],{'foreignKey':_0x66c7('0x1df'),'as':_0x66c7('0x1e0')});db['SmsTransferReport'][_0x66c7('0x125')](db[_0x66c7('0x117')],{'foreignKey':'ToUserId','as':'ToAgent'});db['SmsTransferReport'][_0x66c7('0x125')](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x66c7('0x1e2')});db[_0x66c7('0xf9')]['belongsTo'](db[_0x66c7('0x50')],{'foreignKey':_0x66c7('0x1ef'),'as':_0x66c7('0x1e8')});db['CmList']['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':'ListId','onDelete':_0x66c7('0x119')});db[_0x66c7('0xfa')][_0x66c7('0x11c')](db[_0x66c7('0x1f0')],{'as':'CustomFields','foreignKey':_0x66c7('0x16d')});db[_0x66c7('0xfa')][_0x66c7('0x11c')](db['CmContact'],{'as':_0x66c7('0x12b'),'onDelete':_0x66c7('0x119'),'foreignKey':'ListId'});db['CmList'][_0x66c7('0x11c')](db[_0x66c7('0x76')],{'as':'HopperFinals','foreignKey':_0x66c7('0x16d')});db[_0x66c7('0xfa')]['hasMany'](db[_0x66c7('0x78')],{'as':_0x66c7('0x1f1'),'foreignKey':_0x66c7('0x16d')});db[_0x66c7('0xfa')][_0x66c7('0x11c')](db['ReportAgentPreview'],{'as':_0x66c7('0x7a'),'foreignKey':_0x66c7('0x16d')});db['CmList'][_0x66c7('0x12a')](db['VoiceQueue'],{'as':_0x66c7('0x1f2'),'through':_0x66c7('0x1f3')});db['CmList'][_0x66c7('0x12a')](db[_0x66c7('0x117')],{'as':_0x66c7('0x15b'),'through':_0x66c7('0x12d')});db[_0x66c7('0xfc')][_0x66c7('0x11c')](db[_0x66c7('0x11e')],{'as':_0x66c7('0x1f4'),'onDelete':_0x66c7('0x119')});db['VoicePrefix'][_0x66c7('0x12a')](db[_0x66c7('0x117')],{'as':'Agents','through':_0x66c7('0x115')});db[_0x66c7('0xfc')][_0x66c7('0x12a')](db[_0x66c7('0xeb')],{'through':_0x66c7('0x113'),'as':_0x66c7('0x170')});db['UserProfile'][_0x66c7('0x11c')](db[_0x66c7('0x117')],{'as':_0x66c7('0x178'),'foreignKey':_0x66c7('0x127')});db[_0x66c7('0x126')][_0x66c7('0x11c')](db[_0x66c7('0x1f5')],{'as':_0x66c7('0x1f6'),'foreignKey':_0x66c7('0x127'),'onDelete':_0x66c7('0x119')});db['UserProfileSection'][_0x66c7('0x11c')](db[_0x66c7('0xff')],{'as':'Resources','foreignKey':'sectionId','onDelete':_0x66c7('0x119')});db['WhatsappAccount']['hasMany'](db[_0x66c7('0x82')],{'as':_0x66c7('0x169'),'foreignKey':_0x66c7('0x1f7'),'onDelete':_0x66c7('0x119')});db[_0x66c7('0x144')][_0x66c7('0x11c')](db[_0x66c7('0x80')],{'as':_0x66c7('0x16a'),'foreignKey':_0x66c7('0x1f7')});db[_0x66c7('0x144')][_0x66c7('0x11c')](db[_0x66c7('0x108')],{'as':_0x66c7('0x15e'),'foreignKey':_0x66c7('0x1f7')});db['WhatsappAccount']['hasMany'](db[_0x66c7('0x106')],{'as':_0x66c7('0x16b')});db['WhatsappAccount'][_0x66c7('0x11c')](db[_0x66c7('0x104')],{'as':'Applications'});db['WhatsappAccount'][_0x66c7('0x125')](db[_0x66c7('0xfa')],{'as':_0x66c7('0x16c'),'foreignKey':'ListId'});db[_0x66c7('0x144')][_0x66c7('0x125')](db[_0x66c7('0x88')],{'as':_0x66c7('0x159'),'foreignKey':_0x66c7('0x15a')});db[_0x66c7('0x144')][_0x66c7('0x12a')](db[_0x66c7('0x117')],{'as':_0x66c7('0x15b'),'through':_0x66c7('0x146')});db['WhatsappApplication'][_0x66c7('0x125')](db['User'],{'onDelete':'restrict'});db[_0x66c7('0x104')][_0x66c7('0x125')](db[_0x66c7('0x10e')],{'onDelete':_0x66c7('0x17c')});db[_0x66c7('0x104')][_0x66c7('0x125')](db[_0x66c7('0x144')],{'onDelete':'restrict'});db[_0x66c7('0x104')]['belongsTo'](db[_0x66c7('0x86')],{'onDelete':'restrict','foreignKey':_0x66c7('0x158')});db['WhatsappApplication']['belongsTo'](db['Tag'],{'onDelete':_0x66c7('0x17c'),'foreignKey':_0x66c7('0x17d')});db[_0x66c7('0x106')][_0x66c7('0x11c')](db[_0x66c7('0x108')],{'as':_0x66c7('0x15e'),'onDelete':_0x66c7('0x119'),'foreignKey':_0x66c7('0x1f8')});db['WhatsappInteraction'][_0x66c7('0x125')](db[_0x66c7('0x144')],{'as':_0x66c7('0x172'),'foreignKey':_0x66c7('0x1f7')});db[_0x66c7('0x106')]['belongsTo'](db[_0x66c7('0x173')],{'as':'Contact','foreignKey':_0x66c7('0x165')});db[_0x66c7('0x106')][_0x66c7('0x125')](db['User'],{'as':_0x66c7('0x174'),'foreignKey':_0x66c7('0x11a')});db[_0x66c7('0x106')]['belongsToMany'](db[_0x66c7('0x92')],{'through':_0x66c7('0x1b2'),'as':_0x66c7('0x176')});db['WhatsappInteraction']['belongsToMany'](db[_0x66c7('0x92')],{'through':_0x66c7('0x1b2'),'as':'ThroughTags'});db[_0x66c7('0x106')][_0x66c7('0x12a')](db['User'],{'as':_0x66c7('0x178'),'through':_0x66c7('0x135'),'foreignKey':_0x66c7('0x1f8')});db[_0x66c7('0x108')][_0x66c7('0x125')](db[_0x66c7('0x117')],{'as':_0x66c7('0x117')});db[_0x66c7('0x108')][_0x66c7('0x125')](db[_0x66c7('0x173')],{'onDelete':'cascade','as':_0x66c7('0x164')});db[_0x66c7('0x108')][_0x66c7('0x125')](db[_0x66c7('0x106')],{'onDelete':_0x66c7('0x119'),'as':_0x66c7('0x17a'),'foreignKey':_0x66c7('0x1f8')});db[_0x66c7('0x108')]['belongsTo'](db[_0x66c7('0x144')],{'as':_0x66c7('0x172'),'foreignKey':_0x66c7('0x1f7')});db[_0x66c7('0x10a')]['belongsTo'](db[_0x66c7('0x144')],{});db[_0x66c7('0x10a')][_0x66c7('0x125')](db['CmList'],{'as':'List','foreignKey':_0x66c7('0x16d')});db['WhatsappQueueReport'][_0x66c7('0x125')](db[_0x66c7('0x173')],{'as':_0x66c7('0x164'),'foreignKey':_0x66c7('0x165')});db['WhatsappQueueReport']['belongsTo'](db[_0x66c7('0x106')],{});db[_0x66c7('0x10a')]['belongsTo'](db[_0x66c7('0x10e')],{});db[_0x66c7('0x10a')][_0x66c7('0x125')](db[_0x66c7('0x108')],{});db[_0x66c7('0x10a')][_0x66c7('0x125')](db['User'],{});db[_0x66c7('0x10c')][_0x66c7('0x125')](db[_0x66c7('0x108')],{});db['WhatsappTransferReport'][_0x66c7('0x125')](db['WhatsappInteraction'],{});db[_0x66c7('0x10c')][_0x66c7('0x125')](db[_0x66c7('0x144')],{'foreignKey':_0x66c7('0x1f9'),'as':_0x66c7('0x1de')});db['WhatsappTransferReport']['belongsTo'](db[_0x66c7('0x144')],{'foreignKey':'ToWhatsappAccountId','as':'ToAccount'});db['WhatsappTransferReport'][_0x66c7('0x125')](db[_0x66c7('0x10e')],{'foreignKey':_0x66c7('0x1fa'),'as':_0x66c7('0x1e2')});db[_0x66c7('0x10c')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x66c7('0x1e0')});db['WhatsappTransferReport'][_0x66c7('0x125')](db[_0x66c7('0x117')],{'foreignKey':'ToUserId','as':_0x66c7('0x1e6')});db[_0x66c7('0x10e')][_0x66c7('0x12a')](db[_0x66c7('0x117')],{'as':_0x66c7('0x15b'),'through':'UserWhatsappQueue','foreignKey':_0x66c7('0x1fb')});db[_0x66c7('0x10e')][_0x66c7('0x12a')](db['Team'],{'through':'team_has_whatsapp_queues','as':_0x66c7('0x170')});module[_0x66c7('0x1fc')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x9ffd=['ScreenRecording','VoiceMailMessage','Messages','mailboxuser','VoiceQueueReport','QueueCalls','uniqueid','AgentReports','VoiceCallReport','Contact','ContactId','MailServerIn','MailAccountId','Imap','Smtp','Dispositions','Answers','ListId','TemplateId','mandatoryDispositionPause','mandatoryDispositionPauseId','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','Users','Interaction','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','List','Items','FaxAccountId','Interactions','FaxApplication','FaxInteractionId','fax_interaction_has_tags','ThroughTags','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsMessage','SmsApplication','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','Agent','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','Attachments','ChatGroupId','chat_group_has_users','CmCompany','Company','cm_contact_has_tags','Queue','CampaignId','OwnerId','Automation','Condition','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','ParentId','MailApplications','ChatApplications','FaxApplications','SmsApplications','Schedule','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','Actions','Fields','MetricId','Configurations','Subjects','SubjectId','FieldId','AccountId','Subject','DescriptionId','Field','VariableId','Description','int_desk_configuration_has_tags','ZohoConfiguration','Descriptions','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','FreshsalesAccount','FreshsalesField','FromId','ToId','SessionId','ProjectId','user_has_square_projects','MailQueues','ChatQueues','team_has_sms_queues','SmsQueues','team_has_whatsapp_queues','VoicePrefix','TeamVoicePrefix','TrunkBackup','TrunkBackupId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToQueue','ToMailAccountId','ChatTransferReport','FromChatWebsiteId','ToUserId','ToAgent','ToChatQueueId','ToAccount','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','ToSmsAccountId','CmCustomField','CustomFields','Queues','UserVoicePrefix','userProfileId','UserProfileSection','UserProfileSections','UserProfileResource','sectionId','WhatsappAccountId','WhatsappApplication','user_has_whatsapp_accounts','WhatsappMessage','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','sequelize','lodash','determine','defaultsDeep','xcall','xC@LL1234','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','motion2','database','username','options','password','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','SalesforceAccount','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesConfiguration','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','Team','Campaign','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','hasOne','cascade','UserId','User','hasMany','VoiceRecording','UserVoiceQueueRt','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteraction','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteraction','MailInteractions','WhatsappInteractions','UserNotification','SenderId','belongsToMany','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','VoiceQueue','VoiceQueues','VoicePrefixes','FaxQueues','SmsQueue','OpenchannelQueues','WhatsappQueues','UserWhatsappQueue','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','WhatsappAccounts','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','CmHopper','Hoppers','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','belongsTo','TrunkId','IntervalId','Agents','Teams','voice_queues_has_cm_blacklists'];(function(_0x680969,_0x261431){var _0x3932fd=function(_0x50849e){while(--_0x50849e){_0x680969['push'](_0x680969['shift']());}};_0x3932fd(++_0x261431);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x4cd410,_0x5064d3){_0x4cd410=_0x4cd410-0x0;var _0x52b21c=_0x9ffd[_0x4cd410];return _0x52b21c;};'use strict';var config=require(_0xd9ff('0x0'));var Sequelize=require(_0xd9ff('0x1'));var _=require(_0xd9ff('0x2'));var jstz=require('jstz');var timezone=jstz[_0xd9ff('0x3')]();config[_0xd9ff('0x1')]=_[_0xd9ff('0x4')](config[_0xd9ff('0x1')],{'database':'motion2','username':_0xd9ff('0x5'),'password':_0xd9ff('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xd9ff('0x7'),'dialectOptions':{'charset':_0xd9ff('0x8')},'logging':![],'timezone':timezone[_0xd9ff('0x9')](),'define':{'charset':_0xd9ff('0xa'),'collate':_0xd9ff('0xb')}}});config[_0xd9ff('0xc')]=_[_0xd9ff('0x4')](config[_0xd9ff('0xc')],{'database':_0xd9ff('0xd'),'username':'xcall','password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xd9ff('0x8')},'logging':![],'timezone':timezone[_0xd9ff('0x9')](),'define':{'charset':_0xd9ff('0xa'),'collate':_0xd9ff('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xd9ff('0x1')][_0xd9ff('0xe')],config[_0xd9ff('0x1')][_0xd9ff('0xf')],config['sequelize']['password'],config[_0xd9ff('0x1')][_0xd9ff('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xd9ff('0xc')][_0xd9ff('0xe')],config[_0xd9ff('0xc')]['username'],config[_0xd9ff('0xc')][_0xd9ff('0x11')],config['sequelizeHistory'][_0xd9ff('0x10')])};db['User']=db['sequelize']['import']('../api/user/user.model');db[_0xd9ff('0x12')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0x14'));db[_0xd9ff('0x15')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x16'));db[_0xd9ff('0x17')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x18'));db[_0xd9ff('0x19')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db['VoiceQueue']=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/voiceQueue/voiceQueue.model');db['VoiceRecording']=db['sequelize']['import'](_0xd9ff('0x1a'));db['ScreenRecording']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x1b'));db[_0xd9ff('0x1c')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x1d'));db['VoiceCallReport']=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x1e'));db[_0xd9ff('0x1f')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/voiceDialReport/voiceDialReport.model');db[_0xd9ff('0x20')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x21'));db['VoiceQueueReport']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x22'));db[_0xd9ff('0x23')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x24'));db[_0xd9ff('0x25')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x26'));db['VoiceTransferReport']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x27'));db['UserVoiceQueueRt']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x28'));db[_0xd9ff('0x29')]=db['sequelize'][_0xd9ff('0x13')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0xd9ff('0x2a')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x2b'));db[_0xd9ff('0x2c')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x2d'));db[_0xd9ff('0x2e')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x2f'));db[_0xd9ff('0x30')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x31'));db[_0xd9ff('0x32')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x33'));db['UserWhatsappQueue']=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x34'));db['MailServerIn']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x35'));db['MailServerOut']=db['sequelize']['import'](_0xd9ff('0x36'));db[_0xd9ff('0x37')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x38'));db[_0xd9ff('0x39')]=db['sequelize']['import']('../api/mailQueue/mailQueue.model');db[_0xd9ff('0x3a')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x3b'));db['MailInteraction']=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x3c'));db[_0xd9ff('0x3d')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/mailMessage/mailMessage.model');db[_0xd9ff('0x3e')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x3f'));db[_0xd9ff('0x40')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x41'));db[_0xd9ff('0x42')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0x43'));db[_0xd9ff('0x44')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/dashboardItem/dashboardItem.model');db[_0xd9ff('0x45')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/faxAccount/faxAccount.model');db['FaxApplication']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x46'));db[_0xd9ff('0x47')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/faxInteraction/faxInteraction.model');db[_0xd9ff('0x48')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x49'));db[_0xd9ff('0x4a')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x4b'));db['FaxQueueReport']=db['sequelize']['import'](_0xd9ff('0x4c'));db['SmsAccount']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x4d'));db['SmsApplication']=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/smsApplication/smsApplication.model');db[_0xd9ff('0x4e')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x4f'));db['SmsMessage']=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x50'));db['SmsQueue']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x51'));db[_0xd9ff('0x52')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x53'));db[_0xd9ff('0x54')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0x55'));db[_0xd9ff('0x56')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0x57'));db[_0xd9ff('0x58')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x59'));db[_0xd9ff('0x5a')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x5b'));db[_0xd9ff('0x5c')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0xd9ff('0x5d')]=db['sequelize'][_0xd9ff('0x13')]('../api/chatApplication/chatApplication.model');db[_0xd9ff('0x5e')]=db['sequelize'][_0xd9ff('0x13')]('../api/chatInteraction/chatInteraction.model');db[_0xd9ff('0x5f')]=db['sequelize'][_0xd9ff('0x13')]('../api/chatMessage/chatMessage.model');db[_0xd9ff('0x60')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0x61'));db[_0xd9ff('0x62')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x63'));db[_0xd9ff('0x64')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x65'));db[_0xd9ff('0x66')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x67'));db['CmCompany']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x68'));db[_0xd9ff('0x69')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x6a'));db['CmHopper']=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/cmHopper/cmHopper.model');db[_0xd9ff('0x6b')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x6c'));db[_0xd9ff('0x6d')]=db[_0xd9ff('0x1')]['import']('../api/cmHopperFinal/cmHopperFinal.model');db[_0xd9ff('0x6e')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0x6f'));db[_0xd9ff('0x70')]=db[_0xd9ff('0x1')]['import']('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x71'));db[_0xd9ff('0x72')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x73'));db['Automation']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x74'));db[_0xd9ff('0x75')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x76'));db[_0xd9ff('0x77')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0x78'));db['Condition']=db['sequelize'][_0xd9ff('0x13')]('../api/condition/condition.model');db[_0xd9ff('0x79')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x7a'));db[_0xd9ff('0x7b')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x7c'));db['Cdr']=db[_0xd9ff('0x1')]['import']('../api/cdr/cdr.model');db[_0xd9ff('0x7d')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x7e'));db['Schedule']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x7f'));db[_0xd9ff('0x80')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x81'));db[_0xd9ff('0x82')]=db['sequelize']['import']('../api/tag/tag.model');db[_0xd9ff('0x83')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x84'));db[_0xd9ff('0x85')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x86'));db[_0xd9ff('0x87')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/variable/variable.model');db[_0xd9ff('0x88')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/integration/integration.model');db[_0xd9ff('0x89')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0x8a'));db[_0xd9ff('0x8b')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0x8c'));db[_0xd9ff('0x8d')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x8e'));db[_0xd9ff('0x8f')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x90'));db[_0xd9ff('0x91')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x92'));db[_0xd9ff('0x93')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x94'));db['AnalyticTreeReport']=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0xd9ff('0x95')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0xd9ff('0x96')]=db['sequelize'][_0xd9ff('0x13')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0xd9ff('0x97')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x98'));db[_0xd9ff('0x99')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x9a'));db[_0xd9ff('0x9b')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0x9c'));db[_0xd9ff('0x9d')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0x9e'));db[_0xd9ff('0x9f')]=db['sequelize']['import'](_0xd9ff('0xa0'));db[_0xd9ff('0xa1')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xa2'));db[_0xd9ff('0xa3')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0xa4'));db[_0xd9ff('0xa5')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xa6'));db['ZohoConfiguration']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xa7'));db[_0xd9ff('0xa8')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xa9'));db[_0xd9ff('0xaa')]=db['sequelize'][_0xd9ff('0x13')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0xd9ff('0xab')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xac'));db[_0xd9ff('0xad')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xae'));db[_0xd9ff('0xaf')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xb0'));db[_0xd9ff('0xb1')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0xb2'));db[_0xd9ff('0xb3')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0xb4'));db[_0xd9ff('0xb5')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0xb6'));db[_0xd9ff('0xb7')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xb8'));db[_0xd9ff('0xb9')]=db['sequelize'][_0xd9ff('0x13')]('../api/intVtigerField/intVtigerField.model');db[_0xd9ff('0xba')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xbb'));db[_0xd9ff('0xbc')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xbd'));db[_0xd9ff('0xbe')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/intServicenowField/intServicenowField.model');db[_0xd9ff('0xbf')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0xc0'));db[_0xd9ff('0xc1')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xc2'));db[_0xd9ff('0xc3')]=db['sequelize']['import'](_0xd9ff('0xc4'));db['FreshsalesAccount']=db['sequelize']['import']('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0xd9ff('0xc5')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db[_0xd9ff('0x1')]['import'](_0xd9ff('0xc6'));db['Integration']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xc7'));db[_0xd9ff('0xc8')]=db[_0xd9ff('0x1')]['import']('../api/network/network.model');db[_0xd9ff('0xc9')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xca'));db[_0xd9ff('0xcb')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0xcc'));db[_0xd9ff('0xcd')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xce'));db[_0xd9ff('0xcf')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xd0'));db[_0xd9ff('0xd1')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xd9ff('0xd2')]=db[_0xd9ff('0x1')]['import']('../api/smsQueueReport/smsQueueReport.model');db[_0xd9ff('0xd3')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0xd4'));db[_0xd9ff('0xd5')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xd6'));db[_0xd9ff('0xd7')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/jscriptyProject/jscriptyProject.model');db['Setting']=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0xd8'));db[_0xd9ff('0xd9')]=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0xda'));db[_0xd9ff('0xdb')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xdc'));db['SquareRecording']=db[_0xd9ff('0x1')]['import'](_0xd9ff('0xdd'));db[_0xd9ff('0xde')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/squareMessage/squareMessage.model');db[_0xd9ff('0xdf')]=db[_0xd9ff('0x1')]['import']('../api/team/team.model');db['License']=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/license/license.model');db[_0xd9ff('0xe0')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/campaign/campaign.model');db['Migration']=db['sequelize'][_0xd9ff('0x13')]('../api/migration/migration.model');db[_0xd9ff('0xe1')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0xe2'));db[_0xd9ff('0xe3')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xe4'));db['MailTransferReport']=db[_0xd9ff('0x1')]['import']('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xe5'));db[_0xd9ff('0xe6')]=db['sequelize']['import'](_0xd9ff('0xe7'));db[_0xd9ff('0xe8')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xe9'));db['SmsTransferReport']=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0xea'));db[_0xd9ff('0xeb')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xec'));db['VoicePrefix']=db[_0xd9ff('0x1')]['import']('../api/voicePrefix/voicePrefix.model');db[_0xd9ff('0xed')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xee'));db['UserProfileSection']=db['sequelize'][_0xd9ff('0x13')]('../api/userProfileSection/userProfileSection.model');db['UserProfileResource']=db[_0xd9ff('0x1')]['import'](_0xd9ff('0xef'));db['UserNotification']=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xf0'));db[_0xd9ff('0xf1')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xf2'));db['WhatsappApplication']=db[_0xd9ff('0x1')]['import']('../api/whatsappApplication/whatsappApplication.model');db[_0xd9ff('0xf3')]=db[_0xd9ff('0x1')]['import'](_0xd9ff('0xf4'));db['WhatsappMessage']=db['sequelize'][_0xd9ff('0x13')](_0xd9ff('0xf5'));db[_0xd9ff('0xf6')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xf7'));db[_0xd9ff('0xf8')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xf9'));db[_0xd9ff('0xfa')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')]('../api/whatsappQueue/whatsappQueue.model');db['CloudProvider']=db['sequelize'][_0xd9ff('0x13')]('../api/cloudProvider/cloudProvider.model');db[_0xd9ff('0xfb')]=db[_0xd9ff('0x1')][_0xd9ff('0x13')](_0xd9ff('0xfc'));db['TeamVoicePrefix']=db[_0xd9ff('0x1')]['import'](_0xd9ff('0xfd'));db['UserVoicePrefix']=db['sequelize']['import'](_0xd9ff('0xfe'));db['User'][_0xd9ff('0xff')](db['VoiceMail'],{'as':_0xd9ff('0x1c'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0x102')][_0xd9ff('0x103')](db[_0xd9ff('0x104')],{'as':'Recordings','foreignKey':'UserId'});db[_0xd9ff('0x102')][_0xd9ff('0x103')](db[_0xd9ff('0x105')],{'as':_0xd9ff('0x106'),'foreignKey':_0xd9ff('0x101')});db['User'][_0xd9ff('0x103')](db[_0xd9ff('0x17')],{'as':_0xd9ff('0x107'),'onDelete':_0xd9ff('0x100'),'hooks':!![]});db[_0xd9ff('0x102')][_0xd9ff('0x103')](db['CmHopperFinal'],{'as':_0xd9ff('0x108'),'foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0x102')][_0xd9ff('0x103')](db[_0xd9ff('0x6e')],{'as':_0xd9ff('0x109'),'foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0x102')][_0xd9ff('0x103')](db[_0xd9ff('0x70')],{'as':_0xd9ff('0x70'),'foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0x102')][_0xd9ff('0x103')](db[_0xd9ff('0x10a')],{'as':_0xd9ff('0x10b'),'foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0x102')]['hasMany'](db[_0xd9ff('0x5e')],{'as':_0xd9ff('0x10c'),'foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0x102')][_0xd9ff('0x103')](db[_0xd9ff('0x4e')],{'as':_0xd9ff('0x10d'),'foreignKey':_0xd9ff('0x101')});db['User'][_0xd9ff('0x103')](db['FaxInteraction'],{'as':_0xd9ff('0x10e'),'foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0x102')][_0xd9ff('0x103')](db[_0xd9ff('0x10f')],{'as':_0xd9ff('0x110'),'foreignKey':_0xd9ff('0x101')});db['User'][_0xd9ff('0x103')](db[_0xd9ff('0xf3')],{'as':_0xd9ff('0x111'),'foreignKey':_0xd9ff('0x101')});db['User'][_0xd9ff('0x103')](db[_0xd9ff('0x112')],{'as':'UserNotifications','foreignKey':_0xd9ff('0x113')});db[_0xd9ff('0x102')]['belongsTo'](db['UserProfile'],{'as':'UserProfile','foreignKey':'userProfileId'});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x64')],{'as':'Groups','through':'chat_group_has_users'});db[_0xd9ff('0x102')]['belongsToMany'](db[_0xd9ff('0x69')],{'as':_0xd9ff('0x115'),'through':_0xd9ff('0x116')});db['User']['belongsToMany'](db['CmList'],{'as':_0xd9ff('0x117'),'through':_0xd9ff('0x118')});db['User'][_0xd9ff('0x114')](db[_0xd9ff('0xdf')],{'through':_0xd9ff('0x119')});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x10f')],{'as':_0xd9ff('0x110'),'through':_0xd9ff('0x11a')});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x5e')],{'as':_0xd9ff('0x10c'),'through':_0xd9ff('0x11b')});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x47')],{'as':_0xd9ff('0x10e'),'through':_0xd9ff('0x11c')});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x4e')],{'as':_0xd9ff('0x10d'),'through':_0xd9ff('0x11d')});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x10a')],{'as':_0xd9ff('0x10b'),'through':_0xd9ff('0x11e')});db[_0xd9ff('0x102')]['belongsToMany'](db[_0xd9ff('0xf3')],{'as':_0xd9ff('0x111'),'through':'user_has_whatsapp_interactions'});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x11f')],{'as':_0xd9ff('0x120'),'through':_0xd9ff('0x29'),'required':![]});db[_0xd9ff('0x102')]['belongsToMany'](db['VoicePrefix'],{'as':_0xd9ff('0x121'),'through':'UserVoicePrefix','required':![]});db['User'][_0xd9ff('0x114')](db[_0xd9ff('0x39')],{'as':'MailQueues','through':_0xd9ff('0x2c'),'required':![]});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x62')],{'as':'ChatQueues','through':_0xd9ff('0x2a'),'required':![],'hooks':!![]});db[_0xd9ff('0x102')]['belongsToMany'](db[_0xd9ff('0x4a')],{'as':_0xd9ff('0x122'),'through':'UserFaxQueue','required':![]});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x123')],{'as':'SmsQueues','through':_0xd9ff('0x30'),'required':![]});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db['OpenchannelQueue'],{'as':_0xd9ff('0x124'),'through':'UserOpenchannelQueue','required':![]});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0xfa')],{'as':_0xd9ff('0x125'),'through':_0xd9ff('0x126'),'required':![]});db[_0xd9ff('0x102')]['belongsToMany'](db[_0xd9ff('0xeb')],{'through':_0xd9ff('0x118')});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x5a')],{'as':'ChatWebsites','through':_0xd9ff('0x127')});db[_0xd9ff('0x102')]['belongsToMany'](db[_0xd9ff('0x45')],{'as':_0xd9ff('0x128'),'through':_0xd9ff('0x129')});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x37')],{'as':_0xd9ff('0x12a'),'through':_0xd9ff('0x12b')});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x52')],{'as':_0xd9ff('0x12c'),'through':_0xd9ff('0x12d')});db[_0xd9ff('0x102')][_0xd9ff('0x114')](db[_0xd9ff('0x12e')],{'as':'SmsAccounts','through':'user_has_sms_accounts'});db['User'][_0xd9ff('0x114')](db['WhatsappAccount'],{'as':_0xd9ff('0x12f'),'through':'user_has_whatsapp_accounts'});db['User']['belongsToMany'](db[_0xd9ff('0xdb')],{'as':'SquareProjects','through':'user_has_square_projects'});db[_0xd9ff('0x12')][_0xd9ff('0x103')](db[_0xd9ff('0x17')],{'as':_0xd9ff('0x130'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x131')});db[_0xd9ff('0x15')][_0xd9ff('0x103')](db[_0xd9ff('0x17')],{'onDelete':_0xd9ff('0x100')});db[_0xd9ff('0x17')][_0xd9ff('0x103')](db[_0xd9ff('0x17')],{'as':_0xd9ff('0x132'),'onDelete':'cascade'});db['VoiceMusicOnHold'][_0xd9ff('0x114')](db[_0xd9ff('0x80')],{'as':_0xd9ff('0x133'),'through':_0xd9ff('0x134')});db[_0xd9ff('0x11f')][_0xd9ff('0x103')](db[_0xd9ff('0x105')],{'as':_0xd9ff('0x135'),'foreignKey':'VoiceQueueId'});db[_0xd9ff('0x11f')][_0xd9ff('0x103')](db[_0xd9ff('0x136')],{'as':_0xd9ff('0x137'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xd9ff('0x103')](db[_0xd9ff('0x6d')],{'as':'HopperFinals','foreignKey':_0xd9ff('0x138')});db[_0xd9ff('0x11f')]['hasMany'](db[_0xd9ff('0x6e')],{'as':_0xd9ff('0x139'),'foreignKey':_0xd9ff('0x138')});db[_0xd9ff('0x11f')][_0xd9ff('0x103')](db[_0xd9ff('0x70')],{'as':_0xd9ff('0x70'),'foreignKey':'VoiceQueueId'});db[_0xd9ff('0x11f')][_0xd9ff('0x103')](db[_0xd9ff('0x6b')],{'as':_0xd9ff('0x13a'),'foreignKey':_0xd9ff('0x138')});db['VoiceQueue'][_0xd9ff('0x103')](db[_0xd9ff('0xd1')],{'as':_0xd9ff('0x13b'),'foreignKey':'VoiceQueueId'});db[_0xd9ff('0x11f')][_0xd9ff('0x13c')](db[_0xd9ff('0x25')],{'as':'Trunk','foreignKey':_0xd9ff('0x13d')});db['VoiceQueue']['belongsTo'](db['Trunk'],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0xd9ff('0x11f')][_0xd9ff('0x13c')](db['Interval'],{'as':_0xd9ff('0x79'),'foreignKey':_0xd9ff('0x13e')});db[_0xd9ff('0x11f')]['belongsTo'](db[_0xd9ff('0x7b')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xd9ff('0x11f')][_0xd9ff('0x114')](db[_0xd9ff('0xeb')],{'as':'Lists','through':'voice_queues_has_cm_lists'});db[_0xd9ff('0x11f')][_0xd9ff('0x114')](db['User'],{'as':_0xd9ff('0x13f'),'through':_0xd9ff('0x29')});db[_0xd9ff('0x11f')][_0xd9ff('0x114')](db[_0xd9ff('0xdf')],{'as':_0xd9ff('0x140'),'through':_0xd9ff('0xfb')});db['VoiceQueue'][_0xd9ff('0x114')](db[_0xd9ff('0xeb')],{'as':'BlackLists','through':_0xd9ff('0x141')});db[_0xd9ff('0x104')]['belongsTo'](db[_0xd9ff('0x102')],{'as':'User','foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0x142')]['belongsTo'](db[_0xd9ff('0x102')],{'as':'User','foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0x1c')][_0xd9ff('0x103')](db[_0xd9ff('0x143')],{'as':_0xd9ff('0x144'),'onDelete':_0xd9ff('0x100'),'foreignKey':'mailboxuser','sourceKey':'mailbox'});db[_0xd9ff('0x143')]['belongsTo'](db[_0xd9ff('0x1c')],{'foreignKey':_0xd9ff('0x145'),'targetKey':'mailbox'});db['VoiceCallReport']['hasMany'](db[_0xd9ff('0x146')],{'as':_0xd9ff('0x147'),'foreignKey':_0xd9ff('0x148'),'constraints':![]});db['VoiceCallReport'][_0xd9ff('0x103')](db[_0xd9ff('0x20')],{'as':_0xd9ff('0x149'),'foreignKey':_0xd9ff('0x148'),'constraints':![]});db[_0xd9ff('0x14a')][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{'as':'User','foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0x14a')][_0xd9ff('0x13c')](db[_0xd9ff('0x69')],{'as':_0xd9ff('0x14b'),'foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0x14d')][_0xd9ff('0x13c')](db[_0xd9ff('0x37')],{'as':_0xd9ff('0x37'),'foreignKey':_0xd9ff('0x14e')});db['MailServerOut']['belongsTo'](db[_0xd9ff('0x37')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0xd9ff('0x37')][_0xd9ff('0xff')](db[_0xd9ff('0x14d')],{'as':_0xd9ff('0x14f'),'onDelete':_0xd9ff('0x100')});db['MailAccount'][_0xd9ff('0xff')](db['MailServerOut'],{'as':_0xd9ff('0x150'),'onDelete':_0xd9ff('0x100')});db['MailAccount'][_0xd9ff('0x103')](db[_0xd9ff('0x77')],{'as':_0xd9ff('0x151'),'foreignKey':_0xd9ff('0x14e'),'onDelete':_0xd9ff('0x100')});db[_0xd9ff('0x37')][_0xd9ff('0x103')](db['CannedAnswer'],{'as':_0xd9ff('0x152'),'foreignKey':_0xd9ff('0x14e')});db[_0xd9ff('0x37')][_0xd9ff('0x103')](db[_0xd9ff('0x3d')],{'as':_0xd9ff('0x144'),'foreignKey':'MailAccountId'});db[_0xd9ff('0x37')][_0xd9ff('0x103')](db[_0xd9ff('0x10f')],{'as':'Interactions'});db[_0xd9ff('0x37')]['hasMany'](db[_0xd9ff('0x3e')],{'as':'Applications'});db[_0xd9ff('0x37')][_0xd9ff('0x13c')](db[_0xd9ff('0xeb')],{'as':'List','foreignKey':_0xd9ff('0x153')});db['MailAccount'][_0xd9ff('0x13c')](db[_0xd9ff('0x83')],{'as':_0xd9ff('0x83'),'foreignKey':_0xd9ff('0x154')});db[_0xd9ff('0x37')]['belongsTo'](db[_0xd9ff('0x7b')],{'as':_0xd9ff('0x155'),'foreignKey':_0xd9ff('0x156')});db[_0xd9ff('0x37')][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':'Agents','through':'user_has_mail_accounts'});db[_0xd9ff('0x39')][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x13f'),'through':_0xd9ff('0x2c')});db[_0xd9ff('0x39')][_0xd9ff('0x114')](db['Team'],{'through':_0xd9ff('0x157'),'as':_0xd9ff('0x140')});db[_0xd9ff('0x10f')][_0xd9ff('0x103')](db[_0xd9ff('0x3d')],{'as':_0xd9ff('0x144'),'onDelete':'cascade','foreignKey':_0xd9ff('0x158')});db[_0xd9ff('0x10f')][_0xd9ff('0x13c')](db[_0xd9ff('0x37')],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x14e')});db['MailInteraction']['belongsTo'](db[_0xd9ff('0x69')],{'as':_0xd9ff('0x14b'),'foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0x10f')][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x15a'),'foreignKey':_0xd9ff('0x101')});db['MailInteraction'][_0xd9ff('0x114')](db[_0xd9ff('0x82')],{'through':_0xd9ff('0x15b'),'as':_0xd9ff('0x15c')});db[_0xd9ff('0x10f')][_0xd9ff('0x114')](db['Tag'],{'through':_0xd9ff('0x15b'),'as':'ThroughTags'});db['MailInteraction'][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x15d'),'through':_0xd9ff('0x11a'),'foreignKey':_0xd9ff('0x158')});db[_0xd9ff('0x3d')][_0xd9ff('0x103')](db[_0xd9ff('0xe1')],{'as':'Attachments','onDelete':_0xd9ff('0x100')});db['MailMessage'][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x102')});db[_0xd9ff('0x3d')]['belongsTo'](db[_0xd9ff('0x69')],{'onDelete':_0xd9ff('0x100'),'as':_0xd9ff('0x14b')});db[_0xd9ff('0x3d')][_0xd9ff('0x13c')](db[_0xd9ff('0x10f')],{'as':_0xd9ff('0x15e'),'foreignKey':_0xd9ff('0x158')});db[_0xd9ff('0x3d')]['belongsTo'](db[_0xd9ff('0x37')],{'as':'Account','foreignKey':'MailAccountId'});db[_0xd9ff('0x3d')][_0xd9ff('0x13c')](db[_0xd9ff('0x5a')],{'as':_0xd9ff('0x5a'),'foreignKey':_0xd9ff('0x15f')});db[_0xd9ff('0x3d')][_0xd9ff('0x13c')](db[_0xd9ff('0x60')],{'as':_0xd9ff('0x60'),'foreignKey':_0xd9ff('0x160')});db[_0xd9ff('0x3e')][_0xd9ff('0x13c')](db['User'],{'onDelete':_0xd9ff('0x161')});db['MailApplication'][_0xd9ff('0x13c')](db[_0xd9ff('0x39')],{'onDelete':'restrict'});db['MailApplication'][_0xd9ff('0x13c')](db[_0xd9ff('0x37')],{'onDelete':'restrict'});db[_0xd9ff('0x3e')][_0xd9ff('0x13c')](db['Interval'],{'onDelete':_0xd9ff('0x161'),'foreignKey':'IntervalId'});db[_0xd9ff('0x3e')][_0xd9ff('0x13c')](db[_0xd9ff('0x82')],{'onDelete':_0xd9ff('0x161'),'foreignKey':_0xd9ff('0x162')});db[_0xd9ff('0x40')][_0xd9ff('0x13c')](db[_0xd9ff('0x37')],{});db[_0xd9ff('0x40')][_0xd9ff('0x13c')](db[_0xd9ff('0xeb')],{'as':_0xd9ff('0x163'),'foreignKey':_0xd9ff('0x153')});db[_0xd9ff('0x40')]['belongsTo'](db[_0xd9ff('0x69')],{'as':_0xd9ff('0x14b'),'foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0x40')][_0xd9ff('0x13c')](db[_0xd9ff('0x10f')],{});db['MailQueueReport']['belongsTo'](db['MailMessage'],{});db['MailQueueReport'][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{});db['MailQueueReport'][_0xd9ff('0x13c')](db[_0xd9ff('0x39')],{});db[_0xd9ff('0x42')]['hasMany'](db['DashboardItem'],{'as':_0xd9ff('0x164'),'onDelete':_0xd9ff('0x100')});db['FaxAccount']['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':'FaxAccountId','onDelete':_0xd9ff('0x100')});db[_0xd9ff('0x45')][_0xd9ff('0x103')](db[_0xd9ff('0x75')],{'as':_0xd9ff('0x152'),'foreignKey':_0xd9ff('0x165')});db[_0xd9ff('0x45')][_0xd9ff('0x103')](db[_0xd9ff('0x47')],{'as':_0xd9ff('0x166')});db[_0xd9ff('0x45')][_0xd9ff('0x103')](db[_0xd9ff('0x167')],{'as':_0xd9ff('0x132')});db[_0xd9ff('0x45')][_0xd9ff('0x103')](db[_0xd9ff('0x17')],{'as':'Exntensions','onDelete':_0xd9ff('0x100')});db['FaxAccount'][_0xd9ff('0x103')](db['FaxMessage'],{'as':_0xd9ff('0x144')});db[_0xd9ff('0x45')][_0xd9ff('0x13c')](db['Trunk'],{'as':'Trunk'});db['FaxAccount']['belongsTo'](db['CmList'],{'as':_0xd9ff('0x163'),'foreignKey':_0xd9ff('0x153')});db[_0xd9ff('0x45')][_0xd9ff('0x13c')](db[_0xd9ff('0x7b')],{'as':_0xd9ff('0x155'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xd9ff('0x45')][_0xd9ff('0x114')](db['User'],{'as':'Agents','through':_0xd9ff('0x129')});db[_0xd9ff('0x167')][_0xd9ff('0x13c')](db['User'],{'onDelete':_0xd9ff('0x161')});db[_0xd9ff('0x167')]['belongsTo'](db[_0xd9ff('0x4a')],{'onDelete':_0xd9ff('0x161')});db[_0xd9ff('0x167')][_0xd9ff('0x13c')](db['FaxAccount'],{'onDelete':'restrict'});db[_0xd9ff('0x167')][_0xd9ff('0x13c')](db['Tag'],{'onDelete':_0xd9ff('0x161'),'foreignKey':'TagId'});db[_0xd9ff('0x47')][_0xd9ff('0x103')](db[_0xd9ff('0x48')],{'as':_0xd9ff('0x144'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x168')});db['FaxInteraction']['belongsTo'](db[_0xd9ff('0x45')],{'as':'Account','foreignKey':_0xd9ff('0x165')});db['FaxInteraction'][_0xd9ff('0x13c')](db[_0xd9ff('0x69')],{'as':_0xd9ff('0x14b'),'foreignKey':'ContactId'});db[_0xd9ff('0x47')][_0xd9ff('0x13c')](db['User'],{'as':'Owner','foreignKey':'UserId'});db[_0xd9ff('0x47')][_0xd9ff('0x114')](db[_0xd9ff('0x82')],{'through':_0xd9ff('0x169'),'as':_0xd9ff('0x15c')});db[_0xd9ff('0x47')][_0xd9ff('0x114')](db[_0xd9ff('0x82')],{'through':'fax_interaction_has_tags','as':_0xd9ff('0x16a')});db[_0xd9ff('0x47')][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x15d'),'through':_0xd9ff('0x11c'),'foreignKey':_0xd9ff('0x168')});db[_0xd9ff('0x48')][_0xd9ff('0x13c')](db['User'],{'onDelete':'cascade','as':'User'});db[_0xd9ff('0x48')][_0xd9ff('0x13c')](db['FaxInteraction'],{'as':_0xd9ff('0x15e'),'foreignKey':'FaxInteractionId'});db['FaxMessage'][_0xd9ff('0x13c')](db[_0xd9ff('0x69')],{'onDelete':_0xd9ff('0x100'),'as':_0xd9ff('0x14b')});db[_0xd9ff('0x48')][_0xd9ff('0x13c')](db['Attachment'],{'as':_0xd9ff('0xe1'),'foreignKey':_0xd9ff('0x16b')});db[_0xd9ff('0x48')][_0xd9ff('0x13c')](db[_0xd9ff('0x45')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0xd9ff('0x4a')][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x13f'),'through':_0xd9ff('0x2e')});db[_0xd9ff('0x4a')][_0xd9ff('0x114')](db[_0xd9ff('0xdf')],{'through':_0xd9ff('0x16c'),'as':_0xd9ff('0x140')});db[_0xd9ff('0x16d')][_0xd9ff('0x13c')](db[_0xd9ff('0x45')],{});db['FaxQueueReport'][_0xd9ff('0x13c')](db[_0xd9ff('0xeb')],{'as':_0xd9ff('0x163'),'foreignKey':_0xd9ff('0x153')});db[_0xd9ff('0x16d')][_0xd9ff('0x13c')](db[_0xd9ff('0x69')],{'as':_0xd9ff('0x14b'),'foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0x16d')][_0xd9ff('0x13c')](db[_0xd9ff('0x47')],{});db[_0xd9ff('0x16d')]['belongsTo'](db[_0xd9ff('0x48')],{});db[_0xd9ff('0x16d')][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{});db['FaxQueueReport'][_0xd9ff('0x13c')](db['FaxQueue'],{});db['SmsAccount'][_0xd9ff('0x103')](db[_0xd9ff('0x77')],{'as':_0xd9ff('0x151'),'foreignKey':_0xd9ff('0x16e'),'onDelete':_0xd9ff('0x100')});db[_0xd9ff('0x12e')][_0xd9ff('0x103')](db['CannedAnswer'],{'as':_0xd9ff('0x152'),'foreignKey':_0xd9ff('0x16e')});db['SmsAccount'][_0xd9ff('0x103')](db[_0xd9ff('0x16f')],{'as':_0xd9ff('0x144'),'foreignKey':_0xd9ff('0x16e')});db[_0xd9ff('0x12e')][_0xd9ff('0x103')](db[_0xd9ff('0x4e')],{'as':_0xd9ff('0x166')});db[_0xd9ff('0x12e')][_0xd9ff('0x103')](db[_0xd9ff('0x170')],{'as':'Applications'});db['SmsAccount'][_0xd9ff('0x13c')](db[_0xd9ff('0xeb')],{'as':_0xd9ff('0x163'),'foreignKey':_0xd9ff('0x153')});db[_0xd9ff('0x12e')][_0xd9ff('0x13c')](db[_0xd9ff('0x7b')],{'as':_0xd9ff('0x155'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xd9ff('0x12e')]['belongsToMany'](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x13f'),'through':'user_has_sms_accounts'});db[_0xd9ff('0x170')][_0xd9ff('0x13c')](db['User'],{'onDelete':_0xd9ff('0x161')});db['SmsApplication']['belongsTo'](db[_0xd9ff('0x123')],{'onDelete':'restrict'});db['SmsApplication'][_0xd9ff('0x13c')](db['SmsAccount'],{'onDelete':_0xd9ff('0x161')});db[_0xd9ff('0x170')][_0xd9ff('0x13c')](db[_0xd9ff('0x79')],{'onDelete':_0xd9ff('0x161'),'foreignKey':'IntervalId'});db[_0xd9ff('0x170')][_0xd9ff('0x13c')](db['Tag'],{'onDelete':_0xd9ff('0x161'),'foreignKey':_0xd9ff('0x162')});db['SmsInteraction']['hasMany'](db[_0xd9ff('0x16f')],{'as':'Messages','onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0xd9ff('0x4e')]['belongsTo'](db['SmsAccount'],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x16e')});db[_0xd9ff('0x4e')][_0xd9ff('0x13c')](db['CmContact'],{'as':_0xd9ff('0x14b'),'foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0x4e')][_0xd9ff('0x13c')](db['User'],{'as':_0xd9ff('0x15a'),'foreignKey':'UserId'});db['SmsInteraction'][_0xd9ff('0x114')](db[_0xd9ff('0x82')],{'through':_0xd9ff('0x171'),'as':_0xd9ff('0x15c')});db[_0xd9ff('0x4e')][_0xd9ff('0x114')](db[_0xd9ff('0x82')],{'through':_0xd9ff('0x171'),'as':_0xd9ff('0x16a')});db['SmsInteraction'][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x15d'),'through':_0xd9ff('0x11d'),'foreignKey':_0xd9ff('0x172')});db[_0xd9ff('0x16f')]['belongsTo'](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x102')});db[_0xd9ff('0x16f')][_0xd9ff('0x13c')](db[_0xd9ff('0x69')],{'onDelete':'cascade','as':_0xd9ff('0x14b')});db[_0xd9ff('0x16f')][_0xd9ff('0x13c')](db[_0xd9ff('0x4e')],{'onDelete':_0xd9ff('0x100'),'as':_0xd9ff('0x15e'),'foreignKey':_0xd9ff('0x172')});db['SmsMessage'][_0xd9ff('0x13c')](db[_0xd9ff('0x12e')],{'as':'Account','foreignKey':_0xd9ff('0x16e')});db[_0xd9ff('0x123')][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x13f'),'through':_0xd9ff('0x30'),'foreignKey':_0xd9ff('0x173')});db[_0xd9ff('0x123')][_0xd9ff('0x114')](db[_0xd9ff('0xdf')],{'through':'team_has_sms_queues','as':_0xd9ff('0x140')});db[_0xd9ff('0x52')]['hasMany'](db[_0xd9ff('0x77')],{'as':'Dispositions','foreignKey':_0xd9ff('0x174'),'onDelete':_0xd9ff('0x100')});db['OpenchannelAccount'][_0xd9ff('0x103')](db[_0xd9ff('0x75')],{'as':_0xd9ff('0x152'),'foreignKey':'OpenchannelAccountId'});db[_0xd9ff('0x52')]['hasMany'](db['OpenchannelInteraction'],{'as':_0xd9ff('0x166'),'foreignKey':_0xd9ff('0x174')});db[_0xd9ff('0x52')][_0xd9ff('0x103')](db[_0xd9ff('0x56')],{'as':'Messages','foreignKey':_0xd9ff('0x174')});db[_0xd9ff('0x52')][_0xd9ff('0x103')](db[_0xd9ff('0x54')],{'as':'Applications','foreignKey':_0xd9ff('0x174')});db[_0xd9ff('0x52')][_0xd9ff('0x13c')](db[_0xd9ff('0xeb')],{'as':_0xd9ff('0x163'),'foreignKey':_0xd9ff('0x153')});db[_0xd9ff('0x52')][_0xd9ff('0x13c')](db['Pause'],{'as':_0xd9ff('0x155'),'foreignKey':_0xd9ff('0x156')});db[_0xd9ff('0x52')]['belongsToMany'](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x13f'),'through':_0xd9ff('0x12d')});db['OpenchannelApplication'][_0xd9ff('0x13c')](db['User'],{'onDelete':_0xd9ff('0x161')});db[_0xd9ff('0x54')][_0xd9ff('0x13c')](db[_0xd9ff('0x58')],{'onDelete':_0xd9ff('0x161'),'foreignKey':_0xd9ff('0x175')});db[_0xd9ff('0x54')][_0xd9ff('0x13c')](db[_0xd9ff('0x52')],{'onDelete':_0xd9ff('0x161'),'foreignKey':_0xd9ff('0x174')});db[_0xd9ff('0x54')][_0xd9ff('0x13c')](db[_0xd9ff('0x79')],{'onDelete':_0xd9ff('0x161'),'foreignKey':_0xd9ff('0x13e')});db[_0xd9ff('0x54')][_0xd9ff('0x13c')](db[_0xd9ff('0x82')],{'onDelete':_0xd9ff('0x161'),'foreignKey':_0xd9ff('0x162')});db['OpenchannelInteraction'][_0xd9ff('0x103')](db[_0xd9ff('0x56')],{'as':'Messages','onDelete':'cascade','foreignKey':_0xd9ff('0x176')});db[_0xd9ff('0x10a')][_0xd9ff('0x13c')](db[_0xd9ff('0x52')],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x174')});db['OpenchannelInteraction'][_0xd9ff('0x13c')](db[_0xd9ff('0x69')],{'as':_0xd9ff('0x14b'),'foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0x10a')]['belongsTo'](db['User'],{'as':_0xd9ff('0x15a'),'foreignKey':_0xd9ff('0x101')});db['OpenchannelInteraction'][_0xd9ff('0x114')](db[_0xd9ff('0x82')],{'through':_0xd9ff('0x177'),'as':_0xd9ff('0x15c')});db[_0xd9ff('0x10a')]['belongsToMany'](db[_0xd9ff('0x82')],{'through':'openchannel_interaction_has_tags','as':_0xd9ff('0x16a')});db['OpenchannelInteraction'][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x15d'),'through':_0xd9ff('0x11e'),'foreignKey':_0xd9ff('0x176')});db[_0xd9ff('0x56')][_0xd9ff('0x13c')](db['User'],{'onDelete':_0xd9ff('0x100'),'as':'User'});db['OpenchannelMessage']['belongsTo'](db['CmContact'],{'onDelete':_0xd9ff('0x100'),'as':_0xd9ff('0x14b')});db['OpenchannelMessage'][_0xd9ff('0x13c')](db['OpenchannelInteraction'],{'onDelete':_0xd9ff('0x100'),'as':'Interaction','foreignKey':_0xd9ff('0x176')});db[_0xd9ff('0x56')]['belongsTo'](db[_0xd9ff('0xe1')],{'as':_0xd9ff('0xe1'),'foreignKey':_0xd9ff('0x16b')});db[_0xd9ff('0x56')]['belongsTo'](db[_0xd9ff('0x52')],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x174')});db[_0xd9ff('0x58')]['belongsToMany'](db[_0xd9ff('0x102')],{'as':'Agents','through':'UserOpenchannelQueue','foreignKey':_0xd9ff('0x175')});db[_0xd9ff('0x58')][_0xd9ff('0x114')](db[_0xd9ff('0xdf')],{'through':_0xd9ff('0x178'),'as':_0xd9ff('0x140')});db['ChatWebsite'][_0xd9ff('0x103')](db[_0xd9ff('0x77')],{'as':_0xd9ff('0x151'),'foreignKey':_0xd9ff('0x15f'),'onDelete':_0xd9ff('0x100')});db['ChatWebsite'][_0xd9ff('0x103')](db[_0xd9ff('0x75')],{'as':_0xd9ff('0x152'),'foreignKey':_0xd9ff('0x15f')});db[_0xd9ff('0x5a')][_0xd9ff('0x103')](db[_0xd9ff('0x66')],{'as':_0xd9ff('0x179')});db['ChatWebsite'][_0xd9ff('0x103')](db['ChatInteraction'],{'as':_0xd9ff('0x166')});db[_0xd9ff('0x5a')][_0xd9ff('0x103')](db[_0xd9ff('0x5d')],{'as':_0xd9ff('0x132')});db[_0xd9ff('0x5a')][_0xd9ff('0x103')](db['ChatMessage'],{'as':_0xd9ff('0x144')});db[_0xd9ff('0x5a')]['belongsTo'](db[_0xd9ff('0xeb')],{'as':_0xd9ff('0x163'),'foreignKey':_0xd9ff('0x153')});db['ChatWebsite']['belongsTo'](db[_0xd9ff('0x79')],{'as':_0xd9ff('0x79'),'foreignKey':_0xd9ff('0x13e')});db['ChatWebsite'][_0xd9ff('0x13c')](db['MailAccount'],{'as':'MailAccount','foreignKey':_0xd9ff('0x14e')});db[_0xd9ff('0x5a')][_0xd9ff('0x13c')](db['Pause'],{'as':_0xd9ff('0x155'),'foreignKey':'mandatoryDispositionPauseId'});db['ChatWebsite'][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':'Agents','through':'user_has_chat_websites'});db['OpenchannelQueueReport'][_0xd9ff('0x13c')](db[_0xd9ff('0x52')],{});db['OpenchannelQueueReport'][_0xd9ff('0x13c')](db[_0xd9ff('0xeb')],{'as':_0xd9ff('0x163'),'foreignKey':'ListId'});db[_0xd9ff('0x5c')][_0xd9ff('0x13c')](db[_0xd9ff('0x69')],{'as':'Contact','foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0x5c')][_0xd9ff('0x13c')](db[_0xd9ff('0x10a')],{});db['OpenchannelQueueReport'][_0xd9ff('0x13c')](db[_0xd9ff('0x56')],{});db[_0xd9ff('0x5c')][_0xd9ff('0x13c')](db['User'],{});db[_0xd9ff('0x5c')][_0xd9ff('0x13c')](db[_0xd9ff('0x58')],{});db[_0xd9ff('0x5d')]['belongsTo'](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x17a'),'foreignKey':'UserId','onDelete':_0xd9ff('0x161')});db[_0xd9ff('0x5d')][_0xd9ff('0x13c')](db[_0xd9ff('0x62')],{'as':'Queue','foreignKey':_0xd9ff('0x17b'),'onDelete':_0xd9ff('0x161')});db[_0xd9ff('0x5d')][_0xd9ff('0x13c')](db[_0xd9ff('0x5a')],{'as':_0xd9ff('0x17c'),'foreignKey':_0xd9ff('0x15f'),'onDelete':'restrict'});db[_0xd9ff('0x5d')][_0xd9ff('0x13c')](db[_0xd9ff('0x82')],{'onDelete':_0xd9ff('0x161'),'foreignKey':'TagId'});db['ChatInteraction'][_0xd9ff('0x103')](db[_0xd9ff('0x5f')],{'as':'Messages','onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x17d')});db[_0xd9ff('0x5e')][_0xd9ff('0x13c')](db[_0xd9ff('0x5a')],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x15f')});db[_0xd9ff('0x5e')][_0xd9ff('0x13c')](db[_0xd9ff('0x69')],{'as':_0xd9ff('0x14b'),'foreignKey':'ContactId'});db[_0xd9ff('0x5e')][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x15a'),'foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0x5e')][_0xd9ff('0x114')](db['Tag'],{'through':_0xd9ff('0x17e'),'as':_0xd9ff('0x15c')});db['ChatInteraction']['belongsToMany'](db[_0xd9ff('0x82')],{'through':_0xd9ff('0x17e'),'as':'ThroughTags'});db[_0xd9ff('0x5e')][_0xd9ff('0x114')](db['User'],{'as':_0xd9ff('0x15d'),'through':'user_has_chat_interactions','foreignKey':_0xd9ff('0x17d')});db[_0xd9ff('0x5f')][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{'onDelete':_0xd9ff('0x100'),'as':_0xd9ff('0x102')});db[_0xd9ff('0x5f')][_0xd9ff('0x13c')](db['CmContact'],{'onDelete':_0xd9ff('0x100'),'as':_0xd9ff('0x14b'),'foreignKey':_0xd9ff('0x14c')});db['ChatMessage'][_0xd9ff('0x13c')](db[_0xd9ff('0x5e')],{'onDelete':_0xd9ff('0x100'),'as':_0xd9ff('0x15e'),'foreignKey':_0xd9ff('0x17d')});db[_0xd9ff('0x5f')][_0xd9ff('0x13c')](db[_0xd9ff('0xe1')],{'as':'Attachment','foreignKey':_0xd9ff('0x16b')});db[_0xd9ff('0x5f')][_0xd9ff('0x13c')](db['ChatWebsite'],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x15f')});db[_0xd9ff('0x60')][_0xd9ff('0x103')](db[_0xd9ff('0xe1')],{'as':_0xd9ff('0x17f'),'foreignKey':_0xd9ff('0x160'),'onDelete':'cascade','hooks':!![]});db[_0xd9ff('0x60')]['belongsTo'](db[_0xd9ff('0x69')],{'onDelete':_0xd9ff('0x100'),'as':_0xd9ff('0x14b'),'foreignKey':_0xd9ff('0x14c')});db['ChatOfflineMessage']['belongsTo'](db[_0xd9ff('0x5a')],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x15f')});db['ChatQueue'][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x13f'),'through':'UserChatQueue','hooks':!![]});db['ChatQueue'][_0xd9ff('0x114')](db[_0xd9ff('0xdf')],{'through':'team_has_chat_queues','as':_0xd9ff('0x140')});db[_0xd9ff('0x64')][_0xd9ff('0x103')](db[_0xd9ff('0xcb')],{'as':_0xd9ff('0x144'),'foreignKey':_0xd9ff('0x180'),'onDelete':'cascade'});db[_0xd9ff('0x64')]['belongsToMany'](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x135'),'through':_0xd9ff('0x181')});db[_0xd9ff('0x66')][_0xd9ff('0x13c')](db['ChatWebsite'],{'as':_0xd9ff('0x17c'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0xd9ff('0x103')](db[_0xd9ff('0x69')],{'as':_0xd9ff('0x115'),'foreignKey':'CompanyId'});db[_0xd9ff('0x69')]['hasMany'](db[_0xd9ff('0x136')],{'as':_0xd9ff('0x137'),'foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0x69')]['hasMany'](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0x69')]['hasMany'](db[_0xd9ff('0x6e')],{'as':_0xd9ff('0x139'),'foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0x69')]['hasMany'](db[_0xd9ff('0x70')],{'as':_0xd9ff('0x70'),'foreignKey':_0xd9ff('0x14c')});db['CmContact'][_0xd9ff('0x103')](db[_0xd9ff('0xd1')],{'as':'JscriptySessions','foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0x69')][_0xd9ff('0x103')](db[_0xd9ff('0x10a')],{'as':_0xd9ff('0x10b'),'foreignKey':_0xd9ff('0x14c'),'onDelete':_0xd9ff('0x161')});db[_0xd9ff('0x69')][_0xd9ff('0x103')](db[_0xd9ff('0x5e')],{'as':_0xd9ff('0x10c'),'foreignKey':_0xd9ff('0x14c'),'onDelete':_0xd9ff('0x161')});db['CmContact']['hasMany'](db[_0xd9ff('0x4e')],{'as':_0xd9ff('0x10d'),'foreignKey':'ContactId','onDelete':_0xd9ff('0x161')});db[_0xd9ff('0x69')][_0xd9ff('0x103')](db[_0xd9ff('0x47')],{'as':_0xd9ff('0x10e'),'foreignKey':_0xd9ff('0x14c'),'onDelete':'restrict'});db[_0xd9ff('0x69')][_0xd9ff('0x103')](db[_0xd9ff('0x10f')],{'as':'MailInteractions','foreignKey':_0xd9ff('0x14c'),'onDelete':_0xd9ff('0x161')});db[_0xd9ff('0x69')][_0xd9ff('0x13c')](db[_0xd9ff('0x182')],{'as':_0xd9ff('0x183'),'foreignKey':'CompanyId'});db[_0xd9ff('0x69')][_0xd9ff('0x13c')](db[_0xd9ff('0xeb')],{'as':_0xd9ff('0x163'),'foreignKey':_0xd9ff('0x153'),'onDelete':'cascade'});db[_0xd9ff('0x69')]['belongsToMany'](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x15d'),'through':_0xd9ff('0x116')});db[_0xd9ff('0x69')]['belongsToMany'](db[_0xd9ff('0x82')],{'as':'Tags','through':'cm_contact_has_tags'});db[_0xd9ff('0x69')]['belongsToMany'](db['Tag'],{'through':_0xd9ff('0x184'),'as':_0xd9ff('0x16a')});db['CmHopper']['belongsTo'](db['CmContact'],{'as':_0xd9ff('0x14b'),'foreignKey':_0xd9ff('0x14c'),'onDelete':_0xd9ff('0x100')});db[_0xd9ff('0x136')][_0xd9ff('0x13c')](db[_0xd9ff('0xeb')],{'as':'List','foreignKey':_0xd9ff('0x153'),'onDelete':'cascade'});db[_0xd9ff('0x136')][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x17a'),'foreignKey':_0xd9ff('0x101')});db['CmHopper'][_0xd9ff('0x13c')](db[_0xd9ff('0x11f')],{'as':_0xd9ff('0x185'),'foreignKey':_0xd9ff('0x138'),'onDelete':_0xd9ff('0x100')});db['CmHopper'][_0xd9ff('0x13c')](db[_0xd9ff('0xe0')],{'as':'Campaign','foreignKey':_0xd9ff('0x186'),'onDelete':_0xd9ff('0x100')});db[_0xd9ff('0x136')][_0xd9ff('0x13c')](db['User'],{'as':_0xd9ff('0x15a'),'foreignKey':_0xd9ff('0x187')});db['CmHopperBlack']['belongsTo'](db[_0xd9ff('0x69')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0xd9ff('0x100')});db['CmHopperBlack'][_0xd9ff('0x13c')](db['CmList'],{'as':_0xd9ff('0x163'),'foreignKey':_0xd9ff('0x153'),'onDelete':_0xd9ff('0x100')});db[_0xd9ff('0x6b')][_0xd9ff('0x13c')](db['VoiceQueue'],{'as':_0xd9ff('0x185'),'foreignKey':_0xd9ff('0x138'),'onDelete':_0xd9ff('0x100')});db[_0xd9ff('0x6b')][_0xd9ff('0x13c')](db[_0xd9ff('0xe0')],{'as':_0xd9ff('0xe0'),'foreignKey':_0xd9ff('0x186'),'onDelete':_0xd9ff('0x100')});db[_0xd9ff('0x188')][_0xd9ff('0x103')](db[_0xd9ff('0x189')],{'as':{'plural':_0xd9ff('0x18a'),'singular':_0xd9ff('0x18b')},'foreignKey':_0xd9ff('0x18c'),'onDelete':_0xd9ff('0x100'),'hooks':!![]});db[_0xd9ff('0x188')][_0xd9ff('0x103')](db[_0xd9ff('0x189')],{'as':{'plural':_0xd9ff('0x18d'),'singular':_0xd9ff('0x18e')},'foreignKey':_0xd9ff('0x18f'),'onDelete':_0xd9ff('0x100'),'hooks':!![]});db[_0xd9ff('0x188')][_0xd9ff('0x103')](db[_0xd9ff('0x72')],{'as':'Actions','foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0xd9ff('0x77')]['hasMany'](db[_0xd9ff('0x77')],{'as':_0xd9ff('0x151'),'foreignKey':_0xd9ff('0x190'),'onDelete':_0xd9ff('0x100')});db['Interval'][_0xd9ff('0x103')](db[_0xd9ff('0x79')],{'as':'Intervals','foreignKey':_0xd9ff('0x13e'),'onDelete':_0xd9ff('0x100'),'hooks':!![],'required':![]});db[_0xd9ff('0x79')][_0xd9ff('0x103')](db[_0xd9ff('0x17')],{'as':_0xd9ff('0x107'),'foreignKey':_0xd9ff('0x13e'),'onDelete':'restrict'});db[_0xd9ff('0x79')][_0xd9ff('0x103')](db['MailApplication'],{'as':_0xd9ff('0x191'),'foreignKey':'IntervalId'});db[_0xd9ff('0x79')][_0xd9ff('0x103')](db[_0xd9ff('0x5d')],{'as':_0xd9ff('0x192'),'foreignKey':_0xd9ff('0x13e')});db[_0xd9ff('0x79')][_0xd9ff('0x103')](db[_0xd9ff('0x167')],{'as':_0xd9ff('0x193'),'foreignKey':'IntervalId'});db[_0xd9ff('0x79')]['hasMany'](db['SmsApplication'],{'as':_0xd9ff('0x194'),'foreignKey':_0xd9ff('0x13e')});db[_0xd9ff('0x195')][_0xd9ff('0x13c')](db[_0xd9ff('0x37')],{});db[_0xd9ff('0x195')][_0xd9ff('0x13c')](db[_0xd9ff('0x8d')],{'foreignKey':_0xd9ff('0x196')});db['Schedule'][_0xd9ff('0x13c')](db[_0xd9ff('0x8b')],{'foreignKey':_0xd9ff('0x197')});db[_0xd9ff('0x80')][_0xd9ff('0x114')](db[_0xd9ff('0x19')],{'as':_0xd9ff('0x198'),'through':_0xd9ff('0x134'),'onDelete':_0xd9ff('0x161')});db['Tag'][_0xd9ff('0x114')](db[_0xd9ff('0x69')],{'through':_0xd9ff('0x184')});db[_0xd9ff('0x82')][_0xd9ff('0x114')](db[_0xd9ff('0x5e')],{'through':_0xd9ff('0x17e')});db[_0xd9ff('0x82')][_0xd9ff('0x114')](db[_0xd9ff('0x10f')],{'through':'mail_interaction_has_tags'});db[_0xd9ff('0x82')][_0xd9ff('0x114')](db[_0xd9ff('0x4e')],{'through':'sms_interaction_has_tags'});db['Tag'][_0xd9ff('0x114')](db[_0xd9ff('0x47')],{'through':_0xd9ff('0x169')});db[_0xd9ff('0x82')][_0xd9ff('0x114')](db['OpenchannelInteraction'],{'through':_0xd9ff('0x177')});db['Tag'][_0xd9ff('0x114')](db[_0xd9ff('0xf3')],{'through':_0xd9ff('0x199')});db[_0xd9ff('0x85')][_0xd9ff('0x103')](db[_0xd9ff('0x189')],{'as':{'plural':_0xd9ff('0x19a'),'singular':_0xd9ff('0x19b')},'foreignKey':_0xd9ff('0x19c'),'onDelete':'cascade','hooks':!![]});db[_0xd9ff('0x85')][_0xd9ff('0x103')](db['Condition'],{'as':{'plural':_0xd9ff('0x19d'),'singular':_0xd9ff('0x19e')},'foreignKey':'TriggerAnyId','onDelete':_0xd9ff('0x100'),'hooks':!![]});db['Trigger']['hasMany'](db[_0xd9ff('0x72')],{'as':_0xd9ff('0x19f'),'foreignKey':'TriggerId','onDelete':_0xd9ff('0x100'),'hooks':!![]});db[_0xd9ff('0x8b')][_0xd9ff('0x103')](db['AnalyticFieldReport'],{'as':_0xd9ff('0x1a0'),'onDelete':'cascade','foreignKey':_0xd9ff('0x197'),'hooks':!![]});db[_0xd9ff('0x8d')]['hasMany'](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x196')});db[_0xd9ff('0x91')]['hasMany'](db[_0xd9ff('0x93')],{'as':'Fields','onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a1')});db['AnalyticFieldReport'][_0xd9ff('0x13c')](db[_0xd9ff('0x91')],{'foreignKey':_0xd9ff('0x1a1')});db['SalesforceAccount'][_0xd9ff('0x103')](db[_0xd9ff('0x96')],{'as':_0xd9ff('0x1a2'),'onDelete':_0xd9ff('0x100'),'foreignKey':'AccountId'});db[_0xd9ff('0x96')][_0xd9ff('0x103')](db['SalesforceField'],{'as':_0xd9ff('0x1a3'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0x96')]['hasMany'](db[_0xd9ff('0x97')],{'as':'Descriptions','onDelete':_0xd9ff('0x100'),'foreignKey':'DescriptionId'});db[_0xd9ff('0x96')]['hasMany'](db[_0xd9ff('0x97')],{'as':_0xd9ff('0x1a0'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a5')});db[_0xd9ff('0x96')][_0xd9ff('0x13c')](db[_0xd9ff('0x95')],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x1a6')});db['SalesforceField'][_0xd9ff('0x103')](db[_0xd9ff('0x97')],{'as':_0xd9ff('0x1a7'),'foreignKey':_0xd9ff('0x1a4')});db['SalesforceField'][_0xd9ff('0x103')](db[_0xd9ff('0x97')],{'as':'Description','foreignKey':_0xd9ff('0x1a8')});db['SalesforceField'][_0xd9ff('0x103')](db[_0xd9ff('0x97')],{'as':_0xd9ff('0x1a9'),'foreignKey':_0xd9ff('0x1a5')});db['SalesforceField']['belongsTo'](db[_0xd9ff('0x87')],{'as':'Variable','foreignKey':_0xd9ff('0x1aa')});db[_0xd9ff('0x99')][_0xd9ff('0x103')](db['SugarcrmConfiguration'],{'as':_0xd9ff('0x1a2'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a6')});db[_0xd9ff('0x9b')][_0xd9ff('0x103')](db[_0xd9ff('0x9d')],{'as':_0xd9ff('0x1a3'),'onDelete':'cascade','foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0x9b')]['hasMany'](db[_0xd9ff('0x9d')],{'as':'Descriptions','onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a8')});db[_0xd9ff('0x9b')][_0xd9ff('0x103')](db[_0xd9ff('0x9d')],{'as':_0xd9ff('0x1a0'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a5')});db['SugarcrmConfiguration'][_0xd9ff('0x13c')](db['SugarcrmAccount'],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x1a6')});db[_0xd9ff('0x9d')]['hasMany'](db['SugarcrmField'],{'as':_0xd9ff('0x1a7'),'foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0x9d')][_0xd9ff('0x103')](db[_0xd9ff('0x9d')],{'as':_0xd9ff('0x1ab'),'foreignKey':_0xd9ff('0x1a8')});db['SugarcrmField'][_0xd9ff('0x103')](db[_0xd9ff('0x9d')],{'as':_0xd9ff('0x1a9'),'foreignKey':_0xd9ff('0x1a5')});db[_0xd9ff('0x9d')]['belongsTo'](db[_0xd9ff('0x87')],{'as':_0xd9ff('0x87'),'foreignKey':_0xd9ff('0x1aa')});db[_0xd9ff('0x9f')]['hasMany'](db[_0xd9ff('0xa1')],{'as':_0xd9ff('0x1a2'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a6')});db['DeskConfiguration'][_0xd9ff('0x103')](db[_0xd9ff('0xa3')],{'as':'Subjects','onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0xa1')]['hasMany'](db[_0xd9ff('0xa3')],{'as':'Descriptions','onDelete':_0xd9ff('0x100'),'foreignKey':'DescriptionId'});db['DeskConfiguration'][_0xd9ff('0x103')](db[_0xd9ff('0xa3')],{'as':'Fields','onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a5')});db[_0xd9ff('0xa1')][_0xd9ff('0x13c')](db['DeskAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0xd9ff('0xa1')][_0xd9ff('0x114')](db['Tag'],{'through':_0xd9ff('0x1ac')});db[_0xd9ff('0xa3')][_0xd9ff('0x103')](db[_0xd9ff('0xa3')],{'as':_0xd9ff('0x1a7'),'foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0xa3')][_0xd9ff('0x103')](db['DeskField'],{'as':_0xd9ff('0x1ab'),'foreignKey':_0xd9ff('0x1a8')});db[_0xd9ff('0xa3')][_0xd9ff('0x103')](db['DeskField'],{'as':_0xd9ff('0x1a9'),'foreignKey':_0xd9ff('0x1a5')});db[_0xd9ff('0xa3')][_0xd9ff('0x13c')](db[_0xd9ff('0x87')],{'as':_0xd9ff('0x87'),'foreignKey':_0xd9ff('0x1aa')});db[_0xd9ff('0xa5')][_0xd9ff('0x103')](db[_0xd9ff('0x1ad')],{'as':_0xd9ff('0x1a2'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xd9ff('0x1ad')][_0xd9ff('0x103')](db[_0xd9ff('0xa8')],{'as':_0xd9ff('0x1a3'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0xd9ff('0x1ad')][_0xd9ff('0x103')](db[_0xd9ff('0xa8')],{'as':_0xd9ff('0x1ae'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a8')});db[_0xd9ff('0x1ad')][_0xd9ff('0x103')](db['ZohoField'],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0xd9ff('0x1ad')]['belongsTo'](db[_0xd9ff('0xa5')],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x1a6')});db['ZohoField']['hasMany'](db['ZohoField'],{'as':_0xd9ff('0x1a7'),'foreignKey':_0xd9ff('0x1a4')});db['ZohoField'][_0xd9ff('0x103')](db[_0xd9ff('0xa8')],{'as':_0xd9ff('0x1ab'),'foreignKey':_0xd9ff('0x1a8')});db[_0xd9ff('0xa8')][_0xd9ff('0x103')](db['ZohoField'],{'as':_0xd9ff('0x1a9'),'foreignKey':_0xd9ff('0x1a5')});db[_0xd9ff('0xa8')][_0xd9ff('0x13c')](db[_0xd9ff('0x87')],{'as':_0xd9ff('0x87'),'foreignKey':_0xd9ff('0x1aa')});db[_0xd9ff('0xaa')][_0xd9ff('0x103')](db[_0xd9ff('0xab')],{'as':_0xd9ff('0x1a2'),'onDelete':'cascade','foreignKey':_0xd9ff('0x1a6')});db[_0xd9ff('0xab')][_0xd9ff('0x103')](db[_0xd9ff('0xad')],{'as':'Subjects','foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0xab')][_0xd9ff('0x103')](db[_0xd9ff('0xad')],{'as':'Descriptions','foreignKey':_0xd9ff('0x1a8')});db[_0xd9ff('0xab')][_0xd9ff('0x103')](db['ZendeskField'],{'as':_0xd9ff('0x1a0'),'foreignKey':'FieldId'});db['ZendeskConfiguration']['belongsTo'](db[_0xd9ff('0xaa')],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x1a6')});db['ZendeskConfiguration'][_0xd9ff('0x114')](db[_0xd9ff('0x82')],{'through':_0xd9ff('0x1af')});db[_0xd9ff('0xad')]['hasMany'](db[_0xd9ff('0xad')],{'as':'Subject','foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0xad')]['hasMany'](db[_0xd9ff('0xad')],{'as':_0xd9ff('0x1ab'),'foreignKey':_0xd9ff('0x1a8')});db[_0xd9ff('0xad')][_0xd9ff('0x103')](db[_0xd9ff('0xad')],{'as':'Field','foreignKey':_0xd9ff('0x1a5')});db[_0xd9ff('0xad')][_0xd9ff('0x13c')](db[_0xd9ff('0x87')],{'as':_0xd9ff('0x87'),'foreignKey':_0xd9ff('0x1aa')});db[_0xd9ff('0xaf')][_0xd9ff('0x103')](db['FreshdeskConfiguration'],{'as':_0xd9ff('0x1a2'),'onDelete':'cascade','foreignKey':_0xd9ff('0x1a6')});db[_0xd9ff('0xb1')][_0xd9ff('0x103')](db[_0xd9ff('0xb3')],{'as':_0xd9ff('0x1a3'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0xb1')][_0xd9ff('0x103')](db[_0xd9ff('0xb3')],{'as':_0xd9ff('0x1ae'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['FreshdeskConfiguration'][_0xd9ff('0x103')](db[_0xd9ff('0xb3')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xd9ff('0x1a5')});db[_0xd9ff('0xb1')][_0xd9ff('0x13c')](db[_0xd9ff('0xaf')],{'as':'Account','foreignKey':_0xd9ff('0x1a6')});db[_0xd9ff('0xb1')][_0xd9ff('0x114')](db['Tag'],{'through':_0xd9ff('0x1b0')});db['FreshdeskField'][_0xd9ff('0x103')](db['FreshdeskField'],{'as':_0xd9ff('0x1a7'),'foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0xb3')][_0xd9ff('0x103')](db[_0xd9ff('0xb3')],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField']['hasMany'](db[_0xd9ff('0xb3')],{'as':_0xd9ff('0x1a9'),'foreignKey':'FieldId'});db['FreshdeskField'][_0xd9ff('0x13c')](db[_0xd9ff('0x87')],{'as':_0xd9ff('0x87'),'foreignKey':'VariableId'});db[_0xd9ff('0xb5')]['hasMany'](db[_0xd9ff('0xb7')],{'as':_0xd9ff('0x1a2'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a6')});db['VtigerConfiguration'][_0xd9ff('0x103')](db[_0xd9ff('0xb9')],{'as':_0xd9ff('0x1a3'),'foreignKey':'SubjectId'});db[_0xd9ff('0xb7')]['hasMany'](db['VtigerField'],{'as':'Descriptions','foreignKey':'DescriptionId'});db['VtigerConfiguration'][_0xd9ff('0x103')](db[_0xd9ff('0xb9')],{'as':_0xd9ff('0x1a0'),'foreignKey':'FieldId'});db[_0xd9ff('0xb7')][_0xd9ff('0x13c')](db['VtigerAccount'],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x1a6')});db[_0xd9ff('0xb9')]['hasMany'](db[_0xd9ff('0xb9')],{'as':_0xd9ff('0x1a7'),'foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0xb9')]['hasMany'](db['VtigerField'],{'as':_0xd9ff('0x1ab'),'foreignKey':_0xd9ff('0x1a8')});db['VtigerField']['hasMany'](db[_0xd9ff('0xb9')],{'as':_0xd9ff('0x1a9'),'foreignKey':_0xd9ff('0x1a5')});db[_0xd9ff('0xb9')][_0xd9ff('0x13c')](db[_0xd9ff('0x87')],{'as':_0xd9ff('0x87'),'foreignKey':_0xd9ff('0x1aa')});db[_0xd9ff('0xba')][_0xd9ff('0x103')](db[_0xd9ff('0xbc')],{'as':_0xd9ff('0x1a2'),'onDelete':'cascade','foreignKey':_0xd9ff('0x1a6')});db['ServicenowConfiguration'][_0xd9ff('0x103')](db[_0xd9ff('0xbe')],{'as':_0xd9ff('0x1a3'),'foreignKey':'SubjectId'});db[_0xd9ff('0xbc')][_0xd9ff('0x103')](db[_0xd9ff('0xbe')],{'as':'Descriptions','foreignKey':_0xd9ff('0x1a8')});db[_0xd9ff('0xbc')][_0xd9ff('0x103')](db[_0xd9ff('0xbe')],{'as':'Fields','foreignKey':_0xd9ff('0x1a5')});db[_0xd9ff('0xbc')][_0xd9ff('0x13c')](db[_0xd9ff('0xba')],{'as':_0xd9ff('0x159'),'foreignKey':'AccountId'});db['ServicenowField'][_0xd9ff('0x103')](db[_0xd9ff('0xbe')],{'as':'Subject','foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0xbe')][_0xd9ff('0x103')](db[_0xd9ff('0xbe')],{'as':_0xd9ff('0x1ab'),'foreignKey':'DescriptionId'});db[_0xd9ff('0xbe')][_0xd9ff('0x103')](db[_0xd9ff('0xbe')],{'as':_0xd9ff('0x1a9'),'foreignKey':_0xd9ff('0x1a5')});db[_0xd9ff('0xbe')][_0xd9ff('0x13c')](db[_0xd9ff('0x87')],{'as':'Variable','foreignKey':_0xd9ff('0x1aa')});db[_0xd9ff('0xbf')]['hasMany'](db[_0xd9ff('0xc1')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xd9ff('0x1a6')});db[_0xd9ff('0xc1')][_0xd9ff('0x103')](db[_0xd9ff('0xc3')],{'as':_0xd9ff('0x1a3'),'onDelete':_0xd9ff('0x100'),'foreignKey':'SubjectId'});db['Dynamics365Configuration'][_0xd9ff('0x103')](db[_0xd9ff('0xc3')],{'as':'Descriptions','onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a8')});db['Dynamics365Configuration'][_0xd9ff('0x103')](db[_0xd9ff('0xc3')],{'as':_0xd9ff('0x1a0'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1a5')});db['Dynamics365Configuration'][_0xd9ff('0x13c')](db['Dynamics365Account'],{'as':'Account','foreignKey':_0xd9ff('0x1a6')});db[_0xd9ff('0xc3')][_0xd9ff('0x103')](db[_0xd9ff('0xc3')],{'as':'Subject','foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0xc3')][_0xd9ff('0x103')](db[_0xd9ff('0xc3')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xd9ff('0xc3')][_0xd9ff('0x103')](db[_0xd9ff('0xc3')],{'as':_0xd9ff('0x1a9'),'foreignKey':_0xd9ff('0x1a5')});db['Dynamics365Field']['belongsTo'](db[_0xd9ff('0x87')],{'as':_0xd9ff('0x87'),'foreignKey':_0xd9ff('0x1aa')});db[_0xd9ff('0x1b1')][_0xd9ff('0x103')](db[_0xd9ff('0xc5')],{'as':_0xd9ff('0x1a2'),'onDelete':_0xd9ff('0x100'),'foreignKey':'AccountId'});db[_0xd9ff('0xc5')]['hasMany'](db['FreshsalesField'],{'as':_0xd9ff('0x1a3'),'foreignKey':_0xd9ff('0x1a4')});db[_0xd9ff('0xc5')][_0xd9ff('0x103')](db['FreshsalesField'],{'as':_0xd9ff('0x1ae'),'foreignKey':'DescriptionId'});db[_0xd9ff('0xc5')][_0xd9ff('0x103')](db['FreshsalesField'],{'as':_0xd9ff('0x1a0'),'foreignKey':_0xd9ff('0x1a5')});db[_0xd9ff('0xc5')][_0xd9ff('0x13c')](db[_0xd9ff('0x1b1')],{'as':_0xd9ff('0x159'),'foreignKey':_0xd9ff('0x1a6')});db[_0xd9ff('0x1b2')]['hasMany'](db[_0xd9ff('0x1b2')],{'as':_0xd9ff('0x1a7'),'foreignKey':'SubjectId'});db[_0xd9ff('0x1b2')][_0xd9ff('0x103')](db[_0xd9ff('0x1b2')],{'as':_0xd9ff('0x1ab'),'foreignKey':_0xd9ff('0x1a8')});db['FreshsalesField'][_0xd9ff('0x103')](db[_0xd9ff('0x1b2')],{'as':_0xd9ff('0x1a9'),'foreignKey':_0xd9ff('0x1a5')});db['FreshsalesField'][_0xd9ff('0x13c')](db[_0xd9ff('0x87')],{'as':_0xd9ff('0x87'),'foreignKey':'VariableId'});db[_0xd9ff('0xc9')][_0xd9ff('0x13c')](db['ChatWebsite'],{});db['ChatQueueReport']['belongsTo'](db['CmList'],{'as':_0xd9ff('0x163'),'foreignKey':_0xd9ff('0x153')});db[_0xd9ff('0xc9')][_0xd9ff('0x13c')](db['CmContact'],{'as':_0xd9ff('0x14b'),'foreignKey':_0xd9ff('0x14c')});db['ChatQueueReport'][_0xd9ff('0x13c')](db['ChatInteraction'],{});db['ChatQueueReport'][_0xd9ff('0x13c')](db['ChatMessage'],{});db['ChatQueueReport'][_0xd9ff('0x13c')](db['User'],{});db[_0xd9ff('0xc9')][_0xd9ff('0x13c')](db[_0xd9ff('0x62')],{});db[_0xd9ff('0xcb')][_0xd9ff('0x13c')](db['User'],{'onDelete':'cascade','foreignKey':_0xd9ff('0x1b3')});db['ChatInternalMessage'][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1b4')});db[_0xd9ff('0xd1')][_0xd9ff('0x103')](db[_0xd9ff('0xcf')],{'foreignKey':'SessionId','onDelete':_0xd9ff('0x100')});db['JscriptySessionReport']['hasMany'](db[_0xd9ff('0xcd')],{'foreignKey':_0xd9ff('0x1b5'),'onDelete':_0xd9ff('0x100')});db['SmsQueueReport'][_0xd9ff('0x13c')](db['SmsAccount'],{});db['SmsQueueReport'][_0xd9ff('0x13c')](db[_0xd9ff('0xeb')],{'as':'List','foreignKey':_0xd9ff('0x153')});db[_0xd9ff('0xd2')][_0xd9ff('0x13c')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0xd9ff('0xd2')]['belongsTo'](db[_0xd9ff('0x4e')],{});db[_0xd9ff('0xd2')]['belongsTo'](db[_0xd9ff('0x16f')],{});db['SmsQueueReport'][_0xd9ff('0x13c')](db['User'],{});db[_0xd9ff('0xd2')][_0xd9ff('0x13c')](db[_0xd9ff('0x123')],{});db[_0xd9ff('0xd7')][_0xd9ff('0x103')](db[_0xd9ff('0xd1')],{'foreignKey':_0xd9ff('0x1b6')});db[_0xd9ff('0xd7')][_0xd9ff('0x103')](db[_0xd9ff('0xcf')],{'foreignKey':_0xd9ff('0x1b6')});db[_0xd9ff('0xd7')][_0xd9ff('0x103')](db[_0xd9ff('0xcd')],{'foreignKey':'ProjectId'});db['SquareProject']['belongsToMany'](db['User'],{'as':_0xd9ff('0x15d'),'through':_0xd9ff('0x1b7')});db[_0xd9ff('0xdf')][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':'Agents','through':_0xd9ff('0x119')});db[_0xd9ff('0xdf')][_0xd9ff('0x114')](db[_0xd9ff('0x11f')],{'through':_0xd9ff('0xfb'),'as':_0xd9ff('0x120')});db[_0xd9ff('0xdf')][_0xd9ff('0x114')](db['MailQueue'],{'through':'team_has_mail_queues','as':_0xd9ff('0x1b8')});db['Team'][_0xd9ff('0x114')](db[_0xd9ff('0x62')],{'through':'team_has_chat_queues','as':_0xd9ff('0x1b9')});db[_0xd9ff('0xdf')][_0xd9ff('0x114')](db[_0xd9ff('0x4a')],{'through':_0xd9ff('0x16c'),'as':_0xd9ff('0x122')});db[_0xd9ff('0xdf')][_0xd9ff('0x114')](db[_0xd9ff('0x123')],{'through':_0xd9ff('0x1ba'),'as':_0xd9ff('0x1bb')});db['Team']['belongsToMany'](db['OpenchannelQueue'],{'through':_0xd9ff('0x178'),'as':'OpenchannelQueues'});db['Team']['belongsToMany'](db['WhatsappQueue'],{'through':_0xd9ff('0x1bc'),'as':_0xd9ff('0x125')});db[_0xd9ff('0xdf')][_0xd9ff('0x114')](db[_0xd9ff('0x1bd')],{'through':_0xd9ff('0x1be'),'as':_0xd9ff('0x121')});db['Campaign'][_0xd9ff('0x103')](db[_0xd9ff('0x136')],{'as':_0xd9ff('0x137'),'foreignKey':'CampaignId'});db['Campaign'][_0xd9ff('0x103')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xd9ff('0x186')});db[_0xd9ff('0xe0')]['hasMany'](db['CmHopperHistory'],{'as':_0xd9ff('0x139'),'foreignKey':_0xd9ff('0x186')});db[_0xd9ff('0xe0')][_0xd9ff('0x103')](db[_0xd9ff('0x6b')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0xd9ff('0xe0')]['belongsTo'](db[_0xd9ff('0x25')],{'as':_0xd9ff('0x25'),'foreignKey':_0xd9ff('0x13d')});db['Campaign'][_0xd9ff('0x13c')](db[_0xd9ff('0x25')],{'as':_0xd9ff('0x1bf'),'foreignKey':_0xd9ff('0x1c0')});db[_0xd9ff('0xe0')][_0xd9ff('0x13c')](db[_0xd9ff('0x79')],{'as':'Interval','foreignKey':_0xd9ff('0x13e')});db[_0xd9ff('0xe0')][_0xd9ff('0x13c')](db['SquareProject'],{'as':_0xd9ff('0xdb'),'foreignKey':'SquareProjectId'});db[_0xd9ff('0xe0')][_0xd9ff('0x114')](db[_0xd9ff('0xeb')],{'as':_0xd9ff('0x117'),'through':_0xd9ff('0x1c1')});db[_0xd9ff('0xe0')][_0xd9ff('0x114')](db[_0xd9ff('0xeb')],{'as':_0xd9ff('0x1c2'),'through':_0xd9ff('0x1c3')});db[_0xd9ff('0xe1')][_0xd9ff('0x13c')](db[_0xd9ff('0x60')],{'as':_0xd9ff('0x60'),'foreignKey':_0xd9ff('0x160')});db['MailTransferReport']['belongsTo'](db[_0xd9ff('0x3d')],{});db[_0xd9ff('0x1c4')][_0xd9ff('0x13c')](db[_0xd9ff('0x10f')],{});db[_0xd9ff('0x1c4')][_0xd9ff('0x13c')](db[_0xd9ff('0x37')],{'foreignKey':_0xd9ff('0x1c5'),'as':_0xd9ff('0x1c6')});db['MailTransferReport']['belongsTo'](db['User'],{'foreignKey':_0xd9ff('0x1c7'),'as':_0xd9ff('0x1c8')});db[_0xd9ff('0x1c4')]['belongsTo'](db[_0xd9ff('0x102')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xd9ff('0x1c4')][_0xd9ff('0x13c')](db[_0xd9ff('0x39')],{'foreignKey':'ToMailQueueId','as':_0xd9ff('0x1c9')});db[_0xd9ff('0x1c4')][_0xd9ff('0x13c')](db[_0xd9ff('0x37')],{'foreignKey':_0xd9ff('0x1ca'),'as':'ToAccount'});db[_0xd9ff('0x1cb')][_0xd9ff('0x13c')](db[_0xd9ff('0x5f')],{});db['ChatTransferReport'][_0xd9ff('0x13c')](db[_0xd9ff('0x5e')],{});db[_0xd9ff('0x1cb')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0xd9ff('0x1cc'),'as':_0xd9ff('0x1c6')});db[_0xd9ff('0x1cb')]['belongsTo'](db[_0xd9ff('0x102')],{'foreignKey':_0xd9ff('0x1c7'),'as':_0xd9ff('0x1c8')});db[_0xd9ff('0x1cb')]['belongsTo'](db[_0xd9ff('0x102')],{'foreignKey':_0xd9ff('0x1cd'),'as':_0xd9ff('0x1ce')});db[_0xd9ff('0x1cb')][_0xd9ff('0x13c')](db['ChatQueue'],{'foreignKey':_0xd9ff('0x1cf'),'as':_0xd9ff('0x1c9')});db[_0xd9ff('0x1cb')][_0xd9ff('0x13c')](db[_0xd9ff('0x5a')],{'foreignKey':'ToChatWebsiteId','as':_0xd9ff('0x1d0')});db[_0xd9ff('0xe6')][_0xd9ff('0x13c')](db['FaxMessage'],{});db[_0xd9ff('0xe6')][_0xd9ff('0x13c')](db['FaxInteraction'],{});db[_0xd9ff('0xe6')][_0xd9ff('0x13c')](db[_0xd9ff('0x45')],{'foreignKey':_0xd9ff('0x1d1'),'as':'FromAccount'});db[_0xd9ff('0xe6')]['belongsTo'](db[_0xd9ff('0x102')],{'foreignKey':'FromUserId','as':_0xd9ff('0x1c8')});db[_0xd9ff('0xe6')][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{'foreignKey':'ToUserId','as':_0xd9ff('0x1ce')});db[_0xd9ff('0xe6')][_0xd9ff('0x13c')](db[_0xd9ff('0x4a')],{'foreignKey':_0xd9ff('0x1d2'),'as':_0xd9ff('0x1c9')});db[_0xd9ff('0xe6')][_0xd9ff('0x13c')](db[_0xd9ff('0x45')],{'foreignKey':_0xd9ff('0x1d3'),'as':'ToAccount'});db[_0xd9ff('0xe8')][_0xd9ff('0x13c')](db['OpenchannelMessage'],{});db[_0xd9ff('0xe8')][_0xd9ff('0x13c')](db[_0xd9ff('0x10a')],{});db['OpenchannelTransferReport'][_0xd9ff('0x13c')](db[_0xd9ff('0x52')],{'foreignKey':_0xd9ff('0x1d4'),'as':_0xd9ff('0x1c6')});db[_0xd9ff('0xe8')][_0xd9ff('0x13c')](db['User'],{'foreignKey':'FromUserId','as':_0xd9ff('0x1c8')});db[_0xd9ff('0xe8')][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{'foreignKey':_0xd9ff('0x1cd'),'as':_0xd9ff('0x1ce')});db[_0xd9ff('0xe8')]['belongsTo'](db[_0xd9ff('0x58')],{'foreignKey':_0xd9ff('0x1d5'),'as':_0xd9ff('0x1c9')});db[_0xd9ff('0xe8')][_0xd9ff('0x13c')](db[_0xd9ff('0x52')],{'foreignKey':_0xd9ff('0x1d6'),'as':_0xd9ff('0x1d0')});db[_0xd9ff('0x1d7')]['belongsTo'](db[_0xd9ff('0x16f')],{});db[_0xd9ff('0x1d7')]['belongsTo'](db[_0xd9ff('0x4e')],{});db[_0xd9ff('0x1d7')][_0xd9ff('0x13c')](db[_0xd9ff('0x12e')],{'foreignKey':'FromSmsAccountId','as':_0xd9ff('0x1c6')});db[_0xd9ff('0x1d7')][_0xd9ff('0x13c')](db['User'],{'foreignKey':_0xd9ff('0x1c7'),'as':_0xd9ff('0x1c8')});db[_0xd9ff('0x1d7')]['belongsTo'](db[_0xd9ff('0x102')],{'foreignKey':'ToUserId','as':_0xd9ff('0x1ce')});db['SmsTransferReport'][_0xd9ff('0x13c')](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0xd9ff('0x1c9')});db[_0xd9ff('0x1d7')][_0xd9ff('0x13c')](db[_0xd9ff('0x12e')],{'foreignKey':_0xd9ff('0x1d8'),'as':_0xd9ff('0x1d0')});db[_0xd9ff('0xeb')][_0xd9ff('0x103')](db[_0xd9ff('0x77')],{'as':_0xd9ff('0x151'),'foreignKey':'ListId','onDelete':'cascade'});db[_0xd9ff('0xeb')]['hasMany'](db[_0xd9ff('0x1d9')],{'as':_0xd9ff('0x1da'),'foreignKey':'ListId'});db[_0xd9ff('0xeb')]['hasMany'](db[_0xd9ff('0x69')],{'as':_0xd9ff('0x115'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x153')});db[_0xd9ff('0xeb')][_0xd9ff('0x103')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xd9ff('0x153')});db['CmList'][_0xd9ff('0x103')](db[_0xd9ff('0x6e')],{'as':_0xd9ff('0x109'),'foreignKey':'ListId'});db[_0xd9ff('0xeb')][_0xd9ff('0x103')](db[_0xd9ff('0x70')],{'as':'ReportAgentPreview','foreignKey':_0xd9ff('0x153')});db[_0xd9ff('0xeb')][_0xd9ff('0x114')](db[_0xd9ff('0x11f')],{'as':_0xd9ff('0x1db'),'through':'voice_queues_has_cm_lists'});db[_0xd9ff('0xeb')][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x13f'),'through':'cm_user_has_lists'});db[_0xd9ff('0x1bd')][_0xd9ff('0x103')](db[_0xd9ff('0x17')],{'as':_0xd9ff('0x107'),'onDelete':_0xd9ff('0x100')});db[_0xd9ff('0x1bd')][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x13f'),'through':_0xd9ff('0x1dc')});db[_0xd9ff('0x1bd')][_0xd9ff('0x114')](db[_0xd9ff('0xdf')],{'through':_0xd9ff('0x1be'),'as':_0xd9ff('0x140')});db[_0xd9ff('0xed')][_0xd9ff('0x103')](db['User'],{'as':'Users','foreignKey':_0xd9ff('0x1dd')});db[_0xd9ff('0xed')][_0xd9ff('0x103')](db[_0xd9ff('0x1de')],{'as':_0xd9ff('0x1df'),'foreignKey':'userProfileId','onDelete':_0xd9ff('0x100')});db[_0xd9ff('0x1de')][_0xd9ff('0x103')](db[_0xd9ff('0x1e0')],{'as':'Resources','foreignKey':_0xd9ff('0x1e1'),'onDelete':_0xd9ff('0x100')});db[_0xd9ff('0xf1')][_0xd9ff('0x103')](db[_0xd9ff('0x77')],{'as':_0xd9ff('0x151'),'foreignKey':_0xd9ff('0x1e2'),'onDelete':_0xd9ff('0x100')});db[_0xd9ff('0xf1')][_0xd9ff('0x103')](db[_0xd9ff('0x75')],{'as':_0xd9ff('0x152'),'foreignKey':_0xd9ff('0x1e2')});db[_0xd9ff('0xf1')][_0xd9ff('0x103')](db['WhatsappMessage'],{'as':_0xd9ff('0x144'),'foreignKey':_0xd9ff('0x1e2')});db[_0xd9ff('0xf1')]['hasMany'](db[_0xd9ff('0xf3')],{'as':'Interactions'});db['WhatsappAccount'][_0xd9ff('0x103')](db[_0xd9ff('0x1e3')],{'as':_0xd9ff('0x132')});db[_0xd9ff('0xf1')]['belongsTo'](db[_0xd9ff('0xeb')],{'as':_0xd9ff('0x163'),'foreignKey':_0xd9ff('0x153')});db['WhatsappAccount'][_0xd9ff('0x13c')](db[_0xd9ff('0x7b')],{'as':'mandatoryDispositionPause','foreignKey':_0xd9ff('0x156')});db[_0xd9ff('0xf1')]['belongsToMany'](db[_0xd9ff('0x102')],{'as':'Agents','through':_0xd9ff('0x1e4')});db[_0xd9ff('0x1e3')]['belongsTo'](db['User'],{'onDelete':_0xd9ff('0x161')});db[_0xd9ff('0x1e3')][_0xd9ff('0x13c')](db['WhatsappQueue'],{'onDelete':'restrict'});db[_0xd9ff('0x1e3')][_0xd9ff('0x13c')](db['WhatsappAccount'],{'onDelete':_0xd9ff('0x161')});db['WhatsappApplication'][_0xd9ff('0x13c')](db['Interval'],{'onDelete':_0xd9ff('0x161'),'foreignKey':_0xd9ff('0x13e')});db[_0xd9ff('0x1e3')][_0xd9ff('0x13c')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xd9ff('0x162')});db[_0xd9ff('0xf3')][_0xd9ff('0x103')](db[_0xd9ff('0x1e5')],{'as':_0xd9ff('0x144'),'onDelete':_0xd9ff('0x100'),'foreignKey':_0xd9ff('0x1e6')});db[_0xd9ff('0xf3')][_0xd9ff('0x13c')](db[_0xd9ff('0xf1')],{'as':'Account','foreignKey':_0xd9ff('0x1e2')});db['WhatsappInteraction'][_0xd9ff('0x13c')](db[_0xd9ff('0x69')],{'as':'Contact','foreignKey':'ContactId'});db[_0xd9ff('0xf3')]['belongsTo'](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x15a'),'foreignKey':_0xd9ff('0x101')});db[_0xd9ff('0xf3')]['belongsToMany'](db[_0xd9ff('0x82')],{'through':_0xd9ff('0x199'),'as':_0xd9ff('0x15c')});db[_0xd9ff('0xf3')]['belongsToMany'](db[_0xd9ff('0x82')],{'through':_0xd9ff('0x199'),'as':_0xd9ff('0x16a')});db['WhatsappInteraction'][_0xd9ff('0x114')](db['User'],{'as':_0xd9ff('0x15d'),'through':'user_has_whatsapp_interactions','foreignKey':_0xd9ff('0x1e6')});db[_0xd9ff('0x1e5')][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x102')});db[_0xd9ff('0x1e5')][_0xd9ff('0x13c')](db['CmContact'],{'onDelete':_0xd9ff('0x100'),'as':'Contact'});db[_0xd9ff('0x1e5')][_0xd9ff('0x13c')](db[_0xd9ff('0xf3')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0xd9ff('0x1e6')});db[_0xd9ff('0x1e5')]['belongsTo'](db[_0xd9ff('0xf1')],{'as':_0xd9ff('0x159'),'foreignKey':'WhatsappAccountId'});db['WhatsappQueueReport'][_0xd9ff('0x13c')](db['WhatsappAccount'],{});db[_0xd9ff('0xf6')]['belongsTo'](db[_0xd9ff('0xeb')],{'as':_0xd9ff('0x163'),'foreignKey':_0xd9ff('0x153')});db[_0xd9ff('0xf6')][_0xd9ff('0x13c')](db[_0xd9ff('0x69')],{'as':_0xd9ff('0x14b'),'foreignKey':_0xd9ff('0x14c')});db[_0xd9ff('0xf6')][_0xd9ff('0x13c')](db['WhatsappInteraction'],{});db[_0xd9ff('0xf6')][_0xd9ff('0x13c')](db[_0xd9ff('0xfa')],{});db[_0xd9ff('0xf6')][_0xd9ff('0x13c')](db[_0xd9ff('0x1e5')],{});db[_0xd9ff('0xf6')][_0xd9ff('0x13c')](db[_0xd9ff('0x102')],{});db[_0xd9ff('0xf8')][_0xd9ff('0x13c')](db['WhatsappMessage'],{});db[_0xd9ff('0xf8')][_0xd9ff('0x13c')](db[_0xd9ff('0xf3')],{});db['WhatsappTransferReport'][_0xd9ff('0x13c')](db[_0xd9ff('0xf1')],{'foreignKey':_0xd9ff('0x1e7'),'as':'FromAccount'});db[_0xd9ff('0xf8')]['belongsTo'](db[_0xd9ff('0xf1')],{'foreignKey':_0xd9ff('0x1e8'),'as':_0xd9ff('0x1d0')});db[_0xd9ff('0xf8')][_0xd9ff('0x13c')](db[_0xd9ff('0xfa')],{'foreignKey':_0xd9ff('0x1e9'),'as':_0xd9ff('0x1c9')});db[_0xd9ff('0xf8')]['belongsTo'](db[_0xd9ff('0x102')],{'foreignKey':_0xd9ff('0x1c7'),'as':'FromAgent'});db[_0xd9ff('0xf8')]['belongsTo'](db[_0xd9ff('0x102')],{'foreignKey':_0xd9ff('0x1cd'),'as':_0xd9ff('0x1ce')});db['WhatsappQueue'][_0xd9ff('0x114')](db[_0xd9ff('0x102')],{'as':_0xd9ff('0x13f'),'through':'UserWhatsappQueue','foreignKey':_0xd9ff('0x1ea')});db[_0xd9ff('0xfa')][_0xd9ff('0x114')](db[_0xd9ff('0xdf')],{'through':_0xd9ff('0x1bc'),'as':'Teams'});module[_0xd9ff('0x1eb')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 5a245db..587ef38 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd20c=['/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/auth/local','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','/www','root','/demo','/snippet','snippet','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','/index.html','username','password','newPassword','firstName','lastName','street','phone','mobile','email','clientId','clientSecret','code','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','registry','isPlainObject','isArray','length','isString','replace','}@@','includes','lodash','express','util','./errors','./config/environment','auth','safeTemplate','default','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','url','statusCode','user','name','role','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','remoteAddress','responseTime','other','agent_name','/api/users','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMailMessage','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','./api/mailQueue','/api/mail/interactions','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','./api/openchannelQueueReport','./api/chatApplication','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','./api/trigger','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/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/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/zoho/accounts','/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/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations'];(function(_0x2d1d7c,_0x22de2e){var _0x22a7c5=function(_0x252ecf){while(--_0x252ecf){_0x2d1d7c['push'](_0x2d1d7c['shift']());}};_0x22a7c5(++_0x22de2e);}(_0xd20c,0x1a9));var _0xcd20=function(_0x3e0358,_0x11e9f4){_0x3e0358=_0x3e0358-0x0;var _0x1527d0=_0xd20c[_0x3e0358];return _0x1527d0;};'use strict';var _=require(_0xcd20('0x0'));var path=require('path');var express=require(_0xcd20('0x1'));var ewinston=require('express-winston');var util=require(_0xcd20('0x2'));var errors=require(_0xcd20('0x3'));var config=require(_0xcd20('0x4'));var logger=require('./config/logger')('api');var authLogger=require('./config/logger')(_0xcd20('0x5'));var safeTemplate=require('./safe-template')[_0xcd20('0x6')];exports[_0xcd20('0x7')]=function(_0x210c83){_0x210c83['use'](ewinston[_0xcd20('0x8')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x501847,_0x54df9b){var _0x52ab90=_0xcd20('0x9');if(!_[_0xcd20('0xa')](_0x501847[_0xcd20('0xb')])){_0x52ab90+=_0xcd20('0xc');var _0x17e8b0=_0x501847[_0xcd20('0xb')];maskSensitiveData(_0x17e8b0);}return safeTemplate(util[_0xcd20('0xd')](_0x52ab90,_0x501847[_0xcd20('0xe')],_0x501847[_0xcd20('0xf')][_0xcd20('0x10')]?_0x501847[_0xcd20('0xf')][_0xcd20('0x10')]:_0x501847[_0xcd20('0x11')]['remoteAddress']||_0x501847['ip'],_0x501847[_0xcd20('0x12')],_0x54df9b[_0xcd20('0x13')],_0x54df9b['responseTime'],_0x501847[_0xcd20('0x14')]?_0x501847[_0xcd20('0x14')]['id']:null,_0x501847[_0xcd20('0x14')]?_0x501847[_0xcd20('0x14')][_0xcd20('0x15')]:null,_0x501847['user']?_0x501847[_0xcd20('0x14')][_0xcd20('0x16')]:null,_0x17e8b0?util['inspect'](_0x17e8b0,![],null):''));}}));_0x210c83[_0xcd20('0x17')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x106d58,_0x3a7212){var _0x57f4bf=_0xcd20('0x18');if(_0x106d58[_0xcd20('0xb')]&&_0x106d58[_0xcd20('0xb')][_0xcd20('0x19')]&&_0x106d58[_0xcd20('0xb')][_0xcd20('0x1a')]){_0x57f4bf='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xcd20('0xd')](_0x57f4bf,_0x106d58['method'],_0x106d58[_0xcd20('0xf')][_0xcd20('0x10')]?_0x106d58[_0xcd20('0xf')]['x-forwarded-for']:_0x106d58[_0xcd20('0x11')][_0xcd20('0x1b')]||_0x106d58['ip'],_0x106d58[_0xcd20('0x12')],_0x3a7212[_0xcd20('0x13')],_0x3a7212[_0xcd20('0x1c')],_0x106d58[_0xcd20('0x14')]?_0x106d58[_0xcd20('0x14')]['id']:null,_0x106d58[_0xcd20('0x14')]?_0x106d58['user'][_0xcd20('0x15')]:null,_0x106d58[_0xcd20('0x14')]?_0x106d58[_0xcd20('0x14')][_0xcd20('0x16')]:null,_0x106d58[_0xcd20('0xb')]&&_0x106d58['body'][_0xcd20('0x19')]?_0x106d58[_0xcd20('0xb')][_0xcd20('0x19')]:_0xcd20('0x1d'),_0x106d58[_0xcd20('0xb')]&&_0x106d58[_0xcd20('0xb')][_0xcd20('0x1a')]?_0x106d58['body'][_0xcd20('0x1a')]:'',_0x106d58[_0xcd20('0xb')]&&_0x106d58['body'][_0xcd20('0x1e')]?_0x106d58[_0xcd20('0xb')]['agent_name']:'');},'ignoreRoute':function(_0x433ae6){var _0x1a40c5=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1a40c5['test'](_0x433ae6[_0xcd20('0x12')]);}}));_0x210c83[_0xcd20('0x17')](_0xcd20('0x1f'),require('./api/user'));_0x210c83[_0xcd20('0x17')](_0xcd20('0x20'),require('./api/voiceChanSpy'));_0x210c83[_0xcd20('0x17')](_0xcd20('0x21'),require(_0xcd20('0x22')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x23'),require('./api/voiceExtension'));_0x210c83[_0xcd20('0x17')](_0xcd20('0x24'),require(_0xcd20('0x25')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x26'),require(_0xcd20('0x27')));_0x210c83['use'](_0xcd20('0x28'),require('./api/voiceRecording'));_0x210c83[_0xcd20('0x17')](_0xcd20('0x29'),require(_0xcd20('0x2a')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x2b'),require('./api/voiceMail'));_0x210c83[_0xcd20('0x17')]('/api/voice/mails/messages',require(_0xcd20('0x2c')));_0x210c83[_0xcd20('0x17')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x210c83[_0xcd20('0x17')](_0xcd20('0x2d'),require(_0xcd20('0x2e')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x2f'),require('./api/voiceAgentReport'));_0x210c83[_0xcd20('0x17')](_0xcd20('0x30'),require(_0xcd20('0x31')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x32'),require(_0xcd20('0x33')));_0x210c83['use'](_0xcd20('0x34'),require(_0xcd20('0x35')));_0x210c83[_0xcd20('0x17')]('/api/voice/transfers/reports',require(_0xcd20('0x36')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x37'),require(_0xcd20('0x38')));_0x210c83['use'](_0xcd20('0x39'),require(_0xcd20('0x3a')));_0x210c83[_0xcd20('0x17')]('/api/mail/queues',require(_0xcd20('0x3b')));_0x210c83['use']('/api/mail/substatuses',require('./api/mailSubstatus'));_0x210c83[_0xcd20('0x17')](_0xcd20('0x3c'),require('./api/mailInteraction'));_0x210c83['use']('/api/mail/messages',require(_0xcd20('0x3d')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x3e'),require(_0xcd20('0x3f')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x40'),require('./api/mailQueueReport'));_0x210c83[_0xcd20('0x17')](_0xcd20('0x41'),require(_0xcd20('0x42')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x43'),require(_0xcd20('0x44')));_0x210c83['use'](_0xcd20('0x45'),require(_0xcd20('0x46')));_0x210c83['use'](_0xcd20('0x47'),require(_0xcd20('0x48')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x49'),require(_0xcd20('0x4a')));_0x210c83['use']('/api/fax/messages',require(_0xcd20('0x4b')));_0x210c83[_0xcd20('0x17')]('/api/fax/queues',require(_0xcd20('0x4c')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x4d'),require(_0xcd20('0x4e')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x4f'),require('./api/smsAccount'));_0x210c83['use'](_0xcd20('0x50'),require(_0xcd20('0x51')));_0x210c83[_0xcd20('0x17')]('/api/sms/interactions',require('./api/smsInteraction'));_0x210c83[_0xcd20('0x17')](_0xcd20('0x52'),require(_0xcd20('0x53')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x54'),require(_0xcd20('0x55')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x56'),require(_0xcd20('0x57')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x58'),require(_0xcd20('0x59')));_0x210c83[_0xcd20('0x17')]('/api/openchannel/interactions',require(_0xcd20('0x5a')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x5b'),require(_0xcd20('0x5c')));_0x210c83[_0xcd20('0x17')]('/api/openchannel/queues',require(_0xcd20('0x5d')));_0x210c83['use']('/api/chat/websites',require('./api/chatWebsite'));_0x210c83['use']('/api/openchannel/reports/queue',require(_0xcd20('0x5e')));_0x210c83[_0xcd20('0x17')]('/api/chat/applications',require(_0xcd20('0x5f')));_0x210c83['use']('/api/chat/interactions',require('./api/chatInteraction'));_0x210c83[_0xcd20('0x17')]('/api/chat/messages',require(_0xcd20('0x60')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x61'),require(_0xcd20('0x62')));_0x210c83[_0xcd20('0x17')]('/api/chat/queues',require(_0xcd20('0x63')));_0x210c83[_0xcd20('0x17')]('/api/chat/groups',require(_0xcd20('0x64')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x65'),require(_0xcd20('0x66')));_0x210c83[_0xcd20('0x17')]('/api/cm/companies',require('./api/cmCompany'));_0x210c83['use']('/api/cm/contacts',require(_0xcd20('0x67')));_0x210c83[_0xcd20('0x17')]('/api/cm/hopper',require(_0xcd20('0x68')));_0x210c83['use'](_0xcd20('0x69'),require(_0xcd20('0x6a')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x6b'),require(_0xcd20('0x6c')));_0x210c83[_0xcd20('0x17')]('/api/cm/hopper_history',require(_0xcd20('0x6d')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x6e'),require('./api/cmCustomField'));_0x210c83[_0xcd20('0x17')](_0xcd20('0x6f'),require(_0xcd20('0x70')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x71'),require(_0xcd20('0x72')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x73'),require(_0xcd20('0x74')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x75'),require(_0xcd20('0x76')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x77'),require(_0xcd20('0x78')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x79'),require(_0xcd20('0x7a')));_0x210c83[_0xcd20('0x17')]('/api/pauses',require(_0xcd20('0x7b')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x7c'),require('./api/cdr'));_0x210c83[_0xcd20('0x17')](_0xcd20('0x7d'),require(_0xcd20('0x7e')));_0x210c83[_0xcd20('0x17')]('/api/schedules',require(_0xcd20('0x7f')));_0x210c83[_0xcd20('0x17')]('/api/sounds',require(_0xcd20('0x80')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x81'),require(_0xcd20('0x82')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x83'),require(_0xcd20('0x84')));_0x210c83[_0xcd20('0x17')]('/api/triggers',require(_0xcd20('0x85')));_0x210c83['use']('/api/variables',require(_0xcd20('0x86')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x87'),require('./api/integration'));_0x210c83[_0xcd20('0x17')](_0xcd20('0x88'),require(_0xcd20('0x89')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x8a'),require(_0xcd20('0x8b')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x8c'),require(_0xcd20('0x8d')));_0x210c83['use'](_0xcd20('0x8e'),require(_0xcd20('0x8f')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x90'),require(_0xcd20('0x91')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x92'),require(_0xcd20('0x93')));_0x210c83['use'](_0xcd20('0x94'),require(_0xcd20('0x95')));_0x210c83['use'](_0xcd20('0x96'),require(_0xcd20('0x97')));_0x210c83['use'](_0xcd20('0x98'),require(_0xcd20('0x99')));_0x210c83['use'](_0xcd20('0x9a'),require(_0xcd20('0x9b')));_0x210c83[_0xcd20('0x17')]('/api/integrations/sugarcrm/accounts',require(_0xcd20('0x9c')));_0x210c83[_0xcd20('0x17')]('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0x210c83[_0xcd20('0x17')]('/api/integrations/sugarcrm/fields',require(_0xcd20('0x9d')));_0x210c83['use'](_0xcd20('0x9e'),require(_0xcd20('0x9f')));_0x210c83[_0xcd20('0x17')](_0xcd20('0xa0'),require(_0xcd20('0xa1')));_0x210c83['use']('/api/integrations/desk/fields',require('./api/intDeskField'));_0x210c83['use'](_0xcd20('0xa2'),require('./api/intZohoAccount'));_0x210c83[_0xcd20('0x17')](_0xcd20('0xa3'),require('./api/intZohoConfiguration'));_0x210c83[_0xcd20('0x17')](_0xcd20('0xa4'),require(_0xcd20('0xa5')));_0x210c83[_0xcd20('0x17')](_0xcd20('0xa6'),require(_0xcd20('0xa7')));_0x210c83['use'](_0xcd20('0xa8'),require('./api/intZendeskConfiguration'));_0x210c83[_0xcd20('0x17')](_0xcd20('0xa9'),require(_0xcd20('0xaa')));_0x210c83[_0xcd20('0x17')]('/api/integrations/freshdesk/accounts',require(_0xcd20('0xab')));_0x210c83[_0xcd20('0x17')]('/api/integrations/freshdesk/configurations',require(_0xcd20('0xac')));_0x210c83[_0xcd20('0x17')](_0xcd20('0xad'),require(_0xcd20('0xae')));_0x210c83[_0xcd20('0x17')](_0xcd20('0xaf'),require(_0xcd20('0xb0')));_0x210c83[_0xcd20('0x17')](_0xcd20('0xb1'),require('./api/intVtigerConfiguration'));_0x210c83[_0xcd20('0x17')](_0xcd20('0xb2'),require(_0xcd20('0xb3')));_0x210c83['use'](_0xcd20('0xb4'),require('./api/intServicenowAccount'));_0x210c83[_0xcd20('0x17')](_0xcd20('0xb5'),require('./api/intServicenowConfiguration'));_0x210c83['use'](_0xcd20('0xb6'),require(_0xcd20('0xb7')));_0x210c83[_0xcd20('0x17')]('/api/integrations/dynamics365/accounts',require(_0xcd20('0xb8')));_0x210c83[_0xcd20('0x17')](_0xcd20('0xb9'),require(_0xcd20('0xba')));_0x210c83[_0xcd20('0x17')](_0xcd20('0xbb'),require(_0xcd20('0xbc')));_0x210c83[_0xcd20('0x17')](_0xcd20('0xbd'),require(_0xcd20('0xbe')));_0x210c83[_0xcd20('0x17')]('/api/integrations/freshsales/configurations',require(_0xcd20('0xbf')));_0x210c83[_0xcd20('0x17')](_0xcd20('0xc0'),require(_0xcd20('0xc1')));_0x210c83['use'](_0xcd20('0xc2'),require(_0xcd20('0xc3')));_0x210c83[_0xcd20('0x17')](_0xcd20('0xc4'),require('./api/chatQueueReport'));_0x210c83[_0xcd20('0x17')](_0xcd20('0xc5'),require(_0xcd20('0xc6')));_0x210c83['use'](_0xcd20('0xc7'),require(_0xcd20('0xc8')));_0x210c83['use'](_0xcd20('0xc9'),require(_0xcd20('0xca')));_0x210c83[_0xcd20('0x17')]('/api/jscripty/sessions/reports',require(_0xcd20('0xcb')));_0x210c83['use'](_0xcd20('0xcc'),require('./api/smsQueueReport'));_0x210c83[_0xcd20('0x17')](_0xcd20('0xcd'),require('./api/squareReport'));_0x210c83[_0xcd20('0x17')]('/api/square/details/reports',require('./api/squareReportDetail'));_0x210c83[_0xcd20('0x17')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0x210c83[_0xcd20('0x17')](_0xcd20('0xce'),require('./api/setting'));_0x210c83[_0xcd20('0x17')](_0xcd20('0xcf'),require(_0xcd20('0xd0')));_0x210c83[_0xcd20('0x17')](_0xcd20('0xd1'),require(_0xcd20('0xd2')));_0x210c83[_0xcd20('0x17')](_0xcd20('0xd3'),require('./api/squareRecording'));_0x210c83[_0xcd20('0x17')](_0xcd20('0xd4'),require(_0xcd20('0xd5')));_0x210c83[_0xcd20('0x17')](_0xcd20('0xd6'),require(_0xcd20('0xd7')));_0x210c83[_0xcd20('0x17')](_0xcd20('0xd8'),require(_0xcd20('0xd9')));_0x210c83['use'](_0xcd20('0xda'),require(_0xcd20('0xdb')));_0x210c83[_0xcd20('0x17')](_0xcd20('0xdc'),require('./api/migration'));_0x210c83[_0xcd20('0x17')](_0xcd20('0xdd'),require(_0xcd20('0xde')));_0x210c83[_0xcd20('0x17')](_0xcd20('0xdf'),require(_0xcd20('0xe0')));_0x210c83[_0xcd20('0x17')](_0xcd20('0xe1'),require('./api/mailTransferReport'));_0x210c83[_0xcd20('0x17')](_0xcd20('0xe2'),require(_0xcd20('0xe3')));_0x210c83[_0xcd20('0x17')](_0xcd20('0xe4'),require('./api/faxTransferReport'));_0x210c83[_0xcd20('0x17')](_0xcd20('0xe5'),require(_0xcd20('0xe6')));_0x210c83[_0xcd20('0x17')]('/api/sms/reports/transfer',require(_0xcd20('0xe7')));_0x210c83[_0xcd20('0x17')](_0xcd20('0xe8'),require(_0xcd20('0xe9')));_0x210c83[_0xcd20('0x17')]('/api/voice/prefixes',require(_0xcd20('0xea')));_0x210c83['use'](_0xcd20('0xeb'),require('./api/userProfile'));_0x210c83[_0xcd20('0x17')](_0xcd20('0xec'),require('./api/userProfileSection'));_0x210c83[_0xcd20('0x17')](_0xcd20('0xed'),require(_0xcd20('0xee')));_0x210c83[_0xcd20('0x17')](_0xcd20('0xef'),require(_0xcd20('0xf0')));_0x210c83['use']('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0x210c83[_0xcd20('0x17')](_0xcd20('0xf1'),require(_0xcd20('0xf2')));_0x210c83[_0xcd20('0x17')](_0xcd20('0xf3'),require(_0xcd20('0xf4')));_0x210c83[_0xcd20('0x17')]('/api/whatsapp/messages',require(_0xcd20('0xf5')));_0x210c83['use'](_0xcd20('0xf6'),require(_0xcd20('0xf7')));_0x210c83[_0xcd20('0x17')](_0xcd20('0xf8'),require('./api/whatsappTransferReport'));_0x210c83[_0xcd20('0x17')](_0xcd20('0xf9'),require('./api/whatsappQueue'));_0x210c83[_0xcd20('0x17')](_0xcd20('0xfa'),require(_0xcd20('0xfb')));_0x210c83[_0xcd20('0x17')](_0xcd20('0xfc'),require(_0xcd20('0xfd')));_0x210c83['use'](_0xcd20('0xfe'),require('./api/authLocal'));_0x210c83[_0xcd20('0x17')](_0xcd20('0xff'),require(_0xcd20('0x100')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x101'),require(_0xcd20('0x102')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x103'),require('./api/rpc'));_0x210c83[_0xcd20('0x17')](_0xcd20('0x104'),require(_0xcd20('0x105')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x106'),require('./api/system'));_0x210c83[_0xcd20('0x17')](_0xcd20('0x107'),require(_0xcd20('0x108')));_0x210c83[_0xcd20('0x17')](_0xcd20('0x109'),require(_0xcd20('0x10a')));_0x210c83['use'](_0xcd20('0x10b'),express[_0xcd20('0x10c')](path[_0xcd20('0x10d')](config['root'],_0xcd20('0x10b'))));_0x210c83['use'](_0xcd20('0x10e'),express[_0xcd20('0x10c')](path[_0xcd20('0x10d')](config[_0xcd20('0x10f')],_0xcd20('0x10e'))));_0x210c83[_0xcd20('0x17')](_0xcd20('0x110'),express[_0xcd20('0x10c')](path[_0xcd20('0x10d')](config[_0xcd20('0x10f')],'/demo')));_0x210c83['use'](_0xcd20('0x111'),express['static'](path[_0xcd20('0x10d')](config['root'],_0xcd20('0x112'),'3.0.0')));_0x210c83[_0xcd20('0x17')]('/plugins',express[_0xcd20('0x10c')](path[_0xcd20('0x10d')](config[_0xcd20('0x10f')],_0xcd20('0x113'))));_0x210c83[_0xcd20('0x114')](_0xcd20('0x115'))['get'](errors[0x194]);_0x210c83['route']('/*')[_0xcd20('0x116')](function(_0x1df743,_0x38f57b){_0x38f57b[_0xcd20('0x117')](path[_0xcd20('0x118')](_0x210c83[_0xcd20('0x116')]('appPath')+_0xcd20('0x119')));});};var sensitiveFields=[_0xcd20('0x11a'),_0xcd20('0x11b'),_0xcd20('0x11c'),'apiKey',_0xcd20('0x11d'),_0xcd20('0x11e'),_0xcd20('0x11f'),_0xcd20('0x120'),_0xcd20('0x121'),'fax',_0xcd20('0x122'),_0xcd20('0x123'),_0xcd20('0x124'),'securityToken',_0xcd20('0x125'),'accessKey','tenantId',_0xcd20('0x126'),_0xcd20('0x127'),_0xcd20('0x128'),_0xcd20('0x129'),_0xcd20('0x12a'),_0xcd20('0x12b'),_0xcd20('0x12c'),_0xcd20('0x12d'),_0xcd20('0x12e'),_0xcd20('0x12f'),_0xcd20('0x130'),_0xcd20('0x131'),_0xcd20('0x132'),'privateKey',_0xcd20('0x133'),_0xcd20('0x134'),_0xcd20('0x135'),_0xcd20('0x14'),_0xcd20('0x136'),_0xcd20('0x137'),_0xcd20('0x138'),_0xcd20('0x139'),_0xcd20('0x13a'),_0xcd20('0x13b'),'oldPassword'];function maskSensitiveData(_0x2f243d){var _0x27b3f6=/(?!^)[\s\S](?!$)/g;if(!_[_0xcd20('0x13c')](_0x2f243d))return;for(var _0xa28d1b in _0x2f243d){if(_[_0xcd20('0x13d')](_0x2f243d[_0xa28d1b])){for(var _0x3c2b5a=0x0;_0x3c2b5a<_0x2f243d[_0xa28d1b][_0xcd20('0x13e')];_0x3c2b5a++){maskSensitiveData(_0x2f243d[_0xa28d1b][_0x3c2b5a]);}}else if(_[_0xcd20('0x13c')](_0x2f243d[_0xa28d1b])){maskSensitiveData(_0x2f243d[_0xa28d1b]);}else if(_[_0xcd20('0x13f')](_0x2f243d[_0xa28d1b])){_0x2f243d[_0xa28d1b]=_0x2f243d[_0xa28d1b][_0xcd20('0x140')](/{{{/g,'@@{')[_0xcd20('0x140')](/}}}/g,_0xcd20('0x141'))['replace'](/{{/g,'@{')[_0xcd20('0x140')](/}}/g,'}@');if(_[_0xcd20('0x142')](sensitiveFields,_0xa28d1b)){_0x2f243d[_0xa28d1b]=_0x2f243d[_0xa28d1b][_0xcd20('0x140')](_0x27b3f6,'*');}}}} \ No newline at end of file +var _0x5203=['/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/pauses','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','/api/analytics/metrics','/api/analytics/field_reports','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/fields','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/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/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/cloudProvider','/api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/rpc','/api/version','./api/system','/api/pm2','/api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','snippet','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','username','password','newPassword','apiKey','lastName','street','mobile','clientId','code','token','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','exten','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','replace','@@{','}@@','includes','lodash','path','express','util','./config/logger','api','auth','./safe-template','safeTemplate','default','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','role','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','name','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/openchannel/reports/queue','./api/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup'];(function(_0x1e91eb,_0x5829a3){var _0x2af75a=function(_0x1815d1){while(--_0x1815d1){_0x1e91eb['push'](_0x1e91eb['shift']());}};_0x2af75a(++_0x5829a3);}(_0x5203,0xd3));var _0x3520=function(_0x1b8653,_0xa77a4e){_0x1b8653=_0x1b8653-0x0;var _0x4b867e=_0x5203[_0x1b8653];return _0x4b867e;};'use strict';var _=require(_0x3520('0x0'));var path=require(_0x3520('0x1'));var express=require(_0x3520('0x2'));var ewinston=require('express-winston');var util=require(_0x3520('0x3'));var errors=require('./errors');var config=require('./config/environment');var logger=require(_0x3520('0x4'))(_0x3520('0x5'));var authLogger=require(_0x3520('0x4'))(_0x3520('0x6'));var safeTemplate=require(_0x3520('0x7'))[_0x3520('0x8')];exports[_0x3520('0x9')]=function(_0x4cb627){_0x4cb627[_0x3520('0xa')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x3ad9e4,_0x336612){var _0x33b89f=_0x3520('0xb');if(!_[_0x3520('0xc')](_0x3ad9e4[_0x3520('0xd')])){_0x33b89f+='\x20body=%s';var _0x157081=_0x3ad9e4[_0x3520('0xd')];maskSensitiveData(_0x157081);}return safeTemplate(util[_0x3520('0xe')](_0x33b89f,_0x3ad9e4['method'],_0x3ad9e4[_0x3520('0xf')]['x-forwarded-for']?_0x3ad9e4[_0x3520('0xf')][_0x3520('0x10')]:_0x3ad9e4[_0x3520('0x11')][_0x3520('0x12')]||_0x3ad9e4['ip'],_0x3ad9e4[_0x3520('0x13')],_0x336612[_0x3520('0x14')],_0x336612[_0x3520('0x15')],_0x3ad9e4['user']?_0x3ad9e4[_0x3520('0x16')]['id']:null,_0x3ad9e4[_0x3520('0x16')]?_0x3ad9e4['user']['name']:null,_0x3ad9e4['user']?_0x3ad9e4[_0x3520('0x16')][_0x3520('0x17')]:null,_0x157081?util[_0x3520('0x18')](_0x157081,![],null):''));}}));_0x4cb627[_0x3520('0xa')](ewinston[_0x3520('0x19')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x3c7a38,_0x11f41a){var _0x5156b7=_0x3520('0x1a');if(_0x3c7a38[_0x3520('0xd')]&&_0x3c7a38['body'][_0x3520('0x1b')]&&_0x3c7a38['body'][_0x3520('0x1c')]){_0x5156b7='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x3520('0xe')](_0x5156b7,_0x3c7a38['method'],_0x3c7a38[_0x3520('0xf')][_0x3520('0x10')]?_0x3c7a38[_0x3520('0xf')]['x-forwarded-for']:_0x3c7a38[_0x3520('0x11')][_0x3520('0x12')]||_0x3c7a38['ip'],_0x3c7a38['url'],_0x11f41a[_0x3520('0x14')],_0x11f41a[_0x3520('0x15')],_0x3c7a38['user']?_0x3c7a38['user']['id']:null,_0x3c7a38[_0x3520('0x16')]?_0x3c7a38[_0x3520('0x16')][_0x3520('0x1d')]:null,_0x3c7a38['user']?_0x3c7a38[_0x3520('0x16')][_0x3520('0x17')]:null,_0x3c7a38[_0x3520('0xd')]&&_0x3c7a38[_0x3520('0xd')][_0x3520('0x1b')]?_0x3c7a38[_0x3520('0xd')][_0x3520('0x1b')]:_0x3520('0x1e'),_0x3c7a38[_0x3520('0xd')]&&_0x3c7a38['body'][_0x3520('0x1c')]?_0x3c7a38[_0x3520('0xd')][_0x3520('0x1c')]:'',_0x3c7a38['body']&&_0x3c7a38[_0x3520('0xd')]['agent_name']?_0x3c7a38[_0x3520('0xd')][_0x3520('0x1f')]:'');},'ignoreRoute':function(_0xf09dfe){var _0x149bd1=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x149bd1[_0x3520('0x20')](_0xf09dfe[_0x3520('0x13')]);}}));_0x4cb627['use'](_0x3520('0x21'),require(_0x3520('0x22')));_0x4cb627['use'](_0x3520('0x23'),require(_0x3520('0x24')));_0x4cb627[_0x3520('0xa')](_0x3520('0x25'),require(_0x3520('0x26')));_0x4cb627[_0x3520('0xa')](_0x3520('0x27'),require(_0x3520('0x28')));_0x4cb627[_0x3520('0xa')](_0x3520('0x29'),require(_0x3520('0x2a')));_0x4cb627[_0x3520('0xa')]('/api/voice/queues',require(_0x3520('0x2b')));_0x4cb627[_0x3520('0xa')](_0x3520('0x2c'),require(_0x3520('0x2d')));_0x4cb627[_0x3520('0xa')](_0x3520('0x2e'),require(_0x3520('0x2f')));_0x4cb627['use']('/api/voice/mails',require(_0x3520('0x30')));_0x4cb627['use'](_0x3520('0x31'),require(_0x3520('0x32')));_0x4cb627[_0x3520('0xa')](_0x3520('0x33'),require(_0x3520('0x34')));_0x4cb627[_0x3520('0xa')]('/api/voice/dials/reports',require('./api/voiceDialReport'));_0x4cb627['use']('/api/voice/agents/reports',require(_0x3520('0x35')));_0x4cb627['use'](_0x3520('0x36'),require('./api/voiceQueueReport'));_0x4cb627[_0x3520('0xa')]('/api/members/reports',require(_0x3520('0x37')));_0x4cb627[_0x3520('0xa')](_0x3520('0x38'),require(_0x3520('0x39')));_0x4cb627['use']('/api/voice/transfers/reports',require(_0x3520('0x3a')));_0x4cb627['use'](_0x3520('0x3b'),require('./api/mailServerOut'));_0x4cb627[_0x3520('0xa')](_0x3520('0x3c'),require(_0x3520('0x3d')));_0x4cb627[_0x3520('0xa')](_0x3520('0x3e'),require(_0x3520('0x3f')));_0x4cb627[_0x3520('0xa')]('/api/mail/substatuses',require('./api/mailSubstatus'));_0x4cb627[_0x3520('0xa')](_0x3520('0x40'),require(_0x3520('0x41')));_0x4cb627['use']('/api/mail/messages',require(_0x3520('0x42')));_0x4cb627[_0x3520('0xa')](_0x3520('0x43'),require(_0x3520('0x44')));_0x4cb627[_0x3520('0xa')]('/api/mail/reports/queue',require(_0x3520('0x45')));_0x4cb627['use'](_0x3520('0x46'),require(_0x3520('0x47')));_0x4cb627[_0x3520('0xa')](_0x3520('0x48'),require('./api/dashboardItem'));_0x4cb627[_0x3520('0xa')](_0x3520('0x49'),require(_0x3520('0x4a')));_0x4cb627[_0x3520('0xa')](_0x3520('0x4b'),require(_0x3520('0x4c')));_0x4cb627[_0x3520('0xa')](_0x3520('0x4d'),require(_0x3520('0x4e')));_0x4cb627[_0x3520('0xa')]('/api/fax/messages',require(_0x3520('0x4f')));_0x4cb627[_0x3520('0xa')](_0x3520('0x50'),require(_0x3520('0x51')));_0x4cb627[_0x3520('0xa')](_0x3520('0x52'),require(_0x3520('0x53')));_0x4cb627['use'](_0x3520('0x54'),require('./api/smsAccount'));_0x4cb627['use']('/api/sms/applications',require('./api/smsApplication'));_0x4cb627[_0x3520('0xa')](_0x3520('0x55'),require(_0x3520('0x56')));_0x4cb627[_0x3520('0xa')](_0x3520('0x57'),require('./api/smsMessage'));_0x4cb627[_0x3520('0xa')](_0x3520('0x58'),require(_0x3520('0x59')));_0x4cb627[_0x3520('0xa')]('/api/openchannel/accounts',require(_0x3520('0x5a')));_0x4cb627[_0x3520('0xa')](_0x3520('0x5b'),require('./api/openchannelApplication'));_0x4cb627[_0x3520('0xa')](_0x3520('0x5c'),require(_0x3520('0x5d')));_0x4cb627[_0x3520('0xa')](_0x3520('0x5e'),require(_0x3520('0x5f')));_0x4cb627[_0x3520('0xa')](_0x3520('0x60'),require(_0x3520('0x61')));_0x4cb627['use']('/api/chat/websites',require('./api/chatWebsite'));_0x4cb627[_0x3520('0xa')](_0x3520('0x62'),require('./api/openchannelQueueReport'));_0x4cb627[_0x3520('0xa')]('/api/chat/applications',require(_0x3520('0x63')));_0x4cb627[_0x3520('0xa')](_0x3520('0x64'),require('./api/chatInteraction'));_0x4cb627[_0x3520('0xa')](_0x3520('0x65'),require(_0x3520('0x66')));_0x4cb627[_0x3520('0xa')]('/api/chat/offline_messages',require('./api/chatOfflineMessage'));_0x4cb627[_0x3520('0xa')](_0x3520('0x67'),require('./api/chatQueue'));_0x4cb627[_0x3520('0xa')](_0x3520('0x68'),require(_0x3520('0x69')));_0x4cb627[_0x3520('0xa')](_0x3520('0x6a'),require(_0x3520('0x6b')));_0x4cb627['use']('/api/cm/companies',require(_0x3520('0x6c')));_0x4cb627[_0x3520('0xa')]('/api/cm/contacts',require('./api/cmContact'));_0x4cb627[_0x3520('0xa')](_0x3520('0x6d'),require('./api/cmHopper'));_0x4cb627[_0x3520('0xa')](_0x3520('0x6e'),require(_0x3520('0x6f')));_0x4cb627[_0x3520('0xa')](_0x3520('0x70'),require(_0x3520('0x71')));_0x4cb627['use'](_0x3520('0x72'),require('./api/cmHopperHistory'));_0x4cb627[_0x3520('0xa')](_0x3520('0x73'),require(_0x3520('0x74')));_0x4cb627[_0x3520('0xa')](_0x3520('0x75'),require(_0x3520('0x76')));_0x4cb627[_0x3520('0xa')](_0x3520('0x77'),require(_0x3520('0x78')));_0x4cb627['use'](_0x3520('0x79'),require(_0x3520('0x7a')));_0x4cb627['use']('/api/dispositions',require(_0x3520('0x7b')));_0x4cb627['use'](_0x3520('0x7c'),require(_0x3520('0x7d')));_0x4cb627[_0x3520('0xa')]('/api/intervals',require(_0x3520('0x7e')));_0x4cb627['use'](_0x3520('0x7f'),require('./api/pause'));_0x4cb627[_0x3520('0xa')](_0x3520('0x80'),require(_0x3520('0x81')));_0x4cb627[_0x3520('0xa')]('/api/voiceQueuesLog',require(_0x3520('0x82')));_0x4cb627[_0x3520('0xa')](_0x3520('0x83'),require(_0x3520('0x84')));_0x4cb627[_0x3520('0xa')](_0x3520('0x85'),require(_0x3520('0x86')));_0x4cb627[_0x3520('0xa')](_0x3520('0x87'),require(_0x3520('0x88')));_0x4cb627['use'](_0x3520('0x89'),require(_0x3520('0x8a')));_0x4cb627['use']('/api/triggers',require('./api/trigger'));_0x4cb627[_0x3520('0xa')](_0x3520('0x8b'),require(_0x3520('0x8c')));_0x4cb627[_0x3520('0xa')](_0x3520('0x8d'),require(_0x3520('0x8e')));_0x4cb627['use'](_0x3520('0x8f'),require(_0x3520('0x90')));_0x4cb627[_0x3520('0xa')]('/api/analytics/custom_reports',require(_0x3520('0x91')));_0x4cb627[_0x3520('0xa')](_0x3520('0x92'),require('./api/analyticDefaultReport'));_0x4cb627[_0x3520('0xa')](_0x3520('0x93'),require('./api/analyticExtractedReport'));_0x4cb627[_0x3520('0xa')](_0x3520('0x94'),require('./api/analyticMetric'));_0x4cb627[_0x3520('0xa')](_0x3520('0x95'),require('./api/analyticFieldReport'));_0x4cb627[_0x3520('0xa')]('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x4cb627['use'](_0x3520('0x96'),require('./api/intSalesforceAccount'));_0x4cb627[_0x3520('0xa')](_0x3520('0x97'),require(_0x3520('0x98')));_0x4cb627[_0x3520('0xa')](_0x3520('0x99'),require(_0x3520('0x9a')));_0x4cb627[_0x3520('0xa')](_0x3520('0x9b'),require(_0x3520('0x9c')));_0x4cb627['use'](_0x3520('0x9d'),require(_0x3520('0x9e')));_0x4cb627[_0x3520('0xa')](_0x3520('0x9f'),require(_0x3520('0xa0')));_0x4cb627['use'](_0x3520('0xa1'),require(_0x3520('0xa2')));_0x4cb627[_0x3520('0xa')](_0x3520('0xa3'),require(_0x3520('0xa4')));_0x4cb627[_0x3520('0xa')]('/api/integrations/desk/fields',require(_0x3520('0xa5')));_0x4cb627[_0x3520('0xa')]('/api/integrations/zoho/accounts',require(_0x3520('0xa6')));_0x4cb627['use'](_0x3520('0xa7'),require('./api/intZohoConfiguration'));_0x4cb627[_0x3520('0xa')](_0x3520('0xa8'),require(_0x3520('0xa9')));_0x4cb627[_0x3520('0xa')]('/api/integrations/zendesk/accounts',require(_0x3520('0xaa')));_0x4cb627['use'](_0x3520('0xab'),require(_0x3520('0xac')));_0x4cb627['use'](_0x3520('0xad'),require(_0x3520('0xae')));_0x4cb627[_0x3520('0xa')](_0x3520('0xaf'),require(_0x3520('0xb0')));_0x4cb627[_0x3520('0xa')](_0x3520('0xb1'),require('./api/intFreshdeskConfiguration'));_0x4cb627[_0x3520('0xa')](_0x3520('0xb2'),require(_0x3520('0xb3')));_0x4cb627['use']('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x4cb627[_0x3520('0xa')]('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x4cb627[_0x3520('0xa')](_0x3520('0xb4'),require('./api/intVtigerField'));_0x4cb627[_0x3520('0xa')]('/api/integrations/servicenow/accounts',require('./api/intServicenowAccount'));_0x4cb627[_0x3520('0xa')](_0x3520('0xb5'),require('./api/intServicenowConfiguration'));_0x4cb627[_0x3520('0xa')](_0x3520('0xb6'),require(_0x3520('0xb7')));_0x4cb627['use'](_0x3520('0xb8'),require(_0x3520('0xb9')));_0x4cb627[_0x3520('0xa')](_0x3520('0xba'),require(_0x3520('0xbb')));_0x4cb627[_0x3520('0xa')](_0x3520('0xbc'),require(_0x3520('0xbd')));_0x4cb627[_0x3520('0xa')](_0x3520('0xbe'),require('./api/intFreshsalesAccount'));_0x4cb627['use'](_0x3520('0xbf'),require(_0x3520('0xc0')));_0x4cb627[_0x3520('0xa')](_0x3520('0xc1'),require(_0x3520('0xc2')));_0x4cb627[_0x3520('0xa')]('/api/networks',require(_0x3520('0xc3')));_0x4cb627[_0x3520('0xa')]('/api/chat/reports/queue',require(_0x3520('0xc4')));_0x4cb627['use']('/api/chat/internal/messages',require(_0x3520('0xc5')));_0x4cb627[_0x3520('0xa')](_0x3520('0xc6'),require(_0x3520('0xc7')));_0x4cb627[_0x3520('0xa')](_0x3520('0xc8'),require('./api/jscriptyQuestionReport'));_0x4cb627[_0x3520('0xa')](_0x3520('0xc9'),require(_0x3520('0xca')));_0x4cb627[_0x3520('0xa')](_0x3520('0xcb'),require(_0x3520('0xcc')));_0x4cb627[_0x3520('0xa')]('/api/square/reports',require('./api/squareReport'));_0x4cb627[_0x3520('0xa')]('/api/square/details/reports',require('./api/squareReportDetail'));_0x4cb627[_0x3520('0xa')](_0x3520('0xcd'),require(_0x3520('0xce')));_0x4cb627[_0x3520('0xa')](_0x3520('0xcf'),require(_0x3520('0xd0')));_0x4cb627[_0x3520('0xa')](_0x3520('0xd1'),require(_0x3520('0xd2')));_0x4cb627[_0x3520('0xa')](_0x3520('0xd3'),require(_0x3520('0xd4')));_0x4cb627[_0x3520('0xa')](_0x3520('0xd5'),require(_0x3520('0xd6')));_0x4cb627[_0x3520('0xa')](_0x3520('0xd7'),require('./api/squareMessage'));_0x4cb627[_0x3520('0xa')](_0x3520('0xd8'),require(_0x3520('0xd9')));_0x4cb627[_0x3520('0xa')](_0x3520('0xda'),require(_0x3520('0xdb')));_0x4cb627[_0x3520('0xa')](_0x3520('0xdc'),require(_0x3520('0xdd')));_0x4cb627[_0x3520('0xa')]('/api/migrations',require('./api/migration'));_0x4cb627[_0x3520('0xa')](_0x3520('0xde'),require(_0x3520('0xdf')));_0x4cb627[_0x3520('0xa')](_0x3520('0xe0'),require(_0x3520('0xe1')));_0x4cb627['use'](_0x3520('0xe2'),require('./api/mailTransferReport'));_0x4cb627['use'](_0x3520('0xe3'),require(_0x3520('0xe4')));_0x4cb627[_0x3520('0xa')](_0x3520('0xe5'),require(_0x3520('0xe6')));_0x4cb627[_0x3520('0xa')](_0x3520('0xe7'),require(_0x3520('0xe8')));_0x4cb627[_0x3520('0xa')](_0x3520('0xe9'),require(_0x3520('0xea')));_0x4cb627[_0x3520('0xa')](_0x3520('0xeb'),require('./api/cmList'));_0x4cb627[_0x3520('0xa')](_0x3520('0xec'),require(_0x3520('0xed')));_0x4cb627[_0x3520('0xa')](_0x3520('0xee'),require(_0x3520('0xef')));_0x4cb627[_0x3520('0xa')](_0x3520('0xf0'),require(_0x3520('0xf1')));_0x4cb627[_0x3520('0xa')](_0x3520('0xf2'),require(_0x3520('0xf3')));_0x4cb627[_0x3520('0xa')]('/api/userNotifications',require(_0x3520('0xf4')));_0x4cb627[_0x3520('0xa')]('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0x4cb627['use'](_0x3520('0xf5'),require(_0x3520('0xf6')));_0x4cb627[_0x3520('0xa')]('/api/whatsapp/interactions',require(_0x3520('0xf7')));_0x4cb627[_0x3520('0xa')](_0x3520('0xf8'),require(_0x3520('0xf9')));_0x4cb627[_0x3520('0xa')](_0x3520('0xfa'),require(_0x3520('0xfb')));_0x4cb627[_0x3520('0xa')](_0x3520('0xfc'),require(_0x3520('0xfd')));_0x4cb627['use']('/api/whatsapp/queues',require('./api/whatsappQueue'));_0x4cb627[_0x3520('0xa')]('/api/cloudProviders',require(_0x3520('0xfe')));_0x4cb627[_0x3520('0xa')](_0x3520('0xff'),require('./api/realtime'));_0x4cb627[_0x3520('0xa')](_0x3520('0x100'),require(_0x3520('0x101')));_0x4cb627[_0x3520('0xa')](_0x3520('0x102'),require(_0x3520('0x103')));_0x4cb627[_0x3520('0xa')](_0x3520('0x104'),require('./api/jira'));_0x4cb627[_0x3520('0xa')]('/api/rpc',require(_0x3520('0x105')));_0x4cb627[_0x3520('0xa')](_0x3520('0x106'),require('./api/version'));_0x4cb627[_0x3520('0xa')]('/api/system',require(_0x3520('0x107')));_0x4cb627[_0x3520('0xa')](_0x3520('0x108'),require('./api/pm2'));_0x4cb627[_0x3520('0xa')](_0x3520('0x109'),require('./api/webbar'));_0x4cb627['use'](_0x3520('0x10a'),express[_0x3520('0x10b')](path[_0x3520('0x10c')](config[_0x3520('0x10d')],'/apidoc')));_0x4cb627['use'](_0x3520('0x10e'),express['static'](path['join'](config[_0x3520('0x10d')],_0x3520('0x10e'))));_0x4cb627[_0x3520('0xa')]('/demo',express[_0x3520('0x10b')](path[_0x3520('0x10c')](config[_0x3520('0x10d')],_0x3520('0x10f'))));_0x4cb627[_0x3520('0xa')](_0x3520('0x110'),express[_0x3520('0x10b')](path[_0x3520('0x10c')](config[_0x3520('0x10d')],_0x3520('0x111'),'3.0.0')));_0x4cb627['use'](_0x3520('0x112'),express[_0x3520('0x10b')](path[_0x3520('0x10c')](config['root'],'/server/files/plugins')));_0x4cb627[_0x3520('0x113')](_0x3520('0x114'))[_0x3520('0x115')](errors[0x194]);_0x4cb627['route']('/*')[_0x3520('0x115')](function(_0x228fa2,_0x268047){_0x268047[_0x3520('0x116')](path[_0x3520('0x117')](_0x4cb627[_0x3520('0x115')](_0x3520('0x118'))+'/index.html'));});};var sensitiveFields=[_0x3520('0x119'),_0x3520('0x11a'),_0x3520('0x11b'),_0x3520('0x11c'),'firstName',_0x3520('0x11d'),_0x3520('0x11e'),'phone',_0x3520('0x11f'),'fax','email',_0x3520('0x120'),'clientSecret','securityToken',_0x3520('0x121'),'accessKey','tenantId',_0x3520('0x122'),'channelSecret',_0x3520('0x123'),_0x3520('0x124'),_0x3520('0x125'),_0x3520('0x126'),_0x3520('0x127'),_0x3520('0x128'),_0x3520('0x129'),'calleridnum',_0x3520('0x12a'),'vidaooApiKey','clientEmail',_0x3520('0x12b'),_0x3520('0x12c'),_0x3520('0x12d'),_0x3520('0x12e'),_0x3520('0x16'),_0x3520('0x12f'),_0x3520('0x130'),_0x3520('0x131'),_0x3520('0x132'),_0x3520('0x133'),_0x3520('0x134'),_0x3520('0x135')];function maskSensitiveData(_0x4758e9){var _0x5df936=/(?!^)[\s\S](?!$)/g;if(!_[_0x3520('0x136')](_0x4758e9))return;for(var _0x57427b in _0x4758e9){if(_[_0x3520('0x137')](_0x4758e9[_0x57427b])){for(var _0x3b76b2=0x0;_0x3b76b2<_0x4758e9[_0x57427b][_0x3520('0x138')];_0x3b76b2++){maskSensitiveData(_0x4758e9[_0x57427b][_0x3b76b2]);}}else if(_[_0x3520('0x136')](_0x4758e9[_0x57427b])){maskSensitiveData(_0x4758e9[_0x57427b]);}else if(_['isString'](_0x4758e9[_0x57427b])){_0x4758e9[_0x57427b]=_0x4758e9[_0x57427b][_0x3520('0x139')](/{{{/g,_0x3520('0x13a'))[_0x3520('0x139')](/}}}/g,_0x3520('0x13b'))['replace'](/{{/g,'@{')[_0x3520('0x139')](/}}/g,'}@');if(_[_0x3520('0x13c')](sensitiveFields,_0x57427b)){_0x4758e9[_0x57427b]=_0x4758e9[_0x57427b][_0x3520('0x139')](_0x5df936,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 4220be1..d5e534e 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3177=['../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','rpc','error','log','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.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'];(function(_0x31e216,_0x22a5cf){var _0x1c7b90=function(_0x2ce1e9){while(--_0x2ce1e9){_0x31e216['push'](_0x31e216['shift']());}};_0x1c7b90(++_0x22a5cf);}(_0x3177,0x100));var _0x7317=function(_0x2240d8,_0x413b9f){_0x2240d8=_0x2240d8-0x0;var _0x12509f=_0x3177[_0x2240d8];return _0x12509f;};'use strict';var jayson=require(_0x7317('0x0'));var BPromise=require(_0x7317('0x1'));var _=require(_0x7317('0x2'));var config=require(_0x7317('0x3'));exports[_0x7317('0x4')]=function(){return new BPromise(function(_0x204f4f,_0x86101){var _0x550ed8={};_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x6')));_0x550ed8=_['merge'](_0x550ed8,require(_0x7317('0x7')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x8')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require('../api/voiceRecording/voiceRecording.rpc'));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x9')));_0x550ed8=_['merge'](_0x550ed8,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0xa')));_0x550ed8=_['merge'](_0x550ed8,require(_0x7317('0xb')));_0x550ed8=_['merge'](_0x550ed8,require(_0x7317('0xc')));_0x550ed8=_['merge'](_0x550ed8,require('../api/trunk/trunk.rpc'));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0xd')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0xe')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0xf')));_0x550ed8=_['merge'](_0x550ed8,require(_0x7317('0x10')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x11')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require('../api/mailMessage/mailMessage.rpc'));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require('../api/mailApplication/mailApplication.rpc'));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x12')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x13')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x14')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x15')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require('../api/faxMessage/faxMessage.rpc'));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require('../api/faxQueue/faxQueue.rpc'));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x16')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x17')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x18')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x19')));_0x550ed8=_['merge'](_0x550ed8,require(_0x7317('0x1a')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x1b')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x1c')));_0x550ed8=_['merge'](_0x550ed8,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x1d')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x1e')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x1f')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require('../api/chatMessage/chatMessage.rpc'));_0x550ed8=_['merge'](_0x550ed8,require('../api/chatQueue/chatQueue.rpc'));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x20')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x21')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x22')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x23')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x550ed8=_['merge'](_0x550ed8,require(_0x7317('0x24')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x25')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x26')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x27')));_0x550ed8=_['merge'](_0x550ed8,require('../api/template/template.rpc'));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x28')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x29')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x2a')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x550ed8=_['merge'](_0x550ed8,require(_0x7317('0x2b')));_0x550ed8=_['merge'](_0x550ed8,require(_0x7317('0x2c')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x2d')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x550ed8=_['merge'](_0x550ed8,require(_0x7317('0x2e')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x2f')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x30')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x550ed8=_['merge'](_0x550ed8,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x550ed8=_['merge'](_0x550ed8,require(_0x7317('0x31')));_0x550ed8=_['merge'](_0x550ed8,require(_0x7317('0x32')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x33')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require('../api/squareOdbc/squareOdbc.rpc'));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x34')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x35')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require('../api/squareMessage/squareMessage.rpc'));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x36')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x37')));_0x550ed8=_['merge'](_0x550ed8,require(_0x7317('0x38')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x39')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x3a')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x3b')));_0x550ed8=_['merge'](_0x550ed8,require(_0x7317('0x3c')));_0x550ed8=_[_0x7317('0x5')](_0x550ed8,require(_0x7317('0x3d')));var _0x424e92=jayson[_0x7317('0x3e')](_0x550ed8)[_0x7317('0x3f')]();var _0x5c2b65=config['rpc'][_0x7317('0x40')]||config[_0x7317('0x40')]+0x1;var _0x138c12=config[_0x7317('0x41')]['ip']||'localhost';_0x424e92['on'](_0x7317('0x42'),function(_0x3138a3){return _0x86101(_0x3138a3);});_0x424e92[_0x7317('0x4')](_0x5c2b65,_0x138c12,function(){console[_0x7317('0x43')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x138c12,_0x5c2b65);require(_0x7317('0x44'))[_0x7317('0x45')]();return _0x204f4f(_0x7317('0x46')+_0x138c12+':'+_0x5c2b65);});});}; \ No newline at end of file +var _0x36de=['rpc','port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.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/openchannelQueue/openchannelQueue.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.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/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','http'];(function(_0x179d45,_0x5a1fef){var _0xf32461=function(_0x3a5660){while(--_0x3a5660){_0x179d45['push'](_0x179d45['shift']());}};_0xf32461(++_0x5a1fef);}(_0x36de,0x1ea));var _0xe36d=function(_0x1b15f1,_0x59e21c){_0x1b15f1=_0x1b15f1-0x0;var _0x3b9486=_0x36de[_0x1b15f1];return _0x3b9486;};'use strict';var jayson=require(_0xe36d('0x0'));var BPromise=require(_0xe36d('0x1'));var _=require(_0xe36d('0x2'));var config=require(_0xe36d('0x3'));exports[_0xe36d('0x4')]=function(){return new BPromise(function(_0x44414e,_0x4be980){var _0x4c9e2b={};_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x5')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x7')));_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x8')));_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x9')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0xa')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0xb')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0xc')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0xd')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0xe')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/mailServerIn/mailServerIn.rpc'));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0xf')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x10')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/mailInteraction/mailInteraction.rpc'));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x11')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/mailApplication/mailApplication.rpc'));_0x4c9e2b=_['merge'](_0x4c9e2b,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/faxAccount/faxAccount.rpc'));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x12')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x13')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x14')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x15')));_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x16')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x17')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x18')));_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x19')));_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x1a')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x1b')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x1c')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x1d')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x4c9e2b=_['merge'](_0x4c9e2b,require('../api/chatInteraction/chatInteraction.rpc'));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x1e')));_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x1f')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/cmContact/cmContact.rpc'));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x20')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x21')));_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x22')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x23')));_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x24')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x25')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x26')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x27')));_0x4c9e2b=_['merge'](_0x4c9e2b,require('../api/trigger/trigger.rpc'));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x28')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x29')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x2a')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x2b')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x2c')));_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x2d')));_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x2e')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x2f')));_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x30')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x31')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x32')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x33')));_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x34')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x35')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/squareOdbc/squareOdbc.rpc'));_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x36')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x37')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/squareMessage/squareMessage.rpc'));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x38')));_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x39')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/plugin/plugin.rpc'));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x3a')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x4c9e2b=_['merge'](_0x4c9e2b,require(_0xe36d('0x3b')));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x4c9e2b=_[_0xe36d('0x6')](_0x4c9e2b,require(_0xe36d('0x3c')));var _0x1e63bf=jayson['server'](_0x4c9e2b)[_0xe36d('0x3d')]();var _0x12cc7a=config[_0xe36d('0x3e')][_0xe36d('0x3f')]||config[_0xe36d('0x3f')]+0x1;var _0x536c6b=config['rpc']['ip']||'localhost';_0x1e63bf['on'](_0xe36d('0x40'),function(_0xc897cf){return _0x4be980(_0xc897cf);});_0x1e63bf[_0xe36d('0x4')](_0x12cc7a,_0x536c6b,function(){console[_0xe36d('0x41')](_0xe36d('0x42'),_0x536c6b,_0x12cc7a);require(_0xe36d('0x43'))['default']();return _0x44414e(_0xe36d('0x44')+_0x536c6b+':'+_0x12cc7a);});});}; \ No newline at end of file diff --git a/server/safe-template.js b/server/safe-template.js index f144b6d..2522d29 100644 --- a/server/safe-template.js +++ b/server/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0972=['safeTemplate','\x20}\x20}','string','isArray','map','isPlainObject','keys','reduce','exports'];(function(_0x5544e7,_0x19c60d){var _0x3ce948=function(_0x32214c){while(--_0x32214c){_0x5544e7['push'](_0x5544e7['shift']());}};_0x3ce948(++_0x19c60d);}(_0x0972,0x64));var _0x2097=function(_0x14ee67,_0x1e2f91){_0x14ee67=_0x14ee67-0x0;var _0x4d13c1=_0x0972[_0x14ee67];return _0x4d13c1;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x1591ae){return _0x1591ae==='{{'?'{\x20{\x20':_0x2097('0x0');}function safeTemplate(_0x4ec7aa){var _0x36912c=_0x4ec7aa;if(typeof _0x4ec7aa===_0x2097('0x1')){_0x36912c=_0x4ec7aa['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x2097('0x2')](_0x4ec7aa)){_0x36912c=_0x4ec7aa[_0x2097('0x3')](function(_0xe6fbae){return safeTemplate(_0xe6fbae);});}else if(_[_0x2097('0x4')](_0x4ec7aa)){_0x36912c=Object[_0x2097('0x5')](_0x4ec7aa)[_0x2097('0x6')](function(_0x2b4f21,_0x59739f){_0x2b4f21[_0x59739f]=safeTemplate(_0x4ec7aa[_0x59739f]);return _0x2b4f21;},{});}return _0x36912c;}module[_0x2097('0x7')][_0x2097('0x8')]=safeTemplate; \ No newline at end of file +var _0x1775=['exports','safeTemplate','{\x20{\x20','\x20}\x20}','string','replace','isArray','map','isPlainObject','keys','reduce'];(function(_0x4b4c68,_0x14d416){var _0x1686e6=function(_0x56ab6c){while(--_0x56ab6c){_0x4b4c68['push'](_0x4b4c68['shift']());}};_0x1686e6(++_0x14d416);}(_0x1775,0x1db));var _0x5177=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1775[_0x17d9e3];return _0x14192d;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0xb5c9b1){return _0xb5c9b1==='{{'?_0x5177('0x0'):_0x5177('0x1');}function safeTemplate(_0x2ca33b){var _0xaad33e=_0x2ca33b;if(typeof _0x2ca33b===_0x5177('0x2')){_0xaad33e=_0x2ca33b[_0x5177('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x5177('0x4')](_0x2ca33b)){_0xaad33e=_0x2ca33b[_0x5177('0x5')](function(_0x51275f){return safeTemplate(_0x51275f);});}else if(_[_0x5177('0x6')](_0x2ca33b)){_0xaad33e=Object[_0x5177('0x7')](_0x2ca33b)[_0x5177('0x8')](function(_0x2ac1c6,_0x300b43){_0x2ac1c6[_0x300b43]=safeTemplate(_0x2ca33b[_0x300b43]);return _0x2ac1c6;},{});}return _0xaad33e;}module[_0x5177('0x9')][_0x5177('0xa')]=safeTemplate; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 02ba6ab..a862997 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 _0x5fed=['sayPhonetic','continueAt','extension','setExtension','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','sendRequest','sync','prototype','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setPriority','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s'];(function(_0x2640d1,_0x48a758){var _0x588e65=function(_0x55dd29){while(--_0x55dd29){_0x2640d1['push'](_0x2640d1['shift']());}};_0x588e65(++_0x48a758);}(_0x5fed,0xed));var _0xd5fe=function(_0x5bf152,_0x2884b3){_0x5bf152=_0x5bf152-0x0;var _0x5d1230=_0x5fed[_0x5bf152];return _0x5d1230;};'use strict';var util=require(_0xd5fe('0x0'));var _=require(_0xd5fe('0x1'));var EventEmitter=require(_0xd5fe('0x2'))[_0xd5fe('0x3')];var AGIReply=require(_0xd5fe('0x4'));var AGIError=require(_0xd5fe('0x5'));function AGIChannel(_0x3d6a82){var _0x5831ce=this,_0x378b3a=new AGIReply(),_0x3ce9bd=![],_0x52dafa={};EventEmitter[_0xd5fe('0x6')](_0x5831ce);_0x3d6a82[_0xd5fe('0x7')](_0xd5fe('0x8'));_0x3d6a82['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x378b3a['setEncoding']('utf8');_0x378b3a['on'](_0xd5fe('0x9'),function(_0x314f7a){for(var _0x5edbed in _0x314f7a){_0x5831ce[_0x5edbed]=_0x314f7a[_0x5edbed];}_0x5831ce[_0xd5fe('0xa')](_0xd5fe('0xb'));});_0x378b3a['on'](_0xd5fe('0xc'),function(_0x5b4a0b){if(_0x5b4a0b[_0xd5fe('0xd')]()==_0xd5fe('0xe')){_0x5831ce[_0xd5fe('0xa')](_0xd5fe('0xe'));return;}if(_0x5b4a0b[_0xd5fe('0xf')](0x0,0xb)==_0xd5fe('0x10')){_0x3ce9bd=!![];}if(_0x3ce9bd){_0x52dafa['rx']+=_0x5b4a0b+'\x0a';if(_0x5b4a0b[_0xd5fe('0x11')](_0xd5fe('0x12'))!=-0x1){_0x3ce9bd=![];}}else{_0x52dafa['rx']=_0x5b4a0b;}if(_0x3ce9bd){return;}if(typeof _0x52dafa['cb']=='function'){var _0x537b9a=_0x52dafa['rx'][_0xd5fe('0xf')](0x0,0x3),_0x2b7738=null,_0x25555e=null;_0x537b9a=parseInt(_0x537b9a);if(isNaN(_0x537b9a)){_0x52dafa['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xd5fe('0x13')});return;}if(_0x537b9a!=0xc8){_0x52dafa['cb'](null,{'code':_0x537b9a,'result':-0x1,'extra':'KO'});return;}_0x2b7738=_0x52dafa['rx'][_0xd5fe('0xf')](0x4)[_0xd5fe('0x14')](_0xd5fe('0x15'),'');if(_0x2b7738[_0xd5fe('0x16')]('\x20')!=-0x1){_0x2b7738=_0x2b7738[_0xd5fe('0x17')](0x0,_0x2b7738[_0xd5fe('0x16')]('\x20'));}if(_[_0xd5fe('0x18')](_0x2b7738,'-1')){_0x2b7738=parseInt(_0x2b7738);}_0x25555e=_0x52dafa['rx'][_0xd5fe('0x19')]('\x20');if(_0x25555e[_0xd5fe('0x1a')]==0x3){_0x25555e=_0x25555e[0x2][_0xd5fe('0xf')](0x1,_0x25555e[0x2]['length']-0x1);}else if(_0x25555e['length']>0x3){var _0x550043=/\((.+)\)/;var _0x3c30b2=_0x52dafa['rx']['match'](_0x550043);if(_0x3c30b2){_0x25555e=_0x3c30b2[0x1];}else{_0x25555e=null;}}else{_0x25555e=null;}_0x52dafa['cb'](null,{'code':_0x537b9a,'result':_0x2b7738,'extra':_0x25555e});}});_0x3d6a82['on'](_0xd5fe('0x1b'),function(_0xef900){_0x5831ce['emit']('error',new AGIError(_0xd5fe('0x1c'),_0xef900[_0xd5fe('0x1d')]));});_0x3d6a82['on'](_0xd5fe('0x1e'),function(){_0x5831ce['emit']('close',new AGIError(_0xd5fe('0x1f')));});_0x3d6a82['on'](_0xd5fe('0x20'),function(){_0x5831ce['emit'](_0xd5fe('0x20'),new AGIError(_0xd5fe('0x21')));_0x3d6a82[_0xd5fe('0x22')]();});_0x3d6a82[_0xd5fe('0x23')](_0x378b3a);this[_0xd5fe('0x24')]=function(_0x4555b0,_0x176132){var _0x4555b0=_0x4555b0||'',_0x176132=typeof _0x176132=='function'?_0x176132:new Function();_0x52dafa={'tx':_0x4555b0,'rx':'','cb':_0x176132};_0x3d6a82['write'](_0x4555b0+'\x0a');},this[_0xd5fe('0x1e')]=function(){_0x3d6a82[_0xd5fe('0x22')]();};}util[_0xd5fe('0x25')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0xd5fe('0x26')]=function(_0x259959){return this['command'][_0xd5fe('0x27')](this,_0x259959);};AGIChannel[_0xd5fe('0x28')]['answer']=function(){return this[_0xd5fe('0x26')](_0xd5fe('0x29'));};AGIChannel[_0xd5fe('0x28')][_0xd5fe('0x2a')]=function(_0x238be2,_0x32f553,_0x20bbde){_0x238be2=_0x238be2===undefined?'beep':_0x238be2;_0x32f553=_0x32f553===undefined?'5':_0x32f553;_0x20bbde=_0x20bbde===undefined?'1':_0x20bbde;return this[_0xd5fe('0x26')](util[_0xd5fe('0x2b')](_0xd5fe('0x2c'),_0x238be2,_0x32f553*0x3e8,_0x20bbde));};AGIChannel[_0xd5fe('0x28')][_0xd5fe('0x2d')]=function(_0x31af30){_0x31af30=_0x31af30||_0xd5fe('0x2e');return this[_0xd5fe('0x26')](util[_0xd5fe('0x2b')](_0xd5fe('0x2f'),_0x31af30));};AGIChannel['prototype'][_0xd5fe('0x30')]=function(_0x50c4b1,_0x34822f){if(_[_0xd5fe('0x31')](_0x34822f)){return this[_0xd5fe('0x26')](util['format'](_0xd5fe('0x32'),_0x50c4b1,_0x34822f['join'](',')));}return this[_0xd5fe('0x26')](util['format'](_0xd5fe('0x32'),_0x50c4b1,_0x34822f));};AGIChannel[_0xd5fe('0x28')][_0xd5fe('0x33')]=function(_0x5a59eb){return this['sendRequest'](util[_0xd5fe('0x2b')](_0xd5fe('0x34'),_0x5a59eb));};AGIChannel[_0xd5fe('0x28')]['setExtension']=function(_0x561de9){return this['sendRequest'](util[_0xd5fe('0x2b')]('SET\x20EXTENSION\x20%s',_0x561de9));};AGIChannel[_0xd5fe('0x28')][_0xd5fe('0x35')]=function(_0x78b5ea){return this[_0xd5fe('0x26')](util[_0xd5fe('0x2b')]('SET\x20PRIORITY\x20%s',_0x78b5ea));};AGIChannel[_0xd5fe('0x28')][_0xd5fe('0xe')]=function(){return this[_0xd5fe('0x26')](_0xd5fe('0x36'));};AGIChannel['prototype'][_0xd5fe('0x37')]=function(_0x6371a9,_0x4fff9d){var _0x428330=_[_0xd5fe('0x38')](_0x4fff9d)||_[_0xd5fe('0x39')](_0x4fff9d)?_0x4fff9d[_0xd5fe('0x3a')]():_0x4fff9d;return this['sendRequest'](util[_0xd5fe('0x2b')](_0xd5fe('0x3b'),_0x6371a9,_0x428330?_0x428330[_0xd5fe('0x3a')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xd5fe('0x28')][_0xd5fe('0x3c')]=function(_0x3457ed,_0x2050c9){return this[_0xd5fe('0x26')](util[_0xd5fe('0x2b')]('SAY\x20NUMBER\x20%s\x20%s',_0x3457ed,_0x2050c9));};AGIChannel[_0xd5fe('0x28')][_0xd5fe('0x3d')]=function(_0x2ec9a3,_0x35a1ba){return this[_0xd5fe('0x26')](util[_0xd5fe('0x2b')](_0xd5fe('0x3e'),_0x2ec9a3,_0x35a1ba));};AGIChannel['prototype'][_0xd5fe('0x3f')]=function(_0xb58351,_0x367881){return this['sendRequest'](util[_0xd5fe('0x2b')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0xb58351,_0x367881));};AGIChannel[_0xd5fe('0x28')][_0xd5fe('0x40')]=function(_0x5628f2,_0x447d15,_0x1c76cc){_0x447d15=_0x447d15||this[_0xd5fe('0x41')];_0x1c76cc=_0x1c76cc||0x1;this[_0xd5fe('0x33')](_0x5628f2);this[_0xd5fe('0x42')](_0x447d15);this['setPriority'](_0x1c76cc);return this[_0xd5fe('0x2d')](util[_0xd5fe('0x2b')]('GOTO\x20%s\x20%s\x20%s',_0x5628f2,_0x447d15,_0x1c76cc));};AGIChannel[_0xd5fe('0x28')]['getVariable']=function(_0x560814){return this[_0xd5fe('0x26')](util[_0xd5fe('0x2b')](_0xd5fe('0x43'),_0x560814));};AGIChannel[_0xd5fe('0x28')][_0xd5fe('0x44')]=function(_0x5c15d9,_0x8d9be2,_0x5da4f3,_0x56bbe4,_0x3fbb98,_0x51123f){_0x8d9be2=_0x8d9be2||_0xd5fe('0x45');_0x5da4f3=_0x5da4f3||'';_0x56bbe4=_0x56bbe4===undefined?-0x1:_0x56bbe4==='-1'?-0x1:_0x56bbe4*0x3e8;_0x3fbb98=_0x3fbb98===undefined?'':'s='+_0x3fbb98;_0x51123f=_0x51123f?_0xd5fe('0x46'):'';return this[_0xd5fe('0x26')](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x5c15d9,_0x8d9be2,_0x5da4f3,_0x56bbe4,_0x51123f,_0x3fbb98));};AGIChannel[_0xd5fe('0x28')]['streamFile']=function(_0x3c91ad,_0x213dd0){_0x213dd0=_0x213dd0||'';return this[_0xd5fe('0x26')](util[_0xd5fe('0x2b')](_0xd5fe('0x47'),_0x3c91ad,_0x213dd0));};AGIChannel[_0xd5fe('0x28')][_0xd5fe('0x48')]=function(_0x823dc0){return this[_0xd5fe('0x30')](_0xd5fe('0x49'),_0x823dc0);};AGIChannel[_0xd5fe('0x28')]['wait']=function(_0x3c8225){return this[_0xd5fe('0x30')]('WAIT',_0x3c8225);};AGIChannel['prototype'][_0xd5fe('0x1b')]=function(_0x169525,_0x1cfd66){this[_0xd5fe('0x2d')](util[_0xd5fe('0x2b')](_0xd5fe('0x4a'),_0x169525['id'],_0x169525['label'],_0x1cfd66));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0xcdd2=['destroy','function','write','prototype','sendRequest','command','sync','answer','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','format','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','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','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./error','call','utf8','setTimeout','setEncoding','emit','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','no\x20code','replace','result=','indexOf','startsWith','length','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT'];(function(_0x373ea0,_0x4be8bd){var _0x4c0bdc=function(_0xa5dd09){while(--_0xa5dd09){_0x373ea0['push'](_0x373ea0['shift']());}};_0x4c0bdc(++_0x4be8bd);}(_0xcdd2,0x83));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x2cdd('0x0'));var _=require(_0x2cdd('0x1'));var EventEmitter=require(_0x2cdd('0x2'))[_0x2cdd('0x3')];var AGIReply=require('./reply');var AGIError=require(_0x2cdd('0x4'));function AGIChannel(_0x35f3ce){var _0xf0d3dc=this,_0x2b63a4=new AGIReply(),_0x5d1626=![],_0x42dbf8={};EventEmitter[_0x2cdd('0x5')](_0xf0d3dc);_0x35f3ce['setEncoding'](_0x2cdd('0x6'));_0x35f3ce[_0x2cdd('0x7')](0x8*0x3c*0x3c*0x3e8);_0x2b63a4[_0x2cdd('0x8')](_0x2cdd('0x6'));_0x2b63a4['on']('headers',function(_0x569943){for(var _0x54f580 in _0x569943){_0xf0d3dc[_0x54f580]=_0x569943[_0x54f580];}_0xf0d3dc[_0x2cdd('0x9')]('ready');});_0x2b63a4['on'](_0x2cdd('0xa'),function(_0x3e3cf0){if(_0x3e3cf0[_0x2cdd('0xb')]()==_0x2cdd('0xc')){_0xf0d3dc[_0x2cdd('0x9')](_0x2cdd('0xc'));return;}if(_0x3e3cf0[_0x2cdd('0xd')](0x0,0xb)==_0x2cdd('0xe')){_0x5d1626=!![];}if(_0x5d1626){_0x42dbf8['rx']+=_0x3e3cf0+'\x0a';if(_0x3e3cf0[_0x2cdd('0xf')](_0x2cdd('0x10'))!=-0x1){_0x5d1626=![];}}else{_0x42dbf8['rx']=_0x3e3cf0;}if(_0x5d1626){return;}if(typeof _0x42dbf8['cb']=='function'){var _0x53ea0b=_0x42dbf8['rx']['substring'](0x0,0x3),_0xfddd1e=null,_0x11b209=null;_0x53ea0b=parseInt(_0x53ea0b);if(isNaN(_0x53ea0b)){_0x42dbf8['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x2cdd('0x11')});return;}if(_0x53ea0b!=0xc8){_0x42dbf8['cb'](null,{'code':_0x53ea0b,'result':-0x1,'extra':'KO'});return;}_0xfddd1e=_0x42dbf8['rx'][_0x2cdd('0xd')](0x4)[_0x2cdd('0x12')](_0x2cdd('0x13'),'');if(_0xfddd1e[_0x2cdd('0x14')]('\x20')!=-0x1){_0xfddd1e=_0xfddd1e['substr'](0x0,_0xfddd1e[_0x2cdd('0x14')]('\x20'));}if(_[_0x2cdd('0x15')](_0xfddd1e,'-1')){_0xfddd1e=parseInt(_0xfddd1e);}_0x11b209=_0x42dbf8['rx']['split']('\x20');if(_0x11b209[_0x2cdd('0x16')]==0x3){_0x11b209=_0x11b209[0x2][_0x2cdd('0xd')](0x1,_0x11b209[0x2][_0x2cdd('0x16')]-0x1);}else if(_0x11b209[_0x2cdd('0x16')]>0x3){var _0x3af7c8=/\((.+)\)/;var _0x2587fb=_0x42dbf8['rx']['match'](_0x3af7c8);if(_0x2587fb){_0x11b209=_0x2587fb[0x1];}else{_0x11b209=null;}}else{_0x11b209=null;}_0x42dbf8['cb'](null,{'code':_0x53ea0b,'result':_0xfddd1e,'extra':_0x11b209});}});_0x35f3ce['on'](_0x2cdd('0x17'),function(_0x9491c8){_0xf0d3dc[_0x2cdd('0x9')](_0x2cdd('0x17'),new AGIError('E_AGI_SOCKET_ERROR',_0x9491c8[_0x2cdd('0x18')]));});_0x35f3ce['on'](_0x2cdd('0x19'),function(){_0xf0d3dc[_0x2cdd('0x9')](_0x2cdd('0x19'),new AGIError(_0x2cdd('0x1a')));});_0x35f3ce['on'](_0x2cdd('0x1b'),function(){_0xf0d3dc[_0x2cdd('0x9')](_0x2cdd('0x1b'),new AGIError(_0x2cdd('0x1c')));_0x35f3ce[_0x2cdd('0x1d')]();});_0x35f3ce['pipe'](_0x2b63a4);this['command']=function(_0x206942,_0x5e874e){var _0x206942=_0x206942||'',_0x5e874e=typeof _0x5e874e==_0x2cdd('0x1e')?_0x5e874e:new Function();_0x42dbf8={'tx':_0x206942,'rx':'','cb':_0x5e874e};_0x35f3ce[_0x2cdd('0x1f')](_0x206942+'\x0a');},this[_0x2cdd('0x19')]=function(){_0x35f3ce['destroy']();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x2cdd('0x20')][_0x2cdd('0x21')]=function(_0x340a47){return this[_0x2cdd('0x22')][_0x2cdd('0x23')](this,_0x340a47);};AGIChannel[_0x2cdd('0x20')][_0x2cdd('0x24')]=function(){return this['sendRequest'](_0x2cdd('0x25'));};AGIChannel[_0x2cdd('0x20')][_0x2cdd('0x26')]=function(_0x5a8eff,_0x4cbc21,_0x5ef69f){_0x5a8eff=_0x5a8eff===undefined?_0x2cdd('0x27'):_0x5a8eff;_0x4cbc21=_0x4cbc21===undefined?'5':_0x4cbc21;_0x5ef69f=_0x5ef69f===undefined?'1':_0x5ef69f;return this[_0x2cdd('0x21')](util['format'](_0x2cdd('0x28'),_0x5a8eff,_0x4cbc21*0x3e8,_0x5ef69f));};AGIChannel[_0x2cdd('0x20')][_0x2cdd('0x29')]=function(_0x1fd007){_0x1fd007=_0x1fd007||_0x2cdd('0x2a');return this[_0x2cdd('0x21')](util['format'](_0x2cdd('0x2b'),_0x1fd007));};AGIChannel[_0x2cdd('0x20')][_0x2cdd('0x2c')]=function(_0x43fbc3,_0x4d6929){if(_[_0x2cdd('0x2d')](_0x4d6929)){return this[_0x2cdd('0x21')](util['format'](_0x2cdd('0x2e'),_0x43fbc3,_0x4d6929[_0x2cdd('0x2f')](',')));}return this[_0x2cdd('0x21')](util[_0x2cdd('0x30')](_0x2cdd('0x2e'),_0x43fbc3,_0x4d6929));};AGIChannel[_0x2cdd('0x20')][_0x2cdd('0x31')]=function(_0x1a7552){return this[_0x2cdd('0x21')](util['format'](_0x2cdd('0x32'),_0x1a7552));};AGIChannel[_0x2cdd('0x20')][_0x2cdd('0x33')]=function(_0x5a0fb4){return this['sendRequest'](util['format'](_0x2cdd('0x34'),_0x5a0fb4));};AGIChannel[_0x2cdd('0x20')]['setPriority']=function(_0x6c7f28){return this[_0x2cdd('0x21')](util[_0x2cdd('0x30')](_0x2cdd('0x35'),_0x6c7f28));};AGIChannel[_0x2cdd('0x20')]['hangup']=function(){return this['sendRequest'](_0x2cdd('0x36'));};AGIChannel[_0x2cdd('0x20')][_0x2cdd('0x37')]=function(_0x1b4bd7,_0x41156e){var _0x49a484=_[_0x2cdd('0x38')](_0x41156e)||_[_0x2cdd('0x39')](_0x41156e)?_0x41156e[_0x2cdd('0x3a')]():_0x41156e;return this[_0x2cdd('0x21')](util[_0x2cdd('0x30')](_0x2cdd('0x3b'),_0x1b4bd7,_0x49a484?_0x49a484[_0x2cdd('0x3a')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x2cdd('0x20')][_0x2cdd('0x3c')]=function(_0x2f8e8c,_0x42cbd7){return this[_0x2cdd('0x21')](util[_0x2cdd('0x30')](_0x2cdd('0x3d'),_0x2f8e8c,_0x42cbd7));};AGIChannel[_0x2cdd('0x20')][_0x2cdd('0x3e')]=function(_0x49b727,_0x4bf498){return this[_0x2cdd('0x21')](util[_0x2cdd('0x30')](_0x2cdd('0x3f'),_0x49b727,_0x4bf498));};AGIChannel['prototype'][_0x2cdd('0x40')]=function(_0x59e7d8,_0x573bd4){return this[_0x2cdd('0x21')](util[_0x2cdd('0x30')](_0x2cdd('0x41'),_0x59e7d8,_0x573bd4));};AGIChannel[_0x2cdd('0x20')][_0x2cdd('0x42')]=function(_0x2414bd,_0x4388d7,_0x3778d9){_0x4388d7=_0x4388d7||this[_0x2cdd('0x43')];_0x3778d9=_0x3778d9||0x1;this['setContext'](_0x2414bd);this[_0x2cdd('0x33')](_0x4388d7);this[_0x2cdd('0x44')](_0x3778d9);return this[_0x2cdd('0x29')](util['format'](_0x2cdd('0x45'),_0x2414bd,_0x4388d7,_0x3778d9));};AGIChannel[_0x2cdd('0x20')][_0x2cdd('0x46')]=function(_0x2b3932){return this[_0x2cdd('0x21')](util['format']('GET\x20VARIABLE\x20\x22%s\x22',_0x2b3932));};AGIChannel[_0x2cdd('0x20')][_0x2cdd('0x47')]=function(_0x945df1,_0x5d9369,_0x51c6c6,_0x4162ba,_0x477482,_0x5258fc){_0x5d9369=_0x5d9369||'wav';_0x51c6c6=_0x51c6c6||'';_0x4162ba=_0x4162ba===undefined?-0x1:_0x4162ba==='-1'?-0x1:_0x4162ba*0x3e8;_0x477482=_0x477482===undefined?'':'s='+_0x477482;_0x5258fc=_0x5258fc?_0x2cdd('0x48'):'';return this[_0x2cdd('0x21')](util[_0x2cdd('0x30')](_0x2cdd('0x49'),_0x945df1,_0x5d9369,_0x51c6c6,_0x4162ba,_0x5258fc,_0x477482));};AGIChannel[_0x2cdd('0x20')][_0x2cdd('0x4a')]=function(_0x4427f3,_0x3ac603){_0x3ac603=_0x3ac603||'';return this[_0x2cdd('0x21')](util[_0x2cdd('0x30')](_0x2cdd('0x4b'),_0x4427f3,_0x3ac603));};AGIChannel['prototype'][_0x2cdd('0x4c')]=function(_0x1f9fb3){return this[_0x2cdd('0x2c')]('AGI',_0x1f9fb3);};AGIChannel[_0x2cdd('0x20')]['wait']=function(_0x5acb44){return this[_0x2cdd('0x2c')]('WAIT',_0x5acb44);};AGIChannel[_0x2cdd('0x20')][_0x2cdd('0x17')]=function(_0x14566e,_0x4c55f5){this[_0x2cdd('0x29')](util[_0x2cdd('0x30')](_0x2cdd('0x4d'),_0x14566e['id'],_0x14566e[_0x2cdd('0x4e')],_0x4c55f5));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x2cdd('0x4f')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 3ae6073..db7e92b 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 _0xd3f9=['E_AGI_UNDEFINED','push','format','apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.'];(function(_0xc8ecaf,_0x64e979){var _0x285954=function(_0x38f7a8){while(--_0x38f7a8){_0xc8ecaf['push'](_0xc8ecaf['shift']());}};_0x285954(++_0x64e979);}(_0xd3f9,0x170));var _0x9d3f=function(_0x2c9be1,_0x4c45ce){_0x2c9be1=_0x2c9be1-0x0;var _0x389601=_0xd3f9[_0x2c9be1];return _0x389601;};'use strict';var util=require(_0x9d3f('0x0'));var error={'E_AGI_UNDEFINED':_0x9d3f('0x1'),'E_AGI_ARGUMENT_PORT':_0x9d3f('0x2'),'E_AGI_SERVER_ERROR':_0x9d3f('0x3'),'E_AGI_SERVER_CLOSE':_0x9d3f('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x9d3f('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x9d3f('0x6'),'E_AGI_SOCKET_ERROR':_0x9d3f('0x7'),'E_AGI_SOCKET_CLOSE':_0x9d3f('0x8'),'E_AGI_SOCKET_TIMEOUT':_0x9d3f('0x9'),'E_AGI_COMMAND_EMPTY':_0x9d3f('0xa'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x9d3f('0xb')};function AGIError(_0x345595){var _0x345595=_0x345595||null,_0x33a5ab=_0x33a5ab||[],_0x5a075a=0x1,_0x178ab6='';if(!error[_0x345595]){_0x345595=_0x9d3f('0xc');}_0x33a5ab[_0x9d3f('0xd')](error[_0x345595]);while(arguments[_0x5a075a]){_0x33a5ab[_0x9d3f('0xd')](arguments[_0x5a075a]);_0x5a075a++;}_0x178ab6=util[_0x9d3f('0xe')][_0x9d3f('0xf')](util,_0x33a5ab);this[_0x9d3f('0x10')]=_0x178ab6;this[_0x9d3f('0x11')]=_0x345595;}module[_0x9d3f('0x12')]=AGIError; \ No newline at end of file +var _0x1ce9=['Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','message','name','exports','util','Undefined\x20error.'];(function(_0x2c9956,_0x3fb838){var _0x503855=function(_0x5ba9b6){while(--_0x5ba9b6){_0x2c9956['push'](_0x2c9956['shift']());}};_0x503855(++_0x3fb838);}(_0x1ce9,0x10c));var _0x91ce=function(_0x4cd73d,_0x356ffb){_0x4cd73d=_0x4cd73d-0x0;var _0x2955fc=_0x1ce9[_0x4cd73d];return _0x2955fc;};'use strict';var util=require(_0x91ce('0x0'));var error={'E_AGI_UNDEFINED':_0x91ce('0x1'),'E_AGI_ARGUMENT_PORT':_0x91ce('0x2'),'E_AGI_SERVER_ERROR':_0x91ce('0x3'),'E_AGI_SERVER_CLOSE':_0x91ce('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x91ce('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x91ce('0x6'),'E_AGI_SOCKET_ERROR':_0x91ce('0x7'),'E_AGI_SOCKET_CLOSE':_0x91ce('0x8'),'E_AGI_SOCKET_TIMEOUT':_0x91ce('0x9'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x91ce('0xa'),'E_AGI_IVR_ENTRY':_0x91ce('0xb')};function AGIError(_0x1213c7){var _0x1213c7=_0x1213c7||null,_0x44021a=_0x44021a||[],_0x4a0a1c=0x1,_0x74804='';if(!error[_0x1213c7]){_0x1213c7=_0x91ce('0xc');}_0x44021a[_0x91ce('0xd')](error[_0x1213c7]);while(arguments[_0x4a0a1c]){_0x44021a['push'](arguments[_0x4a0a1c]);_0x4a0a1c++;}_0x74804=util['format'][_0x91ce('0xe')](util,_0x44021a);this[_0x91ce('0xf')]=_0x74804;this[_0x91ce('0x10')]=_0x1213c7;}module[_0x91ce('0x11')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 14b6402..d4fa127 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 _0xbf64=['no\x20edge/s\x20available','condition','split','agicommand','target','default','invalid','vswitch','default\x20on\x20switch\x20not\x20found','includes','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','edges','numberOfEdges','prototype','addVertex','vertices','addEdge','push','size','relations','traverseBFS','info','stop\x20traverse','length'];(function(_0xa661d5,_0x15f163){var _0x30c37f=function(_0x25560d){while(--_0x25560d){_0xa661d5['push'](_0xa661d5['shift']());}};_0x30c37f(++_0x15f163);}(_0xbf64,0x123));var _0x4bf6=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0xbf64[_0x220f3f];return _0x1f170e;};'use strict';var _=require(_0x4bf6('0x0'));var logger=require(_0x4bf6('0x1'))(_0x4bf6('0x2'));var verticesWithRetry=[_0x4bf6('0x3'),_0x4bf6('0x4'),_0x4bf6('0x5')];var Graph=function(){this['vertices']={};this[_0x4bf6('0x6')]={};this[_0x4bf6('0x7')]=0x0;};Graph[_0x4bf6('0x8')][_0x4bf6('0x9')]=function(_0x4c194a){this[_0x4bf6('0xa')][_0x4c194a['id']]=_0x4c194a;this[_0x4bf6('0x6')][_0x4c194a['id']]=[];};Graph[_0x4bf6('0x8')][_0x4bf6('0xb')]=function(_0x745047,_0x1e01a7,_0x1abd97){this[_0x4bf6('0x6')][_0x745047][_0x4bf6('0xc')]({'target':_0x1e01a7,'condition':_0x1abd97});this[_0x4bf6('0x7')]+=0x1;};Graph[_0x4bf6('0x8')][_0x4bf6('0xd')]=function(){return _['size'](this[_0x4bf6('0xa')]);};Graph['prototype'][_0x4bf6('0xe')]=function(){return this[_0x4bf6('0x7')];};Graph[_0x4bf6('0x8')]['getVertex']=function(_0x12c86e){return this['vertices'][_0x12c86e];};Graph['prototype'][_0x4bf6('0xf')]=function(_0x49519f,_0x7efb6c){if(!this[_0x4bf6('0xa')][_0x49519f]){return logger[_0x4bf6('0x10')]('no\x20vertex\x20found');}var _0x394e61=_0x7efb6c(this[_0x4bf6('0xa')][_0x49519f]);if(!_0x394e61){return logger[_0x4bf6('0x10')](_0x4bf6('0x11'));}if(this['edges'][_0x49519f][_0x4bf6('0x12')]===0x0){return logger[_0x4bf6('0x10')](_0x4bf6('0x13'));}for(var _0x946e72=0x0,_0x2513e9=[],_0x1b6f05=![];_0x946e72\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','hangup','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','omit','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','toString','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','isUndefined','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','Project\x20%s\x20not\x20published','continueAt','getLicense','[LICENSE]\x20CHANNELS:\x20%s','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','port','listening','connection','xml2json','syncho','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./graph','./vertices','defaults','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[ERROR]\x20%s','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','toJson','mxGraphModel','agicommand','hasOwnProperty','retry','addVertex','length','source','target','value','getSquareProject','then','createSquareReport','catch'];(function(_0x1c7889,_0x24cd26){var _0x2f14e5=function(_0x9ae1b1){while(--_0x9ae1b1){_0x1c7889['push'](_0x1c7889['shift']());}};_0x2f14e5(++_0x24cd26);}(_0x8930,0x187));var _0x0893=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8930[_0x40a045];return _0x1a687c;};'use strict';var parser=require(_0x0893('0x0'));var _=require('lodash');var syncho=require(_0x0893('0x1'));var util=require('util');var moment=require(_0x0893('0x2'));var config=require(_0x0893('0x3'));var logger=require(_0x0893('0x4'))(_0x0893('0x5'));var utilLicense=require(_0x0893('0x6'));var rpc=require(_0x0893('0x7'));var mailRpc=require('./mailRpc');var Graph=require(_0x0893('0x8'));var Vertices=require(_0x0893('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x0893('0x5')]=_[_0x0893('0xa')](config[_0x0893('0x5')],{'ip':_0x0893('0xb'),'port':0x11dd});function connectionHandler(_0x52943e){process[_0x0893('0xc')](function(){syncho(function(){try{setChannelVariables(_0x52943e);agiHandler(_0x52943e);}catch(_0x3450e8){logger[_0x0893('0xd')](_0x3450e8[_0x0893('0xe')]);}});});}function listeningHandler(){console[_0x0893('0xf')](_0x0893('0x10'),config['agi']['port']);logger['info'](util[_0x0893('0x11')](_0x0893('0x12'),config[_0x0893('0x5')]['ip'],config[_0x0893('0x5')]['port']));}function errorHandler(_0x162665){if(_0x162665&&_0x162665[_0x0893('0x13')]&&_0x162665[_0x0893('0x14')]){logger['error'](util[_0x0893('0x11')]('[%s]\x20%s',_0x162665['name'],_0x162665[_0x0893('0x14')]));}else{logger[_0x0893('0xd')](util[_0x0893('0x11')](_0x0893('0x15'),_0x162665[_0x0893('0xe')]));}}function closeHandler(){logger[_0x0893('0x16')](util['format'](_0x0893('0x17'),this[_0x0893('0x18')],this['calleridname'],this[_0x0893('0x19')],this[_0x0893('0x1a')],this[_0x0893('0x1b')]));try{createSquareReport(this);}catch(_0x18fe5a){logger['error'](_0x18fe5a['stack']);}}function timeoutHandler(){logger['info'](util[_0x0893('0x11')](_0x0893('0x1c'),this['arg_1'],this[_0x0893('0x1d')],this[_0x0893('0x19')],this[_0x0893('0x1a')],this[_0x0893('0x1b')]));}function hangupHandler(){logger[_0x0893('0x16')](util[_0x0893('0x11')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this['calleridname'],this['callerid'],this['dnid'],this['uniqueid']));this['evtHangup']=!![];}function getRoot(_0x3701f8){return parser[_0x0893('0x1e')](_0x3701f8,{'object':!![]})[_0x0893('0x1f')]['root'];}function addVertex(_0x4b515b,_0x4a3819,_0x76651d){_0x4a3819[_0x0893('0x20')]=_0x76651d;if(_0x4a3819[_0x0893('0x21')]('retry')){_0x4a3819['maxRetry']=parseInt(_0x4a3819[_0x0893('0x22')],0xa);}_0x4b515b[_0x0893('0x23')](_['omit'](_0x4a3819,'mxCell'));}function initGraph(_0x21ab07,_0x5e96a3){var _0x277328=new Graph();for(var _0xbfda24 in _0x21ab07){if(_0x21ab07[_0x0893('0x21')](_0xbfda24)){if(_['isArray'](_0x21ab07[_0xbfda24])){for(var _0x1e21bc=0x0;_0x1e21bc<_0x21ab07[_0xbfda24][_0x0893('0x24')];_0x1e21bc+=0x1){addVertex(_0x277328,_0x21ab07[_0xbfda24][_0x1e21bc],_0xbfda24);}}else{addVertex(_0x277328,_0x21ab07[_0xbfda24],_0xbfda24);}}}for(var _0x81f511=0x0;_0x81f511<_0x5e96a3[_0x0893('0x24')];_0x81f511+=0x1){if(_0x5e96a3[_0x81f511][_0x0893('0x25')]&&_0x5e96a3[_0x81f511][_0x0893('0x26')]){_0x277328['addEdge'](_0x5e96a3[_0x81f511]['source'],_0x5e96a3[_0x81f511]['target'],_0x5e96a3[_0x81f511][_0x0893('0x27')]);}}return _0x277328;}function getSquareProject(_0x1e3249,_0x575aa9){rpc[_0x0893('0x28')](_0x1e3249)[_0x0893('0x29')](function(_0x1d96c6){_0x575aa9(null,_0x1d96c6);})['catch'](function(_0x1b9704){_0x575aa9(null,_0x1b9704);});}function createSquareReport(_0x1d40ea,_0xd1e813){rpc[_0x0893('0x2a')](_0x1d40ea)[_0x0893('0x29')](function(_0x43dc85){if(_0xd1e813){_0xd1e813(null,_0x43dc85);}})[_0x0893('0x2b')](function(_0x484ea5){if(_0xd1e813){_0xd1e813(null,_0x484ea5);}});}function setChannelVariables(_0x58c2d0){for(var _0x10719c in _0x58c2d0){if(_0x58c2d0[_0x0893('0x21')](_0x10719c)){if(_0x10719c[_0x0893('0x2c')](_0x0893('0x2d'))===0x0){_0x58c2d0[_0x10719c[_0x0893('0x2e')](0x4)]=_0x58c2d0[_0x10719c];delete _0x58c2d0[_0x10719c];}}}}function getLogFromObject(_0x268130){return util['inspect'](_0x268130,{'showHidden':![],'depth':null});}function agiHandler(_0x2125ee){var _0x4c445b,_0x4e791a,_0x569310,_0x19d68f,_0x4ddd1c;logger[_0x0893('0x2f')](_0x0893('0x30'),JSON[_0x0893('0x31')](_0x2125ee,null,0x2));logger[_0x0893('0x16')](util[_0x0893('0x11')](_0x0893('0x32'),_0x2125ee['arg_1'],_0x2125ee[_0x0893('0x1d')],_0x2125ee[_0x0893('0x19')],_0x2125ee[_0x0893('0x1a')],_0x2125ee[_0x0893('0x1b')]));_0x2125ee['on'](_0x0893('0xd'),errorHandler);_0x2125ee['on']('close',closeHandler);_0x2125ee['on']('timeout',timeoutHandler);_0x2125ee['evtHangup']=![];_0x2125ee['on'](_0x0893('0x33'),hangupHandler);var _0x3187cd=getSquareProject[_0x0893('0x34')](null,_0x2125ee[_0x0893('0x18')]);if(_0x3187cd){if(_0x3187cd['production']){_0x4c445b=getRoot(_0x3187cd[_0x0893('0x35')]);if(_0x4c445b&&_0x4c445b[_0x0893('0x36')]){logger['debug']('root',JSON['stringify'](_0x4c445b,null,0x2));_0x2125ee[_0x0893('0x37')]=moment()['format'](_0x0893('0x38'));_0x4e791a=initGraph(_[_0x0893('0x39')](_0x4c445b,_0x0893('0x3a')),_0x4c445b['mxCell']);_0x569310=new Vertices(_0x2125ee,rpc,mailRpc);logger[_0x0893('0x16')](util[_0x0893('0x11')](_0x0893('0x3b'),_0x2125ee[_0x0893('0x18')],_0x2125ee[_0x0893('0x1d')],_0x2125ee[_0x0893('0x19')],_0x2125ee[_0x0893('0x1a')],_0x2125ee['uniqueid']));_0x4e791a['traverseBFS'](_0x4c445b[_0x0893('0x36')]['id'],function(_0x48be63){try{_0x48be63=_0x569310[_0x0893('0x3c')](_0x48be63);logger[_0x0893('0x2f')](_0x0893('0x3d'),JSON[_0x0893('0x31')](_0x48be63,null,0x2));if(_0x48be63[_0x0893('0x20')]==='gotoc'){logger[_0x0893('0x16')](_0x0893('0x3e'));_0x2125ee[_0x0893('0x3f')]=_0x48be63[_0x0893('0x3f')]||_0x2125ee[_0x0893('0x3f')];_0x2125ee[_0x0893('0x40')]=_0x48be63[_0x0893('0x40')];_0x2125ee[_0x0893('0x41')]=_0x48be63[_0x0893('0x41')]?_0x48be63['priority']-0x1:0x1;return null;}else if(_0x48be63&&_0x569310[_0x48be63['agicommand']]){_0x4ddd1c=_0x569310[_0x48be63[_0x0893('0x20')]](_0x48be63);logger[_0x0893('0x16')](_0x0893('0x42'),JSON['stringify'](_0x4ddd1c,null,0x2));if(_0x4ddd1c&&_0x4ddd1c[_0x0893('0x43')]===AGI_CODE_SUCCESS&&_0x4ddd1c[_0x0893('0x44')]!==AGI_RESULT_ERROR&&!_0x2125ee['evtHangup']){logger[_0x0893('0x2f')](_0x0893('0x42'),getLogFromObject(_0x4ddd1c));return _['isUndefined'](_0x4ddd1c[_0x0893('0x44')])?null:_0x4ddd1c[_0x0893('0x44')][_0x0893('0x45')]();}else{logger[_0x0893('0xd')](_0x0893('0x42'),getLogFromObject(_0x4ddd1c));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x23661a){logger[_0x0893('0xd')](_0x23661a['stack']);return null;}});if(_0x4c445b[_0x0893('0x46')]){logger[_0x0893('0x16')](util[_0x0893('0x11')](_0x0893('0x47'),_0x2125ee[_0x0893('0x18')],_0x2125ee['calleridname'],_0x2125ee[_0x0893('0x19')],_0x2125ee['dnid'],_0x2125ee[_0x0893('0x1b')]));_0x4e791a[_0x0893('0x48')](_0x4c445b[_0x0893('0x46')]['id'],function(_0x50410b){try{_0x50410b=_0x569310[_0x0893('0x3c')](_0x50410b);logger[_0x0893('0x2f')]('vertex',JSON['stringify'](_0x50410b,null,0x2));if(_0x50410b&&_0x569310[_0x50410b[_0x0893('0x20')]]){_0x4ddd1c=_0x569310[_0x50410b[_0x0893('0x20')]](_0x50410b);if(_0x4ddd1c){logger[_0x0893('0x2f')](_0x0893('0x42'),getLogFromObject(_0x4ddd1c));return _[_0x0893('0x49')](_0x4ddd1c[_0x0893('0x44')])?null:_0x4ddd1c['result'][_0x0893('0x45')]();}else{logger[_0x0893('0xd')]('response',getLogFromObject(_0x4ddd1c));return null;}}else{logger[_0x0893('0xd')](_0x0893('0x4a'));return null;}}catch(_0x55ad3f){logger['error'](_0x55ad3f[_0x0893('0xe')]);return null;}});}logger['info'](util[_0x0893('0x11')](_0x0893('0x4b'),_0x2125ee['arg_1'],_0x2125ee[_0x0893('0x1d')],_0x2125ee['callerid'],_0x2125ee[_0x0893('0x1a')],_0x2125ee[_0x0893('0x1b')]));logger['info'](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x2125ee[_0x0893('0x3f')],_0x2125ee[_0x0893('0x40')],parseInt(_0x2125ee[_0x0893('0x41')],0xa)+0x1));_0x2125ee['continueAt'](_0x2125ee['context'],_0x2125ee[_0x0893('0x40')],parseInt(_0x2125ee[_0x0893('0x41')],0xa)+0x1);_0x2125ee[_0x0893('0x4c')]();}}else{logger[_0x0893('0xd')](util['format'](_0x0893('0x4d'),_0x2125ee[_0x0893('0x18')]));_0x2125ee[_0x0893('0x4e')](_0x2125ee[_0x0893('0x3f')],_0x2125ee[_0x0893('0x40')],parseInt(_0x2125ee[_0x0893('0x41')],0xa)+0x1);_0x2125ee[_0x0893('0x4c')]();}}else{logger[_0x0893('0xd')](util['format']('Project\x20%s\x20not\x20found',_0x2125ee[_0x0893('0x18')]));_0x2125ee[_0x0893('0x4e')](_0x2125ee[_0x0893('0x3f')],_0x2125ee[_0x0893('0x40')],parseInt(_0x2125ee[_0x0893('0x41')],0xa)+0x1);_0x2125ee[_0x0893('0x4c')]();}}function main(){var _0x446c15;return utilLicense[_0x0893('0x4f')]()[_0x0893('0x29')](function(_0x643fd6){if(_0x643fd6){if(_0x643fd6['voice']){if(_0x643fd6['callysquare']&&_0x643fd6['callysquare']>0x0){logger['info'](util[_0x0893('0x11')](_0x0893('0x50'),_0x643fd6[_0x0893('0x51')]));_0x446c15=_0x643fd6['callysquare'];}else{logger['info'](_0x0893('0x52'));}}else{logger[_0x0893('0x16')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x446c15=-0x1;}}})[_0x0893('0x2b')](function(_0x50e900){logger[_0x0893('0xd')](_0x0893('0x53'),_0x50e900[_0x0893('0xe')]);})[_0x0893('0x46')](function(){var _0x22dc7d=require('./server')(config[_0x0893('0x5')][_0x0893('0x54')],config[_0x0893('0x5')]['ip'],_0x446c15);_0x22dc7d['on'](_0x0893('0xd'),errorHandler);_0x22dc7d['on'](_0x0893('0x55'),listeningHandler);_0x22dc7d['on'](_0x0893('0x56'),connectionHandler);_0x22dc7d['on'](_0x0893('0x4c'),closeHandler);});}main(); \ No newline at end of file +var _0xf1db=['toJson','agicommand','hasOwnProperty','maxRetry','addVertex','omit','isArray','length','source','target','value','getSquareProject','then','createSquareReport','agi_','substring','inspect','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','start','joinAt','mxCell','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','isUndefined','result','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','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','continueAt','Project\x20%s\x20not\x20published','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./mailRpc','./graph','./vertices','defaults','127.0.0.1','nextTick','error','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','format','[%s]\x20%s','name','[ERROR]\x20%s','calleridname','callerid','dnid','arg_1','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup'];(function(_0x33de6e,_0x483020){var _0x20b705=function(_0x476648){while(--_0x476648){_0x33de6e['push'](_0x33de6e['shift']());}};_0x20b705(++_0x483020);}(_0xf1db,0x8d));var _0xbf1d=function(_0x8f5037,_0x3c7139){_0x8f5037=_0x8f5037-0x0;var _0x26fd81=_0xf1db[_0x8f5037];return _0x26fd81;};'use strict';var parser=require(_0xbf1d('0x0'));var _=require('lodash');var syncho=require(_0xbf1d('0x1'));var util=require(_0xbf1d('0x2'));var moment=require('moment');var config=require(_0xbf1d('0x3'));var logger=require(_0xbf1d('0x4'))(_0xbf1d('0x5'));var utilLicense=require(_0xbf1d('0x6'));var rpc=require('./rpc');var mailRpc=require(_0xbf1d('0x7'));var Graph=require(_0xbf1d('0x8'));var Vertices=require(_0xbf1d('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xbf1d('0x5')]=_[_0xbf1d('0xa')](config[_0xbf1d('0x5')],{'ip':_0xbf1d('0xb'),'port':0x11dd});function connectionHandler(_0x2848ed){process[_0xbf1d('0xc')](function(){syncho(function(){try{setChannelVariables(_0x2848ed);agiHandler(_0x2848ed);}catch(_0x52aad2){logger[_0xbf1d('0xd')](_0x52aad2[_0xbf1d('0xe')]);}});});}function listeningHandler(){console['log'](_0xbf1d('0xf'),config[_0xbf1d('0x5')][_0xbf1d('0x10')]);logger[_0xbf1d('0x11')](util['format'](_0xbf1d('0x12'),config['agi']['ip'],config[_0xbf1d('0x5')][_0xbf1d('0x10')]));}function errorHandler(_0x5f5154){if(_0x5f5154&&_0x5f5154['name']&&_0x5f5154[_0xbf1d('0x13')]){logger[_0xbf1d('0xd')](util[_0xbf1d('0x14')](_0xbf1d('0x15'),_0x5f5154[_0xbf1d('0x16')],_0x5f5154[_0xbf1d('0x13')]));}else{logger[_0xbf1d('0xd')](util[_0xbf1d('0x14')](_0xbf1d('0x17'),_0x5f5154[_0xbf1d('0xe')]));}}function closeHandler(){logger[_0xbf1d('0x11')](util[_0xbf1d('0x14')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0xbf1d('0x18')],this[_0xbf1d('0x19')],this[_0xbf1d('0x1a')],this['uniqueid']));try{createSquareReport(this);}catch(_0x5b0841){logger[_0xbf1d('0xd')](_0x5b0841[_0xbf1d('0xe')]);}}function timeoutHandler(){logger['info'](util[_0xbf1d('0x14')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xbf1d('0x1b')],this['calleridname'],this[_0xbf1d('0x19')],this['dnid'],this[_0xbf1d('0x1c')]));}function hangupHandler(){logger[_0xbf1d('0x11')](util[_0xbf1d('0x14')](_0xbf1d('0x1d'),this['arg_1'],this['calleridname'],this[_0xbf1d('0x19')],this[_0xbf1d('0x1a')],this[_0xbf1d('0x1c')]));this[_0xbf1d('0x1e')]=!![];}function getRoot(_0xe5b178){return parser[_0xbf1d('0x1f')](_0xe5b178,{'object':!![]})['mxGraphModel']['root'];}function addVertex(_0x540e0b,_0x37bd3c,_0x2f49df){_0x37bd3c[_0xbf1d('0x20')]=_0x2f49df;if(_0x37bd3c[_0xbf1d('0x21')]('retry')){_0x37bd3c[_0xbf1d('0x22')]=parseInt(_0x37bd3c['retry'],0xa);}_0x540e0b[_0xbf1d('0x23')](_[_0xbf1d('0x24')](_0x37bd3c,'mxCell'));}function initGraph(_0x3cfeb7,_0x52752d){var _0x31db77=new Graph();for(var _0x5a5fb2 in _0x3cfeb7){if(_0x3cfeb7[_0xbf1d('0x21')](_0x5a5fb2)){if(_[_0xbf1d('0x25')](_0x3cfeb7[_0x5a5fb2])){for(var _0x5c5074=0x0;_0x5c5074<_0x3cfeb7[_0x5a5fb2]['length'];_0x5c5074+=0x1){addVertex(_0x31db77,_0x3cfeb7[_0x5a5fb2][_0x5c5074],_0x5a5fb2);}}else{addVertex(_0x31db77,_0x3cfeb7[_0x5a5fb2],_0x5a5fb2);}}}for(var _0x236800=0x0;_0x236800<_0x52752d[_0xbf1d('0x26')];_0x236800+=0x1){if(_0x52752d[_0x236800][_0xbf1d('0x27')]&&_0x52752d[_0x236800][_0xbf1d('0x28')]){_0x31db77['addEdge'](_0x52752d[_0x236800]['source'],_0x52752d[_0x236800]['target'],_0x52752d[_0x236800][_0xbf1d('0x29')]);}}return _0x31db77;}function getSquareProject(_0x4b54e7,_0x13dceb){rpc[_0xbf1d('0x2a')](_0x4b54e7)[_0xbf1d('0x2b')](function(_0x4ff506){_0x13dceb(null,_0x4ff506);})['catch'](function(_0x5e8b1b){_0x13dceb(null,_0x5e8b1b);});}function createSquareReport(_0xd862ef,_0xa64bee){rpc[_0xbf1d('0x2c')](_0xd862ef)['then'](function(_0x9351b7){if(_0xa64bee){_0xa64bee(null,_0x9351b7);}})['catch'](function(_0x275ebf){if(_0xa64bee){_0xa64bee(null,_0x275ebf);}});}function setChannelVariables(_0x17e15f){for(var _0x402e93 in _0x17e15f){if(_0x17e15f[_0xbf1d('0x21')](_0x402e93)){if(_0x402e93['indexOf'](_0xbf1d('0x2d'))===0x0){_0x17e15f[_0x402e93[_0xbf1d('0x2e')](0x4)]=_0x17e15f[_0x402e93];delete _0x17e15f[_0x402e93];}}}}function getLogFromObject(_0x2e4279){return util[_0xbf1d('0x2f')](_0x2e4279,{'showHidden':![],'depth':null});}function agiHandler(_0x3260c3){var _0x3d9d6f,_0x14cf3e,_0x2ba923,_0x3a104f,_0xa1356f;logger[_0xbf1d('0x30')]('variables',JSON[_0xbf1d('0x31')](_0x3260c3,null,0x2));logger[_0xbf1d('0x11')](util[_0xbf1d('0x14')](_0xbf1d('0x32'),_0x3260c3[_0xbf1d('0x1b')],_0x3260c3[_0xbf1d('0x18')],_0x3260c3[_0xbf1d('0x19')],_0x3260c3[_0xbf1d('0x1a')],_0x3260c3[_0xbf1d('0x1c')]));_0x3260c3['on'](_0xbf1d('0xd'),errorHandler);_0x3260c3['on'](_0xbf1d('0x33'),closeHandler);_0x3260c3['on'](_0xbf1d('0x34'),timeoutHandler);_0x3260c3[_0xbf1d('0x1e')]=![];_0x3260c3['on'](_0xbf1d('0x35'),hangupHandler);var _0x4dffde=getSquareProject[_0xbf1d('0x36')](null,_0x3260c3[_0xbf1d('0x1b')]);if(_0x4dffde){if(_0x4dffde[_0xbf1d('0x37')]){_0x3d9d6f=getRoot(_0x4dffde[_0xbf1d('0x37')]);if(_0x3d9d6f&&_0x3d9d6f[_0xbf1d('0x38')]){logger[_0xbf1d('0x30')]('root',JSON['stringify'](_0x3d9d6f,null,0x2));_0x3260c3[_0xbf1d('0x39')]=moment()[_0xbf1d('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x14cf3e=initGraph(_[_0xbf1d('0x24')](_0x3d9d6f,_0xbf1d('0x3a')),_0x3d9d6f[_0xbf1d('0x3a')]);_0x2ba923=new Vertices(_0x3260c3,rpc,mailRpc);logger[_0xbf1d('0x11')](util[_0xbf1d('0x14')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3260c3['arg_1'],_0x3260c3['calleridname'],_0x3260c3[_0xbf1d('0x19')],_0x3260c3['dnid'],_0x3260c3[_0xbf1d('0x1c')]));_0x14cf3e['traverseBFS'](_0x3d9d6f['start']['id'],function(_0x6a5a72){try{_0x6a5a72=_0x2ba923[_0xbf1d('0x3b')](_0x6a5a72);logger['debug']('vertex',JSON[_0xbf1d('0x31')](_0x6a5a72,null,0x2));if(_0x6a5a72['agicommand']===_0xbf1d('0x3c')){logger[_0xbf1d('0x11')](_0xbf1d('0x3d'));_0x3260c3[_0xbf1d('0x3e')]=_0x6a5a72['context']||_0x3260c3[_0xbf1d('0x3e')];_0x3260c3[_0xbf1d('0x3f')]=_0x6a5a72[_0xbf1d('0x3f')];_0x3260c3['priority']=_0x6a5a72[_0xbf1d('0x40')]?_0x6a5a72[_0xbf1d('0x40')]-0x1:0x1;return null;}else if(_0x6a5a72&&_0x2ba923[_0x6a5a72[_0xbf1d('0x20')]]){_0xa1356f=_0x2ba923[_0x6a5a72[_0xbf1d('0x20')]](_0x6a5a72);logger[_0xbf1d('0x11')](_0xbf1d('0x41'),JSON[_0xbf1d('0x31')](_0xa1356f,null,0x2));if(_0xa1356f&&_0xa1356f['code']===AGI_CODE_SUCCESS&&_0xa1356f['result']!==AGI_RESULT_ERROR&&!_0x3260c3[_0xbf1d('0x1e')]){logger[_0xbf1d('0x30')](_0xbf1d('0x41'),getLogFromObject(_0xa1356f));return _[_0xbf1d('0x42')](_0xa1356f['result'])?null:_0xa1356f[_0xbf1d('0x43')]['toString']();}else{logger[_0xbf1d('0xd')](_0xbf1d('0x41'),getLogFromObject(_0xa1356f));return null;}}else{logger[_0xbf1d('0xd')](_0xbf1d('0x44'));return null;}}catch(_0x4f1130){logger[_0xbf1d('0xd')](_0x4f1130['stack']);return null;}});if(_0x3d9d6f[_0xbf1d('0x45')]){logger[_0xbf1d('0x11')](util[_0xbf1d('0x14')](_0xbf1d('0x46'),_0x3260c3[_0xbf1d('0x1b')],_0x3260c3[_0xbf1d('0x18')],_0x3260c3[_0xbf1d('0x19')],_0x3260c3[_0xbf1d('0x1a')],_0x3260c3['uniqueid']));_0x14cf3e[_0xbf1d('0x47')](_0x3d9d6f[_0xbf1d('0x45')]['id'],function(_0xdb4efa){try{_0xdb4efa=_0x2ba923[_0xbf1d('0x3b')](_0xdb4efa);logger[_0xbf1d('0x30')]('vertex',JSON[_0xbf1d('0x31')](_0xdb4efa,null,0x2));if(_0xdb4efa&&_0x2ba923[_0xdb4efa[_0xbf1d('0x20')]]){_0xa1356f=_0x2ba923[_0xdb4efa['agicommand']](_0xdb4efa);if(_0xa1356f){logger[_0xbf1d('0x30')](_0xbf1d('0x41'),getLogFromObject(_0xa1356f));return _['isUndefined'](_0xa1356f['result'])?null:_0xa1356f[_0xbf1d('0x43')][_0xbf1d('0x48')]();}else{logger[_0xbf1d('0xd')](_0xbf1d('0x41'),getLogFromObject(_0xa1356f));return null;}}else{logger['error'](_0xbf1d('0x44'));return null;}}catch(_0x1fb139){logger['error'](_0x1fb139[_0xbf1d('0xe')]);return null;}});}logger[_0xbf1d('0x11')](util[_0xbf1d('0x14')](_0xbf1d('0x49'),_0x3260c3['arg_1'],_0x3260c3[_0xbf1d('0x18')],_0x3260c3['callerid'],_0x3260c3['dnid'],_0x3260c3[_0xbf1d('0x1c')]));logger[_0xbf1d('0x11')](util[_0xbf1d('0x14')](_0xbf1d('0x4a'),_0x3260c3[_0xbf1d('0x3e')],_0x3260c3['extension'],parseInt(_0x3260c3[_0xbf1d('0x40')],0xa)+0x1));_0x3260c3[_0xbf1d('0x4b')](_0x3260c3[_0xbf1d('0x3e')],_0x3260c3[_0xbf1d('0x3f')],parseInt(_0x3260c3[_0xbf1d('0x40')],0xa)+0x1);_0x3260c3['close']();}}else{logger[_0xbf1d('0xd')](util[_0xbf1d('0x14')](_0xbf1d('0x4c'),_0x3260c3[_0xbf1d('0x1b')]));_0x3260c3[_0xbf1d('0x4b')](_0x3260c3['context'],_0x3260c3['extension'],parseInt(_0x3260c3[_0xbf1d('0x40')],0xa)+0x1);_0x3260c3['close']();}}else{logger[_0xbf1d('0xd')](util[_0xbf1d('0x14')]('Project\x20%s\x20not\x20found',_0x3260c3[_0xbf1d('0x1b')]));_0x3260c3[_0xbf1d('0x4b')](_0x3260c3[_0xbf1d('0x3e')],_0x3260c3[_0xbf1d('0x3f')],parseInt(_0x3260c3[_0xbf1d('0x40')],0xa)+0x1);_0x3260c3['close']();}}function main(){var _0x569c57;return utilLicense['getLicense']()[_0xbf1d('0x2b')](function(_0x10f1c0){if(_0x10f1c0){if(_0x10f1c0[_0xbf1d('0x4d')]){if(_0x10f1c0['callysquare']&&_0x10f1c0[_0xbf1d('0x4e')]>0x0){logger[_0xbf1d('0x11')](util[_0xbf1d('0x14')](_0xbf1d('0x4f'),_0x10f1c0[_0xbf1d('0x4e')]));_0x569c57=_0x10f1c0['callysquare'];}else{logger[_0xbf1d('0x11')](_0xbf1d('0x50'));}}else{logger[_0xbf1d('0x11')](_0xbf1d('0x51'));_0x569c57=-0x1;}}})['catch'](function(_0x4e079b){logger[_0xbf1d('0xd')](_0xbf1d('0x52'),_0x4e079b[_0xbf1d('0xe')]);})[_0xbf1d('0x45')](function(){var _0x175bb4=require(_0xbf1d('0x53'))(config[_0xbf1d('0x5')][_0xbf1d('0x10')],config['agi']['ip'],_0x569c57);_0x175bb4['on']('error',errorHandler);_0x175bb4['on'](_0xbf1d('0x54'),listeningHandler);_0x175bb4['on'](_0xbf1d('0x55'),connectionHandler);_0x175bb4['on'](_0xbf1d('0x33'),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 e855eda..2f1c112 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 _0xd229=['message','result','catch','sendMailMessage','SendMail','bluebird','client','request','error'];(function(_0x45d1fd,_0x463212){var _0xd0e542=function(_0x23ebc9){while(--_0x23ebc9){_0x45d1fd['push'](_0x45d1fd['shift']());}};_0xd0e542(++_0x463212);}(_0xd229,0x137));var _0x9d22=function(_0x5ce3c8,_0x2503bd){_0x5ce3c8=_0x5ce3c8-0x0;var _0xa76867=_0xd229[_0x5ce3c8];return _0xa76867;};'use strict';var BPromise=require(_0x9d22('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x9d22('0x1')]['http']({'port':0x232b});function request(_0x1626cc,_0x3ac955){return new BPromise(function(_0x40f177,_0x58075f){return client[_0x9d22('0x2')](_0x1626cc,_0x3ac955)['then'](function(_0x271896){if(_0x271896[_0x9d22('0x3')]){return _0x58075f(_0x271896[_0x9d22('0x3')][_0x9d22('0x4')]);}else{return _0x40f177(_0x271896[_0x9d22('0x5')]);}})[_0x9d22('0x6')](function(_0x19ecd3){return _0x58075f(_0x19ecd3);});});}exports[_0x9d22('0x7')]=function(_0x57727d,_0x44595e){return request(_0x9d22('0x8'),{'account':_0x57727d,'message':_0x44595e});}; \ No newline at end of file +var _0xa34c=['SendMail','bluebird','jayson/promise','client','http','request','then','error','message','result','sendMailMessage'];(function(_0x22b671,_0x150a2a){var _0x4bd474=function(_0x4e9236){while(--_0x4e9236){_0x22b671['push'](_0x22b671['shift']());}};_0x4bd474(++_0x150a2a);}(_0xa34c,0x16c));var _0xca34=function(_0x94e69,_0x41892b){_0x94e69=_0x94e69-0x0;var _0x415667=_0xa34c[_0x94e69];return _0x415667;};'use strict';var BPromise=require(_0xca34('0x0'));var jayson=require(_0xca34('0x1'));var client=jayson[_0xca34('0x2')][_0xca34('0x3')]({'port':0x232b});function request(_0x5f0126,_0x312be6){return new BPromise(function(_0xc83c5a,_0xe7369f){return client[_0xca34('0x4')](_0x5f0126,_0x312be6)[_0xca34('0x5')](function(_0x4e5c1c){if(_0x4e5c1c[_0xca34('0x6')]){return _0xe7369f(_0x4e5c1c[_0xca34('0x6')][_0xca34('0x7')]);}else{return _0xc83c5a(_0x4e5c1c[_0xca34('0x8')]);}})['catch'](function(_0x4313f2){return _0xe7369f(_0x4313f2);});});}exports[_0xca34('0x9')]=function(_0x5c32e3,_0x233124){return request(_0xca34('0xa'),{'account':_0x5c32e3,'message':_0x233124});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index fb00e57..f6e9d22 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 _0x0e1e=['inherits','prototype','_transform','\x0d\x0a\x0d\x0a','substring','length','split','indexOf','slice','trim','emit','headers','exports','util','stream','Transform','call','_localBuffer','_inBody'];(function(_0x3dcfbf,_0xa4f61f){var _0x4284cf=function(_0x28e328){while(--_0x28e328){_0x3dcfbf['push'](_0x3dcfbf['shift']());}};_0x4284cf(++_0xa4f61f);}(_0x0e1e,0x13d));var _0xe0e1=function(_0x7880d2,_0x32e7d6){_0x7880d2=_0x7880d2-0x0;var _0x35ebbe=_0x0e1e[_0x7880d2];return _0x35ebbe;};'use strict';var util=require(_0xe0e1('0x0'));var Transform=require(_0xe0e1('0x1'))[_0xe0e1('0x2')];function AGIReply(_0x14705c){Transform[_0xe0e1('0x3')](this,_0x14705c);this[_0xe0e1('0x4')]='';this[_0xe0e1('0x5')]=![];}util[_0xe0e1('0x6')](AGIReply,Transform);AGIReply[_0xe0e1('0x7')][_0xe0e1('0x8')]=function(_0x22435a,_0x40d3e8,_0x5d14e1){var _0x3001c8='\x0a',_0x86902a=['\x0a\x0a',_0xe0e1('0x9')],_0x56db8a=-0x1,_0x2b0907=-0x1,_0x2d0e72='',_0xa5e94a=0x0,_0x11011f='',_0x52aa2d='';this['_localBuffer']+=_0x22435a['toString']();_0x11011f=this[_0xe0e1('0x4')];if(!this[_0xe0e1('0x5')]){_0xa5e94a=0x0;while(_0x86902a[_0xa5e94a]){while((_0x2b0907=_0x11011f['indexOf'](_0x86902a[_0xa5e94a]))!=-0x1){_0x2d0e72=_0x86902a[_0xa5e94a];_0x52aa2d=_0x11011f['substring'](0x0,_0x2b0907);_0x11011f=_0x11011f[_0xe0e1('0xa')](_0x2b0907+_0x2d0e72[_0xe0e1('0xb')]);var _0x36efed=_0x52aa2d[_0xe0e1('0xc')](_0x3001c8),_0x1abfef=0x0,_0x38561b={},_0x2bc63f='',_0x1f93f1='',_0x231387=-0x1;while(_0x36efed[_0x1abfef]){_0x231387=_0x36efed[_0x1abfef][_0xe0e1('0xd')](':');if(_0x231387!=-0x1){_0x2bc63f=_0x36efed[_0x1abfef][_0xe0e1('0xe')](0x0,_0x231387)[_0xe0e1('0xf')]();_0x1f93f1=_0x36efed[_0x1abfef][_0xe0e1('0xe')](_0x231387+0x1)['trim']();if(_0x2bc63f['length']>0x0){_0x38561b[_0x2bc63f]=_0x1f93f1;}}else{}_0x1abfef++;}this[_0xe0e1('0x10')](_0xe0e1('0x11'),_0x38561b);this[_0xe0e1('0x5')]=!![];}_0xa5e94a++;}this[_0xe0e1('0x4')]=_0x11011f;}else{while((_0x56db8a=_0x11011f[_0xe0e1('0xd')](_0x3001c8))!=-0x1){_0x52aa2d=_0x11011f[_0xe0e1('0xa')](0x0,_0x56db8a);this[_0xe0e1('0x10')]('line',_0x52aa2d);_0x11011f=_0x11011f[_0xe0e1('0xa')](_0x56db8a+_0x3001c8[_0xe0e1('0xb')]);}this[_0xe0e1('0x4')]=_0x11011f;}_0x5d14e1();};module[_0xe0e1('0x12')]=AGIReply; \ No newline at end of file +var _0xb36c=['Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','toString','substring','length','slice','trim','emit','headers','indexOf','line','exports','util','stream'];(function(_0x32b122,_0x1ad490){var _0x4ad25a=function(_0x590ee6){while(--_0x590ee6){_0x32b122['push'](_0x32b122['shift']());}};_0x4ad25a(++_0x1ad490);}(_0xb36c,0xbc));var _0xcb36=function(_0x21045c,_0x52f950){_0x21045c=_0x21045c-0x0;var _0x2daa90=_0xb36c[_0x21045c];return _0x2daa90;};'use strict';var util=require(_0xcb36('0x0'));var Transform=require(_0xcb36('0x1'))[_0xcb36('0x2')];function AGIReply(_0x59f54b){Transform[_0xcb36('0x3')](this,_0x59f54b);this[_0xcb36('0x4')]='';this[_0xcb36('0x5')]=![];}util[_0xcb36('0x6')](AGIReply,Transform);AGIReply[_0xcb36('0x7')][_0xcb36('0x8')]=function(_0x195a5c,_0x244084,_0x4879d1){var _0x431871='\x0a',_0x55e7ab=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x474816=-0x1,_0x2e8cc1=-0x1,_0x113ab6='',_0x557f17=0x0,_0xc3ce11='',_0x2cf78a='';this[_0xcb36('0x4')]+=_0x195a5c[_0xcb36('0x9')]();_0xc3ce11=this[_0xcb36('0x4')];if(!this[_0xcb36('0x5')]){_0x557f17=0x0;while(_0x55e7ab[_0x557f17]){while((_0x2e8cc1=_0xc3ce11['indexOf'](_0x55e7ab[_0x557f17]))!=-0x1){_0x113ab6=_0x55e7ab[_0x557f17];_0x2cf78a=_0xc3ce11[_0xcb36('0xa')](0x0,_0x2e8cc1);_0xc3ce11=_0xc3ce11[_0xcb36('0xa')](_0x2e8cc1+_0x113ab6[_0xcb36('0xb')]);var _0x3ebc04=_0x2cf78a['split'](_0x431871),_0x51216c=0x0,_0x3134cf={},_0x4bcfdd='',_0xd8e85c='',_0x53cdb4=-0x1;while(_0x3ebc04[_0x51216c]){_0x53cdb4=_0x3ebc04[_0x51216c]['indexOf'](':');if(_0x53cdb4!=-0x1){_0x4bcfdd=_0x3ebc04[_0x51216c][_0xcb36('0xc')](0x0,_0x53cdb4)[_0xcb36('0xd')]();_0xd8e85c=_0x3ebc04[_0x51216c][_0xcb36('0xc')](_0x53cdb4+0x1)[_0xcb36('0xd')]();if(_0x4bcfdd[_0xcb36('0xb')]>0x0){_0x3134cf[_0x4bcfdd]=_0xd8e85c;}}else{}_0x51216c++;}this[_0xcb36('0xe')](_0xcb36('0xf'),_0x3134cf);this[_0xcb36('0x5')]=!![];}_0x557f17++;}this['_localBuffer']=_0xc3ce11;}else{while((_0x474816=_0xc3ce11[_0xcb36('0x10')](_0x431871))!=-0x1){_0x2cf78a=_0xc3ce11[_0xcb36('0xa')](0x0,_0x474816);this[_0xcb36('0xe')](_0xcb36('0x11'),_0x2cf78a);_0xc3ce11=_0xc3ce11[_0xcb36('0xa')](_0x474816+_0x431871[_0xcb36('0xb')]);}this[_0xcb36('0x4')]=_0xc3ce11;}_0x4879d1();};module[_0xcb36('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 52b39c4..31e0d45 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 _0x72c7=['name','email','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','phone','CreateCmContact','getPauseById','ShowPause','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','util','jayson/promise','client','request','then','error','message','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','Smtp'];(function(_0x353a30,_0x50c68a){var _0x213161=function(_0x440b8b){while(--_0x440b8b){_0x353a30['push'](_0x353a30['shift']());}};_0x213161(++_0x50c68a);}(_0x72c7,0xda));var _0x772c=function(_0x155045,_0x5de8a4){_0x155045=_0x155045-0x0;var _0x1b995c=_0x72c7[_0x155045];return _0x1b995c;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require('lodash');var util=require(_0x772c('0x0'));var jayson=require(_0x772c('0x1'));var client=jayson[_0x772c('0x2')]['http']({'port':0x2329});function request(_0x24c4e1,_0x3fce4c){return new BPromise(function(_0x523c61,_0x2f163){return client[_0x772c('0x3')](_0x24c4e1,_0x3fce4c)[_0x772c('0x4')](function(_0x3eb783){if(_0x3eb783[_0x772c('0x5')]){return _0x2f163(_0x3eb783['error'][_0x772c('0x6')]);}else{return _0x523c61(_0x3eb783[_0x772c('0x7')]);}})[_0x772c('0x8')](function(_0x3a2702){return _0x2f163(_0x3a2702);});});}exports[_0x772c('0x9')]=function(_0x5667ea){return request(_0x772c('0xa'),{'options':{'raw':![],'where':{'name':_0x5667ea},'attributes':[_0x772c('0xb')]}});};exports[_0x772c('0xc')]=function(_0x1fbf08){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x1fbf08},'include':[{'model':'MailServerOut','as':_0x772c('0xd')}],'attributes':['id',_0x772c('0xe'),_0x772c('0xf')]}});};exports['getSquareProjectById']=function(_0x3ed345){return request(_0x772c('0xa'),{'options':{'where':{'id':_0x3ed345},'attributes':[_0x772c('0xe')]}});};exports[_0x772c('0x10')]=function(_0x5b2c52){return request(_0x772c('0x11'),{'options':{'where':{'id':_0x5b2c52},'attributes':[_0x772c('0xe')]}});};exports[_0x772c('0x12')]=function(_0x205a5f){return request('ShowVariable',{'options':{'where':{'id':_0x205a5f},'attributes':[_0x772c('0xe')]}});};exports[_0x772c('0x13')]=function(_0x14facc){return request(_0x772c('0x14'),{'options':{'where':{'id':_0x14facc},'attributes':[_0x772c('0x15')]}});};exports[_0x772c('0x16')]=function(_0x53e123){return request(_0x772c('0x17'),{'options':{'where':{'id':_0x53e123},'attributes':['name']}});};exports[_0x772c('0x18')]=function(_0x32651f){return request(_0x772c('0x19'),{'options':{'where':{'id':_0x32651f},'attributes':[_0x772c('0xe')]}});};exports['getSoundById']=function(_0x5b3d2b){return request(_0x772c('0x1a'),{'options':{'where':{'id':_0x5b3d2b},'attributes':[_0x772c('0x1b')]}});};exports[_0x772c('0x1c')]=function(_0x5a8c93){return request(_0x772c('0x1d'),{'options':{'raw':![],'where':{'id':_0x5a8c93},'include':[{'model':'Interval','as':_0x772c('0x1e')}]}});};exports[_0x772c('0x1f')]=function(_0x202bf2){return request(_0x772c('0x20'),{'options':{'where':{'id':_0x202bf2},'attributes':['id',_0x772c('0xe')]}});};exports[_0x772c('0x21')]=function(_0x42822f){return request(_0x772c('0x22'),{'body':_0x42822f});};exports[_0x772c('0x23')]=function(_0x58adea){return request(_0x772c('0x24'),{'body':_0x58adea});};exports[_0x772c('0x25')]=function(_0x27c581){return request(_0x772c('0x26'),{'body':_[_0x772c('0x27')](_0x27c581,{'project_name':_0x27c581[_0x772c('0x28')],'prev_project_name':_0x27c581[_0x772c('0x29')]||'','is_subproject':_0x27c581['arg_2']?!![]:![],'leaveAt':moment()['format'](_0x772c('0x2a'))})});};exports['createSquareRecording']=function(_0x51c6ea){return request(_0x772c('0x2b'),{'body':_0x51c6ea});};exports[_0x772c('0x2c')]=function(_0x54ebec){return request(_0x772c('0x2d'),{'body':_0x54ebec});};exports[_0x772c('0x2e')]=function(_0x34b5b1){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x34b5b1[_0x772c('0x2f')],'ListId':_0x34b5b1['ListId']}}})[_0x772c('0x4')](function(_0xe7b2c2){if(_0xe7b2c2){return _0xe7b2c2;}return request(_0x772c('0x30'),{'body':_0x34b5b1});});};exports[_0x772c('0x31')]=function(_0x458c07){return request(_0x772c('0x32'),{'options':{'where':{'id':_0x458c07},'attributes':[_0x772c('0xe')]}});};exports['agentLogin']=function(_0x59beec,_0x107dbf){return request(_0x772c('0x33'),{'body':{'interface':_0x107dbf},'options':{'where':_0x59beec}});};exports[_0x772c('0x34')]=function(_0x2bfee3,_0x34028d,_0x4debde){return request(_0x772c('0x35'),{'body':{'type':_0x34028d,'uniqueid':_0x4debde},'options':{'where':_0x2bfee3}});};exports[_0x772c('0x36')]=function(_0x191192){return request(_0x772c('0x37'),{'body':{},'options':{'where':_0x191192}});};exports[_0x772c('0x38')]=function(_0x2edddf){return request(_0x772c('0x39'),{'body':{},'options':{'where':_0x2edddf}});}; \ No newline at end of file +var _0xb75a=['createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','bluebird','moment','lodash','util','jayson/promise','client','http','then','error','getSquareProject','ShowSquareProject','production','getMailAccountById','MailServerOut','Smtp','getSquareProjectById','name','ShowVoiceQueue','getVariableById','ShowSquareOdbc','dsn','getUserById','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareReport','merge','arg_1','arg_2','format','createSquareRecording','CreateSquareMessage'];(function(_0x2f46c9,_0x348fb8){var _0x25da0f=function(_0x4089d2){while(--_0x4089d2){_0x2f46c9['push'](_0x2f46c9['shift']());}};_0x25da0f(++_0x348fb8);}(_0xb75a,0x6f));var _0xab75=function(_0x1b6563,_0x3bf0f1){_0x1b6563=_0x1b6563-0x0;var _0xdea7b8=_0xb75a[_0x1b6563];return _0xdea7b8;};'use strict';var BPromise=require(_0xab75('0x0'));var moment=require(_0xab75('0x1'));var _=require(_0xab75('0x2'));var util=require(_0xab75('0x3'));var jayson=require(_0xab75('0x4'));var client=jayson[_0xab75('0x5')][_0xab75('0x6')]({'port':0x2329});function request(_0x12693d,_0x4b5a65){return new BPromise(function(_0x2e72d3,_0x88815b){return client['request'](_0x12693d,_0x4b5a65)[_0xab75('0x7')](function(_0x28bd31){if(_0x28bd31[_0xab75('0x8')]){return _0x88815b(_0x28bd31[_0xab75('0x8')]['message']);}else{return _0x2e72d3(_0x28bd31['result']);}})['catch'](function(_0x547a8b){return _0x88815b(_0x547a8b);});});}exports[_0xab75('0x9')]=function(_0x41bdaf){return request(_0xab75('0xa'),{'options':{'raw':![],'where':{'name':_0x41bdaf},'attributes':[_0xab75('0xb')]}});};exports[_0xab75('0xc')]=function(_0x778ac2){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x778ac2},'include':[{'model':_0xab75('0xd'),'as':_0xab75('0xe')}],'attributes':['id','name','email']}});};exports[_0xab75('0xf')]=function(_0x2a44de){return request(_0xab75('0xa'),{'options':{'where':{'id':_0x2a44de},'attributes':[_0xab75('0x10')]}});};exports['getVoiceQueueById']=function(_0x2ff15a){return request(_0xab75('0x11'),{'options':{'where':{'id':_0x2ff15a},'attributes':['name']}});};exports[_0xab75('0x12')]=function(_0x5631b4){return request('ShowVariable',{'options':{'where':{'id':_0x5631b4},'attributes':[_0xab75('0x10')]}});};exports['getSquareOdbcById']=function(_0x19124f){return request(_0xab75('0x13'),{'options':{'where':{'id':_0x19124f},'attributes':[_0xab75('0x14')]}});};exports[_0xab75('0x15')]=function(_0x1ff7fb){return request('ShowUser',{'options':{'where':{'id':_0x1ff7fb},'attributes':[_0xab75('0x10')]}});};exports[_0xab75('0x16')]=function(_0x4c7ebb){return request(_0xab75('0x17'),{'options':{'where':{'id':_0x4c7ebb},'attributes':[_0xab75('0x10')]}});};exports[_0xab75('0x18')]=function(_0x1d4a14){return request(_0xab75('0x19'),{'options':{'where':{'id':_0x1d4a14},'attributes':[_0xab75('0x1a')]}});};exports['getIntervalById']=function(_0x42c850){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x42c850},'include':[{'model':'Interval','as':_0xab75('0x1b')}]}});};exports[_0xab75('0x1c')]=function(_0x175929){return request(_0xab75('0x1d'),{'options':{'where':{'id':_0x175929},'attributes':['id','name']}});};exports[_0xab75('0x1e')]=function(_0x277514){return request(_0xab75('0x1f'),{'body':_0x277514});};exports['createSquareDetailsReport']=function(_0x3fb91c){return request('CreateSquareDetailsReport',{'body':_0x3fb91c});};exports['createSquareReport']=function(_0x2412b9){return request(_0xab75('0x20'),{'body':_[_0xab75('0x21')](_0x2412b9,{'project_name':_0x2412b9[_0xab75('0x22')],'prev_project_name':_0x2412b9[_0xab75('0x23')]||'','is_subproject':_0x2412b9['arg_2']?!![]:![],'leaveAt':moment()[_0xab75('0x24')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xab75('0x25')]=function(_0x1f7dfb){return request('CreateSquareRecording',{'body':_0x1f7dfb});};exports['createSquareMessage']=function(_0x1c9f7b){return request(_0xab75('0x26'),{'body':_0x1c9f7b});};exports[_0xab75('0x27')]=function(_0x3c41e1){return request(_0xab75('0x28'),{'options':{'raw':![],'where':{'phone':_0x3c41e1[_0xab75('0x29')],'ListId':_0x3c41e1[_0xab75('0x2a')]}}})[_0xab75('0x7')](function(_0x2797b5){if(_0x2797b5){return _0x2797b5;}return request(_0xab75('0x2b'),{'body':_0x3c41e1});});};exports[_0xab75('0x2c')]=function(_0xddb151){return request('ShowPause',{'options':{'where':{'id':_0xddb151},'attributes':[_0xab75('0x10')]}});};exports[_0xab75('0x2d')]=function(_0x5afee6,_0x157805){return request(_0xab75('0x2e'),{'body':{'interface':_0x157805},'options':{'where':_0x5afee6}});};exports[_0xab75('0x2f')]=function(_0x271096,_0x46be65,_0x11c4df){return request(_0xab75('0x30'),{'body':{'type':_0x46be65,'uniqueid':_0x11c4df},'options':{'where':_0x271096}});};exports['agentUnpause']=function(_0x53e285){return request(_0xab75('0x31'),{'body':{},'options':{'where':_0x53e285}});};exports['agentLogout']=function(_0x1fe526){return request('LogoutUser',{'body':{},'options':{'where':_0x1fe526}});}; \ 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 fa67483..e3b80bd 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 _0xb89c=['./polly','./lex','exports'];(function(_0x4f4bd8,_0x1ac536){var _0xc39947=function(_0x862dae){while(--_0x862dae){_0x4f4bd8['push'](_0x4f4bd8['shift']());}};_0xc39947(++_0x1ac536);}(_0xb89c,0x198));var _0xcb89=function(_0x6cfe03,_0x3e527d){_0x6cfe03=_0x6cfe03-0x0;var _0x3b04c6=_0xb89c[_0x6cfe03];return _0x3b04c6;};var polly=require(_0xcb89('0x0'));var lex=require(_0xcb89('0x1'));module[_0xcb89('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x812d=['./lex','exports'];(function(_0x13c6b5,_0x4d97bf){var _0x3da107=function(_0x31d45a){while(--_0x31d45a){_0x13c6b5['push'](_0x13c6b5['shift']());}};_0x3da107(++_0x4d97bf);}(_0x812d,0x6e));var _0xd812=function(_0x32d6a9,_0x38a788){_0x32d6a9=_0x32d6a9-0x0;var _0x50e02c=_0x812d[_0x32d6a9];return _0x50e02c;};var polly=require('./polly');var lex=require(_0xd812('0x0'));module[_0xd812('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 48ec4cf..567fcec 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['./lib/api','exports'];(function(_0x166e96,_0x55191d){var _0x553d73=function(_0x586142){while(--_0x586142){_0x166e96['push'](_0x166e96['shift']());}};_0x553d73(++_0x55191d);}(_0xb43b,0x1b2));var _0xbb43=function(_0x36323f,_0x324dfe){_0x36323f=_0x36323f-0x0;var _0x55f0e1=_0xb43b[_0x36323f];return _0x55f0e1;};'use strict';var lex=require(_0xbb43('0x0'));module[_0xbb43('0x1')]=function(_0x5c45dd,_0x1bdcfc,_0x1995f8,_0x22bc86,_0x4cf605,_0x131e9e){return lex(_0x5c45dd,_0x1bdcfc,_0x1995f8,_0x22bc86,_0x4cf605,_0x131e9e);}; \ No newline at end of file +var _0xb43b=['./lib/api','exports'];(function(_0x74892f,_0x1e981b){var _0x10ee61=function(_0x3c480a){while(--_0x3c480a){_0x74892f['push'](_0x74892f['shift']());}};_0x10ee61(++_0x1e981b);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3f5c72,_0x414ecb){_0x3f5c72=_0x3f5c72-0x0;var _0x5ebb3c=_0xb43b[_0x3f5c72];return _0x5ebb3c;};'use strict';var lex=require(_0xbb43('0x0'));module[_0xbb43('0x1')]=function(_0x5c45dd,_0x1bdcfc,_0x1995f8,_0x22bc86,_0x4cf605,_0x131e9e){return lex(_0x5c45dd,_0x1bdcfc,_0x1995f8,_0x22bc86,_0x4cf605,_0x131e9e);}; \ 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 94830fd..f841f63 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(_0x3e33c9,_0x1f60f4){var _0x273f57=function(_0x2711ff){while(--_0x2711ff){_0x3e33c9['push'](_0x3e33c9['shift']());}};_0x273f57(++_0x1f60f4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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(_0x5533ce,_0x8d8b81){var _0x38a351=function(_0x2813ce){while(--_0x2813ce){_0x5533ce['push'](_0x5533ce['shift']());}};_0x38a351(++_0x8d8b81);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index cc357b3..1c8444e 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 _0x2620=['./lib/api'];(function(_0x5d6a9b,_0x143d7e){var _0x5684ab=function(_0x4264d6){while(--_0x4264d6){_0x5d6a9b['push'](_0x5d6a9b['shift']());}};_0x5684ab(++_0x143d7e);}(_0x2620,0x12c));var _0x0262=function(_0x37e886,_0x17d0ad){_0x37e886=_0x37e886-0x0;var _0x57c5cd=_0x2620[_0x37e886];return _0x57c5cd;};'use strict';var polly=require(_0x0262('0x0'));module['exports']=function(_0x2c503e,_0x504733,_0x4cdd92,_0x137fff,_0x1ff428,_0x2c660b,_0x507215){return polly(_0x2c503e,_0x504733,_0x4cdd92,_0x137fff,_0x1ff428,_0x2c660b,_0x507215);}; \ No newline at end of file +var _0x4eac=['./lib/api','exports'];(function(_0x1443e3,_0x1f01d4){var _0x3f1aea=function(_0x5bf193){while(--_0x5bf193){_0x1443e3['push'](_0x1443e3['shift']());}};_0x3f1aea(++_0x1f01d4);}(_0x4eac,0x1e8));var _0xc4ea=function(_0x424d7c,_0x25aa0b){_0x424d7c=_0x424d7c-0x0;var _0x3698ef=_0x4eac[_0x424d7c];return _0x3698ef;};'use strict';var polly=require(_0xc4ea('0x0'));module[_0xc4ea('0x1')]=function(_0x459958,_0x5617a7,_0x462bf7,_0x14bd87,_0x864ba,_0x4090d8,_0x3dff75){return polly(_0x459958,_0x5617a7,_0x462bf7,_0x14bd87,_0x864ba,_0x4090d8,_0x3dff75);}; \ 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 4a4a7a2..7484a28 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 _0x45e9=['text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports'];(function(_0x30a62b,_0x5bcf64){var _0x16bc3f=function(_0x458c35){while(--_0x458c35){_0x30a62b['push'](_0x30a62b['shift']());}};_0x16bc3f(++_0x5bcf64);}(_0x45e9,0xf4));var _0x945e=function(_0x90e7ce,_0x509991){_0x90e7ce=_0x90e7ce-0x0;var _0x5b6888=_0x45e9[_0x90e7ce];return _0x5b6888;};'use strict';var fs=require('fs');var path=require(_0x945e('0x0'));var BPromise=require(_0x945e('0x1'));var rs=require(_0x945e('0x2'));var AWS=require(_0x945e('0x3'));function pollyResult(_0x5bae40,_0x1a4bdd,_0x161178){return new BPromise(function(_0x19c57a,_0x415f69){_0x5bae40[_0x945e('0x4')](_0x1a4bdd,function(_0x222cd9,_0xc2967c){if(_0x222cd9){_0x415f69(_0x222cd9);}else if(_0xc2967c){if(_0xc2967c[_0x945e('0x5')]instanceof Buffer){fs['writeFile'](_0x161178,_0xc2967c['AudioStream'],function(_0x51a57f){if(_0x51a57f){_0x415f69(_0x51a57f);}else{_0x19c57a();}});}else{_0x415f69(new Error(_0x945e('0x6')));}}else{_0x415f69(new Error(_0x945e('0x7')));}});});}module[_0x945e('0x8')]=function(_0x5ad038,_0x276cca,_0xdfc3b9,_0xb10a09,_0x317e44,_0x430ec1,_0x8edb04){var _0x51b183=new AWS['Polly']({'accessKeyId':_0x5ad038,'secretAccessKey':_0x276cca,'region':_0xdfc3b9});var _0x3f1293={'Text':_0x317e44,'TextType':_0x430ec1||_0x945e('0x9'),'OutputFormat':_0x945e('0xa'),'VoiceId':_0xb10a09};return pollyResult(_0x51b183,_0x3f1293,_0x8edb04);}; \ No newline at end of file +var _0xd2a8=['synthesizeSpeech','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird','aws-sdk'];(function(_0x4c59d1,_0x6e4e01){var _0x3125c8=function(_0x29eacd){while(--_0x29eacd){_0x4c59d1['push'](_0x4c59d1['shift']());}};_0x3125c8(++_0x6e4e01);}(_0xd2a8,0x1f1));var _0x8d2a=function(_0x3c7d70,_0x212dfd){_0x3c7d70=_0x3c7d70-0x0;var _0x251c06=_0xd2a8[_0x3c7d70];return _0x251c06;};'use strict';var fs=require('fs');var path=require(_0x8d2a('0x0'));var BPromise=require(_0x8d2a('0x1'));var rs=require('randomstring');var AWS=require(_0x8d2a('0x2'));function pollyResult(_0x4b62e7,_0xa449da,_0x30ae28){return new BPromise(function(_0x28b900,_0x22092c){_0x4b62e7[_0x8d2a('0x3')](_0xa449da,function(_0x36d9f1,_0xd3e447){if(_0x36d9f1){_0x22092c(_0x36d9f1);}else if(_0xd3e447){if(_0xd3e447[_0x8d2a('0x4')]instanceof Buffer){fs['writeFile'](_0x30ae28,_0xd3e447[_0x8d2a('0x4')],function(_0x50066f){if(_0x50066f){_0x22092c(_0x50066f);}else{_0x28b900();}});}else{_0x22092c(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x22092c(new Error(_0x8d2a('0x5')));}});});}module[_0x8d2a('0x6')]=function(_0x702b97,_0x5cc60f,_0x286ecf,_0x41f914,_0x4e43bc,_0x3baceb,_0x30e38c){var _0x2b93fe=new AWS[(_0x8d2a('0x7'))]({'accessKeyId':_0x702b97,'secretAccessKey':_0x5cc60f,'region':_0x286ecf});var _0x1780af={'Text':_0x4e43bc,'TextType':_0x3baceb||_0x8d2a('0x8'),'OutputFormat':_0x8d2a('0x9'),'VoiceId':_0x41f914};return pollyResult(_0x2b93fe,_0x1780af,_0x30e38c);}; \ 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 4c15095..22d8d03 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 _0x805b=['exports','./lib/api'];(function(_0x2335fa,_0xda635e){var _0x84ceb8=function(_0x531672){while(--_0x531672){_0x2335fa['push'](_0x2335fa['shift']());}};_0x84ceb8(++_0xda635e);}(_0x805b,0x79));var _0xb805=function(_0xde0fa2,_0x49ec43){_0xde0fa2=_0xde0fa2-0x0;var _0x43a830=_0x805b[_0xde0fa2];return _0x43a830;};'use strict';var asr=require(_0xb805('0x0'));module[_0xb805('0x1')]=function(_0x2d2e5e,_0x3be91c,_0x1b9adc,_0x15463e){return asr(_0x2d2e5e,_0x3be91c,_0x1b9adc);}; \ No newline at end of file +var _0x2aae=['./lib/api','exports'];(function(_0x50e318,_0x103521){var _0x209b0f=function(_0x12897d){while(--_0x12897d){_0x50e318['push'](_0x50e318['shift']());}};_0x209b0f(++_0x103521);}(_0x2aae,0x18c));var _0xe2aa=function(_0x4f9149,_0x2694b0){_0x4f9149=_0x4f9149-0x0;var _0x419f59=_0x2aae[_0x4f9149];return _0x419f59;};'use strict';var asr=require(_0xe2aa('0x0'));module[_0xe2aa('0x1')]=function(_0xb38906,_0x3867a1,_0x4b15eb,_0x21825f){return asr(_0xb38906,_0x3867a1,_0x4b15eb);}; \ 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 1852ef6..2b43430 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 _0x8aa7=['toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync'];(function(_0x50f6d7,_0x27cefb){var _0x54db97=function(_0x193afc){while(--_0x193afc){_0x50f6d7['push'](_0x50f6d7['shift']());}};_0x54db97(++_0x27cefb);}(_0x8aa7,0xb6));var _0x78aa=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x8aa7[_0x381589];return _0x2a075d;};'use strict';var url=require('url');var BPromise=require(_0x78aa('0x0'));var fs=require('fs');var host=_0x78aa('0x1');module[_0x78aa('0x2')]=function(_0xa5cd25,_0x3d727e,_0x137fc0){return new BPromise(function(_0x21028b,_0x5b46d1){var _0x2b9bfa;if(typeof _0xa5cd25!==_0x78aa('0x3')||_0xa5cd25[_0x78aa('0x4')]===0x0){return _0x5b46d1(_0x78aa('0x5'));}if(typeof _0x3d727e!==_0x78aa('0x3')||_0x3d727e[_0x78aa('0x4')]===0x0){return _0x5b46d1(_0x78aa('0x6'));}if(typeof _0x137fc0!==_0x78aa('0x7')&&(typeof _0x137fc0!==_0x78aa('0x3')||_0x137fc0[_0x78aa('0x4')]===0x0)){return _0x5b46d1(_0x78aa('0x8'));}try{_0x2b9bfa=fs[_0x78aa('0x9')](_0xa5cd25)[_0x78aa('0xa')](_0x78aa('0xb'));}catch(_0x357ab1){return _0x5b46d1(_0x357ab1);}return _0x21028b({'method':_0x78aa('0xc'),'uri':host+_0x78aa('0xd')+_0x3d727e,'body':{'config':{'encoding':_0x78aa('0xe'),'sampleRateHertz':_0x78aa('0xf'),'languageCode':_0x137fc0},'audio':{'content':_0x2b9bfa}},'json':!![]});});}; \ No newline at end of file +var _0x87ae=['toString','POST','/v1/speech:recognize?key=','LINEAR16','8000','https://speech.googleapis.com','string','length','key\x20should\x20be\x20a\x20string','readFileSync'];(function(_0x41ad1c,_0x18b856){var _0x567184=function(_0x12ca12){while(--_0x12ca12){_0x41ad1c['push'](_0x41ad1c['shift']());}};_0x567184(++_0x18b856);}(_0x87ae,0xf5));var _0xe87a=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x87ae[_0x550d12];return _0x12103d;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0xe87a('0x0');module['exports']=function(_0x4ab66a,_0x2241d2,_0x44fc79){return new BPromise(function(_0x404a0a,_0x5a55b8){var _0x28899c;if(typeof _0x4ab66a!==_0xe87a('0x1')||_0x4ab66a[_0xe87a('0x2')]===0x0){return _0x5a55b8('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x2241d2!=='string'||_0x2241d2[_0xe87a('0x2')]===0x0){return _0x5a55b8(_0xe87a('0x3'));}if(typeof _0x44fc79!=='undefined'&&(typeof _0x44fc79!==_0xe87a('0x1')||_0x44fc79[_0xe87a('0x2')]===0x0)){return _0x5a55b8('lang\x20should\x20be\x20a\x20string');}try{_0x28899c=fs[_0xe87a('0x4')](_0x4ab66a)[_0xe87a('0x5')]('base64');}catch(_0x18cf9d){return _0x5a55b8(_0x18cf9d);}return _0x404a0a({'method':_0xe87a('0x6'),'uri':host+_0xe87a('0x7')+_0x2241d2,'body':{'config':{'encoding':_0xe87a('0x8'),'sampleRateHertz':_0xe87a('0x9'),'languageCode':_0x44fc79},'audio':{'content':_0x28899c}},'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 c167ca4..9cb6441 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 _0x5e9e=['exports'];(function(_0x20f52e,_0x596d5e){var _0x1489ca=function(_0x550038){while(--_0x550038){_0x20f52e['push'](_0x20f52e['shift']());}};_0x1489ca(++_0x596d5e);}(_0x5e9e,0x197));var _0xe5e9=function(_0x6cfbf6,_0x594cf1){_0x6cfbf6=_0x6cfbf6-0x0;var _0x537202=_0x5e9e[_0x6cfbf6];return _0x537202;};var asr=require('./asr');module[_0xe5e9('0x0')]={'asr':asr}; \ No newline at end of file +var _0x5b1d=['exports'];(function(_0xc93e9d,_0x39900c){var _0x4e5f84=function(_0x2e6bdc){while(--_0x2e6bdc){_0xc93e9d['push'](_0xc93e9d['shift']());}};_0x4e5f84(++_0x39900c);}(_0x5b1d,0x13f));var _0xd5b1=function(_0x3d5832,_0x373d4a){_0x3d5832=_0x3d5832-0x0;var _0xf79f94=_0x5b1d[_0x3d5832];return _0xf79f94;};var asr=require('./asr');module[_0xd5b1('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 6d3f0aa..d7c5d88 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 _0xda8d=['statusMessage','createWriteStream','finish\x20download\x20file','unlink','download\x20error','end','WHAT_EVER','data','transcode','wav','error\x20convert','info','finish\x20to\x20convert','resolve','generate','.wav','writeFileSync','base64','then','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','text:synthesize','POST','.mp3','from','chmodSync','777','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','jQ1olc','null','generic','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','tmp','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','stringify','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','status','metadata','isFallbackIntent','googleDialogflowV2','replace','detectIntent','queryResult','diagnosticInfo','fields','intent','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20confidence','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','apiai-promise','dialogflow','http','https','md5','path','querystring','sox','google-tts-api','url','parse','util','./aws','../../../config/logger','https://api.ispeech.org/api/rest','protocol','https:','host','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20'];(function(_0x46c083,_0x50af68){var _0x15a385=function(_0x2d48d7){while(--_0x2d48d7){_0x46c083['push'](_0x46c083['shift']());}};_0x15a385(++_0x50af68);}(_0xda8d,0x163));var _0xdda8=function(_0x3c64e4,_0x385581){_0x3c64e4=_0x3c64e4-0x0;var _0x546166=_0xda8d[_0x3c64e4];return _0x546166;};'use strict';var apiai=require(_0xdda8('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0xdda8('0x1'));var fs=require('fs');var http=require(_0xdda8('0x2'));var https=require(_0xdda8('0x3'));var md5=require(_0xdda8('0x4'));var path=require(_0xdda8('0x5'));var querystring=require(_0xdda8('0x6'));var rp=require('request-promise');var rs=require('randomstring');var sox=require(_0xdda8('0x7'));var tts=require(_0xdda8('0x8'));var urlParse=require(_0xdda8('0x9'))[_0xdda8('0xa')];var util=require(_0xdda8('0xb'));var aws=require(_0xdda8('0xc'));var google=require('./google');var sestek=require('./sestek');var tilde=require('./tilde');var logger=require(_0xdda8('0xd'))('agi');var ISPEECH_API=_0xdda8('0xe');function downloadFile(_0x163d26,_0x44c0b2){return new BPromise(function(_0x5cfbaa,_0x5826e6){var _0x2fdc72=urlParse(_0x163d26);var _0x1bad9a=_0x2fdc72[_0xdda8('0xf')]===_0xdda8('0x10')?https:http;var _0x42f3d8={'host':_0x2fdc72[_0xdda8('0x11')],'path':_0x2fdc72[_0xdda8('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x1bad9a[_0xdda8('0x12')](_0x42f3d8,function(_0x1392ae){if(_0x1392ae[_0xdda8('0x13')]!==0xc8){logger[_0xdda8('0x14')](_0xdda8('0x15')+_0x163d26+_0xdda8('0x16')+_0x1392ae[_0xdda8('0x13')]+'\x20('+_0x1392ae['statusMessage']+')');_0x5826e6(new Error(_0xdda8('0x15')+_0x163d26+'\x20failed,\x20status\x20code\x20=\x20'+_0x1392ae[_0xdda8('0x13')]+'\x20('+_0x1392ae[_0xdda8('0x17')]+')'));return;}var _0x4926a1=fs[_0xdda8('0x18')](_0x44c0b2);_0x4926a1['on']('finish',function(){logger['info'](_0xdda8('0x19'));_0x4926a1['close'](_0x5cfbaa);});_0x4926a1['on']('error',function(_0xb8766f){fs[_0xdda8('0x1a')](_0x44c0b2);logger[_0xdda8('0x14')](_0xdda8('0x1b'),_0xb8766f);_0x5826e6(_0xb8766f);});_0x1392ae['pipe'](_0x4926a1);})['on']('error',function(_0x5a3eab){logger[_0xdda8('0x14')](_0x5a3eab);_0x5826e6(_0x5a3eab);})[_0xdda8('0x1c')]();});}function uploadFile(_0x388dcd){return new BPromise(function(_0xd7f487,_0x4f1efe){var _0x1c9a93=urlParse(_0x388dcd);var _0x10db9c=_0x1c9a93[_0xdda8('0xf')]===_0xdda8('0x10')?https:http;var _0x103a86={'host':_0x1c9a93[_0xdda8('0x11')],'path':_0x1c9a93['path'],'headers':{'user-agent':_0xdda8('0x1d')}};_0x10db9c[_0xdda8('0x12')](_0x103a86,function(_0x55bd1f){if(_0x55bd1f[_0xdda8('0x13')]!==0xc8){_0x4f1efe(new Error(_0xdda8('0x15')+_0x388dcd+_0xdda8('0x16')+_0x55bd1f[_0xdda8('0x13')]+'\x20('+_0x55bd1f['statusMessage']+')'));return;}var _0x4cec02='';_0x55bd1f['on'](_0xdda8('0x1e'),function(_0x3222b9){_0x4cec02+=_0x3222b9;});_0x55bd1f['on'](_0xdda8('0x1c'),function(){_0xd7f487(_0x4cec02);});})['on'](_0xdda8('0x14'),function(_0x167885){_0x4f1efe(_0x167885);})[_0xdda8('0x1c')]();});}function convertFile(_0x49ca9a,_0x12cf3a){return new BPromise(function(_0x59c7ea,_0x573b66){var _0x1ecdbf=sox[_0xdda8('0x1f')](_0x49ca9a,_0x12cf3a,{'sampleRate':0x1f40,'format':_0xdda8('0x20'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1ecdbf['on'](_0xdda8('0x14'),function(_0x423111){logger['error'](_0xdda8('0x21'),_0x423111);_0x573b66(_0x423111);});_0x1ecdbf['on']('end',function(){logger[_0xdda8('0x22')](_0xdda8('0x23'));_0x59c7ea();});_0x1ecdbf['start']();});}function base64Decode(_0x52fe1c,_0x328cca){var _0x49c180=path[_0xdda8('0x24')](__dirname,'tmp',rs[_0xdda8('0x25')](0x4)+_0xdda8('0x26'));fs[_0xdda8('0x27')](_0x49c180,_0x52fe1c,_0xdda8('0x28'));return convertFile(_0x49c180,_0x328cca)[_0xdda8('0x29')](function(){try{fs['unlink'](_0x49c180);fs['chmodSync'](_0x328cca,'777');}catch(_0x55cd22){logger['error'](_0x55cd22);}return _0x328cca['split']('.')[0x0];});}function base64Encode(_0x2bde7c){var _0x158eaf=fs[_0xdda8('0x2a')](_0x2bde7c);return new Buffer(_0x158eaf)[_0xdda8('0x2b')](_0xdda8('0x28'));}exports[_0xdda8('0x2c')]=function(_0x5678a5,_0x3f673e,_0x117382,_0x118e2e,_0x2a2a1b,_0x3b8f21){var _0xea2f50,_0x574436;var _0x5c0c7f=_0xdda8('0x2d');var _0x5a5123=_0xdda8('0x2e')+_0x5678a5;var _0x1381a6={};if(_0x3f673e===_0xdda8('0x2f')){_0x1381a6[_0xdda8('0x30')]={'ssml':_0x117382};}else{_0x1381a6[_0xdda8('0x30')]={'text':_0x117382};};_0x1381a6[_0xdda8('0x31')]={'languageCode':_0x118e2e,'ssmlGender':_0x2a2a1b};_0x1381a6['audioConfig']={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x5b3578={'url':_0x5c0c7f+_0xdda8('0x32')+_0x5a5123,'method':_0xdda8('0x33'),'json':!![],'body':_0x1381a6};return rp(_0x5b3578)[_0xdda8('0x29')](function(_0x53fd71){return new BPromise(function(_0x3c3a30,_0xfef351){_0xea2f50=path[_0xdda8('0x24')](__dirname,'tmp',rs['generate'](0x4)+_0xdda8('0x34'));var _0x351792=Buffer[_0xdda8('0x35')](_0x53fd71['audioContent'],'base64');return fs['writeFile'](_0xea2f50,_0x351792,function(_0x394658){_0xfef351(_0x394658);},function(_0x123052){fs[_0xdda8('0x36')](_0xea2f50,_0xdda8('0x37'));_0x3c3a30(_0x123052);});});})['then'](function(_0x35d438){_0x574436=path[_0xdda8('0x24')](__dirname,'tmp',rs[_0xdda8('0x25')](0x4)+'.wav');return convertFile(_0xea2f50,_0x574436);})['then'](function(){try{fs[_0xdda8('0x1a')](_0xea2f50);fs[_0xdda8('0x36')](_0x574436,'777');}catch(_0x43e419){logger[_0xdda8('0x14')](_0x43e419);}logger['info']('googleCloudTTS\x20path',_0x574436[_0xdda8('0x38')]('.')[0x0]);return _0x574436[_0xdda8('0x38')]('.')[0x0];});};exports[_0xdda8('0x39')]=function(_0x350ad4,_0x210594){var _0x4265c4=_0xdda8('0x3a');var _0x4d2775,_0x44c2de;var _0x2bc876;var _0x2d2b66={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x4265c4,'headers':{'Content-Type':_0xdda8('0x3b')},'body':'f.req='+encodeURIComponent(JSON['stringify']([[[_0xdda8('0x3c'),JSON['stringify']([_0x350ad4,_0x210594||'en',![],_0xdda8('0x3d')]),null,_0xdda8('0x3e')]]]))};return rp(_0x2d2b66)[_0xdda8('0x29')](function(_0x1b2f44){try{_0x2bc876=eval(_0x1b2f44['slice'](0x5))[0x0][0x2];}catch(_0x2a688a){throw new Error(_0xdda8('0x3f')+_0x1b2f44['data']);}if(!_0x2bc876){if(_0x350ad4[_0xdda8('0x40')]>0xc8){throw new Error(_0xdda8('0x41'));}else{throw new Error(_0xdda8('0x42')+_0x210594+_0xdda8('0x43'));}}try{_0x2bc876=eval(_0x2bc876)[0x0];}catch(_0x4b0c50){throw new Error(_0xdda8('0x3f')+res[_0xdda8('0x1e')]);}const _0x533a78=_0x2bc876;_0x4d2775=path[_0xdda8('0x24')](__dirname,_0xdda8('0x44'),rs[_0xdda8('0x25')](0x4)+_0xdda8('0x34'));fs[_0xdda8('0x27')](_0x4d2775,_0x2bc876,{'encoding':_0xdda8('0x28')});_0x44c2de=path[_0xdda8('0x24')](__dirname,_0xdda8('0x44'),rs[_0xdda8('0x25')](0x4)+_0xdda8('0x26'));return convertFile(_0x4d2775,_0x44c2de);})[_0xdda8('0x29')](function(){try{fs[_0xdda8('0x1a')](_0x4d2775);fs[_0xdda8('0x36')](_0x44c2de,_0xdda8('0x37'));}catch(_0x547979){logger[_0xdda8('0x14')](_0x547979);}logger[_0xdda8('0x22')](_0xdda8('0x45'),_0x44c2de['split']('.')[0x0]);return _0x44c2de[_0xdda8('0x38')]('.')[0x0];});};exports[_0xdda8('0x46')]=function(_0x20540a,_0x30c23b,_0x402f75){return google[_0xdda8('0x47')](_0x20540a,_0x30c23b,_0x402f75)[_0xdda8('0x29')](function(_0x997c3a){logger[_0xdda8('0x22')](_0x997c3a[_0xdda8('0x48')]);return rp(_0x997c3a);})[_0xdda8('0x29')](function(_0x5edd01){var _0x3fb066='';var _0x3c8128=0x0;try{fs['unlink'](_0x20540a);}catch(_0x47d53){logger[_0xdda8('0x14')](_0x47d53);}if(_0x5edd01&&_0x5edd01[_0xdda8('0x49')]){_0x3fb066=_0x5edd01[_0xdda8('0x49')][_0xdda8('0x4a')](function(_0x526b40){return _0x526b40&&_0x526b40[_0xdda8('0x4b')][0x0]&&_0x526b40[_0xdda8('0x4b')][0x0]['transcript']?_0x526b40[_0xdda8('0x4b')][0x0][_0xdda8('0x4c')]:'';})[_0xdda8('0x4d')]('\x0a');_0x3c8128=_0x5edd01['results'][_0xdda8('0x4a')](function(_0x5be6e6){return _0x5be6e6&&_0x5be6e6['alternatives'][0x0]&&_0x5be6e6[_0xdda8('0x4b')][0x0][_0xdda8('0x4e')]?_0x5be6e6[_0xdda8('0x4b')][0x0][_0xdda8('0x4e')]:0x0;})['join']('\x0a');}logger[_0xdda8('0x22')](_0xdda8('0x4f'),_0x3fb066);logger['info'](_0xdda8('0x50'),_0x3c8128);return{'transcript':_0x3fb066,'confidence':_0x3c8128};})[_0xdda8('0x51')](function(_0x3a1522){logger[_0xdda8('0x14')]('[%s]\x20%s:%s',_0x3a1522[_0xdda8('0x13')],_0x3a1522[_0xdda8('0x52')],_0x3a1522[_0xdda8('0x53')]);});};exports[_0xdda8('0x54')]=function(_0x179d8f,_0x2d485b,_0x3bfa07,_0x2cbf9f){var _0x44c0ec=apiai(_0x2d485b,{'language':_0x2cbf9f||'en'});return _0x44c0ec[_0xdda8('0x55')](_0x3bfa07,{'sessionId':md5(_0x179d8f)})[_0xdda8('0x29')](function(_0x5292a4){logger[_0xdda8('0x22')](JSON[_0xdda8('0x56')](_0x5292a4));return{'source':_0x5292a4[_0xdda8('0x57')][_0xdda8('0x58')],'resolvedQuery':_0x5292a4['result'][_0xdda8('0x59')],'action':_0x5292a4[_0xdda8('0x57')][_0xdda8('0x5a')],'actionIncomplete':_0x5292a4['result'][_0xdda8('0x5b')],'speech':_0x5292a4[_0xdda8('0x57')][_0xdda8('0x5c')][_0xdda8('0x5d')],'score':_0x5292a4[_0xdda8('0x57')]['score'],'statusCode':_0x5292a4[_0xdda8('0x5e')]['code'],'endConversation':_0x5292a4[_0xdda8('0x57')][_0xdda8('0x5f')]['endConversation']||![],'isFallbackIntent':_0x5292a4['result'][_0xdda8('0x5f')][_0xdda8('0x60')]};});};exports[_0xdda8('0x61')]=function(_0x507de7,_0x50ddc2,_0x3ca80e,_0x5e8a8e,_0x415ccd,_0x5ce44b){var _0x10d9ce=_0x5e8a8e[_0xdda8('0x62')](/\\n/g,'\x0a');var _0x3ac14b={'credentials':{'private_key':_0x10d9ce,'client_email':_0x3ca80e}};var _0xb7ee9f=new dialogflow['SessionsClient'](_0x3ac14b);var _0x4948bd=_0xb7ee9f['sessionPath'](_0x50ddc2,md5(_0x507de7));var _0xcdcc8a={'session':_0x4948bd,'queryInput':{'text':{'text':_0x415ccd,'languageCode':_0x5ce44b}}};return _0xb7ee9f[_0xdda8('0x63')](_0xcdcc8a)['then'](function(_0xe12dea){if(_0xe12dea&&_0xe12dea[_0xdda8('0x40')]){logger[_0xdda8('0x22')]('Dialogflow\x20V2\x20response:',JSON[_0xdda8('0x56')](_0xe12dea));var _0x448b5a=_0xe12dea[0x0];if(_0x448b5a){var _0x365e1b={'action':_0x448b5a[_0xdda8('0x64')][_0xdda8('0x5a')],'allRequiredParamsPresent':_0x448b5a[_0xdda8('0x64')]['allRequiredParamsPresent'],'endConversation':_0x448b5a[_0xdda8('0x64')][_0xdda8('0x65')]&&_0x448b5a[_0xdda8('0x64')]['diagnosticInfo']['fields']?_0x448b5a[_0xdda8('0x64')][_0xdda8('0x65')][_0xdda8('0x66')]['end_conversation']['boolValue']:![],'fulfillmentText':_0x448b5a[_0xdda8('0x64')]['fulfillmentText'],'intentName':_0x448b5a[_0xdda8('0x64')][_0xdda8('0x67')][_0xdda8('0x52')],'intentDisplayName':_0x448b5a[_0xdda8('0x64')][_0xdda8('0x67')]['displayName'],'isFallbackIntent':_0x448b5a[_0xdda8('0x64')][_0xdda8('0x67')]['isFallback'],'languageCode':_0x448b5a[_0xdda8('0x64')]['languageCode'],'queryText':_0x448b5a[_0xdda8('0x64')]['queryText'],'responseId':_0x448b5a['responseId'],'score':_0x448b5a[_0xdda8('0x64')][_0xdda8('0x68')],'speech':_0x448b5a[_0xdda8('0x64')][_0xdda8('0x69')],'providerResponse':JSON[_0xdda8('0x56')](_0xe12dea)};return _0x365e1b;}}});};exports[_0xdda8('0x6a')]=function(_0x2e03ff,_0x59560a,_0x155086,_0x25b3d6){return tilde[_0xdda8('0x47')](_0x2e03ff,_0x59560a,_0x155086,_0x25b3d6)[_0xdda8('0x29')](function(_0x1f6cd1){try{fs[_0xdda8('0x1a')](_0x2e03ff);}catch(_0x4fc856){logger[_0xdda8('0x14')](_0x4fc856);}logger[_0xdda8('0x22')]('Tilde\x20ASR\x20transcription',_0x1f6cd1[_0xdda8('0x4c')]);logger[_0xdda8('0x22')](_0xdda8('0x6b'),_0x1f6cd1['confidence']);return _0x1f6cd1;});};exports['awsPolly']=function(_0x119870,_0x52e42f,_0xa4a28f,_0x1466f7,_0x3286ad,_0x5900be){var _0x3e4fbb=path[_0xdda8('0x24')](__dirname,_0xdda8('0x44'),rs[_0xdda8('0x25')](0x4)+'.mp3');var _0x2502ea;return aws[_0xdda8('0x6c')](_0x119870,_0x52e42f,_0xa4a28f,_0x1466f7,_0x3286ad,_0x5900be,_0x3e4fbb)[_0xdda8('0x29')](function(){_0x2502ea=path[_0xdda8('0x24')](__dirname,_0xdda8('0x44'),rs[_0xdda8('0x25')](0x4)+'.wav');return convertFile(_0x3e4fbb,_0x2502ea);})[_0xdda8('0x29')](function(){try{fs['unlink'](_0x3e4fbb);fs[_0xdda8('0x36')](_0x2502ea,_0xdda8('0x37'));}catch(_0x2bf4f4){logger[_0xdda8('0x14')](_0x2bf4f4);}return _0x2502ea[_0xdda8('0x38')]('.')[0x0];});};exports[_0xdda8('0x6d')]=function(_0x2f9f45,_0xfb7f1b,_0x255026,_0x2d0778,_0x56aa95,_0x43749b){return aws[_0xdda8('0x6e')](_0x2f9f45,_0xfb7f1b,_0x255026,_0x2d0778,_0x56aa95,_0x43749b)[_0xdda8('0x29')](function(_0x4e27de){logger['info'](JSON['stringify'](_0x4e27de));return _0x4e27de;});};exports[_0xdda8('0x6f')]=function(_0x474ee2,_0x5d3d20,_0xf198a3,_0x2da059){var _0x41589d=util[_0xdda8('0x70')](_0xdda8('0x71'),ISPEECH_API,_0x474ee2,encodeURIComponent(_0x5d3d20),_0xf198a3,_0x2da059);var _0x474ed9=path['resolve'](__dirname,'tmp',rs[_0xdda8('0x25')](0x4)+_0xdda8('0x34'));var _0x78796d;return downloadFile(_0x41589d,_0x474ed9)[_0xdda8('0x29')](function(){_0x78796d=path[_0xdda8('0x24')](__dirname,_0xdda8('0x44'),rs['generate'](0x4)+'.wav');return convertFile(_0x474ed9,_0x78796d);})[_0xdda8('0x29')](function(){try{fs[_0xdda8('0x1a')](_0x474ed9);fs[_0xdda8('0x36')](_0x78796d,'777');}catch(_0x5bdd02){logger[_0xdda8('0x14')](_0x5bdd02);}return _0x78796d['split']('.')[0x0];});};exports[_0xdda8('0x72')]=function(_0x2f190b,_0x593255,_0x196aac,_0x3a1426){var _0x5a7d7b=util[_0xdda8('0x70')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x593255,_0x196aac,base64Encode(_0x2f190b),_0x3a1426?util['format'](_0xdda8('0x73'),encodeURIComponent(_0x3a1426)):_0xdda8('0x74'));return uploadFile(_0x5a7d7b)['then'](function(_0x5840f1){return querystring[_0xdda8('0xa')](_0x5840f1);});};exports[_0xdda8('0x75')]=function(_0x5fccfb,_0x5448c9){return sestek[_0xdda8('0x76')](_0x5fccfb,_0x5448c9)[_0xdda8('0x29')](function(_0x51f718){logger[_0xdda8('0x22')](JSON[_0xdda8('0x56')](_0x51f718));var _0x36bd50={'speech':_0x51f718[_0xdda8('0x77')],'action':_0x51f718['channelData']?_0x51f718[_0xdda8('0x78')][_0xdda8('0x79')]:undefined,'actiondata':_0x51f718[_0xdda8('0x78')]?_0x51f718[_0xdda8('0x78')]['CustomActionData']:undefined};if(_0x51f718[_0xdda8('0x78')]&&_0x51f718[_0xdda8('0x78')][_0xdda8('0x7a')]){return base64Decode(_0x51f718[_0xdda8('0x78')][_0xdda8('0x7a')][_0xdda8('0x7b')],path[_0xdda8('0x24')](__dirname,'tmp',rs[_0xdda8('0x25')](0x4)+_0xdda8('0x26')))['then'](function(_0x5670ea){_0x36bd50[_0xdda8('0x7c')]=_0x5670ea;return _0x36bd50;});}return _0x36bd50;});};exports[_0xdda8('0x7d')]=function(){return __dirname;}; \ No newline at end of file +var _0x7869=['alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','endConversation','metadata','replace','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','channelData','CustomActionData','AudioFromTts','audiofile','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','host','WHAT_EVER','statusCode','request\x20to\x20','statusMessage','info','finish\x20download\x20file','close','error','unlink','pipe','protocol','get','wav','start','resolve','tmp','generate','writeFileSync','base64','then','chmodSync','777','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','writeFile','.wav','googleCloudTTS\x20path','googleTTS','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','data','length','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','map'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x7869,0x1d0));var _0x9786=function(_0x301022,_0x4e2773){_0x301022=_0x301022-0x0;var _0x1c7893=_0x7869[_0x301022];return _0x1c7893;};'use strict';var apiai=require(_0x9786('0x0'));var BPromise=require(_0x9786('0x1'));var dialogflow=require(_0x9786('0x2'));var fs=require('fs');var http=require(_0x9786('0x3'));var https=require(_0x9786('0x4'));var md5=require(_0x9786('0x5'));var path=require(_0x9786('0x6'));var querystring=require(_0x9786('0x7'));var rp=require(_0x9786('0x8'));var rs=require(_0x9786('0x9'));var sox=require(_0x9786('0xa'));var tts=require(_0x9786('0xb'));var urlParse=require(_0x9786('0xc'))[_0x9786('0xd')];var util=require(_0x9786('0xe'));var aws=require(_0x9786('0xf'));var google=require(_0x9786('0x10'));var sestek=require('./sestek');var tilde=require(_0x9786('0x11'));var logger=require(_0x9786('0x12'))(_0x9786('0x13'));var ISPEECH_API=_0x9786('0x14');function downloadFile(_0x4914b5,_0x41bf11){return new BPromise(function(_0x5d8008,_0x1ee3d7){var _0x38d045=urlParse(_0x4914b5);var _0x4a4442=_0x38d045['protocol']===_0x9786('0x15')?https:http;var _0x35d9a3={'host':_0x38d045[_0x9786('0x16')],'path':_0x38d045[_0x9786('0x6')],'headers':{'user-agent':_0x9786('0x17')}};_0x4a4442['get'](_0x35d9a3,function(_0x4df8f3){if(_0x4df8f3[_0x9786('0x18')]!==0xc8){logger['error'](_0x9786('0x19')+_0x4914b5+'\x20failed,\x20status\x20code\x20=\x20'+_0x4df8f3[_0x9786('0x18')]+'\x20('+_0x4df8f3[_0x9786('0x1a')]+')');_0x1ee3d7(new Error(_0x9786('0x19')+_0x4914b5+'\x20failed,\x20status\x20code\x20=\x20'+_0x4df8f3[_0x9786('0x18')]+'\x20('+_0x4df8f3['statusMessage']+')'));return;}var _0x3bc527=fs['createWriteStream'](_0x41bf11);_0x3bc527['on']('finish',function(){logger[_0x9786('0x1b')](_0x9786('0x1c'));_0x3bc527[_0x9786('0x1d')](_0x5d8008);});_0x3bc527['on'](_0x9786('0x1e'),function(_0x195879){fs[_0x9786('0x1f')](_0x41bf11);logger[_0x9786('0x1e')]('download\x20error',_0x195879);_0x1ee3d7(_0x195879);});_0x4df8f3[_0x9786('0x20')](_0x3bc527);})['on'](_0x9786('0x1e'),function(_0x3cbcca){logger[_0x9786('0x1e')](_0x3cbcca);_0x1ee3d7(_0x3cbcca);})['end']();});}function uploadFile(_0x182e95){return new BPromise(function(_0x195ca7,_0x3393ce){var _0x2d07c9=urlParse(_0x182e95);var _0x4e1cf9=_0x2d07c9[_0x9786('0x21')]===_0x9786('0x15')?https:http;var _0x2efc7f={'host':_0x2d07c9[_0x9786('0x16')],'path':_0x2d07c9['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x4e1cf9[_0x9786('0x22')](_0x2efc7f,function(_0x3020e7){if(_0x3020e7[_0x9786('0x18')]!==0xc8){_0x3393ce(new Error(_0x9786('0x19')+_0x182e95+'\x20failed,\x20status\x20code\x20=\x20'+_0x3020e7[_0x9786('0x18')]+'\x20('+_0x3020e7['statusMessage']+')'));return;}var _0x2ce799='';_0x3020e7['on']('data',function(_0x413ea7){_0x2ce799+=_0x413ea7;});_0x3020e7['on']('end',function(){_0x195ca7(_0x2ce799);});})['on'](_0x9786('0x1e'),function(_0x1e7cd2){_0x3393ce(_0x1e7cd2);})['end']();});}function convertFile(_0x5abeaa,_0x367b8b){return new BPromise(function(_0x23a3a4,_0xb5ab3d){var _0x1ca0ca=sox['transcode'](_0x5abeaa,_0x367b8b,{'sampleRate':0x1f40,'format':_0x9786('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1ca0ca['on'](_0x9786('0x1e'),function(_0x2d42ac){logger[_0x9786('0x1e')]('error\x20convert',_0x2d42ac);_0xb5ab3d(_0x2d42ac);});_0x1ca0ca['on']('end',function(){logger[_0x9786('0x1b')]('finish\x20to\x20convert');_0x23a3a4();});_0x1ca0ca[_0x9786('0x24')]();});}function base64Decode(_0x5b72a2,_0xf3271c){var _0x89c557=path[_0x9786('0x25')](__dirname,_0x9786('0x26'),rs[_0x9786('0x27')](0x4)+'.wav');fs[_0x9786('0x28')](_0x89c557,_0x5b72a2,_0x9786('0x29'));return convertFile(_0x89c557,_0xf3271c)[_0x9786('0x2a')](function(){try{fs['unlink'](_0x89c557);fs[_0x9786('0x2b')](_0xf3271c,_0x9786('0x2c'));}catch(_0x1d66d8){logger[_0x9786('0x1e')](_0x1d66d8);}return _0xf3271c[_0x9786('0x2d')]('.')[0x0];});}function base64Encode(_0x20b1e6){var _0x5007e6=fs[_0x9786('0x2e')](_0x20b1e6);return new Buffer(_0x5007e6)['toString'](_0x9786('0x29'));}exports[_0x9786('0x2f')]=function(_0x437396,_0x2e2079,_0x56a51b,_0x26bad5,_0x1cf044,_0x25fc5b){var _0xa30433,_0x2718ef;var _0x12e020=_0x9786('0x30');var _0x14d52a=_0x9786('0x31')+_0x437396;var _0x235103={};if(_0x2e2079===_0x9786('0x32')){_0x235103['input']={'ssml':_0x56a51b};}else{_0x235103[_0x9786('0x33')]={'text':_0x56a51b};};_0x235103[_0x9786('0x34')]={'languageCode':_0x26bad5,'ssmlGender':_0x1cf044};_0x235103[_0x9786('0x35')]={'audioEncoding':_0x9786('0x36'),'sampleRateHertz':0x1f40};var _0x12b2a4={'url':_0x12e020+_0x9786('0x37')+_0x14d52a,'method':_0x9786('0x38'),'json':!![],'body':_0x235103};return rp(_0x12b2a4)[_0x9786('0x2a')](function(_0x14f000){return new BPromise(function(_0x136a75,_0x50955d){_0xa30433=path[_0x9786('0x25')](__dirname,_0x9786('0x26'),rs[_0x9786('0x27')](0x4)+_0x9786('0x39'));var _0xd41696=Buffer['from'](_0x14f000['audioContent'],_0x9786('0x29'));return fs[_0x9786('0x3a')](_0xa30433,_0xd41696,function(_0x5b545c){_0x50955d(_0x5b545c);},function(_0x3f03ae){fs[_0x9786('0x2b')](_0xa30433,_0x9786('0x2c'));_0x136a75(_0x3f03ae);});});})[_0x9786('0x2a')](function(_0x1d526a){_0x2718ef=path[_0x9786('0x25')](__dirname,_0x9786('0x26'),rs[_0x9786('0x27')](0x4)+_0x9786('0x3b'));return convertFile(_0xa30433,_0x2718ef);})[_0x9786('0x2a')](function(){try{fs[_0x9786('0x1f')](_0xa30433);fs[_0x9786('0x2b')](_0x2718ef,_0x9786('0x2c'));}catch(_0x119b17){logger['error'](_0x119b17);}logger['info'](_0x9786('0x3c'),_0x2718ef[_0x9786('0x2d')]('.')[0x0]);return _0x2718ef[_0x9786('0x2d')]('.')[0x0];});};exports[_0x9786('0x3d')]=function(_0x1919c9,_0x55ddab){var _0x146902='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x5471af,_0x10719e;var _0x16e92c;var _0x227323={'encoding':_0x9786('0x3e'),'method':_0x9786('0x38'),'timeout':0x2710,'url':_0x146902,'headers':{'Content-Type':_0x9786('0x3f')},'body':_0x9786('0x40')+encodeURIComponent(JSON[_0x9786('0x41')]([[[_0x9786('0x42'),JSON[_0x9786('0x41')]([_0x1919c9,_0x55ddab||'en',![],_0x9786('0x43')]),null,_0x9786('0x44')]]]))};return rp(_0x227323)[_0x9786('0x2a')](function(_0x1384da){try{_0x16e92c=eval(_0x1384da[_0x9786('0x45')](0x5))[0x0][0x2];}catch(_0x4e5fe8){throw new Error(_0x9786('0x46')+_0x1384da[_0x9786('0x47')]);}if(!_0x16e92c){if(_0x1919c9[_0x9786('0x48')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error('lang\x20\x22'+_0x55ddab+_0x9786('0x49'));}}try{_0x16e92c=eval(_0x16e92c)[0x0];}catch(_0x1e9c6b){throw new Error(_0x9786('0x46')+res[_0x9786('0x47')]);}const _0x4f3265=_0x16e92c;_0x5471af=path[_0x9786('0x25')](__dirname,'tmp',rs[_0x9786('0x27')](0x4)+'.mp3');fs[_0x9786('0x28')](_0x5471af,_0x16e92c,{'encoding':'base64'});_0x10719e=path[_0x9786('0x25')](__dirname,'tmp',rs[_0x9786('0x27')](0x4)+_0x9786('0x3b'));return convertFile(_0x5471af,_0x10719e);})[_0x9786('0x2a')](function(){try{fs['unlink'](_0x5471af);fs['chmodSync'](_0x10719e,_0x9786('0x2c'));}catch(_0x7a7a7f){logger[_0x9786('0x1e')](_0x7a7a7f);}logger[_0x9786('0x1b')](_0x9786('0x4a'),_0x10719e[_0x9786('0x2d')]('.')[0x0]);return _0x10719e[_0x9786('0x2d')]('.')[0x0];});};exports[_0x9786('0x4b')]=function(_0x342636,_0x431566,_0x55b887){return google[_0x9786('0x4c')](_0x342636,_0x431566,_0x55b887)[_0x9786('0x2a')](function(_0x36e465){logger[_0x9786('0x1b')](_0x36e465[_0x9786('0x4d')]);return rp(_0x36e465);})[_0x9786('0x2a')](function(_0x3b9a66){var _0x314036='';var _0x42568b=0x0;try{fs[_0x9786('0x1f')](_0x342636);}catch(_0x46ca36){logger[_0x9786('0x1e')](_0x46ca36);}if(_0x3b9a66&&_0x3b9a66[_0x9786('0x4e')]){_0x314036=_0x3b9a66[_0x9786('0x4e')][_0x9786('0x4f')](function(_0xe0907d){return _0xe0907d&&_0xe0907d[_0x9786('0x50')][0x0]&&_0xe0907d[_0x9786('0x50')][0x0][_0x9786('0x51')]?_0xe0907d['alternatives'][0x0]['transcript']:'';})[_0x9786('0x52')]('\x0a');_0x42568b=_0x3b9a66['results'][_0x9786('0x4f')](function(_0x57843b){return _0x57843b&&_0x57843b[_0x9786('0x50')][0x0]&&_0x57843b['alternatives'][0x0][_0x9786('0x53')]?_0x57843b[_0x9786('0x50')][0x0]['confidence']:0x0;})[_0x9786('0x52')]('\x0a');}logger['info'](_0x9786('0x54'),_0x314036);logger[_0x9786('0x1b')](_0x9786('0x55'),_0x42568b);return{'transcript':_0x314036,'confidence':_0x42568b};})[_0x9786('0x56')](function(_0x374e07){logger[_0x9786('0x1e')](_0x9786('0x57'),_0x374e07['statusCode'],_0x374e07[_0x9786('0x58')],_0x374e07[_0x9786('0x59')]);});};exports[_0x9786('0x5a')]=function(_0x33eb37,_0x37ab20,_0x18ed6f,_0x3d1287){var _0x2b885d=apiai(_0x37ab20,{'language':_0x3d1287||'en'});return _0x2b885d[_0x9786('0x5b')](_0x18ed6f,{'sessionId':md5(_0x33eb37)})[_0x9786('0x2a')](function(_0x4a2da5){logger[_0x9786('0x1b')](JSON['stringify'](_0x4a2da5));return{'source':_0x4a2da5[_0x9786('0x5c')][_0x9786('0x5d')],'resolvedQuery':_0x4a2da5[_0x9786('0x5c')][_0x9786('0x5e')],'action':_0x4a2da5['result'][_0x9786('0x5f')],'actionIncomplete':_0x4a2da5[_0x9786('0x5c')][_0x9786('0x60')],'speech':_0x4a2da5[_0x9786('0x5c')][_0x9786('0x61')][_0x9786('0x62')],'score':_0x4a2da5['result'][_0x9786('0x63')],'statusCode':_0x4a2da5[_0x9786('0x64')]['code'],'endConversation':_0x4a2da5[_0x9786('0x5c')]['metadata'][_0x9786('0x65')]||![],'isFallbackIntent':_0x4a2da5[_0x9786('0x5c')][_0x9786('0x66')]['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0x1fa716,_0x16ba9d,_0xcb0dea,_0x13f490,_0x121334,_0x9a7f0b){var _0x3417e6=_0x13f490[_0x9786('0x67')](/\\n/g,'\x0a');var _0x4bbb87={'credentials':{'private_key':_0x3417e6,'client_email':_0xcb0dea}};var _0x1e2daa=new dialogflow[(_0x9786('0x68'))](_0x4bbb87);var _0x547643=_0x1e2daa[_0x9786('0x69')](_0x16ba9d,md5(_0x1fa716));var _0x4a9a24={'session':_0x547643,'queryInput':{'text':{'text':_0x121334,'languageCode':_0x9a7f0b}}};return _0x1e2daa['detectIntent'](_0x4a9a24)['then'](function(_0x3e2d48){if(_0x3e2d48&&_0x3e2d48[_0x9786('0x48')]){logger['info'](_0x9786('0x6a'),JSON['stringify'](_0x3e2d48));var _0x2c4bca=_0x3e2d48[0x0];if(_0x2c4bca){var _0xb78e1={'action':_0x2c4bca[_0x9786('0x6b')]['action'],'allRequiredParamsPresent':_0x2c4bca[_0x9786('0x6b')]['allRequiredParamsPresent'],'endConversation':_0x2c4bca[_0x9786('0x6b')][_0x9786('0x6c')]&&_0x2c4bca[_0x9786('0x6b')][_0x9786('0x6c')]['fields']?_0x2c4bca[_0x9786('0x6b')][_0x9786('0x6c')][_0x9786('0x6d')][_0x9786('0x6e')][_0x9786('0x6f')]:![],'fulfillmentText':_0x2c4bca['queryResult'][_0x9786('0x70')],'intentName':_0x2c4bca[_0x9786('0x6b')][_0x9786('0x71')][_0x9786('0x58')],'intentDisplayName':_0x2c4bca[_0x9786('0x6b')]['intent'][_0x9786('0x72')],'isFallbackIntent':_0x2c4bca['queryResult'][_0x9786('0x71')][_0x9786('0x73')],'languageCode':_0x2c4bca['queryResult'][_0x9786('0x74')],'queryText':_0x2c4bca['queryResult'][_0x9786('0x75')],'responseId':_0x2c4bca[_0x9786('0x76')],'score':_0x2c4bca[_0x9786('0x6b')][_0x9786('0x77')],'speech':_0x2c4bca[_0x9786('0x6b')][_0x9786('0x70')],'providerResponse':JSON[_0x9786('0x41')](_0x3e2d48)};return _0xb78e1;}}});};exports['tildeASR']=function(_0x1f02a1,_0x2adf7b,_0x10f98d,_0x1114c6){return tilde[_0x9786('0x4c')](_0x1f02a1,_0x2adf7b,_0x10f98d,_0x1114c6)[_0x9786('0x2a')](function(_0x161fd2){try{fs[_0x9786('0x1f')](_0x1f02a1);}catch(_0x813cc9){logger['error'](_0x813cc9);}logger[_0x9786('0x1b')](_0x9786('0x78'),_0x161fd2['transcript']);logger['info']('Tilde\x20ASR\x20confidence',_0x161fd2['confidence']);return _0x161fd2;});};exports[_0x9786('0x79')]=function(_0x390008,_0xbf69e3,_0x4ff533,_0x25f5c9,_0x60fc33,_0x20ced1){var _0x17741c=path[_0x9786('0x25')](__dirname,_0x9786('0x26'),rs['generate'](0x4)+_0x9786('0x39'));var _0x2755ad;return aws[_0x9786('0x7a')](_0x390008,_0xbf69e3,_0x4ff533,_0x25f5c9,_0x60fc33,_0x20ced1,_0x17741c)['then'](function(){_0x2755ad=path[_0x9786('0x25')](__dirname,'tmp',rs[_0x9786('0x27')](0x4)+_0x9786('0x3b'));return convertFile(_0x17741c,_0x2755ad);})['then'](function(){try{fs[_0x9786('0x1f')](_0x17741c);fs[_0x9786('0x2b')](_0x2755ad,'777');}catch(_0x16e925){logger[_0x9786('0x1e')](_0x16e925);}return _0x2755ad[_0x9786('0x2d')]('.')[0x0];});};exports[_0x9786('0x7b')]=function(_0x36f78b,_0x4dea86,_0x2ea952,_0x3fb8e3,_0x3b60f6,_0x381466){return aws[_0x9786('0x7c')](_0x36f78b,_0x4dea86,_0x2ea952,_0x3fb8e3,_0x3b60f6,_0x381466)['then'](function(_0x34d17a){logger[_0x9786('0x1b')](JSON[_0x9786('0x41')](_0x34d17a));return _0x34d17a;});};exports['ispeechTTS']=function(_0x38865f,_0x271fd2,_0x56e871,_0x6283a3){var _0x25d153=util[_0x9786('0x7d')](_0x9786('0x7e'),ISPEECH_API,_0x38865f,encodeURIComponent(_0x271fd2),_0x56e871,_0x6283a3);var _0x2c7e59=path[_0x9786('0x25')](__dirname,_0x9786('0x26'),rs['generate'](0x4)+'.mp3');var _0x4032d0;return downloadFile(_0x25d153,_0x2c7e59)['then'](function(){_0x4032d0=path[_0x9786('0x25')](__dirname,'tmp',rs[_0x9786('0x27')](0x4)+_0x9786('0x3b'));return convertFile(_0x2c7e59,_0x4032d0);})[_0x9786('0x2a')](function(){try{fs[_0x9786('0x1f')](_0x2c7e59);fs[_0x9786('0x2b')](_0x4032d0,_0x9786('0x2c'));}catch(_0x2f5e23){logger[_0x9786('0x1e')](_0x2f5e23);}return _0x4032d0[_0x9786('0x2d')]('.')[0x0];});};exports['ispeechASR']=function(_0x3a10de,_0x387f9f,_0x2f8bdf,_0x698c51){var _0x19597c=util[_0x9786('0x7d')](_0x9786('0x7f'),ISPEECH_API,_0x387f9f,_0x2f8bdf,base64Encode(_0x3a10de),_0x698c51?util[_0x9786('0x7d')](_0x9786('0x80'),encodeURIComponent(_0x698c51)):_0x9786('0x81'));return uploadFile(_0x19597c)['then'](function(_0x3de569){return querystring[_0x9786('0xd')](_0x3de569);});};exports[_0x9786('0x82')]=function(_0x150527,_0x182394){return sestek[_0x9786('0x83')](_0x150527,_0x182394)[_0x9786('0x2a')](function(_0x20260b){logger[_0x9786('0x1b')](JSON[_0x9786('0x41')](_0x20260b));var _0x5d3245={'speech':_0x20260b['text'],'action':_0x20260b[_0x9786('0x84')]?_0x20260b[_0x9786('0x84')]['CustomAction']:undefined,'actiondata':_0x20260b[_0x9786('0x84')]?_0x20260b[_0x9786('0x84')][_0x9786('0x85')]:undefined};if(_0x20260b[_0x9786('0x84')]&&_0x20260b[_0x9786('0x84')][_0x9786('0x86')]){return base64Decode(_0x20260b[_0x9786('0x84')][_0x9786('0x86')]['Data'],path['resolve'](__dirname,_0x9786('0x26'),rs[_0x9786('0x27')](0x4)+_0x9786('0x3b')))[_0x9786('0x2a')](function(_0x52ad38){_0x5d3245[_0x9786('0x87')]=_0x52ad38;return _0x5d3245;});}return _0x5d3245;});};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 440767c..4c545ad 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 _0xaa14=['./nda'];(function(_0x33eca6,_0x891651){var _0x1ada39=function(_0x31ab8c){while(--_0x31ab8c){_0x33eca6['push'](_0x33eca6['shift']());}};_0x1ada39(++_0x891651);}(_0xaa14,0x126));var _0x4aa1=function(_0x11f94b,_0x3cd97c){_0x11f94b=_0x11f94b-0x0;var _0x510982=_0xaa14[_0x11f94b];return _0x510982;};var nda=require(_0x4aa1('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x43fb=['exports','./nda'];(function(_0x4945d2,_0x5b8613){var _0xa4a8e4=function(_0xf3ad39){while(--_0xf3ad39){_0x4945d2['push'](_0x4945d2['shift']());}};_0xa4a8e4(++_0x5b8613);}(_0x43fb,0x19f));var _0xb43f=function(_0x56d487,_0x5f1b66){_0x56d487=_0x56d487-0x0;var _0x4229b1=_0x43fb[_0x56d487];return _0x4229b1;};var nda=require(_0xb43f('0x0'));module[_0xb43f('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 0d0bf92..bf203d2 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 _0xa047=['custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','agi','POST','resolve','ndauth_url','/token','username','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','callerid','calleridname','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction'];(function(_0x28f78a,_0x492668){var _0x570c32=function(_0x51c697){while(--_0x51c697){_0x28f78a['push'](_0x28f78a['shift']());}};_0x570c32(++_0x492668);}(_0xa047,0x1c5));var _0x7a04=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xa047[_0x263a74];return _0x2aa86c;};'use strict';var rp=require(_0x7a04('0x0'));var url=require(_0x7a04('0x1'));var logger=require(_0x7a04('0x2'))(_0x7a04('0x3'));module['exports']=function(_0x258f94,_0x491906){var _0x132966={'method':_0x7a04('0x4'),'uri':url[_0x7a04('0x5')](_0x491906[_0x7a04('0x6')],_0x7a04('0x7')),'form':{'grant_type':'password','username':_0x491906[_0x7a04('0x8')],'password':_0x491906[_0x7a04('0x9')]},'json':!![]};return rp(_0x132966)[_0x7a04('0xa')](function(_0x5c183c){var _0x10d92f={'method':_0x7a04('0x4'),'uri':url['resolve'](_0x491906[_0x7a04('0xb')],_0x7a04('0xc')),'body':{'type':_0x491906['ndaactivity_type']||_0x7a04('0xd'),'channelId':'Nda','conversation':{'id':_0x258f94['uniqueid']},'from':{'id':_0x258f94[_0x7a04('0xe')],'name':_0x258f94[_0x7a04('0xf')]},'recipient':{'id':_0x258f94['dnid'],'name':_0x258f94['extension']},'text':_0x491906['text'],'channelData':{}},'headers':{'Authorization':_0x7a04('0x10')+_0x5c183c[_0x7a04('0x11')]},'json':!![]};if(_0x491906[_0x7a04('0x12')]){_0x10d92f[_0x7a04('0x13')][_0x7a04('0x14')][_0x7a04('0x15')]=_0x491906[_0x7a04('0x12')];}if(_0x491906[_0x7a04('0x16')]=='1'){_0x10d92f[_0x7a04('0x13')]['channelData'][_0x7a04('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x7a04('0x18')};}if(_0x491906[_0x7a04('0x19')]){_0x10d92f[_0x7a04('0x13')][_0x7a04('0x14')][_0x7a04('0x1a')]=_0x491906['custom_action'];if(_0x491906[_0x7a04('0x1b')]){_0x10d92f[_0x7a04('0x13')][_0x7a04('0x14')]['CustomActionData']=_0x491906['custom_action_data'];}}logger[_0x7a04('0x1c')](JSON[_0x7a04('0x1d')](_0x10d92f));return rp(_0x10d92f);});}; \ No newline at end of file +var _0xd404=['AudioOutputSettings','custom_action','CustomAction','custom_action_data','CustomActionData','stringify','request-promise','url','agi','exports','POST','resolve','ndauth_url','/token','password','username','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ndagenerate_audio'];(function(_0x5aa20c,_0x28b6ca){var _0x5d0a3a=function(_0x4b6cc8){while(--_0x4b6cc8){_0x5aa20c['push'](_0x5aa20c['shift']());}};_0x5d0a3a(++_0x28b6ca);}(_0xd404,0x15b));var _0x4d40=function(_0xcfc09a,_0xf0c7b9){_0xcfc09a=_0xcfc09a-0x0;var _0x275bcb=_0xd404[_0xcfc09a];return _0x275bcb;};'use strict';var rp=require(_0x4d40('0x0'));var url=require(_0x4d40('0x1'));var logger=require('../../../../../config/logger')(_0x4d40('0x2'));module[_0x4d40('0x3')]=function(_0x502a67,_0x3e9bbc){var _0x610dbf={'method':_0x4d40('0x4'),'uri':url[_0x4d40('0x5')](_0x3e9bbc[_0x4d40('0x6')],_0x4d40('0x7')),'form':{'grant_type':_0x4d40('0x8'),'username':_0x3e9bbc[_0x4d40('0x9')],'password':_0x3e9bbc[_0x4d40('0x8')]},'json':!![]};return rp(_0x610dbf)['then'](function(_0x292180){var _0x116941={'method':'POST','uri':url[_0x4d40('0x5')](_0x3e9bbc['ndassistant_url'],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x3e9bbc[_0x4d40('0xa')]||_0x4d40('0xb'),'channelId':_0x4d40('0xc'),'conversation':{'id':_0x502a67[_0x4d40('0xd')]},'from':{'id':_0x502a67[_0x4d40('0xe')],'name':_0x502a67[_0x4d40('0xf')]},'recipient':{'id':_0x502a67[_0x4d40('0x10')],'name':_0x502a67[_0x4d40('0x11')]},'text':_0x3e9bbc[_0x4d40('0x12')],'channelData':{}},'headers':{'Authorization':_0x4d40('0x13')+_0x292180[_0x4d40('0x14')]},'json':!![]};if(_0x3e9bbc[_0x4d40('0x15')]){_0x116941[_0x4d40('0x16')][_0x4d40('0x17')]['ProjectName']=_0x3e9bbc[_0x4d40('0x15')];}if(_0x3e9bbc[_0x4d40('0x18')]=='1'){_0x116941[_0x4d40('0x16')][_0x4d40('0x17')][_0x4d40('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x3e9bbc[_0x4d40('0x1a')]){_0x116941[_0x4d40('0x16')][_0x4d40('0x17')][_0x4d40('0x1b')]=_0x3e9bbc[_0x4d40('0x1a')];if(_0x3e9bbc[_0x4d40('0x1c')]){_0x116941[_0x4d40('0x16')][_0x4d40('0x17')][_0x4d40('0x1d')]=_0x3e9bbc['custom_action_data'];}}logger['info'](JSON[_0x4d40('0x1e')](_0x116941));return rp(_0x116941);});}; \ 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 211b4fa..ced839c 100644 --- a/server/services/agi/scripts/tilde/asr/index.js +++ b/server/services/agi/scripts/tilde/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xde61=['exports','./lib/api'];(function(_0x21bd1e,_0x13eee4){var _0x5d4a2e=function(_0x254426){while(--_0x254426){_0x21bd1e['push'](_0x21bd1e['shift']());}};_0x5d4a2e(++_0x13eee4);}(_0xde61,0x1cf));var _0x1de6=function(_0x3b4ccb,_0xc85a2){_0x3b4ccb=_0x3b4ccb-0x0;var _0x5f07aa=_0xde61[_0x3b4ccb];return _0x5f07aa;};'use strict';var asr=require(_0x1de6('0x0'));module[_0x1de6('0x1')]=function(_0x41ac51,_0x3a218d,_0x22d153,_0x466144){return asr(_0x41ac51,_0x3a218d,_0x22d153,_0x466144);}; \ No newline at end of file +var _0x337c=['./lib/api','exports'];(function(_0x3b025f,_0x3f4d04){var _0xb129b2=function(_0x2fb05a){while(--_0x2fb05a){_0x3b025f['push'](_0x3b025f['shift']());}};_0xb129b2(++_0x3f4d04);}(_0x337c,0x98));var _0xc337=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x337c[_0x3dd15e];return _0x231fd0;};'use strict';var asr=require(_0xc337('0x0'));module[_0xc337('0x1')]=function(_0x1cbc16,_0x270b26,_0x555363,_0x4b2570){return asr(_0x1cbc16,_0x270b26,_0x555363,_0x4b2570);}; \ 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 7e5fb85..b8bea5b 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 _0x776f=['wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','bluebird','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI'];(function(_0x1fb269,_0x2b99a1){var _0x16b417=function(_0x4b5d1e){while(--_0x4b5d1e){_0x1fb269['push'](_0x1fb269['shift']());}};_0x16b417(++_0x2b99a1);}(_0x776f,0x157));var _0xf776=function(_0x3f6bcf,_0x531e79){_0x3f6bcf=_0x3f6bcf-0x0;var _0x1c5350=_0x776f[_0x3f6bcf];return _0x1c5350;};'use strict';var BPromise=require(_0xf776('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xf776('0x1'));var crypto=require(_0xf776('0x2'));var logger=require(_0xf776('0x3'))(_0xf776('0x4'));module[_0xf776('0x5')]=function(_0x3be454,_0x57298e,_0x388caf,_0x2b00ac){return new BPromise(function(_0x49646d,_0x220d39){logger[_0xf776('0x6')](_0xf776('0x7'),_0x2b00ac||_0xf776('0x8'));var _0x1cd8ba=new WebSocket(_0x2b00ac||_0xf776('0x8'),{'perMessageDeflate':![]});var _0x42b51e='';var _0x3a4495='0';var _0x2d0d7d='1';var _0x3beb7d='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x318e12(_0x2620d1){var _0x18c98d=crypto[_0xf776('0x9')](_0xf776('0xa'));_0x18c98d[_0xf776('0xb')](_0x2620d1);return _0x18c98d[_0xf776('0xc')](_0xf776('0xd'));}function _0x42eee4(){try{logger['info'](_0xf776('0xe'));var _0x4f94cd=moment()[_0xf776('0xf')]();var _0xd481ca=_0x318e12(_0x4f94cd+_0x57298e+_0x388caf);_0x1cd8ba[_0xf776('0x10')](JSON[_0xf776('0x11')]({'appID':_0x57298e,'timestamp':_0x4f94cd,'appKey':_0xd481ca}));var _0x2cfca9=fs['createReadStream'](_0x3be454);_0x2cfca9['on']('data',function(_0x45d731){_0x1cd8ba[_0xf776('0x10')](_0x45d731);});_0x2cfca9['on']('close',function(){_0x1cd8ba[_0xf776('0x10')](_0xf776('0x12'));});}catch(_0x5deb4f){logger[_0xf776('0x13')](_0xf776('0x14'),JSON[_0xf776('0x11')](_0x5deb4f));_0x1cd8ba[_0xf776('0x15')]();}}function _0x12d311(_0x1b3600){try{if(_0x1b3600){var _0x49f434=JSON['parse'](_0x1b3600);switch(_0x49f434[_0xf776('0x16')]){case 0x0:if(_0x49f434[_0xf776('0x17')]){if(_0x49f434[_0xf776('0x17')][_0xf776('0x18')]){logger[_0xf776('0x6')](_0xf776('0x19'),JSON[_0xf776('0x11')](_0x49f434[_0xf776('0x17')][_0xf776('0x1a')]));_0x42b51e=_0x49f434[_0xf776('0x17')][_0xf776('0x1a')][0x0]['transcript'];_0x3a4495=_0x49f434[_0xf776('0x17')][_0xf776('0x1a')][0x0][_0xf776('0x1b')];_0x2d0d7d='0';_0x3beb7d='Success.';_0x1cd8ba[_0xf776('0x15')]();}}break;case 0x1:logger[_0xf776('0x6')](_0xf776('0x1c'));_0x2d0d7d='1';_0x3beb7d=_0xf776('0x1c');break;case 0x2:logger[_0xf776('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x2d0d7d='2';_0x3beb7d=_0xf776('0x1d');break;case 0x9:logger[_0xf776('0x6')](_0xf776('0x1e'));_0x2d0d7d='9';_0x3beb7d=_0xf776('0x1e');break;case 0xa:logger[_0xf776('0x6')](_0xf776('0x1f'));_0x2d0d7d='10';_0x3beb7d='Authentication\x20failed.';break;case 0xb:logger[_0xf776('0x6')](_0xf776('0x20'));_0x2d0d7d='11';_0x3beb7d='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x17d534){logger[_0xf776('0x13')](_0xf776('0x21'),JSON[_0xf776('0x11')](_0x17d534));_0x1cd8ba['terminate']();}}function _0x2f1c11(){logger[_0xf776('0x6')](_0xf776('0x22'));_0x49646d({'transcript':_0x42b51e,'confidence':_0x3a4495,'status':_0x2d0d7d,'status_message':_0x3beb7d});}function _0x2a0543(_0x353a56){logger[_0xf776('0x13')](_0xf776('0x23'));if(!_[_0xf776('0x24')](_0x353a56)){logger[_0xf776('0x13')](_[_0xf776('0x25')](_0x353a56)?JSON[_0xf776('0x11')](_0x353a56):_0x353a56);}}_0x1cd8ba['on'](_0xf776('0x26'),_0x42eee4);_0x1cd8ba['on']('message',_0x12d311);_0x1cd8ba['on']('close',_0x2f1c11);_0x1cd8ba['on'](_0xf776('0x13'),_0x2a0543);});}; \ No newline at end of file +var _0x5e72=['transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','terminate','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','moment','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','info','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','data','close','error','status','result','final','hypotheses'];(function(_0x33a7e5,_0x316645){var _0x7c7133=function(_0x58bc62){while(--_0x58bc62){_0x33a7e5['push'](_0x33a7e5['shift']());}};_0x7c7133(++_0x316645);}(_0x5e72,0x147));var _0x25e7=function(_0x95e7f7,_0x5c6e79){_0x95e7f7=_0x95e7f7-0x0;var _0x5939f2=_0x5e72[_0x95e7f7];return _0x5939f2;};'use strict';var BPromise=require(_0x25e7('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x25e7('0x1'));var crypto=require('crypto');var logger=require('../../../../../../config/logger')(_0x25e7('0x2'));module[_0x25e7('0x3')]=function(_0x2c3c99,_0x46f353,_0x269bde,_0x2c8175){return new BPromise(function(_0x45d2c1,_0x3f7eb0){logger['info'](_0x25e7('0x4'),_0x2c8175||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x40612f=new WebSocket(_0x2c8175||_0x25e7('0x5'),{'perMessageDeflate':![]});var _0x41f586='';var _0x5e7573='0';var _0x18ffca='1';var _0x3ccd7e=_0x25e7('0x6');function _0x3db60e(_0x2ab9e5){var _0x10b8c8=crypto[_0x25e7('0x7')](_0x25e7('0x8'));_0x10b8c8[_0x25e7('0x9')](_0x2ab9e5);return _0x10b8c8[_0x25e7('0xa')](_0x25e7('0xb'));}function _0xa4a649(){try{logger[_0x25e7('0xc')](_0x25e7('0xd'));var _0x574744=moment()['unix']();var _0xdd149b=_0x3db60e(_0x574744+_0x46f353+_0x269bde);_0x40612f[_0x25e7('0xe')](JSON[_0x25e7('0xf')]({'appID':_0x46f353,'timestamp':_0x574744,'appKey':_0xdd149b}));var _0x59f99c=fs[_0x25e7('0x10')](_0x2c3c99);_0x59f99c['on'](_0x25e7('0x11'),function(_0x4882b1){_0x40612f['send'](_0x4882b1);});_0x59f99c['on'](_0x25e7('0x12'),function(){_0x40612f[_0x25e7('0xe')]('EOS');});}catch(_0x2da28b){logger[_0x25e7('0x13')]('Tilde\x20ASR\x20send\x20error',JSON[_0x25e7('0xf')](_0x2da28b));_0x40612f['terminate']();}}function _0xc583f7(_0x1c347a){try{if(_0x1c347a){var _0x2bbf82=JSON['parse'](_0x1c347a);switch(_0x2bbf82[_0x25e7('0x14')]){case 0x0:if(_0x2bbf82[_0x25e7('0x15')]){if(_0x2bbf82[_0x25e7('0x15')][_0x25e7('0x16')]){logger[_0x25e7('0xc')]('Tilde\x20ASR\x20hypoteses',JSON[_0x25e7('0xf')](_0x2bbf82[_0x25e7('0x15')][_0x25e7('0x17')]));_0x41f586=_0x2bbf82['result'][_0x25e7('0x17')][0x0][_0x25e7('0x18')];_0x5e7573=_0x2bbf82[_0x25e7('0x15')][_0x25e7('0x17')][0x0][_0x25e7('0x19')];_0x18ffca='0';_0x3ccd7e=_0x25e7('0x1a');_0x40612f['terminate']();}}break;case 0x1:logger['info'](_0x25e7('0x6'));_0x18ffca='1';_0x3ccd7e=_0x25e7('0x6');break;case 0x2:logger[_0x25e7('0xc')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x18ffca='2';_0x3ccd7e=_0x25e7('0x1b');break;case 0x9:logger[_0x25e7('0xc')](_0x25e7('0x1c'));_0x18ffca='9';_0x3ccd7e='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x25e7('0xc')](_0x25e7('0x1d'));_0x18ffca='10';_0x3ccd7e=_0x25e7('0x1d');break;case 0xb:logger[_0x25e7('0xc')](_0x25e7('0x1e'));_0x18ffca='11';_0x3ccd7e=_0x25e7('0x1e');}}}catch(_0x2518b0){logger[_0x25e7('0x13')](_0x25e7('0x1f'),JSON[_0x25e7('0xf')](_0x2518b0));_0x40612f[_0x25e7('0x20')]();}}function _0x31baf8(){logger['info'](_0x25e7('0x21'));_0x45d2c1({'transcript':_0x41f586,'confidence':_0x5e7573,'status':_0x18ffca,'status_message':_0x3ccd7e});}function _0x573a47(_0x359dd1){logger['error'](_0x25e7('0x22'));if(!_[_0x25e7('0x23')](_0x359dd1)){logger['error'](_[_0x25e7('0x24')](_0x359dd1)?JSON['stringify'](_0x359dd1):_0x359dd1);}}_0x40612f['on'](_0x25e7('0x25'),_0xa4a649);_0x40612f['on'](_0x25e7('0x26'),_0xc583f7);_0x40612f['on'](_0x25e7('0x12'),_0x31baf8);_0x40612f['on'](_0x25e7('0x13'),_0x573a47);});}; \ 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 f29d3a9..97351ca 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 _0xd524=['./asr'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd524,0x1e2));var _0x4d52=function(_0x367c82,_0x2590a5){_0x367c82=_0x367c82-0x0;var _0x1740c1=_0xd524[_0x367c82];return _0x1740c1;};var asr=require(_0x4d52('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x7847=['./asr','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7847,0xde));var _0x7784=function(_0xa91c8b,_0x178735){_0xa91c8b=_0xa91c8b-0x0;var _0x16cace=_0x7847[_0xa91c8b];return _0x16cace;};var asr=require(_0x7784('0x0'));module[_0x7784('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 900b5fa..394698b 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 _0x1983=['emit','error','E_AGI_ARGUMENT_PORT','createServer','listening','connection','getConnections','E_AGI_SERVER_ERROR','destroy','E_AGI_SERVER_MAXCONNECTION','ready','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','events','./error','./channel','127.0.0.1','call'];(function(_0x1b2839,_0x211891){var _0x30e7e8=function(_0x40c0b0){while(--_0x40c0b0){_0x1b2839['push'](_0x1b2839['shift']());}};_0x30e7e8(++_0x211891);}(_0x1983,0x1b1));var _0x3198=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0x1983[_0x59c301];return _0x3866b9;};'use strict';var util=require(_0x3198('0x0'));var net=require(_0x3198('0x1'));var EventEmitter=require(_0x3198('0x2'))['EventEmitter'];var AGIError=require(_0x3198('0x3'));var AGIChannel=require(_0x3198('0x4'));var AGIServer=function(_0x3629e3,_0x1f2cc7,_0x517574){var _0xc08398=this,_0x3629e3=_0x3629e3||0x11dd,_0x1f2cc7=_0x1f2cc7||_0x3198('0x5'),_0x9a276c=null,_0x57e964=0x0;EventEmitter[_0x3198('0x6')](_0xc08398);function _0x39bf89(){if(!_0x3629e3){_0xc08398[_0x3198('0x7')](_0x3198('0x8'),new AGIError(_0x3198('0x9')));return![];}_0x9a276c=net[_0x3198('0xa')]();_0x9a276c['listen'](_0x3629e3,_0x1f2cc7);_0x9a276c['on'](_0x3198('0xb'),function(){_0xc08398['emit']('listening');});_0x9a276c['on'](_0x3198('0xc'),function(_0x2261e2){_0x9a276c[_0x3198('0xd')](function(_0xb364b7,_0x598cad){if(_0xb364b7){_0xc08398['emit'](_0x3198('0x8'),new AGIError(_0x3198('0xe'),_0xb364b7));}else if(_0x517574&&_0x517574<0x0){_0xc08398[_0x3198('0x7')](_0x3198('0x8'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x2261e2[_0x3198('0xf')]();}else if(_0x517574&&_0x517574>0x0&&_0x517574<_0x598cad){_0x57e964+=0x1;_0xc08398[_0x3198('0x7')](_0x3198('0x8'),new AGIError(_0x3198('0x10'),_0x57e964));_0x2261e2[_0x3198('0xf')]();}else{var _0x3e6e23=new AGIChannel(_0x2261e2);_0x3e6e23['on'](_0x3198('0x11'),function(){_0xc08398['emit'](_0x3198('0xc'),_0x3e6e23);});}});});_0x9a276c['on'](_0x3198('0x8'),function(_0x508dfd){_0xc08398[_0x3198('0x7')](_0x3198('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x508dfd['code']));});_0x9a276c['on']('close',function(){_0xc08398['emit']('close',new AGIError(_0x3198('0x12')));});}process[_0x3198('0x13')](function(){_0x39bf89();});};util[_0x3198('0x14')](AGIServer,EventEmitter);module[_0x3198('0x15')]=function(_0x1f6f7a,_0x5a86bf,_0x397741){return new AGIServer(_0x1f6f7a,_0x5a86bf,_0x397741);}; \ No newline at end of file +var _0xe6ba=['EventEmitter','./error','./channel','127.0.0.1','call','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','emit','E_AGI_SERVER_ERROR','error','destroy','E_AGI_SERVER_MAXCONNECTION','code','close','E_AGI_SERVER_CLOSE','nextTick','exports','util','net'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xe6ba,0x6c));var _0xae6b=function(_0x19c346,_0x302fcd){_0x19c346=_0x19c346-0x0;var _0x1d091c=_0xe6ba[_0x19c346];return _0x1d091c;};'use strict';var util=require(_0xae6b('0x0'));var net=require(_0xae6b('0x1'));var EventEmitter=require('events')[_0xae6b('0x2')];var AGIError=require(_0xae6b('0x3'));var AGIChannel=require(_0xae6b('0x4'));var AGIServer=function(_0x1fbf2c,_0x4f0350,_0x5d8d11){var _0x3b1a1a=this,_0x1fbf2c=_0x1fbf2c||0x11dd,_0x4f0350=_0x4f0350||_0xae6b('0x5'),_0x3f42de=null,_0x4345fd=0x0;EventEmitter[_0xae6b('0x6')](_0x3b1a1a);function _0x298798(){if(!_0x1fbf2c){_0x3b1a1a['emit']('error',new AGIError(_0xae6b('0x7')));return![];}_0x3f42de=net[_0xae6b('0x8')]();_0x3f42de[_0xae6b('0x9')](_0x1fbf2c,_0x4f0350);_0x3f42de['on'](_0xae6b('0xa'),function(){_0x3b1a1a['emit'](_0xae6b('0xa'));});_0x3f42de['on'](_0xae6b('0xb'),function(_0x33922a){_0x3f42de['getConnections'](function(_0x264d1f,_0x908bfa){if(_0x264d1f){_0x3b1a1a[_0xae6b('0xc')]('error',new AGIError(_0xae6b('0xd'),_0x264d1f));}else if(_0x5d8d11&&_0x5d8d11<0x0){_0x3b1a1a[_0xae6b('0xc')](_0xae6b('0xe'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x33922a[_0xae6b('0xf')]();}else if(_0x5d8d11&&_0x5d8d11>0x0&&_0x5d8d11<_0x908bfa){_0x4345fd+=0x1;_0x3b1a1a[_0xae6b('0xc')](_0xae6b('0xe'),new AGIError(_0xae6b('0x10'),_0x4345fd));_0x33922a[_0xae6b('0xf')]();}else{var _0x41f5c5=new AGIChannel(_0x33922a);_0x41f5c5['on']('ready',function(){_0x3b1a1a[_0xae6b('0xc')](_0xae6b('0xb'),_0x41f5c5);});}});});_0x3f42de['on'](_0xae6b('0xe'),function(_0x167960){_0x3b1a1a[_0xae6b('0xc')]('error',new AGIError(_0xae6b('0xd'),_0x167960[_0xae6b('0x11')]));});_0x3f42de['on'](_0xae6b('0x12'),function(){_0x3b1a1a[_0xae6b('0xc')](_0xae6b('0x12'),new AGIError(_0xae6b('0x13')));});}process[_0xae6b('0x14')](function(){_0x298798();});};util['inherits'](AGIServer,EventEmitter);module[_0xae6b('0x15')]=function(_0x196487,_0x34691c,_0x55eac0){return new AGIServer(_0x196487,_0x34691c,_0x55eac0);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 4fa2242..3ff1f76 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 _0xca2c=['%s_ROWS_COUNT','variable\x20%s\x20set','debug','sip_id','no\x20user\x20selected','DIAL','SIP/%s','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','unlink','.wav','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\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','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','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','getIntervals','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','false','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','AGENT\x20%s\x20FOUND\x20BY','success','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20NOT\x20FOUND\x20BY','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','getMailAccount','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','Smtp','user','bcc','subject','service','host','port','secure','auth','template_id','account_id','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20found\x20with\x20id\x20%d','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','join','util','lodash','shelljs','randomstring','moment','mustache','request-promise','../../config/logger','agi','rawHeaders','rawBody','menu','getsecretdigits','channel','rpc','mailRpc','prototype','getVariableById','then','name','getVoiceQueue','catch','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunk','getTrunkById','getSound','save_name','sendMailMessage','map','Intervals','interval','getSoundPath','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','LOCAL','shellCommand','exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','url','timeout','number','includes','POST','PUT','method','toUpperCase','parse','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','awsLex','aws_lex_region','googleASR','tildeASR','appid','appsecret','clone','isString','replaceAllVariables','hasOwnProperty','isArray','length','saveRestApiResult','isPlainObject','%s.%s','setVariable','recursiveNodeIndex','split','replaceAll','getVariable','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','createSquareDetailsReport','retry','maxRetry','noop','no\x20text\x20configured','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_INPUT()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','replace','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','keys','forEach'];(function(_0x4386c6,_0x51f6bf){var _0x43d24e=function(_0x502157){while(--_0x502157){_0x4386c6['push'](_0x4386c6['shift']());}};_0x43d24e(++_0x51f6bf);}(_0xca2c,0xfd));var _0xcca2=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xca2c[_0x42245d];return _0x4b211a;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0xcca2('0x0'));var _=require(_0xcca2('0x1'));var sh=require(_0xcca2('0x2'));var odbc=require('odbc')();var rs=require(_0xcca2('0x3'));var moment=require(_0xcca2('0x4'));var Mustache=require(_0xcca2('0x5'));var rp=require(_0xcca2('0x6'));var logger=require(_0xcca2('0x7'))(_0xcca2('0x8'));var config=require('../../config/environment');var scripts=require('./scripts');var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0xcca2('0x9'),_0xcca2('0xa')];var verticesWithRetry=[_0xcca2('0xb'),'getdigits',_0xcca2('0xc')];var AGIVertices=function(_0x3e854f,_0x5ea847,_0x24d5e5){this[_0xcca2('0xd')]=_0x3e854f;this[_0xcca2('0xe')]=_0x5ea847;this[_0xcca2('0xf')]=_0x24d5e5;};AGIVertices[_0xcca2('0x10')]['getVariable']=function(_0x4a950a,_0x5c3100){this['rpc'][_0xcca2('0x11')](_0x4a950a)[_0xcca2('0x12')](function(_0x44d32b){_0x5c3100(null,_0x44d32b?_0x44d32b[_0xcca2('0x13')]:![]);})['catch'](function(_0x3dc7ef){_0x5c3100(_0x3dc7ef);});};AGIVertices['prototype'][_0xcca2('0x14')]=function(_0x1c2ad8,_0x5a94b2){this['rpc']['getVoiceQueueById'](_0x1c2ad8)[_0xcca2('0x12')](function(_0x56f1f6){_0x5a94b2(null,_0x56f1f6?_0x56f1f6[_0xcca2('0x13')]:![]);})[_0xcca2('0x15')](function(_0x23f6c8){_0x5a94b2(_0x23f6c8);});};AGIVertices[_0xcca2('0x10')]['getSquareProject']=function(_0x1a91fc,_0x3673e5){this[_0xcca2('0xe')][_0xcca2('0x16')](_0x1a91fc)['then'](function(_0x2ed0af){_0x3673e5(null,_0x2ed0af?_0x2ed0af[_0xcca2('0x13')]:![]);})[_0xcca2('0x15')](function(_0x81829c){_0x3673e5(_0x81829c);});};AGIVertices[_0xcca2('0x10')][_0xcca2('0x17')]=function(_0x18d321,_0x3abf63){this[_0xcca2('0xe')][_0xcca2('0x18')](_0x18d321)[_0xcca2('0x12')](function(_0x109d8d){_0x3abf63(null,_0x109d8d?_0x109d8d[_0xcca2('0x19')]:![]);})['catch'](function(_0x13c8ba){_0x3abf63(_0x13c8ba);});};AGIVertices['prototype'][_0xcca2('0x1a')]=function(_0x1e666f,_0x536273){this['rpc']['getUserById'](_0x1e666f)[_0xcca2('0x12')](function(_0x2ea5f4){_0x536273(null,_0x2ea5f4?_0x2ea5f4[_0xcca2('0x13')]:![]);})['catch'](function(_0x40ee7e){_0x536273(_0x40ee7e);});};AGIVertices['prototype'][_0xcca2('0x1b')]=function(_0x4e78ac,_0x4d584c){this[_0xcca2('0xe')][_0xcca2('0x1c')](_0x4e78ac)[_0xcca2('0x12')](function(_0x20eb5b){_0x4d584c(null,_0x20eb5b?_0x20eb5b[_0xcca2('0x13')]:![]);})[_0xcca2('0x15')](function(_0x2c918e){_0x4d584c(_0x2c918e);});};AGIVertices[_0xcca2('0x10')][_0xcca2('0x1d')]=function(_0x569a05,_0x281766){var _0x1d2ff7=this;this[_0xcca2('0xe')]['getSoundById'](_0x569a05)['then'](function(_0x2801d2){_0x281766(null,_0x2801d2?_0x1d2ff7['getSoundPath'](_0x2801d2[_0xcca2('0x1e')]):![]);})[_0xcca2('0x15')](function(_0x41e2b4){_0x281766(_0x41e2b4);});};AGIVertices[_0xcca2('0x10')]['getMailAccount']=function(_0x5c70b2,_0x4882ba){this[_0xcca2('0xe')]['getMailAccountById'](_0x5c70b2)[_0xcca2('0x12')](function(_0x188de8){_0x4882ba(null,_0x188de8?_0x188de8:![]);})[_0xcca2('0x15')](function(_0x3885d6){_0x4882ba(_0x3885d6);});};AGIVertices[_0xcca2('0x10')][_0xcca2('0x1f')]=function(_0x259b6b,_0x3465c6,_0x37eef6){this[_0xcca2('0xf')]['sendMailMessage'](_0x259b6b,_0x3465c6)['then'](function(){_0x37eef6(null);})['catch'](function(_0x5cddb6){_0x37eef6(_0x5cddb6);});};AGIVertices[_0xcca2('0x10')]['getIntervals']=function(_0x48d376,_0x3d801c){this['rpc']['getIntervalById'](_0x48d376)[_0xcca2('0x12')](function(_0x52ffd1){if(_0x52ffd1){if(_0x52ffd1['IntervalId']){_0x3d801c(null,[_0x52ffd1['interval']]);}else{_0x3d801c(null,_[_0xcca2('0x20')](_0x52ffd1[_0xcca2('0x21')],_0xcca2('0x22')));}}else{_0x3d801c(null,![]);}})['catch'](function(_0x58a6f2){_0x3d801c(_0x58a6f2);});};AGIVertices[_0xcca2('0x10')][_0xcca2('0x23')]=function(_0x56f42b){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0x56f42b);};AGIVertices[_0xcca2('0x10')][_0xcca2('0x24')]=function(_0x74f2c8,_0x398ec0,_0x2b31b8){odbc[_0xcca2('0x25')](_0x74f2c8,function(_0x2b6569){if(_0x2b6569){logger[_0xcca2('0x26')](_0xcca2('0x27'),_0x2b6569);_0x2b31b8(_0x2b6569);}else{logger[_0xcca2('0x28')](_0xcca2('0x29'));odbc[_0xcca2('0x2a')](_0x398ec0,function(_0x415be8,_0x45f47b){if(_0x415be8){logger[_0xcca2('0x28')](_0xcca2('0x2b'),_0x398ec0);_0x2b31b8(_0x415be8);}else{logger[_0xcca2('0x28')](_0xcca2('0x2c'),_0x398ec0);odbc[_0xcca2('0x2d')](function(_0xbc4b93){if(_0xbc4b93){logger[_0xcca2('0x26')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0xbc4b93);}_0x2b31b8(null,_0x45f47b);});}});}});};AGIVertices[_0xcca2('0x10')][_0xcca2('0x2e')]=function(_0x20a687,_0x34caf1){this[_0xcca2('0xe')][_0xcca2('0x2f')](_0x20a687)['then'](function(_0x1d09c9){_0x34caf1(null,_0x1d09c9?_0x1d09c9:![]);})['catch'](function(_0x3b31f9){_0x34caf1(_0x3b31f9);});};AGIVertices[_0xcca2('0x10')][_0xcca2('0x30')]=function(_0x1c4ac9,_0x4ce97b){this[_0xcca2('0xe')][_0xcca2('0x30')](_0x1c4ac9)['then'](function(_0x11d0d4){_0x4ce97b(null,_0x11d0d4);})[_0xcca2('0x15')](function(_0x3f578c){_0x4ce97b(_0x3f578c);});};AGIVertices[_0xcca2('0x10')]['createSquareDetailsReport']=function(_0x19f69a,_0x534ebb,_0x39cb6d){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0xcca2('0xd')][_0xcca2('0x31')],'node':_0x19f69a[_0xcca2('0x32')],'application':_0x19f69a[_0xcca2('0x33')],'data':_0x534ebb||null,'project_name':this[_0xcca2('0xd')][_0xcca2('0x34')],'callerid':this[_0xcca2('0xd')][_0xcca2('0x35')]})[_0xcca2('0x12')](function(_0x9a498b){if(_0x39cb6d){_0x39cb6d(null,_0x9a498b);}})['catch'](function(_0x4bbbfb){if(_0x39cb6d){_0x39cb6d(_0x4bbbfb);}});};AGIVertices[_0xcca2('0x10')][_0xcca2('0x36')]=function(_0x327825,_0x44a8df,_0x2fea45,_0x4310ae){this[_0xcca2('0xe')]['createSquareRecording']({'uniqueid':this[_0xcca2('0xd')][_0xcca2('0x31')],'callerid':this[_0xcca2('0xd')]['callerid'],'calleridname':this[_0xcca2('0xd')][_0xcca2('0x37')],'context':this['channel'][_0xcca2('0x38')],'extension':this[_0xcca2('0xd')]['extension'],'priority':this[_0xcca2('0xd')][_0xcca2('0x39')],'accountcode':this[_0xcca2('0xd')][_0xcca2('0x3a')],'dnid':this[_0xcca2('0xd')][_0xcca2('0x3b')],'projectName':this['channel'][_0xcca2('0x34')],'saveName':_0x44a8df,'filename':_0x327825[_0xcca2('0x3c')]||_0x44a8df,'savePath':_0x2fea45})['then'](function(_0x46e25e){_0x4310ae(null,_0x46e25e);})['catch'](function(_0x3809a4){_0x4310ae(_0x3809a4);});};AGIVertices[_0xcca2('0x10')][_0xcca2('0x3d')]=function(_0xa7b5d8,_0x573291,_0x14a5cb,_0xd1c1f3,_0x441092){this['rpc'][_0xcca2('0x3d')]({'uniqueid':this['channel'][_0xcca2('0x31')],'body':_0xa7b5d8,'direction':_0x573291,'providerName':_0x14a5cb,'providerResponse':_0xd1c1f3})['then'](function(_0x1455b5){if(_0x441092){_0x441092(null,_0x1455b5);}})[_0xcca2('0x15')](function(_0x1a517f){if(_0x441092){_0x441092(_0x1a517f);}});};AGIVertices['prototype']['createCmContact']=function(_0x4fb4e3,_0x3ae58e){this[_0xcca2('0xe')][_0xcca2('0x3e')]({'firstName':_[_0xcca2('0x3f')](_0x4fb4e3['name'])||_[_0xcca2('0x40')](_0x4fb4e3[_0xcca2('0x13')])?_0xcca2('0x41')+Math['random']():_0x4fb4e3[_0xcca2('0x13')],'lastName':_[_0xcca2('0x3f')](_0x4fb4e3['lastName'])||_[_0xcca2('0x40')](_0x4fb4e3['lastName'])?null:_0x4fb4e3[_0xcca2('0x42')],'phone':_0x4fb4e3[_0xcca2('0x43')],'ListId':_0x4fb4e3[_0xcca2('0x44')],'scheduledat':_0x4fb4e3['scheduledAt'],'callbackUniqueid':this[_0xcca2('0xd')][_0xcca2('0x31')],'tags':_0xcca2('0x45'),'description':_0xcca2('0x46')+_0x4fb4e3[_0xcca2('0x47')][_0xcca2('0x48')](),'priority':_0x4fb4e3[_0xcca2('0x49')]})[_0xcca2('0x12')](function(_0x588f3c){_0x3ae58e(null,_0x588f3c);})['catch'](function(_0x12665a){_0x3ae58e(_0x12665a);});};AGIVertices[_0xcca2('0x10')][_0xcca2('0x4a')]=function(_0x263559,_0x1e0674){this[_0xcca2('0xe')]['getPauseById'](_0x263559)[_0xcca2('0x12')](function(_0x17e099){_0x1e0674(null,_0x17e099?_0x17e099['name']:![]);})[_0xcca2('0x15')](function(_0x3f1190){_0x1e0674(_0x3f1190);});};AGIVertices['prototype'][_0xcca2('0x4b')]=function(_0x3636df,_0x34302c,_0x1dc3f3){var _0x38b3ef={'role':_0xcca2('0x4c')};_0x38b3ef[_0x3636df]=this[_0xcca2('0xd')][_0xcca2('0x35')];this['rpc']['agentPause'](_0x38b3ef,_0x34302c,this[_0xcca2('0xd')][_0xcca2('0x31')])[_0xcca2('0x12')](function(_0x1b2aba){_0x1dc3f3(null,_[_0xcca2('0x40')](_0x1b2aba)?![]:!![]);})[_0xcca2('0x15')](function(_0x1fe7c9){logger['error'](_0x1fe7c9);_0x1dc3f3(null,![]);});};AGIVertices[_0xcca2('0x10')]['agentUnpause']=function(_0x19a7ee,_0x381e23){var _0x52053d={'role':'agent'};_0x52053d[_0x19a7ee]=this[_0xcca2('0xd')][_0xcca2('0x35')];this[_0xcca2('0xe')][_0xcca2('0x4d')](_0x52053d)[_0xcca2('0x12')](function(_0x251b45){_0x381e23(null,_[_0xcca2('0x40')](_0x251b45)?![]:!![]);})[_0xcca2('0x15')](function(_0x3b0631){logger[_0xcca2('0x26')](_0x3b0631);_0x381e23(null,![]);});};AGIVertices['prototype'][_0xcca2('0x4e')]=function(_0x16e5f1,_0x2583f5){var _0x2c0fe6={'role':_0xcca2('0x4c')};_0x2c0fe6[_0x16e5f1]=this['channel']['callerid'];this['rpc']['agentLogout'](_0x2c0fe6)[_0xcca2('0x12')](function(_0x2f4ed0){_0x2583f5(null,_[_0xcca2('0x40')](_0x2f4ed0)?![]:!![]);})['catch'](function(_0x2bf7a2){logger[_0xcca2('0x26')](_0x2bf7a2);_0x2583f5(null,![]);});};AGIVertices[_0xcca2('0x10')][_0xcca2('0x4f')]=function(_0x40cc18,_0x1bfaff){var _0x2c528b={'role':_0xcca2('0x4c')};_0x2c528b[_0x40cc18]=this[_0xcca2('0xd')][_0xcca2('0x35')];var _0x2c1e35=_0x40cc18!=_0xcca2('0x50')?util[_0xcca2('0x51')]('%s/%s@from-sip/n',_0xcca2('0x52'),this[_0xcca2('0xd')][_0xcca2('0x35')]):undefined;this[_0xcca2('0xe')]['agentLogin'](_0x2c528b,_0x2c1e35)[_0xcca2('0x12')](function(_0x2d6774){_0x1bfaff(null,_[_0xcca2('0x40')](_0x2d6774)?![]:!![]);})[_0xcca2('0x15')](function(_0x5aea51){logger['error'](_0x5aea51);_0x1bfaff(null,![]);});};AGIVertices[_0xcca2('0x10')][_0xcca2('0x53')]=function(_0x153f58,_0x3eb7da){sh[_0xcca2('0x54')](_[_0xcca2('0x55')](_0x153f58),function(_0x1b4596,_0x4c55f9){var _0x2cfca0=_0x4c55f9['replace'](/(\r\n|\n|\r)/gm,'');_0x3eb7da(null,_0x2cfca0);});};AGIVertices[_0xcca2('0x10')][_0xcca2('0x56')]=function(_0x7e2d0f,_0x3bebd8){scripts[_0xcca2('0x56')](_0x7e2d0f[_0xcca2('0x57')],_0x7e2d0f[_0xcca2('0x58')]||_0xcca2('0x59'),_0x7e2d0f[_0xcca2('0x59')],_0x7e2d0f[_0xcca2('0x5a')]||_0xcca2('0x5b'),_0x7e2d0f[_0xcca2('0x5c')]||_0xcca2('0x5d'),_0x7e2d0f[_0xcca2('0x5e')]||_0xcca2('0x5f'))[_0xcca2('0x12')](function(_0x253635){_0x3bebd8(null,_0x253635);})[_0xcca2('0x15')](function(_0xc5e1a0){_0x3bebd8(_0xc5e1a0);});};AGIVertices[_0xcca2('0x10')][_0xcca2('0x60')]=function(_0x46de4a,_0x57285a){scripts[_0xcca2('0x60')](_0x46de4a['text'],_0x46de4a[_0xcca2('0x61')]||'en',0x1)[_0xcca2('0x12')](function(_0x2db899){_0x57285a(null,_0x2db899);})['catch'](function(_0x5493fe){_0x57285a(_0x5493fe);});};AGIVertices[_0xcca2('0x10')]['restAPI']=function(_0x47b5de,_0x1fa864){var _0x3e7e69={'uri':_0x47b5de[_0xcca2('0x62')],'method':_0x47b5de['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x47b5de[_0xcca2('0x63')])===_0xcca2('0x64')&&parseInt(_0x47b5de[_0xcca2('0x63')])>=0x1?parseInt(_0x47b5de[_0xcca2('0x63')])*0x3e8:0x5*0x3e8};if(_[_0xcca2('0x65')]([_0xcca2('0x66'),_0xcca2('0x67')],_0x3e7e69[_0xcca2('0x68')][_0xcca2('0x69')]())){try{_0x3e7e69['body']=_0x47b5de['rawBody']?JSON[_0xcca2('0x6a')](_0x47b5de[_0xcca2('0xa')]):{};}catch(_0x41a2c0){logger[_0xcca2('0x26')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x41a2c0);}}try{_0x3e7e69[_0xcca2('0x6b')]=_0x47b5de[_0xcca2('0x9')]?JSON['parse'](_0x47b5de[_0xcca2('0x9')]):{};}catch(_0x451f64){logger[_0xcca2('0x26')](_0xcca2('0x6c'),_0x451f64);}if(_0x47b5de[_0xcca2('0x6d')]){try{var _0x966021=require(_0x47b5de[_0xcca2('0x6d')])[_0xcca2('0x6e')](this,_0x3e7e69);_0x3e7e69[_0xcca2('0x6f')]=Mustache['render'](_0x47b5de['url'],_0x966021,{},['$$','$$']);if(_0x3e7e69['headers']){_0x3e7e69['headers']=JSON[_0xcca2('0x6a')](Mustache[_0xcca2('0x70')](JSON[_0xcca2('0x71')](_0x3e7e69[_0xcca2('0x6b')]),_0x966021,{},['$$','$$']));}if(_0x3e7e69[_0xcca2('0x72')]){_0x3e7e69[_0xcca2('0x72')]=JSON['parse'](Mustache[_0xcca2('0x70')](JSON[_0xcca2('0x71')](_0x3e7e69[_0xcca2('0x72')]),_0x966021,{},['$$','$$']));}}catch(_0x55a2f9){logger['error'](_0xcca2('0x73'),_0x55a2f9);}}rp(_0x3e7e69)['then'](function(_0x344cc8){var _0x3cbd88={'statusCode':_0x344cc8['statusCode']||0xc8,'statusMessage':_0x344cc8[_0xcca2('0x74')]||'OK','headers':_0x344cc8[_0xcca2('0x6b')]||{},'body':_0x344cc8[_0xcca2('0x72')]||{}};_0x1fa864(null,_0x3cbd88);})['catch'](function(_0x100a0){var _0x587d26={'statusCode':_0x100a0[_0xcca2('0x75')]||0x1f4,'statusMessage':_0x100a0[_0xcca2('0x76')]||_0xcca2('0x77'),'headers':_0x100a0['options'][_0xcca2('0x6b')]||{},'body':_0x100a0[_0xcca2('0x78')][_0xcca2('0x72')]||{}};_0x1fa864(null,_0x587d26);});};AGIVertices[_0xcca2('0x10')][_0xcca2('0x79')]=function(_0x52724f,_0xa9769f){scripts[_0xcca2('0x79')](this['channel'][_0xcca2('0x31')],_0x52724f[_0xcca2('0x7a')],_0x52724f[_0xcca2('0x59')],_0x52724f[_0xcca2('0x7b')]||'en')[_0xcca2('0x12')](function(_0x35c1d4){_0xa9769f(null,_0x35c1d4);})[_0xcca2('0x15')](function(_0x16b0a2){_0xa9769f(_0x16b0a2);});};AGIVertices[_0xcca2('0x10')][_0xcca2('0x7c')]=function(_0x93a5ca,_0x2a216c){scripts[_0xcca2('0x7c')](this[_0xcca2('0xd')][_0xcca2('0x31')],_0x93a5ca['dialogflowV2_project_id'],_0x93a5ca[_0xcca2('0x7d')],_0x93a5ca[_0xcca2('0x7e')],_0x93a5ca[_0xcca2('0x59')],_0x93a5ca[_0xcca2('0x7f')]||'en')[_0xcca2('0x12')](function(_0x1b74f0){_0x2a216c(null,_0x1b74f0);})[_0xcca2('0x15')](function(_0x2962bb){_0x2a216c(_0x2962bb);});};AGIVertices['prototype'][_0xcca2('0x80')]=function(_0x3dcec1,_0x5c1492){scripts[_0xcca2('0x80')](this[_0xcca2('0xd')],_0x3dcec1)[_0xcca2('0x12')](function(_0xd42ec5){_0x5c1492(null,_0xd42ec5);})[_0xcca2('0x15')](function(_0x5e5787){_0x5c1492(_0x5e5787);});};AGIVertices[_0xcca2('0x10')][_0xcca2('0x81')]=function(_0x309c9d,_0x357786){scripts['ispeechTTS'](_0x309c9d['key'],_0x309c9d[_0xcca2('0x59')],_0x309c9d[_0xcca2('0x82')]||'en-US',_0x309c9d[_0xcca2('0x83')])[_0xcca2('0x12')](function(_0x57c70d){_0x357786(null,_0x57c70d);})[_0xcca2('0x15')](function(_0xa4c02){_0x357786(_0xa4c02);});};AGIVertices[_0xcca2('0x10')][_0xcca2('0x84')]=function(_0x151010,_0x3b2b6e,_0x45aeed){scripts[_0xcca2('0x84')](_0x3b2b6e,_0x151010['key'],_0x151010[_0xcca2('0x85')]||'en-US',this[_0xcca2('0x86')](_0x151010[_0xcca2('0x87')])?_0x151010['model']:undefined)[_0xcca2('0x12')](function(_0x45f91f){_0x45aeed(null,_0x45f91f);})[_0xcca2('0x15')](function(_0x4cdf96){_0x45aeed(_0x4cdf96);});};AGIVertices[_0xcca2('0x10')][_0xcca2('0x88')]=function(_0x4fb087,_0x2a7fe1){scripts[_0xcca2('0x88')](_0x4fb087[_0xcca2('0x89')],_0x4fb087[_0xcca2('0x8a')],_0x4fb087[_0xcca2('0x8b')],_0x4fb087[_0xcca2('0x8c')]||_0xcca2('0x8d'),_0x4fb087[_0xcca2('0x59')],_0x4fb087['aws_text_type']||_0xcca2('0x59'))[_0xcca2('0x12')](function(_0x48ee76){_0x2a7fe1(null,_0x48ee76);})[_0xcca2('0x15')](function(_0x47b370){_0x2a7fe1(_0x47b370);});};AGIVertices[_0xcca2('0x10')][_0xcca2('0x8e')]=function(_0x9a6e57,_0x46937c){scripts[_0xcca2('0x8e')](this[_0xcca2('0xd')][_0xcca2('0x31')],_0x9a6e57['aws_access_key_id'],_0x9a6e57[_0xcca2('0x8a')],_0x9a6e57[_0xcca2('0x8f')],_0x9a6e57[_0xcca2('0x59')],_0x9a6e57['aws_bot_name'])[_0xcca2('0x12')](function(_0x1df420){_0x46937c(null,_0x1df420);})[_0xcca2('0x15')](function(_0x2eb8cf){_0x46937c(_0x2eb8cf);});};AGIVertices[_0xcca2('0x10')][_0xcca2('0x90')]=function(_0x5f1a17,_0x4d3c0f,_0x33f115){scripts[_0xcca2('0x90')](_0x4d3c0f,_0x5f1a17[_0xcca2('0x7a')],_0x5f1a17['google_asr_language']||'en-US')[_0xcca2('0x12')](function(_0x35e6a5){_0x33f115(null,_0x35e6a5);})['catch'](function(_0x4ec668){_0x33f115(_0x4ec668);});};AGIVertices[_0xcca2('0x10')]['tildeASR']=function(_0x3a4f62,_0x33b9b2,_0x2bd1d1){scripts[_0xcca2('0x91')](_0x33b9b2,_0x3a4f62[_0xcca2('0x92')],_0x3a4f62[_0xcca2('0x93')],_0x3a4f62[_0xcca2('0x6f')])[_0xcca2('0x12')](function(_0x5d1d08){_0x2bd1d1(null,_0x5d1d08);})[_0xcca2('0x15')](function(_0x1d94cf){_0x2bd1d1(_0x1d94cf);});};AGIVertices[_0xcca2('0x10')]['clear']=function(_0xf619bd){var _0x249d8f=_[_0xcca2('0x65')](verticesWithRetry,_0xf619bd[_0xcca2('0x33')])?_0xf619bd:_[_0xcca2('0x94')](_0xf619bd);for(var _0x4b0138 in _0x249d8f){if(_0x249d8f['hasOwnProperty'](_0x4b0138)){if(_0x249d8f[_0x4b0138]&&_[_0xcca2('0x95')](_0x249d8f[_0x4b0138])){if(_[_0xcca2('0x65')](recursiveMapAttributes,_0x4b0138)){_0x249d8f[_0x4b0138]=this['replaceObjectAllVariables'](_0x249d8f[_0x4b0138]);}else{_0x249d8f[_0x4b0138]=this[_0xcca2('0x96')](_0x249d8f[_0x4b0138]);}}}}return _0x249d8f;};AGIVertices['prototype']['recursiveNodeIndex']=function(_0x185430){for(var _0x4cc39a in _0x185430){if(_0x185430[_0xcca2('0x97')](_0x4cc39a)){if(_['isPlainObject'](_0x185430[_0x4cc39a])){this['recursiveNodeIndex'](_0x185430[_0x4cc39a]);}else if(_[_0xcca2('0x98')](_0x185430[_0x4cc39a])){for(var _0x3e9816=0x0;_0x3e9816<_0x185430[_0x4cc39a][_0xcca2('0x99')];_0x3e9816++){this['recursiveNodeIndex'](_0x185430[_0x4cc39a][_0x3e9816]);}}else if(_['isString'](_0x185430[_0x4cc39a])){_0x185430[_0x4cc39a]=this['replaceAllVariables'](_0x185430[_0x4cc39a]);}}}};AGIVertices[_0xcca2('0x10')][_0xcca2('0x9a')]=function(_0xecb11e,_0x23cd10){for(var _0x554005 in _0xecb11e){if(_0xecb11e[_0xcca2('0x97')](_0x554005)){if(_[_0xcca2('0x9b')](_0xecb11e[_0x554005])){if(!_[_0xcca2('0x3f')](_0xecb11e[_0x554005])){this[_0xcca2('0x9a')](_0xecb11e[_0x554005],util[_0xcca2('0x51')](_0xcca2('0x9c'),_0x23cd10,_0x554005));}}else if(_['isArray'](_0xecb11e[_0x554005])){for(var _0x1e4e8d=0x0;_0x1e4e8d<_0xecb11e[_0x554005][_0xcca2('0x99')];_0x1e4e8d++){this['saveRestApiResult'](_0xecb11e[_0x554005][_0x1e4e8d],util[_0xcca2('0x51')](_0xcca2('0x9c'),_0x23cd10,_0x554005+'['+_0x1e4e8d+']'));}}else{if(!_[_0xcca2('0x40')](_0xecb11e[_0x554005])){this['channel'][_0xcca2('0x9d')](util[_0xcca2('0x51')]('%s.%s',_0x23cd10,_0x554005),_0xecb11e[_0x554005]);}}}}};AGIVertices[_0xcca2('0x10')]['replaceObjectAllVariables']=function(_0x2f2db6){try{var _0x4b72b9=JSON['parse'](_0x2f2db6);this[_0xcca2('0x9e')](_0x4b72b9);return JSON['stringify'](_0x4b72b9);}catch(_0x43272a){return this[_0xcca2('0x96')](_0x2f2db6);}};AGIVertices[_0xcca2('0x10')]['replaceAllVariables']=function(_0x5b1f55){var _0xd51fa8=_0x5b1f55[_0xcca2('0x9f')]('{');for(var _0x235cdf=0x1;_0x235cdf<_0xd51fa8[_0xcca2('0x99')];_0x235cdf+=0x1){var _0x3bc46a=_0xd51fa8[_0x235cdf][_0xcca2('0x9f')]('}');if(_0x3bc46a[_0xcca2('0x99')]>0x1){_0x5b1f55=_0x5b1f55[_0xcca2('0xa0')]('{'+_0x3bc46a[0x0]+'}',this[_0xcca2('0xd')][_0xcca2('0xa1')](_0x3bc46a[0x0])[_0xcca2('0xa2')]||_0x3bc46a[0x0]);}}if(_0xd51fa8[_0xcca2('0x99')]===0x1){return _0x5b1f55[_0xcca2('0x48')]();}return this[_0xcca2('0x96')](_0x5b1f55);};AGIVertices[_0xcca2('0x10')][_0xcca2('0xa3')]=function(_0x186757,_0x1fd7dd){var _0x2c3e71=this[_0xcca2('0xd')][_0xcca2('0xa1')](_0x186757);if(_0x2c3e71['result']===-0x1){return _0x2c3e71;}logger['info'](util[_0xcca2('0x51')](_0xcca2('0xa4'),_0x1fd7dd,_0x2c3e71[_0xcca2('0xa2')]));return this[_0xcca2('0xd')][_0xcca2('0x9d')](_0x1fd7dd,_0x2c3e71[_0xcca2('0xa2')]);};AGIVertices['prototype'][_0xcca2('0x86')]=function(_0x2300e5){return _0x2300e5&&_0x2300e5!=='0'&&_0x2300e5!=='-1'&&_0x2300e5!=='';};AGIVertices[_0xcca2('0x10')]['maxRetry']=function(_0x398e13){this[_0xcca2('0xa5')][_0xcca2('0x6e')](this,_0x398e13,'-');_0x398e13[_0xcca2('0xa6')]=_0x398e13[_0xcca2('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xcca2('0x10')]['mrcpsynth']=function(_0xb894bb){logger[_0xcca2('0x28')](util['format']('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0xb894bb[_0xcca2('0x32')]));if(!this[_0xcca2('0x86')](_0xb894bb[_0xcca2('0x59')])){return this['channel'][_0xcca2('0xa8')](_0xcca2('0xa9'));}var _0x301749='\x22'+_0xb894bb[_0xcca2('0x59')]+'\x22';if(this[_0xcca2('0x86')](_0xb894bb['options'])){_0x301749+=','+_0xb894bb[_0xcca2('0x78')];}var _0x1bf791=this[_0xcca2('0xd')]['exec'](_0xcca2('0xaa'),_0x301749);if(_0x1bf791[_0xcca2('0xab')]===-0x1){return _0x1bf791;}return this[_0xcca2('0xd')][_0xcca2('0xa8')](util[_0xcca2('0x51')](_0xcca2('0xac'),_0x301749));};AGIVertices[_0xcca2('0x10')][_0xcca2('0xad')]=function(_0x1b257f){logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0xae'),_0x1b257f[_0xcca2('0x32')]));if(!this[_0xcca2('0x86')](_0x1b257f['grammar'])){return this[_0xcca2('0xd')]['noop'](_0xcca2('0xaf'));}var _0x16e83=_0x1b257f[_0xcca2('0xb0')];if(this[_0xcca2('0x86')](_0x1b257f[_0xcca2('0x78')])){_0x16e83+=','+_0x1b257f[_0xcca2('0x78')];}var _0x430864=this[_0xcca2('0xd')][_0xcca2('0x54')](_0xcca2('0xb1'),_0x16e83);if(_0x430864[_0xcca2('0xab')]===-0x1){return _0x430864;}var _0x42b352=this[_0xcca2('0xa3')](_0xcca2('0xb2'),'MRCP_RECOG_CONFIDENCE');if(_0x42b352[_0xcca2('0xab')]===-0x1){return _0x42b352;}var _0x1265f2=this[_0xcca2('0xa3')]('RECOG_INPUT()',_0xcca2('0xb3'));if(_0x1265f2[_0xcca2('0xab')]===-0x1){return _0x1265f2;}var _0x58bb0c=this[_0xcca2('0xa3')](_0xcca2('0xb4'),_0xcca2('0xb5'));if(_0x58bb0c[_0xcca2('0xab')]===-0x1){return _0x58bb0c;}return this['channel']['noop'](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x16e83));};AGIVertices[_0xcca2('0x10')][_0xcca2('0x8')]=function(_0x260a7e){logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0xb6'),_0x260a7e[_0xcca2('0x32')]));return this[_0xcca2('0xd')]['agi']([_0x260a7e[_0xcca2('0xb7')],_0x260a7e['args']]);};AGIVertices[_0xcca2('0x10')][_0xcca2('0xb8')]=function(_0x41ded6){logger[_0xcca2('0x28')](util[_0xcca2('0x51')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x41ded6[_0xcca2('0x32')]));if(this[_0xcca2('0x86')](_0x41ded6[_0xcca2('0x63')])){logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0xb9'),_0x41ded6[_0xcca2('0x63')]));var _0x4cf2a4=this['channel'][_0xcca2('0xba')](_0x41ded6[_0xcca2('0x63')]);if(_0x4cf2a4['result']===-0x1){return _0x4cf2a4;}}return this['channel'][_0xcca2('0xb8')]();};AGIVertices[_0xcca2('0x10')][_0xcca2('0x45')]=function(_0x18311a){logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0xbb'),_0x18311a[_0xcca2('0x32')]));if(!this[_0xcca2('0x86')](_0x18311a[_0xcca2('0x44')])){return this['channel']['error'](_0x18311a,_0xcca2('0xbc'));}_0x18311a[_0xcca2('0x47')]=moment();if(this[_0xcca2('0x86')](_0x18311a['delay'])){_0x18311a['scheduledAt']=moment()['add'](_0x18311a[_0xcca2('0xbd')],_0xcca2('0xbe'));}if(!this[_0xcca2('0x86')](_0x18311a[_0xcca2('0x49')])){_0x18311a['callback_priority']=0x2;}this['createCmContact'][_0xcca2('0x6e')](this,_0x18311a);return this[_0xcca2('0xd')][_0xcca2('0xa8')](util[_0xcca2('0x51')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x18311a[_0xcca2('0x43')],_0x18311a['list_id'],_0x18311a[_0xcca2('0x47')]));};AGIVertices[_0xcca2('0x10')][_0xcca2('0xbf')]=function(_0x48be1d){logger['info'](util[_0xcca2('0x51')](_0xcca2('0xc0'),_0x48be1d['label']));var _0x229b0c=this[_0xcca2('0xd')][_0xcca2('0x54')](_0x48be1d[_0xcca2('0xc1')],_0x48be1d[_0xcca2('0x78')]);if(_0x229b0c[_0xcca2('0xab')]===-0x1){return _0x229b0c;}return this['channel'][_0xcca2('0xa8')](util[_0xcca2('0x51')](_0xcca2('0xc2'),_0x48be1d[_0xcca2('0xc1')],_0x48be1d[_0xcca2('0x78')]));};AGIVertices[_0xcca2('0x10')][_0xcca2('0xc3')]=function(_0x4f7803){logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0xc4'),_0x4f7803[_0xcca2('0x32')]));if(!this[_0xcca2('0x86')](_0x4f7803[_0xcca2('0x59')])){return this[_0xcca2('0xd')][_0xcca2('0xa8')]('no\x20text\x20configured');}var _0x3d11bf='\x22'+_0x4f7803[_0xcca2('0x59')]+'\x22';if(this['isConfigured'](_0x4f7803['options'])){_0x3d11bf+=','+_0x4f7803['options'];}var _0x3a0d90=this['channel'][_0xcca2('0x54')]('MRCPSynth',_0x3d11bf);if(_0x3a0d90[_0xcca2('0xab')]===-0x1){return _0x3a0d90;}return this['channel'][_0xcca2('0xa8')](util[_0xcca2('0x51')](_0xcca2('0xac'),_0x3d11bf));};AGIVertices[_0xcca2('0x10')][_0xcca2('0xc5')]=function(_0x4234ba){logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0xc6'),_0x4234ba[_0xcca2('0x32')]));if(!this['isConfigured'](_0x4234ba['text'])){return this[_0xcca2('0xd')][_0xcca2('0xa8')](_0xcca2('0xa9'));}var _0x4f8b63='\x22'+_0x4234ba['text']+'\x22';if(this[_0xcca2('0x86')](_0x4234ba[_0xcca2('0x78')])){_0x4f8b63+=','+_0x4234ba[_0xcca2('0x78')];}var _0x436e83=this[_0xcca2('0xd')][_0xcca2('0x54')](_0xcca2('0xaa'),_0x4f8b63);if(_0x436e83[_0xcca2('0xab')]===-0x1){return _0x436e83;}return this['channel'][_0xcca2('0xa8')](util[_0xcca2('0x51')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4f8b63));};AGIVertices[_0xcca2('0x10')]['lumenvoxasr']=function(_0x57efed){logger['info'](util['format'](_0xcca2('0xc7'),_0x57efed[_0xcca2('0x32')]));if(!this[_0xcca2('0x86')](_0x57efed[_0xcca2('0xb0')])){return this['channel'][_0xcca2('0xa8')](_0xcca2('0xaf'));}var _0x4ae157=_0x57efed[_0xcca2('0xb0')];if(this['isConfigured'](_0x57efed[_0xcca2('0x78')])){_0x4ae157+=','+_0x57efed[_0xcca2('0x78')];}var _0xe75919=this[_0xcca2('0xd')][_0xcca2('0x54')](_0xcca2('0xb1'),_0x4ae157);if(_0xe75919[_0xcca2('0xab')]===-0x1){return _0xe75919;}var _0xc356e3=this[_0xcca2('0xa3')](_0xcca2('0xb2'),'LUMENVOX_ASR_CONFIDENCE');if(_0xc356e3[_0xcca2('0xab')]===-0x1){return _0xc356e3;}var _0x31e070=this[_0xcca2('0xa3')](_0xcca2('0xc8'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x31e070['result']===-0x1){return _0x31e070;}var _0x3c39ca=this['getAndSetVariable'](_0xcca2('0xb4'),_0xcca2('0xc9'));if(_0x3c39ca[_0xcca2('0xab')]===-0x1){return _0x3c39ca;}return this[_0xcca2('0xd')][_0xcca2('0xa8')](util[_0xcca2('0x51')](_0xcca2('0xca'),_0x4ae157));};AGIVertices['prototype'][_0xcca2('0xcb')]=function(_0x2c3c50){logger[_0xcca2('0x28')](util['format']('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x2c3c50[_0xcca2('0x32')]));if(!this[_0xcca2('0x86')](_0x2c3c50['grammar'])){return this['channel']['noop'](_0xcca2('0xaf'));}var _0x15f4dc=_0x2c3c50['grammar'];if(this[_0xcca2('0x86')](_0x2c3c50[_0xcca2('0x78')])){_0x15f4dc+=','+_0x2c3c50[_0xcca2('0x78')];}var _0x16a461=this[_0xcca2('0xd')][_0xcca2('0x54')](_0xcca2('0xb1'),_0x15f4dc);if(_0x16a461[_0xcca2('0xab')]===-0x1){return _0x16a461;}var _0x6aed4d=this[_0xcca2('0xa3')](_0xcca2('0xb2'),_0xcca2('0xcc'));if(_0x6aed4d[_0xcca2('0xab')]===-0x1){return _0x6aed4d;}var _0x5e3cb8=this[_0xcca2('0xa3')](_0xcca2('0xc8'),_0xcca2('0xcd'));if(_0x5e3cb8[_0xcca2('0xab')]===-0x1){return _0x5e3cb8;}var _0x58ec8b=this[_0xcca2('0xa3')](_0xcca2('0xb4'),'SESTEK_ASR_INSTANCE');if(_0x58ec8b['result']===-0x1){return _0x58ec8b;}return this['channel']['noop'](util['format'](_0xcca2('0xca'),_0x15f4dc));};AGIVertices['prototype'][_0xcca2('0xce')]=function(_0x5ef404){logger['info'](util[_0xcca2('0x51')](_0xcca2('0xcf'),_0x5ef404[_0xcca2('0x32')]));if(!this[_0xcca2('0x86')](_0x5ef404[_0xcca2('0xd0')])){return this[_0xcca2('0xd')][_0xcca2('0x26')](_0x5ef404,_0xcca2('0xd1'));}var _0x1f48d4=this[_0xcca2('0x17')][_0xcca2('0x6e')](this,_0x5ef404[_0xcca2('0xd0')]);if(!_0x1f48d4){return this[_0xcca2('0xd')][_0xcca2('0x26')](_0x5ef404,_0xcca2('0xd2'));}if(!this[_0xcca2('0x86')](_0x5ef404[_0xcca2('0x2a')])){return this[_0xcca2('0xd')]['error'](_0x5ef404,'no\x20query\x20configured');}var _0x5747ee=_0x5ef404['query'][_0xcca2('0xd3')](/(\r\n|\n|\r)/gm,'\x20');this[_0xcca2('0xd')][_0xcca2('0xa8')](util[_0xcca2('0x51')](_0xcca2('0xd4'),_0x5747ee));var _0x4b85e4=this['getQueryOdbc'][_0xcca2('0x6e')](this,_0x1f48d4,_0x5747ee);this['createSquareDetailsReport'][_0xcca2('0x6e')](this,_0x5ef404,_0x5747ee);if(!this[_0xcca2('0x86')](_0x5ef404['variable_id'])){return this[_0xcca2('0xd')][_0xcca2('0xa8')](_0xcca2('0xd5'));}var _0x1d1d2c=this['getVariable'][_0xcca2('0x6e')](this,_0x5ef404[_0xcca2('0xd6')]);if(!_0x1d1d2c){return this[_0xcca2('0xd')][_0xcca2('0x26')](_0x5ef404,_0xcca2('0xd7'));}var _0x1895a8=this;_0x4b85e4['forEach'](function(_0x3545ca,_0x25e80c){Object[_0xcca2('0xd8')](_0x3545ca)[_0xcca2('0xd9')](function(_0x5ce33a){_0x1895a8['channel']['setVariable'](util[_0xcca2('0x51')]('%s[%s][%s]',_0x1d1d2c,_0x25e80c,_0x5ce33a),_0x3545ca[_0x5ce33a]);});});this[_0xcca2('0xd')][_0xcca2('0x9d')](util[_0xcca2('0x51')](_0xcca2('0xda'),_0x1d1d2c),_0x4b85e4[_0xcca2('0x99')]);return this['channel'][_0xcca2('0xa8')](util['format'](_0xcca2('0xdb'),_0x1d1d2c));};AGIVertices[_0xcca2('0x10')]['dial']=function(_0x8673ce){logger[_0xcca2('0xdc')](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x8673ce['label']));if(!this[_0xcca2('0x86')](_0x8673ce[_0xcca2('0xdd')])){return this['channel'][_0xcca2('0x26')](_0x8673ce,_0xcca2('0xde'));}var _0x359b63=this[_0xcca2('0x1a')][_0xcca2('0x6e')](this,_0x8673ce[_0xcca2('0xdd')]);if(!_0x359b63){return this['channel'][_0xcca2('0x26')](_0x8673ce,'no\x20user\x20found');}var _0x4e2db6=this['channel'][_0xcca2('0x54')](_0xcca2('0xdf'),[util[_0xcca2('0x51')](_0xcca2('0xe0'),_0x359b63),_0x8673ce[_0xcca2('0x63')],_0x8673ce[_0xcca2('0xe1')],_0x8673ce[_0xcca2('0x62')]]);if(_0x4e2db6[_0xcca2('0xab')]===-0x1){return _0x4e2db6;}return this[_0xcca2('0xd')]['noop'](util[_0xcca2('0x51')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0xcca2('0x10')][_0xcca2('0xe2')]=function(_0x3deca0){logger['info'](util['format'](_0xcca2('0xe3'),_0x3deca0[_0xcca2('0x32')]));if(!this[_0xcca2('0x86')](_0x3deca0[_0xcca2('0x7a')])){return this[_0xcca2('0xd')][_0xcca2('0xa8')](_0xcca2('0xe4'));}if(!this[_0xcca2('0x86')](_0x3deca0[_0xcca2('0x59')])){return this[_0xcca2('0xd')][_0xcca2('0xa8')](_0xcca2('0xa9'));}this[_0xcca2('0xd')][_0xcca2('0xe5')]=!![];this[_0xcca2('0xa5')](_0x3deca0);this[_0xcca2('0x3d')](_0x3deca0[_0xcca2('0x59')],'in','','');this[_0xcca2('0xd')]['noop'](util[_0xcca2('0x51')]('Trying\x20Dialogflow:\x20%s',_0x3deca0[_0xcca2('0x59')]));var _0x23ceff=this[_0xcca2('0x79')][_0xcca2('0x6e')](this,_0x3deca0);if(_0x23ceff){for(var _0x5a2306 in _0x23ceff){if(_0x23ceff[_0xcca2('0x97')](_0x5a2306)){this[_0xcca2('0xd')][_0xcca2('0x9d')](util[_0xcca2('0x51')](_0xcca2('0xe6'),_0x5a2306[_0xcca2('0x69')]()),_0x23ceff[_0x5a2306]);}}this[_0xcca2('0x3d')](_0x23ceff[_0xcca2('0xe7')],_0xcca2('0xe8'),_0xcca2('0xe2'),'');return this[_0xcca2('0xd')][_0xcca2('0xa8')](util[_0xcca2('0x51')](_0xcca2('0xe9'),_0x23ceff['speech']));}return this[_0xcca2('0xd')][_0xcca2('0x26')](_0x3deca0,_0xcca2('0xea'));};AGIVertices[_0xcca2('0x10')][_0xcca2('0xeb')]=function(_0x24e965){logger[_0xcca2('0x28')](util['format'](_0xcca2('0xec'),_0x24e965['label']));if(!this[_0xcca2('0x86')](_0x24e965[_0xcca2('0xed')])){return this[_0xcca2('0xd')][_0xcca2('0xa8')](_0xcca2('0xee'));}if(!this['isConfigured'](_0x24e965[_0xcca2('0x7d')])){return this[_0xcca2('0xd')][_0xcca2('0xa8')](_0xcca2('0xef'));}if(!this[_0xcca2('0x86')](_0x24e965[_0xcca2('0x7e')])){return this[_0xcca2('0xd')][_0xcca2('0xa8')](_0xcca2('0xf0'));}if(!this[_0xcca2('0x86')](_0x24e965['dialogflowV2_language'])){return this['channel'][_0xcca2('0xa8')](_0xcca2('0xf1'));}if(!this['isConfigured'](_0x24e965[_0xcca2('0x59')])){return this['channel'][_0xcca2('0xa8')](_0xcca2('0xa9'));}this[_0xcca2('0xd')]['bot']=!![];this[_0xcca2('0xa5')](_0x24e965);this[_0xcca2('0x3d')](_0x24e965[_0xcca2('0x59')],'in','','');this[_0xcca2('0xd')][_0xcca2('0xa8')](util['format']('Trying\x20DialogflowV2:\x20%s',_0x24e965[_0xcca2('0x59')]));var _0x45d70c=this[_0xcca2('0x7c')][_0xcca2('0x6e')](this,_0x24e965);if(_0x45d70c){for(var _0x3ce021 in _0x45d70c){if(_0x45d70c['hasOwnProperty'](_0x3ce021)){if(_0x3ce021!==_0xcca2('0xf2')){this[_0xcca2('0xd')][_0xcca2('0x9d')](util[_0xcca2('0x51')]('DIALOGFLOW_%s',_0x3ce021['toUpperCase']()),_0x45d70c[_0x3ce021]);}}}this['createSquareMessage'](_0x45d70c['speech'],_0xcca2('0xe8'),_0xcca2('0xeb'),_0x45d70c[_0xcca2('0xf2')]);return this['channel'][_0xcca2('0xa8')](util[_0xcca2('0x51')](_0xcca2('0xf3'),_0x45d70c['speech']));}return this[_0xcca2('0xd')][_0xcca2('0x26')](_0x24e965,_0xcca2('0xf4'));};AGIVertices[_0xcca2('0x10')][_0xcca2('0xf5')]=function(_0x5de638){logger[_0xcca2('0x28')](util['format'](_0xcca2('0xf6'),_0x5de638[_0xcca2('0x32')]));if(!this[_0xcca2('0x86')](_0x5de638[_0xcca2('0xf7')])){return this[_0xcca2('0xd')][_0xcca2('0xa8')](_0xcca2('0xf8'));}if(!this[_0xcca2('0x86')](_0x5de638[_0xcca2('0xf9')])){return this[_0xcca2('0xd')][_0xcca2('0xa8')](_0xcca2('0xfa'));}if(!this[_0xcca2('0x86')](_0x5de638[_0xcca2('0xfb')])){return this[_0xcca2('0xd')]['noop'](_0xcca2('0xfc'));}if(!this[_0xcca2('0x86')](_0x5de638[_0xcca2('0xfd')])){return this['channel'][_0xcca2('0xa8')](_0xcca2('0xa9'));}this[_0xcca2('0xd')][_0xcca2('0xe5')]=!![];this[_0xcca2('0xa5')](_0x5de638);this[_0xcca2('0x3d')](_0x5de638['text'],'in','','');this['channel'][_0xcca2('0xa8')](util[_0xcca2('0x51')](_0xcca2('0xfe'),_0x5de638['text']));var _0x5e8c8f=this[_0xcca2('0x80')][_0xcca2('0x6e')](this,_0x5de638);if(_0x5e8c8f){for(var _0x56cb22 in _0x5e8c8f){if(_0x5e8c8f[_0xcca2('0x97')](_0x56cb22)){this[_0xcca2('0xd')][_0xcca2('0x9d')](util['format'](_0xcca2('0xff'),_0x56cb22[_0xcca2('0x69')]()),_0x5e8c8f[_0x56cb22]);}}this['createSquareMessage'](_0x5e8c8f[_0xcca2('0xe7')],'out',_0xcca2('0xf5'),'');if(_0x5e8c8f['audiofile']){this[_0xcca2('0xd')][_0xcca2('0xa8')](util[_0xcca2('0x51')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x5e8c8f[_0xcca2('0x100')]));var _0x2bf84a=this[_0xcca2('0xd')]['streamFile'](_0x5e8c8f[_0xcca2('0x100')]);try{fs[_0xcca2('0x101')](_0x5e8c8f[_0xcca2('0x100')]+_0xcca2('0x102'));}catch(_0x413798){logger[_0xcca2('0x26')](_0x413798);}return _0x2bf84a;}else{return this[_0xcca2('0xd')]['noop'](util[_0xcca2('0x51')](_0xcca2('0x103'),_0x5e8c8f[_0xcca2('0xe7')]));}}return this[_0xcca2('0xd')][_0xcca2('0x26')](_0x5de638,_0xcca2('0x104'));};AGIVertices['prototype'][_0xcca2('0x105')]=function(_0x4416e2){logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0x106'),_0x4416e2[_0xcca2('0x32')]));return this[_0xcca2('0xd')][_0xcca2('0xa8')](_0xcca2('0x105'));};AGIVertices[_0xcca2('0x10')][_0xcca2('0x107')]=function(_0x59d897){logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0x108'),_0x59d897['label']));var _0x3200eb='';if(_0x59d897[_0xcca2('0x109')]){if(!this[_0xcca2('0x86')](_0x59d897[_0xcca2('0x109')])){return this[_0xcca2('0xd')][_0xcca2('0x26')](_0x59d897,_0xcca2('0x10a'));}else{var _0x39b6cf=parseInt(_0x59d897[_0xcca2('0x109')],0xa);if(isNaN(_0x39b6cf)){_0x3200eb=_0x59d897[_0xcca2('0x109')];}else{_0x3200eb=this['getTrunk'][_0xcca2('0x6e')](this,_0x59d897[_0xcca2('0x109')]);if(!_0x3200eb){return this[_0xcca2('0xd')][_0xcca2('0x26')](_0x59d897,_0xcca2('0x10b'));}}}}else if(_0x59d897[_0xcca2('0x10c')]){_0x3200eb=_0x59d897[_0xcca2('0x10c')];}else{return this[_0xcca2('0xd')][_0xcca2('0x26')](_0x59d897,_0xcca2('0x10a'));}var _0x431543=this[_0xcca2('0xd')]['exec'](_0xcca2('0xdf'),[util[_0xcca2('0x51')](_0xcca2('0x10d'),_0x3200eb,_0x59d897[_0xcca2('0x43')]),_0x59d897[_0xcca2('0x63')],_0x59d897[_0xcca2('0xe1')],_0x59d897['url']]);if(_0x431543[_0xcca2('0xab')]===-0x1){return _0x431543;}return this[_0xcca2('0xd')][_0xcca2('0xa8')](util[_0xcca2('0x51')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0xcca2('0x10')]['finally']=function(_0x20053f){logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0x10e'),_0x20053f['label']));return this[_0xcca2('0xd')][_0xcca2('0xa8')](_0xcca2('0x10f'));};AGIVertices[_0xcca2('0x10')][_0xcca2('0x110')]=function(_0x8d70d2){logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0x111'),_0x8d70d2[_0xcca2('0x32')]));if(_0x8d70d2[_0xcca2('0xa6')]===0x0){return this[_0xcca2('0xa7')](_0x8d70d2);}_0x8d70d2[_0xcca2('0xa6')]-=0x1;if(!this[_0xcca2('0x86')](_0x8d70d2[_0xcca2('0x112')])){return this[_0xcca2('0xd')]['error'](_0x8d70d2,_0xcca2('0x113'));}var _0x2c8166=this['getSound'][_0xcca2('0x6e')](this,_0x8d70d2[_0xcca2('0x112')]);if(!_0x2c8166){return this['channel']['error'](_0x8d70d2,_0xcca2('0x114'));}if(!this[_0xcca2('0x86')](_0x8d70d2[_0xcca2('0xd6')])){return this[_0xcca2('0xd')][_0xcca2('0x26')](_0xcca2('0xd5'));}var _0xbb57f5=this[_0xcca2('0xd')][_0xcca2('0x115')](_0x2c8166,_0x8d70d2[_0xcca2('0x116')],_0x8d70d2[_0xcca2('0x117')]);var _0x57869a=_0xbb57f5[_0xcca2('0xab')]?_0xbb57f5['result'][_0xcca2('0x48')]():'';logger[_0xcca2('0x28')](_0xcca2('0x118'),JSON[_0xcca2('0x71')](_0xbb57f5));if(_0xbb57f5[_0xcca2('0xab')]===-0x1){this['createSquareDetailsReport'][_0xcca2('0x6e')](this,_0x8d70d2,_0x57869a);return _0xbb57f5;}else if(_0xbb57f5[_0xcca2('0xa2')]===_0xcca2('0x63')){_0xbb57f5[_0xcca2('0xab')]=_0x57869a['length']>=parseInt(_0x8d70d2[_0xcca2('0x119')])?'x':'i';}else{_0xbb57f5[_0xcca2('0xab')]=_0x57869a[_0xcca2('0x99')]>=parseInt(_0x8d70d2[_0xcca2('0x119')])&&_0x57869a['length']<=parseInt(_0x8d70d2[_0xcca2('0x117')])?'x':'i';}var _0x1df503=this[_0xcca2('0xa1')][_0xcca2('0x6e')](this,_0x8d70d2[_0xcca2('0xd6')]);if(!_0x1df503){return this[_0xcca2('0xd')][_0xcca2('0x26')](_0x8d70d2,_0xcca2('0xd7'));}this[_0xcca2('0xd')][_0xcca2('0x9d')](_0x1df503,_0x57869a);if(this['isConfigured'](_0x8d70d2[_0xcca2('0x11a')])){var _0x2dac84=parseInt(_0x8d70d2[_0xcca2('0x11a')],0xa);var _0x56fb79=rs[_0xcca2('0x11b')]({'charset':'*','length':_0x2dac84});var _0x1c1ce8=_0x57869a[_0xcca2('0x99')];if(_0x1c1ce8>0x0){if(_0x1c1ce8>_0x2dac84){this[_0xcca2('0xa5')][_0xcca2('0x6e')](this,_0x8d70d2,_0x8d70d2[_0xcca2('0x11c')]===_0xcca2('0x11d')?_0x56fb79+_0x57869a[_0xcca2('0x11e')](_0x2dac84):_0x57869a[_0xcca2('0x11e')](0x0,_0x1c1ce8-_0x2dac84)+_0x56fb79);}else{this[_0xcca2('0xa5')][_0xcca2('0x6e')](this,_0x8d70d2,rs[_0xcca2('0x11b')]({'charset':'*','length':_0x1c1ce8}));}}else{this[_0xcca2('0xa5')][_0xcca2('0x6e')](this,_0x8d70d2,'');}}else{this[_0xcca2('0xa5')][_0xcca2('0x6e')](this,_0x8d70d2,_0x57869a);}return _0xbb57f5;};AGIVertices[_0xcca2('0x10')][_0xcca2('0xc')]=function(_0x27e28e){logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0x11f'),_0x27e28e[_0xcca2('0x32')]));return this['getdigits'](_0x27e28e);};AGIVertices['prototype']['goal']=function(_0x34948f){logger[_0xcca2('0x28')](util['format'](_0xcca2('0x120'),_0x34948f['label']));this[_0xcca2('0xa5')]['sync'](this,_0x34948f,_0x34948f[_0xcca2('0x121')]);return this[_0xcca2('0xd')]['noop'](util[_0xcca2('0x51')]('GOAL\x20%s',_0x34948f[_0xcca2('0x121')]));};AGIVertices['prototype']['awspolly']=function(_0x6ddf96){logger['info'](util[_0xcca2('0x51')](_0xcca2('0x122'),_0x6ddf96[_0xcca2('0x32')]));if(!this['isConfigured'](_0x6ddf96[_0xcca2('0x89')])||!this[_0xcca2('0x86')](_0x6ddf96[_0xcca2('0x8a')])){return this[_0xcca2('0xd')][_0xcca2('0xa8')](_0xcca2('0x123'));}if(!this[_0xcca2('0x86')](_0x6ddf96[_0xcca2('0x59')])){return this[_0xcca2('0xd')]['noop'](_0xcca2('0xa9'));}this[_0xcca2('0xd')][_0xcca2('0xa8')](util[_0xcca2('0x51')](_0xcca2('0x124'),_0x6ddf96[_0xcca2('0x59')]));var _0x1c6e6f=this['awsPolly']['sync'](this,_0x6ddf96);if(_0x1c6e6f){this['channel'][_0xcca2('0xa8')](util[_0xcca2('0x51')]('aws\x20Polly\x20%s\x20file\x20created',_0x1c6e6f));var _0x332b53=this['channel'][_0xcca2('0x125')](_0x1c6e6f);try{fs[_0xcca2('0x101')](_0x1c6e6f+_0xcca2('0x102'));}catch(_0x39c41a){logger['error'](_0x39c41a);}return _0x332b53;}return this['channel'][_0xcca2('0x26')](_0x6ddf96,_0xcca2('0x126'));};AGIVertices[_0xcca2('0x10')][_0xcca2('0x127')]=function(_0x47e6fc){logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0x128'),_0x47e6fc[_0xcca2('0x32')]));if(!this[_0xcca2('0x86')](_0x47e6fc[_0xcca2('0x89')])||!this[_0xcca2('0x86')](_0x47e6fc['aws_secret_access_key'])){return this[_0xcca2('0xd')][_0xcca2('0xa8')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xcca2('0x86')](_0x47e6fc[_0xcca2('0x129')])){return this[_0xcca2('0xd')][_0xcca2('0xa8')](_0xcca2('0x12a'));}if(!this[_0xcca2('0x86')](_0x47e6fc['text'])){return this['channel'][_0xcca2('0xa8')](_0xcca2('0xa9'));}this['channel']['bot']=!![];this[_0xcca2('0xa5')](_0x47e6fc);this[_0xcca2('0x3d')](_0x47e6fc[_0xcca2('0x59')],'in','','');this[_0xcca2('0xd')][_0xcca2('0xa8')](util[_0xcca2('0x51')](_0xcca2('0x12b'),_0x47e6fc[_0xcca2('0x59')]));var _0x37b40c=this[_0xcca2('0x8e')]['sync'](this,_0x47e6fc);if(_0x37b40c){for(var _0x1a636c in _0x37b40c){if(_0x37b40c[_0xcca2('0x97')](_0x1a636c)&&_[_0xcca2('0x95')](_0x37b40c[_0x1a636c])){this[_0xcca2('0xd')]['setVariable'](util['format'](_0xcca2('0x12c'),_0x1a636c[_0xcca2('0x69')]()),_0x37b40c[_0x1a636c]);}}if(_[_0xcca2('0x40')](_0x37b40c[_0xcca2('0x76')])){return this[_0xcca2('0xd')][_0xcca2('0xa8')](_0xcca2('0x12d'));}else{this[_0xcca2('0x3d')](_0x37b40c['message'],_0xcca2('0xe8'),_0xcca2('0x12e'),'');return this[_0xcca2('0xd')][_0xcca2('0xa8')](util[_0xcca2('0x51')](_0xcca2('0x12f'),_0x37b40c[_0xcca2('0x76')]));}}return this[_0xcca2('0xd')]['error'](_0x47e6fc,_0xcca2('0x130'));};AGIVertices[_0xcca2('0x10')][_0xcca2('0x131')]=function(_0x32d814){logger['info'](util[_0xcca2('0x51')](_0xcca2('0x132'),_0x32d814[_0xcca2('0x32')],_0x32d814[_0xcca2('0x63')]));if(!this['isConfigured'](_0x32d814[_0xcca2('0x7a')])){return this['channel'][_0xcca2('0xa8')](_0xcca2('0xe4'));}var _0xdfc003=_0xcca2('0x133');var _0xe98fc4=util[_0xcca2('0x51')](_0xcca2('0x134'),FILES_PATH,rs['generate'](0x4));var _0x476183=util[_0xcca2('0x51')](_0xcca2('0x9c'),_0xe98fc4,_0xdfc003);var _0x34d861=!![];if(_0x32d814['beep']===_0xcca2('0x135')){_0x34d861=![];}var _0x289a10=this[_0xcca2('0xd')][_0xcca2('0x136')](_0xe98fc4,_0xdfc003,_0x32d814[_0xcca2('0x137')],_0x32d814[_0xcca2('0x63')],undefined,_0x34d861);if(_0x289a10[_0xcca2('0xab')]!==-0x1){this[_0xcca2('0xd')]['noop'](util[_0xcca2('0x51')](_0xcca2('0x138'),_0x476183));var _0x31987d=this[_0xcca2('0x90')][_0xcca2('0x6e')](this,_0x32d814,_0x476183);if(_0x31987d){for(var _0xb6cb28 in _0x31987d){if(_0x31987d['hasOwnProperty'](_0xb6cb28)){this[_0xcca2('0xd')]['setVariable'](util['format'](_0xcca2('0x139'),_0xb6cb28['toUpperCase']()),_0x31987d[_0xb6cb28]);}}return this[_0xcca2('0xd')][_0xcca2('0xa8')](util['format'](_0xcca2('0x13a'),JSON[_0xcca2('0x71')](_0x31987d)));}}return _0x289a10;};AGIVertices['prototype'][_0xcca2('0x13b')]=function(_0x32eb22){logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0x13c'),_0x32eb22[_0xcca2('0x32')]));if(!this[_0xcca2('0x86')](_0x32eb22['appid'])){return this[_0xcca2('0xd')][_0xcca2('0xa8')](_0xcca2('0x13d'));}if(!this[_0xcca2('0x86')](_0x32eb22[_0xcca2('0x93')])){return this['channel'][_0xcca2('0xa8')](_0xcca2('0x13e'));}var _0x17103e=_0xcca2('0x133');var _0x7faf13=util[_0xcca2('0x51')](_0xcca2('0x134'),FILES_PATH,rs[_0xcca2('0x11b')](0x4));var _0x4e249f=util[_0xcca2('0x51')]('%s.%s',_0x7faf13,_0x17103e);var _0x38ce1b=!![];if(_0x32eb22['beep']===_0xcca2('0x135')){_0x38ce1b=![];}var _0x410a0b=this[_0xcca2('0xd')][_0xcca2('0x136')](_0x7faf13,_0x17103e,_0x32eb22[_0xcca2('0x137')],_0x32eb22['timeout'],undefined,_0x38ce1b);if(_0x410a0b[_0xcca2('0xab')]!==-0x1){this[_0xcca2('0xd')][_0xcca2('0xa8')](util[_0xcca2('0x51')](_0xcca2('0x13f'),_0x4e249f));var _0x5eef64=this[_0xcca2('0x91')]['sync'](this,_0x32eb22,_0x4e249f);if(_0x5eef64){for(var _0x3fcf7e in _0x5eef64){if(_0x5eef64[_0xcca2('0x97')](_0x3fcf7e)){this[_0xcca2('0xd')]['setVariable'](util[_0xcca2('0x51')]('TILDE_ASR_%s',_0x3fcf7e[_0xcca2('0x69')]()),_0x5eef64[_0x3fcf7e]);}}return this['channel'][_0xcca2('0xa8')](util['format']('TildeASR\x20Result\x20%s',JSON[_0xcca2('0x71')](_0x5eef64)));}}return _0x410a0b;};AGIVertices['prototype'][_0xcca2('0x140')]=function(_0x3b6b7b){logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0x141'),_0x3b6b7b['label']));return this['channel'][_0xcca2('0x142')](_0x3b6b7b[_0xcca2('0x38')],_0x3b6b7b[_0xcca2('0x143')],_0x3b6b7b[_0xcca2('0x39')]);};AGIVertices[_0xcca2('0x10')][_0xcca2('0x144')]=function(_0x453892){logger['info'](util[_0xcca2('0x51')](_0xcca2('0x145'),_0x453892[_0xcca2('0x32')]));if(!this[_0xcca2('0x86')](_0x453892[_0xcca2('0x146')])){return this['channel']['error'](_0x453892,_0xcca2('0x147'));}try{var _0x3eb32c=eval(_0x453892[_0xcca2('0x146')])?'true':'false';this[_0xcca2('0xd')][_0xcca2('0xa8')](util[_0xcca2('0x51')](_0xcca2('0x148'),_0x453892[_0xcca2('0x146')],_0x3eb32c));return{'code':0xc8,'result':_0x3eb32c};}catch(_0x5efbba){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xcca2('0x10')][_0xcca2('0x149')]=function(_0x30b384){logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0x14a'),_0x30b384[_0xcca2('0x32')]));if(!this[_0xcca2('0x86')](_0x30b384['interval_id'])){return this['channel'][_0xcca2('0x26')](_0x30b384,_0xcca2('0x14b'));}var _0x49ef7e=this[_0xcca2('0x14c')]['sync'](this,_0x30b384[_0xcca2('0x14d')]);if(!_0x49ef7e){return this['channel'][_0xcca2('0x26')](_0x30b384,_0xcca2('0x14e'));}for(var _0x25fde4=0x0;_0x25fde4<_0x49ef7e[_0xcca2('0x99')];_0x25fde4+=0x1){var _0xed51a4=this['channel'][_0xcca2('0xa1')](util['format'](_0xcca2('0x14f'),_0x49ef7e[_0x25fde4]));if(_0xed51a4['result']===-0x1){return _0xed51a4;}logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0x150'),_0x49ef7e[_0x25fde4],_0xed51a4[_0xcca2('0xa2')]));if(_0xed51a4[_0xcca2('0xa2')]===_0xcca2('0x151')){logger['info'](util['format'](_0xcca2('0x150'),_0x49ef7e[_0x25fde4],_0xcca2('0x151')));this[_0xcca2('0xd')][_0xcca2('0xa8')](util[_0xcca2('0x51')](_0xcca2('0x150'),_0x49ef7e[_0x25fde4],_0xcca2('0x151')));return{'code':0xc8,'result':'true'};}else{logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0x150'),_0x49ef7e[_0x25fde4],_0xcca2('0x152')));this[_0xcca2('0xd')][_0xcca2('0xa8')](util[_0xcca2('0x51')](_0xcca2('0x150'),_0x49ef7e[_0x25fde4],_0xcca2('0x152')));}}return{'code':0xc8,'result':_0xcca2('0x152')};};AGIVertices['prototype'][_0xcca2('0x153')]=function(_0x33c974){logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0x154'),_0x33c974['label']));return this['channel'][_0xcca2('0x153')]();};AGIVertices[_0xcca2('0x10')][_0xcca2('0x155')]=function(_0x86d373){logger[_0xcca2('0x28')](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x86d373[_0xcca2('0x32')]));if(!this['isConfigured'](_0x86d373['key'])){return this[_0xcca2('0xd')][_0xcca2('0xa8')]('no\x20key\x20configured');}var _0x284f43='wav';var _0x3454a1=util['format'](_0xcca2('0x134'),FILES_PATH,rs[_0xcca2('0x11b')](0x4));var _0x5193f8=util['format'](_0xcca2('0x9c'),_0x3454a1,_0x284f43);var _0x3bd53f=!![];if(_0x86d373['beep']===_0xcca2('0x135')){_0x3bd53f=![];}var _0x3a1894=this[_0xcca2('0xd')][_0xcca2('0x136')](_0x3454a1,_0x284f43,_0x86d373['intKey'],_0x86d373[_0xcca2('0x63')],undefined,_0x3bd53f);if(_0x3a1894['result']!==-0x1){this[_0xcca2('0xd')][_0xcca2('0xa8')](util[_0xcca2('0x51')](_0xcca2('0x156'),_0x5193f8));var _0x2392e0=this['ispeechASR'][_0xcca2('0x6e')](this,_0x86d373,_0x5193f8);if(_0x2392e0){for(var _0x2228ab in _0x2392e0){if(_0x2392e0[_0xcca2('0x97')](_0x2228ab)){this[_0xcca2('0xd')][_0xcca2('0x9d')](util[_0xcca2('0x51')](_0xcca2('0x157'),_0x2228ab[_0xcca2('0x69')]()),_0x2392e0[_0x2228ab]);}}return this[_0xcca2('0xd')][_0xcca2('0xa8')](util[_0xcca2('0x51')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x2392e0)));}}return _0x3a1894;};AGIVertices[_0xcca2('0x10')][_0xcca2('0x158')]=function(_0x34c6ef){logger['info'](util['format'](_0xcca2('0x159'),_0x34c6ef[_0xcca2('0x32')]));if(!this[_0xcca2('0x86')](_0x34c6ef['key'])){return this[_0xcca2('0xd')][_0xcca2('0xa8')]('no\x20key\x20configured');}if(!this[_0xcca2('0x86')](_0x34c6ef[_0xcca2('0x59')])){return this['channel'][_0xcca2('0xa8')](_0xcca2('0xa9'));}this[_0xcca2('0xd')][_0xcca2('0xa8')](util[_0xcca2('0x51')]('Trying\x20ispeech\x20TTS\x20%s',_0x34c6ef[_0xcca2('0x59')]));var _0x4847af=this[_0xcca2('0x81')][_0xcca2('0x6e')](this,_0x34c6ef);if(_0x4847af){this[_0xcca2('0xd')][_0xcca2('0xa8')](util[_0xcca2('0x51')](_0xcca2('0x156'),_0x4847af));var _0x9e97dc=this['channel'][_0xcca2('0x125')](_0x4847af,_0x34c6ef['intKey']);try{fs[_0xcca2('0x101')](_0x4847af+_0xcca2('0x102'));}catch(_0x441b3d){logger[_0xcca2('0x26')](_0x441b3d);}return _0x9e97dc;}return this[_0xcca2('0xd')][_0xcca2('0x26')](_0x34c6ef,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0xcca2('0x15a')]=function(_0x409bea){logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0x15b'),_0x409bea[_0xcca2('0x32')]));if(!this[_0xcca2('0x86')](_0x409bea['findBy'])){return this[_0xcca2('0xd')][_0xcca2('0x26')](_0x409bea,'no\x20find\x20by\x20configured');}logger['info'](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xcca2('0xd')][_0xcca2('0x35')],_0x409bea[_0xcca2('0x15c')]));var _0x193768=this[_0xcca2('0x4f')]['sync'](this,_0x409bea[_0xcca2('0x15c')]);if(_0x193768){logger[_0xcca2('0x28')](util['format'](_0xcca2('0x15d'),this['channel'][_0xcca2('0x35')],_0x409bea[_0xcca2('0x15c')]));this[_0xcca2('0xd')][_0xcca2('0xa8')](util[_0xcca2('0x51')](_0xcca2('0x15d'),this['channel'][_0xcca2('0x35')],_0x409bea[_0xcca2('0x15c')]));return{'code':0xc8,'result':_0xcca2('0x15e')};}else{logger[_0xcca2('0x28')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x409bea[_0xcca2('0x15c')]));this[_0xcca2('0xd')]['noop'](util[_0xcca2('0x51')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xcca2('0xd')][_0xcca2('0x35')],_0x409bea[_0xcca2('0x15c')]));return{'code':0xc8,'result':_0xcca2('0x15f')};}};AGIVertices[_0xcca2('0x10')][_0xcca2('0x160')]=function(_0x4140b4){logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0x161'),_0x4140b4[_0xcca2('0x32')]));if(!this['isConfigured'](_0x4140b4[_0xcca2('0x15c')])){return this['channel'][_0xcca2('0x26')](_0x4140b4,_0xcca2('0x162'));}logger['info'](util[_0xcca2('0x51')](_0xcca2('0x163'),this['channel'][_0xcca2('0x35')],_0x4140b4['findBy']));var _0x194e0d=this['agentLogout']['sync'](this,_0x4140b4[_0xcca2('0x15c')]);if(_0x194e0d){logger['info'](util['format'](_0xcca2('0x15d'),this[_0xcca2('0xd')]['callerid'],_0x4140b4[_0xcca2('0x15c')]));this[_0xcca2('0xd')][_0xcca2('0xa8')](util[_0xcca2('0x51')](_0xcca2('0x15d'),this['channel']['callerid'],_0x4140b4[_0xcca2('0x15c')]));return{'code':0xc8,'result':'success'};}else{logger[_0xcca2('0x28')](util['format'](_0xcca2('0x164'),this['channel'][_0xcca2('0x35')],_0x4140b4[_0xcca2('0x15c')]));this[_0xcca2('0xd')][_0xcca2('0xa8')](util[_0xcca2('0x51')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xcca2('0x35')],_0x4140b4[_0xcca2('0x15c')]));return{'code':0xc8,'result':_0xcca2('0x15f')};}};AGIVertices[_0xcca2('0x10')][_0xcca2('0x165')]=function(_0x36a4d3){logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0x166'),_0x36a4d3['label']));if(!this[_0xcca2('0x86')](_0x36a4d3[_0xcca2('0x167')])){return this[_0xcca2('0xd')][_0xcca2('0x26')](_0x36a4d3,_0xcca2('0x168'));}this[_0xcca2('0xd')][_0xcca2('0xa8')](util[_0xcca2('0x51')](_0xcca2('0x169'),_0x36a4d3[_0xcca2('0x167')]));var _0x164155=eval(_0x36a4d3[_0xcca2('0x167')]);if(!this[_0xcca2('0x86')](_0x36a4d3[_0xcca2('0xd6')])){return this[_0xcca2('0xd')][_0xcca2('0xa8')](_0xcca2('0xd5'));}var _0x33a6b0=this['getVariable'][_0xcca2('0x6e')](this,_0x36a4d3[_0xcca2('0xd6')]);if(!_0x33a6b0){return this[_0xcca2('0xd')][_0xcca2('0x26')](_0x36a4d3,'no\x20variable\x20found');}if(_[_0xcca2('0x98')](_0x164155)){var _0x34b494=this;_0x164155[_0xcca2('0xd9')](function(_0x195d14,_0x1c0f72){_0x34b494[_0xcca2('0xd')][_0xcca2('0x9d')](util[_0xcca2('0x51')](_0xcca2('0x16a'),_0x33a6b0,_0x1c0f72),_0x195d14);});return this[_0xcca2('0xd')]['noop'](util['format'](_0xcca2('0x16b'),_0x33a6b0));}else{return this[_0xcca2('0xd')]['setVariable'](_0x33a6b0,_0x164155);}};AGIVertices[_0xcca2('0x10')][_0xcca2('0xb')]=function(_0x56f55b){logger['info'](util[_0xcca2('0x51')](_0xcca2('0x16c'),_0x56f55b[_0xcca2('0x32')]));if(_0x56f55b['retry']===0x0){return this['maxRetry'](_0x56f55b);}_0x56f55b[_0xcca2('0xa6')]-=0x1;if(!this[_0xcca2('0x86')](_0x56f55b['file_id'])){return this[_0xcca2('0xd')][_0xcca2('0x26')](_0x56f55b,_0xcca2('0x113'));}var _0x1c6520=this[_0xcca2('0x1d')][_0xcca2('0x6e')](this,_0x56f55b[_0xcca2('0x112')]);if(!_0x1c6520){return this[_0xcca2('0xd')][_0xcca2('0x26')](_0x56f55b,'no\x20file\x20audio\x20found');}var _0x2b52df=this[_0xcca2('0xd')][_0xcca2('0x115')](_0x1c6520,_0x56f55b[_0xcca2('0x116')],_0x56f55b[_0xcca2('0x16d')]);var _0x3969d2=_0x2b52df[_0xcca2('0xab')];if(_0x2b52df[_0xcca2('0xab')]===-0x1){this['createSquareDetailsReport'][_0xcca2('0x6e')](this,_0x56f55b,'-1');return _0x2b52df;}else if(_0x2b52df[_0xcca2('0xa2')]==='timeout'){_0x2b52df[_0xcca2('0xab')]=_0x2b52df['result'][_0xcca2('0x99')]>0x0?_0x2b52df[_0xcca2('0xab')]:'t';}else if(_['isEmpty'](_0x2b52df[_0xcca2('0xab')])){_0x2b52df[_0xcca2('0xab')]='#';_0x3969d2='#';}if(!this[_0xcca2('0x86')](_0x56f55b['variable_id'])){this[_0xcca2('0xd')]['noop'](_0xcca2('0xd5'));}else{var _0xeab37=this[_0xcca2('0xa1')][_0xcca2('0x6e')](this,_0x56f55b[_0xcca2('0xd6')]);if(!_0xeab37){return this[_0xcca2('0xd')][_0xcca2('0x26')](_0x56f55b,_0xcca2('0xd7'));}this[_0xcca2('0xd')][_0xcca2('0x9d')](_0xeab37,_0x3969d2);}this[_0xcca2('0xa5')]['sync'](this,_0x56f55b,_0x3969d2);return _0x2b52df;};AGIVertices[_0xcca2('0x10')][_0xcca2('0xa8')]=function(_0x2b0390){logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0x16e'),_0x2b0390[_0xcca2('0x32')]));return this[_0xcca2('0xd')][_0xcca2('0xa8')](_0x2b0390['output']||_0x2b0390[_0xcca2('0x32')]);};AGIVertices[_0xcca2('0x10')][_0xcca2('0x16f')]=function(_0x3a1e6d){logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0x170'),_0x3a1e6d[_0xcca2('0x32')]));if(!this['isConfigured'](_0x3a1e6d[_0xcca2('0x15c')])){return this[_0xcca2('0xd')][_0xcca2('0x26')](_0x3a1e6d,'no\x20find\x20by\x20configured');}logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0x163'),this[_0xcca2('0xd')]['callerid'],_0x3a1e6d[_0xcca2('0x15c')]));var _0x437ae6=this['getPause'][_0xcca2('0x6e')](this,_0x3a1e6d[_0xcca2('0x171')]);var _0xd13d4d=this[_0xcca2('0x4b')]['sync'](this,_0x3a1e6d[_0xcca2('0x15c')],_0x437ae6);if(_0xd13d4d){logger['info'](util['format'](_0xcca2('0x15d'),this[_0xcca2('0xd')][_0xcca2('0x35')],_0x3a1e6d[_0xcca2('0x15c')]));this[_0xcca2('0xd')][_0xcca2('0xa8')](util['format'](_0xcca2('0x15d'),this[_0xcca2('0xd')][_0xcca2('0x35')],_0x3a1e6d['findBy']));return{'code':0xc8,'result':_0xcca2('0x15e')};}else{logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0x164'),this[_0xcca2('0xd')]['callerid'],_0x3a1e6d[_0xcca2('0x15c')]));this[_0xcca2('0xd')][_0xcca2('0xa8')](util['format'](_0xcca2('0x15d'),this[_0xcca2('0xd')]['callerid'],_0x3a1e6d[_0xcca2('0x15c')]));return{'code':0xc8,'result':_0xcca2('0x15f')};}};AGIVertices[_0xcca2('0x10')][_0xcca2('0x172')]=function(_0xc89b74){logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0x173'),_0xc89b74['label']));if(!this['isConfigured'](_0xc89b74['file_id'])){return this[_0xcca2('0xd')]['error'](_0xc89b74,_0xcca2('0x113'));}var _0x1e3503=this[_0xcca2('0x1d')][_0xcca2('0x6e')](this,_0xc89b74[_0xcca2('0x112')]);if(!_0x1e3503){return this[_0xcca2('0xd')][_0xcca2('0x26')](_0xc89b74,_0xcca2('0x114'));}var _0x13ab6e=this[_0xcca2('0xd')][_0xcca2('0x54')](_0xcca2('0x174'),[_0x1e3503,_0xc89b74[_0xcca2('0xe1')]]);if(_0x13ab6e[_0xcca2('0xab')]===-0x1){return _0x13ab6e;}return this[_0xcca2('0xd')]['noop'](util[_0xcca2('0x51')](_0xcca2('0xc2'),_0xcca2('0x174'),_0x1e3503));};AGIVertices[_0xcca2('0x10')]['queue']=function(_0x1014fd){logger[_0xcca2('0x28')](util[_0xcca2('0x51')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x1014fd[_0xcca2('0x32')]));if(!this[_0xcca2('0x86')](_0x1014fd[_0xcca2('0x175')])){return this[_0xcca2('0xd')][_0xcca2('0x26')](_0x1014fd,_0xcca2('0x176'));}var _0x3f47b5='';var _0x10928e=parseInt(_0x1014fd[_0xcca2('0x175')],0xa);if(isNaN(_0x10928e)){_0x3f47b5=_0x1014fd[_0xcca2('0x175')];}else{_0x3f47b5=this[_0xcca2('0x14')]['sync'](this,_0x1014fd[_0xcca2('0x175')]);if(!_0x3f47b5){return this[_0xcca2('0xd')]['error'](_0x1014fd,'no\x20queue\x20found');}}var _0x58de0b='';if(this['isConfigured'](_0x1014fd[_0xcca2('0x112')])){var _0x3056b2=this[_0xcca2('0x1d')][_0xcca2('0x6e')](this,_0x1014fd['file_id']);if(_0x3056b2){_0x58de0b=_0x3056b2;}}this['createSquareDetailsReport'][_0xcca2('0x6e')](this,_0x1014fd,_0x3f47b5);if(_0x1014fd[_0xcca2('0xe1')][_0xcca2('0x177')]('x')<0x0){_0x1014fd[_0xcca2('0xe1')]+='x';}if(_0x1014fd[_0xcca2('0xe1')]['indexOf']('X')<0x0){_0x1014fd['opts']+='X';}this['channel'][_0xcca2('0x9d')](_0xcca2('0x178'),_0x3f47b5?_0x3f47b5[_0xcca2('0x179')]():'');var _0x5d1d28=this[_0xcca2('0xd')][_0xcca2('0x54')](_0xcca2('0x17a'),[_0x3f47b5,_0x1014fd[_0xcca2('0xe1')],_0x1014fd[_0xcca2('0x62')],_0x58de0b,_0x1014fd[_0xcca2('0x63')],_0x1014fd[_0xcca2('0x8')],_0x1014fd[_0xcca2('0x17b')],_0x1014fd[_0xcca2('0x17c')],'',_0x1014fd[_0xcca2('0x17d')]]);if(_0x5d1d28[_0xcca2('0xab')]===-0x1){return _0x5d1d28;}return this[_0xcca2('0xd')][_0xcca2('0xa8')](util[_0xcca2('0x51')](_0xcca2('0xc2'),_0xcca2('0x17a'),_0x3f47b5));};AGIVertices[_0xcca2('0x10')][_0xcca2('0x17e')]=function(_0xf43a17){logger['info'](util[_0xcca2('0x51')](_0xcca2('0x17f'),_0xf43a17[_0xcca2('0x32')]));var _0x362fde=_0xf43a17['recordingFormat']||_0xcca2('0x133');var _0x2d6ac0=util[_0xcca2('0x51')](_0xcca2('0x180'),this[_0xcca2('0xd')][_0xcca2('0x31')],rs['generate'](0x5));var _0x2e8d81=util['format']('%s/recordings/%s.%s',FILES_PATH,_0x2d6ac0,_0x362fde);var _0x4a7f91=util[_0xcca2('0x51')](_0xcca2('0x134'),FILES_PATH,_0x2d6ac0);this[_0xcca2('0x36')][_0xcca2('0x6e')](this,_0xf43a17,_0x2d6ac0,_0x2e8d81);this[_0xcca2('0xd')]['setVariable'](_0xcca2('0x181'),_0x2d6ac0);logger[_0xcca2('0x28')](_0xcca2('0x182'),_0x4a7f91,_0x362fde,_0xf43a17[_0xcca2('0x183')],_0xf43a17[_0xcca2('0x63')]);return this[_0xcca2('0xd')][_0xcca2('0x136')](_0x4a7f91,_0x362fde,_0xf43a17[_0xcca2('0x183')],_0xf43a17['timeout'],undefined,!![]);};AGIVertices[_0xcca2('0x10')][_0xcca2('0x184')]=function(_0x27b62d){logger['info'](util[_0xcca2('0x51')](_0xcca2('0x185'),_0x27b62d['label']));if(!this[_0xcca2('0x86')](_0x27b62d[_0xcca2('0x62')])){return this['channel']['noop'](_0xcca2('0x186'));}var _0x3efeef=this[_0xcca2('0x187')][_0xcca2('0x6e')](this,_0x27b62d);logger['info'](util[_0xcca2('0x51')]('Response:',util['inspect'](_0x3efeef,{'showHidden':![],'depth':null})));if(!this[_0xcca2('0x86')](_0x27b62d[_0xcca2('0xd6')])){return this[_0xcca2('0xd')]['noop'](_0xcca2('0x188'));}var _0xfcda56=this[_0xcca2('0xa1')]['sync'](this,_0x27b62d[_0xcca2('0xd6')]);if(!_0xfcda56){return this[_0xcca2('0xd')][_0xcca2('0x26')](_0x27b62d,_0xcca2('0xd7'));}this[_0xcca2('0xd')][_0xcca2('0x9d')](util[_0xcca2('0x51')](_0xcca2('0x189'),_0xfcda56),_0x3efeef[_0xcca2('0x75')]?_0x3efeef['statusCode']:_0xcca2('0x18a'));this[_0xcca2('0xd')]['setVariable'](util[_0xcca2('0x51')](_0xcca2('0x18b'),_0xfcda56),_0x3efeef['statusMessage']?_0x3efeef[_0xcca2('0x74')]:'OK');if(_0x3efeef[_0xcca2('0x72')]){try{this[_0xcca2('0x9a')](_0x3efeef[_0xcca2('0x72')],_0xfcda56);}catch(_0x1c568b){logger[_0xcca2('0x26')](util[_0xcca2('0x51')](_0xcca2('0x18c'),_0xfcda56));}}return this[_0xcca2('0xd')]['noop'](util[_0xcca2('0x51')](_0xcca2('0xdb'),_0xfcda56));};AGIVertices['prototype'][_0xcca2('0x18d')]=function(_0x181a32){logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0x18e'),_0x181a32[_0xcca2('0x32')]));return this['channel'][_0xcca2('0x18f')](_0x181a32[_0xcca2('0x190')][_0xcca2('0xd3')](/\s+/g,''),_0x181a32[_0xcca2('0x183')]);};AGIVertices[_0xcca2('0x10')][_0xcca2('0x191')]=function(_0x25bd20){logger['info'](util['format'](_0xcca2('0x192'),_0x25bd20[_0xcca2('0x32')]));return this[_0xcca2('0xd')]['sayNumber'](_0x25bd20[_0xcca2('0x64')]['replace'](/\s+/g,''),_0x25bd20[_0xcca2('0x183')]);};AGIVertices[_0xcca2('0x10')][_0xcca2('0x193')]=function(_0x25bb40){logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0x194'),_0x25bb40[_0xcca2('0x32')]));return this[_0xcca2('0xd')][_0xcca2('0x195')](_0x25bb40[_0xcca2('0x59')],_0x25bb40[_0xcca2('0x183')]);};AGIVertices[_0xcca2('0x10')][_0xcca2('0x196')]=function(_0x5415b8){logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0x197'),_0x5415b8[_0xcca2('0x32')]));if(!this[_0xcca2('0x86')](_0x5415b8['account_id'])){return this[_0xcca2('0xd')][_0xcca2('0xa8')](_0xcca2('0x198'));}var _0x221530=this[_0xcca2('0x199')][_0xcca2('0x6e')](this,_0x5415b8['account_id']);if(!_0x221530||!_0x221530['Smtp']){return this[_0xcca2('0xd')][_0xcca2('0x26')](_0x5415b8,_0xcca2('0x19a'));}var _0x2b8474={'from':util[_0xcca2('0x51')](_0xcca2('0x19b'),_0x221530[_0xcca2('0x13')],_0x221530['email']||_0x221530[_0xcca2('0x19c')][_0xcca2('0x19d')]),'to':_0x5415b8['to']||'','cc':_0x5415b8['cc']||'','bcc':_0x5415b8[_0xcca2('0x19e')]||'','subject':_0x5415b8[_0xcca2('0x19f')],'html':_0x5415b8[_0xcca2('0x59')],'text':_0x5415b8[_0xcca2('0x59')]};var _0x3c2450={'tls':{'rejectUnauthorized':![]}};if(_0x221530[_0xcca2('0x19c')][_0xcca2('0x1a0')]){_0x3c2450[_0xcca2('0x1a0')]=_0x221530['Smtp']['service'];}else{_0x3c2450['host']=_0x221530[_0xcca2('0x19c')][_0xcca2('0x1a1')];_0x3c2450['port']=_0x221530[_0xcca2('0x19c')][_0xcca2('0x1a2')];_0x3c2450[_0xcca2('0x1a3')]=_0x221530[_0xcca2('0x19c')][_0xcca2('0x1a3')];}if(_0x221530['Smtp']['authentication']){_0x3c2450[_0xcca2('0x1a4')]={'user':_0x221530[_0xcca2('0x19c')][_0xcca2('0x19d')],'pass':_0x221530[_0xcca2('0x19c')]['pass']};}if(this['isConfigured'](_0x5415b8[_0xcca2('0x1a5')])){}logger[_0xcca2('0xdc')]('sendMail\x20message',JSON[_0xcca2('0x71')](_0x2b8474));this[_0xcca2('0xa5')]['sync'](this,_0x5415b8,_0x5415b8[_0xcca2('0x1a6')]);this[_0xcca2('0xd')][_0xcca2('0xa8')](util[_0xcca2('0x51')](_0xcca2('0x1a7'),_0x221530[_0xcca2('0x13')]));this[_0xcca2('0x1f')][_0xcca2('0x6e')](this,_0x3c2450,_0x2b8474);return this[_0xcca2('0xd')]['noop'](_0xcca2('0x1a8'));};AGIVertices[_0xcca2('0x10')][_0xcca2('0x1a9')]=function(_0x4937f6){logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0x1aa'),_0x4937f6['label']));return this[_0xcca2('0xd')]['noop'](_0xcca2('0x1ab'));};AGIVertices['prototype'][_0xcca2('0x1ac')]=function(_0x410ad3){logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0x1ad'),_0x410ad3['label']));if(!this[_0xcca2('0x86')](_0x410ad3['sms_account_id'])){return this[_0xcca2('0xd')][_0xcca2('0xa8')](_0xcca2('0x1ae'));}var _0x691896=this[_0xcca2('0x2e')][_0xcca2('0x6e')](this,_0x410ad3[_0xcca2('0x1af')]);if(!_0x691896){return this['channel'][_0xcca2('0x26')](_0x410ad3,_0xcca2('0x1b0'));}var _0x2c3915={'body':_0x410ad3[_0xcca2('0x1b1')],'phone':_0x410ad3['to']||'','SmsAccountId':_0x691896['id']};logger[_0xcca2('0xdc')](_0xcca2('0x1b2'),JSON[_0xcca2('0x71')](_0x2c3915));this[_0xcca2('0xa5')][_0xcca2('0x6e')](this,_0x410ad3,_0x410ad3[_0xcca2('0x1af')]);this[_0xcca2('0xd')]['noop'](util[_0xcca2('0x51')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x691896[_0xcca2('0x13')]));this[_0xcca2('0x30')][_0xcca2('0x6e')](this,_0x2c3915);return this[_0xcca2('0xd')][_0xcca2('0xa8')](_0xcca2('0x1b3'));};AGIVertices['prototype'][_0xcca2('0x1b4')]=function(_0x2ee2b1){logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0x1b5'),_0x2ee2b1[_0xcca2('0x32')]));if(!this[_0xcca2('0x86')](_0x2ee2b1[_0xcca2('0xd6')])){return this[_0xcca2('0xd')]['error'](_0x2ee2b1,_0xcca2('0x1b6'));}var _0xac9bd5=this['getVariable'][_0xcca2('0x6e')](this,_0x2ee2b1[_0xcca2('0xd6')]);if(!_0xac9bd5){return this['channel'][_0xcca2('0x26')](_0x2ee2b1,_0xcca2('0xd7'));}return this['channel']['setVariable'](_0xac9bd5,_0x2ee2b1['variable_value']);};AGIVertices[_0xcca2('0x10')][_0xcca2('0x1b7')]=function(_0x241a71){logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0x1b8'),_0x241a71[_0xcca2('0x32')]));this[_0xcca2('0xd')][_0xcca2('0xa8')](_0xcca2('0x1b9'));if(_0x241a71[_0xcca2('0xb8')]==='yes'){this[_0xcca2('0xd')][_0xcca2('0xa8')](_0xcca2('0x1ba'));return this[_0xcca2('0xd')][_0xcca2('0xb8')]();}return this[_0xcca2('0xd')]['noop'](_0xcca2('0x1bb'));};AGIVertices[_0xcca2('0x10')][_0xcca2('0x1bc')]=function(_0x18837e){logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0x1bd'),_0x18837e['label']));if(!this[_0xcca2('0x86')](_0x18837e['project_id'])){return this[_0xcca2('0xd')][_0xcca2('0x26')](_0x18837e,'no\x20subproject\x20selected');}var _0x5ad596=this['getSquareProject'][_0xcca2('0x6e')](this,_0x18837e['project_id']);if(!this[_0xcca2('0x86')](_0x5ad596)){return this[_0xcca2('0xd')][_0xcca2('0x26')](_0x18837e,util[_0xcca2('0x51')](_0xcca2('0x1be'),_0x18837e[_0xcca2('0x1bf')]));}if(_0x5ad596===this[_0xcca2('0xd')]['arg_1']){return this['channel'][_0xcca2('0x26')](_0x18837e,_0xcca2('0x1c0'));}this[_0xcca2('0xa5')]['sync'](this,_0x18837e,_0x5ad596);var _0x54f009=this[_0xcca2('0xd')][_0xcca2('0x54')](_0xcca2('0x1c1'),util['format'](_0xcca2('0x1c2'),config[_0xcca2('0x8')][_0xcca2('0x1a1')]||_0xcca2('0x1c3'),_0x5ad596,this[_0xcca2('0xd')][_0xcca2('0x34')]));if(_0x54f009[_0xcca2('0xab')]===-0x1){return _0x54f009;}return this['channel']['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0xcca2('0x1c1'),_0x5ad596));};AGIVertices[_0xcca2('0x10')][_0xcca2('0x1c4')]=function(_0x31bc7c){logger['info'](util['format'](_0xcca2('0x1c5'),_0x31bc7c['label']));var _0x36cce5=this[_0xcca2('0x53')][_0xcca2('0x6e')](this,_0x31bc7c[_0xcca2('0xb7')]);this[_0xcca2('0xa5')][_0xcca2('0x6e')](this,_0x31bc7c,_0x31bc7c[_0xcca2('0xb7')]);if(this[_0xcca2('0x86')](_0x31bc7c[_0xcca2('0xd6')])){var _0x2443bc=this[_0xcca2('0xa1')][_0xcca2('0x6e')](this,_0x31bc7c[_0xcca2('0xd6')]);if(_0x2443bc){this[_0xcca2('0xd')][_0xcca2('0x9d')](_0x2443bc,_0x36cce5);return this[_0xcca2('0xd')]['noop'](util[_0xcca2('0x51')](_0xcca2('0x1c6'),_0x31bc7c[_0xcca2('0xb7')],_0x2443bc));}}return this['channel'][_0xcca2('0xa8')](util['format']('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x31bc7c[_0xcca2('0xb7')]));};AGIVertices[_0xcca2('0x10')][_0xcca2('0x1c7')]=function(_0x28590d){logger[_0xcca2('0x28')](util['format'](_0xcca2('0x1c8'),_0x28590d[_0xcca2('0x32')]));_0x28590d[_0xcca2('0x59')]=_0x28590d[_0xcca2('0x59')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xcca2('0x86')](_0x28590d[_0xcca2('0x57')])){return this[_0xcca2('0xd')][_0xcca2('0xa8')](_0xcca2('0x1c9'));}if(!this['isConfigured'](_0x28590d[_0xcca2('0x59')])){return this['channel'][_0xcca2('0xa8')](_0xcca2('0xa9'));}this[_0xcca2('0xd')][_0xcca2('0xa8')](util[_0xcca2('0x51')](_0xcca2('0x1ca'),_0x28590d[_0xcca2('0x59')]));var _0xddd1a9=this[_0xcca2('0x56')][_0xcca2('0x6e')](this,_0x28590d);if(_0xddd1a9){this[_0xcca2('0xd')][_0xcca2('0xa8')](util['format'](_0xcca2('0x1cb'),_0xddd1a9));var _0x3cbf3d=this[_0xcca2('0xd')][_0xcca2('0x125')](_0xddd1a9);try{fs['unlink'](_0xddd1a9+'.wav');}catch(_0x20e65a){logger[_0xcca2('0x26')](_0x20e65a);}return _0x3cbf3d;}return this[_0xcca2('0xd')][_0xcca2('0x26')](_0x28590d,_0xcca2('0x1cc'));};AGIVertices[_0xcca2('0x10')][_0xcca2('0x1cd')]=function(_0x213380){logger[_0xcca2('0x28')](util[_0xcca2('0x51')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x213380['label']));_0x213380[_0xcca2('0x59')]=_0x213380[_0xcca2('0x59')][_0xcca2('0xd3')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xcca2('0x86')](_0x213380['text'])){return this[_0xcca2('0xd')][_0xcca2('0xa8')](_0xcca2('0xa9'));}this[_0xcca2('0xd')]['noop'](util[_0xcca2('0x51')]('Trying\x20Google\x20TTS\x20%s',_0x213380[_0xcca2('0x59')]));var _0x10064e=this['googleTTS']['sync'](this,_0x213380);if(_0x10064e){this[_0xcca2('0xd')][_0xcca2('0xa8')](util[_0xcca2('0x51')](_0xcca2('0x1ce'),_0x10064e));var _0x14f32e=this[_0xcca2('0xd')][_0xcca2('0x125')](_0x10064e);try{fs['unlink'](_0x10064e+_0xcca2('0x102'));}catch(_0x2f2bd0){logger['error'](_0x2f2bd0);}return _0x14f32e;}return this['channel'][_0xcca2('0x26')](_0x213380,_0xcca2('0x1cf'));};AGIVertices[_0xcca2('0x10')]['unpause']=function(_0xd34c54){logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0x1d0'),_0xd34c54[_0xcca2('0x32')]));if(!this['isConfigured'](_0xd34c54[_0xcca2('0x15c')])){return this[_0xcca2('0xd')][_0xcca2('0x26')](_0xd34c54,'no\x20find\x20by\x20configured');}logger[_0xcca2('0x28')](util['format'](_0xcca2('0x163'),this[_0xcca2('0xd')][_0xcca2('0x35')],_0xd34c54['findBy']));var _0x2fa46c=this['agentUnpause'][_0xcca2('0x6e')](this,_0xd34c54['findBy']);if(_0x2fa46c){logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0x15d'),this[_0xcca2('0xd')][_0xcca2('0x35')],_0xd34c54[_0xcca2('0x15c')]));this[_0xcca2('0xd')]['noop'](util['format'](_0xcca2('0x15d'),this[_0xcca2('0xd')][_0xcca2('0x35')],_0xd34c54['findBy']));return{'code':0xc8,'result':_0xcca2('0x15e')};}else{logger['info'](util[_0xcca2('0x51')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xcca2('0xd')][_0xcca2('0x35')],_0xd34c54[_0xcca2('0x15c')]));this[_0xcca2('0xd')][_0xcca2('0xa8')](util[_0xcca2('0x51')](_0xcca2('0x164'),this[_0xcca2('0xd')][_0xcca2('0x35')],_0xd34c54['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xcca2('0x1d1')]=function(_0x553036){logger[_0xcca2('0x28')](util[_0xcca2('0x51')](_0xcca2('0x1d2'),_0x553036[_0xcca2('0x32')]));var _0x374d62=this['channel'][_0xcca2('0x54')](_0xcca2('0x1d3'),[_0x553036['mailbox'],_0x553036[_0xcca2('0x78')]]);if(_0x374d62[_0xcca2('0xab')]===-0x1){return _0x374d62;}return this['channel'][_0xcca2('0xa8')](util[_0xcca2('0x51')](_0xcca2('0xc2'),_0xcca2('0x1d3'),_0x553036[_0xcca2('0x1d4')]));};AGIVertices['prototype'][_0xcca2('0x1d5')]=function(_0x1e0ac1){logger[_0xcca2('0x28')](util[_0xcca2('0x51')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x1e0ac1[_0xcca2('0x32')]));if(!this[_0xcca2('0x86')](_0x1e0ac1[_0xcca2('0xd6')])){return this[_0xcca2('0xd')]['error'](_0x1e0ac1,_0xcca2('0x1b6'));}var _0x228189=this['getVariable']['sync'](this,_0x1e0ac1[_0xcca2('0xd6')]);if(!_0x228189){return this[_0xcca2('0xd')][_0xcca2('0x26')](_0x1e0ac1,'no\x20variable\x20found');}var _0x27dc48=this['channel']['getVariable'](_0x228189);return{'code':0xc8,'result':_0x27dc48[_0xcca2('0xa2')]?_0x27dc48[_0xcca2('0xa2')]:'-'};};String[_0xcca2('0x10')][_0xcca2('0xa0')]=function(_0x1584be,_0x260db0){return this['split'](_0x1584be)[_0xcca2('0x1d6')](_0x260db0);};module['exports']=AGIVertices; \ No newline at end of file +var _0x1f3d=['SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','Trying\x20DialogflowV2:\x20%s','dialogflowV2','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','audiofile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','toString','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_secret_access_key','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','priority','gotoif','condition','no\x20condition\x20configured','true','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','NOBEEP','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','macro','gosub','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','replace','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','service','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','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','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','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','path','util','lodash','odbc','randomstring','moment','mustache','request-promise','agi','../../config/environment','./scripts','rawHeaders','rawBody','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunkById','getSound','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','map','Intervals','interval','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','accountcode','dnid','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPauseById','agentPause','agent','error','agentUnpause','internal','agentLogin','shellCommand','exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','MALE','audioEncoding','googleTTS','google_tts_language','restAPI','method','timeout','number','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','url','headers','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_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','uri','includes','clone','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','saveRestApiResult','length','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','maxRetry','retry','mrcpsynth','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','result','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','add','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block'];(function(_0x118796,_0x156f22){var _0x592d87=function(_0x19aa5c){while(--_0x19aa5c){_0x118796['push'](_0x118796['shift']());}};_0x592d87(++_0x156f22);}(_0x1f3d,0x10f));var _0xd1f3=function(_0x1129da,_0x31cf2d){_0x1129da=_0x1129da-0x0;var _0x433dea=_0x1f3d[_0x1129da];return _0x433dea;};'use strict';var fs=require('fs');var path=require(_0xd1f3('0x0'));var util=require(_0xd1f3('0x1'));var _=require(_0xd1f3('0x2'));var sh=require('shelljs');var odbc=require(_0xd1f3('0x3'))();var rs=require(_0xd1f3('0x4'));var moment=require(_0xd1f3('0x5'));var Mustache=require(_0xd1f3('0x6'));var rp=require(_0xd1f3('0x7'));var logger=require('../../config/logger')(_0xd1f3('0x8'));var config=require(_0xd1f3('0x9'));var scripts=require(_0xd1f3('0xa'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0xd1f3('0xb'),_0xd1f3('0xc')];var verticesWithRetry=['menu','getdigits',_0xd1f3('0xd')];var AGIVertices=function(_0x3b1b3c,_0x2b9b6f,_0x5bf5da){this[_0xd1f3('0xe')]=_0x3b1b3c;this[_0xd1f3('0xf')]=_0x2b9b6f;this[_0xd1f3('0x10')]=_0x5bf5da;};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x12')]=function(_0xec5588,_0x36aeb5){this[_0xd1f3('0xf')][_0xd1f3('0x13')](_0xec5588)[_0xd1f3('0x14')](function(_0x24598e){_0x36aeb5(null,_0x24598e?_0x24598e[_0xd1f3('0x15')]:![]);})[_0xd1f3('0x16')](function(_0x1447b3){_0x36aeb5(_0x1447b3);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x17')]=function(_0x5c47a5,_0x56bf76){this['rpc'][_0xd1f3('0x18')](_0x5c47a5)[_0xd1f3('0x14')](function(_0x517abe){_0x56bf76(null,_0x517abe?_0x517abe['name']:![]);})[_0xd1f3('0x16')](function(_0x995e02){_0x56bf76(_0x995e02);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x19')]=function(_0x44097a,_0x182970){this[_0xd1f3('0xf')][_0xd1f3('0x1a')](_0x44097a)[_0xd1f3('0x14')](function(_0x23c593){_0x182970(null,_0x23c593?_0x23c593[_0xd1f3('0x15')]:![]);})['catch'](function(_0x44496e){_0x182970(_0x44496e);});};AGIVertices['prototype'][_0xd1f3('0x1b')]=function(_0x30b6b3,_0x3fa9e3){this[_0xd1f3('0xf')][_0xd1f3('0x1c')](_0x30b6b3)['then'](function(_0xc879ab){_0x3fa9e3(null,_0xc879ab?_0xc879ab[_0xd1f3('0x1d')]:![]);})[_0xd1f3('0x16')](function(_0x5c7c6c){_0x3fa9e3(_0x5c7c6c);});};AGIVertices[_0xd1f3('0x11')]['getUser']=function(_0x3e2ffa,_0x187ce2){this['rpc'][_0xd1f3('0x1e')](_0x3e2ffa)[_0xd1f3('0x14')](function(_0x402e5f){_0x187ce2(null,_0x402e5f?_0x402e5f[_0xd1f3('0x15')]:![]);})[_0xd1f3('0x16')](function(_0xfbe28b){_0x187ce2(_0xfbe28b);});};AGIVertices[_0xd1f3('0x11')]['getTrunk']=function(_0x11bf76,_0x47033e){this['rpc'][_0xd1f3('0x1f')](_0x11bf76)[_0xd1f3('0x14')](function(_0x426f66){_0x47033e(null,_0x426f66?_0x426f66['name']:![]);})[_0xd1f3('0x16')](function(_0x314da3){_0x47033e(_0x314da3);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x20')]=function(_0x2c36b7,_0x3b14b7){var _0x148980=this;this[_0xd1f3('0xf')]['getSoundById'](_0x2c36b7)[_0xd1f3('0x14')](function(_0x583d25){_0x3b14b7(null,_0x583d25?_0x148980['getSoundPath'](_0x583d25[_0xd1f3('0x21')]):![]);})['catch'](function(_0x218eb8){_0x3b14b7(_0x218eb8);});};AGIVertices[_0xd1f3('0x11')]['getMailAccount']=function(_0x24e66d,_0x4782fc){this[_0xd1f3('0xf')][_0xd1f3('0x22')](_0x24e66d)['then'](function(_0x40da57){_0x4782fc(null,_0x40da57?_0x40da57:![]);})[_0xd1f3('0x16')](function(_0x3c725b){_0x4782fc(_0x3c725b);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x23')]=function(_0x20eac9,_0xb674bb,_0x154140){this[_0xd1f3('0x10')][_0xd1f3('0x23')](_0x20eac9,_0xb674bb)[_0xd1f3('0x14')](function(){_0x154140(null);})[_0xd1f3('0x16')](function(_0x4e3804){_0x154140(_0x4e3804);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x24')]=function(_0x5d7a69,_0x48c910){this[_0xd1f3('0xf')][_0xd1f3('0x25')](_0x5d7a69)[_0xd1f3('0x14')](function(_0x557d7f){if(_0x557d7f){if(_0x557d7f[_0xd1f3('0x26')]){_0x48c910(null,[_0x557d7f['interval']]);}else{_0x48c910(null,_[_0xd1f3('0x27')](_0x557d7f[_0xd1f3('0x28')],_0xd1f3('0x29')));}}else{_0x48c910(null,![]);}})[_0xd1f3('0x16')](function(_0x2d3830){_0x48c910(_0x2d3830);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x2a')]=function(_0x80e42b){return util[_0xd1f3('0x2b')](_0xd1f3('0x2c'),FILES_PATH,_0x80e42b);};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x2d')]=function(_0x58f46d,_0x1305ac,_0x348065){odbc[_0xd1f3('0x2e')](_0x58f46d,function(_0xea208f){if(_0xea208f){logger['error'](_0xd1f3('0x2f'),_0xea208f);_0x348065(_0xea208f);}else{logger[_0xd1f3('0x30')]('ODBC\x20connection\x20successfully');odbc['query'](_0x1305ac,function(_0x4d4768,_0xc3905b){if(_0x4d4768){logger['info']('Error\x20executing\x20query\x20%s',_0x1305ac);_0x348065(_0x4d4768);}else{logger[_0xd1f3('0x30')]('Query\x20executed\x20correctly\x20%s',_0x1305ac);odbc[_0xd1f3('0x31')](function(_0x5bfb03){if(_0x5bfb03){logger['error'](_0xd1f3('0x32'),_0x5bfb03);}_0x348065(null,_0xc3905b);});}});}});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x33')]=function(_0x405eee,_0x453e7c){this[_0xd1f3('0xf')][_0xd1f3('0x34')](_0x405eee)[_0xd1f3('0x14')](function(_0x4e395b){_0x453e7c(null,_0x4e395b?_0x4e395b:![]);})[_0xd1f3('0x16')](function(_0x5882ea){_0x453e7c(_0x5882ea);});};AGIVertices[_0xd1f3('0x11')]['createSmsMessage']=function(_0x38b15e,_0x39f262){this[_0xd1f3('0xf')][_0xd1f3('0x35')](_0x38b15e)['then'](function(_0xcb76d4){_0x39f262(null,_0xcb76d4);})[_0xd1f3('0x16')](function(_0x13b2ff){_0x39f262(_0x13b2ff);});};AGIVertices['prototype']['createSquareDetailsReport']=function(_0x1c68e2,_0x1a8717,_0x24c3ab){this[_0xd1f3('0xf')][_0xd1f3('0x36')]({'uniqueid':this['channel'][_0xd1f3('0x37')],'node':_0x1c68e2[_0xd1f3('0x38')],'application':_0x1c68e2[_0xd1f3('0x39')],'data':_0x1a8717||null,'project_name':this['channel'][_0xd1f3('0x3a')],'callerid':this[_0xd1f3('0xe')][_0xd1f3('0x3b')]})[_0xd1f3('0x14')](function(_0x235d9e){if(_0x24c3ab){_0x24c3ab(null,_0x235d9e);}})[_0xd1f3('0x16')](function(_0x22d166){if(_0x24c3ab){_0x24c3ab(_0x22d166);}});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x3c')]=function(_0x268b9e,_0x2b5c5f,_0x3b048d,_0x4c84c1){this[_0xd1f3('0xf')][_0xd1f3('0x3c')]({'uniqueid':this[_0xd1f3('0xe')][_0xd1f3('0x37')],'callerid':this['channel'][_0xd1f3('0x3b')],'calleridname':this['channel'][_0xd1f3('0x3d')],'context':this[_0xd1f3('0xe')]['context'],'extension':this['channel']['extension'],'priority':this[_0xd1f3('0xe')]['priority'],'accountcode':this[_0xd1f3('0xe')][_0xd1f3('0x3e')],'dnid':this['channel'][_0xd1f3('0x3f')],'projectName':this[_0xd1f3('0xe')][_0xd1f3('0x3a')],'saveName':_0x2b5c5f,'filename':_0x268b9e['file']||_0x2b5c5f,'savePath':_0x3b048d})[_0xd1f3('0x14')](function(_0x27d5c7){_0x4c84c1(null,_0x27d5c7);})[_0xd1f3('0x16')](function(_0x594402){_0x4c84c1(_0x594402);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x40')]=function(_0x326707,_0x581144,_0x487e40,_0x2589ec,_0x20c6a6){this[_0xd1f3('0xf')]['createSquareMessage']({'uniqueid':this['channel'][_0xd1f3('0x37')],'body':_0x326707,'direction':_0x581144,'providerName':_0x487e40,'providerResponse':_0x2589ec})[_0xd1f3('0x14')](function(_0x4251ff){if(_0x20c6a6){_0x20c6a6(null,_0x4251ff);}})[_0xd1f3('0x16')](function(_0x4e1faa){if(_0x20c6a6){_0x20c6a6(_0x4e1faa);}});};AGIVertices['prototype'][_0xd1f3('0x41')]=function(_0x56a74f,_0xecca08){this[_0xd1f3('0xf')][_0xd1f3('0x41')]({'firstName':_[_0xd1f3('0x42')](_0x56a74f['name'])||_[_0xd1f3('0x43')](_0x56a74f[_0xd1f3('0x15')])?_0xd1f3('0x44')+Math[_0xd1f3('0x45')]():_0x56a74f[_0xd1f3('0x15')],'lastName':_[_0xd1f3('0x42')](_0x56a74f[_0xd1f3('0x46')])||_[_0xd1f3('0x43')](_0x56a74f[_0xd1f3('0x46')])?null:_0x56a74f[_0xd1f3('0x46')],'phone':_0x56a74f[_0xd1f3('0x47')],'ListId':_0x56a74f['list_id'],'scheduledat':_0x56a74f[_0xd1f3('0x48')],'callbackUniqueid':this[_0xd1f3('0xe')][_0xd1f3('0x37')],'tags':_0xd1f3('0x49'),'description':_0xd1f3('0x4a')+_0x56a74f[_0xd1f3('0x48')]['toString'](),'priority':_0x56a74f[_0xd1f3('0x4b')]})[_0xd1f3('0x14')](function(_0x3a3180){_0xecca08(null,_0x3a3180);})['catch'](function(_0x24089a){_0xecca08(_0x24089a);});};AGIVertices[_0xd1f3('0x11')]['getPause']=function(_0x555265,_0xf52bcf){this[_0xd1f3('0xf')][_0xd1f3('0x4c')](_0x555265)['then'](function(_0x3f6b45){_0xf52bcf(null,_0x3f6b45?_0x3f6b45[_0xd1f3('0x15')]:![]);})[_0xd1f3('0x16')](function(_0x55bfd1){_0xf52bcf(_0x55bfd1);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x4d')]=function(_0x2a2751,_0x3a5df6,_0x57182d){var _0xb0df45={'role':_0xd1f3('0x4e')};_0xb0df45[_0x2a2751]=this[_0xd1f3('0xe')][_0xd1f3('0x3b')];this[_0xd1f3('0xf')][_0xd1f3('0x4d')](_0xb0df45,_0x3a5df6,this['channel'][_0xd1f3('0x37')])['then'](function(_0x14505e){_0x57182d(null,_[_0xd1f3('0x43')](_0x14505e)?![]:!![]);})[_0xd1f3('0x16')](function(_0x423dcc){logger[_0xd1f3('0x4f')](_0x423dcc);_0x57182d(null,![]);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x50')]=function(_0x169ae4,_0x50b9f2){var _0x2f09e5={'role':_0xd1f3('0x4e')};_0x2f09e5[_0x169ae4]=this[_0xd1f3('0xe')][_0xd1f3('0x3b')];this['rpc']['agentUnpause'](_0x2f09e5)['then'](function(_0x434850){_0x50b9f2(null,_['isNil'](_0x434850)?![]:!![]);})[_0xd1f3('0x16')](function(_0x3bcf86){logger[_0xd1f3('0x4f')](_0x3bcf86);_0x50b9f2(null,![]);});};AGIVertices[_0xd1f3('0x11')]['agentLogout']=function(_0x580e76,_0x34133e){var _0x316a02={'role':'agent'};_0x316a02[_0x580e76]=this[_0xd1f3('0xe')][_0xd1f3('0x3b')];this[_0xd1f3('0xf')]['agentLogout'](_0x316a02)[_0xd1f3('0x14')](function(_0x6e1f47){_0x34133e(null,_[_0xd1f3('0x43')](_0x6e1f47)?![]:!![]);})[_0xd1f3('0x16')](function(_0x636152){logger[_0xd1f3('0x4f')](_0x636152);_0x34133e(null,![]);});};AGIVertices[_0xd1f3('0x11')]['agentLogin']=function(_0x2e9670,_0x6da335){var _0x5de71d={'role':_0xd1f3('0x4e')};_0x5de71d[_0x2e9670]=this[_0xd1f3('0xe')][_0xd1f3('0x3b')];var _0x54d9ed=_0x2e9670!=_0xd1f3('0x51')?util[_0xd1f3('0x2b')]('%s/%s@from-sip/n','LOCAL',this[_0xd1f3('0xe')]['callerid']):undefined;this['rpc'][_0xd1f3('0x52')](_0x5de71d,_0x54d9ed)[_0xd1f3('0x14')](function(_0x3f6a07){_0x6da335(null,_[_0xd1f3('0x43')](_0x3f6a07)?![]:!![]);})['catch'](function(_0x4ded96){logger['error'](_0x4ded96);_0x6da335(null,![]);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x53')]=function(_0x35e689,_0x2b6095){sh[_0xd1f3('0x54')](_[_0xd1f3('0x55')](_0x35e689),function(_0x2abbc6,_0x1a9dfa){var _0x59f340=_0x1a9dfa['replace'](/(\r\n|\n|\r)/gm,'');_0x2b6095(null,_0x59f340);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x56')]=function(_0x4374dc,_0x3b5ea2){scripts[_0xd1f3('0x56')](_0x4374dc[_0xd1f3('0x57')],_0x4374dc[_0xd1f3('0x58')]||_0xd1f3('0x59'),_0x4374dc[_0xd1f3('0x59')],_0x4374dc[_0xd1f3('0x5a')]||_0xd1f3('0x5b'),_0x4374dc['ssmlGender']||_0xd1f3('0x5c'),_0x4374dc[_0xd1f3('0x5d')]||'MP3')['then'](function(_0x48d3d1){_0x3b5ea2(null,_0x48d3d1);})['catch'](function(_0x3dc00d){_0x3b5ea2(_0x3dc00d);});};AGIVertices[_0xd1f3('0x11')]['googleTTS']=function(_0x3f857d,_0x11c187){scripts[_0xd1f3('0x5e')](_0x3f857d['text'],_0x3f857d[_0xd1f3('0x5f')]||'en',0x1)[_0xd1f3('0x14')](function(_0x373e08){_0x11c187(null,_0x373e08);})['catch'](function(_0x323540){_0x11c187(_0x323540);});};AGIVertices['prototype'][_0xd1f3('0x60')]=function(_0x2c6a44,_0x51d22e){var _0x180dec={'uri':_0x2c6a44['url'],'method':_0x2c6a44[_0xd1f3('0x61')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x2c6a44[_0xd1f3('0x62')])===_0xd1f3('0x63')&&parseInt(_0x2c6a44['timeout'])>=0x1?parseInt(_0x2c6a44[_0xd1f3('0x62')])*0x3e8:0x5*0x3e8};if(_['includes'](['POST',_0xd1f3('0x64')],_0x180dec['method'][_0xd1f3('0x65')]())){try{_0x180dec[_0xd1f3('0x66')]=_0x2c6a44[_0xd1f3('0xc')]?JSON['parse'](_0x2c6a44[_0xd1f3('0xc')]):{};}catch(_0x566c4a){logger[_0xd1f3('0x4f')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x566c4a);}}try{_0x180dec['headers']=_0x2c6a44[_0xd1f3('0xb')]?JSON[_0xd1f3('0x67')](_0x2c6a44[_0xd1f3('0xb')]):{};}catch(_0x460f1c){logger[_0xd1f3('0x4f')](_0xd1f3('0x68'),_0x460f1c);}if(_0x2c6a44[_0xd1f3('0x69')]){try{var _0x389e2f=require(_0x2c6a44['computedVariables'])[_0xd1f3('0x6a')](this,_0x180dec);_0x180dec['uri']=Mustache[_0xd1f3('0x6b')](_0x2c6a44[_0xd1f3('0x6c')],_0x389e2f,{},['$$','$$']);if(_0x180dec[_0xd1f3('0x6d')]){_0x180dec['headers']=JSON[_0xd1f3('0x67')](Mustache[_0xd1f3('0x6b')](JSON[_0xd1f3('0x6e')](_0x180dec[_0xd1f3('0x6d')]),_0x389e2f,{},['$$','$$']));}if(_0x180dec['body']){_0x180dec['body']=JSON[_0xd1f3('0x67')](Mustache[_0xd1f3('0x6b')](JSON[_0xd1f3('0x6e')](_0x180dec[_0xd1f3('0x66')]),_0x389e2f,{},['$$','$$']));}}catch(_0x17d403){logger[_0xd1f3('0x4f')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x17d403);}}rp(_0x180dec)['then'](function(_0x56bcf5){var _0x29d3c1={'statusCode':_0x56bcf5[_0xd1f3('0x6f')]||0xc8,'statusMessage':_0x56bcf5[_0xd1f3('0x70')]||'OK','headers':_0x56bcf5[_0xd1f3('0x6d')]||{},'body':_0x56bcf5['body']||{}};_0x51d22e(null,_0x29d3c1);})[_0xd1f3('0x16')](function(_0x1309d0){var _0x4fde13={'statusCode':_0x1309d0[_0xd1f3('0x6f')]||0x1f4,'statusMessage':_0x1309d0[_0xd1f3('0x71')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x1309d0[_0xd1f3('0x72')][_0xd1f3('0x6d')]||{},'body':_0x1309d0[_0xd1f3('0x72')][_0xd1f3('0x66')]||{}};_0x51d22e(null,_0x4fde13);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x73')]=function(_0x2ee1a5,_0x19e4ad){scripts['googleDialogflow'](this[_0xd1f3('0xe')][_0xd1f3('0x37')],_0x2ee1a5[_0xd1f3('0x74')],_0x2ee1a5['text'],_0x2ee1a5[_0xd1f3('0x75')]||'en')[_0xd1f3('0x14')](function(_0x525aa8){_0x19e4ad(null,_0x525aa8);})[_0xd1f3('0x16')](function(_0x2c2ab6){_0x19e4ad(_0x2c2ab6);});};AGIVertices['prototype']['googleDialogflowV2']=function(_0x38a0a4,_0x27f901){scripts[_0xd1f3('0x76')](this['channel'][_0xd1f3('0x37')],_0x38a0a4[_0xd1f3('0x77')],_0x38a0a4[_0xd1f3('0x78')],_0x38a0a4[_0xd1f3('0x79')],_0x38a0a4['text'],_0x38a0a4[_0xd1f3('0x7a')]||'en')[_0xd1f3('0x14')](function(_0x8cd801){_0x27f901(null,_0x8cd801);})['catch'](function(_0xb849ea){_0x27f901(_0xb849ea);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x7b')]=function(_0x49a1b1,_0x35c5df){scripts[_0xd1f3('0x7b')](this[_0xd1f3('0xe')],_0x49a1b1)[_0xd1f3('0x14')](function(_0x4dbbda){_0x35c5df(null,_0x4dbbda);})[_0xd1f3('0x16')](function(_0x3833a8){_0x35c5df(_0x3833a8);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x7c')]=function(_0x3e25f3,_0xec47cb){scripts[_0xd1f3('0x7c')](_0x3e25f3[_0xd1f3('0x74')],_0x3e25f3[_0xd1f3('0x59')],_0x3e25f3[_0xd1f3('0x7d')]||_0xd1f3('0x5b'),_0x3e25f3[_0xd1f3('0x7e')])[_0xd1f3('0x14')](function(_0x359843){_0xec47cb(null,_0x359843);})[_0xd1f3('0x16')](function(_0x46258){_0xec47cb(_0x46258);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x7f')]=function(_0x45bd00,_0x20d192,_0x5b8925){scripts['ispeechASR'](_0x20d192,_0x45bd00[_0xd1f3('0x74')],_0x45bd00[_0xd1f3('0x80')]||_0xd1f3('0x5b'),this[_0xd1f3('0x81')](_0x45bd00['model'])?_0x45bd00[_0xd1f3('0x82')]:undefined)[_0xd1f3('0x14')](function(_0x40f740){_0x5b8925(null,_0x40f740);})['catch'](function(_0x4e1a11){_0x5b8925(_0x4e1a11);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x83')]=function(_0x20ed93,_0x4f6c6f){scripts[_0xd1f3('0x83')](_0x20ed93[_0xd1f3('0x84')],_0x20ed93['aws_secret_access_key'],_0x20ed93['aws_polly_region'],_0x20ed93[_0xd1f3('0x85')]||_0xd1f3('0x86'),_0x20ed93[_0xd1f3('0x59')],_0x20ed93[_0xd1f3('0x87')]||_0xd1f3('0x59'))['then'](function(_0x53afad){_0x4f6c6f(null,_0x53afad);})[_0xd1f3('0x16')](function(_0x47dec4){_0x4f6c6f(_0x47dec4);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x88')]=function(_0x2804be,_0x604725){scripts[_0xd1f3('0x88')](this[_0xd1f3('0xe')][_0xd1f3('0x37')],_0x2804be[_0xd1f3('0x84')],_0x2804be['aws_secret_access_key'],_0x2804be[_0xd1f3('0x89')],_0x2804be[_0xd1f3('0x59')],_0x2804be[_0xd1f3('0x8a')])[_0xd1f3('0x14')](function(_0x7596d6){_0x604725(null,_0x7596d6);})['catch'](function(_0x1663ed){_0x604725(_0x1663ed);});};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x8b')]=function(_0x2b3c1e,_0x2f1559,_0x3998e4){scripts[_0xd1f3('0x8b')](_0x2f1559,_0x2b3c1e[_0xd1f3('0x74')],_0x2b3c1e[_0xd1f3('0x8c')]||_0xd1f3('0x5b'))[_0xd1f3('0x14')](function(_0x19838c){_0x3998e4(null,_0x19838c);})[_0xd1f3('0x16')](function(_0x67c9cf){_0x3998e4(_0x67c9cf);});};AGIVertices['prototype'][_0xd1f3('0x8d')]=function(_0x106c23,_0x92cc74,_0x1ecb14){scripts['tildeASR'](_0x92cc74,_0x106c23['appid'],_0x106c23[_0xd1f3('0x8e')],_0x106c23[_0xd1f3('0x8f')])[_0xd1f3('0x14')](function(_0x14522a){_0x1ecb14(null,_0x14522a);})[_0xd1f3('0x16')](function(_0x137d4a){_0x1ecb14(_0x137d4a);});};AGIVertices[_0xd1f3('0x11')]['clear']=function(_0x47d6cb){var _0x17e21a=_[_0xd1f3('0x90')](verticesWithRetry,_0x47d6cb['agicommand'])?_0x47d6cb:_[_0xd1f3('0x91')](_0x47d6cb);for(var _0x20bca6 in _0x17e21a){if(_0x17e21a['hasOwnProperty'](_0x20bca6)){if(_0x17e21a[_0x20bca6]&&_[_0xd1f3('0x92')](_0x17e21a[_0x20bca6])){if(_[_0xd1f3('0x90')](recursiveMapAttributes,_0x20bca6)){_0x17e21a[_0x20bca6]=this[_0xd1f3('0x93')](_0x17e21a[_0x20bca6]);}else{_0x17e21a[_0x20bca6]=this[_0xd1f3('0x94')](_0x17e21a[_0x20bca6]);}}}}return _0x17e21a;};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x95')]=function(_0x9c3660){for(var _0x5a5043 in _0x9c3660){if(_0x9c3660[_0xd1f3('0x96')](_0x5a5043)){if(_[_0xd1f3('0x97')](_0x9c3660[_0x5a5043])){this['recursiveNodeIndex'](_0x9c3660[_0x5a5043]);}else if(_[_0xd1f3('0x98')](_0x9c3660[_0x5a5043])){for(var _0x259114=0x0;_0x259114<_0x9c3660[_0x5a5043]['length'];_0x259114++){this[_0xd1f3('0x95')](_0x9c3660[_0x5a5043][_0x259114]);}}else if(_[_0xd1f3('0x92')](_0x9c3660[_0x5a5043])){_0x9c3660[_0x5a5043]=this['replaceAllVariables'](_0x9c3660[_0x5a5043]);}}}};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x99')]=function(_0x377ca1,_0x4bb5b4){for(var _0x765839 in _0x377ca1){if(_0x377ca1['hasOwnProperty'](_0x765839)){if(_[_0xd1f3('0x97')](_0x377ca1[_0x765839])){if(!_[_0xd1f3('0x42')](_0x377ca1[_0x765839])){this[_0xd1f3('0x99')](_0x377ca1[_0x765839],util[_0xd1f3('0x2b')]('%s.%s',_0x4bb5b4,_0x765839));}}else if(_[_0xd1f3('0x98')](_0x377ca1[_0x765839])){for(var _0x21076f=0x0;_0x21076f<_0x377ca1[_0x765839][_0xd1f3('0x9a')];_0x21076f++){this['saveRestApiResult'](_0x377ca1[_0x765839][_0x21076f],util['format'](_0xd1f3('0x9b'),_0x4bb5b4,_0x765839+'['+_0x21076f+']'));}}else{if(!_[_0xd1f3('0x43')](_0x377ca1[_0x765839])){this[_0xd1f3('0xe')][_0xd1f3('0x9c')](util[_0xd1f3('0x2b')](_0xd1f3('0x9b'),_0x4bb5b4,_0x765839),_0x377ca1[_0x765839]);}}}}};AGIVertices['prototype'][_0xd1f3('0x93')]=function(_0x250ba8){try{var _0x3452f9=JSON[_0xd1f3('0x67')](_0x250ba8);this[_0xd1f3('0x95')](_0x3452f9);return JSON[_0xd1f3('0x6e')](_0x3452f9);}catch(_0x2c920e){return this['replaceAllVariables'](_0x250ba8);}};AGIVertices['prototype'][_0xd1f3('0x94')]=function(_0x366178){var _0x3537f1=_0x366178[_0xd1f3('0x9d')]('{');for(var _0x504836=0x1;_0x504836<_0x3537f1[_0xd1f3('0x9a')];_0x504836+=0x1){var _0x3c8b90=_0x3537f1[_0x504836]['split']('}');if(_0x3c8b90['length']>0x1){_0x366178=_0x366178[_0xd1f3('0x9e')]('{'+_0x3c8b90[0x0]+'}',this['channel'][_0xd1f3('0x12')](_0x3c8b90[0x0])[_0xd1f3('0x9f')]||_0x3c8b90[0x0]);}}if(_0x3537f1[_0xd1f3('0x9a')]===0x1){return _0x366178['toString']();}return this[_0xd1f3('0x94')](_0x366178);};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0xa0')]=function(_0x142c18,_0x1ecb00){var _0x5982cd=this['channel'][_0xd1f3('0x12')](_0x142c18);if(_0x5982cd['result']===-0x1){return _0x5982cd;}logger['info'](util[_0xd1f3('0x2b')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x1ecb00,_0x5982cd['extra']));return this[_0xd1f3('0xe')]['setVariable'](_0x1ecb00,_0x5982cd['extra']);};AGIVertices['prototype'][_0xd1f3('0x81')]=function(_0x11e942){return _0x11e942&&_0x11e942!=='0'&&_0x11e942!=='-1'&&_0x11e942!=='';};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0xa1')]=function(_0xb9af69){this[_0xd1f3('0x36')][_0xd1f3('0x6a')](this,_0xb9af69,'-');_0xb9af69[_0xd1f3('0xa2')]=_0xb9af69[_0xd1f3('0xa1')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0xa3')]=function(_0xc18fc9){logger[_0xd1f3('0x30')](util['format']('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0xc18fc9[_0xd1f3('0x38')]));if(!this[_0xd1f3('0x81')](_0xc18fc9[_0xd1f3('0x59')])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0xa5'));}var _0x3097fa='\x22'+_0xc18fc9[_0xd1f3('0x59')]+'\x22';if(this[_0xd1f3('0x81')](_0xc18fc9[_0xd1f3('0x72')])){_0x3097fa+=','+_0xc18fc9[_0xd1f3('0x72')];}var _0x41c63a=this[_0xd1f3('0xe')]['exec'](_0xd1f3('0xa6'),_0x3097fa);if(_0x41c63a['result']===-0x1){return _0x41c63a;}return this['channel'][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0xa7'),_0x3097fa));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0xa8')]=function(_0x219046){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0xa9'),_0x219046[_0xd1f3('0x38')]));if(!this[_0xd1f3('0x81')](_0x219046[_0xd1f3('0xaa')])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0xab'));}var _0x57536f=_0x219046['grammar'];if(this[_0xd1f3('0x81')](_0x219046[_0xd1f3('0x72')])){_0x57536f+=','+_0x219046['options'];}var _0xd383d9=this[_0xd1f3('0xe')]['exec'](_0xd1f3('0xac'),_0x57536f);if(_0xd383d9[_0xd1f3('0xad')]===-0x1){return _0xd383d9;}var _0x4e0cdf=this[_0xd1f3('0xa0')](_0xd1f3('0xae'),_0xd1f3('0xaf'));if(_0x4e0cdf['result']===-0x1){return _0x4e0cdf;}var _0x3b53d6=this[_0xd1f3('0xa0')](_0xd1f3('0xb0'),_0xd1f3('0xb1'));if(_0x3b53d6[_0xd1f3('0xad')]===-0x1){return _0x3b53d6;}var _0x1c6caa=this[_0xd1f3('0xa0')](_0xd1f3('0xb2'),_0xd1f3('0xb3'));if(_0x1c6caa['result']===-0x1){return _0x1c6caa;}return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util['format'](_0xd1f3('0xb4'),_0x57536f));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x8')]=function(_0xd50a92){logger['info'](util[_0xd1f3('0x2b')](_0xd1f3('0xb5'),_0xd50a92[_0xd1f3('0x38')]));return this[_0xd1f3('0xe')]['agi']([_0xd50a92[_0xd1f3('0xb6')],_0xd50a92[_0xd1f3('0xb7')]]);};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0xb8')]=function(_0x43e271){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0xb9'),_0x43e271[_0xd1f3('0x38')]));if(this[_0xd1f3('0x81')](_0x43e271[_0xd1f3('0x62')])){logger['info'](util['format'](_0xd1f3('0xba'),_0x43e271['timeout']));var _0x14b24a=this[_0xd1f3('0xe')][_0xd1f3('0xbb')](_0x43e271[_0xd1f3('0x62')]);if(_0x14b24a[_0xd1f3('0xad')]===-0x1){return _0x14b24a;}}return this[_0xd1f3('0xe')][_0xd1f3('0xb8')]();};AGIVertices['prototype'][_0xd1f3('0x49')]=function(_0x13c8c5){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0xbc'),_0x13c8c5['label']));if(!this[_0xd1f3('0x81')](_0x13c8c5[_0xd1f3('0xbd')])){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x13c8c5,_0xd1f3('0xbe'));}_0x13c8c5['scheduledAt']=moment();if(this[_0xd1f3('0x81')](_0x13c8c5[_0xd1f3('0xbf')])){_0x13c8c5[_0xd1f3('0x48')]=moment()[_0xd1f3('0xc0')](_0x13c8c5['delay'],'minutes');}if(!this[_0xd1f3('0x81')](_0x13c8c5[_0xd1f3('0x4b')])){_0x13c8c5[_0xd1f3('0x4b')]=0x2;}this[_0xd1f3('0x41')][_0xd1f3('0x6a')](this,_0x13c8c5);return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0xc1'),_0x13c8c5[_0xd1f3('0x47')],_0x13c8c5[_0xd1f3('0xbd')],_0x13c8c5[_0xd1f3('0x48')]));};AGIVertices[_0xd1f3('0x11')]['custom_app']=function(_0x57e751){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0xc2'),_0x57e751['label']));var _0x501dcb=this[_0xd1f3('0xe')][_0xd1f3('0x54')](_0x57e751[_0xd1f3('0xc3')],_0x57e751[_0xd1f3('0x72')]);if(_0x501dcb[_0xd1f3('0xad')]===-0x1){return _0x501dcb;}return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util['format'](_0xd1f3('0xc4'),_0x57e751[_0xd1f3('0xc3')],_0x57e751[_0xd1f3('0x72')]));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0xc5')]=function(_0x4d8beb){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x4d8beb[_0xd1f3('0x38')]));if(!this['isConfigured'](_0x4d8beb[_0xd1f3('0x59')])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0xa5'));}var _0x403316='\x22'+_0x4d8beb['text']+'\x22';if(this[_0xd1f3('0x81')](_0x4d8beb[_0xd1f3('0x72')])){_0x403316+=','+_0x4d8beb[_0xd1f3('0x72')];}var _0x25a30c=this[_0xd1f3('0xe')]['exec']('MRCPSynth',_0x403316);if(_0x25a30c[_0xd1f3('0xad')]===-0x1){return _0x25a30c;}return this['channel']['noop'](util['format'](_0xd1f3('0xa7'),_0x403316));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0xc6')]=function(_0x2c6daa){logger[_0xd1f3('0x30')](util['format'](_0xd1f3('0xc7'),_0x2c6daa[_0xd1f3('0x38')]));if(!this[_0xd1f3('0x81')](_0x2c6daa[_0xd1f3('0x59')])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')]('no\x20text\x20configured');}var _0x59a535='\x22'+_0x2c6daa[_0xd1f3('0x59')]+'\x22';if(this['isConfigured'](_0x2c6daa[_0xd1f3('0x72')])){_0x59a535+=','+_0x2c6daa['options'];}var _0x21c604=this[_0xd1f3('0xe')]['exec']('MRCPSynth',_0x59a535);if(_0x21c604[_0xd1f3('0xad')]===-0x1){return _0x21c604;}return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util['format'](_0xd1f3('0xa7'),_0x59a535));};AGIVertices[_0xd1f3('0x11')]['lumenvoxasr']=function(_0x16040e){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0xc8'),_0x16040e[_0xd1f3('0x38')]));if(!this[_0xd1f3('0x81')](_0x16040e[_0xd1f3('0xaa')])){return this['channel'][_0xd1f3('0xa4')]('no\x20grammar\x20configured');}var _0x89d356=_0x16040e['grammar'];if(this['isConfigured'](_0x16040e[_0xd1f3('0x72')])){_0x89d356+=','+_0x16040e[_0xd1f3('0x72')];}var _0x17925b=this[_0xd1f3('0xe')][_0xd1f3('0x54')]('MRCPRecog',_0x89d356);if(_0x17925b[_0xd1f3('0xad')]===-0x1){return _0x17925b;}var _0x20c7c1=this['getAndSetVariable'](_0xd1f3('0xae'),_0xd1f3('0xc9'));if(_0x20c7c1[_0xd1f3('0xad')]===-0x1){return _0x20c7c1;}var _0x4b5aed=this[_0xd1f3('0xa0')](_0xd1f3('0xb0'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x4b5aed[_0xd1f3('0xad')]===-0x1){return _0x4b5aed;}var _0x25e91e=this[_0xd1f3('0xa0')](_0xd1f3('0xb2'),_0xd1f3('0xca'));if(_0x25e91e[_0xd1f3('0xad')]===-0x1){return _0x25e91e;}return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0xb4'),_0x89d356));};AGIVertices[_0xd1f3('0x11')]['sestekasr']=function(_0x36414f){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0xcb'),_0x36414f[_0xd1f3('0x38')]));if(!this['isConfigured'](_0x36414f[_0xd1f3('0xaa')])){return this[_0xd1f3('0xe')]['noop'](_0xd1f3('0xab'));}var _0x48b18f=_0x36414f['grammar'];if(this[_0xd1f3('0x81')](_0x36414f['options'])){_0x48b18f+=','+_0x36414f['options'];}var _0x533f38=this['channel'][_0xd1f3('0x54')](_0xd1f3('0xac'),_0x48b18f);if(_0x533f38[_0xd1f3('0xad')]===-0x1){return _0x533f38;}var _0x4aeefe=this['getAndSetVariable'](_0xd1f3('0xae'),_0xd1f3('0xcc'));if(_0x4aeefe['result']===-0x1){return _0x4aeefe;}var _0x2fa188=this[_0xd1f3('0xa0')](_0xd1f3('0xb0'),_0xd1f3('0xcd'));if(_0x2fa188['result']===-0x1){return _0x2fa188;}var _0x107dbc=this['getAndSetVariable'](_0xd1f3('0xb2'),_0xd1f3('0xce'));if(_0x107dbc['result']===-0x1){return _0x107dbc;}return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0xb4'),_0x48b18f));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0xcf')]=function(_0x39f5a8){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x39f5a8[_0xd1f3('0x38')]));if(!this[_0xd1f3('0x81')](_0x39f5a8[_0xd1f3('0xd0')])){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x39f5a8,'no\x20database\x20selected');}var _0x34459e=this[_0xd1f3('0x1b')][_0xd1f3('0x6a')](this,_0x39f5a8[_0xd1f3('0xd0')]);if(!_0x34459e){return this['channel'][_0xd1f3('0x4f')](_0x39f5a8,_0xd1f3('0xd1'));}if(!this['isConfigured'](_0x39f5a8['query'])){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x39f5a8,_0xd1f3('0xd2'));}var _0x2ca724=_0x39f5a8['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xd1f3('0xe')]['noop'](util[_0xd1f3('0x2b')](_0xd1f3('0xd3'),_0x2ca724));var _0x3ed70f=this['getQueryOdbc'][_0xd1f3('0x6a')](this,_0x34459e,_0x2ca724);this[_0xd1f3('0x36')][_0xd1f3('0x6a')](this,_0x39f5a8,_0x2ca724);if(!this[_0xd1f3('0x81')](_0x39f5a8[_0xd1f3('0xd4')])){return this['channel'][_0xd1f3('0xa4')](_0xd1f3('0xd5'));}var _0x56a87e=this[_0xd1f3('0x12')][_0xd1f3('0x6a')](this,_0x39f5a8[_0xd1f3('0xd4')]);if(!_0x56a87e){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x39f5a8,'no\x20variable\x20found');}var _0x4e47df=this;_0x3ed70f['forEach'](function(_0x3aeb1b,_0x5f1c44){Object[_0xd1f3('0xd6')](_0x3aeb1b)[_0xd1f3('0xd7')](function(_0x389a29){_0x4e47df[_0xd1f3('0xe')][_0xd1f3('0x9c')](util[_0xd1f3('0x2b')](_0xd1f3('0xd8'),_0x56a87e,_0x5f1c44,_0x389a29),_0x3aeb1b[_0x389a29]);});});this[_0xd1f3('0xe')][_0xd1f3('0x9c')](util[_0xd1f3('0x2b')](_0xd1f3('0xd9'),_0x56a87e),_0x3ed70f[_0xd1f3('0x9a')]);return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util['format'](_0xd1f3('0xda'),_0x56a87e));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0xdb')]=function(_0x3bf2ed){logger[_0xd1f3('0xdc')](util[_0xd1f3('0x2b')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x3bf2ed[_0xd1f3('0x38')]));if(!this['isConfigured'](_0x3bf2ed[_0xd1f3('0xdd')])){return this['channel']['error'](_0x3bf2ed,_0xd1f3('0xde'));}var _0x406cdd=this[_0xd1f3('0xdf')]['sync'](this,_0x3bf2ed['sip_id']);if(!_0x406cdd){return this[_0xd1f3('0xe')]['error'](_0x3bf2ed,_0xd1f3('0xe0'));}var _0x522d53=this[_0xd1f3('0xe')][_0xd1f3('0x54')]('DIAL',[util[_0xd1f3('0x2b')](_0xd1f3('0xe1'),_0x406cdd),_0x3bf2ed[_0xd1f3('0x62')],_0x3bf2ed[_0xd1f3('0xe2')],_0x3bf2ed[_0xd1f3('0x6c')]]);if(_0x522d53[_0xd1f3('0xad')]===-0x1){return _0x522d53;}return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0xe3'),_0xd1f3('0xe4')));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0xe5')]=function(_0xcb9730){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0xe6'),_0xcb9730[_0xd1f3('0x38')]));if(!this[_0xd1f3('0x81')](_0xcb9730['key'])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')]('no\x20key\x20configured');}if(!this[_0xd1f3('0x81')](_0xcb9730[_0xd1f3('0x59')])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0xa5'));}this['channel'][_0xd1f3('0xe7')]=!![];this[_0xd1f3('0x36')](_0xcb9730);this['createSquareMessage'](_0xcb9730[_0xd1f3('0x59')],'in','','');this[_0xd1f3('0xe')]['noop'](util['format']('Trying\x20Dialogflow:\x20%s',_0xcb9730[_0xd1f3('0x59')]));var _0xd44bb2=this['googleDialogflow'][_0xd1f3('0x6a')](this,_0xcb9730);if(_0xd44bb2){for(var _0x2bb2c4 in _0xd44bb2){if(_0xd44bb2['hasOwnProperty'](_0x2bb2c4)){this[_0xd1f3('0xe')]['setVariable'](util['format'](_0xd1f3('0xe8'),_0x2bb2c4[_0xd1f3('0x65')]()),_0xd44bb2[_0x2bb2c4]);}}this[_0xd1f3('0x40')](_0xd44bb2['speech'],_0xd1f3('0xe9'),_0xd1f3('0xe5'),'');return this['channel'][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0xea'),_0xd44bb2[_0xd1f3('0xeb')]));}return this[_0xd1f3('0xe')]['error'](_0xcb9730,_0xd1f3('0xec'));};AGIVertices[_0xd1f3('0x11')]['dialogflowV2']=function(_0x2c9a4e){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0xed'),_0x2c9a4e[_0xd1f3('0x38')]));if(!this['isConfigured'](_0x2c9a4e['dialogflowV2_project_id'])){return this[_0xd1f3('0xe')]['noop'](_0xd1f3('0xee'));}if(!this[_0xd1f3('0x81')](_0x2c9a4e[_0xd1f3('0x78')])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')]('no\x20client_email\x20configured');}if(!this[_0xd1f3('0x81')](_0x2c9a4e['private_key'])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')]('no\x20private_key\x20configured');}if(!this[_0xd1f3('0x81')](_0x2c9a4e[_0xd1f3('0x7a')])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')]('no\x20anguage\x20configured');}if(!this[_0xd1f3('0x81')](_0x2c9a4e[_0xd1f3('0x59')])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0xa5'));}this[_0xd1f3('0xe')][_0xd1f3('0xe7')]=!![];this[_0xd1f3('0x36')](_0x2c9a4e);this[_0xd1f3('0x40')](_0x2c9a4e[_0xd1f3('0x59')],'in','','');this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0xef'),_0x2c9a4e[_0xd1f3('0x59')]));var _0x16a744=this[_0xd1f3('0x76')][_0xd1f3('0x6a')](this,_0x2c9a4e);if(_0x16a744){for(var _0x3df8d4 in _0x16a744){if(_0x16a744['hasOwnProperty'](_0x3df8d4)){if(_0x3df8d4!=='providerResponse'){this[_0xd1f3('0xe')][_0xd1f3('0x9c')](util[_0xd1f3('0x2b')](_0xd1f3('0xe8'),_0x3df8d4[_0xd1f3('0x65')]()),_0x16a744[_0x3df8d4]);}}}this['createSquareMessage'](_0x16a744[_0xd1f3('0xeb')],_0xd1f3('0xe9'),_0xd1f3('0xf0'),_0x16a744[_0xd1f3('0xf1')]);return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util['format'](_0xd1f3('0xf2'),_0x16a744['speech']));}return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x2c9a4e,'DialogflowV2\x20is\x20unreachable');};AGIVertices['prototype'][_0xd1f3('0xf3')]=function(_0x4a0583){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0xf4'),_0x4a0583[_0xd1f3('0x38')]));if(!this['isConfigured'](_0x4a0583[_0xd1f3('0xf5')])){return this[_0xd1f3('0xe')]['noop']('no\x20ndauth\x20url\x20configured');}if(!this[_0xd1f3('0x81')](_0x4a0583[_0xd1f3('0xf6')])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0xf7'));}if(!this[_0xd1f3('0x81')](_0x4a0583[_0xd1f3('0xf8')])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0xf9'));}if(!this[_0xd1f3('0x81')](_0x4a0583['ndassistant_url'])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0xa5'));}this[_0xd1f3('0xe')]['bot']=!![];this[_0xd1f3('0x36')](_0x4a0583);this[_0xd1f3('0x40')](_0x4a0583['text'],'in','','');this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util['format'](_0xd1f3('0xfa'),_0x4a0583[_0xd1f3('0x59')]));var _0x180ac3=this[_0xd1f3('0x7b')][_0xd1f3('0x6a')](this,_0x4a0583);if(_0x180ac3){for(var _0x33241a in _0x180ac3){if(_0x180ac3[_0xd1f3('0x96')](_0x33241a)){this[_0xd1f3('0xe')][_0xd1f3('0x9c')](util[_0xd1f3('0x2b')]('SESTEK_NDA_%s',_0x33241a[_0xd1f3('0x65')]()),_0x180ac3[_0x33241a]);}}this['createSquareMessage'](_0x180ac3[_0xd1f3('0xeb')],'out',_0xd1f3('0xf3'),'');if(_0x180ac3['audiofile']){this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0xfb'),_0x180ac3['audiofile']));var _0x43ed48=this[_0xd1f3('0xe')][_0xd1f3('0xfc')](_0x180ac3[_0xd1f3('0xfd')]);try{fs[_0xd1f3('0xfe')](_0x180ac3[_0xd1f3('0xfd')]+'.wav');}catch(_0x4a7661){logger['error'](_0x4a7661);}return _0x43ed48;}else{return this[_0xd1f3('0xe')]['noop'](util[_0xd1f3('0x2b')](_0xd1f3('0xff'),_0x180ac3[_0xd1f3('0xeb')]));}}return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x4a0583,_0xd1f3('0x100'));};AGIVertices['prototype'][_0xd1f3('0x101')]=function(_0x105678){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x102'),_0x105678[_0xd1f3('0x38')]));return this['channel'][_0xd1f3('0xa4')](_0xd1f3('0x101'));};AGIVertices['prototype']['ext_dial']=function(_0x403a88){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x103'),_0x403a88['label']));var _0x305142='';if(_0x403a88['trunk_id']){if(!this['isConfigured'](_0x403a88[_0xd1f3('0x104')])){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x403a88,_0xd1f3('0x105'));}else{var _0x763a55=parseInt(_0x403a88[_0xd1f3('0x104')],0xa);if(isNaN(_0x763a55)){_0x305142=_0x403a88['trunk_id'];}else{_0x305142=this[_0xd1f3('0x106')][_0xd1f3('0x6a')](this,_0x403a88['trunk_id']);if(!_0x305142){return this['channel'][_0xd1f3('0x4f')](_0x403a88,_0xd1f3('0x107'));}}}}else if(_0x403a88[_0xd1f3('0x108')]){_0x305142=_0x403a88['trunk_name'];}else{return this[_0xd1f3('0xe')]['error'](_0x403a88,_0xd1f3('0x105'));}var _0xda28a7=this[_0xd1f3('0xe')]['exec'](_0xd1f3('0xe4'),[util[_0xd1f3('0x2b')]('SIP/%s/%s',_0x305142,_0x403a88['phone']),_0x403a88['timeout'],_0x403a88['opts'],_0x403a88[_0xd1f3('0x6c')]]);if(_0xda28a7['result']===-0x1){return _0xda28a7;}return this['channel'][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0xe3'),'DIAL'));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x109')]=function(_0x153f1e){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x10a'),_0x153f1e[_0xd1f3('0x38')]));return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0x109'));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x10b')]=function(_0x157ada){logger['info'](util['format'](_0xd1f3('0x10c'),_0x157ada[_0xd1f3('0x38')]));if(_0x157ada['retry']===0x0){return this[_0xd1f3('0xa1')](_0x157ada);}_0x157ada['retry']-=0x1;if(!this[_0xd1f3('0x81')](_0x157ada['file_id'])){return this['channel'][_0xd1f3('0x4f')](_0x157ada,_0xd1f3('0x10d'));}var _0x318448=this[_0xd1f3('0x20')][_0xd1f3('0x6a')](this,_0x157ada[_0xd1f3('0x10e')]);if(!_0x318448){return this[_0xd1f3('0xe')]['error'](_0x157ada,_0xd1f3('0x10f'));}if(!this[_0xd1f3('0x81')](_0x157ada['variable_id'])){return this['channel'][_0xd1f3('0x4f')](_0xd1f3('0xd5'));}var _0x4d690a=this['channel'][_0xd1f3('0x110')](_0x318448,_0x157ada[_0xd1f3('0x111')],_0x157ada[_0xd1f3('0x112')]);var _0x450d6f=_0x4d690a[_0xd1f3('0xad')]?_0x4d690a[_0xd1f3('0xad')][_0xd1f3('0x113')]():'';logger['info'](_0xd1f3('0x114'),JSON[_0xd1f3('0x6e')](_0x4d690a));if(_0x4d690a[_0xd1f3('0xad')]===-0x1){this[_0xd1f3('0x36')][_0xd1f3('0x6a')](this,_0x157ada,_0x450d6f);return _0x4d690a;}else if(_0x4d690a['extra']==='timeout'){_0x4d690a[_0xd1f3('0xad')]=_0x450d6f['length']>=parseInt(_0x157ada['mindigit'])?'x':'i';}else{_0x4d690a[_0xd1f3('0xad')]=_0x450d6f['length']>=parseInt(_0x157ada[_0xd1f3('0x115')])&&_0x450d6f['length']<=parseInt(_0x157ada[_0xd1f3('0x112')])?'x':'i';}var _0x56dc9b=this[_0xd1f3('0x12')][_0xd1f3('0x6a')](this,_0x157ada[_0xd1f3('0xd4')]);if(!_0x56dc9b){return this[_0xd1f3('0xe')]['error'](_0x157ada,_0xd1f3('0x116'));}this[_0xd1f3('0xe')][_0xd1f3('0x9c')](_0x56dc9b,_0x450d6f);if(this[_0xd1f3('0x81')](_0x157ada['hiddendigitsnum'])){var _0x2453cd=parseInt(_0x157ada[_0xd1f3('0x117')],0xa);var _0x181afa=rs[_0xd1f3('0x118')]({'charset':'*','length':_0x2453cd});var _0x7cd639=_0x450d6f['length'];if(_0x7cd639>0x0){if(_0x7cd639>_0x2453cd){this[_0xd1f3('0x36')][_0xd1f3('0x6a')](this,_0x157ada,_0x157ada[_0xd1f3('0x119')]===_0xd1f3('0x11a')?_0x181afa+_0x450d6f[_0xd1f3('0x11b')](_0x2453cd):_0x450d6f['substr'](0x0,_0x7cd639-_0x2453cd)+_0x181afa);}else{this[_0xd1f3('0x36')][_0xd1f3('0x6a')](this,_0x157ada,rs[_0xd1f3('0x118')]({'charset':'*','length':_0x7cd639}));}}else{this[_0xd1f3('0x36')][_0xd1f3('0x6a')](this,_0x157ada,'');}}else{this[_0xd1f3('0x36')][_0xd1f3('0x6a')](this,_0x157ada,_0x450d6f);}return _0x4d690a;};AGIVertices[_0xd1f3('0x11')]['getsecretdigits']=function(_0x252856){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x11c'),_0x252856[_0xd1f3('0x38')]));return this[_0xd1f3('0x10b')](_0x252856);};AGIVertices['prototype'][_0xd1f3('0x11d')]=function(_0x36396c){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x11e'),_0x36396c[_0xd1f3('0x38')]));this[_0xd1f3('0x36')][_0xd1f3('0x6a')](this,_0x36396c,_0x36396c['goalname']);return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util['format'](_0xd1f3('0x11f'),_0x36396c[_0xd1f3('0x120')]));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x121')]=function(_0x16605f){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x122'),_0x16605f['label']));if(!this[_0xd1f3('0x81')](_0x16605f[_0xd1f3('0x84')])||!this[_0xd1f3('0x81')](_0x16605f[_0xd1f3('0x123')])){return this['channel'][_0xd1f3('0xa4')](_0xd1f3('0x124'));}if(!this[_0xd1f3('0x81')](_0x16605f[_0xd1f3('0x59')])){return this[_0xd1f3('0xe')]['noop'](_0xd1f3('0xa5'));}this[_0xd1f3('0xe')]['noop'](util[_0xd1f3('0x2b')](_0xd1f3('0x125'),_0x16605f[_0xd1f3('0x59')]));var _0x3fe405=this[_0xd1f3('0x83')][_0xd1f3('0x6a')](this,_0x16605f);if(_0x3fe405){this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util['format'](_0xd1f3('0x126'),_0x3fe405));var _0x522858=this[_0xd1f3('0xe')][_0xd1f3('0xfc')](_0x3fe405);try{fs[_0xd1f3('0xfe')](_0x3fe405+_0xd1f3('0x127'));}catch(_0x52da30){logger[_0xd1f3('0x4f')](_0x52da30);}return _0x522858;}return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x16605f,_0xd1f3('0x128'));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x129')]=function(_0x2f9cf5){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x12a'),_0x2f9cf5['label']));if(!this[_0xd1f3('0x81')](_0x2f9cf5[_0xd1f3('0x84')])||!this['isConfigured'](_0x2f9cf5[_0xd1f3('0x123')])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0x124'));}if(!this[_0xd1f3('0x81')](_0x2f9cf5[_0xd1f3('0x8a')])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')]('no\x20bot\x20name\x20configured');}if(!this[_0xd1f3('0x81')](_0x2f9cf5[_0xd1f3('0x59')])){return this['channel'][_0xd1f3('0xa4')]('no\x20text\x20configured');}this[_0xd1f3('0xe')]['bot']=!![];this['createSquareDetailsReport'](_0x2f9cf5);this[_0xd1f3('0x40')](_0x2f9cf5[_0xd1f3('0x59')],'in','','');this['channel'][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0x12b'),_0x2f9cf5['text']));var _0x242b8e=this[_0xd1f3('0x88')][_0xd1f3('0x6a')](this,_0x2f9cf5);if(_0x242b8e){for(var _0x22c251 in _0x242b8e){if(_0x242b8e[_0xd1f3('0x96')](_0x22c251)&&_[_0xd1f3('0x92')](_0x242b8e[_0x22c251])){this['channel']['setVariable'](util[_0xd1f3('0x2b')]('AWS_LEX_%s',_0x22c251['toUpperCase']()),_0x242b8e[_0x22c251]);}}if(_['isNil'](_0x242b8e[_0xd1f3('0x71')])){return this['channel'][_0xd1f3('0xa4')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x242b8e[_0xd1f3('0x71')],_0xd1f3('0xe9'),_0xd1f3('0x12c'),'');return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0x12d'),_0x242b8e[_0xd1f3('0x71')]));}}return this[_0xd1f3('0xe')]['error'](_0x2f9cf5,_0xd1f3('0x12e'));};AGIVertices[_0xd1f3('0x11')]['googleasr']=function(_0x542184){logger['info'](util[_0xd1f3('0x2b')](_0xd1f3('0x12f'),_0x542184[_0xd1f3('0x38')],_0x542184[_0xd1f3('0x62')]));if(!this[_0xd1f3('0x81')](_0x542184['key'])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0x130'));}var _0xf0013c='wav';var _0x12c4ec=util['format'](_0xd1f3('0x131'),FILES_PATH,rs[_0xd1f3('0x118')](0x4));var _0x362c2d=util[_0xd1f3('0x2b')]('%s.%s',_0x12c4ec,_0xf0013c);var _0x4cc913=!![];if(_0x542184[_0xd1f3('0x132')]==='NOBEEP'){_0x4cc913=![];}var _0x158b8c=this[_0xd1f3('0xe')][_0xd1f3('0x133')](_0x12c4ec,_0xf0013c,_0x542184[_0xd1f3('0x134')],_0x542184['timeout'],undefined,_0x4cc913);if(_0x158b8c['result']!==-0x1){this['channel']['noop'](util['format'](_0xd1f3('0x135'),_0x362c2d));var _0x5697a9=this[_0xd1f3('0x8b')][_0xd1f3('0x6a')](this,_0x542184,_0x362c2d);if(_0x5697a9){for(var _0xbfa1b8 in _0x5697a9){if(_0x5697a9[_0xd1f3('0x96')](_0xbfa1b8)){this['channel'][_0xd1f3('0x9c')](util['format'](_0xd1f3('0x136'),_0xbfa1b8[_0xd1f3('0x65')]()),_0x5697a9[_0xbfa1b8]);}}return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util['format'](_0xd1f3('0x137'),JSON[_0xd1f3('0x6e')](_0x5697a9)));}}return _0x158b8c;};AGIVertices['prototype'][_0xd1f3('0x138')]=function(_0x4bc0d7){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x139'),_0x4bc0d7[_0xd1f3('0x38')]));if(!this[_0xd1f3('0x81')](_0x4bc0d7['appid'])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0x13a'));}if(!this[_0xd1f3('0x81')](_0x4bc0d7['appsecret'])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0x13b'));}var _0x27f2cd='wav';var _0x3fd840=util['format'](_0xd1f3('0x131'),FILES_PATH,rs['generate'](0x4));var _0x313d82=util[_0xd1f3('0x2b')](_0xd1f3('0x9b'),_0x3fd840,_0x27f2cd);var _0x50b5dd=!![];if(_0x4bc0d7['beep']==='NOBEEP'){_0x50b5dd=![];}var _0x3beec9=this['channel']['recordFile'](_0x3fd840,_0x27f2cd,_0x4bc0d7[_0xd1f3('0x134')],_0x4bc0d7['timeout'],undefined,_0x50b5dd);if(_0x3beec9[_0xd1f3('0xad')]!==-0x1){this[_0xd1f3('0xe')]['noop'](util[_0xd1f3('0x2b')](_0xd1f3('0x13c'),_0x313d82));var _0x3318b9=this['tildeASR'][_0xd1f3('0x6a')](this,_0x4bc0d7,_0x313d82);if(_0x3318b9){for(var _0x20cf63 in _0x3318b9){if(_0x3318b9['hasOwnProperty'](_0x20cf63)){this['channel']['setVariable'](util[_0xd1f3('0x2b')](_0xd1f3('0x13d'),_0x20cf63[_0xd1f3('0x65')]()),_0x3318b9[_0x20cf63]);}}return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0x13e'),JSON[_0xd1f3('0x6e')](_0x3318b9)));}}return _0x3beec9;};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x13f')]=function(_0x7f9f4e){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x140'),_0x7f9f4e[_0xd1f3('0x38')]));return this['channel'][_0xd1f3('0x141')](_0x7f9f4e['context'],_0x7f9f4e[_0xd1f3('0x142')],_0x7f9f4e[_0xd1f3('0x143')]);};AGIVertices['prototype'][_0xd1f3('0x144')]=function(_0x2ac6d9){logger[_0xd1f3('0x30')](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x2ac6d9[_0xd1f3('0x38')]));if(!this[_0xd1f3('0x81')](_0x2ac6d9[_0xd1f3('0x145')])){return this[_0xd1f3('0xe')]['error'](_0x2ac6d9,_0xd1f3('0x146'));}try{var _0x2f4651=eval(_0x2ac6d9[_0xd1f3('0x145')])?_0xd1f3('0x147'):_0xd1f3('0x148');this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')]('EVAL\x20CONDITION\x20%s\x20%s',_0x2ac6d9[_0xd1f3('0x145')],_0x2f4651));return{'code':0xc8,'result':_0x2f4651};}catch(_0x36b862){return{'code':0xc8,'result':_0xd1f3('0x148')};}};AGIVertices[_0xd1f3('0x11')]['gotoiftime']=function(_0x676d05){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x149'),_0x676d05[_0xd1f3('0x38')]));if(!this['isConfigured'](_0x676d05[_0xd1f3('0x14a')])){return this['channel']['error'](_0x676d05,_0xd1f3('0x14b'));}var _0x26159f=this[_0xd1f3('0x24')][_0xd1f3('0x6a')](this,_0x676d05[_0xd1f3('0x14a')]);if(!_0x26159f){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x676d05,_0xd1f3('0x14c'));}for(var _0x10b421=0x0;_0x10b421<_0x26159f[_0xd1f3('0x9a')];_0x10b421+=0x1){var _0x3ee07d=this[_0xd1f3('0xe')][_0xd1f3('0x12')](util[_0xd1f3('0x2b')](_0xd1f3('0x14d'),_0x26159f[_0x10b421]));if(_0x3ee07d[_0xd1f3('0xad')]===-0x1){return _0x3ee07d;}logger['info'](util[_0xd1f3('0x2b')](_0xd1f3('0x14e'),_0x26159f[_0x10b421],_0x3ee07d[_0xd1f3('0x9f')]));if(_0x3ee07d[_0xd1f3('0x9f')]===_0xd1f3('0x147')){logger[_0xd1f3('0x30')](util['format'](_0xd1f3('0x14e'),_0x26159f[_0x10b421],_0xd1f3('0x147')));this[_0xd1f3('0xe')]['noop'](util[_0xd1f3('0x2b')]('IFTIME\x20%s\x20%s',_0x26159f[_0x10b421],'true'));return{'code':0xc8,'result':_0xd1f3('0x147')};}else{logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x14e'),_0x26159f[_0x10b421],_0xd1f3('0x148')));this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0x14e'),_0x26159f[_0x10b421],_0xd1f3('0x148')));}}return{'code':0xc8,'result':_0xd1f3('0x148')};};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x14f')]=function(_0x5e6175){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x5e6175['label']));return this[_0xd1f3('0xe')][_0xd1f3('0x14f')]();};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x150')]=function(_0x4915e2){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x4915e2[_0xd1f3('0x38')]));if(!this[_0xd1f3('0x81')](_0x4915e2[_0xd1f3('0x74')])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')]('no\x20key\x20configured');}var _0x48f39b='wav';var _0x28a161=util['format']('%s/recordings/%s',FILES_PATH,rs[_0xd1f3('0x118')](0x4));var _0x4fd197=util['format']('%s.%s',_0x28a161,_0x48f39b);var _0x1d7ae8=!![];if(_0x4915e2['beep']===_0xd1f3('0x151')){_0x1d7ae8=![];}var _0xfa3f6e=this['channel'][_0xd1f3('0x133')](_0x28a161,_0x48f39b,_0x4915e2['intKey'],_0x4915e2[_0xd1f3('0x62')],undefined,_0x1d7ae8);if(_0xfa3f6e[_0xd1f3('0xad')]!==-0x1){this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0x152'),_0x4fd197));var _0x1dbb06=this[_0xd1f3('0x7f')][_0xd1f3('0x6a')](this,_0x4915e2,_0x4fd197);if(_0x1dbb06){for(var _0x97618b in _0x1dbb06){if(_0x1dbb06['hasOwnProperty'](_0x97618b)){this[_0xd1f3('0xe')][_0xd1f3('0x9c')](util['format'](_0xd1f3('0x153'),_0x97618b[_0xd1f3('0x65')]()),_0x1dbb06[_0x97618b]);}}return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')]('IspeechASR\x20Result\x20%s',JSON[_0xd1f3('0x6e')](_0x1dbb06)));}}return _0xfa3f6e;};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x154')]=function(_0x36907e){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x155'),_0x36907e[_0xd1f3('0x38')]));if(!this[_0xd1f3('0x81')](_0x36907e[_0xd1f3('0x74')])){return this['channel'][_0xd1f3('0xa4')]('no\x20key\x20configured');}if(!this[_0xd1f3('0x81')](_0x36907e[_0xd1f3('0x59')])){return this[_0xd1f3('0xe')]['noop'](_0xd1f3('0xa5'));}this[_0xd1f3('0xe')]['noop'](util[_0xd1f3('0x2b')](_0xd1f3('0x156'),_0x36907e['text']));var _0x1fdf92=this['ispeechTTS'][_0xd1f3('0x6a')](this,_0x36907e);if(_0x1fdf92){this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0x152'),_0x1fdf92));var _0x8d9412=this['channel'][_0xd1f3('0xfc')](_0x1fdf92,_0x36907e['intKey']);try{fs[_0xd1f3('0xfe')](_0x1fdf92+_0xd1f3('0x127'));}catch(_0x41d440){logger[_0xd1f3('0x4f')](_0x41d440);}return _0x8d9412;}return this[_0xd1f3('0xe')]['error'](_0x36907e,_0xd1f3('0x157'));};AGIVertices['prototype'][_0xd1f3('0x158')]=function(_0x529a4a){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x159'),_0x529a4a[_0xd1f3('0x38')]));if(!this[_0xd1f3('0x81')](_0x529a4a[_0xd1f3('0x15a')])){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x529a4a,_0xd1f3('0x15b'));}logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x15c'),this[_0xd1f3('0xe')][_0xd1f3('0x3b')],_0x529a4a['findBy']));var _0x30ad80=this[_0xd1f3('0x52')]['sync'](this,_0x529a4a['findBy']);if(_0x30ad80){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x15d'),this['channel'][_0xd1f3('0x3b')],_0x529a4a[_0xd1f3('0x15a')]));this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util['format'](_0xd1f3('0x15d'),this['channel'][_0xd1f3('0x3b')],_0x529a4a[_0xd1f3('0x15a')]));return{'code':0xc8,'result':_0xd1f3('0x15e')};}else{logger['info'](util['format'](_0xd1f3('0x15f'),this['channel']['callerid'],_0x529a4a[_0xd1f3('0x15a')]));this['channel'][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0x15f'),this[_0xd1f3('0xe')]['callerid'],_0x529a4a['findBy']));return{'code':0xc8,'result':_0xd1f3('0x160')};}};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x161')]=function(_0x421578){logger[_0xd1f3('0x30')](util['format'](_0xd1f3('0x162'),_0x421578['label']));if(!this['isConfigured'](_0x421578['findBy'])){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x421578,_0xd1f3('0x15b'));}logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x15c'),this['channel'][_0xd1f3('0x3b')],_0x421578[_0xd1f3('0x15a')]));var _0x3c8067=this['agentLogout']['sync'](this,_0x421578['findBy']);if(_0x3c8067){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x15d'),this[_0xd1f3('0xe')][_0xd1f3('0x3b')],_0x421578['findBy']));this[_0xd1f3('0xe')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xd1f3('0xe')][_0xd1f3('0x3b')],_0x421578[_0xd1f3('0x15a')]));return{'code':0xc8,'result':_0xd1f3('0x15e')};}else{logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x15f'),this['channel'][_0xd1f3('0x3b')],_0x421578['findBy']));this['channel'][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd1f3('0xe')]['callerid'],_0x421578['findBy']));return{'code':0xc8,'result':_0xd1f3('0x160')};}};AGIVertices['prototype'][_0xd1f3('0x163')]=function(_0x4daf65){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x164'),_0x4daf65[_0xd1f3('0x38')]));if(!this[_0xd1f3('0x81')](_0x4daf65[_0xd1f3('0x165')])){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x4daf65,_0xd1f3('0x166'));}this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0x167'),_0x4daf65['operation']));var _0x2c2acd=eval(_0x4daf65[_0xd1f3('0x165')]);if(!this[_0xd1f3('0x81')](_0x4daf65[_0xd1f3('0xd4')])){return this['channel'][_0xd1f3('0xa4')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x25215b=this[_0xd1f3('0x12')][_0xd1f3('0x6a')](this,_0x4daf65[_0xd1f3('0xd4')]);if(!_0x25215b){return this['channel']['error'](_0x4daf65,_0xd1f3('0x116'));}if(_[_0xd1f3('0x98')](_0x2c2acd)){var _0x9b8358=this;_0x2c2acd[_0xd1f3('0xd7')](function(_0x4f749c,_0x12f68b){_0x9b8358[_0xd1f3('0xe')][_0xd1f3('0x9c')](util['format'](_0xd1f3('0x168'),_0x25215b,_0x12f68b),_0x4f749c);});return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0x169'),_0x25215b));}else{return this['channel'][_0xd1f3('0x9c')](_0x25215b,_0x2c2acd);}};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x16a')]=function(_0x4cbdf1){logger['info'](util[_0xd1f3('0x2b')](_0xd1f3('0x16b'),_0x4cbdf1[_0xd1f3('0x38')]));if(_0x4cbdf1[_0xd1f3('0xa2')]===0x0){return this['maxRetry'](_0x4cbdf1);}_0x4cbdf1[_0xd1f3('0xa2')]-=0x1;if(!this[_0xd1f3('0x81')](_0x4cbdf1[_0xd1f3('0x10e')])){return this[_0xd1f3('0xe')]['error'](_0x4cbdf1,_0xd1f3('0x10d'));}var _0x22df05=this['getSound'][_0xd1f3('0x6a')](this,_0x4cbdf1[_0xd1f3('0x10e')]);if(!_0x22df05){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x4cbdf1,_0xd1f3('0x10f'));}var _0x2da23c=this[_0xd1f3('0xe')]['getData'](_0x22df05,_0x4cbdf1[_0xd1f3('0x111')],_0x4cbdf1['digit']);var _0x63c7e9=_0x2da23c[_0xd1f3('0xad')];if(_0x2da23c[_0xd1f3('0xad')]===-0x1){this[_0xd1f3('0x36')]['sync'](this,_0x4cbdf1,'-1');return _0x2da23c;}else if(_0x2da23c[_0xd1f3('0x9f')]===_0xd1f3('0x62')){_0x2da23c[_0xd1f3('0xad')]=_0x2da23c[_0xd1f3('0xad')][_0xd1f3('0x9a')]>0x0?_0x2da23c[_0xd1f3('0xad')]:'t';}else if(_[_0xd1f3('0x42')](_0x2da23c[_0xd1f3('0xad')])){_0x2da23c[_0xd1f3('0xad')]='#';_0x63c7e9='#';}if(!this[_0xd1f3('0x81')](_0x4cbdf1[_0xd1f3('0xd4')])){this['channel']['noop'](_0xd1f3('0xd5'));}else{var _0x1c076d=this[_0xd1f3('0x12')]['sync'](this,_0x4cbdf1[_0xd1f3('0xd4')]);if(!_0x1c076d){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x4cbdf1,_0xd1f3('0x116'));}this['channel'][_0xd1f3('0x9c')](_0x1c076d,_0x63c7e9);}this[_0xd1f3('0x36')]['sync'](this,_0x4cbdf1,_0x63c7e9);return _0x2da23c;};AGIVertices[_0xd1f3('0x11')]['noop']=function(_0xd96a5f){logger['info'](util[_0xd1f3('0x2b')](_0xd1f3('0x16c'),_0xd96a5f[_0xd1f3('0x38')]));return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd96a5f[_0xd1f3('0x16d')]||_0xd96a5f[_0xd1f3('0x38')]);};AGIVertices['prototype']['pause']=function(_0x362c23){logger['info'](util[_0xd1f3('0x2b')](_0xd1f3('0x16e'),_0x362c23[_0xd1f3('0x38')]));if(!this[_0xd1f3('0x81')](_0x362c23[_0xd1f3('0x15a')])){return this[_0xd1f3('0xe')]['error'](_0x362c23,_0xd1f3('0x15b'));}logger[_0xd1f3('0x30')](util['format'](_0xd1f3('0x15c'),this[_0xd1f3('0xe')][_0xd1f3('0x3b')],_0x362c23[_0xd1f3('0x15a')]));var _0x1f8223=this[_0xd1f3('0x16f')][_0xd1f3('0x6a')](this,_0x362c23[_0xd1f3('0x170')]);var _0x3787c2=this[_0xd1f3('0x4d')]['sync'](this,_0x362c23[_0xd1f3('0x15a')],_0x1f8223);if(_0x3787c2){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd1f3('0xe')][_0xd1f3('0x3b')],_0x362c23[_0xd1f3('0x15a')]));this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util['format'](_0xd1f3('0x15d'),this[_0xd1f3('0xe')][_0xd1f3('0x3b')],_0x362c23[_0xd1f3('0x15a')]));return{'code':0xc8,'result':_0xd1f3('0x15e')};}else{logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x15f'),this[_0xd1f3('0xe')][_0xd1f3('0x3b')],_0x362c23[_0xd1f3('0x15a')]));this['channel']['noop'](util[_0xd1f3('0x2b')](_0xd1f3('0x15d'),this[_0xd1f3('0xe')][_0xd1f3('0x3b')],_0x362c23['findBy']));return{'code':0xc8,'result':_0xd1f3('0x160')};}};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x171')]=function(_0x1f5c41){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x172'),_0x1f5c41['label']));if(!this[_0xd1f3('0x81')](_0x1f5c41[_0xd1f3('0x10e')])){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x1f5c41,'no\x20file\x20audio\x20selected');}var _0x8ba774=this[_0xd1f3('0x20')]['sync'](this,_0x1f5c41[_0xd1f3('0x10e')]);if(!_0x8ba774){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x1f5c41,_0xd1f3('0x10f'));}var _0x49bcef=this['channel'][_0xd1f3('0x54')]('PLAYBACK',[_0x8ba774,_0x1f5c41['opts']]);if(_0x49bcef[_0xd1f3('0xad')]===-0x1){return _0x49bcef;}return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util['format']('Executed\x20command\x20%s\x20%s',_0xd1f3('0x173'),_0x8ba774));};AGIVertices['prototype']['queue']=function(_0x5d8c42){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x174'),_0x5d8c42['label']));if(!this[_0xd1f3('0x81')](_0x5d8c42[_0xd1f3('0x175')])){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x5d8c42,_0xd1f3('0x176'));}var _0x254406='';var _0x4f2a00=parseInt(_0x5d8c42['queue_id'],0xa);if(isNaN(_0x4f2a00)){_0x254406=_0x5d8c42[_0xd1f3('0x175')];}else{_0x254406=this[_0xd1f3('0x17')][_0xd1f3('0x6a')](this,_0x5d8c42[_0xd1f3('0x175')]);if(!_0x254406){return this[_0xd1f3('0xe')]['error'](_0x5d8c42,_0xd1f3('0x177'));}}var _0x243828='';if(this[_0xd1f3('0x81')](_0x5d8c42[_0xd1f3('0x10e')])){var _0x25cd2f=this['getSound'][_0xd1f3('0x6a')](this,_0x5d8c42[_0xd1f3('0x10e')]);if(_0x25cd2f){_0x243828=_0x25cd2f;}}this['createSquareDetailsReport']['sync'](this,_0x5d8c42,_0x254406);if(_0x5d8c42[_0xd1f3('0xe2')][_0xd1f3('0x178')]('x')<0x0){_0x5d8c42[_0xd1f3('0xe2')]+='x';}if(_0x5d8c42[_0xd1f3('0xe2')]['indexOf']('X')<0x0){_0x5d8c42[_0xd1f3('0xe2')]+='X';}this[_0xd1f3('0xe')]['setVariable'](_0xd1f3('0x179'),_0x254406?_0x254406[_0xd1f3('0x17a')]():'');var _0x193ef7=this[_0xd1f3('0xe')][_0xd1f3('0x54')]('QUEUE',[_0x254406,_0x5d8c42[_0xd1f3('0xe2')],_0x5d8c42['url'],_0x243828,_0x5d8c42[_0xd1f3('0x62')],_0x5d8c42[_0xd1f3('0x8')],_0x5d8c42[_0xd1f3('0x17b')],_0x5d8c42[_0xd1f3('0x17c')],'',_0x5d8c42[_0xd1f3('0x17d')]]);if(_0x193ef7[_0xd1f3('0xad')]===-0x1){return _0x193ef7;}return this['channel'][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0xc4'),_0xd1f3('0x17e'),_0x254406));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x17f')]=function(_0x1d7870){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x180'),_0x1d7870[_0xd1f3('0x38')]));var _0x7104e3=_0x1d7870[_0xd1f3('0x181')]||'wav';var _0x4bf379=util[_0xd1f3('0x2b')](_0xd1f3('0x182'),this[_0xd1f3('0xe')][_0xd1f3('0x37')],rs[_0xd1f3('0x118')](0x5));var _0x1df83b=util[_0xd1f3('0x2b')]('%s/recordings/%s.%s',FILES_PATH,_0x4bf379,_0x7104e3);var _0x3940d0=util[_0xd1f3('0x2b')](_0xd1f3('0x131'),FILES_PATH,_0x4bf379);this[_0xd1f3('0x3c')][_0xd1f3('0x6a')](this,_0x1d7870,_0x4bf379,_0x1df83b);this[_0xd1f3('0xe')][_0xd1f3('0x9c')]('RECORDING_SAVENAME',_0x4bf379);logger['info'](_0xd1f3('0x183'),_0x3940d0,_0x7104e3,_0x1d7870[_0xd1f3('0x184')],_0x1d7870['timeout']);return this[_0xd1f3('0xe')][_0xd1f3('0x133')](_0x3940d0,_0x7104e3,_0x1d7870[_0xd1f3('0x184')],_0x1d7870[_0xd1f3('0x62')],undefined,!![]);};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x185')]=function(_0xd67480){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x186'),_0xd67480[_0xd1f3('0x38')]));if(!this[_0xd1f3('0x81')](_0xd67480[_0xd1f3('0x6c')])){return this[_0xd1f3('0xe')]['noop'](_0xd1f3('0x187'));}var _0xf11bcb=this[_0xd1f3('0x60')][_0xd1f3('0x6a')](this,_0xd67480);logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x188'),util[_0xd1f3('0x189')](_0xf11bcb,{'showHidden':![],'depth':null})));if(!this[_0xd1f3('0x81')](_0xd67480[_0xd1f3('0xd4')])){return this[_0xd1f3('0xe')]['noop']('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x5d3ebc=this[_0xd1f3('0x12')][_0xd1f3('0x6a')](this,_0xd67480[_0xd1f3('0xd4')]);if(!_0x5d3ebc){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0xd67480,'no\x20variable\x20found');}this[_0xd1f3('0xe')][_0xd1f3('0x9c')](util[_0xd1f3('0x2b')](_0xd1f3('0x18a'),_0x5d3ebc),_0xf11bcb[_0xd1f3('0x6f')]?_0xf11bcb[_0xd1f3('0x6f')]:_0xd1f3('0x18b'));this[_0xd1f3('0xe')][_0xd1f3('0x9c')](util['format'](_0xd1f3('0x18c'),_0x5d3ebc),_0xf11bcb[_0xd1f3('0x70')]?_0xf11bcb[_0xd1f3('0x70')]:'OK');if(_0xf11bcb['body']){try{this[_0xd1f3('0x99')](_0xf11bcb[_0xd1f3('0x66')],_0x5d3ebc);}catch(_0x37b822){logger[_0xd1f3('0x4f')](util['format'](_0xd1f3('0x18d'),_0x5d3ebc));}}return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0xda'),_0x5d3ebc));};AGIVertices[_0xd1f3('0x11')]['saydigits']=function(_0x5201cd){logger['info'](util['format'](_0xd1f3('0x18e'),_0x5201cd[_0xd1f3('0x38')]));return this[_0xd1f3('0xe')][_0xd1f3('0x18f')](_0x5201cd['digits'][_0xd1f3('0x190')](/\s+/g,''),_0x5201cd['escape_digits']);};AGIVertices['prototype']['saynumber']=function(_0xc05339){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0xc05339[_0xd1f3('0x38')]));return this[_0xd1f3('0xe')][_0xd1f3('0x191')](_0xc05339[_0xd1f3('0x63')][_0xd1f3('0x190')](/\s+/g,''),_0xc05339[_0xd1f3('0x184')]);};AGIVertices['prototype'][_0xd1f3('0x192')]=function(_0x3a515e){logger[_0xd1f3('0x30')](util['format'](_0xd1f3('0x193'),_0x3a515e[_0xd1f3('0x38')]));return this[_0xd1f3('0xe')][_0xd1f3('0x194')](_0x3a515e[_0xd1f3('0x59')],_0x3a515e[_0xd1f3('0x184')]);};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x195')]=function(_0x4aed67){logger['info'](util[_0xd1f3('0x2b')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x4aed67[_0xd1f3('0x38')]));if(!this[_0xd1f3('0x81')](_0x4aed67[_0xd1f3('0x196')])){return this[_0xd1f3('0xe')]['noop'](_0xd1f3('0x197'));}var _0xfa3630=this[_0xd1f3('0x198')][_0xd1f3('0x6a')](this,_0x4aed67[_0xd1f3('0x196')]);if(!_0xfa3630||!_0xfa3630[_0xd1f3('0x199')]){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x4aed67,_0xd1f3('0x19a'));}var _0x3f83ab={'from':util[_0xd1f3('0x2b')](_0xd1f3('0x19b'),_0xfa3630['name'],_0xfa3630[_0xd1f3('0x19c')]||_0xfa3630['Smtp']['user']),'to':_0x4aed67['to']||'','cc':_0x4aed67['cc']||'','bcc':_0x4aed67[_0xd1f3('0x19d')]||'','subject':_0x4aed67['subject'],'html':_0x4aed67[_0xd1f3('0x59')],'text':_0x4aed67[_0xd1f3('0x59')]};var _0x1daf77={'tls':{'rejectUnauthorized':![]}};if(_0xfa3630[_0xd1f3('0x199')][_0xd1f3('0x19e')]){_0x1daf77['service']=_0xfa3630[_0xd1f3('0x199')][_0xd1f3('0x19e')];}else{_0x1daf77[_0xd1f3('0x19f')]=_0xfa3630[_0xd1f3('0x199')][_0xd1f3('0x19f')];_0x1daf77[_0xd1f3('0x1a0')]=_0xfa3630[_0xd1f3('0x199')][_0xd1f3('0x1a0')];_0x1daf77[_0xd1f3('0x1a1')]=_0xfa3630[_0xd1f3('0x199')]['secure'];}if(_0xfa3630[_0xd1f3('0x199')][_0xd1f3('0x1a2')]){_0x1daf77[_0xd1f3('0x1a3')]={'user':_0xfa3630['Smtp']['user'],'pass':_0xfa3630['Smtp'][_0xd1f3('0x1a4')]};}if(this[_0xd1f3('0x81')](_0x4aed67[_0xd1f3('0x1a5')])){}logger['debug'](_0xd1f3('0x1a6'),JSON[_0xd1f3('0x6e')](_0x3f83ab));this[_0xd1f3('0x36')]['sync'](this,_0x4aed67,_0x4aed67[_0xd1f3('0x196')]);this['channel'][_0xd1f3('0xa4')](util['format'](_0xd1f3('0x1a7'),_0xfa3630[_0xd1f3('0x15')]));this[_0xd1f3('0x23')][_0xd1f3('0x6a')](this,_0x1daf77,_0x3f83ab);return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0x1a8'));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x1a9')]=function(_0xe67050){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0xe67050[_0xd1f3('0x38')]));return this[_0xd1f3('0xe')]['noop'](_0xd1f3('0x1aa'));};AGIVertices['prototype'][_0xd1f3('0x1ab')]=function(_0x4c544a){logger['info'](util['format'](_0xd1f3('0x1ac'),_0x4c544a[_0xd1f3('0x38')]));if(!this['isConfigured'](_0x4c544a['sms_account_id'])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0x1ad'));}var _0xe91cee=this['getSmsAccount'][_0xd1f3('0x6a')](this,_0x4c544a['sms_account_id']);if(!_0xe91cee){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x4c544a,'no\x20sms\x20account\x20found');}var _0x502006={'body':_0x4c544a[_0xd1f3('0x1ae')],'phone':_0x4c544a['to']||'','SmsAccountId':_0xe91cee['id']};logger[_0xd1f3('0xdc')](_0xd1f3('0x1af'),JSON[_0xd1f3('0x6e')](_0x502006));this[_0xd1f3('0x36')]['sync'](this,_0x4c544a,_0x4c544a['sms_account_id']);this['channel']['noop'](util[_0xd1f3('0x2b')](_0xd1f3('0x1b0'),_0xe91cee[_0xd1f3('0x15')]));this[_0xd1f3('0x35')][_0xd1f3('0x6a')](this,_0x502006);return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0x1b1'));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x1b2')]=function(_0x39adf0){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x1b3'),_0x39adf0['label']));if(!this[_0xd1f3('0x81')](_0x39adf0[_0xd1f3('0xd4')])){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x39adf0,'no\x20variable\x20selected');}var _0x436b28=this['getVariable'][_0xd1f3('0x6a')](this,_0x39adf0[_0xd1f3('0xd4')]);if(!_0x436b28){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x39adf0,_0xd1f3('0x116'));}return this[_0xd1f3('0xe')][_0xd1f3('0x9c')](_0x436b28,_0x39adf0[_0xd1f3('0x1b4')]);};AGIVertices['prototype'][_0xd1f3('0x1b5')]=function(_0x1cbb85){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x1b6'),_0x1cbb85[_0xd1f3('0x38')]));this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0x1b7'));if(_0x1cbb85['answer']===_0xd1f3('0x1b8')){this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0x1b9'));return this['channel'][_0xd1f3('0xb8')]();}return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0x1ba'));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x1bb')]=function(_0x2429e9){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x2429e9['label']));if(!this[_0xd1f3('0x81')](_0x2429e9[_0xd1f3('0x1bc')])){return this['channel'][_0xd1f3('0x4f')](_0x2429e9,_0xd1f3('0x1bd'));}var _0x2da418=this[_0xd1f3('0x19')][_0xd1f3('0x6a')](this,_0x2429e9[_0xd1f3('0x1bc')]);if(!this[_0xd1f3('0x81')](_0x2da418)){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x2429e9,util[_0xd1f3('0x2b')](_0xd1f3('0x1be'),_0x2429e9[_0xd1f3('0x1bc')]));}if(_0x2da418===this[_0xd1f3('0xe')]['arg_1']){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x2429e9,_0xd1f3('0x1bf'));}this[_0xd1f3('0x36')][_0xd1f3('0x6a')](this,_0x2429e9,_0x2da418);var _0x4ec66a=this[_0xd1f3('0xe')][_0xd1f3('0x54')](_0xd1f3('0x1c0'),util[_0xd1f3('0x2b')](_0xd1f3('0x1c1'),config['agi'][_0xd1f3('0x19f')]||'127.0.0.1',_0x2da418,this[_0xd1f3('0xe')][_0xd1f3('0x3a')]));if(_0x4ec66a['result']===-0x1){return _0x4ec66a;}return this[_0xd1f3('0xe')]['noop'](util[_0xd1f3('0x2b')]('Executed\x20command\x20%s\x20%s',_0xd1f3('0x1c0'),_0x2da418));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x1c2')]=function(_0x20e3be){logger[_0xd1f3('0x30')](util['format'](_0xd1f3('0x1c3'),_0x20e3be[_0xd1f3('0x38')]));var _0x4f44d2=this[_0xd1f3('0x53')][_0xd1f3('0x6a')](this,_0x20e3be[_0xd1f3('0xb6')]);this[_0xd1f3('0x36')][_0xd1f3('0x6a')](this,_0x20e3be,_0x20e3be['command']);if(this[_0xd1f3('0x81')](_0x20e3be[_0xd1f3('0xd4')])){var _0x60c944=this[_0xd1f3('0x12')]['sync'](this,_0x20e3be['variable_id']);if(_0x60c944){this['channel'][_0xd1f3('0x9c')](_0x60c944,_0x4f44d2);return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0x1c4'),_0x20e3be[_0xd1f3('0xb6')],_0x60c944));}}return this[_0xd1f3('0xe')]['noop'](util[_0xd1f3('0x2b')](_0xd1f3('0x1c5'),_0x20e3be[_0xd1f3('0xb6')]));};AGIVertices[_0xd1f3('0x11')]['google_cloud_tts']=function(_0x4b470b){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x1c6'),_0x4b470b[_0xd1f3('0x38')]));_0x4b470b['text']=_0x4b470b[_0xd1f3('0x59')][_0xd1f3('0x190')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd1f3('0x81')](_0x4b470b[_0xd1f3('0x57')])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0x1c7'));}if(!this['isConfigured'](_0x4b470b[_0xd1f3('0x59')])){return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](_0xd1f3('0xa5'));}this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0x1c8'),_0x4b470b[_0xd1f3('0x59')]));var _0x132491=this[_0xd1f3('0x56')][_0xd1f3('0x6a')](this,_0x4b470b);if(_0x132491){this[_0xd1f3('0xe')]['noop'](util[_0xd1f3('0x2b')](_0xd1f3('0x1c9'),_0x132491));var _0xb91887=this['channel'][_0xd1f3('0xfc')](_0x132491);try{fs['unlink'](_0x132491+_0xd1f3('0x127'));}catch(_0x3ce5d5){logger[_0xd1f3('0x4f')](_0x3ce5d5);}return _0xb91887;}return this[_0xd1f3('0xe')]['error'](_0x4b470b,_0xd1f3('0x1ca'));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x1cb')]=function(_0xffe113){logger['info'](util['format'](_0xd1f3('0x1cc'),_0xffe113[_0xd1f3('0x38')]));_0xffe113[_0xd1f3('0x59')]=_0xffe113[_0xd1f3('0x59')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd1f3('0x81')](_0xffe113[_0xd1f3('0x59')])){return this['channel'][_0xd1f3('0xa4')](_0xd1f3('0xa5'));}this['channel']['noop'](util[_0xd1f3('0x2b')](_0xd1f3('0x1cd'),_0xffe113['text']));var _0x471c82=this[_0xd1f3('0x5e')]['sync'](this,_0xffe113);if(_0x471c82){this['channel']['noop'](util[_0xd1f3('0x2b')](_0xd1f3('0x1ce'),_0x471c82));var _0x1bc15a=this[_0xd1f3('0xe')][_0xd1f3('0xfc')](_0x471c82);try{fs[_0xd1f3('0xfe')](_0x471c82+_0xd1f3('0x127'));}catch(_0x4222db){logger[_0xd1f3('0x4f')](_0x4222db);}return _0x1bc15a;}return this['channel'][_0xd1f3('0x4f')](_0xffe113,_0xd1f3('0x1cf'));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x1d0')]=function(_0x43542f){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x1d1'),_0x43542f[_0xd1f3('0x38')]));if(!this['isConfigured'](_0x43542f[_0xd1f3('0x15a')])){return this[_0xd1f3('0xe')]['error'](_0x43542f,'no\x20find\x20by\x20configured');}logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xd1f3('0xe')][_0xd1f3('0x3b')],_0x43542f[_0xd1f3('0x15a')]));var _0x131475=this[_0xd1f3('0x50')][_0xd1f3('0x6a')](this,_0x43542f['findBy']);if(_0x131475){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x15d'),this[_0xd1f3('0xe')][_0xd1f3('0x3b')],_0x43542f[_0xd1f3('0x15a')]));this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0x15d'),this[_0xd1f3('0xe')][_0xd1f3('0x3b')],_0x43542f[_0xd1f3('0x15a')]));return{'code':0xc8,'result':'success'};}else{logger[_0xd1f3('0x30')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd1f3('0xe')][_0xd1f3('0x3b')],_0x43542f[_0xd1f3('0x15a')]));this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util[_0xd1f3('0x2b')](_0xd1f3('0x15f'),this[_0xd1f3('0xe')]['callerid'],_0x43542f[_0xd1f3('0x15a')]));return{'code':0xc8,'result':_0xd1f3('0x160')};}};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x1d2')]=function(_0x24c12b){logger[_0xd1f3('0x30')](util[_0xd1f3('0x2b')](_0xd1f3('0x1d3'),_0x24c12b[_0xd1f3('0x38')]));var _0x3bff24=this['channel'][_0xd1f3('0x54')]('VOICEMAIL',[_0x24c12b[_0xd1f3('0x1d4')],_0x24c12b[_0xd1f3('0x72')]]);if(_0x3bff24['result']===-0x1){return _0x3bff24;}return this[_0xd1f3('0xe')][_0xd1f3('0xa4')](util['format'](_0xd1f3('0xc4'),_0xd1f3('0x1d5'),_0x24c12b['mailbox']));};AGIVertices[_0xd1f3('0x11')][_0xd1f3('0x1d6')]=function(_0x3f71b9){logger['info'](util['format'](_0xd1f3('0x1d7'),_0x3f71b9[_0xd1f3('0x38')]));if(!this[_0xd1f3('0x81')](_0x3f71b9[_0xd1f3('0xd4')])){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x3f71b9,_0xd1f3('0x1d8'));}var _0x42e02f=this[_0xd1f3('0x12')]['sync'](this,_0x3f71b9[_0xd1f3('0xd4')]);if(!_0x42e02f){return this[_0xd1f3('0xe')][_0xd1f3('0x4f')](_0x3f71b9,_0xd1f3('0x116'));}var _0x5d4562=this[_0xd1f3('0xe')][_0xd1f3('0x12')](_0x42e02f);return{'code':0xc8,'result':_0x5d4562[_0xd1f3('0x9f')]?_0x5d4562['extra']:'-'};};String[_0xd1f3('0x11')][_0xd1f3('0x9e')]=function(_0x1b52b8,_0x1cbf20){return this[_0xd1f3('0x9d')](_0x1b52b8)[_0xd1f3('0x1d9')](_0x1cbf20);};module[_0xd1f3('0x1da')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index efa128c..2f48aca 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 _0xfb63=['interface','queue','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','voicePause','info','attended','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','lastPauseAt','format','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','stopAcw','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','stringify','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','transfertargetuniqueid','secondtransfereruniqueid','origtransfereruniqueid','syncBlindTransfer','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','syncAgentRingNoAnswer','autopause','all','savePause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','blindtransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','startAcw'];(function(_0x4b0489,_0x599690){var _0x12fe60=function(_0x2b5844){while(--_0x2b5844){_0x4b0489['push'](_0x4b0489['shift']());}};_0x12fe60(++_0x599690);}(_0xfb63,0x178));var _0x3fb6=function(_0x387081,_0x4c8d59){_0x387081=_0x387081-0x0;var _0x6bbebe=_0xfb63[_0x387081];return _0x6bbebe;};'use strict';var util=require(_0x3fb6('0x0'));var _=require(_0x3fb6('0x1'));var moment=require(_0x3fb6('0x2'));var ami=require('../ami');var logger=require(_0x3fb6('0x3'))(_0x3fb6('0x4'));var RpcUser=require(_0x3fb6('0x5'));var RpcVoiceAgentReport=require(_0x3fb6('0x6'));function Acw(_0xe0675c){this[_0x3fb6('0x7')]=_0xe0675c[_0x3fb6('0x7')];this[_0x3fb6('0x8')]=_0xe0675c[_0x3fb6('0x8')];this['timers']=_0xe0675c[_0x3fb6('0x9')];this[_0x3fb6('0xa')]={};ami['on'](_0x3fb6('0xb'),this['syncAgentConnect'][_0x3fb6('0xc')](this));ami['on'](_0x3fb6('0xd'),this['syncHangupRequest'][_0x3fb6('0xc')](this));ami['on'](_0x3fb6('0xe'),this[_0x3fb6('0xf')][_0x3fb6('0xc')](this));ami['on'](_0x3fb6('0x10'),this['syncAgentRingNoAnswer']['bind'](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x3fb6('0xc')](this));ami['on'](_0x3fb6('0x11'),this['syncBlindTransfer'][_0x3fb6('0xc')](this));ami['on'](_0x3fb6('0x12'),this['syncAgentConnectPreview'][_0x3fb6('0xc')](this));}function getDiff(_0x326821){var _0x54899d=moment()[_0x3fb6('0x13')](0x0);var _0x9b5e7b=moment(_0x326821)[_0x3fb6('0x13')](0x0);return _0x54899d[_0x3fb6('0x14')](_0x9b5e7b,_0x3fb6('0x15'));}Acw[_0x3fb6('0x16')][_0x3fb6('0x17')]=function(_0x5722b6){try{var _0x139c1b=this;var _0x50e5df=this[_0x3fb6('0xa')][_0x5722b6][_0x3fb6('0x18')];var _0xa39c5e=this[_0x3fb6('0xa')][_0x5722b6][_0x3fb6('0x19')];var _0x1e8651=this[_0x3fb6('0x7')][_0xa39c5e];var _0x5f2531=![];var _0x24f132='ACW';if(_0x1e8651[_0x3fb6('0x1a')]){if(_0x1e8651[_0x3fb6('0x1b')][_0x3fb6('0x1c')]){_0x5f2531=!![];_0x24f132=_0x1e8651[_0x3fb6('0x1b')][_0x3fb6('0x1c')];}}ami['Action']({'action':_0x3fb6('0x1d'),'interface':_0x50e5df,'paused':!![],'reason':_0x24f132})[_0x3fb6('0x1e')](function(_0xb25a23){if(_0x139c1b[_0x3fb6('0x8')][_0x50e5df]){return RpcUser['getAgent'](_0x139c1b[_0x3fb6('0x8')][_0x50e5df]['id'])[_0x3fb6('0x1e')](function(_0x5a44f1){if(_0x5a44f1&&!_0x5a44f1[_0x3fb6('0x1f')]){logger[_0x3fb6('0x20')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x5722b6,_0x50e5df,_0xa39c5e);var _0x184e10=_0x139c1b['channels'][_0x5722b6][_0x3fb6('0x21')]&&_0x139c1b[_0x3fb6('0xa')][_0x5722b6]['destlinkedid']?_0x139c1b['channels'][_0x5722b6][_0x3fb6('0x22')]:_0x5722b6;return RpcUser['savePause'](_0x139c1b[_0x3fb6('0x8')][_0x50e5df],_0x24f132,_0x184e10)['then'](function(_0x4ff05b){if(!_0x5f2531){_0x139c1b['timers'][_0x50e5df]={};logger[_0x3fb6('0x20')](_0x3fb6('0x23'),_0x5722b6,_0x139c1b['voiceQueues'][_0xa39c5e][_0x3fb6('0x24')],_0x50e5df,_0xa39c5e);_0x139c1b[_0x3fb6('0x9')][_0x50e5df][_0x3fb6('0x25')]=setTimeout(_0x139c1b['stopAcw'][_0x3fb6('0xc')](_0x139c1b,_0x50e5df),_0x139c1b[_0x3fb6('0x7')][_0xa39c5e][_0x3fb6('0x24')]*0x3e8);_0x139c1b[_0x3fb6('0x9')][_0x50e5df][_0x3fb6('0x26')]=moment()[_0x3fb6('0x27')]('YYYY-MM-DD\x20HH:mm:ss');_0x139c1b['timers'][_0x50e5df][_0x3fb6('0x28')]=_0x5722b6;_0x139c1b[_0x3fb6('0x9')][_0x50e5df][_0x3fb6('0x19')]=_0xa39c5e;_0x139c1b[_0x3fb6('0x9')][_0x50e5df][_0x3fb6('0x29')]=function(){var _0x5c8fef=getDiff(_0x139c1b[_0x3fb6('0x9')][_0x50e5df][_0x3fb6('0x26')]);clearTimeout(_0x139c1b[_0x3fb6('0x9')][_0x50e5df]['timer']);_0x139c1b[_0x3fb6('0x9')][_0x50e5df][_0x3fb6('0x25')]=![];RpcVoiceAgentReport[_0x3fb6('0x2a')]({'acwtime':_0x5c8fef},_0x139c1b[_0x3fb6('0x9')][_0x50e5df]['uniqueid'],_0x50e5df)['then'](function(_0x870d18){logger['info'](_0x3fb6('0x2b'),_0x5722b6,_0x5c8fef,_0x870d18);})[_0x3fb6('0x2c')](function(_0x26b28a){logger[_0x3fb6('0x2d')](_0x3fb6('0x2e'),_0x5722b6,_0x26b28a);});delete _0x139c1b[_0x3fb6('0x9')][_0x50e5df];};}});}else{logger[_0x3fb6('0x20')](_0x3fb6('0x2f'),_0x5722b6,_0x50e5df,_0xa39c5e);}});}})['catch'](function(_0x1b21a0){logger[_0x3fb6('0x2d')](_0x3fb6('0x23'),_0x5722b6,_0x139c1b[_0x3fb6('0x7')][_0xa39c5e][_0x3fb6('0x24')],_0x50e5df,_0xa39c5e);})['finally'](function(){delete _0x139c1b['channels'][_0x5722b6];});}catch(_0x182be7){logger[_0x3fb6('0x2d')](_0x3fb6('0x30'),_0x182be7[_0x3fb6('0x31')]);}};Acw[_0x3fb6('0x16')][_0x3fb6('0x32')]=function(_0x4b7e23){try{var _0x3bf682=this;if(_0x3bf682['timers'][_0x4b7e23]){_0x3bf682[_0x3fb6('0x9')][_0x4b7e23]['timer']=![];var _0x361f7c=_0x3bf682['timers'][_0x4b7e23]['uniqueid'];var _0x1455d8=_0x3bf682[_0x3fb6('0x9')][_0x4b7e23]['queue'];var _0x43b001=_0x3bf682['voiceQueues'][_0x1455d8][_0x3fb6('0x24')];logger[_0x3fb6('0x20')](_0x3fb6('0x33'),_0x361f7c,_0x4b7e23);RpcUser[_0x3fb6('0x34')](this[_0x3fb6('0x8')][_0x4b7e23]);RpcVoiceAgentReport['update']({'acwtime':_0x43b001,'agentacw':!![]},_0x361f7c,_0x4b7e23)[_0x3fb6('0x1e')](function(_0x36e121){logger[_0x3fb6('0x20')]('[%s][UPDATE][ACWTIME:%s]',_0x361f7c,_0x43b001,_0x36e121);})[_0x3fb6('0x2c')](function(_0x229e91){logger[_0x3fb6('0x2d')](_0x3fb6('0x2e'),_0x361f7c,_0x229e91);});}else{logger[_0x3fb6('0x2d')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x4b7e23);if(_0x3bf682[_0x3fb6('0x9')]){logger[_0x3fb6('0x20')]('[ACW][TIMERS]',JSON[_0x3fb6('0x35')](_0x3bf682[_0x3fb6('0x9')]));}}}catch(_0x3a45a6){logger['error']('[ACW][STOP]\x20%s',_0x3a45a6['message']);}};Acw['prototype']['syncAgentConnect']=function(_0x248d03){try{if(this[_0x3fb6('0x7')][_0x248d03[_0x3fb6('0x19')]]&&(this[_0x3fb6('0x7')][_0x248d03[_0x3fb6('0x19')]]['acw']||this[_0x3fb6('0x7')][_0x248d03[_0x3fb6('0x19')]]['mandatoryDisposition'])){if(this[_0x3fb6('0x8')][_0x248d03[_0x3fb6('0x18')]]){this['channels'][_0x248d03[_0x3fb6('0x28')]]={'queue':_0x248d03[_0x3fb6('0x19')],'interface':_0x248d03[_0x3fb6('0x18')],'destlinkedid':_0x248d03[_0x3fb6('0x22')]};}}}catch(_0x233f04){logger[_0x3fb6('0x2d')](_0x3fb6('0x36'),_0x233f04['message']);}};Acw[_0x3fb6('0x16')][_0x3fb6('0x37')]=function(_0x4e4a44){try{if(this['voiceQueues'][_0x4e4a44[_0x3fb6('0x19')]]&&(this[_0x3fb6('0x7')][_0x4e4a44[_0x3fb6('0x19')]][_0x3fb6('0x4')]||this['voiceQueues'][_0x4e4a44[_0x3fb6('0x19')]][_0x3fb6('0x1a')])){if(this['agents'][_0x4e4a44['interface']]){this['channels'][_0x4e4a44[_0x3fb6('0x28')]]={'queue':_0x4e4a44[_0x3fb6('0x19')],'interface':_0x4e4a44[_0x3fb6('0x18')]};}}}catch(_0x3f3268){logger['error'](_0x3fb6('0x38'),_0x3f3268[_0x3fb6('0x31')]);}};Acw[_0x3fb6('0x16')][_0x3fb6('0x39')]=function(_0x5bb56a){try{if(this[_0x3fb6('0xa')][_0x5bb56a[_0x3fb6('0x28')]]&&_[_0x3fb6('0x3a')](this['channels'][_0x5bb56a['uniqueid']]['attended'])){logger[_0x3fb6('0x20')](_0x3fb6('0x3b'),_0x5bb56a['uniqueid']);this[_0x3fb6('0x17')](_0x5bb56a[_0x3fb6('0x28')]);}else if(this[_0x3fb6('0xa')][_0x5bb56a[_0x3fb6('0x3c')]]&&_[_0x3fb6('0x3a')](this['channels'][_0x5bb56a['linkedid']]['attended'])){logger[_0x3fb6('0x20')](_0x3fb6('0x3d'),_0x5bb56a[_0x3fb6('0x3c')]);this[_0x3fb6('0x17')](_0x5bb56a['linkedid']);}}catch(_0x20b21a){logger[_0x3fb6('0x2d')](_0x3fb6('0x3e'),_0x20b21a[_0x3fb6('0x31')]);}};Acw[_0x3fb6('0x16')][_0x3fb6('0xf')]=function(_0xc8fa65){try{if(this[_0x3fb6('0xa')][_0xc8fa65[_0x3fb6('0x28')]]&&this[_0x3fb6('0xa')][_0xc8fa65['uniqueid']]['attended']){logger[_0x3fb6('0x20')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0xc8fa65['uniqueid']);this['startAcw'](_0xc8fa65[_0x3fb6('0x28')]);}else if(this[_0x3fb6('0xa')][_0xc8fa65[_0x3fb6('0x3c')]]&&this['channels'][_0xc8fa65['linkedid']][_0x3fb6('0x21')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0xc8fa65['linkedid']);this[_0x3fb6('0x17')](_0xc8fa65[_0x3fb6('0x3c')]);}}catch(_0x337517){logger[_0x3fb6('0x2d')](_0x3fb6('0x3f'),_0x337517[_0x3fb6('0x31')]);}};Acw['prototype'][_0x3fb6('0x40')]=function(_0x409ff0){try{if(!_[_0x3fb6('0x41')](this[_0x3fb6('0xa')][_0x409ff0[_0x3fb6('0x42')]])){this[_0x3fb6('0x17')](_0x409ff0[_0x3fb6('0x42')]);if(this[_0x3fb6('0xa')][_0x409ff0['secondtransfereruniqueid']]){this['channels'][_0x409ff0['secondtransfereruniqueid']][_0x3fb6('0x21')]=!![];this[_0x3fb6('0xa')][_0x409ff0[_0x3fb6('0x43')]]=this[_0x3fb6('0xa')][_0x409ff0[_0x3fb6('0x44')]];delete this[_0x3fb6('0xa')][_0x409ff0[_0x3fb6('0x44')]];}}else if(!_['isNil'](this[_0x3fb6('0xa')][_0x409ff0[_0x3fb6('0x43')]])){this[_0x3fb6('0x17')](_0x409ff0[_0x3fb6('0x43')]);if(this[_0x3fb6('0xa')][_0x409ff0[_0x3fb6('0x45')]]){this['channels'][_0x409ff0[_0x3fb6('0x45')]][_0x3fb6('0x21')]=!![];this[_0x3fb6('0xa')][_0x409ff0[_0x3fb6('0x42')]]=this['channels'][_0x409ff0[_0x3fb6('0x45')]];delete this[_0x3fb6('0xa')][_0x409ff0[_0x3fb6('0x45')]];}}}catch(_0xedbbe5){logger[_0x3fb6('0x2d')]('[ACW][syncAttendedTransfer]\x20%s',_0xedbbe5[_0x3fb6('0x31')]);}};Acw[_0x3fb6('0x16')][_0x3fb6('0x46')]=function(_0x10d884){try{if(this['channels'][_0x10d884[_0x3fb6('0x47')]]){logger[_0x3fb6('0x20')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x3fb6('0x35')](_0x10d884[_0x3fb6('0x47')]));this[_0x3fb6('0x17')](_0x10d884[_0x3fb6('0x47')]);}else if(this[_0x3fb6('0xa')][_0x10d884[_0x3fb6('0x48')]]){logger[_0x3fb6('0x20')](_0x3fb6('0x49'),JSON[_0x3fb6('0x35')](_0x10d884[_0x3fb6('0x48')]));this[_0x3fb6('0x17')](_0x10d884[_0x3fb6('0x48')]);}}catch(_0x3329f6){logger[_0x3fb6('0x2d')]('[ACW][syncBlindTransfer]\x20%s',_0x3329f6[_0x3fb6('0x31')]);}};Acw['prototype'][_0x3fb6('0x4a')]=function(_0x3c50d3){try{if(this[_0x3fb6('0x7')][_0x3c50d3[_0x3fb6('0x19')]]&&this[_0x3fb6('0x7')][_0x3c50d3[_0x3fb6('0x19')]][_0x3fb6('0x4b')]===_0x3fb6('0x4c')){if(this['agents'][_0x3c50d3[_0x3fb6('0x18')]]){logger[_0x3fb6('0x20')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x3c50d3[_0x3fb6('0x28')],_0x3c50d3[_0x3fb6('0x18')],_0x3c50d3['queue']);return RpcUser[_0x3fb6('0x4d')](this['agents'][_0x3c50d3['interface']],'Auto-Pause',_0x3c50d3[_0x3fb6('0x28')]);}}}catch(_0x576ce1){logger['error'](_0x3fb6('0x4e'),_0x576ce1[_0x3fb6('0x31')]);}};module[_0x3fb6('0x4f')]=Acw; \ No newline at end of file +var _0x95ee=['voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','stopAcw','lastPauseAt','format','update','uniqueid','catch','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','[ACW][START]\x20%s','message','prototype','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','Action','QueuePause','then','getAgent'];(function(_0x2a6196,_0x1f2295){var _0x2b021e=function(_0x2143b6){while(--_0x2143b6){_0x2a6196['push'](_0x2a6196['shift']());}};_0x2b021e(++_0x1f2295);}(_0x95ee,0xd1));var _0xe95e=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x95ee[_0xefd519];return _0x4bb882;};'use strict';var util=require(_0xe95e('0x0'));var _=require(_0xe95e('0x1'));var moment=require(_0xe95e('0x2'));var ami=require('../ami');var logger=require(_0xe95e('0x3'))(_0xe95e('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xe95e('0x5'));function Acw(_0x270aae){this[_0xe95e('0x6')]=_0x270aae[_0xe95e('0x6')];this[_0xe95e('0x7')]=_0x270aae[_0xe95e('0x7')];this[_0xe95e('0x8')]=_0x270aae['timers'];this[_0xe95e('0x9')]={};ami['on'](_0xe95e('0xa'),this[_0xe95e('0xb')][_0xe95e('0xc')](this));ami['on'](_0xe95e('0xd'),this[_0xe95e('0xe')][_0xe95e('0xc')](this));ami['on'](_0xe95e('0xf'),this['syncHangup'][_0xe95e('0xc')](this));ami['on']('agentringnoanswer',this[_0xe95e('0x10')][_0xe95e('0xc')](this));ami['on'](_0xe95e('0x11'),this[_0xe95e('0x12')][_0xe95e('0xc')](this));ami['on'](_0xe95e('0x13'),this['syncBlindTransfer'][_0xe95e('0xc')](this));ami['on'](_0xe95e('0x14'),this[_0xe95e('0x15')][_0xe95e('0xc')](this));}function getDiff(_0x532532){var _0x11d041=moment()[_0xe95e('0x16')](0x0);var _0xdd9e4f=moment(_0x532532)[_0xe95e('0x16')](0x0);return _0x11d041['diff'](_0xdd9e4f,_0xe95e('0x17'));}Acw['prototype'][_0xe95e('0x18')]=function(_0x459fc3){try{var _0x5a5e6d=this;var _0x3fc580=this[_0xe95e('0x9')][_0x459fc3][_0xe95e('0x19')];var _0x538ed8=this[_0xe95e('0x9')][_0x459fc3][_0xe95e('0x1a')];var _0x5b114e=this[_0xe95e('0x6')][_0x538ed8];var _0x24d9a2=![];var _0x2e5d58=_0xe95e('0x1b');if(_0x5b114e[_0xe95e('0x1c')]){if(_0x5b114e[_0xe95e('0x1d')]['name']){_0x24d9a2=!![];_0x2e5d58=_0x5b114e['mandatoryDispositionPause']['name'];}}ami[_0xe95e('0x1e')]({'action':_0xe95e('0x1f'),'interface':_0x3fc580,'paused':!![],'reason':_0x2e5d58})[_0xe95e('0x20')](function(_0x1c51ad){if(_0x5a5e6d['agents'][_0x3fc580]){return RpcUser[_0xe95e('0x21')](_0x5a5e6d[_0xe95e('0x7')][_0x3fc580]['id'])[_0xe95e('0x20')](function(_0x1e6094){if(_0x1e6094&&!_0x1e6094[_0xe95e('0x22')]){logger[_0xe95e('0x23')](_0xe95e('0x24'),_0x459fc3,_0x3fc580,_0x538ed8);var _0x1af1ac=_0x5a5e6d[_0xe95e('0x9')][_0x459fc3][_0xe95e('0x25')]&&_0x5a5e6d['channels'][_0x459fc3][_0xe95e('0x26')]?_0x5a5e6d[_0xe95e('0x9')][_0x459fc3][_0xe95e('0x26')]:_0x459fc3;return RpcUser['savePause'](_0x5a5e6d[_0xe95e('0x7')][_0x3fc580],_0x2e5d58,_0x1af1ac)[_0xe95e('0x20')](function(_0x16451d){if(!_0x24d9a2){_0x5a5e6d[_0xe95e('0x8')][_0x3fc580]={};logger[_0xe95e('0x23')](_0xe95e('0x27'),_0x459fc3,_0x5a5e6d[_0xe95e('0x6')][_0x538ed8]['acwTimeout'],_0x3fc580,_0x538ed8);_0x5a5e6d[_0xe95e('0x8')][_0x3fc580][_0xe95e('0x28')]=setTimeout(_0x5a5e6d[_0xe95e('0x29')][_0xe95e('0xc')](_0x5a5e6d,_0x3fc580),_0x5a5e6d[_0xe95e('0x6')][_0x538ed8]['acwTimeout']*0x3e8);_0x5a5e6d[_0xe95e('0x8')][_0x3fc580][_0xe95e('0x2a')]=moment()[_0xe95e('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');_0x5a5e6d[_0xe95e('0x8')][_0x3fc580]['uniqueid']=_0x459fc3;_0x5a5e6d[_0xe95e('0x8')][_0x3fc580][_0xe95e('0x1a')]=_0x538ed8;_0x5a5e6d[_0xe95e('0x8')][_0x3fc580]['updateAcw']=function(){var _0x3cb6bf=getDiff(_0x5a5e6d['timers'][_0x3fc580][_0xe95e('0x2a')]);clearTimeout(_0x5a5e6d[_0xe95e('0x8')][_0x3fc580][_0xe95e('0x28')]);_0x5a5e6d['timers'][_0x3fc580][_0xe95e('0x28')]=![];RpcVoiceAgentReport[_0xe95e('0x2c')]({'acwtime':_0x3cb6bf},_0x5a5e6d[_0xe95e('0x8')][_0x3fc580][_0xe95e('0x2d')],_0x3fc580)[_0xe95e('0x20')](function(_0x5b5846){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x459fc3,_0x3cb6bf,_0x5b5846);})[_0xe95e('0x2e')](function(_0x13db51){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x459fc3,_0x13db51);});delete _0x5a5e6d[_0xe95e('0x8')][_0x3fc580];};}});}else{logger[_0xe95e('0x23')](_0xe95e('0x2f'),_0x459fc3,_0x3fc580,_0x538ed8);}});}})[_0xe95e('0x2e')](function(_0x300e02){logger['error'](_0xe95e('0x27'),_0x459fc3,_0x5a5e6d[_0xe95e('0x6')][_0x538ed8]['acwTimeout'],_0x3fc580,_0x538ed8);})['finally'](function(){delete _0x5a5e6d[_0xe95e('0x9')][_0x459fc3];});}catch(_0x2853ae){logger[_0xe95e('0x30')](_0xe95e('0x31'),_0x2853ae[_0xe95e('0x32')]);}};Acw[_0xe95e('0x33')][_0xe95e('0x29')]=function(_0x489fe1){try{var _0x4e168a=this;if(_0x4e168a['timers'][_0x489fe1]){_0x4e168a[_0xe95e('0x8')][_0x489fe1][_0xe95e('0x28')]=![];var _0x31f45b=_0x4e168a[_0xe95e('0x8')][_0x489fe1][_0xe95e('0x2d')];var _0xca9762=_0x4e168a[_0xe95e('0x8')][_0x489fe1]['queue'];var _0x3cb29c=_0x4e168a['voiceQueues'][_0xca9762]['acwTimeout'];logger[_0xe95e('0x23')](_0xe95e('0x34'),_0x31f45b,_0x489fe1);RpcUser[_0xe95e('0x35')](this[_0xe95e('0x7')][_0x489fe1]);RpcVoiceAgentReport['update']({'acwtime':_0x3cb29c,'agentacw':!![]},_0x31f45b,_0x489fe1)[_0xe95e('0x20')](function(_0x27183b){logger[_0xe95e('0x23')]('[%s][UPDATE][ACWTIME:%s]',_0x31f45b,_0x3cb29c,_0x27183b);})[_0xe95e('0x2e')](function(_0x4ed5a9){logger[_0xe95e('0x30')]('[%s][UPDATE][ERRORS:%s]',_0x31f45b,_0x4ed5a9);});}else{logger[_0xe95e('0x30')](_0xe95e('0x36'),_0x489fe1);if(_0x4e168a['timers']){logger[_0xe95e('0x23')]('[ACW][TIMERS]',JSON[_0xe95e('0x37')](_0x4e168a[_0xe95e('0x8')]));}}}catch(_0xdcd95a){logger[_0xe95e('0x30')](_0xe95e('0x38'),_0xdcd95a['message']);}};Acw[_0xe95e('0x33')][_0xe95e('0xb')]=function(_0x36c7f4){try{if(this['voiceQueues'][_0x36c7f4[_0xe95e('0x1a')]]&&(this[_0xe95e('0x6')][_0x36c7f4[_0xe95e('0x1a')]][_0xe95e('0x4')]||this[_0xe95e('0x6')][_0x36c7f4[_0xe95e('0x1a')]][_0xe95e('0x1c')])){if(this[_0xe95e('0x7')][_0x36c7f4[_0xe95e('0x19')]]){this[_0xe95e('0x9')][_0x36c7f4[_0xe95e('0x2d')]]={'queue':_0x36c7f4[_0xe95e('0x1a')],'interface':_0x36c7f4[_0xe95e('0x19')],'destlinkedid':_0x36c7f4[_0xe95e('0x26')]};}}}catch(_0x287a9a){logger['error'](_0xe95e('0x39'),_0x287a9a[_0xe95e('0x32')]);}};Acw[_0xe95e('0x33')]['syncAgentConnectPreview']=function(_0x3bcf5f){try{if(this['voiceQueues'][_0x3bcf5f[_0xe95e('0x1a')]]&&(this[_0xe95e('0x6')][_0x3bcf5f[_0xe95e('0x1a')]][_0xe95e('0x4')]||this['voiceQueues'][_0x3bcf5f[_0xe95e('0x1a')]][_0xe95e('0x1c')])){if(this[_0xe95e('0x7')][_0x3bcf5f[_0xe95e('0x19')]]){this[_0xe95e('0x9')][_0x3bcf5f[_0xe95e('0x2d')]]={'queue':_0x3bcf5f[_0xe95e('0x1a')],'interface':_0x3bcf5f[_0xe95e('0x19')]};}}}catch(_0x1e621a){logger[_0xe95e('0x30')]('[ACW][syncAgentConnectPreview]\x20%s',_0x1e621a[_0xe95e('0x32')]);}};Acw['prototype'][_0xe95e('0xe')]=function(_0x480c3a){try{if(this[_0xe95e('0x9')][_0x480c3a[_0xe95e('0x2d')]]&&_[_0xe95e('0x3a')](this[_0xe95e('0x9')][_0x480c3a['uniqueid']]['attended'])){logger[_0xe95e('0x23')](_0xe95e('0x3b'),_0x480c3a[_0xe95e('0x2d')]);this[_0xe95e('0x18')](_0x480c3a[_0xe95e('0x2d')]);}else if(this[_0xe95e('0x9')][_0x480c3a[_0xe95e('0x3c')]]&&_[_0xe95e('0x3a')](this['channels'][_0x480c3a[_0xe95e('0x3c')]]['attended'])){logger[_0xe95e('0x23')](_0xe95e('0x3d'),_0x480c3a[_0xe95e('0x3c')]);this[_0xe95e('0x18')](_0x480c3a['linkedid']);}}catch(_0x24fa2d){logger[_0xe95e('0x30')](_0xe95e('0x3e'),_0x24fa2d[_0xe95e('0x32')]);}};Acw[_0xe95e('0x33')][_0xe95e('0x3f')]=function(_0x164306){try{if(this[_0xe95e('0x9')][_0x164306['uniqueid']]&&this[_0xe95e('0x9')][_0x164306[_0xe95e('0x2d')]][_0xe95e('0x25')]){logger[_0xe95e('0x23')](_0xe95e('0x40'),_0x164306[_0xe95e('0x2d')]);this[_0xe95e('0x18')](_0x164306[_0xe95e('0x2d')]);}else if(this[_0xe95e('0x9')][_0x164306[_0xe95e('0x3c')]]&&this[_0xe95e('0x9')][_0x164306[_0xe95e('0x3c')]][_0xe95e('0x25')]){logger[_0xe95e('0x23')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x164306[_0xe95e('0x3c')]);this[_0xe95e('0x18')](_0x164306[_0xe95e('0x3c')]);}}catch(_0x339dda){logger['error'](_0xe95e('0x41'),_0x339dda[_0xe95e('0x32')]);}};Acw[_0xe95e('0x33')]['syncAttendedTransfer']=function(_0x3bff92){try{if(!_[_0xe95e('0x42')](this[_0xe95e('0x9')][_0x3bff92[_0xe95e('0x43')]])){this[_0xe95e('0x18')](_0x3bff92[_0xe95e('0x43')]);if(this[_0xe95e('0x9')][_0x3bff92['secondtransfereruniqueid']]){this[_0xe95e('0x9')][_0x3bff92['secondtransfereruniqueid']][_0xe95e('0x25')]=!![];this[_0xe95e('0x9')][_0x3bff92['transfertargetuniqueid']]=this[_0xe95e('0x9')][_0x3bff92[_0xe95e('0x44')]];delete this[_0xe95e('0x9')][_0x3bff92[_0xe95e('0x44')]];}}else if(!_['isNil'](this[_0xe95e('0x9')][_0x3bff92[_0xe95e('0x45')]])){this[_0xe95e('0x18')](_0x3bff92['transfertargetuniqueid']);if(this[_0xe95e('0x9')][_0x3bff92['origtransfereruniqueid']]){this[_0xe95e('0x9')][_0x3bff92['origtransfereruniqueid']][_0xe95e('0x25')]=!![];this[_0xe95e('0x9')][_0x3bff92['transfereeuniqueid']]=this[_0xe95e('0x9')][_0x3bff92[_0xe95e('0x46')]];delete this[_0xe95e('0x9')][_0x3bff92['origtransfereruniqueid']];}}}catch(_0x34bf23){logger[_0xe95e('0x30')](_0xe95e('0x47'),_0x34bf23[_0xe95e('0x32')]);}};Acw[_0xe95e('0x33')]['syncBlindTransfer']=function(_0x3c2bd4){try{if(this['channels'][_0x3c2bd4[_0xe95e('0x48')]]){logger[_0xe95e('0x23')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xe95e('0x37')](_0x3c2bd4[_0xe95e('0x48')]));this[_0xe95e('0x18')](_0x3c2bd4[_0xe95e('0x48')]);}else if(this[_0xe95e('0x9')][_0x3c2bd4[_0xe95e('0x49')]]){logger[_0xe95e('0x23')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xe95e('0x37')](_0x3c2bd4['transfererlinkedid']));this['startAcw'](_0x3c2bd4[_0xe95e('0x49')]);}}catch(_0x38fff3){logger[_0xe95e('0x30')](_0xe95e('0x4a'),_0x38fff3[_0xe95e('0x32')]);}};Acw[_0xe95e('0x33')][_0xe95e('0x10')]=function(_0x5ace82){try{if(this[_0xe95e('0x6')][_0x5ace82['queue']]&&this['voiceQueues'][_0x5ace82[_0xe95e('0x1a')]][_0xe95e('0x4b')]==='all'){if(this[_0xe95e('0x7')][_0x5ace82[_0xe95e('0x19')]]){logger['info'](_0xe95e('0x4c'),_0x5ace82['uniqueid'],_0x5ace82[_0xe95e('0x19')],_0x5ace82[_0xe95e('0x1a')]);return RpcUser[_0xe95e('0x4d')](this[_0xe95e('0x7')][_0x5ace82[_0xe95e('0x19')]],_0xe95e('0x4e'),_0x5ace82[_0xe95e('0x2d')]);}}}catch(_0x103aa6){logger[_0xe95e('0x30')](_0xe95e('0x4f'),_0x103aa6['message']);}};module[_0xe95e('0x50')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index d519ed0..4ab5f8d 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 _0x0b0e=['../../config/environment','asterisk','port','username','password','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionQueueSummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','close','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipPeerStatus','catch','[ami.js][fullybooted]','once','asterisk-manager','moment','lodash','../../config/logger','ami'];(function(_0xa6583c,_0x44da57){var _0x2a14c7=function(_0x1b4380){while(--_0x1b4380){_0xa6583c['push'](_0xa6583c['shift']());}};_0x2a14c7(++_0x44da57);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1b8bda,_0x43ad31){_0x1b8bda=_0x1b8bda-0x0;var _0x1f7050=_0x0b0e[_0x1b8bda];return _0x1f7050;};'use strict';var Manager=require(_0xe0b0('0x0'));var BPromise=require('bluebird');var moment=require(_0xe0b0('0x1'));var util=require('util');var _=require(_0xe0b0('0x2'));var logger=require(_0xe0b0('0x3'))(_0xe0b0('0x4'));var config=require(_0xe0b0('0x5'));var ami=new Manager(config[_0xe0b0('0x6')][_0xe0b0('0x7')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')][_0xe0b0('0x9')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0xe0b0('0xa')](ami[_0xe0b0('0xb')]);function error(_0xc4a085){logger[_0xe0b0('0xc')](util['format'](_0xe0b0('0xd'),config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')]['port'],util[_0xe0b0('0xe')](_0xc4a085,![],null)));}function close(){logger[_0xe0b0('0xc')](util[_0xe0b0('0xf')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x11')});};};ami[_0xe0b0('0x12')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x13')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'sippeerstatus'});};};ami[_0xe0b0('0x14')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'queuesummary'});};};ami[_0xe0b0('0x15')]=function(){return function(){return ami['Action']({'action':_0xe0b0('0x16')});};};function connect(_0x100204){logger['info'](util['format'](_0xe0b0('0x17'),config['asterisk']['username'],config['asterisk']['ip'],config[_0xe0b0('0x6')]['port']));ami['once'](_0xe0b0('0xc'),error);ami['once'](_0xe0b0('0x18'),close);}ami['on']('connect',connect);ami['on'](_0xe0b0('0x19'),function(_0x1cd7c4){logger[_0xe0b0('0x1a')](util[_0xe0b0('0xf')](_0xe0b0('0x1b'),config['asterisk']['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')],util[_0xe0b0('0xe')](_0x1cd7c4,![],null)));});ami['on']('fullybooted',function(_0x170ad8){logger['info'](util[_0xe0b0('0xf')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')]));return BPromise['resolve']()[_0xe0b0('0x1c')](ami['actionSipShowRegistry']())[_0xe0b0('0x1c')](ami[_0xe0b0('0x12')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x1d')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x14')]())['then'](ami[_0xe0b0('0x15')]())[_0xe0b0('0x1e')](function(_0x5b7a64){logger[_0xe0b0('0xc')](_0xe0b0('0x1f'),util[_0xe0b0('0xe')](_0x5b7a64,{'showHidden':![],'depth':null}));});});ami[_0xe0b0('0x20')](_0xe0b0('0xc'),error);ami[_0xe0b0('0x20')](_0xe0b0('0x18'),close);module['exports']=ami; \ No newline at end of file +var _0xb7e7=['username','Action','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','[ami.js][fullybooted]','exports','asterisk-manager','moment','lodash','ami','asterisk','port','password','keepConnected','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s'];(function(_0x189cf1,_0x16ba19){var _0x1d2f50=function(_0x5aa8e5){while(--_0x5aa8e5){_0x189cf1['push'](_0x189cf1['shift']());}};_0x1d2f50(++_0x16ba19);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xb7e7[_0x4ea69d];return _0x5318e0;};'use strict';var Manager=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var moment=require(_0x7b7e('0x1'));var util=require('util');var _=require(_0x7b7e('0x2'));var logger=require('../../config/logger')(_0x7b7e('0x3'));var config=require('../../config/environment');var ami=new Manager(config[_0x7b7e('0x4')][_0x7b7e('0x5')],config[_0x7b7e('0x4')]['ip'],config['asterisk']['username'],config[_0x7b7e('0x4')][_0x7b7e('0x6')],!![]);ami[_0x7b7e('0x7')]();ami['Action']=BPromise[_0x7b7e('0x8')](ami[_0x7b7e('0x9')]);function error(_0x2917f9){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xc'),config[_0x7b7e('0x4')]['username'],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x2917f9,![],null)));}function close(){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xe'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x11')});};};ami[_0x7b7e('0x12')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x13')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x7b7e('0x14')});};};ami[_0x7b7e('0x15')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x16')});};};function connect(_0x2cc400){logger[_0x7b7e('0x17')](util[_0x7b7e('0xb')](_0x7b7e('0x18'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')](_0x7b7e('0x1a'),close);}ami['on']('connect',connect);ami['on'](_0x7b7e('0x1b'),function(_0x43db4f){logger[_0x7b7e('0x17')](util['format'](_0x7b7e('0x1c'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x43db4f,![],null)));});ami['on'](_0x7b7e('0x1d'),function(_0x53bbb3){logger['info'](util['format'](_0x7b7e('0x1e'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config['asterisk']['port']));return BPromise[_0x7b7e('0x1f')]()[_0x7b7e('0x20')](ami[_0x7b7e('0x21')]())[_0x7b7e('0x20')](ami[_0x7b7e('0x22')]())['then'](ami[_0x7b7e('0x12')]())[_0x7b7e('0x20')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())[_0x7b7e('0x23')](function(_0x423832){logger['error'](_0x7b7e('0x24'),util['inspect'](_0x423832,{'showHidden':![],'depth':null}));});});ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')]('close',close);module[_0x7b7e('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index d18d039..2f854de 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 _0xe706=['result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug','rpc','memberReport','error','message'];(function(_0x4dcc2d,_0x422839){var _0x1bbd79=function(_0x173341){while(--_0x173341){_0x4dcc2d['push'](_0x4dcc2d['shift']());}};_0x1bbd79(++_0x422839);}(_0xe706,0xa3));var _0x6e70=function(_0x4b2cc6,_0x29ef43){_0x4b2cc6=_0x4b2cc6-0x0;var _0x3e0b08=_0xe706[_0x4b2cc6];return _0x3e0b08;};'use strict';var jayson=require(_0x6e70('0x0'));var BPromise=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('ami');var client=jayson[_0x6e70('0x3')][_0x6e70('0x4')]({'port':0x2329});client[_0x6e70('0x5')]=function(_0x7dfbc3,_0x142c27){return new BPromise(function(_0x2164a4,_0x376a8d){return client[_0x6e70('0x6')](_0x7dfbc3,_0x142c27)[_0x6e70('0x7')](function(_0x4381d1){logger[_0x6e70('0x8')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x142c27,_0x4381d1);if(_0x4381d1[_0x6e70('0xb')]){logger[_0x6e70('0xb')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')],_0x142c27);return _0x376a8d(_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')]);}else{return _0x2164a4(_0x4381d1[_0x6e70('0xd')]);}})[_0x6e70('0xe')](function(_0x4600f9){logger['error']('rpc',_0x6e70('0xa'),_0x7dfbc3,_0x4600f9,_0x142c27);return _0x376a8d(_0x4600f9);});});};module[_0x6e70('0xf')]=client; \ No newline at end of file +var _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xb7e7[_0x166d93];return _0xba708;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 4c3f4dc..3ab99f8 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda7d=['recallme','originatecalleridname','getCaller','dialCutDigit','number','substring','prototype','getQueue','exports','lodash','moment','string','isNil','voiceQueue','uniqueid','name','phone','Contact','firstName','lastName','queue','active','type','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','CampaignId','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat'];(function(_0x5c4fe5,_0x535481){var _0xb6a5b0=function(_0x1a8d42){while(--_0x1a8d42){_0x5c4fe5['push'](_0x5c4fe5['shift']());}};_0xb6a5b0(++_0x535481);}(_0xda7d,0xe0));var _0xdda7=function(_0x3131c4,_0x5df24e){_0x3131c4=_0x3131c4-0x0;var _0x5347db=_0xda7d[_0x3131c4];return _0x5347db;};'use strict';var util=require('util');var _=require(_0xdda7('0x0'));var moment=require(_0xdda7('0x1'));function checkNameSurname(_0x26c036,_0x5de675,_0x633e5d){var _0x8269bd='';if(!_['isNil'](_0x5de675)&&_0xdda7('0x2')===typeof _0x5de675){_0x8269bd+=_0x5de675;}if(!_[_0xdda7('0x3')](_0x633e5d)&&_0xdda7('0x2')===typeof _0x633e5d){_0x8269bd+='\x20'+_0x633e5d;}if(_0x8269bd!==''){return _0x8269bd;}return _0x26c036;}function Action(_0x44ab6d,_0x492726,_0xa6c16b){this[_0xdda7('0x4')]=_0x44ab6d;this[_0xdda7('0x5')]=_0xa6c16b||undefined;this[_0xdda7('0x6')]=checkNameSurname(_0x492726['Contact'][_0xdda7('0x7')],_0x492726[_0xdda7('0x8')][_0xdda7('0x9')],_0x492726[_0xdda7('0x8')][_0xdda7('0xa')]);this['number']=_0x492726['Contact']['phone'];this[_0xdda7('0xb')]=_0x44ab6d[_0xdda7('0x6')];this[_0xdda7('0xc')]=_0x492726[_0xdda7('0xc')]||![];this[_0xdda7('0xd')]=_0x44ab6d['type'];this['dialQueueTimeout']=_0x44ab6d['dialQueueTimeout']||0x3;this[_0xdda7('0xe')]=_0x492726[_0xdda7('0xe')];this['countbusyretry']=_0x492726[_0xdda7('0xf')];this[_0xdda7('0x10')]=_0x492726[_0xdda7('0x10')];this[_0xdda7('0x11')]=_0x492726[_0xdda7('0x11')];this['countnosuchnumberretry']=_0x492726[_0xdda7('0x12')];this[_0xdda7('0x13')]=_0x492726[_0xdda7('0x13')];this[_0xdda7('0x14')]=_0x492726[_0xdda7('0x14')];this[_0xdda7('0x15')]=_0x492726[_0xdda7('0x15')];this[_0xdda7('0x16')]=_0x492726[_0xdda7('0x16')];this[_0xdda7('0x17')]=_0x492726['ContactId'];this[_0xdda7('0x18')]=_0x492726[_0xdda7('0x18')];this['UserId']=_0x492726[_0xdda7('0x19')];this['VoiceQueueId']=_0x492726['VoiceQueueId'];this['CampaignId']=_0x492726[_0xdda7('0x1a')];this['idHopper']=_0x492726['id'];this[_0xdda7('0x1b')]=_0x492726[_0xdda7('0x8')][_0xdda7('0x9')]||'';this[_0xdda7('0x1c')]=moment()[_0xdda7('0x1d')](_0xdda7('0x1e'));this[_0xdda7('0x1f')]=_0x492726[_0xdda7('0x1f')];this[_0xdda7('0x20')]=_0x492726[_0xdda7('0x20')];this[_0xdda7('0x21')]=_0x492726[_0xdda7('0x21')];this[_0xdda7('0x22')]=_0x492726[_0xdda7('0x22')];this['originatecalleridnum']='';this[_0xdda7('0x23')]='';}Action['prototype'][_0xdda7('0x24')]=function(){return util[_0xdda7('0x1d')]('\x22%s\x22\x20<%s>',this['name'],this['voiceQueue'][_0xdda7('0x25')]>0x0?this[_0xdda7('0x26')][_0xdda7('0x27')](this['voiceQueue'][_0xdda7('0x25')]):this[_0xdda7('0x26')]);};Action[_0xdda7('0x28')][_0xdda7('0x29')]=function(){return this[_0xdda7('0xb')];};module[_0xdda7('0x2a')]=Action; \ No newline at end of file +var _0xe1fd=['queue','util','lodash','string','isNil','uniqueid','name','Contact','firstName','number','phone','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','substring','getQueue'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xe1fd,0xf7));var _0xde1f=function(_0xc221ab,_0x10ab19){_0xc221ab=_0xc221ab-0x0;var _0x5267bc=_0xe1fd[_0xc221ab];return _0x5267bc;};'use strict';var util=require(_0xde1f('0x0'));var _=require(_0xde1f('0x1'));var moment=require('moment');function checkNameSurname(_0x3b553b,_0x22f775,_0x35c3e8){var _0x45f682='';if(!_['isNil'](_0x22f775)&&_0xde1f('0x2')===typeof _0x22f775){_0x45f682+=_0x22f775;}if(!_[_0xde1f('0x3')](_0x35c3e8)&&_0xde1f('0x2')===typeof _0x35c3e8){_0x45f682+='\x20'+_0x35c3e8;}if(_0x45f682!==''){return _0x45f682;}return _0x3b553b;}function Action(_0x302b14,_0x4ed7e2,_0x5bce56){this['voiceQueue']=_0x302b14;this[_0xde1f('0x4')]=_0x5bce56||undefined;this[_0xde1f('0x5')]=checkNameSurname(_0x4ed7e2[_0xde1f('0x6')]['phone'],_0x4ed7e2['Contact'][_0xde1f('0x7')],_0x4ed7e2[_0xde1f('0x6')]['lastName']);this[_0xde1f('0x8')]=_0x4ed7e2['Contact'][_0xde1f('0x9')];this['queue']=_0x302b14[_0xde1f('0x5')];this['active']=_0x4ed7e2['active']||![];this[_0xde1f('0xa')]=_0x302b14['type'];this[_0xde1f('0xb')]=_0x302b14['dialQueueTimeout']||0x3;this[_0xde1f('0xc')]=_0x4ed7e2['scheduledat'];this['countbusyretry']=_0x4ed7e2[_0xde1f('0xd')];this['countcongestionretry']=_0x4ed7e2[_0xde1f('0xe')];this[_0xde1f('0xf')]=_0x4ed7e2['countnoanswerretry'];this[_0xde1f('0x10')]=_0x4ed7e2['countnosuchnumberretry'];this['countdropretry']=_0x4ed7e2['countdropretry'];this[_0xde1f('0x11')]=_0x4ed7e2[_0xde1f('0x11')];this[_0xde1f('0x12')]=_0x4ed7e2[_0xde1f('0x12')];this[_0xde1f('0x13')]=_0x4ed7e2[_0xde1f('0x13')];this[_0xde1f('0x14')]=_0x4ed7e2[_0xde1f('0x14')];this[_0xde1f('0x15')]=_0x4ed7e2['ListId'];this[_0xde1f('0x16')]=_0x4ed7e2[_0xde1f('0x16')];this['VoiceQueueId']=_0x4ed7e2[_0xde1f('0x17')];this[_0xde1f('0x18')]=_0x4ed7e2[_0xde1f('0x18')];this['idHopper']=_0x4ed7e2['id'];this[_0xde1f('0x19')]=_0x4ed7e2['Contact'][_0xde1f('0x7')]||'';this[_0xde1f('0x1a')]=moment()[_0xde1f('0x1b')](_0xde1f('0x1c'));this[_0xde1f('0x1d')]=_0x4ed7e2[_0xde1f('0x1d')];this[_0xde1f('0x1e')]=_0x4ed7e2[_0xde1f('0x1e')];this[_0xde1f('0x1f')]=_0x4ed7e2[_0xde1f('0x1f')];this[_0xde1f('0x20')]=_0x4ed7e2['recallme'];this['originatecalleridnum']='';this[_0xde1f('0x21')]='';}Action[_0xde1f('0x22')]['getCaller']=function(){return util['format'](_0xde1f('0x23'),this['name'],this[_0xde1f('0x24')][_0xde1f('0x25')]>0x0?this[_0xde1f('0x8')][_0xde1f('0x26')](this[_0xde1f('0x24')][_0xde1f('0x25')]):this[_0xde1f('0x8')]);};Action[_0xde1f('0x22')][_0xde1f('0x27')]=function(){return this[_0xde1f('0x28')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index e4a09da..1e5128c 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2c51=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','diff','seconds','state','statedesc','scheduledat','type','campaigntype'];(function(_0x4bd8e1,_0x5e9388){var _0x286282=function(_0x26485f){while(--_0x26485f){_0x4bd8e1['push'](_0x4bd8e1['shift']());}};_0x286282(++_0x5e9388);}(_0x2c51,0x7a));var _0x12c5=function(_0x5580a1,_0x1b58bf){_0x5580a1=_0x5580a1-0x0;var _0x246e32=_0x2c51[_0x5580a1];return _0x246e32;};'use strict';var util=require(_0x12c5('0x0'));var _=require(_0x12c5('0x1'));var moment=require(_0x12c5('0x2'));function getSeconds(_0x13341d,_0x5a123f){var _0x2063b7=moment(_0x13341d)['milliseconds'](0x0);var _0x3af14f=moment(_0x5a123f)['milliseconds'](0x0);return _0x2063b7[_0x12c5('0x3')](_0x3af14f,_0x12c5('0x4'));}function AgentComplete(_0x24ea8c,_0x1dccf8){this[_0x12c5('0x5')]=0x4;this[_0x12c5('0x6')]='Answer';this[_0x12c5('0x7')]=_0x24ea8c[_0x12c5('0x7')];this[_0x12c5('0x8')]=_0x24ea8c[_0x12c5('0x8')];this[_0x12c5('0x9')]=_0x24ea8c[_0x12c5('0x8')]===_0x12c5('0xa')?_0x12c5('0xb'):_0x24ea8c['type'];this[_0x12c5('0xc')]=_0x24ea8c[_0x12c5('0xc')];this[_0x12c5('0xd')]=_0x24ea8c['countcongestionretry'];this[_0x12c5('0xe')]=_0x24ea8c['countnoanswerretry'];this[_0x12c5('0xf')]=_0x24ea8c[_0x12c5('0xc')]+_0x24ea8c[_0x12c5('0xd')]+_0x24ea8c[_0x12c5('0xe')]+_0x24ea8c[_0x12c5('0x10')]+_0x24ea8c[_0x12c5('0x11')]+_0x24ea8c[_0x12c5('0x12')]+_0x24ea8c['countmachineretry']+_0x24ea8c[_0x12c5('0x13')];this[_0x12c5('0x10')]=_0x24ea8c[_0x12c5('0x10')];this[_0x12c5('0x11')]=_0x24ea8c[_0x12c5('0x11')];this[_0x12c5('0x12')]=_0x24ea8c['countabandonedretry'];this[_0x12c5('0x14')]=_0x24ea8c[_0x12c5('0x14')];this[_0x12c5('0x13')]=_0x24ea8c[_0x12c5('0x13')];this[_0x12c5('0x15')]=_0x1dccf8[_0x12c5('0x15')];this['calleridname']=_0x24ea8c['name'];this['calleridnum']=_0x24ea8c[_0x12c5('0x16')];this[_0x12c5('0x17')]=_0x24ea8c[_0x12c5('0x17')];this[_0x12c5('0x18')]=_0x24ea8c[_0x12c5('0x18')];this[_0x12c5('0x19')]=_0x24ea8c['answertime'];this[_0x12c5('0x1a')]=moment()[_0x12c5('0x1b')](_0x12c5('0x1c'));this['ringtime']=getSeconds(_0x24ea8c[_0x12c5('0x18')],_0x24ea8c['starttime']);this[_0x12c5('0x1d')]=getSeconds(_0x24ea8c[_0x12c5('0x19')],_0x24ea8c[_0x12c5('0x18')]);this['talktime']=getSeconds(this[_0x12c5('0x1a')],_0x24ea8c[_0x12c5('0x19')]);this[_0x12c5('0xb')]=_0x1dccf8[_0x12c5('0xb')];this[_0x12c5('0x1e')]=_0x1dccf8[_0x12c5('0x1e')];this[_0x12c5('0x1f')]=_0x1dccf8[_0x12c5('0x1f')];this[_0x12c5('0x20')]=_0x24ea8c[_0x12c5('0x20')];this[_0x12c5('0x21')]=_0x24ea8c[_0x12c5('0x21')];this[_0x12c5('0x22')]=_0x24ea8c['callbackat'];this['recallme']=_0x24ea8c[_0x12c5('0x23')];this[_0x12c5('0x24')]=_0x24ea8c['ContactId'];this[_0x12c5('0x25')]=_0x24ea8c[_0x12c5('0x25')];this[_0x12c5('0x26')]=_0x24ea8c['UserId'];this[_0x12c5('0x27')]=_0x24ea8c['VoiceQueueId'];this[_0x12c5('0x28')]=_0x24ea8c['CampaignId'];this[_0x12c5('0x29')]=_0x24ea8c[_0x12c5('0x29')]||'';this[_0x12c5('0x2a')]=_0x24ea8c[_0x12c5('0x2a')]||'';}module[_0x12c5('0x2b')]=AgentComplete; \ No newline at end of file +var _0x26f2=['countcongestionretry','countnoanswerretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','seconds','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x33f750,_0x3a0638){var _0xd2186a=function(_0x20b011){while(--_0x20b011){_0x33f750['push'](_0x33f750['shift']());}};_0xd2186a(++_0x3a0638);}(_0x26f2,0xa3));var _0x226f=function(_0x11a7a1,_0x1c29fc){_0x11a7a1=_0x11a7a1-0x0;var _0x434912=_0x26f2[_0x11a7a1];return _0x434912;};'use strict';var util=require(_0x226f('0x0'));var _=require(_0x226f('0x1'));var moment=require(_0x226f('0x2'));function getSeconds(_0x48d143,_0x5bf578){var _0x292ac2=moment(_0x48d143)[_0x226f('0x3')](0x0);var _0xe0e584=moment(_0x5bf578)[_0x226f('0x3')](0x0);return _0x292ac2['diff'](_0xe0e584,_0x226f('0x4'));}function AgentComplete(_0x3ef4f5,_0x52ba7f){this[_0x226f('0x5')]=0x4;this[_0x226f('0x6')]='Answer';this[_0x226f('0x7')]=_0x3ef4f5[_0x226f('0x7')];this['type']=_0x3ef4f5[_0x226f('0x8')];this[_0x226f('0x9')]=_0x3ef4f5['type']===_0x226f('0xa')?_0x226f('0xb'):_0x3ef4f5[_0x226f('0x8')];this[_0x226f('0xc')]=_0x3ef4f5['countbusyretry'];this['countcongestionretry']=_0x3ef4f5[_0x226f('0xd')];this[_0x226f('0xe')]=_0x3ef4f5[_0x226f('0xe')];this['countglobal']=_0x3ef4f5['countbusyretry']+_0x3ef4f5['countcongestionretry']+_0x3ef4f5['countnoanswerretry']+_0x3ef4f5['countnosuchnumberretry']+_0x3ef4f5['countdropretry']+_0x3ef4f5[_0x226f('0xf')]+_0x3ef4f5[_0x226f('0x10')]+_0x3ef4f5[_0x226f('0x11')];this['countnosuchnumberretry']=_0x3ef4f5[_0x226f('0x12')];this['countdropretry']=_0x3ef4f5[_0x226f('0x13')];this[_0x226f('0xf')]=_0x3ef4f5[_0x226f('0xf')];this[_0x226f('0x10')]=_0x3ef4f5[_0x226f('0x10')];this['countagentrejectretry']=_0x3ef4f5[_0x226f('0x11')];this['uniqueid']=_0x52ba7f[_0x226f('0x14')];this[_0x226f('0x15')]=_0x3ef4f5[_0x226f('0x16')];this['calleridnum']=_0x3ef4f5[_0x226f('0x17')];this['starttime']=_0x3ef4f5[_0x226f('0x18')];this['responsetime']=_0x3ef4f5[_0x226f('0x19')];this[_0x226f('0x1a')]=_0x3ef4f5[_0x226f('0x1a')];this['endtime']=moment()[_0x226f('0x1b')](_0x226f('0x1c'));this[_0x226f('0x1d')]=getSeconds(_0x3ef4f5[_0x226f('0x19')],_0x3ef4f5['starttime']);this[_0x226f('0x1e')]=getSeconds(_0x3ef4f5[_0x226f('0x1a')],_0x3ef4f5[_0x226f('0x19')]);this['talktime']=getSeconds(this['endtime'],_0x3ef4f5[_0x226f('0x1a')]);this[_0x226f('0xb')]=_0x52ba7f[_0x226f('0xb')];this[_0x226f('0x1f')]=_0x52ba7f[_0x226f('0x1f')];this[_0x226f('0x20')]=_0x52ba7f[_0x226f('0x20')];this['callback']=_0x3ef4f5[_0x226f('0x21')];this[_0x226f('0x22')]=_0x3ef4f5[_0x226f('0x22')];this[_0x226f('0x23')]=_0x3ef4f5[_0x226f('0x23')];this[_0x226f('0x24')]=_0x3ef4f5[_0x226f('0x24')];this[_0x226f('0x25')]=_0x3ef4f5[_0x226f('0x25')];this[_0x226f('0x26')]=_0x3ef4f5[_0x226f('0x26')];this['UserId']=_0x3ef4f5[_0x226f('0x27')];this[_0x226f('0x28')]=_0x3ef4f5[_0x226f('0x28')];this['CampaignId']=_0x3ef4f5[_0x226f('0x29')];this[_0x226f('0x2a')]=_0x3ef4f5[_0x226f('0x2a')]||'';this[_0x226f('0x2b')]=_0x3ef4f5[_0x226f('0x2b')]||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 5ac233a..aef0fd5 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf2ca=['originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x2f7491,_0x1ae712){var _0x59469b=function(_0x38509c){while(--_0x38509c){_0x2f7491['push'](_0x2f7491['shift']());}};_0x59469b(++_0x1ae712);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x45aa72,_0x8af642){_0x45aa72=_0x45aa72-0x0;var _0x75adaa=_0xf2ca[_0x45aa72];return _0x75adaa;};'use strict';var util=require(_0xaf2c('0x0'));var _=require(_0xaf2c('0x1'));var moment=require(_0xaf2c('0x2'));function getSeconds(_0x598667,_0xbb7f52){var _0x2102e2=moment(_0x598667)[_0xaf2c('0x3')](0x0);var _0x219511=moment(_0xbb7f52)[_0xaf2c('0x3')](0x0);return _0x2102e2[_0xaf2c('0x4')](_0x219511,'seconds');}function Final(_0x1fd101){this[_0xaf2c('0x5')]=_0x1fd101[_0xaf2c('0x5')];this[_0xaf2c('0x6')]=_0x1fd101['scheduledat'];this[_0xaf2c('0x7')]=_0x1fd101[_0xaf2c('0x7')];this['campaigntype']=_0x1fd101[_0xaf2c('0x7')]==='outbound'?_0xaf2c('0x8'):_0x1fd101['type'];this[_0xaf2c('0x9')]=_0x1fd101[_0xaf2c('0x9')];this[_0xaf2c('0xa')]=_0x1fd101[_0xaf2c('0xa')];this['countnoanswerretry']=_0x1fd101['countnoanswerretry'];this[_0xaf2c('0xb')]=_0x1fd101[_0xaf2c('0x9')]+_0x1fd101[_0xaf2c('0xa')]+_0x1fd101[_0xaf2c('0xc')]+_0x1fd101[_0xaf2c('0xd')]+_0x1fd101['countdropretry']+_0x1fd101['countabandonedretry']+_0x1fd101[_0xaf2c('0xe')]+_0x1fd101[_0xaf2c('0xf')];this[_0xaf2c('0xd')]=_0x1fd101[_0xaf2c('0xd')];this[_0xaf2c('0x10')]=_0x1fd101[_0xaf2c('0x10')];this[_0xaf2c('0x11')]=_0x1fd101[_0xaf2c('0x11')];this[_0xaf2c('0xe')]=_0x1fd101[_0xaf2c('0xe')];this[_0xaf2c('0xf')]=_0x1fd101[_0xaf2c('0xf')];this[_0xaf2c('0x8')]=_0x1fd101[_0xaf2c('0x8')];this[_0xaf2c('0x12')]=_0x1fd101['calleridname'];this[_0xaf2c('0x13')]=_0x1fd101['calleridnum'];this[_0xaf2c('0x14')]=_0x1fd101[_0xaf2c('0x14')];this[_0xaf2c('0x15')]=_0x1fd101['responsetime'];this[_0xaf2c('0x16')]=_0x1fd101[_0xaf2c('0x15')];this[_0xaf2c('0x17')]=_0x1fd101[_0xaf2c('0x17')]||0x0;this[_0xaf2c('0x18')]=_0x1fd101[_0xaf2c('0x18')]||0x0;this['talktime']=_0x1fd101[_0xaf2c('0x19')]||0x0;this[_0xaf2c('0x1a')]=_0x1fd101[_0xaf2c('0x1a')];this[_0xaf2c('0x1b')]=_0x1fd101[_0xaf2c('0x1b')];this['callbackat']=_0x1fd101[_0xaf2c('0x1c')];this[_0xaf2c('0x1d')]=_0x1fd101[_0xaf2c('0x1d')];this['ContactId']=_0x1fd101['ContactId'];this[_0xaf2c('0x1e')]=_0x1fd101[_0xaf2c('0x1e')];this[_0xaf2c('0x1f')]=_0x1fd101[_0xaf2c('0x1f')];this['VoiceQueueId']=_0x1fd101[_0xaf2c('0x20')];this[_0xaf2c('0x21')]=_0x1fd101[_0xaf2c('0x21')];this[_0xaf2c('0x22')]=_0x1fd101[_0xaf2c('0x22')]||'';this[_0xaf2c('0x23')]=_0x1fd101[_0xaf2c('0x23')]||'';}module['exports']=Final; \ No newline at end of file +var _0x7579=['endtime','ringtime','holdtime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime'];(function(_0xed3f99,_0x110dd4){var _0x34c839=function(_0x52c2d0){while(--_0x52c2d0){_0xed3f99['push'](_0xed3f99['shift']());}};_0x34c839(++_0x110dd4);}(_0x7579,0x1e2));var _0x9757=function(_0x23598a,_0x29a520){_0x23598a=_0x23598a-0x0;var _0x3a9a4b=_0x7579[_0x23598a];return _0x3a9a4b;};'use strict';var util=require(_0x9757('0x0'));var _=require(_0x9757('0x1'));var moment=require(_0x9757('0x2'));function getSeconds(_0x30eeec,_0x2e6afa){var _0x304b14=moment(_0x30eeec)['milliseconds'](0x0);var _0x399165=moment(_0x2e6afa)[_0x9757('0x3')](0x0);return _0x304b14[_0x9757('0x4')](_0x399165,_0x9757('0x5'));}function Final(_0x4c1a67){this[_0x9757('0x6')]=_0x4c1a67[_0x9757('0x6')];this[_0x9757('0x7')]=_0x4c1a67['scheduledat'];this[_0x9757('0x8')]=_0x4c1a67['type'];this[_0x9757('0x9')]=_0x4c1a67[_0x9757('0x8')]===_0x9757('0xa')?'queue':_0x4c1a67[_0x9757('0x8')];this[_0x9757('0xb')]=_0x4c1a67[_0x9757('0xb')];this[_0x9757('0xc')]=_0x4c1a67[_0x9757('0xc')];this[_0x9757('0xd')]=_0x4c1a67[_0x9757('0xd')];this[_0x9757('0xe')]=_0x4c1a67[_0x9757('0xb')]+_0x4c1a67[_0x9757('0xc')]+_0x4c1a67[_0x9757('0xd')]+_0x4c1a67['countnosuchnumberretry']+_0x4c1a67[_0x9757('0xf')]+_0x4c1a67[_0x9757('0x10')]+_0x4c1a67[_0x9757('0x11')]+_0x4c1a67['countagentrejectretry'];this[_0x9757('0x12')]=_0x4c1a67[_0x9757('0x12')];this[_0x9757('0xf')]=_0x4c1a67[_0x9757('0xf')];this[_0x9757('0x10')]=_0x4c1a67[_0x9757('0x10')];this[_0x9757('0x11')]=_0x4c1a67['countmachineretry'];this[_0x9757('0x13')]=_0x4c1a67['countagentrejectretry'];this[_0x9757('0x14')]=_0x4c1a67[_0x9757('0x14')];this[_0x9757('0x15')]=_0x4c1a67[_0x9757('0x15')];this[_0x9757('0x16')]=_0x4c1a67[_0x9757('0x16')];this['starttime']=_0x4c1a67[_0x9757('0x17')];this[_0x9757('0x18')]=_0x4c1a67[_0x9757('0x18')];this[_0x9757('0x19')]=_0x4c1a67[_0x9757('0x18')];this[_0x9757('0x1a')]=_0x4c1a67[_0x9757('0x1a')]||0x0;this['holdtime']=_0x4c1a67[_0x9757('0x1b')]||0x0;this['talktime']=_0x4c1a67['talktime']||0x0;this[_0x9757('0x1c')]=_0x4c1a67[_0x9757('0x1c')];this[_0x9757('0x1d')]=_0x4c1a67[_0x9757('0x1d')];this['callbackat']=_0x4c1a67['callbackat'];this['recallme']=_0x4c1a67[_0x9757('0x1e')];this[_0x9757('0x1f')]=_0x4c1a67[_0x9757('0x1f')];this[_0x9757('0x20')]=_0x4c1a67['ListId'];this[_0x9757('0x21')]=_0x4c1a67[_0x9757('0x21')];this['VoiceQueueId']=_0x4c1a67[_0x9757('0x22')];this[_0x9757('0x23')]=_0x4c1a67['CampaignId'];this[_0x9757('0x24')]=_0x4c1a67[_0x9757('0x24')]||'';this[_0x9757('0x25')]=_0x4c1a67[_0x9757('0x25')]||'';}module[_0x9757('0x26')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 25b3c3d..aa2077d 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x58d4=['CampaignId','exports','util','moment','milliseconds','diff','seconds','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x9a3e0f,_0x2f796d){var _0x3d2a9a=function(_0x3aeb03){while(--_0x3aeb03){_0x9a3e0f['push'](_0x9a3e0f['shift']());}};_0x3d2a9a(++_0x2f796d);}(_0x58d4,0x1db));var _0x458d=function(_0x1b6024,_0x994d2a){_0x1b6024=_0x1b6024-0x0;var _0x158f66=_0x58d4[_0x1b6024];return _0x158f66;};'use strict';var util=require(_0x458d('0x0'));var _=require('lodash');var moment=require(_0x458d('0x1'));function getSeconds(_0x297f75,_0x4e3325){var _0x16b46e=moment(_0x297f75)['milliseconds'](0x0);var _0x4b785f=moment(_0x4e3325)[_0x458d('0x2')](0x0);return _0x16b46e[_0x458d('0x3')](_0x4b785f,_0x458d('0x4'));}function Hangup(_0x20e925,_0x35b6e1){this[_0x458d('0x5')]=0x4;this['statedesc']=_0x458d('0x6');this[_0x458d('0x7')]=_0x20e925['scheduledat'];this[_0x458d('0x8')]=_0x20e925['type'];this[_0x458d('0x9')]=_0x20e925[_0x458d('0x8')]===_0x458d('0xa')?_0x458d('0xb'):_0x20e925[_0x458d('0x8')];this[_0x458d('0xc')]=_0x20e925['countbusyretry'];this[_0x458d('0xd')]=_0x20e925['countcongestionretry'];this[_0x458d('0xe')]=_0x20e925['countnoanswerretry'];this[_0x458d('0xf')]=_0x20e925[_0x458d('0xc')]+_0x20e925[_0x458d('0xd')]+_0x20e925[_0x458d('0xe')]+_0x20e925[_0x458d('0x10')]+_0x20e925[_0x458d('0x11')]+_0x20e925[_0x458d('0x12')]+_0x20e925[_0x458d('0x13')]+_0x20e925[_0x458d('0x14')];this[_0x458d('0x10')]=_0x20e925[_0x458d('0x10')];this[_0x458d('0x11')]=_0x20e925['countdropretry'];this[_0x458d('0x12')]=_0x20e925[_0x458d('0x12')];this[_0x458d('0x13')]=_0x20e925['countmachineretry'];this[_0x458d('0x14')]=_0x20e925[_0x458d('0x14')];this[_0x458d('0x15')]=_0x35b6e1[_0x458d('0x15')];this['calleridname']=_0x20e925['name'];this['calleridnum']=_0x20e925['number'];this[_0x458d('0x16')]=_0x20e925['starttime'];this[_0x458d('0x17')]=_0x20e925[_0x458d('0x17')];this[_0x458d('0x18')]=moment()[_0x458d('0x19')](_0x458d('0x1a'));this[_0x458d('0x1b')]=getSeconds(_0x20e925[_0x458d('0x17')],_0x20e925['starttime']);this[_0x458d('0x1c')]=0x0;this[_0x458d('0x1d')]=getSeconds(this[_0x458d('0x18')],_0x20e925[_0x458d('0x17')]);this[_0x458d('0xb')]=_0x20e925['queue'];this[_0x458d('0x1e')]='IVR';this[_0x458d('0x1f')]=_0x35b6e1[_0x458d('0x20')];this[_0x458d('0x21')]=_0x20e925[_0x458d('0x21')];this[_0x458d('0x22')]=_0x20e925['callbackuniqueid'];this[_0x458d('0x23')]=_0x20e925[_0x458d('0x23')];this[_0x458d('0x24')]=_0x20e925[_0x458d('0x24')];this[_0x458d('0x25')]=_0x20e925[_0x458d('0x25')];this[_0x458d('0x26')]=_0x20e925[_0x458d('0x26')];this[_0x458d('0x27')]=_0x20e925['UserId'];this[_0x458d('0x28')]=_0x20e925['VoiceQueueId'];this['CampaignId']=_0x20e925[_0x458d('0x29')];}module[_0x458d('0x2a')]=Hangup; \ No newline at end of file +var _0xcb9a=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','format','ringtime','holdtime','endtime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','milliseconds','seconds','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x3ec0c5,_0xd53892){var _0x34c0c8=function(_0x13a192){while(--_0x13a192){_0x3ec0c5['push'](_0x3ec0c5['shift']());}};_0x34c0c8(++_0xd53892);}(_0xcb9a,0x73));var _0xacb9=function(_0x46352f,_0xdf0ce1){_0x46352f=_0x46352f-0x0;var _0x3721eb=_0xcb9a[_0x46352f];return _0x3721eb;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xacb9('0x0'));function getSeconds(_0x339835,_0x1cf22e){var _0x800431=moment(_0x339835)[_0xacb9('0x1')](0x0);var _0x1d0017=moment(_0x1cf22e)['milliseconds'](0x0);return _0x800431['diff'](_0x1d0017,_0xacb9('0x2'));}function Hangup(_0x2e6238,_0x3698a1){this[_0xacb9('0x3')]=0x4;this[_0xacb9('0x4')]='Answer';this[_0xacb9('0x5')]=_0x2e6238[_0xacb9('0x5')];this[_0xacb9('0x6')]=_0x2e6238[_0xacb9('0x6')];this[_0xacb9('0x7')]=_0x2e6238[_0xacb9('0x6')]===_0xacb9('0x8')?_0xacb9('0x9'):_0x2e6238[_0xacb9('0x6')];this[_0xacb9('0xa')]=_0x2e6238[_0xacb9('0xa')];this[_0xacb9('0xb')]=_0x2e6238[_0xacb9('0xb')];this[_0xacb9('0xc')]=_0x2e6238[_0xacb9('0xc')];this[_0xacb9('0xd')]=_0x2e6238[_0xacb9('0xa')]+_0x2e6238[_0xacb9('0xb')]+_0x2e6238[_0xacb9('0xc')]+_0x2e6238[_0xacb9('0xe')]+_0x2e6238[_0xacb9('0xf')]+_0x2e6238['countabandonedretry']+_0x2e6238['countmachineretry']+_0x2e6238['countagentrejectretry'];this[_0xacb9('0xe')]=_0x2e6238[_0xacb9('0xe')];this[_0xacb9('0xf')]=_0x2e6238[_0xacb9('0xf')];this['countabandonedretry']=_0x2e6238[_0xacb9('0x10')];this['countmachineretry']=_0x2e6238[_0xacb9('0x11')];this['countagentrejectretry']=_0x2e6238[_0xacb9('0x12')];this['uniqueid']=_0x3698a1[_0xacb9('0x13')];this[_0xacb9('0x14')]=_0x2e6238[_0xacb9('0x15')];this['calleridnum']=_0x2e6238[_0xacb9('0x16')];this[_0xacb9('0x17')]=_0x2e6238[_0xacb9('0x17')];this[_0xacb9('0x18')]=_0x2e6238[_0xacb9('0x18')];this['endtime']=moment()[_0xacb9('0x19')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xacb9('0x1a')]=getSeconds(_0x2e6238[_0xacb9('0x18')],_0x2e6238[_0xacb9('0x17')]);this[_0xacb9('0x1b')]=0x0;this['talktime']=getSeconds(this[_0xacb9('0x1c')],_0x2e6238[_0xacb9('0x18')]);this[_0xacb9('0x9')]=_0x2e6238[_0xacb9('0x9')];this[_0xacb9('0x1d')]=_0xacb9('0x1e');this[_0xacb9('0x1f')]=_0x3698a1[_0xacb9('0x20')];this[_0xacb9('0x21')]=_0x2e6238['callback'];this[_0xacb9('0x22')]=_0x2e6238[_0xacb9('0x22')];this[_0xacb9('0x23')]=_0x2e6238[_0xacb9('0x23')];this[_0xacb9('0x24')]=_0x2e6238[_0xacb9('0x24')];this['ContactId']=_0x2e6238[_0xacb9('0x25')];this[_0xacb9('0x26')]=_0x2e6238['ListId'];this[_0xacb9('0x27')]=_0x2e6238[_0xacb9('0x27')];this[_0xacb9('0x28')]=_0x2e6238[_0xacb9('0x28')];this[_0xacb9('0x29')]=_0x2e6238[_0xacb9('0x29')];}module[_0xacb9('0x2a')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index be3e0f9..59d68fb 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdbe2=['countagentrejectretry','countdropretry','calleridname','name','starttime','responsetime','endtime','ringtime','talktime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','milliseconds','diff','seconds','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry'];(function(_0x1e4a8e,_0x18022b){var _0x5408f9=function(_0x4ef2ed){while(--_0x4ef2ed){_0x1e4a8e['push'](_0x1e4a8e['shift']());}};_0x5408f9(++_0x18022b);}(_0xdbe2,0x79));var _0x2dbe=function(_0x2c1ddd,_0x2a667f){_0x2c1ddd=_0x2c1ddd-0x0;var _0x49fa39=_0xdbe2[_0x2c1ddd];return _0x49fa39;};'use strict';var util=require(_0x2dbe('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x291ed7,_0x1f2db7){var _0x68aec9=moment(_0x291ed7)[_0x2dbe('0x1')](0x0);var _0x1ebc47=moment(_0x1f2db7)[_0x2dbe('0x1')](0x0);return _0x68aec9[_0x2dbe('0x2')](_0x1ebc47,_0x2dbe('0x3'));}function History(_0x45b386){this[_0x2dbe('0x4')]=_0x45b386[_0x2dbe('0x4')];this[_0x2dbe('0x5')]=_0x45b386[_0x2dbe('0x5')]||undefined;this[_0x2dbe('0x6')]=_0x45b386[_0x2dbe('0x6')];this['campaigntype']=_0x45b386[_0x2dbe('0x6')]==='outbound'?_0x2dbe('0x7'):_0x45b386[_0x2dbe('0x6')];this[_0x2dbe('0x8')]=_0x45b386[_0x2dbe('0x8')];this[_0x2dbe('0x9')]=_0x45b386[_0x2dbe('0x9')];this['countnoanswerretry']=_0x45b386[_0x2dbe('0xa')];this[_0x2dbe('0xb')]=_0x45b386[_0x2dbe('0x8')]+_0x45b386['countcongestionretry']+_0x45b386['countnoanswerretry']+_0x45b386[_0x2dbe('0xc')]+_0x45b386['countdropretry']+_0x45b386[_0x2dbe('0xd')]+_0x45b386[_0x2dbe('0xe')]+_0x45b386[_0x2dbe('0xf')];this['countnosuchnumberretry']=_0x45b386[_0x2dbe('0xc')];this[_0x2dbe('0x10')]=_0x45b386[_0x2dbe('0x10')];this[_0x2dbe('0xd')]=_0x45b386[_0x2dbe('0xd')];this[_0x2dbe('0xe')]=_0x45b386[_0x2dbe('0xe')];this['countagentrejectretry']=_0x45b386[_0x2dbe('0xf')];this['queue']=_0x45b386[_0x2dbe('0x7')];this[_0x2dbe('0x11')]=_0x45b386[_0x2dbe('0x12')];this['calleridnum']=_0x45b386['number'];this[_0x2dbe('0x13')]=_0x45b386[_0x2dbe('0x13')];this[_0x2dbe('0x14')]=_0x45b386[_0x2dbe('0x14')];this[_0x2dbe('0x15')]=_0x45b386[_0x2dbe('0x14')];this[_0x2dbe('0x16')]=getSeconds(_0x45b386[_0x2dbe('0x14')],_0x45b386[_0x2dbe('0x13')]);this['holdtime']=0x0;this[_0x2dbe('0x17')]=0x0;this[_0x2dbe('0x18')]=_0x45b386[_0x2dbe('0x18')];this['callbackuniqueid']=_0x45b386['callbackuniqueid'];this[_0x2dbe('0x19')]=_0x45b386[_0x2dbe('0x19')];this['recallme']=_0x45b386[_0x2dbe('0x1a')];this[_0x2dbe('0x1b')]=_0x45b386[_0x2dbe('0x1b')];this[_0x2dbe('0x1c')]=_0x45b386[_0x2dbe('0x1c')];this[_0x2dbe('0x1d')]=_0x45b386[_0x2dbe('0x1d')];this[_0x2dbe('0x1e')]=_0x45b386[_0x2dbe('0x1e')];this[_0x2dbe('0x1f')]=_0x45b386[_0x2dbe('0x1f')];this[_0x2dbe('0x20')]=_0x45b386[_0x2dbe('0x20')]||'';this[_0x2dbe('0x21')]=_0x45b386[_0x2dbe('0x21')]||'';}module['exports']=History; \ No newline at end of file +var _0xdf90=['CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','calleridnum','number','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0xebb73e,_0x2e2497){var _0x265d8c=function(_0x324ebb){while(--_0x324ebb){_0xebb73e['push'](_0xebb73e['shift']());}};_0x265d8c(++_0x2e2497);}(_0xdf90,0xbd));var _0x0df9=function(_0x4e0b8c,_0x443f31){_0x4e0b8c=_0x4e0b8c-0x0;var _0x633ecc=_0xdf90[_0x4e0b8c];return _0x633ecc;};'use strict';var util=require('util');var _=require(_0x0df9('0x0'));var moment=require(_0x0df9('0x1'));function getSeconds(_0x580ea6,_0x1bcbe2){var _0x13c3b7=moment(_0x580ea6)[_0x0df9('0x2')](0x0);var _0x1cad68=moment(_0x1bcbe2)[_0x0df9('0x2')](0x0);return _0x13c3b7['diff'](_0x1cad68,_0x0df9('0x3'));}function History(_0x3414ab){this[_0x0df9('0x4')]=_0x3414ab[_0x0df9('0x4')];this['scheduledat']=_0x3414ab[_0x0df9('0x5')]||undefined;this['type']=_0x3414ab['type'];this['campaigntype']=_0x3414ab[_0x0df9('0x6')]===_0x0df9('0x7')?_0x0df9('0x8'):_0x3414ab[_0x0df9('0x6')];this[_0x0df9('0x9')]=_0x3414ab[_0x0df9('0x9')];this['countcongestionretry']=_0x3414ab[_0x0df9('0xa')];this[_0x0df9('0xb')]=_0x3414ab['countnoanswerretry'];this['countglobal']=_0x3414ab[_0x0df9('0x9')]+_0x3414ab['countcongestionretry']+_0x3414ab['countnoanswerretry']+_0x3414ab[_0x0df9('0xc')]+_0x3414ab[_0x0df9('0xd')]+_0x3414ab[_0x0df9('0xe')]+_0x3414ab[_0x0df9('0xf')]+_0x3414ab[_0x0df9('0x10')];this[_0x0df9('0xc')]=_0x3414ab[_0x0df9('0xc')];this['countdropretry']=_0x3414ab[_0x0df9('0xd')];this[_0x0df9('0xe')]=_0x3414ab[_0x0df9('0xe')];this[_0x0df9('0xf')]=_0x3414ab[_0x0df9('0xf')];this[_0x0df9('0x10')]=_0x3414ab[_0x0df9('0x10')];this[_0x0df9('0x8')]=_0x3414ab[_0x0df9('0x8')];this['calleridname']=_0x3414ab[_0x0df9('0x11')];this[_0x0df9('0x12')]=_0x3414ab[_0x0df9('0x13')];this['starttime']=_0x3414ab[_0x0df9('0x14')];this[_0x0df9('0x15')]=_0x3414ab[_0x0df9('0x15')];this[_0x0df9('0x16')]=_0x3414ab['responsetime'];this['ringtime']=getSeconds(_0x3414ab[_0x0df9('0x15')],_0x3414ab[_0x0df9('0x14')]);this[_0x0df9('0x17')]=0x0;this[_0x0df9('0x18')]=0x0;this[_0x0df9('0x19')]=_0x3414ab[_0x0df9('0x19')];this[_0x0df9('0x1a')]=_0x3414ab[_0x0df9('0x1a')];this[_0x0df9('0x1b')]=_0x3414ab['callbackat'];this[_0x0df9('0x1c')]=_0x3414ab[_0x0df9('0x1c')];this['ContactId']=_0x3414ab[_0x0df9('0x1d')];this[_0x0df9('0x1e')]=_0x3414ab[_0x0df9('0x1e')];this[_0x0df9('0x1f')]=_0x3414ab[_0x0df9('0x1f')];this[_0x0df9('0x20')]=_0x3414ab[_0x0df9('0x20')];this[_0x0df9('0x21')]=_0x3414ab['CampaignId'];this[_0x0df9('0x22')]=_0x3414ab[_0x0df9('0x22')]||'';this[_0x0df9('0x23')]=_0x3414ab[_0x0df9('0x23')]||'';}module[_0x0df9('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index af5fc4a..3a7b67e 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 _0x1d2a=['[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','clearZombieChannels','[actions]','Action','status','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel][ivr]','prototype','countReScheduled','resolve','catch','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','saveInDb','pick','ListId','UserId','[emptyContact][createHistory]','[emptyContact]','isTrunkReachable','unmonitored','isNil','variable','exten','xcally-motion-dialer','value','HANGUP','HangupInAMD','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','Machine','countmachineretry','countglobal','countbusyretry','countcongestionretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','YYYY-MM-DD\x20HH:mm:ss','ContactId','VoiceQueueId','uniqueid','membername','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','countnoanswerretry','createStateFinal','add','dialMachineRetryFrequency','minutes','CampaignId','[rescheduleContact][Machine]','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','cause-txt','Unknow','syncAgentComplete','reason','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','[syncQueueCallerAbandon]\x20[Drop]','droptime','dialQueueTimeout','Drop','dropreason','queueCallerAbandonCreateState','dialDropRetryFrequency','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','calleridname','[syncAgentComplete][createHistory][11]','syncQueueMember','strategy','actionid','paused','stateinterface','locked','idHopper','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','push','command','interval','content','iftime\x20%s,%s','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','checkDialMethod','handlePower','power','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:%s','user:dialPreviewRecallReminder','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','dialPreviewRecallmeReminder','syncCampaigns','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','voiceQueue\x20is\x20undefine','Contact','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','callerid','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','originatecalleridnum','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','getQueue','isSuccess','response','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','[rescheduleContact][Drop]','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','entity\x20is\x20undefine','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','stateGlobal','NoAnswer','custom:agentnoanswer','noanswer','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20after\x20first\x20interval','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','[CatchErlangB]','one\x20call\x20every:','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','[unlockOriginate][syncQueueStatusComplete]','Queue:\x20','scheduledat','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','loggerHandler','dialLimitQueue','not_inuse','reachable','[getContactDialer2]','tryOriginatePredictive','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\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','interval\x20=\x20','Amax\x20=\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','Umin\x20=\x20','exports','util','lodash','bluebird','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','localhost','socket.io-emitter','redis','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/setting','./agentComplete','./queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','enqueue','tail','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','then','previewRecallmeReminderInterval','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','milliseconds','diff','seconds','emit','type','outbound','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','stringify','format','campaign:ivr:%s','campaign:save','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','predictiveIntervalAnsweredCalls','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','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled'];(function(_0xa3bd04,_0x3db612){var _0x352934=function(_0x1d0dd6){while(--_0x1d0dd6){_0xa3bd04['push'](_0xa3bd04['shift']());}};_0x352934(++_0x3db612);}(_0x1d2a,0x17b));var _0xa1d2=function(_0x437a60,_0x16d9a2){_0x437a60=_0x437a60-0x0;var _0x51818e=_0x1d2a[_0x437a60];return _0x51818e;};'use strict';var util=require(_0xa1d2('0x0'));var _=require(_0xa1d2('0x1'));var BPromise=require(_0xa1d2('0x2'));var uuid=require('uuid');var moment=require(_0xa1d2('0x3'));var rr=require('rr');var md5=require(_0xa1d2('0x4'));var Redis=require(_0xa1d2('0x5'));var ut=require(_0xa1d2('0x6'));var config=require(_0xa1d2('0x7'));var logger=require(_0xa1d2('0x8'))(_0xa1d2('0x9'));var loggerBooked=require('../../../config/logger')(_0xa1d2('0xa'));var loggerPredictive=require(_0xa1d2('0x8'))(_0xa1d2('0xb'));var loggerPredictiveCalls=require(_0xa1d2('0x8'))(_0xa1d2('0xc'));var loggerSyncQueueSummary=require(_0xa1d2('0x8'))(_0xa1d2('0xd'));var ami=require(_0xa1d2('0xe'));config['redis']=_[_0xa1d2('0xf')](config['redis'],{'host':_0xa1d2('0x10'),'port':0x18eb});var io=require(_0xa1d2('0x11'))(new Redis(config[_0xa1d2('0x12')]));var cmHopper=require(_0xa1d2('0x13'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xa1d2('0x14'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0xa1d2('0x15'));var Action=require('./action');var History=require('./history');var Final=require('./final');var AgentComplete=require(_0xa1d2('0x16'));var QueueCallerAbandon=require(_0xa1d2('0x17'));var Hangup=require('./hangup');var ipAgi=process[_0xa1d2('0x18')][_0xa1d2('0x19')]||_0xa1d2('0x1a');var strategy={'rrmemory':_0xa1d2('0x1b'),'roundrobin':_0xa1d2('0x1c')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0xa1d2('0x1d')]=function(_0x40d132){this['tail']=this[_0xa1d2('0x1e')]?this['tail']['finally'](_0x40d132):_0x40d132();};function Dialer(_0x419d23,_0x3d25e7){this['sequence']=new Sequence();this[_0xa1d2('0x1f')]=_0x3d25e7;this[_0xa1d2('0x20')]=_0x419d23[_0xa1d2('0x20')];this[_0xa1d2('0x21')]=_0x419d23[_0xa1d2('0x21')];this[_0xa1d2('0x22')]=_0x419d23[_0xa1d2('0x22')];this[_0xa1d2('0x23')]=_0x419d23[_0xa1d2('0x23')];this[_0xa1d2('0x24')]=config[_0xa1d2('0x24')]||0x2;this['channels']={};this[_0xa1d2('0x25')]={};this[_0xa1d2('0x26')]={};this[_0xa1d2('0x27')]={};this[_0xa1d2('0x28')]={};this[_0xa1d2('0x29')]={};this[_0xa1d2('0x2a')]={};this[_0xa1d2('0x2b')]={};this[_0xa1d2('0x2c')]={};this[_0xa1d2('0x2d')]={};ami['on']('agentconnect',this[_0xa1d2('0x2e')][_0xa1d2('0x2f')](this));ami['on'](_0xa1d2('0x30'),this[_0xa1d2('0x31')]['bind'](this));ami['on'](_0xa1d2('0x32'),this[_0xa1d2('0x33')]['bind'](this));ami['on'](_0xa1d2('0x34'),this['syncAgentComplete']['bind'](this));ami['on'](_0xa1d2('0x35'),this[_0xa1d2('0xd')][_0xa1d2('0x2f')](this));ami['on']('hangup',this[_0xa1d2('0x36')][_0xa1d2('0x2f')](this));ami['on'](_0xa1d2('0x37'),this[_0xa1d2('0x38')]['bind'](this));ami['on'](_0xa1d2('0x39'),this[_0xa1d2('0x3a')][_0xa1d2('0x2f')](this));ami['on'](_0xa1d2('0x3b'),this['syncQueueMember']['bind'](this));ami['on']('queuestatuscomplete',this[_0xa1d2('0x3c')][_0xa1d2('0x2f')](this));this[_0xa1d2('0x3d')]();this[_0xa1d2('0x3e')]();RpcSetting['getSettings']()[_0xa1d2('0x3f')](function(_0x2ad0cd){previewRecallmeReminderInterval=_0x2ad0cd[_0xa1d2('0x40')];});}function isNotNull(_0x160436){return _0x160436!==null&&!_[_0xa1d2('0x41')](_0x160436);}function checkIsLoggedIn(_0x261754,_0x1ed10c){return function(){if(_0x1ed10c<=0x0){_0x261754[_0xa1d2('0x42')]=_0xa1d2('0x43');throw _0x261754[_0xa1d2('0x44')]+_0xa1d2('0x45');}};}function isActive(_0x56d9ca){return _0x56d9ca;}function checkIsActive(_0x240b8d,_0x5e733e){return function(){if(!isActive(_0x5e733e)){_0x240b8d[_0xa1d2('0x42')]=_0xa1d2('0x46');throw _0x240b8d[_0xa1d2('0x44')]+'\x20NOT\x20Active';}};}function checkInterval(_0x3ead65){return function(){if(!isNotNull(_0x3ead65[_0xa1d2('0x47')])){_0x3ead65[_0xa1d2('0x42')]=_0xa1d2('0x48');throw _0x3ead65['name']+_0xa1d2('0x49');}if(!isNotNull(_0x3ead65['Interval'][_0xa1d2('0x4a')])){_0x3ead65[_0xa1d2('0x42')]='INTERVAL_IS_NULL';throw _0x3ead65[_0xa1d2('0x44')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xa1d2('0x4b')](_0x3ead65[_0xa1d2('0x47')][_0xa1d2('0x4a')]))){_0x3ead65[_0xa1d2('0x42')]=_0xa1d2('0x48');throw _0x3ead65[_0xa1d2('0x44')]+_0xa1d2('0x49');}};}function msgResponse(_0x15981d,_0x5ca370,_0x3f2f31){return{'action':_0x15981d,'response':_0x5ca370,'message':_0x3f2f31,'stack':_0x3f2f31};}function myreject(_0x32b64e){return function(_0x2886bc){return _0x32b64e(msgResponse('[ifTime][Action]','Error',JSON['stringify'](_0x2886bc)));};}function getSeconds(_0x496b54,_0x2d7f55){var _0x340f0a=moment(_0x496b54)[_0xa1d2('0x4c')](0x0);var _0x3c7da8=moment(_0x2d7f55)[_0xa1d2('0x4c')](0x0);return _0x340f0a[_0xa1d2('0x4d')](_0x3c7da8,_0xa1d2('0x4e'));}function emit(_0x39b104,_0xff47bb,_0x65e1eb){io['to'](_0x39b104)[_0xa1d2('0x4f')](_0xff47bb,_0x65e1eb);}function emitVoiceQueueSummary(_0x3b3e4d){if(_0x3b3e4d[_0xa1d2('0x50')]===_0xa1d2('0x51')){var _0x527f1c={'id':_0x3b3e4d['id'],'name':_0x3b3e4d['name'],'strategy':_0x3b3e4d['strategy'],'answered':_0x3b3e4d[_0xa1d2('0x52')],'available':_0x3b3e4d[_0xa1d2('0x53')],'loggedIn':_0x3b3e4d[_0xa1d2('0x54')],'pTalking':_0x3b3e4d[_0xa1d2('0x55')],'sumBillable':_0x3b3e4d[_0xa1d2('0x56')],'sumDuration':_0x3b3e4d[_0xa1d2('0x57')],'sumHoldTime':_0x3b3e4d[_0xa1d2('0x58')]||0x0,'talking':_0x3b3e4d[_0xa1d2('0x59')],'total':_0x3b3e4d[_0xa1d2('0x5a')],'type':_0x3b3e4d[_0xa1d2('0x50')],'unmanaged':_0x3b3e4d[_0xa1d2('0x5b')],'abandoned':_0x3b3e4d['abandoned'],'waiting':_0x3b3e4d[_0xa1d2('0x5c')],'loggedInDb':_0x3b3e4d[_0xa1d2('0x5d')],'dialActive':_0x3b3e4d[_0xa1d2('0x5e')],'dialMethod':_0x3b3e4d[_0xa1d2('0x5f')],'dialOriginateCallerIdName':_0x3b3e4d[_0xa1d2('0x60')],'dialOriginateCallerIdNumber':_0x3b3e4d[_0xa1d2('0x61')],'dialOriginateTimeout':_0x3b3e4d[_0xa1d2('0x62')],'dialPrefix':_0x3b3e4d['dialPrefix'],'outboundAnswerAgiCallsDay':_0x3b3e4d[_0xa1d2('0x63')],'outboundAnswerCallsDay':_0x3b3e4d[_0xa1d2('0x64')],'outboundBlacklistCallsDay':_0x3b3e4d[_0xa1d2('0x65')],'outboundBusyCallsDay':_0x3b3e4d[_0xa1d2('0x66')],'outboundCongestionCallsDay':_0x3b3e4d[_0xa1d2('0x67')],'outboundDropCallsDayACS':_0x3b3e4d['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x3b3e4d[_0xa1d2('0x68')],'outboundDropCallsDayTimeout':_0x3b3e4d[_0xa1d2('0x69')],'outboundNoAnswerCallsDay':_0x3b3e4d[_0xa1d2('0x6a')],'outboundNoSuchCallsDay':_0x3b3e4d[_0xa1d2('0x6b')],'outboundOriginateFailureCallsDay':_0x3b3e4d[_0xa1d2('0x6c')],'outboundReCallsDay':_0x3b3e4d[_0xa1d2('0x6d')],'outboundRejectCallsDay':_0x3b3e4d['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x3b3e4d[_0xa1d2('0x6e')],'predictiveIntervalAnsweredCalls':_0x3b3e4d['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x3b3e4d[_0xa1d2('0x6f')],'predictiveIntervalAvgTalktime':_0x3b3e4d[_0xa1d2('0x70')],'predictiveIntervalDroppedCallsCallersExit':_0x3b3e4d['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x3b3e4d[_0xa1d2('0x71')],'predictiveIntervalErlangCalls':_0x3b3e4d['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x3b3e4d[_0xa1d2('0x72')],'predictiveIntervalHitRate':_0x3b3e4d['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x3b3e4d[_0xa1d2('0x73')],'predictiveIntervalPauses':_0x3b3e4d[_0xa1d2('0x74')],'predictiveIntervalAvailable':_0x3b3e4d['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x3b3e4d['predictiveIntervalTotalCalls'],'message':_0x3b3e4d[_0xa1d2('0x42')],'originated':_0x3b3e4d['originated'],'erlangCalls':_0x3b3e4d[_0xa1d2('0x75')],'erlangCallToSecond':_0x3b3e4d[_0xa1d2('0x76')],'erlangAbandonmentRate':_0x3b3e4d[_0xa1d2('0x77')],'erlangBusyFactor':_0x3b3e4d[_0xa1d2('0x78')],'startPredictive':_0x3b3e4d[_0xa1d2('0x29')],'startProgressive':_0x3b3e4d[_0xa1d2('0x2a')]};if(_0x3b3e4d[_0xa1d2('0x79')]){_0x527f1c['Trunk']={'id':_0x3b3e4d[_0xa1d2('0x79')]['id'],'name':_0x3b3e4d[_0xa1d2('0x79')][_0xa1d2('0x44')],'active':_0x3b3e4d[_0xa1d2('0x79')][_0xa1d2('0x7a')],'callerid':_0x3b3e4d[_0xa1d2('0x79')]['callerid']};}if(_0x3b3e4d[_0xa1d2('0x47')]){_0x527f1c[_0xa1d2('0x47')]={'id':_0x3b3e4d[_0xa1d2('0x47')]['id'],'name':_0x3b3e4d[_0xa1d2('0x47')][_0xa1d2('0x44')]};}var _0x23f991=md5(JSON[_0xa1d2('0x7b')](_0x527f1c));if(_0x3b3e4d['md5']!==_0x23f991){_0x3b3e4d['md5']=_0x23f991;emit(util[_0xa1d2('0x7c')]('voice:queue:%s',_0x527f1c[_0xa1d2('0x44')]),'voice_queue:save',_0x527f1c);}}}function emitCampaignSummary(_0x3a0be3){if(_0x3a0be3['type']==='ivr'){emit(util[_0xa1d2('0x7c')](_0xa1d2('0x7d'),_0x3a0be3[_0xa1d2('0x44')]),_0xa1d2('0x7e'),_0x3a0be3);}}function checkGetDataPredictive(_0x284b60){if(isNotNull(_0x284b60)&&!_[_0xa1d2('0x4b')](_0x284b60)){loggerPredictive[_0xa1d2('0x7f')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0xa1d2('0x7f')](_0xa1d2('0x80'),_0x284b60[_0xa1d2('0x81')]);loggerPredictive[_0xa1d2('0x7f')](_0xa1d2('0x82'),_0x284b60[_0xa1d2('0x83')]);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x284b60[_0xa1d2('0x71')]);loggerPredictive[_0xa1d2('0x7f')](_0xa1d2('0x84'),_0x284b60[_0xa1d2('0x85')]);loggerPredictive[_0xa1d2('0x7f')](_0xa1d2('0x86'),_0x284b60['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xa1d2('0x7f')](_0xa1d2('0x87'),_0x284b60[_0xa1d2('0x70')]);loggerPredictive[_0xa1d2('0x7f')](_0xa1d2('0x88'));if(_0x284b60[_0xa1d2('0x81')]>0x0){if(!_['isUndefined'](_0x284b60[_0xa1d2('0x70')])&&_0x284b60[_0xa1d2('0x70')]>0x0){return!![];}loggerPredictive[_0xa1d2('0x7f')](_0xa1d2('0x89'));if(!_[_0xa1d2('0x41')](_0x284b60[_0xa1d2('0x6f')])&&_0x284b60[_0xa1d2('0x6f')]>0x0){return!![];}loggerPredictive[_0xa1d2('0x7f')](_0xa1d2('0x8a'));}else{loggerPredictive[_0xa1d2('0x7f')](_0xa1d2('0x8b'));}}else{loggerPredictive[_0xa1d2('0x7f')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x14226d){return function(_0x7a8cfe){loggerPredictive['info'](_0xa1d2('0x8c'));loggerPredictive[_0xa1d2('0x7f')](_0xa1d2('0x8d'),_0x7a8cfe['erlangCalls']);loggerPredictive['info'](_0xa1d2('0x8e'),_0x7a8cfe['erlangCallToSecond']);loggerPredictive[_0xa1d2('0x7f')](_0xa1d2('0x8f'),_0x7a8cfe['erlangAbandonmentRate']);loggerPredictive[_0xa1d2('0x7f')](_0xa1d2('0x90'),_0x7a8cfe[_0xa1d2('0x78')]);loggerPredictive['info'](_0xa1d2('0x8f'),_0x7a8cfe[_0xa1d2('0x77')]);loggerPredictive[_0xa1d2('0x7f')]('---------------------------');_[_0xa1d2('0x91')](_0x14226d,_0x7a8cfe);};}function getDiff(_0x16f5b6){var _0x3ec271=moment()[_0xa1d2('0x4c')](0x0);var _0x4b596=moment(_0x16f5b6)[_0xa1d2('0x4c')](0x0);return _0x3ec271[_0xa1d2('0x4d')](_0x4b596,_0xa1d2('0x4e'));}function ifInterval(_0xad967f,_0x180d2d){if(_[_0xa1d2('0x41')](_0x180d2d)){return![];}return getDiff(_0x180d2d)<_0xad967f*0x3c;}function freeVariablesPredictive(_0x39bd8b){if(isNotNull(_0x39bd8b)){if(!_[_0xa1d2('0x41')](_0x39bd8b[_0xa1d2('0x2a')])){_0x39bd8b['startProgressive']=undefined;loggerPredictive[_0xa1d2('0x7f')](_0x39bd8b['name'],_0xa1d2('0x92'));}if(!_[_0xa1d2('0x41')](_0x39bd8b[_0xa1d2('0x29')])){_0x39bd8b[_0xa1d2('0x29')]=undefined;loggerPredictive['info'](_0x39bd8b[_0xa1d2('0x44')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0xa1d2('0x41')](_0x39bd8b[_0xa1d2('0x93')])){clearInterval(_0x39bd8b[_0xa1d2('0x93')]);_0x39bd8b[_0xa1d2('0x93')]=undefined;loggerPredictive[_0xa1d2('0x7f')](_0x39bd8b[_0xa1d2('0x44')],_0xa1d2('0x94'));}}}function erlangb(_0x390eac,_0x212eac){if(_0x212eac===0x0){return 0x0;}var _0xb48c6e=0x1;for(var _0x3c8918=0x1;_0x3c8918<=_0x212eac;_0x3c8918+=0x1){_0xb48c6e=0x1+_0xb48c6e*_0x3c8918/_0x390eac;}return 0x1/_0xb48c6e;}function isVoiceQueueOutbound(_0x578da0){return _0x578da0===_0xa1d2('0x51');}function isNotPreview(_0x352341){return _0x352341!==_0xa1d2('0x1f');}function isCampaignIvr(_0x18247e){return _0x18247e===_0xa1d2('0x95');}function getCallerId(_0x270644,_0x19b896,_0x4d917f){if(!_[_0xa1d2('0x41')](_0x4d917f)&&typeof _0x4d917f===_0xa1d2('0x96')&&!_[_0xa1d2('0x4b')](_0x4d917f)){if(!_[_0xa1d2('0x41')](_0x19b896)&&typeof _0x19b896===_0xa1d2('0x96')&&!_['isEmpty'](_0x19b896)){return util[_0xa1d2('0x7c')](_0xa1d2('0x97'),_0x19b896,_0x4d917f);}return util[_0xa1d2('0x7c')]('\x22%s\x22\x20<%s>',_0x4d917f,_0x4d917f);}if(!_['isUndefined'](_0x270644)&&typeof _0x270644===_0xa1d2('0x96')&&!_[_0xa1d2('0x4b')](_0x270644)){return _0x270644;}return _0xa1d2('0x98');}function loggerCatchQueueSummary(_0x5c62c8,_0x4a2259){return function(_0x50115b){freeVariablesPredictive(_0x4a2259);emitVoiceQueueSummary(_0x4a2259);emitCampaignSummary(_0x4a2259);loggerSyncQueueSummary[_0xa1d2('0x99')](_0x5c62c8,util[_0xa1d2('0x9a')](_0x50115b,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x4d7ff1,_0x4ab093){return function(_0x322000){loggerPredictive[_0xa1d2('0x99')](_0x4ab093[_0xa1d2('0x44')],_0x4d7ff1);loggerPredictive['error'](_0x322000[_0xa1d2('0x9b')]);freeVariablesPredictive(_0x4ab093);};}function loggerCatch(_0xeccf2){return function(_0x2245a4){logger[_0xa1d2('0x99')](_0xeccf2,util[_0xa1d2('0x9a')](_0x2245a4,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x18888c){return _0x18888c&&!_[_0xa1d2('0x41')](_0x18888c)&&_0x18888c[_0xa1d2('0x9c')]>0x0;}function decremetOriginate(_0xa85e28){if(!_[_0xa1d2('0x41')](_0xa85e28)&&_0xa85e28!==null){if(typeof _0xa85e28[_0xa1d2('0x9d')]!==_0xa1d2('0x9e')){if(_0xa85e28[_0xa1d2('0x9d')]>0x0){_0xa85e28[_0xa1d2('0x9d')]-=0x1;}else{logger[_0xa1d2('0x99')](_0xa1d2('0x9f'));}}}else{logger[_0xa1d2('0x99')](_0xa1d2('0xa0'));}}function checkContactLowerLimitOriginate(_0x275aa4,_0x1c89e5,_0x11720c){if(_0x1c89e5>_0x11720c){for(var _0x3fecd8=0x0;_0x3fecd8<_0x1c89e5-_0x11720c;_0x3fecd8+=0x1){decremetOriginate(_0x275aa4);}}}function loggerGetContactDialer(_0x5959c2,_0x455626,_0x5c8ad8){return function(_0x445536){checkContactLowerLimitOriginate(_0x455626,_0x5c8ad8,0x0);logger[_0xa1d2('0x99')](_0x5959c2,util[_0xa1d2('0x9a')](_0x445536,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1a6d2e){return function(_0x4e3e33){if(isNotNull(_0x4e3e33)&&isNotNull(_0x4e3e33[0x0])){if(_0x4e3e33[0x0][_0xa1d2('0xa1')]>0x0){_0x1a6d2e[_0xa1d2('0x42')]='RESCHEDULED_CONTACTS';logger[_0xa1d2('0x7f')](_0xa1d2('0xa2')+_0x1a6d2e[_0xa1d2('0x44')],_0x4e3e33[0x0][_0xa1d2('0xa1')],'contacts');}else{_0x1a6d2e[_0xa1d2('0x42')]=_0xa1d2('0xa3');logger[_0xa1d2('0x7f')]('[getContactDialer2][Empty]'+_0x1a6d2e[_0xa1d2('0x44')]);}}};}function notSendMessagesQueue(_0xafde04){if(_0xafde04[_0xa1d2('0xa4')]){freeVariablesPredictive(_0xafde04);if(_0xafde04['originated']===0x0&&_0xafde04[_0xa1d2('0x59')]===0x0&&_0xafde04[_0xa1d2('0x5c')]===0x0&&(_0xafde04[_0xa1d2('0x55')]||0x0)===0x0){_0xafde04[_0xa1d2('0xa4')]=![];_0xafde04['available']=0x0;_0xafde04[_0xa1d2('0x42')]=_0xa1d2('0x46');loggerSyncQueueSummary['error'](_0xa1d2('0xa5'),_0xafde04[_0xa1d2('0x44')],_0xa1d2('0xa6'));}else{_0xafde04[_0xa1d2('0x42')]=_0xa1d2('0xa7');loggerSyncQueueSummary[_0xa1d2('0x99')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0xafde04[_0xa1d2('0x44')],_0xa1d2('0xa8'));}emitVoiceQueueSummary(_0xafde04);}}function notSendMessagesCampaign(_0x752b3a){if(_0x752b3a[_0xa1d2('0xa4')]){if(_0x752b3a[_0xa1d2('0x9d')]===0x0){_0x752b3a[_0xa1d2('0xa4')]=![];_0x752b3a[_0xa1d2('0x42')]=_0xa1d2('0x46');loggerSyncQueueSummary[_0xa1d2('0x99')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x752b3a['name'],_0xa1d2('0xa6'));}else{_0x752b3a[_0xa1d2('0x42')]='IS_DISACTIVED';loggerSyncQueueSummary['error'](_0xa1d2('0xa9'),_0x752b3a[_0xa1d2('0x44')],_0xa1d2('0xa8'));}emitCampaignSummary(_0x752b3a);}}function createObjHistory(_0x3ed994,_0x311880,_0x3d4b89,_0x35eb29,_0x25abe8){_0x3ed994[_0xa1d2('0x42')]=_0x3d4b89;var _0x5aabff=new Action(_0x3ed994,_0x311880);var _0x50add7=new History(_0x5aabff);_0x50add7[_0xa1d2('0xaa')]=_0x35eb29;_0x50add7[_0xa1d2('0xab')]=_0x25abe8;_0x50add7[_0xa1d2('0xac')]=_0x5aabff[_0xa1d2('0xad')];return _0x50add7;}Dialer['prototype'][_0xa1d2('0x3e')]=function(){var _0x13a5e8=this;setInterval(function(){_0x13a5e8[_0xa1d2('0xae')](_0x13a5e8['uniqueId'],'[uniqueid]');_0x13a5e8[_0xa1d2('0xae')](_0x13a5e8['actions'],_0xa1d2('0xaf'));},0x32c8);};Dialer['prototype'][_0xa1d2('0xae')]=function(_0x2079ec,_0x34f48c){var _0x174e14=this;for(var _0x3d38ba in _0x2079ec){if(typeof _0x2079ec[_0x3d38ba]!==_0xa1d2('0x9e')){this['sequence']['enqueue'](function(){if(!_['isNil'](_0x2079ec[_0x3d38ba])){return ami[_0xa1d2('0xb0')]({'action':_0xa1d2('0xb1'),'channel':_0x2079ec[_0x3d38ba][_0xa1d2('0xb2')]})['catch'](function(_0x4736a4){if(_0x4736a4[_0xa1d2('0x42')]===_0xa1d2('0xb3')){setTimeout(function(){if(_0x2079ec[_0x3d38ba]&&_0x2079ec[_0x3d38ba]['type']!==_0xa1d2('0x95')){_0x174e14[_0xa1d2('0xb4')](_0x174e14[_0xa1d2('0x20')][_0x2079ec[_0x3d38ba][_0xa1d2('0xb5')]]);logger[_0xa1d2('0x99')]('[Dialer][checkChannel]',_0x34f48c,_0x3d38ba,_0x2079ec[_0x3d38ba]['queue']);delete _0x2079ec[_0x3d38ba];}if(_0x2079ec[_0x3d38ba]&&_0x2079ec[_0x3d38ba][_0xa1d2('0x50')]===_0xa1d2('0x95')){_0x174e14[_0xa1d2('0xb4')](_0x174e14[_0xa1d2('0x21')][_0x2079ec[_0x3d38ba]['queue']]);logger[_0xa1d2('0x99')](_0xa1d2('0xb6'),_0x34f48c,_0x3d38ba,_0x2079ec[_0x3d38ba][_0xa1d2('0xb5')]);delete _0x2079ec[_0x3d38ba];}},0x2328);}});}});}}};Dialer[_0xa1d2('0xb7')][_0xa1d2('0xb8')]=function(_0x113dd2){return BPromise[_0xa1d2('0xb9')]()['then'](cmHopper[_0xa1d2('0xb8')](_0x113dd2))[_0xa1d2('0xba')](loggerCatch(_0xa1d2('0xbb')));};Dialer[_0xa1d2('0xb7')][_0xa1d2('0xbc')]=function(_0x5eba88){return BPromise[_0xa1d2('0xb9')]()['then'](cmHopperBlack[_0xa1d2('0xbc')](_0x5eba88))[_0xa1d2('0xba')](loggerCatch(_0xa1d2('0xbd')));};Dialer[_0xa1d2('0xb7')]['checkIsBlackListIvr']=function(_0x56c514){return BPromise['resolve']()['then'](cmHopperBlack[_0xa1d2('0xbe')](_0x56c514))[_0xa1d2('0xba')](loggerCatch(_0xa1d2('0xbf')));};Dialer['prototype'][_0xa1d2('0xc0')]=function(_0x2f11da){return BPromise[_0xa1d2('0xb9')]()[_0xa1d2('0x3f')](cmHopperHistory[_0xa1d2('0xc1')](_0x2f11da))[_0xa1d2('0xba')](loggerCatch(_0xa1d2('0xc2')));};Dialer[_0xa1d2('0xb7')][_0xa1d2('0xc3')]=function(_0x387e44){return BPromise['resolve']()[_0xa1d2('0x3f')](cmHopper[_0xa1d2('0xc3')](_0x387e44))[_0xa1d2('0xba')](loggerCatch('[rescheduleContact]\x20'));};Dialer['prototype']['unlockContact']=function(_0x4d28a5,_0x199cc4,_0x12405d){return BPromise['resolve']()[_0xa1d2('0x3f')](cmHopper[_0xa1d2('0xc4')](_0x4d28a5,_0x199cc4,_0x12405d))[_0xa1d2('0xba')](loggerCatch(_0xa1d2('0xc5')));};Dialer[_0xa1d2('0xb7')]['getContactDialer']=function(_0x56e339,_0x1dfa29,_0x213efc,_0x1bdc78,_0x58812b){return BPromise[_0xa1d2('0xb9')]()['then'](cmHopper[_0xa1d2('0xc6')](_0x56e339,_0x1dfa29,_0x213efc,_0x1bdc78))[_0xa1d2('0xba')](function(_0x4bf5a6){_0x58812b[_0xa1d2('0xc7')]-=_0x213efc;_0x58812b[_0xa1d2('0xc7')]=_0x58812b['temp']>0x0?_0x58812b[_0xa1d2('0xc7')]:0x0;loggerCatch(_0xa1d2('0xc8'))(_0x4bf5a6);});};Dialer[_0xa1d2('0xb7')][_0xa1d2('0xc9')]=function(_0x54a0ca,_0x13bcd1,_0x27d2b5,_0x4a007a){return BPromise[_0xa1d2('0xb9')]()[_0xa1d2('0x3f')](cmHopper[_0xa1d2('0xc9')](_0x54a0ca,_0x13bcd1,_0x27d2b5))[_0xa1d2('0xba')](function(_0x23567b){_0x4a007a[_0xa1d2('0xc7')]-=_0x13bcd1;_0x4a007a[_0xa1d2('0xc7')]=_0x4a007a[_0xa1d2('0xc7')]>0x0?_0x4a007a[_0xa1d2('0xc7')]:0x0;loggerCatch(_0xa1d2('0xca'))(_0x23567b);});};Dialer['prototype'][_0xa1d2('0xcb')]=function(_0x67d334){return BPromise['resolve']()[_0xa1d2('0x3f')](voiceQueueRt[_0xa1d2('0xcb')](_0x67d334))[_0xa1d2('0xba')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0xa1d2('0xb7')][_0xa1d2('0xcc')]=function(_0x5625ab){return BPromise[_0xa1d2('0xb9')]()[_0xa1d2('0x3f')](cmHopper['moveContactManagedDialer'](_0x5625ab))['catch'](loggerCatch(_0xa1d2('0xcd')));};Dialer['prototype'][_0xa1d2('0xce')]=function(_0x58e365){return BPromise[_0xa1d2('0xb9')]()[_0xa1d2('0x3f')](cmHopperHistory[_0xa1d2('0xce')](_0x58e365))[_0xa1d2('0xba')](loggerCatch(_0xa1d2('0xcf')));};Dialer[_0xa1d2('0xb7')]['updateOriginated']=function(_0x259476){if(!_[_0xa1d2('0x41')](_0x259476)&&_0x259476!==null){if(typeof _0x259476[_0xa1d2('0x9d')]!==_0xa1d2('0x9e')){if(_0x259476[_0xa1d2('0x9d')]>0x0){_0x259476['originated']-=0x1;}else{logger[_0xa1d2('0x99')](_0xa1d2('0xd0'));}}}else{logger[_0xa1d2('0x99')](_0xa1d2('0xd1'));}};Dialer['prototype']['loggerHandler']=function(_0x495a76,_0x3bcb9d){var _0x452b1c=this;return function(_0x4beb95){_0x452b1c[_0xa1d2('0xb4')](_0x3bcb9d);logger['error'](_0x495a76,util[_0xa1d2('0x9a')](_0x4beb95,{'showHidden':![],'depth':null}));};};Dialer[_0xa1d2('0xb7')][_0xa1d2('0xd2')]=function(_0x1e0ec9,_0x420adb,_0x41fe2f){var _0x3c760f={'state':0x19,'statedesc':'notFound'};this[_0xa1d2('0xb4')](_0x420adb);this[_0xa1d2('0xd3')](_[_0xa1d2('0x91')](_0x3c760f,_[_0xa1d2('0xd4')](_0x41fe2f,['ContactId',_0xa1d2('0xd5'),_0xa1d2('0xd6'),'VoiceQueueId','CampaignId'])),_0xa1d2('0xd7'),_0xa1d2('0xd8'));logger[_0xa1d2('0x99')](_0x1e0ec9);};Dialer[_0xa1d2('0xb7')]['isSuccess']=function(_0x3f717a){return _0x3f717a==='Success';};Dialer[_0xa1d2('0xb7')][_0xa1d2('0xd9')]=function(_0x4e53c0){return!_['isUndefined'](_0x4e53c0)&&_0x4e53c0&&!_[_0xa1d2('0x41')](_0x4e53c0[_0xa1d2('0x44')])&&!_[_0xa1d2('0x41')](_0x4e53c0[_0xa1d2('0x7a')])&&_0x4e53c0[_0xa1d2('0x7a')]&&(this[_0xa1d2('0x23')][util['format']('SIP/%s',_0x4e53c0[_0xa1d2('0x44')])][_0xa1d2('0xb1')]==='reachable'||this[_0xa1d2('0x23')][util['format']('SIP/%s',_0x4e53c0[_0xa1d2('0x44')])][_0xa1d2('0xb1')]===_0xa1d2('0xda'));};Dialer['prototype'][_0xa1d2('0xd3')]=function(_0x19d680,_0x13795f,_0x492a13){this['createHistory'](_0x19d680)[_0xa1d2('0xba')](loggerCatch(_0x13795f));this[_0xa1d2('0xcc')](_0x19d680)[_0xa1d2('0xba')](loggerCatch(_0x492a13));};Dialer[_0xa1d2('0xb7')]['syncVarSet']=function(_0x117267){var _0x58e8c6=this[_0xa1d2('0x27')][_0x117267['uniqueid']];var _0x53c2e9;if(!_[_0xa1d2('0xdb')](_0x117267)&&!_[_0xa1d2('0xdb')](_0x117267[_0xa1d2('0xdc')])&&!_[_0xa1d2('0xdb')](_0x117267[_0xa1d2('0xdc')]['amdstatus'])&&_0x117267[_0xa1d2('0xdd')]===_0xa1d2('0xde')&&_0x58e8c6){if(_0x58e8c6[_0xa1d2('0x50')]!=='ivr'&&this[_0xa1d2('0x20')][_0x58e8c6[_0xa1d2('0xb5')]]['dialAMDActive']&&_0x117267[_0xa1d2('0xdf')]===_0xa1d2('0xe0')){delete this[_0xa1d2('0x27')][_0x117267['uniqueid']];this[_0xa1d2('0xb4')](this['voiceQueues'][_0x58e8c6[_0xa1d2('0xb5')]]);this[_0xa1d2('0x20')][_0x58e8c6[_0xa1d2('0xb5')]][_0xa1d2('0x64')]+=0x1;this[_0xa1d2('0x20')][_0x58e8c6[_0xa1d2('0xb5')]][_0xa1d2('0x63')]+=0x1;_0x53c2e9=new Hangup(_0x58e8c6,_0x117267);_0x53c2e9[_0xa1d2('0xaa')]=0x12;_0x53c2e9[_0xa1d2('0xab')]=_0xa1d2('0xe1');_0x53c2e9['membername']=_0xa1d2('0xe2');ami['emit'](_0xa1d2('0xe3'),ut[_0xa1d2('0xe4')](_0x53c2e9,_0xa1d2('0xe5')));this['saveInDb'](_0x53c2e9,_0xa1d2('0xe6'),_0xa1d2('0xe7'));}if(_0x58e8c6[_0xa1d2('0x50')]!==_0xa1d2('0x95')&&this[_0xa1d2('0x20')][_0x58e8c6[_0xa1d2('0xb5')]][_0xa1d2('0xe8')]&&_0x117267[_0xa1d2('0xdf')]===_0xa1d2('0xe9')){var _0x3100b8=this;return new BPromise(function(_0x1ecff4,_0x3f79be){delete _0x3100b8[_0xa1d2('0x27')][_0x117267['uniqueid']];_0x3100b8[_0xa1d2('0xb4')](_0x3100b8['voiceQueues'][_0x58e8c6[_0xa1d2('0xb5')]]);_0x3100b8[_0xa1d2('0x20')][_0x58e8c6[_0xa1d2('0xb5')]][_0xa1d2('0x64')]+=0x1;_0x3100b8[_0xa1d2('0x20')][_0x58e8c6[_0xa1d2('0xb5')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x4b4520=_0x3100b8[_0xa1d2('0x20')][_0x58e8c6[_0xa1d2('0xb5')]];var _0x22b384=new Hangup(_0x58e8c6,_0x117267);_0x22b384[_0xa1d2('0xaa')]=0x13;_0x22b384[_0xa1d2('0xab')]=_0xa1d2('0xea');_0x22b384['membername']=_0xa1d2('0xe2');_0x22b384[_0xa1d2('0xeb')]+=0x1;_0x22b384[_0xa1d2('0xec')]+=0x1;_0x22b384[_0xa1d2('0xe5')]=!![];ami['emit']('custom:amd',ut[_0xa1d2('0xe4')](_0x22b384,_0xa1d2('0xe5')));_0x3100b8[_0xa1d2('0xce')](_0x22b384)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x22b384[_0xa1d2('0xed')]+_0x22b384[_0xa1d2('0xee')]+_0x22b384['countnoanswerretry']+_0x22b384['countnosuchnumberretry']+_0x22b384[_0xa1d2('0xef')]+_0x22b384[_0xa1d2('0xf0')]+_0x22b384['countmachineretry']+_0x22b384[_0xa1d2('0xf1')]>=_0x4b4520[_0xa1d2('0xf2')]){_0x3100b8['stateGlobal'](_0x22b384,_0x1ecff4,_0x3f79be,_0xa1d2('0xf3'));}else{if(_0x22b384[_0xa1d2('0xeb')]>=_0x4b4520[_0xa1d2('0xf4')]){_0x3100b8['createStateFinal'](_0x22b384,_0x1ecff4,_0x3f79be,_0xa1d2('0xf5'));}else{_0x3100b8[_0xa1d2('0xc3')]({'active':![],'countmachineretry':_0x22b384[_0xa1d2('0xeb')],'scheduledat':moment()['add'](_0x4b4520['dialMachineRetryFrequency'],'minutes')[_0xa1d2('0x7c')](_0xa1d2('0xf6')),'ContactId':_0x22b384[_0xa1d2('0xf7')],'ListId':_0x22b384['ListId'],'VoiceQueueId':_0x22b384[_0xa1d2('0xf8')]||undefined,'CampaignId':_0x22b384['CampaignId']||undefined})[_0xa1d2('0xba')](loggerCatch('[rescheduleContact][Machine]'));_0x1ecff4({'reschedule':0x1});}}});}if(_0x58e8c6['type']===_0xa1d2('0x95')&&this[_0xa1d2('0x21')][_0x58e8c6['queue']][_0xa1d2('0xe8')]&&_0x117267['value']==='HANGUP'){delete this[_0xa1d2('0x27')][_0x117267[_0xa1d2('0xf9')]];this[_0xa1d2('0xb4')](this[_0xa1d2('0x21')][_0x58e8c6[_0xa1d2('0xb5')]]);_0x53c2e9=new Hangup(_0x58e8c6,_0x117267);_0x53c2e9['state']=0x12;_0x53c2e9[_0xa1d2('0xab')]=_0xa1d2('0xe1');_0x53c2e9[_0xa1d2('0xfa')]='AMD';ami[_0xa1d2('0x4f')](_0xa1d2('0xe3'),ut[_0xa1d2('0xe4')](_0x53c2e9,_0xa1d2('0xe5')));this[_0xa1d2('0xd3')](_0x53c2e9,_0xa1d2('0xfb'),_0xa1d2('0xfc'));}if(_0x58e8c6[_0xa1d2('0x50')]===_0xa1d2('0x95')&&this[_0xa1d2('0x21')][_0x58e8c6['queue']][_0xa1d2('0xe8')]&&_0x117267[_0xa1d2('0xdf')]===_0xa1d2('0xe9')){var _0x3100b8=this;return new BPromise(function(_0x4fd050,_0x543f20){delete _0x3100b8[_0xa1d2('0x27')][_0x117267['uniqueid']];_0x3100b8[_0xa1d2('0xb4')](_0x3100b8[_0xa1d2('0x21')][_0x58e8c6[_0xa1d2('0xb5')]]);_0x3100b8[_0xa1d2('0x21')][_0x58e8c6[_0xa1d2('0xb5')]]['outboundAnswerCallsDay']+=0x1;_0x3100b8[_0xa1d2('0x21')][_0x58e8c6[_0xa1d2('0xb5')]][_0xa1d2('0x63')]+=0x1;var _0x20173c=_0x3100b8[_0xa1d2('0x21')][_0x58e8c6['queue']];var _0x50f26b=new Hangup(_0x58e8c6,_0x117267);_0x50f26b[_0xa1d2('0xaa')]=0x13;_0x50f26b[_0xa1d2('0xab')]=_0xa1d2('0xea');_0x50f26b[_0xa1d2('0xfa')]=_0xa1d2('0xe2');_0x50f26b[_0xa1d2('0xeb')]+=0x1;_0x50f26b[_0xa1d2('0xec')]+=0x1;_0x50f26b[_0xa1d2('0xe5')]=!![];ami[_0xa1d2('0x4f')](_0xa1d2('0xe3'),ut['buildObj'](_0x50f26b,'amd'));_0x3100b8['createHistory'](_0x50f26b)[_0xa1d2('0xba')](loggerCatch(_0xa1d2('0xfd')));if(_0x50f26b[_0xa1d2('0xed')]+_0x50f26b[_0xa1d2('0xee')]+_0x50f26b[_0xa1d2('0xfe')]+_0x50f26b['countnosuchnumberretry']+_0x50f26b[_0xa1d2('0xef')]+_0x50f26b[_0xa1d2('0xf0')]+_0x50f26b[_0xa1d2('0xeb')]+_0x50f26b[_0xa1d2('0xf1')]>=_0x20173c[_0xa1d2('0xf2')]){_0x3100b8['stateGlobal'](_0x50f26b,_0x4fd050,_0x543f20,_0xa1d2('0xf3'));}else{if(_0x50f26b[_0xa1d2('0xeb')]>=_0x20173c[_0xa1d2('0xf4')]){_0x3100b8[_0xa1d2('0xff')](_0x50f26b,_0x4fd050,_0x543f20,_0xa1d2('0xf5'));}else{_0x3100b8[_0xa1d2('0xc3')]({'active':![],'countmachineretry':_0x50f26b[_0xa1d2('0xeb')],'scheduledat':moment()[_0xa1d2('0x100')](_0x20173c[_0xa1d2('0x101')],_0xa1d2('0x102'))[_0xa1d2('0x7c')](_0xa1d2('0xf6')),'ContactId':_0x50f26b[_0xa1d2('0xf7')],'ListId':_0x50f26b[_0xa1d2('0xd5')],'VoiceQueueId':_0x50f26b[_0xa1d2('0xf8')]||undefined,'CampaignId':_0x50f26b[_0xa1d2('0x103')]||undefined})[_0xa1d2('0xba')](loggerCatch(_0xa1d2('0x104')));_0x4fd050({'reschedule':0x1});}}});}}};Dialer[_0xa1d2('0xb7')]['syncHangup']=function(_0x374d49){var _0x3a8b7b=this[_0xa1d2('0x27')][_0x374d49['uniqueid']];var _0x7d1c93=this;var _0x5240e8;if(_0x3a8b7b&&_0x3a8b7b[_0xa1d2('0x50')]===_0xa1d2('0x95')){delete this['uniqueId'][_0x374d49[_0xa1d2('0xf9')]];this['updateOriginated'](this[_0xa1d2('0x21')][_0x3a8b7b[_0xa1d2('0xb5')]]);this[_0xa1d2('0x21')][_0x3a8b7b[_0xa1d2('0xb5')]]['ivrAnswerCallsDay']+=0x1;_0x5240e8=new Hangup(_0x3a8b7b,_0x374d49);this[_0xa1d2('0xce')](_0x5240e8)[_0xa1d2('0xba')](loggerCatch(_0xa1d2('0x105')));this[_0xa1d2('0xcc')](_0x5240e8)[_0xa1d2('0xba')](loggerCatch(_0xa1d2('0x106')));}if(_0x3a8b7b&&_0x3a8b7b[_0xa1d2('0x50')]!==_0xa1d2('0x95')&&isNotNull(this[_0xa1d2('0x20')][_0x3a8b7b[_0xa1d2('0xb5')]][_0xa1d2('0x107')])){delete this['uniqueId'][_0x374d49[_0xa1d2('0xf9')]];this['updateOriginated'](this[_0xa1d2('0x20')][_0x3a8b7b['queue']]);this[_0xa1d2('0x20')][_0x3a8b7b[_0xa1d2('0xb5')]]['outboundAnswerCallsDay']+=0x1;this[_0xa1d2('0x20')][_0x3a8b7b[_0xa1d2('0xb5')]]['outboundAnswerAgiCallsDay']+=0x1;_0x5240e8=new Hangup(_0x3a8b7b,_0x374d49);_0x5240e8['state']=0x10;_0x5240e8['statedesc']='AnswerAGI';_0x5240e8[_0xa1d2('0xfa')]='AGI';this[_0xa1d2('0xce')](_0x5240e8)['catch'](loggerCatch(_0xa1d2('0x105')));this[_0xa1d2('0xcc')](_0x5240e8)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x3a8b7b&&_0x3a8b7b['type']!==_0xa1d2('0x95')&&!isNotNull(this[_0xa1d2('0x20')][_0x3a8b7b['queue']]['dialQueueProject'])){delete this['uniqueId'][_0x374d49[_0xa1d2('0xf9')]];this['updateOriginated'](this['voiceQueues'][_0x3a8b7b[_0xa1d2('0xb5')]]);this[_0xa1d2('0x20')][_0x3a8b7b['queue']]['outboundUnknownCallsDay']+=0x1;_0x5240e8=new Hangup(_0x3a8b7b,_0x374d49);_0x5240e8['state']=0xc;_0x5240e8[_0xa1d2('0xab')]=_0x374d49[_0xa1d2('0x108')];_0x5240e8[_0xa1d2('0xfa')]=_0xa1d2('0x109');this[_0xa1d2('0xce')](_0x5240e8)['catch'](loggerCatch(_0xa1d2('0x105')));this[_0xa1d2('0xcc')](_0x5240e8)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xa1d2('0xb7')][_0xa1d2('0x10a')]=function(_0x352f44){var _0x21306c=this['uniqueId'][_0x352f44[_0xa1d2('0xf9')]];var _0x4d7874=this;if(this['voiceQueues'][_0x352f44['queue']]){if(_0x21306c&&_0x21306c['type']!==_0xa1d2('0x95')){delete this[_0xa1d2('0x27')][_0x352f44['uniqueid']];this[_0xa1d2('0x20')][_0x352f44[_0xa1d2('0xb5')]][_0xa1d2('0x64')]+=0x1;var _0x29f370=new AgentComplete(_0x21306c,_0x352f44);if(_0x352f44[_0xa1d2('0x10b')]===_0xa1d2('0x10c')){_0x29f370[_0xa1d2('0x10d')]=this[_0xa1d2('0x20')][_0x352f44[_0xa1d2('0xb5')]][_0xa1d2('0x10e')]&&this[_0xa1d2('0x20')][_0x352f44[_0xa1d2('0xb5')]]['dialAgiAfterHangupAgent']?moment()[_0xa1d2('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this['createHistory'](_0x29f370)[_0xa1d2('0xba')](loggerCatch(_0xa1d2('0x10f')));this[_0xa1d2('0xcc')](_0x29f370)[_0xa1d2('0xba')](loggerCatch(_0xa1d2('0x110')));}}};Dialer[_0xa1d2('0xb7')][_0xa1d2('0x2e')]=function(_0x18db6a){if(this['voiceQueues'][_0x18db6a[_0xa1d2('0xb5')]]){if(this['uniqueId'][_0x18db6a[_0xa1d2('0xf9')]]&&this[_0xa1d2('0x27')][_0x18db6a['uniqueid']][_0xa1d2('0x50')]!==_0xa1d2('0x95')){this[_0xa1d2('0xb4')](this[_0xa1d2('0x20')][_0x18db6a['queue']]);this[_0xa1d2('0x27')][_0x18db6a[_0xa1d2('0xf9')]]['answertime']=moment()[_0xa1d2('0x7c')](_0xa1d2('0xf6'));}}};Dialer['prototype']['queueCallerAbandonCreateState']=function(_0x179614){this[_0xa1d2('0xce')](_0x179614)['catch'](loggerCatch(_0xa1d2('0x10f')));this['moveContactManagedDialer'](_0x179614)[_0xa1d2('0xba')](loggerCatch(_0xa1d2('0x111')));};Dialer['prototype'][_0xa1d2('0x31')]=function(_0x1cc02a){var _0x2c9a4f=this[_0xa1d2('0x27')][_0x1cc02a[_0xa1d2('0xf9')]];var _0x101476=this;if(this['voiceQueues'][_0x1cc02a['queue']]){if(_0x2c9a4f&&_0x2c9a4f[_0xa1d2('0x50')]!==_0xa1d2('0x95')){delete this[_0xa1d2('0x27')][_0x1cc02a['uniqueid']];this[_0xa1d2('0xb4')](this['voiceQueues'][_0x1cc02a['queue']]);_0x2c9a4f['droptime']=moment()[_0xa1d2('0x7c')](_0xa1d2('0xf6'));var _0x37b65d=new QueueCallerAbandon(_0x2c9a4f,_0x1cc02a);if(getSeconds(_0x2c9a4f[_0xa1d2('0x112')],_0x2c9a4f['responsetime'])>=_0x2c9a4f[_0xa1d2('0x113')]){this['voiceQueues'][_0x1cc02a[_0xa1d2('0xb5')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this['voiceQueues'][_0x1cc02a['queue']][_0xa1d2('0x69')]+=0x1;this['voiceQueues'][_0x1cc02a[_0xa1d2('0xb5')]][_0xa1d2('0x72')]+=0x1;_0x37b65d[_0xa1d2('0xaa')]=0xa;_0x37b65d[_0xa1d2('0xab')]=_0xa1d2('0x114');_0x37b65d[_0xa1d2('0x115')]='TIMEOUT';_0x37b65d['agiafterat']=this['voiceQueues'][_0x1cc02a['queue']][_0xa1d2('0x10e')]?moment()[_0xa1d2('0x7c')](_0xa1d2('0xf6')):undefined;_0x37b65d[_0xa1d2('0xef')]+=0x1;_0x37b65d[_0xa1d2('0xec')]+=0x1;if(_0x37b65d[_0xa1d2('0xef')]>=this['voiceQueues'][_0x1cc02a['queue']]['dialDropMaxRetry']){this[_0xa1d2('0x116')](_0x37b65d);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x37b65d[_0xa1d2('0xef')],'scheduledat':moment()[_0xa1d2('0x100')](this[_0xa1d2('0x20')][_0x1cc02a[_0xa1d2('0xb5')]][_0xa1d2('0x117')],_0xa1d2('0x102'))['format'](_0xa1d2('0xf6')),'ContactId':_0x2c9a4f['ContactId'],'ListId':_0x2c9a4f[_0xa1d2('0xd5')],'VoiceQueueId':_0x2c9a4f['VoiceQueueId']||undefined,'CampaignId':_0x2c9a4f['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0x5ae24a=new History(_0x37b65d);_0x5ae24a['state']=0xa;_0x5ae24a[_0xa1d2('0xab')]=_0xa1d2('0x114');_0x5ae24a[_0xa1d2('0xad')]=moment()['format'](_0xa1d2('0xf6'));_0x5ae24a[_0xa1d2('0xac')]=_0x5ae24a['starttime'];_0x5ae24a['calleridname']=_0x37b65d['calleridname'];_0x5ae24a['calleridnum']=_0x37b65d[_0xa1d2('0x118')];this['createHistory'](_0x5ae24a)[_0xa1d2('0xba')](loggerCatch(_0xa1d2('0x119')));}}else{this[_0xa1d2('0x20')][_0x1cc02a[_0xa1d2('0xb5')]][_0xa1d2('0x85')]+=0x1;this[_0xa1d2('0x20')][_0x1cc02a[_0xa1d2('0xb5')]][_0xa1d2('0x68')]+=0x1;_0x37b65d[_0xa1d2('0xaa')]=0xb;_0x37b65d[_0xa1d2('0xab')]=_0xa1d2('0x11a');_0x37b65d['dropreason']='CALLEREXIT';_0x37b65d['countabandonedretry']+=0x1;_0x37b65d[_0xa1d2('0xec')]+=0x1;if(_0x37b65d[_0xa1d2('0xf0')]>=this[_0xa1d2('0x20')][_0x1cc02a[_0xa1d2('0xb5')]][_0xa1d2('0x11b')]){this['queueCallerAbandonCreateState'](_0x37b65d);}else{this[_0xa1d2('0xc3')]({'active':![],'countabandonedretry':_0x37b65d['countabandonedretry'],'scheduledat':moment()[_0xa1d2('0x100')](this[_0xa1d2('0x20')][_0x1cc02a[_0xa1d2('0xb5')]][_0xa1d2('0x11c')],'minutes')['format'](_0xa1d2('0xf6')),'ContactId':_0x2c9a4f[_0xa1d2('0xf7')],'ListId':_0x2c9a4f[_0xa1d2('0xd5')],'VoiceQueueId':_0x2c9a4f['VoiceQueueId']||undefined,'CampaignId':_0x2c9a4f[_0xa1d2('0x103')]||undefined})[_0xa1d2('0xba')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x5ae24a=new History(_0x37b65d);_0x5ae24a['state']=0xb;_0x5ae24a['statedesc']='Abandoned';_0x5ae24a[_0xa1d2('0xad')]=moment()['format'](_0xa1d2('0xf6'));_0x5ae24a[_0xa1d2('0xac')]=_0x5ae24a[_0xa1d2('0xad')];_0x5ae24a[_0xa1d2('0x11d')]=_0x37b65d[_0xa1d2('0x11d')];_0x5ae24a[_0xa1d2('0x118')]=_0x37b65d[_0xa1d2('0x118')];this[_0xa1d2('0xce')](_0x5ae24a)[_0xa1d2('0xba')](loggerCatch(_0xa1d2('0x11e')));}}}}};Dialer['prototype'][_0xa1d2('0x38')]=function(_0x6a812b){if(this[_0xa1d2('0x25')][_0x6a812b[_0xa1d2('0xf9')]]){this['actions'][_0x6a812b['uniqueid']]['channel']=_0x6a812b[_0xa1d2('0xb2')];}if(this['uniqueId'][_0x6a812b[_0xa1d2('0xf9')]]){this[_0xa1d2('0x27')][_0x6a812b[_0xa1d2('0xf9')]][_0xa1d2('0xb2')]=_0x6a812b[_0xa1d2('0xb2')];}};Dialer[_0xa1d2('0xb7')][_0xa1d2('0x11f')]=function(_0x2b9b8a){if(strategy[this[_0xa1d2('0x20')][this[_0xa1d2('0x25')][_0x2b9b8a['actionid']]['queue']][_0xa1d2('0x120')]]===_0xa1d2('0x1c')){if(this[_0xa1d2('0x25')][_0x2b9b8a[_0xa1d2('0x121')]]&&_['isNil'](this[_0xa1d2('0x25')][_0x2b9b8a[_0xa1d2('0x121')]]['locked'])&&_0x2b9b8a[_0xa1d2('0xb1')]==='1'&&_0x2b9b8a[_0xa1d2('0x122')]==='0'){if(this[_0xa1d2('0x22')][_0x2b9b8a[_0xa1d2('0x123')]]){if(!this[_0xa1d2('0x22')][_0x2b9b8a['stateinterface']][_0xa1d2('0x124')]){this[_0xa1d2('0x22')][_0x2b9b8a[_0xa1d2('0x123')]][_0xa1d2('0x124')]=!![];this['actions'][_0x2b9b8a['actionid']][_0xa1d2('0x124')]=!![];this[_0xa1d2('0x25')][_0x2b9b8a[_0xa1d2('0x121')]][_0xa1d2('0x123')]=_0x2b9b8a[_0xa1d2('0x123')];}}}}else if((strategy[this['voiceQueues'][this['actions'][_0x2b9b8a[_0xa1d2('0x121')]]['queue']]['strategy']]||_0xa1d2('0x1b'))===_0xa1d2('0x1b')){if(this[_0xa1d2('0x25')][_0x2b9b8a['actionid']]){if(this[_0xa1d2('0x22')][_0x2b9b8a[_0xa1d2('0x123')]]){this[_0xa1d2('0x25')][_0x2b9b8a[_0xa1d2('0x121')]][_0xa1d2('0x123')]=_0x2b9b8a[_0xa1d2('0x123')];if(_['isNil'](this['queueBooked'][this['actions'][_0x2b9b8a[_0xa1d2('0x121')]][_0xa1d2('0xb5')]])){this['queueBooked'][this[_0xa1d2('0x25')][_0x2b9b8a['actionid']][_0xa1d2('0xb5')]]=[];}this[_0xa1d2('0x2c')][this[_0xa1d2('0x25')][_0x2b9b8a[_0xa1d2('0x121')]][_0xa1d2('0xb5')]]['push'](_[_0xa1d2('0x91')](_[_0xa1d2('0xd4')](this['actions'][_0x2b9b8a[_0xa1d2('0x121')]],[_0xa1d2('0x125'),_0xa1d2('0x123')]),{'status':_0x2b9b8a[_0xa1d2('0xb1')],'paused':_0x2b9b8a['paused']}));}}}};function unlockQueueStatus(_0x278e1c,_0x47eafe){setTimeout(function(){if(_[_0xa1d2('0x41')](_0x278e1c['queueStatusComplete'])){loggerBooked[_0xa1d2('0x99')](_0xa1d2('0x126'),_0x47eafe);}_0x278e1c[_0xa1d2('0x127')]=!![];loggerBooked[_0xa1d2('0x7f')](_0xa1d2('0x128'),_0x47eafe,JSON[_0xa1d2('0x7b')](_[_0xa1d2('0xd4')](_0x278e1c,[_0xa1d2('0x44'),_0xa1d2('0x127')])));},0x1f3);}Dialer[_0xa1d2('0xb7')][_0xa1d2('0x3c')]=function(_0x1d010e){var _0x170e5f=this;var _0x1eaeeb=_0x170e5f[_0xa1d2('0x20')][_0x170e5f['actions'][_0x1d010e[_0xa1d2('0x121')]][_0xa1d2('0xb5')]];if(strategy[this[_0xa1d2('0x20')][this[_0xa1d2('0x25')][_0x1d010e[_0xa1d2('0x121')]][_0xa1d2('0xb5')]][_0xa1d2('0x120')]]==='roundrobin'){if(this['actions'][_0x1d010e['actionid']]&&this['actions'][_0x1d010e['actionid']][_0xa1d2('0x123')]){this[_0xa1d2('0x1f')][_0xa1d2('0x129')](this[_0xa1d2('0x25')][_0x1d010e['actionid']]['idHopper'],this[_0xa1d2('0x25')][_0x1d010e['actionid']][_0xa1d2('0x123')])[_0xa1d2('0xba')](function(_0x5221b3){logger[_0xa1d2('0x99')](_0xa1d2('0x12a'),util[_0xa1d2('0x9a')](_0x5221b3,{'showHidden':![],'depth':null}));})[_0xa1d2('0x12b')](function(){_0x170e5f[_0xa1d2('0xb4')](_0x170e5f[_0xa1d2('0x20')][_0x170e5f[_0xa1d2('0x25')][_0x1d010e[_0xa1d2('0x121')]][_0xa1d2('0xb5')]]);_0x170e5f[_0xa1d2('0x22')][_0x170e5f[_0xa1d2('0x25')][_0x1d010e['actionid']][_0xa1d2('0x123')]]['locked']=![];delete _0x170e5f[_0xa1d2('0x25')][_0x1d010e[_0xa1d2('0x121')]];unlockQueueStatus(_0x1eaeeb);});}else{this[_0xa1d2('0xb4')](this[_0xa1d2('0x20')][this['actions'][_0x1d010e[_0xa1d2('0x121')]][_0xa1d2('0xb5')]]);this[_0xa1d2('0xc3')]({'active':![],'ContactId':this['actions'][_0x1d010e[_0xa1d2('0x121')]][_0xa1d2('0xf7')],'ListId':this[_0xa1d2('0x25')][_0x1d010e['actionid']]['ListId'],'VoiceQueueId':this[_0xa1d2('0x25')][_0x1d010e[_0xa1d2('0x121')]][_0xa1d2('0xf8')]||undefined,'CampaignId':this[_0xa1d2('0x25')][_0x1d010e[_0xa1d2('0x121')]]['CampaignId']||undefined})[_0xa1d2('0xba')](loggerCatch(_0xa1d2('0x12c')));delete this[_0xa1d2('0x25')][_0x1d010e[_0xa1d2('0x121')]];unlockQueueStatus(_0x1eaeeb);}}else if((strategy[this[_0xa1d2('0x20')][this[_0xa1d2('0x25')][_0x1d010e['actionid']]['queue']]['strategy']]||'rrmemory')===_0xa1d2('0x1b')){var _0x253143;if(this[_0xa1d2('0x25')][_0x1d010e[_0xa1d2('0x121')]]&&!_[_0xa1d2('0x4b')](this[_0xa1d2('0x2c')][this[_0xa1d2('0x25')][_0x1d010e[_0xa1d2('0x121')]][_0xa1d2('0xb5')]])){if(this[_0xa1d2('0x2d')][_0x170e5f[_0xa1d2('0x25')][_0x1d010e[_0xa1d2('0x121')]][_0xa1d2('0xb5')]]){this[_0xa1d2('0x2d')][_0x170e5f[_0xa1d2('0x25')][_0x1d010e[_0xa1d2('0x121')]][_0xa1d2('0xb5')]]=this[_0xa1d2('0x2d')][this[_0xa1d2('0x25')][_0x1d010e['actionid']][_0xa1d2('0xb5')]]?this['queueBookedRR'][this[_0xa1d2('0x25')][_0x1d010e[_0xa1d2('0x121')]][_0xa1d2('0xb5')]]:this[_0xa1d2('0x2c')][this[_0xa1d2('0x25')][_0x1d010e[_0xa1d2('0x121')]]['queue']]?this[_0xa1d2('0x2c')][this[_0xa1d2('0x25')][_0x1d010e[_0xa1d2('0x121')]][_0xa1d2('0xb5')]][_0xa1d2('0x12d')]||0x0:0x0;}this[_0xa1d2('0x2c')][this['actions'][_0x1d010e['actionid']]['queue']][_0xa1d2('0x12d')]=this[_0xa1d2('0x2d')][this['actions'][_0x1d010e['actionid']][_0xa1d2('0xb5')]];for(var _0x39422f=0x0;_0x39422f=0x0;})[_0xa1d2('0xba')](myreject(_0x2a8e6d)));}}else{_0x1b6614['push'](ami[_0xa1d2('0xb0')]({'action':_0xa1d2('0x147'),'command':util[_0xa1d2('0x7c')](_0xa1d2('0x14a'),_0x153c2d,!_[_0xa1d2('0x41')](config['timezones'][_0x42c5ce])?_0x42c5ce:'')})['then'](function(_0x4745ba){return _0x4745ba[_0xa1d2('0x149')][_0xa1d2('0x14b')](_0xa1d2('0x14c'))>=0x0;})[_0xa1d2('0xba')](myreject(_0x2a8e6d)));}BPromise[_0xa1d2('0x14d')](_0x1b6614)[_0xa1d2('0x3f')](function(_0x1bfb45){var _0xfed832=_[_0xa1d2('0x14e')](_0x1bfb45);if(_0xfed832){return _0x3497bc(_0xfed832);}else{_0x2c1edf[_0xa1d2('0x42')]=_0x2b704f?_0xa1d2('0x14f'):_0xa1d2('0x150');return _0x2a8e6d(msgResponse(_0xa1d2('0x151'),_0xa1d2('0x140'),_0xa1d2('0x152')+_0x2b704f+'\x20'+_0xdc46a2+'\x20Interval\x20is\x20overtime:\x20'+util[_0xa1d2('0x9a')](_0x153c2d,{'showHidden':![],'depth':null})+_0xa1d2('0x153')+_0x42c5ce));}})[_0xa1d2('0xba')](function(_0x109a55){return _0x2a8e6d(msgResponse(_0xa1d2('0x13e'),_0xa1d2('0x140'),JSON['stringify'](_0x109a55)));});});};Dialer[_0xa1d2('0xb7')][_0xa1d2('0x154')]=function(_0x3b9efc){var _0x18cffb=this;return function(){switch(_0x3b9efc[_0xa1d2('0x5f')]){case'progressive':freeVariablesPredictive(_0x3b9efc);_0x18cffb[_0xa1d2('0x155')](_0x3b9efc,0x1);break;case _0xa1d2('0x156'):freeVariablesPredictive(_0x3b9efc);_0x18cffb[_0xa1d2('0x155')](_0x3b9efc,_0x3b9efc['dialPowerLevel']);break;case _0xa1d2('0xb'):_0x18cffb[_0xa1d2('0xb')](_0x3b9efc);break;case'booked':freeVariablesPredictive(_0x3b9efc);_0x18cffb[_0xa1d2('0x155')](_0x3b9efc,0x1);break;default:freeVariablesPredictive(_0x3b9efc);logger['error'](_0xa1d2('0x157'),_0x3b9efc['name'],_0xa1d2('0x158'));}};};Dialer['prototype'][_0xa1d2('0x159')]=function(_0x2cd6c7){return BPromise[_0xa1d2('0xb9')]()[_0xa1d2('0x3f')](cmHopper[_0xa1d2('0x15a')](_0x2cd6c7['id'],previewRecallmeReminderInterval))[_0xa1d2('0x3f')](function(_0x556df4){for(var _0x300ff4=0x0;_0x300ff4<_0x556df4[_0xa1d2('0x9c')];_0x300ff4++){var _0x2334e7=_0x556df4[_0x300ff4][_0xa1d2('0x15b')][_0xa1d2('0x44')];if(_0x2334e7)io['to'](util[_0xa1d2('0x7c')](_0xa1d2('0x15c'),_0x2334e7))[_0xa1d2('0x4f')](_0xa1d2('0x15d'),{'hopper':_0x556df4[_0x300ff4]});}})[_0xa1d2('0xba')](function(_0x52c249){});};Dialer[_0xa1d2('0xb7')]['launchHandleIvr']=function(_0x50a6aa){var _0x3ddc3e=this;return function(){_0x3ddc3e[_0xa1d2('0x15e')](_0x50a6aa);};};Dialer['prototype']['syncQueueSummary']=function(_0x4325c5){var _0x38c60c=this;if(isNotPreview(_0x4325c5[_0xa1d2('0x5f')])){if(isVoiceQueueOutbound(_0x4325c5[_0xa1d2('0x50')])&&isActive(_0x4325c5['dialActive'])){_0x4325c5[_0xa1d2('0xa4')]=!![];BPromise[_0xa1d2('0xb9')]()[_0xa1d2('0x3f')](checkIsLoggedIn(_0x4325c5,_0x4325c5['loggedIn']))['then'](checkIsActive(_0x4325c5,_0x4325c5[_0xa1d2('0x5e')]))[_0xa1d2('0x3f')](checkInterval(_0x4325c5))[_0xa1d2('0x3f')](_0x38c60c['checkIsTrunkReachable'](_0x4325c5))[_0xa1d2('0x3f')](_0x38c60c[_0xa1d2('0x13d')](_0x4325c5[_0xa1d2('0x15f')],_0x4325c5[_0xa1d2('0x160')],_0x4325c5[_0xa1d2('0x44')],_0x4325c5))[_0xa1d2('0x3f')](_0x38c60c[_0xa1d2('0x13f')](_0x4325c5[_0xa1d2('0x47')],_0x4325c5[_0xa1d2('0x160')],_0x4325c5[_0xa1d2('0x44')],_0x4325c5))['then'](_0x38c60c['checkDialMethod'](_0x4325c5))[_0xa1d2('0xba')](loggerCatchQueueSummary(_0xa1d2('0x161'),_0x4325c5));}else{notSendMessagesQueue(_0x4325c5);}}else{freeVariablesPredictive(_0x4325c5);if(_0x4325c5[_0xa1d2('0x162')]){_0x38c60c[_0xa1d2('0x159')](_0x4325c5);}}};Dialer['prototype'][_0xa1d2('0x163')]=function(){var _0xe6e064=this;var _0x452ee9;for(var _0x18f439 in this['campaigns']){if(typeof this[_0xa1d2('0x21')][_0x18f439]!==_0xa1d2('0x9e')){_0x452ee9=this[_0xa1d2('0x21')][_0x18f439];if(isCampaignIvr(_0x452ee9['type'])&&isActive(_0x452ee9[_0xa1d2('0x7a')])){_0x452ee9[_0xa1d2('0xa4')]=!![];BPromise[_0xa1d2('0xb9')]()[_0xa1d2('0x3f')](checkIsActive(_0x452ee9,_0x452ee9[_0xa1d2('0x7a')]))[_0xa1d2('0x3f')](checkInterval(_0x452ee9))['then'](_0xe6e064[_0xa1d2('0x139')](_0x452ee9))['then'](_0xe6e064[_0xa1d2('0x13d')](_0x452ee9['dialGlobalInterval'],_0x452ee9['dialTimezone'],_0x452ee9['name'],_0x452ee9))[_0xa1d2('0x3f')](_0xe6e064[_0xa1d2('0x13f')](_0x452ee9[_0xa1d2('0x47')],_0x452ee9[_0xa1d2('0x160')],_0x452ee9['name'],_0x452ee9))[_0xa1d2('0x3f')](_0xe6e064['launchHandleIvr'](_0x452ee9))[_0xa1d2('0xba')](loggerCatchQueueSummary(_0xa1d2('0x164'),_0x452ee9));}else{notSendMessagesCampaign(_0x452ee9);}}}};function getCallerIdRandom(_0xa78ace,_0x149343){var _0xa2e6db;var _0x1df427;var _0x44db24;if(_0x149343<=0x0){_0x149343=0x1;}_0xa2e6db=new RegExp(_0xa1d2('0x165')+_0x149343+'}$');_0x1df427=Math['pow'](0xa,_0x149343-0x1);_0x44db24=Math[_0xa1d2('0x166')](0xa,_0x149343)-0x1;return util[_0xa1d2('0x7c')]('%s',_[_0xa1d2('0x167')](_0xa78ace,_0xa2e6db,_[_0xa1d2('0x168')](_0x1df427,_0x44db24)));}function extractCalleridName(_0x53fe6e){var _0x1d8767=_0x53fe6e[_0xa1d2('0x169')](/"(.*?)"/);return _0x1d8767?_0x1d8767[0x1]:_0x53fe6e;}function extractCalleridNumber(_0x3aafe8){var _0xad034e=_0x3aafe8[_0xa1d2('0x169')](/<(.*?)>/);return _0xad034e?_0xad034e[0x1]:_0x3aafe8;}Dialer[_0xa1d2('0xb7')][_0xa1d2('0x16a')]=function(_0x308c51,_0x3b3e0){var _0x4e41c3=this;var _0x2a8fa6=uuid['v4']();this[_0xa1d2('0x25')][_0x2a8fa6]=new Action(_0x308c51,_0x3b3e0,_0x2a8fa6);return new BPromise(function(_0x4e293a,_0x7488d5){if(_[_0xa1d2('0x41')](_0x308c51)&&typeof _0x308c51!==_0xa1d2('0x16b')){return _0x7488d5(msgResponse('originate',_0xa1d2('0x140'),_0xa1d2('0x16c')));}if(_[_0xa1d2('0x41')](_0x3b3e0[_0xa1d2('0x16d')][_0xa1d2('0x16e')])||_0x3b3e0[_0xa1d2('0x16d')]['phone']===null){return _0x7488d5(msgResponse(_0xa1d2('0x16f'),'Failure',_0xa1d2('0x170')));}var _0x2ded4c={'XMD-CALLERID':_0x4e41c3[_0xa1d2('0x25')][_0x2a8fa6][_0xa1d2('0x171')](),'XMD-AGI':_0x308c51[_0xa1d2('0x107')]?util[_0xa1d2('0x7c')](_0xa1d2('0x172'),ipAgi,_0x308c51['dialQueueProject']):_0xa1d2('0x173'),'XMD-AGIAFTER':_0x308c51[_0xa1d2('0x10e')]?util['format'](_0xa1d2('0x172'),ipAgi,_0x308c51[_0xa1d2('0x10e')]):_0xa1d2('0x173'),'XMD-QUEUE':_0x308c51[_0xa1d2('0x50')]===_0xa1d2('0x51')?util[_0xa1d2('0x7c')](_0xa1d2('0x174'),_0x308c51[_0xa1d2('0x44')],_0x308c51[_0xa1d2('0x175')]||'',_0x308c51[_0xa1d2('0x176')]?'c':'',_0x308c51[_0xa1d2('0x113')]||0x3):_0xa1d2('0x173'),'XMD-CONTACTID':_0x3b3e0['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x4e41c3['actions'][_0x2a8fa6][_0xa1d2('0x171')](),'XMD-AMD':_0x308c51[_0xa1d2('0xe8')]?_0xa1d2('0x177'):'NONE','XMD-DESTINATION':'xcally-motion-dialer'};if(_0x308c51[_0xa1d2('0xe8')]){_0x2ded4c[_0xa1d2('0x178')]=_0x308c51[_0xa1d2('0x179')]||0x9c4;_0x2ded4c['XMD-AMDGREETING']=_0x308c51[_0xa1d2('0x17a')]||0x5dc;_0x2ded4c[_0xa1d2('0x17b')]=_0x308c51[_0xa1d2('0x17c')]||0x320;_0x2ded4c[_0xa1d2('0x17d')]=_0x308c51['dialAMDTotalAnalysisTime']||0x1388;_0x2ded4c[_0xa1d2('0x17e')]=_0x308c51[_0xa1d2('0x17f')]||0x64;_0x2ded4c[_0xa1d2('0x180')]=_0x308c51[_0xa1d2('0x181')]||0x32;_0x2ded4c[_0xa1d2('0x182')]=_0x308c51[_0xa1d2('0x183')]||0x3;_0x2ded4c[_0xa1d2('0x184')]=_0x308c51['dialAMDSilenceThreshold']||0x100;_0x2ded4c[_0xa1d2('0x185')]=_0x308c51['dialAMDMaximumWordLength']||0x1388;}if(_0x308c51[_0xa1d2('0x50')]===_0xa1d2('0x51')){_0x2ded4c[_0xa1d2('0x186')]=_0x3b3e0['VoiceQueueId'];}else{_0x2ded4c[_0xa1d2('0x187')]=_0x3b3e0[_0xa1d2('0x103')];}for(var _0xb431a8 in _0x3b3e0[_0xa1d2('0x16d')]){if(typeof _0x3b3e0['Contact'][_0xb431a8]!==_0xa1d2('0x9e')){if(isNotNull(_0x3b3e0['Contact'][_0xb431a8])&&_0xb431a8!=='id'&&_0xb431a8!==_0xa1d2('0x188')&&_0xb431a8!==_0xa1d2('0x189')&&_0xb431a8!==_0xa1d2('0x18a')){_0x2ded4c[util['format'](_0xa1d2('0x18b'),_0xa1d2('0x18c'),_[_0xa1d2('0x18d')](_0xb431a8))]=_0x3b3e0[_0xa1d2('0x16d')][_0xb431a8];}}}var _0x3ac6a2=_0x4e41c3[_0xa1d2('0xd9')](_0x308c51['Trunk'])?getCallerId(_0x308c51['Trunk'][_0xa1d2('0x18e')],_0x308c51[_0xa1d2('0x60')],_0x308c51[_0xa1d2('0x18f')]>0x0?getCallerIdRandom(_0x308c51[_0xa1d2('0x61')],_0x308c51[_0xa1d2('0x18f')]):_0x308c51[_0xa1d2('0x61')]):getCallerId(_[_0xa1d2('0xdb')](_0x308c51[_0xa1d2('0x13a')])?_0x308c51['Trunk'][_0xa1d2('0x18e')]:_0x308c51['TrunkBackup'][_0xa1d2('0x18e')],_0x308c51[_0xa1d2('0x60')],_0x308c51['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x308c51[_0xa1d2('0x61')],_0x308c51[_0xa1d2('0x18f')]):_0x308c51[_0xa1d2('0x61')]);if(_0x3ac6a2){_0x2ded4c[_0xa1d2('0x190')]=_0x4e41c3[_0xa1d2('0x25')][_0x2a8fa6][_0xa1d2('0x191')]=extractCalleridName(_0x3ac6a2);_0x2ded4c['XMD-ORIGINATECALLERIDNUM']=_0x4e41c3['actions'][_0x2a8fa6][_0xa1d2('0x192')]=extractCalleridNumber(_0x3ac6a2);}return ami[_0xa1d2('0xb0')]({'actionid':_0x2a8fa6,'action':_0xa1d2('0x16f'),'channel':_0x4e41c3[_0xa1d2('0xd9')](_0x308c51[_0xa1d2('0x79')])?util[_0xa1d2('0x7c')]('SIP/%s/%s%s',_0x308c51[_0xa1d2('0x79')][_0xa1d2('0x44')],isNotNull(_0x308c51[_0xa1d2('0x193')])?_0x308c51[_0xa1d2('0x193')][_0xa1d2('0x194')]()||'':'',_0x308c51[_0xa1d2('0x195')]>0x0?_0x3b3e0[_0xa1d2('0x16d')][_0xa1d2('0x16e')][_0xa1d2('0x196')](_0x308c51[_0xa1d2('0x195')]):_0x3b3e0[_0xa1d2('0x16d')]['phone']):util[_0xa1d2('0x7c')](_0xa1d2('0x197'),_[_0xa1d2('0xdb')](_0x308c51['TrunkBackup'])?_0x308c51[_0xa1d2('0x79')]['name']:_0x308c51[_0xa1d2('0x13a')][_0xa1d2('0x44')],isNotNull(_0x308c51['dialPrefix'])?_0x308c51[_0xa1d2('0x193')]['trim']()||'':'',_0x308c51[_0xa1d2('0x195')]>0x0?_0x3b3e0[_0xa1d2('0x16d')][_0xa1d2('0x16e')]['substring'](_0x308c51[_0xa1d2('0x195')]):_0x3b3e0[_0xa1d2('0x16d')][_0xa1d2('0x16e')]),'callerid':_0x3ac6a2,'Exten':_0xa1d2('0xde'),'Context':'from-sip','Priority':'1','variable':_0x2ded4c,'timeout':(_0x308c51[_0xa1d2('0x62')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2a8fa6})['then'](function(_0x5804b6){return _0x4e293a(_0x5804b6);})['catch'](function(_0x45fc3c){_0x308c51[_0xa1d2('0x6c')]+=0x1;var _0x3eb84f=new History(_0x4e41c3['actions'][_0x2a8fa6]);logger[_0xa1d2('0x99')](util[_0xa1d2('0x7c')](_0xa1d2('0x198'),JSON[_0xa1d2('0x7b')](_0x45fc3c)));_0x3eb84f[_0xa1d2('0xaa')]=0xe;_0x3eb84f[_0xa1d2('0xab')]=_0xa1d2('0x199');_0x3eb84f[_0xa1d2('0xad')]=moment()[_0xa1d2('0x7c')](_0xa1d2('0xf6'));_0x3eb84f['endtime']=_0x3eb84f[_0xa1d2('0xad')];_0x4e41c3['createHistory'](_0x3eb84f)['catch'](loggerCatch('[originate][error]'));_0x4e41c3[_0xa1d2('0xcc')](_0x3eb84f)['catch'](loggerCatch(_0xa1d2('0x19a')))[_0xa1d2('0x12b')](function(){delete _0x4e41c3[_0xa1d2('0x25')][_0x2a8fa6];return _0x7488d5(msgResponse(_0xa1d2('0x16f'),_0xa1d2('0x19b'),_0xa1d2('0x19c')));});});});};Dialer[_0xa1d2('0xb7')][_0xa1d2('0x33')]=function(_0x491493){var _0x24c0d8=this['actions'][_0x491493[_0xa1d2('0x121')]];if(_0x24c0d8){delete this[_0xa1d2('0x25')][_0x491493[_0xa1d2('0x121')]];_0x24c0d8['responsetime']=moment()[_0xa1d2('0x7c')](_0xa1d2('0xf6'));var _0x39b0ff=_0x24c0d8[_0xa1d2('0x50')]==='ivr'?this[_0xa1d2('0x21')][_0x24c0d8[_0xa1d2('0xb5')]]:this[_0xa1d2('0x20')][_0x24c0d8[_0xa1d2('0x19d')]()];if(!this[_0xa1d2('0x19e')](_0x491493[_0xa1d2('0x19f')])){this[_0xa1d2('0xb4')](_0x39b0ff);return this['callProgressDetecting'](_0x24c0d8,_0x39b0ff,_0x491493)['catch'](loggerCatch('[callProgressDetecting]\x20'));}this[_0xa1d2('0x27')][_0x491493['uniqueid']]=_0x24c0d8;}};Dialer[_0xa1d2('0xb7')][_0xa1d2('0x1a0')]=function(_0x379b55,_0x40f7a4,_0x201c7b){var _0x1e4cb6=new History(_0x40f7a4);if(_0x1e4cb6['countbusyretry']+_0x1e4cb6['countcongestionretry']+_0x1e4cb6[_0xa1d2('0xfe')]+_0x1e4cb6['countnosuchnumberretry']+_0x1e4cb6['countdropretry']+_0x1e4cb6[_0xa1d2('0xf0')]+_0x1e4cb6[_0xa1d2('0xeb')]+_0x1e4cb6[_0xa1d2('0xf1')]>=_0x201c7b['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x379b55){case 0x3:if(_0x1e4cb6[_0xa1d2('0xfe')]>=_0x201c7b[_0xa1d2('0x1a1')]-0x1){return!![];}this[_0xa1d2('0xc3')]({'active':![],'countnoanswerretry':_0x1e4cb6['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xa1d2('0x100')](_0x201c7b[_0xa1d2('0x1a2')],_0xa1d2('0x102'))[_0xa1d2('0x7c')](_0xa1d2('0xf6')),'ContactId':_0x1e4cb6['ContactId'],'ListId':_0x1e4cb6[_0xa1d2('0xd5')],'VoiceQueueId':_0x1e4cb6['VoiceQueueId']||undefined,'CampaignId':_0x1e4cb6[_0xa1d2('0x103')]||undefined})[_0xa1d2('0xba')](loggerCatch(_0xa1d2('0x1a3')));break;case 0x5:if(_0x1e4cb6['countbusyretry']>=_0x201c7b['dialBusyMaxRetry']-0x1){return!![];}this[_0xa1d2('0xc3')]({'active':![],'countbusyretry':_0x1e4cb6[_0xa1d2('0xed')]+=0x1,'scheduledat':moment()['add'](_0x201c7b[_0xa1d2('0x1a4')],_0xa1d2('0x102'))['format'](_0xa1d2('0xf6')),'ContactId':_0x1e4cb6[_0xa1d2('0xf7')],'ListId':_0x1e4cb6[_0xa1d2('0xd5')],'VoiceQueueId':_0x1e4cb6[_0xa1d2('0xf8')]||undefined,'CampaignId':_0x1e4cb6[_0xa1d2('0x103')]||undefined})['catch'](loggerCatch(_0xa1d2('0x1a5')));break;case 0x8:if(_0x1e4cb6[_0xa1d2('0xee')]>=_0x201c7b[_0xa1d2('0x1a6')]-0x1){return!![];}this[_0xa1d2('0xc3')]({'active':![],'countcongestionretry':_0x1e4cb6['countcongestionretry']+=0x1,'scheduledat':moment()[_0xa1d2('0x100')](_0x201c7b['dialCongestionRetryFrequency'],'minutes')[_0xa1d2('0x7c')](_0xa1d2('0xf6')),'ContactId':_0x1e4cb6['ContactId'],'ListId':_0x1e4cb6[_0xa1d2('0xd5')],'VoiceQueueId':_0x1e4cb6['VoiceQueueId']||undefined,'CampaignId':_0x1e4cb6['CampaignId']||undefined})['catch'](loggerCatch(_0xa1d2('0x1a7')));break;case 0x0:if(_0x1e4cb6[_0xa1d2('0x1a8')]>=_0x201c7b[_0xa1d2('0x1a9')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x1e4cb6[_0xa1d2('0x1a8')]+=0x1,'scheduledat':moment()[_0xa1d2('0x100')](_0x201c7b['dialNoSuchNumberRetryFrequency'],_0xa1d2('0x102'))[_0xa1d2('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1e4cb6[_0xa1d2('0xf7')],'ListId':_0x1e4cb6[_0xa1d2('0xd5')],'VoiceQueueId':_0x1e4cb6['VoiceQueueId']||undefined,'CampaignId':_0x1e4cb6[_0xa1d2('0x103')]||undefined})[_0xa1d2('0xba')](loggerCatch(_0xa1d2('0x1aa')));}break;case 0xa:if(_0x1e4cb6[_0xa1d2('0xef')]>=_0x201c7b[_0xa1d2('0x1ab')]-0x1){return!![];}this[_0xa1d2('0xc3')]({'active':![],'countdropretry':_0x1e4cb6['countdropretry']+=0x1,'scheduledat':moment()[_0xa1d2('0x100')](_0x201c7b[_0xa1d2('0x117')],'minutes')[_0xa1d2('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1e4cb6[_0xa1d2('0xf7')],'ListId':_0x1e4cb6[_0xa1d2('0xd5')],'VoiceQueueId':_0x1e4cb6[_0xa1d2('0xf8')]||undefined,'CampaignId':_0x1e4cb6[_0xa1d2('0x103')]||undefined})[_0xa1d2('0xba')](loggerCatch(_0xa1d2('0x1ac')));break;case 0xb:if(_0x1e4cb6['countabandonedretry']>=_0x201c7b[_0xa1d2('0x11b')]-0x1){return!![];}this[_0xa1d2('0xc3')]({'active':![],'countabandonedretry':_0x1e4cb6[_0xa1d2('0xf0')]+=0x1,'scheduledat':moment()['add'](_0x201c7b[_0xa1d2('0x11c')],_0xa1d2('0x102'))[_0xa1d2('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1e4cb6[_0xa1d2('0xf7')],'ListId':_0x1e4cb6[_0xa1d2('0xd5')],'VoiceQueueId':_0x1e4cb6[_0xa1d2('0xf8')]||undefined,'CampaignId':_0x1e4cb6[_0xa1d2('0x103')]||undefined})['catch'](loggerCatch(_0xa1d2('0x1ad')));break;case 0x13:if(_0x1e4cb6[_0xa1d2('0xeb')]>=_0x201c7b['dialMachineMaxRetry']-0x1){return!![];}this[_0xa1d2('0xc3')]({'active':![],'countmachineretry':_0x1e4cb6[_0xa1d2('0xeb')]+=0x1,'scheduledat':moment()[_0xa1d2('0x100')](_0x201c7b[_0xa1d2('0x101')],_0xa1d2('0x102'))[_0xa1d2('0x7c')](_0xa1d2('0xf6')),'ContactId':_0x1e4cb6[_0xa1d2('0xf7')],'ListId':_0x1e4cb6[_0xa1d2('0xd5')],'VoiceQueueId':_0x1e4cb6[_0xa1d2('0xf8')]||undefined,'CampaignId':_0x1e4cb6['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x1e4cb6[_0xa1d2('0xf1')]>=_0x201c7b[_0xa1d2('0x1ae')]-0x1){return!![];}this[_0xa1d2('0xc3')]({'active':![],'countagentrejectretry':_0x1e4cb6[_0xa1d2('0xf1')]+=0x1,'scheduledat':moment()['add'](_0x201c7b['dialAgentRejectRetryFrequency'],_0xa1d2('0x102'))[_0xa1d2('0x7c')](_0xa1d2('0xf6')),'ContactId':_0x1e4cb6['ContactId'],'ListId':_0x1e4cb6[_0xa1d2('0xd5')],'VoiceQueueId':_0x1e4cb6[_0xa1d2('0xf8')]||undefined,'CampaignId':_0x1e4cb6[_0xa1d2('0x103')]||undefined})[_0xa1d2('0xba')](loggerCatch(_0xa1d2('0x1af')));break;default:return!![];}};Dialer[_0xa1d2('0xb7')][_0xa1d2('0x1b0')]=function(_0x4a33d0,_0x3ed43f,_0x27ec94){var _0x3d303d=this;var _0x2f4c6f=new History(_0x4a33d0);return new BPromise(function(_0x14befa,_0x476bca){if(_['isUndefined'](_0x3ed43f)&&typeof _0x3ed43f!==_0xa1d2('0x16b')){return _0x476bca(msgResponse(_0xa1d2('0x1b1'),_0xa1d2('0x140'),_0xa1d2('0x1b2')));}if(_['isUndefined'](_0x27ec94)&&typeof _0x27ec94!==_0xa1d2('0x16b')){return _0x476bca(msgResponse(_0xa1d2('0x1b1'),_0xa1d2('0x140'),'evt\x20is\x20undefine'));}switch(_0x27ec94[_0xa1d2('0x10b')]){case'0':_0x3ed43f[_0xa1d2('0x6b')]+=0x1;_0x2f4c6f[_0xa1d2('0xaa')]=0x0;_0x2f4c6f[_0xa1d2('0xab')]='NoSuchNumber';_0x2f4c6f[_0xa1d2('0x1a8')]+=0x1;_0x2f4c6f[_0xa1d2('0xec')]+=0x1;ami[_0xa1d2('0x4f')](_0xa1d2('0x1b3'),ut[_0xa1d2('0xe4')](_0x4a33d0,_0xa1d2('0x1b4')));_0x3d303d[_0xa1d2('0xce')](_0x2f4c6f)[_0xa1d2('0xba')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x3d303d['checkRetriveMax'](0x0,_0x4a33d0,_0x3ed43f)){if(_0x2f4c6f[_0xa1d2('0x1a8')]>=_0x3ed43f['dialNoSuchNumberMaxRetry']){_0x3d303d[_0xa1d2('0xff')](_0x2f4c6f,_0x14befa,_0x476bca,_0xa1d2('0x1b5'));}else{_0x3d303d[_0xa1d2('0x1b6')](_0x2f4c6f,_0x14befa,_0x476bca,_0xa1d2('0x1b5'));}}break;case'3':_0x3ed43f[_0xa1d2('0x6a')]+=0x1;_0x2f4c6f[_0xa1d2('0xaa')]=0x3;_0x2f4c6f['statedesc']=_0xa1d2('0x1b7');_0x2f4c6f['countnoanswerretry']+=0x1;_0x2f4c6f[_0xa1d2('0xec')]+=0x1;ami[_0xa1d2('0x4f')](_0xa1d2('0x1b8'),ut['buildObj'](_0x4a33d0,_0xa1d2('0x1b9')));_0x3d303d['createHistory'](_0x2f4c6f)[_0xa1d2('0xba')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x3d303d['checkRetriveMax'](0x3,_0x4a33d0,_0x3ed43f)){if(_0x2f4c6f[_0xa1d2('0xfe')]>=_0x3ed43f[_0xa1d2('0x1a1')]){_0x3d303d['createStateFinal'](_0x2f4c6f,_0x14befa,_0x476bca,_0xa1d2('0x1ba'));}else{_0x3d303d[_0xa1d2('0x1b6')](_0x2f4c6f,_0x14befa,_0x476bca,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x3ed43f['outboundBusyCallsDay']+=0x1;_0x2f4c6f['state']=0x5;_0x2f4c6f[_0xa1d2('0xab')]=_0xa1d2('0x1bb');_0x2f4c6f['countbusyretry']+=0x1;_0x2f4c6f['countglobal']+=0x1;ami[_0xa1d2('0x4f')](_0xa1d2('0x1bc'),ut[_0xa1d2('0xe4')](_0x4a33d0,_0xa1d2('0x1bd')));_0x3d303d['createHistory'](_0x2f4c6f)['catch'](loggerCatch(_0xa1d2('0x1be')));if(_0x3d303d[_0xa1d2('0x1a0')](0x5,_0x4a33d0,_0x3ed43f)){if(_0x2f4c6f[_0xa1d2('0xed')]>=_0x3ed43f['dialBusyMaxRetry']){_0x3d303d[_0xa1d2('0xff')](_0x2f4c6f,_0x14befa,_0x476bca,_0xa1d2('0x1bf'));}else{_0x3d303d['stateGlobal'](_0x2f4c6f,_0x14befa,_0x476bca,_0xa1d2('0x1bf'));}}break;case'8':_0x3ed43f['outboundCongestionCallsDay']+=0x1;_0x2f4c6f[_0xa1d2('0xaa')]=0x8;_0x2f4c6f[_0xa1d2('0xab')]=_0xa1d2('0x1c0');_0x2f4c6f['countcongestionretry']+=0x1;_0x2f4c6f[_0xa1d2('0xec')]+=0x1;ami[_0xa1d2('0x4f')](_0xa1d2('0x1c1'),ut[_0xa1d2('0xe4')](_0x4a33d0,'congestion'));_0x3d303d[_0xa1d2('0xce')](_0x2f4c6f)[_0xa1d2('0xba')](loggerCatch(_0xa1d2('0x1c2')));if(_0x3d303d[_0xa1d2('0x1a0')](0x8,_0x4a33d0,_0x3ed43f)){if(_0x2f4c6f[_0xa1d2('0xee')]>=_0x3ed43f['dialCongestionMaxRetry']){_0x3d303d[_0xa1d2('0xff')](_0x2f4c6f,_0x14befa,_0x476bca,'reason\x208\x20congestion');}else{_0x3d303d[_0xa1d2('0x1b6')](_0x2f4c6f,_0x14befa,_0x476bca,_0xa1d2('0x1c3'));}}break;case'11':_0x3ed43f[_0xa1d2('0x1c4')]+=0x1;_0x2f4c6f[_0xa1d2('0xaa')]=0xb;_0x2f4c6f[_0xa1d2('0xab')]=_0xa1d2('0x11a');_0x2f4c6f['countabandonedretry']+=0x1;_0x2f4c6f[_0xa1d2('0xec')]+=0x1;_0x3d303d[_0xa1d2('0xce')](_0x2f4c6f)[_0xa1d2('0xba')](loggerCatch(_0xa1d2('0x11e')));if(_0x3d303d[_0xa1d2('0x1a0')](0xb,_0x4a33d0,_0x3ed43f)){if(_0x2f4c6f[_0xa1d2('0xf0')]>=_0x3ed43f[_0xa1d2('0x11b')]){_0x3d303d['createStateFinal'](_0x2f4c6f,_0x14befa,_0x476bca,_0xa1d2('0x1c5'));}else{_0x3d303d['stateGlobal'](_0x2f4c6f,_0x14befa,_0x476bca,'reason\x2011\x20abandoned');}}break;case'20':_0x3ed43f['outboundRejectCallsDay']+=0x1;_0x2f4c6f[_0xa1d2('0xaa')]=0x14;_0x2f4c6f[_0xa1d2('0xab')]=_0xa1d2('0x1c6');_0x2f4c6f[_0xa1d2('0xf1')]+=0x1;_0x2f4c6f[_0xa1d2('0xec')]+=0x1;ami[_0xa1d2('0x4f')](_0xa1d2('0x1c7'),ut[_0xa1d2('0xe4')](_0x4a33d0,_0xa1d2('0x1c8')));_0x3d303d[_0xa1d2('0xce')](_0x2f4c6f)[_0xa1d2('0xba')](loggerCatch(_0xa1d2('0x1c9')));if(_0x3d303d[_0xa1d2('0x1a0')](0x14,_0x4a33d0,_0x3ed43f)){if(_0x2f4c6f['countagentrejectretry']>=_0x3ed43f[_0xa1d2('0x1ae')]){_0x3d303d[_0xa1d2('0xff')](_0x2f4c6f,_0x14befa,_0x476bca,_0xa1d2('0x1ca'));}else{_0x3d303d[_0xa1d2('0x1b6')](_0x2f4c6f,_0x14befa,_0x476bca,_0xa1d2('0x1ca'));}}break;default:_0x3ed43f[_0xa1d2('0x6e')]+=0x1;_0x2f4c6f['state']=0xc;_0x2f4c6f[_0xa1d2('0xab')]=_0x27ec94[_0xa1d2('0x10b')];_0x3d303d[_0xa1d2('0xce')](_0x2f4c6f)[_0xa1d2('0xba')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x3d303d[_0xa1d2('0x1a0')](_0x27ec94[_0xa1d2('0x10b')],_0x4a33d0,_0x3ed43f)){if(_0x2f4c6f[_0xa1d2('0xed')]+_0x2f4c6f[_0xa1d2('0xee')]+_0x2f4c6f[_0xa1d2('0xfe')]+_0x2f4c6f['countnosuchnumberretry']+_0x2f4c6f[_0xa1d2('0xef')]+_0x2f4c6f[_0xa1d2('0xf0')]+_0x2f4c6f[_0xa1d2('0xeb')]+_0x2f4c6f[_0xa1d2('0xf1')]>=_0x3ed43f[_0xa1d2('0xf2')]){_0x3d303d[_0xa1d2('0x1b6')](_0x2f4c6f,_0x14befa,_0x476bca,_0x27ec94['reason']);}else{_0x3d303d[_0xa1d2('0xff')](_0x2f4c6f,_0x14befa,_0x476bca,_0x27ec94[_0xa1d2('0x10b')]);}}}});};Dialer['prototype'][_0xa1d2('0x1b6')]=function(_0x2347a9,_0x17316f,_0x51c430,_0x2ca087){var _0x3e7858=new Final(_0x2347a9);_0x3e7858[_0xa1d2('0xaa')]=0xf;_0x3e7858[_0xa1d2('0xab')]=_0xa1d2('0x1cb');this[_0xa1d2('0xff')](_0x3e7858,_0x17316f,_0x51c430,_0x2ca087);};Dialer[_0xa1d2('0xb7')][_0xa1d2('0xff')]=function(_0x3faa95,_0xb6a48e,_0x2647c4,_0x363720){this['moveContactManagedDialer'](_0x3faa95)[_0xa1d2('0x3f')](function(){return _0xb6a48e(msgResponse(_0xa1d2('0x1b1'),'Success',_0x363720));})[_0xa1d2('0xba')](function(){return _0x2647c4(msgResponse(_0xa1d2('0x1cc'),'Failure',_0xa1d2('0x1cd')));});};Dialer[_0xa1d2('0xb7')][_0xa1d2('0xb')]=function(_0x48c468){var _0x51f45e=_0x48c468[_0xa1d2('0x1ce')]/0x64;var _0x29aaf2=_0x48c468['outboundDropCallsDayTimeout']/(_0x48c468[_0xa1d2('0x69')]+_0x48c468[_0xa1d2('0x64')]);var _0x30c890=Math[_0xa1d2('0x1cf')](_0x48c468[_0xa1d2('0x1d0')]*(_0x48c468[_0xa1d2('0x1d1')]/0x64));var _0x1eefa2=Math[_0xa1d2('0x1cf')](_0x48c468[_0xa1d2('0x1d0')]*(_0x48c468[_0xa1d2('0x1d2')]/0x64));var _0x41d0de=_0x48c468['available']+_0x48c468[_0xa1d2('0x59')];var _0x5e8fc8=Math['floor'](_0x48c468['erlangCalls']*_0x48c468[_0xa1d2('0x77')]*_0x48c468[_0xa1d2('0x1d3')]*_0x48c468[_0xa1d2('0x73')]);if(_[_0xa1d2('0x41')](_0x48c468['startProgressive'])){if(!_['isUndefined'](_0x48c468[_0xa1d2('0x29')])){_0x48c468[_0xa1d2('0x29')]=undefined;loggerPredictive[_0xa1d2('0x99')](_0xa1d2('0x1d4'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x48c468[_0xa1d2('0x93')])){loggerPredictive[_0xa1d2('0x99')]('[startMethodPredictive][StartProgressive]',_0xa1d2('0x1d5'));clearInterval(_0x48c468[_0xa1d2('0x93')]);_0x48c468[_0xa1d2('0x93')]=undefined;}_0x48c468['startProgressive']=moment()[_0xa1d2('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xa1d2('0x7f')](_0x48c468[_0xa1d2('0x44')],_0xa1d2('0x1d6'),_0x48c468[_0xa1d2('0x2a')]);this[_0xa1d2('0x155')](_0x48c468,0x1);}else if(ifInterval(_0x48c468[_0xa1d2('0x1d7')],_0x48c468[_0xa1d2('0x2a')])){this[_0xa1d2('0x155')](_0x48c468,0x1);loggerPredictiveCalls['info'](_0xa1d2('0x1d8'),_0x48c468[_0xa1d2('0x2a')],_0x48c468[_0xa1d2('0x44')]);_0x48c468[_0xa1d2('0x75')]=0x0;_0x48c468[_0xa1d2('0x72')]=0x0;}else if(_0x51f45e<_0x29aaf2&&_0x48c468['dialPredictiveOptimization']===_0xa1d2('0x1d9')){freeVariablesPredictive(_0x48c468);loggerPredictive[_0xa1d2('0x7f')](_0xa1d2('0x1da'),_0xa1d2('0x1db'),_0x29aaf2,_0xa1d2('0x2a'),_0x48c468[_0xa1d2('0x44')]);}else if(_0x5e8fc8<_0x48c468['predictiveIntervalErlangCallsDroppedCalls']&&_0x48c468[_0xa1d2('0x1dc')]===_0xa1d2('0x1d9')){freeVariablesPredictive(_0x48c468);loggerPredictive[_0xa1d2('0x7f')](_0xa1d2('0x1dd'),_0xa1d2('0x1de'),_0x5e8fc8,_0xa1d2('0x1df'),_0x48c468[_0xa1d2('0x72')],'startProgressive',_0x48c468[_0xa1d2('0x44')]);}else if(!ifInterval(_0x48c468[_0xa1d2('0x1d7')],_0x48c468[_0xa1d2('0x2a')])&&_[_0xa1d2('0x41')](_0x48c468[_0xa1d2('0x29')])&&!_[_0xa1d2('0x41')](_0x48c468[_0xa1d2('0x2a')])){_0x48c468[_0xa1d2('0x29')]=moment()[_0xa1d2('0x7c')](_0xa1d2('0xf6'));loggerPredictive[_0xa1d2('0x7f')](_0x48c468['name'],_0xa1d2('0x1e0'),_0x48c468[_0xa1d2('0x29')]);this[_0xa1d2('0xc0')](_0x48c468[_0xa1d2('0x1d7')])[_0xa1d2('0x3f')](this[_0xa1d2('0x1e1')](_0x48c468))[_0xa1d2('0x3f')](mergeDataErlangB(_0x48c468))['then'](this['startMethodPredictive'](_0x48c468))[_0xa1d2('0xba')](loggerCatchPredictive(_0xa1d2('0x1e2'),_0x48c468));}else if(!ifInterval(_0x48c468[_0xa1d2('0x1d7')],_0x48c468['startPredictive'])){_0x48c468['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x48c468[_0xa1d2('0x29')]=moment()[_0xa1d2('0x7c')](_0xa1d2('0xf6'));loggerPredictive[_0xa1d2('0x7f')](_0x48c468[_0xa1d2('0x44')],'recalculate\x20predictive\x20at',_0x48c468[_0xa1d2('0x29')]);clearInterval(_0x48c468[_0xa1d2('0x93')]);_0x48c468[_0xa1d2('0x93')]=undefined;this[_0xa1d2('0xc0')](_0x48c468[_0xa1d2('0x1d7')])[_0xa1d2('0x3f')](this[_0xa1d2('0x1e1')](_0x48c468))[_0xa1d2('0x3f')](mergeDataErlangB(_0x48c468))[_0xa1d2('0x3f')](this[_0xa1d2('0x1e3')](_0x48c468))[_0xa1d2('0xba')](loggerCatchPredictive(_0xa1d2('0x1e4'),_0x48c468));}else if(_0x48c468[_0xa1d2('0x1d0')]&&_0x41d0de<_0x48c468[_0xa1d2('0x1d0')]-_0x1eefa2){freeVariablesPredictive(_0x48c468);loggerPredictive[_0xa1d2('0x7f')](_0x48c468[_0xa1d2('0x44')],_0xa1d2('0x1e5'),_0x41d0de,')\x20are\x20less\x20than\x20threshold\x20(',_0x48c468['predictiveIntervalAvailable'],'-',_0x1eefa2,'=',_0x48c468['predictiveIntervalAvailable']-_0x1eefa2,')');}else if(_0x48c468[_0xa1d2('0x1d0')]&&_0x41d0de>_0x48c468['predictiveIntervalAvailable']+_0x30c890){freeVariablesPredictive(_0x48c468);loggerPredictive[_0xa1d2('0x7f')](_0x48c468[_0xa1d2('0x44')],_0xa1d2('0x1e5'),_0x41d0de,_0xa1d2('0x1e6'),_0x48c468[_0xa1d2('0x1d0')],'+',_0x30c890,'=',_0x48c468[_0xa1d2('0x1d0')]+_0x30c890,')');}};Dialer[_0xa1d2('0xb7')][_0xa1d2('0x1e1')]=function(_0x577d7a){var _0x4bb5d3=this;return function(_0x5b7a44){return new BPromise(function(_0x40f331,_0x3c203a){_['merge'](_0x577d7a,_0x5b7a44[0x0]);if(checkGetDataPredictive(_0x5b7a44[0x0])){var _0x117b27=_0x577d7a[_0xa1d2('0x1d0')]=_0x577d7a[_0xa1d2('0x59')]+_0x577d7a[_0xa1d2('0x53')];var _0x408187=_0x577d7a[_0xa1d2('0x1d7')]*0x3c;var _0x3cb516=_0x5b7a44[0x0][_0xa1d2('0x70')]+_0x5b7a44[0x0][_0xa1d2('0x6f')];var _0xde9aac=(_0x5b7a44[0x0][_0xa1d2('0x83')]+_0x5b7a44[0x0][_0xa1d2('0x71')]+_0x5b7a44[0x0][_0xa1d2('0x85')])/_0x5b7a44[0x0][_0xa1d2('0x81')];_0x577d7a[_0xa1d2('0x1d3')]=_0xde9aac>0x0?_0xde9aac:0x1;switch(_0x577d7a[_0xa1d2('0x1dc')]){case _0xa1d2('0x1d9'):var _0x5c8037=_0x577d7a[_0xa1d2('0x1ce')]/0x64;return _0x4bb5d3['abandonmentRate'](_0x117b27,_0x408187,_0x3cb516,_0xde9aac,_0x5c8037)[_0xa1d2('0x3f')](function(_0x403dbd){return _0x40f331(_0x403dbd);});case _0xa1d2('0x1e7'):var _0x1f1687=_0x577d7a[_0xa1d2('0x1ce')]/0x64;return _0x4bb5d3[_0xa1d2('0x1e8')](_0x117b27,_0x408187,_0x3cb516,_0xde9aac,_0x1f1687)[_0xa1d2('0x3f')](function(_0x4a9045){return _0x40f331(_0x4a9045);});default:return _0x3c203a(msgResponse(_0xa1d2('0x1e9'),_0xa1d2('0x140'),_0xa1d2('0x1ea')));}}else{return _0x3c203a(msgResponse(_0xa1d2('0x1e9'),_0xa1d2('0x140'),_0xa1d2('0x1eb')));}});};};Dialer[_0xa1d2('0xb7')][_0xa1d2('0x1ec')]=function(_0x47a500){var _0x215aab=this;return function(_0x41d27f){return new BPromise(function(_0x4fce1f,_0x442e9f){_[_0xa1d2('0x91')](_0x47a500,_0x41d27f[0x0]);if(checkGetDataPredictive(_0x41d27f[0x0])){loggerPredictive[_0xa1d2('0x7f')](JSON[_0xa1d2('0x7b')](_0x41d27f[0x0]));if(_0x47a500[_0xa1d2('0x1dc')]===_0xa1d2('0x1d9')){return _0x215aab[_0xa1d2('0xcb')](_0x47a500['id'])['then'](function(_0x39bdfe){var _0x5dd74c=_0x47a500['loggedIn']-_0x39bdfe[0x0][_0xa1d2('0x1ed')];var _0x4a04a0=_0x47a500[_0xa1d2('0x1d7')]*0x3c;var _0x56e5f3=_0x41d27f[0x0][_0xa1d2('0x70')]+_0x41d27f[0x0][_0xa1d2('0x6f')];var _0x56b41d=(_0x41d27f[0x0]['predictiveIntervalAnsweredCalls']+_0x41d27f[0x0][_0xa1d2('0x71')]+_0x41d27f[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x41d27f[0x0][_0xa1d2('0x81')];var _0x4c7639=_0x47a500[_0xa1d2('0x1ce')]/0x64;_0x47a500[_0xa1d2('0x74')]=_0x39bdfe[0x0]['outboundQueuePauses']||0x0;_0x47a500['predictiveIntervalHitRate']=_0x56b41d>0x0?_0x56b41d:0x1;return _0x215aab[_0xa1d2('0x1ee')](_0x5dd74c,_0x4a04a0,_0x56e5f3,_0x56b41d,_0x4c7639);})[_0xa1d2('0x3f')](function(_0xef5946){return _0x4fce1f(_0xef5946);})[_0xa1d2('0xba')](function(_0x2e21ed){return _0x442e9f(msgResponse(_0xa1d2('0x1ef'),'Failure',JSON[_0xa1d2('0x7b')](_0x2e21ed)));});}if(_0x47a500['dialPredictiveOptimization']===_0xa1d2('0x1e7')){return _0x215aab['getVoiceQueueRtPauses'](_0x47a500['id'])['then'](function(_0x15a34f){var _0x24c6f4=_0x47a500['loggedIn']-_0x15a34f[0x0]['outboundQueuePauses'];var _0x22ded2=_0x47a500[_0xa1d2('0x1d7')]*0x3c;var _0x1a9b14=_0x41d27f[0x0][_0xa1d2('0x70')]+_0x41d27f[0x0][_0xa1d2('0x6f')];var _0x8c80ae=(_0x41d27f[0x0][_0xa1d2('0x83')]+_0x41d27f[0x0][_0xa1d2('0x71')]+_0x41d27f[0x0][_0xa1d2('0x85')])/_0x41d27f[0x0][_0xa1d2('0x81')];var _0x3448c8=_0x47a500['dialPredictiveOptimizationPercentage']/0x64;_0x47a500[_0xa1d2('0x74')]=_0x15a34f[0x0]['outboundQueuePauses']||0x0;_0x47a500[_0xa1d2('0x1d3')]=_0x8c80ae>0x0?_0x8c80ae:0x1;return _0x215aab['busyFactor'](_0x24c6f4,_0x22ded2,_0x1a9b14,_0x8c80ae,_0x3448c8);})[_0xa1d2('0x3f')](function(_0x8bc6cc){return _0x4fce1f(_0x8bc6cc);})['catch'](function(_0x3a15a5){return _0x442e9f(msgResponse(_0xa1d2('0x1ef'),'Failure',JSON[_0xa1d2('0x7b')](_0x3a15a5)));});}}else{return _0x442e9f(msgResponse(_0xa1d2('0x1e9'),'Failure',_0xa1d2('0x1eb')));}});};};Dialer[_0xa1d2('0xb7')][_0xa1d2('0x1e3')]=function(_0x302ae5){var _0x3bf921=this;return function(){var _0x118eb1=0x0;var _0x11b512=Math['floor'](_0x302ae5[_0xa1d2('0x76')]*0x3e8);if(_0x11b512>0x0){_0x11b512=_0x11b512<0x64?0x64:_0x11b512;loggerPredictive[_0xa1d2('0x7f')](_0x302ae5['name'],_0xa1d2('0x1f0'),_0x11b512,'milliseconds');_0x302ae5[_0xa1d2('0x93')]=setInterval(function(){_0x3bf921[_0xa1d2('0x93')](_0x302ae5);loggerPredictiveCalls[_0xa1d2('0x7f')]('[handlePredictive]',_0x118eb1+=0x1);},_0x11b512);}else{loggerPredictive[_0xa1d2('0x7f')](_0x302ae5[_0xa1d2('0x44')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xa1d2('0xb7')][_0xa1d2('0x1f1')]=function(_0x295f40,_0x24795a){var _0x428f91=this;return function(_0x333231){if(_['isEmpty'](_0x333231)){if(_[_0xa1d2('0xdb')](_0x24795a[_0xa1d2('0xd6')])||!_0x24795a[_0xa1d2('0x1f2')]){if(_0x295f40[_0xa1d2('0x5f')]===_0xa1d2('0xa')){_0x295f40[_0xa1d2('0x127')]=_[_0xa1d2('0x41')](_0x295f40[_0xa1d2('0x127')])?!![]:_0x295f40[_0xa1d2('0x127')];var _0x18d5da=uuid['v4']();_0x428f91[_0xa1d2('0x25')][_0x18d5da]=new Action(_0x295f40,_0x24795a,_0x18d5da);loggerBooked[_0xa1d2('0x7f')](_0xa1d2('0x1f3'),_0x18d5da,_0xa1d2('0x1f4'),JSON[_0xa1d2('0x7b')](_0x295f40['queueStatusComplete']),'Queue:\x20',_0x295f40[_0xa1d2('0x44')]);if(_0x295f40[_0xa1d2('0x127')]){_0x295f40[_0xa1d2('0x127')]=![];_0x428f91[_0xa1d2('0x2c')][_0x428f91[_0xa1d2('0x25')][_0x18d5da]['queue']]=[];ami[_0xa1d2('0xb0')]({'actionid':_0x18d5da,'action':'queuestatus','queue':_0x295f40['name']})[_0xa1d2('0xba')](function(){_0x428f91[_0xa1d2('0xb4')](_0x295f40);_0x428f91[_0xa1d2('0xc3')]({'active':![],'ContactId':_0x428f91['actions'][_0x18d5da][_0xa1d2('0xf7')],'ListId':_0x428f91[_0xa1d2('0x25')][_0x18d5da]['ListId'],'VoiceQueueId':_0x428f91['actions'][_0x18d5da][_0xa1d2('0xf8')]||undefined,'CampaignId':_0x428f91['actions'][_0x18d5da][_0xa1d2('0x103')]||undefined})['catch'](loggerCatch(_0xa1d2('0x1f5')));delete _0x428f91['actions'][_0x18d5da];});}else{loggerBooked[_0xa1d2('0x7f')]('[booked][checkContactBlack][else]',JSON['stringify'](_0x295f40[_0xa1d2('0x127')]),_0xa1d2('0x1f6'),_0x295f40[_0xa1d2('0x44')]);_0x428f91[_0xa1d2('0xb4')](_0x295f40);_0x428f91[_0xa1d2('0xc3')]({'active':![],'ContactId':_0x428f91[_0xa1d2('0x25')][_0x18d5da][_0xa1d2('0xf7')],'ListId':_0x428f91[_0xa1d2('0x25')][_0x18d5da][_0xa1d2('0xd5')],'VoiceQueueId':_0x428f91['actions'][_0x18d5da][_0xa1d2('0xf8')]||undefined,'CampaignId':_0x428f91[_0xa1d2('0x25')][_0x18d5da][_0xa1d2('0x103')]||undefined})['catch'](loggerCatch(_0xa1d2('0x1f5')));delete _0x428f91[_0xa1d2('0x25')][_0x18d5da];}}else{return _0x428f91['actionOriginate'](_0x295f40,_0x24795a);}}else{if(getDiff(_0x24795a[_0xa1d2('0x1f7')])<_0x295f40['dialRecallMeTimeout']*0x3c){if(_0x24795a[_0xa1d2('0x15b')]&&!_0x24795a[_0xa1d2('0x15b')][_0xa1d2('0x1f8')]){_0x428f91[_0xa1d2('0x1f')][_0xa1d2('0x129')](_0x24795a['id'])[_0xa1d2('0x12b')](function(){_0x428f91[_0xa1d2('0xb4')](_0x295f40);});}else{_0x428f91['unlockContact']({'active':![]},_0x24795a['id'],0x1)[_0xa1d2('0x12b')](function(){_0x428f91[_0xa1d2('0xb4')](_0x295f40);});}}else{_0x295f40[_0xa1d2('0x6d')]+=0x1;_0x428f91[_0xa1d2('0xb4')](_0x295f40);if(_0x295f40[_0xa1d2('0x1f9')]){_0x428f91['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x24795a['ContactId'],'ListId':_0x24795a[_0xa1d2('0xd5')],'VoiceQueueId':_0x24795a[_0xa1d2('0xf8')]||undefined,'CampaignId':_0x24795a['CampaignId']||undefined})['catch'](loggerCatch(_0xa1d2('0x1fa')));_0x428f91[_0xa1d2('0xce')](createObjHistory(_0x295f40,_0x24795a,'RECALLINQUEUE',0x17,_0xa1d2('0x1fb')))[_0xa1d2('0xba')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x428f91[_0xa1d2('0xd3')](createObjHistory(_0x295f40,_0x24795a,'RECALLFAILEDTIMEOUT',0x16,_0xa1d2('0x1fc')),_0xa1d2('0x1fd'),'[Originate][HistoryRecallClose]');}}}}else{_0x295f40['outboundBlacklistCallsDay']+=0x1;_0x428f91[_0xa1d2('0xd3')](createObjHistory(_0x295f40,_0x24795a,'BLACKLIST',0xd,_0xa1d2('0x1fe')),_0xa1d2('0x1ff'),_0xa1d2('0x200'));throw'inBlackList';}};};Dialer['prototype'][_0xa1d2('0x15e')]=function(_0x395aa3){var _0xc6608=this;var _0x2283ca=_0x395aa3[_0xa1d2('0x201')]-_0x395aa3[_0xa1d2('0x9d')]-_0x395aa3[_0xa1d2('0xc7')];emitCampaignSummary(_0x395aa3);if(_0x2283ca>0x0){if(_0x2283ca>this[_0xa1d2('0x24')]){_0x2283ca=this[_0xa1d2('0x24')];}_0x395aa3[_0xa1d2('0xc7')]+=_0x2283ca;this['getContactDialerIvr'](_0x395aa3['id'],_0x2283ca,_0x395aa3[_0xa1d2('0x202')],_0x395aa3)[_0xa1d2('0x3f')](function(_0xaa2d7c){_0x395aa3[_0xa1d2('0xc7')]-=_0x2283ca;_0x395aa3[_0xa1d2('0xc7')]=_0x395aa3[_0xa1d2('0xc7')]>0x0?_0x395aa3[_0xa1d2('0xc7')]:0x0;if(!checkContactEmpty(_0xaa2d7c)){_0x395aa3['message']=_0xa1d2('0xa3');logger[_0xa1d2('0x7f')]('[getContactCampaign2][Empty]'+_0x395aa3[_0xa1d2('0x44')]);}else{_0x395aa3[_0xa1d2('0x9d')]+=_0xaa2d7c[_0xa1d2('0x9c')];_0x395aa3['message']=_0xa1d2('0x203');for(var _0x2ac061=0x0;_0x2ac061<_0xaa2d7c['length'];_0x2ac061+=0x1){_0x395aa3[_0xa1d2('0x204')]+=0x1;if(_['isNil'](_0xaa2d7c[_0x2ac061])||_[_0xa1d2('0xdb')](_0xaa2d7c[_0x2ac061]['Contact'])||_['isNil'](_0xaa2d7c[_0x2ac061][_0xa1d2('0x16d')][_0xa1d2('0x16e')])){_0xc6608[_0xa1d2('0xd2')](_0xa1d2('0x205'),_0x395aa3,_0xaa2d7c[_0x2ac061]);}else{_0xc6608['checkIsBlackListIvr'](_[_0xa1d2('0xd4')](_0xaa2d7c[_0x2ac061],[_0xa1d2('0x103'),_0xa1d2('0x206')]))['then'](_0xc6608[_0xa1d2('0x1f1')](_0x395aa3,_0xaa2d7c[_0x2ac061]))[_0xa1d2('0xba')](_0xc6608[_0xa1d2('0x207')]('[actionOriginateIvr]\x20',_0x395aa3));}}}})[_0xa1d2('0xba')](loggerGetContactDialer('[getContactCampaign2]',_0x395aa3,_0x2283ca));}};Dialer['prototype'][_0xa1d2('0x155')]=function(_0x4bd68e,_0x4cf53a){var _0x5c70e7=this;var _0x48153c=[];var _0x28fa61=_0x4cf53a>=0x1?_0x4cf53a:0x1;if(_0x4bd68e[_0xa1d2('0x5f')]==='booked'){_0x28fa61=0x1;}var _0x364df2=Math['floor'](_0x4bd68e[_0xa1d2('0x53')]*_0x28fa61)-_0x4bd68e[_0xa1d2('0x9d')]-_0x4bd68e[_0xa1d2('0xc7')];emitVoiceQueueSummary(_0x4bd68e);if(_0x4bd68e[_0xa1d2('0x208')]>0x0){var _0x92eea5=_0x4bd68e[_0xa1d2('0x208')]-_0x4bd68e[_0xa1d2('0x9d')]-_0x4bd68e[_0xa1d2('0x59')]-_0x4bd68e[_0xa1d2('0xc7')]-_0x4bd68e[_0xa1d2('0x55')];if(_0x364df2>_0x92eea5){_0x364df2=_0x92eea5;}}if(_0x364df2>0x0){if(_0x4bd68e[_0xa1d2('0x5f')]===_0xa1d2('0xa')){_0x364df2=0x1;}if(_0x364df2>this[_0xa1d2('0x24')]){_0x364df2=this[_0xa1d2('0x24')];}_0x4bd68e[_0xa1d2('0xc7')]+=_0x364df2;for(var _0x105c28 in this[_0xa1d2('0x22')]){if(typeof this[_0xa1d2('0x22')][_0x105c28]!==_0xa1d2('0x9e')){if(this[_0xa1d2('0x22')][_0x105c28]['state']===_0xa1d2('0x209')&&this[_0xa1d2('0x22')][_0x105c28]['status']===_0xa1d2('0x20a')){_0x48153c[_0xa1d2('0x146')](this['agents'][_0x105c28]['id']);}}}this[_0xa1d2('0xc6')](_0x4bd68e['id'],_0x48153c,_0x364df2,_0x4bd68e[_0xa1d2('0x202')],_0x4bd68e)[_0xa1d2('0x3f')](function(_0x37955a){_0x4bd68e[_0xa1d2('0xc7')]-=_0x364df2;_0x4bd68e[_0xa1d2('0xc7')]=_0x4bd68e['temp']>0x0?_0x4bd68e['temp']:0x0;if(!checkContactEmpty(_0x37955a)){_0x5c70e7[_0xa1d2('0xb8')](_0x4bd68e)[_0xa1d2('0x3f')](sendMessageReschedule(_0x4bd68e))[_0xa1d2('0xba')](loggerCatch(_0xa1d2('0xbb')));}else{_0x4bd68e[_0xa1d2('0x9d')]+=_0x37955a[_0xa1d2('0x9c')];_0x4bd68e[_0xa1d2('0x42')]=_0x4bd68e[_0xa1d2('0x5f')]===_0xa1d2('0xa')?_0xa1d2('0x177'):_0xa1d2('0x203');for(var _0x5b799a=0x0;_0x5b799a<_0x37955a[_0xa1d2('0x9c')];_0x5b799a+=0x1){if(_[_0xa1d2('0xdb')](_0x37955a[_0x5b799a])||_[_0xa1d2('0xdb')](_0x37955a[_0x5b799a]['Contact'])||_['isNil'](_0x37955a[_0x5b799a][_0xa1d2('0x16d')][_0xa1d2('0x16e')])){_0x5c70e7[_0xa1d2('0xd2')](_0xa1d2('0x205'),_0x4bd68e,_0x37955a[_0x5b799a]);}else{_0x5c70e7['checkIsBlackList'](_[_0xa1d2('0xd4')](_0x37955a[_0x5b799a],[_0xa1d2('0xf8'),'Contact.phone']))[_0xa1d2('0x3f')](_0x5c70e7['checkContactBlack'](_0x4bd68e,_0x37955a[_0x5b799a]))['catch'](_0x5c70e7['loggerHandler'](_0xa1d2('0x205'),_0x4bd68e));}}}})[_0xa1d2('0xba')](loggerGetContactDialer(_0xa1d2('0x20b'),_0x4bd68e,_0x364df2));}};Dialer[_0xa1d2('0xb7')]['handlePredictive']=function(_0x1f1541){if(_0x1f1541[_0xa1d2('0x208')]>0x0){var _0x52a823=_0x1f1541[_0xa1d2('0x208')]-_0x1f1541['originated']-_0x1f1541['talking'];if(_0x52a823>0x0){this['tryOriginatePredictive'](_0x1f1541);}else{loggerPredictiveCalls[_0xa1d2('0x7f')]('[handlePredictive][limitChannel]');}}else{this[_0xa1d2('0x20c')](_0x1f1541);}};Dialer[_0xa1d2('0xb7')]['tryOriginatePredictive']=function(_0x17d964){var _0x3cb901=this;var _0x378ede=[];_0x17d964[_0xa1d2('0x9d')]+=0x1;for(var _0x919ff5 in this[_0xa1d2('0x22')]){if(typeof this['agents'][_0x919ff5]!==_0xa1d2('0x9e')){if(this[_0xa1d2('0x22')][_0x919ff5][_0xa1d2('0xaa')]==='not_inuse'&&this[_0xa1d2('0x22')][_0x919ff5][_0xa1d2('0xb1')]==='reachable'){_0x378ede['push'](this[_0xa1d2('0x22')][_0x919ff5]['id']);}}}this[_0xa1d2('0xc6')](_0x17d964['id'],_0x378ede,0x1,_0x17d964['dialOrderByScheduledAt'],_0x17d964)[_0xa1d2('0x3f')](function(_0x1ef261){if(!checkContactEmpty(_0x1ef261)){checkContactLowerLimitOriginate(_0x17d964,0x1,0x0);_0x3cb901[_0xa1d2('0xb8')](_0x17d964)[_0xa1d2('0x3f')](sendMessageReschedule(_0x17d964))['catch'](loggerCatch(_0xa1d2('0xbb')));}else{_0x17d964[_0xa1d2('0x42')]=_0xa1d2('0x203');if(_[_0xa1d2('0xdb')](_0x1ef261[0x0])||_[_0xa1d2('0xdb')](_0x1ef261[0x0][_0xa1d2('0x16d')])||_['isNil'](_0x1ef261[0x0][_0xa1d2('0x16d')][_0xa1d2('0x16e')])){_0x3cb901[_0xa1d2('0xd2')](_0xa1d2('0x205'),_0x17d964,_0x1ef261[0x0]);}else{_0x3cb901[_0xa1d2('0xbc')](_[_0xa1d2('0xd4')](_0x1ef261[0x0],['VoiceQueueId',_0xa1d2('0x206')]))[_0xa1d2('0x3f')](_0x3cb901[_0xa1d2('0x1f1')](_0x17d964,_0x1ef261[0x0]))[_0xa1d2('0xba')](_0x3cb901[_0xa1d2('0x207')](_0xa1d2('0x20d'),_0x17d964));}}})[_0xa1d2('0xba')](loggerGetContactDialer('[getContactDialerPredictive]',_0x17d964,0x1));emitVoiceQueueSummary(_0x17d964);};Dialer[_0xa1d2('0xb7')][_0xa1d2('0x1ee')]=function(_0x4acd89,_0x1be761,_0x1fc47d,_0x257c6f,_0xf4f4d8,_0x4721e2){loggerPredictive[_0xa1d2('0x7f')](_0xa1d2('0x20e'));loggerPredictive[_0xa1d2('0x7f')]('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',_0x4acd89);loggerPredictive[_0xa1d2('0x7f')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1be761);loggerPredictive[_0xa1d2('0x7f')](_0xa1d2('0x20f'),_0x1fc47d);loggerPredictive[_0xa1d2('0x7f')](_0xa1d2('0x210'),_0x257c6f);loggerPredictive[_0xa1d2('0x7f')](_0xa1d2('0x211'),_0xf4f4d8);loggerPredictive[_0xa1d2('0x7f')](_0xa1d2('0x88'));return new BPromise(function(_0x5ada4e,_0x299259){if(_0x4acd89<=0x0||isNaN(_0x4acd89)){return _0x299259(msgResponse(_0xa1d2('0x212'),_0xa1d2('0x19b'),_0xa1d2('0x213')+_0x4acd89));}if(_0x1fc47d<=0x0||isNaN(_0x1fc47d)){return _0x299259(msgResponse(_0xa1d2('0x212'),_0xa1d2('0x19b'),_0xa1d2('0x214')+_0x1fc47d));}if(_0x257c6f<=0x0||isNaN(_0x257c6f)){return _0x299259(msgResponse('[abandonmentRate]',_0xa1d2('0x19b'),'p\x20=\x20'+_0x257c6f));}if(_0x1be761<=0x0||isNaN(_0x1be761)){return _0x299259(msgResponse(_0xa1d2('0x212'),_0xa1d2('0x19b'),_0xa1d2('0x215')+_0x1be761));}if(_0xf4f4d8<=0x0||isNaN(_0xf4f4d8)){return _0x299259(msgResponse('[abandonmentRate]','Error',_0xa1d2('0x216')+_0xf4f4d8));}_0x4721e2=_0x4721e2||0x0;var _0x40161e=0x1/_0x1fc47d;var _0x1d6780=0x0;var _0x5b8222=0x0;var _0x1b740f=0x0;var _0x23b4fd=0x0;for(var _0x2bb015=0x0;_0x1b740f<_0xf4f4d8;_0x2bb015+=0x1){_0x5b8222=_0x2bb015/_0x1be761;_0x1d6780=(_0x257c6f*_0x5b8222+_0x4721e2)/_0x40161e;_0x1b740f=erlangb(_0x1d6780,_0x4acd89);_0x23b4fd=_0x1d6780/_0x4acd89*(0x1-erlangb(_0x1d6780,_0x4acd89));}return _0x5ada4e({'erlangCalls':_0x2bb015,'erlangCallToSecond':_0x1be761/_0x2bb015,'erlangAbandonmentRate':_0x1b740f,'erlangBusyFactor':_0x23b4fd});});};Dialer[_0xa1d2('0xb7')]['busyFactor']=function(_0x2cf0e1,_0x507435,_0x27e891,_0xc2eb7,_0x339ec2,_0x2df1be){loggerPredictive[_0xa1d2('0x7f')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0xa1d2('0x7f')](_0xa1d2('0x217'),_0x2cf0e1);loggerPredictive[_0xa1d2('0x7f')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x507435);loggerPredictive['info'](_0xa1d2('0x20f'),_0x27e891);loggerPredictive[_0xa1d2('0x7f')](_0xa1d2('0x210'),_0xc2eb7);loggerPredictive[_0xa1d2('0x7f')](_0xa1d2('0x218'),_0x339ec2);loggerPredictive[_0xa1d2('0x7f')](_0xa1d2('0x88'));return new BPromise(function(_0x43892c,_0x277e5b){if(_0x2cf0e1<=0x0||isNaN(_0x2cf0e1)){return _0x277e5b(msgResponse(_0xa1d2('0x219'),_0xa1d2('0x19b'),_0xa1d2('0x213')+_0x2cf0e1));}if(_0x27e891<=0x0||isNaN(_0x27e891)){return _0x277e5b(msgResponse('[busyFactor]',_0xa1d2('0x19b'),_0xa1d2('0x214')+_0x27e891));}if(_0xc2eb7<=0x0||isNaN(_0xc2eb7)){return _0x277e5b(msgResponse(_0xa1d2('0x219'),_0xa1d2('0x19b'),_0xa1d2('0x21a')+_0xc2eb7));}if(_0x507435<=0x0||isNaN(_0x507435)){return _0x277e5b(msgResponse(_0xa1d2('0x219'),'Error',_0xa1d2('0x215')+_0x507435));}if(_0x339ec2<=0x0||isNaN(_0x339ec2)){return _0x277e5b(msgResponse(_0xa1d2('0x219'),_0xa1d2('0x19b'),_0xa1d2('0x21b')+_0x339ec2));}_0x2df1be=_0x2df1be||0x0;var _0x392e7c=0x1/_0x27e891;var _0x4d6829=0x0;var _0x11f334=0x0;var _0xc3bbc4=0x0;var _0x54a9bf=0x0;for(var _0x5025e9=0x0;_0x54a9bf<_0x339ec2;_0x5025e9+=0x1){_0x11f334=_0x5025e9/_0x507435;_0x4d6829=(_0xc2eb7*_0x11f334+_0x2df1be)/_0x392e7c;_0xc3bbc4=erlangb(_0x4d6829,_0x2cf0e1);_0x54a9bf=_0x4d6829/_0x2cf0e1*(0x1-erlangb(_0x4d6829,_0x2cf0e1));}return _0x43892c({'erlangCalls':_0x5025e9,'erlangCallToSecond':_0x507435/_0x5025e9,'erlangAbandonmentRate':_0xc3bbc4,'erlangBusyFactor':_0x54a9bf});});};module[_0xa1d2('0x21c')]=Dialer; \ No newline at end of file +var _0xebaa=['stateinterface','rrmemory','queueBooked','push','queueStatusComplete','[unlockQueueStatus][undefined]','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','finally','_rr','unlockRR','[booked][RR]','Agent:\x20','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','command','interval','timezones','content','true','iftime\x20%s,%s','indexOf','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','user:%s','user:dialPreviewRecallReminder','handleIvr','dialActive','dialGlobalInterval','dialTimezone','[syncQueueSummary]','dialPreviewRecallmeReminder','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','random','match','actionOriginate','object','originate','Contact','phone','getCaller','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','updatedAt','%s%s','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','getQueue','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callProgressDetecting','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','NoAnswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','predictive','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','startMethodPredictive','recalculate\x20predictive\x20at','getDataPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','agentBusyFactor','UserId','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','maxNumberOriginate','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','reachable','[actionOriginate]\x20','Contact.phone','[handlePredictive][limitChannel]','tryOriginatePredictive','checkContactBlack','[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','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','interval\x20=\x20','Amax\x20=\x20','----\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]','Umin\x20=\x20','util','lodash','moment','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','syncQueueSummary','../ami','redis','defaults','localhost','../rpc/cmHopper','../rpc/setting','./action','./history','./queueCallerAbandon','./hangup','env','127.0.0.1','roundrobin','prototype','enqueue','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','channels','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','queueBookedRR','agentconnect','bind','queuecallerabandon','syncOriginateResponse','agentcomplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','message','AGENTS_NOT_LOGGED','name','Interval','INTERVAL_IS_NULL','Intervals','\x20INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','milliseconds','seconds','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','stringify','format','voice:queue:%s','voice_queue:save','campaign:ivr:%s','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','---------------------------','isUndefined','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','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','diff','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','error','inspect','stack','length','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','[getContactDialer2][Empty]','sendMessageOneNotActive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','actions','isNil','Action','status','No\x20such\x20channel','ivr','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','catch','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','merge','pick','ContactId','ListId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','SIP/%s','uniqueid','variable','amdstatus','value','outboundAnswerCallsDay','membername','AMD','custom:amd','[syncHangupInAMD][createHistory]','dialAMDActive','MACHINE','countglobal','amd','buildObj','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','CampaignId','[rescheduleContact][Machine]','HANGUP','[syncHangupInAMDIvr][createHistory]','Machine','[syncAgentComplete][createHistory][0]','dialMachineMaxRetry','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','cause-txt','Unknow','syncAgentComplete','reason','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncAgentConnect','answertime','queueCallerAbandonCreateState','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','locked','paused'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xebaa,0xf3));var _0xaeba=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xebaa[_0x4e676e];return _0x336a3c;};'use strict';var util=require(_0xaeba('0x0'));var _=require(_0xaeba('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0xaeba('0x2'));var rr=require('rr');var md5=require(_0xaeba('0x3'));var Redis=require(_0xaeba('0x4'));var ut=require('../preview/util/util');var config=require(_0xaeba('0x5'));var logger=require(_0xaeba('0x6'))(_0xaeba('0x7'));var loggerBooked=require(_0xaeba('0x6'))(_0xaeba('0x8'));var loggerPredictive=require(_0xaeba('0x6'))('predictive');var loggerPredictiveCalls=require(_0xaeba('0x6'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xaeba('0x6'))(_0xaeba('0x9'));var ami=require(_0xaeba('0xa'));config[_0xaeba('0xb')]=_[_0xaeba('0xc')](config[_0xaeba('0xb')],{'host':_0xaeba('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xaeba('0xb')]));var cmHopper=require(_0xaeba('0xe'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0xaeba('0xf'));var Action=require(_0xaeba('0x10'));var History=require(_0xaeba('0x11'));var Final=require('./final');var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0xaeba('0x12'));var Hangup=require(_0xaeba('0x13'));var ipAgi=process[_0xaeba('0x14')]['XCALLY_IP_AGI']||_0xaeba('0x15');var strategy={'rrmemory':'rrmemory','roundrobin':_0xaeba('0x16')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xaeba('0x17')][_0xaeba('0x18')]=function(_0xa78c7f){this[_0xaeba('0x19')]=this[_0xaeba('0x19')]?this[_0xaeba('0x19')]['finally'](_0xa78c7f):_0xa78c7f();};function Dialer(_0x50401b,_0x57fb89){this[_0xaeba('0x1a')]=new Sequence();this[_0xaeba('0x1b')]=_0x57fb89;this[_0xaeba('0x1c')]=_0x50401b[_0xaeba('0x1c')];this[_0xaeba('0x1d')]=_0x50401b[_0xaeba('0x1d')];this['agents']=_0x50401b[_0xaeba('0x1e')];this[_0xaeba('0x1f')]=_0x50401b[_0xaeba('0x1f')];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this[_0xaeba('0x20')]={};this['actions']={};this[_0xaeba('0x21')]={};this[_0xaeba('0x22')]={};this[_0xaeba('0x23')]={};this[_0xaeba('0x24')]={};this[_0xaeba('0x25')]={};this['ivrOriginated']={};this['queueBooked']={};this[_0xaeba('0x26')]={};ami['on'](_0xaeba('0x27'),this['syncAgentConnect'][_0xaeba('0x28')](this));ami['on'](_0xaeba('0x29'),this['syncQueueCallerAbandon'][_0xaeba('0x28')](this));ami['on']('originateresponse',this[_0xaeba('0x2a')][_0xaeba('0x28')](this));ami['on'](_0xaeba('0x2b'),this['syncAgentComplete'][_0xaeba('0x28')](this));ami['on'](_0xaeba('0x2c'),this['syncQueueSummary'][_0xaeba('0x28')](this));ami['on'](_0xaeba('0x2d'),this[_0xaeba('0x2e')]['bind'](this));ami['on'](_0xaeba('0x2f'),this[_0xaeba('0x30')][_0xaeba('0x28')](this));ami['on'](_0xaeba('0x31'),this[_0xaeba('0x32')][_0xaeba('0x28')](this));ami['on']('queuemember',this[_0xaeba('0x33')][_0xaeba('0x28')](this));ami['on'](_0xaeba('0x34'),this['syncQueueStatusComplete'][_0xaeba('0x28')](this));this['loopCampaigns']();this[_0xaeba('0x35')]();RpcSetting[_0xaeba('0x36')]()[_0xaeba('0x37')](function(_0x41c478){previewRecallmeReminderInterval=_0x41c478[_0xaeba('0x38')];});}function isNotNull(_0x4ea621){return _0x4ea621!==null&&!_['isUndefined'](_0x4ea621);}function checkIsLoggedIn(_0x3df13f,_0x1a1824){return function(){if(_0x1a1824<=0x0){_0x3df13f[_0xaeba('0x39')]=_0xaeba('0x3a');throw _0x3df13f[_0xaeba('0x3b')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x3d21af){return _0x3d21af;}function checkIsActive(_0x565c60,_0x2766f0){return function(){if(!isActive(_0x2766f0)){_0x565c60[_0xaeba('0x39')]='NOT_ACTIVE';throw _0x565c60['name']+'\x20NOT\x20Active';}};}function checkInterval(_0x3821cb){return function(){if(!isNotNull(_0x3821cb[_0xaeba('0x3c')])){_0x3821cb[_0xaeba('0x39')]=_0xaeba('0x3d');throw _0x3821cb[_0xaeba('0x3b')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x3821cb[_0xaeba('0x3c')][_0xaeba('0x3e')])){_0x3821cb['message']=_0xaeba('0x3d');throw _0x3821cb[_0xaeba('0x3b')]+_0xaeba('0x3f');}if(!isNotNull(_[_0xaeba('0x40')](_0x3821cb[_0xaeba('0x3c')][_0xaeba('0x3e')]))){_0x3821cb[_0xaeba('0x39')]=_0xaeba('0x3d');throw _0x3821cb[_0xaeba('0x3b')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x1d4850,_0x4ff0af,_0x4cb5a2){return{'action':_0x1d4850,'response':_0x4ff0af,'message':_0x4cb5a2,'stack':_0x4cb5a2};}function myreject(_0x2af96c){return function(_0x30294a){return _0x2af96c(msgResponse(_0xaeba('0x41'),_0xaeba('0x42'),JSON['stringify'](_0x30294a)));};}function getSeconds(_0x4bc390,_0x528950){var _0x47b85c=moment(_0x4bc390)[_0xaeba('0x43')](0x0);var _0x16523b=moment(_0x528950)[_0xaeba('0x43')](0x0);return _0x47b85c['diff'](_0x16523b,_0xaeba('0x44'));}function emit(_0x5c0ab5,_0x38a83d,_0x21fefb){io['to'](_0x5c0ab5)[_0xaeba('0x45')](_0x38a83d,_0x21fefb);}function emitVoiceQueueSummary(_0x30e413){if(_0x30e413[_0xaeba('0x46')]===_0xaeba('0x47')){var _0x552998={'id':_0x30e413['id'],'name':_0x30e413[_0xaeba('0x3b')],'strategy':_0x30e413[_0xaeba('0x48')],'answered':_0x30e413[_0xaeba('0x49')],'available':_0x30e413[_0xaeba('0x4a')],'loggedIn':_0x30e413[_0xaeba('0x4b')],'pTalking':_0x30e413[_0xaeba('0x4c')],'sumBillable':_0x30e413[_0xaeba('0x4d')],'sumDuration':_0x30e413[_0xaeba('0x4e')],'sumHoldTime':_0x30e413[_0xaeba('0x4f')]||0x0,'talking':_0x30e413[_0xaeba('0x50')],'total':_0x30e413[_0xaeba('0x51')],'type':_0x30e413[_0xaeba('0x46')],'unmanaged':_0x30e413[_0xaeba('0x52')],'abandoned':_0x30e413[_0xaeba('0x53')],'waiting':_0x30e413[_0xaeba('0x54')],'loggedInDb':_0x30e413[_0xaeba('0x55')],'dialActive':_0x30e413['dialActive'],'dialMethod':_0x30e413['dialMethod'],'dialOriginateCallerIdName':_0x30e413[_0xaeba('0x56')],'dialOriginateCallerIdNumber':_0x30e413[_0xaeba('0x57')],'dialOriginateTimeout':_0x30e413[_0xaeba('0x58')],'dialPrefix':_0x30e413[_0xaeba('0x59')],'outboundAnswerAgiCallsDay':_0x30e413[_0xaeba('0x5a')],'outboundAnswerCallsDay':_0x30e413['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x30e413[_0xaeba('0x5b')],'outboundBusyCallsDay':_0x30e413[_0xaeba('0x5c')],'outboundCongestionCallsDay':_0x30e413[_0xaeba('0x5d')],'outboundDropCallsDayACS':_0x30e413[_0xaeba('0x5e')],'outboundDropCallsDayCallersExit':_0x30e413[_0xaeba('0x5f')],'outboundDropCallsDayTimeout':_0x30e413[_0xaeba('0x60')],'outboundNoAnswerCallsDay':_0x30e413[_0xaeba('0x61')],'outboundNoSuchCallsDay':_0x30e413['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x30e413[_0xaeba('0x62')],'outboundReCallsDay':_0x30e413[_0xaeba('0x63')],'outboundRejectCallsDay':_0x30e413['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x30e413[_0xaeba('0x64')],'predictiveIntervalAnsweredCalls':_0x30e413[_0xaeba('0x65')],'predictiveIntervalAvgHoldtime':_0x30e413['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x30e413[_0xaeba('0x66')],'predictiveIntervalDroppedCallsCallersExit':_0x30e413[_0xaeba('0x67')],'predictiveIntervalDroppedCallsTimeout':_0x30e413[_0xaeba('0x68')],'predictiveIntervalErlangCalls':_0x30e413[_0xaeba('0x69')],'predictiveIntervalErlangCallsDroppedCalls':_0x30e413[_0xaeba('0x6a')],'predictiveIntervalHitRate':_0x30e413[_0xaeba('0x6b')],'predictiveIntervalMultiplicativeFactor':_0x30e413[_0xaeba('0x6c')],'predictiveIntervalPauses':_0x30e413[_0xaeba('0x6d')],'predictiveIntervalAvailable':_0x30e413['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x30e413[_0xaeba('0x6e')],'message':_0x30e413[_0xaeba('0x39')],'originated':_0x30e413['originated'],'erlangCalls':_0x30e413[_0xaeba('0x6f')],'erlangCallToSecond':_0x30e413[_0xaeba('0x70')],'erlangAbandonmentRate':_0x30e413[_0xaeba('0x71')],'erlangBusyFactor':_0x30e413[_0xaeba('0x72')],'startPredictive':_0x30e413[_0xaeba('0x24')],'startProgressive':_0x30e413[_0xaeba('0x25')]};if(_0x30e413['Trunk']){_0x552998[_0xaeba('0x73')]={'id':_0x30e413[_0xaeba('0x73')]['id'],'name':_0x30e413[_0xaeba('0x73')]['name'],'active':_0x30e413[_0xaeba('0x73')][_0xaeba('0x74')],'callerid':_0x30e413['Trunk'][_0xaeba('0x75')]};}if(_0x30e413[_0xaeba('0x3c')]){_0x552998[_0xaeba('0x3c')]={'id':_0x30e413[_0xaeba('0x3c')]['id'],'name':_0x30e413['Interval'][_0xaeba('0x3b')]};}var _0x32bcab=md5(JSON[_0xaeba('0x76')](_0x552998));if(_0x30e413[_0xaeba('0x3')]!==_0x32bcab){_0x30e413[_0xaeba('0x3')]=_0x32bcab;emit(util[_0xaeba('0x77')](_0xaeba('0x78'),_0x552998[_0xaeba('0x3b')]),_0xaeba('0x79'),_0x552998);}}}function emitCampaignSummary(_0x1a628d){if(_0x1a628d[_0xaeba('0x46')]==='ivr'){emit(util[_0xaeba('0x77')](_0xaeba('0x7a'),_0x1a628d['name']),'campaign:save',_0x1a628d);}}function checkGetDataPredictive(_0x4cd2af){if(isNotNull(_0x4cd2af)&&!_[_0xaeba('0x40')](_0x4cd2af)){loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x7c'));loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x7d'),_0x4cd2af[_0xaeba('0x6e')]);loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x7e'),_0x4cd2af[_0xaeba('0x65')]);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4cd2af[_0xaeba('0x68')]);loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x7f'),_0x4cd2af['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x80'),_0x4cd2af[_0xaeba('0x81')]);loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x82'),_0x4cd2af[_0xaeba('0x66')]);loggerPredictive['info'](_0xaeba('0x83'));if(_0x4cd2af['predictiveIntervalTotalCalls']>0x0){if(!_[_0xaeba('0x84')](_0x4cd2af[_0xaeba('0x66')])&&_0x4cd2af[_0xaeba('0x66')]>0x0){return!![];}loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x85'));if(!_['isUndefined'](_0x4cd2af[_0xaeba('0x81')])&&_0x4cd2af[_0xaeba('0x81')]>0x0){return!![];}loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x86'));}else{loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x87'));}}else{loggerPredictive['info'](_0xaeba('0x88'));}return![];}function mergeDataErlangB(_0x5dd87e){return function(_0x1cce1c){loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x89'));loggerPredictive['info'](_0xaeba('0x8a'),_0x1cce1c[_0xaeba('0x6f')]);loggerPredictive[_0xaeba('0x7b')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1cce1c['erlangCallToSecond']);loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x8b'),_0x1cce1c[_0xaeba('0x71')]);loggerPredictive[_0xaeba('0x7b')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1cce1c[_0xaeba('0x72')]);loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x8b'),_0x1cce1c[_0xaeba('0x71')]);loggerPredictive[_0xaeba('0x7b')]('---------------------------');_['merge'](_0x5dd87e,_0x1cce1c);};}function getDiff(_0x2c72fd){var _0x57c339=moment()[_0xaeba('0x43')](0x0);var _0x13509a=moment(_0x2c72fd)[_0xaeba('0x43')](0x0);return _0x57c339[_0xaeba('0x8c')](_0x13509a,'seconds');}function ifInterval(_0xf34b72,_0x2a7847){if(_[_0xaeba('0x84')](_0x2a7847)){return![];}return getDiff(_0x2a7847)<_0xf34b72*0x3c;}function freeVariablesPredictive(_0x3883c3){if(isNotNull(_0x3883c3)){if(!_[_0xaeba('0x84')](_0x3883c3['startProgressive'])){_0x3883c3[_0xaeba('0x25')]=undefined;loggerPredictive['info'](_0x3883c3[_0xaeba('0x3b')],'clearing\x20variable\x20start\x20progressive');}if(!_['isUndefined'](_0x3883c3[_0xaeba('0x24')])){_0x3883c3[_0xaeba('0x24')]=undefined;loggerPredictive['info'](_0x3883c3[_0xaeba('0x3b')],_0xaeba('0x8d'));}if(!_[_0xaeba('0x84')](_0x3883c3[_0xaeba('0x8e')])){clearInterval(_0x3883c3['handlePredictive']);_0x3883c3[_0xaeba('0x8e')]=undefined;loggerPredictive[_0xaeba('0x7b')](_0x3883c3[_0xaeba('0x3b')],_0xaeba('0x8f'));}}}function erlangb(_0x1f6125,_0x10d335){if(_0x10d335===0x0){return 0x0;}var _0x5ce2e4=0x1;for(var _0x42cc76=0x1;_0x42cc76<=_0x10d335;_0x42cc76+=0x1){_0x5ce2e4=0x1+_0x5ce2e4*_0x42cc76/_0x1f6125;}return 0x1/_0x5ce2e4;}function isVoiceQueueOutbound(_0x44001d){return _0x44001d===_0xaeba('0x47');}function isNotPreview(_0x5b2459){return _0x5b2459!=='preview';}function isCampaignIvr(_0x193b32){return _0x193b32==='ivr';}function getCallerId(_0x31a3a4,_0x3b5c7e,_0x21afc4){if(!_[_0xaeba('0x84')](_0x21afc4)&&typeof _0x21afc4==='string'&&!_[_0xaeba('0x40')](_0x21afc4)){if(!_[_0xaeba('0x84')](_0x3b5c7e)&&typeof _0x3b5c7e===_0xaeba('0x90')&&!_[_0xaeba('0x40')](_0x3b5c7e)){return util[_0xaeba('0x77')](_0xaeba('0x91'),_0x3b5c7e,_0x21afc4);}return util[_0xaeba('0x77')]('\x22%s\x22\x20<%s>',_0x21afc4,_0x21afc4);}if(!_['isUndefined'](_0x31a3a4)&&typeof _0x31a3a4==='string'&&!_[_0xaeba('0x40')](_0x31a3a4)){return _0x31a3a4;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x1df4fc,_0x3eb3b1){return function(_0x5c54c1){freeVariablesPredictive(_0x3eb3b1);emitVoiceQueueSummary(_0x3eb3b1);emitCampaignSummary(_0x3eb3b1);loggerSyncQueueSummary[_0xaeba('0x92')](_0x1df4fc,util[_0xaeba('0x93')](_0x5c54c1,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x190d54,_0x3b9737){return function(_0x3dd57d){loggerPredictive[_0xaeba('0x92')](_0x3b9737['name'],_0x190d54);loggerPredictive['error'](_0x3dd57d[_0xaeba('0x94')]);freeVariablesPredictive(_0x3b9737);};}function loggerCatch(_0x32309c){return function(_0x4f9c25){logger['error'](_0x32309c,util['inspect'](_0x4f9c25,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x3c1207){return _0x3c1207&&!_[_0xaeba('0x84')](_0x3c1207)&&_0x3c1207[_0xaeba('0x95')]>0x0;}function decremetOriginate(_0x21eed2){if(!_[_0xaeba('0x84')](_0x21eed2)&&_0x21eed2!==null){if(typeof _0x21eed2[_0xaeba('0x96')]!==_0xaeba('0x97')){if(_0x21eed2[_0xaeba('0x96')]>0x0){_0x21eed2[_0xaeba('0x96')]-=0x1;}else{logger[_0xaeba('0x92')](_0xaeba('0x98'));}}}else{logger[_0xaeba('0x92')](_0xaeba('0x99'));}}function checkContactLowerLimitOriginate(_0x221e0d,_0x2ea8d0,_0x4d08de){if(_0x2ea8d0>_0x4d08de){for(var _0x23b800=0x0;_0x23b800<_0x2ea8d0-_0x4d08de;_0x23b800+=0x1){decremetOriginate(_0x221e0d);}}}function loggerGetContactDialer(_0x533ab4,_0x7b31a7,_0x4c8b89){return function(_0x48bcf0){checkContactLowerLimitOriginate(_0x7b31a7,_0x4c8b89,0x0);logger[_0xaeba('0x92')](_0x533ab4,util['inspect'](_0x48bcf0,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2b3443){return function(_0x2919bf){if(isNotNull(_0x2919bf)&&isNotNull(_0x2919bf[0x0])){if(_0x2919bf[0x0][_0xaeba('0x9a')]>0x0){_0x2b3443[_0xaeba('0x39')]=_0xaeba('0x9b');logger['info'](_0xaeba('0x9c')+_0x2b3443[_0xaeba('0x3b')],_0x2919bf[0x0][_0xaeba('0x9a')],_0xaeba('0x9d'));}else{_0x2b3443[_0xaeba('0x39')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xaeba('0x7b')](_0xaeba('0x9e')+_0x2b3443[_0xaeba('0x3b')]);}}};}function notSendMessagesQueue(_0x430059){if(_0x430059[_0xaeba('0x9f')]){freeVariablesPredictive(_0x430059);if(_0x430059[_0xaeba('0x96')]===0x0&&_0x430059[_0xaeba('0x50')]===0x0&&_0x430059[_0xaeba('0x54')]===0x0&&(_0x430059[_0xaeba('0x4c')]||0x0)===0x0){_0x430059[_0xaeba('0x9f')]=![];_0x430059[_0xaeba('0x4a')]=0x0;_0x430059[_0xaeba('0x39')]=_0xaeba('0xa0');loggerSyncQueueSummary[_0xaeba('0x92')](_0xaeba('0xa1'),_0x430059['name'],_0xaeba('0xa2'));}else{_0x430059[_0xaeba('0x39')]=_0xaeba('0xa3');loggerSyncQueueSummary[_0xaeba('0x92')](_0xaeba('0xa1'),_0x430059[_0xaeba('0x3b')],_0xaeba('0xa4'));}emitVoiceQueueSummary(_0x430059);}}function notSendMessagesCampaign(_0x47c2e6){if(_0x47c2e6[_0xaeba('0x9f')]){if(_0x47c2e6['originated']===0x0){_0x47c2e6[_0xaeba('0x9f')]=![];_0x47c2e6[_0xaeba('0x39')]=_0xaeba('0xa0');loggerSyncQueueSummary[_0xaeba('0x92')](_0xaeba('0xa5'),_0x47c2e6[_0xaeba('0x3b')],_0xaeba('0xa2'));}else{_0x47c2e6[_0xaeba('0x39')]=_0xaeba('0xa3');loggerSyncQueueSummary[_0xaeba('0x92')](_0xaeba('0xa5'),_0x47c2e6[_0xaeba('0x3b')],_0xaeba('0xa4'));}emitCampaignSummary(_0x47c2e6);}}function createObjHistory(_0x4b81fc,_0x587ff2,_0x355189,_0x3fd0ec,_0x258aa9){_0x4b81fc[_0xaeba('0x39')]=_0x355189;var _0x217df2=new Action(_0x4b81fc,_0x587ff2);var _0x337fa1=new History(_0x217df2);_0x337fa1[_0xaeba('0xa6')]=_0x3fd0ec;_0x337fa1[_0xaeba('0xa7')]=_0x258aa9;_0x337fa1[_0xaeba('0xa8')]=_0x217df2[_0xaeba('0xa9')];return _0x337fa1;}Dialer[_0xaeba('0x17')][_0xaeba('0x35')]=function(){var _0x18fa02=this;setInterval(function(){_0x18fa02[_0xaeba('0xaa')](_0x18fa02['uniqueId'],_0xaeba('0xab'));_0x18fa02[_0xaeba('0xaa')](_0x18fa02[_0xaeba('0xac')],'[actions]');},0x32c8);};Dialer[_0xaeba('0x17')][_0xaeba('0xaa')]=function(_0x90db75,_0x5815cb){var _0xdeb682=this;for(var _0x2e0f40 in _0x90db75){if(typeof _0x90db75[_0x2e0f40]!==_0xaeba('0x97')){this[_0xaeba('0x1a')][_0xaeba('0x18')](function(){if(!_[_0xaeba('0xad')](_0x90db75[_0x2e0f40])){return ami[_0xaeba('0xae')]({'action':_0xaeba('0xaf'),'channel':_0x90db75[_0x2e0f40]['channel']})['catch'](function(_0xf1c1d0){if(_0xf1c1d0[_0xaeba('0x39')]===_0xaeba('0xb0')){setTimeout(function(){if(_0x90db75[_0x2e0f40]&&_0x90db75[_0x2e0f40][_0xaeba('0x46')]!==_0xaeba('0xb1')){_0xdeb682[_0xaeba('0xb2')](_0xdeb682['voiceQueues'][_0x90db75[_0x2e0f40][_0xaeba('0xb3')]]);logger[_0xaeba('0x92')](_0xaeba('0xb4'),_0x5815cb,_0x2e0f40,_0x90db75[_0x2e0f40]['queue']);delete _0x90db75[_0x2e0f40];}if(_0x90db75[_0x2e0f40]&&_0x90db75[_0x2e0f40][_0xaeba('0x46')]===_0xaeba('0xb1')){_0xdeb682[_0xaeba('0xb2')](_0xdeb682[_0xaeba('0x1d')][_0x90db75[_0x2e0f40]['queue']]);logger[_0xaeba('0x92')](_0xaeba('0xb5'),_0x5815cb,_0x2e0f40,_0x90db75[_0x2e0f40]['queue']);delete _0x90db75[_0x2e0f40];}},0x2328);}});}});}}};Dialer[_0xaeba('0x17')][_0xaeba('0xb6')]=function(_0x430a9e){return BPromise[_0xaeba('0xb7')]()[_0xaeba('0x37')](cmHopper['countReScheduled'](_0x430a9e))[_0xaeba('0xb8')](loggerCatch(_0xaeba('0xb9')));};Dialer[_0xaeba('0x17')]['checkIsBlackList']=function(_0x4171b){return BPromise[_0xaeba('0xb7')]()[_0xaeba('0x37')](cmHopperBlack[_0xaeba('0xba')](_0x4171b))[_0xaeba('0xb8')](loggerCatch(_0xaeba('0xbb')));};Dialer[_0xaeba('0x17')][_0xaeba('0xbc')]=function(_0x4fd282){return BPromise[_0xaeba('0xb7')]()[_0xaeba('0x37')](cmHopperBlack[_0xaeba('0xbc')](_0x4fd282))[_0xaeba('0xb8')](loggerCatch(_0xaeba('0xbd')));};Dialer[_0xaeba('0x17')][_0xaeba('0xbe')]=function(_0x451b1d){return BPromise['resolve']()['then'](cmHopperHistory['avgHandleTime'](_0x451b1d))['catch'](loggerCatch(_0xaeba('0xbf')));};Dialer[_0xaeba('0x17')][_0xaeba('0xc0')]=function(_0x5e3187){return BPromise['resolve']()[_0xaeba('0x37')](cmHopper[_0xaeba('0xc0')](_0x5e3187))['catch'](loggerCatch(_0xaeba('0xc1')));};Dialer[_0xaeba('0x17')][_0xaeba('0xc2')]=function(_0x164dfa,_0x428c2e,_0x519161){return BPromise[_0xaeba('0xb7')]()[_0xaeba('0x37')](cmHopper[_0xaeba('0xc2')](_0x164dfa,_0x428c2e,_0x519161))[_0xaeba('0xb8')](loggerCatch('[unlockContact]\x20'));};Dialer[_0xaeba('0x17')][_0xaeba('0xc3')]=function(_0x710f15,_0x40db0e,_0x3abf8a,_0x375bc2,_0x272fba){return BPromise[_0xaeba('0xb7')]()[_0xaeba('0x37')](cmHopper[_0xaeba('0xc3')](_0x710f15,_0x40db0e,_0x3abf8a,_0x375bc2))[_0xaeba('0xb8')](function(_0xcf5f6c){_0x272fba['temp']-=_0x3abf8a;_0x272fba[_0xaeba('0xc4')]=_0x272fba[_0xaeba('0xc4')]>0x0?_0x272fba['temp']:0x0;loggerCatch(_0xaeba('0xc5'))(_0xcf5f6c);});};Dialer[_0xaeba('0x17')][_0xaeba('0xc6')]=function(_0x4bd88e,_0x38fffb,_0x2f8448,_0x4e35cf){return BPromise[_0xaeba('0xb7')]()['then'](cmHopper[_0xaeba('0xc6')](_0x4bd88e,_0x38fffb,_0x2f8448))[_0xaeba('0xb8')](function(_0x18d4e7){_0x4e35cf[_0xaeba('0xc4')]-=_0x38fffb;_0x4e35cf[_0xaeba('0xc4')]=_0x4e35cf[_0xaeba('0xc4')]>0x0?_0x4e35cf[_0xaeba('0xc4')]:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x18d4e7);});};Dialer[_0xaeba('0x17')][_0xaeba('0xc7')]=function(_0x5cce36){return BPromise[_0xaeba('0xb7')]()[_0xaeba('0x37')](voiceQueueRt['getVoiceQueueRtPauses'](_0x5cce36))[_0xaeba('0xb8')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0xaeba('0x17')][_0xaeba('0xc8')]=function(_0x3d6dca){return BPromise[_0xaeba('0xb7')]()['then'](cmHopper[_0xaeba('0xc8')](_0x3d6dca))[_0xaeba('0xb8')](loggerCatch(_0xaeba('0xc9')));};Dialer[_0xaeba('0x17')][_0xaeba('0xca')]=function(_0x37c33a){return BPromise[_0xaeba('0xb7')]()[_0xaeba('0x37')](cmHopperHistory['createHistory'](_0x37c33a))[_0xaeba('0xb8')](loggerCatch('[createHistory]\x20'));};Dialer['prototype']['updateOriginated']=function(_0xfbe706){if(!_[_0xaeba('0x84')](_0xfbe706)&&_0xfbe706!==null){if(typeof _0xfbe706[_0xaeba('0x96')]!=='undefined'){if(_0xfbe706[_0xaeba('0x96')]>0x0){_0xfbe706['originated']-=0x1;}else{logger[_0xaeba('0x92')](_0xaeba('0xcb'));}}}else{logger['error'](_0xaeba('0xcc'));}};Dialer[_0xaeba('0x17')][_0xaeba('0xcd')]=function(_0x391a1d,_0x35ddf4){var _0x4db17f=this;return function(_0x2d0524){_0x4db17f[_0xaeba('0xb2')](_0x35ddf4);logger[_0xaeba('0x92')](_0x391a1d,util['inspect'](_0x2d0524,{'showHidden':![],'depth':null}));};};Dialer[_0xaeba('0x17')][_0xaeba('0xce')]=function(_0x4a955e,_0x2a9082,_0x58f00e){var _0x2b147c={'state':0x19,'statedesc':_0xaeba('0xcf')};this[_0xaeba('0xb2')](_0x2a9082);this[_0xaeba('0xd0')](_[_0xaeba('0xd1')](_0x2b147c,_[_0xaeba('0xd2')](_0x58f00e,[_0xaeba('0xd3'),_0xaeba('0xd4'),'UserId',_0xaeba('0xd5'),'CampaignId'])),_0xaeba('0xd6'),_0xaeba('0xd7'));logger[_0xaeba('0x92')](_0x4a955e);};Dialer[_0xaeba('0x17')][_0xaeba('0xd8')]=function(_0xf80c85){return _0xf80c85==='Success';};Dialer[_0xaeba('0x17')][_0xaeba('0xd9')]=function(_0x235eaf){return!_[_0xaeba('0x84')](_0x235eaf)&&_0x235eaf&&!_[_0xaeba('0x84')](_0x235eaf['name'])&&!_[_0xaeba('0x84')](_0x235eaf['active'])&&_0x235eaf[_0xaeba('0x74')]&&(this['trunks'][util[_0xaeba('0x77')]('SIP/%s',_0x235eaf['name'])]['status']==='reachable'||this[_0xaeba('0x1f')][util[_0xaeba('0x77')](_0xaeba('0xda'),_0x235eaf[_0xaeba('0x3b')])]['status']==='unmonitored');};Dialer[_0xaeba('0x17')][_0xaeba('0xd0')]=function(_0x8e669d,_0x31ac2b,_0x1b1126){this[_0xaeba('0xca')](_0x8e669d)[_0xaeba('0xb8')](loggerCatch(_0x31ac2b));this[_0xaeba('0xc8')](_0x8e669d)[_0xaeba('0xb8')](loggerCatch(_0x1b1126));};Dialer['prototype']['syncVarSet']=function(_0x3d4ed3){var _0xaecb75=this[_0xaeba('0x22')][_0x3d4ed3[_0xaeba('0xdb')]];var _0x4911eb;if(!_[_0xaeba('0xad')](_0x3d4ed3)&&!_[_0xaeba('0xad')](_0x3d4ed3[_0xaeba('0xdc')])&&!_[_0xaeba('0xad')](_0x3d4ed3[_0xaeba('0xdc')][_0xaeba('0xdd')])&&_0x3d4ed3['exten']==='xcally-motion-dialer'&&_0xaecb75){if(_0xaecb75[_0xaeba('0x46')]!==_0xaeba('0xb1')&&this['voiceQueues'][_0xaecb75['queue']]['dialAMDActive']&&_0x3d4ed3[_0xaeba('0xde')]==='HANGUP'){delete this[_0xaeba('0x22')][_0x3d4ed3[_0xaeba('0xdb')]];this[_0xaeba('0xb2')](this[_0xaeba('0x1c')][_0xaecb75[_0xaeba('0xb3')]]);this[_0xaeba('0x1c')][_0xaecb75[_0xaeba('0xb3')]][_0xaeba('0xdf')]+=0x1;this[_0xaeba('0x1c')][_0xaecb75[_0xaeba('0xb3')]]['outboundAnswerAgiCallsDay']+=0x1;_0x4911eb=new Hangup(_0xaecb75,_0x3d4ed3);_0x4911eb[_0xaeba('0xa6')]=0x12;_0x4911eb[_0xaeba('0xa7')]='HangupInAMD';_0x4911eb[_0xaeba('0xe0')]=_0xaeba('0xe1');ami['emit'](_0xaeba('0xe2'),ut['buildObj'](_0x4911eb,'amd'));this[_0xaeba('0xd0')](_0x4911eb,_0xaeba('0xe3'),'[syncHangupInAMD]');}if(_0xaecb75[_0xaeba('0x46')]!==_0xaeba('0xb1')&&this[_0xaeba('0x1c')][_0xaecb75[_0xaeba('0xb3')]][_0xaeba('0xe4')]&&_0x3d4ed3[_0xaeba('0xde')]===_0xaeba('0xe5')){var _0x3ce053=this;return new BPromise(function(_0x37317f,_0x364fdf){delete _0x3ce053[_0xaeba('0x22')][_0x3d4ed3[_0xaeba('0xdb')]];_0x3ce053[_0xaeba('0xb2')](_0x3ce053[_0xaeba('0x1c')][_0xaecb75['queue']]);_0x3ce053[_0xaeba('0x1c')][_0xaecb75['queue']]['outboundAnswerCallsDay']+=0x1;_0x3ce053['voiceQueues'][_0xaecb75[_0xaeba('0xb3')]][_0xaeba('0x5a')]+=0x1;var _0xb20371=_0x3ce053[_0xaeba('0x1c')][_0xaecb75[_0xaeba('0xb3')]];var _0x89ff51=new Hangup(_0xaecb75,_0x3d4ed3);_0x89ff51[_0xaeba('0xa6')]=0x13;_0x89ff51[_0xaeba('0xa7')]='Machine';_0x89ff51['membername']=_0xaeba('0xe1');_0x89ff51['countmachineretry']+=0x1;_0x89ff51[_0xaeba('0xe6')]+=0x1;_0x89ff51[_0xaeba('0xe7')]=!![];ami[_0xaeba('0x45')]('custom:amd',ut[_0xaeba('0xe8')](_0x89ff51,_0xaeba('0xe7')));_0x3ce053['createHistory'](_0x89ff51)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x89ff51[_0xaeba('0xe9')]+_0x89ff51[_0xaeba('0xea')]+_0x89ff51[_0xaeba('0xeb')]+_0x89ff51[_0xaeba('0xec')]+_0x89ff51[_0xaeba('0xed')]+_0x89ff51[_0xaeba('0xee')]+_0x89ff51[_0xaeba('0xef')]+_0x89ff51[_0xaeba('0xf0')]>=_0xb20371[_0xaeba('0xf1')]){_0x3ce053[_0xaeba('0xf2')](_0x89ff51,_0x37317f,_0x364fdf,_0xaeba('0xf3'));}else{if(_0x89ff51[_0xaeba('0xef')]>=_0xb20371['dialMachineMaxRetry']){_0x3ce053[_0xaeba('0xf4')](_0x89ff51,_0x37317f,_0x364fdf,_0xaeba('0xf5'));}else{_0x3ce053[_0xaeba('0xc0')]({'active':![],'countmachineretry':_0x89ff51[_0xaeba('0xef')],'scheduledat':moment()[_0xaeba('0xf6')](_0xb20371[_0xaeba('0xf7')],_0xaeba('0xf8'))[_0xaeba('0x77')](_0xaeba('0xf9')),'ContactId':_0x89ff51[_0xaeba('0xd3')],'ListId':_0x89ff51[_0xaeba('0xd4')],'VoiceQueueId':_0x89ff51[_0xaeba('0xd5')]||undefined,'CampaignId':_0x89ff51[_0xaeba('0xfa')]||undefined})[_0xaeba('0xb8')](loggerCatch(_0xaeba('0xfb')));_0x37317f({'reschedule':0x1});}}});}if(_0xaecb75[_0xaeba('0x46')]===_0xaeba('0xb1')&&this['campaigns'][_0xaecb75[_0xaeba('0xb3')]][_0xaeba('0xe4')]&&_0x3d4ed3[_0xaeba('0xde')]===_0xaeba('0xfc')){delete this['uniqueId'][_0x3d4ed3[_0xaeba('0xdb')]];this[_0xaeba('0xb2')](this[_0xaeba('0x1d')][_0xaecb75[_0xaeba('0xb3')]]);_0x4911eb=new Hangup(_0xaecb75,_0x3d4ed3);_0x4911eb[_0xaeba('0xa6')]=0x12;_0x4911eb[_0xaeba('0xa7')]='HangupInAMD';_0x4911eb[_0xaeba('0xe0')]=_0xaeba('0xe1');ami[_0xaeba('0x45')]('custom:amd',ut[_0xaeba('0xe8')](_0x4911eb,_0xaeba('0xe7')));this[_0xaeba('0xd0')](_0x4911eb,_0xaeba('0xfd'),'[syncHangupInAMDIvr]');}if(_0xaecb75[_0xaeba('0x46')]==='ivr'&&this[_0xaeba('0x1d')][_0xaecb75[_0xaeba('0xb3')]][_0xaeba('0xe4')]&&_0x3d4ed3[_0xaeba('0xde')]===_0xaeba('0xe5')){var _0x3ce053=this;return new BPromise(function(_0x56cf3a,_0x3eafb9){delete _0x3ce053[_0xaeba('0x22')][_0x3d4ed3[_0xaeba('0xdb')]];_0x3ce053[_0xaeba('0xb2')](_0x3ce053['campaigns'][_0xaecb75[_0xaeba('0xb3')]]);_0x3ce053[_0xaeba('0x1d')][_0xaecb75[_0xaeba('0xb3')]][_0xaeba('0xdf')]+=0x1;_0x3ce053[_0xaeba('0x1d')][_0xaecb75[_0xaeba('0xb3')]][_0xaeba('0x5a')]+=0x1;var _0x16426d=_0x3ce053[_0xaeba('0x1d')][_0xaecb75[_0xaeba('0xb3')]];var _0x57e1dd=new Hangup(_0xaecb75,_0x3d4ed3);_0x57e1dd[_0xaeba('0xa6')]=0x13;_0x57e1dd['statedesc']=_0xaeba('0xfe');_0x57e1dd[_0xaeba('0xe0')]=_0xaeba('0xe1');_0x57e1dd[_0xaeba('0xef')]+=0x1;_0x57e1dd[_0xaeba('0xe6')]+=0x1;_0x57e1dd[_0xaeba('0xe7')]=!![];ami[_0xaeba('0x45')](_0xaeba('0xe2'),ut[_0xaeba('0xe8')](_0x57e1dd,_0xaeba('0xe7')));_0x3ce053[_0xaeba('0xca')](_0x57e1dd)[_0xaeba('0xb8')](loggerCatch(_0xaeba('0xff')));if(_0x57e1dd[_0xaeba('0xe9')]+_0x57e1dd['countcongestionretry']+_0x57e1dd[_0xaeba('0xeb')]+_0x57e1dd['countnosuchnumberretry']+_0x57e1dd['countdropretry']+_0x57e1dd[_0xaeba('0xee')]+_0x57e1dd[_0xaeba('0xef')]+_0x57e1dd[_0xaeba('0xf0')]>=_0x16426d[_0xaeba('0xf1')]){_0x3ce053[_0xaeba('0xf2')](_0x57e1dd,_0x56cf3a,_0x3eafb9,_0xaeba('0xf3'));}else{if(_0x57e1dd[_0xaeba('0xef')]>=_0x16426d[_0xaeba('0x100')]){_0x3ce053[_0xaeba('0xf4')](_0x57e1dd,_0x56cf3a,_0x3eafb9,_0xaeba('0xf5'));}else{_0x3ce053[_0xaeba('0xc0')]({'active':![],'countmachineretry':_0x57e1dd[_0xaeba('0xef')],'scheduledat':moment()['add'](_0x16426d[_0xaeba('0xf7')],_0xaeba('0xf8'))[_0xaeba('0x77')](_0xaeba('0xf9')),'ContactId':_0x57e1dd[_0xaeba('0xd3')],'ListId':_0x57e1dd[_0xaeba('0xd4')],'VoiceQueueId':_0x57e1dd[_0xaeba('0xd5')]||undefined,'CampaignId':_0x57e1dd[_0xaeba('0xfa')]||undefined})[_0xaeba('0xb8')](loggerCatch(_0xaeba('0xfb')));_0x56cf3a({'reschedule':0x1});}}});}}};Dialer[_0xaeba('0x17')]['syncHangup']=function(_0x4776a4){var _0x10dc0b=this[_0xaeba('0x22')][_0x4776a4[_0xaeba('0xdb')]];var _0x527db0=this;var _0x4fc6f7;if(_0x10dc0b&&_0x10dc0b['type']==='ivr'){delete this[_0xaeba('0x22')][_0x4776a4[_0xaeba('0xdb')]];this[_0xaeba('0xb2')](this[_0xaeba('0x1d')][_0x10dc0b[_0xaeba('0xb3')]]);this[_0xaeba('0x1d')][_0x10dc0b[_0xaeba('0xb3')]]['ivrAnswerCallsDay']+=0x1;_0x4fc6f7=new Hangup(_0x10dc0b,_0x4776a4);this[_0xaeba('0xca')](_0x4fc6f7)['catch'](loggerCatch(_0xaeba('0x101')));this['moveContactManagedDialer'](_0x4fc6f7)[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x102')));}if(_0x10dc0b&&_0x10dc0b['type']!==_0xaeba('0xb1')&&isNotNull(this[_0xaeba('0x1c')][_0x10dc0b[_0xaeba('0xb3')]][_0xaeba('0x103')])){delete this[_0xaeba('0x22')][_0x4776a4[_0xaeba('0xdb')]];this[_0xaeba('0xb2')](this['voiceQueues'][_0x10dc0b[_0xaeba('0xb3')]]);this[_0xaeba('0x1c')][_0x10dc0b[_0xaeba('0xb3')]][_0xaeba('0xdf')]+=0x1;this[_0xaeba('0x1c')][_0x10dc0b['queue']][_0xaeba('0x5a')]+=0x1;_0x4fc6f7=new Hangup(_0x10dc0b,_0x4776a4);_0x4fc6f7[_0xaeba('0xa6')]=0x10;_0x4fc6f7[_0xaeba('0xa7')]=_0xaeba('0x104');_0x4fc6f7[_0xaeba('0xe0')]='AGI';this[_0xaeba('0xca')](_0x4fc6f7)[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x101')));this['moveContactManagedDialer'](_0x4fc6f7)[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x102')));}if(_0x10dc0b&&_0x10dc0b['type']!==_0xaeba('0xb1')&&!isNotNull(this[_0xaeba('0x1c')][_0x10dc0b[_0xaeba('0xb3')]]['dialQueueProject'])){delete this[_0xaeba('0x22')][_0x4776a4[_0xaeba('0xdb')]];this[_0xaeba('0xb2')](this[_0xaeba('0x1c')][_0x10dc0b[_0xaeba('0xb3')]]);this[_0xaeba('0x1c')][_0x10dc0b[_0xaeba('0xb3')]]['outboundUnknownCallsDay']+=0x1;_0x4fc6f7=new Hangup(_0x10dc0b,_0x4776a4);_0x4fc6f7[_0xaeba('0xa6')]=0xc;_0x4fc6f7[_0xaeba('0xa7')]=_0x4776a4[_0xaeba('0x105')];_0x4fc6f7[_0xaeba('0xe0')]=_0xaeba('0x106');this[_0xaeba('0xca')](_0x4fc6f7)[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x101')));this[_0xaeba('0xc8')](_0x4fc6f7)[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x102')));}};Dialer[_0xaeba('0x17')][_0xaeba('0x107')]=function(_0x3534d6){var _0x556fd4=this[_0xaeba('0x22')][_0x3534d6[_0xaeba('0xdb')]];var _0x4cb206=this;if(this[_0xaeba('0x1c')][_0x3534d6[_0xaeba('0xb3')]]){if(_0x556fd4&&_0x556fd4['type']!==_0xaeba('0xb1')){delete this[_0xaeba('0x22')][_0x3534d6[_0xaeba('0xdb')]];this[_0xaeba('0x1c')][_0x3534d6[_0xaeba('0xb3')]][_0xaeba('0xdf')]+=0x1;var _0x250bb1=new AgentComplete(_0x556fd4,_0x3534d6);if(_0x3534d6[_0xaeba('0x108')]==='agent'){_0x250bb1[_0xaeba('0x109')]=this[_0xaeba('0x1c')][_0x3534d6[_0xaeba('0xb3')]][_0xaeba('0x10a')]&&this['voiceQueues'][_0x3534d6[_0xaeba('0xb3')]]['dialAgiAfterHangupAgent']?moment()[_0xaeba('0x77')](_0xaeba('0xf9')):undefined;}this[_0xaeba('0xca')](_0x250bb1)['catch'](loggerCatch(_0xaeba('0x10b')));this[_0xaeba('0xc8')](_0x250bb1)[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x10c')));}}};Dialer[_0xaeba('0x17')][_0xaeba('0x10d')]=function(_0x5d617b){if(this[_0xaeba('0x1c')][_0x5d617b[_0xaeba('0xb3')]]){if(this['uniqueId'][_0x5d617b[_0xaeba('0xdb')]]&&this[_0xaeba('0x22')][_0x5d617b[_0xaeba('0xdb')]][_0xaeba('0x46')]!==_0xaeba('0xb1')){this['updateOriginated'](this[_0xaeba('0x1c')][_0x5d617b['queue']]);this['uniqueId'][_0x5d617b[_0xaeba('0xdb')]][_0xaeba('0x10e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xaeba('0x17')][_0xaeba('0x10f')]=function(_0x406560){this['createHistory'](_0x406560)[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x10b')));this[_0xaeba('0xc8')](_0x406560)[_0xaeba('0xb8')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer['prototype']['syncQueueCallerAbandon']=function(_0x576781){var _0x33d1fc=this[_0xaeba('0x22')][_0x576781[_0xaeba('0xdb')]];var _0x4f199c=this;if(this[_0xaeba('0x1c')][_0x576781[_0xaeba('0xb3')]]){if(_0x33d1fc&&_0x33d1fc[_0xaeba('0x46')]!==_0xaeba('0xb1')){delete this['uniqueId'][_0x576781[_0xaeba('0xdb')]];this[_0xaeba('0xb2')](this['voiceQueues'][_0x576781[_0xaeba('0xb3')]]);_0x33d1fc[_0xaeba('0x110')]=moment()[_0xaeba('0x77')](_0xaeba('0xf9'));var _0x5b7c0f=new QueueCallerAbandon(_0x33d1fc,_0x576781);if(getSeconds(_0x33d1fc['droptime'],_0x33d1fc[_0xaeba('0x111')])>=_0x33d1fc[_0xaeba('0x112')]){this[_0xaeba('0x1c')][_0x576781[_0xaeba('0xb3')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this['voiceQueues'][_0x576781[_0xaeba('0xb3')]][_0xaeba('0x60')]+=0x1;this[_0xaeba('0x1c')][_0x576781[_0xaeba('0xb3')]][_0xaeba('0x6a')]+=0x1;_0x5b7c0f[_0xaeba('0xa6')]=0xa;_0x5b7c0f[_0xaeba('0xa7')]=_0xaeba('0x113');_0x5b7c0f[_0xaeba('0x114')]=_0xaeba('0x115');_0x5b7c0f['agiafterat']=this[_0xaeba('0x1c')][_0x576781[_0xaeba('0xb3')]]['dialQueueProject2']?moment()['format'](_0xaeba('0xf9')):undefined;_0x5b7c0f['countdropretry']+=0x1;_0x5b7c0f[_0xaeba('0xe6')]+=0x1;if(_0x5b7c0f[_0xaeba('0xed')]>=this[_0xaeba('0x1c')][_0x576781[_0xaeba('0xb3')]][_0xaeba('0x116')]){this[_0xaeba('0x10f')](_0x5b7c0f);}else{this[_0xaeba('0xc0')]({'active':![],'countdropretry':_0x5b7c0f[_0xaeba('0xed')],'scheduledat':moment()[_0xaeba('0xf6')](this['voiceQueues'][_0x576781[_0xaeba('0xb3')]][_0xaeba('0x117')],'minutes')['format'](_0xaeba('0xf9')),'ContactId':_0x33d1fc['ContactId'],'ListId':_0x33d1fc['ListId'],'VoiceQueueId':_0x33d1fc['VoiceQueueId']||undefined,'CampaignId':_0x33d1fc['CampaignId']||undefined})[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x118')));var _0x1a8be1=new History(_0x5b7c0f);_0x1a8be1[_0xaeba('0xa6')]=0xa;_0x1a8be1[_0xaeba('0xa7')]=_0xaeba('0x113');_0x1a8be1[_0xaeba('0xa9')]=moment()[_0xaeba('0x77')](_0xaeba('0xf9'));_0x1a8be1[_0xaeba('0xa8')]=_0x1a8be1[_0xaeba('0xa9')];_0x1a8be1[_0xaeba('0x119')]=_0x5b7c0f[_0xaeba('0x119')];_0x1a8be1[_0xaeba('0x11a')]=_0x5b7c0f['calleridnum'];this[_0xaeba('0xca')](_0x1a8be1)['catch'](loggerCatch(_0xaeba('0x11b')));}}else{this[_0xaeba('0x1c')][_0x576781['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xaeba('0x1c')][_0x576781[_0xaeba('0xb3')]]['outboundDropCallsDayCallersExit']+=0x1;_0x5b7c0f[_0xaeba('0xa6')]=0xb;_0x5b7c0f[_0xaeba('0xa7')]=_0xaeba('0x11c');_0x5b7c0f[_0xaeba('0x114')]='CALLEREXIT';_0x5b7c0f['countabandonedretry']+=0x1;_0x5b7c0f[_0xaeba('0xe6')]+=0x1;if(_0x5b7c0f['countabandonedretry']>=this[_0xaeba('0x1c')][_0x576781[_0xaeba('0xb3')]][_0xaeba('0x11d')]){this[_0xaeba('0x10f')](_0x5b7c0f);}else{this[_0xaeba('0xc0')]({'active':![],'countabandonedretry':_0x5b7c0f[_0xaeba('0xee')],'scheduledat':moment()[_0xaeba('0xf6')](this[_0xaeba('0x1c')][_0x576781[_0xaeba('0xb3')]][_0xaeba('0x11e')],_0xaeba('0xf8'))[_0xaeba('0x77')](_0xaeba('0xf9')),'ContactId':_0x33d1fc['ContactId'],'ListId':_0x33d1fc[_0xaeba('0xd4')],'VoiceQueueId':_0x33d1fc[_0xaeba('0xd5')]||undefined,'CampaignId':_0x33d1fc['CampaignId']||undefined})[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x11f')));var _0x1a8be1=new History(_0x5b7c0f);_0x1a8be1['state']=0xb;_0x1a8be1[_0xaeba('0xa7')]='Abandoned';_0x1a8be1['starttime']=moment()[_0xaeba('0x77')](_0xaeba('0xf9'));_0x1a8be1[_0xaeba('0xa8')]=_0x1a8be1['starttime'];_0x1a8be1[_0xaeba('0x119')]=_0x5b7c0f[_0xaeba('0x119')];_0x1a8be1[_0xaeba('0x11a')]=_0x5b7c0f['calleridnum'];this[_0xaeba('0xca')](_0x1a8be1)[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x120')));}}}}};Dialer[_0xaeba('0x17')][_0xaeba('0x30')]=function(_0xf0bf58){if(this['actions'][_0xf0bf58[_0xaeba('0xdb')]]){this['actions'][_0xf0bf58[_0xaeba('0xdb')]][_0xaeba('0x121')]=_0xf0bf58[_0xaeba('0x121')];}if(this[_0xaeba('0x22')][_0xf0bf58[_0xaeba('0xdb')]]){this[_0xaeba('0x22')][_0xf0bf58[_0xaeba('0xdb')]]['channel']=_0xf0bf58['channel'];}};Dialer['prototype'][_0xaeba('0x33')]=function(_0x428f6e){if(strategy[this['voiceQueues'][this[_0xaeba('0xac')][_0x428f6e[_0xaeba('0x122')]][_0xaeba('0xb3')]][_0xaeba('0x48')]]===_0xaeba('0x16')){if(this[_0xaeba('0xac')][_0x428f6e['actionid']]&&_[_0xaeba('0xad')](this[_0xaeba('0xac')][_0x428f6e[_0xaeba('0x122')]][_0xaeba('0x123')])&&_0x428f6e[_0xaeba('0xaf')]==='1'&&_0x428f6e[_0xaeba('0x124')]==='0'){if(this[_0xaeba('0x1e')][_0x428f6e[_0xaeba('0x125')]]){if(!this[_0xaeba('0x1e')][_0x428f6e[_0xaeba('0x125')]][_0xaeba('0x123')]){this[_0xaeba('0x1e')][_0x428f6e[_0xaeba('0x125')]]['locked']=!![];this[_0xaeba('0xac')][_0x428f6e[_0xaeba('0x122')]][_0xaeba('0x123')]=!![];this[_0xaeba('0xac')][_0x428f6e[_0xaeba('0x122')]][_0xaeba('0x125')]=_0x428f6e[_0xaeba('0x125')];}}}}else if((strategy[this[_0xaeba('0x1c')][this[_0xaeba('0xac')][_0x428f6e[_0xaeba('0x122')]][_0xaeba('0xb3')]][_0xaeba('0x48')]]||'rrmemory')===_0xaeba('0x126')){if(this[_0xaeba('0xac')][_0x428f6e[_0xaeba('0x122')]]){if(this[_0xaeba('0x1e')][_0x428f6e[_0xaeba('0x125')]]){this['actions'][_0x428f6e[_0xaeba('0x122')]][_0xaeba('0x125')]=_0x428f6e['stateinterface'];if(_[_0xaeba('0xad')](this['queueBooked'][this[_0xaeba('0xac')][_0x428f6e[_0xaeba('0x122')]]['queue']])){this[_0xaeba('0x127')][this[_0xaeba('0xac')][_0x428f6e['actionid']]['queue']]=[];}this[_0xaeba('0x127')][this[_0xaeba('0xac')][_0x428f6e['actionid']][_0xaeba('0xb3')]][_0xaeba('0x128')](_['merge'](_[_0xaeba('0xd2')](this['actions'][_0x428f6e[_0xaeba('0x122')]],['idHopper','stateinterface']),{'status':_0x428f6e[_0xaeba('0xaf')],'paused':_0x428f6e['paused']}));}}}};function unlockQueueStatus(_0x106003,_0x3a932c){setTimeout(function(){if(_['isUndefined'](_0x106003[_0xaeba('0x129')])){loggerBooked[_0xaeba('0x92')](_0xaeba('0x12a'),_0x3a932c);}_0x106003['queueStatusComplete']=!![];loggerBooked[_0xaeba('0x7b')]('[booked][unlockQueueStatus]',_0x3a932c,JSON['stringify'](_['pick'](_0x106003,[_0xaeba('0x3b'),_0xaeba('0x129')])));},0x1f3);}Dialer[_0xaeba('0x17')]['syncQueueStatusComplete']=function(_0x3dca9c){var _0x5ba14f=this;var _0x51aac5=_0x5ba14f['voiceQueues'][_0x5ba14f[_0xaeba('0xac')][_0x3dca9c[_0xaeba('0x122')]][_0xaeba('0xb3')]];if(strategy[this[_0xaeba('0x1c')][this[_0xaeba('0xac')][_0x3dca9c[_0xaeba('0x122')]][_0xaeba('0xb3')]][_0xaeba('0x48')]]==='roundrobin'){if(this[_0xaeba('0xac')][_0x3dca9c[_0xaeba('0x122')]]&&this[_0xaeba('0xac')][_0x3dca9c[_0xaeba('0x122')]][_0xaeba('0x125')]){this[_0xaeba('0x1b')][_0xaeba('0x12b')](this[_0xaeba('0xac')][_0x3dca9c[_0xaeba('0x122')]][_0xaeba('0x12c')],this[_0xaeba('0xac')][_0x3dca9c[_0xaeba('0x122')]]['stateinterface'])[_0xaeba('0xb8')](function(_0x29d763){logger[_0xaeba('0x92')](_0xaeba('0x12d'),util[_0xaeba('0x93')](_0x29d763,{'showHidden':![],'depth':null}));})[_0xaeba('0x12e')](function(){_0x5ba14f['updateOriginated'](_0x5ba14f[_0xaeba('0x1c')][_0x5ba14f[_0xaeba('0xac')][_0x3dca9c[_0xaeba('0x122')]][_0xaeba('0xb3')]]);_0x5ba14f['agents'][_0x5ba14f[_0xaeba('0xac')][_0x3dca9c['actionid']][_0xaeba('0x125')]]['locked']=![];delete _0x5ba14f['actions'][_0x3dca9c[_0xaeba('0x122')]];unlockQueueStatus(_0x51aac5);});}else{this[_0xaeba('0xb2')](this[_0xaeba('0x1c')][this['actions'][_0x3dca9c[_0xaeba('0x122')]][_0xaeba('0xb3')]]);this['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x3dca9c[_0xaeba('0x122')]]['ContactId'],'ListId':this[_0xaeba('0xac')][_0x3dca9c[_0xaeba('0x122')]][_0xaeba('0xd4')],'VoiceQueueId':this[_0xaeba('0xac')][_0x3dca9c[_0xaeba('0x122')]]['VoiceQueueId']||undefined,'CampaignId':this[_0xaeba('0xac')][_0x3dca9c['actionid']][_0xaeba('0xfa')]||undefined})[_0xaeba('0xb8')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x3dca9c[_0xaeba('0x122')]];unlockQueueStatus(_0x51aac5);}}else if((strategy[this['voiceQueues'][this['actions'][_0x3dca9c[_0xaeba('0x122')]][_0xaeba('0xb3')]][_0xaeba('0x48')]]||_0xaeba('0x126'))===_0xaeba('0x126')){var _0x2e92e0;if(this[_0xaeba('0xac')][_0x3dca9c[_0xaeba('0x122')]]&&!_[_0xaeba('0x40')](this[_0xaeba('0x127')][this[_0xaeba('0xac')][_0x3dca9c[_0xaeba('0x122')]][_0xaeba('0xb3')]])){if(this[_0xaeba('0x26')][_0x5ba14f[_0xaeba('0xac')][_0x3dca9c[_0xaeba('0x122')]]['queue']]){this[_0xaeba('0x26')][_0x5ba14f[_0xaeba('0xac')][_0x3dca9c[_0xaeba('0x122')]][_0xaeba('0xb3')]]=this[_0xaeba('0x26')][this[_0xaeba('0xac')][_0x3dca9c[_0xaeba('0x122')]][_0xaeba('0xb3')]]?this[_0xaeba('0x26')][this[_0xaeba('0xac')][_0x3dca9c[_0xaeba('0x122')]]['queue']]:this[_0xaeba('0x127')][this['actions'][_0x3dca9c['actionid']][_0xaeba('0xb3')]]?this[_0xaeba('0x127')][this['actions'][_0x3dca9c[_0xaeba('0x122')]][_0xaeba('0xb3')]]['_rr']||0x0:0x0;}this[_0xaeba('0x127')][this[_0xaeba('0xac')][_0x3dca9c[_0xaeba('0x122')]][_0xaeba('0xb3')]][_0xaeba('0x12f')]=this[_0xaeba('0x26')][this['actions'][_0x3dca9c[_0xaeba('0x122')]][_0xaeba('0xb3')]];for(var _0x1ee690=0x0;_0x1ee690=0x0;})[_0xaeba('0xb8')](myreject(_0x20f4ec)));}}else{_0x2f6485[_0xaeba('0x128')](ami[_0xaeba('0xae')]({'action':'command','command':util[_0xaeba('0x77')](_0xaeba('0x14e'),_0x20b568,!_[_0xaeba('0x84')](config[_0xaeba('0x14b')][_0x515f4c])?_0x515f4c:'')})[_0xaeba('0x37')](function(_0x198234){return _0x198234[_0xaeba('0x14c')][_0xaeba('0x14f')]('true')>=0x0;})[_0xaeba('0xb8')](myreject(_0x20f4ec)));}BPromise[_0xaeba('0x150')](_0x2f6485)['then'](function(_0x42f508){var _0x439b06=_['some'](_0x42f508);if(_0x439b06){return _0x56bd47(_0x439b06);}else{_0x3aaa03[_0xaeba('0x39')]=_0x4738f0?_0xaeba('0x151'):_0xaeba('0x152');return _0x20f4ec(msgResponse(_0xaeba('0x153'),_0xaeba('0x145'),_0xaeba('0x154')+_0x4738f0+'\x20'+_0x512eda+_0xaeba('0x155')+util[_0xaeba('0x93')](_0x20b568,{'showHidden':![],'depth':null})+_0xaeba('0x156')+_0x515f4c));}})['catch'](function(_0x15c948){return _0x20f4ec(msgResponse('ifTime',_0xaeba('0x145'),JSON['stringify'](_0x15c948)));});});};Dialer[_0xaeba('0x17')][_0xaeba('0x157')]=function(_0x1835f6){var _0x42fc33=this;return function(){switch(_0x1835f6[_0xaeba('0x158')]){case _0xaeba('0x159'):freeVariablesPredictive(_0x1835f6);_0x42fc33[_0xaeba('0x15a')](_0x1835f6,0x1);break;case _0xaeba('0x15b'):freeVariablesPredictive(_0x1835f6);_0x42fc33[_0xaeba('0x15a')](_0x1835f6,_0x1835f6[_0xaeba('0x15c')]);break;case'predictive':_0x42fc33['predictive'](_0x1835f6);break;case'booked':freeVariablesPredictive(_0x1835f6);_0x42fc33[_0xaeba('0x15a')](_0x1835f6,0x1);break;default:freeVariablesPredictive(_0x1835f6);logger[_0xaeba('0x92')](_0xaeba('0x15d'),_0x1835f6['name'],_0xaeba('0x15e'));}};};Dialer['prototype'][_0xaeba('0x15f')]=function(_0x12531f){return BPromise[_0xaeba('0xb7')]()[_0xaeba('0x37')](cmHopper[_0xaeba('0x160')](_0x12531f['id'],previewRecallmeReminderInterval))[_0xaeba('0x37')](function(_0x216640){for(var _0x3abbf3=0x0;_0x3abbf3<_0x216640[_0xaeba('0x95')];_0x3abbf3++){var _0x4d8f33=_0x216640[_0x3abbf3]['Agent']['name'];if(_0x4d8f33)io['to'](util[_0xaeba('0x77')](_0xaeba('0x161'),_0x4d8f33))[_0xaeba('0x45')](_0xaeba('0x162'),{'hopper':_0x216640[_0x3abbf3]});}})[_0xaeba('0xb8')](function(_0x49b4bc){});};Dialer['prototype']['launchHandleIvr']=function(_0x3d88f4){var _0x1c7b0b=this;return function(){_0x1c7b0b[_0xaeba('0x163')](_0x3d88f4);};};Dialer[_0xaeba('0x17')][_0xaeba('0x9')]=function(_0x5bf283){var _0x4849e2=this;if(isNotPreview(_0x5bf283['dialMethod'])){if(isVoiceQueueOutbound(_0x5bf283[_0xaeba('0x46')])&&isActive(_0x5bf283[_0xaeba('0x164')])){_0x5bf283[_0xaeba('0x9f')]=!![];BPromise[_0xaeba('0xb7')]()[_0xaeba('0x37')](checkIsLoggedIn(_0x5bf283,_0x5bf283[_0xaeba('0x4b')]))[_0xaeba('0x37')](checkIsActive(_0x5bf283,_0x5bf283[_0xaeba('0x164')]))[_0xaeba('0x37')](checkInterval(_0x5bf283))[_0xaeba('0x37')](_0x4849e2[_0xaeba('0x13e')](_0x5bf283))[_0xaeba('0x37')](_0x4849e2[_0xaeba('0x142')](_0x5bf283[_0xaeba('0x165')],_0x5bf283['dialTimezone'],_0x5bf283[_0xaeba('0x3b')],_0x5bf283))[_0xaeba('0x37')](_0x4849e2[_0xaeba('0x144')](_0x5bf283[_0xaeba('0x3c')],_0x5bf283[_0xaeba('0x166')],_0x5bf283[_0xaeba('0x3b')],_0x5bf283))[_0xaeba('0x37')](_0x4849e2[_0xaeba('0x157')](_0x5bf283))[_0xaeba('0xb8')](loggerCatchQueueSummary(_0xaeba('0x167'),_0x5bf283));}else{notSendMessagesQueue(_0x5bf283);}}else{freeVariablesPredictive(_0x5bf283);if(_0x5bf283[_0xaeba('0x168')]){_0x4849e2[_0xaeba('0x15f')](_0x5bf283);}}};Dialer[_0xaeba('0x17')]['syncCampaigns']=function(){var _0x3159ab=this;var _0x4bc2fa;for(var _0x9a7408 in this[_0xaeba('0x1d')]){if(typeof this[_0xaeba('0x1d')][_0x9a7408]!=='undefined'){_0x4bc2fa=this[_0xaeba('0x1d')][_0x9a7408];if(isCampaignIvr(_0x4bc2fa[_0xaeba('0x46')])&&isActive(_0x4bc2fa[_0xaeba('0x74')])){_0x4bc2fa[_0xaeba('0x9f')]=!![];BPromise[_0xaeba('0xb7')]()[_0xaeba('0x37')](checkIsActive(_0x4bc2fa,_0x4bc2fa['active']))['then'](checkInterval(_0x4bc2fa))[_0xaeba('0x37')](_0x3159ab[_0xaeba('0x13e')](_0x4bc2fa))[_0xaeba('0x37')](_0x3159ab[_0xaeba('0x142')](_0x4bc2fa[_0xaeba('0x165')],_0x4bc2fa[_0xaeba('0x166')],_0x4bc2fa[_0xaeba('0x3b')],_0x4bc2fa))['then'](_0x3159ab[_0xaeba('0x144')](_0x4bc2fa[_0xaeba('0x3c')],_0x4bc2fa[_0xaeba('0x166')],_0x4bc2fa[_0xaeba('0x3b')],_0x4bc2fa))[_0xaeba('0x37')](_0x3159ab[_0xaeba('0x169')](_0x4bc2fa))[_0xaeba('0xb8')](loggerCatchQueueSummary(_0xaeba('0x16a'),_0x4bc2fa));}else{notSendMessagesCampaign(_0x4bc2fa);}}}};function getCallerIdRandom(_0x2d33ab,_0x3ba19b){var _0x44083e;var _0x4119fe;var _0xaabf2d;if(_0x3ba19b<=0x0){_0x3ba19b=0x1;}_0x44083e=new RegExp(_0xaeba('0x16b')+_0x3ba19b+'}$');_0x4119fe=Math[_0xaeba('0x16c')](0xa,_0x3ba19b-0x1);_0xaabf2d=Math[_0xaeba('0x16c')](0xa,_0x3ba19b)-0x1;return util[_0xaeba('0x77')]('%s',_['replace'](_0x2d33ab,_0x44083e,_[_0xaeba('0x16d')](_0x4119fe,_0xaabf2d)));}function extractCalleridName(_0x5bb969){var _0xf6f624=_0x5bb969[_0xaeba('0x16e')](/"(.*?)"/);return _0xf6f624?_0xf6f624[0x1]:_0x5bb969;}function extractCalleridNumber(_0x2825c3){var _0x344877=_0x2825c3[_0xaeba('0x16e')](/<(.*?)>/);return _0x344877?_0x344877[0x1]:_0x2825c3;}Dialer[_0xaeba('0x17')][_0xaeba('0x16f')]=function(_0x4f54c0,_0x55edd6){var _0x24eba9=this;var _0x4128a8=uuid['v4']();this[_0xaeba('0xac')][_0x4128a8]=new Action(_0x4f54c0,_0x55edd6,_0x4128a8);return new BPromise(function(_0x18cdb7,_0x2490e1){if(_[_0xaeba('0x84')](_0x4f54c0)&&typeof _0x4f54c0!==_0xaeba('0x170')){return _0x2490e1(msgResponse(_0xaeba('0x171'),'Failure','voiceQueue\x20is\x20undefine'));}if(_[_0xaeba('0x84')](_0x55edd6[_0xaeba('0x172')][_0xaeba('0x173')])||_0x55edd6['Contact'][_0xaeba('0x173')]===null){return _0x2490e1(msgResponse(_0xaeba('0x171'),_0xaeba('0x145'),'contact\x20is\x20undefine'));}var _0x5878e8={'XMD-CALLERID':_0x24eba9[_0xaeba('0xac')][_0x4128a8][_0xaeba('0x174')](),'XMD-AGI':_0x4f54c0[_0xaeba('0x103')]?util[_0xaeba('0x77')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4f54c0[_0xaeba('0x103')]):'NONE','XMD-AGIAFTER':_0x4f54c0[_0xaeba('0x10a')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x4f54c0[_0xaeba('0x10a')]):_0xaeba('0x175'),'XMD-QUEUE':_0x4f54c0['type']===_0xaeba('0x47')?util['format'](_0xaeba('0x176'),_0x4f54c0[_0xaeba('0x3b')],_0x4f54c0[_0xaeba('0x177')]||'',_0x4f54c0[_0xaeba('0x178')]?'c':'',_0x4f54c0[_0xaeba('0x112')]||0x3):'NONE','XMD-CONTACTID':_0x55edd6[_0xaeba('0xd3')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x24eba9[_0xaeba('0xac')][_0x4128a8][_0xaeba('0x174')](),'XMD-AMD':_0x4f54c0[_0xaeba('0xe4')]?_0xaeba('0x179'):_0xaeba('0x175'),'XMD-DESTINATION':_0xaeba('0x17a')};if(_0x4f54c0[_0xaeba('0xe4')]){_0x5878e8[_0xaeba('0x17b')]=_0x4f54c0[_0xaeba('0x17c')]||0x9c4;_0x5878e8['XMD-AMDGREETING']=_0x4f54c0[_0xaeba('0x17d')]||0x5dc;_0x5878e8['XMD-AMDAFTERGREETINGSILENCE']=_0x4f54c0['dialAMDAfterGreetingSilence']||0x320;_0x5878e8['XMD-AMDTOTALANALYSISTIME']=_0x4f54c0[_0xaeba('0x17e')]||0x1388;_0x5878e8[_0xaeba('0x17f')]=_0x4f54c0[_0xaeba('0x180')]||0x64;_0x5878e8[_0xaeba('0x181')]=_0x4f54c0[_0xaeba('0x182')]||0x32;_0x5878e8['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x4f54c0[_0xaeba('0x183')]||0x3;_0x5878e8['XMD-AMDSILENCETHRESHOLD']=_0x4f54c0[_0xaeba('0x184')]||0x100;_0x5878e8[_0xaeba('0x185')]=_0x4f54c0[_0xaeba('0x186')]||0x1388;}if(_0x4f54c0['type']===_0xaeba('0x47')){_0x5878e8[_0xaeba('0x187')]=_0x55edd6[_0xaeba('0xd5')];}else{_0x5878e8[_0xaeba('0x188')]=_0x55edd6['CampaignId'];}for(var _0x381b2a in _0x55edd6['Contact']){if(typeof _0x55edd6[_0xaeba('0x172')][_0x381b2a]!==_0xaeba('0x97')){if(isNotNull(_0x55edd6[_0xaeba('0x172')][_0x381b2a])&&_0x381b2a!=='id'&&_0x381b2a!==_0xaeba('0x189')&&_0x381b2a!=='createdAt'&&_0x381b2a!==_0xaeba('0x18a')){_0x5878e8[util['format'](_0xaeba('0x18b'),'XMD-',_[_0xaeba('0x18c')](_0x381b2a))]=_0x55edd6[_0xaeba('0x172')][_0x381b2a];}}}var _0x313c02=_0x24eba9[_0xaeba('0xd9')](_0x4f54c0[_0xaeba('0x73')])?getCallerId(_0x4f54c0[_0xaeba('0x73')][_0xaeba('0x75')],_0x4f54c0[_0xaeba('0x56')],_0x4f54c0[_0xaeba('0x18d')]>0x0?getCallerIdRandom(_0x4f54c0[_0xaeba('0x57')],_0x4f54c0['dialRandomLastDigitCallerIdNumber']):_0x4f54c0[_0xaeba('0x57')]):getCallerId(_[_0xaeba('0xad')](_0x4f54c0[_0xaeba('0x13f')])?_0x4f54c0[_0xaeba('0x73')]['callerid']:_0x4f54c0[_0xaeba('0x13f')][_0xaeba('0x75')],_0x4f54c0[_0xaeba('0x56')],_0x4f54c0[_0xaeba('0x18d')]>0x0?getCallerIdRandom(_0x4f54c0[_0xaeba('0x57')],_0x4f54c0[_0xaeba('0x18d')]):_0x4f54c0[_0xaeba('0x57')]);if(_0x313c02){_0x5878e8[_0xaeba('0x18e')]=_0x24eba9['actions'][_0x4128a8]['originatecalleridname']=extractCalleridName(_0x313c02);_0x5878e8[_0xaeba('0x18f')]=_0x24eba9['actions'][_0x4128a8][_0xaeba('0x190')]=extractCalleridNumber(_0x313c02);}return ami[_0xaeba('0xae')]({'actionid':_0x4128a8,'action':_0xaeba('0x171'),'channel':_0x24eba9[_0xaeba('0xd9')](_0x4f54c0[_0xaeba('0x73')])?util[_0xaeba('0x77')](_0xaeba('0x191'),_0x4f54c0[_0xaeba('0x73')][_0xaeba('0x3b')],isNotNull(_0x4f54c0['dialPrefix'])?_0x4f54c0[_0xaeba('0x59')][_0xaeba('0x192')]()||'':'',_0x4f54c0[_0xaeba('0x193')]>0x0?_0x55edd6[_0xaeba('0x172')][_0xaeba('0x173')]['substring'](_0x4f54c0[_0xaeba('0x193')]):_0x55edd6[_0xaeba('0x172')]['phone']):util[_0xaeba('0x77')](_0xaeba('0x191'),_['isNil'](_0x4f54c0[_0xaeba('0x13f')])?_0x4f54c0['Trunk'][_0xaeba('0x3b')]:_0x4f54c0['TrunkBackup']['name'],isNotNull(_0x4f54c0[_0xaeba('0x59')])?_0x4f54c0[_0xaeba('0x59')][_0xaeba('0x192')]()||'':'',_0x4f54c0['dialCutDigit']>0x0?_0x55edd6[_0xaeba('0x172')]['phone'][_0xaeba('0x194')](_0x4f54c0[_0xaeba('0x193')]):_0x55edd6[_0xaeba('0x172')][_0xaeba('0x173')]),'callerid':_0x313c02,'Exten':'xcally-motion-dialer','Context':_0xaeba('0x195'),'Priority':'1','variable':_0x5878e8,'timeout':(_0x4f54c0[_0xaeba('0x58')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4128a8})[_0xaeba('0x37')](function(_0x1249a9){return _0x18cdb7(_0x1249a9);})[_0xaeba('0xb8')](function(_0x513a5d){_0x4f54c0[_0xaeba('0x62')]+=0x1;var _0x3f096b=new History(_0x24eba9['actions'][_0x4128a8]);logger[_0xaeba('0x92')](util[_0xaeba('0x77')](_0xaeba('0x196'),JSON[_0xaeba('0x76')](_0x513a5d)));_0x3f096b[_0xaeba('0xa6')]=0xe;_0x3f096b['statedesc']=_0xaeba('0x197');_0x3f096b['starttime']=moment()[_0xaeba('0x77')](_0xaeba('0xf9'));_0x3f096b[_0xaeba('0xa8')]=_0x3f096b[_0xaeba('0xa9')];_0x24eba9[_0xaeba('0xca')](_0x3f096b)['catch'](loggerCatch(_0xaeba('0x198')));_0x24eba9['moveContactManagedDialer'](_0x3f096b)[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x198')))[_0xaeba('0x12e')](function(){delete _0x24eba9['actions'][_0x4128a8];return _0x2490e1(msgResponse(_0xaeba('0x171'),_0xaeba('0x42'),'originate\x20action\x20Error'));});});});};Dialer['prototype'][_0xaeba('0x2a')]=function(_0x458a3b){var _0x5c808a=this[_0xaeba('0xac')][_0x458a3b[_0xaeba('0x122')]];if(_0x5c808a){delete this[_0xaeba('0xac')][_0x458a3b[_0xaeba('0x122')]];_0x5c808a['responsetime']=moment()['format'](_0xaeba('0xf9'));var _0x345446=_0x5c808a[_0xaeba('0x46')]===_0xaeba('0xb1')?this['campaigns'][_0x5c808a[_0xaeba('0xb3')]]:this['voiceQueues'][_0x5c808a[_0xaeba('0x199')]()];if(!this[_0xaeba('0xd8')](_0x458a3b['response'])){this[_0xaeba('0xb2')](_0x345446);return this['callProgressDetecting'](_0x5c808a,_0x345446,_0x458a3b)[_0xaeba('0xb8')](loggerCatch('[callProgressDetecting]\x20'));}this[_0xaeba('0x22')][_0x458a3b[_0xaeba('0xdb')]]=_0x5c808a;}};Dialer['prototype']['checkRetriveMax']=function(_0x25ea49,_0x57e29e,_0x458f40){var _0x252f45=new History(_0x57e29e);if(_0x252f45[_0xaeba('0xe9')]+_0x252f45['countcongestionretry']+_0x252f45[_0xaeba('0xeb')]+_0x252f45['countnosuchnumberretry']+_0x252f45['countdropretry']+_0x252f45[_0xaeba('0xee')]+_0x252f45[_0xaeba('0xef')]+_0x252f45[_0xaeba('0xf0')]>=_0x458f40[_0xaeba('0xf1')]-0x1){return!![];}switch(_0x25ea49){case 0x3:if(_0x252f45[_0xaeba('0xeb')]>=_0x458f40[_0xaeba('0x19a')]-0x1){return!![];}this[_0xaeba('0xc0')]({'active':![],'countnoanswerretry':_0x252f45[_0xaeba('0xeb')]+=0x1,'scheduledat':moment()[_0xaeba('0xf6')](_0x458f40[_0xaeba('0x19b')],_0xaeba('0xf8'))[_0xaeba('0x77')](_0xaeba('0xf9')),'ContactId':_0x252f45['ContactId'],'ListId':_0x252f45['ListId'],'VoiceQueueId':_0x252f45[_0xaeba('0xd5')]||undefined,'CampaignId':_0x252f45['CampaignId']||undefined})['catch'](loggerCatch(_0xaeba('0x19c')));break;case 0x5:if(_0x252f45[_0xaeba('0xe9')]>=_0x458f40['dialBusyMaxRetry']-0x1){return!![];}this[_0xaeba('0xc0')]({'active':![],'countbusyretry':_0x252f45[_0xaeba('0xe9')]+=0x1,'scheduledat':moment()[_0xaeba('0xf6')](_0x458f40[_0xaeba('0x19d')],_0xaeba('0xf8'))[_0xaeba('0x77')](_0xaeba('0xf9')),'ContactId':_0x252f45[_0xaeba('0xd3')],'ListId':_0x252f45['ListId'],'VoiceQueueId':_0x252f45[_0xaeba('0xd5')]||undefined,'CampaignId':_0x252f45['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x252f45[_0xaeba('0xea')]>=_0x458f40[_0xaeba('0x19e')]-0x1){return!![];}this[_0xaeba('0xc0')]({'active':![],'countcongestionretry':_0x252f45[_0xaeba('0xea')]+=0x1,'scheduledat':moment()[_0xaeba('0xf6')](_0x458f40[_0xaeba('0x19f')],_0xaeba('0xf8'))['format'](_0xaeba('0xf9')),'ContactId':_0x252f45[_0xaeba('0xd3')],'ListId':_0x252f45[_0xaeba('0xd4')],'VoiceQueueId':_0x252f45['VoiceQueueId']||undefined,'CampaignId':_0x252f45[_0xaeba('0xfa')]||undefined})[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x1a0')));break;case 0x0:if(_0x252f45[_0xaeba('0xec')]>=_0x458f40['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0xaeba('0xc0')]({'active':![],'countnosuchnumberretry':_0x252f45[_0xaeba('0xec')]+=0x1,'scheduledat':moment()[_0xaeba('0xf6')](_0x458f40[_0xaeba('0x1a1')],_0xaeba('0xf8'))[_0xaeba('0x77')](_0xaeba('0xf9')),'ContactId':_0x252f45[_0xaeba('0xd3')],'ListId':_0x252f45[_0xaeba('0xd4')],'VoiceQueueId':_0x252f45['VoiceQueueId']||undefined,'CampaignId':_0x252f45[_0xaeba('0xfa')]||undefined})[_0xaeba('0xb8')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x252f45['countdropretry']>=_0x458f40[_0xaeba('0x116')]-0x1){return!![];}this[_0xaeba('0xc0')]({'active':![],'countdropretry':_0x252f45[_0xaeba('0xed')]+=0x1,'scheduledat':moment()[_0xaeba('0xf6')](_0x458f40[_0xaeba('0x117')],_0xaeba('0xf8'))['format'](_0xaeba('0xf9')),'ContactId':_0x252f45[_0xaeba('0xd3')],'ListId':_0x252f45[_0xaeba('0xd4')],'VoiceQueueId':_0x252f45[_0xaeba('0xd5')]||undefined,'CampaignId':_0x252f45[_0xaeba('0xfa')]||undefined})['catch'](loggerCatch(_0xaeba('0x118')));break;case 0xb:if(_0x252f45['countabandonedretry']>=_0x458f40['dialAbandonedMaxRetry']-0x1){return!![];}this[_0xaeba('0xc0')]({'active':![],'countabandonedretry':_0x252f45[_0xaeba('0xee')]+=0x1,'scheduledat':moment()[_0xaeba('0xf6')](_0x458f40[_0xaeba('0x11e')],_0xaeba('0xf8'))[_0xaeba('0x77')](_0xaeba('0xf9')),'ContactId':_0x252f45['ContactId'],'ListId':_0x252f45[_0xaeba('0xd4')],'VoiceQueueId':_0x252f45[_0xaeba('0xd5')]||undefined,'CampaignId':_0x252f45[_0xaeba('0xfa')]||undefined})[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x11f')));break;case 0x13:if(_0x252f45['countmachineretry']>=_0x458f40['dialMachineMaxRetry']-0x1){return!![];}this[_0xaeba('0xc0')]({'active':![],'countmachineretry':_0x252f45[_0xaeba('0xef')]+=0x1,'scheduledat':moment()[_0xaeba('0xf6')](_0x458f40[_0xaeba('0xf7')],'minutes')['format'](_0xaeba('0xf9')),'ContactId':_0x252f45[_0xaeba('0xd3')],'ListId':_0x252f45['ListId'],'VoiceQueueId':_0x252f45[_0xaeba('0xd5')]||undefined,'CampaignId':_0x252f45[_0xaeba('0xfa')]||undefined})[_0xaeba('0xb8')](loggerCatch(_0xaeba('0xfb')));break;case 0x14:if(_0x252f45[_0xaeba('0xf0')]>=_0x458f40[_0xaeba('0x1a2')]-0x1){return!![];}this[_0xaeba('0xc0')]({'active':![],'countagentrejectretry':_0x252f45[_0xaeba('0xf0')]+=0x1,'scheduledat':moment()[_0xaeba('0xf6')](_0x458f40[_0xaeba('0x1a3')],'minutes')[_0xaeba('0x77')](_0xaeba('0xf9')),'ContactId':_0x252f45[_0xaeba('0xd3')],'ListId':_0x252f45[_0xaeba('0xd4')],'VoiceQueueId':_0x252f45[_0xaeba('0xd5')]||undefined,'CampaignId':_0x252f45['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xaeba('0x17')][_0xaeba('0x1a4')]=function(_0x303b4c,_0x523c5d,_0x2b4b36){var _0x3a694f=this;var _0x1380fa=new History(_0x303b4c);return new BPromise(function(_0x197fc0,_0x5e09e7){if(_[_0xaeba('0x84')](_0x523c5d)&&typeof _0x523c5d!==_0xaeba('0x170')){return _0x5e09e7(msgResponse(_0xaeba('0x1a5'),'Failure','entity\x20is\x20undefine'));}if(_[_0xaeba('0x84')](_0x2b4b36)&&typeof _0x2b4b36!=='object'){return _0x5e09e7(msgResponse('[callProgressDetecting]',_0xaeba('0x145'),_0xaeba('0x1a6')));}switch(_0x2b4b36[_0xaeba('0x108')]){case'0':_0x523c5d['outboundNoSuchCallsDay']+=0x1;_0x1380fa[_0xaeba('0xa6')]=0x0;_0x1380fa['statedesc']=_0xaeba('0x1a7');_0x1380fa[_0xaeba('0xec')]+=0x1;_0x1380fa[_0xaeba('0xe6')]+=0x1;ami[_0xaeba('0x45')](_0xaeba('0x1a8'),ut[_0xaeba('0xe8')](_0x303b4c,_0xaeba('0x1a9')));_0x3a694f['createHistory'](_0x1380fa)[_0xaeba('0xb8')](loggerCatch(_0xaeba('0xff')));if(_0x3a694f[_0xaeba('0x1aa')](0x0,_0x303b4c,_0x523c5d)){if(_0x1380fa[_0xaeba('0xec')]>=_0x523c5d[_0xaeba('0x1ab')]){_0x3a694f[_0xaeba('0xf4')](_0x1380fa,_0x197fc0,_0x5e09e7,_0xaeba('0x1ac'));}else{_0x3a694f[_0xaeba('0xf2')](_0x1380fa,_0x197fc0,_0x5e09e7,_0xaeba('0x1ac'));}}break;case'3':_0x523c5d['outboundNoAnswerCallsDay']+=0x1;_0x1380fa['state']=0x3;_0x1380fa[_0xaeba('0xa7')]=_0xaeba('0x1ad');_0x1380fa[_0xaeba('0xeb')]+=0x1;_0x1380fa[_0xaeba('0xe6')]+=0x1;ami[_0xaeba('0x45')]('custom:agentnoanswer',ut[_0xaeba('0xe8')](_0x303b4c,_0xaeba('0x1ae')));_0x3a694f[_0xaeba('0xca')](_0x1380fa)['catch'](loggerCatch(_0xaeba('0x1af')));if(_0x3a694f[_0xaeba('0x1aa')](0x3,_0x303b4c,_0x523c5d)){if(_0x1380fa['countnoanswerretry']>=_0x523c5d['dialNoAnswerMaxRetry']){_0x3a694f[_0xaeba('0xf4')](_0x1380fa,_0x197fc0,_0x5e09e7,'reason\x203\x20ringing\x20no\x20answer');}else{_0x3a694f[_0xaeba('0xf2')](_0x1380fa,_0x197fc0,_0x5e09e7,_0xaeba('0x1b0'));}}break;case'5':_0x523c5d[_0xaeba('0x5c')]+=0x1;_0x1380fa[_0xaeba('0xa6')]=0x5;_0x1380fa['statedesc']=_0xaeba('0x1b1');_0x1380fa['countbusyretry']+=0x1;_0x1380fa[_0xaeba('0xe6')]+=0x1;ami[_0xaeba('0x45')](_0xaeba('0x1b2'),ut['buildObj'](_0x303b4c,_0xaeba('0x1b3')));_0x3a694f[_0xaeba('0xca')](_0x1380fa)[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x1b4')));if(_0x3a694f[_0xaeba('0x1aa')](0x5,_0x303b4c,_0x523c5d)){if(_0x1380fa[_0xaeba('0xe9')]>=_0x523c5d['dialBusyMaxRetry']){_0x3a694f[_0xaeba('0xf4')](_0x1380fa,_0x197fc0,_0x5e09e7,_0xaeba('0x1b5'));}else{_0x3a694f[_0xaeba('0xf2')](_0x1380fa,_0x197fc0,_0x5e09e7,'reason\x205\x20busy');}}break;case'8':_0x523c5d[_0xaeba('0x5d')]+=0x1;_0x1380fa[_0xaeba('0xa6')]=0x8;_0x1380fa[_0xaeba('0xa7')]=_0xaeba('0x1b6');_0x1380fa[_0xaeba('0xea')]+=0x1;_0x1380fa['countglobal']+=0x1;ami[_0xaeba('0x45')](_0xaeba('0x1b7'),ut[_0xaeba('0xe8')](_0x303b4c,_0xaeba('0x1b8')));_0x3a694f[_0xaeba('0xca')](_0x1380fa)[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x1b9')));if(_0x3a694f[_0xaeba('0x1aa')](0x8,_0x303b4c,_0x523c5d)){if(_0x1380fa[_0xaeba('0xea')]>=_0x523c5d['dialCongestionMaxRetry']){_0x3a694f[_0xaeba('0xf4')](_0x1380fa,_0x197fc0,_0x5e09e7,_0xaeba('0x1ba'));}else{_0x3a694f[_0xaeba('0xf2')](_0x1380fa,_0x197fc0,_0x5e09e7,_0xaeba('0x1ba'));}}break;case'11':_0x523c5d[_0xaeba('0x1bb')]+=0x1;_0x1380fa[_0xaeba('0xa6')]=0xb;_0x1380fa[_0xaeba('0xa7')]=_0xaeba('0x11c');_0x1380fa[_0xaeba('0xee')]+=0x1;_0x1380fa['countglobal']+=0x1;_0x3a694f[_0xaeba('0xca')](_0x1380fa)[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x120')));if(_0x3a694f[_0xaeba('0x1aa')](0xb,_0x303b4c,_0x523c5d)){if(_0x1380fa[_0xaeba('0xee')]>=_0x523c5d[_0xaeba('0x11d')]){_0x3a694f[_0xaeba('0xf4')](_0x1380fa,_0x197fc0,_0x5e09e7,_0xaeba('0x1bc'));}else{_0x3a694f['stateGlobal'](_0x1380fa,_0x197fc0,_0x5e09e7,_0xaeba('0x1bc'));}}break;case'20':_0x523c5d[_0xaeba('0x1bd')]+=0x1;_0x1380fa[_0xaeba('0xa6')]=0x14;_0x1380fa[_0xaeba('0xa7')]=_0xaeba('0x1be');_0x1380fa['countagentrejectretry']+=0x1;_0x1380fa['countglobal']+=0x1;ami[_0xaeba('0x45')](_0xaeba('0x1bf'),ut[_0xaeba('0xe8')](_0x303b4c,_0xaeba('0x1c0')));_0x3a694f[_0xaeba('0xca')](_0x1380fa)[_0xaeba('0xb8')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x3a694f[_0xaeba('0x1aa')](0x14,_0x303b4c,_0x523c5d)){if(_0x1380fa[_0xaeba('0xf0')]>=_0x523c5d[_0xaeba('0x1a2')]){_0x3a694f[_0xaeba('0xf4')](_0x1380fa,_0x197fc0,_0x5e09e7,_0xaeba('0x1c1'));}else{_0x3a694f[_0xaeba('0xf2')](_0x1380fa,_0x197fc0,_0x5e09e7,_0xaeba('0x1c1'));}}break;default:_0x523c5d[_0xaeba('0x64')]+=0x1;_0x1380fa['state']=0xc;_0x1380fa[_0xaeba('0xa7')]=_0x2b4b36[_0xaeba('0x108')];_0x3a694f[_0xaeba('0xca')](_0x1380fa)['catch'](loggerCatch(_0xaeba('0x1c2')));if(_0x3a694f[_0xaeba('0x1aa')](_0x2b4b36[_0xaeba('0x108')],_0x303b4c,_0x523c5d)){if(_0x1380fa[_0xaeba('0xe9')]+_0x1380fa['countcongestionretry']+_0x1380fa[_0xaeba('0xeb')]+_0x1380fa[_0xaeba('0xec')]+_0x1380fa[_0xaeba('0xed')]+_0x1380fa['countabandonedretry']+_0x1380fa['countmachineretry']+_0x1380fa[_0xaeba('0xf0')]>=_0x523c5d[_0xaeba('0xf1')]){_0x3a694f[_0xaeba('0xf2')](_0x1380fa,_0x197fc0,_0x5e09e7,_0x2b4b36['reason']);}else{_0x3a694f[_0xaeba('0xf4')](_0x1380fa,_0x197fc0,_0x5e09e7,_0x2b4b36[_0xaeba('0x108')]);}}}});};Dialer['prototype'][_0xaeba('0xf2')]=function(_0x30e744,_0x4cac7e,_0x35966e,_0x50e435){var _0x217dd6=new Final(_0x30e744);_0x217dd6[_0xaeba('0xa6')]=0xf;_0x217dd6[_0xaeba('0xa7')]='Global';this[_0xaeba('0xf4')](_0x217dd6,_0x4cac7e,_0x35966e,_0x50e435);};Dialer['prototype'][_0xaeba('0xf4')]=function(_0x5f2a42,_0x33a1d6,_0xe9b46,_0x45cc3b){this[_0xaeba('0xc8')](_0x5f2a42)[_0xaeba('0x37')](function(){return _0x33a1d6(msgResponse(_0xaeba('0x1a5'),'Success',_0x45cc3b));})[_0xaeba('0xb8')](function(){return _0xe9b46(msgResponse(_0xaeba('0x1c3'),_0xaeba('0x145'),_0xaeba('0x1c4')));});};Dialer[_0xaeba('0x17')][_0xaeba('0x1c5')]=function(_0x26f938){var _0x4e3c2d=_0x26f938[_0xaeba('0x1c6')]/0x64;var _0x294ab7=_0x26f938[_0xaeba('0x60')]/(_0x26f938[_0xaeba('0x60')]+_0x26f938[_0xaeba('0xdf')]);var _0x4e9d44=Math['round'](_0x26f938[_0xaeba('0x1c7')]*(_0x26f938[_0xaeba('0x1c8')]/0x64));var _0x335680=Math['round'](_0x26f938[_0xaeba('0x1c7')]*(_0x26f938[_0xaeba('0x1c9')]/0x64));var _0x366604=_0x26f938[_0xaeba('0x4a')]+_0x26f938['talking'];var _0x2bb3d0=Math['floor'](_0x26f938[_0xaeba('0x6f')]*_0x26f938[_0xaeba('0x71')]*_0x26f938[_0xaeba('0x6b')]*_0x26f938[_0xaeba('0x6c')]);if(_[_0xaeba('0x84')](_0x26f938[_0xaeba('0x25')])){if(!_[_0xaeba('0x84')](_0x26f938[_0xaeba('0x24')])){_0x26f938[_0xaeba('0x24')]=undefined;loggerPredictive[_0xaeba('0x92')](_0xaeba('0x1ca'),_0xaeba('0x1cb'));}if(!_['isUndefined'](_0x26f938[_0xaeba('0x8e')])){loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0xaeba('0x1cc'));clearInterval(_0x26f938[_0xaeba('0x8e')]);_0x26f938[_0xaeba('0x8e')]=undefined;}_0x26f938[_0xaeba('0x25')]=moment()[_0xaeba('0x77')](_0xaeba('0xf9'));loggerPredictive[_0xaeba('0x7b')](_0x26f938[_0xaeba('0x3b')],_0xaeba('0x1cd'),_0x26f938[_0xaeba('0x25')]);this[_0xaeba('0x15a')](_0x26f938,0x1);}else if(ifInterval(_0x26f938[_0xaeba('0x1ce')],_0x26f938[_0xaeba('0x25')])){this[_0xaeba('0x15a')](_0x26f938,0x1);loggerPredictiveCalls[_0xaeba('0x7b')]('[startMethodPredictive][StartProgressive][Loop]',_0x26f938['startProgressive'],_0x26f938['name']);_0x26f938[_0xaeba('0x6f')]=0x0;_0x26f938['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x4e3c2d<_0x294ab7&&_0x26f938[_0xaeba('0x1cf')]===_0xaeba('0x1d0')){freeVariablesPredictive(_0x26f938);loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x1d1'),_0xaeba('0x1d2'),_0x294ab7,'startProgressive',_0x26f938[_0xaeba('0x3b')]);}else if(_0x2bb3d0<_0x26f938[_0xaeba('0x6a')]&&_0x26f938[_0xaeba('0x1cf')]===_0xaeba('0x1d0')){freeVariablesPredictive(_0x26f938);loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x1d3'),_0xaeba('0x1d4'),_0x2bb3d0,'Drop\x20in\x20this\x20interval',_0x26f938[_0xaeba('0x6a')],_0xaeba('0x25'),_0x26f938[_0xaeba('0x3b')]);}else if(!ifInterval(_0x26f938[_0xaeba('0x1ce')],_0x26f938[_0xaeba('0x25')])&&_[_0xaeba('0x84')](_0x26f938[_0xaeba('0x24')])&&!_['isUndefined'](_0x26f938[_0xaeba('0x25')])){_0x26f938[_0xaeba('0x24')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x26f938[_0xaeba('0x3b')],_0xaeba('0x1d5'),_0x26f938[_0xaeba('0x24')]);this[_0xaeba('0xbe')](_0x26f938[_0xaeba('0x1ce')])[_0xaeba('0x37')](this['getDataPredictive'](_0x26f938))[_0xaeba('0x37')](mergeDataErlangB(_0x26f938))[_0xaeba('0x37')](this[_0xaeba('0x1d6')](_0x26f938))[_0xaeba('0xb8')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x26f938));}else if(!ifInterval(_0x26f938[_0xaeba('0x1ce')],_0x26f938[_0xaeba('0x24')])){_0x26f938[_0xaeba('0x6a')]=0x0;_0x26f938[_0xaeba('0x24')]=moment()[_0xaeba('0x77')](_0xaeba('0xf9'));loggerPredictive['info'](_0x26f938[_0xaeba('0x3b')],_0xaeba('0x1d7'),_0x26f938[_0xaeba('0x24')]);clearInterval(_0x26f938['handlePredictive']);_0x26f938[_0xaeba('0x8e')]=undefined;this['averageHandleTime'](_0x26f938[_0xaeba('0x1ce')])[_0xaeba('0x37')](this[_0xaeba('0x1d8')](_0x26f938))[_0xaeba('0x37')](mergeDataErlangB(_0x26f938))['then'](this[_0xaeba('0x1d6')](_0x26f938))[_0xaeba('0xb8')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x26f938));}else if(_0x26f938['predictiveIntervalAvailable']&&_0x366604<_0x26f938[_0xaeba('0x1c7')]-_0x335680){freeVariablesPredictive(_0x26f938);loggerPredictive[_0xaeba('0x7b')](_0x26f938[_0xaeba('0x3b')],_0xaeba('0x1d9'),_0x366604,_0xaeba('0x1da'),_0x26f938['predictiveIntervalAvailable'],'-',_0x335680,'=',_0x26f938[_0xaeba('0x1c7')]-_0x335680,')');}else if(_0x26f938['predictiveIntervalAvailable']&&_0x366604>_0x26f938['predictiveIntervalAvailable']+_0x4e9d44){freeVariablesPredictive(_0x26f938);loggerPredictive[_0xaeba('0x7b')](_0x26f938['name'],_0xaeba('0x1d9'),_0x366604,')\x20are\x20more\x20than\x20threshold\x20(',_0x26f938[_0xaeba('0x1c7')],'+',_0x4e9d44,'=',_0x26f938[_0xaeba('0x1c7')]+_0x4e9d44,')');}};Dialer[_0xaeba('0x17')][_0xaeba('0x1d8')]=function(_0x3a295e){var _0x2d084e=this;return function(_0x115940){return new BPromise(function(_0x595757,_0x5044ac){_[_0xaeba('0xd1')](_0x3a295e,_0x115940[0x0]);if(checkGetDataPredictive(_0x115940[0x0])){var _0x344e94=_0x3a295e[_0xaeba('0x1c7')]=_0x3a295e['talking']+_0x3a295e[_0xaeba('0x4a')];var _0x436936=_0x3a295e['dialPredictiveInterval']*0x3c;var _0x1656a7=_0x115940[0x0][_0xaeba('0x66')]+_0x115940[0x0][_0xaeba('0x81')];var _0x15eeb3=(_0x115940[0x0]['predictiveIntervalAnsweredCalls']+_0x115940[0x0][_0xaeba('0x68')]+_0x115940[0x0][_0xaeba('0x67')])/_0x115940[0x0][_0xaeba('0x6e')];_0x3a295e[_0xaeba('0x6b')]=_0x15eeb3>0x0?_0x15eeb3:0x1;switch(_0x3a295e[_0xaeba('0x1cf')]){case _0xaeba('0x1d0'):var _0x211561=_0x3a295e[_0xaeba('0x1c6')]/0x64;return _0x2d084e[_0xaeba('0x1db')](_0x344e94,_0x436936,_0x1656a7,_0x15eeb3,_0x211561)[_0xaeba('0x37')](function(_0xbdce78){return _0x595757(_0xbdce78);});case'agentBusyFactor':var _0x3673c3=_0x3a295e[_0xaeba('0x1c6')]/0x64;return _0x2d084e[_0xaeba('0x1dc')](_0x344e94,_0x436936,_0x1656a7,_0x15eeb3,_0x3673c3)['then'](function(_0x3176fa){return _0x595757(_0x3176fa);});default:return _0x5044ac(msgResponse(_0xaeba('0x1dd'),_0xaeba('0x145'),_0xaeba('0x1de')));}}else{return _0x5044ac(msgResponse(_0xaeba('0x1dd'),'Failure','check\x20failure'));}});};};Dialer[_0xaeba('0x17')][_0xaeba('0x1df')]=function(_0x43f7bc){var _0xd573ab=this;return function(_0x24ca04){return new BPromise(function(_0x137d32,_0x88fe96){_[_0xaeba('0xd1')](_0x43f7bc,_0x24ca04[0x0]);if(checkGetDataPredictive(_0x24ca04[0x0])){loggerPredictive[_0xaeba('0x7b')](JSON[_0xaeba('0x76')](_0x24ca04[0x0]));if(_0x43f7bc['dialPredictiveOptimization']===_0xaeba('0x1d0')){return _0xd573ab['getVoiceQueueRtPauses'](_0x43f7bc['id'])[_0xaeba('0x37')](function(_0x1fe576){var _0x5101fe=_0x43f7bc[_0xaeba('0x4b')]-_0x1fe576[0x0]['outboundQueuePauses'];var _0x2137e5=_0x43f7bc[_0xaeba('0x1ce')]*0x3c;var _0x32fdb5=_0x24ca04[0x0][_0xaeba('0x66')]+_0x24ca04[0x0][_0xaeba('0x81')];var _0x23be25=(_0x24ca04[0x0][_0xaeba('0x65')]+_0x24ca04[0x0][_0xaeba('0x68')]+_0x24ca04[0x0][_0xaeba('0x67')])/_0x24ca04[0x0][_0xaeba('0x6e')];var _0x4562f1=_0x43f7bc[_0xaeba('0x1c6')]/0x64;_0x43f7bc[_0xaeba('0x6d')]=_0x1fe576[0x0][_0xaeba('0x1e0')]||0x0;_0x43f7bc[_0xaeba('0x6b')]=_0x23be25>0x0?_0x23be25:0x1;return _0xd573ab[_0xaeba('0x1db')](_0x5101fe,_0x2137e5,_0x32fdb5,_0x23be25,_0x4562f1);})[_0xaeba('0x37')](function(_0xc60154){return _0x137d32(_0xc60154);})[_0xaeba('0xb8')](function(_0x5a91f8){return _0x88fe96(msgResponse(_0xaeba('0x1e1'),_0xaeba('0x145'),JSON[_0xaeba('0x76')](_0x5a91f8)));});}if(_0x43f7bc[_0xaeba('0x1cf')]===_0xaeba('0x1e2')){return _0xd573ab['getVoiceQueueRtPauses'](_0x43f7bc['id'])[_0xaeba('0x37')](function(_0x4116d2){var _0x2c303c=_0x43f7bc['loggedIn']-_0x4116d2[0x0]['outboundQueuePauses'];var _0x4212be=_0x43f7bc['dialPredictiveInterval']*0x3c;var _0xa6be7c=_0x24ca04[0x0][_0xaeba('0x66')]+_0x24ca04[0x0][_0xaeba('0x81')];var _0xe30e60=(_0x24ca04[0x0][_0xaeba('0x65')]+_0x24ca04[0x0][_0xaeba('0x68')]+_0x24ca04[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x24ca04[0x0]['predictiveIntervalTotalCalls'];var _0x3f5dc4=_0x43f7bc[_0xaeba('0x1c6')]/0x64;_0x43f7bc[_0xaeba('0x6d')]=_0x4116d2[0x0][_0xaeba('0x1e0')]||0x0;_0x43f7bc['predictiveIntervalHitRate']=_0xe30e60>0x0?_0xe30e60:0x1;return _0xd573ab[_0xaeba('0x1dc')](_0x2c303c,_0x4212be,_0xa6be7c,_0xe30e60,_0x3f5dc4);})[_0xaeba('0x37')](function(_0x1c6a81){return _0x137d32(_0x1c6a81);})['catch'](function(_0x3c67a8){return _0x88fe96(msgResponse('[CatchErlangB]',_0xaeba('0x145'),JSON[_0xaeba('0x76')](_0x3c67a8)));});}}else{return _0x88fe96(msgResponse(_0xaeba('0x1dd'),_0xaeba('0x145'),'check\x20failure'));}});};};Dialer[_0xaeba('0x17')]['startMethodPredictive']=function(_0x4b0088){var _0x2845df=this;return function(){var _0x1c3277=0x0;var _0x28b240=Math['floor'](_0x4b0088[_0xaeba('0x70')]*0x3e8);if(_0x28b240>0x0){_0x28b240=_0x28b240<0x64?0x64:_0x28b240;loggerPredictive[_0xaeba('0x7b')](_0x4b0088[_0xaeba('0x3b')],'one\x20call\x20every:',_0x28b240,_0xaeba('0x43'));_0x4b0088[_0xaeba('0x8e')]=setInterval(function(){_0x2845df[_0xaeba('0x8e')](_0x4b0088);loggerPredictiveCalls[_0xaeba('0x7b')]('[handlePredictive]',_0x1c3277+=0x1);},_0x28b240);}else{loggerPredictive[_0xaeba('0x7b')](_0x4b0088[_0xaeba('0x3b')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xaeba('0x17')]['checkContactBlack']=function(_0x342432,_0x19db98){var _0x1f82ca=this;return function(_0x4646b8){if(_[_0xaeba('0x40')](_0x4646b8)){if(_[_0xaeba('0xad')](_0x19db98[_0xaeba('0x1e3')])||!_0x19db98[_0xaeba('0x1e4')]){if(_0x342432[_0xaeba('0x158')]===_0xaeba('0x8')){_0x342432[_0xaeba('0x129')]=_[_0xaeba('0x84')](_0x342432[_0xaeba('0x129')])?!![]:_0x342432[_0xaeba('0x129')];var _0x52a22c=uuid['v4']();_0x1f82ca[_0xaeba('0xac')][_0x52a22c]=new Action(_0x342432,_0x19db98,_0x52a22c);loggerBooked[_0xaeba('0x7b')](_0xaeba('0x1e5'),_0x52a22c,'queueStatusComplete:\x20',JSON['stringify'](_0x342432[_0xaeba('0x129')]),_0xaeba('0x1e6'),_0x342432['name']);if(_0x342432[_0xaeba('0x129')]){_0x342432[_0xaeba('0x129')]=![];_0x1f82ca[_0xaeba('0x127')][_0x1f82ca[_0xaeba('0xac')][_0x52a22c][_0xaeba('0xb3')]]=[];ami['Action']({'actionid':_0x52a22c,'action':_0xaeba('0x1e7'),'queue':_0x342432['name']})[_0xaeba('0xb8')](function(){_0x1f82ca['updateOriginated'](_0x342432);_0x1f82ca[_0xaeba('0xc0')]({'active':![],'ContactId':_0x1f82ca[_0xaeba('0xac')][_0x52a22c][_0xaeba('0xd3')],'ListId':_0x1f82ca[_0xaeba('0xac')][_0x52a22c]['ListId'],'VoiceQueueId':_0x1f82ca[_0xaeba('0xac')][_0x52a22c][_0xaeba('0xd5')]||undefined,'CampaignId':_0x1f82ca[_0xaeba('0xac')][_0x52a22c][_0xaeba('0xfa')]||undefined})[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x1e8')));delete _0x1f82ca['actions'][_0x52a22c];});}else{loggerBooked[_0xaeba('0x7b')](_0xaeba('0x1e9'),JSON[_0xaeba('0x76')](_0x342432[_0xaeba('0x129')]),_0xaeba('0x1e6'),_0x342432['name']);_0x1f82ca[_0xaeba('0xb2')](_0x342432);_0x1f82ca[_0xaeba('0xc0')]({'active':![],'ContactId':_0x1f82ca['actions'][_0x52a22c][_0xaeba('0xd3')],'ListId':_0x1f82ca['actions'][_0x52a22c][_0xaeba('0xd4')],'VoiceQueueId':_0x1f82ca[_0xaeba('0xac')][_0x52a22c]['VoiceQueueId']||undefined,'CampaignId':_0x1f82ca[_0xaeba('0xac')][_0x52a22c][_0xaeba('0xfa')]||undefined})[_0xaeba('0xb8')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x1f82ca[_0xaeba('0xac')][_0x52a22c];}}else{return _0x1f82ca[_0xaeba('0x16f')](_0x342432,_0x19db98);}}else{if(getDiff(_0x19db98[_0xaeba('0x1ea')])<_0x342432[_0xaeba('0x1eb')]*0x3c){if(_0x19db98[_0xaeba('0x1ec')]&&!_0x19db98[_0xaeba('0x1ec')][_0xaeba('0x1ed')]){_0x1f82ca[_0xaeba('0x1b')][_0xaeba('0x12b')](_0x19db98['id'])['finally'](function(){_0x1f82ca['updateOriginated'](_0x342432);});}else{_0x1f82ca[_0xaeba('0xc2')]({'active':![]},_0x19db98['id'],0x1)['finally'](function(){_0x1f82ca[_0xaeba('0xb2')](_0x342432);});}}else{_0x342432[_0xaeba('0x63')]+=0x1;_0x1f82ca[_0xaeba('0xb2')](_0x342432);if(_0x342432[_0xaeba('0x1ee')]){_0x1f82ca['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x19db98[_0xaeba('0xd3')],'ListId':_0x19db98['ListId'],'VoiceQueueId':_0x19db98['VoiceQueueId']||undefined,'CampaignId':_0x19db98[_0xaeba('0xfa')]||undefined})[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x1ef')));_0x1f82ca[_0xaeba('0xca')](createObjHistory(_0x342432,_0x19db98,'RECALLINQUEUE',0x17,_0xaeba('0x1f0')))[_0xaeba('0xb8')](loggerCatch(_0xaeba('0x1f1')));}else{_0x1f82ca[_0xaeba('0xd0')](createObjHistory(_0x342432,_0x19db98,_0xaeba('0x1f2'),0x16,'RecallFailedTimeout'),_0xaeba('0x1f3'),_0xaeba('0x1f4'));}}}}else{_0x342432[_0xaeba('0x5b')]+=0x1;_0x1f82ca[_0xaeba('0xd0')](createObjHistory(_0x342432,_0x19db98,_0xaeba('0x1f5'),0xd,'Blacklist'),_0xaeba('0x1f6'),_0xaeba('0x1f7'));throw _0xaeba('0x1f8');}};};Dialer[_0xaeba('0x17')][_0xaeba('0x163')]=function(_0x2e9193){var _0xf0a561=this;var _0x15feeb=_0x2e9193['limitCalls']-_0x2e9193[_0xaeba('0x96')]-_0x2e9193[_0xaeba('0xc4')];emitCampaignSummary(_0x2e9193);if(_0x15feeb>0x0){if(_0x15feeb>this[_0xaeba('0x1f9')]){_0x15feeb=this['maxNumberOriginate'];}_0x2e9193[_0xaeba('0xc4')]+=_0x15feeb;this[_0xaeba('0xc6')](_0x2e9193['id'],_0x15feeb,_0x2e9193[_0xaeba('0x1fa')],_0x2e9193)[_0xaeba('0x37')](function(_0xf2d806){_0x2e9193['temp']-=_0x15feeb;_0x2e9193[_0xaeba('0xc4')]=_0x2e9193[_0xaeba('0xc4')]>0x0?_0x2e9193[_0xaeba('0xc4')]:0x0;if(!checkContactEmpty(_0xf2d806)){_0x2e9193[_0xaeba('0x39')]=_0xaeba('0x1fb');logger[_0xaeba('0x7b')](_0xaeba('0x1fc')+_0x2e9193[_0xaeba('0x3b')]);}else{_0x2e9193[_0xaeba('0x96')]+=_0xf2d806[_0xaeba('0x95')];_0x2e9193['message']=_0xaeba('0x1fd');for(var _0x34e3a1=0x0;_0x34e3a1<_0xf2d806[_0xaeba('0x95')];_0x34e3a1+=0x1){_0x2e9193['ivrTotalCallsDays']+=0x1;if(_[_0xaeba('0xad')](_0xf2d806[_0x34e3a1])||_[_0xaeba('0xad')](_0xf2d806[_0x34e3a1][_0xaeba('0x172')])||_[_0xaeba('0xad')](_0xf2d806[_0x34e3a1]['Contact'][_0xaeba('0x173')])){_0xf0a561[_0xaeba('0xce')]('[actionOriginate]\x20',_0x2e9193,_0xf2d806[_0x34e3a1]);}else{_0xf0a561[_0xaeba('0xbc')](_[_0xaeba('0xd2')](_0xf2d806[_0x34e3a1],[_0xaeba('0xfa'),'Contact.phone']))[_0xaeba('0x37')](_0xf0a561['checkContactBlack'](_0x2e9193,_0xf2d806[_0x34e3a1]))['catch'](_0xf0a561[_0xaeba('0xcd')](_0xaeba('0x1fe'),_0x2e9193));}}}})[_0xaeba('0xb8')](loggerGetContactDialer(_0xaeba('0x1ff'),_0x2e9193,_0x15feeb));}};Dialer['prototype'][_0xaeba('0x15a')]=function(_0x266671,_0x26f966){var _0x4b233f=this;var _0x50ff9e=[];var _0x540730=_0x26f966>=0x1?_0x26f966:0x1;if(_0x266671[_0xaeba('0x158')]===_0xaeba('0x8')){_0x540730=0x1;}var _0x2122a4=Math['floor'](_0x266671['available']*_0x540730)-_0x266671[_0xaeba('0x96')]-_0x266671[_0xaeba('0xc4')];emitVoiceQueueSummary(_0x266671);if(_0x266671[_0xaeba('0x200')]>0x0){var _0x266fb6=_0x266671['dialLimitQueue']-_0x266671['originated']-_0x266671['talking']-_0x266671[_0xaeba('0xc4')]-_0x266671[_0xaeba('0x4c')];if(_0x2122a4>_0x266fb6){_0x2122a4=_0x266fb6;}}if(_0x2122a4>0x0){if(_0x266671['dialMethod']===_0xaeba('0x8')){_0x2122a4=0x1;}if(_0x2122a4>this[_0xaeba('0x1f9')]){_0x2122a4=this['maxNumberOriginate'];}_0x266671[_0xaeba('0xc4')]+=_0x2122a4;for(var _0x10d754 in this['agents']){if(typeof this[_0xaeba('0x1e')][_0x10d754]!=='undefined'){if(this[_0xaeba('0x1e')][_0x10d754][_0xaeba('0xa6')]===_0xaeba('0x201')&&this[_0xaeba('0x1e')][_0x10d754][_0xaeba('0xaf')]===_0xaeba('0x202')){_0x50ff9e['push'](this[_0xaeba('0x1e')][_0x10d754]['id']);}}}this['getContactDialer'](_0x266671['id'],_0x50ff9e,_0x2122a4,_0x266671[_0xaeba('0x1fa')],_0x266671)[_0xaeba('0x37')](function(_0x3815eb){_0x266671[_0xaeba('0xc4')]-=_0x2122a4;_0x266671[_0xaeba('0xc4')]=_0x266671[_0xaeba('0xc4')]>0x0?_0x266671[_0xaeba('0xc4')]:0x0;if(!checkContactEmpty(_0x3815eb)){_0x4b233f[_0xaeba('0xb6')](_0x266671)[_0xaeba('0x37')](sendMessageReschedule(_0x266671))[_0xaeba('0xb8')](loggerCatch(_0xaeba('0xb9')));}else{_0x266671[_0xaeba('0x96')]+=_0x3815eb[_0xaeba('0x95')];_0x266671[_0xaeba('0x39')]=_0x266671[_0xaeba('0x158')]==='booked'?_0xaeba('0x179'):_0xaeba('0x1fd');for(var _0x1d724a=0x0;_0x1d724a<_0x3815eb[_0xaeba('0x95')];_0x1d724a+=0x1){if(_['isNil'](_0x3815eb[_0x1d724a])||_[_0xaeba('0xad')](_0x3815eb[_0x1d724a][_0xaeba('0x172')])||_['isNil'](_0x3815eb[_0x1d724a][_0xaeba('0x172')][_0xaeba('0x173')])){_0x4b233f[_0xaeba('0xce')](_0xaeba('0x203'),_0x266671,_0x3815eb[_0x1d724a]);}else{_0x4b233f[_0xaeba('0xba')](_[_0xaeba('0xd2')](_0x3815eb[_0x1d724a],[_0xaeba('0xd5'),_0xaeba('0x204')]))[_0xaeba('0x37')](_0x4b233f['checkContactBlack'](_0x266671,_0x3815eb[_0x1d724a]))[_0xaeba('0xb8')](_0x4b233f[_0xaeba('0xcd')](_0xaeba('0x203'),_0x266671));}}}})[_0xaeba('0xb8')](loggerGetContactDialer('[getContactDialer2]',_0x266671,_0x2122a4));}};Dialer[_0xaeba('0x17')][_0xaeba('0x8e')]=function(_0x3aedf5){if(_0x3aedf5[_0xaeba('0x200')]>0x0){var _0x4e1fe8=_0x3aedf5[_0xaeba('0x200')]-_0x3aedf5['originated']-_0x3aedf5[_0xaeba('0x50')];if(_0x4e1fe8>0x0){this['tryOriginatePredictive'](_0x3aedf5);}else{loggerPredictiveCalls[_0xaeba('0x7b')](_0xaeba('0x205'));}}else{this[_0xaeba('0x206')](_0x3aedf5);}};Dialer[_0xaeba('0x17')][_0xaeba('0x206')]=function(_0x54b249){var _0x358f2c=this;var _0x106055=[];_0x54b249[_0xaeba('0x96')]+=0x1;for(var _0x41e911 in this[_0xaeba('0x1e')]){if(typeof this[_0xaeba('0x1e')][_0x41e911]!==_0xaeba('0x97')){if(this[_0xaeba('0x1e')][_0x41e911][_0xaeba('0xa6')]==='not_inuse'&&this[_0xaeba('0x1e')][_0x41e911]['status']===_0xaeba('0x202')){_0x106055[_0xaeba('0x128')](this['agents'][_0x41e911]['id']);}}}this[_0xaeba('0xc3')](_0x54b249['id'],_0x106055,0x1,_0x54b249[_0xaeba('0x1fa')],_0x54b249)['then'](function(_0x4e3f29){if(!checkContactEmpty(_0x4e3f29)){checkContactLowerLimitOriginate(_0x54b249,0x1,0x0);_0x358f2c[_0xaeba('0xb6')](_0x54b249)[_0xaeba('0x37')](sendMessageReschedule(_0x54b249))[_0xaeba('0xb8')](loggerCatch(_0xaeba('0xb9')));}else{_0x54b249[_0xaeba('0x39')]=_0xaeba('0x1fd');if(_[_0xaeba('0xad')](_0x4e3f29[0x0])||_[_0xaeba('0xad')](_0x4e3f29[0x0][_0xaeba('0x172')])||_[_0xaeba('0xad')](_0x4e3f29[0x0][_0xaeba('0x172')][_0xaeba('0x173')])){_0x358f2c[_0xaeba('0xce')](_0xaeba('0x203'),_0x54b249,_0x4e3f29[0x0]);}else{_0x358f2c[_0xaeba('0xba')](_[_0xaeba('0xd2')](_0x4e3f29[0x0],[_0xaeba('0xd5'),_0xaeba('0x204')]))[_0xaeba('0x37')](_0x358f2c[_0xaeba('0x207')](_0x54b249,_0x4e3f29[0x0]))[_0xaeba('0xb8')](_0x358f2c[_0xaeba('0xcd')]('[actionOriginatePredictive]\x20',_0x54b249));}}})[_0xaeba('0xb8')](loggerGetContactDialer(_0xaeba('0x208'),_0x54b249,0x1));emitVoiceQueueSummary(_0x54b249);};Dialer[_0xaeba('0x17')][_0xaeba('0x1db')]=function(_0x30f003,_0x2764d6,_0x5ad30e,_0x5eac84,_0x38c0b0,_0x132fe8){loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x209'));loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x20a'),_0x30f003);loggerPredictive[_0xaeba('0x7b')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2764d6);loggerPredictive['info'](_0xaeba('0x20b'),_0x5ad30e);loggerPredictive['info'](_0xaeba('0x20c'),_0x5eac84);loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x20d'),_0x38c0b0);loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x83'));return new BPromise(function(_0x21d215,_0x193e37){if(_0x30f003<=0x0||isNaN(_0x30f003)){return _0x193e37(msgResponse(_0xaeba('0x20e'),'Error',_0xaeba('0x20f')+_0x30f003));}if(_0x5ad30e<=0x0||isNaN(_0x5ad30e)){return _0x193e37(msgResponse(_0xaeba('0x20e'),'Error',_0xaeba('0x210')+_0x5ad30e));}if(_0x5eac84<=0x0||isNaN(_0x5eac84)){return _0x193e37(msgResponse(_0xaeba('0x20e'),_0xaeba('0x42'),_0xaeba('0x211')+_0x5eac84));}if(_0x2764d6<=0x0||isNaN(_0x2764d6)){return _0x193e37(msgResponse('[abandonmentRate]','Error',_0xaeba('0x212')+_0x2764d6));}if(_0x38c0b0<=0x0||isNaN(_0x38c0b0)){return _0x193e37(msgResponse('[abandonmentRate]',_0xaeba('0x42'),_0xaeba('0x213')+_0x38c0b0));}_0x132fe8=_0x132fe8||0x0;var _0x4f61cf=0x1/_0x5ad30e;var _0x2098a3=0x0;var _0x3f1b7b=0x0;var _0x16a2b7=0x0;var _0x5f2808=0x0;for(var _0x49f6e9=0x0;_0x16a2b7<_0x38c0b0;_0x49f6e9+=0x1){_0x3f1b7b=_0x49f6e9/_0x2764d6;_0x2098a3=(_0x5eac84*_0x3f1b7b+_0x132fe8)/_0x4f61cf;_0x16a2b7=erlangb(_0x2098a3,_0x30f003);_0x5f2808=_0x2098a3/_0x30f003*(0x1-erlangb(_0x2098a3,_0x30f003));}return _0x21d215({'erlangCalls':_0x49f6e9,'erlangCallToSecond':_0x2764d6/_0x49f6e9,'erlangAbandonmentRate':_0x16a2b7,'erlangBusyFactor':_0x5f2808});});};Dialer[_0xaeba('0x17')]['busyFactor']=function(_0x5a1996,_0x53e76e,_0x2324be,_0x486a42,_0x32a7d4,_0x24ac46){loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x214'));loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x20a'),_0x5a1996);loggerPredictive[_0xaeba('0x7b')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x53e76e);loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x20b'),_0x2324be);loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x20c'),_0x486a42);loggerPredictive[_0xaeba('0x7b')](_0xaeba('0x215'),_0x32a7d4);loggerPredictive['info'](_0xaeba('0x83'));return new BPromise(function(_0xe170aa,_0x23166c){if(_0x5a1996<=0x0||isNaN(_0x5a1996)){return _0x23166c(msgResponse(_0xaeba('0x216'),_0xaeba('0x42'),_0xaeba('0x20f')+_0x5a1996));}if(_0x2324be<=0x0||isNaN(_0x2324be)){return _0x23166c(msgResponse(_0xaeba('0x216'),_0xaeba('0x42'),'Ts\x20=\x20'+_0x2324be));}if(_0x486a42<=0x0||isNaN(_0x486a42)){return _0x23166c(msgResponse('[busyFactor]',_0xaeba('0x42'),'p\x20=\x20'+_0x486a42));}if(_0x53e76e<=0x0||isNaN(_0x53e76e)){return _0x23166c(msgResponse(_0xaeba('0x216'),_0xaeba('0x42'),'interval\x20=\x20'+_0x53e76e));}if(_0x32a7d4<=0x0||isNaN(_0x32a7d4)){return _0x23166c(msgResponse(_0xaeba('0x216'),'Error',_0xaeba('0x217')+_0x32a7d4));}_0x24ac46=_0x24ac46||0x0;var _0x4db519=0x1/_0x2324be;var _0x45c04c=0x0;var _0xbc1298=0x0;var _0x32e046=0x0;var _0x1da6aa=0x0;for(var _0x5e871e=0x0;_0x1da6aa<_0x32a7d4;_0x5e871e+=0x1){_0xbc1298=_0x5e871e/_0x53e76e;_0x45c04c=(_0x486a42*_0xbc1298+_0x24ac46)/_0x4db519;_0x32e046=erlangb(_0x45c04c,_0x5a1996);_0x1da6aa=_0x45c04c/_0x5a1996*(0x1-erlangb(_0x45c04c,_0x5a1996));}return _0xe170aa({'erlangCalls':_0x5e871e,'erlangCallToSecond':_0x53e76e/_0x5e871e,'erlangAbandonmentRate':_0x32e046,'erlangBusyFactor':_0x1da6aa});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 2511778..0ae197d 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7c8d=['uniqueid','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x36d04d,_0x469817){var _0x213b48=function(_0x407b54){while(--_0x407b54){_0x36d04d['push'](_0x36d04d['shift']());}};_0x213b48(++_0x469817);}(_0x7c8d,0x115));var _0xd7c8=function(_0x1e8eea,_0x19d696){_0x1e8eea=_0x1e8eea-0x0;var _0x535b7c=_0x7c8d[_0x1e8eea];return _0x535b7c;};'use strict';var util=require(_0xd7c8('0x0'));var _=require(_0xd7c8('0x1'));var moment=require(_0xd7c8('0x2'));function getSeconds(_0x3b4c35,_0x4e1bde){var _0x26076d=moment(_0x3b4c35)[_0xd7c8('0x3')](0x0);var _0x23b70c=moment(_0x4e1bde)[_0xd7c8('0x3')](0x0);return _0x26076d['diff'](_0x23b70c,_0xd7c8('0x4'));}function QueueCallerAbandon(_0x5667d4,_0x3c0e66){this['scheduledat']=_0x5667d4[_0xd7c8('0x5')];this[_0xd7c8('0x6')]=_0x5667d4[_0xd7c8('0x6')];this['campaigntype']=_0x5667d4['type']===_0xd7c8('0x7')?_0xd7c8('0x8'):_0x5667d4[_0xd7c8('0x6')];this['countbusyretry']=_0x5667d4[_0xd7c8('0x9')];this['countcongestionretry']=_0x5667d4[_0xd7c8('0xa')];this['countnoanswerretry']=_0x5667d4[_0xd7c8('0xb')];this['countglobal']=_0x5667d4[_0xd7c8('0x9')]+_0x5667d4[_0xd7c8('0xa')]+_0x5667d4[_0xd7c8('0xb')]+_0x5667d4[_0xd7c8('0xc')]+_0x5667d4[_0xd7c8('0xd')]+_0x5667d4[_0xd7c8('0xe')]+_0x5667d4[_0xd7c8('0xf')]+_0x5667d4[_0xd7c8('0x10')];this[_0xd7c8('0xc')]=_0x5667d4[_0xd7c8('0xc')];this['countdropretry']=_0x5667d4[_0xd7c8('0xd')];this[_0xd7c8('0xe')]=_0x5667d4[_0xd7c8('0xe')];this[_0xd7c8('0xf')]=_0x5667d4[_0xd7c8('0xf')];this['countagentrejectretry']=_0x5667d4['countagentrejectretry'];this[_0xd7c8('0x11')]=_0x3c0e66['uniqueid'];this['calleridname']=_0x5667d4[_0xd7c8('0x12')];this[_0xd7c8('0x13')]=_0x5667d4[_0xd7c8('0x14')];this[_0xd7c8('0x15')]=_0x5667d4[_0xd7c8('0x15')];this[_0xd7c8('0x16')]=_0x5667d4[_0xd7c8('0x16')];this['droptime']=_0x5667d4[_0xd7c8('0x17')];this[_0xd7c8('0x18')]=this[_0xd7c8('0x17')];this[_0xd7c8('0x19')]=getSeconds(_0x5667d4['responsetime'],_0x5667d4[_0xd7c8('0x15')]);this[_0xd7c8('0x1a')]=getSeconds(this[_0xd7c8('0x17')],_0x5667d4['responsetime']);this[_0xd7c8('0x1b')]=0x0;this[_0xd7c8('0x8')]=_0x3c0e66[_0xd7c8('0x8')];this[_0xd7c8('0x1c')]=_0x3c0e66[_0xd7c8('0x1d')];this['reason']=_0x3c0e66[_0xd7c8('0x1e')];this[_0xd7c8('0x1f')]=_0x5667d4[_0xd7c8('0x1f')];this['callbackuniqueid']=_0x5667d4[_0xd7c8('0x20')];this['callbackat']=_0x5667d4['callbackat'];this['recallme']=_0x5667d4[_0xd7c8('0x21')];this[_0xd7c8('0x22')]=_0x5667d4[_0xd7c8('0x22')];this[_0xd7c8('0x23')]=_0x5667d4[_0xd7c8('0x23')];this[_0xd7c8('0x24')]=_0x5667d4[_0xd7c8('0x24')];this[_0xd7c8('0x25')]=_0x5667d4['VoiceQueueId'];this['CampaignId']=_0x5667d4[_0xd7c8('0x26')];this['originatecalleridnum']=_0x5667d4[_0xd7c8('0x27')]||'';this[_0xd7c8('0x28')]=_0x5667d4[_0xd7c8('0x28')]||'';}module[_0xd7c8('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0x4d43=['reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','responsetime','droptime','ringtime','holdtime','talktime','connectedlinename'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x4d43,0xce));var _0x34d4=function(_0xea1be7,_0x92c0ca){_0xea1be7=_0xea1be7-0x0;var _0x29a757=_0x4d43[_0xea1be7];return _0x29a757;};'use strict';var util=require(_0x34d4('0x0'));var _=require(_0x34d4('0x1'));var moment=require(_0x34d4('0x2'));function getSeconds(_0x17a102,_0x53cfc3){var _0x257248=moment(_0x17a102)[_0x34d4('0x3')](0x0);var _0x505a15=moment(_0x53cfc3)['milliseconds'](0x0);return _0x257248[_0x34d4('0x4')](_0x505a15,'seconds');}function QueueCallerAbandon(_0x59bb4f,_0x537156){this[_0x34d4('0x5')]=_0x59bb4f['scheduledat'];this[_0x34d4('0x6')]=_0x59bb4f['type'];this['campaigntype']=_0x59bb4f['type']===_0x34d4('0x7')?_0x34d4('0x8'):_0x59bb4f[_0x34d4('0x6')];this[_0x34d4('0x9')]=_0x59bb4f[_0x34d4('0x9')];this['countcongestionretry']=_0x59bb4f[_0x34d4('0xa')];this['countnoanswerretry']=_0x59bb4f[_0x34d4('0xb')];this[_0x34d4('0xc')]=_0x59bb4f[_0x34d4('0x9')]+_0x59bb4f[_0x34d4('0xa')]+_0x59bb4f['countnoanswerretry']+_0x59bb4f[_0x34d4('0xd')]+_0x59bb4f[_0x34d4('0xe')]+_0x59bb4f[_0x34d4('0xf')]+_0x59bb4f[_0x34d4('0x10')]+_0x59bb4f[_0x34d4('0x11')];this['countnosuchnumberretry']=_0x59bb4f[_0x34d4('0xd')];this['countdropretry']=_0x59bb4f[_0x34d4('0xe')];this['countabandonedretry']=_0x59bb4f[_0x34d4('0xf')];this[_0x34d4('0x10')]=_0x59bb4f[_0x34d4('0x10')];this['countagentrejectretry']=_0x59bb4f['countagentrejectretry'];this[_0x34d4('0x12')]=_0x537156[_0x34d4('0x12')];this[_0x34d4('0x13')]=_0x59bb4f[_0x34d4('0x14')];this['calleridnum']=_0x59bb4f[_0x34d4('0x15')];this['starttime']=_0x59bb4f['starttime'];this[_0x34d4('0x16')]=_0x59bb4f['responsetime'];this[_0x34d4('0x17')]=_0x59bb4f[_0x34d4('0x17')];this['endtime']=this['droptime'];this[_0x34d4('0x18')]=getSeconds(_0x59bb4f[_0x34d4('0x16')],_0x59bb4f['starttime']);this[_0x34d4('0x19')]=getSeconds(this[_0x34d4('0x17')],_0x59bb4f[_0x34d4('0x16')]);this[_0x34d4('0x1a')]=0x0;this['queue']=_0x537156[_0x34d4('0x8')];this['membername']=_0x537156[_0x34d4('0x1b')];this[_0x34d4('0x1c')]=_0x537156['reason'];this['callback']=_0x59bb4f['callback'];this[_0x34d4('0x1d')]=_0x59bb4f[_0x34d4('0x1d')];this['callbackat']=_0x59bb4f[_0x34d4('0x1e')];this['recallme']=_0x59bb4f[_0x34d4('0x1f')];this[_0x34d4('0x20')]=_0x59bb4f[_0x34d4('0x20')];this[_0x34d4('0x21')]=_0x59bb4f['ListId'];this[_0x34d4('0x22')]=_0x59bb4f[_0x34d4('0x22')];this[_0x34d4('0x23')]=_0x59bb4f['VoiceQueueId'];this[_0x34d4('0x24')]=_0x59bb4f[_0x34d4('0x24')];this['originatecalleridnum']=_0x59bb4f[_0x34d4('0x25')]||'';this[_0x34d4('0x26')]=_0x59bb4f['originatecalleridname']||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 4d051c2..fab34af 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(_0x5d8298,_0x1b78d9){var _0x554959=function(_0x3187e1){while(--_0x3187e1){_0x5d8298['push'](_0x5d8298['shift']());}};_0x554959(++_0x1b78d9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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(_0x1e02c1,_0x576272){var _0x5e37ad=function(_0x2c5d99){while(--_0x2c5d99){_0x1e02c1['push'](_0x1e02c1['shift']());}};_0x5e37ad(++_0x576272);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 32c6e1a..c5c971d 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 _0x065e=['variable','channelstate','channelstatedesc','syncNewExten','value','operation','status','localstationid','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','then','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate2]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','moment','path','tiff2pdf','fax','../ami','./channel','./util/util','./action','../rpc/attachment','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','from-voip-provider','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype'];(function(_0x169369,_0x3c2de1){var _0x1cef7e=function(_0x3dcb5d){while(--_0x3dcb5d){_0x169369['push'](_0x169369['shift']());}};_0x1cef7e(++_0x3c2de1);}(_0x065e,0x1a7));var _0xe065=function(_0x5e01ba,_0x316153){_0x5e01ba=_0x5e01ba-0x0;var _0x553736=_0x065e[_0x5e01ba];return _0x553736;};'use strict';var util=require(_0xe065('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0xe065('0x1'));var path=require(_0xe065('0x2'));var tiff2pdf=require(_0xe065('0x3'));var gs=require('./util/gs');var logger=require('../../../config/logger')(_0xe065('0x4'));var ami=require(_0xe065('0x5'));var rpcDb=require('./rpcDb');var Channel=require(_0xe065('0x6'));var ut=require(_0xe065('0x7'));var Action=require(_0xe065('0x8'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xe065('0x9'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x273e22){this[_0xe065('0xa')]={};this[_0xe065('0xb')]=_0x273e22[_0xe065('0xb')];this[_0xe065('0xc')]=_0x273e22['trunks'];this[_0xe065('0xd')]={};ami['on'](_0xe065('0xe'),this[_0xe065('0xf')][_0xe065('0x10')](this));ami['on'](_0xe065('0x11'),this[_0xe065('0x12')]['bind'](this));ami['on']('newstate',this[_0xe065('0x13')][_0xe065('0x10')](this));ami['on'](_0xe065('0x14'),this['syncNewExten'][_0xe065('0x10')](this));ami['on'](_0xe065('0x15'),this[_0xe065('0x16')][_0xe065('0x10')](this));ami['on'](_0xe065('0x17'),this['syncReceiveFax'][_0xe065('0x10')](this));ami['on'](_0xe065('0x18'),this[_0xe065('0x19')][_0xe065('0x10')](this));ami['on'](_0xe065('0x1a'),this[_0xe065('0x1b')][_0xe065('0x10')](this));}Fax['prototype'][_0xe065('0xf')]=function(_0xe48f8c){if(_0xe48f8c['context']===_0xe065('0x1c')){for(var _0x1d2f7a in this[_0xe065('0xb')]){if(this[_0xe065('0xb')][_0xe065('0x1d')](_0x1d2f7a)){if(_0xe48f8c[_0xe065('0x1e')]===this[_0xe065('0xb')][_0x1d2f7a]['localstationid']){this[_0xe065('0xa')][_0xe48f8c['uniqueid']]={};this[_0xe065('0xa')][_0xe48f8c[_0xe065('0x1f')]]['channel']=_0xe48f8c[_0xe065('0x20')];this['channels'][_0xe48f8c[_0xe065('0x1f')]]['id']=this[_0xe065('0xb')][_0x1d2f7a]['id'];this[_0xe065('0xa')][_0xe48f8c[_0xe065('0x1f')]][_0xe065('0x21')]=this[_0xe065('0xb')][_0x1d2f7a][_0xe065('0x21')];logger[_0xe065('0x22')](_0xe48f8c[_0xe065('0x1f')],'\x20syncNewchannel\x20');}}}}if(this[_0xe065('0xd')][_0xe48f8c[_0xe065('0x1f')]]){this[_0xe065('0xa')][_0xe48f8c[_0xe065('0x1f')]]={};this['channels'][_0xe48f8c['uniqueid']][_0xe065('0x20')]=_0xe48f8c['channel'];logger[_0xe065('0x22')](_0xe48f8c[_0xe065('0x1f')],_0xe065('0x23'));}};Fax[_0xe065('0x24')][_0xe065('0x12')]=function(_0x3ec154){if(this[_0xe065('0xa')][_0x3ec154[_0xe065('0x1f')]]){for(var _0x52cd9c in _0x3ec154['variable']){if(_0x3ec154[_0xe065('0x25')][_0xe065('0x1d')](_0x52cd9c)){this[_0xe065('0xa')][_0x3ec154[_0xe065('0x1f')]][_0x52cd9c]=_0x3ec154['value'];}}}};Fax[_0xe065('0x24')]['syncNewState']=function(_0x522420){if(this[_0xe065('0xa')][_0x522420[_0xe065('0x1f')]]){this[_0xe065('0xa')][_0x522420['uniqueid']][_0xe065('0x26')]=_0x522420['channelstate'];this[_0xe065('0xa')][_0x522420[_0xe065('0x1f')]][_0xe065('0x27')]=_0x522420[_0xe065('0x27')];}};Fax['prototype'][_0xe065('0x28')]=function(_0x4940cf){if(this[_0xe065('0xa')][_0x4940cf[_0xe065('0x1f')]]){for(var _0x5d0864 in _0x4940cf[_0xe065('0x25')]){if(_0x4940cf['variable'][_0xe065('0x1d')](_0x5d0864)){this['channels'][_0x4940cf[_0xe065('0x1f')]][_0x5d0864]=_0x4940cf[_0xe065('0x29')];}}}};Fax[_0xe065('0x24')][_0xe065('0x16')]=function(_0x5c5401){if(this[_0xe065('0xa')][_0x5c5401[_0xe065('0x1f')]]){this[_0xe065('0xa')][_0x5c5401[_0xe065('0x1f')]][_0xe065('0x2a')]=_0x5c5401[_0xe065('0x2a')];this['channels'][_0x5c5401[_0xe065('0x1f')]][_0xe065('0x2b')]=_0x5c5401['status'];this[_0xe065('0xa')][_0x5c5401[_0xe065('0x1f')]][_0xe065('0x2c')]=_0x5c5401[_0xe065('0x2c')];this[_0xe065('0xa')][_0x5c5401[_0xe065('0x1f')]][_0xe065('0x2d')]=_0x5c5401['filename'];logger[_0xe065('0x22')](_0x5c5401['uniqueid'],_0xe065('0x2e'));}};Fax[_0xe065('0x24')][_0xe065('0x2f')]=function(_0xcceb12){var _0x45fe3f=this;if(this[_0xe065('0xa')][_0xcceb12['uniqueid']]){var _0x402d74=this[_0xe065('0xa')][_0xcceb12[_0xe065('0x1f')]]['id'];this['channels'][_0xcceb12[_0xe065('0x1f')]][_0xe065('0x30')]=_0xcceb12[_0xe065('0x30')];this[_0xe065('0xa')][_0xcceb12[_0xe065('0x1f')]]['pagestransferred']=_0xcceb12[_0xe065('0x31')];this[_0xe065('0xa')][_0xcceb12['uniqueid']][_0xe065('0x2c')]=_0xcceb12['localstationid'];this[_0xe065('0xa')][_0xcceb12[_0xe065('0x1f')]]['resolution']=_0xcceb12[_0xe065('0x32')];this[_0xe065('0xa')][_0xcceb12['uniqueid']][_0xe065('0x33')]=_0xcceb12[_0xe065('0x33')];this[_0xe065('0xa')][_0xcceb12[_0xe065('0x1f')]][_0xe065('0x2d')]=_0xcceb12[_0xe065('0x2d')];this[_0xe065('0xa')][_0xcceb12[_0xe065('0x1f')]][_0xe065('0x34')]=_0xcceb12[_0xe065('0x34')];if(this[_0xe065('0xa')][_0xcceb12[_0xe065('0x1f')]][_0xe065('0x31')]>0x0){tiff2pdf(_0xcceb12['filename'],'/var/opt/motion2/server/files/attachments/',function(_0xfcb0d0){logger[_0xe065('0x22')](_0xcceb12['uniqueid'],_0xe065('0x35'),_0xfcb0d0[_0xe065('0x36')]);attachment[_0xe065('0x37')]({'name':path[_0xe065('0x38')](_0xcceb12[_0xe065('0x2d')])[_0xe065('0x21')],'basename':path[_0xe065('0x38')](_0xcceb12[_0xe065('0x2d')])[_0xe065('0x21')]+'.pdf','type':_0xe065('0x39')})[_0xe065('0x3a')](function(_0x299f96){faxAccount['notify'](_0x402d74,{'from':_0xcceb12[_0xe065('0x34')],'mapKey':_0xe065('0x4'),'body':path[_0xe065('0x38')](_0xcceb12[_0xe065('0x2d')])['name']+_0xe065('0x3b'),'AttachmentId':_0x299f96['id']})[_0xe065('0x3c')](function(_0x1d9ecc){logger[_0xe065('0x3d')](_0xcceb12[_0xe065('0x1f')],_0xe065('0x3e'),JSON[_0xe065('0x3f')](_0x1d9ecc));});})['catch'](function(_0x3a2900){logger[_0xe065('0x3d')](_0xcceb12[_0xe065('0x1f')],_0xe065('0x40'),JSON[_0xe065('0x3f')](_0x3a2900));});});}logger[_0xe065('0x22')](_0xcceb12[_0xe065('0x1f')],'\x20receiveFax\x20');}};Fax[_0xe065('0x24')]['syncOriginateResponse']=function(_0x45fe1f){if(this[_0xe065('0xd')][_0x45fe1f[_0xe065('0x1f')]]){_['merge'](this[_0xe065('0xa')][_0x45fe1f[_0xe065('0x1f')]],_[_0xe065('0x41')](_0x45fe1f,[_0xe065('0x42'),_0xe065('0x43')]));}};function updateStatus(_0x6953e0){if(_0x6953e0[_0xe065('0x44')]){faxMessage[_0xe065('0x45')](_0x6953e0[_0xe065('0x44')],{'failMessage':_0xe065('0x46')})[_0xe065('0x3a')](function(_0x270cd5){ut[_0xe065('0x47')]('[Fax][Message][Error][Updated]',_0x270cd5);})['catch'](function(_0x584201){ut[_0xe065('0x47')]('[Fax][Message][Error][NoUpdate1]',_0x584201);});}else{ut[_0xe065('0x47')](_0xe065('0x48'));}}Fax[_0xe065('0x24')]['updateStatus']=function(_0x45a60e,_0x20272a,_0x5cce78){var _0x39f24b=this;var _0x366d4b={};if(_0x20272a){_0x366d4b={'read':_0x20272a};}else{_0x366d4b={'failMessage':_0x5cce78};}if(this[_0xe065('0xd')][_0x45a60e][_0xe065('0x44')]){faxMessage[_0xe065('0x45')](this[_0xe065('0xd')][_0x45a60e][_0xe065('0x44')],_0x366d4b)[_0xe065('0x3a')](function(_0x43480d){ut[_0xe065('0x47')]('[Fax][Message][Updated]',_0x43480d);})[_0xe065('0x3c')](function(_0x18eb92){ut[_0xe065('0x47')](_0xe065('0x49'),_0x18eb92);})['finally'](function(){delete _0x39f24b[_0xe065('0xa')][_0x45a60e];delete _0x39f24b[_0xe065('0xd')][_0x45a60e];});}else{ut[_0xe065('0x47')](_0xe065('0x4a'));delete this['channels'][_0x45a60e];delete this[_0xe065('0xd')][_0x45a60e];}};Fax[_0xe065('0x24')][_0xe065('0x19')]=function(_0x5320c6){var _0x6e3b3b=this;if(this[_0xe065('0xa')][_0x5320c6[_0xe065('0x1f')]]){if(this[_0xe065('0xd')][_0x5320c6[_0xe065('0x1f')]]){this[_0xe065('0xa')][_0x5320c6[_0xe065('0x1f')]]['id']=this[_0xe065('0xd')][_0x5320c6[_0xe065('0x1f')]]['id'];this['channels'][_0x5320c6[_0xe065('0x1f')]]['name']=this[_0xe065('0xd')][_0x5320c6[_0xe065('0x1f')]][_0xe065('0x21')];}logger['info'](_0x5320c6['uniqueid'],this['actions'][_0x5320c6[_0xe065('0x1f')]]?_0xe065('0x4b'):_0xe065('0x4c'),JSON[_0xe065('0x3f')](this[_0xe065('0xa')][_0x5320c6[_0xe065('0x1f')]]));if(this[_0xe065('0xd')][_0x5320c6[_0xe065('0x1f')]]){if(this[_0xe065('0xa')][_0x5320c6[_0xe065('0x1f')]][_0xe065('0x4d')]>0x0&&this['channels'][_0x5320c6['uniqueid']][_0xe065('0x15')]===_0xe065('0x4e')){this['updateStatus'](_0x5320c6[_0xe065('0x1f')],!![]);}else{this['updateStatus'](_0x5320c6['uniqueid'],![],this[_0xe065('0xa')][_0x5320c6[_0xe065('0x1f')]][_0xe065('0x4f')]?_0xe065('0x50')+this[_0xe065('0xa')][_0x5320c6[_0xe065('0x1f')]][_0xe065('0x4f')]:'SENDING\x20FAILED');}}}};Fax[_0xe065('0x24')][_0xe065('0x51')]=function(_0xaef095){var _0xb3591e=this;return new BPromise(function(_0x432def,_0x4f35a6){_0xb3591e[_0xe065('0x52')](_0xaef095,_0xb3591e[_0xe065('0xb')][_0xaef095[_0xe065('0x53')]])[_0xe065('0x3a')](function(_0x2968c5){ut[_0xe065('0x47')]('[Fax][execOriginate][success]',_0x2968c5);_0x432def(ut['message']('Fax\x20received'));})['catch'](function(_0x5c3d7a){ut[_0xe065('0x47')](_0xe065('0x54'),_0x5c3d7a);updateStatus(_0xaef095);_0x4f35a6(ut[_0xe065('0x36')](_0xe065('0x55')));});});};Fax[_0xe065('0x24')][_0xe065('0x56')]=function(_0x3290bd){var _0x4084a0=this;return new BPromise(function(_0x507fd2,_0x4c96d1){var _0x3c0805=_0x4084a0[_0xe065('0x57')](_0x4084a0[_0xe065('0xb')][_0x3290bd['FaxAccountId']][_0xe065('0x58')],_0x3290bd);if(_0x3c0805[_0xe065('0x59')]){_0x507fd2(ut[_0xe065('0x36')](_0xe065('0x5a')));}else{_0x4c96d1(ut[_0xe065('0x36')](_0x3c0805[_0xe065('0x36')]));}});};function originate(_0xac5395,_0x199ca3,_0x27863d){return new BPromise(function(_0xecef2,_0x213feb){if(_0x27863d){var _0x4493db=util[_0xe065('0x5b')](_0xe065('0x5c'),path[_0xe065('0x38')](_0xac5395[_0xe065('0x2')])[_0xe065('0x21')],_0xac5395[_0xe065('0x2')]);gs['execute'](_0x4493db)[_0xe065('0x3a')](function(){_0xac5395[_0xe065('0x2')]=util[_0xe065('0x5b')](_0xe065('0x5d'),path[_0xe065('0x38')](_0xac5395[_0xe065('0x2')])[_0xe065('0x5e')],path[_0xe065('0x38')](_0xac5395[_0xe065('0x2')])[_0xe065('0x21')]);_0x199ca3[_0xe065('0x5f')]=_0xac5395[_0xe065('0x2')];ut[_0xe065('0x47')](_0xe065('0x60'),'');ami[_0xe065('0x61')](ut[_0xe065('0x62')](_0xac5395,_0x199ca3))[_0xe065('0x3a')](function(_0x4f722a){_0xecef2(_0x4f722a);})[_0xe065('0x3c')](function(_0x185b5b){_0x213feb(_0x185b5b);});})[_0xe065('0x3c')](function(_0x1993e8){_0x213feb(_0x1993e8);});}else{ami[_0xe065('0x61')](ut[_0xe065('0x62')](_0xac5395,_0x199ca3))[_0xe065('0x3a')](function(_0x7554a0){_0xecef2(_0x7554a0);})[_0xe065('0x3c')](function(_0x3a9a23){_0x213feb(_0x3a9a23);});}});}Fax['prototype']['execOriginate']=function(_0x151fd6,_0x551f72){var _0x3705e3=this;return new BPromise(function(_0x4f3f9d,_0x1df721){var _0x162482=uuid['v4']();var _0x3757bb=ut[_0xe065('0x63')](_0x151fd6,_0x551f72);_0x3705e3[_0xe065('0xd')][_0x162482]=new Action(_0x162482,_0x551f72,_0x151fd6);var _0x3318d4=_0x3705e3[_0xe065('0xd')][_0x162482];if(path[_0xe065('0x38')](_0x151fd6[_0xe065('0x2')])['ext']===_0xe065('0x3b')){originate(_0x3318d4,_0x3757bb,!![])[_0xe065('0x3a')](function(_0x134d0a){_0x4f3f9d(_0x134d0a);})[_0xe065('0x3c')](function(_0x5858d9){_0x1df721(_0x5858d9);});}else{originate(_0x3318d4,_0x3757bb,![])[_0xe065('0x3a')](function(_0x2fdaae){_0x4f3f9d(_0x2fdaae);})[_0xe065('0x3c')](function(_0x4ff8d5){_0x1df721(_0x4ff8d5);});}});};Fax[_0xe065('0x24')][_0xe065('0x64')]=function(_0x3c024b){return!_['isNil'](_0x3c024b)&&!_[_0xe065('0x65')](_0x3c024b[_0xe065('0x21')])&&!_['isNil'](_0x3c024b['active'])&&_0x3c024b[_0xe065('0x66')]&&!_[_0xe065('0x65')](this[_0xe065('0xc')][util[_0xe065('0x5b')](_0xe065('0x67'),_0x3c024b['name'])])&&!_['isNil'](this[_0xe065('0xc')][util[_0xe065('0x5b')]('SIP/%s',_0x3c024b[_0xe065('0x21')])][_0xe065('0x2b')])&&(this[_0xe065('0xc')][util[_0xe065('0x5b')](_0xe065('0x67'),_0x3c024b[_0xe065('0x21')])][_0xe065('0x2b')]===_0xe065('0x68')||this[_0xe065('0xc')][util[_0xe065('0x5b')]('SIP/%s',_0x3c024b['name'])][_0xe065('0x2b')]===_0xe065('0x69'));};Fax[_0xe065('0x24')][_0xe065('0x57')]=function(_0x2c72fa,_0x4e79ab){if(!this[_0xe065('0x64')](_0x2c72fa)){ut[_0xe065('0x47')](_0xe065('0x6a'),_[_0xe065('0x65')](_0x2c72fa)?'':_0x2c72fa[_0xe065('0x21')]+_0xe065('0x6b'));return{'isValid':![],'message':_0xe065('0x6c')};}if(_[_0xe065('0x65')](_0x4e79ab[_0xe065('0x4')])){ut[_0xe065('0x47')](_0xe065('0x6d'),JSON['stringify'](_0x4e79ab));return{'isValid':![],'message':_0xe065('0x6e')};}if(_[_0xe065('0x65')](_0x4e79ab[_0xe065('0x2')])){ut[_0xe065('0x47')](_0xe065('0x6f'),JSON[_0xe065('0x3f')](_0x4e79ab));return{'isValid':![],'message':_0xe065('0x70')};}return{'isValid':!![],'message':_0xe065('0x71')};};module[_0xe065('0x72')]=Fax; \ No newline at end of file +var _0x7af2=['application/pdf','then','parse','catch','error','stringify','\x20receiveFax\x20','pick','AttachmentId','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','\x20hangup\x20sendFile\x20','SUCCESS','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','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','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','addVariables','ext','isTrunkReachable','isNil','active','format','SIP/%s','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','lodash','bluebird','uuid','moment','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','bind','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','syncNewchannel','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','syncVarSet','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','.pdf'];(function(_0x10161b,_0x525d72){var _0x3ba890=function(_0xd50f9d){while(--_0xd50f9d){_0x10161b['push'](_0x10161b['shift']());}};_0x3ba890(++_0x525d72);}(_0x7af2,0x119));var _0x27af=function(_0x4034c2,_0x3253e5){_0x4034c2=_0x4034c2-0x0;var _0x1cc244=_0x7af2[_0x4034c2];return _0x1cc244;};'use strict';var util=require('util');var _=require(_0x27af('0x0'));var BPromise=require(_0x27af('0x1'));var uuid=require(_0x27af('0x2'));var moment=require(_0x27af('0x3'));var path=require('path');var tiff2pdf=require(_0x27af('0x4'));var gs=require(_0x27af('0x5'));var logger=require(_0x27af('0x6'))(_0x27af('0x7'));var ami=require(_0x27af('0x8'));var rpcDb=require(_0x27af('0x9'));var Channel=require(_0x27af('0xa'));var ut=require(_0x27af('0xb'));var Action=require(_0x27af('0xc'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x27af('0xd'));var faxMessage=require(_0x27af('0xe'));function Fax(_0x389e97){this['channels']={};this[_0x27af('0xf')]=_0x389e97[_0x27af('0xf')];this[_0x27af('0x10')]=_0x389e97['trunks'];this[_0x27af('0x11')]={};ami['on']('newchannel',this['syncNewchannel'][_0x27af('0x12')](this));ami['on']('varset',this['syncVarSet'][_0x27af('0x12')](this));ami['on']('newstate',this[_0x27af('0x13')]['bind'](this));ami['on'](_0x27af('0x14'),this[_0x27af('0x15')][_0x27af('0x12')](this));ami['on'](_0x27af('0x16'),this[_0x27af('0x17')][_0x27af('0x12')](this));ami['on'](_0x27af('0x18'),this[_0x27af('0x19')][_0x27af('0x12')](this));ami['on'](_0x27af('0x1a'),this[_0x27af('0x1b')][_0x27af('0x12')](this));ami['on'](_0x27af('0x1c'),this[_0x27af('0x1d')][_0x27af('0x12')](this));}Fax[_0x27af('0x1e')][_0x27af('0x1f')]=function(_0xbcf794){if(_0xbcf794['context']===_0x27af('0x20')){for(var _0x31d702 in this['faxAccounts']){if(this['faxAccounts'][_0x27af('0x21')](_0x31d702)){if(_0xbcf794[_0x27af('0x22')]===this[_0x27af('0xf')][_0x31d702][_0x27af('0x23')]){this[_0x27af('0x24')][_0xbcf794['uniqueid']]={};this[_0x27af('0x24')][_0xbcf794[_0x27af('0x25')]][_0x27af('0x26')]=_0xbcf794['channel'];this[_0x27af('0x24')][_0xbcf794[_0x27af('0x25')]]['id']=this[_0x27af('0xf')][_0x31d702]['id'];this['channels'][_0xbcf794[_0x27af('0x25')]][_0x27af('0x27')]=this[_0x27af('0xf')][_0x31d702][_0x27af('0x27')];logger[_0x27af('0x28')](_0xbcf794[_0x27af('0x25')],_0x27af('0x29'));}}}}if(this[_0x27af('0x11')][_0xbcf794[_0x27af('0x25')]]){this['channels'][_0xbcf794['uniqueid']]={};this['channels'][_0xbcf794[_0x27af('0x25')]]['channel']=_0xbcf794[_0x27af('0x26')];logger[_0x27af('0x28')](_0xbcf794['uniqueid'],_0x27af('0x29'));}};Fax[_0x27af('0x1e')][_0x27af('0x2a')]=function(_0x424490){if(this[_0x27af('0x24')][_0x424490[_0x27af('0x25')]]){for(var _0x775d4e in _0x424490['variable']){if(_0x424490[_0x27af('0x2b')][_0x27af('0x21')](_0x775d4e)){this[_0x27af('0x24')][_0x424490[_0x27af('0x25')]][_0x775d4e]=_0x424490[_0x27af('0x2c')];}}}};Fax[_0x27af('0x1e')][_0x27af('0x13')]=function(_0x2b26ac){if(this[_0x27af('0x24')][_0x2b26ac[_0x27af('0x25')]]){this[_0x27af('0x24')][_0x2b26ac['uniqueid']][_0x27af('0x2d')]=_0x2b26ac[_0x27af('0x2d')];this[_0x27af('0x24')][_0x2b26ac[_0x27af('0x25')]][_0x27af('0x2e')]=_0x2b26ac[_0x27af('0x2e')];}};Fax['prototype']['syncNewExten']=function(_0x214791){if(this[_0x27af('0x24')][_0x214791['uniqueid']]){for(var _0x24e7e9 in _0x214791[_0x27af('0x2b')]){if(_0x214791[_0x27af('0x2b')][_0x27af('0x21')](_0x24e7e9)){this[_0x27af('0x24')][_0x214791[_0x27af('0x25')]][_0x24e7e9]=_0x214791[_0x27af('0x2c')];}}}};Fax[_0x27af('0x1e')][_0x27af('0x17')]=function(_0x425ac1){if(this[_0x27af('0x24')][_0x425ac1['uniqueid']]){this['channels'][_0x425ac1[_0x27af('0x25')]][_0x27af('0x2f')]=_0x425ac1['operation'];this[_0x27af('0x24')][_0x425ac1[_0x27af('0x25')]]['status']=_0x425ac1[_0x27af('0x30')];this[_0x27af('0x24')][_0x425ac1[_0x27af('0x25')]][_0x27af('0x23')]=_0x425ac1[_0x27af('0x23')];this['channels'][_0x425ac1[_0x27af('0x25')]][_0x27af('0x31')]=_0x425ac1['filename'];logger['info'](_0x425ac1[_0x27af('0x25')],_0x27af('0x32'));}};Fax[_0x27af('0x1e')][_0x27af('0x19')]=function(_0x467891){var _0xd58131=this;if(this['channels'][_0x467891[_0x27af('0x25')]]){var _0x506474=this[_0x27af('0x24')][_0x467891[_0x27af('0x25')]]['id'];this[_0x27af('0x24')][_0x467891[_0x27af('0x25')]][_0x27af('0x33')]=_0x467891['remotestationid'];this[_0x27af('0x24')][_0x467891[_0x27af('0x25')]][_0x27af('0x34')]=_0x467891[_0x27af('0x34')];this[_0x27af('0x24')][_0x467891[_0x27af('0x25')]][_0x27af('0x23')]=_0x467891[_0x27af('0x23')];this[_0x27af('0x24')][_0x467891[_0x27af('0x25')]][_0x27af('0x35')]=_0x467891[_0x27af('0x35')];this[_0x27af('0x24')][_0x467891[_0x27af('0x25')]]['transferrate']=_0x467891[_0x27af('0x36')];this[_0x27af('0x24')][_0x467891[_0x27af('0x25')]][_0x27af('0x31')]=_0x467891['filename'];this[_0x27af('0x24')][_0x467891['uniqueid']]['calleridnum']=_0x467891[_0x27af('0x37')];if(this[_0x27af('0x24')][_0x467891[_0x27af('0x25')]][_0x27af('0x34')]>0x0){tiff2pdf(_0x467891[_0x27af('0x31')],_0x27af('0x38'),function(_0x28b953){logger[_0x27af('0x28')](_0x467891[_0x27af('0x25')],_0x27af('0x39'),_0x28b953[_0x27af('0x3a')]);attachment[_0x27af('0x3b')]({'name':path['parse'](_0x467891[_0x27af('0x31')])[_0x27af('0x27')],'basename':path['parse'](_0x467891['filename'])[_0x27af('0x27')]+_0x27af('0x3c'),'type':_0x27af('0x3d')})[_0x27af('0x3e')](function(_0x1bd775){faxAccount['notify'](_0x506474,{'from':_0x467891[_0x27af('0x37')],'mapKey':'fax','body':path[_0x27af('0x3f')](_0x467891[_0x27af('0x31')])[_0x27af('0x27')]+_0x27af('0x3c'),'AttachmentId':_0x1bd775['id']})[_0x27af('0x40')](function(_0x3fd6ef){logger[_0x27af('0x41')](_0x467891['uniqueid'],'\x20notify\x20',JSON[_0x27af('0x42')](_0x3fd6ef));});})['catch'](function(_0xffeb6){logger[_0x27af('0x41')](_0x467891[_0x27af('0x25')],_0x27af('0x43'),JSON[_0x27af('0x42')](_0xffeb6));});});}logger[_0x27af('0x28')](_0x467891[_0x27af('0x25')],'\x20receiveFax\x20');}};Fax[_0x27af('0x1e')][_0x27af('0x1d')]=function(_0x20e180){if(this[_0x27af('0x11')][_0x20e180[_0x27af('0x25')]]){_['merge'](this[_0x27af('0x24')][_0x20e180[_0x27af('0x25')]],_[_0x27af('0x44')](_0x20e180,['response','reason']));}};function updateStatus(_0x3c0a03){if(_0x3c0a03[_0x27af('0x45')]){faxMessage[_0x27af('0x46')](_0x3c0a03['AttachmentId'],{'failMessage':'SENDING\x20FAILED\x20'})[_0x27af('0x3e')](function(_0x5278cd){ut[_0x27af('0x47')](_0x27af('0x48'),_0x5278cd);})[_0x27af('0x40')](function(_0x290f4f){ut[_0x27af('0x47')](_0x27af('0x49'),_0x290f4f);});}else{ut[_0x27af('0x47')](_0x27af('0x4a'));}}Fax[_0x27af('0x1e')][_0x27af('0x4b')]=function(_0x23369a,_0x5c02c1,_0x76ed78){var _0x2ee44a=this;var _0x3f1b20={};if(_0x5c02c1){_0x3f1b20={'read':_0x5c02c1};}else{_0x3f1b20={'failMessage':_0x76ed78};}if(this[_0x27af('0x11')][_0x23369a][_0x27af('0x45')]){faxMessage[_0x27af('0x46')](this[_0x27af('0x11')][_0x23369a][_0x27af('0x45')],_0x3f1b20)['then'](function(_0x2e7b34){ut['logger'](_0x27af('0x4c'),_0x2e7b34);})[_0x27af('0x40')](function(_0x42b6a2){ut['logger'](_0x27af('0x4d'),_0x42b6a2);})['finally'](function(){delete _0x2ee44a[_0x27af('0x24')][_0x23369a];delete _0x2ee44a[_0x27af('0x11')][_0x23369a];});}else{ut[_0x27af('0x47')]('[Fax][Message][NoUpdate2]');delete this[_0x27af('0x24')][_0x23369a];delete this['actions'][_0x23369a];}};Fax[_0x27af('0x1e')]['syncHangup']=function(_0x477251){var _0x3eea7b=this;if(this[_0x27af('0x24')][_0x477251['uniqueid']]){if(this['actions'][_0x477251[_0x27af('0x25')]]){this[_0x27af('0x24')][_0x477251[_0x27af('0x25')]]['id']=this[_0x27af('0x11')][_0x477251['uniqueid']]['id'];this[_0x27af('0x24')][_0x477251[_0x27af('0x25')]][_0x27af('0x27')]=this[_0x27af('0x11')][_0x477251[_0x27af('0x25')]][_0x27af('0x27')];}logger['info'](_0x477251[_0x27af('0x25')],this[_0x27af('0x11')][_0x477251[_0x27af('0x25')]]?_0x27af('0x4e'):'\x20hangup\x20faxRiceive\x20',JSON[_0x27af('0x42')](this['channels'][_0x477251[_0x27af('0x25')]]));if(this[_0x27af('0x11')][_0x477251['uniqueid']]){if(this[_0x27af('0x24')][_0x477251[_0x27af('0x25')]]['faxpages']>0x0&&this['channels'][_0x477251[_0x27af('0x25')]][_0x27af('0x16')]===_0x27af('0x4f')){this['updateStatus'](_0x477251[_0x27af('0x25')],!![]);}else{this[_0x27af('0x4b')](_0x477251['uniqueid'],![],this[_0x27af('0x24')][_0x477251[_0x27af('0x25')]]['faxstatusstring']?'SENDING\x20FAILED:\x20'+this[_0x27af('0x24')][_0x477251[_0x27af('0x25')]]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax[_0x27af('0x1e')][_0x27af('0x50')]=function(_0x2a8534){var _0x266220=this;return new BPromise(function(_0x15103e,_0x3515ee){_0x266220[_0x27af('0x51')](_0x2a8534,_0x266220['faxAccounts'][_0x2a8534['FaxAccountId']])[_0x27af('0x3e')](function(_0x402654){ut[_0x27af('0x47')](_0x27af('0x52'),_0x402654);_0x15103e(ut[_0x27af('0x3a')](_0x27af('0x53')));})[_0x27af('0x40')](function(_0x2b86b3){ut[_0x27af('0x47')](_0x27af('0x54'),_0x2b86b3);updateStatus(_0x2a8534);_0x3515ee(ut[_0x27af('0x3a')](_0x27af('0x55')));});});};Fax[_0x27af('0x1e')][_0x27af('0x56')]=function(_0x3bfd28){var _0x4932b8=this;return new BPromise(function(_0x4601e9,_0x4eb01f){var _0x3379a9=_0x4932b8[_0x27af('0x57')](_0x4932b8['faxAccounts'][_0x3bfd28[_0x27af('0x58')]][_0x27af('0x59')],_0x3bfd28);if(_0x3379a9[_0x27af('0x5a')]){_0x4601e9(ut[_0x27af('0x3a')](_0x27af('0x5b')));}else{_0x4eb01f(ut[_0x27af('0x3a')](_0x3379a9['message']));}});};function originate(_0x132ed4,_0x31a595,_0x3a2958){return new BPromise(function(_0x4ab463,_0x5d7af4){if(_0x3a2958){var _0xf3ac96=util['format'](_0x27af('0x5c'),path[_0x27af('0x3f')](_0x132ed4[_0x27af('0x5d')])[_0x27af('0x27')],_0x132ed4[_0x27af('0x5d')]);gs['execute'](_0xf3ac96)[_0x27af('0x3e')](function(){_0x132ed4[_0x27af('0x5d')]=util['format'](_0x27af('0x5e'),path[_0x27af('0x3f')](_0x132ed4['path'])['dir'],path[_0x27af('0x3f')](_0x132ed4[_0x27af('0x5d')])[_0x27af('0x27')]);_0x31a595[_0x27af('0x5f')]=_0x132ed4[_0x27af('0x5d')];ut[_0x27af('0x47')](_0x27af('0x60'),'');ami['Action'](ut[_0x27af('0x61')](_0x132ed4,_0x31a595))[_0x27af('0x3e')](function(_0x19067d){_0x4ab463(_0x19067d);})[_0x27af('0x40')](function(_0x4d120b){_0x5d7af4(_0x4d120b);});})['catch'](function(_0x8bcd9f){_0x5d7af4(_0x8bcd9f);});}else{ami[_0x27af('0x62')](ut[_0x27af('0x61')](_0x132ed4,_0x31a595))[_0x27af('0x3e')](function(_0x569083){_0x4ab463(_0x569083);})['catch'](function(_0x5de989){_0x5d7af4(_0x5de989);});}});}Fax[_0x27af('0x1e')][_0x27af('0x51')]=function(_0x27add6,_0x2c1225){var _0x44af31=this;return new BPromise(function(_0x27dcd5,_0x50f5e6){var _0x4895f4=uuid['v4']();var _0x18c5c0=ut[_0x27af('0x63')](_0x27add6,_0x2c1225);_0x44af31[_0x27af('0x11')][_0x4895f4]=new Action(_0x4895f4,_0x2c1225,_0x27add6);var _0x2c3d30=_0x44af31['actions'][_0x4895f4];if(path['parse'](_0x27add6[_0x27af('0x5d')])[_0x27af('0x64')]===_0x27af('0x3c')){originate(_0x2c3d30,_0x18c5c0,!![])[_0x27af('0x3e')](function(_0x2b7e18){_0x27dcd5(_0x2b7e18);})[_0x27af('0x40')](function(_0x199679){_0x50f5e6(_0x199679);});}else{originate(_0x2c3d30,_0x18c5c0,![])[_0x27af('0x3e')](function(_0x1d0438){_0x27dcd5(_0x1d0438);})[_0x27af('0x40')](function(_0x435746){_0x50f5e6(_0x435746);});}});};Fax['prototype'][_0x27af('0x65')]=function(_0xb0161c){return!_[_0x27af('0x66')](_0xb0161c)&&!_['isNil'](_0xb0161c[_0x27af('0x27')])&&!_[_0x27af('0x66')](_0xb0161c[_0x27af('0x67')])&&_0xb0161c['active']&&!_[_0x27af('0x66')](this['trunks'][util[_0x27af('0x68')](_0x27af('0x69'),_0xb0161c[_0x27af('0x27')])])&&!_[_0x27af('0x66')](this[_0x27af('0x10')][util[_0x27af('0x68')](_0x27af('0x69'),_0xb0161c[_0x27af('0x27')])]['status'])&&(this[_0x27af('0x10')][util['format'](_0x27af('0x69'),_0xb0161c[_0x27af('0x27')])][_0x27af('0x30')]==='reachable'||this['trunks'][util[_0x27af('0x68')](_0x27af('0x69'),_0xb0161c[_0x27af('0x27')])]['status']==='unmonitored');};Fax['prototype'][_0x27af('0x57')]=function(_0x110843,_0x551f50){if(!this[_0x27af('0x65')](_0x110843)){ut[_0x27af('0x47')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x27af('0x66')](_0x110843)?'':_0x110843[_0x27af('0x27')]+_0x27af('0x6a'));return{'isValid':![],'message':_0x27af('0x6b')};}if(_['isNil'](_0x551f50[_0x27af('0x7')])){ut[_0x27af('0x47')](_0x27af('0x6c'),JSON[_0x27af('0x42')](_0x551f50));return{'isValid':![],'message':_0x27af('0x6d')};}if(_['isNil'](_0x551f50['path'])){ut[_0x27af('0x47')](_0x27af('0x6e'),JSON['stringify'](_0x551f50));return{'isValid':![],'message':_0x27af('0x6f')};}return{'isValid':!![],'message':_0x27af('0x70')};};module[_0x27af('0x71')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index f27f42a..c77e6d6 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 _0x5e78=['util','bluebird','preview','lodash','error','inspect','notify','then','catch','[Notify]\x20'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5e78,0xaa));var _0x85e7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e78[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x85e7('0x0'));var BPromise=require(_0x85e7('0x1'));var logger=require('../../../config/logger')(_0x85e7('0x2'));var _=require(_0x85e7('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x525860){return function(_0x27171b){logger[_0x85e7('0x4')](_0x525860,util[_0x85e7('0x5')](_0x27171b,{'showHidden':![],'depth':null}));};}exports[_0x85e7('0x6')]=function(_0x21daf1,_0x4ee9d9){return BPromise['resolve']()[_0x85e7('0x7')](faxAccount[_0x85e7('0x6')](_0x21daf1,_0x4ee9d9))[_0x85e7('0x8')](loggerCatch(_0x85e7('0x9')));}; \ No newline at end of file +var _0x5d0d=['util','../../../config/logger','lodash','../rpc/faxAccount','error','inspect','notify','resolve','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d0d,0x99));var _0xd5d0=function(_0x382e89,_0x4768c0){_0x382e89=_0x382e89-0x0;var _0x3a1318=_0x5d0d[_0x382e89];return _0x3a1318;};'use strict';var util=require(_0xd5d0('0x0'));var BPromise=require('bluebird');var logger=require(_0xd5d0('0x1'))('preview');var _=require(_0xd5d0('0x2'));var faxAccount=require(_0xd5d0('0x3'));function loggerCatch(_0x2089b3){return function(_0x3105d1){logger[_0xd5d0('0x4')](_0x2089b3,util[_0xd5d0('0x5')](_0x3105d1,{'showHidden':![],'depth':null}));};}exports[_0xd5d0('0x6')]=function(_0x1acf6e,_0x347495){return BPromise[_0xd5d0('0x7')]()['then'](faxAccount['notify'](_0x1acf6e,_0x347495))[_0xd5d0('0x8')](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 508ebd0..7993d31 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 _0x6298=['child_process','exec','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','bluebird'];(function(_0x41a332,_0x67b939){var _0x15ae65=function(_0x2f392a){while(--_0x2f392a){_0x41a332['push'](_0x41a332['shift']());}};_0x15ae65(++_0x67b939);}(_0x6298,0xf0));var _0x8629=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6298[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x8629('0x0'));var logger=require(_0x8629('0x1'))('fax');var BPromise=require(_0x8629('0x2'));var exec=require(_0x8629('0x3'))[_0x8629('0x4')];exports['execute']=function(_0x366b37){return new BPromise(function(_0x5e77df,_0x3cfeef){exec(_0x366b37,function(_0x1c1982,_0x1848b3,_0x1abf6f){logger[_0x8629('0x5')]('Exec\x20gs',_0x1848b3);if(_0x1c1982){logger[_0x8629('0x5')](_0x8629('0x6'),_0x8629('0x7'),util[_0x8629('0x8')](_0x1c1982,{'showHidden':![],'depth':null}),_0x1848b3,_0x1abf6f);_0x3cfeef(_0x1c1982);}_0x5e77df(_0x1848b3);});});}; \ No newline at end of file +var _0x9c41=['exec','Exec\x20gs','info','\x20Error\x20:','inspect','util','../../../../config/logger','bluebird','child_process'];(function(_0x4149c4,_0x293567){var _0x32079e=function(_0x5df9e3){while(--_0x5df9e3){_0x4149c4['push'](_0x4149c4['shift']());}};_0x32079e(++_0x293567);}(_0x9c41,0x1eb));var _0x19c4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9c41[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x19c4('0x0'));var logger=require(_0x19c4('0x1'))('fax');var BPromise=require(_0x19c4('0x2'));var exec=require(_0x19c4('0x3'))[_0x19c4('0x4')];exports['execute']=function(_0xcf3239){return new BPromise(function(_0x2f3cc1,_0x1b859a){exec(_0xcf3239,function(_0x262d71,_0x19aa79,_0x4c53c0){logger['info'](_0x19c4('0x5'),_0x19aa79);if(_0x262d71){logger[_0x19c4('0x6')](_0x19c4('0x5'),_0x19c4('0x7'),util[_0x19c4('0x8')](_0x262d71,{'showHidden':![],'depth':null}),_0x19aa79,_0x4c53c0);_0x1b859a(_0x262d71);}_0x2f3cc1(_0x19aa79);});});}; \ 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 b1e5bb3..1d768be 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 _0x8534=['fax','message','logger','info','inspect','addVariables','ecm','minrate','maxrate','\x22%s\x22','gateway','faxdetect','localstationid','path','uniqueid','from-sip','format','\x22%s\x22\x20<%s>','headerinfo','util','lodash','moment','../../../../config/logger'];(function(_0x4185e7,_0x576959){var _0x107878=function(_0x10f008){while(--_0x10f008){_0x4185e7['push'](_0x4185e7['shift']());}};_0x107878(++_0x576959);}(_0x8534,0x110));var _0x4853=function(_0x57f201,_0x277193){_0x57f201=_0x57f201-0x0;var _0x53c91e=_0x8534[_0x57f201];return _0x53c91e;};'use strict';var util=require(_0x4853('0x0'));var _=require(_0x4853('0x1'));var moment=require(_0x4853('0x2'));var logger=require(_0x4853('0x3'))(_0x4853('0x4'));exports[_0x4853('0x5')]=function(_0x31c18f){return{'message':_0x31c18f};};exports[_0x4853('0x6')]=function(_0x230041,_0x3eba3a){logger[_0x4853('0x7')](_0x230041,util[_0x4853('0x8')](_0x3eba3a,{'showHidden':![],'depth':null}));};exports[_0x4853('0x9')]=function(_0x4e3839,_0xef566e){var _0x4440ca={'XMF-ECM':_0xef566e[_0x4853('0xa')],'XMF-HEADERINFO':_0xef566e['headerinfo'],'XMF-MINRATE':_0xef566e[_0x4853('0xb')],'XMF-MAXRATE':_0xef566e[_0x4853('0xc')],'XMF-MODEM':util['format'](_0x4853('0xd'),_0xef566e['modem']),'XMF-GATEWAY':_0xef566e[_0x4853('0xe')],'XMF-FAXDETECT':_0xef566e[_0x4853('0xf')],'XMF-T38TIMEOUT':_0xef566e['t38timeout'],'XMF-LOCALSTATIONID':_0xef566e[_0x4853('0x10')],'XMF-PATH':_0x4e3839[_0x4853('0x11')]};return _0x4440ca;};exports['variablesAction']=function(_0x599681,_0x5b46b0){return{'actionid':_0x599681[_0x4853('0x12')],'action':'originate','channel':_0x599681['channel'],'Exten':'xcally-motion-fax','Context':_0x4853('0x13'),'Priority':'1','callerid':util[_0x4853('0x14')](_0x4853('0x15'),_0x599681[_0x4853('0x16')]?_0x599681[_0x4853('0x16')]:'',_0x599681[_0x4853('0x10')]),'variable':_0x5b46b0,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x599681[_0x4853('0x12')]};}; \ No newline at end of file +var _0x896f=['../../../../config/logger','fax','logger','info','inspect','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','moment'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x896f,0x12a));var _0xf896=function(_0x25662e,_0x4cec68){_0x25662e=_0x25662e-0x0;var _0x59b7bc=_0x896f[_0x25662e];return _0x59b7bc;};'use strict';var util=require(_0xf896('0x0'));var _=require('lodash');var moment=require(_0xf896('0x1'));var logger=require(_0xf896('0x2'))(_0xf896('0x3'));exports['message']=function(_0xda1fdb){return{'message':_0xda1fdb};};exports[_0xf896('0x4')]=function(_0xefafa2,_0x4e285d){logger[_0xf896('0x5')](_0xefafa2,util[_0xf896('0x6')](_0x4e285d,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x3acf6a,_0x1c8ae2){var _0x3fe24e={'XMF-ECM':_0x1c8ae2[_0xf896('0x7')],'XMF-HEADERINFO':_0x1c8ae2[_0xf896('0x8')],'XMF-MINRATE':_0x1c8ae2[_0xf896('0x9')],'XMF-MAXRATE':_0x1c8ae2[_0xf896('0xa')],'XMF-MODEM':util[_0xf896('0xb')](_0xf896('0xc'),_0x1c8ae2[_0xf896('0xd')]),'XMF-GATEWAY':_0x1c8ae2[_0xf896('0xe')],'XMF-FAXDETECT':_0x1c8ae2[_0xf896('0xf')],'XMF-T38TIMEOUT':_0x1c8ae2[_0xf896('0x10')],'XMF-LOCALSTATIONID':_0x1c8ae2[_0xf896('0x11')],'XMF-PATH':_0x3acf6a[_0xf896('0x12')]};return _0x3fe24e;};exports['variablesAction']=function(_0x599f01,_0x56abb7){return{'actionid':_0x599f01[_0xf896('0x13')],'action':_0xf896('0x14'),'channel':_0x599f01[_0xf896('0x15')],'Exten':_0xf896('0x16'),'Context':_0xf896('0x17'),'Priority':'1','callerid':util[_0xf896('0xb')](_0xf896('0x18'),_0x599f01[_0xf896('0x8')]?_0x599f01[_0xf896('0x8')]:'',_0x599f01['localstationid']),'variable':_0x56abb7,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x599f01[_0xf896('0x13')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 7d11143..ec09fda 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 _0xd7ff=['hour','get','resolve','then','initAgents','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','bluebird','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','ami'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd7ff,0x1e1));var _0xfd7f=function(_0x3e431e,_0x508c09){_0x3e431e=_0x3e431e-0x0;var _0x7ef3f2=_0xd7ff[_0x3e431e];return _0x7ef3f2;};'use strict';var BPromise=require(_0xfd7f('0x0'));var util=require(_0xfd7f('0x1'));var moment=require(_0xfd7f('0x2'));var server=require(_0xfd7f('0x3'));var Realtime=require(_0xfd7f('0x4'));var Report=require(_0xfd7f('0x5'));var Acw=require(_0xfd7f('0x6'));var Trigger=require(_0xfd7f('0x7'));var Dialer=require(_0xfd7f('0x8'));var Preview=require(_0xfd7f('0x9'));var Fax=require(_0xfd7f('0xa'));var user=require(_0xfd7f('0xb'));var voiceQueue=require(_0xfd7f('0xc'));var voiceQueueReport=require(_0xfd7f('0xd'));var voiceCallReport=require(_0xfd7f('0xe'));var trunk=require('./rpc/trunk');var trigger=require(_0xfd7f('0xf'));var template=require(_0xfd7f('0x10'));var cmHopperHistory=require(_0xfd7f('0x11'));var campaign=require(_0xfd7f('0x12'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xfd7f('0x13'));var zendesk=require(_0xfd7f('0x14'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xfd7f('0x15'));var freshdesk=require(_0xfd7f('0x16'));var desk=require(_0xfd7f('0x17'));var zoho=require(_0xfd7f('0x18'));var vtiger=require(_0xfd7f('0x19'));var freshsales=require(_0xfd7f('0x1a'));var servicenow=require(_0xfd7f('0x1b'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xfd7f('0x1c'))(_0xfd7f('0x1d'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0xfd7f('0x1e'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xfd7f('0x1f')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xfd7f('0x20')]()['then'](user['getAgents']())[_0xfd7f('0x21')](realtime[_0xfd7f('0x22')]())[_0xfd7f('0x21')](user['getTelephones']())[_0xfd7f('0x21')](realtime[_0xfd7f('0x23')]())[_0xfd7f('0x21')](trunk[_0xfd7f('0x24')]())[_0xfd7f('0x21')](realtime[_0xfd7f('0x25')]())[_0xfd7f('0x21')](voiceQueue[_0xfd7f('0x26')]())[_0xfd7f('0x21')](realtime[_0xfd7f('0x27')]())[_0xfd7f('0x21')](trigger[_0xfd7f('0x28')]())[_0xfd7f('0x21')](realtime['initTriggers']())[_0xfd7f('0x21')](template['getTemplates']())[_0xfd7f('0x21')](realtime['initTemplates']())[_0xfd7f('0x21')](zendesk['getZendeskAccounts']())[_0xfd7f('0x21')](realtime[_0xfd7f('0x29')]())[_0xfd7f('0x21')](salesforce[_0xfd7f('0x2a')]())['then'](realtime[_0xfd7f('0x2b')]())[_0xfd7f('0x21')](sugarcrm['getSugarcrmAccounts']())[_0xfd7f('0x21')](realtime['initSugarcrmAccounts']())[_0xfd7f('0x21')](freshdesk[_0xfd7f('0x2c')]())['then'](realtime[_0xfd7f('0x2d')]())[_0xfd7f('0x21')](desk[_0xfd7f('0x2e')]())['then'](realtime[_0xfd7f('0x2f')]())[_0xfd7f('0x21')](zoho[_0xfd7f('0x30')]())[_0xfd7f('0x21')](realtime[_0xfd7f('0x31')]())[_0xfd7f('0x21')](vtiger[_0xfd7f('0x32')]())[_0xfd7f('0x21')](realtime['initVtigerAccounts']())[_0xfd7f('0x21')](freshsales[_0xfd7f('0x33')]())['then'](realtime[_0xfd7f('0x34')]())[_0xfd7f('0x21')](servicenow[_0xfd7f('0x35')]())[_0xfd7f('0x21')](realtime[_0xfd7f('0x36')]())[_0xfd7f('0x21')](dynamics365[_0xfd7f('0x37')]())[_0xfd7f('0x21')](realtime['initDynamics365Accounts']())['then'](campaign[_0xfd7f('0x38')]())[_0xfd7f('0x21')](realtime[_0xfd7f('0x39')]())['then'](voiceExtension[_0xfd7f('0x3a')]())[_0xfd7f('0x21')](realtime[_0xfd7f('0x3b')]())[_0xfd7f('0x21')](faxAccount[_0xfd7f('0x3c')]())[_0xfd7f('0x21')](realtime[_0xfd7f('0x3d')]())['then'](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0xfd7f('0x21')](voiceQueueReport[_0xfd7f('0x3e')]())[_0xfd7f('0x21')](realtime[_0xfd7f('0x3f')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())['then'](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory[_0xfd7f('0x40')]())[_0xfd7f('0x21')](realtime[_0xfd7f('0x41')]())[_0xfd7f('0x21')](voiceCallReport['getVoiceCallReports']())[_0xfd7f('0x21')](realtime[_0xfd7f('0x42')]())['catch'](function(_0x3d8de6){logger[_0xfd7f('0x43')](_0xfd7f('0x44'),util[_0xfd7f('0x45')](_0x3d8de6,{'showHidden':![],'depth':null}));});}function main(){return server[_0xfd7f('0x46')](realtime,preview,fax)[_0xfd7f('0x21')](function(_0x38391a){return initRealtime();})[_0xfd7f('0x21')](function(){return initParams();})[_0xfd7f('0x21')](function(){report[_0xfd7f('0x47')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x195d0e){logger[_0xfd7f('0x43')](_0xfd7f('0x48'),util[_0xfd7f('0x45')](_0x195d0e,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x7c2a=['getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','bluebird','util','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7c2a,0x15e));var _0xa7c2=function(_0x575771,_0x164c49){_0x575771=_0x575771-0x0;var _0x272415=_0x7c2a[_0x575771];return _0x272415;};'use strict';var BPromise=require(_0xa7c2('0x0'));var util=require(_0xa7c2('0x1'));var moment=require('moment');var server=require(_0xa7c2('0x2'));var Realtime=require(_0xa7c2('0x3'));var Report=require(_0xa7c2('0x4'));var Acw=require(_0xa7c2('0x5'));var Trigger=require(_0xa7c2('0x6'));var Dialer=require(_0xa7c2('0x7'));var Preview=require(_0xa7c2('0x8'));var Fax=require(_0xa7c2('0x9'));var user=require(_0xa7c2('0xa'));var voiceQueue=require(_0xa7c2('0xb'));var voiceQueueReport=require(_0xa7c2('0xc'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xa7c2('0xd'));var trigger=require(_0xa7c2('0xe'));var template=require(_0xa7c2('0xf'));var cmHopperHistory=require(_0xa7c2('0x10'));var campaign=require(_0xa7c2('0x11'));var voiceExtension=require(_0xa7c2('0x12'));var faxAccount=require(_0xa7c2('0x13'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xa7c2('0x14'));var sugarcrm=require(_0xa7c2('0x15'));var freshdesk=require(_0xa7c2('0x16'));var desk=require(_0xa7c2('0x17'));var zoho=require(_0xa7c2('0x18'));var vtiger=require(_0xa7c2('0x19'));var freshsales=require(_0xa7c2('0x1a'));var servicenow=require(_0xa7c2('0x1b'));var dynamics365=require(_0xa7c2('0x1c'));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(_0xa7c2('0x1d'))(_0xa7c2('0x1e'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get']('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xa7c2('0x1f')](_0xa7c2('0x20'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xa7c2('0x21')]()[_0xa7c2('0x22')](user[_0xa7c2('0x23')]())[_0xa7c2('0x22')](realtime[_0xa7c2('0x24')]())['then'](user[_0xa7c2('0x25')]())[_0xa7c2('0x22')](realtime['initTelephones']())[_0xa7c2('0x22')](trunk[_0xa7c2('0x26')]())[_0xa7c2('0x22')](realtime[_0xa7c2('0x27')]())[_0xa7c2('0x22')](voiceQueue['getVoiceQueues']())[_0xa7c2('0x22')](realtime[_0xa7c2('0x28')]())[_0xa7c2('0x22')](trigger[_0xa7c2('0x29')]())[_0xa7c2('0x22')](realtime[_0xa7c2('0x2a')]())['then'](template[_0xa7c2('0x2b')]())[_0xa7c2('0x22')](realtime[_0xa7c2('0x2c')]())[_0xa7c2('0x22')](zendesk['getZendeskAccounts']())[_0xa7c2('0x22')](realtime[_0xa7c2('0x2d')]())[_0xa7c2('0x22')](salesforce[_0xa7c2('0x2e')]())['then'](realtime[_0xa7c2('0x2f')]())[_0xa7c2('0x22')](sugarcrm[_0xa7c2('0x30')]())['then'](realtime[_0xa7c2('0x31')]())[_0xa7c2('0x22')](freshdesk[_0xa7c2('0x32')]())[_0xa7c2('0x22')](realtime['initFreshdeskAccounts']())['then'](desk[_0xa7c2('0x33')]())[_0xa7c2('0x22')](realtime[_0xa7c2('0x34')]())[_0xa7c2('0x22')](zoho[_0xa7c2('0x35')]())['then'](realtime['initZohoAccounts']())['then'](vtiger[_0xa7c2('0x36')]())[_0xa7c2('0x22')](realtime[_0xa7c2('0x37')]())['then'](freshsales['getFreshsalesAccounts']())[_0xa7c2('0x22')](realtime[_0xa7c2('0x38')]())[_0xa7c2('0x22')](servicenow[_0xa7c2('0x39')]())[_0xa7c2('0x22')](realtime[_0xa7c2('0x3a')]())[_0xa7c2('0x22')](dynamics365[_0xa7c2('0x3b')]())[_0xa7c2('0x22')](realtime[_0xa7c2('0x3c')]())[_0xa7c2('0x22')](campaign[_0xa7c2('0x3d')]())[_0xa7c2('0x22')](realtime[_0xa7c2('0x3e')]())[_0xa7c2('0x22')](voiceExtension[_0xa7c2('0x3f')]())[_0xa7c2('0x22')](realtime[_0xa7c2('0x40')]())['then'](faxAccount[_0xa7c2('0x41')]())['then'](realtime[_0xa7c2('0x42')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0xa7c2('0x21')]()[_0xa7c2('0x22')](voiceQueueReport[_0xa7c2('0x43')]())[_0xa7c2('0x22')](realtime[_0xa7c2('0x44')]())[_0xa7c2('0x22')](cmHopperHistory[_0xa7c2('0x45')]())[_0xa7c2('0x22')](realtime[_0xa7c2('0x46')]())['then'](cmHopperHistory[_0xa7c2('0x47')]())[_0xa7c2('0x22')](realtime['initCampaignHopperHistory']())[_0xa7c2('0x22')](voiceCallReport['getVoiceCallReports']())[_0xa7c2('0x22')](realtime[_0xa7c2('0x48')]())[_0xa7c2('0x49')](function(_0xb22ae9){logger[_0xa7c2('0x4a')](_0xa7c2('0x4b'),util[_0xa7c2('0x4c')](_0xb22ae9,{'showHidden':![],'depth':null}));});}function main(){return server[_0xa7c2('0x4d')](realtime,preview,fax)[_0xa7c2('0x22')](function(_0x1ecf0d){return initRealtime();})[_0xa7c2('0x22')](function(){return initParams();})[_0xa7c2('0x22')](function(){report[_0xa7c2('0x4e')]();setInterval(initRealtime,0x1388);})[_0xa7c2('0x49')](function(_0x391a20){logger[_0xa7c2('0x4a')](_0xa7c2('0x4f'),util[_0xa7c2('0x4c')](_0x391a20,{'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 3b986ec..13e6582 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 _0x70e0=['name','voiceStatusQueue','onhold','stringify','md5','user:%s','user:save','emit','user:presence','lodash','util','moment','../../../config/environment','redis','defaults','socket.io-emitter','email','accountcode','fullname','state','unknown','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','local','toLowerCase','not_inuse','idle','inuse','statePause','toNumber','format'];(function(_0x5d0593,_0x4c7945){var _0x4a28c5=function(_0x233d52){while(--_0x233d52){_0x5d0593['push'](_0x5d0593['shift']());}};_0x4a28c5(++_0x4c7945);}(_0x70e0,0x17b));var _0x070e=function(_0x4266d1,_0x44daa3){_0x4266d1=_0x4266d1-0x0;var _0x264331=_0x70e0[_0x4266d1];return _0x264331;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x070e('0x3'));config[_0x070e('0x4')]=_[_0x070e('0x5')](config[_0x070e('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x070e('0x6'))(new Redis(config['redis']));function Agent(_0x46fe68){this['id']=_0x46fe68['id']||0x0;this['name']=_0x46fe68['name']||'';this['email']=_0x46fe68[_0x070e('0x7')]||'';this[_0x070e('0x8')]=_0x46fe68[_0x070e('0x8')]||'';this[_0x070e('0x9')]=_0x46fe68[_0x070e('0x9')]||'';this[_0x070e('0xa')]=_0x070e('0xb');this['stateTime']=0x0;this['status']=_0x070e('0xb');this[_0x070e('0xc')]='';this[_0x070e('0xd')]='';this[_0x070e('0xe')]='';this[_0x070e('0xf')]='';this[_0x070e('0x10')]=_0x46fe68[_0x070e('0x10')]||![];this[_0x070e('0x11')]=_0x070e('0xb');this[_0x070e('0x12')]=0x0;this[_0x070e('0x13')]='';this['voiceStatusQueue']='';this['onhold']=![];this[_0x070e('0x14')]=![];this['md5']='';}Agent['prototype']['updateStatusRealtime']=function(_0x11d2ce){var _0x14c3fd;if(_0x11d2ce&&_0x11d2ce['state']){_0x14c3fd=_0x11d2ce['state'][_0x070e('0x15')]();switch(_0x14c3fd){case _0x070e('0x16'):_0x14c3fd=_0x070e('0x17');break;case _0x070e('0x18'):_0x14c3fd='talking';break;}}if(_0x14c3fd&&this['voiceStatus']!==_0x14c3fd||_0x11d2ce[_0x070e('0x19')]){this[_0x070e('0x12')]=_[_0x070e('0x1a')](moment()[_0x070e('0x1b')]('x'));}if(_0x14c3fd){this[_0x070e('0x11')]=_0x14c3fd;}var _0x5037eb={'id':this['id'],'name':this[_0x070e('0x1c')],'email':this[_0x070e('0x7')],'accountcode':this[_0x070e('0x8')],'fullname':this[_0x070e('0x9')],'state':this[_0x070e('0xa')],'stateTime':this['stateTime'],'status':this['status'],'address':this['address'],'online':this[_0x070e('0x10')],'voiceStatus':this[_0x070e('0x11')],'voiceStatusTime':this[_0x070e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x070e('0x1d')],'interface':this['interface'],'onhold':this[_0x070e('0x1e')]};var _0x3f6985=md5(JSON[_0x070e('0x1f')](_0x5037eb));if(this[_0x070e('0x20')]!==_0x3f6985){this[_0x070e('0x20')]=_0x3f6985;io['to'](util[_0x070e('0x1b')](_0x070e('0x21'),_0x5037eb[_0x070e('0x1c')]))['emit'](_0x070e('0x22'),_0x5037eb);io[_0x070e('0x23')](_0x070e('0x24'),_0x5037eb);}};module['exports']=Agent; \ No newline at end of file +var _0x70e0=['name','voiceStatusQueue','onhold','stringify','md5','user:%s','user:save','emit','user:presence','lodash','util','moment','../../../config/environment','redis','defaults','socket.io-emitter','email','accountcode','fullname','state','unknown','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','local','toLowerCase','not_inuse','idle','inuse','statePause','toNumber','format'];(function(_0x46917f,_0x24e037){var _0x355f8f=function(_0x2e4aa3){while(--_0x2e4aa3){_0x46917f['push'](_0x46917f['shift']());}};_0x355f8f(++_0x24e037);}(_0x70e0,0x17b));var _0x070e=function(_0x27d682,_0x1aaa3e){_0x27d682=_0x27d682-0x0;var _0x182c4a=_0x70e0[_0x27d682];return _0x182c4a;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x070e('0x3'));config[_0x070e('0x4')]=_[_0x070e('0x5')](config[_0x070e('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x070e('0x6'))(new Redis(config['redis']));function Agent(_0x46fe68){this['id']=_0x46fe68['id']||0x0;this['name']=_0x46fe68['name']||'';this['email']=_0x46fe68[_0x070e('0x7')]||'';this[_0x070e('0x8')]=_0x46fe68[_0x070e('0x8')]||'';this[_0x070e('0x9')]=_0x46fe68[_0x070e('0x9')]||'';this[_0x070e('0xa')]=_0x070e('0xb');this['stateTime']=0x0;this['status']=_0x070e('0xb');this[_0x070e('0xc')]='';this[_0x070e('0xd')]='';this[_0x070e('0xe')]='';this[_0x070e('0xf')]='';this[_0x070e('0x10')]=_0x46fe68[_0x070e('0x10')]||![];this[_0x070e('0x11')]=_0x070e('0xb');this[_0x070e('0x12')]=0x0;this[_0x070e('0x13')]='';this['voiceStatusQueue']='';this['onhold']=![];this[_0x070e('0x14')]=![];this['md5']='';}Agent['prototype']['updateStatusRealtime']=function(_0x11d2ce){var _0x14c3fd;if(_0x11d2ce&&_0x11d2ce['state']){_0x14c3fd=_0x11d2ce['state'][_0x070e('0x15')]();switch(_0x14c3fd){case _0x070e('0x16'):_0x14c3fd=_0x070e('0x17');break;case _0x070e('0x18'):_0x14c3fd='talking';break;}}if(_0x14c3fd&&this['voiceStatus']!==_0x14c3fd||_0x11d2ce[_0x070e('0x19')]){this[_0x070e('0x12')]=_[_0x070e('0x1a')](moment()[_0x070e('0x1b')]('x'));}if(_0x14c3fd){this[_0x070e('0x11')]=_0x14c3fd;}var _0x5037eb={'id':this['id'],'name':this[_0x070e('0x1c')],'email':this[_0x070e('0x7')],'accountcode':this[_0x070e('0x8')],'fullname':this[_0x070e('0x9')],'state':this[_0x070e('0xa')],'stateTime':this['stateTime'],'status':this['status'],'address':this['address'],'online':this[_0x070e('0x10')],'voiceStatus':this[_0x070e('0x11')],'voiceStatusTime':this[_0x070e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x070e('0x1d')],'interface':this['interface'],'onhold':this[_0x070e('0x1e')]};var _0x3f6985=md5(JSON[_0x070e('0x1f')](_0x5037eb));if(this[_0x070e('0x20')]!==_0x3f6985){this[_0x070e('0x20')]=_0x3f6985;io['to'](util[_0x070e('0x1b')](_0x070e('0x21'),_0x5037eb[_0x070e('0x1c')]))['emit'](_0x070e('0x22'),_0x5037eb);io[_0x070e('0x23')](_0x070e('0x24'),_0x5037eb);}};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 99bc7cd..39250fb 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 _0xc32f=['DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialOrderByScheduledAt'];(function(_0x1cac97,_0x14901b){var _0xc47a1=function(_0xd30b64){while(--_0xd30b64){_0x1cac97['push'](_0x1cac97['shift']());}};_0xc47a1(++_0x14901b);}(_0xc32f,0x77));var _0xfc32=function(_0x176880,_0x559679){_0x176880=_0x176880-0x0;var _0x1eaff5=_0xc32f[_0x176880];return _0x1eaff5;};'use strict';function Campaign(_0x58a232){this['id']=_0x58a232['id']||0x0;this[_0xfc32('0x0')]=_0x58a232['name']||'';this[_0xfc32('0x1')]=_0x58a232['type']||_0xfc32('0x2');this['originated']=0x0;this[_0xfc32('0x3')]=0x0;this[_0xfc32('0x4')]=0x0;this[_0xfc32('0x5')]=0x0;this[_0xfc32('0x6')]='';this[_0xfc32('0x7')]=!![];this[_0xfc32('0x8')]=_0x58a232[_0xfc32('0x8')];this['limitCalls']=_0x58a232[_0xfc32('0x9')];this[_0xfc32('0xa')]=_0x58a232[_0xfc32('0xa')]||null;this[_0xfc32('0xb')]=_0x58a232[_0xfc32('0xb')]?_0x58a232['dialGlobalInterval']:null;this[_0xfc32('0xc')]=_0x58a232['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x58a232[_0xfc32('0xd')];this[_0xfc32('0xe')]=_0x58a232['dialOriginateTimeout']||0x1e;this[_0xfc32('0xf')]=_0x58a232[_0xfc32('0xf')];this[_0xfc32('0x10')]=_0x58a232[_0xfc32('0x10')];this[_0xfc32('0x11')]=_0x58a232[_0xfc32('0x11')];this[_0xfc32('0x12')]=_0x58a232[_0xfc32('0x12')];this['dialNoAnswerMaxRetry']=_0x58a232['dialNoAnswerMaxRetry'];this['dialNoAnswerRetryFrequency']=_0x58a232[_0xfc32('0x13')];this[_0xfc32('0x14')]=_0x58a232['dialGlobalMaxRetry'];this[_0xfc32('0x15')]=_0x58a232[_0xfc32('0x15')]||0x3;this[_0xfc32('0x16')]=_0x58a232[_0xfc32('0x16')]||0x96;this[_0xfc32('0x17')]=_0x58a232['dialDropMaxRetry']||0x3;this[_0xfc32('0x18')]=_0x58a232['dialDropRetryFrequency']||0x96;this[_0xfc32('0x19')]=_0x58a232[_0xfc32('0x19')]||0x3;this[_0xfc32('0x1a')]=_0x58a232['dialAbandonedRetryFrequency']||0x96;this[_0xfc32('0x1b')]=_0x58a232['dialMachineMaxRetry']||0x3;this[_0xfc32('0x1c')]=_0x58a232[_0xfc32('0x1c')]||0x96;this['dialAgentRejectMaxRetry']=_0x58a232['dialAgentRejectMaxRetry']||0x3;this[_0xfc32('0x1d')]=_0x58a232[_0xfc32('0x1d')]||0x96;this[_0xfc32('0x1e')]=_0x58a232['dialOrderByScheduledAt']||_0xfc32('0x1f');this[_0xfc32('0x20')]=_0x58a232[_0xfc32('0x20')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x58a232[_0xfc32('0x21')]||undefined;this['dialCutDigit']=_0x58a232['dialCutDigit']||undefined;this['TrunkBackup']=_0x58a232['TrunkBackup']?_0x58a232[_0xfc32('0x22')]:undefined;this['Trunk']=_0x58a232[_0xfc32('0x23')]?_0x58a232[_0xfc32('0x23')]:undefined;this[_0xfc32('0x24')]=_0x58a232[_0xfc32('0x24')]?_0x58a232[_0xfc32('0x24')]:undefined;this['SquareProject']=_0x58a232[_0xfc32('0x25')]?_0x58a232[_0xfc32('0x25')]:undefined;this[_0xfc32('0x26')]=_0x58a232['SquareProject']?_0x58a232['SquareProject']['name']:undefined;this[_0xfc32('0x27')]=_0x58a232[_0xfc32('0x27')]||![];this[_0xfc32('0x28')]=_0x58a232[_0xfc32('0x28')];this[_0xfc32('0x29')]=_0x58a232[_0xfc32('0x29')];this['dialAMDAfterGreetingSilence']=_0x58a232[_0xfc32('0x2a')];this[_0xfc32('0x2b')]=_0x58a232['dialAMDTotalAnalysisTime'];this[_0xfc32('0x2c')]=_0x58a232[_0xfc32('0x2c')];this[_0xfc32('0x2d')]=_0x58a232[_0xfc32('0x2d')];this[_0xfc32('0x2e')]=_0x58a232[_0xfc32('0x2e')];this[_0xfc32('0x2f')]=_0x58a232['dialAMDSilenceThreshold'];this[_0xfc32('0x30')]=_0x58a232[_0xfc32('0x30')];}module[_0xfc32('0x31')]=Campaign; \ No newline at end of file +var _0x9f42=['SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval'];(function(_0x2ac3f7,_0x50e025){var _0x2d84a3=function(_0x57ca8a){while(--_0x57ca8a){_0x2ac3f7['push'](_0x2ac3f7['shift']());}};_0x2d84a3(++_0x50e025);}(_0x9f42,0x10c));var _0x29f4=function(_0x5c524e,_0x4f07dc){_0x5c524e=_0x5c524e-0x0;var _0x49ffd1=_0x9f42[_0x5c524e];return _0x49ffd1;};'use strict';function Campaign(_0x499dc1){this['id']=_0x499dc1['id']||0x0;this[_0x29f4('0x0')]=_0x499dc1[_0x29f4('0x0')]||'';this[_0x29f4('0x1')]=_0x499dc1[_0x29f4('0x1')]||_0x29f4('0x2');this[_0x29f4('0x3')]=0x0;this[_0x29f4('0x4')]=0x0;this[_0x29f4('0x5')]=0x0;this[_0x29f4('0x6')]=0x0;this[_0x29f4('0x7')]='';this['sendMessageOneNotActive']=!![];this[_0x29f4('0x8')]=_0x499dc1['active'];this['limitCalls']=_0x499dc1['limitCalls'];this['dialTimezone']=_0x499dc1[_0x29f4('0x9')]||null;this[_0x29f4('0xa')]=_0x499dc1[_0x29f4('0xa')]?_0x499dc1[_0x29f4('0xa')]:null;this[_0x29f4('0xb')]=_0x499dc1[_0x29f4('0xb')];this['dialOriginateCallerIdNumber']=_0x499dc1[_0x29f4('0xc')];this['dialOriginateTimeout']=_0x499dc1[_0x29f4('0xd')]||0x1e;this[_0x29f4('0xe')]=_0x499dc1['dialCongestionMaxRetry'];this[_0x29f4('0xf')]=_0x499dc1[_0x29f4('0xf')];this[_0x29f4('0x10')]=_0x499dc1['dialBusyMaxRetry'];this['dialBusyRetryFrequency']=_0x499dc1[_0x29f4('0x11')];this[_0x29f4('0x12')]=_0x499dc1['dialNoAnswerMaxRetry'];this[_0x29f4('0x13')]=_0x499dc1[_0x29f4('0x13')];this[_0x29f4('0x14')]=_0x499dc1['dialGlobalMaxRetry'];this[_0x29f4('0x15')]=_0x499dc1['dialNoSuchNumberMaxRetry']||0x3;this[_0x29f4('0x16')]=_0x499dc1['dialNoSuchNumberRetryFrequency']||0x96;this[_0x29f4('0x17')]=_0x499dc1['dialDropMaxRetry']||0x3;this[_0x29f4('0x18')]=_0x499dc1['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x499dc1[_0x29f4('0x19')]||0x3;this[_0x29f4('0x1a')]=_0x499dc1[_0x29f4('0x1a')]||0x96;this[_0x29f4('0x1b')]=_0x499dc1[_0x29f4('0x1b')]||0x3;this[_0x29f4('0x1c')]=_0x499dc1[_0x29f4('0x1c')]||0x96;this[_0x29f4('0x1d')]=_0x499dc1[_0x29f4('0x1d')]||0x3;this[_0x29f4('0x1e')]=_0x499dc1[_0x29f4('0x1e')]||0x96;this['dialOrderByScheduledAt']=_0x499dc1['dialOrderByScheduledAt']||_0x29f4('0x1f');this[_0x29f4('0x20')]=_0x499dc1[_0x29f4('0x20')]||undefined;this[_0x29f4('0x21')]=_0x499dc1[_0x29f4('0x21')]||undefined;this[_0x29f4('0x22')]=_0x499dc1[_0x29f4('0x22')]||undefined;this[_0x29f4('0x23')]=_0x499dc1[_0x29f4('0x23')]?_0x499dc1[_0x29f4('0x23')]:undefined;this[_0x29f4('0x24')]=_0x499dc1[_0x29f4('0x24')]?_0x499dc1[_0x29f4('0x24')]:undefined;this['Interval']=_0x499dc1[_0x29f4('0x25')]?_0x499dc1[_0x29f4('0x25')]:undefined;this['SquareProject']=_0x499dc1[_0x29f4('0x26')]?_0x499dc1[_0x29f4('0x26')]:undefined;this[_0x29f4('0x27')]=_0x499dc1['SquareProject']?_0x499dc1[_0x29f4('0x26')][_0x29f4('0x0')]:undefined;this[_0x29f4('0x28')]=_0x499dc1[_0x29f4('0x28')]||![];this['dialAMDInitialSilence']=_0x499dc1[_0x29f4('0x29')];this[_0x29f4('0x2a')]=_0x499dc1[_0x29f4('0x2a')];this[_0x29f4('0x2b')]=_0x499dc1['dialAMDAfterGreetingSilence'];this[_0x29f4('0x2c')]=_0x499dc1['dialAMDTotalAnalysisTime'];this[_0x29f4('0x2d')]=_0x499dc1['dialAMDMinWordLength'];this[_0x29f4('0x2e')]=_0x499dc1[_0x29f4('0x2e')];this[_0x29f4('0x2f')]=_0x499dc1[_0x29f4('0x2f')];this[_0x29f4('0x30')]=_0x499dc1['dialAMDSilenceThreshold'];this[_0x29f4('0x31')]=_0x499dc1[_0x29f4('0x31')];}module[_0x29f4('0x32')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 3b5fdc1..0767e76 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 _0x3d04=['destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','uniqueid','linkedid','exten','answered','lastapplication','lastdata','duration','billableseconds','holdtime','disposition','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel'];(function(_0x1c96ca,_0x928f86){var _0x514090=function(_0x87d2d4){while(--_0x87d2d4){_0x1c96ca['push'](_0x1c96ca['shift']());}};_0x514090(++_0x928f86);}(_0x3d04,0xbe));var _0x43d0=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x3d04[_0x3b380d];return _0x54502b;};'use strict';function Channel(){this[_0x43d0('0x0')]=null;this[_0x43d0('0x1')]='';this[_0x43d0('0x2')]='';this[_0x43d0('0x3')]=0x0;this[_0x43d0('0x4')]='';this[_0x43d0('0x5')]=undefined;this[_0x43d0('0x6')]=undefined;this[_0x43d0('0x7')]=0x0;this['context']='';this[_0x43d0('0x8')]=0x0;this[_0x43d0('0x9')]=0x0;this[_0x43d0('0xa')]=0x0;this[_0x43d0('0xb')]=![];this['answertime']=null;this['endtime']=null;this['unmanaged']=![];this['abandoned']=![];this[_0x43d0('0xc')]='';this[_0x43d0('0xd')]='';this[_0x43d0('0xe')]=0x0;this[_0x43d0('0xf')]=0x0;this[_0x43d0('0x10')]=0x0;this['type']=null;this['tag']=null;this[_0x43d0('0x11')]=null;this['monitor']=![];this['monitorFilename']=null;this[_0x43d0('0x12')]=null;this[_0x43d0('0x13')]=[];this[_0x43d0('0x14')]=undefined;this[_0x43d0('0x15')]=undefined;this['transferType']=undefined;this[_0x43d0('0x16')]=0x0;}module[_0x43d0('0x17')]=Channel; \ No newline at end of file +var _0x707b=['linkedid','exten','unmanaged','abandoned','lastapplication','lastdata','billableseconds','holdtime','monitor','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridname','accountcode','context','uniqueid'];(function(_0x1af97d,_0x28daf7){var _0x588362=function(_0x5ceb2f){while(--_0x5ceb2f){_0x1af97d['push'](_0x1af97d['shift']());}};_0x588362(++_0x28daf7);}(_0x707b,0xdf));var _0xb707=function(_0x47fa10,_0x39b01c){_0x47fa10=_0x47fa10-0x0;var _0x204f30=_0x707b[_0x47fa10];return _0x204f30;};'use strict';function Channel(){this[_0xb707('0x0')]=null;this[_0xb707('0x1')]='';this[_0xb707('0x2')]='';this['calleridnum']=0x0;this[_0xb707('0x3')]='';this['connectedlinenum']=undefined;this['connectedlinename']=undefined;this[_0xb707('0x4')]=0x0;this[_0xb707('0x5')]='';this[_0xb707('0x6')]=0x0;this[_0xb707('0x7')]=0x0;this[_0xb707('0x8')]=0x0;this['answered']=![];this['answertime']=null;this['endtime']=null;this[_0xb707('0x9')]=![];this[_0xb707('0xa')]=![];this[_0xb707('0xb')]='';this[_0xb707('0xc')]='';this['duration']=0x0;this[_0xb707('0xd')]=0x0;this[_0xb707('0xe')]=0x0;this['type']=null;this['tag']=null;this['disposition']=null;this[_0xb707('0xf')]=![];this['monitorFilename']=null;this[_0xb707('0x10')]=null;this[_0xb707('0x11')]=[];this[_0xb707('0x12')]=undefined;this[_0xb707('0x13')]=undefined;this[_0xb707('0x14')]=undefined;this[_0xb707('0x15')]=0x0;}module[_0xb707('0x16')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index cbfb113..950ec49 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 _0xf45b=['name','username','remoteUri','password','consumerKey','consumerSecret','token','tokenSecret','type','Configurations'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf45b,0x82));var _0xbf45=function(_0x3874ab,_0x1e2dec){_0x3874ab=_0x3874ab-0x0;var _0x3b90e8=_0xf45b[_0x3874ab];return _0x3b90e8;};'use strict';function DeskAccount(_0x1a3111){this['id']=_0x1a3111['id']||0x0;this[_0xbf45('0x0')]=_0x1a3111[_0xbf45('0x0')]||'';this[_0xbf45('0x1')]=_0x1a3111[_0xbf45('0x1')]||'';this['remoteUri']=_0x1a3111[_0xbf45('0x2')]||'';this['authType']=_0x1a3111['authType']||'';this['password']=_0x1a3111[_0xbf45('0x3')]||'';this[_0xbf45('0x4')]=_0x1a3111[_0xbf45('0x4')]||'';this[_0xbf45('0x5')]=_0x1a3111[_0xbf45('0x5')]||'';this[_0xbf45('0x6')]=_0x1a3111[_0xbf45('0x6')]||'';this['tokenSecret']=_0x1a3111[_0xbf45('0x7')]||'';this[_0xbf45('0x8')]=_0x1a3111[_0xbf45('0x8')]||'';this['serverUrl']=_0x1a3111['serverUrl']||'';this[_0xbf45('0x9')]=_0x1a3111[_0xbf45('0x9')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0x34b0=['authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x19e3a4,_0x2f28ca){var _0x142b55=function(_0x53e37b){while(--_0x53e37b){_0x19e3a4['push'](_0x19e3a4['shift']());}};_0x142b55(++_0x2f28ca);}(_0x34b0,0x7f));var _0x034b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x34b0[_0x20a584];return _0x4b41a8;};'use strict';function DeskAccount(_0x2ddc63){this['id']=_0x2ddc63['id']||0x0;this[_0x034b('0x0')]=_0x2ddc63[_0x034b('0x0')]||'';this[_0x034b('0x1')]=_0x2ddc63[_0x034b('0x1')]||'';this[_0x034b('0x2')]=_0x2ddc63[_0x034b('0x2')]||'';this['authType']=_0x2ddc63[_0x034b('0x3')]||'';this[_0x034b('0x4')]=_0x2ddc63['password']||'';this[_0x034b('0x5')]=_0x2ddc63[_0x034b('0x5')]||'';this[_0x034b('0x6')]=_0x2ddc63['consumerSecret']||'';this['token']=_0x2ddc63[_0x034b('0x7')]||'';this[_0x034b('0x8')]=_0x2ddc63[_0x034b('0x8')]||'';this['type']=_0x2ddc63[_0x034b('0x9')]||'';this[_0x034b('0xa')]=_0x2ddc63[_0x034b('0xa')]||'';this[_0x034b('0xb')]=_0x2ddc63[_0x034b('0xb')]||{};}module[_0x034b('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 8303920..47ad4f5 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 _0xa9e0=['clientSecret','serverUrl','Configurations','name','password','remoteUri','tenantId','clientId'];(function(_0x37cbd6,_0x4f4ce1){var _0x24c77a=function(_0x4e1821){while(--_0x4e1821){_0x37cbd6['push'](_0x37cbd6['shift']());}};_0x24c77a(++_0x4f4ce1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';function Dynamics365Account(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['username']=_0x1f0015['username']||'';this[_0x0a9e('0x1')]=_0x1f0015['password']||'';this[_0x0a9e('0x2')]=_0x1f0015[_0x0a9e('0x2')]||'';this[_0x0a9e('0x3')]=_0x1f0015[_0x0a9e('0x3')]||'';this[_0x0a9e('0x4')]=_0x1f0015['clientId']||'';this[_0x0a9e('0x5')]=_0x1f0015[_0x0a9e('0x5')]||{};this[_0x0a9e('0x6')]=_0x1f0015['serverUrl']||'';this['Configurations']=_0x1f0015[_0x0a9e('0x7')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0xb43b=['Configurations','exports','name','username','password','remoteUri','tenantId','clientSecret','serverUrl'];(function(_0x5e1358,_0x51fa66){var _0x4a16a6=function(_0x7fd22c){while(--_0x7fd22c){_0x5e1358['push'](_0x5e1358['shift']());}};_0x4a16a6(++_0x51fa66);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5cfc53,_0x20b989){_0x5cfc53=_0x5cfc53-0x0;var _0x21fec6=_0xb43b[_0x5cfc53];return _0x21fec6;};'use strict';function Dynamics365Account(_0x2ee678){this['id']=_0x2ee678['id']||0x0;this[_0xbb43('0x0')]=_0x2ee678['name']||'';this[_0xbb43('0x1')]=_0x2ee678[_0xbb43('0x1')]||'';this[_0xbb43('0x2')]=_0x2ee678['password']||'';this[_0xbb43('0x3')]=_0x2ee678[_0xbb43('0x3')]||'';this[_0xbb43('0x4')]=_0x2ee678[_0xbb43('0x4')]||'';this['clientId']=_0x2ee678['clientId']||'';this[_0xbb43('0x5')]=_0x2ee678['clientSecret']||{};this[_0xbb43('0x6')]=_0x2ee678[_0xbb43('0x6')]||'';this[_0xbb43('0x7')]=_0x2ee678[_0xbb43('0x7')]||{};}module[_0xbb43('0x8')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 770bec5..2c1248f 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 _0xbd7f=['gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','v17,v27,v29'];(function(_0x56c3d0,_0x558dff){var _0x3ea915=function(_0x3c9bca){while(--_0x3c9bca){_0x56c3d0['push'](_0x56c3d0['shift']());}};_0x3ea915(++_0x558dff);}(_0xbd7f,0x6f));var _0xfbd7=function(_0x1a27a1,_0x233ab9){_0x1a27a1=_0x1a27a1-0x0;var _0x8194a=_0xbd7f[_0x1a27a1];return _0x8194a;};'use strict';function FaxAccount(_0xd4d052){this['id']=_0xd4d052['id']||0x0;this[_0xfbd7('0x0')]=_0xd4d052[_0xfbd7('0x0')]||'';this[_0xfbd7('0x1')]=_0xd4d052[_0xfbd7('0x1')];this[_0xfbd7('0x2')]=_0xd4d052[_0xfbd7('0x2')];this[_0xfbd7('0x3')]=_0xd4d052[_0xfbd7('0x3')];this[_0xfbd7('0x4')]=_0xd4d052['localstationid'];this['minrate']=_0xd4d052[_0xfbd7('0x5')]||0x960;this[_0xfbd7('0x6')]=_0xd4d052[_0xfbd7('0x6')]||0x3840;this['modem']=_0xd4d052['modem']||_0xfbd7('0x7');this[_0xfbd7('0x8')]=_0xd4d052['gateway']||'no';this['faxdetect']=_0xd4d052[_0xfbd7('0x9')]||'no';this[_0xfbd7('0xa')]=_0xd4d052['t38timeout']||0x1388;this[_0xfbd7('0xb')]=_0xd4d052[_0xfbd7('0xb')]||_0xfbd7('0xc');this[_0xfbd7('0xd')]=_0xd4d052[_0xfbd7('0xd')]?_0xd4d052[_0xfbd7('0xd')]:undefined;this['ListId']=_0xd4d052[_0xfbd7('0xe')];this['key']=_0xd4d052[_0xfbd7('0xf')];}module[_0xfbd7('0x10')]=FaxAccount; \ No newline at end of file +var _0xd85e=['v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description','headerinfo','localstationid','maxrate','modem'];(function(_0x19b63f,_0x5aa47d){var _0x53ca6a=function(_0x17eba6){while(--_0x17eba6){_0x19b63f['push'](_0x19b63f['shift']());}};_0x53ca6a(++_0x5aa47d);}(_0xd85e,0x72));var _0xed85=function(_0x325bb6,_0x3a1811){_0x325bb6=_0x325bb6-0x0;var _0x1f0a86=_0xd85e[_0x325bb6];return _0x1f0a86;};'use strict';function FaxAccount(_0x286388){this['id']=_0x286388['id']||0x0;this[_0xed85('0x0')]=_0x286388[_0xed85('0x0')]||'';this[_0xed85('0x1')]=_0x286388['description'];this['ecm']=_0x286388['ecm'];this['headerinfo']=_0x286388[_0xed85('0x2')];this[_0xed85('0x3')]=_0x286388['localstationid'];this['minrate']=_0x286388['minrate']||0x960;this[_0xed85('0x4')]=_0x286388[_0xed85('0x4')]||0x3840;this['modem']=_0x286388[_0xed85('0x5')]||_0xed85('0x6');this[_0xed85('0x7')]=_0x286388['gateway']||'no';this[_0xed85('0x8')]=_0x286388['faxdetect']||'no';this['t38timeout']=_0x286388[_0xed85('0x9')]||0x1388;this[_0xed85('0xa')]=_0x286388[_0xed85('0xa')]||'SIP';this['Trunk']=_0x286388[_0xed85('0xb')]?_0x286388['Trunk']:undefined;this[_0xed85('0xc')]=_0x286388['ListId'];this[_0xed85('0xd')]=_0x286388[_0xed85('0xd')];}module[_0xed85('0xe')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 739dfad..d1eec99 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 _0x263f=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x47b168,_0x4d2b9a){var _0x47be9f=function(_0x3cf2c8){while(--_0x3cf2c8){_0x47b168['push'](_0x47b168['shift']());}};_0x47be9f(++_0x4d2b9a);}(_0x263f,0x197));var _0xf263=function(_0x4f597e,_0xa8e8){_0x4f597e=_0x4f597e-0x0;var _0xe19776=_0x263f[_0x4f597e];return _0xe19776;};'use strict';function FreshdeskAccount(_0x128f6a){this['id']=_0x128f6a['id']||0x0;this[_0xf263('0x0')]=_0x128f6a['name']||'';this[_0xf263('0x1')]=_0x128f6a[_0xf263('0x1')]||'';this[_0xf263('0x2')]=_0x128f6a[_0xf263('0x3')]||'';this[_0xf263('0x4')]=_0x128f6a[_0xf263('0x4')]||'';this[_0xf263('0x5')]=_0x128f6a['serverUrl']||'';this[_0xf263('0x6')]=_0x128f6a['Configurations']||{};}module[_0xf263('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0xfb34=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xfb34,0x1ed));var _0x4fb3=function(_0x3fe6df,_0x5a04d4){_0x3fe6df=_0x3fe6df-0x0;var _0x372a0e=_0xfb34[_0x3fe6df];return _0x372a0e;};'use strict';function FreshdeskAccount(_0x87cc73){this['id']=_0x87cc73['id']||0x0;this[_0x4fb3('0x0')]=_0x87cc73[_0x4fb3('0x0')]||'';this[_0x4fb3('0x1')]=_0x87cc73[_0x4fb3('0x1')]||'';this[_0x4fb3('0x2')]=_0x87cc73[_0x4fb3('0x3')]||'';this[_0x4fb3('0x4')]=_0x87cc73[_0x4fb3('0x4')]||'';this[_0x4fb3('0x5')]=_0x87cc73['serverUrl']||'';this[_0x4fb3('0x6')]=_0x87cc73[_0x4fb3('0x6')]||{};}module[_0x4fb3('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 e4317ee..35d8df1 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 _0xd8fb=['serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x40695f,_0x206ffc){var _0x1ff7db=function(_0x11f177){while(--_0x11f177){_0x40695f['push'](_0x40695f['shift']());}};_0x1ff7db(++_0x206ffc);}(_0xd8fb,0x99));var _0xbd8f=function(_0x20d94f,_0x454149){_0x20d94f=_0x20d94f-0x0;var _0x633ed=_0xd8fb[_0x20d94f];return _0x633ed;};'use strict';function FreshsalesAccount(_0x66e31){this['id']=_0x66e31['id']||0x0;this[_0xbd8f('0x0')]=_0x66e31[_0xbd8f('0x0')]||'';this[_0xbd8f('0x1')]=_0x66e31['username']||'';this['apiKey']=_0x66e31['token']||'';this[_0xbd8f('0x2')]=_0x66e31[_0xbd8f('0x2')]||'';this['serverUrl']=_0x66e31[_0xbd8f('0x3')]||'';this[_0xbd8f('0x4')]=_0x66e31['Configurations']||{};}module[_0xbd8f('0x5')]=FreshsalesAccount; \ No newline at end of file +var _0x35d0=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x297d6f,_0x12c8be){var _0x4e0852=function(_0x37780e){while(--_0x37780e){_0x297d6f['push'](_0x297d6f['shift']());}};_0x4e0852(++_0x12c8be);}(_0x35d0,0xf9));var _0x035d=function(_0x3239f5,_0x50e77c){_0x3239f5=_0x3239f5-0x0;var _0x3559c8=_0x35d0[_0x3239f5];return _0x3559c8;};'use strict';function FreshsalesAccount(_0x5dadff){this['id']=_0x5dadff['id']||0x0;this[_0x035d('0x0')]=_0x5dadff['name']||'';this[_0x035d('0x1')]=_0x5dadff[_0x035d('0x1')]||'';this[_0x035d('0x2')]=_0x5dadff[_0x035d('0x3')]||'';this[_0x035d('0x4')]=_0x5dadff[_0x035d('0x4')]||'';this['serverUrl']=_0x5dadff[_0x035d('0x5')]||'';this[_0x035d('0x6')]=_0x5dadff[_0x035d('0x6')]||{};}module[_0x035d('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 ec15394..004e341 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 _0xbe1a=['type','inbound','uniqueid','calleridnum','calleridname','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','channel','connectedlinename','context','exten','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables'];(function(_0x49adfe,_0x2fd329){var _0x1d53da=function(_0x4edbdb){while(--_0x4edbdb){_0x49adfe['push'](_0x49adfe['shift']());}};_0x1d53da(++_0x2fd329);}(_0xbe1a,0x15e));var _0xabe1=function(_0x22df0c,_0x4ff8f9){_0x22df0c=_0x22df0c-0x0;var _0x4cb882=_0xbe1a[_0x22df0c];return _0x4cb882;};'use strict';function QueueReport(){this[_0xabe1('0x0')]=_0xabe1('0x1');this[_0xabe1('0x2')]='';this[_0xabe1('0x3')]='';this[_0xabe1('0x4')]='';this['queue']='';this[_0xabe1('0x5')]=null;this[_0xabe1('0x6')]=null;this[_0xabe1('0x7')]=0x1;this[_0xabe1('0x8')]=0x1;this[_0xabe1('0x9')]=![];this[_0xabe1('0xa')]=null;this[_0xabe1('0xb')]=![];this['queuecallercompleteAt']=null;this[_0xabe1('0xc')]=![];this[_0xabe1('0xd')]=null;this['originalposition']=0x1;this[_0xabe1('0xe')]='';this['connectedlinenum']='';this[_0xabe1('0xf')]='';this['accountcode']='';this[_0xabe1('0x10')]='';this[_0xabe1('0x11')]='';this['priority']='';this[_0xabe1('0x12')]=0x0;this[_0xabe1('0x13')]=![];this[_0xabe1('0x14')]='';this[_0xabe1('0x15')]=_0xabe1('0x16');this[_0xabe1('0x17')]=0x0;this[_0xabe1('0x18')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0xd3db=['queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','exten','holdtime','assigned','lastAssignedTo','voice','mohtime','exports','type','inbound','uniqueid','calleridnum','calleridname'];(function(_0x838813,_0x448f0f){var _0x2bd32d=function(_0x57b589){while(--_0x57b589){_0x838813['push'](_0x838813['shift']());}};_0x2bd32d(++_0x448f0f);}(_0xd3db,0x199));var _0xbd3d=function(_0x1820c5,_0x5368fb){_0x1820c5=_0x1820c5-0x0;var _0x163d38=_0xd3db[_0x1820c5];return _0x163d38;};'use strict';function QueueReport(){this[_0xbd3d('0x0')]=_0xbd3d('0x1');this[_0xbd3d('0x2')]='';this[_0xbd3d('0x3')]='';this[_0xbd3d('0x4')]='';this[_0xbd3d('0x5')]='';this[_0xbd3d('0x6')]=null;this[_0xbd3d('0x7')]=null;this[_0xbd3d('0x8')]=0x1;this['count']=0x1;this['queuecallerabandon']=![];this[_0xbd3d('0x9')]=null;this[_0xbd3d('0xa')]=![];this[_0xbd3d('0xb')]=null;this['queuecallerexit']=![];this[_0xbd3d('0xc')]=null;this[_0xbd3d('0xd')]=0x1;this['channel']='';this[_0xbd3d('0xe')]='';this[_0xbd3d('0xf')]='';this['accountcode']='';this['context']='';this[_0xbd3d('0x10')]='';this['priority']='';this[_0xbd3d('0x11')]=0x0;this[_0xbd3d('0x12')]=![];this[_0xbd3d('0x13')]='';this['motionChannel']=_0xbd3d('0x14');this[_0xbd3d('0x15')]=0x0;this['variables']={};}module[_0xbd3d('0x16')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 889a4bf..a5d96c3 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 _0x69b5=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name'];(function(_0x570878,_0x4fc7de){var _0x43397a=function(_0x533bd7){while(--_0x533bd7){_0x570878['push'](_0x570878['shift']());}};_0x43397a(++_0x4fc7de);}(_0x69b5,0x18b));var _0x569b=function(_0x2050f7,_0x3833c6){_0x2050f7=_0x2050f7-0x0;var _0x219da1=_0x69b5[_0x2050f7];return _0x219da1;};'use strict';function SalesforceAccount(_0x123026){this['id']=_0x123026['id']||0x0;this[_0x569b('0x0')]=_0x123026[_0x569b('0x0')]||'';this['username']=_0x123026[_0x569b('0x1')]||'';this[_0x569b('0x2')]=_0x123026[_0x569b('0x2')]||'';this[_0x569b('0x3')]=_0x123026[_0x569b('0x3')]||'';this[_0x569b('0x4')]=_0x123026[_0x569b('0x4')]||'';this[_0x569b('0x5')]=_0x123026[_0x569b('0x5')]||'';this['securityToken']=_0x123026[_0x569b('0x6')]||'';this[_0x569b('0x7')]=_0x123026['type']||_0x569b('0x8');this['serverUrl']=_0x123026[_0x569b('0x9')]||'';this[_0x569b('0xa')]=_0x123026[_0x569b('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x3cdd=['exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations'];(function(_0x1051b2,_0x21810e){var _0x4b302b=function(_0x4d7d0a){while(--_0x4d7d0a){_0x1051b2['push'](_0x1051b2['shift']());}};_0x4b302b(++_0x21810e);}(_0x3cdd,0xb5));var _0xd3cd=function(_0x516414,_0x3fda1c){_0x516414=_0x516414-0x0;var _0x1aaa21=_0x3cdd[_0x516414];return _0x1aaa21;};'use strict';function SalesforceAccount(_0x52f0d3){this['id']=_0x52f0d3['id']||0x0;this[_0xd3cd('0x0')]=_0x52f0d3[_0xd3cd('0x0')]||'';this[_0xd3cd('0x1')]=_0x52f0d3['username']||'';this['remoteUri']=_0x52f0d3[_0xd3cd('0x2')]||'';this[_0xd3cd('0x3')]=_0x52f0d3[_0xd3cd('0x3')]||'';this[_0xd3cd('0x4')]=_0x52f0d3['clientId']||'';this['clientSecret']=_0x52f0d3[_0xd3cd('0x5')]||'';this[_0xd3cd('0x6')]=_0x52f0d3['securityToken']||'';this[_0xd3cd('0x7')]=_0x52f0d3[_0xd3cd('0x7')]||_0xd3cd('0x8');this[_0xd3cd('0x9')]=_0x52f0d3[_0xd3cd('0x9')]||'';this[_0xd3cd('0xa')]=_0x52f0d3[_0xd3cd('0xa')]||{};}module[_0xd3cd('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index d0030d6..ed035f3 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 _0xa61c=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xa61c,0x132));var _0xca61=function(_0x2d4936,_0x254806){_0x2d4936=_0x2d4936-0x0;var _0x88c89=_0xa61c[_0x2d4936];return _0x88c89;};'use strict';function ServicenowAccount(_0x21782e){this['id']=_0x21782e['id']||0x0;this[_0xca61('0x0')]=_0x21782e['name']||'';this['username']=_0x21782e[_0xca61('0x1')]||'';this[_0xca61('0x2')]=_0x21782e[_0xca61('0x2')]||'';this['remoteUri']=_0x21782e[_0xca61('0x3')]||'';this[_0xca61('0x4')]=_0x21782e[_0xca61('0x4')]||'';this[_0xca61('0x5')]=_0x21782e[_0xca61('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0xedc1=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x2087e4,_0x34d318){var _0x5bb608=function(_0x8e7f3c){while(--_0x8e7f3c){_0x2087e4['push'](_0x2087e4['shift']());}};_0x5bb608(++_0x34d318);}(_0xedc1,0x1ab));var _0x1edc=function(_0x15482e,_0x25b23c){_0x15482e=_0x15482e-0x0;var _0x4a0651=_0xedc1[_0x15482e];return _0x4a0651;};'use strict';function ServicenowAccount(_0xce1ddd){this['id']=_0xce1ddd['id']||0x0;this['name']=_0xce1ddd[_0x1edc('0x0')]||'';this['username']=_0xce1ddd[_0x1edc('0x1')]||'';this['password']=_0xce1ddd[_0x1edc('0x2')]||'';this[_0x1edc('0x3')]=_0xce1ddd[_0x1edc('0x3')]||'';this[_0x1edc('0x4')]=_0xce1ddd[_0x1edc('0x4')]||'';this['Configurations']=_0xce1ddd[_0x1edc('0x5')]||{};}module[_0x1edc('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 91e06a1..0a62b80 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 _0xff13=['username','password','remoteUri','serverUrl','Configurations','name'];(function(_0xe563d5,_0x417bf7){var _0x1572c8=function(_0x192a7c){while(--_0x192a7c){_0xe563d5['push'](_0xe563d5['shift']());}};_0x1572c8(++_0x417bf7);}(_0xff13,0x137));var _0x3ff1=function(_0x3b2e53,_0x23a035){_0x3b2e53=_0x3b2e53-0x0;var _0x18bbd8=_0xff13[_0x3b2e53];return _0x18bbd8;};'use strict';function SugarcrmAccount(_0x1fef9c){this['id']=_0x1fef9c['id']||0x0;this[_0x3ff1('0x0')]=_0x1fef9c[_0x3ff1('0x0')]||'';this[_0x3ff1('0x1')]=_0x1fef9c['username']||'';this[_0x3ff1('0x2')]=_0x1fef9c[_0x3ff1('0x2')]||'';this[_0x3ff1('0x3')]=_0x1fef9c[_0x3ff1('0x3')]||'';this['serverUrl']=_0x1fef9c[_0x3ff1('0x4')]||'';this[_0x3ff1('0x5')]=_0x1fef9c['Configurations']||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x6618=['name','username','password','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6618,0xb8));var _0x8661=function(_0x2bed54,_0xd54293){_0x2bed54=_0x2bed54-0x0;var _0x7c3ae6=_0x6618[_0x2bed54];return _0x7c3ae6;};'use strict';function SugarcrmAccount(_0x3f77aa){this['id']=_0x3f77aa['id']||0x0;this[_0x8661('0x0')]=_0x3f77aa[_0x8661('0x0')]||'';this[_0x8661('0x1')]=_0x3f77aa[_0x8661('0x1')]||'';this[_0x8661('0x2')]=_0x3f77aa['password']||'';this[_0x8661('0x3')]=_0x3f77aa['remoteUri']||'';this['serverUrl']=_0x3f77aa['serverUrl']||'';this['Configurations']=_0x3f77aa['Configurations']||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 8921028..93a48c7 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 _0xd763=['status','unknown','address','exports','accountcode','state','stateTime'];(function(_0x3290ae,_0x220797){var _0x2af6bf=function(_0x2168ad){while(--_0x2168ad){_0x3290ae['push'](_0x3290ae['shift']());}};_0x2af6bf(++_0x220797);}(_0xd763,0x17e));var _0x3d76=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xd763[_0x4fbfd9];return _0x31dc94;};'use strict';function Telephone(_0x5cc5c3){this['id']=_0x5cc5c3['id']||0x0;this['name']=_0x5cc5c3['name']||'';this[_0x3d76('0x0')]=_0x5cc5c3[_0x3d76('0x0')]||'';this[_0x3d76('0x1')]='unknown';this[_0x3d76('0x2')]=0x0;this[_0x3d76('0x3')]=_0x3d76('0x4');this[_0x3d76('0x5')]='';}module[_0x3d76('0x6')]=Telephone; \ No newline at end of file +var _0x6aa4=['address','exports','name','accountcode','state','unknown','stateTime','status'];(function(_0x115a45,_0x375a9d){var _0x289dd9=function(_0x136649){while(--_0x136649){_0x115a45['push'](_0x115a45['shift']());}};_0x289dd9(++_0x375a9d);}(_0x6aa4,0xb2));var _0x46aa=function(_0x4453a4,_0xca002c){_0x4453a4=_0x4453a4-0x0;var _0x15f835=_0x6aa4[_0x4453a4];return _0x15f835;};'use strict';function Telephone(_0x24790f){this['id']=_0x24790f['id']||0x0;this[_0x46aa('0x0')]=_0x24790f[_0x46aa('0x0')]||'';this['accountcode']=_0x24790f[_0x46aa('0x1')]||'';this[_0x46aa('0x2')]=_0x46aa('0x3');this[_0x46aa('0x4')]=0x0;this[_0x46aa('0x5')]=_0x46aa('0x3');this[_0x46aa('0x6')]='';}module[_0x46aa('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 73a1196..f04ebc0 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','html'];(function(_0x440436,_0x41a810){var _0x32e74e=function(_0xe9025b){while(--_0xe9025b){_0x440436['push'](_0x440436['shift']());}};_0x32e74e(++_0x41a810);}(_0xb10b,0x12a));var _0xbb10=function(_0x38fbc2,_0x641aa1){_0x38fbc2=_0x38fbc2-0x0;var _0x43c7d4=_0xb10b[_0x38fbc2];return _0x43c7d4;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0xc9bde2,_0x49e3ec){var _0x4a468d=function(_0x57714a){while(--_0x57714a){_0xc9bde2['push'](_0xc9bde2['shift']());}};_0x4a468d(++_0x49e3ec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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 3ff3aab..8793d7f 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(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x1a85,0x178));var _0x51a8=function(_0x27787d,_0x3c832a){_0x27787d=_0x27787d-0x0;var _0x2ec19c=_0x1a85[_0x27787d];return _0x2ec19c;};'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 _0xb10b=['AllConditions','AnyConditions','Actions','exports','name','channel','status'];(function(_0x52286f,_0x235214){var _0x2b2c86=function(_0x432992){while(--_0x432992){_0x52286f['push'](_0x52286f['shift']());}};_0x2b2c86(++_0x235214);}(_0xb10b,0x12a));var _0xbb10=function(_0x2b63a0,_0x14fc48){_0x2b63a0=_0x2b63a0-0x0;var _0x4f0434=_0xb10b[_0x2b63a0];return _0x4f0434;};'use strict';function Trigger(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'voice';this[_0xbb10('0x2')]=_0x13ce8d[_0xbb10('0x2')]||![];this[_0xbb10('0x3')]=_0x13ce8d[_0xbb10('0x3')]||[];this[_0xbb10('0x4')]=_0x13ce8d[_0xbb10('0x4')]||[];this['Actions']=_0x13ce8d[_0xbb10('0x5')]||[];}module[_0xbb10('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index b011b26..5d40886 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 _0x701c=['split','port','domain','domainport','refresh','stateRegistry','address','defaultuser','exports','active','name','state','unknown','stateTime','status','registry','indexOf'];(function(_0x531d15,_0x599af5){var _0x271a18=function(_0x31284d){while(--_0x31284d){_0x531d15['push'](_0x531d15['shift']());}};_0x271a18(++_0x599af5);}(_0x701c,0xb3));var _0xc701=function(_0xa05fd3,_0x4c6517){_0xa05fd3=_0xa05fd3-0x0;var _0x581738=_0x701c[_0xa05fd3];return _0x581738;};'use strict';function Trunk(_0x405b8b){this['id']=_0x405b8b['id']||0x0;this[_0xc701('0x0')]=_0x405b8b[_0xc701('0x0')]||![];this[_0xc701('0x1')]=_0x405b8b['name']||'';this[_0xc701('0x2')]=_0xc701('0x3');this[_0xc701('0x4')]=0x0;this[_0xc701('0x5')]='unknown';this[_0xc701('0x6')]=_0x405b8b[_0xc701('0x6')]&&_0x405b8b[_0xc701('0x6')][_0xc701('0x7')](':')?_0x405b8b[_0xc701('0x6')][_0xc701('0x8')](':')[0x0]:'';this['host']='';this[_0xc701('0x9')]='';this[_0xc701('0xa')]='';this[_0xc701('0xb')]='';this[_0xc701('0xc')]='';this[_0xc701('0xd')]=_0xc701('0x3');this['registrationtime']='';this[_0xc701('0xe')]='';this[_0xc701('0xf')]=_0x405b8b['defaultuser']||'';}module[_0xc701('0x10')]=Trunk; \ No newline at end of file +var _0x7057=['registry','indexOf','split','host','port','domainport','refresh','registrationtime','address','defaultuser','active','name','state','unknown','stateTime','status'];(function(_0x2e137e,_0x3ec457){var _0x2d92ac=function(_0x59afcf){while(--_0x59afcf){_0x2e137e['push'](_0x2e137e['shift']());}};_0x2d92ac(++_0x3ec457);}(_0x7057,0x12a));var _0x7705=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x7057[_0x199572];return _0x13cfa3;};'use strict';function Trunk(_0x4396de){this['id']=_0x4396de['id']||0x0;this[_0x7705('0x0')]=_0x4396de['active']||![];this[_0x7705('0x1')]=_0x4396de[_0x7705('0x1')]||'';this[_0x7705('0x2')]=_0x7705('0x3');this[_0x7705('0x4')]=0x0;this[_0x7705('0x5')]=_0x7705('0x3');this[_0x7705('0x6')]=_0x4396de[_0x7705('0x6')]&&_0x4396de[_0x7705('0x6')][_0x7705('0x7')](':')?_0x4396de[_0x7705('0x6')][_0x7705('0x8')](':')[0x0]:'';this[_0x7705('0x9')]='';this[_0x7705('0xa')]='';this['domain']='';this[_0x7705('0xb')]='';this[_0x7705('0xc')]='';this['stateRegistry']=_0x7705('0x3');this[_0x7705('0xd')]='';this[_0x7705('0xe')]='';this[_0x7705('0xf')]=_0x4396de[_0x7705('0xf')]||'';}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 39f8439..230c7d3 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 _0xcf5d=['exten','recordingFormat','none','mandatoryDisposition'];(function(_0x51b551,_0x333457){var _0x4ac3f0=function(_0x45afc2){while(--_0x45afc2){_0x51b551['push'](_0x51b551['shift']());}};_0x4ac3f0(++_0x333457);}(_0xcf5d,0x144));var _0xdcf5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf5d[_0x3dd15e];return _0x231fd0;};'use strict';function voiceExtension(_0x2b3e93){this['id']=_0x2b3e93['id']||0x0;this['exten']=_0x2b3e93[_0xdcf5('0x0')]||'';this[_0xdcf5('0x1')]=_0x2b3e93['recordingFormat']||_0xdcf5('0x2');this[_0xdcf5('0x3')]=_0x2b3e93['mandatoryDisposition']||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x12a3=['recordingFormat','mandatoryDisposition','exports','exten'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x12a3,0x83));var _0x312a=function(_0xc0c9b4,_0x5a2bb0){_0xc0c9b4=_0xc0c9b4-0x0;var _0x375b9f=_0x12a3[_0xc0c9b4];return _0x375b9f;};'use strict';function voiceExtension(_0x5920ad){this['id']=_0x5920ad['id']||0x0;this[_0x312a('0x0')]=_0x5920ad[_0x312a('0x0')]||'';this['recordingFormat']=_0x5920ad[_0x312a('0x1')]||'none';this[_0x312a('0x2')]=_0x5920ad[_0x312a('0x2')]||![];}module[_0x312a('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 5bc8409..faab6af 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 _0xfe7a=['outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','exports','unknown','inuse','busy','unavailable','ringing','ringinuse','onhold','wav','gsm','rrmemory','name','monitor_format','type','waiting','talking','total','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay'];(function(_0x3902bc,_0x3ac4dc){var _0x3f89c6=function(_0xcf7d52){while(--_0xcf7d52){_0x3902bc['push'](_0x3902bc['shift']());}};_0x3f89c6(++_0x3ac4dc);}(_0xfe7a,0x11d));var _0xafe7=function(_0x293947,_0x1ac925){_0x293947=_0x293947-0x0;var _0x585cc8=_0xfe7a[_0x293947];return _0x585cc8;};'use strict';var statusDesc=[_0xafe7('0x0'),'not_inuse',_0xafe7('0x1'),_0xafe7('0x2'),'invalid',_0xafe7('0x3'),_0xafe7('0x4'),_0xafe7('0x5'),_0xafe7('0x6')];var monitorFormat={'wav':_0xafe7('0x7'),'wav49':'wav49','gsm':_0xafe7('0x8')};var strategy={'rrmemory':_0xafe7('0x9'),'roundrobin':'roundrobin'};function VoiceQueue(_0x4d1575){this['id']=_0x4d1575['id']||0x0;this[_0xafe7('0xa')]=_0x4d1575[_0xafe7('0xa')]||'';this['monitor_format']=_0x4d1575[_0xafe7('0xb')]||'';this['type']=_0x4d1575[_0xafe7('0xc')]||'inbound';this[_0xafe7('0xd')]=0x0;this[_0xafe7('0xe')]=0x0;this[_0xafe7('0xf')]=0x0;this['answered']=0x0;this[_0xafe7('0x10')]=0x0;this[_0xafe7('0x11')]=0x0;this[_0xafe7('0x12')]=0x0;this[_0xafe7('0x13')]=0x0;this[_0xafe7('0x14')]=0x0;this[_0xafe7('0x15')]=0x0;this[_0xafe7('0x16')]=0x0;this[_0xafe7('0x17')]=_0x4d1575[_0xafe7('0x17')]||![];this['acwTimeout']=_0x4d1575[_0xafe7('0x18')]||0xa;this[_0xafe7('0x19')]=_0x4d1575[_0xafe7('0x19')]||'no';this[_0xafe7('0x1a')]=!![];this['message']='';this[_0xafe7('0x1b')]=0x0;this[_0xafe7('0x1c')]=0x0;this[_0xafe7('0x1d')]=_0x4d1575['dialTimezone']||null;this[_0xafe7('0x1e')]=_0x4d1575[_0xafe7('0x1e')]?_0x4d1575[_0xafe7('0x1e')]:null;this[_0xafe7('0x1f')]=_0x4d1575[_0xafe7('0x1f')];this[_0xafe7('0x20')]=_0x4d1575['dialMethod']||'progressive';this[_0xafe7('0x21')]=_0x4d1575[_0xafe7('0x21')]||0x0;this[_0xafe7('0x22')]=_0x4d1575[_0xafe7('0x22')]||0x0;this[_0xafe7('0x23')]=_0x4d1575['dialPowerLevel']||0x1;this[_0xafe7('0x24')]=_0x4d1575[_0xafe7('0x24')]||_0xafe7('0x25');this[_0xafe7('0x26')]=_0x4d1575['dialPredictiveOptimizationPercentage']||0.03;this[_0xafe7('0x27')]=_0x4d1575[_0xafe7('0x27')]||0x258;this[_0xafe7('0x28')]=_0x4d1575[_0xafe7('0x28')]||_0xafe7('0x29');this[_0xafe7('0x2a')]=_0x4d1575[_0xafe7('0x2a')]||_0xafe7('0x29');this[_0xafe7('0x2b')]=_0x4d1575[_0xafe7('0x2b')]||0x1e;this['dialQueueOptions']=_0x4d1575[_0xafe7('0x2c')]||'tTxX';this['dialQueueTimeout']=_0x4d1575[_0xafe7('0x2d')]||0x3;this[_0xafe7('0x2e')]=_0x4d1575['dialQueueProject']||undefined;this[_0xafe7('0x2f')]=_0x4d1575['dialCongestionMaxRetry']||0x3;this['dialCongestionRetryFrequency']=_0x4d1575[_0xafe7('0x30')]||0x96;this[_0xafe7('0x31')]=_0x4d1575[_0xafe7('0x31')]||0x3;this[_0xafe7('0x32')]=_0x4d1575[_0xafe7('0x32')]||0x96;this['dialNoAnswerMaxRetry']=_0x4d1575['dialNoAnswerMaxRetry']||0x3;this['dialNoAnswerRetryFrequency']=_0x4d1575[_0xafe7('0x33')]||0x96;this[_0xafe7('0x34')]=_0x4d1575[_0xafe7('0x34')]||0x3;this[_0xafe7('0x35')]=_0x4d1575[_0xafe7('0x35')]||0x96;this[_0xafe7('0x36')]=_0x4d1575[_0xafe7('0x36')]||0x3;this[_0xafe7('0x37')]=_0x4d1575[_0xafe7('0x37')]||0x96;this[_0xafe7('0x38')]=_0x4d1575[_0xafe7('0x38')]||0x3;this[_0xafe7('0x39')]=_0x4d1575['dialAbandonedRetryFrequency']||0x96;this[_0xafe7('0x3a')]=_0x4d1575[_0xafe7('0x3a')]||0x3;this[_0xafe7('0x3b')]=_0x4d1575[_0xafe7('0x3b')]||0x96;this[_0xafe7('0x3c')]=_0x4d1575[_0xafe7('0x3c')]||0x3;this[_0xafe7('0x3d')]=_0x4d1575[_0xafe7('0x3d')]||0x96;this['dialGlobalMaxRetry']=_0x4d1575[_0xafe7('0x3e')]||0x4;this[_0xafe7('0x3f')]=_0x4d1575[_0xafe7('0x3f')]?_0x4d1575[_0xafe7('0x3f')]:undefined;this['TrunkBackup']=_0x4d1575['TrunkBackup']?_0x4d1575[_0xafe7('0x40')]:undefined;this[_0xafe7('0x41')]=_0x4d1575[_0xafe7('0x41')]||undefined;this['Interval']=_0x4d1575[_0xafe7('0x42')]?_0x4d1575[_0xafe7('0x42')]:undefined;this['dialOrderByScheduledAt']=_0x4d1575[_0xafe7('0x43')]||_0xafe7('0x44');this[_0xafe7('0x45')]=_0x4d1575[_0xafe7('0x45')]||undefined;this[_0xafe7('0x46')]=_0x4d1575[_0xafe7('0x46')]||undefined;this[_0xafe7('0x47')]=strategy[_0x4d1575['strategy']]||_0xafe7('0x9');this[_0xafe7('0x48')]=!![];this[_0xafe7('0x49')]=_0x4d1575['dialAMDActive']||![];this[_0xafe7('0x4a')]=_0x4d1575[_0xafe7('0x4a')];this[_0xafe7('0x4b')]=_0x4d1575['dialAMDGreeting'];this[_0xafe7('0x4c')]=_0x4d1575[_0xafe7('0x4c')];this[_0xafe7('0x4d')]=_0x4d1575[_0xafe7('0x4d')];this[_0xafe7('0x4e')]=_0x4d1575['dialAMDMinWordLength'];this[_0xafe7('0x4f')]=_0x4d1575[_0xafe7('0x4f')];this[_0xafe7('0x50')]=_0x4d1575['dialAMDMaximumNumberOfWords'];this[_0xafe7('0x51')]=_0x4d1575[_0xafe7('0x51')];this[_0xafe7('0x52')]=_0x4d1575[_0xafe7('0x52')];this[_0xafe7('0x53')]=0x0;this[_0xafe7('0x54')]=0x0;this[_0xafe7('0x55')]=_0x4d1575[_0xafe7('0x55')];this[_0xafe7('0x56')]=0x0;this[_0xafe7('0x57')]=0x0;this[_0xafe7('0x58')]=0x0;this[_0xafe7('0x59')]=0x0;this['outboundCongestionCallsDay']=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0xafe7('0x5a')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xafe7('0x5b')]=0x0;this[_0xafe7('0x5c')]=0x0;this[_0xafe7('0x5d')]=0x0;this[_0xafe7('0x5e')]=0x0;this[_0xafe7('0x5f')]=0x0;this['outboundAbandonedDay']=0x0;this[_0xafe7('0x60')]=undefined;this[_0xafe7('0x61')]=undefined;this[_0xafe7('0x62')]=undefined;this[_0xafe7('0x63')]=1.05;this[_0xafe7('0x64')]=0x0;this[_0xafe7('0x65')]=0x0;this[_0xafe7('0x66')]=0x0;this[_0xafe7('0x67')]=0x0;this[_0xafe7('0x68')]=0x0;this[_0xafe7('0x69')]=0x0;this[_0xafe7('0x6a')]=0x0;this[_0xafe7('0x6b')]=0x0;this[_0xafe7('0x6c')]=_0x4d1575[_0xafe7('0x6d')]||0x14;this['predictiveIntervalMinThreshold']=_0x4d1575['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xafe7('0x6e')]=0x0;this[_0xafe7('0x6f')]=0x0;this[_0xafe7('0x70')]=0x1;this['erlangCalls']=0x0;this[_0xafe7('0x71')]=0x0;this[_0xafe7('0x72')]=0x0;this[_0xafe7('0x73')]=0x0;this[_0xafe7('0x74')]=_0x4d1575[_0xafe7('0x74')]||0x1e;this['dialRecallInQueue']=_0x4d1575[_0xafe7('0x75')]||![];this['dialPreviewAutoRecallMe']=!!_0x4d1575[_0xafe7('0x76')]||![];this[_0xafe7('0x77')]=!!_0x4d1575[_0xafe7('0x77')]||![];this[_0xafe7('0x78')]=_0x4d1575[_0xafe7('0x78')]||undefined;this[_0xafe7('0x79')]=_0x4d1575[_0xafe7('0x79')]||![];this[_0xafe7('0x7a')]=_0x4d1575[_0xafe7('0x7a')]||![];this[_0xafe7('0xb')]=monitorFormat[_0x4d1575[_0xafe7('0xb')]]?monitorFormat[_0x4d1575[_0xafe7('0xb')]]:undefined;this['mandatoryDisposition']=_0x4d1575['mandatoryDisposition']||![];this[_0xafe7('0x7b')]=_0x4d1575[_0xafe7('0x7b')]?_0x4d1575[_0xafe7('0x7b')]:undefined;}module[_0xafe7('0x7c')]=VoiceQueue; \ No newline at end of file +var _0x5ae7=['dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','inuse','invalid','unavailable','ringing','ringinuse','onhold','gsm','rrmemory','roundrobin','name','monitor_format','type','waiting','talking','total','sumDuration','sumHoldTime','sumBillable','abandoned','loggedIn','available','acw','acwTimeout','autopause','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate'];(function(_0x29dda1,_0x508e13){var _0x21b0ef=function(_0x118906){while(--_0x118906){_0x29dda1['push'](_0x29dda1['shift']());}};_0x21b0ef(++_0x508e13);}(_0x5ae7,0x140));var _0x75ae=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x5ae7[_0x2aec52];return _0x3b8835;};'use strict';var statusDesc=[_0x75ae('0x0'),'not_inuse',_0x75ae('0x1'),'busy',_0x75ae('0x2'),_0x75ae('0x3'),_0x75ae('0x4'),_0x75ae('0x5'),_0x75ae('0x6')];var monitorFormat={'wav':'wav','wav49':'wav49','gsm':_0x75ae('0x7')};var strategy={'rrmemory':_0x75ae('0x8'),'roundrobin':_0x75ae('0x9')};function VoiceQueue(_0x16797d){this['id']=_0x16797d['id']||0x0;this[_0x75ae('0xa')]=_0x16797d[_0x75ae('0xa')]||'';this[_0x75ae('0xb')]=_0x16797d[_0x75ae('0xb')]||'';this[_0x75ae('0xc')]=_0x16797d[_0x75ae('0xc')]||'inbound';this[_0x75ae('0xd')]=0x0;this[_0x75ae('0xe')]=0x0;this[_0x75ae('0xf')]=0x0;this['answered']=0x0;this[_0x75ae('0x10')]=0x0;this[_0x75ae('0x11')]=0x0;this[_0x75ae('0x12')]=0x0;this['unmanaged']=0x0;this[_0x75ae('0x13')]=0x0;this[_0x75ae('0x14')]=0x0;this[_0x75ae('0x15')]=0x0;this[_0x75ae('0x16')]=_0x16797d[_0x75ae('0x16')]||![];this['acwTimeout']=_0x16797d[_0x75ae('0x17')]||0xa;this[_0x75ae('0x18')]=_0x16797d['autopause']||'no';this['sendMessageOneNotActive']=!![];this[_0x75ae('0x19')]='';this[_0x75ae('0x1a')]=0x0;this['temp']=0x0;this[_0x75ae('0x1b')]=_0x16797d[_0x75ae('0x1b')]||null;this[_0x75ae('0x1c')]=_0x16797d[_0x75ae('0x1c')]?_0x16797d[_0x75ae('0x1c')]:null;this[_0x75ae('0x1d')]=_0x16797d[_0x75ae('0x1d')];this['dialMethod']=_0x16797d[_0x75ae('0x1e')]||_0x75ae('0x1f');this[_0x75ae('0x20')]=_0x16797d[_0x75ae('0x20')]||0x0;this[_0x75ae('0x21')]=_0x16797d['dialLimitQueue']||0x0;this[_0x75ae('0x22')]=_0x16797d[_0x75ae('0x22')]||0x1;this[_0x75ae('0x23')]=_0x16797d[_0x75ae('0x23')]||_0x75ae('0x24');this[_0x75ae('0x25')]=_0x16797d[_0x75ae('0x25')]||0.03;this[_0x75ae('0x26')]=_0x16797d[_0x75ae('0x26')]||0x258;this[_0x75ae('0x27')]=_0x16797d[_0x75ae('0x27')]||_0x75ae('0x28');this['dialOriginateCallerIdNumber']=_0x16797d[_0x75ae('0x29')]||_0x75ae('0x28');this[_0x75ae('0x2a')]=_0x16797d['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x16797d[_0x75ae('0x2b')]||'tTxX';this['dialQueueTimeout']=_0x16797d['dialQueueTimeout']||0x3;this[_0x75ae('0x2c')]=_0x16797d[_0x75ae('0x2c')]||undefined;this[_0x75ae('0x2d')]=_0x16797d[_0x75ae('0x2d')]||0x3;this[_0x75ae('0x2e')]=_0x16797d[_0x75ae('0x2e')]||0x96;this[_0x75ae('0x2f')]=_0x16797d[_0x75ae('0x2f')]||0x3;this[_0x75ae('0x30')]=_0x16797d['dialBusyRetryFrequency']||0x96;this[_0x75ae('0x31')]=_0x16797d[_0x75ae('0x31')]||0x3;this[_0x75ae('0x32')]=_0x16797d[_0x75ae('0x32')]||0x96;this[_0x75ae('0x33')]=_0x16797d['dialNoSuchNumberMaxRetry']||0x3;this[_0x75ae('0x34')]=_0x16797d[_0x75ae('0x34')]||0x96;this[_0x75ae('0x35')]=_0x16797d[_0x75ae('0x35')]||0x3;this[_0x75ae('0x36')]=_0x16797d[_0x75ae('0x36')]||0x96;this['dialAbandonedMaxRetry']=_0x16797d['dialAbandonedMaxRetry']||0x3;this[_0x75ae('0x37')]=_0x16797d[_0x75ae('0x37')]||0x96;this[_0x75ae('0x38')]=_0x16797d[_0x75ae('0x38')]||0x3;this[_0x75ae('0x39')]=_0x16797d[_0x75ae('0x39')]||0x96;this[_0x75ae('0x3a')]=_0x16797d['dialAgentRejectMaxRetry']||0x3;this[_0x75ae('0x3b')]=_0x16797d[_0x75ae('0x3b')]||0x96;this[_0x75ae('0x3c')]=_0x16797d[_0x75ae('0x3c')]||0x4;this['Trunk']=_0x16797d['Trunk']?_0x16797d[_0x75ae('0x3d')]:undefined;this[_0x75ae('0x3e')]=_0x16797d['TrunkBackup']?_0x16797d[_0x75ae('0x3e')]:undefined;this[_0x75ae('0x3f')]=_0x16797d[_0x75ae('0x3f')]||undefined;this[_0x75ae('0x40')]=_0x16797d[_0x75ae('0x40')]?_0x16797d[_0x75ae('0x40')]:undefined;this['dialOrderByScheduledAt']=_0x16797d[_0x75ae('0x41')]||'DESC';this[_0x75ae('0x42')]=_0x16797d[_0x75ae('0x42')]||undefined;this['dialCutDigit']=_0x16797d[_0x75ae('0x43')]||undefined;this[_0x75ae('0x44')]=strategy[_0x16797d['strategy']]||_0x75ae('0x8');this[_0x75ae('0x45')]=!![];this[_0x75ae('0x46')]=_0x16797d[_0x75ae('0x46')]||![];this[_0x75ae('0x47')]=_0x16797d[_0x75ae('0x47')];this['dialAMDGreeting']=_0x16797d[_0x75ae('0x48')];this['dialAMDAfterGreetingSilence']=_0x16797d['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x16797d[_0x75ae('0x49')];this[_0x75ae('0x4a')]=_0x16797d[_0x75ae('0x4a')];this[_0x75ae('0x4b')]=_0x16797d[_0x75ae('0x4b')];this['dialAMDMaximumNumberOfWords']=_0x16797d[_0x75ae('0x4c')];this[_0x75ae('0x4d')]=_0x16797d[_0x75ae('0x4d')];this[_0x75ae('0x4e')]=_0x16797d['dialAMDMaximumWordLength'];this[_0x75ae('0x4f')]=0x0;this[_0x75ae('0x50')]=0x0;this[_0x75ae('0x51')]=_0x16797d[_0x75ae('0x51')];this[_0x75ae('0x52')]=0x0;this[_0x75ae('0x53')]=0x0;this[_0x75ae('0x54')]=0x0;this[_0x75ae('0x55')]=0x0;this[_0x75ae('0x56')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x75ae('0x57')]=0x0;this[_0x75ae('0x58')]=0x0;this[_0x75ae('0x59')]=0x0;this[_0x75ae('0x5a')]=0x0;this[_0x75ae('0x5b')]=0x0;this[_0x75ae('0x5c')]=0x0;this[_0x75ae('0x5d')]=0x0;this['outboundAbandonedDay']=0x0;this['startProgressive']=undefined;this[_0x75ae('0x5e')]=undefined;this['handlePredictive']=undefined;this[_0x75ae('0x5f')]=1.05;this[_0x75ae('0x60')]=0x0;this[_0x75ae('0x61')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x75ae('0x62')]=0x0;this[_0x75ae('0x63')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x75ae('0x64')]=0x0;this[_0x75ae('0x65')]=0x0;this[_0x75ae('0x66')]=_0x16797d[_0x75ae('0x67')]||0x14;this['predictiveIntervalMinThreshold']=_0x16797d['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x75ae('0x68')]=0x0;this[_0x75ae('0x69')]=0x0;this[_0x75ae('0x6a')]=0x1;this[_0x75ae('0x6b')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this[_0x75ae('0x6c')]=0x0;this[_0x75ae('0x6d')]=_0x16797d[_0x75ae('0x6d')]||0x1e;this[_0x75ae('0x6e')]=_0x16797d[_0x75ae('0x6e')]||![];this[_0x75ae('0x6f')]=!!_0x16797d['dialPreviewAutoRecallMe']||![];this['dialPreviewRecallmeReminder']=!!_0x16797d[_0x75ae('0x70')]||![];this[_0x75ae('0x71')]=_0x16797d[_0x75ae('0x71')]||undefined;this[_0x75ae('0x72')]=_0x16797d[_0x75ae('0x72')]||![];this[_0x75ae('0x73')]=_0x16797d[_0x75ae('0x73')]||![];this[_0x75ae('0xb')]=monitorFormat[_0x16797d['monitor_format']]?monitorFormat[_0x16797d[_0x75ae('0xb')]]:undefined;this[_0x75ae('0x74')]=_0x16797d['mandatoryDisposition']||![];this[_0x75ae('0x75')]=_0x16797d[_0x75ae('0x75')]?_0x16797d[_0x75ae('0x75')]:undefined;}module[_0x75ae('0x76')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 4782d9e..32ac5a4 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 _0xd068=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0x351c4f,_0x310326){var _0x527c4b=function(_0x3e0c69){while(--_0x3e0c69){_0x351c4f['push'](_0x351c4f['shift']());}};_0x527c4b(++_0x310326);}(_0xd068,0x100));var _0x8d06=function(_0x3924b0,_0xeb17a3){_0x3924b0=_0x3924b0-0x0;var _0x213da5=_0xd068[_0x3924b0];return _0x213da5;};'use strict';function VtigerAccount(_0x5869e9){this['id']=_0x5869e9['id']||0x0;this[_0x8d06('0x0')]=_0x5869e9['name']||'';this[_0x8d06('0x1')]=_0x5869e9['username']||'';this[_0x8d06('0x2')]=_0x5869e9['accessKey']||'';this[_0x8d06('0x3')]=_0x5869e9[_0x8d06('0x3')]||'';this['serverUrl']=_0x5869e9[_0x8d06('0x4')]||'';this[_0x8d06('0x5')]=_0x5869e9[_0x8d06('0x5')]||{};}module[_0x8d06('0x6')]=VtigerAccount; \ No newline at end of file +var _0x30b8=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x3bc31,_0x13a7a2){var _0x3762d1=function(_0x138fbd){while(--_0x138fbd){_0x3bc31['push'](_0x3bc31['shift']());}};_0x3762d1(++_0x13a7a2);}(_0x30b8,0x10b));var _0x830b=function(_0x32100e,_0x143db0){_0x32100e=_0x32100e-0x0;var _0x2e8081=_0x30b8[_0x32100e];return _0x2e8081;};'use strict';function VtigerAccount(_0x301aa4){this['id']=_0x301aa4['id']||0x0;this['name']=_0x301aa4[_0x830b('0x0')]||'';this[_0x830b('0x1')]=_0x301aa4[_0x830b('0x1')]||'';this[_0x830b('0x2')]=_0x301aa4[_0x830b('0x2')]||'';this[_0x830b('0x3')]=_0x301aa4['remoteUri']||'';this['serverUrl']=_0x301aa4[_0x830b('0x4')]||'';this[_0x830b('0x5')]=_0x301aa4[_0x830b('0x5')]||{};}module[_0x830b('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 cc57be6..be2ed9b 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 _0x316d=['username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports'];(function(_0x4caff1,_0x4d7ce1){var _0x2e088f=function(_0x47a321){while(--_0x47a321){_0x4caff1['push'](_0x4caff1['shift']());}};_0x2e088f(++_0x4d7ce1);}(_0x316d,0x1c2));var _0xd316=function(_0x2f49a7,_0x23676e){_0x2f49a7=_0x2f49a7-0x0;var _0x2908b5=_0x316d[_0x2f49a7];return _0x2908b5;};'use strict';function ZendeskAccount(_0x2ef5aa){this['id']=_0x2ef5aa['id']||0x0;this['name']=_0x2ef5aa['name']||'';this['username']=_0x2ef5aa[_0xd316('0x0')]||'';this[_0xd316('0x1')]=_0x2ef5aa['password']||'';this[_0xd316('0x2')]=_0x2ef5aa[_0xd316('0x2')]||'';this[_0xd316('0x3')]=_0x2ef5aa[_0xd316('0x3')]||'';this[_0xd316('0x4')]=_0x2ef5aa['authType']||'';this['type']=_0x2ef5aa[_0xd316('0x5')]||_0xd316('0x6');this[_0xd316('0x7')]=_0x2ef5aa[_0xd316('0x7')]||'';this['Configurations']=_0x2ef5aa[_0xd316('0x8')]||{};}module[_0xd316('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x8afb=['name','password','remoteUri','authType','type','serverUrl','Configurations','exports'];(function(_0x39428c,_0x34b23a){var _0x52d069=function(_0x394962){while(--_0x394962){_0x39428c['push'](_0x39428c['shift']());}};_0x52d069(++_0x34b23a);}(_0x8afb,0xa8));var _0xb8af=function(_0x51e7d8,_0x56d4d4){_0x51e7d8=_0x51e7d8-0x0;var _0x27b10e=_0x8afb[_0x51e7d8];return _0x27b10e;};'use strict';function ZendeskAccount(_0x39c5cc){this['id']=_0x39c5cc['id']||0x0;this[_0xb8af('0x0')]=_0x39c5cc[_0xb8af('0x0')]||'';this['username']=_0x39c5cc['username']||'';this[_0xb8af('0x1')]=_0x39c5cc[_0xb8af('0x1')]||'';this['token']=_0x39c5cc['token']||'';this[_0xb8af('0x2')]=_0x39c5cc[_0xb8af('0x2')]||'';this[_0xb8af('0x3')]=_0x39c5cc[_0xb8af('0x3')]||'';this[_0xb8af('0x4')]=_0x39c5cc[_0xb8af('0x4')]||'integrationTab';this['serverUrl']=_0x39c5cc[_0xb8af('0x5')]||'';this[_0xb8af('0x6')]=_0x39c5cc['Configurations']||{};}module[_0xb8af('0x7')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 25376f9..0d8ae79 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 _0xd340=['serverUrl','code','refreshToken','Configurations','name','description','zone','clientId','clientSecret'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0xd340,0xd3));var _0x0d34=function(_0x39831c,_0x332121){_0x39831c=_0x39831c-0x0;var _0x35d0ed=_0xd340[_0x39831c];return _0x35d0ed;};'use strict';function ZohoAccount(_0x41507d){this['id']=_0x41507d['id']||0x0;this[_0x0d34('0x0')]=_0x41507d[_0x0d34('0x0')]||'';this[_0x0d34('0x1')]=_0x41507d[_0x0d34('0x1')]||'';this['host']=_0x41507d['host']||'';this['zone']=_0x41507d[_0x0d34('0x2')]||'';this[_0x0d34('0x3')]=_0x41507d['clientId']||'';this[_0x0d34('0x4')]=_0x41507d['clientSecret']||'';this['serverUrl']=_0x41507d[_0x0d34('0x5')]||'';this[_0x0d34('0x6')]=_0x41507d[_0x0d34('0x6')]||'';this[_0x0d34('0x7')]=_0x41507d[_0x0d34('0x7')]||'';this[_0x0d34('0x8')]=_0x41507d['Configurations']||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x54e1=['refreshToken','Configurations','exports','name','description','host','clientId','clientSecret','code'];(function(_0x417b1a,_0x3cfce5){var _0x1e41af=function(_0xe2e44e){while(--_0xe2e44e){_0x417b1a['push'](_0x417b1a['shift']());}};_0x1e41af(++_0x3cfce5);}(_0x54e1,0x66));var _0x154e=function(_0x3526a3,_0x1d2792){_0x3526a3=_0x3526a3-0x0;var _0x3ddfd6=_0x54e1[_0x3526a3];return _0x3ddfd6;};'use strict';function ZohoAccount(_0x216b39){this['id']=_0x216b39['id']||0x0;this['name']=_0x216b39[_0x154e('0x0')]||'';this['description']=_0x216b39[_0x154e('0x1')]||'';this[_0x154e('0x2')]=_0x216b39['host']||'';this['zone']=_0x216b39['zone']||'';this[_0x154e('0x3')]=_0x216b39[_0x154e('0x3')]||'';this[_0x154e('0x4')]=_0x216b39['clientSecret']||'';this['serverUrl']=_0x216b39['serverUrl']||'';this['code']=_0x216b39[_0x154e('0x5')]||'';this['refreshToken']=_0x216b39[_0x154e('0x6')]||'';this[_0x154e('0x7')]=_0x216b39[_0x154e('0x7')]||{};}module[_0x154e('0x8')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 735d90c..80deecb 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 _0xb6a6=['format','SIP/%s','calleridname','Contact','firstName','lastName','active','calleridnum','phone','scheduledat','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','type','campaigntype','membername','Agent','channelAgent'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xb6a6,0xd4));var _0x6b6a=function(_0x5e4563,_0x3ff918){_0x5e4563=_0x5e4563-0x0;var _0x8d1bf5=_0xb6a6[_0x5e4563];return _0x8d1bf5;};'use strict';var util=require(_0x6b6a('0x0'));var _=require(_0x6b6a('0x1'));var moment=require(_0x6b6a('0x2'));function checkNameSurname(_0x489cbd,_0x1261e7,_0x5eb133){var _0x2c6877='';if(!_[_0x6b6a('0x3')](_0x1261e7)&&_0x6b6a('0x4')===typeof _0x1261e7){_0x2c6877+=_0x1261e7;}if(!_[_0x6b6a('0x3')](_0x5eb133)&&_0x6b6a('0x4')===typeof _0x5eb133){_0x2c6877+='\x20'+_0x5eb133;}if(_0x2c6877!==''){return _0x2c6877;}return _0x489cbd;}function Action(_0x29e1a9,_0x196c8a,_0xeb9cf4,_0x242775,_0x254fc8){this[_0x6b6a('0x5')]=_0xeb9cf4||undefined;this[_0x6b6a('0x6')]=_0x29e1a9['id'];this[_0x6b6a('0x7')]=_0x196c8a['name'];this[_0x6b6a('0x8')]=_0x196c8a[_0x6b6a('0x8')];this[_0x6b6a('0x9')]=_0x6b6a('0x7');this['dialAnswer']=![];this[_0x6b6a('0xa')]=_['isNil'](_0x29e1a9[_0x6b6a('0xb')])?undefined:_0x29e1a9[_0x6b6a('0xb')]['name'];this[_0x6b6a('0xc')]=this[_0x6b6a('0xa')]?util[_0x6b6a('0xd')](_0x6b6a('0xe'),this['membername']):_0x242775||undefined;this[_0x6b6a('0xf')]=checkNameSurname(_0x29e1a9[_0x6b6a('0x10')]['phone'],_0x29e1a9[_0x6b6a('0x10')][_0x6b6a('0x11')],_0x29e1a9[_0x6b6a('0x10')][_0x6b6a('0x12')]);this[_0x6b6a('0x13')]=_0x29e1a9[_0x6b6a('0x13')]||![];this[_0x6b6a('0x14')]=_0x29e1a9[_0x6b6a('0x10')][_0x6b6a('0x15')];this[_0x6b6a('0x16')]=_0x29e1a9[_0x6b6a('0x16')];this['countbusyretry']=_0x29e1a9['countbusyretry']||0x0;this['countcongestionretry']=_0x29e1a9[_0x6b6a('0x17')]||0x0;this[_0x6b6a('0x18')]=_0x29e1a9[_0x6b6a('0x18')]||0x0;this[_0x6b6a('0x19')]=(_0x29e1a9['countbusyretry']||0x0)+(_0x29e1a9[_0x6b6a('0x17')]||0x0)+(_0x29e1a9['countnoanswerretry']||0x0)+(_0x29e1a9[_0x6b6a('0x1a')]||0x0)+(_0x29e1a9[_0x6b6a('0x1b')]||0x0)+(_0x29e1a9[_0x6b6a('0x1c')]||0x0)+(_0x29e1a9[_0x6b6a('0x1d')]||0x0)+(_0x29e1a9[_0x6b6a('0x1e')]||0x0);this['countnosuchnumberretry']=_0x29e1a9['countnosuchnumberretry']||0x0;this[_0x6b6a('0x1b')]=_0x29e1a9[_0x6b6a('0x1b')]||0x0;this['countabandonedretry']=_0x29e1a9[_0x6b6a('0x1c')]||0x0;this[_0x6b6a('0x1d')]=_0x29e1a9[_0x6b6a('0x1d')]||0x0;this[_0x6b6a('0x1e')]=_0x29e1a9[_0x6b6a('0x1e')]||0x0;this[_0x6b6a('0x1f')]=_0x29e1a9[_0x6b6a('0x1f')];this[_0x6b6a('0x20')]=_0x29e1a9[_0x6b6a('0x20')];this[_0x6b6a('0x21')]=_0x29e1a9[_0x6b6a('0x21')];this[_0x6b6a('0x22')]=_0x29e1a9[_0x6b6a('0x22')];this[_0x6b6a('0x23')]=_0x29e1a9[_0x6b6a('0x23')];this[_0x6b6a('0x24')]=_0x29e1a9[_0x6b6a('0x24')];this[_0x6b6a('0x25')]=_[_0x6b6a('0x3')](_0x29e1a9['Agent'])?_0x29e1a9[_0x6b6a('0x25')]:_0x29e1a9[_0x6b6a('0xb')]['id'];this[_0x6b6a('0x26')]=_0x29e1a9[_0x6b6a('0x26')];this[_0x6b6a('0x27')]='';this[_0x6b6a('0x28')]='';}Action['prototype'][_0x6b6a('0x29')]=function(){return util[_0x6b6a('0xd')](_0x6b6a('0x2a'),this[_0x6b6a('0xf')],this[_0x6b6a('0x2b')]);};module[_0x6b6a('0x2c')]=Action; \ No newline at end of file +var _0x1e19=['queue','type','dialAnswer','membername','Agent','name','channelAgent','format','SIP/%s','phone','Contact','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','calleridname','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact'];(function(_0x48181d,_0x42e154){var _0x514544=function(_0xe69612){while(--_0xe69612){_0x48181d['push'](_0x48181d['shift']());}};_0x514544(++_0x42e154);}(_0x1e19,0x161));var _0x91e1=function(_0x2897cd,_0x30b5de){_0x2897cd=_0x2897cd-0x0;var _0x25f1c8=_0x1e19[_0x2897cd];return _0x25f1c8;};'use strict';var util=require(_0x91e1('0x0'));var _=require(_0x91e1('0x1'));var moment=require(_0x91e1('0x2'));function checkNameSurname(_0xe59b5e,_0x43c0da,_0x18b855){var _0xc25a2a='';if(!_[_0x91e1('0x3')](_0x43c0da)&&_0x91e1('0x4')===typeof _0x43c0da){_0xc25a2a+=_0x43c0da;}if(!_[_0x91e1('0x3')](_0x18b855)&&'string'===typeof _0x18b855){_0xc25a2a+='\x20'+_0x18b855;}if(_0xc25a2a!==''){return _0xc25a2a;}return _0xe59b5e;}function Action(_0x1f5fa5,_0x66b584,_0x454f3e,_0x5d9687,_0x4842e3){this[_0x91e1('0x5')]=_0x454f3e||undefined;this[_0x91e1('0x6')]=_0x1f5fa5['id'];this[_0x91e1('0x7')]=_0x66b584['name'];this[_0x91e1('0x8')]=_0x66b584['type'];this['campaigntype']='queue';this[_0x91e1('0x9')]=![];this[_0x91e1('0xa')]=_[_0x91e1('0x3')](_0x1f5fa5[_0x91e1('0xb')])?undefined:_0x1f5fa5[_0x91e1('0xb')][_0x91e1('0xc')];this[_0x91e1('0xd')]=this[_0x91e1('0xa')]?util[_0x91e1('0xe')](_0x91e1('0xf'),this['membername']):_0x5d9687||undefined;this['calleridname']=checkNameSurname(_0x1f5fa5['Contact'][_0x91e1('0x10')],_0x1f5fa5[_0x91e1('0x11')]['firstName'],_0x1f5fa5[_0x91e1('0x11')][_0x91e1('0x12')]);this[_0x91e1('0x13')]=_0x1f5fa5[_0x91e1('0x13')]||![];this[_0x91e1('0x14')]=_0x1f5fa5[_0x91e1('0x11')][_0x91e1('0x10')];this[_0x91e1('0x15')]=_0x1f5fa5['scheduledat'];this[_0x91e1('0x16')]=_0x1f5fa5[_0x91e1('0x16')]||0x0;this[_0x91e1('0x17')]=_0x1f5fa5[_0x91e1('0x17')]||0x0;this[_0x91e1('0x18')]=_0x1f5fa5[_0x91e1('0x18')]||0x0;this['countglobal']=(_0x1f5fa5[_0x91e1('0x16')]||0x0)+(_0x1f5fa5[_0x91e1('0x17')]||0x0)+(_0x1f5fa5['countnoanswerretry']||0x0)+(_0x1f5fa5['countnosuchnumberretry']||0x0)+(_0x1f5fa5[_0x91e1('0x19')]||0x0)+(_0x1f5fa5[_0x91e1('0x1a')]||0x0)+(_0x1f5fa5['countmachineretry']||0x0)+(_0x1f5fa5[_0x91e1('0x1b')]||0x0);this[_0x91e1('0x1c')]=_0x1f5fa5[_0x91e1('0x1c')]||0x0;this[_0x91e1('0x19')]=_0x1f5fa5[_0x91e1('0x19')]||0x0;this[_0x91e1('0x1a')]=_0x1f5fa5['countabandonedretry']||0x0;this[_0x91e1('0x1d')]=_0x1f5fa5['countmachineretry']||0x0;this['countagentrejectretry']=_0x1f5fa5[_0x91e1('0x1b')]||0x0;this[_0x91e1('0x1e')]=_0x1f5fa5['callback'];this[_0x91e1('0x1f')]=_0x1f5fa5[_0x91e1('0x1f')];this['callbackat']=_0x1f5fa5[_0x91e1('0x20')];this[_0x91e1('0x21')]=_0x1f5fa5['recallme'];this[_0x91e1('0x22')]=_0x1f5fa5[_0x91e1('0x22')];this[_0x91e1('0x23')]=_0x1f5fa5[_0x91e1('0x23')];this[_0x91e1('0x24')]=_[_0x91e1('0x3')](_0x1f5fa5[_0x91e1('0xb')])?_0x1f5fa5[_0x91e1('0x24')]:_0x1f5fa5['Agent']['id'];this[_0x91e1('0x25')]=_0x1f5fa5['VoiceQueueId'];this[_0x91e1('0x26')]='';this[_0x91e1('0x27')]='';}Action[_0x91e1('0x28')]['getCaller']=function(){return util['format'](_0x91e1('0x29'),this[_0x91e1('0x2a')],this[_0x91e1('0x2b')]);};module[_0x91e1('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 9bdff76..9dfe5f4 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 _0xf873=['countglobal','totalGlobal','custom:agentnosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','buildObj','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','BUSY','countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialBusyMaxRetry','rescheduleContact','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','Global','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','dialBusyRetryFrequency','CANCEL','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','countagentrejectretry','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','linkedid','[callProgressDetectingCustomer][machine]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','Busy','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','Contact\x20is\x20undefined','idContact','custom:agentcalled','called','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','disableContact','getContactPreview','recallme','isValid','Contact.phone','[Preview][getContactPreview]','Call\x20unsuccessful','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','phone','substring','dialCutDigit','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','callerid','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','starttime','[originated][increment]','OriginateError','syncNewExten','actionid','lookAgent','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','cause','statedesc','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','type','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','Interval','format','voice:queue:%s','voice_queue:save','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','logger','syncCampaigns','hasOwnProperty','outbound','clearZombieChannels','dialActive','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','info','Queue','queue','stringify','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','Action','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','size','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','Agent','voicePause','run','logger2','[RecallMe]','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','rescheduleContactInQueue','createBody','createCustomerHistory','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry'];(function(_0x73bcb6,_0x32d2fd){var _0xcdc1d2=function(_0x190434){while(--_0x190434){_0x73bcb6['push'](_0x73bcb6['shift']());}};_0xcdc1d2(++_0x32d2fd);}(_0xf873,0xb2));var _0x3f87=function(_0x298efc,_0x19d637){_0x298efc=_0x298efc-0x0;var _0x5becde=_0xf873[_0x298efc];return _0x5becde;};'use strict';var util=require('util');var _=require(_0x3f87('0x0'));var BPromise=require(_0x3f87('0x1'));var uuid=require(_0x3f87('0x2'));var moment=require(_0x3f87('0x3'));var md5=require(_0x3f87('0x4'));var Redis=require(_0x3f87('0x5'));var config=require(_0x3f87('0x6'));var logger=require(_0x3f87('0x7'))(_0x3f87('0x8'));var loggerAction=require('../../../config/logger')(_0x3f87('0x9'));var ami=require(_0x3f87('0xa'));var rpcDb=require(_0x3f87('0xb'));var Action=require('./action');var ut=require(_0x3f87('0xc'));config[_0x3f87('0xd')]=_[_0x3f87('0xe')](config[_0x3f87('0xd')],{'host':_0x3f87('0xf'),'port':0x18eb});var io=require(_0x3f87('0x10'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x3f87('0x11')][_0x3f87('0x12')]=function(_0x32e236){this[_0x3f87('0x13')]=this[_0x3f87('0x13')]?this[_0x3f87('0x13')][_0x3f87('0x14')](_0x32e236):_0x32e236();};function Preview(_0x2b7ca0){this[_0x3f87('0x15')]=new Sequence();this[_0x3f87('0x16')]=_0x2b7ca0[_0x3f87('0x17')];this[_0x3f87('0x18')]=_0x2b7ca0[_0x3f87('0x18')];this[_0x3f87('0x19')]={};this['agents']=_0x2b7ca0[_0x3f87('0x1a')];this[_0x3f87('0x1b')]=0x0;ami['on']('originateresponse',this[_0x3f87('0x1c')][_0x3f87('0x1d')](this));ami['on'](_0x3f87('0x1e'),this[_0x3f87('0x1f')][_0x3f87('0x1d')](this));ami['on'](_0x3f87('0x20'),this[_0x3f87('0x21')][_0x3f87('0x1d')](this));ami['on']('dialend',this[_0x3f87('0x22')][_0x3f87('0x1d')](this));ami['on'](_0x3f87('0x23'),this['syncNewExten'][_0x3f87('0x1d')](this));ami['on']('varset',this[_0x3f87('0x24')][_0x3f87('0x1d')](this));ami['on'](_0x3f87('0x25'),this[_0x3f87('0x26')][_0x3f87('0x1d')](this));ami['on']('blindtransfer',this[_0x3f87('0x27')][_0x3f87('0x1d')](this));this[_0x3f87('0x28')](this[_0x3f87('0x16')]);}function emit(_0x57f7c5,_0x4acd30,_0x507c43){io['to'](_0x57f7c5)[_0x3f87('0x29')](_0x4acd30,_0x507c43);}function emitCampaignPreview(_0x2b1684){if(_0x2b1684[_0x3f87('0x2a')]==='outbound'){var _0x17e411={'id':_0x2b1684['id'],'name':_0x2b1684[_0x3f87('0x2b')],'strategy':_0x2b1684[_0x3f87('0x2c')],'answered':_0x2b1684[_0x3f87('0x2d')],'available':_0x2b1684[_0x3f87('0x2e')],'loggedIn':_0x2b1684[_0x3f87('0x2f')],'pTalking':_0x2b1684[_0x3f87('0x30')],'sumBillable':_0x2b1684[_0x3f87('0x31')],'sumDuration':_0x2b1684[_0x3f87('0x32')],'sumHoldTime':_0x2b1684[_0x3f87('0x33')]||0x0,'talking':_0x2b1684[_0x3f87('0x34')],'total':_0x2b1684[_0x3f87('0x35')],'type':_0x2b1684['type'],'unmanaged':_0x2b1684[_0x3f87('0x36')],'abandoned':_0x2b1684[_0x3f87('0x37')],'waiting':_0x2b1684[_0x3f87('0x38')],'loggedInDb':_0x2b1684['loggedInDb'],'dialActive':_0x2b1684['dialActive'],'dialMethod':_0x2b1684[_0x3f87('0x39')],'dialOriginateCallerIdName':_0x2b1684[_0x3f87('0x3a')],'dialOriginateCallerIdNumber':_0x2b1684[_0x3f87('0x3b')],'dialOriginateTimeout':_0x2b1684[_0x3f87('0x3c')],'dialPrefix':_0x2b1684[_0x3f87('0x3d')],'outboundAnswerAgiCallsDay':_0x2b1684[_0x3f87('0x3e')],'outboundAnswerCallsDay':_0x2b1684[_0x3f87('0x3f')],'outboundBlacklistCallsDay':_0x2b1684[_0x3f87('0x40')],'outboundBusyCallsDay':_0x2b1684[_0x3f87('0x41')],'outboundCongestionCallsDay':_0x2b1684[_0x3f87('0x42')],'outboundDropCallsDayACS':_0x2b1684[_0x3f87('0x43')],'outboundDropCallsDayCallersExit':_0x2b1684[_0x3f87('0x44')],'outboundDropCallsDayTimeout':_0x2b1684[_0x3f87('0x45')],'outboundNoAnswerCallsDay':_0x2b1684[_0x3f87('0x46')],'outboundNoSuchCallsDay':_0x2b1684[_0x3f87('0x47')],'outboundOriginateFailureCallsDay':_0x2b1684[_0x3f87('0x48')],'outboundReCallsDay':_0x2b1684['outboundReCallsDay'],'outboundRejectCallsDay':_0x2b1684[_0x3f87('0x49')],'outboundUnknownCallsDay':_0x2b1684[_0x3f87('0x4a')],'outboundAbandonedCallsDay':_0x2b1684[_0x3f87('0x4b')],'predictiveIntervalAnsweredCalls':_0x2b1684[_0x3f87('0x4c')],'predictiveIntervalAvgHoldtime':_0x2b1684['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x2b1684['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x2b1684['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x2b1684[_0x3f87('0x4d')],'predictiveIntervalErlangCalls':_0x2b1684[_0x3f87('0x4e')],'predictiveIntervalErlangCallsDroppedCalls':_0x2b1684[_0x3f87('0x4f')],'predictiveIntervalHitRate':_0x2b1684[_0x3f87('0x50')],'predictiveIntervalMultiplicativeFactor':_0x2b1684[_0x3f87('0x51')],'predictiveIntervalPauses':_0x2b1684['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x2b1684[_0x3f87('0x52')],'predictiveIntervalTotalCalls':_0x2b1684['predictiveIntervalTotalCalls'],'message':_0x2b1684[_0x3f87('0x53')],'originated':_0x2b1684[_0x3f87('0x54')],'erlangCalls':_0x2b1684[_0x3f87('0x55')],'erlangCallToSecond':_0x2b1684[_0x3f87('0x56')],'erlangAbandonmentRate':_0x2b1684[_0x3f87('0x57')],'erlangBusyFactor':_0x2b1684[_0x3f87('0x58')],'startPredictive':_0x2b1684[_0x3f87('0x59')],'startProgressive':_0x2b1684['startProgressive']};if(_0x2b1684['Trunk']){_0x17e411[_0x3f87('0x5a')]={'id':_0x2b1684[_0x3f87('0x5a')]['id'],'name':_0x2b1684[_0x3f87('0x5a')][_0x3f87('0x2b')],'active':_0x2b1684[_0x3f87('0x5a')][_0x3f87('0x5b')],'callerid':_0x2b1684[_0x3f87('0x5a')]['callerid']};}if(_0x2b1684[_0x3f87('0x5c')]){_0x17e411['Interval']={'id':_0x2b1684[_0x3f87('0x5c')]['id'],'name':_0x2b1684[_0x3f87('0x5c')][_0x3f87('0x2b')]};}var _0x2d8399=md5(JSON['stringify'](_0x17e411));if(_0x2b1684[_0x3f87('0x4')]!==_0x2d8399){_0x2b1684['md5']=_0x2d8399;emit(util[_0x3f87('0x5d')](_0x3f87('0x5e'),_0x17e411[_0x3f87('0x2b')]),_0x3f87('0x5f'),_0x17e411);}}}function emitVoiceQueueChannelRemove(_0x116900){logger['info']('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x116900));emit(util[_0x3f87('0x5d')](_0x3f87('0x5e'),_0x116900[_0x3f87('0x2b')]),_0x3f87('0x60'),_0x116900);io[_0x3f87('0x29')](_0x3f87('0x61'),_0x116900);}function notSendMessagesQueue(_0x54407a){if(_0x54407a[_0x3f87('0x62')]){if(_0x54407a['originated']===0x0&&_0x54407a[_0x3f87('0x30')]===0x0){_0x54407a[_0x3f87('0x62')]=![];_0x54407a['available']=0x0;_0x54407a[_0x3f87('0x63')]=0x0;_0x54407a[_0x3f87('0x53')]=_0x3f87('0x64');ut['logger'](_0x3f87('0x65'),_0x54407a['name']+'\x20is\x20not\x20active');}else{_0x54407a[_0x3f87('0x53')]=_0x3f87('0x66');ut[_0x3f87('0x67')](_0x3f87('0x65'),_0x54407a[_0x3f87('0x2b')]+'\x20is\x20disactive');}emitCampaignPreview(_0x54407a);}}Preview[_0x3f87('0x11')][_0x3f87('0x28')]=function(){var _0x1082dc=this;setInterval(function(){_0x1082dc[_0x3f87('0x68')]();},0x7cf);};Preview['prototype'][_0x3f87('0x68')]=function(){var _0x458c79=this[_0x3f87('0x16')];this[_0x3f87('0x1b')]+=0x1;for(var _0x1fc2c2 in _0x458c79){if(_0x458c79[_0x3f87('0x69')](_0x1fc2c2)&&(_0x458c79[_0x1fc2c2][_0x3f87('0x39')]===_0x3f87('0x8')||_0x458c79[_0x1fc2c2]['dialMethod']==='booked')&&_0x458c79[_0x1fc2c2][_0x3f87('0x2a')]===_0x3f87('0x6a')){if(this[_0x3f87('0x1b')]>0x7){this[_0x3f87('0x1b')]=0x0;this[_0x3f87('0x6b')]();}}if(_0x458c79[_0x3f87('0x69')](_0x1fc2c2)&&_0x458c79[_0x1fc2c2][_0x3f87('0x39')]===_0x3f87('0x8')&&_0x458c79[_0x1fc2c2][_0x3f87('0x2a')]===_0x3f87('0x6a')){if(_0x458c79[_0x1fc2c2][_0x3f87('0x6c')]){this['setMessage'](_0x458c79[_0x1fc2c2]);if(_0x458c79[_0x1fc2c2][_0x3f87('0x6d')])this[_0x3f87('0x6e')](_0x458c79[_0x1fc2c2]);}else{notSendMessagesQueue(_0x458c79[_0x1fc2c2]);}}}};Preview[_0x3f87('0x11')][_0x3f87('0x6f')]=function(_0x2bec12){var _0x41ee7d=this;this[_0x3f87('0x15')][_0x3f87('0x12')](function(){if(!_[_0x3f87('0x70')](_0x41ee7d[_0x3f87('0x19')][_0x2bec12])){loggerAction[_0x3f87('0x71')]('[clearZombieChannels][talking]',_0x2bec12,_0x3f87('0x72'),_0x41ee7d[_0x3f87('0x19')][_0x2bec12][_0x3f87('0x73')],'originated:\x20',JSON[_0x3f87('0x74')](_0x41ee7d[_0x3f87('0x16')][_0x41ee7d[_0x3f87('0x19')][_0x2bec12][_0x3f87('0x73')]][_0x3f87('0x54')]),_0x3f87('0x75'),JSON[_0x3f87('0x74')](_0x41ee7d['campaignsPreview'][_0x41ee7d[_0x3f87('0x19')][_0x2bec12][_0x3f87('0x73')]][_0x3f87('0x30')]),JSON[_0x3f87('0x74')](_0x41ee7d[_0x3f87('0x19')][_0x2bec12][_0x3f87('0x76')]),JSON[_0x3f87('0x74')](_[_0x3f87('0x77')](_0x41ee7d[_0x3f87('0x19')][_0x2bec12],[_0x3f87('0x78'),_0x3f87('0x79'),_0x3f87('0x7a'),'ListId'])));return ami[_0x3f87('0x7b')]({'action':'status','channel':_0x41ee7d[_0x3f87('0x19')][_0x2bec12][_0x3f87('0x7c')]})[_0x3f87('0x7d')](function(_0x434241){if(_0x434241[_0x3f87('0x53')]===_0x3f87('0x7e')){setTimeout(function(){if(_0x41ee7d['actions'][_0x2bec12]){ut[_0x3f87('0x7f')](_0x41ee7d[_0x3f87('0x16')][_0x41ee7d[_0x3f87('0x19')][_0x2bec12][_0x3f87('0x73')]],_0x3f87('0x80'));if(_0x41ee7d[_0x3f87('0x19')][_0x2bec12][_0x3f87('0x76')]===!![]){ut[_0x3f87('0x81')](_0x41ee7d[_0x3f87('0x16')][_0x41ee7d[_0x3f87('0x19')][_0x2bec12][_0x3f87('0x73')]],_0x3f87('0x80'));ut[_0x3f87('0x82')](_0x3f87('0x83')+_0x2bec12,_0x41ee7d[_0x3f87('0x19')][_0x2bec12][_0x3f87('0x73')]);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x2bec12,_0x41ee7d['actions'][_0x2bec12][_0x3f87('0x73')]);delete _0x41ee7d['actions'][_0x2bec12];}},0x2328);}});}});};Preview[_0x3f87('0x11')][_0x3f87('0x6b')]=function(){var _0x1fcd71=this;loggerAction[_0x3f87('0x71')]('[action]',_[_0x3f87('0x84')](this[_0x3f87('0x19')]));for(var _0x120854 in this['actions']){if(_0x1fcd71['actions']['hasOwnProperty'](_0x120854)){_0x1fcd71[_0x3f87('0x6f')](_0x120854);}}};Preview[_0x3f87('0x11')]['recallMe']=function(_0x4172f5){var _0x23b68c=this;rpcDb[_0x3f87('0x85')](_0x4172f5['id'],ut[_0x3f87('0x86')](this[_0x3f87('0x1a')]))[_0x3f87('0x87')](function(_0x3c84c5){if(!_[_0x3f87('0x70')](_0x3c84c5)){for(var _0x45865b=0x0;_0x45865b<_0x3c84c5[_0x3f87('0x88')];_0x45865b+=0x1){if(ut[_0x3f87('0x89')](_0x3c84c5[_0x45865b][_0x3f87('0x8a')])<_0x4172f5['dialRecallMeTimeout']*0x3c){if(_0x3c84c5[_0x45865b][_0x3f87('0x8b')]&&!_0x3c84c5[_0x45865b][_0x3f87('0x8b')][_0x3f87('0x8c')]){_0x23b68c[_0x3f87('0x8d')](_0x3c84c5[_0x45865b]['id'])[_0x3f87('0x87')](ut[_0x3f87('0x8e')](_0x3f87('0x8f')))[_0x3f87('0x7d')](ut[_0x3f87('0x8e')](_0x3f87('0x8f')));}else{rpcDb['disableContact'](_0x3c84c5[_0x45865b]['id']);}}else{var _0x415766=new Action(_0x3c84c5[_0x45865b],_0x4172f5);_0x415766['starttime']=moment()[_0x3f87('0x5d')](_0x3f87('0x90'));_0x4172f5[_0x3f87('0x91')]+=0x1;ut[_0x3f87('0x92')](_0x415766,0x17,'RecallInQueue');if(_0x4172f5['dialRecallInQueue']){rpcDb[_0x3f87('0x93')](ut[_0x3f87('0x94')](_0x3c84c5[_0x45865b]));rpcDb[_0x3f87('0x95')](_0x415766,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x3f87('0x92')](_0x415766,0x16,_0x3f87('0x96'));rpcDb[_0x3f87('0x95')](_0x415766,'[HistoryRecallClose]');rpcDb[_0x3f87('0x97')](_0x415766,_0x3f87('0x98'));}}}}})[_0x3f87('0x7d')](ut['logger2']('[getContactRecallMe]'));};Preview[_0x3f87('0x11')]['setMessage']=function(_0xbab32a){_0xbab32a[_0x3f87('0x62')]=!![];if(ut['IsNotLoggedIn'](_0xbab32a[_0x3f87('0x2f')])){_0xbab32a[_0x3f87('0x53')]='AGENTS_NOT_LOGGED';}else if(!ut['isActive'](_0xbab32a[_0x3f87('0x6c')])){_0xbab32a[_0x3f87('0x53')]=_0x3f87('0x64');}else if(!this[_0x3f87('0x99')](_0xbab32a[_0x3f87('0x5a')])){if(!this[_0x3f87('0x99')](_0xbab32a[_0x3f87('0x9a')])){_0xbab32a[_0x3f87('0x53')]=_0x3f87('0x9b');}else{_0xbab32a[_0x3f87('0x53')]=_0x3f87('0x9c');}}else{_0xbab32a[_0x3f87('0x53')]=_0x3f87('0x9c');}emitCampaignPreview(_0xbab32a);};Preview[_0x3f87('0x11')][_0x3f87('0x9d')]=function(_0x19aaac,_0x520043,_0x21f834){var _0x46aff2=this;var _0x31cb87=this[_0x3f87('0x19')][_0x520043];var _0x5839fc=this[_0x3f87('0x16')][_0x31cb87[_0x3f87('0x73')]];var _0x3f6b5a;if(_0x5839fc){switch(_0x21f834){case'1':_0x5839fc[_0x3f87('0x47')]+=0x1;_0x31cb87[_0x3f87('0x9e')]+=0x1;_0x31cb87[_0x3f87('0x9f')]=ut[_0x3f87('0xa0')](_0x31cb87);ut['logCustomer'](_0x31cb87,0x0,'NoSuchNumber');ami[_0x3f87('0x29')](_0x3f87('0xa1'),ut['buildObj'](_0x31cb87,'nosuchnumber'));rpcDb[_0x3f87('0x95')](_0x31cb87,_0x3f87('0xa2'));if(ut['totalGlobal'](_0x31cb87)>=_0x5839fc[_0x3f87('0xa3')]){_0x3f6b5a=ut[_0x3f87('0xa4')](_0x31cb87,0xf,'Global');rpcDb['createCustomerFinal'](_0x3f6b5a,_0x3f87('0xa5'));}else{if(_0x31cb87[_0x3f87('0x9e')]>=_0x5839fc[_0x3f87('0xa6')]){rpcDb['createCustomerFinal'](_0x31cb87,_0x3f87('0xa5'));}else{rpcDb['rescheduleContact'](ut[_0x3f87('0xa7')](_0x31cb87,_0x3f87('0x9e'),_0x5839fc[_0x3f87('0xa8')]),_0x31cb87[_0x3f87('0xa9')],_0x31cb87[_0x3f87('0xaa')]);}}delete this[_0x3f87('0x19')][_0x19aaac['linkedid']];break;case _0x3f87('0xab'):var _0x263ea6=moment()[_0x3f87('0x5d')](_0x3f87('0x90'));_0x31cb87[_0x3f87('0xac')]=_0x263ea6;_0x31cb87[_0x3f87('0xad')]=_0x263ea6;_0x31cb87[_0x3f87('0x76')]=!![];_0x5839fc['pTalking']+=0x1;logger[_0x3f87('0x71')](_0x3f87('0xae'),_0x31cb87[_0x3f87('0xaf')],_0x3f87('0xb0'),_0x5839fc['name'],_0x3f87('0x75'),_0x5839fc[_0x3f87('0x30')]);ami[_0x3f87('0x29')](_0x3f87('0xb1'),ut[_0x3f87('0xb2')](_0x31cb87,'connect',this['campaignsPreview'][_0x31cb87[_0x3f87('0x73')]]));if(_0x5839fc['acw']){ami[_0x3f87('0x29')](_0x3f87('0xb3'),ut[_0x3f87('0xb4')](_0x31cb87));}break;case'16':ami[_0x3f87('0x29')](_0x3f87('0xb5'),ut[_0x3f87('0xb2')](_0x31cb87,_0x3f87('0xb6'),this[_0x3f87('0x16')][_0x31cb87[_0x3f87('0x73')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x31cb87,_0x3f87('0xb6')));_0x5839fc[_0x3f87('0x3f')]+=0x1;_0x5839fc['total']+=0x1;_0x5839fc[_0x3f87('0x2d')]+=0x1;ut[_0x3f87('0x81')](_0x5839fc,'[16]');_0x31cb87['countglobal']=ut[_0x3f87('0xa0')](_0x31cb87);ut[_0x3f87('0x92')](_0x31cb87,0x4,_0x3f87('0xb7'));rpcDb[_0x3f87('0x95')](_0x31cb87,_0x3f87('0xb8'));rpcDb[_0x3f87('0x97')](_0x31cb87,_0x3f87('0xb9'));rpcDb[_0x3f87('0xba')](_0x31cb87);_0x5839fc[_0x3f87('0x32')]+=_0x31cb87[_0x3f87('0xbb')];_0x5839fc[_0x3f87('0x31')]+=_0x31cb87[_0x3f87('0xbb')];logger[_0x3f87('0x71')]('[syncHangup][talking][decrement]',_0x31cb87[_0x3f87('0xaf')],_0x3f87('0xb0'),_0x5839fc[_0x3f87('0x2b')],'pTalking:\x20',_0x5839fc[_0x3f87('0x30')]);delete this[_0x3f87('0x19')][_0x19aaac['linkedid']];break;case _0x3f87('0xbc'):_0x5839fc[_0x3f87('0x41')]+=0x1;_0x31cb87[_0x3f87('0xbd')]+=0x1;_0x31cb87['countglobal']=ut[_0x3f87('0xa0')](_0x31cb87);ut[_0x3f87('0x92')](_0x31cb87,0x5,'Busy');ami[_0x3f87('0x29')](_0x3f87('0xbe'),ut['buildObj'](_0x31cb87,_0x3f87('0xbf')));rpcDb[_0x3f87('0x95')](_0x31cb87,_0x3f87('0xc0'));if(ut[_0x3f87('0xa0')](_0x31cb87)>=_0x5839fc[_0x3f87('0xa3')]){_0x3f6b5a=ut['cloneAction'](_0x31cb87,0xf,'Global');rpcDb[_0x3f87('0x97')](_0x3f6b5a,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x31cb87['countbusyretry']>=_0x5839fc[_0x3f87('0xc1')]){rpcDb['createCustomerFinal'](_0x31cb87,_0x3f87('0xc0'));}else{rpcDb[_0x3f87('0xc2')](ut['scheduledAt'](_0x31cb87,_0x3f87('0xbd'),_0x5839fc['dialBusyRetryFrequency']),_0x31cb87[_0x3f87('0xa9')],_0x31cb87['activeContact']);}}break;case _0x3f87('0xc3'):_0x5839fc[_0x3f87('0x46')]+=0x1;_0x31cb87[_0x3f87('0xc4')]+=0x1;_0x31cb87[_0x3f87('0x9f')]=ut[_0x3f87('0xa0')](_0x31cb87);ut[_0x3f87('0x92')](_0x31cb87,0x3,_0x3f87('0xc5'));ami[_0x3f87('0x29')](_0x3f87('0xc6'),ut[_0x3f87('0xb2')](_0x31cb87,_0x3f87('0xc7')));rpcDb[_0x3f87('0x95')](_0x31cb87,_0x3f87('0xc8'));if(ut['totalGlobal'](_0x31cb87)>=_0x5839fc['dialGlobalMaxRetry']){_0x3f6b5a=ut['cloneAction'](_0x31cb87,0xf,_0x3f87('0xc9'));rpcDb[_0x3f87('0x97')](_0x3f6b5a,_0x3f87('0xca'));}else{if(_0x31cb87['countnoanswerretry']>=_0x5839fc[_0x3f87('0xcb')]){rpcDb[_0x3f87('0x97')](_0x31cb87,_0x3f87('0xc8'));}else{rpcDb[_0x3f87('0xc2')](ut[_0x3f87('0xa7')](_0x31cb87,'countnoanswerretry',_0x5839fc[_0x3f87('0xcc')]),_0x31cb87[_0x3f87('0xa9')],_0x31cb87[_0x3f87('0xaa')]);}}break;case _0x3f87('0xcd'):_0x5839fc[_0x3f87('0x42')]+=0x1;_0x31cb87[_0x3f87('0xce')]+=0x1;_0x31cb87[_0x3f87('0x9f')]=ut[_0x3f87('0xa0')](_0x31cb87);ut[_0x3f87('0x92')](_0x31cb87,0x8,'Congestion');ami[_0x3f87('0x29')](_0x3f87('0xcf'),ut[_0x3f87('0xb2')](_0x31cb87,'congestion'));rpcDb[_0x3f87('0x95')](_0x31cb87,_0x3f87('0xd0'));if(ut[_0x3f87('0xa0')](_0x31cb87)>=_0x5839fc['dialGlobalMaxRetry']){_0x3f6b5a=ut[_0x3f87('0xa4')](_0x31cb87,0xf,_0x3f87('0xc9'));rpcDb[_0x3f87('0x97')](_0x3f6b5a,_0x3f87('0xd1'));}else{if(_0x31cb87[_0x3f87('0xce')]>=_0x5839fc[_0x3f87('0xd2')]){rpcDb['createCustomerFinal'](_0x31cb87,_0x3f87('0xd0'));}else{rpcDb['rescheduleContact'](ut[_0x3f87('0xa7')](_0x31cb87,'countcongestionretry',_0x5839fc[_0x3f87('0xd3')]),_0x31cb87[_0x3f87('0xa9')],_0x31cb87[_0x3f87('0xaa')]);}}break;case _0x3f87('0xd4'):_0x5839fc['outboundRejectCallsDay']+=0x1;_0x31cb87['countagentrejectretry']+=0x1;_0x31cb87[_0x3f87('0x9f')]=ut['totalGlobal'](_0x31cb87);ut['logCustomer'](_0x31cb87,0x14,'AgentReject');ami['emit'](_0x3f87('0xd5'),ut[_0x3f87('0xb2')](_0x31cb87,_0x3f87('0xd6')));rpcDb['createCustomerHistory'](_0x31cb87,_0x3f87('0xd7'));if(ut[_0x3f87('0xa0')](_0x31cb87)>=_0x5839fc[_0x3f87('0xa3')]){_0x3f6b5a=ut['cloneAction'](_0x31cb87,0x14,_0x3f87('0xd8'));rpcDb[_0x3f87('0x97')](_0x3f6b5a,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x31cb87[_0x3f87('0xd9')]>=_0x5839fc[_0x3f87('0xda')]){rpcDb['createCustomerFinal'](_0x31cb87,_0x3f87('0xdb'));}else{rpcDb[_0x3f87('0xc2')](ut[_0x3f87('0xa7')](_0x31cb87,'countagentrejectretry',_0x5839fc[_0x3f87('0xdc')]),_0x31cb87[_0x3f87('0xa9')],_0x31cb87['activeContact']);}}break;case'ABANDONED':_0x5839fc[_0x3f87('0x4b')]+=0x1;_0x31cb87[_0x3f87('0xdd')]+=0x1;_0x31cb87[_0x3f87('0x9f')]=ut['totalGlobal'](_0x31cb87);ut[_0x3f87('0x92')](_0x31cb87,0xb,_0x3f87('0xde'));rpcDb['createCustomerHistory'](_0x31cb87,_0x3f87('0xdf'));if(ut[_0x3f87('0xa0')](_0x31cb87)>=_0x5839fc[_0x3f87('0xa3')]){_0x3f6b5a=ut['cloneAction'](_0x31cb87,0xf,_0x3f87('0xc9'));rpcDb[_0x3f87('0x97')](_0x3f6b5a,_0x3f87('0xdf'));}else{if(_0x31cb87[_0x3f87('0xe0')]>=_0x5839fc[_0x3f87('0xe1')]){rpcDb[_0x3f87('0x97')](_0x31cb87,_0x3f87('0xdf'));}else{rpcDb[_0x3f87('0xc2')](ut[_0x3f87('0xa7')](_0x31cb87,'countabandonedretry',_0x5839fc[_0x3f87('0xe2')]),_0x31cb87[_0x3f87('0xa9')],_0x31cb87[_0x3f87('0xaa')]);}}break;case'18':_0x5839fc['outboundUnknownCallsDay']+=0x1;_0x31cb87[_0x3f87('0xe3')]+=0x1;_0x31cb87[_0x3f87('0x9f')]=ut[_0x3f87('0xa0')](_0x31cb87);ut[_0x3f87('0x92')](_0x31cb87,0x12,_0x19aaac[_0x3f87('0xe4')]||_0x19aaac[_0x3f87('0xe5')]);ami['emit'](_0x3f87('0xe6'),ut[_0x3f87('0xb2')](_0x31cb87,_0x3f87('0xe7')));rpcDb[_0x3f87('0x95')](_0x31cb87,_0x3f87('0xe8'));if(ut[_0x3f87('0xa0')](_0x31cb87)>=_0x5839fc[_0x3f87('0xa3')]){_0x3f6b5a=ut[_0x3f87('0xa4')](_0x31cb87,0xf,_0x3f87('0xc9'));rpcDb[_0x3f87('0x97')](_0x3f6b5a,_0x3f87('0xe8'));}else{rpcDb[_0x3f87('0x97')](_0x31cb87,_0x3f87('0xe8'));}delete this[_0x3f87('0x19')][_0x19aaac[_0x3f87('0xe9')]];break;case'19':_0x5839fc[_0x3f87('0x4a')]+=0x1;_0x31cb87[_0x3f87('0x9f')]=ut[_0x3f87('0xa0')](_0x31cb87);ut['logCustomer'](_0x31cb87,0x13,_0x19aaac[_0x3f87('0xe4')]||_0x19aaac[_0x3f87('0xe5')]);ami[_0x3f87('0x29')](_0x3f87('0xe6'),ut[_0x3f87('0xb2')](_0x31cb87,'amd'));rpcDb[_0x3f87('0x95')](_0x31cb87,_0x3f87('0xea'));if(ut[_0x3f87('0xa0')](_0x31cb87)>=_0x5839fc[_0x3f87('0xa3')]){_0x3f6b5a=ut[_0x3f87('0xa4')](_0x31cb87,0xf,_0x3f87('0xc9'));rpcDb[_0x3f87('0x97')](_0x3f6b5a,_0x3f87('0xea'));}else{rpcDb['createCustomerFinal'](_0x31cb87,_0x3f87('0xea'));}delete this[_0x3f87('0x19')][_0x19aaac[_0x3f87('0xe9')]];break;default:if(_0x31cb87[_0x3f87('0x76')]){ut[_0x3f87('0x81')](_0x5839fc,'[default]');ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x5839fc[_0x3f87('0x2b')],_0x19aaac);}_0x5839fc['outboundUnknownCallsDay']+=0x1;_0x31cb87[_0x3f87('0x9f')]=ut[_0x3f87('0xa0')](_0x31cb87);ut[_0x3f87('0x92')](_0x31cb87,0xc,_0x19aaac[_0x3f87('0xe4')]||_0x19aaac[_0x3f87('0xe5')]);rpcDb[_0x3f87('0x95')](_0x31cb87,_0x3f87('0xeb'));if(ut[_0x3f87('0xa0')](_0x31cb87)>=_0x5839fc[_0x3f87('0xa3')]){_0x3f6b5a=ut[_0x3f87('0xa4')](_0x31cb87,0xf,_0x3f87('0xc9'));rpcDb[_0x3f87('0x97')](_0x3f6b5a,_0x3f87('0xec'));}else{rpcDb[_0x3f87('0x97')](_0x31cb87,_0x3f87('0xec'));}delete this['actions'][_0x19aaac[_0x3f87('0xe9')]];}if(!(_0x31cb87['dialAnswer']&&_0x21f834==='16')){ut['updateOriginated'](_0x5839fc,_0x3f87('0xed'));logger[_0x3f87('0x71')](_0x3f87('0xee'),_0x31cb87['uniqueid'],_0x3f87('0xb0'),_0x5839fc[_0x3f87('0x2b')],'originated:\x20',_0x5839fc[_0x3f87('0x54')]);}if(_0x21f834!==_0x3f87('0xab')){delete this[_0x3f87('0x19')][_0x19aaac['linkedid']];delete this[_0x3f87('0x19')][_0x19aaac[_0x3f87('0xef')]];}}};Preview['prototype'][_0x3f87('0xf0')]=function(_0x355dc6,_0x49198d,_0x58f227){if(_[_0x3f87('0xf1')](_0x49198d)&&_0x3f87('0xf2')!==typeof _0x49198d){return;}if(_[_0x3f87('0xf1')](_0x58f227)&&_0x3f87('0xf2')!==typeof _0x58f227){return;}switch(_0x58f227[_0x3f87('0xf3')]){case'0':ut[_0x3f87('0xf4')](_0x355dc6,0x0,_0x3f87('0xf5'));rpcDb['createAgentHistory'](_0x355dc6,_0x3f87('0xf6'));break;case'3':ut['logAgent'](_0x355dc6,0x3,'NoAnswer');rpcDb[_0x3f87('0xf7')](_0x355dc6,_0x3f87('0xf8'));break;case'5':ut['logAgent'](_0x355dc6,0x5,_0x3f87('0xf9'));rpcDb['createAgentHistory'](_0x355dc6,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x3f87('0xf4')](_0x355dc6,0x8,'Congestion');rpcDb[_0x3f87('0xf7')](_0x355dc6,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut['logAgent'](_0x355dc6,0x16,_0x3f87('0xfa'));rpcDb[_0x3f87('0xf7')](_0x355dc6,_0x3f87('0xfb'));break;default:ut[_0x3f87('0xf4')](_0x355dc6,0xc,_0x58f227['reason']);rpcDb[_0x3f87('0xf7')](_0x355dc6,_0x3f87('0xfc'));}ut[_0x3f87('0x7f')](_0x49198d,'[callProgressDetectingAgent]');logger['info'](_0x3f87('0xfd'),_0x355dc6[_0x3f87('0xaf')],_0x3f87('0xb0'),_0x49198d[_0x3f87('0x2b')],'originated:\x20',_0x49198d[_0x3f87('0x54')]);delete this[_0x3f87('0x19')][_0x355dc6[_0x3f87('0xaf')]];};Preview[_0x3f87('0x11')][_0x3f87('0xfe')]=function(_0x30bc5a,_0xd3aa8d,_0x465465,_0x33e423,_0x2317f1){var _0x94cb13=this;return new BPromise(function(_0x10f4e5,_0x4a4d3f){if(_[_0x3f87('0x70')](_0xd3aa8d)||_['isNil'](_0xd3aa8d['Contact'])||_['isNil'](_0xd3aa8d[_0x3f87('0xff')]['phone'])||_[_0x3f87('0x70')](_0xd3aa8d[_0x3f87('0x7a')])){_0x4a4d3f(ut[_0x3f87('0x53')](_0x3f87('0x100'),_0x33e423,_0x2317f1));return;}var _0x23b3ac=uuid['v4']();var _0x53f1dd=_0x94cb13[_0x3f87('0x16')][_0xd3aa8d['Queue']['name']];var _0x45810c=_0x465465?_0x94cb13[_0x3f87('0x1a')][_0x465465]['id']:undefined;_0x94cb13['actions'][_0x23b3ac]=new Action(_0xd3aa8d,_0x53f1dd,_0x23b3ac,_0x465465,_0x45810c);var _0x41961e=_0x94cb13[_0x3f87('0x19')][_0x23b3ac];_0x41961e[_0x3f87('0xa9')]=_0x33e423;_0x41961e['activeContact']=_0x2317f1;_0x41961e['lookAgent']=_0x465465;if(_['isEmpty'](_0x30bc5a)){_0x94cb13['execCall'](_0x41961e,_0x53f1dd,_0xd3aa8d,_0x465465)[_0x3f87('0x87')](function(_0x92cdd3){logger[_0x3f87('0x71')]('[Preview][execCall][success]','Queue:\x20'+_0x41961e['queue']+'\x20IdHopper:\x20'+_0x41961e[_0x3f87('0x101')],JSON['stringify'](_0x92cdd3));ami[_0x3f87('0x29')](_0x3f87('0x102'),ut['buildObj'](_0x41961e,_0x3f87('0x103'),_0x94cb13[_0x3f87('0x16')][_0x41961e[_0x3f87('0x73')]]));_0x10f4e5(ut[_0x3f87('0x53')]('Calling'));})['catch'](function(_0x526cbe){ut[_0x3f87('0x67')](_0x3f87('0x104'),_0x526cbe);_0x4a4d3f(ut[_0x3f87('0x53')](_0x3f87('0x105'),_0x33e423,_0x2317f1));});}else{_0x53f1dd[_0x3f87('0x40')]+=0x1;ut[_0x3f87('0x106')](_0x41961e);rpcDb[_0x3f87('0x107')](_0x41961e,_0x3f87('0x108'));delete _0x94cb13[_0x3f87('0x19')][_0x23b3ac];_0x4a4d3f(ut[_0x3f87('0x53')](_0x3f87('0x109'),_0x33e423,_0x2317f1));}});};Preview['prototype'][_0x3f87('0x99')]=function(_0x13a732){return!_['isNil'](_0x13a732)&&!_['isNil'](_0x13a732[_0x3f87('0x2b')])&&!_['isNil'](_0x13a732[_0x3f87('0x5b')])&&_0x13a732[_0x3f87('0x5b')]&&!_[_0x3f87('0x70')](this['trunks'][util[_0x3f87('0x5d')]('SIP/%s',_0x13a732[_0x3f87('0x2b')])])&&!_[_0x3f87('0x70')](this[_0x3f87('0x18')][util[_0x3f87('0x5d')](_0x3f87('0x10a'),_0x13a732['name'])][_0x3f87('0x10b')])&&(this[_0x3f87('0x18')][util['format'](_0x3f87('0x10a'),_0x13a732[_0x3f87('0x2b')])][_0x3f87('0x10b')]===_0x3f87('0x10c')||this['trunks'][util[_0x3f87('0x5d')](_0x3f87('0x10a'),_0x13a732['name'])][_0x3f87('0x10b')]===_0x3f87('0x10d'));};Preview['prototype']['run']=function(_0x26ab7a,_0x395df9){var _0x405d8b=this;return new BPromise(function(_0x553121,_0x10a5d1){_0x405d8b[_0x3f87('0x10e')](_0x26ab7a,_0x395df9)[_0x3f87('0x87')](function(_0x52e580){_0x553121(_[_0x3f87('0x77')](_0x52e580,[_0x3f87('0x53')]));})[_0x3f87('0x7d')](function(_0x5d4eef){if(_0x5d4eef[_0x3f87('0x10f')]){rpcDb[_0x3f87('0x110')](_0x26ab7a);}if(_0x5d4eef[_0x3f87('0x5b')]){rpcDb[_0x3f87('0x111')](_0x26ab7a);}_0x10a5d1(_['pick'](_0x5d4eef,[_0x3f87('0x53')]));});});};Preview[_0x3f87('0x11')][_0x3f87('0x10e')]=function(_0x39333b,_0x299b9f){var _0x2051b5=this;return new BPromise(function(_0x40d347,_0x371db5){var _0x1e0dba,_0x40d01e;rpcDb[_0x3f87('0x112')](_0x39333b)[_0x3f87('0x87')](function(_0x4472e6){if(!_[_0x3f87('0x70')](_0x4472e6[0x0])){_0x40d01e=_0x4472e6[0x0]['recallme']?![]:!![];_0x1e0dba=_0x4472e6[0x0][_0x3f87('0x113')]?!![]:![];_0x1e0dba=_0x299b9f?!![]:_0x1e0dba;}var _0x54ca37=_0x2051b5['validateContact'](_0x4472e6);if(_0x54ca37[_0x3f87('0x114')]){rpcDb['checkIsBlackList'](_[_0x3f87('0x77')](_0x4472e6[0x0],[_0x3f87('0x7a'),_0x3f87('0x115')]))[_0x3f87('0x87')](function(_0x2203cd){_0x2051b5[_0x3f87('0xfe')](_0x2203cd,_0x4472e6[0x0],_0x299b9f,_0x40d01e,_0x1e0dba)[_0x3f87('0x87')](function(_0x490808){_0x40d347(_0x490808);})[_0x3f87('0x7d')](function(_0x86764){_0x371db5(_0x86764);});})[_0x3f87('0x7d')](function(_0x46b6e5){ut[_0x3f87('0x67')]('[Preview][checkIsBlackList]',_0x46b6e5);_0x371db5(ut[_0x3f87('0x53')]('Call\x20unsuccessful',_0x40d01e,_0x1e0dba));});}else{_0x371db5(ut[_0x3f87('0x53')](_0x54ca37[_0x3f87('0x53')],_0x40d01e,_0x1e0dba));}})['catch'](function(_0x590652){ut[_0x3f87('0x67')](_0x3f87('0x116'),_0x590652);_0x371db5(ut[_0x3f87('0x53')](_0x3f87('0x117'),![],!![]));});});};Preview[_0x3f87('0x11')][_0x3f87('0x118')]=function(_0x359bc2){if(_[_0x3f87('0x70')](_0x359bc2)||_['isEmpty'](_0x359bc2)||!_[_0x3f87('0x70')](_0x359bc2[0x0][_0x3f87('0x8b')])&&_[_0x3f87('0x70')](_0x359bc2[0x0][_0x3f87('0x8b')]['name'])){ut[_0x3f87('0x67')](_0x3f87('0x119'),_0x359bc2);return{'isValid':![],'message':_0x3f87('0x11a')};}var _0x1e455c=this[_0x3f87('0x16')][_0x359bc2[0x0]['Queue'][_0x3f87('0x2b')]];_0x1e455c[_0x3f87('0x53')]=_0x3f87('0x9c');if(_[_0x3f87('0x70')](_0x1e455c)){ut[_0x3f87('0x67')](_0x3f87('0x11b'),_0x1e455c);return{'isValid':![],'message':_0x3f87('0x11c')};}if(!this[_0x3f87('0x99')](_0x1e455c[_0x3f87('0x5a')])){ut['logger'](_0x3f87('0x11d'),_0x3f87('0x11e')+_0x1e455c['name']+_0x3f87('0x11f'));if(!this[_0x3f87('0x99')](_0x1e455c[_0x3f87('0x9a')])){ut['logger'](_0x3f87('0x11d'),_0x1e455c[_0x3f87('0x2b')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x3f87('0x120')};}}if(!ut[_0x3f87('0x121')](_0x1e455c[_0x3f87('0x6c')])){ut[_0x3f87('0x67')]('[Preview][validateContact][Campaign\x20Active]',_0x1e455c[_0x3f87('0x2b')]+_0x3f87('0x122'));return{'isValid':![],'message':_0x3f87('0x11e')+_0x1e455c['name']+_0x3f87('0x122')};}return{'isValid':!![],'message':_0x3f87('0x123')};};Preview[_0x3f87('0x11')][_0x3f87('0x124')]=function(_0x3b1ee2,_0x880693,_0x46b035,_0x28aefc){var _0x204e5a=this;return new BPromise(function(_0x1e6775,_0x457286){var _0x3122b8=_0x3b1ee2['uniqueid'];var _0x48d9cc=_0x204e5a[_0x3f87('0x99')](_0x880693['Trunk'])?util['format'](_0x3f87('0x125'),_0x880693[_0x3f87('0x5a')]['name'],_[_0x3f87('0x70')](_0x880693[_0x3f87('0x3d')])?'':_0x880693['dialPrefix']['trim']()||'',_0x880693['dialCutDigit']>0x0?_0x46b035[_0x3f87('0xff')][_0x3f87('0x126')][_0x3f87('0x127')](_0x880693[_0x3f87('0x128')]):_0x46b035[_0x3f87('0xff')][_0x3f87('0x126')]):util[_0x3f87('0x5d')](_0x3f87('0x125'),_[_0x3f87('0x70')](_0x880693[_0x3f87('0x9a')])?_0x880693[_0x3f87('0x5a')][_0x3f87('0x2b')]:_0x880693[_0x3f87('0x9a')]['name'],_[_0x3f87('0x70')](_0x880693[_0x3f87('0x3d')])?'':_0x880693['dialPrefix']['trim']()||'',_0x880693[_0x3f87('0x128')]>0x0?_0x46b035[_0x3f87('0xff')][_0x3f87('0x126')]['substring'](_0x880693[_0x3f87('0x128')]):_0x46b035[_0x3f87('0xff')][_0x3f87('0x126')]);var _0x3a04f1=_0x204e5a[_0x3f87('0x99')](_0x880693[_0x3f87('0x5a')])?ut[_0x3f87('0x129')](_0x880693[_0x3f87('0x5a')]['callerid'],_0x880693[_0x3f87('0x3a')],_0x880693[_0x3f87('0x12a')]>0x0?ut[_0x3f87('0x12b')](_0x880693[_0x3f87('0x3b')],_0x880693['dialRandomLastDigitCallerIdNumber']):_0x880693['dialOriginateCallerIdNumber']):ut[_0x3f87('0x129')](_[_0x3f87('0x70')](_0x880693['TrunkBackup'])?_0x880693[_0x3f87('0x5a')][_0x3f87('0x12c')]:_0x880693[_0x3f87('0x9a')]['callerid'],_0x880693['dialOriginateCallerIdName'],_0x880693[_0x3f87('0x12a')]>0x0?ut[_0x3f87('0x12b')](_0x880693['dialOriginateCallerIdNumber'],_0x880693[_0x3f87('0x12a')]):_0x880693[_0x3f87('0x3b')]);if(_0x3a04f1){_0x3b1ee2['originatecalleridname']=ut[_0x3f87('0x12d')](_0x3a04f1);_0x3b1ee2[_0x3f87('0x12e')]=ut[_0x3f87('0x12f')](_0x3a04f1);}var _0x2ca849=ut[_0x3f87('0x130')](_0x880693,_0x46b035,_0x48d9cc,_0x3a04f1,_0x3122b8,_0x3b1ee2);_[_0x3f87('0x131')](_0x3b1ee2,ut[_0x3f87('0x132')](_0x2ca849));_0x3b1ee2[_0x3f87('0x133')]=moment()['format'](_0x3f87('0x90'));ami[_0x3f87('0x7b')](ut['variablesAction'](_0x3b1ee2,_0x880693,_0x2ca849,_0x3b1ee2['activeContact'],_0x28aefc))[_0x3f87('0x87')](function(_0x4fdc2a){_0x880693[_0x3f87('0x54')]+=0x1;logger['info'](_0x3f87('0x134'),_0x3122b8,_0x3f87('0xb0'),_0x880693[_0x3f87('0x2b')],'originated:\x20',_0x880693[_0x3f87('0x54')]);_0x1e6775(_0x4fdc2a);})['catch'](function(_0x45080f){ut[_0x3f87('0xf4')](_0x3b1ee2,0xe,_0x3f87('0x135'));rpcDb[_0x3f87('0xf7')](_0x3b1ee2,'[originateFailure][logOriginateFailure]');_0x457286(_0x45080f);});});};Preview[_0x3f87('0x11')][_0x3f87('0x136')]=function(_0x96b7fe){if(this[_0x3f87('0x19')][_0x96b7fe['linkedid']]){this[_0x3f87('0x19')][_0x96b7fe[_0x3f87('0xe9')]][_0x3f87('0x7c')]=_0x96b7fe[_0x3f87('0x7c')];}};Preview[_0x3f87('0x11')][_0x3f87('0x1c')]=function(_0x3fa2c2){var _0x1ee2fa=this;var _0x139884=this['actions'][_0x3fa2c2[_0x3f87('0x137')]];if(_0x139884){if(_0x139884[_0x3f87('0x138')]&&this[_0x3f87('0x1a')][_0x139884[_0x3f87('0x138')]]){ut[_0x3f87('0x139')](_0x139884,this[_0x3f87('0x1a')][_0x139884[_0x3f87('0x138')]][_0x3f87('0x2b')],this[_0x3f87('0x1a')][_0x139884[_0x3f87('0x138')]]['id']);}var _0x7b2392=_[_0x3f87('0x13a')](_0x139884);_0x7b2392[_0x3f87('0xac')]=moment()[_0x3f87('0x5d')](_0x3f87('0x90'));var _0x412cec=_0x1ee2fa[_0x3f87('0x16')][_0x139884['queue']];if(ut[_0x3f87('0x13b')](_0x3fa2c2[_0x3f87('0x13c')])){if(_0x139884[_0x3f87('0xa9')]){rpcDb[_0x3f87('0x110')](_0x139884[_0x3f87('0x101')]);}if(_0x139884['activeContact']){rpcDb[_0x3f87('0x111')](_0x139884[_0x3f87('0x101')]);}ami[_0x3f87('0x29')](_0x3f87('0x13d'),ut[_0x3f87('0xb2')](_0x139884,_0x3f87('0x13e'),this[_0x3f87('0x16')][_0x139884[_0x3f87('0x73')]]));this[_0x3f87('0xf0')](_0x7b2392,_0x412cec,_0x3fa2c2);}else{_0x139884[_0x3f87('0x133')]=moment()[_0x3f87('0x5d')](_0x3f87('0x90'));ut['logAgent'](_0x7b2392,0x4,_0x3f87('0xb7'));rpcDb[_0x3f87('0xf7')](_0x7b2392,_0x3f87('0x13f'));}}};Preview[_0x3f87('0x11')][_0x3f87('0x1f')]=function(_0x448b4e){var _0x186055=this;var _0x4925bc=this['actions'][_0x448b4e['linkedid']];var _0x4f764c;if(_0x4925bc){_0x4f764c=this[_0x3f87('0x16')][_0x4925bc['queue']];logger[_0x3f87('0x71')]('[syncHangup][talking]',_0x448b4e['linkedid'],'\x20Queue',_0x4f764c['name'],_0x3f87('0x75'),_0x4f764c[_0x3f87('0x30')]);}if(this[_0x3f87('0x19')][_0x448b4e['linkedid']]&&_0x448b4e[_0x3f87('0xe9')]!==_0x448b4e[_0x3f87('0xaf')]){if(_0x448b4e[_0x3f87('0x140')]==='16'&&this[_0x3f87('0x19')][_0x448b4e['linkedid']][_0x3f87('0x76')]){this[_0x3f87('0x9d')](_0x448b4e,_0x448b4e[_0x3f87('0xe9')],_0x448b4e['cause']);}else if(this[_0x3f87('0x19')][_0x448b4e['linkedid']][_0x3f87('0x76')]){logger[_0x3f87('0x71')]('[syncHangup][talking][cause]',_0x448b4e[_0x3f87('0xe9')],_0x448b4e[_0x3f87('0x140')],'\x20Queue',_0x4f764c[_0x3f87('0x2b')],_0x3f87('0x75'),_0x4f764c[_0x3f87('0x30')]);this[_0x3f87('0x9d')](_0x448b4e,_0x448b4e['linkedid'],_0x448b4e[_0x3f87('0x140')]);}}else if(_0x4925bc&&_[_0x3f87('0x70')](_0x4925bc[_0x3f87('0x141')])&&_0x4f764c['dialQueueProject']&&_0x448b4e[_0x3f87('0xe9')]===_0x448b4e[_0x3f87('0xaf')]&&_['isNil'](_0x448b4e[_0x3f87('0xf3')])&&_0x448b4e[_0x3f87('0x140')]==='16'&&_0x448b4e['channelstate']==='6'&&_[_0x3f87('0xf1')](_0x4925bc['transfer'])){if(_0x4925bc['unlockAgent']){rpcDb[_0x3f87('0x110')](_0x4925bc['idContact']);}if(_0x4925bc[_0x3f87('0xaa')]){rpcDb[_0x3f87('0x111')](_0x4925bc['idContact']);}_0x448b4e[_0x3f87('0xf3')]='22';this['callProgressDetectingAgent'](_0x4925bc,_0x4f764c,_0x448b4e);}else if(_0x4925bc&&_0x4925bc[_0x3f87('0x142')]){if(_0x448b4e['cause']==='16'&&this[_0x3f87('0x19')][_0x448b4e['linkedid']][_0x3f87('0x76')]){logger['info'](_0x3f87('0x143'),_0x448b4e[_0x3f87('0xe9')],_0x448b4e[_0x3f87('0x140')],_0x3f87('0xb0'),_0x4f764c['name'],_0x3f87('0x75'),_0x4f764c[_0x3f87('0x30')]);this[_0x3f87('0x9d')](_0x448b4e,_0x448b4e['linkedid'],_0x448b4e[_0x3f87('0x140')]);}else if(this[_0x3f87('0x19')][_0x448b4e[_0x3f87('0xe9')]][_0x3f87('0x76')]){logger[_0x3f87('0x71')](_0x3f87('0x144'),_0x448b4e[_0x3f87('0xe9')],_0x448b4e[_0x3f87('0x140')],'\x20Queue',_0x4f764c[_0x3f87('0x2b')],_0x3f87('0x75'),_0x4f764c[_0x3f87('0x30')]);this['callProgressDetectingCustomer'](_0x448b4e,_0x448b4e[_0x3f87('0xe9')],_0x448b4e[_0x3f87('0x140')]);}}};Preview[_0x3f87('0x11')][_0x3f87('0x22')]=function(_0x35530b){if(this[_0x3f87('0x19')][_0x35530b[_0x3f87('0xef')]]&&_0x35530b[_0x3f87('0xef')]!==_0x35530b[_0x3f87('0x145')]){this['callProgressDetectingCustomer'](_0x35530b,_0x35530b['destlinkedid'],_0x35530b[_0x3f87('0xe5')]);}};Preview[_0x3f87('0x11')][_0x3f87('0x21')]=function(_0x9f8158){if(this[_0x3f87('0x19')][_0x9f8158[_0x3f87('0xe9')]]&&_0x9f8158[_0x3f87('0xe9')]!==_0x9f8158[_0x3f87('0xaf')]&&!this['actions'][_0x9f8158[_0x3f87('0xe9')]][_0x3f87('0x76')]){if(_0x9f8158[_0x3f87('0x140')]==='1'){this[_0x3f87('0x9d')](_0x9f8158,_0x9f8158['linkedid'],_0x9f8158[_0x3f87('0x140')]);}}};Preview['prototype'][_0x3f87('0x146')]=function(_0x35b971,_0x2f729b,_0x284a46){if(this[_0x3f87('0x19')][_0x35b971]){if(_['isNil'](this[_0x3f87('0x19')][_0x35b971][_0x3f87('0x147')])){this['actions'][_0x35b971]['variables']={};}this[_0x3f87('0x19')][_0x35b971][_0x3f87('0x147')][_0x2f729b]=_0x284a46;}};Preview['prototype'][_0x3f87('0x24')]=function(_0xdf135c){try{if(!_[_0x3f87('0x70')](_0xdf135c)){if(ut[_0x3f87('0x148')](_[_0x3f87('0x149')](_0xdf135c[_0x3f87('0x14a')])[0x0])){this[_0x3f87('0x146')](_0xdf135c['uniqueid'],_[_0x3f87('0x149')](_0xdf135c[_0x3f87('0x14a')])[0x0],_0xdf135c[_0x3f87('0x14b')]);}}}catch(_0x1bc6bf){logger[_0x3f87('0x14c')](_0x3f87('0x14d'),util['inspect'](_0x1bc6bf,{'showHidden':![],'depth':null}));}};Preview[_0x3f87('0x11')][_0x3f87('0x26')]=function(_0x14737b){if(_0x14737b){if(this[_0x3f87('0x19')][_0x14737b[_0x3f87('0x14e')]]){this[_0x3f87('0x19')][_0x14737b[_0x3f87('0x14e')]][_0x3f87('0x142')]=!![];}}};Preview[_0x3f87('0x11')][_0x3f87('0x27')]=function(_0x5dec7b){if(_0x5dec7b){if(this[_0x3f87('0x19')][_0x5dec7b[_0x3f87('0x14f')]]){this[_0x3f87('0x19')][_0x5dec7b['transfererlinkedid']][_0x3f87('0x142')]=!![];}}};module[_0x3f87('0x150')]=Preview; \ No newline at end of file +var _0x9c5a=['[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','logAgent','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Calling','Call\x20failed','outboundBlacklistCallsDay','createHistory','[Blacklist][error]','SIP/%s','status','unmonitored','execRun','pick','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','dialPrefix','dialCutDigit','substring','SIP/%s/%s%s','trim','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','getCallerId','dialOriginateCallerIdName','originatecalleridname','extractCalleridName','originatecalleridnum','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','channel','actionid','lookAgent','logLookAgent','clone','responsetime','isFailure','response','idContact','custom:agentringnoanswer','rejected','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','addVariable','variables','keys','variable','error','inspect','transfererlinkedid','exports','util','lodash','uuid','moment','md5','ioredis','../../../config/logger','preview','actionPreview','./rpcDb','./action','defaults','redis','socket.io-emitter','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','type','outbound','name','strategy','answered','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','abandoned','waiting','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','Interval','stringify','format','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','prototype','hasOwnProperty','booked','clearZombieChannels','dialActive','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','contactId','UserId','VoiceQueueId','ListId','Action','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[action]','size','clearZombieChannel','recallMe','getContactRecallMe','then','length','scheduledat','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','setMessage','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','countnosuchnumberretry','countglobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','totalGlobal','dialGlobalMaxRetry','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','dialNoSuchNumberRetryFrequency','activeContact','linkedid','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','connect','acw','buildAcw','custom:agentcomplete','Answer','[callProgressDetectingCustomer][logAnswer]','talktime','BUSY','countbusyretry','Busy','busy','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','dialBusyRetryFrequency','unlockAgent','outboundNoAnswerCallsDay','custom:agentnoanswer','noanswer','cloneAction','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','rescheduleContact','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','countagentrejectretry','AgentReject','agentreject','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]'];(function(_0x462e1e,_0x168a64){var _0x100ec6=function(_0x3a24c6){while(--_0x3a24c6){_0x462e1e['push'](_0x462e1e['shift']());}};_0x100ec6(++_0x168a64);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x2e147e,_0x4e51cd){_0x2e147e=_0x2e147e-0x0;var _0x4df73c=_0x9c5a[_0x2e147e];return _0x4df73c;};'use strict';var util=require(_0xa9c5('0x0'));var _=require(_0xa9c5('0x1'));var BPromise=require('bluebird');var uuid=require(_0xa9c5('0x2'));var moment=require(_0xa9c5('0x3'));var md5=require(_0xa9c5('0x4'));var Redis=require(_0xa9c5('0x5'));var config=require('../../../config/environment');var logger=require(_0xa9c5('0x6'))(_0xa9c5('0x7'));var loggerAction=require('../../../config/logger')(_0xa9c5('0x8'));var ami=require('../ami');var rpcDb=require(_0xa9c5('0x9'));var Action=require(_0xa9c5('0xa'));var ut=require('./util/util');config['redis']=_[_0xa9c5('0xb')](config[_0xa9c5('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0xa9c5('0xd'))(new Redis(config[_0xa9c5('0xc')]));var Sequence=function(){};Sequence['prototype'][_0xa9c5('0xe')]=function(_0x40a79d){this['tail']=this['tail']?this[_0xa9c5('0xf')][_0xa9c5('0x10')](_0x40a79d):_0x40a79d();};function Preview(_0x45f8d8){this[_0xa9c5('0x11')]=new Sequence();this[_0xa9c5('0x12')]=_0x45f8d8[_0xa9c5('0x13')];this[_0xa9c5('0x14')]=_0x45f8d8[_0xa9c5('0x14')];this[_0xa9c5('0x15')]={};this[_0xa9c5('0x16')]=_0x45f8d8['agents'];this[_0xa9c5('0x17')]=0x0;ami['on'](_0xa9c5('0x18'),this[_0xa9c5('0x19')][_0xa9c5('0x1a')](this));ami['on'](_0xa9c5('0x1b'),this[_0xa9c5('0x1c')][_0xa9c5('0x1a')](this));ami['on'](_0xa9c5('0x1d'),this[_0xa9c5('0x1e')][_0xa9c5('0x1a')](this));ami['on']('dialend',this[_0xa9c5('0x1f')][_0xa9c5('0x1a')](this));ami['on'](_0xa9c5('0x20'),this['syncNewExten'][_0xa9c5('0x1a')](this));ami['on'](_0xa9c5('0x21'),this[_0xa9c5('0x22')][_0xa9c5('0x1a')](this));ami['on'](_0xa9c5('0x23'),this[_0xa9c5('0x24')][_0xa9c5('0x1a')](this));ami['on'](_0xa9c5('0x25'),this[_0xa9c5('0x26')][_0xa9c5('0x1a')](this));this[_0xa9c5('0x27')](this[_0xa9c5('0x12')]);}function emit(_0x54f8b9,_0x1115ad,_0x21ab50){io['to'](_0x54f8b9)['emit'](_0x1115ad,_0x21ab50);}function emitCampaignPreview(_0x5d2115){if(_0x5d2115[_0xa9c5('0x28')]===_0xa9c5('0x29')){var _0x10b208={'id':_0x5d2115['id'],'name':_0x5d2115[_0xa9c5('0x2a')],'strategy':_0x5d2115[_0xa9c5('0x2b')],'answered':_0x5d2115[_0xa9c5('0x2c')],'available':_0x5d2115['available'],'loggedIn':_0x5d2115['loggedIn'],'pTalking':_0x5d2115[_0xa9c5('0x2d')],'sumBillable':_0x5d2115[_0xa9c5('0x2e')],'sumDuration':_0x5d2115['sumDuration'],'sumHoldTime':_0x5d2115[_0xa9c5('0x2f')]||0x0,'talking':_0x5d2115[_0xa9c5('0x30')],'total':_0x5d2115[_0xa9c5('0x31')],'type':_0x5d2115[_0xa9c5('0x28')],'unmanaged':_0x5d2115[_0xa9c5('0x32')],'abandoned':_0x5d2115[_0xa9c5('0x33')],'waiting':_0x5d2115[_0xa9c5('0x34')],'loggedInDb':_0x5d2115['loggedInDb'],'dialActive':_0x5d2115['dialActive'],'dialMethod':_0x5d2115[_0xa9c5('0x35')],'dialOriginateCallerIdName':_0x5d2115['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x5d2115[_0xa9c5('0x36')],'dialOriginateTimeout':_0x5d2115[_0xa9c5('0x37')],'dialPrefix':_0x5d2115['dialPrefix'],'outboundAnswerAgiCallsDay':_0x5d2115[_0xa9c5('0x38')],'outboundAnswerCallsDay':_0x5d2115[_0xa9c5('0x39')],'outboundBlacklistCallsDay':_0x5d2115['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x5d2115[_0xa9c5('0x3a')],'outboundCongestionCallsDay':_0x5d2115[_0xa9c5('0x3b')],'outboundDropCallsDayACS':_0x5d2115[_0xa9c5('0x3c')],'outboundDropCallsDayCallersExit':_0x5d2115[_0xa9c5('0x3d')],'outboundDropCallsDayTimeout':_0x5d2115[_0xa9c5('0x3e')],'outboundNoAnswerCallsDay':_0x5d2115['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x5d2115[_0xa9c5('0x3f')],'outboundOriginateFailureCallsDay':_0x5d2115['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x5d2115[_0xa9c5('0x40')],'outboundRejectCallsDay':_0x5d2115[_0xa9c5('0x41')],'outboundUnknownCallsDay':_0x5d2115[_0xa9c5('0x42')],'outboundAbandonedCallsDay':_0x5d2115['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x5d2115[_0xa9c5('0x43')],'predictiveIntervalAvgHoldtime':_0x5d2115[_0xa9c5('0x44')],'predictiveIntervalAvgTalktime':_0x5d2115['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x5d2115[_0xa9c5('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x5d2115[_0xa9c5('0x46')],'predictiveIntervalErlangCalls':_0x5d2115[_0xa9c5('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x5d2115[_0xa9c5('0x48')],'predictiveIntervalHitRate':_0x5d2115[_0xa9c5('0x49')],'predictiveIntervalMultiplicativeFactor':_0x5d2115[_0xa9c5('0x4a')],'predictiveIntervalPauses':_0x5d2115[_0xa9c5('0x4b')],'predictiveIntervalAvailable':_0x5d2115['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x5d2115[_0xa9c5('0x4c')],'message':_0x5d2115[_0xa9c5('0x4d')],'originated':_0x5d2115[_0xa9c5('0x4e')],'erlangCalls':_0x5d2115[_0xa9c5('0x4f')],'erlangCallToSecond':_0x5d2115[_0xa9c5('0x50')],'erlangAbandonmentRate':_0x5d2115[_0xa9c5('0x51')],'erlangBusyFactor':_0x5d2115[_0xa9c5('0x52')],'startPredictive':_0x5d2115[_0xa9c5('0x53')],'startProgressive':_0x5d2115['startProgressive']};if(_0x5d2115['Trunk']){_0x10b208[_0xa9c5('0x54')]={'id':_0x5d2115[_0xa9c5('0x54')]['id'],'name':_0x5d2115[_0xa9c5('0x54')][_0xa9c5('0x2a')],'active':_0x5d2115[_0xa9c5('0x54')][_0xa9c5('0x55')],'callerid':_0x5d2115['Trunk']['callerid']};}if(_0x5d2115['Interval']){_0x10b208[_0xa9c5('0x56')]={'id':_0x5d2115[_0xa9c5('0x56')]['id'],'name':_0x5d2115['Interval'][_0xa9c5('0x2a')]};}var _0x56eb82=md5(JSON[_0xa9c5('0x57')](_0x10b208));if(_0x5d2115[_0xa9c5('0x4')]!==_0x56eb82){_0x5d2115[_0xa9c5('0x4')]=_0x56eb82;emit(util[_0xa9c5('0x58')]('voice:queue:%s',_0x10b208[_0xa9c5('0x2a')]),_0xa9c5('0x59'),_0x10b208);}}}function emitVoiceQueueChannelRemove(_0x191153){logger[_0xa9c5('0x5a')](_0xa9c5('0x5b'),JSON[_0xa9c5('0x57')](_0x191153));emit(util[_0xa9c5('0x58')](_0xa9c5('0x5c'),_0x191153['name']),_0xa9c5('0x5d'),_0x191153);io[_0xa9c5('0x5e')](_0xa9c5('0x5f'),_0x191153);}function notSendMessagesQueue(_0x2b95fa){if(_0x2b95fa[_0xa9c5('0x60')]){if(_0x2b95fa[_0xa9c5('0x4e')]===0x0&&_0x2b95fa['pTalking']===0x0){_0x2b95fa[_0xa9c5('0x60')]=![];_0x2b95fa['available']=0x0;_0x2b95fa[_0xa9c5('0x61')]=0x0;_0x2b95fa['message']=_0xa9c5('0x62');ut[_0xa9c5('0x63')](_0xa9c5('0x64'),_0x2b95fa['name']+_0xa9c5('0x65'));}else{_0x2b95fa[_0xa9c5('0x4d')]=_0xa9c5('0x66');ut[_0xa9c5('0x63')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x2b95fa[_0xa9c5('0x2a')]+_0xa9c5('0x67'));}emitCampaignPreview(_0x2b95fa);}}Preview[_0xa9c5('0x68')][_0xa9c5('0x27')]=function(){var _0x2a6b48=this;setInterval(function(){_0x2a6b48['syncCampaigns']();},0x7cf);};Preview[_0xa9c5('0x68')]['syncCampaigns']=function(){var _0x1de605=this[_0xa9c5('0x12')];this[_0xa9c5('0x17')]+=0x1;for(var _0xc8fca4 in _0x1de605){if(_0x1de605[_0xa9c5('0x69')](_0xc8fca4)&&(_0x1de605[_0xc8fca4][_0xa9c5('0x35')]===_0xa9c5('0x7')||_0x1de605[_0xc8fca4][_0xa9c5('0x35')]===_0xa9c5('0x6a'))&&_0x1de605[_0xc8fca4][_0xa9c5('0x28')]==='outbound'){if(this[_0xa9c5('0x17')]>0x7){this[_0xa9c5('0x17')]=0x0;this[_0xa9c5('0x6b')]();}}if(_0x1de605[_0xa9c5('0x69')](_0xc8fca4)&&_0x1de605[_0xc8fca4][_0xa9c5('0x35')]===_0xa9c5('0x7')&&_0x1de605[_0xc8fca4]['type']===_0xa9c5('0x29')){if(_0x1de605[_0xc8fca4][_0xa9c5('0x6c')]){this['setMessage'](_0x1de605[_0xc8fca4]);if(_0x1de605[_0xc8fca4]['dialPreviewAutoRecallMe'])this['recallMe'](_0x1de605[_0xc8fca4]);}else{notSendMessagesQueue(_0x1de605[_0xc8fca4]);}}}};Preview['prototype']['clearZombieChannel']=function(_0x160020){var _0x569185=this;this[_0xa9c5('0x11')][_0xa9c5('0xe')](function(){if(!_[_0xa9c5('0x6d')](_0x569185[_0xa9c5('0x15')][_0x160020])){loggerAction[_0xa9c5('0x5a')](_0xa9c5('0x6e'),_0x160020,_0xa9c5('0x6f'),_0x569185[_0xa9c5('0x15')][_0x160020][_0xa9c5('0x70')],_0xa9c5('0x71'),JSON[_0xa9c5('0x57')](_0x569185['campaignsPreview'][_0x569185[_0xa9c5('0x15')][_0x160020]['queue']][_0xa9c5('0x4e')]),_0xa9c5('0x72'),JSON['stringify'](_0x569185['campaignsPreview'][_0x569185[_0xa9c5('0x15')][_0x160020][_0xa9c5('0x70')]][_0xa9c5('0x2d')]),JSON['stringify'](_0x569185['actions'][_0x160020][_0xa9c5('0x73')]),JSON[_0xa9c5('0x57')](_['pick'](_0x569185[_0xa9c5('0x15')][_0x160020],[_0xa9c5('0x74'),_0xa9c5('0x75'),_0xa9c5('0x76'),_0xa9c5('0x77')])));return ami[_0xa9c5('0x78')]({'action':'status','channel':_0x569185['actions'][_0x160020]['channel']})[_0xa9c5('0x79')](function(_0x277903){if(_0x277903[_0xa9c5('0x4d')]===_0xa9c5('0x7a')){setTimeout(function(){if(_0x569185[_0xa9c5('0x15')][_0x160020]){ut[_0xa9c5('0x7b')](_0x569185['campaignsPreview'][_0x569185[_0xa9c5('0x15')][_0x160020][_0xa9c5('0x70')]],_0xa9c5('0x7c'));if(_0x569185[_0xa9c5('0x15')][_0x160020][_0xa9c5('0x73')]===!![]){ut[_0xa9c5('0x7d')](_0x569185['campaignsPreview'][_0x569185['actions'][_0x160020][_0xa9c5('0x70')]],'[clearZombieChannel]');ut[_0xa9c5('0x7e')]('[Dialer][checkChannel][pTalking][Preview]'+_0x160020,_0x569185[_0xa9c5('0x15')][_0x160020][_0xa9c5('0x70')]);}ut[_0xa9c5('0x7e')]('[Dialer][checkChannel][Preview]'+_0x160020,_0x569185[_0xa9c5('0x15')][_0x160020][_0xa9c5('0x70')]);delete _0x569185[_0xa9c5('0x15')][_0x160020];}},0x2328);}});}});};Preview[_0xa9c5('0x68')]['clearZombieChannels']=function(){var _0x49422c=this;loggerAction[_0xa9c5('0x5a')](_0xa9c5('0x7f'),_[_0xa9c5('0x80')](this['actions']));for(var _0x31e12e in this[_0xa9c5('0x15')]){if(_0x49422c[_0xa9c5('0x15')][_0xa9c5('0x69')](_0x31e12e)){_0x49422c[_0xa9c5('0x81')](_0x31e12e);}}};Preview[_0xa9c5('0x68')][_0xa9c5('0x82')]=function(_0x298b3d){var _0x5a7f0a=this;rpcDb[_0xa9c5('0x83')](_0x298b3d['id'],ut['agentReadyId'](this[_0xa9c5('0x16')]))[_0xa9c5('0x84')](function(_0x26bda1){if(!_['isNil'](_0x26bda1)){for(var _0x4d475a=0x0;_0x4d475a<_0x26bda1[_0xa9c5('0x85')];_0x4d475a+=0x1){if(ut['getDiff'](_0x26bda1[_0x4d475a][_0xa9c5('0x86')])<_0x298b3d[_0xa9c5('0x87')]*0x3c){if(_0x26bda1[_0x4d475a][_0xa9c5('0x88')]&&!_0x26bda1[_0x4d475a][_0xa9c5('0x88')]['voicePause']){_0x5a7f0a[_0xa9c5('0x89')](_0x26bda1[_0x4d475a]['id'])[_0xa9c5('0x84')](ut[_0xa9c5('0x8a')](_0xa9c5('0x8b')))['catch'](ut['logger2'](_0xa9c5('0x8b')));}else{rpcDb[_0xa9c5('0x8c')](_0x26bda1[_0x4d475a]['id']);}}else{var _0x67c1f8=new Action(_0x26bda1[_0x4d475a],_0x298b3d);_0x67c1f8[_0xa9c5('0x8d')]=moment()[_0xa9c5('0x58')](_0xa9c5('0x8e'));_0x298b3d['outboundReCallsDay']+=0x1;ut[_0xa9c5('0x8f')](_0x67c1f8,0x17,_0xa9c5('0x90'));if(_0x298b3d[_0xa9c5('0x91')]){rpcDb[_0xa9c5('0x92')](ut[_0xa9c5('0x93')](_0x26bda1[_0x4d475a]));rpcDb[_0xa9c5('0x94')](_0x67c1f8,_0xa9c5('0x95'));}else{ut[_0xa9c5('0x8f')](_0x67c1f8,0x16,_0xa9c5('0x96'));rpcDb[_0xa9c5('0x94')](_0x67c1f8,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x67c1f8,_0xa9c5('0x97'));}}}}})[_0xa9c5('0x79')](ut[_0xa9c5('0x8a')](_0xa9c5('0x98')));};Preview['prototype'][_0xa9c5('0x99')]=function(_0x4aa699){_0x4aa699[_0xa9c5('0x60')]=!![];if(ut[_0xa9c5('0x9a')](_0x4aa699[_0xa9c5('0x9b')])){_0x4aa699[_0xa9c5('0x4d')]=_0xa9c5('0x9c');}else if(!ut[_0xa9c5('0x9d')](_0x4aa699[_0xa9c5('0x6c')])){_0x4aa699[_0xa9c5('0x4d')]=_0xa9c5('0x62');}else if(!this[_0xa9c5('0x9e')](_0x4aa699[_0xa9c5('0x54')])){if(!this[_0xa9c5('0x9e')](_0x4aa699['TrunkBackup'])){_0x4aa699[_0xa9c5('0x4d')]=_0xa9c5('0x9f');}else{_0x4aa699[_0xa9c5('0x4d')]=_0xa9c5('0xa0');}}else{_0x4aa699[_0xa9c5('0x4d')]=_0xa9c5('0xa0');}emitCampaignPreview(_0x4aa699);};Preview[_0xa9c5('0x68')]['callProgressDetectingCustomer']=function(_0x5b7c33,_0x207bb7,_0x502a00){var _0x2ae087=this;var _0x2510e4=this['actions'][_0x207bb7];var _0x219854=this[_0xa9c5('0x12')][_0x2510e4['queue']];var _0x4f8d9e;if(_0x219854){switch(_0x502a00){case'1':_0x219854[_0xa9c5('0x3f')]+=0x1;_0x2510e4[_0xa9c5('0xa1')]+=0x1;_0x2510e4[_0xa9c5('0xa2')]=ut['totalGlobal'](_0x2510e4);ut['logCustomer'](_0x2510e4,0x0,_0xa9c5('0xa3'));ami[_0xa9c5('0x5e')]('custom:agentnosuchnumber',ut[_0xa9c5('0xa4')](_0x2510e4,_0xa9c5('0xa5')));rpcDb[_0xa9c5('0x94')](_0x2510e4,_0xa9c5('0xa6'));if(ut[_0xa9c5('0xa7')](_0x2510e4)>=_0x219854[_0xa9c5('0xa8')]){_0x4f8d9e=ut['cloneAction'](_0x2510e4,0xf,_0xa9c5('0xa9'));rpcDb[_0xa9c5('0xaa')](_0x4f8d9e,_0xa9c5('0xab'));}else{if(_0x2510e4[_0xa9c5('0xa1')]>=_0x219854['dialNoSuchNumberMaxRetry']){rpcDb[_0xa9c5('0xaa')](_0x2510e4,_0xa9c5('0xab'));}else{rpcDb['rescheduleContact'](ut[_0xa9c5('0xac')](_0x2510e4,_0xa9c5('0xa1'),_0x219854[_0xa9c5('0xad')]),_0x2510e4['unlockAgent'],_0x2510e4[_0xa9c5('0xae')]);}}delete this[_0xa9c5('0x15')][_0x5b7c33[_0xa9c5('0xaf')]];break;case _0xa9c5('0xb0'):var _0x2d449a=moment()[_0xa9c5('0x58')](_0xa9c5('0x8e'));_0x2510e4['responsetime']=_0x2d449a;_0x2510e4[_0xa9c5('0xb1')]=_0x2d449a;_0x2510e4[_0xa9c5('0x73')]=!![];_0x219854[_0xa9c5('0x2d')]+=0x1;logger[_0xa9c5('0x5a')](_0xa9c5('0xb2'),_0x2510e4[_0xa9c5('0xb3')],_0xa9c5('0xb4'),_0x219854[_0xa9c5('0x2a')],_0xa9c5('0x72'),_0x219854[_0xa9c5('0x2d')]);ami[_0xa9c5('0x5e')]('custom:agentconnect',ut[_0xa9c5('0xa4')](_0x2510e4,_0xa9c5('0xb5'),this['campaignsPreview'][_0x2510e4[_0xa9c5('0x70')]]));if(_0x219854[_0xa9c5('0xb6')]){ami[_0xa9c5('0x5e')]('custom:agentConnectPreview',ut[_0xa9c5('0xb7')](_0x2510e4));}break;case'16':ami[_0xa9c5('0x5e')](_0xa9c5('0xb8'),ut[_0xa9c5('0xa4')](_0x2510e4,'complete',this[_0xa9c5('0x12')][_0x2510e4[_0xa9c5('0x70')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x2510e4,'complete'));_0x219854['outboundAnswerCallsDay']+=0x1;_0x219854['total']+=0x1;_0x219854['answered']+=0x1;ut['decrementTalkink'](_0x219854,'[16]');_0x2510e4['countglobal']=ut[_0xa9c5('0xa7')](_0x2510e4);ut[_0xa9c5('0x8f')](_0x2510e4,0x4,_0xa9c5('0xb9'));rpcDb[_0xa9c5('0x94')](_0x2510e4,_0xa9c5('0xba'));rpcDb['createCustomerFinal'](_0x2510e4,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x2510e4);_0x219854['sumDuration']+=_0x2510e4[_0xa9c5('0xbb')];_0x219854[_0xa9c5('0x2e')]+=_0x2510e4[_0xa9c5('0xbb')];logger[_0xa9c5('0x5a')]('[syncHangup][talking][decrement]',_0x2510e4['uniqueid'],_0xa9c5('0xb4'),_0x219854[_0xa9c5('0x2a')],_0xa9c5('0x72'),_0x219854[_0xa9c5('0x2d')]);delete this[_0xa9c5('0x15')][_0x5b7c33['linkedid']];break;case _0xa9c5('0xbc'):_0x219854[_0xa9c5('0x3a')]+=0x1;_0x2510e4[_0xa9c5('0xbd')]+=0x1;_0x2510e4['countglobal']=ut[_0xa9c5('0xa7')](_0x2510e4);ut[_0xa9c5('0x8f')](_0x2510e4,0x5,_0xa9c5('0xbe'));ami[_0xa9c5('0x5e')]('custom:agentbusy',ut[_0xa9c5('0xa4')](_0x2510e4,_0xa9c5('0xbf')));rpcDb['createCustomerHistory'](_0x2510e4,'[callProgressDetectingCustomer][logBusy]');if(ut[_0xa9c5('0xa7')](_0x2510e4)>=_0x219854['dialGlobalMaxRetry']){_0x4f8d9e=ut['cloneAction'](_0x2510e4,0xf,_0xa9c5('0xa9'));rpcDb[_0xa9c5('0xaa')](_0x4f8d9e,_0xa9c5('0xc0'));}else{if(_0x2510e4[_0xa9c5('0xbd')]>=_0x219854[_0xa9c5('0xc1')]){rpcDb['createCustomerFinal'](_0x2510e4,_0xa9c5('0xc2'));}else{rpcDb['rescheduleContact'](ut[_0xa9c5('0xac')](_0x2510e4,_0xa9c5('0xbd'),_0x219854[_0xa9c5('0xc3')]),_0x2510e4[_0xa9c5('0xc4')],_0x2510e4['activeContact']);}}break;case'NOANSWER':_0x219854[_0xa9c5('0xc5')]+=0x1;_0x2510e4['countnoanswerretry']+=0x1;_0x2510e4['countglobal']=ut[_0xa9c5('0xa7')](_0x2510e4);ut[_0xa9c5('0x8f')](_0x2510e4,0x3,'NoAnswer');ami['emit'](_0xa9c5('0xc6'),ut[_0xa9c5('0xa4')](_0x2510e4,_0xa9c5('0xc7')));rpcDb[_0xa9c5('0x94')](_0x2510e4,'[callProgressDetectingCustomer][logNoAnswer]');if(ut['totalGlobal'](_0x2510e4)>=_0x219854[_0xa9c5('0xa8')]){_0x4f8d9e=ut[_0xa9c5('0xc8')](_0x2510e4,0xf,_0xa9c5('0xa9'));rpcDb[_0xa9c5('0xaa')](_0x4f8d9e,_0xa9c5('0xc9'));}else{if(_0x2510e4[_0xa9c5('0xca')]>=_0x219854[_0xa9c5('0xcb')]){rpcDb['createCustomerFinal'](_0x2510e4,_0xa9c5('0xcc'));}else{rpcDb[_0xa9c5('0xcd')](ut['scheduledAt'](_0x2510e4,_0xa9c5('0xca'),_0x219854[_0xa9c5('0xce')]),_0x2510e4['unlockAgent'],_0x2510e4[_0xa9c5('0xae')]);}}break;case _0xa9c5('0xcf'):_0x219854[_0xa9c5('0x3b')]+=0x1;_0x2510e4[_0xa9c5('0xd0')]+=0x1;_0x2510e4[_0xa9c5('0xa2')]=ut[_0xa9c5('0xa7')](_0x2510e4);ut[_0xa9c5('0x8f')](_0x2510e4,0x8,_0xa9c5('0xd1'));ami[_0xa9c5('0x5e')](_0xa9c5('0xd2'),ut[_0xa9c5('0xa4')](_0x2510e4,_0xa9c5('0xd3')));rpcDb[_0xa9c5('0x94')](_0x2510e4,_0xa9c5('0xd4'));if(ut[_0xa9c5('0xa7')](_0x2510e4)>=_0x219854[_0xa9c5('0xa8')]){_0x4f8d9e=ut[_0xa9c5('0xc8')](_0x2510e4,0xf,'Global');rpcDb[_0xa9c5('0xaa')](_0x4f8d9e,_0xa9c5('0xd5'));}else{if(_0x2510e4[_0xa9c5('0xd0')]>=_0x219854['dialCongestionMaxRetry']){rpcDb[_0xa9c5('0xaa')](_0x2510e4,_0xa9c5('0xd4'));}else{rpcDb['rescheduleContact'](ut[_0xa9c5('0xac')](_0x2510e4,_0xa9c5('0xd0'),_0x219854[_0xa9c5('0xc3')]),_0x2510e4[_0xa9c5('0xc4')],_0x2510e4[_0xa9c5('0xae')]);}}break;case _0xa9c5('0xd6'):_0x219854[_0xa9c5('0x41')]+=0x1;_0x2510e4[_0xa9c5('0xd7')]+=0x1;_0x2510e4[_0xa9c5('0xa2')]=ut[_0xa9c5('0xa7')](_0x2510e4);ut[_0xa9c5('0x8f')](_0x2510e4,0x14,_0xa9c5('0xd8'));ami[_0xa9c5('0x5e')]('custom:agentreject',ut['buildObj'](_0x2510e4,_0xa9c5('0xd9')));rpcDb[_0xa9c5('0x94')](_0x2510e4,'[syncHangupRequest][logAgentReject]');if(ut[_0xa9c5('0xa7')](_0x2510e4)>=_0x219854[_0xa9c5('0xa8')]){_0x4f8d9e=ut[_0xa9c5('0xc8')](_0x2510e4,0x14,_0xa9c5('0xd8'));rpcDb['createCustomerFinal'](_0x4f8d9e,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x2510e4[_0xa9c5('0xd7')]>=_0x219854[_0xa9c5('0xda')]){rpcDb[_0xa9c5('0xaa')](_0x2510e4,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xa9c5('0xcd')](ut[_0xa9c5('0xac')](_0x2510e4,_0xa9c5('0xd7'),_0x219854['dialAgentRejectRetryFrequency']),_0x2510e4[_0xa9c5('0xc4')],_0x2510e4[_0xa9c5('0xae')]);}}break;case _0xa9c5('0xdb'):_0x219854[_0xa9c5('0xdc')]+=0x1;_0x2510e4[_0xa9c5('0xdd')]+=0x1;_0x2510e4[_0xa9c5('0xa2')]=ut[_0xa9c5('0xa7')](_0x2510e4);ut[_0xa9c5('0x8f')](_0x2510e4,0xb,_0xa9c5('0xde'));rpcDb[_0xa9c5('0x94')](_0x2510e4,_0xa9c5('0xdf'));if(ut[_0xa9c5('0xa7')](_0x2510e4)>=_0x219854[_0xa9c5('0xa8')]){_0x4f8d9e=ut[_0xa9c5('0xc8')](_0x2510e4,0xf,_0xa9c5('0xa9'));rpcDb['createCustomerFinal'](_0x4f8d9e,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x2510e4['countabandonedetry']>=_0x219854[_0xa9c5('0xe0')]){rpcDb[_0xa9c5('0xaa')](_0x2510e4,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xa9c5('0xcd')](ut[_0xa9c5('0xac')](_0x2510e4,'countabandonedretry',_0x219854[_0xa9c5('0xe1')]),_0x2510e4[_0xa9c5('0xc4')],_0x2510e4[_0xa9c5('0xae')]);}}break;case'18':_0x219854[_0xa9c5('0x42')]+=0x1;_0x2510e4[_0xa9c5('0xe2')]+=0x1;_0x2510e4['countglobal']=ut[_0xa9c5('0xa7')](_0x2510e4);ut[_0xa9c5('0x8f')](_0x2510e4,0x12,_0x5b7c33[_0xa9c5('0xe3')]||_0x5b7c33[_0xa9c5('0xe4')]);ami[_0xa9c5('0x5e')](_0xa9c5('0xe5'),ut[_0xa9c5('0xa4')](_0x2510e4,_0xa9c5('0xe6')));rpcDb[_0xa9c5('0x94')](_0x2510e4,_0xa9c5('0xe7'));if(ut[_0xa9c5('0xa7')](_0x2510e4)>=_0x219854[_0xa9c5('0xa8')]){_0x4f8d9e=ut[_0xa9c5('0xc8')](_0x2510e4,0xf,'Global');rpcDb['createCustomerFinal'](_0x4f8d9e,_0xa9c5('0xe7'));}else{rpcDb[_0xa9c5('0xaa')](_0x2510e4,_0xa9c5('0xe7'));}delete this[_0xa9c5('0x15')][_0x5b7c33['linkedid']];break;case'19':_0x219854[_0xa9c5('0x42')]+=0x1;_0x2510e4['countglobal']=ut['totalGlobal'](_0x2510e4);ut['logCustomer'](_0x2510e4,0x13,_0x5b7c33[_0xa9c5('0xe3')]||_0x5b7c33[_0xa9c5('0xe4')]);ami['emit'](_0xa9c5('0xe5'),ut[_0xa9c5('0xa4')](_0x2510e4,_0xa9c5('0xe6')));rpcDb[_0xa9c5('0x94')](_0x2510e4,_0xa9c5('0xe8'));if(ut[_0xa9c5('0xa7')](_0x2510e4)>=_0x219854[_0xa9c5('0xa8')]){_0x4f8d9e=ut['cloneAction'](_0x2510e4,0xf,_0xa9c5('0xa9'));rpcDb['createCustomerFinal'](_0x4f8d9e,_0xa9c5('0xe8'));}else{rpcDb[_0xa9c5('0xaa')](_0x2510e4,_0xa9c5('0xe8'));}delete this[_0xa9c5('0x15')][_0x5b7c33[_0xa9c5('0xaf')]];break;default:if(_0x2510e4[_0xa9c5('0x73')]){ut[_0xa9c5('0x7d')](_0x219854,_0xa9c5('0xe9'));ut['loggerError'](_0xa9c5('0xea')+_0x219854['name'],_0x5b7c33);}_0x219854[_0xa9c5('0x42')]+=0x1;_0x2510e4['countglobal']=ut[_0xa9c5('0xa7')](_0x2510e4);ut[_0xa9c5('0x8f')](_0x2510e4,0xc,_0x5b7c33[_0xa9c5('0xe3')]||_0x5b7c33[_0xa9c5('0xe4')]);rpcDb[_0xa9c5('0x94')](_0x2510e4,_0xa9c5('0xeb'));if(ut[_0xa9c5('0xa7')](_0x2510e4)>=_0x219854[_0xa9c5('0xa8')]){_0x4f8d9e=ut['cloneAction'](_0x2510e4,0xf,'Global');rpcDb[_0xa9c5('0xaa')](_0x4f8d9e,_0xa9c5('0xec'));}else{rpcDb[_0xa9c5('0xaa')](_0x2510e4,_0xa9c5('0xec'));}delete this['actions'][_0x5b7c33['linkedid']];}if(!(_0x2510e4[_0xa9c5('0x73')]&&_0x502a00==='16')){ut[_0xa9c5('0x7b')](_0x219854,_0xa9c5('0xed'));logger[_0xa9c5('0x5a')](_0xa9c5('0xee'),_0x2510e4[_0xa9c5('0xb3')],_0xa9c5('0xb4'),_0x219854[_0xa9c5('0x2a')],_0xa9c5('0x71'),_0x219854['originated']);}if(_0x502a00!==_0xa9c5('0xb0')){delete this[_0xa9c5('0x15')][_0x5b7c33[_0xa9c5('0xaf')]];delete this[_0xa9c5('0x15')][_0x5b7c33[_0xa9c5('0xef')]];}}};Preview[_0xa9c5('0x68')][_0xa9c5('0xf0')]=function(_0x42e803,_0xf77e11,_0x2204b){if(_[_0xa9c5('0xf1')](_0xf77e11)&&_0xa9c5('0xf2')!==typeof _0xf77e11){return;}if(_[_0xa9c5('0xf1')](_0x2204b)&&_0xa9c5('0xf2')!==typeof _0x2204b){return;}switch(_0x2204b[_0xa9c5('0xf3')]){case'0':ut['logAgent'](_0x42e803,0x0,_0xa9c5('0xa3'));rpcDb[_0xa9c5('0xf4')](_0x42e803,_0xa9c5('0xf5'));break;case'3':ut['logAgent'](_0x42e803,0x3,_0xa9c5('0xf6'));rpcDb['createAgentHistory'](_0x42e803,_0xa9c5('0xf7'));break;case'5':ut[_0xa9c5('0xf8')](_0x42e803,0x5,_0xa9c5('0xbe'));rpcDb[_0xa9c5('0xf4')](_0x42e803,_0xa9c5('0xf9'));break;case'8':ut[_0xa9c5('0xf8')](_0x42e803,0x8,_0xa9c5('0xd1'));rpcDb[_0xa9c5('0xf4')](_0x42e803,_0xa9c5('0xfa'));break;case'22':ut['logAgent'](_0x42e803,0x16,_0xa9c5('0xfb'));rpcDb[_0xa9c5('0xf4')](_0x42e803,_0xa9c5('0xfc'));break;default:ut[_0xa9c5('0xf8')](_0x42e803,0xc,_0x2204b[_0xa9c5('0xf3')]);rpcDb['createAgentHistory'](_0x42e803,_0xa9c5('0xfa'));}ut[_0xa9c5('0x7b')](_0xf77e11,_0xa9c5('0xfd'));logger[_0xa9c5('0x5a')](_0xa9c5('0xfe'),_0x42e803['uniqueid'],_0xa9c5('0xb4'),_0xf77e11['name'],_0xa9c5('0x71'),_0xf77e11[_0xa9c5('0x4e')]);delete this[_0xa9c5('0x15')][_0x42e803[_0xa9c5('0xb3')]];};Preview[_0xa9c5('0x68')][_0xa9c5('0xff')]=function(_0xe3b086,_0x35b8c9,_0x1fdc93,_0x1400b2,_0x3e2a1e){var _0x150d58=this;return new BPromise(function(_0x466ce6,_0x1c8efb){if(_[_0xa9c5('0x6d')](_0x35b8c9)||_[_0xa9c5('0x6d')](_0x35b8c9[_0xa9c5('0x100')])||_['isNil'](_0x35b8c9[_0xa9c5('0x100')][_0xa9c5('0x101')])||_[_0xa9c5('0x6d')](_0x35b8c9[_0xa9c5('0x76')])){_0x1c8efb(ut[_0xa9c5('0x4d')](_0xa9c5('0x102'),_0x1400b2,_0x3e2a1e));return;}var _0x18389c=uuid['v4']();var _0xd2bb86=_0x150d58['campaignsPreview'][_0x35b8c9[_0xa9c5('0x6f')][_0xa9c5('0x2a')]];var _0x5018c4=_0x1fdc93?_0x150d58[_0xa9c5('0x16')][_0x1fdc93]['id']:undefined;_0x150d58[_0xa9c5('0x15')][_0x18389c]=new Action(_0x35b8c9,_0xd2bb86,_0x18389c,_0x1fdc93,_0x5018c4);var _0x5545eb=_0x150d58['actions'][_0x18389c];_0x5545eb[_0xa9c5('0xc4')]=_0x1400b2;_0x5545eb[_0xa9c5('0xae')]=_0x3e2a1e;_0x5545eb['lookAgent']=_0x1fdc93;if(_[_0xa9c5('0x103')](_0xe3b086)){_0x150d58[_0xa9c5('0x104')](_0x5545eb,_0xd2bb86,_0x35b8c9,_0x1fdc93)[_0xa9c5('0x84')](function(_0x2d5a24){logger[_0xa9c5('0x5a')](_0xa9c5('0x105'),_0xa9c5('0x106')+_0x5545eb[_0xa9c5('0x70')]+_0xa9c5('0x107')+_0x5545eb['idContact'],JSON[_0xa9c5('0x57')](_0x2d5a24));ami[_0xa9c5('0x5e')](_0xa9c5('0x108'),ut[_0xa9c5('0xa4')](_0x5545eb,'called',_0x150d58['campaignsPreview'][_0x5545eb[_0xa9c5('0x70')]]));_0x466ce6(ut[_0xa9c5('0x4d')](_0xa9c5('0x109')));})[_0xa9c5('0x79')](function(_0x3269ba){ut[_0xa9c5('0x63')]('[Preview][execCall][failure]',_0x3269ba);_0x1c8efb(ut[_0xa9c5('0x4d')](_0xa9c5('0x10a'),_0x1400b2,_0x3e2a1e));});}else{_0xd2bb86[_0xa9c5('0x10b')]+=0x1;ut['logBlacklist'](_0x5545eb);rpcDb[_0xa9c5('0x10c')](_0x5545eb,_0xa9c5('0x10d'));delete _0x150d58['actions'][_0x18389c];_0x1c8efb(ut[_0xa9c5('0x4d')]('Contact\x20in\x20black\x20List',_0x1400b2,_0x3e2a1e));}});};Preview[_0xa9c5('0x68')]['isTrunkReachable']=function(_0x52d348){return!_[_0xa9c5('0x6d')](_0x52d348)&&!_[_0xa9c5('0x6d')](_0x52d348['name'])&&!_['isNil'](_0x52d348[_0xa9c5('0x55')])&&_0x52d348[_0xa9c5('0x55')]&&!_[_0xa9c5('0x6d')](this[_0xa9c5('0x14')][util['format'](_0xa9c5('0x10e'),_0x52d348[_0xa9c5('0x2a')])])&&!_['isNil'](this['trunks'][util[_0xa9c5('0x58')]('SIP/%s',_0x52d348[_0xa9c5('0x2a')])]['status'])&&(this[_0xa9c5('0x14')][util['format'](_0xa9c5('0x10e'),_0x52d348[_0xa9c5('0x2a')])][_0xa9c5('0x10f')]==='reachable'||this[_0xa9c5('0x14')][util[_0xa9c5('0x58')](_0xa9c5('0x10e'),_0x52d348[_0xa9c5('0x2a')])][_0xa9c5('0x10f')]===_0xa9c5('0x110'));};Preview[_0xa9c5('0x68')][_0xa9c5('0x89')]=function(_0x37bdd7,_0x456833){var _0x1cc858=this;return new BPromise(function(_0x345b1d,_0x4681f9){_0x1cc858[_0xa9c5('0x111')](_0x37bdd7,_0x456833)[_0xa9c5('0x84')](function(_0x2f8ccf){_0x345b1d(_[_0xa9c5('0x112')](_0x2f8ccf,[_0xa9c5('0x4d')]));})[_0xa9c5('0x79')](function(_0x1b54dc){if(_0x1b54dc[_0xa9c5('0x113')]){rpcDb[_0xa9c5('0x114')](_0x37bdd7);}if(_0x1b54dc[_0xa9c5('0x55')]){rpcDb[_0xa9c5('0x8c')](_0x37bdd7);}_0x4681f9(_[_0xa9c5('0x112')](_0x1b54dc,['message']));});});};Preview[_0xa9c5('0x68')][_0xa9c5('0x111')]=function(_0x1d0b63,_0xa8905e){var _0x5e9ce9=this;return new BPromise(function(_0x1ff174,_0x4d7916){var _0x21a87e,_0x5b8f70;rpcDb[_0xa9c5('0x115')](_0x1d0b63)['then'](function(_0x22424e){if(!_[_0xa9c5('0x6d')](_0x22424e[0x0])){_0x5b8f70=_0x22424e[0x0][_0xa9c5('0x116')]?![]:!![];_0x21a87e=_0x22424e[0x0][_0xa9c5('0x116')]?!![]:![];_0x21a87e=_0xa8905e?!![]:_0x21a87e;}var _0x4a6123=_0x5e9ce9[_0xa9c5('0x117')](_0x22424e);if(_0x4a6123[_0xa9c5('0x118')]){rpcDb[_0xa9c5('0x119')](_[_0xa9c5('0x112')](_0x22424e[0x0],[_0xa9c5('0x76'),'Contact.phone']))[_0xa9c5('0x84')](function(_0x272db4){_0x5e9ce9[_0xa9c5('0xff')](_0x272db4,_0x22424e[0x0],_0xa8905e,_0x5b8f70,_0x21a87e)['then'](function(_0x18a668){_0x1ff174(_0x18a668);})[_0xa9c5('0x79')](function(_0x8cccd1){_0x4d7916(_0x8cccd1);});})[_0xa9c5('0x79')](function(_0x4c4b56){ut['logger']('[Preview][checkIsBlackList]',_0x4c4b56);_0x4d7916(ut[_0xa9c5('0x4d')](_0xa9c5('0x11a'),_0x5b8f70,_0x21a87e));});}else{_0x4d7916(ut['message'](_0x4a6123[_0xa9c5('0x4d')],_0x5b8f70,_0x21a87e));}})['catch'](function(_0x592b18){ut['logger'](_0xa9c5('0x11b'),_0x592b18);_0x4d7916(ut[_0xa9c5('0x4d')](_0xa9c5('0x11a'),![],!![]));});});};Preview[_0xa9c5('0x68')][_0xa9c5('0x117')]=function(_0xd06ffc){if(_[_0xa9c5('0x6d')](_0xd06ffc)||_[_0xa9c5('0x103')](_0xd06ffc)||!_[_0xa9c5('0x6d')](_0xd06ffc[0x0][_0xa9c5('0x88')])&&_[_0xa9c5('0x6d')](_0xd06ffc[0x0]['Agent'][_0xa9c5('0x2a')])){ut[_0xa9c5('0x63')](_0xa9c5('0x11c'),_0xd06ffc);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x24b12d=this[_0xa9c5('0x12')][_0xd06ffc[0x0][_0xa9c5('0x6f')]['name']];_0x24b12d[_0xa9c5('0x4d')]=_0xa9c5('0xa0');if(_['isNil'](_0x24b12d)){ut[_0xa9c5('0x63')](_0xa9c5('0x11d'),_0x24b12d);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xa9c5('0x9e')](_0x24b12d[_0xa9c5('0x54')])){ut[_0xa9c5('0x63')](_0xa9c5('0x11e'),'campaign\x20Name:\x20'+_0x24b12d[_0xa9c5('0x2a')]+_0xa9c5('0x11f'));if(!this[_0xa9c5('0x9e')](_0x24b12d[_0xa9c5('0x120')])){ut['logger'](_0xa9c5('0x11e'),_0x24b12d[_0xa9c5('0x2a')]+_0xa9c5('0x121'));return{'isValid':![],'message':_0xa9c5('0x122')};}}if(!ut['isActive'](_0x24b12d['dialActive'])){ut[_0xa9c5('0x63')]('[Preview][validateContact][Campaign\x20Active]',_0x24b12d[_0xa9c5('0x2a')]+_0xa9c5('0x123'));return{'isValid':![],'message':_0xa9c5('0x124')+_0x24b12d['name']+_0xa9c5('0x123')};}return{'isValid':!![],'message':_0xa9c5('0x125')};};Preview[_0xa9c5('0x68')][_0xa9c5('0x104')]=function(_0x2c2671,_0x1c8e59,_0x26c209,_0x417181){var _0x58dd4c=this;return new BPromise(function(_0x4382cf,_0xdeb6e5){var _0x11621e=_0x2c2671[_0xa9c5('0xb3')];var _0x54ffc4=_0x58dd4c[_0xa9c5('0x9e')](_0x1c8e59[_0xa9c5('0x54')])?util[_0xa9c5('0x58')]('SIP/%s/%s%s',_0x1c8e59['Trunk'][_0xa9c5('0x2a')],_[_0xa9c5('0x6d')](_0x1c8e59[_0xa9c5('0x126')])?'':_0x1c8e59['dialPrefix']['trim']()||'',_0x1c8e59[_0xa9c5('0x127')]>0x0?_0x26c209[_0xa9c5('0x100')]['phone'][_0xa9c5('0x128')](_0x1c8e59['dialCutDigit']):_0x26c209[_0xa9c5('0x100')][_0xa9c5('0x101')]):util[_0xa9c5('0x58')](_0xa9c5('0x129'),_[_0xa9c5('0x6d')](_0x1c8e59[_0xa9c5('0x120')])?_0x1c8e59[_0xa9c5('0x54')][_0xa9c5('0x2a')]:_0x1c8e59[_0xa9c5('0x120')][_0xa9c5('0x2a')],_[_0xa9c5('0x6d')](_0x1c8e59['dialPrefix'])?'':_0x1c8e59[_0xa9c5('0x126')][_0xa9c5('0x12a')]()||'',_0x1c8e59[_0xa9c5('0x127')]>0x0?_0x26c209[_0xa9c5('0x100')][_0xa9c5('0x101')][_0xa9c5('0x128')](_0x1c8e59[_0xa9c5('0x127')]):_0x26c209['Contact'][_0xa9c5('0x101')]);var _0x3a25fd=_0x58dd4c[_0xa9c5('0x9e')](_0x1c8e59['Trunk'])?ut['getCallerId'](_0x1c8e59[_0xa9c5('0x54')][_0xa9c5('0x12b')],_0x1c8e59['dialOriginateCallerIdName'],_0x1c8e59[_0xa9c5('0x12c')]>0x0?ut[_0xa9c5('0x12d')](_0x1c8e59['dialOriginateCallerIdNumber'],_0x1c8e59[_0xa9c5('0x12c')]):_0x1c8e59[_0xa9c5('0x36')]):ut[_0xa9c5('0x12e')](_[_0xa9c5('0x6d')](_0x1c8e59[_0xa9c5('0x120')])?_0x1c8e59[_0xa9c5('0x54')][_0xa9c5('0x12b')]:_0x1c8e59[_0xa9c5('0x120')][_0xa9c5('0x12b')],_0x1c8e59[_0xa9c5('0x12f')],_0x1c8e59[_0xa9c5('0x12c')]>0x0?ut['getCallerIdRandom'](_0x1c8e59[_0xa9c5('0x36')],_0x1c8e59['dialRandomLastDigitCallerIdNumber']):_0x1c8e59[_0xa9c5('0x36')]);if(_0x3a25fd){_0x2c2671[_0xa9c5('0x130')]=ut[_0xa9c5('0x131')](_0x3a25fd);_0x2c2671[_0xa9c5('0x132')]=ut['extractCalleridNumber'](_0x3a25fd);}var _0x3058a6=ut[_0xa9c5('0x133')](_0x1c8e59,_0x26c209,_0x54ffc4,_0x3a25fd,_0x11621e,_0x2c2671);_[_0xa9c5('0x134')](_0x2c2671,ut[_0xa9c5('0x135')](_0x3058a6));_0x2c2671['starttime']=moment()[_0xa9c5('0x58')](_0xa9c5('0x8e'));ami[_0xa9c5('0x78')](ut[_0xa9c5('0x136')](_0x2c2671,_0x1c8e59,_0x3058a6,_0x2c2671['activeContact'],_0x417181))[_0xa9c5('0x84')](function(_0x42dbd7){_0x1c8e59[_0xa9c5('0x4e')]+=0x1;logger[_0xa9c5('0x5a')](_0xa9c5('0x137'),_0x11621e,_0xa9c5('0xb4'),_0x1c8e59[_0xa9c5('0x2a')],_0xa9c5('0x71'),_0x1c8e59[_0xa9c5('0x4e')]);_0x4382cf(_0x42dbd7);})[_0xa9c5('0x79')](function(_0x411ee7){ut[_0xa9c5('0xf8')](_0x2c2671,0xe,_0xa9c5('0x138'));rpcDb[_0xa9c5('0xf4')](_0x2c2671,_0xa9c5('0x139'));_0xdeb6e5(_0x411ee7);});});};Preview['prototype'][_0xa9c5('0x13a')]=function(_0x543b32){if(this['actions'][_0x543b32[_0xa9c5('0xaf')]]){this[_0xa9c5('0x15')][_0x543b32[_0xa9c5('0xaf')]][_0xa9c5('0x13b')]=_0x543b32[_0xa9c5('0x13b')];}};Preview['prototype'][_0xa9c5('0x19')]=function(_0x53b2f1){var _0x4dde67=this;var _0x130c9a=this[_0xa9c5('0x15')][_0x53b2f1[_0xa9c5('0x13c')]];if(_0x130c9a){if(_0x130c9a[_0xa9c5('0x13d')]&&this[_0xa9c5('0x16')][_0x130c9a[_0xa9c5('0x13d')]]){ut[_0xa9c5('0x13e')](_0x130c9a,this[_0xa9c5('0x16')][_0x130c9a[_0xa9c5('0x13d')]][_0xa9c5('0x2a')],this[_0xa9c5('0x16')][_0x130c9a[_0xa9c5('0x13d')]]['id']);}var _0x5d93d2=_[_0xa9c5('0x13f')](_0x130c9a);_0x5d93d2[_0xa9c5('0x140')]=moment()[_0xa9c5('0x58')](_0xa9c5('0x8e'));var _0x20454c=_0x4dde67[_0xa9c5('0x12')][_0x130c9a[_0xa9c5('0x70')]];if(ut[_0xa9c5('0x141')](_0x53b2f1[_0xa9c5('0x142')])){if(_0x130c9a[_0xa9c5('0xc4')]){rpcDb['unlockContact'](_0x130c9a[_0xa9c5('0x143')]);}if(_0x130c9a['activeContact']){rpcDb[_0xa9c5('0x8c')](_0x130c9a[_0xa9c5('0x143')]);}ami[_0xa9c5('0x5e')](_0xa9c5('0x144'),ut[_0xa9c5('0xa4')](_0x130c9a,_0xa9c5('0x145'),this['campaignsPreview'][_0x130c9a[_0xa9c5('0x70')]]));this['callProgressDetectingAgent'](_0x5d93d2,_0x20454c,_0x53b2f1);}else{_0x130c9a[_0xa9c5('0x8d')]=moment()['format'](_0xa9c5('0x8e'));ut[_0xa9c5('0xf8')](_0x5d93d2,0x4,_0xa9c5('0xb9'));rpcDb[_0xa9c5('0xf4')](_0x5d93d2,'[callProgressDetectingAgent][logAnswer]');}}};Preview['prototype']['syncHangup']=function(_0x21fa3e){var _0x4d19fe=this;var _0x45fa29=this[_0xa9c5('0x15')][_0x21fa3e[_0xa9c5('0xaf')]];var _0x40ddd5;if(_0x45fa29){_0x40ddd5=this['campaignsPreview'][_0x45fa29['queue']];logger['info'](_0xa9c5('0x146'),_0x21fa3e['linkedid'],_0xa9c5('0xb4'),_0x40ddd5[_0xa9c5('0x2a')],_0xa9c5('0x72'),_0x40ddd5[_0xa9c5('0x2d')]);}if(this[_0xa9c5('0x15')][_0x21fa3e[_0xa9c5('0xaf')]]&&_0x21fa3e['linkedid']!==_0x21fa3e[_0xa9c5('0xb3')]){if(_0x21fa3e[_0xa9c5('0x147')]==='16'&&this[_0xa9c5('0x15')][_0x21fa3e[_0xa9c5('0xaf')]]['dialAnswer']){this[_0xa9c5('0x148')](_0x21fa3e,_0x21fa3e['linkedid'],_0x21fa3e['cause']);}else if(this[_0xa9c5('0x15')][_0x21fa3e[_0xa9c5('0xaf')]]['dialAnswer']){logger[_0xa9c5('0x5a')](_0xa9c5('0x149'),_0x21fa3e['linkedid'],_0x21fa3e[_0xa9c5('0x147')],_0xa9c5('0xb4'),_0x40ddd5[_0xa9c5('0x2a')],'pTalking:\x20',_0x40ddd5[_0xa9c5('0x2d')]);this[_0xa9c5('0x148')](_0x21fa3e,_0x21fa3e['linkedid'],_0x21fa3e[_0xa9c5('0x147')]);}}else if(_0x45fa29&&_[_0xa9c5('0x6d')](_0x45fa29[_0xa9c5('0x14a')])&&_0x40ddd5[_0xa9c5('0x14b')]&&_0x21fa3e[_0xa9c5('0xaf')]===_0x21fa3e[_0xa9c5('0xb3')]&&_[_0xa9c5('0x6d')](_0x21fa3e[_0xa9c5('0xf3')])&&_0x21fa3e['cause']==='16'&&_0x21fa3e['channelstate']==='6'&&_['isUndefined'](_0x45fa29[_0xa9c5('0x14c')])){if(_0x45fa29['unlockAgent']){rpcDb[_0xa9c5('0x114')](_0x45fa29['idContact']);}if(_0x45fa29[_0xa9c5('0xae')]){rpcDb[_0xa9c5('0x8c')](_0x45fa29[_0xa9c5('0x143')]);}_0x21fa3e['reason']='22';this['callProgressDetectingAgent'](_0x45fa29,_0x40ddd5,_0x21fa3e);}else if(_0x45fa29&&_0x45fa29[_0xa9c5('0x14c')]){if(_0x21fa3e[_0xa9c5('0x147')]==='16'&&this[_0xa9c5('0x15')][_0x21fa3e[_0xa9c5('0xaf')]][_0xa9c5('0x73')]){logger['info'](_0xa9c5('0x14d'),_0x21fa3e['linkedid'],_0x21fa3e[_0xa9c5('0x147')],_0xa9c5('0xb4'),_0x40ddd5['name'],'pTalking:\x20',_0x40ddd5[_0xa9c5('0x2d')]);this[_0xa9c5('0x148')](_0x21fa3e,_0x21fa3e['linkedid'],_0x21fa3e[_0xa9c5('0x147')]);}else if(this[_0xa9c5('0x15')][_0x21fa3e[_0xa9c5('0xaf')]][_0xa9c5('0x73')]){logger[_0xa9c5('0x5a')](_0xa9c5('0x149'),_0x21fa3e[_0xa9c5('0xaf')],_0x21fa3e[_0xa9c5('0x147')],'\x20Queue',_0x40ddd5[_0xa9c5('0x2a')],_0xa9c5('0x72'),_0x40ddd5[_0xa9c5('0x2d')]);this[_0xa9c5('0x148')](_0x21fa3e,_0x21fa3e[_0xa9c5('0xaf')],_0x21fa3e['cause']);}}};Preview[_0xa9c5('0x68')][_0xa9c5('0x1f')]=function(_0x4db22d){if(this[_0xa9c5('0x15')][_0x4db22d[_0xa9c5('0xef')]]&&_0x4db22d[_0xa9c5('0xef')]!==_0x4db22d['destuniqueid']){this[_0xa9c5('0x148')](_0x4db22d,_0x4db22d['destlinkedid'],_0x4db22d[_0xa9c5('0xe4')]);}};Preview[_0xa9c5('0x68')][_0xa9c5('0x1e')]=function(_0x1def15){if(this[_0xa9c5('0x15')][_0x1def15[_0xa9c5('0xaf')]]&&_0x1def15[_0xa9c5('0xaf')]!==_0x1def15['uniqueid']&&!this['actions'][_0x1def15[_0xa9c5('0xaf')]][_0xa9c5('0x73')]){if(_0x1def15[_0xa9c5('0x147')]==='1'){this[_0xa9c5('0x148')](_0x1def15,_0x1def15['linkedid'],_0x1def15[_0xa9c5('0x147')]);}}};Preview[_0xa9c5('0x68')][_0xa9c5('0x14e')]=function(_0x90b498,_0x314f21,_0x4e1931){if(this[_0xa9c5('0x15')][_0x90b498]){if(_[_0xa9c5('0x6d')](this[_0xa9c5('0x15')][_0x90b498][_0xa9c5('0x14f')])){this[_0xa9c5('0x15')][_0x90b498][_0xa9c5('0x14f')]={};}this['actions'][_0x90b498]['variables'][_0x314f21]=_0x4e1931;}};Preview[_0xa9c5('0x68')][_0xa9c5('0x22')]=function(_0x7698d5){try{if(!_['isNil'](_0x7698d5)){if(ut['filterKey'](_[_0xa9c5('0x150')](_0x7698d5[_0xa9c5('0x151')])[0x0])){this[_0xa9c5('0x14e')](_0x7698d5[_0xa9c5('0xb3')],_['keys'](_0x7698d5[_0xa9c5('0x151')])[0x0],_0x7698d5['value']);}}}catch(_0xc1126c){logger[_0xa9c5('0x152')]('[syncVarSet][Preview]',util[_0xa9c5('0x153')](_0xc1126c,{'showHidden':![],'depth':null}));}};Preview[_0xa9c5('0x68')][_0xa9c5('0x24')]=function(_0x440f3d){if(_0x440f3d){if(this[_0xa9c5('0x15')][_0x440f3d['transfertargetlinkedid']]){this[_0xa9c5('0x15')][_0x440f3d['transfertargetlinkedid']]['transfer']=!![];}}};Preview['prototype'][_0xa9c5('0x26')]=function(_0x4be8cd){if(_0x4be8cd){if(this[_0xa9c5('0x15')][_0x4be8cd[_0xa9c5('0x154')]]){this[_0xa9c5('0x15')][_0x4be8cd[_0xa9c5('0x154')]][_0xa9c5('0x14c')]=!![];}}};module[_0xa9c5('0x155')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 1849c7a..27cca92 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 _0x752b=['uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','preview','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type'];(function(_0x50edb7,_0x44caf8){var _0x15548a=function(_0xa87065){while(--_0xa87065){_0x50edb7['push'](_0x50edb7['shift']());}};_0x15548a(++_0x44caf8);}(_0x752b,0xce));var _0xb752=function(_0x35911f,_0x1d7ece){_0x35911f=_0x35911f-0x0;var _0x51e9d3=_0x752b[_0x35911f];return _0x51e9d3;};'use strict';var util=require('util');var BPromise=require(_0xb752('0x0'));var logger=require('../../../config/logger')(_0xb752('0x1'));var _=require(_0xb752('0x2'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0xb752('0x3'));var cmHopperHistory=require(_0xb752('0x4'));var cmHopperBlack=require(_0xb752('0x5'));var voiceQueueRt=require(_0xb752('0x6'));var agentReportPreview=require(_0xb752('0x7'));var voiceQueueReport=require(_0xb752('0x8'));function loggerCatch(_0x149279){return function(_0x433e49){logger[_0xb752('0x9')](_0x149279,util[_0xb752('0xa')](_0x433e49,{'showHidden':![],'depth':null}));};}function create(_0x425ada){return BPromise[_0xb752('0xb')]()[_0xb752('0xc')](cmHopperHistory[_0xb752('0xd')](_0x425ada))[_0xb752('0xe')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x112547){return BPromise['resolve']()[_0xb752('0xc')](agentReportPreview['createHistory'](_0x112547))[_0xb752('0xe')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x5c115e){return BPromise[_0xb752('0xb')]()['then'](cmHopper[_0xb752('0xf')](_0x5c115e,!![]))[_0xb752('0xe')](loggerCatch(_0xb752('0x10')));}exports[_0xb752('0x11')]=function(_0x1ad4c0){return BPromise['resolve']()['then'](cmHopperBlack[_0xb752('0x11')](_0x1ad4c0))[_0xb752('0xe')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0xb752('0x12')]=function(_0x468fde){return BPromise['resolve']()[_0xb752('0xc')](cmHopper[_0xb752('0x12')](_0x468fde))[_0xb752('0xe')](loggerCatch(_0xb752('0x13')));};exports['createHistory']=function(_0x5e89f3,_0x3eb5e5){create(_0x5e89f3)[_0xb752('0xe')](loggerCatch(_0x3eb5e5));moveContact(_0x5e89f3)[_0xb752('0xe')](loggerCatch(_0x3eb5e5));};exports[_0xb752('0x14')]=function(_0x52199a,_0x5eea42){createAgent(_0x52199a)[_0xb752('0xe')](loggerCatch(_0x5eea42));};exports[_0xb752('0x15')]=function(_0x1128c0,_0x57e1c3){create(_0x1128c0)[_0xb752('0xe')](loggerCatch(_0x57e1c3));};exports[_0xb752('0x16')]=function(_0x53cefe,_0x5a43c8){moveContact(_0x53cefe)[_0xb752('0xe')](loggerCatch(_0x5a43c8));};exports[_0xb752('0x17')]=function(_0xec45c0,_0x2a9e6c,_0xac70ed){if(_0x2a9e6c){_0xec45c0[_0xb752('0x18')]=null;}if(_0xac70ed){_0xec45c0[_0xb752('0x19')]=![];}return BPromise[_0xb752('0xb')]()[_0xb752('0xc')](cmHopper[_0xb752('0x17')](_0xec45c0))['catch'](loggerCatch(_0xb752('0x1a')));};exports[_0xb752('0x1b')]=function(_0x2c1c6b){return BPromise[_0xb752('0xb')]()[_0xb752('0xc')](cmHopper['countReScheduled'](_0x2c1c6b))[_0xb752('0xe')](loggerCatch(_0xb752('0x1c')));};exports[_0xb752('0x1d')]=function(_0x2310ea){return BPromise[_0xb752('0xb')]()['then'](cmHopper['unlockContact']({'UserId':null},_0x2310ea,0x1))[_0xb752('0xe')](loggerCatch(_0xb752('0x1e')));};exports['disableContact']=function(_0x597988){return BPromise['resolve']()['then'](cmHopper[_0xb752('0x1d')]({'active':![]},_0x597988,0x1))[_0xb752('0xe')](loggerCatch(_0xb752('0x1f')));};exports[_0xb752('0x20')]=function(_0x22cffa){var _0x2857ad={};_0x2857ad[_0xb752('0x21')]=_0x22cffa[_0xb752('0x21')];_0x2857ad[_0xb752('0x22')]=_0x22cffa['uniqueid'];_0x2857ad['calleridnum']=_0x22cffa[_0xb752('0x23')];_0x2857ad[_0xb752('0x24')]=_0x22cffa['calleridname'];_0x2857ad['queue']=_0x22cffa[_0xb752('0x25')];_0x2857ad[_0xb752('0x26')]=_0x22cffa[_0xb752('0x27')];_0x2857ad[_0xb752('0x28')]=_0x22cffa[_0xb752('0x27')];_0x2857ad[_0xb752('0x29')]=0x1;_0x2857ad[_0xb752('0x2a')]=_0x22cffa[_0xb752('0x2b')];_0x2857ad[_0xb752('0x2c')]=_0x22cffa[_0xb752('0x2d')];_0x2857ad[_0xb752('0x2e')]=_0xb752('0x2f');_0x2857ad[_0xb752('0x30')]=_0xb752('0x31');_0x2857ad[_0xb752('0x32')]=0x0;_0x2857ad[_0xb752('0x33')]=0x1;_0x2857ad[_0xb752('0x34')]=_0x22cffa[_0xb752('0x2d')];_0x2857ad[_0xb752('0x35')]='COMPLETED';return BPromise[_0xb752('0xb')]()[_0xb752('0xc')](voiceQueueReport[_0xb752('0x36')](_0x2857ad))[_0xb752('0xe')](loggerCatch(_0xb752('0x37')));};exports[_0xb752('0x38')]=function(_0xec1a3f,_0x4e6534){return BPromise[_0xb752('0xb')]()[_0xb752('0xc')](cmHopper[_0xb752('0x38')](_0xec1a3f,_0x4e6534))[_0xb752('0xe')](loggerCatch(_0xb752('0x39')));};exports[_0xb752('0x3a')]=function(_0x361a46){return BPromise[_0xb752('0xb')]()['then'](cmHopper[_0xb752('0x17')](_0x361a46,!![],!![]))[_0xb752('0xe')](loggerCatch(_0xb752('0x3b')));}; \ No newline at end of file +var _0x61df=['resolve','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','from-sip','exten','xcally-motion-preview','holdtime','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','then','[moveContactManagedDialer]\x20','checkIsBlackList'];(function(_0x489c95,_0x53159c){var _0x10e7a7=function(_0xcb4342){while(--_0xcb4342){_0x489c95['push'](_0x489c95['shift']());}};_0x10e7a7(++_0x53159c);}(_0x61df,0x19e));var _0xf61d=function(_0x4133a7,_0x389139){_0x4133a7=_0x4133a7-0x0;var _0x161c4e=_0x61df[_0x4133a7];return _0x161c4e;};'use strict';var util=require(_0xf61d('0x0'));var BPromise=require('bluebird');var logger=require(_0xf61d('0x1'))(_0xf61d('0x2'));var _=require(_0xf61d('0x3'));var cmHopper=require(_0xf61d('0x4'));var cmHopperFinal=require(_0xf61d('0x5'));var cmHopperHistory=require(_0xf61d('0x6'));var cmHopperBlack=require(_0xf61d('0x7'));var voiceQueueRt=require(_0xf61d('0x8'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xf61d('0x9'));function loggerCatch(_0x3d1472){return function(_0x299383){logger[_0xf61d('0xa')](_0x3d1472,util[_0xf61d('0xb')](_0x299383,{'showHidden':![],'depth':null}));};}function create(_0x5dc4ef){return BPromise['resolve']()['then'](cmHopperHistory[_0xf61d('0xc')](_0x5dc4ef))[_0xf61d('0xd')](loggerCatch(_0xf61d('0xe')));}function createAgent(_0x346f3d){return BPromise['resolve']()[_0xf61d('0xf')](agentReportPreview[_0xf61d('0xc')](_0x346f3d))['catch'](loggerCatch(_0xf61d('0xe')));}function moveContact(_0x15ad35){return BPromise['resolve']()['then'](cmHopper['moveContactManagedDialer'](_0x15ad35,!![]))[_0xf61d('0xd')](loggerCatch(_0xf61d('0x10')));}exports[_0xf61d('0x11')]=function(_0x54b2b3){return BPromise[_0xf61d('0x12')]()[_0xf61d('0xf')](cmHopperBlack[_0xf61d('0x11')](_0x54b2b3))[_0xf61d('0xd')](loggerCatch(_0xf61d('0x13')));};exports['getContactPreview']=function(_0x387f9e){return BPromise[_0xf61d('0x12')]()[_0xf61d('0xf')](cmHopper[_0xf61d('0x14')](_0x387f9e))[_0xf61d('0xd')](loggerCatch(_0xf61d('0x15')));};exports['createHistory']=function(_0x178fc9,_0xfcfb1d){create(_0x178fc9)[_0xf61d('0xd')](loggerCatch(_0xfcfb1d));moveContact(_0x178fc9)['catch'](loggerCatch(_0xfcfb1d));};exports[_0xf61d('0x16')]=function(_0xeb9dca,_0x11c0c8){createAgent(_0xeb9dca)[_0xf61d('0xd')](loggerCatch(_0x11c0c8));};exports['createCustomerHistory']=function(_0x3c5246,_0x13c700){create(_0x3c5246)['catch'](loggerCatch(_0x13c700));};exports[_0xf61d('0x17')]=function(_0x93a75a,_0x485caf){moveContact(_0x93a75a)[_0xf61d('0xd')](loggerCatch(_0x485caf));};exports[_0xf61d('0x18')]=function(_0x5b1884,_0x26e86f,_0x5e2cb0){if(_0x26e86f){_0x5b1884[_0xf61d('0x19')]=null;}if(_0x5e2cb0){_0x5b1884[_0xf61d('0x1a')]=![];}return BPromise[_0xf61d('0x12')]()['then'](cmHopper[_0xf61d('0x18')](_0x5b1884))['catch'](loggerCatch(_0xf61d('0x1b')));};exports[_0xf61d('0x1c')]=function(_0x223be8){return BPromise[_0xf61d('0x12')]()['then'](cmHopper[_0xf61d('0x1c')](_0x223be8))['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0xf61d('0x1d')]=function(_0xb61e1c){return BPromise['resolve']()[_0xf61d('0xf')](cmHopper['unlockContact']({'UserId':null},_0xb61e1c,0x1))[_0xf61d('0xd')](loggerCatch('[unlockContact]\x20'));};exports[_0xf61d('0x1e')]=function(_0x5a5b7c){return BPromise['resolve']()['then'](cmHopper[_0xf61d('0x1d')]({'active':![]},_0x5a5b7c,0x1))[_0xf61d('0xd')](loggerCatch(_0xf61d('0x1f')));};exports[_0xf61d('0x20')]=function(_0x45d1f6){var _0x483b47={};_0x483b47[_0xf61d('0x21')]=_0x45d1f6['type'];_0x483b47[_0xf61d('0x22')]=_0x45d1f6['uniqueid'];_0x483b47[_0xf61d('0x23')]=_0x45d1f6[_0xf61d('0x23')];_0x483b47[_0xf61d('0x24')]=_0x45d1f6[_0xf61d('0x24')];_0x483b47['queue']=_0x45d1f6['queue'];_0x483b47[_0xf61d('0x25')]=_0x45d1f6[_0xf61d('0x26')];_0x483b47['queuecallerleaveAt']=_0x45d1f6['answertime'];_0x483b47[_0xf61d('0x27')]=0x1;_0x483b47[_0xf61d('0x28')]=_0x45d1f6[_0xf61d('0x29')];_0x483b47[_0xf61d('0x2a')]=_0x45d1f6[_0xf61d('0x2b')];_0x483b47['context']=_0xf61d('0x2c');_0x483b47[_0xf61d('0x2d')]=_0xf61d('0x2e');_0x483b47[_0xf61d('0x2f')]=0x0;_0x483b47['assigned']=0x1;_0x483b47['lastAssignedTo']=_0x45d1f6[_0xf61d('0x2b')];_0x483b47[_0xf61d('0x30')]=_0xf61d('0x31');return BPromise['resolve']()['then'](voiceQueueReport[_0xf61d('0x32')](_0x483b47))[_0xf61d('0xd')](loggerCatch(_0xf61d('0x33')));};exports[_0xf61d('0x34')]=function(_0x5569e8,_0x565cd4){return BPromise['resolve']()['then'](cmHopper[_0xf61d('0x34')](_0x5569e8,_0x565cd4))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x2b827d){return BPromise['resolve']()[_0xf61d('0xf')](cmHopper[_0xf61d('0x18')](_0x2b827d,!![],!![]))['catch'](loggerCatch(_0xf61d('0x35')));}; \ 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 3dc8749..5cc026d 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 _0xa315=['originatecalleridnum','originatecalleridname','xcally-motion-preview','monitor_format','Contact','tags','createdAt','updatedAt','%s%s','toUpper','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','starttime','responsetime','endtime','logAgent','ringtime','UserId','logCustomer','statedesc','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','from-sip','timeout','totalGlobal','countcongestionretry','countnoanswerretry','cloneAction','clone','Global','active','scheduledat','add','minutes','ContactId','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','channelAgent','motionChannel','voice','mandatoryDisposition','interface','agentReadyId','not_inuse','status','reachable','push','getDiff','createBody','CampaignId','idContact','campaigntype','dialAnswer','membername','countbusyretry','callback','callbackat','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview','env','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','string','isUndefined','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','addVariables','Queue','name','calleridname','calleridnum','dialer','VoiceQueueId','dialOriginateTimeout','format','\x22rtTxX%s%s\x22','dialQueueProject2','isEmpty','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE'];(function(_0x55e2ab,_0x2b0d23){var _0x76a2b4=function(_0x26ec5c){while(--_0x26ec5c){_0x55e2ab['push'](_0x55e2ab['shift']());}};_0x76a2b4(++_0x2b0d23);}(_0xa315,0x17a));var _0x5a31=function(_0x5ba74f,_0x200bf4){_0x5ba74f=_0x5ba74f-0x0;var _0x534d79=_0xa315[_0x5ba74f];return _0x534d79;};'use strict';var util=require(_0x5a31('0x0'));var _=require(_0x5a31('0x1'));var moment=require(_0x5a31('0x2'));var logger=require(_0x5a31('0x3'))(_0x5a31('0x4'));var ipAgi=process[_0x5a31('0x5')]['XCALLY_IP_AGI']||_0x5a31('0x6');function getSeconds(_0x3c4874,_0x204c55){var _0x42f97f=moment(_0x3c4874)['milliseconds'](0x0);var _0x30227e=moment(_0x204c55)[_0x5a31('0x7')](0x0);return _0x42f97f[_0x5a31('0x8')](_0x30227e,_0x5a31('0x9'));}exports[_0x5a31('0xa')]=function(_0x32dc18){return function(_0x67c535){logger[_0x5a31('0xb')](_0x32dc18,util[_0x5a31('0xc')](_0x67c535,{'showHidden':![],'depth':null}));};};exports[_0x5a31('0xd')]=function(_0x1a83f2,_0x1f4f23){logger[_0x5a31('0xe')](_0x1a83f2,util[_0x5a31('0xc')](_0x1f4f23,{'showHidden':![],'depth':null}));};exports[_0x5a31('0xf')]=function(_0xecb728,_0x39330a){logger[_0x5a31('0xb')](_0xecb728,util[_0x5a31('0xc')](_0x39330a,{'showHidden':![],'depth':null}));};exports[_0x5a31('0x10')]=function(_0x51e94e){return function(_0x48900c){logger[_0x5a31('0xe')](_0x51e94e,util[_0x5a31('0xc')](_0x48900c,{'showHidden':![],'depth':null}));};};exports[_0x5a31('0x11')]=function(_0x421992,_0x4a4dfd,_0x575d98){return{'message':_0x421992,'unlock':_0x4a4dfd,'active':_0x575d98};};exports['getCallerId']=function(_0x26fdac,_0x472eb6,_0x57c05f){if(!_['isUndefined'](_0x57c05f)&&_0x5a31('0x12')===typeof _0x57c05f&&!_['isEmpty'](_0x57c05f)){if(!_[_0x5a31('0x13')](_0x472eb6)&&_0x5a31('0x12')===typeof _0x472eb6&&!_['isEmpty'](_0x472eb6)){return util['format'](_0x5a31('0x14'),_0x472eb6,_0x57c05f);}return util['format'](_0x5a31('0x14'),_0x57c05f,_0x57c05f);}if(!_['isUndefined'](_0x26fdac)&&_0x5a31('0x12')===typeof _0x26fdac&&!_['isEmpty'](_0x26fdac)){return _0x26fdac;}return _0x5a31('0x15');};exports['isActive']=function(_0x42afe4){if(_[_0x5a31('0x16')](_0x42afe4)){return![];}return _0x42afe4;};exports[_0x5a31('0x17')]=function(_0x578758,_0x911dbd,_0x1372ad,_0xf20c40,_0x541234,_0x1dd60e){var _0x46797a={'XMD-QUEUE':_0x911dbd['Queue']?_0x911dbd[_0x5a31('0x18')][_0x5a31('0x19')]:'','XMD-CALLERID':_0xf20c40,'XMD-CALLERID-PREVIEW':_0x1dd60e?util['format'](_0x5a31('0x14'),_0x1dd60e[_0x5a31('0x1a')],_0x1dd60e[_0x5a31('0x1b')]):_0xf20c40,'XMD-DIALID':_0x541234,'XMD-CONTACTID':_0x911dbd['ContactId'],'XMD-CDRTYPE':_0x5a31('0x1c'),'CALLERID(all)':_0xf20c40,'XMD-VOICEQUEUEID':_0x911dbd[_0x5a31('0x1d')],'XMD-DIALCHANNEL':_0x1372ad,'XMD-DIALTIMEOUT':_0x578758[_0x5a31('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0x5a31('0x1f')](_0x5a31('0x20'),_0x578758[_0x5a31('0x21')]?'g':'',_[_0x5a31('0x22')](_0x578758['monitor_format'])?'':_0x5a31('0x23')),'XMD-DIALURL':_0x578758[_0x5a31('0x24')]||'','XMD-AGI':_0x578758[_0x5a31('0x25')]?util[_0x5a31('0x1f')]('\x22agi://%s/square,%s\x22',ipAgi,_0x578758[_0x5a31('0x25')]):_0x5a31('0x26'),'XMD-AGIAFTER':_0x578758[_0x5a31('0x21')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x578758[_0x5a31('0x21')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x1dd60e?_0x1dd60e[_0x5a31('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x1dd60e?_0x1dd60e[_0x5a31('0x28')]:'','XMD-DESTINATION':_0x5a31('0x29'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0x5a31('0x22')](_0x578758[_0x5a31('0x2a')])){_0x46797a[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x578758[_0x5a31('0x2a')];_0x46797a[util[_0x5a31('0x1f')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x541234;}if(_0x911dbd&&_0x911dbd[_0x5a31('0x2b')]){for(var _0x3064cc in _0x911dbd[_0x5a31('0x2b')]){if(_0x911dbd[_0x5a31('0x2b')]['hasOwnProperty'](_0x3064cc)){if(!_[_0x5a31('0x16')](_0x911dbd[_0x5a31('0x2b')][_0x3064cc])&&_0x3064cc!=='id'&&_0x3064cc!==_0x5a31('0x2c')&&_0x3064cc!==_0x5a31('0x2d')&&_0x3064cc!==_0x5a31('0x2e')){_0x46797a[util[_0x5a31('0x1f')](_0x5a31('0x2f'),'XMD-',_[_0x5a31('0x30')](_0x3064cc))]=_0x911dbd[_0x5a31('0x2b')][_0x3064cc];}}}}return _0x46797a;};exports[_0x5a31('0x31')]=function(_0x121fa0){var _0x42f643={};for(var _0x1b9a3a in _0x121fa0){if(_0x121fa0[_0x5a31('0x32')](_0x1b9a3a)){_0x42f643[util[_0x5a31('0x1f')]('%s',_[_0x5a31('0x33')](_0x1b9a3a))]=_0x121fa0[_0x1b9a3a];}}return{'variables':_0x42f643};};exports[_0x5a31('0x34')]=function(_0x43dda8,_0x2eaef1){if(!_[_0x5a31('0x16')](_0x43dda8)){if(_0x43dda8[_0x5a31('0x32')](_0x5a31('0x35'))){if(_0x43dda8[_0x5a31('0x35')]>0x0){_0x43dda8[_0x5a31('0x35')]-=0x1;}else{logger['error'](_0x5a31('0x36'),_0x2eaef1);}}}else{logger['error'](_0x5a31('0x37'),_0x2eaef1);}};exports['logBlacklist']=function(_0x792491){var _0x49e16b=moment()[_0x5a31('0x1f')](_0x5a31('0x38'));_0x792491[_0x5a31('0x39')]=0xd;_0x792491['statedesc']='Blacklist';_0x792491[_0x5a31('0x3a')]=_0x49e16b;_0x792491[_0x5a31('0x3b')]=_0x49e16b;_0x792491[_0x5a31('0x3c')]=_0x49e16b;};exports[_0x5a31('0x3d')]=function(_0x3ba878,_0x24f8c0,_0x4c5ca5){var _0x413b63=moment()[_0x5a31('0x1f')](_0x5a31('0x38'));_0x3ba878[_0x5a31('0x39')]=_0x24f8c0;_0x3ba878['statedesc']=_0x4c5ca5;_0x3ba878[_0x5a31('0x3b')]=_0x413b63;_0x3ba878[_0x5a31('0x3e')]=getSeconds(_0x3ba878[_0x5a31('0x3b')],_0x3ba878['starttime']);};exports['logLookAgent']=function(_0x1ff871,_0x29505a,_0x5ecdf7){_0x1ff871['membername']=_0x29505a;_0x1ff871[_0x5a31('0x3f')]=_0x5ecdf7;};exports[_0x5a31('0x40')]=function(_0x428fdd,_0x50df1c,_0x57d0fe){var _0x3b16b5=moment()[_0x5a31('0x1f')](_0x5a31('0x38'));_0x428fdd[_0x5a31('0x39')]=_0x50df1c;_0x428fdd[_0x5a31('0x41')]=_0x57d0fe;_0x428fdd['responsetime']=_0x428fdd[_0x5a31('0x3b')]?_0x428fdd[_0x5a31('0x3b')]:_0x3b16b5;_0x428fdd[_0x5a31('0x3c')]=_0x428fdd['endtime']?_0x428fdd['endtime']:_0x3b16b5;_0x428fdd[_0x5a31('0x3e')]=getSeconds(_0x428fdd['responsetime']||0x0,_0x428fdd['starttime']||0x0);_0x428fdd[_0x5a31('0x42')]=_0x428fdd[_0x5a31('0x43')]?getSeconds(_0x428fdd[_0x5a31('0x3c')],_0x428fdd[_0x5a31('0x43')]):0x0;};exports[_0x5a31('0x44')]=function(_0x316dca){return _0x316dca===_0x5a31('0x45');};exports[_0x5a31('0x46')]=function(_0x44c1df,_0xb16778,_0x4f9a40,_0x545584,_0x14a4f9){var _0xe9a60a=_0x545584?_0x5a31('0x47'):_0x44c1df[_0x5a31('0x1a')];_0xe9a60a=_0x14a4f9?_0x5a31('0x48'):_0xe9a60a;return{'actionid':_0x44c1df[_0x5a31('0x49')],'action':_0x5a31('0x4a'),'channel':_0x44c1df['channelAgent'],'callerid':util[_0x5a31('0x1f')](_0x5a31('0x14'),_0xe9a60a,_0x44c1df[_0x5a31('0x1b')]),'Exten':'xcally-motion-preview','Context':_0x5a31('0x4b'),'Priority':'1','variable':_0x4f9a40,'timeout':(_0xb16778[_0x5a31('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x44c1df[_0x5a31('0x49')]};};exports[_0x5a31('0x4d')]=function(_0x102224){return _0x102224['countbusyretry']+_0x102224[_0x5a31('0x4e')]+_0x102224[_0x5a31('0x4f')]+_0x102224['countagentrejectretry']+_0x102224['countnosuchnumberretry'];};exports[_0x5a31('0x50')]=function(_0x4e819e){var _0x4d0ef3=_[_0x5a31('0x51')](_0x4e819e);_0x4d0ef3[_0x5a31('0x39')]=0xf;_0x4d0ef3[_0x5a31('0x41')]=_0x5a31('0x52');return _0x4d0ef3;};exports['scheduledAt']=function(_0x1c5dfc,_0x2ddbef,_0x21204d){var _0x1e44d2={};_0x1e44d2[_0x2ddbef]=_0x1c5dfc[_0x2ddbef];_0x1e44d2[_0x5a31('0x53')]=![];_0x1e44d2[_0x5a31('0x54')]=moment()[_0x5a31('0x55')](_0x21204d,_0x5a31('0x56'))[_0x5a31('0x1f')](_0x5a31('0x38'));_0x1e44d2[_0x5a31('0x57')]=_0x1c5dfc['ContactId'];_0x1e44d2[_0x5a31('0x58')]=_0x1c5dfc[_0x5a31('0x58')];_0x1e44d2[_0x5a31('0x1d')]=_0x1c5dfc[_0x5a31('0x1d')]||undefined;return _0x1e44d2;};exports['decrementTalkink']=function(_0x403058,_0x5c4a9a){if(!_['isNil'](_0x403058)){if(_0x403058[_0x5a31('0x59')]>0x0){_0x403058[_0x5a31('0x59')]-=0x1;}else{logger['error'](_0x5c4a9a,_0x5a31('0x5a'));}}else{logger[_0x5a31('0xb')](_0x5c4a9a,_0x5a31('0x5b'));}};exports[_0x5a31('0x5c')]=function(_0x3b620a){if(_0x3b620a<=0x0){return!![];}return![];};exports[_0x5a31('0x5d')]=function(_0xdbc20a,_0x4275b3,_0x5afa91){_0xdbc20a[_0x5a31('0x5e')]=_0x4275b3;_0xdbc20a['name']=_0xdbc20a[_0x5a31('0x5f')];_0xdbc20a['interface']=_0xdbc20a[_0x5a31('0x60')];_0xdbc20a[_0x5a31('0x61')]=_0x5a31('0x62');if(_0x5afa91){_0xdbc20a[_0x5a31('0x63')]=_0x5afa91['mandatoryDisposition'];}return _0xdbc20a;};exports['buildAcw']=function(_0x12a11d){var _0x3efc0b={};_0x3efc0b[_0x5a31('0x5f')]=_0x12a11d[_0x5a31('0x5f')];_0x3efc0b[_0x5a31('0x64')]=_0x12a11d[_0x5a31('0x60')];_0x3efc0b['uniqueid']=_0x12a11d['uniqueid'];return _0x3efc0b;};exports[_0x5a31('0x65')]=function(_0x1402bf){var _0x29799c=[];for(var _0xc4c800 in _0x1402bf){if(_0x1402bf[_0x5a31('0x32')](_0xc4c800)){if(!_[_0x5a31('0x16')](_0x1402bf[_0xc4c800])&&_0x1402bf[_0xc4c800][_0x5a31('0x39')]===_0x5a31('0x66')&&_0x1402bf[_0xc4c800][_0x5a31('0x67')]===_0x5a31('0x68')){_0x29799c[_0x5a31('0x69')](_0x1402bf[_0xc4c800]['id']);}}}return _0x29799c;};exports[_0x5a31('0x6a')]=function(_0x27b1b5){var _0x191f95=moment()[_0x5a31('0x7')](0x0);var _0x512302=moment(_0x27b1b5)[_0x5a31('0x7')](0x0);return _0x191f95[_0x5a31('0x8')](_0x512302,_0x5a31('0x9'));};exports[_0x5a31('0x6b')]=function(_0x588f33){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x588f33['ContactId'],'ListId':_0x588f33[_0x5a31('0x58')],'VoiceQueueId':_0x588f33[_0x5a31('0x1d')]||undefined,'CampaignId':_0x588f33[_0x5a31('0x6c')]||undefined};};exports['filterKey']=function(_0x3a06ef){if(_0x3a06ef===_0x5a31('0x49')||_0x3a06ef===_0x5a31('0x6d')||_0x3a06ef==='queue'||_0x3a06ef==='type'||_0x3a06ef===_0x5a31('0x6e')||_0x3a06ef===_0x5a31('0x6f')||_0x3a06ef===_0x5a31('0x70')||_0x3a06ef===_0x5a31('0x60')||_0x3a06ef===_0x5a31('0x1a')||_0x3a06ef===_0x5a31('0x53')||_0x3a06ef===_0x5a31('0x1b')||_0x3a06ef==='scheduledat'||_0x3a06ef===_0x5a31('0x71')||_0x3a06ef===_0x5a31('0x4e')||_0x3a06ef===_0x5a31('0x4f')||_0x3a06ef==='countglobal'||_0x3a06ef===_0x5a31('0x72')||_0x3a06ef==='callbackuniqueid'||_0x3a06ef===_0x5a31('0x73')||_0x3a06ef==='recallme'||_0x3a06ef==='ContactId'||_0x3a06ef===_0x5a31('0x58')||_0x3a06ef===_0x5a31('0x3f')||_0x3a06ef===_0x5a31('0x1d')||_0x3a06ef===_0x5a31('0x74')||_0x3a06ef==='xmd-voicequeueid'||_0x3a06ef===_0x5a31('0x75')||_0x3a06ef===_0x5a31('0x76')||_0x3a06ef===_0x5a31('0x77')||_0x3a06ef===_0x5a31('0x78')||_0x3a06ef==='xmd-dialtimeout'||_0x3a06ef==='xmd-dialoptions'||_0x3a06ef==='xmd-dialid'||_0x3a06ef===_0x5a31('0x79')||_0x3a06ef===_0x5a31('0x7a')||_0x3a06ef===_0x5a31('0x7b')||_0x3a06ef==='xmd-callerid'||_0x3a06ef===_0x5a31('0x7c')||_0x3a06ef===_0x5a31('0x7d')||_0x3a06ef===_0x5a31('0x7e')||_0x3a06ef===_0x5a31('0x7f')||_0x3a06ef===_0x5a31('0x80')||_0x3a06ef==='rtpaudioqosjitterbridged'||_0x3a06ef===_0x5a31('0x81')||_0x3a06ef==='rtpaudioqoslossbridged'||_0x3a06ef==='rtpaudioqosrtt'||_0x3a06ef==='rtpaudioqosrttbridged'||_0x3a06ef===_0x5a31('0x7e')||_0x3a06ef===_0x5a31('0x7f')||_0x3a06ef===_0x5a31('0x80')||_0x3a06ef===_0x5a31('0x82')||_0x3a06ef===_0x5a31('0x81')||_0x3a06ef==='rtpaudioqoslossbridged'||_0x3a06ef===_0x5a31('0x83')||_0x3a06ef===_0x5a31('0x84')||_0x3a06ef===_0x5a31('0x85')||_0x3a06ef===_0x5a31('0x86')||_0x3a06ef==='state'||_0x3a06ef===_0x5a31('0x41')){return![];}return!![];};exports[_0x5a31('0x87')]=function(_0x117d1e,_0x1ca4b3){var _0x4f19a1,_0x534d95,_0x2a6b4a;if(_0x1ca4b3<=0x0){_0x1ca4b3=0x1;}_0x4f19a1=new RegExp('\x5cw{0,'+_0x1ca4b3+'}$');_0x534d95=Math[_0x5a31('0x88')](0xa,_0x1ca4b3-0x1);_0x2a6b4a=Math['pow'](0xa,_0x1ca4b3)-0x1;return util[_0x5a31('0x1f')]('%s',_['replace'](_0x117d1e,_0x4f19a1,_['random'](_0x534d95,_0x2a6b4a)));};exports['extractCalleridName']=function(_0x46fe78){var _0x4c4d7d=_0x46fe78[_0x5a31('0x89')](/"(.*?)"/);return _0x4c4d7d?_0x4c4d7d[0x1]:_0x46fe78;};exports[_0x5a31('0x8a')]=function(_0x4d5e35){var _0x453622=_0x4d5e35['match'](/<(.*?)>/);return _0x453622?_0x453622[0x1]:_0x4d5e35;}; \ No newline at end of file +var _0xc5b9=['countnoanswerretry','countnosuchnumberretry','cloneAction','clone','state','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','queue','interface','motionChannel','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','push','seconds','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','membername','countglobal','callback','callbackuniqueid','callbackat','recallme','xmd-voicequeueid','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqoslossbridged','getCallerIdRandom','pow','replace','random','match','extractCalleridNumber','lodash','moment','../../../../config/logger','preview','env','127.0.0.1','milliseconds','diff','error','inspect','logger','info','loggerError','logger2','getCallerId','isUndefined','isEmpty','format','\x22%s\x22\x20<%s>','string','\x22\x22\x20<>','isActive','isNil','addVariables','name','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','Blacklist','responsetime','endtime','statedesc','ringtime','logLookAgent','UserId','starttime','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','calleridnum','timeout','totalGlobal','countbusyretry','countcongestionretry'];(function(_0x510912,_0x91f943){var _0x23f357=function(_0x141565){while(--_0x141565){_0x510912['push'](_0x510912['shift']());}};_0x23f357(++_0x91f943);}(_0xc5b9,0xce));var _0x9c5b=function(_0x30986c,_0x39ce58){_0x30986c=_0x30986c-0x0;var _0x57c209=_0xc5b9[_0x30986c];return _0x57c209;};'use strict';var util=require('util');var _=require(_0x9c5b('0x0'));var moment=require(_0x9c5b('0x1'));var logger=require(_0x9c5b('0x2'))(_0x9c5b('0x3'));var ipAgi=process[_0x9c5b('0x4')]['XCALLY_IP_AGI']||_0x9c5b('0x5');function getSeconds(_0x6d944e,_0x4c414e){var _0x3b864d=moment(_0x6d944e)[_0x9c5b('0x6')](0x0);var _0x5453ab=moment(_0x4c414e)[_0x9c5b('0x6')](0x0);return _0x3b864d[_0x9c5b('0x7')](_0x5453ab,'seconds');}exports['loggerCatch']=function(_0x29348b){return function(_0x46892d){logger[_0x9c5b('0x8')](_0x29348b,util[_0x9c5b('0x9')](_0x46892d,{'showHidden':![],'depth':null}));};};exports[_0x9c5b('0xa')]=function(_0x4371e2,_0x47ba42){logger[_0x9c5b('0xb')](_0x4371e2,util[_0x9c5b('0x9')](_0x47ba42,{'showHidden':![],'depth':null}));};exports[_0x9c5b('0xc')]=function(_0x40afff,_0x4da2fd){logger[_0x9c5b('0x8')](_0x40afff,util['inspect'](_0x4da2fd,{'showHidden':![],'depth':null}));};exports[_0x9c5b('0xd')]=function(_0x2acda2){return function(_0x320a94){logger[_0x9c5b('0xb')](_0x2acda2,util['inspect'](_0x320a94,{'showHidden':![],'depth':null}));};};exports['message']=function(_0xec4281,_0x1ef799,_0x133bb4){return{'message':_0xec4281,'unlock':_0x1ef799,'active':_0x133bb4};};exports[_0x9c5b('0xe')]=function(_0x47324d,_0x6f608d,_0x5ee129){if(!_[_0x9c5b('0xf')](_0x5ee129)&&'string'===typeof _0x5ee129&&!_[_0x9c5b('0x10')](_0x5ee129)){if(!_[_0x9c5b('0xf')](_0x6f608d)&&'string'===typeof _0x6f608d&&!_[_0x9c5b('0x10')](_0x6f608d)){return util[_0x9c5b('0x11')](_0x9c5b('0x12'),_0x6f608d,_0x5ee129);}return util['format'](_0x9c5b('0x12'),_0x5ee129,_0x5ee129);}if(!_[_0x9c5b('0xf')](_0x47324d)&&_0x9c5b('0x13')===typeof _0x47324d&&!_[_0x9c5b('0x10')](_0x47324d)){return _0x47324d;}return _0x9c5b('0x14');};exports[_0x9c5b('0x15')]=function(_0x132279){if(_[_0x9c5b('0x16')](_0x132279)){return![];}return _0x132279;};exports[_0x9c5b('0x17')]=function(_0x599933,_0x4909c9,_0x240324,_0x363393,_0x4f2fc1,_0x172618){var _0x4f06f8={'XMD-QUEUE':_0x4909c9['Queue']?_0x4909c9['Queue'][_0x9c5b('0x18')]:'','XMD-CALLERID':_0x363393,'XMD-CALLERID-PREVIEW':_0x172618?util[_0x9c5b('0x11')](_0x9c5b('0x12'),_0x172618[_0x9c5b('0x19')],_0x172618['calleridnum']):_0x363393,'XMD-DIALID':_0x4f2fc1,'XMD-CONTACTID':_0x4909c9[_0x9c5b('0x1a')],'XMD-CDRTYPE':_0x9c5b('0x1b'),'CALLERID(all)':_0x363393,'XMD-VOICEQUEUEID':_0x4909c9[_0x9c5b('0x1c')],'XMD-DIALCHANNEL':_0x240324,'XMD-DIALTIMEOUT':_0x599933[_0x9c5b('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0x9c5b('0x11')](_0x9c5b('0x1e'),_0x599933[_0x9c5b('0x1f')]?'g':'',_['isEmpty'](_0x599933[_0x9c5b('0x20')])?'':_0x9c5b('0x21')),'XMD-DIALURL':_0x599933['dialPreviewUrl']||'','XMD-AGI':_0x599933[_0x9c5b('0x22')]?util[_0x9c5b('0x11')](_0x9c5b('0x23'),ipAgi,_0x599933[_0x9c5b('0x22')]):_0x9c5b('0x24'),'XMD-AGIAFTER':_0x599933[_0x9c5b('0x1f')]?util[_0x9c5b('0x11')](_0x9c5b('0x23'),ipAgi,_0x599933[_0x9c5b('0x1f')]):_0x9c5b('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x172618?_0x172618[_0x9c5b('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x172618?_0x172618[_0x9c5b('0x26')]:'','XMD-DESTINATION':_0x9c5b('0x27'),'SIPADDHEADER':_0x9c5b('0x28')};if(!_['isEmpty'](_0x599933[_0x9c5b('0x20')])){_0x4f06f8[util[_0x9c5b('0x11')]('%s',_0x9c5b('0x29'))]=_0x599933[_0x9c5b('0x20')];_0x4f06f8[util[_0x9c5b('0x11')]('%s',_0x9c5b('0x2a'))]=_0x4f2fc1;}if(_0x4909c9&&_0x4909c9[_0x9c5b('0x2b')]){for(var _0x5d8e59 in _0x4909c9[_0x9c5b('0x2b')]){if(_0x4909c9[_0x9c5b('0x2b')][_0x9c5b('0x2c')](_0x5d8e59)){if(!_[_0x9c5b('0x16')](_0x4909c9[_0x9c5b('0x2b')][_0x5d8e59])&&_0x5d8e59!=='id'&&_0x5d8e59!==_0x9c5b('0x2d')&&_0x5d8e59!=='createdAt'&&_0x5d8e59!==_0x9c5b('0x2e')){_0x4f06f8[util[_0x9c5b('0x11')](_0x9c5b('0x2f'),_0x9c5b('0x30'),_[_0x9c5b('0x31')](_0x5d8e59))]=_0x4909c9[_0x9c5b('0x2b')][_0x5d8e59];}}}}return _0x4f06f8;};exports[_0x9c5b('0x32')]=function(_0x361b4c){var _0x48cecf={};for(var _0xd42baa in _0x361b4c){if(_0x361b4c[_0x9c5b('0x2c')](_0xd42baa)){_0x48cecf[util[_0x9c5b('0x11')]('%s',_[_0x9c5b('0x33')](_0xd42baa))]=_0x361b4c[_0xd42baa];}}return{'variables':_0x48cecf};};exports['updateOriginated']=function(_0x17e233,_0x1c182f){if(!_[_0x9c5b('0x16')](_0x17e233)){if(_0x17e233[_0x9c5b('0x2c')](_0x9c5b('0x34'))){if(_0x17e233[_0x9c5b('0x34')]>0x0){_0x17e233['originated']-=0x1;}else{logger[_0x9c5b('0x8')](_0x9c5b('0x35'),_0x1c182f);}}}else{logger[_0x9c5b('0x8')](_0x9c5b('0x36'),_0x1c182f);}};exports[_0x9c5b('0x37')]=function(_0x138430){var _0x250e04=moment()[_0x9c5b('0x11')](_0x9c5b('0x38'));_0x138430['state']=0xd;_0x138430['statedesc']=_0x9c5b('0x39');_0x138430['starttime']=_0x250e04;_0x138430[_0x9c5b('0x3a')]=_0x250e04;_0x138430[_0x9c5b('0x3b')]=_0x250e04;};exports['logAgent']=function(_0x830b80,_0x1a9178,_0x5e5fff){var _0x38f381=moment()[_0x9c5b('0x11')](_0x9c5b('0x38'));_0x830b80['state']=_0x1a9178;_0x830b80[_0x9c5b('0x3c')]=_0x5e5fff;_0x830b80[_0x9c5b('0x3a')]=_0x38f381;_0x830b80[_0x9c5b('0x3d')]=getSeconds(_0x830b80[_0x9c5b('0x3a')],_0x830b80['starttime']);};exports[_0x9c5b('0x3e')]=function(_0x266ea7,_0x63fa00,_0xa06b12){_0x266ea7['membername']=_0x63fa00;_0x266ea7[_0x9c5b('0x3f')]=_0xa06b12;};exports['logCustomer']=function(_0x13f7e6,_0x55d295,_0x134ae7){var _0x522fec=moment()[_0x9c5b('0x11')](_0x9c5b('0x38'));_0x13f7e6['state']=_0x55d295;_0x13f7e6[_0x9c5b('0x3c')]=_0x134ae7;_0x13f7e6[_0x9c5b('0x3a')]=_0x13f7e6[_0x9c5b('0x3a')]?_0x13f7e6[_0x9c5b('0x3a')]:_0x522fec;_0x13f7e6[_0x9c5b('0x3b')]=_0x13f7e6[_0x9c5b('0x3b')]?_0x13f7e6[_0x9c5b('0x3b')]:_0x522fec;_0x13f7e6[_0x9c5b('0x3d')]=getSeconds(_0x13f7e6[_0x9c5b('0x3a')]||0x0,_0x13f7e6[_0x9c5b('0x40')]||0x0);_0x13f7e6[_0x9c5b('0x41')]=_0x13f7e6[_0x9c5b('0x42')]?getSeconds(_0x13f7e6[_0x9c5b('0x3b')],_0x13f7e6['answertime']):0x0;};exports[_0x9c5b('0x43')]=function(_0x991742){return _0x991742===_0x9c5b('0x44');};exports[_0x9c5b('0x45')]=function(_0x5eb948,_0x3a74fe,_0x546360,_0x38271d,_0x4fb442){var _0x5b0998=_0x38271d?_0x9c5b('0x46'):_0x5eb948[_0x9c5b('0x19')];_0x5b0998=_0x4fb442?_0x9c5b('0x47'):_0x5b0998;return{'actionid':_0x5eb948[_0x9c5b('0x48')],'action':_0x9c5b('0x49'),'channel':_0x5eb948[_0x9c5b('0x4a')],'callerid':util[_0x9c5b('0x11')](_0x9c5b('0x12'),_0x5b0998,_0x5eb948[_0x9c5b('0x4b')]),'Exten':_0x9c5b('0x27'),'Context':'from-sip','Priority':'1','variable':_0x546360,'timeout':(_0x3a74fe[_0x9c5b('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5eb948[_0x9c5b('0x48')]};};exports[_0x9c5b('0x4d')]=function(_0x30f98a){return _0x30f98a[_0x9c5b('0x4e')]+_0x30f98a[_0x9c5b('0x4f')]+_0x30f98a[_0x9c5b('0x50')]+_0x30f98a['countagentrejectretry']+_0x30f98a[_0x9c5b('0x51')];};exports[_0x9c5b('0x52')]=function(_0x1d37f3){var _0xc7adf4=_[_0x9c5b('0x53')](_0x1d37f3);_0xc7adf4[_0x9c5b('0x54')]=0xf;_0xc7adf4[_0x9c5b('0x3c')]=_0x9c5b('0x55');return _0xc7adf4;};exports[_0x9c5b('0x56')]=function(_0x2f5ea0,_0x485be2,_0x9657f8){var _0x1b7df3={};_0x1b7df3[_0x485be2]=_0x2f5ea0[_0x485be2];_0x1b7df3[_0x9c5b('0x57')]=![];_0x1b7df3[_0x9c5b('0x58')]=moment()[_0x9c5b('0x59')](_0x9657f8,_0x9c5b('0x5a'))['format'](_0x9c5b('0x38'));_0x1b7df3[_0x9c5b('0x1a')]=_0x2f5ea0[_0x9c5b('0x1a')];_0x1b7df3[_0x9c5b('0x5b')]=_0x2f5ea0['ListId'];_0x1b7df3[_0x9c5b('0x1c')]=_0x2f5ea0[_0x9c5b('0x1c')]||undefined;return _0x1b7df3;};exports[_0x9c5b('0x5c')]=function(_0x3a777a,_0x4faff0){if(!_[_0x9c5b('0x16')](_0x3a777a)){if(_0x3a777a['pTalking']>0x0){_0x3a777a[_0x9c5b('0x5d')]-=0x1;}else{logger['error'](_0x4faff0,_0x9c5b('0x5e'));}}else{logger[_0x9c5b('0x8')](_0x4faff0,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x3dabd3){if(_0x3dabd3<=0x0){return!![];}return![];};exports['buildObj']=function(_0x460d40,_0x336969,_0x120d5a){_0x460d40['lastevent']=_0x336969;_0x460d40['name']=_0x460d40[_0x9c5b('0x5f')];_0x460d40[_0x9c5b('0x60')]=_0x460d40[_0x9c5b('0x4a')];_0x460d40[_0x9c5b('0x61')]=_0x9c5b('0x62');if(_0x120d5a){_0x460d40['mandatoryDisposition']=_0x120d5a[_0x9c5b('0x63')];}return _0x460d40;};exports[_0x9c5b('0x64')]=function(_0x813ca3){var _0x11bbb9={};_0x11bbb9[_0x9c5b('0x5f')]=_0x813ca3['queue'];_0x11bbb9[_0x9c5b('0x60')]=_0x813ca3[_0x9c5b('0x4a')];_0x11bbb9[_0x9c5b('0x48')]=_0x813ca3['uniqueid'];return _0x11bbb9;};exports[_0x9c5b('0x65')]=function(_0x2b7c87){var _0x3b6bea=[];for(var _0x5bd8df in _0x2b7c87){if(_0x2b7c87[_0x9c5b('0x2c')](_0x5bd8df)){if(!_[_0x9c5b('0x16')](_0x2b7c87[_0x5bd8df])&&_0x2b7c87[_0x5bd8df]['state']===_0x9c5b('0x66')&&_0x2b7c87[_0x5bd8df][_0x9c5b('0x67')]===_0x9c5b('0x68')){_0x3b6bea[_0x9c5b('0x69')](_0x2b7c87[_0x5bd8df]['id']);}}}return _0x3b6bea;};exports['getDiff']=function(_0x1a456d){var _0x27df4b=moment()[_0x9c5b('0x6')](0x0);var _0x1bd798=moment(_0x1a456d)[_0x9c5b('0x6')](0x0);return _0x27df4b[_0x9c5b('0x7')](_0x1bd798,_0x9c5b('0x6a'));};exports[_0x9c5b('0x6b')]=function(_0x3253a6){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3253a6[_0x9c5b('0x1a')],'ListId':_0x3253a6[_0x9c5b('0x5b')],'VoiceQueueId':_0x3253a6['VoiceQueueId']||undefined,'CampaignId':_0x3253a6[_0x9c5b('0x6c')]||undefined};};exports[_0x9c5b('0x6d')]=function(_0x511c29){if(_0x511c29===_0x9c5b('0x48')||_0x511c29===_0x9c5b('0x6e')||_0x511c29===_0x9c5b('0x5f')||_0x511c29===_0x9c5b('0x6f')||_0x511c29===_0x9c5b('0x70')||_0x511c29===_0x9c5b('0x71')||_0x511c29===_0x9c5b('0x72')||_0x511c29===_0x9c5b('0x4a')||_0x511c29===_0x9c5b('0x19')||_0x511c29===_0x9c5b('0x57')||_0x511c29===_0x9c5b('0x4b')||_0x511c29===_0x9c5b('0x58')||_0x511c29==='countbusyretry'||_0x511c29==='countcongestionretry'||_0x511c29===_0x9c5b('0x50')||_0x511c29===_0x9c5b('0x73')||_0x511c29===_0x9c5b('0x74')||_0x511c29===_0x9c5b('0x75')||_0x511c29===_0x9c5b('0x76')||_0x511c29===_0x9c5b('0x77')||_0x511c29===_0x9c5b('0x1a')||_0x511c29==='ListId'||_0x511c29===_0x9c5b('0x3f')||_0x511c29===_0x9c5b('0x1c')||_0x511c29==='sipcallid'||_0x511c29===_0x9c5b('0x78')||_0x511c29==='xmd-queue'||_0x511c29==='xmd-phone'||_0x511c29===_0x9c5b('0x79')||_0x511c29===_0x9c5b('0x7a')||_0x511c29===_0x9c5b('0x7b')||_0x511c29==='xmd-dialoptions'||_0x511c29===_0x9c5b('0x7c')||_0x511c29===_0x9c5b('0x7d')||_0x511c29===_0x9c5b('0x7e')||_0x511c29==='xmd-cdrtype'||_0x511c29===_0x9c5b('0x7f')||_0x511c29==='xmd-agiafter'||_0x511c29===_0x9c5b('0x80')||_0x511c29===_0x9c5b('0x81')||_0x511c29===_0x9c5b('0x82')||_0x511c29===_0x9c5b('0x83')||_0x511c29===_0x9c5b('0x84')||_0x511c29===_0x9c5b('0x85')||_0x511c29==='rtpaudioqoslossbridged'||_0x511c29===_0x9c5b('0x86')||_0x511c29===_0x9c5b('0x87')||_0x511c29===_0x9c5b('0x81')||_0x511c29==='rtpaudioqosbridged'||_0x511c29===_0x9c5b('0x83')||_0x511c29===_0x9c5b('0x84')||_0x511c29===_0x9c5b('0x85')||_0x511c29===_0x9c5b('0x88')||_0x511c29===_0x9c5b('0x86')||_0x511c29==='rtpaudioqosrttbridged'||_0x511c29==='bridgepeer'||_0x511c29==='bridgepvtcallid'||_0x511c29==='state'||_0x511c29===_0x9c5b('0x3c')){return![];}return!![];};exports[_0x9c5b('0x89')]=function(_0x410efd,_0x31d151){var _0x44e61d,_0x539278,_0x280f33;if(_0x31d151<=0x0){_0x31d151=0x1;}_0x44e61d=new RegExp('\x5cw{0,'+_0x31d151+'}$');_0x539278=Math[_0x9c5b('0x8a')](0xa,_0x31d151-0x1);_0x280f33=Math[_0x9c5b('0x8a')](0xa,_0x31d151)-0x1;return util[_0x9c5b('0x11')]('%s',_[_0x9c5b('0x8b')](_0x410efd,_0x44e61d,_[_0x9c5b('0x8c')](_0x539278,_0x280f33)));};exports['extractCalleridName']=function(_0x380b9d){var _0x4f7d16=_0x380b9d[_0x9c5b('0x8d')](/"(.*?)"/);return _0x4f7d16?_0x4f7d16[0x1]:_0x380b9d;};exports[_0x9c5b('0x8e')]=function(_0x4dd204){var _0x51337a=_0x4dd204[_0x9c5b('0x8d')](/<(.*?)>/);return _0x51337a?_0x51337a[0x1]:_0x4dd204;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index edb9c79..b92878e 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 _0x3de6=['string','boolean','voicequeuechannel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3de6,0x141));var _0x63de=function(_0x1b072c,_0x197207){_0x1b072c=_0x1b072c-0x0;var _0x465dd6=_0x3de6[_0x1b072c];return _0x465dd6;};'use strict';exports['queueadd']={'queue':{'type':_0x63de('0x0'),'required':!![]},'interface':{'type':_0x63de('0x0'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':'boolean','required':![]}};exports['queueremove']={'queue':{'type':_0x63de('0x0'),'required':!![]},'interface':{'type':_0x63de('0x0'),'required':!![]}};exports['queuepause']={'interface':{'type':'string','required':!![]},'paused':{'type':_0x63de('0x1')},'reason':{'type':_0x63de('0x0'),'required':![]}};exports['reload']={'module':{'type':_0x63de('0x0'),'required':![]}};exports[_0x63de('0x2')]={'uniqueid':{'type':_0x63de('0x0'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x63de('0x0')},'format':{'type':'string'},'mixmonitorid':{'type':_0x63de('0x0')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x63de('0x0'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x63de('0x0'),'required':!![]},'exten':{'type':_0x63de('0x0'),'required':!![]},'context':{'type':_0x63de('0x0')}}; \ No newline at end of file +var _0x9a25=['voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','queuepause'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x9a25,0x81));var _0x59a2=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9a25[_0x5b644e];return _0x49c6bf;};'use strict';exports[_0x59a2('0x0')]={'queue':{'type':_0x59a2('0x1'),'required':!![]},'interface':{'type':_0x59a2('0x1'),'required':!![]},'membername':{'type':_0x59a2('0x1'),'required':!![]},'penalty':{'type':_0x59a2('0x2'),'required':![]},'paused':{'type':_0x59a2('0x3'),'required':![]}};exports[_0x59a2('0x4')]={'queue':{'type':_0x59a2('0x1'),'required':!![]},'interface':{'type':_0x59a2('0x1'),'required':!![]}};exports[_0x59a2('0x5')]={'interface':{'type':_0x59a2('0x1'),'required':!![]},'paused':{'type':_0x59a2('0x3')},'reason':{'type':_0x59a2('0x1'),'required':![]}};exports['reload']={'module':{'type':'string','required':![]}};exports[_0x59a2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x59a2('0x1'),'required':!![]},'filename':{'type':_0x59a2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0x59a2('0x7')]={'uniqueid':{'type':_0x59a2('0x1'),'required':!![]}};exports[_0x59a2('0x8')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x59a2('0x1'),'required':!![]},'context':{'type':_0x59a2('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 81df0fd..ff892fe 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 _0xa1d5=['trunks','initVoiceQueues','initTriggers','initZendeskAccounts','initSalesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','voiceQueues','triggers','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','interface','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','abandoned','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined'];(function(_0x390556,_0x5b64bd){var _0x11868e=function(_0x51bf69){while(--_0x51bf69){_0x390556['push'](_0x390556['shift']());}};_0x11868e(++_0x5b64bd);}(_0xa1d5,0x16d));var _0x5a1d=function(_0x426190,_0x5b475d){_0x426190=_0x426190-0x0;var _0x17ddbd=_0xa1d5[_0x426190];return _0x17ddbd;};'use strict';var BPromise=require(_0x5a1d('0x0'));var util=require(_0x5a1d('0x1'));var _=require(_0x5a1d('0x2'));var moment=require(_0x5a1d('0x3'));var Agent=require(_0x5a1d('0x4'));var Telephone=require(_0x5a1d('0x5'));var Trunk=require(_0x5a1d('0x6'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x5a1d('0x7'));var Template=require(_0x5a1d('0x8'));var Campaign=require(_0x5a1d('0x9'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x5a1d('0xa'));var SalesforceAccount=require(_0x5a1d('0xb'));var FreshdeskAccount=require(_0x5a1d('0xc'));var SugarcrmAccount=require(_0x5a1d('0xd'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0x5a1d('0xe'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0x5a1d('0xf'));var Dynamics365Account=require(_0x5a1d('0x10'));var FreshsalesAccount=require(_0x5a1d('0x11'));var FaxAccount=require(_0x5a1d('0x12'));var Realtime=function(){this[_0x5a1d('0x13')]={};this[_0x5a1d('0x14')]={};this['trunks']={};this[_0x5a1d('0x15')]={};this[_0x5a1d('0x16')]={};this[_0x5a1d('0x17')]={};this[_0x5a1d('0x18')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x5a1d('0x19')]={};this[_0x5a1d('0x1a')]={};this[_0x5a1d('0x1b')]={};this[_0x5a1d('0x1c')]={};this[_0x5a1d('0x1d')]={};this['settings']={};this[_0x5a1d('0x1e')]={};this[_0x5a1d('0x1f')]={};this['sugarcrmAccounts']={};this[_0x5a1d('0x20')]={};this[_0x5a1d('0x21')]={};this[_0x5a1d('0x22')]={};this[_0x5a1d('0x23')]={};this['servicenowAccounts']={};this[_0x5a1d('0x24')]={};this['freshsalesAccounts']={};this[_0x5a1d('0x25')]={};};function freeIsNotKey(_0x5b6820,_0x475db2,_0x307cf5){var _0x48c9f6=_[_0x5a1d('0x26')](_0x5b6820,function(_0x1f8c10,_0x4e3281){return _0x1f8c10[_0x307cf5];});for(var _0x256493 in _0x475db2){if(_0x475db2[_0x5a1d('0x27')](_0x256493)){if(!_0x48c9f6[_0x256493]){delete _0x475db2[_0x256493];}}}}function freeIsNotKeySip(_0x2b0564,_0x21a0f9){var _0x19ab93=_[_0x5a1d('0x26')](_0x2b0564,function(_0xcb849d,_0x4c975e){return util[_0x5a1d('0x28')](_0x5a1d('0x29'),_0xcb849d[_0x5a1d('0x2a')]);});for(var _0x2b2713 in _0x21a0f9){if(_0x21a0f9[_0x5a1d('0x27')](_0x2b2713)){if(!_0x19ab93[_0x2b2713]){delete _0x21a0f9[_0x2b2713];}}}}function freeIsNotKeyAgent(_0x5c0531,_0xe6bfbd){var _0x2734f0=_[_0x5a1d('0x26')](_0x5c0531,function(_0x474b21,_0x2eddae){var _0x2534db=_['isNil'](_0x474b21[_0x5a1d('0x2b')])?util[_0x5a1d('0x28')](_0x5a1d('0x29'),_0x474b21[_0x5a1d('0x2a')]):_0x474b21[_0x5a1d('0x2b')];return _0x2534db;});for(var _0x1a896b in _0xe6bfbd){if(_0xe6bfbd[_0x5a1d('0x27')](_0x1a896b)){if(!_0x2734f0[_0x1a896b]){delete _0xe6bfbd[_0x1a896b];}}}}function clearVoiceCallReports(_0x3bad56){_0x3bad56[_0x5a1d('0x2c')]=0x0;_0x3bad56[_0x5a1d('0x2d')]=0x0;_0x3bad56[_0x5a1d('0x2e')]=0x0;_0x3bad56[_0x5a1d('0x2f')]=0x0;_0x3bad56[_0x5a1d('0x30')]=0x0;}function clearCampaigns(_0x1bc64c){if(!_[_0x5a1d('0x31')](_0x1bc64c)){for(var _0x1c0073 in _0x1bc64c){if(_0x1bc64c[_0x5a1d('0x27')](_0x1c0073)){_0x1bc64c[_0x1c0073][_0x5a1d('0x32')]=0x0;_0x1bc64c[_0x1c0073][_0x5a1d('0x33')]=0x0;}}}}function clearVoiceQueues(_0x58fcc9){if(!_[_0x5a1d('0x31')](_0x58fcc9)){for(var _0x3f9f41 in _0x58fcc9){if(_0x58fcc9[_0x5a1d('0x27')](_0x3f9f41)){_0x58fcc9[_0x3f9f41]['total']=0x0;_0x58fcc9[_0x3f9f41][_0x5a1d('0x2d')]=0x0;_0x58fcc9[_0x3f9f41]['unmanaged']=0x0;_0x58fcc9[_0x3f9f41][_0x5a1d('0x34')]=0x0;_0x58fcc9[_0x3f9f41]['sumHoldTime']=0x0;_0x58fcc9[_0x3f9f41][_0x5a1d('0x2f')]=0x0;_0x58fcc9[_0x3f9f41][_0x5a1d('0x30')]=0x0;_0x58fcc9[_0x3f9f41][_0x5a1d('0x35')]=0x0;_0x58fcc9[_0x3f9f41]['outboundNoAnswerCallsDay']=0x0;_0x58fcc9[_0x3f9f41]['outboundBusyCallsDay']=0x0;_0x58fcc9[_0x3f9f41][_0x5a1d('0x36')]=0x0;_0x58fcc9[_0x3f9f41][_0x5a1d('0x37')]=0x0;_0x58fcc9[_0x3f9f41]['outboundUnknownCallsDay']=0x0;_0x58fcc9[_0x3f9f41][_0x5a1d('0x38')]=0x0;_0x58fcc9[_0x3f9f41]['outboundDropCallsDayCallersExit']=0x0;_0x58fcc9[_0x3f9f41][_0x5a1d('0x39')]=0x0;_0x58fcc9[_0x3f9f41][_0x5a1d('0x3a')]=0x0;_0x58fcc9[_0x3f9f41][_0x5a1d('0x3b')]=0x0;_0x58fcc9[_0x3f9f41][_0x5a1d('0x3c')]=0x0;_0x58fcc9[_0x3f9f41][_0x5a1d('0x35')]=0x0;_0x58fcc9[_0x3f9f41][_0x5a1d('0x3d')]=0x0;_0x58fcc9[_0x3f9f41][_0x5a1d('0x3e')]=!![];}}}}Realtime[_0x5a1d('0x3f')][_0x5a1d('0x40')]=function(_0x155d1b,_0x39af79){for(var _0x51999a in _0x39af79){if(_0x155d1b[_0x5a1d('0x27')](_0x51999a)){_0x155d1b[_0x51999a]=_0x39af79[_0x51999a];}}};Realtime[_0x5a1d('0x3f')]['initAgents']=function(){var _0x23906d=this;return function(_0x456d67){if(_0x456d67){freeIsNotKeyAgent(_0x456d67,_0x23906d['agents']);for(var _0x31f02f=0x0,_0x430f49={},_0x507ae1={};_0x31f02f<_0x456d67[_0x5a1d('0x41')];_0x31f02f+=0x1){_0x430f49=_0x456d67[_0x31f02f];var _0x3c8966=_['isNil'](_0x430f49['interface'])?util['format'](_0x5a1d('0x29'),_0x430f49[_0x5a1d('0x2a')]):_0x430f49[_0x5a1d('0x2b')];if(_['isUndefined'](_0x23906d[_0x5a1d('0x13')][_0x3c8966])){_0x23906d[_0x5a1d('0x13')][_0x3c8966]=new Agent(_0x430f49);}else{_0x23906d[_0x5a1d('0x40')](_0x23906d[_0x5a1d('0x13')][_0x3c8966],_0x430f49);}}}return _0x23906d[_0x5a1d('0x13')];};};Realtime[_0x5a1d('0x3f')]['initTelephones']=function(){var _0x1c317a=this;return function(_0x5bc5ef){if(_0x5bc5ef){freeIsNotKeySip(_0x5bc5ef,_0x1c317a[_0x5a1d('0x14')]);for(var _0x59d7bd=0x0,_0x14af7d={},_0x54b5a3={};_0x59d7bd<_0x5bc5ef[_0x5a1d('0x41')];_0x59d7bd+=0x1){_0x14af7d=_0x5bc5ef[_0x59d7bd];if(_[_0x5a1d('0x42')](_0x1c317a['telephones'][util['format'](_0x5a1d('0x29'),_0x14af7d[_0x5a1d('0x2a')])])){_0x1c317a[_0x5a1d('0x14')][util[_0x5a1d('0x28')](_0x5a1d('0x29'),_0x14af7d[_0x5a1d('0x2a')])]=new Telephone(_0x14af7d);}else{_0x1c317a[_0x5a1d('0x40')](_0x1c317a[_0x5a1d('0x14')][util[_0x5a1d('0x28')](_0x5a1d('0x29'),_0x14af7d[_0x5a1d('0x2a')])],_0x14af7d);}}}return _0x1c317a[_0x5a1d('0x14')];};};Realtime[_0x5a1d('0x3f')]['initTrunks']=function(){var _0x3d9cf2=this;return function(_0x4f4c36){if(_0x4f4c36){freeIsNotKeySip(_0x4f4c36,_0x3d9cf2[_0x5a1d('0x43')]);for(var _0xe6a9b3=0x0,_0x254f69={},_0x35b2f3={};_0xe6a9b3<_0x4f4c36[_0x5a1d('0x41')];_0xe6a9b3+=0x1){_0x254f69=_0x4f4c36[_0xe6a9b3];if(_[_0x5a1d('0x42')](_0x3d9cf2[_0x5a1d('0x43')][util[_0x5a1d('0x28')]('SIP/%s',_0x254f69['name'])])){_0x3d9cf2[_0x5a1d('0x43')][util[_0x5a1d('0x28')]('SIP/%s',_0x254f69[_0x5a1d('0x2a')])]=new Trunk(_0x254f69);}else{_0x3d9cf2[_0x5a1d('0x40')](_0x3d9cf2['trunks'][util[_0x5a1d('0x28')](_0x5a1d('0x29'),_0x254f69[_0x5a1d('0x2a')])],_0x254f69);}}}return _0x3d9cf2['trunks'];};};Realtime[_0x5a1d('0x3f')][_0x5a1d('0x44')]=function(){var _0xe15114=this;return function(_0x3e6033){if(_0x3e6033){freeIsNotKey(_0x3e6033,_0xe15114['voiceQueues'],'name');for(var _0x9407e2=0x0,_0x1039c5={},_0x5a4520={};_0x9407e2<_0x3e6033[_0x5a1d('0x41')];_0x9407e2+=0x1){_0x1039c5=_0x3e6033[_0x9407e2];if(_[_0x5a1d('0x42')](_0xe15114[_0x5a1d('0x15')][_0x1039c5[_0x5a1d('0x2a')]])){_0xe15114['voiceQueues'][_0x1039c5['name']]=new VoiceQueue(_0x1039c5);}else{_0xe15114[_0x5a1d('0x40')](_0xe15114[_0x5a1d('0x15')][_0x1039c5[_0x5a1d('0x2a')]],_0x1039c5);}}}return _0xe15114[_0x5a1d('0x15')];};};Realtime[_0x5a1d('0x3f')][_0x5a1d('0x45')]=function(){var _0x2c0b9e=this;return function(_0x7b3b76){if(_0x7b3b76){freeIsNotKey(_0x7b3b76,_0x2c0b9e[_0x5a1d('0x16')],'id');for(var _0x5baab3=0x0,_0x5a4a81={},_0x2cd3ae={};_0x5baab3<_0x7b3b76['length'];_0x5baab3+=0x1){_0x5a4a81=_0x7b3b76[_0x5baab3];if(_[_0x5a1d('0x42')](_0x2c0b9e[_0x5a1d('0x16')][_0x5a4a81['id']])){_0x2c0b9e['triggers'][_0x5a4a81['id']]=new Trigger(_0x5a4a81);}else{_0x2c0b9e[_0x5a1d('0x40')](_0x2c0b9e[_0x5a1d('0x16')][_0x5a4a81['id']],_0x5a4a81);}}}return _0x2c0b9e['triggers'];};};Realtime[_0x5a1d('0x3f')]['initTemplates']=function(){var _0x2b41a9=this;return function(_0x5ca79f){if(_0x5ca79f){freeIsNotKey(_0x5ca79f,_0x2b41a9['templates'],'id');for(var _0xee593e=0x0,_0x367d6b={},_0x2c4048={};_0xee593e<_0x5ca79f['length'];_0xee593e+=0x1){_0x367d6b=_0x5ca79f[_0xee593e];if(_[_0x5a1d('0x42')](_0x2b41a9[_0x5a1d('0x18')][_0x367d6b['id']])){_0x2b41a9['templates'][_0x367d6b['id']]=new Template(_0x367d6b);}else{_0x2b41a9[_0x5a1d('0x40')](_0x2b41a9['templates'][_0x367d6b['id']],_0x367d6b);}}}return _0x2b41a9[_0x5a1d('0x18')];};};Realtime[_0x5a1d('0x3f')][_0x5a1d('0x46')]=function(){var _0x4537df=this;return function(_0xd16187){if(_0xd16187){freeIsNotKey(_0xd16187,_0x4537df[_0x5a1d('0x1e')],'id');for(var _0x254125=0x0,_0x2699f8={},_0xfa33f9={};_0x254125<_0xd16187[_0x5a1d('0x41')];_0x254125+=0x1){_0x2699f8=_0xd16187[_0x254125];if(_[_0x5a1d('0x42')](_0x4537df[_0x5a1d('0x1e')][_0x2699f8['id']])){_0x4537df[_0x5a1d('0x1e')][_0x2699f8['id']]=new ZendeskAccount(_0x2699f8);}else{_0x4537df['mergeFromDatabase'](_0x4537df[_0x5a1d('0x1e')][_0x2699f8['id']],_0x2699f8);}}}return _0x4537df[_0x5a1d('0x1e')];};};Realtime[_0x5a1d('0x3f')][_0x5a1d('0x47')]=function(){var _0x152403=this;return function(_0x3d3494){if(_0x3d3494){freeIsNotKey(_0x3d3494,_0x152403[_0x5a1d('0x1f')],'id');for(var _0x5360d6=0x0,_0x238b89={},_0xd4ae6a={};_0x5360d6<_0x3d3494['length'];_0x5360d6+=0x1){_0x238b89=_0x3d3494[_0x5360d6];if(_[_0x5a1d('0x42')](_0x152403[_0x5a1d('0x1f')][_0x238b89['id']])){_0x152403[_0x5a1d('0x1f')][_0x238b89['id']]=new SalesforceAccount(_0x238b89);}else{_0x152403[_0x5a1d('0x40')](_0x152403[_0x5a1d('0x1f')][_0x238b89['id']],_0x238b89);}}}return _0x152403[_0x5a1d('0x1f')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x12077c=this;return function(_0x59025f){if(_0x59025f){freeIsNotKey(_0x59025f,_0x12077c[_0x5a1d('0x20')],'id');for(var _0x56ddcb=0x0,_0x364242={},_0x97a003={};_0x56ddcb<_0x59025f[_0x5a1d('0x41')];_0x56ddcb+=0x1){_0x364242=_0x59025f[_0x56ddcb];if(_[_0x5a1d('0x42')](_0x12077c[_0x5a1d('0x20')][_0x364242['id']])){_0x12077c[_0x5a1d('0x20')][_0x364242['id']]=new FreshdeskAccount(_0x364242);}else{_0x12077c['mergeFromDatabase'](_0x12077c[_0x5a1d('0x20')][_0x364242['id']],_0x364242);}}}return _0x12077c[_0x5a1d('0x20')];};};Realtime[_0x5a1d('0x3f')][_0x5a1d('0x48')]=function(){var _0x1c9a69=this;return function(_0x13e3a4){if(_0x13e3a4){freeIsNotKey(_0x13e3a4,_0x1c9a69[_0x5a1d('0x21')],'id');for(var _0x2c98e6=0x0,_0xd54a7f={},_0x2bb8bf={};_0x2c98e6<_0x13e3a4[_0x5a1d('0x41')];_0x2c98e6+=0x1){_0xd54a7f=_0x13e3a4[_0x2c98e6];if(_[_0x5a1d('0x42')](_0x1c9a69['zohoAccounts'][_0xd54a7f['id']])){_0x1c9a69[_0x5a1d('0x21')][_0xd54a7f['id']]=new ZohoAccount(_0xd54a7f);}else{_0x1c9a69['mergeFromDatabase'](_0x1c9a69[_0x5a1d('0x21')][_0xd54a7f['id']],_0xd54a7f);}}}return _0x1c9a69[_0x5a1d('0x21')];};};Realtime[_0x5a1d('0x3f')][_0x5a1d('0x49')]=function(){var _0x43c006=this;return function(_0x1f2e10){if(_0x1f2e10){freeIsNotKey(_0x1f2e10,_0x43c006[_0x5a1d('0x22')],'id');for(var _0x37e584=0x0,_0x3ec01b={},_0x3e0efc={};_0x37e584<_0x1f2e10[_0x5a1d('0x41')];_0x37e584+=0x1){_0x3ec01b=_0x1f2e10[_0x37e584];if(_[_0x5a1d('0x42')](_0x43c006[_0x5a1d('0x22')][_0x3ec01b['id']])){_0x43c006[_0x5a1d('0x22')][_0x3ec01b['id']]=new DeskAccount(_0x3ec01b);}else{_0x43c006['mergeFromDatabase'](_0x43c006[_0x5a1d('0x22')][_0x3ec01b['id']],_0x3ec01b);}}}return _0x43c006[_0x5a1d('0x22')];};};Realtime[_0x5a1d('0x3f')][_0x5a1d('0x4a')]=function(){var _0x2560dc=this;return function(_0x543e6b){if(_0x543e6b){freeIsNotKey(_0x543e6b,_0x2560dc[_0x5a1d('0x4b')],'id');for(var _0x83bcdb=0x0,_0x8ad9a2={},_0x3d94f7={};_0x83bcdb<_0x543e6b[_0x5a1d('0x41')];_0x83bcdb+=0x1){_0x8ad9a2=_0x543e6b[_0x83bcdb];if(_[_0x5a1d('0x42')](_0x2560dc[_0x5a1d('0x4b')][_0x8ad9a2['id']])){_0x2560dc[_0x5a1d('0x4b')][_0x8ad9a2['id']]=new SugarcrmAccount(_0x8ad9a2);}else{_0x2560dc['mergeFromDatabase'](_0x2560dc['sugarcrmAccounts'][_0x8ad9a2['id']],_0x8ad9a2);}}}return _0x2560dc['sugarcrmAccounts'];};};Realtime[_0x5a1d('0x3f')][_0x5a1d('0x4c')]=function(){var _0x529be9=this;return function(_0x29e751){if(_0x29e751){freeIsNotKey(_0x29e751,_0x529be9['vtigerAccounts'],'id');for(var _0x7e5bac=0x0,_0x14c548={},_0x79ecc0={};_0x7e5bac<_0x29e751[_0x5a1d('0x41')];_0x7e5bac+=0x1){_0x14c548=_0x29e751[_0x7e5bac];if(_[_0x5a1d('0x42')](_0x529be9[_0x5a1d('0x23')][_0x14c548['id']])){_0x529be9[_0x5a1d('0x23')][_0x14c548['id']]=new VtigerAccount(_0x14c548);}else{_0x529be9[_0x5a1d('0x40')](_0x529be9['vtigerAccounts'][_0x14c548['id']],_0x14c548);}}}return _0x529be9[_0x5a1d('0x23')];};};Realtime['prototype'][_0x5a1d('0x4d')]=function(){var _0x53654b=this;return function(_0x55be75){if(_0x55be75){freeIsNotKey(_0x55be75,_0x53654b['servicenowAccounts'],'id');for(var _0x4aeb97=0x0,_0x48389e={},_0x414613={};_0x4aeb97<_0x55be75['length'];_0x4aeb97+=0x1){_0x48389e=_0x55be75[_0x4aeb97];if(_['isUndefined'](_0x53654b[_0x5a1d('0x4e')][_0x48389e['id']])){_0x53654b[_0x5a1d('0x4e')][_0x48389e['id']]=new ServicenowAccount(_0x48389e);}else{_0x53654b[_0x5a1d('0x40')](_0x53654b[_0x5a1d('0x4e')][_0x48389e['id']],_0x48389e);}}}return _0x53654b[_0x5a1d('0x4e')];};};Realtime[_0x5a1d('0x3f')][_0x5a1d('0x4f')]=function(){var _0x3d3064=this;return function(_0x2657c9){if(_0x2657c9){freeIsNotKey(_0x2657c9,_0x3d3064[_0x5a1d('0x24')],'id');for(var _0x30afa6=0x0,_0x4cd07e={},_0x4deb1f={};_0x30afa6<_0x2657c9['length'];_0x30afa6+=0x1){_0x4cd07e=_0x2657c9[_0x30afa6];if(_[_0x5a1d('0x42')](_0x3d3064['dynamics365Accounts'][_0x4cd07e['id']])){_0x3d3064[_0x5a1d('0x24')][_0x4cd07e['id']]=new Dynamics365Account(_0x4cd07e);}else{_0x3d3064[_0x5a1d('0x40')](_0x3d3064[_0x5a1d('0x24')][_0x4cd07e['id']],_0x4cd07e);}}}return _0x3d3064[_0x5a1d('0x24')];};};Realtime['prototype'][_0x5a1d('0x50')]=function(){var _0x536328=this;return function(_0x4f816c){if(_0x4f816c){freeIsNotKey(_0x4f816c,_0x536328['freshsalesAccounts'],'id');for(var _0x47c53b=0x0,_0x5d47dd={},_0x9bdebf={};_0x47c53b<_0x4f816c[_0x5a1d('0x41')];_0x47c53b+=0x1){_0x5d47dd=_0x4f816c[_0x47c53b];if(_[_0x5a1d('0x42')](_0x536328['freshsalesAccounts'][_0x5d47dd['id']])){_0x536328[_0x5a1d('0x51')][_0x5d47dd['id']]=new FreshsalesAccount(_0x5d47dd);}else{_0x536328[_0x5a1d('0x40')](_0x536328[_0x5a1d('0x51')][_0x5d47dd['id']],_0x5d47dd);}}}return _0x536328[_0x5a1d('0x51')];};};Realtime[_0x5a1d('0x3f')][_0x5a1d('0x52')]=function(){var _0x48d497=this;return function(_0x385c31){for(var _0xffcd14=0x0;_0xffcd14<_0x385c31[_0x5a1d('0x41')];_0xffcd14+=0x1){_[_0x5a1d('0x53')](_0x48d497[_0x5a1d('0x15')][_0x385c31[_0xffcd14]['name']],_0x385c31[_0xffcd14]);}return _0x48d497[_0x5a1d('0x15')];};};Realtime[_0x5a1d('0x3f')][_0x5a1d('0x54')]=function(){var _0x203eee=this;return function(_0x5acbed){clearVoiceQueues(_0x203eee['voiceQueues']);if(_0x5acbed){_0x5acbed=_[_0x5a1d('0x55')](_0x5acbed,_0x5a1d('0x56'));for(var _0x4932c9 in _0x5acbed){if(_0x5acbed[_0x5a1d('0x27')](_0x4932c9)){var _0x5880e0={};for(var _0x602b79=0x0;_0x602b79<_0x5acbed[_0x4932c9][_0x5a1d('0x41')];_0x602b79+=0x1){var _0xc2cdf2=_0x5acbed[_0x4932c9][_0x602b79][_0x5a1d('0x57')];if(_0x203eee[_0x5a1d('0x15')][_0xc2cdf2]){if(_0x5acbed[_0x4932c9][_0x602b79][_0x5a1d('0x58')]){_0x203eee[_0x5a1d('0x15')][_0xc2cdf2]['unmanaged']+=0x1;}if(_0x5acbed[_0x4932c9][_0x602b79][_0x5a1d('0x59')]){_0x203eee[_0x5a1d('0x15')][_0xc2cdf2][_0x5a1d('0x34')]+=0x1;}_0x203eee[_0x5a1d('0x15')][_0xc2cdf2][_0x5a1d('0x2e')]+=moment(_0x5acbed[_0x4932c9][_0x602b79]['queuecallerleaveAt'])[_0x5a1d('0x5a')](moment(_0x5acbed[_0x4932c9][_0x602b79][_0x5a1d('0x5b')]),_0x5a1d('0x5c'))||0x0;if(_0x602b79===_0x5acbed[_0x4932c9]['length']-0x1){_0x203eee[_0x5a1d('0x15')][_0xc2cdf2]['sumDuration']+=moment(_0x5acbed[_0x4932c9][_0x602b79][_0x5a1d('0x5d')]||_0x5acbed[_0x4932c9][_0x602b79][_0x5a1d('0x5e')]||_0x5acbed[_0x4932c9][_0x602b79][_0x5a1d('0x5f')])[_0x5a1d('0x5a')](moment(_0x5acbed[_0x4932c9][_0x602b79][_0x5a1d('0x5b')]),'seconds')||0x0;_0x203eee['voiceQueues'][_0xc2cdf2][_0x5a1d('0x2c')]+=0x1;if(_0x5acbed[_0x4932c9][_0x602b79][_0x5a1d('0x60')]){_0x203eee['voiceQueues'][_0xc2cdf2][_0x5a1d('0x2d')]+=0x1;_0x203eee[_0x5a1d('0x15')][_0xc2cdf2][_0x5a1d('0x30')]+=moment(_0x5acbed[_0x4932c9][_0x602b79][_0x5a1d('0x5d')])[_0x5a1d('0x5a')](moment(_0x5acbed[_0x4932c9][_0x602b79][_0x5a1d('0x61')]),_0x5a1d('0x5c'))||0x0;}}else{_0x203eee[_0x5a1d('0x15')][_0xc2cdf2][_0x5a1d('0x2f')]+=_0x203eee['voiceQueues'][_0xc2cdf2][_0x5a1d('0x2e')]||0x0;}}}}}}return _0x203eee[_0x5a1d('0x15')];};};Realtime[_0x5a1d('0x3f')][_0x5a1d('0x62')]=function(){var _0x75c501=this;return function(_0x5da8ef){clearVoiceCallReports(_0x75c501[_0x5a1d('0x63')]);if(_0x5da8ef){for(var _0x580365=0x0;_0x580365<_0x5da8ef[_0x5a1d('0x41')];_0x580365+=0x1){_0x75c501[_0x5a1d('0x63')][_0x5a1d('0x2c')]+=0x1;_0x75c501['outbound']['sumDuration']+=_0x5da8ef[_0x580365][_0x5a1d('0x64')];if(_0x5da8ef[_0x580365]['disposition']==='ANSWERED'){_0x75c501[_0x5a1d('0x63')][_0x5a1d('0x2d')]+=0x1;_0x75c501['outbound'][_0x5a1d('0x2e')]+=_0x5da8ef[_0x580365][_0x5a1d('0x64')]-_0x5da8ef[_0x580365][_0x5a1d('0x65')]||0x0;_0x75c501[_0x5a1d('0x63')]['sumBillable']+=_0x5da8ef[_0x580365][_0x5a1d('0x65')];}}}return _0x75c501[_0x5a1d('0x63')];};};Realtime[_0x5a1d('0x3f')][_0x5a1d('0x66')]=function(){var _0x3c1c85=this;return function(_0x11b906){if(_0x11b906){freeIsNotKey(_0x11b906,_0x3c1c85[_0x5a1d('0x17')],'name');for(var _0x4ef9cc=0x0,_0xfacc90={};_0x4ef9cc<_0x11b906[_0x5a1d('0x41')];_0x4ef9cc+=0x1){_0xfacc90=_0x11b906[_0x4ef9cc];if(_[_0x5a1d('0x42')](_0x3c1c85[_0x5a1d('0x17')][_0xfacc90[_0x5a1d('0x2a')]])){_0x3c1c85[_0x5a1d('0x17')][_0xfacc90[_0x5a1d('0x2a')]]=new Campaign(_0xfacc90);}else{_0x3c1c85[_0x5a1d('0x40')](_0x3c1c85[_0x5a1d('0x17')][_0xfacc90[_0x5a1d('0x2a')]],_0xfacc90);_0x3c1c85[_0x5a1d('0x17')][_0xfacc90[_0x5a1d('0x2a')]]['dialQueueProject']=_0xfacc90[_0x5a1d('0x67')]?_0xfacc90[_0x5a1d('0x67')][_0x5a1d('0x2a')]:undefined;}}}return _0x3c1c85['campaigns'];};};Realtime['prototype'][_0x5a1d('0x68')]=function(){var _0x749282=this;return function(_0x9dedd8){if(_0x9dedd8){freeIsNotKey(_0x9dedd8,_0x749282['voiceExtensions'],'id');for(var _0x442292=0x0,_0x5da6bf={};_0x442292<_0x9dedd8[_0x5a1d('0x41')];_0x442292+=0x1){_0x5da6bf=_0x9dedd8[_0x442292];if(_['isUndefined'](_0x749282[_0x5a1d('0x19')][_0x5da6bf['id']])){_0x749282[_0x5a1d('0x19')][_0x5da6bf['id']]=new VoiceExtension(_0x5da6bf);}else{_0x749282['mergeFromDatabase'](_0x749282[_0x5a1d('0x19')][_0x5da6bf['id']],_0x5da6bf);}}}return _0x749282[_0x5a1d('0x19')];};};Realtime[_0x5a1d('0x3f')][_0x5a1d('0x69')]=function(){var _0x56d9db=this;return function(_0x33ddf6){clearCampaigns(_0x56d9db['campaigns']);for(var _0x417851=0x0;_0x417851<_0x33ddf6['length'];_0x417851+=0x1){_['merge'](_0x56d9db['campaigns'][_0x33ddf6[_0x417851]['name']],_0x33ddf6[_0x417851]);}return _0x56d9db['campaigns'];};};Realtime['prototype'][_0x5a1d('0x6a')]=function(){var _0x1bbcde=this;return function(_0x5a937e){if(_0x5a937e){freeIsNotKey(_0x5a937e,_0x1bbcde[_0x5a1d('0x25')],'id');for(var _0x36adc0=0x0,_0x5a3a66={},_0x325ee4={};_0x36adc0<_0x5a937e[_0x5a1d('0x41')];_0x36adc0+=0x1){_0x5a3a66=_0x5a937e[_0x36adc0];if(_[_0x5a1d('0x42')](_0x1bbcde[_0x5a1d('0x25')][_0x5a3a66['id']])){_0x1bbcde['faxAccounts'][_0x5a3a66['id']]=new FaxAccount(_0x5a3a66);}else{_0x1bbcde[_0x5a1d('0x40')](_0x1bbcde[_0x5a1d('0x25')][_0x5a3a66['id']],_0x5a3a66);}}}return _0x1bbcde[_0x5a1d('0x25')];};};module[_0x5a1d('0x6b')]=Realtime; \ No newline at end of file +var _0xaf00=['length','isUndefined','initTelephones','telephones','initTrunks','voiceQueues','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts','servicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','queuecallerleaveAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallerjoinAt','queuecallercomplete','initVoiceCallReports','ANSWERED','duration','billableseconds','SquareProject','initVoiceExtensions','initFaxAccounts','exports','bluebird','util','lodash','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','trunks','triggers','campaigns','templates','outbound','voiceExtensions','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','answered','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase'];(function(_0x61711c,_0x5b2962){var _0x4cf0e9=function(_0x179352){while(--_0x179352){_0x61711c['push'](_0x61711c['shift']());}};_0x4cf0e9(++_0x5b2962);}(_0xaf00,0x8f));var _0x0af0=function(_0x495e9f,_0x1b1d80){_0x495e9f=_0x495e9f-0x0;var _0xb249d2=_0xaf00[_0x495e9f];return _0xb249d2;};'use strict';var BPromise=require(_0x0af0('0x0'));var util=require(_0x0af0('0x1'));var _=require(_0x0af0('0x2'));var moment=require('moment');var Agent=require(_0x0af0('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x0af0('0x4'));var VoiceQueue=require(_0x0af0('0x5'));var Trigger=require(_0x0af0('0x6'));var Template=require(_0x0af0('0x7'));var Campaign=require(_0x0af0('0x8'));var VoiceExtension=require(_0x0af0('0x9'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x0af0('0xa'));var SugarcrmAccount=require(_0x0af0('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0x0af0('0xc'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0x0af0('0xd'));var Dynamics365Account=require(_0x0af0('0xe'));var FreshsalesAccount=require(_0x0af0('0xf'));var FaxAccount=require(_0x0af0('0x10'));var Realtime=function(){this[_0x0af0('0x11')]={};this['telephones']={};this[_0x0af0('0x12')]={};this['voiceQueues']={};this[_0x0af0('0x13')]={};this[_0x0af0('0x14')]={};this[_0x0af0('0x15')]={};this[_0x0af0('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x0af0('0x17')]={};this['channels']={};this['queueChannels']={};this[_0x0af0('0x18')]={};this[_0x0af0('0x19')]={};this[_0x0af0('0x1a')]={};this[_0x0af0('0x1b')]={};this[_0x0af0('0x1c')]={};this[_0x0af0('0x1d')]={};this[_0x0af0('0x1e')]={};this[_0x0af0('0x1f')]={};this['deskAccounts']={};this[_0x0af0('0x20')]={};this['servicenowAccounts']={};this[_0x0af0('0x21')]={};this[_0x0af0('0x22')]={};this[_0x0af0('0x23')]={};};function freeIsNotKey(_0x2cde3f,_0x51f466,_0x52fcc0){var _0x1950e9=_[_0x0af0('0x24')](_0x2cde3f,function(_0xdadc2a,_0x2ba3b3){return _0xdadc2a[_0x52fcc0];});for(var _0x549cee in _0x51f466){if(_0x51f466[_0x0af0('0x25')](_0x549cee)){if(!_0x1950e9[_0x549cee]){delete _0x51f466[_0x549cee];}}}}function freeIsNotKeySip(_0x4c05ce,_0x4e2820){var _0x4b2a2b=_[_0x0af0('0x24')](_0x4c05ce,function(_0x3ae482,_0x2c83b2){return util[_0x0af0('0x26')](_0x0af0('0x27'),_0x3ae482[_0x0af0('0x28')]);});for(var _0x3f62ac in _0x4e2820){if(_0x4e2820[_0x0af0('0x25')](_0x3f62ac)){if(!_0x4b2a2b[_0x3f62ac]){delete _0x4e2820[_0x3f62ac];}}}}function freeIsNotKeyAgent(_0x1a7b75,_0xe36ba1){var _0x4a31ef=_[_0x0af0('0x24')](_0x1a7b75,function(_0x5e4cd3,_0x4e9afb){var _0x1d8694=_[_0x0af0('0x29')](_0x5e4cd3[_0x0af0('0x2a')])?util['format'](_0x0af0('0x27'),_0x5e4cd3[_0x0af0('0x28')]):_0x5e4cd3[_0x0af0('0x2a')];return _0x1d8694;});for(var _0x3888c4 in _0xe36ba1){if(_0xe36ba1[_0x0af0('0x25')](_0x3888c4)){if(!_0x4a31ef[_0x3888c4]){delete _0xe36ba1[_0x3888c4];}}}}function clearVoiceCallReports(_0x2711a0){_0x2711a0[_0x0af0('0x2b')]=0x0;_0x2711a0['answered']=0x0;_0x2711a0[_0x0af0('0x2c')]=0x0;_0x2711a0[_0x0af0('0x2d')]=0x0;_0x2711a0[_0x0af0('0x2e')]=0x0;}function clearCampaigns(_0x2243f3){if(!_[_0x0af0('0x2f')](_0x2243f3)){for(var _0x29c1f5 in _0x2243f3){if(_0x2243f3['hasOwnProperty'](_0x29c1f5)){_0x2243f3[_0x29c1f5][_0x0af0('0x30')]=0x0;_0x2243f3[_0x29c1f5][_0x0af0('0x31')]=0x0;}}}}function clearVoiceQueues(_0x5228af){if(!_[_0x0af0('0x2f')](_0x5228af)){for(var _0x18e0a4 in _0x5228af){if(_0x5228af[_0x0af0('0x25')](_0x18e0a4)){_0x5228af[_0x18e0a4][_0x0af0('0x2b')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x32')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x33')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x34')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x2c')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x2d')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x2e')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x35')]=0x0;_0x5228af[_0x18e0a4]['outboundNoAnswerCallsDay']=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x36')]=0x0;_0x5228af[_0x18e0a4]['outboundCongestionCallsDay']=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x37')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x38')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x39')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x3a')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x3b')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x3c')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x3d')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x3e')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x35')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x3f')]=0x0;_0x5228af[_0x18e0a4][_0x0af0('0x40')]=!![];}}}}Realtime[_0x0af0('0x41')][_0x0af0('0x42')]=function(_0x237e8e,_0x4c1495){for(var _0x903889 in _0x4c1495){if(_0x237e8e[_0x0af0('0x25')](_0x903889)){_0x237e8e[_0x903889]=_0x4c1495[_0x903889];}}};Realtime[_0x0af0('0x41')]['initAgents']=function(){var _0x2f7c4c=this;return function(_0x41d031){if(_0x41d031){freeIsNotKeyAgent(_0x41d031,_0x2f7c4c['agents']);for(var _0x4cf1da=0x0,_0x2df2d9={},_0x172f93={};_0x4cf1da<_0x41d031[_0x0af0('0x43')];_0x4cf1da+=0x1){_0x2df2d9=_0x41d031[_0x4cf1da];var _0x1db0c2=_[_0x0af0('0x29')](_0x2df2d9[_0x0af0('0x2a')])?util['format'](_0x0af0('0x27'),_0x2df2d9[_0x0af0('0x28')]):_0x2df2d9[_0x0af0('0x2a')];if(_[_0x0af0('0x44')](_0x2f7c4c[_0x0af0('0x11')][_0x1db0c2])){_0x2f7c4c[_0x0af0('0x11')][_0x1db0c2]=new Agent(_0x2df2d9);}else{_0x2f7c4c[_0x0af0('0x42')](_0x2f7c4c[_0x0af0('0x11')][_0x1db0c2],_0x2df2d9);}}}return _0x2f7c4c['agents'];};};Realtime[_0x0af0('0x41')][_0x0af0('0x45')]=function(){var _0x282538=this;return function(_0x326a6a){if(_0x326a6a){freeIsNotKeySip(_0x326a6a,_0x282538[_0x0af0('0x46')]);for(var _0x5bf9f3=0x0,_0x2b2e47={},_0x641b0={};_0x5bf9f3<_0x326a6a['length'];_0x5bf9f3+=0x1){_0x2b2e47=_0x326a6a[_0x5bf9f3];if(_[_0x0af0('0x44')](_0x282538['telephones'][util[_0x0af0('0x26')](_0x0af0('0x27'),_0x2b2e47[_0x0af0('0x28')])])){_0x282538[_0x0af0('0x46')][util[_0x0af0('0x26')]('SIP/%s',_0x2b2e47[_0x0af0('0x28')])]=new Telephone(_0x2b2e47);}else{_0x282538['mergeFromDatabase'](_0x282538[_0x0af0('0x46')][util[_0x0af0('0x26')]('SIP/%s',_0x2b2e47[_0x0af0('0x28')])],_0x2b2e47);}}}return _0x282538['telephones'];};};Realtime['prototype'][_0x0af0('0x47')]=function(){var _0x388c9c=this;return function(_0x1bf1e0){if(_0x1bf1e0){freeIsNotKeySip(_0x1bf1e0,_0x388c9c[_0x0af0('0x12')]);for(var _0x283252=0x0,_0x15e266={},_0x53a304={};_0x283252<_0x1bf1e0['length'];_0x283252+=0x1){_0x15e266=_0x1bf1e0[_0x283252];if(_[_0x0af0('0x44')](_0x388c9c[_0x0af0('0x12')][util['format']('SIP/%s',_0x15e266['name'])])){_0x388c9c[_0x0af0('0x12')][util[_0x0af0('0x26')]('SIP/%s',_0x15e266[_0x0af0('0x28')])]=new Trunk(_0x15e266);}else{_0x388c9c[_0x0af0('0x42')](_0x388c9c[_0x0af0('0x12')][util[_0x0af0('0x26')]('SIP/%s',_0x15e266['name'])],_0x15e266);}}}return _0x388c9c[_0x0af0('0x12')];};};Realtime[_0x0af0('0x41')]['initVoiceQueues']=function(){var _0x4b9030=this;return function(_0x3bf52d){if(_0x3bf52d){freeIsNotKey(_0x3bf52d,_0x4b9030['voiceQueues'],_0x0af0('0x28'));for(var _0x95a1e1=0x0,_0xd1f372={},_0x455620={};_0x95a1e1<_0x3bf52d[_0x0af0('0x43')];_0x95a1e1+=0x1){_0xd1f372=_0x3bf52d[_0x95a1e1];if(_[_0x0af0('0x44')](_0x4b9030[_0x0af0('0x48')][_0xd1f372[_0x0af0('0x28')]])){_0x4b9030[_0x0af0('0x48')][_0xd1f372[_0x0af0('0x28')]]=new VoiceQueue(_0xd1f372);}else{_0x4b9030[_0x0af0('0x42')](_0x4b9030['voiceQueues'][_0xd1f372[_0x0af0('0x28')]],_0xd1f372);}}}return _0x4b9030[_0x0af0('0x48')];};};Realtime[_0x0af0('0x41')]['initTriggers']=function(){var _0xba4fc9=this;return function(_0x45b5d9){if(_0x45b5d9){freeIsNotKey(_0x45b5d9,_0xba4fc9[_0x0af0('0x13')],'id');for(var _0x55a532=0x0,_0x2fac16={},_0x1ae9d3={};_0x55a532<_0x45b5d9[_0x0af0('0x43')];_0x55a532+=0x1){_0x2fac16=_0x45b5d9[_0x55a532];if(_['isUndefined'](_0xba4fc9['triggers'][_0x2fac16['id']])){_0xba4fc9[_0x0af0('0x13')][_0x2fac16['id']]=new Trigger(_0x2fac16);}else{_0xba4fc9[_0x0af0('0x42')](_0xba4fc9['triggers'][_0x2fac16['id']],_0x2fac16);}}}return _0xba4fc9[_0x0af0('0x13')];};};Realtime['prototype'][_0x0af0('0x49')]=function(){var _0x301db1=this;return function(_0x4af083){if(_0x4af083){freeIsNotKey(_0x4af083,_0x301db1[_0x0af0('0x15')],'id');for(var _0x5ad84f=0x0,_0x5712a4={},_0x1cfa89={};_0x5ad84f<_0x4af083[_0x0af0('0x43')];_0x5ad84f+=0x1){_0x5712a4=_0x4af083[_0x5ad84f];if(_[_0x0af0('0x44')](_0x301db1[_0x0af0('0x15')][_0x5712a4['id']])){_0x301db1['templates'][_0x5712a4['id']]=new Template(_0x5712a4);}else{_0x301db1['mergeFromDatabase'](_0x301db1[_0x0af0('0x15')][_0x5712a4['id']],_0x5712a4);}}}return _0x301db1[_0x0af0('0x15')];};};Realtime[_0x0af0('0x41')][_0x0af0('0x4a')]=function(){var _0x5c1cde=this;return function(_0x52b84b){if(_0x52b84b){freeIsNotKey(_0x52b84b,_0x5c1cde[_0x0af0('0x1b')],'id');for(var _0x1d13dc=0x0,_0x5e946b={},_0xfddd2a={};_0x1d13dc<_0x52b84b['length'];_0x1d13dc+=0x1){_0x5e946b=_0x52b84b[_0x1d13dc];if(_[_0x0af0('0x44')](_0x5c1cde[_0x0af0('0x1b')][_0x5e946b['id']])){_0x5c1cde[_0x0af0('0x1b')][_0x5e946b['id']]=new ZendeskAccount(_0x5e946b);}else{_0x5c1cde['mergeFromDatabase'](_0x5c1cde[_0x0af0('0x1b')][_0x5e946b['id']],_0x5e946b);}}}return _0x5c1cde['zendeskAccounts'];};};Realtime[_0x0af0('0x41')][_0x0af0('0x4b')]=function(){var _0x525001=this;return function(_0x44e41b){if(_0x44e41b){freeIsNotKey(_0x44e41b,_0x525001[_0x0af0('0x1c')],'id');for(var _0x29f20d=0x0,_0x428579={},_0x43beee={};_0x29f20d<_0x44e41b[_0x0af0('0x43')];_0x29f20d+=0x1){_0x428579=_0x44e41b[_0x29f20d];if(_[_0x0af0('0x44')](_0x525001[_0x0af0('0x1c')][_0x428579['id']])){_0x525001[_0x0af0('0x1c')][_0x428579['id']]=new SalesforceAccount(_0x428579);}else{_0x525001[_0x0af0('0x42')](_0x525001['salesforceAccounts'][_0x428579['id']],_0x428579);}}}return _0x525001[_0x0af0('0x1c')];};};Realtime[_0x0af0('0x41')][_0x0af0('0x4c')]=function(){var _0x23f14c=this;return function(_0x7ae8e7){if(_0x7ae8e7){freeIsNotKey(_0x7ae8e7,_0x23f14c[_0x0af0('0x1e')],'id');for(var _0x45c250=0x0,_0x581ebb={},_0xb60e55={};_0x45c250<_0x7ae8e7[_0x0af0('0x43')];_0x45c250+=0x1){_0x581ebb=_0x7ae8e7[_0x45c250];if(_[_0x0af0('0x44')](_0x23f14c[_0x0af0('0x1e')][_0x581ebb['id']])){_0x23f14c[_0x0af0('0x1e')][_0x581ebb['id']]=new FreshdeskAccount(_0x581ebb);}else{_0x23f14c[_0x0af0('0x42')](_0x23f14c[_0x0af0('0x1e')][_0x581ebb['id']],_0x581ebb);}}}return _0x23f14c[_0x0af0('0x1e')];};};Realtime[_0x0af0('0x41')]['initZohoAccounts']=function(){var _0x58084e=this;return function(_0x4a8ee8){if(_0x4a8ee8){freeIsNotKey(_0x4a8ee8,_0x58084e[_0x0af0('0x1f')],'id');for(var _0x24b4da=0x0,_0x110d28={},_0xdc50e0={};_0x24b4da<_0x4a8ee8['length'];_0x24b4da+=0x1){_0x110d28=_0x4a8ee8[_0x24b4da];if(_[_0x0af0('0x44')](_0x58084e[_0x0af0('0x1f')][_0x110d28['id']])){_0x58084e['zohoAccounts'][_0x110d28['id']]=new ZohoAccount(_0x110d28);}else{_0x58084e[_0x0af0('0x42')](_0x58084e[_0x0af0('0x1f')][_0x110d28['id']],_0x110d28);}}}return _0x58084e[_0x0af0('0x1f')];};};Realtime[_0x0af0('0x41')][_0x0af0('0x4d')]=function(){var _0x4a6a1e=this;return function(_0x5cf0b7){if(_0x5cf0b7){freeIsNotKey(_0x5cf0b7,_0x4a6a1e[_0x0af0('0x4e')],'id');for(var _0x603fcf=0x0,_0x4e138e={},_0x1a33b5={};_0x603fcf<_0x5cf0b7[_0x0af0('0x43')];_0x603fcf+=0x1){_0x4e138e=_0x5cf0b7[_0x603fcf];if(_['isUndefined'](_0x4a6a1e['deskAccounts'][_0x4e138e['id']])){_0x4a6a1e[_0x0af0('0x4e')][_0x4e138e['id']]=new DeskAccount(_0x4e138e);}else{_0x4a6a1e[_0x0af0('0x42')](_0x4a6a1e[_0x0af0('0x4e')][_0x4e138e['id']],_0x4e138e);}}}return _0x4a6a1e[_0x0af0('0x4e')];};};Realtime[_0x0af0('0x41')][_0x0af0('0x4f')]=function(){var _0x577969=this;return function(_0x438398){if(_0x438398){freeIsNotKey(_0x438398,_0x577969[_0x0af0('0x1d')],'id');for(var _0xf1d28b=0x0,_0x5ee7c0={},_0x5c2752={};_0xf1d28b<_0x438398[_0x0af0('0x43')];_0xf1d28b+=0x1){_0x5ee7c0=_0x438398[_0xf1d28b];if(_[_0x0af0('0x44')](_0x577969[_0x0af0('0x1d')][_0x5ee7c0['id']])){_0x577969[_0x0af0('0x1d')][_0x5ee7c0['id']]=new SugarcrmAccount(_0x5ee7c0);}else{_0x577969[_0x0af0('0x42')](_0x577969[_0x0af0('0x1d')][_0x5ee7c0['id']],_0x5ee7c0);}}}return _0x577969[_0x0af0('0x1d')];};};Realtime[_0x0af0('0x41')][_0x0af0('0x50')]=function(){var _0x116f36=this;return function(_0x151eeb){if(_0x151eeb){freeIsNotKey(_0x151eeb,_0x116f36[_0x0af0('0x20')],'id');for(var _0x7d6a2=0x0,_0x180d3e={},_0x30a3c1={};_0x7d6a2<_0x151eeb[_0x0af0('0x43')];_0x7d6a2+=0x1){_0x180d3e=_0x151eeb[_0x7d6a2];if(_[_0x0af0('0x44')](_0x116f36[_0x0af0('0x20')][_0x180d3e['id']])){_0x116f36[_0x0af0('0x20')][_0x180d3e['id']]=new VtigerAccount(_0x180d3e);}else{_0x116f36[_0x0af0('0x42')](_0x116f36[_0x0af0('0x20')][_0x180d3e['id']],_0x180d3e);}}}return _0x116f36[_0x0af0('0x20')];};};Realtime[_0x0af0('0x41')]['initServicenowAccounts']=function(){var _0x1bfb63=this;return function(_0x373a36){if(_0x373a36){freeIsNotKey(_0x373a36,_0x1bfb63[_0x0af0('0x51')],'id');for(var _0x24be96=0x0,_0x46dcf8={},_0x182af1={};_0x24be96<_0x373a36[_0x0af0('0x43')];_0x24be96+=0x1){_0x46dcf8=_0x373a36[_0x24be96];if(_['isUndefined'](_0x1bfb63[_0x0af0('0x51')][_0x46dcf8['id']])){_0x1bfb63['servicenowAccounts'][_0x46dcf8['id']]=new ServicenowAccount(_0x46dcf8);}else{_0x1bfb63[_0x0af0('0x42')](_0x1bfb63['servicenowAccounts'][_0x46dcf8['id']],_0x46dcf8);}}}return _0x1bfb63['servicenowAccounts'];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x2ff5c6=this;return function(_0x1d5696){if(_0x1d5696){freeIsNotKey(_0x1d5696,_0x2ff5c6[_0x0af0('0x21')],'id');for(var _0x80e039=0x0,_0x4df4da={},_0x27e702={};_0x80e039<_0x1d5696[_0x0af0('0x43')];_0x80e039+=0x1){_0x4df4da=_0x1d5696[_0x80e039];if(_[_0x0af0('0x44')](_0x2ff5c6[_0x0af0('0x21')][_0x4df4da['id']])){_0x2ff5c6[_0x0af0('0x21')][_0x4df4da['id']]=new Dynamics365Account(_0x4df4da);}else{_0x2ff5c6[_0x0af0('0x42')](_0x2ff5c6[_0x0af0('0x21')][_0x4df4da['id']],_0x4df4da);}}}return _0x2ff5c6[_0x0af0('0x21')];};};Realtime[_0x0af0('0x41')][_0x0af0('0x52')]=function(){var _0x2f9b4b=this;return function(_0xe3d919){if(_0xe3d919){freeIsNotKey(_0xe3d919,_0x2f9b4b[_0x0af0('0x22')],'id');for(var _0x49ca9e=0x0,_0x499088={},_0x393034={};_0x49ca9e<_0xe3d919[_0x0af0('0x43')];_0x49ca9e+=0x1){_0x499088=_0xe3d919[_0x49ca9e];if(_[_0x0af0('0x44')](_0x2f9b4b[_0x0af0('0x22')][_0x499088['id']])){_0x2f9b4b[_0x0af0('0x22')][_0x499088['id']]=new FreshsalesAccount(_0x499088);}else{_0x2f9b4b[_0x0af0('0x42')](_0x2f9b4b[_0x0af0('0x22')][_0x499088['id']],_0x499088);}}}return _0x2f9b4b[_0x0af0('0x22')];};};Realtime[_0x0af0('0x41')][_0x0af0('0x53')]=function(){var _0xc2de46=this;return function(_0x25621c){for(var _0x43336a=0x0;_0x43336a<_0x25621c[_0x0af0('0x43')];_0x43336a+=0x1){_[_0x0af0('0x54')](_0xc2de46[_0x0af0('0x48')][_0x25621c[_0x43336a]['name']],_0x25621c[_0x43336a]);}return _0xc2de46['voiceQueues'];};};Realtime[_0x0af0('0x41')][_0x0af0('0x55')]=function(){var _0x31a1ab=this;return function(_0x1f39b3){clearVoiceQueues(_0x31a1ab[_0x0af0('0x48')]);if(_0x1f39b3){_0x1f39b3=_[_0x0af0('0x56')](_0x1f39b3,'uniqueid');for(var _0x3d340a in _0x1f39b3){if(_0x1f39b3['hasOwnProperty'](_0x3d340a)){var _0x545742={};for(var _0x1f16a3=0x0;_0x1f16a3<_0x1f39b3[_0x3d340a]['length'];_0x1f16a3+=0x1){var _0x19921f=_0x1f39b3[_0x3d340a][_0x1f16a3][_0x0af0('0x57')];if(_0x31a1ab[_0x0af0('0x48')][_0x19921f]){if(_0x1f39b3[_0x3d340a][_0x1f16a3]['queuecallerexit']){_0x31a1ab['voiceQueues'][_0x19921f]['unmanaged']+=0x1;}if(_0x1f39b3[_0x3d340a][_0x1f16a3][_0x0af0('0x58')]){_0x31a1ab[_0x0af0('0x48')][_0x19921f]['abandoned']+=0x1;}_0x31a1ab['voiceQueues'][_0x19921f][_0x0af0('0x2c')]+=moment(_0x1f39b3[_0x3d340a][_0x1f16a3][_0x0af0('0x59')])['diff'](moment(_0x1f39b3[_0x3d340a][_0x1f16a3]['queuecallerjoinAt']),_0x0af0('0x5a'))||0x0;if(_0x1f16a3===_0x1f39b3[_0x3d340a][_0x0af0('0x43')]-0x1){_0x31a1ab[_0x0af0('0x48')][_0x19921f]['sumDuration']+=moment(_0x1f39b3[_0x3d340a][_0x1f16a3][_0x0af0('0x5b')]||_0x1f39b3[_0x3d340a][_0x1f16a3][_0x0af0('0x5c')]||_0x1f39b3[_0x3d340a][_0x1f16a3][_0x0af0('0x5d')])[_0x0af0('0x5e')](moment(_0x1f39b3[_0x3d340a][_0x1f16a3][_0x0af0('0x5f')]),'seconds')||0x0;_0x31a1ab[_0x0af0('0x48')][_0x19921f]['total']+=0x1;if(_0x1f39b3[_0x3d340a][_0x1f16a3][_0x0af0('0x60')]){_0x31a1ab[_0x0af0('0x48')][_0x19921f][_0x0af0('0x32')]+=0x1;_0x31a1ab['voiceQueues'][_0x19921f][_0x0af0('0x2e')]+=moment(_0x1f39b3[_0x3d340a][_0x1f16a3][_0x0af0('0x5b')])['diff'](moment(_0x1f39b3[_0x3d340a][_0x1f16a3]['queuecallerleaveAt']),_0x0af0('0x5a'))||0x0;}}else{_0x31a1ab[_0x0af0('0x48')][_0x19921f]['sumDuration']+=_0x31a1ab[_0x0af0('0x48')][_0x19921f][_0x0af0('0x2c')]||0x0;}}}}}}return _0x31a1ab[_0x0af0('0x48')];};};Realtime[_0x0af0('0x41')][_0x0af0('0x61')]=function(){var _0x18a1f1=this;return function(_0xa684c2){clearVoiceCallReports(_0x18a1f1['outbound']);if(_0xa684c2){for(var _0x570e73=0x0;_0x570e73<_0xa684c2[_0x0af0('0x43')];_0x570e73+=0x1){_0x18a1f1['outbound'][_0x0af0('0x2b')]+=0x1;_0x18a1f1[_0x0af0('0x16')][_0x0af0('0x2d')]+=_0xa684c2[_0x570e73]['duration'];if(_0xa684c2[_0x570e73]['disposition']===_0x0af0('0x62')){_0x18a1f1[_0x0af0('0x16')]['answered']+=0x1;_0x18a1f1[_0x0af0('0x16')][_0x0af0('0x2c')]+=_0xa684c2[_0x570e73][_0x0af0('0x63')]-_0xa684c2[_0x570e73][_0x0af0('0x64')]||0x0;_0x18a1f1[_0x0af0('0x16')][_0x0af0('0x2e')]+=_0xa684c2[_0x570e73][_0x0af0('0x64')];}}}return _0x18a1f1['outbound'];};};Realtime[_0x0af0('0x41')]['initCampaigns']=function(){var _0x26cbca=this;return function(_0x2ed0ef){if(_0x2ed0ef){freeIsNotKey(_0x2ed0ef,_0x26cbca[_0x0af0('0x14')],_0x0af0('0x28'));for(var _0x2c980d=0x0,_0x5e8cf1={};_0x2c980d<_0x2ed0ef[_0x0af0('0x43')];_0x2c980d+=0x1){_0x5e8cf1=_0x2ed0ef[_0x2c980d];if(_[_0x0af0('0x44')](_0x26cbca[_0x0af0('0x14')][_0x5e8cf1[_0x0af0('0x28')]])){_0x26cbca[_0x0af0('0x14')][_0x5e8cf1['name']]=new Campaign(_0x5e8cf1);}else{_0x26cbca['mergeFromDatabase'](_0x26cbca['campaigns'][_0x5e8cf1['name']],_0x5e8cf1);_0x26cbca[_0x0af0('0x14')][_0x5e8cf1[_0x0af0('0x28')]]['dialQueueProject']=_0x5e8cf1[_0x0af0('0x65')]?_0x5e8cf1[_0x0af0('0x65')]['name']:undefined;}}}return _0x26cbca['campaigns'];};};Realtime[_0x0af0('0x41')][_0x0af0('0x66')]=function(){var _0x5be1f7=this;return function(_0x5280e5){if(_0x5280e5){freeIsNotKey(_0x5280e5,_0x5be1f7[_0x0af0('0x17')],'id');for(var _0x3ec149=0x0,_0x221d6b={};_0x3ec149<_0x5280e5[_0x0af0('0x43')];_0x3ec149+=0x1){_0x221d6b=_0x5280e5[_0x3ec149];if(_[_0x0af0('0x44')](_0x5be1f7[_0x0af0('0x17')][_0x221d6b['id']])){_0x5be1f7[_0x0af0('0x17')][_0x221d6b['id']]=new VoiceExtension(_0x221d6b);}else{_0x5be1f7[_0x0af0('0x42')](_0x5be1f7[_0x0af0('0x17')][_0x221d6b['id']],_0x221d6b);}}}return _0x5be1f7['voiceExtensions'];};};Realtime[_0x0af0('0x41')]['initCampaignHopperHistory']=function(){var _0x46e212=this;return function(_0x1e3b5a){clearCampaigns(_0x46e212[_0x0af0('0x14')]);for(var _0x20358e=0x0;_0x20358e<_0x1e3b5a[_0x0af0('0x43')];_0x20358e+=0x1){_['merge'](_0x46e212[_0x0af0('0x14')][_0x1e3b5a[_0x20358e][_0x0af0('0x28')]],_0x1e3b5a[_0x20358e]);}return _0x46e212[_0x0af0('0x14')];};};Realtime[_0x0af0('0x41')][_0x0af0('0x67')]=function(){var _0x239b8b=this;return function(_0x26600d){if(_0x26600d){freeIsNotKey(_0x26600d,_0x239b8b['faxAccounts'],'id');for(var _0x5570ce=0x0,_0x45d879={},_0x5459f4={};_0x5570ce<_0x26600d[_0x0af0('0x43')];_0x5570ce+=0x1){_0x45d879=_0x26600d[_0x5570ce];if(_[_0x0af0('0x44')](_0x239b8b[_0x0af0('0x23')][_0x45d879['id']])){_0x239b8b['faxAccounts'][_0x45d879['id']]=new FaxAccount(_0x45d879);}else{_0x239b8b[_0x0af0('0x42')](_0x239b8b[_0x0af0('0x23')][_0x45d879['id']],_0x45d879);}}}return _0x239b8b[_0x0af0('0x23')];};};module[_0x0af0('0x68')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 0f8e74d..f47e111 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 _0xd8c5=['../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','findAgent','find','accountcode','name','interface','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','isNil','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','voiceQueueReport','create','match','getAgentByInternal','keys','getCallType','channel','calleridnum','outbound','internal','destination','exten','dialer','queue','lastdata','from-voip-provider','context','from-sip','xcally-motion-preview','calleridpreview','destinationchannel','callerid','originatecalleridnum','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','blindTransfer','type','split','membername','monitorFilename','monitors','filename','createdAt','connectedlinename','isArray','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','attendedTransfer','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport'];(function(_0x2e0bed,_0x24b28d){var _0x45e74e=function(_0x36166d){while(--_0x36166d){_0x2e0bed['push'](_0x2e0bed['shift']());}};_0x45e74e(++_0x24b28d);}(_0xd8c5,0x1c8));var _0x5d8c=function(_0x13a815,_0x47dc54){_0x13a815=_0x13a815-0x0;var _0x53d6ab=_0xd8c5[_0x13a815];return _0x53d6ab;};'use strict';var _=require(_0x5d8c('0x0'));var moment=require(_0x5d8c('0x1'));var util=require(_0x5d8c('0x2'));var config=require(_0x5d8c('0x3'));var ami=require(_0x5d8c('0x4'));var RpcVoiceAgentReport=require(_0x5d8c('0x5'));var RpcVoiceCallReport=require(_0x5d8c('0x6'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x5d8c('0x7'));var RpcVoiceQueueReport=require(_0x5d8c('0x8'));var RpcVoiceRecording=require(_0x5d8c('0x9'));var RpcVoiceTransferReport=require(_0x5d8c('0xa'));var VoiceQueueReport=require(_0x5d8c('0xb'));var VoiceCallReport=require(_0x5d8c('0xc'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x5d8c('0xd'));var UserReport=require(_0x5d8c('0xe'));function Report(_0x2e15d5){this[_0x5d8c('0xf')]=_0x2e15d5;this[_0x5d8c('0x10')]=_0x2e15d5[_0x5d8c('0x10')];this[_0x5d8c('0x11')]=_0x2e15d5['telephones'];}Report[_0x5d8c('0x12')][_0x5d8c('0x13')]=function(_0x3a29a8){var _0x9774e1=new VoiceQueueReport(this['realtime']);var _0x108e7b=new VoiceAgentReport(this[_0x5d8c('0xf')]);var _0x18f6b1=new VoiceDialReport(this['realtime']);var _0x34cf32=new VoiceCallReport(this[_0x5d8c('0xf')]);var _0x271c48=new UserReport(this[_0x5d8c('0xf')]);if(config[_0x5d8c('0x14')]&&config['xdr']['disabled']){ami['on'](_0x5d8c('0x15'),this['voiceQueueReport'][_0x5d8c('0x16')](this));ami['on'](_0x5d8c('0x17'),this[_0x5d8c('0x18')][_0x5d8c('0x16')](this));ami['on'](_0x5d8c('0x19'),this[_0x5d8c('0x1a')]['bind'](this));ami['on'](_0x5d8c('0x1b'),this[_0x5d8c('0x1c')][_0x5d8c('0x16')](this));ami['on'](_0x5d8c('0x1d'),this['blindTransfer'][_0x5d8c('0x16')](this));ami['on']('attendedtransfer',this['attendedTransfer'][_0x5d8c('0x16')](this));}};Report['prototype'][_0x5d8c('0x1e')]=function(_0x437f0e){var _0x58829e;_0x58829e=_[_0x5d8c('0x1f')](this[_0x5d8c('0x10')],function(_0x1795de){return _0x1795de[_0x5d8c('0x20')]==_0x437f0e||_0x1795de['name']==_0x437f0e;});if(_['isNil'](_0x58829e)){var _0x2c3a80=_[_0x5d8c('0x1f')](this[_0x5d8c('0x11')],function(_0x250eb8){return _0x250eb8[_0x5d8c('0x20')]==_0x437f0e||_0x250eb8[_0x5d8c('0x21')]==_0x437f0e;});if(_0x2c3a80){_0x58829e=_['find'](this['agents'],function(_0x279eea){return _0x279eea[_0x5d8c('0x22')]==util[_0x5d8c('0x23')](_0x5d8c('0x24'),_0x2c3a80[_0x5d8c('0x21')]);});}}return _0x58829e;};Report['prototype']['voiceQueueReport']=function(_0x1c145d){for(var _0x19b2a4=0x0;_0x19b2a4<_0x1c145d[_0x5d8c('0x25')];_0x19b2a4+=0x1){var _0x423d34=this['findAgent'](_0x1c145d[_0x19b2a4][_0x5d8c('0x26')]);if(_0x423d34){_0x1c145d[_0x19b2a4][_0x5d8c('0x20')]=_0x423d34[_0x5d8c('0x20')];_0x1c145d[_0x19b2a4][_0x5d8c('0x27')]=!![];_0x1c145d[_0x19b2a4][_0x5d8c('0x28')]=_0x423d34['name'];_0x1c145d[_0x19b2a4][_0x5d8c('0x22')]=_[_0x5d8c('0x29')](_0x423d34[_0x5d8c('0x22')])?util[_0x5d8c('0x23')](_0x5d8c('0x24'),_0x423d34[_0x5d8c('0x21')]):_0x423d34[_0x5d8c('0x22')];if(_0x1c145d[_0x19b2a4][_0x5d8c('0x2a')]){_0x1c145d[_0x19b2a4][_0x5d8c('0x2b')]=moment()[_0x5d8c('0x23')](_0x5d8c('0x2c'));}if(_0x1c145d[_0x19b2a4]['queuecallerexit']){_0x1c145d[_0x19b2a4][_0x5d8c('0x2d')]=moment()[_0x5d8c('0x23')](_0x5d8c('0x2c'));}RpcMemberReport[_0x5d8c('0x2e')](_0x1c145d[_0x19b2a4]);}RpcVoiceQueueReport[_0x5d8c('0x2f')](_0x1c145d[_0x19b2a4]);}};function extractCalleridNumber(_0x2e207c){var _0x4a4ea8=_0x2e207c[_0x5d8c('0x30')](/<(.*?)>/);return _0x4a4ea8?_0x4a4ea8[0x1]:_0x2e207c;}Report[_0x5d8c('0x12')][_0x5d8c('0x31')]=function(_0x23f8b8){for(var _0x19147f=0x0;_0x19147f','calleridname','linkedid','transfers','transfereelinkedid','uniqueid','UserId','membername','monitor'];(function(_0x3a846e,_0x5bbd99){var _0x14c089=function(_0x46ae0d){while(--_0x46ae0d){_0x3a846e['push'](_0x3a846e['shift']());}};_0x14c089(++_0x5bbd99);}(_0x835c,0x1e1));var _0xc835=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x835c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc835('0x0'));var moment=require(_0xc835('0x1'));var util=require(_0xc835('0x2'));var config=require(_0xc835('0x3'));var ami=require(_0xc835('0x4'));var RpcVoiceAgentReport=require(_0xc835('0x5'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xc835('0x6'));var RpcMemberReport=require(_0xc835('0x7'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0xc835('0x8'));var VoiceQueueReport=require(_0xc835('0x9'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xc835('0xa'));var VoiceDialReport=require(_0xc835('0xb'));var UserReport=require(_0xc835('0xc'));function Report(_0x2f1a89){this[_0xc835('0xd')]=_0x2f1a89;this['agents']=_0x2f1a89[_0xc835('0xe')];this[_0xc835('0xf')]=_0x2f1a89[_0xc835('0xf')];}Report[_0xc835('0x10')]['sync']=function(_0x2aa124){var _0x14d1af=new VoiceQueueReport(this[_0xc835('0xd')]);var _0x5c9ba7=new VoiceAgentReport(this[_0xc835('0xd')]);var _0x2c7bfb=new VoiceDialReport(this[_0xc835('0xd')]);var _0x315d3c=new VoiceCallReport(this[_0xc835('0xd')]);var _0x1355b8=new UserReport(this[_0xc835('0xd')]);if(config[_0xc835('0x11')]&&config[_0xc835('0x11')][_0xc835('0x12')]){ami['on']('custom:voiceQueueReport',this[_0xc835('0x13')][_0xc835('0x14')](this));ami['on'](_0xc835('0x15'),this[_0xc835('0x16')][_0xc835('0x14')](this));ami['on']('custom:voiceAgentReport',this[_0xc835('0x17')][_0xc835('0x14')](this));ami['on'](_0xc835('0x18'),this[_0xc835('0x19')][_0xc835('0x14')](this));ami['on'](_0xc835('0x1a'),this[_0xc835('0x1b')][_0xc835('0x14')](this));ami['on']('attendedtransfer',this[_0xc835('0x1c')][_0xc835('0x14')](this));}};Report[_0xc835('0x10')][_0xc835('0x1d')]=function(_0x1a69e9){var _0x2a8ac1;_0x2a8ac1=_['find'](this[_0xc835('0xe')],function(_0x53ed13){return _0x53ed13[_0xc835('0x1e')]==_0x1a69e9||_0x53ed13[_0xc835('0x1f')]==_0x1a69e9;});if(_[_0xc835('0x20')](_0x2a8ac1)){var _0x368b21=_['find'](this[_0xc835('0xf')],function(_0x3e6551){return _0x3e6551[_0xc835('0x1e')]==_0x1a69e9||_0x3e6551['name']==_0x1a69e9;});if(_0x368b21){_0x2a8ac1=_[_0xc835('0x21')](this[_0xc835('0xe')],function(_0x1cd5d2){return _0x1cd5d2[_0xc835('0x22')]==util[_0xc835('0x23')]('SIP/%s',_0x368b21['name']);});}}return _0x2a8ac1;};Report[_0xc835('0x10')][_0xc835('0x13')]=function(_0x43a8ab){for(var _0x4029e2=0x0;_0x4029e2<_0x43a8ab[_0xc835('0x24')];_0x4029e2+=0x1){var _0x2cbe91=this[_0xc835('0x1d')](_0x43a8ab[_0x4029e2][_0xc835('0x25')]);if(_0x2cbe91){_0x43a8ab[_0x4029e2][_0xc835('0x1e')]=_0x2cbe91[_0xc835('0x1e')];_0x43a8ab[_0x4029e2][_0xc835('0x26')]=!![];_0x43a8ab[_0x4029e2][_0xc835('0x27')]=_0x2cbe91['name'];_0x43a8ab[_0x4029e2]['interface']=_[_0xc835('0x20')](_0x2cbe91[_0xc835('0x22')])?util[_0xc835('0x23')](_0xc835('0x28'),_0x2cbe91[_0xc835('0x1f')]):_0x2cbe91[_0xc835('0x22')];if(_0x43a8ab[_0x4029e2][_0xc835('0x29')]){_0x43a8ab[_0x4029e2][_0xc835('0x2a')]=moment()[_0xc835('0x23')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x43a8ab[_0x4029e2][_0xc835('0x2b')]){_0x43a8ab[_0x4029e2]['queuecallerexitAt']=moment()[_0xc835('0x23')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xc835('0x13')](_0x43a8ab[_0x4029e2]);}RpcVoiceQueueReport[_0xc835('0x2c')](_0x43a8ab[_0x4029e2]);}};function extractCalleridNumber(_0x33e7bf){var _0x1dfe87=_0x33e7bf[_0xc835('0x2d')](/<(.*?)>/);return _0x1dfe87?_0x1dfe87[0x1]:_0x33e7bf;}Report[_0xc835('0x10')][_0xc835('0x2e')]=function(_0x331351){for(var _0x1b8c57=0x0;_0x1b8c570x0?_0x37aa70:0x0;this[_0x3330('0x15')][_0x27d449[_0x3330('0x68')]][_0x3330('0x34')]=this[_0x3330('0x15')][_0x27d449[_0x3330('0x68')]]['talking']>_[_0x3330('0x6d')](_0x27d449[_0x3330('0x6e')])?_[_0x3330('0x6d')](_0x27d449[_0x3330('0x6e')]):this[_0x3330('0x15')][_0x27d449['queue']][_0x3330('0x34')];this['emitVoiceQueueSummary'](this[_0x3330('0x15')][_0x27d449[_0x3330('0x68')]],'queuesummary');}logger[_0x3330('0x46')](_0x3330('0x70'),util['inspect'](this[_0x3330('0x15')][_0x27d449[_0x3330('0x68')]],{'showHidden':![],'depth':null}));ami[_0x3330('0x45')](_0x3330('0x71'),this[_0x3330('0x15')][_0x27d449[_0x3330('0x68')]]);}}}catch(_0x590c2d){logger[_0x3330('0x3e')](_0x3330('0x66'),util['inspect'](_0x590c2d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3330('0xd')]['syncQueueSummaryComplete']=function(_0x41f610){logger[_0x3330('0x46')](_0x3330('0x72'),util['inspect'](_0x41f610,{'showHidden':![],'depth':null}));this[_0x3330('0x65')]=!![];};VoiceQueueReport[_0x3330('0xd')][_0x3330('0x1d')]=function(_0x2da907){try{if(this[_0x3330('0x67')](_0x2da907)){logger[_0x3330('0x46')](_0x3330('0x73'),_0x2da907[_0x3330('0x49')],util[_0x3330('0x40')](_0x2da907,{'showHidden':![],'depth':null}));if(_[_0x3330('0x61')](this['queueReports'][_0x2da907[_0x3330('0x49')]]))this[_0x3330('0x12')][_0x2da907[_0x3330('0x49')]]=[];if(_['isUndefined'](this[_0x3330('0x14')][_0x2da907[_0x3330('0x49')]]))this['channels'][_0x2da907[_0x3330('0x49')]]={};var _0x3fe751=new QueueReport();_0x3fe751[_0x3330('0x4c')]=_0x2da907[_0x3330('0x68')];_0x3fe751[_0x3330('0x50')]=this['voiceQueues'][_0x3fe751[_0x3330('0x4c')]]&&this['voiceQueues'][_0x3fe751['name']][_0x3330('0x50')]?this['voiceQueues'][_0x3fe751[_0x3330('0x4c')]][_0x3330('0x50')]||'inbound':_0x3330('0x74');_0x3fe751[_0x3330('0x68')]=_0x2da907['queue'];_0x3fe751[_0x3330('0x75')]=moment()[_0x3330('0x4a')](_0x3330('0x76'));_0x3fe751[_0x3330('0x77')]=_0x2da907[_0x3330('0x77')];_0x3fe751[_0x3330('0x78')]=_0x2da907[_0x3330('0x78')];_0x3fe751[_0x3330('0x49')]=_0x2da907['uniqueid'];_0x3fe751['routealias']=this[_0x3330('0x14')][_0x2da907['uniqueid']][_0x3330('0x79')];logger[_0x3330('0x6a')](_0x3330('0x7a'),_0x3fe751[_0x3330('0x4c')],_0x3fe751[_0x3330('0x50')]);_['merge'](_0x3fe751,_['pick'](_0x2da907,_[_0x3330('0x7b')](_0x3fe751)));this['queueReports'][_0x2da907['uniqueid']][_0x3330('0x7c')](_0x3fe751);this[_0x3330('0x14')][_0x2da907['uniqueid']]=_0x3fe751;this['emitVoiceQueueChannelSave'](_0x3fe751,_0x3330('0x1c'));}}catch(_0x393172){logger[_0x3330('0x3e')]('[%s][voiceQueueReport][queuecallerjoin]',_0x2da907[_0x3330('0x49')],util[_0x3330('0x40')](_0x393172,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3330('0x1f')]=function(_0x137002){try{if(this[_0x3330('0x67')](_0x137002)){logger[_0x3330('0x46')]('[%s][voiceQueueReport][queuecallerabandon]',_0x137002[_0x3330('0x49')],util['inspect'](_0x137002,{'showHidden':![],'depth':null}));if(this[_0x3330('0x12')][_0x137002['uniqueid']]){var _0x18ce7b=_[_0x3330('0x7d')](this[_0x3330('0x12')][_0x137002[_0x3330('0x49')]]);_0x18ce7b[_0x3330('0x7e')]=![];_0x18ce7b[_0x3330('0x7f')]=null;_0x18ce7b[_0x3330('0x80')]=_0x137002['holdtime'];_0x18ce7b[_0x3330('0x81')]=_0x137002[_0x3330('0x81')];_0x18ce7b['queuecallerabandon']=!![];_0x18ce7b[_0x3330('0x82')]=moment()[_0x3330('0x4a')](_0x3330('0x76'));_0x18ce7b[_0x3330('0x83')]='ABANDONED';_0x18ce7b[_0x3330('0x84')]=null;logger['info'](_0x3330('0x85'),_0x18ce7b['name'],_0x18ce7b[_0x3330('0x50')]);this[_0x3330('0x14')][_0x137002['uniqueid']]=_0x18ce7b;this[_0x3330('0x43')](_0x18ce7b,_0x3330('0x1e'));}}}catch(_0x3d7e56){logger[_0x3330('0x3e')](_0x3330('0x86'),_0x137002[_0x3330('0x49')],util[_0x3330('0x40')](_0x3d7e56,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3330('0x20')]=function(_0x519244){try{if(this[_0x3330('0x67')](_0x519244)){logger['debug'](_0x3330('0x87'),_0x519244[_0x3330('0x49')],util[_0x3330('0x40')](_0x519244,{'showHidden':![],'depth':null}));if(this[_0x3330('0x12')][_0x519244[_0x3330('0x49')]]){var _0x532ffc=_[_0x3330('0x7d')](this[_0x3330('0x12')][_0x519244[_0x3330('0x49')]]);_0x532ffc[_0x3330('0x88')]=moment()[_0x3330('0x4a')](_0x3330('0x76'));_0x532ffc[_0x3330('0x89')]=_0x519244[_0x3330('0x89')];_0x532ffc[_0x3330('0x8a')]=_0x519244[_0x3330('0x8a')];logger[_0x3330('0x6a')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x532ffc[_0x3330('0x4c')],_0x532ffc[_0x3330('0x50')],_0x519244[_0x3330('0x89')],_0x519244[_0x3330('0x8a')]);this[_0x3330('0x14')][_0x519244['uniqueid']]=_0x532ffc;this[_0x3330('0x8b')](_0x532ffc,_0x3330('0x8c'));}}}catch(_0x16f328){logger[_0x3330('0x3e')]('[%s][voiceQueueReport][queuecallerleave]',_0x519244[_0x3330('0x49')],util[_0x3330('0x40')](_0x16f328,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3330('0x24')]=function(_0x41e236){try{if(this['isNotNull'](_0x41e236)){logger[_0x3330('0x46')](_0x3330('0x8d'),_0x41e236[_0x3330('0x49')],util[_0x3330('0x40')](_0x41e236,{'showHidden':![],'depth':null}));if(this[_0x3330('0x12')][_0x41e236['uniqueid']]){var _0x39d3bc=_[_0x3330('0x7d')](this[_0x3330('0x12')][_0x41e236[_0x3330('0x49')]]);_0x39d3bc[_0x3330('0x7e')]=!![];_0x39d3bc[_0x3330('0x83')]=_0x3330('0x8e');logger[_0x3330('0x6a')](_0x3330('0x8f'),_0x39d3bc[_0x3330('0x4c')],_0x39d3bc[_0x3330('0x50')]);}}}catch(_0x18f6c3){logger[_0x3330('0x3e')](_0x3330('0x8d'),_0x41e236[_0x3330('0x49')],util[_0x3330('0x40')](_0x18f6c3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3330('0xd')][_0x3330('0x22')]=function(_0x4c8d2c){try{if(this[_0x3330('0x67')](_0x4c8d2c)){logger[_0x3330('0x46')]('[%s][voiceQueueReport][agentcomplete]',_0x4c8d2c['uniqueid'],util['inspect'](_0x4c8d2c,{'showHidden':![],'depth':null}));if(this[_0x3330('0x12')][_0x4c8d2c[_0x3330('0x49')]]){var _0x333ad9=_[_0x3330('0x7d')](this['queueReports'][_0x4c8d2c[_0x3330('0x49')]]);_0x333ad9['queuecallerabandon']=![];_0x333ad9[_0x3330('0x82')]=null;_0x333ad9[_0x3330('0x90')]=!![];_0x333ad9[_0x3330('0x84')]=_0x4c8d2c[_0x3330('0x91')];_0x333ad9[_0x3330('0x80')]=_0x4c8d2c[_0x3330('0x80')];_0x333ad9[_0x3330('0x7e')]=!![];_0x333ad9['queuecallerexit']=![];_0x333ad9[_0x3330('0x92')]=null;if(!_0x333ad9['transfer']){if(_0x4c8d2c[_0x3330('0x93')]==_0x3330('0x94')){_0x333ad9[_0x3330('0x83')]='COMPLETED';logger[_0x3330('0x6a')](_0x3330('0x95'),_0x333ad9[_0x3330('0x4c')],_0x333ad9[_0x3330('0x50')]);}else{if(_[_0x3330('0x96')](_0x4c8d2c[_0x3330('0x3b')][_0x3330('0x97')](),_0x3330('0x98'))){if(this[_0x3330('0x12')][_0x4c8d2c[_0x3330('0x99')]]){var _0x1ec196=_[_0x3330('0x7d')](this[_0x3330('0x12')][_0x4c8d2c['linkedid']]);_0x1ec196[_0x3330('0x7e')]=![];_0x1ec196[_0x3330('0x9a')]=!![];_0x1ec196['queuecallerexitAt']=moment(_0x333ad9[_0x3330('0x75')])[_0x3330('0x9b')](_0x4c8d2c[_0x3330('0x80')],_0x3330('0x9c'))[_0x3330('0x4a')](_0x3330('0x76'));_0x1ec196[_0x3330('0x83')]='FORWARDTRANSFER';_0x1ec196[_0x3330('0x94')]=!![];_0x1ec196[_0x3330('0x9d')]='FORWARD';_0x1ec196[_0x3330('0x9e')]=_0x4c8d2c['destexten'];_0x1ec196[_0x3330('0x9f')]=_0x4c8d2c[_0x3330('0x49')];logger[_0x3330('0x6a')](_0x3330('0xa0'),_0x1ec196[_0x3330('0x4c')],_0x1ec196[_0x3330('0x50')]);var _0x10bbdb=this[_0x3330('0x12')][_0x4c8d2c[_0x3330('0x99')]];this['queueReports'][_0x4c8d2c['linkedid']]=this[_0x3330('0x12')][_0x4c8d2c[_0x3330('0x49')]];this[_0x3330('0x12')][_0x4c8d2c[_0x3330('0x49')]]=_0x10bbdb;}}else{_0x333ad9[_0x3330('0x83')]='COMPLETEDBY'+_0x4c8d2c[_0x3330('0x93')][_0x3330('0xa1')]();logger[_0x3330('0x6a')](_0x3330('0xa2'),_0x333ad9[_0x3330('0x4c')],_0x333ad9[_0x3330('0x50')],_0x333ad9[_0x3330('0x83')]);}}}this[_0x3330('0x14')][_0x4c8d2c[_0x3330('0x49')]]=_0x333ad9;this['emitVoiceQueueChannelRemove'](_0x333ad9,_0x3330('0x21'));}}}catch(_0x577c95){logger[_0x3330('0x3e')](_0x3330('0xa3'),_0x4c8d2c[_0x3330('0x49')],util[_0x3330('0x40')](_0x577c95,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3330('0xd')][_0x3330('0xa4')]=function(_0x19031d){try{if(this[_0x3330('0x67')](_0x19031d)){logger[_0x3330('0x46')](_0x3330('0xa5'),_0x19031d[_0x3330('0x49')],util['inspect'](_0x19031d,{'showHidden':![],'depth':null}));this[_0x3330('0xa6')](_0x19031d['uniqueid'],_[_0x3330('0x7b')](_0x19031d[_0x3330('0xa7')])[0x0],_0x19031d['value']);if(this[_0x3330('0x12')][_0x19031d[_0x3330('0x49')]]){var _0x2988dd=_['last'](this[_0x3330('0x12')][_0x19031d[_0x3330('0x49')]]);if(_0x2988dd){if(this[_0x3330('0x67')](_0x19031d['variable'])&&this[_0x3330('0x67')](_0x19031d[_0x3330('0xa7')][_0x3330('0xa8')])){switch(_0x19031d[_0x3330('0xa9')]){case _0x3330('0xaa'):_0x2988dd[_0x3330('0x9a')]=![];_0x2988dd[_0x3330('0x92')]=null;break;case _0x3330('0xab'):_0x2988dd[_0x3330('0xac')]=_0x3330('0xad');_0x2988dd[_0x3330('0x9a')]=!![];_0x2988dd[_0x3330('0x92')]=moment()[_0x3330('0x4a')](_0x3330('0x76'));_0x2988dd[_0x3330('0x88')]=moment()[_0x3330('0x4a')](_0x3330('0x76'));logger['debug'](_0x3330('0xae'),_0x19031d[_0x3330('0x49')],util[_0x3330('0x40')](_0x2988dd,{'showHidden':![],'depth':null}));ami[_0x3330('0x45')](_0x3330('0xaf'),_0x2988dd);break;default:_0x2988dd[_0x3330('0x9a')]=!![];_0x2988dd[_0x3330('0x92')]=moment()[_0x3330('0x4a')](_0x3330('0x76'));_0x2988dd[_0x3330('0x88')]=moment()[_0x3330('0x4a')](_0x3330('0x76'));}_0x2988dd[_0x3330('0x1e')]=![];_0x2988dd[_0x3330('0x82')]=null;_0x2988dd[_0x3330('0x83')]=_0x19031d[_0x3330('0xa9')];this[_0x3330('0x14')][_0x19031d[_0x3330('0x49')]]=_0x2988dd;this[_0x3330('0x43')](_0x2988dd,_0x3330('0x25'));}else if(this[_0x3330('0x67')](_0x19031d[_0x3330('0xa7')])&&this[_0x3330('0x67')](_0x19031d[_0x3330('0xa7')]['queueposition'])){if(!_0x2988dd[_0x3330('0x1e')]){_0x2988dd[_0x3330('0x9a')]=!![];_0x2988dd['queuecallerexitAt']=moment()['format'](_0x3330('0x76'));_0x2988dd[_0x3330('0x83')]='EXITWITHKEY';_0x2988dd[_0x3330('0x88')]=moment()[_0x3330('0x4a')](_0x3330('0x76'));this[_0x3330('0x14')][_0x19031d['uniqueid']]=_0x2988dd;}}logger['info'](_0x3330('0xb0'),_0x19031d[_0x3330('0x49')],_0x2988dd[_0x3330('0x4c')],_0x2988dd[_0x3330('0x50')],_['keys'](_0x19031d['variable'])[0x0],_0x19031d[_0x3330('0xa9')]);_0x2988dd[_0x3330('0x17')]=this['variables'][_0x19031d[_0x3330('0x49')]];}}}}catch(_0x45d35a){logger[_0x3330('0x3e')](_0x3330('0xa5'),_0x19031d[_0x3330('0x49')],util[_0x3330('0x40')](_0x45d35a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3330('0xd')][_0x3330('0xa6')]=function(_0x567620,_0x25132b,_0x43d0e0){var _0x431ffd=[_0x3330('0xb1'),_0x3330('0xb2'),_0x3330('0xb3'),_0x3330('0xb4'),_0x3330('0xb5'),_0x3330('0xb6'),_0x3330('0xb7'),_0x3330('0xb8'),_0x3330('0xb9'),'sipuri',_0x3330('0xba'),_0x3330('0xbb'),_0x3330('0xbc'),_0x3330('0xbd'),_0x3330('0xbe'),_0x3330('0xbf'),_0x3330('0x91'),'memberpenalty',_0x3330('0xc0')];if(!_['isNil'](_0x25132b)&&!_['includes'](_0x431ffd,_0x25132b)){if(_[_0x3330('0x61')](this[_0x3330('0x17')][_0x567620])){this[_0x3330('0x17')][_0x567620]={};}this[_0x3330('0x17')][_0x567620][_0x25132b]=_0x43d0e0;}};VoiceQueueReport[_0x3330('0xd')][_0x3330('0x26')]=function(_0x4ec577){try{if(this[_0x3330('0x67')](_0x4ec577)){logger[_0x3330('0x46')](_0x3330('0xc1'),_0x4ec577[_0x3330('0x49')],util['inspect'](_0x4ec577,{'showHidden':![],'depth':null}));if(this[_0x3330('0x12')][_0x4ec577[_0x3330('0x49')]]){for(var _0xaa1b5e=0x0,_0x2bd15d={};_0xaa1b5e0x0?_0x4009da:0x0;this[_0x0eaf('0x10')][_0x1122ac[_0x0eaf('0x63')]]['talking']=this[_0x0eaf('0x10')][_0x1122ac[_0x0eaf('0x63')]]['talking']>_[_0x0eaf('0x68')](_0x1122ac[_0x0eaf('0x69')])?_[_0x0eaf('0x68')](_0x1122ac[_0x0eaf('0x69')]):this[_0x0eaf('0x10')][_0x1122ac['queue']][_0x0eaf('0x6a')];this[_0x0eaf('0x50')](this[_0x0eaf('0x10')][_0x1122ac[_0x0eaf('0x63')]],'queuesummary');}logger[_0x0eaf('0x43')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0x0eaf('0x47')](this['voiceQueues'][_0x1122ac[_0x0eaf('0x63')]],{'showHidden':![],'depth':null}));ami[_0x0eaf('0x42')](_0x0eaf('0x6b'),this[_0x0eaf('0x10')][_0x1122ac[_0x0eaf('0x63')]]);}}}catch(_0x489044){logger[_0x0eaf('0x3b')](_0x0eaf('0x62'),util[_0x0eaf('0x47')](_0x489044,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0eaf('0x9')][_0x0eaf('0x6c')]=function(_0x45a13f){logger[_0x0eaf('0x43')](_0x0eaf('0x6d'),util['inspect'](_0x45a13f,{'showHidden':![],'depth':null}));this[_0x0eaf('0x11')]=!![];};VoiceQueueReport[_0x0eaf('0x9')][_0x0eaf('0x6e')]=function(_0xe4438a){try{if(this[_0x0eaf('0x5e')](_0xe4438a)){logger['debug'](_0x0eaf('0x6f'),_0xe4438a[_0x0eaf('0x46')],util[_0x0eaf('0x47')](_0xe4438a,{'showHidden':![],'depth':null}));if(_[_0x0eaf('0x5f')](this[_0x0eaf('0xd')][_0xe4438a[_0x0eaf('0x46')]]))this['queueReports'][_0xe4438a[_0x0eaf('0x46')]]=[];if(_[_0x0eaf('0x5f')](this[_0x0eaf('0x33')][_0xe4438a[_0x0eaf('0x46')]]))this[_0x0eaf('0x33')][_0xe4438a[_0x0eaf('0x46')]]={};var _0x4062e0=new QueueReport();_0x4062e0[_0x0eaf('0x4a')]=_0xe4438a[_0x0eaf('0x63')];_0x4062e0['type']=this['voiceQueues'][_0x4062e0[_0x0eaf('0x4a')]]&&this['voiceQueues'][_0x4062e0['name']]['type']?this[_0x0eaf('0x10')][_0x4062e0['name']][_0x0eaf('0x51')]||'inbound':'inbound';_0x4062e0['queue']=_0xe4438a[_0x0eaf('0x63')];_0x4062e0[_0x0eaf('0x70')]=moment()['format'](_0x0eaf('0x71'));_0x4062e0[_0x0eaf('0x72')]=_0xe4438a[_0x0eaf('0x72')];_0x4062e0[_0x0eaf('0x73')]=_0xe4438a[_0x0eaf('0x73')];_0x4062e0['uniqueid']=_0xe4438a[_0x0eaf('0x46')];_0x4062e0[_0x0eaf('0x74')]=this[_0x0eaf('0x33')][_0xe4438a[_0x0eaf('0x46')]][_0x0eaf('0x74')];logger[_0x0eaf('0x65')](_0x0eaf('0x75'),_0x4062e0[_0x0eaf('0x4a')],_0x4062e0['type']);_[_0x0eaf('0x76')](_0x4062e0,_['pick'](_0xe4438a,_[_0x0eaf('0x77')](_0x4062e0)));this[_0x0eaf('0xd')][_0xe4438a[_0x0eaf('0x46')]][_0x0eaf('0x78')](_0x4062e0);this[_0x0eaf('0x33')][_0xe4438a[_0x0eaf('0x46')]]=_0x4062e0;this['emitVoiceQueueChannelSave'](_0x4062e0,_0x0eaf('0x16'));}}catch(_0xacff44){logger[_0x0eaf('0x3b')]('[%s][voiceQueueReport][queuecallerjoin]',_0xe4438a['uniqueid'],util[_0x0eaf('0x47')](_0xacff44,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0eaf('0x18')]=function(_0x5e286e){try{if(this['isNotNull'](_0x5e286e)){logger[_0x0eaf('0x43')](_0x0eaf('0x79'),_0x5e286e['uniqueid'],util[_0x0eaf('0x47')](_0x5e286e,{'showHidden':![],'depth':null}));if(this[_0x0eaf('0xd')][_0x5e286e['uniqueid']]){var _0x461cef=_[_0x0eaf('0x7a')](this['queueReports'][_0x5e286e[_0x0eaf('0x46')]]);_0x461cef[_0x0eaf('0x7b')]=![];_0x461cef[_0x0eaf('0x7c')]=null;_0x461cef[_0x0eaf('0x7d')]=_0x5e286e[_0x0eaf('0x7d')];_0x461cef[_0x0eaf('0x7e')]=_0x5e286e[_0x0eaf('0x7e')];_0x461cef['queuecallerabandon']=!![];_0x461cef[_0x0eaf('0x7f')]=moment()['format'](_0x0eaf('0x71'));_0x461cef[_0x0eaf('0x80')]='ABANDONED';_0x461cef[_0x0eaf('0x81')]=null;logger['info'](_0x0eaf('0x82'),_0x461cef['name'],_0x461cef[_0x0eaf('0x51')]);this['channels'][_0x5e286e['uniqueid']]=_0x461cef;this[_0x0eaf('0x40')](_0x461cef,'queuecallerabandon');}}}catch(_0x248c94){logger[_0x0eaf('0x3b')](_0x0eaf('0x79'),_0x5e286e[_0x0eaf('0x46')],util[_0x0eaf('0x47')](_0x248c94,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0eaf('0x9')]['syncQueueCallerLeave']=function(_0x2ab924){try{if(this['isNotNull'](_0x2ab924)){logger['debug'](_0x0eaf('0x83'),_0x2ab924['uniqueid'],util[_0x0eaf('0x47')](_0x2ab924,{'showHidden':![],'depth':null}));if(this[_0x0eaf('0xd')][_0x2ab924[_0x0eaf('0x46')]]){var _0x4de057=_[_0x0eaf('0x7a')](this[_0x0eaf('0xd')][_0x2ab924['uniqueid']]);_0x4de057[_0x0eaf('0x84')]=moment()[_0x0eaf('0x48')](_0x0eaf('0x71'));_0x4de057[_0x0eaf('0x85')]=_0x2ab924['connectedlinenum'];_0x4de057[_0x0eaf('0x86')]=_0x2ab924[_0x0eaf('0x86')];logger[_0x0eaf('0x65')](_0x0eaf('0x87'),_0x4de057[_0x0eaf('0x4a')],_0x4de057[_0x0eaf('0x51')],_0x2ab924['connectedlinenum'],_0x2ab924[_0x0eaf('0x86')]);this[_0x0eaf('0x33')][_0x2ab924['uniqueid']]=_0x4de057;this[_0x0eaf('0x88')](_0x4de057,_0x0eaf('0x19'));}}}catch(_0x275d0c){logger[_0x0eaf('0x3b')](_0x0eaf('0x83'),_0x2ab924[_0x0eaf('0x46')],util[_0x0eaf('0x47')](_0x275d0c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0eaf('0x9')][_0x0eaf('0x89')]=function(_0x28afa8){try{if(this[_0x0eaf('0x5e')](_0x28afa8)){logger[_0x0eaf('0x43')](_0x0eaf('0x8a'),_0x28afa8['uniqueid'],util[_0x0eaf('0x47')](_0x28afa8,{'showHidden':![],'depth':null}));if(this[_0x0eaf('0xd')][_0x28afa8[_0x0eaf('0x46')]]){var _0x32b132=_[_0x0eaf('0x7a')](this['queueReports'][_0x28afa8[_0x0eaf('0x46')]]);_0x32b132['queuecallercomplete']=!![];_0x32b132['queuecallerexitreason']=_0x0eaf('0x8b');logger[_0x0eaf('0x65')](_0x0eaf('0x8c'),_0x32b132[_0x0eaf('0x4a')],_0x32b132[_0x0eaf('0x51')]);}}}catch(_0x1aa22d){logger[_0x0eaf('0x3b')](_0x0eaf('0x8a'),_0x28afa8['uniqueid'],util[_0x0eaf('0x47')](_0x1aa22d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0eaf('0x9')][_0x0eaf('0x1c')]=function(_0x4394b3){try{if(this[_0x0eaf('0x5e')](_0x4394b3)){logger['debug'](_0x0eaf('0x8d'),_0x4394b3[_0x0eaf('0x46')],util[_0x0eaf('0x47')](_0x4394b3,{'showHidden':![],'depth':null}));if(this[_0x0eaf('0xd')][_0x4394b3[_0x0eaf('0x46')]]){var _0x3e3120=_[_0x0eaf('0x7a')](this['queueReports'][_0x4394b3[_0x0eaf('0x46')]]);_0x3e3120[_0x0eaf('0x17')]=![];_0x3e3120[_0x0eaf('0x7f')]=null;_0x3e3120[_0x0eaf('0x8e')]=!![];_0x3e3120[_0x0eaf('0x81')]=_0x4394b3['membername'];_0x3e3120['holdtime']=_0x4394b3[_0x0eaf('0x7d')];_0x3e3120[_0x0eaf('0x7b')]=!![];_0x3e3120[_0x0eaf('0x8f')]=![];_0x3e3120['queuecallerexitAt']=null;if(!_0x3e3120[_0x0eaf('0x90')]){if(_0x4394b3[_0x0eaf('0x91')]==_0x0eaf('0x90')){_0x3e3120[_0x0eaf('0x80')]='COMPLETED';logger[_0x0eaf('0x65')](_0x0eaf('0x92'),_0x3e3120[_0x0eaf('0x4a')],_0x3e3120[_0x0eaf('0x51')]);}else{if(_[_0x0eaf('0x93')](_0x4394b3['channel'][_0x0eaf('0x94')](),_0x0eaf('0x95'))){if(this['queueReports'][_0x4394b3['linkedid']]){var _0x44e230=_[_0x0eaf('0x7a')](this['queueReports'][_0x4394b3[_0x0eaf('0x96')]]);_0x44e230[_0x0eaf('0x7b')]=![];_0x44e230[_0x0eaf('0x8f')]=!![];_0x44e230['queuecallerexitAt']=moment(_0x3e3120['queuecallerjoinAt'])[_0x0eaf('0x97')](_0x4394b3[_0x0eaf('0x7d')],_0x0eaf('0x98'))[_0x0eaf('0x48')](_0x0eaf('0x71'));_0x44e230['queuecallerexitreason']=_0x0eaf('0x99');_0x44e230['transfer']=!![];_0x44e230[_0x0eaf('0x9a')]=_0x0eaf('0x9b');_0x44e230[_0x0eaf('0x9c')]=_0x4394b3[_0x0eaf('0x9d')];_0x44e230[_0x0eaf('0x9e')]=_0x4394b3[_0x0eaf('0x46')];logger[_0x0eaf('0x65')](_0x0eaf('0x9f'),_0x44e230[_0x0eaf('0x4a')],_0x44e230[_0x0eaf('0x51')]);var _0x16144d=this[_0x0eaf('0xd')][_0x4394b3[_0x0eaf('0x96')]];this[_0x0eaf('0xd')][_0x4394b3[_0x0eaf('0x96')]]=this[_0x0eaf('0xd')][_0x4394b3['uniqueid']];this[_0x0eaf('0xd')][_0x4394b3['uniqueid']]=_0x16144d;}}else{_0x3e3120[_0x0eaf('0x80')]=_0x0eaf('0xa0')+_0x4394b3[_0x0eaf('0x91')]['toUpperCase']();logger[_0x0eaf('0x65')](_0x0eaf('0xa1'),_0x3e3120[_0x0eaf('0x4a')],_0x3e3120[_0x0eaf('0x51')],_0x3e3120[_0x0eaf('0x80')]);}}}this[_0x0eaf('0x33')][_0x4394b3['uniqueid']]=_0x3e3120;this['emitVoiceQueueChannelRemove'](_0x3e3120,'agentcomplete');}}}catch(_0xaa4e10){logger['error'](_0x0eaf('0x8d'),_0x4394b3[_0x0eaf('0x46')],util[_0x0eaf('0x47')](_0xaa4e10,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0eaf('0x9')][_0x0eaf('0x1e')]=function(_0x3a58ae){try{if(this[_0x0eaf('0x5e')](_0x3a58ae)){logger['debug'](_0x0eaf('0xa2'),_0x3a58ae['uniqueid'],util['inspect'](_0x3a58ae,{'showHidden':![],'depth':null}));this[_0x0eaf('0xa3')](_0x3a58ae[_0x0eaf('0x46')],_[_0x0eaf('0x77')](_0x3a58ae[_0x0eaf('0xa4')])[0x0],_0x3a58ae[_0x0eaf('0xa5')]);if(this[_0x0eaf('0xd')][_0x3a58ae[_0x0eaf('0x46')]]){var _0x27d63a=_[_0x0eaf('0x7a')](this[_0x0eaf('0xd')][_0x3a58ae[_0x0eaf('0x46')]]);if(_0x27d63a){if(this[_0x0eaf('0x5e')](_0x3a58ae[_0x0eaf('0xa4')])&&this['isNotNull'](_0x3a58ae[_0x0eaf('0xa4')][_0x0eaf('0xa6')])){switch(_0x3a58ae[_0x0eaf('0xa5')]){case _0x0eaf('0xa7'):_0x27d63a[_0x0eaf('0x8f')]=![];_0x27d63a[_0x0eaf('0xa8')]=null;break;case _0x0eaf('0xa9'):_0x27d63a[_0x0eaf('0xaa')]=_0x0eaf('0xab');_0x27d63a[_0x0eaf('0x8f')]=!![];_0x27d63a['queuecallerexitAt']=moment()[_0x0eaf('0x48')](_0x0eaf('0x71'));_0x27d63a[_0x0eaf('0x84')]=moment()[_0x0eaf('0x48')](_0x0eaf('0x71'));logger[_0x0eaf('0x43')](_0x0eaf('0xac'),_0x3a58ae[_0x0eaf('0x46')],util['inspect'](_0x27d63a,{'showHidden':![],'depth':null}));ami['emit'](_0x0eaf('0xad'),_0x27d63a);break;default:_0x27d63a['queuecallerexit']=!![];_0x27d63a[_0x0eaf('0xa8')]=moment()[_0x0eaf('0x48')](_0x0eaf('0x71'));_0x27d63a[_0x0eaf('0x84')]=moment()[_0x0eaf('0x48')](_0x0eaf('0x71'));}_0x27d63a[_0x0eaf('0x17')]=![];_0x27d63a[_0x0eaf('0x7f')]=null;_0x27d63a[_0x0eaf('0x80')]=_0x3a58ae[_0x0eaf('0xa5')];this[_0x0eaf('0x33')][_0x3a58ae[_0x0eaf('0x46')]]=_0x27d63a;this['emitVoiceQueueChannelRemove'](_0x27d63a,_0x0eaf('0x1d'));}else if(this[_0x0eaf('0x5e')](_0x3a58ae[_0x0eaf('0xa4')])&&this[_0x0eaf('0x5e')](_0x3a58ae[_0x0eaf('0xa4')][_0x0eaf('0xae')])){if(!_0x27d63a[_0x0eaf('0x17')]){_0x27d63a[_0x0eaf('0x8f')]=!![];_0x27d63a[_0x0eaf('0xa8')]=moment()[_0x0eaf('0x48')](_0x0eaf('0x71'));_0x27d63a['queuecallerexitreason']=_0x0eaf('0xaf');_0x27d63a[_0x0eaf('0x84')]=moment()[_0x0eaf('0x48')](_0x0eaf('0x71'));this[_0x0eaf('0x33')][_0x3a58ae[_0x0eaf('0x46')]]=_0x27d63a;}}logger[_0x0eaf('0x65')](_0x0eaf('0xb0'),_0x3a58ae[_0x0eaf('0x46')],_0x27d63a['name'],_0x27d63a[_0x0eaf('0x51')],_[_0x0eaf('0x77')](_0x3a58ae[_0x0eaf('0xa4')])[0x0],_0x3a58ae[_0x0eaf('0xa5')]);_0x27d63a[_0x0eaf('0x13')]=this[_0x0eaf('0x13')][_0x3a58ae[_0x0eaf('0x46')]];}}}}catch(_0x2b01b2){logger[_0x0eaf('0x3b')](_0x0eaf('0xa2'),_0x3a58ae[_0x0eaf('0x46')],util[_0x0eaf('0x47')](_0x2b01b2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0eaf('0x9')]['addVariable']=function(_0x4e02b1,_0x40e16d,_0x18fe09){var _0x454c59=[_0x0eaf('0xb1'),_0x0eaf('0xb2'),_0x0eaf('0xb3'),'rtpaudioqosjitterbridged',_0x0eaf('0xb4'),'rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid',_0x0eaf('0xb5'),_0x0eaf('0xb6'),'bridgepvtcallid','membercalls',_0x0eaf('0xb7'),_0x0eaf('0xb8'),_0x0eaf('0xb9'),'membername','memberpenalty',_0x0eaf('0xba')];if(!_['isNil'](_0x40e16d)&&!_[_0x0eaf('0xbb')](_0x454c59,_0x40e16d)){if(_[_0x0eaf('0x5f')](this[_0x0eaf('0x13')][_0x4e02b1])){this[_0x0eaf('0x13')][_0x4e02b1]={};}this['variables'][_0x4e02b1][_0x40e16d]=_0x18fe09;}};VoiceQueueReport[_0x0eaf('0x9')][_0x0eaf('0x20')]=function(_0x3629f2){try{if(this[_0x0eaf('0x5e')](_0x3629f2)){logger['debug'](_0x0eaf('0xbc'),_0x3629f2[_0x0eaf('0x46')],util['inspect'](_0x3629f2,{'showHidden':![],'depth':null}));if(this[_0x0eaf('0xd')][_0x3629f2[_0x0eaf('0x46')]]){for(var _0xfdb24=0x0,_0x3a75de={};_0xfdb24=0x0?moment(_0x5e466b[_0x683e('0x16')])[_0x683e('0xb')](_0x5e466b[_0x683e('0x15')],'seconds'):null,'data1':_0x683e('0x18'),'data2':_0x5e466b[_0x683e('0x11')],'data3':_0x5e466b[_0x683e('0xe')],'data4':_0x5e466b[_0x683e('0x19')]||null,'role':_0x683e('0x10'),'internal':_0x5e466b['accountcode']?_[_0x683e('0x12')](_0x5e466b[_0x683e('0x11')]):undefined,'uniqueid':_0x5e466b[_0x683e('0x1a')]},'log':_0x683e('0x3')});}; \ No newline at end of file +var _0xbb0f=['dialstring','lodash','voiceQueueReport','queuecallercompleteAt','Request','CreateMemberReport','voice','lastAssignedTo','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','inbound','agent','accountcode','toNumber','uniqueid','voiceDialReport','starttime','endtime','outbound','exten'];(function(_0x17af95,_0x41aace){var _0x358822=function(_0x3e856b){while(--_0x3e856b){_0x17af95['push'](_0x17af95['shift']());}};_0x358822(++_0x41aace);}(_0xbb0f,0x97));var _0xfbb0=function(_0xec73e0,_0x7fc635){_0xec73e0=_0xec73e0-0x0;var _0x562172=_0xbb0f[_0xec73e0];return _0x562172;};'use strict';var moment=require('moment');var _=require(_0xfbb0('0x0'));var util=require('util');var client=require('../client');exports[_0xfbb0('0x1')]=function(_0x369b45){var _0x5f0c4f=_0x369b45[_0xfbb0('0x2')]||_0x369b45['queuecallerexitAt'];return client[_0xfbb0('0x3')](_0xfbb0('0x4'),{'body':{'channel':_0xfbb0('0x5'),'membername':_0x369b45[_0xfbb0('0x6')],'interface':_['isNil'](_0x369b45[_0xfbb0('0x7')])?util[_0xfbb0('0x8')](_0xfbb0('0x9'),_0x369b45[_0xfbb0('0x6')]):_0x369b45[_0xfbb0('0x7')],'type':_0xfbb0('0xa'),'enterAt':_0x369b45[_0xfbb0('0xb')],'exitAt':_0x5f0c4f,'duration':moment(_0x5f0c4f)[_0xfbb0('0xc')](_0x369b45[_0xfbb0('0xb')],_0xfbb0('0xd')),'data1':_0xfbb0('0xe'),'data2':_0x369b45['calleridnum'],'data3':_0x369b45['exten'],'data4':null,'data5':_0x369b45['queue'],'role':_0xfbb0('0xf'),'internal':_0x369b45[_0xfbb0('0x10')]?_[_0xfbb0('0x11')](_0x369b45['accountcode']):undefined,'uniqueid':_0x369b45[_0xfbb0('0x12')]},'log':_0xfbb0('0x4')});};exports[_0xfbb0('0x13')]=function(_0x2a3625){return client['Request'](_0xfbb0('0x4'),{'body':{'channel':_0xfbb0('0x5'),'membername':_0x2a3625['membername'],'interface':_0x2a3625['interface'],'type':_0xfbb0('0xa'),'enterAt':_0x2a3625[_0xfbb0('0x14')],'exitAt':_0x2a3625[_0xfbb0('0x15')],'duration':moment(_0x2a3625[_0xfbb0('0x15')])[_0xfbb0('0xc')](_0x2a3625['starttime'],_0xfbb0('0xd'))>=0x0?moment(_0x2a3625[_0xfbb0('0x15')])[_0xfbb0('0xc')](_0x2a3625[_0xfbb0('0x14')],_0xfbb0('0xd')):null,'data1':_0xfbb0('0x16'),'data2':_0x2a3625[_0xfbb0('0x10')],'data3':_0x2a3625[_0xfbb0('0x17')],'data4':_0x2a3625[_0xfbb0('0x18')]||null,'role':'agent','internal':_0x2a3625[_0xfbb0('0x10')]?_[_0xfbb0('0x11')](_0x2a3625[_0xfbb0('0x10')]):undefined,'uniqueid':_0x2a3625['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 654d286..c5b81de 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 _0xe890=['previewRecallmeReminderInterval','GetSettings','Request','ShowSetting','stopRecordingOnTransfer'];(function(_0x1a0e98,_0x6bd5d7){var _0x3fa192=function(_0x256fd2){while(--_0x256fd2){_0x1a0e98['push'](_0x1a0e98['shift']());}};_0x3fa192(++_0x6bd5d7);}(_0xe890,0x1a6));var _0x0e89=function(_0x49900e,_0x48b6bb){_0x49900e=_0x49900e-0x0;var _0x4ed98e=_0xe890[_0x49900e];return _0x4ed98e;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0x0e89('0x0')](_0x0e89('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0e89('0x2'),_0x0e89('0x3')]},'log':_0x0e89('0x4')});}; \ No newline at end of file +var _0x0bb4=['getSettings','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client'];(function(_0x2f0c55,_0x57370f){var _0x10a23f=function(_0x2aaef3){while(--_0x2aaef3){_0x2f0c55['push'](_0x2f0c55['shift']());}};_0x10a23f(++_0x57370f);}(_0x0bb4,0x77));var _0x40bb=function(_0xca8a7c,_0x2f7a66){_0xca8a7c=_0xca8a7c-0x0;var _0x3ab51c=_0x0bb4[_0xca8a7c];return _0x3ab51c;};'use strict';var client=require(_0x40bb('0x0'));exports[_0x40bb('0x1')]=function(){return client['Request'](_0x40bb('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x40bb('0x3'),_0x40bb('0x4')]},'log':_0x40bb('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 88085fc..4a65fb4 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 _0x8409=['../client','getTemplates','Request','GetTemplate','name'];(function(_0x3f32e0,_0x31a9c0){var _0xe5ccc3=function(_0x27cc8c){while(--_0x27cc8c){_0x3f32e0['push'](_0x3f32e0['shift']());}};_0xe5ccc3(++_0x31a9c0);}(_0x8409,0x91));var _0x9840=function(_0x30df37,_0x48ad64){_0x30df37=_0x30df37-0x0;var _0x41ab55=_0x8409[_0x30df37];return _0x41ab55;};'use strict';var client=require(_0x9840('0x0'));exports[_0x9840('0x1')]=function(_0xf820a9){return function(_0x43c437){return client[_0x9840('0x2')](_0x9840('0x3'),{'options':{'raw':!![],'attributes':['id',_0x9840('0x4'),'html']},'log':_0x9840('0x3')});};}; \ No newline at end of file +var _0x969d=['getTemplates','GetTemplate','html','../client'];(function(_0x1a9e78,_0x180720){var _0x113e06=function(_0x229c64){while(--_0x229c64){_0x1a9e78['push'](_0x1a9e78['shift']());}};_0x113e06(++_0x180720);}(_0x969d,0xf7));var _0xd969=function(_0x34bd49,_0x3c9070){_0x34bd49=_0x34bd49-0x0;var _0x349fca=_0x969d[_0x34bd49];return _0x349fca;};'use strict';var client=require(_0xd969('0x0'));exports[_0xd969('0x1')]=function(_0x1c5abf){return function(_0x1c40b8){return client['Request'](_0xd969('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0xd969('0x3')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 97439e0..7177812 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 _0x685f=['data1','data3','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','Condition','AllConditions','field','operator','value','Action','Actions'];(function(_0x675246,_0x1d0878){var _0x59e2c7=function(_0x2d3d74){while(--_0x2d3d74){_0x675246['push'](_0x675246['shift']());}};_0x59e2c7(++_0x1d0878);}(_0x685f,0x18b));var _0xf685=function(_0x30c3cd,_0x1c86c6){_0x30c3cd=_0x30c3cd-0x0;var _0x1dab14=_0x685f[_0x30c3cd];return _0x1dab14;};'use strict';var client=require(_0xf685('0x0'));exports[_0xf685('0x1')]=function(_0x30b937){return function(_0x485da5){return client[_0xf685('0x2')](_0xf685('0x3'),{'options':{'raw':![],'attributes':['id',_0xf685('0x4'),_0xf685('0x5'),'status'],'include':[{'model':_0xf685('0x6'),'as':_0xf685('0x7'),'attributes':['id',_0xf685('0x8'),_0xf685('0x9'),_0xf685('0xa')]},{'model':_0xf685('0x6'),'as':'AnyConditions','attributes':['id',_0xf685('0x8'),_0xf685('0x9'),_0xf685('0xa')]},{'model':_0xf685('0xb'),'as':_0xf685('0xc'),'attributes':['id','action',_0xf685('0xd'),'data2',_0xf685('0xe'),'data4','data5',_0xf685('0xf'),_0xf685('0x10')]}]},'log':_0xf685('0x3')});};}; \ No newline at end of file +var _0x9f40=['data2','data3','data4','data5','data6','data7','GetTrigger','../client','getTriggers','Request','name','status','Condition','field','operator','value','Action','Actions'];(function(_0x258df0,_0x31ce33){var _0x2a96fe=function(_0x2a93cf){while(--_0x2a93cf){_0x258df0['push'](_0x258df0['shift']());}};_0x2a96fe(++_0x31ce33);}(_0x9f40,0x1ed));var _0x09f4=function(_0x3323f6,_0x957905){_0x3323f6=_0x3323f6-0x0;var _0x55eb64=_0x9f40[_0x3323f6];return _0x55eb64;};'use strict';var client=require(_0x09f4('0x0'));exports[_0x09f4('0x1')]=function(_0x2501c7){return function(_0x2b9d60){return client[_0x09f4('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x09f4('0x3'),'channel',_0x09f4('0x4')],'include':[{'model':_0x09f4('0x5'),'as':'AllConditions','attributes':['id',_0x09f4('0x6'),_0x09f4('0x7'),_0x09f4('0x8')]},{'model':_0x09f4('0x5'),'as':'AnyConditions','attributes':['id',_0x09f4('0x6'),_0x09f4('0x7'),'value']},{'model':_0x09f4('0x9'),'as':_0x09f4('0xa'),'attributes':['id','action','data1',_0x09f4('0xb'),_0x09f4('0xc'),_0x09f4('0xd'),_0x09f4('0xe'),_0x09f4('0xf'),_0x09f4('0x10')]}]},'log':_0x09f4('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 175fa52..69bf3b4 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 _0x9b60=['../client','getTrunks','Request','GetTrunk','name','registry'];(function(_0x99f0fb,_0x12cbdf){var _0x36345c=function(_0x5ce7de){while(--_0x5ce7de){_0x99f0fb['push'](_0x99f0fb['shift']());}};_0x36345c(++_0x12cbdf);}(_0x9b60,0x174));var _0x09b6=function(_0x1898f1,_0x117fa8){_0x1898f1=_0x1898f1-0x0;var _0x648c0b=_0x9b60[_0x1898f1];return _0x648c0b;};'use strict';var client=require(_0x09b6('0x0'));exports[_0x09b6('0x1')]=function(_0x3220ce){return function(_0x23aee){return client[_0x09b6('0x2')](_0x09b6('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x09b6('0x4'),_0x09b6('0x5'),'defaultuser']},'log':'GetTrunk'});};}; \ No newline at end of file +var _0xe306=['getTrunks','Request','registry','defaultuser','../client'];(function(_0x19a773,_0x2c3111){var _0xf2eaa2=function(_0x2053bc){while(--_0x2053bc){_0x19a773['push'](_0x19a773['shift']());}};_0xf2eaa2(++_0x2c3111);}(_0xe306,0x180));var _0x6e30=function(_0x5471ec,_0x1ce81a){_0x5471ec=_0x5471ec-0x0;var _0x121d4c=_0xe306[_0x5471ec];return _0x121d4c;};'use strict';var client=require(_0x6e30('0x0'));exports[_0x6e30('0x1')]=function(_0x31a12f){return function(_0x2c9174){return client[_0x6e30('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x6e30('0x3'),_0x6e30('0x4')]},'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 a98ae98..bd49290 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0xbe166,_0x359d2){var _0x253250=function(_0x5ac3be){while(--_0x5ac3be){_0xbe166['push'](_0xbe166['shift']());}};_0x253250(++_0x359d2);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file +var _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 705f276..d8539e4 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 _0x51f3=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport','update'];(function(_0x50b735,_0x2f590e){var _0x5e5c0d=function(_0x267642){while(--_0x267642){_0x50b735['push'](_0x50b735['shift']());}};_0x5e5c0d(++_0x2f590e);}(_0x51f3,0xfd));var _0x351f=function(_0x404d4f,_0x5daa77){_0x404d4f=_0x404d4f-0x0;var _0x1caa05=_0x51f3[_0x404d4f];return _0x1caa05;};'use strict';var client=require(_0x351f('0x0'));exports[_0x351f('0x1')]=function(_0x52f2d2){return client[_0x351f('0x2')](_0x351f('0x3'),{'body':_0x52f2d2,'log':_0x351f('0x3')});};exports[_0x351f('0x4')]=function(_0x1d1911,_0x4e057f,_0x42e12b){return client['Request'](_0x351f('0x5'),{'body':_0x1d1911,'options':{'where':{'uniqueid':_0x4e057f,'interface':_0x42e12b,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x3a9c=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','Request'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x3a9c,0x1ac));var _0xc3a9=function(_0x6a189a,_0x49a42c){_0x6a189a=_0x6a189a-0x0;var _0x515500=_0x3a9c[_0x6a189a];return _0x515500;};'use strict';var client=require(_0xc3a9('0x0'));exports['create']=function(_0x49f3e0){return client[_0xc3a9('0x1')]('CreateVoiceAgentReport',{'body':_0x49f3e0,'log':_0xc3a9('0x2')});};exports[_0xc3a9('0x3')]=function(_0x2259e3,_0x211a66,_0x2954cf){return client['Request'](_0xc3a9('0x4'),{'body':_0x2259e3,'options':{'where':{'uniqueid':_0x211a66,'interface':_0x2954cf,'agentcomplete':!![]}},'log':_0xc3a9('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 2224b7b..10be711 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 _0x1dc4=['day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','duration','billableseconds','moment','util','lodash','../client','Request','CreateVoiceCallReport','merge','calleridnum','context','DOCUMENTATION','getVoiceCallReports','outbound'];(function(_0x23c5f6,_0x5ef467){var _0x29c433=function(_0x47cc8c){while(--_0x47cc8c){_0x23c5f6['push'](_0x23c5f6['shift']());}};_0x29c433(++_0x5ef467);}(_0x1dc4,0x183));var _0x41dc=function(_0x5112aa,_0x11ab4d){_0x5112aa=_0x5112aa-0x0;var _0x2c4161=_0x1dc4[_0x5112aa];return _0x2c4161;};'use strict';var moment=require(_0x41dc('0x0'));var util=require(_0x41dc('0x1'));var _=require(_0x41dc('0x2'));var client=require(_0x41dc('0x3'));exports['create']=function(_0x180cd9){return client[_0x41dc('0x4')](_0x41dc('0x5'),{'body':_[_0x41dc('0x6')](_0x180cd9,{'source':_0x180cd9[_0x41dc('0x7')],'destinationcontext':_0x180cd9[_0x41dc('0x8')],'callerid':_0x180cd9['callerid'],'amaflags':_0x41dc('0x9')}),'log':_0x41dc('0x5')});};exports[_0x41dc('0xa')]=function(){return function(){return client[_0x41dc('0x4')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x41dc('0xb')],'createdAt':{'$between':[moment()['startOf'](_0x41dc('0xc'))[_0x41dc('0xd')](_0x41dc('0xe')),moment()[_0x41dc('0xf')](_0x41dc('0xc'))[_0x41dc('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x41dc('0x10'),'disposition',_0x41dc('0x11'),_0x41dc('0x12')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x3b5c=['startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','lodash','create','Request','CreateVoiceCallReport','merge','calleridnum','context','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x3b5c,0x128));var _0xc3b5=function(_0x436d51,_0x947007){_0x436d51=_0x436d51-0x0;var _0x2dcf75=_0x3b5c[_0x436d51];return _0x2dcf75;};'use strict';var moment=require(_0xc3b5('0x0'));var util=require('util');var _=require(_0xc3b5('0x1'));var client=require('../client');exports[_0xc3b5('0x2')]=function(_0x30c4ad){return client[_0xc3b5('0x3')](_0xc3b5('0x4'),{'body':_[_0xc3b5('0x5')](_0x30c4ad,{'source':_0x30c4ad[_0xc3b5('0x6')],'destinationcontext':_0x30c4ad[_0xc3b5('0x7')],'callerid':_0x30c4ad['callerid'],'amaflags':_0xc3b5('0x8')}),'log':_0xc3b5('0x4')});};exports[_0xc3b5('0x9')]=function(){return function(){return client['Request'](_0xc3b5('0xa'),{'options':{'where':{'type':[_0xc3b5('0xb')],'createdAt':{'$between':[moment()[_0xc3b5('0xc')](_0xc3b5('0xd'))['format'](_0xc3b5('0xe')),moment()[_0xc3b5('0xf')]('day')[_0xc3b5('0x10')](_0xc3b5('0xe'))]}},'attributes':[_0xc3b5('0x11'),_0xc3b5('0x12'),_0xc3b5('0x13'),_0xc3b5('0x14')]},'log':_0xc3b5('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 3ce9fe1..88bf6ab 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 _0xcf46=['../client','Request','CreateVoiceDialReport'];(function(_0x4deb9a,_0x4ca41f){var _0x4ec151=function(_0x44a11d){while(--_0x44a11d){_0x4deb9a['push'](_0x4deb9a['shift']());}};_0x4ec151(++_0x4ca41f);}(_0xcf46,0x1d7));var _0x6cf4=function(_0x48cb49,_0x2388d6){_0x48cb49=_0x48cb49-0x0;var _0x32239b=_0xcf46[_0x48cb49];return _0x32239b;};'use strict';var client=require(_0x6cf4('0x0'));exports['create']=function(_0x33cc8f){return client[_0x6cf4('0x1')](_0x6cf4('0x2'),{'body':_0x33cc8f,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x1b86=['../client','create','Request','CreateVoiceDialReport'];(function(_0x23d437,_0x4261dd){var _0x4c99f4=function(_0x5cffd0){while(--_0x5cffd0){_0x23d437['push'](_0x23d437['shift']());}};_0x4c99f4(++_0x4261dd);}(_0x1b86,0x1d8));var _0x61b8=function(_0x37f1b4,_0x124c4e){_0x37f1b4=_0x37f1b4-0x0;var _0x4b96c5=_0x1b86[_0x37f1b4];return _0x4b96c5;};'use strict';var client=require(_0x61b8('0x0'));exports[_0x61b8('0x1')]=function(_0x16a5c0){return client[_0x61b8('0x2')](_0x61b8('0x3'),{'body':_0x16a5c0,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 06ffeb2..7522ad3 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 _0x0cfa=['getVoiceExtensions','Request','GetVoiceExtension','../client'];(function(_0x58e989,_0x2b6e4a){var _0x2bf9bd=function(_0x583536){while(--_0x583536){_0x58e989['push'](_0x58e989['shift']());}};_0x2bf9bd(++_0x2b6e4a);}(_0x0cfa,0x18f));var _0xa0cf=function(_0x22eef7,_0x1af5bc){_0x22eef7=_0x22eef7-0x0;var _0x1a489d=_0x0cfa[_0x22eef7];return _0x1a489d;};'use strict';var client=require(_0xa0cf('0x0'));exports[_0xa0cf('0x1')]=function(){return function(){return client[_0xa0cf('0x2')](_0xa0cf('0x3'),{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x68fc=['recordingFormat','../client','getVoiceExtensions','Request'];(function(_0x1283d4,_0x36b6f1){var _0x433643=function(_0x4c9fbe){while(--_0x4c9fbe){_0x1283d4['push'](_0x1283d4['shift']());}};_0x433643(++_0x36b6f1);}(_0x68fc,0xa5));var _0xc68f=function(_0x480f28,_0x1b9b80){_0x480f28=_0x480f28-0x0;var _0xd4c034=_0x68fc[_0x480f28];return _0xd4c034;};'use strict';var client=require(_0xc68f('0x0'));exports[_0xc68f('0x1')]=function(){return function(){return client[_0xc68f('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten',_0xc68f('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 6e065d1..dc7d6ac 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 _0xec05=['dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewRecallmeReminder','callerid','Pause','mandatoryDispositionPause','TrunkBackup','active','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','monitor_format','dialActive','dialMethod','dialLimitChannel'];(function(_0xde5521,_0x424a03){var _0x59e1df=function(_0x50bdf1){while(--_0x50bdf1){_0xde5521['push'](_0xde5521['shift']());}};_0x59e1df(++_0x424a03);}(_0xec05,0xe6));var _0x5ec0=function(_0x9de297,_0x4d2383){_0x9de297=_0x9de297-0x0;var _0x287b3a=_0xec05[_0x9de297];return _0x287b3a;};'use strict';var client=require(_0x5ec0('0x0'));exports[_0x5ec0('0x1')]=function(){return function(){return client[_0x5ec0('0x2')](_0x5ec0('0x3'),{'options':{'raw':![],'attributes':['id',_0x5ec0('0x4'),_0x5ec0('0x5'),'acwTimeout','autopause',_0x5ec0('0x6'),'type',_0x5ec0('0x7'),_0x5ec0('0x8'),_0x5ec0('0x9'),_0x5ec0('0xa'),'dialPowerLevel',_0x5ec0('0xb'),_0x5ec0('0xc'),_0x5ec0('0xd'),_0x5ec0('0xe'),_0x5ec0('0xf'),_0x5ec0('0x10'),_0x5ec0('0x11'),'dialQueueTimeout',_0x5ec0('0x12'),_0x5ec0('0x13'),_0x5ec0('0x14'),_0x5ec0('0x15'),'dialBusyRetryFrequency',_0x5ec0('0x16'),_0x5ec0('0x17'),_0x5ec0('0x18'),_0x5ec0('0x19'),'dialGlobalInterval','dialPrefix',_0x5ec0('0x1a'),_0x5ec0('0x1b'),_0x5ec0('0x1c'),_0x5ec0('0x1d'),_0x5ec0('0x1e'),'dialAMDTotalAnalysisTime',_0x5ec0('0x1f'),_0x5ec0('0x20'),'dialAMDMaximumNumberOfWords',_0x5ec0('0x21'),'dialAMDMaximumWordLength','timeout',_0x5ec0('0x22'),_0x5ec0('0x23'),_0x5ec0('0x24'),_0x5ec0('0x25'),_0x5ec0('0x26'),_0x5ec0('0x27'),_0x5ec0('0x6'),_0x5ec0('0x28'),'dialRandomLastDigitCallerIdNumber','dialCutDigit',_0x5ec0('0x29'),_0x5ec0('0x2a'),_0x5ec0('0x2b'),_0x5ec0('0x2c'),_0x5ec0('0x2d'),'dialAbandonedRetryFrequency',_0x5ec0('0x2e'),_0x5ec0('0x2f'),_0x5ec0('0x30'),'dialAgentRejectRetryFrequency',_0x5ec0('0x31'),_0x5ec0('0x32'),'dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe',_0x5ec0('0x33')],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0x5ec0('0x4'),_0x5ec0('0x34'),'active']},{'model':_0x5ec0('0x35'),'as':_0x5ec0('0x36'),'attributes':['id',_0x5ec0('0x4')]},{'model':'Trunk','as':_0x5ec0('0x37'),'attributes':['id',_0x5ec0('0x4'),_0x5ec0('0x34'),_0x5ec0('0x38')]},{'model':_0x5ec0('0x39'),'as':'Interval','attributes':['id','name'],'include':[{'model':'Interval','as':_0x5ec0('0x3a'),'attributes':['id',_0x5ec0('0x4'),_0x5ec0('0x3b')]}]}]},'log':_0x5ec0('0x1')});};}; \ No newline at end of file +var _0x5858=['dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','name','acw','acwTimeout','type','dialActive','dialMethod','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateTimeout','dialQueueOptions','dialQueueProject'];(function(_0x367a44,_0x121a26){var _0x14c9d1=function(_0x1262a8){while(--_0x1262a8){_0x367a44['push'](_0x367a44['shift']());}};_0x14c9d1(++_0x121a26);}(_0x5858,0xa7));var _0x8585=function(_0xbfae90,_0xa9e4ef){_0xbfae90=_0xbfae90-0x0;var _0xda61ef=_0x5858[_0xbfae90];return _0xda61ef;};'use strict';var client=require(_0x8585('0x0'));exports[_0x8585('0x1')]=function(){return function(){return client[_0x8585('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x8585('0x3'),_0x8585('0x4'),_0x8585('0x5'),'autopause','monitor_format',_0x8585('0x6'),_0x8585('0x7'),_0x8585('0x8'),'dialLimitChannel',_0x8585('0x9'),'dialPowerLevel',_0x8585('0xa'),_0x8585('0xb'),_0x8585('0xc'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber',_0x8585('0xd'),_0x8585('0xe'),'dialQueueTimeout',_0x8585('0xf'),_0x8585('0x10'),'dialCongestionRetryFrequency',_0x8585('0x11'),_0x8585('0x12'),_0x8585('0x13'),'dialNoAnswerRetryFrequency',_0x8585('0x14'),_0x8585('0x15'),_0x8585('0x16'),_0x8585('0x17'),_0x8585('0x18'),_0x8585('0x19'),_0x8585('0x1a'),_0x8585('0x1b'),_0x8585('0x1c'),'dialAMDTotalAnalysisTime',_0x8585('0x1d'),_0x8585('0x1e'),_0x8585('0x1f'),_0x8585('0x20'),'dialAMDMaximumWordLength','timeout',_0x8585('0x21'),'dialRecallInQueue',_0x8585('0x22'),_0x8585('0x23'),_0x8585('0x24'),_0x8585('0x25'),_0x8585('0x26'),'strategy',_0x8585('0x27'),_0x8585('0x28'),_0x8585('0x29'),'dialNoSuchNumberRetryFrequency',_0x8585('0x2a'),_0x8585('0x2b'),_0x8585('0x2c'),'dialAbandonedRetryFrequency',_0x8585('0x2d'),_0x8585('0x2e'),_0x8585('0x2f'),_0x8585('0x30'),_0x8585('0x31'),_0x8585('0x32'),'dialPredictiveIntervalMinThreshold',_0x8585('0x33'),_0x8585('0x34')],'include':[{'model':_0x8585('0x35'),'as':_0x8585('0x35'),'attributes':['id',_0x8585('0x3'),_0x8585('0x36'),_0x8585('0x37')]},{'model':_0x8585('0x38'),'as':_0x8585('0x39'),'attributes':['id','name']},{'model':_0x8585('0x35'),'as':_0x8585('0x3a'),'attributes':['id',_0x8585('0x3'),_0x8585('0x36'),_0x8585('0x37')]},{'model':_0x8585('0x3b'),'as':'Interval','attributes':['id','name'],'include':[{'model':_0x8585('0x3b'),'as':'Intervals','attributes':['id',_0x8585('0x3'),_0x8585('0x3c')]}]}]},'log':_0x8585('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 00b8aa2..48a9887 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(_0x186740,_0x49020a){var _0x385a68=function(_0x5e12aa){while(--_0x5e12aa){_0x186740['push'](_0x186740['shift']());}};_0x385a68(++_0x49020a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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(_0x42dd69,_0x862f4b){var _0x151a64=function(_0x19c9f0){while(--_0x19c9f0){_0x42dd69['push'](_0x42dd69['shift']());}};_0x151a64(++_0x862f4b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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 4a4ec74..676b942 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 _0x14d1=['../client','getVoiceQueueRtPauses'];(function(_0x96ce79,_0x296c8c){var _0x1efff5=function(_0xd4b2bd){while(--_0xd4b2bd){_0x96ce79['push'](_0x96ce79['shift']());}};_0x1efff5(++_0x296c8c);}(_0x14d1,0x184));var _0x114d=function(_0x267872,_0x4cdeac){_0x267872=_0x267872-0x0;var _0x3dc218=_0x14d1[_0x267872];return _0x3dc218;};'use strict';var client=require(_0x114d('0x0'));exports['getVoiceQueueRtPauses']=function(_0x43241a){return function(){return client['Request']('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x43241a,'paused':!![]},'raw':!![]},'log':_0x114d('0x1')});};}; \ No newline at end of file +var _0xbc3d=['../client','getVoiceQueueRtPauses','GetVoiceQueueRtPauses'];(function(_0x29caf2,_0x517e50){var _0x46ed50=function(_0x1f3f3c){while(--_0x1f3f3c){_0x29caf2['push'](_0x29caf2['shift']());}};_0x46ed50(++_0x517e50);}(_0xbc3d,0x1b0));var _0xdbc3=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xbc3d[_0x122096];return _0x3d1966;};'use strict';var client=require(_0xdbc3('0x0'));exports[_0xdbc3('0x1')]=function(_0x50977f){return function(){return client['Request'](_0xdbc3('0x2'),{'options':{'where':{'VoiceQueueId':_0x50977f,'paused':!![]},'raw':!![]},'log':_0xdbc3('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 03d1967..cab9e1a 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x3d09e3,_0x18a724){var _0x1e5909=function(_0x484862){while(--_0x484862){_0x3d09e3['push'](_0x3d09e3['shift']());}};_0x1e5909(++_0x18a724);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x396c3a,_0x18f378){var _0x24b7f6=function(_0x2377c6){while(--_0x2377c6){_0x396c3a['push'](_0x396c3a['shift']());}};_0x24b7f6(++_0x18f378);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 03de114..30d46f5 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 _0x15d8=['CreateVoiceTransferReport','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfereechannel','transfereecalleridname','transfereeaccountcode','transfereeexten','isexternal','attendedTransfer','origtransferercalleridname','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','transfers','Request'];(function(_0x447761,_0x36a6f3){var _0x4d4904=function(_0x5a0811){while(--_0x5a0811){_0x447761['push'](_0x447761['shift']());}};_0x4d4904(++_0x36a6f3);}(_0x15d8,0xf1));var _0x815d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x15d8[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x815d('0x0')]={};exports['blindTransfer']=function(_0x475d20){return client[_0x815d('0x1')](_0x815d('0x2'),{'body':{'result':_0x475d20[_0x815d('0x3')],'transfererchannel':_0x475d20['transfererchannel'],'transferercalleridnum':_0x475d20[_0x815d('0x4')],'transferercalleridname':_0x475d20[_0x815d('0x5')],'transfererconnectedlinenum':_0x475d20[_0x815d('0x6')],'transfererconnectedlinename':_0x475d20[_0x815d('0x7')],'transfereraccountcode':_0x475d20[_0x815d('0x8')],'transferercontext':_0x475d20[_0x815d('0x9')],'transfererexten':_0x475d20['transfererexten'],'transfererlinkedid':_0x475d20['transfererlinkedid'],'transfereechannel':_0x475d20[_0x815d('0xa')],'transfereecalleridnum':_0x475d20['transfereecalleridnum'],'transfereecalleridname':_0x475d20[_0x815d('0xb')],'transfereeconnectedlinenum':_0x475d20['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x475d20['transfereeconnectedlinename'],'transfereeaccountcode':_0x475d20[_0x815d('0xc')],'transfereecontext':_0x475d20['transfereecontext'],'transfereeexten':_0x475d20[_0x815d('0xd')],'transfereelinkedid':_0x475d20['transfereelinkedid'],'isexternal':_0x475d20[_0x815d('0xe')],'context':_0x475d20['context'],'extension':_0x475d20['extension'],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports[_0x815d('0xf')]=function(_0x3b9351){return client['Request'](_0x815d('0x2'),{'body':{'result':_0x3b9351['result'],'transfererchannel':_0x3b9351['origtransfererchannel'],'transferercalleridnum':_0x3b9351['origtransferercalleridnum'],'transferercalleridname':_0x3b9351[_0x815d('0x10')],'transfererconnectedlinenum':_0x3b9351['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x3b9351['secondtransfererconnectedlinename'],'transfereraccountcode':_0x3b9351['origtransfereraccountcode'],'transferercontext':_0x3b9351['secondtransferercontext'],'transfererexten':_0x3b9351['secondtransfererexten'],'transfererlinkedid':_0x3b9351['origtransfererlinkedid'],'transfereechannel':_0x3b9351[_0x815d('0x11')],'transfereecalleridnum':_0x3b9351[_0x815d('0x12')],'transfereecalleridname':_0x3b9351[_0x815d('0x13')],'transfereeconnectedlinenum':_0x3b9351['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x3b9351[_0x815d('0x14')],'transfereeaccountcode':_0x3b9351[_0x815d('0x15')],'transfereecontext':_0x3b9351[_0x815d('0x16')],'transfereeexten':_0x3b9351[_0x815d('0x17')],'transfereelinkedid':_0x3b9351[_0x815d('0x18')],'isexternal':_0x3b9351[_0x815d('0xe')],'context':_0x3b9351[_0x815d('0x19')],'extension':_0x3b9351['origtransfererexten'],'type':_0x815d('0x1a')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x1012=['transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','transfers','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','extension','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext'];(function(_0x48df04,_0x1522b1){var _0x4de5fa=function(_0x3ae6db){while(--_0x3ae6db){_0x48df04['push'](_0x48df04['shift']());}};_0x4de5fa(++_0x1522b1);}(_0x1012,0xc2));var _0x2101=function(_0x3a0ebd,_0x47f368){_0x3a0ebd=_0x3a0ebd-0x0;var _0x51a660=_0x1012[_0x3a0ebd];return _0x51a660;};'use strict';var client=require('../client');exports[_0x2101('0x0')]={};exports[_0x2101('0x1')]=function(_0x26eb53){return client[_0x2101('0x2')](_0x2101('0x3'),{'body':{'result':_0x26eb53['result'],'transfererchannel':_0x26eb53[_0x2101('0x4')],'transferercalleridnum':_0x26eb53[_0x2101('0x5')],'transferercalleridname':_0x26eb53['transferercalleridname'],'transfererconnectedlinenum':_0x26eb53[_0x2101('0x6')],'transfererconnectedlinename':_0x26eb53[_0x2101('0x7')],'transfereraccountcode':_0x26eb53[_0x2101('0x8')],'transferercontext':_0x26eb53[_0x2101('0x9')],'transfererexten':_0x26eb53[_0x2101('0xa')],'transfererlinkedid':_0x26eb53[_0x2101('0xb')],'transfereechannel':_0x26eb53[_0x2101('0xc')],'transfereecalleridnum':_0x26eb53[_0x2101('0xd')],'transfereecalleridname':_0x26eb53[_0x2101('0xe')],'transfereeconnectedlinenum':_0x26eb53[_0x2101('0xf')],'transfereeconnectedlinename':_0x26eb53[_0x2101('0x10')],'transfereeaccountcode':_0x26eb53[_0x2101('0x11')],'transfereecontext':_0x26eb53[_0x2101('0x12')],'transfereeexten':_0x26eb53['transfereeexten'],'transfereelinkedid':_0x26eb53[_0x2101('0x13')],'isexternal':_0x26eb53['isexternal'],'context':_0x26eb53['context'],'extension':_0x26eb53[_0x2101('0x14')],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports[_0x2101('0x15')]=function(_0x3809fd){return client[_0x2101('0x2')](_0x2101('0x3'),{'body':{'result':_0x3809fd['result'],'transfererchannel':_0x3809fd[_0x2101('0x16')],'transferercalleridnum':_0x3809fd[_0x2101('0x17')],'transferercalleridname':_0x3809fd[_0x2101('0x18')],'transfererconnectedlinenum':_0x3809fd[_0x2101('0x19')],'transfererconnectedlinename':_0x3809fd[_0x2101('0x1a')],'transfereraccountcode':_0x3809fd['origtransfereraccountcode'],'transferercontext':_0x3809fd[_0x2101('0x1b')],'transfererexten':_0x3809fd['secondtransfererexten'],'transfererlinkedid':_0x3809fd['origtransfererlinkedid'],'transfereechannel':_0x3809fd['transfertargetchannel'],'transfereecalleridnum':_0x3809fd[_0x2101('0x1c')],'transfereecalleridname':_0x3809fd['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x3809fd[_0x2101('0x1d')],'transfereeconnectedlinename':_0x3809fd[_0x2101('0x1e')],'transfereeaccountcode':_0x3809fd[_0x2101('0x1f')],'transfereecontext':_0x3809fd[_0x2101('0x20')],'transfereeexten':_0x3809fd['transfertargetexten'],'transfereelinkedid':_0x3809fd[_0x2101('0x21')],'isexternal':_0x3809fd[_0x2101('0x22')],'context':_0x3809fd[_0x2101('0x23')],'extension':_0x3809fd[_0x2101('0x24')],'type':'attended'},'log':_0x2101('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 166b07e..20b5f0a 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 _0x5e0e=['moment','../../../config/environment','../properties','listen','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','isConnected','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Action','catch','message','error','command','then','content','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','total','type','unmanaged','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','length','undefined','values','voicechannel','find','channels','uniqueid','channel','format','%s.%s','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','StopMixMonitor','filename','wav','StopMixMonitor\x20Success','queueChannels','Hangup','Redirect','exten','context','telephones','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','validate','bluebird'];(function(_0x2b5a2e,_0x17e793){var _0x41f02f=function(_0x4786e3){while(--_0x4786e3){_0x2b5a2e['push'](_0x2b5a2e['shift']());}};_0x41f02f(++_0x17e793);}(_0x5e0e,0x89));var _0xe5e0=function(_0x2657fa,_0x15fab8){_0x2657fa=_0x2657fa-0x0;var _0x555b92=_0x5e0e[_0x2657fa];return _0x555b92;};'use strict';var _=require(_0xe5e0('0x0'));var util=require(_0xe5e0('0x1'));var jayson=require('jayson/promise');var schema=require(_0xe5e0('0x2'));var BPromise=require(_0xe5e0('0x3'));var moment=require(_0xe5e0('0x4'));var config=require(_0xe5e0('0x5'));var properties=require(_0xe5e0('0x6'));var ami=require('../ami');exports[_0xe5e0('0x7')]=function(_0x52407b,_0x239262,_0x3e564e){return new BPromise(function(_0x2ff9ac,_0x1a4c51){var _0xa91224={'QueuePause':function(_0x156c30){return new Promise(function(_0x59a81f,_0x4059cf){var _0x29199a=util['format'](_0xe5e0('0x8'),_0xe5e0('0x9'),_0x156c30[_0xe5e0('0xa')]);if(_0x52407b[_0xe5e0('0xb')]&&_0x52407b[_0xe5e0('0xb')][_0x29199a]&&_0x52407b[_0xe5e0('0xb')][_0x29199a][_0xe5e0('0xc')]){_0x52407b[_0xe5e0('0xb')][_0x29199a][_0xe5e0('0xd')]();}if(_0x52407b[_0xe5e0('0xe')][_0x29199a]){_0x52407b[_0xe5e0('0xe')][_0x29199a][_0xe5e0('0xf')]({'statePause':_0x156c30[_0xe5e0('0x10')]?!![]:![]});}_0x59a81f({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x5cabeb){var _0x43638e=this;return new Promise(function(_0x1100cc,_0x24f33d){if(ami[_0xe5e0('0x11')]()==![]){return _0x24f33d(_0x43638e['error'](0x1f4,[config[_0xe5e0('0x12')]['ip'],config[_0xe5e0('0x12')][_0xe5e0('0x13')],_0xe5e0('0x14')][_0xe5e0('0x15')]('\x20')));}_0x5cabeb=_[_0xe5e0('0x16')](_0x5cabeb,_[_0xe5e0('0x17')](properties[_0xe5e0('0x18')]));_0x5cabeb[_0xe5e0('0x19')]='Reload';return ami[_0xe5e0('0x1a')](_0x5cabeb)['then'](function(_0x417077){_0x1100cc({'code':0xc8,'message':_0x417077['message']});})[_0xe5e0('0x1b')](function(_0x150c3a){_0x24f33d(_0x43638e['error'](0x1f5,_0x150c3a[_0xe5e0('0x1c')]));});});},'Command':function(_0x4a7ea4){var _0xa81bd4=this;return new Promise(function(_0xce7366,_0x3a2480){if(ami[_0xe5e0('0x11')]()==![]){return _0x3a2480(_0xa81bd4[_0xe5e0('0x1d')](0x1f4,[config[_0xe5e0('0x12')]['ip'],config[_0xe5e0('0x12')][_0xe5e0('0x13')],_0xe5e0('0x14')][_0xe5e0('0x15')]('\x20')));}_0x4a7ea4=_[_0xe5e0('0x16')](_0x4a7ea4,_0xe5e0('0x1e'));_0x4a7ea4[_0xe5e0('0x19')]='Command';return ami['Action'](_0x4a7ea4)[_0xe5e0('0x1f')](function(_0x228368){_0xce7366({'code':0xc8,'message':_0x228368[_0xe5e0('0x20')]});})[_0xe5e0('0x1b')](function(_0x3596ca){_0x3a2480(_0xa81bd4[_0xe5e0('0x1d')](0x1f5,_0x3596ca[_0xe5e0('0x1c')]));});});},'VoiceQueues':function(_0x48071c){return new Promise(function(_0xf45724,_0x5df2be){var _0x332c4e=[];for(var _0x6f21de in _0x52407b[_0xe5e0('0x21')]){if(_0x52407b[_0xe5e0('0x21')][_0xe5e0('0x22')](_0x6f21de)){var _0x4867f2=_0x52407b['voiceQueues'][_0x6f21de];var _0x25fe90={'id':_0x4867f2['id'],'name':_0x4867f2['name'],'strategy':_0x4867f2[_0xe5e0('0x23')],'answered':_0x4867f2[_0xe5e0('0x24')],'available':_0x4867f2[_0xe5e0('0x25')],'loggedIn':_0x4867f2[_0xe5e0('0x26')],'pTalking':_0x4867f2[_0xe5e0('0x27')],'sumBillable':_0x4867f2[_0xe5e0('0x28')],'sumDuration':_0x4867f2['sumDuration'],'sumHoldTime':_0x4867f2[_0xe5e0('0x29')]||0x0,'talking':_0x4867f2['talking'],'total':_0x4867f2[_0xe5e0('0x2a')],'type':_0x4867f2[_0xe5e0('0x2b')],'unmanaged':_0x4867f2[_0xe5e0('0x2c')],'abandoned':_0x4867f2['abandoned'],'waiting':_0x4867f2[_0xe5e0('0x2d')],'loggedInDb':_0x4867f2[_0xe5e0('0x2e')]};if(_0x4867f2[_0xe5e0('0x2b')]===_0xe5e0('0x2f')){_0x25fe90[_0xe5e0('0x30')]=_0x4867f2['dialActive'];_0x25fe90[_0xe5e0('0x31')]=_0x4867f2[_0xe5e0('0x31')];_0x25fe90[_0xe5e0('0x32')]=_0x4867f2[_0xe5e0('0x32')];_0x25fe90['dialOriginateCallerIdNumber']=_0x4867f2[_0xe5e0('0x33')];_0x25fe90[_0xe5e0('0x34')]=_0x4867f2[_0xe5e0('0x34')];_0x25fe90[_0xe5e0('0x35')]=_0x4867f2[_0xe5e0('0x35')];_0x25fe90[_0xe5e0('0x36')]=_0x4867f2[_0xe5e0('0x36')];_0x25fe90[_0xe5e0('0x37')]=_0x4867f2[_0xe5e0('0x37')];_0x25fe90[_0xe5e0('0x38')]=_0x4867f2[_0xe5e0('0x38')];_0x25fe90[_0xe5e0('0x39')]=_0x4867f2[_0xe5e0('0x39')];_0x25fe90[_0xe5e0('0x3a')]=_0x4867f2[_0xe5e0('0x3a')];_0x25fe90[_0xe5e0('0x3b')]=_0x4867f2['outboundCongestionCallsDay'];_0x25fe90['outboundDropCallsDayACS']=_0x4867f2[_0xe5e0('0x3c')];_0x25fe90[_0xe5e0('0x3d')]=_0x4867f2[_0xe5e0('0x3d')];_0x25fe90['outboundDropCallsDayTimeout']=_0x4867f2[_0xe5e0('0x3e')];_0x25fe90[_0xe5e0('0x3f')]=_0x4867f2[_0xe5e0('0x3f')];_0x25fe90['outboundNoSuchCallsDay']=_0x4867f2[_0xe5e0('0x40')];_0x25fe90[_0xe5e0('0x41')]=_0x4867f2[_0xe5e0('0x41')];_0x25fe90[_0xe5e0('0x42')]=_0x4867f2['outboundReCallsDay'];_0x25fe90[_0xe5e0('0x43')]=_0x4867f2['outboundRejectCallsDay'];_0x25fe90[_0xe5e0('0x44')]=_0x4867f2['outboundUnknownCallsDay'];_0x25fe90[_0xe5e0('0x45')]=_0x4867f2['predictiveIntervalAnsweredCalls'];_0x25fe90[_0xe5e0('0x46')]=_0x4867f2[_0xe5e0('0x46')];_0x25fe90['predictiveIntervalAvgTalktime']=_0x4867f2[_0xe5e0('0x47')];_0x25fe90[_0xe5e0('0x48')]=_0x4867f2[_0xe5e0('0x48')];_0x25fe90[_0xe5e0('0x49')]=_0x4867f2[_0xe5e0('0x49')];_0x25fe90[_0xe5e0('0x4a')]=_0x4867f2[_0xe5e0('0x4a')];_0x25fe90[_0xe5e0('0x4b')]=_0x4867f2[_0xe5e0('0x4b')];_0x25fe90[_0xe5e0('0x4c')]=_0x4867f2[_0xe5e0('0x4c')];_0x25fe90['predictiveIntervalMultiplicativeFactor']=_0x4867f2[_0xe5e0('0x4d')];_0x25fe90[_0xe5e0('0x4e')]=_0x4867f2[_0xe5e0('0x4e')];_0x25fe90[_0xe5e0('0x4f')]=_0x4867f2[_0xe5e0('0x4f')];_0x25fe90['predictiveIntervalTotalCalls']=_0x4867f2[_0xe5e0('0x50')];_0x25fe90[_0xe5e0('0x1c')]=_0x4867f2[_0xe5e0('0x1c')];_0x25fe90[_0xe5e0('0x51')]=_0x4867f2['originated'];_0x25fe90[_0xe5e0('0x52')]=_0x4867f2[_0xe5e0('0x52')];_0x25fe90[_0xe5e0('0x53')]=_0x4867f2[_0xe5e0('0x53')];_0x25fe90[_0xe5e0('0x54')]=_0x4867f2['erlangAbandonmentRate'];_0x25fe90[_0xe5e0('0x55')]=_0x4867f2['erlangBusyFactor'];_0x25fe90['startPredictive']=_0x4867f2[_0xe5e0('0x56')];_0x25fe90[_0xe5e0('0x57')]=_0x4867f2[_0xe5e0('0x57')];}if(_0x4867f2[_0xe5e0('0x58')]){_0x25fe90[_0xe5e0('0x58')]={'id':_0x4867f2['Trunk']['id'],'name':_0x4867f2[_0xe5e0('0x58')][_0xe5e0('0xa')],'active':_0x4867f2['Trunk']['active'],'callerid':_0x4867f2[_0xe5e0('0x58')][_0xe5e0('0x59')]};}if(_0x4867f2[_0xe5e0('0x5a')]){_0x25fe90[_0xe5e0('0x5a')]={'id':_0x4867f2[_0xe5e0('0x5a')]['id'],'name':_0x4867f2['Interval'][_0xe5e0('0xa')]};}_0x332c4e[_0xe5e0('0x5b')](_0x25fe90);}}_0xf45724({'count':_0x332c4e[_0xe5e0('0x5c')],'rows':_0x332c4e});});},'UpdateVoiceQueue':function(_0x56994a){return new Promise(function(_0x3b86e1,_0x21b731){var _0x12ba02=_['find'](_0x52407b['voiceQueues'],{'id':parseInt(_0x56994a['id'])});var _0x43df1d=_['omit'](_0x56994a,['id']);if(_0x12ba02){for(var _0x3084ff in _0x43df1d){if(typeof _0x43df1d[_0x3084ff]!==_0xe5e0('0x5d')&&typeof _0x12ba02[_0x3084ff]!==_0xe5e0('0x5d')){_0x12ba02[_0x3084ff]=_0x43df1d[_0x3084ff];}}_0x3b86e1(_0x12ba02);}else{_0x21b731();}});},'VoiceChannels':function(_0x160803){return new Promise(function(_0x183e81,_0x2138ae){var _0x38fd91=_[_0xe5e0('0x5e')](_0x52407b['channels']);_0x183e81({'count':_0x38fd91['length'],'rows':_0x38fd91});});},'VoiceChannelMixMonitor':function(_0x552a9e){var _0x314ee7=this;return new Promise(function(_0x4fd77b,_0x494257){if(ami['isConnected']()==![]){return _0x494257(_0x314ee7['error'](0x1f4,[config['asterisk']['ip'],config[_0xe5e0('0x12')]['username'],_0xe5e0('0x14')]['join']('\x20')));}var _0x47974f=schema(properties[_0xe5e0('0x5f')])[_0xe5e0('0x2')](_0x552a9e);if(_0x47974f['length']>0x0){return _0x494257(_0x314ee7['error'](0x1f4,_['map'](_0x47974f,_0xe5e0('0x1c'))[_0xe5e0('0x15')](',\x20')));}var _0x3836cb=_[_0xe5e0('0x60')](_0x52407b[_0xe5e0('0x61')],{'uniqueid':_0x552a9e[_0xe5e0('0x62')]});if(_0x3836cb&&_0x3836cb[_0xe5e0('0x63')]){var _0x530d10=util[_0xe5e0('0x64')](_0xe5e0('0x65'),_0x552a9e['filename']||_0x552a9e[_0xe5e0('0x62')],_0x552a9e[_0xe5e0('0x64')]||'wav');return ami[_0xe5e0('0x1a')]({'action':_0xe5e0('0x66'),'channel':_0x3836cb[_0xe5e0('0x63')],'file':_0x530d10,'options':_0xe5e0('0x67')})[_0xe5e0('0x1f')](function(_0x38e40){var _0x4cfdd1=_[_0xe5e0('0x60')](_0x3836cb[_0xe5e0('0x68')],{'filename':_0xe5e0('0x69')+_0x530d10[_0xe5e0('0x6a')]()});if(_[_0xe5e0('0x6b')](_0x4cfdd1)){_0x3836cb['monitors'][_0xe5e0('0x5b')]({'filename':_0xe5e0('0x69')+_0x530d10['toLowerCase'](),'createdAt':moment()[_0xe5e0('0x64')](_0xe5e0('0x6c')),'mixmonitorid':_0x38e40[_0xe5e0('0x6d')],'status':_0xe5e0('0x6e')});}else{_0x4cfdd1[_0xe5e0('0x6d')]=_0x38e40[_0xe5e0('0x6d')];_0x4cfdd1[_0xe5e0('0x6f')]=_0xe5e0('0x6e');}_0x4fd77b({'code':0xc8,'message':[_0x552a9e[_0xe5e0('0x62')],_0xe5e0('0x70'),_0x38e40['mixmonitorid']][_0xe5e0('0x15')]('\x20'),'mixmonitorid':_0x38e40[_0xe5e0('0x6d')]});})['catch'](function(_0x44d6bd){_0x494257(_0x314ee7[_0xe5e0('0x1d')](0x1f5,[_0x552a9e[_0xe5e0('0x62')],_0x44d6bd[_0xe5e0('0x1c')][_0xe5e0('0x6a')]()][_0xe5e0('0x15')]('\x20')));});}else{return _0x494257(_0x314ee7[_0xe5e0('0x1d')](0x1f5,_0xe5e0('0x71')));}});},'VoiceChannelStopMixMonitor':function(_0x12e5a3){var _0x38c0e8=this;return new Promise(function(_0x21f7ed,_0x37c521){if(ami[_0xe5e0('0x11')]()==![]){return _0x37c521(_0x38c0e8[_0xe5e0('0x1d')](0x1f4,[config[_0xe5e0('0x12')]['ip'],config[_0xe5e0('0x12')][_0xe5e0('0x13')],'ami\x20disconnected'][_0xe5e0('0x15')]('\x20')));}var _0xe7caf6=schema(properties[_0xe5e0('0x5f')])['validate'](_0x12e5a3);if(_0xe7caf6[_0xe5e0('0x5c')]>0x0){return _0x37c521(_0x38c0e8[_0xe5e0('0x1d')](0x1f4,_[_0xe5e0('0x72')](_0xe7caf6,_0xe5e0('0x1c'))[_0xe5e0('0x15')](',\x20')));}var _0x13932c=_[_0xe5e0('0x60')](_0x52407b[_0xe5e0('0x61')],{'uniqueid':_0x12e5a3[_0xe5e0('0x62')]});if(_0x13932c){return BPromise[_0xe5e0('0x73')]()[_0xe5e0('0x1f')](function(){if(_0x13932c['channel']){return ami[_0xe5e0('0x1a')]({'action':_0xe5e0('0x74'),'channel':_0x13932c[_0xe5e0('0x63')],'mixmonitorid':_0x12e5a3[_0xe5e0('0x6d')]})[_0xe5e0('0x1b')](function(_0x5b15fc){});}})[_0xe5e0('0x1f')](function(){if(_0x13932c['destinationchannel']){return ami[_0xe5e0('0x1a')]({'action':_0xe5e0('0x74'),'channel':_0x13932c['destinationchannel'],'mixmonitorid':_0x12e5a3[_0xe5e0('0x6d')]})[_0xe5e0('0x1b')](function(_0x596990){});}})[_0xe5e0('0x1f')](function(_0x312293){var _0x24f370=_[_0xe5e0('0x60')](_0x13932c[_0xe5e0('0x68')],{'mixmonitorid':_0x12e5a3['mixmonitorid']});if(_0x24f370){_0x24f370[_0xe5e0('0x6f')]='stop';}})[_0xe5e0('0x1f')](function(){var _0x52106a=util[_0xe5e0('0x64')](_0xe5e0('0x65'),_0x12e5a3[_0xe5e0('0x75')]||_0x12e5a3[_0xe5e0('0x62')],_0x12e5a3[_0xe5e0('0x64')]||_0xe5e0('0x76'));var _0x17fb65=_[_0xe5e0('0x60')](_0x13932c['monitors'],{'filename':_0xe5e0('0x69')+_0x52106a[_0xe5e0('0x6a')]()});if(_0x17fb65){_0x17fb65[_0xe5e0('0x6f')]='stop';}})[_0xe5e0('0x1f')](function(){_0x21f7ed({'code':0xc8,'message':[_0x12e5a3[_0xe5e0('0x62')],_0xe5e0('0x77')]['join']('\x20')});})['catch'](function(_0x3803d8){_0x37c521(_0x38c0e8[_0xe5e0('0x1d')](0x1f5,[_0x12e5a3[_0xe5e0('0x62')],_0x3803d8[_0xe5e0('0x1c')]['toLowerCase']()][_0xe5e0('0x15')]('\x20')));});}else{return _0x37c521(_0x38c0e8['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x4d4908){return new Promise(function(_0xd0bb59,_0x41df32){var _0x49a874=_[_0xe5e0('0x5e')](_0x52407b[_0xe5e0('0x78')]);_0xd0bb59({'count':_0x49a874[_0xe5e0('0x5c')],'rows':_0x49a874});});},'VoiceQueuesChannel':function(_0x214df7){var _0x16cfe1=this;return new Promise(function(_0x16ac31,_0x1e3281){var _0x105b24=schema(properties['voicequeuechannel'])[_0xe5e0('0x2')](_0x214df7);if(_0x105b24[_0xe5e0('0x5c')]>0x0){return _0x1e3281(_0x16cfe1[_0xe5e0('0x1d')](0x1f4,_['map'](_0x105b24,_0xe5e0('0x1c'))[_0xe5e0('0x15')](',\x20')));}var _0x5cdbbf=_['find'](_0x52407b['queueChannels'],{'uniqueid':_0x214df7[_0xe5e0('0x62')]});if(_0x5cdbbf){_0x16ac31(_0x5cdbbf);}else{return _0x1e3281(_0x16cfe1[_0xe5e0('0x1d')](0x1f5,_0xe5e0('0x71')));}});},'VoiceQueuesChannelHangup':function(_0x296d5c){var _0x394a7f=this;return new Promise(function(_0x34caa4,_0xc140c9){if(ami[_0xe5e0('0x11')]()==![]){return _0xc140c9(_0x394a7f['error'](0x1f4,[config['asterisk']['ip'],config[_0xe5e0('0x12')]['username'],'ami\x20disconnected']['join']('\x20')));}var _0x58dcef=schema(properties['voicequeuechannelhangup'])[_0xe5e0('0x2')](_0x296d5c);if(_0x58dcef['length']>0x0){return _0xc140c9(_0x394a7f[_0xe5e0('0x1d')](0x1f4,_[_0xe5e0('0x72')](_0x58dcef,_0xe5e0('0x1c'))['join'](',\x20')));}var _0x261a5a=_[_0xe5e0('0x60')](_0x52407b[_0xe5e0('0x78')],{'uniqueid':_0x296d5c['uniqueid']});if(_0x261a5a&&_0x261a5a[_0xe5e0('0x63')]){return ami[_0xe5e0('0x1a')]({'action':_0xe5e0('0x79'),'channel':_0x261a5a[_0xe5e0('0x63')]})['then'](function(_0x12d9f5){_0x34caa4({'code':0xc8,'message':[_0x296d5c[_0xe5e0('0x62')],_0x12d9f5[_0xe5e0('0x1c')]['toLowerCase']()][_0xe5e0('0x15')]('\x20')});})[_0xe5e0('0x1b')](function(_0x135bad){_0xc140c9(_0x394a7f[_0xe5e0('0x1d')](0x1f5,[_0x296d5c[_0xe5e0('0x62')],_0x135bad['message'][_0xe5e0('0x6a')]()]['join']('\x20')));});}else{return _0xc140c9(_0x394a7f[_0xe5e0('0x1d')](0x1f5,_0xe5e0('0x71')));}});},'VoiceQueuesChannelRedirect':function(_0x44aa4f){var _0x5a9b7a=this;return new Promise(function(_0x5365d7,_0x3ddad0){if(ami['isConnected']()==![]){return _0x3ddad0(_0x5a9b7a[_0xe5e0('0x1d')](0x1f4,[config['asterisk']['ip'],config[_0xe5e0('0x12')][_0xe5e0('0x13')],_0xe5e0('0x14')][_0xe5e0('0x15')]('\x20')));}var _0xa5b53d=schema(properties['voicequeuechannelredirect'])[_0xe5e0('0x2')](_0x44aa4f);if(_0xa5b53d[_0xe5e0('0x5c')]>0x0){return _0x3ddad0(_0x5a9b7a['error'](0x1f4,_[_0xe5e0('0x72')](_0xa5b53d,_0xe5e0('0x1c'))[_0xe5e0('0x15')](',\x20')));}var _0x520691=_['find'](_0x52407b[_0xe5e0('0x78')],{'uniqueid':_0x44aa4f[_0xe5e0('0x62')]});if(_0x520691&&_0x520691[_0xe5e0('0x63')]){return ami[_0xe5e0('0x1a')]({'action':_0xe5e0('0x7a'),'channel':_0x520691[_0xe5e0('0x63')],'exten':_0x44aa4f[_0xe5e0('0x7b')],'context':_0x44aa4f[_0xe5e0('0x7c')]||_0x520691['context'],'priority':0x1})[_0xe5e0('0x1f')](function(_0x4b8620){_0x5365d7({'code':0xc8,'message':[_0x44aa4f[_0xe5e0('0x62')],_0x4b8620['message']['toLowerCase']()][_0xe5e0('0x15')]('\x20')});})[_0xe5e0('0x1b')](function(_0x3ab8ca){_0x3ddad0(_0x5a9b7a[_0xe5e0('0x1d')](0x1f5,[_0x44aa4f['uniqueid'],_0x3ab8ca[_0xe5e0('0x1c')][_0xe5e0('0x6a')]()]['join']('\x20')));});}else{return _0x3ddad0(_0x5a9b7a[_0xe5e0('0x1d')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x39f0fc){return new Promise(function(_0x309012,_0x59c32f){var _0x3fb1c3=_[_0xe5e0('0x5e')](_0x52407b[_0xe5e0('0xe')]);_0x309012({'count':_0x3fb1c3['length'],'rows':_0x3fb1c3});});},'Telephones':function(_0x47b2e7){return new Promise(function(_0x27ae6a,_0x56eac2){var _0x272856=_[_0xe5e0('0x5e')](_0x52407b[_0xe5e0('0x7d')]);_0x27ae6a({'count':_0x272856[_0xe5e0('0x5c')],'rows':_0x272856});});},'Trunks':function(_0x2233d6){return new Promise(function(_0x430b70,_0x26e9dc){var _0x3ecced=_['values'](_0x52407b['trunks']);_0x430b70({'count':_0x3ecced[_0xe5e0('0x5c')],'rows':_0x3ecced});});},'OutboundChannels':function(_0x57c295){return new Promise(function(_0x24cbd1,_0x3e719e){var _0x4c47e7=_[_0xe5e0('0x5e')](_0x52407b[_0xe5e0('0x7e')]);_0x24cbd1({'count':_0x4c47e7[_0xe5e0('0x5c')],'rows':_0x4c47e7});});},'Outbound':function(_0x42523b){return new Promise(function(_0x282fb6,_0x1c1318){_0x282fb6(_0x52407b[_0xe5e0('0x2f')]);});},'Campaigns':function(_0x25991a){return new Promise(function(_0x5b2c5d,_0x491dd3){var _0x5d5bd4=_[_0xe5e0('0x5e')](_0x52407b[_0xe5e0('0x7f')]);_0x5b2c5d({'count':_0x5d5bd4[_0xe5e0('0x5c')],'rows':_0x5d5bd4});});},'VoiceQueuesPreview':function(_0x4fcf7e){var _0x520e3c=this;return new Promise(function(_0x102ea7,_0x1d9a34){_0x239262[_0xe5e0('0x80')](_0x4fcf7e['id'])[_0xe5e0('0x1f')](function(_0x54b7c2){_0x102ea7({'code':0xc8,'message':_0x54b7c2[_0xe5e0('0x1c')]});})[_0xe5e0('0x1b')](function(_0x28da71){_0x1d9a34(_0x520e3c[_0xe5e0('0x1d')](0x1f4,_0x28da71[_0xe5e0('0x1c')]));});});},'EventManager':function(_0x1a558f){var _0x3280ed=this;return new Promise(function(_0x31023a,_0x2bf02c){if(!_0x1a558f[_0xe5e0('0x81')]){return _0x2bf02c(_0x3280ed[_0xe5e0('0x1d')](0x1f4,_0xe5e0('0x82')));}ami[_0xe5e0('0x83')](_0xe5e0('0x84')+_0x1a558f[_0xe5e0('0x81')],_0x1a558f['message']);_0x31023a({'code':0xc8,'message':_0x1a558f});});},'FaxAccounts':function(_0x2f7df8){return new Promise(function(_0x54922c,_0x35fbd6){var _0x568aca=_[_0xe5e0('0x5e')](_0x52407b[_0xe5e0('0x85')]);_0x54922c({'count':_0x568aca[_0xe5e0('0x5c')],'rows':_0x568aca});});},'SendFax':function(_0x36231d){var _0x6989a6=this;return new Promise(function(_0x524ab0,_0x411720){_0x3e564e[_0xe5e0('0x86')](_0x36231d)['then'](function(_0x3a20e4){_0x524ab0({'code':0xc8,'message':_0x3a20e4[_0xe5e0('0x1c')]});})['catch'](function(_0xb6b336){_0x411720(_0x6989a6['error'](0x1f4,_0xb6b336['message']));});});},'CheckAfterSend':function(_0x56f40a){var _0x58ca90=this;return new Promise(function(_0x2794b0,_0x371ef5){_0x3e564e[_0xe5e0('0x87')](_0x56f40a)[_0xe5e0('0x1f')](function(_0x597cdd){_0x2794b0({'code':0xc8,'message':_0x597cdd[_0xe5e0('0x1c')]});})['catch'](function(_0xc922ac){_0x371ef5(_0x58ca90['error'](0x1f4,_0xc922ac[_0xe5e0('0x1c')]));});});}};var _0x5bfaf0=jayson[_0xe5e0('0x88')](_0xa91224)[_0xe5e0('0x89')]();_0x5bfaf0['on'](_0xe5e0('0x1d'),function(_0xc804a2){return _0x1a4c51(_0xc804a2);});_0x5bfaf0['listen'](0x232a,_0xe5e0('0x8a'),function(){console[_0xe5e0('0x8b')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x2ff9ac(_0xe5e0('0x8c')+0x232a);});});}; \ No newline at end of file +var _0xc9c3=['exten','context','trunks','outboundChannels','run','event','Event\x20name\x20mandatory','custom:','faxAccounts','send','checkAfterSend','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','agents','updateStatusRealtime','pause','asterisk','username','ami\x20disconnected','join','pick','module','then','message','catch','error','command','action','Command','Action','content','voiceQueues','hasOwnProperty','strategy','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','find','omit','undefined','values','channels','length','isConnected','voicechannel','validate','map','uniqueid','channel','wav','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','push','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','destinationchannel','StopMixMonitor','status','stop','%s.%s','filename','StopMixMonitor\x20Success','voicequeuechannel','voicequeuechannelhangup','queueChannels','Redirect'];(function(_0x2bdf29,_0x40cab0){var _0x60cb83=function(_0x4bc761){while(--_0x4bc761){_0x2bdf29['push'](_0x2bdf29['shift']());}};_0x60cb83(++_0x40cab0);}(_0xc9c3,0x96));var _0x3c9c=function(_0x36bcca,_0x7b315f){_0x36bcca=_0x36bcca-0x0;var _0x3374c7=_0xc9c3[_0x36bcca];return _0x3374c7;};'use strict';var _=require('lodash');var util=require('util');var jayson=require(_0x3c9c('0x0'));var schema=require('validate');var BPromise=require(_0x3c9c('0x1'));var moment=require(_0x3c9c('0x2'));var config=require(_0x3c9c('0x3'));var properties=require(_0x3c9c('0x4'));var ami=require(_0x3c9c('0x5'));exports[_0x3c9c('0x6')]=function(_0x143bfe,_0x512e80,_0x48b219){return new BPromise(function(_0x5c86bd,_0x5a2836){var _0x3ca0ce={'QueuePause':function(_0xc35e75){return new Promise(function(_0x2eb946,_0x3e5ccb){var _0x355ef3=util[_0x3c9c('0x7')](_0x3c9c('0x8'),_0x3c9c('0x9'),_0xc35e75[_0x3c9c('0xa')]);if(_0x143bfe['timers']&&_0x143bfe[_0x3c9c('0xb')][_0x355ef3]&&_0x143bfe[_0x3c9c('0xb')][_0x355ef3]['timer']){_0x143bfe[_0x3c9c('0xb')][_0x355ef3]['updateAcw']();}if(_0x143bfe[_0x3c9c('0xc')][_0x355ef3]){_0x143bfe[_0x3c9c('0xc')][_0x355ef3][_0x3c9c('0xd')]({'statePause':_0xc35e75[_0x3c9c('0xe')]?!![]:![]});}_0x2eb946({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x50cf96){var _0x4a60d9=this;return new Promise(function(_0x857b1f,_0x59bbc6){if(ami['isConnected']()==![]){return _0x59bbc6(_0x4a60d9['error'](0x1f4,[config[_0x3c9c('0xf')]['ip'],config['asterisk'][_0x3c9c('0x10')],_0x3c9c('0x11')][_0x3c9c('0x12')]('\x20')));}_0x50cf96=_[_0x3c9c('0x13')](_0x50cf96,_['keys'](properties[_0x3c9c('0x14')]));_0x50cf96['action']='Reload';return ami['Action'](_0x50cf96)[_0x3c9c('0x15')](function(_0x32d94a){_0x857b1f({'code':0xc8,'message':_0x32d94a[_0x3c9c('0x16')]});})[_0x3c9c('0x17')](function(_0x3e63e0){_0x59bbc6(_0x4a60d9[_0x3c9c('0x18')](0x1f5,_0x3e63e0[_0x3c9c('0x16')]));});});},'Command':function(_0x56fa79){var _0x15a90a=this;return new Promise(function(_0x4c7122,_0x461711){if(ami['isConnected']()==![]){return _0x461711(_0x15a90a[_0x3c9c('0x18')](0x1f4,[config[_0x3c9c('0xf')]['ip'],config['asterisk'][_0x3c9c('0x10')],_0x3c9c('0x11')][_0x3c9c('0x12')]('\x20')));}_0x56fa79=_['pick'](_0x56fa79,_0x3c9c('0x19'));_0x56fa79[_0x3c9c('0x1a')]=_0x3c9c('0x1b');return ami[_0x3c9c('0x1c')](_0x56fa79)[_0x3c9c('0x15')](function(_0x3bc5c4){_0x4c7122({'code':0xc8,'message':_0x3bc5c4[_0x3c9c('0x1d')]});})[_0x3c9c('0x17')](function(_0x509bf7){_0x461711(_0x15a90a[_0x3c9c('0x18')](0x1f5,_0x509bf7['message']));});});},'VoiceQueues':function(_0x497145){return new Promise(function(_0xe04fca,_0x4ca078){var _0x527bb9=[];for(var _0x379880 in _0x143bfe[_0x3c9c('0x1e')]){if(_0x143bfe[_0x3c9c('0x1e')][_0x3c9c('0x1f')](_0x379880)){var _0x4c283d=_0x143bfe[_0x3c9c('0x1e')][_0x379880];var _0x65b831={'id':_0x4c283d['id'],'name':_0x4c283d['name'],'strategy':_0x4c283d[_0x3c9c('0x20')],'answered':_0x4c283d['answered'],'available':_0x4c283d['available'],'loggedIn':_0x4c283d[_0x3c9c('0x21')],'pTalking':_0x4c283d[_0x3c9c('0x22')],'sumBillable':_0x4c283d[_0x3c9c('0x23')],'sumDuration':_0x4c283d[_0x3c9c('0x24')],'sumHoldTime':_0x4c283d[_0x3c9c('0x25')]||0x0,'talking':_0x4c283d['talking'],'total':_0x4c283d[_0x3c9c('0x26')],'type':_0x4c283d['type'],'unmanaged':_0x4c283d[_0x3c9c('0x27')],'abandoned':_0x4c283d[_0x3c9c('0x28')],'waiting':_0x4c283d[_0x3c9c('0x29')],'loggedInDb':_0x4c283d[_0x3c9c('0x2a')]};if(_0x4c283d['type']===_0x3c9c('0x2b')){_0x65b831[_0x3c9c('0x2c')]=_0x4c283d[_0x3c9c('0x2c')];_0x65b831[_0x3c9c('0x2d')]=_0x4c283d[_0x3c9c('0x2d')];_0x65b831[_0x3c9c('0x2e')]=_0x4c283d[_0x3c9c('0x2e')];_0x65b831[_0x3c9c('0x2f')]=_0x4c283d['dialOriginateCallerIdNumber'];_0x65b831[_0x3c9c('0x30')]=_0x4c283d[_0x3c9c('0x30')];_0x65b831[_0x3c9c('0x31')]=_0x4c283d[_0x3c9c('0x31')];_0x65b831[_0x3c9c('0x32')]=_0x4c283d[_0x3c9c('0x32')];_0x65b831[_0x3c9c('0x33')]=_0x4c283d[_0x3c9c('0x33')];_0x65b831[_0x3c9c('0x34')]=_0x4c283d[_0x3c9c('0x34')];_0x65b831[_0x3c9c('0x35')]=_0x4c283d[_0x3c9c('0x35')];_0x65b831[_0x3c9c('0x36')]=_0x4c283d[_0x3c9c('0x36')];_0x65b831['outboundCongestionCallsDay']=_0x4c283d[_0x3c9c('0x37')];_0x65b831[_0x3c9c('0x38')]=_0x4c283d[_0x3c9c('0x38')];_0x65b831['outboundDropCallsDayCallersExit']=_0x4c283d[_0x3c9c('0x39')];_0x65b831[_0x3c9c('0x3a')]=_0x4c283d[_0x3c9c('0x3a')];_0x65b831[_0x3c9c('0x3b')]=_0x4c283d['outboundNoAnswerCallsDay'];_0x65b831['outboundNoSuchCallsDay']=_0x4c283d[_0x3c9c('0x3c')];_0x65b831[_0x3c9c('0x3d')]=_0x4c283d[_0x3c9c('0x3d')];_0x65b831['outboundReCallsDay']=_0x4c283d['outboundReCallsDay'];_0x65b831[_0x3c9c('0x3e')]=_0x4c283d['outboundRejectCallsDay'];_0x65b831['outboundUnknownCallsDay']=_0x4c283d[_0x3c9c('0x3f')];_0x65b831[_0x3c9c('0x40')]=_0x4c283d[_0x3c9c('0x40')];_0x65b831['predictiveIntervalAvgHoldtime']=_0x4c283d[_0x3c9c('0x41')];_0x65b831[_0x3c9c('0x42')]=_0x4c283d[_0x3c9c('0x42')];_0x65b831['predictiveIntervalDroppedCallsCallersExit']=_0x4c283d['predictiveIntervalDroppedCallsCallersExit'];_0x65b831['predictiveIntervalDroppedCallsTimeout']=_0x4c283d[_0x3c9c('0x43')];_0x65b831[_0x3c9c('0x44')]=_0x4c283d[_0x3c9c('0x44')];_0x65b831[_0x3c9c('0x45')]=_0x4c283d[_0x3c9c('0x45')];_0x65b831[_0x3c9c('0x46')]=_0x4c283d['predictiveIntervalHitRate'];_0x65b831['predictiveIntervalMultiplicativeFactor']=_0x4c283d[_0x3c9c('0x47')];_0x65b831[_0x3c9c('0x48')]=_0x4c283d[_0x3c9c('0x48')];_0x65b831['predictiveIntervalAvailable']=_0x4c283d[_0x3c9c('0x49')];_0x65b831[_0x3c9c('0x4a')]=_0x4c283d[_0x3c9c('0x4a')];_0x65b831['message']=_0x4c283d['message'];_0x65b831[_0x3c9c('0x4b')]=_0x4c283d[_0x3c9c('0x4b')];_0x65b831[_0x3c9c('0x4c')]=_0x4c283d['erlangCalls'];_0x65b831[_0x3c9c('0x4d')]=_0x4c283d[_0x3c9c('0x4d')];_0x65b831[_0x3c9c('0x4e')]=_0x4c283d[_0x3c9c('0x4e')];_0x65b831['erlangBusyFactor']=_0x4c283d[_0x3c9c('0x4f')];_0x65b831[_0x3c9c('0x50')]=_0x4c283d['startPredictive'];_0x65b831['startProgressive']=_0x4c283d[_0x3c9c('0x51')];}if(_0x4c283d[_0x3c9c('0x52')]){_0x65b831['Trunk']={'id':_0x4c283d[_0x3c9c('0x52')]['id'],'name':_0x4c283d[_0x3c9c('0x52')][_0x3c9c('0xa')],'active':_0x4c283d[_0x3c9c('0x52')][_0x3c9c('0x53')],'callerid':_0x4c283d[_0x3c9c('0x52')]['callerid']};}if(_0x4c283d[_0x3c9c('0x54')]){_0x65b831[_0x3c9c('0x54')]={'id':_0x4c283d[_0x3c9c('0x54')]['id'],'name':_0x4c283d[_0x3c9c('0x54')][_0x3c9c('0xa')]};}_0x527bb9['push'](_0x65b831);}}_0xe04fca({'count':_0x527bb9['length'],'rows':_0x527bb9});});},'UpdateVoiceQueue':function(_0x55a6ba){return new Promise(function(_0x3ff47a,_0x1da3e7){var _0x25285d=_[_0x3c9c('0x55')](_0x143bfe['voiceQueues'],{'id':parseInt(_0x55a6ba['id'])});var _0x798651=_[_0x3c9c('0x56')](_0x55a6ba,['id']);if(_0x25285d){for(var _0x27a013 in _0x798651){if(typeof _0x798651[_0x27a013]!==_0x3c9c('0x57')&&typeof _0x25285d[_0x27a013]!==_0x3c9c('0x57')){_0x25285d[_0x27a013]=_0x798651[_0x27a013];}}_0x3ff47a(_0x25285d);}else{_0x1da3e7();}});},'VoiceChannels':function(_0x58f6b7){return new Promise(function(_0x184c22,_0x1177b3){var _0x1804e3=_[_0x3c9c('0x58')](_0x143bfe[_0x3c9c('0x59')]);_0x184c22({'count':_0x1804e3[_0x3c9c('0x5a')],'rows':_0x1804e3});});},'VoiceChannelMixMonitor':function(_0x475fd6){var _0x5a74ce=this;return new Promise(function(_0x260d3b,_0x3a59f9){if(ami[_0x3c9c('0x5b')]()==![]){return _0x3a59f9(_0x5a74ce[_0x3c9c('0x18')](0x1f4,[config[_0x3c9c('0xf')]['ip'],config[_0x3c9c('0xf')]['username'],_0x3c9c('0x11')][_0x3c9c('0x12')]('\x20')));}var _0x2b0691=schema(properties[_0x3c9c('0x5c')])[_0x3c9c('0x5d')](_0x475fd6);if(_0x2b0691[_0x3c9c('0x5a')]>0x0){return _0x3a59f9(_0x5a74ce[_0x3c9c('0x18')](0x1f4,_[_0x3c9c('0x5e')](_0x2b0691,_0x3c9c('0x16'))[_0x3c9c('0x12')](',\x20')));}var _0x39b9d8=_[_0x3c9c('0x55')](_0x143bfe[_0x3c9c('0x59')],{'uniqueid':_0x475fd6[_0x3c9c('0x5f')]});if(_0x39b9d8&&_0x39b9d8[_0x3c9c('0x60')]){var _0x2b022f=util['format']('%s.%s',_0x475fd6['filename']||_0x475fd6[_0x3c9c('0x5f')],_0x475fd6[_0x3c9c('0x7')]||_0x3c9c('0x61'));return ami[_0x3c9c('0x1c')]({'action':'MixMonitor','channel':_0x39b9d8[_0x3c9c('0x60')],'file':_0x2b022f,'options':'ai(mixmonitorid)'})['then'](function(_0x34cd84){var _0x2849c6=_[_0x3c9c('0x55')](_0x39b9d8[_0x3c9c('0x62')],{'filename':_0x3c9c('0x63')+_0x2b022f[_0x3c9c('0x64')]()});if(_[_0x3c9c('0x65')](_0x2849c6)){_0x39b9d8[_0x3c9c('0x62')][_0x3c9c('0x66')]({'filename':'/var/spool/asterisk/monitor/'+_0x2b022f[_0x3c9c('0x64')](),'createdAt':moment()[_0x3c9c('0x7')](_0x3c9c('0x67')),'mixmonitorid':_0x34cd84[_0x3c9c('0x68')],'status':_0x3c9c('0x69')});}else{_0x2849c6[_0x3c9c('0x68')]=_0x34cd84[_0x3c9c('0x68')];_0x2849c6['status']='rec';}_0x260d3b({'code':0xc8,'message':[_0x475fd6[_0x3c9c('0x5f')],_0x3c9c('0x6a'),_0x34cd84[_0x3c9c('0x68')]][_0x3c9c('0x12')]('\x20'),'mixmonitorid':_0x34cd84[_0x3c9c('0x68')]});})[_0x3c9c('0x17')](function(_0x287ca1){_0x3a59f9(_0x5a74ce[_0x3c9c('0x18')](0x1f5,[_0x475fd6[_0x3c9c('0x5f')],_0x287ca1[_0x3c9c('0x16')][_0x3c9c('0x64')]()][_0x3c9c('0x12')]('\x20')));});}else{return _0x3a59f9(_0x5a74ce[_0x3c9c('0x18')](0x1f5,_0x3c9c('0x6b')));}});},'VoiceChannelStopMixMonitor':function(_0x581523){var _0x423891=this;return new Promise(function(_0x4306fe,_0x1b6f0a){if(ami[_0x3c9c('0x5b')]()==![]){return _0x1b6f0a(_0x423891[_0x3c9c('0x18')](0x1f4,[config['asterisk']['ip'],config[_0x3c9c('0xf')][_0x3c9c('0x10')],'ami\x20disconnected']['join']('\x20')));}var _0x1d810d=schema(properties[_0x3c9c('0x5c')])['validate'](_0x581523);if(_0x1d810d[_0x3c9c('0x5a')]>0x0){return _0x1b6f0a(_0x423891[_0x3c9c('0x18')](0x1f4,_[_0x3c9c('0x5e')](_0x1d810d,_0x3c9c('0x16'))[_0x3c9c('0x12')](',\x20')));}var _0x2264b7=_[_0x3c9c('0x55')](_0x143bfe[_0x3c9c('0x59')],{'uniqueid':_0x581523[_0x3c9c('0x5f')]});if(_0x2264b7){return BPromise[_0x3c9c('0x6c')]()[_0x3c9c('0x15')](function(){if(_0x2264b7['channel']){return ami[_0x3c9c('0x1c')]({'action':'StopMixMonitor','channel':_0x2264b7['channel'],'mixmonitorid':_0x581523[_0x3c9c('0x68')]})[_0x3c9c('0x17')](function(_0x1a1485){});}})[_0x3c9c('0x15')](function(){if(_0x2264b7[_0x3c9c('0x6d')]){return ami[_0x3c9c('0x1c')]({'action':_0x3c9c('0x6e'),'channel':_0x2264b7['destinationchannel'],'mixmonitorid':_0x581523[_0x3c9c('0x68')]})[_0x3c9c('0x17')](function(_0x31fb57){});}})[_0x3c9c('0x15')](function(_0x1cfaea){var _0x4fb887=_['find'](_0x2264b7[_0x3c9c('0x62')],{'mixmonitorid':_0x581523[_0x3c9c('0x68')]});if(_0x4fb887){_0x4fb887[_0x3c9c('0x6f')]=_0x3c9c('0x70');}})[_0x3c9c('0x15')](function(){var _0x990934=util[_0x3c9c('0x7')](_0x3c9c('0x71'),_0x581523[_0x3c9c('0x72')]||_0x581523[_0x3c9c('0x5f')],_0x581523[_0x3c9c('0x7')]||_0x3c9c('0x61'));var _0x4311c0=_[_0x3c9c('0x55')](_0x2264b7[_0x3c9c('0x62')],{'filename':_0x3c9c('0x63')+_0x990934[_0x3c9c('0x64')]()});if(_0x4311c0){_0x4311c0['status']=_0x3c9c('0x70');}})['then'](function(){_0x4306fe({'code':0xc8,'message':[_0x581523['uniqueid'],_0x3c9c('0x73')][_0x3c9c('0x12')]('\x20')});})[_0x3c9c('0x17')](function(_0x4b1b16){_0x1b6f0a(_0x423891[_0x3c9c('0x18')](0x1f5,[_0x581523[_0x3c9c('0x5f')],_0x4b1b16['message'][_0x3c9c('0x64')]()][_0x3c9c('0x12')]('\x20')));});}else{return _0x1b6f0a(_0x423891['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x5e4146){return new Promise(function(_0x1e93d7,_0x2fc65b){var _0xbc5b78=_[_0x3c9c('0x58')](_0x143bfe['queueChannels']);_0x1e93d7({'count':_0xbc5b78['length'],'rows':_0xbc5b78});});},'VoiceQueuesChannel':function(_0x2f2628){var _0x2dc609=this;return new Promise(function(_0x260a90,_0x94bc44){var _0x4342a9=schema(properties[_0x3c9c('0x74')])[_0x3c9c('0x5d')](_0x2f2628);if(_0x4342a9[_0x3c9c('0x5a')]>0x0){return _0x94bc44(_0x2dc609[_0x3c9c('0x18')](0x1f4,_['map'](_0x4342a9,'message')[_0x3c9c('0x12')](',\x20')));}var _0x5cf82a=_['find'](_0x143bfe['queueChannels'],{'uniqueid':_0x2f2628[_0x3c9c('0x5f')]});if(_0x5cf82a){_0x260a90(_0x5cf82a);}else{return _0x94bc44(_0x2dc609[_0x3c9c('0x18')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x56effa){var _0x53ccaf=this;return new Promise(function(_0x482612,_0x77afb5){if(ami['isConnected']()==![]){return _0x77afb5(_0x53ccaf[_0x3c9c('0x18')](0x1f4,[config[_0x3c9c('0xf')]['ip'],config[_0x3c9c('0xf')]['username'],'ami\x20disconnected'][_0x3c9c('0x12')]('\x20')));}var _0x5ca292=schema(properties[_0x3c9c('0x75')])[_0x3c9c('0x5d')](_0x56effa);if(_0x5ca292[_0x3c9c('0x5a')]>0x0){return _0x77afb5(_0x53ccaf[_0x3c9c('0x18')](0x1f4,_['map'](_0x5ca292,_0x3c9c('0x16'))[_0x3c9c('0x12')](',\x20')));}var _0x5c1a13=_[_0x3c9c('0x55')](_0x143bfe[_0x3c9c('0x76')],{'uniqueid':_0x56effa['uniqueid']});if(_0x5c1a13&&_0x5c1a13[_0x3c9c('0x60')]){return ami[_0x3c9c('0x1c')]({'action':'Hangup','channel':_0x5c1a13[_0x3c9c('0x60')]})[_0x3c9c('0x15')](function(_0xab562a){_0x482612({'code':0xc8,'message':[_0x56effa['uniqueid'],_0xab562a['message'][_0x3c9c('0x64')]()][_0x3c9c('0x12')]('\x20')});})['catch'](function(_0x386197){_0x77afb5(_0x53ccaf[_0x3c9c('0x18')](0x1f5,[_0x56effa[_0x3c9c('0x5f')],_0x386197['message'][_0x3c9c('0x64')]()][_0x3c9c('0x12')]('\x20')));});}else{return _0x77afb5(_0x53ccaf['error'](0x1f5,_0x3c9c('0x6b')));}});},'VoiceQueuesChannelRedirect':function(_0x2cb21d){var _0xc4b7c9=this;return new Promise(function(_0x3caddb,_0x1ecabd){if(ami[_0x3c9c('0x5b')]()==![]){return _0x1ecabd(_0xc4b7c9[_0x3c9c('0x18')](0x1f4,[config[_0x3c9c('0xf')]['ip'],config[_0x3c9c('0xf')][_0x3c9c('0x10')],'ami\x20disconnected'][_0x3c9c('0x12')]('\x20')));}var _0x150a27=schema(properties['voicequeuechannelredirect'])[_0x3c9c('0x5d')](_0x2cb21d);if(_0x150a27[_0x3c9c('0x5a')]>0x0){return _0x1ecabd(_0xc4b7c9['error'](0x1f4,_[_0x3c9c('0x5e')](_0x150a27,_0x3c9c('0x16'))[_0x3c9c('0x12')](',\x20')));}var _0x17d23e=_[_0x3c9c('0x55')](_0x143bfe['queueChannels'],{'uniqueid':_0x2cb21d[_0x3c9c('0x5f')]});if(_0x17d23e&&_0x17d23e[_0x3c9c('0x60')]){return ami[_0x3c9c('0x1c')]({'action':_0x3c9c('0x77'),'channel':_0x17d23e[_0x3c9c('0x60')],'exten':_0x2cb21d[_0x3c9c('0x78')],'context':_0x2cb21d[_0x3c9c('0x79')]||_0x17d23e[_0x3c9c('0x79')],'priority':0x1})[_0x3c9c('0x15')](function(_0x36018f){_0x3caddb({'code':0xc8,'message':[_0x2cb21d[_0x3c9c('0x5f')],_0x36018f[_0x3c9c('0x16')][_0x3c9c('0x64')]()]['join']('\x20')});})[_0x3c9c('0x17')](function(_0x296e46){_0x1ecabd(_0xc4b7c9['error'](0x1f5,[_0x2cb21d[_0x3c9c('0x5f')],_0x296e46[_0x3c9c('0x16')][_0x3c9c('0x64')]()]['join']('\x20')));});}else{return _0x1ecabd(_0xc4b7c9[_0x3c9c('0x18')](0x1f5,_0x3c9c('0x6b')));}});},'Agents':function(_0x21c7c3){return new Promise(function(_0x285ebc,_0x478572){var _0x773eea=_['values'](_0x143bfe[_0x3c9c('0xc')]);_0x285ebc({'count':_0x773eea['length'],'rows':_0x773eea});});},'Telephones':function(_0x2265e8){return new Promise(function(_0x48a57f,_0x4950c3){var _0x263270=_['values'](_0x143bfe['telephones']);_0x48a57f({'count':_0x263270[_0x3c9c('0x5a')],'rows':_0x263270});});},'Trunks':function(_0x2f3a98){return new Promise(function(_0x14ccbc,_0x9b3118){var _0x2f4e79=_[_0x3c9c('0x58')](_0x143bfe[_0x3c9c('0x7a')]);_0x14ccbc({'count':_0x2f4e79[_0x3c9c('0x5a')],'rows':_0x2f4e79});});},'OutboundChannels':function(_0x2e6b96){return new Promise(function(_0x13e236,_0x1528a6){var _0x570ae6=_['values'](_0x143bfe[_0x3c9c('0x7b')]);_0x13e236({'count':_0x570ae6['length'],'rows':_0x570ae6});});},'Outbound':function(_0x552ec1){return new Promise(function(_0x3bb0c1,_0x1838d7){_0x3bb0c1(_0x143bfe[_0x3c9c('0x2b')]);});},'Campaigns':function(_0x1748c7){return new Promise(function(_0x2dec50,_0x57746d){var _0x105e67=_[_0x3c9c('0x58')](_0x143bfe['campaigns']);_0x2dec50({'count':_0x105e67['length'],'rows':_0x105e67});});},'VoiceQueuesPreview':function(_0x308a24){var _0x5f42c1=this;return new Promise(function(_0x2e3cab,_0x1ceaa3){_0x512e80[_0x3c9c('0x7c')](_0x308a24['id'])[_0x3c9c('0x15')](function(_0x327e63){_0x2e3cab({'code':0xc8,'message':_0x327e63[_0x3c9c('0x16')]});})[_0x3c9c('0x17')](function(_0x18012e){_0x1ceaa3(_0x5f42c1[_0x3c9c('0x18')](0x1f4,_0x18012e[_0x3c9c('0x16')]));});});},'EventManager':function(_0x52af3a){var _0x32690f=this;return new Promise(function(_0x2f5738,_0xf6f1ea){if(!_0x52af3a[_0x3c9c('0x7d')]){return _0xf6f1ea(_0x32690f['error'](0x1f4,_0x3c9c('0x7e')));}ami['emit'](_0x3c9c('0x7f')+_0x52af3a[_0x3c9c('0x7d')],_0x52af3a['message']);_0x2f5738({'code':0xc8,'message':_0x52af3a});});},'FaxAccounts':function(_0x22d2bd){return new Promise(function(_0x4cd7b9,_0x49559f){var _0x3d34e3=_[_0x3c9c('0x58')](_0x143bfe[_0x3c9c('0x80')]);_0x4cd7b9({'count':_0x3d34e3[_0x3c9c('0x5a')],'rows':_0x3d34e3});});},'SendFax':function(_0x17e5ce){var _0x5c96ad=this;return new Promise(function(_0x3e2f73,_0x48c11d){_0x48b219[_0x3c9c('0x81')](_0x17e5ce)['then'](function(_0x12bb7b){_0x3e2f73({'code':0xc8,'message':_0x12bb7b[_0x3c9c('0x16')]});})[_0x3c9c('0x17')](function(_0x19db8a){_0x48c11d(_0x5c96ad[_0x3c9c('0x18')](0x1f4,_0x19db8a[_0x3c9c('0x16')]));});});},'CheckAfterSend':function(_0x1fe080){var _0x41c07b=this;return new Promise(function(_0x557dc6,_0xa1de30){_0x48b219[_0x3c9c('0x82')](_0x1fe080)[_0x3c9c('0x15')](function(_0x5614df){_0x557dc6({'code':0xc8,'message':_0x5614df[_0x3c9c('0x16')]});})[_0x3c9c('0x17')](function(_0x37d2b6){_0xa1de30(_0x41c07b[_0x3c9c('0x18')](0x1f4,_0x37d2b6[_0x3c9c('0x16')]));});});}};var _0xdfe4f7=jayson['server'](_0x3ca0ce)[_0x3c9c('0x83')]();_0xdfe4f7['on'](_0x3c9c('0x18'),function(_0x2e158c){return _0x5a2836(_0x2e158c);});_0xdfe4f7[_0x3c9c('0x6')](0x232a,'127.0.0.1',function(){console[_0x3c9c('0x84')](_0x3c9c('0x85'),0x232a);return _0x5c86bd(_0x3c9c('0x86')+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 da684b3..2a9abe6 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 _0xe5b3=['ListId','data3','$or','map','routeId','calleridnum','phone','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','destcalleridnum','firstName','calleridname','','Unknown','destcalleridname','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','push','user:%s','format','merge','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','info','emit','exec','data1','data2','isNil','xmd-contactid'];(function(_0x3b7d9d,_0x12b8dd){var _0x3e8a5c=function(_0x1b3198){while(--_0x1b3198){_0x3b7d9d['push'](_0x3b7d9d['shift']());}};_0x3e8a5c(++_0x12b8dd);}(_0xe5b3,0x133));var _0x3e5b=function(_0x1e96e4,_0x25179f){_0x1e96e4=_0x1e96e4-0x0;var _0x525f80=_0xe5b3[_0x1e96e4];return _0x525f80;};'use strict';var _=require('lodash');var BPromise=require(_0x3e5b('0x0'));var Redis=require(_0x3e5b('0x1'));var util=require(_0x3e5b('0x2'));var config=require(_0x3e5b('0x3'));var logger=require(_0x3e5b('0x4'))(_0x3e5b('0x5'));var cmContactRpc=require(_0x3e5b('0x6'));config[_0x3e5b('0x7')]=_[_0x3e5b('0x8')](config[_0x3e5b('0x7')],{'host':_0x3e5b('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3e5b('0x7')]));function emit(_0x5dcf55,_0x534e7d,_0x41d46f,_0x3901c2,_0x3c7c2e){logger[_0x3e5b('0xa')]('[CM][%s][%s]',_0x5dcf55,_0x534e7d['id'],_0x41d46f,_0x3901c2,JSON['stringify'](_0x3c7c2e));io['to'](_0x41d46f)[_0x3e5b('0xb')](_0x3901c2,_0x3c7c2e);}exports[_0x3e5b('0xc')]=function(_0x22fc1a,_0x17dee7,_0xeeaabc,_0x522e9e){var _0x3be027,_0x52efbd;var _0x468305={};var _0x382273=Number(_0xeeaabc[_0x3e5b('0xd')]);var _0x374068=_0xeeaabc[_0x3e5b('0xe')]?Boolean(Number(_0xeeaabc[_0x3e5b('0xe')])):![];var _0x405e70;var _0x560010=![];if(!_[_0x3e5b('0xf')](_0xeeaabc['data5'])){if(_0xeeaabc['data5']=='1')_0x560010=!![];}if(!_0x560010){if(_0x522e9e['xmd-contactid']){_0x468305['id']=_0x522e9e[_0x3e5b('0x10')];}}if(!_0x468305['id']){_0x468305[_0x3e5b('0x11')]=_0x382273;_0x405e70=_0xeeaabc[_0x3e5b('0x12')]&&_0xeeaabc['data3']!=='0'?_0xeeaabc[_0x3e5b('0x12')]['split'](','):['phone'];_0x468305[_0x3e5b('0x13')]=_[_0x3e5b('0x14')](_0x405e70,function(_0x5e2f83){var _0x3d58a4={};_0x3d58a4[_0x5e2f83]=_0x522e9e[_0x3e5b('0x15')]?_0x522e9e['destcalleridnum']:_0x522e9e[_0x3e5b('0x16')];return _0x3d58a4;});}var _0x3365dd=['id','firstName','lastName',_0x3e5b('0x17'),_0x3e5b('0x18'),_0x3e5b('0x19'),_0x3e5b('0x11'),_0x3e5b('0x1a'),_0x3e5b('0x1b'),_0x3e5b('0x1c')];var _0x21fc32=_[_0x3e5b('0x1d')](_0x3365dd,_0x405e70);BPromise[_0x3e5b('0x1e')]()[_0x3e5b('0x1f')](cmContactRpc[_0x3e5b('0x20')]({'attributes':_0x21fc32,'where':_0x468305}))[_0x3e5b('0x1f')](function(_0x402873){_0x52efbd=_0x402873;if(!_['isEmpty'](_0x52efbd)){if(_0x52efbd[_0x3e5b('0x21')]===0x1){_0x3be027=_0x52efbd[0x0];logger[_0x3e5b('0xa')](_0x3e5b('0x22'),_0x522e9e[_0x3e5b('0x23')],_0x17dee7['id'],_0x3be027['id']);}else{logger['info'](_0x3e5b('0x24'),_0x522e9e['uniqueid'],_0x17dee7['id'],_[_0x3e5b('0x14')](_0x52efbd,'id')[_0x3e5b('0x25')](','));}return;}else{logger['info'](_0x3e5b('0x26'),_0x522e9e[_0x3e5b('0x23')],_0x17dee7['id']);var _0x42d7e9={'ListId':_0x382273};var _0x3c8965=_0xeeaabc[_0x3e5b('0x27')]&&_0xeeaabc[_0x3e5b('0x27')]!=='0'?_0xeeaabc[_0x3e5b('0x27')]:_0x3e5b('0x17');if(_0x374068){logger['info'](_0x3e5b('0x28'),_0x522e9e['uniqueid'],_0x17dee7['id']);_0x42d7e9[_0x3c8965]=_[_0x3e5b('0xf')](_0x522e9e['routeId'])?_0x522e9e[_0x3e5b('0x16')]:_0x522e9e[_0x3e5b('0x29')];if(_[_0x3e5b('0xf')](_0x522e9e[_0x3e5b('0x15')])){_0x42d7e9[_0x3e5b('0x2a')]=_0x522e9e[_0x3e5b('0x2b')]&&_0x522e9e[_0x3e5b('0x2b')]!==_0x3e5b('0x2c')?_0x522e9e[_0x3e5b('0x2b')]:_0x3e5b('0x2d');}else{_0x42d7e9[_0x3e5b('0x2a')]=_0x522e9e['destcalleridname']&&_0x522e9e[_0x3e5b('0x2e')]!==_0x3e5b('0x2c')?_0x522e9e[_0x3e5b('0x2e')]:_0x3e5b('0x2d');}return BPromise[_0x3e5b('0x1e')]()[_0x3e5b('0x1f')](cmContactRpc[_0x3e5b('0x2f')](_0x42d7e9))['then'](function(_0x33f089){_0x3be027=_0x33f089;_0x52efbd['push'](_0x33f089);if(_0x3be027){logger['info'](_0x3e5b('0x30'),_0x522e9e[_0x3e5b('0x23')],_0x17dee7['id'],_0x3be027['id']);}return;});}else{logger['info'](_0x3e5b('0x31'),_0x522e9e[_0x3e5b('0x23')],_0x17dee7['id']);_0x42d7e9[_0x3c8965]=_[_0x3e5b('0xf')](_0x522e9e[_0x3e5b('0x15')])?_0x522e9e[_0x3e5b('0x16')]:_0x522e9e[_0x3e5b('0x29')];if(_[_0x3e5b('0xf')](_0x522e9e[_0x3e5b('0x15')])){_0x42d7e9[_0x3e5b('0x2a')]=_0x522e9e[_0x3e5b('0x2b')]&&_0x522e9e[_0x3e5b('0x2b')]!==_0x3e5b('0x2c')?_0x522e9e['calleridname']:_0x3e5b('0x2d');}else{_0x42d7e9[_0x3e5b('0x2a')]=_0x522e9e['destcalleridname']&&_0x522e9e['destcalleridname']!==_0x3e5b('0x2c')?_0x522e9e['destcalleridname']:_0x3e5b('0x2d');}_0x3be027=_0x42d7e9;_0x52efbd[_0x3e5b('0x32')](_0x42d7e9);return;}}})[_0x3e5b('0x1f')](function(){if(_0x22fc1a){emit(_0x522e9e[_0x3e5b('0x23')],_0x17dee7,util['format'](_0x3e5b('0x33'),_0x22fc1a['name']),util[_0x3e5b('0x34')]('trigger:%s',_0xeeaabc['action']['toLowerCase']()),{'evt':_[_0x3e5b('0x35')](_0x522e9e,{'autoCreate':_0x374068}),'contact':_0x3be027===undefined?{}:_0x3be027,'contacts':_0x52efbd[_0x3e5b('0x21')]===0x0?undefined:_0x52efbd});}});}; \ No newline at end of file +var _0xd6d6=['isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','phone','[CM][%s][%s]\x20Autocreate\x20enabled','routeId','calleridname','','Unknown','destcalleridname','push','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','name','format','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','info','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','$or','map','destcalleridnum','calleridnum','firstName','mobile','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x26b7ad,_0xba6345){_0x26b7ad=_0x26b7ad-0x0;var _0x466237=_0xd6d6[_0x26b7ad];return _0x466237;};'use strict';var _=require(_0x6d6d('0x0'));var BPromise=require(_0x6d6d('0x1'));var Redis=require(_0x6d6d('0x2'));var util=require(_0x6d6d('0x3'));var config=require('../../../../config/environment');var logger=require(_0x6d6d('0x4'))(_0x6d6d('0x5'));var cmContactRpc=require(_0x6d6d('0x6'));config[_0x6d6d('0x7')]=_[_0x6d6d('0x8')](config[_0x6d6d('0x7')],{'host':_0x6d6d('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6d6d('0x7')]));function emit(_0x1bf731,_0x44f83d,_0x18f824,_0xd49f57,_0x408f88){logger[_0x6d6d('0xa')]('[CM][%s][%s]',_0x1bf731,_0x44f83d['id'],_0x18f824,_0xd49f57,JSON['stringify'](_0x408f88));io['to'](_0x18f824)[_0x6d6d('0xb')](_0xd49f57,_0x408f88);}exports[_0x6d6d('0xc')]=function(_0x23b18a,_0x290dfb,_0xf84314,_0x576c88){var _0x1f2b86,_0x158f82;var _0x49b59c={};var _0x4fbe9c=Number(_0xf84314[_0x6d6d('0xd')]);var _0x32146d=_0xf84314[_0x6d6d('0xe')]?Boolean(Number(_0xf84314[_0x6d6d('0xe')])):![];var _0x2b74ed;var _0x41fbdf=![];if(!_[_0x6d6d('0xf')](_0xf84314[_0x6d6d('0x10')])){if(_0xf84314['data5']=='1')_0x41fbdf=!![];}if(!_0x41fbdf){if(_0x576c88[_0x6d6d('0x11')]){_0x49b59c['id']=_0x576c88[_0x6d6d('0x11')];}}if(!_0x49b59c['id']){_0x49b59c[_0x6d6d('0x12')]=_0x4fbe9c;_0x2b74ed=_0xf84314[_0x6d6d('0x13')]&&_0xf84314[_0x6d6d('0x13')]!=='0'?_0xf84314['data3'][_0x6d6d('0x14')](','):['phone'];_0x49b59c[_0x6d6d('0x15')]=_[_0x6d6d('0x16')](_0x2b74ed,function(_0x1cc02b){var _0x4bb3d1={};_0x4bb3d1[_0x1cc02b]=_0x576c88['routeId']?_0x576c88[_0x6d6d('0x17')]:_0x576c88[_0x6d6d('0x18')];return _0x4bb3d1;});}var _0x2b59d4=['id',_0x6d6d('0x19'),'lastName','phone',_0x6d6d('0x1a'),'fax',_0x6d6d('0x12'),_0x6d6d('0x1b'),_0x6d6d('0x1c'),_0x6d6d('0x1d')];var _0x40d35b=_[_0x6d6d('0x1e')](_0x2b59d4,_0x2b74ed);BPromise[_0x6d6d('0x1f')]()[_0x6d6d('0x20')](cmContactRpc[_0x6d6d('0x21')]({'attributes':_0x40d35b,'where':_0x49b59c}))[_0x6d6d('0x20')](function(_0x24b10d){_0x158f82=_0x24b10d;if(!_[_0x6d6d('0x22')](_0x158f82)){if(_0x158f82[_0x6d6d('0x23')]===0x1){_0x1f2b86=_0x158f82[0x0];logger[_0x6d6d('0xa')](_0x6d6d('0x24'),_0x576c88[_0x6d6d('0x25')],_0x290dfb['id'],_0x1f2b86['id']);}else{logger[_0x6d6d('0xa')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x576c88[_0x6d6d('0x25')],_0x290dfb['id'],_[_0x6d6d('0x16')](_0x158f82,'id')[_0x6d6d('0x26')](','));}return;}else{logger[_0x6d6d('0xa')](_0x6d6d('0x27'),_0x576c88[_0x6d6d('0x25')],_0x290dfb['id']);var _0x554f8e={'ListId':_0x4fbe9c};var _0x2851dd=_0xf84314[_0x6d6d('0x28')]&&_0xf84314[_0x6d6d('0x28')]!=='0'?_0xf84314[_0x6d6d('0x28')]:_0x6d6d('0x29');if(_0x32146d){logger[_0x6d6d('0xa')](_0x6d6d('0x2a'),_0x576c88['uniqueid'],_0x290dfb['id']);_0x554f8e[_0x2851dd]=_[_0x6d6d('0xf')](_0x576c88[_0x6d6d('0x2b')])?_0x576c88['calleridnum']:_0x576c88['destcalleridnum'];if(_[_0x6d6d('0xf')](_0x576c88[_0x6d6d('0x2b')])){_0x554f8e[_0x6d6d('0x19')]=_0x576c88['calleridname']&&_0x576c88[_0x6d6d('0x2c')]!==_0x6d6d('0x2d')?_0x576c88[_0x6d6d('0x2c')]:_0x6d6d('0x2e');}else{_0x554f8e[_0x6d6d('0x19')]=_0x576c88[_0x6d6d('0x2f')]&&_0x576c88[_0x6d6d('0x2f')]!==_0x6d6d('0x2d')?_0x576c88[_0x6d6d('0x2f')]:_0x6d6d('0x2e');}return BPromise['resolve']()[_0x6d6d('0x20')](cmContactRpc['createContact'](_0x554f8e))[_0x6d6d('0x20')](function(_0x1ea9b2){_0x1f2b86=_0x1ea9b2;_0x158f82[_0x6d6d('0x30')](_0x1ea9b2);if(_0x1f2b86){logger[_0x6d6d('0xa')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x576c88[_0x6d6d('0x25')],_0x290dfb['id'],_0x1f2b86['id']);}return;});}else{logger['info'](_0x6d6d('0x31'),_0x576c88[_0x6d6d('0x25')],_0x290dfb['id']);_0x554f8e[_0x2851dd]=_['isNil'](_0x576c88[_0x6d6d('0x2b')])?_0x576c88[_0x6d6d('0x18')]:_0x576c88[_0x6d6d('0x17')];if(_[_0x6d6d('0xf')](_0x576c88[_0x6d6d('0x2b')])){_0x554f8e[_0x6d6d('0x19')]=_0x576c88[_0x6d6d('0x2c')]&&_0x576c88[_0x6d6d('0x2c')]!==_0x6d6d('0x2d')?_0x576c88[_0x6d6d('0x2c')]:_0x6d6d('0x2e');}else{_0x554f8e[_0x6d6d('0x19')]=_0x576c88[_0x6d6d('0x2f')]&&_0x576c88[_0x6d6d('0x2f')]!==''?_0x576c88[_0x6d6d('0x2f')]:_0x6d6d('0x2e');}_0x1f2b86=_0x554f8e;_0x158f82[_0x6d6d('0x30')](_0x554f8e);return;}}})[_0x6d6d('0x20')](function(){if(_0x23b18a){emit(_0x576c88['uniqueid'],_0x290dfb,util['format'](_0x6d6d('0x32'),_0x23b18a[_0x6d6d('0x33')]),util[_0x6d6d('0x34')]('trigger:%s',_0xf84314[_0x6d6d('0x35')][_0x6d6d('0x36')]()),{'evt':_[_0x6d6d('0x37')](_0x576c88,{'autoCreate':_0x32146d}),'contact':_0x1f2b86===undefined?{}:_0x1f2b86,'contacts':_0x158f82[_0x6d6d('0x23')]===0x0?undefined:_0x158f82});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index f6bedbe..25b5a75 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 _0x541f=['../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','vtigerAccounts','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:substatus','custom:incomingmessage','custom:acceptmessage','custom:rejectmessage','emit','stringify','clone','motionChannel','undefined','voice','checkTriggers','prototype','hasOwnProperty','status','merge','variables','Actions','length','interface','action','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','data2','render','html','template\x20not\x20found','uri','isNil','data3','data4','location','uriLocation','data5','windowHeight','data6','600','winApplication','winArguments','user:%s','name','format','jscripty','trigger:%s','integration','exec','routeId','urlforward','script','buildUri','parse','query','checkTrigger','channel','every','AllConditions','checkConditions','AnyConditions','some','field','account','ChatWebsiteId','AccountId','operator','value','upperFirst','interaction','message','event','queue','agent','membername','lastevent','mailSubstatus','null','substatus','exports','lodash','url','./urlforward','./integration','./cmContact','./script'];(function(_0x16de68,_0x33d7ff){var _0x1c277e=function(_0x1d8549){while(--_0x1d8549){_0x16de68['push'](_0x16de68['shift']());}};_0x1c277e(++_0x33d7ff);}(_0x541f,0x78));var _0xf541=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x541f[_0x1035c1];return _0x308d67;};'use strict';var util=require('util');var _=require(_0xf541('0x0'));var url=require(_0xf541('0x1'));var Mustache=require('mustache');var Redis=require('ioredis');var urlforward=require(_0xf541('0x2'));var integration=require(_0xf541('0x3'));var cmContact=require(_0xf541('0x4'));var script=require(_0xf541('0x5'));var config=require(_0xf541('0x6'));var logger=require(_0xf541('0x7'))(_0xf541('0x8'));var ami=require(_0xf541('0x9'));config[_0xf541('0xa')]=_[_0xf541('0xb')](config[_0xf541('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xf541('0xc'))(new Redis(config[_0xf541('0xa')]));var operators={'equals':function(_0x4a3806,_0x2d692b){return _0x4a3806==_0x2d692b;},'not_equals':function(_0x3d9b84,_0x59dc77){return _0x3d9b84!=_0x59dc77;}};var barAndWebActions=[_0xf541('0xd'),_0xf541('0x1'),_0xf541('0xe')];function Trigger(_0x1e0df4){this[_0xf541('0xf')]=_0x1e0df4[_0xf541('0xf')];this[_0xf541('0x10')]=_0x1e0df4[_0xf541('0x10')];this['voiceQueues']=_0x1e0df4[_0xf541('0x11')];this[_0xf541('0x12')]=_0x1e0df4[_0xf541('0x12')];this[_0xf541('0x13')]=_0x1e0df4['voiceExtensions'];this['zendeskAccounts']=_0x1e0df4[_0xf541('0x14')];this['freshdeskAccounts']=_0x1e0df4[_0xf541('0x15')];this[_0xf541('0x16')]=_0x1e0df4[_0xf541('0x16')];this['sugarcrmAccounts']=_0x1e0df4[_0xf541('0x17')];this[_0xf541('0x18')]=_0x1e0df4[_0xf541('0x18')];this[_0xf541('0x19')]=_0x1e0df4[_0xf541('0x19')];this['vtigerAccounts']=_0x1e0df4['vtigerAccounts'];this[_0xf541('0x1a')]=_0x1e0df4['servicenowAccounts'];this[_0xf541('0x1b')]=_0x1e0df4[_0xf541('0x1b')];this[_0xf541('0x1c')]=_0x1e0df4[_0xf541('0x1c')];this['accounts']={'zendesk':this[_0xf541('0x14')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0xf541('0x15')],'sugarcrm':this[_0xf541('0x17')],'zoho':this['zohoAccounts'],'desk':this[_0xf541('0x19')],'vtiger':this[_0xf541('0x1d')],'dynamics365':this[_0xf541('0x1b')],'freshsales':this[_0xf541('0x1c')],'servicenow':this[_0xf541('0x1a')]};ami['on']('custom:agentcalled',this[_0xf541('0x1e')][_0xf541('0x1f')](this));ami['on'](_0xf541('0x20'),this[_0xf541('0x1e')][_0xf541('0x1f')](this));ami['on'](_0xf541('0x21'),this[_0xf541('0x1e')]['bind'](this));ami['on']('custom:agentcomplete',this[_0xf541('0x1e')][_0xf541('0x1f')](this));ami['on'](_0xf541('0x22'),this[_0xf541('0x1e')]['bind'](this));ami['on'](_0xf541('0x23'),this['syncCustomEvent'][_0xf541('0x1f')](this));ami['on'](_0xf541('0x24'),this[_0xf541('0x1e')][_0xf541('0x1f')](this));ami['on'](_0xf541('0x25'),this[_0xf541('0x1e')][_0xf541('0x1f')](this));ami['on'](_0xf541('0x26'),this[_0xf541('0x1e')][_0xf541('0x1f')](this));ami['on'](_0xf541('0x27'),this[_0xf541('0x1e')][_0xf541('0x1f')](this));ami['on'](_0xf541('0x28'),this[_0xf541('0x1e')][_0xf541('0x1f')](this));ami['on'](_0xf541('0x29'),this[_0xf541('0x1e')][_0xf541('0x1f')](this));ami['on']('custom:dialbegin',this[_0xf541('0x2a')][_0xf541('0x1f')](this));ami['on'](_0xf541('0x2b'),this[_0xf541('0x2a')][_0xf541('0x1f')](this));ami['on'](_0xf541('0x2c'),this[_0xf541('0x2a')][_0xf541('0x1f')](this));ami['on'](_0xf541('0x2d'),this[_0xf541('0x1e')][_0xf541('0x1f')](this));ami['on']('custom:closedinteraction',this[_0xf541('0x1e')][_0xf541('0x1f')](this));ami['on'](_0xf541('0x2e'),this[_0xf541('0x1e')][_0xf541('0x1f')](this));ami['on'](_0xf541('0x2f'),this[_0xf541('0x1e')][_0xf541('0x1f')](this));ami['on']('custom:outgoingmessage',this['syncCustomEvent']['bind'](this));ami['on'](_0xf541('0x30'),this['syncCustomEvent']['bind'](this));ami['on'](_0xf541('0x31'),this[_0xf541('0x1e')][_0xf541('0x1f')](this));}Trigger['prototype'][_0xf541('0x32')]=function(_0x4eecb4,_0x3a16c5,_0x59175a){logger['info'](_0x4eecb4,_0x3a16c5,JSON[_0xf541('0x33')](_0x59175a));io['to'](_0x4eecb4)[_0xf541('0x32')](_0x3a16c5,_0x59175a);};Trigger['prototype'][_0xf541('0x1e')]=function(_0x1d5e67){var _0x63cbf1=_[_0xf541('0x34')](_0x1d5e67);if(typeof _0x63cbf1[_0xf541('0x35')]===_0xf541('0x36')){_0x63cbf1[_0xf541('0x35')]=_0xf541('0x37');}this[_0xf541('0x38')](_0x63cbf1);};Trigger[_0xf541('0x39')][_0xf541('0x2a')]=function(_0x4561e4){if(this['agents'][_0x4561e4['interface']]){this['syncCustomEvent'](_0x4561e4);}};Trigger[_0xf541('0x39')][_0xf541('0x38')]=function(_0x30d17c){var _0x57b6dd;for(var _0x5919d8 in this[_0xf541('0xf')]){if(this['triggers'][_0xf541('0x3a')](_0x5919d8)){if(this['triggers'][_0x5919d8][_0xf541('0x3b')]){_0x57b6dd=this['checkTrigger'](this[_0xf541('0xf')][_0x5919d8],_0x30d17c);if(_0x57b6dd){_[_0xf541('0x3c')](_0x30d17c,_0x30d17c[_0xf541('0x3d')]);for(var _0x297675=0x0,_0xfa2587,_0x32ffd8,_0x50e45a;_0x2976750x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ No newline at end of file +var _0x55ca=['debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','token','%s/token:%s','toString','base64','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','_embedded','entries','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','length','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','variableName','customVariable','Variable','name','priority','merge','xCALLY','Motion','CTI','concat','Tags','getString','Descriptions','/api/v2/users/%d','user','Fields','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','./util','../../../../config/environment','desk','redis','defaults','localhost','socket.io-emitter','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me'];(function(_0x41528e,_0x5914c5){var _0x42fe22=function(_0x5a7da3){while(--_0x5a7da3){_0x41528e['push'](_0x41528e['shift']());}};_0x42fe22(++_0x5914c5);}(_0x55ca,0x126));var _0xa55c=function(_0x5ae350,_0x24edc7){_0x5ae350=_0x5ae350-0x0;var _0x4e3073=_0x55ca[_0x5ae350];return _0x4e3073;};'use strict';var _=require(_0xa55c('0x0'));var rp=require(_0xa55c('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));config[_0xa55c('0x5')]=_[_0xa55c('0x6')](config[_0xa55c('0x5')],{'host':_0xa55c('0x7'),'port':0x18eb});var io=require(_0xa55c('0x8'))(new Redis(config[_0xa55c('0x5')]));function emit(_0x4d0624,_0x2121fd,_0x2537f0){io['to'](_0x4d0624)['emit'](_0x2121fd,_0x2537f0);}var headers={'Content-Type':_0xa55c('0x9'),'Accept':_0xa55c('0x9')};function getUser(_0x52a3bc,_0x5849ad){if(intUtil[_0xa55c('0xa')](_0x5849ad)===!![]){logger[_0xa55c('0xb')](_0xa55c('0xc'),_0x5849ad);return request({'uri':util[_0xa55c('0xd')](_0xa55c('0xe'),_0x52a3bc[_0xa55c('0xf')])})[_0xa55c('0x10')](function(_0x70c2de){if(_0x70c2de[_0xa55c('0x11')]){return _[_0xa55c('0x12')](_0x70c2de['_embedded']['entries'],{'email':_0x5849ad});}})[_0xa55c('0x10')](function(_0x576044){if(_0x576044){logger['info']('Agent\x20found!');return _0x576044;}else{logger[_0xa55c('0xb')](_0xa55c('0x13'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}});}else{logger[_0xa55c('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}}function request(_0x31e10d){logger[_0xa55c('0x15')](_0xa55c('0x16'),JSON[_0xa55c('0x17')](_0x31e10d));return rp(_[_0xa55c('0x6')](_0x31e10d,{'method':_0xa55c('0x18'),'headers':headers,'json':!![]}));}function getAuth(_0x4cee3c){var _0x3d4c9e;if(_0x4cee3c[_0xa55c('0x19')]===_0xa55c('0x1a')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1b'),_0x4cee3c[_0xa55c('0x1c')],_0x4cee3c['password']);}else if(_0x4cee3c['authType']===_0xa55c('0x1d')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1e'),_0x4cee3c['username'],_0x4cee3c[_0xa55c('0x1d')]);}return util[_0xa55c('0xd')]('Basic\x20%s',new Buffer(_0x3d4c9e)[_0xa55c('0x1f')](_0xa55c('0x20')));}function getEndUser(_0x940f28,_0x1965f1,_0x234372){logger['info'](_0xa55c('0x21'),_0x234372);return request({'uri':util['format']('%s/customers/search',_0x940f28['remoteUri']),'qs':{'phone':_0x234372}})[_0xa55c('0x10')](function(_0x54b038){if(_0x54b038[_0xa55c('0x11')]){logger[_0xa55c('0xb')](_0xa55c('0x22'));return _0x54b038[_0xa55c('0x23')][_0xa55c('0x24')][0x0];}else{logger[_0xa55c('0xb')](_0xa55c('0x25'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x26'),_0x940f28[_0xa55c('0xf')]),'method':_0xa55c('0x27'),'body':{'first_name':_0x1965f1,'title':_0x1965f1,'phone_numbers':[{'type':'work','value':_0x234372}]}});}});}function getTags(_0x430d55,_0x28814f){var _0x1c9f6b=[];if(_0x430d55&&_0x430d55[_0xa55c('0x28')]>0x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index b88a692..cba7da2 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 _0xcc0b=['md5','ioredis','../../../../config/logger','../../../../config/environment','redis','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','error','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','outbound','destcalleridnum','contacts','/systemusers(','4.0','headers','odata-entityid','substring','enduserId','toLowerCase','calleridnum','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','telephone1','contactid',']\x20Enduser\x20created!','string','picklist','type','nameField','idField','ticketType','incident','incidents','assign','getString','Descriptions','Fields','phonecall','phonecalls','Subjects','/contacts(','callDirection','queue','lastIndexOf','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','util','./util'];(function(_0x55a709,_0xd20829){var _0x4a08e4=function(_0x4b6986){while(--_0x4b6986){_0x55a709['push'](_0x55a709['shift']());}};_0x4a08e4(++_0xd20829);}(_0xcc0b,0xc0));var _0xbcc0=function(_0x12e073,_0x4d43db){_0x12e073=_0x12e073-0x0;var _0x267748=_0xcc0b[_0x12e073];return _0x267748;};'use strict';var _=require(_0xbcc0('0x0'));var BPromise=require(_0xbcc0('0x1'));var rp=require('request-promise');var util=require(_0xbcc0('0x2'));var intUtil=require(_0xbcc0('0x3'));var md5=require(_0xbcc0('0x4'));var Redis=require(_0xbcc0('0x5'));var logger=require(_0xbcc0('0x6'))('dynamics365');var config=require(_0xbcc0('0x7'));config[_0xbcc0('0x8')]=_['defaults'](config[_0xbcc0('0x8')],{'host':_0xbcc0('0x9'),'port':0x18eb});var io=require(_0xbcc0('0xa'))(new Redis(config[_0xbcc0('0x8')]));function getAuthToken(_0x4bd59a,_0x468bed,_0x4e6d65){var _0x361c79={'method':_0xbcc0('0xb'),'uri':_0x468bed,'form':{'client_id':_0x4bd59a[_0xbcc0('0xc')],'resource':_0x4bd59a[_0xbcc0('0xd')],'username':_0x4bd59a[_0xbcc0('0xe')],'password':_0x4bd59a[_0xbcc0('0xf')],'grant_type':_0xbcc0('0xf'),'client_secret':_0x4bd59a[_0xbcc0('0x10')]},'json':!![]};return rp(_0x361c79)[_0xbcc0('0x11')](function(_0x1fb4c6){return _0x1fb4c6[_0xbcc0('0x12')];})[_0xbcc0('0x13')](function(_0x4c0c12){logger[_0xbcc0('0x14')]('['+[_0x4e6d65['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0x4c0c12[_0xbcc0('0x15')];});}function getUser(_0xab7b3,_0x11d930,_0x11084a,_0x45c134,_0x1c4ab5,_0x5aa320){return new BPromise(function(_0x11c362,_0x5451c4){return getAuthToken(_0x11d930,_0x45c134,_0x5aa320)[_0xbcc0('0x11')](function(_0x5432c1){var _0x4e7768={'method':_0xbcc0('0x16'),'uri':_0x1c4ab5+_0xbcc0('0x17'),'headers':{'Authorization':_0xbcc0('0x18')+_0x5432c1,'OData-Version':'4.0'},'json':!![]};return rp(_0x4e7768);})[_0xbcc0('0x11')](function(_0x4ee2ca){var _0xaaff5d=_0x4ee2ca[_0xbcc0('0x19')];var _0x1fcffb=![];var _0x43a670=null;if(!_[_0xbcc0('0x1a')](_0x11084a)){if(intUtil[_0xbcc0('0x1b')](_0x11084a[_0xbcc0('0x1c')])){_0xab7b3[_0xbcc0('0x1d')]=_0x11084a[_0xbcc0('0x1c')];for(_0x43a670=0x0;_0x43a670<_0xaaff5d[_0xbcc0('0x1e')];_0x43a670++){if(_0xaaff5d[_0x43a670][_0xbcc0('0x1f')]===_0x11084a[_0xbcc0('0x1c')]&&!_0xaaff5d[_0x43a670][_0xbcc0('0x20')]){_0x1fcffb=!![];logger[_0xbcc0('0x21')]('['+[_0x5aa320[_0xbcc0('0x22')]()]+_0xbcc0('0x23')+_0xaaff5d[_0x43a670][_0xbcc0('0x24')]+'!');_0xab7b3[_0xbcc0('0x25')]=_0xaaff5d[_0x43a670]['systemuserid'];}}}}if(!_0x1fcffb){logger[_0xbcc0('0x21')]('['+[_0x5aa320[_0xbcc0('0x22')]()]+_0xbcc0('0x26'));_0xab7b3['userEmail']=_0x11d930['username'];for(_0x43a670=0x0;_0x43a670<_0xaaff5d[_0xbcc0('0x1e')];_0x43a670++){if(_0xaaff5d[_0x43a670][_0xbcc0('0x1f')]===_0x11d930['username']){_0xab7b3[_0xbcc0('0x25')]=_0xaaff5d[_0x43a670][_0xbcc0('0x24')];}}}_0x11c362(_0xab7b3);})[_0xbcc0('0x13')](function(_0x49d254){_0x5451c4(_0x49d254[_0xbcc0('0x15')]);});});}function createEndUser(_0x5c1e0a,_0x431883,_0x23e468,_0x276638,_0x13a011,_0x344375){return new BPromise(function(_0x66b206,_0x110960){return getAuthToken(_0x431883,_0x23e468,_0x344375)[_0xbcc0('0x11')](function(_0x1bf1f4){var _0x20135c=_0x344375['toLowerCase']()===_0xbcc0('0x27')?_0x13a011[_0xbcc0('0x28')]:_0x13a011['calleridnum'];var _0x210aa9={'method':_0xbcc0('0xb'),'uri':_0x276638+_0xbcc0('0x29'),'body':{'telephone1':_0x20135c,'fullname':_0x20135c,'firstname':_0x20135c,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xbcc0('0x2a')+_0x5c1e0a[_0xbcc0('0x25')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x1bf1f4,'OData-Version':_0xbcc0('0x2b')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x210aa9);})[_0xbcc0('0x11')](function(_0x5a87a6){var _0x352e9a=_0x5a87a6[_0xbcc0('0x2c')][_0xbcc0('0x2d')];var _0x47f39e=_0x352e9a[_0xbcc0('0x2e')](_0x352e9a['lastIndexOf']('(')+0x1,_0x352e9a['lastIndexOf'](')'));_0x5c1e0a[_0xbcc0('0x2f')]=_0x47f39e;_0x66b206(_0x5c1e0a);})[_0xbcc0('0x13')](function(_0x1f18c2){_0x110960(_0x1f18c2[_0xbcc0('0x15')]);});});}function getEndUser(_0x64d6d6,_0xa85151,_0x17c8eb,_0x3d7bb6,_0x5d6ffc,_0x5c80ec){return new BPromise(function(_0x132a6e,_0x3094ef){var _0x5d12fe=_0x5c80ec[_0xbcc0('0x30')]()===_0xbcc0('0x27')?_0x5d6ffc['destcalleridnum']:_0x5d6ffc[_0xbcc0('0x31')];return getAuthToken(_0xa85151,_0x17c8eb,_0x5c80ec)[_0xbcc0('0x11')](function(_0x7b4e9d){var _0x3b74a3={'method':_0xbcc0('0x16'),'uri':_0x3d7bb6+_0xbcc0('0x32')+_0x5d12fe[_0xbcc0('0x33')]('+',_0xbcc0('0x34'))+'\x27','headers':{'Authorization':_0xbcc0('0x18')+_0x7b4e9d,'If-None-Match':null,'OData-Version':_0xbcc0('0x2b')},'json':!![]};return rp(_0x3b74a3);})[_0xbcc0('0x11')](function(_0x5bb3fd){var _0x1d0e95=null;if(_0x5bb3fd){var _0x14a206=_0x5bb3fd['value'];var _0x1068a9=![];for(_0x1d0e95=0x0;_0x1d0e95<_0x14a206[_0xbcc0('0x1e')];_0x1d0e95++){if(_0x14a206[_0x1d0e95][_0xbcc0('0x35')]===_0x5d12fe){_0x1068a9=!![];_0x64d6d6[_0xbcc0('0x2f')]=_0x14a206[_0x1d0e95][_0xbcc0('0x36')];}}if(_0x1068a9){_0x132a6e(_0x64d6d6);}else{return createEndUser(_0x64d6d6,_0xa85151,_0x17c8eb,_0x3d7bb6,_0x5d6ffc,_0x5c80ec)[_0xbcc0('0x11')](function(_0x34a893){logger[_0xbcc0('0x21')]('['+[_0x5c80ec[_0xbcc0('0x22')]()]+_0xbcc0('0x37'),_0x34a893[_0xbcc0('0x2f')]);_0x132a6e(_0x34a893);});}}else{return createEndUser(_0x64d6d6,_0xa85151,_0x17c8eb,_0x3d7bb6,_0x5d6ffc,_0x5c80ec)[_0xbcc0('0x11')](function(_0x1106d6){logger[_0xbcc0('0x21')]('['+[_0x5c80ec[_0xbcc0('0x22')]()]+']\x20Enduser\x20Created!',_0x1106d6['enduserId']);_0x132a6e(_0x1106d6);});}});});}function getCustomFields(_0x573c08,_0x59e3ef,_0x3eede7){var _0x1ce959={};if(_0x573c08[_0xbcc0('0x1e')]>0x0){_['forEach'](_0x573c08,function(_0x1553e4){if(_['includes']([_0xbcc0('0x38'),_0xbcc0('0x39')],_0x1553e4[_0xbcc0('0x3a')])&&_0x1553e4[_0xbcc0('0x3b')]&&!_0x1553e4['customField']){var _0x305b2b=_0x1553e4[_0xbcc0('0x3c')][_0xbcc0('0x30')]();var _0x4ff8f4=_0x305b2b[_0xbcc0('0x2e')](0x0,_0x305b2b['indexOf']('_'));var _0x5d7c14=_0x305b2b[_0xbcc0('0x2e')](_0x305b2b['indexOf']('_')+0x1);if(_0x4ff8f4===_0x3eede7){_0x1ce959[_0x5d7c14]=_0x1553e4['content'];}}});}return _0x1ce959;}function getTicket(_0x26ecfd,_0x93eef3,_0x2f0398,_0x5e6e85,_0xb5a718,_0x11ab3c,_0x2cb705){return new BPromise(function(_0x1d4923,_0x1bd3ff){var _0x137947;return getAuthToken(_0x93eef3,_0x2f0398,_0x2cb705)[_0xbcc0('0x11')](function(_0xebc016){if(_0x11ab3c[_0xbcc0('0x3d')]===_0xbcc0('0x3e')){_0x137947={'method':_0xbcc0('0xb'),'uri':_0x5e6e85+_0xbcc0('0x3f'),'body':Object[_0xbcc0('0x40')]({},{'title':intUtil[_0xbcc0('0x41')](_0x11ab3c['Subjects'],_0xb5a718,'\x20'),'description':intUtil[_0xbcc0('0x41')](_0x11ab3c[_0xbcc0('0x42')],_0xb5a718,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x26ecfd[_0xbcc0('0x2f')]+')','ownerid@odata.bind':_0xbcc0('0x2a')+_0x26ecfd['userId']+')','caseorigincode':'1'},getCustomFields(_0x11ab3c[_0xbcc0('0x43')],_0xb5a718,_0x11ab3c[_0xbcc0('0x3d')])),'headers':{'Authorization':'Bearer\x20'+_0xebc016,'OData-Version':_0xbcc0('0x2b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x11ab3c[_0xbcc0('0x3d')]===_0xbcc0('0x44')){_0x137947={'method':_0xbcc0('0xb'),'uri':_0x5e6e85+_0xbcc0('0x45'),'body':Object[_0xbcc0('0x40')]({},{'subject':intUtil[_0xbcc0('0x41')](_0x11ab3c[_0xbcc0('0x46')],_0xb5a718,'\x20'),'phonenumber':String(_0xb5a718['calleridnum']),'description':intUtil[_0xbcc0('0x41')](_0x11ab3c[_0xbcc0('0x42')],_0xb5a718,'\x0a'),'regardingobjectid_contact@odata.bind':_0xbcc0('0x47')+_0x26ecfd[_0xbcc0('0x2f')]+')','ownerid@odata.bind':'/systemusers('+_0x26ecfd['userId']+')','directioncode':_0x26ecfd[_0xbcc0('0x48')]===_0xbcc0('0x49')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xbcc0('0x2a')+_0x26ecfd['userId']+')','participationtypemask':_0x26ecfd['callDirection']==='queue'?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x26ecfd['enduserId']+')','participationtypemask':_0x26ecfd[_0xbcc0('0x48')]===_0xbcc0('0x49')?0x1:0x2}]},getCustomFields(_0x11ab3c['Fields'],_0xb5a718,_0x11ab3c[_0xbcc0('0x3d')])),'headers':{'Authorization':'Bearer\x20'+_0xebc016,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x137947);})['then'](function(_0x4edf3e){var _0x4c7f3d=_0x4edf3e[_0xbcc0('0x2c')][_0xbcc0('0x2d')];var _0x541521=_0x4c7f3d[_0xbcc0('0x2e')](_0x4c7f3d[_0xbcc0('0x4a')]('(')+0x1,_0x4c7f3d[_0xbcc0('0x4a')](')'));_0x26ecfd[_0xbcc0('0x4b')]=_0x541521;_0x1d4923(_0x26ecfd);})[_0xbcc0('0x13')](function(_0xffee93){_0x1bd3ff(_0xffee93[_0xbcc0('0x15')]);});});}function emit(_0x1182ce,_0xaa28b7,_0x10987e,_0x4f4312){var _0xb49695={'uri':util[_0xbcc0('0x4c')](_0xbcc0('0x4d'),_0x1182ce,_0x10987e,_0x4f4312)};io['to'](util['format'](_0xbcc0('0x4e'),_0xaa28b7))['emit'](_0xbcc0('0x4f'),_0xb49695);}exports['cs']=function(_0x543508,_0x1799a1,_0x2d398c,_0x370770,_0x33f046,_0x3982ca,_0x57434e,_0x280799){var _0x22c6b1={};_0x3982ca[_0xbcc0('0xd')]=intUtil[_0xbcc0('0x50')](_0x3982ca[_0xbcc0('0xd')]);_0x3982ca['serverUrl']=intUtil[_0xbcc0('0x50')](_0x3982ca[_0xbcc0('0x51')]);_0x22c6b1[_0xbcc0('0x48')]=_0x280799===_0xbcc0('0x49')||_0x280799===_0xbcc0('0x52')?'queue':_0xbcc0('0x27');var _0x469854=util['format'](_0xbcc0('0x53'),_0x3982ca[_0xbcc0('0xd')]);var _0x380d89=util['format']('https://login.microsoftonline.com/%s/oauth2/token',_0x3982ca['tenantId']);var _0x131157=util[_0xbcc0('0x4c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3982ca[_0xbcc0('0x51')],_0x1799a1['uniqueid'],md5(_0x1799a1[_0xbcc0('0x54')]));if(_0x33f046&&_0x33f046[_0xbcc0('0x55')]){logger[_0xbcc0('0x21')](_0xbcc0('0x56'),_0xbcc0('0x57'));_0x1799a1[_0xbcc0('0x58')]=_0x131157;}else if(_0x57434e&&_0x57434e[_0xbcc0('0x59')]&&_0x57434e[_0xbcc0('0x59')]!=='none'){logger[_0xbcc0('0x21')](_0xbcc0('0x5a'),'Recording\x20is\x20enabled!');_0x1799a1[_0xbcc0('0x58')]=_0x131157;}else{_0x1799a1['recordingURL']='';}return getUser(_0x22c6b1,_0x3982ca,_0x370770,_0x380d89,_0x469854,_0x280799)['then'](function(_0x46b6f2){logger['info']('['+_0x280799[_0xbcc0('0x22')]()+_0xbcc0('0x5b'),_0x46b6f2['userId']);logger[_0xbcc0('0x21')]('['+_0x280799['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0x46b6f2['userEmail']);return getEndUser(_0x46b6f2,_0x3982ca,_0x380d89,_0x469854,_0x1799a1,_0x280799);})[_0xbcc0('0x11')](function(_0x2b11b3){logger['info']('['+_0x280799[_0xbcc0('0x22')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x2b11b3[_0xbcc0('0x2f')]);logger['info']('['+_0x280799[_0xbcc0('0x22')]()+_0xbcc0('0x5c'),_0x1799a1['calleridnum']);return getTicket(_0x2b11b3,_0x3982ca,_0x380d89,_0x469854,_0x1799a1,_0x2d398c,_0x280799);})[_0xbcc0('0x11')](function(_0x2d1615){logger['info'](util['format']('['+_0x280799[_0xbcc0('0x22')]()+_0xbcc0('0x5d'),_0x2d398c[_0xbcc0('0x3d')],_0x2d1615[_0xbcc0('0x4b')]));logger[_0xbcc0('0x21')](util['format']('['+_0x280799['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x280799));if(_0x280799!==_0xbcc0('0x52')){logger[_0xbcc0('0x21')]('['+_0x280799['toUpperCase']()+']',_0xbcc0('0x5e'));emit(_0x3982ca[_0xbcc0('0xd')],_0x370770[_0xbcc0('0x5f')],_0x2d398c[_0xbcc0('0x3d')],_0x2d1615[_0xbcc0('0x4b')]);}})[_0xbcc0('0x13')](function(_0x210341){logger['error']('['+_0x280799[_0xbcc0('0x22')]()+_0xbcc0('0x60'),util[_0xbcc0('0x61')](_0x210341,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7c25=['email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','destcalleridnum','calleridnum','/systemusers(','lastIndexOf','message','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','value','enduserId','contactid',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','idField','substring','indexOf','content','ticketType','incident','incidents','assign','Subjects','getString','Descriptions','/contacts(','Fields','phonecall','phonecalls','callDirection','queue','headers','odata-entityid','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','serverUrl','stripTrailingSlash','unmanaged','outbound','format','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','request-promise','util','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','error','toUpperCase','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0'];(function(_0x6fb7ec,_0x2cc36f){var _0x243017=function(_0x3d591c){while(--_0x3d591c){_0x6fb7ec['push'](_0x6fb7ec['shift']());}};_0x243017(++_0x2cc36f);}(_0x7c25,0x10e));var _0x57c2=function(_0x45b0d4,_0x131741){_0x45b0d4=_0x45b0d4-0x0;var _0x3d6c14=_0x7c25[_0x45b0d4];return _0x3d6c14;};'use strict';var _=require('lodash');var BPromise=require(_0x57c2('0x0'));var rp=require(_0x57c2('0x1'));var util=require(_0x57c2('0x2'));var intUtil=require('./util');var md5=require('md5');var Redis=require('ioredis');var logger=require('../../../../config/logger')(_0x57c2('0x3'));var config=require(_0x57c2('0x4'));config[_0x57c2('0x5')]=_[_0x57c2('0x6')](config[_0x57c2('0x5')],{'host':_0x57c2('0x7'),'port':0x18eb});var io=require(_0x57c2('0x8'))(new Redis(config[_0x57c2('0x5')]));function getAuthToken(_0x14de4f,_0x1ab8b1,_0x2de8bb){var _0x44dbb6={'method':_0x57c2('0x9'),'uri':_0x1ab8b1,'form':{'client_id':_0x14de4f[_0x57c2('0xa')],'resource':_0x14de4f[_0x57c2('0xb')],'username':_0x14de4f[_0x57c2('0xc')],'password':_0x14de4f['password'],'grant_type':_0x57c2('0xd'),'client_secret':_0x14de4f[_0x57c2('0xe')]},'json':!![]};return rp(_0x44dbb6)[_0x57c2('0xf')](function(_0x41db3c){return _0x41db3c[_0x57c2('0x10')];})[_0x57c2('0x11')](function(_0x490c06){logger[_0x57c2('0x12')]('['+[_0x2de8bb[_0x57c2('0x13')]()]+']\x20Wrong\x20credentials!');return _0x490c06['message'];});}function getUser(_0x47f3f6,_0x20e750,_0x53150d,_0x329b80,_0x53a011,_0x41bd29){return new BPromise(function(_0x21f48d,_0x3d118e){return getAuthToken(_0x20e750,_0x329b80,_0x41bd29)[_0x57c2('0xf')](function(_0x1d5590){var _0x5a9a9f={'method':_0x57c2('0x14'),'uri':_0x53a011+_0x57c2('0x15'),'headers':{'Authorization':_0x57c2('0x16')+_0x1d5590,'OData-Version':_0x57c2('0x17')},'json':!![]};return rp(_0x5a9a9f);})[_0x57c2('0xf')](function(_0x45554a){var _0x3a3e48=_0x45554a['value'];var _0x30f162=![];var _0x201c7d=null;if(!_['isNil'](_0x53150d)){if(intUtil['validateEmail'](_0x53150d[_0x57c2('0x18')])){_0x47f3f6[_0x57c2('0x19')]=_0x53150d[_0x57c2('0x18')];for(_0x201c7d=0x0;_0x201c7d<_0x3a3e48[_0x57c2('0x1a')];_0x201c7d++){if(_0x3a3e48[_0x201c7d][_0x57c2('0x1b')]===_0x53150d[_0x57c2('0x18')]&&!_0x3a3e48[_0x201c7d][_0x57c2('0x1c')]){_0x30f162=!![];logger[_0x57c2('0x1d')]('['+[_0x41bd29['toUpperCase']()]+_0x57c2('0x1e')+_0x3a3e48[_0x201c7d][_0x57c2('0x1f')]+'!');_0x47f3f6[_0x57c2('0x20')]=_0x3a3e48[_0x201c7d][_0x57c2('0x1f')];}}}}if(!_0x30f162){logger['info']('['+[_0x41bd29[_0x57c2('0x13')]()]+_0x57c2('0x21'));_0x47f3f6['userEmail']=_0x20e750[_0x57c2('0xc')];for(_0x201c7d=0x0;_0x201c7d<_0x3a3e48[_0x57c2('0x1a')];_0x201c7d++){if(_0x3a3e48[_0x201c7d][_0x57c2('0x1b')]===_0x20e750['username']){_0x47f3f6[_0x57c2('0x20')]=_0x3a3e48[_0x201c7d][_0x57c2('0x1f')];}}}_0x21f48d(_0x47f3f6);})[_0x57c2('0x11')](function(_0x13a5d5){_0x3d118e(_0x13a5d5['message']);});});}function createEndUser(_0x99bfc7,_0x37ccb6,_0x2801d2,_0x366296,_0x15ad17,_0xf07439){return new BPromise(function(_0x1ab3af,_0x35b69c){return getAuthToken(_0x37ccb6,_0x2801d2,_0xf07439)[_0x57c2('0xf')](function(_0x4076bd){var _0x5d5284=_0xf07439[_0x57c2('0x22')]()==='outbound'?_0x15ad17[_0x57c2('0x23')]:_0x15ad17[_0x57c2('0x24')];var _0x596a36={'method':_0x57c2('0x9'),'uri':_0x366296+'contacts','body':{'telephone1':_0x5d5284,'fullname':_0x5d5284,'firstname':_0x5d5284,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x57c2('0x25')+_0x99bfc7[_0x57c2('0x20')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x4076bd,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x596a36);})['then'](function(_0x341142){var _0x2c3cce=_0x341142['headers']['odata-entityid'];var _0x20ab5f=_0x2c3cce['substring'](_0x2c3cce['lastIndexOf']('(')+0x1,_0x2c3cce[_0x57c2('0x26')](')'));_0x99bfc7['enduserId']=_0x20ab5f;_0x1ab3af(_0x99bfc7);})[_0x57c2('0x11')](function(_0x55196f){_0x35b69c(_0x55196f[_0x57c2('0x27')]);});});}function getEndUser(_0x1ba9a6,_0x1a44fa,_0x1ff6ae,_0x1a903c,_0x431faf,_0x56b27b){return new BPromise(function(_0x1fbd3b,_0x3fbdfc){var _0x258d47=_0x56b27b['toLowerCase']()==='outbound'?_0x431faf[_0x57c2('0x23')]:_0x431faf[_0x57c2('0x24')];return getAuthToken(_0x1a44fa,_0x1ff6ae,_0x56b27b)[_0x57c2('0xf')](function(_0x8f87de){var _0x1b09aa={'method':_0x57c2('0x14'),'uri':_0x1a903c+_0x57c2('0x28')+_0x258d47[_0x57c2('0x29')]('+',_0x57c2('0x2a'))+'\x27','headers':{'Authorization':_0x57c2('0x16')+_0x8f87de,'If-None-Match':null,'OData-Version':_0x57c2('0x17')},'json':!![]};return rp(_0x1b09aa);})[_0x57c2('0xf')](function(_0xe3dc89){var _0xc174e5=null;if(_0xe3dc89){var _0x8e2bc=_0xe3dc89[_0x57c2('0x2b')];var _0x3d2e1c=![];for(_0xc174e5=0x0;_0xc174e5<_0x8e2bc[_0x57c2('0x1a')];_0xc174e5++){if(_0x8e2bc[_0xc174e5]['telephone1']===_0x258d47){_0x3d2e1c=!![];_0x1ba9a6[_0x57c2('0x2c')]=_0x8e2bc[_0xc174e5][_0x57c2('0x2d')];}}if(_0x3d2e1c){_0x1fbd3b(_0x1ba9a6);}else{return createEndUser(_0x1ba9a6,_0x1a44fa,_0x1ff6ae,_0x1a903c,_0x431faf,_0x56b27b)['then'](function(_0x4a830f){logger[_0x57c2('0x1d')]('['+[_0x56b27b['toUpperCase']()]+_0x57c2('0x2e'),_0x4a830f[_0x57c2('0x2c')]);_0x1fbd3b(_0x4a830f);});}}else{return createEndUser(_0x1ba9a6,_0x1a44fa,_0x1ff6ae,_0x1a903c,_0x431faf,_0x56b27b)['then'](function(_0x3932d3){logger[_0x57c2('0x1d')]('['+[_0x56b27b[_0x57c2('0x13')]()]+']\x20Enduser\x20Created!',_0x3932d3[_0x57c2('0x2c')]);_0x1fbd3b(_0x3932d3);});}});});}function getCustomFields(_0x413652,_0x291f8e,_0x42bea6){var _0xa12abf={};if(_0x413652[_0x57c2('0x1a')]>0x0){_[_0x57c2('0x2f')](_0x413652,function(_0x451fe0){if(_[_0x57c2('0x30')]([_0x57c2('0x31'),_0x57c2('0x32')],_0x451fe0[_0x57c2('0x33')])&&_0x451fe0[_0x57c2('0x34')]&&!_0x451fe0['customField']){var _0x27b9e4=_0x451fe0[_0x57c2('0x35')][_0x57c2('0x22')]();var _0x292c1e=_0x27b9e4[_0x57c2('0x36')](0x0,_0x27b9e4['indexOf']('_'));var _0x37eeec=_0x27b9e4[_0x57c2('0x36')](_0x27b9e4[_0x57c2('0x37')]('_')+0x1);if(_0x292c1e===_0x42bea6){_0xa12abf[_0x37eeec]=_0x451fe0[_0x57c2('0x38')];}}});}return _0xa12abf;}function getTicket(_0x27bab9,_0x2cd274,_0x2782ff,_0x4fe312,_0x261480,_0x2f0608,_0x19dec2){return new BPromise(function(_0xc26d05,_0x4e34f2){var _0x4436d9;return getAuthToken(_0x2cd274,_0x2782ff,_0x19dec2)['then'](function(_0x14a396){if(_0x2f0608[_0x57c2('0x39')]===_0x57c2('0x3a')){_0x4436d9={'method':_0x57c2('0x9'),'uri':_0x4fe312+_0x57c2('0x3b'),'body':Object[_0x57c2('0x3c')]({},{'title':intUtil['getString'](_0x2f0608[_0x57c2('0x3d')],_0x261480,'\x20'),'description':intUtil[_0x57c2('0x3e')](_0x2f0608[_0x57c2('0x3f')],_0x261480,'\x0a'),'customerid_contact@odata.bind':_0x57c2('0x40')+_0x27bab9['enduserId']+')','ownerid@odata.bind':_0x57c2('0x25')+_0x27bab9[_0x57c2('0x20')]+')','caseorigincode':'1'},getCustomFields(_0x2f0608[_0x57c2('0x41')],_0x261480,_0x2f0608[_0x57c2('0x39')])),'headers':{'Authorization':'Bearer\x20'+_0x14a396,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2f0608['ticketType']===_0x57c2('0x42')){_0x4436d9={'method':_0x57c2('0x9'),'uri':_0x4fe312+_0x57c2('0x43'),'body':Object[_0x57c2('0x3c')]({},{'subject':intUtil[_0x57c2('0x3e')](_0x2f0608[_0x57c2('0x3d')],_0x261480,'\x20'),'phonenumber':String(_0x261480[_0x57c2('0x24')]),'description':intUtil[_0x57c2('0x3e')](_0x2f0608[_0x57c2('0x3f')],_0x261480,'\x0a'),'regardingobjectid_contact@odata.bind':_0x57c2('0x40')+_0x27bab9['enduserId']+')','ownerid@odata.bind':'/systemusers('+_0x27bab9[_0x57c2('0x20')]+')','directioncode':_0x27bab9[_0x57c2('0x44')]===_0x57c2('0x45')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x57c2('0x25')+_0x27bab9['userId']+')','participationtypemask':_0x27bab9[_0x57c2('0x44')]===_0x57c2('0x45')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x27bab9[_0x57c2('0x2c')]+')','participationtypemask':_0x27bab9[_0x57c2('0x44')]===_0x57c2('0x45')?0x1:0x2}]},getCustomFields(_0x2f0608[_0x57c2('0x41')],_0x261480,_0x2f0608['ticketType'])),'headers':{'Authorization':_0x57c2('0x16')+_0x14a396,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4436d9);})[_0x57c2('0xf')](function(_0x32055f){var _0x4f5f2f=_0x32055f[_0x57c2('0x46')][_0x57c2('0x47')];var _0x4382e6=_0x4f5f2f[_0x57c2('0x36')](_0x4f5f2f[_0x57c2('0x26')]('(')+0x1,_0x4f5f2f[_0x57c2('0x26')](')'));_0x27bab9[_0x57c2('0x48')]=_0x4382e6;_0xc26d05(_0x27bab9);})['catch'](function(_0x73b733){_0x4e34f2(_0x73b733['message']);});});}function emit(_0x40aea0,_0xc326ad,_0x1ca44d,_0x1eb295){var _0x32f929={'uri':util['format'](_0x57c2('0x49'),_0x40aea0,_0x1ca44d,_0x1eb295)};io['to'](util['format'](_0x57c2('0x4a'),_0xc326ad))[_0x57c2('0x4b')]('trigger:browser:url',_0x32f929);}exports['cs']=function(_0xb33955,_0x54120c,_0x2e39c2,_0x159eeb,_0x1d1635,_0x4870d3,_0xe27852,_0x2e289b){var _0x17621d={};_0x4870d3['remoteUri']=intUtil['stripTrailingSlash'](_0x4870d3[_0x57c2('0xb')]);_0x4870d3[_0x57c2('0x4c')]=intUtil[_0x57c2('0x4d')](_0x4870d3[_0x57c2('0x4c')]);_0x17621d['callDirection']=_0x2e289b==='queue'||_0x2e289b===_0x57c2('0x4e')?_0x57c2('0x45'):_0x57c2('0x4f');var _0x4c9215=util[_0x57c2('0x50')](_0x57c2('0x51'),_0x4870d3[_0x57c2('0xb')]);var _0x24643e=util[_0x57c2('0x50')]('https://login.microsoftonline.com/%s/oauth2/token',_0x4870d3['tenantId']);var _0x26b533=util['format'](_0x57c2('0x52'),_0x4870d3['serverUrl'],_0x54120c[_0x57c2('0x53')],md5(_0x54120c['uniqueid']));if(_0x1d1635&&_0x1d1635['monitor_format']){logger[_0x57c2('0x1d')](_0x57c2('0x54'),_0x57c2('0x55'));_0x54120c[_0x57c2('0x56')]=_0x26b533;}else if(_0xe27852&&_0xe27852['recordingFormat']&&_0xe27852[_0x57c2('0x57')]!==_0x57c2('0x58')){logger[_0x57c2('0x1d')](_0x57c2('0x59'),_0x57c2('0x55'));_0x54120c['recordingURL']=_0x26b533;}else{_0x54120c[_0x57c2('0x56')]='';}return getUser(_0x17621d,_0x4870d3,_0x159eeb,_0x24643e,_0x4c9215,_0x2e289b)[_0x57c2('0xf')](function(_0x5516ef){logger[_0x57c2('0x1d')]('['+_0x2e289b[_0x57c2('0x13')]()+_0x57c2('0x5a'),_0x5516ef[_0x57c2('0x20')]);logger[_0x57c2('0x1d')]('['+_0x2e289b['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0x5516ef['userEmail']);return getEndUser(_0x5516ef,_0x4870d3,_0x24643e,_0x4c9215,_0x54120c,_0x2e289b);})[_0x57c2('0xf')](function(_0x2e7d6c){logger[_0x57c2('0x1d')]('['+_0x2e289b[_0x57c2('0x13')]()+_0x57c2('0x5b'),_0x2e7d6c[_0x57c2('0x2c')]);logger['info']('['+_0x2e289b[_0x57c2('0x13')]()+_0x57c2('0x5c'),_0x54120c[_0x57c2('0x24')]);return getTicket(_0x2e7d6c,_0x4870d3,_0x24643e,_0x4c9215,_0x54120c,_0x2e39c2,_0x2e289b);})['then'](function(_0x476184){logger['info'](util[_0x57c2('0x50')]('['+_0x2e289b[_0x57c2('0x13')]()+_0x57c2('0x5d'),_0x2e39c2[_0x57c2('0x39')],_0x476184['ticketId']));logger[_0x57c2('0x1d')](util[_0x57c2('0x50')]('['+_0x2e289b[_0x57c2('0x13')]()+']\x20Call\x20direction:\x20%s',_0x2e289b));if(_0x2e289b!==_0x57c2('0x4e')){logger[_0x57c2('0x1d')]('['+_0x2e289b[_0x57c2('0x13')]()+']',_0x57c2('0x5e'));emit(_0x4870d3[_0x57c2('0xb')],_0x159eeb[_0x57c2('0x5f')],_0x2e39c2['ticketType'],_0x476184[_0x57c2('0x48')]);}})[_0x57c2('0x11')](function(_0x1bf183){logger[_0x57c2('0x12')]('['+_0x2e289b[_0x57c2('0x13')]()+_0x57c2('0x60'),util[_0x57c2('0x61')](_0x1bf183,{'showHidden':!![],'depth':null}));});}; \ 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 dc5aca0..ddf3647 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 _0x6d9b=['%s/api/v2/contacts','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','type','nameField','content','toString','picklist','idField','customField','push','variable','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','catch','unmanaged','monitor_format','lastevent','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','Descriptions','
','name','Fields','custom_fields','keyBy','format','remoteUri','POST','Ticket\x20created!','validateEmail','%s/api/v2/agents','then','length','Agent\x20found!','contact','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'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6d9b,0x1c0));var _0xb6d9=function(_0x15ec39,_0x1fb58e){_0x15ec39=_0x15ec39-0x0;var _0x49d068=_0x6d9b[_0x15ec39];return _0x49d068;};'use strict';var _=require(_0xb6d9('0x0'));var rp=require(_0xb6d9('0x1'));var md5=require(_0xb6d9('0x2'));var util=require(_0xb6d9('0x3'));var Redis=require('ioredis');var intUtil=require(_0xb6d9('0x4'));var config=require(_0xb6d9('0x5'));var logger=require(_0xb6d9('0x6'))(_0xb6d9('0x7'));config[_0xb6d9('0x8')]=_[_0xb6d9('0x9')](config['redis'],{'host':_0xb6d9('0xa'),'port':0x18eb});var io=require(_0xb6d9('0xb'))(new Redis(config[_0xb6d9('0x8')]));var headers={'Content-Type':_0xb6d9('0xc'),'Accept':_0xb6d9('0xc')};function emit(_0x5e567c,_0x282fa2,_0x3a4a9d){io['to'](_0x5e567c)[_0xb6d9('0xd')](_0x282fa2,_0x3a4a9d);}function getTicket(_0xa077de,_0x3b4f7d,_0x28e9ca,_0x42c3ee,_0x9fd67b){logger[_0xb6d9('0xe')](_0xb6d9('0xf'));var _0x301430=_[_0xb6d9('0x10')]({'responder_id':_0x3b4f7d['id'],'requester_id':_0x28e9ca['id'],'name':util['format'](_0xb6d9('0x11'),_0x9fd67b[_0xb6d9('0x12')]),'phone':_0x9fd67b[_0xb6d9('0x13')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x42c3ee[_0xb6d9('0x14')],_0x9fd67b,'\x20'),'description':intUtil['getString'](_0x42c3ee[_0xb6d9('0x15')],_0x9fd67b,_0xb6d9('0x16')),'tags':getTags(_0x42c3ee['Tags'],_0xb6d9('0x17'))},getCustomFields(_0x42c3ee[_0xb6d9('0x18')],_0x9fd67b));_0x301430[_0xb6d9('0x19')]=_['mapValues'](_[_0xb6d9('0x1a')](_0x301430[_0xb6d9('0x19')],'id'),'value');return request({'uri':util[_0xb6d9('0x1b')]('%s/api/v2/tickets',_0xa077de[_0xb6d9('0x1c')]),'method':_0xb6d9('0x1d'),'body':_0x301430})['then'](function(_0x440361){logger['info'](_0xb6d9('0x1e'));return _0x440361;});}function getUser(_0x3260bc,_0x49a839){if(intUtil[_0xb6d9('0x1f')](_0x49a839)){return request({'uri':util['format'](_0xb6d9('0x20'),_0x3260bc['remoteUri']),'qs':{'email':_0x49a839}})[_0xb6d9('0x21')](function(_0x3245d1){if(_0x3245d1[_0xb6d9('0x22')]){logger['info'](_0xb6d9('0x23'));return _['find'](_0x3245d1,function(_0x3ebec1){return _0x3ebec1[_0xb6d9('0x24')]['email']===_0x49a839;});}else{logger[_0xb6d9('0xe')](_0xb6d9('0x25'));return request({'uri':util[_0xb6d9('0x1b')](_0xb6d9('0x26'),_0x3260bc['remoteUri'])})['then'](function(_0x564b54){logger['info'](_0xb6d9('0x27'));return _0x564b54;});}});}else{logger[_0xb6d9('0xe')](_0xb6d9('0x28'));return request({'uri':util[_0xb6d9('0x1b')]('%s/api/v2/agents/me',_0x3260bc[_0xb6d9('0x1c')])})[_0xb6d9('0x21')](function(_0x2480a6){logger[_0xb6d9('0xe')](_0xb6d9('0x27'));return _0x2480a6;});}}function getEndUser(_0x1dde35,_0x5be8e0,_0x47fb22){logger['info'](_0xb6d9('0x29'),_0x47fb22);return request({'uri':util[_0xb6d9('0x1b')](_0xb6d9('0x2a'),_0x1dde35['remoteUri']),'qs':{'phone':_0x47fb22}})[_0xb6d9('0x21')](function(_0x98762a){if(_0x98762a[_0xb6d9('0x22')]){logger[_0xb6d9('0xe')](_0xb6d9('0x2b'));return _[_0xb6d9('0x2c')](_0x98762a,{'phone':_0x47fb22});}else{logger[_0xb6d9('0xe')](_0xb6d9('0x2d'));return request({'uri':util[_0xb6d9('0x1b')](_0xb6d9('0x2a'),_0x1dde35['remoteUri']),'method':_0xb6d9('0x1d'),'body':{'name':_0x5be8e0,'phone':_0x47fb22}})['then'](function(_0x26f3b0){logger[_0xb6d9('0xe')](_0xb6d9('0x2e'));return _0x26f3b0;});}});}function getAuth(_0x4db8b1){return util[_0xb6d9('0x1b')](_0xb6d9('0x2f'),new Buffer(_0x4db8b1['apiKey']+':X')['toString'](_0xb6d9('0x30')));}function request(_0x1340b7){logger[_0xb6d9('0x31')](_0xb6d9('0x32'),JSON[_0xb6d9('0x33')](_0x1340b7));return rp(_['defaults'](_0x1340b7,{'method':_0xb6d9('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x40c404,_0x4c814a){var _0xfc0ae7=[];if(_0x40c404&&_0x40c404['length']>0x0){_0xfc0ae7=_[_0xb6d9('0x35')](_0x40c404,_0x4c814a);}return _0xfc0ae7;}function getCustomFields(_0xb94349,_0x328d59){var _0x31ac0a=[];var _0x1daf37={'custom_fields':[]};if(_0xb94349[_0xb6d9('0x22')]>0x0){_[_0xb6d9('0x36')](_0xb94349,function(_0x1303d0){if(_[_0xb6d9('0x37')]([_0xb6d9('0x38'),'picklist'],_0x1303d0[_0xb6d9('0x39')])&&_0x1303d0['nameField']&&!_0x1303d0['customField']){_0x1daf37[_0x1303d0[_0xb6d9('0x3a')]['toLowerCase']()]=_0x1303d0[_0xb6d9('0x3b')][_0xb6d9('0x3c')]();}else if(_[_0xb6d9('0x37')]([_0xb6d9('0x38'),_0xb6d9('0x3d')],_0x1303d0['type'])&&_0x1303d0[_0xb6d9('0x3e')]&&_0x1303d0[_0xb6d9('0x3f')]){_0x1daf37['custom_fields'][_0xb6d9('0x40')]({'id':_0x1303d0[_0xb6d9('0x3e')],'value':_0x1303d0[_0xb6d9('0x3b')][_0xb6d9('0x3c')]()});}else if(_0x1303d0[_0xb6d9('0x39')]===_0xb6d9('0x41')&&_0x1303d0[_0xb6d9('0x42')]&&_0x1303d0[_0xb6d9('0x3e')]&&_0x1303d0[_0xb6d9('0x3f')]){_0x328d59[_0x1303d0['variableName']]&&_0x1daf37[_0xb6d9('0x19')][_0xb6d9('0x40')]({'id':_0x1303d0[_0xb6d9('0x3e')],'value':_0x328d59[_0x1303d0[_0xb6d9('0x42')]][_0xb6d9('0x3c')]()});}else if(_0x1303d0[_0xb6d9('0x39')]===_0xb6d9('0x43')&&_0x1303d0['Variable']&&_0x1303d0[_0xb6d9('0x44')]['name']&&_0x1303d0[_0xb6d9('0x3e')]&&_0x1303d0[_0xb6d9('0x3f')]){_0x328d59[_0x1303d0[_0xb6d9('0x44')][_0xb6d9('0x17')][_0xb6d9('0x45')]()]&&_0x1daf37['custom_fields'][_0xb6d9('0x40')]({'id':_0x1303d0[_0xb6d9('0x3e')],'value':_0x328d59[_0x1303d0['Variable']['name'][_0xb6d9('0x45')]()][_0xb6d9('0x3c')]()});}});}return _0x1daf37;}exports[_0xb6d9('0x46')]=function(_0x18635e,_0x476a06,_0x3a50f1,_0x42300f,_0x5315f6,_0x10656d){var _0x2c0e36,_0x302cc0;_0x10656d[_0xb6d9('0x1c')]=intUtil[_0xb6d9('0x47')](_0x10656d[_0xb6d9('0x1c')]);_0x10656d[_0xb6d9('0x48')]=intUtil[_0xb6d9('0x47')](_0x10656d[_0xb6d9('0x48')]);if(_0x5315f6&&_0x5315f6['monitor_format']){logger[_0xb6d9('0xe')]('[QUEUE]',_0xb6d9('0x49'));_0x476a06[_0xb6d9('0x4a')]=util[_0xb6d9('0x1b')](_0xb6d9('0x4b'),_0x10656d[_0xb6d9('0x48')],_0x476a06[_0xb6d9('0x4c')],md5(_0x476a06[_0xb6d9('0x4c')]));}else{_0x476a06[_0xb6d9('0x4a')]='';}headers[_0xb6d9('0x4d')]=getAuth(_0x10656d);return getUser(_0x10656d,_0x42300f[_0xb6d9('0x4e')])['then'](function(_0x4bb3c5){_0x2c0e36=_0x4bb3c5;logger[_0xb6d9('0xe')]('The\x20User\x20ID\x20is:',_0x2c0e36['id']);return getEndUser(_0x10656d,_0x476a06[_0xb6d9('0x12')],_0x476a06[_0xb6d9('0x13')]);})['then'](function(_0x1af75c){_0x302cc0=_0x1af75c;logger[_0xb6d9('0xe')](_0xb6d9('0x4f'),_0x302cc0['id']);return getTicket(_0x10656d,_0x2c0e36,_0x302cc0,_0x3a50f1,_0x476a06);})[_0xb6d9('0x21')](function(_0x35d79e){if(_0x35d79e&&_0x35d79e['id']){logger[_0xb6d9('0xe')](_0xb6d9('0x1e'));logger[_0xb6d9('0xe')](_0xb6d9('0x50'),_0x35d79e['id']);logger[_0xb6d9('0xe')](_0xb6d9('0x51'),_0xb6d9('0x52'));emit(util['format'](_0xb6d9('0x53'),_0x42300f[_0xb6d9('0x17')]),_0xb6d9('0x54'),{'uri':util[_0xb6d9('0x1b')](_0xb6d9('0x55'),_0x10656d['remoteUri'],_0x35d79e['id'])});}})['catch'](function(_0x346b73){logger[_0xb6d9('0x56')]('[QUEUE]',JSON[_0xb6d9('0x33')](_0x346b73));});};exports[_0xb6d9('0x57')]=function(_0x1ccb59,_0x111205,_0x3cb75d,_0x39285c,_0xc8c86,_0x5de7c1,_0x314ee1){var _0x546a1e,_0x3e3fe9;_0x5de7c1[_0xb6d9('0x1c')]=intUtil[_0xb6d9('0x47')](_0x5de7c1['remoteUri']);_0x5de7c1[_0xb6d9('0x48')]=intUtil[_0xb6d9('0x47')](_0x5de7c1[_0xb6d9('0x48')]);if(_0x314ee1&&_0x314ee1[_0xb6d9('0x58')]&&_0x314ee1[_0xb6d9('0x58')]!=='none'){logger[_0xb6d9('0xe')](_0xb6d9('0x59'),_0xb6d9('0x49'));_0x111205[_0xb6d9('0x4a')]=util[_0xb6d9('0x1b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5de7c1[_0xb6d9('0x48')],_0x111205[_0xb6d9('0x4c')],md5(_0x111205['uniqueid']));}headers['Authorization']=getAuth(_0x5de7c1);return getUser(_0x5de7c1,_0x39285c[_0xb6d9('0x4e')])['then'](function(_0x3835b4){_0x546a1e=_0x3835b4;logger[_0xb6d9('0xe')](_0xb6d9('0x5a'),_0x546a1e['id']);return getEndUser(_0x5de7c1,_0x111205[_0xb6d9('0x5b')],_0x111205[_0xb6d9('0x5c')]);})['then'](function(_0x382383){_0x3e3fe9=_0x382383;logger[_0xb6d9('0xe')](_0xb6d9('0x4f'),_0x3e3fe9['id']);return getTicket(_0x5de7c1,_0x546a1e,_0x3e3fe9,_0x3cb75d,_0x111205);})[_0xb6d9('0x21')](function(_0x5c2fd8){if(_0x5c2fd8&&_0x5c2fd8['id']){logger[_0xb6d9('0xe')](_0xb6d9('0x1e'));logger[_0xb6d9('0xe')](_0xb6d9('0x50'),_0x5c2fd8['id']);logger[_0xb6d9('0xe')]('[OUTBOUND]',_0xb6d9('0x52'));emit(util[_0xb6d9('0x1b')]('user:%s',_0x39285c[_0xb6d9('0x17')]),'trigger:browser:url',{'uri':util[_0xb6d9('0x1b')]('%s/helpdesk/tickets/%d',_0x5de7c1['remoteUri'],_0x5c2fd8['id'])});}})[_0xb6d9('0x5d')](function(_0x4c1bcd){logger[_0xb6d9('0x56')](_0xb6d9('0x59'),JSON[_0xb6d9('0x33')](_0x4c1bcd));});};exports[_0xb6d9('0x5e')]=function(_0x2d75e7,_0x201ebc,_0x20fa3e,_0x3ce241,_0x2507bb,_0x40cbfe){var _0x322658,_0x2c77cc;_0x40cbfe[_0xb6d9('0x1c')]=intUtil[_0xb6d9('0x47')](_0x40cbfe[_0xb6d9('0x1c')]);_0x40cbfe[_0xb6d9('0x48')]=intUtil[_0xb6d9('0x47')](_0x40cbfe['serverUrl']);if(_0x2507bb&&_0x2507bb[_0xb6d9('0x5f')]){logger['info']('['+_0x201ebc[_0xb6d9('0x60')][_0xb6d9('0x61')]()+']','Recording\x20is\x20enabled!');_0x201ebc['recordingURL']=util['format'](_0xb6d9('0x4b'),_0x40cbfe['serverUrl'],_0x201ebc[_0xb6d9('0x4c')],md5(_0x201ebc['uniqueid']));}else{_0x201ebc[_0xb6d9('0x4a')]='';}headers[_0xb6d9('0x4d')]=getAuth(_0x40cbfe);return getUser(_0x40cbfe,'')[_0xb6d9('0x21')](function(_0x23e7fb){_0x322658=_0x23e7fb;logger['info'](_0xb6d9('0x5a'),_0x322658['id']);return getEndUser(_0x40cbfe,_0x201ebc[_0xb6d9('0x12')],_0x201ebc[_0xb6d9('0x13')]);})[_0xb6d9('0x21')](function(_0x22f19c){_0x2c77cc=_0x22f19c;logger[_0xb6d9('0xe')](_0xb6d9('0x4f'),_0x2c77cc['id']);return getTicket(_0x40cbfe,_0x322658,_0x2c77cc,_0x20fa3e,_0x201ebc);})[_0xb6d9('0x21')](function(_0x49b93e){if(_0x49b93e){logger[_0xb6d9('0xe')](_0xb6d9('0x1e'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x49b93e['id']);}})[_0xb6d9('0x5d')](function(_0x35a1ff){logger[_0xb6d9('0x56')]('['+_0x201ebc[_0xb6d9('0x60')][_0xb6d9('0x61')]()+']',JSON['stringify'](_0x35a1ff));});}; \ No newline at end of file +var _0x34d2=['Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','length','Agent\x20found!','contact','email','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','%s/api/v2/contacts','Enduser\x20created.','apiKey','toString','base64','stringify','GET','map','forEach','includes','string','type','nameField','customField','toLowerCase','content','picklist','idField','push','variable','variableName','customVariable','Variable','queue','serverUrl','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','lastevent','toUpperCase','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','defaults','redis','localhost','application/json','emit','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','POST','then','info'];(function(_0x4d9b26,_0x287573){var _0x3cce89=function(_0x2e62bf){while(--_0x2e62bf){_0x4d9b26['push'](_0x4d9b26['shift']());}};_0x3cce89(++_0x287573);}(_0x34d2,0x1ad));var _0x234d=function(_0x1c0fc6,_0x216b51){_0x1c0fc6=_0x1c0fc6-0x0;var _0x4fb60b=_0x34d2[_0x1c0fc6];return _0x4fb60b;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x234d('0x0'));var util=require(_0x234d('0x1'));var Redis=require(_0x234d('0x2'));var intUtil=require(_0x234d('0x3'));var config=require(_0x234d('0x4'));var logger=require(_0x234d('0x5'))(_0x234d('0x6'));config['redis']=_[_0x234d('0x7')](config[_0x234d('0x8')],{'host':_0x234d('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x234d('0x8')]));var headers={'Content-Type':_0x234d('0xa'),'Accept':_0x234d('0xa')};function emit(_0x4b0280,_0x2b68ca,_0x278022){io['to'](_0x4b0280)[_0x234d('0xb')](_0x2b68ca,_0x278022);}function getTicket(_0x1f481d,_0x3619e6,_0x4128ea,_0x1dfe13,_0x54e33a){logger['info'](_0x234d('0xc'));var _0x15b0c6=_['merge']({'responder_id':_0x3619e6['id'],'requester_id':_0x4128ea['id'],'name':util[_0x234d('0xd')](_0x234d('0xe'),_0x54e33a[_0x234d('0xf')]),'phone':_0x54e33a['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x234d('0x10')](_0x1dfe13[_0x234d('0x11')],_0x54e33a,'\x20'),'description':intUtil[_0x234d('0x10')](_0x1dfe13[_0x234d('0x12')],_0x54e33a,_0x234d('0x13')),'tags':getTags(_0x1dfe13[_0x234d('0x14')],_0x234d('0x15'))},getCustomFields(_0x1dfe13[_0x234d('0x16')],_0x54e33a));_0x15b0c6[_0x234d('0x17')]=_[_0x234d('0x18')](_[_0x234d('0x19')](_0x15b0c6[_0x234d('0x17')],'id'),_0x234d('0x1a'));return request({'uri':util[_0x234d('0xd')](_0x234d('0x1b'),_0x1f481d['remoteUri']),'method':_0x234d('0x1c'),'body':_0x15b0c6})[_0x234d('0x1d')](function(_0x18680b){logger[_0x234d('0x1e')](_0x234d('0x1f'));return _0x18680b;});}function getUser(_0x1f89a7,_0x447f05){if(intUtil[_0x234d('0x20')](_0x447f05)){return request({'uri':util[_0x234d('0xd')](_0x234d('0x21'),_0x1f89a7[_0x234d('0x22')]),'qs':{'email':_0x447f05}})[_0x234d('0x1d')](function(_0x11bcd5){if(_0x11bcd5[_0x234d('0x23')]){logger['info'](_0x234d('0x24'));return _['find'](_0x11bcd5,function(_0x1dde74){return _0x1dde74[_0x234d('0x25')][_0x234d('0x26')]===_0x447f05;});}else{logger[_0x234d('0x1e')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x234d('0x27'),_0x1f89a7[_0x234d('0x22')])})['then'](function(_0x53f908){logger[_0x234d('0x1e')]('Admin\x20account\x20selected.');return _0x53f908;});}});}else{logger[_0x234d('0x1e')](_0x234d('0x28'));return request({'uri':util['format'](_0x234d('0x27'),_0x1f89a7[_0x234d('0x22')])})['then'](function(_0x329a6f){logger[_0x234d('0x1e')](_0x234d('0x29'));return _0x329a6f;});}}function getEndUser(_0x3b9b72,_0x531ea,_0x19504b){logger[_0x234d('0x1e')](_0x234d('0x2a'),_0x19504b);return request({'uri':util[_0x234d('0xd')]('%s/api/v2/contacts',_0x3b9b72[_0x234d('0x22')]),'qs':{'phone':_0x19504b}})['then'](function(_0x3a719d){if(_0x3a719d[_0x234d('0x23')]){logger[_0x234d('0x1e')](_0x234d('0x2b'));return _['find'](_0x3a719d,{'phone':_0x19504b});}else{logger[_0x234d('0x1e')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x234d('0xd')](_0x234d('0x2c'),_0x3b9b72['remoteUri']),'method':_0x234d('0x1c'),'body':{'name':_0x531ea,'phone':_0x19504b}})[_0x234d('0x1d')](function(_0x49bb4c){logger[_0x234d('0x1e')](_0x234d('0x2d'));return _0x49bb4c;});}});}function getAuth(_0x379589){return util[_0x234d('0xd')]('Basic\x20%s',new Buffer(_0x379589[_0x234d('0x2e')]+':X')[_0x234d('0x2f')](_0x234d('0x30')));}function request(_0x45e531){logger['debug']('[HTTP]',JSON[_0x234d('0x31')](_0x45e531));return rp(_[_0x234d('0x7')](_0x45e531,{'method':_0x234d('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x2fe4eb,_0x20817d){var _0x4a2d76=[];if(_0x2fe4eb&&_0x2fe4eb['length']>0x0){_0x4a2d76=_[_0x234d('0x33')](_0x2fe4eb,_0x20817d);}return _0x4a2d76;}function getCustomFields(_0x5f0130,_0x5c3ae5){var _0xff2cfc=[];var _0x28a572={'custom_fields':[]};if(_0x5f0130[_0x234d('0x23')]>0x0){_[_0x234d('0x34')](_0x5f0130,function(_0x30a7ee){if(_[_0x234d('0x35')]([_0x234d('0x36'),'picklist'],_0x30a7ee[_0x234d('0x37')])&&_0x30a7ee[_0x234d('0x38')]&&!_0x30a7ee[_0x234d('0x39')]){_0x28a572[_0x30a7ee[_0x234d('0x38')][_0x234d('0x3a')]()]=_0x30a7ee[_0x234d('0x3b')][_0x234d('0x2f')]();}else if(_['includes']([_0x234d('0x36'),_0x234d('0x3c')],_0x30a7ee[_0x234d('0x37')])&&_0x30a7ee[_0x234d('0x3d')]&&_0x30a7ee['customField']){_0x28a572[_0x234d('0x17')][_0x234d('0x3e')]({'id':_0x30a7ee[_0x234d('0x3d')],'value':_0x30a7ee[_0x234d('0x3b')][_0x234d('0x2f')]()});}else if(_0x30a7ee[_0x234d('0x37')]===_0x234d('0x3f')&&_0x30a7ee['variableName']&&_0x30a7ee['idField']&&_0x30a7ee[_0x234d('0x39')]){_0x5c3ae5[_0x30a7ee[_0x234d('0x40')]]&&_0x28a572['custom_fields'][_0x234d('0x3e')]({'id':_0x30a7ee[_0x234d('0x3d')],'value':_0x5c3ae5[_0x30a7ee['variableName']]['toString']()});}else if(_0x30a7ee[_0x234d('0x37')]===_0x234d('0x41')&&_0x30a7ee[_0x234d('0x42')]&&_0x30a7ee['Variable'][_0x234d('0x15')]&&_0x30a7ee[_0x234d('0x3d')]&&_0x30a7ee[_0x234d('0x39')]){_0x5c3ae5[_0x30a7ee['Variable'][_0x234d('0x15')][_0x234d('0x3a')]()]&&_0x28a572['custom_fields'][_0x234d('0x3e')]({'id':_0x30a7ee[_0x234d('0x3d')],'value':_0x5c3ae5[_0x30a7ee[_0x234d('0x42')][_0x234d('0x15')]['toLowerCase']()][_0x234d('0x2f')]()});}});}return _0x28a572;}exports[_0x234d('0x43')]=function(_0x2af8dc,_0x4a6aa7,_0x420cdc,_0x2a0282,_0xa0100a,_0x1c784d){var _0x3e4319,_0x27ac97;_0x1c784d[_0x234d('0x22')]=intUtil['stripTrailingSlash'](_0x1c784d[_0x234d('0x22')]);_0x1c784d[_0x234d('0x44')]=intUtil['stripTrailingSlash'](_0x1c784d['serverUrl']);if(_0xa0100a&&_0xa0100a['monitor_format']){logger[_0x234d('0x1e')]('[QUEUE]',_0x234d('0x45'));_0x4a6aa7[_0x234d('0x46')]=util[_0x234d('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1c784d['serverUrl'],_0x4a6aa7[_0x234d('0x47')],md5(_0x4a6aa7[_0x234d('0x47')]));}else{_0x4a6aa7[_0x234d('0x46')]='';}headers[_0x234d('0x48')]=getAuth(_0x1c784d);return getUser(_0x1c784d,_0x2a0282[_0x234d('0x26')])[_0x234d('0x1d')](function(_0x58fee7){_0x3e4319=_0x58fee7;logger['info'](_0x234d('0x49'),_0x3e4319['id']);return getEndUser(_0x1c784d,_0x4a6aa7[_0x234d('0xf')],_0x4a6aa7[_0x234d('0x4a')]);})[_0x234d('0x1d')](function(_0x113580){_0x27ac97=_0x113580;logger[_0x234d('0x1e')](_0x234d('0x4b'),_0x27ac97['id']);return getTicket(_0x1c784d,_0x3e4319,_0x27ac97,_0x420cdc,_0x4a6aa7);})[_0x234d('0x1d')](function(_0x4fefd7){if(_0x4fefd7&&_0x4fefd7['id']){logger[_0x234d('0x1e')]('Ticket\x20created!');logger[_0x234d('0x1e')](_0x234d('0x4c'),_0x4fefd7['id']);logger[_0x234d('0x1e')](_0x234d('0x4d'),_0x234d('0x4e'));emit(util['format'](_0x234d('0x4f'),_0x2a0282['name']),_0x234d('0x50'),{'uri':util[_0x234d('0xd')](_0x234d('0x51'),_0x1c784d[_0x234d('0x22')],_0x4fefd7['id'])});}})[_0x234d('0x52')](function(_0x3d51c2){logger[_0x234d('0x53')](_0x234d('0x4d'),JSON[_0x234d('0x31')](_0x3d51c2));});};exports['outbound']=function(_0x21ec16,_0x5e0cae,_0x318195,_0x4734a9,_0x5be58c,_0x39031e,_0x1414e1){var _0x505936,_0x5d3b3c;_0x39031e[_0x234d('0x22')]=intUtil[_0x234d('0x54')](_0x39031e[_0x234d('0x22')]);_0x39031e[_0x234d('0x44')]=intUtil[_0x234d('0x54')](_0x39031e['serverUrl']);if(_0x1414e1&&_0x1414e1['recordingFormat']&&_0x1414e1[_0x234d('0x55')]!==_0x234d('0x56')){logger[_0x234d('0x1e')](_0x234d('0x57'),'Recording\x20is\x20enabled!');_0x5e0cae['recordingURL']=util[_0x234d('0xd')](_0x234d('0x58'),_0x39031e[_0x234d('0x44')],_0x5e0cae[_0x234d('0x47')],md5(_0x5e0cae[_0x234d('0x47')]));}headers[_0x234d('0x48')]=getAuth(_0x39031e);return getUser(_0x39031e,_0x4734a9[_0x234d('0x26')])['then'](function(_0x1955c1){_0x505936=_0x1955c1;logger[_0x234d('0x1e')](_0x234d('0x49'),_0x505936['id']);return getEndUser(_0x39031e,_0x5e0cae['destcalleridname'],_0x5e0cae[_0x234d('0x59')]);})[_0x234d('0x1d')](function(_0x596f9c){_0x5d3b3c=_0x596f9c;logger[_0x234d('0x1e')](_0x234d('0x4b'),_0x5d3b3c['id']);return getTicket(_0x39031e,_0x505936,_0x5d3b3c,_0x318195,_0x5e0cae);})[_0x234d('0x1d')](function(_0x51f6d2){if(_0x51f6d2&&_0x51f6d2['id']){logger[_0x234d('0x1e')]('Ticket\x20created!');logger[_0x234d('0x1e')](_0x234d('0x4c'),_0x51f6d2['id']);logger[_0x234d('0x1e')](_0x234d('0x57'),_0x234d('0x4e'));emit(util[_0x234d('0xd')](_0x234d('0x4f'),_0x4734a9[_0x234d('0x15')]),_0x234d('0x50'),{'uri':util[_0x234d('0xd')](_0x234d('0x51'),_0x39031e['remoteUri'],_0x51f6d2['id'])});}})[_0x234d('0x52')](function(_0x4995c8){logger['error'](_0x234d('0x57'),JSON[_0x234d('0x31')](_0x4995c8));});};exports['unmanaged']=function(_0x52aed5,_0x5e7353,_0x3501b3,_0xae67f,_0x416952,_0x8c89e8){var _0x5bed6b,_0x43fbde;_0x8c89e8['remoteUri']=intUtil[_0x234d('0x54')](_0x8c89e8[_0x234d('0x22')]);_0x8c89e8[_0x234d('0x44')]=intUtil[_0x234d('0x54')](_0x8c89e8['serverUrl']);if(_0x416952&&_0x416952['monitor_format']){logger[_0x234d('0x1e')]('['+_0x5e7353[_0x234d('0x5a')][_0x234d('0x5b')]()+']',_0x234d('0x45'));_0x5e7353['recordingURL']=util['format'](_0x234d('0x58'),_0x8c89e8[_0x234d('0x44')],_0x5e7353[_0x234d('0x47')],md5(_0x5e7353['uniqueid']));}else{_0x5e7353['recordingURL']='';}headers['Authorization']=getAuth(_0x8c89e8);return getUser(_0x8c89e8,'')[_0x234d('0x1d')](function(_0x49426c){_0x5bed6b=_0x49426c;logger[_0x234d('0x1e')](_0x234d('0x49'),_0x5bed6b['id']);return getEndUser(_0x8c89e8,_0x5e7353[_0x234d('0xf')],_0x5e7353[_0x234d('0x4a')]);})[_0x234d('0x1d')](function(_0x500f2c){_0x43fbde=_0x500f2c;logger[_0x234d('0x1e')]('The\x20Enduser\x20ID\x20is:',_0x43fbde['id']);return getTicket(_0x8c89e8,_0x5bed6b,_0x43fbde,_0x3501b3,_0x5e7353);})[_0x234d('0x1d')](function(_0x263128){if(_0x263128){logger[_0x234d('0x1e')](_0x234d('0x1f'));logger[_0x234d('0x1e')](_0x234d('0x4c'),_0x263128['id']);}})['catch'](function(_0x39cf08){logger['error']('['+_0x5e7353[_0x234d('0x5a')][_0x234d('0x5b')]()+']',JSON[_0x234d('0x31')](_0x39cf08));});}; \ 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 bf16028..7bfe955 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 _0xc3ec=['adminId','Contact','add','ticketId','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','remoteUri','serverUrl','stripTrailingSlash','username','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','util','moment','ioredis','./util','defaults','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','users','length','email','adminEmail','Requested\x20Resource\x20not\x20Found','catch','error','Getting\x20user\x20list','then','Getting\x20user\x20with\x20email','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','message','/api/lookup?q=','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','toUpperCase','Creating\x20new\x20task','/api/tasks','Subjects','getString','Descriptions'];(function(_0x37f4c4,_0x52f79d){var _0x4fa8ae=function(_0x118c43){while(--_0x118c43){_0x37f4c4['push'](_0x37f4c4['shift']());}};_0x4fa8ae(++_0x52f79d);}(_0xc3ec,0x75));var _0xcc3e=function(_0x37ebcb,_0x18a24e){_0x37ebcb=_0x37ebcb-0x0;var _0x4f0159=_0xc3ec[_0x37ebcb];return _0x4f0159;};'use strict';var _=require(_0xcc3e('0x0'));var rp=require('request-promise');var md5=require(_0xcc3e('0x1'));var util=require(_0xcc3e('0x2'));var moment=require(_0xcc3e('0x3'));var Promise=require('bluebird');var Redis=require(_0xcc3e('0x4'));var intUtil=require(_0xcc3e('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('freshsales');config['redis']=_[_0xcc3e('0x6')](config[_0xcc3e('0x7')],{'host':_0xcc3e('0x8'),'port':0x18eb});var io=require(_0xcc3e('0x9'))(new Redis(config['redis']));function getAdminId(_0x1c3c7f,_0x1188d3,_0x2ce8bc,_0x55769b){return new Promise(function(_0x4f1949,_0xa5ddf){var _0x2546e7=![];var _0x279e2e={'method':_0xcc3e('0xa'),'uri':_0x55769b+_0xcc3e('0xb'),'json':!![]};_0x279e2e[_0xcc3e('0xc')]=_0x2ce8bc;logger[_0xcc3e('0xd')](_0xcc3e('0xe'));return rp(_0x279e2e)['then'](function(_0xf71f9){if(_0xf71f9){var _0x191db3=_0xf71f9[_0xcc3e('0xf')];var _0x4dcc7b=null;for(_0x4dcc7b=0x0;_0x4dcc7b<_0x191db3[_0xcc3e('0x10')];_0x4dcc7b++){if(_0x191db3[_0x4dcc7b][_0xcc3e('0x11')]===_0x1c3c7f[_0xcc3e('0x12')]){_0x1c3c7f['adminId']=_0x191db3[_0x4dcc7b]['id'];_0x2546e7=!![];}}if(_0x2546e7){logger[_0xcc3e('0xd')]('Admin\x20found:',_0x1c3c7f['adminId']);_0x4f1949(_0x1c3c7f);}else{_0xa5ddf({'statusCode':0x194,'message':_0xcc3e('0x13')});}}else{_0xa5ddf({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xcc3e('0x14')](function(_0x26fe29){logger[_0xcc3e('0x15')]('['+[_0x1188d3['toUpperCase']()]+']',_0x26fe29['message']);_0xa5ddf(_0x26fe29);});});}function getUser(_0x16ef7d,_0x4f1101,_0x10a472){return function(_0x43d87f){return new Promise(function(_0x499c4e,_0x19eb00){var _0x52dd16={'method':_0xcc3e('0xa'),'uri':_0x10a472+_0xcc3e('0xb'),'json':!![]};_0x52dd16['headers']=_0x4f1101;logger[_0xcc3e('0xd')](_0xcc3e('0x16'));return rp(_0x52dd16)[_0xcc3e('0x17')](function(_0x33ee3e){if(_0x33ee3e){var _0x2ca28f=_0x33ee3e['users'];var _0x421638=![];var _0x364941=null;if(_0x43d87f['agentEmail']!==null){logger[_0xcc3e('0xd')](_0xcc3e('0x18'),_0x43d87f[_0xcc3e('0x19')]);_0x43d87f[_0xcc3e('0x1a')]=_0x43d87f['agentEmail'];for(_0x364941=0x0;_0x364941<_0x2ca28f['length'];_0x364941++){if(_0x2ca28f[_0x364941]['email']===_0x43d87f[_0xcc3e('0x19')]){_0x421638=!![];_0x43d87f[_0xcc3e('0x1b')]=_0x2ca28f[_0x364941]['id'];logger['info'](_0xcc3e('0x1c'),_0x43d87f['userId']);}}}if(!_0x421638){logger['info'](_0xcc3e('0x1d'));_0x43d87f[_0xcc3e('0x1a')]=_0x43d87f[_0xcc3e('0x12')];_0x43d87f[_0xcc3e('0x1b')]=_0x43d87f['adminId'];_0x421638=!![];}if(_0x421638){_0x499c4e(_0x43d87f);}else{_0x19eb00({'statusCode':0x194,'message':_0xcc3e('0x13')});}}else{_0x19eb00({'statusCode':0x194,'message':_0xcc3e('0x13')});}})[_0xcc3e('0x14')](function(_0x350f0e){logger['error']('['+[_0x16ef7d['toUpperCase']()]+']',_0x350f0e[_0xcc3e('0x1e')]);_0x19eb00(_0x350f0e);});});};}function searchContact(_0x2a3f6f,_0x209cdf,_0x434c6f,_0x31c955){return new Promise(function(_0x108a74,_0x4d09c5){var _0x2be451={'method':'GET','headers':_0x209cdf,'uri':_0x2a3f6f+_0xcc3e('0x1f')+_0x31c955+_0xcc3e('0x20')+_0x434c6f+_0xcc3e('0x21'),'json':!![]};rp(_0x2be451)[_0xcc3e('0x17')](function(_0x2b3f06){var _0x26226b=_[_0xcc3e('0x22')](_0x2b3f06[_0xcc3e('0x23')][_0xcc3e('0x23')],[_0x434c6f,_0x31c955]);_0x108a74(_0x26226b);})[_0xcc3e('0x14')](function(_0x24b484){_0x4d09c5(_0x24b484);});});}function getEndUser(_0x11cbe4,_0xeabd9c,_0xd2a1a7){return function(_0x119b5d){return new Promise(function(_0x3a33be,_0x35e42e){logger[_0xcc3e('0xd')](util['format'](_0xcc3e('0x24'),_0x119b5d[_0xcc3e('0x25')]));searchContact(_0xd2a1a7,_0xeabd9c,'mobile_number',_0x119b5d[_0xcc3e('0x25')])[_0xcc3e('0x17')](function(_0x3c449c){if(_0x3c449c){_0x119b5d[_0xcc3e('0x26')]=_0x3c449c['id'];logger[_0xcc3e('0xd')](_0xcc3e('0x27'),_0x119b5d[_0xcc3e('0x26')]);return _0x3a33be(_0x119b5d);}searchContact(_0xd2a1a7,_0xeabd9c,_0xcc3e('0x28'),_0x119b5d[_0xcc3e('0x25')])[_0xcc3e('0x17')](function(_0x30b250){if(_0x30b250){_0x119b5d[_0xcc3e('0x26')]=_0x30b250['id'];logger[_0xcc3e('0xd')](_0xcc3e('0x29'),_0x119b5d[_0xcc3e('0x26')]);return _0x3a33be(_0x119b5d);}createEndUser(_0x119b5d,_0x11cbe4,_0xeabd9c,_0xd2a1a7)['then'](function(_0x2b8c94){logger[_0xcc3e('0xd')](_0xcc3e('0x2a'),_0x2b8c94[_0xcc3e('0x26')]);return _0x3a33be(_0x2b8c94);});});})[_0xcc3e('0x14')](function(_0x5d419e){_0x35e42e(_0x5d419e);});});};}function createEndUser(_0x3e4a1a,_0x2f3a70,_0x7f0ed6,_0x477f53){return new Promise(function(_0x425a4d,_0x302cbe){var _0x32c9d2=moment();var _0x5d6dae={'method':_0xcc3e('0x2b'),'uri':_0x477f53+_0xcc3e('0x2c'),'body':{'contact':{'last_name':_0x3e4a1a[_0xcc3e('0x25')],'work_number':_0x3e4a1a[_0xcc3e('0x25')],'mobile_number':_0x3e4a1a[_0xcc3e('0x25')],'owner_id':_0x3e4a1a[_0xcc3e('0x1b')],'created_at':_0x32c9d2[_0xcc3e('0x2d')](_0xcc3e('0x2e'))}},'json':!![]};_0x5d6dae['headers']=_0x7f0ed6;logger['info'](_0xcc3e('0x2f'));return rp(_0x5d6dae)[_0xcc3e('0x17')](function(_0x260108){_0x3e4a1a[_0xcc3e('0x26')]=_0x260108[_0xcc3e('0x30')]['id'];_0x425a4d(_0x3e4a1a);})[_0xcc3e('0x14')](function(_0x3ad11e){logger[_0xcc3e('0x15')]('['+[_0x2f3a70[_0xcc3e('0x31')]()]+']',_0x3ad11e[_0xcc3e('0x1e')]);_0x302cbe(_0x3ad11e['message']);});});}function getTicket(_0x5de966,_0x59e694,_0x1101f1,_0x28fd10,_0x5b6e6f){return function(_0x2087ec){logger[_0xcc3e('0xd')](_0xcc3e('0x32'));return new Promise(function(_0xe328a,_0x27030a){var _0x36338e=moment();var _0x3fec6a={'method':'POST','uri':_0x1101f1+_0xcc3e('0x33'),'body':{'title':intUtil['getString'](_0x28fd10[_0xcc3e('0x34')],_0x5b6e6f,'\x20'),'description':intUtil[_0xcc3e('0x35')](_0x28fd10[_0xcc3e('0x36')],_0x5b6e6f,'\x0a'),'owner_id':_0x2087ec[_0xcc3e('0x1b')],'creater_id':_0x2087ec[_0xcc3e('0x37')],'targetable_id':_0x2087ec[_0xcc3e('0x26')],'targetable_type':_0xcc3e('0x38'),'created_at':_0x36338e['format'](_0xcc3e('0x2e')),'due_date':_0x36338e[_0xcc3e('0x39')](0x1e,'m')[_0xcc3e('0x2d')](_0xcc3e('0x2e'))},'json':!![]};_0x3fec6a['headers']=_0x59e694;return rp(_0x3fec6a)['then'](function(_0x2222ee){_0x2087ec[_0xcc3e('0x3a')]=_0x2222ee['task']['id'];logger[_0xcc3e('0xd')](_0xcc3e('0x3b'),_0x2087ec[_0xcc3e('0x3a')]);_0xe328a(_0x2087ec);})[_0xcc3e('0x14')](function(_0x324489){logger[_0xcc3e('0x15')]('['+[_0x5de966[_0xcc3e('0x31')]()]+']',_0x324489[_0xcc3e('0x1e')]);_0x27030a(_0x324489[_0xcc3e('0x1e')]);});});};}function emit(_0x1c8ea8,_0x596f52,_0x4701df){var _0x34f67e={'uri':_0x1c8ea8+_0xcc3e('0x3c')+_0x4701df};io['to'](util[_0xcc3e('0x2d')](_0xcc3e('0x3d'),_0x596f52))[_0xcc3e('0x3e')](_0xcc3e('0x3f'),_0x34f67e);}exports['cs']=function(_0x38a347,_0x1c0005,_0x338981,_0x5ed737,_0x11b8d5,_0x523a77,_0xea5d2e,_0x2bf208){var _0x54b5f4={};var _0x20a513={'Authorization':_0xcc3e('0x40')+_0x523a77['apiKey']};_0x523a77['remoteUri']=intUtil['stripTrailingSlash'](_0x523a77[_0xcc3e('0x41')]);_0x523a77[_0xcc3e('0x42')]=intUtil[_0xcc3e('0x43')](_0x523a77[_0xcc3e('0x42')]);var _0x48722f=_0x523a77[_0xcc3e('0x41')];_0x54b5f4[_0xcc3e('0x12')]=_0x523a77[_0xcc3e('0x44')];_0x54b5f4[_0xcc3e('0x25')]=_0x2bf208['toLowerCase']()===_0xcc3e('0x45')?_0x1c0005[_0xcc3e('0x46')]:_0x1c0005[_0xcc3e('0x47')];_0x54b5f4[_0xcc3e('0x48')]=_0x2bf208===_0xcc3e('0x49')||_0x2bf208===_0xcc3e('0x4a')?_0xcc3e('0x49'):'outbound';if(_0x5ed737){_0x54b5f4[_0xcc3e('0x19')]=_0x5ed737[_0xcc3e('0x11')];}var _0x3b1da2=util[_0xcc3e('0x2d')](_0xcc3e('0x4b'),_0x523a77['serverUrl'],_0x1c0005[_0xcc3e('0x4c')],md5(_0x1c0005[_0xcc3e('0x4c')]));if(_0x11b8d5&&_0x11b8d5[_0xcc3e('0x4d')]){logger[_0xcc3e('0xd')]('[QUEUE]',_0xcc3e('0x4e'));_0x1c0005[_0xcc3e('0x4f')]=_0x3b1da2;}else if(_0xea5d2e&&_0xea5d2e[_0xcc3e('0x50')]&&_0xea5d2e[_0xcc3e('0x50')]!=='none'){logger[_0xcc3e('0xd')](_0xcc3e('0x51'),_0xcc3e('0x4e'));_0x1c0005[_0xcc3e('0x4f')]=_0x3b1da2;}else{_0x1c0005[_0xcc3e('0x4f')]='';}return getAdminId(_0x54b5f4,_0x2bf208,_0x20a513,_0x48722f)[_0xcc3e('0x17')](getUser(_0x2bf208,_0x20a513,_0x48722f))[_0xcc3e('0x17')](getEndUser(_0x2bf208,_0x20a513,_0x48722f))['then'](getTicket(_0x2bf208,_0x20a513,_0x48722f,_0x338981,_0x1c0005))[_0xcc3e('0x17')](function(_0x1d6958){logger[_0xcc3e('0xd')](util[_0xcc3e('0x2d')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1d6958[_0xcc3e('0x3a')]));if(_0x2bf208!=='unmanaged'){logger[_0xcc3e('0xd')]('['+[_0x2bf208[_0xcc3e('0x31')]()]+']',_0xcc3e('0x52'));emit(_0x48722f,_0x5ed737[_0xcc3e('0x53')],_0x1d6958['endUserId']);}})[_0xcc3e('0x14')](function(_0x10a122){logger[_0xcc3e('0x15')]('['+[_0x2bf208[_0xcc3e('0x31')]()]+_0xcc3e('0x54'),util[_0xcc3e('0x55')](_0x10a122,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9ca3=['contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','add','Task\x20created:','ticketId','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','util','moment','bluebird','ioredis','./util','../../../../config/environment','freshsales','defaults','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userId','User\x20found:','Admin\x20selected','message','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s'];(function(_0x4299c1,_0x2d1416){var _0x1b6dbd=function(_0x3cde6f){while(--_0x3cde6f){_0x4299c1['push'](_0x4299c1['shift']());}};_0x1b6dbd(++_0x2d1416);}(_0x9ca3,0x7d));var _0x39ca=function(_0x180dfa,_0x3a21db){_0x180dfa=_0x180dfa-0x0;var _0x530cf7=_0x9ca3[_0x180dfa];return _0x530cf7;};'use strict';var _=require(_0x39ca('0x0'));var rp=require(_0x39ca('0x1'));var md5=require('md5');var util=require(_0x39ca('0x2'));var moment=require(_0x39ca('0x3'));var Promise=require(_0x39ca('0x4'));var Redis=require(_0x39ca('0x5'));var intUtil=require(_0x39ca('0x6'));var config=require(_0x39ca('0x7'));var logger=require('../../../../config/logger')(_0x39ca('0x8'));config['redis']=_[_0x39ca('0x9')](config[_0x39ca('0xa')],{'host':_0x39ca('0xb'),'port':0x18eb});var io=require(_0x39ca('0xc'))(new Redis(config[_0x39ca('0xa')]));function getAdminId(_0x5b8a85,_0x31c41f,_0x281e12,_0x34aaf1){return new Promise(function(_0x328d83,_0x449fb9){var _0xa23451=![];var _0x568c87={'method':_0x39ca('0xd'),'uri':_0x34aaf1+_0x39ca('0xe'),'json':!![]};_0x568c87[_0x39ca('0xf')]=_0x281e12;logger[_0x39ca('0x10')](_0x39ca('0x11'));return rp(_0x568c87)[_0x39ca('0x12')](function(_0x3dac2b){if(_0x3dac2b){var _0x505223=_0x3dac2b[_0x39ca('0x13')];var _0x3451d2=null;for(_0x3451d2=0x0;_0x3451d2<_0x505223[_0x39ca('0x14')];_0x3451d2++){if(_0x505223[_0x3451d2][_0x39ca('0x15')]===_0x5b8a85[_0x39ca('0x16')]){_0x5b8a85[_0x39ca('0x17')]=_0x505223[_0x3451d2]['id'];_0xa23451=!![];}}if(_0xa23451){logger['info'](_0x39ca('0x18'),_0x5b8a85[_0x39ca('0x17')]);_0x328d83(_0x5b8a85);}else{_0x449fb9({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x449fb9({'statusCode':0x194,'message':_0x39ca('0x19')});}})[_0x39ca('0x1a')](function(_0xbdb5f6){logger[_0x39ca('0x1b')]('['+[_0x31c41f[_0x39ca('0x1c')]()]+']',_0xbdb5f6['message']);_0x449fb9(_0xbdb5f6);});});}function getUser(_0x1dcd75,_0x221010,_0x3a349f){return function(_0x3fa86a){return new Promise(function(_0x59387a,_0x144e19){var _0x2ede5a={'method':_0x39ca('0xd'),'uri':_0x3a349f+_0x39ca('0xe'),'json':!![]};_0x2ede5a[_0x39ca('0xf')]=_0x221010;logger[_0x39ca('0x10')](_0x39ca('0x1d'));return rp(_0x2ede5a)[_0x39ca('0x12')](function(_0x838449){if(_0x838449){var _0x5d5faf=_0x838449[_0x39ca('0x13')];var _0x48cd58=![];var _0x4bc88b=null;if(_0x3fa86a[_0x39ca('0x1e')]!==null){logger[_0x39ca('0x10')](_0x39ca('0x1f'),_0x3fa86a[_0x39ca('0x1e')]);_0x3fa86a['userEmail']=_0x3fa86a['agentEmail'];for(_0x4bc88b=0x0;_0x4bc88b<_0x5d5faf['length'];_0x4bc88b++){if(_0x5d5faf[_0x4bc88b][_0x39ca('0x15')]===_0x3fa86a['agentEmail']){_0x48cd58=!![];_0x3fa86a[_0x39ca('0x20')]=_0x5d5faf[_0x4bc88b]['id'];logger[_0x39ca('0x10')](_0x39ca('0x21'),_0x3fa86a[_0x39ca('0x20')]);}}}if(!_0x48cd58){logger[_0x39ca('0x10')](_0x39ca('0x22'));_0x3fa86a['userEmail']=_0x3fa86a[_0x39ca('0x16')];_0x3fa86a[_0x39ca('0x20')]=_0x3fa86a[_0x39ca('0x17')];_0x48cd58=!![];}if(_0x48cd58){_0x59387a(_0x3fa86a);}else{_0x144e19({'statusCode':0x194,'message':_0x39ca('0x19')});}}else{_0x144e19({'statusCode':0x194,'message':_0x39ca('0x19')});}})['catch'](function(_0x1fb007){logger[_0x39ca('0x1b')]('['+[_0x1dcd75[_0x39ca('0x1c')]()]+']',_0x1fb007[_0x39ca('0x23')]);_0x144e19(_0x1fb007);});});};}function searchContact(_0x5a44d6,_0x31653e,_0x567e35,_0x5183a7){return new Promise(function(_0x114ccc,_0x24c2bb){var _0xd50cac={'method':_0x39ca('0xd'),'headers':_0x31653e,'uri':_0x5a44d6+'/api/lookup?q='+_0x5183a7+_0x39ca('0x24')+_0x567e35+_0x39ca('0x25'),'json':!![]};rp(_0xd50cac)['then'](function(_0x13b59f){var _0x255043=_['find'](_0x13b59f[_0x39ca('0x26')]['contacts'],[_0x567e35,_0x5183a7]);_0x114ccc(_0x255043);})['catch'](function(_0x56edf2){_0x24c2bb(_0x56edf2);});});}function getEndUser(_0x4e1980,_0x384650,_0x53c77e){return function(_0xd1f579){return new Promise(function(_0x380ab6,_0x53589f){logger[_0x39ca('0x10')](util[_0x39ca('0x27')](_0x39ca('0x28'),_0xd1f579[_0x39ca('0x29')]));searchContact(_0x53c77e,_0x384650,_0x39ca('0x2a'),_0xd1f579[_0x39ca('0x29')])[_0x39ca('0x12')](function(_0x4ef2bf){if(_0x4ef2bf){_0xd1f579[_0x39ca('0x2b')]=_0x4ef2bf['id'];logger['info'](_0x39ca('0x2c'),_0xd1f579[_0x39ca('0x2b')]);return _0x380ab6(_0xd1f579);}searchContact(_0x53c77e,_0x384650,'work_number',_0xd1f579[_0x39ca('0x29')])[_0x39ca('0x12')](function(_0x5ddb95){if(_0x5ddb95){_0xd1f579[_0x39ca('0x2b')]=_0x5ddb95['id'];logger[_0x39ca('0x10')](_0x39ca('0x2d'),_0xd1f579[_0x39ca('0x2b')]);return _0x380ab6(_0xd1f579);}createEndUser(_0xd1f579,_0x4e1980,_0x384650,_0x53c77e)[_0x39ca('0x12')](function(_0x1bc49e){logger['info'](_0x39ca('0x2e'),_0x1bc49e[_0x39ca('0x2b')]);return _0x380ab6(_0x1bc49e);});});})['catch'](function(_0x5dc5b6){_0x53589f(_0x5dc5b6);});});};}function createEndUser(_0x4f652c,_0x4c9755,_0xb5c4bf,_0x474dcc){return new Promise(function(_0x2fe28c,_0x3390b8){var _0x2af364=moment();var _0x32bb44={'method':_0x39ca('0x2f'),'uri':_0x474dcc+_0x39ca('0x30'),'body':{'contact':{'last_name':_0x4f652c[_0x39ca('0x29')],'work_number':_0x4f652c['contactNumber'],'mobile_number':_0x4f652c[_0x39ca('0x29')],'owner_id':_0x4f652c['userId'],'created_at':_0x2af364[_0x39ca('0x27')](_0x39ca('0x31'))}},'json':!![]};_0x32bb44['headers']=_0xb5c4bf;logger[_0x39ca('0x10')](_0x39ca('0x32'));return rp(_0x32bb44)[_0x39ca('0x12')](function(_0x3ea899){_0x4f652c['endUserId']=_0x3ea899[_0x39ca('0x33')]['id'];_0x2fe28c(_0x4f652c);})['catch'](function(_0x51dc29){logger['error']('['+[_0x4c9755[_0x39ca('0x1c')]()]+']',_0x51dc29['message']);_0x3390b8(_0x51dc29[_0x39ca('0x23')]);});});}function getTicket(_0x275fe4,_0x29473a,_0x4e2654,_0x117285,_0x1c6ad3){return function(_0x5bcf77){logger[_0x39ca('0x10')](_0x39ca('0x34'));return new Promise(function(_0x313294,_0x260e29){var _0x34be18=moment();var _0xb434a4={'method':_0x39ca('0x2f'),'uri':_0x4e2654+_0x39ca('0x35'),'body':{'title':intUtil[_0x39ca('0x36')](_0x117285['Subjects'],_0x1c6ad3,'\x20'),'description':intUtil[_0x39ca('0x36')](_0x117285[_0x39ca('0x37')],_0x1c6ad3,'\x0a'),'owner_id':_0x5bcf77[_0x39ca('0x20')],'creater_id':_0x5bcf77['adminId'],'targetable_id':_0x5bcf77[_0x39ca('0x2b')],'targetable_type':'Contact','created_at':_0x34be18[_0x39ca('0x27')](_0x39ca('0x31')),'due_date':_0x34be18[_0x39ca('0x38')](0x1e,'m')[_0x39ca('0x27')](_0x39ca('0x31'))},'json':!![]};_0xb434a4[_0x39ca('0xf')]=_0x29473a;return rp(_0xb434a4)['then'](function(_0x58e565){_0x5bcf77['ticketId']=_0x58e565['task']['id'];logger[_0x39ca('0x10')](_0x39ca('0x39'),_0x5bcf77[_0x39ca('0x3a')]);_0x313294(_0x5bcf77);})['catch'](function(_0x480e7f){logger[_0x39ca('0x1b')]('['+[_0x275fe4['toUpperCase']()]+']',_0x480e7f[_0x39ca('0x23')]);_0x260e29(_0x480e7f['message']);});});};}function emit(_0x59125a,_0x1b359e,_0x52c429){var _0x259dc3={'uri':_0x59125a+'/contacts/'+_0x52c429};io['to'](util[_0x39ca('0x27')]('user:%s',_0x1b359e))[_0x39ca('0x3b')](_0x39ca('0x3c'),_0x259dc3);}exports['cs']=function(_0x5c9bcc,_0x372ee4,_0x250a93,_0x4c2f5d,_0x1b7ad9,_0x139db2,_0x94d8c6,_0x58b51b){var _0x59d069={};var _0xe3a0={'Authorization':_0x39ca('0x3d')+_0x139db2['apiKey']};_0x139db2[_0x39ca('0x3e')]=intUtil[_0x39ca('0x3f')](_0x139db2[_0x39ca('0x3e')]);_0x139db2[_0x39ca('0x40')]=intUtil[_0x39ca('0x3f')](_0x139db2['serverUrl']);var _0x6746b2=_0x139db2[_0x39ca('0x3e')];_0x59d069[_0x39ca('0x16')]=_0x139db2['username'];_0x59d069[_0x39ca('0x29')]=_0x58b51b[_0x39ca('0x41')]()===_0x39ca('0x42')?_0x372ee4[_0x39ca('0x43')]:_0x372ee4[_0x39ca('0x44')];_0x59d069['callDirection']=_0x58b51b===_0x39ca('0x45')||_0x58b51b===_0x39ca('0x46')?_0x39ca('0x45'):_0x39ca('0x42');if(_0x4c2f5d){_0x59d069[_0x39ca('0x1e')]=_0x4c2f5d['email'];}var _0x4b90c4=util[_0x39ca('0x27')](_0x39ca('0x47'),_0x139db2[_0x39ca('0x40')],_0x372ee4[_0x39ca('0x48')],md5(_0x372ee4['uniqueid']));if(_0x1b7ad9&&_0x1b7ad9['monitor_format']){logger['info'](_0x39ca('0x49'),_0x39ca('0x4a'));_0x372ee4[_0x39ca('0x4b')]=_0x4b90c4;}else if(_0x94d8c6&&_0x94d8c6[_0x39ca('0x4c')]&&_0x94d8c6[_0x39ca('0x4c')]!==_0x39ca('0x4d')){logger[_0x39ca('0x10')](_0x39ca('0x4e'),_0x39ca('0x4a'));_0x372ee4[_0x39ca('0x4b')]=_0x4b90c4;}else{_0x372ee4[_0x39ca('0x4b')]='';}return getAdminId(_0x59d069,_0x58b51b,_0xe3a0,_0x6746b2)[_0x39ca('0x12')](getUser(_0x58b51b,_0xe3a0,_0x6746b2))[_0x39ca('0x12')](getEndUser(_0x58b51b,_0xe3a0,_0x6746b2))[_0x39ca('0x12')](getTicket(_0x58b51b,_0xe3a0,_0x6746b2,_0x250a93,_0x372ee4))[_0x39ca('0x12')](function(_0x3156a6){logger[_0x39ca('0x10')](util[_0x39ca('0x27')](_0x39ca('0x4f'),_0x3156a6[_0x39ca('0x3a')]));if(_0x58b51b!==_0x39ca('0x46')){logger[_0x39ca('0x10')]('['+[_0x58b51b[_0x39ca('0x1c')]()]+']',_0x39ca('0x50'));emit(_0x6746b2,_0x4c2f5d[_0x39ca('0x51')],_0x3156a6['endUserId']);}})[_0x39ca('0x1a')](function(_0x69663a){logger[_0x39ca('0x1b')]('['+[_0x58b51b[_0x39ca('0x1c')]()]+_0x39ca('0x52'),util['inspect'](_0x69663a,{'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 8b17ac0..5b2a757 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 _0xaa85=['%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./servicenow','./dynamics365','zendesk','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','servicenow','includes','data1','toLowerCase','find','Configurations','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','salesforce','freshsales','log','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xaa85,0x113));var _0x5aa8=function(_0x39e12e,_0x55bd8f){_0x39e12e=_0x39e12e-0x0;var _0x13bcd5=_0xaa85[_0x39e12e];return _0x13bcd5;};'use strict';var _=require(_0x5aa8('0x0'));var util=require(_0x5aa8('0x1'));var zendesk=require(_0x5aa8('0x2'));var salesforce=require(_0x5aa8('0x3'));var sugarcrm=require(_0x5aa8('0x4'));var freshdesk=require(_0x5aa8('0x5'));var zoho=require(_0x5aa8('0x6'));var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require(_0x5aa8('0x7'));var dynamics365=require(_0x5aa8('0x8'));var freshsales=require('./freshsales');var integrations=[_0x5aa8('0x9'),'salesforce',_0x5aa8('0xa'),_0x5aa8('0xb'),_0x5aa8('0xc'),_0x5aa8('0xd'),_0x5aa8('0xe'),_0x5aa8('0xf'),'freshsales',_0x5aa8('0x10')];exports['exec']=function(_0x5ef54d,_0x167dcd,_0x284412,_0x2780c,_0x16cb90,_0x44264f){if(_0x284412){if(_[_0x5aa8('0x11')](integrations,_0x5ef54d[_0x5aa8('0x12')][_0x5aa8('0x13')]())){try{var _0x293149=null;var _0x7f3f83='';var _0x13950a=_0x284412[_0x5ef54d[_0x5aa8('0x12')]['toLowerCase']()];if(_0x13950a){var _0x24f759=_0x13950a[_0x5ef54d['data2']];if(_0x24f759){var _0x2de766=_[_0x5aa8('0x14')](_0x24f759[_0x5aa8('0x15')],{'id':parseInt(_0x5ef54d['data3'],0xa)});if(_0x2de766){if(_0x2780c){if(_0x16cb90&&_0x167dcd['queue']){_0x7f3f83=_0x5aa8('0x16');}else if(_0x167dcd[_0x5aa8('0x17')]){_0x7f3f83=_0x5aa8('0x18');}else{console['log'](_0x5aa8('0x19'),_0x167dcd);}}else{_0x7f3f83=_0x5aa8('0x1a');}switch(_0x5ef54d[_0x5aa8('0x12')][_0x5aa8('0x13')]()){case _0x5aa8('0x9'):zendesk[_0x7f3f83](_0x5ef54d,_0x167dcd,_0x2de766,_0x2780c,_0x16cb90,_0x24f759,_0x44264f);break;case _0x5aa8('0x1b'):salesforce[_0x7f3f83](_0x5ef54d,_0x167dcd,_0x2de766,_0x2780c,_0x16cb90,_0x24f759,_0x44264f);break;case _0x5aa8('0xa'):sugarcrm[_0x7f3f83](_0x5ef54d,_0x167dcd,_0x2de766,_0x2780c,_0x16cb90,_0x24f759,_0x44264f);break;case _0x5aa8('0xb'):freshdesk[_0x7f3f83](_0x5ef54d,_0x167dcd,_0x2de766,_0x2780c,_0x16cb90,_0x24f759,_0x44264f);break;case _0x5aa8('0xc'):zoho[_0x7f3f83](_0x5ef54d,_0x167dcd,_0x2de766,_0x2780c,_0x16cb90,_0x24f759,_0x44264f);break;case _0x5aa8('0xd'):desk[_0x7f3f83](_0x5ef54d,_0x167dcd,_0x2de766,_0x2780c,_0x16cb90,_0x24f759,_0x44264f);break;case _0x5aa8('0xe'):vtiger[_0x7f3f83](_0x5ef54d,_0x167dcd,_0x2de766,_0x2780c,_0x16cb90,_0x24f759,_0x44264f);break;case _0x5aa8('0x1c'):freshsales['cs'](_0x5ef54d,_0x167dcd,_0x2de766,_0x2780c,_0x16cb90,_0x24f759,_0x44264f,_0x7f3f83);break;case _0x5aa8('0x10'):servicenow['cs'](_0x5ef54d,_0x167dcd,_0x2de766,_0x2780c,_0x16cb90,_0x24f759,_0x44264f,_0x7f3f83);break;case _0x5aa8('0xf'):dynamics365['cs'](_0x5ef54d,_0x167dcd,_0x2de766,_0x2780c,_0x16cb90,_0x24f759,_0x44264f,_0x7f3f83);break;default:console[_0x5aa8('0x1d')](_0x5aa8('0x1e'));}}else{_0x293149=require(_0x5aa8('0x1f'))(_0x5ef54d[_0x5aa8('0x12')]['toLowerCase']());_0x293149[_0x5aa8('0x20')](_0x5aa8('0x21'),util[_0x5aa8('0x22')](_0x5aa8('0x23'),_0x5ef54d[_0x5aa8('0x12')][_0x5aa8('0x13')](),_0x5ef54d[_0x5aa8('0x24')]));}}else{_0x293149=require('../../../../config/logger')(_0x5ef54d[_0x5aa8('0x12')][_0x5aa8('0x13')]());_0x293149[_0x5aa8('0x20')](_0x5aa8('0x21'),util[_0x5aa8('0x22')](_0x5aa8('0x25'),_0x5ef54d[_0x5aa8('0x12')][_0x5aa8('0x13')](),_0x5ef54d[_0x5aa8('0x26')]));}}else{}}catch(_0x1b7743){console['error'](_0x1b7743);}}}}; \ No newline at end of file +var _0xa437=['freshsales','servicenow','exec','data1','toLowerCase','data2','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','freshdesk','vtiger','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./sugarcrm','./freshdesk','./desk','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','zoho','dynamics365'];(function(_0x1ab7db,_0x5ae040){var _0x1c5b48=function(_0x3b9bf3){while(--_0x3b9bf3){_0x1ab7db['push'](_0x1ab7db['shift']());}};_0x1c5b48(++_0x5ae040);}(_0xa437,0x1d0));var _0x7a43=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa437[_0x4c7fb5];return _0x2e10ac;};'use strict';var _=require(_0x7a43('0x0'));var util=require('util');var zendesk=require(_0x7a43('0x1'));var salesforce=require('./salesforce');var sugarcrm=require(_0x7a43('0x2'));var freshdesk=require(_0x7a43('0x3'));var zoho=require('./zoho');var desk=require(_0x7a43('0x4'));var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require(_0x7a43('0x5'));var freshsales=require(_0x7a43('0x6'));var integrations=[_0x7a43('0x7'),_0x7a43('0x8'),_0x7a43('0x9'),'freshdesk',_0x7a43('0xa'),'desk','vtiger',_0x7a43('0xb'),_0x7a43('0xc'),_0x7a43('0xd')];exports[_0x7a43('0xe')]=function(_0x4a61c4,_0x242ab2,_0x11829b,_0x59b68c,_0x3d0a04,_0x2ca8f9){if(_0x11829b){if(_['includes'](integrations,_0x4a61c4[_0x7a43('0xf')][_0x7a43('0x10')]())){try{var _0x111130=null;var _0x517759='';var _0x2d9cf7=_0x11829b[_0x4a61c4[_0x7a43('0xf')][_0x7a43('0x10')]()];if(_0x2d9cf7){var _0x52c96b=_0x2d9cf7[_0x4a61c4[_0x7a43('0x11')]];if(_0x52c96b){var _0xf443d5=_['find'](_0x52c96b[_0x7a43('0x12')],{'id':parseInt(_0x4a61c4[_0x7a43('0x13')],0xa)});if(_0xf443d5){if(_0x59b68c){if(_0x3d0a04&&_0x242ab2[_0x7a43('0x14')]){_0x517759=_0x7a43('0x14');}else if(_0x242ab2[_0x7a43('0x15')]){_0x517759=_0x7a43('0x16');}else{console[_0x7a43('0x17')](_0x7a43('0x18'),_0x242ab2);}}else{_0x517759=_0x7a43('0x19');}switch(_0x4a61c4['data1']['toLowerCase']()){case _0x7a43('0x7'):zendesk[_0x517759](_0x4a61c4,_0x242ab2,_0xf443d5,_0x59b68c,_0x3d0a04,_0x52c96b,_0x2ca8f9);break;case _0x7a43('0x8'):salesforce[_0x517759](_0x4a61c4,_0x242ab2,_0xf443d5,_0x59b68c,_0x3d0a04,_0x52c96b,_0x2ca8f9);break;case _0x7a43('0x9'):sugarcrm[_0x517759](_0x4a61c4,_0x242ab2,_0xf443d5,_0x59b68c,_0x3d0a04,_0x52c96b,_0x2ca8f9);break;case _0x7a43('0x1a'):freshdesk[_0x517759](_0x4a61c4,_0x242ab2,_0xf443d5,_0x59b68c,_0x3d0a04,_0x52c96b,_0x2ca8f9);break;case _0x7a43('0xa'):zoho[_0x517759](_0x4a61c4,_0x242ab2,_0xf443d5,_0x59b68c,_0x3d0a04,_0x52c96b,_0x2ca8f9);break;case'desk':desk[_0x517759](_0x4a61c4,_0x242ab2,_0xf443d5,_0x59b68c,_0x3d0a04,_0x52c96b,_0x2ca8f9);break;case _0x7a43('0x1b'):vtiger[_0x517759](_0x4a61c4,_0x242ab2,_0xf443d5,_0x59b68c,_0x3d0a04,_0x52c96b,_0x2ca8f9);break;case _0x7a43('0xc'):freshsales['cs'](_0x4a61c4,_0x242ab2,_0xf443d5,_0x59b68c,_0x3d0a04,_0x52c96b,_0x2ca8f9,_0x517759);break;case _0x7a43('0xd'):servicenow['cs'](_0x4a61c4,_0x242ab2,_0xf443d5,_0x59b68c,_0x3d0a04,_0x52c96b,_0x2ca8f9,_0x517759);break;case _0x7a43('0xb'):dynamics365['cs'](_0x4a61c4,_0x242ab2,_0xf443d5,_0x59b68c,_0x3d0a04,_0x52c96b,_0x2ca8f9,_0x517759);break;default:console[_0x7a43('0x17')](_0x7a43('0x1c'));}}else{_0x111130=require(_0x7a43('0x1d'))(_0x4a61c4['data1']['toLowerCase']());_0x111130[_0x7a43('0x1e')](_0x7a43('0x1f'),util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x4a61c4[_0x7a43('0xf')][_0x7a43('0x10')](),_0x4a61c4['data3']));}}else{_0x111130=require(_0x7a43('0x1d'))(_0x4a61c4['data1'][_0x7a43('0x10')]());_0x111130[_0x7a43('0x1e')]('[EXEC]',util[_0x7a43('0x20')](_0x7a43('0x21'),_0x4a61c4[_0x7a43('0xf')][_0x7a43('0x10')](),_0x4a61c4[_0x7a43('0x11')]));}}else{}}catch(_0xd79231){console[_0x7a43('0x1e')](_0xd79231);}}}}; \ 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 441cfd5..6ee30a5 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 _0x1ea2=['LastName','format','Caller\x20-\x20%s','No\x20Company','Name','','upperFirst','forEach','string','picklist','idField','content','variable','variableName','toString','customVariable','Variable','name','password','remoteUri','clientId','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','newTab','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','trigger:salesforce:display','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','IsRecurrence','endUserType','contact','lead','WhoId','WhatId','Case','ContactId','account','AccountId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','then','length','Email','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','$or','Contact','cloneDeep','additionalSearchLead','merge','Lead','additionalSearchAccount','Account','additionalSearchContact','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.'];(function(_0x45ebd9,_0x3aca7a){var _0x4fe9ee=function(_0x479e89){while(--_0x479e89){_0x45ebd9['push'](_0x45ebd9['shift']());}};_0x4fe9ee(++_0x3aca7a);}(_0x1ea2,0x1af));var _0x21ea=function(_0x16771d,_0x224c60){_0x16771d=_0x16771d-0x0;var _0x386f11=_0x1ea2[_0x16771d];return _0x386f11;};'use strict';var _=require(_0x21ea('0x0'));var rp=require(_0x21ea('0x1'));var moment=require('moment');var BPromise=require(_0x21ea('0x2'));var md5=require(_0x21ea('0x3'));var jsforce=require(_0x21ea('0x4'));var util=require(_0x21ea('0x5'));var Redis=require(_0x21ea('0x6'));var intUtil=require(_0x21ea('0x7'));var config=require(_0x21ea('0x8'));var logger=require(_0x21ea('0x9'))('salesforce');config[_0x21ea('0xa')]=_[_0x21ea('0xb')](config[_0x21ea('0xa')],{'host':_0x21ea('0xc'),'port':0x18eb});var io=require(_0x21ea('0xd'))(new Redis(config[_0x21ea('0xa')]));function emit(_0x4bceea,_0x375a28,_0xd27c9){io['to'](_0x4bceea)[_0x21ea('0xe')](_0x375a28,_0xd27c9);}function getTicket(_0x18aafb,_0x1c35de,_0x3cbf6b,_0x990bb6,_0x8cdfcc,_0x242802,_0x37312e,_0x257299){var _0x57979d=Object['assign']({},{'OwnerId':_0x1c35de['id'],'Subject':intUtil[_0x21ea('0xf')](_0x990bb6[_0x21ea('0x10')],_0x8cdfcc,'\x20'),'Description':intUtil[_0x21ea('0xf')](_0x990bb6[_0x21ea('0x11')],_0x8cdfcc,'\x0a')},getCustomFields(_0x242802,_0x8cdfcc));if(_0x3cbf6b){if(_0x990bb6[_0x21ea('0x12')]===_0x21ea('0x13')){_0x57979d[_0x21ea('0x14')]=moment['utc']();_0x57979d['IsReminderSet']=![];_0x57979d[_0x21ea('0x15')]=![];if(_0x3cbf6b[_0x21ea('0x16')]===_0x21ea('0x17')||_0x3cbf6b[_0x21ea('0x16')]===_0x21ea('0x18')){_0x57979d[_0x21ea('0x19')]=_0x3cbf6b['id'];}else if(_0x3cbf6b[_0x21ea('0x16')]==='account'){_0x57979d[_0x21ea('0x1a')]=_0x3cbf6b['id'];}}else if(_0x990bb6[_0x21ea('0x12')]===_0x21ea('0x1b')){if(_0x3cbf6b[_0x21ea('0x16')]==='contact'){_0x57979d[_0x21ea('0x1c')]=_0x3cbf6b['id'];}else if(_0x3cbf6b[_0x21ea('0x16')]===_0x21ea('0x1d')){_0x57979d[_0x21ea('0x1e')]=_0x3cbf6b['id'];}else if(_0x3cbf6b[_0x21ea('0x16')]==='lead'&&_0x990bb6['leadId']){_0x57979d[_0x990bb6['leadId']]=_0x3cbf6b['id'];}else{logger[_0x21ea('0x1f')](_0x21ea('0x20'));}}}return _0x37312e[_0x21ea('0x21')](_0x990bb6['ticketType'])[_0x21ea('0x22')](_0x57979d);}function getUser(_0x2644c6,_0x3659cb,_0x32aea9){if(!_[_0x21ea('0x23')](_0x3659cb)&&intUtil[_0x21ea('0x24')](_0x3659cb)){var _0xca8ca4={'Email':_0x3659cb};var _0x10d717={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x32aea9[_0x21ea('0x21')](_0x21ea('0x25'))[_0x21ea('0x26')](_0xca8ca4,_0x10d717)[_0x21ea('0x27')]()[_0x21ea('0x28')](function(_0x221594){if(_0x221594[_0x21ea('0x29')]){var _0x8c8738=_[_0x21ea('0x26')](_0x221594,function(_0x588127){return _0x588127[_0x21ea('0x2a')]===_0x3659cb;});if(_0x8c8738){logger[_0x21ea('0x1f')]('Agent\x20%s\x20found.',_0x3659cb);return BPromise[_0x21ea('0x2b')]({'id':_0x8c8738['Id'],'name':_0x8c8738['Name']});}}else{logger[_0x21ea('0x1f')](_0x21ea('0x2c'),_0x3659cb);return _0x32aea9[_0x21ea('0x2d')]()[_0x21ea('0x28')](function(_0x2a4d85){return BPromise[_0x21ea('0x2b')]({'id':_0x2a4d85[_0x21ea('0x2e')],'name':_0x2a4d85[_0x21ea('0x2f')]});});}});}else{logger['info'](_0x21ea('0x2c'),_0x3659cb);return _0x32aea9[_0x21ea('0x2d')]()[_0x21ea('0x28')](function(_0x1c64bf){return BPromise[_0x21ea('0x2b')]({'id':_0x1c64bf['user_id'],'name':_0x1c64bf[_0x21ea('0x2f')]});});}}function getEndUser(_0x1fd81e,_0x50bd85,_0x583dda,_0xc32c25,_0x58d5fc){var _0x5dc9ca={'$or':{'Phone':_0xc32c25}};var _0x24b933={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x21ea('0x2b')]()[_0x21ea('0x28')](function(){logger['info'](_0x21ea('0x30'),_0xc32c25,_0x50bd85[_0x21ea('0x31')]);switch(_0x50bd85[_0x21ea('0x31')]){case _0x21ea('0x32'):var _0x468ea4=_['cloneDeep'](_0x5dc9ca);if(_0x50bd85['additionalSearchContact']){var _0x1903b4={};_0x1903b4[_0x50bd85['additionalSearchContact']]=_0xc32c25;_['merge'](_0x468ea4[_0x21ea('0x33')],_0x1903b4);}return _0x58d5fc[_0x21ea('0x21')](_0x21ea('0x34'))[_0x21ea('0x26')](_0x468ea4,_0x24b933)['execute']()[_0x21ea('0x28')](function(_0x5aa4e5){if(_0x5aa4e5&&_0x5aa4e5[_0x21ea('0x29')]){return _0x5aa4e5;}else{var _0x37006f=_[_0x21ea('0x35')](_0x5dc9ca);if(_0x50bd85[_0x21ea('0x36')]){var _0x498e42={};_0x498e42[_0x50bd85[_0x21ea('0x36')]]=_0xc32c25;_[_0x21ea('0x37')](_0x37006f['$or'],_0x498e42);}return _0x58d5fc['sobject'](_0x21ea('0x38'))[_0x21ea('0x26')](_0x37006f,_0x24b933);}});case'account_contact_lead':var _0x2a3571=_[_0x21ea('0x35')](_0x5dc9ca);if(_0x50bd85[_0x21ea('0x39')]){var _0x1903b4={};_0x1903b4[_0x50bd85['additionalSearchAccount']]=_0xc32c25;_[_0x21ea('0x37')](_0x2a3571[_0x21ea('0x33')],_0x1903b4);}return _0x58d5fc[_0x21ea('0x21')](_0x21ea('0x3a'))[_0x21ea('0x26')](_0x2a3571,_0x24b933)['execute']()[_0x21ea('0x28')](function(_0x3eac68){if(_0x3eac68&&_0x3eac68[_0x21ea('0x29')]){return _0x3eac68;}else{var _0x4dacc3=_[_0x21ea('0x35')](_0x5dc9ca);if(_0x50bd85['additionalSearchContact']){var _0xffec12={};_0xffec12[_0x50bd85[_0x21ea('0x3b')]]=_0xc32c25;_[_0x21ea('0x37')](_0x4dacc3[_0x21ea('0x33')],_0xffec12);}return _0x58d5fc[_0x21ea('0x21')](_0x21ea('0x34'))['find'](_0x4dacc3,_0x24b933)[_0x21ea('0x28')](function(_0x570340){if(_0x570340&&_0x570340[_0x21ea('0x29')]){return _0x570340;}else{var _0x385799=_[_0x21ea('0x35')](_0x5dc9ca);if(_0x50bd85[_0x21ea('0x36')]){var _0xc8de7={};_0xc8de7[_0x50bd85[_0x21ea('0x36')]]=_0xc32c25;_[_0x21ea('0x37')](_0x385799[_0x21ea('0x33')],_0xc8de7);}return _0x58d5fc[_0x21ea('0x21')](_0x21ea('0x38'))['find'](_0x385799,_0x24b933);}});}});case _0x21ea('0x17'):var _0x468ea4=_[_0x21ea('0x35')](_0x5dc9ca);if(_0x50bd85[_0x21ea('0x3b')]){var _0x1903b4={};_0x1903b4[_0x50bd85[_0x21ea('0x3b')]]=_0xc32c25;_['merge'](_0x468ea4['$or'],_0x1903b4);}return _0x58d5fc[_0x21ea('0x21')]('Contact')[_0x21ea('0x26')](_0x468ea4,_0x24b933)['execute']();case'lead':var _0x5efd4c=_[_0x21ea('0x35')](_0x5dc9ca);if(_0x50bd85[_0x21ea('0x36')]){var _0x1903b4={};_0x1903b4[_0x50bd85[_0x21ea('0x36')]]=_0xc32c25;_['merge'](_0x5efd4c[_0x21ea('0x33')],_0x1903b4);}return _0x58d5fc['sobject'](_0x21ea('0x38'))[_0x21ea('0x26')](_0x5efd4c,_0x24b933);case _0x21ea('0x1d'):var _0x2a3571=_['cloneDeep'](_0x5dc9ca);if(_0x50bd85['additionalSearchAccount']){var _0x1903b4={};_0x1903b4[_0x50bd85[_0x21ea('0x39')]]=_0xc32c25;_[_0x21ea('0x37')](_0x2a3571[_0x21ea('0x33')],_0x1903b4);}return _0x58d5fc['sobject'](_0x21ea('0x3a'))['find'](_0x2a3571,_0x24b933);default:return null;}})[_0x21ea('0x28')](function(_0x370f87){if(_0x370f87&&_0x370f87[_0x21ea('0x29')]){var _0x9f7d0c=_[_0x21ea('0x3c')](_0x370f87);if(_0x9f7d0c){return BPromise['resolve']({'id':_0x9f7d0c['Id'],'name':_0x9f7d0c['Name'],'phone':_0x9f7d0c[_0x21ea('0x3d')],'endUserType':_0x9f7d0c[_0x21ea('0x3e')][_0x21ea('0x3f')][_0x21ea('0x40')]()});}}})[_0x21ea('0x28')](function(_0x19624f){if(_0x19624f){logger[_0x21ea('0x1f')](_0x21ea('0x41'),_0x19624f['endUserType'],_0xc32c25);return BPromise[_0x21ea('0x2b')](_0x19624f);}else{logger[_0x21ea('0x1f')](_0x21ea('0x42'),_0xc32c25);var _0x6a3c65={'Phone':_0xc32c25};if(_0x50bd85[_0x21ea('0x43')]){if(_0x50bd85['moduleCreate']===_0x21ea('0x17')){logger[_0x21ea('0x1f')](_0x21ea('0x44'),_0xc32c25,_0x50bd85['moduleCreate']);_0x6a3c65[_0x21ea('0x45')]=_0x583dda!==''?_0x583dda:util[_0x21ea('0x46')]('Caller\x20-\x20%s',_0xc32c25);}else if(_0x50bd85['moduleCreate']===_0x21ea('0x18')){logger[_0x21ea('0x1f')](_0x21ea('0x44'),_0xc32c25,_0x50bd85[_0x21ea('0x43')]);_0x6a3c65[_0x21ea('0x45')]=_0x583dda!==''?_0x583dda:util[_0x21ea('0x46')](_0x21ea('0x47'),_0xc32c25);_0x6a3c65['Company']=_0x21ea('0x48');}else if(_0x50bd85[_0x21ea('0x43')]===_0x21ea('0x1d')){logger['info'](_0x21ea('0x44'),_0xc32c25,_0x50bd85[_0x21ea('0x43')]);_0x6a3c65[_0x21ea('0x49')]=_0x583dda!==_0x21ea('0x4a')?_0x583dda:util[_0x21ea('0x46')]('Caller\x20-\x20%s',_0xc32c25);}else{return null;}}return _0x58d5fc[_0x21ea('0x21')](_[_0x21ea('0x4b')](_0x50bd85[_0x21ea('0x43')]))[_0x21ea('0x22')](_0x6a3c65)[_0x21ea('0x28')](function(_0x23117a){return BPromise['resolve']({'id':_0x23117a['id'],'endUserType':_0x50bd85['moduleCreate']});});}});}function getCustomFields(_0x1c4421,_0x2c809e){var _0x3b932f={};if(_0x1c4421['length']>0x0){_[_0x21ea('0x4c')](_0x1c4421,function(_0x55b035){if(_['includes']([_0x21ea('0x4d'),_0x21ea('0x4e')],_0x55b035[_0x21ea('0x3f')])&&_0x55b035[_0x21ea('0x4f')]){_0x3b932f[_0x55b035[_0x21ea('0x4f')]]=_0x55b035[_0x21ea('0x50')]['toString']();}else if(_0x55b035['type']===_0x21ea('0x51')&&_0x55b035[_0x21ea('0x52')]&&_0x55b035[_0x21ea('0x4f')]){_0x2c809e[_0x55b035[_0x21ea('0x52')]]&&(_0x3b932f[_0x55b035[_0x21ea('0x4f')]]=_0x2c809e[_0x55b035[_0x21ea('0x52')]][_0x21ea('0x53')]());}else if(_0x55b035[_0x21ea('0x3f')]===_0x21ea('0x54')&&_0x55b035['Variable']&&_0x55b035[_0x21ea('0x55')]['name']&&_0x55b035[_0x21ea('0x4f')]){_0x2c809e[_0x55b035['Variable'][_0x21ea('0x56')]['toLowerCase']()]&&(_0x3b932f[_0x55b035['idField']]=_0x2c809e[_0x55b035[_0x21ea('0x55')][_0x21ea('0x56')][_0x21ea('0x40')]()][_0x21ea('0x53')]());}});}return _0x3b932f;}function getConnection(_0x4b09f1){var _0xbe8164=_0x4b09f1[_0x21ea('0x57')]['concat'](_0x4b09f1['securityToken']);var _0x55fb96=new jsforce['Connection']({'oauth2':{'loginUrl':_0x4b09f1[_0x21ea('0x58')]||'https://login.salesforce.com','clientId':_0x4b09f1[_0x21ea('0x59')],'clientSecret':_0x4b09f1['clientSecret']}});return _0x55fb96['login'](_0x4b09f1['username'],_0xbe8164)[_0x21ea('0x28')](function(){logger[_0x21ea('0x1f')]('Connection\x20established.');return _0x55fb96;});}exports[_0x21ea('0x5a')]=function(_0x2af617,_0xd143c7,_0x39f9ac,_0xf6b27,_0x2680f5,_0x40fb8c){var _0x97e135,_0x2ec95d,_0x2d3836,_0x30e6c9;_0x40fb8c[_0x21ea('0x5b')]=intUtil[_0x21ea('0x5c')](_0x40fb8c[_0x21ea('0x5b')]);_0x40fb8c[_0x21ea('0x58')]=intUtil['stripTrailingSlash'](_0x40fb8c[_0x21ea('0x58')]);if(_0x2680f5&&_0x2680f5[_0x21ea('0x5d')]){logger[_0x21ea('0x1f')](_0x21ea('0x5e'),_0x21ea('0x5f'));_0xd143c7[_0x21ea('0x60')]=util[_0x21ea('0x46')](_0x21ea('0x61'),_0x40fb8c[_0x21ea('0x5b')],_0xd143c7['uniqueid'],md5(_0xd143c7['uniqueid']));}else{_0xd143c7[_0x21ea('0x60')]='';}return getConnection(_0x40fb8c)['then'](function(_0x1aa362){_0x30e6c9=_0x1aa362;return getUser(_0x40fb8c,_0xf6b27[_0x21ea('0x62')],_0x30e6c9);})[_0x21ea('0x28')](function(_0x10644f){_0x97e135=_0x10644f;return getEndUser(_0x40fb8c,_0x39f9ac,_0xd143c7[_0x21ea('0x63')],_0xd143c7[_0x21ea('0x64')],_0x30e6c9);})[_0x21ea('0x28')](function(_0x37e034){_0x2ec95d=_0x37e034;return getTicket(_0x40fb8c,_0x97e135,_0x2ec95d,_0x39f9ac,_0xd143c7,_0x39f9ac['Fields'],_0x30e6c9,_0x21ea('0x5a'));})[_0x21ea('0x28')](function(_0x10c65d){_0x2d3836=_0x10c65d;logger[_0x21ea('0x1f')](_0x21ea('0x65'),_0x2d3836['id']);logger[_0x21ea('0x1f')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x2d3836['id'],_0xf6b27['name'],_0x40fb8c[_0x21ea('0x3f')]);switch(_0x40fb8c[_0x21ea('0x3f')]){case _0x21ea('0x66'):emit(util['format'](_0x21ea('0x67'),_0xf6b27[_0x21ea('0x56')]),'trigger:salesforce:display',{'recordId':_0x2d3836['id']});break;case _0x21ea('0x68'):emit(util[_0x21ea('0x46')](_0x21ea('0x67'),_0xf6b27[_0x21ea('0x56')]),_0x21ea('0x69'),{'uri':util[_0x21ea('0x46')]('%s/%s/e',_0x30e6c9[_0x21ea('0x6a')],_0x2d3836['id'])});break;default:logger[_0x21ea('0x6b')](_0x21ea('0x6c'));}})['catch'](function(_0x77417a){logger['error']('[QUEUE]',_0x77417a);});};exports[_0x21ea('0x6d')]=function(_0x5772f4,_0x654709,_0x4594e1,_0xfabd24,_0x1a994e,_0x555209,_0x1f40ca){var _0x553326,_0x25237c,_0x50f986,_0x2ea5a3;_0x555209[_0x21ea('0x5b')]=intUtil[_0x21ea('0x5c')](_0x555209[_0x21ea('0x5b')]);_0x555209[_0x21ea('0x58')]=intUtil[_0x21ea('0x5c')](_0x555209['remoteUri']);if(_0x1f40ca&&_0x1f40ca['recordingFormat']&&_0x1f40ca[_0x21ea('0x6e')]!==_0x21ea('0x6f')){logger[_0x21ea('0x1f')](_0x21ea('0x70'),_0x21ea('0x5f'));_0x654709[_0x21ea('0x60')]=util['format'](_0x21ea('0x61'),_0x555209[_0x21ea('0x5b')],_0x654709['uniqueid'],md5(_0x654709[_0x21ea('0x71')]));}return getConnection(_0x555209)[_0x21ea('0x28')](function(_0x33108f){_0x2ea5a3=_0x33108f;return getUser(_0x555209,_0xfabd24[_0x21ea('0x62')],_0x2ea5a3);})[_0x21ea('0x28')](function(_0x551ac6){_0x553326=_0x551ac6;return getEndUser(_0x555209,_0x4594e1,_0x654709[_0x21ea('0x72')],_0x654709[_0x21ea('0x73')],_0x2ea5a3);})[_0x21ea('0x28')](function(_0x7a2b86){_0x25237c=_0x7a2b86;return getTicket(_0x555209,_0x553326,_0x25237c,_0x4594e1,_0x654709,_0x4594e1[_0x21ea('0x74')],_0x2ea5a3,_0x21ea('0x6d'));})[_0x21ea('0x28')](function(_0x409b35){_0x50f986=_0x409b35;logger[_0x21ea('0x1f')](_0x21ea('0x75'),_0x50f986['id']);logger[_0x21ea('0x1f')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x50f986['id'],_0xfabd24[_0x21ea('0x56')],_0x555209['type']);switch(_0x555209['type']){case _0x21ea('0x66'):emit(util['format'](_0x21ea('0x67'),_0xfabd24['name']),_0x21ea('0x76'),{'recordId':_0x50f986['id']});break;case _0x21ea('0x68'):emit(util[_0x21ea('0x46')](_0x21ea('0x67'),_0xfabd24[_0x21ea('0x56')]),'trigger:browser:url',{'uri':util['format']('%s/%s/e',_0x2ea5a3[_0x21ea('0x6a')],_0x50f986['id'])});break;default:logger[_0x21ea('0x6b')](_0x21ea('0x70'),_0x21ea('0x77'));}})[_0x21ea('0x78')](function(_0x3d373c){logger[_0x21ea('0x6b')](_0x21ea('0x70'),_0x3d373c);});};exports[_0x21ea('0x79')]=function(_0x54b6d7,_0x4392e6,_0x258bf6,_0x4f8990,_0x2b0460,_0x32a1aa){var _0x20877a,_0x1273a3,_0x2d899e,_0x1c6436;_0x32a1aa['serverUrl']=intUtil[_0x21ea('0x5c')](_0x32a1aa[_0x21ea('0x5b')]);_0x32a1aa[_0x21ea('0x58')]=intUtil[_0x21ea('0x5c')](_0x32a1aa[_0x21ea('0x58')]);if(_0x2b0460&&_0x2b0460[_0x21ea('0x5d')]){logger['info']('['+_0x4392e6[_0x21ea('0x7a')][_0x21ea('0x7b')]()+']','Recording\x20is\x20enabled!');_0x4392e6[_0x21ea('0x60')]=util[_0x21ea('0x46')](_0x21ea('0x61'),_0x32a1aa['serverUrl'],_0x4392e6[_0x21ea('0x71')],md5(_0x4392e6['uniqueid']));}else{_0x4392e6[_0x21ea('0x60')]='';}return getConnection(_0x32a1aa)[_0x21ea('0x28')](function(_0x369bc3){_0x1c6436=_0x369bc3;if(!_['isNil'](_0x4f8990)){return getUser(_0x32a1aa,_0x4f8990['name'],_0x1c6436);}else{return getUser(_0x32a1aa,null,_0x1c6436);}})[_0x21ea('0x28')](function(_0x57e3e4){_0x20877a=_0x57e3e4;return getEndUser(_0x32a1aa,_0x258bf6,_0x4392e6[_0x21ea('0x63')],_0x4392e6['calleridnum'],_0x1c6436);})[_0x21ea('0x28')](function(_0x298e60){_0x1273a3=_0x298e60;return getTicket(_0x32a1aa,_0x20877a,_0x1273a3,_0x258bf6,_0x4392e6,_0x258bf6[_0x21ea('0x74')],_0x1c6436);})[_0x21ea('0x28')](function(_0x4211ec){_0x2d899e=_0x4211ec;logger[_0x21ea('0x1f')]('['+_0x4392e6['lastevent'][_0x21ea('0x7b')]()+']\x20Ticket\x20%s\x20created.',_0x2d899e['id']);logger[_0x21ea('0x1f')]('['+_0x4392e6[_0x21ea('0x7a')][_0x21ea('0x7b')]()+_0x21ea('0x7c'),_0x32a1aa[_0x21ea('0x3f')]);})['catch'](function(_0x406f5b){logger[_0x21ea('0x6b')]('['+_0x4392e6[_0x21ea('0x7a')][_0x21ea('0x7b')]()+']',_0x406f5b);});}; \ No newline at end of file +var _0xef4f=['lead','WhoId','Case','ContactId','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','then','length','Email','Agent\x20%s\x20found.','resolve','Name','info','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','Lead','account_contact_lead','additionalSearchAccount','Account','execute','additionalSearchLead','first','Phone','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','Caller\x20-\x20%s','Company','No\x20Company','account','','upperFirst','includes','string','picklist','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:browser:url','unmanaged','lastevent','toUpperCase','calleridname',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','emit','assign','getString','Subjects','Descriptions','ticketType','ActivityDate','IsRecurrence','endUserType','contact'];(function(_0x1522ad,_0x84f385){var _0x4f649a=function(_0x5f0bbc){while(--_0x5f0bbc){_0x1522ad['push'](_0x1522ad['shift']());}};_0x4f649a(++_0x84f385);}(_0xef4f,0xf2));var _0xfef4=function(_0x3d40f6,_0x160271){_0x3d40f6=_0x3d40f6-0x0;var _0x246255=_0xef4f[_0x3d40f6];return _0x246255;};'use strict';var _=require(_0xfef4('0x0'));var rp=require(_0xfef4('0x1'));var moment=require(_0xfef4('0x2'));var BPromise=require('bluebird');var md5=require(_0xfef4('0x3'));var jsforce=require(_0xfef4('0x4'));var util=require(_0xfef4('0x5'));var Redis=require(_0xfef4('0x6'));var intUtil=require(_0xfef4('0x7'));var config=require(_0xfef4('0x8'));var logger=require(_0xfef4('0x9'))(_0xfef4('0xa'));config[_0xfef4('0xb')]=_[_0xfef4('0xc')](config[_0xfef4('0xb')],{'host':_0xfef4('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfef4('0xb')]));function emit(_0x1f80b7,_0x385084,_0x23a6b3){io['to'](_0x1f80b7)[_0xfef4('0xe')](_0x385084,_0x23a6b3);}function getTicket(_0x5acec8,_0x2f7b30,_0xe85e74,_0xe22e33,_0x4ef590,_0xece40a,_0x2856f9,_0xf491a9){var _0x27d8b8=Object[_0xfef4('0xf')]({},{'OwnerId':_0x2f7b30['id'],'Subject':intUtil[_0xfef4('0x10')](_0xe22e33[_0xfef4('0x11')],_0x4ef590,'\x20'),'Description':intUtil[_0xfef4('0x10')](_0xe22e33[_0xfef4('0x12')],_0x4ef590,'\x0a')},getCustomFields(_0xece40a,_0x4ef590));if(_0xe85e74){if(_0xe22e33[_0xfef4('0x13')]==='Task'){_0x27d8b8[_0xfef4('0x14')]=moment['utc']();_0x27d8b8['IsReminderSet']=![];_0x27d8b8[_0xfef4('0x15')]=![];if(_0xe85e74[_0xfef4('0x16')]===_0xfef4('0x17')||_0xe85e74[_0xfef4('0x16')]===_0xfef4('0x18')){_0x27d8b8[_0xfef4('0x19')]=_0xe85e74['id'];}else if(_0xe85e74[_0xfef4('0x16')]==='account'){_0x27d8b8['WhatId']=_0xe85e74['id'];}}else if(_0xe22e33[_0xfef4('0x13')]===_0xfef4('0x1a')){if(_0xe85e74[_0xfef4('0x16')]===_0xfef4('0x17')){_0x27d8b8[_0xfef4('0x1b')]=_0xe85e74['id'];}else if(_0xe85e74['endUserType']==='account'){_0x27d8b8[_0xfef4('0x1c')]=_0xe85e74['id'];}else if(_0xe85e74[_0xfef4('0x16')]==='lead'&&_0xe22e33[_0xfef4('0x1d')]){_0x27d8b8[_0xe22e33['leadId']]=_0xe85e74['id'];}else{logger['info'](_0xfef4('0x1e'));}}}return _0x2856f9[_0xfef4('0x1f')](_0xe22e33[_0xfef4('0x13')])[_0xfef4('0x20')](_0x27d8b8);}function getUser(_0x5170fc,_0x140cc6,_0x222ff2){if(!_[_0xfef4('0x21')](_0x140cc6)&&intUtil[_0xfef4('0x22')](_0x140cc6)){var _0x52b860={'Email':_0x140cc6};var _0x392afd={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x222ff2[_0xfef4('0x1f')](_0xfef4('0x23'))[_0xfef4('0x24')](_0x52b860,_0x392afd)['execute']()[_0xfef4('0x25')](function(_0x47bbe1){if(_0x47bbe1[_0xfef4('0x26')]){var _0x128033=_['find'](_0x47bbe1,function(_0x4980ec){return _0x4980ec[_0xfef4('0x27')]===_0x140cc6;});if(_0x128033){logger['info'](_0xfef4('0x28'),_0x140cc6);return BPromise[_0xfef4('0x29')]({'id':_0x128033['Id'],'name':_0x128033[_0xfef4('0x2a')]});}}else{logger[_0xfef4('0x2b')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x140cc6);return _0x222ff2[_0xfef4('0x2c')]()[_0xfef4('0x25')](function(_0x44a8c5){return BPromise[_0xfef4('0x29')]({'id':_0x44a8c5[_0xfef4('0x2d')],'name':_0x44a8c5['display_name']});});}});}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x140cc6);return _0x222ff2[_0xfef4('0x2c')]()['then'](function(_0x2cc30d){return BPromise['resolve']({'id':_0x2cc30d[_0xfef4('0x2d')],'name':_0x2cc30d[_0xfef4('0x2e')]});});}}function getEndUser(_0x376b3c,_0x40d585,_0x31d62a,_0x51821f,_0x370fbc){var _0x5d13ff={'$or':{'Phone':_0x51821f}};var _0x24ad6d={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xfef4('0x29')]()[_0xfef4('0x25')](function(){logger[_0xfef4('0x2b')](_0xfef4('0x2f'),_0x51821f,_0x40d585[_0xfef4('0x30')]);switch(_0x40d585[_0xfef4('0x30')]){case _0xfef4('0x31'):var _0x431904=_[_0xfef4('0x32')](_0x5d13ff);if(_0x40d585[_0xfef4('0x33')]){var _0x3c6af2={};_0x3c6af2[_0x40d585[_0xfef4('0x33')]]=_0x51821f;_[_0xfef4('0x34')](_0x431904[_0xfef4('0x35')],_0x3c6af2);}return _0x370fbc[_0xfef4('0x1f')](_0xfef4('0x36'))['find'](_0x431904,_0x24ad6d)['execute']()['then'](function(_0x6bf2a3){if(_0x6bf2a3&&_0x6bf2a3['length']){return _0x6bf2a3;}else{var _0x57d68d=_[_0xfef4('0x32')](_0x5d13ff);if(_0x40d585['additionalSearchLead']){var _0x18e7e0={};_0x18e7e0[_0x40d585['additionalSearchLead']]=_0x51821f;_['merge'](_0x57d68d[_0xfef4('0x35')],_0x18e7e0);}return _0x370fbc[_0xfef4('0x1f')](_0xfef4('0x37'))[_0xfef4('0x24')](_0x57d68d,_0x24ad6d);}});case _0xfef4('0x38'):var _0x31c801=_[_0xfef4('0x32')](_0x5d13ff);if(_0x40d585[_0xfef4('0x39')]){var _0x3c6af2={};_0x3c6af2[_0x40d585[_0xfef4('0x39')]]=_0x51821f;_[_0xfef4('0x34')](_0x31c801['$or'],_0x3c6af2);}return _0x370fbc[_0xfef4('0x1f')](_0xfef4('0x3a'))[_0xfef4('0x24')](_0x31c801,_0x24ad6d)[_0xfef4('0x3b')]()[_0xfef4('0x25')](function(_0x2e3fd3){if(_0x2e3fd3&&_0x2e3fd3[_0xfef4('0x26')]){return _0x2e3fd3;}else{var _0x19158d=_['cloneDeep'](_0x5d13ff);if(_0x40d585[_0xfef4('0x33')]){var _0x54b213={};_0x54b213[_0x40d585['additionalSearchContact']]=_0x51821f;_[_0xfef4('0x34')](_0x19158d[_0xfef4('0x35')],_0x54b213);}return _0x370fbc[_0xfef4('0x1f')](_0xfef4('0x36'))[_0xfef4('0x24')](_0x19158d,_0x24ad6d)['then'](function(_0x93c6f0){if(_0x93c6f0&&_0x93c6f0[_0xfef4('0x26')]){return _0x93c6f0;}else{var _0x443080=_[_0xfef4('0x32')](_0x5d13ff);if(_0x40d585['additionalSearchLead']){var _0x1ecd46={};_0x1ecd46[_0x40d585[_0xfef4('0x3c')]]=_0x51821f;_[_0xfef4('0x34')](_0x443080[_0xfef4('0x35')],_0x1ecd46);}return _0x370fbc[_0xfef4('0x1f')](_0xfef4('0x37'))[_0xfef4('0x24')](_0x443080,_0x24ad6d);}});}});case _0xfef4('0x17'):var _0x431904=_[_0xfef4('0x32')](_0x5d13ff);if(_0x40d585[_0xfef4('0x33')]){var _0x3c6af2={};_0x3c6af2[_0x40d585['additionalSearchContact']]=_0x51821f;_['merge'](_0x431904[_0xfef4('0x35')],_0x3c6af2);}return _0x370fbc[_0xfef4('0x1f')](_0xfef4('0x36'))['find'](_0x431904,_0x24ad6d)[_0xfef4('0x3b')]();case _0xfef4('0x18'):var _0x404c41=_[_0xfef4('0x32')](_0x5d13ff);if(_0x40d585[_0xfef4('0x3c')]){var _0x3c6af2={};_0x3c6af2[_0x40d585[_0xfef4('0x3c')]]=_0x51821f;_[_0xfef4('0x34')](_0x404c41[_0xfef4('0x35')],_0x3c6af2);}return _0x370fbc[_0xfef4('0x1f')](_0xfef4('0x37'))[_0xfef4('0x24')](_0x404c41,_0x24ad6d);case'account':var _0x31c801=_[_0xfef4('0x32')](_0x5d13ff);if(_0x40d585[_0xfef4('0x39')]){var _0x3c6af2={};_0x3c6af2[_0x40d585[_0xfef4('0x39')]]=_0x51821f;_[_0xfef4('0x34')](_0x31c801[_0xfef4('0x35')],_0x3c6af2);}return _0x370fbc['sobject'](_0xfef4('0x3a'))[_0xfef4('0x24')](_0x31c801,_0x24ad6d);default:return null;}})['then'](function(_0x206d3d){if(_0x206d3d&&_0x206d3d[_0xfef4('0x26')]){var _0x501910=_[_0xfef4('0x3d')](_0x206d3d);if(_0x501910){return BPromise[_0xfef4('0x29')]({'id':_0x501910['Id'],'name':_0x501910[_0xfef4('0x2a')],'phone':_0x501910[_0xfef4('0x3e')],'endUserType':_0x501910['attributes'][_0xfef4('0x3f')]['toLowerCase']()});}}})[_0xfef4('0x25')](function(_0x7a4352){if(_0x7a4352){logger[_0xfef4('0x2b')](_0xfef4('0x40'),_0x7a4352['endUserType'],_0x51821f);return BPromise['resolve'](_0x7a4352);}else{logger['info'](_0xfef4('0x41'),_0x51821f);var _0x2bbfe5={'Phone':_0x51821f};if(_0x40d585[_0xfef4('0x42')]){if(_0x40d585[_0xfef4('0x42')]===_0xfef4('0x17')){logger['info'](_0xfef4('0x43'),_0x51821f,_0x40d585[_0xfef4('0x42')]);_0x2bbfe5[_0xfef4('0x44')]=_0x31d62a!==''?_0x31d62a:util[_0xfef4('0x45')](_0xfef4('0x46'),_0x51821f);}else if(_0x40d585['moduleCreate']===_0xfef4('0x18')){logger[_0xfef4('0x2b')](_0xfef4('0x43'),_0x51821f,_0x40d585[_0xfef4('0x42')]);_0x2bbfe5[_0xfef4('0x44')]=_0x31d62a!==''?_0x31d62a:util[_0xfef4('0x45')](_0xfef4('0x46'),_0x51821f);_0x2bbfe5[_0xfef4('0x47')]=_0xfef4('0x48');}else if(_0x40d585[_0xfef4('0x42')]===_0xfef4('0x49')){logger[_0xfef4('0x2b')](_0xfef4('0x43'),_0x51821f,_0x40d585['moduleCreate']);_0x2bbfe5['Name']=_0x31d62a!==_0xfef4('0x4a')?_0x31d62a:util[_0xfef4('0x45')](_0xfef4('0x46'),_0x51821f);}else{return null;}}return _0x370fbc[_0xfef4('0x1f')](_[_0xfef4('0x4b')](_0x40d585['moduleCreate']))[_0xfef4('0x20')](_0x2bbfe5)[_0xfef4('0x25')](function(_0xa7ffff){return BPromise[_0xfef4('0x29')]({'id':_0xa7ffff['id'],'endUserType':_0x40d585[_0xfef4('0x42')]});});}});}function getCustomFields(_0x5de94c,_0x385ed3){var _0x27c79f={};if(_0x5de94c[_0xfef4('0x26')]>0x0){_['forEach'](_0x5de94c,function(_0x2a2396){if(_[_0xfef4('0x4c')]([_0xfef4('0x4d'),_0xfef4('0x4e')],_0x2a2396[_0xfef4('0x3f')])&&_0x2a2396[_0xfef4('0x4f')]){_0x27c79f[_0x2a2396[_0xfef4('0x4f')]]=_0x2a2396[_0xfef4('0x50')][_0xfef4('0x51')]();}else if(_0x2a2396[_0xfef4('0x3f')]==='variable'&&_0x2a2396[_0xfef4('0x52')]&&_0x2a2396['idField']){_0x385ed3[_0x2a2396[_0xfef4('0x52')]]&&(_0x27c79f[_0x2a2396[_0xfef4('0x4f')]]=_0x385ed3[_0x2a2396[_0xfef4('0x52')]][_0xfef4('0x51')]());}else if(_0x2a2396[_0xfef4('0x3f')]===_0xfef4('0x53')&&_0x2a2396[_0xfef4('0x54')]&&_0x2a2396[_0xfef4('0x54')][_0xfef4('0x55')]&&_0x2a2396[_0xfef4('0x4f')]){_0x385ed3[_0x2a2396[_0xfef4('0x54')][_0xfef4('0x55')][_0xfef4('0x56')]()]&&(_0x27c79f[_0x2a2396['idField']]=_0x385ed3[_0x2a2396['Variable'][_0xfef4('0x55')][_0xfef4('0x56')]()][_0xfef4('0x51')]());}});}return _0x27c79f;}function getConnection(_0x8f13fd){var _0x4f849f=_0x8f13fd[_0xfef4('0x57')][_0xfef4('0x58')](_0x8f13fd[_0xfef4('0x59')]);var _0x1f7d1e=new jsforce['Connection']({'oauth2':{'loginUrl':_0x8f13fd[_0xfef4('0x5a')]||_0xfef4('0x5b'),'clientId':_0x8f13fd['clientId'],'clientSecret':_0x8f13fd[_0xfef4('0x5c')]}});return _0x1f7d1e[_0xfef4('0x5d')](_0x8f13fd[_0xfef4('0x5e')],_0x4f849f)['then'](function(){logger[_0xfef4('0x2b')](_0xfef4('0x5f'));return _0x1f7d1e;});}exports['queue']=function(_0x45deb9,_0x362796,_0x2a351b,_0x4f44b7,_0x525538,_0x44da48){var _0x1d4c78,_0x56a30f,_0x16f8ef,_0x24a92c;_0x44da48[_0xfef4('0x60')]=intUtil[_0xfef4('0x61')](_0x44da48[_0xfef4('0x60')]);_0x44da48[_0xfef4('0x5a')]=intUtil[_0xfef4('0x61')](_0x44da48[_0xfef4('0x5a')]);if(_0x525538&&_0x525538[_0xfef4('0x62')]){logger[_0xfef4('0x2b')](_0xfef4('0x63'),_0xfef4('0x64'));_0x362796[_0xfef4('0x65')]=util[_0xfef4('0x45')](_0xfef4('0x66'),_0x44da48['serverUrl'],_0x362796[_0xfef4('0x67')],md5(_0x362796[_0xfef4('0x67')]));}else{_0x362796[_0xfef4('0x65')]='';}return getConnection(_0x44da48)['then'](function(_0x5f2b99){_0x24a92c=_0x5f2b99;return getUser(_0x44da48,_0x4f44b7[_0xfef4('0x68')],_0x24a92c);})[_0xfef4('0x25')](function(_0x32a89){_0x1d4c78=_0x32a89;return getEndUser(_0x44da48,_0x2a351b,_0x362796['calleridname'],_0x362796[_0xfef4('0x69')],_0x24a92c);})[_0xfef4('0x25')](function(_0x1538a7){_0x56a30f=_0x1538a7;return getTicket(_0x44da48,_0x1d4c78,_0x56a30f,_0x2a351b,_0x362796,_0x2a351b[_0xfef4('0x6a')],_0x24a92c,_0xfef4('0x6b'));})[_0xfef4('0x25')](function(_0x272d6c){_0x16f8ef=_0x272d6c;logger[_0xfef4('0x2b')](_0xfef4('0x6c'),_0x16f8ef['id']);logger[_0xfef4('0x2b')](_0xfef4('0x6d'),_0x16f8ef['id'],_0x4f44b7['name'],_0x44da48['type']);switch(_0x44da48[_0xfef4('0x3f')]){case _0xfef4('0x6e'):emit(util[_0xfef4('0x45')](_0xfef4('0x6f'),_0x4f44b7[_0xfef4('0x55')]),_0xfef4('0x70'),{'recordId':_0x16f8ef['id']});break;case _0xfef4('0x71'):emit(util[_0xfef4('0x45')](_0xfef4('0x6f'),_0x4f44b7[_0xfef4('0x55')]),'trigger:browser:url',{'uri':util['format'](_0xfef4('0x72'),_0x24a92c[_0xfef4('0x73')],_0x16f8ef['id'])});break;default:logger[_0xfef4('0x74')](_0xfef4('0x75'));}})[_0xfef4('0x76')](function(_0x51f369){logger[_0xfef4('0x74')](_0xfef4('0x63'),_0x51f369);});};exports[_0xfef4('0x77')]=function(_0x5ef4af,_0x17d36c,_0x565bf8,_0x5bbc2e,_0x7777c2,_0xefd685,_0x3e7638){var _0x5d2a20,_0x5d8106,_0x593954,_0x155da1;_0xefd685['serverUrl']=intUtil['stripTrailingSlash'](_0xefd685[_0xfef4('0x60')]);_0xefd685['remoteUri']=intUtil[_0xfef4('0x61')](_0xefd685['remoteUri']);if(_0x3e7638&&_0x3e7638[_0xfef4('0x78')]&&_0x3e7638['recordingFormat']!==_0xfef4('0x79')){logger[_0xfef4('0x2b')](_0xfef4('0x7a'),'Recording\x20is\x20enabled!');_0x17d36c['recordingURL']=util['format'](_0xfef4('0x66'),_0xefd685[_0xfef4('0x60')],_0x17d36c[_0xfef4('0x67')],md5(_0x17d36c[_0xfef4('0x67')]));}return getConnection(_0xefd685)[_0xfef4('0x25')](function(_0x4b6b15){_0x155da1=_0x4b6b15;return getUser(_0xefd685,_0x5bbc2e[_0xfef4('0x68')],_0x155da1);})['then'](function(_0x253d8c){_0x5d2a20=_0x253d8c;return getEndUser(_0xefd685,_0x565bf8,_0x17d36c[_0xfef4('0x7b')],_0x17d36c[_0xfef4('0x7c')],_0x155da1);})[_0xfef4('0x25')](function(_0x67d7ef){_0x5d8106=_0x67d7ef;return getTicket(_0xefd685,_0x5d2a20,_0x5d8106,_0x565bf8,_0x17d36c,_0x565bf8[_0xfef4('0x6a')],_0x155da1,_0xfef4('0x77'));})[_0xfef4('0x25')](function(_0x2c4ee5){_0x593954=_0x2c4ee5;logger[_0xfef4('0x2b')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x593954['id']);logger['info'](_0xfef4('0x7d'),_0x593954['id'],_0x5bbc2e['name'],_0xefd685[_0xfef4('0x3f')]);switch(_0xefd685[_0xfef4('0x3f')]){case'integrationTab':emit(util['format'](_0xfef4('0x6f'),_0x5bbc2e['name']),_0xfef4('0x70'),{'recordId':_0x593954['id']});break;case _0xfef4('0x71'):emit(util[_0xfef4('0x45')](_0xfef4('0x6f'),_0x5bbc2e[_0xfef4('0x55')]),_0xfef4('0x7e'),{'uri':util[_0xfef4('0x45')](_0xfef4('0x72'),_0x155da1[_0xfef4('0x73')],_0x593954['id'])});break;default:logger[_0xfef4('0x74')](_0xfef4('0x7a'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xfef4('0x76')](function(_0x5356d7){logger[_0xfef4('0x74')](_0xfef4('0x7a'),_0x5356d7);});};exports[_0xfef4('0x7f')]=function(_0x426597,_0x86813f,_0x1d7a5d,_0x44d32a,_0xed4e81,_0x45a579){var _0x825262,_0xb25176,_0x57f289,_0x13e9f8;_0x45a579['serverUrl']=intUtil[_0xfef4('0x61')](_0x45a579['serverUrl']);_0x45a579[_0xfef4('0x5a')]=intUtil['stripTrailingSlash'](_0x45a579['remoteUri']);if(_0xed4e81&&_0xed4e81[_0xfef4('0x62')]){logger['info']('['+_0x86813f[_0xfef4('0x80')][_0xfef4('0x81')]()+']',_0xfef4('0x64'));_0x86813f[_0xfef4('0x65')]=util[_0xfef4('0x45')](_0xfef4('0x66'),_0x45a579['serverUrl'],_0x86813f[_0xfef4('0x67')],md5(_0x86813f[_0xfef4('0x67')]));}else{_0x86813f[_0xfef4('0x65')]='';}return getConnection(_0x45a579)['then'](function(_0x2f7b82){_0x13e9f8=_0x2f7b82;if(!_['isNil'](_0x44d32a)){return getUser(_0x45a579,_0x44d32a[_0xfef4('0x55')],_0x13e9f8);}else{return getUser(_0x45a579,null,_0x13e9f8);}})[_0xfef4('0x25')](function(_0x468fb4){_0x825262=_0x468fb4;return getEndUser(_0x45a579,_0x1d7a5d,_0x86813f[_0xfef4('0x82')],_0x86813f[_0xfef4('0x69')],_0x13e9f8);})[_0xfef4('0x25')](function(_0x2cfe62){_0xb25176=_0x2cfe62;return getTicket(_0x45a579,_0x825262,_0xb25176,_0x1d7a5d,_0x86813f,_0x1d7a5d[_0xfef4('0x6a')],_0x13e9f8);})[_0xfef4('0x25')](function(_0x473f4c){_0x57f289=_0x473f4c;logger['info']('['+_0x86813f['lastevent'][_0xfef4('0x81')]()+_0xfef4('0x83'),_0x57f289['id']);logger[_0xfef4('0x2b')]('['+_0x86813f[_0xfef4('0x80')]['toUpperCase']()+_0xfef4('0x84'),_0x45a579[_0xfef4('0x3f')]);})[_0xfef4('0x76')](function(_0x2a0d1d){logger[_0xfef4('0x74')]('['+_0x86813f['lastevent']['toUpperCase']()+']',_0x2a0d1d);});}; \ 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 494571c..3cd0147 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 _0xb575=['ticketNumber','number','label','?sysparm_query=name%3D','label_entry','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','username','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','unmanaged','queue','uniqueid','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','bluebird','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','],\x20getAdminUser\x20crm','toUpperCase','message','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','System','],\x20EndUser\x20schema','endUserId','error','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','forEach','includes','nameField','content','toString','picklist','idField','toLowerCase','type','variable','variableName','customField','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','Subjects','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId'];(function(_0xd7f314,_0x176c1a){var _0x41c0ca=function(_0x37298f){while(--_0x37298f){_0xd7f314['push'](_0xd7f314['shift']());}};_0x41c0ca(++_0x176c1a);}(_0xb575,0x1c4));var _0x5b57=function(_0xb124ba,_0x5b094c){_0xb124ba=_0xb124ba-0x0;var _0x4c6447=_0xb575[_0xb124ba];return _0x4c6447;};'use strict';var _=require('lodash');var Promise=require(_0x5b57('0x0'));var rp=require(_0x5b57('0x1'));var util=require(_0x5b57('0x2'));var md5=require('md5');var Redis=require(_0x5b57('0x3'));var intUtil=require(_0x5b57('0x4'));var config=require(_0x5b57('0x5'));var logger=require(_0x5b57('0x6'))(_0x5b57('0x7'));config[_0x5b57('0x8')]=_[_0x5b57('0x9')](config[_0x5b57('0x8')],{'host':_0x5b57('0xa'),'port':0x18eb});var io=require(_0x5b57('0xb'))(new Redis(config['redis']));function getAdminUser(_0x407a7c,_0x3bf7b6,_0x2b82d4,_0xe45ae9,_0x6a2bb1,_0x51d858){return new Promise(function(_0x1e0cc1,_0x196e55){var _0x1efcbb={'method':_0x5b57('0xc'),'uri':_0xe45ae9+_0x5b57('0xd')+'&'+_0x6a2bb1+'&'+_0x51d858,'auth':_0x3bf7b6,'json':!![]};return rp(_0x1efcbb)[_0x5b57('0xe')](function(_0x9766f8){if(_0x9766f8[_0x5b57('0xf')][_0x5b57('0x10')]>0x0){_0x2b82d4[_0x5b57('0x11')]=_0x9766f8[_0x5b57('0xf')][0x0][_0x5b57('0x12')];}logger[_0x5b57('0x13')]('['+[_0x407a7c['toUpperCase']()]+_0x5b57('0x14'),_0x2b82d4);_0x1e0cc1(_0x2b82d4);})['catch'](function(_0xa26adc){logger['error']('['+[_0x407a7c[_0x5b57('0x15')]()]+']',_0xa26adc[_0x5b57('0x16')]);_0x196e55(_0xa26adc[_0x5b57('0x16')]);});});}function getUser(_0x270bf9,_0x11862a,_0x3270b7,_0x54e0a5,_0x33349f){return function(_0x2e24d3){logger[_0x5b57('0x13')]('['+[_0x270bf9[_0x5b57('0x15')]()]+'],\x20getUser\x20input\x20crm',_0x2e24d3);return new Promise(function(_0x2d1f3f,_0x3dab4b){if(intUtil[_0x5b57('0x17')](_0x2e24d3[_0x5b57('0x18')])){var _0x385186={'method':_0x5b57('0xc'),'uri':_0x3270b7+'sys_user?sysparm_query=email%3D'+_0x2e24d3[_0x5b57('0x18')]+'&'+_0x54e0a5+'&'+_0x33349f,'auth':_0x11862a,'json':!![]};logger[_0x5b57('0x13')]('['+[_0x270bf9[_0x5b57('0x15')]()]+_0x5b57('0x19'),_0x385186);return rp(_0x385186)[_0x5b57('0xe')](function(_0x174a2a){logger[_0x5b57('0x13')]('['+[_0x270bf9['toUpperCase']()]+_0x5b57('0x1a'),_0x174a2a);if(_0x174a2a[_0x5b57('0xf')]['length']>0x0&&String(_0x174a2a['result'][0x0][_0x5b57('0x1b')])===_0x5b57('0x1c')){_0x2e24d3[_0x5b57('0x1d')]=_0x174a2a[_0x5b57('0xf')][0x0][_0x5b57('0x12')];}else{_0x2e24d3[_0x5b57('0x1d')]=_0x2e24d3[_0x5b57('0x11')];_0x2e24d3[_0x5b57('0x18')]=_0x2e24d3['adminEmail'];}logger[_0x5b57('0x13')]('['+[_0x270bf9[_0x5b57('0x15')]()]+_0x5b57('0x1e'),_0x2e24d3);_0x2d1f3f(_0x2e24d3);})[_0x5b57('0x1f')](function(_0x21be2c){logger['error']('['+[_0x270bf9['toUpperCase']()]+']',_0x21be2c[_0x5b57('0x16')]);_0x3dab4b(_0x21be2c[_0x5b57('0x16')]);});}else{logger[_0x5b57('0x13')]('['+[_0x270bf9['toUpperCase']()]+_0x5b57('0x20'));_0x2e24d3['userId']=_0x2e24d3[_0x5b57('0x11')];_0x2e24d3[_0x5b57('0x18')]=_0x2e24d3[_0x5b57('0x21')];_0x2d1f3f(_0x2e24d3);}});};}function createEndUser(_0x3babf6,_0x3269e6,_0x5558c1,_0x5f324e,_0x5c3d3b){logger[_0x5b57('0x13')]('['+[_0x3babf6[_0x5b57('0x15')]()]+_0x5b57('0x22'),_0x5558c1);return new Promise(function(_0x3746df,_0x1c679d){var _0x399531={'method':_0x5b57('0x23'),'uri':_0x5f324e+'sys_user?'+_0x5c3d3b,'body':{'user_name':_0x5558c1[_0x5b57('0x24')],'roles':'user','first_name':_0x5558c1[_0x5b57('0x24')],'active':'true','date_format':_0x5b57('0x25'),'phone':_0x5558c1[_0x5b57('0x24')]},'auth':_0x3269e6,'json':!![]};return rp(_0x399531)['then'](function(_0xdc91b7){logger['info']('['+[_0x3babf6[_0x5b57('0x15')]()]+_0x5b57('0x26'),_0xdc91b7[_0x5b57('0xf')]);_0x5558c1[_0x5b57('0x27')]=_0xdc91b7[_0x5b57('0xf')][_0x5b57('0x12')];_0x3746df(_0x5558c1);})[_0x5b57('0x1f')](function(_0x29e2e1){logger[_0x5b57('0x28')]('['+[_0x3babf6['toUpperCase']()]+']',_0x29e2e1[_0x5b57('0x16')]);_0x1c679d(_0x29e2e1[_0x5b57('0x16')]);});});}function getEndUser(_0x44447e,_0x301172,_0x3ec2e4,_0x258560,_0x356fed){return function(_0x5e9c87){logger['info']('['+[_0x44447e['toUpperCase']()]+'],\x20getEndUser\x20input\x20crm',_0x5e9c87);return new Promise(function(_0x19ce49,_0x1c0c26){var _0x45c20b={'method':_0x5b57('0xc'),'uri':_0x3ec2e4+_0x5b57('0x29')+_0x5e9c87[_0x5b57('0x24')]+'&'+_0x258560+'&'+_0x356fed,'auth':_0x301172,'json':!![]};return rp(_0x45c20b)['then'](function(_0xf4966e){if(_0xf4966e[_0x5b57('0xf')][_0x5b57('0x10')]>0x0){_0x5e9c87['endUserId']=_0xf4966e[_0x5b57('0xf')][0x0][_0x5b57('0x12')];logger['info']('['+[_0x44447e[_0x5b57('0x15')]()]+'],\x20getEndUser\x20crm',_0x5e9c87);_0x19ce49(_0x5e9c87);}else{return createEndUser(_0x44447e,_0x301172,_0x5e9c87,_0x3ec2e4,_0x258560)['then'](function(_0x574abb){logger[_0x5b57('0x13')]('['+[_0x44447e['toUpperCase']()]+_0x5b57('0x2a'),_0x574abb);_0x19ce49(_0x574abb);});}})[_0x5b57('0x1f')](function(_0x46f527){logger['error']('['+[_0x44447e[_0x5b57('0x15')]()]+']',_0x46f527['message']);_0x1c0c26(_0x46f527[_0x5b57('0x16')]);});});};}function getCustomFields(_0x53d406,_0x5314e5){var _0x537e99={};if(_0x53d406[_0x5b57('0x10')]>0x0){_[_0x5b57('0x2b')](_0x53d406,function(_0x28c1cd){if(_[_0x5b57('0x2c')](['string','picklist'],_0x28c1cd['type'])&&_0x28c1cd[_0x5b57('0x2d')]&&!_0x28c1cd['customField']){_0x537e99[_0x28c1cd[_0x5b57('0x2d')]['toLowerCase']()]=_0x28c1cd[_0x5b57('0x2e')][_0x5b57('0x2f')]();}else if(_['includes'](['string',_0x5b57('0x30')],_0x28c1cd['type'])&&_0x28c1cd['idField']&&_0x28c1cd['customField']){_0x537e99[_0x28c1cd[_0x5b57('0x31')][_0x5b57('0x32')]()]=_0x28c1cd[_0x5b57('0x2e')][_0x5b57('0x2f')]();}else if(_0x28c1cd[_0x5b57('0x33')]===_0x5b57('0x34')&&_0x28c1cd[_0x5b57('0x35')]&&_0x28c1cd[_0x5b57('0x31')]&&_0x28c1cd[_0x5b57('0x36')]){_0x537e99[_0x28c1cd[_0x5b57('0x31')][_0x5b57('0x32')]()]=_0x5314e5[_0x28c1cd[_0x5b57('0x35')]]['toString']();}else if(_0x28c1cd[_0x5b57('0x33')]===_0x5b57('0x37')&&_0x28c1cd[_0x5b57('0x38')]&&_0x28c1cd['Variable'][_0x5b57('0x39')]&&_0x28c1cd[_0x5b57('0x31')]&&_0x28c1cd[_0x5b57('0x36')]){_0x537e99[_0x28c1cd['idField'][_0x5b57('0x32')]()]=_0x5314e5[_0x28c1cd['Variable'][_0x5b57('0x39')][_0x5b57('0x32')]()][_0x5b57('0x2f')]();}});}return _0x537e99;}function getTicket(_0x384fa8,_0x425287,_0x502431,_0xdccc09,_0x2ddc20,_0x3f24c7){return function(_0x2161ab){logger[_0x5b57('0x13')]('['+[_0x384fa8[_0x5b57('0x15')]()]+_0x5b57('0x3a'),_0x2161ab);return new Promise(function(_0x23b72d,_0x49ada5){var _0x3e9338=_0x384fa8[_0x5b57('0x32')]()===_0x5b57('0x3b')?_0x2161ab[_0x5b57('0x1d')]:_0x2161ab[_0x5b57('0x27')];var _0x2d3c72={'method':'POST','uri':_0x502431+_0x5b57('0x3c')+'?'+_0x3f24c7,'body':Object[_0x5b57('0x3d')]({},{'active':_0x5b57('0x1c'),'caller_id':_0x3e9338,'assigned_to':_0x2161ab[_0x5b57('0x1d')],'short_description':intUtil['getString'](_0xdccc09[_0x5b57('0x3e')],_0x2ddc20,'\x20'),'description':intUtil[_0x5b57('0x3f')](_0xdccc09[_0x5b57('0x40')],_0x2ddc20,'\x0a')},getCustomFields(_0xdccc09[_0x5b57('0x41')],_0x2ddc20)),'auth':_0x425287,'json':!![]};return rp(_0x2d3c72)[_0x5b57('0xe')](function(_0x34535f){logger['info']('['+[_0x384fa8[_0x5b57('0x15')]()]+_0x5b57('0x42'),_0x34535f[_0x5b57('0xf')]);_0x2161ab[_0x5b57('0x43')]=_0x34535f[_0x5b57('0xf')]['sys_id'];_0x2161ab[_0x5b57('0x44')]=_0x34535f[_0x5b57('0xf')][_0x5b57('0x45')];logger[_0x5b57('0x13')]('['+[_0x384fa8['toUpperCase']()]+']\x20getTicket\x20crm',_0x2161ab);_0x23b72d(_0x2161ab);})[_0x5b57('0x1f')](function(_0x5b0aae){logger[_0x5b57('0x28')]('['+[_0x384fa8[_0x5b57('0x15')]()]+']',_0x5b0aae['message']);_0x49ada5(_0x5b0aae[_0x5b57('0x16')]);});});};}function createRemoteTag(_0x6ab605,_0x4e1fa9,_0x2a26c6,_0x3f4153){return new Promise(function(_0x5bcf07,_0x1adc00){var _0x24af3e={'method':'POST','uri':_0x2a26c6+_0x5b57('0x46')+'?'+_0x3f4153,'body':{'short_description':_0x6ab605,'global':!![],'active':!![],'name':_0x6ab605},'auth':_0x4e1fa9,'json':!![]};return rp(_0x24af3e)[_0x5b57('0xe')](function(_0x4ce88c){var _0x369379=_0x4ce88c[_0x5b57('0xf')][_0x5b57('0x12')];_0x5bcf07(_0x369379);});});}function getRemoteTag(_0x1ce6de,_0x37fd6e,_0x2862fa,_0x58262e,_0x2d5b3f){return new Promise(function(_0x16b0f1,_0x1822a4){var _0x1fb098={'method':_0x5b57('0xc'),'uri':_0x2862fa+_0x5b57('0x46')+_0x5b57('0x47')+_0x1ce6de+'&'+_0x58262e,'auth':_0x37fd6e,'json':!![]};return rp(_0x1fb098)['then'](function(_0x496344){if(_0x496344['result'][_0x5b57('0x10')]>0x0){var _0x31f979=_0x496344['result'][0x0]['sys_id'];_0x16b0f1(_0x31f979);}else{return createRemoteTag(_0x1ce6de,_0x37fd6e,_0x2862fa,_0x58262e)[_0x5b57('0xe')](function(_0x53e4e8){_0x16b0f1(_0x53e4e8);});}});});}function assignTagToIncident(_0x45f8f2,_0x1b915e,_0x5849dc,_0xca7dda,_0x29264d){return new Promise(function(_0x58936b,_0x545e8e){var _0x4f7ae2={'method':_0x5b57('0x23'),'uri':_0x5849dc+_0x5b57('0x48')+'?'+_0x29264d,'body':{'label':_0x45f8f2,'table':_0x5b57('0x3c'),'id_type':'Incident','table_key':_0xca7dda['ticketId'],'title':'Incident\x20-\x20'+_0xca7dda[_0x5b57('0x44')],'id_display':_0xca7dda[_0x5b57('0x44')]},'auth':_0x1b915e,'json':!![]};return rp(_0x4f7ae2)[_0x5b57('0xe')](function(_0x593bf9){_0x58936b();})[_0x5b57('0x1f')](function(){_0x58936b();});});}function manageTags(_0x24bce9,_0x4873e9,_0x5784bc,_0x59ad97,_0x45a604,_0x5a71f2,_0x406c44){return new Promise(function(_0x444071,_0x24898f){var _0x25cc0b=[];_0x4873e9[_0x5b57('0x2b')](function(_0x4953ac){_0x25cc0b[_0x5b57('0x49')](getRemoteTag(_0x4953ac,_0x5784bc,_0x59ad97,_0x5a71f2,_0x406c44));});return Promise[_0x5b57('0x4a')](_0x25cc0b)[_0x5b57('0xe')](function(_0x18bb08){if(_0x18bb08[_0x5b57('0x10')]){logger['info']('['+[_0x24bce9[_0x5b57('0x15')]()]+_0x5b57('0x4b'),_0x18bb08);var _0x58cb61=[];_0x18bb08[_0x5b57('0x2b')](function(_0x17a465){_0x58cb61[_0x5b57('0x49')](assignTagToIncident(_0x17a465,_0x5784bc,_0x59ad97,_0x45a604,_0x5a71f2));});return Promise['all'](_0x58cb61)[_0x5b57('0xe')](function(){_0x444071();})[_0x5b57('0x1f')](function(){_0x444071();});}else{_0x444071();}});});}function getTags(_0x4a2abb,_0x6ad41c,_0x44467b,_0x6114a1,_0x425539,_0x399f0e){return function(_0x538fe0){return new Promise(function(_0x3b34bc,_0x5ae918){var _0x5cf433=[];var _0x35562e=_0x6114a1['Tags'];if(_0x35562e&&_0x35562e['length']>0x0){_0x5cf433=_[_0x5b57('0x4c')](_0x35562e,_0x5b57('0x39'));}if(_0x5cf433['length']>0x0){return manageTags(_0x4a2abb,_0x5cf433,_0x6ad41c,_0x44467b,_0x538fe0,_0x425539,_0x399f0e)['then'](function(){_0x3b34bc(_0x538fe0);});}else{_0x3b34bc(_0x538fe0);}});};}function emit(_0x1f00ac,_0x4e2db6,_0xde169c){var _0x37c85e='%26sysparm_record_target%3Dincident'+_0x5b57('0x4d')+_0x5b57('0x4e')+_0x5b57('0x4f');var _0x1abae3={'uri':_0x1f00ac+'/nav_to.do?uri=incident.do?sys_id%3D'+_0xde169c+_0x37c85e};io['to'](util[_0x5b57('0x50')](_0x5b57('0x51'),_0x4e2db6))['emit']('trigger:browser:url',_0x1abae3);}exports['cs']=function(_0x465408,_0x25f259,_0x2a267e,_0x10ab39,_0x5b1c1a,_0x51415e,_0xaef3f2,_0x12f491){var _0x49d370={};var _0x5a9de8={'user':_0x51415e[_0x5b57('0x52')],'pass':_0x51415e['password']};var _0x3f6cbc=_0x5b57('0x53');var _0x31c7c3='sysparm_display_value=true';_0x51415e[_0x5b57('0x54')]=intUtil[_0x5b57('0x55')](_0x51415e['remoteUri']);_0x51415e[_0x5b57('0x56')]=intUtil[_0x5b57('0x55')](_0x51415e[_0x5b57('0x56')]);var _0x41a923=util['format'](_0x5b57('0x57'),_0x51415e[_0x5b57('0x54')]);_0x49d370[_0x5b57('0x18')]=!_[_0x5b57('0x58')](_0x10ab39)?_0x10ab39[_0x5b57('0x59')]:null;_0x49d370[_0x5b57('0x21')]=_0x51415e[_0x5b57('0x59')];_0x49d370[_0x5b57('0x24')]=_0x12f491[_0x5b57('0x32')]()==='outbound'?_0x25f259[_0x5b57('0x5a')]:_0x25f259[_0x5b57('0x5b')];_0x49d370[_0x5b57('0x5c')]=_0x12f491==='queue'||_0x12f491===_0x5b57('0x5d')?_0x5b57('0x5e'):'outbound';var _0x392daf=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x51415e[_0x5b57('0x56')],_0x25f259['uniqueid'],md5(_0x25f259[_0x5b57('0x5f')]));if(_0x5b1c1a&&_0x5b1c1a['monitor_format']){logger[_0x5b57('0x13')](_0x5b57('0x60'),'Recording\x20is\x20enabled!');_0x25f259[_0x5b57('0x61')]=_0x392daf;}else if(_0xaef3f2&&_0xaef3f2[_0x5b57('0x62')]&&_0xaef3f2[_0x5b57('0x62')]!=='none'){logger[_0x5b57('0x13')](_0x5b57('0x63'),'Recording\x20is\x20enabled!');_0x25f259['recordingURL']=_0x392daf;}else{_0x25f259[_0x5b57('0x61')]='';}return getAdminUser(_0x12f491,_0x5a9de8,_0x49d370,_0x41a923,_0x31c7c3,_0x3f6cbc)[_0x5b57('0xe')](getUser(_0x12f491,_0x5a9de8,_0x41a923,_0x31c7c3,_0x3f6cbc))[_0x5b57('0xe')](getEndUser(_0x12f491,_0x5a9de8,_0x41a923,_0x31c7c3,_0x3f6cbc))[_0x5b57('0xe')](getTicket(_0x12f491,_0x5a9de8,_0x41a923,_0x2a267e,_0x25f259,_0x31c7c3))[_0x5b57('0xe')](function(_0x4862ad){logger[_0x5b57('0x13')](util['format'](_0x5b57('0x64'),_0x4862ad['ticketId']));logger['info'](util[_0x5b57('0x50')](_0x5b57('0x65'),_0x12f491));if(_0x12f491!=='unmanaged'){logger[_0x5b57('0x13')]('['+[_0x12f491['toUpperCase']()]+']',_0x5b57('0x66'));emit(_0x51415e['remoteUri'],_0x10ab39[_0x5b57('0x39')],_0x4862ad['ticketId']);}})['catch'](function(_0x1a5858){logger[_0x5b57('0x28')]('['+[_0x12f491[_0x5b57('0x15')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x5b57('0x67')](_0x1a5858,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x293a=['error','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','then','],\x20getUser\x20entity','active','true','userId','sys_id','message','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','System','],\x20EndUser\x20schema','catch','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','nameField','customField','content','toString','picklist','type','idField','toLowerCase','variable','variableName','customVariable','Variable','name','outbound','POST','incident','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident','Incident\x20-\x20','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','result','length','adminId','info','toUpperCase','],\x20getAdminUser\x20crm'];(function(_0x44e3b1,_0x12291e){var _0x277485=function(_0x21517f){while(--_0x21517f){_0x44e3b1['push'](_0x44e3b1['shift']());}};_0x277485(++_0x12291e);}(_0x293a,0xc0));var _0xa293=function(_0x449340,_0x2233e1){_0x449340=_0x449340-0x0;var _0x1a188d=_0x293a[_0x449340];return _0x1a188d;};'use strict';var _=require(_0xa293('0x0'));var Promise=require('bluebird');var rp=require(_0xa293('0x1'));var util=require(_0xa293('0x2'));var md5=require(_0xa293('0x3'));var Redis=require(_0xa293('0x4'));var intUtil=require('./util');var config=require(_0xa293('0x5'));var logger=require(_0xa293('0x6'))(_0xa293('0x7'));config[_0xa293('0x8')]=_[_0xa293('0x9')](config[_0xa293('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xa293('0xa'))(new Redis(config[_0xa293('0x8')]));function getAdminUser(_0x59d8ad,_0x208a6d,_0x2bd780,_0x5ad60a,_0x5e4ed7,_0x12a6d7){return new Promise(function(_0x4b3813,_0x22ed59){var _0x3a6778={'method':_0xa293('0xb'),'uri':_0x5ad60a+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x5e4ed7+'&'+_0x12a6d7,'auth':_0x208a6d,'json':!![]};return rp(_0x3a6778)['then'](function(_0x101a9f){if(_0x101a9f[_0xa293('0xc')][_0xa293('0xd')]>0x0){_0x2bd780[_0xa293('0xe')]=_0x101a9f['result'][0x0]['sys_id'];}logger[_0xa293('0xf')]('['+[_0x59d8ad[_0xa293('0x10')]()]+_0xa293('0x11'),_0x2bd780);_0x4b3813(_0x2bd780);})['catch'](function(_0x260601){logger[_0xa293('0x12')]('['+[_0x59d8ad[_0xa293('0x10')]()]+']',_0x260601['message']);_0x22ed59(_0x260601['message']);});});}function getUser(_0x44e81a,_0x47d36a,_0x502a18,_0x279491,_0x29245d){return function(_0x376dab){logger[_0xa293('0xf')]('['+[_0x44e81a['toUpperCase']()]+_0xa293('0x13'),_0x376dab);return new Promise(function(_0x1bb755,_0x172077){if(intUtil[_0xa293('0x14')](_0x376dab[_0xa293('0x15')])){var _0x191594={'method':_0xa293('0xb'),'uri':_0x502a18+_0xa293('0x16')+_0x376dab[_0xa293('0x15')]+'&'+_0x279491+'&'+_0x29245d,'auth':_0x47d36a,'json':!![]};logger['info']('['+[_0x44e81a[_0xa293('0x10')]()]+'],\x20getUser\x20rp\x20obj',_0x191594);return rp(_0x191594)[_0xa293('0x17')](function(_0x2a83f9){logger[_0xa293('0xf')]('['+[_0x44e81a[_0xa293('0x10')]()]+_0xa293('0x18'),_0x2a83f9);if(_0x2a83f9[_0xa293('0xc')][_0xa293('0xd')]>0x0&&String(_0x2a83f9['result'][0x0][_0xa293('0x19')])===_0xa293('0x1a')){_0x376dab[_0xa293('0x1b')]=_0x2a83f9['result'][0x0][_0xa293('0x1c')];}else{_0x376dab[_0xa293('0x1b')]=_0x376dab[_0xa293('0xe')];_0x376dab[_0xa293('0x15')]=_0x376dab['adminEmail'];}logger[_0xa293('0xf')]('['+[_0x44e81a[_0xa293('0x10')]()]+'],\x20getUser\x20crm',_0x376dab);_0x1bb755(_0x376dab);})['catch'](function(_0x20e73c){logger[_0xa293('0x12')]('['+[_0x44e81a[_0xa293('0x10')]()]+']',_0x20e73c['message']);_0x172077(_0x20e73c[_0xa293('0x1d')]);});}else{logger[_0xa293('0xf')]('['+[_0x44e81a[_0xa293('0x10')]()]+']\x20using\x20admin\x20profile');_0x376dab[_0xa293('0x1b')]=_0x376dab['adminId'];_0x376dab[_0xa293('0x15')]=_0x376dab['adminEmail'];_0x1bb755(_0x376dab);}});};}function createEndUser(_0x43623b,_0x25944d,_0x342faa,_0x45dc8f,_0x463141){logger['info']('['+[_0x43623b[_0xa293('0x10')]()]+_0xa293('0x1e'),_0x342faa);return new Promise(function(_0xd6487e,_0x1e9534){var _0x54da8b={'method':'POST','uri':_0x45dc8f+_0xa293('0x1f')+_0x463141,'body':{'user_name':_0x342faa[_0xa293('0x20')],'roles':'user','first_name':_0x342faa[_0xa293('0x20')],'active':_0xa293('0x1a'),'date_format':_0xa293('0x21'),'phone':_0x342faa[_0xa293('0x20')]},'auth':_0x25944d,'json':!![]};return rp(_0x54da8b)['then'](function(_0x56bc78){logger['info']('['+[_0x43623b[_0xa293('0x10')]()]+_0xa293('0x22'),_0x56bc78[_0xa293('0xc')]);_0x342faa['endUserId']=_0x56bc78[_0xa293('0xc')][_0xa293('0x1c')];_0xd6487e(_0x342faa);})[_0xa293('0x23')](function(_0x2f817d){logger[_0xa293('0x12')]('['+[_0x43623b[_0xa293('0x10')]()]+']',_0x2f817d[_0xa293('0x1d')]);_0x1e9534(_0x2f817d[_0xa293('0x1d')]);});});}function getEndUser(_0x1f3152,_0x221693,_0x53f943,_0x2bfe3e,_0x526bd0){return function(_0x12b016){logger[_0xa293('0xf')]('['+[_0x1f3152[_0xa293('0x10')]()]+_0xa293('0x24'),_0x12b016);return new Promise(function(_0x273187,_0x2e3b86){var _0x3fdadb={'method':'GET','uri':_0x53f943+_0xa293('0x25')+_0x12b016[_0xa293('0x20')]+'&'+_0x2bfe3e+'&'+_0x526bd0,'auth':_0x221693,'json':!![]};return rp(_0x3fdadb)[_0xa293('0x17')](function(_0x36ccb5){if(_0x36ccb5[_0xa293('0xc')][_0xa293('0xd')]>0x0){_0x12b016[_0xa293('0x26')]=_0x36ccb5['result'][0x0][_0xa293('0x1c')];logger[_0xa293('0xf')]('['+[_0x1f3152[_0xa293('0x10')]()]+_0xa293('0x27'),_0x12b016);_0x273187(_0x12b016);}else{return createEndUser(_0x1f3152,_0x221693,_0x12b016,_0x53f943,_0x2bfe3e)[_0xa293('0x17')](function(_0x3a8522){logger[_0xa293('0xf')]('['+[_0x1f3152[_0xa293('0x10')]()]+_0xa293('0x28'),_0x3a8522);_0x273187(_0x3a8522);});}})[_0xa293('0x23')](function(_0x3cc2a4){logger[_0xa293('0x12')]('['+[_0x1f3152[_0xa293('0x10')]()]+']',_0x3cc2a4[_0xa293('0x1d')]);_0x2e3b86(_0x3cc2a4[_0xa293('0x1d')]);});});};}function getCustomFields(_0x8bcfcc,_0x3ac9ed){var _0x4c8217={};if(_0x8bcfcc[_0xa293('0xd')]>0x0){_[_0xa293('0x29')](_0x8bcfcc,function(_0x3a42ff){if(_[_0xa293('0x2a')]([_0xa293('0x2b'),'picklist'],_0x3a42ff['type'])&&_0x3a42ff[_0xa293('0x2c')]&&!_0x3a42ff[_0xa293('0x2d')]){_0x4c8217[_0x3a42ff['nameField']['toLowerCase']()]=_0x3a42ff[_0xa293('0x2e')][_0xa293('0x2f')]();}else if(_[_0xa293('0x2a')]([_0xa293('0x2b'),_0xa293('0x30')],_0x3a42ff[_0xa293('0x31')])&&_0x3a42ff[_0xa293('0x32')]&&_0x3a42ff[_0xa293('0x2d')]){_0x4c8217[_0x3a42ff[_0xa293('0x32')][_0xa293('0x33')]()]=_0x3a42ff[_0xa293('0x2e')][_0xa293('0x2f')]();}else if(_0x3a42ff[_0xa293('0x31')]===_0xa293('0x34')&&_0x3a42ff[_0xa293('0x35')]&&_0x3a42ff[_0xa293('0x32')]&&_0x3a42ff[_0xa293('0x2d')]){_0x4c8217[_0x3a42ff[_0xa293('0x32')][_0xa293('0x33')]()]=_0x3ac9ed[_0x3a42ff[_0xa293('0x35')]][_0xa293('0x2f')]();}else if(_0x3a42ff[_0xa293('0x31')]===_0xa293('0x36')&&_0x3a42ff[_0xa293('0x37')]&&_0x3a42ff['Variable'][_0xa293('0x38')]&&_0x3a42ff[_0xa293('0x32')]&&_0x3a42ff[_0xa293('0x2d')]){_0x4c8217[_0x3a42ff['idField'][_0xa293('0x33')]()]=_0x3ac9ed[_0x3a42ff[_0xa293('0x37')][_0xa293('0x38')][_0xa293('0x33')]()][_0xa293('0x2f')]();}});}return _0x4c8217;}function getTicket(_0x16f8b9,_0x522a8b,_0x39677d,_0x224963,_0x1e63fb,_0x180aad){return function(_0x45d521){logger[_0xa293('0xf')]('['+[_0x16f8b9[_0xa293('0x10')]()]+']\x20getTicket\x20input\x20crm',_0x45d521);return new Promise(function(_0x526889,_0xdcb73){var _0x2725e3=_0x16f8b9[_0xa293('0x33')]()===_0xa293('0x39')?_0x45d521['userId']:_0x45d521[_0xa293('0x26')];var _0x23584f={'method':_0xa293('0x3a'),'uri':_0x39677d+_0xa293('0x3b')+'?'+_0x180aad,'body':Object['assign']({},{'active':'true','caller_id':_0x2725e3,'assigned_to':_0x45d521[_0xa293('0x1b')],'short_description':intUtil[_0xa293('0x3c')](_0x224963[_0xa293('0x3d')],_0x1e63fb,'\x20'),'description':intUtil['getString'](_0x224963[_0xa293('0x3e')],_0x1e63fb,'\x0a')},getCustomFields(_0x224963['Fields'],_0x1e63fb)),'auth':_0x522a8b,'json':!![]};return rp(_0x23584f)['then'](function(_0x3920ac){logger[_0xa293('0xf')]('['+[_0x16f8b9['toUpperCase']()]+_0xa293('0x3f'),_0x3920ac[_0xa293('0xc')]);_0x45d521[_0xa293('0x40')]=_0x3920ac[_0xa293('0xc')]['sys_id'];_0x45d521[_0xa293('0x41')]=_0x3920ac[_0xa293('0xc')]['number'];logger[_0xa293('0xf')]('['+[_0x16f8b9['toUpperCase']()]+_0xa293('0x42'),_0x45d521);_0x526889(_0x45d521);})['catch'](function(_0x15e47d){logger[_0xa293('0x12')]('['+[_0x16f8b9[_0xa293('0x10')]()]+']',_0x15e47d['message']);_0xdcb73(_0x15e47d[_0xa293('0x1d')]);});});};}function createRemoteTag(_0x61db0,_0x8981b9,_0x1ae111,_0x4b030e){return new Promise(function(_0x3cf75b,_0x967de2){var _0x5243bd={'method':_0xa293('0x3a'),'uri':_0x1ae111+_0xa293('0x43')+'?'+_0x4b030e,'body':{'short_description':_0x61db0,'global':!![],'active':!![],'name':_0x61db0},'auth':_0x8981b9,'json':!![]};return rp(_0x5243bd)[_0xa293('0x17')](function(_0x53289d){var _0x5332b2=_0x53289d[_0xa293('0xc')]['sys_id'];_0x3cf75b(_0x5332b2);});});}function getRemoteTag(_0x2f6b7b,_0x11e259,_0x222a3d,_0xc96466,_0x34efea){return new Promise(function(_0xb66d0d,_0x3371f7){var _0x2068b0={'method':_0xa293('0xb'),'uri':_0x222a3d+_0xa293('0x43')+_0xa293('0x44')+_0x2f6b7b+'&'+_0xc96466,'auth':_0x11e259,'json':!![]};return rp(_0x2068b0)[_0xa293('0x17')](function(_0x29888c){if(_0x29888c[_0xa293('0xc')]['length']>0x0){var _0x366058=_0x29888c[_0xa293('0xc')][0x0][_0xa293('0x1c')];_0xb66d0d(_0x366058);}else{return createRemoteTag(_0x2f6b7b,_0x11e259,_0x222a3d,_0xc96466)[_0xa293('0x17')](function(_0x3bdbb0){_0xb66d0d(_0x3bdbb0);});}});});}function assignTagToIncident(_0x32db9e,_0x34ccd4,_0x92f0fa,_0x391e99,_0x11c548){return new Promise(function(_0x534b17,_0x2ea4a6){var _0x2c2f3e={'method':_0xa293('0x3a'),'uri':_0x92f0fa+'label_entry'+'?'+_0x11c548,'body':{'label':_0x32db9e,'table':_0xa293('0x3b'),'id_type':_0xa293('0x45'),'table_key':_0x391e99[_0xa293('0x40')],'title':_0xa293('0x46')+_0x391e99['ticketNumber'],'id_display':_0x391e99[_0xa293('0x41')]},'auth':_0x34ccd4,'json':!![]};return rp(_0x2c2f3e)[_0xa293('0x17')](function(_0x3676ce){_0x534b17();})[_0xa293('0x23')](function(){_0x534b17();});});}function manageTags(_0x308603,_0x59b500,_0xef5ee2,_0x1c9f7e,_0x37462b,_0x6b1dd1,_0x26ed0f){return new Promise(function(_0x389fa3,_0x589792){var _0x3171fa=[];_0x59b500[_0xa293('0x29')](function(_0x25df37){_0x3171fa[_0xa293('0x47')](getRemoteTag(_0x25df37,_0xef5ee2,_0x1c9f7e,_0x6b1dd1,_0x26ed0f));});return Promise[_0xa293('0x48')](_0x3171fa)['then'](function(_0x5b2d5b){if(_0x5b2d5b['length']){logger['info']('['+[_0x308603[_0xa293('0x10')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x5b2d5b);var _0x5cf481=[];_0x5b2d5b[_0xa293('0x29')](function(_0x45e307){_0x5cf481[_0xa293('0x47')](assignTagToIncident(_0x45e307,_0xef5ee2,_0x1c9f7e,_0x37462b,_0x6b1dd1));});return Promise[_0xa293('0x48')](_0x5cf481)[_0xa293('0x17')](function(){_0x389fa3();})[_0xa293('0x23')](function(){_0x389fa3();});}else{_0x389fa3();}});});}function getTags(_0x1fc820,_0x272949,_0x56a428,_0xf2652,_0x39dc27,_0x4700df){return function(_0x434da7){return new Promise(function(_0x597cb8,_0x4e090e){var _0x26079d=[];var _0x156398=_0xf2652[_0xa293('0x49')];if(_0x156398&&_0x156398[_0xa293('0xd')]>0x0){_0x26079d=_[_0xa293('0x4a')](_0x156398,_0xa293('0x38'));}if(_0x26079d[_0xa293('0xd')]>0x0){return manageTags(_0x1fc820,_0x26079d,_0x272949,_0x56a428,_0x434da7,_0x39dc27,_0x4700df)[_0xa293('0x17')](function(){_0x597cb8(_0x434da7);});}else{_0x597cb8(_0x434da7);}});};}function emit(_0x1600ac,_0x5dba03,_0x514c67){var _0x567413=_0xa293('0x4b')+_0xa293('0x4c')+_0xa293('0x4d')+_0xa293('0x4e');var _0x18a0f1={'uri':_0x1600ac+_0xa293('0x4f')+_0x514c67+_0x567413};io['to'](util[_0xa293('0x50')]('user:%s',_0x5dba03))[_0xa293('0x51')](_0xa293('0x52'),_0x18a0f1);}exports['cs']=function(_0x2b6a11,_0x570ad4,_0x4d2820,_0xfa9d1c,_0x4edd5b,_0x58efde,_0x53adfd,_0x1c0e36){var _0x158c1b={};var _0x147a02={'user':_0x58efde['username'],'pass':_0x58efde['password']};var _0x9d74fc='sysparm_limit=1';var _0x5a0774=_0xa293('0x53');_0x58efde[_0xa293('0x54')]=intUtil[_0xa293('0x55')](_0x58efde[_0xa293('0x54')]);_0x58efde[_0xa293('0x56')]=intUtil[_0xa293('0x55')](_0x58efde['serverUrl']);var _0x330de0=util['format'](_0xa293('0x57'),_0x58efde[_0xa293('0x54')]);_0x158c1b[_0xa293('0x15')]=!_[_0xa293('0x58')](_0xfa9d1c)?_0xfa9d1c[_0xa293('0x59')]:null;_0x158c1b['adminEmail']=_0x58efde['email'];_0x158c1b[_0xa293('0x20')]=_0x1c0e36[_0xa293('0x33')]()===_0xa293('0x39')?_0x570ad4[_0xa293('0x5a')]:_0x570ad4[_0xa293('0x5b')];_0x158c1b[_0xa293('0x5c')]=_0x1c0e36==='queue'||_0x1c0e36==='unmanaged'?_0xa293('0x5d'):_0xa293('0x39');var _0x382d03=util['format'](_0xa293('0x5e'),_0x58efde['serverUrl'],_0x570ad4[_0xa293('0x5f')],md5(_0x570ad4[_0xa293('0x5f')]));if(_0x4edd5b&&_0x4edd5b[_0xa293('0x60')]){logger[_0xa293('0xf')]('[QUEUE]','Recording\x20is\x20enabled!');_0x570ad4[_0xa293('0x61')]=_0x382d03;}else if(_0x53adfd&&_0x53adfd[_0xa293('0x62')]&&_0x53adfd[_0xa293('0x62')]!==_0xa293('0x63')){logger[_0xa293('0xf')]('[OUTBOUND]',_0xa293('0x64'));_0x570ad4['recordingURL']=_0x382d03;}else{_0x570ad4[_0xa293('0x61')]='';}return getAdminUser(_0x1c0e36,_0x147a02,_0x158c1b,_0x330de0,_0x5a0774,_0x9d74fc)['then'](getUser(_0x1c0e36,_0x147a02,_0x330de0,_0x5a0774,_0x9d74fc))[_0xa293('0x17')](getEndUser(_0x1c0e36,_0x147a02,_0x330de0,_0x5a0774,_0x9d74fc))[_0xa293('0x17')](getTicket(_0x1c0e36,_0x147a02,_0x330de0,_0x4d2820,_0x570ad4,_0x5a0774))[_0xa293('0x17')](function(_0x4a59a4){logger['info'](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x4a59a4[_0xa293('0x40')]));logger['info'](util[_0xa293('0x50')](_0xa293('0x65'),_0x1c0e36));if(_0x1c0e36!==_0xa293('0x66')){logger['info']('['+[_0x1c0e36[_0xa293('0x10')]()]+']',_0xa293('0x67'));emit(_0x58efde['remoteUri'],_0xfa9d1c[_0xa293('0x38')],_0x4a59a4[_0xa293('0x40')]);}})[_0xa293('0x23')](function(_0x17227e){logger[_0xa293('0x12')]('['+[_0x1c0e36[_0xa293('0x10')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0xa293('0x68')](_0x17227e,{'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 3db67df..3af5a21 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 _0x1d45=['push','idField','variableName','set_entry','JSON','stringify','format','Basic\x20%s','toString','base64','isNil','info','Getting\x20agent\x20with\x20name','get_entry_list','then','entry_list','length','find','name_value_list','user_name','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Enduser\x20created.','debug','[HTTP]','merge','type','nameField','customField','content','custom_fields','variable','customVariable','Variable','toLowerCase','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Ticket\x20ID\x20is:','unmanaged','lastevent','toUpperCase','lodash','bluebird','md5','util','ioredis','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','emit','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','date_start','toISOString','slice','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','forEach'];(function(_0x94ca6e,_0x398cde){var _0x1fafa8=function(_0x39cab5){while(--_0x39cab5){_0x94ca6e['push'](_0x94ca6e['shift']());}};_0x1fafa8(++_0x398cde);}(_0x1d45,0x144));var _0x51d4=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0x1d45[_0x485b5a];return _0xd2b34d;};'use strict';var _=require(_0x51d4('0x0'));var rp=require('request-promise');var BPromise=require(_0x51d4('0x1'));var md5=require(_0x51d4('0x2'));var util=require(_0x51d4('0x3'));var Redis=require(_0x51d4('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x51d4('0x5'))(_0x51d4('0x6'));config[_0x51d4('0x7')]=_[_0x51d4('0x8')](config['redis'],{'host':_0x51d4('0x9'),'port':0x18eb});var io=require(_0x51d4('0xa'))(new Redis(config[_0x51d4('0x7')]));var def={'method':'POST','json':!![]};function emit(_0x5959e4,_0x577ba3,_0x3caa08){io['to'](_0x5959e4)[_0x51d4('0xb')](_0x577ba3,_0x3caa08);}function getTicket(_0x435683,_0x5377ba,_0x101fe4,_0xd99df7,_0x57c0cf,_0x456db4,_0x447aff,_0x419bb8){logger['info'](_0x51d4('0xc'));var _0x5a193a=new Date();var _0x25fcbe=[{'name':_0x51d4('0xd'),'value':intUtil[_0x51d4('0xe')](_0xd99df7[_0x51d4('0xf')],_0x57c0cf,'\x20')},{'name':_0x51d4('0x10'),'value':_0x5377ba['id']},{'name':_0x51d4('0x11'),'value':_0x5377ba['id']},{'name':_0x51d4('0x12'),'value':intUtil[_0x51d4('0xe')](_0xd99df7['Descriptions'],_0x57c0cf,'\x0a')},{'name':_0x51d4('0x13'),'value':_0x5a193a[_0x51d4('0x14')]()[_0x51d4('0x15')](0x0,0x13)['replace']('T','\x20')},{'name':_0x51d4('0x16'),'value':'0'},{'name':_0x51d4('0x17'),'value':'15'},{'name':_0x51d4('0x18'),'value':_0x101fe4['id']},{'name':_0x51d4('0x19'),'value':_0x51d4('0x1a')},{'name':_0x51d4('0x1b'),'value':_0x101fe4[_0x51d4('0xd')]},{'name':_0x51d4('0x1c'),'value':_0x419bb8}];if(_0x456db4['length']){_[_0x51d4('0x1d')](_0x456db4,function(_0x418b74){if(_0x57c0cf[_0x418b74['variableName']]){_0x25fcbe[_0x51d4('0x1e')]({'name':_0x418b74[_0x51d4('0x1f')],'value':_0x57c0cf[_0x418b74[_0x51d4('0x20')]]});}});}return request({'form':{'method':_0x51d4('0x21'),'input_type':_0x51d4('0x22'),'response_type':'JSON','rest_data':JSON[_0x51d4('0x23')]({'session':_0x447aff['id'],'module_name':'Calls','name_value_list':_0x25fcbe})}});}function getAuth(_0xfd747c){return util[_0x51d4('0x24')](_0x51d4('0x25'),new Buffer(_0xfd747c['apiKey']+':X')[_0x51d4('0x26')](_0x51d4('0x27')));}function getServerInfo(_0x3706cd){return request({'form':{'method':'get_server_info','input_type':_0x51d4('0x22'),'response_type':_0x51d4('0x22'),'rest_data':JSON[_0x51d4('0x23')]({'session':_0x3706cd['id']})}});}function getUser(_0x5a3fdd,_0xb54fac,_0x527e27){if(!_[_0x51d4('0x28')](_0xb54fac)){logger[_0x51d4('0x29')](_0x51d4('0x2a'),_0xb54fac);return request({'form':{'method':_0x51d4('0x2b'),'input_type':_0x51d4('0x22'),'response_type':_0x51d4('0x22'),'rest_data':JSON[_0x51d4('0x23')]({'session':_0x527e27['id'],'module_name':'Employees','query':util[_0x51d4('0x24')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0xb54fac),'order_by':'','offset':'0','select_fields':['id',_0x51d4('0xd'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x51d4('0x2c')](function(_0x4a3f25){if(_0x4a3f25[_0x51d4('0x2d')][_0x51d4('0x2e')]){var _0x2efb85=_[_0x51d4('0x2f')](_0x4a3f25['entry_list'],function(_0x5bf5d6){return _0x5bf5d6[_0x51d4('0x30')][_0x51d4('0x31')][_0x51d4('0x32')]===_0xb54fac;});if(_0x2efb85){logger['info'](_0x51d4('0x33'));return BPromise['resolve']({'id':_0x2efb85[_0x51d4('0x30')]['id'][_0x51d4('0x32')],'name':_0x2efb85[_0x51d4('0x30')][_0x51d4('0xd')]['value']});}}logger[_0x51d4('0x29')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x51d4('0x34')]({'id':_0x527e27[_0x51d4('0x30')][_0x51d4('0x35')]['value'],'name':_0x527e27[_0x51d4('0x30')]['user_name']['value']});});}else{logger[_0x51d4('0x29')](_0x51d4('0x36'));return BPromise[_0x51d4('0x34')]({'id':_0x527e27[_0x51d4('0x30')]['user_id'][_0x51d4('0x32')],'name':_0x527e27[_0x51d4('0x30')]['user_name'][_0x51d4('0x32')]});}}function getEndUser(_0x5694a5,_0x176938,_0x1f0c1e,_0x3655f5){logger[_0x51d4('0x29')](_0x51d4('0x37'),_0x1f0c1e);return request({'form':{'method':_0x51d4('0x2b'),'input_type':_0x51d4('0x22'),'response_type':'JSON','rest_data':JSON[_0x51d4('0x23')]({'session':_0x3655f5['id'],'module_name':_0x51d4('0x1a'),'query':util[_0x51d4('0x24')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x1f0c1e),'order_by':'','offset':'0','select_fields':['id',_0x51d4('0xd'),_0x51d4('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x51d4('0x2c')](function(_0x2b21df){if(_0x2b21df[_0x51d4('0x2d')][_0x51d4('0x2e')]){var _0x2820fd=_[_0x51d4('0x2f')](_0x2b21df['entry_list'],function(_0x205a73){return _0x205a73['name_value_list']['phone_home'][_0x51d4('0x32')]===_0x1f0c1e;});if(_0x2820fd){logger[_0x51d4('0x29')](_0x51d4('0x39'));return BPromise[_0x51d4('0x34')]({'id':_0x2820fd[_0x51d4('0x30')]['id'][_0x51d4('0x32')],'name':_0x2820fd[_0x51d4('0x30')][_0x51d4('0xd')][_0x51d4('0x32')],'phone':_0x2820fd[_0x51d4('0x30')][_0x51d4('0x38')]['value']});}}else{logger[_0x51d4('0x29')](_0x51d4('0x3a'));return request({'form':{'method':'set_entry','input_type':_0x51d4('0x22'),'response_type':'JSON','rest_data':JSON[_0x51d4('0x23')]({'session':_0x3655f5['id'],'module_name':_0x51d4('0x1a'),'name_value_list':[{'name':_0x51d4('0x3b'),'value':_0x176938!==''?_0x176938:util[_0x51d4('0x24')]('Caller\x20-\x20%s',_0x1f0c1e)},{'name':_0x51d4('0x38'),'value':_0x1f0c1e}]})}})[_0x51d4('0x2c')](function(_0x40d720){logger[_0x51d4('0x29')](_0x51d4('0x3c'));return BPromise[_0x51d4('0x34')]({'id':_0x40d720['id'],'name':_0x40d720[_0x51d4('0x2d')][_0x51d4('0x3b')]['value'],'phone':_0x40d720[_0x51d4('0x2d')][_0x51d4('0x38')][_0x51d4('0x32')]});});}});}function request(_0x3e3b0e){logger[_0x51d4('0x3d')](_0x51d4('0x3e'),JSON[_0x51d4('0x23')](_0x3e3b0e));return rp(_[_0x51d4('0x3f')](def,_0x3e3b0e));}function getTags(_0x395f3b,_0x2ae99d){var _0x1d6104=[];if(_0x395f3b&&_0x395f3b[_0x51d4('0x2e')]>0x0){_0x1d6104=_['map'](_0x395f3b,_0x2ae99d);}return _0x1d6104;}function getCustomFields(_0x12737f,_0x78e17f){var _0x228176=[];var _0x29f309={'custom_fields':[]};if(_0x12737f[_0x51d4('0x2e')]>0x0){_[_0x51d4('0x1d')](_0x12737f,function(_0x2fd51d){if(_0x2fd51d[_0x51d4('0x40')]==='string'&&_0x2fd51d[_0x51d4('0x41')]&&!_0x2fd51d[_0x51d4('0x42')]){_0x29f309[_0x2fd51d[_0x51d4('0x41')]['toLowerCase']()]=_0x2fd51d[_0x51d4('0x43')][_0x51d4('0x26')]();}else if(_0x2fd51d[_0x51d4('0x40')]==='string'&&_0x2fd51d['idField']&&_0x2fd51d[_0x51d4('0x42')]){_0x29f309[_0x51d4('0x44')]['push']({'id':_0x2fd51d[_0x51d4('0x1f')],'value':_0x2fd51d[_0x51d4('0x43')][_0x51d4('0x26')]()});}else if(_0x2fd51d[_0x51d4('0x40')]===_0x51d4('0x45')&&_0x2fd51d[_0x51d4('0x20')]&&_0x2fd51d[_0x51d4('0x1f')]&&_0x2fd51d[_0x51d4('0x42')]){_0x78e17f[_0x2fd51d[_0x51d4('0x20')]]&&_0x29f309[_0x51d4('0x44')][_0x51d4('0x1e')]({'id':_0x2fd51d[_0x51d4('0x1f')],'value':_0x78e17f[_0x2fd51d['variableName']][_0x51d4('0x26')]()});}else if(_0x2fd51d[_0x51d4('0x40')]===_0x51d4('0x46')&&_0x2fd51d[_0x51d4('0x47')]&&_0x2fd51d[_0x51d4('0x47')]['name']&&_0x2fd51d[_0x51d4('0x1f')]&&_0x2fd51d[_0x51d4('0x42')]){_0x78e17f[_0x2fd51d['Variable'][_0x51d4('0xd')][_0x51d4('0x48')]()]&&_0x29f309[_0x51d4('0x44')][_0x51d4('0x1e')]({'id':_0x2fd51d[_0x51d4('0x1f')],'value':_0x78e17f[_0x2fd51d[_0x51d4('0x47')][_0x51d4('0xd')][_0x51d4('0x48')]()][_0x51d4('0x26')]()});}});}return _0x29f309;}function getConnection(_0x3a0dc7){return request({'method':'POST','form':{'method':'login','input_type':_0x51d4('0x22'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x3a0dc7['username'],'password':_0x3a0dc7[_0x51d4('0x49')],'encryption':_0x51d4('0x4a')},'application':_0x51d4('0x4b')})}})[_0x51d4('0x2c')](function(_0x3048c3){var _0x4c8ee6=_0x3048c3;if(_0x4c8ee6['id']){def[_0x51d4('0x4c')]=_0x4c8ee6['id'];return BPromise[_0x51d4('0x34')](_0x4c8ee6);}else{throw new Error(util['format'](_0x51d4('0x4d'),_0x3a0dc7['id']));}});}function setRelationship(_0x283170,_0x173106,_0x4a0258,_0x5f23db){return request({'form':{'method':_0x51d4('0x4e'),'input_type':_0x51d4('0x22'),'response_type':_0x51d4('0x22'),'rest_data':JSON[_0x51d4('0x23')]({'session':_0x283170['id'],'module_name':_0x51d4('0x4f'),'module_id':_0x4a0258['id'],'link_field_name':_0x5f23db,'related_ids':[_0x173106['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x51d4('0x50')]=function(_0x4554ca,_0x2090ed,_0x2a0f65,_0x2ac171,_0x223733,_0x55b065){var _0x452269,_0x22d4c7,_0x772c8f,_0x3e3e49;_0x55b065[_0x51d4('0x51')]=intUtil[_0x51d4('0x52')](_0x55b065[_0x51d4('0x51')]);_0x55b065[_0x51d4('0x53')]=intUtil[_0x51d4('0x52')](_0x55b065[_0x51d4('0x53')]);def[_0x51d4('0x54')]=util[_0x51d4('0x24')](_0x51d4('0x55'),_0x55b065['remoteUri']);if(_0x223733&&_0x223733[_0x51d4('0x56')]){logger['info']('[QUEUE]',_0x51d4('0x57'));_0x2090ed[_0x51d4('0x58')]=util['format'](_0x51d4('0x59'),_0x55b065[_0x51d4('0x53')],_0x2090ed[_0x51d4('0x5a')],md5(_0x2090ed[_0x51d4('0x5a')]));}else{_0x2090ed['recordingURL']='';}return getConnection(_0x55b065)[_0x51d4('0x2c')](function(_0x424fab){_0x3e3e49=_0x424fab;return getUser(_0x55b065,_0x2ac171['name'],_0x3e3e49);})[_0x51d4('0x2c')](function(_0x4cf9c4){_0x452269=_0x4cf9c4;logger['info'](_0x51d4('0x5b'),_0x452269['id']);return getEndUser(_0x55b065,_0x2090ed[_0x51d4('0x5c')],_0x2090ed[_0x51d4('0x5d')],_0x3e3e49);})[_0x51d4('0x2c')](function(_0x21f327){_0x22d4c7=_0x21f327;logger['info'](_0x51d4('0x5e'),_0x22d4c7['id']);return getTicket(_0x55b065,_0x452269,_0x22d4c7,_0x2a0f65,_0x2090ed,_0x2a0f65[_0x51d4('0x5f')],_0x3e3e49,_0x51d4('0x60'));})[_0x51d4('0x2c')](function(_0x14d54d){_0x772c8f=_0x14d54d;logger[_0x51d4('0x29')](_0x51d4('0x61'));logger[_0x51d4('0x29')]('The\x20Ticket\x20ID\x20is:',_0x772c8f['id']);return setRelationship(_0x3e3e49,_0x452269,_0x772c8f,_0x51d4('0x62'));})['then'](function(){return setRelationship(_0x3e3e49,_0x22d4c7,_0x772c8f,_0x51d4('0x63'));})[_0x51d4('0x2c')](function(){return getServerInfo(_0x3e3e49);})[_0x51d4('0x2c')](function(_0x106523){var _0x2fc1d0=parseInt(_0x106523[_0x51d4('0x64')][_0x51d4('0x65')](0x0));var _0x571ae6=util[_0x51d4('0x24')](_0x51d4('0x66'),_0x55b065['remoteUri'],_0x772c8f['id']);if(_0x2fc1d0>0x6){_0x571ae6=util[_0x51d4('0x24')](_0x51d4('0x67'),_0x55b065[_0x51d4('0x51')],_0x772c8f['id']);}logger[_0x51d4('0x29')](_0x51d4('0x68'),_0x51d4('0x69'));emit(util['format']('user:%s',_0x2ac171[_0x51d4('0xd')]),_0x51d4('0x6a'),{'uri':_0x571ae6});})[_0x51d4('0x6b')](function(_0x41db9a){logger[_0x51d4('0x6c')](_0x51d4('0x68'),JSON[_0x51d4('0x23')](_0x41db9a));});};exports[_0x51d4('0x6d')]=function(_0x27f783,_0x5713ed,_0x349eab,_0x141062,_0x3d9661,_0x1bc06e,_0x3467c9){var _0x27fc2f,_0x3e6edd,_0x448e2a,_0xc0066a;_0x1bc06e['remoteUri']=intUtil['stripTrailingSlash'](_0x1bc06e[_0x51d4('0x51')]);_0x1bc06e['serverUrl']=intUtil[_0x51d4('0x52')](_0x1bc06e['serverUrl']);def['uri']=util[_0x51d4('0x24')](_0x51d4('0x55'),_0x1bc06e[_0x51d4('0x51')]);if(_0x3467c9&&_0x3467c9['recordingFormat']&&_0x3467c9[_0x51d4('0x6e')]!==_0x51d4('0x6f')){logger['info'](_0x51d4('0x70'),_0x51d4('0x57'));_0x5713ed['recordingURL']=util[_0x51d4('0x24')](_0x51d4('0x59'),_0x1bc06e[_0x51d4('0x53')],_0x5713ed[_0x51d4('0x5a')],md5(_0x5713ed[_0x51d4('0x5a')]));}return getConnection(_0x1bc06e)[_0x51d4('0x2c')](function(_0x4ce89d){_0xc0066a=_0x4ce89d;return getUser(_0x1bc06e,_0x141062[_0x51d4('0xd')],_0xc0066a);})['then'](function(_0x21d155){_0x27fc2f=_0x21d155;logger[_0x51d4('0x29')](_0x51d4('0x5b'),_0x27fc2f['id']);return getEndUser(_0x1bc06e,_0x5713ed[_0x51d4('0x71')],_0x5713ed['destcalleridnum'],_0xc0066a);})[_0x51d4('0x2c')](function(_0x1c03c0){_0x3e6edd=_0x1c03c0;logger[_0x51d4('0x29')](_0x51d4('0x5e'),_0x3e6edd['id']);return getTicket(_0x1bc06e,_0x27fc2f,_0x3e6edd,_0x349eab,_0x5713ed,_0x349eab[_0x51d4('0x5f')],_0xc0066a,'Outbound');})['then'](function(_0x9de31d){_0x448e2a=_0x9de31d;logger[_0x51d4('0x29')]('Ticket\x20created!');logger[_0x51d4('0x29')](_0x51d4('0x72'),_0x448e2a['id']);return setRelationship(_0xc0066a,_0x27fc2f,_0x448e2a,_0x51d4('0x62'));})[_0x51d4('0x2c')](function(){return setRelationship(_0xc0066a,_0x3e6edd,_0x448e2a,_0x51d4('0x63'));})[_0x51d4('0x2c')](function(){return getServerInfo(_0xc0066a);})[_0x51d4('0x2c')](function(_0x40deeb){var _0x307040=parseInt(_0x40deeb[_0x51d4('0x64')]['charAt'](0x0));var _0x527485=util['format'](_0x51d4('0x66'),_0x1bc06e[_0x51d4('0x51')],_0x448e2a['id']);if(_0x307040>0x6){_0x527485=util[_0x51d4('0x24')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x1bc06e[_0x51d4('0x51')],_0x448e2a['id']);}logger['info'](_0x51d4('0x70'),_0x51d4('0x69'));emit(util[_0x51d4('0x24')]('user:%s',_0x141062[_0x51d4('0xd')]),'trigger:browser:url',{'uri':_0x527485});})[_0x51d4('0x6b')](function(_0x2d3ed1){logger[_0x51d4('0x6c')](_0x51d4('0x70'),JSON[_0x51d4('0x23')](_0x2d3ed1));});};exports[_0x51d4('0x73')]=function(_0x4c4bd1,_0x27022c,_0x2a6f35,_0x169e6c,_0x18cb4f,_0xdcc2bb){var _0x1565da,_0x565e02,_0x23e1a4,_0x413c18;_0xdcc2bb[_0x51d4('0x51')]=intUtil['stripTrailingSlash'](_0xdcc2bb[_0x51d4('0x51')]);_0xdcc2bb[_0x51d4('0x53')]=intUtil[_0x51d4('0x52')](_0xdcc2bb['serverUrl']);def[_0x51d4('0x54')]=util[_0x51d4('0x24')]('%s/service/v4_1/rest.php',_0xdcc2bb[_0x51d4('0x51')]);if(_0x18cb4f&&_0x18cb4f[_0x51d4('0x56')]){logger['info']('['+_0x27022c[_0x51d4('0x74')][_0x51d4('0x75')]()+']',_0x51d4('0x57'));_0x27022c[_0x51d4('0x58')]=util[_0x51d4('0x24')](_0x51d4('0x59'),_0xdcc2bb['serverUrl'],_0x27022c[_0x51d4('0x5a')],md5(_0x27022c[_0x51d4('0x5a')]));}else{_0x27022c[_0x51d4('0x58')]='';}return getConnection(_0xdcc2bb)[_0x51d4('0x2c')](function(_0x5dcc44){_0x413c18=_0x5dcc44;if(!_[_0x51d4('0x28')](_0x169e6c)){return getUser(_0xdcc2bb,_0x169e6c['name'],_0x413c18);}else{return getUser(_0xdcc2bb,null,_0x413c18);}})['then'](function(_0x486a51){_0x1565da=_0x486a51;logger[_0x51d4('0x29')](_0x51d4('0x5b'),_0x1565da['id']);return getEndUser(_0xdcc2bb,_0x27022c[_0x51d4('0x5c')],_0x27022c['calleridnum'],_0x413c18);})[_0x51d4('0x2c')](function(_0x337e0f){_0x565e02=_0x337e0f;logger[_0x51d4('0x29')](_0x51d4('0x5e'),_0x565e02['id']);return getTicket(_0xdcc2bb,_0x1565da,_0x565e02,_0x2a6f35,_0x27022c,_0x2a6f35[_0x51d4('0x5f')],_0x413c18,'Inbound');})[_0x51d4('0x2c')](function(_0x47f1a9){_0x23e1a4=_0x47f1a9;logger[_0x51d4('0x29')]('Ticket\x20created!');logger[_0x51d4('0x29')](_0x51d4('0x72'),_0x23e1a4['id']);return setRelationship(_0x413c18,_0x1565da,_0x23e1a4,'users');})[_0x51d4('0x2c')](function(){return setRelationship(_0x413c18,_0x565e02,_0x23e1a4,_0x51d4('0x63'));})[_0x51d4('0x2c')](function(){return getServerInfo(_0x413c18);})[_0x51d4('0x6b')](function(_0x186a31){logger['error']('['+_0x27022c[_0x51d4('0x74')]['toUpperCase']()+']',JSON[_0x51d4('0x23')](_0x186a31));});}; \ No newline at end of file +var _0xab65=['Subjects','assigned_user_id','created_by','description','Descriptions','slice','replace','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','variableName','push','idField','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','base64','get_server_info','isNil','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','length','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','user_name','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','forEach','type','string','nameField','customField','toLowerCase','toString','content','variable','custom_fields','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','Calls','queue','remoteUri','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','uniqueid','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','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...','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Outbound','contacts','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','trigger:browser:url','catch','unmanaged','lastevent','toUpperCase','The\x20User\x20ID\x20is:','request-promise','md5','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','name','getString'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xab65,0xea));var _0x5ab6=function(_0x5452b9,_0x3e1158){_0x5452b9=_0x5452b9-0x0;var _0x218041=_0xab65[_0x5452b9];return _0x218041;};'use strict';var _=require('lodash');var rp=require(_0x5ab6('0x0'));var BPromise=require('bluebird');var md5=require(_0x5ab6('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x5ab6('0x2'));var config=require(_0x5ab6('0x3'));var logger=require(_0x5ab6('0x4'))(_0x5ab6('0x5'));config[_0x5ab6('0x6')]=_[_0x5ab6('0x7')](config[_0x5ab6('0x6')],{'host':_0x5ab6('0x8'),'port':0x18eb});var io=require(_0x5ab6('0x9'))(new Redis(config[_0x5ab6('0x6')]));var def={'method':_0x5ab6('0xa'),'json':!![]};function emit(_0x1639c5,_0x1dbebb,_0x274e65){io['to'](_0x1639c5)[_0x5ab6('0xb')](_0x1dbebb,_0x274e65);}function getTicket(_0x156ded,_0x4c08b3,_0x4a5a1f,_0x5815e7,_0x156bd3,_0x54a97a,_0x4ccbeb,_0xf5b936){logger['info']('Creating\x20new\x20ticket...');var _0x1536d4=new Date();var _0x5bc528=[{'name':_0x5ab6('0xc'),'value':intUtil[_0x5ab6('0xd')](_0x5815e7[_0x5ab6('0xe')],_0x156bd3,'\x20')},{'name':_0x5ab6('0xf'),'value':_0x4c08b3['id']},{'name':_0x5ab6('0x10'),'value':_0x4c08b3['id']},{'name':_0x5ab6('0x11'),'value':intUtil['getString'](_0x5815e7[_0x5ab6('0x12')],_0x156bd3,'\x0a')},{'name':'date_start','value':_0x1536d4['toISOString']()[_0x5ab6('0x13')](0x0,0x13)[_0x5ab6('0x14')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x5ab6('0x15'),'value':'15'},{'name':_0x5ab6('0x16'),'value':_0x4a5a1f['id']},{'name':_0x5ab6('0x17'),'value':_0x5ab6('0x18')},{'name':_0x5ab6('0x19'),'value':_0x4a5a1f[_0x5ab6('0xc')]},{'name':_0x5ab6('0x1a'),'value':_0xf5b936}];if(_0x54a97a['length']){_['forEach'](_0x54a97a,function(_0x3c2f6d){if(_0x156bd3[_0x3c2f6d[_0x5ab6('0x1b')]]){_0x5bc528[_0x5ab6('0x1c')]({'name':_0x3c2f6d[_0x5ab6('0x1d')],'value':_0x156bd3[_0x3c2f6d[_0x5ab6('0x1b')]]});}});}return request({'form':{'method':_0x5ab6('0x1e'),'input_type':_0x5ab6('0x1f'),'response_type':'JSON','rest_data':JSON[_0x5ab6('0x20')]({'session':_0x4ccbeb['id'],'module_name':'Calls','name_value_list':_0x5bc528})}});}function getAuth(_0x223a71){return util[_0x5ab6('0x21')](_0x5ab6('0x22'),new Buffer(_0x223a71[_0x5ab6('0x23')]+':X')['toString'](_0x5ab6('0x24')));}function getServerInfo(_0x40e7af){return request({'form':{'method':_0x5ab6('0x25'),'input_type':'JSON','response_type':_0x5ab6('0x1f'),'rest_data':JSON[_0x5ab6('0x20')]({'session':_0x40e7af['id']})}});}function getUser(_0x1ab4d3,_0x20b359,_0x2f9483){if(!_[_0x5ab6('0x26')](_0x20b359)){logger[_0x5ab6('0x27')](_0x5ab6('0x28'),_0x20b359);return request({'form':{'method':_0x5ab6('0x29'),'input_type':_0x5ab6('0x1f'),'response_type':_0x5ab6('0x1f'),'rest_data':JSON[_0x5ab6('0x20')]({'session':_0x2f9483['id'],'module_name':_0x5ab6('0x2a'),'query':util[_0x5ab6('0x21')](_0x5ab6('0x2b'),_0x20b359),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5ab6('0x2c')](function(_0x51a146){if(_0x51a146[_0x5ab6('0x2d')][_0x5ab6('0x2e')]){var _0x47d0ee=_['find'](_0x51a146[_0x5ab6('0x2d')],function(_0xd6ef4e){return _0xd6ef4e[_0x5ab6('0x2f')]['user_name'][_0x5ab6('0x30')]===_0x20b359;});if(_0x47d0ee){logger[_0x5ab6('0x27')](_0x5ab6('0x31'));return BPromise[_0x5ab6('0x32')]({'id':_0x47d0ee[_0x5ab6('0x2f')]['id'][_0x5ab6('0x30')],'name':_0x47d0ee[_0x5ab6('0x2f')]['name'][_0x5ab6('0x30')]});}}logger[_0x5ab6('0x27')](_0x5ab6('0x33'));return BPromise[_0x5ab6('0x32')]({'id':_0x2f9483[_0x5ab6('0x2f')][_0x5ab6('0x34')][_0x5ab6('0x30')],'name':_0x2f9483['name_value_list'][_0x5ab6('0x35')][_0x5ab6('0x30')]});});}else{logger['info']('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x5ab6('0x32')]({'id':_0x2f9483[_0x5ab6('0x2f')][_0x5ab6('0x34')][_0x5ab6('0x30')],'name':_0x2f9483[_0x5ab6('0x2f')][_0x5ab6('0x35')]['value']});}}function getEndUser(_0x3ee83e,_0x484ada,_0x49f6f6,_0x1c6ac3){logger[_0x5ab6('0x27')]('Searching\x20enduser\x20with\x20phone',_0x49f6f6);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x5ab6('0x1f'),'rest_data':JSON[_0x5ab6('0x20')]({'session':_0x1c6ac3['id'],'module_name':_0x5ab6('0x18'),'query':util[_0x5ab6('0x21')](_0x5ab6('0x36'),_0x49f6f6),'order_by':'','offset':'0','select_fields':['id',_0x5ab6('0xc'),_0x5ab6('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x5ade12){if(_0x5ade12['entry_list'][_0x5ab6('0x2e')]){var _0x2479c3=_[_0x5ab6('0x38')](_0x5ade12[_0x5ab6('0x2d')],function(_0x437c33){return _0x437c33[_0x5ab6('0x2f')][_0x5ab6('0x37')][_0x5ab6('0x30')]===_0x49f6f6;});if(_0x2479c3){logger[_0x5ab6('0x27')](_0x5ab6('0x39'));return BPromise[_0x5ab6('0x32')]({'id':_0x2479c3[_0x5ab6('0x2f')]['id'][_0x5ab6('0x30')],'name':_0x2479c3[_0x5ab6('0x2f')][_0x5ab6('0xc')][_0x5ab6('0x30')],'phone':_0x2479c3['name_value_list'][_0x5ab6('0x37')][_0x5ab6('0x30')]});}}else{logger[_0x5ab6('0x27')](_0x5ab6('0x3a'));return request({'form':{'method':_0x5ab6('0x1e'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x5ab6('0x20')]({'session':_0x1c6ac3['id'],'module_name':_0x5ab6('0x18'),'name_value_list':[{'name':'first_name','value':_0x484ada!==_0x5ab6('0x3b')?_0x484ada:util['format'](_0x5ab6('0x3c'),_0x49f6f6)},{'name':'phone_home','value':_0x49f6f6}]})}})[_0x5ab6('0x2c')](function(_0x5614fd){logger[_0x5ab6('0x27')](_0x5ab6('0x3d'));return BPromise[_0x5ab6('0x32')]({'id':_0x5614fd['id'],'name':_0x5614fd[_0x5ab6('0x2d')]['first_name'][_0x5ab6('0x30')],'phone':_0x5614fd[_0x5ab6('0x2d')]['phone_home'][_0x5ab6('0x30')]});});}});}function request(_0x4ea773){logger[_0x5ab6('0x3e')](_0x5ab6('0x3f'),JSON[_0x5ab6('0x20')](_0x4ea773));return rp(_[_0x5ab6('0x40')](def,_0x4ea773));}function getTags(_0x56ca94,_0x20662f){var _0x31c708=[];if(_0x56ca94&&_0x56ca94[_0x5ab6('0x2e')]>0x0){_0x31c708=_['map'](_0x56ca94,_0x20662f);}return _0x31c708;}function getCustomFields(_0x22052d,_0xa404ba){var _0xef9a1a=[];var _0x5b1b6d={'custom_fields':[]};if(_0x22052d[_0x5ab6('0x2e')]>0x0){_[_0x5ab6('0x41')](_0x22052d,function(_0xe0a905){if(_0xe0a905[_0x5ab6('0x42')]===_0x5ab6('0x43')&&_0xe0a905[_0x5ab6('0x44')]&&!_0xe0a905[_0x5ab6('0x45')]){_0x5b1b6d[_0xe0a905['nameField'][_0x5ab6('0x46')]()]=_0xe0a905['content'][_0x5ab6('0x47')]();}else if(_0xe0a905[_0x5ab6('0x42')]===_0x5ab6('0x43')&&_0xe0a905[_0x5ab6('0x1d')]&&_0xe0a905[_0x5ab6('0x45')]){_0x5b1b6d['custom_fields'][_0x5ab6('0x1c')]({'id':_0xe0a905[_0x5ab6('0x1d')],'value':_0xe0a905[_0x5ab6('0x48')][_0x5ab6('0x47')]()});}else if(_0xe0a905['type']===_0x5ab6('0x49')&&_0xe0a905[_0x5ab6('0x1b')]&&_0xe0a905['idField']&&_0xe0a905['customField']){_0xa404ba[_0xe0a905[_0x5ab6('0x1b')]]&&_0x5b1b6d[_0x5ab6('0x4a')][_0x5ab6('0x1c')]({'id':_0xe0a905[_0x5ab6('0x1d')],'value':_0xa404ba[_0xe0a905['variableName']][_0x5ab6('0x47')]()});}else if(_0xe0a905[_0x5ab6('0x42')]===_0x5ab6('0x4b')&&_0xe0a905[_0x5ab6('0x4c')]&&_0xe0a905[_0x5ab6('0x4c')][_0x5ab6('0xc')]&&_0xe0a905[_0x5ab6('0x1d')]&&_0xe0a905['customField']){_0xa404ba[_0xe0a905[_0x5ab6('0x4c')][_0x5ab6('0xc')][_0x5ab6('0x46')]()]&&_0x5b1b6d['custom_fields'][_0x5ab6('0x1c')]({'id':_0xe0a905['idField'],'value':_0xa404ba[_0xe0a905[_0x5ab6('0x4c')][_0x5ab6('0xc')][_0x5ab6('0x46')]()][_0x5ab6('0x47')]()});}});}return _0x5b1b6d;}function getConnection(_0x727ddd){return request({'method':_0x5ab6('0xa'),'form':{'method':_0x5ab6('0x4d'),'input_type':_0x5ab6('0x1f'),'response_type':_0x5ab6('0x1f'),'rest_data':JSON[_0x5ab6('0x20')]({'user_auth':{'user_name':_0x727ddd[_0x5ab6('0x4e')],'password':_0x727ddd[_0x5ab6('0x4f')],'encryption':_0x5ab6('0x50')},'application':_0x5ab6('0x51')})}})['then'](function(_0x3cc959){var _0x4fcaba=_0x3cc959;if(_0x4fcaba['id']){def[_0x5ab6('0x52')]=_0x4fcaba['id'];return BPromise[_0x5ab6('0x32')](_0x4fcaba);}else{throw new Error(util['format'](_0x5ab6('0x53'),_0x727ddd['id']));}});}function setRelationship(_0x576488,_0x33c9c0,_0x225355,_0x223cb5){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x5ab6('0x20')]({'session':_0x576488['id'],'module_name':_0x5ab6('0x54'),'module_id':_0x225355['id'],'link_field_name':_0x223cb5,'related_ids':[_0x33c9c0['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x5ab6('0x55')]=function(_0x22155c,_0x21c499,_0x343be2,_0x594f96,_0x57e2f3,_0x27d3e1){var _0x16c744,_0xd18bc2,_0x2e93a6,_0x1fd454;_0x27d3e1[_0x5ab6('0x56')]=intUtil['stripTrailingSlash'](_0x27d3e1['remoteUri']);_0x27d3e1[_0x5ab6('0x57')]=intUtil[_0x5ab6('0x58')](_0x27d3e1[_0x5ab6('0x57')]);def[_0x5ab6('0x59')]=util[_0x5ab6('0x21')](_0x5ab6('0x5a'),_0x27d3e1[_0x5ab6('0x56')]);if(_0x57e2f3&&_0x57e2f3[_0x5ab6('0x5b')]){logger[_0x5ab6('0x27')](_0x5ab6('0x5c'),'Recording\x20is\x20enabled!');_0x21c499[_0x5ab6('0x5d')]=util[_0x5ab6('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x27d3e1[_0x5ab6('0x57')],_0x21c499[_0x5ab6('0x5e')],md5(_0x21c499[_0x5ab6('0x5e')]));}else{_0x21c499[_0x5ab6('0x5d')]='';}return getConnection(_0x27d3e1)['then'](function(_0x553c2a){_0x1fd454=_0x553c2a;return getUser(_0x27d3e1,_0x594f96[_0x5ab6('0xc')],_0x1fd454);})[_0x5ab6('0x2c')](function(_0x117989){_0x16c744=_0x117989;logger['info']('The\x20User\x20ID\x20is:',_0x16c744['id']);return getEndUser(_0x27d3e1,_0x21c499[_0x5ab6('0x5f')],_0x21c499['calleridnum'],_0x1fd454);})['then'](function(_0xd10fc){_0xd18bc2=_0xd10fc;logger['info'](_0x5ab6('0x60'),_0xd18bc2['id']);return getTicket(_0x27d3e1,_0x16c744,_0xd18bc2,_0x343be2,_0x21c499,_0x343be2[_0x5ab6('0x61')],_0x1fd454,_0x5ab6('0x62'));})[_0x5ab6('0x2c')](function(_0x5e4534){_0x2e93a6=_0x5e4534;logger[_0x5ab6('0x27')](_0x5ab6('0x63'));logger[_0x5ab6('0x27')](_0x5ab6('0x64'),_0x2e93a6['id']);return setRelationship(_0x1fd454,_0x16c744,_0x2e93a6,_0x5ab6('0x65'));})['then'](function(){return setRelationship(_0x1fd454,_0xd18bc2,_0x2e93a6,'contacts');})[_0x5ab6('0x2c')](function(){return getServerInfo(_0x1fd454);})[_0x5ab6('0x2c')](function(_0x519b4f){var _0x5f5b9d=parseInt(_0x519b4f[_0x5ab6('0x66')][_0x5ab6('0x67')](0x0));var _0x334b3d=util['format'](_0x5ab6('0x68'),_0x27d3e1['remoteUri'],_0x2e93a6['id']);if(_0x5f5b9d>0x6){_0x334b3d=util[_0x5ab6('0x21')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x27d3e1[_0x5ab6('0x56')],_0x2e93a6['id']);}logger['info'](_0x5ab6('0x5c'),_0x5ab6('0x69'));emit(util[_0x5ab6('0x21')]('user:%s',_0x594f96[_0x5ab6('0xc')]),'trigger:browser:url',{'uri':_0x334b3d});})['catch'](function(_0x564dca){logger[_0x5ab6('0x6a')](_0x5ab6('0x5c'),JSON[_0x5ab6('0x20')](_0x564dca));});};exports[_0x5ab6('0x6b')]=function(_0x36db25,_0x1ba67f,_0x42d440,_0x14c81e,_0x302d5d,_0x48a147,_0xe86cc4){var _0x2d0183,_0x40174a,_0x1c4842,_0x326058;_0x48a147['remoteUri']=intUtil['stripTrailingSlash'](_0x48a147[_0x5ab6('0x56')]);_0x48a147[_0x5ab6('0x57')]=intUtil[_0x5ab6('0x58')](_0x48a147[_0x5ab6('0x57')]);def[_0x5ab6('0x59')]=util[_0x5ab6('0x21')]('%s/service/v4_1/rest.php',_0x48a147[_0x5ab6('0x56')]);if(_0xe86cc4&&_0xe86cc4[_0x5ab6('0x6c')]&&_0xe86cc4[_0x5ab6('0x6c')]!==_0x5ab6('0x6d')){logger[_0x5ab6('0x27')](_0x5ab6('0x6e'),_0x5ab6('0x6f'));_0x1ba67f[_0x5ab6('0x5d')]=util['format'](_0x5ab6('0x70'),_0x48a147['serverUrl'],_0x1ba67f[_0x5ab6('0x5e')],md5(_0x1ba67f['uniqueid']));}return getConnection(_0x48a147)[_0x5ab6('0x2c')](function(_0x164373){_0x326058=_0x164373;return getUser(_0x48a147,_0x14c81e['name'],_0x326058);})[_0x5ab6('0x2c')](function(_0x284f05){_0x2d0183=_0x284f05;logger[_0x5ab6('0x27')]('The\x20User\x20ID\x20is:',_0x2d0183['id']);return getEndUser(_0x48a147,_0x1ba67f[_0x5ab6('0x71')],_0x1ba67f[_0x5ab6('0x72')],_0x326058);})[_0x5ab6('0x2c')](function(_0x1ee3e9){_0x40174a=_0x1ee3e9;logger[_0x5ab6('0x27')]('The\x20Enduser\x20ID\x20is:',_0x40174a['id']);return getTicket(_0x48a147,_0x2d0183,_0x40174a,_0x42d440,_0x1ba67f,_0x42d440['Fields'],_0x326058,_0x5ab6('0x73'));})['then'](function(_0x812934){_0x1c4842=_0x812934;logger['info'](_0x5ab6('0x63'));logger[_0x5ab6('0x27')](_0x5ab6('0x64'),_0x1c4842['id']);return setRelationship(_0x326058,_0x2d0183,_0x1c4842,_0x5ab6('0x65'));})[_0x5ab6('0x2c')](function(){return setRelationship(_0x326058,_0x40174a,_0x1c4842,_0x5ab6('0x74'));})[_0x5ab6('0x2c')](function(){return getServerInfo(_0x326058);})[_0x5ab6('0x2c')](function(_0xf04d5b){var _0x1c849e=parseInt(_0xf04d5b[_0x5ab6('0x66')]['charAt'](0x0));var _0x173f83=util['format'](_0x5ab6('0x68'),_0x48a147[_0x5ab6('0x56')],_0x1c4842['id']);if(_0x1c849e>0x6){_0x173f83=util[_0x5ab6('0x21')](_0x5ab6('0x75'),_0x48a147['remoteUri'],_0x1c4842['id']);}logger[_0x5ab6('0x27')](_0x5ab6('0x6e'),_0x5ab6('0x69'));emit(util['format']('user:%s',_0x14c81e[_0x5ab6('0xc')]),_0x5ab6('0x76'),{'uri':_0x173f83});})[_0x5ab6('0x77')](function(_0x3bbc39){logger[_0x5ab6('0x6a')]('[OUTBOUND]',JSON[_0x5ab6('0x20')](_0x3bbc39));});};exports[_0x5ab6('0x78')]=function(_0x2bc75c,_0x4321e0,_0x1bf76a,_0x11c5a5,_0x5b33f3,_0x4813f7){var _0x8fe55e,_0x330ab9,_0xfee369,_0x806cd1;_0x4813f7[_0x5ab6('0x56')]=intUtil[_0x5ab6('0x58')](_0x4813f7[_0x5ab6('0x56')]);_0x4813f7[_0x5ab6('0x57')]=intUtil[_0x5ab6('0x58')](_0x4813f7['serverUrl']);def[_0x5ab6('0x59')]=util[_0x5ab6('0x21')](_0x5ab6('0x5a'),_0x4813f7['remoteUri']);if(_0x5b33f3&&_0x5b33f3['monitor_format']){logger['info']('['+_0x4321e0[_0x5ab6('0x79')][_0x5ab6('0x7a')]()+']',_0x5ab6('0x6f'));_0x4321e0[_0x5ab6('0x5d')]=util[_0x5ab6('0x21')](_0x5ab6('0x70'),_0x4813f7[_0x5ab6('0x57')],_0x4321e0[_0x5ab6('0x5e')],md5(_0x4321e0[_0x5ab6('0x5e')]));}else{_0x4321e0['recordingURL']='';}return getConnection(_0x4813f7)[_0x5ab6('0x2c')](function(_0x47cc1f){_0x806cd1=_0x47cc1f;if(!_[_0x5ab6('0x26')](_0x11c5a5)){return getUser(_0x4813f7,_0x11c5a5['name'],_0x806cd1);}else{return getUser(_0x4813f7,null,_0x806cd1);}})[_0x5ab6('0x2c')](function(_0x1bcca1){_0x8fe55e=_0x1bcca1;logger[_0x5ab6('0x27')](_0x5ab6('0x7b'),_0x8fe55e['id']);return getEndUser(_0x4813f7,_0x4321e0[_0x5ab6('0x5f')],_0x4321e0['calleridnum'],_0x806cd1);})[_0x5ab6('0x2c')](function(_0x42dcfe){_0x330ab9=_0x42dcfe;logger[_0x5ab6('0x27')]('The\x20Enduser\x20ID\x20is:',_0x330ab9['id']);return getTicket(_0x4813f7,_0x8fe55e,_0x330ab9,_0x1bf76a,_0x4321e0,_0x1bf76a[_0x5ab6('0x61')],_0x806cd1,_0x5ab6('0x62'));})[_0x5ab6('0x2c')](function(_0x96379f){_0xfee369=_0x96379f;logger[_0x5ab6('0x27')]('Ticket\x20created!');logger[_0x5ab6('0x27')](_0x5ab6('0x64'),_0xfee369['id']);return setRelationship(_0x806cd1,_0x8fe55e,_0xfee369,_0x5ab6('0x65'));})[_0x5ab6('0x2c')](function(){return setRelationship(_0x806cd1,_0x330ab9,_0xfee369,'contacts');})['then'](function(){return getServerInfo(_0x806cd1);})['catch'](function(_0x1ee2da){logger[_0x5ab6('0x6a')]('['+_0x4321e0[_0x5ab6('0x79')][_0x5ab6('0x7a')]()+']',JSON[_0x5ab6('0x20')](_0x1ee2da));});}; \ 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 251a140..372947b 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 _0x7c47=['format','%s:\x20%s','keyContent','keyType','join','stripTrailingSlash','slice','substring','validateEmail','isNil','test','lodash','util','length','sortBy','push','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','string','key'];(function(_0x41c7b0,_0x5037de){var _0x4e8d15=function(_0xf02f87){while(--_0xf02f87){_0x41c7b0['push'](_0x41c7b0['shift']());}};_0x4e8d15(++_0x5037de);}(_0x7c47,0x1e7));var _0x77c4=function(_0x22fac9,_0x371ce6){_0x22fac9=_0x22fac9-0x0;var _0x1fe4ba=_0x7c47[_0x22fac9];return _0x1fe4ba;};'use strict';var _=require(_0x77c4('0x0'));var util=require(_0x77c4('0x1'));exports['getString']=function(_0x4281da,_0x1de8fa,_0x3b8354){var _0x28d774=[];if(_0x4281da[_0x77c4('0x2')]>0x0){var _0x472c6a=_[_0x77c4('0x3')](_0x4281da,['id']);for(var _0x5dbf84=0x0;_0x5dbf84<_0x472c6a[_0x77c4('0x2')];_0x5dbf84++){var _0x367493=_0x472c6a[_0x5dbf84];if(_0x367493['type']==='string'){_0x28d774[_0x77c4('0x4')](_0x367493[_0x77c4('0x5')]);}else if(_0x367493[_0x77c4('0x6')]===_0x77c4('0x7')&&_0x367493[_0x77c4('0x8')]){_0x1de8fa[_0x367493[_0x77c4('0x8')]]&&_0x28d774[_0x77c4('0x4')](_0x1de8fa[_0x367493['variableName']][_0x77c4('0x9')]());}else if(_0x367493[_0x77c4('0x6')]===_0x77c4('0xa')&&_0x367493[_0x77c4('0xb')]&&_0x367493['Variable'][_0x77c4('0xc')]){_0x1de8fa[_0x367493[_0x77c4('0xb')][_0x77c4('0xc')][_0x77c4('0xd')]()]&&_0x28d774['push'](_0x1de8fa[_0x367493[_0x77c4('0xb')][_0x77c4('0xc')][_0x77c4('0xd')]()][_0x77c4('0x9')]());}else if(_0x367493['type']===_0x77c4('0xe')){if(_0x367493['keyType']===_0x77c4('0xf')&&_0x367493[_0x77c4('0x10')]){_0x28d774['push'](util[_0x77c4('0x11')](_0x77c4('0x12'),_0x367493[_0x77c4('0x10')],_0x367493[_0x77c4('0x13')]));}else if(_0x367493['keyType']===_0x77c4('0x7')&&_0x367493[_0x77c4('0x8')]&&_0x367493[_0x77c4('0x10')]){_0x1de8fa[_0x367493[_0x77c4('0x8')]]&&_0x28d774[_0x77c4('0x4')](util[_0x77c4('0x11')](_0x77c4('0x12'),_0x367493[_0x77c4('0x10')],_0x1de8fa[_0x367493['variableName']]));}else if(_0x367493[_0x77c4('0x14')]===_0x77c4('0xa')&&_0x367493[_0x77c4('0xb')]&&_0x367493[_0x77c4('0xb')]['name']&&_0x367493[_0x77c4('0x10')]){_0x1de8fa[_0x367493['Variable'][_0x77c4('0xc')][_0x77c4('0xd')]()]&&_0x28d774[_0x77c4('0x4')](util['format'](_0x77c4('0x12'),_0x367493[_0x77c4('0x10')],_0x1de8fa[_0x367493[_0x77c4('0xb')][_0x77c4('0xc')][_0x77c4('0xd')]()]));}}}}return _0x28d774[_0x77c4('0x15')](_0x3b8354);};exports[_0x77c4('0x16')]=function(_0x417978){var _0x84d30b=_0x417978[_0x77c4('0x17')](-0x1);if(_0x84d30b==='/'){_0x417978=_0x417978[_0x77c4('0x18')](0x0,_0x417978['lastIndexOf'](_0x84d30b));}return _0x417978;};exports[_0x77c4('0x19')]=function(_0x123dcc){if(!_[_0x77c4('0x1a')](_0x123dcc)&&_0x123dcc!==''){var _0x1d1d15=/^(([^<>()\[\]\\.,;:\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 _0x1d1d15[_0x77c4('0x1b')](String(_0x123dcc)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0xfd52=['util','getString','length','sortBy','type','string','content','variableName','push','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','variable','join','stripTrailingSlash','slice','substring','validateEmail','isNil','test'];(function(_0x4123ee,_0x337d4d){var _0x7458fb=function(_0x25b899){while(--_0x25b899){_0x4123ee['push'](_0x4123ee['shift']());}};_0x7458fb(++_0x337d4d);}(_0xfd52,0x195));var _0x2fd5=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xfd52[_0x550d12];return _0x12103d;};'use strict';var _=require('lodash');var util=require(_0x2fd5('0x0'));exports[_0x2fd5('0x1')]=function(_0x3a69ac,_0x51ad13,_0x5709c6){var _0xa512df=[];if(_0x3a69ac[_0x2fd5('0x2')]>0x0){var _0xd0187e=_[_0x2fd5('0x3')](_0x3a69ac,['id']);for(var _0x4d5f12=0x0;_0x4d5f12<_0xd0187e[_0x2fd5('0x2')];_0x4d5f12++){var _0x23f210=_0xd0187e[_0x4d5f12];if(_0x23f210[_0x2fd5('0x4')]===_0x2fd5('0x5')){_0xa512df['push'](_0x23f210[_0x2fd5('0x6')]);}else if(_0x23f210[_0x2fd5('0x4')]==='variable'&&_0x23f210[_0x2fd5('0x7')]){_0x51ad13[_0x23f210[_0x2fd5('0x7')]]&&_0xa512df[_0x2fd5('0x8')](_0x51ad13[_0x23f210[_0x2fd5('0x7')]][_0x2fd5('0x9')]());}else if(_0x23f210[_0x2fd5('0x4')]===_0x2fd5('0xa')&&_0x23f210[_0x2fd5('0xb')]&&_0x23f210[_0x2fd5('0xb')][_0x2fd5('0xc')]){_0x51ad13[_0x23f210[_0x2fd5('0xb')]['name']['toLowerCase']()]&&_0xa512df['push'](_0x51ad13[_0x23f210[_0x2fd5('0xb')][_0x2fd5('0xc')][_0x2fd5('0xd')]()]['toString']());}else if(_0x23f210[_0x2fd5('0x4')]===_0x2fd5('0xe')){if(_0x23f210[_0x2fd5('0xf')]==='string'&&_0x23f210[_0x2fd5('0x10')]){_0xa512df[_0x2fd5('0x8')](util[_0x2fd5('0x11')](_0x2fd5('0x12'),_0x23f210[_0x2fd5('0x10')],_0x23f210['keyContent']));}else if(_0x23f210[_0x2fd5('0xf')]===_0x2fd5('0x13')&&_0x23f210[_0x2fd5('0x7')]&&_0x23f210[_0x2fd5('0x10')]){_0x51ad13[_0x23f210[_0x2fd5('0x7')]]&&_0xa512df[_0x2fd5('0x8')](util[_0x2fd5('0x11')](_0x2fd5('0x12'),_0x23f210['key'],_0x51ad13[_0x23f210[_0x2fd5('0x7')]]));}else if(_0x23f210[_0x2fd5('0xf')]==='customVariable'&&_0x23f210[_0x2fd5('0xb')]&&_0x23f210['Variable'][_0x2fd5('0xc')]&&_0x23f210['key']){_0x51ad13[_0x23f210[_0x2fd5('0xb')][_0x2fd5('0xc')]['toLowerCase']()]&&_0xa512df['push'](util['format'](_0x2fd5('0x12'),_0x23f210[_0x2fd5('0x10')],_0x51ad13[_0x23f210[_0x2fd5('0xb')][_0x2fd5('0xc')]['toLowerCase']()]));}}}}return _0xa512df[_0x2fd5('0x14')](_0x5709c6);};exports[_0x2fd5('0x15')]=function(_0x1686ee){var _0x33d758=_0x1686ee[_0x2fd5('0x16')](-0x1);if(_0x33d758==='/'){_0x1686ee=_0x1686ee[_0x2fd5('0x17')](0x0,_0x1686ee['lastIndexOf'](_0x33d758));}return _0x1686ee;};exports[_0x2fd5('0x18')]=function(_0x4ca739){if(!_[_0x2fd5('0x19')](_0x4ca739)&&_0x4ca739!==''){var _0x2461b8=/^(([^<>()\[\]\\.,;:\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 _0x2461b8[_0x2fd5('0x1a')](String(_0x4ca739)[_0x2fd5('0xd')]());}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 63b015b..4ada0d7 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x461982,_0x37a19a){var _0x52555=function(_0x26cb20){while(--_0x26cb20){_0x461982['push'](_0x461982['shift']());}};_0x52555(++_0x37a19a);}(_0x9c44,0x178));var _0x49c4=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9c44[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x5be37a,_0x4bb5a2){var _0x50e3c7=function(_0x120a91){while(--_0x120a91){_0x5be37a['push'](_0x5be37a['shift']());}};_0x50e3c7(++_0x4bb5a2);}(_0xe706,0xa3));var _0x6e70=function(_0x154cb5,_0x1a8d5a){_0x154cb5=_0x154cb5-0x0;var _0x3f574f=_0xe706[_0x154cb5];return _0x3f574f;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 92a71f1..5e322c1 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 _0xbde2=['type','nameField','toLowerCase','content','string','customField','custom_fields','push','idField','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','inspect','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','merge','Tags','name','Subjects','getString','Descriptions','Fields','then','info','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','first','Enduser\x20found!','%s/users.json','end-user','Enduser\x20created.','password','%s:%s','authType','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','includes','picklist'];(function(_0x2b0a69,_0x166999){var _0x199955=function(_0x2a1520){while(--_0x2a1520){_0x2b0a69['push'](_0x2b0a69['shift']());}};_0x199955(++_0x166999);}(_0xbde2,0x118));var _0x2bde=function(_0x5a8bd9,_0x193239){_0x5a8bd9=_0x5a8bd9-0x0;var _0xbf5058=_0xbde2[_0x5a8bd9];return _0xbf5058;};'use strict';var _=require(_0x2bde('0x0'));var rp=require(_0x2bde('0x1'));var md5=require(_0x2bde('0x2'));var util=require(_0x2bde('0x3'));var Redis=require(_0x2bde('0x4'));var intUtil=require('./util');var config=require(_0x2bde('0x5'));var logger=require(_0x2bde('0x6'))(_0x2bde('0x7'));config[_0x2bde('0x8')]=_[_0x2bde('0x9')](config[_0x2bde('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x2bde('0xa'))(new Redis(config['redis']));function emit(_0x19c7f0,_0x4eec1d,_0x5524d0){io['to'](_0x19c7f0)[_0x2bde('0xb')](_0x4eec1d,_0x5524d0);}var headers={'Content-Type':_0x2bde('0xc'),'Accept':_0x2bde('0xc')};function getTicket(_0x1ff99b,_0x36cdf6,_0x2265e9,_0x4b18b2,_0x58578){logger['info'](_0x2bde('0xd'));return request({'uri':util[_0x2bde('0xe')](_0x2bde('0xf'),_0x1ff99b['remoteUri']),'method':_0x2bde('0x10'),'body':{'ticket':_[_0x2bde('0x11')]({'requester_id':_0x2265e9['id'],'submitter_id':_0x36cdf6?_0x36cdf6['id']:undefined,'assignee_id':_0x36cdf6?_0x36cdf6['id']:undefined,'tags':getTags(_0x4b18b2[_0x2bde('0x12')],_0x2bde('0x13')),'subject':intUtil['getString'](_0x4b18b2[_0x2bde('0x14')],_0x58578,'\x20'),'description':intUtil[_0x2bde('0x15')](_0x4b18b2['Descriptions'],_0x58578,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x4b18b2[_0x2bde('0x16')],_0x58578,'\x0a')}},getCustomFields(_0x4b18b2[_0x2bde('0x17')],_0x58578))}})[_0x2bde('0x18')](function(_0x33a755){logger[_0x2bde('0x19')](_0x2bde('0x1a'));return _0x33a755[_0x2bde('0x1b')];});}function getUser(_0xab9e93,_0x47aa71){if(intUtil[_0x2bde('0x1c')](_0x47aa71)){logger[_0x2bde('0x19')](_0x2bde('0x1d'),_0x47aa71);return request({'uri':util[_0x2bde('0xe')](_0x2bde('0x1e'),_0xab9e93[_0x2bde('0x1f')]),'qs':{'query':util['format'](_0x2bde('0x20'),_0x47aa71)}})[_0x2bde('0x18')](function(_0x216fde){if(_0x216fde[_0x2bde('0x21')]){logger[_0x2bde('0x19')]('Agent\x20found!');return _[_0x2bde('0x22')](_0x216fde[_0x2bde('0x23')],{'email':_0x47aa71,'role':_0x2bde('0x24')});}else{logger[_0x2bde('0x19')](_0x2bde('0x25'));return request({'uri':util[_0x2bde('0xe')](_0x2bde('0x26'),_0xab9e93['remoteUri'])})['then'](function(_0x2b1787){logger[_0x2bde('0x19')](_0x2bde('0x27'));return _0x2b1787[_0x2bde('0x28')];});}});}else{logger['info'](_0x2bde('0x25'));return request({'uri':util[_0x2bde('0xe')](_0x2bde('0x26'),_0xab9e93['remoteUri'])})[_0x2bde('0x18')](function(_0x1c104e){logger['info']('Admin\x20account\x20selected.');return _0x1c104e['user'];});}}function getEndUser(_0x46f9e5,_0x2f3efb,_0x800f8d){logger['info'](_0x2bde('0x29'),_0x800f8d);return request({'uri':util['format']('%s/search.json',_0x46f9e5['remoteUri']),'qs':{'query':util[_0x2bde('0xe')](_0x2bde('0x2a'),_0x800f8d)}})[_0x2bde('0x18')](function(_0x381748){var _0x47f418;if(_0x381748['results'][_0x2bde('0x2b')]){_0x381748[_0x2bde('0x23')]=_[_0x2bde('0x2c')](_0x381748[_0x2bde('0x23')],{'suspended':![],'role':'end-user'});if(_0x381748[_0x2bde('0x23')][_0x2bde('0x2b')]){_0x47f418=_[_0x2bde('0x2d')](_0x381748[_0x2bde('0x23')]);}}if(_0x47f418){logger[_0x2bde('0x19')](_0x2bde('0x2e'));return _0x47f418;}else{logger[_0x2bde('0x19')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x2bde('0xe')](_0x2bde('0x2f'),_0x46f9e5[_0x2bde('0x1f')]),'method':_0x2bde('0x10'),'body':{'user':{'role':_0x2bde('0x30'),'name':util['format']('Caller\x20-\x20%s',_0x2f3efb||_0x800f8d),'phone':_0x800f8d}}})[_0x2bde('0x18')](function(_0x219b4e){logger['info'](_0x2bde('0x31'));return _0x219b4e[_0x2bde('0x28')];});}});}function getAuth(_0x5d5487){var _0x2fc30d;if(_0x5d5487['authType']===_0x2bde('0x32')){_0x2fc30d=util[_0x2bde('0xe')](_0x2bde('0x33'),_0x5d5487['username'],_0x5d5487[_0x2bde('0x32')]);}else if(_0x5d5487[_0x2bde('0x34')]===_0x2bde('0x35')){_0x2fc30d=util[_0x2bde('0xe')](_0x2bde('0x36'),_0x5d5487['username'],_0x5d5487['token']);}return util['format'](_0x2bde('0x37'),new Buffer(_0x2fc30d)[_0x2bde('0x38')](_0x2bde('0x39')));}function request(_0x65c9c5){logger[_0x2bde('0x3a')](_0x2bde('0x3b'),JSON[_0x2bde('0x3c')](_0x65c9c5));return rp(_[_0x2bde('0x9')](_0x65c9c5,{'method':_0x2bde('0x3d'),'headers':headers,'json':!![]}));}function getTags(_0x252d8a,_0x383051){var _0x3802ab=[];if(_0x252d8a&&_0x252d8a[_0x2bde('0x2b')]>0x0){_0x3802ab=_[_0x2bde('0x3e')](_0x252d8a,_0x383051);}return _0x3802ab;}function getCustomFields(_0x1d85a4,_0x20ee97){var _0x3d36eb=[];var _0x4e8de7={'custom_fields':[]};if(_0x1d85a4['length']>0x0){_['forEach'](_0x1d85a4,function(_0x12ef29){if(_[_0x2bde('0x3f')](['string',_0x2bde('0x40')],_0x12ef29[_0x2bde('0x41')])&&_0x12ef29[_0x2bde('0x42')]&&!_0x12ef29['customField']){_0x4e8de7[_0x12ef29['nameField'][_0x2bde('0x43')]()]=_0x12ef29[_0x2bde('0x44')][_0x2bde('0x38')]();}else if(_[_0x2bde('0x3f')]([_0x2bde('0x45'),_0x2bde('0x40')],_0x12ef29['type'])&&_0x12ef29['idField']&&_0x12ef29[_0x2bde('0x46')]){_0x4e8de7[_0x2bde('0x47')][_0x2bde('0x48')]({'id':_0x12ef29[_0x2bde('0x49')],'value':_0x12ef29[_0x2bde('0x44')][_0x2bde('0x38')]()});}else if(_0x12ef29[_0x2bde('0x41')]===_0x2bde('0x4a')&&_0x12ef29[_0x2bde('0x4b')]&&_0x12ef29[_0x2bde('0x49')]&&_0x12ef29['customField']){_0x20ee97[_0x12ef29[_0x2bde('0x4b')]]&&_0x4e8de7[_0x2bde('0x47')]['push']({'id':_0x12ef29[_0x2bde('0x49')],'value':_0x20ee97[_0x12ef29['variableName']][_0x2bde('0x38')]()});}else if(_0x12ef29['type']===_0x2bde('0x4c')&&_0x12ef29[_0x2bde('0x4d')]&&_0x12ef29[_0x2bde('0x4d')][_0x2bde('0x13')]&&_0x12ef29[_0x2bde('0x49')]&&_0x12ef29['customField']){_0x20ee97[_0x12ef29[_0x2bde('0x4d')][_0x2bde('0x13')][_0x2bde('0x43')]()]&&_0x4e8de7[_0x2bde('0x47')][_0x2bde('0x48')]({'id':_0x12ef29['idField'],'value':_0x20ee97[_0x12ef29[_0x2bde('0x4d')][_0x2bde('0x13')][_0x2bde('0x43')]()][_0x2bde('0x38')]()});}});}return _0x4e8de7;}exports[_0x2bde('0x4e')]=function(_0x5aa3de,_0x59050b,_0x32a45d,_0x3d3444,_0x383fc0,_0x290b7e){var _0x5602f2,_0x3a5fa8;_0x290b7e[_0x2bde('0x1f')]=intUtil[_0x2bde('0x4f')](_0x290b7e[_0x2bde('0x1f')]);_0x290b7e[_0x2bde('0x50')]=intUtil[_0x2bde('0x4f')](_0x290b7e['serverUrl']);if(_0x383fc0&&_0x383fc0[_0x2bde('0x51')]){logger[_0x2bde('0x19')](_0x2bde('0x52'),_0x2bde('0x53'));_0x59050b[_0x2bde('0x54')]=util[_0x2bde('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x290b7e[_0x2bde('0x50')],_0x59050b['uniqueid'],md5(_0x59050b[_0x2bde('0x55')]));}else{_0x59050b[_0x2bde('0x54')]='';}headers[_0x2bde('0x56')]=getAuth(_0x290b7e);return getUser(_0x290b7e,_0x3d3444[_0x2bde('0x57')])[_0x2bde('0x18')](function(_0x3ed8ac){_0x5602f2=_0x3ed8ac;logger[_0x2bde('0x19')](_0x2bde('0x58'),_0x5602f2['id']);return getEndUser(_0x290b7e,_0x59050b[_0x2bde('0x59')],_0x59050b['calleridnum']);})[_0x2bde('0x18')](function(_0x5e077d){_0x3a5fa8=_0x5e077d;logger[_0x2bde('0x19')](_0x2bde('0x5a'),_0x3a5fa8['id']);return getTicket(_0x290b7e,_0x5602f2,_0x3a5fa8,_0x32a45d,_0x59050b);})['then'](function(_0x12863a){if(_0x12863a){logger['info'](_0x2bde('0x5b'),_0x12863a['id']);switch(_0x290b7e[_0x2bde('0x41')]){case _0x2bde('0x5c'):logger['info']('[QUEUE]',_0x2bde('0x5d'));return request({'uri':util['format'](_0x2bde('0x5e'),_0x290b7e[_0x2bde('0x1f')],_0x5602f2['id'],_0x12863a['id']),'method':'POST'});case _0x2bde('0x5f'):logger[_0x2bde('0x19')]('[QUEUE]',_0x2bde('0x60'));emit(util[_0x2bde('0xe')](_0x2bde('0x61'),_0x3d3444['name']),'trigger:browser:url',{'uri':util[_0x2bde('0xe')](_0x2bde('0x62'),_0x290b7e[_0x2bde('0x1f')][_0x2bde('0x63')]('/api/v2',''),_0x12863a['id'])});break;default:logger[_0x2bde('0x64')](_0x2bde('0x52'),_0x2bde('0x65'));}}})['catch'](function(_0x17a9b0){logger[_0x2bde('0x64')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x2bde('0x66')](_0x17a9b0,{'showHidden':!![],'depth':null}));});};exports[_0x2bde('0x67')]=function(_0x2c4036,_0x404f3d,_0x203284,_0x12f881,_0x37a2ca,_0x4c53dc,_0x2f02e1){var _0x1d74a2,_0x18a202;_0x4c53dc[_0x2bde('0x1f')]=intUtil[_0x2bde('0x4f')](_0x4c53dc['remoteUri']);_0x4c53dc[_0x2bde('0x50')]=intUtil['stripTrailingSlash'](_0x4c53dc['serverUrl']);if(_0x2f02e1&&_0x2f02e1[_0x2bde('0x68')]&&_0x2f02e1['recordingFormat']!==_0x2bde('0x69')){logger[_0x2bde('0x19')](_0x2bde('0x6a'),_0x2bde('0x53'));_0x404f3d[_0x2bde('0x54')]=util[_0x2bde('0xe')](_0x2bde('0x6b'),_0x4c53dc[_0x2bde('0x50')],_0x404f3d[_0x2bde('0x55')],md5(_0x404f3d[_0x2bde('0x55')]));}headers[_0x2bde('0x56')]=getAuth(_0x4c53dc);return getUser(_0x4c53dc,_0x12f881[_0x2bde('0x57')])[_0x2bde('0x18')](function(_0x1d1bb3){_0x1d74a2=_0x1d1bb3;logger[_0x2bde('0x19')](_0x2bde('0x58'),_0x1d74a2['id']);return getEndUser(_0x4c53dc,_0x404f3d[_0x2bde('0x6c')],_0x404f3d[_0x2bde('0x6d')]);})[_0x2bde('0x18')](function(_0x53be7c){_0x18a202=_0x53be7c;logger[_0x2bde('0x19')](_0x2bde('0x5a'),_0x18a202['id']);return getTicket(_0x4c53dc,_0x1d74a2,_0x18a202,_0x203284,_0x404f3d);})['then'](function(_0x869de7){if(_0x869de7){logger[_0x2bde('0x19')](_0x2bde('0x5b'),_0x869de7['id']);switch(_0x4c53dc[_0x2bde('0x41')]){case _0x2bde('0x5c'):logger[_0x2bde('0x19')](_0x2bde('0x6a'),_0x2bde('0x5d'));return request({'uri':util['format'](_0x2bde('0x5e'),_0x4c53dc[_0x2bde('0x1f')],_0x1d74a2['id'],_0x869de7['id']),'method':_0x2bde('0x10')});case _0x2bde('0x5f'):logger[_0x2bde('0x19')](_0x2bde('0x6a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x2bde('0xe')](_0x2bde('0x61'),_0x12f881['name']),'trigger:browser:url',{'uri':util[_0x2bde('0xe')]('%s/agent/tickets/%s',_0x4c53dc[_0x2bde('0x1f')]['replace']('/api/v2',''),_0x869de7['id'])});break;default:logger['error']('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x2bde('0x6e')](function(_0xca3f5d){logger['error'](_0x2bde('0x6f'),util['inspect'](_0xca3f5d,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x3e04ab,_0x43705e,_0xb75581,_0x521668,_0x39bde6,_0x4ece75){var _0x390b34,_0x551040;_0x4ece75['remoteUri']=intUtil[_0x2bde('0x4f')](_0x4ece75[_0x2bde('0x1f')]);_0x4ece75['serverUrl']=intUtil[_0x2bde('0x4f')](_0x4ece75[_0x2bde('0x50')]);if(_0x39bde6&&_0x39bde6['monitor_format']){logger[_0x2bde('0x19')]('['+_0x43705e[_0x2bde('0x70')][_0x2bde('0x71')]()+']',_0x2bde('0x53'));_0x43705e[_0x2bde('0x54')]=util[_0x2bde('0xe')](_0x2bde('0x6b'),_0x4ece75[_0x2bde('0x50')],_0x43705e[_0x2bde('0x55')],md5(_0x43705e[_0x2bde('0x55')]));}else{_0x43705e[_0x2bde('0x54')]='';}headers[_0x2bde('0x56')]=getAuth(_0x4ece75);return getUser(_0x4ece75)[_0x2bde('0x18')](function(_0x299bd9){_0x390b34=_0x299bd9;logger['info']('The\x20User\x20ID\x20is:',_0x390b34['id']);return getEndUser(_0x4ece75,_0x43705e[_0x2bde('0x59')],_0x43705e['calleridnum']);})[_0x2bde('0x18')](function(_0x4f019f){_0x551040=_0x4f019f;logger[_0x2bde('0x19')](_0x2bde('0x5a'),_0x551040['id']);return getTicket(_0x4ece75,_0x390b34,_0x551040,_0xb75581,_0x43705e);})['then'](function(_0x143699){if(_0x143699){logger[_0x2bde('0x19')](_0x2bde('0x5b'),_0x143699['id']);}})[_0x2bde('0x6e')](function(_0xb6bcba){logger[_0x2bde('0x64')]('['+_0x43705e[_0x2bde('0x70')]['toUpperCase']()+']'+_0x2bde('0x72'),util[_0x2bde('0x66')](_0xb6bcba,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x747c=['../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','info','format','%s/tickets.json','remoteUri','merge','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','validateEmail','%s/search.json','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','length','filter','end-user','first','Enduser\x20found!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','password','username','token','%s/token:%s','Basic\x20%s','[HTTP]','stringify','GET','map','forEach','string','picklist','nameField','toString','includes','customField','custom_fields','push','idField','content','type','variable','variableName','Variable','name','toLowerCase','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','recordingFormat','Recording\x20is\x20enabled!','email','destcalleridname','[OUTBOUND]','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','calleridname','\x20Error\x20running\x20Zendesk\x20integration','util','ioredis','./util'];(function(_0x32b30c,_0x2d5ec8){var _0xcfc212=function(_0x42e668){while(--_0x42e668){_0x32b30c['push'](_0x32b30c['shift']());}};_0xcfc212(++_0x2d5ec8);}(_0x747c,0x1a1));var _0xc747=function(_0x5b846c,_0x52fc09){_0x5b846c=_0x5b846c-0x0;var _0x5905f6=_0x747c[_0x5b846c];return _0x5905f6;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require(_0xc747('0x0'));var Redis=require(_0xc747('0x1'));var intUtil=require(_0xc747('0x2'));var config=require(_0xc747('0x3'));var logger=require(_0xc747('0x4'))(_0xc747('0x5'));config[_0xc747('0x6')]=_[_0xc747('0x7')](config[_0xc747('0x6')],{'host':_0xc747('0x8'),'port':0x18eb});var io=require(_0xc747('0x9'))(new Redis(config[_0xc747('0x6')]));function emit(_0x582399,_0x3dcb87,_0x4a2d45){io['to'](_0x582399)[_0xc747('0xa')](_0x3dcb87,_0x4a2d45);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getTicket(_0x27b879,_0x2e2305,_0x3f6223,_0x3103b4,_0x511123){logger[_0xc747('0xb')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xc747('0xc')](_0xc747('0xd'),_0x27b879[_0xc747('0xe')]),'method':'POST','body':{'ticket':_[_0xc747('0xf')]({'requester_id':_0x3f6223['id'],'submitter_id':_0x2e2305?_0x2e2305['id']:undefined,'assignee_id':_0x2e2305?_0x2e2305['id']:undefined,'tags':getTags(_0x3103b4['Tags'],'name'),'subject':intUtil[_0xc747('0x10')](_0x3103b4[_0xc747('0x11')],_0x511123,'\x20'),'description':intUtil[_0xc747('0x10')](_0x3103b4[_0xc747('0x12')],_0x511123,'\x0a'),'comment':{'public':![],'body':intUtil[_0xc747('0x10')](_0x3103b4[_0xc747('0x12')],_0x511123,'\x0a')}},getCustomFields(_0x3103b4['Fields'],_0x511123))}})[_0xc747('0x13')](function(_0x35b851){logger[_0xc747('0xb')](_0xc747('0x14'));return _0x35b851[_0xc747('0x15')];});}function getUser(_0x518e6c,_0x33ced2){if(intUtil[_0xc747('0x16')](_0x33ced2)){logger[_0xc747('0xb')]('Getting\x20agent\x20with\x20email',_0x33ced2);return request({'uri':util['format'](_0xc747('0x17'),_0x518e6c[_0xc747('0xe')]),'qs':{'query':util[_0xc747('0xc')]('type:user\x20role:agent\x20email:%s',_0x33ced2)}})['then'](function(_0x5de479){if(_0x5de479['count']){logger[_0xc747('0xb')]('Agent\x20found!');return _[_0xc747('0x18')](_0x5de479[_0xc747('0x19')],{'email':_0x33ced2,'role':_0xc747('0x1a')});}else{logger[_0xc747('0xb')](_0xc747('0x1b'));return request({'uri':util[_0xc747('0xc')](_0xc747('0x1c'),_0x518e6c[_0xc747('0xe')])})[_0xc747('0x13')](function(_0x234cff){logger[_0xc747('0xb')](_0xc747('0x1d'));return _0x234cff[_0xc747('0x1e')];});}});}else{logger[_0xc747('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xc747('0x1c'),_0x518e6c[_0xc747('0xe')])})[_0xc747('0x13')](function(_0x3c0b0e){logger[_0xc747('0xb')](_0xc747('0x1d'));return _0x3c0b0e[_0xc747('0x1e')];});}}function getEndUser(_0x3e4a37,_0x4b3d11,_0x2bf515){logger[_0xc747('0xb')](_0xc747('0x1f'),_0x2bf515);return request({'uri':util[_0xc747('0xc')](_0xc747('0x17'),_0x3e4a37[_0xc747('0xe')]),'qs':{'query':util[_0xc747('0xc')]('type:user\x20role:end-user\x20phone:%s',_0x2bf515)}})[_0xc747('0x13')](function(_0x34d19e){var _0x49bc9a;if(_0x34d19e[_0xc747('0x19')][_0xc747('0x20')]){_0x34d19e[_0xc747('0x19')]=_[_0xc747('0x21')](_0x34d19e['results'],{'suspended':![],'role':_0xc747('0x22')});if(_0x34d19e['results'][_0xc747('0x20')]){_0x49bc9a=_[_0xc747('0x23')](_0x34d19e[_0xc747('0x19')]);}}if(_0x49bc9a){logger['info'](_0xc747('0x24'));return _0x49bc9a;}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xc747('0xc')](_0xc747('0x25'),_0x3e4a37[_0xc747('0xe')]),'method':_0xc747('0x26'),'body':{'user':{'role':_0xc747('0x22'),'name':util[_0xc747('0xc')](_0xc747('0x27'),_0x4b3d11||_0x2bf515),'phone':_0x2bf515}}})[_0xc747('0x13')](function(_0x59b402){logger[_0xc747('0xb')](_0xc747('0x28'));return _0x59b402['user'];});}});}function getAuth(_0x1142b3){var _0x3ffb9f;if(_0x1142b3[_0xc747('0x29')]===_0xc747('0x2a')){_0x3ffb9f=util[_0xc747('0xc')]('%s:%s',_0x1142b3[_0xc747('0x2b')],_0x1142b3[_0xc747('0x2a')]);}else if(_0x1142b3[_0xc747('0x29')]===_0xc747('0x2c')){_0x3ffb9f=util[_0xc747('0xc')](_0xc747('0x2d'),_0x1142b3['username'],_0x1142b3[_0xc747('0x2c')]);}return util[_0xc747('0xc')](_0xc747('0x2e'),new Buffer(_0x3ffb9f)['toString']('base64'));}function request(_0x1e6558){logger['debug'](_0xc747('0x2f'),JSON[_0xc747('0x30')](_0x1e6558));return rp(_['defaults'](_0x1e6558,{'method':_0xc747('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x53f51d,_0x48a139){var _0x4e97c9=[];if(_0x53f51d&&_0x53f51d[_0xc747('0x20')]>0x0){_0x4e97c9=_[_0xc747('0x32')](_0x53f51d,_0x48a139);}return _0x4e97c9;}function getCustomFields(_0x3a20d6,_0x2701a5){var _0x3830db=[];var _0x2643d5={'custom_fields':[]};if(_0x3a20d6['length']>0x0){_[_0xc747('0x33')](_0x3a20d6,function(_0x59afd7){if(_['includes']([_0xc747('0x34'),_0xc747('0x35')],_0x59afd7['type'])&&_0x59afd7[_0xc747('0x36')]&&!_0x59afd7['customField']){_0x2643d5[_0x59afd7['nameField']['toLowerCase']()]=_0x59afd7['content'][_0xc747('0x37')]();}else if(_[_0xc747('0x38')](['string','picklist'],_0x59afd7['type'])&&_0x59afd7['idField']&&_0x59afd7[_0xc747('0x39')]){_0x2643d5[_0xc747('0x3a')][_0xc747('0x3b')]({'id':_0x59afd7[_0xc747('0x3c')],'value':_0x59afd7[_0xc747('0x3d')][_0xc747('0x37')]()});}else if(_0x59afd7[_0xc747('0x3e')]===_0xc747('0x3f')&&_0x59afd7[_0xc747('0x40')]&&_0x59afd7[_0xc747('0x3c')]&&_0x59afd7[_0xc747('0x39')]){_0x2701a5[_0x59afd7['variableName']]&&_0x2643d5['custom_fields'][_0xc747('0x3b')]({'id':_0x59afd7[_0xc747('0x3c')],'value':_0x2701a5[_0x59afd7[_0xc747('0x40')]][_0xc747('0x37')]()});}else if(_0x59afd7[_0xc747('0x3e')]==='customVariable'&&_0x59afd7[_0xc747('0x41')]&&_0x59afd7['Variable'][_0xc747('0x42')]&&_0x59afd7[_0xc747('0x3c')]&&_0x59afd7[_0xc747('0x39')]){_0x2701a5[_0x59afd7[_0xc747('0x41')][_0xc747('0x42')]['toLowerCase']()]&&_0x2643d5[_0xc747('0x3a')][_0xc747('0x3b')]({'id':_0x59afd7[_0xc747('0x3c')],'value':_0x2701a5[_0x59afd7[_0xc747('0x41')]['name'][_0xc747('0x43')]()][_0xc747('0x37')]()});}});}return _0x2643d5;}exports['queue']=function(_0xed972e,_0x16e112,_0x4f7b47,_0x5793f1,_0x3ff64c,_0x59a051){var _0x564352,_0x4d2aa9;_0x59a051['remoteUri']=intUtil[_0xc747('0x44')](_0x59a051['remoteUri']);_0x59a051[_0xc747('0x45')]=intUtil[_0xc747('0x44')](_0x59a051[_0xc747('0x45')]);if(_0x3ff64c&&_0x3ff64c[_0xc747('0x46')]){logger[_0xc747('0xb')](_0xc747('0x47'),'Recording\x20is\x20enabled!');_0x16e112[_0xc747('0x48')]=util[_0xc747('0xc')](_0xc747('0x49'),_0x59a051[_0xc747('0x45')],_0x16e112[_0xc747('0x4a')],md5(_0x16e112[_0xc747('0x4a')]));}else{_0x16e112[_0xc747('0x48')]='';}headers[_0xc747('0x4b')]=getAuth(_0x59a051);return getUser(_0x59a051,_0x5793f1['email'])['then'](function(_0x5da9f1){_0x564352=_0x5da9f1;logger[_0xc747('0xb')](_0xc747('0x4c'),_0x564352['id']);return getEndUser(_0x59a051,_0x16e112['calleridname'],_0x16e112[_0xc747('0x4d')]);})[_0xc747('0x13')](function(_0x26de1a){_0x4d2aa9=_0x26de1a;logger['info'](_0xc747('0x4e'),_0x4d2aa9['id']);return getTicket(_0x59a051,_0x564352,_0x4d2aa9,_0x4f7b47,_0x16e112);})[_0xc747('0x13')](function(_0x2b2d86){if(_0x2b2d86){logger[_0xc747('0xb')](_0xc747('0x4f'),_0x2b2d86['id']);switch(_0x59a051[_0xc747('0x3e')]){case _0xc747('0x50'):logger[_0xc747('0xb')](_0xc747('0x47'),_0xc747('0x51'));return request({'uri':util[_0xc747('0xc')](_0xc747('0x52'),_0x59a051['remoteUri'],_0x564352['id'],_0x2b2d86['id']),'method':'POST'});case _0xc747('0x53'):logger[_0xc747('0xb')](_0xc747('0x47'),_0xc747('0x54'));emit(util['format'](_0xc747('0x55'),_0x5793f1[_0xc747('0x42')]),_0xc747('0x56'),{'uri':util[_0xc747('0xc')]('%s/agent/tickets/%s',_0x59a051[_0xc747('0xe')][_0xc747('0x57')](_0xc747('0x58'),''),_0x2b2d86['id'])});break;default:logger[_0xc747('0x59')](_0xc747('0x47'),_0xc747('0x5a'));}}})[_0xc747('0x5b')](function(_0x2a97b7){logger[_0xc747('0x59')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xc747('0x5c')](_0x2a97b7,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x5927fe,_0x58e92b,_0x4c045d,_0x33d8cc,_0x41a5d0,_0x895ef0,_0x3bb74d){var _0x28c3cd,_0x22091f;_0x895ef0[_0xc747('0xe')]=intUtil[_0xc747('0x44')](_0x895ef0[_0xc747('0xe')]);_0x895ef0['serverUrl']=intUtil[_0xc747('0x44')](_0x895ef0[_0xc747('0x45')]);if(_0x3bb74d&&_0x3bb74d[_0xc747('0x5d')]&&_0x3bb74d[_0xc747('0x5d')]!=='none'){logger[_0xc747('0xb')]('[OUTBOUND]',_0xc747('0x5e'));_0x58e92b[_0xc747('0x48')]=util[_0xc747('0xc')](_0xc747('0x49'),_0x895ef0[_0xc747('0x45')],_0x58e92b[_0xc747('0x4a')],md5(_0x58e92b[_0xc747('0x4a')]));}headers['Authorization']=getAuth(_0x895ef0);return getUser(_0x895ef0,_0x33d8cc[_0xc747('0x5f')])[_0xc747('0x13')](function(_0x5e59d7){_0x28c3cd=_0x5e59d7;logger['info'](_0xc747('0x4c'),_0x28c3cd['id']);return getEndUser(_0x895ef0,_0x58e92b[_0xc747('0x60')],_0x58e92b['destcalleridnum']);})[_0xc747('0x13')](function(_0x4bf9c5){_0x22091f=_0x4bf9c5;logger[_0xc747('0xb')](_0xc747('0x4e'),_0x22091f['id']);return getTicket(_0x895ef0,_0x28c3cd,_0x22091f,_0x4c045d,_0x58e92b);})[_0xc747('0x13')](function(_0xf40686){if(_0xf40686){logger[_0xc747('0xb')](_0xc747('0x4f'),_0xf40686['id']);switch(_0x895ef0[_0xc747('0x3e')]){case _0xc747('0x50'):logger[_0xc747('0xb')](_0xc747('0x61'),_0xc747('0x51'));return request({'uri':util[_0xc747('0xc')](_0xc747('0x52'),_0x895ef0[_0xc747('0xe')],_0x28c3cd['id'],_0xf40686['id']),'method':'POST'});case _0xc747('0x53'):logger['info'](_0xc747('0x61'),_0xc747('0x54'));emit(util[_0xc747('0xc')](_0xc747('0x55'),_0x33d8cc[_0xc747('0x42')]),'trigger:browser:url',{'uri':util[_0xc747('0xc')](_0xc747('0x62'),_0x895ef0[_0xc747('0xe')][_0xc747('0x57')](_0xc747('0x58'),''),_0xf40686['id'])});break;default:logger[_0xc747('0x59')](_0xc747('0x61'),_0xc747('0x5a'));}}})[_0xc747('0x5b')](function(_0x568c95){logger[_0xc747('0x59')](_0xc747('0x63'),util['inspect'](_0x568c95,{'showHidden':!![],'depth':null}));});};exports[_0xc747('0x64')]=function(_0x183692,_0x222f62,_0x12149e,_0x31f1a2,_0x497672,_0x5efea8){var _0x3054f7,_0x5f41a4;_0x5efea8[_0xc747('0xe')]=intUtil[_0xc747('0x44')](_0x5efea8[_0xc747('0xe')]);_0x5efea8[_0xc747('0x45')]=intUtil[_0xc747('0x44')](_0x5efea8[_0xc747('0x45')]);if(_0x497672&&_0x497672['monitor_format']){logger[_0xc747('0xb')]('['+_0x222f62[_0xc747('0x65')][_0xc747('0x66')]()+']',_0xc747('0x5e'));_0x222f62[_0xc747('0x48')]=util[_0xc747('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5efea8[_0xc747('0x45')],_0x222f62['uniqueid'],md5(_0x222f62[_0xc747('0x4a')]));}else{_0x222f62[_0xc747('0x48')]='';}headers[_0xc747('0x4b')]=getAuth(_0x5efea8);return getUser(_0x5efea8)[_0xc747('0x13')](function(_0x1f219d){_0x3054f7=_0x1f219d;logger['info'](_0xc747('0x4c'),_0x3054f7['id']);return getEndUser(_0x5efea8,_0x222f62[_0xc747('0x67')],_0x222f62[_0xc747('0x4d')]);})['then'](function(_0x5d794c){_0x5f41a4=_0x5d794c;logger[_0xc747('0xb')]('The\x20Enduser\x20ID\x20is:',_0x5f41a4['id']);return getTicket(_0x5efea8,_0x3054f7,_0x5f41a4,_0x12149e,_0x222f62);})['then'](function(_0x108abc){if(_0x108abc){logger[_0xc747('0xb')](_0xc747('0x4f'),_0x108abc['id']);}})[_0xc747('0x5b')](function(_0x4e861b){logger['error']('['+_0x222f62['lastevent'][_0xc747('0x66')]()+']'+_0xc747('0x68'),util[_0xc747('0x5c')](_0x4e861b,{'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 ab36357..cc6a05e 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 _0x2a62=['variableName','Variable','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','then','add','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','profile','name','user','Administrator','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','enduserType','startCase','moduleCreate','role','first_name','last_name','data','details','log','moduleSearch','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','lead','Leads','Creating\x20new\x20call...','administrator','Subject','getString','Subjects','Description','Descriptions','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','mm:ss','answertime','utc','endtime','YYYY-MM-DDTHH:mm:ss','diff','lastevent','called','Called','complete','connect','Call_Result','Answered','Rejected','abandoned','timeout','Call_Start_Time','outbound','starttime','agentcalledAt','Call_Type','/crm/v2/Calls','code','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','The\x20User\x20ID\x20is:','calleridname','Inbound','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','none','[OUTBOUND]','com','destcalleridname','Outbound','trigger:browser:url','unmanaged','toUpperCase','lodash','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','idField','content','toString','variable'];(function(_0x5466ab,_0x227b13){var _0x40751a=function(_0x477f9e){while(--_0x477f9e){_0x5466ab['push'](_0x5466ab['shift']());}};_0x40751a(++_0x227b13);}(_0x2a62,0x111));var _0x22a6=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x2a62[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0x22a6('0x0'));var rp=require('request-promise');var md5=require(_0x22a6('0x1'));var util=require(_0x22a6('0x2'));var intUtil=require(_0x22a6('0x3'));var moment=require(_0x22a6('0x4'));var Redis=require(_0x22a6('0x5'));var BPromise=require(_0x22a6('0x6'));var config=require(_0x22a6('0x7'));var logger=require(_0x22a6('0x8'))(_0x22a6('0x9'));config[_0x22a6('0xa')]=_[_0x22a6('0xb')](config[_0x22a6('0xa')],{'host':_0x22a6('0xc'),'port':0x18eb});var io=require(_0x22a6('0xd'))(new Redis(config[_0x22a6('0xa')]));function emit(_0xdff2e,_0x261ecf,_0x470d27){io['to'](_0xdff2e)[_0x22a6('0xe')](_0x261ecf,_0x470d27);}function request(_0x12d4d4){logger[_0x22a6('0xf')](_0x22a6('0x10'),JSON[_0x22a6('0x11')](_0x12d4d4));return rp(_0x12d4d4);}function getCustomFields(_0x4a8360,_0xaac342){var _0x3fc63d={};if(_0x4a8360[_0x22a6('0x12')]>0x0){_[_0x22a6('0x13')](_0x4a8360,function(_0x2549aa){if(_[_0x22a6('0x14')](['string','picklist'],_0x2549aa['type'])&&_0x2549aa['idField']){_0x3fc63d[_0x2549aa[_0x22a6('0x15')]]=_0x2549aa[_0x22a6('0x16')][_0x22a6('0x17')]();}else if(_0x2549aa['type']===_0x22a6('0x18')&&_0x2549aa['variableName']&&_0x2549aa[_0x22a6('0x15')]&&_0xaac342[_0x2549aa[_0x22a6('0x19')]]){_0x3fc63d[_0x2549aa[_0x22a6('0x15')]]=_0xaac342[_0x2549aa[_0x22a6('0x19')]]['toString']();}else if(_0x2549aa['type']==='customVariable'&&_0x2549aa[_0x22a6('0x1a')]&&_0x2549aa[_0x22a6('0x1a')]['name']&&_0x2549aa[_0x22a6('0x15')]&&_0xaac342[_0x2549aa[_0x22a6('0x1a')]['name'][_0x22a6('0x1b')]()]){_0x3fc63d[_0x2549aa[_0x22a6('0x15')]]=_0xaac342[_0x2549aa[_0x22a6('0x1a')]['name']['toLowerCase']()][_0x22a6('0x17')]();}});}return _0x3fc63d;}function getName(_0x558373){if(_0x558373[_0x22a6('0x1c')]('\x20')>0x0){var _0x5dd7ba=_0x558373[_0x22a6('0x1d')](/ (.+)/);if(_0x5dd7ba[0x1]){return _0x5dd7ba;}}return[_0x558373,_0x558373];}var accountsTokens={};function getAccessToken(_0x4db041){return new Promise(function(_0x523caf,_0x36ba52){if(!_[_0x22a6('0x1e')](accountsTokens[_0x4db041['id']])&&!_[_0x22a6('0x1e')](accountsTokens[_0x4db041['id']][_0x22a6('0x1f')])){if(moment()[_0x22a6('0x20')](accountsTokens[_0x4db041['id']][_0x22a6('0x21')])){_0x523caf(accountsTokens[_0x4db041['id']]['access_token']);}}var _0x331dfa;switch(_0x4db041['zone']){case'US':_0x331dfa=_0x22a6('0x22');break;case'AU':_0x331dfa=_0x22a6('0x23');break;case'EU':_0x331dfa='https://accounts.zoho.eu';break;case'IN':_0x331dfa='https://accounts.zoho.in';break;case'CN':_0x331dfa=_0x22a6('0x24');break;default:_0x331dfa='https://accounts.zoho.eu';break;}var _0x405c42={'method':_0x22a6('0x25'),'uri':_0x331dfa+'/oauth/v2/token','qs':{'refresh_token':_0x4db041[_0x22a6('0x26')],'client_id':_0x4db041[_0x22a6('0x27')],'client_secret':_0x4db041[_0x22a6('0x28')],'grant_type':_0x22a6('0x29')},'json':!![]};return rp(_0x405c42)[_0x22a6('0x2a')](function(_0xe4e6e9){accountsTokens[_0x4db041['id']]={'access_token':_0xe4e6e9[_0x22a6('0x1f')],'expires_in':moment()[_0x22a6('0x2b')](_0xe4e6e9['expires_in'],'seconds')};_0x523caf(_0xe4e6e9[_0x22a6('0x1f')]);})['catch'](function(_0x2b8c66){logger[_0x22a6('0x2c')](_0x22a6('0x2d'),_0x2b8c66[_0x22a6('0x2e')]);_0x36ba52(_0x2b8c66);});});}function getUser(_0x5b5caa,_0x3f3d92,_0x2a154d,_0x42ddad){logger[_0x22a6('0x2f')](_0x22a6('0x30'));return request({'method':_0x22a6('0x31'),'uri':util[_0x22a6('0x32')](_0x22a6('0x33'),_0x3f3d92),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x22a6('0x34')+_0x5b5caa},'json':!![]})[_0x22a6('0x2a')](function(_0x35a8a){if(_0x35a8a[_0x22a6('0x35')]){var _0x33219f=-0x1;if(_[_0x22a6('0x36')](_0x35a8a[_0x22a6('0x35')])){if(!_[_0x22a6('0x1e')](_0x42ddad)){_0x33219f=_[_0x22a6('0x37')](_0x35a8a[_0x22a6('0x35')],function(_0x5cb694){return _0x5cb694[_0x22a6('0x38')]===_0x42ddad;});}if(_0x33219f>=0x0){logger['info']('Agent\x20found!');}else{logger[_0x22a6('0x2f')]('Using\x20the\x20admin\x20account!');_0x33219f=_[_0x22a6('0x37')](_0x35a8a[_0x22a6('0x35')],function(_0x299673){return _0x299673[_0x22a6('0x39')][_0x22a6('0x3a')]==='Administrator';});}return _0x35a8a[_0x22a6('0x35')][_0x33219f];}else{if(_0x35a8a[_0x22a6('0x3b')][_0x22a6('0x39')][_0x22a6('0x3a')]===_0x22a6('0x3c')){logger[_0x22a6('0x2f')](_0x22a6('0x3d'));user=_0x35a8a[_0x22a6('0x3b')];return user;}else{logger[_0x22a6('0x2c')](_0x22a6('0x3e'),JSON[_0x22a6('0x11')](_0x35a8a));throw new Error(_0x22a6('0x3f')+JSON[_0x22a6('0x11')](_0x35a8a));}}}else{logger[_0x22a6('0x2c')](_0x22a6('0x3e'),JSON[_0x22a6('0x11')](_0x35a8a));throw new Error(_0x22a6('0x3f')+JSON[_0x22a6('0x11')](_0x35a8a));}})[_0x22a6('0x40')](function(_0x5438d5){console[_0x22a6('0x2c')](_0x5438d5);});}function getZohoUser(_0x1d1a40,_0x250936){return new BPromise(function(_0x3b27f7,_0x175c75){request(_0x1d1a40)[_0x22a6('0x2a')](function(_0x4cef73){var _0x19d754=null;if(_0x4cef73){_0x19d754=_0x4cef73['data'][0x0];_0x19d754[_0x22a6('0x41')]=_0x250936;}_0x3b27f7(_0x19d754);})[_0x22a6('0x40')](function(_0x455d15){_0x175c75(_0x455d15);});});}function createEndUser(_0x10570c,_0x197fbc,_0xd78282,_0x4c12dc,_0x11008a,_0xda591){var _0xd78282=getName(_0xd78282);return request({'method':_0x22a6('0x25'),'uri':'https://www.zohoapis.'+_0x197fbc+'/crm/v2/'+_[_0x22a6('0x42')](_0xda591[_0x22a6('0x43')])+'s','body':{'data':[{'Last_Name':_0xd78282[0x1],'First_Name':_0xd78282[0x0],'Phone':_0x4c12dc,'Owner':{'name':!_[_0x22a6('0x1e')](_0x11008a[_0x22a6('0x44')][_0x22a6('0x3a')])?_0x11008a[_0x22a6('0x44')][_0x22a6('0x3a')]:!_[_0x22a6('0x1e')](_0x11008a[_0x22a6('0x45')])?_0x11008a['first_name']+'\x20'+_0x11008a[_0x22a6('0x46')]:_0x11008a['last_name'],'id':_0x11008a['id']}}]},'headers':{'Authorization':_0x22a6('0x34')+_0x10570c},'json':!![]})['then'](function(_0x27be5c){if(_0x27be5c&&_0x27be5c[_0x22a6('0x47')][0x0]['code']==='SUCCESS'){var _0xc4d931=_0x27be5c[_0x22a6('0x47')][0x0][_0x22a6('0x48')];_0xc4d931[_0x22a6('0x41')]=_[_0x22a6('0x42')](_0xda591[_0x22a6('0x43')])+'s';return _0xc4d931;}logger['error']('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error('Error:\x20'+JSON[_0x22a6('0x11')](data));})[_0x22a6('0x40')](function(_0xced5b8){console[_0x22a6('0x49')]('CREATE\x20ERROR',_0xced5b8);});}function getEndUser(_0x4f15ab,_0x5db8d6,_0x5df817,_0x4e147a,_0x10220f,_0xbca23f,_0x4a8e69){var _0x12dbc8={'method':'GET','uri':'','headers':{'Authorization':_0x22a6('0x34')+_0x4f15ab},'json':!![]};switch(_0x4a8e69[_0x22a6('0x4a')]){case'contact_lead':_0x12dbc8[_0x22a6('0x4b')]=_0x22a6('0x4c')+_0x5db8d6+_0x22a6('0x4d')+_0x10220f+'))';return getZohoUser(_0x12dbc8,_0x22a6('0x4e'))[_0x22a6('0x2a')](function(_0x39250c){if(_0x39250c)return _0x39250c;_0x12dbc8[_0x22a6('0x4b')]=_0x22a6('0x4c')+_0x5db8d6+_0x22a6('0x4f')+_0x10220f+'))';return getZohoUser(_0x12dbc8,'Leads')['then'](function(_0x6b5383){if(_0x6b5383)return _0x6b5383;if(_0x4a8e69[_0x22a6('0x43')]!=_0x22a6('0x50')){return createEndUser(_0x4f15ab,_0x5db8d6,_0x4e147a,_0x10220f,_0xbca23f,_0x4a8e69);}else{return{};}});});break;case _0x22a6('0x51'):_0x12dbc8[_0x22a6('0x4b')]='https://www.zohoapis.'+_0x5db8d6+_0x22a6('0x4d')+_0x10220f+'))';return getZohoUser(_0x12dbc8,_0x22a6('0x4e'))[_0x22a6('0x2a')](function(_0x502910){if(_0x502910)return _0x502910;if(_0x4a8e69['moduleCreate']!=_0x22a6('0x50')){return createEndUser(_0x4f15ab,_0x5db8d6,_0x4e147a,_0x10220f,_0xbca23f,_0x4a8e69);}else{return{};}});break;case _0x22a6('0x52'):_0x12dbc8[_0x22a6('0x4b')]=_0x22a6('0x4c')+_0x5db8d6+_0x22a6('0x4f')+_0x10220f+'))';return getZohoUser(_0x12dbc8,_0x22a6('0x53'))[_0x22a6('0x2a')](function(_0xbcf928){if(_0xbcf928)return _0xbcf928;if(_0x4a8e69[_0x22a6('0x43')]!=_0x22a6('0x50')){return createEndUser(_0x4f15ab,_0x5db8d6,_0x4e147a,_0x10220f,_0xbca23f,_0x4a8e69);}else{return{};}});break;}}function getCall(_0x2424b8,_0x1065f8,_0x173c9f,_0x8dcf1b,_0x34b3d9,_0x34ed4d,_0x1acc78,_0x58ad5b){logger[_0x22a6('0x2f')](_0x22a6('0x54'));var _0x40223b={};_0x40223b['Owner']={'name':!_[_0x22a6('0x1e')](_0x8dcf1b[_0x22a6('0x44')]['name'])&&!_['isNil'](_0x8dcf1b[_0x22a6('0x39')][_0x22a6('0x3a')])&&_0x8dcf1b[_0x22a6('0x39')][_0x22a6('0x3a')]===_0x22a6('0x55')?_0x8dcf1b[_0x22a6('0x44')][_0x22a6('0x3a')]:!_[_0x22a6('0x1e')](_0x8dcf1b[_0x22a6('0x45')])?_0x8dcf1b[_0x22a6('0x45')]+'\x20'+_0x8dcf1b[_0x22a6('0x46')]:_0x8dcf1b[_0x22a6('0x46')],'id':_0x8dcf1b['id']};_0x40223b[_0x22a6('0x56')]=intUtil[_0x22a6('0x57')](_0x34ed4d[_0x22a6('0x58')],_0x1acc78,'\x20');_0x40223b[_0x22a6('0x59')]=intUtil[_0x22a6('0x57')](_0x34ed4d[_0x22a6('0x5a')],_0x1acc78,'\x0a');if(_0x34b3d9[_0x22a6('0x41')]==='Contacts'){_0x40223b['Who_Id']={'name':!_[_0x22a6('0x1e')](_0x34b3d9[_0x22a6('0x5b')])?_0x34b3d9[_0x22a6('0x5b')]:!_['isNil'](_0x34b3d9['First_Name'])?_0x34b3d9[_0x22a6('0x5c')]+'\x20'+_0x34b3d9[_0x22a6('0x5d')]:_0x34b3d9['Last_Name'],'id':_0x34b3d9['id']};}if(_0x34b3d9[_0x22a6('0x41')]===_0x22a6('0x53')){_0x40223b['What_Id']={'name':!_[_0x22a6('0x1e')](_0x34b3d9[_0x22a6('0x5b')])?_0x34b3d9[_0x22a6('0x5b')]:!_[_0x22a6('0x1e')](_0x34b3d9[_0x22a6('0x5c')])?_0x34b3d9[_0x22a6('0x5c')]+'\x20'+_0x34b3d9[_0x22a6('0x5d')]:_0x34b3d9[_0x22a6('0x5d')],'id':_0x34b3d9['id']};_0x40223b[_0x22a6('0x5e')]=_[_0x22a6('0x42')](_0x34b3d9['enduserType']);}if(_0x1acc78[_0x22a6('0x5f')]){_0x40223b[_0x22a6('0x60')]=moment['utc'](parseInt(_0x1acc78['talktime'])*0x3e8)[_0x22a6('0x32')](_0x22a6('0x61'));}else if(_0x1acc78[_0x22a6('0x62')]&&_0x1acc78['endtime']){_0x40223b[_0x22a6('0x60')]=moment[_0x22a6('0x63')](moment(_0x1acc78[_0x22a6('0x64')],_0x22a6('0x65'))[_0x22a6('0x66')](moment(_0x1acc78['starttime'],_0x22a6('0x65'))))['format'](_0x22a6('0x61'));}switch(_0x1acc78[_0x22a6('0x67')]){case _0x22a6('0x68'):_0x40223b['Call_Result']=_0x22a6('0x69');break;case _0x22a6('0x6a'):case _0x22a6('0x6b'):_0x40223b[_0x22a6('0x6c')]=_0x22a6('0x6d');break;case'rejected':_0x40223b[_0x22a6('0x6c')]=_0x22a6('0x6e');break;case _0x22a6('0x6f'):_0x40223b[_0x22a6('0x6c')]='Abandoned';break;case _0x22a6('0x70'):_0x40223b[_0x22a6('0x6c')]='Timeout';default:}_0x40223b[_0x22a6('0x71')]=(_0x58ad5b===_0x22a6('0x72')?moment(_0x1acc78[_0x22a6('0x73')])[_0x22a6('0x32')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x1acc78[_0x22a6('0x74')])[_0x22a6('0x32')](_0x22a6('0x65')))||moment()['format'](_0x22a6('0x65'));_0x40223b[_0x22a6('0x75')]=_0x58ad5b||'Inbound';_0x40223b=_['merge'](_0x40223b,getCustomFields(_0x34ed4d['Fields'],_0x1acc78));return request({'method':_0x22a6('0x25'),'uri':_0x22a6('0x4c')+_0x1065f8+_0x22a6('0x76'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2424b8},'body':{'data':[_0x40223b]},'json':!![]})[_0x22a6('0x2a')](function(_0x83108){if(_0x83108&&_0x83108[_0x22a6('0x47')][0x0][_0x22a6('0x77')]==='SUCCESS'){logger[_0x22a6('0x2f')]('Call\x20created!');return{'id':_0x83108[_0x22a6('0x47')][0x0][_0x22a6('0x48')]['id']};}})[_0x22a6('0x40')](function(_0x523ce9){logger[_0x22a6('0x2f')](_0x22a6('0x78'),_0x523ce9['stack']);console['log'](_0x22a6('0x78'),_0x523ce9);});}exports[_0x22a6('0x79')]=function(_0x6462fc,_0x617539,_0x9e5ba6,_0x1aeb84,_0x3e9a75,_0x2705ce){var _0x15d335,_0x23a563,_0x2b305c;_0x2705ce[_0x22a6('0x7a')]=intUtil[_0x22a6('0x7b')](_0x2705ce['host']);_0x2705ce[_0x22a6('0x7c')]=intUtil[_0x22a6('0x7b')](_0x2705ce[_0x22a6('0x7c')]);if(_0x3e9a75&&_0x3e9a75[_0x22a6('0x7d')]){logger[_0x22a6('0x2f')]('[QUEUE]',_0x22a6('0x7e'));_0x617539[_0x22a6('0x7f')]=_0x2705ce['serverUrl']+_0x22a6('0x80')+_0x617539[_0x22a6('0x81')]+_0x22a6('0x82')+md5(_0x617539['uniqueid']);}else{_0x617539[_0x22a6('0x7f')]='';}var _0x234605=_0x2705ce[_0x22a6('0x7a')]===_0x22a6('0x83')?'eu':'com';return getAccessToken(_0x2705ce)['then'](function(_0x57f188){_0x2b305c=_0x57f188;return getUser(_0x2b305c,_0x234605,_0x2705ce,_0x1aeb84[_0x22a6('0x38')]);})[_0x22a6('0x2a')](function(_0x1cf63f){_0x15d335=_0x1cf63f;logger[_0x22a6('0x2f')](_0x22a6('0x84'),_0x15d335['id']);return getEndUser(_0x2b305c,_0x234605,_0x2705ce,_0x617539[_0x22a6('0x85')],_0x617539['calleridnum'],_0x15d335,_0x9e5ba6);})['then'](function(_0x5b2157){_0x23a563=_0x5b2157;return getCall(_0x2b305c,_0x234605,_0x2705ce,_0x15d335,_0x23a563,_0x9e5ba6,_0x617539,_0x22a6('0x86'));})[_0x22a6('0x2a')](function(_0x306125){if(_0x306125){logger[_0x22a6('0x2f')](_0x22a6('0x87'),_0x306125['id']);logger[_0x22a6('0x2f')](_0x22a6('0x88'),_0x22a6('0x89'));emit(util[_0x22a6('0x32')](_0x22a6('0x8a'),_0x1aeb84[_0x22a6('0x3a')]),'trigger:browser:url',{'uri':_0x22a6('0x8b')+_0x2705ce[_0x22a6('0x7a')]+_0x22a6('0x8c')+_0x306125['id']});}})[_0x22a6('0x40')](function(_0x59c06b){logger[_0x22a6('0x2c')](_0x22a6('0x88'),JSON[_0x22a6('0x11')](_0x59c06b));});};exports[_0x22a6('0x72')]=function(_0xdab623,_0x1c15b6,_0x423397,_0x54b69e,_0x5b213a,_0x512181,_0x20a12b){var _0x4d16a7,_0x2344c9,_0x36ad0d;_0x512181['host']=intUtil[_0x22a6('0x7b')](_0x512181[_0x22a6('0x7a')]);_0x512181[_0x22a6('0x7c')]=intUtil['stripTrailingSlash'](_0x512181[_0x22a6('0x7c')]);if(_0x20a12b&&_0x20a12b['recordingFormat']&&_0x20a12b['recordingFormat']!==_0x22a6('0x8d')){logger['info'](_0x22a6('0x8e'),_0x22a6('0x7e'));_0x1c15b6['recordingURL']=_0x512181[_0x22a6('0x7c')]+'/api/voice/recordings/'+_0x1c15b6['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x1c15b6[_0x22a6('0x81')]);}var _0x1f0a5a=_0x512181[_0x22a6('0x7a')]===_0x22a6('0x83')?'eu':_0x22a6('0x8f');return getAccessToken(_0x512181)[_0x22a6('0x2a')](function(_0x26fc8a){_0x36ad0d=_0x26fc8a;return getUser(_0x36ad0d,_0x1f0a5a,_0x512181,_0x54b69e[_0x22a6('0x38')]);})[_0x22a6('0x2a')](function(_0x2c4f27){_0x4d16a7=_0x2c4f27;logger['info']('The\x20User\x20ID\x20is:',_0x4d16a7['id']);return getEndUser(_0x36ad0d,_0x1f0a5a,_0x512181,_0x1c15b6[_0x22a6('0x90')],_0x1c15b6['destcalleridnum'],_0x4d16a7,_0x423397);})[_0x22a6('0x2a')](function(_0x317183){_0x2344c9=_0x317183;return getCall(_0x36ad0d,_0x1f0a5a,_0x512181,_0x4d16a7,_0x2344c9,_0x423397,_0x1c15b6,_0x22a6('0x91'));})[_0x22a6('0x2a')](function(_0x69598c){if(_0x69598c){logger[_0x22a6('0x2f')]('The\x20Call\x20ID\x20is:',_0x69598c['id']);logger[_0x22a6('0x2f')](_0x22a6('0x8e'),_0x22a6('0x89'));emit(util[_0x22a6('0x32')](_0x22a6('0x8a'),_0x54b69e[_0x22a6('0x3a')]),_0x22a6('0x92'),{'uri':_0x22a6('0x8b')+_0x512181[_0x22a6('0x7a')]+_0x22a6('0x8c')+_0x69598c['id']});}})[_0x22a6('0x40')](function(_0x47d355){logger[_0x22a6('0x2c')](_0x22a6('0x8e'),JSON[_0x22a6('0x11')](_0x47d355));});};exports[_0x22a6('0x93')]=function(_0x51ca52,_0x448568,_0x820056,_0x213cb8,_0x279d4d,_0xde9e31){var _0x2ceb1b,_0x385933,_0x36c09c;_0xde9e31[_0x22a6('0x7a')]=intUtil[_0x22a6('0x7b')](_0xde9e31[_0x22a6('0x7a')]);_0xde9e31[_0x22a6('0x7c')]=intUtil[_0x22a6('0x7b')](_0xde9e31[_0x22a6('0x7c')]);if(_0x279d4d&&_0x279d4d[_0x22a6('0x7d')]){logger[_0x22a6('0x2f')]('['+_0x448568['lastevent'][_0x22a6('0x94')]()+']',_0x22a6('0x7e'));_0x448568[_0x22a6('0x7f')]=_0xde9e31[_0x22a6('0x7c')]+'/api/voice/recordings/'+_0x448568[_0x22a6('0x81')]+_0x22a6('0x82')+md5(_0x448568[_0x22a6('0x81')]);}else{_0x448568[_0x22a6('0x7f')]='';}var _0x5e4242=_0xde9e31[_0x22a6('0x7a')]==='zoho.eu'?'eu':_0x22a6('0x8f');return getAccessToken(_0xde9e31)[_0x22a6('0x2a')](function(_0x4989e3){_0x36c09c=_0x4989e3;return getUser(_0x36c09c,_0x5e4242,_0xde9e31);})[_0x22a6('0x2a')](function(_0x1f73f6){_0x2ceb1b=_0x1f73f6;logger[_0x22a6('0x2f')](_0x22a6('0x84'),_0x2ceb1b['id']);return getEndUser(_0x36c09c,_0x5e4242,_0xde9e31,_0x448568[_0x22a6('0x85')],_0x448568['calleridnum'],_0x2ceb1b,_0x820056);})[_0x22a6('0x2a')](function(_0x190d2c){_0x385933=_0x190d2c;return getCall(_0x36c09c,_0x5e4242,_0xde9e31,_0x2ceb1b,_0x385933,_0x820056,_0x448568,_0x22a6('0x86'));})[_0x22a6('0x2a')](function(_0x2029aa){if(_0x2029aa){logger[_0x22a6('0x2f')](_0x22a6('0x87'),_0x2029aa['id']);}})[_0x22a6('0x40')](function(_0x5f59c0){logger[_0x22a6('0x2c')]('['+_0x448568['lastevent'][_0x22a6('0x94')]()+']',JSON[_0x22a6('0x11')](_0x5f59c0));});}; \ No newline at end of file +var _0xb973=['What_Id','Full_Name','talktime','Call_Duration','utc','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','called','Call_Result','Answered','Rejected','abandoned','timeout','Call_Start_Time','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','com','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','https://crm.','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','/crm/EntityInfo.do?module=Calls&id=','unmanaged','lastevent','toUpperCase','lodash','md5','util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','string','type','idField','content','toString','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','then','add','seconds','catch','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','profile','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','last_name','code','SUCCESS','data','details','startCase','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Who_Id','First_Name','Last_Name'];(function(_0x13ceed,_0xecda6a){var _0x545d11=function(_0x3f40a0){while(--_0x3f40a0){_0x13ceed['push'](_0x13ceed['shift']());}};_0x545d11(++_0xecda6a);}(_0xb973,0xc9));var _0x3b97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb973[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3b97('0x0'));var rp=require('request-promise');var md5=require(_0x3b97('0x1'));var util=require(_0x3b97('0x2'));var intUtil=require('./util');var moment=require(_0x3b97('0x3'));var Redis=require(_0x3b97('0x4'));var BPromise=require(_0x3b97('0x5'));var config=require(_0x3b97('0x6'));var logger=require(_0x3b97('0x7'))(_0x3b97('0x8'));config[_0x3b97('0x9')]=_[_0x3b97('0xa')](config['redis'],{'host':_0x3b97('0xb'),'port':0x18eb});var io=require(_0x3b97('0xc'))(new Redis(config[_0x3b97('0x9')]));function emit(_0x7e23b8,_0x27e67f,_0x10824d){io['to'](_0x7e23b8)[_0x3b97('0xd')](_0x27e67f,_0x10824d);}function request(_0x3d70e9){logger[_0x3b97('0xe')](_0x3b97('0xf'),JSON[_0x3b97('0x10')](_0x3d70e9));return rp(_0x3d70e9);}function getCustomFields(_0x214cbe,_0x12a0f7){var _0x26ecd8={};if(_0x214cbe[_0x3b97('0x11')]>0x0){_['forEach'](_0x214cbe,function(_0x23d927){if(_['includes']([_0x3b97('0x12'),'picklist'],_0x23d927[_0x3b97('0x13')])&&_0x23d927[_0x3b97('0x14')]){_0x26ecd8[_0x23d927['idField']]=_0x23d927[_0x3b97('0x15')][_0x3b97('0x16')]();}else if(_0x23d927[_0x3b97('0x13')]==='variable'&&_0x23d927['variableName']&&_0x23d927[_0x3b97('0x14')]&&_0x12a0f7[_0x23d927['variableName']]){_0x26ecd8[_0x23d927[_0x3b97('0x14')]]=_0x12a0f7[_0x23d927[_0x3b97('0x17')]]['toString']();}else if(_0x23d927['type']==='customVariable'&&_0x23d927[_0x3b97('0x18')]&&_0x23d927[_0x3b97('0x18')][_0x3b97('0x19')]&&_0x23d927['idField']&&_0x12a0f7[_0x23d927[_0x3b97('0x18')][_0x3b97('0x19')][_0x3b97('0x1a')]()]){_0x26ecd8[_0x23d927[_0x3b97('0x14')]]=_0x12a0f7[_0x23d927[_0x3b97('0x18')][_0x3b97('0x19')]['toLowerCase']()]['toString']();}});}return _0x26ecd8;}function getName(_0x19b79a){if(_0x19b79a[_0x3b97('0x1b')]('\x20')>0x0){var _0x5b4646=_0x19b79a[_0x3b97('0x1c')](/ (.+)/);if(_0x5b4646[0x1]){return _0x5b4646;}}return[_0x19b79a,_0x19b79a];}var accountsTokens={};function getAccessToken(_0xe9e56b){return new Promise(function(_0x26c505,_0x5e28ce){if(!_[_0x3b97('0x1d')](accountsTokens[_0xe9e56b['id']])&&!_[_0x3b97('0x1d')](accountsTokens[_0xe9e56b['id']][_0x3b97('0x1e')])){if(moment()['isBefore'](accountsTokens[_0xe9e56b['id']][_0x3b97('0x1f')])){_0x26c505(accountsTokens[_0xe9e56b['id']][_0x3b97('0x1e')]);}}var _0x3ac890;switch(_0xe9e56b[_0x3b97('0x20')]){case'US':_0x3ac890=_0x3b97('0x21');break;case'AU':_0x3ac890='https://accounts.zoho.com.au';break;case'EU':_0x3ac890=_0x3b97('0x22');break;case'IN':_0x3ac890=_0x3b97('0x23');break;case'CN':_0x3ac890=_0x3b97('0x24');break;default:_0x3ac890=_0x3b97('0x22');break;}var _0x5377a8={'method':_0x3b97('0x25'),'uri':_0x3ac890+_0x3b97('0x26'),'qs':{'refresh_token':_0xe9e56b[_0x3b97('0x27')],'client_id':_0xe9e56b['clientId'],'client_secret':_0xe9e56b[_0x3b97('0x28')],'grant_type':_0x3b97('0x29')},'json':!![]};return rp(_0x5377a8)[_0x3b97('0x2a')](function(_0x4b7be3){accountsTokens[_0xe9e56b['id']]={'access_token':_0x4b7be3[_0x3b97('0x1e')],'expires_in':moment()[_0x3b97('0x2b')](_0x4b7be3[_0x3b97('0x1f')],_0x3b97('0x2c'))};_0x26c505(_0x4b7be3['access_token']);})[_0x3b97('0x2d')](function(_0x57fcef){logger['error']('Failing\x20creating\x20the\x20access_token',_0x57fcef[_0x3b97('0x2e')]);_0x5e28ce(_0x57fcef);});});}function getUser(_0x2b9bde,_0x47e1be,_0x258fd4,_0x4c7766){logger[_0x3b97('0x2f')](_0x3b97('0x30'));return request({'method':_0x3b97('0x31'),'uri':util[_0x3b97('0x32')](_0x3b97('0x33'),_0x47e1be),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x3b97('0x34')+_0x2b9bde},'json':!![]})[_0x3b97('0x2a')](function(_0x2a4b22){if(_0x2a4b22[_0x3b97('0x35')]){var _0x39a363=-0x1;if(_[_0x3b97('0x36')](_0x2a4b22[_0x3b97('0x35')])){if(!_[_0x3b97('0x1d')](_0x4c7766)){_0x39a363=_[_0x3b97('0x37')](_0x2a4b22[_0x3b97('0x35')],function(_0x159b51){return _0x159b51[_0x3b97('0x38')]===_0x4c7766;});}if(_0x39a363>=0x0){logger['info'](_0x3b97('0x39'));}else{logger['info'](_0x3b97('0x3a'));_0x39a363=_[_0x3b97('0x37')](_0x2a4b22['users'],function(_0x9f5d42){return _0x9f5d42['profile'][_0x3b97('0x19')]===_0x3b97('0x3b');});}return _0x2a4b22[_0x3b97('0x35')][_0x39a363];}else{if(_0x2a4b22[_0x3b97('0x3c')][_0x3b97('0x3d')][_0x3b97('0x19')]===_0x3b97('0x3b')){logger[_0x3b97('0x2f')](_0x3b97('0x3a'));user=_0x2a4b22['user'];return user;}else{logger[_0x3b97('0x3e')](_0x3b97('0x3f'),JSON[_0x3b97('0x10')](_0x2a4b22));throw new Error(_0x3b97('0x40')+JSON[_0x3b97('0x10')](_0x2a4b22));}}}else{logger['error'](_0x3b97('0x3f'),JSON['stringify'](_0x2a4b22));throw new Error(_0x3b97('0x40')+JSON[_0x3b97('0x10')](_0x2a4b22));}})['catch'](function(_0x35f0c0){console[_0x3b97('0x3e')](_0x35f0c0);});}function getZohoUser(_0x144ccb,_0x50781f){return new BPromise(function(_0x1139cf,_0x32bbb5){request(_0x144ccb)['then'](function(_0x1e47ba){var _0x5c61a8=null;if(_0x1e47ba){_0x5c61a8=_0x1e47ba['data'][0x0];_0x5c61a8[_0x3b97('0x41')]=_0x50781f;}_0x1139cf(_0x5c61a8);})['catch'](function(_0x4891dd){_0x32bbb5(_0x4891dd);});});}function createEndUser(_0x21f6cf,_0x316678,_0x31bfc8,_0x4a4478,_0x30c9c1,_0x3325c5){var _0x31bfc8=getName(_0x31bfc8);return request({'method':_0x3b97('0x25'),'uri':_0x3b97('0x42')+_0x316678+_0x3b97('0x43')+_['startCase'](_0x3325c5[_0x3b97('0x44')])+'s','body':{'data':[{'Last_Name':_0x31bfc8[0x1],'First_Name':_0x31bfc8[0x0],'Phone':_0x4a4478,'Owner':{'name':!_[_0x3b97('0x1d')](_0x30c9c1[_0x3b97('0x45')][_0x3b97('0x19')])?_0x30c9c1[_0x3b97('0x45')][_0x3b97('0x19')]:!_[_0x3b97('0x1d')](_0x30c9c1[_0x3b97('0x46')])?_0x30c9c1[_0x3b97('0x46')]+'\x20'+_0x30c9c1[_0x3b97('0x47')]:_0x30c9c1[_0x3b97('0x47')],'id':_0x30c9c1['id']}}]},'headers':{'Authorization':_0x3b97('0x34')+_0x21f6cf},'json':!![]})[_0x3b97('0x2a')](function(_0x1bf0ce){if(_0x1bf0ce&&_0x1bf0ce['data'][0x0][_0x3b97('0x48')]===_0x3b97('0x49')){var _0x5d7fa=_0x1bf0ce[_0x3b97('0x4a')][0x0][_0x3b97('0x4b')];_0x5d7fa[_0x3b97('0x41')]=_[_0x3b97('0x4c')](_0x3325c5[_0x3b97('0x44')])+'s';return _0x5d7fa;}logger[_0x3b97('0x3e')]('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error('Error:\x20'+JSON['stringify'](data));})[_0x3b97('0x2d')](function(_0x2a3b1c){console[_0x3b97('0x4d')](_0x3b97('0x4e'),_0x2a3b1c);});}function getEndUser(_0x335efb,_0x3f3363,_0x837214,_0x47c15a,_0x16820a,_0x2ca77c,_0x4990a7){var _0x5efa9f={'method':_0x3b97('0x31'),'uri':'','headers':{'Authorization':_0x3b97('0x34')+_0x335efb},'json':!![]};switch(_0x4990a7[_0x3b97('0x4f')]){case _0x3b97('0x50'):_0x5efa9f[_0x3b97('0x51')]='https://www.zohoapis.'+_0x3f3363+_0x3b97('0x52')+_0x16820a+'))';return getZohoUser(_0x5efa9f,_0x3b97('0x53'))[_0x3b97('0x2a')](function(_0x367a8b){if(_0x367a8b)return _0x367a8b;_0x5efa9f[_0x3b97('0x51')]=_0x3b97('0x42')+_0x3f3363+_0x3b97('0x54')+_0x16820a+'))';return getZohoUser(_0x5efa9f,_0x3b97('0x55'))['then'](function(_0x2c643c){if(_0x2c643c)return _0x2c643c;if(_0x4990a7[_0x3b97('0x44')]!=_0x3b97('0x56')){return createEndUser(_0x335efb,_0x3f3363,_0x47c15a,_0x16820a,_0x2ca77c,_0x4990a7);}else{return{};}});});break;case _0x3b97('0x57'):_0x5efa9f[_0x3b97('0x51')]=_0x3b97('0x42')+_0x3f3363+_0x3b97('0x52')+_0x16820a+'))';return getZohoUser(_0x5efa9f,_0x3b97('0x53'))[_0x3b97('0x2a')](function(_0x10c69c){if(_0x10c69c)return _0x10c69c;if(_0x4990a7[_0x3b97('0x44')]!=_0x3b97('0x56')){return createEndUser(_0x335efb,_0x3f3363,_0x47c15a,_0x16820a,_0x2ca77c,_0x4990a7);}else{return{};}});break;case _0x3b97('0x58'):_0x5efa9f[_0x3b97('0x51')]=_0x3b97('0x42')+_0x3f3363+_0x3b97('0x54')+_0x16820a+'))';return getZohoUser(_0x5efa9f,_0x3b97('0x55'))[_0x3b97('0x2a')](function(_0x1db3de){if(_0x1db3de)return _0x1db3de;if(_0x4990a7[_0x3b97('0x44')]!=_0x3b97('0x56')){return createEndUser(_0x335efb,_0x3f3363,_0x47c15a,_0x16820a,_0x2ca77c,_0x4990a7);}else{return{};}});break;}}function getCall(_0x59086e,_0x3c9e3e,_0x2551e0,_0x37654d,_0x559325,_0x4ef6a1,_0x2dd5fa,_0x4af59c){logger[_0x3b97('0x2f')](_0x3b97('0x59'));var _0x71fc4e={};_0x71fc4e[_0x3b97('0x5a')]={'name':!_[_0x3b97('0x1d')](_0x37654d[_0x3b97('0x45')]['name'])&&!_[_0x3b97('0x1d')](_0x37654d['profile'][_0x3b97('0x19')])&&_0x37654d[_0x3b97('0x3d')][_0x3b97('0x19')]===_0x3b97('0x5b')?_0x37654d[_0x3b97('0x45')][_0x3b97('0x19')]:!_[_0x3b97('0x1d')](_0x37654d[_0x3b97('0x46')])?_0x37654d[_0x3b97('0x46')]+'\x20'+_0x37654d[_0x3b97('0x47')]:_0x37654d[_0x3b97('0x47')],'id':_0x37654d['id']};_0x71fc4e[_0x3b97('0x5c')]=intUtil[_0x3b97('0x5d')](_0x4ef6a1['Subjects'],_0x2dd5fa,'\x20');_0x71fc4e['Description']=intUtil['getString'](_0x4ef6a1['Descriptions'],_0x2dd5fa,'\x0a');if(_0x559325[_0x3b97('0x41')]===_0x3b97('0x53')){_0x71fc4e[_0x3b97('0x5e')]={'name':!_['isNil'](_0x559325['Full_Name'])?_0x559325['Full_Name']:!_[_0x3b97('0x1d')](_0x559325[_0x3b97('0x5f')])?_0x559325[_0x3b97('0x5f')]+'\x20'+_0x559325[_0x3b97('0x60')]:_0x559325[_0x3b97('0x60')],'id':_0x559325['id']};}if(_0x559325[_0x3b97('0x41')]==='Leads'){_0x71fc4e[_0x3b97('0x61')]={'name':!_[_0x3b97('0x1d')](_0x559325[_0x3b97('0x62')])?_0x559325[_0x3b97('0x62')]:!_['isNil'](_0x559325[_0x3b97('0x5f')])?_0x559325['First_Name']+'\x20'+_0x559325[_0x3b97('0x60')]:_0x559325[_0x3b97('0x60')],'id':_0x559325['id']};_0x71fc4e['$se_module']=_[_0x3b97('0x4c')](_0x559325['enduserType']);}if(_0x2dd5fa[_0x3b97('0x63')]){_0x71fc4e[_0x3b97('0x64')]=moment[_0x3b97('0x65')](parseInt(_0x2dd5fa['talktime'])*0x3e8)['format'](_0x3b97('0x66'));}else if(_0x2dd5fa['answertime']&&_0x2dd5fa[_0x3b97('0x67')]){_0x71fc4e[_0x3b97('0x64')]=moment[_0x3b97('0x65')](moment(_0x2dd5fa[_0x3b97('0x67')],_0x3b97('0x68'))[_0x3b97('0x69')](moment(_0x2dd5fa[_0x3b97('0x6a')],_0x3b97('0x68'))))[_0x3b97('0x32')](_0x3b97('0x66'));}switch(_0x2dd5fa['lastevent']){case _0x3b97('0x6b'):_0x71fc4e[_0x3b97('0x6c')]='Called';break;case'complete':case'connect':_0x71fc4e[_0x3b97('0x6c')]=_0x3b97('0x6d');break;case'rejected':_0x71fc4e[_0x3b97('0x6c')]=_0x3b97('0x6e');break;case _0x3b97('0x6f'):_0x71fc4e[_0x3b97('0x6c')]='Abandoned';break;case _0x3b97('0x70'):_0x71fc4e[_0x3b97('0x6c')]='Timeout';default:}_0x71fc4e[_0x3b97('0x71')]=(_0x4af59c==='outbound'?moment(_0x2dd5fa['starttime'])[_0x3b97('0x32')](_0x3b97('0x68')):moment(_0x2dd5fa['agentcalledAt'])[_0x3b97('0x32')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x3b97('0x32')]('YYYY-MM-DDTHH:mm:ss');_0x71fc4e['Call_Type']=_0x4af59c||_0x3b97('0x72');_0x71fc4e=_[_0x3b97('0x73')](_0x71fc4e,getCustomFields(_0x4ef6a1[_0x3b97('0x74')],_0x2dd5fa));return request({'method':_0x3b97('0x25'),'uri':_0x3b97('0x42')+_0x3c9e3e+_0x3b97('0x75'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x59086e},'body':{'data':[_0x71fc4e]},'json':!![]})[_0x3b97('0x2a')](function(_0x1cf91a){if(_0x1cf91a&&_0x1cf91a[_0x3b97('0x4a')][0x0][_0x3b97('0x48')]===_0x3b97('0x49')){logger[_0x3b97('0x2f')](_0x3b97('0x76'));return{'id':_0x1cf91a[_0x3b97('0x4a')][0x0][_0x3b97('0x4b')]['id']};}})['catch'](function(_0x4f4f1a){logger[_0x3b97('0x2f')](_0x3b97('0x77'),_0x4f4f1a['stack']);console['log'](_0x3b97('0x77'),_0x4f4f1a);});}exports[_0x3b97('0x78')]=function(_0x115d6c,_0x6d1345,_0x181029,_0x2d901b,_0x547c09,_0x2cfdd5){var _0x10b1be,_0xa33552,_0x333612;_0x2cfdd5[_0x3b97('0x79')]=intUtil[_0x3b97('0x7a')](_0x2cfdd5[_0x3b97('0x79')]);_0x2cfdd5[_0x3b97('0x7b')]=intUtil[_0x3b97('0x7a')](_0x2cfdd5[_0x3b97('0x7b')]);if(_0x547c09&&_0x547c09[_0x3b97('0x7c')]){logger[_0x3b97('0x2f')](_0x3b97('0x7d'),_0x3b97('0x7e'));_0x6d1345[_0x3b97('0x7f')]=_0x2cfdd5[_0x3b97('0x7b')]+_0x3b97('0x80')+_0x6d1345['uniqueid']+_0x3b97('0x81')+md5(_0x6d1345[_0x3b97('0x82')]);}else{_0x6d1345[_0x3b97('0x7f')]='';}var _0x1db9c1=_0x2cfdd5[_0x3b97('0x79')]==='zoho.eu'?'eu':_0x3b97('0x83');return getAccessToken(_0x2cfdd5)[_0x3b97('0x2a')](function(_0x263a84){_0x333612=_0x263a84;return getUser(_0x333612,_0x1db9c1,_0x2cfdd5,_0x2d901b[_0x3b97('0x38')]);})[_0x3b97('0x2a')](function(_0x5d5f6e){_0x10b1be=_0x5d5f6e;logger[_0x3b97('0x2f')](_0x3b97('0x84'),_0x10b1be['id']);return getEndUser(_0x333612,_0x1db9c1,_0x2cfdd5,_0x6d1345[_0x3b97('0x85')],_0x6d1345['calleridnum'],_0x10b1be,_0x181029);})[_0x3b97('0x2a')](function(_0x2fe5be){_0xa33552=_0x2fe5be;return getCall(_0x333612,_0x1db9c1,_0x2cfdd5,_0x10b1be,_0xa33552,_0x181029,_0x6d1345,_0x3b97('0x72'));})[_0x3b97('0x2a')](function(_0x451b33){if(_0x451b33){logger[_0x3b97('0x2f')](_0x3b97('0x86'),_0x451b33['id']);logger[_0x3b97('0x2f')](_0x3b97('0x7d'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x3b97('0x87'),_0x2d901b['name']),_0x3b97('0x88'),{'uri':_0x3b97('0x89')+_0x2cfdd5[_0x3b97('0x79')]+'/crm/EntityInfo.do?module=Calls&id='+_0x451b33['id']});}})[_0x3b97('0x2d')](function(_0x31b6a4){logger[_0x3b97('0x3e')]('[QUEUE]',JSON[_0x3b97('0x10')](_0x31b6a4));});};exports['outbound']=function(_0xb4760,_0x3faa7e,_0x44cdc5,_0x3a403d,_0x24c771,_0x2fe97e,_0x5bd8e4){var _0x1adaac,_0x400cc1,_0x9223d1;_0x2fe97e['host']=intUtil[_0x3b97('0x7a')](_0x2fe97e['host']);_0x2fe97e[_0x3b97('0x7b')]=intUtil[_0x3b97('0x7a')](_0x2fe97e[_0x3b97('0x7b')]);if(_0x5bd8e4&&_0x5bd8e4[_0x3b97('0x8a')]&&_0x5bd8e4[_0x3b97('0x8a')]!==_0x3b97('0x8b')){logger['info'](_0x3b97('0x8c'),_0x3b97('0x7e'));_0x3faa7e[_0x3b97('0x7f')]=_0x2fe97e['serverUrl']+_0x3b97('0x80')+_0x3faa7e[_0x3b97('0x82')]+_0x3b97('0x81')+md5(_0x3faa7e[_0x3b97('0x82')]);}var _0x28eb3d=_0x2fe97e[_0x3b97('0x79')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x2fe97e)[_0x3b97('0x2a')](function(_0x388e4b){_0x9223d1=_0x388e4b;return getUser(_0x9223d1,_0x28eb3d,_0x2fe97e,_0x3a403d[_0x3b97('0x38')]);})['then'](function(_0x483d6c){_0x1adaac=_0x483d6c;logger['info'](_0x3b97('0x84'),_0x1adaac['id']);return getEndUser(_0x9223d1,_0x28eb3d,_0x2fe97e,_0x3faa7e[_0x3b97('0x8d')],_0x3faa7e[_0x3b97('0x8e')],_0x1adaac,_0x44cdc5);})['then'](function(_0x53c898){_0x400cc1=_0x53c898;return getCall(_0x9223d1,_0x28eb3d,_0x2fe97e,_0x1adaac,_0x400cc1,_0x44cdc5,_0x3faa7e,_0x3b97('0x8f'));})['then'](function(_0xa29cb5){if(_0xa29cb5){logger['info'](_0x3b97('0x86'),_0xa29cb5['id']);logger[_0x3b97('0x2f')](_0x3b97('0x8c'),_0x3b97('0x90'));emit(util['format'](_0x3b97('0x87'),_0x3a403d[_0x3b97('0x19')]),'trigger:browser:url',{'uri':'https://crm.'+_0x2fe97e[_0x3b97('0x79')]+_0x3b97('0x91')+_0xa29cb5['id']});}})[_0x3b97('0x2d')](function(_0x1170e5){logger['error'](_0x3b97('0x8c'),JSON[_0x3b97('0x10')](_0x1170e5));});};exports[_0x3b97('0x92')]=function(_0x252405,_0x2de9bb,_0x8c92bc,_0x2de1b4,_0x268d94,_0xd26c3e){var _0x7c2758,_0x4a8fae,_0x4c9b80;_0xd26c3e['host']=intUtil['stripTrailingSlash'](_0xd26c3e[_0x3b97('0x79')]);_0xd26c3e[_0x3b97('0x7b')]=intUtil['stripTrailingSlash'](_0xd26c3e[_0x3b97('0x7b')]);if(_0x268d94&&_0x268d94[_0x3b97('0x7c')]){logger[_0x3b97('0x2f')]('['+_0x2de9bb[_0x3b97('0x93')][_0x3b97('0x94')]()+']',_0x3b97('0x7e'));_0x2de9bb[_0x3b97('0x7f')]=_0xd26c3e[_0x3b97('0x7b')]+_0x3b97('0x80')+_0x2de9bb[_0x3b97('0x82')]+_0x3b97('0x81')+md5(_0x2de9bb[_0x3b97('0x82')]);}else{_0x2de9bb['recordingURL']='';}var _0x57bee3=_0xd26c3e['host']==='zoho.eu'?'eu':_0x3b97('0x83');return getAccessToken(_0xd26c3e)['then'](function(_0x343e14){_0x4c9b80=_0x343e14;return getUser(_0x4c9b80,_0x57bee3,_0xd26c3e);})[_0x3b97('0x2a')](function(_0x12b21c){_0x7c2758=_0x12b21c;logger[_0x3b97('0x2f')](_0x3b97('0x84'),_0x7c2758['id']);return getEndUser(_0x4c9b80,_0x57bee3,_0xd26c3e,_0x2de9bb[_0x3b97('0x85')],_0x2de9bb['calleridnum'],_0x7c2758,_0x8c92bc);})['then'](function(_0x13f6ce){_0x4a8fae=_0x13f6ce;return getCall(_0x4c9b80,_0x57bee3,_0xd26c3e,_0x7c2758,_0x4a8fae,_0x8c92bc,_0x2de9bb,_0x3b97('0x72'));})[_0x3b97('0x2a')](function(_0x1d4125){if(_0x1d4125){logger[_0x3b97('0x2f')](_0x3b97('0x86'),_0x1d4125['id']);}})[_0x3b97('0x2d')](function(_0x1d3824){logger[_0x3b97('0x3e')]('['+_0x2de9bb['lastevent'][_0x3b97('0x94')]()+']',JSON['stringify'](_0x1d3824));});}; \ 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 50cd69e..17afb01 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 _0xf00a=['error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','trigger','exec','data2','data3','render'];(function(_0x137642,_0x2bcb51){var _0xce2de4=function(_0x335b6e){while(--_0x335b6e){_0x137642['push'](_0x137642['shift']());}};_0xce2de4(++_0x2bcb51);}(_0xf00a,0x171));var _0xaf00=function(_0x254c9e,_0xab8a1b){_0x254c9e=_0x254c9e-0x0;var _0x2d4cb6=_0xf00a[_0x254c9e];return _0x2d4cb6;};'use strict';var util=require(_0xaf00('0x0'));var sh=require(_0xaf00('0x1'));var Mustache=require(_0xaf00('0x2'));var logger=require('../../../../config/logger')(_0xaf00('0x3'));exports[_0xaf00('0x4')]=function(_0x1c3710,_0xe43255){var _0x47614a=_0x1c3710[_0xaf00('0x5')]?_0x1c3710[_0xaf00('0x5')]:'Script';var _0x192214=_0x1c3710[_0xaf00('0x6')]?Mustache[_0xaf00('0x7')](_0x1c3710[_0xaf00('0x6')],_0xe43255):_0xe43255;sh[_0xaf00('0x4')](_0x192214,function(_0x252a07,_0xe71e23,_0x5840e2){if(_0x252a07!==0x0){logger[_0xaf00('0x8')](util[_0xaf00('0x9')](_0xaf00('0xa'),_0x47614a,_0x192214,_0x252a07,_0x5840e2));}else{logger[_0xaf00('0xb')](util[_0xaf00('0x9')](_0xaf00('0xc'),_0x47614a,_0x192214,_0xe71e23));}});}; \ No newline at end of file +var _0xd306=['mustache','../../../../config/logger','trigger','data2','render','format'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd306,0x96));var _0x6d30=function(_0x4978e1,_0x28aa9a){_0x4978e1=_0x4978e1-0x0;var _0x319309=_0xd306[_0x4978e1];return _0x319309;};'use strict';var util=require('util');var sh=require('shelljs');var Mustache=require(_0x6d30('0x0'));var logger=require(_0x6d30('0x1'))(_0x6d30('0x2'));exports['exec']=function(_0x37f82d,_0x3065be){var _0x23af51=_0x37f82d[_0x6d30('0x3')]?_0x37f82d['data2']:'Script';var _0x4a529e=_0x37f82d['data3']?Mustache[_0x6d30('0x4')](_0x37f82d['data3'],_0x3065be):_0x3065be;sh['exec'](_0x4a529e,function(_0x5effaf,_0x329b29,_0x50cc6){if(_0x5effaf!==0x0){logger['error'](util[_0x6d30('0x5')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x23af51,_0x4a529e,_0x5effaf,_0x50cc6));}else{logger['info'](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x23af51,_0x4a529e,_0x329b29));}});}; \ 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 6883956..e3fc46b 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 _0x50bb=['number','headers','data6','parse','render','GET','DELETE','POST','data7','body','error','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','data2','then','isNil',',\x20request\x20body:\x20','stringify','info','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','data5'];(function(_0x4a440a,_0x55e3e0){var _0x567da8=function(_0x205e55){while(--_0x205e55){_0x4a440a['push'](_0x4a440a['shift']());}};_0x567da8(++_0x55e3e0);}(_0x50bb,0x154));var _0xb50b=function(_0x510581,_0x174328){_0x510581=_0x510581-0x0;var _0x1f4af6=_0x50bb[_0x510581];return _0x1f4af6;};'use strict';var rp=require(_0xb50b('0x0'));var util=require(_0xb50b('0x1'));var _=require(_0xb50b('0x2'));var Mustache=require(_0xb50b('0x3'));var logger=require(_0xb50b('0x4'))(_0xb50b('0x5'));exports[_0xb50b('0x6')]=function(_0x24a8cc,_0x42dd38){var _0x3e0bbb,_0x5f47e2;var _0x2d1630={'method':_0x24a8cc[_0xb50b('0x7')][_0xb50b('0x8')](),'uri':Mustache['render'](_0x24a8cc['data2'],_0x42dd38),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x24a8cc[_0xb50b('0x9')])===_0xb50b('0xa')&&parseInt(_0x24a8cc['data5'])>=0x1&&parseInt(_0x24a8cc['data5'])<=0xa?parseInt(_0x24a8cc[_0xb50b('0x9')])*0x3e8:0x5*0x3e8};try{_0x2d1630[_0xb50b('0xb')]=_0x24a8cc[_0xb50b('0xc')]?JSON[_0xb50b('0xd')](Mustache[_0xb50b('0xe')](_0x24a8cc[_0xb50b('0xc')],_0x42dd38)):{};}catch(_0x37fd45){logger['error'](_0x37fd45['stack']);}switch(_0x24a8cc[_0xb50b('0x7')][_0xb50b('0x8')]()){case _0xb50b('0xf'):case _0xb50b('0x10'):_0x3e0bbb=null;_0x2d1630['qs']=_0x42dd38;break;case _0xb50b('0x11'):case'PUT':if(_0x24a8cc[_0xb50b('0x12')]){try{_0x3e0bbb=JSON['parse'](Mustache[_0xb50b('0xe')](_0x24a8cc[_0xb50b('0x12')],_0x42dd38));_0x2d1630[_0xb50b('0x13')]=_0x3e0bbb;}catch(_0x349382){logger[_0xb50b('0x14')](_0x349382[_0xb50b('0x15')]);logger['error'](_0xb50b('0x16'));}}else{_0x3e0bbb=_0x42dd38;_0x2d1630[_0xb50b('0x13')]=_0x3e0bbb;}break;}logger['info'](util['format']('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x24a8cc[_0xb50b('0x7')],_0x24a8cc[_0xb50b('0x17')],JSON['stringify'](_0x2d1630)));rp(_0x2d1630)[_0xb50b('0x18')](function(_0x5b01ee){_0x3e0bbb=!_[_0xb50b('0x19')](_0x3e0bbb)?_0xb50b('0x1a')+_0x3e0bbb:'';_0x5f47e2=typeof _0x5b01ee['body']==='object'?JSON[_0xb50b('0x1b')](_0x5b01ee[_0xb50b('0x13')]):_0x5b01ee['body'];logger[_0xb50b('0x1c')](util[_0xb50b('0x1d')](_0xb50b('0x1e'),_0x24a8cc[_0xb50b('0x7')],_0x24a8cc[_0xb50b('0x17')],_0x5b01ee['statusCode'],_0x5f47e2));})[_0xb50b('0x1f')](function(_0x4c43ed){logger['error'](util[_0xb50b('0x1d')](_0xb50b('0x20'),_0x24a8cc[_0xb50b('0x7')],_0x24a8cc[_0xb50b('0x17')],_0x4c43ed[_0xb50b('0x21')],_0x4c43ed['name'],_0x4c43ed[_0xb50b('0x22')]));});}; \ No newline at end of file +var _0xea61=['render','error','stack','toUpperCase','PUT','data7','body','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil','object','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','mustache','../../../../config/logger','trigger','exec','data1','data5','headers','parse'];(function(_0x613fd3,_0xe7d69a){var _0x499fce=function(_0x2d72d0){while(--_0x2d72d0){_0x613fd3['push'](_0x613fd3['shift']());}};_0x499fce(++_0xe7d69a);}(_0xea61,0x104));var _0x1ea6=function(_0x1883dd,_0x15f5b6){_0x1883dd=_0x1883dd-0x0;var _0x65c0a=_0xea61[_0x1883dd];return _0x65c0a;};'use strict';var rp=require(_0x1ea6('0x0'));var util=require(_0x1ea6('0x1'));var _=require('lodash');var Mustache=require(_0x1ea6('0x2'));var logger=require(_0x1ea6('0x3'))(_0x1ea6('0x4'));exports[_0x1ea6('0x5')]=function(_0x3456db,_0x47198d){var _0x5d4ef4,_0x423c5b;var _0x456084={'method':_0x3456db[_0x1ea6('0x6')]['toUpperCase'](),'uri':Mustache['render'](_0x3456db['data2'],_0x47198d),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3456db[_0x1ea6('0x7')])==='number'&&parseInt(_0x3456db[_0x1ea6('0x7')])>=0x1&&parseInt(_0x3456db['data5'])<=0xa?parseInt(_0x3456db[_0x1ea6('0x7')])*0x3e8:0x5*0x3e8};try{_0x456084[_0x1ea6('0x8')]=_0x3456db['data6']?JSON[_0x1ea6('0x9')](Mustache[_0x1ea6('0xa')](_0x3456db['data6'],_0x47198d)):{};}catch(_0x12305e){logger[_0x1ea6('0xb')](_0x12305e[_0x1ea6('0xc')]);}switch(_0x3456db[_0x1ea6('0x6')][_0x1ea6('0xd')]()){case'GET':case'DELETE':_0x5d4ef4=null;_0x456084['qs']=_0x47198d;break;case'POST':case _0x1ea6('0xe'):if(_0x3456db[_0x1ea6('0xf')]){try{_0x5d4ef4=JSON[_0x1ea6('0x9')](Mustache[_0x1ea6('0xa')](_0x3456db[_0x1ea6('0xf')],_0x47198d));_0x456084['body']=_0x5d4ef4;}catch(_0x5b63db){logger[_0x1ea6('0xb')](_0x5b63db[_0x1ea6('0xc')]);logger[_0x1ea6('0xb')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x5d4ef4=_0x47198d;_0x456084[_0x1ea6('0x10')]=_0x5d4ef4;}break;}logger[_0x1ea6('0x11')](util['format'](_0x1ea6('0x12'),_0x3456db[_0x1ea6('0x6')],_0x3456db[_0x1ea6('0x13')],JSON[_0x1ea6('0x14')](_0x456084)));rp(_0x456084)[_0x1ea6('0x15')](function(_0x37369e){_0x5d4ef4=!_[_0x1ea6('0x16')](_0x5d4ef4)?',\x20request\x20body:\x20'+_0x5d4ef4:'';_0x423c5b=typeof _0x37369e[_0x1ea6('0x10')]===_0x1ea6('0x17')?JSON[_0x1ea6('0x14')](_0x37369e['body']):_0x37369e['body'];logger['info'](util[_0x1ea6('0x18')](_0x1ea6('0x19'),_0x3456db['data1'],_0x3456db[_0x1ea6('0x13')],_0x37369e[_0x1ea6('0x1a')],_0x423c5b));})['catch'](function(_0x157ce8){logger[_0x1ea6('0xb')](util['format'](_0x1ea6('0x1b'),_0x3456db[_0x1ea6('0x6')],_0x3456db['data2'],_0x157ce8['statusCode'],_0x157ce8[_0x1ea6('0x1c')],_0x157ce8[_0x1ea6('0x1d')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index fb0e3a6..c8a5863 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 _0x9e73=['Request','request','then','rpc','error','message','catch','exports','jayson/promise','routing','client','http'];(function(_0x38b8f8,_0x3e0b87){var _0x475230=function(_0x2027b3){while(--_0x2027b3){_0x38b8f8['push'](_0x38b8f8['shift']());}};_0x475230(++_0x3e0b87);}(_0x9e73,0x194));var _0x39e7=function(_0x51c3a1,_0x151bd0){_0x51c3a1=_0x51c3a1-0x0;var _0xdba917=_0x9e73[_0x51c3a1];return _0xdba917;};'use strict';var jayson=require(_0x39e7('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')(_0x39e7('0x1'));var client=jayson[_0x39e7('0x2')][_0x39e7('0x3')]({'port':0x2329});client[_0x39e7('0x4')]=function(_0x412c3d,_0x517c02){return new BPromise(function(_0xc86e41,_0x31df23){return client[_0x39e7('0x5')](_0x412c3d,_0x517c02)[_0x39e7('0x6')](function(_0x9164dd){logger['debug'](_0x39e7('0x7'),'routing',_0x412c3d,_0x517c02,_0x9164dd);if(_0x9164dd[_0x39e7('0x8')]){logger[_0x39e7('0x8')](_0x39e7('0x7'),_0x39e7('0x1'),_0x412c3d,_0x9164dd['error'][_0x39e7('0x9')],_0x517c02);return _0x31df23(_0x9164dd[_0x39e7('0x8')][_0x39e7('0x9')]);}else{return _0xc86e41(_0x9164dd['result']);}})[_0x39e7('0xa')](function(_0x4b4437){logger[_0x39e7('0x8')]('rpc',_0x39e7('0x1'),_0x412c3d,_0x4b4437,_0x517c02);return _0x31df23(_0x4b4437);});});};module[_0x39e7('0xb')]=client; \ No newline at end of file +var _0xda8d=['routing','message','result','catch','exports','jayson/promise','bluebird','client','http','Request','request','then','debug','rpc','error'];(function(_0x1f8a0c,_0x5e8443){var _0x39073b=function(_0x394753){while(--_0x394753){_0x1f8a0c['push'](_0x1f8a0c['shift']());}};_0x39073b(++_0x5e8443);}(_0xda8d,0x131));var _0xdda8=function(_0x2404ed,_0x104e4d){_0x2404ed=_0x2404ed-0x0;var _0x51b96d=_0xda8d[_0x2404ed];return _0x51b96d;};'use strict';var jayson=require(_0xdda8('0x0'));var BPromise=require(_0xdda8('0x1'));var logger=require('../../config/logger')('routing');var client=jayson[_0xdda8('0x2')][_0xdda8('0x3')]({'port':0x2329});client[_0xdda8('0x4')]=function(_0x2be989,_0x192c63){return new BPromise(function(_0x10696e,_0x202b97){return client[_0xdda8('0x5')](_0x2be989,_0x192c63)[_0xdda8('0x6')](function(_0x8d8748){logger[_0xdda8('0x7')](_0xdda8('0x8'),'routing',_0x2be989,_0x192c63,_0x8d8748);if(_0x8d8748[_0xdda8('0x9')]){logger[_0xdda8('0x9')]('rpc',_0xdda8('0xa'),_0x2be989,_0x8d8748[_0xdda8('0x9')][_0xdda8('0xb')],_0x192c63);return _0x202b97(_0x8d8748[_0xdda8('0x9')][_0xdda8('0xb')]);}else{return _0x10696e(_0x8d8748[_0xdda8('0xc')]);}})[_0xdda8('0xd')](function(_0xffe6fa){logger[_0xdda8('0x9')]('rpc','routing',_0x2be989,_0xffe6fa,_0x192c63);return _0x202b97(_0xffe6fa);});});};module[_0xdda8('0xe')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 7e49c40..8aa3fc7 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 _0xe31a=['then','getMailAccounts','initMailAccounts','mailAccounts','listen','getSettings','loginMailFrequency','catch','log','bluebird','./server','./rpc/mailAccount','./rpc/setting','resolve'];(function(_0x908240,_0x4ea0f3){var _0x5bf78b=function(_0x2d65d1){while(--_0x2d65d1){_0x908240['push'](_0x908240['shift']());}};_0x5bf78b(++_0x4ea0f3);}(_0xe31a,0x87));var _0xae31=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xe31a[_0x4a53d];return _0x27410e;};'use strict';var BPromise=require(_0xae31('0x0'));var server=require(_0xae31('0x1'));var Realtime=require('./realtime');var EmailChannel=require('./lib/email');var mailAccount=require(_0xae31('0x2'));var setting=require(_0xae31('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0xae31('0x4')]()[_0xae31('0x5')](mailAccount[_0xae31('0x6')]())[_0xae31('0x5')](realtime[_0xae31('0x7')]())[_0xae31('0x5')](function(){email['refresh'](realtime[_0xae31('0x8')]);return realtime;});}function main(){return server[_0xae31('0x9')](realtime,email)[_0xae31('0x5')](function(){return initRealtime();})[_0xae31('0x5')](function(){return setting[_0xae31('0xa')]();})[_0xae31('0x5')](function(_0x614185){return setInterval(initRealtime,_0x614185[_0xae31('0xb')]*0x3e8);})[_0xae31('0xc')](function(_0x7c5f2b){console[_0xae31('0xd')](_0x7c5f2b);});}main(); \ No newline at end of file +var _0xe8b1=['./rpc/setting','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','getSettings','catch','bluebird','./server','./lib/email','./rpc/mailAccount'];(function(_0xdee72,_0x309d1d){var _0x1fae39=function(_0x234c8f){while(--_0x234c8f){_0xdee72['push'](_0xdee72['shift']());}};_0x1fae39(++_0x309d1d);}(_0xe8b1,0x104));var _0x1e8b=function(_0x34e4f1,_0x57b35d){_0x34e4f1=_0x34e4f1-0x0;var _0x1a7e8e=_0xe8b1[_0x34e4f1];return _0x1a7e8e;};'use strict';var BPromise=require(_0x1e8b('0x0'));var server=require(_0x1e8b('0x1'));var Realtime=require('./realtime');var EmailChannel=require(_0x1e8b('0x2'));var mailAccount=require(_0x1e8b('0x3'));var setting=require(_0x1e8b('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise['resolve']()[_0x1e8b('0x5')](mailAccount[_0x1e8b('0x6')]())[_0x1e8b('0x5')](realtime[_0x1e8b('0x7')]())[_0x1e8b('0x5')](function(){email[_0x1e8b('0x8')](realtime[_0x1e8b('0x9')]);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(){return initRealtime();})['then'](function(){return setting[_0x1e8b('0xa')]();})[_0x1e8b('0x5')](function(_0x1c2e15){return setInterval(initRealtime,_0x1c2e15['loginMailFrequency']*0x3e8);})[_0x1e8b('0xb')](function(_0x4cd746){console['log'](_0x4cd746);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index ac3d36f..8b8a571 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 _0x6481=['prototype','emit','name','key','active','Imap','status','messageStatus','total','isNil','refresh','hasOwnProperty','handleImapEmail','end','handleImapEnd','bind','error','handleImapError','disabled','handleImapBox','connected','messages','info','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','sendMail','smtp','verifySmtp','Smtp','verify','verified','exports','bluebird','md5','ioredis','../../../config/environment','email','redis','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6481,0x1f2));var _0x1648=function(_0xfe916c,_0x151f76){_0xfe916c=_0xfe916c-0x0;var _0x3003a1=_0x6481[_0xfe916c];return _0x3003a1;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0x1648('0x0'));var md5=require(_0x1648('0x1'));var Redis=require(_0x1648('0x2'));var config=require(_0x1648('0x3'));var logger=require('../../../config/logger')(_0x1648('0x4'));config['redis']=_['defaults'](config[_0x1648('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var EmailImap=require(_0x1648('0x6'));var EmailSmtp=require(_0x1648('0x7'));var mailAccount=require(_0x1648('0x8'));var md5Accounts={};function EmailChannel(_0x16cc8b){logger['info'](_0x1648('0x9'));this[_0x1648('0xa')]=_0x16cc8b[_0x1648('0xa')];this[_0x1648('0xb')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x1648('0xc')][_0x1648('0xd')]=function(_0x33e192){var _0x376dd0=this[_0x1648('0xa')][_0x33e192];var _0x374321={'id':_0x376dd0['id'],'name':_0x376dd0[_0x1648('0xe')],'key':_0x376dd0[_0x1648('0xf')],'active':_0x376dd0[_0x1648('0x10')],'Imap':{'status':_0x376dd0[_0x1648('0x11')][_0x1648('0x12')],'messageStatus':_0x376dd0[_0x1648('0x11')][_0x1648('0x13')],'total':_0x376dd0[_0x1648('0x11')][_0x1648('0x14')]}};if(_[_0x1648('0x15')](md5Accounts[_0x33e192])){md5Accounts[_0x33e192]={};}var _0x1da012=md5(JSON['stringify'](_0x374321));if(md5Accounts[_0x33e192][_0x1648('0x1')]!==_0x1da012){md5Accounts[_0x33e192][_0x1648('0x1')]=_0x1da012;io[_0x1648('0xd')]('mailAccount:update',_0x374321);}};EmailChannel['prototype'][_0x1648('0x16')]=function(_0xb2e4bd){for(var _0x26d4c4 in _0xb2e4bd){if(_0xb2e4bd[_0x1648('0x17')](_0x26d4c4)){if(_0xb2e4bd[_0x26d4c4][_0x1648('0x11')]&&_0xb2e4bd[_0x26d4c4][_0x1648('0x10')]){var _0x55c9ee=_0xb2e4bd[_0x26d4c4][_0x1648('0x11')];if(!this[_0x1648('0xb')][_0x1648('0x17')](_0x55c9ee['id'])){this[_0x1648('0xb')][_0x55c9ee['id']]=new EmailImap(_0x55c9ee,_0xb2e4bd[_0x26d4c4][_0x1648('0x4')]);this[_0x1648('0xb')][_0x55c9ee['id']]['on']('box',this['handleImapBox']['bind'](this,_0x26d4c4));this['imapAccounts'][_0x55c9ee['id']]['on']('email',this[_0x1648('0x18')]['bind'](this,_0x26d4c4));this['imapAccounts'][_0x55c9ee['id']]['on'](_0x1648('0x19'),this[_0x1648('0x1a')][_0x1648('0x1b')](this,_0x26d4c4));this[_0x1648('0xb')][_0x55c9ee['id']]['on'](_0x1648('0x1c'),this[_0x1648('0x1d')][_0x1648('0x1b')](this,_0x26d4c4));}}else{if(_[_0x1648('0x15')](this[_0x1648('0xa')][_0x26d4c4][_0x1648('0x11')])){this[_0x1648('0xa')][_0x26d4c4][_0x1648('0x11')]={};}this['mailAccounts'][_0x26d4c4]['Imap'][_0x1648('0x12')]=_0x1648('0x1e');this[_0x1648('0xa')][_0x26d4c4][_0x1648('0x11')][_0x1648('0x13')]='';this[_0x1648('0xd')](_0x26d4c4);}}}};EmailChannel['prototype'][_0x1648('0x1f')]=function(_0x5e53c4,_0x3026bc){if(this[_0x1648('0xa')][_0x5e53c4]){this['mailAccounts'][_0x5e53c4]['Imap'][_0x1648('0x12')]=_0x1648('0x20');this[_0x1648('0xa')][_0x5e53c4]['Imap'][_0x1648('0x13')]=_0x3026bc[_0x1648('0xe')];if(_0x3026bc[_0x1648('0x21')]){this['mailAccounts'][_0x5e53c4]['Imap'][_0x1648('0x14')]=_0x3026bc[_0x1648('0x21')][_0x1648('0x14')];}return this[_0x1648('0xd')](_0x5e53c4);}};EmailChannel['prototype'][_0x1648('0x18')]=function(_0x3b3124,_0x7c7e4d){logger[_0x1648('0x22')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x7c7e4d[_0x1648('0x23')],_0x7c7e4d[_0x1648('0x24')],_0x7c7e4d[_0x1648('0x25')],_0x3b3124);if(this[_0x1648('0xa')][_0x3b3124]){return mailAccount[_0x1648('0x26')](_0x3b3124,_0x7c7e4d)[_0x1648('0x27')](function(_0x2940df){if(_0x2940df){logger[_0x1648('0x22')](_0x1648('0x28'));}})['catch'](function(_0x305b7d){logger[_0x1648('0x1c')](_0x1648('0x29'),JSON[_0x1648('0x2a')](_0x305b7d));});}};EmailChannel['prototype']['handleImapEnd']=function(_0x2f302b){if(this[_0x1648('0xa')][_0x2f302b]&&this['mailAccounts'][_0x2f302b][_0x1648('0x11')]){if(this['imapAccounts'][this[_0x1648('0xa')][_0x2f302b][_0x1648('0x11')]['id']]){delete this['imapAccounts'][this[_0x1648('0xa')][_0x2f302b][_0x1648('0x11')]['id']];}this['mailAccounts'][_0x2f302b][_0x1648('0x11')][_0x1648('0x2b')]=moment();this[_0x1648('0xd')](_0x2f302b);}};EmailChannel[_0x1648('0xc')][_0x1648('0x1d')]=function(_0x24adb6,_0x2a5098){if(this[_0x1648('0xa')][_0x24adb6]){this['mailAccounts'][_0x24adb6][_0x1648('0x11')][_0x1648('0x12')]=_0x1648('0x1c');this[_0x1648('0xa')][_0x24adb6]['Imap'][_0x1648('0x13')]=_0x2a5098;return this[_0x1648('0xd')](_0x24adb6);}};EmailChannel[_0x1648('0xc')][_0x1648('0x2c')]=function(_0x5a144d,_0x5e12f9){return this[_0x1648('0x2d')]['send'](_0x5a144d,_0x5e12f9);};EmailChannel[_0x1648('0xc')][_0x1648('0x2e')]=function(_0x3370b5){var _0x270b31=this;if(this[_0x1648('0xa')][_0x3370b5['id']]){if(_[_0x1648('0x15')](this[_0x1648('0xa')][_0x3370b5['id']][_0x1648('0x2f')])){this['mailAccounts'][_0x3370b5['id']][_0x1648('0x2f')]={};}this[_0x1648('0xa')][_0x3370b5['id']][_0x1648('0x2f')][_0x1648('0x2b')]=moment();return new BPromise(function(_0x25a6b6,_0x1e2fb5){return _0x270b31['smtp'][_0x1648('0x30')](_0x3370b5)['then'](function(_0x45af9f){_0x270b31['mailAccounts'][_0x3370b5['id']][_0x1648('0x2f')][_0x1648('0x12')]=_0x1648('0x31');_0x270b31[_0x1648('0xa')][_0x3370b5['id']][_0x1648('0x2f')][_0x1648('0x13')]='';_0x270b31[_0x1648('0xd')](_0x3370b5['id']);_0x25a6b6(_0x45af9f);})['catch'](function(_0x5b8611){_0x270b31[_0x1648('0xa')][_0x3370b5['id']][_0x1648('0x2f')][_0x1648('0x12')]=_0x1648('0x1c');_0x270b31['mailAccounts'][_0x3370b5['id']][_0x1648('0x2f')][_0x1648('0x13')]=_0x5b8611;_0x270b31[_0x1648('0xd')](_0x3370b5['id']);_0x1e2fb5(_0x5b8611);});});}return this[_0x1648('0x2d')][_0x1648('0x30')](_0x3370b5);};module[_0x1648('0x32')]=EmailChannel; \ No newline at end of file +var _0x2094=['../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','name','key','active','status','Imap','messageStatus','total','isNil','md5','emit','mailAccount:update','refresh','email','box','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','handleImapBox','connected','messages','lastName','then','Mail\x20accepted\x20from\x20routing','catch','stringify','lastSync','sendMail','smtp','send','verifySmtp','Smtp','verify','verified','exports','lodash','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter'];(function(_0x5eee95,_0x732124){var _0x142f18=function(_0x501e75){while(--_0x501e75){_0x5eee95['push'](_0x5eee95['shift']());}};_0x142f18(++_0x732124);}(_0x2094,0x1ed));var _0x4209=function(_0x27cbc5,_0x161380){_0x27cbc5=_0x27cbc5-0x0;var _0x1d82fd=_0x2094[_0x27cbc5];return _0x1d82fd;};'use strict';var _=require(_0x4209('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require('md5');var Redis=require('ioredis');var config=require(_0x4209('0x1'));var logger=require(_0x4209('0x2'))('email');config[_0x4209('0x3')]=_[_0x4209('0x4')](config[_0x4209('0x3')],{'host':_0x4209('0x5'),'port':0x18eb});var io=require(_0x4209('0x6'))(new Redis(config[_0x4209('0x3')]));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require(_0x4209('0x7'));var md5Accounts={};function EmailChannel(_0x1639ab){logger[_0x4209('0x8')](_0x4209('0x9'));this[_0x4209('0xa')]=_0x1639ab['mailAccounts'];this[_0x4209('0xb')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x4209('0xc')]['emit']=function(_0x5f4a7e){var _0x15d3a2=this[_0x4209('0xa')][_0x5f4a7e];var _0x19410b={'id':_0x15d3a2['id'],'name':_0x15d3a2[_0x4209('0xd')],'key':_0x15d3a2[_0x4209('0xe')],'active':_0x15d3a2[_0x4209('0xf')],'Imap':{'status':_0x15d3a2['Imap'][_0x4209('0x10')],'messageStatus':_0x15d3a2[_0x4209('0x11')][_0x4209('0x12')],'total':_0x15d3a2['Imap'][_0x4209('0x13')]}};if(_[_0x4209('0x14')](md5Accounts[_0x5f4a7e])){md5Accounts[_0x5f4a7e]={};}var _0x1d3783=md5(JSON['stringify'](_0x19410b));if(md5Accounts[_0x5f4a7e]['md5']!==_0x1d3783){md5Accounts[_0x5f4a7e][_0x4209('0x15')]=_0x1d3783;io[_0x4209('0x16')](_0x4209('0x17'),_0x19410b);}};EmailChannel[_0x4209('0xc')][_0x4209('0x18')]=function(_0x3af923){for(var _0x3ec240 in _0x3af923){if(_0x3af923['hasOwnProperty'](_0x3ec240)){if(_0x3af923[_0x3ec240][_0x4209('0x11')]&&_0x3af923[_0x3ec240]['active']){var _0x538dc3=_0x3af923[_0x3ec240][_0x4209('0x11')];if(!this[_0x4209('0xb')]['hasOwnProperty'](_0x538dc3['id'])){this[_0x4209('0xb')][_0x538dc3['id']]=new EmailImap(_0x538dc3,_0x3af923[_0x3ec240][_0x4209('0x19')]);this[_0x4209('0xb')][_0x538dc3['id']]['on'](_0x4209('0x1a'),this['handleImapBox'][_0x4209('0x1b')](this,_0x3ec240));this[_0x4209('0xb')][_0x538dc3['id']]['on'](_0x4209('0x19'),this[_0x4209('0x1c')][_0x4209('0x1b')](this,_0x3ec240));this[_0x4209('0xb')][_0x538dc3['id']]['on'](_0x4209('0x1d'),this[_0x4209('0x1e')][_0x4209('0x1b')](this,_0x3ec240));this[_0x4209('0xb')][_0x538dc3['id']]['on'](_0x4209('0x1f'),this[_0x4209('0x20')][_0x4209('0x1b')](this,_0x3ec240));}}else{if(_['isNil'](this[_0x4209('0xa')][_0x3ec240][_0x4209('0x11')])){this[_0x4209('0xa')][_0x3ec240]['Imap']={};}this[_0x4209('0xa')][_0x3ec240][_0x4209('0x11')][_0x4209('0x10')]='disabled';this[_0x4209('0xa')][_0x3ec240][_0x4209('0x11')]['messageStatus']='';this[_0x4209('0x16')](_0x3ec240);}}}};EmailChannel[_0x4209('0xc')][_0x4209('0x21')]=function(_0x451b99,_0x5923ba){if(this[_0x4209('0xa')][_0x451b99]){this[_0x4209('0xa')][_0x451b99]['Imap'][_0x4209('0x10')]=_0x4209('0x22');this[_0x4209('0xa')][_0x451b99][_0x4209('0x11')][_0x4209('0x12')]=_0x5923ba[_0x4209('0xd')];if(_0x5923ba[_0x4209('0x23')]){this[_0x4209('0xa')][_0x451b99][_0x4209('0x11')][_0x4209('0x13')]=_0x5923ba[_0x4209('0x23')][_0x4209('0x13')];}return this[_0x4209('0x16')](_0x451b99);}};EmailChannel['prototype'][_0x4209('0x1c')]=function(_0x2123da,_0xceef32){logger[_0x4209('0x8')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0xceef32['firstName'],_0xceef32[_0x4209('0x24')],_0xceef32['from'],_0x2123da);if(this[_0x4209('0xa')][_0x2123da]){return mailAccount['notify'](_0x2123da,_0xceef32)[_0x4209('0x25')](function(_0xb7de72){if(_0xb7de72){logger[_0x4209('0x8')](_0x4209('0x26'));}})[_0x4209('0x27')](function(_0x2bb89d){logger['error']('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x4209('0x28')](_0x2bb89d));});}};EmailChannel['prototype']['handleImapEnd']=function(_0x24d451){if(this[_0x4209('0xa')][_0x24d451]&&this[_0x4209('0xa')][_0x24d451][_0x4209('0x11')]){if(this['imapAccounts'][this[_0x4209('0xa')][_0x24d451][_0x4209('0x11')]['id']]){delete this[_0x4209('0xb')][this[_0x4209('0xa')][_0x24d451][_0x4209('0x11')]['id']];}this[_0x4209('0xa')][_0x24d451]['Imap'][_0x4209('0x29')]=moment();this[_0x4209('0x16')](_0x24d451);}};EmailChannel[_0x4209('0xc')][_0x4209('0x20')]=function(_0x2080cf,_0x3d179e){if(this[_0x4209('0xa')][_0x2080cf]){this[_0x4209('0xa')][_0x2080cf][_0x4209('0x11')][_0x4209('0x10')]=_0x4209('0x1f');this[_0x4209('0xa')][_0x2080cf]['Imap'][_0x4209('0x12')]=_0x3d179e;return this[_0x4209('0x16')](_0x2080cf);}};EmailChannel['prototype'][_0x4209('0x2a')]=function(_0x8516c5,_0x4af30f){return this[_0x4209('0x2b')][_0x4209('0x2c')](_0x8516c5,_0x4af30f);};EmailChannel[_0x4209('0xc')][_0x4209('0x2d')]=function(_0xc3451c){var _0x3c567f=this;if(this[_0x4209('0xa')][_0xc3451c['id']]){if(_[_0x4209('0x14')](this[_0x4209('0xa')][_0xc3451c['id']][_0x4209('0x2e')])){this['mailAccounts'][_0xc3451c['id']][_0x4209('0x2e')]={};}this['mailAccounts'][_0xc3451c['id']][_0x4209('0x2e')][_0x4209('0x29')]=moment();return new BPromise(function(_0x397e5b,_0x5b0318){return _0x3c567f[_0x4209('0x2b')][_0x4209('0x2f')](_0xc3451c)[_0x4209('0x25')](function(_0x4b2a64){_0x3c567f[_0x4209('0xa')][_0xc3451c['id']]['Smtp'][_0x4209('0x10')]=_0x4209('0x30');_0x3c567f[_0x4209('0xa')][_0xc3451c['id']]['Smtp'][_0x4209('0x12')]='';_0x3c567f[_0x4209('0x16')](_0xc3451c['id']);_0x397e5b(_0x4b2a64);})[_0x4209('0x27')](function(_0x1e7f5d){_0x3c567f['mailAccounts'][_0xc3451c['id']]['Smtp']['status']=_0x4209('0x1f');_0x3c567f['mailAccounts'][_0xc3451c['id']][_0x4209('0x2e')][_0x4209('0x12')]=_0x1e7f5d;_0x3c567f[_0x4209('0x16')](_0xc3451c['id']);_0x5b0318(_0x1e7f5d);});});}return this[_0x4209('0x2b')]['verify'](_0xc3451c);};module[_0x4209('0x31')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 2e71ae9..ddf9f4f 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 _0x858f=['iconv','events','EventEmitter','../../../config/logger','mailbox','account','getAccount','once','ready','handleReady','bind','end','error','handleError','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','getHost','email','anonymous@xcally.com','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','parser','handleEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','imap','lodash','randomstring','mailparser','simpleParser'];(function(_0xf33243,_0x319493){var _0x29e1f4=function(_0x9d388c){while(--_0x9d388c){_0xf33243['push'](_0xf33243['shift']());}};_0x29e1f4(++_0x319493);}(_0x858f,0xeb));var _0xf858=function(_0x215dc8,_0x52c245){_0x215dc8=_0x215dc8-0x0;var _0x583ea3=_0x858f[_0x215dc8];return _0x583ea3;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var Imap=require(_0xf858('0x0'));var _=require(_0xf858('0x1'));var rs=require(_0xf858('0x2'));var simpleParser=require(_0xf858('0x3'))[_0xf858('0x4')];var Iconv=require(_0xf858('0x5'))['Iconv'];var EventEmitter=require(_0xf858('0x6'))[_0xf858('0x7')];var utils=require('./utils');var logger=require(_0xf858('0x8'))('email');function EmailImap(_0x35752e,_0x3a6d9c){this[_0xf858('0x9')]='INBOX';this[_0xf858('0xa')]=this[_0xf858('0xb')](_0x35752e,_0x3a6d9c);this[_0xf858('0x0')]=new Imap(this[_0xf858('0xa')]);this[_0xf858('0x0')][_0xf858('0xc')](_0xf858('0xd'),this[_0xf858('0xe')][_0xf858('0xf')](this));this[_0xf858('0x0')][_0xf858('0xc')](_0xf858('0x10'),this['handleEnd']['bind'](this));this[_0xf858('0x0')]['on'](_0xf858('0x11'),this[_0xf858('0x12')][_0xf858('0xf')](this));this[_0xf858('0x0')]['connect']();}util[_0xf858('0x13')](EmailImap,EventEmitter);EmailImap[_0xf858('0x14')]['getAccount']=function(_0x37e817,_0x962cf1){var _0x49e8b2={'connTimeout':_0x37e817[_0xf858('0x15')]?_0x37e817[_0xf858('0x15')]*0x3e8:0x2710,'authTimeout':_0x37e817['authTimeout']?_0x37e817[_0xf858('0x16')]*0x3e8:0x1388};if(_[_0xf858('0x17')](_0x37e817[_0xf858('0x18')])){if(_0x37e817[_0xf858('0x19')]){_0x49e8b2[_0xf858('0x1a')]=_0x37e817[_0xf858('0x1a')];_0x49e8b2[_0xf858('0x1b')]=_0x37e817[_0xf858('0x1b')];}_0x49e8b2[_0xf858('0x1c')]=_0x37e817[_0xf858('0x1c')];_0x49e8b2[_0xf858('0x1d')]=_0x37e817[_0xf858('0x1d')]||0x3e1;if(_0x37e817[_0xf858('0x1e')]){_0x49e8b2[_0xf858('0x1e')]=!![];}else{_0x49e8b2[_0xf858('0x1e')]=![];_0x49e8b2['autotls']='required';}}else{_0x49e8b2[_0xf858('0x1a')]=_0x37e817['user'];_0x49e8b2['password']=_0x37e817[_0xf858('0x1b')];_0x49e8b2[_0xf858('0x1c')]=utils[_0xf858('0x1f')](_0x37e817['service']);_0x49e8b2[_0xf858('0x1d')]=0x3e1;_0x49e8b2[_0xf858('0x1e')]=!![];}_0x49e8b2[_0xf858('0x20')]=_0x962cf1||_0x37e817['user']||_0xf858('0x21');return _0x49e8b2;};EmailImap['prototype'][_0xf858('0xe')]=function(){this[_0xf858('0x0')]['openBox'](this['mailbox'],![],this[_0xf858('0x22')][_0xf858('0xf')](this));};EmailImap[_0xf858('0x14')][_0xf858('0x22')]=function(_0x2e5e04,_0x120de8){if(_0x2e5e04){this[_0xf858('0x12')](_0x2e5e04,!![]);}else{this[_0xf858('0x23')](_0xf858('0x24'),_0x120de8);this[_0xf858('0x25')]();}};EmailImap[_0xf858('0x14')][_0xf858('0x26')]=function(_0xf3f34d){if(_0xf3f34d){this[_0xf858('0x12')](_0xf3f34d,!![]);}else{this[_0xf858('0x0')][_0xf858('0x10')]();}};EmailImap[_0xf858('0x14')]['readUnseen']=function(){this[_0xf858('0x0')][_0xf858('0x27')]([_0xf858('0x28')],this[_0xf858('0x29')][_0xf858('0xf')](this));};EmailImap['prototype']['handleReadUnseen']=function(_0xbc7f7e,_0x1d66e6){if(_0xbc7f7e){this[_0xf858('0x12')](_0xbc7f7e,!![]);}else{if(_0x1d66e6[_0xf858('0x2a')]){try{var _0x326480=this[_0xf858('0x0')]['fetch'](_0x1d66e6,{'bodies':'','markSeen':!![]});_0x326480['on'](_0xf858('0x2b'),this[_0xf858('0x2c')]['bind'](this));_0x326480['once']('error',this[_0xf858('0x2d')][_0xf858('0xf')](this));_0x326480[_0xf858('0xc')](_0xf858('0x10'),this[_0xf858('0x2e')][_0xf858('0xf')](this));}catch(_0x12b644){logger[_0xf858('0x11')](_0x12b644);}}else{this[_0xf858('0x0')][_0xf858('0x2f')](!![],this[_0xf858('0x26')][_0xf858('0xf')](this));}}};EmailImap[_0xf858('0x14')]['handleFetchMessage']=function(_0x29f76d,_0x4c931e){_0x29f76d['on'](_0xf858('0x30'),this[_0xf858('0x31')][_0xf858('0xf')](this));_0x29f76d['once'](_0xf858('0x32'),this[_0xf858('0x33')][_0xf858('0xf')](this));_0x29f76d['once'](_0xf858('0x10'),this['handleMessageEnd'][_0xf858('0xf')](this));};EmailImap[_0xf858('0x14')][_0xf858('0x31')]=function(_0x593661,_0x9966e3){simpleParser(_0x593661,{'Iconv':Iconv},this[_0xf858('0x34')][_0xf858('0xf')](this));};EmailImap[_0xf858('0x14')][_0xf858('0x33')]=function(_0x2e1228){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap[_0xf858('0x14')][_0xf858('0x34')]=function(_0x316fc9,_0x28fe6f){if(_0x316fc9){logger[_0xf858('0x11')](_0x316fc9);}else{var _0x3393bf=this;utils[_0xf858('0x35')](this[_0xf858('0xa')],_0x28fe6f,function(_0x5b0005){_0x3393bf[_0xf858('0x23')](_0xf858('0x20'),_0x5b0005);});}};EmailImap[_0xf858('0x14')]['handleFetchEnd']=function(){this[_0xf858('0x0')][_0xf858('0x2f')](!![],this[_0xf858('0x26')]['bind'](this));};EmailImap[_0xf858('0x14')][_0xf858('0x2d')]=function(_0x565aa5){this[_0xf858('0x12')](_0x565aa5);this['imap']['closeBox'](!![],this[_0xf858('0x26')][_0xf858('0xf')](this));};EmailImap[_0xf858('0x14')][_0xf858('0x36')]=function(){this['emit'](_0xf858('0x10'));};EmailImap[_0xf858('0x14')][_0xf858('0x12')]=function(_0x49568d,_0x5f4f60){logger[_0xf858('0x11')](_0xf858('0x12'),this[_0xf858('0xa')][_0xf858('0x20')],JSON[_0xf858('0x37')](_0x49568d));var _0x5fd872='';if(_0x49568d){if(_0x49568d[_0xf858('0x38')]){_0x5fd872=_0x49568d[_0xf858('0x38')];}else{for(var _0x48277b in _0x49568d){if(_0x49568d[_0xf858('0x39')](_0x48277b)){_0x5fd872+=_[_0xf858('0x3a')](_0x48277b)+':\x20'+_0x49568d[_0x48277b]+'\x0a';}}}}if(_0x5f4f60){this['imap']['end']();}else{this[_0xf858('0x23')]('error',_0x5fd872);this[_0xf858('0x23')](_0xf858('0x10'));}};module[_0xf858('0x3b')]=EmailImap; \ No newline at end of file +var _0xaa12=['authentication','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','openBox','handleOpenBox','emit','box','readUnseen','end','search','UNSEEN','handleReadUnseen','length','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','parser','stringify','textCode','hasOwnProperty','upperFirst','error','exports','path','imap','lodash','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','getAccount','account','once','ready','handleReady','bind','handleEnd','handleError','connect','prototype','connTimeout','authTimeout','isNil','service'];(function(_0x59991e,_0x43ca9c){var _0xeb5852=function(_0xca6723){while(--_0xca6723){_0x59991e['push'](_0x59991e['shift']());}};_0xeb5852(++_0x43ca9c);}(_0xaa12,0xec));var _0x2aa1=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xaa12[_0x59ee6f];return _0x4c0979;};'use strict';var fs=require('fs');var path=require(_0x2aa1('0x0'));var util=require('util');var Imap=require(_0x2aa1('0x1'));var _=require(_0x2aa1('0x2'));var rs=require('randomstring');var simpleParser=require(_0x2aa1('0x3'))[_0x2aa1('0x4')];var Iconv=require(_0x2aa1('0x5'))[_0x2aa1('0x6')];var EventEmitter=require(_0x2aa1('0x7'))[_0x2aa1('0x8')];var utils=require(_0x2aa1('0x9'));var logger=require(_0x2aa1('0xa'))(_0x2aa1('0xb'));function EmailImap(_0x434daf,_0x5100e0){this[_0x2aa1('0xc')]=_0x2aa1('0xd');this['account']=this[_0x2aa1('0xe')](_0x434daf,_0x5100e0);this[_0x2aa1('0x1')]=new Imap(this[_0x2aa1('0xf')]);this[_0x2aa1('0x1')][_0x2aa1('0x10')](_0x2aa1('0x11'),this[_0x2aa1('0x12')][_0x2aa1('0x13')](this));this[_0x2aa1('0x1')]['once']('end',this[_0x2aa1('0x14')][_0x2aa1('0x13')](this));this[_0x2aa1('0x1')]['on']('error',this[_0x2aa1('0x15')]['bind'](this));this[_0x2aa1('0x1')][_0x2aa1('0x16')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x2aa1('0x17')][_0x2aa1('0xe')]=function(_0x27cb2a,_0x973e8c){var _0x3afd27={'connTimeout':_0x27cb2a[_0x2aa1('0x18')]?_0x27cb2a[_0x2aa1('0x18')]*0x3e8:0x2710,'authTimeout':_0x27cb2a[_0x2aa1('0x19')]?_0x27cb2a[_0x2aa1('0x19')]*0x3e8:0x1388};if(_[_0x2aa1('0x1a')](_0x27cb2a[_0x2aa1('0x1b')])){if(_0x27cb2a[_0x2aa1('0x1c')]){_0x3afd27[_0x2aa1('0x1d')]=_0x27cb2a[_0x2aa1('0x1d')];_0x3afd27[_0x2aa1('0x1e')]=_0x27cb2a[_0x2aa1('0x1e')];}_0x3afd27['host']=_0x27cb2a[_0x2aa1('0x1f')];_0x3afd27[_0x2aa1('0x20')]=_0x27cb2a[_0x2aa1('0x20')]||0x3e1;if(_0x27cb2a[_0x2aa1('0x21')]){_0x3afd27[_0x2aa1('0x21')]=!![];}else{_0x3afd27['tls']=![];_0x3afd27[_0x2aa1('0x22')]=_0x2aa1('0x23');}}else{_0x3afd27['user']=_0x27cb2a[_0x2aa1('0x1d')];_0x3afd27[_0x2aa1('0x1e')]=_0x27cb2a[_0x2aa1('0x1e')];_0x3afd27[_0x2aa1('0x1f')]=utils[_0x2aa1('0x24')](_0x27cb2a[_0x2aa1('0x1b')]);_0x3afd27[_0x2aa1('0x20')]=0x3e1;_0x3afd27[_0x2aa1('0x21')]=!![];}_0x3afd27[_0x2aa1('0xb')]=_0x973e8c||_0x27cb2a['user']||_0x2aa1('0x25');return _0x3afd27;};EmailImap[_0x2aa1('0x17')][_0x2aa1('0x12')]=function(){this[_0x2aa1('0x1')][_0x2aa1('0x26')](this[_0x2aa1('0xc')],![],this[_0x2aa1('0x27')]['bind'](this));};EmailImap[_0x2aa1('0x17')]['handleOpenBox']=function(_0x5e33d4,_0x714620){if(_0x5e33d4){this[_0x2aa1('0x15')](_0x5e33d4,!![]);}else{this[_0x2aa1('0x28')](_0x2aa1('0x29'),_0x714620);this[_0x2aa1('0x2a')]();}};EmailImap[_0x2aa1('0x17')]['handleCloseBox']=function(_0x452d61){if(_0x452d61){this[_0x2aa1('0x15')](_0x452d61,!![]);}else{this[_0x2aa1('0x1')][_0x2aa1('0x2b')]();}};EmailImap[_0x2aa1('0x17')][_0x2aa1('0x2a')]=function(){this[_0x2aa1('0x1')][_0x2aa1('0x2c')]([_0x2aa1('0x2d')],this[_0x2aa1('0x2e')]['bind'](this));};EmailImap[_0x2aa1('0x17')][_0x2aa1('0x2e')]=function(_0x3aa4ec,_0x3efbbf){if(_0x3aa4ec){this[_0x2aa1('0x15')](_0x3aa4ec,!![]);}else{if(_0x3efbbf[_0x2aa1('0x2f')]){try{var _0x2f1685=this[_0x2aa1('0x1')]['fetch'](_0x3efbbf,{'bodies':'','markSeen':!![]});_0x2f1685['on'](_0x2aa1('0x30'),this[_0x2aa1('0x31')][_0x2aa1('0x13')](this));_0x2f1685[_0x2aa1('0x10')]('error',this[_0x2aa1('0x32')][_0x2aa1('0x13')](this));_0x2f1685[_0x2aa1('0x10')](_0x2aa1('0x2b'),this[_0x2aa1('0x33')]['bind'](this));}catch(_0x447925){logger['error'](_0x447925);}}else{this[_0x2aa1('0x1')][_0x2aa1('0x34')](!![],this[_0x2aa1('0x35')][_0x2aa1('0x13')](this));}}};EmailImap['prototype'][_0x2aa1('0x31')]=function(_0x2d0a83,_0x427c02){_0x2d0a83['on'](_0x2aa1('0x36'),this[_0x2aa1('0x37')]['bind'](this));_0x2d0a83[_0x2aa1('0x10')](_0x2aa1('0x38'),this[_0x2aa1('0x39')][_0x2aa1('0x13')](this));_0x2d0a83[_0x2aa1('0x10')](_0x2aa1('0x2b'),this['handleMessageEnd']['bind'](this));};EmailImap[_0x2aa1('0x17')][_0x2aa1('0x37')]=function(_0x434e8d,_0x480e0b){simpleParser(_0x434e8d,{'Iconv':Iconv},this[_0x2aa1('0x3a')][_0x2aa1('0x13')](this));};EmailImap['prototype'][_0x2aa1('0x39')]=function(_0x2b1baf){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap[_0x2aa1('0x17')][_0x2aa1('0x3a')]=function(_0x3fcd70,_0x340b08){if(_0x3fcd70){logger['error'](_0x3fcd70);}else{var _0x176994=this;utils[_0x2aa1('0x3b')](this[_0x2aa1('0xf')],_0x340b08,function(_0x5f4b22){_0x176994['emit'](_0x2aa1('0xb'),_0x5f4b22);});}};EmailImap['prototype'][_0x2aa1('0x33')]=function(){this['imap'][_0x2aa1('0x34')](!![],this[_0x2aa1('0x35')][_0x2aa1('0x13')](this));};EmailImap[_0x2aa1('0x17')][_0x2aa1('0x32')]=function(_0x3aedd7){this[_0x2aa1('0x15')](_0x3aedd7);this[_0x2aa1('0x1')]['closeBox'](!![],this[_0x2aa1('0x35')][_0x2aa1('0x13')](this));};EmailImap[_0x2aa1('0x17')]['handleEnd']=function(){this['emit']('end');};EmailImap[_0x2aa1('0x17')][_0x2aa1('0x15')]=function(_0x231d84,_0xcff208){logger['error']('handleError',this[_0x2aa1('0xf')][_0x2aa1('0xb')],JSON[_0x2aa1('0x3c')](_0x231d84));var _0x155b55='';if(_0x231d84){if(_0x231d84[_0x2aa1('0x3d')]){_0x155b55=_0x231d84['textCode'];}else{for(var _0x3797f5 in _0x231d84){if(_0x231d84[_0x2aa1('0x3e')](_0x3797f5)){_0x155b55+=_[_0x2aa1('0x3f')](_0x3797f5)+':\x20'+_0x231d84[_0x3797f5]+'\x0a';}}}}if(_0xcff208){this[_0x2aa1('0x1')][_0x2aa1('0x2b')]();}else{this[_0x2aa1('0x28')](_0x2aa1('0x40'),_0x155b55);this[_0x2aa1('0x28')](_0x2aa1('0x2b'));}};module[_0x2aa1('0x41')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 7f09490..7f44e14 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 _0x6ace=['prototype','send','createTransport','use','compile','sendMail','verify','toString','nodemailer','nodemailer-plugin-inline-base64'];(function(_0x5f10a4,_0x539da9){var _0x2fad68=function(_0x2600aa){while(--_0x2600aa){_0x5f10a4['push'](_0x5f10a4['shift']());}};_0x2fad68(++_0x539da9);}(_0x6ace,0xd0));var _0xe6ac=function(_0x56ee31,_0x53079f){_0x56ee31=_0x56ee31-0x0;var _0x4b664c=_0x6ace[_0x56ee31];return _0x4b664c;};'use strict';var nodemailer=require(_0xe6ac('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0xe6ac('0x1'));function EmailSmtp(){}EmailSmtp[_0xe6ac('0x2')][_0xe6ac('0x3')]=function(_0x1f8af7,_0x4f6f17){return new BPromise(function(_0x2ac447,_0x5bb18f){var _0x282822=nodemailer[_0xe6ac('0x4')](_0x1f8af7);_0x282822[_0xe6ac('0x5')](_0xe6ac('0x6'),inlineBase64());_0x282822[_0xe6ac('0x7')](_0x4f6f17,function(_0x3cfc94,_0x58b1ed){if(_0x3cfc94){_0x5bb18f(_0x3cfc94['toString']());}else{_0x2ac447(_0x58b1ed);}});});};EmailSmtp[_0xe6ac('0x2')][_0xe6ac('0x8')]=function(_0x521dbe){return new BPromise(function(_0x3e637a,_0x33c288){var _0x57020d=nodemailer[_0xe6ac('0x4')](_0x521dbe);_0x57020d[_0xe6ac('0x8')](function(_0x435bcf,_0x6d7385){if(_0x435bcf){_0x33c288(_0x435bcf[_0xe6ac('0x9')]());}else{if(_0x6d7385){_0x3e637a(_0x6d7385);}else{_0x33c288('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x8bd4=['send','compile','toString','createTransport','verify','Not\x20verifired','exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype'];(function(_0x4f69ed,_0x25b8e8){var _0x36139b=function(_0x2ba3bc){while(--_0x2ba3bc){_0x4f69ed['push'](_0x4f69ed['shift']());}};_0x36139b(++_0x25b8e8);}(_0x8bd4,0x75));var _0x48bd=function(_0x42d0e8,_0x3d824b){_0x42d0e8=_0x42d0e8-0x0;var _0x4ed2f7=_0x8bd4[_0x42d0e8];return _0x4ed2f7;};'use strict';var nodemailer=require(_0x48bd('0x0'));var BPromise=require(_0x48bd('0x1'));var inlineBase64=require(_0x48bd('0x2'));function EmailSmtp(){}EmailSmtp[_0x48bd('0x3')][_0x48bd('0x4')]=function(_0x52e775,_0x4dacbc){return new BPromise(function(_0x92b31a,_0x566105){var _0x183fae=nodemailer['createTransport'](_0x52e775);_0x183fae['use'](_0x48bd('0x5'),inlineBase64());_0x183fae['sendMail'](_0x4dacbc,function(_0x3f073d,_0x31a9b4){if(_0x3f073d){_0x566105(_0x3f073d[_0x48bd('0x6')]());}else{_0x92b31a(_0x31a9b4);}});});};EmailSmtp[_0x48bd('0x3')]['verify']=function(_0x227553){return new BPromise(function(_0x192fab,_0xed57f0){var _0x4fba55=nodemailer[_0x48bd('0x7')](_0x227553);_0x4fba55[_0x48bd('0x8')](function(_0x13bfd1,_0x34067c){if(_0x13bfd1){_0xed57f0(_0x13bfd1[_0x48bd('0x6')]());}else{if(_0x34067c){_0x192fab(_0x34067c);}else{_0xed57f0(_0x48bd('0x9'));}}});});};module[_0x48bd('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 642f17c..55959a7 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 _0x0c3a=['imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','../../../config/environment','head','value','address','@xcally.com','name','substring','split','slice','join','length','isEmpty','anonymous','generate','html','test','replace','includes','attachments','forEach','push','filename','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','gmail','imap.gmail.com','yahoo'];(function(_0x400454,_0x506bbe){var _0x2288cd=function(_0x410bc9){while(--_0x410bc9){_0x400454['push'](_0x400454['shift']());}};_0x2288cd(++_0x506bbe);}(_0x0c3a,0x171));var _0xa0c3=function(_0x1654cd,_0x47919c){_0x1654cd=_0x1654cd-0x0;var _0x40668e=_0x0c3a[_0x1654cd];return _0x40668e;};'use strict';var _=require(_0xa0c3('0x0'));var moment=require(_0xa0c3('0x1'));var random=require(_0xa0c3('0x2'));var fs=require('fs');var path=require(_0xa0c3('0x3'));var util=require(_0xa0c3('0x4'));var tnef=require(_0xa0c3('0x5'));var logger=require(_0xa0c3('0x6'))('email');var config=require(_0xa0c3('0x7'));function getAddress(_0x11e5d4){var _0x5d79bc=_[_0xa0c3('0x8')](_0x11e5d4[_0xa0c3('0x9')]);return _0x5d79bc&&_0x5d79bc['address']?_0x5d79bc[_0xa0c3('0xa')]:'anonymous'+random['generate'](0x6)+_0xa0c3('0xb');}function getFirstName(_0x109c9a){var _0x3b524a=_[_0xa0c3('0x8')](_0x109c9a['value']);if(_0x3b524a&&_0x3b524a[_0xa0c3('0xc')]){if(_0x3b524a[_0xa0c3('0xc')]==_0x3b524a['address']){return _0x3b524a['name'][_0xa0c3('0xd')](0x0,_0x3b524a[_0xa0c3('0xc')]['indexOf']('@'));}var _0x30522f=_0x3b524a[_0xa0c3('0xc')][_0xa0c3('0xe')](/\s+/);return _0x30522f['length']>0x1?_0x30522f[_0xa0c3('0xf')](0x0,-0x1)[_0xa0c3('0x10')]('\x20'):_0x3b524a['name'];}return'Anonymous';}function getLastName(_0x2de54f){var _0x2452d8=_[_0xa0c3('0x8')](_0x2de54f[_0xa0c3('0x9')]);if(_0x2452d8&&_0x2452d8[_0xa0c3('0xc')]){var _0x4bbfcf=_0x2452d8[_0xa0c3('0xc')]['split'](/\s+/);return _0x4bbfcf[_0xa0c3('0x11')]>0x1?_0x4bbfcf['pop']():'';}return'';}function getMails(_0x49983c,_0x4d5c8a){var _0xd70a2b='';for(var _0x474695=0x0;_0x474695<_0x4d5c8a[_0xa0c3('0x9')]['length'];_0x474695+=0x1){if(_0x4d5c8a[_0xa0c3('0x9')][_0x474695][_0xa0c3('0xa')]!==_0x49983c){if(!_[_0xa0c3('0x12')](_0xd70a2b)){_0xd70a2b+=',';}_0xd70a2b+=_0x4d5c8a[_0xa0c3('0x9')][_0x474695][_0xa0c3('0xc')]||_0x4d5c8a[_0xa0c3('0x9')][_0x474695][_0xa0c3('0xa')]||'';_0xd70a2b+='\x20<';_0xd70a2b+=_0x4d5c8a['value'][_0x474695][_0xa0c3('0xa')]?_0x4d5c8a['value'][_0x474695][_0xa0c3('0xa')]:_0xa0c3('0x13')+random[_0xa0c3('0x14')](0x6)+_0xa0c3('0xb');_0xd70a2b+='>';}}return _0xd70a2b;}function parseEmail(_0x53111d,_0x91fd9f,_0x2be9eb){if(_0x91fd9f[_0xa0c3('0x15')]){var _0x1a1c0b=/)<[^<]*)*<\/script>/gi;while(_0x1a1c0b[_0xa0c3('0x16')](_0x91fd9f[_0xa0c3('0x15')])){_0x91fd9f[_0xa0c3('0x15')]=_0x91fd9f['html'][_0xa0c3('0x17')](_0x1a1c0b,'');}if(_0x91fd9f[_0xa0c3('0x15')][_0xa0c3('0x18')]('{_0x47b303[_0xa0c3('0x1b')](_0x16daf8[_0xa0c3('0x1c')]);});var _0x303410=/]+>/g;var _0x381f3b=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x171720=_0x91fd9f['html'][_0xa0c3('0x17')](_0x381f3b,_0xa0c3('0x1d'));var _0x254969=_0x171720[_0xa0c3('0x17')](_0x303410,_0xa0c3('0x1e'));for(let _0x54cf9e=0x0;_0x54cf9e<_0x47b303[_0xa0c3('0x11')];_0x54cf9e++){var _0x51ea75=_0x254969[_0xa0c3('0x17')](_0xa0c3('0x1e'),_0xa0c3('0x1f')+_0x47b303[_0x54cf9e]+_0xa0c3('0x20'));_0x254969=_0x51ea75;}_0x91fd9f[_0xa0c3('0x15')]=_0x254969;}_0x2be9eb[_0xa0c3('0x21')]=_0x91fd9f['html'];}else{_0x2be9eb[_0xa0c3('0x21')]=_0x91fd9f[_0xa0c3('0x22')];}if(_0x2be9eb[_0xa0c3('0x21')]){_0x2be9eb[_0xa0c3('0x21')]=_0x2be9eb[_0xa0c3('0x21')]['replace'](/0x0){var _0x382228=[_0xa0c3('0x32'),_0xa0c3('0x33'),_0xa0c3('0x34')];for(var _0x2fdae9=0x0;_0x2fdae9<_0x91fd9f[_0xa0c3('0x31')][_0xa0c3('0x11')];_0x2fdae9++){var _0x24b1db=_[_0xa0c3('0x35')](_0x382228,_0x91fd9f[_0xa0c3('0x31')][_0x2fdae9][_0xa0c3('0x36')]);if(_0x24b1db>=0x0){_0x2be9eb['isAutoreply']=!![];}}}return _0x2be9eb;}exports[_0xa0c3('0x37')]=function(_0x30dbe4,_0x3d0b8c,_0x43f80c){var _0x247e0c={'from':getAddress(_0x3d0b8c[_0xa0c3('0x38')]),'firstName':getFirstName(_0x3d0b8c[_0xa0c3('0x38')]),'lastName':getLastName(_0x3d0b8c[_0xa0c3('0x38')]),'mapKey':_0xa0c3('0x27'),'message':{'from':getMails(_0x30dbe4[_0xa0c3('0x27')],_0x3d0b8c['from']),'to':_0x30dbe4[_0xa0c3('0x27')],'cc':'','subject':_0x3d0b8c[_0xa0c3('0x39')]||'','messageId':_0x3d0b8c[_0xa0c3('0x3a')],'inReplyTo':_0x3d0b8c[_0xa0c3('0x3b')],'sentAt':moment(_0x3d0b8c['date'])[_0xa0c3('0x2b')](_0xa0c3('0x3c')),'attach':![],'attachments':[]}};if(!_0x3d0b8c[_0xa0c3('0x15')]&&!_0x3d0b8c[_0xa0c3('0x22')]){var _0x9b9954=_['filter'](_0x3d0b8c['attachments'],{'contentType':'application/ms-tnef'});if(_0x9b9954[_0xa0c3('0x11')]){logger['info'](util[_0xa0c3('0x2b')](_0xa0c3('0x3d'),_0x3d0b8c[_0xa0c3('0x3a')]));tnef['parseBuffer'](_[_0xa0c3('0x3e')](_0x9b9954)['content'],function(_0x51f22f,_0x168c06){if(_0x168c06){_0x3d0b8c[_0xa0c3('0x15')]=_0x168c06[_0xa0c3('0x3f')]||_0xa0c3('0x40');if(_0x168c06[_0xa0c3('0x41')]){for(var _0x23fe12=0x0;_0x23fe12<_0x168c06[_0xa0c3('0x41')][_0xa0c3('0x11')];_0x23fe12++){var _0x315ee5=_0x168c06[_0xa0c3('0x41')][_0x23fe12];_0x247e0c['message']['attachments'][_0xa0c3('0x1b')]({'filename':_0x315ee5['Title'],'content':Buffer['from'](_0x315ee5['Data'])});}}}_0x43f80c(parseEmail(_0x30dbe4,_0x3d0b8c,_0x247e0c));});}else{_0x3d0b8c[_0xa0c3('0x15')]='

Empty\x20message

';_0x43f80c(parseEmail(_0x30dbe4,_0x3d0b8c,_0x247e0c));}}else{_0x43f80c(parseEmail(_0x30dbe4,_0x3d0b8c,_0x247e0c));}};exports['getHost']=function(_0x354935){switch(_0x354935){case _0xa0c3('0x42'):return _0xa0c3('0x43');case _0xa0c3('0x44'):return'imap.mail.yahoo.com';case'hotmail':return _0xa0c3('0x45');case _0xa0c3('0x46'):return _0xa0c3('0x47');}return _0xa0c3('0x48');}; \ No newline at end of file +var _0x9264=['indexOf','line','isAutoreply','parser','from','subject','messageId','inReplyTo','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','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','lodash','moment','randomstring','path','../../../config/logger','address','generate','@xcally.com','head','value','name','split','length','join','Anonymous','pop','anonymous','html','includes','','body','textAsHtml','0x1?_0x5f27dd['slice'](0x0,-0x1)[_0x4926('0xd')]('\x20'):_0x18e43d[_0x4926('0xa')];}return _0x4926('0xe');}function getLastName(_0x44325a){var _0x2613a2=_[_0x4926('0x8')](_0x44325a[_0x4926('0x9')]);if(_0x2613a2&&_0x2613a2[_0x4926('0xa')]){var _0x21503d=_0x2613a2[_0x4926('0xa')][_0x4926('0xb')](/\s+/);return _0x21503d[_0x4926('0xc')]>0x1?_0x21503d[_0x4926('0xf')]():'';}return'';}function getMails(_0x1ac74f,_0x55b957){var _0x1703ed='';for(var _0x258914=0x0;_0x258914<_0x55b957[_0x4926('0x9')]['length'];_0x258914+=0x1){if(_0x55b957['value'][_0x258914][_0x4926('0x5')]!==_0x1ac74f){if(!_['isEmpty'](_0x1703ed)){_0x1703ed+=',';}_0x1703ed+=_0x55b957[_0x4926('0x9')][_0x258914][_0x4926('0xa')]||_0x55b957['value'][_0x258914][_0x4926('0x5')]||'';_0x1703ed+='\x20<';_0x1703ed+=_0x55b957['value'][_0x258914][_0x4926('0x5')]?_0x55b957[_0x4926('0x9')][_0x258914][_0x4926('0x5')]:_0x4926('0x10')+random['generate'](0x6)+'@xcally.com';_0x1703ed+='>';}}return _0x1703ed;}function parseEmail(_0x1e8d98,_0x588c7a,_0x48de21){if(_0x588c7a[_0x4926('0x11')]){var _0x309c71=/)<[^<]*)*<\/script>/gi;while(_0x309c71['test'](_0x588c7a[_0x4926('0x11')])){_0x588c7a['html']=_0x588c7a[_0x4926('0x11')]['replace'](_0x309c71,'');}if(_0x588c7a[_0x4926('0x11')][_0x4926('0x12')](_0x4926('0x13'))){var _0x44eb88=[];_0x588c7a['attachments']['forEach'](_0x5c8935=>{_0x44eb88[_0x4926('0x14')](_0x5c8935[_0x4926('0x15')]);});var _0x43c077=/]+>/g;var _0x2519a2=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x51be4f=_0x588c7a['html']['replace'](_0x2519a2,_0x4926('0x16'));var _0x273f4b=_0x51be4f[_0x4926('0x17')](_0x43c077,'_IMG');for(let _0x514755=0x0;_0x514755<_0x44eb88['length'];_0x514755++){var _0x37701c=_0x273f4b[_0x4926('0x17')](_0x4926('0x18'),'\x20[Attachment:\x20'+_0x44eb88[_0x514755]+_0x4926('0x19'));_0x273f4b=_0x37701c;}_0x588c7a[_0x4926('0x11')]=_0x273f4b;}_0x48de21[_0x4926('0x1a')]=_0x588c7a[_0x4926('0x11')];}else{_0x48de21[_0x4926('0x1a')]=_0x588c7a[_0x4926('0x1b')];}if(_0x48de21['body']){_0x48de21[_0x4926('0x1a')]=_0x48de21[_0x4926('0x1a')][_0x4926('0x17')](/0x0){var _0x4c2be7=['Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply'];for(var _0x1dd36b=0x0;_0x1dd36b<_0x588c7a[_0x4926('0x2f')][_0x4926('0xc')];_0x1dd36b++){var _0x2c76d6=_[_0x4926('0x30')](_0x4c2be7,_0x588c7a['headerLines'][_0x1dd36b][_0x4926('0x31')]);if(_0x2c76d6>=0x0){_0x48de21[_0x4926('0x32')]=!![];}}}return _0x48de21;}exports[_0x4926('0x33')]=function(_0x9dc879,_0x437800,_0x42be93){var _0x22d32e={'from':getAddress(_0x437800[_0x4926('0x34')]),'firstName':getFirstName(_0x437800[_0x4926('0x34')]),'lastName':getLastName(_0x437800[_0x4926('0x34')]),'mapKey':'email','message':{'from':getMails(_0x9dc879['email'],_0x437800[_0x4926('0x34')]),'to':_0x9dc879['email'],'cc':'','subject':_0x437800[_0x4926('0x35')]||'','messageId':_0x437800[_0x4926('0x36')],'inReplyTo':_0x437800[_0x4926('0x37')],'sentAt':moment(_0x437800['date'])[_0x4926('0x28')](_0x4926('0x38')),'attach':![],'attachments':[]}};if(!_0x437800[_0x4926('0x11')]&&!_0x437800[_0x4926('0x1b')]){var _0x43561b=_[_0x4926('0x39')](_0x437800[_0x4926('0x23')],{'contentType':_0x4926('0x3a')});if(_0x43561b[_0x4926('0xc')]){logger[_0x4926('0x3b')](util[_0x4926('0x28')](_0x4926('0x3c'),_0x437800[_0x4926('0x36')]));tnef[_0x4926('0x3d')](_[_0x4926('0x3e')](_0x43561b)['content'],function(_0x1ee46d,_0x3c8bbe){if(_0x3c8bbe){_0x437800['html']=_0x3c8bbe[_0x4926('0x3f')]||_0x4926('0x40');if(_0x3c8bbe[_0x4926('0x41')]){for(var _0x572c91=0x0;_0x572c91<_0x3c8bbe[_0x4926('0x41')][_0x4926('0xc')];_0x572c91++){var _0x41041c=_0x3c8bbe[_0x4926('0x41')][_0x572c91];_0x22d32e[_0x4926('0x1d')][_0x4926('0x23')][_0x4926('0x14')]({'filename':_0x41041c[_0x4926('0x42')],'content':Buffer['from'](_0x41041c[_0x4926('0x43')])});}}}_0x42be93(parseEmail(_0x9dc879,_0x437800,_0x22d32e));});}else{_0x437800['html']='

Empty\x20message

';_0x42be93(parseEmail(_0x9dc879,_0x437800,_0x22d32e));}}else{_0x42be93(parseEmail(_0x9dc879,_0x437800,_0x22d32e));}};exports[_0x4926('0x44')]=function(_0x391e0e){switch(_0x391e0e){case'gmail':return _0x4926('0x45');case _0x4926('0x46'):return _0x4926('0x47');case _0x4926('0x48'):return _0x4926('0x49');case _0x4926('0x4a'):return'outlook.office365.com';}return'127.0.0.1';}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index d93933b..e8f9ef3 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 _0x6c56=['Imap','Smtp','exports','lodash','name','Service','key','SERV','active'];(function(_0x4fbb15,_0x21be0c){var _0x436338=function(_0x3b5a05){while(--_0x3b5a05){_0x4fbb15['push'](_0x4fbb15['shift']());}};_0x436338(++_0x21be0c);}(_0x6c56,0x1d7));var _0x66c5=function(_0x15cdcb,_0x4340e9){_0x15cdcb=_0x15cdcb-0x0;var _0x37b069=_0x6c56[_0x15cdcb];return _0x37b069;};'use strict';var _=require(_0x66c5('0x0'));function MailAccount(_0x43abd7){this['id']=_0x43abd7['id']||0x0;this[_0x66c5('0x1')]=_0x43abd7['name']||_0x66c5('0x2');this[_0x66c5('0x3')]=_0x43abd7[_0x66c5('0x3')]||_0x66c5('0x4');this['active']=_0x43abd7[_0x66c5('0x5')]||![];this[_0x66c5('0x6')]=_0x43abd7[_0x66c5('0x6')]||[];this[_0x66c5('0x7')]=_0x43abd7[_0x66c5('0x7')]||[];}module[_0x66c5('0x8')]=MailAccount; \ No newline at end of file +var _0x8cb4=['name','key','SERV','active','Smtp','exports'];(function(_0x5c0813,_0x5b490d){var _0x3f0bf4=function(_0x56c1d){while(--_0x56c1d){_0x5c0813['push'](_0x5c0813['shift']());}};_0x3f0bf4(++_0x5b490d);}(_0x8cb4,0x1d4));var _0x48cb=function(_0x4db6b1,_0x285282){_0x4db6b1=_0x4db6b1-0x0;var _0x1ec25f=_0x8cb4[_0x4db6b1];return _0x1ec25f;};'use strict';var _=require('lodash');function MailAccount(_0x5b3231){this['id']=_0x5b3231['id']||0x0;this[_0x48cb('0x0')]=_0x5b3231[_0x48cb('0x0')]||'Service';this[_0x48cb('0x1')]=_0x5b3231['key']||_0x48cb('0x2');this[_0x48cb('0x3')]=_0x5b3231[_0x48cb('0x3')]||![];this['Imap']=_0x5b3231['Imap']||[];this['Smtp']=_0x5b3231[_0x48cb('0x4')]||[];}module[_0x48cb('0x5')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index c549d82..1f63a19 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 _0x1b8c=['prototype','length','isUndefined','merge','../model/mailAccount','mailAccounts','hasOwnProperty'];(function(_0x26dc96,_0x10c6f5){var _0x30b7be=function(_0x47de22){while(--_0x47de22){_0x26dc96['push'](_0x26dc96['shift']());}};_0x30b7be(++_0x10c6f5);}(_0x1b8c,0x18c));var _0xc1b8=function(_0x51ba0d,_0x147079){_0x51ba0d=_0x51ba0d-0x0;var _0x3bdb3d=_0x1b8c[_0x51ba0d];return _0x3bdb3d;};'use strict';var _=require('lodash');var MailAccount=require(_0xc1b8('0x0'));var Realtime=function(){this[_0xc1b8('0x1')]={};};function freeIsNotKey(_0x4c507a,_0x1e6474,_0x39cacd){var _0x4970e1=_['mapKeys'](_0x4c507a,function(_0x4d4f77,_0x38df8c){return _0x4d4f77[_0x39cacd];});for(var _0x290a60 in _0x1e6474){if(_0x1e6474[_0xc1b8('0x2')](_0x290a60)){if(!_0x4970e1[_0x290a60]){delete _0x1e6474[_0x290a60];}}}}Realtime[_0xc1b8('0x3')]['mergeFromDatabase']=function(_0x30e8ca,_0x1f2fff){for(var _0x257744 in _0x1f2fff){if(_0x30e8ca[_0xc1b8('0x2')](_0x257744)){_0x30e8ca[_0x257744]=_0x1f2fff[_0x257744];}}};Realtime[_0xc1b8('0x3')]['initMailAccounts']=function(){var _0x11c39d=this;return function(_0x5e0894){if(_0x5e0894){freeIsNotKey(_0x5e0894,_0x11c39d[_0xc1b8('0x1')],'id');for(var _0x50695e=0x0,_0x57526f={},_0x592762={};_0x50695e<_0x5e0894[_0xc1b8('0x4')];_0x50695e+=0x1){_0x57526f=_0x5e0894[_0x50695e];if(_[_0xc1b8('0x5')](_0x11c39d['mailAccounts'][_0x57526f['id']])){_0x11c39d['mailAccounts'][_0x57526f['id']]=new MailAccount(_0x57526f);}else{_[_0xc1b8('0x6')](_0x11c39d[_0xc1b8('0x1')][_0x57526f['id']],_0x57526f);}}}return _0x11c39d[_0xc1b8('0x1')];};};module['exports']=Realtime; \ No newline at end of file +var _0x2b52=['isUndefined','merge','lodash','mailAccounts','mapKeys','hasOwnProperty','mergeFromDatabase','prototype'];(function(_0x3a8301,_0x5edfe5){var _0x1bdf91=function(_0x2986ed){while(--_0x2986ed){_0x3a8301['push'](_0x3a8301['shift']());}};_0x1bdf91(++_0x5edfe5);}(_0x2b52,0xba));var _0x22b5=function(_0x15876a,_0x15383d){_0x15876a=_0x15876a-0x0;var _0xbd900f=_0x2b52[_0x15876a];return _0xbd900f;};'use strict';var _=require(_0x22b5('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x22b5('0x1')]={};};function freeIsNotKey(_0x577cb5,_0x301f16,_0x242d9c){var _0x54c679=_[_0x22b5('0x2')](_0x577cb5,function(_0x4e166c,_0x33ed7d){return _0x4e166c[_0x242d9c];});for(var _0x24bb3a in _0x301f16){if(_0x301f16[_0x22b5('0x3')](_0x24bb3a)){if(!_0x54c679[_0x24bb3a]){delete _0x301f16[_0x24bb3a];}}}}Realtime['prototype'][_0x22b5('0x4')]=function(_0x547a34,_0x27fd7c){for(var _0x181ae2 in _0x27fd7c){if(_0x547a34[_0x22b5('0x3')](_0x181ae2)){_0x547a34[_0x181ae2]=_0x27fd7c[_0x181ae2];}}};Realtime[_0x22b5('0x5')]['initMailAccounts']=function(){var _0x2d6474=this;return function(_0x26bba4){if(_0x26bba4){freeIsNotKey(_0x26bba4,_0x2d6474[_0x22b5('0x1')],'id');for(var _0x1c67bb=0x0,_0x1773b1={},_0x2dfbd2={};_0x1c67bb<_0x26bba4['length'];_0x1c67bb+=0x1){_0x1773b1=_0x26bba4[_0x1c67bb];if(_[_0x22b5('0x6')](_0x2d6474[_0x22b5('0x1')][_0x1773b1['id']])){_0x2d6474['mailAccounts'][_0x1773b1['id']]=new MailAccount(_0x1773b1);}else{_[_0x22b5('0x7')](_0x2d6474[_0x22b5('0x1')][_0x1773b1['id']],_0x1773b1);}}}return _0x2d6474[_0x22b5('0x1')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index fcef96d..aaa444e 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 _0xa456=['TemplateId','MailServerIn','Imap','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','service','email','active','ListId'];(function(_0x7460d8,_0x2fc1a1){var _0x338f82=function(_0x1cec50){while(--_0x1cec50){_0x7460d8['push'](_0x7460d8['shift']());}};_0x338f82(++_0x2fc1a1);}(_0xa456,0x142));var _0x6a45=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xa456[_0x4ae6ef];return _0x3cbb4e;};'use strict';var client=require(_0x6a45('0x0'));exports[_0x6a45('0x1')]=function(){return function(){return client[_0x6a45('0x2')](_0x6a45('0x3'),{'options':{'attributes':['id','name',_0x6a45('0x4'),_0x6a45('0x5'),_0x6a45('0x6'),'key',_0x6a45('0x7'),_0x6a45('0x8')],'raw':![],'include':[{'model':_0x6a45('0x9'),'as':_0x6a45('0xa')},{'model':'MailServerOut','as':_0x6a45('0xb')}]},'log':_0x6a45('0xc')});};};exports[_0x6a45('0xd')]=function(_0x19e67c,_0x3deb09){return client['Request'](_0x6a45('0xe'),{'account':{'id':_0x19e67c},'body':_0x3deb09,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x9af6=['getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','service','key','ListId','TemplateId','Imap','Smtp'];(function(_0x4a1acd,_0x346390){var _0x19a0fb=function(_0x2e667c){while(--_0x2e667c){_0x4a1acd['push'](_0x4a1acd['shift']());}};_0x19a0fb(++_0x346390);}(_0x9af6,0x1d7));var _0x69af=function(_0x186acc,_0x4e2dab){_0x186acc=_0x186acc-0x0;var _0x2fe027=_0x9af6[_0x186acc];return _0x2fe027;};'use strict';var client=require(_0x69af('0x0'));exports[_0x69af('0x1')]=function(){return function(){return client[_0x69af('0x2')]('GetMailAccount',{'options':{'attributes':['id','name',_0x69af('0x3'),'email','active',_0x69af('0x4'),_0x69af('0x5'),_0x69af('0x6')],'raw':![],'include':[{'model':'MailServerIn','as':_0x69af('0x7')},{'model':'MailServerOut','as':_0x69af('0x8')}]},'log':_0x69af('0x9')});};};exports[_0x69af('0xa')]=function(_0x17353a,_0x26ecde){return client[_0x69af('0x2')](_0x69af('0xb'),{'account':{'id':_0x17353a},'body':_0x26ecde,'log':_0x69af('0xb')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 3d78666..cf3e4c7 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 _0xc7f6=['ShowSetting','getSettings','Request'];(function(_0x494a42,_0x1f2103){var _0x254792=function(_0x5f1c1d){while(--_0x5f1c1d){_0x494a42['push'](_0x494a42['shift']());}};_0x254792(++_0x1f2103);}(_0xc7f6,0xee));var _0x6c7f=function(_0xb33879,_0x38b0cc){_0xb33879=_0xb33879-0x0;var _0x305a36=_0xc7f6[_0xb33879];return _0x305a36;};'use strict';var client=require('../client');exports[_0x6c7f('0x0')]=function(){return client[_0x6c7f('0x1')](_0x6c7f('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':'GetSettings'});}; \ No newline at end of file +var _0x6258=['Request','loginMailFrequency','GetSettings','getSettings'];(function(_0x3da40b,_0x228dde){var _0x2e8434=function(_0x140b68){while(--_0x140b68){_0x3da40b['push'](_0x3da40b['shift']());}};_0x2e8434(++_0x228dde);}(_0x6258,0x8b));var _0x8625=function(_0x2f5a10,_0x5e56b4){_0x2f5a10=_0x2f5a10-0x0;var _0x2c8732=_0x6258[_0x2f5a10];return _0x2c8732;};'use strict';var client=require('../client');exports[_0x8625('0x0')]=function(){return client[_0x8625('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x8625('0x2')]},'log':_0x8625('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index e8383bc..f06cfb7 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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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 3ed696c..721289b 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 _0x73e0=['sticky-session','../../config/environment','createServer','timeout','listen','port','socket.io','polling','defaults','redis','socket.io-redis','../../config/triggers','default','../../config/socketio','../../routes','once','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express'];(function(_0x3bdd95,_0x18e65a){var _0x4baade=function(_0x12f97a){while(--_0x12f97a){_0x3bdd95['push'](_0x3bdd95['shift']());}};_0x4baade(++_0x18e65a);}(_0x73e0,0x19f));var _0x073e=function(_0x423174,_0x1a989e){_0x423174=_0x423174-0x0;var _0x50dbab=_0x73e0[_0x423174];return _0x50dbab;};'use strict';var _=require(_0x073e('0x0'));var http=require(_0x073e('0x1'));var express=require(_0x073e('0x2'));var sticky=require(_0x073e('0x3'));var Redis=require('ioredis');var config=require(_0x073e('0x4'));var app=express();var server=http[_0x073e('0x5')](app);server[_0x073e('0x6')]=0xdbba0;if(sticky[_0x073e('0x7')](server,config[_0x073e('0x8')])){var socketio=require(_0x073e('0x9'))(server,{'transports':['websocket',_0x073e('0xa')]});config['redis']=_[_0x073e('0xb')](config[_0x073e('0xc')],{'host':'localhost','port':0x18eb});socketio['adapter'](require(_0x073e('0xd'))({'pubClient':new Redis(config[_0x073e('0xc')]),'subClient':new Redis(config[_0x073e('0xc')])}));require(_0x073e('0xe'))[_0x073e('0xf')]();require(_0x073e('0x10'))['default'](socketio);require('../../config/express')['default'](app);require(_0x073e('0x11'))[_0x073e('0xf')](app);}else{server[_0x073e('0x12')](_0x073e('0x13'),function(){console['log'](_0x073e('0x14'),config['port']);});}exports=module[_0x073e('0x15')]=app; \ No newline at end of file +var _0xeb01=['http','express','sticky-session','../../config/environment','createServer','timeout','listen','port','socket.io','polling','redis','defaults','adapter','../../config/triggers','default','../../config/socketio','../../config/express','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash'];(function(_0x366f2e,_0x6bff89){var _0x5059fe=function(_0x49d81e){while(--_0x49d81e){_0x366f2e['push'](_0x366f2e['shift']());}};_0x5059fe(++_0x6bff89);}(_0xeb01,0x1cd));var _0x1eb0=function(_0x218e04,_0x44d8b3){_0x218e04=_0x218e04-0x0;var _0x4a537a=_0xeb01[_0x218e04];return _0x4a537a;};'use strict';var _=require(_0x1eb0('0x0'));var http=require(_0x1eb0('0x1'));var express=require(_0x1eb0('0x2'));var sticky=require(_0x1eb0('0x3'));var Redis=require('ioredis');var config=require(_0x1eb0('0x4'));var app=express();var server=http[_0x1eb0('0x5')](app);server[_0x1eb0('0x6')]=0xdbba0;if(sticky[_0x1eb0('0x7')](server,config[_0x1eb0('0x8')])){var socketio=require(_0x1eb0('0x9'))(server,{'transports':['websocket',_0x1eb0('0xa')]});config[_0x1eb0('0xb')]=_[_0x1eb0('0xc')](config[_0x1eb0('0xb')],{'host':'localhost','port':0x18eb});socketio[_0x1eb0('0xd')](require('socket.io-redis')({'pubClient':new Redis(config['redis']),'subClient':new Redis(config['redis'])}));require(_0x1eb0('0xe'))[_0x1eb0('0xf')]();require(_0x1eb0('0x10'))[_0x1eb0('0xf')](socketio);require(_0x1eb0('0x11'))['default'](app);require('../../routes')['default'](app);}else{server['once'](_0x1eb0('0x12'),function(){console[_0x1eb0('0x13')](_0x1eb0('0x14'),config[_0x1eb0('0x8')]);});}exports=module[_0x1eb0('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index e766eb2..4af09d5 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 _0xe815=['routing','client','Request','request','then','rpc','error','message','result','catch','jayson/promise','bluebird','../../config/logger'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0xe815,0x1b7));var _0x5e81=function(_0x298283,_0x1a54d9){_0x298283=_0x298283-0x0;var _0x204eb5=_0xe815[_0x298283];return _0x204eb5;};'use strict';var jayson=require(_0x5e81('0x0'));var BPromise=require(_0x5e81('0x1'));var logger=require(_0x5e81('0x2'))(_0x5e81('0x3'));var client=jayson[_0x5e81('0x4')]['http']({'port':0x2329});client[_0x5e81('0x5')]=function(_0x338aea,_0x34188e){return new BPromise(function(_0x17aa00,_0x592ae8){return client[_0x5e81('0x6')](_0x338aea,_0x34188e)[_0x5e81('0x7')](function(_0x1e4e47){logger['debug'](_0x5e81('0x8'),_0x5e81('0x3'),_0x338aea,_0x34188e,_0x1e4e47);if(_0x1e4e47[_0x5e81('0x9')]){logger[_0x5e81('0x9')](_0x5e81('0x8'),'routing',_0x338aea,_0x1e4e47[_0x5e81('0x9')]['message'],_0x34188e);return _0x592ae8(_0x1e4e47['error'][_0x5e81('0xa')]);}else{return _0x17aa00(_0x1e4e47[_0x5e81('0xb')]);}})[_0x5e81('0xc')](function(_0x54d625){logger[_0x5e81('0x9')](_0x5e81('0x8'),_0x5e81('0x3'),_0x338aea,_0x54d625,_0x34188e);return _0x592ae8(_0x54d625);});});};module['exports']=client; \ No newline at end of file +var _0xdab5=['error','rpc','routing','message','exports','jayson/promise','bluebird','client','Request','then','debug'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xdab5,0x165));var _0x5dab=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xdab5[_0x50a0c2];return _0x5ebadd;};'use strict';var jayson=require(_0x5dab('0x0'));var BPromise=require(_0x5dab('0x1'));var logger=require('../../config/logger')('routing');var client=jayson[_0x5dab('0x2')]['http']({'port':0x2329});client[_0x5dab('0x3')]=function(_0x5ce685,_0x337733){return new BPromise(function(_0x48d55a,_0x27cae1){return client['request'](_0x5ce685,_0x337733)[_0x5dab('0x4')](function(_0x701c8){logger[_0x5dab('0x5')]('rpc','routing',_0x5ce685,_0x337733,_0x701c8);if(_0x701c8[_0x5dab('0x6')]){logger[_0x5dab('0x6')](_0x5dab('0x7'),_0x5dab('0x8'),_0x5ce685,_0x701c8[_0x5dab('0x6')][_0x5dab('0x9')],_0x337733);return _0x27cae1(_0x701c8['error'][_0x5dab('0x9')]);}else{return _0x48d55a(_0x701c8['result']);}})['catch'](function(_0x4eb463){logger[_0x5dab('0x6')](_0x5dab('0x7'),_0x5dab('0x8'),_0x5ce685,_0x4eb463,_0x337733);return _0x27cae1(_0x4eb463);});});};module[_0x5dab('0xa')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index cabcd3b..e411c2d 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 _0xadf3=['initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','catch','bluebird','./server','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','then','getAgents','getIntervals','initOpenchannelQueues','getChatQueues'];(function(_0x3555c0,_0xb06408){var _0x1337ad=function(_0x3ade78){while(--_0x3ade78){_0x3555c0['push'](_0x3555c0['shift']());}};_0x1337ad(++_0xb06408);}(_0xadf3,0xa9));var _0x3adf=function(_0x3d2ebb,_0x54ee9a){_0x3d2ebb=_0x3d2ebb-0x0;var _0x47c3cc=_0xadf3[_0x3d2ebb];return _0x47c3cc;};'use strict';var BPromise=require(_0x3adf('0x0'));var server=require(_0x3adf('0x1'));var Realtime=require(_0x3adf('0x2'));var user=require(_0x3adf('0x3'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x3adf('0x4'));var chatQueue=require(_0x3adf('0x5'));var smsQueue=require(_0x3adf('0x6'));var mailQueue=require(_0x3adf('0x7'));var faxQueue=require(_0x3adf('0x8'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x3adf('0x9')]()[_0x3adf('0xa')](user[_0x3adf('0xb')]())['then'](realtime['initAgents']())[_0x3adf('0xa')](interval[_0x3adf('0xc')]())[_0x3adf('0xa')](realtime['initIntervals']())[_0x3adf('0xa')](openchannelQueue['getOpenchannelQueues']())[_0x3adf('0xa')](realtime[_0x3adf('0xd')]())[_0x3adf('0xa')](chatQueue[_0x3adf('0xe')]())['then'](realtime[_0x3adf('0xf')]())['then'](smsQueue[_0x3adf('0x10')]())['then'](realtime[_0x3adf('0x11')]())[_0x3adf('0xa')](mailQueue[_0x3adf('0x12')]())[_0x3adf('0xa')](realtime['initMailQueues']())[_0x3adf('0xa')](faxQueue[_0x3adf('0x13')]())['then'](realtime[_0x3adf('0x14')]())[_0x3adf('0xa')](whatsappQueue[_0x3adf('0x15')]())[_0x3adf('0xa')](realtime['initWhatsappQueues']())[_0x3adf('0xa')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x3adf('0xa')](function(_0x495af8){return initRealtime();})[_0x3adf('0xa')](function(_0x2eb390){return setInterval(initRealtime,0x1388);})[_0x3adf('0x16')](function(_0x3e4a0a){console['log'](_0x3e4a0a);});}main(); \ No newline at end of file +var _0xc300=['resolve','then','getAgents','getIntervals','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue'];(function(_0x121336,_0x3370ea){var _0x53ff9f=function(_0x4482fe){while(--_0x4482fe){_0x121336['push'](_0x121336['shift']());}};_0x53ff9f(++_0x3370ea);}(_0xc300,0x1f1));var _0x0c30=function(_0x18cadb,_0xf59330){_0x18cadb=_0x18cadb-0x0;var _0x2422c2=_0xc300[_0x18cadb];return _0x2422c2;};'use strict';var BPromise=require(_0x0c30('0x0'));var server=require(_0x0c30('0x1'));var Realtime=require('./realtime');var user=require(_0x0c30('0x2'));var interval=require(_0x0c30('0x3'));var openchannelQueue=require(_0x0c30('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x0c30('0x5'));var mailQueue=require(_0x0c30('0x6'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x0c30('0x7')]()[_0x0c30('0x8')](user[_0x0c30('0x9')]())[_0x0c30('0x8')](realtime['initAgents']())[_0x0c30('0x8')](interval[_0x0c30('0xa')]())[_0x0c30('0x8')](realtime[_0x0c30('0xb')]())[_0x0c30('0x8')](openchannelQueue[_0x0c30('0xc')]())[_0x0c30('0x8')](realtime['initOpenchannelQueues']())[_0x0c30('0x8')](chatQueue[_0x0c30('0xd')]())[_0x0c30('0x8')](realtime[_0x0c30('0xe')]())[_0x0c30('0x8')](smsQueue['getSmsQueues']())[_0x0c30('0x8')](realtime[_0x0c30('0xf')]())[_0x0c30('0x8')](mailQueue[_0x0c30('0x10')]())['then'](realtime[_0x0c30('0x11')]())['then'](faxQueue[_0x0c30('0x12')]())[_0x0c30('0x8')](realtime['initFaxQueues']())[_0x0c30('0x8')](whatsappQueue[_0x0c30('0x13')]())['then'](realtime[_0x0c30('0x14')]())[_0x0c30('0x8')](function(){return realtime;});}function main(){return server[_0x0c30('0x15')](realtime)[_0x0c30('0x8')](function(_0x8c17d9){return initRealtime();})[_0x0c30('0x8')](function(_0x18f20f){return setInterval(initRealtime,0x1388);})[_0x0c30('0x16')](function(_0x3de8bc){console[_0x0c30('0x17')](_0x3de8bc);});}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 d8fcc6d..d3e3390 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x329eac,_0x262797){var _0x1ca64b=function(_0x38933f){while(--_0x38933f){_0x329eac['push'](_0x329eac['shift']());}};_0x1ca64b(++_0x262797);}(_0x7a54,0x106));var _0x47a5=function(_0x3f49a8,_0x132a0a){_0x3f49a8=_0x3f49a8-0x0;var _0x5d81b8=_0x7a54[_0x3f49a8];return _0x5d81b8;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file +var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x4f6610,_0x11d9ae){var _0x44e7d3=function(_0x1c9b2f){while(--_0x1c9b2f){_0x4f6610['push'](_0x4f6610['shift']());}};_0x44e7d3(++_0x11d9ae);}(_0x326f,0xd1));var _0xf326=function(_0x35305d,_0x36568e){_0x35305d=_0x35305d-0x0;var _0x1aeb51=_0x326f[_0x35305d];return _0x1aeb51;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 3a0fd34..f08257e 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 _0xd09b=['error','result','catch','sendMailMessage','SendMail','bluebird','http','then'];(function(_0x23fa5d,_0x356419){var _0x43f2b0=function(_0x1e5f60){while(--_0x1e5f60){_0x23fa5d['push'](_0x23fa5d['shift']());}};_0x43f2b0(++_0x356419);}(_0xd09b,0x1c5));var _0xbd09=function(_0x4af1fd,_0x166611){_0x4af1fd=_0x4af1fd-0x0;var _0x2acc3a=_0xd09b[_0x4af1fd];return _0x2acc3a;};'use strict';var BPromise=require(_0xbd09('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbd09('0x1')]({'port':0x232b});function request(_0x161d80,_0x99a22a){return new BPromise(function(_0x47e294,_0x2622cf){return client['request'](_0x161d80,_0x99a22a)[_0xbd09('0x2')](function(_0x401114){if(_0x401114[_0xbd09('0x3')]){return _0x2622cf(_0x401114[_0xbd09('0x3')]['message']);}else{return _0x47e294(_0x401114[_0xbd09('0x4')]);}})[_0xbd09('0x5')](function(_0x5a1d2c){return _0x2622cf(_0x5a1d2c);});});}exports[_0xbd09('0x6')]=function(_0x4d6c51,_0x2f00ae){return request(_0xbd09('0x7'),{'account':_0x4d6c51,'message':_0x2f00ae});}; \ No newline at end of file +var _0x66cf=['request','error','message','result','SendMail','bluebird','jayson/promise','client','http'];(function(_0x26234f,_0xff06f1){var _0x2e65ed=function(_0x55a179){while(--_0x55a179){_0x26234f['push'](_0x26234f['shift']());}};_0x2e65ed(++_0xff06f1);}(_0x66cf,0x101));var _0xf66c=function(_0x109bfc,_0x299326){_0x109bfc=_0x109bfc-0x0;var _0x1d957c=_0x66cf[_0x109bfc];return _0x1d957c;};'use strict';var BPromise=require(_0xf66c('0x0'));var jayson=require(_0xf66c('0x1'));var client=jayson[_0xf66c('0x2')][_0xf66c('0x3')]({'port':0x232b});function request(_0x3ff64b,_0x2eaa0c){return new BPromise(function(_0x2d6080,_0x5b502b){return client[_0xf66c('0x4')](_0x3ff64b,_0x2eaa0c)['then'](function(_0x2cacbf){if(_0x2cacbf[_0xf66c('0x5')]){return _0x5b502b(_0x2cacbf['error'][_0xf66c('0x6')]);}else{return _0x2d6080(_0x2cacbf[_0xf66c('0x7')]);}})['catch'](function(_0x14b671){return _0x5b502b(_0x14b671);});});}exports['sendMailMessage']=function(_0x298c5d,_0x5eecc2){return request(_0xf66c('0x8'),{'account':_0x298c5d,'message':_0x5eecc2});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 089309f..933f6e1 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 _0x09e4=['smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','busy','busyQueue','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','idle','mail','chat','openchannel','sms','whatsapp','Status','StatusTime','format','faxPause','mailStatusTime','faxStatus','whatsappStatusTime','openchannelStatusTime','openchannelCurrentCapacity','stringify','emit','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x09e4,0x1ce));var _0x409e=function(_0x555943,_0x44f643){_0x555943=_0x555943-0x0;var _0x419a83=_0x09e4[_0x555943];return _0x419a83;};'use strict';var _=require(_0x409e('0x0'));var moment=require(_0x409e('0x1'));var md5=require(_0x409e('0x2'));var Redis=require(_0x409e('0x3'));var config=require(_0x409e('0x4'));config[_0x409e('0x5')]=_[_0x409e('0x6')](config[_0x409e('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x409e('0x7'))(new Redis(config['redis']));function Agent(_0x4a49b0){this['id']=_0x4a49b0['id']||0x0;this[_0x409e('0x8')]=_0x4a49b0[_0x409e('0x8')]||'';this[_0x409e('0x9')]=_0x4a49b0[_0x409e('0x9')]||!![];this['voicePause']=_0x4a49b0[_0x409e('0xa')]||![];this[_0x409e('0xb')]=_0x4a49b0[_0x409e('0xb')]||![];this[_0x409e('0xc')]=_0x4a49b0['mailPause']||![];this['faxPause']=_0x4a49b0['faxPause']||![];this[_0x409e('0xd')]=_0x4a49b0[_0x409e('0xd')]||![];this[_0x409e('0xe')]=_0x4a49b0['openchannelPause']||![];this[_0x409e('0xf')]=_0x409e('0x10');this[_0x409e('0x11')]=0x0;this[_0x409e('0x12')]=_0x4a49b0[_0x409e('0x12')]||0x0;this[_0x409e('0x13')]=0x0;this[_0x409e('0x14')]=_0x409e('0x10');this['mailStatusTime']=0x0;this['mailCapacity']=_0x4a49b0[_0x409e('0x15')]||0x0;this[_0x409e('0x16')]=0x0;this['faxStatus']=_0x409e('0x10');this[_0x409e('0x17')]=0x0;this[_0x409e('0x18')]=_0x4a49b0[_0x409e('0x18')]||0x0;this[_0x409e('0x19')]=0x0;this[_0x409e('0x1a')]=_0x409e('0x10');this[_0x409e('0x1b')]=0x0;this[_0x409e('0x1c')]=_0x4a49b0['smsCapacity']||0x0;this[_0x409e('0x1d')]=0x0;this[_0x409e('0x1e')]=_0x409e('0x10');this['whatsappStatusTime']=0x0;this[_0x409e('0x1f')]=_0x4a49b0['whatsappCapacity']||0x0;this[_0x409e('0x20')]=0x0;this[_0x409e('0x21')]=_0x409e('0x10');this['openchannelStatusTime']=0x0;this['openchannelCapacity']=_0x4a49b0[_0x409e('0x22')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x409e('0x23')]=![];this[_0x409e('0x24')]=undefined;this['md5']='';this['updateRealtime']();}Agent[_0x409e('0x25')][_0x409e('0x26')]=function(_0x2acfa7){if(this[_0x2acfa7+_0x409e('0x27')]>0x0){if(this[_0x2acfa7+_0x409e('0x28')]>0x0&&this[_0x2acfa7+_0x409e('0x27')]>=this[_0x2acfa7+_0x409e('0x28')]){return _0x409e('0x29');}else{return'working';}}else{return _0x409e('0x2a');}};Agent['prototype']['updateRealtime']=function(){var _0x48bf74=[_0x409e('0x2b'),_0x409e('0x2c'),_0x409e('0x2d'),'fax',_0x409e('0x2e'),_0x409e('0x2f')];for(var _0x10faa2=0x0;_0x10faa2<_0x48bf74['length'];_0x10faa2+=0x1){var _0x213e7a=this[_0x409e('0x26')](_0x48bf74[_0x10faa2]);if(this[_0x48bf74[_0x10faa2]+_0x409e('0x30')]!==_0x213e7a){this[_0x48bf74[_0x10faa2]+_0x409e('0x31')]=_['toNumber'](moment()[_0x409e('0x32')]('x'));}this[_0x48bf74[_0x10faa2]+_0x409e('0x30')]=_0x213e7a;}var _0x3b042f={'id':this['id'],'name':this['name'],'online':this[_0x409e('0x9')],'voicePause':this[_0x409e('0xa')],'chatPause':this['chatPause'],'mailPause':this[_0x409e('0xc')],'smsPause':this['smsPause'],'faxPause':this[_0x409e('0x33')],'openchannelPause':this[_0x409e('0xe')],'chatStatus':this[_0x409e('0xf')],'chatStatusTime':this[_0x409e('0x11')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x409e('0x13')],'mailStatus':this[_0x409e('0x14')],'mailStatusTime':this[_0x409e('0x34')],'mailCapacity':this[_0x409e('0x15')],'mailCurrentCapacity':this[_0x409e('0x16')],'faxStatus':this[_0x409e('0x35')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x409e('0x18')],'faxCurrentCapacity':this[_0x409e('0x19')],'smsStatus':this[_0x409e('0x1a')],'smsStatusTime':this[_0x409e('0x1b')],'smsCapacity':this[_0x409e('0x1c')],'smsCurrentCapacity':this[_0x409e('0x1d')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x409e('0x36')],'whatsappCapacity':this[_0x409e('0x1f')],'whatsappCurrentCapacity':this[_0x409e('0x20')],'openchannelStatus':this[_0x409e('0x21')],'openchannelStatusTime':this[_0x409e('0x37')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x409e('0x38')],'busy':this[_0x409e('0x23')],'busyQueue':this['busyQueue']};var _0x44e4da=md5(JSON[_0x409e('0x39')](_0x3b042f));if(this['md5']!==_0x44e4da){this[_0x409e('0x2')]=_0x44e4da;io[_0x409e('0x3a')](_0x409e('0x3b'),_0x3b042f);}};module[_0x409e('0x3c')]=Agent; \ No newline at end of file +var _0x5014=['voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','unknown','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','md5','prototype','CurrentCapacity','Capacity','maxcapacity','working','idle','updateRealtime','chat','openchannel','fax','whatsapp','getChannelStatus','Status','StatusTime','toNumber','format','smsStatus','whatsappStatusTime','openchannelStatusTime','busyQueue','stringify','user:save','exports','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online'];(function(_0x305ab4,_0x2d91a4){var _0x4c8e05=function(_0x21419c){while(--_0x21419c){_0x305ab4['push'](_0x305ab4['shift']());}};_0x4c8e05(++_0x2d91a4);}(_0x5014,0x1d7));var _0x4501=function(_0x310d80,_0x350219){_0x310d80=_0x310d80-0x0;var _0x211642=_0x5014[_0x310d80];return _0x211642;};'use strict';var _=require('lodash');var moment=require(_0x4501('0x0'));var md5=require('md5');var Redis=require(_0x4501('0x1'));var config=require(_0x4501('0x2'));config[_0x4501('0x3')]=_[_0x4501('0x4')](config[_0x4501('0x3')],{'host':_0x4501('0x5'),'port':0x18eb});var io=require(_0x4501('0x6'))(new Redis(config[_0x4501('0x3')]));function Agent(_0x5cbe99){this['id']=_0x5cbe99['id']||0x0;this[_0x4501('0x7')]=_0x5cbe99['name']||'';this[_0x4501('0x8')]=_0x5cbe99[_0x4501('0x8')]||!![];this[_0x4501('0x9')]=_0x5cbe99[_0x4501('0x9')]||![];this[_0x4501('0xa')]=_0x5cbe99['chatPause']||![];this[_0x4501('0xb')]=_0x5cbe99[_0x4501('0xb')]||![];this[_0x4501('0xc')]=_0x5cbe99[_0x4501('0xc')]||![];this[_0x4501('0xd')]=_0x5cbe99['smsPause']||![];this[_0x4501('0xe')]=_0x5cbe99[_0x4501('0xe')]||![];this[_0x4501('0xf')]='unknown';this[_0x4501('0x10')]=0x0;this['chatCapacity']=_0x5cbe99[_0x4501('0x11')]||0x0;this[_0x4501('0x12')]=0x0;this[_0x4501('0x13')]='unknown';this[_0x4501('0x14')]=0x0;this['mailCapacity']=_0x5cbe99[_0x4501('0x15')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x4501('0x16')]=_0x4501('0x17');this[_0x4501('0x18')]=0x0;this[_0x4501('0x19')]=_0x5cbe99[_0x4501('0x19')]||0x0;this[_0x4501('0x1a')]=0x0;this['smsStatus']=_0x4501('0x17');this[_0x4501('0x1b')]=0x0;this['smsCapacity']=_0x5cbe99[_0x4501('0x1c')]||0x0;this['smsCurrentCapacity']=0x0;this[_0x4501('0x1d')]=_0x4501('0x17');this['whatsappStatusTime']=0x0;this[_0x4501('0x1e')]=_0x5cbe99[_0x4501('0x1e')]||0x0;this[_0x4501('0x1f')]=0x0;this[_0x4501('0x20')]=_0x4501('0x17');this['openchannelStatusTime']=0x0;this[_0x4501('0x21')]=_0x5cbe99[_0x4501('0x21')]||0x0;this[_0x4501('0x22')]=0x0;this[_0x4501('0x23')]=![];this['busyQueue']=undefined;this[_0x4501('0x24')]='';this['updateRealtime']();}Agent[_0x4501('0x25')]['getChannelStatus']=function(_0xc6de3f){if(this[_0xc6de3f+_0x4501('0x26')]>0x0){if(this[_0xc6de3f+_0x4501('0x27')]>0x0&&this[_0xc6de3f+'CurrentCapacity']>=this[_0xc6de3f+_0x4501('0x27')]){return _0x4501('0x28');}else{return _0x4501('0x29');}}else{return _0x4501('0x2a');}};Agent['prototype'][_0x4501('0x2b')]=function(){var _0x572fcb=['mail',_0x4501('0x2c'),_0x4501('0x2d'),_0x4501('0x2e'),'sms',_0x4501('0x2f')];for(var _0x169c2d=0x0;_0x169c2d<_0x572fcb['length'];_0x169c2d+=0x1){var _0x180e8f=this[_0x4501('0x30')](_0x572fcb[_0x169c2d]);if(this[_0x572fcb[_0x169c2d]+_0x4501('0x31')]!==_0x180e8f){this[_0x572fcb[_0x169c2d]+_0x4501('0x32')]=_[_0x4501('0x33')](moment()[_0x4501('0x34')]('x'));}this[_0x572fcb[_0x169c2d]+'Status']=_0x180e8f;}var _0x434120={'id':this['id'],'name':this['name'],'online':this[_0x4501('0x8')],'voicePause':this['voicePause'],'chatPause':this[_0x4501('0xa')],'mailPause':this[_0x4501('0xb')],'smsPause':this[_0x4501('0xd')],'faxPause':this[_0x4501('0xc')],'openchannelPause':this[_0x4501('0xe')],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x4501('0x11')],'chatCurrentCapacity':this[_0x4501('0x12')],'mailStatus':this[_0x4501('0x13')],'mailStatusTime':this[_0x4501('0x14')],'mailCapacity':this[_0x4501('0x15')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x4501('0x16')],'faxStatusTime':this[_0x4501('0x18')],'faxCapacity':this[_0x4501('0x19')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x4501('0x35')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x4501('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x4501('0x1d')],'whatsappStatusTime':this[_0x4501('0x36')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x4501('0x1f')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x4501('0x37')],'openchannelCapacity':this[_0x4501('0x21')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x4501('0x23')],'busyQueue':this[_0x4501('0x38')]};var _0x49bf13=md5(JSON[_0x4501('0x39')](_0x434120));if(this[_0x4501('0x24')]!==_0x49bf13){this[_0x4501('0x24')]=_0x49bf13;io['emit'](_0x4501('0x3a'),_0x434120);}};module[_0x4501('0x3b')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 89326d9..eaebf4e 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 _0x4937=['defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','map','_rr','length','online','paused','available','loggedIn','stringify','format','chat:queue:%s','chat_queue:save','exports','lodash','util','ioredis','redis'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x4937,0x70));var _0x7493=function(_0x48f2ed,_0x35d3c7){_0x48f2ed=_0x48f2ed-0x0;var _0x14a0c5=_0x4937[_0x48f2ed];return _0x14a0c5;};'use strict';var _=require(_0x7493('0x0'));var md5=require('md5');var util=require(_0x7493('0x1'));var Redis=require(_0x7493('0x2'));var config=require('../../../config/environment');config[_0x7493('0x3')]=_[_0x7493('0x4')](config[_0x7493('0x3')],{'host':_0x7493('0x5'),'port':0x18eb});var io=require(_0x7493('0x6'))(new Redis(config[_0x7493('0x3')]));function ChatQueue(_0x43cbba){this['id']=_0x43cbba['id']||0x0;this[_0x7493('0x7')]=_0x43cbba['name']||'';this[_0x7493('0x8')]=_0x43cbba[_0x7493('0x8')]||0xa;this[_0x7493('0x9')]=_0x43cbba['strategy']||'beepall';this[_0x7493('0xa')]=_0x43cbba[_0x7493('0xa')];this[_0x7493('0xb')]={};this[_0x7493('0xc')]=0x0;this[_0x7493('0xd')]='';this[_0x7493('0xe')]();this[_0x7493('0xf')]();}ChatQueue[_0x7493('0x10')][_0x7493('0xe')]=function(){var _0x3a80db=this[_0x7493('0xb')]['_rr'];this[_0x7493('0xb')]=_[_0x7493('0x11')](this[_0x7493('0xa')],'id');this[_0x7493('0xb')][_0x7493('0x12')]=_0x3a80db;};ChatQueue[_0x7493('0x10')][_0x7493('0xf')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x521862=0x0;_0x521862=0x0?this['available']:0x0;var _0x5df176={'id':this['id'],'available':this[_0x7493('0x16')],'loggedIn':this[_0x7493('0x17')],'name':this[_0x7493('0x7')],'paused':this[_0x7493('0x15')],'waiting':this[_0x7493('0xc')]};var _0x548719=md5(JSON[_0x7493('0x18')](_0x5df176));if(this[_0x7493('0xd')]!==_0x548719){this[_0x7493('0xd')]=_0x548719;io['to'](util[_0x7493('0x19')](_0x7493('0x1a'),_0x5df176[_0x7493('0x7')]))['emit'](_0x7493('0x1b'),_0x5df176);}};module[_0x7493('0x1c')]=ChatQueue; \ No newline at end of file +var _0x6d09=['available','waiting','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','md5','ioredis','redis','defaults','name','timeout','strategy','Agents','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','chatPause'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6d09,0x1dc));var _0x96d0=function(_0x5ae9b5,_0x5bebb5){_0x5ae9b5=_0x5ae9b5-0x0;var _0x551281=_0x6d09[_0x5ae9b5];return _0x551281;};'use strict';var _=require('lodash');var md5=require(_0x96d0('0x0'));var util=require('util');var Redis=require(_0x96d0('0x1'));var config=require('../../../config/environment');config[_0x96d0('0x2')]=_[_0x96d0('0x3')](config[_0x96d0('0x2')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x151cf1){this['id']=_0x151cf1['id']||0x0;this[_0x96d0('0x4')]=_0x151cf1[_0x96d0('0x4')]||'';this['timeout']=_0x151cf1[_0x96d0('0x5')]||0xa;this[_0x96d0('0x6')]=_0x151cf1[_0x96d0('0x6')]||'beepall';this[_0x96d0('0x7')]=_0x151cf1['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0x96d0('0x0')]='';this[_0x96d0('0x8')]();this[_0x96d0('0x9')]();}ChatQueue[_0x96d0('0xa')]['updateRouting']=function(){var _0x23a514=this[_0x96d0('0xb')][_0x96d0('0xc')];this['mapAgentsId']=_[_0x96d0('0xd')](this[_0x96d0('0x7')],'id');this[_0x96d0('0xb')][_0x96d0('0xc')]=_0x23a514;};ChatQueue[_0x96d0('0xa')][_0x96d0('0x9')]=function(){this[_0x96d0('0xe')]=0x0;this[_0x96d0('0xf')]=0x0;for(var _0x5d1e8e=0x0;_0x5d1e8e=0x0?this[_0x96d0('0x12')]:0x0;var _0x5829f9={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x96d0('0xf')],'waiting':this[_0x96d0('0x13')]};var _0x27cb48=md5(JSON[_0x96d0('0x14')](_0x5829f9));if(this[_0x96d0('0x0')]!==_0x27cb48){this['md5']=_0x27cb48;io['to'](util[_0x96d0('0x15')](_0x96d0('0x16'),_0x5829f9['name']))[_0x96d0('0x17')](_0x96d0('0x18'),_0x5829f9);}};module[_0x96d0('0x19')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index fa5e525..5556704 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 _0x3d00=['map','loggedIn','paused','length','faxPause','available','stringify','format','emit','fax_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','mapAgentsId'];(function(_0x46a642,_0x4eee63){var _0x5e1a1f=function(_0x21dc18){while(--_0x21dc18){_0x46a642['push'](_0x46a642['shift']());}};_0x5e1a1f(++_0x4eee63);}(_0x3d00,0x1bd));var _0x03d0=function(_0xe63b9f,_0x211e5d){_0xe63b9f=_0xe63b9f-0x0;var _0x4be175=_0x3d00[_0xe63b9f];return _0x4be175;};'use strict';var _=require(_0x03d0('0x0'));var md5=require(_0x03d0('0x1'));var util=require(_0x03d0('0x2'));var Redis=require(_0x03d0('0x3'));var config=require(_0x03d0('0x4'));config[_0x03d0('0x5')]=_[_0x03d0('0x6')](config[_0x03d0('0x5')],{'host':_0x03d0('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x03d0('0x5')]));function FaxQueue(_0x48c382){this['id']=_0x48c382['id']||0x0;this[_0x03d0('0x8')]=_0x48c382[_0x03d0('0x8')]||'';this[_0x03d0('0x9')]=_0x48c382[_0x03d0('0x9')]||0xa;this[_0x03d0('0xa')]=_0x48c382['strategy']||_0x03d0('0xb');this[_0x03d0('0xc')]=_0x48c382[_0x03d0('0xc')];this['mapAgentsId']={};this[_0x03d0('0xd')]=0x0;this[_0x03d0('0x1')]='';this[_0x03d0('0xe')]();this[_0x03d0('0xf')]();}FaxQueue[_0x03d0('0x10')]['updateRouting']=function(){var _0x12fbe5=this['mapAgentsId'][_0x03d0('0x11')];this[_0x03d0('0x12')]=_[_0x03d0('0x13')](this[_0x03d0('0xc')],'id');this[_0x03d0('0x12')][_0x03d0('0x11')]=_0x12fbe5;};FaxQueue[_0x03d0('0x10')]['updateRealtime']=function(){this[_0x03d0('0x14')]=0x0;this[_0x03d0('0x15')]=0x0;for(var _0x24f75a=0x0;_0x24f75a=0x0?this[_0x03d0('0x18')]:0x0;var _0x428e73={'id':this['id'],'available':this[_0x03d0('0x18')],'loggedIn':this[_0x03d0('0x14')],'name':this['name'],'paused':this[_0x03d0('0x15')],'waiting':this[_0x03d0('0xd')]};var _0x3fd91c=md5(JSON[_0x03d0('0x19')](_0x428e73));if(this['md5']!==_0x3fd91c){this[_0x03d0('0x1')]=_0x3fd91c;io['to'](util[_0x03d0('0x1a')]('fax:queue:%s',_0x428e73[_0x03d0('0x8')]))[_0x03d0('0x1b')](_0x03d0('0x1c'),_0x428e73);}};module['exports']=FaxQueue; \ No newline at end of file +var _0x51d6=['md5','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','length','online','faxPause','paused','available','waiting','stringify','format','emit','fax_queue:save','exports','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','beepall','Agents','mapAgentsId'];(function(_0x29ae80,_0x3579f1){var _0x5d6d71=function(_0xfaffe2){while(--_0xfaffe2){_0x29ae80['push'](_0x29ae80['shift']());}};_0x5d6d71(++_0x3579f1);}(_0x51d6,0x13e));var _0x651d=function(_0x249938,_0x675ebc){_0x249938=_0x249938-0x0;var _0x344da2=_0x51d6[_0x249938];return _0x344da2;};'use strict';var _=require(_0x651d('0x0'));var md5=require('md5');var util=require(_0x651d('0x1'));var Redis=require(_0x651d('0x2'));var config=require(_0x651d('0x3'));config['redis']=_[_0x651d('0x4')](config[_0x651d('0x5')],{'host':_0x651d('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x651d('0x5')]));function FaxQueue(_0x2ec698){this['id']=_0x2ec698['id']||0x0;this[_0x651d('0x7')]=_0x2ec698[_0x651d('0x7')]||'';this[_0x651d('0x8')]=_0x2ec698[_0x651d('0x8')]||0xa;this['strategy']=_0x2ec698['strategy']||_0x651d('0x9');this[_0x651d('0xa')]=_0x2ec698[_0x651d('0xa')];this[_0x651d('0xb')]={};this['waiting']=0x0;this[_0x651d('0xc')]='';this[_0x651d('0xd')]();this['updateRealtime']();}FaxQueue[_0x651d('0xe')][_0x651d('0xd')]=function(){var _0x16caf6=this[_0x651d('0xb')][_0x651d('0xf')];this[_0x651d('0xb')]=_[_0x651d('0x10')](this[_0x651d('0xa')],'id');this['mapAgentsId'][_0x651d('0xf')]=_0x16caf6;};FaxQueue[_0x651d('0xe')][_0x651d('0x11')]=function(){this[_0x651d('0x12')]=0x0;this['paused']=0x0;for(var _0x2ab0db=0x0;_0x2ab0db=0x0?this[_0x651d('0x17')]:0x0;var _0x3b3765={'id':this['id'],'available':this[_0x651d('0x17')],'loggedIn':this[_0x651d('0x12')],'name':this[_0x651d('0x7')],'paused':this[_0x651d('0x16')],'waiting':this[_0x651d('0x18')]};var _0x2628bf=md5(JSON[_0x651d('0x19')](_0x3b3765));if(this['md5']!==_0x2628bf){this['md5']=_0x2628bf;io['to'](util[_0x651d('0x1a')]('fax:queue:%s',_0x3b3765[_0x651d('0x7')]))[_0x651d('0x1b')](_0x651d('0x1c'),_0x3b3765);}};module[_0x651d('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 0df554a..7d6bbe8 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 _0xa601=['name','Intervals'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xa601,0x7a));var _0x1a60=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xa601[_0x4b7895];return _0x264180;};'use strict';function Interval(_0x57f7e9){this['id']=_0x57f7e9['id']||0x0;this[_0x1a60('0x0')]=_0x57f7e9[_0x1a60('0x0')]||'';this[_0x1a60('0x1')]=_0x57f7e9['Intervals']||{};}module['exports']=Interval; \ No newline at end of file +var _0x91e7=['Intervals','name'];(function(_0xe30e17,_0xce02be){var _0x2342c9=function(_0x20b733){while(--_0x20b733){_0xe30e17['push'](_0xe30e17['shift']());}};_0x2342c9(++_0xce02be);}(_0x91e7,0xa9));var _0x791e=function(_0x2d4421,_0x15a84f){_0x2d4421=_0x2d4421-0x0;var _0x2d3b01=_0x91e7[_0x2d4421];return _0x2d3b01;};'use strict';function Interval(_0x418155){this['id']=_0x418155['id']||0x0;this['name']=_0x418155[_0x791e('0x0')]||'';this['Intervals']=_0x418155[_0x791e('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index cb17194..56b1ba0 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 _0xacb3=['mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','name','timeout','strategy','Agents','updateRealtime','prototype','updateRouting','mapAgentsId','_rr','map','paused','length','loggedIn','mailPause','available','stringify','format'];(function(_0x312097,_0x25ee69){var _0x33e345=function(_0x4fc3b7){while(--_0x4fc3b7){_0x312097['push'](_0x312097['shift']());}};_0x33e345(++_0x25ee69);}(_0xacb3,0xac));var _0x3acb=function(_0x4b6804,_0x301b24){_0x4b6804=_0x4b6804-0x0;var _0x11b4f1=_0xacb3[_0x4b6804];return _0x11b4f1;};'use strict';var _=require(_0x3acb('0x0'));var md5=require(_0x3acb('0x1'));var util=require(_0x3acb('0x2'));var Redis=require(_0x3acb('0x3'));var config=require(_0x3acb('0x4'));config[_0x3acb('0x5')]=_[_0x3acb('0x6')](config[_0x3acb('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3acb('0x5')]));function MailQueue(_0x223f57){this['id']=_0x223f57['id']||0x0;this[_0x3acb('0x7')]=_0x223f57[_0x3acb('0x7')]||'';this[_0x3acb('0x8')]=_0x223f57['timeout']||0xa;this[_0x3acb('0x9')]=_0x223f57[_0x3acb('0x9')]||'beepall';this['Agents']=_0x223f57[_0x3acb('0xa')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x3acb('0x1')]='';this['updateRouting']();this[_0x3acb('0xb')]();}MailQueue[_0x3acb('0xc')][_0x3acb('0xd')]=function(){var _0xa19eb5=this[_0x3acb('0xe')][_0x3acb('0xf')];this[_0x3acb('0xe')]=_[_0x3acb('0x10')](this[_0x3acb('0xa')],'id');this[_0x3acb('0xe')][_0x3acb('0xf')]=_0xa19eb5;};MailQueue[_0x3acb('0xc')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x3acb('0x11')]=0x0;for(var _0x51fe41=0x0;_0x51fe41=0x0?this[_0x3acb('0x15')]:0x0;var _0x4eab46={'id':this['id'],'available':this[_0x3acb('0x15')],'loggedIn':this[_0x3acb('0x13')],'name':this[_0x3acb('0x7')],'paused':this[_0x3acb('0x11')],'waiting':this['waiting']};var _0x57b0d3=md5(JSON[_0x3acb('0x16')](_0x4eab46));if(this[_0x3acb('0x1')]!==_0x57b0d3){this[_0x3acb('0x1')]=_0x57b0d3;io['to'](util[_0x3acb('0x17')](_0x3acb('0x18'),_0x4eab46['name']))[_0x3acb('0x19')](_0x3acb('0x1a'),_0x4eab46);}};module[_0x3acb('0x1b')]=MailQueue; \ No newline at end of file +var _0xbf05=['map','loggedIn','paused','online','available','format','emit','mail_queue:save','exports','lodash','md5','ioredis','defaults','localhost','redis','name','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr'];(function(_0x5b7b8e,_0x25e8b5){var _0x179029=function(_0x87cff6){while(--_0x87cff6){_0x5b7b8e['push'](_0x5b7b8e['shift']());}};_0x179029(++_0x25e8b5);}(_0xbf05,0x6d));var _0x5bf0=function(_0x253fe1,_0x5a780d){_0x253fe1=_0x253fe1-0x0;var _0x4fea01=_0xbf05[_0x253fe1];return _0x4fea01;};'use strict';var _=require(_0x5bf0('0x0'));var md5=require(_0x5bf0('0x1'));var util=require('util');var Redis=require(_0x5bf0('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x5bf0('0x3')](config['redis'],{'host':_0x5bf0('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5bf0('0x5')]));function MailQueue(_0x51c742){this['id']=_0x51c742['id']||0x0;this[_0x5bf0('0x6')]=_0x51c742[_0x5bf0('0x6')]||'';this['timeout']=_0x51c742['timeout']||0xa;this['strategy']=_0x51c742[_0x5bf0('0x7')]||_0x5bf0('0x8');this[_0x5bf0('0x9')]=_0x51c742['Agents'];this[_0x5bf0('0xa')]={};this[_0x5bf0('0xb')]=0x0;this[_0x5bf0('0x1')]='';this[_0x5bf0('0xc')]();this[_0x5bf0('0xd')]();}MailQueue[_0x5bf0('0xe')][_0x5bf0('0xc')]=function(){var _0x129667=this[_0x5bf0('0xa')][_0x5bf0('0xf')];this[_0x5bf0('0xa')]=_[_0x5bf0('0x10')](this['Agents'],'id');this[_0x5bf0('0xa')][_0x5bf0('0xf')]=_0x129667;};MailQueue[_0x5bf0('0xe')][_0x5bf0('0xd')]=function(){this[_0x5bf0('0x11')]=0x0;this[_0x5bf0('0x12')]=0x0;for(var _0x238d41=0x0;_0x238d41=0x0?this[_0x5bf0('0x14')]:0x0;var _0x44b15b={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5bf0('0x11')],'name':this[_0x5bf0('0x6')],'paused':this['paused'],'waiting':this['waiting']};var _0x4b642e=md5(JSON['stringify'](_0x44b15b));if(this[_0x5bf0('0x1')]!==_0x4b642e){this[_0x5bf0('0x1')]=_0x4b642e;io['to'](util[_0x5bf0('0x15')]('mail:queue:%s',_0x44b15b[_0x5bf0('0x6')]))[_0x5bf0('0x16')](_0x5bf0('0x17'),_0x44b15b);}};module[_0x5bf0('0x18')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 37ec6c8..78ed648 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 _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x42af14,_0x3aa96e){var _0x25e63d=function(_0x1588ff){while(--_0x1588ff){_0x42af14['push'](_0x42af14['shift']());}};_0x25e63d(++_0x3aa96e);}(_0x814b,0x1a2));var _0xb814=function(_0x1de43c,_0xaa29de){_0x1de43c=_0x1de43c-0x0;var _0x296d3e=_0x814b[_0x1de43c];return _0x296d3e;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x420d8d,_0x78b67f){var _0x4865d7=function(_0x2965df){while(--_0x2965df){_0x420d8d['push'](_0x420d8d['shift']());}};_0x4865d7(++_0x78b67f);}(_0x2ef3,0xba));var _0x32ef=function(_0x16a837,_0x51bece){_0x16a837=_0x16a837-0x0;var _0x1ef5b9=_0x2ef3[_0x16a837];return _0x1ef5b9;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 48e4c00..57623de 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 _0xbb53=['strategy','Agents','mapAgentsId','waiting','updateRouting','_rr','map','prototype','updateRealtime','paused','length','smsPause','loggedIn','available','stringify','format','sms:queue:%s','emit','sms_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout'];(function(_0x5deef8,_0x4414fa){var _0x2b96ea=function(_0x5b26b1){while(--_0x5b26b1){_0x5deef8['push'](_0x5deef8['shift']());}};_0x2b96ea(++_0x4414fa);}(_0xbb53,0x121));var _0x3bb5=function(_0x518399,_0x1de68c){_0x518399=_0x518399-0x0;var _0x434626=_0xbb53[_0x518399];return _0x434626;};'use strict';var _=require(_0x3bb5('0x0'));var md5=require(_0x3bb5('0x1'));var util=require(_0x3bb5('0x2'));var Redis=require(_0x3bb5('0x3'));var config=require(_0x3bb5('0x4'));config[_0x3bb5('0x5')]=_[_0x3bb5('0x6')](config[_0x3bb5('0x5')],{'host':_0x3bb5('0x7'),'port':0x18eb});var io=require(_0x3bb5('0x8'))(new Redis(config['redis']));function SmsQueue(_0x5d09e2){this['id']=_0x5d09e2['id']||0x0;this[_0x3bb5('0x9')]=_0x5d09e2[_0x3bb5('0x9')]||'';this[_0x3bb5('0xa')]=_0x5d09e2[_0x3bb5('0xa')]||0xa;this[_0x3bb5('0xb')]=_0x5d09e2['strategy']||'beepall';this['Agents']=_0x5d09e2[_0x3bb5('0xc')];this[_0x3bb5('0xd')]={};this[_0x3bb5('0xe')]=0x0;this['md5']='';this[_0x3bb5('0xf')]();this['updateRealtime']();}SmsQueue['prototype'][_0x3bb5('0xf')]=function(){var _0x2b915a=this['mapAgentsId'][_0x3bb5('0x10')];this['mapAgentsId']=_[_0x3bb5('0x11')](this['Agents'],'id');this['mapAgentsId'][_0x3bb5('0x10')]=_0x2b915a;};SmsQueue[_0x3bb5('0x12')][_0x3bb5('0x13')]=function(){this['loggedIn']=0x0;this[_0x3bb5('0x14')]=0x0;for(var _0x12e409=0x0;_0x12e409=0x0?this['available']:0x0;var _0x13cb3a={'id':this['id'],'available':this[_0x3bb5('0x18')],'loggedIn':this[_0x3bb5('0x17')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x3bb5('0xe')]};var _0x478021=md5(JSON[_0x3bb5('0x19')](_0x13cb3a));if(this['md5']!==_0x478021){this[_0x3bb5('0x1')]=_0x478021;io['to'](util[_0x3bb5('0x1a')](_0x3bb5('0x1b'),_0x13cb3a[_0x3bb5('0x9')]))[_0x3bb5('0x1c')](_0x3bb5('0x1d'),_0x13cb3a);}};module['exports']=SmsQueue; \ No newline at end of file +var _0xb49a=['loggedIn','paused','online','smsPause','available','sms:queue:%s','emit','sms_queue:save','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','map','_rr'];(function(_0x26dd46,_0x5f5abc){var _0x28a19e=function(_0x49f403){while(--_0x49f403){_0x26dd46['push'](_0x26dd46['shift']());}};_0x28a19e(++_0x5f5abc);}(_0xb49a,0xfb));var _0xab49=function(_0x2b7675,_0x5969c9){_0x2b7675=_0x2b7675-0x0;var _0x4c4f97=_0xb49a[_0x2b7675];return _0x4c4f97;};'use strict';var _=require(_0xab49('0x0'));var md5=require(_0xab49('0x1'));var util=require(_0xab49('0x2'));var Redis=require(_0xab49('0x3'));var config=require(_0xab49('0x4'));config['redis']=_[_0xab49('0x5')](config[_0xab49('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xab49('0x6')]));function SmsQueue(_0x287cd5){this['id']=_0x287cd5['id']||0x0;this[_0xab49('0x7')]=_0x287cd5[_0xab49('0x7')]||'';this[_0xab49('0x8')]=_0x287cd5[_0xab49('0x8')]||0xa;this[_0xab49('0x9')]=_0x287cd5['strategy']||_0xab49('0xa');this[_0xab49('0xb')]=_0x287cd5[_0xab49('0xb')];this[_0xab49('0xc')]={};this[_0xab49('0xd')]=0x0;this['md5']='';this['updateRouting']();this[_0xab49('0xe')]();}SmsQueue[_0xab49('0xf')][_0xab49('0x10')]=function(){var _0x126f00=this[_0xab49('0xc')]['_rr'];this[_0xab49('0xc')]=_[_0xab49('0x11')](this[_0xab49('0xb')],'id');this[_0xab49('0xc')][_0xab49('0x12')]=_0x126f00;};SmsQueue[_0xab49('0xf')][_0xab49('0xe')]=function(){this[_0xab49('0x13')]=0x0;this[_0xab49('0x14')]=0x0;for(var _0x389ebb=0x0;_0x389ebb=0x0?this['available']:0x0;var _0x167a2a={'id':this['id'],'available':this[_0xab49('0x17')],'loggedIn':this[_0xab49('0x13')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xab49('0xd')]};var _0xa039ed=md5(JSON['stringify'](_0x167a2a));if(this[_0xab49('0x1')]!==_0xa039ed){this[_0xab49('0x1')]=_0xa039ed;io['to'](util['format'](_0xab49('0x18'),_0x167a2a['name']))[_0xab49('0x19')](_0xab49('0x1a'),_0x167a2a);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index eca49c7..b7bf524 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 _0xa82b=['whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting','prototype','mapAgentsId','_rr','map','updateRealtime','loggedIn','paused','length','online','whatsappPause','available','format','whatsapp:queue:%s','emit'];(function(_0x1f1a93,_0x1ce777){var _0x2f0466=function(_0x351690){while(--_0x351690){_0x1f1a93['push'](_0x1f1a93['shift']());}};_0x2f0466(++_0x1ce777);}(_0xa82b,0xfa));var _0xba82=function(_0x444127,_0x27d1e9){_0x444127=_0x444127-0x0;var _0x5855c0=_0xa82b[_0x444127];return _0x5855c0;};'use strict';var _=require(_0xba82('0x0'));var md5=require(_0xba82('0x1'));var util=require(_0xba82('0x2'));var Redis=require(_0xba82('0x3'));var config=require(_0xba82('0x4'));config[_0xba82('0x5')]=_[_0xba82('0x6')](config[_0xba82('0x5')],{'host':_0xba82('0x7'),'port':0x18eb});var io=require(_0xba82('0x8'))(new Redis(config[_0xba82('0x5')]));function WhatsappQueue(_0x34e194){this['id']=_0x34e194['id']||0x0;this[_0xba82('0x9')]=_0x34e194['name']||'';this['timeout']=_0x34e194[_0xba82('0xa')]||0xa;this[_0xba82('0xb')]=_0x34e194[_0xba82('0xb')]||'beepall';this[_0xba82('0xc')]=_0x34e194[_0xba82('0xc')];this['mapAgentsId']={};this[_0xba82('0xd')]=0x0;this[_0xba82('0x1')]='';this[_0xba82('0xe')]();this['updateRealtime']();}WhatsappQueue[_0xba82('0xf')][_0xba82('0xe')]=function(){var _0x2795fd=this[_0xba82('0x10')][_0xba82('0x11')];this[_0xba82('0x10')]=_[_0xba82('0x12')](this['Agents'],'id');this[_0xba82('0x10')][_0xba82('0x11')]=_0x2795fd;};WhatsappQueue[_0xba82('0xf')][_0xba82('0x13')]=function(){this[_0xba82('0x14')]=0x0;this[_0xba82('0x15')]=0x0;for(var _0x7e20e=0x0;_0x7e20e=0x0?this[_0xba82('0x19')]:0x0;var _0x8ed7eb={'id':this['id'],'available':this[_0xba82('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xba82('0xd')]};var _0x58b36f=md5(JSON['stringify'](_0x8ed7eb));if(this['md5']!==_0x58b36f){this[_0xba82('0x1')]=_0x58b36f;io['to'](util[_0xba82('0x1a')](_0xba82('0x1b'),_0x8ed7eb[_0xba82('0x9')]))[_0xba82('0x1c')](_0xba82('0x1d'),_0x8ed7eb);}};module[_0xba82('0x1e')]=WhatsappQueue; \ No newline at end of file +var _0xaaaa=['updateRouting','updateRealtime','_rr','map','loggedIn','length','online','whatsappPause','paused','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x441c74,_0x41962b){var _0x47f9ce=function(_0x4ceff5){while(--_0x4ceff5){_0x441c74['push'](_0x441c74['shift']());}};_0x47f9ce(++_0x41962b);}(_0xaaaa,0x110));var _0xaaaa=function(_0x88e664,_0x33dfae){_0x88e664=_0x88e664-0x0;var _0x3ae6b4=_0xaaaa[_0x88e664];return _0x3ae6b4;};'use strict';var _=require(_0xaaaa('0x0'));var md5=require(_0xaaaa('0x1'));var util=require(_0xaaaa('0x2'));var Redis=require(_0xaaaa('0x3'));var config=require(_0xaaaa('0x4'));config[_0xaaaa('0x5')]=_[_0xaaaa('0x6')](config[_0xaaaa('0x5')],{'host':_0xaaaa('0x7'),'port':0x18eb});var io=require(_0xaaaa('0x8'))(new Redis(config[_0xaaaa('0x5')]));function WhatsappQueue(_0x4c5e34){this['id']=_0x4c5e34['id']||0x0;this[_0xaaaa('0x9')]=_0x4c5e34['name']||'';this[_0xaaaa('0xa')]=_0x4c5e34[_0xaaaa('0xa')]||0xa;this[_0xaaaa('0xb')]=_0x4c5e34[_0xaaaa('0xb')]||_0xaaaa('0xc');this['Agents']=_0x4c5e34[_0xaaaa('0xd')];this[_0xaaaa('0xe')]={};this[_0xaaaa('0xf')]=0x0;this[_0xaaaa('0x1')]='';this[_0xaaaa('0x10')]();this[_0xaaaa('0x11')]();}WhatsappQueue['prototype'][_0xaaaa('0x10')]=function(){var _0x3bd6a7=this['mapAgentsId'][_0xaaaa('0x12')];this[_0xaaaa('0xe')]=_[_0xaaaa('0x13')](this[_0xaaaa('0xd')],'id');this[_0xaaaa('0xe')][_0xaaaa('0x12')]=_0x3bd6a7;};WhatsappQueue['prototype']['updateRealtime']=function(){this[_0xaaaa('0x14')]=0x0;this['paused']=0x0;for(var _0x4e1ecc=0x0;_0x4e1ecc=0x0?this['available']:0x0;var _0x550ff4={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xaaaa('0x9')],'paused':this['paused'],'waiting':this['waiting']};var _0x59cc3e=md5(JSON[_0xaaaa('0x1a')](_0x550ff4));if(this['md5']!==_0x59cc3e){this[_0xaaaa('0x1')]=_0x59cc3e;io['to'](util[_0xaaaa('0x1b')](_0xaaaa('0x1c'),_0x550ff4[_0xaaaa('0x9')]))[_0xaaaa('0x1d')](_0xaaaa('0x1e'),_0x550ff4);}};module[_0xaaaa('0x1f')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 83bc468..94c7605 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index d1fb24b..470290c 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 _0xc7d6=['AddTagsToChatInteraction','addTagsToChatInteraction','../client','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x150244,_0x251005){var _0x5685e5=function(_0x580890){while(--_0x580890){_0x150244['push'](_0x150244['shift']());}};_0x5685e5(++_0x251005);}(_0xc7d6,0x152));var _0x6c7d=function(_0x1f3e0d,_0x49212c){_0x1f3e0d=_0x1f3e0d-0x0;var _0x62155e=_0xc7d6[_0x1f3e0d];return _0x62155e;};'use strict';var client=require(_0x6c7d('0x0'));exports['update']=function(_0x573c5f,_0x37437a){return client[_0x6c7d('0x1')](_0x6c7d('0x2'),{'body':_0x37437a,'options':{'where':{'id':_0x573c5f}},'log':_0x6c7d('0x3')});};exports['addTags']=function(_0x5dd36d,_0x304e30){return client[_0x6c7d('0x1')](_0x6c7d('0x4'),{'body':_0x304e30,'options':{'where':{'id':_0x5dd36d}},'log':_0x6c7d('0x5')});}; \ No newline at end of file +var _0x0fe4=['Request','UpdateChatInteraction','updateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update'];(function(_0x3b9f61,_0x28b8b9){var _0x1b893c=function(_0x1632ce){while(--_0x1632ce){_0x3b9f61['push'](_0x3b9f61['shift']());}};_0x1b893c(++_0x28b8b9);}(_0x0fe4,0xad));var _0x40fe=function(_0x52ec3d,_0x1a488a){_0x52ec3d=_0x52ec3d-0x0;var _0x433763=_0x0fe4[_0x52ec3d];return _0x433763;};'use strict';var client=require(_0x40fe('0x0'));exports[_0x40fe('0x1')]=function(_0x34c583,_0x11abce){return client[_0x40fe('0x2')](_0x40fe('0x3'),{'body':_0x11abce,'options':{'where':{'id':_0x34c583}},'log':_0x40fe('0x4')});};exports['addTags']=function(_0x118ffd,_0x2888e7){return client['Request'](_0x40fe('0x5'),{'body':_0x2888e7,'options':{'where':{'id':_0x118ffd}},'log':_0x40fe('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index a8fd4a0..22fdefe 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 _0xf860=['createChatMessage','create','Request','CreateChatMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf860,0xe1));var _0x0f86=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf860[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x0f86('0x0')]=function(_0x39a3f8){return client[_0x0f86('0x1')](_0x0f86('0x2'),{'body':_0x39a3f8,'log':_0x0f86('0x3')});}; \ No newline at end of file +var _0x6be2=['Request','CreateChatMessage','createChatMessage','../client','create'];(function(_0x2a6754,_0x277259){var _0x17feda=function(_0x5745be){while(--_0x5745be){_0x2a6754['push'](_0x2a6754['shift']());}};_0x17feda(++_0x277259);}(_0x6be2,0xe4));var _0x26be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6be2[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x26be('0x0'));exports[_0x26be('0x1')]=function(_0xaeda8a){return client[_0x26be('0x2')](_0x26be('0x3'),{'body':_0xaeda8a,'log':_0x26be('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 58a4cd2..2e263be 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 _0x2086=['online','chatPause','../client','getChatQueues','Request','GetChatQueue','name','timeout','User','Agents'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x2086,0x124));var _0x6208=function(_0x2e8097,_0x517656){_0x2e8097=_0x2e8097-0x0;var _0x20426a=_0x2086[_0x2e8097];return _0x20426a;};'use strict';var client=require(_0x6208('0x0'));exports[_0x6208('0x1')]=function(){return function(){return client[_0x6208('0x2')](_0x6208('0x3'),{'options':{'raw':![],'attributes':['id',_0x6208('0x4'),_0x6208('0x5'),'strategy'],'include':[{'model':_0x6208('0x6'),'as':_0x6208('0x7'),'attributes':['id','name',_0x6208('0x8'),_0x6208('0x9')]}]},'log':_0x6208('0x1')});};}; \ No newline at end of file +var _0x1f75=['../client','getChatQueues','Request','name','timeout','strategy','User','Agents','online','chatPause'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x1f75,0x12c));var _0x51f7=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x1f75[_0x481bf7];return _0x461787;};'use strict';var client=require(_0x51f7('0x0'));exports[_0x51f7('0x1')]=function(){return function(){return client[_0x51f7('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x51f7('0x3'),_0x51f7('0x4'),_0x51f7('0x5')],'include':[{'model':_0x51f7('0x6'),'as':_0x51f7('0x7'),'attributes':['id',_0x51f7('0x3'),_0x51f7('0x8'),_0x51f7('0x9')]}]},'log':_0x51f7('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index e2a7a8d..da12bc4 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 _0x38c3=['create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','../client'];(function(_0x4cd577,_0x51dc24){var _0x563347=function(_0x5d6aa3){while(--_0x5d6aa3){_0x4cd577['push'](_0x4cd577['shift']());}};_0x563347(++_0x51dc24);}(_0x38c3,0x13d));var _0x338c=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x38c3[_0x599f41];return _0x2e4d58;};'use strict';var client=require(_0x338c('0x0'));exports[_0x338c('0x1')]=function(_0x574849){return client[_0x338c('0x2')](_0x338c('0x3'),{'body':_0x574849,'log':_0x338c('0x3')});};exports[_0x338c('0x4')]=function(_0x381963,_0xbe0aef){return client['Request'](_0x338c('0x5'),{'body':_0xbe0aef,'options':{'where':{'uniqueid':_0x381963},'order':[['id','DESC']],'limit':0x1},'log':_0x338c('0x5')});}; \ No newline at end of file +var _0x2029=['Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client','create'];(function(_0x3c5a2c,_0xd3a687){var _0x41d3ba=function(_0x37b949){while(--_0x37b949){_0x3c5a2c['push'](_0x3c5a2c['shift']());}};_0x41d3ba(++_0xd3a687);}(_0x2029,0x171));var _0x9202=function(_0x12c581,_0x415a8b){_0x12c581=_0x12c581-0x0;var _0x323ced=_0x2029[_0x12c581];return _0x323ced;};'use strict';var client=require(_0x9202('0x0'));exports[_0x9202('0x1')]=function(_0x4d4110){return client[_0x9202('0x2')](_0x9202('0x3'),{'body':_0x4d4110,'log':_0x9202('0x3')});};exports[_0x9202('0x4')]=function(_0x39fa99,_0x81709f){return client[_0x9202('0x2')](_0x9202('0x5'),{'body':_0x81709f,'options':{'where':{'uniqueid':_0x39fa99},'order':[['id',_0x9202('0x6')]],'limit':0x1},'log':_0x9202('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index f5af994..57ecd5a 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0xfc406a,_0x4479e1){var _0x395473=function(_0x1fe8b6){while(--_0x1fe8b6){_0xfc406a['push'](_0xfc406a['shift']());}};_0x395473(++_0x4479e1);}(_0x7a54,0x106));var _0x47a5=function(_0xd43632,_0x2b5709){_0xd43632=_0xd43632-0x0;var _0x1811c2=_0x7a54[_0xd43632];return _0x1811c2;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x5ebbc0,_0x5d166d){var _0x352778=function(_0x3923b7){while(--_0x3923b7){_0x5ebbc0['push'](_0x5ebbc0['shift']());}};_0x352778(++_0x5d166d);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index cc5f0a4..e518e7f 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 _0xd161=['Request','CreateFaxMessage','createFaxMessage','create'];(function(_0x485fff,_0x33157d){var _0x43fdb0=function(_0x266850){while(--_0x266850){_0x485fff['push'](_0x485fff['shift']());}};_0x43fdb0(++_0x33157d);}(_0xd161,0x153));var _0x1d16=function(_0x23feed,_0x3ee753){_0x23feed=_0x23feed-0x0;var _0x15e8a5=_0xd161[_0x23feed];return _0x15e8a5;};'use strict';var client=require('../client');exports[_0x1d16('0x0')]=function(_0x5b72cc){return client[_0x1d16('0x1')](_0x1d16('0x2'),{'body':_0x5b72cc,'log':_0x1d16('0x3')});}; \ No newline at end of file +var _0x19d8=['CreateFaxMessage','../client'];(function(_0x4159b9,_0x351682){var _0xd10719=function(_0x1dbd8a){while(--_0x1dbd8a){_0x4159b9['push'](_0x4159b9['shift']());}};_0xd10719(++_0x351682);}(_0x19d8,0xa7));var _0x819d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x19d8[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x819d('0x0'));exports['create']=function(_0x1d5dcf){return client['Request'](_0x819d('0x1'),{'body':_0x1d5dcf,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 9e5a9de..9299f66 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 _0xab78=['strategy','User','Agents','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','timeout'];(function(_0x207811,_0x3420a6){var _0x170d56=function(_0x4340b7){while(--_0x4340b7){_0x207811['push'](_0x207811['shift']());}};_0x170d56(++_0x3420a6);}(_0xab78,0x1b2));var _0x8ab7=function(_0x3afe37,_0x1c9d3c){_0x3afe37=_0x3afe37-0x0;var _0x592823=_0xab78[_0x3afe37];return _0x592823;};'use strict';var client=require(_0x8ab7('0x0'));exports[_0x8ab7('0x1')]=function(){return function(){return client[_0x8ab7('0x2')](_0x8ab7('0x3'),{'options':{'raw':![],'attributes':['id',_0x8ab7('0x4'),_0x8ab7('0x5'),_0x8ab7('0x6')],'include':[{'model':_0x8ab7('0x7'),'as':_0x8ab7('0x8'),'attributes':['id',_0x8ab7('0x4'),_0x8ab7('0x9'),_0x8ab7('0xa')]}]},'log':_0x8ab7('0x1')});};}; \ No newline at end of file +var _0x7678=['../client','getFaxQueues','Request','name','timeout','strategy','User','Agents','online','faxPause'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x7678,0x14a));var _0x8767=function(_0x1829b6,_0x10ef6b){_0x1829b6=_0x1829b6-0x0;var _0x3def6b=_0x7678[_0x1829b6];return _0x3def6b;};'use strict';var client=require(_0x8767('0x0'));exports[_0x8767('0x1')]=function(){return function(){return client[_0x8767('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x8767('0x3'),_0x8767('0x4'),_0x8767('0x5')],'include':[{'model':_0x8767('0x6'),'as':_0x8767('0x7'),'attributes':['id','name',_0x8767('0x8'),_0x8767('0x9')]}]},'log':_0x8767('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 14d53eb..af99ee5 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 _0x474f=['DESC','../client','create','Request','CreateFaxQueueReport','UpdateFaxQueueReport'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x474f,0x163));var _0xf474=function(_0x4b7ab7,_0x230c0e){_0x4b7ab7=_0x4b7ab7-0x0;var _0x59259c=_0x474f[_0x4b7ab7];return _0x59259c;};'use strict';var client=require(_0xf474('0x0'));exports[_0xf474('0x1')]=function(_0x232a8e){return client[_0xf474('0x2')](_0xf474('0x3'),{'body':_0x232a8e,'log':_0xf474('0x3')});};exports['update']=function(_0x5467cb,_0x35a0c9){return client[_0xf474('0x2')](_0xf474('0x4'),{'body':_0x35a0c9,'options':{'where':{'uniqueid':_0x5467cb},'order':[['id',_0xf474('0x5')]],'limit':0x1},'log':_0xf474('0x4')});}; \ No newline at end of file +var _0xcefc=['CreateFaxQueueReport','UpdateFaxQueueReport','DESC','../client','Request'];(function(_0x10ffaf,_0x2e5c01){var _0x26803e=function(_0x5cd95a){while(--_0x5cd95a){_0x10ffaf['push'](_0x10ffaf['shift']());}};_0x26803e(++_0x2e5c01);}(_0xcefc,0x8a));var _0xccef=function(_0x1ca4e7,_0x4e9282){_0x1ca4e7=_0x1ca4e7-0x0;var _0x106c19=_0xcefc[_0x1ca4e7];return _0x106c19;};'use strict';var client=require(_0xccef('0x0'));exports['create']=function(_0x3db819){return client[_0xccef('0x1')]('CreateFaxQueueReport',{'body':_0x3db819,'log':_0xccef('0x2')});};exports['update']=function(_0x53d807,_0x587fc9){return client['Request'](_0xccef('0x3'),{'body':_0x587fc9,'options':{'where':{'uniqueid':_0x53d807},'order':[['id',_0xccef('0x4')]],'limit':0x1},'log':_0xccef('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 3d445ab..ecb67bd 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 _0x2f64=['../client','getIntervals','GetInterval','Interval','Intervals','name'];(function(_0xf94f9b,_0x2db140){var _0x2a8df6=function(_0x218a86){while(--_0x218a86){_0xf94f9b['push'](_0xf94f9b['shift']());}};_0x2a8df6(++_0x2db140);}(_0x2f64,0x15c));var _0x42f6=function(_0x4edaf1,_0x3c0639){_0x4edaf1=_0x4edaf1-0x0;var _0x4c4a2a=_0x2f64[_0x4edaf1];return _0x4c4a2a;};'use strict';var client=require(_0x42f6('0x0'));exports[_0x42f6('0x1')]=function(){return function(){return client['Request'](_0x42f6('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x42f6('0x3'),'as':_0x42f6('0x4'),'attributes':['id',_0x42f6('0x5'),'interval']}]},'log':_0x42f6('0x1')});};}; \ No newline at end of file +var _0x6e2f=['Interval','Intervals','../client','getIntervals','Request','name'];(function(_0x1a5e00,_0x40c95c){var _0x1ec9f7=function(_0x4ca7ca){while(--_0x4ca7ca){_0x1a5e00['push'](_0x1a5e00['shift']());}};_0x1ec9f7(++_0x40c95c);}(_0x6e2f,0x74));var _0xf6e2=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x6e2f[_0x5bd426];return _0x23a7eb;};'use strict';var client=require(_0xf6e2('0x0'));exports[_0xf6e2('0x1')]=function(){return function(){return client[_0xf6e2('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xf6e2('0x3')],'include':[{'model':_0xf6e2('0x4'),'as':_0xf6e2('0x5'),'attributes':['id','name','interval']}]},'log':_0xf6e2('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 25d3108..9ebe8d1 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 _0x6d38=['updateMailInteraction','Request','addTagsToChatInteraction','update'];(function(_0x320e1f,_0x1ada5e){var _0x1c7ae2=function(_0x13e28c){while(--_0x13e28c){_0x320e1f['push'](_0x320e1f['shift']());}};_0x1c7ae2(++_0x1ada5e);}(_0x6d38,0x1ef));var _0x86d3=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x6d38[_0x3e5086];return _0xfeb102;};'use strict';var client=require('../client');exports[_0x86d3('0x0')]=function(_0x4c9c06,_0x3db243){return client['Request']('UpdateMailInteraction',{'body':_0x3db243,'options':{'where':{'id':_0x4c9c06}},'log':_0x86d3('0x1')});};exports['addTags']=function(_0xe9198a,_0x455b9d){return client[_0x86d3('0x2')]('AddTagsToMailInteraction',{'body':_0x455b9d,'options':{'where':{'id':_0xe9198a}},'log':_0x86d3('0x3')});}; \ No newline at end of file +var _0xe2cf=['addTags','Request','AddTagsToMailInteraction','update','UpdateMailInteraction','updateMailInteraction'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x4975f8,_0x3a226c){_0x4975f8=_0x4975f8-0x0;var _0x86d59f=_0xe2cf[_0x4975f8];return _0x86d59f;};'use strict';var client=require('../client');exports[_0xfe2c('0x0')]=function(_0x546786,_0x11c3a4){return client['Request'](_0xfe2c('0x1'),{'body':_0x11c3a4,'options':{'where':{'id':_0x546786}},'log':_0xfe2c('0x2')});};exports[_0xfe2c('0x3')]=function(_0x11b6b8,_0x494978){return client[_0xfe2c('0x4')](_0xfe2c('0x5'),{'body':_0x494978,'options':{'where':{'id':_0x11b6b8}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 2a46442..79bc05f 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 _0xe164=['createMailMessage','Request','CreateMailMessage'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xe164,0xaf));var _0x4e16=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xe164[_0x40220a];return _0x3903cc;};'use strict';var client=require('../client');exports['create']=function(_0x25f1e5){return client[_0x4e16('0x0')](_0x4e16('0x1'),{'body':_0x25f1e5,'log':_0x4e16('0x2')});}; \ No newline at end of file +var _0xbbf4=['CreateMailMessage','createMailMessage','../client','create'];(function(_0x20b29c,_0xe22528){var _0x20d81b=function(_0xd63a71){while(--_0xd63a71){_0x20b29c['push'](_0x20b29c['shift']());}};_0x20d81b(++_0xe22528);}(_0xbbf4,0x7a));var _0x4bbf=function(_0x198a98,_0x1cc58f){_0x198a98=_0x198a98-0x0;var _0x3daf2b=_0xbbf4[_0x198a98];return _0x3daf2b;};'use strict';var client=require(_0x4bbf('0x0'));exports[_0x4bbf('0x1')]=function(_0x664782){return client['Request'](_0x4bbf('0x2'),{'body':_0x664782,'log':_0x4bbf('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 6daf729..70457f3 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 _0x0fa5=['online','mailPause','getMailQueues','../client','Request','GetMailQueue','timeout','strategy','Agents','name'];(function(_0xd86db5,_0x11d9d3){var _0x2f1e6d=function(_0x169671){while(--_0x169671){_0xd86db5['push'](_0xd86db5['shift']());}};_0x2f1e6d(++_0x11d9d3);}(_0x0fa5,0xad));var _0x50fa=function(_0x2c4570,_0x21871d){_0x2c4570=_0x2c4570-0x0;var _0x26f4b0=_0x0fa5[_0x2c4570];return _0x26f4b0;};'use strict';var client=require(_0x50fa('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x50fa('0x1')](_0x50fa('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x50fa('0x3'),_0x50fa('0x4')],'include':[{'model':'User','as':_0x50fa('0x5'),'attributes':['id',_0x50fa('0x6'),_0x50fa('0x7'),_0x50fa('0x8')]}]},'log':_0x50fa('0x9')});};}; \ No newline at end of file +var _0x62fc=['Request','name','User','mailPause','../client','getMailQueues'];(function(_0x2e5a67,_0x37dadb){var _0x1f37b9=function(_0x47a076){while(--_0x47a076){_0x2e5a67['push'](_0x2e5a67['shift']());}};_0x1f37b9(++_0x37dadb);}(_0x62fc,0x1c6));var _0xc62f=function(_0xfb9f75,_0xc7521b){_0xfb9f75=_0xfb9f75-0x0;var _0x1ce11e=_0x62fc[_0xfb9f75];return _0x1ce11e;};'use strict';var client=require(_0xc62f('0x0'));exports[_0xc62f('0x1')]=function(){return function(){return client[_0xc62f('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xc62f('0x3'),'timeout','strategy'],'include':[{'model':_0xc62f('0x4'),'as':'Agents','attributes':['id',_0xc62f('0x3'),'online',_0xc62f('0x5')]}]},'log':_0xc62f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 43fe663..e3e9d22 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 _0xe59b=['CreateMailQueueReport','update','UpdateMailQueueReport','../client','Request'];(function(_0x2c5971,_0x23fdee){var _0x7edd1a=function(_0x9c4a41){while(--_0x9c4a41){_0x2c5971['push'](_0x2c5971['shift']());}};_0x7edd1a(++_0x23fdee);}(_0xe59b,0xa8));var _0xbe59=function(_0x20d56f,_0x2b5748){_0x20d56f=_0x20d56f-0x0;var _0x55a2ff=_0xe59b[_0x20d56f];return _0x55a2ff;};'use strict';var client=require(_0xbe59('0x0'));exports['create']=function(_0x1db393){return client[_0xbe59('0x1')](_0xbe59('0x2'),{'body':_0x1db393,'log':_0xbe59('0x2')});};exports[_0xbe59('0x3')]=function(_0x28bab6,_0x1d01b8){return client['Request'](_0xbe59('0x4'),{'body':_0x1d01b8,'options':{'where':{'uniqueid':_0x28bab6},'order':[['id','DESC']],'limit':0x1},'log':_0xbe59('0x4')});}; \ No newline at end of file +var _0xe040=['../client','create','update','UpdateMailQueueReport','DESC'];(function(_0x353a30,_0x50c68a){var _0x213161=function(_0x440b8b){while(--_0x440b8b){_0x353a30['push'](_0x353a30['shift']());}};_0x213161(++_0x50c68a);}(_0xe040,0x64));var _0x0e04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe040[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x0e04('0x0'));exports[_0x0e04('0x1')]=function(_0x9aa90e){return client['Request']('CreateMailQueueReport',{'body':_0x9aa90e,'log':'CreateMailQueueReport'});};exports[_0x0e04('0x2')]=function(_0x3b26fa,_0x35cb20){return client['Request'](_0x0e04('0x3'),{'body':_0x35cb20,'options':{'where':{'uniqueid':_0x3b26fa},'order':[['id',_0x0e04('0x4')]],'limit':0x1},'log':_0x0e04('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index a50b0b2..69fcac1 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 _0x6f7c=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTagsToChatInteraction','../client','Request'];(function(_0xea821e,_0x1ad760){var _0x4b95eb=function(_0xd14fc8){while(--_0xd14fc8){_0xea821e['push'](_0xea821e['shift']());}};_0x4b95eb(++_0x1ad760);}(_0x6f7c,0x9e));var _0xc6f7=function(_0x21646a,_0x14dd46){_0x21646a=_0x21646a-0x0;var _0x13be22=_0x6f7c[_0x21646a];return _0x13be22;};'use strict';var client=require(_0xc6f7('0x0'));exports['update']=function(_0x1d1384,_0x534572){return client[_0xc6f7('0x1')](_0xc6f7('0x2'),{'body':_0x534572,'options':{'where':{'id':_0x1d1384}},'log':_0xc6f7('0x3')});};exports['addTags']=function(_0x3c14c6,_0x252ee8){return client[_0xc6f7('0x1')]('AddTagsToOpenchannelInteraction',{'body':_0x252ee8,'options':{'where':{'id':_0x3c14c6}},'log':_0xc6f7('0x4')});}; \ No newline at end of file +var _0xc61b=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update','Request'];(function(_0x380431,_0x24bd98){var _0x4d0fc2=function(_0x996f6e){while(--_0x996f6e){_0x380431['push'](_0x380431['shift']());}};_0x4d0fc2(++_0x24bd98);}(_0xc61b,0x91));var _0xbc61=function(_0x529ef2,_0x13dd70){_0x529ef2=_0x529ef2-0x0;var _0x449ab8=_0xc61b[_0x529ef2];return _0x449ab8;};'use strict';var client=require('../client');exports[_0xbc61('0x0')]=function(_0x5f5d9f,_0x52434f){return client[_0xbc61('0x1')](_0xbc61('0x2'),{'body':_0x52434f,'options':{'where':{'id':_0x5f5d9f}},'log':_0xbc61('0x3')});};exports[_0xbc61('0x4')]=function(_0x4f509b,_0x7c370){return client[_0xbc61('0x1')](_0xbc61('0x5'),{'body':_0x7c370,'options':{'where':{'id':_0x4f509b}},'log':_0xbc61('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 7b30817..761b774 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 _0x18f5=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x18f5,0x1bc));var _0x518f=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x18f5[_0x7e2eb0];return _0xd92de4;};'use strict';var client=require(_0x518f('0x0'));exports[_0x518f('0x1')]=function(_0x285121){return client[_0x518f('0x2')](_0x518f('0x3'),{'body':_0x285121,'log':_0x518f('0x4')});}; \ No newline at end of file +var _0xe374=['../client','create','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x59a3d4,_0x33a44e){var _0x1d548d=function(_0x16551b){while(--_0x16551b){_0x59a3d4['push'](_0x59a3d4['shift']());}};_0x1d548d(++_0x33a44e);}(_0xe374,0x150));var _0x4e37=function(_0x42b950,_0x278b2b){_0x42b950=_0x42b950-0x0;var _0x589c7f=_0xe374[_0x42b950];return _0x589c7f;};'use strict';var client=require(_0x4e37('0x0'));exports[_0x4e37('0x1')]=function(_0x2a044c){return client['Request'](_0x4e37('0x2'),{'body':_0x2a044c,'log':_0x4e37('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index d710cc2..e99a9fb 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 _0x151b=['User','online','openchannelPause','../client','GetOpenchannelQueue','timeout','strategy'];(function(_0x1a5a92,_0x4056e1){var _0xa92479=function(_0x5a7ec8){while(--_0x5a7ec8){_0x1a5a92['push'](_0x1a5a92['shift']());}};_0xa92479(++_0x4056e1);}(_0x151b,0x153));var _0xb151=function(_0x1677e7,_0x4df4b2){_0x1677e7=_0x1677e7-0x0;var _0x431369=_0x151b[_0x1677e7];return _0x431369;};'use strict';var client=require(_0xb151('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client['Request'](_0xb151('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xb151('0x2'),_0xb151('0x3')],'include':[{'model':_0xb151('0x4'),'as':'Agents','attributes':['id','name',_0xb151('0x5'),_0xb151('0x6')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x8782=['../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','Agents','online'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x8782,0x17a));var _0x2878=function(_0x400c94,_0x4def83){_0x400c94=_0x400c94-0x0;var _0x2c72eb=_0x8782[_0x400c94];return _0x2c72eb;};'use strict';var client=require(_0x2878('0x0'));exports[_0x2878('0x1')]=function(){return function(){return client[_0x2878('0x2')](_0x2878('0x3'),{'options':{'raw':![],'attributes':['id',_0x2878('0x4'),_0x2878('0x5'),_0x2878('0x6')],'include':[{'model':'User','as':_0x2878('0x7'),'attributes':['id',_0x2878('0x4'),_0x2878('0x8'),'openchannelPause']}]},'log':_0x2878('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index fe9fdaa..95ca9e6 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 _0x841e=['UpdateOpenchannelQueueReport','DESC','../client','create','CreateOpenchannelQueueReport'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x841e,0x15b));var _0xe841=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x841e[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xe841('0x0'));exports[_0xe841('0x1')]=function(_0x1b1ea7){return client['Request'](_0xe841('0x2'),{'body':_0x1b1ea7,'log':'CreateOpenchannelQueueReport'});};exports['update']=function(_0x285466,_0x5e5139){return client['Request'](_0xe841('0x3'),{'body':_0x5e5139,'options':{'where':{'uniqueid':_0x285466},'order':[['id',_0xe841('0x4')]],'limit':0x1},'log':_0xe841('0x3')});}; \ No newline at end of file +var _0x8bf0=['update','UpdateOpenchannelQueueReport','Request','CreateOpenchannelQueueReport'];(function(_0x5e2152,_0x172f3d){var _0x5ddcf6=function(_0x30a5cc){while(--_0x30a5cc){_0x5e2152['push'](_0x5e2152['shift']());}};_0x5ddcf6(++_0x172f3d);}(_0x8bf0,0x14a));var _0x08bf=function(_0x41ddb6,_0x148e78){_0x41ddb6=_0x41ddb6-0x0;var _0x289513=_0x8bf0[_0x41ddb6];return _0x289513;};'use strict';var client=require('../client');exports['create']=function(_0x226ecb){return client[_0x08bf('0x0')](_0x08bf('0x1'),{'body':_0x226ecb,'log':'CreateOpenchannelQueueReport'});};exports[_0x08bf('0x2')]=function(_0x47b74f,_0x5e8818){return client[_0x08bf('0x0')]('UpdateOpenchannelQueueReport',{'body':_0x5e8818,'options':{'where':{'uniqueid':_0x47b74f},'order':[['id','DESC']],'limit':0x1},'log':_0x08bf('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 3ce416f..176367a 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 _0x56a6=['addTagsToSmsInteraction','../client','update','updateSmsInteraction','addTags','Request','AddTagsToSmsInteraction'];(function(_0x584308,_0x1379b3){var _0x45865b=function(_0x145a82){while(--_0x145a82){_0x584308['push'](_0x584308['shift']());}};_0x45865b(++_0x1379b3);}(_0x56a6,0x17b));var _0x656a=function(_0xf41aa6,_0x491d70){_0xf41aa6=_0xf41aa6-0x0;var _0x40643f=_0x56a6[_0xf41aa6];return _0x40643f;};'use strict';var client=require(_0x656a('0x0'));exports[_0x656a('0x1')]=function(_0xe679b,_0xaa8734){return client['Request']('UpdateSmsInteraction',{'body':_0xaa8734,'options':{'where':{'id':_0xe679b}},'log':_0x656a('0x2')});};exports[_0x656a('0x3')]=function(_0x67844b,_0x4d764b){return client[_0x656a('0x4')](_0x656a('0x5'),{'body':_0x4d764b,'options':{'where':{'id':_0x67844b}},'log':_0x656a('0x6')});}; \ No newline at end of file +var _0x96a2=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x303556,_0x46d2af){var _0x9afa64=function(_0x2786e5){while(--_0x2786e5){_0x303556['push'](_0x303556['shift']());}};_0x9afa64(++_0x46d2af);}(_0x96a2,0x96));var _0x296a=function(_0x1b6897,_0x505e26){_0x1b6897=_0x1b6897-0x0;var _0x2a2152=_0x96a2[_0x1b6897];return _0x2a2152;};'use strict';var client=require(_0x296a('0x0'));exports['update']=function(_0x46dc2b,_0x2c8e7c){return client[_0x296a('0x1')](_0x296a('0x2'),{'body':_0x2c8e7c,'options':{'where':{'id':_0x46dc2b}},'log':_0x296a('0x3')});};exports[_0x296a('0x4')]=function(_0x142815,_0x420fc5){return client[_0x296a('0x1')](_0x296a('0x5'),{'body':_0x420fc5,'options':{'where':{'id':_0x142815}},'log':_0x296a('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 0e2bc44..0bc528d 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 _0x1a64=['CreateSmsMessage','createSmsMessage','Request'];(function(_0x37673e,_0x10c2bc){var _0x438db6=function(_0x264db2){while(--_0x264db2){_0x37673e['push'](_0x37673e['shift']());}};_0x438db6(++_0x10c2bc);}(_0x1a64,0x1f1));var _0x41a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1a64[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['create']=function(_0x46ef2d){return client[_0x41a6('0x0')](_0x41a6('0x1'),{'body':_0x46ef2d,'log':_0x41a6('0x2')});}; \ No newline at end of file +var _0xf572=['Request','CreateSmsMessage','createSmsMessage','../client','create'];(function(_0xcf3a34,_0xf740b9){var _0x634728=function(_0xa46080){while(--_0xa46080){_0xcf3a34['push'](_0xcf3a34['shift']());}};_0x634728(++_0xf740b9);}(_0xf572,0x76));var _0x2f57=function(_0x22aad6,_0x53227e){_0x22aad6=_0x22aad6-0x0;var _0x201cd2=_0xf572[_0x22aad6];return _0x201cd2;};'use strict';var client=require(_0x2f57('0x0'));exports[_0x2f57('0x1')]=function(_0x2b5104){return client[_0x2f57('0x2')](_0x2f57('0x3'),{'body':_0x2b5104,'log':_0x2f57('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 854f72d..c3e4d42 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 _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x2f89c0,_0x455702){var _0x164223=function(_0x11a234){while(--_0x11a234){_0x2f89c0['push'](_0x2f89c0['shift']());}};_0x164223(++_0x455702);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file +var _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x4b2ed7,_0x5b3100){var _0x55a953=function(_0x4b7abd){while(--_0x4b7abd){_0x4b2ed7['push'](_0x4b2ed7['shift']());}};_0x55a953(++_0x5b3100);}(_0x70e0,0x17b));var _0x070e=function(_0x58efeb,_0x959f4d){_0x58efeb=_0x58efeb-0x0;var _0x2e2a48=_0x70e0[_0x58efeb];return _0x2e2a48;};'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 b16c525..1293759 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x737a1f,_0x235fef){var _0x16eba1=function(_0x292aa8){while(--_0x292aa8){_0x737a1f['push'](_0x737a1f['shift']());}};_0x16eba1(++_0x235fef);}(_0xedd9,0xfc));var _0x9edd=function(_0x1ec8d0,_0x42da15){_0x1ec8d0=_0x1ec8d0-0x0;var _0x588979=_0xedd9[_0x1ec8d0];return _0x588979;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file +var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x5d983c,_0x57b322){var _0x45d2f8=function(_0x4fb48d){while(--_0x4fb48d){_0x5d983c['push'](_0x5d983c['shift']());}};_0x45d2f8(++_0x57b322);}(_0x008c,0x188));var _0xc008=function(_0x3e88f0,_0x27d2b0){_0x3e88f0=_0x3e88f0-0x0;var _0x106a66=_0x008c[_0x3e88f0];return _0x106a66;};'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 diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 4ba8180..517e156 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(_0x3f417f,_0x454605){var _0x14ae66=function(_0x106372){while(--_0x106372){_0x3f417f['push'](_0x3f417f['shift']());}};_0x14ae66(++_0x454605);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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(_0x2b0b4c,_0x3aab35){var _0x3acc75=function(_0x3c9b39){while(--_0x3c9b39){_0x2b0b4c['push'](_0x2b0b4c['shift']());}};_0x3acc75(++_0x3aab35);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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 66ea478..3a73fd6 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 _0x8ba0=['update','Request','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8ba0,0x1c7));var _0x08ba=function(_0x4bdc05,_0x623370){_0x4bdc05=_0x4bdc05-0x0;var _0x43f1b3=_0x8ba0[_0x4bdc05];return _0x43f1b3;};'use strict';var client=require(_0x08ba('0x0'));exports[_0x08ba('0x1')]=function(_0x3208b5,_0x1c7b7b){return client[_0x08ba('0x2')]('UpdateWhatsappInteraction',{'body':_0x1c7b7b,'options':{'where':{'id':_0x3208b5}},'log':'updateWhatsappInteraction'});};exports[_0x08ba('0x3')]=function(_0x802b7e,_0x3defcd){return client[_0x08ba('0x2')](_0x08ba('0x4'),{'body':_0x3defcd,'options':{'where':{'id':_0x802b7e}},'log':_0x08ba('0x5')});}; \ No newline at end of file +var _0x938d=['../client','update','Request','UpdateWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x3da9cd,_0x279a5c){var _0x3d4baf=function(_0x378caf){while(--_0x378caf){_0x3da9cd['push'](_0x3da9cd['shift']());}};_0x3d4baf(++_0x279a5c);}(_0x938d,0x122));var _0xd938=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x938d[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xd938('0x0'));exports[_0xd938('0x1')]=function(_0x4fb46a,_0x3c6634){return client[_0xd938('0x2')](_0xd938('0x3'),{'body':_0x3c6634,'options':{'where':{'id':_0x4fb46a}},'log':'updateWhatsappInteraction'});};exports['addTags']=function(_0xc9f24b,_0x429911){return client[_0xd938('0x2')]('AddTagsToWhatsappInteraction',{'body':_0x429911,'options':{'where':{'id':_0xc9f24b}},'log':_0xd938('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index f8992c8..d667170 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 _0x8d47=['../client','createWhatsappMessage'];(function(_0x349a9e,_0x473cb8){var _0x24c207=function(_0x22f148){while(--_0x22f148){_0x349a9e['push'](_0x349a9e['shift']());}};_0x24c207(++_0x473cb8);}(_0x8d47,0xfc));var _0x78d4=function(_0x508b0b,_0x515bd7){_0x508b0b=_0x508b0b-0x0;var _0x3792e8=_0x8d47[_0x508b0b];return _0x3792e8;};'use strict';var client=require(_0x78d4('0x0'));exports['create']=function(_0x5bc21e){return client['Request']('CreateWhatsappMessage',{'body':_0x5bc21e,'log':_0x78d4('0x1')});}; \ No newline at end of file +var _0x3a00=['Request','CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0xa52fe3,_0x3feb1c){var _0x50c1a5=function(_0x977116){while(--_0x977116){_0xa52fe3['push'](_0xa52fe3['shift']());}};_0x50c1a5(++_0x3feb1c);}(_0x3a00,0x1ca));var _0x03a0=function(_0x154192,_0x2d360f){_0x154192=_0x154192-0x0;var _0x3c2792=_0x3a00[_0x154192];return _0x3c2792;};'use strict';var client=require(_0x03a0('0x0'));exports[_0x03a0('0x1')]=function(_0x4726f4){return client[_0x03a0('0x2')](_0x03a0('0x3'),{'body':_0x4726f4,'log':_0x03a0('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index d04ea9b..b0c0971 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 _0x3210=['GetWhatsappQueue','name','timeout','strategy','User','Agents','online','whatsappPause','getWhatsappQueues','../client','Request'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x3210,0x148));var _0x0321=function(_0x3d2132,_0x125d5a){_0x3d2132=_0x3d2132-0x0;var _0x3bd40a=_0x3210[_0x3d2132];return _0x3bd40a;};'use strict';var client=require(_0x0321('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x0321('0x1')](_0x0321('0x2'),{'options':{'raw':![],'attributes':['id',_0x0321('0x3'),_0x0321('0x4'),_0x0321('0x5')],'include':[{'model':_0x0321('0x6'),'as':_0x0321('0x7'),'attributes':['id',_0x0321('0x3'),_0x0321('0x8'),_0x0321('0x9')]}]},'log':_0x0321('0xa')});};}; \ No newline at end of file +var _0x34b4=['../client','getWhatsappQueues','GetWhatsappQueue','name','timeout','strategy','online','whatsappPause'];(function(_0x4a759b,_0x28a0b9){var _0x1619f2=function(_0x2aa111){while(--_0x2aa111){_0x4a759b['push'](_0x4a759b['shift']());}};_0x1619f2(++_0x28a0b9);}(_0x34b4,0xe8));var _0x434b=function(_0x5dab7a,_0x4f5105){_0x5dab7a=_0x5dab7a-0x0;var _0x5dbafd=_0x34b4[_0x5dab7a];return _0x5dbafd;};'use strict';var client=require(_0x434b('0x0'));exports[_0x434b('0x1')]=function(){return function(){return client['Request'](_0x434b('0x2'),{'options':{'raw':![],'attributes':['id',_0x434b('0x3'),_0x434b('0x4'),_0x434b('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x434b('0x3'),_0x434b('0x6'),_0x434b('0x7')]}]},'log':_0x434b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index d42851d..d3017b0 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 _0xbcf7=['../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC'];(function(_0x152678,_0x11e0ac){var _0x311a9=function(_0x4f5291){while(--_0x4f5291){_0x152678['push'](_0x152678['shift']());}};_0x311a9(++_0x11e0ac);}(_0xbcf7,0x70));var _0x7bcf=function(_0x106724,_0x4b1eb0){_0x106724=_0x106724-0x0;var _0x2819b9=_0xbcf7[_0x106724];return _0x2819b9;};'use strict';var client=require(_0x7bcf('0x0'));exports[_0x7bcf('0x1')]=function(_0x35150b){return client[_0x7bcf('0x2')](_0x7bcf('0x3'),{'body':_0x35150b,'log':'CreateWhatsappQueueReport'});};exports[_0x7bcf('0x4')]=function(_0x50764c,_0x221b41){return client[_0x7bcf('0x2')](_0x7bcf('0x5'),{'body':_0x221b41,'options':{'where':{'uniqueid':_0x50764c},'order':[['id',_0x7bcf('0x6')]],'limit':0x1},'log':_0x7bcf('0x5')});}; \ No newline at end of file +var _0x85a7=['../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC'];(function(_0x1680c8,_0x328a14){var _0xdd8590=function(_0x22b9d6){while(--_0x22b9d6){_0x1680c8['push'](_0x1680c8['shift']());}};_0xdd8590(++_0x328a14);}(_0x85a7,0xd9));var _0x785a=function(_0x5f1543,_0x319776){_0x5f1543=_0x5f1543-0x0;var _0x2c5592=_0x85a7[_0x5f1543];return _0x2c5592;};'use strict';var client=require(_0x785a('0x0'));exports[_0x785a('0x1')]=function(_0x3ed1f0){return client[_0x785a('0x2')](_0x785a('0x3'),{'body':_0x3ed1f0,'log':_0x785a('0x3')});};exports[_0x785a('0x4')]=function(_0x228a96,_0x1b0762){return client[_0x785a('0x2')](_0x785a('0x5'),{'body':_0x1b0762,'options':{'where':{'uniqueid':_0x228a96},'order':[['id',_0x785a('0x6')]],'limit':0x1},'log':_0x785a('0x5')});}; \ 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 112f8a3..7a20152 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 _0xbe36=['map','message','find','timeout','atimeout','channel','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','stop','complete','[%s][AGENT]\x20ROUTING\x20END','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','util','../../../../config/logger','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error'];(function(_0x41c25c,_0x2f25e4){var _0x946c9a=function(_0x26e886){while(--_0x26e886){_0x41c25c['push'](_0x41c25c['shift']());}};_0x946c9a(++_0x2f25e4);}(_0xbe36,0xd1));var _0x6be3=function(_0x264848,_0x46e71f){_0x264848=_0x264848-0x0;var _0xdce51e=_0xbe36[_0x264848];return _0xdce51e;};'use strict';var schema=require(_0x6be3('0x0'));var _=require('lodash');var util=require(_0x6be3('0x1'));var seqqueue=require('seq-queue');var logger=require(_0x6be3('0x2'))(_0x6be3('0x3'));var strategy=require(_0x6be3('0x4'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x6be3('0x5')},'timeout':{'type':_0x6be3('0x6'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x3988d8,_0xfd656d,_0x4d8bac){return logger[_0x6be3('0x7')](util[_0x6be3('0x8')](_0x6be3('0x9'),_0x3988d8,_0xfd656d[_0x6be3('0xa')],_0x4d8bac));}function handleFindAgent(_0x371175){return function(_0x3f7c7d){return _0x3f7c7d[_0x6be3('0xa')][_0x6be3('0xb')]()===_0x371175['toLowerCase']();};}exports[_0x6be3('0xc')]=function(_0xc529e3,_0x258da7,_0x4c292b,_0xabc43d){return function(_0x2b3964){try{var _0x21f162={'name':_0x258da7[0x0],'timeout':_0x258da7[0x1]};var _0x3fe18f=queue['validate'](_0x21f162,{'typecast':!![]});if(_0x3fe18f[_0x6be3('0xd')]){logger[_0x6be3('0xe')]('[%s][AGENT]\x20%s',_0xc529e3,_[_0x6be3('0xf')](_0x3fe18f,_0x6be3('0x10'))['join'](',\x20'));_0x2b3964['stop']();}else{var _0x2d20f3=_[_0x6be3('0x11')](_0x4c292b['agents'],handleFindAgent(_0x21f162[_0x6be3('0xa')]));if(_0x2d20f3){var _0x32c0f3=(_0x21f162[_0x6be3('0x12')]||0xa)*0x3e8;var _0x2ba117,_0xd0b994;var _0x22d602=seqqueue['createQueue'](_0x32c0f3);_0x22d602['id']=_0xc529e3;_0x22d602[_0x6be3('0x13')]=_0x32c0f3;_0x22d602[_0x6be3('0x14')]=_0xabc43d[_0x6be3('0x14')];writeLog(_0xc529e3,_0x2d20f3,util['format']('START:%s',_0x32c0f3));_0x4c292b['rules'][_0xc529e3]['on']('end',function(){logger[_0x6be3('0x7')](_0x6be3('0x15'),_0xc529e3);clearTimeout(_0xd0b994);_0xd0b994=undefined;_0x22d602[_0x6be3('0x16')]();if(_0x4c292b['rules'][_0xc529e3]){delete _0x4c292b[_0x6be3('0x17')][_0xc529e3];}_0x2b3964[_0x6be3('0x18')]();});_0x4c292b[_0x6be3('0x17')][_0xc529e3]['on'](_0x6be3('0x19'),function(){if(_0x4c292b[_0x6be3('0x17')][_0xc529e3]){delete _0x4c292b[_0x6be3('0x17')][_0xc529e3];}});_0xd0b994=setTimeout(function(){logger[_0x6be3('0x7')](_0x6be3('0x1a'),_0xc529e3);clearTimeout(_0xd0b994);_0x22d602[_0x6be3('0x16')]();_0x2b3964[_0x6be3('0x1b')]();},_0x32c0f3);strategy['agent'](_0x22d602,_0x2d20f3,_0x4c292b,_0xabc43d);}else{logger[_0x6be3('0xe')](_0x6be3('0x1c'),_0xc529e3,_0x21f162['name']);_0x2b3964['stop']();}}}catch(_0x3513d4){console[_0x6be3('0x1d')](_0x3513d4);logger['error'](_0x6be3('0x1e'),_0xc529e3,_0x3513d4[_0x6be3('0x1f')]);_0x2b3964[_0x6be3('0x18')]();}};}; \ No newline at end of file +var _0x1dfe=['atimeout','channel','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','rules','stop','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','find','agents','timeout'];(function(_0x16a80b,_0x5363ef){var _0x2c2df5=function(_0x3bea7b){while(--_0x3bea7b){_0x16a80b['push'](_0x16a80b['shift']());}};_0x2c2df5(++_0x5363ef);}(_0x1dfe,0x14a));var _0xe1df=function(_0x199b6a,_0x2cc3bf){_0x199b6a=_0x199b6a-0x0;var _0x2c8a2a=_0x1dfe[_0x199b6a];return _0x2c8a2a;};'use strict';var schema=require(_0xe1df('0x0'));var _=require(_0xe1df('0x1'));var util=require(_0xe1df('0x2'));var seqqueue=require(_0xe1df('0x3'));var logger=require('../../../../config/logger')(_0xe1df('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0xe1df('0x5'),'required':!![],'message':_0xe1df('0x6')},'timeout':{'type':_0xe1df('0x7'),'message':_0xe1df('0x8')}});function writeLog(_0x3d4bd6,_0x4afc20,_0x479651){return logger['info'](util[_0xe1df('0x9')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x3d4bd6,_0x4afc20[_0xe1df('0xa')],_0x479651));}function handleFindAgent(_0x2fdc0b){return function(_0x5d56da){return _0x5d56da[_0xe1df('0xa')][_0xe1df('0xb')]()===_0x2fdc0b['toLowerCase']();};}exports[_0xe1df('0xc')]=function(_0x2f8aa6,_0x385515,_0x29abf8,_0x129b28){return function(_0x3d7a20){try{var _0x36ad6d={'name':_0x385515[0x0],'timeout':_0x385515[0x1]};var _0x394845=queue[_0xe1df('0x0')](_0x36ad6d,{'typecast':!![]});if(_0x394845[_0xe1df('0xd')]){logger[_0xe1df('0xe')](_0xe1df('0xf'),_0x2f8aa6,_[_0xe1df('0x10')](_0x394845,'message')['join'](',\x20'));_0x3d7a20['stop']();}else{var _0x103252=_[_0xe1df('0x11')](_0x29abf8[_0xe1df('0x12')],handleFindAgent(_0x36ad6d[_0xe1df('0xa')]));if(_0x103252){var _0x42075f=(_0x36ad6d[_0xe1df('0x13')]||0xa)*0x3e8;var _0x16547a,_0x396198;var _0x3ad93b=seqqueue['createQueue'](_0x42075f);_0x3ad93b['id']=_0x2f8aa6;_0x3ad93b[_0xe1df('0x14')]=_0x42075f;_0x3ad93b['channel']=_0x129b28[_0xe1df('0x15')];writeLog(_0x2f8aa6,_0x103252,util[_0xe1df('0x9')](_0xe1df('0x16'),_0x42075f));_0x29abf8['rules'][_0x2f8aa6]['on'](_0xe1df('0x17'),function(){logger['info'](_0xe1df('0x18'),_0x2f8aa6);clearTimeout(_0x396198);_0x396198=undefined;_0x3ad93b['close']();if(_0x29abf8[_0xe1df('0x19')][_0x2f8aa6]){delete _0x29abf8[_0xe1df('0x19')][_0x2f8aa6];}_0x3d7a20[_0xe1df('0x1a')]();});_0x29abf8[_0xe1df('0x19')][_0x2f8aa6]['on'](_0xe1df('0x1b'),function(){if(_0x29abf8['rules'][_0x2f8aa6]){delete _0x29abf8[_0xe1df('0x19')][_0x2f8aa6];}});_0x396198=setTimeout(function(){logger['info'](_0xe1df('0x1c'),_0x2f8aa6);clearTimeout(_0x396198);_0x3ad93b[_0xe1df('0x1d')]();_0x3d7a20[_0xe1df('0x1e')]();},_0x42075f);strategy[_0xe1df('0x1f')](_0x3ad93b,_0x103252,_0x29abf8,_0x129b28);}else{logger[_0xe1df('0xe')](_0xe1df('0x20'),_0x2f8aa6,_0x36ad6d[_0xe1df('0xa')]);_0x3d7a20['stop']();}}}catch(_0x150bb3){console[_0xe1df('0x21')](_0x150bb3);logger[_0xe1df('0xe')]('[%s][QUEUE]\x20%s',_0x2f8aa6,_0x150bb3[_0xe1df('0x22')]);_0x3d7a20[_0xe1df('0x1a')]();}};}; \ 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 97fd416..81a9851 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 _0x8d11=['stringify','lodash','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','phone','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','body','Message','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','toString','providerName','amazonlex','create','then','dialogState','Failed'];(function(_0x2de325,_0x21c226){var _0x2dcc26=function(_0x2992bd){while(--_0x2992bd){_0x2de325['push'](_0x2de325['shift']());}};_0x2dcc26(++_0x21c226);}(_0x8d11,0x1cd));var _0x18d1=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x8d11[_0x43d11d];return _0x38cd08;};'use strict';var _=require(_0x18d1('0x0'));var moment=require(_0x18d1('0x1'));var AWS=require(_0x18d1('0x2'));var utils=require(_0x18d1('0x3'));var logger=require(_0x18d1('0x4'))('routing');var rpc={'chatMessage':require(_0x18d1('0x5')),'openchannelMessage':require(_0x18d1('0x6')),'mailMessage':require(_0x18d1('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x18d1('0x8')),'whatsappMessage':require(_0x18d1('0x9'))};exports[_0x18d1('0xa')]=function(_0x30b446,_0x34dffa){return function(_0x5773b8){try{if(!_['isNil'](this[_0x18d1('0xb')]['UserId'])){logger[_0x18d1('0xc')](_0x18d1('0xd'),_0x30b446,_0x18d1('0xe'));return _0x5773b8[_0x18d1('0xf')]();}var _0x43c41a={'ContactId':this['contact']['id'],'sentAt':moment()[_0x18d1('0x10')](_0x18d1('0x11')),'direction':'out'};if(this[_0x18d1('0x12')]===_0x18d1('0x13')||this[_0x18d1('0x12')]==='whatsapp'){_0x43c41a[_0x18d1('0x14')]=this[_0x18d1('0xb')][_0x18d1('0x14')];}var _0x4bb9f9=this[_0x18d1('0x12')];if(_0x4bb9f9==='chat'){_0x43c41a[_0x18d1('0x15')]=this['account']['id'];}else{_0x43c41a[_[_0x18d1('0x16')](_0x4bb9f9)+_0x18d1('0x17')]=this[_0x18d1('0x18')]['id'];}_0x43c41a[_[_0x18d1('0x16')](_0x4bb9f9)+_0x18d1('0x19')]=this[_0x18d1('0xb')]['id'];if(this[_0x18d1('0xb')][_0x18d1('0x1a')]){var _0x4a174b=_0x34dffa[0x4];if(!_[_0x18d1('0x1b')](_0x4a174b)){_0x43c41a[_0x18d1('0x1c')]=utils['getMustacheRender'](_0x4a174b,this);return rpc[_0x4bb9f9+_0x18d1('0x1d')]['create'](_0x43c41a)['then'](function(_0x21bbaa){logger[_0x18d1('0xc')](_0x18d1('0xd'),_0x30b446,_0x43c41a['body']);})[_0x18d1('0x1e')](function(_0x54889c){logger[_0x18d1('0x1f')](_0x18d1('0xd'),_0x30b446,JSON['stringify'](_0x54889c));})[_0x18d1('0x20')](function(){logger[_0x18d1('0xc')](_0x18d1('0x21'),_0x30b446);_0x5773b8[_0x18d1('0x22')]();});}else{logger['info'](_0x18d1('0x23'),_0x30b446);_0x5773b8['stop']();}}else{var _0x555e7f=this;var _0x121d28=new AWS['LexRuntime']({'accessKeyId':_0x34dffa[0x0],'secretAccessKey':_0x34dffa[0x1],'region':_0x34dffa[0x2]});var _0x47653e={'botAlias':_0x18d1('0x24'),'botName':_0x34dffa[0x3],'inputText':this[_0x18d1('0x25')][_0x18d1('0x1c')],'userId':this[_0x18d1('0x12')]+':'+this[_0x18d1('0xb')]['id'][_0x18d1('0x26')]()};_0x121d28['postText'](_0x47653e,function(_0x25b841,_0x5d8461){if(_0x25b841){logger[_0x18d1('0x1f')](_0x18d1('0xd'),_0x30b446,_0x25b841[_0x18d1('0x25')]);_0x5773b8[_0x18d1('0xf')]();}else if(_0x5d8461&&_0x5d8461[_0x18d1('0x25')]){_0x555e7f[_0x18d1('0x1c')]['amazonlex']=_0x5d8461;_0x43c41a[_0x18d1('0x1c')]=_0x5d8461[_0x18d1('0x25')];_0x43c41a[_0x18d1('0x27')]=_0x18d1('0x28');_0x43c41a['providerResponse']=JSON['stringify'](_0x5d8461);return rpc[_0x4bb9f9+_0x18d1('0x1d')][_0x18d1('0x29')](_0x43c41a)[_0x18d1('0x2a')](function(_0x18119b){logger[_0x18d1('0xc')](_0x18d1('0xd'),_0x30b446,_0x43c41a[_0x18d1('0x1c')]);if(_0x5d8461[_0x18d1('0x2b')]==_0x18d1('0x2c')){_0x5773b8[_0x18d1('0xf')]();}else{_0x5773b8[_0x18d1('0x22')]();}})[_0x18d1('0x1e')](function(_0x57307c){logger[_0x18d1('0x1f')]('[%s][AMAZONLEX]\x20%s',_0x30b446,JSON[_0x18d1('0x2d')](_0x57307c));_0x5773b8[_0x18d1('0xf')]();});}else{_0x5773b8[_0x18d1('0xf')]();}});}}catch(_0x57b0fc){logger[_0x18d1('0x1f')](_0x18d1('0xd'),_0x30b446,JSON[_0x18d1('0x2d')](_0x57b0fc));_0x5773b8['stop']();}};}; \ No newline at end of file +var _0x3d5c=['Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','info','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','toString','amazonlex','Failed','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','[%s][AMAZONLEX]\x20%s'];(function(_0x51a226,_0x1fa11d){var _0x2718f1=function(_0x342fef){while(--_0x342fef){_0x51a226['push'](_0x51a226['shift']());}};_0x2718f1(++_0x1fa11d);}(_0x3d5c,0xb6));var _0xc3d5=function(_0xfbba38,_0x651026){_0xfbba38=_0xfbba38-0x0;var _0x716876=_0x3d5c[_0xfbba38];return _0x716876;};'use strict';var _=require('lodash');var moment=require('moment');var AWS=require(_0xc3d5('0x0'));var utils=require(_0xc3d5('0x1'));var logger=require(_0xc3d5('0x2'))(_0xc3d5('0x3'));var rpc={'chatMessage':require(_0xc3d5('0x4')),'openchannelMessage':require(_0xc3d5('0x5')),'mailMessage':require(_0xc3d5('0x6')),'smsMessage':require(_0xc3d5('0x7')),'faxMessage':require(_0xc3d5('0x8')),'whatsappMessage':require(_0xc3d5('0x9'))};exports[_0xc3d5('0xa')]=function(_0x237289,_0x481933){return function(_0x484c10){try{if(!_[_0xc3d5('0xb')](this[_0xc3d5('0xc')]['UserId'])){logger['info'](_0xc3d5('0xd'),_0x237289,_0xc3d5('0xe'));return _0x484c10[_0xc3d5('0xf')]();}var _0x359bad={'ContactId':this['contact']['id'],'sentAt':moment()[_0xc3d5('0x10')](_0xc3d5('0x11')),'direction':_0xc3d5('0x12')};if(this[_0xc3d5('0x13')]===_0xc3d5('0x14')||this[_0xc3d5('0x13')]===_0xc3d5('0x15')){_0x359bad[_0xc3d5('0x16')]=this[_0xc3d5('0xc')]['phone'];}var _0x77b65=this['channel'];if(_0x77b65===_0xc3d5('0x17')){_0x359bad[_0xc3d5('0x18')]=this[_0xc3d5('0x19')]['id'];}else{_0x359bad[_[_0xc3d5('0x1a')](_0x77b65)+_0xc3d5('0x1b')]=this[_0xc3d5('0x19')]['id'];}_0x359bad[_[_0xc3d5('0x1a')](_0x77b65)+_0xc3d5('0x1c')]=this[_0xc3d5('0xc')]['id'];if(this['interaction'][_0xc3d5('0x1d')]){var _0x1898d7=_0x481933[0x4];if(!_[_0xc3d5('0x1e')](_0x1898d7)){_0x359bad[_0xc3d5('0x1f')]=utils[_0xc3d5('0x20')](_0x1898d7,this);return rpc[_0x77b65+_0xc3d5('0x21')][_0xc3d5('0x22')](_0x359bad)[_0xc3d5('0x23')](function(_0x16f315){logger[_0xc3d5('0x24')](_0xc3d5('0xd'),_0x237289,_0x359bad[_0xc3d5('0x1f')]);})[_0xc3d5('0x25')](function(_0x4cb54d){logger[_0xc3d5('0x26')](_0xc3d5('0xd'),_0x237289,JSON[_0xc3d5('0x27')](_0x4cb54d));})[_0xc3d5('0x28')](function(){logger['info'](_0xc3d5('0x29'),_0x237289);_0x484c10[_0xc3d5('0x2a')]();});}else{logger['info'](_0xc3d5('0x2b'),_0x237289);_0x484c10[_0xc3d5('0x2a')]();}}else{var _0x3bfcef=this;var _0x123fd7=new AWS[(_0xc3d5('0x2c'))]({'accessKeyId':_0x481933[0x0],'secretAccessKey':_0x481933[0x1],'region':_0x481933[0x2]});var _0x3d37d0={'botAlias':'$LATEST','botName':_0x481933[0x3],'inputText':this[_0xc3d5('0x2d')][_0xc3d5('0x1f')],'userId':this[_0xc3d5('0x13')]+':'+this[_0xc3d5('0xc')]['id'][_0xc3d5('0x2e')]()};_0x123fd7['postText'](_0x3d37d0,function(_0x4c42cf,_0x3ce84f){if(_0x4c42cf){logger[_0xc3d5('0x26')](_0xc3d5('0xd'),_0x237289,_0x4c42cf[_0xc3d5('0x2d')]);_0x484c10[_0xc3d5('0xf')]();}else if(_0x3ce84f&&_0x3ce84f[_0xc3d5('0x2d')]){_0x3bfcef[_0xc3d5('0x1f')][_0xc3d5('0x2f')]=_0x3ce84f;_0x359bad['body']=_0x3ce84f[_0xc3d5('0x2d')];_0x359bad['providerName']=_0xc3d5('0x2f');_0x359bad['providerResponse']=JSON[_0xc3d5('0x27')](_0x3ce84f);return rpc[_0x77b65+_0xc3d5('0x21')][_0xc3d5('0x22')](_0x359bad)[_0xc3d5('0x23')](function(_0x4b2439){logger[_0xc3d5('0x24')](_0xc3d5('0xd'),_0x237289,_0x359bad['body']);if(_0x3ce84f['dialogState']==_0xc3d5('0x30')){_0x484c10[_0xc3d5('0xf')]();}else{_0x484c10[_0xc3d5('0x2a')]();}})[_0xc3d5('0x25')](function(_0x4428e3){logger[_0xc3d5('0x26')]('[%s][AMAZONLEX]\x20%s',_0x237289,JSON[_0xc3d5('0x27')](_0x4428e3));_0x484c10[_0xc3d5('0xf')]();});}else{_0x484c10['next']();}});}}catch(_0x120161){logger[_0xc3d5('0x26')](_0xc3d5('0xd'),_0x237289,JSON[_0xc3d5('0x27')](_0x120161));_0x484c10[_0xc3d5('0x2a')]();}};}; \ 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 f3ebd5b..9a921d3 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 _0xdeaa=['Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','Autoreply\x20already\x20sent','autoreplyExecuted','info','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','chat','ChatWebsiteId','account','upperFirst','InteractionId','Message','service','host','Smtp','port','authentication','user','inReplyTo','messageId','html','','','headers','auto-replied','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','finally','resolve','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','mail','body','[%s][AUTOREPLY]\x20%s'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xdeaa,0xc7));var _0xadea=function(_0x1eaa0c,_0x5be2db){_0x1eaa0c=_0x1eaa0c-0x0;var _0xa940b3=_0xdeaa[_0x1eaa0c];return _0xa940b3;};'use strict';var _=require('lodash');var moment=require(_0xadea('0x0'));var utils=require(_0xadea('0x1'));var logger=require(_0xadea('0x2'))(_0xadea('0x3'));var rpc={'chatMessage':require(_0xadea('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xadea('0x5')),'smsMessage':require(_0xadea('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xadea('0x7')),'chatInteraction':require(_0xadea('0x8')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0xadea('0x9')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0xadea('0xa')),'whatsappInteraction':require(_0xadea('0xb'))};var mailRpc=require(_0xadea('0xc'));exports[_0xadea('0xd')]=function(_0x4b2605,_0x12574e,_0x2c0b56,_0x1c6f1d){return function(_0x501bf6){try{var _0xbfe818=this['channel'];if(_0xbfe818===_0xadea('0xe')&&_0x1c6f1d[_0xadea('0xf')]['isAutoreply']){logger['info'](_0xadea('0x10'),_0x4b2605,_0xadea('0x11'));return _0x501bf6[_0xadea('0x12')]();}if(_0x12574e[0x0]==='1'&&(_[_0xadea('0x13')](this[_0xadea('0x14')]['created'])||!this[_0xadea('0x14')]['created'])){logger['info']('[%s][AUTOREPLY]\x20%s',_0x4b2605,_0xadea('0x15'));return _0x501bf6[_0xadea('0x12')]();}if(_0x12574e[0x0]==='2'&&this[_0xadea('0x14')][_0xadea('0x16')]){logger[_0xadea('0x17')](_0xadea('0x18'),_0x4b2605,_0xadea('0x19'));return _0x501bf6[_0xadea('0x12')]();}var _0x5c1873={'ContactId':this[_0xadea('0x1a')]['id'],'sentAt':moment()[_0xadea('0x1b')](_0xadea('0x1c')),'direction':'out'};if(this[_0xadea('0x1d')]==='mail'){_0x5c1873['body']=utils[_0xadea('0x1e')](_0x12574e[0x2],this);}else{_0x5c1873['body']=utils[_0xadea('0x1e')](_0x12574e[0x1],this);}if(this[_0xadea('0x1f')]){_0x5c1873['to']=this[_0xadea('0x1f')][_0xadea('0x20')]||'';if(this[_0xadea('0x1d')]===_0xadea('0xe')&&_0x12574e[0x1]==='1'){_0x5c1873['cc']=this[_0xadea('0x1f')]['cc']||'';}_0x5c1873[_0xadea('0x20')]=this[_0xadea('0x1f')]['to']||'';_0x5c1873[_0xadea('0x21')]=this['message']['phone']||'';_0x5c1873[_0xadea('0x22')]=!![];if(this[_0xadea('0x1f')][_0xadea('0x23')]){_0x5c1873[_0xadea('0x23')]='';_0x5c1873[_0xadea('0x23')]+=_[_0xadea('0x24')](this[_0xadea('0x1f')][_0xadea('0x23')],_0xadea('0x25'))?'':'Re:\x20';_0x5c1873[_0xadea('0x23')]+=this['message'][_0xadea('0x23')];}}if(this[_0xadea('0x1d')]===_0xadea('0x26')){_0x5c1873[_0xadea('0x27')]=this[_0xadea('0x28')]['id'];}else{_0x5c1873[_[_0xadea('0x29')](this[_0xadea('0x1d')])+'AccountId']=this[_0xadea('0x28')]['id'];}_0x5c1873[_['upperFirst'](this['channel'])+_0xadea('0x2a')]=this[_0xadea('0x14')]['id'];var _0x41e7c9=this[_0xadea('0x14')];if(rpc[this[_0xadea('0x1d')]+_0xadea('0x2b')]){if(this['channel']==='mail'){var _0x2699bd={'tls':{'rejectUnauthorized':![]}};if(this['account']['Smtp'][_0xadea('0x2c')]){_0x2699bd[_0xadea('0x2c')]=this[_0xadea('0x28')]['Smtp'][_0xadea('0x2c')];}else{_0x2699bd[_0xadea('0x2d')]=this[_0xadea('0x28')][_0xadea('0x2e')]['host'];_0x2699bd[_0xadea('0x2f')]=this[_0xadea('0x28')][_0xadea('0x2e')]['port'];_0x2699bd['secure']=this[_0xadea('0x28')][_0xadea('0x2e')]['secure'];}if(this[_0xadea('0x28')][_0xadea('0x2e')][_0xadea('0x30')]){_0x2699bd['auth']={'user':this[_0xadea('0x28')][_0xadea('0x2e')][_0xadea('0x31')],'pass':this[_0xadea('0x28')][_0xadea('0x2e')]['pass']};}_0x5c1873[_0xadea('0x32')]=this[_0xadea('0x1f')][_0xadea('0x33')];_0x5c1873[_0xadea('0x34')]=_0xadea('0x35')+_['replace'](_0x5c1873[_0xadea('0xf')],'','replace','headers','auto-replied','All','auto_reply','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','Interaction','error','stop','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','mail','body','isAutoreply','next','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','getMustacheRender','message','from','phone','subject','startsWith','Re:','Re:\x20','account','Message','Smtp','host','port','secure','auth','user','pass','inReplyTo','messageId'];(function(_0x357fa1,_0xfa5d1f){var _0x59b9b7=function(_0x40de86){while(--_0x40de86){_0x357fa1['push'](_0x357fa1['shift']());}};_0x59b9b7(++_0xfa5d1f);}(_0x6072,0x1b1));var _0x2607=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6072[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x2607('0x0'));var moment=require(_0x2607('0x1'));var utils=require('./utils');var logger=require(_0x2607('0x2'))(_0x2607('0x3'));var rpc={'chatMessage':require(_0x2607('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x2607('0x5')),'smsMessage':require(_0x2607('0x6')),'faxMessage':require(_0x2607('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x2607('0x8')),'openchannelInteraction':require(_0x2607('0x9')),'mailInteraction':require(_0x2607('0xa')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0x2607('0xb')),'whatsappInteraction':require(_0x2607('0xc'))};var mailRpc=require(_0x2607('0xd'));exports[_0x2607('0xe')]=function(_0x3551b4,_0x49815d,_0x57b51c,_0x571d90){return function(_0x558d65){try{var _0x333fe2=this['channel'];if(_0x333fe2===_0x2607('0xf')&&_0x571d90[_0x2607('0x10')][_0x2607('0x11')]){logger['info']('[%s][AUTOREPLY]\x20%s',_0x3551b4,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x558d65[_0x2607('0x12')]();}if(_0x49815d[0x0]==='1'&&(_[_0x2607('0x13')](this[_0x2607('0x14')][_0x2607('0x15')])||!this[_0x2607('0x14')][_0x2607('0x15')])){logger[_0x2607('0x16')](_0x2607('0x17'),_0x3551b4,_0x2607('0x18'));return _0x558d65['next']();}if(_0x49815d[0x0]==='2'&&this['interaction'][_0x2607('0x19')]){logger[_0x2607('0x16')](_0x2607('0x1a'),_0x3551b4,'One\x20Time\x20already\x20sent');return _0x558d65[_0x2607('0x12')]();}var _0x1a8206={'ContactId':this[_0x2607('0x1b')]['id'],'sentAt':moment()['format'](_0x2607('0x1c')),'direction':_0x2607('0x1d')};if(this[_0x2607('0x1e')]===_0x2607('0xf')){_0x1a8206['body']=utils[_0x2607('0x1f')](_0x49815d[0x2],this);}else{_0x1a8206[_0x2607('0x10')]=utils[_0x2607('0x1f')](_0x49815d[0x1],this);}if(this['message']){_0x1a8206['to']=this[_0x2607('0x20')][_0x2607('0x21')]||'';if(this[_0x2607('0x1e')]===_0x2607('0xf')&&_0x49815d[0x1]==='1'){_0x1a8206['cc']=this[_0x2607('0x20')]['cc']||'';}_0x1a8206[_0x2607('0x21')]=this[_0x2607('0x20')]['to']||'';_0x1a8206[_0x2607('0x22')]=this[_0x2607('0x20')]['phone']||'';_0x1a8206['read']=!![];if(this[_0x2607('0x20')][_0x2607('0x23')]){_0x1a8206[_0x2607('0x23')]='';_0x1a8206[_0x2607('0x23')]+=_[_0x2607('0x24')](this[_0x2607('0x20')][_0x2607('0x23')],_0x2607('0x25'))?'':_0x2607('0x26');_0x1a8206[_0x2607('0x23')]+=this['message']['subject'];}}if(this[_0x2607('0x1e')]==='chat'){_0x1a8206['ChatWebsiteId']=this[_0x2607('0x27')]['id'];}else{_0x1a8206[_['upperFirst'](this[_0x2607('0x1e')])+'AccountId']=this['account']['id'];}_0x1a8206[_['upperFirst'](this[_0x2607('0x1e')])+'InteractionId']=this[_0x2607('0x14')]['id'];var _0x1b30b3=this[_0x2607('0x14')];if(rpc[this[_0x2607('0x1e')]+_0x2607('0x28')]){if(this[_0x2607('0x1e')]===_0x2607('0xf')){var _0x5dec9e={'tls':{'rejectUnauthorized':![]}};if(this[_0x2607('0x27')][_0x2607('0x29')]['service']){_0x5dec9e['service']=this[_0x2607('0x27')][_0x2607('0x29')]['service'];}else{_0x5dec9e['host']=this[_0x2607('0x27')][_0x2607('0x29')][_0x2607('0x2a')];_0x5dec9e[_0x2607('0x2b')]=this[_0x2607('0x27')][_0x2607('0x29')][_0x2607('0x2b')];_0x5dec9e[_0x2607('0x2c')]=this[_0x2607('0x27')][_0x2607('0x29')]['secure'];}if(this['account']['Smtp']['authentication']){_0x5dec9e[_0x2607('0x2d')]={'user':this[_0x2607('0x27')][_0x2607('0x29')][_0x2607('0x2e')],'pass':this[_0x2607('0x27')][_0x2607('0x29')][_0x2607('0x2f')]};}_0x1a8206[_0x2607('0x30')]=this[_0x2607('0x20')][_0x2607('0x31')];_0x1a8206['html']=_0x2607('0x32')+_[_0x2607('0x33')](_0x1a8206[_0x2607('0x10')],'';_0x1a8206[_0x2607('0x34')]={'Auto-Submitted':_0x2607('0x35'),'X-Auto-Response-Suppress':_0x2607('0x36'),'Precedence':_0x2607('0x37')};return mailRpc['sendMailMessage'](_0x5dec9e,_0x1a8206)[_0x2607('0x38')](function(_0x3e0f0c){logger['info'](_0x2607('0x39'),_0x3551b4);_0x1a8206['messageId']=_0x3e0f0c[_0x2607('0x20')]['messageId'];return rpc[_0x333fe2+'Message']['create'](_0x1a8206);})[_0x2607('0x38')](function(_0x415227){logger[_0x2607('0x16')](_0x2607('0x17'),_0x3551b4,JSON[_0x2607('0x3a')](_0x415227));})[_0x2607('0x3b')](function(_0x1fdd0c){logger['error'](_0x2607('0x3c'),_0x3551b4,JSON[_0x2607('0x3a')](_0x1fdd0c));})[_0x2607('0x3d')](function(){Promise[_0x2607('0x3e')]()[_0x2607('0x38')](function(){if(_0x49815d[0x0]!=='2'||_0x1b30b3[_0x2607('0x19')])return;return rpc[_0x333fe2+'Interaction'][_0x2607('0x3f')](_0x1b30b3['id'],{'autoreplyExecuted':!![]})['then'](function(_0x428ff8){logger['info'](_0x2607('0x1a'),_0x3551b4,JSON[_0x2607('0x3a')](_0x428ff8));})['catch'](function(_0x376ffa){logger['error'](_0x2607('0x40'),_0x3551b4,JSON[_0x2607('0x3a')](_0x376ffa));});})['then'](function(){_0x558d65[_0x2607('0x12')]();});});}else{return rpc[this[_0x2607('0x1e')]+_0x2607('0x28')][_0x2607('0x41')](_0x1a8206)['then'](function(_0x3c2536){logger['info']('[%s][AUTOREPLY]\x20%s',_0x3551b4,_0x1a8206['body']);})[_0x2607('0x3b')](function(_0x32586d){logger['error'](_0x2607('0x17'),_0x3551b4,JSON[_0x2607('0x3a')](_0x32586d));})['finally'](function(){Promise[_0x2607('0x3e')]()['then'](function(){if(_0x49815d[0x0]!=='2'||_0x1b30b3[_0x2607('0x19')])return;return rpc[_0x333fe2+_0x2607('0x42')][_0x2607('0x3f')](_0x1b30b3['id'],{'autoreplyExecuted':!![]})[_0x2607('0x38')](function(_0x1a8c86){logger[_0x2607('0x16')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3551b4,JSON['stringify'](_0x1a8c86));})['catch'](function(_0x3e8c31){logger[_0x2607('0x43')](_0x2607('0x40'),_0x3551b4,JSON[_0x2607('0x3a')](_0x3e8c31));});})[_0x2607('0x38')](function(){_0x558d65[_0x2607('0x12')]();});});}}}catch(_0x1de133){logger['error'](_0x2607('0x17'),_0x3551b4,JSON[_0x2607('0x3a')](_0x1de133));_0x558d65[_0x2607('0x44')]();}};}; \ 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 7381960..aef6aca 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 _0xb6ac=['stringify','finally','[%s][CLOSE]\x20%s','stop','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','error'];(function(_0x4b82bd,_0x365f3b){var _0x11d9f2=function(_0xce0382){while(--_0xce0382){_0x4b82bd['push'](_0x4b82bd['shift']());}};_0x11d9f2(++_0x365f3b);}(_0xb6ac,0x1bc));var _0xcb6a=function(_0x57e3b9,_0x2900e3){_0x57e3b9=_0x57e3b9-0x0;var _0x3854ba=_0xb6ac[_0x57e3b9];return _0x3854ba;};'use strict';var moment=require('moment');var logger=require(_0xcb6a('0x0'))(_0xcb6a('0x1'));var rpc={'chatInteraction':require(_0xcb6a('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xcb6a('0x3')),'mailInteraction':require(_0xcb6a('0x4')),'faxInteraction':require(_0xcb6a('0x5')),'whatsappInteraction':require(_0xcb6a('0x6'))};exports[_0xcb6a('0x7')]=function(_0x339bbb,_0x2e5477,_0x224b19,_0x4cfbbd){return function(_0x15c528){try{logger[_0xcb6a('0x8')]('[%s][CLOSE]\x20reason\x20%s',_0x339bbb,_0x2e5477[0x0]);var _0x416b8d={'closed':0x1,'closedAt':moment()[_0xcb6a('0x9')](_0xcb6a('0xa')),'closeReason':_0xcb6a('0xb'),'disposition':_0x2e5477[0x0]};if(rpc[_0x4cfbbd[_0xcb6a('0xc')]+_0xcb6a('0xd')]){rpc[_0x4cfbbd[_0xcb6a('0xc')]+'Interaction'][_0xcb6a('0xe')](_0x4cfbbd[_0xcb6a('0xf')]['id'],_0x416b8d)[_0xcb6a('0x10')](function(_0x506f2f){logger['info']('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x339bbb,_0x4cfbbd[_0xcb6a('0xf')]['id']);})['catch'](function(_0x40335c){logger[_0xcb6a('0x11')]('[%s][CLOSE]\x20%s',_0x339bbb,JSON[_0xcb6a('0x12')](_0x40335c));})[_0xcb6a('0x13')](function(){_0x15c528['stop']();});}}catch(_0x2c8594){logger['error'](_0xcb6a('0x14'),_0x339bbb,JSON['stringify'](_0x2c8594));_0x15c528[_0xcb6a('0x15')]();}};}; \ No newline at end of file +var _0xda36=['[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','channel','update','interaction','then'];(function(_0x3b5e9d,_0x5970dc){var _0x44681d=function(_0x306697){while(--_0x306697){_0x3b5e9d['push'](_0x3b5e9d['shift']());}};_0x44681d(++_0x5970dc);}(_0xda36,0x101));var _0x6da3=function(_0x5c0b0c,_0x5f454b){_0x5c0b0c=_0x5c0b0c-0x0;var _0x57581a=_0xda36[_0x5c0b0c];return _0x57581a;};'use strict';var moment=require('moment');var logger=require(_0x6da3('0x0'))(_0x6da3('0x1'));var rpc={'chatInteraction':require(_0x6da3('0x2')),'openchannelInteraction':require(_0x6da3('0x3')),'smsInteraction':require(_0x6da3('0x4')),'mailInteraction':require(_0x6da3('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x6da3('0x6'))};exports[_0x6da3('0x7')]=function(_0x32a738,_0x1cc5cd,_0x4dbe7c,_0x32289f){return function(_0x7d7bd3){try{logger[_0x6da3('0x8')](_0x6da3('0x9'),_0x32a738,_0x1cc5cd[0x0]);var _0x3625f1={'closed':0x1,'closedAt':moment()[_0x6da3('0xa')](_0x6da3('0xb')),'closeReason':_0x6da3('0xc'),'disposition':_0x1cc5cd[0x0]};if(rpc[_0x32289f['channel']+_0x6da3('0xd')]){rpc[_0x32289f[_0x6da3('0xe')]+_0x6da3('0xd')][_0x6da3('0xf')](_0x32289f[_0x6da3('0x10')]['id'],_0x3625f1)[_0x6da3('0x11')](function(_0x5be01d){logger[_0x6da3('0x8')](_0x6da3('0x12'),_0x32a738,_0x32289f[_0x6da3('0x10')]['id']);})[_0x6da3('0x13')](function(_0x18625b){logger[_0x6da3('0x14')](_0x6da3('0x15'),_0x32a738,JSON[_0x6da3('0x16')](_0x18625b));})[_0x6da3('0x17')](function(){_0x7d7bd3[_0x6da3('0x18')]();});}}catch(_0x3bf2ea){logger[_0x6da3('0x14')](_0x6da3('0x15'),_0x32a738,JSON['stringify'](_0x3bf2ea));_0x7d7bd3[_0x6da3('0x18')]();}};}; \ 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 bf9b9eb..c71c684 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 _0xdbf5=['../../rpc/whatsappMessage','consequence','interaction','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','out','channel','phone','account','upperFirst','InteractionId','created','getMustacheRender','Message','create','then','error','stringify','finally','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','body','dialogflow','result','fulfillment','speech','providerName','providerResponse','metadata','endConversation','catch','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xdbf5,0x18c));var _0x5dbf=function(_0xa5c800,_0x9a674b){_0xa5c800=_0xa5c800-0x0;var _0x365476=_0xdbf5[_0xa5c800];return _0x365476;};'use strict';var _=require('lodash');var moment=require(_0x5dbf('0x0'));var apiai=require('apiai-promise');var md5=require('md5');var utils=require(_0x5dbf('0x1'));var logger=require(_0x5dbf('0x2'))(_0x5dbf('0x3'));var rpc={'chatMessage':require(_0x5dbf('0x4')),'openchannelMessage':require(_0x5dbf('0x5')),'mailMessage':require(_0x5dbf('0x6')),'smsMessage':require(_0x5dbf('0x7')),'faxMessage':require(_0x5dbf('0x8')),'whatsappMessage':require(_0x5dbf('0x9'))};exports[_0x5dbf('0xa')]=function(_0x209b7d,_0x88128e){return function(_0x93e657){try{if(!_['isNil'](this[_0x5dbf('0xb')]['UserId'])){logger[_0x5dbf('0xc')](_0x5dbf('0xd'),_0x209b7d,_0x5dbf('0xe'));return _0x93e657[_0x5dbf('0xf')]();}var _0x4efed3={'ContactId':this[_0x5dbf('0x10')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x5dbf('0x11')};if(this['channel']==='sms'||this[_0x5dbf('0x12')]==='whatsapp'){_0x4efed3[_0x5dbf('0x13')]=this[_0x5dbf('0xb')][_0x5dbf('0x13')];}var _0x7cb848=this[_0x5dbf('0x12')];if(_0x7cb848==='chat'){_0x4efed3['ChatWebsiteId']=this[_0x5dbf('0x14')]['id'];}else{_0x4efed3[_[_0x5dbf('0x15')](_0x7cb848)+'AccountId']=this[_0x5dbf('0x14')]['id'];}_0x4efed3[_[_0x5dbf('0x15')](_0x7cb848)+_0x5dbf('0x16')]=this[_0x5dbf('0xb')]['id'];if(this[_0x5dbf('0xb')][_0x5dbf('0x17')]){var _0x2d32cc=_0x88128e[0x2];if(!_['isEmpty'](_0x2d32cc)){_0x4efed3['body']=utils[_0x5dbf('0x18')](_0x2d32cc,this);return rpc[_0x7cb848+_0x5dbf('0x19')][_0x5dbf('0x1a')](_0x4efed3)[_0x5dbf('0x1b')](function(_0x20c2b0){logger['info'](_0x5dbf('0xd'),_0x209b7d,_0x4efed3['body']);})['catch'](function(_0x577ca2){logger[_0x5dbf('0x1c')](_0x5dbf('0xd'),_0x209b7d,JSON[_0x5dbf('0x1d')](_0x577ca2));})[_0x5dbf('0x1e')](function(){logger[_0x5dbf('0xc')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x209b7d);_0x93e657[_0x5dbf('0x1f')]();});}else{logger['info'](_0x5dbf('0x20'),_0x209b7d);_0x93e657[_0x5dbf('0x1f')]();}}else{var _0x14d133=this;var _0x43a612=apiai(_0x88128e[0x0],{'language':_0x88128e[0x1]||'en'});return _0x43a612[_0x5dbf('0x21')](this[_0x5dbf('0x22')]['body'],{'sessionId':md5(this[_0x5dbf('0xb')]['id'])})[_0x5dbf('0x1b')](function(_0x2d3e1b){_0x14d133[_0x5dbf('0x23')][_0x5dbf('0x24')]=_0x2d3e1b;_0x4efed3[_0x5dbf('0x23')]=_0x2d3e1b[_0x5dbf('0x25')][_0x5dbf('0x26')][_0x5dbf('0x27')];_0x4efed3[_0x5dbf('0x28')]=_0x5dbf('0x24');_0x4efed3[_0x5dbf('0x29')]=JSON[_0x5dbf('0x1d')](_0x2d3e1b);return rpc[_0x7cb848+_0x5dbf('0x19')][_0x5dbf('0x1a')](_0x4efed3)[_0x5dbf('0x1b')](function(_0x466985){logger[_0x5dbf('0xc')](_0x5dbf('0xd'),_0x209b7d,_0x4efed3[_0x5dbf('0x23')]);if(_0x2d3e1b[_0x5dbf('0x25')][_0x5dbf('0x2a')][_0x5dbf('0x2b')]){_0x93e657['next']();}else{_0x93e657[_0x5dbf('0x1f')]();}})[_0x5dbf('0x2c')](function(_0xc4748){logger[_0x5dbf('0x1c')](_0x5dbf('0xd'),_0x209b7d,JSON[_0x5dbf('0x1d')](_0xc4748));_0x93e657[_0x5dbf('0xf')]();});})[_0x5dbf('0x2c')](function(_0x406ce6){logger[_0x5dbf('0x1c')](_0x5dbf('0xd'),_0x209b7d,_0x406ce6['message']);_0x93e657['next']();});}}catch(_0xf429ae){logger[_0x5dbf('0x1c')](_0x5dbf('0xd'),_0x209b7d,JSON[_0x5dbf('0x1d')](_0xf429ae));_0x93e657[_0x5dbf('0x1f')]();}};}; \ No newline at end of file +var _0xf1c6=['routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','body','Message','create','info','[%s][DIALOGFLOW]\x20%s','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','then','dialogflow','fulfillment','speech','providerName','providerResponse','metadata','endConversation','catch','stringify','stop','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger'];(function(_0x13ce61,_0x23f0bd){var _0x404ae8=function(_0x362d11){while(--_0x362d11){_0x13ce61['push'](_0x13ce61['shift']());}};_0x404ae8(++_0x23f0bd);}(_0xf1c6,0xf4));var _0x6f1c=function(_0x562996,_0x20fd20){_0x562996=_0x562996-0x0;var _0x3b303f=_0xf1c6[_0x562996];return _0x3b303f;};'use strict';var _=require(_0x6f1c('0x0'));var moment=require(_0x6f1c('0x1'));var apiai=require(_0x6f1c('0x2'));var md5=require(_0x6f1c('0x3'));var utils=require(_0x6f1c('0x4'));var logger=require(_0x6f1c('0x5'))(_0x6f1c('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x6f1c('0x7')),'mailMessage':require(_0x6f1c('0x8')),'smsMessage':require(_0x6f1c('0x9')),'faxMessage':require(_0x6f1c('0xa')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x1a3460,_0x2d0f02){return function(_0x3f7b30){try{if(!_[_0x6f1c('0xb')](this[_0x6f1c('0xc')][_0x6f1c('0xd')])){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x1a3460,_0x6f1c('0xe'));return _0x3f7b30[_0x6f1c('0xf')]();}var _0xed1cca={'ContactId':this[_0x6f1c('0x10')]['id'],'sentAt':moment()[_0x6f1c('0x11')](_0x6f1c('0x12')),'direction':'out'};if(this[_0x6f1c('0x13')]===_0x6f1c('0x14')||this['channel']===_0x6f1c('0x15')){_0xed1cca['phone']=this['interaction'][_0x6f1c('0x16')];}var _0x2d5956=this['channel'];if(_0x2d5956==='chat'){_0xed1cca[_0x6f1c('0x17')]=this['account']['id'];}else{_0xed1cca[_[_0x6f1c('0x18')](_0x2d5956)+_0x6f1c('0x19')]=this[_0x6f1c('0x1a')]['id'];}_0xed1cca[_[_0x6f1c('0x18')](_0x2d5956)+_0x6f1c('0x1b')]=this[_0x6f1c('0xc')]['id'];if(this[_0x6f1c('0xc')]['created']){var _0x2ca612=_0x2d0f02[0x2];if(!_['isEmpty'](_0x2ca612)){_0xed1cca[_0x6f1c('0x1c')]=utils['getMustacheRender'](_0x2ca612,this);return rpc[_0x2d5956+_0x6f1c('0x1d')][_0x6f1c('0x1e')](_0xed1cca)['then'](function(_0x5475d6){logger[_0x6f1c('0x1f')](_0x6f1c('0x20'),_0x1a3460,_0xed1cca[_0x6f1c('0x1c')]);})['catch'](function(_0x202aa9){logger[_0x6f1c('0x21')](_0x6f1c('0x20'),_0x1a3460,JSON['stringify'](_0x202aa9));})[_0x6f1c('0x22')](function(){logger[_0x6f1c('0x1f')](_0x6f1c('0x23'),_0x1a3460);_0x3f7b30['stop']();});}else{logger[_0x6f1c('0x1f')](_0x6f1c('0x24'),_0x1a3460);_0x3f7b30['stop']();}}else{var _0x20fd66=this;var _0x1f7ac2=apiai(_0x2d0f02[0x0],{'language':_0x2d0f02[0x1]||'en'});return _0x1f7ac2[_0x6f1c('0x25')](this[_0x6f1c('0x26')]['body'],{'sessionId':md5(this[_0x6f1c('0xc')]['id'])})[_0x6f1c('0x27')](function(_0x235773){_0x20fd66[_0x6f1c('0x1c')][_0x6f1c('0x28')]=_0x235773;_0xed1cca[_0x6f1c('0x1c')]=_0x235773['result'][_0x6f1c('0x29')][_0x6f1c('0x2a')];_0xed1cca[_0x6f1c('0x2b')]=_0x6f1c('0x28');_0xed1cca[_0x6f1c('0x2c')]=JSON['stringify'](_0x235773);return rpc[_0x2d5956+_0x6f1c('0x1d')][_0x6f1c('0x1e')](_0xed1cca)[_0x6f1c('0x27')](function(_0x1faa4a){logger[_0x6f1c('0x1f')](_0x6f1c('0x20'),_0x1a3460,_0xed1cca['body']);if(_0x235773['result'][_0x6f1c('0x2d')][_0x6f1c('0x2e')]){_0x3f7b30[_0x6f1c('0xf')]();}else{_0x3f7b30['stop']();}})[_0x6f1c('0x2f')](function(_0x1e861c){logger[_0x6f1c('0x21')](_0x6f1c('0x20'),_0x1a3460,JSON['stringify'](_0x1e861c));_0x3f7b30[_0x6f1c('0xf')]();});})[_0x6f1c('0x2f')](function(_0x5c09ba){logger[_0x6f1c('0x21')](_0x6f1c('0x20'),_0x1a3460,_0x5c09ba[_0x6f1c('0x26')]);_0x3f7b30['next']();});}}catch(_0x477e37){logger['error'](_0x6f1c('0x20'),_0x1a3460,JSON[_0x6f1c('0x30')](_0x477e37));_0x3f7b30[_0x6f1c('0x31')]();}};}; \ 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 ee07898..cd3a023 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 _0xdc97=['InteractionId','isEmpty','error','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','intent','name','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','providerName','dialogflowV2','providerResponse','stringify','length','push','fulfillmentText','stop','lodash','dialogflow','md5','bluebird','routing','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','clone','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','body','catch','consequence','isNil','interaction','UserId','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','chat','ChatWebsiteId','account','upperFirst','AccountId'];(function(_0x25779d,_0x139f33){var _0x1d42e6=function(_0x481279){while(--_0x481279){_0x25779d['push'](_0x25779d['shift']());}};_0x1d42e6(++_0x139f33);}(_0xdc97,0x13b));var _0x7dc9=function(_0x13ec12,_0x24b3e4){_0x13ec12=_0x13ec12-0x0;var _0x33d679=_0xdc97[_0x13ec12];return _0x33d679;};'use strict';var _=require(_0x7dc9('0x0'));var dialogflow=require(_0x7dc9('0x1'));var md5=require(_0x7dc9('0x2'));var moment=require('moment');var Promise=require(_0x7dc9('0x3'));var logger=require('../../../../config/logger')(_0x7dc9('0x4'));var utils=require(_0x7dc9('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x7dc9('0x6')),'mailMessage':require(_0x7dc9('0x7')),'smsMessage':require(_0x7dc9('0x8')),'faxMessage':require(_0x7dc9('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x2636ef,_0x4f91c7,_0x4b3229,_0x2ff923){return new Promise(function(_0x23737d,_0x3318ea){var _0x42ec7c=_[_0x7dc9('0xa')](_0x4b3229);_0x42ec7c['body']=_0x2ff923;return rpc[_0x4f91c7+_0x7dc9('0xb')][_0x7dc9('0xc')](_0x42ec7c)[_0x7dc9('0xd')](function(){logger[_0x7dc9('0xe')](_0x7dc9('0xf'),_0x2636ef,_0x42ec7c[_0x7dc9('0x10')]);_0x23737d();})[_0x7dc9('0x11')](function(_0x4e8e65){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x2636ef,JSON['stringify'](_0x4e8e65));_0x3318ea(_0x4e8e65);});});}exports[_0x7dc9('0x12')]=function(_0x14e5db,_0x5c6ca5){return function(_0xbd06be){try{if(!_[_0x7dc9('0x13')](this[_0x7dc9('0x14')][_0x7dc9('0x15')])){logger[_0x7dc9('0xe')](_0x7dc9('0xf'),_0x14e5db,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0xbd06be[_0x7dc9('0x16')]();}var _0x278191={'ContactId':this[_0x7dc9('0x17')]['id'],'sentAt':moment()[_0x7dc9('0x18')](_0x7dc9('0x19')),'direction':_0x7dc9('0x1a')};if(this[_0x7dc9('0x1b')]===_0x7dc9('0x1c')||this[_0x7dc9('0x1b')]==='whatsapp'){_0x278191[_0x7dc9('0x1d')]=this['interaction'][_0x7dc9('0x1d')];}var _0x1cc237=this['channel'];if(_0x1cc237===_0x7dc9('0x1e')){_0x278191[_0x7dc9('0x1f')]=this[_0x7dc9('0x20')]['id'];}else{_0x278191[_[_0x7dc9('0x21')](_0x1cc237)+_0x7dc9('0x22')]=this[_0x7dc9('0x20')]['id'];}_0x278191[_[_0x7dc9('0x21')](_0x1cc237)+_0x7dc9('0x23')]=this[_0x7dc9('0x14')]['id'];if(this[_0x7dc9('0x14')]['created']){var _0x593e60=_0x5c6ca5[0x4];if(!_[_0x7dc9('0x24')](_0x593e60)){_0x278191[_0x7dc9('0x10')]=utils['getMustacheRender'](_0x593e60,this);return rpc[_0x1cc237+_0x7dc9('0xb')][_0x7dc9('0xc')](_0x278191)['then'](function(_0xffc080){logger[_0x7dc9('0xe')](_0x7dc9('0xf'),_0x14e5db,_0x278191['body']);})[_0x7dc9('0x11')](function(_0x1e3a8d){logger[_0x7dc9('0x25')]('[%s][DIALOGFLOWV2]\x20%s',_0x14e5db,JSON['stringify'](_0x1e3a8d));})['finally'](function(){logger[_0x7dc9('0xe')](_0x7dc9('0x26'),_0x14e5db);_0xbd06be['stop']();});}else{logger['info'](_0x7dc9('0x27'),_0x14e5db);_0xbd06be['stop']();}}else{var _0x2d22eb=this;var _0x1c690b=_0x5c6ca5[0x2][_0x7dc9('0x28')](/\\n/g,'\x0a');var _0x3e4102={'credentials':{'private_key':_0x1c690b,'client_email':_0x5c6ca5[0x1]}};var _0xa2aaa9=new dialogflow[(_0x7dc9('0x29'))](_0x3e4102);var _0x236d42=_0xa2aaa9[_0x7dc9('0x2a')](_0x5c6ca5[0x0],md5(_0x2d22eb[_0x7dc9('0x14')]['id']));var _0x3c4379={'session':_0x236d42,'queryInput':{'text':{'text':_0x2d22eb[_0x7dc9('0x2b')][_0x7dc9('0x10')],'languageCode':_0x5c6ca5[0x3]||'en'}}};return _0xa2aaa9['detectIntent'](_0x3c4379)['then'](function(_0x513dd6){if(_0x513dd6&&_0x513dd6['length']){_0x2d22eb['body']['dialogflowV2']=_0x513dd6;var _0x58c4e8=_0x513dd6[0x0];var _0x59f5d8=_0x58c4e8[_0x7dc9('0x2c')][_0x7dc9('0x2d')]&&_0x58c4e8[_0x7dc9('0x2c')][_0x7dc9('0x2d')][_0x7dc9('0x2e')]?_0x58c4e8[_0x7dc9('0x2c')]['diagnosticInfo']['fields']['end_conversation'][_0x7dc9('0x2f')]:![];_0x2d22eb['body'][_0x7dc9('0x30')]=_0x58c4e8[_0x7dc9('0x2c')][_0x7dc9('0x31')];_0x2d22eb[_0x7dc9('0x10')][_0x7dc9('0x32')]=_0x58c4e8[_0x7dc9('0x2c')][_0x7dc9('0x33')];_0x2d22eb[_0x7dc9('0x10')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x58c4e8[_0x7dc9('0x2c')]['diagnosticInfo']&&_0x58c4e8[_0x7dc9('0x2c')][_0x7dc9('0x2d')][_0x7dc9('0x2e')]?_0x58c4e8[_0x7dc9('0x2c')]['diagnosticInfo'][_0x7dc9('0x2e')]['end_conversation'][_0x7dc9('0x2f')]:![];_0x2d22eb['body']['DIALOGFLOWV2_INTENTNAME']=_0x58c4e8[_0x7dc9('0x2c')][_0x7dc9('0x34')][_0x7dc9('0x35')];_0x2d22eb[_0x7dc9('0x10')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x58c4e8[_0x7dc9('0x2c')][_0x7dc9('0x34')][_0x7dc9('0x36')];_0x2d22eb[_0x7dc9('0x10')][_0x7dc9('0x37')]=_0x58c4e8[_0x7dc9('0x2c')][_0x7dc9('0x34')][_0x7dc9('0x38')];_0x2d22eb[_0x7dc9('0x10')][_0x7dc9('0x39')]=_0x58c4e8[_0x7dc9('0x2c')][_0x7dc9('0x3a')];_0x2d22eb['body'][_0x7dc9('0x3b')]=_0x58c4e8[_0x7dc9('0x2c')][_0x7dc9('0x3c')];_0x2d22eb[_0x7dc9('0x10')]['DIALOGFLOWV2_SCORE']=_0x58c4e8[_0x7dc9('0x2c')][_0x7dc9('0x3d')];_0x278191[_0x7dc9('0x3e')]=_0x7dc9('0x3f');_0x278191[_0x7dc9('0x40')]=JSON[_0x7dc9('0x41')](_0x513dd6);var _0x5a1201=[];for(var _0x553230=0x0;_0x553230<_0x513dd6[_0x7dc9('0x42')];_0x553230++){var _0x36a965=_0x513dd6[_0x553230];if(_0x36a965&&_0x36a965['queryResult']&&_0x36a965[_0x7dc9('0x2c')]['fulfillmentText']){_0x5a1201[_0x7dc9('0x43')](createMessage(_0x14e5db,_0x1cc237,_0x278191,_0x36a965[_0x7dc9('0x2c')][_0x7dc9('0x44')]));}}return Promise['all'](_0x5a1201)[_0x7dc9('0xd')](function(){if(_0x59f5d8){_0xbd06be[_0x7dc9('0x16')]();}else{_0xbd06be[_0x7dc9('0x45')]();}})[_0x7dc9('0x11')](function(_0x28ffc0){logger[_0x7dc9('0x25')](_0x7dc9('0xf'),_0x14e5db,JSON['stringify'](_0x28ffc0));_0xbd06be[_0x7dc9('0x16')]();});}})['catch'](function(_0x52d883){logger[_0x7dc9('0x25')](_0x7dc9('0xf'),_0x14e5db,_0x52d883[_0x7dc9('0x2b')]);_0xbd06be[_0x7dc9('0x16')]();});}}catch(_0xa39a03){logger[_0x7dc9('0x25')](_0x7dc9('0xf'),_0x14e5db,JSON[_0x7dc9('0x41')](_0xa39a03));_0xbd06be[_0x7dc9('0x45')]();}};}; \ No newline at end of file +var _0x2cf6=['account','upperFirst','AccountId','InteractionId','created','create','catch','error','stringify','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','SessionsClient','message','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','length','fulfillmentText','push','all','stop','next','lodash','dialogflow','md5','moment','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/whatsappMessage','clone','body','Message','then','info','[%s][DIALOGFLOWV2]\x20%s','consequence','isNil','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','interaction','phone','chat','ChatWebsiteId'];(function(_0xb135a7,_0x10a6bf){var _0x6d364a=function(_0x4d44e7){while(--_0x4d44e7){_0xb135a7['push'](_0xb135a7['shift']());}};_0x6d364a(++_0x10a6bf);}(_0x2cf6,0x177));var _0x62cf=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x2cf6[_0x25bea7];return _0x175952;};'use strict';var _=require(_0x62cf('0x0'));var dialogflow=require(_0x62cf('0x1'));var md5=require(_0x62cf('0x2'));var moment=require(_0x62cf('0x3'));var Promise=require('bluebird');var logger=require(_0x62cf('0x4'))(_0x62cf('0x5'));var utils=require(_0x62cf('0x6'));var rpc={'chatMessage':require(_0x62cf('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x62cf('0x8'))};function createMessage(_0x91d515,_0x4e0d06,_0x38c78b,_0x4f486b){return new Promise(function(_0x2de0dd,_0x39fd91){var _0x31b9f7=_[_0x62cf('0x9')](_0x38c78b);_0x31b9f7[_0x62cf('0xa')]=_0x4f486b;return rpc[_0x4e0d06+_0x62cf('0xb')]['create'](_0x31b9f7)[_0x62cf('0xc')](function(){logger[_0x62cf('0xd')](_0x62cf('0xe'),_0x91d515,_0x31b9f7[_0x62cf('0xa')]);_0x2de0dd();})['catch'](function(_0x8c6d84){logger['error'](_0x62cf('0xe'),_0x91d515,JSON['stringify'](_0x8c6d84));_0x39fd91(_0x8c6d84);});});}exports[_0x62cf('0xf')]=function(_0x309ab8,_0x2d0888){return function(_0x5b1756){try{if(!_[_0x62cf('0x10')](this['interaction']['UserId'])){logger[_0x62cf('0xd')](_0x62cf('0xe'),_0x309ab8,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x5b1756['next']();}var _0x493aec={'ContactId':this[_0x62cf('0x11')]['id'],'sentAt':moment()[_0x62cf('0x12')](_0x62cf('0x13')),'direction':'out'};if(this[_0x62cf('0x14')]===_0x62cf('0x15')||this[_0x62cf('0x14')]===_0x62cf('0x16')){_0x493aec['phone']=this[_0x62cf('0x17')][_0x62cf('0x18')];}var _0x31a52d=this['channel'];if(_0x31a52d===_0x62cf('0x19')){_0x493aec[_0x62cf('0x1a')]=this[_0x62cf('0x1b')]['id'];}else{_0x493aec[_[_0x62cf('0x1c')](_0x31a52d)+_0x62cf('0x1d')]=this['account']['id'];}_0x493aec[_['upperFirst'](_0x31a52d)+_0x62cf('0x1e')]=this['interaction']['id'];if(this['interaction'][_0x62cf('0x1f')]){var _0x58650a=_0x2d0888[0x4];if(!_['isEmpty'](_0x58650a)){_0x493aec[_0x62cf('0xa')]=utils['getMustacheRender'](_0x58650a,this);return rpc[_0x31a52d+_0x62cf('0xb')][_0x62cf('0x20')](_0x493aec)['then'](function(_0x41a81e){logger['info'](_0x62cf('0xe'),_0x309ab8,_0x493aec['body']);})[_0x62cf('0x21')](function(_0x32debe){logger[_0x62cf('0x22')](_0x62cf('0xe'),_0x309ab8,JSON[_0x62cf('0x23')](_0x32debe));})['finally'](function(){logger[_0x62cf('0xd')](_0x62cf('0x24'),_0x309ab8);_0x5b1756['stop']();});}else{logger[_0x62cf('0xd')](_0x62cf('0x25'),_0x309ab8);_0x5b1756['stop']();}}else{var _0x1938b9=this;var _0x76394=_0x2d0888[0x2]['replace'](/\\n/g,'\x0a');var _0x589637={'credentials':{'private_key':_0x76394,'client_email':_0x2d0888[0x1]}};var _0x41973f=new dialogflow[(_0x62cf('0x26'))](_0x589637);var _0x13f6b3=_0x41973f['sessionPath'](_0x2d0888[0x0],md5(_0x1938b9['interaction']['id']));var _0x36d20c={'session':_0x13f6b3,'queryInput':{'text':{'text':_0x1938b9[_0x62cf('0x27')][_0x62cf('0xa')],'languageCode':_0x2d0888[0x3]||'en'}}};return _0x41973f[_0x62cf('0x28')](_0x36d20c)[_0x62cf('0xc')](function(_0x51067c){if(_0x51067c&&_0x51067c['length']){_0x1938b9[_0x62cf('0xa')][_0x62cf('0x29')]=_0x51067c;var _0x2afd86=_0x51067c[0x0];var _0x3819e2=_0x2afd86[_0x62cf('0x2a')][_0x62cf('0x2b')]&&_0x2afd86['queryResult'][_0x62cf('0x2b')][_0x62cf('0x2c')]?_0x2afd86['queryResult'][_0x62cf('0x2b')]['fields'][_0x62cf('0x2d')][_0x62cf('0x2e')]:![];_0x1938b9[_0x62cf('0xa')][_0x62cf('0x2f')]=_0x2afd86['queryResult']['action'];_0x1938b9[_0x62cf('0xa')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x2afd86['queryResult'][_0x62cf('0x30')];_0x1938b9[_0x62cf('0xa')][_0x62cf('0x31')]=_0x2afd86[_0x62cf('0x2a')]['diagnosticInfo']&&_0x2afd86[_0x62cf('0x2a')][_0x62cf('0x2b')][_0x62cf('0x2c')]?_0x2afd86[_0x62cf('0x2a')][_0x62cf('0x2b')][_0x62cf('0x2c')][_0x62cf('0x2d')][_0x62cf('0x2e')]:![];_0x1938b9['body']['DIALOGFLOWV2_INTENTNAME']=_0x2afd86['queryResult'][_0x62cf('0x32')][_0x62cf('0x33')];_0x1938b9[_0x62cf('0xa')][_0x62cf('0x34')]=_0x2afd86['queryResult'][_0x62cf('0x32')][_0x62cf('0x35')];_0x1938b9[_0x62cf('0xa')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x2afd86[_0x62cf('0x2a')][_0x62cf('0x32')][_0x62cf('0x36')];_0x1938b9[_0x62cf('0xa')][_0x62cf('0x37')]=_0x2afd86['queryResult'][_0x62cf('0x38')];_0x1938b9['body'][_0x62cf('0x39')]=_0x2afd86[_0x62cf('0x2a')]['queryText'];_0x1938b9['body'][_0x62cf('0x3a')]=_0x2afd86[_0x62cf('0x2a')][_0x62cf('0x3b')];_0x493aec[_0x62cf('0x3c')]='dialogflowV2';_0x493aec['providerResponse']=JSON['stringify'](_0x51067c);var _0x213d52=[];for(var _0x22336c=0x0;_0x22336c<_0x51067c[_0x62cf('0x3d')];_0x22336c++){var _0x75af0=_0x51067c[_0x22336c];if(_0x75af0&&_0x75af0['queryResult']&&_0x75af0['queryResult'][_0x62cf('0x3e')]){_0x213d52[_0x62cf('0x3f')](createMessage(_0x309ab8,_0x31a52d,_0x493aec,_0x75af0[_0x62cf('0x2a')][_0x62cf('0x3e')]));}}return Promise[_0x62cf('0x40')](_0x213d52)[_0x62cf('0xc')](function(){if(_0x3819e2){_0x5b1756['next']();}else{_0x5b1756[_0x62cf('0x41')]();}})[_0x62cf('0x21')](function(_0x3c81ac){logger[_0x62cf('0x22')](_0x62cf('0xe'),_0x309ab8,JSON['stringify'](_0x3c81ac));_0x5b1756[_0x62cf('0x42')]();});}})[_0x62cf('0x21')](function(_0x4fca38){logger['error'](_0x62cf('0xe'),_0x309ab8,_0x4fca38[_0x62cf('0x27')]);_0x5b1756[_0x62cf('0x42')]();});}}catch(_0x2e8f90){logger[_0x62cf('0x22')]('[%s][DIALOGFLOWV2]\x20%s',_0x309ab8,JSON['stringify'](_0x2e8f90));_0x5b1756['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 b309c56..2e9b3c7 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 _0xf8ec=['stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','replace','validate','length','error','[%s][GOTOIF]\x20%s','message','join'];(function(_0x3e9146,_0x31415e){var _0x3f249d=function(_0x70d6a1){while(--_0x70d6a1){_0x3e9146['push'](_0x3e9146['shift']());}};_0x3f249d(++_0x31415e);}(_0xf8ec,0x12d));var _0xcf8e=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0xf8ec[_0x59c301];return _0x3866b9;};'use strict';var schema=require('validate');var _=require('lodash');var htmlToText=require(_0xcf8e('0x0'));var utils=require(_0xcf8e('0x1'));var logger=require(_0xcf8e('0x2'))(_0xcf8e('0x3'));var gotoif=schema({'condition':{'type':_0xcf8e('0x4'),'required':!![],'message':_0xcf8e('0x5')},'priorityTrue':{'type':_0xcf8e('0x6'),'message':_0xcf8e('0x7')},'priorityFalse':{'type':_0xcf8e('0x6'),'message':_0xcf8e('0x8')}});exports[_0xcf8e('0x9')]=function(_0x34dfc7,_0x58f84f){return function(_0x2de8df){try{var _0x151f75={'condition':htmlToText['fromString'](utils[_0xcf8e('0xa')](_0x58f84f[0x0],this),{'wordwrap':![]})[_0xcf8e('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x58f84f[0x1],'priorityFalse':_0x58f84f[0x2]};var _0x263cb7=gotoif[_0xcf8e('0xc')](_0x151f75,{'typecast':!![]});if(_0x263cb7[_0xcf8e('0xd')]){logger[_0xcf8e('0xe')](_0xcf8e('0xf'),_0x34dfc7,_['map'](_0x263cb7,_0xcf8e('0x10'))[_0xcf8e('0x11')](',\x20'));_0x2de8df[_0xcf8e('0x12')]();}else{try{var _0x107092=eval('('+_0x151f75[_0xcf8e('0x13')]+')');var _0x297461=_0x107092?_0x151f75[_0xcf8e('0x14')]:_0x151f75[_0xcf8e('0x15')];logger[_0xcf8e('0x16')](_0xcf8e('0x17'),_0x34dfc7,_0x151f75[_0xcf8e('0x13')],_0x107092,_0x297461||_0xcf8e('0x18'));if(_0x297461){var _0x273010=_[_0xcf8e('0x19')](_0x2de8df['rules'](),{'p':_0x297461});if(_0x273010>=0x0){logger[_0xcf8e('0x16')](_0xcf8e('0x1a'),_0x34dfc7,_0x297461||_0xcf8e('0x18'),_0x273010);_0x2de8df[_0xcf8e('0x18')](_0x273010);}else{logger[_0xcf8e('0x16')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x34dfc7,_0x297461||'next');_0x2de8df['stop']();}}else{_0x2de8df['next']();}}catch(_0x48e9d8){logger[_0xcf8e('0xe')](_0xcf8e('0x1b'),_0x34dfc7,_0x48e9d8[_0xcf8e('0x10')]);_0x2de8df[_0xcf8e('0x12')]();}}}catch(_0x244480){logger[_0xcf8e('0xe')]('[%s][GOTOIF]\x20%s',_0x34dfc7,JSON[_0xcf8e('0x1c')](_0x244480));_0x2de8df['stop']();}};}; \ No newline at end of file +var _0xc4de=['[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','lodash','html-to-text','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','replace','[%s][GOTOIF]\x20%s','map','join','stop','condition','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error'];(function(_0x26fcb7,_0x15fd7d){var _0x4bcfc9=function(_0x6913c8){while(--_0x6913c8){_0x26fcb7['push'](_0x26fcb7['shift']());}};_0x4bcfc9(++_0x15fd7d);}(_0xc4de,0x17d));var _0xec4d=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0xc4de[_0x39e283];return _0x7de89f;};'use strict';var schema=require(_0xec4d('0x0'));var _=require(_0xec4d('0x1'));var htmlToText=require(_0xec4d('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0xec4d('0x3'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0xec4d('0x4')},'priorityTrue':{'type':'number','message':_0xec4d('0x5')},'priorityFalse':{'type':_0xec4d('0x6'),'message':_0xec4d('0x7')}});exports[_0xec4d('0x8')]=function(_0x909de1,_0x20f1a9){return function(_0x4aafd5){try{var _0xd24ad0={'condition':htmlToText['fromString'](utils[_0xec4d('0x9')](_0x20f1a9[0x0],this),{'wordwrap':![]})[_0xec4d('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x20f1a9[0x1],'priorityFalse':_0x20f1a9[0x2]};var _0x2f38a7=gotoif[_0xec4d('0x0')](_0xd24ad0,{'typecast':!![]});if(_0x2f38a7['length']){logger['error'](_0xec4d('0xb'),_0x909de1,_[_0xec4d('0xc')](_0x2f38a7,'message')[_0xec4d('0xd')](',\x20'));_0x4aafd5[_0xec4d('0xe')]();}else{try{var _0x3ddc6f=eval('('+_0xd24ad0[_0xec4d('0xf')]+')');var _0x375b11=_0x3ddc6f?_0xd24ad0[_0xec4d('0x10')]:_0xd24ad0['priorityFalse'];logger[_0xec4d('0x11')](_0xec4d('0x12'),_0x909de1,_0xd24ad0['condition'],_0x3ddc6f,_0x375b11||_0xec4d('0x13'));if(_0x375b11){var _0x1e95ab=_[_0xec4d('0x14')](_0x4aafd5['rules'](),{'p':_0x375b11});if(_0x1e95ab>=0x0){logger[_0xec4d('0x11')](_0xec4d('0x15'),_0x909de1,_0x375b11||'next',_0x1e95ab);_0x4aafd5[_0xec4d('0x13')](_0x1e95ab);}else{logger['info'](_0xec4d('0x16'),_0x909de1,_0x375b11||_0xec4d('0x13'));_0x4aafd5[_0xec4d('0xe')]();}}else{_0x4aafd5[_0xec4d('0x13')]();}}catch(_0x3c2730){logger[_0xec4d('0x17')](_0xec4d('0x18'),_0x909de1,_0x3c2730[_0xec4d('0x19')]);_0x4aafd5[_0xec4d('0xe')]();}}}catch(_0x4925da){logger['error'](_0xec4d('0xb'),_0x909de1,JSON[_0xec4d('0x1a')](_0x4925da));_0x4aafd5[_0xec4d('0xe')]();}};}; \ 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 d5b47f7..dac1bdd 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 _0x70cb=['consequence','error','[%s][GOTOP]\x20%s','map','message','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'];(function(_0x219082,_0x5e54a9){var _0x3b4918=function(_0x234637){while(--_0x234637){_0x219082['push'](_0x219082['shift']());}};_0x3b4918(++_0x5e54a9);}(_0x70cb,0x1c8));var _0xb70c=function(_0x64a4f2,_0x1921a5){_0x64a4f2=_0x64a4f2-0x0;var _0x1a892c=_0x70cb[_0x64a4f2];return _0x1a892c;};'use strict';var schema=require(_0xb70c('0x0'));var _=require('lodash');var logger=require(_0xb70c('0x1'))('routing');var gotop=schema({'priority':{'type':_0xb70c('0x2'),'required':!![],'message':_0xb70c('0x3')}});exports[_0xb70c('0x4')]=function(_0x358392,_0x1babb8){return function(_0x521e80){try{var _0x29255a={'priority':_0x1babb8[0x0]};var _0x2ddaba=gotop[_0xb70c('0x0')](_0x29255a,{'typecast':!![]});if(_0x2ddaba['length']){logger[_0xb70c('0x5')](_0xb70c('0x6'),_0x358392,_[_0xb70c('0x7')](_0x2ddaba,_0xb70c('0x8'))[_0xb70c('0x9')](',\x20'));_0x521e80[_0xb70c('0xa')]();}else{logger['info'](_0xb70c('0xb'),_0x358392,_0x29255a[_0xb70c('0xc')]);if(_0x29255a[_0xb70c('0xc')]){var _0x419986=_[_0xb70c('0xd')](_0x521e80[_0xb70c('0xe')](),{'p':_0x29255a[_0xb70c('0xc')]});if(_0x419986>=0x0){logger[_0xb70c('0xf')](_0xb70c('0x10'),_0x358392,_0x29255a['priority']||'next',_0x419986);_0x521e80[_0xb70c('0x11')](_0x419986);}else{logger[_0xb70c('0xf')](_0xb70c('0x12'),_0x358392,_0x29255a[_0xb70c('0xc')]||'next');_0x521e80[_0xb70c('0xa')]();}}else{_0x521e80[_0xb70c('0x11')]();}}}catch(_0x221df5){logger['error'](_0xb70c('0x6'),_0x358392,JSON[_0xb70c('0x13')](_0x221df5));_0x521e80[_0xb70c('0xa')]();}};}; \ No newline at end of file +var _0xc777=['[%s][GOTOP]\x20%s','map','message','stop','info','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc777,0x81));var _0x7c77=function(_0x594576,_0x5c47c3){_0x594576=_0x594576-0x0;var _0xf5afc6=_0xc777[_0x594576];return _0xf5afc6;};'use strict';var schema=require(_0x7c77('0x0'));var _=require(_0x7c77('0x1'));var logger=require(_0x7c77('0x2'))(_0x7c77('0x3'));var gotop=schema({'priority':{'type':_0x7c77('0x4'),'required':!![],'message':_0x7c77('0x5')}});exports[_0x7c77('0x6')]=function(_0xda33e2,_0x41443e){return function(_0x299ad9){try{var _0x2f6868={'priority':_0x41443e[0x0]};var _0x862ee3=gotop[_0x7c77('0x0')](_0x2f6868,{'typecast':!![]});if(_0x862ee3['length']){logger['error'](_0x7c77('0x7'),_0xda33e2,_[_0x7c77('0x8')](_0x862ee3,_0x7c77('0x9'))['join'](',\x20'));_0x299ad9[_0x7c77('0xa')]();}else{logger[_0x7c77('0xb')]('[%s][GOTOP]\x20priority\x20%s',_0xda33e2,_0x2f6868[_0x7c77('0xc')]);if(_0x2f6868[_0x7c77('0xc')]){var _0x152f62=_['findIndex'](_0x299ad9[_0x7c77('0xd')](),{'p':_0x2f6868[_0x7c77('0xc')]});if(_0x152f62>=0x0){logger[_0x7c77('0xb')](_0x7c77('0xe'),_0xda33e2,_0x2f6868['priority']||_0x7c77('0xf'),_0x152f62);_0x299ad9[_0x7c77('0xf')](_0x152f62);}else{logger['info'](_0x7c77('0x10'),_0xda33e2,_0x2f6868[_0x7c77('0xc')]||_0x7c77('0xf'));_0x299ad9['stop']();}}else{_0x299ad9[_0x7c77('0xf')]();}}}catch(_0x50b3a4){logger['error']('[%s][GOTOP]\x20%s',_0xda33e2,JSON['stringify'](_0x50b3a4));_0x299ad9['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 1a8e19a..2bff572 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 _0x74c7=['upperFirst','channel','AccountId','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stop','stringify','lodash','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','contact','chat','ChatWebsiteId','account'];(function(_0x25fd41,_0x42ee8d){var _0x1710ea=function(_0x43d51f){while(--_0x43d51f){_0x25fd41['push'](_0x25fd41['shift']());}};_0x1710ea(++_0x42ee8d);}(_0x74c7,0x7c));var _0x774c=function(_0x358360,_0x3afd17){_0x358360=_0x358360-0x0;var _0xf8903a=_0x74c7[_0x358360];return _0xf8903a;};'use strict';var _=require(_0x774c('0x0'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x774c('0x1'));var rpc={'chatMessage':require(_0x774c('0x2')),'openchannelMessage':require(_0x774c('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x774c('0x4')),'faxMessage':require(_0x774c('0x5')),'whatsappMessage':require(_0x774c('0x6'))};exports['consequence']=function(_0x51fb76,_0x5aaeb7){return function(_0x169a00){try{var _0x3275b2={'body':utils['getMustacheRender'](_0x5aaeb7[0x0],this),'ContactId':this[_0x774c('0x7')]['id']};if(this['channel']===_0x774c('0x8')){_0x3275b2[_0x774c('0x9')]=this[_0x774c('0xa')]['id'];}else{_0x3275b2[_[_0x774c('0xb')](this[_0x774c('0xc')])+_0x774c('0xd')]=this[_0x774c('0xa')]['id'];}_0x3275b2[_['upperFirst'](this[_0x774c('0xc')])+_0x774c('0xe')]=this[_0x774c('0xf')]['id'];if(rpc[this['channel']+_0x774c('0x10')]){return rpc[this[_0x774c('0xc')]+'Message'][_0x774c('0x11')](_0x3275b2)[_0x774c('0x12')](function(_0x1db882){logger[_0x774c('0x13')](_0x774c('0x14'),_0x51fb76,_0x3275b2[_0x774c('0x15')]);_0x169a00[_0x774c('0x16')]();})[_0x774c('0x17')](function(_0x2f3b81){logger[_0x774c('0x18')]('[%s][MESSAGE]\x20%s',_0x51fb76,JSON['stringify'](_0x2f3b81));_0x169a00[_0x774c('0x19')]();});}}catch(_0x39b14f){logger[_0x774c('0x18')](_0x774c('0x14'),_0x51fb76,JSON[_0x774c('0x1a')](_0x39b14f));_0x169a00[_0x774c('0x19')]();}};}; \ No newline at end of file +var _0xdeff=['InteractionId','interaction','Message','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','ChatWebsiteId','upperFirst','account'];(function(_0x41604b,_0x245a9d){var _0x5693ef=function(_0x208e23){while(--_0x208e23){_0x41604b['push'](_0x41604b['shift']());}};_0x5693ef(++_0x245a9d);}(_0xdeff,0x151));var _0xfdef=function(_0x4b4638,_0xe99cda){_0x4b4638=_0x4b4638-0x0;var _0x59e92b=_0xdeff[_0x4b4638];return _0x59e92b;};'use strict';var _=require(_0xfdef('0x0'));var utils=require('./utils');var logger=require(_0xfdef('0x1'))('routing');var rpc={'chatMessage':require(_0xfdef('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xfdef('0x3')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xfdef('0x4')),'whatsappMessage':require(_0xfdef('0x5'))};exports[_0xfdef('0x6')]=function(_0x1b9b60,_0x448427){return function(_0x6f6779){try{var _0x4f064c={'body':utils[_0xfdef('0x7')](_0x448427[0x0],this),'ContactId':this[_0xfdef('0x8')]['id']};if(this[_0xfdef('0x9')]==='chat'){_0x4f064c[_0xfdef('0xa')]=this['account']['id'];}else{_0x4f064c[_[_0xfdef('0xb')](this[_0xfdef('0x9')])+'AccountId']=this[_0xfdef('0xc')]['id'];}_0x4f064c[_[_0xfdef('0xb')](this[_0xfdef('0x9')])+_0xfdef('0xd')]=this[_0xfdef('0xe')]['id'];if(rpc[this['channel']+_0xfdef('0xf')]){return rpc[this[_0xfdef('0x9')]+'Message']['create'](_0x4f064c)[_0xfdef('0x10')](function(_0x40e629){logger[_0xfdef('0x11')](_0xfdef('0x12'),_0x1b9b60,_0x4f064c[_0xfdef('0x13')]);_0x6f6779[_0xfdef('0x14')]();})[_0xfdef('0x15')](function(_0x1dcf30){logger[_0xfdef('0x16')](_0xfdef('0x12'),_0x1b9b60,JSON[_0xfdef('0x17')](_0x1dcf30));_0x6f6779[_0xfdef('0x18')]();});}}catch(_0x228344){logger[_0xfdef('0x16')]('[%s][MESSAGE]\x20%s',_0x1b9b60,JSON[_0xfdef('0x17')](_0x228344));_0x6f6779[_0xfdef('0x18')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 07a8548..c8b2a8c 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 _0x8f53=['./utils','../../../../config/logger','routing','next','error','[%s][NOOP]\x20%s','stringify','stop'];(function(_0x3e477e,_0x5ecd1b){var _0x4a7da5=function(_0x3fc8d7){while(--_0x3fc8d7){_0x3e477e['push'](_0x3e477e['shift']());}};_0x4a7da5(++_0x5ecd1b);}(_0x8f53,0x128));var _0x38f5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8f53[_0x20a584];return _0x4b41a8;};'use strict';var utils=require(_0x38f5('0x0'));var logger=require(_0x38f5('0x1'))(_0x38f5('0x2'));exports['consequence']=function(_0x48bc89,_0x665865){return function(_0x2a5dbb){try{logger['info']('[%s][NOOP]\x20%s',_0x48bc89,utils['getMustacheRender'](_0x665865[0x0],this));_0x2a5dbb[_0x38f5('0x3')]();}catch(_0x2db192){logger[_0x38f5('0x4')](_0x38f5('0x5'),_0x48bc89,JSON[_0x38f5('0x6')](_0x2db192));_0x2a5dbb[_0x38f5('0x7')]();}};}; \ No newline at end of file +var _0x2204=['info','[%s][NOOP]\x20%s','getMustacheRender','error','stop','./utils','routing'];(function(_0x3a812d,_0x4f0a93){var _0xdee285=function(_0x13a064){while(--_0x13a064){_0x3a812d['push'](_0x3a812d['shift']());}};_0xdee285(++_0x4f0a93);}(_0x2204,0x178));var _0x4220=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2204[_0x3dd15e];return _0x231fd0;};'use strict';var utils=require(_0x4220('0x0'));var logger=require('../../../../config/logger')(_0x4220('0x1'));exports['consequence']=function(_0x4519f5,_0x391630){return function(_0x49d374){try{logger[_0x4220('0x2')](_0x4220('0x3'),_0x4519f5,utils[_0x4220('0x4')](_0x391630[0x0],this));_0x49d374['next']();}catch(_0x2e0ba1){logger[_0x4220('0x5')]('[%s][NOOP]\x20%s',_0x4519f5,JSON['stringify'](_0x2e0ba1));_0x49d374[_0x4220('0x6')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index addb919..43893e8 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 _0x1fce=['timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','length','stop','find','Queues','createQueue','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','queue_id','queue','emit','clone','account','format','%sQueuesWaitingInteractions','pick','%s_queue_waiting_interaction:%s','save','remove','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','interaction','message','AccountId','WebsiteId','info','name','QueueReport','create','catch','error','accepted','[%s][STOP:QUEUE][NAME:%s]','update'];(function(_0x312a1d,_0x12472b){var _0x251402=function(_0x19dffc){while(--_0x19dffc){_0x312a1d['push'](_0x312a1d['shift']());}};_0x251402(++_0x12472b);}(_0x1fce,0x14c));var _0xe1fc=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x1fce[_0x468b0f];return _0x3e74d9;};'use strict';var schema=require(_0xe1fc('0x0'));var _=require(_0xe1fc('0x1'));var util=require(_0xe1fc('0x2'));var seqqueue=require(_0xe1fc('0x3'));var moment=require(_0xe1fc('0x4'));var Redis=require(_0xe1fc('0x5'));var config=require(_0xe1fc('0x6'));var logger=require(_0xe1fc('0x7'))(_0xe1fc('0x8'));var strategy=require(_0xe1fc('0x9'));config[_0xe1fc('0xa')]=_[_0xe1fc('0xb')](config[_0xe1fc('0xa')],{'host':_0xe1fc('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe1fc('0xa')]));var attributes=['id',_0xe1fc('0xd'),'account',_0xe1fc('0xe'),'from','joinAt'];function emit(_0x4a8aab,_0x31d12f,_0x111733){io['to'](_0x4a8aab)[_0xe1fc('0xf')](_0x31d12f,_0x111733);}function emitChannelQueueInteraction(_0x45e43a,_0x8961cc,_0x378a84,_0x37bd67,_0x314c47,_0x45b97b,_0x1f370d,_0x15a0ee){var _0x3d433d=_[_0xe1fc('0x10')](_0x378a84);_0x3d433d[_0xe1fc('0xd')]=_0x15a0ee;_0x3d433d[_0xe1fc('0xe')]=_0x8961cc;_0x3d433d[_0xe1fc('0x11')]=_0x37bd67;_0x3d433d['id']=_0x314c47;if(_0x45b97b){_0x1f370d[util[_0xe1fc('0x12')](_0xe1fc('0x13'),_0x45e43a)][_0x314c47]=_[_0xe1fc('0x14')](_0x3d433d,attributes);}else{delete _0x1f370d[util[_0xe1fc('0x12')](_0xe1fc('0x13'),_0x45e43a)][_0x314c47];}emit(util[_0xe1fc('0x12')]('%s:queue:%s',_0x45e43a,_0x8961cc),util[_0xe1fc('0x12')](_0xe1fc('0x15'),_0x45e43a,_0x45b97b?_0xe1fc('0x16'):_0xe1fc('0x17')),_[_0xe1fc('0x14')](_0x3d433d,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xe1fc('0x18')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0xe1fc('0x19')),'faxQueueReport':require(_0xe1fc('0x1a')),'whatsappQueueReport':require(_0xe1fc('0x1b'))};var queue=schema({'name':{'type':_0xe1fc('0x1c'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xe1fc('0x1d'),'message':_0xe1fc('0x1e')}});function startRouting(_0x2d212c,_0x5c5867,_0x1f4f06,_0x11690c){if(_0x2d212c&&_0x5c5867&&_0x1f4f06){_0x5c5867[_0xe1fc('0x1f')]+=0x1;var _0xa2a5a3={'uniqueid':_0x2d212c,'from':_0x1f4f06[_0xe1fc('0x20')]?_0x1f4f06['body'][_0xe1fc('0x21')]:'','joinAt':moment()[_0xe1fc('0x12')](_0xe1fc('0x22')),'ContactId':_0x1f4f06[_0xe1fc('0x23')]?_0x1f4f06['contact']['id']:null,'ListId':_0x1f4f06[_0xe1fc('0x24')]?_0x1f4f06[_0xe1fc('0x24')]['id']:null};_0xa2a5a3[_['upperFirst'](_0x1f4f06[_0xe1fc('0x25')])+_0xe1fc('0x26')]=_0x5c5867['id']||null;_0xa2a5a3[_[_0xe1fc('0x27')](_0x1f4f06['channel'])+'InteractionId']=_0x1f4f06[_0xe1fc('0x28')]?_0x1f4f06[_0xe1fc('0x28')]['id']:null;_0xa2a5a3[_[_0xe1fc('0x27')](_0x1f4f06[_0xe1fc('0x25')])+'MessageId']=_0x1f4f06['message']?_0x1f4f06[_0xe1fc('0x29')]['id']:null;_0xa2a5a3[_[_0xe1fc('0x27')](_0x1f4f06['channel'])+(_0x1f4f06['channel']!=='chat'?_0xe1fc('0x2a'):_0xe1fc('0x2b'))]=_0x1f4f06[_0xe1fc('0x11')]?_0x1f4f06['account']['id']:null;logger[_0xe1fc('0x2c')](util['format']('[%s][START:QUEUE][NAME:%s]',_0x2d212c,_0x5c5867['name']));emitChannelQueueInteraction(_0x1f4f06[_0xe1fc('0x25')],_0x5c5867[_0xe1fc('0x2d')],_0xa2a5a3,_0x1f4f06[_0xe1fc('0x11')][_0xe1fc('0x2d')],_0x1f4f06[_0xe1fc('0x29')]['id'],!![],_0x11690c,_0x5c5867['id']);if(rpc[_0x1f4f06[_0xe1fc('0x25')]+_0xe1fc('0x2e')]){return rpc[_0x1f4f06['channel']+_0xe1fc('0x2e')][_0xe1fc('0x2f')](_0xa2a5a3)[_0xe1fc('0x30')](function(_0x5379bf){logger[_0xe1fc('0x31')]('create\x20queue\x20report');});}}}function stopRouting(_0x303670,_0x12f340,_0x3fa0fc,_0x292c43){if(_0x303670&&_0x12f340){_0x12f340[_0xe1fc('0x1f')]-=0x1;var _0x135506={'leaveAt':moment()[_0xe1fc('0x12')](_0xe1fc('0x22')),'acceptAt':moment()[_0xe1fc('0x12')](_0xe1fc('0x22')),'reason':_0xe1fc('0x32')};logger[_0xe1fc('0x2c')](util['format'](_0xe1fc('0x33'),_0x303670,_0x12f340[_0xe1fc('0x2d')]));emitChannelQueueInteraction(_0x3fa0fc['channel'],_0x12f340[_0xe1fc('0x2d')],_0x3fa0fc[_0xe1fc('0x20')],_0x3fa0fc['account'][_0xe1fc('0x2d')],_0x3fa0fc[_0xe1fc('0x29')]['id'],![],_0x292c43,_0x12f340['id']);if(rpc[_0x3fa0fc[_0xe1fc('0x25')]+_0xe1fc('0x2e')]){return rpc[_0x3fa0fc['channel']+_0xe1fc('0x2e')][_0xe1fc('0x34')](_0x303670,_0x135506)[_0xe1fc('0x30')](function(_0x454832){logger[_0xe1fc('0x31')]('update\x20queue\x20report');});}}}function endRouting(_0x1ab628,_0x3edd04,_0x4be52b,_0x424502){if(_0x1ab628&&_0x3edd04){_0x3edd04[_0xe1fc('0x1f')]-=0x1;var _0x39671d={'leaveAt':moment()[_0xe1fc('0x12')](_0xe1fc('0x22')),'exitAt':moment()[_0xe1fc('0x12')](_0xe1fc('0x22')),'reason':_0xe1fc('0x35')};logger['info'](util[_0xe1fc('0x12')](_0xe1fc('0x36'),_0x1ab628,_0x3edd04[_0xe1fc('0x2d')]));emitChannelQueueInteraction(_0x4be52b[_0xe1fc('0x25')],_0x3edd04[_0xe1fc('0x2d')],_0x4be52b['body'],_0x4be52b[_0xe1fc('0x11')]['name'],_0x4be52b[_0xe1fc('0x29')]['id'],![],_0x424502);if(rpc[_0x4be52b[_0xe1fc('0x25')]+_0xe1fc('0x2e')]){return rpc[_0x4be52b[_0xe1fc('0x25')]+_0xe1fc('0x2e')][_0xe1fc('0x34')](_0x1ab628,_0x39671d)[_0xe1fc('0x30')](function(_0x1db116){logger[_0xe1fc('0x31')](_0xe1fc('0x37'));});}}}function handleFindQueue(_0x22ea3a){return function(_0x118784){return _0x118784[_0xe1fc('0x2d')][_0xe1fc('0x38')]()===_0x22ea3a[_0xe1fc('0x38')]();};}exports['consequence']=function(_0x49d06f,_0x3f192f,_0x5b239d,_0x5a6145){return function(_0x38c566){try{var _0x4f8249={'name':_0x3f192f[0x0],'timeout':_0x3f192f[0x1]};var _0x1125f0=queue[_0xe1fc('0x0')](_0x4f8249,{'typecast':!![]});if(_0x1125f0[_0xe1fc('0x39')]){logger['error']('[%s][QUEUE]\x20%s',_0x49d06f,_['map'](_0x1125f0,_0xe1fc('0x29'))['join'](',\x20'));_0x38c566[_0xe1fc('0x3a')]();}else{var _0x34f0bf=_[_0xe1fc('0x3b')](_0x5b239d[_0x5a6145[_0xe1fc('0x25')]+_0xe1fc('0x3c')],handleFindQueue(_0x4f8249[_0xe1fc('0x2d')]));if(_0x34f0bf){startRouting(_0x49d06f,_0x34f0bf,_0x5a6145,_0x5b239d);var _0x444a25=(_0x34f0bf[_0xe1fc('0x35')]||0xa)*0x3e8;var _0x33d1f1=(_0x4f8249[_0xe1fc('0x35')]||0x14)*0x3e8;var _0x240a45,_0x2c9602;if(_0x444a25>_0x33d1f1){_0x33d1f1=_0x444a25;}var _0x10018d=seqqueue[_0xe1fc('0x3d')](_0x444a25);_0x10018d['id']=_0x49d06f;_0x10018d[_0xe1fc('0x3e')]=_0x444a25;_0x10018d[_0xe1fc('0x3f')]=_0x33d1f1;_0x10018d[_0xe1fc('0x25')]=_0x5a6145['channel'];_0x5b239d['rules'][_0x49d06f]['on'](_0xe1fc('0x40'),function(){logger[_0xe1fc('0x2c')](_0xe1fc('0x41'),_0x49d06f);stopRouting(_0x49d06f,_0x34f0bf,_0x5a6145,_0x5b239d);clearTimeout(_0x240a45);_0x240a45=undefined;_0x10018d[_0xe1fc('0x42')](!![]);if(_0x5b239d[_0xe1fc('0x43')][_0x49d06f]){delete _0x5b239d[_0xe1fc('0x43')][_0x49d06f];}_0x38c566[_0xe1fc('0x3a')]();});_0x5b239d[_0xe1fc('0x43')][_0x49d06f]['on']('complete',function(){if(_0x5b239d[_0xe1fc('0x43')][_0x49d06f]){delete _0x5b239d[_0xe1fc('0x43')][_0x49d06f];}});_0x240a45=setTimeout(function(){logger['info'](_0xe1fc('0x44'),_0x49d06f);endRouting(_0x49d06f,_0x34f0bf,_0x5a6145,_0x5b239d);clearTimeout(_0x240a45);_0x10018d['close'](!![]);_0x38c566[_0xe1fc('0x45')]();},_0x33d1f1);switch(_0x34f0bf[_0xe1fc('0x46')]){case _0xe1fc('0x47'):strategy[_0xe1fc('0x47')](_0x10018d,_0x34f0bf,_0x5b239d,_0x5a6145);break;default:strategy[_0xe1fc('0x48')](_0x10018d,_0x34f0bf,_0x5b239d,_0x5a6145);}}else{logger['error'](_0xe1fc('0x49'),_0x49d06f,_0x4f8249[_0xe1fc('0x2d')]);_0x38c566['stop']();}}}catch(_0x15ecfb){console[_0xe1fc('0x4a')](_0x15ecfb);logger[_0xe1fc('0x31')](_0xe1fc('0x4b'),_0x49d06f,_0x15ecfb[_0xe1fc('0x4c')]);_0x38c566[_0xe1fc('0x3a')]();}};}; \ No newline at end of file +var _0x55ea=['format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','InteractionId','interaction','channel','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','update','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','timeout','createQueue','atimeout','rules','end','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','account','queue','from','joinAt','queue_id'];(function(_0x5cc40d,_0x133d09){var _0x192d61=function(_0xe50121){while(--_0xe50121){_0x5cc40d['push'](_0x5cc40d['shift']());}};_0x192d61(++_0x133d09);}(_0x55ea,0xe2));var _0xa55e=function(_0x58286a,_0x479482){_0x58286a=_0x58286a-0x0;var _0x30ac86=_0x55ea[_0x58286a];return _0x30ac86;};'use strict';var schema=require('validate');var _=require(_0xa55e('0x0'));var util=require(_0xa55e('0x1'));var seqqueue=require(_0xa55e('0x2'));var moment=require('moment');var Redis=require(_0xa55e('0x3'));var config=require(_0xa55e('0x4'));var logger=require(_0xa55e('0x5'))(_0xa55e('0x6'));var strategy=require(_0xa55e('0x7'));config[_0xa55e('0x8')]=_[_0xa55e('0x9')](config[_0xa55e('0x8')],{'host':_0xa55e('0xa'),'port':0x18eb});var io=require(_0xa55e('0xb'))(new Redis(config['redis']));var attributes=['id','queue_id',_0xa55e('0xc'),_0xa55e('0xd'),_0xa55e('0xe'),_0xa55e('0xf')];function emit(_0x5cc1db,_0x547451,_0x3ff9ba){io['to'](_0x5cc1db)['emit'](_0x547451,_0x3ff9ba);}function emitChannelQueueInteraction(_0x12d49f,_0x50592a,_0x38b730,_0x5eb76b,_0x4d5290,_0x524e81,_0x3eaf97,_0x49c5b7){var _0x1c3bee=_['clone'](_0x38b730);_0x1c3bee[_0xa55e('0x10')]=_0x49c5b7;_0x1c3bee['queue']=_0x50592a;_0x1c3bee[_0xa55e('0xc')]=_0x5eb76b;_0x1c3bee['id']=_0x4d5290;if(_0x524e81){_0x3eaf97[util[_0xa55e('0x11')](_0xa55e('0x12'),_0x12d49f)][_0x4d5290]=_['pick'](_0x1c3bee,attributes);}else{delete _0x3eaf97[util[_0xa55e('0x11')](_0xa55e('0x12'),_0x12d49f)][_0x4d5290];}emit(util[_0xa55e('0x11')](_0xa55e('0x13'),_0x12d49f,_0x50592a),util[_0xa55e('0x11')](_0xa55e('0x14'),_0x12d49f,_0x524e81?'save':_0xa55e('0x15')),_[_0xa55e('0x16')](_0x1c3bee,attributes));}var rpc={'openchannelQueueReport':require(_0xa55e('0x17')),'mailQueueReport':require(_0xa55e('0x18')),'chatQueueReport':require(_0xa55e('0x19')),'smsQueueReport':require(_0xa55e('0x1a')),'faxQueueReport':require(_0xa55e('0x1b')),'whatsappQueueReport':require(_0xa55e('0x1c'))};var queue=schema({'name':{'type':_0xa55e('0x1d'),'required':!![],'message':_0xa55e('0x1e')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x2e3f7a,_0x2f65e9,_0x3dfec5,_0x4ded05){if(_0x2e3f7a&&_0x2f65e9&&_0x3dfec5){_0x2f65e9[_0xa55e('0x1f')]+=0x1;var _0x3d821c={'uniqueid':_0x2e3f7a,'from':_0x3dfec5[_0xa55e('0x20')]?_0x3dfec5[_0xa55e('0x20')][_0xa55e('0xe')]:'','joinAt':moment()['format'](_0xa55e('0x21')),'ContactId':_0x3dfec5[_0xa55e('0x22')]?_0x3dfec5[_0xa55e('0x22')]['id']:null,'ListId':_0x3dfec5['list']?_0x3dfec5[_0xa55e('0x23')]['id']:null};_0x3d821c[_[_0xa55e('0x24')](_0x3dfec5['channel'])+_0xa55e('0x25')]=_0x2f65e9['id']||null;_0x3d821c[_[_0xa55e('0x24')](_0x3dfec5['channel'])+_0xa55e('0x26')]=_0x3dfec5[_0xa55e('0x27')]?_0x3dfec5[_0xa55e('0x27')]['id']:null;_0x3d821c[_[_0xa55e('0x24')](_0x3dfec5[_0xa55e('0x28')])+_0xa55e('0x29')]=_0x3dfec5[_0xa55e('0x2a')]?_0x3dfec5[_0xa55e('0x2a')]['id']:null;_0x3d821c[_['upperFirst'](_0x3dfec5['channel'])+(_0x3dfec5['channel']!==_0xa55e('0x2b')?_0xa55e('0x2c'):_0xa55e('0x2d'))]=_0x3dfec5['account']?_0x3dfec5[_0xa55e('0xc')]['id']:null;logger[_0xa55e('0x2e')](util[_0xa55e('0x11')](_0xa55e('0x2f'),_0x2e3f7a,_0x2f65e9[_0xa55e('0x30')]));emitChannelQueueInteraction(_0x3dfec5[_0xa55e('0x28')],_0x2f65e9[_0xa55e('0x30')],_0x3d821c,_0x3dfec5[_0xa55e('0xc')][_0xa55e('0x30')],_0x3dfec5[_0xa55e('0x2a')]['id'],!![],_0x4ded05,_0x2f65e9['id']);if(rpc[_0x3dfec5[_0xa55e('0x28')]+'QueueReport']){return rpc[_0x3dfec5[_0xa55e('0x28')]+_0xa55e('0x31')][_0xa55e('0x32')](_0x3d821c)[_0xa55e('0x33')](function(_0x3ef0c0){logger[_0xa55e('0x34')]('create\x20queue\x20report');});}}}function stopRouting(_0x1e3c65,_0x30692b,_0x3049b5,_0x8199e){if(_0x1e3c65&&_0x30692b){_0x30692b[_0xa55e('0x1f')]-=0x1;var _0x567f2e={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x1e3c65,_0x30692b['name']));emitChannelQueueInteraction(_0x3049b5[_0xa55e('0x28')],_0x30692b['name'],_0x3049b5[_0xa55e('0x20')],_0x3049b5['account'][_0xa55e('0x30')],_0x3049b5[_0xa55e('0x2a')]['id'],![],_0x8199e,_0x30692b['id']);if(rpc[_0x3049b5[_0xa55e('0x28')]+_0xa55e('0x31')]){return rpc[_0x3049b5[_0xa55e('0x28')]+_0xa55e('0x31')][_0xa55e('0x35')](_0x1e3c65,_0x567f2e)[_0xa55e('0x33')](function(_0x54e20a){logger[_0xa55e('0x34')](_0xa55e('0x36'));});}}}function endRouting(_0xdffff7,_0x2e0bd8,_0x598f08,_0x38e4b9){if(_0xdffff7&&_0x2e0bd8){_0x2e0bd8['waiting']-=0x1;var _0x3ccdb1={'leaveAt':moment()[_0xa55e('0x11')](_0xa55e('0x21')),'exitAt':moment()[_0xa55e('0x11')](_0xa55e('0x21')),'reason':'timeout'};logger[_0xa55e('0x2e')](util['format'](_0xa55e('0x37'),_0xdffff7,_0x2e0bd8['name']));emitChannelQueueInteraction(_0x598f08[_0xa55e('0x28')],_0x2e0bd8[_0xa55e('0x30')],_0x598f08['body'],_0x598f08[_0xa55e('0xc')][_0xa55e('0x30')],_0x598f08[_0xa55e('0x2a')]['id'],![],_0x38e4b9);if(rpc[_0x598f08[_0xa55e('0x28')]+_0xa55e('0x31')]){return rpc[_0x598f08[_0xa55e('0x28')]+_0xa55e('0x31')][_0xa55e('0x35')](_0xdffff7,_0x3ccdb1)['catch'](function(_0x10c613){logger['error'](_0xa55e('0x36'));});}}}function handleFindQueue(_0x14be59){return function(_0x58981f){return _0x58981f[_0xa55e('0x30')][_0xa55e('0x38')]()===_0x14be59['toLowerCase']();};}exports[_0xa55e('0x39')]=function(_0x5169dc,_0x6d1711,_0x3f9a23,_0x419fba){return function(_0x4eebee){try{var _0x4000b5={'name':_0x6d1711[0x0],'timeout':_0x6d1711[0x1]};var _0x228ae4=queue[_0xa55e('0x3a')](_0x4000b5,{'typecast':!![]});if(_0x228ae4[_0xa55e('0x3b')]){logger[_0xa55e('0x34')](_0xa55e('0x3c'),_0x5169dc,_[_0xa55e('0x3d')](_0x228ae4,_0xa55e('0x2a'))[_0xa55e('0x3e')](',\x20'));_0x4eebee[_0xa55e('0x3f')]();}else{var _0x4d17a5=_[_0xa55e('0x40')](_0x3f9a23[_0x419fba[_0xa55e('0x28')]+_0xa55e('0x41')],handleFindQueue(_0x4000b5['name']));if(_0x4d17a5){startRouting(_0x5169dc,_0x4d17a5,_0x419fba,_0x3f9a23);var _0x578a28=(_0x4d17a5[_0xa55e('0x42')]||0xa)*0x3e8;var _0xa640b3=(_0x4000b5['timeout']||0x14)*0x3e8;var _0x19e63f,_0x274149;if(_0x578a28>_0xa640b3){_0xa640b3=_0x578a28;}var _0xd66d6d=seqqueue[_0xa55e('0x43')](_0x578a28);_0xd66d6d['id']=_0x5169dc;_0xd66d6d[_0xa55e('0x44')]=_0x578a28;_0xd66d6d['qtimeout']=_0xa640b3;_0xd66d6d[_0xa55e('0x28')]=_0x419fba[_0xa55e('0x28')];_0x3f9a23[_0xa55e('0x45')][_0x5169dc]['on'](_0xa55e('0x46'),function(){logger[_0xa55e('0x2e')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x5169dc);stopRouting(_0x5169dc,_0x4d17a5,_0x419fba,_0x3f9a23);clearTimeout(_0x19e63f);_0x19e63f=undefined;_0xd66d6d[_0xa55e('0x47')](!![]);if(_0x3f9a23['rules'][_0x5169dc]){delete _0x3f9a23[_0xa55e('0x45')][_0x5169dc];}_0x4eebee[_0xa55e('0x3f')]();});_0x3f9a23[_0xa55e('0x45')][_0x5169dc]['on'](_0xa55e('0x48'),function(){if(_0x3f9a23[_0xa55e('0x45')][_0x5169dc]){delete _0x3f9a23[_0xa55e('0x45')][_0x5169dc];}});_0x19e63f=setTimeout(function(){logger[_0xa55e('0x2e')](_0xa55e('0x49'),_0x5169dc);endRouting(_0x5169dc,_0x4d17a5,_0x419fba,_0x3f9a23);clearTimeout(_0x19e63f);_0xd66d6d[_0xa55e('0x47')](!![]);_0x4eebee[_0xa55e('0x4a')]();},_0xa640b3);switch(_0x4d17a5[_0xa55e('0x4b')]){case _0xa55e('0x4c'):strategy[_0xa55e('0x4c')](_0xd66d6d,_0x4d17a5,_0x3f9a23,_0x419fba);break;default:strategy[_0xa55e('0x4d')](_0xd66d6d,_0x4d17a5,_0x3f9a23,_0x419fba);}}else{logger[_0xa55e('0x34')](_0xa55e('0x4e'),_0x5169dc,_0x4000b5[_0xa55e('0x30')]);_0x4eebee[_0xa55e('0x3f')]();}}}catch(_0x26ae50){console[_0xa55e('0x4f')](_0x26ae50);logger[_0xa55e('0x34')](_0xa55e('0x3c'),_0x5169dc,_0x26ae50[_0xa55e('0x50')]);_0x4eebee[_0xa55e('0x3f')]();}};}; \ 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 1f04fb9..fc0e21d 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 _0xe014=['channel','busy','busyQueue','showNotification','writeLog','RINGING','routing',':FORCED','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','exports','lodash','uuid','../../../../../config/logger','notificationId','squeue','agent','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','push','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe014,0x14b));var _0x4e01=function(_0xf755de,_0xbae09d){_0xf755de=_0xf755de-0x0;var _0x1e9289=_0xe014[_0xf755de];return _0x1e9289;};'use strict';var _=require(_0x4e01('0x0'));var uuid=require(_0x4e01('0x1'));var util=require('./util');var logger=require(_0x4e01('0x2'))('routing');var Agent=function(_0x441d99,_0x396546,_0x36c6df,_0x1bc203){this[_0x4e01('0x3')]=uuid['v4']();this[_0x4e01('0x4')]=_0x441d99;this[_0x4e01('0x5')]=_0x396546;this['realtime']=_0x36c6df;this['routing']=_0x1bc203;this[_0x4e01('0x4')]['push'](this[_0x4e01('0x6')][_0x4e01('0x7')](this),this[_0x4e01('0x8')]['bind'](this));this[_0x4e01('0x4')]['on'](_0x4e01('0x9'),this[_0x4e01('0x8')][_0x4e01('0x7')](this));this[_0x4e01('0x4')]['on'](_0x4e01('0xa'),this[_0x4e01('0xb')][_0x4e01('0x7')](this));};Agent[_0x4e01('0xc')][_0x4e01('0xd')]=function(){this[_0x4e01('0x4')]['push'](this[_0x4e01('0x6')][_0x4e01('0x7')](this),this[_0x4e01('0x8')][_0x4e01('0x7')](this));};Agent['prototype']['handleDrained']=function(){this['handleTimeout'](!![]);};Agent[_0x4e01('0xc')][_0x4e01('0x6')]=function(_0x2aba4d){logger[_0x4e01('0xe')](_0x4e01('0xf'),this[_0x4e01('0x4')]['id'],this[_0x4e01('0x5')]['id']);if(_[_0x4e01('0x10')](this[_0x4e01('0x11')][_0x4e01('0x12')][this[_0x4e01('0x5')]['id']])){logger['info'](_0x4e01('0x13'),this[_0x4e01('0x4')]['id'],this[_0x4e01('0x5')]['id']);setTimeout(this[_0x4e01('0xd')]['bind'](this),0x3e8);}else{if(this['routing']['forcedOwnership']||util[_0x4e01('0x14')](this['squeue']['id'],this[_0x4e01('0x11')][_0x4e01('0x12')][this['agent']['id']],this[_0x4e01('0x4')][_0x4e01('0x15')],![])){this[_0x4e01('0x11')]['agents'][this[_0x4e01('0x5')]['id']][_0x4e01('0x16')]=!![];this['realtime'][_0x4e01('0x12')][this['agent']['id']][_0x4e01('0x17')]=undefined;util[_0x4e01('0x18')](this[_0x4e01('0x3')],this[_0x4e01('0x4')]['id'],this[_0x4e01('0x11')][_0x4e01('0x12')][this['agent']['id']],null,this['routing']);util[_0x4e01('0x19')](this[_0x4e01('0x4')]['id'],this[_0x4e01('0x11')][_0x4e01('0x12')][this[_0x4e01('0x5')]['id']],_0x4e01('0x1a')+(this[_0x4e01('0x1b')]['forcedOwnership']?_0x4e01('0x1c'):''));}else{logger[_0x4e01('0xe')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x4e01('0x4')]['id'],this['agent']['id']);setTimeout(this[_0x4e01('0xd')]['bind'](this),0x3e8);}}};Agent['prototype'][_0x4e01('0x8')]=function(_0x344457){if(_[_0x4e01('0x10')](this[_0x4e01('0x11')][_0x4e01('0x12')][this['agent']['id']])){return logger[_0x4e01('0xe')](_0x4e01('0x13'),this['squeue']['id'],this[_0x4e01('0x5')]['id']);}else{logger[_0x4e01('0xe')](_0x4e01('0x1d'),this['squeue']['id'],this[_0x4e01('0x5')]['id']);util[_0x4e01('0x1e')](this[_0x4e01('0x3')],this[_0x4e01('0x4')]['id'],this[_0x4e01('0x11')][_0x4e01('0x12')][this[_0x4e01('0x5')]['id']],null,this[_0x4e01('0x1b')]);this[_0x4e01('0x11')][_0x4e01('0x12')][this['agent']['id']][_0x4e01('0x16')]=![];this['realtime'][_0x4e01('0x12')][this['agent']['id']][_0x4e01('0x17')]=undefined;util[_0x4e01('0x19')](this[_0x4e01('0x4')]['id'],this['realtime']['agents'][this['agent']['id']],_0x344457?'STOP':'TIMEOUT');}if(!_0x344457){setTimeout(this[_0x4e01('0xd')][_0x4e01('0x7')](this),0x3e8);}};function agent(_0x13d7d9,_0x5b0227,_0x3a83a8,_0x100939){return new Agent(_0x13d7d9,_0x5b0227,_0x3a83a8,_0x100939);}module[_0x4e01('0x1f')]=agent; \ No newline at end of file +var _0xdfab=['drained','handleDrained','prototype','push','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','busy','showNotification','writeLog','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','handleRun','bind','timeout','handleTimeout'];(function(_0x4325da,_0x312300){var _0x25d602=function(_0x1ca4d4){while(--_0x1ca4d4){_0x4325da['push'](_0x4325da['shift']());}};_0x25d602(++_0x312300);}(_0xdfab,0x18c));var _0xbdfa=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xdfab[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0xbdfa('0x0'));var uuid=require('uuid');var util=require(_0xbdfa('0x1'));var logger=require(_0xbdfa('0x2'))(_0xbdfa('0x3'));var Agent=function(_0x3149f1,_0x7bb094,_0x53e37d,_0x31d9b2){this[_0xbdfa('0x4')]=uuid['v4']();this[_0xbdfa('0x5')]=_0x3149f1;this[_0xbdfa('0x6')]=_0x7bb094;this[_0xbdfa('0x7')]=_0x53e37d;this['routing']=_0x31d9b2;this[_0xbdfa('0x5')]['push'](this[_0xbdfa('0x8')][_0xbdfa('0x9')](this),this['handleTimeout'][_0xbdfa('0x9')](this));this['squeue']['on'](_0xbdfa('0xa'),this[_0xbdfa('0xb')]['bind'](this));this[_0xbdfa('0x5')]['on'](_0xbdfa('0xc'),this[_0xbdfa('0xd')]['bind'](this));};Agent[_0xbdfa('0xe')]['push']=function(){this[_0xbdfa('0x5')][_0xbdfa('0xf')](this[_0xbdfa('0x8')]['bind'](this),this['handleTimeout'][_0xbdfa('0x9')](this));};Agent[_0xbdfa('0xe')][_0xbdfa('0xd')]=function(){this['handleTimeout'](!![]);};Agent[_0xbdfa('0xe')]['handleRun']=function(_0x221fb5){logger[_0xbdfa('0x10')](_0xbdfa('0x11'),this['squeue']['id'],this['agent']['id']);if(_[_0xbdfa('0x12')](this[_0xbdfa('0x7')][_0xbdfa('0x13')][this[_0xbdfa('0x6')]['id']])){logger[_0xbdfa('0x10')](_0xbdfa('0x14'),this[_0xbdfa('0x5')]['id'],this[_0xbdfa('0x6')]['id']);setTimeout(this[_0xbdfa('0xf')][_0xbdfa('0x9')](this),0x3e8);}else{if(this[_0xbdfa('0x3')]['forcedOwnership']||util[_0xbdfa('0x15')](this['squeue']['id'],this['realtime'][_0xbdfa('0x13')][this['agent']['id']],this['squeue'][_0xbdfa('0x16')],![])){this[_0xbdfa('0x7')]['agents'][this[_0xbdfa('0x6')]['id']][_0xbdfa('0x17')]=!![];this[_0xbdfa('0x7')][_0xbdfa('0x13')][this[_0xbdfa('0x6')]['id']]['busyQueue']=undefined;util[_0xbdfa('0x18')](this[_0xbdfa('0x4')],this[_0xbdfa('0x5')]['id'],this[_0xbdfa('0x7')]['agents'][this[_0xbdfa('0x6')]['id']],null,this[_0xbdfa('0x3')]);util[_0xbdfa('0x19')](this[_0xbdfa('0x5')]['id'],this[_0xbdfa('0x7')][_0xbdfa('0x13')][this['agent']['id']],_0xbdfa('0x1a')+(this[_0xbdfa('0x3')][_0xbdfa('0x1b')]?_0xbdfa('0x1c'):''));}else{logger['info'](_0xbdfa('0x1d'),this[_0xbdfa('0x5')]['id'],this[_0xbdfa('0x6')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0xbdfa('0xe')]['handleTimeout']=function(_0x129bc5){if(_[_0xbdfa('0x12')](this['realtime'][_0xbdfa('0x13')][this[_0xbdfa('0x6')]['id']])){return logger[_0xbdfa('0x10')](_0xbdfa('0x14'),this[_0xbdfa('0x5')]['id'],this['agent']['id']);}else{logger['info'](_0xbdfa('0x1e'),this[_0xbdfa('0x5')]['id'],this[_0xbdfa('0x6')]['id']);util['hideNotification'](this[_0xbdfa('0x4')],this[_0xbdfa('0x5')]['id'],this['realtime'][_0xbdfa('0x13')][this[_0xbdfa('0x6')]['id']],null,this['routing']);this['realtime']['agents'][this['agent']['id']]['busy']=![];this[_0xbdfa('0x7')][_0xbdfa('0x13')][this[_0xbdfa('0x6')]['id']]['busyQueue']=undefined;util[_0xbdfa('0x19')](this[_0xbdfa('0x5')]['id'],this[_0xbdfa('0x7')][_0xbdfa('0x13')][this[_0xbdfa('0x6')]['id']],_0x129bc5?_0xbdfa('0x1f'):_0xbdfa('0x20'));}if(!_0x129bc5){setTimeout(this[_0xbdfa('0xf')]['bind'](this),0x3e8);}};function agent(_0x3385d0,_0x176ac0,_0x33d3a8,_0x4f05d5){return new Agent(_0x3385d0,_0x176ac0,_0x33d3a8,_0x4f05d5);}module[_0xbdfa('0x21')]=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 e37c0de..1827210 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 _0xe8f7=['bind','handleTimeout','drained','handleDrained','prototype','isNil','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','busyQueue','name','notificationId','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','busy','exports','lodash','./util','../../../../../config/logger','routing','queue','realtime','squeue','push','handleRun'];(function(_0x15c6ef,_0x131df0){var _0x1198ad=function(_0x5a8e4d){while(--_0x5a8e4d){_0x15c6ef['push'](_0x15c6ef['shift']());}};_0x1198ad(++_0x131df0);}(_0xe8f7,0x137));var _0x7e8f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe8f7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7e8f('0x0'));var uuid=require('uuid');var util=require(_0x7e8f('0x1'));var logger=require(_0x7e8f('0x2'))(_0x7e8f('0x3'));var Beepall=function(_0x4773eb,_0x428a60,_0xa9b6b5,_0x4249af){this['notificationId']=uuid['v4']();this['squeue']=_0x4773eb;this[_0x7e8f('0x4')]=_0x428a60;this[_0x7e8f('0x5')]=_0xa9b6b5;this['routing']=_0x4249af;this[_0x7e8f('0x6')][_0x7e8f('0x7')](this[_0x7e8f('0x8')][_0x7e8f('0x9')](this),this[_0x7e8f('0xa')][_0x7e8f('0x9')](this));this[_0x7e8f('0x6')]['on']('timeout',this[_0x7e8f('0xa')][_0x7e8f('0x9')](this));this['squeue']['on'](_0x7e8f('0xb'),this[_0x7e8f('0xc')][_0x7e8f('0x9')](this));};Beepall[_0x7e8f('0xd')]['push']=function(){this[_0x7e8f('0x6')][_0x7e8f('0x7')](this['handleRun'][_0x7e8f('0x9')](this),this[_0x7e8f('0xa')]['bind'](this));};Beepall['prototype'][_0x7e8f('0xc')]=function(_0x27287f){this[_0x7e8f('0xa')](!![]);};Beepall[_0x7e8f('0xd')][_0x7e8f('0x8')]=function(_0x31bb2a){var _0x2bdd98=!![];if(!_[_0x7e8f('0xe')](this[_0x7e8f('0x4')])&&!_[_0x7e8f('0xe')](this[_0x7e8f('0x4')][_0x7e8f('0xf')])&&this[_0x7e8f('0x4')][_0x7e8f('0xf')][_0x7e8f('0x10')]>0x0){for(var _0xbbb0e=0x0,_0x577a7b;_0xbbb0e0x0){for(var _0x195683=0x0,_0x58000f;_0x1956830x0&&_0x240000[_0x1f8d27+'CurrentCapacity']>=_0x240000[_0x1f8d27+_0x85d5('0x20')]){writeLog(_0x5ce96e,_0x240000,_0x1f8d27[_0x85d5('0x21')]()+_0x85d5('0x22'));return![];}}return!![];};exports['showNotification']=function(_0x2d0497,_0x367704,_0x815808,_0x370c97,_0x4605c5){return sendNotification(!![],_0x2d0497,_0x367704,_0x815808,_0x370c97,_0x4605c5);};exports['hideNotification']=function(_0x1cbef1,_0x476c8b,_0x330f8a,_0x22a961,_0x43ac91){return sendNotification(![],_0x1cbef1,_0x476c8b,_0x330f8a,_0x22a961,_0x43ac91);};exports['writeLog']=writeLog; \ No newline at end of file +var _0xdf55=['[%s][QUEUE][AGENT:%s][STATUS:%s]','BUSY','online','OFFLINE','Capacity','hasOwnProperty','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','hideNotification','writeLog','lodash','util','mustache','ioredis','../../../../../config/logger','routing','redis','localhost','socket.io-emitter','emit','format','name','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','user:%s','notification:%s','save','remove','info'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xdf55,0x83));var _0x5df5=function(_0x312484,_0x2605e6){_0x312484=_0x312484-0x0;var _0x5035e8=_0xdf55[_0x312484];return _0x5035e8;};'use strict';var _=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var utils=require('../utils');var Mustache=require(_0x5df5('0x2'));var Redis=require(_0x5df5('0x3'));var config=require('../../../../../config/environment');var logger=require(_0x5df5('0x4'))(_0x5df5('0x5'));config[_0x5df5('0x6')]=_['defaults'](config[_0x5df5('0x6')],{'host':_0x5df5('0x7'),'port':0x18eb});var io=require(_0x5df5('0x8'))(new Redis(config[_0x5df5('0x6')]));function emit(_0x9b8756,_0x2b7ed9,_0x4722a2){io['to'](_0x9b8756)[_0x5df5('0x9')](_0x2b7ed9,_0x4722a2);}function sendNotification(_0x4d43a3,_0x338f2b,_0x403d8b,_0x41941e,_0x4787f1,_0x52ed26){io['to'](util[_0x5df5('0xa')]('user:%s',_0x41941e[_0x5df5('0xb')]))[_0x5df5('0x9')]('user:save',_0x41941e);var _0x59d273=_0x52ed26||{};var _0x40322d=_0x403d8b[_0x5df5('0xc')]('.');var _0x1d0b7e={'uniqueid':_0x338f2b,'channel':_0x40322d[0x0],'id':_0x40322d[0x1],'title':_0x40322d[0x0]+_0x5df5('0xd'),'interactionId':_0x40322d[0x2],'queue':_0x4787f1?_0x4787f1[_0x5df5('0xb')]:null,'sound':_0x59d273[_0x5df5('0xe')][_0x5df5('0xf')],'shake':_0x59d273[_0x5df5('0xe')][_0x5df5('0x10')]};try{if(!_0x59d273[_0x5df5('0x11')]){_0x59d273['body']={};}if(_0x4787f1){_0x59d273[_0x5df5('0x11')]['queue']=_0x4787f1;}else if(_0x59d273[_0x5df5('0x11')][_0x5df5('0x12')]){delete _0x59d273[_0x5df5('0x11')][_0x5df5('0x12')];}_0x1d0b7e[_0x5df5('0x13')]=utils['getMustacheRender'](_0x59d273[_0x5df5('0xe')][_0x5df5('0x14')],_0x59d273);}catch(_0x591a19){_0x1d0b7e[_0x5df5('0x13')]=_0x5df5('0x15');logger[_0x5df5('0x16')](util[_0x5df5('0xa')](_0x5df5('0x17'),_0x338f2b,_0x591a19['message']));}io['to'](util['format'](_0x5df5('0x18'),_0x41941e['name']))[_0x5df5('0x9')](util[_0x5df5('0xa')](_0x5df5('0x19'),_0x4d43a3?_0x5df5('0x1a'):_0x5df5('0x1b')),_0x1d0b7e);}function writeLog(_0x4b4b57,_0x1d6474,_0x39d8a1){return logger[_0x5df5('0x1c')](util[_0x5df5('0xa')](_0x5df5('0x1d'),_0x4b4b57,_0x1d6474[_0x5df5('0xb')],_0x39d8a1));}exports['isAgentAvailable']=function(_0x2e99a1,_0x2e862d,_0x8742a7,_0x446bba){if(_0x2e862d['busy']){writeLog(_0x2e99a1,_0x2e862d,_0x5df5('0x1e'));return![];}if(!_0x2e862d[_0x5df5('0x1f')]){writeLog(_0x2e99a1,_0x2e862d,_0x5df5('0x20'));return![];}if(_0x2e862d[_0x8742a7+'Pause']){writeLog(_0x2e99a1,_0x2e862d,'PAUSE');return![];}if(_0x446bba&&_0x2e862d['hasOwnProperty'](_0x8742a7+_0x5df5('0x21'))&&_0x2e862d[_0x5df5('0x22')](_0x8742a7+_0x5df5('0x23'))){if(_0x2e862d[_0x8742a7+_0x5df5('0x21')]>0x0&&_0x2e862d[_0x8742a7+_0x5df5('0x23')]>=_0x2e862d[_0x8742a7+_0x5df5('0x21')]){writeLog(_0x2e99a1,_0x2e862d,_0x8742a7[_0x5df5('0x24')]()+_0x5df5('0x25'));return![];}}return!![];};exports['showNotification']=function(_0x18bb61,_0x4fc1a1,_0x339c71,_0x44d2c1,_0x5bc181){return sendNotification(!![],_0x18bb61,_0x4fc1a1,_0x339c71,_0x44d2c1,_0x5bc181);};exports[_0x5df5('0x26')]=function(_0x4945c6,_0xd2b213,_0x4cccf1,_0x2e1885,_0x4afe36){return sendNotification(![],_0x4945c6,_0xd2b213,_0x4cccf1,_0x2e1885,_0x4afe36);};exports[_0x5df5('0x27')]=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 b2dbab6..d80a06d 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 _0x20cb=['./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','shelljs','lodash'];(function(_0x2ede15,_0x4b7e0e){var _0x4b32dc=function(_0x4180f3){while(--_0x4180f3){_0x2ede15['push'](_0x2ede15['shift']());}};_0x4b32dc(++_0x4b7e0e);}(_0x20cb,0x12a));var _0xb20c=function(_0x4ac7d0,_0x538ebc){_0x4ac7d0=_0x4ac7d0-0x0;var _0x11a24d=_0x20cb[_0x4ac7d0];return _0x11a24d;};'use strict';var schema=require('validate');var sh=require(_0xb20c('0x0'));var _=require(_0xb20c('0x1'));var utils=require(_0xb20c('0x2'));var logger=require(_0xb20c('0x3'))('routing');var system=schema({'command':{'type':_0xb20c('0x4'),'required':!![],'message':_0xb20c('0x5')}});exports[_0xb20c('0x6')]=function(_0x5bd915,_0x1cfc0e){return function(_0x3103fd){try{var _0x1a6d94={'command':_0x1cfc0e[0x0]};var _0x49b697=system['validate'](_0x1a6d94,{'typecast':!![]});if(_0x49b697[_0xb20c('0x7')]){logger[_0xb20c('0x8')](_0xb20c('0x9'),_0x5bd915,_[_0xb20c('0xa')](_0x49b697,_0xb20c('0xb'))[_0xb20c('0xc')](',\x20'));logger[_0xb20c('0xd')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x5bd915);_0x3103fd['next']();}else{var _0x4b211d=this;var _0x53f43d=utils['getMustacheRender'](_0x1cfc0e[0x0],this);logger[_0xb20c('0xd')](_0xb20c('0xe'),_0x5bd915,_0x53f43d);sh[_0xb20c('0xf')](_[_0xb20c('0x10')](_0x53f43d),function(_0x2dda3f,_0x2dd2c6){logger[_0xb20c('0xd')](_0xb20c('0x11'),_0x5bd915,_0x2dda3f);if(_0x2dda3f==0x0){var _0x560fd7=_0x2dd2c6[_0xb20c('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0xb20c('0x13')](_0x1cfc0e[0x1])||_['isEmpty'](_0x1cfc0e[0x1])){logger[_0xb20c('0xd')](_0xb20c('0x14'),_0x5bd915);_0x4b211d[_0xb20c('0x15')][_0x1cfc0e[0x1]]=_0x560fd7;}else{logger[_0xb20c('0xd')](_0xb20c('0x16'),_0x5bd915,_0x1cfc0e[0x1],_0x560fd7);_0x4b211d[_0xb20c('0x15')][_0x1cfc0e[0x1]]=_0x560fd7;}}_0x3103fd['next']();});}}catch(_0x18660b){logger[_0xb20c('0x8')](_0xb20c('0x9'),_0x5bd915,_['isObject'](_0x18660b)?JSON[_0xb20c('0x17')](_0x18660b):_0x18660b);logger[_0xb20c('0xd')](_0xb20c('0x18'),_0x5bd915);_0x3103fd['next']();}};}; \ No newline at end of file +var _0xb806=['[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20%s','isObject','stringify','validate','./utils','../../../../config/logger','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty'];(function(_0x53f897,_0x539857){var _0x6879f8=function(_0xa3c36){while(--_0xa3c36){_0x53f897['push'](_0x53f897['shift']());}};_0x6879f8(++_0x539857);}(_0xb806,0x95));var _0x6b80=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0xb806[_0x32b542];return _0x554d54;};'use strict';var schema=require(_0x6b80('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require(_0x6b80('0x1'));var logger=require(_0x6b80('0x2'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0x6b80('0x3')}});exports['consequence']=function(_0x5a03c4,_0xf9407b){return function(_0x1196bb){try{var _0x2ab150={'command':_0xf9407b[0x0]};var _0x520aef=system[_0x6b80('0x0')](_0x2ab150,{'typecast':!![]});if(_0x520aef[_0x6b80('0x4')]){logger[_0x6b80('0x5')]('[%s][SYSTEM]\x20%s',_0x5a03c4,_[_0x6b80('0x6')](_0x520aef,_0x6b80('0x7'))[_0x6b80('0x8')](',\x20'));logger[_0x6b80('0x9')](_0x6b80('0xa'),_0x5a03c4);_0x1196bb[_0x6b80('0xb')]();}else{var _0x261a49=this;var _0x462f02=utils[_0x6b80('0xc')](_0xf9407b[0x0],this);logger[_0x6b80('0x9')](_0x6b80('0xd'),_0x5a03c4,_0x462f02);sh[_0x6b80('0xe')](_[_0x6b80('0xf')](_0x462f02),function(_0x528dc4,_0x375ccd){logger['info'](_0x6b80('0x10'),_0x5a03c4,_0x528dc4);if(_0x528dc4==0x0){var _0x3a46dd=_0x375ccd[_0x6b80('0x11')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0xf9407b[0x1])||_[_0x6b80('0x12')](_0xf9407b[0x1])){logger[_0x6b80('0x9')](_0x6b80('0x13'),_0x5a03c4);_0x261a49['body'][_0xf9407b[0x1]]=_0x3a46dd;}else{logger[_0x6b80('0x9')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x5a03c4,_0xf9407b[0x1],_0x3a46dd);_0x261a49[_0x6b80('0x14')][_0xf9407b[0x1]]=_0x3a46dd;}}_0x1196bb[_0x6b80('0xb')]();});}}catch(_0x364eb9){logger['error'](_0x6b80('0x15'),_0x5a03c4,_[_0x6b80('0x16')](_0x364eb9)?JSON[_0x6b80('0x17')](_0x364eb9):_0x364eb9);logger[_0x6b80('0x9')](_0x6b80('0xa'),_0x5a03c4);_0x1196bb[_0x6b80('0xb')]();}};}; \ 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 d772f6c..b7979c5 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 _0x4027=['isObject','stringify','validate','lodash','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','finally','[%s][TAG]\x20%s'];(function(_0x4fa3d2,_0x1bb8db){var _0x1ea3fd=function(_0x4d832e){while(--_0x4d832e){_0x4fa3d2['push'](_0x4fa3d2['shift']());}};_0x1ea3fd(++_0x1bb8db);}(_0x4027,0x188));var _0x7402=function(_0x4643d6,_0x11d5ad){_0x4643d6=_0x4643d6-0x0;var _0x365328=_0x4027[_0x4643d6];return _0x365328;};'use strict';var schema=require(_0x7402('0x0'));var _=require(_0x7402('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x7402('0x2')),'faxInteraction':require(_0x7402('0x3')),'whatsappInteraction':require(_0x7402('0x4'))};var logger=require(_0x7402('0x5'))(_0x7402('0x6'));var tag=schema({'tag':{'type':_0x7402('0x7'),'required':!![],'message':_0x7402('0x8')}});exports[_0x7402('0x9')]=function(_0x133363,_0x2eea65,_0x1127ec,_0x2ec1a3){return function(_0x173db0){try{var _0x115a2f={'tag':_0x2eea65[0x0]};var _0x44d1f5=tag[_0x7402('0x0')](_0x115a2f,{'typecast':!![]});if(_0x44d1f5['length']){logger[_0x7402('0xa')]('[%s][TAG]\x20%s',_0x133363,_['map'](_0x44d1f5,_0x7402('0xb'))[_0x7402('0xc')](',\x20'));logger[_0x7402('0xd')](_0x7402('0xe'),_0x133363);_0x173db0[_0x7402('0xf')]();}else{var _0x2eac13={'ids':[_0x2eea65[0x0]]};if(rpc[_0x2ec1a3[_0x7402('0x10')]+_0x7402('0x11')]){rpc[_0x2ec1a3[_0x7402('0x10')]+_0x7402('0x11')]['addTags'](_0x2ec1a3['interaction']['id'],_0x2eac13)[_0x7402('0x12')](function(_0xf687c2){logger[_0x7402('0xd')](_0x7402('0x13'),_0x133363,_0x2eea65[0x1],_0x2ec1a3[_0x7402('0x10')],_0x2ec1a3[_0x7402('0x14')]['id']);})[_0x7402('0x15')](function(_0x3c9ef2){logger['error']('[%s][TAG]\x20%s',_0x133363,JSON['stringify'](_0x3c9ef2));logger[_0x7402('0xd')](_0x7402('0xe'),_0x133363);})[_0x7402('0x16')](function(){_0x173db0[_0x7402('0xf')]();});}}}catch(_0x2475de){logger['error'](_0x7402('0x17'),_0x133363,_[_0x7402('0x18')](_0x2475de)?JSON[_0x7402('0x19')](_0x2475de):_0x2475de);logger['info'](_0x7402('0xe'),_0x133363);_0x173db0[_0x7402('0xf')]();}};}; \ No newline at end of file +var _0xdcc0=['TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','join','info','next','channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','isObject','validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger'];(function(_0x10acb2,_0x3ca870){var _0x186379=function(_0x294bbd){while(--_0x294bbd){_0x10acb2['push'](_0x10acb2['shift']());}};_0x186379(++_0x3ca870);}(_0xdcc0,0x17f));var _0x0dcc=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xdcc0[_0x5ddb1c];return _0x354adc;};'use strict';var schema=require(_0x0dcc('0x0'));var _=require(_0x0dcc('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x0dcc('0x2')),'smsInteraction':require(_0x0dcc('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x0dcc('0x4')),'whatsappInteraction':require(_0x0dcc('0x5'))};var logger=require(_0x0dcc('0x6'))('routing');var tag=schema({'tag':{'type':'number','required':!![],'message':_0x0dcc('0x7')}});exports[_0x0dcc('0x8')]=function(_0x311095,_0x2785c1,_0x37d22e,_0x9f8ae0){return function(_0x266a98){try{var _0x20c364={'tag':_0x2785c1[0x0]};var _0x48ceb6=tag['validate'](_0x20c364,{'typecast':!![]});if(_0x48ceb6[_0x0dcc('0x9')]){logger[_0x0dcc('0xa')](_0x0dcc('0xb'),_0x311095,_[_0x0dcc('0xc')](_0x48ceb6,_0x0dcc('0xd'))[_0x0dcc('0xe')](',\x20'));logger[_0x0dcc('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x311095);_0x266a98[_0x0dcc('0x10')]();}else{var _0x2bdf7d={'ids':[_0x2785c1[0x0]]};if(rpc[_0x9f8ae0[_0x0dcc('0x11')]+'Interaction']){rpc[_0x9f8ae0['channel']+_0x0dcc('0x12')][_0x0dcc('0x13')](_0x9f8ae0['interaction']['id'],_0x2bdf7d)[_0x0dcc('0x14')](function(_0xb5dcde){logger[_0x0dcc('0xf')](_0x0dcc('0x15'),_0x311095,_0x2785c1[0x1],_0x9f8ae0[_0x0dcc('0x11')],_0x9f8ae0['interaction']['id']);})[_0x0dcc('0x16')](function(_0x2f6f73){logger[_0x0dcc('0xa')]('[%s][TAG]\x20%s',_0x311095,JSON['stringify'](_0x2f6f73));logger['info'](_0x0dcc('0x17'),_0x311095);})[_0x0dcc('0x18')](function(){_0x266a98[_0x0dcc('0x10')]();});}}}catch(_0xb98a){logger['error'](_0x0dcc('0xb'),_0x311095,_[_0x0dcc('0x19')](_0xb98a)?JSON['stringify'](_0xb98a):_0xb98a);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x311095);_0x266a98[_0x0dcc('0x10')]();}};}; \ 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 c4b2271..5b77d21 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 _0xdc50=['params','stringify','POST','application/json-rpc','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','urlOnAnswer','?params=','urlOnRing','jsonrpc','2.0','push'];(function(_0x2053ea,_0x1ab2d4){var _0x2232c4=function(_0x4230df){while(--_0x4230df){_0x2053ea['push'](_0x2053ea['shift']());}};_0x2232c4(++_0x1ab2d4);}(_0xdc50,0x109));var _0x0dc5=function(_0x2e1410,_0x31590a){_0x2e1410=_0x2e1410-0x0;var _0x18d9a8=_0xdc50[_0x2e1410];return _0x18d9a8;};'use strict';var rp=require(_0x0dc5('0x0'));var logger=require(_0x0dc5('0x1'))(_0x0dc5('0x2'));var _=require(_0x0dc5('0x3'));var arr=[];exports[_0x0dc5('0x4')]=function(_0x16f465,_0x56a2ec){return function(_0x27b8a1){var _0x264ea8=_0x56a2ec[0xa];var _0x1d6d6e=_0x56a2ec[0xb];var _0x3c230c=_0x56a2ec[0xc];var _0x54fb79=_0x56a2ec[0xd];var _0x229e40=_0x56a2ec[0xe];var _0x5122f2=_0x56a2ec[0xf][_0x0dc5('0x5')](/\n/g,_0x0dc5('0x6'));var _0x461517=_0x56a2ec[0x10][_0x0dc5('0x5')](/\n/g,'\x20');if(!arr[_0x0dc5('0x7')](_0x1d6d6e)){arr['push'](_0x1d6d6e);var _0x426708=_0x56a2ec[0x3];var _0x2ee0c7=_0x56a2ec[0x4];var _0x200a7c=_0x56a2ec[0x1];var _0x29b20a=_0x56a2ec[0x0];var _0x11aadf={};_0x11aadf[_0x0dc5('0x8')]=_0x56a2ec[0x8]+_0x0dc5('0x9')+_0x3c230c+'|'+_0x264ea8+'|'+_0x54fb79+'|'+_0x1d6d6e+'|'+_0x229e40;_0x11aadf[_0x0dc5('0xa')]=_0x56a2ec[0x7]+_0x0dc5('0x9')+_0x3c230c+'|'+_0x264ea8+'|'+_0x54fb79+'|'+_0x1d6d6e+'|'+_0x229e40+'|'+_0x5122f2+'|'+_0x461517;_0x11aadf['title']=_0x56a2ec[0x9];var _0x5be1db={};_0x5be1db[_0x0dc5('0xb')]=_0x0dc5('0xc');_0x5be1db['method']='login';var _0x16b628=[];_0x16b628['push'](_0x56a2ec[0x2]);_0x16b628[_0x0dc5('0xd')](_0x56a2ec[0x5]);_0x16b628[_0x0dc5('0xd')](_0x56a2ec[0x6]);_0x5be1db[_0x0dc5('0xe')]=_0x16b628;_0x5be1db['id']=0x1;var _0x53dd0e=JSON[_0x0dc5('0xf')](_0x5be1db);var _0x3174f8={'encoding':'utf8','method':_0x0dc5('0x10'),'timeout':0x2710,'url':_0x426708,'headers':{'Content-Type':_0x0dc5('0x11')},'body':_0x53dd0e};return rp(_0x3174f8)['then'](function(_0x1ddf60){const _0xbca206=JSON['parse'](_0x1ddf60);if(!_0xbca206['result'][_0x0dc5('0x12')]){throw new Error(_0x0dc5('0x13'));}var _0x35ca3d=_0x1d6d6e;var _0x4b1113=_0x0dc5('0x14')+_0x200a7c+_0x0dc5('0x15')+_0x29b20a+_0x0dc5('0x16')+_0x35ca3d+'&data='+JSON['stringify'](_0x11aadf);var _0x37e02e=_0x2ee0c7+'?'+_0x4b1113;return rp(_0x37e02e);})[_0x0dc5('0x17')](function(_0x12f6fc){logger[_0x0dc5('0x18')](_0x0dc5('0x19'),_0x16f465,_0x12f6fc);_0x27b8a1[_0x0dc5('0x1a')]();})['catch'](function(_0x487341){logger['error'](_0x0dc5('0x1b'),_0x16f465,_[_0x0dc5('0x1c')](_0x487341)?JSON[_0x0dc5('0xf')](_0x487341):_0x487341);_0x27b8a1[_0x0dc5('0x1a')]();});}else{logger[_0x0dc5('0x18')](_0x0dc5('0x1d'),_0x16f465);_0x27b8a1[_0x0dc5('0x1e')]();}};}; \ No newline at end of file +var _0x8212=['info','[%s][TVOX]\x20%s','isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','../../../../config/logger','routing','consequence','\x20-\x20','replace','includes','urlOnAnswer','?params=','title','jsonrpc','2.0','method','login','params','stringify','POST','then','result','Unable\x20to\x20login\x20with\x20TVox\x20application','&data='];(function(_0x272156,_0x5e4b0d){var _0x1071d0=function(_0x5f1f6b){while(--_0x5f1f6b){_0x272156['push'](_0x272156['shift']());}};_0x1071d0(++_0x5e4b0d);}(_0x8212,0x1bf));var _0x2821=function(_0x2f8fc5,_0x5804a7){_0x2f8fc5=_0x2f8fc5-0x0;var _0x392d45=_0x8212[_0x2f8fc5];return _0x392d45;};'use strict';var rp=require(_0x2821('0x0'));var logger=require(_0x2821('0x1'))(_0x2821('0x2'));var _=require('lodash');var arr=[];exports[_0x2821('0x3')]=function(_0x33573b,_0x268274){return function(_0x49cb93){var _0xbbb2ec=_0x268274[0xa];var _0x834362=_0x268274[0xb];var _0x3e46b1=_0x268274[0xc];var _0x6950f5=_0x268274[0xd];var _0x5deb4e=_0x268274[0xe];var _0x5c67e7=_0x268274[0xf]['replace'](/\n/g,_0x2821('0x4'));var _0x14889b=_0x268274[0x10][_0x2821('0x5')](/\n/g,'\x20');if(!arr[_0x2821('0x6')](_0x834362)){arr['push'](_0x834362);var _0x24456b=_0x268274[0x3];var _0x145ad2=_0x268274[0x4];var _0x51d228=_0x268274[0x1];var _0xfdd486=_0x268274[0x0];var _0x2084bb={};_0x2084bb[_0x2821('0x7')]=_0x268274[0x8]+_0x2821('0x8')+_0x3e46b1+'|'+_0xbbb2ec+'|'+_0x6950f5+'|'+_0x834362+'|'+_0x5deb4e;_0x2084bb['urlOnRing']=_0x268274[0x7]+'?params='+_0x3e46b1+'|'+_0xbbb2ec+'|'+_0x6950f5+'|'+_0x834362+'|'+_0x5deb4e+'|'+_0x5c67e7+'|'+_0x14889b;_0x2084bb[_0x2821('0x9')]=_0x268274[0x9];var _0x296c53={};_0x296c53[_0x2821('0xa')]=_0x2821('0xb');_0x296c53[_0x2821('0xc')]=_0x2821('0xd');var _0x466c4b=[];_0x466c4b['push'](_0x268274[0x2]);_0x466c4b['push'](_0x268274[0x5]);_0x466c4b['push'](_0x268274[0x6]);_0x296c53[_0x2821('0xe')]=_0x466c4b;_0x296c53['id']=0x1;var _0x5c6658=JSON[_0x2821('0xf')](_0x296c53);var _0x2ebfbe={'encoding':'utf8','method':_0x2821('0x10'),'timeout':0x2710,'url':_0x24456b,'headers':{'Content-Type':'application/json-rpc'},'body':_0x5c6658};return rp(_0x2ebfbe)[_0x2821('0x11')](function(_0x567e8f){const _0x57cb5e=JSON['parse'](_0x567e8f);if(!_0x57cb5e[_0x2821('0x12')]['logged']){throw new Error(_0x2821('0x13'));}var _0x30cc98=_0x834362;var _0x5a32cc='channelId='+_0x51d228+'&serviceId='+_0xfdd486+'&sessionId='+_0x30cc98+_0x2821('0x14')+JSON[_0x2821('0xf')](_0x2084bb);var _0xffedd=_0x145ad2+'?'+_0x5a32cc;return rp(_0xffedd);})['then'](function(_0x3ca3ec){logger[_0x2821('0x15')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x33573b,_0x3ca3ec);_0x49cb93['stop']();})['catch'](function(_0x3308ea){logger['error'](_0x2821('0x16'),_0x33573b,_[_0x2821('0x17')](_0x3308ea)?JSON[_0x2821('0xf')](_0x3308ea):_0x3308ea);_0x49cb93[_0x2821('0x18')]();});}else{logger[_0x2821('0x15')](_0x2821('0x19'),_0x33573b);_0x49cb93['next']();}};}; \ 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 6df02d6..47434be 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['merge','body','account','list','exports','render'];(function(_0x5e6e89,_0x138ee6){var _0x2c17a5=function(_0x102579){while(--_0x102579){_0x5e6e89['push'](_0x5e6e89['shift']());}};_0x2c17a5(++_0x138ee6);}(_0x9c44,0x178));var _0x49c4=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9c44[_0x4f9b18];return _0x29f20c;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x289bb7,_0xa3684c){var _0x4d85be=function(_0x557cb3){while(--_0x557cb3){_0x289bb7['push'](_0x289bb7['shift']());}};_0x4d85be(++_0xa3684c);}(_0xe706,0xa3));var _0x6e70=function(_0x155924,_0x2a5368){_0x155924=_0x155924-0x0;var _0x262e4b=_0xe706[_0x155924];return _0x262e4b;};'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 diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 3eb4d14..9496e6a 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 _0x705f=['name','paused','waiting','mailQueues','available','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','path','bluebird','uuid','./applications/utils','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','format','isNil','IntervalId','map','Intervals','interval','listen','rules','channel','message','interaction','applications','length','join','.js','app','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflow','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','body','%s:%s:%s','condition','intervals','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','update','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','chatQueues','loggedIn'];(function(_0x2ad455,_0x55a29b){var _0x3c2ea0=function(_0x2b7edf){while(--_0x2b7edf){_0x2ad455['push'](_0x2ad455['shift']());}};_0x3c2ea0(++_0x55a29b);}(_0x705f,0x75));var _0xf705=function(_0x27097a,_0x1b7f8b){_0x27097a=_0x27097a-0x0;var _0x26378b=_0x705f[_0x27097a];return _0x26378b;};'use strict';var _=require('lodash');var util=require('util');var path=require(_0xf705('0x0'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xf705('0x1'));var uuid=require(_0xf705('0x2'));var utils=require(_0xf705('0x3'));var config=require(_0xf705('0x4'));var logger=require(_0xf705('0x5'))(_0xf705('0x6'));var rpc={'openchannelQueueReport':require(_0xf705('0x7')),'mailQueueReport':require(_0xf705('0x8')),'chatQueueReport':require(_0xf705('0x9')),'smsQueueReport':require(_0xf705('0xa')),'faxQueueReport':require(_0xf705('0xb')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0xc244e3,_0x58cae9,_0x1e45ad){return util[_0xf705('0xc')]('%s.%s.%s',_0xc244e3,_0x58cae9||0x0,_0x1e45ad||0x0);}function getIntervals(_0x4bd6fd,_0x1f9ab1){var _0xc6fbde=[];if(!_[_0xf705('0xd')](_0x1f9ab1[_0xf705('0xe')])&&!_[_0xf705('0xd')](_0x4bd6fd[_0x1f9ab1[_0xf705('0xe')]])&&!_[_0xf705('0xd')](_0x4bd6fd[_0x1f9ab1[_0xf705('0xe')]]['Intervals'])){_0xc6fbde=_[_0xf705('0xf')](_0x4bd6fd[_0x1f9ab1[_0xf705('0xe')]][_0xf705('0x10')],_0xf705('0x11'));}else if(!_[_0xf705('0xd')](_0x1f9ab1['interval'])){_0xc6fbde=[_0x1f9ab1['interval']];}return _0xc6fbde;}exports[_0xf705('0x12')]=function(_0x10763f){_0x10763f[_0xf705('0x13')]={};return new BPromise(function(_0x15ab66,_0x57d132){var _0x9c7b75={'Start':function(_0x23a64b){var _0x4555a8=this;return new Promise(function(_0x32f48b,_0x572efc){if(_0x23a64b){try{var _0x11dcbc=[];var _0x479b31=getId(_0x23a64b[_0xf705('0x14')],_0x23a64b[_0xf705('0x15')]?_0x23a64b['message']['id']:0x0,_0x23a64b[_0xf705('0x16')]?_0x23a64b['interaction']['id']:0x0);if(_0x23a64b[_0xf705('0x17')]&&_['isArray'](_0x23a64b['applications'])&&_0x23a64b[_0xf705('0x17')][_0xf705('0x18')]){for(var _0x2d9bd5=0x0;_0x2d9bd5<_0x23a64b['applications'][_0xf705('0x18')];_0x2d9bd5+=0x1){var _0x7e27b4=_0x23a64b[_0xf705('0x17')][_0x2d9bd5];if(fs['existsSync'](path[_0xf705('0x19')](__dirname,'applications',_0x7e27b4['app']+_0xf705('0x1a')))){var _0x1052a6=[];switch(_0x7e27b4[_0xf705('0x1b')][_0xf705('0x1c')]()){case _0xf705('0x1d'):var _0x3f29c0=_0x7e27b4[_0xf705('0x1e')][_0xf705('0x1f')](',');if(_0x23a64b[_0xf705('0x14')]===_0xf705('0x20')){_0x1052a6[_0xf705('0x21')](_0x3f29c0[0x0]);_0x1052a6['push'](_0x3f29c0[0x1]);_0x1052a6[_0xf705('0x21')](_0x3f29c0['slice'](0x2,_0x3f29c0[_0xf705('0x18')])['join'](','));}else{_0x1052a6['push'](_0x3f29c0[0x0]);_0x1052a6[_0xf705('0x21')](_0x3f29c0[_0xf705('0x22')](0x1,_0x3f29c0['length'])['join'](','));}break;case _0xf705('0x23'):var _0xcf86d6=_0x7e27b4[_0xf705('0x1e')][_0xf705('0x1f')](',');_0x1052a6[_0xf705('0x21')](_0xcf86d6[0x0]);_0x1052a6['push'](_0xcf86d6[0x1]);_0x1052a6[_0xf705('0x21')](_0xcf86d6[_0xf705('0x22')](0x2,_0xcf86d6[_0xf705('0x18')])['join'](','));break;case'dialogflowv2':var _0x4a0fd3=_0x7e27b4['appdata'][_0xf705('0x1f')](',');_0x1052a6['push'](_0x4a0fd3[0x0]);_0x1052a6['push'](_0x4a0fd3[0x1]);_0x1052a6[_0xf705('0x21')](_0x4a0fd3[0x2]);_0x1052a6[_0xf705('0x21')](_0x4a0fd3[0x3]);_0x1052a6[_0xf705('0x21')](_0x4a0fd3[_0xf705('0x22')](0x4,_0x4a0fd3[_0xf705('0x18')])['join'](','));break;case'amazonlex':var _0x105393=_0x7e27b4[_0xf705('0x1e')][_0xf705('0x1f')](',');_0x1052a6[_0xf705('0x21')](_0x105393[0x0]);_0x1052a6[_0xf705('0x21')](_0x105393[0x1]);_0x1052a6[_0xf705('0x21')](_0x105393[0x2]);_0x1052a6[_0xf705('0x21')](_0x105393[0x3]);_0x1052a6[_0xf705('0x21')](_0x105393['slice'](0x4,_0x105393[_0xf705('0x18')])['join'](','));break;case _0xf705('0x15'):_0x1052a6['push'](_0x7e27b4[_0xf705('0x1e')]);break;case _0xf705('0x24'):_0x1052a6[_0xf705('0x21')](_0x7e27b4[_0xf705('0x25')]);_0x1052a6[_0xf705('0x21')](_0x7e27b4[_0xf705('0x1e')]);break;case _0xf705('0x26'):var _0x5e90be=utils[_0xf705('0x27')](_0x23a64b[_0xf705('0x28')][_0xf705('0x29')],_0x23a64b);var _0x549a3d=_0x7e27b4['appdata'][_0xf705('0x1f')](',');_0x1052a6['push'](_0x549a3d[0x0]);_0x1052a6[_0xf705('0x21')](_0x549a3d[0x1]);_0x1052a6[_0xf705('0x21')](_0x549a3d[0x2]);_0x1052a6[_0xf705('0x21')](_0x549a3d[0x3]);_0x1052a6['push'](_0x549a3d[0x4]);_0x1052a6[_0xf705('0x21')](_0x549a3d[0x5]);_0x1052a6['push'](_0x549a3d[0x6]);_0x1052a6[_0xf705('0x21')](_0x549a3d[0x7]);_0x1052a6[_0xf705('0x21')](_0x549a3d[0x8]);_0x1052a6[_0xf705('0x21')](_0x549a3d[0x9]);_0x1052a6['push'](_0x549a3d[0xa]);_0x1052a6[_0xf705('0x21')](_0x23a64b['interaction']['id']);_0x1052a6[_0xf705('0x21')](_0x23a64b[_0xf705('0x15')]['id']);_0x1052a6[_0xf705('0x21')](_0x7e27b4[_0xf705('0x2a')]);_0x1052a6[_0xf705('0x21')](_0x23a64b[_0xf705('0x16')]['ContactId']);_0x1052a6[_0xf705('0x21')](_0x23a64b[_0xf705('0x2b')][_0xf705('0x2b')]);_0x1052a6[_0xf705('0x21')](_0x5e90be);break;default:_0x1052a6=_['isNil'](_0x7e27b4['appdata'])?[]:_0x7e27b4[_0xf705('0x1e')][_0xf705('0x1f')](',');}var _0x5302e8={'id':util[_0xf705('0xc')](_0xf705('0x2c'),_0x479b31,_0x7e27b4['id'],_0x7e27b4[_0xf705('0x1b')]),'condition':require('./interval')[_0xf705('0x2d')](_0x479b31,getIntervals(_0x10763f[_0xf705('0x2e')],_0x7e27b4),_0x10763f),'consequence':require('./applications/'+_0x7e27b4[_0xf705('0x1b')])[_0xf705('0x2f')](_0x479b31,_0x1052a6,_0x10763f,_0x23a64b),'p':_0x7e27b4[_0xf705('0x30')]||0x0};logger[_0xf705('0x31')](_0xf705('0x32'),_0x5302e8['id'],_0xf705('0x33'),getIntervals(_0x10763f[_0xf705('0x2e')],_0x7e27b4)[_0xf705('0x19')](_0xf705('0x34')));_0x11dcbc[_0xf705('0x21')](_0x5302e8);}else{logger[_0xf705('0x35')]('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,'applications',_0x7e27b4[_0xf705('0x1b')]+_0xf705('0x1a')));}}_0x10763f[_0xf705('0x13')][_0x479b31]=new RuleEngine(_0x11dcbc);_0x10763f['rules'][_0x479b31][_0xf705('0x36')](_0x23a64b,function(_0xf90018){logger[_0xf705('0x31')](_0xf705('0x37'),JSON[_0xf705('0x38')](_0xf90018[_0xf705('0x39')]));if(_0x10763f['rules'][_0x479b31]){_0x10763f['rules'][_0x479b31][_0xf705('0x3a')](_0xf705('0x3b'));}});return _0x32f48b({'code':0xc8,'message':_0x23a64b});}else{logger['info'](_0xf705('0x3c'));return _0x32f48b({'code':0xc8,'message':_0x23a64b});}}catch(_0x1dd6f5){logger[_0xf705('0x35')](_0x1dd6f5[_0xf705('0x3d')]);return _0x572efc(_0x4555a8['error'](0x1f4,_0x1dd6f5));}}return _0x572efc(_0xf705('0x3e'));});},'AcceptMessage':function(_0x416334){var _0x512845=this;return new Promise(function(_0x2c0252,_0x2131e0){if(_0x416334[_0xf705('0x3f')]&&_0x416334[_0xf705('0x3f')]['id']){if(_0x10763f[_0xf705('0x40')][_0x416334[_0xf705('0x3f')]['id']]){_0x10763f[_0xf705('0x40')][_0x416334[_0xf705('0x3f')]['id']][_0xf705('0x41')]=![];_0x10763f['agents'][_0x416334['agent']['id']][_0xf705('0x42')]=undefined;}}if(_0x416334[_0xf705('0x15')]&&_0x416334['message']['id']){try{var _0x26bfa9=getId(_0x416334[_0xf705('0x14')],_0x416334[_0xf705('0x15')]?_0x416334[_0xf705('0x15')]['id']:0x0,_0x416334[_0xf705('0x16')]?_0x416334[_0xf705('0x16')]['id']:0x0);if(_0x10763f['rules'][_0x26bfa9]){_0x10763f['rules'][_0x26bfa9]['emit'](_0xf705('0x43'));if(rpc[_0x416334[_0xf705('0x14')]+_0xf705('0x44')]){rpc[_0x416334['channel']+_0xf705('0x44')][_0xf705('0x45')](_0x26bfa9,{'UserId':_0x416334[_0xf705('0x15')]['UserId']})['catch'](function(_0x573d0a){logger[_0xf705('0x35')](_0xf705('0x46'));});}}return _0x2c0252({'code':0xc8,'message':_0x416334});}catch(_0x233370){logger[_0xf705('0x35')](_0x233370[_0xf705('0x3d')]);return _0x2131e0(_0x512845[_0xf705('0x35')](0x1f4,_0x233370));}}logger['error'](_0xf705('0x47'));return _0x2131e0(_0x512845[_0xf705('0x35')](0x1f4,_0xf705('0x47')));});},'RejectMessage':function(_0x10f4c4){var _0x20df2e=this;return new Promise(function(_0x34c3aa,_0x5148be){if(_0x10f4c4['agent']&&_0x10f4c4[_0xf705('0x3f')]['id']){try{if(_0x10763f[_0xf705('0x40')][_0x10f4c4[_0xf705('0x3f')]['id']]){_0x10763f[_0xf705('0x40')][_0x10f4c4['agent']['id']][_0xf705('0x41')]=![];_0x10763f[_0xf705('0x40')][_0x10f4c4[_0xf705('0x3f')]['id']][_0xf705('0x42')]=undefined;}return _0x34c3aa({'code':0xc8,'message':_0x10f4c4});}catch(_0x405177){logger[_0xf705('0x35')](_0x405177[_0xf705('0x3d')]);return _0x5148be(_0x20df2e[_0xf705('0x35')](0x1f4,_0x405177));}}logger[_0xf705('0x35')](_0xf705('0x47'));return _0x5148be(_0x20df2e[_0xf705('0x35')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x2df632){var _0x457827=this;return new Promise(function(_0x41559b,_0x467c39){if(_0x2df632[_0xf705('0x14')]&&_0x2df632[_0xf705('0x16')]&&_0x2df632[_0xf705('0x16')]['id']){try{var _0x25f9b4=getId(_0x2df632[_0xf705('0x14')],_0x2df632[_0xf705('0x15')]?_0x2df632[_0xf705('0x15')]['id']:0x0,_0x2df632[_0xf705('0x16')]?_0x2df632[_0xf705('0x16')]['id']:0x0);if(_0x10763f['rules'][_0x25f9b4]){_0x10763f[_0xf705('0x13')][_0x25f9b4][_0xf705('0x3a')](_0xf705('0x43'));}return _0x41559b({'code':0xc8,'message':_0x2df632});}catch(_0x110e50){logger[_0xf705('0x35')](_0x110e50[_0xf705('0x3d')]);return _0x467c39(_0x457827['error'](0x1f4,_0x110e50));}}logger[_0xf705('0x35')](_0xf705('0x47'));return _0x467c39(_0x457827['error'](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x2c4a23){var _0x3be06d=this;return new Promise(function(_0x4088a8,_0x4c07f1){if(_0x10763f[_0xf705('0x40')][_0xf705('0x48')](_0x2c4a23['id'])){for(var _0x52b73f in _0x2c4a23[_0xf705('0x49')]){if(_0x2c4a23['capacity'][_0xf705('0x48')](_0x52b73f)){if(_0x10763f['agents'][_0x2c4a23['id']][_0xf705('0x48')](_0x52b73f+_0xf705('0x4a'))){_0x10763f[_0xf705('0x40')][_0x2c4a23['id']][_0x52b73f+_0xf705('0x4a')]=parseInt(_0x2c4a23['capacity'][_0x52b73f],0xa);}}}_0x10763f['agents'][_0x2c4a23['id']][_0xf705('0x4b')]();return _0x4088a8({'code':0xc8,'message':_0x10763f[_0xf705('0x40')][_0x2c4a23['id']]});}else{return _0x4c07f1(_0x3be06d[_0xf705('0x35')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x2c9871){return new Promise(function(_0x5b1106,_0x520423){var _0x2d7aa1=_[_0xf705('0x4c')](_0x10763f[_0xf705('0x40')]);_0x5b1106({'count':_0x2d7aa1[_0xf705('0x18')],'rows':_0x2d7aa1});});},'ChatQueues':function(_0x1263a9){return new Promise(function(_0x5b5ce5,_0x32ead1){var _0x22964d=[];for(var _0x1cd5ef in _0x10763f['chatQueues']){if(_0x10763f[_0xf705('0x4d')][_0xf705('0x48')](_0x1cd5ef)){var _0x4fade7=_0x10763f[_0xf705('0x4d')][_0x1cd5ef];var _0x5131d4={'id':_0x4fade7['id'],'available':_0x4fade7['available'],'loggedIn':_0x4fade7[_0xf705('0x4e')],'name':_0x4fade7[_0xf705('0x4f')],'paused':_0x4fade7[_0xf705('0x50')],'waiting':_0x4fade7[_0xf705('0x51')]};_0x22964d[_0xf705('0x21')](_0x5131d4);}}_0x5b5ce5({'count':_0x22964d[_0xf705('0x18')],'rows':_0x22964d});});},'MailQueues':function(_0x384167){return new Promise(function(_0x33cde9,_0xf3c3ea){var _0x471a19=[];for(var _0x3a955a in _0x10763f[_0xf705('0x52')]){if(_0x10763f[_0xf705('0x52')]['hasOwnProperty'](_0x3a955a)){var _0x337763=_0x10763f[_0xf705('0x52')][_0x3a955a];var _0x145bc7={'id':_0x337763['id'],'available':_0x337763[_0xf705('0x53')],'loggedIn':_0x337763[_0xf705('0x4e')],'name':_0x337763[_0xf705('0x4f')],'paused':_0x337763[_0xf705('0x50')],'waiting':_0x337763[_0xf705('0x51')]};_0x471a19[_0xf705('0x21')](_0x145bc7);}}_0x33cde9({'count':_0x471a19['length'],'rows':_0x471a19});});},'OpenchannelQueues':function(_0x5e45f5){return new Promise(function(_0x4a8b9e,_0xfbe9d0){var _0x209eef=[];for(var _0x32a90f in _0x10763f[_0xf705('0x54')]){if(_0x10763f['openchannelQueues'][_0xf705('0x48')](_0x32a90f)){var _0x1a6372=_0x10763f[_0xf705('0x54')][_0x32a90f];var _0x929cae={'id':_0x1a6372['id'],'available':_0x1a6372['available'],'loggedIn':_0x1a6372[_0xf705('0x4e')],'name':_0x1a6372['name'],'paused':_0x1a6372[_0xf705('0x50')],'waiting':_0x1a6372[_0xf705('0x51')]};_0x209eef[_0xf705('0x21')](_0x929cae);}}_0x4a8b9e({'count':_0x209eef['length'],'rows':_0x209eef});});},'SmsQueues':function(_0x46c30d){return new Promise(function(_0x62068a,_0x2e4287){var _0xb69d8=[];for(var _0x1641b0 in _0x10763f[_0xf705('0x55')]){if(_0x10763f[_0xf705('0x55')]['hasOwnProperty'](_0x1641b0)){var _0x1edf99=_0x10763f[_0xf705('0x55')][_0x1641b0];var _0x17faff={'id':_0x1edf99['id'],'available':_0x1edf99[_0xf705('0x53')],'loggedIn':_0x1edf99[_0xf705('0x4e')],'name':_0x1edf99[_0xf705('0x4f')],'paused':_0x1edf99[_0xf705('0x50')],'waiting':_0x1edf99[_0xf705('0x51')]};_0xb69d8[_0xf705('0x21')](_0x17faff);}}_0x62068a({'count':_0xb69d8[_0xf705('0x18')],'rows':_0xb69d8});});},'FaxQueues':function(_0x54618c){return new Promise(function(_0x2179ad,_0x3c6865){var _0x3071f5=[];for(var _0xe896cb in _0x10763f[_0xf705('0x56')]){if(_0x10763f['faxQueues'][_0xf705('0x48')](_0xe896cb)){var _0x59cc74=_0x10763f[_0xf705('0x56')][_0xe896cb];var _0x81d480={'id':_0x59cc74['id'],'available':_0x59cc74[_0xf705('0x53')],'loggedIn':_0x59cc74['loggedIn'],'name':_0x59cc74[_0xf705('0x4f')],'paused':_0x59cc74[_0xf705('0x50')],'waiting':_0x59cc74[_0xf705('0x51')]};_0x3071f5[_0xf705('0x21')](_0x81d480);}}_0x2179ad({'count':_0x3071f5[_0xf705('0x18')],'rows':_0x3071f5});});},'WhatsappQueues':function(_0x1811f1){return new Promise(function(_0x474c4d,_0x153dc0){var _0xeaa0e5=[];for(var _0x75bda3 in _0x10763f[_0xf705('0x57')]){if(_0x10763f['whatsappQueues'][_0xf705('0x48')](_0x75bda3)){var _0x569db9=_0x10763f[_0xf705('0x57')][_0x75bda3];var _0x5d2faa={'id':_0x569db9['id'],'available':_0x569db9[_0xf705('0x53')],'loggedIn':_0x569db9['loggedIn'],'name':_0x569db9[_0xf705('0x4f')],'paused':_0x569db9[_0xf705('0x50')],'waiting':_0x569db9[_0xf705('0x51')]};_0xeaa0e5['push'](_0x5d2faa);}}_0x474c4d({'count':_0xeaa0e5[_0xf705('0x18')],'rows':_0xeaa0e5});});},'ChatQueuesWaitingInteractions':function(_0x9a39e){return new Promise(function(_0x4a83cb,_0x573b8d){var _0x231485=_[_0xf705('0x4c')](_0x10763f[_0xf705('0x58')]);_0x4a83cb({'count':_0x231485[_0xf705('0x18')],'rows':_0x231485});});},'MailQueuesWaitingInteractions':function(_0x4d5884){return new Promise(function(_0x4d5466,_0x328d41){var _0x5be6c3=_['values'](_0x10763f[_0xf705('0x59')]);_0x4d5466({'count':_0x5be6c3['length'],'rows':_0x5be6c3});});},'OpenchannelQueuesWaitingInteractions':function(_0x1b7284){return new Promise(function(_0x5e70fd,_0xbdd9a0){var _0x5600f8=_['values'](_0x10763f[_0xf705('0x5a')]);_0x5e70fd({'count':_0x5600f8[_0xf705('0x18')],'rows':_0x5600f8});});},'SmsQueuesWaitingInteractions':function(_0x52b3cf){return new Promise(function(_0xb7c4a3,_0x3e0d97){var _0x22b511=_[_0xf705('0x4c')](_0x10763f[_0xf705('0x5b')]);_0xb7c4a3({'count':_0x22b511[_0xf705('0x18')],'rows':_0x22b511});});},'FaxQueuesWaitingInteractions':function(_0x54de69){return new Promise(function(_0x3527dd,_0x279e67){var _0xad2210=_[_0xf705('0x4c')](_0x10763f['faxQueuesWaitingInteractions']);_0x3527dd({'count':_0xad2210[_0xf705('0x18')],'rows':_0xad2210});});},'WhatsappQueuesWaitingInteractions':function(_0x1293db){return new Promise(function(_0x1b4edb,_0x1eb293){var _0x500d18=_[_0xf705('0x4c')](_0x10763f[_0xf705('0x5c')]);_0x1b4edb({'count':_0x500d18['length'],'rows':_0x500d18});});}};var _0x154cdd=jayson[_0xf705('0x5d')](_0x9c7b75)[_0xf705('0x5e')]();_0x154cdd['on'](_0xf705('0x35'),function(_0x67eea4){logger['error'](JSON[_0xf705('0x38')](_0x67eea4));return _0x57d132(_0x67eea4);});_0x154cdd['listen'](0x232c,_0xf705('0x5f'),function(){console[_0xf705('0x60')](_0xf705('0x61'),0x232c);return _0x15ab66('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x5db8=['../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','map','Intervals','interval','listen','rules','channel','message','interaction','applications','isArray','length','join','app','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflow','dialogflowv2','amazonlex','tag','tvox','account','notificationTemplate','ChatWebsiteId','ContactId','./interval','intervals','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','agent','agents','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','bluebird','uuid','./applications/utils','routing'];(function(_0x131fe7,_0x21fcdb){var _0x2eddf3=function(_0x1be350){while(--_0x1be350){_0x131fe7['push'](_0x131fe7['shift']());}};_0x2eddf3(++_0x21fcdb);}(_0x5db8,0xbb));var _0x85db=function(_0x404cde,_0x27b51c){_0x404cde=_0x404cde-0x0;var _0x139882=_0x5db8[_0x404cde];return _0x139882;};'use strict';var _=require(_0x85db('0x0'));var util=require(_0x85db('0x1'));var path=require(_0x85db('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x85db('0x3'));var uuid=require(_0x85db('0x4'));var utils=require(_0x85db('0x5'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x85db('0x6'));var rpc={'openchannelQueueReport':require(_0x85db('0x7')),'mailQueueReport':require(_0x85db('0x8')),'chatQueueReport':require(_0x85db('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x85db('0xa'))};var RuleEngine=require(_0x85db('0xb'));function getId(_0xc6fd00,_0x308988,_0x59a522){return util[_0x85db('0xc')]('%s.%s.%s',_0xc6fd00,_0x308988||0x0,_0x59a522||0x0);}function getIntervals(_0x18e5d1,_0x27819d){var _0x42c287=[];if(!_[_0x85db('0xd')](_0x27819d['IntervalId'])&&!_['isNil'](_0x18e5d1[_0x27819d['IntervalId']])&&!_[_0x85db('0xd')](_0x18e5d1[_0x27819d[_0x85db('0xe')]]['Intervals'])){_0x42c287=_[_0x85db('0xf')](_0x18e5d1[_0x27819d['IntervalId']][_0x85db('0x10')],_0x85db('0x11'));}else if(!_[_0x85db('0xd')](_0x27819d[_0x85db('0x11')])){_0x42c287=[_0x27819d[_0x85db('0x11')]];}return _0x42c287;}exports[_0x85db('0x12')]=function(_0x2b7507){_0x2b7507[_0x85db('0x13')]={};return new BPromise(function(_0x3ca181,_0x415281){var _0x1e9dec={'Start':function(_0x270fd7){var _0x2be61d=this;return new Promise(function(_0x5ccfef,_0x27bd65){if(_0x270fd7){try{var _0x175622=[];var _0x11e7da=getId(_0x270fd7[_0x85db('0x14')],_0x270fd7[_0x85db('0x15')]?_0x270fd7[_0x85db('0x15')]['id']:0x0,_0x270fd7[_0x85db('0x16')]?_0x270fd7['interaction']['id']:0x0);if(_0x270fd7[_0x85db('0x17')]&&_[_0x85db('0x18')](_0x270fd7[_0x85db('0x17')])&&_0x270fd7[_0x85db('0x17')][_0x85db('0x19')]){for(var _0x2bc9a4=0x0;_0x2bc9a4<_0x270fd7[_0x85db('0x17')][_0x85db('0x19')];_0x2bc9a4+=0x1){var _0x2b8f30=_0x270fd7[_0x85db('0x17')][_0x2bc9a4];if(fs['existsSync'](path[_0x85db('0x1a')](__dirname,_0x85db('0x17'),_0x2b8f30[_0x85db('0x1b')]+_0x85db('0x1c')))){var _0x44c122=[];switch(_0x2b8f30[_0x85db('0x1b')][_0x85db('0x1d')]()){case _0x85db('0x1e'):var _0x4e2755=_0x2b8f30[_0x85db('0x1f')][_0x85db('0x20')](',');if(_0x270fd7[_0x85db('0x14')]===_0x85db('0x21')){_0x44c122[_0x85db('0x22')](_0x4e2755[0x0]);_0x44c122[_0x85db('0x22')](_0x4e2755[0x1]);_0x44c122['push'](_0x4e2755[_0x85db('0x23')](0x2,_0x4e2755[_0x85db('0x19')])[_0x85db('0x1a')](','));}else{_0x44c122['push'](_0x4e2755[0x0]);_0x44c122['push'](_0x4e2755['slice'](0x1,_0x4e2755[_0x85db('0x19')])[_0x85db('0x1a')](','));}break;case _0x85db('0x24'):var _0x51b748=_0x2b8f30[_0x85db('0x1f')][_0x85db('0x20')](',');_0x44c122[_0x85db('0x22')](_0x51b748[0x0]);_0x44c122['push'](_0x51b748[0x1]);_0x44c122['push'](_0x51b748[_0x85db('0x23')](0x2,_0x51b748[_0x85db('0x19')])[_0x85db('0x1a')](','));break;case _0x85db('0x25'):var _0x397afc=_0x2b8f30[_0x85db('0x1f')][_0x85db('0x20')](',');_0x44c122[_0x85db('0x22')](_0x397afc[0x0]);_0x44c122[_0x85db('0x22')](_0x397afc[0x1]);_0x44c122[_0x85db('0x22')](_0x397afc[0x2]);_0x44c122['push'](_0x397afc[0x3]);_0x44c122['push'](_0x397afc[_0x85db('0x23')](0x4,_0x397afc['length'])[_0x85db('0x1a')](','));break;case _0x85db('0x26'):var _0x5abdb7=_0x2b8f30[_0x85db('0x1f')][_0x85db('0x20')](',');_0x44c122[_0x85db('0x22')](_0x5abdb7[0x0]);_0x44c122[_0x85db('0x22')](_0x5abdb7[0x1]);_0x44c122['push'](_0x5abdb7[0x2]);_0x44c122[_0x85db('0x22')](_0x5abdb7[0x3]);_0x44c122[_0x85db('0x22')](_0x5abdb7[_0x85db('0x23')](0x4,_0x5abdb7[_0x85db('0x19')])[_0x85db('0x1a')](','));break;case'message':_0x44c122[_0x85db('0x22')](_0x2b8f30[_0x85db('0x1f')]);break;case _0x85db('0x27'):_0x44c122[_0x85db('0x22')](_0x2b8f30['TagId']);_0x44c122[_0x85db('0x22')](_0x2b8f30[_0x85db('0x1f')]);break;case _0x85db('0x28'):var _0x536398=utils['getMustacheRender'](_0x270fd7[_0x85db('0x29')][_0x85db('0x2a')],_0x270fd7);var _0x4980b7=_0x2b8f30[_0x85db('0x1f')][_0x85db('0x20')](',');_0x44c122[_0x85db('0x22')](_0x4980b7[0x0]);_0x44c122[_0x85db('0x22')](_0x4980b7[0x1]);_0x44c122[_0x85db('0x22')](_0x4980b7[0x2]);_0x44c122[_0x85db('0x22')](_0x4980b7[0x3]);_0x44c122[_0x85db('0x22')](_0x4980b7[0x4]);_0x44c122[_0x85db('0x22')](_0x4980b7[0x5]);_0x44c122[_0x85db('0x22')](_0x4980b7[0x6]);_0x44c122[_0x85db('0x22')](_0x4980b7[0x7]);_0x44c122[_0x85db('0x22')](_0x4980b7[0x8]);_0x44c122[_0x85db('0x22')](_0x4980b7[0x9]);_0x44c122['push'](_0x4980b7[0xa]);_0x44c122[_0x85db('0x22')](_0x270fd7[_0x85db('0x16')]['id']);_0x44c122[_0x85db('0x22')](_0x270fd7[_0x85db('0x15')]['id']);_0x44c122['push'](_0x2b8f30[_0x85db('0x2b')]);_0x44c122[_0x85db('0x22')](_0x270fd7[_0x85db('0x16')][_0x85db('0x2c')]);_0x44c122['push'](_0x270fd7['body']['body']);_0x44c122['push'](_0x536398);break;default:_0x44c122=_['isNil'](_0x2b8f30[_0x85db('0x1f')])?[]:_0x2b8f30[_0x85db('0x1f')][_0x85db('0x20')](',');}var _0x17f649={'id':util[_0x85db('0xc')]('%s:%s:%s',_0x11e7da,_0x2b8f30['id'],_0x2b8f30['app']),'condition':require(_0x85db('0x2d'))['condition'](_0x11e7da,getIntervals(_0x2b7507[_0x85db('0x2e')],_0x2b8f30),_0x2b7507),'consequence':require(_0x85db('0x2f')+_0x2b8f30['app'])['consequence'](_0x11e7da,_0x44c122,_0x2b7507,_0x270fd7),'p':_0x2b8f30[_0x85db('0x30')]||0x0};logger[_0x85db('0x31')](_0x85db('0x32'),_0x17f649['id'],_0x85db('0x33'),getIntervals(_0x2b7507[_0x85db('0x2e')],_0x2b8f30)['join'](_0x85db('0x34')));_0x175622[_0x85db('0x22')](_0x17f649);}else{logger[_0x85db('0x35')]('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,'applications',_0x2b8f30[_0x85db('0x1b')]+_0x85db('0x1c')));}}_0x2b7507[_0x85db('0x13')][_0x11e7da]=new RuleEngine(_0x175622);_0x2b7507['rules'][_0x11e7da]['execute'](_0x270fd7,function(_0x3e4dbc){logger['info'](_0x85db('0x36'),JSON[_0x85db('0x37')](_0x3e4dbc[_0x85db('0x38')]));if(_0x2b7507['rules'][_0x11e7da]){_0x2b7507[_0x85db('0x13')][_0x11e7da][_0x85db('0x39')](_0x85db('0x3a'));}});return _0x5ccfef({'code':0xc8,'message':_0x270fd7});}else{logger[_0x85db('0x31')](_0x85db('0x3b'));return _0x5ccfef({'code':0xc8,'message':_0x270fd7});}}catch(_0x1670fd){logger[_0x85db('0x35')](_0x1670fd[_0x85db('0x3c')]);return _0x27bd65(_0x2be61d[_0x85db('0x35')](0x1f4,_0x1670fd));}}return _0x27bd65('routing\x20is\x20empty');});},'AcceptMessage':function(_0x16a25f){var _0x1b9ab8=this;return new Promise(function(_0x30c7a0,_0x16d6b3){if(_0x16a25f[_0x85db('0x3d')]&&_0x16a25f[_0x85db('0x3d')]['id']){if(_0x2b7507['agents'][_0x16a25f[_0x85db('0x3d')]['id']]){_0x2b7507[_0x85db('0x3e')][_0x16a25f[_0x85db('0x3d')]['id']]['busy']=![];_0x2b7507['agents'][_0x16a25f[_0x85db('0x3d')]['id']]['busyQueue']=undefined;}}if(_0x16a25f[_0x85db('0x15')]&&_0x16a25f[_0x85db('0x15')]['id']){try{var _0x24afcd=getId(_0x16a25f[_0x85db('0x14')],_0x16a25f[_0x85db('0x15')]?_0x16a25f['message']['id']:0x0,_0x16a25f['interaction']?_0x16a25f[_0x85db('0x16')]['id']:0x0);if(_0x2b7507[_0x85db('0x13')][_0x24afcd]){_0x2b7507[_0x85db('0x13')][_0x24afcd][_0x85db('0x39')](_0x85db('0x3f'));if(rpc[_0x16a25f[_0x85db('0x14')]+_0x85db('0x40')]){rpc[_0x16a25f[_0x85db('0x14')]+_0x85db('0x40')][_0x85db('0x41')](_0x24afcd,{'UserId':_0x16a25f['message'][_0x85db('0x42')]})[_0x85db('0x43')](function(_0x54abf5){logger['error'](_0x85db('0x44'));});}}return _0x30c7a0({'code':0xc8,'message':_0x16a25f});}catch(_0x306be6){logger['error'](_0x306be6['stack']);return _0x16d6b3(_0x1b9ab8[_0x85db('0x35')](0x1f4,_0x306be6));}}logger[_0x85db('0x35')]('message\x20is\x20empty');return _0x16d6b3(_0x1b9ab8[_0x85db('0x35')](0x1f4,_0x85db('0x45')));});},'RejectMessage':function(_0x29df9e){var _0xd3cedb=this;return new Promise(function(_0x12b822,_0x2cddad){if(_0x29df9e[_0x85db('0x3d')]&&_0x29df9e[_0x85db('0x3d')]['id']){try{if(_0x2b7507[_0x85db('0x3e')][_0x29df9e[_0x85db('0x3d')]['id']]){_0x2b7507['agents'][_0x29df9e['agent']['id']][_0x85db('0x46')]=![];_0x2b7507[_0x85db('0x3e')][_0x29df9e[_0x85db('0x3d')]['id']][_0x85db('0x47')]=undefined;}return _0x12b822({'code':0xc8,'message':_0x29df9e});}catch(_0x2b77ce){logger[_0x85db('0x35')](_0x2b77ce[_0x85db('0x3c')]);return _0x2cddad(_0xd3cedb[_0x85db('0x35')](0x1f4,_0x2b77ce));}}logger[_0x85db('0x35')](_0x85db('0x45'));return _0x2cddad(_0xd3cedb[_0x85db('0x35')](0x1f4,_0x85db('0x45')));});},'AbandonInteraction':function(_0x198dad){var _0x425e61=this;return new Promise(function(_0x4b4742,_0x3df8ed){if(_0x198dad[_0x85db('0x14')]&&_0x198dad['interaction']&&_0x198dad[_0x85db('0x16')]['id']){try{var _0x40a009=getId(_0x198dad[_0x85db('0x14')],_0x198dad[_0x85db('0x15')]?_0x198dad[_0x85db('0x15')]['id']:0x0,_0x198dad[_0x85db('0x16')]?_0x198dad[_0x85db('0x16')]['id']:0x0);if(_0x2b7507['rules'][_0x40a009]){_0x2b7507[_0x85db('0x13')][_0x40a009][_0x85db('0x39')]('end');}return _0x4b4742({'code':0xc8,'message':_0x198dad});}catch(_0x5b38c6){logger[_0x85db('0x35')](_0x5b38c6['stack']);return _0x3df8ed(_0x425e61[_0x85db('0x35')](0x1f4,_0x5b38c6));}}logger[_0x85db('0x35')](_0x85db('0x45'));return _0x3df8ed(_0x425e61[_0x85db('0x35')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x247da4){var _0x5c634d=this;return new Promise(function(_0x5b950d,_0x493ab3){if(_0x2b7507[_0x85db('0x3e')][_0x85db('0x48')](_0x247da4['id'])){for(var _0x4fdec2 in _0x247da4[_0x85db('0x49')]){if(_0x247da4[_0x85db('0x49')]['hasOwnProperty'](_0x4fdec2)){if(_0x2b7507[_0x85db('0x3e')][_0x247da4['id']][_0x85db('0x48')](_0x4fdec2+_0x85db('0x4a'))){_0x2b7507[_0x85db('0x3e')][_0x247da4['id']][_0x4fdec2+_0x85db('0x4a')]=parseInt(_0x247da4[_0x85db('0x49')][_0x4fdec2],0xa);}}}_0x2b7507['agents'][_0x247da4['id']][_0x85db('0x4b')]();return _0x5b950d({'code':0xc8,'message':_0x2b7507[_0x85db('0x3e')][_0x247da4['id']]});}else{return _0x493ab3(_0x5c634d[_0x85db('0x35')](0x1f4,_0x85db('0x4c')));}});},'Agents':function(_0xff3b97){return new Promise(function(_0xfacd9e,_0x1c26a7){var _0x2b9da3=_['values'](_0x2b7507['agents']);_0xfacd9e({'count':_0x2b9da3['length'],'rows':_0x2b9da3});});},'ChatQueues':function(_0x4e5e2a){return new Promise(function(_0x16aac9,_0x38f37f){var _0x88626d=[];for(var _0x239027 in _0x2b7507[_0x85db('0x4d')]){if(_0x2b7507[_0x85db('0x4d')]['hasOwnProperty'](_0x239027)){var _0x367ebe=_0x2b7507[_0x85db('0x4d')][_0x239027];var _0x11bc25={'id':_0x367ebe['id'],'available':_0x367ebe[_0x85db('0x4e')],'loggedIn':_0x367ebe['loggedIn'],'name':_0x367ebe[_0x85db('0x4f')],'paused':_0x367ebe[_0x85db('0x50')],'waiting':_0x367ebe[_0x85db('0x51')]};_0x88626d[_0x85db('0x22')](_0x11bc25);}}_0x16aac9({'count':_0x88626d[_0x85db('0x19')],'rows':_0x88626d});});},'MailQueues':function(_0x2a7f1e){return new Promise(function(_0x4604e7,_0x2af26e){var _0x357a98=[];for(var _0x22559c in _0x2b7507['mailQueues']){if(_0x2b7507[_0x85db('0x52')][_0x85db('0x48')](_0x22559c)){var _0x40ccc6=_0x2b7507[_0x85db('0x52')][_0x22559c];var _0x1c37f4={'id':_0x40ccc6['id'],'available':_0x40ccc6['available'],'loggedIn':_0x40ccc6[_0x85db('0x53')],'name':_0x40ccc6[_0x85db('0x4f')],'paused':_0x40ccc6[_0x85db('0x50')],'waiting':_0x40ccc6[_0x85db('0x51')]};_0x357a98[_0x85db('0x22')](_0x1c37f4);}}_0x4604e7({'count':_0x357a98['length'],'rows':_0x357a98});});},'OpenchannelQueues':function(_0x1a9f92){return new Promise(function(_0x4213c3,_0x176e51){var _0x58ff0f=[];for(var _0xee1099 in _0x2b7507[_0x85db('0x54')]){if(_0x2b7507[_0x85db('0x54')]['hasOwnProperty'](_0xee1099)){var _0xbf277e=_0x2b7507[_0x85db('0x54')][_0xee1099];var _0x5b516d={'id':_0xbf277e['id'],'available':_0xbf277e[_0x85db('0x4e')],'loggedIn':_0xbf277e[_0x85db('0x53')],'name':_0xbf277e[_0x85db('0x4f')],'paused':_0xbf277e[_0x85db('0x50')],'waiting':_0xbf277e[_0x85db('0x51')]};_0x58ff0f[_0x85db('0x22')](_0x5b516d);}}_0x4213c3({'count':_0x58ff0f[_0x85db('0x19')],'rows':_0x58ff0f});});},'SmsQueues':function(_0xd96523){return new Promise(function(_0x22a37a,_0x27aa32){var _0xa4d981=[];for(var _0x3e81b6 in _0x2b7507[_0x85db('0x55')]){if(_0x2b7507[_0x85db('0x55')][_0x85db('0x48')](_0x3e81b6)){var _0x4da42e=_0x2b7507[_0x85db('0x55')][_0x3e81b6];var _0x2f7f7a={'id':_0x4da42e['id'],'available':_0x4da42e[_0x85db('0x4e')],'loggedIn':_0x4da42e[_0x85db('0x53')],'name':_0x4da42e['name'],'paused':_0x4da42e['paused'],'waiting':_0x4da42e[_0x85db('0x51')]};_0xa4d981['push'](_0x2f7f7a);}}_0x22a37a({'count':_0xa4d981[_0x85db('0x19')],'rows':_0xa4d981});});},'FaxQueues':function(_0x45cfd2){return new Promise(function(_0x3fc37e,_0x59bca4){var _0xf556b5=[];for(var _0x377eb6 in _0x2b7507[_0x85db('0x56')]){if(_0x2b7507[_0x85db('0x56')]['hasOwnProperty'](_0x377eb6)){var _0x28e203=_0x2b7507['faxQueues'][_0x377eb6];var _0x145c78={'id':_0x28e203['id'],'available':_0x28e203[_0x85db('0x4e')],'loggedIn':_0x28e203[_0x85db('0x53')],'name':_0x28e203[_0x85db('0x4f')],'paused':_0x28e203[_0x85db('0x50')],'waiting':_0x28e203[_0x85db('0x51')]};_0xf556b5[_0x85db('0x22')](_0x145c78);}}_0x3fc37e({'count':_0xf556b5[_0x85db('0x19')],'rows':_0xf556b5});});},'WhatsappQueues':function(_0x15895e){return new Promise(function(_0x1c57ca,_0x16df89){var _0x33440a=[];for(var _0x4369bd in _0x2b7507['whatsappQueues']){if(_0x2b7507[_0x85db('0x57')]['hasOwnProperty'](_0x4369bd)){var _0x2aeb7d=_0x2b7507[_0x85db('0x57')][_0x4369bd];var _0x4c1b81={'id':_0x2aeb7d['id'],'available':_0x2aeb7d[_0x85db('0x4e')],'loggedIn':_0x2aeb7d[_0x85db('0x53')],'name':_0x2aeb7d[_0x85db('0x4f')],'paused':_0x2aeb7d['paused'],'waiting':_0x2aeb7d[_0x85db('0x51')]};_0x33440a['push'](_0x4c1b81);}}_0x1c57ca({'count':_0x33440a[_0x85db('0x19')],'rows':_0x33440a});});},'ChatQueuesWaitingInteractions':function(_0x58382d){return new Promise(function(_0x2b6490,_0x2e68cc){var _0x542be6=_[_0x85db('0x58')](_0x2b7507[_0x85db('0x59')]);_0x2b6490({'count':_0x542be6[_0x85db('0x19')],'rows':_0x542be6});});},'MailQueuesWaitingInteractions':function(_0x23fb0f){return new Promise(function(_0x3dc1ab,_0x249e03){var _0x520315=_[_0x85db('0x58')](_0x2b7507[_0x85db('0x5a')]);_0x3dc1ab({'count':_0x520315[_0x85db('0x19')],'rows':_0x520315});});},'OpenchannelQueuesWaitingInteractions':function(_0x598e01){return new Promise(function(_0x3c92b3,_0x2c6f48){var _0x388fa4=_[_0x85db('0x58')](_0x2b7507[_0x85db('0x5b')]);_0x3c92b3({'count':_0x388fa4[_0x85db('0x19')],'rows':_0x388fa4});});},'SmsQueuesWaitingInteractions':function(_0x13fd5){return new Promise(function(_0x308537,_0x37d815){var _0x3cd417=_[_0x85db('0x58')](_0x2b7507['smsQueuesWaitingInteractions']);_0x308537({'count':_0x3cd417[_0x85db('0x19')],'rows':_0x3cd417});});},'FaxQueuesWaitingInteractions':function(_0x9c32f1){return new Promise(function(_0xdcb072,_0x53f137){var _0x17df73=_['values'](_0x2b7507[_0x85db('0x5c')]);_0xdcb072({'count':_0x17df73['length'],'rows':_0x17df73});});},'WhatsappQueuesWaitingInteractions':function(_0x1cbd17){return new Promise(function(_0x48425e,_0xdedf9e){var _0x5c6028=_[_0x85db('0x58')](_0x2b7507[_0x85db('0x5d')]);_0x48425e({'count':_0x5c6028['length'],'rows':_0x5c6028});});}};var _0x565d66=jayson['server'](_0x1e9dec)['http']();_0x565d66['on'](_0x85db('0x35'),function(_0x10352e){logger[_0x85db('0x35')](JSON[_0x85db('0x37')](_0x10352e));return _0x415281(_0x10352e);});_0x565d66[_0x85db('0x12')](0x232c,_0x85db('0x5e'),function(){console['log'](_0x85db('0x5f'),0x232c);return _0x3ca181(_0x85db('0x60')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 21ab277..9381545 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 _0xf49e=['[%s][INTERVAL]\x20%s','some','when','log','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','stack','bluebird','lodash','../../../config/logger','client','http','request','then','error','message','result','catch','rules','info','length','push','iftime\x20%s','indexOf','true'];(function(_0x3863e4,_0x46d031){var _0x1e0b44=function(_0x360cef){while(--_0x360cef){_0x3863e4['push'](_0x3863e4['shift']());}};_0x1e0b44(++_0x46d031);}(_0xf49e,0x1dc));var _0xef49=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xf49e[_0x1035c1];return _0x308d67;};'use strict';var util=require('util');var BPromise=require(_0xef49('0x0'));var jayson=require('jayson/promise');var _=require(_0xef49('0x1'));var logger=require(_0xef49('0x2'))('routing');var client=jayson[_0xef49('0x3')][_0xef49('0x4')]({'port':0x232a});function request(_0x58a2b3,_0x26d9c0){return new BPromise(function(_0x441271,_0x217d43){return client[_0xef49('0x5')](_0x58a2b3,_0x26d9c0)[_0xef49('0x6')](function(_0x4b707b){if(_0x4b707b[_0xef49('0x7')]){return _0x217d43(_0x4b707b[_0xef49('0x7')][_0xef49('0x8')]);}else{return _0x441271(_0x4b707b[_0xef49('0x9')]);}})[_0xef49('0xa')](function(_0x6b863e){return _0x217d43(_0x6b863e);});});}exports['condition']=function(_0x6addd3,_0x58ae2c,_0x98e9b0){return function(_0x223a29){if(_0x98e9b0['rules']&&!_0x98e9b0[_0xef49('0xb')][_0x6addd3]){logger[_0xef49('0xc')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x6addd3);return _0x223a29['stop']();}var _0x149fe4=[];for(var _0x5dee0a=0x0;_0x5dee0a<_0x58ae2c[_0xef49('0xd')];_0x5dee0a+=0x1){_0x149fe4[_0xef49('0xe')](request('Command',{'command':util['format'](_0xef49('0xf'),_0x58ae2c[_0x5dee0a])})[_0xef49('0x6')](function(_0x2cb429){return _0x2cb429&&_0x2cb429[_0xef49('0x8')]&&_0x2cb429[_0xef49('0x8')][_0xef49('0x10')](_0xef49('0x11'))>=0x0?!![]:![];})[_0xef49('0xa')](function(_0x3d48d8){logger[_0xef49('0x7')](_0xef49('0x12'),_0x6addd3,_0x58ae2c[_0x5dee0a]);}));}BPromise['all'](_0x149fe4)[_0xef49('0x6')](function(_0x40cf99){var _0x18088=_[_0xef49('0x13')](_0x40cf99);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0x6addd3,_0x58ae2c['join']('\x20|\x20'),_0x18088);_0x223a29[_0xef49('0x14')](_0x18088);})[_0xef49('0xa')](function(_0x4c4b10){console[_0xef49('0x15')](_0x4c4b10);logger[_0xef49('0x7')](_0xef49('0x16'),_0x6addd3,_0x58ae2c[_0xef49('0x17')](_0xef49('0x18')),_0x4c4b10[_0xef49('0x19')]);_0x223a29['stop']();});};}; \ No newline at end of file +var _0xc0a5=['[%s][INTERVAL]\x20%s\x20%s','join','stack','bluebird','jayson/promise','request','then','error','message','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','true','[%s][INTERVAL]\x20%s','some','\x20|\x20','when','log'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xc0a5,0xfd));var _0x5c0a=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xc0a5[_0x2c91e9];return _0x13f0ff;};'use strict';var util=require('util');var BPromise=require(_0x5c0a('0x0'));var jayson=require(_0x5c0a('0x1'));var _=require('lodash');var logger=require('../../../config/logger')('routing');var client=jayson['client']['http']({'port':0x232a});function request(_0x50265b,_0x33d636){return new BPromise(function(_0x5cb9ef,_0xee7ce){return client[_0x5c0a('0x2')](_0x50265b,_0x33d636)[_0x5c0a('0x3')](function(_0x2117cd){if(_0x2117cd[_0x5c0a('0x4')]){return _0xee7ce(_0x2117cd[_0x5c0a('0x4')][_0x5c0a('0x5')]);}else{return _0x5cb9ef(_0x2117cd['result']);}})[_0x5c0a('0x6')](function(_0x5cd316){return _0xee7ce(_0x5cd316);});});}exports[_0x5c0a('0x7')]=function(_0x1ebb6e,_0x9dc1a7,_0x5036ba){return function(_0x3c855c){if(_0x5036ba[_0x5c0a('0x8')]&&!_0x5036ba[_0x5c0a('0x8')][_0x1ebb6e]){logger[_0x5c0a('0x9')](_0x5c0a('0xa'),_0x1ebb6e);return _0x3c855c[_0x5c0a('0xb')]();}var _0x345759=[];for(var _0xedef21=0x0;_0xedef21<_0x9dc1a7[_0x5c0a('0xc')];_0xedef21+=0x1){_0x345759[_0x5c0a('0xd')](request(_0x5c0a('0xe'),{'command':util[_0x5c0a('0xf')]('iftime\x20%s',_0x9dc1a7[_0xedef21])})['then'](function(_0x4e081b){return _0x4e081b&&_0x4e081b[_0x5c0a('0x5')]&&_0x4e081b[_0x5c0a('0x5')]['indexOf'](_0x5c0a('0x10'))>=0x0?!![]:![];})[_0x5c0a('0x6')](function(_0x7ae2cf){logger['error'](_0x5c0a('0x11'),_0x1ebb6e,_0x9dc1a7[_0xedef21]);}));}BPromise['all'](_0x345759)[_0x5c0a('0x3')](function(_0x456ff4){var _0xea32c8=_[_0x5c0a('0x12')](_0x456ff4);logger[_0x5c0a('0x9')]('[%s][INTERVAL]\x20%s\x20%s',_0x1ebb6e,_0x9dc1a7['join'](_0x5c0a('0x13')),_0xea32c8);_0x3c855c[_0x5c0a('0x14')](_0xea32c8);})[_0x5c0a('0x6')](function(_0x24af0b){console[_0x5c0a('0x15')](_0x24af0b);logger['error'](_0x5c0a('0x16'),_0x1ebb6e,_0x9dc1a7[_0x5c0a('0x17')](_0x5c0a('0x13')),_0x24af0b[_0x5c0a('0x18')]);_0x3c855c[_0x5c0a('0xb')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index f97e622..02daf61 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 _0x702d=['error','[%s][agents][agentringnoanswer]','agentringnoanswer','agentringnoanswerAt','now','timeout','reason','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transferuniqueid','transfertargetuniqueid','clone','calleridname','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','lodash','util','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','called','connectedlinename','info'];(function(_0x349864,_0x279861){var _0x33fb8c=function(_0x5f550b){while(--_0x5f550b){_0x349864['push'](_0x349864['shift']());}};_0x33fb8c(++_0x279861);}(_0x702d,0x147));var _0xd702=function(_0xb72c5d,_0x23bd10){_0xb72c5d=_0xb72c5d-0x0;var _0x358f1c=_0x702d[_0xb72c5d];return _0x358f1c;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var utils=require(_0xd702('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x33e7c5,_0x37ed5c){utils['info'](util[_0xd702('0x3')](_0xd702('0x4'),_0x33e7c5[_0xd702('0x5')],_0x33e7c5[_0xd702('0x6')],_0x33e7c5['queue'],_0x33e7c5[_0xd702('0x7')],_0x33e7c5['interface'],_0x33e7c5[_0xd702('0x8')],_0x33e7c5[_0xd702('0x9')],_0x33e7c5[_0xd702('0xa')]));if(_0x33e7c5['queue']){utils[_0xd702('0xb')](_0x33e7c5['queue'])[_0xd702('0xc')](function(_0x25423f){if(_0x25423f){_0x33e7c5[_0xd702('0xd')]=_0x25423f[_0xd702('0xd')];_0x33e7c5[_0xd702('0xe')]=_0x33e7c5[_0xd702('0xf')]?_0x25423f[_0xd702('0x10')]:![];_0x33e7c5[_0xd702('0x11')]=_0x33e7c5[_0xd702('0xe')]?_0x25423f[_0xd702('0x12')]:0x0;}utils['request']('CreateVoiceAgentReport',_0x33e7c5);});}else{utils[_0xd702('0x13')](_0xd702('0x14'),_0x33e7c5);}if(_0x37ed5c){delete transfers[_0x33e7c5[_0xd702('0x5')]];}else{delete agents[_0x33e7c5['destuniqueid']];}}exports[_0xd702('0x15')]=function(_0x128add){try{utils[_0xd702('0x16')](util[_0xd702('0x3')](_0xd702('0x17'),_0x128add[_0xd702('0x5')]),_0x128add);agents[_0x128add['destuniqueid']]=_0x128add;agents[_0x128add[_0xd702('0x18')]][_0xd702('0x19')]=utils['now']();agents[_0x128add[_0xd702('0x18')]]['lastevent']=_0xd702('0x1a');agents[_0x128add[_0xd702('0x18')]]['connectedlinenum']=null;agents[_0x128add[_0xd702('0x18')]][_0xd702('0x1b')]=null;utils[_0xd702('0x1c')](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x128add[_0xd702('0x5')],agents[_0x128add['destuniqueid']][_0xd702('0x7')],_0x128add[_0xd702('0x18')]));}catch(_0x37267c){utils[_0xd702('0x1d')](util[_0xd702('0x3')](_0xd702('0x17'),_0x128add[_0xd702('0x5')]),_0x37267c);}};exports['agentringnoanswer']=function(_0x4be140){try{if(!_['isNil'](agents[_0x4be140[_0xd702('0x18')]])){utils[_0xd702('0x16')](util['format'](_0xd702('0x1e'),_0x4be140['uniqueid']),_0x4be140);utils[_0xd702('0x1c')](util['format']('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x4be140['uniqueid'],agents[_0x4be140[_0xd702('0x18')]][_0xd702('0x7')],_0x4be140[_0xd702('0x18')]));agents[_0x4be140['destuniqueid']][_0xd702('0x1f')]=!![];agents[_0x4be140[_0xd702('0x18')]][_0xd702('0x20')]=utils[_0xd702('0x21')]();agents[_0x4be140[_0xd702('0x18')]][_0xd702('0xa')]=_0xd702('0x22');agents[_0x4be140[_0xd702('0x18')]][_0xd702('0x23')]='timeout';agents[_0x4be140[_0xd702('0x18')]][_0xd702('0x24')]=_0x4be140[_0xd702('0x25')]?parseInt(_0x4be140[_0xd702('0x25')])/0x3e8:0x0;agents[_0x4be140[_0xd702('0x18')]][_0xd702('0x26')]=0x0;unanswered[_0xd702('0x27')](_0x4be140[_0xd702('0x18')]);}}catch(_0x5f1084){utils['error'](util[_0xd702('0x3')](_0xd702('0x1e'),_0x4be140['uniqueid']),_0x5f1084);}};exports[_0xd702('0x28')]=function(_0xee8bf1){try{_[_0xd702('0x29')](agents,function(_0x2946ae,_0x56e9cd){if(_0x2946ae[_0xd702('0x5')]==_0xee8bf1[_0xd702('0x5')]&&!_[_0xd702('0x2a')](unanswered,_0x2946ae[_0xd702('0x18')])){utils[_0xd702('0x16')](util['format'](_0xd702('0x2b'),_0xee8bf1[_0xd702('0x5')]),_0xee8bf1);utils[_0xd702('0x1c')](util['format'](_0xd702('0x2c'),_0xee8bf1['uniqueid'],_0x2946ae['membername'],_0x2946ae[_0xd702('0x18')]));_0x2946ae[_0xd702('0x1f')]=!![];_0x2946ae[_0xd702('0x20')]=utils['now']();_0x2946ae[_0xd702('0xa')]=_0xd702('0x2d');_0x2946ae['reason']=_0xd702('0x2d');_0x2946ae[_0xd702('0x24')]=_0xee8bf1[_0xd702('0x24')];_0x2946ae[_0xd702('0x26')]=0x0;writeDB(_0x2946ae);}});}catch(_0xa6b40a){utils[_0xd702('0x1d')](util[_0xd702('0x3')](_0xd702('0x2b'),_0xee8bf1[_0xd702('0x5')]),_0xa6b40a);}};exports[_0xd702('0x2e')]=function(_0x9f458b){try{if(agents[_0x9f458b[_0xd702('0x18')]]){utils[_0xd702('0x16')](util['format'](_0xd702('0x2f'),_0x9f458b[_0xd702('0x5')]),_0x9f458b);utils[_0xd702('0x1c')](util[_0xd702('0x3')](_0xd702('0x30'),_0x9f458b[_0xd702('0x5')],agents[_0x9f458b[_0xd702('0x18')]]['membername'],_0x9f458b['destuniqueid']));agents[_0x9f458b[_0xd702('0x18')]][_0xd702('0x31')]=utils['now']();agents[_0x9f458b['destuniqueid']][_0xd702('0x9')]=_0x9f458b[_0xd702('0x9')];agents[_0x9f458b['destuniqueid']][_0xd702('0x1b')]=_0x9f458b[_0xd702('0x1b')];agents[_0x9f458b[_0xd702('0x18')]]['holdtime']=_0x9f458b[_0xd702('0x25')];agents[_0x9f458b[_0xd702('0x18')]][_0xd702('0xa')]='connect';_[_0xd702('0x29')](agents,function(_0x512854,_0x359bbd){if(_0x512854[_0xd702('0x18')]!=_0x9f458b[_0xd702('0x18')]&&_0x512854[_0xd702('0x5')]==_0x9f458b[_0xd702('0x5')]){_0x512854[_0xd702('0x26')]=0x0;_0x512854[_0xd702('0x24')]=_0x9f458b[_0xd702('0x25')];_0x512854['agentringnoanswer']=!![];_0x512854[_0xd702('0x20')]=utils[_0xd702('0x21')]();_0x512854[_0xd702('0xa')]=_0xd702('0x32');_0x512854[_0xd702('0x23')]='answered_elsewhere';_0x512854[_0xd702('0x33')]=_0x9f458b[_0xd702('0x18')];_0x512854[_0xd702('0x34')]=_0x9f458b['membername'];writeDB(_0x512854);}});}}catch(_0xd48ad0){utils[_0xd702('0x1d')](util[_0xd702('0x3')](_0xd702('0x2f'),_0x9f458b['uniqueid']),_0xd48ad0);}};exports[_0xd702('0xf')]=function(_0xfa5e9){try{if(!_[_0xd702('0x35')](agents[_0xfa5e9[_0xd702('0x18')]])){utils[_0xd702('0x16')](util['format'](_0xd702('0x36'),_0xfa5e9[_0xd702('0x5')]),_0xfa5e9);utils['info'](util['format'](_0xd702('0x37'),_0xfa5e9[_0xd702('0x5')],agents[_0xfa5e9[_0xd702('0x18')]][_0xd702('0x7')],_0xfa5e9[_0xd702('0x18')]));agents[_0xfa5e9[_0xd702('0x18')]][_0xd702('0xf')]=!![];agents[_0xfa5e9[_0xd702('0x18')]][_0xd702('0x38')]=utils['now']();agents[_0xfa5e9['destuniqueid']][_0xd702('0x26')]=utils['diffTime'](agents[_0xfa5e9[_0xd702('0x18')]]['agentcompleteAt'],agents[_0xfa5e9[_0xd702('0x18')]]['agentconnectAt']);agents[_0xfa5e9[_0xd702('0x18')]]['reason']=_0xfa5e9[_0xd702('0x23')];agents[_0xfa5e9[_0xd702('0x18')]]['lastevent']=_0xd702('0x39');writeDB(agents[_0xfa5e9[_0xd702('0x18')]]);}}catch(_0x2c0528){utils[_0xd702('0x1d')](util[_0xd702('0x3')]('[%s][agents][agentcomplete]',_0xfa5e9[_0xd702('0x5')]),_0x2c0528);}};exports[_0xd702('0x3a')]=function(_0x2d09be){try{if(!_['isNil'](agents[_0x2d09be[_0xd702('0x3b')]])){utils['debug'](util[_0xd702('0x3')](_0xd702('0x3c'),_0x2d09be[_0xd702('0x5')]),_0x2d09be);utils['info'](util['format'](_0xd702('0x3d'),_0x2d09be[_0xd702('0x5')],agents[_0x2d09be[_0xd702('0x3b')]][_0xd702('0x7')],agents[_0x2d09be[_0xd702('0x3b')]][_0xd702('0x5')]));agents[_0x2d09be[_0xd702('0x3b')]][_0xd702('0x3e')]=!![];agents[_0x2d09be[_0xd702('0x3b')]][_0xd702('0x3f')]='blind';agents[_0x2d09be['transfereruniqueid']][_0xd702('0x40')]=_0x2d09be[_0xd702('0x41')];agents[_0x2d09be[_0xd702('0x3b')]]['transferuniqueid']=agents[_0x2d09be['transfereruniqueid']][_0xd702('0x5')];}}catch(_0x54c7e2){utils[_0xd702('0x1d')](util[_0xd702('0x3')](_0xd702('0x3c'),_0x2d09be[_0xd702('0x5')]),_0x54c7e2);}};exports[_0xd702('0x42')]=function(_0x3cd4c1){try{utils[_0xd702('0x16')](util[_0xd702('0x3')](_0xd702('0x43'),_0x3cd4c1['origtransfereruniqueid']),_0x3cd4c1);if(_0x3cd4c1[_0xd702('0x44')]==_0x3cd4c1[_0xd702('0x45')]){if(!_[_0xd702('0x35')](agents[_0x3cd4c1[_0xd702('0x46')]])){utils['info'](util[_0xd702('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x3cd4c1[_0xd702('0x44')],agents[_0x3cd4c1['secondtransfereruniqueid']]['membername']));agents[_0x3cd4c1[_0xd702('0x46')]][_0xd702('0x3e')]=!![];agents[_0x3cd4c1[_0xd702('0x46')]][_0xd702('0x3f')]=_0xd702('0x47');agents[_0x3cd4c1[_0xd702('0x46')]]['transferexten']=_0x3cd4c1[_0xd702('0x48')];agents[_0x3cd4c1[_0xd702('0x46')]]['transferuniqueid']=_0x3cd4c1[_0xd702('0x44')];}if(_0x3cd4c1[_0xd702('0x49')]&&agents[_0x3cd4c1[_0xd702('0x49')]]){agents[_0x3cd4c1[_0xd702('0x49')]][_0xd702('0x4a')]=0x1;transfers[_0x3cd4c1[_0xd702('0x49')]]=_['clone'](agents[_0x3cd4c1[_0xd702('0x49')]]);transfers[_0x3cd4c1[_0xd702('0x49')]][_0xd702('0x8')]=agents[_0x3cd4c1[_0xd702('0x46')]][_0xd702('0x8')];transfers[_0x3cd4c1['transfereeuniqueid']]['calleridname']=agents[_0x3cd4c1[_0xd702('0x46')]]['calleridname'];transfers[_0x3cd4c1['transfereeuniqueid']][_0xd702('0x19')]=utils['now']();transfers[_0x3cd4c1[_0xd702('0x49')]][_0xd702('0x31')]=utils[_0xd702('0x21')]();transfers[_0x3cd4c1[_0xd702('0x49')]]['holdtime']=0x0;transfers[_0x3cd4c1[_0xd702('0x49')]]['agententerreason']=0x2;}}else if(_0x3cd4c1[_0xd702('0x46')]==_0x3cd4c1['secondtransfererlinkedid']){if(!_[_0xd702('0x35')](agents[_0x3cd4c1[_0xd702('0x44')]])){utils[_0xd702('0x1c')](util[_0xd702('0x3')](_0xd702('0x4b'),_0x3cd4c1[_0xd702('0x44')],agents[_0x3cd4c1[_0xd702('0x44')]]['membername']));agents[_0x3cd4c1['origtransfereruniqueid']][_0xd702('0x3e')]=!![];agents[_0x3cd4c1['origtransfereruniqueid']][_0xd702('0x3f')]=_0xd702('0x47');agents[_0x3cd4c1['origtransfereruniqueid']][_0xd702('0x40')]=_0x3cd4c1[_0xd702('0x4c')];agents[_0x3cd4c1['origtransfereruniqueid']][_0xd702('0x4d')]=_0x3cd4c1['secondtransfereruniqueid'];}if(_0x3cd4c1[_0xd702('0x4e')]&&agents[_0x3cd4c1[_0xd702('0x4e')]]){agents[_0x3cd4c1[_0xd702('0x4e')]][_0xd702('0x4a')]=0x1;transfers[_0x3cd4c1['transfertargetuniqueid']]=_[_0xd702('0x4f')](agents[_0x3cd4c1[_0xd702('0x4e')]]);transfers[_0x3cd4c1[_0xd702('0x4e')]][_0xd702('0x8')]=agents[_0x3cd4c1[_0xd702('0x44')]]['calleridnum'];transfers[_0x3cd4c1[_0xd702('0x4e')]][_0xd702('0x50')]=agents[_0x3cd4c1[_0xd702('0x44')]][_0xd702('0x50')];transfers[_0x3cd4c1[_0xd702('0x4e')]][_0xd702('0x19')]=utils['now']();transfers[_0x3cd4c1[_0xd702('0x4e')]]['agentconnectAt']=utils[_0xd702('0x21')]();transfers[_0x3cd4c1[_0xd702('0x4e')]][_0xd702('0x24')]=0x0;transfers[_0x3cd4c1[_0xd702('0x4e')]]['agententerreason']=0x2;}}}catch(_0x3e99ff){utils[_0xd702('0x1d')](util[_0xd702('0x3')](_0xd702('0x43'),_0x3cd4c1[_0xd702('0x44')]),_0x3e99ff);}};exports['hangup']=function(_0x5bc3dd){try{utils[_0xd702('0x16')](util[_0xd702('0x3')](_0xd702('0x51'),_0x5bc3dd[_0xd702('0x5')]),_0x5bc3dd);if(agents[_0x5bc3dd[_0xd702('0x5')]]&&agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x23')]===_0xd702('0x22')){if(_0x5bc3dd[_0xd702('0x52')]==='21'){agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x23')]=_0xd702('0x53');agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0xa')]=_0xd702('0x53');}utils[_0xd702('0x1c')](util['format'](_0xd702('0x54'),_0x5bc3dd['uniqueid'],agents[_0x5bc3dd['uniqueid']][_0xd702('0x7')],agents[_0x5bc3dd['uniqueid']][_0xd702('0x23')],agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0xa')]));writeDB(agents[_0x5bc3dd[_0xd702('0x5')]]);var _0x472e5a=unanswered[_0xd702('0x55')](_0x5bc3dd[_0xd702('0x5')]);if(_0x472e5a>-0x1){unanswered[_0xd702('0x56')](_0x472e5a,0x1);}}if(transfers[_0x5bc3dd[_0xd702('0x5')]]){transfers[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0xf')]=!![];transfers[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x38')]=utils[_0xd702('0x21')]();transfers[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x26')]=utils[_0xd702('0x57')](transfers[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x38')],transfers[_0x5bc3dd['uniqueid']][_0xd702('0x31')]);transfers[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x23')]=_0xd702('0x58');transfers[_0x5bc3dd[_0xd702('0x5')]]['lastevent']=_0xd702('0x39');utils[_0xd702('0x1c')](util['format'](_0xd702('0x54'),_0x5bc3dd[_0xd702('0x5')],transfers[_0x5bc3dd[_0xd702('0x5')]]['membername'],transfers[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x23')],transfers[_0x5bc3dd['uniqueid']][_0xd702('0xa')]));writeDB(transfers[_0x5bc3dd[_0xd702('0x5')]],!![]);}if(agents[_0x5bc3dd[_0xd702('0x5')]]&&agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x31')]){agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0xf')]=!![];agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x38')]=utils[_0xd702('0x21')]();agents[_0x5bc3dd[_0xd702('0x5')]]['talktime']=utils[_0xd702('0x57')](agents[_0x5bc3dd[_0xd702('0x5')]]['agentcompleteAt'],agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x31')]);agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x23')]=agents[_0x5bc3dd[_0xd702('0x5')]]['transfer']?'transfer':_0xd702('0x58');agents[_0x5bc3dd['uniqueid']][_0xd702('0xa')]=_0xd702('0x39');utils[_0xd702('0x1c')](util[_0xd702('0x3')](_0xd702('0x54'),_0x5bc3dd['uniqueid'],agents[_0x5bc3dd[_0xd702('0x5')]]['membername'],agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0x23')],agents[_0x5bc3dd[_0xd702('0x5')]][_0xd702('0xa')]));writeDB(agents[_0x5bc3dd[_0xd702('0x5')]]);}}catch(_0x1ea077){utils['error'](util['format'](_0xd702('0x51'),_0x5bc3dd[_0xd702('0x5')]),_0x1ea077);}}; \ No newline at end of file +var _0xf290=['now','connectedlinename','error','agentringnoanswer','timeout','reason','holdtime','push','[%s][agents][agentringnoanswer]','includes','debug','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','talktime','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','ringtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','isNil','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','transfertype','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','clone','calleridname','hangup','[%s][agents][hangup]','rejected','indexOf','agent','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','calleridnum','connectedlinenum','lastevent','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','request','CreateVoiceAgentReport','destuniqueid','agentcalled','[%s][agents][agentcalled]','agentcalledAt'];(function(_0x131a8,_0x33d2fe){var _0x5022f8=function(_0x32f617){while(--_0x32f617){_0x131a8['push'](_0x131a8['shift']());}};_0x5022f8(++_0x33d2fe);}(_0xf290,0xde));var _0x0f29=function(_0x59e821,_0x86c723){_0x59e821=_0x59e821-0x0;var _0x5333f6=_0xf290[_0x59e821];return _0x5333f6;};'use strict';var _=require('lodash');var util=require(_0x0f29('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x1d35f0,_0x4b16e4){utils[_0x0f29('0x1')](util[_0x0f29('0x2')](_0x0f29('0x3'),_0x1d35f0[_0x0f29('0x4')],_0x1d35f0[_0x0f29('0x5')],_0x1d35f0['queue'],_0x1d35f0[_0x0f29('0x6')],_0x1d35f0['interface'],_0x1d35f0[_0x0f29('0x7')],_0x1d35f0[_0x0f29('0x8')],_0x1d35f0[_0x0f29('0x9')]));if(_0x1d35f0[_0x0f29('0xa')]){utils[_0x0f29('0xb')](_0x1d35f0[_0x0f29('0xa')])[_0x0f29('0xc')](function(_0x3c6a6e){if(_0x3c6a6e){_0x1d35f0[_0x0f29('0xd')]=_0x3c6a6e[_0x0f29('0xd')];_0x1d35f0[_0x0f29('0xe')]=_0x1d35f0[_0x0f29('0xf')]?_0x3c6a6e[_0x0f29('0x10')]:![];_0x1d35f0[_0x0f29('0x11')]=_0x1d35f0[_0x0f29('0xe')]?_0x3c6a6e['acwTimeout']:0x0;}utils[_0x0f29('0x12')]('CreateVoiceAgentReport',_0x1d35f0);});}else{utils[_0x0f29('0x12')](_0x0f29('0x13'),_0x1d35f0);}if(_0x4b16e4){delete transfers[_0x1d35f0[_0x0f29('0x4')]];}else{delete agents[_0x1d35f0[_0x0f29('0x14')]];}}exports[_0x0f29('0x15')]=function(_0x2d2573){try{utils['debug'](util[_0x0f29('0x2')](_0x0f29('0x16'),_0x2d2573[_0x0f29('0x4')]),_0x2d2573);agents[_0x2d2573[_0x0f29('0x14')]]=_0x2d2573;agents[_0x2d2573[_0x0f29('0x14')]][_0x0f29('0x17')]=utils[_0x0f29('0x18')]();agents[_0x2d2573[_0x0f29('0x14')]]['lastevent']='called';agents[_0x2d2573[_0x0f29('0x14')]][_0x0f29('0x8')]=null;agents[_0x2d2573[_0x0f29('0x14')]][_0x0f29('0x19')]=null;utils['info'](util[_0x0f29('0x2')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x2d2573[_0x0f29('0x4')],agents[_0x2d2573['destuniqueid']]['membername'],_0x2d2573['destuniqueid']));}catch(_0x23a44f){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')](_0x0f29('0x16'),_0x2d2573[_0x0f29('0x4')]),_0x23a44f);}};exports[_0x0f29('0x1b')]=function(_0x150271){try{if(!_['isNil'](agents[_0x150271[_0x0f29('0x14')]])){utils['debug'](util['format']('[%s][agents][agentringnoanswer]',_0x150271['uniqueid']),_0x150271);utils[_0x0f29('0x1')](util[_0x0f29('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x150271[_0x0f29('0x4')],agents[_0x150271[_0x0f29('0x14')]][_0x0f29('0x6')],_0x150271[_0x0f29('0x14')]));agents[_0x150271[_0x0f29('0x14')]]['agentringnoanswer']=!![];agents[_0x150271[_0x0f29('0x14')]]['agentringnoanswerAt']=utils[_0x0f29('0x18')]();agents[_0x150271[_0x0f29('0x14')]][_0x0f29('0x9')]=_0x0f29('0x1c');agents[_0x150271['destuniqueid']][_0x0f29('0x1d')]='timeout';agents[_0x150271['destuniqueid']][_0x0f29('0x1e')]=_0x150271['ringtime']?parseInt(_0x150271['ringtime'])/0x3e8:0x0;agents[_0x150271['destuniqueid']]['talktime']=0x0;unanswered[_0x0f29('0x1f')](_0x150271[_0x0f29('0x14')]);}}catch(_0x4cc5a0){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')](_0x0f29('0x20'),_0x150271['uniqueid']),_0x4cc5a0);}};exports['queuecallerabandon']=function(_0x37ebcc){try{_['forIn'](agents,function(_0x36b65c,_0x561c31){if(_0x36b65c['uniqueid']==_0x37ebcc[_0x0f29('0x4')]&&!_[_0x0f29('0x21')](unanswered,_0x36b65c[_0x0f29('0x14')])){utils[_0x0f29('0x22')](util['format']('[%s][agents][queuecallerabandon]',_0x37ebcc[_0x0f29('0x4')]),_0x37ebcc);utils['info'](util['format'](_0x0f29('0x23'),_0x37ebcc['uniqueid'],_0x36b65c[_0x0f29('0x6')],_0x36b65c['destuniqueid']));_0x36b65c['agentringnoanswer']=!![];_0x36b65c[_0x0f29('0x24')]=utils[_0x0f29('0x18')]();_0x36b65c[_0x0f29('0x9')]=_0x0f29('0x25');_0x36b65c[_0x0f29('0x1d')]='abandoned';_0x36b65c[_0x0f29('0x1e')]=_0x37ebcc['holdtime'];_0x36b65c[_0x0f29('0x26')]=0x0;writeDB(_0x36b65c);}});}catch(_0x3e8f3f){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')]('[%s][agents][queuecallerabandon]',_0x37ebcc[_0x0f29('0x4')]),_0x3e8f3f);}};exports[_0x0f29('0x27')]=function(_0x5be4fa){try{if(agents[_0x5be4fa[_0x0f29('0x14')]]){utils[_0x0f29('0x22')](util['format']('[%s][agents][agentconnect]',_0x5be4fa[_0x0f29('0x4')]),_0x5be4fa);utils[_0x0f29('0x1')](util[_0x0f29('0x2')](_0x0f29('0x28'),_0x5be4fa[_0x0f29('0x4')],agents[_0x5be4fa[_0x0f29('0x14')]]['membername'],_0x5be4fa[_0x0f29('0x14')]));agents[_0x5be4fa['destuniqueid']][_0x0f29('0x29')]=utils['now']();agents[_0x5be4fa[_0x0f29('0x14')]][_0x0f29('0x8')]=_0x5be4fa[_0x0f29('0x8')];agents[_0x5be4fa['destuniqueid']]['connectedlinename']=_0x5be4fa[_0x0f29('0x19')];agents[_0x5be4fa['destuniqueid']][_0x0f29('0x1e')]=_0x5be4fa[_0x0f29('0x2a')];agents[_0x5be4fa[_0x0f29('0x14')]][_0x0f29('0x9')]=_0x0f29('0x2b');_['forIn'](agents,function(_0x13c05c,_0xf77c66){if(_0x13c05c[_0x0f29('0x14')]!=_0x5be4fa[_0x0f29('0x14')]&&_0x13c05c[_0x0f29('0x4')]==_0x5be4fa[_0x0f29('0x4')]){_0x13c05c[_0x0f29('0x26')]=0x0;_0x13c05c[_0x0f29('0x1e')]=_0x5be4fa[_0x0f29('0x2a')];_0x13c05c['agentringnoanswer']=!![];_0x13c05c[_0x0f29('0x24')]=utils[_0x0f29('0x18')]();_0x13c05c[_0x0f29('0x9')]=_0x0f29('0x2c');_0x13c05c['reason']=_0x0f29('0x2c');_0x13c05c[_0x0f29('0x2d')]=_0x5be4fa[_0x0f29('0x14')];_0x13c05c[_0x0f29('0x2e')]=_0x5be4fa[_0x0f29('0x6')];writeDB(_0x13c05c);}});}}catch(_0x56062d){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')](_0x0f29('0x2f'),_0x5be4fa['uniqueid']),_0x56062d);}};exports[_0x0f29('0xf')]=function(_0x284279){try{if(!_[_0x0f29('0x30')](agents[_0x284279[_0x0f29('0x14')]])){utils[_0x0f29('0x22')](util[_0x0f29('0x2')](_0x0f29('0x31'),_0x284279[_0x0f29('0x4')]),_0x284279);utils['info'](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x284279[_0x0f29('0x4')],agents[_0x284279[_0x0f29('0x14')]][_0x0f29('0x6')],_0x284279[_0x0f29('0x14')]));agents[_0x284279[_0x0f29('0x14')]][_0x0f29('0xf')]=!![];agents[_0x284279['destuniqueid']][_0x0f29('0x32')]=utils['now']();agents[_0x284279[_0x0f29('0x14')]]['talktime']=utils[_0x0f29('0x33')](agents[_0x284279[_0x0f29('0x14')]][_0x0f29('0x32')],agents[_0x284279[_0x0f29('0x14')]][_0x0f29('0x29')]);agents[_0x284279['destuniqueid']][_0x0f29('0x1d')]=_0x284279[_0x0f29('0x1d')];agents[_0x284279[_0x0f29('0x14')]]['lastevent']=_0x0f29('0x34');writeDB(agents[_0x284279['destuniqueid']]);}}catch(_0x4fd625){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')](_0x0f29('0x31'),_0x284279[_0x0f29('0x4')]),_0x4fd625);}};exports[_0x0f29('0x35')]=function(_0x335435){try{if(!_['isNil'](agents[_0x335435[_0x0f29('0x36')]])){utils[_0x0f29('0x22')](util[_0x0f29('0x2')](_0x0f29('0x37'),_0x335435[_0x0f29('0x4')]),_0x335435);utils[_0x0f29('0x1')](util[_0x0f29('0x2')](_0x0f29('0x38'),_0x335435[_0x0f29('0x4')],agents[_0x335435[_0x0f29('0x36')]]['membername'],agents[_0x335435['transfereruniqueid']][_0x0f29('0x4')]));agents[_0x335435[_0x0f29('0x36')]][_0x0f29('0x39')]=!![];agents[_0x335435[_0x0f29('0x36')]]['transfertype']=_0x0f29('0x3a');agents[_0x335435[_0x0f29('0x36')]][_0x0f29('0x3b')]=_0x335435[_0x0f29('0x3c')];agents[_0x335435[_0x0f29('0x36')]][_0x0f29('0x3d')]=agents[_0x335435[_0x0f29('0x36')]]['uniqueid'];}}catch(_0x17f33){utils[_0x0f29('0x1a')](util[_0x0f29('0x2')](_0x0f29('0x37'),_0x335435[_0x0f29('0x4')]),_0x17f33);}};exports[_0x0f29('0x3e')]=function(_0x5ec172){try{utils[_0x0f29('0x22')](util[_0x0f29('0x2')](_0x0f29('0x3f'),_0x5ec172['origtransfereruniqueid']),_0x5ec172);if(_0x5ec172[_0x0f29('0x40')]==_0x5ec172['origtransfererlinkedid']){if(!_[_0x0f29('0x30')](agents[_0x5ec172['secondtransfereruniqueid']])){utils[_0x0f29('0x1')](util[_0x0f29('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x5ec172[_0x0f29('0x40')],agents[_0x5ec172[_0x0f29('0x41')]][_0x0f29('0x6')]));agents[_0x5ec172['secondtransfereruniqueid']][_0x0f29('0x39')]=!![];agents[_0x5ec172['secondtransfereruniqueid']][_0x0f29('0x42')]=_0x0f29('0x43');agents[_0x5ec172['secondtransfereruniqueid']][_0x0f29('0x3b')]=_0x5ec172[_0x0f29('0x44')];agents[_0x5ec172['secondtransfereruniqueid']][_0x0f29('0x3d')]=_0x5ec172['origtransfereruniqueid'];}if(_0x5ec172[_0x0f29('0x45')]&&agents[_0x5ec172['transfereeuniqueid']]){agents[_0x5ec172[_0x0f29('0x45')]][_0x0f29('0x46')]=0x1;transfers[_0x5ec172[_0x0f29('0x45')]]=_['clone'](agents[_0x5ec172[_0x0f29('0x45')]]);transfers[_0x5ec172[_0x0f29('0x45')]][_0x0f29('0x7')]=agents[_0x5ec172[_0x0f29('0x41')]]['calleridnum'];transfers[_0x5ec172[_0x0f29('0x45')]]['calleridname']=agents[_0x5ec172[_0x0f29('0x41')]]['calleridname'];transfers[_0x5ec172[_0x0f29('0x45')]][_0x0f29('0x17')]=utils[_0x0f29('0x18')]();transfers[_0x5ec172[_0x0f29('0x45')]][_0x0f29('0x29')]=utils[_0x0f29('0x18')]();transfers[_0x5ec172[_0x0f29('0x45')]]['holdtime']=0x0;transfers[_0x5ec172[_0x0f29('0x45')]]['agententerreason']=0x2;}}else if(_0x5ec172[_0x0f29('0x41')]==_0x5ec172[_0x0f29('0x47')]){if(!_[_0x0f29('0x30')](agents[_0x5ec172['origtransfereruniqueid']])){utils[_0x0f29('0x1')](util[_0x0f29('0x2')](_0x0f29('0x48'),_0x5ec172[_0x0f29('0x40')],agents[_0x5ec172[_0x0f29('0x40')]]['membername']));agents[_0x5ec172['origtransfereruniqueid']][_0x0f29('0x39')]=!![];agents[_0x5ec172[_0x0f29('0x40')]][_0x0f29('0x42')]='ATTENDED';agents[_0x5ec172['origtransfereruniqueid']][_0x0f29('0x3b')]=_0x5ec172[_0x0f29('0x49')];agents[_0x5ec172[_0x0f29('0x40')]]['transferuniqueid']=_0x5ec172['secondtransfereruniqueid'];}if(_0x5ec172['transfertargetuniqueid']&&agents[_0x5ec172[_0x0f29('0x4a')]]){agents[_0x5ec172[_0x0f29('0x4a')]]['agententerreason']=0x1;transfers[_0x5ec172[_0x0f29('0x4a')]]=_[_0x0f29('0x4b')](agents[_0x5ec172['transfertargetuniqueid']]);transfers[_0x5ec172[_0x0f29('0x4a')]]['calleridnum']=agents[_0x5ec172[_0x0f29('0x40')]][_0x0f29('0x7')];transfers[_0x5ec172['transfertargetuniqueid']][_0x0f29('0x4c')]=agents[_0x5ec172[_0x0f29('0x40')]][_0x0f29('0x4c')];transfers[_0x5ec172[_0x0f29('0x4a')]][_0x0f29('0x17')]=utils[_0x0f29('0x18')]();transfers[_0x5ec172['transfertargetuniqueid']][_0x0f29('0x29')]=utils[_0x0f29('0x18')]();transfers[_0x5ec172[_0x0f29('0x4a')]]['holdtime']=0x0;transfers[_0x5ec172[_0x0f29('0x4a')]][_0x0f29('0x46')]=0x2;}}}catch(_0x4bbc7e){utils[_0x0f29('0x1a')](util['format'](_0x0f29('0x3f'),_0x5ec172[_0x0f29('0x40')]),_0x4bbc7e);}};exports[_0x0f29('0x4d')]=function(_0x4bd8f1){try{utils[_0x0f29('0x22')](util[_0x0f29('0x2')](_0x0f29('0x4e'),_0x4bd8f1[_0x0f29('0x4')]),_0x4bd8f1);if(agents[_0x4bd8f1[_0x0f29('0x4')]]&&agents[_0x4bd8f1[_0x0f29('0x4')]]['reason']===_0x0f29('0x1c')){if(_0x4bd8f1['cause']==='21'){agents[_0x4bd8f1['uniqueid']][_0x0f29('0x1d')]=_0x0f29('0x4f');agents[_0x4bd8f1['uniqueid']][_0x0f29('0x9')]=_0x0f29('0x4f');}utils['info'](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x4bd8f1['uniqueid'],agents[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x6')],agents[_0x4bd8f1['uniqueid']]['reason'],agents[_0x4bd8f1[_0x0f29('0x4')]]['lastevent']));writeDB(agents[_0x4bd8f1[_0x0f29('0x4')]]);var _0x473eac=unanswered[_0x0f29('0x50')](_0x4bd8f1[_0x0f29('0x4')]);if(_0x473eac>-0x1){unanswered['splice'](_0x473eac,0x1);}}if(transfers[_0x4bd8f1[_0x0f29('0x4')]]){transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0xf')]=!![];transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x32')]=utils['now']();transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x26')]=utils[_0x0f29('0x33')](transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x32')],transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x29')]);transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x1d')]=_0x0f29('0x51');transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x9')]=_0x0f29('0x34');utils[_0x0f29('0x1')](util[_0x0f29('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x4bd8f1[_0x0f29('0x4')],transfers[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x6')],transfers[_0x4bd8f1[_0x0f29('0x4')]]['reason'],transfers[_0x4bd8f1['uniqueid']][_0x0f29('0x9')]));writeDB(transfers[_0x4bd8f1[_0x0f29('0x4')]],!![]);}if(agents[_0x4bd8f1[_0x0f29('0x4')]]&&agents[_0x4bd8f1['uniqueid']][_0x0f29('0x29')]){agents[_0x4bd8f1['uniqueid']][_0x0f29('0xf')]=!![];agents[_0x4bd8f1['uniqueid']][_0x0f29('0x32')]=utils[_0x0f29('0x18')]();agents[_0x4bd8f1[_0x0f29('0x4')]]['talktime']=utils[_0x0f29('0x33')](agents[_0x4bd8f1['uniqueid']]['agentcompleteAt'],agents[_0x4bd8f1[_0x0f29('0x4')]]['agentconnectAt']);agents[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x1d')]=agents[_0x4bd8f1['uniqueid']][_0x0f29('0x39')]?_0x0f29('0x39'):_0x0f29('0x51');agents[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x9')]=_0x0f29('0x34');utils[_0x0f29('0x1')](util[_0x0f29('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x4bd8f1[_0x0f29('0x4')],agents[_0x4bd8f1[_0x0f29('0x4')]][_0x0f29('0x6')],agents[_0x4bd8f1['uniqueid']][_0x0f29('0x1d')],agents[_0x4bd8f1[_0x0f29('0x4')]]['lastevent']));writeDB(agents[_0x4bd8f1[_0x0f29('0x4')]]);}}catch(_0x5e39a7){utils[_0x0f29('0x1a')](util['format'](_0x0f29('0x4e'),_0x4bd8f1['uniqueid']),_0x5e39a7);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 2bcd52f..783f2ce 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 _0x582b=['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','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','starttime','diffTime','attendedtransfer','localtwolinkedid','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr','split','substring','noop','lastapplication','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','accountcode','then','UserId','request','blinds','recording','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','[%s][calls][newstate]'];(function(_0x41d7f1,_0x51c4f3){var _0x463412=function(_0xc7471a){while(--_0xc7471a){_0x41d7f1['push'](_0x41d7f1['shift']());}};_0x463412(++_0x51c4f3);}(_0x582b,0x185));var _0xb582=function(_0x51ad81,_0xf21e4b){_0x51ad81=_0x51ad81-0x0;var _0x181ecf=_0x582b[_0x51ad81];return _0x181ecf;};'use strict';var _=require('lodash');var util=require(_0xb582('0x0'));var utils=require(_0xb582('0x1'));var transfers=require('./transfers.controller');var dispositions=[_0xb582('0x2'),'FAILED',_0xb582('0x3'),_0xb582('0x2'),_0xb582('0x2'),_0xb582('0x2'),_0xb582('0x4'),_0xb582('0x5'),_0xb582('0x3'),_0xb582('0x3'),'FAILED'];var channels={};function writeDB(_0x1e78c1){var _0x2381da;if(transfers['blinds'][_0x1e78c1[_0xb582('0x6')]]){_0x2381da=_0x1e78c1['uniqueid'];_0x1e78c1['uniqueid']=transfers['blinds'][_0x1e78c1[_0xb582('0x6')]][_0xb582('0x7')];}utils[_0xb582('0x8')](util[_0xb582('0x9')](_0xb582('0xa'),_0x1e78c1[_0xb582('0x6')],_0x1e78c1[_0xb582('0xb')],_0x1e78c1[_0xb582('0xc')],_0x1e78c1[_0xb582('0xd')],_0x1e78c1[_0xb582('0xe')],_0x1e78c1[_0xb582('0xf')],_0x1e78c1[_0xb582('0x10')],_0x1e78c1['lastevent']));if(_0x1e78c1[_0xb582('0x11')]){utils['getUserByInternal'](_0x1e78c1[_0xb582('0x11')])[_0xb582('0x12')](function(_0x58d1ce){if(_0x58d1ce){_0x1e78c1[_0xb582('0x13')]=_0x58d1ce['id'];}utils[_0xb582('0x14')]('CreateVoiceCallReport',_0x1e78c1);});}else{utils[_0xb582('0x14')]('CreateVoiceCallReport',_0x1e78c1);}if(channels[_0x1e78c1[_0xb582('0x6')]]){delete channels[_0x1e78c1[_0xb582('0x6')]];}else if(_0x2381da&&channels[_0x2381da]){if(!transfers[_0xb582('0x15')][_0x2381da][_0xb582('0x16')])delete transfers[_0xb582('0x15')][_0x2381da];delete channels[_0x2381da];}}exports[_0xb582('0x17')]=function(_0x11b5ae){try{utils[_0xb582('0x18')](util[_0xb582('0x9')](_0xb582('0x19'),_0x11b5ae[_0xb582('0x6')]),_0x11b5ae);if(_0x11b5ae['uniqueid']==_0x11b5ae[_0xb582('0x1a')]&&_0x11b5ae[_0xb582('0xb')]!=_0xb582('0x1b')){utils['info'](util[_0xb582('0x9')](_0xb582('0x1c'),_0x11b5ae['uniqueid'],_0x11b5ae[_0xb582('0x1d')],_0x11b5ae[_0xb582('0x1e')]));channels[_0x11b5ae[_0xb582('0x6')]]={'uniqueid':_0x11b5ae[_0xb582('0x6')],'accountcode':_0x11b5ae[_0xb582('0x11')],'source':_0x11b5ae[_0xb582('0xf')],'destination':_0x11b5ae['exten'],'destinationcontext':_0x11b5ae[_0xb582('0x1d')],'channel':_0x11b5ae[_0xb582('0xb')],'starttime':utils[_0xb582('0x1f')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xb582('0x2'),'amaflags':_0xb582('0x20')};}}catch(_0x1814d7){utils[_0xb582('0x21')](util[_0xb582('0x9')](_0xb582('0x19'),_0x11b5ae[_0xb582('0x6')]),_0x1814d7);}};exports['newstate']=function(_0x35c9f3){try{utils[_0xb582('0x18')](util[_0xb582('0x9')](_0xb582('0x22'),_0x35c9f3[_0xb582('0x6')]),_0x35c9f3);if(!_[_0xb582('0x23')](channels[_0x35c9f3['uniqueid']])&&_0x35c9f3[_0xb582('0x24')]==0x6){utils[_0xb582('0x8')](util[_0xb582('0x9')](_0xb582('0x25'),_0x35c9f3[_0xb582('0x6')],_0x35c9f3['context'],_0x35c9f3[_0xb582('0xb')]));if(_[_0xb582('0x23')](channels[_0x35c9f3[_0xb582('0x6')]]['systemanswertime'])){channels[_0x35c9f3[_0xb582('0x6')]][_0xb582('0x26')]=utils[_0xb582('0x1f')]();}}else if(!_['isNil'](channels[_0x35c9f3[_0xb582('0x1a')]])&&_0x35c9f3[_0xb582('0x24')]==0x6&&_0x35c9f3['context']!=_0xb582('0x27')){utils[_0xb582('0x8')](util[_0xb582('0x9')](_0xb582('0x28'),_0x35c9f3[_0xb582('0x6')],_0x35c9f3[_0xb582('0x1a')],_0x35c9f3[_0xb582('0x1d')],_0x35c9f3[_0xb582('0xb')]));channels[_0x35c9f3[_0xb582('0x1a')]]['accountcode']=_0x35c9f3[_0xb582('0x11')];channels[_0x35c9f3[_0xb582('0x1a')]][_0xb582('0x29')]=_0x35c9f3[_0xb582('0xb')];if(_[_0xb582('0x23')](channels[_0x35c9f3['linkedid']]['answertime'])){channels[_0x35c9f3[_0xb582('0x1a')]][_0xb582('0x2a')]=utils[_0xb582('0x1f')]();}channels[_0x35c9f3[_0xb582('0x1a')]][_0xb582('0x2b')]=dispositions[_[_0xb582('0x2c')](_0x35c9f3['channelstate'])]||_0xb582('0x4');}}catch(_0x2549fb){utils['error'](util['format']('[%s][calls][newstate]',_0x35c9f3[_0xb582('0x6')]),_0x2549fb);}};exports[_0xb582('0x2d')]=function(_0x3dd205){try{if(!_[_0xb582('0x23')](channels[_0x3dd205['uniqueid']])){utils[_0xb582('0x18')](util[_0xb582('0x9')](_0xb582('0x2e'),_0x3dd205[_0xb582('0x6')]),_0x3dd205);if(_[_0xb582('0x23')](channels[_0x3dd205[_0xb582('0x6')]][_0xb582('0x2f')])){channels[_0x3dd205[_0xb582('0x6')]][_0xb582('0x2f')]=_0x3dd205[_0xb582('0x30')]+'\x20<'+_0x3dd205[_0xb582('0xf')]+'>';}utils[_0xb582('0x8')](util['format'](_0xb582('0x31'),_0x3dd205[_0xb582('0x6')],channels[_0x3dd205[_0xb582('0x6')]]['callerid'],_0x3dd205[_0xb582('0x32')]));channels[_0x3dd205[_0xb582('0x6')]][_0xb582('0x33')]=utils[_0xb582('0x1f')]();channels[_0x3dd205[_0xb582('0x6')]][_0xb582('0x34')]=utils['diffTime'](channels[_0x3dd205['uniqueid']][_0xb582('0x33')],channels[_0x3dd205['uniqueid']][_0xb582('0x35')]);channels[_0x3dd205[_0xb582('0x6')]]['billableseconds']=channels[_0x3dd205[_0xb582('0x6')]]['answertime']?utils[_0xb582('0x36')](channels[_0x3dd205[_0xb582('0x6')]]['endtime'],channels[_0x3dd205[_0xb582('0x6')]][_0xb582('0x2a')]):0x0;writeDB(channels[_0x3dd205[_0xb582('0x6')]]);}}catch(_0x39adc7){utils[_0xb582('0x21')](util[_0xb582('0x9')](_0xb582('0x2e'),_0x3dd205[_0xb582('0x6')]),_0x39adc7);}};exports[_0xb582('0x37')]=function(_0x5e01cf){try{if(!_[_0xb582('0x23')](channels[_0x5e01cf[_0xb582('0x38')]])){utils['debug'](util[_0xb582('0x9')]('[%s][calls][attendedtransfer]',_0x5e01cf[_0xb582('0x39')]),_0x5e01cf);if(channels[_0x5e01cf[_0xb582('0x38')]][_0xb582('0xb')]==_0x5e01cf['transfereechannel']){utils['info'](util['format'](_0xb582('0x3a'),_0x5e01cf[_0xb582('0x39')],_0x5e01cf[_0xb582('0x38')],_0x5e01cf[_0xb582('0x3b')]));channels[_0x5e01cf['localtwolinkedid']][_0xb582('0x29')]=_0x5e01cf[_0xb582('0x3b')];channels[_0x5e01cf['localtwolinkedid']][_0xb582('0x3c')]=_0xb582('0x3d');}else if(channels[_0x5e01cf[_0xb582('0x38')]][_0xb582('0xb')]=_0x5e01cf[_0xb582('0x3e')]){utils['info'](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x5e01cf['origtransfereruniqueid'],_0x5e01cf['localtwolinkedid'],_0x5e01cf[_0xb582('0x3f')]));channels[_0x5e01cf[_0xb582('0x38')]][_0xb582('0x29')]=_0x5e01cf[_0xb582('0x3f')];channels[_0x5e01cf[_0xb582('0x38')]][_0xb582('0x3c')]=_0xb582('0x3d');}}}catch(_0x37b8ad){utils[_0xb582('0x21')](util[_0xb582('0x9')](_0xb582('0x40'),_0x5e01cf[_0xb582('0x39')]),_0x37b8ad);}};exports[_0xb582('0x41')]=function(_0x51cf6f){try{if(!_[_0xb582('0x23')](channels[_0x51cf6f[_0xb582('0x6')]])){utils[_0xb582('0x18')](util[_0xb582('0x9')](_0xb582('0x42'),_0x51cf6f[_0xb582('0x6')]),_0x51cf6f);channels[_0x51cf6f['uniqueid']][_0xb582('0x43')]=utils[_0xb582('0x1f')]();utils[_0xb582('0x8')](util[_0xb582('0x9')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x51cf6f[_0xb582('0x6')],channels[_0x51cf6f[_0xb582('0x6')]][_0xb582('0x43')]));}}catch(_0x219f52){utils[_0xb582('0x21')](util['format'](_0xb582('0x42'),_0x51cf6f[_0xb582('0x6')]),_0x219f52);}};exports['musiconholdstop']=function(_0x23e8b6){try{if(!_[_0xb582('0x23')](channels[_0x23e8b6['uniqueid']])){utils[_0xb582('0x18')](util[_0xb582('0x9')](_0xb582('0x44'),_0x23e8b6[_0xb582('0x6')]),_0x23e8b6);if(!_[_0xb582('0x23')](channels[_0x23e8b6['uniqueid']]['musiconholdstartAt'])){channels[_0x23e8b6[_0xb582('0x6')]][_0xb582('0x45')]+=utils[_0xb582('0x36')](utils['now'](),channels[_0x23e8b6[_0xb582('0x6')]][_0xb582('0x43')]);utils[_0xb582('0x8')](util[_0xb582('0x9')](_0xb582('0x46'),_0x23e8b6[_0xb582('0x6')],channels[_0x23e8b6[_0xb582('0x6')]][_0xb582('0x45')]));delete channels[_0x23e8b6[_0xb582('0x6')]][_0xb582('0x43')];}}}catch(_0x1d545d){utils[_0xb582('0x21')](util[_0xb582('0x9')](_0xb582('0x44'),_0x23e8b6['uniqueid']),_0x1d545d);}};exports['varset']=function(_0x445f33){try{if(!_['isNil'](channels[_0x445f33['uniqueid']])){utils[_0xb582('0x18')](util['format'](_0xb582('0x47'),_0x445f33[_0xb582('0x6')]),_0x445f33);if(!_[_0xb582('0x23')](_0x445f33['variable'][_0xb582('0x48')])){utils[_0xb582('0x8')](util[_0xb582('0x9')](_0xb582('0x49'),_0x445f33['uniqueid'],_0x445f33[_0xb582('0x4a')]));channels[_0x445f33[_0xb582('0x6')]]['source']=_0x445f33[_0xb582('0x4a')];}if(!_[_0xb582('0x23')](_0x445f33[_0xb582('0x4b')][_0xb582('0x4c')])){utils[_0xb582('0x8')](util[_0xb582('0x9')](_0xb582('0x4d'),_0x445f33[_0xb582('0x6')],_0x445f33['value']));channels[_0x445f33[_0xb582('0x6')]][_0xb582('0x4e')]=_0x445f33['value'];channels[_0x445f33['uniqueid']][_0xb582('0x2f')]='\x22'+_0x445f33[_0xb582('0x4a')]+_0xb582('0x4f')+_0x445f33[_0xb582('0x4a')]+'>';}if(!_[_0xb582('0x23')](_0x445f33[_0xb582('0x4b')][_0xb582('0x50')])||!_['isNil'](_0x445f33['variable'][_0xb582('0x51')])){utils[_0xb582('0x8')](util['format'](_0xb582('0x52'),_0x445f33[_0xb582('0x6')],!_['isNil'](_0x445f33[_0xb582('0x4b')][_0xb582('0x50')])?_0xb582('0x50'):_0xb582('0x51'),_0x445f33[_0xb582('0x4a')]));channels[_0x445f33['uniqueid']][_0xb582('0x2f')]=_0x445f33[_0xb582('0x4a')];}if(!_[_0xb582('0x23')](_0x445f33[_0xb582('0x4b')][_0xb582('0x53')])||!_[_0xb582('0x23')](_0x445f33[_0xb582('0x4b')]['xmcs-queue'])){utils[_0xb582('0x8')](util[_0xb582('0x9')](_0xb582('0x52'),_0x445f33['uniqueid'],!_[_0xb582('0x23')](_0x445f33['variable'][_0xb582('0x53')])?_0xb582('0x53'):'xmcs-queue',_0x445f33[_0xb582('0x4a')]));channels[_0x445f33[_0xb582('0x6')]]['lastapplication']=_0xb582('0x54');channels[_0x445f33[_0xb582('0x6')]][_0xb582('0x55')]=_0x445f33['value'];channels[_0x445f33['uniqueid']][_0xb582('0xc')]=!![];}if(!_['isNil'](_0x445f33['variable'][_0xb582('0x56')])){utils[_0xb582('0x8')](util[_0xb582('0x9')](_0xb582('0x57'),_0x445f33['uniqueid'],_0x445f33[_0xb582('0x4a')]));channels[_0x445f33[_0xb582('0x6')]]['ContactId']=_0x445f33[_0xb582('0x4a')];}if(!_['isNil'](_0x445f33[_0xb582('0x4b')][_0xb582('0x58')])){utils[_0xb582('0x8')](util[_0xb582('0x9')](_0xb582('0x59'),_0x445f33[_0xb582('0x6')],_0x445f33['value']));channels[_0x445f33[_0xb582('0x6')]][_0xb582('0x5a')]=_0x445f33[_0xb582('0x4a')];}if(!_[_0xb582('0x23')](_0x445f33['variable'][_0xb582('0x5b')])){utils[_0xb582('0x8')](util[_0xb582('0x9')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x445f33[_0xb582('0x6')],_0x445f33[_0xb582('0x4a')]));channels[_0x445f33[_0xb582('0x6')]]['routeid']=_0x445f33[_0xb582('0x4a')];}if(!_[_0xb582('0x23')](_0x445f33['variable'][_0xb582('0x5c')])){utils[_0xb582('0x8')](util[_0xb582('0x9')](_0xb582('0x5d'),_0x445f33[_0xb582('0x6')],_0x445f33[_0xb582('0x4a')]));channels[_0x445f33[_0xb582('0x6')]][_0xb582('0x5c')]=_0x445f33[_0xb582('0x4a')];}}}catch(_0x2842c6){utils[_0xb582('0x21')](util[_0xb582('0x9')]('[%s][calls][varset]',_0x445f33['uniqueid']),_0x2842c6);}};exports['newexten']=function(_0x529ecb){try{if(!_['isNil'](channels[_0x529ecb[_0xb582('0x6')]])){utils[_0xb582('0x18')](util[_0xb582('0x9')](_0xb582('0x5e'),_0x529ecb[_0xb582('0x6')]),_0x529ecb);utils[_0xb582('0x8')](util[_0xb582('0x9')](_0xb582('0x5f'),_0x529ecb['uniqueid'],_0x529ecb[_0xb582('0x60')],_0x529ecb[_0xb582('0x61')]));if(_0x529ecb[_0xb582('0x60')]['toLowerCase']()==_0xb582('0x62')&&_[_0xb582('0x63')](_0x529ecb[_0xb582('0x61')][_0xb582('0x64')](),_0xb582('0x65'))){var _0x46f783=_0x529ecb[_0xb582('0x61')][_0xb582('0x66')]('=');var _0x383850=_0x46f783[0x0][_0xb582('0x67')](_0x46f783[0x0]['lastIndexOf']('(')+0x1,_0x46f783[0x0]['lastIndexOf'](')'));var _0x42313b=_0x46f783[0x1];channels[_0x529ecb[_0xb582('0x6')]][_0x383850]=_0x42313b;}if(!_['includes'](['hangup',_0xb582('0x68'),'execif','set','gotoif'],_0x529ecb['application'][_0xb582('0x64')]())){channels[_0x529ecb[_0xb582('0x6')]][_0xb582('0x69')]=_0x529ecb[_0xb582('0x60')];channels[_0x529ecb[_0xb582('0x6')]][_0xb582('0x55')]=_0x529ecb['appdata'];}}}catch(_0x19f323){utils[_0xb582('0x21')](util['format']('[%s][calls][newexten]',_0x529ecb[_0xb582('0x6')]),_0x19f323);}}; \ No newline at end of file +var _0x02fe=['lastIndexOf','includes','execif','gotoif','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','uniqueid','blinds','transfereeuniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','error','newstate','[%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','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','starttime','billableseconds','diffTime','attendedtransfer','[%s][calls][attendedtransfer]','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','transfertargetchannel','origtransfereruniqueid','origtransfererchannel','userfield','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','[%s][calls][varset]','xmd-originatecalleridnum','value','source','xmd-phone','destination','\x22\x20<','variable','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','set','startsWith','appdata','toLowerCase','cdr','split'];(function(_0x4c4d6f,_0x5d7351){var _0x7e219a=function(_0x39a45a){while(--_0x39a45a){_0x4c4d6f['push'](_0x4c4d6f['shift']());}};_0x7e219a(++_0x5d7351);}(_0x02fe,0x1b8));var _0xe02f=function(_0x3443b5,_0xcabca9){_0x3443b5=_0x3443b5-0x0;var _0x4178e1=_0x02fe[_0x3443b5];return _0x4178e1;};'use strict';var _=require('lodash');var util=require(_0xe02f('0x0'));var utils=require(_0xe02f('0x1'));var transfers=require(_0xe02f('0x2'));var dispositions=[_0xe02f('0x3'),_0xe02f('0x4'),_0xe02f('0x4'),_0xe02f('0x3'),_0xe02f('0x3'),_0xe02f('0x3'),_0xe02f('0x5'),_0xe02f('0x6'),_0xe02f('0x4'),_0xe02f('0x4'),_0xe02f('0x4')];var channels={};function writeDB(_0x1106a4){var _0x45f434;if(transfers['blinds'][_0x1106a4[_0xe02f('0x7')]]){_0x45f434=_0x1106a4['uniqueid'];_0x1106a4[_0xe02f('0x7')]=transfers[_0xe02f('0x8')][_0x1106a4[_0xe02f('0x7')]][_0xe02f('0x9')];}utils['info'](util[_0xe02f('0xa')](_0xe02f('0xb'),_0x1106a4[_0xe02f('0x7')],_0x1106a4[_0xe02f('0xc')],_0x1106a4[_0xe02f('0xd')],_0x1106a4[_0xe02f('0xe')],_0x1106a4['interface'],_0x1106a4[_0xe02f('0xf')],_0x1106a4[_0xe02f('0x10')],_0x1106a4[_0xe02f('0x11')]));if(_0x1106a4[_0xe02f('0x12')]){utils[_0xe02f('0x13')](_0x1106a4['accountcode'])['then'](function(_0x2ef418){if(_0x2ef418){_0x1106a4[_0xe02f('0x14')]=_0x2ef418['id'];}utils[_0xe02f('0x15')]('CreateVoiceCallReport',_0x1106a4);});}else{utils['request'](_0xe02f('0x16'),_0x1106a4);}if(channels[_0x1106a4[_0xe02f('0x7')]]){delete channels[_0x1106a4['uniqueid']];}else if(_0x45f434&&channels[_0x45f434]){if(!transfers['blinds'][_0x45f434]['recording'])delete transfers[_0xe02f('0x8')][_0x45f434];delete channels[_0x45f434];}}exports[_0xe02f('0x17')]=function(_0x4c5ed0){try{utils[_0xe02f('0x18')](util['format'](_0xe02f('0x19'),_0x4c5ed0[_0xe02f('0x7')]),_0x4c5ed0);if(_0x4c5ed0[_0xe02f('0x7')]==_0x4c5ed0[_0xe02f('0x1a')]&&_0x4c5ed0['channel']!='OutgoingSpoolFailed'){utils[_0xe02f('0x1b')](util['format'](_0xe02f('0x1c'),_0x4c5ed0[_0xe02f('0x7')],_0x4c5ed0[_0xe02f('0x1d')],_0x4c5ed0[_0xe02f('0x1e')]));channels[_0x4c5ed0[_0xe02f('0x7')]]={'uniqueid':_0x4c5ed0[_0xe02f('0x7')],'accountcode':_0x4c5ed0[_0xe02f('0x12')],'source':_0x4c5ed0['calleridnum'],'destination':_0x4c5ed0['exten'],'destinationcontext':_0x4c5ed0[_0xe02f('0x1d')],'channel':_0x4c5ed0[_0xe02f('0xc')],'starttime':utils[_0xe02f('0x1f')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xe02f('0x3'),'amaflags':'DOCUMENTATION'};}}catch(_0x371412){utils[_0xe02f('0x20')](util['format'](_0xe02f('0x19'),_0x4c5ed0[_0xe02f('0x7')]),_0x371412);}};exports[_0xe02f('0x21')]=function(_0x376de8){try{utils[_0xe02f('0x18')](util['format'](_0xe02f('0x22'),_0x376de8['uniqueid']),_0x376de8);if(!_[_0xe02f('0x23')](channels[_0x376de8['uniqueid']])&&_0x376de8[_0xe02f('0x24')]==0x6){utils[_0xe02f('0x1b')](util[_0xe02f('0xa')](_0xe02f('0x25'),_0x376de8[_0xe02f('0x7')],_0x376de8[_0xe02f('0x1d')],_0x376de8[_0xe02f('0xc')]));if(_[_0xe02f('0x23')](channels[_0x376de8[_0xe02f('0x7')]][_0xe02f('0x26')])){channels[_0x376de8['uniqueid']][_0xe02f('0x26')]=utils[_0xe02f('0x1f')]();}}else if(!_[_0xe02f('0x23')](channels[_0x376de8[_0xe02f('0x1a')]])&&_0x376de8[_0xe02f('0x24')]==0x6&&_0x376de8[_0xe02f('0x1d')]!=_0xe02f('0x27')){utils[_0xe02f('0x1b')](util[_0xe02f('0xa')](_0xe02f('0x28'),_0x376de8['uniqueid'],_0x376de8['linkedid'],_0x376de8[_0xe02f('0x1d')],_0x376de8[_0xe02f('0xc')]));channels[_0x376de8[_0xe02f('0x1a')]][_0xe02f('0x12')]=_0x376de8['accountcode'];channels[_0x376de8[_0xe02f('0x1a')]][_0xe02f('0x29')]=_0x376de8['channel'];if(_['isNil'](channels[_0x376de8[_0xe02f('0x1a')]][_0xe02f('0x2a')])){channels[_0x376de8[_0xe02f('0x1a')]]['answertime']=utils[_0xe02f('0x1f')]();}channels[_0x376de8[_0xe02f('0x1a')]][_0xe02f('0x2b')]=dispositions[_['toNumber'](_0x376de8[_0xe02f('0x24')])]||_0xe02f('0x5');}}catch(_0x5aafde){utils[_0xe02f('0x20')](util[_0xe02f('0xa')]('[%s][calls][newstate]',_0x376de8[_0xe02f('0x7')]),_0x5aafde);}};exports['hangup']=function(_0x4acd22){try{if(!_[_0xe02f('0x23')](channels[_0x4acd22['uniqueid']])){utils[_0xe02f('0x18')](util['format'](_0xe02f('0x2c'),_0x4acd22[_0xe02f('0x7')]),_0x4acd22);if(_['isNil'](channels[_0x4acd22['uniqueid']][_0xe02f('0x2d')])){channels[_0x4acd22[_0xe02f('0x7')]][_0xe02f('0x2d')]=_0x4acd22[_0xe02f('0x2e')]+'\x20<'+_0x4acd22[_0xe02f('0xf')]+'>';}utils[_0xe02f('0x1b')](util[_0xe02f('0xa')](_0xe02f('0x2f'),_0x4acd22[_0xe02f('0x7')],channels[_0x4acd22[_0xe02f('0x7')]]['callerid'],_0x4acd22[_0xe02f('0x30')]));channels[_0x4acd22[_0xe02f('0x7')]][_0xe02f('0x31')]=utils[_0xe02f('0x1f')]();channels[_0x4acd22[_0xe02f('0x7')]][_0xe02f('0x32')]=utils['diffTime'](channels[_0x4acd22[_0xe02f('0x7')]][_0xe02f('0x31')],channels[_0x4acd22[_0xe02f('0x7')]][_0xe02f('0x33')]);channels[_0x4acd22[_0xe02f('0x7')]][_0xe02f('0x34')]=channels[_0x4acd22[_0xe02f('0x7')]][_0xe02f('0x2a')]?utils[_0xe02f('0x35')](channels[_0x4acd22[_0xe02f('0x7')]][_0xe02f('0x31')],channels[_0x4acd22['uniqueid']]['answertime']):0x0;writeDB(channels[_0x4acd22[_0xe02f('0x7')]]);}}catch(_0x5e2b14){utils['error'](util[_0xe02f('0xa')](_0xe02f('0x2c'),_0x4acd22[_0xe02f('0x7')]),_0x5e2b14);}};exports[_0xe02f('0x36')]=function(_0x8ea357){try{if(!_[_0xe02f('0x23')](channels[_0x8ea357['localtwolinkedid']])){utils['debug'](util['format'](_0xe02f('0x37'),_0x8ea357['origtransfereruniqueid']),_0x8ea357);if(channels[_0x8ea357[_0xe02f('0x38')]][_0xe02f('0xc')]==_0x8ea357[_0xe02f('0x39')]){utils['info'](util[_0xe02f('0xa')](_0xe02f('0x3a'),_0x8ea357['origtransfereruniqueid'],_0x8ea357[_0xe02f('0x38')],_0x8ea357[_0xe02f('0x3b')]));channels[_0x8ea357[_0xe02f('0x38')]]['destinationchannel']=_0x8ea357[_0xe02f('0x3b')];channels[_0x8ea357[_0xe02f('0x38')]]['userfield']=_0xe02f('0x3c');}else if(channels[_0x8ea357[_0xe02f('0x38')]][_0xe02f('0xc')]=_0x8ea357[_0xe02f('0x3d')]){utils[_0xe02f('0x1b')](util[_0xe02f('0xa')](_0xe02f('0x3a'),_0x8ea357[_0xe02f('0x3e')],_0x8ea357[_0xe02f('0x38')],_0x8ea357['origtransfererchannel']));channels[_0x8ea357[_0xe02f('0x38')]]['destinationchannel']=_0x8ea357[_0xe02f('0x3f')];channels[_0x8ea357['localtwolinkedid']][_0xe02f('0x40')]=_0xe02f('0x3c');}}}catch(_0x1ba6a3){utils[_0xe02f('0x20')](util[_0xe02f('0xa')](_0xe02f('0x37'),_0x8ea357[_0xe02f('0x3e')]),_0x1ba6a3);}};exports[_0xe02f('0x41')]=function(_0x17fc8b){try{if(!_['isNil'](channels[_0x17fc8b[_0xe02f('0x7')]])){utils[_0xe02f('0x18')](util['format'](_0xe02f('0x42'),_0x17fc8b[_0xe02f('0x7')]),_0x17fc8b);channels[_0x17fc8b[_0xe02f('0x7')]][_0xe02f('0x43')]=utils[_0xe02f('0x1f')]();utils[_0xe02f('0x1b')](util['format'](_0xe02f('0x44'),_0x17fc8b['uniqueid'],channels[_0x17fc8b[_0xe02f('0x7')]][_0xe02f('0x43')]));}}catch(_0x4c4712){utils['error'](util[_0xe02f('0xa')]('[%s][calls][musiconholdstart]',_0x17fc8b['uniqueid']),_0x4c4712);}};exports[_0xe02f('0x45')]=function(_0xe83dee){try{if(!_[_0xe02f('0x23')](channels[_0xe83dee[_0xe02f('0x7')]])){utils[_0xe02f('0x18')](util[_0xe02f('0xa')]('[%s][calls][musiconholdstop]',_0xe83dee['uniqueid']),_0xe83dee);if(!_[_0xe02f('0x23')](channels[_0xe83dee[_0xe02f('0x7')]][_0xe02f('0x43')])){channels[_0xe83dee[_0xe02f('0x7')]]['mohtime']+=utils[_0xe02f('0x35')](utils[_0xe02f('0x1f')](),channels[_0xe83dee[_0xe02f('0x7')]][_0xe02f('0x43')]);utils[_0xe02f('0x1b')](util[_0xe02f('0xa')](_0xe02f('0x46'),_0xe83dee[_0xe02f('0x7')],channels[_0xe83dee[_0xe02f('0x7')]][_0xe02f('0x47')]));delete channels[_0xe83dee[_0xe02f('0x7')]][_0xe02f('0x43')];}}}catch(_0x476fea){utils[_0xe02f('0x20')](util['format']('[%s][calls][musiconholdstop]',_0xe83dee[_0xe02f('0x7')]),_0x476fea);}};exports['varset']=function(_0x2a1da3){try{if(!_['isNil'](channels[_0x2a1da3[_0xe02f('0x7')]])){utils['debug'](util[_0xe02f('0xa')](_0xe02f('0x48'),_0x2a1da3[_0xe02f('0x7')]),_0x2a1da3);if(!_[_0xe02f('0x23')](_0x2a1da3['variable'][_0xe02f('0x49')])){utils['info'](util[_0xe02f('0xa')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x2a1da3[_0xe02f('0x7')],_0x2a1da3[_0xe02f('0x4a')]));channels[_0x2a1da3[_0xe02f('0x7')]][_0xe02f('0x4b')]=_0x2a1da3['value'];}if(!_[_0xe02f('0x23')](_0x2a1da3['variable'][_0xe02f('0x4c')])){utils[_0xe02f('0x1b')](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x2a1da3[_0xe02f('0x7')],_0x2a1da3[_0xe02f('0x4a')]));channels[_0x2a1da3[_0xe02f('0x7')]][_0xe02f('0x4d')]=_0x2a1da3[_0xe02f('0x4a')];channels[_0x2a1da3[_0xe02f('0x7')]]['callerid']='\x22'+_0x2a1da3[_0xe02f('0x4a')]+_0xe02f('0x4e')+_0x2a1da3[_0xe02f('0x4a')]+'>';}if(!_[_0xe02f('0x23')](_0x2a1da3[_0xe02f('0x4f')][_0xe02f('0x50')])||!_['isNil'](_0x2a1da3[_0xe02f('0x4f')][_0xe02f('0x51')])){utils['info'](util[_0xe02f('0xa')](_0xe02f('0x52'),_0x2a1da3[_0xe02f('0x7')],!_[_0xe02f('0x23')](_0x2a1da3[_0xe02f('0x4f')][_0xe02f('0x50')])?_0xe02f('0x50'):'xmd-callerid',_0x2a1da3['value']));channels[_0x2a1da3[_0xe02f('0x7')]][_0xe02f('0x2d')]=_0x2a1da3[_0xe02f('0x4a')];}if(!_[_0xe02f('0x23')](_0x2a1da3[_0xe02f('0x4f')][_0xe02f('0x53')])||!_['isNil'](_0x2a1da3[_0xe02f('0x4f')][_0xe02f('0x54')])){utils[_0xe02f('0x1b')](util[_0xe02f('0xa')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x2a1da3['uniqueid'],!_[_0xe02f('0x23')](_0x2a1da3[_0xe02f('0x4f')][_0xe02f('0x53')])?'xmd-queue':'xmcs-queue',_0x2a1da3['value']));channels[_0x2a1da3[_0xe02f('0x7')]][_0xe02f('0x55')]='Queue';channels[_0x2a1da3[_0xe02f('0x7')]][_0xe02f('0x56')]=_0x2a1da3[_0xe02f('0x4a')];channels[_0x2a1da3['uniqueid']][_0xe02f('0xd')]=!![];}if(!_[_0xe02f('0x23')](_0x2a1da3[_0xe02f('0x4f')][_0xe02f('0x57')])){utils[_0xe02f('0x1b')](util['format'](_0xe02f('0x58'),_0x2a1da3['uniqueid'],_0x2a1da3[_0xe02f('0x4a')]));channels[_0x2a1da3[_0xe02f('0x7')]][_0xe02f('0x59')]=_0x2a1da3['value'];}if(!_['isNil'](_0x2a1da3[_0xe02f('0x4f')][_0xe02f('0x5a')])){utils[_0xe02f('0x1b')](util['format']('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x2a1da3[_0xe02f('0x7')],_0x2a1da3['value']));channels[_0x2a1da3['uniqueid']][_0xe02f('0x5b')]=_0x2a1da3['value'];}if(!_[_0xe02f('0x23')](_0x2a1da3[_0xe02f('0x4f')][_0xe02f('0x5c')])){utils[_0xe02f('0x1b')](util[_0xe02f('0xa')](_0xe02f('0x5d'),_0x2a1da3[_0xe02f('0x7')],_0x2a1da3[_0xe02f('0x4a')]));channels[_0x2a1da3[_0xe02f('0x7')]]['routeid']=_0x2a1da3[_0xe02f('0x4a')];}if(!_['isNil'](_0x2a1da3[_0xe02f('0x4f')][_0xe02f('0x5e')])){utils[_0xe02f('0x1b')](util[_0xe02f('0xa')](_0xe02f('0x5f'),_0x2a1da3['uniqueid'],_0x2a1da3[_0xe02f('0x4a')]));channels[_0x2a1da3['uniqueid']]['sipcallid']=_0x2a1da3[_0xe02f('0x4a')];}}}catch(_0x397c81){utils[_0xe02f('0x20')](util[_0xe02f('0xa')](_0xe02f('0x48'),_0x2a1da3['uniqueid']),_0x397c81);}};exports['newexten']=function(_0x4212ad){try{if(!_['isNil'](channels[_0x4212ad[_0xe02f('0x7')]])){utils[_0xe02f('0x18')](util['format'](_0xe02f('0x60'),_0x4212ad[_0xe02f('0x7')]),_0x4212ad);utils[_0xe02f('0x1b')](util[_0xe02f('0xa')](_0xe02f('0x61'),_0x4212ad['uniqueid'],_0x4212ad[_0xe02f('0x62')],_0x4212ad['appdata']));if(_0x4212ad[_0xe02f('0x62')]['toLowerCase']()==_0xe02f('0x63')&&_[_0xe02f('0x64')](_0x4212ad[_0xe02f('0x65')][_0xe02f('0x66')](),_0xe02f('0x67'))){var _0x4edfa6=_0x4212ad[_0xe02f('0x65')][_0xe02f('0x68')]('=');var _0x329439=_0x4edfa6[0x0]['substring'](_0x4edfa6[0x0][_0xe02f('0x69')]('(')+0x1,_0x4edfa6[0x0][_0xe02f('0x69')](')'));var _0x1eb643=_0x4edfa6[0x1];channels[_0x4212ad[_0xe02f('0x7')]][_0x329439]=_0x1eb643;}if(!_[_0xe02f('0x6a')](['hangup','noop',_0xe02f('0x6b'),'set',_0xe02f('0x6c')],_0x4212ad[_0xe02f('0x62')][_0xe02f('0x66')]())){channels[_0x4212ad['uniqueid']][_0xe02f('0x55')]=_0x4212ad[_0xe02f('0x62')];channels[_0x4212ad['uniqueid']][_0xe02f('0x56')]=_0x4212ad[_0xe02f('0x65')];}}}catch(_0x4a7190){utils[_0xe02f('0x20')](util[_0xe02f('0xa')](_0xe02f('0x60'),_0x4212ad[_0xe02f('0x7')]),_0x4a7190);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 452a6cf..940f480 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 _0xcf6d=['[core]\x20connected','shutdown','info','[core]\x20shutdown','error','[core]\x20error','close','managerevent','./utils','connect'];(function(_0x3a2a3c,_0x37bd31){var _0x50ac9a=function(_0x494a7f){while(--_0x494a7f){_0x3a2a3c['push'](_0x3a2a3c['shift']());}};_0x50ac9a(++_0x37bd31);}(_0xcf6d,0x102));var _0xdcf6=function(_0x5b025c,_0x3c4553){_0x5b025c=_0x5b025c-0x0;var _0x1af903=_0xcf6d[_0x5b025c];return _0x1af903;};'use strict';var utils=require(_0xdcf6('0x0'));exports[_0xdcf6('0x1')]=function(){utils['info'](_0xdcf6('0x2'));};exports[_0xdcf6('0x3')]=function(){utils[_0xdcf6('0x4')](_0xdcf6('0x5'));};exports['fullybooted']=function(){utils[_0xdcf6('0x4')]('[core]\x20fullybooted');};exports[_0xdcf6('0x6')]=function(_0x4c1473){utils[_0xdcf6('0x6')](_0xdcf6('0x7'),_0x4c1473);};exports[_0xdcf6('0x8')]=function(){utils[_0xdcf6('0x4')]('[core]\x20close');};exports[_0xdcf6('0x9')]=function(_0x3d9302){}; \ No newline at end of file +var _0x2b82=['[core]\x20error','close','[core]\x20close','managerevent','./utils','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error'];(function(_0x103546,_0x37d41f){var _0xdef652=function(_0x2024dc){while(--_0x2024dc){_0x103546['push'](_0x103546['shift']());}};_0xdef652(++_0x37d41f);}(_0x2b82,0x190));var _0x22b8=function(_0x9a87a8,_0x46fc68){_0x9a87a8=_0x9a87a8-0x0;var _0x25be63=_0x2b82[_0x9a87a8];return _0x25be63;};'use strict';var utils=require(_0x22b8('0x0'));exports['connect']=function(){utils[_0x22b8('0x1')](_0x22b8('0x2'));};exports[_0x22b8('0x3')]=function(){utils[_0x22b8('0x1')](_0x22b8('0x4'));};exports[_0x22b8('0x5')]=function(){utils[_0x22b8('0x1')](_0x22b8('0x6'));};exports[_0x22b8('0x7')]=function(_0x137308){utils['error'](_0x22b8('0x8'),_0x137308);};exports[_0x22b8('0x9')]=function(){utils[_0x22b8('0x1')](_0x22b8('0xa'));};exports[_0x22b8('0xb')]=function(_0x55ee8a){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 58d7b99..44e2047 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 _0x62ce=['format','uniqueid','dialstring','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','error','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','[%s][dials][dialbegin]','starttime','now','lastevent','called','dialend','[%s][dials][dialend]','ANSWER','assign','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','calleridnum','calleridname','cause-txt','complete','duration','diffTime','billableseconds','endtime','lodash','util','info'];(function(_0x4e0d7c,_0x33bbf3){var _0x296357=function(_0x2b1a4c){while(--_0x2b1a4c){_0x4e0d7c['push'](_0x4e0d7c['shift']());}};_0x296357(++_0x33bbf3);}(_0x62ce,0x10b));var _0xe62c=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x62ce[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xe62c('0x0'));var util=require(_0xe62c('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x2facac){utils[_0xe62c('0x2')](util[_0xe62c('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x2facac[_0xe62c('0x4')],_0x2facac['channel'],_0x2facac[_0xe62c('0x5')],_0x2facac['calleridnum'],_0x2facac['connectedlinenum'],_0x2facac[_0xe62c('0x6')]));utils[_0xe62c('0x7')](_0xe62c('0x8'),_0x2facac);delete dials[_0x2facac[_0xe62c('0x4')]];}exports[_0xe62c('0x9')]=function(_0x5cc883){try{utils[_0xe62c('0xa')](util['format'](_0xe62c('0xb'),_0x5cc883[_0xe62c('0x4')]),_0x5cc883);utils['info'](util[_0xe62c('0x3')](_0xe62c('0xc'),_0x5cc883[_0xe62c('0x4')],_0x5cc883[_0xe62c('0xd')],_0x5cc883[_0xe62c('0xe')]));if(_0x5cc883[_0xe62c('0xd')][_0xe62c('0xf')]()==_0xe62c('0x10')&&_['startsWith'](_0x5cc883['appdata'][_0xe62c('0xf')](),'cdr(routeid)')){var _0x31285a=_0x5cc883[_0xe62c('0xe')]['split']('=');dials[_0x5cc883[_0xe62c('0x4')]]={'routeId':_0x31285a[0x1]};}}catch(_0x1d9680){utils[_0xe62c('0x11')](util[_0xe62c('0x3')](_0xe62c('0xb'),_0x5cc883[_0xe62c('0x4')]),_0x1d9680);}};exports['varset']=function(_0xad4dad){try{utils[_0xe62c('0xa')](util[_0xe62c('0x3')](_0xe62c('0x12'),_0xad4dad[_0xe62c('0x4')]),_0xad4dad);if(!_[_0xe62c('0x13')](_0xad4dad[_0xe62c('0x14')][_0xe62c('0x15')])){utils[_0xe62c('0x2')](util['format'](_0xe62c('0x16'),_0xad4dad[_0xe62c('0x4')],_0xad4dad['value']));dials[_0xad4dad['uniqueid']]={'routeId':_0xad4dad['value']};}}catch(_0x841552){utils[_0xe62c('0x11')](util['format']('[%s][dials][varset]',_0xad4dad[_0xe62c('0x4')]),_0x841552);}};exports['dialbegin']=function(_0x6433e0){try{if(!_[_0xe62c('0x13')](dials[_0x6433e0['uniqueid']])){utils['debug'](util[_0xe62c('0x3')](_0xe62c('0x17'),_0x6433e0[_0xe62c('0x4')]),_0x6433e0);dials[_0x6433e0[_0xe62c('0x4')]]=_['assign'](dials[_0x6433e0[_0xe62c('0x4')]],_0x6433e0);dials[_0x6433e0[_0xe62c('0x4')]][_0xe62c('0x18')]=utils[_0xe62c('0x19')]();dials[_0x6433e0[_0xe62c('0x4')]][_0xe62c('0x1a')]=_0xe62c('0x1b');utils[_0xe62c('0x2')](util[_0xe62c('0x3')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x6433e0[_0xe62c('0x4')],dials[_0x6433e0[_0xe62c('0x4')]][_0xe62c('0x18')]));}}catch(_0x344477){utils['error'](util[_0xe62c('0x3')]('[%s][dials][dialbegin]',_0x6433e0[_0xe62c('0x4')]),_0x344477);}};exports[_0xe62c('0x1c')]=function(_0x546e1e){try{if(!_[_0xe62c('0x13')](dials[_0x546e1e[_0xe62c('0x4')]])){utils['debug'](util[_0xe62c('0x3')](_0xe62c('0x1d'),_0x546e1e[_0xe62c('0x4')]),_0x546e1e);dials[_0x546e1e[_0xe62c('0x4')]]['dialstatus']=_0x546e1e[_0xe62c('0x6')];if(_0x546e1e[_0xe62c('0x6')]==_0xe62c('0x1e')){dials[_0x546e1e[_0xe62c('0x4')]]=_[_0xe62c('0x1f')](dials[_0x546e1e[_0xe62c('0x4')]],_0x546e1e);dials[_0x546e1e['uniqueid']][_0xe62c('0x20')]=utils[_0xe62c('0x19')]();dials[_0x546e1e[_0xe62c('0x4')]][_0xe62c('0x1a')]=_0xe62c('0x21');utils[_0xe62c('0x2')](util[_0xe62c('0x3')](_0xe62c('0x22'),_0x546e1e[_0xe62c('0x4')],_0x546e1e[_0xe62c('0x6')],dials[_0x546e1e[_0xe62c('0x4')]]['answertime']));}else{utils[_0xe62c('0x2')](util[_0xe62c('0x3')](_0xe62c('0x23'),_0x546e1e[_0xe62c('0x4')],_0x546e1e[_0xe62c('0x6')]));}}}catch(_0x40ff99){utils[_0xe62c('0x11')](util[_0xe62c('0x3')](_0xe62c('0x1d'),_0x546e1e[_0xe62c('0x4')]),_0x40ff99);}};exports['hangup']=function(_0x34c348){try{if(!_[_0xe62c('0x13')](dials[_0x34c348['uniqueid']])){utils[_0xe62c('0xa')](util[_0xe62c('0x3')](_0xe62c('0x24'),_0x34c348[_0xe62c('0x4')]),_0x34c348);utils[_0xe62c('0x2')](util[_0xe62c('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x34c348[_0xe62c('0x4')],_0x34c348[_0xe62c('0x25')],_0x34c348[_0xe62c('0x26')],_0x34c348[_0xe62c('0x27')]));dials[_0x34c348[_0xe62c('0x4')]]=_[_0xe62c('0x1f')](dials[_0x34c348[_0xe62c('0x4')]],{'endtime':utils[_0xe62c('0x19')](),'lastevent':_0xe62c('0x28')});dials[_0x34c348[_0xe62c('0x4')]][_0xe62c('0x29')]=utils['diffTime'](dials[_0x34c348[_0xe62c('0x4')]]['endtime'],dials[_0x34c348[_0xe62c('0x4')]][_0xe62c('0x18')]);dials[_0x34c348[_0xe62c('0x4')]]['holdtime']=utils[_0xe62c('0x2a')](dials[_0x34c348[_0xe62c('0x4')]][_0xe62c('0x20')]||dials[_0x34c348[_0xe62c('0x4')]]['endtime'],dials[_0x34c348['uniqueid']][_0xe62c('0x18')]);dials[_0x34c348[_0xe62c('0x4')]][_0xe62c('0x2b')]=dials[_0x34c348[_0xe62c('0x4')]][_0xe62c('0x20')]?utils[_0xe62c('0x2a')](dials[_0x34c348['uniqueid']][_0xe62c('0x2c')],dials[_0x34c348[_0xe62c('0x4')]][_0xe62c('0x20')]):0x0;writeDB(dials[_0x34c348[_0xe62c('0x4')]]);}}catch(_0x1bd9c1){utils['error'](util['format'](_0xe62c('0x24'),_0x34c348['uniqueid']),_0x1bd9c1);}}; \ No newline at end of file +var _0x7ed7=['connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridname','now','complete','duration','holdtime','diffTime','endtime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring','calleridnum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr(routeid)','error','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]','starttime','called','dialend','[%s][dials][dialend]','ANSWER','assign','answertime','lastevent'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x7ed7,0x10c));var _0x77ed=function(_0x1e7060,_0x453e1a){_0x1e7060=_0x1e7060-0x0;var _0x4233cf=_0x7ed7[_0x1e7060];return _0x4233cf;};'use strict';var _=require(_0x77ed('0x0'));var util=require(_0x77ed('0x1'));var utils=require(_0x77ed('0x2'));var dials={};function writeDB(_0x343178){utils[_0x77ed('0x3')](util[_0x77ed('0x4')](_0x77ed('0x5'),_0x343178[_0x77ed('0x6')],_0x343178['channel'],_0x343178[_0x77ed('0x7')],_0x343178[_0x77ed('0x8')],_0x343178['connectedlinenum'],_0x343178[_0x77ed('0x9')]));utils[_0x77ed('0xa')](_0x77ed('0xb'),_0x343178);delete dials[_0x343178[_0x77ed('0x6')]];}exports[_0x77ed('0xc')]=function(_0x37a074){try{utils[_0x77ed('0xd')](util[_0x77ed('0x4')](_0x77ed('0xe'),_0x37a074['uniqueid']),_0x37a074);utils[_0x77ed('0x3')](util['format'](_0x77ed('0xf'),_0x37a074['uniqueid'],_0x37a074[_0x77ed('0x10')],_0x37a074[_0x77ed('0x11')]));if(_0x37a074[_0x77ed('0x10')][_0x77ed('0x12')]()==_0x77ed('0x13')&&_['startsWith'](_0x37a074[_0x77ed('0x11')][_0x77ed('0x12')](),_0x77ed('0x14'))){var _0x4e984d=_0x37a074['appdata']['split']('=');dials[_0x37a074['uniqueid']]={'routeId':_0x4e984d[0x1]};}}catch(_0x5970e8){utils[_0x77ed('0x15')](util[_0x77ed('0x4')](_0x77ed('0xe'),_0x37a074[_0x77ed('0x6')]),_0x5970e8);}};exports['varset']=function(_0x2a24b9){try{utils[_0x77ed('0xd')](util[_0x77ed('0x4')]('[%s][dials][varset]',_0x2a24b9[_0x77ed('0x6')]),_0x2a24b9);if(!_[_0x77ed('0x16')](_0x2a24b9[_0x77ed('0x17')][_0x77ed('0x18')])){utils[_0x77ed('0x3')](util[_0x77ed('0x4')](_0x77ed('0x19'),_0x2a24b9[_0x77ed('0x6')],_0x2a24b9[_0x77ed('0x1a')]));dials[_0x2a24b9['uniqueid']]={'routeId':_0x2a24b9['value']};}}catch(_0x162998){utils[_0x77ed('0x15')](util[_0x77ed('0x4')](_0x77ed('0x1b'),_0x2a24b9[_0x77ed('0x6')]),_0x162998);}};exports[_0x77ed('0x1c')]=function(_0x182da5){try{if(!_[_0x77ed('0x16')](dials[_0x182da5['uniqueid']])){utils[_0x77ed('0xd')](util[_0x77ed('0x4')](_0x77ed('0x1d'),_0x182da5[_0x77ed('0x6')]),_0x182da5);dials[_0x182da5[_0x77ed('0x6')]]=_['assign'](dials[_0x182da5[_0x77ed('0x6')]],_0x182da5);dials[_0x182da5['uniqueid']][_0x77ed('0x1e')]=utils['now']();dials[_0x182da5[_0x77ed('0x6')]]['lastevent']=_0x77ed('0x1f');utils[_0x77ed('0x3')](util[_0x77ed('0x4')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x182da5['uniqueid'],dials[_0x182da5[_0x77ed('0x6')]]['starttime']));}}catch(_0x4f6b17){utils[_0x77ed('0x15')](util[_0x77ed('0x4')]('[%s][dials][dialbegin]',_0x182da5[_0x77ed('0x6')]),_0x4f6b17);}};exports[_0x77ed('0x20')]=function(_0x297c8c){try{if(!_['isNil'](dials[_0x297c8c['uniqueid']])){utils['debug'](util[_0x77ed('0x4')](_0x77ed('0x21'),_0x297c8c[_0x77ed('0x6')]),_0x297c8c);dials[_0x297c8c[_0x77ed('0x6')]][_0x77ed('0x9')]=_0x297c8c[_0x77ed('0x9')];if(_0x297c8c['dialstatus']==_0x77ed('0x22')){dials[_0x297c8c[_0x77ed('0x6')]]=_[_0x77ed('0x23')](dials[_0x297c8c[_0x77ed('0x6')]],_0x297c8c);dials[_0x297c8c[_0x77ed('0x6')]][_0x77ed('0x24')]=utils['now']();dials[_0x297c8c[_0x77ed('0x6')]][_0x77ed('0x25')]=_0x77ed('0x26');utils[_0x77ed('0x3')](util[_0x77ed('0x4')](_0x77ed('0x27'),_0x297c8c[_0x77ed('0x6')],_0x297c8c[_0x77ed('0x9')],dials[_0x297c8c['uniqueid']][_0x77ed('0x24')]));}else{utils[_0x77ed('0x3')](util[_0x77ed('0x4')](_0x77ed('0x28'),_0x297c8c[_0x77ed('0x6')],_0x297c8c[_0x77ed('0x9')]));}}}catch(_0x27a237){utils[_0x77ed('0x15')](util[_0x77ed('0x4')]('[%s][dials][dialend]',_0x297c8c[_0x77ed('0x6')]),_0x27a237);}};exports[_0x77ed('0x29')]=function(_0xc13d3e){try{if(!_[_0x77ed('0x16')](dials[_0xc13d3e[_0x77ed('0x6')]])){utils[_0x77ed('0xd')](util[_0x77ed('0x4')](_0x77ed('0x2a'),_0xc13d3e[_0x77ed('0x6')]),_0xc13d3e);utils['info'](util[_0x77ed('0x4')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0xc13d3e[_0x77ed('0x6')],_0xc13d3e[_0x77ed('0x8')],_0xc13d3e[_0x77ed('0x2b')],_0xc13d3e['cause-txt']));dials[_0xc13d3e[_0x77ed('0x6')]]=_[_0x77ed('0x23')](dials[_0xc13d3e[_0x77ed('0x6')]],{'endtime':utils[_0x77ed('0x2c')](),'lastevent':_0x77ed('0x2d')});dials[_0xc13d3e['uniqueid']][_0x77ed('0x2e')]=utils['diffTime'](dials[_0xc13d3e[_0x77ed('0x6')]]['endtime'],dials[_0xc13d3e[_0x77ed('0x6')]][_0x77ed('0x1e')]);dials[_0xc13d3e[_0x77ed('0x6')]][_0x77ed('0x2f')]=utils[_0x77ed('0x30')](dials[_0xc13d3e[_0x77ed('0x6')]][_0x77ed('0x24')]||dials[_0xc13d3e[_0x77ed('0x6')]][_0x77ed('0x31')],dials[_0xc13d3e[_0x77ed('0x6')]][_0x77ed('0x1e')]);dials[_0xc13d3e[_0x77ed('0x6')]][_0x77ed('0x32')]=dials[_0xc13d3e['uniqueid']]['answertime']?utils[_0x77ed('0x30')](dials[_0xc13d3e['uniqueid']][_0x77ed('0x31')],dials[_0xc13d3e[_0x77ed('0x6')]][_0x77ed('0x24')]):0x0;writeDB(dials[_0xc13d3e['uniqueid']]);}}catch(_0x44e1e2){utils['error'](util[_0x77ed('0x4')](_0x77ed('0x2a'),_0xc13d3e[_0x77ed('0x6')]),_0x44e1e2);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 0f67a98..c50838a 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 _0x7c6d=['queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','asterisk','port','username','password','xdr','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','device','[%s][index][devicestatechange]','agentcalled','uniqueid','[%s][index][agentcalled]','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x7c6d,0xe2));var _0xd7c6=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x7c6d[_0x5e3b04];return _0x1fc44d;};var AsteriskManager=require(_0xd7c6('0x0'));var config=require(_0xd7c6('0x1'));var utils=require(_0xd7c6('0x2'));var util=require(_0xd7c6('0x3'));var ami=new AsteriskManager(config[_0xd7c6('0x4')][_0xd7c6('0x5')],config[_0xd7c6('0x4')]['ip'],config[_0xd7c6('0x4')][_0xd7c6('0x6')],config['asterisk'][_0xd7c6('0x7')],!![]);ami['keepConnected']();if(config[_0xd7c6('0x8')]&&config[_0xd7c6('0x8')]['disabled']){utils['info']('XDR\x20DISABLED');}else{var agents=require(_0xd7c6('0x9'));var calls=require('./calls.controller');var queues=require(_0xd7c6('0xa'));var recordings=require(_0xd7c6('0xb'));var members=require(_0xd7c6('0xc'));var dials=require(_0xd7c6('0xd'));var transfers=require('./transfers.controller');var core=require('./core.controller');ami['on'](_0xd7c6('0xe'),core[_0xd7c6('0xe')]);ami['on'](_0xd7c6('0xf'),core[_0xd7c6('0xf')]);ami['on'](_0xd7c6('0x10'),core[_0xd7c6('0x10')]);ami['on']('error',core[_0xd7c6('0x11')]);ami['on'](_0xd7c6('0x12'),core[_0xd7c6('0x12')]);ami['on']('managerevent',core[_0xd7c6('0x13')]);ami['on'](_0xd7c6('0x14'),function(_0x285665){try{utils[_0xd7c6('0x15')](util[_0xd7c6('0x16')]('[%s][index][devicestatechange]',_0x285665[_0xd7c6('0x17')]),_0x285665);members[_0xd7c6('0x14')](_0x285665);}catch(_0x34483f){utils['error'](util[_0xd7c6('0x16')](_0xd7c6('0x18'),_0x285665[_0xd7c6('0x17')]),_0x34483f);}});ami['on'](_0xd7c6('0x19'),function(_0x4ad82e){try{utils[_0xd7c6('0x15')](util[_0xd7c6('0x16')]('[%s][index][agentcalled]',_0x4ad82e[_0xd7c6('0x1a')]),_0x4ad82e);agents[_0xd7c6('0x19')](_0x4ad82e);}catch(_0x4780db){utils[_0xd7c6('0x11')](util[_0xd7c6('0x16')](_0xd7c6('0x1b'),_0x4ad82e[_0xd7c6('0x1a')]),_0x4780db);}});ami['on']('agentringnoanswer',function(_0x2965cc){try{utils[_0xd7c6('0x15')](util['format'](_0xd7c6('0x1c'),_0x2965cc[_0xd7c6('0x1a')]),_0x2965cc);agents[_0xd7c6('0x1d')](_0x2965cc);}catch(_0x479d0c){utils[_0xd7c6('0x11')](util[_0xd7c6('0x16')](_0xd7c6('0x1c'),_0x2965cc[_0xd7c6('0x1a')]),_0x479d0c);}});ami['on'](_0xd7c6('0x1e'),function(_0x56f61d){try{utils[_0xd7c6('0x15')](util[_0xd7c6('0x16')](_0xd7c6('0x1f'),_0x56f61d[_0xd7c6('0x1a')]),_0x56f61d);agents[_0xd7c6('0x1e')](_0x56f61d);queues[_0xd7c6('0x1e')](_0x56f61d);}catch(_0x4b9cf3){utils['error'](util[_0xd7c6('0x16')]('[%s][index][agentconnect]',_0x56f61d[_0xd7c6('0x1a')]),_0x4b9cf3);}});ami['on'](_0xd7c6('0x20'),function(_0x41942b){try{utils[_0xd7c6('0x15')](util[_0xd7c6('0x16')]('[%s][index][agentcomplete]',_0x41942b[_0xd7c6('0x1a')]),_0x41942b);agents['agentcomplete'](_0x41942b);queues[_0xd7c6('0x20')](_0x41942b);members['agentcomplete'](_0x41942b);}catch(_0x285479){utils[_0xd7c6('0x11')](util[_0xd7c6('0x16')](_0xd7c6('0x21'),_0x41942b[_0xd7c6('0x1a')]),_0x285479);}});ami['on'](_0xd7c6('0x22'),function(_0x111814){try{utils[_0xd7c6('0x15')](util[_0xd7c6('0x16')](_0xd7c6('0x23'),_0x111814['uniqueid']),_0x111814);agents[_0xd7c6('0x22')](_0x111814);queues['queuecallerabandon'](_0x111814);}catch(_0x40017a){utils[_0xd7c6('0x11')](util[_0xd7c6('0x16')](_0xd7c6('0x23'),_0x111814['uniqueid']),_0x40017a);}});ami['on']('queuecallerjoin',function(_0x40dc0f){try{utils[_0xd7c6('0x15')](util['format']('[%s][index][queuecallerjoin]',_0x40dc0f[_0xd7c6('0x1a')]),_0x40dc0f);queues[_0xd7c6('0x24')](_0x40dc0f);recordings[_0xd7c6('0x24')](_0x40dc0f);}catch(_0x300074){utils[_0xd7c6('0x11')](util[_0xd7c6('0x16')](_0xd7c6('0x25'),_0x40dc0f[_0xd7c6('0x1a')]),_0x300074);}});ami['on'](_0xd7c6('0x26'),function(_0x598e97){try{utils['debug'](util[_0xd7c6('0x16')](_0xd7c6('0x27'),_0x598e97[_0xd7c6('0x1a')]),_0x598e97);queues[_0xd7c6('0x26')](_0x598e97);}catch(_0x30ddb6){utils[_0xd7c6('0x11')](util['format'](_0xd7c6('0x27'),_0x598e97[_0xd7c6('0x1a')]),_0x30ddb6);}});ami['on'](_0xd7c6('0x28'),function(_0x17f88b){try{utils[_0xd7c6('0x15')](util[_0xd7c6('0x16')](_0xd7c6('0x29'),_0x17f88b[_0xd7c6('0x1a')]),_0x17f88b);queues[_0xd7c6('0x28')](_0x17f88b);calls[_0xd7c6('0x28')](_0x17f88b);}catch(_0x5e34a7){utils[_0xd7c6('0x11')](util[_0xd7c6('0x16')](_0xd7c6('0x29'),_0x17f88b['uniqueid']),_0x5e34a7);}});ami['on'](_0xd7c6('0x2a'),function(_0x2eedab){try{utils[_0xd7c6('0x15')](util[_0xd7c6('0x16')](_0xd7c6('0x2b'),_0x2eedab[_0xd7c6('0x1a')]),_0x2eedab);queues[_0xd7c6('0x2a')](_0x2eedab);calls[_0xd7c6('0x2a')](_0x2eedab);}catch(_0x49758d){utils['error'](util['format']('[%s][index][musiconholdstop]',_0x2eedab[_0xd7c6('0x1a')]),_0x49758d);}});ami['on'](_0xd7c6('0x2c'),function(_0x1c2233){try{utils[_0xd7c6('0x15')](util[_0xd7c6('0x16')](_0xd7c6('0x2d'),_0x1c2233[_0xd7c6('0x1a')]),_0x1c2233);calls[_0xd7c6('0x2c')](_0x1c2233);recordings[_0xd7c6('0x2c')](_0x1c2233);}catch(_0xea9b4){utils['error'](util[_0xd7c6('0x16')](_0xd7c6('0x2d'),_0x1c2233[_0xd7c6('0x1a')]),_0xea9b4);}});ami['on'](_0xd7c6('0x2e'),function(_0x328a14){try{utils[_0xd7c6('0x15')](util[_0xd7c6('0x16')]('[%s][index][hangup]',_0x328a14[_0xd7c6('0x1a')]),_0x328a14);calls[_0xd7c6('0x2e')](_0x328a14);recordings[_0xd7c6('0x2e')](_0x328a14);dials[_0xd7c6('0x2e')](_0x328a14);agents[_0xd7c6('0x2e')](_0x328a14);queues[_0xd7c6('0x2e')](_0x328a14);}catch(_0x1d58c7){utils[_0xd7c6('0x11')](util[_0xd7c6('0x16')](_0xd7c6('0x2f'),_0x328a14['uniqueid']),_0x1d58c7);}});ami['on'](_0xd7c6('0x30'),function(_0x23777e){try{utils[_0xd7c6('0x15')](util[_0xd7c6('0x16')](_0xd7c6('0x31'),_0x23777e[_0xd7c6('0x1a')]),_0x23777e);members[_0xd7c6('0x30')](_0x23777e);}catch(_0x17dfa4){utils[_0xd7c6('0x11')](util['format']('[%s][index][cdr]',_0x23777e['uniqueid']),_0x17dfa4);}});ami['on']('blindtransfer',function(_0x26912b){try{utils[_0xd7c6('0x15')](util[_0xd7c6('0x16')](_0xd7c6('0x32'),_0x26912b[_0xd7c6('0x1a')]),_0x26912b);queues[_0xd7c6('0x33')](_0x26912b);agents[_0xd7c6('0x33')](_0x26912b);transfers[_0xd7c6('0x33')](_0x26912b);recordings[_0xd7c6('0x33')](_0x26912b);}catch(_0x4985b7){utils[_0xd7c6('0x11')](util['format'](_0xd7c6('0x32'),_0x26912b[_0xd7c6('0x1a')]),_0x4985b7);}});ami['on'](_0xd7c6('0x34'),function(_0x3c108f){try{utils['debug'](util['format']('[%s][index][attendedtransfer]',_0x3c108f[_0xd7c6('0x35')]),_0x3c108f);queues[_0xd7c6('0x34')](_0x3c108f);transfers[_0xd7c6('0x34')](_0x3c108f);agents[_0xd7c6('0x34')](_0x3c108f);calls[_0xd7c6('0x34')](_0x3c108f);}catch(_0x5d17f0){utils[_0xd7c6('0x11')](util[_0xd7c6('0x16')](_0xd7c6('0x36'),_0x3c108f[_0xd7c6('0x35')]),_0x5d17f0);}});ami['on'](_0xd7c6('0x37'),function(_0x218b6e){try{utils['debug'](util['format'](_0xd7c6('0x38'),_0x218b6e[_0xd7c6('0x1a')]),_0x218b6e);queues[_0xd7c6('0x37')](_0x218b6e);recordings[_0xd7c6('0x37')](_0x218b6e);calls[_0xd7c6('0x37')](_0x218b6e);dials['varset'](_0x218b6e);}catch(_0x12f728){utils['error'](util[_0xd7c6('0x16')]('[%s][index][varset]',_0x218b6e[_0xd7c6('0x1a')]),_0x12f728);}});ami['on'](_0xd7c6('0x39'),function(_0x238f41){try{utils[_0xd7c6('0x15')](util[_0xd7c6('0x16')]('[%s][index][newexten]',_0x238f41[_0xd7c6('0x1a')]),_0x238f41);calls['newexten'](_0x238f41);recordings[_0xd7c6('0x39')](_0x238f41);dials[_0xd7c6('0x39')](_0x238f41);}catch(_0x1f980a){utils[_0xd7c6('0x11')](util['format'](_0xd7c6('0x3a'),_0x238f41['uniqueid']),_0x1f980a);}});ami['on'](_0xd7c6('0x3b'),function(_0x2478ca){try{utils[_0xd7c6('0x15')](util[_0xd7c6('0x16')](_0xd7c6('0x3c'),_0x2478ca[_0xd7c6('0x1a')]),_0x2478ca);calls[_0xd7c6('0x3b')](_0x2478ca);recordings[_0xd7c6('0x3b')](_0x2478ca);}catch(_0x52f31b){utils[_0xd7c6('0x11')](util[_0xd7c6('0x16')]('[%s][index][newchannel]',_0x2478ca[_0xd7c6('0x1a')]),_0x52f31b);}});ami['on']('dialbegin',function(_0x3ecc4b){try{utils[_0xd7c6('0x15')](util[_0xd7c6('0x16')]('[%s][index][dialbegin]',_0x3ecc4b[_0xd7c6('0x1a')]),_0x3ecc4b);dials[_0xd7c6('0x3d')](_0x3ecc4b);}catch(_0x51f5c8){utils[_0xd7c6('0x11')](util[_0xd7c6('0x16')](_0xd7c6('0x3e'),_0x3ecc4b[_0xd7c6('0x1a')]),_0x51f5c8);}});ami['on'](_0xd7c6('0x3f'),function(_0x168d06){try{utils[_0xd7c6('0x15')](util[_0xd7c6('0x16')](_0xd7c6('0x40'),_0x168d06[_0xd7c6('0x1a')]),_0x168d06);dials[_0xd7c6('0x3f')](_0x168d06);}catch(_0x5c33be){utils[_0xd7c6('0x11')](util['format'](_0xd7c6('0x40'),_0x168d06[_0xd7c6('0x1a')]),_0x5c33be);}});} \ No newline at end of file +var _0x2565=['cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','[%s][index][newexten]','newexten','[%s][index][newchannel]','newchannel','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','asterisk','username','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./dials.controller','./transfers.controller','./core.controller','connect','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2565,0x9a));var _0x5256=function(_0x39e598,_0x4c2cce){_0x39e598=_0x39e598-0x0;var _0x4a7e41=_0x2565[_0x39e598];return _0x4a7e41;};var AsteriskManager=require(_0x5256('0x0'));var config=require(_0x5256('0x1'));var utils=require('./utils');var util=require(_0x5256('0x2'));var ami=new AsteriskManager(config[_0x5256('0x3')]['port'],config[_0x5256('0x3')]['ip'],config[_0x5256('0x3')][_0x5256('0x4')],config[_0x5256('0x3')][_0x5256('0x5')],!![]);ami[_0x5256('0x6')]();if(config['xdr']&&config[_0x5256('0x7')][_0x5256('0x8')]){utils[_0x5256('0x9')](_0x5256('0xa'));}else{var agents=require(_0x5256('0xb'));var calls=require(_0x5256('0xc'));var queues=require(_0x5256('0xd'));var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require(_0x5256('0xe'));var transfers=require(_0x5256('0xf'));var core=require(_0x5256('0x10'));ami['on'](_0x5256('0x11'),core[_0x5256('0x11')]);ami['on']('shutdown',core['shutdown']);ami['on'](_0x5256('0x12'),core[_0x5256('0x12')]);ami['on']('error',core[_0x5256('0x13')]);ami['on'](_0x5256('0x14'),core['close']);ami['on'](_0x5256('0x15'),core[_0x5256('0x15')]);ami['on'](_0x5256('0x16'),function(_0x3516b9){try{utils[_0x5256('0x17')](util[_0x5256('0x18')](_0x5256('0x19'),_0x3516b9[_0x5256('0x1a')]),_0x3516b9);members[_0x5256('0x16')](_0x3516b9);}catch(_0x127ae4){utils[_0x5256('0x13')](util[_0x5256('0x18')](_0x5256('0x19'),_0x3516b9['device']),_0x127ae4);}});ami['on'](_0x5256('0x1b'),function(_0x39ec3c){try{utils[_0x5256('0x17')](util[_0x5256('0x18')](_0x5256('0x1c'),_0x39ec3c[_0x5256('0x1d')]),_0x39ec3c);agents[_0x5256('0x1b')](_0x39ec3c);}catch(_0x12a5e9){utils[_0x5256('0x13')](util[_0x5256('0x18')]('[%s][index][agentcalled]',_0x39ec3c['uniqueid']),_0x12a5e9);}});ami['on'](_0x5256('0x1e'),function(_0x2d1002){try{utils[_0x5256('0x17')](util[_0x5256('0x18')](_0x5256('0x1f'),_0x2d1002[_0x5256('0x1d')]),_0x2d1002);agents[_0x5256('0x1e')](_0x2d1002);}catch(_0x4cba04){utils['error'](util[_0x5256('0x18')]('[%s][index][agentringnoanswer]',_0x2d1002['uniqueid']),_0x4cba04);}});ami['on'](_0x5256('0x20'),function(_0x1175ff){try{utils[_0x5256('0x17')](util[_0x5256('0x18')]('[%s][index][agentconnect]',_0x1175ff['uniqueid']),_0x1175ff);agents[_0x5256('0x20')](_0x1175ff);queues[_0x5256('0x20')](_0x1175ff);}catch(_0x19eb8c){utils[_0x5256('0x13')](util['format'](_0x5256('0x21'),_0x1175ff[_0x5256('0x1d')]),_0x19eb8c);}});ami['on'](_0x5256('0x22'),function(_0x2a39ad){try{utils[_0x5256('0x17')](util[_0x5256('0x18')](_0x5256('0x23'),_0x2a39ad['uniqueid']),_0x2a39ad);agents[_0x5256('0x22')](_0x2a39ad);queues['agentcomplete'](_0x2a39ad);members['agentcomplete'](_0x2a39ad);}catch(_0x58a718){utils[_0x5256('0x13')](util[_0x5256('0x18')]('[%s][index][agentcomplete]',_0x2a39ad[_0x5256('0x1d')]),_0x58a718);}});ami['on'](_0x5256('0x24'),function(_0x41a67a){try{utils[_0x5256('0x17')](util[_0x5256('0x18')](_0x5256('0x25'),_0x41a67a[_0x5256('0x1d')]),_0x41a67a);agents[_0x5256('0x24')](_0x41a67a);queues[_0x5256('0x24')](_0x41a67a);}catch(_0x370d1a){utils[_0x5256('0x13')](util['format'](_0x5256('0x25'),_0x41a67a[_0x5256('0x1d')]),_0x370d1a);}});ami['on'](_0x5256('0x26'),function(_0x24ad88){try{utils[_0x5256('0x17')](util[_0x5256('0x18')]('[%s][index][queuecallerjoin]',_0x24ad88['uniqueid']),_0x24ad88);queues[_0x5256('0x26')](_0x24ad88);recordings['queuecallerjoin'](_0x24ad88);}catch(_0x4278da){utils[_0x5256('0x13')](util[_0x5256('0x18')](_0x5256('0x27'),_0x24ad88[_0x5256('0x1d')]),_0x4278da);}});ami['on'](_0x5256('0x28'),function(_0x288759){try{utils[_0x5256('0x17')](util[_0x5256('0x18')](_0x5256('0x29'),_0x288759['uniqueid']),_0x288759);queues[_0x5256('0x28')](_0x288759);}catch(_0x3b6e58){utils['error'](util[_0x5256('0x18')](_0x5256('0x29'),_0x288759[_0x5256('0x1d')]),_0x3b6e58);}});ami['on'](_0x5256('0x2a'),function(_0x5ca885){try{utils['debug'](util[_0x5256('0x18')]('[%s][index][musiconholdstart]',_0x5ca885[_0x5256('0x1d')]),_0x5ca885);queues[_0x5256('0x2a')](_0x5ca885);calls[_0x5256('0x2a')](_0x5ca885);}catch(_0xdefb99){utils[_0x5256('0x13')](util[_0x5256('0x18')](_0x5256('0x2b'),_0x5ca885[_0x5256('0x1d')]),_0xdefb99);}});ami['on'](_0x5256('0x2c'),function(_0x3470bf){try{utils['debug'](util['format'](_0x5256('0x2d'),_0x3470bf[_0x5256('0x1d')]),_0x3470bf);queues[_0x5256('0x2c')](_0x3470bf);calls['musiconholdstop'](_0x3470bf);}catch(_0xa1dd91){utils[_0x5256('0x13')](util[_0x5256('0x18')](_0x5256('0x2d'),_0x3470bf[_0x5256('0x1d')]),_0xa1dd91);}});ami['on'](_0x5256('0x2e'),function(_0x35ef8f){try{utils[_0x5256('0x17')](util['format'](_0x5256('0x2f'),_0x35ef8f[_0x5256('0x1d')]),_0x35ef8f);calls[_0x5256('0x2e')](_0x35ef8f);recordings[_0x5256('0x2e')](_0x35ef8f);}catch(_0x47547e){utils[_0x5256('0x13')](util[_0x5256('0x18')](_0x5256('0x2f'),_0x35ef8f[_0x5256('0x1d')]),_0x47547e);}});ami['on'](_0x5256('0x30'),function(_0x462ac0){try{utils[_0x5256('0x17')](util[_0x5256('0x18')]('[%s][index][hangup]',_0x462ac0[_0x5256('0x1d')]),_0x462ac0);calls[_0x5256('0x30')](_0x462ac0);recordings[_0x5256('0x30')](_0x462ac0);dials['hangup'](_0x462ac0);agents[_0x5256('0x30')](_0x462ac0);queues[_0x5256('0x30')](_0x462ac0);}catch(_0x555638){utils[_0x5256('0x13')](util[_0x5256('0x18')](_0x5256('0x31'),_0x462ac0[_0x5256('0x1d')]),_0x555638);}});ami['on'](_0x5256('0x32'),function(_0x45002d){try{utils['debug'](util[_0x5256('0x18')](_0x5256('0x33'),_0x45002d[_0x5256('0x1d')]),_0x45002d);members[_0x5256('0x32')](_0x45002d);}catch(_0x3ed0a8){utils['error'](util[_0x5256('0x18')]('[%s][index][cdr]',_0x45002d['uniqueid']),_0x3ed0a8);}});ami['on'](_0x5256('0x34'),function(_0xfad32a){try{utils[_0x5256('0x17')](util[_0x5256('0x18')](_0x5256('0x35'),_0xfad32a[_0x5256('0x1d')]),_0xfad32a);queues['blindtransfer'](_0xfad32a);agents[_0x5256('0x34')](_0xfad32a);transfers[_0x5256('0x34')](_0xfad32a);recordings[_0x5256('0x34')](_0xfad32a);}catch(_0x17c31d){utils['error'](util[_0x5256('0x18')](_0x5256('0x35'),_0xfad32a[_0x5256('0x1d')]),_0x17c31d);}});ami['on']('attendedtransfer',function(_0x3ddeb0){try{utils[_0x5256('0x17')](util[_0x5256('0x18')](_0x5256('0x36'),_0x3ddeb0[_0x5256('0x37')]),_0x3ddeb0);queues[_0x5256('0x38')](_0x3ddeb0);transfers[_0x5256('0x38')](_0x3ddeb0);agents['attendedtransfer'](_0x3ddeb0);calls[_0x5256('0x38')](_0x3ddeb0);}catch(_0x38b1d7){utils[_0x5256('0x13')](util[_0x5256('0x18')](_0x5256('0x36'),_0x3ddeb0[_0x5256('0x37')]),_0x38b1d7);}});ami['on'](_0x5256('0x39'),function(_0x11e0fa){try{utils[_0x5256('0x17')](util['format'](_0x5256('0x3a'),_0x11e0fa[_0x5256('0x1d')]),_0x11e0fa);queues[_0x5256('0x39')](_0x11e0fa);recordings[_0x5256('0x39')](_0x11e0fa);calls['varset'](_0x11e0fa);dials[_0x5256('0x39')](_0x11e0fa);}catch(_0x1d0b6b){utils[_0x5256('0x13')](util['format'](_0x5256('0x3a'),_0x11e0fa[_0x5256('0x1d')]),_0x1d0b6b);}});ami['on']('newexten',function(_0xe96979){try{utils[_0x5256('0x17')](util[_0x5256('0x18')](_0x5256('0x3b'),_0xe96979['uniqueid']),_0xe96979);calls[_0x5256('0x3c')](_0xe96979);recordings[_0x5256('0x3c')](_0xe96979);dials['newexten'](_0xe96979);}catch(_0x422cd1){utils[_0x5256('0x13')](util[_0x5256('0x18')](_0x5256('0x3b'),_0xe96979[_0x5256('0x1d')]),_0x422cd1);}});ami['on']('newchannel',function(_0x2fd9df){try{utils[_0x5256('0x17')](util[_0x5256('0x18')](_0x5256('0x3d'),_0x2fd9df[_0x5256('0x1d')]),_0x2fd9df);calls[_0x5256('0x3e')](_0x2fd9df);recordings[_0x5256('0x3e')](_0x2fd9df);}catch(_0x1d9855){utils[_0x5256('0x13')](util[_0x5256('0x18')]('[%s][index][newchannel]',_0x2fd9df['uniqueid']),_0x1d9855);}});ami['on']('dialbegin',function(_0x5aa213){try{utils[_0x5256('0x17')](util[_0x5256('0x18')](_0x5256('0x3f'),_0x5aa213['uniqueid']),_0x5aa213);dials[_0x5256('0x40')](_0x5aa213);}catch(_0x50093c){utils['error'](util['format'](_0x5256('0x41'),_0x5aa213[_0x5256('0x1d')]),_0x50093c);}});ami['on'](_0x5256('0x42'),function(_0x8bf0dc){try{utils['debug'](util[_0x5256('0x18')](_0x5256('0x43'),_0x8bf0dc[_0x5256('0x1d')]),_0x8bf0dc);dials[_0x5256('0x42')](_0x8bf0dc);}catch(_0x4245aa){utils['error'](util[_0x5256('0x18')](_0x5256('0x43'),_0x8bf0dc['uniqueid']),_0x4245aa);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 5c176c3..b617523 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 _0xcebd=['data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','source','lodash','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','membername','type','then','internal','request','CreateMemberReport','name','catch','error','some','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','[%s][members][agentcomplete]','[%s][members][cdr]','channel','split','assign','data1','data2'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xcebd,0x15c));var _0xdceb=function(_0x866d1f,_0x8194d9){_0x866d1f=_0x866d1f-0x0;var _0x2fad60=_0xcebd[_0x866d1f];return _0x2fad60;};'use strict';var _=require(_0xdceb('0x0'));var util=require('util');var utils=require(_0xdceb('0x1'));var members={};var exclude=[_0xdceb('0x2'),_0xdceb('0x3')];function writeDB(_0x4b1472){utils[_0xdceb('0x4')](util[_0xdceb('0x5')](_0xdceb('0x6'),_0x4b1472[_0xdceb('0x7')],_0x4b1472[_0xdceb('0x8')],_0x4b1472['channel'],_0x4b1472['data2'],_0x4b1472[_0xdceb('0x9')],_0x4b1472[_0xdceb('0xa')]));if(_0x4b1472[_0xdceb('0x8')]){utils['getUserByInterface'](_0x4b1472[_0xdceb('0x8')])[_0xdceb('0xb')](function(_0x18c45d){if(_0x18c45d){_0x4b1472[_0xdceb('0x9')]=_0x18c45d['name'];_0x4b1472[_0xdceb('0xc')]=_0x18c45d['internal'];utils[_0xdceb('0xd')](_0xdceb('0xe'),_0x4b1472);}else{utils['getUserByName'](_0x4b1472[_0xdceb('0x8')]['split']('/')[0x1])[_0xdceb('0xb')](function(_0x5bded7){if(_0x5bded7){_0x4b1472[_0xdceb('0x9')]=_0x5bded7[_0xdceb('0xf')];_0x4b1472[_0xdceb('0xc')]=_0x5bded7[_0xdceb('0xc')];utils['request'](_0xdceb('0xe'),_0x4b1472);}});}})[_0xdceb('0x10')](function(_0x426b34){utils[_0xdceb('0x11')](util[_0xdceb('0x5')]('[%s][members][writeDB]',_0x4b1472[_0xdceb('0x7')]),_0x426b34);});}delete members[_0x4b1472[_0xdceb('0x8')]];}function startsWith(_0x4fc8ea,_0x213e80){return _[_0xdceb('0x12')](_0x4fc8ea,function(_0x45ff2d){return _['startsWith'](_0x213e80,_0x45ff2d);});}exports[_0xdceb('0x13')]=function(_0x434de3){try{utils[_0xdceb('0x14')](util[_0xdceb('0x5')](_0xdceb('0x15'),members[_0x434de3[_0xdceb('0x16')]]?members[_0x434de3['device']]['uniqueid']:_0x434de3[_0xdceb('0x16')]),_0x434de3);utils[_0xdceb('0x4')](util['format'](_0xdceb('0x17'),members[_0x434de3[_0xdceb('0x16')]]?members[_0x434de3[_0xdceb('0x16')]][_0xdceb('0x7')]:_0x434de3['device'],_0x434de3['state'],_0x434de3[_0xdceb('0x16')]));switch(_0x434de3[_0xdceb('0x18')]){case _0xdceb('0x19'):case _0xdceb('0x1a'):if(!startsWith(exclude,_0x434de3[_0xdceb('0x16')])){members[_0x434de3[_0xdceb('0x16')]]={'channel':'voice','interface':_0x434de3[_0xdceb('0x16')],'type':_0xdceb('0x1b'),'enterAt':utils[_0xdceb('0x1c')](),'role':_0xdceb('0x1d')};}break;case _0xdceb('0x1e'):if(!_[_0xdceb('0x1f')](members[_0x434de3[_0xdceb('0x16')]])){members[_0x434de3[_0xdceb('0x16')]][_0xdceb('0x20')]=utils[_0xdceb('0x1c')]();members[_0x434de3[_0xdceb('0x16')]][_0xdceb('0x21')]=utils[_0xdceb('0x22')](members[_0x434de3[_0xdceb('0x16')]][_0xdceb('0x20')],members[_0x434de3[_0xdceb('0x16')]]['enterAt']);if(members[_0x434de3[_0xdceb('0x16')]][_0xdceb('0x7')]){writeDB(members[_0x434de3[_0xdceb('0x16')]]);}}break;default:break;}}catch(_0x4e5ca2){utils[_0xdceb('0x11')](util[_0xdceb('0x5')](_0xdceb('0x15'),members[_0x434de3[_0xdceb('0x16')]]?members[_0x434de3['device']]['uniqueid']:_0x434de3['device']),_0x4e5ca2);}};exports['agentcomplete']=function(_0x587d95){try{if(!_['isNil'](members[_0x587d95[_0xdceb('0x8')]])){utils['debug'](util[_0xdceb('0x5')]('[%s][members][agentcomplete]',_0x587d95[_0xdceb('0x7')]),_0x587d95);utils[_0xdceb('0x4')](util['format'](_0xdceb('0x23'),_0x587d95[_0xdceb('0x7')],_0x587d95[_0xdceb('0x8')],_0x587d95[_0xdceb('0x24')]));members[_0x587d95[_0xdceb('0x8')]]=_['assign'](members[_0x587d95[_0xdceb('0x8')]],{'data4':_0x587d95[_0xdceb('0x24')],'uniqueid':_0x587d95[_0xdceb('0x7')]});}}catch(_0x136c17){utils[_0xdceb('0x11')](util[_0xdceb('0x5')](_0xdceb('0x25'),_0x587d95[_0xdceb('0x7')]),_0x136c17);}};exports['cdr']=function(_0x46a04c){try{utils['debug'](util[_0xdceb('0x5')](_0xdceb('0x26'),_0x46a04c[_0xdceb('0x7')]),_0x46a04c);if(_0x46a04c[_0xdceb('0x27')]){var _0x4fea13=_0x46a04c[_0xdceb('0x27')][_0xdceb('0x28')]('-')[0x0];if(!_[_0xdceb('0x1f')](members[_0x4fea13])){members[_0x4fea13]=_[_0xdceb('0x29')](members[_0x4fea13],{'data1':members[_0x4fea13][_0xdceb('0x2a')]||_0x46a04c['type'],'data2':members[_0x4fea13][_0xdceb('0x2b')]||_0x46a04c['source'],'data3':members[_0x4fea13][_0xdceb('0x2c')]||_0x46a04c[_0xdceb('0x2d')],'uniqueid':members[_0x4fea13]['uniqueid']||_0x46a04c['uniqueid']});utils[_0xdceb('0x4')](util[_0xdceb('0x5')](_0xdceb('0x2e'),_0x46a04c[_0xdceb('0x7')],members[_0x4fea13][_0xdceb('0x2a')],members[_0x4fea13]['data2'],members[_0x4fea13]['data3']));if(members[_0x4fea13][_0xdceb('0x20')]){writeDB(members[_0x4fea13]);}}}if(_0x46a04c[_0xdceb('0x2f')]){var _0x4f3972=_0x46a04c[_0xdceb('0x2f')][_0xdceb('0x28')]('-')[0x0];if(!_['isNil'](members[_0x4f3972])){members[_0x4f3972]=_['assign'](members[_0x4f3972],{'data1':members[_0x4f3972]['data1']||_0x46a04c[_0xdceb('0xa')],'data2':members[_0x4f3972][_0xdceb('0x2b')]||_0x46a04c[_0xdceb('0x30')],'data3':members[_0x4f3972][_0xdceb('0x2c')]||_0x46a04c[_0xdceb('0x2d')],'uniqueid':members[_0x4f3972][_0xdceb('0x7')]||_0x46a04c['uniqueid']});utils[_0xdceb('0x4')](util[_0xdceb('0x5')](_0xdceb('0x2e'),_0x46a04c[_0xdceb('0x7')],members[_0x4f3972][_0xdceb('0x2a')],members[_0x4f3972][_0xdceb('0x2b')],members[_0x4f3972][_0xdceb('0x2c')]));if(members[_0x4f3972][_0xdceb('0x20')]){writeDB(members[_0x4f3972]);}}}}catch(_0x27ec0c){utils[_0xdceb('0x11')](util[_0xdceb('0x5')](_0xdceb('0x26'),_0x46a04c[_0xdceb('0x7')]),_0x27ec0c);}}; \ No newline at end of file +var _0x3cb7=['[%s][members][cdr]','lodash','util','Local/_attended@transfer','Queue:','info','format','uniqueid','channel','data2','membername','type','interface','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','error','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','agent','NOT_INUSE','isNil','exitAt','now','duration','diffTime','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','data1','source','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','data3'];(function(_0x5e5189,_0x5e67d2){var _0x3c6db8=function(_0x2d7839){while(--_0x2d7839){_0x5e5189['push'](_0x5e5189['shift']());}};_0x3c6db8(++_0x5e67d2);}(_0x3cb7,0x1a8));var _0x73cb=function(_0x4a8bad,_0x4bfb2f){_0x4a8bad=_0x4a8bad-0x0;var _0x30cf32=_0x3cb7[_0x4a8bad];return _0x30cf32;};'use strict';var _=require(_0x73cb('0x0'));var util=require(_0x73cb('0x1'));var utils=require('./utils');var members={};var exclude=[_0x73cb('0x2'),_0x73cb('0x3')];function writeDB(_0x1d6827){utils[_0x73cb('0x4')](util[_0x73cb('0x5')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x1d6827[_0x73cb('0x6')],_0x1d6827['interface'],_0x1d6827[_0x73cb('0x7')],_0x1d6827[_0x73cb('0x8')],_0x1d6827[_0x73cb('0x9')],_0x1d6827[_0x73cb('0xa')]));if(_0x1d6827[_0x73cb('0xb')]){utils[_0x73cb('0xc')](_0x1d6827['interface'])[_0x73cb('0xd')](function(_0xe80a05){if(_0xe80a05){_0x1d6827[_0x73cb('0x9')]=_0xe80a05[_0x73cb('0xe')];_0x1d6827[_0x73cb('0xf')]=_0xe80a05[_0x73cb('0xf')];utils[_0x73cb('0x10')](_0x73cb('0x11'),_0x1d6827);}else{utils[_0x73cb('0x12')](_0x1d6827[_0x73cb('0xb')][_0x73cb('0x13')]('/')[0x1])[_0x73cb('0xd')](function(_0x37d9ba){if(_0x37d9ba){_0x1d6827[_0x73cb('0x9')]=_0x37d9ba['name'];_0x1d6827[_0x73cb('0xf')]=_0x37d9ba[_0x73cb('0xf')];utils[_0x73cb('0x10')]('CreateMemberReport',_0x1d6827);}});}})['catch'](function(_0x3a0a2a){utils[_0x73cb('0x14')](util[_0x73cb('0x5')]('[%s][members][writeDB]',_0x1d6827[_0x73cb('0x6')]),_0x3a0a2a);});}delete members[_0x1d6827[_0x73cb('0xb')]];}function startsWith(_0x53f53e,_0x1a1a8d){return _['some'](_0x53f53e,function(_0x32f167){return _[_0x73cb('0x15')](_0x1a1a8d,_0x32f167);});}exports[_0x73cb('0x16')]=function(_0x4caaab){try{utils[_0x73cb('0x17')](util['format'](_0x73cb('0x18'),members[_0x4caaab[_0x73cb('0x19')]]?members[_0x4caaab[_0x73cb('0x19')]]['uniqueid']:_0x4caaab[_0x73cb('0x19')]),_0x4caaab);utils[_0x73cb('0x4')](util[_0x73cb('0x5')](_0x73cb('0x1a'),members[_0x4caaab['device']]?members[_0x4caaab[_0x73cb('0x19')]][_0x73cb('0x6')]:_0x4caaab[_0x73cb('0x19')],_0x4caaab[_0x73cb('0x1b')],_0x4caaab[_0x73cb('0x19')]));switch(_0x4caaab[_0x73cb('0x1b')]){case'INUSE':case _0x73cb('0x1c'):if(!startsWith(exclude,_0x4caaab[_0x73cb('0x19')])){members[_0x4caaab['device']]={'channel':'voice','interface':_0x4caaab['device'],'type':'TALKING','enterAt':utils['now'](),'role':_0x73cb('0x1d')};}break;case _0x73cb('0x1e'):if(!_[_0x73cb('0x1f')](members[_0x4caaab['device']])){members[_0x4caaab[_0x73cb('0x19')]][_0x73cb('0x20')]=utils[_0x73cb('0x21')]();members[_0x4caaab[_0x73cb('0x19')]][_0x73cb('0x22')]=utils[_0x73cb('0x23')](members[_0x4caaab['device']][_0x73cb('0x20')],members[_0x4caaab[_0x73cb('0x19')]]['enterAt']);if(members[_0x4caaab[_0x73cb('0x19')]][_0x73cb('0x6')]){writeDB(members[_0x4caaab['device']]);}}break;default:break;}}catch(_0x4e3d8c){utils['error'](util[_0x73cb('0x5')](_0x73cb('0x18'),members[_0x4caaab['device']]?members[_0x4caaab[_0x73cb('0x19')]]['uniqueid']:_0x4caaab[_0x73cb('0x19')]),_0x4e3d8c);}};exports[_0x73cb('0x24')]=function(_0x175be6){try{if(!_[_0x73cb('0x1f')](members[_0x175be6[_0x73cb('0xb')]])){utils[_0x73cb('0x17')](util[_0x73cb('0x5')](_0x73cb('0x25'),_0x175be6[_0x73cb('0x6')]),_0x175be6);utils[_0x73cb('0x4')](util[_0x73cb('0x5')](_0x73cb('0x26'),_0x175be6[_0x73cb('0x6')],_0x175be6[_0x73cb('0xb')],_0x175be6['queue']));members[_0x175be6['interface']]=_[_0x73cb('0x27')](members[_0x175be6[_0x73cb('0xb')]],{'data4':_0x175be6[_0x73cb('0x28')],'uniqueid':_0x175be6['uniqueid']});}}catch(_0x5d34dc){utils['error'](util[_0x73cb('0x5')](_0x73cb('0x25'),_0x175be6[_0x73cb('0x6')]),_0x5d34dc);}};exports['cdr']=function(_0x194171){try{utils[_0x73cb('0x17')](util[_0x73cb('0x5')]('[%s][members][cdr]',_0x194171[_0x73cb('0x6')]),_0x194171);if(_0x194171['channel']){var _0x1b32cf=_0x194171['channel']['split']('-')[0x0];if(!_[_0x73cb('0x1f')](members[_0x1b32cf])){members[_0x1b32cf]=_['assign'](members[_0x1b32cf],{'data1':members[_0x1b32cf][_0x73cb('0x29')]||_0x194171[_0x73cb('0xa')],'data2':members[_0x1b32cf][_0x73cb('0x8')]||_0x194171[_0x73cb('0x2a')],'data3':members[_0x1b32cf]['data3']||_0x194171['destination'],'uniqueid':members[_0x1b32cf][_0x73cb('0x6')]||_0x194171[_0x73cb('0x6')]});utils[_0x73cb('0x4')](util[_0x73cb('0x5')](_0x73cb('0x2b'),_0x194171[_0x73cb('0x6')],members[_0x1b32cf][_0x73cb('0x29')],members[_0x1b32cf][_0x73cb('0x8')],members[_0x1b32cf]['data3']));if(members[_0x1b32cf][_0x73cb('0x20')]){writeDB(members[_0x1b32cf]);}}}if(_0x194171[_0x73cb('0x2c')]){var _0x1c6dca=_0x194171[_0x73cb('0x2c')][_0x73cb('0x13')]('-')[0x0];if(!_[_0x73cb('0x1f')](members[_0x1c6dca])){members[_0x1c6dca]=_[_0x73cb('0x27')](members[_0x1c6dca],{'data1':members[_0x1c6dca]['data1']||_0x194171[_0x73cb('0xa')],'data2':members[_0x1c6dca][_0x73cb('0x8')]||_0x194171[_0x73cb('0x2a')],'data3':members[_0x1c6dca]['data3']||_0x194171['destination'],'uniqueid':members[_0x1c6dca][_0x73cb('0x6')]||_0x194171['uniqueid']});utils[_0x73cb('0x4')](util[_0x73cb('0x5')](_0x73cb('0x2b'),_0x194171['uniqueid'],members[_0x1c6dca][_0x73cb('0x29')],members[_0x1c6dca]['data2'],members[_0x1c6dca][_0x73cb('0x2d')]));if(members[_0x1c6dca][_0x73cb('0x20')]){writeDB(members[_0x1c6dca]);}}}}catch(_0x22243d){utils[_0x73cb('0x14')](util[_0x73cb('0x5')](_0x73cb('0x2e'),_0x194171[_0x73cb('0x6')]),_0x22243d);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 443810a..4824fbf 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 _0xe44e=['attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','ATTENDED','transfereelinkedid','queuecallerenterreason','clone','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','hangup','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','[%s][queues][varset]','variable','value','toUpperCase','queuecallerabandonAt','queuecallerexitAt','now','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','queuecallerleaveAt','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','reason','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'];(function(_0x241f06,_0x3c7ef8){var _0x2ec3a1=function(_0xa80e82){while(--_0xa80e82){_0x241f06['push'](_0x241f06['shift']());}};_0x2ec3a1(++_0x3c7ef8);}(_0xe44e,0x1bf));var _0xee44=function(_0x88b90b,_0x496565){_0x88b90b=_0x88b90b-0x0;var _0x107cc8=_0xe44e[_0x88b90b];return _0x107cc8;};'use strict';var _=require(_0xee44('0x0'));var util=require(_0xee44('0x1'));var utils=require(_0xee44('0x2'));var queues={};function writeDB(_0x515cfd){utils[_0xee44('0x3')](util[_0xee44('0x4')](_0xee44('0x5'),_0x515cfd['uniqueid'],_0x515cfd['channel'],_0x515cfd[_0xee44('0x6')],_0x515cfd[_0xee44('0x7')],_0x515cfd[_0xee44('0x8')],_0x515cfd[_0xee44('0x9')],_0x515cfd[_0xee44('0xa')]));if(_0x515cfd['queue']){utils[_0xee44('0xb')](_0x515cfd[_0xee44('0x6')])[_0xee44('0xc')](function(_0x5636e8){if(_0x5636e8){_0x515cfd[_0xee44('0xd')]=_0x5636e8[_0xee44('0xd')];}utils[_0xee44('0xe')](_0xee44('0xf'),_0x515cfd);});}else{utils[_0xee44('0xe')](_0xee44('0xf'),_0x515cfd);}if(_0x515cfd[_0xee44('0x10')]){delete queues[_0x515cfd['transfereduniqueid']];}else{delete queues[_0x515cfd[_0xee44('0x11')]];}}exports[_0xee44('0x12')]=function(_0x17f110){try{utils[_0xee44('0x13')](util[_0xee44('0x4')](_0xee44('0x14'),_0x17f110[_0xee44('0x11')]),_0x17f110);utils[_0xee44('0x3')](util[_0xee44('0x4')](_0xee44('0x15'),_0x17f110['uniqueid'],_0x17f110[_0xee44('0x6')],_0x17f110[_0xee44('0x16')]));queues[_0x17f110[_0xee44('0x11')]]=_[_0xee44('0x17')](_0x17f110,{'originalposition':_0x17f110['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x5531b9){utils[_0xee44('0x18')](util[_0xee44('0x4')](_0xee44('0x14'),_0x17f110[_0xee44('0x11')]),_0x5531b9);}};exports[_0xee44('0x19')]=function(_0x18da00){try{if(!_[_0xee44('0x1a')](queues[_0x18da00['uniqueid']])){utils[_0xee44('0x13')](util[_0xee44('0x4')](_0xee44('0x1b'),_0x18da00[_0xee44('0x11')]),_0x18da00);if(queues[_0x18da00['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x18da00[_0xee44('0x11')]][_0xee44('0x1c')]&&!queues[_0x18da00[_0xee44('0x11')]][_0xee44('0x1d')]){queues[_0x18da00[_0xee44('0x11')]]['queuecallercomplete']=!![];queues[_0x18da00['uniqueid']][_0xee44('0x1e')]=utils['now']();queues[_0x18da00['uniqueid']][_0xee44('0xa')]=_0xee44('0x1f');}utils[_0xee44('0x3')](util[_0xee44('0x4')](_0xee44('0x20'),_0x18da00['uniqueid'],queues[_0x18da00[_0xee44('0x11')]][_0xee44('0x21')],queues[_0x18da00['uniqueid']][_0xee44('0xa')]));writeDB(queues[_0x18da00[_0xee44('0x11')]]);}else if(queues[_0x18da00[_0xee44('0x11')]]['transfereduniqueid']){utils[_0xee44('0x3')](util[_0xee44('0x4')](_0xee44('0x22'),_0x18da00['uniqueid'],queues[_0x18da00[_0xee44('0x11')]]['name'],queues[_0x18da00[_0xee44('0x11')]][_0xee44('0x10')]));queues[queues[_0x18da00[_0xee44('0x11')]][_0xee44('0x10')]]=queues[_0x18da00[_0xee44('0x11')]];queues[queues[_0x18da00['uniqueid']][_0xee44('0x10')]]['queuecallerenterreason']=0x2;delete queues[_0x18da00[_0xee44('0x11')]];}}}catch(_0x36a6ad){utils[_0xee44('0x18')](util[_0xee44('0x4')](_0xee44('0x1b'),_0x18da00['uniqueid']),_0x36a6ad);}};exports[_0xee44('0x23')]=function(_0x1f9449){try{utils['debug'](util[_0xee44('0x4')](_0xee44('0x24'),_0x1f9449[_0xee44('0x11')]),_0x1f9449);if(!_[_0xee44('0x1a')](_0x1f9449[_0xee44('0x25')]['queuestatus'])&&_0x1f9449[_0xee44('0x26')][_0xee44('0x27')]()!=='CONTINUE'){if(!_[_0xee44('0x1a')](queues[_0x1f9449[_0xee44('0x11')]])){queues[_0x1f9449['uniqueid']][_0xee44('0x1c')]=![];queues[_0x1f9449['uniqueid']][_0xee44('0x28')]=null;queues[_0x1f9449[_0xee44('0x11')]][_0xee44('0x1d')]=!![];queues[_0x1f9449[_0xee44('0x11')]][_0xee44('0x29')]=utils['now']();queues[_0x1f9449['uniqueid']][_0xee44('0xa')]=_0x1f9449[_0xee44('0x26')][_0xee44('0x27')]();utils[_0xee44('0x3')](util[_0xee44('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x1f9449[_0xee44('0x11')],queues[_0x1f9449[_0xee44('0x11')]][_0xee44('0x21')],_0x1f9449[_0xee44('0x26')],queues[_0x1f9449[_0xee44('0x11')]][_0xee44('0xa')]));writeDB(queues[_0x1f9449[_0xee44('0x11')]]);}}else if(!_[_0xee44('0x1a')](_0x1f9449[_0xee44('0x25')]['queueposition'])){if(!_[_0xee44('0x1a')](queues[_0x1f9449[_0xee44('0x11')]])&&!queues[_0x1f9449[_0xee44('0x11')]][_0xee44('0x1c')]){queues[_0x1f9449[_0xee44('0x11')]][_0xee44('0x1c')]=![];queues[_0x1f9449[_0xee44('0x11')]][_0xee44('0x28')]=null;queues[_0x1f9449[_0xee44('0x11')]][_0xee44('0x1d')]=!![];queues[_0x1f9449['uniqueid']][_0xee44('0x29')]=utils[_0xee44('0x2a')]();queues[_0x1f9449[_0xee44('0x11')]][_0xee44('0xa')]=_0xee44('0x2b');utils['info'](util[_0xee44('0x4')](_0xee44('0x2c'),_0x1f9449[_0xee44('0x11')],queues[_0x1f9449[_0xee44('0x11')]][_0xee44('0x21')],_0x1f9449[_0xee44('0x26')],queues[_0x1f9449[_0xee44('0x11')]][_0xee44('0xa')]));}}}catch(_0x104467){utils[_0xee44('0x18')](util['format']('[%s][queues][varset]',_0x1f9449[_0xee44('0x11')]),_0x104467);}};exports['queuecallerabandon']=function(_0x98584){try{if(!_['isNil'](queues[_0x98584[_0xee44('0x11')]])){utils['debug'](util[_0xee44('0x4')](_0xee44('0x2d'),_0x98584[_0xee44('0x11')]),_0x98584);queues[_0x98584[_0xee44('0x11')]][_0xee44('0x1d')]=![];queues[_0x98584[_0xee44('0x11')]][_0xee44('0x29')]=null;queues[_0x98584[_0xee44('0x11')]][_0xee44('0x1c')]=!![];queues[_0x98584[_0xee44('0x11')]]['queuecallerabandonAt']=utils['now']();queues[_0x98584[_0xee44('0x11')]][_0xee44('0xa')]=_0xee44('0x2e');utils[_0xee44('0x3')](util[_0xee44('0x4')](_0xee44('0x2f'),_0x98584[_0xee44('0x11')],queues[_0x98584[_0xee44('0x11')]][_0xee44('0x21')],queues[_0x98584[_0xee44('0x11')]][_0xee44('0xa')]));}}catch(_0x46c27c){utils[_0xee44('0x18')](util['format'](_0xee44('0x2d'),_0x98584[_0xee44('0x11')]),_0x46c27c);}};exports[_0xee44('0x30')]=function(_0x40edec){try{if(!_['isNil'](queues[_0x40edec[_0xee44('0x11')]])){utils[_0xee44('0x13')](util['format'](_0xee44('0x31'),_0x40edec['uniqueid']),_0x40edec);utils[_0xee44('0x3')](util['format']('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x40edec['uniqueid'],queues[_0x40edec[_0xee44('0x11')]]['name'],_0x40edec[_0xee44('0x32')],_0x40edec[_0xee44('0x33')]));queues[_0x40edec['uniqueid']][_0xee44('0x30')]=!![];queues[_0x40edec[_0xee44('0x11')]][_0xee44('0x34')]=utils[_0xee44('0x2a')]();queues[_0x40edec[_0xee44('0x11')]]['holdtime']=utils[_0xee44('0x35')](queues[_0x40edec[_0xee44('0x11')]][_0xee44('0x34')],queues[_0x40edec['uniqueid']][_0xee44('0x36')]);queues[_0x40edec[_0xee44('0x11')]][_0xee44('0x16')]=_0x40edec['position'];queues[_0x40edec[_0xee44('0x11')]][_0xee44('0x37')]=_0x40edec[_0xee44('0x37')];queues[_0x40edec[_0xee44('0x11')]][_0xee44('0x32')]=_0x40edec['connectedlinenum'];queues[_0x40edec[_0xee44('0x11')]][_0xee44('0x33')]=_0x40edec[_0xee44('0x33')];}}catch(_0x49f1d9){utils[_0xee44('0x18')](util['format'](_0xee44('0x31'),_0x40edec[_0xee44('0x11')]),_0x49f1d9);}};exports[_0xee44('0x38')]=function(_0x23aa32){try{if(!_[_0xee44('0x1a')](queues[_0x23aa32[_0xee44('0x11')]])){utils[_0xee44('0x13')](util[_0xee44('0x4')](_0xee44('0x39'),_0x23aa32['uniqueid']),_0x23aa32);utils[_0xee44('0x3')](util[_0xee44('0x4')](_0xee44('0x3a'),_0x23aa32[_0xee44('0x11')],queues[_0x23aa32[_0xee44('0x11')]][_0xee44('0x21')],_0x23aa32[_0xee44('0x3b')],_0x23aa32[_0xee44('0x3c')]));queues[_0x23aa32[_0xee44('0x11')]][_0xee44('0x1c')]=![];queues[_0x23aa32[_0xee44('0x11')]][_0xee44('0x1c')]=![];queues[_0x23aa32[_0xee44('0x11')]][_0xee44('0x28')]=null;queues[_0x23aa32[_0xee44('0x11')]][_0xee44('0x1d')]=![];queues[_0x23aa32[_0xee44('0x11')]]['queuecallerexitreason']=null;queues[_0x23aa32['uniqueid']]['queuecallerexitAt']=null;queues[_0x23aa32[_0xee44('0x11')]][_0xee44('0x3d')]=!![];queues[_0x23aa32[_0xee44('0x11')]][_0xee44('0x9')]=_0x23aa32[_0xee44('0x3c')];queues[_0x23aa32[_0xee44('0x11')]][_0xee44('0x7')]=_0x23aa32[_0xee44('0x3b')];}}catch(_0x36e3db){utils[_0xee44('0x18')](util[_0xee44('0x4')]('[%s][queues][agentconnect]',_0x23aa32['uniqueid']),_0x36e3db);}};exports[_0xee44('0x3e')]=function(_0x33cb8f){try{if(!_[_0xee44('0x1a')](queues[_0x33cb8f[_0xee44('0x11')]])){if(queues[_0x33cb8f[_0xee44('0x11')]][_0xee44('0x34')]){utils[_0xee44('0x13')](util['format'](_0xee44('0x3f'),_0x33cb8f['uniqueid']),_0x33cb8f);queues[_0x33cb8f[_0xee44('0x11')]][_0xee44('0x1c')]=![];queues[_0x33cb8f[_0xee44('0x11')]][_0xee44('0x1c')]=![];queues[_0x33cb8f['uniqueid']]['queuecallerabandonAt']=null;queues[_0x33cb8f['uniqueid']][_0xee44('0x1d')]=![];queues[_0x33cb8f['uniqueid']][_0xee44('0x29')]=null;queues[_0x33cb8f[_0xee44('0x11')]][_0xee44('0x3d')]=!![];queues[_0x33cb8f[_0xee44('0x11')]][_0xee44('0x7')]=_0x33cb8f[_0xee44('0x3b')];queues[_0x33cb8f[_0xee44('0x11')]]['queuecallercomplete']=!![];queues[_0x33cb8f[_0xee44('0x11')]][_0xee44('0x1e')]=utils['now']();if(_0x33cb8f[_0xee44('0x40')]==_0xee44('0x41')){if(!queues[_0x33cb8f['uniqueid']][_0xee44('0x41')]){queues[_0x33cb8f[_0xee44('0x11')]]['queuecallerexitreason']=_0xee44('0x42');}}else{queues[_0x33cb8f[_0xee44('0x11')]][_0xee44('0xa')]=_0xee44('0x43')+_0x33cb8f[_0xee44('0x40')][_0xee44('0x27')]();}utils[_0xee44('0x3')](util[_0xee44('0x4')](_0xee44('0x44'),_0x33cb8f[_0xee44('0x11')],queues[_0x33cb8f[_0xee44('0x11')]][_0xee44('0x21')],_0x33cb8f['membername'],queues[_0x33cb8f[_0xee44('0x11')]]['queuecallerexitreason']));writeDB(queues[_0x33cb8f['uniqueid']]);}}}catch(_0x26f57){utils['error'](util['format']('[%s][queues][agentcomplete]',_0x33cb8f[_0xee44('0x11')]),_0x26f57);}};exports[_0xee44('0x45')]=function(_0x2ee250){try{if(!_[_0xee44('0x1a')](queues[_0x2ee250[_0xee44('0x46')]])){utils['debug'](util['format'](_0xee44('0x47'),_0x2ee250[_0xee44('0x11')]),_0x2ee250);queues[_0x2ee250['transfereeuniqueid']]['transfer']=!![];queues[_0x2ee250[_0xee44('0x46')]][_0xee44('0x48')]='BLIND';queues[_0x2ee250['transfereeuniqueid']][_0xee44('0x49')]=_0x2ee250[_0xee44('0x4a')];queues[_0x2ee250[_0xee44('0x46')]][_0xee44('0x4b')]=_0x2ee250[_0xee44('0x46')];queues[_0x2ee250[_0xee44('0x46')]][_0xee44('0xa')]=_0xee44('0x4c');utils[_0xee44('0x3')](util[_0xee44('0x4')](_0xee44('0x4d'),_0x2ee250[_0xee44('0x11')],queues[_0x2ee250['transfereeuniqueid']][_0xee44('0x21')],_0x2ee250[_0xee44('0x46')],_0x2ee250[_0xee44('0x4a')]));}}catch(_0x545eb9){utils[_0xee44('0x18')](util[_0xee44('0x4')]('[%s][queues][blindtransfer]',_0x2ee250[_0xee44('0x11')]),_0x545eb9);}};exports[_0xee44('0x4e')]=function(_0x268229){try{utils[_0xee44('0x13')](util[_0xee44('0x4')](_0xee44('0x4f'),_0x268229[_0xee44('0x50')]),_0x268229);if(_0x268229[_0xee44('0x50')]==_0x268229[_0xee44('0x51')]){if(!_['isNil'](queues[_0x268229['secondtransfererlinkedid']])){utils['info'](util['format'](_0xee44('0x52'),_0x268229[_0xee44('0x50')],queues[_0x268229[_0xee44('0x53')]][_0xee44('0x21')],_0x268229['origtransfererexten']));queues[_0x268229[_0xee44('0x53')]][_0xee44('0x41')]=!![];queues[_0x268229[_0xee44('0x53')]][_0xee44('0x48')]=_0xee44('0x54');queues[_0x268229['secondtransfererlinkedid']]['transferexten']=_0x268229['origtransfererexten'];queues[_0x268229[_0xee44('0x53')]][_0xee44('0x4b')]=_0x268229['origtransfereruniqueid'];queues[_0x268229['secondtransfererlinkedid']][_0xee44('0xa')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x268229[_0xee44('0x51')]])){if(_0x268229[_0xee44('0x55')]&&queues[_0x268229[_0xee44('0x55')]]){queues[_0x268229[_0xee44('0x55')]][_0xee44('0x56')]=0x1;queues[_0x268229['transfereeuniqueid']]=_[_0xee44('0x57')](queues[_0x268229[_0xee44('0x55')]]);queues[_0x268229[_0xee44('0x46')]][_0xee44('0x10')]=_0x268229['transfertargetuniqueid'];queues[_0x268229['transfereeuniqueid']][_0xee44('0x56')]=0x2;queues[_0x268229['transfereeuniqueid']][_0xee44('0x8')]=queues[_0x268229[_0xee44('0x53')]][_0xee44('0x8')];queues[_0x268229[_0xee44('0x46')]][_0xee44('0x58')]=queues[_0x268229[_0xee44('0x53')]][_0xee44('0x58')];queues[_0x268229[_0xee44('0x46')]][_0xee44('0x36')]=utils[_0xee44('0x2a')]();queues[_0x268229[_0xee44('0x46')]]['queuecallerleaveAt']=utils[_0xee44('0x2a')]();queues[_0x268229['transfereeuniqueid']][_0xee44('0x59')]=0x0;queues[_0x268229[_0xee44('0x46')]][_0xee44('0x5a')]=0x0;utils['info'](util[_0xee44('0x4')](_0xee44('0x5b'),_0x268229[_0xee44('0x50')],queues[_0x268229[_0xee44('0x46')]][_0xee44('0x21')],queues[_0x268229[_0xee44('0x46')]][_0xee44('0x8')],queues[_0x268229['transfereeuniqueid']][_0xee44('0x58')]));}else{utils[_0xee44('0x3')](util['format'](_0xee44('0x5c'),_0x268229[_0xee44('0x50')],queues[_0x268229[_0xee44('0x51')]][_0xee44('0x21')],_0x268229[_0xee44('0x53')]));queues[_0x268229[_0xee44('0x51')]][_0xee44('0x10')]=_0x268229[_0xee44('0x53')];}}}else if(_0x268229['secondtransfereruniqueid']==_0x268229['secondtransfererlinkedid']){if(!_[_0xee44('0x1a')](queues[_0x268229[_0xee44('0x51')]])){utils[_0xee44('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x268229['origtransfereruniqueid'],queues[_0x268229[_0xee44('0x51')]][_0xee44('0x21')],_0x268229[_0xee44('0x5d')],_0x268229[_0xee44('0x5e')]));queues[_0x268229[_0xee44('0x51')]][_0xee44('0x41')]=!![];queues[_0x268229['origtransfererlinkedid']]['transfertype']=_0xee44('0x54');queues[_0x268229['origtransfererlinkedid']][_0xee44('0x49')]=_0x268229['secondtransfererexten'];queues[_0x268229[_0xee44('0x51')]][_0xee44('0x4b')]=_0x268229['secondtransfereruniqueid'];queues[_0x268229[_0xee44('0x51')]]['queuecallerexitreason']=_0xee44('0x5f');}if(!_['isNil'](queues[_0x268229[_0xee44('0x53')]])){if(_0x268229[_0xee44('0x60')]&&queues[_0x268229[_0xee44('0x60')]]){queues[_0x268229['transfertargetlinkedid']]['queuecallerenterreason']=0x1;queues[_0x268229['transfertargetuniqueid']]=_[_0xee44('0x57')](queues[_0x268229[_0xee44('0x60')]]);queues[_0x268229[_0xee44('0x61')]]['transfereduniqueid']=_0x268229[_0xee44('0x61')];queues[_0x268229[_0xee44('0x61')]][_0xee44('0x56')]=0x2;queues[_0x268229['transfertargetuniqueid']][_0xee44('0x8')]=queues[_0x268229[_0xee44('0x51')]][_0xee44('0x8')];queues[_0x268229[_0xee44('0x61')]][_0xee44('0x58')]=queues[_0x268229[_0xee44('0x51')]][_0xee44('0x58')];queues[_0x268229[_0xee44('0x61')]]['queuecallerjoinAt']=utils[_0xee44('0x2a')]();queues[_0x268229[_0xee44('0x61')]][_0xee44('0x34')]=utils[_0xee44('0x2a')]();queues[_0x268229[_0xee44('0x61')]]['holdtime']=0x0;queues[_0x268229[_0xee44('0x61')]][_0xee44('0x5a')]=0x0;utils[_0xee44('0x3')](util[_0xee44('0x4')](_0xee44('0x62'),_0x268229[_0xee44('0x50')],queues[_0x268229[_0xee44('0x61')]][_0xee44('0x21')],queues[_0x268229[_0xee44('0x61')]][_0xee44('0x10')],queues[_0x268229[_0xee44('0x61')]][_0xee44('0x8')],queues[_0x268229['transfertargetuniqueid']][_0xee44('0x58')]));}else{utils[_0xee44('0x3')](util['format'](_0xee44('0x5c'),_0x268229[_0xee44('0x50')],queues[_0x268229[_0xee44('0x53')]][_0xee44('0x21')],_0x268229[_0xee44('0x51')]));queues[_0x268229[_0xee44('0x53')]][_0xee44('0x10')]=_0x268229[_0xee44('0x51')];}}}}catch(_0x2041bf){utils[_0xee44('0x18')](util[_0xee44('0x4')](_0xee44('0x4f'),_0x268229[_0xee44('0x50')]),_0x2041bf);}};exports[_0xee44('0x63')]=function(_0x3314d7){try{if(!_[_0xee44('0x1a')](queues[_0x3314d7[_0xee44('0x11')]])){utils[_0xee44('0x13')](util[_0xee44('0x4')](_0xee44('0x64'),_0x3314d7[_0xee44('0x11')]),_0x3314d7);queues[_0x3314d7['uniqueid']][_0xee44('0x65')]=utils['now']();utils[_0xee44('0x3')](util['format'](_0xee44('0x66'),_0x3314d7[_0xee44('0x11')],queues[_0x3314d7['uniqueid']][_0xee44('0x21')],queues[_0x3314d7[_0xee44('0x11')]][_0xee44('0x65')]));}}catch(_0x46f1f8){utils[_0xee44('0x18')](util['format'](_0xee44('0x64'),_0x3314d7[_0xee44('0x11')]),_0x46f1f8);}};exports[_0xee44('0x67')]=function(_0x2a8d94){try{if(!_[_0xee44('0x1a')](queues[_0x2a8d94['uniqueid']])){if(!_['isNil'](queues[_0x2a8d94[_0xee44('0x11')]][_0xee44('0x65')])){utils[_0xee44('0x13')](util[_0xee44('0x4')]('[%s][queues][musiconholdstop]',_0x2a8d94['uniqueid']),_0x2a8d94);queues[_0x2a8d94[_0xee44('0x11')]]['mohtime']+=utils[_0xee44('0x35')](utils[_0xee44('0x2a')](),queues[_0x2a8d94[_0xee44('0x11')]][_0xee44('0x65')]);utils[_0xee44('0x3')](util[_0xee44('0x4')](_0xee44('0x68'),_0x2a8d94[_0xee44('0x11')],queues[_0x2a8d94[_0xee44('0x11')]]['name'],queues[_0x2a8d94[_0xee44('0x11')]][_0xee44('0x5a')]));delete queues[_0x2a8d94[_0xee44('0x11')]][_0xee44('0x65')];}}}catch(_0x16817b){utils[_0xee44('0x18')](util[_0xee44('0x4')]('[%s][queues][musiconholdstop]',_0x2a8d94['uniqueid']),_0x16817b);}}; \ No newline at end of file +var _0x12c2=['secondtransfereruniqueid','secondtransfererexten','transferexten','transfertargetlinkedid','mohtime','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','hangup','isNil','queuecallerabandon','queuecallerexit','queuecallercompleteAt','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','[%s][queues][hangup]','varset','variable','queuestatus','value','toUpperCase','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','assigned','lastAssignedTo','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','origtransfererexten','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','transfertargetuniqueid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s'];(function(_0x595c93,_0x1461f7){var _0x41b4d3=function(_0x4ef564){while(--_0x4ef564){_0x595c93['push'](_0x595c93['shift']());}};_0x41b4d3(++_0x1461f7);}(_0x12c2,0x1a2));var _0x212c=function(_0x1f76cf,_0x2f78c2){_0x1f76cf=_0x1f76cf-0x0;var _0x3f01bc=_0x12c2[_0x1f76cf];return _0x3f01bc;};'use strict';var _=require(_0x212c('0x0'));var util=require(_0x212c('0x1'));var utils=require(_0x212c('0x2'));var queues={};function writeDB(_0x2bb862){utils[_0x212c('0x3')](util[_0x212c('0x4')](_0x212c('0x5'),_0x2bb862[_0x212c('0x6')],_0x2bb862['channel'],_0x2bb862[_0x212c('0x7')],_0x2bb862['lastAssignedTo'],_0x2bb862[_0x212c('0x8')],_0x2bb862[_0x212c('0x9')],_0x2bb862[_0x212c('0xa')]));if(_0x2bb862['queue']){utils[_0x212c('0xb')](_0x2bb862[_0x212c('0x7')])[_0x212c('0xc')](function(_0x400d27){if(_0x400d27){_0x2bb862['type']=_0x400d27[_0x212c('0xd')];}utils[_0x212c('0xe')]('CreateVoiceQueueReport',_0x2bb862);});}else{utils['request'](_0x212c('0xf'),_0x2bb862);}if(_0x2bb862[_0x212c('0x10')]){delete queues[_0x2bb862[_0x212c('0x10')]];}else{delete queues[_0x2bb862[_0x212c('0x6')]];}}exports[_0x212c('0x11')]=function(_0x69b883){try{utils[_0x212c('0x12')](util[_0x212c('0x4')](_0x212c('0x13'),_0x69b883[_0x212c('0x6')]),_0x69b883);utils[_0x212c('0x3')](util[_0x212c('0x4')](_0x212c('0x14'),_0x69b883[_0x212c('0x6')],_0x69b883[_0x212c('0x7')],_0x69b883[_0x212c('0x15')]));queues[_0x69b883[_0x212c('0x6')]]=_[_0x212c('0x16')](_0x69b883,{'originalposition':_0x69b883[_0x212c('0x15')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0xfe9b7b){utils['error'](util[_0x212c('0x4')](_0x212c('0x13'),_0x69b883['uniqueid']),_0xfe9b7b);}};exports[_0x212c('0x17')]=function(_0x405737){try{if(!_[_0x212c('0x18')](queues[_0x405737['uniqueid']])){utils[_0x212c('0x12')](util[_0x212c('0x4')]('[%s][queues][hangup]',_0x405737[_0x212c('0x6')]),_0x405737);if(queues[_0x405737['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x405737[_0x212c('0x6')]][_0x212c('0x19')]&&!queues[_0x405737[_0x212c('0x6')]][_0x212c('0x1a')]){queues[_0x405737[_0x212c('0x6')]]['queuecallercomplete']=!![];queues[_0x405737[_0x212c('0x6')]][_0x212c('0x1b')]=utils[_0x212c('0x1c')]();queues[_0x405737[_0x212c('0x6')]]['queuecallerexitreason']=_0x212c('0x1d');}utils[_0x212c('0x3')](util[_0x212c('0x4')](_0x212c('0x1e'),_0x405737['uniqueid'],queues[_0x405737[_0x212c('0x6')]][_0x212c('0x1f')],queues[_0x405737[_0x212c('0x6')]][_0x212c('0xa')]));writeDB(queues[_0x405737['uniqueid']]);}else if(queues[_0x405737['uniqueid']][_0x212c('0x10')]){utils[_0x212c('0x3')](util[_0x212c('0x4')](_0x212c('0x20'),_0x405737['uniqueid'],queues[_0x405737[_0x212c('0x6')]]['name'],queues[_0x405737[_0x212c('0x6')]][_0x212c('0x10')]));queues[queues[_0x405737['uniqueid']][_0x212c('0x10')]]=queues[_0x405737[_0x212c('0x6')]];queues[queues[_0x405737['uniqueid']]['transfereduniqueid']][_0x212c('0x21')]=0x2;delete queues[_0x405737[_0x212c('0x6')]];}}}catch(_0x13509f){utils[_0x212c('0x22')](util[_0x212c('0x4')](_0x212c('0x23'),_0x405737[_0x212c('0x6')]),_0x13509f);}};exports[_0x212c('0x24')]=function(_0x26e9d6){try{utils[_0x212c('0x12')](util[_0x212c('0x4')]('[%s][queues][varset]',_0x26e9d6[_0x212c('0x6')]),_0x26e9d6);if(!_['isNil'](_0x26e9d6[_0x212c('0x25')][_0x212c('0x26')])&&_0x26e9d6[_0x212c('0x27')][_0x212c('0x28')]()!=='CONTINUE'){if(!_[_0x212c('0x18')](queues[_0x26e9d6[_0x212c('0x6')]])){queues[_0x26e9d6[_0x212c('0x6')]][_0x212c('0x19')]=![];queues[_0x26e9d6[_0x212c('0x6')]][_0x212c('0x29')]=null;queues[_0x26e9d6[_0x212c('0x6')]]['queuecallerexit']=!![];queues[_0x26e9d6[_0x212c('0x6')]][_0x212c('0x2a')]=utils[_0x212c('0x1c')]();queues[_0x26e9d6[_0x212c('0x6')]][_0x212c('0xa')]=_0x26e9d6[_0x212c('0x27')][_0x212c('0x28')]();utils[_0x212c('0x3')](util['format'](_0x212c('0x2b'),_0x26e9d6[_0x212c('0x6')],queues[_0x26e9d6['uniqueid']][_0x212c('0x1f')],_0x26e9d6[_0x212c('0x27')],queues[_0x26e9d6['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x26e9d6[_0x212c('0x6')]]);}}else if(!_[_0x212c('0x18')](_0x26e9d6[_0x212c('0x25')][_0x212c('0x2c')])){if(!_[_0x212c('0x18')](queues[_0x26e9d6[_0x212c('0x6')]])&&!queues[_0x26e9d6[_0x212c('0x6')]][_0x212c('0x19')]){queues[_0x26e9d6[_0x212c('0x6')]][_0x212c('0x19')]=![];queues[_0x26e9d6['uniqueid']][_0x212c('0x29')]=null;queues[_0x26e9d6[_0x212c('0x6')]]['queuecallerexit']=!![];queues[_0x26e9d6[_0x212c('0x6')]][_0x212c('0x2a')]=utils[_0x212c('0x1c')]();queues[_0x26e9d6[_0x212c('0x6')]]['queuecallerexitreason']='EXITWITHKEY';utils[_0x212c('0x3')](util[_0x212c('0x4')](_0x212c('0x2d'),_0x26e9d6['uniqueid'],queues[_0x26e9d6[_0x212c('0x6')]]['name'],_0x26e9d6['value'],queues[_0x26e9d6[_0x212c('0x6')]][_0x212c('0xa')]));}}}catch(_0x25ec5a){utils[_0x212c('0x22')](util[_0x212c('0x4')](_0x212c('0x2e'),_0x26e9d6[_0x212c('0x6')]),_0x25ec5a);}};exports[_0x212c('0x19')]=function(_0x3263ce){try{if(!_[_0x212c('0x18')](queues[_0x3263ce['uniqueid']])){utils[_0x212c('0x12')](util[_0x212c('0x4')]('[%s][queues][queuecallerabandon]',_0x3263ce[_0x212c('0x6')]),_0x3263ce);queues[_0x3263ce['uniqueid']][_0x212c('0x1a')]=![];queues[_0x3263ce[_0x212c('0x6')]][_0x212c('0x2a')]=null;queues[_0x3263ce[_0x212c('0x6')]][_0x212c('0x19')]=!![];queues[_0x3263ce[_0x212c('0x6')]][_0x212c('0x29')]=utils[_0x212c('0x1c')]();queues[_0x3263ce['uniqueid']][_0x212c('0xa')]='ABANDONED';utils[_0x212c('0x3')](util[_0x212c('0x4')](_0x212c('0x2f'),_0x3263ce[_0x212c('0x6')],queues[_0x3263ce['uniqueid']][_0x212c('0x1f')],queues[_0x3263ce[_0x212c('0x6')]][_0x212c('0xa')]));}}catch(_0x4d27a5){utils[_0x212c('0x22')](util[_0x212c('0x4')](_0x212c('0x30'),_0x3263ce[_0x212c('0x6')]),_0x4d27a5);}};exports[_0x212c('0x31')]=function(_0x4f0904){try{if(!_['isNil'](queues[_0x4f0904[_0x212c('0x6')]])){utils[_0x212c('0x12')](util[_0x212c('0x4')](_0x212c('0x32'),_0x4f0904['uniqueid']),_0x4f0904);utils[_0x212c('0x3')](util['format'](_0x212c('0x33'),_0x4f0904[_0x212c('0x6')],queues[_0x4f0904[_0x212c('0x6')]]['name'],_0x4f0904['connectedlinenum'],_0x4f0904[_0x212c('0x34')]));queues[_0x4f0904[_0x212c('0x6')]][_0x212c('0x31')]=!![];queues[_0x4f0904['uniqueid']][_0x212c('0x35')]=utils[_0x212c('0x1c')]();queues[_0x4f0904[_0x212c('0x6')]][_0x212c('0x36')]=utils[_0x212c('0x37')](queues[_0x4f0904[_0x212c('0x6')]][_0x212c('0x35')],queues[_0x4f0904['uniqueid']][_0x212c('0x38')]);queues[_0x4f0904[_0x212c('0x6')]][_0x212c('0x15')]=_0x4f0904['position'];queues[_0x4f0904[_0x212c('0x6')]][_0x212c('0x39')]=_0x4f0904[_0x212c('0x39')];queues[_0x4f0904['uniqueid']]['connectedlinenum']=_0x4f0904['connectedlinenum'];queues[_0x4f0904[_0x212c('0x6')]][_0x212c('0x34')]=_0x4f0904['connectedlinename'];}}catch(_0x5d1875){utils[_0x212c('0x22')](util[_0x212c('0x4')]('[%s][queues][queuecallerleave]',_0x4f0904[_0x212c('0x6')]),_0x5d1875);}};exports['agentconnect']=function(_0x23d5ec){try{if(!_[_0x212c('0x18')](queues[_0x23d5ec[_0x212c('0x6')]])){utils['debug'](util[_0x212c('0x4')](_0x212c('0x3a'),_0x23d5ec[_0x212c('0x6')]),_0x23d5ec);utils[_0x212c('0x3')](util['format'](_0x212c('0x3b'),_0x23d5ec[_0x212c('0x6')],queues[_0x23d5ec[_0x212c('0x6')]][_0x212c('0x1f')],_0x23d5ec[_0x212c('0x3c')],_0x23d5ec[_0x212c('0x3d')]));queues[_0x23d5ec['uniqueid']][_0x212c('0x19')]=![];queues[_0x23d5ec[_0x212c('0x6')]][_0x212c('0x19')]=![];queues[_0x23d5ec[_0x212c('0x6')]][_0x212c('0x29')]=null;queues[_0x23d5ec[_0x212c('0x6')]][_0x212c('0x1a')]=![];queues[_0x23d5ec['uniqueid']][_0x212c('0xa')]=null;queues[_0x23d5ec['uniqueid']][_0x212c('0x2a')]=null;queues[_0x23d5ec[_0x212c('0x6')]]['assigned']=!![];queues[_0x23d5ec[_0x212c('0x6')]]['accountcode']=_0x23d5ec[_0x212c('0x3d')];queues[_0x23d5ec[_0x212c('0x6')]]['lastAssignedTo']=_0x23d5ec[_0x212c('0x3c')];}}catch(_0xfa2875){utils[_0x212c('0x22')](util['format'](_0x212c('0x3a'),_0x23d5ec[_0x212c('0x6')]),_0xfa2875);}};exports[_0x212c('0x3e')]=function(_0x434fd4){try{if(!_[_0x212c('0x18')](queues[_0x434fd4[_0x212c('0x6')]])){if(queues[_0x434fd4[_0x212c('0x6')]][_0x212c('0x35')]){utils[_0x212c('0x12')](util['format'](_0x212c('0x3f'),_0x434fd4['uniqueid']),_0x434fd4);queues[_0x434fd4[_0x212c('0x6')]]['queuecallerabandon']=![];queues[_0x434fd4[_0x212c('0x6')]][_0x212c('0x19')]=![];queues[_0x434fd4[_0x212c('0x6')]][_0x212c('0x29')]=null;queues[_0x434fd4[_0x212c('0x6')]]['queuecallerexit']=![];queues[_0x434fd4[_0x212c('0x6')]][_0x212c('0x2a')]=null;queues[_0x434fd4['uniqueid']][_0x212c('0x40')]=!![];queues[_0x434fd4['uniqueid']][_0x212c('0x41')]=_0x434fd4['membername'];queues[_0x434fd4['uniqueid']][_0x212c('0x42')]=!![];queues[_0x434fd4[_0x212c('0x6')]][_0x212c('0x1b')]=utils[_0x212c('0x1c')]();if(_0x434fd4[_0x212c('0x43')]==_0x212c('0x44')){if(!queues[_0x434fd4['uniqueid']][_0x212c('0x44')]){queues[_0x434fd4[_0x212c('0x6')]][_0x212c('0xa')]=_0x212c('0x45');}}else{queues[_0x434fd4[_0x212c('0x6')]][_0x212c('0xa')]=_0x212c('0x46')+_0x434fd4[_0x212c('0x43')][_0x212c('0x28')]();}utils[_0x212c('0x3')](util[_0x212c('0x4')](_0x212c('0x47'),_0x434fd4[_0x212c('0x6')],queues[_0x434fd4[_0x212c('0x6')]][_0x212c('0x1f')],_0x434fd4[_0x212c('0x3c')],queues[_0x434fd4[_0x212c('0x6')]][_0x212c('0xa')]));writeDB(queues[_0x434fd4[_0x212c('0x6')]]);}}}catch(_0x3b9fcd){utils[_0x212c('0x22')](util[_0x212c('0x4')](_0x212c('0x3f'),_0x434fd4[_0x212c('0x6')]),_0x3b9fcd);}};exports[_0x212c('0x48')]=function(_0x272e0a){try{if(!_[_0x212c('0x18')](queues[_0x272e0a['transfereeuniqueid']])){utils['debug'](util['format'](_0x212c('0x49'),_0x272e0a[_0x212c('0x6')]),_0x272e0a);queues[_0x272e0a[_0x212c('0x4a')]]['transfer']=!![];queues[_0x272e0a[_0x212c('0x4a')]][_0x212c('0x4b')]='BLIND';queues[_0x272e0a[_0x212c('0x4a')]]['transferexten']=_0x272e0a['extension'];queues[_0x272e0a[_0x212c('0x4a')]]['transferuniqueid']=_0x272e0a[_0x212c('0x4a')];queues[_0x272e0a[_0x212c('0x4a')]][_0x212c('0xa')]=_0x212c('0x4c');utils['info'](util['format'](_0x212c('0x4d'),_0x272e0a[_0x212c('0x6')],queues[_0x272e0a['transfereeuniqueid']][_0x212c('0x1f')],_0x272e0a[_0x212c('0x4a')],_0x272e0a[_0x212c('0x4e')]));}}catch(_0x2fce37){utils[_0x212c('0x22')](util['format'](_0x212c('0x49'),_0x272e0a[_0x212c('0x6')]),_0x2fce37);}};exports['attendedtransfer']=function(_0x52f83b){try{utils[_0x212c('0x12')](util[_0x212c('0x4')](_0x212c('0x4f'),_0x52f83b[_0x212c('0x50')]),_0x52f83b);if(_0x52f83b[_0x212c('0x50')]==_0x52f83b['origtransfererlinkedid']){if(!_['isNil'](queues[_0x52f83b[_0x212c('0x51')]])){utils[_0x212c('0x3')](util[_0x212c('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x52f83b[_0x212c('0x50')],queues[_0x52f83b[_0x212c('0x51')]]['name'],_0x52f83b[_0x212c('0x52')]));queues[_0x52f83b[_0x212c('0x51')]][_0x212c('0x44')]=!![];queues[_0x52f83b[_0x212c('0x51')]][_0x212c('0x4b')]=_0x212c('0x53');queues[_0x52f83b[_0x212c('0x51')]]['transferexten']=_0x52f83b[_0x212c('0x52')];queues[_0x52f83b[_0x212c('0x51')]][_0x212c('0x54')]=_0x52f83b['origtransfereruniqueid'];queues[_0x52f83b[_0x212c('0x51')]]['queuecallerexitreason']=_0x212c('0x55');}if(!_[_0x212c('0x18')](queues[_0x52f83b[_0x212c('0x56')]])){if(_0x52f83b['transfereelinkedid']&&queues[_0x52f83b[_0x212c('0x57')]]){queues[_0x52f83b['transfereelinkedid']][_0x212c('0x21')]=0x1;queues[_0x52f83b['transfereeuniqueid']]=_['clone'](queues[_0x52f83b['transfereelinkedid']]);queues[_0x52f83b['transfereeuniqueid']][_0x212c('0x10')]=_0x52f83b[_0x212c('0x58')];queues[_0x52f83b[_0x212c('0x4a')]][_0x212c('0x21')]=0x2;queues[_0x52f83b[_0x212c('0x4a')]]['calleridnum']=queues[_0x52f83b[_0x212c('0x51')]][_0x212c('0x8')];queues[_0x52f83b[_0x212c('0x4a')]][_0x212c('0x59')]=queues[_0x52f83b[_0x212c('0x51')]][_0x212c('0x59')];queues[_0x52f83b[_0x212c('0x4a')]][_0x212c('0x38')]=utils[_0x212c('0x1c')]();queues[_0x52f83b[_0x212c('0x4a')]][_0x212c('0x35')]=utils[_0x212c('0x1c')]();queues[_0x52f83b[_0x212c('0x4a')]][_0x212c('0x36')]=0x0;queues[_0x52f83b[_0x212c('0x4a')]]['mohtime']=0x0;utils[_0x212c('0x3')](util[_0x212c('0x4')](_0x212c('0x5a'),_0x52f83b[_0x212c('0x50')],queues[_0x52f83b['transfereeuniqueid']]['name'],queues[_0x52f83b['transfereeuniqueid']][_0x212c('0x8')],queues[_0x52f83b[_0x212c('0x4a')]][_0x212c('0x59')]));}else{utils[_0x212c('0x3')](util[_0x212c('0x4')](_0x212c('0x5b'),_0x52f83b[_0x212c('0x50')],queues[_0x52f83b[_0x212c('0x56')]][_0x212c('0x1f')],_0x52f83b[_0x212c('0x51')]));queues[_0x52f83b[_0x212c('0x56')]]['transfereduniqueid']=_0x52f83b['secondtransfererlinkedid'];}}}else if(_0x52f83b['secondtransfereruniqueid']==_0x52f83b[_0x212c('0x51')]){if(!_['isNil'](queues[_0x52f83b[_0x212c('0x56')]])){utils[_0x212c('0x3')](util[_0x212c('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x52f83b[_0x212c('0x50')],queues[_0x52f83b[_0x212c('0x56')]][_0x212c('0x1f')],_0x52f83b[_0x212c('0x5c')],_0x52f83b[_0x212c('0x5d')]));queues[_0x52f83b[_0x212c('0x56')]]['transfer']=!![];queues[_0x52f83b[_0x212c('0x56')]][_0x212c('0x4b')]=_0x212c('0x53');queues[_0x52f83b[_0x212c('0x56')]][_0x212c('0x5e')]=_0x52f83b[_0x212c('0x5d')];queues[_0x52f83b[_0x212c('0x56')]][_0x212c('0x54')]=_0x52f83b['secondtransfereruniqueid'];queues[_0x52f83b[_0x212c('0x56')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x52f83b[_0x212c('0x51')]])){if(_0x52f83b[_0x212c('0x5f')]&&queues[_0x52f83b[_0x212c('0x5f')]]){queues[_0x52f83b[_0x212c('0x5f')]]['queuecallerenterreason']=0x1;queues[_0x52f83b[_0x212c('0x58')]]=_['clone'](queues[_0x52f83b['transfertargetlinkedid']]);queues[_0x52f83b['transfertargetuniqueid']][_0x212c('0x10')]=_0x52f83b[_0x212c('0x58')];queues[_0x52f83b[_0x212c('0x58')]][_0x212c('0x21')]=0x2;queues[_0x52f83b['transfertargetuniqueid']][_0x212c('0x8')]=queues[_0x52f83b[_0x212c('0x56')]]['calleridnum'];queues[_0x52f83b[_0x212c('0x58')]][_0x212c('0x59')]=queues[_0x52f83b['origtransfererlinkedid']][_0x212c('0x59')];queues[_0x52f83b[_0x212c('0x58')]]['queuecallerjoinAt']=utils[_0x212c('0x1c')]();queues[_0x52f83b[_0x212c('0x58')]]['queuecallerleaveAt']=utils['now']();queues[_0x52f83b[_0x212c('0x58')]][_0x212c('0x36')]=0x0;queues[_0x52f83b[_0x212c('0x58')]][_0x212c('0x60')]=0x0;utils['info'](util[_0x212c('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x52f83b[_0x212c('0x50')],queues[_0x52f83b[_0x212c('0x58')]][_0x212c('0x1f')],queues[_0x52f83b[_0x212c('0x58')]]['transfereduniqueid'],queues[_0x52f83b['transfertargetuniqueid']][_0x212c('0x8')],queues[_0x52f83b[_0x212c('0x58')]]['calleridname']));}else{utils['info'](util[_0x212c('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x52f83b[_0x212c('0x50')],queues[_0x52f83b[_0x212c('0x51')]][_0x212c('0x1f')],_0x52f83b['origtransfererlinkedid']));queues[_0x52f83b['secondtransfererlinkedid']][_0x212c('0x10')]=_0x52f83b[_0x212c('0x56')];}}}}catch(_0x5e75e9){utils['error'](util[_0x212c('0x4')]('[%s][queues][attendedtransfer]',_0x52f83b[_0x212c('0x50')]),_0x5e75e9);}};exports[_0x212c('0x61')]=function(_0x12f6df){try{if(!_['isNil'](queues[_0x12f6df[_0x212c('0x6')]])){utils[_0x212c('0x12')](util['format'](_0x212c('0x62'),_0x12f6df['uniqueid']),_0x12f6df);queues[_0x12f6df[_0x212c('0x6')]][_0x212c('0x63')]=utils[_0x212c('0x1c')]();utils[_0x212c('0x3')](util[_0x212c('0x4')](_0x212c('0x64'),_0x12f6df[_0x212c('0x6')],queues[_0x12f6df[_0x212c('0x6')]][_0x212c('0x1f')],queues[_0x12f6df[_0x212c('0x6')]][_0x212c('0x63')]));}}catch(_0x155b12){utils['error'](util['format'](_0x212c('0x62'),_0x12f6df['uniqueid']),_0x155b12);}};exports['musiconholdstop']=function(_0xb7ab5){try{if(!_[_0x212c('0x18')](queues[_0xb7ab5[_0x212c('0x6')]])){if(!_[_0x212c('0x18')](queues[_0xb7ab5[_0x212c('0x6')]]['musiconholdstartAt'])){utils[_0x212c('0x12')](util[_0x212c('0x4')]('[%s][queues][musiconholdstop]',_0xb7ab5['uniqueid']),_0xb7ab5);queues[_0xb7ab5[_0x212c('0x6')]]['mohtime']+=utils['diffTime'](utils[_0x212c('0x1c')](),queues[_0xb7ab5[_0x212c('0x6')]][_0x212c('0x63')]);utils[_0x212c('0x3')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0xb7ab5[_0x212c('0x6')],queues[_0xb7ab5[_0x212c('0x6')]][_0x212c('0x1f')],queues[_0xb7ab5['uniqueid']][_0x212c('0x60')]));delete queues[_0xb7ab5[_0x212c('0x6')]][_0x212c('0x63')];}}}catch(_0x47e8ea){utils[_0x212c('0x22')](util[_0x212c('0x4')](_0x212c('0x65'),_0xb7ab5[_0x212c('0x6')]),_0x47e8ea);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 82eae4d..4bf479f 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 _0xd721=['[%s][recordings][newexten]','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','blindtransfer','[%s][recordings][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','util','./transfers.controller','info','[%s][recordings][writeDB]','uniqueid','blinds','accountcode','then','name','UserId','CreateVoiceRecording','request','newchannel','[%s][recordings][newchannel]','format','context','exten','channel','error','newstate','[%s][recordings][newstate]','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','debug','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','replace','.wav49','.WAV','find','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','outbound','newexten'];(function(_0x43036c,_0x5c3cbc){var _0x182b8f=function(_0x43b839){while(--_0x43b839){_0x43036c['push'](_0x43036c['shift']());}};_0x182b8f(++_0x5c3cbc);}(_0xd721,0xa3));var _0x1d72=function(_0x26c8f8,_0x8be117){_0x26c8f8=_0x26c8f8-0x0;var _0x19bc31=_0xd721[_0x26c8f8];return _0x19bc31;};'use strict';var _=require(_0x1d72('0x0'));var util=require(_0x1d72('0x1'));var utils=require('./utils');var transfers=require(_0x1d72('0x2'));var recordings={};function writeDB(_0xf249ef){var _0x25b31a;utils[_0x1d72('0x3')](util['format'](_0x1d72('0x4'),_0xf249ef[_0x1d72('0x5')]));if(transfers[_0x1d72('0x6')][_0xf249ef[_0x1d72('0x5')]]){_0x25b31a=_0xf249ef[_0x1d72('0x5')];_0xf249ef[_0x1d72('0x5')]=transfers[_0x1d72('0x6')][_0xf249ef[_0x1d72('0x5')]]['transfereeuniqueid'];}if(_0xf249ef[_0x1d72('0x7')]){utils['getUserByInternal'](_0xf249ef[_0x1d72('0x7')])[_0x1d72('0x8')](function(_0x3b299e){if(_0x3b299e){_0xf249ef['membername']=_0x3b299e[_0x1d72('0x9')];_0xf249ef[_0x1d72('0xa')]=_0x3b299e['id'];}utils['request'](_0x1d72('0xb'),_0xf249ef);});}else{utils[_0x1d72('0xc')](_0x1d72('0xb'),_0xf249ef);}if(_0x25b31a)delete transfers['blinds'][_0x25b31a];}exports[_0x1d72('0xd')]=function(_0x289165){try{utils['debug'](util['format'](_0x1d72('0xe'),_0x289165[_0x1d72('0x5')]),_0x289165);if(_0x289165[_0x1d72('0x5')]==_0x289165['linkedid']){utils[_0x1d72('0x3')](util[_0x1d72('0xf')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x289165['uniqueid'],_0x289165[_0x1d72('0x10')],_0x289165[_0x1d72('0x11')]));recordings[_0x289165[_0x1d72('0x5')]]={'uniqueid':_0x289165[_0x1d72('0x5')],'accountcode':_0x289165[_0x1d72('0x7')],'exten':_0x289165[_0x1d72('0x11')],'context':_0x289165[_0x1d72('0x10')],'channel':_0x289165[_0x1d72('0x12')],'monitors':[]};}}catch(_0xa6c297){utils[_0x1d72('0x13')](util['format'](_0x1d72('0xe'),_0x289165[_0x1d72('0x5')]),_0xa6c297);}};exports[_0x1d72('0x14')]=function(_0x3669c1){try{utils['debug'](util[_0x1d72('0xf')](_0x1d72('0x15'),_0x3669c1[_0x1d72('0x5')]),_0x3669c1);if(!_['isNil'](recordings[_0x3669c1[_0x1d72('0x5')]])&&_0x3669c1['channelstate']==0x6){utils['info'](util[_0x1d72('0xf')](_0x1d72('0x16'),_0x3669c1['uniqueid'],_0x3669c1[_0x1d72('0x10')],_0x3669c1['channel']));}else if(!_[_0x1d72('0x17')](recordings[_0x3669c1[_0x1d72('0x18')]])&&_0x3669c1['channelstate']==0x6&&_0x3669c1['context']!=_0x1d72('0x19')){utils[_0x1d72('0x3')](util[_0x1d72('0xf')](_0x1d72('0x1a'),_0x3669c1[_0x1d72('0x5')],_0x3669c1[_0x1d72('0x18')],_0x3669c1['context'],_0x3669c1[_0x1d72('0x12')]));recordings[_0x3669c1[_0x1d72('0x18')]]['accountcode']=_0x3669c1[_0x1d72('0x7')];}}catch(_0x3fd186){utils[_0x1d72('0x13')](util['format'](_0x1d72('0x15'),_0x3669c1[_0x1d72('0x5')]),_0x3fd186);}};exports[_0x1d72('0x1b')]=function(_0x424a03){try{if(!_['isNil'](_0x424a03[_0x1d72('0x1c')])&&!_[_0x1d72('0x17')](_0x424a03[_0x1d72('0x1c')][_0x1d72('0x1d')])){utils[_0x1d72('0x1e')](util[_0x1d72('0xf')](_0x1d72('0x1f'),_0x424a03[_0x1d72('0x5')]),_0x424a03);utils[_0x1d72('0x3')](util[_0x1d72('0xf')](_0x1d72('0x20'),_0x424a03[_0x1d72('0x5')],_0x424a03[_0x1d72('0x1c')],_0x424a03['value']));if(_[_0x1d72('0x21')](_0x424a03['value'],'.wav49')){_0x424a03[_0x1d72('0x22')]=_0x424a03[_0x1d72('0x22')][_0x1d72('0x23')](_0x1d72('0x24'),_0x1d72('0x25'));}if(recordings[_0x424a03['linkedid']]){var _0x53cc1a=_[_0x1d72('0x26')](recordings[_0x424a03[_0x1d72('0x18')]][_0x1d72('0x27')],{'value':_0x424a03[_0x1d72('0x22')]});if(_['isNil'](_0x53cc1a)){recordings[_0x424a03[_0x1d72('0x18')]][_0x1d72('0x27')][_0x1d72('0x28')]({'value':_0x424a03[_0x1d72('0x22')]});}}}}catch(_0x3e5be7){utils['error'](util[_0x1d72('0xf')](_0x1d72('0x1f'),_0x424a03['uniqueid']),_0x3e5be7);}};exports['hangup']=function(_0x32443f){try{if(!_['isNil'](recordings[_0x32443f[_0x1d72('0x5')]])){utils['debug'](util['format'](_0x1d72('0x29'),_0x32443f[_0x1d72('0x5')]),_0x32443f);utils['info'](util[_0x1d72('0xf')](_0x1d72('0x2a'),_0x32443f[_0x1d72('0x5')],_0x32443f['calleridnum'],_0x32443f['calleridname'],_0x32443f[_0x1d72('0x2b')]));recordings[_0x32443f[_0x1d72('0x5')]]['calleridnum']=_0x32443f[_0x1d72('0x2c')];recordings[_0x32443f[_0x1d72('0x5')]]['calleridname']=_0x32443f['calleridname'];recordings[_0x32443f['uniqueid']][_0x1d72('0x2d')]=_0x32443f[_0x1d72('0x2d')];recordings[_0x32443f[_0x1d72('0x5')]][_0x1d72('0x2e')]=_0x32443f[_0x1d72('0x2e')];if(recordings[_0x32443f[_0x1d72('0x5')]][_0x1d72('0x2f')]==_0x1d72('0x30')&&recordings[_0x32443f[_0x1d72('0x5')]][_0x1d72('0x7')]){recordings[_0x32443f[_0x1d72('0x5')]][_0x1d72('0x2d')]=recordings[_0x32443f[_0x1d72('0x5')]][_0x1d72('0x7')];recordings[_0x32443f[_0x1d72('0x5')]]['connectedlinename']='';}recordings[_0x32443f[_0x1d72('0x5')]][_0x1d72('0x27')]['forEach'](function(_0x1bc04e){var _0x574242=_['clone'](recordings[_0x32443f[_0x1d72('0x5')]]);_0x574242[_0x1d72('0x22')]=_0x1bc04e[_0x1d72('0x22')];writeDB(_0x574242);});delete recordings[_0x32443f[_0x1d72('0x5')]];}}catch(_0x14e4f5){utils['error'](util[_0x1d72('0xf')](_0x1d72('0x29'),_0x32443f[_0x1d72('0x5')]),_0x14e4f5);}};exports[_0x1d72('0x31')]=function(_0x5e11be){try{if(!_[_0x1d72('0x17')](recordings[_0x5e11be['uniqueid']])){utils[_0x1d72('0x1e')](util[_0x1d72('0xf')](_0x1d72('0x32'),_0x5e11be[_0x1d72('0x5')]),_0x5e11be);utils['info'](util[_0x1d72('0xf')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x5e11be[_0x1d72('0x5')],_0x5e11be[_0x1d72('0x33')],_0x5e11be[_0x1d72('0x34')]));if(_0x5e11be[_0x1d72('0x33')][_0x1d72('0x35')]()==_0x1d72('0x36')&&_[_0x1d72('0x37')](_0x5e11be[_0x1d72('0x34')]['toLowerCase'](),_0x1d72('0x38'))){var _0x1dad49=_0x5e11be[_0x1d72('0x34')][_0x1d72('0x39')]('=');var _0xc4df4d=_0x1dad49[0x0][_0x1d72('0x3a')](_0x1dad49[0x0][_0x1d72('0x3b')]('(')+0x1,_0x1dad49[0x0]['lastIndexOf'](')'));var _0x153097=_0x1dad49[0x1];recordings[_0x5e11be[_0x1d72('0x5')]][_0xc4df4d]=_0x153097;}}}catch(_0x32103e){utils[_0x1d72('0x13')](util[_0x1d72('0xf')]('[%s][recordings][newexten]',_0x5e11be[_0x1d72('0x5')]),_0x32103e);}};exports['queuecallerjoin']=function(_0x1c9cfa){try{if(!_[_0x1d72('0x17')](recordings[_0x1c9cfa['uniqueid']])){utils[_0x1d72('0x1e')](util[_0x1d72('0xf')]('[%s][recordings][queuecallerjoin]',_0x1c9cfa['uniqueid']),_0x1c9cfa);utils[_0x1d72('0x3')](util[_0x1d72('0xf')](_0x1d72('0x3c'),_0x1c9cfa[_0x1d72('0x5')],_0x1c9cfa['queue']));recordings[_0x1c9cfa[_0x1d72('0x5')]][_0x1d72('0x3d')]=_0x1c9cfa[_0x1d72('0x3d')];}}catch(_0x2f930b){utils['error'](util[_0x1d72('0xf')](_0x1d72('0x3e'),_0x1c9cfa[_0x1d72('0x5')]),_0x2f930b);}};exports[_0x1d72('0x3f')]=function(_0x2dae51){try{utils[_0x1d72('0x1e')](util[_0x1d72('0xf')](_0x1d72('0x40'),_0x2dae51[_0x1d72('0x5')]),_0x2dae51);utils[_0x1d72('0x3')](util[_0x1d72('0xf')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x2dae51[_0x1d72('0x5')],_0x2dae51[_0x1d72('0x41')],_0x2dae51[_0x1d72('0x42')],_0x2dae51[_0x1d72('0x43')],_0x2dae51[_0x1d72('0x44')]));if(recordings[_0x2dae51[_0x1d72('0x45')]]&&transfers[_0x1d72('0x6')][_0x2dae51[_0x1d72('0x45')]]){transfers[_0x1d72('0x6')][_0x2dae51[_0x1d72('0x45')]][_0x1d72('0x46')]=!![];}}catch(_0x596b94){utils[_0x1d72('0x13')](util[_0x1d72('0xf')](_0x1d72('0x40'),_0x2dae51['uniqueid']),_0x596b94);}}; \ No newline at end of file +var _0xb995=['[%s][recordings][newchannel]','linkedid','exten','context','channel','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','[%s][recordings][hangup]','calleridnum','calleridname','connectedlinename','outbound','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','toLowerCase','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','blindtransfer','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','transfereruniqueid','recording','lodash','./utils','./transfers.controller','info','format','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','name','UserId','request','CreateVoiceRecording','newchannel','debug'];(function(_0x232c7b,_0x206995){var _0x323ca7=function(_0x7c8f85){while(--_0x7c8f85){_0x232c7b['push'](_0x232c7b['shift']());}};_0x323ca7(++_0x206995);}(_0xb995,0xb0));var _0x5b99=function(_0x3758dc,_0x2580bc){_0x3758dc=_0x3758dc-0x0;var _0x428332=_0xb995[_0x3758dc];return _0x428332;};'use strict';var _=require(_0x5b99('0x0'));var util=require('util');var utils=require(_0x5b99('0x1'));var transfers=require(_0x5b99('0x2'));var recordings={};function writeDB(_0x1e6401){var _0x3d8e1d;utils[_0x5b99('0x3')](util[_0x5b99('0x4')]('[%s][recordings][writeDB]',_0x1e6401[_0x5b99('0x5')]));if(transfers[_0x5b99('0x6')][_0x1e6401[_0x5b99('0x5')]]){_0x3d8e1d=_0x1e6401['uniqueid'];_0x1e6401['uniqueid']=transfers[_0x5b99('0x6')][_0x1e6401[_0x5b99('0x5')]][_0x5b99('0x7')];}if(_0x1e6401[_0x5b99('0x8')]){utils[_0x5b99('0x9')](_0x1e6401[_0x5b99('0x8')])['then'](function(_0x4a065c){if(_0x4a065c){_0x1e6401['membername']=_0x4a065c[_0x5b99('0xa')];_0x1e6401[_0x5b99('0xb')]=_0x4a065c['id'];}utils[_0x5b99('0xc')](_0x5b99('0xd'),_0x1e6401);});}else{utils['request']('CreateVoiceRecording',_0x1e6401);}if(_0x3d8e1d)delete transfers[_0x5b99('0x6')][_0x3d8e1d];}exports[_0x5b99('0xe')]=function(_0x37b236){try{utils[_0x5b99('0xf')](util[_0x5b99('0x4')](_0x5b99('0x10'),_0x37b236[_0x5b99('0x5')]),_0x37b236);if(_0x37b236['uniqueid']==_0x37b236[_0x5b99('0x11')]){utils[_0x5b99('0x3')](util['format']('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x37b236[_0x5b99('0x5')],_0x37b236['context'],_0x37b236[_0x5b99('0x12')]));recordings[_0x37b236[_0x5b99('0x5')]]={'uniqueid':_0x37b236['uniqueid'],'accountcode':_0x37b236[_0x5b99('0x8')],'exten':_0x37b236[_0x5b99('0x12')],'context':_0x37b236[_0x5b99('0x13')],'channel':_0x37b236[_0x5b99('0x14')],'monitors':[]};}}catch(_0x4c67dc){utils['error'](util[_0x5b99('0x4')]('[%s][recordings][newchannel]',_0x37b236[_0x5b99('0x5')]),_0x4c67dc);}};exports[_0x5b99('0x15')]=function(_0x46410f){try{utils[_0x5b99('0xf')](util[_0x5b99('0x4')](_0x5b99('0x16'),_0x46410f['uniqueid']),_0x46410f);if(!_[_0x5b99('0x17')](recordings[_0x46410f['uniqueid']])&&_0x46410f[_0x5b99('0x18')]==0x6){utils[_0x5b99('0x3')](util[_0x5b99('0x4')](_0x5b99('0x19'),_0x46410f['uniqueid'],_0x46410f[_0x5b99('0x13')],_0x46410f[_0x5b99('0x14')]));}else if(!_[_0x5b99('0x17')](recordings[_0x46410f[_0x5b99('0x11')]])&&_0x46410f['channelstate']==0x6&&_0x46410f[_0x5b99('0x13')]!=_0x5b99('0x1a')){utils[_0x5b99('0x3')](util[_0x5b99('0x4')](_0x5b99('0x1b'),_0x46410f[_0x5b99('0x5')],_0x46410f[_0x5b99('0x11')],_0x46410f['context'],_0x46410f[_0x5b99('0x14')]));recordings[_0x46410f['linkedid']][_0x5b99('0x8')]=_0x46410f[_0x5b99('0x8')];}}catch(_0x3959da){utils[_0x5b99('0x1c')](util[_0x5b99('0x4')]('[%s][recordings][newstate]',_0x46410f['uniqueid']),_0x3959da);}};exports[_0x5b99('0x1d')]=function(_0x8978e1){try{if(!_[_0x5b99('0x17')](_0x8978e1[_0x5b99('0x1e')])&&!_[_0x5b99('0x17')](_0x8978e1[_0x5b99('0x1e')][_0x5b99('0x1f')])){utils[_0x5b99('0xf')](util[_0x5b99('0x4')](_0x5b99('0x20'),_0x8978e1[_0x5b99('0x5')]),_0x8978e1);utils['info'](util[_0x5b99('0x4')](_0x5b99('0x21'),_0x8978e1[_0x5b99('0x5')],_0x8978e1[_0x5b99('0x1e')],_0x8978e1[_0x5b99('0x22')]));if(_[_0x5b99('0x23')](_0x8978e1[_0x5b99('0x22')],_0x5b99('0x24'))){_0x8978e1[_0x5b99('0x22')]=_0x8978e1[_0x5b99('0x22')][_0x5b99('0x25')](_0x5b99('0x24'),_0x5b99('0x26'));}if(recordings[_0x8978e1[_0x5b99('0x11')]]){var _0x4724fa=_[_0x5b99('0x27')](recordings[_0x8978e1[_0x5b99('0x11')]]['monitors'],{'value':_0x8978e1[_0x5b99('0x22')]});if(_[_0x5b99('0x17')](_0x4724fa)){recordings[_0x8978e1[_0x5b99('0x11')]][_0x5b99('0x28')]['push']({'value':_0x8978e1['value']});}}}}catch(_0x4e611e){utils['error'](util['format']('[%s][recordings][varset]',_0x8978e1[_0x5b99('0x5')]),_0x4e611e);}};exports['hangup']=function(_0x3da29e){try{if(!_[_0x5b99('0x17')](recordings[_0x3da29e[_0x5b99('0x5')]])){utils[_0x5b99('0xf')](util['format'](_0x5b99('0x29'),_0x3da29e[_0x5b99('0x5')]),_0x3da29e);utils[_0x5b99('0x3')](util[_0x5b99('0x4')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x3da29e[_0x5b99('0x5')],_0x3da29e[_0x5b99('0x2a')],_0x3da29e[_0x5b99('0x2b')],_0x3da29e['cause-txt']));recordings[_0x3da29e[_0x5b99('0x5')]][_0x5b99('0x2a')]=_0x3da29e[_0x5b99('0x2a')];recordings[_0x3da29e['uniqueid']][_0x5b99('0x2b')]=_0x3da29e[_0x5b99('0x2b')];recordings[_0x3da29e[_0x5b99('0x5')]]['connectedlinenum']=_0x3da29e['connectedlinenum'];recordings[_0x3da29e[_0x5b99('0x5')]][_0x5b99('0x2c')]=_0x3da29e[_0x5b99('0x2c')];if(recordings[_0x3da29e[_0x5b99('0x5')]]['type']==_0x5b99('0x2d')&&recordings[_0x3da29e[_0x5b99('0x5')]][_0x5b99('0x8')]){recordings[_0x3da29e[_0x5b99('0x5')]]['connectedlinenum']=recordings[_0x3da29e[_0x5b99('0x5')]]['accountcode'];recordings[_0x3da29e[_0x5b99('0x5')]]['connectedlinename']='';}recordings[_0x3da29e[_0x5b99('0x5')]][_0x5b99('0x28')]['forEach'](function(_0x309fb0){var _0xacc225=_[_0x5b99('0x2e')](recordings[_0x3da29e[_0x5b99('0x5')]]);_0xacc225[_0x5b99('0x22')]=_0x309fb0[_0x5b99('0x22')];writeDB(_0xacc225);});delete recordings[_0x3da29e[_0x5b99('0x5')]];}}catch(_0x5613b8){utils[_0x5b99('0x1c')](util['format']('[%s][recordings][hangup]',_0x3da29e[_0x5b99('0x5')]),_0x5613b8);}};exports['newexten']=function(_0xebf34b){try{if(!_[_0x5b99('0x17')](recordings[_0xebf34b[_0x5b99('0x5')]])){utils[_0x5b99('0xf')](util[_0x5b99('0x4')](_0x5b99('0x2f'),_0xebf34b['uniqueid']),_0xebf34b);utils[_0x5b99('0x3')](util[_0x5b99('0x4')](_0x5b99('0x30'),_0xebf34b[_0x5b99('0x5')],_0xebf34b['application'],_0xebf34b[_0x5b99('0x31')]));if(_0xebf34b['application'][_0x5b99('0x32')]()=='set'&&_['startsWith'](_0xebf34b['appdata'][_0x5b99('0x32')](),_0x5b99('0x33'))){var _0x3c97bb=_0xebf34b[_0x5b99('0x31')][_0x5b99('0x34')]('=');var _0x5a4077=_0x3c97bb[0x0]['substring'](_0x3c97bb[0x0][_0x5b99('0x35')]('(')+0x1,_0x3c97bb[0x0][_0x5b99('0x35')](')'));var _0x5e120f=_0x3c97bb[0x1];recordings[_0xebf34b[_0x5b99('0x5')]][_0x5a4077]=_0x5e120f;}}}catch(_0x27d8d9){utils[_0x5b99('0x1c')](util[_0x5b99('0x4')](_0x5b99('0x2f'),_0xebf34b[_0x5b99('0x5')]),_0x27d8d9);}};exports[_0x5b99('0x36')]=function(_0x12e520){try{if(!_[_0x5b99('0x17')](recordings[_0x12e520['uniqueid']])){utils[_0x5b99('0xf')](util[_0x5b99('0x4')](_0x5b99('0x37'),_0x12e520[_0x5b99('0x5')]),_0x12e520);utils['info'](util[_0x5b99('0x4')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x12e520[_0x5b99('0x5')],_0x12e520['queue']));recordings[_0x12e520[_0x5b99('0x5')]][_0x5b99('0x38')]=_0x12e520[_0x5b99('0x38')];}}catch(_0x2ee125){utils[_0x5b99('0x1c')](util[_0x5b99('0x4')](_0x5b99('0x37'),_0x12e520['uniqueid']),_0x2ee125);}};exports[_0x5b99('0x39')]=function(_0x1edb1d){try{utils['debug'](util[_0x5b99('0x4')]('[%s][recordings][blindtransfer]',_0x1edb1d[_0x5b99('0x5')]),_0x1edb1d);utils[_0x5b99('0x3')](util[_0x5b99('0x4')](_0x5b99('0x3a'),_0x1edb1d['uniqueid'],_0x1edb1d[_0x5b99('0x3b')],_0x1edb1d[_0x5b99('0x3c')],_0x1edb1d['transfereecalleridnum'],_0x1edb1d[_0x5b99('0x3d')]));if(recordings[_0x1edb1d[_0x5b99('0x3e')]]&&transfers[_0x5b99('0x6')][_0x1edb1d[_0x5b99('0x3e')]]){transfers[_0x5b99('0x6')][_0x1edb1d[_0x5b99('0x3e')]][_0x5b99('0x3f')]=!![];}}catch(_0x402f28){utils[_0x5b99('0x1c')](util[_0x5b99('0x4')]('[%s][recordings][blindtransfer]',_0x1edb1d['uniqueid']),_0x402f28);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 3359867..adfe0d8 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 _0xf725=['origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','error','lodash','util','./utils','type','attended','origtransfereruniqueid','request','CreateVoiceTransferReport','blindtransfer','format','[%s][transfers][blindtransfer]','uniqueid','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridname','blinds','transfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname','assign','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext'];(function(_0x2867d8,_0xef3ee0){var _0x3b8176=function(_0x2b9eb8){while(--_0x2b9eb8){_0x2867d8['push'](_0x2867d8['shift']());}};_0x3b8176(++_0xef3ee0);}(_0xf725,0xc6));var _0x5f72=function(_0x273403,_0x2d763c){_0x273403=_0x273403-0x0;var _0x368fc5=_0xf725[_0x273403];return _0x368fc5;};'use strict';var _=require(_0x5f72('0x0'));var util=require(_0x5f72('0x1'));var utils=require(_0x5f72('0x2'));function writeDB(_0x1a0577){utils['info'](util['format']('[%s][transfers][writeDB]\x20type:%s',_0x1a0577[_0x5f72('0x3')]===_0x5f72('0x4')?_0x1a0577[_0x5f72('0x5')]:_0x1a0577['uniqueid'],_0x1a0577[_0x5f72('0x3')]));utils[_0x5f72('0x6')](_0x5f72('0x7'),_0x1a0577);}exports['blinds']={};exports[_0x5f72('0x8')]=function(_0x422d83){try{utils['debug'](util[_0x5f72('0x9')](_0x5f72('0xa'),_0x422d83[_0x5f72('0xb')]),_0x422d83);utils[_0x5f72('0xc')](util[_0x5f72('0x9')](_0x5f72('0xd'),_0x422d83[_0x5f72('0xb')],_0x422d83['transferercalleridnum'],_0x422d83[_0x5f72('0xe')],_0x422d83['transfereecalleridnum'],_0x422d83[_0x5f72('0xf')]));_0x422d83[_0x5f72('0x3')]='blind';exports[_0x5f72('0x10')][_0x422d83[_0x5f72('0x11')]]=_0x422d83;writeDB(_0x422d83);}catch(_0x840a47){utils['error'](util[_0x5f72('0x9')](_0x5f72('0xa'),_0x422d83['uniqueid']),_0x840a47);}};exports['attendedtransfer']=function(_0x276218){try{utils['debug'](util[_0x5f72('0x9')]('[%s][transfers][attendedtransfer]',_0x276218[_0x5f72('0x5')]),_0x276218);utils[_0x5f72('0xc')](util[_0x5f72('0x9')](_0x5f72('0x12'),_0x276218[_0x5f72('0x5')],_0x276218[_0x5f72('0x13')],_0x276218['origtransferercalleridname'],_0x276218[_0x5f72('0x14')],_0x276218[_0x5f72('0x15')]));_0x276218=_[_0x5f72('0x16')](_0x276218,{'transfererchannel':_0x276218['origtransfererchannel'],'transferercalleridnum':_0x276218['origtransferercalleridnum'],'transferercalleridname':_0x276218['origtransferercalleridname'],'transfererconnectedlinenum':_0x276218[_0x5f72('0x17')],'transfererconnectedlinename':_0x276218[_0x5f72('0x18')],'transfereraccountcode':_0x276218[_0x5f72('0x19')],'transferercontext':_0x276218[_0x5f72('0x1a')],'transfererexten':_0x276218[_0x5f72('0x1b')],'transfererlinkedid':_0x276218[_0x5f72('0x1c')],'context':_0x276218[_0x5f72('0x1d')],'extension':_0x276218[_0x5f72('0x1e')],'type':_0x5f72('0x4')});if(_[_0x5f72('0x1f')](_0x276218[_0x5f72('0x20')])){_0x276218=_[_0x5f72('0x16')](_0x276218,{'transfereechannel':_0x276218[_0x5f72('0x21')],'transfereecalleridnum':_0x276218[_0x5f72('0x14')],'transfereecalleridname':_0x276218[_0x5f72('0x15')],'transfereeconnectedlinenum':_0x276218['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x276218[_0x5f72('0x22')],'transfereeaccountcode':_0x276218['transfertargetaccountcode'],'transfereecontext':_0x276218[_0x5f72('0x23')],'transfereeexten':_0x276218[_0x5f72('0x24')],'transfereelinkedid':_0x276218['transfertargetlinkedid']});}writeDB(_0x276218);}catch(_0x2f9bc3){utils[_0x5f72('0x25')](util['format']('[%s][transfers][attendedtransfer]',_0x276218[_0x5f72('0x5')]),_0x2f9bc3);}}; \ No newline at end of file +var _0xef2a=['secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','error','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','uniqueid','type','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','blind','transfereruniqueid','[%s][transfers][blindtransfer]','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname','origtransferercalleridname'];(function(_0x16374e,_0x24911b){var _0x3635c2=function(_0x553452){while(--_0x553452){_0x16374e['push'](_0x16374e['shift']());}};_0x3635c2(++_0x24911b);}(_0xef2a,0x88));var _0xaef2=function(_0x58e877,_0x73b061){_0x58e877=_0x58e877-0x0;var _0x48be62=_0xef2a[_0x58e877];return _0x48be62;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xaef2('0x0'));function writeDB(_0x3f2ce3){utils[_0xaef2('0x1')](util[_0xaef2('0x2')](_0xaef2('0x3'),_0x3f2ce3['type']===_0xaef2('0x4')?_0x3f2ce3[_0xaef2('0x5')]:_0x3f2ce3[_0xaef2('0x6')],_0x3f2ce3[_0xaef2('0x7')]));utils['request']('CreateVoiceTransferReport',_0x3f2ce3);}exports[_0xaef2('0x8')]={};exports[_0xaef2('0x9')]=function(_0x387124){try{utils[_0xaef2('0xa')](util['format']('[%s][transfers][blindtransfer]',_0x387124[_0xaef2('0x6')]),_0x387124);utils[_0xaef2('0x1')](util[_0xaef2('0x2')](_0xaef2('0xb'),_0x387124['uniqueid'],_0x387124['transferercalleridnum'],_0x387124[_0xaef2('0xc')],_0x387124[_0xaef2('0xd')],_0x387124['transfereecalleridname']));_0x387124['type']=_0xaef2('0xe');exports[_0xaef2('0x8')][_0x387124[_0xaef2('0xf')]]=_0x387124;writeDB(_0x387124);}catch(_0x54843d){utils['error'](util[_0xaef2('0x2')](_0xaef2('0x10'),_0x387124[_0xaef2('0x6')]),_0x54843d);}};exports[_0xaef2('0x11')]=function(_0x169b91){try{utils[_0xaef2('0xa')](util[_0xaef2('0x2')](_0xaef2('0x12'),_0x169b91['origtransfereruniqueid']),_0x169b91);utils[_0xaef2('0x1')](util['format'](_0xaef2('0x13'),_0x169b91[_0xaef2('0x5')],_0x169b91[_0xaef2('0x14')],_0x169b91['origtransferercalleridname'],_0x169b91[_0xaef2('0x15')],_0x169b91[_0xaef2('0x16')]));_0x169b91=_['assign'](_0x169b91,{'transfererchannel':_0x169b91['origtransfererchannel'],'transferercalleridnum':_0x169b91[_0xaef2('0x14')],'transferercalleridname':_0x169b91[_0xaef2('0x17')],'transfererconnectedlinenum':_0x169b91['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x169b91[_0xaef2('0x18')],'transfereraccountcode':_0x169b91[_0xaef2('0x19')],'transferercontext':_0x169b91[_0xaef2('0x1a')],'transfererexten':_0x169b91[_0xaef2('0x1b')],'transfererlinkedid':_0x169b91[_0xaef2('0x1c')],'context':_0x169b91[_0xaef2('0x1d')],'extension':_0x169b91['origtransfererexten'],'type':_0xaef2('0x4')});if(_[_0xaef2('0x1e')](_0x169b91[_0xaef2('0x1f')])){_0x169b91=_[_0xaef2('0x20')](_0x169b91,{'transfereechannel':_0x169b91[_0xaef2('0x21')],'transfereecalleridnum':_0x169b91[_0xaef2('0x15')],'transfereecalleridname':_0x169b91[_0xaef2('0x16')],'transfereeconnectedlinenum':_0x169b91[_0xaef2('0x22')],'transfereeconnectedlinename':_0x169b91['transfertargetconnectedlinename'],'transfereeaccountcode':_0x169b91[_0xaef2('0x23')],'transfereecontext':_0x169b91[_0xaef2('0x24')],'transfereeexten':_0x169b91[_0xaef2('0x25')],'transfereelinkedid':_0x169b91[_0xaef2('0x26')]});}writeDB(_0x169b91);}catch(_0x402c45){utils[_0xaef2('0x27')](util[_0xaef2('0x2')](_0xaef2('0x12'),_0x169b91[_0xaef2('0x5')]),_0x402c45);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 65950dd..f7ed421 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 _0xc7b4=['length','getUserByInternal','info','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','seconds','diffTime','diff','sumTime','isAfter','isBefore','bluebird','moment','util','client','xdr','debug','inspect','error','request','then','catch','[utils][request]\x20name:%s','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result'];(function(_0x2cbb0b,_0x126f29){var _0x4d5936=function(_0x3de0ec){while(--_0x3de0ec){_0x2cbb0b['push'](_0x2cbb0b['shift']());}};_0x4d5936(++_0x126f29);}(_0xc7b4,0x1cd));var _0x4c7b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7b4[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x4c7b('0x0'));var jayson=require('jayson/promise');var moment=require(_0x4c7b('0x1'));var util=require(_0x4c7b('0x2'));var client=jayson[_0x4c7b('0x3')]['http']({'port':0x2329});var logger=require('../../config/logger')(_0x4c7b('0x4'));exports['info']=function(_0x3936f3,_0x343ce5){logger['info'](_0x3936f3,_0x343ce5?util['inspect'](_0x343ce5,{'showHidden':![],'depth':null}):'');};exports[_0x4c7b('0x5')]=function(_0x507668,_0x1fc67e){logger[_0x4c7b('0x5')](_0x507668,_0x1fc67e?util[_0x4c7b('0x6')](_0x1fc67e,{'showHidden':![],'depth':null}):'');};exports[_0x4c7b('0x7')]=function(_0x15022d,_0x11c2d5){logger[_0x4c7b('0x7')](_0x15022d,_0x11c2d5?util[_0x4c7b('0x6')](_0x11c2d5,{'showHidden':![],'depth':null}):'');};exports[_0x4c7b('0x8')]=function(_0x3daff3,_0x9c4421){return client[_0x4c7b('0x8')](_0x3daff3,{'body':_0x9c4421})[_0x4c7b('0x9')](function(_0x21c790){logger['debug']('[utils][request]\x20name:%s',_0x3daff3,_0x21c790?util[_0x4c7b('0x6')](_0x21c790,{'showHidden':![],'depth':null}):'');})[_0x4c7b('0xa')](function(_0x469d31){logger[_0x4c7b('0x7')](_0x4c7b('0xb'),_0x3daff3,_0x469d31?util['inspect'](_0x469d31,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3df964){return client[_0x4c7b('0x8')](_0x4c7b('0xc'),{'options':{'raw':!![],'attributes':['id',_0x4c7b('0xd'),_0x4c7b('0xe'),_0x4c7b('0xf')],'where':_0x3df964,'limit':0x1}})['then'](function(_0x3820a0){logger[_0x4c7b('0x5')](_0x4c7b('0x10'),JSON[_0x4c7b('0x11')](_0x3df964),_0x3820a0?util[_0x4c7b('0x6')](_0x3820a0,{'showHidden':![],'depth':null}):'');return _0x3820a0[_0x4c7b('0x12')][_0x4c7b('0x13')]?_0x3820a0[_0x4c7b('0x12')][0x0]:null;});}exports[_0x4c7b('0x14')]=function(_0x5777cd){return new BPromise(function(_0x31eb05,_0x3a0c69){if(_0x5777cd){return getUser({'internal':_0x5777cd})[_0x4c7b('0x9')](function(_0x225890){logger[_0x4c7b('0x15')](_0x4c7b('0x16'),_0x5777cd,_0x225890?'found':_0x4c7b('0x17'));return _0x31eb05(_0x225890);})[_0x4c7b('0xa')](function(_0x2584c3){logger['error']('[utils][getUserByInternal]',_0x2584c3?util[_0x4c7b('0x6')](_0x2584c3,{'showHidden':![],'depth':null}):'');return _0x31eb05(null);});}return _0x31eb05(null);});};exports[_0x4c7b('0x18')]=function(_0x405d9d){return new BPromise(function(_0x5c759e,_0x2e30d0){if(_0x405d9d){return getUser({'interface':_0x405d9d})['then'](function(_0x23dae1){logger['info'](_0x4c7b('0x19'),_0x405d9d,_0x23dae1?_0x4c7b('0x1a'):_0x4c7b('0x17'));return _0x5c759e(_0x23dae1);})[_0x4c7b('0xa')](function(_0x1918cb){logger[_0x4c7b('0x7')](_0x4c7b('0x1b'),_0x1918cb?util[_0x4c7b('0x6')](_0x1918cb,{'showHidden':![],'depth':null}):'');return _0x5c759e(null);});}return _0x5c759e(null);});};exports[_0x4c7b('0x1c')]=function(_0x4c9754){return new BPromise(function(_0x5aac6f,_0x1e2a19){if(_0x4c9754){return getUser({'name':_0x4c9754})['then'](function(_0x10a19f){logger[_0x4c7b('0x15')]('[utils][getUserByName]\x20name:%s\x20%s',_0x4c9754,_0x10a19f?'found':_0x4c7b('0x17'));return _0x5aac6f(_0x10a19f);})[_0x4c7b('0xa')](function(_0x2920c1){logger[_0x4c7b('0x7')]('[utils][getUserByName]',_0x2920c1?util[_0x4c7b('0x6')](_0x2920c1,{'showHidden':![],'depth':null}):'');return _0x5aac6f(null);});}return _0x5aac6f(null);});};exports[_0x4c7b('0x1d')]=function(_0x5932e9){return new BPromise(function(_0x26dc65,_0x245bf4){if(_0x5932e9){return client[_0x4c7b('0x8')](_0x4c7b('0x1e'),{'options':{'raw':!![],'attributes':['id','name',_0x4c7b('0x1f'),_0x4c7b('0x20'),_0x4c7b('0x21')],'where':{'name':_0x5932e9},'limit':0x1}})[_0x4c7b('0x9')](function(_0x3507f4){logger[_0x4c7b('0x5')](_0x4c7b('0x22'),_0x5932e9,_0x3507f4?util['inspect'](_0x3507f4,{'showHidden':![],'depth':null}):'');logger['info'](_0x4c7b('0x23'),_0x5932e9,_0x3507f4?'found':_0x4c7b('0x17'));return _0x26dc65(_0x3507f4[_0x4c7b('0x12')]['length']?_0x3507f4[_0x4c7b('0x12')][0x0]:null);})['catch'](function(_0x1edbc1){logger[_0x4c7b('0x7')](_0x4c7b('0x24'),_0x1edbc1?util[_0x4c7b('0x6')](_0x1edbc1,{'showHidden':![],'depth':null}):'');return _0x26dc65(null);});}return _0x26dc65(null);});};exports[_0x4c7b('0x25')]=function(_0x1e94fe,_0x35861f){return moment(_0x1e94fe)[_0x4c7b('0x26')](_0x35861f,'seconds')[_0x4c7b('0x27')](_0x4c7b('0x28'));};exports[_0x4c7b('0x29')]=function(_0x35cff9,_0x2bc5b7){return moment(_0x35cff9)['subtract'](_0x2bc5b7,_0x4c7b('0x2a'))[_0x4c7b('0x27')](_0x4c7b('0x28'));};exports[_0x4c7b('0x2b')]=function(_0x44d3b4,_0xbed40d){return moment(_0x44d3b4)[_0x4c7b('0x2c')](moment(_0xbed40d),_0x4c7b('0x2a'));};exports[_0x4c7b('0x2d')]=function(_0x510e38,_0x29cae3){return parseInt(_0x510e38,0xa)+parseInt(_0x29cae3,0xa);};exports['now']=function(){return moment()[_0x4c7b('0x27')](_0x4c7b('0x28'));};exports[_0x4c7b('0x2e')]=function(_0x44938c,_0x2fa237){if(_0x2fa237){return moment(_0x44938c)[_0x4c7b('0x2e')](_0x2fa237);}return!![];};exports[_0x4c7b('0x2f')]=function(_0x137684,_0x494255){if(_0x494255){return moment(_0x137684)[_0x4c7b('0x2f')](_0x494255);}else if(_0x137684){return!![];}return![];}; \ No newline at end of file +var _0x92f3=['internal','name','then','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','notfound','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','info','inspect','debug','error','request','[utils][request]\x20name:%s','catch','GetUser'];(function(_0x28f4ad,_0x2cf8f4){var _0x6cb4ce=function(_0x16866c){while(--_0x16866c){_0x28f4ad['push'](_0x28f4ad['shift']());}};_0x6cb4ce(++_0x2cf8f4);}(_0x92f3,0xf0));var _0x392f=function(_0x7b102d,_0x414b58){_0x7b102d=_0x7b102d-0x0;var _0x235e07=_0x92f3[_0x7b102d];return _0x235e07;};'use strict';var BPromise=require(_0x392f('0x0'));var jayson=require(_0x392f('0x1'));var moment=require(_0x392f('0x2'));var util=require(_0x392f('0x3'));var client=jayson[_0x392f('0x4')][_0x392f('0x5')]({'port':0x2329});var logger=require(_0x392f('0x6'))('xdr');exports[_0x392f('0x7')]=function(_0x9ccaa6,_0x123a70){logger[_0x392f('0x7')](_0x9ccaa6,_0x123a70?util[_0x392f('0x8')](_0x123a70,{'showHidden':![],'depth':null}):'');};exports[_0x392f('0x9')]=function(_0x3c4297,_0x1a7a10){logger[_0x392f('0x9')](_0x3c4297,_0x1a7a10?util[_0x392f('0x8')](_0x1a7a10,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x3c7d85,_0x4b15c0){logger[_0x392f('0xa')](_0x3c7d85,_0x4b15c0?util['inspect'](_0x4b15c0,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x2f726f,_0x28ffae){return client[_0x392f('0xb')](_0x2f726f,{'body':_0x28ffae})['then'](function(_0x58d362){logger[_0x392f('0x9')](_0x392f('0xc'),_0x2f726f,_0x58d362?util['inspect'](_0x58d362,{'showHidden':![],'depth':null}):'');})[_0x392f('0xd')](function(_0x155273){logger['error'](_0x392f('0xc'),_0x2f726f,_0x155273?util[_0x392f('0x8')](_0x155273,{'showHidden':![],'depth':null}):'');});};function getUser(_0x597a32){return client[_0x392f('0xb')](_0x392f('0xe'),{'options':{'raw':!![],'attributes':['id',_0x392f('0xf'),_0x392f('0x10'),'interface'],'where':_0x597a32,'limit':0x1}})[_0x392f('0x11')](function(_0x3f0f0e){logger[_0x392f('0x9')](_0x392f('0x12'),JSON[_0x392f('0x13')](_0x597a32),_0x3f0f0e?util[_0x392f('0x8')](_0x3f0f0e,{'showHidden':![],'depth':null}):'');return _0x3f0f0e['result'][_0x392f('0x14')]?_0x3f0f0e[_0x392f('0x15')][0x0]:null;});}exports[_0x392f('0x16')]=function(_0x44d877){return new BPromise(function(_0x6dd67b,_0x2cc955){if(_0x44d877){return getUser({'internal':_0x44d877})['then'](function(_0x110a40){logger[_0x392f('0x7')](_0x392f('0x17'),_0x44d877,_0x110a40?'found':'notfound');return _0x6dd67b(_0x110a40);})[_0x392f('0xd')](function(_0xc60426){logger[_0x392f('0xa')]('[utils][getUserByInternal]',_0xc60426?util[_0x392f('0x8')](_0xc60426,{'showHidden':![],'depth':null}):'');return _0x6dd67b(null);});}return _0x6dd67b(null);});};exports[_0x392f('0x18')]=function(_0x3d9b6c){return new BPromise(function(_0x1ac696,_0x5d155b){if(_0x3d9b6c){return getUser({'interface':_0x3d9b6c})[_0x392f('0x11')](function(_0x1df5a4){logger[_0x392f('0x7')](_0x392f('0x19'),_0x3d9b6c,_0x1df5a4?_0x392f('0x1a'):'notfound');return _0x1ac696(_0x1df5a4);})[_0x392f('0xd')](function(_0x238f76){logger[_0x392f('0xa')](_0x392f('0x1b'),_0x238f76?util[_0x392f('0x8')](_0x238f76,{'showHidden':![],'depth':null}):'');return _0x1ac696(null);});}return _0x1ac696(null);});};exports[_0x392f('0x1c')]=function(_0x2b5253){return new BPromise(function(_0x273f70,_0x5e8ad4){if(_0x2b5253){return getUser({'name':_0x2b5253})['then'](function(_0x1d6f8c){logger[_0x392f('0x7')]('[utils][getUserByName]\x20name:%s\x20%s',_0x2b5253,_0x1d6f8c?_0x392f('0x1a'):_0x392f('0x1d'));return _0x273f70(_0x1d6f8c);})[_0x392f('0xd')](function(_0xed9f61){logger['error'](_0x392f('0x1e'),_0xed9f61?util[_0x392f('0x8')](_0xed9f61,{'showHidden':![],'depth':null}):'');return _0x273f70(null);});}return _0x273f70(null);});};exports[_0x392f('0x1f')]=function(_0x3d78bd){return new BPromise(function(_0xc15fee,_0x59c87f){if(_0x3d78bd){return client['request'](_0x392f('0x20'),{'options':{'raw':!![],'attributes':['id',_0x392f('0x10'),_0x392f('0x21'),_0x392f('0x22'),_0x392f('0x23')],'where':{'name':_0x3d78bd},'limit':0x1}})[_0x392f('0x11')](function(_0x5c54a7){logger[_0x392f('0x9')](_0x392f('0x24'),_0x3d78bd,_0x5c54a7?util[_0x392f('0x8')](_0x5c54a7,{'showHidden':![],'depth':null}):'');logger['info'](_0x392f('0x25'),_0x3d78bd,_0x5c54a7?_0x392f('0x1a'):_0x392f('0x1d'));return _0xc15fee(_0x5c54a7[_0x392f('0x15')][_0x392f('0x14')]?_0x5c54a7[_0x392f('0x15')][0x0]:null);})['catch'](function(_0x292d0f){logger[_0x392f('0xa')]('[utils][getVoiceQueueByName]',_0x292d0f?util[_0x392f('0x8')](_0x292d0f,{'showHidden':![],'depth':null}):'');return _0xc15fee(null);});}return _0xc15fee(null);});};exports[_0x392f('0x26')]=function(_0x553451,_0x588a35){return moment(_0x553451)[_0x392f('0x27')](_0x588a35,'seconds')[_0x392f('0x28')](_0x392f('0x29'));};exports[_0x392f('0x2a')]=function(_0x23aaad,_0x3558ce){return moment(_0x23aaad)[_0x392f('0x2b')](_0x3558ce,_0x392f('0x2c'))[_0x392f('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x392f('0x2d')]=function(_0x5c70b4,_0x5bae68){return moment(_0x5c70b4)[_0x392f('0x2e')](moment(_0x5bae68),_0x392f('0x2c'));};exports[_0x392f('0x2f')]=function(_0x59ed43,_0x168896){return parseInt(_0x59ed43,0xa)+parseInt(_0x168896,0xa);};exports[_0x392f('0x30')]=function(){return moment()[_0x392f('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x392f('0x31')]=function(_0x65c7f3,_0x5de4b9){if(_0x5de4b9){return moment(_0x65c7f3)[_0x392f('0x31')](_0x5de4b9);}return!![];};exports[_0x392f('0x32')]=function(_0x5839e4,_0x24c833){if(_0x24c833){return moment(_0x5839e4)[_0x392f('0x32')](_0x24c833);}else if(_0x5839e4){return!![];}return![];}; \ No newline at end of file